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