/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/@hperchec/juisy@1.4.0/src/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
const getCallerFile=require("get-caller-file"),Yargs=require("yargs/yargs"),utils=require("./utils");exports.createCli=function(t){return function(o){const i=initYargs(Yargs(o));return t(i)}};const cliTools=exports.cliTools={async extractUsage(t,o=!1,i=[""],n="en"){const e=t([""]);e.locale(n);const a={command:void 0,args:void 0,aliases:void 0,extractedUsage:void 0,rawUsage:void 0,children:o?{}:void 0};await e.parseAsync(i,{help:!0},(function(t,o,i){if(t)throw t;const n=this;a.args=o._,a.command=o._[o._.length-1],a.rawUsage=i;const e=a.extractedUsage={};e.demandedCommands=n.getDemandedCommands(),e.demandedOptions=n.getDemandedOptions(),e.deprecatedOptions=n.getDeprecatedOptions(),e.groups=n.getGroups(),e.options=n.getOptions();const s=n.getInternalMethods(),r=s.getUsageInstance();e.usages=r.getUsage();const m=s.getCommandInstance();a.aliases=m.aliasMap;const l=m.handlers,d=r.getCommands();e.commands=Object.keys(l).reduce(((t,o)=>{const[i,n,e,a,s]=d.find((t=>t[0]===l[o].original));return t[o]={cmd:i,description:n,isDefault:e,aliases:a,deprecated:s},t}),{})}));if(o)for(const o in a.extractedUsage.commands)a.children[o]=await cliTools.extractUsage(t,!0,[...i.filter((t=>""!==t)),o],n);return a}};function initYargs(t){t._isPrivate=!1,t._globalCommandVisitors={},t._globalCommandVisitorsEnabled=new Set([]),t._meta={};const o=t.commandDir;return t.originalCommandDir=o,t.commandDir=commandDir,t.globalCommandVisitor=globalCommandVisitor,t.globalCommandVisitorOptions=globalCommandVisitorOptions,t.hasGlobalCommandVisitor=hasGlobalCommandVisitor,t.disableGlobalCommandVisitors=disableGlobalCommandVisitors,t.enableGlobalCommandVisitors=enableGlobalCommandVisitors,t.isPrivate=isPrivate,t.getMeta=getMeta,t.globalCommandVisitor("private-command-visitor",privateCommandVisitor,privateCommandVisitor.options).globalCommandVisitor("get-meta-command-visitor",getMetaCommandVisitor,getMetaCommandVisitor.options).strict().help()}function commandDir(t,o={}){const i=this,n=o.visit||(t=>t);return i.getInternalMethods().getCommandInstance().addDirectory(t,require,getCallerFile(),{...o,visit:function(t,o,e){let a;for(const n of i._globalCommandVisitorsEnabled){const s=i._globalCommandVisitors[n];s(t,o,e,i,s.options)||(a=!0)}const s=n(t,o,e,i);return!a&&s}}),i}function globalCommandVisitor(t,o,i={}){return this._globalCommandVisitors[t]=o,this.enableGlobalCommandVisitors([t]).globalCommandVisitorOptions(t,i)}function globalCommandVisitorOptions(t,o){return this._globalCommandVisitors[t].options={...this._globalCommandVisitors[t].options,...o},this}function hasGlobalCommandVisitor(t){return Object.keys(this._globalCommandVisitors).includes(t)}function disableGlobalCommandVisitors(t=[]){for(const o of t){if(!this.hasGlobalCommandVisitor(o))throw new Error('Global command visitor: "'+o+'" not defined.');this._globalCommandVisitorsEnabled.delete(o)}return this}function enableGlobalCommandVisitors(t=[]){for(const o of t){if(!this.hasGlobalCommandVisitor(o))throw new Error('Global command visitor: "'+o+'" not defined.');this._globalCommandVisitorsEnabled.add(o)}return this}function isPrivate(){return this._isPrivate}function getMeta(){return this._meta}function wrapBuilder(t,o){const i=t||(t=>t);return function(t){return i(o(t))}}function privateCommandVisitor(t,o,i,n,e){const{cmdObjectProp:a,envKey:s}=e;if(t[a]){if("private"!==process.env[s])return!1;t.builder=wrapBuilder(t.builder,(function(t){return t._isPrivate=!0,t}))}return t}function getMetaCommandVisitor(t,o,i,n,e){const{cmdObjectProp:a}=e;if(t[a]){const o=t[a];t.builder=wrapBuilder(t.builder,(function(t){return t._meta=utils.merge(t._meta,o),t}))}return t}exports.utils=utils,privateCommandVisitor.options={cmdObjectProp:"private",envKey:"CLI_ENV"},getMetaCommandVisitor.options={cmdObjectProp:"meta"};
//# sourceMappingURL=/sm/637b499f13d3fdfb8c9c588eddb88f4281e7ea7af7a49abd4809818101981741.map