derived-cli 0.0.65 → 0.0.67

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.
Files changed (2) hide show
  1. package/dist/bundle.js +87 -82
  2. package/package.json +1 -1
package/dist/bundle.js CHANGED
@@ -1,93 +1,98 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var rs=Object.create;var le=Object.defineProperty;var ss=Object.getOwnPropertyDescriptor;var ns=Object.getOwnPropertyNames;var is=Object.getPrototypeOf,us=Object.prototype.hasOwnProperty;var os=(s,e)=>()=>(s&&(e=s(s=0)),e);var I=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports),xt=(s,e)=>{for(var t in e)le(s,t,{get:e[t],enumerable:!0})},Ot=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ns(e))!us.call(s,i)&&i!==t&&le(s,i,{get:()=>e[i],enumerable:!(n=ss(e,i))||n.enumerable});return s};var b=(s,e,t)=>(t=s!=null?rs(is(s)):{},Ot(e||!s||!s.__esModule?le(t,"default",{value:s,enumerable:!0}):t,s)),as=s=>Ot(le({},"__esModule",{value:!0}),s);var ne=I(Ne=>{var De=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},Ie=class extends De{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Ne.CommanderError=De;Ne.InvalidArgumentError=Ie});var ce=I(Me=>{var{InvalidArgumentError:ls}=ne(),je=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,n)=>{if(!this.argChoices.includes(t))throw new ls(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(t,n):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function Ds(s){let e=s.name()+(s.variadic===!0?"...":"");return s.required?"<"+e+">":"["+e+"]"}Me.Argument=je;Me.humanReadableArgName=Ds});var Ge=I(He=>{var{humanReadableArgName:cs}=ce(),Ve=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(i=>!i._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((i,u)=>i.name().localeCompare(u.name())),t}compareOptions(e,t){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(i=>!i.hidden),n=e._getHelpOption();if(n&&!n.hidden){let i=n.short&&e._findOption(n.short),u=n.long&&e._findOption(n.long);!i&&!u?t.push(n):n.long&&!u?t.push(e.createOption(n.long,n.description)):n.short&&!i&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let i=n.options.filter(u=>!u.hidden);t.push(...i)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(n=>cs(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(i)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(i)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,""]}groupItems(e,t,n){let i=new Map;return e.forEach(u=>{let r=n(u);i.has(r)||i.set(r,[])}),t.forEach(u=>{let r=n(u);i.has(r)||i.set(r,[]),i.get(r).push(u)}),i}formatHelp(e,t){let n=t.padWidth(e,t),i=t.helpWidth??80;function u(D,p){return t.formatItem(D,n,p,t)}let r=[`${t.styleTitle("Usage:")} ${t.styleUsage(t.commandUsage(e))}`,""],o=t.commandDescription(e);o.length>0&&(r=r.concat([t.boxWrap(t.styleCommandDescription(o),i),""]));let a=t.visibleArguments(e).map(D=>u(t.styleArgumentTerm(t.argumentTerm(D)),t.styleArgumentDescription(t.argumentDescription(D))));if(r=r.concat(this.formatItemList("Arguments:",a,t)),this.groupItems(e.options,t.visibleOptions(e),D=>D.helpGroupHeading??"Options:").forEach((D,p)=>{let C=D.map($=>u(t.styleOptionTerm(t.optionTerm($)),t.styleOptionDescription(t.optionDescription($))));r=r.concat(this.formatItemList(p,C,t))}),t.showGlobalOptions){let D=t.visibleGlobalOptions(e).map(p=>u(t.styleOptionTerm(t.optionTerm(p)),t.styleOptionDescription(t.optionDescription(p))));r=r.concat(this.formatItemList("Global Options:",D,t))}return this.groupItems(e.commands,t.visibleCommands(e),D=>D.helpGroup()||"Commands:").forEach((D,p)=>{let C=D.map($=>u(t.styleSubcommandTerm(t.subcommandTerm($)),t.styleSubcommandDescription(t.subcommandDescription($))));r=r.concat(this.formatItemList(p,C,t))}),r.join(`
3
- `)}displayWidth(e){return kt(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t==="[command]"?this.styleSubcommandText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleCommandText(t)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleSubcommandText(t)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,i){let r=" ".repeat(2);if(!n)return r+e;let o=e.padEnd(t+e.length-i.displayWidth(e)),a=2,l=(this.helpWidth??80)-t-a-2,D;return l<this.minWidthToWrap||i.preformatted(n)?D=n:D=i.boxWrap(n,l).replace(/\n/g,`
2
+ "use strict";var os=Object.create;var le=Object.defineProperty;var as=Object.getOwnPropertyDescriptor;var ls=Object.getOwnPropertyNames;var Ds=Object.getPrototypeOf,cs=Object.prototype.hasOwnProperty;var hs=(s,e)=>()=>(s&&(e=s(s=0)),e);var I=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports),St=(s,e)=>{for(var t in e)le(s,t,{get:e[t],enumerable:!0})},Tt=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ls(e))!cs.call(s,n)&&n!==t&&le(s,n,{get:()=>e[n],enumerable:!(i=as(e,n))||i.enumerable});return s};var C=(s,e,t)=>(t=s!=null?os(Ds(s)):{},Tt(e||!s||!s.__esModule?le(t,"default",{value:s,enumerable:!0}):t,s)),ps=s=>Tt(le({},"__esModule",{value:!0}),s);var ne=I(Me=>{var De=class extends Error{constructor(e,t,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},Ne=class extends De{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Me.CommanderError=De;Me.InvalidArgumentError=Ne});var ce=I(He=>{var{InvalidArgumentError:ds}=ne(),Ve=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,i)=>{if(!this.argChoices.includes(t))throw new ds(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(t,i):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function ms(s){let e=s.name()+(s.variadic===!0?"...":"");return s.required?"<"+e+">":"["+e+"]"}He.Argument=Ve;He.humanReadableArgName=ms});var Re=I(We=>{var{humanReadableArgName:fs}=ce(),Ge=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(n=>!n._hidden),i=e._getHelpCommand();return i&&!i._hidden&&t.push(i),this.sortSubcommands&&t.sort((n,u)=>n.name().localeCompare(u.name())),t}compareOptions(e,t){let i=n=>n.short?n.short.replace(/^-/,""):n.long.replace(/^--/,"");return i(e).localeCompare(i(t))}visibleOptions(e){let t=e.options.filter(n=>!n.hidden),i=e._getHelpOption();if(i&&!i.hidden){let n=i.short&&e._findOption(i.short),u=i.long&&e._findOption(i.long);!n&&!u?t.push(i):i.long&&!u?t.push(e.createOption(i.long,i.description)):i.short&&!n&&t.push(e.createOption(i.short,i.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let i=e.parent;i;i=i.parent){let n=i.options.filter(u=>!u.hidden);t.push(...n)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(i=>fs(i)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((i,n)=>Math.max(i,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((i,n)=>Math.max(i,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((i,n)=>Math.max(i,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((i,n)=>Math.max(i,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let i="";for(let n=e.parent;n;n=n.parent)i=n.name()+" "+i;return i+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let i=`(${t.join(", ")})`;return e.description?`${e.description} ${i}`:i}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let i=`(${t.join(", ")})`;return e.description?`${e.description} ${i}`:i}return e.description}formatItemList(e,t,i){return t.length===0?[]:[i.styleTitle(e),...t,""]}groupItems(e,t,i){let n=new Map;return e.forEach(u=>{let r=i(u);n.has(r)||n.set(r,[])}),t.forEach(u=>{let r=i(u);n.has(r)||n.set(r,[]),n.get(r).push(u)}),n}formatHelp(e,t){let i=t.padWidth(e,t),n=t.helpWidth??80;function u(D,p){return t.formatItem(D,i,p,t)}let r=[`${t.styleTitle("Usage:")} ${t.styleUsage(t.commandUsage(e))}`,""],o=t.commandDescription(e);o.length>0&&(r=r.concat([t.boxWrap(t.styleCommandDescription(o),n),""]));let a=t.visibleArguments(e).map(D=>u(t.styleArgumentTerm(t.argumentTerm(D)),t.styleArgumentDescription(t.argumentDescription(D))));if(r=r.concat(this.formatItemList("Arguments:",a,t)),this.groupItems(e.options,t.visibleOptions(e),D=>D.helpGroupHeading??"Options:").forEach((D,p)=>{let E=D.map($=>u(t.styleOptionTerm(t.optionTerm($)),t.styleOptionDescription(t.optionDescription($))));r=r.concat(this.formatItemList(p,E,t))}),t.showGlobalOptions){let D=t.visibleGlobalOptions(e).map(p=>u(t.styleOptionTerm(t.optionTerm(p)),t.styleOptionDescription(t.optionDescription(p))));r=r.concat(this.formatItemList("Global Options:",D,t))}return this.groupItems(e.commands,t.visibleCommands(e),D=>D.helpGroup()||"Commands:").forEach((D,p)=>{let E=D.map($=>u(t.styleSubcommandTerm(t.subcommandTerm($)),t.styleSubcommandDescription(t.subcommandDescription($))));r=r.concat(this.formatItemList(p,E,t))}),r.join(`
3
+ `)}displayWidth(e){return Pt(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t==="[command]"?this.styleSubcommandText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleCommandText(t)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleSubcommandText(t)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,i,n){let r=" ".repeat(2);if(!i)return r+e;let o=e.padEnd(t+e.length-n.displayWidth(e)),a=2,l=(this.helpWidth??80)-t-a-2,D;return l<this.minWidthToWrap||n.preformatted(i)?D=i:D=n.boxWrap(i,l).replace(/\n/g,`
4
4
  `+" ".repeat(t+a)),r+o+" ".repeat(a)+D.replace(/\n/g,`
5
- ${r}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),i=/[\s]*[^\s]+/g,u=[];return n.forEach(r=>{let o=r.match(i);if(o===null){u.push("");return}let a=[o.shift()],c=this.displayWidth(a[0]);o.forEach(l=>{let D=this.displayWidth(l);if(c+D<=t){a.push(l),c+=D;return}u.push(a.join(""));let p=l.trimStart();a=[p],c=this.displayWidth(p)}),u.push(a.join(""))}),u.join(`
6
- `)}};function kt(s){let e=/\x1b\[\d*(;\d*)*m/g;return s.replace(e,"")}He.Help=Ve;He.stripColor=kt});var Le=I(qe=>{var{InvalidArgumentError:hs}=ne(),We=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=ps(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e=="string"&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,n)=>{if(!this.argChoices.includes(t))throw new hs(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(t,n):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?St(this.name().replace(/^no-/,"")):St(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Re=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let i=this.negativeOptions.get(n).presetArg,u=i!==void 0?i:!1;return t.negate===(u===e)}};function St(s){return s.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function ps(s){let e,t,n=/^-[^-]$/,i=/^--[^-]/,u=s.split(/[ |,]+/).concat("guard");if(n.test(u[0])&&(e=u.shift()),i.test(u[0])&&(t=u.shift()),!e&&n.test(u[0])&&(e=u.shift()),!e&&i.test(u[0])&&(e=t,t=u.shift()),u[0].startsWith("-")){let r=u[0],o=`option creation failed due to '${r}' in option flags '${s}'`;throw/^-[^-][^-]/.test(r)?new Error(`${o}
5
+ ${r}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let i=e.split(/\r\n|\n/),n=/[\s]*[^\s]+/g,u=[];return i.forEach(r=>{let o=r.match(n);if(o===null){u.push("");return}let a=[o.shift()],c=this.displayWidth(a[0]);o.forEach(l=>{let D=this.displayWidth(l);if(c+D<=t){a.push(l),c+=D;return}u.push(a.join(""));let p=l.trimStart();a=[p],c=this.displayWidth(p)}),u.push(a.join(""))}),u.join(`
6
+ `)}};function Pt(s){let e=/\x1b\[\d*(;\d*)*m/g;return s.replace(e,"")}We.Help=Ge;We.stripColor=Pt});var Je=I(Ue=>{var{InvalidArgumentError:gs}=ne(),qe=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let i=Cs(e);this.short=i.shortFlag,this.long=i.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e=="string"&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,i)=>{if(!this.argChoices.includes(t))throw new gs(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(t,i):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?It(this.name().replace(/^no-/,"")):It(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Le=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,i)=>{this.positiveOptions.has(i)&&this.dualOptions.add(i)})}valueFromOption(e,t){let i=t.attributeName();if(!this.dualOptions.has(i))return!0;let n=this.negativeOptions.get(i).presetArg,u=n!==void 0?n:!1;return t.negate===(u===e)}};function It(s){return s.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function Cs(s){let e,t,i=/^-[^-]$/,n=/^--[^-]/,u=s.split(/[ |,]+/).concat("guard");if(i.test(u[0])&&(e=u.shift()),n.test(u[0])&&(t=u.shift()),!e&&i.test(u[0])&&(e=u.shift()),!e&&n.test(u[0])&&(e=t,t=u.shift()),u[0].startsWith("-")){let r=u[0],o=`option creation failed due to '${r}' in option flags '${s}'`;throw/^-[^-][^-]/.test(r)?new Error(`${o}
7
7
  - a short flag is a single dash and a single character
8
8
  - either use a single dash and a single character (for a short flag)
9
- - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):n.test(r)?new Error(`${o}
10
- - too many short flags`):i.test(r)?new Error(`${o}
9
+ - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):i.test(r)?new Error(`${o}
10
+ - too many short flags`):n.test(r)?new Error(`${o}
11
11
  - too many long flags`):new Error(`${o}
12
- - unrecognised flag format`)}if(e===void 0&&t===void 0)throw new Error(`option creation failed due to no flags found in '${s}'.`);return{shortFlag:e,longFlag:t}}qe.Option=We;qe.DualOptions=Re});var Pt=I(Tt=>{function ds(s,e){if(Math.abs(s.length-e.length)>3)return Math.max(s.length,e.length);let t=[];for(let n=0;n<=s.length;n++)t[n]=[n];for(let n=0;n<=e.length;n++)t[0][n]=n;for(let n=1;n<=e.length;n++)for(let i=1;i<=s.length;i++){let u=1;s[i-1]===e[n-1]?u=0:u=1,t[i][n]=Math.min(t[i-1][n]+1,t[i][n-1]+1,t[i-1][n-1]+u),i>1&&n>1&&s[i-1]===e[n-2]&&s[i-2]===e[n-1]&&(t[i][n]=Math.min(t[i][n],t[i-2][n-2]+1))}return t[s.length][e.length]}function ms(s,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=s.startsWith("--");t&&(s=s.slice(2),e=e.map(r=>r.slice(2)));let n=[],i=3,u=.4;return e.forEach(r=>{if(r.length<=1)return;let o=ds(s,r),a=Math.max(s.length,r.length);(a-o)/a>u&&(o<i?(i=o,n=[r]):o===i&&n.push(r))}),n.sort((r,o)=>r.localeCompare(o)),t&&(n=n.map(r=>`--${r}`)),n.length>1?`
13
- (Did you mean one of ${n.join(", ")}?)`:n.length===1?`
14
- (Did you mean ${n[0]}?)`:""}Tt.suggestSimilar=ms});var Mt=I(Ye=>{var fs=require("node:events").EventEmitter,Ue=require("node:child_process"),M=require("node:path"),he=require("node:fs"),m=require("node:process"),{Argument:gs,humanReadableArgName:Cs}=ce(),{CommanderError:Je}=ne(),{Help:Fs,stripColor:Es}=Ge(),{Option:It,DualOptions:ys}=Le(),{suggestSimilar:Nt}=Pt(),Ke=class s extends fs{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:t=>m.stdout.write(t),writeErr:t=>m.stderr.write(t),outputError:(t,n)=>n(t),getOutHelpWidth:()=>m.stdout.isTTY?m.stdout.columns:void 0,getErrHelpWidth:()=>m.stderr.isTTY?m.stderr.columns:void 0,getOutHasColors:()=>ze()??(m.stdout.isTTY&&m.stdout.hasColors?.()),getErrHasColors:()=>ze()??(m.stderr.isTTY&&m.stderr.hasColors?.()),stripColor:t=>Es(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,n){let i=t,u=n;typeof i=="object"&&i!==null&&(u=i,i=null),u=u||{};let[,r,o]=e.match(/([^ ]+) *(.*)/),a=this.createCommand(r);return i&&(a.description(i),a._executableHandler=!0),u.isDefault&&(this._defaultCommandName=a._name),a._hidden=!!(u.noHelp||u.hidden),a._executableFile=u.executableFile||null,o&&a.arguments(o),this._registerCommand(a),a.parent=this,a.copyInheritedSettings(this),i?this:a}createCommand(e){return new s(e)}createHelp(){return Object.assign(new Fs,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
15
- - specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new gs(e,t)}argument(e,t,n,i){let u=this.createArgument(e,t);return typeof n=="function"?u.default(i).argParser(n):u.default(n),this.addArgument(u),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t?.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let n=e??"help [command]",[,i,u]=n.match(/([^ ]+) *(.*)/),r=t??"display help for command",o=this.createCommand(i);return o.helpOption(!1),u&&o.arguments(u),r&&o.description(r),this._addImplicitHelpCommand=!0,this._helpCommand=o,(e||t)&&this._initCommandGroup(o),this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
16
- Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,n){this._exitCallback&&this._exitCallback(new Je(e,t,n)),m.exit(e)}action(e){let t=n=>{let i=this.registeredArguments.length,u=n.slice(0,i);return this._storeOptionsAsProperties?u[i]=this:u[i]=this.opts(),u.push(this),e.apply(this,u)};return this._actionHandler=t,this}createOption(e,t){return new It(e,t)}_callParseArg(e,t,n,i){try{return e.parseArg(t,n)}catch(u){if(u.code==="commander.invalidArgument"){let r=`${i} ${u.message}`;this.error(r,{exitCode:u.exitCode,code:u.code})}throw u}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
17
- - already used by option '${t.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let t=i=>[i.name()].concat(i.aliases()),n=t(e).find(i=>this._findCommand(i));if(n){let i=t(this._findCommand(n)).join("|"),u=t(e).join("|");throw new Error(`cannot add command '${u}' as already have command '${i}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),n=e.attributeName();if(e.negate){let u=e.long.replace(/^--no-/,"--");this._findOption(u)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");let i=(u,r,o)=>{u==null&&e.presetArg!==void 0&&(u=e.presetArg);let a=this.getOptionValue(n);u!==null&&e.parseArg?u=this._callParseArg(e,u,a,r):u!==null&&e.variadic&&(u=e._collectValue(u,a)),u==null&&(e.negate?u=!1:e.isBoolean()||e.optional?u=!0:u=""),this.setOptionValueWithSource(n,u,o)};return this.on("option:"+t,u=>{let r=`error: option '${e.flags}' argument '${u}' is invalid.`;i(u,r,"cli")}),e.envVar&&this.on("optionEnv:"+t,u=>{let r=`error: option '${e.flags}' value '${u}' from env '${e.envVar}' is invalid.`;i(u,r,"env")}),this}_optionEx(e,t,n,i,u){if(typeof t=="object"&&t instanceof It)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let r=this.createOption(t,n);if(r.makeOptionMandatory(!!e.mandatory),typeof i=="function")r.default(u).argParser(i);else if(i instanceof RegExp){let o=i;i=(a,c)=>{let l=o.exec(a);return l?l[0]:c},r.default(u).argParser(i)}else r.default(i);return this.addOption(r)}option(e,t,n,i){return this._optionEx({},e,t,n,i)}requiredOption(e,t,n,i){return this._optionEx({mandatory:!0},e,t,n,i)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,n){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(t=n.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){m.versions?.electron&&(t.from="electron");let i=m.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(t.from="eval")}e===void 0&&(e=m.argv),this.rawArgs=e.slice();let n;switch(t.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":m.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return this._parseCommand([],n),this}async parseAsync(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
18
- - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,t,n){if(he.existsSync(e))return;let i=t?`searched for local subcommand relative to directory '${t}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",u=`'${e}' does not exist
19
- - if '${n}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
12
+ - unrecognised flag format`)}if(e===void 0&&t===void 0)throw new Error(`option creation failed due to no flags found in '${s}'.`);return{shortFlag:e,longFlag:t}}Ue.Option=qe;Ue.DualOptions=Le});var Nt=I(jt=>{function Fs(s,e){if(Math.abs(s.length-e.length)>3)return Math.max(s.length,e.length);let t=[];for(let i=0;i<=s.length;i++)t[i]=[i];for(let i=0;i<=e.length;i++)t[0][i]=i;for(let i=1;i<=e.length;i++)for(let n=1;n<=s.length;n++){let u=1;s[n-1]===e[i-1]?u=0:u=1,t[n][i]=Math.min(t[n-1][i]+1,t[n][i-1]+1,t[n-1][i-1]+u),n>1&&i>1&&s[n-1]===e[i-2]&&s[n-2]===e[i-1]&&(t[n][i]=Math.min(t[n][i],t[n-2][i-2]+1))}return t[s.length][e.length]}function Es(s,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=s.startsWith("--");t&&(s=s.slice(2),e=e.map(r=>r.slice(2)));let i=[],n=3,u=.4;return e.forEach(r=>{if(r.length<=1)return;let o=Fs(s,r),a=Math.max(s.length,r.length);(a-o)/a>u&&(o<n?(n=o,i=[r]):o===n&&i.push(r))}),i.sort((r,o)=>r.localeCompare(o)),t&&(i=i.map(r=>`--${r}`)),i.length>1?`
13
+ (Did you mean one of ${i.join(", ")}?)`:i.length===1?`
14
+ (Did you mean ${i[0]}?)`:""}jt.suggestSimilar=Es});var Gt=I(Ze=>{var ys=require("node:events").EventEmitter,Ke=require("node:child_process"),M=require("node:path"),he=require("node:fs"),f=require("node:process"),{Argument:bs,humanReadableArgName:vs}=ce(),{CommanderError:ze}=ne(),{Help:$s,stripColor:ws}=Re(),{Option:Mt,DualOptions:As}=Je(),{suggestSimilar:Vt}=Nt(),Ye=class s extends ys{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:t=>f.stdout.write(t),writeErr:t=>f.stderr.write(t),outputError:(t,i)=>i(t),getOutHelpWidth:()=>f.stdout.isTTY?f.stdout.columns:void 0,getErrHelpWidth:()=>f.stderr.isTTY?f.stderr.columns:void 0,getOutHasColors:()=>Qe()??(f.stdout.isTTY&&f.stdout.hasColors?.()),getErrHasColors:()=>Qe()??(f.stderr.isTTY&&f.stderr.hasColors?.()),stripColor:t=>ws(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,i){let n=t,u=i;typeof n=="object"&&n!==null&&(u=n,n=null),u=u||{};let[,r,o]=e.match(/([^ ]+) *(.*)/),a=this.createCommand(r);return n&&(a.description(n),a._executableHandler=!0),u.isDefault&&(this._defaultCommandName=a._name),a._hidden=!!(u.noHelp||u.hidden),a._executableFile=u.executableFile||null,o&&a.arguments(o),this._registerCommand(a),a.parent=this,a.copyInheritedSettings(this),n?this:a}createCommand(e){return new s(e)}createHelp(){return Object.assign(new $s,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
15
+ - specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new bs(e,t)}argument(e,t,i,n){let u=this.createArgument(e,t);return typeof i=="function"?u.default(n).argParser(i):u.default(i),this.addArgument(u),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t?.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let i=e??"help [command]",[,n,u]=i.match(/([^ ]+) *(.*)/),r=t??"display help for command",o=this.createCommand(n);return o.helpOption(!1),u&&o.arguments(u),r&&o.description(r),this._addImplicitHelpCommand=!0,this._helpCommand=o,(e||t)&&this._initCommandGroup(o),this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let i=["preSubcommand","preAction","postAction"];if(!i.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
16
+ Expecting one of '${i.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,i){this._exitCallback&&this._exitCallback(new ze(e,t,i)),f.exit(e)}action(e){let t=i=>{let n=this.registeredArguments.length,u=i.slice(0,n);return this._storeOptionsAsProperties?u[n]=this:u[n]=this.opts(),u.push(this),e.apply(this,u)};return this._actionHandler=t,this}createOption(e,t){return new Mt(e,t)}_callParseArg(e,t,i,n){try{return e.parseArg(t,i)}catch(u){if(u.code==="commander.invalidArgument"){let r=`${n} ${u.message}`;this.error(r,{exitCode:u.exitCode,code:u.code})}throw u}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let i=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${i}'
17
+ - already used by option '${t.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let t=n=>[n.name()].concat(n.aliases()),i=t(e).find(n=>this._findCommand(n));if(i){let n=t(this._findCommand(i)).join("|"),u=t(e).join("|");throw new Error(`cannot add command '${u}' as already have command '${n}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),i=e.attributeName();if(e.negate){let u=e.long.replace(/^--no-/,"--");this._findOption(u)||this.setOptionValueWithSource(i,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(i,e.defaultValue,"default");let n=(u,r,o)=>{u==null&&e.presetArg!==void 0&&(u=e.presetArg);let a=this.getOptionValue(i);u!==null&&e.parseArg?u=this._callParseArg(e,u,a,r):u!==null&&e.variadic&&(u=e._collectValue(u,a)),u==null&&(e.negate?u=!1:e.isBoolean()||e.optional?u=!0:u=""),this.setOptionValueWithSource(i,u,o)};return this.on("option:"+t,u=>{let r=`error: option '${e.flags}' argument '${u}' is invalid.`;n(u,r,"cli")}),e.envVar&&this.on("optionEnv:"+t,u=>{let r=`error: option '${e.flags}' value '${u}' from env '${e.envVar}' is invalid.`;n(u,r,"env")}),this}_optionEx(e,t,i,n,u){if(typeof t=="object"&&t instanceof Mt)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let r=this.createOption(t,i);if(r.makeOptionMandatory(!!e.mandatory),typeof n=="function")r.default(u).argParser(n);else if(n instanceof RegExp){let o=n;n=(a,c)=>{let l=o.exec(a);return l?l[0]:c},r.default(u).argParser(n)}else r.default(n);return this.addOption(r)}option(e,t,i,n){return this._optionEx({},e,t,i,n)}requiredOption(e,t,i,n){return this._optionEx({mandatory:!0},e,t,i,n)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,i){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=i,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(i=>{i.getOptionValueSource(e)!==void 0&&(t=i.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){f.versions?.electron&&(t.from="electron");let n=f.execArgv??[];(n.includes("-e")||n.includes("--eval")||n.includes("-p")||n.includes("--print"))&&(t.from="eval")}e===void 0&&(e=f.argv),this.rawArgs=e.slice();let i;switch(t.from){case void 0:case"node":this._scriptPath=e[1],i=e.slice(2);break;case"electron":f.defaultApp?(this._scriptPath=e[1],i=e.slice(2)):i=e.slice(1);break;case"user":i=e.slice(0);break;case"eval":i=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",i}parse(e,t){this._prepareForParse();let i=this._prepareUserArgs(e,t);return this._parseCommand([],i),this}async parseAsync(e,t){this._prepareForParse();let i=this._prepareUserArgs(e,t);return await this._parseCommand([],i),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
18
+ - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,t,i){if(he.existsSync(e))return;let n=t?`searched for local subcommand relative to directory '${t}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",u=`'${e}' does not exist
19
+ - if '${i}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
20
20
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
21
- - ${i}`;throw new Error(u)}_executeSubCommand(e,t){t=t.slice();let n=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function u(l,D){let p=M.resolve(l,D);if(he.existsSync(p))return p;if(i.includes(M.extname(D)))return;let C=i.find($=>he.existsSync(`${p}${$}`));if(C)return`${p}${C}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=e._executableFile||`${this._name}-${e._name}`,o=this._executableDir||"";if(this._scriptPath){let l;try{l=he.realpathSync(this._scriptPath)}catch{l=this._scriptPath}o=M.resolve(M.dirname(l),o)}if(o){let l=u(o,r);if(!l&&!e._executableFile&&this._scriptPath){let D=M.basename(this._scriptPath,M.extname(this._scriptPath));D!==this._name&&(l=u(o,`${D}-${e._name}`))}r=l||r}n=i.includes(M.extname(r));let a;m.platform!=="win32"?n?(t.unshift(r),t=jt(m.execArgv).concat(t),a=Ue.spawn(m.argv[0],t,{stdio:"inherit"})):a=Ue.spawn(r,t,{stdio:"inherit"}):(this._checkForMissingExecutable(r,o,e._name),t.unshift(r),t=jt(m.execArgv).concat(t),a=Ue.spawn(m.execPath,t,{stdio:"inherit"})),a.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(D=>{m.on(D,()=>{a.killed===!1&&a.exitCode===null&&a.kill(D)})});let c=this._exitCallback;a.on("close",l=>{l=l??1,c?c(new Je(l,"commander.executeSubCommandAsync","(close)")):m.exit(l)}),a.on("error",l=>{if(l.code==="ENOENT")this._checkForMissingExecutable(r,o,e._name);else if(l.code==="EACCES")throw new Error(`'${r}' not executable`);if(!c)m.exit(1);else{let D=new Je(1,"commander.executeSubCommandAsync","(error)");D.nestedError=l,c(D)}}),this.runningCommand=a}_dispatchSubcommand(e,t,n){let i=this._findCommand(e);i||this.help({error:!0}),i._prepareForParse();let u;return u=this._chainOrCallSubCommandHook(u,i,"preSubcommand"),u=this._chainOrCall(u,()=>{if(i._executableHandler)this._executeSubCommand(i,t.concat(n));else return i._parseCommand(t,n)}),u}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(n,i,u)=>{let r=i;if(i!==null&&n.parseArg){let o=`error: command-argument value '${i}' is invalid for argument '${n.name()}'.`;r=this._callParseArg(n,i,u,o)}return r};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,i)=>{let u=n.defaultValue;n.variadic?i<this.args.length?(u=this.args.slice(i),n.parseArg&&(u=u.reduce((r,o)=>e(n,o,r),n.defaultValue))):u===void 0&&(u=[]):i<this.args.length&&(u=this.args[i],n.parseArg&&(u=e(n,u,n.defaultValue))),t[i]=u}),this.processedArgs=t}_chainOrCall(e,t){return e?.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,i=[];return this._getCommandAndAncestors().reverse().filter(u=>u._lifeCycleHooks[t]!==void 0).forEach(u=>{u._lifeCycleHooks[t].forEach(r=>{i.push({hookedCommand:u,callback:r})})}),t==="postAction"&&i.reverse(),i.forEach(u=>{n=this._chainOrCall(n,()=>u.callback(u.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let i=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(u=>{i=this._chainOrCall(i,()=>u(this,t))}),i}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},u=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let r;return r=this._chainOrCallHooks(r,"preAction"),r=this._chainOrCall(r,()=>this._actionHandler(this.processedArgs)),this.parent&&(r=this._chainOrCall(r,()=>{this.parent.emit(u,e,t)})),r=this._chainOrCallHooks(r,"postAction"),r}if(this.parent?.listenerCount(u))i(),this._processArguments(),this.parent.emit(u,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let i=n.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let i=e.find(u=>n.conflictsWith.includes(u.attributeName()));i&&this._conflictingOption(n,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],i=t;function u(l){return l.length>1&&l[0]==="-"}let r=l=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(l)?!this._getCommandAndAncestors().some(D=>D.options.map(p=>p.short).some(p=>/^-\d$/.test(p))):!1,o=null,a=null,c=0;for(;c<e.length||a;){let l=a??e[c++];if(a=null,l==="--"){i===n&&i.push(l),i.push(...e.slice(c));break}if(o&&(!u(l)||r(l))){this.emit(`option:${o.name()}`,l);continue}if(o=null,u(l)){let D=this._findOption(l);if(D){if(D.required){let p=e[c++];p===void 0&&this.optionMissingArgument(D),this.emit(`option:${D.name()}`,p)}else if(D.optional){let p=null;c<e.length&&(!u(e[c])||r(e[c]))&&(p=e[c++]),this.emit(`option:${D.name()}`,p)}else this.emit(`option:${D.name()}`);o=D.variadic?D:null;continue}}if(l.length>2&&l[0]==="-"&&l[1]!=="-"){let D=this._findOption(`-${l[1]}`);if(D){D.required||D.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${D.name()}`,l.slice(2)):(this.emit(`option:${D.name()}`),a=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let D=l.indexOf("="),p=this._findOption(l.slice(0,D));if(p&&(p.required||p.optional)){this.emit(`option:${p.name()}`,l.slice(D+1));continue}}if(i===t&&u(l)&&!(this.commands.length===0&&r(l))&&(i=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(l)){t.push(l),n.push(...e.slice(c));break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l,...e.slice(c));break}else if(this._defaultCommandName){n.push(l,...e.slice(c));break}}if(this._passThroughOptions){i.push(l,...e.slice(c));break}i.push(l)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let i=this.options[n].attributeName();e[i]=i===this._versionOptionName?this._version:this[i]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
21
+ - ${n}`;throw new Error(u)}_executeSubCommand(e,t){t=t.slice();let i=!1,n=[".js",".ts",".tsx",".mjs",".cjs"];function u(l,D){let p=M.resolve(l,D);if(he.existsSync(p))return p;if(n.includes(M.extname(D)))return;let E=n.find($=>he.existsSync(`${p}${$}`));if(E)return`${p}${E}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=e._executableFile||`${this._name}-${e._name}`,o=this._executableDir||"";if(this._scriptPath){let l;try{l=he.realpathSync(this._scriptPath)}catch{l=this._scriptPath}o=M.resolve(M.dirname(l),o)}if(o){let l=u(o,r);if(!l&&!e._executableFile&&this._scriptPath){let D=M.basename(this._scriptPath,M.extname(this._scriptPath));D!==this._name&&(l=u(o,`${D}-${e._name}`))}r=l||r}i=n.includes(M.extname(r));let a;f.platform!=="win32"?i?(t.unshift(r),t=Ht(f.execArgv).concat(t),a=Ke.spawn(f.argv[0],t,{stdio:"inherit"})):a=Ke.spawn(r,t,{stdio:"inherit"}):(this._checkForMissingExecutable(r,o,e._name),t.unshift(r),t=Ht(f.execArgv).concat(t),a=Ke.spawn(f.execPath,t,{stdio:"inherit"})),a.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(D=>{f.on(D,()=>{a.killed===!1&&a.exitCode===null&&a.kill(D)})});let c=this._exitCallback;a.on("close",l=>{l=l??1,c?c(new ze(l,"commander.executeSubCommandAsync","(close)")):f.exit(l)}),a.on("error",l=>{if(l.code==="ENOENT")this._checkForMissingExecutable(r,o,e._name);else if(l.code==="EACCES")throw new Error(`'${r}' not executable`);if(!c)f.exit(1);else{let D=new ze(1,"commander.executeSubCommandAsync","(error)");D.nestedError=l,c(D)}}),this.runningCommand=a}_dispatchSubcommand(e,t,i){let n=this._findCommand(e);n||this.help({error:!0}),n._prepareForParse();let u;return u=this._chainOrCallSubCommandHook(u,n,"preSubcommand"),u=this._chainOrCall(u,()=>{if(n._executableHandler)this._executeSubCommand(n,t.concat(i));else return n._parseCommand(t,i)}),u}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(i,n,u)=>{let r=n;if(n!==null&&i.parseArg){let o=`error: command-argument value '${n}' is invalid for argument '${i.name()}'.`;r=this._callParseArg(i,n,u,o)}return r};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((i,n)=>{let u=i.defaultValue;i.variadic?n<this.args.length?(u=this.args.slice(n),i.parseArg&&(u=u.reduce((r,o)=>e(i,o,r),i.defaultValue))):u===void 0&&(u=[]):n<this.args.length&&(u=this.args[n],i.parseArg&&(u=e(i,u,i.defaultValue))),t[n]=u}),this.processedArgs=t}_chainOrCall(e,t){return e?.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let i=e,n=[];return this._getCommandAndAncestors().reverse().filter(u=>u._lifeCycleHooks[t]!==void 0).forEach(u=>{u._lifeCycleHooks[t].forEach(r=>{n.push({hookedCommand:u,callback:r})})}),t==="postAction"&&n.reverse(),n.forEach(u=>{i=this._chainOrCall(i,()=>u.callback(u.hookedCommand,this))}),i}_chainOrCallSubCommandHook(e,t,i){let n=e;return this._lifeCycleHooks[i]!==void 0&&this._lifeCycleHooks[i].forEach(u=>{n=this._chainOrCall(n,()=>u(this,t))}),n}_parseCommand(e,t){let i=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(i.operands),t=i.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(i.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let n=()=>{i.unknown.length>0&&this.unknownOption(i.unknown[0])},u=`command:${this.name()}`;if(this._actionHandler){n(),this._processArguments();let r;return r=this._chainOrCallHooks(r,"preAction"),r=this._chainOrCall(r,()=>this._actionHandler(this.processedArgs)),this.parent&&(r=this._chainOrCall(r,()=>{this.parent.emit(u,e,t)})),r=this._chainOrCallHooks(r,"postAction"),r}if(this.parent?.listenerCount(u))n(),this._processArguments(),this.parent.emit(u,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(n(),this._processArguments())}else this.commands.length?(n(),this.help({error:!0})):(n(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(i=>{let n=i.attributeName();return this.getOptionValue(n)===void 0?!1:this.getOptionValueSource(n)!=="default"});e.filter(i=>i.conflictsWith.length>0).forEach(i=>{let n=e.find(u=>i.conflictsWith.includes(u.attributeName()));n&&this._conflictingOption(i,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],i=[],n=t;function u(l){return l.length>1&&l[0]==="-"}let r=l=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(l)?!this._getCommandAndAncestors().some(D=>D.options.map(p=>p.short).some(p=>/^-\d$/.test(p))):!1,o=null,a=null,c=0;for(;c<e.length||a;){let l=a??e[c++];if(a=null,l==="--"){n===i&&n.push(l),n.push(...e.slice(c));break}if(o&&(!u(l)||r(l))){this.emit(`option:${o.name()}`,l);continue}if(o=null,u(l)){let D=this._findOption(l);if(D){if(D.required){let p=e[c++];p===void 0&&this.optionMissingArgument(D),this.emit(`option:${D.name()}`,p)}else if(D.optional){let p=null;c<e.length&&(!u(e[c])||r(e[c]))&&(p=e[c++]),this.emit(`option:${D.name()}`,p)}else this.emit(`option:${D.name()}`);o=D.variadic?D:null;continue}}if(l.length>2&&l[0]==="-"&&l[1]!=="-"){let D=this._findOption(`-${l[1]}`);if(D){D.required||D.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${D.name()}`,l.slice(2)):(this.emit(`option:${D.name()}`),a=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let D=l.indexOf("="),p=this._findOption(l.slice(0,D));if(p&&(p.required||p.optional)){this.emit(`option:${p.name()}`,l.slice(D+1));continue}}if(n===t&&u(l)&&!(this.commands.length===0&&r(l))&&(n=i),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&i.length===0){if(this._findCommand(l)){t.push(l),i.push(...e.slice(c));break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l,...e.slice(c));break}else if(this._defaultCommandName){i.push(l,...e.slice(c));break}}if(this._passThroughOptions){n.push(l,...e.slice(c));break}n.push(l)}return{operands:t,unknown:i}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let i=0;i<t;i++){let n=this.options[i].attributeName();e[n]=n===this._versionOptionName?this._version:this[n]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
22
22
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
23
23
  `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
24
- `),this.outputHelp({error:!0}));let n=t||{},i=n.exitCode||1,u=n.code||"commander.error";this._exit(i,u,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in m.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,m.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new ys(this.options),t=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(i=>!t(i)).forEach(i=>{this.setOptionValueWithSource(i,n.implied[i],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let n=r=>{let o=r.attributeName(),a=this.getOptionValue(o),c=this.options.find(D=>D.negate&&o===D.attributeName()),l=this.options.find(D=>!D.negate&&o===D.attributeName());return c&&(c.presetArg===void 0&&a===!1||c.presetArg!==void 0&&a===c.presetArg)?c:l||r},i=r=>{let o=n(r),a=o.attributeName();return this.getOptionValueSource(a)==="env"?`environment variable '${o.envVar}'`:`option '${o.flags}'`},u=`error: ${i(e)} cannot be used with ${i(t)}`;this.error(u,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],u=this;do{let r=u.createHelp().visibleOptions(u).filter(o=>o.long).map(o=>o.long);i=i.concat(r),u=u.parent}while(u&&!u._enablePositionalOptions);t=Nt(e,i)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,n=t===1?"":"s",u=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${n} but got ${e.length}.`;this.error(u,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(u=>{i.push(u.name()),u.alias()&&i.push(u.alias())}),t=Nt(e,i)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:"commander.unknownCommand"})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",n=n||"output the version number";let i=this.createOption(t,n);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e}
25
- `),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(e);if(n){let i=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(n=>Cs(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=M.basename(e,M.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),n=this._getOutputContext(e);t.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let i=t.formatHelp(this,t);return n.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(e){e=e||{};let t=!!e.error,n,i,u;return t?(n=o=>this._outputConfiguration.writeErr(o),i=this._outputConfiguration.getErrHasColors(),u=this._outputConfiguration.getErrHelpWidth()):(n=o=>this._outputConfiguration.writeOut(o),i=this._outputConfiguration.getOutHasColors(),u=this._outputConfiguration.getOutHelpWidth()),{error:t,write:o=>(i||(o=this._outputConfiguration.stripColor(o)),n(o)),hasColors:i,helpWidth:u}}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let n=this._getOutputContext(e),i={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(r=>r.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let u=this.helpInformation({error:n.error});if(t&&(u=t(u),typeof u!="string"&&!Buffer.isBuffer(u)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(u),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(r=>r.emit("afterAllHelp",i))}helpOption(e,t){return typeof e=="boolean"?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",t??"display help for command"),(e||t)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(m.exitCode??0);t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText.
26
- Expecting one of '${n.join("', '")}'`);let i=`${e}Help`;return this.on(i,u=>{let r;typeof t=="function"?r=t({error:u.error,command:u.command}):r=t,r&&u.write(`${r}
27
- `)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(i=>t.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function jt(s){return s.map(e=>{if(!e.startsWith("--inspect"))return e;let t,n="127.0.0.1",i="9229",u;return(u=e.match(/^(--inspect(-brk)?)$/))!==null?t=u[1]:(u=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=u[1],/^\d+$/.test(u[3])?i=u[3]:n=u[3]):(u=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=u[1],n=u[3],i=u[4]),t&&i!=="0"?`${t}=${n}:${parseInt(i)+1}`:e})}function ze(){if(m.env.NO_COLOR||m.env.FORCE_COLOR==="0"||m.env.FORCE_COLOR==="false")return!1;if(m.env.FORCE_COLOR||m.env.CLICOLOR_FORCE!==void 0)return!0}Ye.Command=Ke;Ye.useColor=ze});var Wt=I(k=>{var{Argument:Vt}=ce(),{Command:Qe}=Mt(),{CommanderError:bs,InvalidArgumentError:Ht}=ne(),{Help:$s}=Ge(),{Option:Gt}=Le();k.program=new Qe;k.createCommand=s=>new Qe(s);k.createOption=(s,e)=>new Gt(s,e);k.createArgument=(s,e)=>new Vt(s,e);k.Command=Qe;k.Option=Gt;k.Argument=Vt;k.Help=$s;k.CommanderError=bs;k.InvalidArgumentError=Ht;k.InvalidOptionArgumentError=Ht});var et=I((Ci,Lt)=>{"use strict";var Ze="\x1B",F=`${Ze}[`,vs="\x07",Xe={to(s,e){return e?`${F}${e+1};${s+1}H`:`${F}${s+1}G`},move(s,e){let t="";return s<0?t+=`${F}${-s}D`:s>0&&(t+=`${F}${s}C`),e<0?t+=`${F}${-e}A`:e>0&&(t+=`${F}${e}B`),t},up:(s=1)=>`${F}${s}A`,down:(s=1)=>`${F}${s}B`,forward:(s=1)=>`${F}${s}C`,backward:(s=1)=>`${F}${s}D`,nextLine:(s=1)=>`${F}E`.repeat(s),prevLine:(s=1)=>`${F}F`.repeat(s),left:`${F}G`,hide:`${F}?25l`,show:`${F}?25h`,save:`${Ze}7`,restore:`${Ze}8`},ws={up:(s=1)=>`${F}S`.repeat(s),down:(s=1)=>`${F}T`.repeat(s)},As={screen:`${F}2J`,up:(s=1)=>`${F}1J`.repeat(s),down:(s=1)=>`${F}J`.repeat(s),line:`${F}2K`,lineEnd:`${F}K`,lineStart:`${F}1K`,lines(s){let e="";for(let t=0;t<s;t++)e+=this.line+(t<s-1?Xe.up():"");return s&&(e+=Xe.left),e}};Lt.exports={cursor:Xe,scroll:ws,erase:As,beep:vs}});var me=I((Fi,tt)=>{var de=process||{},Ut=de.argv||[],pe=de.env||{},Bs=!(pe.NO_COLOR||Ut.includes("--no-color"))&&(!!pe.FORCE_COLOR||Ut.includes("--color")||de.platform==="win32"||(de.stdout||{}).isTTY&&pe.TERM!=="dumb"||!!pe.CI),_s=(s,e,t=s)=>n=>{let i=""+n,u=i.indexOf(e,s.length);return~u?s+xs(i,e,t,u)+e:s+i+e},xs=(s,e,t,n)=>{let i="",u=0;do i+=s.substring(u,n)+t,u=n+e.length,n=s.indexOf(e,u);while(~n);return i+s.substring(u)},Jt=(s=Bs)=>{let e=s?_s:()=>String;return{isColorSupported:s,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};tt.exports=Jt();tt.exports.createColors=Jt});var Er=I((Si,Fr)=>{"use strict";var pt=Object.defineProperty,gn=Object.getOwnPropertyDescriptor,Cn=Object.getOwnPropertyNames,Fn=Object.prototype.hasOwnProperty,En=(s,e)=>{for(var t in e)pt(s,t,{get:e[t],enumerable:!0})},yn=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Cn(e))!Fn.call(s,i)&&i!==t&&pt(s,i,{get:()=>e[i],enumerable:!(n=gn(e,i))||n.enumerable});return s},bn=s=>yn(pt({},"__esModule",{value:!0}),s),Cr={};En(Cr,{default:()=>wn});Fr.exports=bn(Cr);var $n=class{baseUrl;defaultHeaders;constructor(s,e={}){this.baseUrl=s,this.defaultHeaders=e}buildUrl(s){return`${this.baseUrl.replace(/\/$/,"")}/${s.replace(/^\//,"")}`}async request(s,e,t,n={}){let i=this.buildUrl(e),u=await fetch(i,{method:s,headers:{"Content-Type":"application/json",...this.defaultHeaders,...n},body:t?JSON.stringify(t):void 0});if(!u.ok){let o=await u.text().catch(()=>"");throw new Error(`HTTP ${u.status} ${u.statusText}: ${o||"Request failed"}`)}let r=await u.text();try{return JSON.parse(r)}catch{return r}}get(s,e){return this.request("GET",s,void 0,e)}post(s,e,t){return this.request("POST",s,e,t)}put(s,e,t){return this.request("PUT",s,e,t)}delete(s,e){return this.request("DELETE",s,void 0,e)}},vn=class{api;apiToken;constructor(s){this.apiToken=s?.apiToken,this.api=new $n("https://api.derived.dev/api",{...this.apiToken?{Authorization:this.apiToken}:{}})}fetchBlock=async s=>this.api.get(`/public/v1/template-group/code/${s}`);getBlockInputFromUserQuery=(s,e)=>this.api.post("/public/v1/template-group/get-block-input-from-user-query",{blockInput:s,query:e});resolveMultipleTemplates=(s,e)=>this.api.post("/public/v1/template-group/resolve-multiple-templates-by-block-code",{blockCode:s,data:e});searchBlocksByName=s=>this.api.get(`/public/v1/template-group/semantic-search?q=${s}&limit=5&threshold=0.5`);fetchProjectBySlug=async s=>this.api.get(`/public/v1/project/detail-by-slug/${s}`);createMultipleTemplates=async s=>this.api.post("/v1/template/create-multiple",s);createTemplateGroup=async s=>this.api.post("/v1/template-group/create",s);getProjectCategories=async(s,e=20,t=1)=>{let n=encodeURIComponent(JSON.stringify({projectID:s})),i=encodeURIComponent(JSON.stringify({Desc:"id"}));return this.api.get(`/v1/block-category/list?filters=${n}&sort=${i}&limit=${e}&page=${t}`)};createCategory=async s=>this.api.post("/v1/block-category/create",s);updateTemplateGroup=async(s,e)=>this.api.put(`/v1/template-group/update/${s}`,e)},wn=vn});var Lr={};xt(Lr,{isDirectoryEmpty:()=>Un,removeGitDirectory:()=>Jn});function Un(s){return(0,z.existsSync)(s)?(0,z.readdirSync)(s).filter(n=>!n.startsWith(".")).length===0:!0}function Jn(s){let e=(0,qr.join)(s,".git");(0,z.existsSync)(e)&&(0,z.rmSync)(e,{recursive:!0,force:!0})}var z,qr,Ur=os(()=>{"use strict";z=require("fs"),qr=require("path")});var Zn={};xt(Zn,{displayFileTree:()=>Qr});module.exports=as(Zn);var Rt=b(Wt(),1),{program:oi,createCommand:ai,createArgument:li,createOption:Di,CommanderError:ci,InvalidArgumentError:hi,InvalidOptionArgumentError:pi,Command:qt,Argument:di,Option:mi,Help:fi}=Rt.default;var ye=require("node:util");var w=b(et(),1),ee=require("node:process"),H=b(require("node:readline"),1),nt=b(require("node:readline"),1),rr=require("node:stream"),sr=b(me(),1);function Os({onlyFirst:s=!1}={}){let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(e,s?void 0:"g")}var ks=Os();function nr(s){if(typeof s!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof s}\``);return s.replace(ks,"")}function ir(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var ur={exports:{}};(function(s){var e={};s.exports=e,e.eastAsianWidth=function(n){var i=n.charCodeAt(0),u=n.length==2?n.charCodeAt(1):0,r=i;return 55296<=i&&i<=56319&&56320<=u&&u<=57343&&(i&=1023,u&=1023,r=i<<10|u,r+=65536),r==12288||65281<=r&&r<=65376||65504<=r&&r<=65510?"F":r==8361||65377<=r&&r<=65470||65474<=r&&r<=65479||65482<=r&&r<=65487||65490<=r&&r<=65495||65498<=r&&r<=65500||65512<=r&&r<=65518?"H":4352<=r&&r<=4447||4515<=r&&r<=4519||4602<=r&&r<=4607||9001<=r&&r<=9002||11904<=r&&r<=11929||11931<=r&&r<=12019||12032<=r&&r<=12245||12272<=r&&r<=12283||12289<=r&&r<=12350||12353<=r&&r<=12438||12441<=r&&r<=12543||12549<=r&&r<=12589||12593<=r&&r<=12686||12688<=r&&r<=12730||12736<=r&&r<=12771||12784<=r&&r<=12830||12832<=r&&r<=12871||12880<=r&&r<=13054||13056<=r&&r<=19903||19968<=r&&r<=42124||42128<=r&&r<=42182||43360<=r&&r<=43388||44032<=r&&r<=55203||55216<=r&&r<=55238||55243<=r&&r<=55291||63744<=r&&r<=64255||65040<=r&&r<=65049||65072<=r&&r<=65106||65108<=r&&r<=65126||65128<=r&&r<=65131||110592<=r&&r<=110593||127488<=r&&r<=127490||127504<=r&&r<=127546||127552<=r&&r<=127560||127568<=r&&r<=127569||131072<=r&&r<=194367||177984<=r&&r<=196605||196608<=r&&r<=262141?"W":32<=r&&r<=126||162<=r&&r<=163||165<=r&&r<=166||r==172||r==175||10214<=r&&r<=10221||10629<=r&&r<=10630?"Na":r==161||r==164||167<=r&&r<=168||r==170||173<=r&&r<=174||176<=r&&r<=180||182<=r&&r<=186||188<=r&&r<=191||r==198||r==208||215<=r&&r<=216||222<=r&&r<=225||r==230||232<=r&&r<=234||236<=r&&r<=237||r==240||242<=r&&r<=243||247<=r&&r<=250||r==252||r==254||r==257||r==273||r==275||r==283||294<=r&&r<=295||r==299||305<=r&&r<=307||r==312||319<=r&&r<=322||r==324||328<=r&&r<=331||r==333||338<=r&&r<=339||358<=r&&r<=359||r==363||r==462||r==464||r==466||r==468||r==470||r==472||r==474||r==476||r==593||r==609||r==708||r==711||713<=r&&r<=715||r==717||r==720||728<=r&&r<=731||r==733||r==735||768<=r&&r<=879||913<=r&&r<=929||931<=r&&r<=937||945<=r&&r<=961||963<=r&&r<=969||r==1025||1040<=r&&r<=1103||r==1105||r==8208||8211<=r&&r<=8214||8216<=r&&r<=8217||8220<=r&&r<=8221||8224<=r&&r<=8226||8228<=r&&r<=8231||r==8240||8242<=r&&r<=8243||r==8245||r==8251||r==8254||r==8308||r==8319||8321<=r&&r<=8324||r==8364||r==8451||r==8453||r==8457||r==8467||r==8470||8481<=r&&r<=8482||r==8486||r==8491||8531<=r&&r<=8532||8539<=r&&r<=8542||8544<=r&&r<=8555||8560<=r&&r<=8569||r==8585||8592<=r&&r<=8601||8632<=r&&r<=8633||r==8658||r==8660||r==8679||r==8704||8706<=r&&r<=8707||8711<=r&&r<=8712||r==8715||r==8719||r==8721||r==8725||r==8730||8733<=r&&r<=8736||r==8739||r==8741||8743<=r&&r<=8748||r==8750||8756<=r&&r<=8759||8764<=r&&r<=8765||r==8776||r==8780||r==8786||8800<=r&&r<=8801||8804<=r&&r<=8807||8810<=r&&r<=8811||8814<=r&&r<=8815||8834<=r&&r<=8835||8838<=r&&r<=8839||r==8853||r==8857||r==8869||r==8895||r==8978||9312<=r&&r<=9449||9451<=r&&r<=9547||9552<=r&&r<=9587||9600<=r&&r<=9615||9618<=r&&r<=9621||9632<=r&&r<=9633||9635<=r&&r<=9641||9650<=r&&r<=9651||9654<=r&&r<=9655||9660<=r&&r<=9661||9664<=r&&r<=9665||9670<=r&&r<=9672||r==9675||9678<=r&&r<=9681||9698<=r&&r<=9701||r==9711||9733<=r&&r<=9734||r==9737||9742<=r&&r<=9743||9748<=r&&r<=9749||r==9756||r==9758||r==9792||r==9794||9824<=r&&r<=9825||9827<=r&&r<=9829||9831<=r&&r<=9834||9836<=r&&r<=9837||r==9839||9886<=r&&r<=9887||9918<=r&&r<=9919||9924<=r&&r<=9933||9935<=r&&r<=9953||r==9955||9960<=r&&r<=9983||r==10045||r==10071||10102<=r&&r<=10111||11093<=r&&r<=11097||12872<=r&&r<=12879||57344<=r&&r<=63743||65024<=r&&r<=65039||r==65533||127232<=r&&r<=127242||127248<=r&&r<=127277||127280<=r&&r<=127337||127344<=r&&r<=127386||917760<=r&&r<=917999||983040<=r&&r<=1048573||1048576<=r&&r<=1114109?"A":"N"},e.characterLength=function(n){var i=this.eastAsianWidth(n);return i=="F"||i=="W"||i=="A"?2:1};function t(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(n){for(var i=t(n),u=0,r=0;r<i.length;r++)u=u+this.characterLength(i[r]);return u},e.slice=function(n,i,u){textLen=e.length(n),i=i||0,u=u||1,i<0&&(i=textLen+i),u<0&&(u=textLen+u);for(var r="",o=0,a=t(n),c=0;c<a.length;c++){var l=a[c],D=e.length(l);if(o>=i-(D==2?1:0))if(o+D<=u)r+=l;else break;o+=D}return r}})(ur);var Ss=ur.exports,Ts=ir(Ss),Ps=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},Is=ir(Ps);function ie(s,e={}){if(typeof s!="string"||s.length===0||(e={ambiguousIsNarrow:!0,...e},s=nr(s),s.length===0))return 0;s=s.replace(Is()," ");let t=e.ambiguousIsNarrow?1:2,n=0;for(let i of s){let u=i.codePointAt(0);if(!(u<=31||u>=127&&u<=159||u>=768&&u<=879))switch(Ts.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=t;break;default:n+=1}}return n}var rt=10,Kt=(s=0)=>e=>`\x1B[${e+s}m`,zt=(s=0)=>e=>`\x1B[${38+s};5;${e}m`,Yt=(s=0)=>(e,t,n)=>`\x1B[${38+s};2;${e};${t};${n}m`,g={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(g.modifier);var Ns=Object.keys(g.color),js=Object.keys(g.bgColor);[...Ns,...js];function Ms(){let s=new Map;for(let[e,t]of Object.entries(g)){for(let[n,i]of Object.entries(t))g[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},t[n]=g[n],s.set(i[0],i[1]);Object.defineProperty(g,e,{value:t,enumerable:!1})}return Object.defineProperty(g,"codes",{value:s,enumerable:!1}),g.color.close="\x1B[39m",g.bgColor.close="\x1B[49m",g.color.ansi=Kt(),g.color.ansi256=zt(),g.color.ansi16m=Yt(),g.bgColor.ansi=Kt(rt),g.bgColor.ansi256=zt(rt),g.bgColor.ansi16m=Yt(rt),Object.defineProperties(g,{rgbToAnsi256:{value:(e,t,n)=>e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:e=>{let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[n]=t;n.length===3&&(n=[...n].map(u=>u+u).join(""));let i=Number.parseInt(n,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:e=>g.rgbToAnsi256(...g.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,n,i;if(e>=232)t=((e-232)*10+8)/255,n=t,i=t;else{e-=16;let o=e%36;t=Math.floor(e/36)/5,n=Math.floor(o/6)/5,i=o%6/5}let u=Math.max(t,n,i)*2;if(u===0)return 30;let r=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(t));return u===2&&(r+=60),r},enumerable:!1},rgbToAnsi:{value:(e,t,n)=>g.ansi256ToAnsi(g.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>g.ansi256ToAnsi(g.hexToAnsi256(e)),enumerable:!1}}),g}var Vs=Ms(),Ee=new Set(["\x1B","\x9B"]),Hs=39,ut="\x07",or="[",Gs="]",ar="m",ot=`${Gs}8;;`,Qt=s=>`${Ee.values().next().value}${or}${s}${ar}`,Zt=s=>`${Ee.values().next().value}${ot}${s}${ut}`,Ws=s=>s.split(" ").map(e=>ie(e)),st=(s,e,t)=>{let n=[...e],i=!1,u=!1,r=ie(nr(s[s.length-1]));for(let[o,a]of n.entries()){let c=ie(a);if(r+c<=t?s[s.length-1]+=a:(s.push(a),r=0),Ee.has(a)&&(i=!0,u=n.slice(o+1).join("").startsWith(ot)),i){u?a===ut&&(i=!1,u=!1):a===ar&&(i=!1);continue}r+=c,r===t&&o<n.length-1&&(s.push(""),r=0)}!r&&s[s.length-1].length>0&&s.length>1&&(s[s.length-2]+=s.pop())},Rs=s=>{let e=s.split(" "),t=e.length;for(;t>0&&!(ie(e[t-1])>0);)t--;return t===e.length?s:e.slice(0,t).join(" ")+e.slice(t).join("")},qs=(s,e,t={})=>{if(t.trim!==!1&&s.trim()==="")return"";let n="",i,u,r=Ws(s),o=[""];for(let[c,l]of s.split(" ").entries()){t.trim!==!1&&(o[o.length-1]=o[o.length-1].trimStart());let D=ie(o[o.length-1]);if(c!==0&&(D>=e&&(t.wordWrap===!1||t.trim===!1)&&(o.push(""),D=0),(D>0||t.trim===!1)&&(o[o.length-1]+=" ",D++)),t.hard&&r[c]>e){let p=e-D,C=1+Math.floor((r[c]-p-1)/e);Math.floor((r[c]-1)/e)<C&&o.push(""),st(o,l,e);continue}if(D+r[c]>e&&D>0&&r[c]>0){if(t.wordWrap===!1&&D<e){st(o,l,e);continue}o.push("")}if(D+r[c]>e&&t.wordWrap===!1){st(o,l,e);continue}o[o.length-1]+=l}t.trim!==!1&&(o=o.map(c=>Rs(c)));let a=[...o.join(`
28
- `)];for(let[c,l]of a.entries()){if(n+=l,Ee.has(l)){let{groups:p}=new RegExp(`(?:\\${or}(?<code>\\d+)m|\\${ot}(?<uri>.*)${ut})`).exec(a.slice(c).join(""))||{groups:{}};if(p.code!==void 0){let C=Number.parseFloat(p.code);i=C===Hs?void 0:C}else p.uri!==void 0&&(u=p.uri.length===0?void 0:p.uri)}let D=Vs.codes.get(Number(i));a[c+1]===`
29
- `?(u&&(n+=Zt("")),i&&D&&(n+=Qt(D))):l===`
30
- `&&(i&&D&&(n+=Qt(i)),u&&(n+=Zt(u)))}return n};function Xt(s,e,t){return String(s).normalize().replace(/\r\n/g,`
24
+ `),this.outputHelp({error:!0}));let i=t||{},n=i.exitCode||1,u=i.code||"commander.error";this._exit(n,u,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in f.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,f.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new As(this.options),t=i=>this.getOptionValue(i)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(i));this.options.filter(i=>i.implied!==void 0&&t(i.attributeName())&&e.valueFromOption(this.getOptionValue(i.attributeName()),i)).forEach(i=>{Object.keys(i.implied).filter(n=>!t(n)).forEach(n=>{this.setOptionValueWithSource(n,i.implied[n],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let i=r=>{let o=r.attributeName(),a=this.getOptionValue(o),c=this.options.find(D=>D.negate&&o===D.attributeName()),l=this.options.find(D=>!D.negate&&o===D.attributeName());return c&&(c.presetArg===void 0&&a===!1||c.presetArg!==void 0&&a===c.presetArg)?c:l||r},n=r=>{let o=i(r),a=o.attributeName();return this.getOptionValueSource(a)==="env"?`environment variable '${o.envVar}'`:`option '${o.flags}'`},u=`error: ${n(e)} cannot be used with ${n(t)}`;this.error(u,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let n=[],u=this;do{let r=u.createHelp().visibleOptions(u).filter(o=>o.long).map(o=>o.long);n=n.concat(r),u=u.parent}while(u&&!u._enablePositionalOptions);t=Vt(e,n)}let i=`error: unknown option '${e}'${t}`;this.error(i,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,i=t===1?"":"s",u=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${i} but got ${e.length}.`;this.error(u,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(u=>{n.push(u.name()),u.alias()&&n.push(u.alias())}),t=Vt(e,n)}let i=`error: unknown command '${e}'${t}`;this.error(i,{code:"commander.unknownCommand"})}version(e,t,i){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",i=i||"output the version number";let n=this.createOption(t,i);return this._versionOptionName=n.attributeName(),this._registerOption(n),this.on("option:"+n.name(),()=>{this._outputConfiguration.writeOut(`${e}
25
+ `),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let i=this.parent?._findCommand(e);if(i){let n=[i.name()].concat(i.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${n}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(i=>vs(i));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=M.basename(e,M.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),i=this._getOutputContext(e);t.prepareContext({error:i.error,helpWidth:i.helpWidth,outputHasColors:i.hasColors});let n=t.formatHelp(this,t);return i.hasColors?n:this._outputConfiguration.stripColor(n)}_getOutputContext(e){e=e||{};let t=!!e.error,i,n,u;return t?(i=o=>this._outputConfiguration.writeErr(o),n=this._outputConfiguration.getErrHasColors(),u=this._outputConfiguration.getErrHelpWidth()):(i=o=>this._outputConfiguration.writeOut(o),n=this._outputConfiguration.getOutHasColors(),u=this._outputConfiguration.getOutHelpWidth()),{error:t,write:o=>(n||(o=this._outputConfiguration.stripColor(o)),i(o)),hasColors:n,helpWidth:u}}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let i=this._getOutputContext(e),n={error:i.error,write:i.write,command:this};this._getCommandAndAncestors().reverse().forEach(r=>r.emit("beforeAllHelp",n)),this.emit("beforeHelp",n);let u=this.helpInformation({error:i.error});if(t&&(u=t(u),typeof u!="string"&&!Buffer.isBuffer(u)))throw new Error("outputHelp callback must return a string or a Buffer");i.write(u),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",n),this._getCommandAndAncestors().forEach(r=>r.emit("afterAllHelp",n))}helpOption(e,t){return typeof e=="boolean"?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",t??"display help for command"),(e||t)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(f.exitCode??0);t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let i=["beforeAll","before","after","afterAll"];if(!i.includes(e))throw new Error(`Unexpected value for position to addHelpText.
26
+ Expecting one of '${i.join("', '")}'`);let n=`${e}Help`;return this.on(n,u=>{let r;typeof t=="function"?r=t({error:u.error,command:u.command}):r=t,r&&u.write(`${r}
27
+ `)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(n=>t.is(n))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Ht(s){return s.map(e=>{if(!e.startsWith("--inspect"))return e;let t,i="127.0.0.1",n="9229",u;return(u=e.match(/^(--inspect(-brk)?)$/))!==null?t=u[1]:(u=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=u[1],/^\d+$/.test(u[3])?n=u[3]:i=u[3]):(u=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=u[1],i=u[3],n=u[4]),t&&n!=="0"?`${t}=${i}:${parseInt(n)+1}`:e})}function Qe(){if(f.env.NO_COLOR||f.env.FORCE_COLOR==="0"||f.env.FORCE_COLOR==="false")return!1;if(f.env.FORCE_COLOR||f.env.CLICOLOR_FORCE!==void 0)return!0}Ze.Command=Ye;Ze.useColor=Qe});var Lt=I(k=>{var{Argument:Wt}=ce(),{Command:Xe}=Gt(),{CommanderError:Bs,InvalidArgumentError:Rt}=ne(),{Help:_s}=Re(),{Option:qt}=Je();k.program=new Xe;k.createCommand=s=>new Xe(s);k.createOption=(s,e)=>new qt(s,e);k.createArgument=(s,e)=>new Wt(s,e);k.Command=Xe;k.Option=qt;k.Argument=Wt;k.Help=_s;k.CommanderError=Bs;k.InvalidArgumentError=Rt;k.InvalidOptionArgumentError=Rt});var rt=I((yn,Kt)=>{"use strict";var et="\x1B",F=`${et}[`,xs="\x07",tt={to(s,e){return e?`${F}${e+1};${s+1}H`:`${F}${s+1}G`},move(s,e){let t="";return s<0?t+=`${F}${-s}D`:s>0&&(t+=`${F}${s}C`),e<0?t+=`${F}${-e}A`:e>0&&(t+=`${F}${e}B`),t},up:(s=1)=>`${F}${s}A`,down:(s=1)=>`${F}${s}B`,forward:(s=1)=>`${F}${s}C`,backward:(s=1)=>`${F}${s}D`,nextLine:(s=1)=>`${F}E`.repeat(s),prevLine:(s=1)=>`${F}F`.repeat(s),left:`${F}G`,hide:`${F}?25l`,show:`${F}?25h`,save:`${et}7`,restore:`${et}8`},Os={up:(s=1)=>`${F}S`.repeat(s),down:(s=1)=>`${F}T`.repeat(s)},ks={screen:`${F}2J`,up:(s=1)=>`${F}1J`.repeat(s),down:(s=1)=>`${F}J`.repeat(s),line:`${F}2K`,lineEnd:`${F}K`,lineStart:`${F}1K`,lines(s){let e="";for(let t=0;t<s;t++)e+=this.line+(t<s-1?tt.up():"");return s&&(e+=tt.left),e}};Kt.exports={cursor:tt,scroll:Os,erase:ks,beep:xs}});var me=I((bn,st)=>{var de=process||{},zt=de.argv||[],pe=de.env||{},Ss=!(pe.NO_COLOR||zt.includes("--no-color"))&&(!!pe.FORCE_COLOR||zt.includes("--color")||de.platform==="win32"||(de.stdout||{}).isTTY&&pe.TERM!=="dumb"||!!pe.CI),Ts=(s,e,t=s)=>i=>{let n=""+i,u=n.indexOf(e,s.length);return~u?s+Ps(n,e,t,u)+e:s+n+e},Ps=(s,e,t,i)=>{let n="",u=0;do n+=s.substring(u,i)+t,u=i+e.length,i=s.indexOf(e,u);while(~i);return n+s.substring(u)},Yt=(s=Ss)=>{let e=s?Ts:()=>String;return{isColorSupported:s,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};st.exports=Yt();st.exports.createColors=Yt});var $r=I((Pn,vr)=>{"use strict";var ft=Object.defineProperty,Fi=Object.getOwnPropertyDescriptor,Ei=Object.getOwnPropertyNames,yi=Object.prototype.hasOwnProperty,bi=(s,e)=>{for(var t in e)ft(s,t,{get:e[t],enumerable:!0})},vi=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Ei(e))!yi.call(s,n)&&n!==t&&ft(s,n,{get:()=>e[n],enumerable:!(i=Fi(e,n))||i.enumerable});return s},$i=s=>vi(ft({},"__esModule",{value:!0}),s),br={};bi(br,{default:()=>Bi});vr.exports=$i(br);var wi=class{baseUrl;defaultHeaders;constructor(s,e={}){this.baseUrl=s,this.defaultHeaders=e}buildUrl(s){return`${this.baseUrl.replace(/\/$/,"")}/${s.replace(/^\//,"")}`}async request(s,e,t,i={}){let n=this.buildUrl(e),u=await fetch(n,{method:s,headers:{"Content-Type":"application/json",...this.defaultHeaders,...i},body:t?JSON.stringify(t):void 0});if(!u.ok){let o=await u.text().catch(()=>"");throw new Error(`HTTP ${u.status} ${u.statusText}: ${o||"Request failed"}`)}let r=await u.text();try{return JSON.parse(r)}catch{return r}}get(s,e){return this.request("GET",s,void 0,e)}post(s,e,t){return this.request("POST",s,e,t)}put(s,e,t){return this.request("PUT",s,e,t)}delete(s,e){return this.request("DELETE",s,void 0,e)}},Ai=class{api;apiToken;constructor(s){this.apiToken=s?.apiToken,this.api=new wi("https://api.derived.dev/api",{...this.apiToken?{Authorization:this.apiToken}:{}})}fetchBlock=async s=>this.api.get(`/public/v1/template-group/code/${s}`);getBlockInputFromUserQuery=(s,e)=>this.api.post("/public/v1/template-group/get-block-input-from-user-query",{blockInput:s,query:e});resolveMultipleTemplates=(s,e)=>this.api.post("/public/v1/template-group/resolve-multiple-templates-by-block-code",{blockCode:s,data:e});searchBlocksByName=s=>this.api.get(`/public/v1/template-group/semantic-search?q=${s}&limit=5&threshold=0.5`);fetchProjectBySlug=async s=>this.api.get(`/public/v1/project/detail-by-slug/${s}`);createMultipleTemplates=async s=>this.api.post("/v1/template/create-multiple",s);createTemplateGroup=async s=>this.api.post("/v1/template-group/create",s);getProjectCategories=async(s,e=20,t=1)=>{let i=encodeURIComponent(JSON.stringify({projectID:s})),n=encodeURIComponent(JSON.stringify({Desc:"id"}));return this.api.get(`/v1/block-category/list?filters=${i}&sort=${n}&limit=${e}&page=${t}`)};createCategory=async s=>this.api.post("/v1/block-category/create",s);updateTemplateGroup=async(s,e)=>this.api.put(`/v1/template-group/update/${s}`,e)},Bi=Ai});var zr={};St(zr,{isDirectoryEmpty:()=>Ki,removeGitDirectory:()=>zi});function Ki(s){return(0,Q.existsSync)(s)?(0,Q.readdirSync)(s).filter(i=>!i.startsWith(".")).length===0:!0}function zi(s){let e=(0,Kr.join)(s,".git");(0,Q.existsSync)(e)&&(0,Q.rmSync)(e,{recursive:!0,force:!0})}var Q,Kr,Yr=hs(()=>{"use strict";Q=require("fs"),Kr=require("path")});var en={};St(en,{displayFileTree:()=>rs});module.exports=ps(en);var Ut=C(Lt(),1),{program:Dn,createCommand:cn,createArgument:hn,createOption:pn,CommanderError:dn,InvalidArgumentError:mn,InvalidOptionArgumentError:fn,Command:Jt,Argument:gn,Option:Cn,Help:Fn}=Ut.default;var be=require("node:util");var v=C(rt(),1),re=require("node:process"),H=C(require("node:readline"),1),ut=C(require("node:readline"),1),nr=require("node:stream"),ur=C(me(),1);function Is({onlyFirst:s=!1}={}){let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(e,s?void 0:"g")}var js=Is();function or(s){if(typeof s!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof s}\``);return s.replace(js,"")}function ar(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var lr={exports:{}};(function(s){var e={};s.exports=e,e.eastAsianWidth=function(i){var n=i.charCodeAt(0),u=i.length==2?i.charCodeAt(1):0,r=n;return 55296<=n&&n<=56319&&56320<=u&&u<=57343&&(n&=1023,u&=1023,r=n<<10|u,r+=65536),r==12288||65281<=r&&r<=65376||65504<=r&&r<=65510?"F":r==8361||65377<=r&&r<=65470||65474<=r&&r<=65479||65482<=r&&r<=65487||65490<=r&&r<=65495||65498<=r&&r<=65500||65512<=r&&r<=65518?"H":4352<=r&&r<=4447||4515<=r&&r<=4519||4602<=r&&r<=4607||9001<=r&&r<=9002||11904<=r&&r<=11929||11931<=r&&r<=12019||12032<=r&&r<=12245||12272<=r&&r<=12283||12289<=r&&r<=12350||12353<=r&&r<=12438||12441<=r&&r<=12543||12549<=r&&r<=12589||12593<=r&&r<=12686||12688<=r&&r<=12730||12736<=r&&r<=12771||12784<=r&&r<=12830||12832<=r&&r<=12871||12880<=r&&r<=13054||13056<=r&&r<=19903||19968<=r&&r<=42124||42128<=r&&r<=42182||43360<=r&&r<=43388||44032<=r&&r<=55203||55216<=r&&r<=55238||55243<=r&&r<=55291||63744<=r&&r<=64255||65040<=r&&r<=65049||65072<=r&&r<=65106||65108<=r&&r<=65126||65128<=r&&r<=65131||110592<=r&&r<=110593||127488<=r&&r<=127490||127504<=r&&r<=127546||127552<=r&&r<=127560||127568<=r&&r<=127569||131072<=r&&r<=194367||177984<=r&&r<=196605||196608<=r&&r<=262141?"W":32<=r&&r<=126||162<=r&&r<=163||165<=r&&r<=166||r==172||r==175||10214<=r&&r<=10221||10629<=r&&r<=10630?"Na":r==161||r==164||167<=r&&r<=168||r==170||173<=r&&r<=174||176<=r&&r<=180||182<=r&&r<=186||188<=r&&r<=191||r==198||r==208||215<=r&&r<=216||222<=r&&r<=225||r==230||232<=r&&r<=234||236<=r&&r<=237||r==240||242<=r&&r<=243||247<=r&&r<=250||r==252||r==254||r==257||r==273||r==275||r==283||294<=r&&r<=295||r==299||305<=r&&r<=307||r==312||319<=r&&r<=322||r==324||328<=r&&r<=331||r==333||338<=r&&r<=339||358<=r&&r<=359||r==363||r==462||r==464||r==466||r==468||r==470||r==472||r==474||r==476||r==593||r==609||r==708||r==711||713<=r&&r<=715||r==717||r==720||728<=r&&r<=731||r==733||r==735||768<=r&&r<=879||913<=r&&r<=929||931<=r&&r<=937||945<=r&&r<=961||963<=r&&r<=969||r==1025||1040<=r&&r<=1103||r==1105||r==8208||8211<=r&&r<=8214||8216<=r&&r<=8217||8220<=r&&r<=8221||8224<=r&&r<=8226||8228<=r&&r<=8231||r==8240||8242<=r&&r<=8243||r==8245||r==8251||r==8254||r==8308||r==8319||8321<=r&&r<=8324||r==8364||r==8451||r==8453||r==8457||r==8467||r==8470||8481<=r&&r<=8482||r==8486||r==8491||8531<=r&&r<=8532||8539<=r&&r<=8542||8544<=r&&r<=8555||8560<=r&&r<=8569||r==8585||8592<=r&&r<=8601||8632<=r&&r<=8633||r==8658||r==8660||r==8679||r==8704||8706<=r&&r<=8707||8711<=r&&r<=8712||r==8715||r==8719||r==8721||r==8725||r==8730||8733<=r&&r<=8736||r==8739||r==8741||8743<=r&&r<=8748||r==8750||8756<=r&&r<=8759||8764<=r&&r<=8765||r==8776||r==8780||r==8786||8800<=r&&r<=8801||8804<=r&&r<=8807||8810<=r&&r<=8811||8814<=r&&r<=8815||8834<=r&&r<=8835||8838<=r&&r<=8839||r==8853||r==8857||r==8869||r==8895||r==8978||9312<=r&&r<=9449||9451<=r&&r<=9547||9552<=r&&r<=9587||9600<=r&&r<=9615||9618<=r&&r<=9621||9632<=r&&r<=9633||9635<=r&&r<=9641||9650<=r&&r<=9651||9654<=r&&r<=9655||9660<=r&&r<=9661||9664<=r&&r<=9665||9670<=r&&r<=9672||r==9675||9678<=r&&r<=9681||9698<=r&&r<=9701||r==9711||9733<=r&&r<=9734||r==9737||9742<=r&&r<=9743||9748<=r&&r<=9749||r==9756||r==9758||r==9792||r==9794||9824<=r&&r<=9825||9827<=r&&r<=9829||9831<=r&&r<=9834||9836<=r&&r<=9837||r==9839||9886<=r&&r<=9887||9918<=r&&r<=9919||9924<=r&&r<=9933||9935<=r&&r<=9953||r==9955||9960<=r&&r<=9983||r==10045||r==10071||10102<=r&&r<=10111||11093<=r&&r<=11097||12872<=r&&r<=12879||57344<=r&&r<=63743||65024<=r&&r<=65039||r==65533||127232<=r&&r<=127242||127248<=r&&r<=127277||127280<=r&&r<=127337||127344<=r&&r<=127386||917760<=r&&r<=917999||983040<=r&&r<=1048573||1048576<=r&&r<=1114109?"A":"N"},e.characterLength=function(i){var n=this.eastAsianWidth(i);return n=="F"||n=="W"||n=="A"?2:1};function t(i){return i.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(i){for(var n=t(i),u=0,r=0;r<n.length;r++)u=u+this.characterLength(n[r]);return u},e.slice=function(i,n,u){textLen=e.length(i),n=n||0,u=u||1,n<0&&(n=textLen+n),u<0&&(u=textLen+u);for(var r="",o=0,a=t(i),c=0;c<a.length;c++){var l=a[c],D=e.length(l);if(o>=n-(D==2?1:0))if(o+D<=u)r+=l;else break;o+=D}return r}})(lr);var Ns=lr.exports,Ms=ar(Ns),Vs=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},Hs=ar(Vs);function ue(s,e={}){if(typeof s!="string"||s.length===0||(e={ambiguousIsNarrow:!0,...e},s=or(s),s.length===0))return 0;s=s.replace(Hs()," ");let t=e.ambiguousIsNarrow?1:2,i=0;for(let n of s){let u=n.codePointAt(0);if(!(u<=31||u>=127&&u<=159||u>=768&&u<=879))switch(Ms.eastAsianWidth(n)){case"F":case"W":i+=2;break;case"A":i+=t;break;default:i+=1}}return i}var it=10,Qt=(s=0)=>e=>`\x1B[${e+s}m`,Zt=(s=0)=>e=>`\x1B[${38+s};5;${e}m`,Xt=(s=0)=>(e,t,i)=>`\x1B[${38+s};2;${e};${t};${i}m`,g={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(g.modifier);var Gs=Object.keys(g.color),Ws=Object.keys(g.bgColor);[...Gs,...Ws];function Rs(){let s=new Map;for(let[e,t]of Object.entries(g)){for(let[i,n]of Object.entries(t))g[i]={open:`\x1B[${n[0]}m`,close:`\x1B[${n[1]}m`},t[i]=g[i],s.set(n[0],n[1]);Object.defineProperty(g,e,{value:t,enumerable:!1})}return Object.defineProperty(g,"codes",{value:s,enumerable:!1}),g.color.close="\x1B[39m",g.bgColor.close="\x1B[49m",g.color.ansi=Qt(),g.color.ansi256=Zt(),g.color.ansi16m=Xt(),g.bgColor.ansi=Qt(it),g.bgColor.ansi256=Zt(it),g.bgColor.ansi16m=Xt(it),Object.defineProperties(g,{rgbToAnsi256:{value:(e,t,i)=>e===t&&t===i?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(i/255*5),enumerable:!1},hexToRgb:{value:e=>{let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[i]=t;i.length===3&&(i=[...i].map(u=>u+u).join(""));let n=Number.parseInt(i,16);return[n>>16&255,n>>8&255,n&255]},enumerable:!1},hexToAnsi256:{value:e=>g.rgbToAnsi256(...g.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,i,n;if(e>=232)t=((e-232)*10+8)/255,i=t,n=t;else{e-=16;let o=e%36;t=Math.floor(e/36)/5,i=Math.floor(o/6)/5,n=o%6/5}let u=Math.max(t,i,n)*2;if(u===0)return 30;let r=30+(Math.round(n)<<2|Math.round(i)<<1|Math.round(t));return u===2&&(r+=60),r},enumerable:!1},rgbToAnsi:{value:(e,t,i)=>g.ansi256ToAnsi(g.rgbToAnsi256(e,t,i)),enumerable:!1},hexToAnsi:{value:e=>g.ansi256ToAnsi(g.hexToAnsi256(e)),enumerable:!1}}),g}var qs=Rs(),ye=new Set(["\x1B","\x9B"]),Ls=39,at="\x07",Dr="[",Us="]",cr="m",lt=`${Us}8;;`,er=s=>`${ye.values().next().value}${Dr}${s}${cr}`,tr=s=>`${ye.values().next().value}${lt}${s}${at}`,Js=s=>s.split(" ").map(e=>ue(e)),nt=(s,e,t)=>{let i=[...e],n=!1,u=!1,r=ue(or(s[s.length-1]));for(let[o,a]of i.entries()){let c=ue(a);if(r+c<=t?s[s.length-1]+=a:(s.push(a),r=0),ye.has(a)&&(n=!0,u=i.slice(o+1).join("").startsWith(lt)),n){u?a===at&&(n=!1,u=!1):a===cr&&(n=!1);continue}r+=c,r===t&&o<i.length-1&&(s.push(""),r=0)}!r&&s[s.length-1].length>0&&s.length>1&&(s[s.length-2]+=s.pop())},Ks=s=>{let e=s.split(" "),t=e.length;for(;t>0&&!(ue(e[t-1])>0);)t--;return t===e.length?s:e.slice(0,t).join(" ")+e.slice(t).join("")},zs=(s,e,t={})=>{if(t.trim!==!1&&s.trim()==="")return"";let i="",n,u,r=Js(s),o=[""];for(let[c,l]of s.split(" ").entries()){t.trim!==!1&&(o[o.length-1]=o[o.length-1].trimStart());let D=ue(o[o.length-1]);if(c!==0&&(D>=e&&(t.wordWrap===!1||t.trim===!1)&&(o.push(""),D=0),(D>0||t.trim===!1)&&(o[o.length-1]+=" ",D++)),t.hard&&r[c]>e){let p=e-D,E=1+Math.floor((r[c]-p-1)/e);Math.floor((r[c]-1)/e)<E&&o.push(""),nt(o,l,e);continue}if(D+r[c]>e&&D>0&&r[c]>0){if(t.wordWrap===!1&&D<e){nt(o,l,e);continue}o.push("")}if(D+r[c]>e&&t.wordWrap===!1){nt(o,l,e);continue}o[o.length-1]+=l}t.trim!==!1&&(o=o.map(c=>Ks(c)));let a=[...o.join(`
28
+ `)];for(let[c,l]of a.entries()){if(i+=l,ye.has(l)){let{groups:p}=new RegExp(`(?:\\${Dr}(?<code>\\d+)m|\\${lt}(?<uri>.*)${at})`).exec(a.slice(c).join(""))||{groups:{}};if(p.code!==void 0){let E=Number.parseFloat(p.code);n=E===Ls?void 0:E}else p.uri!==void 0&&(u=p.uri.length===0?void 0:p.uri)}let D=qs.codes.get(Number(n));a[c+1]===`
29
+ `?(u&&(i+=tr("")),n&&D&&(i+=er(D))):l===`
30
+ `&&(n&&D&&(i+=er(n)),u&&(i+=tr(u)))}return i};function rr(s,e,t){return String(s).normalize().replace(/\r\n/g,`
31
31
  `).split(`
32
- `).map(n=>qs(n,e,t)).join(`
33
- `)}var Ls=["up","down","left","right","space","enter","cancel"],ge={actions:new Set(Ls),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};function at(s,e){if(typeof s=="string")return ge.aliases.get(s)===e;for(let t of s)if(t!==void 0&&at(t,e))return!0;return!1}function Us(s,e){if(s===e)return;let t=s.split(`
34
- `),n=e.split(`
35
- `),i=[];for(let u=0;u<Math.max(t.length,n.length);u++)t[u]!==n[u]&&i.push(u);return i}var Js=globalThis.process.platform.startsWith("win"),it=Symbol("clack:cancel");function q(s){return s===it}function fe(s,e){let t=s;t.isTTY&&t.setRawMode(e)}function lr({input:s=ee.stdin,output:e=ee.stdout,overwrite:t=!0,hideCursor:n=!0}={}){let i=H.createInterface({input:s,output:e,prompt:"",tabSize:1});H.emitKeypressEvents(s,i),s.isTTY&&s.setRawMode(!0);let u=(r,{name:o,sequence:a})=>{let c=String(r);if(at([c,o,a],"cancel")){n&&e.write(w.cursor.show),process.exit(0);return}if(!t)return;H.moveCursor(e,o==="return"?0:-1,o==="return"?-1:0,()=>{H.clearLine(e,1,()=>{s.once("keypress",u)})})};return n&&e.write(w.cursor.hide),s.once("keypress",u),()=>{s.off("keypress",u),n&&e.write(w.cursor.show),s.isTTY&&!Js&&s.setRawMode(!1),i.terminal=!1,i.close()}}var Ks=Object.defineProperty,zs=(s,e,t)=>e in s?Ks(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,x=(s,e,t)=>(zs(s,typeof e!="symbol"?e+"":e,t),t),ue=class{constructor(e,t=!0){x(this,"input"),x(this,"output"),x(this,"_abortSignal"),x(this,"rl"),x(this,"opts"),x(this,"_render"),x(this,"_track",!1),x(this,"_prevFrame",""),x(this,"_subscribers",new Map),x(this,"_cursor",0),x(this,"state","initial"),x(this,"error",""),x(this,"value");let{input:n=ee.stdin,output:i=ee.stdout,render:u,signal:r,...o}=e;this.opts=o,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=u.bind(this),this._track=t,this._abortSignal=r,this.input=n,this.output=i}unsubscribe(){this._subscribers.clear()}setSubscriber(e,t){let n=this._subscribers.get(e)??[];n.push(t),this._subscribers.set(e,n)}on(e,t){this.setSubscriber(e,{cb:t})}once(e,t){this.setSubscriber(e,{cb:t,once:!0})}emit(e,...t){let n=this._subscribers.get(e)??[],i=[];for(let u of n)u.cb(...t),u.once&&i.push(()=>n.splice(n.indexOf(u),1));for(let u of i)u()}prompt(){return new Promise((e,t)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(it);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let n=new rr.Writable;n._write=(i,u,r)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),r()},this.input.pipe(n),this.rl=nt.default.createInterface({input:this.input,output:n,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),nt.default.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),fe(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(w.cursor.show),this.output.off("resize",this.render),fe(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(w.cursor.show),this.output.off("resize",this.render),fe(this.input,!1),e(it)})})}onKeypress(e,t){if(this.state==="error"&&(this.state="active"),t?.name&&(!this._track&&ge.aliases.has(t.name)&&this.emit("cursor",ge.aliases.get(t.name)),ge.actions.has(t.name)&&this.emit("cursor",t.name)),e&&(e.toLowerCase()==="y"||e.toLowerCase()==="n")&&this.emit("confirm",e.toLowerCase()==="y"),e===" "&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),e&&this.emit("key",e.toLowerCase()),t?.name==="return"){if(this.opts.validate){let n=this.opts.validate(this.value);n&&(this.error=n instanceof Error?n.message:n,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}at([e,t?.name,t?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
36
- `),fe(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=Xt(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
37
- `).length-1;this.output.write(w.cursor.move(-999,e*-1))}render(){let e=Xt(this._render(this)??"",process.stdout.columns,{hard:!0});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(w.cursor.hide);else{let t=Us(this._prevFrame,e);if(this.restoreCursor(),t&&t?.length===1){let n=t[0];this.output.write(w.cursor.move(0,n)),this.output.write(w.erase.lines(1));let i=e.split(`
38
- `);this.output.write(i[n]),this._prevFrame=e,this.output.write(w.cursor.move(0,i.length-n-1));return}if(t&&t?.length>1){let n=t[0];this.output.write(w.cursor.move(0,n)),this.output.write(w.erase.down());let i=e.split(`
39
- `).slice(n);this.output.write(i.join(`
40
- `)),this._prevFrame=e;return}this.output.write(w.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}};var Ys;Ys=new WeakMap;var Qs=Object.defineProperty,Zs=(s,e,t)=>e in s?Qs(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,er=(s,e,t)=>(Zs(s,typeof e!="symbol"?e+"":e,t),t),Dr=class extends ue{constructor(s){super(s,!1),er(this,"options"),er(this,"cursor",0),this.options=s.options,this.value=[...s.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:e})=>e===s.cursorAt),0),this.on("key",e=>{e==="a"&&this.toggleAll()}),this.on("cursor",e=>{switch(e){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){let s=this.value.length===this.options.length;this.value=s?[]:this.options.map(e=>e.value)}toggleValue(){let s=this.value.includes(this._value);this.value=s?this.value.filter(e=>e!==this._value):[...this.value,this._value]}};var Xs=Object.defineProperty,en=(s,e,t)=>e in s?Xs(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,tr=(s,e,t)=>(en(s,typeof e!="symbol"?e+"":e,t),t),Ce=class extends ue{constructor(e){super(e,!1),tr(this,"options"),tr(this,"cursor",0),this.options=e.options,this.cursor=this.options.findIndex(({value:t})=>t===e.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",t=>{switch(t){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}};var Fe=class extends ue{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}\u2588`;let e=this.value.slice(0,this.cursor),[t,...n]=this.value.slice(this.cursor);return`${e}${sr.default.inverse(t)}${n.join("")}`}get cursor(){return this._cursor}constructor(e){super(e),this.on("finalize",()=>{this.value||(this.value=e.defaultValue)})}};var S=b(require("node:process"),1),h=b(me(),1),be=b(et(),1);function tn(){return S.default.platform!=="win32"?S.default.env.TERM!=="linux":!!S.default.env.CI||!!S.default.env.WT_SESSION||!!S.default.env.TERMINUS_SUBLIME||S.default.env.ConEmuTask==="{cmd::Cmder}"||S.default.env.TERM_PROGRAM==="Terminus-Sublime"||S.default.env.TERM_PROGRAM==="vscode"||S.default.env.TERM==="xterm-256color"||S.default.env.TERM==="alacritty"||S.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var lt=tn(),E=(s,e)=>lt?s:e,rn=E("\u25C6","*"),pr=E("\u25A0","x"),dr=E("\u25B2","x"),$e=E("\u25C7","o"),sn=E("\u250C","T"),f=E("\u2502","|"),L=E("\u2514","\u2014"),nn=E("\u25CF",">"),un=E("\u25CB"," "),on=E("\u25FB","[\u2022]"),cr=E("\u25FC","[+]"),an=E("\u25FB","[ ]"),_i=E("\u25AA","\u2022"),hr=E("\u2500","-"),ln=E("\u256E","+"),Dn=E("\u251C","+"),cn=E("\u256F","+"),hn=E("\u25CF","\u2022"),pn=E("\u25C6","*"),dn=E("\u25B2","!"),mn=E("\u25A0","x"),ct=s=>{switch(s){case"initial":case"active":return h.default.cyan(rn);case"cancel":return h.default.red(pr);case"error":return h.default.yellow(dr);case"submit":return h.default.green($e)}},Dt=s=>{let{cursor:e,options:t,style:n}=s,i=s.maxItems??Number.POSITIVE_INFINITY,u=Math.max(process.stdout.rows-4,0),r=Math.min(u,Math.max(i,5)),o=0;e>=o+r-3?o=Math.max(Math.min(e-r+3,t.length-r),0):e<o+2&&(o=Math.max(e-2,0));let a=r<t.length&&o>0,c=r<t.length&&o+r<t.length;return t.slice(o,o+r).map((l,D,p)=>{let C=D===0&&a,$=D===p.length-1&&c;return C||$?h.default.dim("..."):n(l,D+o===e)})},mr=s=>new Fe({validate:s.validate,placeholder:s.placeholder,defaultValue:s.defaultValue,initialValue:s.initialValue,render(){let e=`${h.default.gray(f)}
41
- ${ct(this.state)} ${s.message}
42
- `,t=s.placeholder?h.default.inverse(s.placeholder[0])+h.default.dim(s.placeholder.slice(1)):h.default.inverse(h.default.hidden("_")),n=this.value?this.valueWithCursor:t;switch(this.state){case"error":return`${e.trim()}
43
- ${h.default.yellow(f)} ${n}
44
- ${h.default.yellow(L)} ${h.default.yellow(this.error)}
45
- `;case"submit":return`${e}${h.default.gray(f)} ${h.default.dim(this.value||s.placeholder)}`;case"cancel":return`${e}${h.default.gray(f)} ${h.default.strikethrough(h.default.dim(this.value??""))}${this.value?.trim()?`
46
- ${h.default.gray(f)}`:""}`;default:return`${e}${h.default.cyan(f)} ${n}
47
- ${h.default.cyan(L)}
48
- `}}}).prompt();var ve=s=>{let e=(t,n)=>{let i=t.label??String(t.value);switch(n){case"selected":return`${h.default.dim(i)}`;case"active":return`${h.default.green(nn)} ${i} ${t.hint?h.default.dim(`(${t.hint})`):""}`;case"cancelled":return`${h.default.strikethrough(h.default.dim(i))}`;default:return`${h.default.dim(un)} ${h.default.dim(i)}`}};return new Ce({options:s.options,initialValue:s.initialValue,render(){let t=`${h.default.gray(f)}
49
- ${ct(this.state)} ${s.message}
50
- `;switch(this.state){case"submit":return`${t}${h.default.gray(f)} ${e(this.options[this.cursor],"selected")}`;case"cancel":return`${t}${h.default.gray(f)} ${e(this.options[this.cursor],"cancelled")}
51
- ${h.default.gray(f)}`;default:return`${t}${h.default.cyan(f)} ${Dt({cursor:this.cursor,options:this.options,maxItems:s.maxItems,style:(n,i)=>e(n,i?"active":"inactive")}).join(`
52
- ${h.default.cyan(f)} `)}
53
- ${h.default.cyan(L)}
54
- `}}}).prompt()};var fr=s=>{let e=(t,n)=>{let i=t.label??String(t.value);return n==="active"?`${h.default.cyan(on)} ${i} ${t.hint?h.default.dim(`(${t.hint})`):""}`:n==="selected"?`${h.default.green(cr)} ${h.default.dim(i)} ${t.hint?h.default.dim(`(${t.hint})`):""}`:n==="cancelled"?`${h.default.strikethrough(h.default.dim(i))}`:n==="active-selected"?`${h.default.green(cr)} ${i} ${t.hint?h.default.dim(`(${t.hint})`):""}`:n==="submitted"?`${h.default.dim(i)}`:`${h.default.dim(an)} ${h.default.dim(i)}`};return new Dr({options:s.options,initialValues:s.initialValues,required:s.required??!0,cursorAt:s.cursorAt,validate(t){if(this.required&&t.length===0)return`Please select at least one option.
55
- ${h.default.reset(h.default.dim(`Press ${h.default.gray(h.default.bgWhite(h.default.inverse(" space ")))} to select, ${h.default.gray(h.default.bgWhite(h.default.inverse(" enter ")))} to submit`))}`},render(){let t=`${h.default.gray(f)}
56
- ${ct(this.state)} ${s.message}
57
- `,n=(i,u)=>{let r=this.value.includes(i.value);return u&&r?e(i,"active-selected"):r?e(i,"selected"):e(i,u?"active":"inactive")};switch(this.state){case"submit":return`${t}${h.default.gray(f)} ${this.options.filter(({value:i})=>this.value.includes(i)).map(i=>e(i,"submitted")).join(h.default.dim(", "))||h.default.dim("none")}`;case"cancel":{let i=this.options.filter(({value:u})=>this.value.includes(u)).map(u=>e(u,"cancelled")).join(h.default.dim(", "));return`${t}${h.default.gray(f)} ${i.trim()?`${i}
58
- ${h.default.gray(f)}`:""}`}case"error":{let i=this.error.split(`
59
- `).map((u,r)=>r===0?`${h.default.yellow(L)} ${h.default.yellow(u)}`:` ${u}`).join(`
60
- `);return`${t+h.default.yellow(f)} ${Dt({options:this.options,cursor:this.cursor,maxItems:s.maxItems,style:n}).join(`
61
- ${h.default.yellow(f)} `)}
62
- ${i}
63
- `}default:return`${t}${h.default.cyan(f)} ${Dt({options:this.options,cursor:this.cursor,maxItems:s.maxItems,style:n}).join(`
64
- ${h.default.cyan(f)} `)}
65
- ${h.default.cyan(L)}
66
- `}}}).prompt()};var G=(s="",e="")=>{let t=`
32
+ `).map(i=>zs(i,e,t)).join(`
33
+ `)}var Ys=["up","down","left","right","space","enter","cancel"],ge={actions:new Set(Ys),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};function Dt(s,e){if(typeof s=="string")return ge.aliases.get(s)===e;for(let t of s)if(t!==void 0&&Dt(t,e))return!0;return!1}function Qs(s,e){if(s===e)return;let t=s.split(`
34
+ `),i=e.split(`
35
+ `),n=[];for(let u=0;u<Math.max(t.length,i.length);u++)t[u]!==i[u]&&n.push(u);return n}var Zs=globalThis.process.platform.startsWith("win"),ot=Symbol("clack:cancel");function G(s){return s===ot}function fe(s,e){let t=s;t.isTTY&&t.setRawMode(e)}function hr({input:s=re.stdin,output:e=re.stdout,overwrite:t=!0,hideCursor:i=!0}={}){let n=H.createInterface({input:s,output:e,prompt:"",tabSize:1});H.emitKeypressEvents(s,n),s.isTTY&&s.setRawMode(!0);let u=(r,{name:o,sequence:a})=>{let c=String(r);if(Dt([c,o,a],"cancel")){i&&e.write(v.cursor.show),process.exit(0);return}if(!t)return;H.moveCursor(e,o==="return"?0:-1,o==="return"?-1:0,()=>{H.clearLine(e,1,()=>{s.once("keypress",u)})})};return i&&e.write(v.cursor.hide),s.once("keypress",u),()=>{s.off("keypress",u),i&&e.write(v.cursor.show),s.isTTY&&!Zs&&s.setRawMode(!1),n.terminal=!1,n.close()}}var Xs=Object.defineProperty,ei=(s,e,t)=>e in s?Xs(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,x=(s,e,t)=>(ei(s,typeof e!="symbol"?e+"":e,t),t),te=class{constructor(e,t=!0){x(this,"input"),x(this,"output"),x(this,"_abortSignal"),x(this,"rl"),x(this,"opts"),x(this,"_render"),x(this,"_track",!1),x(this,"_prevFrame",""),x(this,"_subscribers",new Map),x(this,"_cursor",0),x(this,"state","initial"),x(this,"error",""),x(this,"value");let{input:i=re.stdin,output:n=re.stdout,render:u,signal:r,...o}=e;this.opts=o,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=u.bind(this),this._track=t,this._abortSignal=r,this.input=i,this.output=n}unsubscribe(){this._subscribers.clear()}setSubscriber(e,t){let i=this._subscribers.get(e)??[];i.push(t),this._subscribers.set(e,i)}on(e,t){this.setSubscriber(e,{cb:t})}once(e,t){this.setSubscriber(e,{cb:t,once:!0})}emit(e,...t){let i=this._subscribers.get(e)??[],n=[];for(let u of i)u.cb(...t),u.once&&n.push(()=>i.splice(i.indexOf(u),1));for(let u of n)u()}prompt(){return new Promise((e,t)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(ot);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let i=new nr.Writable;i._write=(n,u,r)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),r()},this.input.pipe(i),this.rl=ut.default.createInterface({input:this.input,output:i,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),ut.default.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),fe(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(v.cursor.show),this.output.off("resize",this.render),fe(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(v.cursor.show),this.output.off("resize",this.render),fe(this.input,!1),e(ot)})})}onKeypress(e,t){if(this.state==="error"&&(this.state="active"),t?.name&&(!this._track&&ge.aliases.has(t.name)&&this.emit("cursor",ge.aliases.get(t.name)),ge.actions.has(t.name)&&this.emit("cursor",t.name)),e&&(e.toLowerCase()==="y"||e.toLowerCase()==="n")&&this.emit("confirm",e.toLowerCase()==="y"),e===" "&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),e&&this.emit("key",e.toLowerCase()),t?.name==="return"){if(this.opts.validate){let i=this.opts.validate(this.value);i&&(this.error=i instanceof Error?i.message:i,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}Dt([e,t?.name,t?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
36
+ `),fe(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=rr(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
37
+ `).length-1;this.output.write(v.cursor.move(-999,e*-1))}render(){let e=rr(this._render(this)??"",process.stdout.columns,{hard:!0});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(v.cursor.hide);else{let t=Qs(this._prevFrame,e);if(this.restoreCursor(),t&&t?.length===1){let i=t[0];this.output.write(v.cursor.move(0,i)),this.output.write(v.erase.lines(1));let n=e.split(`
38
+ `);this.output.write(n[i]),this._prevFrame=e,this.output.write(v.cursor.move(0,n.length-i-1));return}if(t&&t?.length>1){let i=t[0];this.output.write(v.cursor.move(0,i)),this.output.write(v.erase.down());let n=e.split(`
39
+ `).slice(i);this.output.write(n.join(`
40
+ `)),this._prevFrame=e;return}this.output.write(v.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}},Ce=class extends te{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(e){super(e,!1),this.value=!!e.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",t=>{this.output.write(v.cursor.move(0,-1)),this.value=t,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var ti;ti=new WeakMap;var ri=Object.defineProperty,si=(s,e,t)=>e in s?ri(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,sr=(s,e,t)=>(si(s,typeof e!="symbol"?e+"":e,t),t),pr=class extends te{constructor(s){super(s,!1),sr(this,"options"),sr(this,"cursor",0),this.options=s.options,this.value=[...s.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:e})=>e===s.cursorAt),0),this.on("key",e=>{e==="a"&&this.toggleAll()}),this.on("cursor",e=>{switch(e){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){let s=this.value.length===this.options.length;this.value=s?[]:this.options.map(e=>e.value)}toggleValue(){let s=this.value.includes(this._value);this.value=s?this.value.filter(e=>e!==this._value):[...this.value,this._value]}};var ii=Object.defineProperty,ni=(s,e,t)=>e in s?ii(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,ir=(s,e,t)=>(ni(s,typeof e!="symbol"?e+"":e,t),t),Fe=class extends te{constructor(e){super(e,!1),ir(this,"options"),ir(this,"cursor",0),this.options=e.options,this.cursor=this.options.findIndex(({value:t})=>t===e.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",t=>{switch(t){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}};var Ee=class extends te{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}\u2588`;let e=this.value.slice(0,this.cursor),[t,...i]=this.value.slice(this.cursor);return`${e}${ur.default.inverse(t)}${i.join("")}`}get cursor(){return this._cursor}constructor(e){super(e),this.on("finalize",()=>{this.value||(this.value=e.defaultValue)})}};var S=C(require("node:process"),1),h=C(me(),1),ve=C(rt(),1);function ui(){return S.default.platform!=="win32"?S.default.env.TERM!=="linux":!!S.default.env.CI||!!S.default.env.WT_SESSION||!!S.default.env.TERMINUS_SUBLIME||S.default.env.ConEmuTask==="{cmd::Cmder}"||S.default.env.TERM_PROGRAM==="Terminus-Sublime"||S.default.env.TERM_PROGRAM==="vscode"||S.default.env.TERM==="xterm-256color"||S.default.env.TERM==="alacritty"||S.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var ct=ui(),b=(s,e)=>ct?s:e,oi=b("\u25C6","*"),fr=b("\u25A0","x"),gr=b("\u25B2","x"),$e=b("\u25C7","o"),ai=b("\u250C","T"),m=b("\u2502","|"),W=b("\u2514","\u2014"),ht=b("\u25CF",">"),pt=b("\u25CB"," "),li=b("\u25FB","[\u2022]"),dr=b("\u25FC","[+]"),Di=b("\u25FB","[ ]"),On=b("\u25AA","\u2022"),mr=b("\u2500","-"),ci=b("\u256E","+"),hi=b("\u251C","+"),pi=b("\u256F","+"),di=b("\u25CF","\u2022"),mi=b("\u25C6","*"),fi=b("\u25B2","!"),gi=b("\u25A0","x"),we=s=>{switch(s){case"initial":case"active":return h.default.cyan(oi);case"cancel":return h.default.red(fr);case"error":return h.default.yellow(gr);case"submit":return h.default.green($e)}},dt=s=>{let{cursor:e,options:t,style:i}=s,n=s.maxItems??Number.POSITIVE_INFINITY,u=Math.max(process.stdout.rows-4,0),r=Math.min(u,Math.max(n,5)),o=0;e>=o+r-3?o=Math.max(Math.min(e-r+3,t.length-r),0):e<o+2&&(o=Math.max(e-2,0));let a=r<t.length&&o>0,c=r<t.length&&o+r<t.length;return t.slice(o,o+r).map((l,D,p)=>{let E=D===0&&a,$=D===p.length-1&&c;return E||$?h.default.dim("..."):i(l,D+o===e)})},Cr=s=>new Ee({validate:s.validate,placeholder:s.placeholder,defaultValue:s.defaultValue,initialValue:s.initialValue,render(){let e=`${h.default.gray(m)}
41
+ ${we(this.state)} ${s.message}
42
+ `,t=s.placeholder?h.default.inverse(s.placeholder[0])+h.default.dim(s.placeholder.slice(1)):h.default.inverse(h.default.hidden("_")),i=this.value?this.valueWithCursor:t;switch(this.state){case"error":return`${e.trim()}
43
+ ${h.default.yellow(m)} ${i}
44
+ ${h.default.yellow(W)} ${h.default.yellow(this.error)}
45
+ `;case"submit":return`${e}${h.default.gray(m)} ${h.default.dim(this.value||s.placeholder)}`;case"cancel":return`${e}${h.default.gray(m)} ${h.default.strikethrough(h.default.dim(this.value??""))}${this.value?.trim()?`
46
+ ${h.default.gray(m)}`:""}`;default:return`${e}${h.default.cyan(m)} ${i}
47
+ ${h.default.cyan(W)}
48
+ `}}}).prompt();var Fr=s=>{let e=s.active??"Yes",t=s.inactive??"No";return new Ce({active:e,inactive:t,initialValue:s.initialValue??!0,render(){let i=`${h.default.gray(m)}
49
+ ${we(this.state)} ${s.message}
50
+ `,n=this.value?e:t;switch(this.state){case"submit":return`${i}${h.default.gray(m)} ${h.default.dim(n)}`;case"cancel":return`${i}${h.default.gray(m)} ${h.default.strikethrough(h.default.dim(n))}
51
+ ${h.default.gray(m)}`;default:return`${i}${h.default.cyan(m)} ${this.value?`${h.default.green(ht)} ${e}`:`${h.default.dim(pt)} ${h.default.dim(e)}`} ${h.default.dim("/")} ${this.value?`${h.default.dim(pt)} ${h.default.dim(t)}`:`${h.default.green(ht)} ${t}`}
52
+ ${h.default.cyan(W)}
53
+ `}}}).prompt()},Ae=s=>{let e=(t,i)=>{let n=t.label??String(t.value);switch(i){case"selected":return`${h.default.dim(n)}`;case"active":return`${h.default.green(ht)} ${n} ${t.hint?h.default.dim(`(${t.hint})`):""}`;case"cancelled":return`${h.default.strikethrough(h.default.dim(n))}`;default:return`${h.default.dim(pt)} ${h.default.dim(n)}`}};return new Fe({options:s.options,initialValue:s.initialValue,render(){let t=`${h.default.gray(m)}
54
+ ${we(this.state)} ${s.message}
55
+ `;switch(this.state){case"submit":return`${t}${h.default.gray(m)} ${e(this.options[this.cursor],"selected")}`;case"cancel":return`${t}${h.default.gray(m)} ${e(this.options[this.cursor],"cancelled")}
56
+ ${h.default.gray(m)}`;default:return`${t}${h.default.cyan(m)} ${dt({cursor:this.cursor,options:this.options,maxItems:s.maxItems,style:(i,n)=>e(i,n?"active":"inactive")}).join(`
57
+ ${h.default.cyan(m)} `)}
58
+ ${h.default.cyan(W)}
59
+ `}}}).prompt()};var Er=s=>{let e=(t,i)=>{let n=t.label??String(t.value);return i==="active"?`${h.default.cyan(li)} ${n} ${t.hint?h.default.dim(`(${t.hint})`):""}`:i==="selected"?`${h.default.green(dr)} ${h.default.dim(n)} ${t.hint?h.default.dim(`(${t.hint})`):""}`:i==="cancelled"?`${h.default.strikethrough(h.default.dim(n))}`:i==="active-selected"?`${h.default.green(dr)} ${n} ${t.hint?h.default.dim(`(${t.hint})`):""}`:i==="submitted"?`${h.default.dim(n)}`:`${h.default.dim(Di)} ${h.default.dim(n)}`};return new pr({options:s.options,initialValues:s.initialValues,required:s.required??!0,cursorAt:s.cursorAt,validate(t){if(this.required&&t.length===0)return`Please select at least one option.
60
+ ${h.default.reset(h.default.dim(`Press ${h.default.gray(h.default.bgWhite(h.default.inverse(" space ")))} to select, ${h.default.gray(h.default.bgWhite(h.default.inverse(" enter ")))} to submit`))}`},render(){let t=`${h.default.gray(m)}
61
+ ${we(this.state)} ${s.message}
62
+ `,i=(n,u)=>{let r=this.value.includes(n.value);return u&&r?e(n,"active-selected"):r?e(n,"selected"):e(n,u?"active":"inactive")};switch(this.state){case"submit":return`${t}${h.default.gray(m)} ${this.options.filter(({value:n})=>this.value.includes(n)).map(n=>e(n,"submitted")).join(h.default.dim(", "))||h.default.dim("none")}`;case"cancel":{let n=this.options.filter(({value:u})=>this.value.includes(u)).map(u=>e(u,"cancelled")).join(h.default.dim(", "));return`${t}${h.default.gray(m)} ${n.trim()?`${n}
63
+ ${h.default.gray(m)}`:""}`}case"error":{let n=this.error.split(`
64
+ `).map((u,r)=>r===0?`${h.default.yellow(W)} ${h.default.yellow(u)}`:` ${u}`).join(`
65
+ `);return`${t+h.default.yellow(m)} ${dt({options:this.options,cursor:this.cursor,maxItems:s.maxItems,style:i}).join(`
66
+ ${h.default.yellow(m)} `)}
67
+ ${n}
68
+ `}default:return`${t}${h.default.cyan(m)} ${dt({options:this.options,cursor:this.cursor,maxItems:s.maxItems,style:i}).join(`
69
+ ${h.default.cyan(m)} `)}
70
+ ${h.default.cyan(W)}
71
+ `}}}).prompt()};var R=(s="",e="")=>{let t=`
67
72
  ${s}
68
73
  `.split(`
69
- `),n=(0,ye.stripVTControlCharacters)(e).length,i=Math.max(t.reduce((r,o)=>{let a=(0,ye.stripVTControlCharacters)(o);return a.length>r?a.length:r},0),n)+2,u=t.map(r=>`${h.default.gray(f)} ${h.default.dim(r)}${" ".repeat(i-(0,ye.stripVTControlCharacters)(r).length)}${h.default.gray(f)}`).join(`
70
- `);process.stdout.write(`${h.default.gray(f)}
71
- ${h.default.green($e)} ${h.default.reset(e)} ${h.default.gray(hr.repeat(Math.max(i-n-1,1))+ln)}
74
+ `),i=(0,be.stripVTControlCharacters)(e).length,n=Math.max(t.reduce((r,o)=>{let a=(0,be.stripVTControlCharacters)(o);return a.length>r?a.length:r},0),i)+2,u=t.map(r=>`${h.default.gray(m)} ${h.default.dim(r)}${" ".repeat(n-(0,be.stripVTControlCharacters)(r).length)}${h.default.gray(m)}`).join(`
75
+ `);process.stdout.write(`${h.default.gray(m)}
76
+ ${h.default.green($e)} ${h.default.reset(e)} ${h.default.gray(mr.repeat(Math.max(n-i-1,1))+ci)}
72
77
  ${u}
73
- ${h.default.gray(Dn+hr.repeat(i+2)+cn)}
74
- `)},d=(s="")=>{process.stdout.write(`${h.default.gray(L)} ${h.default.red(s)}
78
+ ${h.default.gray(hi+mr.repeat(n+2)+pi)}
79
+ `)},d=(s="")=>{process.stdout.write(`${h.default.gray(W)} ${h.default.red(s)}
75
80
 
76
- `)},oe=(s="")=>{process.stdout.write(`${h.default.gray(sn)} ${s}
77
- `)},te=(s="")=>{process.stdout.write(`${h.default.gray(f)}
78
- ${h.default.gray(L)} ${s}
81
+ `)},oe=(s="")=>{process.stdout.write(`${h.default.gray(ai)} ${s}
82
+ `)},q=(s="")=>{process.stdout.write(`${h.default.gray(m)}
83
+ ${h.default.gray(W)} ${s}
79
84
 
80
- `)},A={message:(s="",{symbol:e=h.default.gray(f)}={})=>{let t=[`${h.default.gray(f)}`];if(s){let[n,...i]=s.split(`
81
- `);t.push(`${e} ${n}`,...i.map(u=>`${h.default.gray(f)} ${u}`))}process.stdout.write(`${t.join(`
85
+ `)},A={message:(s="",{symbol:e=h.default.gray(m)}={})=>{let t=[`${h.default.gray(m)}`];if(s){let[i,...n]=s.split(`
86
+ `);t.push(`${e} ${i}`,...n.map(u=>`${h.default.gray(m)} ${u}`))}process.stdout.write(`${t.join(`
82
87
  `)}
83
- `)},info:s=>{A.message(s,{symbol:h.default.blue(hn)})},success:s=>{A.message(s,{symbol:h.default.green(pn)})},step:s=>{A.message(s,{symbol:h.default.green($e)})},warn:s=>{A.message(s,{symbol:h.default.yellow(dn)})},warning:s=>{A.warn(s)},error:s=>{A.message(s,{symbol:h.default.red(mn)})}},xi=`${h.default.gray(f)} `;var B=({indicator:s="dots"}={})=>{let e=lt?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],t=lt?80:120,n=process.env.CI==="true",i,u,r=!1,o="",a,c=performance.now(),l=v=>{let O=v>1?"Something went wrong":"Canceled";r&&_t(O,v)},D=()=>l(2),p=()=>l(1),C=()=>{process.on("uncaughtExceptionMonitor",D),process.on("unhandledRejection",D),process.on("SIGINT",p),process.on("SIGTERM",p),process.on("exit",l)},$=()=>{process.removeListener("uncaughtExceptionMonitor",D),process.removeListener("unhandledRejection",D),process.removeListener("SIGINT",p),process.removeListener("SIGTERM",p),process.removeListener("exit",l)},Q=()=>{if(a===void 0)return;n&&process.stdout.write(`
84
- `);let v=a.split(`
85
- `);process.stdout.write(be.cursor.move(-999,v.length-1)),process.stdout.write(be.erase.down(v.length))},y=v=>v.replace(/\.+$/,""),Z=v=>{let O=(performance.now()-v)/1e3,P=Math.floor(O/60),X=Math.floor(O%60);return P>0?`[${P}m ${X}s]`:`[${X}s]`},es=(v="")=>{r=!0,i=lr(),o=y(v),c=performance.now(),process.stdout.write(`${h.default.gray(f)}
86
- `);let O=0,P=0;C(),u=setInterval(()=>{if(n&&o===a)return;Q(),a=o;let X=h.default.magenta(e[O]);if(n)process.stdout.write(`${X} ${o}...`);else if(s==="timer")process.stdout.write(`${X} ${o} ${Z(c)}`);else{let ts=".".repeat(Math.floor(P)).slice(0,3);process.stdout.write(`${X} ${o}${ts}`)}O=O+1<e.length?O+1:0,P=P<e.length?P+.125:0},t)},_t=(v="",O=0)=>{r=!1,clearInterval(u),Q();let P=O===0?h.default.green($e):O===1?h.default.red(pr):h.default.red(dr);o=y(v??o),s==="timer"?process.stdout.write(`${P} ${o} ${Z(c)}
88
+ `)},info:s=>{A.message(s,{symbol:h.default.blue(di)})},success:s=>{A.message(s,{symbol:h.default.green(mi)})},step:s=>{A.message(s,{symbol:h.default.green($e)})},warn:s=>{A.message(s,{symbol:h.default.yellow(fi)})},warning:s=>{A.warn(s)},error:s=>{A.message(s,{symbol:h.default.red(gi)})}},kn=`${h.default.gray(m)} `;var B=({indicator:s="dots"}={})=>{let e=ct?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],t=ct?80:120,i=process.env.CI==="true",n,u,r=!1,o="",a,c=performance.now(),l=w=>{let O=w>1?"Something went wrong":"Canceled";r&&kt(O,w)},D=()=>l(2),p=()=>l(1),E=()=>{process.on("uncaughtExceptionMonitor",D),process.on("unhandledRejection",D),process.on("SIGINT",p),process.on("SIGTERM",p),process.on("exit",l)},$=()=>{process.removeListener("uncaughtExceptionMonitor",D),process.removeListener("unhandledRejection",D),process.removeListener("SIGINT",p),process.removeListener("SIGTERM",p),process.removeListener("exit",l)},X=()=>{if(a===void 0)return;i&&process.stdout.write(`
89
+ `);let w=a.split(`
90
+ `);process.stdout.write(ve.cursor.move(-999,w.length-1)),process.stdout.write(ve.erase.down(w.length))},J=w=>w.replace(/\.+$/,""),y=w=>{let O=(performance.now()-w)/1e3,P=Math.floor(O/60),ee=Math.floor(O%60);return P>0?`[${P}m ${ee}s]`:`[${ee}s]`},ns=(w="")=>{r=!0,n=hr(),o=J(w),c=performance.now(),process.stdout.write(`${h.default.gray(m)}
91
+ `);let O=0,P=0;E(),u=setInterval(()=>{if(i&&o===a)return;X(),a=o;let ee=h.default.magenta(e[O]);if(i)process.stdout.write(`${ee} ${o}...`);else if(s==="timer")process.stdout.write(`${ee} ${o} ${y(c)}`);else{let us=".".repeat(Math.floor(P)).slice(0,3);process.stdout.write(`${ee} ${o}${us}`)}O=O+1<e.length?O+1:0,P=P<e.length?P+.125:0},t)},kt=(w="",O=0)=>{r=!1,clearInterval(u),X();let P=O===0?h.default.green($e):O===1?h.default.red(fr):h.default.red(gr);o=J(w??o),s==="timer"?process.stdout.write(`${P} ${o} ${y(c)}
87
92
  `):process.stdout.write(`${P} ${o}
88
- `),$(),i()};return{start:es,stop:_t,message:(v="")=>{o=y(v??o)}}};var Kr=require("child_process"),T=require("fs"),zr=require("os"),At=require("path");var re=b(require("fs")),ht=b(require("path")),gr=(s,e=[],t=!1)=>{let n=[],i=[],u=[];for(let r of s){let o=ht.default.join(process.cwd(),r.resolvedPath);if(!r.isNotEnabled)try{if(re.default.mkdirSync(ht.default.dirname(o),{recursive:!0}),r.templateType==="add"){let a=re.default.existsSync(o)&&re.default.lstatSync(o).isFile(),c=t||e.includes(r.resolvedPath);if(a&&!c){u.push(`File already exists: ${o}`);continue}else{if(r.pathError||r.templateError){u.push(`Failed to create file: ${o} because of error: ${r.templateError}`);continue}re.default.writeFileSync(o,r.resolvedTemplate),n.push(o)}}else r.templateType==="modify"&&(r.modifiedFileContent?(re.default.writeFileSync(o,r.modifiedFileContent),i.push(o)):u.push(`Failed to modify file: ${o} because of error: ${r.templateError}`))}catch(a){u.push(a instanceof Error?a.message:String(a))}}return{addResults:n,modifyResults:i,errors:u}};var se=b(Er());var dt=b(me());function yr(s){let e={name:"root",type:"directory",children:[],path:""},t=s.map(n=>n.replace(/^\//,"").replace(/\\/g,"/")).sort();for(let n of t){let i=n.split("/").filter(Boolean),u=e;i.forEach((r,o)=>{let a=o===i.length-1,c=u.children?.find(l=>l.name===r);if(c)u=c;else{let l={name:r,type:a?"file":"directory",children:a?void 0:[],path:i.slice(0,o+1).join("/")};u.children||(u.children=[]),u.children.push(l),u=l}})}return e}function we(s,e="",t=!0,n=!0){if(n&&s.children)return s.children.map((a,c)=>we(a,"",c===s.children.length-1,!1)).join(`
89
- `);let i=t?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",u=s.type==="directory"?"\u{1F4C1} ":"\u{1F4C4} ",r=s.type==="directory"?dt.default.cyan(s.name+"/"):dt.default.green(s.name),o=e+i+u+r+`
90
- `;if(s.children&&s.children.length>0){let a=e+(t?" ":"\u2502 ");s.children.forEach((c,l)=>{o+=we(c,a,l===s.children.length-1,!1)})}return o}var V=require("fs"),mt=require("path"),An=".derived",Bn="blocks.json";function br(){return(0,mt.join)(process.cwd(),An)}function $r(){return(0,mt.join)(br(),Bn)}function ft(s,e){if(s===e)return!0;if(s==null||e==null)return s===e;if(typeof s!=typeof e)return!1;if(typeof s!="object")return s===e;let t=Object.keys(s),n=Object.keys(e);if(t.length!==n.length)return!1;for(let i of t)if(!n.includes(i)||!ft(s[i],e[i]))return!1;return!0}function Ae(){let s=$r();if(!(0,V.existsSync)(s))return{addedBlocks:[]};try{let e=(0,V.readFileSync)(s,"utf-8"),t=JSON.parse(e);return Array.isArray(t.addedBlocks)?t.addedBlocks.length>0&&typeof t.addedBlocks[0]=="string"?{addedBlocks:t.addedBlocks.map(n=>({code:n,input:{}}))}:t:{addedBlocks:[]}}catch{return{addedBlocks:[]}}}function _n(s){let e=br(),t=$r();(0,V.existsSync)(e)||(0,V.mkdirSync)(e,{recursive:!0}),(0,V.writeFileSync)(t,JSON.stringify(s,null,2))}function vr(s){return Ae().addedBlocks.some(t=>t.code===s)}function gt(s,e){return Ae().addedBlocks.find(i=>i.code===s&&ft(i.input,e))||null}function wr(s,e){return Ae().addedBlocks.filter(n=>n.code===s&&!ft(n.input,e))}function Ar(s,e={}){let t=Ae();gt(s,e)||(t.addedBlocks.push({code:s,input:e}),_n(t))}var J=require("child_process");function _r(s){return e=>e.length>1?[s,"run",e[0],"--",...e.slice(1)]:[s,"run",e[0]]}function xn(){return s=>["deno","run",`npm:${s[0]}`,...s.slice(1)]}var On={agent:["npm",0],run:_r("npm"),install:["npm","i",0],frozen:["npm","ci",0],global:["npm","i","-g",0],add:["npm","i",0],upgrade:["npm","update",0],"upgrade-interactive":null,execute:["npx",0],"execute-local":["npx",0],uninstall:["npm","uninstall",0],global_uninstall:["npm","uninstall","-g",0]},xr={agent:["yarn",0],run:["yarn","run",0],install:["yarn","install",0],frozen:["yarn","install","--frozen-lockfile",0],global:["yarn","global","add",0],add:["yarn","add",0],upgrade:["yarn","upgrade",0],"upgrade-interactive":["yarn","upgrade-interactive",0],execute:["npx",0],"execute-local":["yarn","exec",0],uninstall:["yarn","remove",0],global_uninstall:["yarn","global","remove",0]},kn={...xr,frozen:["yarn","install","--immutable",0],upgrade:["yarn","up",0],"upgrade-interactive":["yarn","up","-i",0],execute:["yarn","dlx",0],"execute-local":["yarn","exec",0],global:["npm","i","-g",0],global_uninstall:["npm","uninstall","-g",0]},Br={agent:["pnpm",0],run:["pnpm","run",0],install:["pnpm","i",0],frozen:["pnpm","i","--frozen-lockfile",0],global:["pnpm","add","-g",0],add:["pnpm","add",0],upgrade:["pnpm","update",0],"upgrade-interactive":["pnpm","update","-i",0],execute:["pnpm","dlx",0],"execute-local":["pnpm","exec",0],uninstall:["pnpm","remove",0],global_uninstall:["pnpm","remove","--global",0]},Sn={agent:["bun",0],run:["bun","run",0],install:["bun","install",0],frozen:["bun","install","--frozen-lockfile",0],global:["bun","add","-g",0],add:["bun","add",0],upgrade:["bun","update",0],"upgrade-interactive":["bun","update",0],execute:["bun","x",0],"execute-local":["bun","x",0],uninstall:["bun","remove",0],global_uninstall:["bun","remove","-g",0]},Tn={agent:["deno",0],run:["deno","task",0],install:["deno","install",0],frozen:["deno","install","--frozen",0],global:["deno","install","-g",0],add:["deno","add",0],upgrade:["deno","outdated","--update",0],"upgrade-interactive":["deno","outdated","--update",0],execute:xn(),"execute-local":["deno","task","--eval",0],uninstall:["deno","remove",0],global_uninstall:["deno","uninstall","-g",0]},Or={npm:On,yarn:xr,"yarn@berry":kn,pnpm:Br,"pnpm@6":{...Br,run:_r("pnpm")},bun:Sn,deno:Tn};function Ct(s,e,t){let n=Or[s][e];return kr(n,t)}function kr(s,e){if(s==null)return null;let t=typeof s=="function"?s(e):s.flatMap(n=>typeof n=="number"?e:[n]);return{command:t[0],args:t.slice(1)}}var Sr=["npm","yarn","yarn@berry","pnpm","pnpm@6","bun","deno"],Ft={"bun.lock":"bun","bun.lockb":"bun","deno.lock":"deno","pnpm-lock.yaml":"pnpm","yarn.lock":"yarn","package-lock.json":"npm","npm-shrinkwrap.json":"npm"};var xe=b(require("node:fs"),1),U=b(require("node:path"),1),Mr=b(require("node:process"),1);var Tr=Symbol.for("quansync.getIsAsync"),Be=class extends Error{constructor(e="Unexpected promise in sync context"){super(e),this.name="QuansyncError"}};function yt(s){return s&&typeof s=="object"&&typeof s.then=="function"}function Pn(s){return s&&typeof s=="object"&&typeof s[Symbol.iterator]=="function"&&"__quansync"in s}function bt(s){let e=function*(...n){return(yield Tr)?yield s.async.apply(this,n):s.sync.apply(this,n)};function t(...n){let i=e.apply(this,n);return i.then=(...u)=>s.async.apply(this,n).then(...u),i.__quansync=!0,i}return t.sync=s.sync,t.async=s.async,t}function In(s){return bt({async:()=>Promise.resolve(s),sync:()=>{if(yt(s))throw new Be;return s}})}function Et(s,e){if(s===Tr)return e;if(Pn(s))return e?Nr(s):Ir(s);if(!e&&yt(s))throw new Be;return s}var Pr=s=>s;function Ir(s,e=Pr){let t=s.next();for(;!t.done;)try{t=s.next(Et(e(t.value,!1)))}catch(n){t=s.throw(n)}return Et(t.value)}async function Nr(s,e=Pr){let t=s.next();for(;!t.done;)try{t=s.next(await Et(e(t.value,!0),!0))}catch(n){t=s.throw(n)}return t.value}function Nn(s,e){return bt({name:s.name,async(...t){return Nr(s.apply(this,t),e?.onYield)},sync(...t){return Ir(s.apply(this,t),e?.onYield)}})}function $t(s,e){return yt(s)?In(s):typeof s=="function"?Nn(s,e):bt(s)}var Vi=$t({async:()=>Promise.resolve(!0),sync:()=>!1});var _e=$t;var Vr=_e({sync:s=>{try{return xe.default.statSync(s).isFile()}catch{return!1}},async:async s=>{try{return(await xe.default.promises.stat(s)).isFile()}catch{return!1}}});function*jn(s=Mr.default.cwd()){let e=U.default.resolve(s),{root:t}=U.default.parse(e);for(;e&&e!==t;)yield e,e=U.default.dirname(e)}var jr=_e(function*(s,e){return!s||!(yield Vr(s))?null:Vn(s,e)}),Oe=_e(function*(s={}){let{cwd:e,onUnknown:t}=s;for(let n of jn(e)){for(let u of Object.keys(Ft))if(yield Vr(U.default.join(n,u))){let r=Ft[u],o=yield jr(U.default.join(n,"package.json"),t);return o||{name:r,agent:r}}let i=yield jr(U.default.join(n,"package.json"),t);if(i)return i}return null}),Mn=Oe.sync;function Vn(s,e){try{let t=JSON.parse(xe.default.readFileSync(s,"utf8")),n;if(typeof t.packageManager=="string"){let[i,u]=t.packageManager.replace(/^\^/,"").split("@"),r=u;return i==="yarn"&&Number.parseInt(u)>1?(n="yarn@berry",r="berry",{name:i,agent:n,version:r}):i==="pnpm"&&Number.parseInt(u)<7?(n="pnpm@6",{name:i,agent:n,version:r}):Sr.includes(i)?(n=i,{name:i,agent:n,version:r}):e?.(t.packageManager)??null}}catch{}return null}function vt(s){try{return process.platform==="win32"?(0,J.execSync)(`where ${s}`,{stdio:"ignore"}):(0,J.execSync)(`command -v ${s}`,{stdio:"ignore"}),!0}catch{return!1}}function Hn(s,e){if(s==="npx"||s==="pnpx"||s==="bunx")return{intent:"execute",args:e};if(s==="yarn"&&e[0]==="dlx")return{intent:"execute",args:e.slice(1)};if(["npm","pnpm","yarn","bun"].includes(s)){let n=e[0]||"",i=e.slice(1);if(!n||["install","i"].includes(n))return{intent:"install",args:i};if(n==="add")return{intent:"add",args:i};if(n==="run")return{intent:"run",args:i};if(["uninstall","remove","rm","un"].includes(n))return{intent:"uninstall",args:i};if(n==="install"&&i.length>0)return{intent:"add",args:i};if(n&&!n.startsWith("-"))return{intent:"run",args:e}}return null}async function ke(s,e={}){let t=s.trim().split(/\s+/),n=t[0]||"",i=t.slice(1),u=Hn(n,i);if(u){let o=(await Oe({cwd:process.cwd()}))?.agent||"npm",a=Ct(o,u.intent,u.args);if(a){let c=`${a.command} ${a.args.join(" ")}`;if(u.intent==="execute"){if(vt("bunx")){let l=`bunx ${u.args.join(" ")}`;return(0,J.execSync)(l,{stdio:"inherit",cwd:process.cwd(),...e})}if(vt("npx")){let l=`npx ${u.args.join(" ")}`;return(0,J.execSync)(l,{stdio:"inherit",cwd:process.cwd(),...e})}}if(vt(a.command))return(0,J.execSync)(c,{stdio:"inherit",cwd:process.cwd(),...e});throw new Error(`Command not found: ${a.command}. Please install the required package manager.`)}}return(0,J.execSync)(s,{stdio:"inherit",cwd:process.cwd(),...e})}var K=b(require("crypto")),_=b(require("fs")),ae=b(require("path")),wt=b(require("os")),Gr="ts-cli-derived",Gn="jwt-token",Se=()=>{let s=wt.homedir();return ae.join(s,`.${Gr}`,`${Gn}.enc`)},Wn=()=>{let s=Se(),e=ae.dirname(s);_.existsSync(e)||_.mkdirSync(e,{recursive:!0})},Hr=()=>{let s=ae.join(wt.homedir(),`.${Gr}`,"key");if(!_.existsSync(s)){let e=K.randomBytes(32);return _.writeFileSync(s,e),e}return _.readFileSync(s)},W=class{static async saveToken(e){Wn();let t=Hr(),n=K.randomBytes(16),i=K.createCipheriv("aes-256-gcm",t,n),u=Buffer.concat([i.update(e,"utf8"),i.final()]),r=i.getAuthTag(),o={iv:n.toString("hex"),encrypted:u.toString("hex"),authTag:r.toString("hex")};_.writeFileSync(Se(),JSON.stringify(o))}static async getToken(){try{let e=Se();if(!_.existsSync(e))return null;let t=JSON.parse(_.readFileSync(e,"utf8")),n=Hr(),i=Buffer.from(t.iv,"hex"),u=Buffer.from(t.encrypted,"hex"),r=Buffer.from(t.authTag,"hex"),o=K.createDecipheriv("aes-256-gcm",n,i);return o.setAuthTag(r),o.update(u)+o.final("utf8")}catch{return null}}static async deleteToken(){try{let e=Se();return _.existsSync(e)?(_.unlinkSync(e),!0):!1}catch{return!1}}};var N=require("fs"),R=require("path"),Rn=new Set([".git","node_modules"]);function qn(s){if((0,N.existsSync)(s))return(0,R.resolve)(s);if(s.startsWith("/")){let e=(0,R.resolve)(process.cwd(),s.replace(/^\/+/,""));if((0,N.existsSync)(e))return e}return(0,R.resolve)(process.cwd(),s)}function Wr(s){let e=(0,N.readdirSync)(s,{withFileTypes:!0}),t=[];for(let n of e){let i=(0,R.join)(s,n.name);if(n.isDirectory()){if(Rn.has(n.name))continue;t.push(...Wr(i));continue}n.isFile()&&t.push(i)}return t}function Ln(s){let e=(0,R.relative)(process.cwd(),s);return!e||e.startsWith("..")?null:`/${e.replace(/\\/g,"/")}`}function Rr(s){let e=[],t=new Set;for(let r of s){let o=qn(r);if(!(0,N.existsSync)(o)){e.push(`Path does not exist: ${r}`);continue}try{let a=(0,N.lstatSync)(o);if(a.isFile()){t.add(o);continue}if(a.isDirectory()){try{let c=Wr(o);for(let l of c)t.add(l)}catch(c){e.push(`Failed to read directory "${o}": ${c.message}`)}continue}e.push(`Unsupported path type: ${r}`)}catch(a){e.push(`Failed to inspect path "${o}": ${a.message}`)}}let n=[],i=new Set,u=Array.from(t).sort((r,o)=>r.localeCompare(o));for(let r of u){let o=Ln(r);if(!o){e.push(`Path is outside the current project: ${r}`);continue}if(!i.has(o)){i.add(o);try{let a=(0,N.readFileSync)(r,"utf-8");n.push({templatePath:o,template:a})}catch(a){e.push(`Failed to read file "${r}": ${a.message}`)}}}return{files:n,errors:e}}var j=new qt,Y=new se.default;function Pe(){return!process.stdin.isTTY||process.env.CI==="true"||process.env.TERM==="dumb"||process.env.NON_INTERACTIVE==="true"}async function Kn(s){let e=(0,At.join)((0,zr.tmpdir)(),`cli-edit-${Date.now()}.json`);(0,T.writeFileSync)(e,JSON.stringify(s,null,2));let t=process.env.VISUAL||process.env.EDITOR||"nano";return new Promise((n,i)=>{(0,Kr.spawn)(t,[e],{stdio:"inherit"}).on("exit",r=>{if(r===0)try{let o=(0,T.readFileSync)(e,"utf-8"),a=JSON.parse(o);(0,T.unlinkSync)(e),n(a)}catch{(0,T.unlinkSync)(e),i(new Error("Invalid JSON format"))}else(0,T.unlinkSync)(e),i(new Error("Editor closed without saving"))})})}async function Jr(s,e){let t=B();t.start("Modifying block input...");let n=await Y.getBlockInputFromUserQuery(JSON.stringify(s),e);return t.stop("Block input modified"),Bt(n.result,"Refined Block Input"),n.result}function Bt(s,e="Block Input"){G(JSON.stringify(s,null,2),e)}function Yr(s,e){return Y.resolveMultipleTemplates(s,e)}async function Qr(s,e){let t=await Yr(s,e),n=t.result.files.map(r=>r.resolvedPath),i=yr(n),u=we(i);G(u,`Files to be created (${t.result.files.length}):`)}async function Te(s,e,t=!1,n){let i=B();i.start("Resolving Files...");let u=await Yr(s,e),r=u.result.files.filter(l=>{let D=(0,At.join)(process.cwd(),l.resolvedPath);return(0,T.existsSync)(D)&&(0,T.lstatSync)(D).isFile()&&l.templateType==="add"}),o=[],a=t;if(r.length>0&&!t){if(i.stop(`${r.length} conflicting files detected`),Pe()){let D=`
93
+ `),$(),n()};return{start:ns,stop:kt,message:(w="")=>{o=J(w??o)}}};var Xr=require("child_process"),T=require("fs"),es=require("os"),xt=require("path");var se=C(require("fs")),mt=C(require("path")),yr=(s,e=[],t=!1)=>{let i=[],n=[],u=[];for(let r of s){let o=mt.default.join(process.cwd(),r.resolvedPath);if(!r.isNotEnabled)try{if(se.default.mkdirSync(mt.default.dirname(o),{recursive:!0}),r.templateType==="add"){let a=se.default.existsSync(o)&&se.default.lstatSync(o).isFile(),c=t||e.includes(r.resolvedPath);if(a&&!c){u.push(`File already exists: ${o}`);continue}else{if(r.pathError||r.templateError){u.push(`Failed to create file: ${o} because of error: ${r.templateError}`);continue}se.default.writeFileSync(o,r.resolvedTemplate),i.push(o)}}else r.templateType==="modify"&&(r.modifiedFileContent?(se.default.writeFileSync(o,r.modifiedFileContent),n.push(o)):u.push(`Failed to modify file: ${o} because of error: ${r.templateError}`))}catch(a){u.push(a instanceof Error?a.message:String(a))}}return{addResults:i,modifyResults:n,errors:u}};var ie=C($r());var gt=C(me());function wr(s){let e={name:"root",type:"directory",children:[],path:""},t=s.map(i=>i.replace(/^\//,"").replace(/\\/g,"/")).sort();for(let i of t){let n=i.split("/").filter(Boolean),u=e;n.forEach((r,o)=>{let a=o===n.length-1,c=u.children?.find(l=>l.name===r);if(c)u=c;else{let l={name:r,type:a?"file":"directory",children:a?void 0:[],path:n.slice(0,o+1).join("/")};u.children||(u.children=[]),u.children.push(l),u=l}})}return e}function Be(s,e="",t=!0,i=!0){if(i&&s.children)return s.children.map((a,c)=>Be(a,"",c===s.children.length-1,!1)).join(`
94
+ `);let n=t?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",u=s.type==="directory"?"\u{1F4C1} ":"\u{1F4C4} ",r=s.type==="directory"?gt.default.cyan(s.name+"/"):gt.default.green(s.name),o=e+n+u+r+`
95
+ `;if(s.children&&s.children.length>0){let a=e+(t?" ":"\u2502 ");s.children.forEach((c,l)=>{o+=Be(c,a,l===s.children.length-1,!1)})}return o}var V=require("fs"),Ct=require("path"),_i=".derived",xi="blocks.json";function Ar(){return(0,Ct.join)(process.cwd(),_i)}function Br(){return(0,Ct.join)(Ar(),xi)}function Ft(s,e){if(s===e)return!0;if(s==null||e==null)return s===e;if(typeof s!=typeof e)return!1;if(typeof s!="object")return s===e;let t=Object.keys(s),i=Object.keys(e);if(t.length!==i.length)return!1;for(let n of t)if(!i.includes(n)||!Ft(s[n],e[n]))return!1;return!0}function _e(){let s=Br();if(!(0,V.existsSync)(s))return{addedBlocks:[]};try{let e=(0,V.readFileSync)(s,"utf-8"),t=JSON.parse(e);return Array.isArray(t.addedBlocks)?t.addedBlocks.length>0&&typeof t.addedBlocks[0]=="string"?{addedBlocks:t.addedBlocks.map(i=>({code:i,input:{}}))}:t:{addedBlocks:[]}}catch{return{addedBlocks:[]}}}function Oi(s){let e=Ar(),t=Br();(0,V.existsSync)(e)||(0,V.mkdirSync)(e,{recursive:!0}),(0,V.writeFileSync)(t,JSON.stringify(s,null,2))}function _r(s){return _e().addedBlocks.some(t=>t.code===s)}function Et(s,e){return _e().addedBlocks.find(n=>n.code===s&&Ft(n.input,e))||null}function xr(s,e){return _e().addedBlocks.filter(i=>i.code===s&&!Ft(i.input,e))}function Or(s,e={}){let t=_e();Et(s,e)||(t.addedBlocks.push({code:s,input:e}),Oi(t))}var z=require("child_process");function Sr(s){return e=>e.length>1?[s,"run",e[0],"--",...e.slice(1)]:[s,"run",e[0]]}function ki(){return s=>["deno","run",`npm:${s[0]}`,...s.slice(1)]}var Si={agent:["npm",0],run:Sr("npm"),install:["npm","i",0],frozen:["npm","ci",0],global:["npm","i","-g",0],add:["npm","i",0],upgrade:["npm","update",0],"upgrade-interactive":null,execute:["npx",0],"execute-local":["npx",0],uninstall:["npm","uninstall",0],global_uninstall:["npm","uninstall","-g",0]},Tr={agent:["yarn",0],run:["yarn","run",0],install:["yarn","install",0],frozen:["yarn","install","--frozen-lockfile",0],global:["yarn","global","add",0],add:["yarn","add",0],upgrade:["yarn","upgrade",0],"upgrade-interactive":["yarn","upgrade-interactive",0],execute:["npx",0],"execute-local":["yarn","exec",0],uninstall:["yarn","remove",0],global_uninstall:["yarn","global","remove",0]},Ti={...Tr,frozen:["yarn","install","--immutable",0],upgrade:["yarn","up",0],"upgrade-interactive":["yarn","up","-i",0],execute:["yarn","dlx",0],"execute-local":["yarn","exec",0],global:["npm","i","-g",0],global_uninstall:["npm","uninstall","-g",0]},kr={agent:["pnpm",0],run:["pnpm","run",0],install:["pnpm","i",0],frozen:["pnpm","i","--frozen-lockfile",0],global:["pnpm","add","-g",0],add:["pnpm","add",0],upgrade:["pnpm","update",0],"upgrade-interactive":["pnpm","update","-i",0],execute:["pnpm","dlx",0],"execute-local":["pnpm","exec",0],uninstall:["pnpm","remove",0],global_uninstall:["pnpm","remove","--global",0]},Pi={agent:["bun",0],run:["bun","run",0],install:["bun","install",0],frozen:["bun","install","--frozen-lockfile",0],global:["bun","add","-g",0],add:["bun","add",0],upgrade:["bun","update",0],"upgrade-interactive":["bun","update",0],execute:["bun","x",0],"execute-local":["bun","x",0],uninstall:["bun","remove",0],global_uninstall:["bun","remove","-g",0]},Ii={agent:["deno",0],run:["deno","task",0],install:["deno","install",0],frozen:["deno","install","--frozen",0],global:["deno","install","-g",0],add:["deno","add",0],upgrade:["deno","outdated","--update",0],"upgrade-interactive":["deno","outdated","--update",0],execute:ki(),"execute-local":["deno","task","--eval",0],uninstall:["deno","remove",0],global_uninstall:["deno","uninstall","-g",0]},Pr={npm:Si,yarn:Tr,"yarn@berry":Ti,pnpm:kr,"pnpm@6":{...kr,run:Sr("pnpm")},bun:Pi,deno:Ii};function yt(s,e,t){let i=Pr[s][e];return Ir(i,t)}function Ir(s,e){if(s==null)return null;let t=typeof s=="function"?s(e):s.flatMap(i=>typeof i=="number"?e:[i]);return{command:t[0],args:t.slice(1)}}var jr=["npm","yarn","yarn@berry","pnpm","pnpm@6","bun","deno"],bt={"bun.lock":"bun","bun.lockb":"bun","deno.lock":"deno","pnpm-lock.yaml":"pnpm","yarn.lock":"yarn","package-lock.json":"npm","npm-shrinkwrap.json":"npm"};var ke=C(require("node:fs"),1),K=C(require("node:path"),1),Wr=C(require("node:process"),1);var Nr=Symbol.for("quansync.getIsAsync"),xe=class extends Error{constructor(e="Unexpected promise in sync context"){super(e),this.name="QuansyncError"}};function $t(s){return s&&typeof s=="object"&&typeof s.then=="function"}function ji(s){return s&&typeof s=="object"&&typeof s[Symbol.iterator]=="function"&&"__quansync"in s}function wt(s){let e=function*(...i){return(yield Nr)?yield s.async.apply(this,i):s.sync.apply(this,i)};function t(...i){let n=e.apply(this,i);return n.then=(...u)=>s.async.apply(this,i).then(...u),n.__quansync=!0,n}return t.sync=s.sync,t.async=s.async,t}function Ni(s){return wt({async:()=>Promise.resolve(s),sync:()=>{if($t(s))throw new xe;return s}})}function vt(s,e){if(s===Nr)return e;if(ji(s))return e?Hr(s):Vr(s);if(!e&&$t(s))throw new xe;return s}var Mr=s=>s;function Vr(s,e=Mr){let t=s.next();for(;!t.done;)try{t=s.next(vt(e(t.value,!1)))}catch(i){t=s.throw(i)}return vt(t.value)}async function Hr(s,e=Mr){let t=s.next();for(;!t.done;)try{t=s.next(await vt(e(t.value,!0),!0))}catch(i){t=s.throw(i)}return t.value}function Mi(s,e){return wt({name:s.name,async(...t){return Hr(s.apply(this,t),e?.onYield)},sync(...t){return Vr(s.apply(this,t),e?.onYield)}})}function At(s,e){return $t(s)?Ni(s):typeof s=="function"?Mi(s,e):wt(s)}var Gn=At({async:()=>Promise.resolve(!0),sync:()=>!1});var Oe=At;var Rr=Oe({sync:s=>{try{return ke.default.statSync(s).isFile()}catch{return!1}},async:async s=>{try{return(await ke.default.promises.stat(s)).isFile()}catch{return!1}}});function*Vi(s=Wr.default.cwd()){let e=K.default.resolve(s),{root:t}=K.default.parse(e);for(;e&&e!==t;)yield e,e=K.default.dirname(e)}var Gr=Oe(function*(s,e){return!s||!(yield Rr(s))?null:Gi(s,e)}),Se=Oe(function*(s={}){let{cwd:e,onUnknown:t}=s;for(let i of Vi(e)){for(let u of Object.keys(bt))if(yield Rr(K.default.join(i,u))){let r=bt[u],o=yield Gr(K.default.join(i,"package.json"),t);return o||{name:r,agent:r}}let n=yield Gr(K.default.join(i,"package.json"),t);if(n)return n}return null}),Hi=Se.sync;function Gi(s,e){try{let t=JSON.parse(ke.default.readFileSync(s,"utf8")),i;if(typeof t.packageManager=="string"){let[n,u]=t.packageManager.replace(/^\^/,"").split("@"),r=u;return n==="yarn"&&Number.parseInt(u)>1?(i="yarn@berry",r="berry",{name:n,agent:i,version:r}):n==="pnpm"&&Number.parseInt(u)<7?(i="pnpm@6",{name:n,agent:i,version:r}):jr.includes(n)?(i=n,{name:n,agent:i,version:r}):e?.(t.packageManager)??null}}catch{}return null}function Bt(s){try{return process.platform==="win32"?(0,z.execSync)(`where ${s}`,{stdio:"ignore"}):(0,z.execSync)(`command -v ${s}`,{stdio:"ignore"}),!0}catch{return!1}}function Wi(s,e){if(s==="npx"||s==="pnpx"||s==="bunx")return{intent:"execute",args:e};if(s==="yarn"&&e[0]==="dlx")return{intent:"execute",args:e.slice(1)};if(["npm","pnpm","yarn","bun"].includes(s)){let i=e[0]||"",n=e.slice(1);if(!i||["install","i"].includes(i))return{intent:"install",args:n};if(i==="add")return{intent:"add",args:n};if(i==="run")return{intent:"run",args:n};if(["uninstall","remove","rm","un"].includes(i))return{intent:"uninstall",args:n};if(i==="install"&&n.length>0)return{intent:"add",args:n};if(i&&!i.startsWith("-"))return{intent:"run",args:e}}return null}async function Te(s,e={}){let t=s.trim().split(/\s+/),i=t[0]||"",n=t.slice(1),u=Wi(i,n);if(u){let o=(await Se({cwd:process.cwd()}))?.agent||"npm",a=yt(o,u.intent,u.args);if(a){let c=`${a.command} ${a.args.join(" ")}`;if(u.intent==="execute"){if(Bt("bunx")){let l=`bunx ${u.args.join(" ")}`;return(0,z.execSync)(l,{stdio:"inherit",cwd:process.cwd(),...e})}if(Bt("npx")){let l=`npx ${u.args.join(" ")}`;return(0,z.execSync)(l,{stdio:"inherit",cwd:process.cwd(),...e})}}if(Bt(a.command))return(0,z.execSync)(c,{stdio:"inherit",cwd:process.cwd(),...e});throw new Error(`Command not found: ${a.command}. Please install the required package manager.`)}}return(0,z.execSync)(s,{stdio:"inherit",cwd:process.cwd(),...e})}var Y=C(require("crypto")),_=C(require("fs")),ae=C(require("path")),_t=C(require("os")),Lr="ts-cli-derived",Ri="jwt-token",Pe=()=>{let s=_t.homedir();return ae.join(s,`.${Lr}`,`${Ri}.enc`)},qi=()=>{let s=Pe(),e=ae.dirname(s);_.existsSync(e)||_.mkdirSync(e,{recursive:!0})},qr=()=>{let s=ae.join(_t.homedir(),`.${Lr}`,"key");if(!_.existsSync(s)){let e=Y.randomBytes(32);return _.writeFileSync(s,e),e}return _.readFileSync(s)},L=class{static async saveToken(e){qi();let t=qr(),i=Y.randomBytes(16),n=Y.createCipheriv("aes-256-gcm",t,i),u=Buffer.concat([n.update(e,"utf8"),n.final()]),r=n.getAuthTag(),o={iv:i.toString("hex"),encrypted:u.toString("hex"),authTag:r.toString("hex")};_.writeFileSync(Pe(),JSON.stringify(o))}static async getToken(){try{let e=Pe();if(!_.existsSync(e))return null;let t=JSON.parse(_.readFileSync(e,"utf8")),i=qr(),n=Buffer.from(t.iv,"hex"),u=Buffer.from(t.encrypted,"hex"),r=Buffer.from(t.authTag,"hex"),o=Y.createDecipheriv("aes-256-gcm",i,n);return o.setAuthTag(r),o.update(u)+o.final("utf8")}catch{return null}}static async deleteToken(){try{let e=Pe();return _.existsSync(e)?(_.unlinkSync(e),!0):!1}catch{return!1}}};var j=require("fs"),U=require("path"),Li=new Set([".git","node_modules"]);function Ui(s){if((0,j.existsSync)(s))return(0,U.resolve)(s);if(s.startsWith("/")){let e=(0,U.resolve)(process.cwd(),s.replace(/^\/+/,""));if((0,j.existsSync)(e))return e}return(0,U.resolve)(process.cwd(),s)}function Ur(s){let e=(0,j.readdirSync)(s,{withFileTypes:!0}),t=[];for(let i of e){let n=(0,U.join)(s,i.name);if(i.isDirectory()){if(Li.has(i.name))continue;t.push(...Ur(n));continue}i.isFile()&&t.push(n)}return t}function Ji(s){let e=(0,U.relative)(process.cwd(),s);return!e||e.startsWith("..")?null:`/${e.replace(/\\/g,"/")}`}function Jr(s){let e=[],t=new Set;for(let r of s){let o=Ui(r);if(!(0,j.existsSync)(o)){e.push(`Path does not exist: ${r}`);continue}try{let a=(0,j.lstatSync)(o);if(a.isFile()){t.add(o);continue}if(a.isDirectory()){try{let c=Ur(o);for(let l of c)t.add(l)}catch(c){e.push(`Failed to read directory "${o}": ${c.message}`)}continue}e.push(`Unsupported path type: ${r}`)}catch(a){e.push(`Failed to inspect path "${o}": ${a.message}`)}}let i=[],n=new Set,u=Array.from(t).sort((r,o)=>r.localeCompare(o));for(let r of u){let o=Ji(r);if(!o){e.push(`Path is outside the current project: ${r}`);continue}if(!n.has(o)){n.add(o);try{let a=(0,j.readFileSync)(r,"utf-8");i.push({templatePath:o,template:a})}catch(a){e.push(`Failed to read file "${r}": ${a.message}`)}}}return{files:i,errors:e}}var N=new Jt,Z=new ie.default;function je(){return!process.stdin.isTTY||process.env.CI==="true"||process.env.TERM==="dumb"||process.env.NON_INTERACTIVE==="true"}async function Yi(s){let e=(0,xt.join)((0,es.tmpdir)(),`cli-edit-${Date.now()}.json`);(0,T.writeFileSync)(e,JSON.stringify(s,null,2));let t=process.env.VISUAL||process.env.EDITOR||"nano";return new Promise((i,n)=>{(0,Xr.spawn)(t,[e],{stdio:"inherit"}).on("exit",r=>{if(r===0)try{let o=(0,T.readFileSync)(e,"utf-8"),a=JSON.parse(o);(0,T.unlinkSync)(e),i(a)}catch{(0,T.unlinkSync)(e),n(new Error("Invalid JSON format"))}else(0,T.unlinkSync)(e),n(new Error("Editor closed without saving"))})})}async function Qr(s,e){let t=B();t.start("Modifying block input...");let i=await Z.getBlockInputFromUserQuery(JSON.stringify(s),e);return t.stop("Block input modified"),Ot(i.result,"Refined Block Input"),i.result}function Ot(s,e="Block Input"){R(JSON.stringify(s,null,2),e)}function ts(s,e){return Z.resolveMultipleTemplates(s,e)}async function rs(s,e){let t=await ts(s,e),i=t.result.files.map(r=>r.resolvedPath),n=wr(i),u=Be(n);R(u,`Files to be created (${t.result.files.length}):`)}async function Ie(s,e,t=!1,i){let n=B();n.start("Resolving Files...");let u=await ts(s,e),r=u.result.files.filter(l=>{let D=(0,xt.join)(process.cwd(),l.resolvedPath);return(0,T.existsSync)(D)&&(0,T.lstatSync)(D).isFile()&&l.templateType==="add"}),o=[],a=t;if(r.length>0&&!t){if(n.stop(`${r.length} conflicting files detected`),je()){let D=`
91
96
  Non-Interactive Mode Error:
92
97
 
93
98
  ${r.length} file(s) already exist and require user selection.
@@ -98,7 +103,7 @@ To resolve this, please restart the command with one of these flags:
98
103
 
99
104
  Example:
100
105
  derived-cli add ${s} --overwrite
101
- `;d(D),process.exit(1)}let l=await ve({message:"Some files already exist. How would you like to proceed?",options:[{value:"overwrite-all",label:"Overwrite all"},{value:"select",label:"Select files to overwrite"},{value:"skip-all",label:"Skip all"}]});if(q(l)&&(d("Operation cancelled."),process.exit(0)),l==="overwrite-all")a=!0;else if(l==="select"){let D=await fr({message:"Select files to overwrite",options:r.map(p=>({value:p.resolvedPath,label:p.resolvedPath}))});q(D)&&(d("Operation cancelled."),process.exit(0)),o=D}i.start("Generating files...")}let c=gr(u.result.files,o,a);if(c.errors?.length&&console.log(c.errors,"errors"),i.stop(`${c.addResults.length} files added, ${c.modifyResults.length} files modified, ${c.errors.length} errors`),c.addResults.length>0||c.modifyResults.length>0){if(Ar(s,e),n?.setupCommands&&n.setupCommands.trim()){let l=n.setupCommands.split(",").map(p=>p.trim()),D=B();for(let p of l)if(p){D.start(`Running setup command: ${p}`);try{await ke(p,{stdio:"inherit",cwd:process.cwd()}),D.stop(`Completed: ${p}`)}catch(C){D.stop(`Warning: Setup command failed: ${p}`),console.warn(` ${C.message}`)}}}if(n?.aiInstruction&&n.aiInstruction.trim())return n.aiInstruction}return null}async function zn(s){let e=[],t=new Set;async function n(i){if(t.has(i))return;t.add(i);let u=await Y.fetchBlock(i);if(u?.result?.id){if(u.result.dependsOn?.length)for(let r of u.result.dependsOn)await n(r.code);i!==s&&e.push(i)}}return await n(s),e}async function Yn(s,e,t,n=!1,i=!0){i&&oe(`Add block: ${s}`);let u=!1,r=B();r.start("Fetching block...");let o=await Y.fetchBlock(s);if(o?.result?.id)r.stop(`Block Found '${o.result.name}' ${o.result.input?"with input":""}`);else return r.stop("Block Not Found"),null;let a=t||o.result.input;if(t){let c=await Te(s,t,n,o.result);return u=!0,c}if(!a&&!u){let c=await Te(s,{},n,o.result);return u=!0,c}if(a&&e&&!t){a=await Jr(a,e);let c=await Te(s,a,n,o.result);return u=!0,c}for(;!u&&a&&!e;){if(Bt(a),Pe()){let D=`This block requires input configuration, but user selection is not available.
106
+ `;d(D),process.exit(1)}let l=await Ae({message:"Some files already exist. How would you like to proceed?",options:[{value:"overwrite-all",label:"Overwrite all"},{value:"select",label:"Select files to overwrite"},{value:"skip-all",label:"Skip all"}]});if(G(l)&&(d("Operation cancelled."),process.exit(0)),l==="overwrite-all")a=!0;else if(l==="select"){let D=await Er({message:"Select files to overwrite",options:r.map(p=>({value:p.resolvedPath,label:p.resolvedPath}))});G(D)&&(d("Operation cancelled."),process.exit(0)),o=D}n.start("Generating files...")}let c=yr(u.result.files,o,a);if(c.errors?.length&&console.log(c.errors,"errors"),n.stop(`${c.addResults.length} files added, ${c.modifyResults.length} files modified, ${c.errors.length} errors`),c.addResults.length>0||c.modifyResults.length>0){if(Or(s,e),i?.setupCommands&&i.setupCommands.trim()){let l=i.setupCommands.split(",").map(p=>p.trim()),D=B();for(let p of l)if(p){D.start(`Running setup command: ${p}`);try{await Te(p,{stdio:"inherit",cwd:process.cwd()}),D.stop(`Completed: ${p}`)}catch(E){D.stop(`Warning: Setup command failed: ${p}`),console.warn(` ${E.message}`)}}}if(i?.aiInstruction&&i.aiInstruction.trim())return i.aiInstruction}return null}async function Qi(s){let e=[],t=new Set;async function i(n){if(t.has(n))return;t.add(n);let u=await Z.fetchBlock(n);if(u?.result?.id){if(u.result.dependsOn?.length)for(let r of u.result.dependsOn)await i(r.code);n!==s&&e.push(n)}}return await i(s),e}async function Zi(s,e,t,i=!1,n=!0){n&&oe(`Add block: ${s}`);let u=!1,r=B();r.start("Fetching block...");let o=await Z.fetchBlock(s);if(o?.result?.id)r.stop(`Block Found '${o.result.name}' ${o.result.input?"with input":""}`);else return r.stop("Block Not Found"),null;let a=t||o.result.input;if(t){let c=await Ie(s,t,i,o.result);return u=!0,c}if(!a&&!u){let c=await Ie(s,{},i,o.result);return u=!0,c}if(a&&e&&!t){a=await Qr(a,e);let c=await Ie(s,a,i,o.result);return u=!0,c}for(;!u&&a&&!e;){if(Ot(a),je()){let D=`This block requires input configuration, but user selection is not available.
102
107
 
103
108
  To resolve this, please restart the command with below flag:
104
109
 
@@ -110,13 +115,13 @@ To resolve this, please restart the command with below flag:
110
115
  Follow this JSON structure for block input:
111
116
 
112
117
  ${JSON.stringify(a,null,2)}
113
- `;d(D),process.exit(1)}let l=await ve({message:"What would you like to do?",options:[{value:"refine",label:"Edit (AI)"},{value:"edit",label:"Edit (Editor)"},{value:"showFiles",label:"Show files to be created"},{value:"done",label:"Insert Files"}]});if(q(l)&&(d("Operation cancelled."),process.exit(0)),l==="refine"){let D=await mr({message:"Describe what to refine:"});a=await Jr(a,D)}if(l==="edit"&&(a=await Kn(a)),l==="done"){let D=await Te(s,a,n,o.result);return u=!0,D}l==="showFiles"&&await Qr(s,a)}return null}async function Zr(s,e,t,n=!1){let r=[...await zn(s),s].filter(a=>a===s?!0:!vr(a));if(r.length===0){G(`Block "${s}" and all its dependencies are already added.`,"Nothing to do");return}if(r.length>1){let a=r.map((c,l)=>{let D=c===s;return` ${l+1}. ${c}${D?" (main)":" (dependency)"}`}).join(`
114
- `);G(`${r.length} blocks will be processed in order:
118
+ `;d(D),process.exit(1)}let l=await Ae({message:"What would you like to do?",options:[{value:"refine",label:"Edit (AI)"},{value:"edit",label:"Edit (Editor)"},{value:"showFiles",label:"Show files to be created"},{value:"done",label:"Insert Files"}]});if(G(l)&&(d("Operation cancelled."),process.exit(0)),l==="refine"){let D=await Cr({message:"Describe what to refine:"});a=await Qr(a,D)}if(l==="edit"&&(a=await Yi(a)),l==="done"){let D=await Ie(s,a,i,o.result);return u=!0,D}l==="showFiles"&&await rs(s,a)}return null}async function ss(s,e,t,i=!1){let r=[...await Qi(s),s].filter(a=>a===s?!0:!_r(a));if(r.length===0){R(`Block "${s}" and all its dependencies are already added.`,"Nothing to do");return}if(r.length>1){let a=r.map((c,l)=>{let D=c===s;return` ${l+1}. ${c}${D?" (main)":" (dependency)"}`}).join(`
119
+ `);R(`${r.length} blocks will be processed in order:
115
120
 
116
- ${a}`,"Processing Queue")}let o=[];for(let a=0;a<r.length;a++){let c=r[a];if(!c)continue;let l=c===s,D=a===r.length-1;r.length>1&&oe(`[${a+1}/${r.length}] Processing: ${c}${l?" (main)":""}`);let p=await Yn(c,l?e:void 0,l?t:null,n,r.length===1);p&&o.push({blockCode:c,instruction:p,isMain:l}),D||te(`\u2713 ${c} completed`)}if(r.length>1){let a=`\u2713 All ${r.length} blocks processed successfully`;te(a)}if(o.length>0){let a="";o.length===1?a=o[0]?.instruction||"":a=o.map((c,l)=>{let D=c.isMain?`${c.blockCode} (main)`:c.blockCode;return`${l+1}. [${D}]
121
+ ${a}`,"Processing Queue")}let o=[];for(let a=0;a<r.length;a++){let c=r[a];if(!c)continue;let l=c===s,D=a===r.length-1;r.length>1&&oe(`[${a+1}/${r.length}] Processing: ${c}${l?" (main)":""}`);let p=await Zi(c,l?e:void 0,l?t:null,i,r.length===1);p&&o.push({blockCode:c,instruction:p,isMain:l}),D||q(`\u2713 ${c} completed`)}if(r.length>1){let a=`\u2713 All ${r.length} blocks processed successfully`;q(a)}if(o.length>0){let a="";o.length===1?a=o[0]?.instruction||"":a=o.map((c,l)=>{let D=c.isMain?`${c.blockCode} (main)`:c.blockCode;return`${l+1}. [${D}]
117
122
  ${c.instruction}`}).join(`
118
123
 
119
- `),G(a,"Next Steps")}}async function Qn(s,e={}){oe(`\u{1F50D} Searching for: "${s}"`);let t=B();t.start("Finding relevant blocks...");try{let n=await Y.searchBlocksByName(s);if(t.stop("Search complete"),!n.result||n.result.length===0){te("No blocks found matching your query.");return}let i;if(e.autoSelect||Pe()){let o=n.result[0];if(!o){d("No blocks found in search results.");return}i=o.code,n.result.length>1?(A.info(`Auto-selected best match: ${o.name} (${o.code})`),A.info(`${n.result.length-1} other match(es) available but not selected.`)):A.success(`Found exact match: ${o.name} (${o.code})`)}else{let o=await ve({message:`Found ${n.result.length} block(s). Select a block to add:`,options:n.result.map((a,c)=>({value:a.code,label:`${a.name}`,hint:`Code: ${a.code} | Input: ${a.input?"Required":"Not required"}`}))});q(o)&&(d("Operation cancelled."),process.exit(0)),i=o}let u=n.result.find(o=>o.code===i);if(!u){d("Selected block not found.");return}!e.autoSelect&&!Pe()&&A.success(`Selected: ${u.name} (${u.code})`);let r=null;if(u.input&&Object.keys(u.input).length>0){let o=B();o.start("Resolving block input from your query...");try{r=(await Y.getBlockInputFromUserQuery(JSON.stringify(u.input),s)).result,o.stop("Block input resolved"),Bt(r,"Resolved Block Input")}catch(a){o.stop("Could not resolve input automatically"),A.warning(`Input resolution failed: ${a.message}`),A.info("Proceeding with default input schema \u2014 you can refine it in the next step.")}}await Zr(u.code,r?void 0:s,r||null,e.overwrite||!1)}catch(n){t.stop("Search failed"),d(`Error: ${n.message}`)}}j.command("help").description("List all commands and usage").action(()=>{console.log(`
124
+ `),R(a,"Next Steps")}}async function Xi(s,e={}){oe(`\u{1F50D} Searching for: "${s}"`);let t=B();t.start("Finding relevant blocks...");try{let i=await Z.searchBlocksByName(s);if(t.stop("Search complete"),!i.result||i.result.length===0){q("No blocks found matching your query.");return}let n;if(e.autoSelect||je()){let o=i.result[0];if(!o){d("No blocks found in search results.");return}n=o.code,i.result.length>1?(A.info(`Auto-selected best match: ${o.name} (${o.code})`),A.info(`${i.result.length-1} other match(es) available but not selected.`)):A.success(`Found exact match: ${o.name} (${o.code})`)}else{let o=await Ae({message:`Found ${i.result.length} block(s). Select a block to add:`,options:i.result.map((a,c)=>({value:a.code,label:`${a.name}`,hint:`Code: ${a.code} | Input: ${a.input?"Required":"Not required"}`}))});G(o)&&(d("Operation cancelled."),process.exit(0)),n=o}let u=i.result.find(o=>o.code===n);if(!u){d("Selected block not found.");return}!e.autoSelect&&!je()&&A.success(`Selected: ${u.name} (${u.code})`);let r=null;if(u.input&&Object.keys(u.input).length>0){let o=B();o.start("Resolving block input from your query...");try{r=(await Z.getBlockInputFromUserQuery(JSON.stringify(u.input),s)).result,o.stop("Block input resolved"),Ot(r,"Resolved Block Input")}catch(a){o.stop("Could not resolve input automatically"),A.warning(`Input resolution failed: ${a.message}`),A.info("Proceeding with default input schema \u2014 you can refine it in the next step.")}}await ss(u.code,r?void 0:s,r||null,e.overwrite||!1)}catch(i){t.stop("Search failed"),d(`Error: ${i.message}`)}}N.command("help").description("List all commands and usage").action(()=>{console.log(`
120
125
  Available commands:
121
126
 
122
127
  search <query>
@@ -150,8 +155,8 @@ Available commands:
150
155
 
151
156
  help
152
157
  Show this help text.
153
- `)});var Xr=s=>{let e=B();try{e.start("Decoding base64...");let t=Buffer.from(s,"base64").toString("utf8"),n=JSON.parse(t);for(;typeof n!="object";)n=JSON.parse(n);return e.stop("Decoded input successfully"),n}catch{return e.stop("Failed to decode input"),null}};j.command("add <blockCode>").description("Generate and refine a JSON block interactively").option("-q, --query <value>","Optional user input").option("-i, --block-input <value>","Optional block input json schema in base 64").option("-o, --overwrite","Automatically overwrite existing files").option("-f, --force","Force insert even if block already exists").action(async(s,e)=>{let t=e.blockInput?Xr(e.blockInput):null;if(gt(s,t||{})&&!e.force){G(`Block "${s}" with the same input configuration is already added to this project.
158
+ `)});var is=s=>{let e=B();try{e.start("Decoding base64...");let t=Buffer.from(s,"base64").toString("utf8"),i=JSON.parse(t);for(;typeof i!="object";)i=JSON.parse(i);return e.stop("Decoded input successfully"),i}catch{return e.stop("Failed to decode input"),null}};N.command("add <blockCode>").description("Generate and refine a JSON block interactively").option("-q, --query <value>","Optional user input").option("-i, --block-input <value>","Optional block input json schema in base 64").option("-o, --overwrite","Automatically overwrite existing files").option("-f, --force","Force insert even if block already exists").action(async(s,e)=>{let t=e.blockInput?is(e.blockInput):null;if(Et(s,t||{})&&!e.force){R(`Block "${s}" with the same input configuration is already added to this project.
154
159
 
155
- Use -f to force re-add.`,"Already Added");return}let i=wr(s,t||{});if(i.length>0&&!e.force){let u=i.length;G(`Block "${s}" has already been added ${u} time${u>1?"s":""} with different input configuration${u>1?"s":""}.
160
+ Use -f to force re-add.`,"Already Added");return}let n=xr(s,t||{});if(n.length>0&&!e.force){let u=n.length;R(`Block "${s}" has already been added ${u} time${u>1?"s":""} with different input configuration${u>1?"s":""}.
156
161
 
157
- Proceeding to add with new input configuration...`,"Different Input Detected")}await Zr(s,e.query,t,e.overwrite)});j.command("search <query>").description("Search and add blocks using natural language").option("-a, --auto-select","Automatically select the best match (agent-friendly mode)").option("-o, --overwrite","Automatically overwrite existing files").action(async(s,e)=>{await Qn(s,{autoSelect:e.autoSelect,overwrite:e.overwrite})});j.command("create <projectId> <categoryId> <templateGroupName> [paths...]").description("Create templates from provided files/folders and group them into a template group").action(async(s,e,t,n=[])=>{let i=await W.getToken();i||(d("You must be logged in to create templates. Please run 'derived-cli register <token>' first."),process.exit(1));let u=Number.parseInt(s,10);Number.isNaN(u)&&(d("Invalid project ID. Please provide a numeric value."),process.exit(1));let r=Number.parseInt(e,10);Number.isNaN(r)&&(d("Invalid category ID. Please provide a numeric value."),process.exit(1));let o=n.filter(y=>y.trim().length>0);o.length===0&&(d("At least one file or directory path is required."),process.exit(1));let a=B();a.start("Collecting files from provided paths...");let{files:c,errors:l}=Rr(o);a.stop(`Collected ${c.length} file(s) from ${o.length} path(s)`);for(let y of l)A.warning(y);c.length===0&&(d("No valid files found to create templates from."),process.exit(1));let D=new se.default({apiToken:i}),p=B();p.start("Creating template group...");let C=null;try{let y=await D.createTemplateGroup({name:t,projectID:u,blockCategoryId:r}),Z=Number(y?.result?.id);if(!Number.isInteger(Z)||Z<=0)throw new Error("Template group created but no valid group ID was returned.");C=Z,p.stop(`Template group created (ID: ${C})`)}catch(y){p.stop("Failed to create template group"),y.response?.data?d(`API Error: ${JSON.stringify(y.response.data)}`):d(`Error: ${y.message}`),process.exit(1)}C===null&&(d("Template group could not be created."),process.exit(1));let $=c.map(y=>({type:"add",templateGroupId:C,path:y.templatePath,template:y.template})),Q=B();Q.start(`Creating ${$.length} template(s)...`);try{await D.createMultipleTemplates($),Q.stop(`Created ${$.length} template(s) successfully`),te(`Template group "${t}" created successfully.`),console.log(C)}catch(y){Q.stop("Failed to create templates"),y.response?.data?d(`API Error: ${JSON.stringify(y.response.data)}`):d(`Error: ${y.message}`),process.exit(1)}});j.command("create-template-group").description("Create a new template group").option("-p, --payload <value>","Base64 encoded JSON payload").action(async s=>{let e=await W.getToken();e||(d("You must be logged in to create a template group. Please run 'derived-cli register <token>' first."),process.exit(1)),s.payload||(d("Payload is required (--payload <base64-json>)"),process.exit(1));let t=Xr(s.payload);t||(d("Invalid base64 payload"),process.exit(1));let n=new se.default({apiToken:e}),i=B();i.start("Creating template group...");try{let u=await n.createTemplateGroup(t);i.stop("Template group created successfully"),u?.result?.id?console.log(u.result.id):console.log(JSON.stringify(u))}catch(u){i.stop("Failed to create template group"),u.response?.data?d(`API Error: ${JSON.stringify(u.response.data)}`):d(`Error: ${u.message}`),process.exit(1)}});j.command("create-category <projectId> <categoryName>").description("Create a new category in a project").action(async(s,e)=>{let t=await W.getToken();t||(d("You must be logged in to create a category. Please run 'derived-cli register <token>' first."),process.exit(1));let n=Number.parseInt(s,10);Number.isNaN(n)&&(d("Invalid project ID. Please provide a numeric value."),process.exit(1));let i=new se.default({apiToken:t}),u=B();u.start("Creating category...");try{let r=await i.createCategory({name:e,projectId:n,active:!0});u.stop("Category created successfully"),r?.result?.id?console.log(r.result.id):console.log(JSON.stringify(r))}catch(r){u.stop("Failed to create category"),r.response?.data?d(`API Error: ${JSON.stringify(r.response.data)}`):d(`Error: ${r.message}`),process.exit(1)}});j.command("list-categories <projectId>").description("List all categories in a project").action(async s=>{let e=await W.getToken();e||(d("You must be logged in to list categories. Please run 'derived-cli register <token>' first."),process.exit(1)),s||(d("Project ID is required"),process.exit(1));let t=new se.default({apiToken:e}),n=B();n.start("Fetching categories...");try{let i=await t.getProjectCategories(parseInt(s));n.stop("Categories fetched successfully"),i?.result?console.log(JSON.stringify(i.result,null,2)):console.log("No categories found or invalid response structure")}catch(i){n.stop("Failed to fetch categories"),i.response?.data?d(`API Error: ${JSON.stringify(i.response.data)}`):d(`Error: ${i.message}`),process.exit(1)}});j.command("init <project-slug>").description("Initialize a project from a template").action(async s=>{oe(`\u{1F680} Initializing project: ${s}`);try{let e=process.cwd(),{isDirectoryEmpty:t,removeGitDirectory:n}=await Promise.resolve().then(()=>(Ur(),Lr));t(e)||(d("\u274C Error: Current directory is not empty. Please run this command in an empty directory."),process.exit(1));let i=B();i.start("Fetching project details...");let u=await Y.fetchProjectBySlug(s);u?.result||(i.stop("\u274C Project not found"),d(`Project with slug '${s}' does not exist.`),process.exit(1));let r=u.result;i.stop(`\u2705 Found project: ${r.name}`),i.start(`Cloning repository from ${r.gitUrl}...`);try{await ke(`git clone ${r.gitUrl} .`,{stdio:"pipe",cwd:e}),i.stop("\u2705 Repository cloned successfully")}catch(o){i.stop("\u274C Failed to clone repository"),d(`Git clone failed: ${o.message}`),process.exit(1)}if(n(e),r.setupCommand&&r.setupCommand.trim()){let o=r.setupCommand.split(",").map(a=>a.trim());for(let a of o)if(a){i.start(`Running: ${a}`);try{await ke(a,{stdio:"inherit",cwd:e}),i.stop(`\u2705 Completed: ${a}`)}catch(c){i.stop(`\u26A0\uFE0F Warning: Command failed: ${a}`),console.warn(` ${c.message}`)}}}te(`\u{1F389} Project '${r.name}' setup successfully!`)}catch(e){d(`\u274C An error occurred: ${e.message}`),process.exit(1)}});j.command("register <token>").description("Register with your account token").action(async s=>{try{await W.saveToken(s),A.success("Token saved successfully!")}catch(e){d(`Failed to save token: ${e.message}`)}});j.parse();0&&(module.exports={displayFileTree});
162
+ Proceeding to add with new input configuration...`,"Different Input Detected")}await ss(s,e.query,t,e.overwrite)});N.command("search <query>").description("Search and add blocks using natural language").option("-a, --auto-select","Automatically select the best match (agent-friendly mode)").option("-o, --overwrite","Automatically overwrite existing files").action(async(s,e)=>{await Xi(s,{autoSelect:e.autoSelect,overwrite:e.overwrite})});N.command("create <projectId> <categoryId> <templateGroupName> [paths...]").description("Create templates from provided files/folders and group them into a template group").action(async(s,e,t,i=[])=>{let n=await L.getToken();n||(d("You must be logged in to create templates. Please run 'derived-cli register <token>' first."),process.exit(1));let u=Number.parseInt(s,10);Number.isNaN(u)&&(d("Invalid project ID. Please provide a numeric value."),process.exit(1));let r=Number.parseInt(e,10);Number.isNaN(r)&&(d("Invalid category ID. Please provide a numeric value."),process.exit(1));let o=i.filter(y=>y.trim().length>0);o.length===0&&(d("At least one file or directory path is required."),process.exit(1));let a=B();a.start("Collecting files from provided paths...");let{files:c,errors:l}=Jr(o);a.stop(`Collected ${c.length} file(s) from ${o.length} path(s)`);for(let y of l)A.warning(y);c.length===0&&(d("No valid files found to create templates from."),process.exit(1));let D=new ie.default({apiToken:n}),p=B();p.start("Creating template group...");let E=null,$=null;try{$=await D.createTemplateGroup({name:t,projectID:u,blockCategoryId:r});let y=Number($?.result?.id);if(!Number.isInteger(y)||y<=0)throw new Error("Template group created but no valid group ID was returned.");E=y,p.stop(`Template group created ${E}`)}catch(y){p.stop("Failed to create template group"),y.response?.data?d(`API Error: ${JSON.stringify(y.response.data)}`):d(`Error: ${y.message}`),process.exit(1)}E===null&&(d("Template group could not be created."),process.exit(1));let X=c.map(y=>({type:"add",templateGroupId:E,path:y.templatePath,template:y.template})),J=B();J.start(`Creating ${X.length} template(s)...`);try{await D.createMultipleTemplates(X),J.stop(`Created ${X.length} template(s) successfully`),q(`Template group "${t}" created successfully.`),console.log($?.result)}catch(y){J.stop("Failed to create templates"),y.response?.data?d(`API Error: ${JSON.stringify(y.response.data)}`):d(`Error: ${y.message}`),process.exit(1)}});N.command("create-template-group").description("Create a new template group").option("-p, --payload <value>","Base64 encoded JSON payload").action(async s=>{let e=await L.getToken();e||(d("You must be logged in to create a template group. Please run 'derived-cli register <token>' first."),process.exit(1)),s.payload||(d("Payload is required (--payload <base64-json>)"),process.exit(1));let t=is(s.payload);t||(d("Invalid base64 payload"),process.exit(1));let i=new ie.default({apiToken:e}),n=B();n.start("Creating template group...");try{let u=await i.createTemplateGroup(t);n.stop("Template group created successfully"),u?.result?.id?console.log(u.result.id):console.log(JSON.stringify(u))}catch(u){n.stop("Failed to create template group"),u.response?.data?d(`API Error: ${JSON.stringify(u.response.data)}`):d(`Error: ${u.message}`),process.exit(1)}});N.command("create-category <projectId> <categoryName>").description("Create a new category in a project").action(async(s,e)=>{let t=await L.getToken();t||(d("You must be logged in to create a category. Please run 'derived-cli register <token>' first."),process.exit(1));let i=Number.parseInt(s,10);Number.isNaN(i)&&(d("Invalid project ID. Please provide a numeric value."),process.exit(1));let n=new ie.default({apiToken:t}),u=B();u.start("Creating category...");try{let r=await n.createCategory({name:e,projectId:i,active:!0});u.stop("Category created successfully"),r?.result?.id?console.log(r.result.id):console.log(JSON.stringify(r))}catch(r){u.stop("Failed to create category"),r.response?.data?d(`API Error: ${JSON.stringify(r.response.data)}`):d(`Error: ${r.message}`),process.exit(1)}});N.command("list-categories <projectId>").description("List all categories in a project").action(async s=>{let e=await L.getToken();e||(d("You must be logged in to list categories. Please run 'derived-cli register <token>' first."),process.exit(1)),s||(d("Project ID is required"),process.exit(1));let t=new ie.default({apiToken:e}),i=B();i.start("Fetching categories...");try{let n=await t.getProjectCategories(parseInt(s));i.stop("Categories fetched successfully"),n?.result?console.log(JSON.stringify(n.result,null,2)):console.log("No categories found or invalid response structure")}catch(n){i.stop("Failed to fetch categories"),n.response?.data?d(`API Error: ${JSON.stringify(n.response.data)}`):d(`Error: ${n.message}`),process.exit(1)}});async function Zr(s,e){let{existsSync:t,mkdirSync:i,writeFileSync:n}=await import("fs"),{join:u}=await import("path"),r=u(s,".derived");t(r)||i(r,{recursive:!0});let o={projectID:e.id,projectSlug:e.slug,projectName:e.name,ownerUsername:e.ownerUsername,gitUrl:e.gitUrl,description:e.description},a=u(r,"project.json");n(a,JSON.stringify(o,null,2))}N.command("init <project-slug>").description("Initialize a project from a template").action(async s=>{oe(`\u{1F680} Initializing project: ${s}`);try{let e=process.cwd(),{isDirectoryEmpty:t,removeGitDirectory:i}=await Promise.resolve().then(()=>(Yr(),zr)),{existsSync:n}=await import("fs"),{join:u}=await import("path"),r=t(e),o=B();o.start("Fetching project details...");let a=await Z.fetchProjectBySlug(s);a?.result||(o.stop("\u274C Project not found"),d(`Project with slug '${s}' does not exist.`),process.exit(1));let c=a.result;if(o.stop(`\u2705 Found project: ${c.name}`),!r){let l=u(e,".derived","project.json");if(n(l)){let D=await Fr({message:"project.json already exists. Do you want to overwrite it?"});G(D)&&(d("Operation cancelled."),process.exit(0)),D||(q("Skipped updating project.json"),process.exit(0))}await Zr(e,c),q("Updated project.json in .derived folder"),process.exit(0)}o.start(`Cloning repository from ${c.gitUrl}...`);try{await Te(`git clone ${c.gitUrl} .`,{stdio:"pipe",cwd:e}),o.stop("\u2705 Repository cloned successfully")}catch(l){o.stop("\u274C Failed to clone repository"),d(`Git clone failed: ${l.message}`),process.exit(1)}if(i(e),c.setupCommand&&c.setupCommand.trim()){let l=c.setupCommand.split(",").map(D=>D.trim());for(let D of l)if(D){o.start(`Running: ${D}`);try{await Te(D,{stdio:"inherit",cwd:e}),o.stop(`\u2705 Completed: ${D}`)}catch(p){o.stop(`\u26A0\uFE0F Warning: Command failed: ${D}`),console.warn(` ${p.message}`)}}}await Zr(e,c),q(`\u{1F389} Project '${c.name}' setup successfully!`)}catch(e){d(`\u274C An error occurred: ${e.message}`),process.exit(1)}});N.command("register <token>").description("Register with your account token").action(async s=>{try{await L.saveToken(s),A.success("Token saved successfully!")}catch(e){d(`Failed to save token: ${e.message}`)}});N.parse();0&&(module.exports={displayFileTree});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "derived-cli",
3
- "version": "0.0.65",
3
+ "version": "0.0.67",
4
4
  "description": "CLI for Derived",
5
5
  "author": "Derived",
6
6
  "license": "MIT",