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