@uniformdev/context 12.2.1-alpha.141 → 12.2.1-alpha.171

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/cli.mjs CHANGED
@@ -1,13 +1,13 @@
1
- import{b as Ve,d as Ge}from"../chunk-WLJXJJSU.mjs";import{a as Ct}from"../chunk-TRWANXVF.mjs";import{notStrictEqual as Ai,strictEqual as xi}from"assert";var ti={right:ri,center:oi},ei=0,le=1,ni=2,fe=3,Ke=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(`
2
- `).map(i=>i.split(" ")),n=0;return e.forEach(i=>{i.length>1&&ft.stringWidth(i[0])>n&&(n=Math.min(Math.floor(this.width*.5),ft.stringWidth(i[0])))}),e.forEach(i=>{this.div(...i.map((o,a)=>({text:o.trim(),padding:this.measurePadding(o),width:a===0&&i.length>1?n:void 0})))}),this.rows[this.rows.length-1]}colFromString(t){return{text:t,padding:this.measurePadding(t)}}measurePadding(t){let e=ft.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(`
3
- `)}rowToString(t,e){return this.rasterize(t).forEach((n,i)=>{let o="";n.forEach((a,f)=>{let{width:m}=t[f],_=this.negatePadding(t[f]),b=a;_>ft.stringWidth(a)&&(b+=" ".repeat(_-ft.stringWidth(a))),t[f].align&&t[f].align!=="left"&&this.wrap&&(b=ti[t[f].align](b,_),ft.stringWidth(b)<_&&(b+=" ".repeat((m||0)-ft.stringWidth(b)-1)));let c=t[f].padding||[0,0,0,0];c[fe]&&(o+=" ".repeat(c[fe])),o+=Je(t[f],b,"| "),o+=b,o+=Je(t[f],b," |"),c[le]&&(o+=" ".repeat(c[le])),i===0&&e.length>0&&(o=this.renderInline(o,e[e.length-1]))}),e.push({text:o.replace(/ +$/,""),span:t.span})}),e}renderInline(t,e){let n=t.match(/^ */),i=n?n[0].length:0,o=e.text,a=ft.stringWidth(o.trimRight());return e.span?this.wrap?i<a?t:(e.hidden=!0,o.trimRight()+" ".repeat(i-a)+t.trimLeft()):(e.hidden=!0,o+t):t}rasterize(t){let e=[],n=this.columnWidths(t),i;return t.forEach((o,a)=>{o.width=n[a],this.wrap?i=ft.wrap(o.text,this.negatePadding(o),{hard:!0}).split(`
4
- `):i=o.text.split(`
5
- `),o.border&&(i.unshift("."+"-".repeat(this.negatePadding(o)+2)+"."),i.push("'"+"-".repeat(this.negatePadding(o)+2)+"'")),o.padding&&(i.unshift(...new Array(o.padding[ei]||0).fill("")),i.push(...new Array(o.padding[ni]||0).fill(""))),i.forEach((f,m)=>{e[m]||e.push([]);let _=e[m];for(let b=0;b<a;b++)_[b]===void 0&&_.push("");_.push(f)})}),e}negatePadding(t){let e=t.width||0;return t.padding&&(e-=(t.padding[fe]||0)+(t.padding[le]||0)),t.border&&(e-=4),e}columnWidths(t){if(!this.wrap)return t.map(a=>a.width||ft.stringWidth(a.text));let e=t.length,n=this.width,i=t.map(a=>{if(a.width)return e--,n-=a.width,a.width}),o=e?Math.floor(n/e):0;return i.map((a,f)=>a===void 0?Math.max(o,ii(t[f])):a)}};function Je(s,t,e){return s.border?/[.']-+[.']/.test(t)?"":t.trim().length!==0?e:" ":""}function ii(s){let t=s.padding||[],e=1+(t[fe]||0)+(t[le]||0);return s.border?e+4:e}function si(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function ri(s,t){s=s.trim();let e=ft.stringWidth(s);return e<t?" ".repeat(t-e)+s:s}function oi(s,t){s=s.trim();let e=ft.stringWidth(s);return e>=t?s:" ".repeat(t-e>>1)+s}var ft;function Qe(s,t){return ft=t,new Ke({width:(s==null?void 0:s.width)||si(),wrap:s==null?void 0:s.wrap})}var Ze=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function xe(s){return s.replace(Ze,"")}function Xe(s,t){let[e,n]=s.match(Ze)||["",""];s=xe(s);let i="";for(let o=0;o<s.length;o++)o!==0&&o%t===0&&(i+=`
6
- `),i+=s.charAt(o);return e&&n&&(i=`${e}${i}${n}`),i}function Pe(s){return Qe(s,{stringWidth:t=>[...t].length,stripAnsi:xe,wrap:Xe})}import{dirname as ke,resolve as tn}from"path";import{readdirSync as ai,statSync as li}from"fs";function en(s,t){let e=tn(".",s),n;for(li(e).isDirectory()||(e=ke(e));;){if(n=t(e,ai(e)),n)return tn(e,n);if(e=ke(n=e),n===e)break}}import{inspect as Pi}from"util";import{readFileSync as Si}from"fs";import{fileURLToPath as Mi}from"url";import{format as hi}from"util";import{normalize as ui,resolve as di}from"path";function zt(s){if(s!==s.toLowerCase()&&s!==s.toUpperCase()||(s=s.toLowerCase()),s.indexOf("-")===-1&&s.indexOf("_")===-1)return s;{let e="",n=!1,i=s.match(/^-+/);for(let o=i?i[0].length:0;o<s.length;o++){let a=s.charAt(o);n&&(n=!1,a=a.toUpperCase()),o!==0&&(a==="-"||a==="_")?n=!0:a!=="-"&&a!=="_"&&(e+=a)}return e}}function ce(s,t){let e=s.toLowerCase();t=t||"-";let n="";for(let i=0;i<s.length;i++){let o=e.charAt(i),a=s.charAt(i);o!==a&&i>0?n+=`${t}${e.charAt(i)}`:n+=a}return n}function he(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 nn(s){if(Array.isArray(s))return s.map(a=>typeof a!="string"?a+"":a);s=s.trim();let t=0,e=null,n=null,i=null,o=[];for(let a=0;a<s.length;a++){if(e=n,n=s.charAt(a),n===" "&&!i){e!==" "&&t++;continue}n===i?i=null:(n==="'"||n==='"')&&!i&&(i=n),o[t]||(o[t]=""),o[t]+=n}return o}var dt;(function(s){s.BOOLEAN="boolean",s.STRING="string",s.NUMBER="number",s.ARRAY="array"})(dt||(dt={}));var Pt,Se=class{constructor(t){Pt=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),i=nn(t),o=typeof t=="string",a=fi(Object.assign(Object.create(null),n.alias)),f=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),_=n.configObjects||[],b=n.envPrefix,c=f["populate--"],g=c?"--":"_",w=Object.create(null),M=Object.create(null),y=n.__||Pt.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:[]},U=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,v=new RegExp("^--"+f["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(l){let u=typeof l=="object"?l.key:l,O=Object.keys(l).map(function(p){return{boolean:"bools",string:"strings",number:"numbers"}[p]}).filter(Boolean).pop();O&&(d[O][u]=!0),d.arrays[u]=!0,d.keys.push(u)}),[].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,u])=>{typeof u=="number"&&(d.nargs[l]=u,d.keys.push(l))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([l,u])=>{typeof u=="function"&&(d.coercions[l]=u,d.keys.push(l))}),typeof n.config!="undefined"&&(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,u])=>{(typeof u=="boolean"||typeof u=="function")&&(d.configs[l]=u)})),Ut(n.key,a,n.default,d.arrays),Object.keys(m).forEach(function(l){(d.aliases[l]||[]).forEach(function(u){m[u]=m[l]})});let B=null;ae();let Y=[],q=Object.assign(Object.create(null),{_:[]}),St={};for(let l=0;l<i.length;l++){let u=i[l],O=u.replace(/^-{3,}/,"---"),p,h,P,j,I,rt;if(u!=="--"&&X(u))_t(u);else if(O.match(/---+(=|$)/)){_t(u);continue}else if(u.match(/^--.+=/)||!f["short-option-groups"]&&u.match(/^-.+=/))j=u.match(/^--?([^=]+)=([\s\S]*)$/),j!==null&&Array.isArray(j)&&j.length>=3&&(N(j[1],d.arrays)?l=Wt(l,j[1],i,j[2]):N(j[1],d.nargs)!==!1?l=Zt(l,j[1],i,j[2]):V(j[1],j[2],!0));else if(u.match(v)&&f["boolean-negation"])j=u.match(v),j!==null&&Array.isArray(j)&&j.length>=2&&(h=j[1],V(h,N(h,d.arrays)?[!1]:!1));else if(u.match(/^--.+/)||!f["short-option-groups"]&&u.match(/^-[^-]+/))j=u.match(/^--?(.+)/),j!==null&&Array.isArray(j)&&j.length>=2&&(h=j[1],N(h,d.arrays)?l=Wt(l,h,i):N(h,d.nargs)!==!1?l=Zt(l,h,i):(I=i[l+1],I!==void 0&&(!I.match(/^-/)||I.match(U))&&!N(h,d.bools)&&!N(h,d.counts)||/^(true|false)$/.test(I)?(V(h,I),l++):V(h,k(h))));else if(u.match(/^-.\..+=/))j=u.match(/^-([^=]+)=([\s\S]*)$/),j!==null&&Array.isArray(j)&&j.length>=3&&V(j[1],j[2]);else if(u.match(/^-.\..+/)&&!u.match(U))I=i[l+1],j=u.match(/^-(.\..+)/),j!==null&&Array.isArray(j)&&j.length>=2&&(h=j[1],I!==void 0&&!I.match(/^-/)&&!N(h,d.bools)&&!N(h,d.counts)?(V(h,I),l++):V(h,k(h)));else if(u.match(/^-[^-]+/)&&!u.match(U)){P=u.slice(1,-1).split(""),p=!1;for(let at=0;at<P.length;at++){if(I=u.slice(at+2),P[at+1]&&P[at+1]==="="){rt=u.slice(at+3),h=P[at],N(h,d.arrays)?l=Wt(l,h,i,rt):N(h,d.nargs)!==!1?l=Zt(l,h,i,rt):V(h,rt),p=!0;break}if(I==="-"){V(P[at],I);continue}if(/[A-Za-z]/.test(P[at])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(I)&&N(I,d.bools)===!1){V(P[at],I),p=!0;break}if(P[at+1]&&P[at+1].match(/\W/)){V(P[at],I),p=!0;break}else V(P[at],k(P[at]))}h=u.slice(-1)[0],!p&&h!=="-"&&(N(h,d.arrays)?l=Wt(l,h,i):N(h,d.nargs)!==!1?l=Zt(l,h,i):(I=i[l+1],I!==void 0&&(!/^(-|--)[^-]/.test(I)||I.match(U))&&!N(h,d.bools)&&!N(h,d.counts)||/^(true|false)$/.test(I)?(V(h,I),l++):V(h,k(h))))}else if(u.match(/^-[0-9]$/)&&u.match(U)&&N(u.slice(1),d.bools))h=u.slice(1),V(h,k(h));else if(u==="--"){Y=i.slice(l+1);break}else if(f["halt-at-non-option"]){Y=i.slice(l);break}else _t(u)}H(q,!0),H(q,!1),W(q),et(),Z(q,d.aliases,m,!0),st(q),f["set-placeholder-key"]&&Lt(q),Object.keys(d.counts).forEach(function(l){At(q,l.split("."))||V(l,0)}),c&&Y.length&&(q[g]=[]),Y.forEach(function(l){q[g].push(l)}),f["camel-case-expansion"]&&f["strip-dashed"]&&Object.keys(q).filter(l=>l!=="--"&&l.includes("-")).forEach(l=>{delete q[l]}),f["strip-aliased"]&&[].concat(...Object.keys(a).map(l=>a[l])).forEach(l=>{f["camel-case-expansion"]&&l.includes("-")&&delete q[l.split(".").map(u=>zt(u)).join(".")],delete q[l]});function _t(l){let u=$("_",l);(typeof u=="string"||typeof u=="number")&&q._.push(u)}function Zt(l,u,O,p){let h,P=N(u,d.nargs);if(P=typeof P!="number"||isNaN(P)?1:P,P===0)return wt(p)||(B=Error(y("Argument unexpected for: %s",u))),V(u,k(u)),l;let j=wt(p)?0:1;if(f["nargs-eats-options"])O.length-(l+1)+j<P&&(B=Error(y("Not enough arguments following: %s",u))),j=P;else{for(h=l+1;h<O.length&&(!O[h].match(/^-[^0-9]/)||O[h].match(U)||X(O[h]));h++)j++;j<P&&(B=Error(y("Not enough arguments following: %s",u)))}let I=Math.min(j,P);for(!wt(p)&&I>0&&(V(u,p),I--),h=l+1;h<I+l+1;h++)V(u,O[h]);return l+I}function Wt(l,u,O,p){let h=[],P=p||O[l+1],j=N(u,d.nargs);if(N(u,d.bools)&&!/^(true|false)$/.test(P))h.push(!0);else if(wt(P)||wt(p)&&/^-/.test(P)&&!U.test(P)&&!X(P)){if(m[u]!==void 0){let I=m[u];h=Array.isArray(I)?I:[I]}}else{wt(p)||h.push(C(u,p,!0));for(let I=l+1;I<O.length&&!(!f["greedy-arrays"]&&h.length>0||j&&typeof j=="number"&&h.length>=j||(P=O[I],/^-/.test(P)&&!U.test(P)&&!X(P)));I++)l=I,h.push(C(u,P,o))}return typeof j=="number"&&(j&&h.length<j||isNaN(j)&&h.length===0)&&(B=Error(y("Not enough arguments following: %s",u))),V(u,h),l}function V(l,u,O=o){if(/-/.test(l)&&f["camel-case-expansion"]){let P=l.split(".").map(function(j){return zt(j)}).join(".");x(l,P)}let p=C(l,u,O),h=l.split(".");xt(q,h,p),d.aliases[l]&&d.aliases[l].forEach(function(P){let j=P.split(".");xt(q,j,p)}),h.length>1&&f["dot-notation"]&&(d.aliases[h[0]]||[]).forEach(function(P){let j=P.split("."),I=[].concat(h);I.shift(),j=j.concat(I),(d.aliases[l]||[]).includes(j.join("."))||xt(q,j,p)}),N(l,d.normalize)&&!N(l,d.arrays)&&[l].concat(d.aliases[l]||[]).forEach(function(j){Object.defineProperty(St,j,{enumerable:!0,get(){return u},set(I){u=typeof I=="string"?Pt.normalize(I):I}})})}function x(l,u){d.aliases[l]&&d.aliases[l].length||(d.aliases[l]=[u],w[u]=!0),d.aliases[u]&&d.aliases[u].length||x(u,l)}function C(l,u,O){O&&(u=ci(u)),(N(l,d.bools)||N(l,d.counts))&&typeof u=="string"&&(u=u==="true");let p=Array.isArray(u)?u.map(function(h){return $(l,h)}):$(l,u);return N(l,d.counts)&&(wt(p)||typeof p=="boolean")&&(p=Me()),N(l,d.normalize)&&N(l,d.arrays)&&(Array.isArray(u)?p=u.map(h=>Pt.normalize(h)):p=Pt.normalize(u)),p}function $(l,u){return!f["parse-positional-numbers"]&&l==="_"||!N(l,d.strings)&&!N(l,d.bools)&&!Array.isArray(u)&&(he(u)&&f["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${u}`)))||!wt(u)&&N(l,d.numbers))&&(u=Number(u)),u}function W(l){let u=Object.create(null);Z(u,d.aliases,m),Object.keys(d.configs).forEach(function(O){let p=l[O]||u[O];if(p)try{let h=null,P=Pt.resolve(Pt.cwd(),p),j=d.configs[O];if(typeof j=="function"){try{h=j(P)}catch(I){h=I}if(h instanceof Error){B=h;return}}else h=Pt.require(P);G(h)}catch(h){h.name==="PermissionDenied"?B=h:l[O]&&(B=Error(y("Invalid JSON config file: %s",p)))}})}function G(l,u){Object.keys(l).forEach(function(O){let p=l[O],h=u?u+"."+O:O;typeof p=="object"&&p!==null&&!Array.isArray(p)&&f["dot-notation"]?G(p,h):(!At(q,h.split("."))||N(h,d.arrays)&&f["combine-arrays"])&&V(h,p)})}function et(){typeof _!="undefined"&&_.forEach(function(l){G(l)})}function H(l,u){if(typeof b=="undefined")return;let O=typeof b=="string"?b:"",p=Pt.env();Object.keys(p).forEach(function(h){if(O===""||h.lastIndexOf(O,0)===0){let P=h.split("__").map(function(j,I){return I===0&&(j=j.substring(O.length)),zt(j)});(u&&d.configs[P.join(".")]||!u)&&!At(l,P)&&V(P.join("."),p[h])}})}function st(l){let u,O=new Set;Object.keys(l).forEach(function(p){if(!O.has(p)&&(u=N(p,d.coercions),typeof u=="function"))try{let h=$(p,u(l[p]));[].concat(d.aliases[p]||[],p).forEach(P=>{O.add(P),l[P]=h})}catch(h){B=h}})}function Lt(l){return d.keys.forEach(u=>{~u.indexOf(".")||typeof l[u]=="undefined"&&(l[u]=void 0)}),l}function Z(l,u,O,p=!1){Object.keys(O).forEach(function(h){At(l,h.split("."))||(xt(l,h.split("."),O[h]),p&&(M[h]=!0),(u[h]||[]).forEach(function(P){At(l,P.split("."))||xt(l,P.split("."),O[h])}))})}function At(l,u){let O=l;f["dot-notation"]||(u=[u.join(".")]),u.slice(0,-1).forEach(function(h){O=O[h]||{}});let p=u[u.length-1];return typeof O!="object"?!1:p in O}function xt(l,u,O){let p=l;f["dot-notation"]||(u=[u.join(".")]),u.slice(0,-1).forEach(function(rt){rt=sn(rt),typeof p=="object"&&p[rt]===void 0&&(p[rt]={}),typeof p[rt]!="object"||Array.isArray(p[rt])?(Array.isArray(p[rt])?p[rt].push({}):p[rt]=[p[rt],{}],p=p[rt][p[rt].length-1]):p=p[rt]});let h=sn(u[u.length-1]),P=N(u.join("."),d.arrays),j=Array.isArray(O),I=f["duplicate-arguments-array"];!I&&N(h,d.nargs)&&(I=!0,(!wt(p[h])&&d.nargs[h]===1||Array.isArray(p[h])&&p[h].length===d.nargs[h])&&(p[h]=void 0)),O===Me()?p[h]=Me(p[h]):Array.isArray(p[h])?I&&P&&j?p[h]=f["flatten-duplicate-arrays"]?p[h].concat(O):(Array.isArray(p[h][0])?p[h]:[p[h]]).concat([O]):!I&&Boolean(P)===Boolean(j)?p[h]=O:p[h]=p[h].concat([O]):p[h]===void 0&&P?p[h]=j?O:[O]:I&&!(p[h]===void 0||N(h,d.counts)||N(h,d.bools))?p[h]=[p[h],O]:p[h]=O}function Ut(...l){l.forEach(function(u){Object.keys(u||{}).forEach(function(O){d.aliases[O]||(d.aliases[O]=[].concat(a[O]||[]),d.aliases[O].concat(O).forEach(function(p){if(/-/.test(p)&&f["camel-case-expansion"]){let h=zt(p);h!==O&&d.aliases[O].indexOf(h)===-1&&(d.aliases[O].push(h),w[h]=!0)}}),d.aliases[O].concat(O).forEach(function(p){if(p.length>1&&/[A-Z]/.test(p)&&f["camel-case-expansion"]){let h=ce(p,"-");h!==O&&d.aliases[O].indexOf(h)===-1&&(d.aliases[O].push(h),w[h]=!0)}}),d.aliases[O].forEach(function(p){d.aliases[p]=[O].concat(d.aliases[O].filter(function(h){return p!==h}))}))})})}function N(l,u){let O=[].concat(d.aliases[l]||[],l),p=Object.keys(u),h=O.find(P=>p.includes(P));return h?u[h]:!1}function Ae(l){let u=Object.keys(d);return[].concat(u.map(p=>d[p])).some(function(p){return Array.isArray(p)?p.includes(l):p[l]})}function F(l,...u){return[].concat(...u).some(function(p){let h=l.match(p);return h&&Ae(h[1])})}function J(l){if(l.match(U)||!l.match(/^-[^-]+/))return!1;let u=!0,O,p=l.slice(1).split("");for(let h=0;h<p.length;h++){if(O=l.slice(h+2),!Ae(p[h])){u=!1;break}if(p[h+1]&&p[h+1]==="="||O==="-"||/[A-Za-z]/.test(p[h])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(O)||p[h+1]&&p[h+1].match(/\W/))break}return u}function X(l){return f["unknown-options-as-args"]&&z(l)}function z(l){return l=l.replace(/^-{3,}/,"--"),l.match(U)||J(l)?!1:!F(l,/^-+([^=]+?)=[\s\S]*$/,v,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function k(l){return!N(l,d.bools)&&!N(l,d.counts)&&`${l}`in m?m[l]:nt(Ot(l))}function nt(l){return{[dt.BOOLEAN]:!0,[dt.STRING]:"",[dt.NUMBER]:void 0,[dt.ARRAY]:[]}[l]}function Ot(l){let u=dt.BOOLEAN;return N(l,d.strings)?u=dt.STRING:N(l,d.numbers)?u=dt.NUMBER:N(l,d.bools)?u=dt.BOOLEAN:N(l,d.arrays)&&(u=dt.ARRAY),u}function wt(l){return l===void 0}function ae(){Object.keys(d.counts).find(l=>N(l,d.arrays)?(B=Error(y("Invalid configuration: %s, opts.count excludes opts.array.",l)),!0):N(l,d.nargs)?(B=Error(y("Invalid configuration: %s, opts.count excludes opts.narg.",l)),!0):!1)}return{aliases:Object.assign({},d.aliases),argv:Object.assign(St,q),configuration:f,defaulted:Object.assign({},M),error:B,newAliases:Object.assign({},w)}}};function fi(s){let t=[],e=Object.create(null),n=!0;for(Object.keys(s).forEach(function(i){t.push([].concat(s[i],i))});n;){n=!1;for(let i=0;i<t.length;i++)for(let o=i+1;o<t.length;o++)if(t[i].filter(function(f){return t[o].indexOf(f)!==-1}).length){t[i]=t[i].concat(t[o]),t.splice(o,1),n=!0;break}}return t.forEach(function(i){i=i.filter(function(a,f,m){return m.indexOf(a)===f});let o=i.pop();o!==void 0&&typeof o=="string"&&(e[o]=i)}),e}function Me(s){return s!==void 0?s+1:1}function sn(s){return s==="__proto__"?"___proto___":s}function ci(s){return typeof s=="string"&&(s[0]==="'"||s[0]==='"')&&s[s.length-1]===s[0]?s.substring(1,s.length-1):s}import{readFileSync as pi}from"fs";var rn=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12;if(process&&process.version&&Number(process.version.match(/v([^.]+)/)[1])<rn)throw Error(`yargs parser supports a minimum Node.js version of ${rn}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);var mi=process?process.env:{},on=new Se({cwd:process.cwd,env:()=>mi,format:hi,normalize:ui,resolve:di,require:s=>{if(typeof Ct!="undefined")return Ct(s);if(s.match(/\.json$/))return JSON.parse(pi(s,"utf8"));throw Error("only .json config files are supported in ESM")}}),ie=function(t,e){return on.parse(t.slice(),e).argv};ie.detailed=function(s,t){return on.parse(s.slice(),t)};ie.camelCase=zt;ie.decamelize=ce;ie.looksLikeNumber=he;var an=ie;import{basename as Ii,dirname as $i,extname as Fi,relative as Ni,resolve as dn}from"path";function gi(){return bi()?0:1}function bi(){return _i()&&!process.defaultApp}function _i(){return!!process.versions.electron}function ln(){return process.argv[gi()]}var K=class extends Error{constructor(t){super(t||"yargs error");this.name="YError",Error.captureStackTrace(this,K)}};import{readFileSync as Oi,statSync as wi,writeFile as yi}from"fs";import{format as Ci}from"util";import{resolve as ji}from"path";var fn={fs:{readFileSync:Oi,writeFile:yi},format:Ci,resolve:ji,exists:s=>{try{return wi(s).isFile()}catch(t){return!1}}};var yt,cn=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(),yt.format.apply(yt.format,[this.cache[this.locale][e]||e].concat(t))}__n(){let t=Array.prototype.slice.call(arguments),e=t.shift(),n=t.shift(),i=t.shift(),o=function(){};typeof t[t.length-1]=="function"&&(o=t.pop()),this.cache[this.locale]||this._readLocaleFile();let a=i===1?e:n;this.cache[this.locale][e]&&(a=this.cache[this.locale][e][i===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:o})):o();let f=[a];return~a.indexOf("%d")&&f.push(i),yt.format.apply(yt.format,f.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(i,o){let a=e[o+1];n+=i,typeof a!="undefined"&&(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,i=e.locale,o=e.cb,a=this._resolveLocaleFile(n,i),f=JSON.stringify(this.cache[i],null,2);yt.fs.writeFile(a,f,"utf-8",function(m){t.writeQueue.shift(),t.writeQueue.length>0&&t._processWriteQueue(),o(m)})}_readLocaleFile(){let t={},e=this._resolveLocaleFile(this.directory,this.locale);try{yt.fs.readFileSync&&(t=JSON.parse(yt.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=yt.resolve(t,"./",e+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~e.lastIndexOf("_")){let i=yt.resolve(t,"./",e.split("_")[0]+".json");this._fileExistsSync(i)&&(n=i)}return n}_fileExistsSync(t){return yt.exists(t)}};function hn(s,t){yt=t;let e=new cn(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 Ei=s=>hn(s,fn),un=Ei;var Li={},Di="require is not supported by ESM",pn="loading a directory of commands is not supported yet for ESM",ue;try{ue=Mi(Li.url)}catch(s){ue=process.cwd()}var Wi=ue.split("node_modules")[0],mn={assert:{notStrictEqual:Ai,strictEqual:xi},cliui:Pe,findUp:en,getEnv:s=>process.env[s],inspect:Pi,getCallerFile:()=>{throw new K(pn)},getProcessArgvBin:ln,mainFilename:Wi||process.cwd(),Parser:an,path:{basename:Ii,dirname:$i,extname:Fi,relative:Ni,resolve:dn},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!="undefined"?process.stdout.columns:null},readFileSync:Si,require:()=>{throw new K(Di)},requireDirectory:()=>{throw new K(pn)},stringWidth:s=>[...s].length,y18n:un({directory:dn(ue,"../../../locales"),updateFiles:!1})};function lt(s,t,e,n){e.assert.notStrictEqual(s,t,n)}function Ie(s,t){t.assert.strictEqual(typeof s,"string")}function Xt(s){return Object.keys(s)}function Q(s){return!!s&&!!s.then&&typeof s.then=="function"}function Mt(s){let e=s.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,i=e.shift();if(!i)throw new Error(`No command found in: ${s}`);let o={cmd:i.replace(n,""),demanded:[],optional:[]};return e.forEach((a,f)=>{let m=!1;a=a.replace(/\s/g,""),/\.+[\]>]/.test(a)&&f===e.length-1&&(m=!0),/^\[/.test(a)?o.optional.push({cmd:a.replace(n,"").split("|"),variadic:m}):o.demanded.push({cmd:a.replace(n,"").split("|"),variadic:m})}),o}var Ui=["first","second","third","fourth","fifth","sixth"];function E(s,t,e){function n(){return typeof s=="object"?[{demanded:[],optional:[]},s,t]:[Mt(`cmd ${s}`),t,e]}try{let i=0,[o,a,f]=n(),m=[].slice.call(a);for(;m.length&&m[m.length-1]===void 0;)m.pop();let _=f||m.length;if(_<o.demanded.length)throw new K(`Not enough arguments provided. Expected ${o.demanded.length} but received ${m.length}.`);let b=o.demanded.length+o.optional.length;if(_>b)throw new K(`Too many arguments provided. Expected max ${b} but received ${_}.`);o.demanded.forEach(c=>{let g=m.shift(),w=gn(g);c.cmd.filter(y=>y===w||y==="*").length===0&&bn(w,c.cmd,i),i+=1}),o.optional.forEach(c=>{if(m.length===0)return;let g=m.shift(),w=gn(g);c.cmd.filter(y=>y===w||y==="*").length===0&&bn(w,c.cmd,i),i+=1})}catch(i){console.warn(i.stack)}}function gn(s){return Array.isArray(s)?"array":s===null?"null":typeof s}function bn(s,t,e){throw new K(`Invalid ${Ui[e]||"manyith"} argument. Expected ${t.join(" or ")} but received ${s}.`)}var $e=class{constructor(t){this.globalMiddleware=[],this.frozens=[],this.yargs=t}addMiddleware(t,e,n=!0,i=!1){if(E("<array|function> [boolean] [boolean] [boolean]",[t,e,n],arguments.length),Array.isArray(t)){for(let o=0;o<t.length;o++){if(typeof t[o]!="function")throw Error("middleware must be a function");let a=t[o];a.applyBeforeValidation=e,a.global=n}Array.prototype.push.apply(this.globalMiddleware,t)}else if(typeof t=="function"){let o=t;o.applyBeforeValidation=e,o.global=n,o.mutates=i,this.globalMiddleware.push(t)}return this.yargs}addCoerceMiddleware(t,e){let n=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(i=>{let o=[...n[e]||[],e];return i.option?!o.includes(i.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 _n(s){return s?s.map(t=>(t.applyBeforeValidation=!1,t)):[]}function Rt(s,t,e,n){return e.reduce((i,o)=>{if(o.applyBeforeValidation!==n)return i;if(o.mutates){if(o.applied)return i;o.applied=!0}if(Q(i))return i.then(a=>Promise.all([a,o(a,t)])).then(([a,f])=>Object.assign(a,f));{let a=o(i,t);return Q(a)?a.then(f=>Object.assign(i,f)):Object.assign(i,a)}},s)}function vt(s,t,e=n=>{throw n}){try{let n=zi(s)?s():s;return Q(n)?n.then(i=>t(i)):t(n)}catch(n){return e(n)}}function zi(s){return typeof s=="function"}function Fe(s){if(typeof Ct=="undefined")return null;for(let t=0,e=Object.keys(Ct.cache),n;t<e.length;t++)if(n=Ct.cache[e[t]],n.exports===s)return n;return null}var kt=/(^\*)|(^\$0)/,On=class{constructor(t,e,n,i){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=i,this.usage=t,this.globalMiddleware=n,this.validation=e}addDirectory(t,e,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:a=>a;i.visit=(a,f,m)=>{let _=o(a,f,m);if(_){if(this.requireCache.has(f))return _;this.requireCache.add(f),this.addHandler(_)}return _},this.shim.requireDirectory({require:e,filename:n},t,i)}addHandler(t,e,n,i,o,a){let f=[],m=_n(o);if(i=i||(()=>{}),Array.isArray(t))if(Ri(t))[t,...f]=t;else for(let _ of t)this.addHandler(_);else if(Ti(t)){let _=Array.isArray(t.command)||typeof t.command=="string"?t.command:this.moduleName(t);t.aliases&&(_=[].concat(_).concat(t.aliases)),this.addHandler(_,this.extractDesc(t),t.builder,t.handler,t.middlewares,t.deprecated);return}else if(yn(n)){this.addHandler([t].concat(f),e,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof t=="string"){let _=Mt(t);f=f.map(g=>Mt(g).cmd);let b=!1,c=[_.cmd].concat(f).filter(g=>kt.test(g)?(b=!0,!1):!0);c.length===0&&b&&c.push("$0"),b&&(_.cmd=c[0],f=c.slice(1),t=t.replace(kt,_.cmd)),f.forEach(g=>{this.aliasMap[g]=_.cmd}),e!==!1&&this.usage.command(t,e,b,f,a),this.handlers[_.cmd]={original:t,description:e,handler:i,builder:n||{},middlewares:m,deprecated:a,demanded:_.demanded,optional:_.optional},b&&(this.defaultCommand=this.handlers[_.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(t,e,n,i,o,a){let f=this.handlers[t]||this.handlers[this.aliasMap[t]]||this.defaultCommand,m=e.getInternalMethods().getContext(),_=m.commands.slice(),b=!t;t&&(m.commands.push(t),m.fullCommands.push(f.original));let c=this.applyBuilderUpdateUsageAndParse(b,f,e,n.aliases,_,i,o,a);return Q(c)?c.then(g=>this.applyMiddlewareAndGetResult(b,f,g.innerArgv,m,o,g.aliases,e)):this.applyMiddlewareAndGetResult(b,f,c.innerArgv,m,o,c.aliases,e)}applyBuilderUpdateUsageAndParse(t,e,n,i,o,a,f,m){let _=e.builder,b=n;if(de(_)){let c=_(n.getInternalMethods().reset(i),m);if(Q(c))return c.then(g=>(b=Cn(g)?g:n,this.parseAndUpdateUsage(t,e,b,o,a,f)))}else vi(_)&&(b=n.getInternalMethods().reset(i),Object.keys(e.builder).forEach(c=>{b.option(c,_[c])}));return this.parseAndUpdateUsage(t,e,b,o,a,f)}parseAndUpdateUsage(t,e,n,i,o,a){t&&n.getInternalMethods().getUsageInstance().unfreeze(),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(i,e),e.description);let f=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,o,a);return Q(f)?f.then(m=>({aliases:n.parsed.aliases,innerArgv:m})):{aliases:n.parsed.aliases,innerArgv:f}}shouldUpdateUsage(t){return!t.getInternalMethods().getUsageInstance().getUsageDisabled()&&t.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(t,e){let n=kt.test(e.original)?e.original.replace(kt,"").trim():e.original,i=t.filter(o=>!kt.test(o));return i.push(n),`$0 ${i.join(" ")}`}applyMiddlewareAndGetResult(t,e,n,i,o,a,f){let m={};if(o)return n;f.getInternalMethods().getHasOutput()||(m=this.populatePositionals(e,n,i,f));let _=this.globalMiddleware.getMiddleware().slice(0).concat(e.middlewares);if(n=Rt(n,f,_,!0),!f.getInternalMethods().getHasOutput()){let b=f.getInternalMethods().runValidation(a,m,f.parsed.error,t);n=vt(n,c=>(b(c),c))}if(e.handler&&!f.getInternalMethods().getHasOutput()){f.getInternalMethods().setHasOutput();let b=!!f.getOptions().configuration["populate--"];f.getInternalMethods().postProcess(n,b,!1,!1),n=Rt(n,f,_,!1),n=vt(n,c=>{let g=e.handler(c);return Q(g)?g.then(()=>c):c}),t||f.getInternalMethods().getUsageInstance().cacheHelpMessage(),Q(n)&&!f.getInternalMethods().hasParseCallback()&&n.catch(c=>{try{f.getInternalMethods().getUsageInstance().fail(null,c)}catch(g){}})}return t||(i.commands.pop(),i.fullCommands.pop()),n}populatePositionals(t,e,n,i){e._=e._.slice(n.commands.length);let o=t.demanded.slice(0),a=t.optional.slice(0),f={};for(this.validation.positionalCount(o.length,e._.length);o.length;){let m=o.shift();this.populatePositional(m,e,f)}for(;a.length;){let m=a.shift();this.populatePositional(m,e,f)}return e._=n.commands.concat(e._.map(m=>""+m)),this.postProcessPositionals(e,f,this.cmdToParseOptions(t.original),i),f}populatePositional(t,e,n){let i=t.cmd[0];t.variadic?n[i]=e._.splice(0).map(String):e._.length&&(n[i]=[String(e._.shift())])}cmdToParseOptions(t){let e={array:[],default:{},alias:{},demand:{}},n=Mt(t);return n.demanded.forEach(i=>{let[o,...a]=i.cmd;i.variadic&&(e.array.push(o),e.default[o]=[]),e.alias[o]=a,e.demand[o]=!0}),n.optional.forEach(i=>{let[o,...a]=i.cmd;i.variadic&&(e.array.push(o),e.default[o]=[]),e.alias[o]=a}),e}postProcessPositionals(t,e,n,i){let o=Object.assign({},i.getOptions());o.default=Object.assign(n.default,o.default);for(let _ of Object.keys(n.alias))o.alias[_]=(o.alias[_]||[]).concat(n.alias[_]);o.array=o.array.concat(n.array),o.config={};let a=[];if(Object.keys(e).forEach(_=>{e[_].map(b=>{o.configuration["unknown-options-as-args"]&&(o.key[_]=!0),a.push(`--${_}`),a.push(b)})}),!a.length)return;let f=Object.assign({},o.configuration,{"populate--":!1}),m=this.shim.Parser.detailed(a,Object.assign({},o,{configuration:f}));if(m.error)i.getInternalMethods().getUsageInstance().fail(m.error.message,m.error);else{let _=Object.keys(e);Object.keys(e).forEach(c=>{_.push(...m.aliases[c])});let b=i.getOptions().default;Object.keys(m.argv).forEach(c=>{_.includes(c)&&(e[c]||(e[c]=m.argv[c]),!Object.prototype.hasOwnProperty.call(b,c)&&Object.prototype.hasOwnProperty.call(t,c)&&Object.prototype.hasOwnProperty.call(m.argv,c)&&(Array.isArray(t[c])||Array.isArray(m.argv[c]))?t[c]=[].concat(t[c],m.argv[c]):t[c]=m.argv[c])})}}runDefaultBuilderOn(t){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(t)){let n=kt.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(de(e))return e(t,!0);yn(e)||Object.keys(e).forEach(n=>{t.option(n,e[n])})}moduleName(t){let e=Fe(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 i of[t,e,n]){if(typeof i=="string"||i===!1)return i;lt(i,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){let t=this.frozens.pop();lt(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 wn(s,t,e,n){return new On(s,t,e,n)}function yn(s){return typeof s=="object"&&!!s.builder&&typeof s.handler=="function"}function Ri(s){return s.every(t=>typeof t=="string")}function de(s){return typeof s=="function"}function vi(s){return typeof s=="object"}function Ti(s){return typeof s=="object"&&!Array.isArray(s)}function It(s={},t=()=>!0){let e={};return Xt(s).forEach(n=>{t(n,s[n])&&(e[n]=s[n])}),e}function $t(s){typeof process!="undefined"&&[process.stdout,process.stderr].forEach(t=>{let e=t;e._handle&&e.isTTY&&typeof e._handle.setBlocking=="function"&&e._handle.setBlocking(s)})}function Hi(s){return typeof s=="boolean"}function jn(s,t){let e=t.y18n.__,n={},i=[];n.failFn=function(C){i.push(C)};let o=null,a=!0;n.showHelpOnFail=function(C=!0,$){function W(){return typeof C=="string"?[!0,C]:[C,$]}let[G,et]=W();return o=et,a=G,n};let f=!1;n.fail=function(C,$){let W=s.getInternalMethods().getLoggerInstance();if(i.length)for(let G=i.length-1;G>=0;--G){let et=i[G];if(Hi(et)){if($)throw $;if(C)throw Error(C)}else et(C,$,n)}else{if(s.getExitProcess()&&$t(!0),f||(f=!0,a&&(s.showHelp("error"),W.error()),(C||$)&&W.error(C||$),o&&((C||$)&&W.error(""),W.error(o))),$=$||new K(C),s.getExitProcess())return s.exit(1);if(s.getInternalMethods().hasParseCallback())return s.exit(1,$);throw $}};let m=[],_=!1;n.usage=(x,C)=>x===null?(_=!0,m=[],n):(_=!1,m.push([x,C||""]),n),n.getUsage=()=>m,n.getUsageDisabled=()=>_,n.getPositionalGroupName=()=>e("Positionals:");let b=[];n.example=(x,C)=>{b.push([x,C||""])};let c=[];n.command=function(C,$,W,G,et=!1){W&&(c=c.map(H=>(H[2]=!1,H))),c.push([C,$||"",W,G,et])},n.getCommands=()=>c;let g={};n.describe=function(C,$){Array.isArray(C)?C.forEach(W=>{n.describe(W,$)}):typeof C=="object"?Object.keys(C).forEach(W=>{n.describe(W,C[W])}):g[C]=$},n.getDescriptions=()=>g;let w=[];n.epilog=x=>{w.push(x)};let M=!1,y;n.wrap=x=>{M=!0,y=x};function d(){return M||(y=Zt(),M=!0),y}let U="__yargsString__:";n.deferY18nLookup=x=>U+x,n.help=function(){if(Y)return Y;B();let C=s.customScriptName?s.$0:t.path.basename(s.$0),$=s.getDemandedOptions(),W=s.getDemandedCommands(),G=s.getDeprecatedOptions(),et=s.getGroups(),H=s.getOptions(),st=[];st=st.concat(Object.keys(g)),st=st.concat(Object.keys($)),st=st.concat(Object.keys(W)),st=st.concat(Object.keys(H.default)),st=st.filter(St),st=Object.keys(st.reduce((F,J)=>(J!=="_"&&(F[J]=!0),F),{}));let Lt=d(),Z=t.cliui({width:Lt,wrap:!!Lt});if(!_){if(m.length)m.forEach(F=>{Z.div({text:`${F[0].replace(/\$0/g,C)}`}),F[1]&&Z.div({text:`${F[1]}`,padding:[1,0,0,0]})}),Z.div();else if(c.length){let F=null;W._?F=`${C} <${e("command")}>
7
- `:F=`${C} [${e("command")}]
8
- `,Z.div(`${F}`)}}if(c.length>1||c.length===1&&!c[0][2]){Z.div(e("Commands:"));let F=s.getInternalMethods().getContext(),J=F.commands.length?`${F.commands.join(" ")} `:"";s.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(c=c.sort((z,k)=>z[0].localeCompare(k[0])));let X=C?`${C} `:"";c.forEach(z=>{let k=`${X}${J}${z[0].replace(/^\$0 ?/,"")}`;Z.span({text:k,padding:[0,2,0,2],width:v(c,Lt,`${C}${J}`)+4},{text:z[1]});let nt=[];z[2]&&nt.push(`[${e("default")}]`),z[3]&&z[3].length&&nt.push(`[${e("aliases:")} ${z[3].join(", ")}]`),z[4]&&(typeof z[4]=="string"?nt.push(`[${e("deprecated: %s",z[4])}]`):nt.push(`[${e("deprecated")}]`)),nt.length?Z.div({text:nt.join(" "),padding:[0,0,0,2],align:"right"}):Z.div()}),Z.div()}let At=(Object.keys(H.alias)||[]).concat(Object.keys(s.parsed.newAliases)||[]);st=st.filter(F=>!s.parsed.newAliases[F]&&At.every(J=>(H.alias[J]||[]).indexOf(F)===-1));let xt=e("Options:");et[xt]||(et[xt]=[]),q(st,H.alias,et,xt);let Ut=F=>/^--/.test(pe(F)),N=Object.keys(et).filter(F=>et[F].length>0).map(F=>{let J=et[F].filter(St).map(X=>{if(At.includes(X))return X;for(let z=0,k;(k=At[z])!==void 0;z++)if((H.alias[k]||[]).includes(X))return k;return X});return{groupName:F,normalizedKeys:J}}).filter(({normalizedKeys:F})=>F.length>0).map(({groupName:F,normalizedKeys:J})=>{let X=J.reduce((z,k)=>(z[k]=[k].concat(H.alias[k]||[]).map(nt=>F===n.getPositionalGroupName()?nt:(/^[0-9]$/.test(nt)?H.boolean.includes(k)?"-":"--":nt.length>1?"--":"-")+nt).sort((nt,Ot)=>Ut(nt)===Ut(Ot)?0:Ut(nt)?1:-1).join(", "),z),{});return{groupName:F,normalizedKeys:J,switches:X}});if(N.filter(({groupName:F})=>F!==n.getPositionalGroupName()).some(({normalizedKeys:F,switches:J})=>!F.every(X=>Ut(J[X])))&&N.filter(({groupName:F})=>F!==n.getPositionalGroupName()).forEach(({normalizedKeys:F,switches:J})=>{F.forEach(X=>{Ut(J[X])&&(J[X]=Yi(J[X],"-x, ".length))})}),N.forEach(({groupName:F,normalizedKeys:J,switches:X})=>{Z.div(F),J.forEach(z=>{let k=X[z],nt=g[z]||"",Ot=null;nt.includes(U)&&(nt=e(nt.substring(U.length))),H.boolean.includes(z)&&(Ot=`[${e("boolean")}]`),H.count.includes(z)&&(Ot=`[${e("count")}]`),H.string.includes(z)&&(Ot=`[${e("string")}]`),H.normalize.includes(z)&&(Ot=`[${e("string")}]`),H.array.includes(z)&&(Ot=`[${e("array")}]`),H.number.includes(z)&&(Ot=`[${e("number")}]`);let wt=l=>typeof l=="string"?`[${e("deprecated: %s",l)}]`:`[${e("deprecated")}]`,ae=[z in G?wt(G[z]):null,Ot,z in $?`[${e("required")}]`:null,H.choices&&H.choices[z]?`[${e("choices:")} ${n.stringifiedValues(H.choices[z])}]`:null,_t(H.default[z],H.defaultDescription[z])].filter(Boolean).join(" ");Z.span({text:pe(k),padding:[0,2,0,2+En(k)],width:v(X,Lt)+4},nt),ae?Z.div({text:ae,padding:[0,0,0,2],align:"right"}):Z.div()}),Z.div()}),b.length&&(Z.div(e("Examples:")),b.forEach(F=>{F[0]=F[0].replace(/\$0/g,C)}),b.forEach(F=>{F[1]===""?Z.div({text:F[0],padding:[0,2,0,2]}):Z.div({text:F[0],padding:[0,2,0,2],width:v(b,Lt)+4},{text:F[1]})}),Z.div()),w.length>0){let F=w.map(J=>J.replace(/\$0/g,C)).join(`
9
- `);Z.div(`${F}
10
- `)}return Z.toString().replace(/\s*$/,"")};function v(x,C,$){let W=0;return Array.isArray(x)||(x=Object.values(x).map(G=>[G])),x.forEach(G=>{W=Math.max(t.stringWidth($?`${$} ${pe(G[0])}`:pe(G[0]))+En(G[0]),W)}),C&&(W=Math.min(W,parseInt((C*.5).toString(),10))),W}function B(){let x=s.getDemandedOptions(),C=s.getOptions();(Object.keys(C.alias)||[]).forEach($=>{C.alias[$].forEach(W=>{g[W]&&n.describe($,g[W]),W in x&&s.demandOption($,x[W]),C.boolean.includes(W)&&s.boolean($),C.count.includes(W)&&s.count($),C.string.includes(W)&&s.string($),C.normalize.includes(W)&&s.normalize($),C.array.includes(W)&&s.array($),C.number.includes(W)&&s.number($)})})}let Y;n.cacheHelpMessage=function(){Y=this.help()},n.clearCachedHelpMessage=function(){Y=void 0},n.hasCachedHelpMessage=function(){return!!Y};function q(x,C,$,W){let G=[],et=null;return Object.keys($).forEach(H=>{G=G.concat($[H])}),x.forEach(H=>{et=[H].concat(C[H]),et.some(st=>G.indexOf(st)!==-1)||$[W].push(H)}),G}function St(x){return s.getOptions().hiddenOptions.indexOf(x)<0||s.parsed.argv[s.getOptions().showHiddenOpt]}n.showHelp=x=>{let C=s.getInternalMethods().getLoggerInstance();x||(x="error"),(typeof x=="function"?x:C[x])(n.help())},n.functionDescription=x=>{let C=x.name?t.Parser.decamelize(x.name,"-"):e("generated-value");return["(",C,")"].join("")},n.stringifiedValues=function(C,$){let W="",G=$||", ",et=[].concat(C);return!C||!et.length||et.forEach(H=>{W.length&&(W+=G),W+=JSON.stringify(H)}),W};function _t(x,C){let $=`[${e("default:")} `;if(x===void 0&&!C)return null;if(C)$+=C;else switch(typeof x){case"string":$+=`"${x}"`;break;case"object":$+=JSON.stringify(x);break;default:$+=x}return`${$}]`}function Zt(){let x=80;return t.process.stdColumns?Math.min(x,t.process.stdColumns):x}let Wt=null;n.version=x=>{Wt=x},n.showVersion=x=>{let C=s.getInternalMethods().getLoggerInstance();x||(x="error"),(typeof x=="function"?x:C[x])(Wt)},n.reset=function(C){return o=null,f=!1,m=[],_=!1,w=[],b=[],c=[],g=It(g,$=>!C[$]),n};let V=[];return n.freeze=function(){V.push({failMessage:o,failureOutput:f,usages:m,usageDisabled:_,epilogs:w,examples:b,commands:c,descriptions:g})},n.unfreeze=function(){let C=V.pop();!C||({failMessage:o,failureOutput:f,usages:m,usageDisabled:_,epilogs:w,examples:b,commands:c,descriptions:g}=C)},n}function Ne(s){return typeof s=="object"}function Yi(s,t){return Ne(s)?{text:s.text,indentation:s.indentation+t}:{text:s,indentation:t}}function En(s){return Ne(s)?s.indentation:0}function pe(s){return Ne(s)?s.text:s}var An=`###-begin-{{app_name}}-completions-###
1
+ import{b as ir,d as De,e as Ve,f as rr,g as Ne,h as Te}from"../chunk-JKQJOIRC.mjs";import{a as ze,b as da,c as pa,i as b}from"../chunk-KZPEO35A.mjs";var Ps=da((Cn,ln)=>{b();var Uf=200,Yi="__lodash_hash_undefined__",ts=1,Gn=2,ns=9007199254740991,zn="[object Arguments]",Bi="[object Array]",is="[object Boolean]",rs="[object Date]",os="[object Error]",ss="[object Function]",$f="[object GeneratorFunction]",Vn="[object Map]",as="[object Number]",sn="[object Object]",ls="[object Promise]",cs="[object RegExp]",Kn="[object Set]",fs="[object String]",Wf="[object Symbol]",qi="[object WeakMap]",us="[object ArrayBuffer]",Qn="[object DataView]",Hf="[object Float32Array]",kf="[object Float64Array]",Yf="[object Int8Array]",Bf="[object Int16Array]",qf="[object Int32Array]",Gf="[object Uint8Array]",zf="[object Uint8ClampedArray]",Vf="[object Uint16Array]",Kf="[object Uint32Array]",Qf=/[\\^$.*+?()[\]{}|]/g,Jf=/^\[object .+?Constructor\]$/,Zf=/^(?:0|[1-9]\d*)$/,X={};X[Hf]=X[kf]=X[Yf]=X[Bf]=X[qf]=X[Gf]=X[zf]=X[Vf]=X[Kf]=!0;X[zn]=X[Bi]=X[us]=X[is]=X[Qn]=X[rs]=X[os]=X[ss]=X[Vn]=X[as]=X[sn]=X[cs]=X[Kn]=X[fs]=X[qi]=!1;var ds=typeof global=="object"&&global&&global.Object===Object&&global,Xf=typeof self=="object"&&self&&self.Object===Object&&self,ht=ds||Xf||Function("return this")(),ps=typeof Cn=="object"&&Cn&&!Cn.nodeType&&Cn,hs=ps&&typeof ln=="object"&&ln&&!ln.nodeType&&ln,eu=hs&&hs.exports===ps,ms=eu&&ds.process,gs=function(){try{return ms&&ms.binding("util")}catch(e){}}(),ys=gs&&gs.isTypedArray;function tu(e,t){for(var n=-1,i=e?e.length:0;++n<i;)if(t(e[n],n,e))return!0;return!1}function nu(e,t){for(var n=-1,i=Array(e);++n<e;)i[n]=t(n);return i}function iu(e){return function(t){return e(t)}}function ru(e,t){return e==null?void 0:e[t]}function Gi(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(n){}return t}function ou(e){var t=-1,n=Array(e.size);return e.forEach(function(i,r){n[++t]=[r,i]}),n}function su(e,t){return function(n){return e(t(n))}}function au(e){var t=-1,n=Array(e.size);return e.forEach(function(i){n[++t]=i}),n}var lu=Array.prototype,cu=Function.prototype,Jn=Object.prototype,zi=ht["__core-js_shared__"],bs=function(){var e=/[^.]+$/.exec(zi&&zi.keys&&zi.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),As=cu.toString,it=Jn.hasOwnProperty,An=Jn.toString,fu=RegExp("^"+As.call(it).replace(Qf,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ws=ht.Symbol,xs=ht.Uint8Array,uu=Jn.propertyIsEnumerable,du=lu.splice,pu=su(Object.keys,Object),Vi=an(ht,"DataView"),wn=an(ht,"Map"),Ki=an(ht,"Promise"),Qi=an(ht,"Set"),Ji=an(ht,"WeakMap"),xn=an(Object,"create"),hu=zt(Vi),mu=zt(wn),gu=zt(Ki),yu=zt(Qi),bu=zt(Ji),Cs=ws?ws.prototype:void 0,Zi=Cs?Cs.valueOf:void 0;function qt(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function Au(){this.__data__=xn?xn(null):{}}function wu(e){return this.has(e)&&delete this.__data__[e]}function xu(e){var t=this.__data__;if(xn){var n=t[e];return n===Yi?void 0:n}return it.call(t,e)?t[e]:void 0}function Cu(e){var t=this.__data__;return xn?t[e]!==void 0:it.call(t,e)}function Ou(e,t){var n=this.__data__;return n[e]=xn&&t===void 0?Yi:t,this}qt.prototype.clear=Au;qt.prototype.delete=wu;qt.prototype.get=xu;qt.prototype.has=Cu;qt.prototype.set=Ou;function rt(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function _u(){this.__data__=[]}function vu(e){var t=this.__data__,n=Xn(t,e);if(n<0)return!1;var i=t.length-1;return n==i?t.pop():du.call(t,n,1),!0}function Eu(e){var t=this.__data__,n=Xn(t,e);return n<0?void 0:t[n][1]}function Su(e){return Xn(this.__data__,e)>-1}function Iu(e,t){var n=this.__data__,i=Xn(n,e);return i<0?n.push([e,t]):n[i][1]=t,this}rt.prototype.clear=_u;rt.prototype.delete=vu;rt.prototype.get=Eu;rt.prototype.has=Su;rt.prototype.set=Iu;function Gt(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function ju(){this.__data__={hash:new qt,map:new(wn||rt),string:new qt}}function Pu(e){return ei(this,e).delete(e)}function Mu(e){return ei(this,e).get(e)}function Fu(e){return ei(this,e).has(e)}function Lu(e,t){return ei(this,e).set(e,t),this}Gt.prototype.clear=ju;Gt.prototype.delete=Pu;Gt.prototype.get=Mu;Gt.prototype.has=Fu;Gt.prototype.set=Lu;function Zn(e){var t=-1,n=e?e.length:0;for(this.__data__=new Gt;++t<n;)this.add(e[t])}function Du(e){return this.__data__.set(e,Yi),this}function Nu(e){return this.__data__.has(e)}Zn.prototype.add=Zn.prototype.push=Du;Zn.prototype.has=Nu;function mt(e){this.__data__=new rt(e)}function Tu(){this.__data__=new rt}function Ru(e){return this.__data__.delete(e)}function Uu(e){return this.__data__.get(e)}function $u(e){return this.__data__.has(e)}function Wu(e,t){var n=this.__data__;if(n instanceof rt){var i=n.__data__;if(!wn||i.length<Uf-1)return i.push([e,t]),this;n=this.__data__=new Gt(i)}return n.set(e,t),this}mt.prototype.clear=Tu;mt.prototype.delete=Ru;mt.prototype.get=Uu;mt.prototype.has=$u;mt.prototype.set=Wu;function Hu(e,t){var n=Xi(e)||Xu(e)?nu(e.length,String):[],i=n.length,r=!!i;for(var o in e)(t||it.call(e,o))&&!(r&&(o=="length"||Ku(o,i)))&&n.push(o);return n}function Xn(e,t){for(var n=e.length;n--;)if(vs(e[n][0],t))return n;return-1}function ku(e){return An.call(e)}function Os(e,t,n,i,r){return e===t?!0:e==null||t==null||!er(e)&&!tr(t)?e!==e&&t!==t:Yu(e,t,Os,n,i,r)}function Yu(e,t,n,i,r,o){var s=Xi(e),a=Xi(t),l=Bi,u=Bi;s||(l=gt(e),l=l==zn?sn:l),a||(u=gt(t),u=u==zn?sn:u);var d=l==sn&&!Gi(e),f=u==sn&&!Gi(t),p=l==u;if(p&&!d)return o||(o=new mt),s||nd(e)?_s(e,t,n,i,r,o):zu(e,t,l,n,i,r,o);if(!(r&Gn)){var g=d&&it.call(e,"__wrapped__"),C=f&&it.call(t,"__wrapped__");if(g||C){var w=g?e.value():e,m=C?t.value():t;return o||(o=new mt),n(w,m,i,r,o)}}return p?(o||(o=new mt),Vu(e,t,n,i,r,o)):!1}function Bu(e){if(!er(e)||Ju(e))return!1;var t=Ss(e)||Gi(e)?fu:Jf;return t.test(zt(e))}function qu(e){return tr(e)&&Is(e.length)&&!!X[An.call(e)]}function Gu(e){if(!Zu(e))return pu(e);var t=[];for(var n in Object(e))it.call(e,n)&&n!="constructor"&&t.push(n);return t}function _s(e,t,n,i,r,o){var s=r&Gn,a=e.length,l=t.length;if(a!=l&&!(s&&l>a))return!1;var u=o.get(e);if(u&&o.get(t))return u==t;var d=-1,f=!0,p=r&ts?new Zn:void 0;for(o.set(e,t),o.set(t,e);++d<a;){var g=e[d],C=t[d];if(i)var w=s?i(C,g,d,t,e,o):i(g,C,d,e,t,o);if(w!==void 0){if(w)continue;f=!1;break}if(p){if(!tu(t,function(m,j){if(!p.has(j)&&(g===m||n(g,m,i,r,o)))return p.add(j)})){f=!1;break}}else if(!(g===C||n(g,C,i,r,o))){f=!1;break}}return o.delete(e),o.delete(t),f}function zu(e,t,n,i,r,o,s){switch(n){case Qn:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case us:return!(e.byteLength!=t.byteLength||!i(new xs(e),new xs(t)));case is:case rs:case as:return vs(+e,+t);case os:return e.name==t.name&&e.message==t.message;case cs:case fs:return e==t+"";case Vn:var a=ou;case Kn:var l=o&Gn;if(a||(a=au),e.size!=t.size&&!l)return!1;var u=s.get(e);if(u)return u==t;o|=ts,s.set(e,t);var d=_s(a(e),a(t),i,r,o,s);return s.delete(e),d;case Wf:if(Zi)return Zi.call(e)==Zi.call(t)}return!1}function Vu(e,t,n,i,r,o){var s=r&Gn,a=js(e),l=a.length,u=js(t),d=u.length;if(l!=d&&!s)return!1;for(var f=l;f--;){var p=a[f];if(!(s?p in t:it.call(t,p)))return!1}var g=o.get(e);if(g&&o.get(t))return g==t;var C=!0;o.set(e,t),o.set(t,e);for(var w=s;++f<l;){p=a[f];var m=e[p],j=t[p];if(i)var _=s?i(j,m,p,t,e,o):i(m,j,p,e,t,o);if(!(_===void 0?m===j||n(m,j,i,r,o):_)){C=!1;break}w||(w=p=="constructor")}if(C&&!w){var q=e.constructor,G=t.constructor;q!=G&&"constructor"in e&&"constructor"in t&&!(typeof q=="function"&&q instanceof q&&typeof G=="function"&&G instanceof G)&&(C=!1)}return o.delete(e),o.delete(t),C}function ei(e,t){var n=e.__data__;return Qu(t)?n[typeof t=="string"?"string":"hash"]:n.map}function an(e,t){var n=ru(e,t);return Bu(n)?n:void 0}var gt=ku;(Vi&&gt(new Vi(new ArrayBuffer(1)))!=Qn||wn&&gt(new wn)!=Vn||Ki&&gt(Ki.resolve())!=ls||Qi&&gt(new Qi)!=Kn||Ji&&gt(new Ji)!=qi)&&(gt=function(e){var t=An.call(e),n=t==sn?e.constructor:void 0,i=n?zt(n):void 0;if(i)switch(i){case hu:return Qn;case mu:return Vn;case gu:return ls;case yu:return Kn;case bu:return qi}return t});function Ku(e,t){return t=t==null?ns:t,!!t&&(typeof e=="number"||Zf.test(e))&&e>-1&&e%1==0&&e<t}function Qu(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Ju(e){return!!bs&&bs in e}function Zu(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||Jn;return e===n}function zt(e){if(e!=null){try{return As.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function vs(e,t){return e===t||e!==e&&t!==t}function Xu(e){return ed(e)&&it.call(e,"callee")&&(!uu.call(e,"callee")||An.call(e)==zn)}var Xi=Array.isArray;function Es(e){return e!=null&&Is(e.length)&&!Ss(e)}function ed(e){return tr(e)&&Es(e)}function td(e,t,n){n=typeof n=="function"?n:void 0;var i=n?n(e,t):void 0;return i===void 0?Os(e,t,n):!!i}function Ss(e){var t=er(e)?An.call(e):"";return t==ss||t==$f}function Is(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=ns}function er(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function tr(e){return!!e&&typeof e=="object"}var nd=ys?iu(ys):qu;function js(e){return Es(e)?Hu(e):Gu(e)}ln.exports=td});b();b();b();import{notStrictEqual as $a,strictEqual as Wa}from"assert";b();b();var ha={right:Aa,center:wa},ma=0,_n=1,ga=2,vn=3,or=class{constructor(t){var n;this.width=t.width,this.wrap=(n=t.wrap)!==null&&n!==void 0?n:!0,this.rows=[]}span(...t){let n=this.div(...t);n.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 n=t.map(i=>typeof i=="string"?this.colFromString(i):i);return this.rows.push(n),n}shouldApplyLayoutDSL(...t){return t.length===1&&typeof t[0]=="string"&&/[\t\n]/.test(t[0])}applyLayoutDSL(t){let n=t.split(`
2
+ `).map(r=>r.split(" ")),i=0;return n.forEach(r=>{r.length>1&&Pe.stringWidth(r[0])>i&&(i=Math.min(Math.floor(this.width*.5),Pe.stringWidth(r[0])))}),n.forEach(r=>{this.div(...r.map((o,s)=>({text:o.trim(),padding:this.measurePadding(o),width:s===0&&r.length>1?i:void 0})))}),this.rows[this.rows.length-1]}colFromString(t){return{text:t,padding:this.measurePadding(t)}}measurePadding(t){let n=Pe.stripAnsi(t);return[0,n.match(/\s*$/)[0].length,0,n.match(/^\s*/)[0].length]}toString(){let t=[];return this.rows.forEach(n=>{this.rowToString(n,t)}),t.filter(n=>!n.hidden).map(n=>n.text).join(`
3
+ `)}rowToString(t,n){return this.rasterize(t).forEach((i,r)=>{let o="";i.forEach((s,a)=>{let{width:l}=t[a],u=this.negatePadding(t[a]),d=s;u>Pe.stringWidth(s)&&(d+=" ".repeat(u-Pe.stringWidth(s))),t[a].align&&t[a].align!=="left"&&this.wrap&&(d=ha[t[a].align](d,u),Pe.stringWidth(d)<u&&(d+=" ".repeat((l||0)-Pe.stringWidth(d)-1)));let f=t[a].padding||[0,0,0,0];f[vn]&&(o+=" ".repeat(f[vn])),o+=sr(t[a],d,"| "),o+=d,o+=sr(t[a],d," |"),f[_n]&&(o+=" ".repeat(f[_n])),r===0&&n.length>0&&(o=this.renderInline(o,n[n.length-1]))}),n.push({text:o.replace(/ +$/,""),span:t.span})}),n}renderInline(t,n){let i=t.match(/^ */),r=i?i[0].length:0,o=n.text,s=Pe.stringWidth(o.trimRight());return n.span?this.wrap?r<s?t:(n.hidden=!0,o.trimRight()+" ".repeat(r-s)+t.trimLeft()):(n.hidden=!0,o+t):t}rasterize(t){let n=[],i=this.columnWidths(t),r;return t.forEach((o,s)=>{o.width=i[s],this.wrap?r=Pe.wrap(o.text,this.negatePadding(o),{hard:!0}).split(`
4
+ `):r=o.text.split(`
5
+ `),o.border&&(r.unshift("."+"-".repeat(this.negatePadding(o)+2)+"."),r.push("'"+"-".repeat(this.negatePadding(o)+2)+"'")),o.padding&&(r.unshift(...new Array(o.padding[ma]||0).fill("")),r.push(...new Array(o.padding[ga]||0).fill(""))),r.forEach((a,l)=>{n[l]||n.push([]);let u=n[l];for(let d=0;d<s;d++)u[d]===void 0&&u.push("");u.push(a)})}),n}negatePadding(t){let n=t.width||0;return t.padding&&(n-=(t.padding[vn]||0)+(t.padding[_n]||0)),t.border&&(n-=4),n}columnWidths(t){if(!this.wrap)return t.map(s=>s.width||Pe.stringWidth(s.text));let n=t.length,i=this.width,r=t.map(s=>{if(s.width)return n--,i-=s.width,s.width}),o=n?Math.floor(i/n):0;return r.map((s,a)=>s===void 0?Math.max(o,ya(t[a])):s)}};function sr(e,t,n){return e.border?/[.']-+[.']/.test(t)?"":t.trim().length!==0?n:" ":""}function ya(e){let t=e.padding||[],n=1+(t[vn]||0)+(t[_n]||0);return e.border?n+4:n}function ba(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function Aa(e,t){e=e.trim();let n=Pe.stringWidth(e);return n<t?" ".repeat(t-n)+e:e}function wa(e,t){e=e.trim();let n=Pe.stringWidth(e);return n>=t?e:" ".repeat(t-n>>1)+e}var Pe;function ar(e,t){return Pe=t,new or({width:(e==null?void 0:e.width)||ba(),wrap:e==null?void 0:e.wrap})}b();var lr=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function ai(e){return e.replace(lr,"")}function cr(e,t){let[n,i]=e.match(lr)||["",""];e=ai(e);let r="";for(let o=0;o<e.length;o++)o!==0&&o%t===0&&(r+=`
6
+ `),r+=e.charAt(o);return n&&i&&(r=`${n}${r}${i}`),r}function li(e){return ar(e,{stringWidth:t=>[...t].length,stripAnsi:ai,wrap:cr})}b();import{dirname as fr,resolve as ur}from"path";import{readdirSync as xa,statSync as Ca}from"fs";function dr(e,t){let n=ur(".",e),i;for(Ca(n).isDirectory()||(n=fr(n));;){if(i=t(n,xa(n)),i)return ur(n,i);if(n=fr(i=n),i===n)break}}import{inspect as Ha}from"util";import{readFileSync as ka}from"fs";import{fileURLToPath as Ya}from"url";b();import{format as va}from"util";import{normalize as Ea,resolve as Sa}from"path";b();function Pt(e){if(e!==e.toLowerCase()&&e!==e.toUpperCase()||(e=e.toLowerCase()),e.indexOf("-")===-1&&e.indexOf("_")===-1)return e;{let n="",i=!1,r=e.match(/^-+/);for(let o=r?r[0].length:0;o<e.length;o++){let s=e.charAt(o);i&&(i=!1,s=s.toUpperCase()),o!==0&&(s==="-"||s==="_")?i=!0:s!=="-"&&s!=="_"&&(n+=s)}return n}}function En(e,t){let n=e.toLowerCase();t=t||"-";let i="";for(let r=0;r<e.length;r++){let o=n.charAt(r),s=e.charAt(r);o!==s&&r>0?i+=`${t}${n.charAt(r)}`:i+=s}return i}function Sn(e){return e==null?!1:typeof e=="number"||/^0x[0-9a-f]+$/i.test(e)?!0:/^0[^.]/.test(e)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e)}b();b();function pr(e){if(Array.isArray(e))return e.map(s=>typeof s!="string"?s+"":s);e=e.trim();let t=0,n=null,i=null,r=null,o=[];for(let s=0;s<e.length;s++){if(n=i,i=e.charAt(s),i===" "&&!r){n!==" "&&t++;continue}i===r?r=null:(i==="'"||i==='"')&&!r&&(r=i),o[t]||(o[t]=""),o[t]+=i}return o}b();var Re;(function(e){e.BOOLEAN="boolean",e.STRING="string",e.NUMBER="number",e.ARRAY="array"})(Re||(Re={}));var et,ci=class{constructor(t){et=t}parse(t,n){let i=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},n),r=pr(t),o=typeof t=="string",s=Oa(Object.assign(Object.create(null),i.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},i.configuration),l=Object.assign(Object.create(null),i.default),u=i.configObjects||[],d=i.envPrefix,f=a["populate--"],p=f?"--":"_",g=Object.create(null),C=Object.create(null),w=i.__||et.format,m={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:[]},j=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,_=new RegExp("^--"+a["negation-prefix"]+"(.+)");[].concat(i.array||[]).filter(Boolean).forEach(function(h){let A=typeof h=="object"?h.key:h,O=Object.keys(h).map(function(x){return{boolean:"bools",string:"strings",number:"numbers"}[x]}).filter(Boolean).pop();O&&(m[O][A]=!0),m.arrays[A]=!0,m.keys.push(A)}),[].concat(i.boolean||[]).filter(Boolean).forEach(function(h){m.bools[h]=!0,m.keys.push(h)}),[].concat(i.string||[]).filter(Boolean).forEach(function(h){m.strings[h]=!0,m.keys.push(h)}),[].concat(i.number||[]).filter(Boolean).forEach(function(h){m.numbers[h]=!0,m.keys.push(h)}),[].concat(i.count||[]).filter(Boolean).forEach(function(h){m.counts[h]=!0,m.keys.push(h)}),[].concat(i.normalize||[]).filter(Boolean).forEach(function(h){m.normalize[h]=!0,m.keys.push(h)}),typeof i.narg=="object"&&Object.entries(i.narg).forEach(([h,A])=>{typeof A=="number"&&(m.nargs[h]=A,m.keys.push(h))}),typeof i.coerce=="object"&&Object.entries(i.coerce).forEach(([h,A])=>{typeof A=="function"&&(m.coercions[h]=A,m.keys.push(h))}),typeof i.config!="undefined"&&(Array.isArray(i.config)||typeof i.config=="string"?[].concat(i.config).filter(Boolean).forEach(function(h){m.configs[h]=!0}):typeof i.config=="object"&&Object.entries(i.config).forEach(([h,A])=>{(typeof A=="boolean"||typeof A=="function")&&(m.configs[h]=A)})),jt(i.key,s,i.default,m.arrays),Object.keys(l).forEach(function(h){(m.aliases[h]||[]).forEach(function(A){l[A]=l[h]})});let q=null;On();let G=[],K=Object.assign(Object.create(null),{_:[]}),ot={};for(let h=0;h<r.length;h++){let A=r[h],O=A.replace(/^-{3,}/,"---"),x,y,L,I,N,de;if(A!=="--"&&ie(A))Ye(A);else if(O.match(/---+(=|$)/)){Ye(A);continue}else if(A.match(/^--.+=/)||!a["short-option-groups"]&&A.match(/^-.+=/))I=A.match(/^--?([^=]+)=([\s\S]*)$/),I!==null&&Array.isArray(I)&&I.length>=3&&($(I[1],m.arrays)?h=St(h,I[1],r,I[2]):$(I[1],m.nargs)!==!1?h=Vt(h,I[1],r,I[2]):Q(I[1],I[2],!0));else if(A.match(_)&&a["boolean-negation"])I=A.match(_),I!==null&&Array.isArray(I)&&I.length>=2&&(y=I[1],Q(y,$(y,m.arrays)?[!1]:!1));else if(A.match(/^--.+/)||!a["short-option-groups"]&&A.match(/^-[^-]+/))I=A.match(/^--?(.+)/),I!==null&&Array.isArray(I)&&I.length>=2&&(y=I[1],$(y,m.arrays)?h=St(h,y,r):$(y,m.nargs)!==!1?h=Vt(h,y,r):(N=r[h+1],N!==void 0&&(!N.match(/^-/)||N.match(j))&&!$(y,m.bools)&&!$(y,m.counts)||/^(true|false)$/.test(N)?(Q(y,N),h++):Q(y,re(y))));else if(A.match(/^-.\..+=/))I=A.match(/^-([^=]+)=([\s\S]*)$/),I!==null&&Array.isArray(I)&&I.length>=3&&Q(I[1],I[2]);else if(A.match(/^-.\..+/)&&!A.match(j))N=r[h+1],I=A.match(/^-(.\..+)/),I!==null&&Array.isArray(I)&&I.length>=2&&(y=I[1],N!==void 0&&!N.match(/^-/)&&!$(y,m.bools)&&!$(y,m.counts)?(Q(y,N),h++):Q(y,re(y)));else if(A.match(/^-[^-]+/)&&!A.match(j)){L=A.slice(1,-1).split(""),x=!1;for(let Ee=0;Ee<L.length;Ee++){if(N=A.slice(Ee+2),L[Ee+1]&&L[Ee+1]==="="){de=A.slice(Ee+3),y=L[Ee],$(y,m.arrays)?h=St(h,y,r,de):$(y,m.nargs)!==!1?h=Vt(h,y,r,de):Q(y,de),x=!0;break}if(N==="-"){Q(L[Ee],N);continue}if(/[A-Za-z]/.test(L[Ee])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(N)&&$(N,m.bools)===!1){Q(L[Ee],N),x=!0;break}if(L[Ee+1]&&L[Ee+1].match(/\W/)){Q(L[Ee],N),x=!0;break}else Q(L[Ee],re(L[Ee]))}y=A.slice(-1)[0],!x&&y!=="-"&&($(y,m.arrays)?h=St(h,y,r):$(y,m.nargs)!==!1?h=Vt(h,y,r):(N=r[h+1],N!==void 0&&(!/^(-|--)[^-]/.test(N)||N.match(j))&&!$(y,m.bools)&&!$(y,m.counts)||/^(true|false)$/.test(N)?(Q(y,N),h++):Q(y,re(y))))}else if(A.match(/^-[0-9]$/)&&A.match(j)&&$(A.slice(1),m.bools))y=A.slice(1),Q(y,re(y));else if(A==="--"){G=r.slice(h+1);break}else if(a["halt-at-non-option"]){G=r.slice(h);break}else Ye(A)}V(K,!0),V(K,!1),Y(K),se(),ne(K,m.aliases,l,!0),fe(K),a["set-placeholder-key"]&&It(K),Object.keys(m.counts).forEach(function(h){Ze(K,h.split("."))||Q(h,0)}),f&&G.length&&(K[p]=[]),G.forEach(function(h){K[p].push(h)}),a["camel-case-expansion"]&&a["strip-dashed"]&&Object.keys(K).filter(h=>h!=="--"&&h.includes("-")).forEach(h=>{delete K[h]}),a["strip-aliased"]&&[].concat(...Object.keys(s).map(h=>s[h])).forEach(h=>{a["camel-case-expansion"]&&h.includes("-")&&delete K[h.split(".").map(A=>Pt(A)).join(".")],delete K[h]});function Ye(h){let A=R("_",h);(typeof A=="string"||typeof A=="number")&&K._.push(A)}function Vt(h,A,O,x){let y,L=$(A,m.nargs);if(L=typeof L!="number"||isNaN(L)?1:L,L===0)return qe(x)||(q=Error(w("Argument unexpected for: %s",A))),Q(A,re(A)),h;let I=qe(x)?0:1;if(a["nargs-eats-options"])O.length-(h+1)+I<L&&(q=Error(w("Not enough arguments following: %s",A))),I=L;else{for(y=h+1;y<O.length&&(!O[y].match(/^-[^0-9]/)||O[y].match(j)||ie(O[y]));y++)I++;I<L&&(q=Error(w("Not enough arguments following: %s",A)))}let N=Math.min(I,L);for(!qe(x)&&N>0&&(Q(A,x),N--),y=h+1;y<N+h+1;y++)Q(A,O[y]);return h+N}function St(h,A,O,x){let y=[],L=x||O[h+1],I=$(A,m.nargs);if($(A,m.bools)&&!/^(true|false)$/.test(L))y.push(!0);else if(qe(L)||qe(x)&&/^-/.test(L)&&!j.test(L)&&!ie(L)){if(l[A]!==void 0){let N=l[A];y=Array.isArray(N)?N:[N]}}else{qe(x)||y.push(S(A,x,!0));for(let N=h+1;N<O.length&&!(!a["greedy-arrays"]&&y.length>0||I&&typeof I=="number"&&y.length>=I||(L=O[N],/^-/.test(L)&&!j.test(L)&&!ie(L)));N++)h=N,y.push(S(A,L,o))}return typeof I=="number"&&(I&&y.length<I||isNaN(I)&&y.length===0)&&(q=Error(w("Not enough arguments following: %s",A))),Q(A,y),h}function Q(h,A,O=o){if(/-/.test(h)&&a["camel-case-expansion"]){let L=h.split(".").map(function(I){return Pt(I)}).join(".");F(h,L)}let x=S(h,A,O),y=h.split(".");Xe(K,y,x),m.aliases[h]&&m.aliases[h].forEach(function(L){let I=L.split(".");Xe(K,I,x)}),y.length>1&&a["dot-notation"]&&(m.aliases[y[0]]||[]).forEach(function(L){let I=L.split("."),N=[].concat(y);N.shift(),I=I.concat(N),(m.aliases[h]||[]).includes(I.join("."))||Xe(K,I,x)}),$(h,m.normalize)&&!$(h,m.arrays)&&[h].concat(m.aliases[h]||[]).forEach(function(I){Object.defineProperty(ot,I,{enumerable:!0,get(){return A},set(N){A=typeof N=="string"?et.normalize(N):N}})})}function F(h,A){m.aliases[h]&&m.aliases[h].length||(m.aliases[h]=[A],g[A]=!0),m.aliases[A]&&m.aliases[A].length||F(A,h)}function S(h,A,O){O&&(A=_a(A)),($(h,m.bools)||$(h,m.counts))&&typeof A=="string"&&(A=A==="true");let x=Array.isArray(A)?A.map(function(y){return R(h,y)}):R(h,A);return $(h,m.counts)&&(qe(x)||typeof x=="boolean")&&(x=fi()),$(h,m.normalize)&&$(h,m.arrays)&&(Array.isArray(A)?x=A.map(y=>et.normalize(y)):x=et.normalize(A)),x}function R(h,A){return!a["parse-positional-numbers"]&&h==="_"||!$(h,m.strings)&&!$(h,m.bools)&&!Array.isArray(A)&&(Sn(A)&&a["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${A}`)))||!qe(A)&&$(h,m.numbers))&&(A=Number(A)),A}function Y(h){let A=Object.create(null);ne(A,m.aliases,l),Object.keys(m.configs).forEach(function(O){let x=h[O]||A[O];if(x)try{let y=null,L=et.resolve(et.cwd(),x),I=m.configs[O];if(typeof I=="function"){try{y=I(L)}catch(N){y=N}if(y instanceof Error){q=y;return}}else y=et.require(L);J(y)}catch(y){y.name==="PermissionDenied"?q=y:h[O]&&(q=Error(w("Invalid JSON config file: %s",x)))}})}function J(h,A){Object.keys(h).forEach(function(O){let x=h[O],y=A?A+"."+O:O;typeof x=="object"&&x!==null&&!Array.isArray(x)&&a["dot-notation"]?J(x,y):(!Ze(K,y.split("."))||$(y,m.arrays)&&a["combine-arrays"])&&Q(y,x)})}function se(){typeof u!="undefined"&&u.forEach(function(h){J(h)})}function V(h,A){if(typeof d=="undefined")return;let O=typeof d=="string"?d:"",x=et.env();Object.keys(x).forEach(function(y){if(O===""||y.lastIndexOf(O,0)===0){let L=y.split("__").map(function(I,N){return N===0&&(I=I.substring(O.length)),Pt(I)});(A&&m.configs[L.join(".")]||!A)&&!Ze(h,L)&&Q(L.join("."),x[y])}})}function fe(h){let A,O=new Set;Object.keys(h).forEach(function(x){if(!O.has(x)&&(A=$(x,m.coercions),typeof A=="function"))try{let y=R(x,A(h[x]));[].concat(m.aliases[x]||[],x).forEach(L=>{O.add(L),h[L]=y})}catch(y){q=y}})}function It(h){return m.keys.forEach(A=>{~A.indexOf(".")||typeof h[A]=="undefined"&&(h[A]=void 0)}),h}function ne(h,A,O,x=!1){Object.keys(O).forEach(function(y){Ze(h,y.split("."))||(Xe(h,y.split("."),O[y]),x&&(C[y]=!0),(A[y]||[]).forEach(function(L){Ze(h,L.split("."))||Xe(h,L.split("."),O[y])}))})}function Ze(h,A){let O=h;a["dot-notation"]||(A=[A.join(".")]),A.slice(0,-1).forEach(function(y){O=O[y]||{}});let x=A[A.length-1];return typeof O!="object"?!1:x in O}function Xe(h,A,O){let x=h;a["dot-notation"]||(A=[A.join(".")]),A.slice(0,-1).forEach(function(de){de=hr(de),typeof x=="object"&&x[de]===void 0&&(x[de]={}),typeof x[de]!="object"||Array.isArray(x[de])?(Array.isArray(x[de])?x[de].push({}):x[de]=[x[de],{}],x=x[de][x[de].length-1]):x=x[de]});let y=hr(A[A.length-1]),L=$(A.join("."),m.arrays),I=Array.isArray(O),N=a["duplicate-arguments-array"];!N&&$(y,m.nargs)&&(N=!0,(!qe(x[y])&&m.nargs[y]===1||Array.isArray(x[y])&&x[y].length===m.nargs[y])&&(x[y]=void 0)),O===fi()?x[y]=fi(x[y]):Array.isArray(x[y])?N&&L&&I?x[y]=a["flatten-duplicate-arrays"]?x[y].concat(O):(Array.isArray(x[y][0])?x[y]:[x[y]]).concat([O]):!N&&Boolean(L)===Boolean(I)?x[y]=O:x[y]=x[y].concat([O]):x[y]===void 0&&L?x[y]=I?O:[O]:N&&!(x[y]===void 0||$(y,m.counts)||$(y,m.bools))?x[y]=[x[y],O]:x[y]=O}function jt(...h){h.forEach(function(A){Object.keys(A||{}).forEach(function(O){m.aliases[O]||(m.aliases[O]=[].concat(s[O]||[]),m.aliases[O].concat(O).forEach(function(x){if(/-/.test(x)&&a["camel-case-expansion"]){let y=Pt(x);y!==O&&m.aliases[O].indexOf(y)===-1&&(m.aliases[O].push(y),g[y]=!0)}}),m.aliases[O].concat(O).forEach(function(x){if(x.length>1&&/[A-Z]/.test(x)&&a["camel-case-expansion"]){let y=En(x,"-");y!==O&&m.aliases[O].indexOf(y)===-1&&(m.aliases[O].push(y),g[y]=!0)}}),m.aliases[O].forEach(function(x){m.aliases[x]=[O].concat(m.aliases[O].filter(function(y){return x!==y}))}))})})}function $(h,A){let O=[].concat(m.aliases[h]||[],h),x=Object.keys(A),y=O.find(L=>x.includes(L));return y?A[y]:!1}function si(h){let A=Object.keys(m);return[].concat(A.map(x=>m[x])).some(function(x){return Array.isArray(x)?x.includes(h):x[h]})}function U(h,...A){return[].concat(...A).some(function(x){let y=h.match(x);return y&&si(y[1])})}function ee(h){if(h.match(j)||!h.match(/^-[^-]+/))return!1;let A=!0,O,x=h.slice(1).split("");for(let y=0;y<x.length;y++){if(O=h.slice(y+2),!si(x[y])){A=!1;break}if(x[y+1]&&x[y+1]==="="||O==="-"||/[A-Za-z]/.test(x[y])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(O)||x[y+1]&&x[y+1].match(/\W/))break}return A}function ie(h){return a["unknown-options-as-args"]&&z(h)}function z(h){return h=h.replace(/^-{3,}/,"--"),h.match(j)||ee(h)?!1:!U(h,/^-+([^=]+?)=[\s\S]*$/,_,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function re(h){return!$(h,m.bools)&&!$(h,m.counts)&&`${h}`in l?l[h]:ae(Be(h))}function ae(h){return{[Re.BOOLEAN]:!0,[Re.STRING]:"",[Re.NUMBER]:void 0,[Re.ARRAY]:[]}[h]}function Be(h){let A=Re.BOOLEAN;return $(h,m.strings)?A=Re.STRING:$(h,m.numbers)?A=Re.NUMBER:$(h,m.bools)?A=Re.BOOLEAN:$(h,m.arrays)&&(A=Re.ARRAY),A}function qe(h){return h===void 0}function On(){Object.keys(m.counts).find(h=>$(h,m.arrays)?(q=Error(w("Invalid configuration: %s, opts.count excludes opts.array.",h)),!0):$(h,m.nargs)?(q=Error(w("Invalid configuration: %s, opts.count excludes opts.narg.",h)),!0):!1)}return{aliases:Object.assign({},m.aliases),argv:Object.assign(ot,K),configuration:a,defaulted:Object.assign({},C),error:q,newAliases:Object.assign({},g)}}};function Oa(e){let t=[],n=Object.create(null),i=!0;for(Object.keys(e).forEach(function(r){t.push([].concat(e[r],r))});i;){i=!1;for(let r=0;r<t.length;r++)for(let o=r+1;o<t.length;o++)if(t[r].filter(function(a){return t[o].indexOf(a)!==-1}).length){t[r]=t[r].concat(t[o]),t.splice(o,1),i=!0;break}}return t.forEach(function(r){r=r.filter(function(s,a,l){return l.indexOf(s)===a});let o=r.pop();o!==void 0&&typeof o=="string"&&(n[o]=r)}),n}function fi(e){return e!==void 0?e+1:1}function hr(e){return e==="__proto__"?"___proto___":e}function _a(e){return typeof e=="string"&&(e[0]==="'"||e[0]==='"')&&e[e.length-1]===e[0]?e.substring(1,e.length-1):e}import{readFileSync as Ia}from"fs";var mr=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12;if(process&&process.version&&Number(process.version.match(/v([^.]+)/)[1])<mr)throw Error(`yargs parser supports a minimum Node.js version of ${mr}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);var ja=process?process.env:{},gr=new ci({cwd:process.cwd,env:()=>ja,format:va,normalize:Ea,resolve:Sa,require:e=>{if(typeof ze!="undefined")return ze(e);if(e.match(/\.json$/))return JSON.parse(Ia(e,"utf8"));throw Error("only .json config files are supported in ESM")}}),fn=function(t,n){return gr.parse(t.slice(),n).argv};fn.detailed=function(e,t){return gr.parse(e.slice(),t)};fn.camelCase=Pt;fn.decamelize=En;fn.looksLikeNumber=Sn;var yr=fn;import{basename as Ba,dirname as qa,extname as Ga,relative as za,resolve as Or}from"path";b();function Pa(){return Ma()?0:1}function Ma(){return Fa()&&!process.defaultApp}function Fa(){return!!process.versions.electron}function br(){return process.argv[Pa()]}b();var Z=class extends Error{constructor(t){super(t||"yargs error");this.name="YError",Error.captureStackTrace(this,Z)}};b();b();import{readFileSync as La,statSync as Da,writeFile as Na}from"fs";import{format as Ta}from"util";import{resolve as Ra}from"path";var Ar={fs:{readFileSync:La,writeFile:Na},format:Ta,resolve:Ra,exists:e=>{try{return Da(e).isFile()}catch(t){return!1}}};b();var Ge,wr=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 n=t.shift(),i=function(){};return typeof t[t.length-1]=="function"&&(i=t.pop()),i=i||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][n]&&this.updateFiles?(this.cache[this.locale][n]=n,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:i})):i(),Ge.format.apply(Ge.format,[this.cache[this.locale][n]||n].concat(t))}__n(){let t=Array.prototype.slice.call(arguments),n=t.shift(),i=t.shift(),r=t.shift(),o=function(){};typeof t[t.length-1]=="function"&&(o=t.pop()),this.cache[this.locale]||this._readLocaleFile();let s=r===1?n:i;this.cache[this.locale][n]&&(s=this.cache[this.locale][n][r===1?"one":"other"]),!this.cache[this.locale][n]&&this.updateFiles?(this.cache[this.locale][n]={one:n,other:i},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:o})):o();let a=[s];return~s.indexOf("%d")&&a.push(r),Ge.format.apply(Ge.format,a.concat(t))}setLocale(t){this.locale=t}getLocale(){return this.locale}updateLocale(t){this.cache[this.locale]||this._readLocaleFile();for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&(this.cache[this.locale][n]=t[n])}_taggedLiteral(t,...n){let i="";return t.forEach(function(r,o){let s=n[o+1];i+=r,typeof s!="undefined"&&(i+="%s")}),this.__.apply(this,[i].concat([].slice.call(n,1)))}_enqueueWrite(t){this.writeQueue.push(t),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){let t=this,n=this.writeQueue[0],i=n.directory,r=n.locale,o=n.cb,s=this._resolveLocaleFile(i,r),a=JSON.stringify(this.cache[r],null,2);Ge.fs.writeFile(s,a,"utf-8",function(l){t.writeQueue.shift(),t.writeQueue.length>0&&t._processWriteQueue(),o(l)})}_readLocaleFile(){let t={},n=this._resolveLocaleFile(this.directory,this.locale);try{Ge.fs.readFileSync&&(t=JSON.parse(Ge.fs.readFileSync(n,"utf-8")))}catch(i){if(i instanceof SyntaxError&&(i.message="syntax error in "+n),i.code==="ENOENT")t={};else throw i}this.cache[this.locale]=t}_resolveLocaleFile(t,n){let i=Ge.resolve(t,"./",n+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(i)&&~n.lastIndexOf("_")){let r=Ge.resolve(t,"./",n.split("_")[0]+".json");this._fileExistsSync(r)&&(i=r)}return i}_fileExistsSync(t){return Ge.exists(t)}};function xr(e,t){Ge=t;let n=new wr(e);return{__:n.__.bind(n),__n:n.__n.bind(n),setLocale:n.setLocale.bind(n),getLocale:n.getLocale.bind(n),updateLocale:n.updateLocale.bind(n),locale:n.locale}}var Ua=e=>xr(e,Ar),Cr=Ua;var Qa={},Va="require is not supported by ESM",_r="loading a directory of commands is not supported yet for ESM",In;try{In=Ya(Qa.url)}catch(e){In=process.cwd()}var Ka=In.split("node_modules")[0],vr={assert:{notStrictEqual:$a,strictEqual:Wa},cliui:li,findUp:dr,getEnv:e=>process.env[e],inspect:Ha,getCallerFile:()=>{throw new Z(_r)},getProcessArgvBin:br,mainFilename:Ka||process.cwd(),Parser:yr,path:{basename:Ba,dirname:qa,extname:Ga,relative:za,resolve:Or},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(e,t)=>process.emitWarning(e,t),execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:typeof process.stdout.columns!="undefined"?process.stdout.columns:null},readFileSync:ka,require:()=>{throw new Z(Va)},requireDirectory:()=>{throw new Z(_r)},stringWidth:e=>[...e].length,y18n:Cr({directory:Or(In,"../../../locales"),updateFiles:!1})};b();b();b();function Se(e,t,n,i){n.assert.notStrictEqual(e,t,i)}function ui(e,t){t.assert.strictEqual(typeof e,"string")}function Kt(e){return Object.keys(e)}b();function te(e){return!!e&&!!e.then&&typeof e.then=="function"}b();b();b();function st(e){let n=e.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),i=/\.*[\][<>]/g,r=n.shift();if(!r)throw new Error(`No command found in: ${e}`);let o={cmd:r.replace(i,""),demanded:[],optional:[]};return n.forEach((s,a)=>{let l=!1;s=s.replace(/\s/g,""),/\.+[\]>]/.test(s)&&a===n.length-1&&(l=!0),/^\[/.test(s)?o.optional.push({cmd:s.replace(i,"").split("|"),variadic:l}):o.demanded.push({cmd:s.replace(i,"").split("|"),variadic:l})}),o}var Ja=["first","second","third","fourth","fifth","sixth"];function P(e,t,n){function i(){return typeof e=="object"?[{demanded:[],optional:[]},e,t]:[st(`cmd ${e}`),t,n]}try{let r=0,[o,s,a]=i(),l=[].slice.call(s);for(;l.length&&l[l.length-1]===void 0;)l.pop();let u=a||l.length;if(u<o.demanded.length)throw new Z(`Not enough arguments provided. Expected ${o.demanded.length} but received ${l.length}.`);let d=o.demanded.length+o.optional.length;if(u>d)throw new Z(`Too many arguments provided. Expected max ${d} but received ${u}.`);o.demanded.forEach(f=>{let p=l.shift(),g=Er(p);f.cmd.filter(w=>w===g||w==="*").length===0&&Sr(g,f.cmd,r),r+=1}),o.optional.forEach(f=>{if(l.length===0)return;let p=l.shift(),g=Er(p);f.cmd.filter(w=>w===g||w==="*").length===0&&Sr(g,f.cmd,r),r+=1})}catch(r){console.warn(r.stack)}}function Er(e){return Array.isArray(e)?"array":e===null?"null":typeof e}function Sr(e,t,n){throw new Z(`Invalid ${Ja[n]||"manyith"} argument. Expected ${t.join(" or ")} but received ${e}.`)}var di=class{constructor(t){this.globalMiddleware=[],this.frozens=[],this.yargs=t}addMiddleware(t,n,i=!0,r=!1){if(P("<array|function> [boolean] [boolean] [boolean]",[t,n,i],arguments.length),Array.isArray(t)){for(let o=0;o<t.length;o++){if(typeof t[o]!="function")throw Error("middleware must be a function");let s=t[o];s.applyBeforeValidation=n,s.global=i}Array.prototype.push.apply(this.globalMiddleware,t)}else if(typeof t=="function"){let o=t;o.applyBeforeValidation=n,o.global=i,o.mutates=r,this.globalMiddleware.push(t)}return this.yargs}addCoerceMiddleware(t,n){let i=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(r=>{let o=[...i[n]||[],n];return r.option?!o.includes(r.option):!0}),t.option=n,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 Ir(e){return e?e.map(t=>(t.applyBeforeValidation=!1,t)):[]}function Mt(e,t,n,i){return n.reduce((r,o)=>{if(o.applyBeforeValidation!==i)return r;if(o.mutates){if(o.applied)return r;o.applied=!0}if(te(r))return r.then(s=>Promise.all([s,o(s,t)])).then(([s,a])=>Object.assign(s,a));{let s=o(r,t);return te(s)?s.then(a=>Object.assign(r,a)):Object.assign(r,s)}},e)}b();function Ft(e,t,n=i=>{throw i}){try{let i=Za(e)?e():e;return te(i)?i.then(r=>t(r)):t(i)}catch(i){return n(i)}}function Za(e){return typeof e=="function"}b();function pi(e){if(typeof ze=="undefined")return null;for(let t=0,n=Object.keys(ze.cache),i;t<n.length;t++)if(i=ze.cache[n[t]],i.exports===e)return i;return null}var Qt=/(^\*)|(^\$0)/,jr=class{constructor(t,n,i,r){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=r,this.usage=t,this.globalMiddleware=i,this.validation=n}addDirectory(t,n,i,r){r=r||{},typeof r.recurse!="boolean"&&(r.recurse=!1),Array.isArray(r.extensions)||(r.extensions=["js"]);let o=typeof r.visit=="function"?r.visit:s=>s;r.visit=(s,a,l)=>{let u=o(s,a,l);if(u){if(this.requireCache.has(a))return u;this.requireCache.add(a),this.addHandler(u)}return u},this.shim.requireDirectory({require:n,filename:i},t,r)}addHandler(t,n,i,r,o,s){let a=[],l=Ir(o);if(r=r||(()=>{}),Array.isArray(t))if(Xa(t))[t,...a]=t;else for(let u of t)this.addHandler(u);else if(tl(t)){let u=Array.isArray(t.command)||typeof t.command=="string"?t.command:this.moduleName(t);t.aliases&&(u=[].concat(u).concat(t.aliases)),this.addHandler(u,this.extractDesc(t),t.builder,t.handler,t.middlewares,t.deprecated);return}else if(Mr(i)){this.addHandler([t].concat(a),n,i.builder,i.handler,i.middlewares,i.deprecated);return}if(typeof t=="string"){let u=st(t);a=a.map(p=>st(p).cmd);let d=!1,f=[u.cmd].concat(a).filter(p=>Qt.test(p)?(d=!0,!1):!0);f.length===0&&d&&f.push("$0"),d&&(u.cmd=f[0],a=f.slice(1),t=t.replace(Qt,u.cmd)),a.forEach(p=>{this.aliasMap[p]=u.cmd}),n!==!1&&this.usage.command(t,n,d,a,s),this.handlers[u.cmd]={original:t,description:n,handler:r,builder:i||{},middlewares:l,deprecated:s,demanded:u.demanded,optional:u.optional},d&&(this.defaultCommand=this.handlers[u.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(t,n,i,r,o,s){let a=this.handlers[t]||this.handlers[this.aliasMap[t]]||this.defaultCommand,l=n.getInternalMethods().getContext(),u=l.commands.slice(),d=!t;t&&(l.commands.push(t),l.fullCommands.push(a.original));let f=this.applyBuilderUpdateUsageAndParse(d,a,n,i.aliases,u,r,o,s);return te(f)?f.then(p=>this.applyMiddlewareAndGetResult(d,a,p.innerArgv,l,o,p.aliases,n)):this.applyMiddlewareAndGetResult(d,a,f.innerArgv,l,o,f.aliases,n)}applyBuilderUpdateUsageAndParse(t,n,i,r,o,s,a,l){let u=n.builder,d=i;if(jn(u)){let f=u(i.getInternalMethods().reset(r),l);if(te(f))return f.then(p=>(d=Fr(p)?p:i,this.parseAndUpdateUsage(t,n,d,o,s,a)))}else el(u)&&(d=i.getInternalMethods().reset(r),Object.keys(n.builder).forEach(f=>{d.option(f,u[f])}));return this.parseAndUpdateUsage(t,n,d,o,s,a)}parseAndUpdateUsage(t,n,i,r,o,s){t&&i.getInternalMethods().getUsageInstance().unfreeze(),this.shouldUpdateUsage(i)&&i.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(r,n),n.description);let a=i.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,o,s);return te(a)?a.then(l=>({aliases:i.parsed.aliases,innerArgv:l})):{aliases:i.parsed.aliases,innerArgv:a}}shouldUpdateUsage(t){return!t.getInternalMethods().getUsageInstance().getUsageDisabled()&&t.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(t,n){let i=Qt.test(n.original)?n.original.replace(Qt,"").trim():n.original,r=t.filter(o=>!Qt.test(o));return r.push(i),`$0 ${r.join(" ")}`}applyMiddlewareAndGetResult(t,n,i,r,o,s,a){let l={};if(o)return i;a.getInternalMethods().getHasOutput()||(l=this.populatePositionals(n,i,r,a));let u=this.globalMiddleware.getMiddleware().slice(0).concat(n.middlewares);if(i=Mt(i,a,u,!0),!a.getInternalMethods().getHasOutput()){let d=a.getInternalMethods().runValidation(s,l,a.parsed.error,t);i=Ft(i,f=>(d(f),f))}if(n.handler&&!a.getInternalMethods().getHasOutput()){a.getInternalMethods().setHasOutput();let d=!!a.getOptions().configuration["populate--"];a.getInternalMethods().postProcess(i,d,!1,!1),i=Mt(i,a,u,!1),i=Ft(i,f=>{let p=n.handler(f);return te(p)?p.then(()=>f):f}),t||a.getInternalMethods().getUsageInstance().cacheHelpMessage(),te(i)&&!a.getInternalMethods().hasParseCallback()&&i.catch(f=>{try{a.getInternalMethods().getUsageInstance().fail(null,f)}catch(p){}})}return t||(r.commands.pop(),r.fullCommands.pop()),i}populatePositionals(t,n,i,r){n._=n._.slice(i.commands.length);let o=t.demanded.slice(0),s=t.optional.slice(0),a={};for(this.validation.positionalCount(o.length,n._.length);o.length;){let l=o.shift();this.populatePositional(l,n,a)}for(;s.length;){let l=s.shift();this.populatePositional(l,n,a)}return n._=i.commands.concat(n._.map(l=>""+l)),this.postProcessPositionals(n,a,this.cmdToParseOptions(t.original),r),a}populatePositional(t,n,i){let r=t.cmd[0];t.variadic?i[r]=n._.splice(0).map(String):n._.length&&(i[r]=[String(n._.shift())])}cmdToParseOptions(t){let n={array:[],default:{},alias:{},demand:{}},i=st(t);return i.demanded.forEach(r=>{let[o,...s]=r.cmd;r.variadic&&(n.array.push(o),n.default[o]=[]),n.alias[o]=s,n.demand[o]=!0}),i.optional.forEach(r=>{let[o,...s]=r.cmd;r.variadic&&(n.array.push(o),n.default[o]=[]),n.alias[o]=s}),n}postProcessPositionals(t,n,i,r){let o=Object.assign({},r.getOptions());o.default=Object.assign(i.default,o.default);for(let u of Object.keys(i.alias))o.alias[u]=(o.alias[u]||[]).concat(i.alias[u]);o.array=o.array.concat(i.array),o.config={};let s=[];if(Object.keys(n).forEach(u=>{n[u].map(d=>{o.configuration["unknown-options-as-args"]&&(o.key[u]=!0),s.push(`--${u}`),s.push(d)})}),!s.length)return;let a=Object.assign({},o.configuration,{"populate--":!1}),l=this.shim.Parser.detailed(s,Object.assign({},o,{configuration:a}));if(l.error)r.getInternalMethods().getUsageInstance().fail(l.error.message,l.error);else{let u=Object.keys(n);Object.keys(n).forEach(f=>{u.push(...l.aliases[f])});let d=r.getOptions().default;Object.keys(l.argv).forEach(f=>{u.includes(f)&&(n[f]||(n[f]=l.argv[f]),!Object.prototype.hasOwnProperty.call(d,f)&&Object.prototype.hasOwnProperty.call(t,f)&&Object.prototype.hasOwnProperty.call(l.argv,f)&&(Array.isArray(t[f])||Array.isArray(l.argv[f]))?t[f]=[].concat(t[f],l.argv[f]):t[f]=l.argv[f])})}}runDefaultBuilderOn(t){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(t)){let i=Qt.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");t.getInternalMethods().getUsageInstance().usage(i,this.defaultCommand.description)}let n=this.defaultCommand.builder;if(jn(n))return n(t,!0);Mr(n)||Object.keys(n).forEach(i=>{t.option(i,n[i])})}moduleName(t){let n=pi(t);if(!n)throw new Error(`No command name given for module: ${this.shim.inspect(t)}`);return this.commandFromFilename(n.filename)}commandFromFilename(t){return this.shim.path.basename(t,this.shim.path.extname(t))}extractDesc({describe:t,description:n,desc:i}){for(let r of[t,n,i]){if(typeof r=="string"||r===!1)return r;Se(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();Se(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 Pr(e,t,n,i){return new jr(e,t,n,i)}function Mr(e){return typeof e=="object"&&!!e.builder&&typeof e.handler=="function"}function Xa(e){return e.every(t=>typeof t=="string")}function jn(e){return typeof e=="function"}function el(e){return typeof e=="object"}function tl(e){return typeof e=="object"&&!Array.isArray(e)}b();b();function at(e={},t=()=>!0){let n={};return Kt(e).forEach(i=>{t(i,e[i])&&(n[i]=e[i])}),n}b();function lt(e){typeof process!="undefined"&&[process.stdout,process.stderr].forEach(t=>{let n=t;n._handle&&n.isTTY&&typeof n._handle.setBlocking=="function"&&n._handle.setBlocking(e)})}function nl(e){return typeof e=="boolean"}function Lr(e,t){let n=t.y18n.__,i={},r=[];i.failFn=function(S){r.push(S)};let o=null,s=!0;i.showHelpOnFail=function(S=!0,R){function Y(){return typeof S=="string"?[!0,S]:[S,R]}let[J,se]=Y();return o=se,s=J,i};let a=!1;i.fail=function(S,R){let Y=e.getInternalMethods().getLoggerInstance();if(r.length)for(let J=r.length-1;J>=0;--J){let se=r[J];if(nl(se)){if(R)throw R;if(S)throw Error(S)}else se(S,R,i)}else{if(e.getExitProcess()&&lt(!0),a||(a=!0,s&&(e.showHelp("error"),Y.error()),(S||R)&&Y.error(S||R),o&&((S||R)&&Y.error(""),Y.error(o))),R=R||new Z(S),e.getExitProcess())return e.exit(1);if(e.getInternalMethods().hasParseCallback())return e.exit(1,R);throw R}};let l=[],u=!1;i.usage=(F,S)=>F===null?(u=!0,l=[],i):(u=!1,l.push([F,S||""]),i),i.getUsage=()=>l,i.getUsageDisabled=()=>u,i.getPositionalGroupName=()=>n("Positionals:");let d=[];i.example=(F,S)=>{d.push([F,S||""])};let f=[];i.command=function(S,R,Y,J,se=!1){Y&&(f=f.map(V=>(V[2]=!1,V))),f.push([S,R||"",Y,J,se])},i.getCommands=()=>f;let p={};i.describe=function(S,R){Array.isArray(S)?S.forEach(Y=>{i.describe(Y,R)}):typeof S=="object"?Object.keys(S).forEach(Y=>{i.describe(Y,S[Y])}):p[S]=R},i.getDescriptions=()=>p;let g=[];i.epilog=F=>{g.push(F)};let C=!1,w;i.wrap=F=>{C=!0,w=F};function m(){return C||(w=Vt(),C=!0),w}let j="__yargsString__:";i.deferY18nLookup=F=>j+F,i.help=function(){if(G)return G;q();let S=e.customScriptName?e.$0:t.path.basename(e.$0),R=e.getDemandedOptions(),Y=e.getDemandedCommands(),J=e.getDeprecatedOptions(),se=e.getGroups(),V=e.getOptions(),fe=[];fe=fe.concat(Object.keys(p)),fe=fe.concat(Object.keys(R)),fe=fe.concat(Object.keys(Y)),fe=fe.concat(Object.keys(V.default)),fe=fe.filter(ot),fe=Object.keys(fe.reduce((U,ee)=>(ee!=="_"&&(U[ee]=!0),U),{}));let It=m(),ne=t.cliui({width:It,wrap:!!It});if(!u){if(l.length)l.forEach(U=>{ne.div({text:`${U[0].replace(/\$0/g,S)}`}),U[1]&&ne.div({text:`${U[1]}`,padding:[1,0,0,0]})}),ne.div();else if(f.length){let U=null;Y._?U=`${S} <${n("command")}>
7
+ `:U=`${S} [${n("command")}]
8
+ `,ne.div(`${U}`)}}if(f.length>1||f.length===1&&!f[0][2]){ne.div(n("Commands:"));let U=e.getInternalMethods().getContext(),ee=U.commands.length?`${U.commands.join(" ")} `:"";e.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(f=f.sort((z,re)=>z[0].localeCompare(re[0])));let ie=S?`${S} `:"";f.forEach(z=>{let re=`${ie}${ee}${z[0].replace(/^\$0 ?/,"")}`;ne.span({text:re,padding:[0,2,0,2],width:_(f,It,`${S}${ee}`)+4},{text:z[1]});let ae=[];z[2]&&ae.push(`[${n("default")}]`),z[3]&&z[3].length&&ae.push(`[${n("aliases:")} ${z[3].join(", ")}]`),z[4]&&(typeof z[4]=="string"?ae.push(`[${n("deprecated: %s",z[4])}]`):ae.push(`[${n("deprecated")}]`)),ae.length?ne.div({text:ae.join(" "),padding:[0,0,0,2],align:"right"}):ne.div()}),ne.div()}let Ze=(Object.keys(V.alias)||[]).concat(Object.keys(e.parsed.newAliases)||[]);fe=fe.filter(U=>!e.parsed.newAliases[U]&&Ze.every(ee=>(V.alias[ee]||[]).indexOf(U)===-1));let Xe=n("Options:");se[Xe]||(se[Xe]=[]),K(fe,V.alias,se,Xe);let jt=U=>/^--/.test(Pn(U)),$=Object.keys(se).filter(U=>se[U].length>0).map(U=>{let ee=se[U].filter(ot).map(ie=>{if(Ze.includes(ie))return ie;for(let z=0,re;(re=Ze[z])!==void 0;z++)if((V.alias[re]||[]).includes(ie))return re;return ie});return{groupName:U,normalizedKeys:ee}}).filter(({normalizedKeys:U})=>U.length>0).map(({groupName:U,normalizedKeys:ee})=>{let ie=ee.reduce((z,re)=>(z[re]=[re].concat(V.alias[re]||[]).map(ae=>U===i.getPositionalGroupName()?ae:(/^[0-9]$/.test(ae)?V.boolean.includes(re)?"-":"--":ae.length>1?"--":"-")+ae).sort((ae,Be)=>jt(ae)===jt(Be)?0:jt(ae)?1:-1).join(", "),z),{});return{groupName:U,normalizedKeys:ee,switches:ie}});if($.filter(({groupName:U})=>U!==i.getPositionalGroupName()).some(({normalizedKeys:U,switches:ee})=>!U.every(ie=>jt(ee[ie])))&&$.filter(({groupName:U})=>U!==i.getPositionalGroupName()).forEach(({normalizedKeys:U,switches:ee})=>{U.forEach(ie=>{jt(ee[ie])&&(ee[ie]=il(ee[ie],"-x, ".length))})}),$.forEach(({groupName:U,normalizedKeys:ee,switches:ie})=>{ne.div(U),ee.forEach(z=>{let re=ie[z],ae=p[z]||"",Be=null;ae.includes(j)&&(ae=n(ae.substring(j.length))),V.boolean.includes(z)&&(Be=`[${n("boolean")}]`),V.count.includes(z)&&(Be=`[${n("count")}]`),V.string.includes(z)&&(Be=`[${n("string")}]`),V.normalize.includes(z)&&(Be=`[${n("string")}]`),V.array.includes(z)&&(Be=`[${n("array")}]`),V.number.includes(z)&&(Be=`[${n("number")}]`);let qe=h=>typeof h=="string"?`[${n("deprecated: %s",h)}]`:`[${n("deprecated")}]`,On=[z in J?qe(J[z]):null,Be,z in R?`[${n("required")}]`:null,V.choices&&V.choices[z]?`[${n("choices:")} ${i.stringifiedValues(V.choices[z])}]`:null,Ye(V.default[z],V.defaultDescription[z])].filter(Boolean).join(" ");ne.span({text:Pn(re),padding:[0,2,0,2+Dr(re)],width:_(ie,It)+4},ae),On?ne.div({text:On,padding:[0,0,0,2],align:"right"}):ne.div()}),ne.div()}),d.length&&(ne.div(n("Examples:")),d.forEach(U=>{U[0]=U[0].replace(/\$0/g,S)}),d.forEach(U=>{U[1]===""?ne.div({text:U[0],padding:[0,2,0,2]}):ne.div({text:U[0],padding:[0,2,0,2],width:_(d,It)+4},{text:U[1]})}),ne.div()),g.length>0){let U=g.map(ee=>ee.replace(/\$0/g,S)).join(`
9
+ `);ne.div(`${U}
10
+ `)}return ne.toString().replace(/\s*$/,"")};function _(F,S,R){let Y=0;return Array.isArray(F)||(F=Object.values(F).map(J=>[J])),F.forEach(J=>{Y=Math.max(t.stringWidth(R?`${R} ${Pn(J[0])}`:Pn(J[0]))+Dr(J[0]),Y)}),S&&(Y=Math.min(Y,parseInt((S*.5).toString(),10))),Y}function q(){let F=e.getDemandedOptions(),S=e.getOptions();(Object.keys(S.alias)||[]).forEach(R=>{S.alias[R].forEach(Y=>{p[Y]&&i.describe(R,p[Y]),Y in F&&e.demandOption(R,F[Y]),S.boolean.includes(Y)&&e.boolean(R),S.count.includes(Y)&&e.count(R),S.string.includes(Y)&&e.string(R),S.normalize.includes(Y)&&e.normalize(R),S.array.includes(Y)&&e.array(R),S.number.includes(Y)&&e.number(R)})})}let G;i.cacheHelpMessage=function(){G=this.help()},i.clearCachedHelpMessage=function(){G=void 0},i.hasCachedHelpMessage=function(){return!!G};function K(F,S,R,Y){let J=[],se=null;return Object.keys(R).forEach(V=>{J=J.concat(R[V])}),F.forEach(V=>{se=[V].concat(S[V]),se.some(fe=>J.indexOf(fe)!==-1)||R[Y].push(V)}),J}function ot(F){return e.getOptions().hiddenOptions.indexOf(F)<0||e.parsed.argv[e.getOptions().showHiddenOpt]}i.showHelp=F=>{let S=e.getInternalMethods().getLoggerInstance();F||(F="error"),(typeof F=="function"?F:S[F])(i.help())},i.functionDescription=F=>{let S=F.name?t.Parser.decamelize(F.name,"-"):n("generated-value");return["(",S,")"].join("")},i.stringifiedValues=function(S,R){let Y="",J=R||", ",se=[].concat(S);return!S||!se.length||se.forEach(V=>{Y.length&&(Y+=J),Y+=JSON.stringify(V)}),Y};function Ye(F,S){let R=`[${n("default:")} `;if(F===void 0&&!S)return null;if(S)R+=S;else switch(typeof F){case"string":R+=`"${F}"`;break;case"object":R+=JSON.stringify(F);break;default:R+=F}return`${R}]`}function Vt(){let F=80;return t.process.stdColumns?Math.min(F,t.process.stdColumns):F}let St=null;i.version=F=>{St=F},i.showVersion=F=>{let S=e.getInternalMethods().getLoggerInstance();F||(F="error"),(typeof F=="function"?F:S[F])(St)},i.reset=function(S){return o=null,a=!1,l=[],u=!1,g=[],d=[],f=[],p=at(p,R=>!S[R]),i};let Q=[];return i.freeze=function(){Q.push({failMessage:o,failureOutput:a,usages:l,usageDisabled:u,epilogs:g,examples:d,commands:f,descriptions:p})},i.unfreeze=function(){let S=Q.pop();!S||({failMessage:o,failureOutput:a,usages:l,usageDisabled:u,epilogs:g,examples:d,commands:f,descriptions:p}=S)},i}function hi(e){return typeof e=="object"}function il(e,t){return hi(e)?{text:e.text,indentation:e.indentation+t}:{text:e,indentation:t}}function Dr(e){return hi(e)?e.indentation:0}function Pn(e){return hi(e)?e.text:e}b();b();var Nr=`###-begin-{{app_name}}-completions-###
11
11
  #
12
12
  # yargs command completion script
13
13
  #
@@ -35,7 +35,7 @@ _{{app_name}}_yargs_completions()
35
35
  }
36
36
  complete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}
37
37
  ###-end-{{app_name}}-completions-###
38
- `,xn=`#compdef {{app_name}}
38
+ `,Tr=`#compdef {{app_name}}
39
39
  ###-begin-{{app_name}}-completions-###
40
40
  #
41
41
  # yargs command completion script
@@ -54,15 +54,49 @@ _{{app_name}}_yargs_completions()
54
54
  }
55
55
  compdef _{{app_name}}_yargs_completions {{app_name}}
56
56
  ###-end-{{app_name}}-completions-###
57
- `;var Pn=class{constructor(t,e,n,i){var o,a,f;this.yargs=t,this.usage=e,this.command=n,this.shim=i,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.zshShell=(f=((o=this.shim.getEnv("SHELL"))===null||o===void 0?void 0:o.includes("zsh"))||((a=this.shim.getEnv("ZSH_NAME"))===null||a===void 0?void 0:a.includes("zsh")))!==null&&f!==void 0?f:!1}defaultCompletion(t,e,n,i){let o=this.command.getCommandHandlers();for(let f=0,m=t.length;f<m;++f)if(o[t[f]]&&o[t[f]].builder){let _=o[t[f]].builder;if(de(_)){let b=this.yargs.getInternalMethods().reset();return _(b,!0),b.argv}}let a=[];this.commandCompletions(a,t,n),this.optionCompletions(a,t,e,n),this.choicesCompletions(a,t,e,n),i(null,a)}commandCompletions(t,e,n){let i=this.yargs.getInternalMethods().getContext().commands;!n.match(/^-/)&&i[i.length-1]!==n&&!this.previousArgHasChoices(e)&&this.usage.getCommands().forEach(o=>{let a=Mt(o[0]).cmd;if(e.indexOf(a)===-1)if(!this.zshShell)t.push(a);else{let f=o[1]||"";t.push(a.replace(/:/g,"\\:")+":"+f)}})}optionCompletions(t,e,n,i){if((i.match(/^-/)||i===""&&t.length===0)&&!this.previousArgHasChoices(e)){let o=this.yargs.getOptions(),a=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(o.key).forEach(f=>{let m=!!o.configuration["boolean-negation"]&&o.boolean.includes(f);!a.includes(f)&&!this.argsContainKey(e,n,f,m)&&(this.completeOptionKey(f,t,i),m&&!!o.default[f]&&this.completeOptionKey(`no-${f}`,t,i))})}}choicesCompletions(t,e,n,i){if(this.previousArgHasChoices(e)){let o=this.getPreviousArgChoices(e);o&&o.length>0&&t.push(...o)}}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 i=e.replace(/-/g,""),o=this.yargs.getOptions();if(Object.keys(o.key).some(a=>a===i)&&Array.isArray(o.choices[i]))return o.choices[i].filter(a=>!n||a.startsWith(n))}previousArgHasChoices(t){let e=this.getPreviousArgChoices(t);return e!==void 0&&e.length>0}argsContainKey(t,e,n,i){if(t.indexOf(`--${n}`)!==-1||i&&t.indexOf(`--no-${n}`)!==-1)return!0;if(this.aliases){for(let o of this.aliases[n])if(e[o]!==void 0)return!0}return!1}completeOptionKey(t,e,n){let i=this.usage.getDescriptions(),o=m=>/^--/.test(m),a=m=>/^[^0-9]$/.test(m),f=!o(n)&&a(t)?"-":"--";if(!this.zshShell)e.push(f+t);else{let m=i[t]||"";e.push(f+`${t.replace(/:/g,"\\:")}:${m.replace("__yargsString__:","")}`)}}customCompletion(t,e,n,i){if(lt(this.customCompletionFunction,null,this.shim),qi(this.customCompletionFunction)){let o=this.customCompletionFunction(n,e);return Q(o)?o.then(a=>{this.shim.process.nextTick(()=>{i(null,a)})}).catch(a=>{this.shim.process.nextTick(()=>{i(a,void 0)})}):i(null,o)}else return Vi(this.customCompletionFunction)?this.customCompletionFunction(n,e,(o=i)=>this.defaultCompletion(t,e,n,o),o=>{i(null,o)}):this.customCompletionFunction(n,e,o=>{i(null,o)})}getCompletion(t,e){let n=t.length?t[t.length-1]:"",i=this.yargs.parse(t,!0),o=this.customCompletionFunction?a=>this.customCompletion(t,a,n,e):a=>this.defaultCompletion(t,a,n,e);return Q(i)?i.then(o):o(i)}generateCompletionScript(t,e){let n=this.zshShell?xn:An,i=this.shim.path.basename(t);return t.match(/\.js$/)&&(t=`./${t}`),n=n.replace(/{{app_name}}/g,i),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 Sn(s,t,e,n){return new Pn(s,t,e,n)}function qi(s){return s.length<3}function Vi(s){return s.length>3}function Mn(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 i;for(i=0;i<=s.length;i++)e[0][i]=i;for(n=1;n<=t.length;n++)for(i=1;i<=s.length;i++)t.charAt(n-1)===s.charAt(i-1)?e[n][i]=e[n-1][i-1]:n>1&&i>1&&t.charAt(n-2)===s.charAt(i-1)&&t.charAt(n-1)===s.charAt(i-2)?e[n][i]=e[n-2][i-2]+1:e[n][i]=Math.min(e[n-1][i-1]+1,Math.min(e[n][i-1]+1,e[n-1][i]+1));return e[t.length][s.length]}var In=["$0","--","_"];function $n(s,t,e){let n=e.y18n.__,i=e.y18n.__n,o={};o.nonOptionCount=function(c){let g=s.getDemandedCommands(),M=c._.length+(c["--"]?c["--"].length:0)-s.getInternalMethods().getContext().commands.length;g._&&(M<g._.min||M>g._.max)&&(M<g._.min?g._.minMsg!==void 0?t.fail(g._.minMsg?g._.minMsg.replace(/\$0/g,M.toString()).replace(/\$1/,g._.min.toString()):null):t.fail(i("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",M,M.toString(),g._.min.toString())):M>g._.max&&(g._.maxMsg!==void 0?t.fail(g._.maxMsg?g._.maxMsg.replace(/\$0/g,M.toString()).replace(/\$1/,g._.max.toString()):null):t.fail(i("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",M,M.toString(),g._.max.toString()))))},o.positionalCount=function(c,g){g<c&&t.fail(i("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",g,g+"",c+""))},o.requiredArguments=function(c,g){let w=null;for(let M of Object.keys(g))(!Object.prototype.hasOwnProperty.call(c,M)||typeof c[M]=="undefined")&&(w=w||{},w[M]=g[M]);if(w){let M=[];for(let d of Object.keys(w)){let U=w[d];U&&M.indexOf(U)<0&&M.push(U)}let y=M.length?`
58
- ${M.join(`
59
- `)}`:"";t.fail(i("Missing required argument: %s","Missing required arguments: %s",Object.keys(w).length,Object.keys(w).join(", ")+y))}},o.unknownArguments=function(c,g,w,M,y=!0){var d;let U=s.getInternalMethods().getCommandInstance().getCommands(),v=[],B=s.getInternalMethods().getContext();if(Object.keys(c).forEach(Y=>{!In.includes(Y)&&!Object.prototype.hasOwnProperty.call(w,Y)&&!Object.prototype.hasOwnProperty.call(s.getInternalMethods().getParseContext(),Y)&&!o.isValidAndSomeAliasIsNotNew(Y,g)&&v.push(Y)}),y&&(B.commands.length>0||U.length>0||M)&&c._.slice(B.commands.length).forEach(Y=>{U.includes(""+Y)||v.push(""+Y)}),y){let q=((d=s.getDemandedCommands()._)===null||d===void 0?void 0:d.max)||0,St=B.commands.length+q;St<c._.length&&c._.slice(St).forEach(_t=>{_t=String(_t),!B.commands.includes(_t)&&!v.includes(_t)&&v.push(_t)})}v.length&&t.fail(i("Unknown argument: %s","Unknown arguments: %s",v.length,v.join(", ")))},o.unknownCommands=function(c){let g=s.getInternalMethods().getCommandInstance().getCommands(),w=[],M=s.getInternalMethods().getContext();return(M.commands.length>0||g.length>0)&&c._.slice(M.commands.length).forEach(y=>{g.includes(""+y)||w.push(""+y)}),w.length>0?(t.fail(i("Unknown command: %s","Unknown commands: %s",w.length,w.join(", "))),!0):!1},o.isValidAndSomeAliasIsNotNew=function(c,g){if(!Object.prototype.hasOwnProperty.call(g,c))return!1;let w=s.parsed.newAliases;return[c,...g[c]].some(M=>!Object.prototype.hasOwnProperty.call(w,M)||!w[c])},o.limitedChoices=function(c){let g=s.getOptions(),w={};if(!Object.keys(g.choices).length)return;Object.keys(c).forEach(d=>{In.indexOf(d)===-1&&Object.prototype.hasOwnProperty.call(g.choices,d)&&[].concat(c[d]).forEach(U=>{g.choices[d].indexOf(U)===-1&&U!==void 0&&(w[d]=(w[d]||[]).concat(U))})});let M=Object.keys(w);if(!M.length)return;let y=n("Invalid values:");M.forEach(d=>{y+=`
60
- ${n("Argument: %s, Given: %s, Choices: %s",d,t.stringifiedValues(w[d]),t.stringifiedValues(g.choices[d]))}`}),t.fail(y)};let a={};o.implies=function(c,g){E("<string|object> [array|number|string]",[c,g],arguments.length),typeof c=="object"?Object.keys(c).forEach(w=>{o.implies(w,c[w])}):(s.global(c),a[c]||(a[c]=[]),Array.isArray(g)?g.forEach(w=>o.implies(c,w)):(lt(g,void 0,e),a[c].push(g)))},o.getImplied=function(){return a};function f(b,c){let g=Number(c);return c=isNaN(g)?c:g,typeof c=="number"?c=b._.length>=c:c.match(/^--no-.+/)?(c=c.match(/^--no-(.+)/)[1],c=!Object.prototype.hasOwnProperty.call(b,c)):c=Object.prototype.hasOwnProperty.call(b,c),c}o.implications=function(c){let g=[];if(Object.keys(a).forEach(w=>{let M=w;(a[w]||[]).forEach(y=>{let d=M,U=y;d=f(c,d),y=f(c,y),d&&!y&&g.push(` ${M} -> ${U}`)})}),g.length){let w=`${n("Implications failed:")}
61
- `;g.forEach(M=>{w+=M}),t.fail(w)}};let m={};o.conflicts=function(c,g){E("<string|object> [array|string]",[c,g],arguments.length),typeof c=="object"?Object.keys(c).forEach(w=>{o.conflicts(w,c[w])}):(s.global(c),m[c]||(m[c]=[]),Array.isArray(g)?g.forEach(w=>o.conflicts(c,w)):m[c].push(g))},o.getConflicting=()=>m,o.conflicting=function(c){Object.keys(c).forEach(g=>{m[g]&&m[g].forEach(w=>{w&&c[g]!==void 0&&c[w]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",g,w))})}),s.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(m).forEach(g=>{m[g].forEach(w=>{w&&c[e.Parser.camelCase(g)]!==void 0&&c[e.Parser.camelCase(w)]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",g,w))})})},o.recommendCommands=function(c,g){let w=3;g=g.sort((d,U)=>U.length-d.length);let M=null,y=1/0;for(let d=0,U;(U=g[d])!==void 0;d++){let v=Mn(c,U);v<=w&&v<y&&(y=v,M=U)}M&&t.fail(n("Did you mean %s?",M))},o.reset=function(c){return a=It(a,g=>!c[g]),m=It(m,g=>!c[g]),o};let _=[];return o.freeze=function(){_.push({implied:a,conflicting:m})},o.unfreeze=function(){let c=_.pop();lt(c,void 0,e),{implied:a,conflicting:m}=c},o}var De=[],se;function me(s,t,e,n){se=n;let i={};if(Object.prototype.hasOwnProperty.call(s,"extends")){if(typeof s.extends!="string")return i;let o=/\.json|\..*rc$/.test(s.extends),a=null;if(o)a=Ki(t,s.extends);else try{a=Ct.resolve(s.extends)}catch(f){return s}Gi(a),De.push(a),i=o?JSON.parse(se.readFileSync(a,"utf8")):Ct(s.extends),delete s.extends,i=me(i,se.path.dirname(a),e,se)}return De=[],e?Fn(i,s):Object.assign({},i,s)}function Gi(s){if(De.indexOf(s)>-1)throw new K(`Circular extended configurations: '${s}'.`)}function Ki(s,t){return se.path.resolve(s,t)}function Fn(s,t){let e={};function n(i){return i&&typeof i=="object"&&!Array.isArray(i)}Object.assign(e,s);for(let i of Object.keys(t))n(t[i])&&n(e[i])?e[i]=Fn(s[i],t[i]):e[i]=t[i];return e}var A=function(s,t,e,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?s!==t||!i:!t.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(s,e):i?i.value=e:t.set(s,e),e},r=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,Tt,re,pt,ct,ge,Ft,Ht,be,mt,_e,gt,jt,ht,bt,te,ot,S,Oe,we,ut,Yt,ee,Bt,Nt,ye,D,qt,Vt,Gt,L,Et,tt;function Nn(s){return(t=[],e=s.process.cwd(),n)=>{let i=new Zn(t,e,n,s);return Object.defineProperty(i,"argv",{get:()=>i.parse(),enumerable:!0}),i.help(),i.version(),i}}var Dn=Symbol("copyDoubleDash"),Wn=Symbol("copyDoubleDash"),We=Symbol("deleteFromParserHintObject"),Ln=Symbol("emitWarning"),Un=Symbol("freeze"),zn=Symbol("getDollarZero"),Kt=Symbol("getParserConfiguration"),Le=Symbol("guessLocale"),Rn=Symbol("guessVersion"),vn=Symbol("parsePositionalNumbers"),Ue=Symbol("pkgUp"),Dt=Symbol("populateParserHintArray"),ne=Symbol("populateParserHintSingleValueDictionary"),ze=Symbol("populateParserHintArrayDictionary"),Re=Symbol("populateParserHintDictionary"),ve=Symbol("sanitizeKey"),Te=Symbol("setKey"),He=Symbol("unfreeze"),Tn=Symbol("validateAsync"),Hn=Symbol("getCommandInstance"),Yn=Symbol("getContext"),Bn=Symbol("getHasOutput"),qn=Symbol("getLoggerInstance"),Vn=Symbol("getParseContext"),Gn=Symbol("getUsageInstance"),Kn=Symbol("getValidationInstance"),Ce=Symbol("hasParseCallback"),Jt=Symbol("postProcess"),Jn=Symbol("rebase"),Ye=Symbol("reset"),oe=Symbol("runYargsParserAndExecuteCommands"),Be=Symbol("runValidation"),Qn=Symbol("setHasOutput"),Qt=Symbol("kTrackManuallySetKeys"),Zn=class{constructor(t=[],e,n,i){this.customScriptName=!1,this.parsed=!1,it.set(this,void 0),Tt.set(this,void 0),re.set(this,{commands:[],fullCommands:[]}),pt.set(this,null),ct.set(this,null),ge.set(this,"show-hidden"),Ft.set(this,null),Ht.set(this,!0),be.set(this,{}),mt.set(this,!0),_e.set(this,[]),gt.set(this,void 0),jt.set(this,{}),ht.set(this,!1),bt.set(this,null),te.set(this,void 0),ot.set(this,""),S.set(this,void 0),Oe.set(this,void 0),we.set(this,{}),ut.set(this,null),Yt.set(this,null),ee.set(this,{}),Bt.set(this,{}),Nt.set(this,void 0),ye.set(this,!1),D.set(this,void 0),qt.set(this,!1),Vt.set(this,!1),Gt.set(this,!1),L.set(this,void 0),Et.set(this,null),tt.set(this,void 0),A(this,D,i,"f"),A(this,Nt,t,"f"),A(this,Tt,e,"f"),A(this,Oe,n,"f"),A(this,gt,new $e(this),"f"),this.$0=this[zn](),this[Ye](),A(this,it,r(this,it,"f"),"f"),A(this,L,r(this,L,"f"),"f"),A(this,tt,r(this,tt,"f"),"f"),A(this,S,r(this,S,"f"),"f"),r(this,S,"f").showHiddenOpt=r(this,ge,"f"),A(this,te,this[Wn](),"f")}addHelpOpt(t,e){let n="help";return E("[string|boolean] [string]",[t,e],arguments.length),r(this,bt,"f")&&(this[We](r(this,bt,"f")),A(this,bt,null,"f")),t===!1&&e===void 0?this:(A(this,bt,typeof t=="string"?t:n,"f"),this.boolean(r(this,bt,"f")),this.describe(r(this,bt,"f"),e||r(this,L,"f").deferY18nLookup("Show help")),this)}help(t,e){return this.addHelpOpt(t,e)}addShowHiddenOpt(t,e){if(E("[string|boolean] [string]",[t,e],arguments.length),t===!1&&e===void 0)return this;let n=typeof t=="string"?t:r(this,ge,"f");return this.boolean(n),this.describe(n,e||r(this,L,"f").deferY18nLookup("Show hidden options")),r(this,S,"f").showHiddenOpt=n,this}showHidden(t,e){return this.addShowHiddenOpt(t,e)}alias(t,e){return E("<object|string|array> [string|array]",[t,e],arguments.length),this[ze](this.alias.bind(this),"alias",t,e),this}array(t){return E("<array|string>",[t],arguments.length),this[Dt]("array",t),this[Qt](t),this}boolean(t){return E("<array|string>",[t],arguments.length),this[Dt]("boolean",t),this[Qt](t),this}check(t,e){return E("<function> [boolean]",[t,e],arguments.length),this.middleware((n,i)=>vt(()=>t(n,i.getOptions()),o=>(o?(typeof o=="string"||o instanceof Error)&&r(this,L,"f").fail(o.toString(),o):r(this,L,"f").fail(r(this,D,"f").y18n.__("Argument check failed: %s",t.toString())),n),o=>(r(this,L,"f").fail(o.message?o.message:o.toString(),o),n)),!1,e),this}choices(t,e){return E("<object|string|array> [string|array]",[t,e],arguments.length),this[ze](this.choices.bind(this),"choices",t,e),this}coerce(t,e){if(E("<object|string|array> [function]",[t,e],arguments.length),Array.isArray(t)){if(!e)throw new K("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 K("coerce callback must be provided");return r(this,S,"f").key[t]=!0,r(this,gt,"f").addCoerceMiddleware((n,i)=>{let o;return vt(()=>(o=i.getAliases(),e(n[t])),a=>{if(n[t]=a,o[t])for(let f of o[t])n[f]=a;return n},a=>{throw new K(a.message)})},t),this}conflicts(t,e){return E("<string|object> [string|array]",[t,e],arguments.length),r(this,tt,"f").conflicts(t,e),this}config(t="config",e,n){return E("[object|string] [string|function] [function]",[t,e,n],arguments.length),typeof t=="object"&&!Array.isArray(t)?(t=me(t,r(this,Tt,"f"),this[Kt]()["deep-merge-config"]||!1,r(this,D,"f")),r(this,S,"f").configObjects=(r(this,S,"f").configObjects||[]).concat(t),this):(typeof e=="function"&&(n=e,e=void 0),this.describe(t,e||r(this,L,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach(i=>{r(this,S,"f").config[i]=n||!0}),this)}completion(t,e,n){return E("[string] [string|boolean|function] [function]",[t,e,n],arguments.length),typeof e=="function"&&(n=e,e=void 0),A(this,ct,t||r(this,ct,"f")||"completion","f"),!e&&e!==!1&&(e="generate completion script"),this.command(r(this,ct,"f"),e),n&&r(this,pt,"f").registerFunction(n),this}command(t,e,n,i,o,a){return E("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[t,e,n,i,o,a],arguments.length),r(this,it,"f").addHandler(t,e,n,i,o,a),this}commands(t,e,n,i,o,a){return this.command(t,e,n,i,o,a)}commandDir(t,e){E("<string> [object]",[t,e],arguments.length);let n=r(this,Oe,"f")||r(this,D,"f").require;return r(this,it,"f").addDirectory(t,n,r(this,D,"f").getCallerFile(),e),this}count(t){return E("<array|string>",[t],arguments.length),this[Dt]("count",t),this[Qt](t),this}default(t,e,n){return E("<object|string|array> [*] [string]",[t,e,n],arguments.length),n&&(Ie(t,r(this,D,"f")),r(this,S,"f").defaultDescription[t]=n),typeof e=="function"&&(Ie(t,r(this,D,"f")),r(this,S,"f").defaultDescription[t]||(r(this,S,"f").defaultDescription[t]=r(this,L,"f").functionDescription(e)),e=e.call()),this[ne](this.default.bind(this),"default",t,e),this}defaults(t,e,n){return this.default(t,e,n)}demandCommand(t=1,e,n,i){return E("[number] [number|string] [string|null|undefined] [string|null|undefined]",[t,e,n,i],arguments.length),typeof e!="number"&&(n=e,e=1/0),this.global("_",!1),r(this,S,"f").demandedCommands._={min:t,max:e,minMsg:n,maxMsg:i},this}demand(t,e,n){return Array.isArray(e)?(e.forEach(i=>{lt(n,!0,r(this,D,"f")),this.demandOption(i,n)}),e=1/0):typeof e!="number"&&(n=e,e=1/0),typeof t=="number"?(lt(n,!0,r(this,D,"f")),this.demandCommand(t,e,n,n)):Array.isArray(t)?t.forEach(i=>{lt(n,!0,r(this,D,"f")),this.demandOption(i,n)}):typeof n=="string"?this.demandOption(t,n):(n===!0||typeof n=="undefined")&&this.demandOption(t),this}demandOption(t,e){return E("<object|string|array> [string]",[t,e],arguments.length),this[ne](this.demandOption.bind(this),"demandedOptions",t,e),this}deprecateOption(t,e){return E("<string> [string|boolean]",[t,e],arguments.length),r(this,S,"f").deprecatedOptions[t]=e,this}describe(t,e){return E("<object|string|array> [string]",[t,e],arguments.length),this[Te](t,!0),r(this,L,"f").describe(t,e),this}detectLocale(t){return E("<boolean>",[t],arguments.length),A(this,Ht,t,"f"),this}env(t){return E("[string|boolean]",[t],arguments.length),t===!1?delete r(this,S,"f").envPrefix:r(this,S,"f").envPrefix=t||"",this}epilogue(t){return E("<string>",[t],arguments.length),r(this,L,"f").epilog(t),this}epilog(t){return this.epilogue(t)}example(t,e){return E("<string|array> [string]",[t,e],arguments.length),Array.isArray(t)?t.forEach(n=>this.example(...n)):r(this,L,"f").example(t,e),this}exit(t,e){A(this,ht,!0,"f"),A(this,Ft,e,"f"),r(this,mt,"f")&&r(this,D,"f").process.exit(t)}exitProcess(t=!0){return E("[boolean]",[t],arguments.length),A(this,mt,t,"f"),this}fail(t){if(E("<function|boolean>",[t],arguments.length),typeof t=="boolean"&&t!==!1)throw new K("Invalid first argument. Expected function or boolean 'false'");return r(this,L,"f").failFn(t),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(t,e){return E("<array> [function]",[t,e],arguments.length),e?r(this,pt,"f").getCompletion(t,e):new Promise((n,i)=>{r(this,pt,"f").getCompletion(t,(o,a)=>{o?i(o):n(a)})})}getDemandedOptions(){return E([],0),r(this,S,"f").demandedOptions}getDemandedCommands(){return E([],0),r(this,S,"f").demandedCommands}getDeprecatedOptions(){return E([],0),r(this,S,"f").deprecatedOptions}getDetectLocale(){return r(this,Ht,"f")}getExitProcess(){return r(this,mt,"f")}getGroups(){return Object.assign({},r(this,jt,"f"),r(this,Bt,"f"))}getHelp(){if(A(this,ht,!0,"f"),!r(this,L,"f").hasCachedHelpMessage()){if(!this.parsed){let e=this[oe](r(this,Nt,"f"),void 0,void 0,0,!0);if(Q(e))return e.then(()=>r(this,L,"f").help())}let t=r(this,it,"f").runDefaultBuilderOn(this);if(Q(t))return t.then(()=>r(this,L,"f").help())}return Promise.resolve(r(this,L,"f").help())}getOptions(){return r(this,S,"f")}getStrict(){return r(this,qt,"f")}getStrictCommands(){return r(this,Vt,"f")}getStrictOptions(){return r(this,Gt,"f")}global(t,e){return E("<string|array> [boolean]",[t,e],arguments.length),t=[].concat(t),e!==!1?r(this,S,"f").local=r(this,S,"f").local.filter(n=>t.indexOf(n)===-1):t.forEach(n=>{r(this,S,"f").local.includes(n)||r(this,S,"f").local.push(n)}),this}group(t,e){E("<string|array> <string>",[t,e],arguments.length);let n=r(this,Bt,"f")[e]||r(this,jt,"f")[e];r(this,Bt,"f")[e]&&delete r(this,Bt,"f")[e];let i={};return r(this,jt,"f")[e]=(n||[]).concat(t).filter(o=>i[o]?!1:i[o]=!0),this}hide(t){return E("<string>",[t],arguments.length),r(this,S,"f").hiddenOptions.push(t),this}implies(t,e){return E("<string|object> [number|string|array]",[t,e],arguments.length),r(this,tt,"f").implies(t,e),this}locale(t){return E("[string]",[t],arguments.length),t?(A(this,Ht,!1,"f"),r(this,D,"f").y18n.setLocale(t),this):(this[Le](),r(this,D,"f").y18n.getLocale())}middleware(t,e,n){return r(this,gt,"f").addMiddleware(t,!!e,n)}nargs(t,e){return E("<string|object|array> [number]",[t,e],arguments.length),this[ne](this.nargs.bind(this),"narg",t,e),this}normalize(t){return E("<array|string>",[t],arguments.length),this[Dt]("normalize",t),this}number(t){return E("<array|string>",[t],arguments.length),this[Dt]("number",t),this[Qt](t),this}option(t,e){if(E("<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[Qt](t),r(this,Et,"f")&&(t==="version"||(e==null?void 0:e.alias)==="version")&&this[Ln](['"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(`
62
- `),void 0,"versionWarning"),r(this,S,"f").key[t]=!0,e.alias&&this.alias(t,e.alias);let n=e.deprecate||e.deprecated;n&&this.deprecateOption(t,n);let i=e.demand||e.required||e.require;i&&this.demand(t,i),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&&(r(this,S,"f").defaultDescription[t]=e.defaultDescription),e.skipValidation&&this.skipValidation(t);let o=e.describe||e.description||e.desc;this.describe(t,o),e.hidden&&this.hide(t),e.requiresArg&&this.requiresArg(t)}return this}options(t,e){return this.option(t,e)}parse(t,e,n){E("[string|array] [function|boolean|object] [function]",[t,e,n],arguments.length),this[Un](),typeof t=="undefined"&&(t=r(this,Nt,"f")),typeof e=="object"&&(A(this,Yt,e,"f"),e=n),typeof e=="function"&&(A(this,ut,e,"f"),e=!1),e||A(this,Nt,t,"f"),r(this,ut,"f")&&A(this,mt,!1,"f");let i=this[oe](t,!!e),o=this.parsed;return r(this,pt,"f").setParsed(this.parsed),Q(i)?i.then(a=>(r(this,ut,"f")&&r(this,ut,"f").call(this,r(this,Ft,"f"),a,r(this,ot,"f")),a)).catch(a=>{throw r(this,ut,"f")&&r(this,ut,"f")(a,this.parsed.argv,r(this,ot,"f")),a}).finally(()=>{this[He](),this.parsed=o}):(r(this,ut,"f")&&r(this,ut,"f").call(this,r(this,Ft,"f"),i,r(this,ot,"f")),this[He](),this.parsed=o,i)}parseAsync(t,e,n){let i=this.parse(t,e,n);return Q(i)?i:Promise.resolve(i)}parseSync(t,e,n){let i=this.parse(t,e,n);if(Q(i))throw new K(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return i}parserConfiguration(t){return E("<object>",[t],arguments.length),A(this,we,t,"f"),this}pkgConf(t,e){E("<string> [string]",[t,e],arguments.length);let n=null,i=this[Ue](e||r(this,Tt,"f"));return i[t]&&typeof i[t]=="object"&&(n=me(i[t],e||r(this,Tt,"f"),this[Kt]()["deep-merge-config"]||!1,r(this,D,"f")),r(this,S,"f").configObjects=(r(this,S,"f").configObjects||[]).concat(n)),this}positional(t,e){E("<string> <object>",[t,e],arguments.length);let n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];e=It(e,(a,f)=>a==="type"&&!["string","number","boolean"].includes(f)?!1:n.includes(a));let i=r(this,re,"f").fullCommands[r(this,re,"f").fullCommands.length-1],o=i?r(this,it,"f").cmdToParseOptions(i):{array:[],alias:{},default:{},demand:{}};return Xt(o).forEach(a=>{let f=o[a];Array.isArray(f)?f.indexOf(t)!==-1&&(e[a]=!0):f[t]&&!(a in e)&&(e[a]=f[t])}),this.group(t,r(this,L,"f").getPositionalGroupName()),this.option(t,e)}recommendCommands(t=!0){return E("[boolean]",[t],arguments.length),A(this,ye,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 E("<array|string|object> [number]",[t],arguments.length),typeof t=="string"&&r(this,S,"f").narg[t]?this:(this[ne](this.requiresArg.bind(this),"narg",t,NaN),this)}showCompletionScript(t,e){return E("[string] [string]",[t,e],arguments.length),t=t||this.$0,r(this,te,"f").log(r(this,pt,"f").generateCompletionScript(t,e||r(this,ct,"f")||"completion")),this}showHelp(t){if(E("[string|function]",[t],arguments.length),A(this,ht,!0,"f"),!r(this,L,"f").hasCachedHelpMessage()){if(!this.parsed){let n=this[oe](r(this,Nt,"f"),void 0,void 0,0,!0);if(Q(n))return n.then(()=>{r(this,L,"f").showHelp(t)}),this}let e=r(this,it,"f").runDefaultBuilderOn(this);if(Q(e))return e.then(()=>{r(this,L,"f").showHelp(t)}),this}return r(this,L,"f").showHelp(t),this}scriptName(t){return this.customScriptName=!0,this.$0=t,this}showHelpOnFail(t,e){return E("[boolean|string] [string]",[t,e],arguments.length),r(this,L,"f").showHelpOnFail(t,e),this}showVersion(t){return E("[string|function]",[t],arguments.length),r(this,L,"f").showVersion(t),this}skipValidation(t){return E("<array|string>",[t],arguments.length),this[Dt]("skipValidation",t),this}strict(t){return E("[boolean]",[t],arguments.length),A(this,qt,t!==!1,"f"),this}strictCommands(t){return E("[boolean]",[t],arguments.length),A(this,Vt,t!==!1,"f"),this}strictOptions(t){return E("[boolean]",[t],arguments.length),A(this,Gt,t!==!1,"f"),this}string(t){return E("<array|string>",[t],arguments.length),this[Dt]("string",t),this[Qt](t),this}terminalWidth(){return E([],0),r(this,D,"f").process.stdColumns}updateLocale(t){return this.updateStrings(t)}updateStrings(t){return E("<object>",[t],arguments.length),A(this,Ht,!1,"f"),r(this,D,"f").y18n.updateLocale(t),this}usage(t,e,n,i){if(E("<string|null|undefined> [string|boolean] [function|object] [function]",[t,e,n,i],arguments.length),e!==void 0){if(lt(t,null,r(this,D,"f")),(t||"").match(/^\$0( |$)/))return this.command(t,e,n,i);throw new K(".usage() description must start with $0 if being used as alias for .command()")}else return r(this,L,"f").usage(t),this}version(t,e,n){let i="version";if(E("[boolean|string] [string] [string]",[t,e,n],arguments.length),r(this,Et,"f")&&(this[We](r(this,Et,"f")),r(this,L,"f").version(void 0),A(this,Et,null,"f")),arguments.length===0)n=this[Rn](),t=i;else if(arguments.length===1){if(t===!1)return this;n=t,t=i}else arguments.length===2&&(n=e,e=void 0);return A(this,Et,typeof t=="string"?t:i,"f"),e=e||r(this,L,"f").deferY18nLookup("Show version number"),r(this,L,"f").version(n||void 0),this.boolean(r(this,Et,"f")),this.describe(r(this,Et,"f"),e),this}wrap(t){return E("<number|null|undefined>",[t],arguments.length),r(this,L,"f").wrap(t),this}[(it=new WeakMap,Tt=new WeakMap,re=new WeakMap,pt=new WeakMap,ct=new WeakMap,ge=new WeakMap,Ft=new WeakMap,Ht=new WeakMap,be=new WeakMap,mt=new WeakMap,_e=new WeakMap,gt=new WeakMap,jt=new WeakMap,ht=new WeakMap,bt=new WeakMap,te=new WeakMap,ot=new WeakMap,S=new WeakMap,Oe=new WeakMap,we=new WeakMap,ut=new WeakMap,Yt=new WeakMap,ee=new WeakMap,Bt=new WeakMap,Nt=new WeakMap,ye=new WeakMap,D=new WeakMap,qt=new WeakMap,Vt=new WeakMap,Gt=new WeakMap,L=new WeakMap,Et=new WeakMap,tt=new WeakMap,Dn)](t){if(!t._||!t["--"])return t;t._.push.apply(t._,t["--"]);try{delete t["--"]}catch(e){}return t}[Wn](){return{log:(...t)=>{this[Ce]()||console.log(...t),A(this,ht,!0,"f"),r(this,ot,"f").length&&A(this,ot,r(this,ot,"f")+`
63
- `,"f"),A(this,ot,r(this,ot,"f")+t.join(" "),"f")},error:(...t)=>{this[Ce]()||console.error(...t),A(this,ht,!0,"f"),r(this,ot,"f").length&&A(this,ot,r(this,ot,"f")+`
64
- `,"f"),A(this,ot,r(this,ot,"f")+t.join(" "),"f")}}}[We](t){Xt(r(this,S,"f")).forEach(e=>{if((i=>i==="configObjects")(e))return;let n=r(this,S,"f")[e];Array.isArray(n)?n.includes(t)&&n.splice(n.indexOf(t),1):typeof n=="object"&&delete n[t]}),delete r(this,L,"f").getDescriptions()[t]}[Ln](t,e,n){r(this,be,"f")[n]||(r(this,D,"f").process.emitWarning(t,e),r(this,be,"f")[n]=!0)}[Un](){r(this,_e,"f").push({options:r(this,S,"f"),configObjects:r(this,S,"f").configObjects.slice(0),exitProcess:r(this,mt,"f"),groups:r(this,jt,"f"),strict:r(this,qt,"f"),strictCommands:r(this,Vt,"f"),strictOptions:r(this,Gt,"f"),completionCommand:r(this,ct,"f"),output:r(this,ot,"f"),exitError:r(this,Ft,"f"),hasOutput:r(this,ht,"f"),parsed:this.parsed,parseFn:r(this,ut,"f"),parseContext:r(this,Yt,"f")}),r(this,L,"f").freeze(),r(this,tt,"f").freeze(),r(this,it,"f").freeze(),r(this,gt,"f").freeze()}[zn](){let t="",e;return/\b(node|iojs|electron)(\.exe)?$/.test(r(this,D,"f").process.argv()[0])?e=r(this,D,"f").process.argv().slice(1,2):e=r(this,D,"f").process.argv().slice(0,1),t=e.map(n=>{let i=this[Jn](r(this,Tt,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&i.length<n.length?i:n}).join(" ").trim(),r(this,D,"f").getEnv("_")&&r(this,D,"f").getProcessArgvBin()===r(this,D,"f").getEnv("_")&&(t=r(this,D,"f").getEnv("_").replace(`${r(this,D,"f").path.dirname(r(this,D,"f").process.execPath())}/`,"")),t}[Kt](){return r(this,we,"f")}[Le](){if(!r(this,Ht,"f"))return;let t=r(this,D,"f").getEnv("LC_ALL")||r(this,D,"f").getEnv("LC_MESSAGES")||r(this,D,"f").getEnv("LANG")||r(this,D,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[Rn](){return this[Ue]().version||"unknown"}[vn](t){let e=t["--"]?t["--"]:t._;for(let n=0,i;(i=e[n])!==void 0;n++)r(this,D,"f").Parser.looksLikeNumber(i)&&Number.isSafeInteger(Math.floor(parseFloat(`${i}`)))&&(e[n]=Number(i));return t}[Ue](t){let e=t||"*";if(r(this,ee,"f")[e])return r(this,ee,"f")[e];let n={};try{let i=t||r(this,D,"f").mainFilename;!t&&r(this,D,"f").path.extname(i)&&(i=r(this,D,"f").path.dirname(i));let o=r(this,D,"f").findUp(i,(a,f)=>{if(f.includes("package.json"))return"package.json"});lt(o,void 0,r(this,D,"f")),n=JSON.parse(r(this,D,"f").readFileSync(o,"utf8"))}catch(i){}return r(this,ee,"f")[e]=n||{},r(this,ee,"f")[e]}[Dt](t,e){e=[].concat(e),e.forEach(n=>{n=this[ve](n),r(this,S,"f")[t].push(n)})}[ne](t,e,n,i){this[Re](t,e,n,i,(o,a,f)=>{r(this,S,"f")[o][a]=f})}[ze](t,e,n,i){this[Re](t,e,n,i,(o,a,f)=>{r(this,S,"f")[o][a]=(r(this,S,"f")[o][a]||[]).concat(f)})}[Re](t,e,n,i,o){if(Array.isArray(n))n.forEach(a=>{t(a,i)});else if((a=>typeof a=="object")(n))for(let a of Xt(n))t(a,n[a]);else o(e,this[ve](n),i)}[ve](t){return t==="__proto__"?"___proto___":t}[Te](t,e){return this[ne](this[Te].bind(this),"key",t,e),this}[He](){var t,e,n,i,o,a,f,m,_,b,c,g;let w=r(this,_e,"f").pop();lt(w,void 0,r(this,D,"f"));let M;t=this,e=this,n=this,i=this,o=this,a=this,f=this,m=this,_=this,b=this,c=this,g=this,{options:{set value(y){A(t,S,y,"f")}}.value,configObjects:M,exitProcess:{set value(y){A(e,mt,y,"f")}}.value,groups:{set value(y){A(n,jt,y,"f")}}.value,output:{set value(y){A(i,ot,y,"f")}}.value,exitError:{set value(y){A(o,Ft,y,"f")}}.value,hasOutput:{set value(y){A(a,ht,y,"f")}}.value,parsed:this.parsed,strict:{set value(y){A(f,qt,y,"f")}}.value,strictCommands:{set value(y){A(m,Vt,y,"f")}}.value,strictOptions:{set value(y){A(_,Gt,y,"f")}}.value,completionCommand:{set value(y){A(b,ct,y,"f")}}.value,parseFn:{set value(y){A(c,ut,y,"f")}}.value,parseContext:{set value(y){A(g,Yt,y,"f")}}.value}=w,r(this,S,"f").configObjects=M,r(this,L,"f").unfreeze(),r(this,tt,"f").unfreeze(),r(this,it,"f").unfreeze(),r(this,gt,"f").unfreeze()}[Tn](t,e){return vt(e,n=>(t(n),n))}getInternalMethods(){return{getCommandInstance:this[Hn].bind(this),getContext:this[Yn].bind(this),getHasOutput:this[Bn].bind(this),getLoggerInstance:this[qn].bind(this),getParseContext:this[Vn].bind(this),getParserConfiguration:this[Kt].bind(this),getUsageInstance:this[Gn].bind(this),getValidationInstance:this[Kn].bind(this),hasParseCallback:this[Ce].bind(this),postProcess:this[Jt].bind(this),reset:this[Ye].bind(this),runValidation:this[Be].bind(this),runYargsParserAndExecuteCommands:this[oe].bind(this),setHasOutput:this[Qn].bind(this)}}[Hn](){return r(this,it,"f")}[Yn](){return r(this,re,"f")}[Bn](){return r(this,ht,"f")}[qn](){return r(this,te,"f")}[Vn](){return r(this,Yt,"f")||{}}[Gn](){return r(this,L,"f")}[Kn](){return r(this,tt,"f")}[Ce](){return!!r(this,ut,"f")}[Jt](t,e,n,i){return n||Q(t)||(e||(t=this[Dn](t)),(this[Kt]()["parse-positional-numbers"]||this[Kt]()["parse-positional-numbers"]===void 0)&&(t=this[vn](t)),i&&(t=Rt(t,this,r(this,gt,"f").getMiddleware(),!1))),t}[Ye](t={}){A(this,S,r(this,S,"f")||{},"f");let e={};e.local=r(this,S,"f").local||[],e.configObjects=r(this,S,"f").configObjects||[];let n={};e.local.forEach(a=>{n[a]=!0,(t[a]||[]).forEach(f=>{n[f]=!0})}),Object.assign(r(this,Bt,"f"),Object.keys(r(this,jt,"f")).reduce((a,f)=>{let m=r(this,jt,"f")[f].filter(_=>!(_ in n));return m.length>0&&(a[f]=m),a},{})),A(this,jt,{},"f");let i=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],o=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return i.forEach(a=>{e[a]=(r(this,S,"f")[a]||[]).filter(f=>!n[f])}),o.forEach(a=>{e[a]=It(r(this,S,"f")[a],f=>!n[f])}),e.envPrefix=r(this,S,"f").envPrefix,A(this,S,e,"f"),A(this,L,r(this,L,"f")?r(this,L,"f").reset(n):jn(this,r(this,D,"f")),"f"),A(this,tt,r(this,tt,"f")?r(this,tt,"f").reset(n):$n(this,r(this,L,"f"),r(this,D,"f")),"f"),A(this,it,r(this,it,"f")?r(this,it,"f").reset():wn(r(this,L,"f"),r(this,tt,"f"),r(this,gt,"f"),r(this,D,"f")),"f"),r(this,pt,"f")||A(this,pt,Sn(this,r(this,L,"f"),r(this,it,"f"),r(this,D,"f")),"f"),r(this,gt,"f").reset(),A(this,ct,null,"f"),A(this,ot,"","f"),A(this,Ft,null,"f"),A(this,ht,!1,"f"),this.parsed=!1,this}[Jn](t,e){return r(this,D,"f").path.relative(t,e)}[oe](t,e,n,i=0,o=!1){let a=!!n||o;t=t||r(this,Nt,"f"),r(this,S,"f").__=r(this,D,"f").y18n.__,r(this,S,"f").configuration=this[Kt]();let f=!!r(this,S,"f").configuration["populate--"],m=Object.assign({},r(this,S,"f").configuration,{"populate--":!0}),_=r(this,D,"f").Parser.detailed(t,Object.assign({},r(this,S,"f"),{configuration:{"parse-positional-numbers":!1,...m}})),b=Object.assign(_.argv,r(this,Yt,"f")),c,g=_.aliases,w=!1,M=!1;Object.keys(b).forEach(y=>{y===r(this,bt,"f")&&b[y]?w=!0:y===r(this,Et,"f")&&b[y]&&(M=!0)}),b.$0=this.$0,this.parsed=_,i===0&&r(this,L,"f").clearCachedHelpMessage();try{if(this[Le](),e)return this[Jt](b,f,!!n,!1);r(this,bt,"f")&&[r(this,bt,"f")].concat(g[r(this,bt,"f")]||[]).filter(B=>B.length>1).includes(""+b._[b._.length-1])&&(b._.pop(),w=!0);let y=r(this,it,"f").getCommands(),d=r(this,pt,"f").completionKey in b,U=w||d||o;if(b._.length){if(y.length){let v;for(let B=i||0,Y;b._[B]!==void 0;B++)if(Y=String(b._[B]),y.includes(Y)&&Y!==r(this,ct,"f")){let q=r(this,it,"f").runCommand(Y,this,_,B+1,o,w||M||o);return this[Jt](q,f,!!n,!1)}else if(!v&&Y!==r(this,ct,"f")){v=Y;break}!r(this,it,"f").hasDefaultCommand()&&r(this,ye,"f")&&v&&!U&&r(this,tt,"f").recommendCommands(v,y)}r(this,ct,"f")&&b._.includes(r(this,ct,"f"))&&!d&&(r(this,mt,"f")&&$t(!0),this.showCompletionScript(),this.exit(0))}if(r(this,it,"f").hasDefaultCommand()&&!U){let v=r(this,it,"f").runCommand(null,this,_,0,o,w||M||o);return this[Jt](v,f,!!n,!1)}if(d){r(this,mt,"f")&&$t(!0),t=[].concat(t);let v=t.slice(t.indexOf(`--${r(this,pt,"f").completionKey}`)+1);return r(this,pt,"f").getCompletion(v,(B,Y)=>{if(B)throw new K(B.message);(Y||[]).forEach(q=>{r(this,te,"f").log(q)}),this.exit(0)}),this[Jt](b,!f,!!n,!1)}if(r(this,ht,"f")||(w?(r(this,mt,"f")&&$t(!0),a=!0,this.showHelp("log"),this.exit(0)):M&&(r(this,mt,"f")&&$t(!0),a=!0,r(this,L,"f").showVersion("log"),this.exit(0))),!a&&r(this,S,"f").skipValidation.length>0&&(a=Object.keys(b).some(v=>r(this,S,"f").skipValidation.indexOf(v)>=0&&b[v]===!0)),!a){if(_.error)throw new K(_.error.message);if(!d){let v=this[Be](g,{},_.error);n||(c=Rt(b,this,r(this,gt,"f").getMiddleware(),!0)),c=this[Tn](v,c!=null?c:b),Q(c)&&!n&&(c=c.then(()=>Rt(b,this,r(this,gt,"f").getMiddleware(),!1)))}}}catch(y){if(y instanceof K)r(this,L,"f").fail(y.message,y);else throw y}return this[Jt](c!=null?c:b,f,!!n,!0)}[Be](t,e,n,i){let o={...this.getDemandedOptions()};return a=>{if(n)throw new K(n.message);r(this,tt,"f").nonOptionCount(a),r(this,tt,"f").requiredArguments(a,o);let f=!1;r(this,Vt,"f")&&(f=r(this,tt,"f").unknownCommands(a)),r(this,qt,"f")&&!f?r(this,tt,"f").unknownArguments(a,t,e,!!i):r(this,Gt,"f")&&r(this,tt,"f").unknownArguments(a,t,{},!1,!1),r(this,tt,"f").limitedChoices(a),r(this,tt,"f").implications(a),r(this,tt,"f").conflicting(a)}}[Qn](){A(this,ht,!0,"f")}[Qt](t){if(typeof t=="string")r(this,S,"f").key[t]=!0;else for(let e of t)r(this,S,"f").key[e]=!0}};function Cn(s){return!!s&&typeof s.getInternalMethods=="function"}var Ji=Nn(mn),je=Ji;import Ee from"chalk";import{writeFile as Qi}from"fs";import Zi from"isomorphic-unfetch";import{exit as qe}from"process";var Xn={command:"get [output]",aliases:["dl","download"],describe:"Download the Uniform Context manifest for a project",builder:s=>{var t,e,n;return s.option("apiKey",{alias:"k",demandOption:!0,string:!0,default:(t=process.env.UNIFORM_API_KEY)!=null?t:"",describe:"Uniform API key to use. Defaults to UNIFORM_API_KEY env if set."}).option("project",{describe:"Uniform project ID. Defaults to UCTX_CLI_PROJECT_ID or UNIFORM_PROJECT_ID env. Supports dotenv.",demandOption:!0,default:(n=(e=process.env.UCTX_CLI_PROJECT_ID)!=null?e:process.env.UNIFORM_PROJECT_ID)!=null?n:"",type:"string",alias:["p"]}).option("preview",{describe:"If set, fetches the unpublished preview manifest (The API key must have permission)",default:!1,type:"boolean",alias:["d"]}).option("output",{string:!0,alias:"o",default:process.env.UNIFORM_MANIFEST_PATH,describe:"Path to write manifest to. Defaults to UNIFORM_MANIFEST_PATH env if set."})},handler:async({apiKey:s,output:t,project:e,preview:n})=>{e||(console.error(Ee.red("You must specify the project ID")),qe(1));let i=Xi(),o=new Ge({apiHost:i,projectId:e,apiKey:s,fetch:Zi});try{let a=await o.get({preview:n}),f=JSON.stringify(a,null,2);t?Qi(t,f,m=>{m&&(console.error(`Error writing file to ${t}
65
- `,m),qe(1)),console.log(Ee.green(`\u2705 ${t} has been updated from ${i}`))}):console.log(f)}catch(a){let f;a instanceof Ve?(a.statusCode===403&&(f=`The API key ${s} did not have permissions to fetch the manifest. Ensure ${n?"Context > Read Drafts":"Context > Manifest > Read"} permissions are granted.`),f=a.message):f=a.toString(),console.error(Ee.red("\u26A0 Error fetching Context manifest")),console.error(Ee.gray(` \u2757 ${f}`)),qe(1)}}},Xi=()=>process.env.UNIFORM_CLI_BASE_URL||"https://uniform.app";var kn={command:"manifest <command>",describe:"Commands for Uniform Context",aliases:["man"],builder:s=>s.command(Xn).demandCommand(),handler:()=>{je.help()}};var so={commands:[{command:"context <command>",aliases:["ctx"],describe:"Uniform Context commands",builder:s=>s.command(kn).demandCommand(),handler:()=>{je.showHelp()}}]};export{so as uniformCLI};
57
+ `;var Rr=class{constructor(t,n,i,r){var o,s,a;this.yargs=t,this.usage=n,this.command=i,this.shim=r,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.zshShell=(a=((o=this.shim.getEnv("SHELL"))===null||o===void 0?void 0:o.includes("zsh"))||((s=this.shim.getEnv("ZSH_NAME"))===null||s===void 0?void 0:s.includes("zsh")))!==null&&a!==void 0?a:!1}defaultCompletion(t,n,i,r){let o=this.command.getCommandHandlers();for(let a=0,l=t.length;a<l;++a)if(o[t[a]]&&o[t[a]].builder){let u=o[t[a]].builder;if(jn(u)){let d=this.yargs.getInternalMethods().reset();return u(d,!0),d.argv}}let s=[];this.commandCompletions(s,t,i),this.optionCompletions(s,t,n,i),this.choicesCompletions(s,t,n,i),r(null,s)}commandCompletions(t,n,i){let r=this.yargs.getInternalMethods().getContext().commands;!i.match(/^-/)&&r[r.length-1]!==i&&!this.previousArgHasChoices(n)&&this.usage.getCommands().forEach(o=>{let s=st(o[0]).cmd;if(n.indexOf(s)===-1)if(!this.zshShell)t.push(s);else{let a=o[1]||"";t.push(s.replace(/:/g,"\\:")+":"+a)}})}optionCompletions(t,n,i,r){if((r.match(/^-/)||r===""&&t.length===0)&&!this.previousArgHasChoices(n)){let o=this.yargs.getOptions(),s=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(o.key).forEach(a=>{let l=!!o.configuration["boolean-negation"]&&o.boolean.includes(a);!s.includes(a)&&!this.argsContainKey(n,i,a,l)&&(this.completeOptionKey(a,t,r),l&&!!o.default[a]&&this.completeOptionKey(`no-${a}`,t,r))})}}choicesCompletions(t,n,i,r){if(this.previousArgHasChoices(n)){let o=this.getPreviousArgChoices(n);o&&o.length>0&&t.push(...o)}}getPreviousArgChoices(t){if(t.length<1)return;let n=t[t.length-1],i="";if(!n.startsWith("--")&&t.length>1&&(i=n,n=t[t.length-2]),!n.startsWith("--"))return;let r=n.replace(/-/g,""),o=this.yargs.getOptions();if(Object.keys(o.key).some(s=>s===r)&&Array.isArray(o.choices[r]))return o.choices[r].filter(s=>!i||s.startsWith(i))}previousArgHasChoices(t){let n=this.getPreviousArgChoices(t);return n!==void 0&&n.length>0}argsContainKey(t,n,i,r){if(t.indexOf(`--${i}`)!==-1||r&&t.indexOf(`--no-${i}`)!==-1)return!0;if(this.aliases){for(let o of this.aliases[i])if(n[o]!==void 0)return!0}return!1}completeOptionKey(t,n,i){let r=this.usage.getDescriptions(),o=l=>/^--/.test(l),s=l=>/^[^0-9]$/.test(l),a=!o(i)&&s(t)?"-":"--";if(!this.zshShell)n.push(a+t);else{let l=r[t]||"";n.push(a+`${t.replace(/:/g,"\\:")}:${l.replace("__yargsString__:","")}`)}}customCompletion(t,n,i,r){if(Se(this.customCompletionFunction,null,this.shim),ol(this.customCompletionFunction)){let o=this.customCompletionFunction(i,n);return te(o)?o.then(s=>{this.shim.process.nextTick(()=>{r(null,s)})}).catch(s=>{this.shim.process.nextTick(()=>{r(s,void 0)})}):r(null,o)}else return sl(this.customCompletionFunction)?this.customCompletionFunction(i,n,(o=r)=>this.defaultCompletion(t,n,i,o),o=>{r(null,o)}):this.customCompletionFunction(i,n,o=>{r(null,o)})}getCompletion(t,n){let i=t.length?t[t.length-1]:"",r=this.yargs.parse(t,!0),o=this.customCompletionFunction?s=>this.customCompletion(t,s,i,n):s=>this.defaultCompletion(t,s,i,n);return te(r)?r.then(o):o(r)}generateCompletionScript(t,n){let i=this.zshShell?Tr:Nr,r=this.shim.path.basename(t);return t.match(/\.js$/)&&(t=`./${t}`),i=i.replace(/{{app_name}}/g,r),i=i.replace(/{{completion_command}}/g,n),i.replace(/{{app_path}}/g,t)}registerFunction(t){this.customCompletionFunction=t}setParsed(t){this.aliases=t.aliases}};function Ur(e,t,n,i){return new Rr(e,t,n,i)}function ol(e){return e.length<3}function sl(e){return e.length>3}b();b();function $r(e,t){if(e.length===0)return t.length;if(t.length===0)return e.length;let n=[],i;for(i=0;i<=t.length;i++)n[i]=[i];let r;for(r=0;r<=e.length;r++)n[0][r]=r;for(i=1;i<=t.length;i++)for(r=1;r<=e.length;r++)t.charAt(i-1)===e.charAt(r-1)?n[i][r]=n[i-1][r-1]:i>1&&r>1&&t.charAt(i-2)===e.charAt(r-1)&&t.charAt(i-1)===e.charAt(r-2)?n[i][r]=n[i-2][r-2]+1:n[i][r]=Math.min(n[i-1][r-1]+1,Math.min(n[i][r-1]+1,n[i-1][r]+1));return n[t.length][e.length]}var Wr=["$0","--","_"];function Hr(e,t,n){let i=n.y18n.__,r=n.y18n.__n,o={};o.nonOptionCount=function(f){let p=e.getDemandedCommands(),C=f._.length+(f["--"]?f["--"].length:0)-e.getInternalMethods().getContext().commands.length;p._&&(C<p._.min||C>p._.max)&&(C<p._.min?p._.minMsg!==void 0?t.fail(p._.minMsg?p._.minMsg.replace(/\$0/g,C.toString()).replace(/\$1/,p._.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",C,C.toString(),p._.min.toString())):C>p._.max&&(p._.maxMsg!==void 0?t.fail(p._.maxMsg?p._.maxMsg.replace(/\$0/g,C.toString()).replace(/\$1/,p._.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",C,C.toString(),p._.max.toString()))))},o.positionalCount=function(f,p){p<f&&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",p,p+"",f+""))},o.requiredArguments=function(f,p){let g=null;for(let C of Object.keys(p))(!Object.prototype.hasOwnProperty.call(f,C)||typeof f[C]=="undefined")&&(g=g||{},g[C]=p[C]);if(g){let C=[];for(let m of Object.keys(g)){let j=g[m];j&&C.indexOf(j)<0&&C.push(j)}let w=C.length?`
58
+ ${C.join(`
59
+ `)}`:"";t.fail(r("Missing required argument: %s","Missing required arguments: %s",Object.keys(g).length,Object.keys(g).join(", ")+w))}},o.unknownArguments=function(f,p,g,C,w=!0){var m;let j=e.getInternalMethods().getCommandInstance().getCommands(),_=[],q=e.getInternalMethods().getContext();if(Object.keys(f).forEach(G=>{!Wr.includes(G)&&!Object.prototype.hasOwnProperty.call(g,G)&&!Object.prototype.hasOwnProperty.call(e.getInternalMethods().getParseContext(),G)&&!o.isValidAndSomeAliasIsNotNew(G,p)&&_.push(G)}),w&&(q.commands.length>0||j.length>0||C)&&f._.slice(q.commands.length).forEach(G=>{j.includes(""+G)||_.push(""+G)}),w){let K=((m=e.getDemandedCommands()._)===null||m===void 0?void 0:m.max)||0,ot=q.commands.length+K;ot<f._.length&&f._.slice(ot).forEach(Ye=>{Ye=String(Ye),!q.commands.includes(Ye)&&!_.includes(Ye)&&_.push(Ye)})}_.length&&t.fail(r("Unknown argument: %s","Unknown arguments: %s",_.length,_.join(", ")))},o.unknownCommands=function(f){let p=e.getInternalMethods().getCommandInstance().getCommands(),g=[],C=e.getInternalMethods().getContext();return(C.commands.length>0||p.length>0)&&f._.slice(C.commands.length).forEach(w=>{p.includes(""+w)||g.push(""+w)}),g.length>0?(t.fail(r("Unknown command: %s","Unknown commands: %s",g.length,g.join(", "))),!0):!1},o.isValidAndSomeAliasIsNotNew=function(f,p){if(!Object.prototype.hasOwnProperty.call(p,f))return!1;let g=e.parsed.newAliases;return[f,...p[f]].some(C=>!Object.prototype.hasOwnProperty.call(g,C)||!g[f])},o.limitedChoices=function(f){let p=e.getOptions(),g={};if(!Object.keys(p.choices).length)return;Object.keys(f).forEach(m=>{Wr.indexOf(m)===-1&&Object.prototype.hasOwnProperty.call(p.choices,m)&&[].concat(f[m]).forEach(j=>{p.choices[m].indexOf(j)===-1&&j!==void 0&&(g[m]=(g[m]||[]).concat(j))})});let C=Object.keys(g);if(!C.length)return;let w=i("Invalid values:");C.forEach(m=>{w+=`
60
+ ${i("Argument: %s, Given: %s, Choices: %s",m,t.stringifiedValues(g[m]),t.stringifiedValues(p.choices[m]))}`}),t.fail(w)};let s={};o.implies=function(f,p){P("<string|object> [array|number|string]",[f,p],arguments.length),typeof f=="object"?Object.keys(f).forEach(g=>{o.implies(g,f[g])}):(e.global(f),s[f]||(s[f]=[]),Array.isArray(p)?p.forEach(g=>o.implies(f,g)):(Se(p,void 0,n),s[f].push(p)))},o.getImplied=function(){return s};function a(d,f){let p=Number(f);return f=isNaN(p)?f:p,typeof f=="number"?f=d._.length>=f:f.match(/^--no-.+/)?(f=f.match(/^--no-(.+)/)[1],f=!Object.prototype.hasOwnProperty.call(d,f)):f=Object.prototype.hasOwnProperty.call(d,f),f}o.implications=function(f){let p=[];if(Object.keys(s).forEach(g=>{let C=g;(s[g]||[]).forEach(w=>{let m=C,j=w;m=a(f,m),w=a(f,w),m&&!w&&p.push(` ${C} -> ${j}`)})}),p.length){let g=`${i("Implications failed:")}
61
+ `;p.forEach(C=>{g+=C}),t.fail(g)}};let l={};o.conflicts=function(f,p){P("<string|object> [array|string]",[f,p],arguments.length),typeof f=="object"?Object.keys(f).forEach(g=>{o.conflicts(g,f[g])}):(e.global(f),l[f]||(l[f]=[]),Array.isArray(p)?p.forEach(g=>o.conflicts(f,g)):l[f].push(p))},o.getConflicting=()=>l,o.conflicting=function(f){Object.keys(f).forEach(p=>{l[p]&&l[p].forEach(g=>{g&&f[p]!==void 0&&f[g]!==void 0&&t.fail(i("Arguments %s and %s are mutually exclusive",p,g))})}),e.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(l).forEach(p=>{l[p].forEach(g=>{g&&f[n.Parser.camelCase(p)]!==void 0&&f[n.Parser.camelCase(g)]!==void 0&&t.fail(i("Arguments %s and %s are mutually exclusive",p,g))})})},o.recommendCommands=function(f,p){let g=3;p=p.sort((m,j)=>j.length-m.length);let C=null,w=1/0;for(let m=0,j;(j=p[m])!==void 0;m++){let _=$r(f,j);_<=g&&_<w&&(w=_,C=j)}C&&t.fail(i("Did you mean %s?",C))},o.reset=function(f){return s=at(s,p=>!f[p]),l=at(l,p=>!f[p]),o};let u=[];return o.freeze=function(){u.push({implied:s,conflicting:l})},o.unfreeze=function(){let f=u.pop();Se(f,void 0,n),{implied:s,conflicting:l}=f},o}b();var mi=[],un;function Mn(e,t,n,i){un=i;let r={};if(Object.prototype.hasOwnProperty.call(e,"extends")){if(typeof e.extends!="string")return r;let o=/\.json|\..*rc$/.test(e.extends),s=null;if(o)s=ll(t,e.extends);else try{s=ze.resolve(e.extends)}catch(a){return e}al(s),mi.push(s),r=o?JSON.parse(un.readFileSync(s,"utf8")):ze(e.extends),delete e.extends,r=Mn(r,un.path.dirname(s),n,un)}return mi=[],n?kr(r,e):Object.assign({},r,e)}function al(e){if(mi.indexOf(e)>-1)throw new Z(`Circular extended configurations: '${e}'.`)}function ll(e,t){return un.path.resolve(e,t)}function kr(e,t){let n={};function i(r){return r&&typeof r=="object"&&!Array.isArray(r)}Object.assign(n,e);for(let r of Object.keys(t))i(t[r])&&i(n[r])?n[r]=kr(e[r],t[r]):n[r]=t[r];return n}var M=function(e,t,n,i,r){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?r.call(e,n):r?r.value=n:t.set(e,n),n},c=function(e,t,n,i){if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?i:n==="a"?i.call(e):i?i.value:t.get(e)},le,Lt,dn,Ue,Me,Fn,ct,Dt,Ln,$e,Dn,We,Ke,Fe,He,Jt,pe,D,Nn,Tn,Le,Nt,Zt,Tt,ft,Rn,W,Rt,Ut,$t,B,Qe,oe;function Yr(e){return(t=[],n=e.process.cwd(),i)=>{let r=new ao(t,n,i,e);return Object.defineProperty(r,"argv",{get:()=>r.parse(),enumerable:!0}),r.help(),r.version(),r}}var Br=Symbol("copyDoubleDash"),qr=Symbol("copyDoubleDash"),gi=Symbol("deleteFromParserHintObject"),Gr=Symbol("emitWarning"),zr=Symbol("freeze"),Vr=Symbol("getDollarZero"),Wt=Symbol("getParserConfiguration"),yi=Symbol("guessLocale"),Kr=Symbol("guessVersion"),Qr=Symbol("parsePositionalNumbers"),bi=Symbol("pkgUp"),ut=Symbol("populateParserHintArray"),Xt=Symbol("populateParserHintSingleValueDictionary"),Ai=Symbol("populateParserHintArrayDictionary"),wi=Symbol("populateParserHintDictionary"),xi=Symbol("sanitizeKey"),Ci=Symbol("setKey"),Oi=Symbol("unfreeze"),Jr=Symbol("validateAsync"),Zr=Symbol("getCommandInstance"),Xr=Symbol("getContext"),eo=Symbol("getHasOutput"),to=Symbol("getLoggerInstance"),no=Symbol("getParseContext"),io=Symbol("getUsageInstance"),ro=Symbol("getValidationInstance"),Un=Symbol("hasParseCallback"),Ht=Symbol("postProcess"),oo=Symbol("rebase"),_i=Symbol("reset"),pn=Symbol("runYargsParserAndExecuteCommands"),vi=Symbol("runValidation"),so=Symbol("setHasOutput"),kt=Symbol("kTrackManuallySetKeys"),ao=class{constructor(t=[],n,i,r){this.customScriptName=!1,this.parsed=!1,le.set(this,void 0),Lt.set(this,void 0),dn.set(this,{commands:[],fullCommands:[]}),Ue.set(this,null),Me.set(this,null),Fn.set(this,"show-hidden"),ct.set(this,null),Dt.set(this,!0),Ln.set(this,{}),$e.set(this,!0),Dn.set(this,[]),We.set(this,void 0),Ke.set(this,{}),Fe.set(this,!1),He.set(this,null),Jt.set(this,void 0),pe.set(this,""),D.set(this,void 0),Nn.set(this,void 0),Tn.set(this,{}),Le.set(this,null),Nt.set(this,null),Zt.set(this,{}),Tt.set(this,{}),ft.set(this,void 0),Rn.set(this,!1),W.set(this,void 0),Rt.set(this,!1),Ut.set(this,!1),$t.set(this,!1),B.set(this,void 0),Qe.set(this,null),oe.set(this,void 0),M(this,W,r,"f"),M(this,ft,t,"f"),M(this,Lt,n,"f"),M(this,Nn,i,"f"),M(this,We,new di(this),"f"),this.$0=this[Vr](),this[_i](),M(this,le,c(this,le,"f"),"f"),M(this,B,c(this,B,"f"),"f"),M(this,oe,c(this,oe,"f"),"f"),M(this,D,c(this,D,"f"),"f"),c(this,D,"f").showHiddenOpt=c(this,Fn,"f"),M(this,Jt,this[qr](),"f")}addHelpOpt(t,n){let i="help";return P("[string|boolean] [string]",[t,n],arguments.length),c(this,He,"f")&&(this[gi](c(this,He,"f")),M(this,He,null,"f")),t===!1&&n===void 0?this:(M(this,He,typeof t=="string"?t:i,"f"),this.boolean(c(this,He,"f")),this.describe(c(this,He,"f"),n||c(this,B,"f").deferY18nLookup("Show help")),this)}help(t,n){return this.addHelpOpt(t,n)}addShowHiddenOpt(t,n){if(P("[string|boolean] [string]",[t,n],arguments.length),t===!1&&n===void 0)return this;let i=typeof t=="string"?t:c(this,Fn,"f");return this.boolean(i),this.describe(i,n||c(this,B,"f").deferY18nLookup("Show hidden options")),c(this,D,"f").showHiddenOpt=i,this}showHidden(t,n){return this.addShowHiddenOpt(t,n)}alias(t,n){return P("<object|string|array> [string|array]",[t,n],arguments.length),this[Ai](this.alias.bind(this),"alias",t,n),this}array(t){return P("<array|string>",[t],arguments.length),this[ut]("array",t),this[kt](t),this}boolean(t){return P("<array|string>",[t],arguments.length),this[ut]("boolean",t),this[kt](t),this}check(t,n){return P("<function> [boolean]",[t,n],arguments.length),this.middleware((i,r)=>Ft(()=>t(i,r.getOptions()),o=>(o?(typeof o=="string"||o instanceof Error)&&c(this,B,"f").fail(o.toString(),o):c(this,B,"f").fail(c(this,W,"f").y18n.__("Argument check failed: %s",t.toString())),i),o=>(c(this,B,"f").fail(o.message?o.message:o.toString(),o),i)),!1,n),this}choices(t,n){return P("<object|string|array> [string|array]",[t,n],arguments.length),this[Ai](this.choices.bind(this),"choices",t,n),this}coerce(t,n){if(P("<object|string|array> [function]",[t,n],arguments.length),Array.isArray(t)){if(!n)throw new Z("coerce callback must be provided");for(let i of t)this.coerce(i,n);return this}else if(typeof t=="object"){for(let i of Object.keys(t))this.coerce(i,t[i]);return this}if(!n)throw new Z("coerce callback must be provided");return c(this,D,"f").key[t]=!0,c(this,We,"f").addCoerceMiddleware((i,r)=>{let o;return Ft(()=>(o=r.getAliases(),n(i[t])),s=>{if(i[t]=s,o[t])for(let a of o[t])i[a]=s;return i},s=>{throw new Z(s.message)})},t),this}conflicts(t,n){return P("<string|object> [string|array]",[t,n],arguments.length),c(this,oe,"f").conflicts(t,n),this}config(t="config",n,i){return P("[object|string] [string|function] [function]",[t,n,i],arguments.length),typeof t=="object"&&!Array.isArray(t)?(t=Mn(t,c(this,Lt,"f"),this[Wt]()["deep-merge-config"]||!1,c(this,W,"f")),c(this,D,"f").configObjects=(c(this,D,"f").configObjects||[]).concat(t),this):(typeof n=="function"&&(i=n,n=void 0),this.describe(t,n||c(this,B,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach(r=>{c(this,D,"f").config[r]=i||!0}),this)}completion(t,n,i){return P("[string] [string|boolean|function] [function]",[t,n,i],arguments.length),typeof n=="function"&&(i=n,n=void 0),M(this,Me,t||c(this,Me,"f")||"completion","f"),!n&&n!==!1&&(n="generate completion script"),this.command(c(this,Me,"f"),n),i&&c(this,Ue,"f").registerFunction(i),this}command(t,n,i,r,o,s){return P("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[t,n,i,r,o,s],arguments.length),c(this,le,"f").addHandler(t,n,i,r,o,s),this}commands(t,n,i,r,o,s){return this.command(t,n,i,r,o,s)}commandDir(t,n){P("<string> [object]",[t,n],arguments.length);let i=c(this,Nn,"f")||c(this,W,"f").require;return c(this,le,"f").addDirectory(t,i,c(this,W,"f").getCallerFile(),n),this}count(t){return P("<array|string>",[t],arguments.length),this[ut]("count",t),this[kt](t),this}default(t,n,i){return P("<object|string|array> [*] [string]",[t,n,i],arguments.length),i&&(ui(t,c(this,W,"f")),c(this,D,"f").defaultDescription[t]=i),typeof n=="function"&&(ui(t,c(this,W,"f")),c(this,D,"f").defaultDescription[t]||(c(this,D,"f").defaultDescription[t]=c(this,B,"f").functionDescription(n)),n=n.call()),this[Xt](this.default.bind(this),"default",t,n),this}defaults(t,n,i){return this.default(t,n,i)}demandCommand(t=1,n,i,r){return P("[number] [number|string] [string|null|undefined] [string|null|undefined]",[t,n,i,r],arguments.length),typeof n!="number"&&(i=n,n=1/0),this.global("_",!1),c(this,D,"f").demandedCommands._={min:t,max:n,minMsg:i,maxMsg:r},this}demand(t,n,i){return Array.isArray(n)?(n.forEach(r=>{Se(i,!0,c(this,W,"f")),this.demandOption(r,i)}),n=1/0):typeof n!="number"&&(i=n,n=1/0),typeof t=="number"?(Se(i,!0,c(this,W,"f")),this.demandCommand(t,n,i,i)):Array.isArray(t)?t.forEach(r=>{Se(i,!0,c(this,W,"f")),this.demandOption(r,i)}):typeof i=="string"?this.demandOption(t,i):(i===!0||typeof i=="undefined")&&this.demandOption(t),this}demandOption(t,n){return P("<object|string|array> [string]",[t,n],arguments.length),this[Xt](this.demandOption.bind(this),"demandedOptions",t,n),this}deprecateOption(t,n){return P("<string> [string|boolean]",[t,n],arguments.length),c(this,D,"f").deprecatedOptions[t]=n,this}describe(t,n){return P("<object|string|array> [string]",[t,n],arguments.length),this[Ci](t,!0),c(this,B,"f").describe(t,n),this}detectLocale(t){return P("<boolean>",[t],arguments.length),M(this,Dt,t,"f"),this}env(t){return P("[string|boolean]",[t],arguments.length),t===!1?delete c(this,D,"f").envPrefix:c(this,D,"f").envPrefix=t||"",this}epilogue(t){return P("<string>",[t],arguments.length),c(this,B,"f").epilog(t),this}epilog(t){return this.epilogue(t)}example(t,n){return P("<string|array> [string]",[t,n],arguments.length),Array.isArray(t)?t.forEach(i=>this.example(...i)):c(this,B,"f").example(t,n),this}exit(t,n){M(this,Fe,!0,"f"),M(this,ct,n,"f"),c(this,$e,"f")&&c(this,W,"f").process.exit(t)}exitProcess(t=!0){return P("[boolean]",[t],arguments.length),M(this,$e,t,"f"),this}fail(t){if(P("<function|boolean>",[t],arguments.length),typeof t=="boolean"&&t!==!1)throw new Z("Invalid first argument. Expected function or boolean 'false'");return c(this,B,"f").failFn(t),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(t,n){return P("<array> [function]",[t,n],arguments.length),n?c(this,Ue,"f").getCompletion(t,n):new Promise((i,r)=>{c(this,Ue,"f").getCompletion(t,(o,s)=>{o?r(o):i(s)})})}getDemandedOptions(){return P([],0),c(this,D,"f").demandedOptions}getDemandedCommands(){return P([],0),c(this,D,"f").demandedCommands}getDeprecatedOptions(){return P([],0),c(this,D,"f").deprecatedOptions}getDetectLocale(){return c(this,Dt,"f")}getExitProcess(){return c(this,$e,"f")}getGroups(){return Object.assign({},c(this,Ke,"f"),c(this,Tt,"f"))}getHelp(){if(M(this,Fe,!0,"f"),!c(this,B,"f").hasCachedHelpMessage()){if(!this.parsed){let n=this[pn](c(this,ft,"f"),void 0,void 0,0,!0);if(te(n))return n.then(()=>c(this,B,"f").help())}let t=c(this,le,"f").runDefaultBuilderOn(this);if(te(t))return t.then(()=>c(this,B,"f").help())}return Promise.resolve(c(this,B,"f").help())}getOptions(){return c(this,D,"f")}getStrict(){return c(this,Rt,"f")}getStrictCommands(){return c(this,Ut,"f")}getStrictOptions(){return c(this,$t,"f")}global(t,n){return P("<string|array> [boolean]",[t,n],arguments.length),t=[].concat(t),n!==!1?c(this,D,"f").local=c(this,D,"f").local.filter(i=>t.indexOf(i)===-1):t.forEach(i=>{c(this,D,"f").local.includes(i)||c(this,D,"f").local.push(i)}),this}group(t,n){P("<string|array> <string>",[t,n],arguments.length);let i=c(this,Tt,"f")[n]||c(this,Ke,"f")[n];c(this,Tt,"f")[n]&&delete c(this,Tt,"f")[n];let r={};return c(this,Ke,"f")[n]=(i||[]).concat(t).filter(o=>r[o]?!1:r[o]=!0),this}hide(t){return P("<string>",[t],arguments.length),c(this,D,"f").hiddenOptions.push(t),this}implies(t,n){return P("<string|object> [number|string|array]",[t,n],arguments.length),c(this,oe,"f").implies(t,n),this}locale(t){return P("[string]",[t],arguments.length),t?(M(this,Dt,!1,"f"),c(this,W,"f").y18n.setLocale(t),this):(this[yi](),c(this,W,"f").y18n.getLocale())}middleware(t,n,i){return c(this,We,"f").addMiddleware(t,!!n,i)}nargs(t,n){return P("<string|object|array> [number]",[t,n],arguments.length),this[Xt](this.nargs.bind(this),"narg",t,n),this}normalize(t){return P("<array|string>",[t],arguments.length),this[ut]("normalize",t),this}number(t){return P("<array|string>",[t],arguments.length),this[ut]("number",t),this[kt](t),this}option(t,n){if(P("<string|object> [object]",[t,n],arguments.length),typeof t=="object")Object.keys(t).forEach(i=>{this.options(i,t[i])});else{typeof n!="object"&&(n={}),this[kt](t),c(this,Qe,"f")&&(t==="version"||(n==null?void 0:n.alias)==="version")&&this[Gr](['"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(`
62
+ `),void 0,"versionWarning"),c(this,D,"f").key[t]=!0,n.alias&&this.alias(t,n.alias);let i=n.deprecate||n.deprecated;i&&this.deprecateOption(t,i);let r=n.demand||n.required||n.require;r&&this.demand(t,r),n.demandOption&&this.demandOption(t,typeof n.demandOption=="string"?n.demandOption:void 0),n.conflicts&&this.conflicts(t,n.conflicts),"default"in n&&this.default(t,n.default),n.implies!==void 0&&this.implies(t,n.implies),n.nargs!==void 0&&this.nargs(t,n.nargs),n.config&&this.config(t,n.configParser),n.normalize&&this.normalize(t),n.choices&&this.choices(t,n.choices),n.coerce&&this.coerce(t,n.coerce),n.group&&this.group(t,n.group),(n.boolean||n.type==="boolean")&&(this.boolean(t),n.alias&&this.boolean(n.alias)),(n.array||n.type==="array")&&(this.array(t),n.alias&&this.array(n.alias)),(n.number||n.type==="number")&&(this.number(t),n.alias&&this.number(n.alias)),(n.string||n.type==="string")&&(this.string(t),n.alias&&this.string(n.alias)),(n.count||n.type==="count")&&this.count(t),typeof n.global=="boolean"&&this.global(t,n.global),n.defaultDescription&&(c(this,D,"f").defaultDescription[t]=n.defaultDescription),n.skipValidation&&this.skipValidation(t);let o=n.describe||n.description||n.desc;this.describe(t,o),n.hidden&&this.hide(t),n.requiresArg&&this.requiresArg(t)}return this}options(t,n){return this.option(t,n)}parse(t,n,i){P("[string|array] [function|boolean|object] [function]",[t,n,i],arguments.length),this[zr](),typeof t=="undefined"&&(t=c(this,ft,"f")),typeof n=="object"&&(M(this,Nt,n,"f"),n=i),typeof n=="function"&&(M(this,Le,n,"f"),n=!1),n||M(this,ft,t,"f"),c(this,Le,"f")&&M(this,$e,!1,"f");let r=this[pn](t,!!n),o=this.parsed;return c(this,Ue,"f").setParsed(this.parsed),te(r)?r.then(s=>(c(this,Le,"f")&&c(this,Le,"f").call(this,c(this,ct,"f"),s,c(this,pe,"f")),s)).catch(s=>{throw c(this,Le,"f")&&c(this,Le,"f")(s,this.parsed.argv,c(this,pe,"f")),s}).finally(()=>{this[Oi](),this.parsed=o}):(c(this,Le,"f")&&c(this,Le,"f").call(this,c(this,ct,"f"),r,c(this,pe,"f")),this[Oi](),this.parsed=o,r)}parseAsync(t,n,i){let r=this.parse(t,n,i);return te(r)?r:Promise.resolve(r)}parseSync(t,n,i){let r=this.parse(t,n,i);if(te(r))throw new Z(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return r}parserConfiguration(t){return P("<object>",[t],arguments.length),M(this,Tn,t,"f"),this}pkgConf(t,n){P("<string> [string]",[t,n],arguments.length);let i=null,r=this[bi](n||c(this,Lt,"f"));return r[t]&&typeof r[t]=="object"&&(i=Mn(r[t],n||c(this,Lt,"f"),this[Wt]()["deep-merge-config"]||!1,c(this,W,"f")),c(this,D,"f").configObjects=(c(this,D,"f").configObjects||[]).concat(i)),this}positional(t,n){P("<string> <object>",[t,n],arguments.length);let i=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];n=at(n,(s,a)=>s==="type"&&!["string","number","boolean"].includes(a)?!1:i.includes(s));let r=c(this,dn,"f").fullCommands[c(this,dn,"f").fullCommands.length-1],o=r?c(this,le,"f").cmdToParseOptions(r):{array:[],alias:{},default:{},demand:{}};return Kt(o).forEach(s=>{let a=o[s];Array.isArray(a)?a.indexOf(t)!==-1&&(n[s]=!0):a[t]&&!(s in n)&&(n[s]=a[t])}),this.group(t,c(this,B,"f").getPositionalGroupName()),this.option(t,n)}recommendCommands(t=!0){return P("[boolean]",[t],arguments.length),M(this,Rn,t,"f"),this}required(t,n,i){return this.demand(t,n,i)}require(t,n,i){return this.demand(t,n,i)}requiresArg(t){return P("<array|string|object> [number]",[t],arguments.length),typeof t=="string"&&c(this,D,"f").narg[t]?this:(this[Xt](this.requiresArg.bind(this),"narg",t,NaN),this)}showCompletionScript(t,n){return P("[string] [string]",[t,n],arguments.length),t=t||this.$0,c(this,Jt,"f").log(c(this,Ue,"f").generateCompletionScript(t,n||c(this,Me,"f")||"completion")),this}showHelp(t){if(P("[string|function]",[t],arguments.length),M(this,Fe,!0,"f"),!c(this,B,"f").hasCachedHelpMessage()){if(!this.parsed){let i=this[pn](c(this,ft,"f"),void 0,void 0,0,!0);if(te(i))return i.then(()=>{c(this,B,"f").showHelp(t)}),this}let n=c(this,le,"f").runDefaultBuilderOn(this);if(te(n))return n.then(()=>{c(this,B,"f").showHelp(t)}),this}return c(this,B,"f").showHelp(t),this}scriptName(t){return this.customScriptName=!0,this.$0=t,this}showHelpOnFail(t,n){return P("[boolean|string] [string]",[t,n],arguments.length),c(this,B,"f").showHelpOnFail(t,n),this}showVersion(t){return P("[string|function]",[t],arguments.length),c(this,B,"f").showVersion(t),this}skipValidation(t){return P("<array|string>",[t],arguments.length),this[ut]("skipValidation",t),this}strict(t){return P("[boolean]",[t],arguments.length),M(this,Rt,t!==!1,"f"),this}strictCommands(t){return P("[boolean]",[t],arguments.length),M(this,Ut,t!==!1,"f"),this}strictOptions(t){return P("[boolean]",[t],arguments.length),M(this,$t,t!==!1,"f"),this}string(t){return P("<array|string>",[t],arguments.length),this[ut]("string",t),this[kt](t),this}terminalWidth(){return P([],0),c(this,W,"f").process.stdColumns}updateLocale(t){return this.updateStrings(t)}updateStrings(t){return P("<object>",[t],arguments.length),M(this,Dt,!1,"f"),c(this,W,"f").y18n.updateLocale(t),this}usage(t,n,i,r){if(P("<string|null|undefined> [string|boolean] [function|object] [function]",[t,n,i,r],arguments.length),n!==void 0){if(Se(t,null,c(this,W,"f")),(t||"").match(/^\$0( |$)/))return this.command(t,n,i,r);throw new Z(".usage() description must start with $0 if being used as alias for .command()")}else return c(this,B,"f").usage(t),this}version(t,n,i){let r="version";if(P("[boolean|string] [string] [string]",[t,n,i],arguments.length),c(this,Qe,"f")&&(this[gi](c(this,Qe,"f")),c(this,B,"f").version(void 0),M(this,Qe,null,"f")),arguments.length===0)i=this[Kr](),t=r;else if(arguments.length===1){if(t===!1)return this;i=t,t=r}else arguments.length===2&&(i=n,n=void 0);return M(this,Qe,typeof t=="string"?t:r,"f"),n=n||c(this,B,"f").deferY18nLookup("Show version number"),c(this,B,"f").version(i||void 0),this.boolean(c(this,Qe,"f")),this.describe(c(this,Qe,"f"),n),this}wrap(t){return P("<number|null|undefined>",[t],arguments.length),c(this,B,"f").wrap(t),this}[(le=new WeakMap,Lt=new WeakMap,dn=new WeakMap,Ue=new WeakMap,Me=new WeakMap,Fn=new WeakMap,ct=new WeakMap,Dt=new WeakMap,Ln=new WeakMap,$e=new WeakMap,Dn=new WeakMap,We=new WeakMap,Ke=new WeakMap,Fe=new WeakMap,He=new WeakMap,Jt=new WeakMap,pe=new WeakMap,D=new WeakMap,Nn=new WeakMap,Tn=new WeakMap,Le=new WeakMap,Nt=new WeakMap,Zt=new WeakMap,Tt=new WeakMap,ft=new WeakMap,Rn=new WeakMap,W=new WeakMap,Rt=new WeakMap,Ut=new WeakMap,$t=new WeakMap,B=new WeakMap,Qe=new WeakMap,oe=new WeakMap,Br)](t){if(!t._||!t["--"])return t;t._.push.apply(t._,t["--"]);try{delete t["--"]}catch(n){}return t}[qr](){return{log:(...t)=>{this[Un]()||console.log(...t),M(this,Fe,!0,"f"),c(this,pe,"f").length&&M(this,pe,c(this,pe,"f")+`
63
+ `,"f"),M(this,pe,c(this,pe,"f")+t.join(" "),"f")},error:(...t)=>{this[Un]()||console.error(...t),M(this,Fe,!0,"f"),c(this,pe,"f").length&&M(this,pe,c(this,pe,"f")+`
64
+ `,"f"),M(this,pe,c(this,pe,"f")+t.join(" "),"f")}}}[gi](t){Kt(c(this,D,"f")).forEach(n=>{if((r=>r==="configObjects")(n))return;let i=c(this,D,"f")[n];Array.isArray(i)?i.includes(t)&&i.splice(i.indexOf(t),1):typeof i=="object"&&delete i[t]}),delete c(this,B,"f").getDescriptions()[t]}[Gr](t,n,i){c(this,Ln,"f")[i]||(c(this,W,"f").process.emitWarning(t,n),c(this,Ln,"f")[i]=!0)}[zr](){c(this,Dn,"f").push({options:c(this,D,"f"),configObjects:c(this,D,"f").configObjects.slice(0),exitProcess:c(this,$e,"f"),groups:c(this,Ke,"f"),strict:c(this,Rt,"f"),strictCommands:c(this,Ut,"f"),strictOptions:c(this,$t,"f"),completionCommand:c(this,Me,"f"),output:c(this,pe,"f"),exitError:c(this,ct,"f"),hasOutput:c(this,Fe,"f"),parsed:this.parsed,parseFn:c(this,Le,"f"),parseContext:c(this,Nt,"f")}),c(this,B,"f").freeze(),c(this,oe,"f").freeze(),c(this,le,"f").freeze(),c(this,We,"f").freeze()}[Vr](){let t="",n;return/\b(node|iojs|electron)(\.exe)?$/.test(c(this,W,"f").process.argv()[0])?n=c(this,W,"f").process.argv().slice(1,2):n=c(this,W,"f").process.argv().slice(0,1),t=n.map(i=>{let r=this[oo](c(this,Lt,"f"),i);return i.match(/^(\/|([a-zA-Z]:)?\\)/)&&r.length<i.length?r:i}).join(" ").trim(),c(this,W,"f").getEnv("_")&&c(this,W,"f").getProcessArgvBin()===c(this,W,"f").getEnv("_")&&(t=c(this,W,"f").getEnv("_").replace(`${c(this,W,"f").path.dirname(c(this,W,"f").process.execPath())}/`,"")),t}[Wt](){return c(this,Tn,"f")}[yi](){if(!c(this,Dt,"f"))return;let t=c(this,W,"f").getEnv("LC_ALL")||c(this,W,"f").getEnv("LC_MESSAGES")||c(this,W,"f").getEnv("LANG")||c(this,W,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[Kr](){return this[bi]().version||"unknown"}[Qr](t){let n=t["--"]?t["--"]:t._;for(let i=0,r;(r=n[i])!==void 0;i++)c(this,W,"f").Parser.looksLikeNumber(r)&&Number.isSafeInteger(Math.floor(parseFloat(`${r}`)))&&(n[i]=Number(r));return t}[bi](t){let n=t||"*";if(c(this,Zt,"f")[n])return c(this,Zt,"f")[n];let i={};try{let r=t||c(this,W,"f").mainFilename;!t&&c(this,W,"f").path.extname(r)&&(r=c(this,W,"f").path.dirname(r));let o=c(this,W,"f").findUp(r,(s,a)=>{if(a.includes("package.json"))return"package.json"});Se(o,void 0,c(this,W,"f")),i=JSON.parse(c(this,W,"f").readFileSync(o,"utf8"))}catch(r){}return c(this,Zt,"f")[n]=i||{},c(this,Zt,"f")[n]}[ut](t,n){n=[].concat(n),n.forEach(i=>{i=this[xi](i),c(this,D,"f")[t].push(i)})}[Xt](t,n,i,r){this[wi](t,n,i,r,(o,s,a)=>{c(this,D,"f")[o][s]=a})}[Ai](t,n,i,r){this[wi](t,n,i,r,(o,s,a)=>{c(this,D,"f")[o][s]=(c(this,D,"f")[o][s]||[]).concat(a)})}[wi](t,n,i,r,o){if(Array.isArray(i))i.forEach(s=>{t(s,r)});else if((s=>typeof s=="object")(i))for(let s of Kt(i))t(s,i[s]);else o(n,this[xi](i),r)}[xi](t){return t==="__proto__"?"___proto___":t}[Ci](t,n){return this[Xt](this[Ci].bind(this),"key",t,n),this}[Oi](){var t,n,i,r,o,s,a,l,u,d,f,p;let g=c(this,Dn,"f").pop();Se(g,void 0,c(this,W,"f"));let C;t=this,n=this,i=this,r=this,o=this,s=this,a=this,l=this,u=this,d=this,f=this,p=this,{options:{set value(w){M(t,D,w,"f")}}.value,configObjects:C,exitProcess:{set value(w){M(n,$e,w,"f")}}.value,groups:{set value(w){M(i,Ke,w,"f")}}.value,output:{set value(w){M(r,pe,w,"f")}}.value,exitError:{set value(w){M(o,ct,w,"f")}}.value,hasOutput:{set value(w){M(s,Fe,w,"f")}}.value,parsed:this.parsed,strict:{set value(w){M(a,Rt,w,"f")}}.value,strictCommands:{set value(w){M(l,Ut,w,"f")}}.value,strictOptions:{set value(w){M(u,$t,w,"f")}}.value,completionCommand:{set value(w){M(d,Me,w,"f")}}.value,parseFn:{set value(w){M(f,Le,w,"f")}}.value,parseContext:{set value(w){M(p,Nt,w,"f")}}.value}=g,c(this,D,"f").configObjects=C,c(this,B,"f").unfreeze(),c(this,oe,"f").unfreeze(),c(this,le,"f").unfreeze(),c(this,We,"f").unfreeze()}[Jr](t,n){return Ft(n,i=>(t(i),i))}getInternalMethods(){return{getCommandInstance:this[Zr].bind(this),getContext:this[Xr].bind(this),getHasOutput:this[eo].bind(this),getLoggerInstance:this[to].bind(this),getParseContext:this[no].bind(this),getParserConfiguration:this[Wt].bind(this),getUsageInstance:this[io].bind(this),getValidationInstance:this[ro].bind(this),hasParseCallback:this[Un].bind(this),postProcess:this[Ht].bind(this),reset:this[_i].bind(this),runValidation:this[vi].bind(this),runYargsParserAndExecuteCommands:this[pn].bind(this),setHasOutput:this[so].bind(this)}}[Zr](){return c(this,le,"f")}[Xr](){return c(this,dn,"f")}[eo](){return c(this,Fe,"f")}[to](){return c(this,Jt,"f")}[no](){return c(this,Nt,"f")||{}}[io](){return c(this,B,"f")}[ro](){return c(this,oe,"f")}[Un](){return!!c(this,Le,"f")}[Ht](t,n,i,r){return i||te(t)||(n||(t=this[Br](t)),(this[Wt]()["parse-positional-numbers"]||this[Wt]()["parse-positional-numbers"]===void 0)&&(t=this[Qr](t)),r&&(t=Mt(t,this,c(this,We,"f").getMiddleware(),!1))),t}[_i](t={}){M(this,D,c(this,D,"f")||{},"f");let n={};n.local=c(this,D,"f").local||[],n.configObjects=c(this,D,"f").configObjects||[];let i={};n.local.forEach(s=>{i[s]=!0,(t[s]||[]).forEach(a=>{i[a]=!0})}),Object.assign(c(this,Tt,"f"),Object.keys(c(this,Ke,"f")).reduce((s,a)=>{let l=c(this,Ke,"f")[a].filter(u=>!(u in i));return l.length>0&&(s[a]=l),s},{})),M(this,Ke,{},"f");let r=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],o=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return r.forEach(s=>{n[s]=(c(this,D,"f")[s]||[]).filter(a=>!i[a])}),o.forEach(s=>{n[s]=at(c(this,D,"f")[s],a=>!i[a])}),n.envPrefix=c(this,D,"f").envPrefix,M(this,D,n,"f"),M(this,B,c(this,B,"f")?c(this,B,"f").reset(i):Lr(this,c(this,W,"f")),"f"),M(this,oe,c(this,oe,"f")?c(this,oe,"f").reset(i):Hr(this,c(this,B,"f"),c(this,W,"f")),"f"),M(this,le,c(this,le,"f")?c(this,le,"f").reset():Pr(c(this,B,"f"),c(this,oe,"f"),c(this,We,"f"),c(this,W,"f")),"f"),c(this,Ue,"f")||M(this,Ue,Ur(this,c(this,B,"f"),c(this,le,"f"),c(this,W,"f")),"f"),c(this,We,"f").reset(),M(this,Me,null,"f"),M(this,pe,"","f"),M(this,ct,null,"f"),M(this,Fe,!1,"f"),this.parsed=!1,this}[oo](t,n){return c(this,W,"f").path.relative(t,n)}[pn](t,n,i,r=0,o=!1){let s=!!i||o;t=t||c(this,ft,"f"),c(this,D,"f").__=c(this,W,"f").y18n.__,c(this,D,"f").configuration=this[Wt]();let a=!!c(this,D,"f").configuration["populate--"],l=Object.assign({},c(this,D,"f").configuration,{"populate--":!0}),u=c(this,W,"f").Parser.detailed(t,Object.assign({},c(this,D,"f"),{configuration:{"parse-positional-numbers":!1,...l}})),d=Object.assign(u.argv,c(this,Nt,"f")),f,p=u.aliases,g=!1,C=!1;Object.keys(d).forEach(w=>{w===c(this,He,"f")&&d[w]?g=!0:w===c(this,Qe,"f")&&d[w]&&(C=!0)}),d.$0=this.$0,this.parsed=u,r===0&&c(this,B,"f").clearCachedHelpMessage();try{if(this[yi](),n)return this[Ht](d,a,!!i,!1);c(this,He,"f")&&[c(this,He,"f")].concat(p[c(this,He,"f")]||[]).filter(q=>q.length>1).includes(""+d._[d._.length-1])&&(d._.pop(),g=!0);let w=c(this,le,"f").getCommands(),m=c(this,Ue,"f").completionKey in d,j=g||m||o;if(d._.length){if(w.length){let _;for(let q=r||0,G;d._[q]!==void 0;q++)if(G=String(d._[q]),w.includes(G)&&G!==c(this,Me,"f")){let K=c(this,le,"f").runCommand(G,this,u,q+1,o,g||C||o);return this[Ht](K,a,!!i,!1)}else if(!_&&G!==c(this,Me,"f")){_=G;break}!c(this,le,"f").hasDefaultCommand()&&c(this,Rn,"f")&&_&&!j&&c(this,oe,"f").recommendCommands(_,w)}c(this,Me,"f")&&d._.includes(c(this,Me,"f"))&&!m&&(c(this,$e,"f")&&lt(!0),this.showCompletionScript(),this.exit(0))}if(c(this,le,"f").hasDefaultCommand()&&!j){let _=c(this,le,"f").runCommand(null,this,u,0,o,g||C||o);return this[Ht](_,a,!!i,!1)}if(m){c(this,$e,"f")&&lt(!0),t=[].concat(t);let _=t.slice(t.indexOf(`--${c(this,Ue,"f").completionKey}`)+1);return c(this,Ue,"f").getCompletion(_,(q,G)=>{if(q)throw new Z(q.message);(G||[]).forEach(K=>{c(this,Jt,"f").log(K)}),this.exit(0)}),this[Ht](d,!a,!!i,!1)}if(c(this,Fe,"f")||(g?(c(this,$e,"f")&&lt(!0),s=!0,this.showHelp("log"),this.exit(0)):C&&(c(this,$e,"f")&&lt(!0),s=!0,c(this,B,"f").showVersion("log"),this.exit(0))),!s&&c(this,D,"f").skipValidation.length>0&&(s=Object.keys(d).some(_=>c(this,D,"f").skipValidation.indexOf(_)>=0&&d[_]===!0)),!s){if(u.error)throw new Z(u.error.message);if(!m){let _=this[vi](p,{},u.error);i||(f=Mt(d,this,c(this,We,"f").getMiddleware(),!0)),f=this[Jr](_,f!=null?f:d),te(f)&&!i&&(f=f.then(()=>Mt(d,this,c(this,We,"f").getMiddleware(),!1)))}}}catch(w){if(w instanceof Z)c(this,B,"f").fail(w.message,w);else throw w}return this[Ht](f!=null?f:d,a,!!i,!0)}[vi](t,n,i,r){let o={...this.getDemandedOptions()};return s=>{if(i)throw new Z(i.message);c(this,oe,"f").nonOptionCount(s),c(this,oe,"f").requiredArguments(s,o);let a=!1;c(this,Ut,"f")&&(a=c(this,oe,"f").unknownCommands(s)),c(this,Rt,"f")&&!a?c(this,oe,"f").unknownArguments(s,t,n,!!r):c(this,$t,"f")&&c(this,oe,"f").unknownArguments(s,t,{},!1,!1),c(this,oe,"f").limitedChoices(s),c(this,oe,"f").implications(s),c(this,oe,"f").conflicting(s)}}[so](){M(this,Fe,!0,"f")}[kt](t){if(typeof t=="string")c(this,D,"f").key[t]=!0;else for(let n of t)c(this,D,"f").key[n]=!0}};function Fr(e){return!!e&&typeof e.getInternalMethods=="function"}var cl=Yr(vr),ke=cl;b();b();import dd from"isomorphic-unfetch";b();import id from"chalk";import{existsSync as rd,mkdirSync as od}from"fs";import{readdir as sd,unlink as ad}from"fs/promises";import{extname as ld,join as Ms}from"path";b();function lo(e){return typeof e=="undefined"||e===null}function fl(e){return typeof e=="object"&&e!==null}function ul(e){return Array.isArray(e)?e:lo(e)?[]:[e]}function dl(e,t){var n,i,r,o;if(t)for(o=Object.keys(t),n=0,i=o.length;n<i;n+=1)r=o[n],e[r]=t[r];return e}function pl(e,t){var n="",i;for(i=0;i<t;i+=1)n+=e;return n}function hl(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var ml=lo,gl=fl,yl=ul,bl=pl,Al=hl,wl=dl,ue={isNothing:ml,isObject:gl,toArray:yl,repeat:bl,isNegativeZero:Al,extend:wl};function co(e,t){var n="",i=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(n+=`
65
+
66
+ `+e.mark.snippet),i+" "+n):i}function hn(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=co(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}hn.prototype=Object.create(Error.prototype);hn.prototype.constructor=hn;hn.prototype.toString=function(t){return this.name+": "+co(this,t)};var Ie=hn;function Ei(e,t,n,i,r){var o="",s="",a=Math.floor(r/2)-1;return i-t>a&&(o=" ... ",t=i-a+o.length),n-i>a&&(s=" ...",n=i+a-s.length),{str:o+e.slice(t,n).replace(/\t/g,"\u2192")+s,pos:i-t+o.length}}function Si(e,t){return ue.repeat(" ",t-e.length)+e}function xl(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var n=/\r?\n|\r|\0/g,i=[0],r=[],o,s=-1;o=n.exec(e.buffer);)r.push(o.index),i.push(o.index+o[0].length),e.position<=o.index&&s<0&&(s=i.length-2);s<0&&(s=i.length-1);var a="",l,u,d=Math.min(e.line+t.linesAfter,r.length).toString().length,f=t.maxLength-(t.indent+d+3);for(l=1;l<=t.linesBefore&&!(s-l<0);l++)u=Ei(e.buffer,i[s-l],r[s-l],e.position-(i[s]-i[s-l]),f),a=ue.repeat(" ",t.indent)+Si((e.line-l+1).toString(),d)+" | "+u.str+`
67
+ `+a;for(u=Ei(e.buffer,i[s],r[s],e.position,f),a+=ue.repeat(" ",t.indent)+Si((e.line+1).toString(),d)+" | "+u.str+`
68
+ `,a+=ue.repeat("-",t.indent+d+3+u.pos)+`^
69
+ `,l=1;l<=t.linesAfter&&!(s+l>=r.length);l++)u=Ei(e.buffer,i[s+l],r[s+l],e.position-(i[s]-i[s+l]),f),a+=ue.repeat(" ",t.indent)+Si((e.line+l+1).toString(),d)+" | "+u.str+`
70
+ `;return a.replace(/\n$/,"")}var Cl=xl,Ol=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],_l=["scalar","sequence","mapping"];function vl(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(i){t[String(i)]=n})}),t}function El(e,t){if(t=t||{},Object.keys(t).forEach(function(n){if(Ol.indexOf(n)===-1)throw new Ie('Unknown option "'+n+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(n){return n},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=vl(t.styleAliases||null),_l.indexOf(this.kind)===-1)throw new Ie('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var ye=El;function fo(e,t){var n=[];return e[t].forEach(function(i){var r=n.length;n.forEach(function(o,s){o.tag===i.tag&&o.kind===i.kind&&o.multi===i.multi&&(r=s)}),n[r]=i}),n}function Sl(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},t,n;function i(r){r.multi?(e.multi[r.kind].push(r),e.multi.fallback.push(r)):e[r.kind][r.tag]=e.fallback[r.tag]=r}for(t=0,n=arguments.length;t<n;t+=1)arguments[t].forEach(i);return e}function Ii(e){return this.extend(e)}Ii.prototype.extend=function(t){var n=[],i=[];if(t instanceof ye)i.push(t);else if(Array.isArray(t))i=i.concat(t);else if(t&&(Array.isArray(t.implicit)||Array.isArray(t.explicit)))t.implicit&&(n=n.concat(t.implicit)),t.explicit&&(i=i.concat(t.explicit));else throw new Ie("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(o){if(!(o instanceof ye))throw new Ie("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(o.loadKind&&o.loadKind!=="scalar")throw new Ie("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(o.multi)throw new Ie("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),i.forEach(function(o){if(!(o instanceof ye))throw new Ie("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var r=Object.create(Ii.prototype);return r.implicit=(this.implicit||[]).concat(n),r.explicit=(this.explicit||[]).concat(i),r.compiledImplicit=fo(r,"implicit"),r.compiledExplicit=fo(r,"explicit"),r.compiledTypeMap=Sl(r.compiledImplicit,r.compiledExplicit),r};var Il=Ii,jl=new ye("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),Pl=new ye("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),Ml=new ye("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),Fl=new Il({explicit:[jl,Pl,Ml]});function Ll(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function Dl(){return null}function Nl(e){return e===null}var Tl=new ye("tag:yaml.org,2002:null",{kind:"scalar",resolve:Ll,construct:Dl,predicate:Nl,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function Rl(e){if(e===null)return!1;var t=e.length;return t===4&&(e==="true"||e==="True"||e==="TRUE")||t===5&&(e==="false"||e==="False"||e==="FALSE")}function Ul(e){return e==="true"||e==="True"||e==="TRUE"}function $l(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var Wl=new ye("tag:yaml.org,2002:bool",{kind:"scalar",resolve:Rl,construct:Ul,predicate:$l,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function Hl(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function kl(e){return 48<=e&&e<=55}function Yl(e){return 48<=e&&e<=57}function Bl(e){if(e===null)return!1;var t=e.length,n=0,i=!1,r;if(!t)return!1;if(r=e[n],(r==="-"||r==="+")&&(r=e[++n]),r==="0"){if(n+1===t)return!0;if(r=e[++n],r==="b"){for(n++;n<t;n++)if(r=e[n],r!=="_"){if(r!=="0"&&r!=="1")return!1;i=!0}return i&&r!=="_"}if(r==="x"){for(n++;n<t;n++)if(r=e[n],r!=="_"){if(!Hl(e.charCodeAt(n)))return!1;i=!0}return i&&r!=="_"}if(r==="o"){for(n++;n<t;n++)if(r=e[n],r!=="_"){if(!kl(e.charCodeAt(n)))return!1;i=!0}return i&&r!=="_"}}if(r==="_")return!1;for(;n<t;n++)if(r=e[n],r!=="_"){if(!Yl(e.charCodeAt(n)))return!1;i=!0}return!(!i||r==="_")}function ql(e){var t=e,n=1,i;if(t.indexOf("_")!==-1&&(t=t.replace(/_/g,"")),i=t[0],(i==="-"||i==="+")&&(i==="-"&&(n=-1),t=t.slice(1),i=t[0]),t==="0")return 0;if(i==="0"){if(t[1]==="b")return n*parseInt(t.slice(2),2);if(t[1]==="x")return n*parseInt(t.slice(2),16);if(t[1]==="o")return n*parseInt(t.slice(2),8)}return n*parseInt(t,10)}function Gl(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!ue.isNegativeZero(e)}var zl=new ye("tag:yaml.org,2002:int",{kind:"scalar",resolve:Bl,construct:ql,predicate:Gl,represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Vl=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function Kl(e){return!(e===null||!Vl.test(e)||e[e.length-1]==="_")}function Ql(e){var t,n;return t=e.replace(/_/g,"").toLowerCase(),n=t[0]==="-"?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),t===".inf"?n===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:t===".nan"?NaN:n*parseFloat(t,10)}var Jl=/^[-+]?[0-9]+e/;function Zl(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(ue.isNegativeZero(e))return"-0.0";return n=e.toString(10),Jl.test(n)?n.replace("e",".e"):n}function Xl(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||ue.isNegativeZero(e))}var ec=new ye("tag:yaml.org,2002:float",{kind:"scalar",resolve:Kl,construct:Ql,predicate:Xl,represent:Zl,defaultStyle:"lowercase"}),tc=Fl.extend({implicit:[Tl,Wl,zl,ec]}),nc=tc,uo=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),po=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function ic(e){return e===null?!1:uo.exec(e)!==null||po.exec(e)!==null}function rc(e){var t,n,i,r,o,s,a,l=0,u=null,d,f,p;if(t=uo.exec(e),t===null&&(t=po.exec(e)),t===null)throw new Error("Date resolve error");if(n=+t[1],i=+t[2]-1,r=+t[3],!t[4])return new Date(Date.UTC(n,i,r));if(o=+t[4],s=+t[5],a=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(d=+t[10],f=+(t[11]||0),u=(d*60+f)*6e4,t[9]==="-"&&(u=-u)),p=new Date(Date.UTC(n,i,r,o,s,a,l)),u&&p.setTime(p.getTime()-u),p}function oc(e){return e.toISOString()}var sc=new ye("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:ic,construct:rc,instanceOf:Date,represent:oc});function ac(e){return e==="<<"||e===null}var lc=new ye("tag:yaml.org,2002:merge",{kind:"scalar",resolve:ac}),ji=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
71
+ \r`;function cc(e){if(e===null)return!1;var t,n,i=0,r=e.length,o=ji;for(n=0;n<r;n++)if(t=o.indexOf(e.charAt(n)),!(t>64)){if(t<0)return!1;i+=6}return i%8===0}function fc(e){var t,n,i=e.replace(/[\r\n=]/g,""),r=i.length,o=ji,s=0,a=[];for(t=0;t<r;t++)t%4===0&&t&&(a.push(s>>16&255),a.push(s>>8&255),a.push(s&255)),s=s<<6|o.indexOf(i.charAt(t));return n=r%4*6,n===0?(a.push(s>>16&255),a.push(s>>8&255),a.push(s&255)):n===18?(a.push(s>>10&255),a.push(s>>2&255)):n===12&&a.push(s>>4&255),new Uint8Array(a)}function uc(e){var t="",n=0,i,r,o=e.length,s=ji;for(i=0;i<o;i++)i%3===0&&i&&(t+=s[n>>18&63],t+=s[n>>12&63],t+=s[n>>6&63],t+=s[n&63]),n=(n<<8)+e[i];return r=o%3,r===0?(t+=s[n>>18&63],t+=s[n>>12&63],t+=s[n>>6&63],t+=s[n&63]):r===2?(t+=s[n>>10&63],t+=s[n>>4&63],t+=s[n<<2&63],t+=s[64]):r===1&&(t+=s[n>>2&63],t+=s[n<<4&63],t+=s[64],t+=s[64]),t}function dc(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var pc=new ye("tag:yaml.org,2002:binary",{kind:"scalar",resolve:cc,construct:fc,predicate:dc,represent:uc}),hc=Object.prototype.hasOwnProperty,mc=Object.prototype.toString;function gc(e){if(e===null)return!0;var t=[],n,i,r,o,s,a=e;for(n=0,i=a.length;n<i;n+=1){if(r=a[n],s=!1,mc.call(r)!=="[object Object]")return!1;for(o in r)if(hc.call(r,o))if(!s)s=!0;else return!1;if(!s)return!1;if(t.indexOf(o)===-1)t.push(o);else return!1}return!0}function yc(e){return e!==null?e:[]}var bc=new ye("tag:yaml.org,2002:omap",{kind:"sequence",resolve:gc,construct:yc}),Ac=Object.prototype.toString;function wc(e){if(e===null)return!0;var t,n,i,r,o,s=e;for(o=new Array(s.length),t=0,n=s.length;t<n;t+=1){if(i=s[t],Ac.call(i)!=="[object Object]"||(r=Object.keys(i),r.length!==1))return!1;o[t]=[r[0],i[r[0]]]}return!0}function xc(e){if(e===null)return[];var t,n,i,r,o,s=e;for(o=new Array(s.length),t=0,n=s.length;t<n;t+=1)i=s[t],r=Object.keys(i),o[t]=[r[0],i[r[0]]];return o}var Cc=new ye("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:wc,construct:xc}),Oc=Object.prototype.hasOwnProperty;function _c(e){if(e===null)return!0;var t,n=e;for(t in n)if(Oc.call(n,t)&&n[t]!==null)return!1;return!0}function vc(e){return e!==null?e:{}}var Ec=new ye("tag:yaml.org,2002:set",{kind:"mapping",resolve:_c,construct:vc}),ho=nc.extend({implicit:[sc,lc],explicit:[pc,bc,Cc,Ec]}),dt=Object.prototype.hasOwnProperty,$n=1,mo=2,go=3,Wn=4,Pi=1,Sc=2,yo=3,Ic=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,jc=/[\x85\u2028\u2029]/,Pc=/[,\[\]\{\}]/,bo=/^(?:!|!!|![a-z\-]+!)$/i,Ao=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function wo(e){return Object.prototype.toString.call(e)}function Je(e){return e===10||e===13}function Yt(e){return e===9||e===32}function je(e){return e===9||e===32||e===10||e===13}function en(e){return e===44||e===91||e===93||e===123||e===125}function Mc(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function Fc(e){return e===120?2:e===117?4:e===85?8:0}function Lc(e){return 48<=e&&e<=57?e-48:-1}function xo(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
72
+ `:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"\x85":e===95?"\xA0":e===76?"\u2028":e===80?"\u2029":""}function Dc(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}var Co=new Array(256),Oo=new Array(256);for(Bt=0;Bt<256;Bt++)Co[Bt]=xo(Bt)?1:0,Oo[Bt]=xo(Bt);var Bt;function Nc(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||ho,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function _o(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=Cl(n),new Ie(t,n)}function T(e,t){throw _o(e,t)}function Hn(e,t){e.onWarning&&e.onWarning.call(null,_o(e,t))}var vo={YAML:function(t,n,i){var r,o,s;t.version!==null&&T(t,"duplication of %YAML directive"),i.length!==1&&T(t,"YAML directive accepts exactly one argument"),r=/^([0-9]+)\.([0-9]+)$/.exec(i[0]),r===null&&T(t,"ill-formed argument of the YAML directive"),o=parseInt(r[1],10),s=parseInt(r[2],10),o!==1&&T(t,"unacceptable YAML version of the document"),t.version=i[0],t.checkLineBreaks=s<2,s!==1&&s!==2&&Hn(t,"unsupported YAML version of the document")},TAG:function(t,n,i){var r,o;i.length!==2&&T(t,"TAG directive accepts exactly two arguments"),r=i[0],o=i[1],bo.test(r)||T(t,"ill-formed tag handle (first argument) of the TAG directive"),dt.call(t.tagMap,r)&&T(t,'there is a previously declared suffix for "'+r+'" tag handle'),Ao.test(o)||T(t,"ill-formed tag prefix (second argument) of the TAG directive");try{o=decodeURIComponent(o)}catch(s){T(t,"tag prefix is malformed: "+o)}t.tagMap[r]=o}};function pt(e,t,n,i){var r,o,s,a;if(t<n){if(a=e.input.slice(t,n),i)for(r=0,o=a.length;r<o;r+=1)s=a.charCodeAt(r),s===9||32<=s&&s<=1114111||T(e,"expected valid JSON character");else Ic.test(a)&&T(e,"the stream contains non-printable characters");e.result+=a}}function Eo(e,t,n,i){var r,o,s,a;for(ue.isObject(n)||T(e,"cannot merge mappings; the provided source object is unacceptable"),r=Object.keys(n),s=0,a=r.length;s<a;s+=1)o=r[s],dt.call(t,o)||(t[o]=n[o],i[o]=!0)}function tn(e,t,n,i,r,o,s,a,l){var u,d;if(Array.isArray(r))for(r=Array.prototype.slice.call(r),u=0,d=r.length;u<d;u+=1)Array.isArray(r[u])&&T(e,"nested arrays are not supported inside keys"),typeof r=="object"&&wo(r[u])==="[object Object]"&&(r[u]="[object Object]");if(typeof r=="object"&&wo(r)==="[object Object]"&&(r="[object Object]"),r=String(r),t===null&&(t={}),i==="tag:yaml.org,2002:merge")if(Array.isArray(o))for(u=0,d=o.length;u<d;u+=1)Eo(e,t,o[u],n);else Eo(e,t,o,n);else!e.json&&!dt.call(n,r)&&dt.call(t,r)&&(e.line=s||e.line,e.lineStart=a||e.lineStart,e.position=l||e.position,T(e,"duplicated mapping key")),r==="__proto__"?Object.defineProperty(t,r,{configurable:!0,enumerable:!0,writable:!0,value:o}):t[r]=o,delete n[r];return t}function Mi(e){var t;t=e.input.charCodeAt(e.position),t===10?e.position++:t===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):T(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function ce(e,t,n){for(var i=0,r=e.input.charCodeAt(e.position);r!==0;){for(;Yt(r);)r===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),r=e.input.charCodeAt(++e.position);if(t&&r===35)do r=e.input.charCodeAt(++e.position);while(r!==10&&r!==13&&r!==0);if(Je(r))for(Mi(e),r=e.input.charCodeAt(e.position),i++,e.lineIndent=0;r===32;)e.lineIndent++,r=e.input.charCodeAt(++e.position);else break}return n!==-1&&i!==0&&e.lineIndent<n&&Hn(e,"deficient indentation"),i}function kn(e){var t=e.position,n;return n=e.input.charCodeAt(t),!!((n===45||n===46)&&n===e.input.charCodeAt(t+1)&&n===e.input.charCodeAt(t+2)&&(t+=3,n=e.input.charCodeAt(t),n===0||je(n)))}function Fi(e,t){t===1?e.result+=" ":t>1&&(e.result+=ue.repeat(`
73
+ `,t-1))}function Tc(e,t,n){var i,r,o,s,a,l,u,d,f=e.kind,p=e.result,g;if(g=e.input.charCodeAt(e.position),je(g)||en(g)||g===35||g===38||g===42||g===33||g===124||g===62||g===39||g===34||g===37||g===64||g===96||(g===63||g===45)&&(r=e.input.charCodeAt(e.position+1),je(r)||n&&en(r)))return!1;for(e.kind="scalar",e.result="",o=s=e.position,a=!1;g!==0;){if(g===58){if(r=e.input.charCodeAt(e.position+1),je(r)||n&&en(r))break}else if(g===35){if(i=e.input.charCodeAt(e.position-1),je(i))break}else{if(e.position===e.lineStart&&kn(e)||n&&en(g))break;if(Je(g))if(l=e.line,u=e.lineStart,d=e.lineIndent,ce(e,!1,-1),e.lineIndent>=t){a=!0,g=e.input.charCodeAt(e.position);continue}else{e.position=s,e.line=l,e.lineStart=u,e.lineIndent=d;break}}a&&(pt(e,o,s,!1),Fi(e,e.line-l),o=s=e.position,a=!1),Yt(g)||(s=e.position+1),g=e.input.charCodeAt(++e.position)}return pt(e,o,s,!1),e.result?!0:(e.kind=f,e.result=p,!1)}function Rc(e,t){var n,i,r;if(n=e.input.charCodeAt(e.position),n!==39)return!1;for(e.kind="scalar",e.result="",e.position++,i=r=e.position;(n=e.input.charCodeAt(e.position))!==0;)if(n===39)if(pt(e,i,e.position,!0),n=e.input.charCodeAt(++e.position),n===39)i=e.position,e.position++,r=e.position;else return!0;else Je(n)?(pt(e,i,r,!0),Fi(e,ce(e,!1,t)),i=r=e.position):e.position===e.lineStart&&kn(e)?T(e,"unexpected end of the document within a single quoted scalar"):(e.position++,r=e.position);T(e,"unexpected end of the stream within a single quoted scalar")}function Uc(e,t){var n,i,r,o,s,a;if(a=e.input.charCodeAt(e.position),a!==34)return!1;for(e.kind="scalar",e.result="",e.position++,n=i=e.position;(a=e.input.charCodeAt(e.position))!==0;){if(a===34)return pt(e,n,e.position,!0),e.position++,!0;if(a===92){if(pt(e,n,e.position,!0),a=e.input.charCodeAt(++e.position),Je(a))ce(e,!1,t);else if(a<256&&Co[a])e.result+=Oo[a],e.position++;else if((s=Fc(a))>0){for(r=s,o=0;r>0;r--)a=e.input.charCodeAt(++e.position),(s=Mc(a))>=0?o=(o<<4)+s:T(e,"expected hexadecimal character");e.result+=Dc(o),e.position++}else T(e,"unknown escape sequence");n=i=e.position}else Je(a)?(pt(e,n,i,!0),Fi(e,ce(e,!1,t)),n=i=e.position):e.position===e.lineStart&&kn(e)?T(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}T(e,"unexpected end of the stream within a double quoted scalar")}function $c(e,t){var n=!0,i,r,o,s=e.tag,a,l=e.anchor,u,d,f,p,g,C=Object.create(null),w,m,j,_;if(_=e.input.charCodeAt(e.position),_===91)d=93,g=!1,a=[];else if(_===123)d=125,g=!0,a={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=a),_=e.input.charCodeAt(++e.position);_!==0;){if(ce(e,!0,t),_=e.input.charCodeAt(e.position),_===d)return e.position++,e.tag=s,e.anchor=l,e.kind=g?"mapping":"sequence",e.result=a,!0;n?_===44&&T(e,"expected the node content, but found ','"):T(e,"missed comma between flow collection entries"),m=w=j=null,f=p=!1,_===63&&(u=e.input.charCodeAt(e.position+1),je(u)&&(f=p=!0,e.position++,ce(e,!0,t))),i=e.line,r=e.lineStart,o=e.position,nn(e,t,$n,!1,!0),m=e.tag,w=e.result,ce(e,!0,t),_=e.input.charCodeAt(e.position),(p||e.line===i)&&_===58&&(f=!0,_=e.input.charCodeAt(++e.position),ce(e,!0,t),nn(e,t,$n,!1,!0),j=e.result),g?tn(e,a,C,m,w,j,i,r,o):f?a.push(tn(e,null,C,m,w,j,i,r,o)):a.push(w),ce(e,!0,t),_=e.input.charCodeAt(e.position),_===44?(n=!0,_=e.input.charCodeAt(++e.position)):n=!1}T(e,"unexpected end of the stream within a flow collection")}function Wc(e,t){var n,i,r=Pi,o=!1,s=!1,a=t,l=0,u=!1,d,f;if(f=e.input.charCodeAt(e.position),f===124)i=!1;else if(f===62)i=!0;else return!1;for(e.kind="scalar",e.result="";f!==0;)if(f=e.input.charCodeAt(++e.position),f===43||f===45)Pi===r?r=f===43?yo:Sc:T(e,"repeat of a chomping mode identifier");else if((d=Lc(f))>=0)d===0?T(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?T(e,"repeat of an indentation width identifier"):(a=t+d-1,s=!0);else break;if(Yt(f)){do f=e.input.charCodeAt(++e.position);while(Yt(f));if(f===35)do f=e.input.charCodeAt(++e.position);while(!Je(f)&&f!==0)}for(;f!==0;){for(Mi(e),e.lineIndent=0,f=e.input.charCodeAt(e.position);(!s||e.lineIndent<a)&&f===32;)e.lineIndent++,f=e.input.charCodeAt(++e.position);if(!s&&e.lineIndent>a&&(a=e.lineIndent),Je(f)){l++;continue}if(e.lineIndent<a){r===yo?e.result+=ue.repeat(`
74
+ `,o?1+l:l):r===Pi&&o&&(e.result+=`
75
+ `);break}for(i?Yt(f)?(u=!0,e.result+=ue.repeat(`
76
+ `,o?1+l:l)):u?(u=!1,e.result+=ue.repeat(`
77
+ `,l+1)):l===0?o&&(e.result+=" "):e.result+=ue.repeat(`
78
+ `,l):e.result+=ue.repeat(`
79
+ `,o?1+l:l),o=!0,s=!0,l=0,n=e.position;!Je(f)&&f!==0;)f=e.input.charCodeAt(++e.position);pt(e,n,e.position,!1)}return!0}function So(e,t){var n,i=e.tag,r=e.anchor,o=[],s,a=!1,l;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=o),l=e.input.charCodeAt(e.position);l!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,T(e,"tab characters must not be used in indentation")),!(l!==45||(s=e.input.charCodeAt(e.position+1),!je(s))));){if(a=!0,e.position++,ce(e,!0,-1)&&e.lineIndent<=t){o.push(null),l=e.input.charCodeAt(e.position);continue}if(n=e.line,nn(e,t,go,!1,!0),o.push(e.result),ce(e,!0,-1),l=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&l!==0)T(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break}return a?(e.tag=i,e.anchor=r,e.kind="sequence",e.result=o,!0):!1}function Hc(e,t,n){var i,r,o,s,a,l,u=e.tag,d=e.anchor,f={},p=Object.create(null),g=null,C=null,w=null,m=!1,j=!1,_;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=f),_=e.input.charCodeAt(e.position);_!==0;){if(!m&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,T(e,"tab characters must not be used in indentation")),i=e.input.charCodeAt(e.position+1),o=e.line,(_===63||_===58)&&je(i))_===63?(m&&(tn(e,f,p,g,C,null,s,a,l),g=C=w=null),j=!0,m=!0,r=!0):m?(m=!1,r=!0):T(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,_=i;else{if(s=e.line,a=e.lineStart,l=e.position,!nn(e,n,mo,!1,!0))break;if(e.line===o){for(_=e.input.charCodeAt(e.position);Yt(_);)_=e.input.charCodeAt(++e.position);if(_===58)_=e.input.charCodeAt(++e.position),je(_)||T(e,"a whitespace character is expected after the key-value separator within a block mapping"),m&&(tn(e,f,p,g,C,null,s,a,l),g=C=w=null),j=!0,m=!1,r=!1,g=e.tag,C=e.result;else if(j)T(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=u,e.anchor=d,!0}else if(j)T(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=u,e.anchor=d,!0}if((e.line===o||e.lineIndent>t)&&(m&&(s=e.line,a=e.lineStart,l=e.position),nn(e,t,Wn,!0,r)&&(m?C=e.result:w=e.result),m||(tn(e,f,p,g,C,w,s,a,l),g=C=w=null),ce(e,!0,-1),_=e.input.charCodeAt(e.position)),(e.line===o||e.lineIndent>t)&&_!==0)T(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return m&&tn(e,f,p,g,C,null,s,a,l),j&&(e.tag=u,e.anchor=d,e.kind="mapping",e.result=f),j}function kc(e){var t,n=!1,i=!1,r,o,s;if(s=e.input.charCodeAt(e.position),s!==33)return!1;if(e.tag!==null&&T(e,"duplication of a tag property"),s=e.input.charCodeAt(++e.position),s===60?(n=!0,s=e.input.charCodeAt(++e.position)):s===33?(i=!0,r="!!",s=e.input.charCodeAt(++e.position)):r="!",t=e.position,n){do s=e.input.charCodeAt(++e.position);while(s!==0&&s!==62);e.position<e.length?(o=e.input.slice(t,e.position),s=e.input.charCodeAt(++e.position)):T(e,"unexpected end of the stream within a verbatim tag")}else{for(;s!==0&&!je(s);)s===33&&(i?T(e,"tag suffix cannot contain exclamation marks"):(r=e.input.slice(t-1,e.position+1),bo.test(r)||T(e,"named tag handle cannot contain such characters"),i=!0,t=e.position+1)),s=e.input.charCodeAt(++e.position);o=e.input.slice(t,e.position),Pc.test(o)&&T(e,"tag suffix cannot contain flow indicator characters")}o&&!Ao.test(o)&&T(e,"tag name cannot contain such characters: "+o);try{o=decodeURIComponent(o)}catch(a){T(e,"tag name is malformed: "+o)}return n?e.tag=o:dt.call(e.tagMap,r)?e.tag=e.tagMap[r]+o:r==="!"?e.tag="!"+o:r==="!!"?e.tag="tag:yaml.org,2002:"+o:T(e,'undeclared tag handle "'+r+'"'),!0}function Yc(e){var t,n;if(n=e.input.charCodeAt(e.position),n!==38)return!1;for(e.anchor!==null&&T(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;n!==0&&!je(n)&&!en(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&T(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function Bc(e){var t,n,i;if(i=e.input.charCodeAt(e.position),i!==42)return!1;for(i=e.input.charCodeAt(++e.position),t=e.position;i!==0&&!je(i)&&!en(i);)i=e.input.charCodeAt(++e.position);return e.position===t&&T(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),dt.call(e.anchorMap,n)||T(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],ce(e,!0,-1),!0}function nn(e,t,n,i,r){var o,s,a,l=1,u=!1,d=!1,f,p,g,C,w,m;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,o=s=a=Wn===n||go===n,i&&ce(e,!0,-1)&&(u=!0,e.lineIndent>t?l=1:e.lineIndent===t?l=0:e.lineIndent<t&&(l=-1)),l===1)for(;kc(e)||Yc(e);)ce(e,!0,-1)?(u=!0,a=o,e.lineIndent>t?l=1:e.lineIndent===t?l=0:e.lineIndent<t&&(l=-1)):a=!1;if(a&&(a=u||r),(l===1||Wn===n)&&($n===n||mo===n?w=t:w=t+1,m=e.position-e.lineStart,l===1?a&&(So(e,m)||Hc(e,m,w))||$c(e,w)?d=!0:(s&&Wc(e,w)||Rc(e,w)||Uc(e,w)?d=!0:Bc(e)?(d=!0,(e.tag!==null||e.anchor!==null)&&T(e,"alias node should not have any properties")):Tc(e,w,$n===n)&&(d=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):l===0&&(d=a&&So(e,m))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&T(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),f=0,p=e.implicitTypes.length;f<p;f+=1)if(C=e.implicitTypes[f],C.resolve(e.result)){e.result=C.construct(e.result),e.tag=C.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(dt.call(e.typeMap[e.kind||"fallback"],e.tag))C=e.typeMap[e.kind||"fallback"][e.tag];else for(C=null,g=e.typeMap.multi[e.kind||"fallback"],f=0,p=g.length;f<p;f+=1)if(e.tag.slice(0,g[f].tag.length)===g[f].tag){C=g[f];break}C||T(e,"unknown tag !<"+e.tag+">"),e.result!==null&&C.kind!==e.kind&&T(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+C.kind+'", not "'+e.kind+'"'),C.resolve(e.result,e.tag)?(e.result=C.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):T(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||d}function qc(e){var t=e.position,n,i,r,o=!1,s;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(s=e.input.charCodeAt(e.position))!==0&&(ce(e,!0,-1),s=e.input.charCodeAt(e.position),!(e.lineIndent>0||s!==37));){for(o=!0,s=e.input.charCodeAt(++e.position),n=e.position;s!==0&&!je(s);)s=e.input.charCodeAt(++e.position);for(i=e.input.slice(n,e.position),r=[],i.length<1&&T(e,"directive name must not be less than one character in length");s!==0;){for(;Yt(s);)s=e.input.charCodeAt(++e.position);if(s===35){do s=e.input.charCodeAt(++e.position);while(s!==0&&!Je(s));break}if(Je(s))break;for(n=e.position;s!==0&&!je(s);)s=e.input.charCodeAt(++e.position);r.push(e.input.slice(n,e.position))}s!==0&&Mi(e),dt.call(vo,i)?vo[i](e,i,r):Hn(e,'unknown document directive "'+i+'"')}if(ce(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,ce(e,!0,-1)):o&&T(e,"directives end mark is expected"),nn(e,e.lineIndent-1,Wn,!1,!0),ce(e,!0,-1),e.checkLineBreaks&&jc.test(e.input.slice(t,e.position))&&Hn(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&kn(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,ce(e,!0,-1));return}if(e.position<e.length-1)T(e,"end of the stream or a document separator is expected");else return}function Io(e,t){e=String(e),t=t||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
80
+ `),e.charCodeAt(0)===65279&&(e=e.slice(1)));var n=new Nc(e,t),i=e.indexOf("\0");for(i!==-1&&(n.position=i,T(n,"null byte is not allowed in input")),n.input+="\0";n.input.charCodeAt(n.position)===32;)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)qc(n);return n.documents}function Gc(e,t,n){t!==null&&typeof t=="object"&&typeof n=="undefined"&&(n=t,t=null);var i=Io(e,n);if(typeof t!="function")return i;for(var r=0,o=i.length;r<o;r+=1)t(i[r])}function zc(e,t){var n=Io(e,t);if(n.length!==0){if(n.length===1)return n[0];throw new Ie("expected a single document in the stream, but found more")}}var Vc=Gc,Kc=zc,jo={loadAll:Vc,load:Kc},Po=Object.prototype.toString,Mo=Object.prototype.hasOwnProperty,Li=65279,Qc=9,mn=10,Jc=13,Zc=32,Xc=33,ef=34,Di=35,tf=37,nf=38,rf=39,of=42,Fo=44,sf=45,Yn=58,af=61,lf=62,cf=63,ff=64,Lo=91,Do=93,uf=96,No=123,df=124,To=125,be={};be[0]="\\0";be[7]="\\a";be[8]="\\b";be[9]="\\t";be[10]="\\n";be[11]="\\v";be[12]="\\f";be[13]="\\r";be[27]="\\e";be[34]='\\"';be[92]="\\\\";be[133]="\\N";be[160]="\\_";be[8232]="\\L";be[8233]="\\P";var pf=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],hf=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function mf(e,t){var n,i,r,o,s,a,l;if(t===null)return{};for(n={},i=Object.keys(t),r=0,o=i.length;r<o;r+=1)s=i[r],a=String(t[s]),s.slice(0,2)==="!!"&&(s="tag:yaml.org,2002:"+s.slice(2)),l=e.compiledTypeMap.fallback[s],l&&Mo.call(l.styleAliases,a)&&(a=l.styleAliases[a]),n[s]=a;return n}function gf(e){var t,n,i;if(t=e.toString(16).toUpperCase(),e<=255)n="x",i=2;else if(e<=65535)n="u",i=4;else if(e<=4294967295)n="U",i=8;else throw new Ie("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+n+ue.repeat("0",i-t.length)+t}var yf=1,gn=2;function bf(e){this.schema=e.schema||ho,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=ue.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=mf(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?gn:yf,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function Ro(e,t){for(var n=ue.repeat(" ",t),i=0,r=-1,o="",s,a=e.length;i<a;)r=e.indexOf(`
81
+ `,i),r===-1?(s=e.slice(i),i=a):(s=e.slice(i,r+1),i=r+1),s.length&&s!==`
82
+ `&&(o+=n),o+=s;return o}function Ni(e,t){return`
83
+ `+ue.repeat(" ",e.indent*t)}function Af(e,t){var n,i,r;for(n=0,i=e.implicitTypes.length;n<i;n+=1)if(r=e.implicitTypes[n],r.resolve(t))return!0;return!1}function Bn(e){return e===Zc||e===Qc}function yn(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==Li||65536<=e&&e<=1114111}function Uo(e){return yn(e)&&e!==Li&&e!==Jc&&e!==mn}function $o(e,t,n){var i=Uo(e),r=i&&!Bn(e);return(n?i:i&&e!==Fo&&e!==Lo&&e!==Do&&e!==No&&e!==To)&&e!==Di&&!(t===Yn&&!r)||Uo(t)&&!Bn(t)&&e===Di||t===Yn&&r}function wf(e){return yn(e)&&e!==Li&&!Bn(e)&&e!==sf&&e!==cf&&e!==Yn&&e!==Fo&&e!==Lo&&e!==Do&&e!==No&&e!==To&&e!==Di&&e!==nf&&e!==of&&e!==Xc&&e!==df&&e!==af&&e!==lf&&e!==rf&&e!==ef&&e!==tf&&e!==ff&&e!==uf}function xf(e){return!Bn(e)&&e!==Yn}function bn(e,t){var n=e.charCodeAt(t),i;return n>=55296&&n<=56319&&t+1<e.length&&(i=e.charCodeAt(t+1),i>=56320&&i<=57343)?(n-55296)*1024+i-56320+65536:n}function Wo(e){var t=/^\n* /;return t.test(e)}var Ho=1,Ti=2,ko=3,Yo=4,rn=5;function Cf(e,t,n,i,r,o,s,a){var l,u=0,d=null,f=!1,p=!1,g=i!==-1,C=-1,w=wf(bn(e,0))&&xf(bn(e,e.length-1));if(t||s)for(l=0;l<e.length;u>=65536?l+=2:l++){if(u=bn(e,l),!yn(u))return rn;w=w&&$o(u,d,a),d=u}else{for(l=0;l<e.length;u>=65536?l+=2:l++){if(u=bn(e,l),u===mn)f=!0,g&&(p=p||l-C-1>i&&e[C+1]!==" ",C=l);else if(!yn(u))return rn;w=w&&$o(u,d,a),d=u}p=p||g&&l-C-1>i&&e[C+1]!==" "}return!f&&!p?w&&!s&&!r(e)?Ho:o===gn?rn:Ti:n>9&&Wo(e)?rn:s?o===gn?rn:Ti:p?Yo:ko}function Of(e,t,n,i,r){e.dump=function(){if(t.length===0)return e.quotingType===gn?'""':"''";if(!e.noCompatMode&&(pf.indexOf(t)!==-1||hf.test(t)))return e.quotingType===gn?'"'+t+'"':"'"+t+"'";var o=e.indent*Math.max(1,n),s=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-o),a=i||e.flowLevel>-1&&n>=e.flowLevel;function l(u){return Af(e,u)}switch(Cf(t,a,e.indent,s,l,e.quotingType,e.forceQuotes&&!i,r)){case Ho:return t;case Ti:return"'"+t.replace(/'/g,"''")+"'";case ko:return"|"+Bo(t,e.indent)+qo(Ro(t,o));case Yo:return">"+Bo(t,e.indent)+qo(Ro(_f(t,s),o));case rn:return'"'+vf(t)+'"';default:throw new Ie("impossible error: invalid scalar style")}}()}function Bo(e,t){var n=Wo(e)?String(t):"",i=e[e.length-1]===`
84
+ `,r=i&&(e[e.length-2]===`
85
+ `||e===`
86
+ `),o=r?"+":i?"":"-";return n+o+`
87
+ `}function qo(e){return e[e.length-1]===`
88
+ `?e.slice(0,-1):e}function _f(e,t){for(var n=/(\n+)([^\n]*)/g,i=function(){var u=e.indexOf(`
89
+ `);return u=u!==-1?u:e.length,n.lastIndex=u,Go(e.slice(0,u),t)}(),r=e[0]===`
90
+ `||e[0]===" ",o,s;s=n.exec(e);){var a=s[1],l=s[2];o=l[0]===" ",i+=a+(!r&&!o&&l!==""?`
91
+ `:"")+Go(l,t),r=o}return i}function Go(e,t){if(e===""||e[0]===" ")return e;for(var n=/ [^ ]/g,i,r=0,o,s=0,a=0,l="";i=n.exec(e);)a=i.index,a-r>t&&(o=s>r?s:a,l+=`
92
+ `+e.slice(r,o),r=o+1),s=a;return l+=`
93
+ `,e.length-r>t&&s>r?l+=e.slice(r,s)+`
94
+ `+e.slice(s+1):l+=e.slice(r),l.slice(1)}function vf(e){for(var t="",n=0,i,r=0;r<e.length;n>=65536?r+=2:r++)n=bn(e,r),i=be[n],!i&&yn(n)?(t+=e[r],n>=65536&&(t+=e[r+1])):t+=i||gf(n);return t}function Ef(e,t,n){var i="",r=e.tag,o,s,a;for(o=0,s=n.length;o<s;o+=1)a=n[o],e.replacer&&(a=e.replacer.call(n,String(o),a)),(tt(e,t,a,!1,!1)||typeof a=="undefined"&&tt(e,t,null,!1,!1))&&(i!==""&&(i+=","+(e.condenseFlow?"":" ")),i+=e.dump);e.tag=r,e.dump="["+i+"]"}function zo(e,t,n,i){var r="",o=e.tag,s,a,l;for(s=0,a=n.length;s<a;s+=1)l=n[s],e.replacer&&(l=e.replacer.call(n,String(s),l)),(tt(e,t+1,l,!0,!0,!1,!0)||typeof l=="undefined"&&tt(e,t+1,null,!0,!0,!1,!0))&&((!i||r!=="")&&(r+=Ni(e,t)),e.dump&&mn===e.dump.charCodeAt(0)?r+="-":r+="- ",r+=e.dump);e.tag=o,e.dump=r||"[]"}function Sf(e,t,n){var i="",r=e.tag,o=Object.keys(n),s,a,l,u,d;for(s=0,a=o.length;s<a;s+=1)d="",i!==""&&(d+=", "),e.condenseFlow&&(d+='"'),l=o[s],u=n[l],e.replacer&&(u=e.replacer.call(n,l,u)),!!tt(e,t,l,!1,!1)&&(e.dump.length>1024&&(d+="? "),d+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),!!tt(e,t,u,!1,!1)&&(d+=e.dump,i+=d));e.tag=r,e.dump="{"+i+"}"}function If(e,t,n,i){var r="",o=e.tag,s=Object.keys(n),a,l,u,d,f,p;if(e.sortKeys===!0)s.sort();else if(typeof e.sortKeys=="function")s.sort(e.sortKeys);else if(e.sortKeys)throw new Ie("sortKeys must be a boolean or a function");for(a=0,l=s.length;a<l;a+=1)p="",(!i||r!=="")&&(p+=Ni(e,t)),u=s[a],d=n[u],e.replacer&&(d=e.replacer.call(n,u,d)),!!tt(e,t+1,u,!0,!0,!0)&&(f=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,f&&(e.dump&&mn===e.dump.charCodeAt(0)?p+="?":p+="? "),p+=e.dump,f&&(p+=Ni(e,t)),!!tt(e,t+1,d,!0,f)&&(e.dump&&mn===e.dump.charCodeAt(0)?p+=":":p+=": ",p+=e.dump,r+=p));e.tag=o,e.dump=r||"{}"}function Vo(e,t,n){var i,r,o,s,a,l;for(r=n?e.explicitTypes:e.implicitTypes,o=0,s=r.length;o<s;o+=1)if(a=r[o],(a.instanceOf||a.predicate)&&(!a.instanceOf||typeof t=="object"&&t instanceof a.instanceOf)&&(!a.predicate||a.predicate(t))){if(n?a.multi&&a.representName?e.tag=a.representName(t):e.tag=a.tag:e.tag="?",a.represent){if(l=e.styleMap[a.tag]||a.defaultStyle,Po.call(a.represent)==="[object Function]")i=a.represent(t,l);else if(Mo.call(a.represent,l))i=a.represent[l](t,l);else throw new Ie("!<"+a.tag+'> tag resolver accepts not "'+l+'" style');e.dump=i}return!0}return!1}function tt(e,t,n,i,r,o,s){e.tag=null,e.dump=n,Vo(e,n,!1)||Vo(e,n,!0);var a=Po.call(e.dump),l=i,u;i&&(i=e.flowLevel<0||e.flowLevel>t);var d=a==="[object Object]"||a==="[object Array]",f,p;if(d&&(f=e.duplicates.indexOf(n),p=f!==-1),(e.tag!==null&&e.tag!=="?"||p||e.indent!==2&&t>0)&&(r=!1),p&&e.usedDuplicates[f])e.dump="*ref_"+f;else{if(d&&p&&!e.usedDuplicates[f]&&(e.usedDuplicates[f]=!0),a==="[object Object]")i&&Object.keys(e.dump).length!==0?(If(e,t,e.dump,r),p&&(e.dump="&ref_"+f+e.dump)):(Sf(e,t,e.dump),p&&(e.dump="&ref_"+f+" "+e.dump));else if(a==="[object Array]")i&&e.dump.length!==0?(e.noArrayIndent&&!s&&t>0?zo(e,t-1,e.dump,r):zo(e,t,e.dump,r),p&&(e.dump="&ref_"+f+e.dump)):(Ef(e,t,e.dump),p&&(e.dump="&ref_"+f+" "+e.dump));else if(a==="[object String]")e.tag!=="?"&&Of(e,e.dump,t,o,l);else{if(a==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new Ie("unacceptable kind of an object to dump "+a)}e.tag!==null&&e.tag!=="?"&&(u=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?u="!"+u:u.slice(0,18)==="tag:yaml.org,2002:"?u="!!"+u.slice(18):u="!<"+u+">",e.dump=u+" "+e.dump)}return!0}function jf(e,t){var n=[],i=[],r,o;for(Ri(e,n,i),r=0,o=i.length;r<o;r+=1)t.duplicates.push(n[i[r]]);t.usedDuplicates=new Array(o)}function Ri(e,t,n){var i,r,o;if(e!==null&&typeof e=="object")if(r=t.indexOf(e),r!==-1)n.indexOf(r)===-1&&n.push(r);else if(t.push(e),Array.isArray(e))for(r=0,o=e.length;r<o;r+=1)Ri(e[r],t,n);else for(i=Object.keys(e),r=0,o=i.length;r<o;r+=1)Ri(e[i[r]],t,n)}function Pf(e,t){t=t||{};var n=new bf(t);n.noRefs||jf(e,n);var i=e;return n.replacer&&(i=n.replacer.call({"":i},"",i)),tt(n,0,i,!0,!0)?n.dump+`
95
+ `:""}var Mf=Pf,Ff={dump:Mf};function Ui(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var Ko=jo.load,Mh=jo.loadAll,Qo=Ff.dump;var Fh=Ui("safeLoad","load"),Lh=Ui("safeLoadAll","loadAll"),Dh=Ui("safeDump","dump");import{writeFileSync as cd}from"fs";import{extname as Fs}from"path";import{readFileSync as fd}from"fs";import ud from"fs";b();function nt(){}nt.prototype={diff:function(t,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=i.callback;typeof i=="function"&&(r=i,i={}),this.options=i;var o=this;function s(w){return r?(setTimeout(function(){r(void 0,w)},0),!0):w}t=this.castInput(t),n=this.castInput(n),t=this.removeEmpty(this.tokenize(t)),n=this.removeEmpty(this.tokenize(n));var a=n.length,l=t.length,u=1,d=a+l,f=[{newPos:-1,components:[]}],p=this.extractCommon(f[0],n,t,0);if(f[0].newPos+1>=a&&p+1>=l)return s([{value:this.join(n),count:n.length}]);function g(){for(var w=-1*u;w<=u;w+=2){var m=void 0,j=f[w-1],_=f[w+1],q=(_?_.newPos:0)-w;j&&(f[w-1]=void 0);var G=j&&j.newPos+1<a,K=_&&0<=q&&q<l;if(!G&&!K){f[w]=void 0;continue}if(!G||K&&j.newPos<_.newPos?(m=Df(_),o.pushComponent(m.components,void 0,!0)):(m=j,m.newPos++,o.pushComponent(m.components,!0,void 0)),q=o.extractCommon(m,n,t,w),m.newPos+1>=a&&q+1>=l)return s(Lf(o,m.components,n,t,o.useLongestToken));f[w]=m}u++}if(r)(function w(){setTimeout(function(){if(u>d)return r();g()||w()},0)})();else for(;u<=d;){var C=g();if(C)return C}},pushComponent:function(t,n,i){var r=t[t.length-1];r&&r.added===n&&r.removed===i?t[t.length-1]={count:r.count+1,added:n,removed:i}:t.push({count:1,added:n,removed:i})},extractCommon:function(t,n,i,r){for(var o=n.length,s=i.length,a=t.newPos,l=a-r,u=0;a+1<o&&l+1<s&&this.equals(n[a+1],i[l+1]);)a++,l++,u++;return u&&t.components.push({count:u}),t.newPos=a,l},equals:function(t,n){return this.options.comparator?this.options.comparator(t,n):t===n||this.options.ignoreCase&&t.toLowerCase()===n.toLowerCase()},removeEmpty:function(t){for(var n=[],i=0;i<t.length;i++)t[i]&&n.push(t[i]);return n},castInput:function(t){return t},tokenize:function(t){return t.split("")},join:function(t){return t.join("")}};function Lf(e,t,n,i,r){for(var o=0,s=t.length,a=0,l=0;o<s;o++){var u=t[o];if(u.removed){if(u.value=e.join(i.slice(l,l+u.count)),l+=u.count,o&&t[o-1].added){var f=t[o-1];t[o-1]=t[o],t[o]=f}}else{if(!u.added&&r){var d=n.slice(a,a+u.count);d=d.map(function(g,C){var w=i[l+C];return w.length>g.length?w:g}),u.value=e.join(d)}else u.value=e.join(n.slice(a,a+u.count));a+=u.count,u.added||(l+=u.count)}}var p=t[s-1];return s>1&&typeof p.value=="string"&&(p.added||p.removed)&&e.equals("",p.value)&&(t[s-2].value+=p.value,t.pop()),t}function Df(e){return{newPos:e.newPos,components:e.components.slice(0)}}var Th=new nt;var Jo=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,Zo=/\S/,Xo=new nt;Xo.equals=function(e,t){return this.options.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e===t||this.options.ignoreWhitespace&&!Zo.test(e)&&!Zo.test(t)};Xo.tokenize=function(e){for(var t=e.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),n=0;n<t.length-1;n++)!t[n+1]&&t[n+2]&&Jo.test(t[n])&&Jo.test(t[n+2])&&(t[n]+=t[n+2],t.splice(n+1,2),n--);return t};var $i=new nt;$i.tokenize=function(e){var t=[],n=e.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(var i=0;i<n.length;i++){var r=n[i];i%2&&!this.options.newlineIsToken?t[t.length-1]+=r:(this.options.ignoreWhitespace&&(r=r.trim()),t.push(r))}return t};function Wi(e,t,n){return $i.diff(e,t,n)}var Nf=new nt;Nf.tokenize=function(e){return e.split(/(\S.+?[.!?])(?=\s+|$)/)};var Tf=new nt;Tf.tokenize=function(e){return e.split(/([{}:;,]|\s+)/)};function qn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?qn=function(t){return typeof t}:qn=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qn(e)}var Rf=Object.prototype.toString,on=new nt;on.useLongestToken=!0;on.tokenize=$i.tokenize;on.castInput=function(e){var t=this.options,n=t.undefinedReplacement,i=t.stringifyReplacer,r=i===void 0?function(o,s){return typeof s=="undefined"?n:s}:i;return typeof e=="string"?e:JSON.stringify(Hi(e,null,null,r),r," ")};on.equals=function(e,t){return nt.prototype.equals.call(on,e.replace(/,([\r\n])/g,"$1"),t.replace(/,([\r\n])/g,"$1"))};function es(e,t,n){return on.diff(e,t,n)}function Hi(e,t,n,i,r){t=t||[],n=n||[],i&&(e=i(r,e));var o;for(o=0;o<t.length;o+=1)if(t[o]===e)return n[o];var s;if(Rf.call(e)==="[object Array]"){for(t.push(e),s=new Array(e.length),n.push(s),o=0;o<e.length;o+=1)s[o]=Hi(e[o],t,n,i,r);return t.pop(),n.pop(),s}if(e&&e.toJSON&&(e=e.toJSON()),qn(e)==="object"&&e!==null){t.push(e),s={},n.push(s);var a=[],l;for(l in e)e.hasOwnProperty(l)&&a.push(l);for(a.sort(),o=0;o<a.length;o+=1)l=a[o],s[l]=Hi(e[l],t,n,i,l);t.pop(),n.pop()}else s=e;return s}var ki=new nt;ki.tokenize=function(e){return e.slice()};ki.join=ki.removeEmpty=function(e){return e};var Ns=pa(Ps(),1);import cn from"chalk";async function Ae({objects:e,selectIdentifier:t,selectDisplayName:n=t,onSyncComplete:i}){let r=e.reduce((a,l)=>{let u=t(l);if(a[u])throw new Error(`Identifier ${u} was not unique.`);return a[u]={id:u,object:l,providerId:u,displayName:n(l)},a},{});async function*o(){for(let a of Object.values(r))yield a}function s(){return Object.entries(r).sort((a,l)=>a[0].localeCompare(l[0])).map(a=>a[1].object)}return{objects:o(),deleteObject:async a=>{delete r[a]},writeObject:async a=>{let l=t(a.object);r[l]=a},extractCurrent:s,onSyncComplete:i?a=>i(a,s()):void 0}}function H(e){var t,n;return e.option("apiKey",{describe:"Uniform API key. Defaults to CANVAS_CLI_API_KEY or UNIFORM_API_KEY env. Supports dotenv.",default:(n=(t=process.env.CANVAS_CLI_API_KEY)!=null?t:process.env.UPM_CLI_API_KEY)!=null?n:process.env.UNIFORM_API_KEY,demandOption:!0,type:"string"}).option("apiHost",{describe:"Uniform host. Defaults to UNIFORM_CLI_BASE_URL env or https://uniform.app. Supports dotenv.",default:process.env.UNIFORM_CLI_BASE_URL||"https://uniform.app",demandOption:!0,type:"string"})}function k(e){var t,n,i;return e.option("project",{describe:"Uniform project ID. Defaults to UNIFORM_CLI_PROJECT_ID or UNIFORM_PROJECT_ID env. Supports dotenv.",default:(i=(n=(t=process.env.UNIFORM_CLI_PROJECT_ID)!=null?t:process.env.CANVAS_CLI_PROJECT_ID)!=null?n:process.env.UPM_CLI_PROJECT_ID)!=null?i:process.env.UNIFORM_PROJECT_ID,demandOption:!0,type:"string",alias:["p"]})}function we(e){return e.option("format",{alias:["f"],describe:"Output format",default:"yaml",choices:["yaml","json"],type:"string"}).option("filename",{alias:["o"],describe:"Output filename. If not specified, write to stdout.",type:"string"})}function xe(e){var t;return e.option("diff",{describe:"Whether to show diffs in stdout. off = no diffs; update = on for updates; on = updates, creates, deletes. Can be set by UNIFORM_CLI_DIFF_MODE environment variable.",default:(t=process.env.UNIFORM_CLI_DIFF_MODE)!=null?t:"off",type:"string",choices:["off","update","on"],alias:["d"]})}function Ce(e){let t=Fs(e);return t===".yaml"||t===".yml"||t===".json"}function he(e,t,n){let i;if(n&&!t){let r=Fs(n);r===".yaml"||r===".yml"?t="yaml":r===".json"&&(t="json")}else if(!t)throw new Error("Format must be specified when no filename is passed");switch(t){case"json":i=JSON.stringify(e,null,2);break;case"yaml":i=Qo(e);break;default:throw new Error(`Unsupported format: ${t}`)}n?cd(n,i,"utf8"):console.log(i)}function yt(e){let t=fd(e,"utf8");return Ko(t,{filename:e,json:!0})}async function Oe({directory:e,format:t="yaml",selectIdentifier:n,selectDisplayName:i=n}){rd(e)||od(e,{recursive:!0});let r=await sd(e,"utf-8"),o=new Set(r.filter(l=>{let u=ld(l);return u===".json"||u===".yaml"||u===".yml"})),s=l=>Ms(e,`${l}.${t}`);async function*a(){for(let l of o){let u=Ms(e,l);try{let d=await yt(u);yield{id:n(d),displayName:i(d),providerId:u,object:d}}catch(d){throw console.error(id.red(`Failed to read ${u}, data is likely invalid.
96
+ ${d==null?void 0:d.message}`)),d}}}return{objects:a(),deleteObject:async l=>{await ad(l)},writeObject:async l=>{he(l.object,t,s(l.id))}}}function Ls(e,t){if(!t&&!ud.existsSync(e))return{};let n=yt(e);if(typeof n!="object")throw new Error(`Package ${e} does not appear valid.`);return n}function Ds(e,t){he(t,void 0,e)}async function me({source:e,target:t,compareContents:n=(a,l)=>(0,Ns.default)(a.object,l.object,(u,d,f)=>f==="created"||f==="modified"?!0:void 0),mode:i,allowEmptySource:r=!1,whatIf:o=!1,log:s=()=>{}}){var a,l;let u=new Map;for await(let p of t.objects)u.set(p.id,p);let d=[],f=!1;for await(let p of e.objects){f=!0;let g=p.id,C=u.get(g);if(C){if(!n(p,C)&&(i==="createOrUpdate"||i==="mirror")){let w=async(m,j)=>{var _;o||await t.writeObject(m,j),s({action:"update",id:g,providerId:m.providerId,displayName:(_=m.displayName)!=null?_:m.providerId,whatIf:o,diff:es(j.object,m.object)})};d.push(w(p,C))}u.delete(g)}else{let w=async(m,j)=>{var _;o||await t.writeObject(m),s({action:"create",id:j,providerId:j,displayName:(_=m.displayName)!=null?_:m.providerId,whatIf:o,diff:Wi("",JSON.stringify(m.object,null,2))})};d.push(w(p,g))}}if(await Promise.all(d),i==="mirror"){if(!f&&!r)throw new Error("Source is empty and mode is mirror. This would cause deletion of everything in the target, and most likely indicates an error in source definition.");let p=[];u.forEach(async g=>{let C=async w=>{var m;o||await t.deleteObject(w.providerId),s({action:"delete",id:w.id,providerId:w.providerId,displayName:(m=w.displayName)!=null?m:w.providerId,whatIf:o,diff:Wi(JSON.stringify(w.object,null,2),"")})};p.push(C(g))}),await Promise.all(p)}await Promise.all([(a=e.onSyncComplete)==null?void 0:a.call(e,!1),(l=t.onSyncComplete)==null?void 0:l.call(t,!0)])}function ge(e){let{diffMode:t="off",indent:n,prefix:i}=e!=null?e:{};return function({action:r,displayName:o,whatIf:s,diff:a}){let l="";switch(r){case"create":l=cn.green("[A]");break;case"update":l=cn.white("[U]");break;case"delete":l=cn.yellow("[D]");break}let u="";(t==="on"||t==="update"&&r==="update")&&(u=`
97
+ `+a.map(d=>d.added?cn.green(d.value):d.removed?cn.red(d.value):d.value).join("")),console.log(`${n!=null?n:""}${s?cn.gray("[WHATIF]"):""}${l}${i!=null?i:""} ${o}${u}`)}}var Ts={command:"get <id>",describe:"Fetch an aggregate",builder:e=>we(H(k(e.positional("id",{demandOption:!0,describe:"Aggregate public ID to fetch"})))),handler:async({apiHost:e,apiKey:t,id:n,format:i,project:r,filename:o})=>{let a=await new De({apiKey:t,apiHost:e,fetch:dd,projectId:r}).get({aggregateId:n});a.aggregates.length===0?(console.error("Aggregate did not exist"),process.exit(1)):he(a.aggregates[0],i,o)}};b();import pd from"isomorphic-unfetch";var Rs={command:"list",describe:"List aggregates",aliases:["ls"],builder:e=>we(H(k(e))),handler:async({apiHost:e,apiKey:t,format:n,filename:i,project:r})=>{let s=await new De({apiKey:t,apiHost:e,fetch:pd,projectId:r}).get({});he(s.aggregates,n,i)}};b();import md from"isomorphic-unfetch";b();var bt=e=>e.id,At=e=>`${e.name} (pid: ${e.id})`;b();function _e(e,t){return Ls(e,t)}function wt(e,t){Ds(e,t)}b();import hd from"p-limit";var ve=hd(8);b();function ti({client:e,type:t}){async function*n(){let i=(await e.get({type:t})).aggregates;for await(let r of i)yield{id:bt(r),displayName:At(r),providerId:r.id,object:r}}return{objects:n(),deleteObject:async i=>{await e.remove({aggregateId:i})},writeObject:async i=>{await e.upsert({aggregate:i.object})}}}var Us={command:"pull <directory>",describe:"Pulls all aggregates to local files in a directory",builder:e=>H(k(xe(e.positional("directory",{describe:"Directory to save the aggregates to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",type:"string"}).option("format",{alias:["f"],describe:"Output format",default:"yaml",choices:["yaml","json"],type:"string"}).option("what-if",{alias:["w"],describe:"What-if mode reports what would be done but changes no files",default:!1,type:"boolean"}).option("mode",{alias:["m"],describe:'What kind of changes can be made. "create" = create new files, update nothing. "createOrUpdate" = create new files, update existing, delete nothing. "mirror" = create, update, and delete to mirror state',choices:["create","createOrUpdate","mirror"],default:"mirror",type:"string"})))),handler:async({apiHost:e,apiKey:t,directory:n,format:i,mode:r,whatIf:o,project:s,diff:a})=>{var p;let l=new De({apiKey:t,apiHost:e,fetch:md,projectId:s,limitPolicy:ve}),u=ti({client:l}),d;if(Ce(n)){let g=_e(n,!1);d=await Ae({objects:(p=g.aggregates)!=null?p:[],selectIdentifier:bt,selectDisplayName:At,onSyncComplete:async(C,w)=>{g.aggregates=w,wt(n,g)}})}else d=await Oe({directory:n,selectIdentifier:bt,selectDisplayName:At,format:i});await me({source:u,target:d,mode:r,whatIf:o,log:ge({diffMode:a})})}};b();import gd from"isomorphic-unfetch";var $s={command:"push <directory>",describe:"Pushes all aggregates from files in a directory or package to Uniform",builder:e=>H(k(xe(e.positional("directory",{describe:"Directory to read the aggregates from. If a filename is used, a package will be read instead.",type:"string"}).option("what-if",{alias:["w"],describe:"What-if mode reports what would be done but changes nothing",default:!1,type:"boolean"}).option("mode",{alias:["m"],describe:'What kind of changes can be made. "create" = create new, update nothing. "createOrUpdate" = create new, update existing, delete nothing. "mirror" = create, update, and delete',choices:["create","createOrUpdate","mirror"],default:"mirror",type:"string"})))),handler:async({apiHost:e,apiKey:t,directory:n,mode:i,whatIf:r,project:o,diff:s})=>{var f;let a=new De({apiKey:t,apiHost:e,fetch:gd,projectId:o,limitPolicy:ve}),l;if(Ce(n)){let p=_e(n,!0);l=await Ae({objects:(f=p.aggregates)!=null?f:[],selectIdentifier:bt,selectDisplayName:At})}else l=await Oe({directory:n,selectIdentifier:bt,selectDisplayName:At});let d=ti({client:a});await me({source:l,target:d,mode:i,whatIf:r,log:ge({diffMode:s})})}};b();import yd from"isomorphic-unfetch";var Ws={command:"remove <id>",aliases:["delete","rm"],describe:"Delete an aggregate",builder:e=>H(k(e.positional("id",{demandOption:!0,describe:"Aggregate public ID to delete"}))),handler:async({apiHost:e,apiKey:t,id:n,project:i})=>{await new De({apiKey:t,apiHost:e,fetch:yd,projectId:i}).remove({aggregateId:n})}};b();import bd from"isomorphic-unfetch";var Hs={command:"update <filename>",aliases:["put"],describe:"Insert or update an aggregate",builder:e=>H(k(e.positional("filename",{demandOption:!0,describe:"Aggregate file to put"}))),handler:async({apiHost:e,apiKey:t,filename:n,project:i})=>{let r=new De({apiKey:t,apiHost:e,fetch:bd,projectId:i}),o=yt(n);await r.upsert({aggregate:o})}};var ks={command:"aggregate <command>",aliases:["agg","intent","audience"],describe:"Commands for Context aggregates (intents, audiences)",builder:e=>e.command(Us).command($s).command(Ts).command(Ws).command(Rs).command(Hs).demandCommand(),handler:()=>{ke.help()}};b();b();import Ad from"isomorphic-unfetch";var Ys={command:"get <id>",describe:"Fetch an enrichment category and its values",builder:e=>we(H(k(e.positional("id",{demandOption:!0,describe:"Enrichment category public ID to fetch"})))),handler:async({apiHost:e,apiKey:t,id:n,format:i,project:r,filename:o})=>{var l,u;let a=(u=(l=await new Ve({apiKey:t,apiHost:e,fetch:Ad,projectId:r}).get())==null?void 0:l.enrichments)==null?void 0:u.filter(d=>d.id===n);a.length===0?(console.error("Enrichment did not exist"),process.exit(1)):he(a[0],i,o)}};b();import wd from"isomorphic-unfetch";var Bs={command:"list",describe:"List enrichments",aliases:["ls"],builder:e=>we(H(k(e))),handler:async({apiHost:e,apiKey:t,format:n,filename:i,project:r})=>{let s=await new Ve({apiKey:t,apiHost:e,fetch:wd,projectId:r}).get();he(s.enrichments,n,i)}};b();import xd from"isomorphic-unfetch";b();var xt=e=>e.id,Ct=e=>`${e.name} (pid: ${e.id})`;b();function ni({client:e}){async function*t(){let n=(await e.get()).enrichments;for await(let i of n)yield{id:xt(i),displayName:Ct(i),providerId:i.id,object:i}}return{objects:t(),deleteObject:async n=>{await e.removeCategory({enrichmentId:n})},writeObject:async(n,i)=>{var s,a;await e.upsertCategory({enrichment:n.object});let r=qs({categoryId:n.id,values:n.object.values}),o=qs({categoryId:n.id,values:(a=(s=i==null?void 0:i.object)==null?void 0:s.values)!=null?a:[],client:e});await me({source:r,target:o,mode:"mirror",whatIf:!1,log:ge({diffMode:"off",prefix:` ${n.displayName} value`,indent:"> "})})}}}var qs=({client:e,categoryId:t,values:n})=>({objects:async function*(){for(let r of n)yield{id:r.id,providerId:r.id,object:r,displayName:`${r.value} (pid: ${r.id})`}}(),deleteObject:async r=>{if(!e)throw new Error("Provider is read only");await e.removeValue({enrichmentId:t,enrichmentValueId:r})},writeObject:async r=>{if(!e)throw new Error("Provider is read only");await e.upsertValue({enrichmentId:t,enrichmentValue:r.object})}});var Gs={command:"pull <directory>",describe:"Pulls all enrichments to local files in a directory",builder:e=>H(k(xe(e.positional("directory",{describe:"Directory to save the enrichments to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",type:"string"}).option("format",{alias:["f"],describe:"Output format",default:"yaml",choices:["yaml","json"],type:"string"}).option("what-if",{alias:["w"],describe:"What-if mode reports what would be done but changes no files",default:!1,type:"boolean"}).option("mode",{alias:["m"],describe:'What kind of changes can be made. "create" = create new files, update nothing. "createOrUpdate" = create new files, update existing, delete nothing. "mirror" = create, update, and delete to mirror state',choices:["create","createOrUpdate","mirror"],default:"mirror",type:"string"})))),handler:async({apiHost:e,apiKey:t,directory:n,format:i,mode:r,whatIf:o,project:s,diff:a})=>{var p;let l=new Ve({apiKey:t,apiHost:e,fetch:xd,projectId:s,limitPolicy:ve}),u=ni({client:l}),d;if(Ce(n)){let g=_e(n,!1);d=await Ae({objects:(p=g.enrichments)!=null?p:[],selectIdentifier:xt,selectDisplayName:Ct,onSyncComplete:async(C,w)=>{g.enrichments=w,wt(n,g)}})}else d=await Oe({directory:n,selectIdentifier:xt,selectDisplayName:Ct,format:i});await me({source:u,target:d,mode:r,whatIf:o,log:ge({diffMode:a})})}};b();import Cd from"isomorphic-unfetch";var zs={command:"push <directory>",describe:"Pushes all enrichments from files in a directory or package to Uniform",builder:e=>H(k(xe(e.positional("directory",{describe:"Directory to read the enrichments from. If a filename is used, a package will be read instead.",type:"string"}).option("what-if",{alias:["w"],describe:"What-if mode reports what would be done but changes nothing",default:!1,type:"boolean"}).option("mode",{alias:["m"],describe:'What kind of changes can be made. "create" = create new, update nothing. "createOrUpdate" = create new, update existing, delete nothing. "mirror" = create, update, and delete',choices:["create","createOrUpdate","mirror"],default:"mirror",type:"string"})))),handler:async({apiHost:e,apiKey:t,directory:n,mode:i,whatIf:r,project:o,diff:s})=>{var f;let a=new Ve({apiKey:t,apiHost:e,fetch:Cd,projectId:o,limitPolicy:ve}),l;if(Ce(n)){let p=_e(n,!0);l=await Ae({objects:(f=p.enrichments)!=null?f:[],selectIdentifier:xt,selectDisplayName:Ct})}else l=await Oe({directory:n,selectIdentifier:xt,selectDisplayName:Ct});let d=ni({client:a});await me({source:l,target:d,mode:i,whatIf:r,log:ge({diffMode:s})})}};b();import Od from"isomorphic-unfetch";var Vs={command:"remove <id>",aliases:["delete","rm"],describe:"Delete an enrichment category and its values",builder:e=>H(k(e.positional("id",{demandOption:!0,describe:"Enrichment category public ID to delete"}))),handler:async({apiHost:e,apiKey:t,id:n,project:i})=>{await new Ve({apiKey:t,apiHost:e,fetch:Od,projectId:i}).removeCategory({enrichmentId:n})}};var Ks={command:"enrichment <command>",aliases:["enr"],describe:"Commands for Context enrichments",builder:e=>e.command(Gs).command(zs).command(Ys).command(Vs).command(Bs).demandCommand(),handler:()=>{ke.help()}};b();b();import ii from"chalk";import{writeFile as _d}from"fs";import vd from"isomorphic-unfetch";import{exit as nr}from"process";var Qs={command:"get [output]",aliases:["dl","download"],describe:"Download the Uniform Context manifest for a project",builder:e=>{var t,n,i;return e.option("apiKey",{alias:"k",demandOption:!0,string:!0,default:(t=process.env.UNIFORM_API_KEY)!=null?t:"",describe:"Uniform API key to use. Defaults to UNIFORM_API_KEY env if set."}).option("project",{describe:"Uniform project ID. Defaults to UCTX_CLI_PROJECT_ID or UNIFORM_PROJECT_ID env. Supports dotenv.",demandOption:!0,default:(i=(n=process.env.UCTX_CLI_PROJECT_ID)!=null?n:process.env.UNIFORM_PROJECT_ID)!=null?i:"",type:"string",alias:["p"]}).option("preview",{describe:"If set, fetches the unpublished preview manifest (The API key must have permission)",default:!1,type:"boolean",alias:["d"]}).option("output",{string:!0,alias:"o",default:process.env.UNIFORM_MANIFEST_PATH,describe:"Path to write manifest to. Defaults to UNIFORM_MANIFEST_PATH env if set."})},handler:async({apiKey:e,output:t,project:n,preview:i})=>{n||(console.error(ii.red("You must specify the project ID")),nr(1));let r=Ed(),o=new rr({apiHost:r,projectId:n,apiKey:e,fetch:vd});try{let s=await o.get({preview:i}),a=JSON.stringify(s,null,2);t?_d(t,a,l=>{l&&(console.error(`Error writing file to ${t}
98
+ `,l),nr(1)),console.log(ii.green(`\u2705 ${t} has been updated from ${r}`))}):console.log(a)}catch(s){let a;s instanceof ir?(s.statusCode===403&&(a=`The API key ${e} did not have permissions to fetch the manifest. Ensure ${i?"Context > Read Drafts":"Context > Manifest > Read"} permissions are granted.`),a=s.message):a=s.toString(),console.error(ii.red("\u26A0 Error fetching Context manifest")),console.error(ii.gray(` \u2757 ${a}`)),nr(1)}}},Ed=()=>process.env.UNIFORM_CLI_BASE_URL||"https://uniform.app";var Js={command:"manifest <command>",describe:"Commands for context manifests",aliases:["man"],builder:e=>e.command(Qs).demandCommand(),handler:()=>{ke.help()}};b();b();import Sd from"isomorphic-unfetch";var Zs={command:"get <id>",describe:"Fetch a quirk",builder:e=>we(H(k(e.positional("id",{demandOption:!0,describe:"Quirk public ID to fetch"})))),handler:async({apiHost:e,apiKey:t,id:n,format:i,project:r,filename:o})=>{let a=await new Ne({apiKey:t,apiHost:e,fetch:Sd,projectId:r}).get({quirkId:n,withIntegrations:!0});a.quirks.length===0?(console.error("Quirk did not exist"),process.exit(1)):he(a.quirks[0],i,o)}};b();import Id from"isomorphic-unfetch";var Xs={command:"list",describe:"List quirks",aliases:["ls"],builder:e=>we(H(k(e.option("withIntegrations",{alias:["i"],describe:"Whether to include meta-quirks created by integrations in the list. Defaults to false.",type:"boolean"})))),handler:async({apiHost:e,apiKey:t,format:n,filename:i,project:r,withIntegrations:o})=>{let a=await new Ne({apiKey:t,apiHost:e,fetch:Id,projectId:r}).get({withIntegrations:o});he(a.quirks,n,i)}};b();import jd from"isomorphic-unfetch";b();var Ot=e=>e.id,_t=e=>`${e.name} (pid: ${e.id})`;b();function ri({client:e}){async function*t(){let n=(await e.get({withIntegrations:!1})).quirks;for await(let i of n)yield{id:Ot(i),displayName:_t(i),providerId:i.id,object:i}}return{objects:t(),deleteObject:async n=>{await e.remove({quirkId:n})},writeObject:async n=>{await e.upsert({quirk:n.object})}}}var ea={command:"pull <directory>",describe:"Pulls all quirks to local files in a directory",builder:e=>H(k(xe(e.positional("directory",{describe:"Directory to save the quirks to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",type:"string"}).option("format",{alias:["f"],describe:"Output format",default:"yaml",choices:["yaml","json"],type:"string"}).option("what-if",{alias:["w"],describe:"What-if mode reports what would be done but changes no files",default:!1,type:"boolean"}).option("mode",{alias:["m"],describe:'What kind of changes can be made. "create" = create new files, update nothing. "createOrUpdate" = create new files, update existing, delete nothing. "mirror" = create, update, and delete to mirror state',choices:["create","createOrUpdate","mirror"],default:"mirror",type:"string"})))),handler:async({apiHost:e,apiKey:t,directory:n,format:i,mode:r,whatIf:o,project:s,diff:a})=>{var p;let l=new Ne({apiKey:t,apiHost:e,fetch:jd,projectId:s,limitPolicy:ve}),u=ri({client:l}),d;if(Ce(n)){let g=_e(n,!1);d=await Ae({objects:(p=g.quirks)!=null?p:[],selectIdentifier:Ot,selectDisplayName:_t,onSyncComplete:async(C,w)=>{g.quirks=w,wt(n,g)}})}else d=await Oe({directory:n,selectIdentifier:Ot,selectDisplayName:_t,format:i});await me({source:u,target:d,mode:r,whatIf:o,log:ge({diffMode:a})})}};b();import Pd from"isomorphic-unfetch";var ta={command:"push <directory>",describe:"Pushes all quirks from files in a directory or package to Uniform",builder:e=>H(k(xe(e.positional("directory",{describe:"Directory to read the quirks from. If a filename is used, a package will be read instead.",type:"string"}).option("what-if",{alias:["w"],describe:"What-if mode reports what would be done but changes nothing",default:!1,type:"boolean"}).option("mode",{alias:["m"],describe:'What kind of changes can be made. "create" = create new, update nothing. "createOrUpdate" = create new, update existing, delete nothing. "mirror" = create, update, and delete',choices:["create","createOrUpdate","mirror"],default:"mirror",type:"string"})))),handler:async({apiHost:e,apiKey:t,directory:n,mode:i,whatIf:r,project:o,diff:s})=>{var f;let a=new Ne({apiKey:t,apiHost:e,fetch:Pd,projectId:o,limitPolicy:ve}),l;if(Ce(n)){let p=_e(n,!0);l=await Ae({objects:(f=p.quirks)!=null?f:[],selectIdentifier:Ot,selectDisplayName:_t})}else l=await Oe({directory:n,selectIdentifier:Ot,selectDisplayName:_t});let d=ri({client:a});await me({source:l,target:d,mode:i,whatIf:r,log:ge({diffMode:s})})}};b();import Md from"isomorphic-unfetch";var na={command:"remove <id>",aliases:["delete","rm"],describe:"Delete a quirk",builder:e=>H(k(e.positional("id",{demandOption:!0,describe:"Quirk public ID to delete"}))),handler:async({apiHost:e,apiKey:t,id:n,project:i})=>{await new Ne({apiKey:t,apiHost:e,fetch:Md,projectId:i}).remove({quirkId:n})}};b();import Fd from"isomorphic-unfetch";var ia={command:"update <filename>",aliases:["put"],describe:"Insert or update a quirk",builder:e=>H(k(e.positional("filename",{demandOption:!0,describe:"Quirk file to put"}))),handler:async({apiHost:e,apiKey:t,filename:n,project:i})=>{let r=new Ne({apiKey:t,apiHost:e,fetch:Fd,projectId:i}),o=yt(n);await r.upsert({quirk:o})}};var ra={command:"quirk <command>",aliases:["qk"],describe:"Commands for Context quirks",builder:e=>e.command(ea).command(ta).command(Zs).command(na).command(Xs).command(ia).demandCommand(),handler:()=>{ke.help()}};b();b();import Ld from"isomorphic-unfetch";var oa={command:"get <id>",describe:"Fetch a signal",builder:e=>we(H(k(e.positional("id",{demandOption:!0,describe:"Signal public ID to fetch"})))),handler:async({apiHost:e,apiKey:t,id:n,format:i,project:r,filename:o})=>{let a=await new Te({apiKey:t,apiHost:e,fetch:Ld,projectId:r}).get({signalId:n});a.signals.length===0?(console.error("Signal did not exist"),process.exit(1)):he(a.signals[0],i,o)}};b();import Dd from"isomorphic-unfetch";var sa={command:"list",describe:"List signals",aliases:["ls"],builder:e=>we(H(k(e))),handler:async({apiHost:e,apiKey:t,format:n,filename:i,project:r})=>{let s=await new Te({apiKey:t,apiHost:e,fetch:Dd,projectId:r}).get();he(s.signals,n,i)}};b();import Nd from"isomorphic-unfetch";b();var vt=e=>e.id,Et=e=>`${e.name} (pid: ${e.id})`;b();function oi({client:e}){async function*t(){let n=(await e.get()).signals;for await(let i of n)yield{id:vt(i),displayName:Et(i),providerId:i.id,object:i}}return{objects:t(),deleteObject:async n=>{await e.remove({signalId:n})},writeObject:async n=>{await e.upsert({signal:n.object})}}}var aa={command:"pull <directory>",describe:"Pulls all signals to local files in a directory",builder:e=>H(k(xe(e.positional("directory",{describe:"Directory to save the signals to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",type:"string"}).option("format",{alias:["f"],describe:"Output format",default:"yaml",choices:["yaml","json"],type:"string"}).option("what-if",{alias:["w"],describe:"What-if mode reports what would be done but changes no files",default:!1,type:"boolean"}).option("mode",{alias:["m"],describe:'What kind of changes can be made. "create" = create new files, update nothing. "createOrUpdate" = create new files, update existing, delete nothing. "mirror" = create, update, and delete to mirror state',choices:["create","createOrUpdate","mirror"],default:"mirror",type:"string"})))),handler:async({apiHost:e,apiKey:t,directory:n,format:i,mode:r,whatIf:o,project:s,diff:a})=>{var p;let l=new Te({apiKey:t,apiHost:e,fetch:Nd,projectId:s,limitPolicy:ve}),u=oi({client:l}),d;if(Ce(n)){let g=_e(n,!1);d=await Ae({objects:(p=g.signals)!=null?p:[],selectIdentifier:vt,selectDisplayName:Et,onSyncComplete:async(C,w)=>{g.signals=w,wt(n,g)}})}else d=await Oe({directory:n,selectIdentifier:vt,selectDisplayName:Et,format:i});await me({source:u,target:d,mode:r,whatIf:o,log:ge({diffMode:a})})}};b();import Td from"isomorphic-unfetch";var la={command:"push <directory>",describe:"Pushes all signals from files in a directory or package to Uniform",builder:e=>H(k(xe(e.positional("directory",{describe:"Directory to read the signals from. If a filename is used, a package will be read instead.",type:"string"}).option("what-if",{alias:["w"],describe:"What-if mode reports what would be done but changes nothing",default:!1,type:"boolean"}).option("mode",{alias:["m"],describe:'What kind of changes can be made. "create" = create new, update nothing. "createOrUpdate" = create new, update existing, delete nothing. "mirror" = create, update, and delete',choices:["create","createOrUpdate","mirror"],default:"mirror",type:"string"})))),handler:async({apiHost:e,apiKey:t,directory:n,mode:i,whatIf:r,project:o,diff:s})=>{var f;let a=new Te({apiKey:t,apiHost:e,fetch:Td,projectId:o,limitPolicy:ve}),l;if(Ce(n)){let p=_e(n,!0);l=await Ae({objects:(f=p.signals)!=null?f:[],selectIdentifier:vt,selectDisplayName:Et})}else l=await Oe({directory:n,selectIdentifier:vt,selectDisplayName:Et});let d=oi({client:a});await me({source:l,target:d,mode:i,whatIf:r,log:ge({diffMode:s})})}};b();import Rd from"isomorphic-unfetch";var ca={command:"remove <id>",aliases:["delete","rm"],describe:"Delete a signal",builder:e=>H(k(e.positional("id",{demandOption:!0,describe:"Signal public ID to delete"}))),handler:async({apiHost:e,apiKey:t,id:n,project:i})=>{await new Te({apiKey:t,apiHost:e,fetch:Rd,projectId:i}).remove({signalId:n})}};b();import Ud from"isomorphic-unfetch";var fa={command:"update <filename>",aliases:["put"],describe:"Insert or update a signal",builder:e=>H(k(e.positional("filename",{demandOption:!0,describe:"Signal file to put"}))),handler:async({apiHost:e,apiKey:t,filename:n,project:i})=>{let r=new Te({apiKey:t,apiHost:e,fetch:Ud,projectId:i}),o=yt(n);await r.upsert({signal:o})}};var ua={command:"signal <command>",aliases:["sig"],describe:"Commands for Context signals",builder:e=>e.command(aa).command(la).command(oa).command(ca).command(sa).command(fa).demandCommand(),handler:()=>{ke.help()}};var qb={commands:[{command:"context <command>",aliases:["ctx"],describe:"Uniform Context commands",builder:e=>e.command(Js).command(ua).command(Ks).command(ks).command(ra).demandCommand(),handler:()=>{ke.showHelp()}}]};export{qb as uniformCLI};
99
+ /*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */
66
100
  /**
67
101
  * @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
68
102
  * CJS and ESM environments.