@uniformdev/canvas 12.2.1-alpha.171 → 12.2.1-alpha.184
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.js +35 -34
- package/dist/cli/cli.mjs +34 -33
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +7 -7
package/dist/cli/cli.mjs
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
import{a as De,b as
|
1
|
+
import{a as De,b as Bs,c as zs,d as x,h as X,q as Gs,r as Qi}from"../chunk-BU3NFPPR.mjs";var vs=Bs((dn,Xt)=>{x();var gc=200,Vi="__lodash_hash_undefined__",rs=1,Gn=2,os=9007199254740991,Hn="[object Arguments]",Hi="[object Array]",ss="[object Boolean]",as="[object Date]",ls="[object Error]",fs="[object Function]",yc="[object GeneratorFunction]",Wn="[object Map]",cs="[object Number]",Zt="[object Object]",Vo="[object Promise]",us="[object RegExp]",Yn="[object Set]",ps="[object String]",bc="[object Symbol]",Wi="[object WeakMap]",ds="[object ArrayBuffer]",Bn="[object DataView]",wc="[object Float32Array]",Ac="[object Float64Array]",Cc="[object Int8Array]",xc="[object Int16Array]",vc="[object Int32Array]",_c="[object Uint8Array]",Oc="[object Uint8ClampedArray]",Sc="[object Uint16Array]",Ec="[object Uint32Array]",Ic=/[\\^$.*+?()[\]{}|]/g,jc=/^\[object .+?Constructor\]$/,Pc=/^(?:0|[1-9]\d*)$/,Q={};Q[wc]=Q[Ac]=Q[Cc]=Q[xc]=Q[vc]=Q[_c]=Q[Oc]=Q[Sc]=Q[Ec]=!0;Q[Hn]=Q[Hi]=Q[ds]=Q[ss]=Q[Bn]=Q[as]=Q[ls]=Q[fs]=Q[Wn]=Q[cs]=Q[Zt]=Q[us]=Q[Yn]=Q[ps]=Q[Wi]=!1;var hs=typeof global=="object"&&global&&global.Object===Object&&global,Fc=typeof self=="object"&&self&&self.Object===Object&&self,rt=hs||Fc||Function("return this")(),ms=typeof dn=="object"&&dn&&!dn.nodeType&&dn,ko=ms&&typeof Xt=="object"&&Xt&&!Xt.nodeType&&Xt,Lc=ko&&ko.exports===ms,Jo=Lc&&hs.process,Qo=function(){try{return Jo&&Jo.binding("util")}catch(e){}}(),Zo=Qo&&Qo.isTypedArray;function Mc(e,t){for(var n=-1,i=e?e.length:0;++n<i;)if(t(e[n],n,e))return!0;return!1}function Dc(e,t){for(var n=-1,i=Array(e);++n<e;)i[n]=t(n);return i}function Nc(e){return function(t){return e(t)}}function Tc(e,t){return e==null?void 0:e[t]}function Yi(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(n){}return t}function Rc(e){var t=-1,n=Array(e.size);return e.forEach(function(i,r){n[++t]=[r,i]}),n}function $c(e,t){return function(n){return e(t(n))}}function Uc(e){var t=-1,n=Array(e.size);return e.forEach(function(i){n[++t]=i}),n}var Hc=Array.prototype,Wc=Function.prototype,qn=Object.prototype,$i=rt["__core-js_shared__"],Xo=function(){var e=/[^.]+$/.exec($i&&$i.keys&&$i.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),gs=Wc.toString,Ge=qn.hasOwnProperty,gn=qn.toString,Yc=RegExp("^"+gs.call(Ge).replace(Ic,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),es=rt.Symbol,ts=rt.Uint8Array,Bc=qn.propertyIsEnumerable,zc=Hc.splice,Gc=$c(Object.keys,Object),Bi=en(rt,"DataView"),hn=en(rt,"Map"),zi=en(rt,"Promise"),Gi=en(rt,"Set"),qi=en(rt,"WeakMap"),mn=en(Object,"create"),qc=Ut(Bi),Kc=Ut(hn),Vc=Ut(zi),kc=Ut(Gi),Jc=Ut(qi),ns=es?es.prototype:void 0,Ui=ns?ns.valueOf:void 0;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 Qc(){this.__data__=mn?mn(null):{}}function Zc(e){return this.has(e)&&delete this.__data__[e]}function Xc(e){var t=this.__data__;if(mn){var n=t[e];return n===Vi?void 0:n}return Ge.call(t,e)?t[e]:void 0}function eu(e){var t=this.__data__;return mn?t[e]!==void 0:Ge.call(t,e)}function tu(e,t){var n=this.__data__;return n[e]=mn&&t===void 0?Vi:t,this}Rt.prototype.clear=Qc;Rt.prototype.delete=Zc;Rt.prototype.get=Xc;Rt.prototype.has=eu;Rt.prototype.set=tu;function qe(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 nu(){this.__data__=[]}function iu(e){var t=this.__data__,n=Kn(t,e);if(n<0)return!1;var i=t.length-1;return n==i?t.pop():zc.call(t,n,1),!0}function ru(e){var t=this.__data__,n=Kn(t,e);return n<0?void 0:t[n][1]}function ou(e){return Kn(this.__data__,e)>-1}function su(e,t){var n=this.__data__,i=Kn(n,e);return i<0?n.push([e,t]):n[i][1]=t,this}qe.prototype.clear=nu;qe.prototype.delete=iu;qe.prototype.get=ru;qe.prototype.has=ou;qe.prototype.set=su;function $t(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__={hash:new Rt,map:new(hn||qe),string:new Rt}}function lu(e){return Vn(this,e).delete(e)}function fu(e){return Vn(this,e).get(e)}function cu(e){return Vn(this,e).has(e)}function uu(e,t){return Vn(this,e).set(e,t),this}$t.prototype.clear=au;$t.prototype.delete=lu;$t.prototype.get=fu;$t.prototype.has=cu;$t.prototype.set=uu;function zn(e){var t=-1,n=e?e.length:0;for(this.__data__=new $t;++t<n;)this.add(e[t])}function pu(e){return this.__data__.set(e,Vi),this}function du(e){return this.__data__.has(e)}zn.prototype.add=zn.prototype.push=pu;zn.prototype.has=du;function it(e){this.__data__=new qe(e)}function hu(){this.__data__=new qe}function mu(e){return this.__data__.delete(e)}function gu(e){return this.__data__.get(e)}function yu(e){return this.__data__.has(e)}function bu(e,t){var n=this.__data__;if(n instanceof qe){var i=n.__data__;if(!hn||i.length<gc-1)return i.push([e,t]),this;n=this.__data__=new $t(i)}return n.set(e,t),this}it.prototype.clear=hu;it.prototype.delete=mu;it.prototype.get=gu;it.prototype.has=yu;it.prototype.set=bu;function wu(e,t){var n=Ki(e)||Fu(e)?Dc(e.length,String):[],i=n.length,r=!!i;for(var o in e)(t||Ge.call(e,o))&&!(r&&(o=="length"||Eu(o,i)))&&n.push(o);return n}function Kn(e,t){for(var n=e.length;n--;)if(ws(e[n][0],t))return n;return-1}function Au(e){return gn.call(e)}function ys(e,t,n,i,r){return e===t?!0:e==null||t==null||!ki(e)&&!Ji(t)?e!==e&&t!==t:Cu(e,t,ys,n,i,r)}function Cu(e,t,n,i,r,o){var s=Ki(e),a=Ki(t),l=Hi,u=Hi;s||(l=nt(e),l=l==Hn?Zt:l),a||(u=nt(t),u=u==Hn?Zt:u);var p=l==Zt&&!Yi(e),c=u==Zt&&!Yi(t),d=l==u;if(d&&!p)return o||(o=new it),s||Du(e)?bs(e,t,n,i,r,o):Ou(e,t,l,n,i,r,o);if(!(r&Gn)){var g=p&&Ge.call(e,"__wrapped__"),A=c&&Ge.call(t,"__wrapped__");if(g||A){var w=g?e.value():e,m=A?t.value():t;return o||(o=new it),n(w,m,i,r,o)}}return d?(o||(o=new it),Su(e,t,n,i,r,o)):!1}function xu(e){if(!ki(e)||ju(e))return!1;var t=Cs(e)||Yi(e)?Yc:jc;return t.test(Ut(e))}function vu(e){return Ji(e)&&xs(e.length)&&!!Q[gn.call(e)]}function _u(e){if(!Pu(e))return Gc(e);var t=[];for(var n in Object(e))Ge.call(e,n)&&n!="constructor"&&t.push(n);return t}function bs(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 p=-1,c=!0,d=r&rs?new zn:void 0;for(o.set(e,t),o.set(t,e);++p<a;){var g=e[p],A=t[p];if(i)var w=s?i(A,g,p,t,e,o):i(g,A,p,e,t,o);if(w!==void 0){if(w)continue;c=!1;break}if(d){if(!Mc(t,function(m,S){if(!d.has(S)&&(g===m||n(g,m,i,r,o)))return d.add(S)})){c=!1;break}}else if(!(g===A||n(g,A,i,r,o))){c=!1;break}}return o.delete(e),o.delete(t),c}function Ou(e,t,n,i,r,o,s){switch(n){case Bn:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case ds:return!(e.byteLength!=t.byteLength||!i(new ts(e),new ts(t)));case ss:case as:case cs:return ws(+e,+t);case ls:return e.name==t.name&&e.message==t.message;case us:case ps:return e==t+"";case Wn:var a=Rc;case Yn:var l=o&Gn;if(a||(a=Uc),e.size!=t.size&&!l)return!1;var u=s.get(e);if(u)return u==t;o|=rs,s.set(e,t);var p=bs(a(e),a(t),i,r,o,s);return s.delete(e),p;case bc:if(Ui)return Ui.call(e)==Ui.call(t)}return!1}function Su(e,t,n,i,r,o){var s=r&Gn,a=is(e),l=a.length,u=is(t),p=u.length;if(l!=p&&!s)return!1;for(var c=l;c--;){var d=a[c];if(!(s?d in t:Ge.call(t,d)))return!1}var g=o.get(e);if(g&&o.get(t))return g==t;var A=!0;o.set(e,t),o.set(t,e);for(var w=s;++c<l;){d=a[c];var m=e[d],S=t[d];if(i)var _=s?i(S,m,d,t,e,o):i(m,S,d,e,t,o);if(!(_===void 0?m===S||n(m,S,i,r,o):_)){A=!1;break}w||(w=d=="constructor")}if(A&&!w){var B=e.constructor,z=t.constructor;B!=z&&"constructor"in e&&"constructor"in t&&!(typeof B=="function"&&B instanceof B&&typeof z=="function"&&z instanceof z)&&(A=!1)}return o.delete(e),o.delete(t),A}function Vn(e,t){var n=e.__data__;return Iu(t)?n[typeof t=="string"?"string":"hash"]:n.map}function en(e,t){var n=Tc(e,t);return xu(n)?n:void 0}var nt=Au;(Bi&&nt(new Bi(new ArrayBuffer(1)))!=Bn||hn&&nt(new hn)!=Wn||zi&&nt(zi.resolve())!=Vo||Gi&&nt(new Gi)!=Yn||qi&&nt(new qi)!=Wi)&&(nt=function(e){var t=gn.call(e),n=t==Zt?e.constructor:void 0,i=n?Ut(n):void 0;if(i)switch(i){case qc:return Bn;case Kc:return Wn;case Vc:return Vo;case kc:return Yn;case Jc:return Wi}return t});function Eu(e,t){return t=t==null?os:t,!!t&&(typeof e=="number"||Pc.test(e))&&e>-1&&e%1==0&&e<t}function Iu(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function ju(e){return!!Xo&&Xo in e}function Pu(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||qn;return e===n}function Ut(e){if(e!=null){try{return gs.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function ws(e,t){return e===t||e!==e&&t!==t}function Fu(e){return Lu(e)&&Ge.call(e,"callee")&&(!Bc.call(e,"callee")||gn.call(e)==Hn)}var Ki=Array.isArray;function As(e){return e!=null&&xs(e.length)&&!Cs(e)}function Lu(e){return Ji(e)&&As(e)}function Mu(e,t,n){n=typeof n=="function"?n:void 0;var i=n?n(e,t):void 0;return i===void 0?ys(e,t,n):!!i}function Cs(e){var t=ki(e)?gn.call(e):"";return t==fs||t==yc}function xs(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=os}function ki(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Ji(e){return!!e&&typeof e=="object"}var Du=Zo?Nc(Zo):vu;function is(e){return As(e)?wu(e):_u(e)}Xt.exports=Mu});x();x();x();import{notStrictEqual as ya,strictEqual as ba}from"assert";x();x();var qs={right:Qs,center:Zs},Ks=0,bn=1,Vs=2,wn=3,Xi=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
2
|
`).map(r=>r.split(" ")),i=0;return n.forEach(r=>{r.length>1&&Ce.stringWidth(r[0])>i&&(i=Math.min(Math.floor(this.width*.5),Ce.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=Ce.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]),p=s;u>Ce.stringWidth(s)&&(p+=" ".repeat(u-Ce.stringWidth(s))),t[a].align&&t[a].align!=="left"&&this.wrap&&(p=
|
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]),p=s;u>Ce.stringWidth(s)&&(p+=" ".repeat(u-Ce.stringWidth(s))),t[a].align&&t[a].align!=="left"&&this.wrap&&(p=qs[t[a].align](p,u),Ce.stringWidth(p)<u&&(p+=" ".repeat((l||0)-Ce.stringWidth(p)-1)));let c=t[a].padding||[0,0,0,0];c[wn]&&(o+=" ".repeat(c[wn])),o+=Zi(t[a],p,"| "),o+=p,o+=Zi(t[a],p," |"),c[bn]&&(o+=" ".repeat(c[bn])),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=Ce.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=Ce.wrap(o.text,this.negatePadding(o),{hard:!0}).split(`
|
4
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[
|
6
|
-
`),r+=e.charAt(o);return n&&i&&(r=`${n}${r}${i}`),r}function ni(e){return Xi(e,{stringWidth:t=>[...t].length,stripAnsi:ti,wrap:tr})}x();import{dirname as nr,resolve as ir}from"path";import{readdirSync as Zs,statSync as Xs}from"fs";function rr(e,t){let n=ir(".",e),i;for(Xs(n).isDirectory()||(n=nr(n));;){if(i=t(n,Zs(n)),i)return ir(n,i);if(n=nr(i=n),i===n)break}}import{inspect as ya}from"util";import{readFileSync as wa}from"fs";import{fileURLToPath as Aa}from"url";x();import{format as na}from"util";import{normalize as ia,resolve as ra}from"path";x();function xt(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 An(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 Cn(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)}x();x();function or(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}x();var Oe;(function(e){e.BOOLEAN="boolean",e.STRING="string",e.NUMBER="number",e.ARRAY="array"})(Oe||(Oe={}));var Ye,ri=class{constructor(t){Ye=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=or(t),o=typeof t=="string",s=ea(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||[],p=i.envPrefix,c=a["populate--"],d=c?"--":"_",g=Object.create(null),A=Object.create(null),w=i.__||Ye.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:[]},E=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,_=new RegExp("^--"+a["negation-prefix"]+"(.+)");[].concat(i.array||[]).filter(Boolean).forEach(function(h){let y=typeof h=="object"?h.key:h,v=Object.keys(h).map(function(C){return{boolean:"bools",string:"strings",number:"numbers"}[C]}).filter(Boolean).pop();v&&(m[v][y]=!0),m.arrays[y]=!0,m.keys.push(y)}),[].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,y])=>{typeof y=="number"&&(m.nargs[h]=y,m.keys.push(h))}),typeof i.coerce=="object"&&Object.entries(i.coerce).forEach(([h,y])=>{typeof y=="function"&&(m.coercions[h]=y,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,y])=>{(typeof y=="boolean"||typeof y=="function")&&(m.configs[h]=y)})),Ct(i.key,s,i.default,m.arrays),Object.keys(l).forEach(function(h){(m.aliases[h]||[]).forEach(function(y){l[y]=l[h]})});let B=null;bn();let z=[],K=Object.assign(Object.create(null),{_:[]}),Ke={};for(let h=0;h<r.length;h++){let y=r[h],v=y.replace(/^-{3,}/,"---"),C,b,P,S,D,de;if(y!=="--"&&re(y))Pe(y);else if(v.match(/---+(=|$)/)){Pe(y);continue}else if(y.match(/^--.+=/)||!a["short-option-groups"]&&y.match(/^-.+=/))S=y.match(/^--?([^=]+)=([\s\S]*)$/),S!==null&&Array.isArray(S)&&S.length>=3&&(U(S[1],m.arrays)?h=wt(h,S[1],r,S[2]):U(S[1],m.nargs)!==!1?h=Ht(h,S[1],r,S[2]):V(S[1],S[2],!0));else if(y.match(_)&&a["boolean-negation"])S=y.match(_),S!==null&&Array.isArray(S)&&S.length>=2&&(b=S[1],V(b,U(b,m.arrays)?[!1]:!1));else if(y.match(/^--.+/)||!a["short-option-groups"]&&y.match(/^-[^-]+/))S=y.match(/^--?(.+)/),S!==null&&Array.isArray(S)&&S.length>=2&&(b=S[1],U(b,m.arrays)?h=wt(h,b,r):U(b,m.nargs)!==!1?h=Ht(h,b,r):(D=r[h+1],D!==void 0&&(!D.match(/^-/)||D.match(E))&&!U(b,m.bools)&&!U(b,m.counts)||/^(true|false)$/.test(D)?(V(b,D),h++):V(b,oe(b))));else if(y.match(/^-.\..+=/))S=y.match(/^-([^=]+)=([\s\S]*)$/),S!==null&&Array.isArray(S)&&S.length>=3&&V(S[1],S[2]);else if(y.match(/^-.\..+/)&&!y.match(E))D=r[h+1],S=y.match(/^-(.\..+)/),S!==null&&Array.isArray(S)&&S.length>=2&&(b=S[1],D!==void 0&&!D.match(/^-/)&&!U(b,m.bools)&&!U(b,m.counts)?(V(b,D),h++):V(b,oe(b)));else if(y.match(/^-[^-]+/)&&!y.match(E)){P=y.slice(1,-1).split(""),C=!1;for(let be=0;be<P.length;be++){if(D=y.slice(be+2),P[be+1]&&P[be+1]==="="){de=y.slice(be+3),b=P[be],U(b,m.arrays)?h=wt(h,b,r,de):U(b,m.nargs)!==!1?h=Ht(h,b,r,de):V(b,de),C=!0;break}if(D==="-"){V(P[be],D);continue}if(/[A-Za-z]/.test(P[be])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(D)&&U(D,m.bools)===!1){V(P[be],D),C=!0;break}if(P[be+1]&&P[be+1].match(/\W/)){V(P[be],D),C=!0;break}else V(P[be],oe(P[be]))}b=y.slice(-1)[0],!C&&b!=="-"&&(U(b,m.arrays)?h=wt(h,b,r):U(b,m.nargs)!==!1?h=Ht(h,b,r):(D=r[h+1],D!==void 0&&(!/^(-|--)[^-]/.test(D)||D.match(E))&&!U(b,m.bools)&&!U(b,m.counts)||/^(true|false)$/.test(D)?(V(b,D),h++):V(b,oe(b))))}else if(y.match(/^-[0-9]$/)&&y.match(E)&&U(y.slice(1),m.bools))b=y.slice(1),V(b,oe(b));else if(y==="--"){z=r.slice(h+1);break}else if(a["halt-at-non-option"]){z=r.slice(h);break}else Pe(y)}q(K,!0),q(K,!1),W(K),ae(),ie(K,m.aliases,l,!0),ue(K),a["set-placeholder-key"]&&At(K),Object.keys(m.counts).forEach(function(h){He(K,h.split("."))||V(h,0)}),c&&z.length&&(K[d]=[]),z.forEach(function(h){K[d].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(y=>xt(y)).join(".")],delete K[h]});function Pe(h){let y=R("_",h);(typeof y=="string"||typeof y=="number")&&K._.push(y)}function Ht(h,y,v,C){let b,P=U(y,m.nargs);if(P=typeof P!="number"||isNaN(P)?1:P,P===0)return Le(C)||(B=Error(w("Argument unexpected for: %s",y))),V(y,oe(y)),h;let S=Le(C)?0:1;if(a["nargs-eats-options"])v.length-(h+1)+S<P&&(B=Error(w("Not enough arguments following: %s",y))),S=P;else{for(b=h+1;b<v.length&&(!v[b].match(/^-[^0-9]/)||v[b].match(E)||re(v[b]));b++)S++;S<P&&(B=Error(w("Not enough arguments following: %s",y)))}let D=Math.min(S,P);for(!Le(C)&&D>0&&(V(y,C),D--),b=h+1;b<D+h+1;b++)V(y,v[b]);return h+D}function wt(h,y,v,C){let b=[],P=C||v[h+1],S=U(y,m.nargs);if(U(y,m.bools)&&!/^(true|false)$/.test(P))b.push(!0);else if(Le(P)||Le(C)&&/^-/.test(P)&&!E.test(P)&&!re(P)){if(l[y]!==void 0){let D=l[y];b=Array.isArray(D)?D:[D]}}else{Le(C)||b.push(O(y,C,!0));for(let D=h+1;D<v.length&&!(!a["greedy-arrays"]&&b.length>0||S&&typeof S=="number"&&b.length>=S||(P=v[D],/^-/.test(P)&&!E.test(P)&&!re(P)));D++)h=D,b.push(O(y,P,o))}return typeof S=="number"&&(S&&b.length<S||isNaN(S)&&b.length===0)&&(B=Error(w("Not enough arguments following: %s",y))),V(y,b),h}function V(h,y,v=o){if(/-/.test(h)&&a["camel-case-expansion"]){let P=h.split(".").map(function(S){return xt(S)}).join(".");F(h,P)}let C=O(h,y,v),b=h.split(".");We(K,b,C),m.aliases[h]&&m.aliases[h].forEach(function(P){let S=P.split(".");We(K,S,C)}),b.length>1&&a["dot-notation"]&&(m.aliases[b[0]]||[]).forEach(function(P){let S=P.split("."),D=[].concat(b);D.shift(),S=S.concat(D),(m.aliases[h]||[]).includes(S.join("."))||We(K,S,C)}),U(h,m.normalize)&&!U(h,m.arrays)&&[h].concat(m.aliases[h]||[]).forEach(function(S){Object.defineProperty(Ke,S,{enumerable:!0,get(){return y},set(D){y=typeof D=="string"?Ye.normalize(D):D}})})}function F(h,y){m.aliases[h]&&m.aliases[h].length||(m.aliases[h]=[y],g[y]=!0),m.aliases[y]&&m.aliases[y].length||F(y,h)}function O(h,y,v){v&&(y=ta(y)),(U(h,m.bools)||U(h,m.counts))&&typeof y=="string"&&(y=y==="true");let C=Array.isArray(y)?y.map(function(b){return R(h,b)}):R(h,y);return U(h,m.counts)&&(Le(C)||typeof C=="boolean")&&(C=ii()),U(h,m.normalize)&&U(h,m.arrays)&&(Array.isArray(y)?C=y.map(b=>Ye.normalize(b)):C=Ye.normalize(y)),C}function R(h,y){return!a["parse-positional-numbers"]&&h==="_"||!U(h,m.strings)&&!U(h,m.bools)&&!Array.isArray(y)&&(Cn(y)&&a["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${y}`)))||!Le(y)&&U(h,m.numbers))&&(y=Number(y)),y}function W(h){let y=Object.create(null);ie(y,m.aliases,l),Object.keys(m.configs).forEach(function(v){let C=h[v]||y[v];if(C)try{let b=null,P=Ye.resolve(Ye.cwd(),C),S=m.configs[v];if(typeof S=="function"){try{b=S(P)}catch(D){b=D}if(b instanceof Error){B=b;return}}else b=Ye.require(P);k(b)}catch(b){b.name==="PermissionDenied"?B=b:h[v]&&(B=Error(w("Invalid JSON config file: %s",C)))}})}function k(h,y){Object.keys(h).forEach(function(v){let C=h[v],b=y?y+"."+v:v;typeof C=="object"&&C!==null&&!Array.isArray(C)&&a["dot-notation"]?k(C,b):(!He(K,b.split("."))||U(b,m.arrays)&&a["combine-arrays"])&&V(b,C)})}function ae(){typeof u!="undefined"&&u.forEach(function(h){k(h)})}function q(h,y){if(typeof p=="undefined")return;let v=typeof p=="string"?p:"",C=Ye.env();Object.keys(C).forEach(function(b){if(v===""||b.lastIndexOf(v,0)===0){let P=b.split("__").map(function(S,D){return D===0&&(S=S.substring(v.length)),xt(S)});(y&&m.configs[P.join(".")]||!y)&&!He(h,P)&&V(P.join("."),C[b])}})}function ue(h){let y,v=new Set;Object.keys(h).forEach(function(C){if(!v.has(C)&&(y=U(C,m.coercions),typeof y=="function"))try{let b=R(C,y(h[C]));[].concat(m.aliases[C]||[],C).forEach(P=>{v.add(P),h[P]=b})}catch(b){B=b}})}function At(h){return m.keys.forEach(y=>{~y.indexOf(".")||typeof h[y]=="undefined"&&(h[y]=void 0)}),h}function ie(h,y,v,C=!1){Object.keys(v).forEach(function(b){He(h,b.split("."))||(We(h,b.split("."),v[b]),C&&(A[b]=!0),(y[b]||[]).forEach(function(P){He(h,P.split("."))||We(h,P.split("."),v[b])}))})}function He(h,y){let v=h;a["dot-notation"]||(y=[y.join(".")]),y.slice(0,-1).forEach(function(b){v=v[b]||{}});let C=y[y.length-1];return typeof v!="object"?!1:C in v}function We(h,y,v){let C=h;a["dot-notation"]||(y=[y.join(".")]),y.slice(0,-1).forEach(function(de){de=sr(de),typeof C=="object"&&C[de]===void 0&&(C[de]={}),typeof C[de]!="object"||Array.isArray(C[de])?(Array.isArray(C[de])?C[de].push({}):C[de]=[C[de],{}],C=C[de][C[de].length-1]):C=C[de]});let b=sr(y[y.length-1]),P=U(y.join("."),m.arrays),S=Array.isArray(v),D=a["duplicate-arguments-array"];!D&&U(b,m.nargs)&&(D=!0,(!Le(C[b])&&m.nargs[b]===1||Array.isArray(C[b])&&C[b].length===m.nargs[b])&&(C[b]=void 0)),v===ii()?C[b]=ii(C[b]):Array.isArray(C[b])?D&&P&&S?C[b]=a["flatten-duplicate-arrays"]?C[b].concat(v):(Array.isArray(C[b][0])?C[b]:[C[b]]).concat([v]):!D&&Boolean(P)===Boolean(S)?C[b]=v:C[b]=C[b].concat([v]):C[b]===void 0&&P?C[b]=S?v:[v]:D&&!(C[b]===void 0||U(b,m.counts)||U(b,m.bools))?C[b]=[C[b],v]:C[b]=v}function Ct(...h){h.forEach(function(y){Object.keys(y||{}).forEach(function(v){m.aliases[v]||(m.aliases[v]=[].concat(s[v]||[]),m.aliases[v].concat(v).forEach(function(C){if(/-/.test(C)&&a["camel-case-expansion"]){let b=xt(C);b!==v&&m.aliases[v].indexOf(b)===-1&&(m.aliases[v].push(b),g[b]=!0)}}),m.aliases[v].concat(v).forEach(function(C){if(C.length>1&&/[A-Z]/.test(C)&&a["camel-case-expansion"]){let b=An(C,"-");b!==v&&m.aliases[v].indexOf(b)===-1&&(m.aliases[v].push(b),g[b]=!0)}}),m.aliases[v].forEach(function(C){m.aliases[C]=[v].concat(m.aliases[v].filter(function(b){return C!==b}))}))})})}function U(h,y){let v=[].concat(m.aliases[h]||[],h),C=Object.keys(y),b=v.find(P=>C.includes(P));return b?y[b]:!1}function ei(h){let y=Object.keys(m);return[].concat(y.map(C=>m[C])).some(function(C){return Array.isArray(C)?C.includes(h):C[h]})}function $(h,...y){return[].concat(...y).some(function(C){let b=h.match(C);return b&&ei(b[1])})}function Z(h){if(h.match(E)||!h.match(/^-[^-]+/))return!1;let y=!0,v,C=h.slice(1).split("");for(let b=0;b<C.length;b++){if(v=h.slice(b+2),!ei(C[b])){y=!1;break}if(C[b+1]&&C[b+1]==="="||v==="-"||/[A-Za-z]/.test(C[b])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(v)||C[b+1]&&C[b+1].match(/\W/))break}return y}function re(h){return a["unknown-options-as-args"]&&G(h)}function G(h){return h=h.replace(/^-{3,}/,"--"),h.match(E)||Z(h)?!1:!$(h,/^-+([^=]+?)=[\s\S]*$/,_,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function oe(h){return!U(h,m.bools)&&!U(h,m.counts)&&`${h}`in l?l[h]:le(Fe(h))}function le(h){return{[Oe.BOOLEAN]:!0,[Oe.STRING]:"",[Oe.NUMBER]:void 0,[Oe.ARRAY]:[]}[h]}function Fe(h){let y=Oe.BOOLEAN;return U(h,m.strings)?y=Oe.STRING:U(h,m.numbers)?y=Oe.NUMBER:U(h,m.bools)?y=Oe.BOOLEAN:U(h,m.arrays)&&(y=Oe.ARRAY),y}function Le(h){return h===void 0}function bn(){Object.keys(m.counts).find(h=>U(h,m.arrays)?(B=Error(w("Invalid configuration: %s, opts.count excludes opts.array.",h)),!0):U(h,m.nargs)?(B=Error(w("Invalid configuration: %s, opts.count excludes opts.narg.",h)),!0):!1)}return{aliases:Object.assign({},m.aliases),argv:Object.assign(Ke,K),configuration:a,defaulted:Object.assign({},A),error:B,newAliases:Object.assign({},g)}}};function ea(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 ii(e){return e!==void 0?e+1:1}function sr(e){return e==="__proto__"?"___proto___":e}function ta(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 oa}from"fs";var ar=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])<ar)throw Error(`yargs parser supports a minimum Node.js version of ${ar}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);var sa=process?process.env:{},lr=new ri({cwd:process.cwd,env:()=>sa,format:na,normalize:ia,resolve:ra,require:e=>{if(typeof De!="undefined")return De(e);if(e.match(/\.json$/))return JSON.parse(oa(e,"utf8"));throw Error("only .json config files are supported in ESM")}}),rn=function(t,n){return lr.parse(t.slice(),n).argv};rn.detailed=function(e,t){return lr.parse(e.slice(),t)};rn.camelCase=xt;rn.decamelize=An;rn.looksLikeNumber=Cn;var fr=rn;import{basename as Ca,dirname as xa,extname as va,relative as _a,resolve as mr}from"path";x();function aa(){return la()?0:1}function la(){return fa()&&!process.defaultApp}function fa(){return!!process.versions.electron}function cr(){return process.argv[aa()]}x();var J=class extends Error{constructor(t){super(t||"yargs error");this.name="YError",Error.captureStackTrace(this,J)}};x();x();import{readFileSync as ca,statSync as ua,writeFile as pa}from"fs";import{format as da}from"util";import{resolve as ha}from"path";var ur={fs:{readFileSync:ca,writeFile:pa},format:da,resolve:ha,exists:e=>{try{return ua(e).isFile()}catch(t){return!1}}};x();var Me,pr=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(),Me.format.apply(Me.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),Me.format.apply(Me.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);Me.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{Me.fs.readFileSync&&(t=JSON.parse(Me.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=Me.resolve(t,"./",n+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(i)&&~n.lastIndexOf("_")){let r=Me.resolve(t,"./",n.split("_")[0]+".json");this._fileExistsSync(r)&&(i=r)}return i}_fileExistsSync(t){return Me.exists(t)}};function dr(e,t){Me=t;let n=new pr(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 ma=e=>dr(e,ur),hr=ma;var Ea={},Oa="require is not supported by ESM",gr="loading a directory of commands is not supported yet for ESM",xn;try{xn=Aa(Ea.url)}catch(e){xn=process.cwd()}var Sa=xn.split("node_modules")[0],br={assert:{notStrictEqual:ga,strictEqual:ba},cliui:ni,findUp:rr,getEnv:e=>process.env[e],inspect:ya,getCallerFile:()=>{throw new J(gr)},getProcessArgvBin:cr,mainFilename:Sa||process.cwd(),Parser:fr,path:{basename:Ca,dirname:xa,extname:va,relative:_a,resolve:mr},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:wa,require:()=>{throw new J(Oa)},requireDirectory:()=>{throw new J(gr)},stringWidth:e=>[...e].length,y18n:hr({directory:mr(xn,"../../../locales"),updateFiles:!1})};x();x();x();function ye(e,t,n,i){n.assert.notStrictEqual(e,t,i)}function oi(e,t){t.assert.strictEqual(typeof e,"string")}function Wt(e){return Object.keys(e)}x();function ee(e){return!!e&&!!e.then&&typeof e.then=="function"}x();x();x();function Ve(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 Ia=["first","second","third","fourth","fifth","sixth"];function I(e,t,n){function i(){return typeof e=="object"?[{demanded:[],optional:[]},e,t]:[Ve(`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 J(`Not enough arguments provided. Expected ${o.demanded.length} but received ${l.length}.`);let p=o.demanded.length+o.optional.length;if(u>p)throw new J(`Too many arguments provided. Expected max ${p} but received ${u}.`);o.demanded.forEach(c=>{let d=l.shift(),g=yr(d);c.cmd.filter(w=>w===g||w==="*").length===0&&wr(g,c.cmd,r),r+=1}),o.optional.forEach(c=>{if(l.length===0)return;let d=l.shift(),g=yr(d);c.cmd.filter(w=>w===g||w==="*").length===0&&wr(g,c.cmd,r),r+=1})}catch(r){console.warn(r.stack)}}function yr(e){return Array.isArray(e)?"array":e===null?"null":typeof e}function wr(e,t,n){throw new J(`Invalid ${Ia[n]||"manyith"} argument. Expected ${t.join(" or ")} but received ${e}.`)}var si=class{constructor(t){this.globalMiddleware=[],this.frozens=[],this.yargs=t}addMiddleware(t,n,i=!0,r=!1){if(I("<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 Ar(e){return e?e.map(t=>(t.applyBeforeValidation=!1,t)):[]}function vt(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(ee(r))return r.then(s=>Promise.all([s,o(s,t)])).then(([s,a])=>Object.assign(s,a));{let s=o(r,t);return ee(s)?s.then(a=>Object.assign(r,a)):Object.assign(r,s)}},e)}x();function _t(e,t,n=i=>{throw i}){try{let i=ja(e)?e():e;return ee(i)?i.then(r=>t(r)):t(i)}catch(i){return n(i)}}function ja(e){return typeof e=="function"}x();function ai(e){if(typeof De=="undefined")return null;for(let t=0,n=Object.keys(De.cache),i;t<n.length;t++)if(i=De.cache[n[t]],i.exports===e)return i;return null}var Yt=/(^\*)|(^\$0)/,xr=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=Ar(o);if(r=r||(()=>{}),Array.isArray(t))if(Pa(t))[t,...a]=t;else for(let u of t)this.addHandler(u);else if(La(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(Cr(i)){this.addHandler([t].concat(a),n,i.builder,i.handler,i.middlewares,i.deprecated);return}if(typeof t=="string"){let u=Ve(t);a=a.map(d=>Ve(d).cmd);let p=!1,c=[u.cmd].concat(a).filter(d=>Yt.test(d)?(p=!0,!1):!0);c.length===0&&p&&c.push("$0"),p&&(u.cmd=c[0],a=c.slice(1),t=t.replace(Yt,u.cmd)),a.forEach(d=>{this.aliasMap[d]=u.cmd}),n!==!1&&this.usage.command(t,n,p,a,s),this.handlers[u.cmd]={original:t,description:n,handler:r,builder:i||{},middlewares:l,deprecated:s,demanded:u.demanded,optional:u.optional},p&&(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(),p=!t;t&&(l.commands.push(t),l.fullCommands.push(a.original));let c=this.applyBuilderUpdateUsageAndParse(p,a,n,i.aliases,u,r,o,s);return ee(c)?c.then(d=>this.applyMiddlewareAndGetResult(p,a,d.innerArgv,l,o,d.aliases,n)):this.applyMiddlewareAndGetResult(p,a,c.innerArgv,l,o,c.aliases,n)}applyBuilderUpdateUsageAndParse(t,n,i,r,o,s,a,l){let u=n.builder,p=i;if(vn(u)){let c=u(i.getInternalMethods().reset(r),l);if(ee(c))return c.then(d=>(p=_r(d)?d:i,this.parseAndUpdateUsage(t,n,p,o,s,a)))}else Fa(u)&&(p=i.getInternalMethods().reset(r),Object.keys(n.builder).forEach(c=>{p.option(c,u[c])}));return this.parseAndUpdateUsage(t,n,p,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 ee(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=Yt.test(n.original)?n.original.replace(Yt,"").trim():n.original,r=t.filter(o=>!Yt.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=vt(i,a,u,!0),!a.getInternalMethods().getHasOutput()){let p=a.getInternalMethods().runValidation(s,l,a.parsed.error,t);i=_t(i,c=>(p(c),c))}if(n.handler&&!a.getInternalMethods().getHasOutput()){a.getInternalMethods().setHasOutput();let p=!!a.getOptions().configuration["populate--"];a.getInternalMethods().postProcess(i,p,!1,!1),i=vt(i,a,u,!1),i=_t(i,c=>{let d=n.handler(c);return ee(d)?d.then(()=>c):c}),t||a.getInternalMethods().getUsageInstance().cacheHelpMessage(),ee(i)&&!a.getInternalMethods().hasParseCallback()&&i.catch(c=>{try{a.getInternalMethods().getUsageInstance().fail(null,c)}catch(d){}})}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=Ve(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(p=>{o.configuration["unknown-options-as-args"]&&(o.key[u]=!0),s.push(`--${u}`),s.push(p)})}),!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(c=>{u.push(...l.aliases[c])});let p=r.getOptions().default;Object.keys(l.argv).forEach(c=>{u.includes(c)&&(n[c]||(n[c]=l.argv[c]),!Object.prototype.hasOwnProperty.call(p,c)&&Object.prototype.hasOwnProperty.call(t,c)&&Object.prototype.hasOwnProperty.call(l.argv,c)&&(Array.isArray(t[c])||Array.isArray(l.argv[c]))?t[c]=[].concat(t[c],l.argv[c]):t[c]=l.argv[c])})}}runDefaultBuilderOn(t){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(t)){let i=Yt.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(vn(n))return n(t,!0);Cr(n)||Object.keys(n).forEach(i=>{t.option(i,n[i])})}moduleName(t){let n=ai(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;ye(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();ye(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 vr(e,t,n,i){return new xr(e,t,n,i)}function Cr(e){return typeof e=="object"&&!!e.builder&&typeof e.handler=="function"}function Pa(e){return e.every(t=>typeof t=="string")}function vn(e){return typeof e=="function"}function Fa(e){return typeof e=="object"}function La(e){return typeof e=="object"&&!Array.isArray(e)}x();x();function ke(e={},t=()=>!0){let n={};return Wt(e).forEach(i=>{t(i,e[i])&&(n[i]=e[i])}),n}x();function Je(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 Ma(e){return typeof e=="boolean"}function Sr(e,t){let n=t.y18n.__,i={},r=[];i.failFn=function(O){r.push(O)};let o=null,s=!0;i.showHelpOnFail=function(O=!0,R){function W(){return typeof O=="string"?[!0,O]:[O,R]}let[k,ae]=W();return o=ae,s=k,i};let a=!1;i.fail=function(O,R){let W=e.getInternalMethods().getLoggerInstance();if(r.length)for(let k=r.length-1;k>=0;--k){let ae=r[k];if(Ma(ae)){if(R)throw R;if(O)throw Error(O)}else ae(O,R,i)}else{if(e.getExitProcess()&&Je(!0),a||(a=!0,s&&(e.showHelp("error"),W.error()),(O||R)&&W.error(O||R),o&&((O||R)&&W.error(""),W.error(o))),R=R||new J(O),e.getExitProcess())return e.exit(1);if(e.getInternalMethods().hasParseCallback())return e.exit(1,R);throw R}};let l=[],u=!1;i.usage=(F,O)=>F===null?(u=!0,l=[],i):(u=!1,l.push([F,O||""]),i),i.getUsage=()=>l,i.getUsageDisabled=()=>u,i.getPositionalGroupName=()=>n("Positionals:");let p=[];i.example=(F,O)=>{p.push([F,O||""])};let c=[];i.command=function(O,R,W,k,ae=!1){W&&(c=c.map(q=>(q[2]=!1,q))),c.push([O,R||"",W,k,ae])},i.getCommands=()=>c;let d={};i.describe=function(O,R){Array.isArray(O)?O.forEach(W=>{i.describe(W,R)}):typeof O=="object"?Object.keys(O).forEach(W=>{i.describe(W,O[W])}):d[O]=R},i.getDescriptions=()=>d;let g=[];i.epilog=F=>{g.push(F)};let A=!1,w;i.wrap=F=>{A=!0,w=F};function m(){return A||(w=Ht(),A=!0),w}let E="__yargsString__:";i.deferY18nLookup=F=>E+F,i.help=function(){if(z)return z;B();let O=e.customScriptName?e.$0:t.path.basename(e.$0),R=e.getDemandedOptions(),W=e.getDemandedCommands(),k=e.getDeprecatedOptions(),ae=e.getGroups(),q=e.getOptions(),ue=[];ue=ue.concat(Object.keys(d)),ue=ue.concat(Object.keys(R)),ue=ue.concat(Object.keys(W)),ue=ue.concat(Object.keys(q.default)),ue=ue.filter(Ke),ue=Object.keys(ue.reduce(($,Z)=>(Z!=="_"&&($[Z]=!0),$),{}));let At=m(),ie=t.cliui({width:At,wrap:!!At});if(!u){if(l.length)l.forEach($=>{ie.div({text:`${$[0].replace(/\$0/g,O)}`}),$[1]&&ie.div({text:`${$[1]}`,padding:[1,0,0,0]})}),ie.div();else if(c.length){let $=null;W._?$=`${O} <${n("command")}>
|
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[Ks]||0).fill("")),r.push(...new Array(o.padding[Vs]||0).fill(""))),r.forEach((a,l)=>{n[l]||n.push([]);let u=n[l];for(let p=0;p<s;p++)u[p]===void 0&&u.push("");u.push(a)})}),n}negatePadding(t){let n=t.width||0;return t.padding&&(n-=(t.padding[wn]||0)+(t.padding[bn]||0)),t.border&&(n-=4),n}columnWidths(t){if(!this.wrap)return t.map(s=>s.width||Ce.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,ks(t[a])):s)}};function Zi(e,t,n){return e.border?/[.']-+[.']/.test(t)?"":t.trim().length!==0?n:" ":""}function ks(e){let t=e.padding||[],n=1+(t[wn]||0)+(t[bn]||0);return e.border?n+4:n}function Js(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function Qs(e,t){e=e.trim();let n=Ce.stringWidth(e);return n<t?" ".repeat(t-n)+e:e}function Zs(e,t){e=e.trim();let n=Ce.stringWidth(e);return n>=t?e:" ".repeat(t-n>>1)+e}var Ce;function er(e,t){return Ce=t,new Xi({width:(e==null?void 0:e.width)||Js(),wrap:e==null?void 0:e.wrap})}x();var tr=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function ni(e){return e.replace(tr,"")}function nr(e,t){let[n,i]=e.match(tr)||["",""];e=ni(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 ii(e){return er(e,{stringWidth:t=>[...t].length,stripAnsi:ni,wrap:nr})}x();import{dirname as ir,resolve as rr}from"path";import{readdirSync as Xs,statSync as ea}from"fs";function or(e,t){let n=rr(".",e),i;for(ea(n).isDirectory()||(n=ir(n));;){if(i=t(n,Xs(n)),i)return rr(n,i);if(n=ir(i=n),i===n)break}}import{inspect as wa}from"util";import{readFileSync as Aa}from"fs";import{fileURLToPath as Ca}from"url";x();import{format as ia}from"util";import{normalize as ra,resolve as oa}from"path";x();function xt(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 An(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 Cn(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)}x();x();function sr(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}x();var Oe;(function(e){e.BOOLEAN="boolean",e.STRING="string",e.NUMBER="number",e.ARRAY="array"})(Oe||(Oe={}));var Ye,oi=class{constructor(t){Ye=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=sr(t),o=typeof t=="string",s=ta(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||[],p=i.envPrefix,c=a["populate--"],d=c?"--":"_",g=Object.create(null),A=Object.create(null),w=i.__||Ye.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:[]},S=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,_=new RegExp("^--"+a["negation-prefix"]+"(.+)");[].concat(i.array||[]).filter(Boolean).forEach(function(h){let b=typeof h=="object"?h.key:h,v=Object.keys(h).map(function(C){return{boolean:"bools",string:"strings",number:"numbers"}[C]}).filter(Boolean).pop();v&&(m[v][b]=!0),m.arrays[b]=!0,m.keys.push(b)}),[].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,b])=>{typeof b=="number"&&(m.nargs[h]=b,m.keys.push(h))}),typeof i.coerce=="object"&&Object.entries(i.coerce).forEach(([h,b])=>{typeof b=="function"&&(m.coercions[h]=b,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,b])=>{(typeof b=="boolean"||typeof b=="function")&&(m.configs[h]=b)})),Ct(i.key,s,i.default,m.arrays),Object.keys(l).forEach(function(h){(m.aliases[h]||[]).forEach(function(b){l[b]=l[h]})});let B=null;yn();let z=[],K=Object.assign(Object.create(null),{_:[]}),Ke={};for(let h=0;h<r.length;h++){let b=r[h],v=b.replace(/^-{3,}/,"---"),C,y,P,E,D,de;if(b!=="--"&&re(b))Pe(b);else if(v.match(/---+(=|$)/)){Pe(b);continue}else if(b.match(/^--.+=/)||!a["short-option-groups"]&&b.match(/^-.+=/))E=b.match(/^--?([^=]+)=([\s\S]*)$/),E!==null&&Array.isArray(E)&&E.length>=3&&(U(E[1],m.arrays)?h=wt(h,E[1],r,E[2]):U(E[1],m.nargs)!==!1?h=Ht(h,E[1],r,E[2]):V(E[1],E[2],!0));else if(b.match(_)&&a["boolean-negation"])E=b.match(_),E!==null&&Array.isArray(E)&&E.length>=2&&(y=E[1],V(y,U(y,m.arrays)?[!1]:!1));else if(b.match(/^--.+/)||!a["short-option-groups"]&&b.match(/^-[^-]+/))E=b.match(/^--?(.+)/),E!==null&&Array.isArray(E)&&E.length>=2&&(y=E[1],U(y,m.arrays)?h=wt(h,y,r):U(y,m.nargs)!==!1?h=Ht(h,y,r):(D=r[h+1],D!==void 0&&(!D.match(/^-/)||D.match(S))&&!U(y,m.bools)&&!U(y,m.counts)||/^(true|false)$/.test(D)?(V(y,D),h++):V(y,oe(y))));else if(b.match(/^-.\..+=/))E=b.match(/^-([^=]+)=([\s\S]*)$/),E!==null&&Array.isArray(E)&&E.length>=3&&V(E[1],E[2]);else if(b.match(/^-.\..+/)&&!b.match(S))D=r[h+1],E=b.match(/^-(.\..+)/),E!==null&&Array.isArray(E)&&E.length>=2&&(y=E[1],D!==void 0&&!D.match(/^-/)&&!U(y,m.bools)&&!U(y,m.counts)?(V(y,D),h++):V(y,oe(y)));else if(b.match(/^-[^-]+/)&&!b.match(S)){P=b.slice(1,-1).split(""),C=!1;for(let ye=0;ye<P.length;ye++){if(D=b.slice(ye+2),P[ye+1]&&P[ye+1]==="="){de=b.slice(ye+3),y=P[ye],U(y,m.arrays)?h=wt(h,y,r,de):U(y,m.nargs)!==!1?h=Ht(h,y,r,de):V(y,de),C=!0;break}if(D==="-"){V(P[ye],D);continue}if(/[A-Za-z]/.test(P[ye])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(D)&&U(D,m.bools)===!1){V(P[ye],D),C=!0;break}if(P[ye+1]&&P[ye+1].match(/\W/)){V(P[ye],D),C=!0;break}else V(P[ye],oe(P[ye]))}y=b.slice(-1)[0],!C&&y!=="-"&&(U(y,m.arrays)?h=wt(h,y,r):U(y,m.nargs)!==!1?h=Ht(h,y,r):(D=r[h+1],D!==void 0&&(!/^(-|--)[^-]/.test(D)||D.match(S))&&!U(y,m.bools)&&!U(y,m.counts)||/^(true|false)$/.test(D)?(V(y,D),h++):V(y,oe(y))))}else if(b.match(/^-[0-9]$/)&&b.match(S)&&U(b.slice(1),m.bools))y=b.slice(1),V(y,oe(y));else if(b==="--"){z=r.slice(h+1);break}else if(a["halt-at-non-option"]){z=r.slice(h);break}else Pe(b)}q(K,!0),q(K,!1),W(K),ae(),ie(K,m.aliases,l,!0),ue(K),a["set-placeholder-key"]&&At(K),Object.keys(m.counts).forEach(function(h){He(K,h.split("."))||V(h,0)}),c&&z.length&&(K[d]=[]),z.forEach(function(h){K[d].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(b=>xt(b)).join(".")],delete K[h]});function Pe(h){let b=R("_",h);(typeof b=="string"||typeof b=="number")&&K._.push(b)}function Ht(h,b,v,C){let y,P=U(b,m.nargs);if(P=typeof P!="number"||isNaN(P)?1:P,P===0)return Le(C)||(B=Error(w("Argument unexpected for: %s",b))),V(b,oe(b)),h;let E=Le(C)?0:1;if(a["nargs-eats-options"])v.length-(h+1)+E<P&&(B=Error(w("Not enough arguments following: %s",b))),E=P;else{for(y=h+1;y<v.length&&(!v[y].match(/^-[^0-9]/)||v[y].match(S)||re(v[y]));y++)E++;E<P&&(B=Error(w("Not enough arguments following: %s",b)))}let D=Math.min(E,P);for(!Le(C)&&D>0&&(V(b,C),D--),y=h+1;y<D+h+1;y++)V(b,v[y]);return h+D}function wt(h,b,v,C){let y=[],P=C||v[h+1],E=U(b,m.nargs);if(U(b,m.bools)&&!/^(true|false)$/.test(P))y.push(!0);else if(Le(P)||Le(C)&&/^-/.test(P)&&!S.test(P)&&!re(P)){if(l[b]!==void 0){let D=l[b];y=Array.isArray(D)?D:[D]}}else{Le(C)||y.push(O(b,C,!0));for(let D=h+1;D<v.length&&!(!a["greedy-arrays"]&&y.length>0||E&&typeof E=="number"&&y.length>=E||(P=v[D],/^-/.test(P)&&!S.test(P)&&!re(P)));D++)h=D,y.push(O(b,P,o))}return typeof E=="number"&&(E&&y.length<E||isNaN(E)&&y.length===0)&&(B=Error(w("Not enough arguments following: %s",b))),V(b,y),h}function V(h,b,v=o){if(/-/.test(h)&&a["camel-case-expansion"]){let P=h.split(".").map(function(E){return xt(E)}).join(".");F(h,P)}let C=O(h,b,v),y=h.split(".");We(K,y,C),m.aliases[h]&&m.aliases[h].forEach(function(P){let E=P.split(".");We(K,E,C)}),y.length>1&&a["dot-notation"]&&(m.aliases[y[0]]||[]).forEach(function(P){let E=P.split("."),D=[].concat(y);D.shift(),E=E.concat(D),(m.aliases[h]||[]).includes(E.join("."))||We(K,E,C)}),U(h,m.normalize)&&!U(h,m.arrays)&&[h].concat(m.aliases[h]||[]).forEach(function(E){Object.defineProperty(Ke,E,{enumerable:!0,get(){return b},set(D){b=typeof D=="string"?Ye.normalize(D):D}})})}function F(h,b){m.aliases[h]&&m.aliases[h].length||(m.aliases[h]=[b],g[b]=!0),m.aliases[b]&&m.aliases[b].length||F(b,h)}function O(h,b,v){v&&(b=na(b)),(U(h,m.bools)||U(h,m.counts))&&typeof b=="string"&&(b=b==="true");let C=Array.isArray(b)?b.map(function(y){return R(h,y)}):R(h,b);return U(h,m.counts)&&(Le(C)||typeof C=="boolean")&&(C=ri()),U(h,m.normalize)&&U(h,m.arrays)&&(Array.isArray(b)?C=b.map(y=>Ye.normalize(y)):C=Ye.normalize(b)),C}function R(h,b){return!a["parse-positional-numbers"]&&h==="_"||!U(h,m.strings)&&!U(h,m.bools)&&!Array.isArray(b)&&(Cn(b)&&a["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${b}`)))||!Le(b)&&U(h,m.numbers))&&(b=Number(b)),b}function W(h){let b=Object.create(null);ie(b,m.aliases,l),Object.keys(m.configs).forEach(function(v){let C=h[v]||b[v];if(C)try{let y=null,P=Ye.resolve(Ye.cwd(),C),E=m.configs[v];if(typeof E=="function"){try{y=E(P)}catch(D){y=D}if(y instanceof Error){B=y;return}}else y=Ye.require(P);k(y)}catch(y){y.name==="PermissionDenied"?B=y:h[v]&&(B=Error(w("Invalid JSON config file: %s",C)))}})}function k(h,b){Object.keys(h).forEach(function(v){let C=h[v],y=b?b+"."+v:v;typeof C=="object"&&C!==null&&!Array.isArray(C)&&a["dot-notation"]?k(C,y):(!He(K,y.split("."))||U(y,m.arrays)&&a["combine-arrays"])&&V(y,C)})}function ae(){typeof u!="undefined"&&u.forEach(function(h){k(h)})}function q(h,b){if(typeof p=="undefined")return;let v=typeof p=="string"?p:"",C=Ye.env();Object.keys(C).forEach(function(y){if(v===""||y.lastIndexOf(v,0)===0){let P=y.split("__").map(function(E,D){return D===0&&(E=E.substring(v.length)),xt(E)});(b&&m.configs[P.join(".")]||!b)&&!He(h,P)&&V(P.join("."),C[y])}})}function ue(h){let b,v=new Set;Object.keys(h).forEach(function(C){if(!v.has(C)&&(b=U(C,m.coercions),typeof b=="function"))try{let y=R(C,b(h[C]));[].concat(m.aliases[C]||[],C).forEach(P=>{v.add(P),h[P]=y})}catch(y){B=y}})}function At(h){return m.keys.forEach(b=>{~b.indexOf(".")||typeof h[b]=="undefined"&&(h[b]=void 0)}),h}function ie(h,b,v,C=!1){Object.keys(v).forEach(function(y){He(h,y.split("."))||(We(h,y.split("."),v[y]),C&&(A[y]=!0),(b[y]||[]).forEach(function(P){He(h,P.split("."))||We(h,P.split("."),v[y])}))})}function He(h,b){let v=h;a["dot-notation"]||(b=[b.join(".")]),b.slice(0,-1).forEach(function(y){v=v[y]||{}});let C=b[b.length-1];return typeof v!="object"?!1:C in v}function We(h,b,v){let C=h;a["dot-notation"]||(b=[b.join(".")]),b.slice(0,-1).forEach(function(de){de=ar(de),typeof C=="object"&&C[de]===void 0&&(C[de]={}),typeof C[de]!="object"||Array.isArray(C[de])?(Array.isArray(C[de])?C[de].push({}):C[de]=[C[de],{}],C=C[de][C[de].length-1]):C=C[de]});let y=ar(b[b.length-1]),P=U(b.join("."),m.arrays),E=Array.isArray(v),D=a["duplicate-arguments-array"];!D&&U(y,m.nargs)&&(D=!0,(!Le(C[y])&&m.nargs[y]===1||Array.isArray(C[y])&&C[y].length===m.nargs[y])&&(C[y]=void 0)),v===ri()?C[y]=ri(C[y]):Array.isArray(C[y])?D&&P&&E?C[y]=a["flatten-duplicate-arrays"]?C[y].concat(v):(Array.isArray(C[y][0])?C[y]:[C[y]]).concat([v]):!D&&Boolean(P)===Boolean(E)?C[y]=v:C[y]=C[y].concat([v]):C[y]===void 0&&P?C[y]=E?v:[v]:D&&!(C[y]===void 0||U(y,m.counts)||U(y,m.bools))?C[y]=[C[y],v]:C[y]=v}function Ct(...h){h.forEach(function(b){Object.keys(b||{}).forEach(function(v){m.aliases[v]||(m.aliases[v]=[].concat(s[v]||[]),m.aliases[v].concat(v).forEach(function(C){if(/-/.test(C)&&a["camel-case-expansion"]){let y=xt(C);y!==v&&m.aliases[v].indexOf(y)===-1&&(m.aliases[v].push(y),g[y]=!0)}}),m.aliases[v].concat(v).forEach(function(C){if(C.length>1&&/[A-Z]/.test(C)&&a["camel-case-expansion"]){let y=An(C,"-");y!==v&&m.aliases[v].indexOf(y)===-1&&(m.aliases[v].push(y),g[y]=!0)}}),m.aliases[v].forEach(function(C){m.aliases[C]=[v].concat(m.aliases[v].filter(function(y){return C!==y}))}))})})}function U(h,b){let v=[].concat(m.aliases[h]||[],h),C=Object.keys(b),y=v.find(P=>C.includes(P));return y?b[y]:!1}function ti(h){let b=Object.keys(m);return[].concat(b.map(C=>m[C])).some(function(C){return Array.isArray(C)?C.includes(h):C[h]})}function $(h,...b){return[].concat(...b).some(function(C){let y=h.match(C);return y&&ti(y[1])})}function Z(h){if(h.match(S)||!h.match(/^-[^-]+/))return!1;let b=!0,v,C=h.slice(1).split("");for(let y=0;y<C.length;y++){if(v=h.slice(y+2),!ti(C[y])){b=!1;break}if(C[y+1]&&C[y+1]==="="||v==="-"||/[A-Za-z]/.test(C[y])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(v)||C[y+1]&&C[y+1].match(/\W/))break}return b}function re(h){return a["unknown-options-as-args"]&&G(h)}function G(h){return h=h.replace(/^-{3,}/,"--"),h.match(S)||Z(h)?!1:!$(h,/^-+([^=]+?)=[\s\S]*$/,_,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function oe(h){return!U(h,m.bools)&&!U(h,m.counts)&&`${h}`in l?l[h]:le(Fe(h))}function le(h){return{[Oe.BOOLEAN]:!0,[Oe.STRING]:"",[Oe.NUMBER]:void 0,[Oe.ARRAY]:[]}[h]}function Fe(h){let b=Oe.BOOLEAN;return U(h,m.strings)?b=Oe.STRING:U(h,m.numbers)?b=Oe.NUMBER:U(h,m.bools)?b=Oe.BOOLEAN:U(h,m.arrays)&&(b=Oe.ARRAY),b}function Le(h){return h===void 0}function yn(){Object.keys(m.counts).find(h=>U(h,m.arrays)?(B=Error(w("Invalid configuration: %s, opts.count excludes opts.array.",h)),!0):U(h,m.nargs)?(B=Error(w("Invalid configuration: %s, opts.count excludes opts.narg.",h)),!0):!1)}return{aliases:Object.assign({},m.aliases),argv:Object.assign(Ke,K),configuration:a,defaulted:Object.assign({},A),error:B,newAliases:Object.assign({},g)}}};function ta(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 ri(e){return e!==void 0?e+1:1}function ar(e){return e==="__proto__"?"___proto___":e}function na(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 sa}from"fs";var lr=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])<lr)throw Error(`yargs parser supports a minimum Node.js version of ${lr}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);var aa=process?process.env:{},fr=new oi({cwd:process.cwd,env:()=>aa,format:ia,normalize:ra,resolve:oa,require:e=>{if(typeof De!="undefined")return De(e);if(e.match(/\.json$/))return JSON.parse(sa(e,"utf8"));throw Error("only .json config files are supported in ESM")}}),rn=function(t,n){return fr.parse(t.slice(),n).argv};rn.detailed=function(e,t){return fr.parse(e.slice(),t)};rn.camelCase=xt;rn.decamelize=An;rn.looksLikeNumber=Cn;var cr=rn;import{basename as xa,dirname as va,extname as _a,relative as Oa,resolve as gr}from"path";x();function la(){return fa()?0:1}function fa(){return ca()&&!process.defaultApp}function ca(){return!!process.versions.electron}function ur(){return process.argv[la()]}x();var J=class extends Error{constructor(t){super(t||"yargs error");this.name="YError",Error.captureStackTrace(this,J)}};x();x();import{readFileSync as ua,statSync as pa,writeFile as da}from"fs";import{format as ha}from"util";import{resolve as ma}from"path";var pr={fs:{readFileSync:ua,writeFile:da},format:ha,resolve:ma,exists:e=>{try{return pa(e).isFile()}catch(t){return!1}}};x();var Me,dr=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(),Me.format.apply(Me.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),Me.format.apply(Me.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);Me.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{Me.fs.readFileSync&&(t=JSON.parse(Me.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=Me.resolve(t,"./",n+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(i)&&~n.lastIndexOf("_")){let r=Me.resolve(t,"./",n.split("_")[0]+".json");this._fileExistsSync(r)&&(i=r)}return i}_fileExistsSync(t){return Me.exists(t)}};function hr(e,t){Me=t;let n=new dr(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 ga=e=>hr(e,pr),mr=ga;var Ia={},Sa="require is not supported by ESM",yr="loading a directory of commands is not supported yet for ESM",xn;try{xn=Ca(Ia.url)}catch(e){xn=process.cwd()}var Ea=xn.split("node_modules")[0],br={assert:{notStrictEqual:ya,strictEqual:ba},cliui:ii,findUp:or,getEnv:e=>process.env[e],inspect:wa,getCallerFile:()=>{throw new J(yr)},getProcessArgvBin:ur,mainFilename:Ea||process.cwd(),Parser:cr,path:{basename:xa,dirname:va,extname:_a,relative:Oa,resolve:gr},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:Aa,require:()=>{throw new J(Sa)},requireDirectory:()=>{throw new J(yr)},stringWidth:e=>[...e].length,y18n:mr({directory:gr(xn,"../../../locales"),updateFiles:!1})};x();x();x();function be(e,t,n,i){n.assert.notStrictEqual(e,t,i)}function si(e,t){t.assert.strictEqual(typeof e,"string")}function Wt(e){return Object.keys(e)}x();function ee(e){return!!e&&!!e.then&&typeof e.then=="function"}x();x();x();function Ve(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 I(e,t,n){function i(){return typeof e=="object"?[{demanded:[],optional:[]},e,t]:[Ve(`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 J(`Not enough arguments provided. Expected ${o.demanded.length} but received ${l.length}.`);let p=o.demanded.length+o.optional.length;if(u>p)throw new J(`Too many arguments provided. Expected max ${p} but received ${u}.`);o.demanded.forEach(c=>{let d=l.shift(),g=wr(d);c.cmd.filter(w=>w===g||w==="*").length===0&&Ar(g,c.cmd,r),r+=1}),o.optional.forEach(c=>{if(l.length===0)return;let d=l.shift(),g=wr(d);c.cmd.filter(w=>w===g||w==="*").length===0&&Ar(g,c.cmd,r),r+=1})}catch(r){console.warn(r.stack)}}function wr(e){return Array.isArray(e)?"array":e===null?"null":typeof e}function Ar(e,t,n){throw new J(`Invalid ${ja[n]||"manyith"} argument. Expected ${t.join(" or ")} but received ${e}.`)}var ai=class{constructor(t){this.globalMiddleware=[],this.frozens=[],this.yargs=t}addMiddleware(t,n,i=!0,r=!1){if(I("<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 Cr(e){return e?e.map(t=>(t.applyBeforeValidation=!1,t)):[]}function vt(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(ee(r))return r.then(s=>Promise.all([s,o(s,t)])).then(([s,a])=>Object.assign(s,a));{let s=o(r,t);return ee(s)?s.then(a=>Object.assign(r,a)):Object.assign(r,s)}},e)}x();function _t(e,t,n=i=>{throw i}){try{let i=Pa(e)?e():e;return ee(i)?i.then(r=>t(r)):t(i)}catch(i){return n(i)}}function Pa(e){return typeof e=="function"}x();function li(e){if(typeof De=="undefined")return null;for(let t=0,n=Object.keys(De.cache),i;t<n.length;t++)if(i=De.cache[n[t]],i.exports===e)return i;return null}var Yt=/(^\*)|(^\$0)/,vr=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=Cr(o);if(r=r||(()=>{}),Array.isArray(t))if(Fa(t))[t,...a]=t;else for(let u of t)this.addHandler(u);else if(Ma(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(xr(i)){this.addHandler([t].concat(a),n,i.builder,i.handler,i.middlewares,i.deprecated);return}if(typeof t=="string"){let u=Ve(t);a=a.map(d=>Ve(d).cmd);let p=!1,c=[u.cmd].concat(a).filter(d=>Yt.test(d)?(p=!0,!1):!0);c.length===0&&p&&c.push("$0"),p&&(u.cmd=c[0],a=c.slice(1),t=t.replace(Yt,u.cmd)),a.forEach(d=>{this.aliasMap[d]=u.cmd}),n!==!1&&this.usage.command(t,n,p,a,s),this.handlers[u.cmd]={original:t,description:n,handler:r,builder:i||{},middlewares:l,deprecated:s,demanded:u.demanded,optional:u.optional},p&&(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(),p=!t;t&&(l.commands.push(t),l.fullCommands.push(a.original));let c=this.applyBuilderUpdateUsageAndParse(p,a,n,i.aliases,u,r,o,s);return ee(c)?c.then(d=>this.applyMiddlewareAndGetResult(p,a,d.innerArgv,l,o,d.aliases,n)):this.applyMiddlewareAndGetResult(p,a,c.innerArgv,l,o,c.aliases,n)}applyBuilderUpdateUsageAndParse(t,n,i,r,o,s,a,l){let u=n.builder,p=i;if(vn(u)){let c=u(i.getInternalMethods().reset(r),l);if(ee(c))return c.then(d=>(p=Or(d)?d:i,this.parseAndUpdateUsage(t,n,p,o,s,a)))}else La(u)&&(p=i.getInternalMethods().reset(r),Object.keys(n.builder).forEach(c=>{p.option(c,u[c])}));return this.parseAndUpdateUsage(t,n,p,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 ee(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=Yt.test(n.original)?n.original.replace(Yt,"").trim():n.original,r=t.filter(o=>!Yt.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=vt(i,a,u,!0),!a.getInternalMethods().getHasOutput()){let p=a.getInternalMethods().runValidation(s,l,a.parsed.error,t);i=_t(i,c=>(p(c),c))}if(n.handler&&!a.getInternalMethods().getHasOutput()){a.getInternalMethods().setHasOutput();let p=!!a.getOptions().configuration["populate--"];a.getInternalMethods().postProcess(i,p,!1,!1),i=vt(i,a,u,!1),i=_t(i,c=>{let d=n.handler(c);return ee(d)?d.then(()=>c):c}),t||a.getInternalMethods().getUsageInstance().cacheHelpMessage(),ee(i)&&!a.getInternalMethods().hasParseCallback()&&i.catch(c=>{try{a.getInternalMethods().getUsageInstance().fail(null,c)}catch(d){}})}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=Ve(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(p=>{o.configuration["unknown-options-as-args"]&&(o.key[u]=!0),s.push(`--${u}`),s.push(p)})}),!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(c=>{u.push(...l.aliases[c])});let p=r.getOptions().default;Object.keys(l.argv).forEach(c=>{u.includes(c)&&(n[c]||(n[c]=l.argv[c]),!Object.prototype.hasOwnProperty.call(p,c)&&Object.prototype.hasOwnProperty.call(t,c)&&Object.prototype.hasOwnProperty.call(l.argv,c)&&(Array.isArray(t[c])||Array.isArray(l.argv[c]))?t[c]=[].concat(t[c],l.argv[c]):t[c]=l.argv[c])})}}runDefaultBuilderOn(t){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(t)){let i=Yt.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(vn(n))return n(t,!0);xr(n)||Object.keys(n).forEach(i=>{t.option(i,n[i])})}moduleName(t){let n=li(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;be(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();be(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 _r(e,t,n,i){return new vr(e,t,n,i)}function xr(e){return typeof e=="object"&&!!e.builder&&typeof e.handler=="function"}function Fa(e){return e.every(t=>typeof t=="string")}function vn(e){return typeof e=="function"}function La(e){return typeof e=="object"}function Ma(e){return typeof e=="object"&&!Array.isArray(e)}x();x();function ke(e={},t=()=>!0){let n={};return Wt(e).forEach(i=>{t(i,e[i])&&(n[i]=e[i])}),n}x();function Je(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 Da(e){return typeof e=="boolean"}function Er(e,t){let n=t.y18n.__,i={},r=[];i.failFn=function(O){r.push(O)};let o=null,s=!0;i.showHelpOnFail=function(O=!0,R){function W(){return typeof O=="string"?[!0,O]:[O,R]}let[k,ae]=W();return o=ae,s=k,i};let a=!1;i.fail=function(O,R){let W=e.getInternalMethods().getLoggerInstance();if(r.length)for(let k=r.length-1;k>=0;--k){let ae=r[k];if(Da(ae)){if(R)throw R;if(O)throw Error(O)}else ae(O,R,i)}else{if(e.getExitProcess()&&Je(!0),a||(a=!0,s&&(e.showHelp("error"),W.error()),(O||R)&&W.error(O||R),o&&((O||R)&&W.error(""),W.error(o))),R=R||new J(O),e.getExitProcess())return e.exit(1);if(e.getInternalMethods().hasParseCallback())return e.exit(1,R);throw R}};let l=[],u=!1;i.usage=(F,O)=>F===null?(u=!0,l=[],i):(u=!1,l.push([F,O||""]),i),i.getUsage=()=>l,i.getUsageDisabled=()=>u,i.getPositionalGroupName=()=>n("Positionals:");let p=[];i.example=(F,O)=>{p.push([F,O||""])};let c=[];i.command=function(O,R,W,k,ae=!1){W&&(c=c.map(q=>(q[2]=!1,q))),c.push([O,R||"",W,k,ae])},i.getCommands=()=>c;let d={};i.describe=function(O,R){Array.isArray(O)?O.forEach(W=>{i.describe(W,R)}):typeof O=="object"?Object.keys(O).forEach(W=>{i.describe(W,O[W])}):d[O]=R},i.getDescriptions=()=>d;let g=[];i.epilog=F=>{g.push(F)};let A=!1,w;i.wrap=F=>{A=!0,w=F};function m(){return A||(w=Ht(),A=!0),w}let S="__yargsString__:";i.deferY18nLookup=F=>S+F,i.help=function(){if(z)return z;B();let O=e.customScriptName?e.$0:t.path.basename(e.$0),R=e.getDemandedOptions(),W=e.getDemandedCommands(),k=e.getDeprecatedOptions(),ae=e.getGroups(),q=e.getOptions(),ue=[];ue=ue.concat(Object.keys(d)),ue=ue.concat(Object.keys(R)),ue=ue.concat(Object.keys(W)),ue=ue.concat(Object.keys(q.default)),ue=ue.filter(Ke),ue=Object.keys(ue.reduce(($,Z)=>(Z!=="_"&&($[Z]=!0),$),{}));let At=m(),ie=t.cliui({width:At,wrap:!!At});if(!u){if(l.length)l.forEach($=>{ie.div({text:`${$[0].replace(/\$0/g,O)}`}),$[1]&&ie.div({text:`${$[1]}`,padding:[1,0,0,0]})}),ie.div();else if(c.length){let $=null;W._?$=`${O} <${n("command")}>
|
7
7
|
`:$=`${O} [${n("command")}]
|
8
|
-
`,ie.div(`${$}`)}}if(c.length>1||c.length===1&&!c[0][2]){ie.div(n("Commands:"));let $=e.getInternalMethods().getContext(),Z=$.commands.length?`${$.commands.join(" ")} `:"";e.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(c=c.sort((G,oe)=>G[0].localeCompare(oe[0])));let re=O?`${O} `:"";c.forEach(G=>{let oe=`${re}${Z}${G[0].replace(/^\$0 ?/,"")}`;ie.span({text:oe,padding:[0,2,0,2],width:_(c,At,`${O}${Z}`)+4},{text:G[1]});let le=[];G[2]&&le.push(`[${n("default")}]`),G[3]&&G[3].length&&le.push(`[${n("aliases:")} ${G[3].join(", ")}]`),G[4]&&(typeof G[4]=="string"?le.push(`[${n("deprecated: %s",G[4])}]`):le.push(`[${n("deprecated")}]`)),le.length?ie.div({text:le.join(" "),padding:[0,0,0,2],align:"right"}):ie.div()}),ie.div()}let He=(Object.keys(q.alias)||[]).concat(Object.keys(e.parsed.newAliases)||[]);ue=ue.filter($=>!e.parsed.newAliases[$]&&He.every(Z=>(q.alias[Z]||[]).indexOf($)===-1));let We=n("Options:");ae[We]||(ae[We]=[]),K(ue,q.alias,ae,We);let Ct=$=>/^--/.test(_n($)),U=Object.keys(ae).filter($=>ae[$].length>0).map($=>{let Z=ae[$].filter(Ke).map(re=>{if(He.includes(re))return re;for(let G=0,oe;(oe=He[G])!==void 0;G++)if((q.alias[oe]||[]).includes(re))return oe;return re});return{groupName:$,normalizedKeys:Z}}).filter(({normalizedKeys:$})=>$.length>0).map(({groupName:$,normalizedKeys:Z})=>{let re=Z.reduce((G,oe)=>(G[oe]=[oe].concat(q.alias[oe]||[]).map(le=>$===i.getPositionalGroupName()?le:(/^[0-9]$/.test(le)?q.boolean.includes(oe)?"-":"--":le.length>1?"--":"-")+le).sort((le,Fe)=>Ct(le)===Ct(Fe)?0:Ct(le)?1:-1).join(", "),G),{});return{groupName:$,normalizedKeys:Z,switches:re}});if(U.filter(({groupName:$})=>$!==i.getPositionalGroupName()).some(({normalizedKeys:$,switches:Z})=>!$.every(re=>Ct(Z[re])))&&U.filter(({groupName:$})=>$!==i.getPositionalGroupName()).forEach(({normalizedKeys:$,switches:Z})=>{$.forEach(re=>{Ct(Z[re])&&(Z[re]=
|
8
|
+
`,ie.div(`${$}`)}}if(c.length>1||c.length===1&&!c[0][2]){ie.div(n("Commands:"));let $=e.getInternalMethods().getContext(),Z=$.commands.length?`${$.commands.join(" ")} `:"";e.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(c=c.sort((G,oe)=>G[0].localeCompare(oe[0])));let re=O?`${O} `:"";c.forEach(G=>{let oe=`${re}${Z}${G[0].replace(/^\$0 ?/,"")}`;ie.span({text:oe,padding:[0,2,0,2],width:_(c,At,`${O}${Z}`)+4},{text:G[1]});let le=[];G[2]&&le.push(`[${n("default")}]`),G[3]&&G[3].length&&le.push(`[${n("aliases:")} ${G[3].join(", ")}]`),G[4]&&(typeof G[4]=="string"?le.push(`[${n("deprecated: %s",G[4])}]`):le.push(`[${n("deprecated")}]`)),le.length?ie.div({text:le.join(" "),padding:[0,0,0,2],align:"right"}):ie.div()}),ie.div()}let He=(Object.keys(q.alias)||[]).concat(Object.keys(e.parsed.newAliases)||[]);ue=ue.filter($=>!e.parsed.newAliases[$]&&He.every(Z=>(q.alias[Z]||[]).indexOf($)===-1));let We=n("Options:");ae[We]||(ae[We]=[]),K(ue,q.alias,ae,We);let Ct=$=>/^--/.test(_n($)),U=Object.keys(ae).filter($=>ae[$].length>0).map($=>{let Z=ae[$].filter(Ke).map(re=>{if(He.includes(re))return re;for(let G=0,oe;(oe=He[G])!==void 0;G++)if((q.alias[oe]||[]).includes(re))return oe;return re});return{groupName:$,normalizedKeys:Z}}).filter(({normalizedKeys:$})=>$.length>0).map(({groupName:$,normalizedKeys:Z})=>{let re=Z.reduce((G,oe)=>(G[oe]=[oe].concat(q.alias[oe]||[]).map(le=>$===i.getPositionalGroupName()?le:(/^[0-9]$/.test(le)?q.boolean.includes(oe)?"-":"--":le.length>1?"--":"-")+le).sort((le,Fe)=>Ct(le)===Ct(Fe)?0:Ct(le)?1:-1).join(", "),G),{});return{groupName:$,normalizedKeys:Z,switches:re}});if(U.filter(({groupName:$})=>$!==i.getPositionalGroupName()).some(({normalizedKeys:$,switches:Z})=>!$.every(re=>Ct(Z[re])))&&U.filter(({groupName:$})=>$!==i.getPositionalGroupName()).forEach(({normalizedKeys:$,switches:Z})=>{$.forEach(re=>{Ct(Z[re])&&(Z[re]=Na(Z[re],4))})}),U.forEach(({groupName:$,normalizedKeys:Z,switches:re})=>{ie.div($),Z.forEach(G=>{let oe=re[G],le=d[G]||"",Fe=null;le.includes(S)&&(le=n(le.substring(S.length))),q.boolean.includes(G)&&(Fe=`[${n("boolean")}]`),q.count.includes(G)&&(Fe=`[${n("count")}]`),q.string.includes(G)&&(Fe=`[${n("string")}]`),q.normalize.includes(G)&&(Fe=`[${n("string")}]`),q.array.includes(G)&&(Fe=`[${n("array")}]`),q.number.includes(G)&&(Fe=`[${n("number")}]`);let Le=h=>typeof h=="string"?`[${n("deprecated: %s",h)}]`:`[${n("deprecated")}]`,yn=[G in k?Le(k[G]):null,Fe,G in R?`[${n("required")}]`:null,q.choices&&q.choices[G]?`[${n("choices:")} ${i.stringifiedValues(q.choices[G])}]`:null,Pe(q.default[G],q.defaultDescription[G])].filter(Boolean).join(" ");ie.span({text:_n(oe),padding:[0,2,0,2+Sr(oe)],width:_(re,At)+4},le),yn?ie.div({text:yn,padding:[0,0,0,2],align:"right"}):ie.div()}),ie.div()}),p.length&&(ie.div(n("Examples:")),p.forEach($=>{$[0]=$[0].replace(/\$0/g,O)}),p.forEach($=>{$[1]===""?ie.div({text:$[0],padding:[0,2,0,2]}):ie.div({text:$[0],padding:[0,2,0,2],width:_(p,At)+4},{text:$[1]})}),ie.div()),g.length>0){let $=g.map(Z=>Z.replace(/\$0/g,O)).join(`
|
9
9
|
`);ie.div(`${$}
|
10
|
-
`)}return ie.toString().replace(/\s*$/,"")};function _(F,O,R){let W=0;return Array.isArray(F)||(F=Object.values(F).map(k=>[k])),F.forEach(k=>{W=Math.max(t.stringWidth(R?`${R} ${_n(k[0])}`:_n(k[0]))+
|
10
|
+
`)}return ie.toString().replace(/\s*$/,"")};function _(F,O,R){let W=0;return Array.isArray(F)||(F=Object.values(F).map(k=>[k])),F.forEach(k=>{W=Math.max(t.stringWidth(R?`${R} ${_n(k[0])}`:_n(k[0]))+Sr(k[0]),W)}),O&&(W=Math.min(W,parseInt((O*.5).toString(),10))),W}function B(){let F=e.getDemandedOptions(),O=e.getOptions();(Object.keys(O.alias)||[]).forEach(R=>{O.alias[R].forEach(W=>{d[W]&&i.describe(R,d[W]),W in F&&e.demandOption(R,F[W]),O.boolean.includes(W)&&e.boolean(R),O.count.includes(W)&&e.count(R),O.string.includes(W)&&e.string(R),O.normalize.includes(W)&&e.normalize(R),O.array.includes(W)&&e.array(R),O.number.includes(W)&&e.number(R)})})}let z;i.cacheHelpMessage=function(){z=this.help()},i.clearCachedHelpMessage=function(){z=void 0},i.hasCachedHelpMessage=function(){return!!z};function K(F,O,R,W){let k=[],ae=null;return Object.keys(R).forEach(q=>{k=k.concat(R[q])}),F.forEach(q=>{ae=[q].concat(O[q]),ae.some(ue=>k.indexOf(ue)!==-1)||R[W].push(q)}),k}function Ke(F){return e.getOptions().hiddenOptions.indexOf(F)<0||e.parsed.argv[e.getOptions().showHiddenOpt]}i.showHelp=F=>{let O=e.getInternalMethods().getLoggerInstance();F||(F="error"),(typeof F=="function"?F:O[F])(i.help())},i.functionDescription=F=>{let O=F.name?t.Parser.decamelize(F.name,"-"):n("generated-value");return["(",O,")"].join("")},i.stringifiedValues=function(O,R){let W="",k=R||", ",ae=[].concat(O);return!O||!ae.length||ae.forEach(q=>{W.length&&(W+=k),W+=JSON.stringify(q)}),W};function Pe(F,O){let R=`[${n("default:")} `;if(F===void 0&&!O)return null;if(O)R+=O;else switch(typeof F){case"string":R+=`"${F}"`;break;case"object":R+=JSON.stringify(F);break;default:R+=F}return`${R}]`}function Ht(){return t.process.stdColumns?Math.min(80,t.process.stdColumns):80}let wt=null;i.version=F=>{wt=F},i.showVersion=F=>{let O=e.getInternalMethods().getLoggerInstance();F||(F="error"),(typeof F=="function"?F:O[F])(wt)},i.reset=function(O){return o=null,a=!1,l=[],u=!1,g=[],p=[],c=[],d=ke(d,R=>!O[R]),i};let V=[];return i.freeze=function(){V.push({failMessage:o,failureOutput:a,usages:l,usageDisabled:u,epilogs:g,examples:p,commands:c,descriptions:d})},i.unfreeze=function(){let O=V.pop();!O||({failMessage:o,failureOutput:a,usages:l,usageDisabled:u,epilogs:g,examples:p,commands:c,descriptions:d}=O)},i}function fi(e){return typeof e=="object"}function Na(e,t){return fi(e)?{text:e.text,indentation:e.indentation+t}:{text:e,indentation:t}}function Sr(e){return fi(e)?e.indentation:0}function _n(e){return fi(e)?e.text:e}x();x();var Ir=`###-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
|
-
`,
|
38
|
+
`,jr=`#compdef {{app_name}}
|
39
39
|
###-begin-{{app_name}}-completions-###
|
40
40
|
#
|
41
41
|
# yargs command completion script
|
@@ -54,47 +54,48 @@ _{{app_name}}_yargs_completions()
|
|
54
54
|
}
|
55
55
|
compdef _{{app_name}}_yargs_completions {{app_name}}
|
56
56
|
###-end-{{app_name}}-completions-###
|
57
|
-
`;var
|
57
|
+
`;var Pr=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(vn(u)){let p=this.yargs.getInternalMethods().reset();return u(p,!0),p.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=Ve(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(be(this.customCompletionFunction,null,this.shim),Ra(this.customCompletionFunction)){let o=this.customCompletionFunction(i,n);return ee(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 $a(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 ee(r)?r.then(o):o(r)}generateCompletionScript(t,n){let i=this.zshShell?jr:Ir,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 Fr(e,t,n,i){return new Pr(e,t,n,i)}function Ra(e){return e.length<3}function $a(e){return e.length>3}x();x();function Lr(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 Mr=["$0","--","_"];function Dr(e,t,n){let i=n.y18n.__,r=n.y18n.__n,o={};o.nonOptionCount=function(c){let d=e.getDemandedCommands(),A=c._.length+(c["--"]?c["--"].length:0)-e.getInternalMethods().getContext().commands.length;d._&&(A<d._.min||A>d._.max)&&(A<d._.min?d._.minMsg!==void 0?t.fail(d._.minMsg?d._.minMsg.replace(/\$0/g,A.toString()).replace(/\$1/,d._.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",A,A.toString(),d._.min.toString())):A>d._.max&&(d._.maxMsg!==void 0?t.fail(d._.maxMsg?d._.maxMsg.replace(/\$0/g,A.toString()).replace(/\$1/,d._.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",A,A.toString(),d._.max.toString()))))},o.positionalCount=function(c,d){d<c&&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",d,d+"",c+""))},o.requiredArguments=function(c,d){let g=null;for(let A of Object.keys(d))(!Object.prototype.hasOwnProperty.call(c,A)||typeof c[A]=="undefined")&&(g=g||{},g[A]=d[A]);if(g){let A=[];for(let m of Object.keys(g)){let S=g[m];S&&A.indexOf(S)<0&&A.push(S)}let w=A.length?`
|
58
58
|
${A.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(c,d,g,A,w=!0){var m;let
|
60
|
-
${i("Argument: %s, Given: %s, Choices: %s",m,t.stringifiedValues(g[m]),t.stringifiedValues(d.choices[m]))}`}),t.fail(w)};let s={};o.implies=function(c,d){I("<string|object> [array|number|string]",[c,d],arguments.length),typeof c=="object"?Object.keys(c).forEach(g=>{o.implies(g,c[g])}):(e.global(c),s[c]||(s[c]=[]),Array.isArray(d)?d.forEach(g=>o.implies(c,g)):(
|
61
|
-
`;d.forEach(A=>{g+=A}),t.fail(g)}};let l={};o.conflicts=function(c,d){I("<string|object> [array|string]",[c,d],arguments.length),typeof c=="object"?Object.keys(c).forEach(g=>{o.conflicts(g,c[g])}):(e.global(c),l[c]||(l[c]=[]),Array.isArray(d)?d.forEach(g=>o.conflicts(c,g)):l[c].push(d))},o.getConflicting=()=>l,o.conflicting=function(c){Object.keys(c).forEach(d=>{l[d]&&l[d].forEach(g=>{g&&c[d]!==void 0&&c[g]!==void 0&&t.fail(i("Arguments %s and %s are mutually exclusive",d,g))})}),e.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(l).forEach(d=>{l[d].forEach(g=>{g&&c[n.Parser.camelCase(d)]!==void 0&&c[n.Parser.camelCase(g)]!==void 0&&t.fail(i("Arguments %s and %s are mutually exclusive",d,g))})})},o.recommendCommands=function(c,d){d=d.sort((m,E)=>E.length-m.length);let A=null,w=1/0;for(let m=0,E;(E=d[m])!==void 0;m++){let _=Fr(c,E);_<=3&&_<w&&(w=_,A=E)}A&&t.fail(i("Did you mean %s?",A))},o.reset=function(c){return s=ke(s,d=>!c[d]),l=ke(l,d=>!c[d]),o};let u=[];return o.freeze=function(){u.push({implied:s,conflicting:l})},o.unfreeze=function(){let c=u.pop();ye(c,void 0,n),{implied:s,conflicting:l}=c},o}x();var fi=[],on;function On(e,t,n,i){on=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=Ua(t,e.extends);else try{s=De.resolve(e.extends)}catch(a){return e}$a(s),fi.push(s),r=o?JSON.parse(on.readFileSync(s,"utf8")):De(e.extends),delete e.extends,r=On(r,on.path.dirname(s),n,on)}return fi=[],n?Dr(r,e):Object.assign({},r,e)}function $a(e){if(fi.indexOf(e)>-1)throw new J(`Circular extended configurations: '${e}'.`)}function Ua(e,t){return on.path.resolve(e,t)}function Dr(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]=Dr(e[r],t[r]):n[r]=t[r];return n}var j=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},f=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)},fe,Ot,sn,Se,xe,Sn,Qe,St,En,Ee,In,Ie,Ne,ve,je,Bt,he,L,jn,Pn,_e,Et,zt,It,Ze,Fn,H,jt,Pt,Ft,Y,Te,se;function Zr(e){return(t=[],n=e.process.cwd(),i)=>{let r=new Xr(t,n,i,e);return Object.defineProperty(r,"argv",{get:()=>r.parse(),enumerable:!0}),r.help(),r.version(),r}}var Nr=Symbol("copyDoubleDash"),Tr=Symbol("copyDoubleDash"),ci=Symbol("deleteFromParserHintObject"),Rr=Symbol("emitWarning"),$r=Symbol("freeze"),Ur=Symbol("getDollarZero"),Lt=Symbol("getParserConfiguration"),ui=Symbol("guessLocale"),Hr=Symbol("guessVersion"),Wr=Symbol("parsePositionalNumbers"),pi=Symbol("pkgUp"),Xe=Symbol("populateParserHintArray"),Gt=Symbol("populateParserHintSingleValueDictionary"),di=Symbol("populateParserHintArrayDictionary"),hi=Symbol("populateParserHintDictionary"),mi=Symbol("sanitizeKey"),gi=Symbol("setKey"),bi=Symbol("unfreeze"),Yr=Symbol("validateAsync"),Br=Symbol("getCommandInstance"),zr=Symbol("getContext"),Gr=Symbol("getHasOutput"),qr=Symbol("getLoggerInstance"),Kr=Symbol("getParseContext"),Vr=Symbol("getUsageInstance"),kr=Symbol("getValidationInstance"),Ln=Symbol("hasParseCallback"),Mt=Symbol("postProcess"),Jr=Symbol("rebase"),yi=Symbol("reset"),an=Symbol("runYargsParserAndExecuteCommands"),wi=Symbol("runValidation"),Qr=Symbol("setHasOutput"),Dt=Symbol("kTrackManuallySetKeys"),Xr=class{constructor(t=[],n,i,r){this.customScriptName=!1,this.parsed=!1,fe.set(this,void 0),Ot.set(this,void 0),sn.set(this,{commands:[],fullCommands:[]}),Se.set(this,null),xe.set(this,null),Sn.set(this,"show-hidden"),Qe.set(this,null),St.set(this,!0),En.set(this,{}),Ee.set(this,!0),In.set(this,[]),Ie.set(this,void 0),Ne.set(this,{}),ve.set(this,!1),je.set(this,null),Bt.set(this,void 0),he.set(this,""),L.set(this,void 0),jn.set(this,void 0),Pn.set(this,{}),_e.set(this,null),Et.set(this,null),zt.set(this,{}),It.set(this,{}),Ze.set(this,void 0),Fn.set(this,!1),H.set(this,void 0),jt.set(this,!1),Pt.set(this,!1),Ft.set(this,!1),Y.set(this,void 0),Te.set(this,null),se.set(this,void 0),j(this,H,r,"f"),j(this,Ze,t,"f"),j(this,Ot,n,"f"),j(this,jn,i,"f"),j(this,Ie,new si(this),"f"),this.$0=this[Ur](),this[yi](),j(this,fe,f(this,fe,"f"),"f"),j(this,Y,f(this,Y,"f"),"f"),j(this,se,f(this,se,"f"),"f"),j(this,L,f(this,L,"f"),"f"),f(this,L,"f").showHiddenOpt=f(this,Sn,"f"),j(this,Bt,this[Tr](),"f")}addHelpOpt(t,n){let i="help";return I("[string|boolean] [string]",[t,n],arguments.length),f(this,je,"f")&&(this[ci](f(this,je,"f")),j(this,je,null,"f")),t===!1&&n===void 0?this:(j(this,je,typeof t=="string"?t:i,"f"),this.boolean(f(this,je,"f")),this.describe(f(this,je,"f"),n||f(this,Y,"f").deferY18nLookup("Show help")),this)}help(t,n){return this.addHelpOpt(t,n)}addShowHiddenOpt(t,n){if(I("[string|boolean] [string]",[t,n],arguments.length),t===!1&&n===void 0)return this;let i=typeof t=="string"?t:f(this,Sn,"f");return this.boolean(i),this.describe(i,n||f(this,Y,"f").deferY18nLookup("Show hidden options")),f(this,L,"f").showHiddenOpt=i,this}showHidden(t,n){return this.addShowHiddenOpt(t,n)}alias(t,n){return I("<object|string|array> [string|array]",[t,n],arguments.length),this[di](this.alias.bind(this),"alias",t,n),this}array(t){return I("<array|string>",[t],arguments.length),this[Xe]("array",t),this[Dt](t),this}boolean(t){return I("<array|string>",[t],arguments.length),this[Xe]("boolean",t),this[Dt](t),this}check(t,n){return I("<function> [boolean]",[t,n],arguments.length),this.middleware((i,r)=>_t(()=>t(i,r.getOptions()),o=>(o?(typeof o=="string"||o instanceof Error)&&f(this,Y,"f").fail(o.toString(),o):f(this,Y,"f").fail(f(this,H,"f").y18n.__("Argument check failed: %s",t.toString())),i),o=>(f(this,Y,"f").fail(o.message?o.message:o.toString(),o),i)),!1,n),this}choices(t,n){return I("<object|string|array> [string|array]",[t,n],arguments.length),this[di](this.choices.bind(this),"choices",t,n),this}coerce(t,n){if(I("<object|string|array> [function]",[t,n],arguments.length),Array.isArray(t)){if(!n)throw new J("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 J("coerce callback must be provided");return f(this,L,"f").key[t]=!0,f(this,Ie,"f").addCoerceMiddleware((i,r)=>{let o;return _t(()=>(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 J(s.message)})},t),this}conflicts(t,n){return I("<string|object> [string|array]",[t,n],arguments.length),f(this,se,"f").conflicts(t,n),this}config(t="config",n,i){return I("[object|string] [string|function] [function]",[t,n,i],arguments.length),typeof t=="object"&&!Array.isArray(t)?(t=On(t,f(this,Ot,"f"),this[Lt]()["deep-merge-config"]||!1,f(this,H,"f")),f(this,L,"f").configObjects=(f(this,L,"f").configObjects||[]).concat(t),this):(typeof n=="function"&&(i=n,n=void 0),this.describe(t,n||f(this,Y,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach(r=>{f(this,L,"f").config[r]=i||!0}),this)}completion(t,n,i){return I("[string] [string|boolean|function] [function]",[t,n,i],arguments.length),typeof n=="function"&&(i=n,n=void 0),j(this,xe,t||f(this,xe,"f")||"completion","f"),!n&&n!==!1&&(n="generate completion script"),this.command(f(this,xe,"f"),n),i&&f(this,Se,"f").registerFunction(i),this}command(t,n,i,r,o,s){return I("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[t,n,i,r,o,s],arguments.length),f(this,fe,"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){I("<string> [object]",[t,n],arguments.length);let i=f(this,jn,"f")||f(this,H,"f").require;return f(this,fe,"f").addDirectory(t,i,f(this,H,"f").getCallerFile(),n),this}count(t){return I("<array|string>",[t],arguments.length),this[Xe]("count",t),this[Dt](t),this}default(t,n,i){return I("<object|string|array> [*] [string]",[t,n,i],arguments.length),i&&(oi(t,f(this,H,"f")),f(this,L,"f").defaultDescription[t]=i),typeof n=="function"&&(oi(t,f(this,H,"f")),f(this,L,"f").defaultDescription[t]||(f(this,L,"f").defaultDescription[t]=f(this,Y,"f").functionDescription(n)),n=n.call()),this[Gt](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 I("[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),f(this,L,"f").demandedCommands._={min:t,max:n,minMsg:i,maxMsg:r},this}demand(t,n,i){return Array.isArray(n)?(n.forEach(r=>{ye(i,!0,f(this,H,"f")),this.demandOption(r,i)}),n=1/0):typeof n!="number"&&(i=n,n=1/0),typeof t=="number"?(ye(i,!0,f(this,H,"f")),this.demandCommand(t,n,i,i)):Array.isArray(t)?t.forEach(r=>{ye(i,!0,f(this,H,"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 I("<object|string|array> [string]",[t,n],arguments.length),this[Gt](this.demandOption.bind(this),"demandedOptions",t,n),this}deprecateOption(t,n){return I("<string> [string|boolean]",[t,n],arguments.length),f(this,L,"f").deprecatedOptions[t]=n,this}describe(t,n){return I("<object|string|array> [string]",[t,n],arguments.length),this[gi](t,!0),f(this,Y,"f").describe(t,n),this}detectLocale(t){return I("<boolean>",[t],arguments.length),j(this,St,t,"f"),this}env(t){return I("[string|boolean]",[t],arguments.length),t===!1?delete f(this,L,"f").envPrefix:f(this,L,"f").envPrefix=t||"",this}epilogue(t){return I("<string>",[t],arguments.length),f(this,Y,"f").epilog(t),this}epilog(t){return this.epilogue(t)}example(t,n){return I("<string|array> [string]",[t,n],arguments.length),Array.isArray(t)?t.forEach(i=>this.example(...i)):f(this,Y,"f").example(t,n),this}exit(t,n){j(this,ve,!0,"f"),j(this,Qe,n,"f"),f(this,Ee,"f")&&f(this,H,"f").process.exit(t)}exitProcess(t=!0){return I("[boolean]",[t],arguments.length),j(this,Ee,t,"f"),this}fail(t){if(I("<function|boolean>",[t],arguments.length),typeof t=="boolean"&&t!==!1)throw new J("Invalid first argument. Expected function or boolean 'false'");return f(this,Y,"f").failFn(t),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(t,n){return I("<array> [function]",[t,n],arguments.length),n?f(this,Se,"f").getCompletion(t,n):new Promise((i,r)=>{f(this,Se,"f").getCompletion(t,(o,s)=>{o?r(o):i(s)})})}getDemandedOptions(){return I([],0),f(this,L,"f").demandedOptions}getDemandedCommands(){return I([],0),f(this,L,"f").demandedCommands}getDeprecatedOptions(){return I([],0),f(this,L,"f").deprecatedOptions}getDetectLocale(){return f(this,St,"f")}getExitProcess(){return f(this,Ee,"f")}getGroups(){return Object.assign({},f(this,Ne,"f"),f(this,It,"f"))}getHelp(){if(j(this,ve,!0,"f"),!f(this,Y,"f").hasCachedHelpMessage()){if(!this.parsed){let n=this[an](f(this,Ze,"f"),void 0,void 0,0,!0);if(ee(n))return n.then(()=>f(this,Y,"f").help())}let t=f(this,fe,"f").runDefaultBuilderOn(this);if(ee(t))return t.then(()=>f(this,Y,"f").help())}return Promise.resolve(f(this,Y,"f").help())}getOptions(){return f(this,L,"f")}getStrict(){return f(this,jt,"f")}getStrictCommands(){return f(this,Pt,"f")}getStrictOptions(){return f(this,Ft,"f")}global(t,n){return I("<string|array> [boolean]",[t,n],arguments.length),t=[].concat(t),n!==!1?f(this,L,"f").local=f(this,L,"f").local.filter(i=>t.indexOf(i)===-1):t.forEach(i=>{f(this,L,"f").local.includes(i)||f(this,L,"f").local.push(i)}),this}group(t,n){I("<string|array> <string>",[t,n],arguments.length);let i=f(this,It,"f")[n]||f(this,Ne,"f")[n];f(this,It,"f")[n]&&delete f(this,It,"f")[n];let r={};return f(this,Ne,"f")[n]=(i||[]).concat(t).filter(o=>r[o]?!1:r[o]=!0),this}hide(t){return I("<string>",[t],arguments.length),f(this,L,"f").hiddenOptions.push(t),this}implies(t,n){return I("<string|object> [number|string|array]",[t,n],arguments.length),f(this,se,"f").implies(t,n),this}locale(t){return I("[string]",[t],arguments.length),t?(j(this,St,!1,"f"),f(this,H,"f").y18n.setLocale(t),this):(this[ui](),f(this,H,"f").y18n.getLocale())}middleware(t,n,i){return f(this,Ie,"f").addMiddleware(t,!!n,i)}nargs(t,n){return I("<string|object|array> [number]",[t,n],arguments.length),this[Gt](this.nargs.bind(this),"narg",t,n),this}normalize(t){return I("<array|string>",[t],arguments.length),this[Xe]("normalize",t),this}number(t){return I("<array|string>",[t],arguments.length),this[Xe]("number",t),this[Dt](t),this}option(t,n){if(I("<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[Dt](t),f(this,Te,"f")&&(t==="version"||(n==null?void 0:n.alias)==="version")&&this[Rr](['"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"),f(this,L,"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&&(f(this,L,"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){I("[string|array] [function|boolean|object] [function]",[t,n,i],arguments.length),this[
|
59
|
+
`)}`:"";t.fail(r("Missing required argument: %s","Missing required arguments: %s",Object.keys(g).length,Object.keys(g).join(", ")+w))}},o.unknownArguments=function(c,d,g,A,w=!0){var m;let S=e.getInternalMethods().getCommandInstance().getCommands(),_=[],B=e.getInternalMethods().getContext();if(Object.keys(c).forEach(z=>{!Mr.includes(z)&&!Object.prototype.hasOwnProperty.call(g,z)&&!Object.prototype.hasOwnProperty.call(e.getInternalMethods().getParseContext(),z)&&!o.isValidAndSomeAliasIsNotNew(z,d)&&_.push(z)}),w&&(B.commands.length>0||S.length>0||A)&&c._.slice(B.commands.length).forEach(z=>{S.includes(""+z)||_.push(""+z)}),w){let K=((m=e.getDemandedCommands()._)===null||m===void 0?void 0:m.max)||0,Ke=B.commands.length+K;Ke<c._.length&&c._.slice(Ke).forEach(Pe=>{Pe=String(Pe),!B.commands.includes(Pe)&&!_.includes(Pe)&&_.push(Pe)})}_.length&&t.fail(r("Unknown argument: %s","Unknown arguments: %s",_.length,_.join(", ")))},o.unknownCommands=function(c){let d=e.getInternalMethods().getCommandInstance().getCommands(),g=[],A=e.getInternalMethods().getContext();return(A.commands.length>0||d.length>0)&&c._.slice(A.commands.length).forEach(w=>{d.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(c,d){if(!Object.prototype.hasOwnProperty.call(d,c))return!1;let g=e.parsed.newAliases;return[c,...d[c]].some(A=>!Object.prototype.hasOwnProperty.call(g,A)||!g[c])},o.limitedChoices=function(c){let d=e.getOptions(),g={};if(!Object.keys(d.choices).length)return;Object.keys(c).forEach(m=>{Mr.indexOf(m)===-1&&Object.prototype.hasOwnProperty.call(d.choices,m)&&[].concat(c[m]).forEach(S=>{d.choices[m].indexOf(S)===-1&&S!==void 0&&(g[m]=(g[m]||[]).concat(S))})});let A=Object.keys(g);if(!A.length)return;let w=i("Invalid values:");A.forEach(m=>{w+=`
|
60
|
+
${i("Argument: %s, Given: %s, Choices: %s",m,t.stringifiedValues(g[m]),t.stringifiedValues(d.choices[m]))}`}),t.fail(w)};let s={};o.implies=function(c,d){I("<string|object> [array|number|string]",[c,d],arguments.length),typeof c=="object"?Object.keys(c).forEach(g=>{o.implies(g,c[g])}):(e.global(c),s[c]||(s[c]=[]),Array.isArray(d)?d.forEach(g=>o.implies(c,g)):(be(d,void 0,n),s[c].push(d)))},o.getImplied=function(){return s};function a(p,c){let d=Number(c);return c=isNaN(d)?c:d,typeof c=="number"?c=p._.length>=c:c.match(/^--no-.+/)?(c=c.match(/^--no-(.+)/)[1],c=!Object.prototype.hasOwnProperty.call(p,c)):c=Object.prototype.hasOwnProperty.call(p,c),c}o.implications=function(c){let d=[];if(Object.keys(s).forEach(g=>{let A=g;(s[g]||[]).forEach(w=>{let m=A,S=w;m=a(c,m),w=a(c,w),m&&!w&&d.push(` ${A} -> ${S}`)})}),d.length){let g=`${i("Implications failed:")}
|
61
|
+
`;d.forEach(A=>{g+=A}),t.fail(g)}};let l={};o.conflicts=function(c,d){I("<string|object> [array|string]",[c,d],arguments.length),typeof c=="object"?Object.keys(c).forEach(g=>{o.conflicts(g,c[g])}):(e.global(c),l[c]||(l[c]=[]),Array.isArray(d)?d.forEach(g=>o.conflicts(c,g)):l[c].push(d))},o.getConflicting=()=>l,o.conflicting=function(c){Object.keys(c).forEach(d=>{l[d]&&l[d].forEach(g=>{g&&c[d]!==void 0&&c[g]!==void 0&&t.fail(i("Arguments %s and %s are mutually exclusive",d,g))})}),e.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(l).forEach(d=>{l[d].forEach(g=>{g&&c[n.Parser.camelCase(d)]!==void 0&&c[n.Parser.camelCase(g)]!==void 0&&t.fail(i("Arguments %s and %s are mutually exclusive",d,g))})})},o.recommendCommands=function(c,d){d=d.sort((m,S)=>S.length-m.length);let A=null,w=1/0;for(let m=0,S;(S=d[m])!==void 0;m++){let _=Lr(c,S);_<=3&&_<w&&(w=_,A=S)}A&&t.fail(i("Did you mean %s?",A))},o.reset=function(c){return s=ke(s,d=>!c[d]),l=ke(l,d=>!c[d]),o};let u=[];return o.freeze=function(){u.push({implied:s,conflicting:l})},o.unfreeze=function(){let c=u.pop();be(c,void 0,n),{implied:s,conflicting:l}=c},o}x();var ci=[],on;function On(e,t,n,i){on=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=Ha(t,e.extends);else try{s=De.resolve(e.extends)}catch(a){return e}Ua(s),ci.push(s),r=o?JSON.parse(on.readFileSync(s,"utf8")):De(e.extends),delete e.extends,r=On(r,on.path.dirname(s),n,on)}return ci=[],n?Nr(r,e):Object.assign({},r,e)}function Ua(e){if(ci.indexOf(e)>-1)throw new J(`Circular extended configurations: '${e}'.`)}function Ha(e,t){return on.path.resolve(e,t)}function Nr(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]=Nr(e[r],t[r]):n[r]=t[r];return n}var j=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},f=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)},fe,Ot,sn,Se,xe,Sn,Qe,St,En,Ee,In,Ie,Ne,ve,je,Bt,he,L,jn,Pn,_e,Et,zt,It,Ze,Fn,H,jt,Pt,Ft,Y,Te,se;function Xr(e){return(t=[],n=e.process.cwd(),i)=>{let r=new eo(t,n,i,e);return Object.defineProperty(r,"argv",{get:()=>r.parse(),enumerable:!0}),r.help(),r.version(),r}}var Tr=Symbol("copyDoubleDash"),Rr=Symbol("copyDoubleDash"),ui=Symbol("deleteFromParserHintObject"),$r=Symbol("emitWarning"),Ur=Symbol("freeze"),Hr=Symbol("getDollarZero"),Lt=Symbol("getParserConfiguration"),pi=Symbol("guessLocale"),Wr=Symbol("guessVersion"),Yr=Symbol("parsePositionalNumbers"),di=Symbol("pkgUp"),Xe=Symbol("populateParserHintArray"),Gt=Symbol("populateParserHintSingleValueDictionary"),hi=Symbol("populateParserHintArrayDictionary"),mi=Symbol("populateParserHintDictionary"),gi=Symbol("sanitizeKey"),yi=Symbol("setKey"),bi=Symbol("unfreeze"),Br=Symbol("validateAsync"),zr=Symbol("getCommandInstance"),Gr=Symbol("getContext"),qr=Symbol("getHasOutput"),Kr=Symbol("getLoggerInstance"),Vr=Symbol("getParseContext"),kr=Symbol("getUsageInstance"),Jr=Symbol("getValidationInstance"),Ln=Symbol("hasParseCallback"),Mt=Symbol("postProcess"),Qr=Symbol("rebase"),wi=Symbol("reset"),an=Symbol("runYargsParserAndExecuteCommands"),Ai=Symbol("runValidation"),Zr=Symbol("setHasOutput"),Dt=Symbol("kTrackManuallySetKeys"),eo=class{constructor(t=[],n,i,r){this.customScriptName=!1,this.parsed=!1,fe.set(this,void 0),Ot.set(this,void 0),sn.set(this,{commands:[],fullCommands:[]}),Se.set(this,null),xe.set(this,null),Sn.set(this,"show-hidden"),Qe.set(this,null),St.set(this,!0),En.set(this,{}),Ee.set(this,!0),In.set(this,[]),Ie.set(this,void 0),Ne.set(this,{}),ve.set(this,!1),je.set(this,null),Bt.set(this,void 0),he.set(this,""),L.set(this,void 0),jn.set(this,void 0),Pn.set(this,{}),_e.set(this,null),Et.set(this,null),zt.set(this,{}),It.set(this,{}),Ze.set(this,void 0),Fn.set(this,!1),H.set(this,void 0),jt.set(this,!1),Pt.set(this,!1),Ft.set(this,!1),Y.set(this,void 0),Te.set(this,null),se.set(this,void 0),j(this,H,r,"f"),j(this,Ze,t,"f"),j(this,Ot,n,"f"),j(this,jn,i,"f"),j(this,Ie,new ai(this),"f"),this.$0=this[Hr](),this[wi](),j(this,fe,f(this,fe,"f"),"f"),j(this,Y,f(this,Y,"f"),"f"),j(this,se,f(this,se,"f"),"f"),j(this,L,f(this,L,"f"),"f"),f(this,L,"f").showHiddenOpt=f(this,Sn,"f"),j(this,Bt,this[Rr](),"f")}addHelpOpt(t,n){let i="help";return I("[string|boolean] [string]",[t,n],arguments.length),f(this,je,"f")&&(this[ui](f(this,je,"f")),j(this,je,null,"f")),t===!1&&n===void 0?this:(j(this,je,typeof t=="string"?t:i,"f"),this.boolean(f(this,je,"f")),this.describe(f(this,je,"f"),n||f(this,Y,"f").deferY18nLookup("Show help")),this)}help(t,n){return this.addHelpOpt(t,n)}addShowHiddenOpt(t,n){if(I("[string|boolean] [string]",[t,n],arguments.length),t===!1&&n===void 0)return this;let i=typeof t=="string"?t:f(this,Sn,"f");return this.boolean(i),this.describe(i,n||f(this,Y,"f").deferY18nLookup("Show hidden options")),f(this,L,"f").showHiddenOpt=i,this}showHidden(t,n){return this.addShowHiddenOpt(t,n)}alias(t,n){return I("<object|string|array> [string|array]",[t,n],arguments.length),this[hi](this.alias.bind(this),"alias",t,n),this}array(t){return I("<array|string>",[t],arguments.length),this[Xe]("array",t),this[Dt](t),this}boolean(t){return I("<array|string>",[t],arguments.length),this[Xe]("boolean",t),this[Dt](t),this}check(t,n){return I("<function> [boolean]",[t,n],arguments.length),this.middleware((i,r)=>_t(()=>t(i,r.getOptions()),o=>(o?(typeof o=="string"||o instanceof Error)&&f(this,Y,"f").fail(o.toString(),o):f(this,Y,"f").fail(f(this,H,"f").y18n.__("Argument check failed: %s",t.toString())),i),o=>(f(this,Y,"f").fail(o.message?o.message:o.toString(),o),i)),!1,n),this}choices(t,n){return I("<object|string|array> [string|array]",[t,n],arguments.length),this[hi](this.choices.bind(this),"choices",t,n),this}coerce(t,n){if(I("<object|string|array> [function]",[t,n],arguments.length),Array.isArray(t)){if(!n)throw new J("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 J("coerce callback must be provided");return f(this,L,"f").key[t]=!0,f(this,Ie,"f").addCoerceMiddleware((i,r)=>{let o;return _t(()=>(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 J(s.message)})},t),this}conflicts(t,n){return I("<string|object> [string|array]",[t,n],arguments.length),f(this,se,"f").conflicts(t,n),this}config(t="config",n,i){return I("[object|string] [string|function] [function]",[t,n,i],arguments.length),typeof t=="object"&&!Array.isArray(t)?(t=On(t,f(this,Ot,"f"),this[Lt]()["deep-merge-config"]||!1,f(this,H,"f")),f(this,L,"f").configObjects=(f(this,L,"f").configObjects||[]).concat(t),this):(typeof n=="function"&&(i=n,n=void 0),this.describe(t,n||f(this,Y,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach(r=>{f(this,L,"f").config[r]=i||!0}),this)}completion(t,n,i){return I("[string] [string|boolean|function] [function]",[t,n,i],arguments.length),typeof n=="function"&&(i=n,n=void 0),j(this,xe,t||f(this,xe,"f")||"completion","f"),!n&&n!==!1&&(n="generate completion script"),this.command(f(this,xe,"f"),n),i&&f(this,Se,"f").registerFunction(i),this}command(t,n,i,r,o,s){return I("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[t,n,i,r,o,s],arguments.length),f(this,fe,"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){I("<string> [object]",[t,n],arguments.length);let i=f(this,jn,"f")||f(this,H,"f").require;return f(this,fe,"f").addDirectory(t,i,f(this,H,"f").getCallerFile(),n),this}count(t){return I("<array|string>",[t],arguments.length),this[Xe]("count",t),this[Dt](t),this}default(t,n,i){return I("<object|string|array> [*] [string]",[t,n,i],arguments.length),i&&(si(t,f(this,H,"f")),f(this,L,"f").defaultDescription[t]=i),typeof n=="function"&&(si(t,f(this,H,"f")),f(this,L,"f").defaultDescription[t]||(f(this,L,"f").defaultDescription[t]=f(this,Y,"f").functionDescription(n)),n=n.call()),this[Gt](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 I("[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),f(this,L,"f").demandedCommands._={min:t,max:n,minMsg:i,maxMsg:r},this}demand(t,n,i){return Array.isArray(n)?(n.forEach(r=>{be(i,!0,f(this,H,"f")),this.demandOption(r,i)}),n=1/0):typeof n!="number"&&(i=n,n=1/0),typeof t=="number"?(be(i,!0,f(this,H,"f")),this.demandCommand(t,n,i,i)):Array.isArray(t)?t.forEach(r=>{be(i,!0,f(this,H,"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 I("<object|string|array> [string]",[t,n],arguments.length),this[Gt](this.demandOption.bind(this),"demandedOptions",t,n),this}deprecateOption(t,n){return I("<string> [string|boolean]",[t,n],arguments.length),f(this,L,"f").deprecatedOptions[t]=n,this}describe(t,n){return I("<object|string|array> [string]",[t,n],arguments.length),this[yi](t,!0),f(this,Y,"f").describe(t,n),this}detectLocale(t){return I("<boolean>",[t],arguments.length),j(this,St,t,"f"),this}env(t){return I("[string|boolean]",[t],arguments.length),t===!1?delete f(this,L,"f").envPrefix:f(this,L,"f").envPrefix=t||"",this}epilogue(t){return I("<string>",[t],arguments.length),f(this,Y,"f").epilog(t),this}epilog(t){return this.epilogue(t)}example(t,n){return I("<string|array> [string]",[t,n],arguments.length),Array.isArray(t)?t.forEach(i=>this.example(...i)):f(this,Y,"f").example(t,n),this}exit(t,n){j(this,ve,!0,"f"),j(this,Qe,n,"f"),f(this,Ee,"f")&&f(this,H,"f").process.exit(t)}exitProcess(t=!0){return I("[boolean]",[t],arguments.length),j(this,Ee,t,"f"),this}fail(t){if(I("<function|boolean>",[t],arguments.length),typeof t=="boolean"&&t!==!1)throw new J("Invalid first argument. Expected function or boolean 'false'");return f(this,Y,"f").failFn(t),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(t,n){return I("<array> [function]",[t,n],arguments.length),n?f(this,Se,"f").getCompletion(t,n):new Promise((i,r)=>{f(this,Se,"f").getCompletion(t,(o,s)=>{o?r(o):i(s)})})}getDemandedOptions(){return I([],0),f(this,L,"f").demandedOptions}getDemandedCommands(){return I([],0),f(this,L,"f").demandedCommands}getDeprecatedOptions(){return I([],0),f(this,L,"f").deprecatedOptions}getDetectLocale(){return f(this,St,"f")}getExitProcess(){return f(this,Ee,"f")}getGroups(){return Object.assign({},f(this,Ne,"f"),f(this,It,"f"))}getHelp(){if(j(this,ve,!0,"f"),!f(this,Y,"f").hasCachedHelpMessage()){if(!this.parsed){let n=this[an](f(this,Ze,"f"),void 0,void 0,0,!0);if(ee(n))return n.then(()=>f(this,Y,"f").help())}let t=f(this,fe,"f").runDefaultBuilderOn(this);if(ee(t))return t.then(()=>f(this,Y,"f").help())}return Promise.resolve(f(this,Y,"f").help())}getOptions(){return f(this,L,"f")}getStrict(){return f(this,jt,"f")}getStrictCommands(){return f(this,Pt,"f")}getStrictOptions(){return f(this,Ft,"f")}global(t,n){return I("<string|array> [boolean]",[t,n],arguments.length),t=[].concat(t),n!==!1?f(this,L,"f").local=f(this,L,"f").local.filter(i=>t.indexOf(i)===-1):t.forEach(i=>{f(this,L,"f").local.includes(i)||f(this,L,"f").local.push(i)}),this}group(t,n){I("<string|array> <string>",[t,n],arguments.length);let i=f(this,It,"f")[n]||f(this,Ne,"f")[n];f(this,It,"f")[n]&&delete f(this,It,"f")[n];let r={};return f(this,Ne,"f")[n]=(i||[]).concat(t).filter(o=>r[o]?!1:r[o]=!0),this}hide(t){return I("<string>",[t],arguments.length),f(this,L,"f").hiddenOptions.push(t),this}implies(t,n){return I("<string|object> [number|string|array]",[t,n],arguments.length),f(this,se,"f").implies(t,n),this}locale(t){return I("[string]",[t],arguments.length),t?(j(this,St,!1,"f"),f(this,H,"f").y18n.setLocale(t),this):(this[pi](),f(this,H,"f").y18n.getLocale())}middleware(t,n,i){return f(this,Ie,"f").addMiddleware(t,!!n,i)}nargs(t,n){return I("<string|object|array> [number]",[t,n],arguments.length),this[Gt](this.nargs.bind(this),"narg",t,n),this}normalize(t){return I("<array|string>",[t],arguments.length),this[Xe]("normalize",t),this}number(t){return I("<array|string>",[t],arguments.length),this[Xe]("number",t),this[Dt](t),this}option(t,n){if(I("<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[Dt](t),f(this,Te,"f")&&(t==="version"||(n==null?void 0:n.alias)==="version")&&this[$r](['"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"),f(this,L,"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&&(f(this,L,"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){I("[string|array] [function|boolean|object] [function]",[t,n,i],arguments.length),this[Ur](),typeof t=="undefined"&&(t=f(this,Ze,"f")),typeof n=="object"&&(j(this,Et,n,"f"),n=i),typeof n=="function"&&(j(this,_e,n,"f"),n=!1),n||j(this,Ze,t,"f"),f(this,_e,"f")&&j(this,Ee,!1,"f");let r=this[an](t,!!n),o=this.parsed;return f(this,Se,"f").setParsed(this.parsed),ee(r)?r.then(s=>(f(this,_e,"f")&&f(this,_e,"f").call(this,f(this,Qe,"f"),s,f(this,he,"f")),s)).catch(s=>{throw f(this,_e,"f")&&f(this,_e,"f")(s,this.parsed.argv,f(this,he,"f")),s}).finally(()=>{this[bi](),this.parsed=o}):(f(this,_e,"f")&&f(this,_e,"f").call(this,f(this,Qe,"f"),r,f(this,he,"f")),this[bi](),this.parsed=o,r)}parseAsync(t,n,i){let r=this.parse(t,n,i);return ee(r)?r:Promise.resolve(r)}parseSync(t,n,i){let r=this.parse(t,n,i);if(ee(r))throw new J(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return r}parserConfiguration(t){return I("<object>",[t],arguments.length),j(this,Pn,t,"f"),this}pkgConf(t,n){I("<string> [string]",[t,n],arguments.length);let i=null,r=this[di](n||f(this,Ot,"f"));return r[t]&&typeof r[t]=="object"&&(i=On(r[t],n||f(this,Ot,"f"),this[Lt]()["deep-merge-config"]||!1,f(this,H,"f")),f(this,L,"f").configObjects=(f(this,L,"f").configObjects||[]).concat(i)),this}positional(t,n){I("<string> <object>",[t,n],arguments.length);let i=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];n=ke(n,(s,a)=>s==="type"&&!["string","number","boolean"].includes(a)?!1:i.includes(s));let r=f(this,sn,"f").fullCommands[f(this,sn,"f").fullCommands.length-1],o=r?f(this,fe,"f").cmdToParseOptions(r):{array:[],alias:{},default:{},demand:{}};return Wt(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,f(this,Y,"f").getPositionalGroupName()),this.option(t,n)}recommendCommands(t=!0){return I("[boolean]",[t],arguments.length),j(this,Fn,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 I("<array|string|object> [number]",[t],arguments.length),typeof t=="string"&&f(this,L,"f").narg[t]?this:(this[Gt](this.requiresArg.bind(this),"narg",t,NaN),this)}showCompletionScript(t,n){return I("[string] [string]",[t,n],arguments.length),t=t||this.$0,f(this,Bt,"f").log(f(this,Se,"f").generateCompletionScript(t,n||f(this,xe,"f")||"completion")),this}showHelp(t){if(I("[string|function]",[t],arguments.length),j(this,ve,!0,"f"),!f(this,Y,"f").hasCachedHelpMessage()){if(!this.parsed){let i=this[an](f(this,Ze,"f"),void 0,void 0,0,!0);if(ee(i))return i.then(()=>{f(this,Y,"f").showHelp(t)}),this}let n=f(this,fe,"f").runDefaultBuilderOn(this);if(ee(n))return n.then(()=>{f(this,Y,"f").showHelp(t)}),this}return f(this,Y,"f").showHelp(t),this}scriptName(t){return this.customScriptName=!0,this.$0=t,this}showHelpOnFail(t,n){return I("[boolean|string] [string]",[t,n],arguments.length),f(this,Y,"f").showHelpOnFail(t,n),this}showVersion(t){return I("[string|function]",[t],arguments.length),f(this,Y,"f").showVersion(t),this}skipValidation(t){return I("<array|string>",[t],arguments.length),this[Xe]("skipValidation",t),this}strict(t){return I("[boolean]",[t],arguments.length),j(this,jt,t!==!1,"f"),this}strictCommands(t){return I("[boolean]",[t],arguments.length),j(this,Pt,t!==!1,"f"),this}strictOptions(t){return I("[boolean]",[t],arguments.length),j(this,Ft,t!==!1,"f"),this}string(t){return I("<array|string>",[t],arguments.length),this[Xe]("string",t),this[Dt](t),this}terminalWidth(){return I([],0),f(this,H,"f").process.stdColumns}updateLocale(t){return this.updateStrings(t)}updateStrings(t){return I("<object>",[t],arguments.length),j(this,St,!1,"f"),f(this,H,"f").y18n.updateLocale(t),this}usage(t,n,i,r){if(I("<string|null|undefined> [string|boolean] [function|object] [function]",[t,n,i,r],arguments.length),n!==void 0){if(be(t,null,f(this,H,"f")),(t||"").match(/^\$0( |$)/))return this.command(t,n,i,r);throw new J(".usage() description must start with $0 if being used as alias for .command()")}else return f(this,Y,"f").usage(t),this}version(t,n,i){let r="version";if(I("[boolean|string] [string] [string]",[t,n,i],arguments.length),f(this,Te,"f")&&(this[ui](f(this,Te,"f")),f(this,Y,"f").version(void 0),j(this,Te,null,"f")),arguments.length===0)i=this[Wr](),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 j(this,Te,typeof t=="string"?t:r,"f"),n=n||f(this,Y,"f").deferY18nLookup("Show version number"),f(this,Y,"f").version(i||void 0),this.boolean(f(this,Te,"f")),this.describe(f(this,Te,"f"),n),this}wrap(t){return I("<number|null|undefined>",[t],arguments.length),f(this,Y,"f").wrap(t),this}[(fe=new WeakMap,Ot=new WeakMap,sn=new WeakMap,Se=new WeakMap,xe=new WeakMap,Sn=new WeakMap,Qe=new WeakMap,St=new WeakMap,En=new WeakMap,Ee=new WeakMap,In=new WeakMap,Ie=new WeakMap,Ne=new WeakMap,ve=new WeakMap,je=new WeakMap,Bt=new WeakMap,he=new WeakMap,L=new WeakMap,jn=new WeakMap,Pn=new WeakMap,_e=new WeakMap,Et=new WeakMap,zt=new WeakMap,It=new WeakMap,Ze=new WeakMap,Fn=new WeakMap,H=new WeakMap,jt=new WeakMap,Pt=new WeakMap,Ft=new WeakMap,Y=new WeakMap,Te=new WeakMap,se=new WeakMap,Tr)](t){if(!t._||!t["--"])return t;t._.push.apply(t._,t["--"]);try{delete t["--"]}catch(n){}return t}[Rr](){return{log:(...t)=>{this[Ln]()||console.log(...t),j(this,ve,!0,"f"),f(this,he,"f").length&&j(this,he,f(this,he,"f")+`
|
63
63
|
`,"f"),j(this,he,f(this,he,"f")+t.join(" "),"f")},error:(...t)=>{this[Ln]()||console.error(...t),j(this,ve,!0,"f"),f(this,he,"f").length&&j(this,he,f(this,he,"f")+`
|
64
|
-
`,"f"),j(this,he,f(this,he,"f")+t.join(" "),"f")}}}[
|
64
|
+
`,"f"),j(this,he,f(this,he,"f")+t.join(" "),"f")}}}[ui](t){Wt(f(this,L,"f")).forEach(n=>{if((r=>r==="configObjects")(n))return;let i=f(this,L,"f")[n];Array.isArray(i)?i.includes(t)&&i.splice(i.indexOf(t),1):typeof i=="object"&&delete i[t]}),delete f(this,Y,"f").getDescriptions()[t]}[$r](t,n,i){f(this,En,"f")[i]||(f(this,H,"f").process.emitWarning(t,n),f(this,En,"f")[i]=!0)}[Ur](){f(this,In,"f").push({options:f(this,L,"f"),configObjects:f(this,L,"f").configObjects.slice(0),exitProcess:f(this,Ee,"f"),groups:f(this,Ne,"f"),strict:f(this,jt,"f"),strictCommands:f(this,Pt,"f"),strictOptions:f(this,Ft,"f"),completionCommand:f(this,xe,"f"),output:f(this,he,"f"),exitError:f(this,Qe,"f"),hasOutput:f(this,ve,"f"),parsed:this.parsed,parseFn:f(this,_e,"f"),parseContext:f(this,Et,"f")}),f(this,Y,"f").freeze(),f(this,se,"f").freeze(),f(this,fe,"f").freeze(),f(this,Ie,"f").freeze()}[Hr](){let t="",n;return/\b(node|iojs|electron)(\.exe)?$/.test(f(this,H,"f").process.argv()[0])?n=f(this,H,"f").process.argv().slice(1,2):n=f(this,H,"f").process.argv().slice(0,1),t=n.map(i=>{let r=this[Qr](f(this,Ot,"f"),i);return i.match(/^(\/|([a-zA-Z]:)?\\)/)&&r.length<i.length?r:i}).join(" ").trim(),f(this,H,"f").getEnv("_")&&f(this,H,"f").getProcessArgvBin()===f(this,H,"f").getEnv("_")&&(t=f(this,H,"f").getEnv("_").replace(`${f(this,H,"f").path.dirname(f(this,H,"f").process.execPath())}/`,"")),t}[Lt](){return f(this,Pn,"f")}[pi](){if(!f(this,St,"f"))return;let t=f(this,H,"f").getEnv("LC_ALL")||f(this,H,"f").getEnv("LC_MESSAGES")||f(this,H,"f").getEnv("LANG")||f(this,H,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[Wr](){return this[di]().version||"unknown"}[Yr](t){let n=t["--"]?t["--"]:t._;for(let i=0,r;(r=n[i])!==void 0;i++)f(this,H,"f").Parser.looksLikeNumber(r)&&Number.isSafeInteger(Math.floor(parseFloat(`${r}`)))&&(n[i]=Number(r));return t}[di](t){let n=t||"*";if(f(this,zt,"f")[n])return f(this,zt,"f")[n];let i={};try{let r=t||f(this,H,"f").mainFilename;!t&&f(this,H,"f").path.extname(r)&&(r=f(this,H,"f").path.dirname(r));let o=f(this,H,"f").findUp(r,(s,a)=>{if(a.includes("package.json"))return"package.json"});be(o,void 0,f(this,H,"f")),i=JSON.parse(f(this,H,"f").readFileSync(o,"utf8"))}catch(r){}return f(this,zt,"f")[n]=i||{},f(this,zt,"f")[n]}[Xe](t,n){n=[].concat(n),n.forEach(i=>{i=this[gi](i),f(this,L,"f")[t].push(i)})}[Gt](t,n,i,r){this[mi](t,n,i,r,(o,s,a)=>{f(this,L,"f")[o][s]=a})}[hi](t,n,i,r){this[mi](t,n,i,r,(o,s,a)=>{f(this,L,"f")[o][s]=(f(this,L,"f")[o][s]||[]).concat(a)})}[mi](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 Wt(i))t(s,i[s]);else o(n,this[gi](i),r)}[gi](t){return t==="__proto__"?"___proto___":t}[yi](t,n){return this[Gt](this[yi].bind(this),"key",t,n),this}[bi](){var t,n,i,r,o,s,a,l,u,p,c,d;let g=f(this,In,"f").pop();be(g,void 0,f(this,H,"f"));let A;t=this,n=this,i=this,r=this,o=this,s=this,a=this,l=this,u=this,p=this,c=this,d=this,{options:{set value(w){j(t,L,w,"f")}}.value,configObjects:A,exitProcess:{set value(w){j(n,Ee,w,"f")}}.value,groups:{set value(w){j(i,Ne,w,"f")}}.value,output:{set value(w){j(r,he,w,"f")}}.value,exitError:{set value(w){j(o,Qe,w,"f")}}.value,hasOutput:{set value(w){j(s,ve,w,"f")}}.value,parsed:this.parsed,strict:{set value(w){j(a,jt,w,"f")}}.value,strictCommands:{set value(w){j(l,Pt,w,"f")}}.value,strictOptions:{set value(w){j(u,Ft,w,"f")}}.value,completionCommand:{set value(w){j(p,xe,w,"f")}}.value,parseFn:{set value(w){j(c,_e,w,"f")}}.value,parseContext:{set value(w){j(d,Et,w,"f")}}.value}=g,f(this,L,"f").configObjects=A,f(this,Y,"f").unfreeze(),f(this,se,"f").unfreeze(),f(this,fe,"f").unfreeze(),f(this,Ie,"f").unfreeze()}[Br](t,n){return _t(n,i=>(t(i),i))}getInternalMethods(){return{getCommandInstance:this[zr].bind(this),getContext:this[Gr].bind(this),getHasOutput:this[qr].bind(this),getLoggerInstance:this[Kr].bind(this),getParseContext:this[Vr].bind(this),getParserConfiguration:this[Lt].bind(this),getUsageInstance:this[kr].bind(this),getValidationInstance:this[Jr].bind(this),hasParseCallback:this[Ln].bind(this),postProcess:this[Mt].bind(this),reset:this[wi].bind(this),runValidation:this[Ai].bind(this),runYargsParserAndExecuteCommands:this[an].bind(this),setHasOutput:this[Zr].bind(this)}}[zr](){return f(this,fe,"f")}[Gr](){return f(this,sn,"f")}[qr](){return f(this,ve,"f")}[Kr](){return f(this,Bt,"f")}[Vr](){return f(this,Et,"f")||{}}[kr](){return f(this,Y,"f")}[Jr](){return f(this,se,"f")}[Ln](){return!!f(this,_e,"f")}[Mt](t,n,i,r){return i||ee(t)||(n||(t=this[Tr](t)),(this[Lt]()["parse-positional-numbers"]||this[Lt]()["parse-positional-numbers"]===void 0)&&(t=this[Yr](t)),r&&(t=vt(t,this,f(this,Ie,"f").getMiddleware(),!1))),t}[wi](t={}){j(this,L,f(this,L,"f")||{},"f");let n={};n.local=f(this,L,"f").local||[],n.configObjects=f(this,L,"f").configObjects||[];let i={};n.local.forEach(s=>{i[s]=!0,(t[s]||[]).forEach(a=>{i[a]=!0})}),Object.assign(f(this,It,"f"),Object.keys(f(this,Ne,"f")).reduce((s,a)=>{let l=f(this,Ne,"f")[a].filter(u=>!(u in i));return l.length>0&&(s[a]=l),s},{})),j(this,Ne,{},"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]=(f(this,L,"f")[s]||[]).filter(a=>!i[a])}),o.forEach(s=>{n[s]=ke(f(this,L,"f")[s],a=>!i[a])}),n.envPrefix=f(this,L,"f").envPrefix,j(this,L,n,"f"),j(this,Y,f(this,Y,"f")?f(this,Y,"f").reset(i):Er(this,f(this,H,"f")),"f"),j(this,se,f(this,se,"f")?f(this,se,"f").reset(i):Dr(this,f(this,Y,"f"),f(this,H,"f")),"f"),j(this,fe,f(this,fe,"f")?f(this,fe,"f").reset():_r(f(this,Y,"f"),f(this,se,"f"),f(this,Ie,"f"),f(this,H,"f")),"f"),f(this,Se,"f")||j(this,Se,Fr(this,f(this,Y,"f"),f(this,fe,"f"),f(this,H,"f")),"f"),f(this,Ie,"f").reset(),j(this,xe,null,"f"),j(this,he,"","f"),j(this,Qe,null,"f"),j(this,ve,!1,"f"),this.parsed=!1,this}[Qr](t,n){return f(this,H,"f").path.relative(t,n)}[an](t,n,i,r=0,o=!1){let s=!!i||o;t=t||f(this,Ze,"f"),f(this,L,"f").__=f(this,H,"f").y18n.__,f(this,L,"f").configuration=this[Lt]();let a=!!f(this,L,"f").configuration["populate--"],l=Object.assign({},f(this,L,"f").configuration,{"populate--":!0}),u=f(this,H,"f").Parser.detailed(t,Object.assign({},f(this,L,"f"),{configuration:{"parse-positional-numbers":!1,...l}})),p=Object.assign(u.argv,f(this,Et,"f")),c,d=u.aliases,g=!1,A=!1;Object.keys(p).forEach(w=>{w===f(this,je,"f")&&p[w]?g=!0:w===f(this,Te,"f")&&p[w]&&(A=!0)}),p.$0=this.$0,this.parsed=u,r===0&&f(this,Y,"f").clearCachedHelpMessage();try{if(this[pi](),n)return this[Mt](p,a,!!i,!1);f(this,je,"f")&&[f(this,je,"f")].concat(d[f(this,je,"f")]||[]).filter(B=>B.length>1).includes(""+p._[p._.length-1])&&(p._.pop(),g=!0);let w=f(this,fe,"f").getCommands(),m=f(this,Se,"f").completionKey in p,S=g||m||o;if(p._.length){if(w.length){let _;for(let B=r||0,z;p._[B]!==void 0;B++)if(z=String(p._[B]),w.includes(z)&&z!==f(this,xe,"f")){let K=f(this,fe,"f").runCommand(z,this,u,B+1,o,g||A||o);return this[Mt](K,a,!!i,!1)}else if(!_&&z!==f(this,xe,"f")){_=z;break}!f(this,fe,"f").hasDefaultCommand()&&f(this,Fn,"f")&&_&&!S&&f(this,se,"f").recommendCommands(_,w)}f(this,xe,"f")&&p._.includes(f(this,xe,"f"))&&!m&&(f(this,Ee,"f")&&Je(!0),this.showCompletionScript(),this.exit(0))}if(f(this,fe,"f").hasDefaultCommand()&&!S){let _=f(this,fe,"f").runCommand(null,this,u,0,o,g||A||o);return this[Mt](_,a,!!i,!1)}if(m){f(this,Ee,"f")&&Je(!0),t=[].concat(t);let _=t.slice(t.indexOf(`--${f(this,Se,"f").completionKey}`)+1);return f(this,Se,"f").getCompletion(_,(B,z)=>{if(B)throw new J(B.message);(z||[]).forEach(K=>{f(this,Bt,"f").log(K)}),this.exit(0)}),this[Mt](p,!a,!!i,!1)}if(f(this,ve,"f")||(g?(f(this,Ee,"f")&&Je(!0),s=!0,this.showHelp("log"),this.exit(0)):A&&(f(this,Ee,"f")&&Je(!0),s=!0,f(this,Y,"f").showVersion("log"),this.exit(0))),!s&&f(this,L,"f").skipValidation.length>0&&(s=Object.keys(p).some(_=>f(this,L,"f").skipValidation.indexOf(_)>=0&&p[_]===!0)),!s){if(u.error)throw new J(u.error.message);if(!m){let _=this[Ai](d,{},u.error);i||(c=vt(p,this,f(this,Ie,"f").getMiddleware(),!0)),c=this[Br](_,c!=null?c:p),ee(c)&&!i&&(c=c.then(()=>vt(p,this,f(this,Ie,"f").getMiddleware(),!1)))}}}catch(w){if(w instanceof J)f(this,Y,"f").fail(w.message,w);else throw w}return this[Mt](c!=null?c:p,a,!!i,!0)}[Ai](t,n,i,r){let o={...this.getDemandedOptions()};return s=>{if(i)throw new J(i.message);f(this,se,"f").nonOptionCount(s),f(this,se,"f").requiredArguments(s,o);let a=!1;f(this,Pt,"f")&&(a=f(this,se,"f").unknownCommands(s)),f(this,jt,"f")&&!a?f(this,se,"f").unknownArguments(s,t,n,!!r):f(this,Ft,"f")&&f(this,se,"f").unknownArguments(s,t,{},!1,!1),f(this,se,"f").limitedChoices(s),f(this,se,"f").implications(s),f(this,se,"f").conflicting(s)}}[Zr](){j(this,ve,!0,"f")}[Dt](t){if(typeof t=="string")f(this,L,"f").key[t]=!0;else for(let n of t)f(this,L,"f").key[n]=!0}};function Or(e){return!!e&&typeof e.getInternalMethods=="function"}var Wa=Xr(br),qt=Wa;x();x();import zu from"isomorphic-unfetch";x();import Nu from"chalk";import{existsSync as Tu,mkdirSync as Ru}from"fs";import{readdir as $u,unlink as Uu}from"fs/promises";import{extname as Hu,join as _s}from"path";x();function yo(e){return typeof e=="undefined"||e===null}function Ya(e){return typeof e=="object"&&e!==null}function Ba(e){return Array.isArray(e)?e:yo(e)?[]:[e]}function za(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 Ga(e,t){var n="",i;for(i=0;i<t;i+=1)n+=e;return n}function qa(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var Ka=yo,Va=Ya,ka=Ba,Ja=Ga,Qa=qa,Za=za,pe={isNothing:Ka,isObject:Va,toArray:ka,repeat:Ja,isNegativeZero:Qa,extend:Za};function bo(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
65
|
|
66
|
-
`+e.mark.snippet),i+" "+n):i}function fn(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=bo(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}fn.prototype=Object.create(Error.prototype);fn.prototype.constructor=fn;fn.prototype.toString=function(t){return this.name+": "+bo(this,t)};var we=fn;function
|
67
|
-
`+a;for(u=
|
66
|
+
`+e.mark.snippet),i+" "+n):i}function fn(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=bo(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}fn.prototype=Object.create(Error.prototype);fn.prototype.constructor=fn;fn.prototype.toString=function(t){return this.name+": "+bo(this,t)};var we=fn;function Ci(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 xi(e,t){return pe.repeat(" ",t-e.length)+e}function Xa(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,p=Math.min(e.line+t.linesAfter,r.length).toString().length,c=t.maxLength-(t.indent+p+3);for(l=1;l<=t.linesBefore&&!(s-l<0);l++)u=Ci(e.buffer,i[s-l],r[s-l],e.position-(i[s]-i[s-l]),c),a=pe.repeat(" ",t.indent)+xi((e.line-l+1).toString(),p)+" | "+u.str+`
|
67
|
+
`+a;for(u=Ci(e.buffer,i[s],r[s],e.position,c),a+=pe.repeat(" ",t.indent)+xi((e.line+1).toString(),p)+" | "+u.str+`
|
68
68
|
`,a+=pe.repeat("-",t.indent+p+3+u.pos)+`^
|
69
|
-
`,l=1;l<=t.linesAfter&&!(s+l>=r.length);l++)u=
|
70
|
-
`;return a.replace(/\n$/,"")}var Xa
|
71
|
-
\r`;function
|
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
|
73
|
-
`,t-1))}function
|
74
|
-
`,o?1+l:l):r===
|
69
|
+
`,l=1;l<=t.linesAfter&&!(s+l>=r.length);l++)u=Ci(e.buffer,i[s+l],r[s+l],e.position-(i[s]-i[s+l]),c),a+=pe.repeat(" ",t.indent)+xi((e.line+l+1).toString(),p)+" | "+u.str+`
|
70
|
+
`;return a.replace(/\n$/,"")}var el=Xa,tl=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],nl=["scalar","sequence","mapping"];function il(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(i){t[String(i)]=n})}),t}function rl(e,t){if(t=t||{},Object.keys(t).forEach(function(n){if(tl.indexOf(n)===-1)throw new we('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=il(t.styleAliases||null),nl.indexOf(this.kind)===-1)throw new we('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var me=rl;function to(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 ol(){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 _i(e){return this.extend(e)}_i.prototype.extend=function(t){var n=[],i=[];if(t instanceof me)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 we("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(o){if(!(o instanceof me))throw new we("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(o.loadKind&&o.loadKind!=="scalar")throw new we("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 we("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 me))throw new we("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var r=Object.create(_i.prototype);return r.implicit=(this.implicit||[]).concat(n),r.explicit=(this.explicit||[]).concat(i),r.compiledImplicit=to(r,"implicit"),r.compiledExplicit=to(r,"explicit"),r.compiledTypeMap=ol(r.compiledImplicit,r.compiledExplicit),r};var sl=_i,al=new me("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),ll=new me("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),fl=new me("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),cl=new sl({explicit:[al,ll,fl]});function ul(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function pl(){return null}function dl(e){return e===null}var hl=new me("tag:yaml.org,2002:null",{kind:"scalar",resolve:ul,construct:pl,predicate:dl,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function ml(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 gl(e){return e==="true"||e==="True"||e==="TRUE"}function yl(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var bl=new me("tag:yaml.org,2002:bool",{kind:"scalar",resolve:ml,construct:gl,predicate:yl,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 wl(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function Al(e){return 48<=e&&e<=55}function Cl(e){return 48<=e&&e<=57}function xl(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(!wl(e.charCodeAt(n)))return!1;i=!0}return i&&r!=="_"}if(r==="o"){for(n++;n<t;n++)if(r=e[n],r!=="_"){if(!Al(e.charCodeAt(n)))return!1;i=!0}return i&&r!=="_"}}if(r==="_")return!1;for(;n<t;n++)if(r=e[n],r!=="_"){if(!Cl(e.charCodeAt(n)))return!1;i=!0}return!(!i||r==="_")}function vl(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 _l(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!pe.isNegativeZero(e)}var Ol=new me("tag:yaml.org,2002:int",{kind:"scalar",resolve:xl,construct:vl,predicate:_l,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"]}}),Sl=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function El(e){return!(e===null||!Sl.test(e)||e[e.length-1]==="_")}function Il(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 Pl(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(pe.isNegativeZero(e))return"-0.0";return n=e.toString(10),jl.test(n)?n.replace("e",".e"):n}function Fl(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||pe.isNegativeZero(e))}var Ll=new me("tag:yaml.org,2002:float",{kind:"scalar",resolve:El,construct:Il,predicate:Fl,represent:Pl,defaultStyle:"lowercase"}),Ml=cl.extend({implicit:[hl,bl,Ol,Ll]}),Dl=Ml,wo=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Ao=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 Nl(e){return e===null?!1:wo.exec(e)!==null||Ao.exec(e)!==null}function Tl(e){var t,n,i,r,o,s,a,l=0,u=null,p,c,d;if(t=wo.exec(e),t===null&&(t=Ao.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]&&(p=+t[10],c=+(t[11]||0),u=(p*60+c)*6e4,t[9]==="-"&&(u=-u)),d=new Date(Date.UTC(n,i,r,o,s,a,l)),u&&d.setTime(d.getTime()-u),d}function Rl(e){return e.toISOString()}var $l=new me("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:Nl,construct:Tl,instanceOf:Date,represent:Rl});function Ul(e){return e==="<<"||e===null}var Hl=new me("tag:yaml.org,2002:merge",{kind:"scalar",resolve:Ul}),ji=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
71
|
+
\r`;function Wl(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 Yl(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 Bl(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 zl(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var Gl=new me("tag:yaml.org,2002:binary",{kind:"scalar",resolve:Wl,construct:Yl,predicate:zl,represent:Bl}),ql=Object.prototype.hasOwnProperty,Kl=Object.prototype.toString;function Vl(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,Kl.call(r)!=="[object Object]")return!1;for(o in r)if(ql.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 kl(e){return e!==null?e:[]}var Jl=new me("tag:yaml.org,2002:omap",{kind:"sequence",resolve:Vl,construct:kl}),Ql=Object.prototype.toString;function Zl(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],Ql.call(i)!=="[object Object]"||(r=Object.keys(i),r.length!==1))return!1;o[t]=[r[0],i[r[0]]]}return!0}function Xl(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 ef=new me("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:Zl,construct:Xl}),tf=Object.prototype.hasOwnProperty;function nf(e){if(e===null)return!0;var t,n=e;for(t in n)if(tf.call(n,t)&&n[t]!==null)return!1;return!0}function rf(e){return e!==null?e:{}}var of=new me("tag:yaml.org,2002:set",{kind:"mapping",resolve:nf,construct:rf}),Co=Dl.extend({implicit:[$l,Hl],explicit:[Gl,Jl,ef,of]}),tt=Object.prototype.hasOwnProperty,Mn=1,xo=2,vo=3,Dn=4,vi=1,sf=2,no=3,af=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,lf=/[\x85\u2028\u2029]/,ff=/[,\[\]\{\}]/,_o=/^(?:!|!!|![a-z\-]+!)$/i,Oo=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function io(e){return Object.prototype.toString.call(e)}function Re(e){return e===10||e===13}function Tt(e){return e===9||e===32}function Ae(e){return e===9||e===32||e===10||e===13}function Vt(e){return e===44||e===91||e===93||e===123||e===125}function cf(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function uf(e){return e===120?2:e===117?4:e===85?8:0}function pf(e){return 48<=e&&e<=57?e-48:-1}function ro(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 df(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}var So=new Array(256),Eo=new Array(256);for(Nt=0;Nt<256;Nt++)So[Nt]=ro(Nt)?1:0,Eo[Nt]=ro(Nt);var Nt;function hf(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||Co,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 Io(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=el(n),new we(t,n)}function T(e,t){throw Io(e,t)}function Nn(e,t){e.onWarning&&e.onWarning.call(null,Io(e,t))}var oo={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&&Nn(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],_o.test(r)||T(t,"ill-formed tag handle (first argument) of the TAG directive"),tt.call(t.tagMap,r)&&T(t,'there is a previously declared suffix for "'+r+'" tag handle'),Oo.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 et(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 af.test(a)&&T(e,"the stream contains non-printable characters");e.result+=a}}function so(e,t,n,i){var r,o,s,a;for(pe.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],tt.call(t,o)||(t[o]=n[o],i[o]=!0)}function kt(e,t,n,i,r,o,s,a,l){var u,p;if(Array.isArray(r))for(r=Array.prototype.slice.call(r),u=0,p=r.length;u<p;u+=1)Array.isArray(r[u])&&T(e,"nested arrays are not supported inside keys"),typeof r=="object"&&io(r[u])==="[object Object]"&&(r[u]="[object Object]");if(typeof r=="object"&&io(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,p=o.length;u<p;u+=1)so(e,t,o[u],n);else so(e,t,o,n);else!e.json&&!tt.call(n,r)&&tt.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 Pi(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(;Tt(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(Re(r))for(Pi(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&&Nn(e,"deficient indentation"),i}function $n(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||Ae(n)))}function Fi(e,t){t===1?e.result+=" ":t>1&&(e.result+=pe.repeat(`
|
73
|
+
`,t-1))}function mf(e,t,n){var i,r,o,s,a,l,u,p,c=e.kind,d=e.result,g;if(g=e.input.charCodeAt(e.position),Ae(g)||Vt(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),Ae(r)||n&&Vt(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),Ae(r)||n&&Vt(r))break}else if(g===35){if(i=e.input.charCodeAt(e.position-1),Ae(i))break}else{if(e.position===e.lineStart&&$n(e)||n&&Vt(g))break;if(Re(g))if(l=e.line,u=e.lineStart,p=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=p;break}}a&&(et(e,o,s,!1),Fi(e,e.line-l),o=s=e.position,a=!1),Tt(g)||(s=e.position+1),g=e.input.charCodeAt(++e.position)}return et(e,o,s,!1),e.result?!0:(e.kind=c,e.result=d,!1)}function gf(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(et(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 Re(n)?(et(e,i,r,!0),Fi(e,ce(e,!1,t)),i=r=e.position):e.position===e.lineStart&&$n(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 yf(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 et(e,n,e.position,!0),e.position++,!0;if(a===92){if(et(e,n,e.position,!0),a=e.input.charCodeAt(++e.position),Re(a))ce(e,!1,t);else if(a<256&&So[a])e.result+=Eo[a],e.position++;else if((s=uf(a))>0){for(r=s,o=0;r>0;r--)a=e.input.charCodeAt(++e.position),(s=cf(a))>=0?o=(o<<4)+s:T(e,"expected hexadecimal character");e.result+=df(o),e.position++}else T(e,"unknown escape sequence");n=i=e.position}else Re(a)?(et(e,n,i,!0),Fi(e,ce(e,!1,t)),n=i=e.position):e.position===e.lineStart&&$n(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 bf(e,t){var n=!0,i,r,o,s=e.tag,a,l=e.anchor,u,p,c,d,g,A=Object.create(null),w,m,S,_;if(_=e.input.charCodeAt(e.position),_===91)p=93,g=!1,a=[];else if(_===123)p=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),_===p)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=S=null,c=d=!1,_===63&&(u=e.input.charCodeAt(e.position+1),Ae(u)&&(c=d=!0,e.position++,ce(e,!0,t))),i=e.line,r=e.lineStart,o=e.position,Jt(e,t,Mn,!1,!0),m=e.tag,w=e.result,ce(e,!0,t),_=e.input.charCodeAt(e.position),(d||e.line===i)&&_===58&&(c=!0,_=e.input.charCodeAt(++e.position),ce(e,!0,t),Jt(e,t,Mn,!1,!0),S=e.result),g?kt(e,a,A,m,w,S,i,r,o):c?a.push(kt(e,null,A,m,w,S,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 wf(e,t){var n,i,r=vi,o=!1,s=!1,a=t,l=0,u=!1,p,c;if(c=e.input.charCodeAt(e.position),c===124)i=!1;else if(c===62)i=!0;else return!1;for(e.kind="scalar",e.result="";c!==0;)if(c=e.input.charCodeAt(++e.position),c===43||c===45)vi===r?r=c===43?no:sf:T(e,"repeat of a chomping mode identifier");else if((p=pf(c))>=0)p===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+p-1,s=!0);else break;if(Tt(c)){do c=e.input.charCodeAt(++e.position);while(Tt(c));if(c===35)do c=e.input.charCodeAt(++e.position);while(!Re(c)&&c!==0)}for(;c!==0;){for(Pi(e),e.lineIndent=0,c=e.input.charCodeAt(e.position);(!s||e.lineIndent<a)&&c===32;)e.lineIndent++,c=e.input.charCodeAt(++e.position);if(!s&&e.lineIndent>a&&(a=e.lineIndent),Re(c)){l++;continue}if(e.lineIndent<a){r===no?e.result+=pe.repeat(`
|
74
|
+
`,o?1+l:l):r===vi&&o&&(e.result+=`
|
75
75
|
`);break}for(i?Tt(c)?(u=!0,e.result+=pe.repeat(`
|
76
76
|
`,o?1+l:l)):u?(u=!1,e.result+=pe.repeat(`
|
77
77
|
`,l+1)):l===0?o&&(e.result+=" "):e.result+=pe.repeat(`
|
78
78
|
`,l):e.result+=pe.repeat(`
|
79
|
-
`,o?1+l:l),o=!0,s=!0,l=0,n=e.position;!Re(c)&&c!==0;)c=e.input.charCodeAt(++e.position);et(e,n,e.position,!1)}return!0}function
|
80
|
-
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var n=new
|
79
|
+
`,o?1+l:l),o=!0,s=!0,l=0,n=e.position;!Re(c)&&c!==0;)c=e.input.charCodeAt(++e.position);et(e,n,e.position,!1)}return!0}function ao(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),!Ae(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,Jt(e,t,vo,!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 Af(e,t,n){var i,r,o,s,a,l,u=e.tag,p=e.anchor,c={},d=Object.create(null),g=null,A=null,w=null,m=!1,S=!1,_;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=c),_=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)&&Ae(i))_===63?(m&&(kt(e,c,d,g,A,null,s,a,l),g=A=w=null),S=!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,!Jt(e,n,xo,!1,!0))break;if(e.line===o){for(_=e.input.charCodeAt(e.position);Tt(_);)_=e.input.charCodeAt(++e.position);if(_===58)_=e.input.charCodeAt(++e.position),Ae(_)||T(e,"a whitespace character is expected after the key-value separator within a block mapping"),m&&(kt(e,c,d,g,A,null,s,a,l),g=A=w=null),S=!0,m=!1,r=!1,g=e.tag,A=e.result;else if(S)T(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=u,e.anchor=p,!0}else if(S)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=p,!0}if((e.line===o||e.lineIndent>t)&&(m&&(s=e.line,a=e.lineStart,l=e.position),Jt(e,t,Dn,!0,r)&&(m?A=e.result:w=e.result),m||(kt(e,c,d,g,A,w,s,a,l),g=A=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&&kt(e,c,d,g,A,null,s,a,l),S&&(e.tag=u,e.anchor=p,e.kind="mapping",e.result=c),S}function Cf(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&&!Ae(s);)s===33&&(i?T(e,"tag suffix cannot contain exclamation marks"):(r=e.input.slice(t-1,e.position+1),_o.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),ff.test(o)&&T(e,"tag suffix cannot contain flow indicator characters")}o&&!Oo.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:tt.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 xf(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&&!Ae(n)&&!Vt(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 vf(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&&!Ae(i)&&!Vt(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),tt.call(e.anchorMap,n)||T(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],ce(e,!0,-1),!0}function Jt(e,t,n,i,r){var o,s,a,l=1,u=!1,p=!1,c,d,g,A,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=Dn===n||vo===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(;Cf(e)||xf(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||Dn===n)&&(Mn===n||xo===n?w=t:w=t+1,m=e.position-e.lineStart,l===1?a&&(ao(e,m)||Af(e,m,w))||bf(e,w)?p=!0:(s&&wf(e,w)||gf(e,w)||yf(e,w)?p=!0:vf(e)?(p=!0,(e.tag!==null||e.anchor!==null)&&T(e,"alias node should not have any properties")):mf(e,w,Mn===n)&&(p=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):l===0&&(p=a&&ao(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+'"'),c=0,d=e.implicitTypes.length;c<d;c+=1)if(A=e.implicitTypes[c],A.resolve(e.result)){e.result=A.construct(e.result),e.tag=A.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(tt.call(e.typeMap[e.kind||"fallback"],e.tag))A=e.typeMap[e.kind||"fallback"][e.tag];else for(A=null,g=e.typeMap.multi[e.kind||"fallback"],c=0,d=g.length;c<d;c+=1)if(e.tag.slice(0,g[c].tag.length)===g[c].tag){A=g[c];break}A||T(e,"unknown tag !<"+e.tag+">"),e.result!==null&&A.kind!==e.kind&&T(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+A.kind+'", not "'+e.kind+'"'),A.resolve(e.result,e.tag)?(e.result=A.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||p}function _f(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&&!Ae(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(;Tt(s);)s=e.input.charCodeAt(++e.position);if(s===35){do s=e.input.charCodeAt(++e.position);while(s!==0&&!Re(s));break}if(Re(s))break;for(n=e.position;s!==0&&!Ae(s);)s=e.input.charCodeAt(++e.position);r.push(e.input.slice(n,e.position))}s!==0&&Pi(e),tt.call(oo,i)?oo[i](e,i,r):Nn(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"),Jt(e,e.lineIndent-1,Dn,!1,!0),ce(e,!0,-1),e.checkLineBreaks&&lf.test(e.input.slice(t,e.position))&&Nn(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&$n(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 jo(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 hf(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;)_f(n);return n.documents}function Of(e,t,n){t!==null&&typeof t=="object"&&typeof n=="undefined"&&(n=t,t=null);var i=jo(e,n);if(typeof t!="function")return i;for(var r=0,o=i.length;r<o;r+=1)t(i[r])}function Sf(e,t){var n=jo(e,t);if(n.length!==0){if(n.length===1)return n[0];throw new we("expected a single document in the stream, but found more")}}var Ef=Of,If=Sf,Po={loadAll:Ef,load:If},Fo=Object.prototype.toString,Lo=Object.prototype.hasOwnProperty,Li=65279,jf=9,cn=10,Pf=13,Ff=32,Lf=33,Mf=34,Oi=35,Df=37,Nf=38,Tf=39,Rf=42,Mo=44,$f=45,Tn=58,Uf=61,Hf=62,Wf=63,Yf=64,Do=91,No=93,Bf=96,To=123,zf=124,Ro=125,ge={};ge[0]="\\0";ge[7]="\\a";ge[8]="\\b";ge[9]="\\t";ge[10]="\\n";ge[11]="\\v";ge[12]="\\f";ge[13]="\\r";ge[27]="\\e";ge[34]='\\"';ge[92]="\\\\";ge[133]="\\N";ge[160]="\\_";ge[8232]="\\L";ge[8233]="\\P";var Gf=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],qf=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function Kf(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&&Lo.call(l.styleAliases,a)&&(a=l.styleAliases[a]),n[s]=a;return n}function Vf(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 we("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+n+pe.repeat("0",i-t.length)+t}var kf=1,un=2;function Jf(e){this.schema=e.schema||Co,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=pe.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=Kf(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==='"'?un:kf,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 lo(e,t){for(var n=pe.repeat(" ",t),i=0,r=-1,o="",s,a=e.length;i<a;)r=e.indexOf(`
|
81
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
|
83
|
-
`+pe.repeat(" ",e.indent*t)}function
|
82
|
+
`&&(o+=n),o+=s;return o}function Si(e,t){return`
|
83
|
+
`+pe.repeat(" ",e.indent*t)}function Qf(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 Rn(e){return e===Ff||e===jf}function pn(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 fo(e){return pn(e)&&e!==Li&&e!==Pf&&e!==cn}function co(e,t,n){var i=fo(e),r=i&&!Rn(e);return(n?i:i&&e!==Mo&&e!==Do&&e!==No&&e!==To&&e!==Ro)&&e!==Oi&&!(t===Tn&&!r)||fo(t)&&!Rn(t)&&e===Oi||t===Tn&&r}function Zf(e){return pn(e)&&e!==Li&&!Rn(e)&&e!==$f&&e!==Wf&&e!==Tn&&e!==Mo&&e!==Do&&e!==No&&e!==To&&e!==Ro&&e!==Oi&&e!==Nf&&e!==Rf&&e!==Lf&&e!==zf&&e!==Uf&&e!==Hf&&e!==Tf&&e!==Mf&&e!==Df&&e!==Yf&&e!==Bf}function Xf(e){return!Rn(e)&&e!==Tn}function ln(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 $o(e){var t=/^\n* /;return t.test(e)}var Uo=1,Ei=2,Ho=3,Wo=4,Kt=5;function ec(e,t,n,i,r,o,s,a){var l,u=0,p=null,c=!1,d=!1,g=i!==-1,A=-1,w=Zf(ln(e,0))&&Xf(ln(e,e.length-1));if(t||s)for(l=0;l<e.length;u>=65536?l+=2:l++){if(u=ln(e,l),!pn(u))return Kt;w=w&&co(u,p,a),p=u}else{for(l=0;l<e.length;u>=65536?l+=2:l++){if(u=ln(e,l),u===cn)c=!0,g&&(d=d||l-A-1>i&&e[A+1]!==" ",A=l);else if(!pn(u))return Kt;w=w&&co(u,p,a),p=u}d=d||g&&l-A-1>i&&e[A+1]!==" "}return!c&&!d?w&&!s&&!r(e)?Uo:o===un?Kt:Ei:n>9&&$o(e)?Kt:s?o===un?Kt:Ei:d?Wo:Ho}function tc(e,t,n,i,r){e.dump=function(){if(t.length===0)return e.quotingType===un?'""':"''";if(!e.noCompatMode&&(Gf.indexOf(t)!==-1||qf.test(t)))return e.quotingType===un?'"'+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 Qf(e,u)}switch(ec(t,a,e.indent,s,l,e.quotingType,e.forceQuotes&&!i,r)){case Uo:return t;case Ei:return"'"+t.replace(/'/g,"''")+"'";case Ho:return"|"+uo(t,e.indent)+po(lo(t,o));case Wo:return">"+uo(t,e.indent)+po(lo(nc(t,s),o));case Kt:return'"'+ic(t)+'"';default:throw new we("impossible error: invalid scalar style")}}()}function uo(e,t){var n=$o(e)?String(t):"",i=e[e.length-1]===`
|
84
84
|
`,r=i&&(e[e.length-2]===`
|
85
85
|
`||e===`
|
86
86
|
`),o=r?"+":i?"":"-";return n+o+`
|
87
|
-
`}function
|
88
|
-
`?e.slice(0,-1):e}function
|
89
|
-
`);return u=u!==-1?u:e.length,n.lastIndex=u,
|
87
|
+
`}function po(e){return e[e.length-1]===`
|
88
|
+
`?e.slice(0,-1):e}function nc(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,ho(e.slice(0,u),t)}(),r=e[0]===`
|
90
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
|
-
`:"")+
|
91
|
+
`:"")+ho(l,t),r=o}return i}function ho(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
92
|
`+e.slice(r,o),r=o+1),s=a;return l+=`
|
93
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
|
95
|
-
`:""}var lc
|
96
|
-
${p==null?void 0:p.message}`)),p}}}return{objects:a(),deleteObject:async l=>{await
|
97
|
-
`+a.map(p=>p.added?tn.green(p.value):p.removed?tn.red(p.value):p.value).join("")),console.log(`${n!=null?n:""}${s?tn.gray("[WHATIF]"):""}${l}${i!=null?i:""} ${o}${u}`)}}var Is={command:"get <id>",describe:"Fetch a component definition",builder:e=>st(te(ne(e.positional("id",{demandOption:!0,describe:"Component definition public ID to fetch"})))),handler:async({apiHost:e,apiKey:t,id:n,format:i,project:r,filename:o})=>{let a=await new X({apiKey:t,apiHost:e,fetch:Bu,projectId:r}).getComponentDefinitions({componentId:n,limit:1});a.componentDefinitions.length===0?(console.error("Component did not exist"),process.exit(1)):$e(a.componentDefinitions[0],i,o)}};x();import zu from"isomorphic-unfetch";var js={command:"list",describe:"List component definitions",aliases:["ls"],builder:e=>st(te(ne(e.options({offset:{describe:"Number of rows to skip before fetching",type:"number",default:0},limit:{describe:"Number of rows to fetch",type:"number",default:20}})))),handler:async({apiHost:e,apiKey:t,limit:n,offset:i,format:r,filename:o,project:s})=>{let l=await new X({apiKey:t,apiHost:e,fetch:zu,projectId:s}).getComponentDefinitions({limit:n,offset:i});$e(l.componentDefinitions,r,o)}};x();x();import Gu from"p-limit";function Jn(e){let t={...e};return delete t.projectId,delete t.state,t}function Ue(e){return e.option("state",{type:"string",describe:"Composition state to fetch.",choices:["preview","published"],default:"preview"})}function pt(e){let t=Number(e);if(!isNaN(t))return t;if(!e)return 64;if(typeof e!="string")throw new Error('state must be "published", "preview", or a number');return e==="preview"?0:64}var dt=Gu(8);import qu from"isomorphic-unfetch";x();x();var ht=e=>e.id,mt=e=>`${e.name} (pid: ${e.id})`;function Qn({client:e}){async function*t(){let n=kn(async(i,r)=>(await e.getComponentDefinitions({limit:r,offset:i})).componentDefinitions,{pageSize:100});for await(let i of n)yield{id:ht(i),displayName:mt(i),providerId:i.id,object:i}}return{objects:t(),deleteObject:async n=>{await e.removeComponentDefinition({componentId:n})},writeObject:async n=>{await e.updateComponentDefinition({componentDefinition:n.object})}}}x();function gt(e,t){return Os(e,t)}function Zn(e,t){Ss(e,t)}var Ps={command:"pull <directory>",describe:"Pulls all component definitions to local files in a directory",builder:e=>te(ne(at(e.positional("directory",{describe:"Directory to save the component definitions 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 d;let l=new X({apiKey:t,apiHost:e,fetch:qu,projectId:s,limitPolicy:dt}),u=Qn({client:l}),p;if(lt(n)){let g=gt(n,!1);p=await ot({objects:(d=g.components)!=null?d:[],selectIdentifier:ht,selectDisplayName:mt,onSyncComplete:async(A,w)=>{g.components=w,Zn(n,g)}})}else p=await ft({directory:n,selectIdentifier:ht,selectDisplayName:mt,format:i});await ct({source:u,target:p,mode:r,whatIf:o,log:ut({diffMode:a})})}};x();import Ku from"isomorphic-unfetch";var Fs={command:"push <directory>",describe:"Pushes all component definitions from files in a directory to Uniform Optimize",builder:e=>te(ne(at(e.positional("directory",{describe:"Directory to read the component definitions 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 c;let a=new X({apiKey:t,apiHost:e,fetch:Ku,projectId:o,limitPolicy:dt}),l;if(lt(n)){let d=gt(n,!0);l=await ot({objects:(c=d.components)!=null?c:[],selectIdentifier:ht,selectDisplayName:mt})}else l=await ft({directory:n,selectIdentifier:ht,selectDisplayName:mt});let p=Qn({client:a});await ct({source:l,target:p,mode:i,whatIf:r,log:ut({diffMode:s})})}};x();import Vu from"isomorphic-unfetch";var Ls={command:"remove <id>",aliases:["delete","rm"],describe:"Delete a component definition",builder:e=>te(ne(e.positional("id",{demandOption:!0,describe:"Component definition public ID to delete"}))),handler:async({apiHost:e,apiKey:t,id:n,project:i})=>{await new X({apiKey:t,apiHost:e,fetch:Vu,projectId:i}).removeComponentDefinition({componentId:n})}};x();import ku from"isomorphic-unfetch";var Ms={command:"update <filename>",aliases:["put"],describe:"Insert or update a component definition",builder:e=>te(ne(e.positional("filename",{demandOption:!0,describe:"Component definition file to put"}))),handler:async({apiHost:e,apiKey:t,filename:n,project:i})=>{let r=new X({apiKey:t,apiHost:e,fetch:ku,projectId:i}),o=nn(n);await r.updateComponentDefinition({componentDefinition:o})}};var Ds={command:"component <command>",aliases:["def"],describe:"Commands for Canvas component definitions",builder:e=>e.command(Ps).command(Fs).command(Is).command(Ls).command(js).command(Ms).demandCommand(),handler:()=>{qt.help()}};x();x();import Ju from"isomorphic-unfetch";var Ns={command:"get <id>",describe:"Fetch a composition",builder:e=>st(te(ne(Ue(e.positional("id",{demandOption:!0,describe:"Composition public ID to fetch"}).option({resolvePatterns:{type:"boolean",default:!1,describe:"Resolve pattern references in the composition"}}))))),handler:async({apiHost:e,apiKey:t,id:n,format:i,filename:r,state:o,project:s,resolvePatterns:a})=>{let l=new X({apiKey:t,apiHost:e,fetch:Ju,projectId:s}),u=Jn(await l.getCompositionById({compositionId:n,state:pt(o),skipPatternResolution:!a}));$e(u,i,r)}};x();import Qu from"isomorphic-unfetch";var Ts={command:"list",describe:"List compositions",aliases:["ls"],builder:e=>st(te(ne(Ue(e.options({offset:{describe:"Number of rows to skip before fetching",type:"number",default:0},limit:{describe:"Number of rows to fetch",type:"number",default:20},resolvePatterns:{type:"boolean",default:!1,describe:"Resolve pattern references in the composition"}}))))),handler:async({apiHost:e,apiKey:t,limit:n,offset:i,format:r,filename:o,project:s,state:a,resolvePatterns:l})=>{let p=await new X({apiKey:t,apiHost:e,fetch:Qu,projectId:s}).getCompositionList({limit:n,offset:i,state:pt(a),skipPatternResolution:!l});$e(p.compositions,r,o)}};x();import Zu from"isomorphic-unfetch";x();x();var bt=e=>e.composition._id,yt=e=>{var t,n;return`${(n=(t=e.composition._name)!=null?t:e.composition._slug)!=null?n:e.composition._id} (pid: ${e.composition._id})`};function Xn({client:e,state:t}){let n=pt(t);async function*i(){let r=kn(async(o,s)=>(await e.getCompositionList({limit:s,offset:o,state:n,skipPatternResolution:!0})).compositions,{pageSize:100});for await(let o of r)yield{id:bt(o),displayName:yt(o),providerId:o.composition._id,object:Jn(o)}}return{objects:i(),deleteObject:async r=>{await e.removeComposition({compositionId:r})},writeObject:async r=>{await e.updateComposition({...r.object,state:n})}}}var Rs={command:"pull <directory>",describe:"Pulls all compositions to local files in a directory",builder:e=>te(ne(Ue(at(e.positional("directory",{describe:"Directory to save the component definitions 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,state:s,project:a,diff:l})=>{var g;let u=new X({apiKey:t,apiHost:e,fetch:Zu,projectId:a,limitPolicy:dt}),p=Xn({client:u,state:s}),c=lt(n),d;if(c){let A=gt(n,!1);d=await ot({objects:(g=A==null?void 0:A.compositions)!=null?g:[],selectIdentifier:bt,selectDisplayName:yt,onSyncComplete:async(w,m)=>{A.compositions=m,Zn(n,A)}})}else d=await ft({directory:n,selectIdentifier:bt,selectDisplayName:yt,format:i});await ct({source:p,target:d,mode:r,whatIf:o,log:ut({diffMode:l})})}};x();import Xu from"isomorphic-unfetch";var $s={command:"push <directory>",describe:"Pushes all compositions from files in a directory to Uniform Optimize",builder:e=>te(ne(Ue(at(e.positional("directory",{describe:"Directory to read the component definitions 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,state:o,project:s,diff:a})=>{var d;let l=new X({apiKey:t,apiHost:e,fetch:Xu,projectId:s,limitPolicy:dt}),u;if(lt(n)){let g=gt(n,!0);u=await ot({objects:(d=g.compositions)!=null?d:[],selectIdentifier:bt,selectDisplayName:yt})}else u=await ft({directory:n,selectIdentifier:bt,selectDisplayName:yt});let c=Xn({client:l,state:o});await ct({source:u,target:c,mode:i,whatIf:r,log:ut({diffMode:a})})}};x();import ep from"isomorphic-unfetch";var Us={command:"remove <id>",aliases:["delete","rm"],describe:"Delete a composition",builder:e=>te(ne(e.positional("id",{demandOption:!0,describe:"Composition public ID to delete"}))),handler:async({apiHost:e,apiKey:t,id:n,project:i})=>{await new X({apiKey:t,apiHost:e,fetch:ep,projectId:i}).removeComposition({compositionId:n})}};x();import tp from"isomorphic-unfetch";var Hs={command:"update <filename>",aliases:["put"],describe:"Insert or update a composition",builder:e=>te(ne(Ue(e.positional("filename",{demandOption:!0,describe:"Composition file to put"})))),handler:async({apiHost:e,apiKey:t,filename:n,project:i,state:r})=>{let o=new X({apiKey:t,apiHost:e,fetch:tp,projectId:i}),s=nn(n);await o.updateComposition({...s,state:pt(r)})}};var Ws={command:"composition <command>",describe:"Commands for Canvas compositions",aliases:["comp"],builder:e=>e.command(Rs).command($s).command(Ns).command(Us).command(Ts).command(Hs).demandCommand(),handler:()=>{qt.help()}};var Zg={commands:[{command:"canvas <command>",aliases:["cv","pm","presentation"],describe:"Uniform Canvas commands",builder:e=>e.command(Ws).command(Ds).demandCommand(),handler:()=>{qt.showHelp()}}]};export{gt as readCanvasPackage,Zg as uniformCLI,Zn as writeCanvasPackage};
|
94
|
+
`+e.slice(s+1):l+=e.slice(r),l.slice(1)}function ic(e){for(var t="",n=0,i,r=0;r<e.length;n>=65536?r+=2:r++)n=ln(e,r),i=ge[n],!i&&pn(n)?(t+=e[r],n>=65536&&(t+=e[r+1])):t+=i||Vf(n);return t}function rc(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)),(Be(e,t,a,!1,!1)||typeof a=="undefined"&&Be(e,t,null,!1,!1))&&(i!==""&&(i+=","+(e.condenseFlow?"":" ")),i+=e.dump);e.tag=r,e.dump="["+i+"]"}function mo(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)),(Be(e,t+1,l,!0,!0,!1,!0)||typeof l=="undefined"&&Be(e,t+1,null,!0,!0,!1,!0))&&((!i||r!=="")&&(r+=Si(e,t)),e.dump&&cn===e.dump.charCodeAt(0)?r+="-":r+="- ",r+=e.dump);e.tag=o,e.dump=r||"[]"}function oc(e,t,n){var i="",r=e.tag,o=Object.keys(n),s,a,l,u,p;for(s=0,a=o.length;s<a;s+=1)p="",i!==""&&(p+=", "),e.condenseFlow&&(p+='"'),l=o[s],u=n[l],e.replacer&&(u=e.replacer.call(n,l,u)),!!Be(e,t,l,!1,!1)&&(e.dump.length>1024&&(p+="? "),p+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),!!Be(e,t,u,!1,!1)&&(p+=e.dump,i+=p));e.tag=r,e.dump="{"+i+"}"}function sc(e,t,n,i){var r="",o=e.tag,s=Object.keys(n),a,l,u,p,c,d;if(e.sortKeys===!0)s.sort();else if(typeof e.sortKeys=="function")s.sort(e.sortKeys);else if(e.sortKeys)throw new we("sortKeys must be a boolean or a function");for(a=0,l=s.length;a<l;a+=1)d="",(!i||r!=="")&&(d+=Si(e,t)),u=s[a],p=n[u],e.replacer&&(p=e.replacer.call(n,u,p)),!!Be(e,t+1,u,!0,!0,!0)&&(c=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,c&&(e.dump&&cn===e.dump.charCodeAt(0)?d+="?":d+="? "),d+=e.dump,c&&(d+=Si(e,t)),!!Be(e,t+1,p,!0,c)&&(e.dump&&cn===e.dump.charCodeAt(0)?d+=":":d+=": ",d+=e.dump,r+=d));e.tag=o,e.dump=r||"{}"}function go(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,Fo.call(a.represent)==="[object Function]")i=a.represent(t,l);else if(Lo.call(a.represent,l))i=a.represent[l](t,l);else throw new we("!<"+a.tag+'> tag resolver accepts not "'+l+'" style');e.dump=i}return!0}return!1}function Be(e,t,n,i,r,o,s){e.tag=null,e.dump=n,go(e,n,!1)||go(e,n,!0);var a=Fo.call(e.dump),l=i,u;i&&(i=e.flowLevel<0||e.flowLevel>t);var p=a==="[object Object]"||a==="[object Array]",c,d;if(p&&(c=e.duplicates.indexOf(n),d=c!==-1),(e.tag!==null&&e.tag!=="?"||d||e.indent!==2&&t>0)&&(r=!1),d&&e.usedDuplicates[c])e.dump="*ref_"+c;else{if(p&&d&&!e.usedDuplicates[c]&&(e.usedDuplicates[c]=!0),a==="[object Object]")i&&Object.keys(e.dump).length!==0?(sc(e,t,e.dump,r),d&&(e.dump="&ref_"+c+e.dump)):(oc(e,t,e.dump),d&&(e.dump="&ref_"+c+" "+e.dump));else if(a==="[object Array]")i&&e.dump.length!==0?(e.noArrayIndent&&!s&&t>0?mo(e,t-1,e.dump,r):mo(e,t,e.dump,r),d&&(e.dump="&ref_"+c+e.dump)):(rc(e,t,e.dump),d&&(e.dump="&ref_"+c+" "+e.dump));else if(a==="[object String]")e.tag!=="?"&&tc(e,e.dump,t,o,l);else{if(a==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new we("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 ac(e,t){var n=[],i=[],r,o;for(Ii(e,n,i),r=0,o=i.length;r<o;r+=1)t.duplicates.push(n[i[r]]);t.usedDuplicates=new Array(o)}function Ii(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)Ii(e[r],t,n);else for(i=Object.keys(e),r=0,o=i.length;r<o;r+=1)Ii(e[i[r]],t,n)}function lc(e,t){t=t||{};var n=new Jf(t);n.noRefs||ac(e,n);var i=e;return n.replacer&&(i=n.replacer.call({"":i},"",i)),Be(n,0,i,!0,!0)?n.dump+`
|
95
|
+
`:""}var fc=lc,cc={dump:fc};function Mi(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 Yo=Po.load,kd=Po.loadAll,Bo=cc.dump;var Jd=Mi("safeLoad","load"),Qd=Mi("safeLoadAll","loadAll"),Zd=Mi("safeDump","dump");import{writeFileSync as Wu}from"fs";import{extname as Os}from"path";import{readFileSync as Yu}from"fs";import Bu from"fs";x();function ze(){}ze.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,p=a+l,c=[{newPos:-1,components:[]}],d=this.extractCommon(c[0],n,t,0);if(c[0].newPos+1>=a&&d+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,S=c[w-1],_=c[w+1],B=(_?_.newPos:0)-w;S&&(c[w-1]=void 0);var z=S&&S.newPos+1<a,K=_&&0<=B&&B<l;if(!z&&!K){c[w]=void 0;continue}if(!z||K&&S.newPos<_.newPos?(m=pc(_),o.pushComponent(m.components,void 0,!0)):(m=S,m.newPos++,o.pushComponent(m.components,!0,void 0)),B=o.extractCommon(m,n,t,w),m.newPos+1>=a&&B+1>=l)return s(uc(o,m.components,n,t,o.useLongestToken));c[w]=m}u++}if(r)(function w(){setTimeout(function(){if(u>p)return r();g()||w()},0)})();else for(;u<=p;){var A=g();if(A)return A}},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 uc(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 c=t[o-1];t[o-1]=t[o],t[o]=c}}else{if(!u.added&&r){var p=n.slice(a,a+u.count);p=p.map(function(g,A){var w=i[l+A];return w.length>g.length?w:g}),u.value=e.join(p)}else u.value=e.join(n.slice(a,a+u.count));a+=u.count,u.added||(l+=u.count)}}var d=t[s-1];return s>1&&typeof d.value=="string"&&(d.added||d.removed)&&e.equals("",d.value)&&(t[s-2].value+=d.value,t.pop()),t}function pc(e){return{newPos:e.newPos,components:e.components.slice(0)}}var eh=new ze;var zo=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,Go=/\S/,qo=new ze;qo.equals=function(e,t){return this.options.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e===t||this.options.ignoreWhitespace&&!Go.test(e)&&!Go.test(t)};qo.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]&&zo.test(t[n])&&zo.test(t[n+2])&&(t[n]+=t[n+2],t.splice(n+1,2),n--);return t};var Ti=new ze;Ti.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 Ri(e,t,n){return Ti.diff(e,t,n)}var dc=new ze;dc.tokenize=function(e){return e.split(/(\S.+?[.!?])(?=\s+|$)/)};var hc=new ze;hc.tokenize=function(e){return e.split(/([{}:;,]|\s+)/)};function Un(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Un=function(t){return typeof t}:Un=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Un(e)}var mc=Object.prototype.toString,Qt=new ze;Qt.useLongestToken=!0;Qt.tokenize=Ti.tokenize;Qt.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(Di(e,null,null,r),r," ")};Qt.equals=function(e,t){return ze.prototype.equals.call(Qt,e.replace(/,([\r\n])/g,"$1"),t.replace(/,([\r\n])/g,"$1"))};function Ko(e,t,n){return Qt.diff(e,t,n)}function Di(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(mc.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]=Di(e[o],t,n,i,r);return t.pop(),n.pop(),s}if(e&&e.toJSON&&(e=e.toJSON()),Un(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]=Di(e[l],t,n,i,l);t.pop(),n.pop()}else s=e;return s}var Ni=new ze;Ni.tokenize=function(e){return e.slice()};Ni.join=Ni.removeEmpty=function(e){return e};var Is=zs(vs(),1);import tn from"chalk";async function ot({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 te(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 ne(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 st(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 at(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 lt(e){let t=Os(e);return t===".yaml"||t===".yml"||t===".json"}function $e(e,t,n){let i;if(n&&!t){let r=Os(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=Bo(e);break;default:throw new Error(`Unsupported format: ${t}`)}n?Wu(n,i,"utf8"):console.log(i)}function nn(e){let t=Yu(e,"utf8");return Yo(t,{filename:e,json:!0})}async function*Jn(e,t){let n=t.pageSize||100,i=0,r=[];do{r=await e(i,n);for(let o of r)yield o;i+=n}while(r.length===n)}async function ft({directory:e,format:t="yaml",selectIdentifier:n,selectDisplayName:i=n}){Tu(e)||Ru(e,{recursive:!0});let r=await $u(e,"utf-8"),o=new Set(r.filter(l=>{let u=Hu(l);return u===".json"||u===".yaml"||u===".yml"})),s=l=>_s(e,`${l}.${t}`);async function*a(){for(let l of o){let u=_s(e,l);try{let p=await nn(u);yield{id:n(p),displayName:i(p),providerId:u,object:p}}catch(p){throw console.error(Nu.red(`Failed to read ${u}, data is likely invalid.
|
96
|
+
${p==null?void 0:p.message}`)),p}}}return{objects:a(),deleteObject:async l=>{await Uu(l)},writeObject:async l=>{$e(l.object,t,s(l.id))}}}function Ss(e,t){if(!t&&!Bu.existsSync(e))return{};let n=nn(e);if(typeof n!="object")throw new Error(`Package ${e} does not appear valid.`);return n}function Es(e,t){$e(t,void 0,e)}async function ct({source:e,target:t,compareContents:n=(a,l)=>(0,Is.default)(a.object,l.object,(u,p,c)=>c==="created"||c==="modified"?!0:void 0),mode:i,allowEmptySource:r=!1,whatIf:o=!1,log:s=()=>{}}){var a,l;let u=new Map;for await(let d of t.objects)u.set(d.id,d);let p=[],c=!1;for await(let d of e.objects){c=!0;let g=d.id,A=u.get(g);if(A){if(!n(d,A)&&(i==="createOrUpdate"||i==="mirror")){let w=async(m,S)=>{var _;if(!o)try{await t.writeObject(m,S)}catch(B){throw new kn(B,m)}s({action:"update",id:g,providerId:m.providerId,displayName:(_=m.displayName)!=null?_:m.providerId,whatIf:o,diff:Ko(S.object,m.object)})};p.push(w(d,A))}u.delete(g)}else{let w=async(m,S)=>{var _;if(!o)try{await t.writeObject(m)}catch(B){throw new kn(B,m)}s({action:"create",id:S,providerId:S,displayName:(_=m.displayName)!=null?_:m.providerId,whatIf:o,diff:Ri("",JSON.stringify(m.object,null,2))})};p.push(w(d,g))}}if(await Promise.all(p),i==="mirror"){if(!c&&!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 d=[];u.forEach(async g=>{let A=async w=>{var m;if(!o)try{await t.deleteObject(w.providerId)}catch(S){throw new kn(S,w)}s({action:"delete",id:w.id,providerId:w.providerId,displayName:(m=w.displayName)!=null?m:w.providerId,whatIf:o,diff:Ri(JSON.stringify(w.object,null,2),"")})};d.push(A(g))}),await Promise.all(d)}await Promise.all([(a=e.onSyncComplete)==null?void 0:a.call(e,!1),(l=t.onSyncComplete)==null?void 0:l.call(t,!0)])}var kn=class extends Error{constructor(e,t){super(`Error syncing ${(n=t.displayName)!=null?n:t.providerId} (${t.providerId})
|
97
|
+
${e}`);var n;this.stack=void 0,Object.setPrototypeOf(this,kn.prototype)}};function ut(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=tn.green("[A]");break;case"update":l=tn.white("[U]");break;case"delete":l=tn.yellow("[D]");break}let u="";(t==="on"||t==="update"&&r==="update")&&(u=`
|
98
|
+
`+a.map(p=>p.added?tn.green(p.value):p.removed?tn.red(p.value):p.value).join("")),console.log(`${n!=null?n:""}${s?tn.gray("[WHATIF]"):""}${l}${i!=null?i:""} ${o}${u}`)}}var js={command:"get <id>",describe:"Fetch a component definition",builder:e=>st(te(ne(e.positional("id",{demandOption:!0,describe:"Component definition public ID to fetch"})))),handler:async({apiHost:e,apiKey:t,id:n,format:i,project:r,filename:o})=>{let a=await new X({apiKey:t,apiHost:e,fetch:zu,projectId:r}).getComponentDefinitions({componentId:n,limit:1});a.componentDefinitions.length===0?(console.error("Component did not exist"),process.exit(1)):$e(a.componentDefinitions[0],i,o)}};x();import Gu from"isomorphic-unfetch";var Ps={command:"list",describe:"List component definitions",aliases:["ls"],builder:e=>st(te(ne(e.options({offset:{describe:"Number of rows to skip before fetching",type:"number",default:0},limit:{describe:"Number of rows to fetch",type:"number",default:20}})))),handler:async({apiHost:e,apiKey:t,limit:n,offset:i,format:r,filename:o,project:s})=>{let l=await new X({apiKey:t,apiHost:e,fetch:Gu,projectId:s}).getComponentDefinitions({limit:n,offset:i});$e(l.componentDefinitions,r,o)}};x();x();import qu from"p-limit";function Qn(e){let t={...e};return delete t.projectId,delete t.state,t}function Ue(e){return e.option("state",{type:"string",describe:"Composition state to fetch.",choices:["preview","published"],default:"preview"})}function pt(e){let t=Number(e);if(!isNaN(t))return t;if(!e)return 64;if(typeof e!="string")throw new Error('state must be "published", "preview", or a number');return e==="preview"?0:64}var dt=qu(8);import Ku from"isomorphic-unfetch";x();x();var ht=e=>e.id,mt=e=>`${e.name} (pid: ${e.id})`;function Zn({client:e}){async function*t(){let n=Jn(async(i,r)=>(await e.getComponentDefinitions({limit:r,offset:i})).componentDefinitions,{pageSize:100});for await(let i of n)yield{id:ht(i),displayName:mt(i),providerId:i.id,object:i}}return{objects:t(),deleteObject:async n=>{await e.removeComponentDefinition({componentId:n})},writeObject:async n=>{await e.updateComponentDefinition({componentDefinition:n.object})}}}x();function gt(e,t){return Ss(e,t)}function Xn(e,t){Es(e,t)}var Fs={command:"pull <directory>",describe:"Pulls all component definitions to local files in a directory",builder:e=>te(ne(at(e.positional("directory",{describe:"Directory to save the component definitions 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 d;let l=new X({apiKey:t,apiHost:e,fetch:Ku,projectId:s,limitPolicy:dt}),u=Zn({client:l}),p;if(lt(n)){let g=gt(n,!1);p=await ot({objects:(d=g.components)!=null?d:[],selectIdentifier:ht,selectDisplayName:mt,onSyncComplete:async(A,w)=>{g.components=w,Xn(n,g)}})}else p=await ft({directory:n,selectIdentifier:ht,selectDisplayName:mt,format:i});await ct({source:u,target:p,mode:r,whatIf:o,log:ut({diffMode:a})})}};x();import Vu from"isomorphic-unfetch";var Ls={command:"push <directory>",describe:"Pushes all component definitions from files in a directory to Uniform Optimize",builder:e=>te(ne(at(e.positional("directory",{describe:"Directory to read the component definitions 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 c;let a=new X({apiKey:t,apiHost:e,fetch:Vu,projectId:o,limitPolicy:dt}),l;if(lt(n)){let d=gt(n,!0);l=await ot({objects:(c=d.components)!=null?c:[],selectIdentifier:ht,selectDisplayName:mt})}else l=await ft({directory:n,selectIdentifier:ht,selectDisplayName:mt});let p=Zn({client:a});await ct({source:l,target:p,mode:i,whatIf:r,log:ut({diffMode:s})})}};x();import ku from"isomorphic-unfetch";var Ms={command:"remove <id>",aliases:["delete","rm"],describe:"Delete a component definition",builder:e=>te(ne(e.positional("id",{demandOption:!0,describe:"Component definition public ID to delete"}))),handler:async({apiHost:e,apiKey:t,id:n,project:i})=>{await new X({apiKey:t,apiHost:e,fetch:ku,projectId:i}).removeComponentDefinition({componentId:n})}};x();import Ju from"isomorphic-unfetch";var Ds={command:"update <filename>",aliases:["put"],describe:"Insert or update a component definition",builder:e=>te(ne(e.positional("filename",{demandOption:!0,describe:"Component definition file to put"}))),handler:async({apiHost:e,apiKey:t,filename:n,project:i})=>{let r=new X({apiKey:t,apiHost:e,fetch:Ju,projectId:i}),o=nn(n);await r.updateComponentDefinition({componentDefinition:o})}};var Ns={command:"component <command>",aliases:["def"],describe:"Commands for Canvas component definitions",builder:e=>e.command(Fs).command(Ls).command(js).command(Ms).command(Ps).command(Ds).demandCommand(),handler:()=>{qt.help()}};x();x();import Qu from"isomorphic-unfetch";var Ts={command:"get <id>",describe:"Fetch a composition",builder:e=>st(te(ne(Ue(e.positional("id",{demandOption:!0,describe:"Composition public ID to fetch"}).option({resolvePatterns:{type:"boolean",default:!1,describe:"Resolve pattern references in the composition"}}))))),handler:async({apiHost:e,apiKey:t,id:n,format:i,filename:r,state:o,project:s,resolvePatterns:a})=>{let l=new X({apiKey:t,apiHost:e,fetch:Qu,projectId:s}),u=Qn(await l.getCompositionById({compositionId:n,state:pt(o),skipPatternResolution:!a}));$e(u,i,r)}};x();import Zu from"isomorphic-unfetch";var Rs={command:"list",describe:"List compositions",aliases:["ls"],builder:e=>st(te(ne(Ue(e.options({offset:{describe:"Number of rows to skip before fetching",type:"number",default:0},limit:{describe:"Number of rows to fetch",type:"number",default:20},resolvePatterns:{type:"boolean",default:!1,describe:"Resolve pattern references in the composition"}}))))),handler:async({apiHost:e,apiKey:t,limit:n,offset:i,format:r,filename:o,project:s,state:a,resolvePatterns:l})=>{let p=await new X({apiKey:t,apiHost:e,fetch:Zu,projectId:s}).getCompositionList({limit:n,offset:i,state:pt(a),skipPatternResolution:!l});$e(p.compositions,r,o)}};x();import Xu from"isomorphic-unfetch";x();x();var yt=e=>e.composition._id,bt=e=>{var t,n;return`${(n=(t=e.composition._name)!=null?t:e.composition._slug)!=null?n:e.composition._id} (pid: ${e.composition._id})`};function ei({client:e,state:t}){let n=pt(t);async function*i(){let r=Jn(async(o,s)=>(await e.getCompositionList({limit:s,offset:o,state:n,skipPatternResolution:!0})).compositions,{pageSize:100});for await(let o of r)yield{id:yt(o),displayName:bt(o),providerId:o.composition._id,object:Qn(o)}}return{objects:i(),deleteObject:async r=>{await e.removeComposition({compositionId:r})},writeObject:async r=>{await e.updateComposition({...r.object,state:n})}}}var $s={command:"pull <directory>",describe:"Pulls all compositions to local files in a directory",builder:e=>te(ne(Ue(at(e.positional("directory",{describe:"Directory to save the component definitions 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,state:s,project:a,diff:l})=>{var g;let u=new X({apiKey:t,apiHost:e,fetch:Xu,projectId:a,limitPolicy:dt}),p=ei({client:u,state:s}),c=lt(n),d;if(c){let A=gt(n,!1);d=await ot({objects:(g=A==null?void 0:A.compositions)!=null?g:[],selectIdentifier:yt,selectDisplayName:bt,onSyncComplete:async(w,m)=>{A.compositions=m,Xn(n,A)}})}else d=await ft({directory:n,selectIdentifier:yt,selectDisplayName:bt,format:i});await ct({source:p,target:d,mode:r,whatIf:o,log:ut({diffMode:l})})}};x();import ep from"isomorphic-unfetch";var Us={command:"push <directory>",describe:"Pushes all compositions from files in a directory to Uniform Optimize",builder:e=>te(ne(Ue(at(e.positional("directory",{describe:"Directory to read the component definitions 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,state:o,project:s,diff:a})=>{var d;let l=new X({apiKey:t,apiHost:e,fetch:ep,projectId:s,limitPolicy:dt}),u;if(lt(n)){let g=gt(n,!0);u=await ot({objects:(d=g.compositions)!=null?d:[],selectIdentifier:yt,selectDisplayName:bt})}else u=await ft({directory:n,selectIdentifier:yt,selectDisplayName:bt});let c=ei({client:l,state:o});await ct({source:u,target:c,mode:i,whatIf:r,log:ut({diffMode:a})})}};x();import tp from"isomorphic-unfetch";var Hs={command:"remove <id>",aliases:["delete","rm"],describe:"Delete a composition",builder:e=>te(ne(e.positional("id",{demandOption:!0,describe:"Composition public ID to delete"}))),handler:async({apiHost:e,apiKey:t,id:n,project:i})=>{await new X({apiKey:t,apiHost:e,fetch:tp,projectId:i}).removeComposition({compositionId:n})}};x();import np from"isomorphic-unfetch";var Ws={command:"update <filename>",aliases:["put"],describe:"Insert or update a composition",builder:e=>te(ne(Ue(e.positional("filename",{demandOption:!0,describe:"Composition file to put"})))),handler:async({apiHost:e,apiKey:t,filename:n,project:i,state:r})=>{let o=new X({apiKey:t,apiHost:e,fetch:np,projectId:i}),s=nn(n);await o.updateComposition({...s,state:pt(r)})}};var Ys={command:"composition <command>",describe:"Commands for Canvas compositions",aliases:["comp"],builder:e=>e.command($s).command(Us).command(Ts).command(Hs).command(Rs).command(Ws).demandCommand(),handler:()=>{qt.help()}};var Xg={commands:[{command:"canvas <command>",aliases:["cv","pm","presentation"],describe:"Uniform Canvas commands",builder:e=>e.command(Ys).command(Ns).demandCommand(),handler:()=>{qt.showHelp()}}]};export{gt as readCanvasPackage,Xg as uniformCLI,Xn as writeCanvasPackage};
|
98
99
|
/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */
|
99
100
|
/**
|
100
101
|
* @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
|