@automagik/genie 0.260201.2240

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 (59) hide show
  1. package/.github/workflows/publish.yml +26 -0
  2. package/.worktrees/.metadata.json +3 -0
  3. package/README.md +532 -0
  4. package/bun.lock +101 -0
  5. package/dist/claudio.js +76 -0
  6. package/dist/genie.js +201 -0
  7. package/dist/term.js +136 -0
  8. package/install.sh +351 -0
  9. package/package.json +37 -0
  10. package/scripts/version.ts +48 -0
  11. package/src/claudio.ts +128 -0
  12. package/src/commands/launch.ts +245 -0
  13. package/src/commands/models.ts +43 -0
  14. package/src/commands/profiles.ts +95 -0
  15. package/src/commands/setup.ts +5 -0
  16. package/src/genie-commands/hooks.ts +317 -0
  17. package/src/genie-commands/install.ts +351 -0
  18. package/src/genie-commands/setup.ts +282 -0
  19. package/src/genie-commands/shortcuts.ts +62 -0
  20. package/src/genie-commands/update.ts +228 -0
  21. package/src/genie.ts +106 -0
  22. package/src/lib/api-client.ts +109 -0
  23. package/src/lib/claude-settings.ts +252 -0
  24. package/src/lib/config.ts +109 -0
  25. package/src/lib/genie-config.ts +164 -0
  26. package/src/lib/hook-manager.ts +130 -0
  27. package/src/lib/hook-script.ts +256 -0
  28. package/src/lib/hooks/compose.ts +72 -0
  29. package/src/lib/hooks/index.ts +163 -0
  30. package/src/lib/hooks/presets/audited.ts +191 -0
  31. package/src/lib/hooks/presets/collaborative.ts +143 -0
  32. package/src/lib/hooks/presets/sandboxed.ts +153 -0
  33. package/src/lib/hooks/presets/supervised.ts +66 -0
  34. package/src/lib/hooks/utils/escape.ts +46 -0
  35. package/src/lib/log-reader.ts +213 -0
  36. package/src/lib/picker.ts +62 -0
  37. package/src/lib/session-metadata.ts +58 -0
  38. package/src/lib/system-detect.ts +185 -0
  39. package/src/lib/tmux.ts +410 -0
  40. package/src/lib/version.ts +15 -0
  41. package/src/lib/wizard.ts +104 -0
  42. package/src/lib/worktree.ts +362 -0
  43. package/src/term-commands/attach.ts +23 -0
  44. package/src/term-commands/exec.ts +34 -0
  45. package/src/term-commands/hook.ts +42 -0
  46. package/src/term-commands/ls.ts +33 -0
  47. package/src/term-commands/new.ts +73 -0
  48. package/src/term-commands/pane.ts +81 -0
  49. package/src/term-commands/read.ts +70 -0
  50. package/src/term-commands/rm.ts +47 -0
  51. package/src/term-commands/send.ts +34 -0
  52. package/src/term-commands/shortcuts.ts +355 -0
  53. package/src/term-commands/split.ts +87 -0
  54. package/src/term-commands/status.ts +116 -0
  55. package/src/term-commands/window.ts +72 -0
  56. package/src/term.ts +192 -0
  57. package/src/types/config.ts +17 -0
  58. package/src/types/genie-config.ts +104 -0
  59. package/tsconfig.json +17 -0
package/dist/genie.js ADDED
@@ -0,0 +1,201 @@
1
+ #!/usr/bin/env bun
2
+ // @bun
3
+ var x6=Object.create;var{getPrototypeOf:y6,defineProperty:R0,getOwnPropertyNames:h6}=Object;var g6=Object.prototype.hasOwnProperty;var KD=(D,F,B)=>{B=D!=null?x6(y6(D)):{};let E=F||!D||!D.__esModule?R0(B,"default",{value:D,enumerable:!0}):B;for(let $ of h6(D))if(!g6.call(E,$))R0(E,$,{get:()=>D[$],enumerable:!0});return E};var h=(D,F)=>()=>(F||D((F={exports:{}}).exports,F),F.exports);var m6=(D,F)=>{for(var B in F)R0(D,B,{get:F[B],enumerable:!0,configurable:!0,set:(E)=>F[B]=()=>E})};var QD=import.meta.require;var j2=h((l6)=>{class V0 extends Error{constructor(D,F,B){super(B);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=F,this.exitCode=D,this.nestedError=void 0}}class L3 extends V0{constructor(D){super(1,"commander.invalidArgument",D);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}l6.CommanderError=V0;l6.InvalidArgumentError=L3});var l2=h((i6)=>{var{InvalidArgumentError:c6}=j2();class O3{constructor(D,F){switch(this.description=F||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,D[0]){case"<":this.required=!0,this._name=D.slice(1,-1);break;case"[":this.required=!1,this._name=D.slice(1,-1);break;default:this.required=!0,this._name=D;break}if(this._name.length>3&&this._name.slice(-3)==="...")this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_concatValue(D,F){if(F===this.defaultValue||!Array.isArray(F))return[D];return F.concat(D)}default(D,F){return this.defaultValue=D,this.defaultValueDescription=F,this}argParser(D){return this.parseArg=D,this}choices(D){return this.argChoices=D.slice(),this.parseArg=(F,B)=>{if(!this.argChoices.includes(F))throw new c6(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(F,B);return F},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function n6(D){let F=D.name()+(D.variadic===!0?"...":"");return D.required?"<"+F+">":"["+F+"]"}i6.Argument=O3;i6.humanReadableArgName=n6});var K0=h((s6)=>{var{humanReadableArgName:o6}=l2();class w3{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(D){let F=D.commands.filter((E)=>!E._hidden),B=D._getHelpCommand();if(B&&!B._hidden)F.push(B);if(this.sortSubcommands)F.sort((E,$)=>{return E.name().localeCompare($.name())});return F}compareOptions(D,F){let B=(E)=>{return E.short?E.short.replace(/^-/,""):E.long.replace(/^--/,"")};return B(D).localeCompare(B(F))}visibleOptions(D){let F=D.options.filter((E)=>!E.hidden),B=D._getHelpOption();if(B&&!B.hidden){let E=B.short&&D._findOption(B.short),$=B.long&&D._findOption(B.long);if(!E&&!$)F.push(B);else if(B.long&&!$)F.push(D.createOption(B.long,B.description));else if(B.short&&!E)F.push(D.createOption(B.short,B.description))}if(this.sortOptions)F.sort(this.compareOptions);return F}visibleGlobalOptions(D){if(!this.showGlobalOptions)return[];let F=[];for(let B=D.parent;B;B=B.parent){let E=B.options.filter(($)=>!$.hidden);F.push(...E)}if(this.sortOptions)F.sort(this.compareOptions);return F}visibleArguments(D){if(D._argsDescription)D.registeredArguments.forEach((F)=>{F.description=F.description||D._argsDescription[F.name()]||""});if(D.registeredArguments.find((F)=>F.description))return D.registeredArguments;return[]}subcommandTerm(D){let F=D.registeredArguments.map((B)=>o6(B)).join(" ");return D._name+(D._aliases[0]?"|"+D._aliases[0]:"")+(D.options.length?" [options]":"")+(F?" "+F:"")}optionTerm(D){return D.flags}argumentTerm(D){return D.name()}longestSubcommandTermLength(D,F){return F.visibleCommands(D).reduce((B,E)=>{return Math.max(B,F.subcommandTerm(E).length)},0)}longestOptionTermLength(D,F){return F.visibleOptions(D).reduce((B,E)=>{return Math.max(B,F.optionTerm(E).length)},0)}longestGlobalOptionTermLength(D,F){return F.visibleGlobalOptions(D).reduce((B,E)=>{return Math.max(B,F.optionTerm(E).length)},0)}longestArgumentTermLength(D,F){return F.visibleArguments(D).reduce((B,E)=>{return Math.max(B,F.argumentTerm(E).length)},0)}commandUsage(D){let F=D._name;if(D._aliases[0])F=F+"|"+D._aliases[0];let B="";for(let E=D.parent;E;E=E.parent)B=E.name()+" "+B;return B+F+" "+D.usage()}commandDescription(D){return D.description()}subcommandDescription(D){return D.summary()||D.description()}optionDescription(D){let F=[];if(D.argChoices)F.push(`choices: ${D.argChoices.map((B)=>JSON.stringify(B)).join(", ")}`);if(D.defaultValue!==void 0){if(D.required||D.optional||D.isBoolean()&&typeof D.defaultValue==="boolean")F.push(`default: ${D.defaultValueDescription||JSON.stringify(D.defaultValue)}`)}if(D.presetArg!==void 0&&D.optional)F.push(`preset: ${JSON.stringify(D.presetArg)}`);if(D.envVar!==void 0)F.push(`env: ${D.envVar}`);if(F.length>0)return`${D.description} (${F.join(", ")})`;return D.description}argumentDescription(D){let F=[];if(D.argChoices)F.push(`choices: ${D.argChoices.map((B)=>JSON.stringify(B)).join(", ")}`);if(D.defaultValue!==void 0)F.push(`default: ${D.defaultValueDescription||JSON.stringify(D.defaultValue)}`);if(F.length>0){let B=`(${F.join(", ")})`;if(D.description)return`${D.description} ${B}`;return B}return D.description}formatHelp(D,F){let B=F.padWidth(D,F),E=F.helpWidth||80,$=2,X=2;function J(A,I){if(I){let P=`${A.padEnd(B+2)}${I}`;return F.wrap(P,E-2,B+2)}return A}function Q(A){return A.join(`
4
+ `).replace(/^/gm," ".repeat(2))}let Y=[`Usage: ${F.commandUsage(D)}`,""],W=F.commandDescription(D);if(W.length>0)Y=Y.concat([F.wrap(W,E,0),""]);let q=F.visibleArguments(D).map((A)=>{return J(F.argumentTerm(A),F.argumentDescription(A))});if(q.length>0)Y=Y.concat(["Arguments:",Q(q),""]);let G=F.visibleOptions(D).map((A)=>{return J(F.optionTerm(A),F.optionDescription(A))});if(G.length>0)Y=Y.concat(["Options:",Q(G),""]);if(this.showGlobalOptions){let A=F.visibleGlobalOptions(D).map((I)=>{return J(F.optionTerm(I),F.optionDescription(I))});if(A.length>0)Y=Y.concat(["Global Options:",Q(A),""])}let R=F.visibleCommands(D).map((A)=>{return J(F.subcommandTerm(A),F.subcommandDescription(A))});if(R.length>0)Y=Y.concat(["Commands:",Q(R),""]);return Y.join(`
5
+ `)}padWidth(D,F){return Math.max(F.longestOptionTermLength(D,F),F.longestGlobalOptionTermLength(D,F),F.longestSubcommandTermLength(D,F),F.longestArgumentTermLength(D,F))}wrap(D,F,B,E=40){let X=new RegExp(`[\\n][${" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF"}]+`);if(D.match(X))return D;let J=F-B;if(J<E)return D;let Q=D.slice(0,B),Y=D.slice(B).replace(`\r
6
+ `,`
7
+ `),W=" ".repeat(B),G=`\\s${"\u200B"}`,R=new RegExp(`
8
+ |.{1,${J-1}}([${G}]|$)|[^${G}]+?([${G}]|$)`,"g"),A=Y.match(R)||[];return Q+A.map((I,P)=>{if(I===`
9
+ `)return"";return(P>0?W:"")+I.trimEnd()}).join(`
10
+ `)}}s6.Help=w3});var N0=h((BF)=>{var{InvalidArgumentError:e6}=j2();class S3{constructor(D,F){this.flags=D,this.description=F||"",this.required=D.includes("<"),this.optional=D.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(D),this.mandatory=!1;let B=FF(D);if(this.short=B.shortFlag,this.long=B.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}default(D,F){return this.defaultValue=D,this.defaultValueDescription=F,this}preset(D){return this.presetArg=D,this}conflicts(D){return this.conflictsWith=this.conflictsWith.concat(D),this}implies(D){let F=D;if(typeof D==="string")F={[D]:!0};return this.implied=Object.assign(this.implied||{},F),this}env(D){return this.envVar=D,this}argParser(D){return this.parseArg=D,this}makeOptionMandatory(D=!0){return this.mandatory=!!D,this}hideHelp(D=!0){return this.hidden=!!D,this}_concatValue(D,F){if(F===this.defaultValue||!Array.isArray(F))return[D];return F.concat(D)}choices(D){return this.argChoices=D.slice(),this.parseArg=(F,B)=>{if(!this.argChoices.includes(F))throw new e6(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(F,B);return F},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){return DF(this.name().replace(/^no-/,""))}is(D){return this.short===D||this.long===D}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class u3{constructor(D){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,D.forEach((F)=>{if(F.negate)this.negativeOptions.set(F.attributeName(),F);else this.positiveOptions.set(F.attributeName(),F)}),this.negativeOptions.forEach((F,B)=>{if(this.positiveOptions.has(B))this.dualOptions.add(B)})}valueFromOption(D,F){let B=F.attributeName();if(!this.dualOptions.has(B))return!0;let E=this.negativeOptions.get(B).presetArg,$=E!==void 0?E:!1;return F.negate===($===D)}}function DF(D){return D.split("-").reduce((F,B)=>{return F+B[0].toUpperCase()+B.slice(1)})}function FF(D){let F,B,E=D.split(/[ |,]+/);if(E.length>1&&!/^[[<]/.test(E[1]))F=E.shift();if(B=E.shift(),!F&&/^-[^-]$/.test(B))F=B,B=void 0;return{shortFlag:F,longFlag:B}}BF.Option=S3;BF.DualOptions=u3});var I3=h((QF)=>{function XF(D,F){if(Math.abs(D.length-F.length)>3)return Math.max(D.length,F.length);let B=[];for(let E=0;E<=D.length;E++)B[E]=[E];for(let E=0;E<=F.length;E++)B[0][E]=E;for(let E=1;E<=F.length;E++)for(let $=1;$<=D.length;$++){let X=1;if(D[$-1]===F[E-1])X=0;else X=1;if(B[$][E]=Math.min(B[$-1][E]+1,B[$][E-1]+1,B[$-1][E-1]+X),$>1&&E>1&&D[$-1]===F[E-2]&&D[$-2]===F[E-1])B[$][E]=Math.min(B[$][E],B[$-2][E-2]+1)}return B[D.length][F.length]}function JF(D,F){if(!F||F.length===0)return"";F=Array.from(new Set(F));let B=D.startsWith("--");if(B)D=D.slice(2),F=F.map((J)=>J.slice(2));let E=[],$=3,X=0.4;if(F.forEach((J)=>{if(J.length<=1)return;let Q=XF(D,J),Y=Math.max(D.length,J.length);if((Y-Q)/Y>X){if(Q<$)$=Q,E=[J];else if(Q===$)E.push(J)}}),E.sort((J,Q)=>J.localeCompare(Q)),B)E=E.map((J)=>`--${J}`);if(E.length>1)return`
11
+ (Did you mean one of ${E.join(", ")}?)`;if(E.length===1)return`
12
+ (Did you mean ${E[0]}?)`;return""}QF.suggestSimilar=JF});var k3=h((MF)=>{var WF=QD("events").EventEmitter,L0=QD("child_process"),GD=QD("path"),O0=QD("fs"),y=QD("process"),{Argument:qF,humanReadableArgName:_F}=l2(),{CommanderError:w0}=j2(),{Help:HF}=K0(),{Option:T3,DualOptions:GF}=N0(),{suggestSimilar:b3}=I3();class S0 extends WF{constructor(D){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=D||"",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._outputConfiguration={writeOut:(F)=>y.stdout.write(F),writeErr:(F)=>y.stderr.write(F),getOutHelpWidth:()=>y.stdout.isTTY?y.stdout.columns:void 0,getErrHelpWidth:()=>y.stderr.isTTY?y.stderr.columns:void 0,outputError:(F,B)=>B(F)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(D){return this._outputConfiguration=D._outputConfiguration,this._helpOption=D._helpOption,this._helpCommand=D._helpCommand,this._helpConfiguration=D._helpConfiguration,this._exitCallback=D._exitCallback,this._storeOptionsAsProperties=D._storeOptionsAsProperties,this._combineFlagAndOptionalValue=D._combineFlagAndOptionalValue,this._allowExcessArguments=D._allowExcessArguments,this._enablePositionalOptions=D._enablePositionalOptions,this._showHelpAfterError=D._showHelpAfterError,this._showSuggestionAfterError=D._showSuggestionAfterError,this}_getCommandAndAncestors(){let D=[];for(let F=this;F;F=F.parent)D.push(F);return D}command(D,F,B){let E=F,$=B;if(typeof E==="object"&&E!==null)$=E,E=null;$=$||{};let[,X,J]=D.match(/([^ ]+) *(.*)/),Q=this.createCommand(X);if(E)Q.description(E),Q._executableHandler=!0;if($.isDefault)this._defaultCommandName=Q._name;if(Q._hidden=!!($.noHelp||$.hidden),Q._executableFile=$.executableFile||null,J)Q.arguments(J);if(this._registerCommand(Q),Q.parent=this,Q.copyInheritedSettings(this),E)return this;return Q}createCommand(D){return new S0(D)}createHelp(){return Object.assign(new HF,this.configureHelp())}configureHelp(D){if(D===void 0)return this._helpConfiguration;return this._helpConfiguration=D,this}configureOutput(D){if(D===void 0)return this._outputConfiguration;return Object.assign(this._outputConfiguration,D),this}showHelpAfterError(D=!0){if(typeof D!=="string")D=!!D;return this._showHelpAfterError=D,this}showSuggestionAfterError(D=!0){return this._showSuggestionAfterError=!!D,this}addCommand(D,F){if(!D._name)throw Error(`Command passed to .addCommand() must have a name
13
+ - specify the name in Command constructor or using .name()`);if(F=F||{},F.isDefault)this._defaultCommandName=D._name;if(F.noHelp||F.hidden)D._hidden=!0;return this._registerCommand(D),D.parent=this,D._checkForBrokenPassThrough(),this}createArgument(D,F){return new qF(D,F)}argument(D,F,B,E){let $=this.createArgument(D,F);if(typeof B==="function")$.default(E).argParser(B);else $.default(B);return this.addArgument($),this}arguments(D){return D.trim().split(/ +/).forEach((F)=>{this.argument(F)}),this}addArgument(D){let F=this.registeredArguments.slice(-1)[0];if(F&&F.variadic)throw Error(`only the last argument can be variadic '${F.name()}'`);if(D.required&&D.defaultValue!==void 0&&D.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${D.name()}'`);return this.registeredArguments.push(D),this}helpCommand(D,F){if(typeof D==="boolean")return this._addImplicitHelpCommand=D,this;D=D??"help [command]";let[,B,E]=D.match(/([^ ]+) *(.*)/),$=F??"display help for command",X=this.createCommand(B);if(X.helpOption(!1),E)X.arguments(E);if($)X.description($);return this._addImplicitHelpCommand=!0,this._helpCommand=X,this}addHelpCommand(D,F){if(typeof D!=="object")return this.helpCommand(D,F),this;return this._addImplicitHelpCommand=!0,this._helpCommand=D,this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook(D,F){let B=["preSubcommand","preAction","postAction"];if(!B.includes(D))throw Error(`Unexpected value for event passed to hook : '${D}'.
14
+ Expecting one of '${B.join("', '")}'`);if(this._lifeCycleHooks[D])this._lifeCycleHooks[D].push(F);else this._lifeCycleHooks[D]=[F];return this}exitOverride(D){if(D)this._exitCallback=D;else this._exitCallback=(F)=>{if(F.code!=="commander.executeSubCommandAsync")throw F};return this}_exit(D,F,B){if(this._exitCallback)this._exitCallback(new w0(D,F,B));y.exit(D)}action(D){let F=(B)=>{let E=this.registeredArguments.length,$=B.slice(0,E);if(this._storeOptionsAsProperties)$[E]=this;else $[E]=this.opts();return $.push(this),D.apply(this,$)};return this._actionHandler=F,this}createOption(D,F){return new T3(D,F)}_callParseArg(D,F,B,E){try{return D.parseArg(F,B)}catch($){if($.code==="commander.invalidArgument"){let X=`${E} ${$.message}`;this.error(X,{exitCode:$.exitCode,code:$.code})}throw $}}_registerOption(D){let F=D.short&&this._findOption(D.short)||D.long&&this._findOption(D.long);if(F){let B=D.long&&this._findOption(D.long)?D.long:D.short;throw Error(`Cannot add option '${D.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${B}'
15
+ - already used by option '${F.flags}'`)}this.options.push(D)}_registerCommand(D){let F=(E)=>{return[E.name()].concat(E.aliases())},B=F(D).find((E)=>this._findCommand(E));if(B){let E=F(this._findCommand(B)).join("|"),$=F(D).join("|");throw Error(`cannot add command '${$}' as already have command '${E}'`)}this.commands.push(D)}addOption(D){this._registerOption(D);let F=D.name(),B=D.attributeName();if(D.negate){let $=D.long.replace(/^--no-/,"--");if(!this._findOption($))this.setOptionValueWithSource(B,D.defaultValue===void 0?!0:D.defaultValue,"default")}else if(D.defaultValue!==void 0)this.setOptionValueWithSource(B,D.defaultValue,"default");let E=($,X,J)=>{if($==null&&D.presetArg!==void 0)$=D.presetArg;let Q=this.getOptionValue(B);if($!==null&&D.parseArg)$=this._callParseArg(D,$,Q,X);else if($!==null&&D.variadic)$=D._concatValue($,Q);if($==null)if(D.negate)$=!1;else if(D.isBoolean()||D.optional)$=!0;else $="";this.setOptionValueWithSource(B,$,J)};if(this.on("option:"+F,($)=>{let X=`error: option '${D.flags}' argument '${$}' is invalid.`;E($,X,"cli")}),D.envVar)this.on("optionEnv:"+F,($)=>{let X=`error: option '${D.flags}' value '${$}' from env '${D.envVar}' is invalid.`;E($,X,"env")});return this}_optionEx(D,F,B,E,$){if(typeof F==="object"&&F instanceof T3)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let X=this.createOption(F,B);if(X.makeOptionMandatory(!!D.mandatory),typeof E==="function")X.default($).argParser(E);else if(E instanceof RegExp){let J=E;E=(Q,Y)=>{let W=J.exec(Q);return W?W[0]:Y},X.default($).argParser(E)}else X.default(E);return this.addOption(X)}option(D,F,B,E){return this._optionEx({},D,F,B,E)}requiredOption(D,F,B,E){return this._optionEx({mandatory:!0},D,F,B,E)}combineFlagAndOptionalValue(D=!0){return this._combineFlagAndOptionalValue=!!D,this}allowUnknownOption(D=!0){return this._allowUnknownOption=!!D,this}allowExcessArguments(D=!0){return this._allowExcessArguments=!!D,this}enablePositionalOptions(D=!0){return this._enablePositionalOptions=!!D,this}passThroughOptions(D=!0){return this._passThroughOptions=!!D,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(D=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!D,this}getOptionValue(D){if(this._storeOptionsAsProperties)return this[D];return this._optionValues[D]}setOptionValue(D,F){return this.setOptionValueWithSource(D,F,void 0)}setOptionValueWithSource(D,F,B){if(this._storeOptionsAsProperties)this[D]=F;else this._optionValues[D]=F;return this._optionValueSources[D]=B,this}getOptionValueSource(D){return this._optionValueSources[D]}getOptionValueSourceWithGlobals(D){let F;return this._getCommandAndAncestors().forEach((B)=>{if(B.getOptionValueSource(D)!==void 0)F=B.getOptionValueSource(D)}),F}_prepareUserArgs(D,F){if(D!==void 0&&!Array.isArray(D))throw Error("first parameter to parse must be array or undefined");if(F=F||{},D===void 0&&F.from===void 0){if(y.versions?.electron)F.from="electron";let E=y.execArgv??[];if(E.includes("-e")||E.includes("--eval")||E.includes("-p")||E.includes("--print"))F.from="eval"}if(D===void 0)D=y.argv;this.rawArgs=D.slice();let B;switch(F.from){case void 0:case"node":this._scriptPath=D[1],B=D.slice(2);break;case"electron":if(y.defaultApp)this._scriptPath=D[1],B=D.slice(2);else B=D.slice(1);break;case"user":B=D.slice(0);break;case"eval":B=D.slice(1);break;default:throw Error(`unexpected parse option { from: '${F.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",B}parse(D,F){let B=this._prepareUserArgs(D,F);return this._parseCommand([],B),this}async parseAsync(D,F){let B=this._prepareUserArgs(D,F);return await this._parseCommand([],B),this}_executeSubCommand(D,F){F=F.slice();let B=!1,E=[".js",".ts",".tsx",".mjs",".cjs"];function $(W,q){let G=GD.resolve(W,q);if(O0.existsSync(G))return G;if(E.includes(GD.extname(q)))return;let R=E.find((A)=>O0.existsSync(`${G}${A}`));if(R)return`${G}${R}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let X=D._executableFile||`${this._name}-${D._name}`,J=this._executableDir||"";if(this._scriptPath){let W;try{W=O0.realpathSync(this._scriptPath)}catch(q){W=this._scriptPath}J=GD.resolve(GD.dirname(W),J)}if(J){let W=$(J,X);if(!W&&!D._executableFile&&this._scriptPath){let q=GD.basename(this._scriptPath,GD.extname(this._scriptPath));if(q!==this._name)W=$(J,`${q}-${D._name}`)}X=W||X}B=E.includes(GD.extname(X));let Q;if(y.platform!=="win32")if(B)F.unshift(X),F=P3(y.execArgv).concat(F),Q=L0.spawn(y.argv[0],F,{stdio:"inherit"});else Q=L0.spawn(X,F,{stdio:"inherit"});else F.unshift(X),F=P3(y.execArgv).concat(F),Q=L0.spawn(y.execPath,F,{stdio:"inherit"});if(!Q.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((q)=>{y.on(q,()=>{if(Q.killed===!1&&Q.exitCode===null)Q.kill(q)})});let Y=this._exitCallback;Q.on("close",(W)=>{if(W=W??1,!Y)y.exit(W);else Y(new w0(W,"commander.executeSubCommandAsync","(close)"))}),Q.on("error",(W)=>{if(W.code==="ENOENT"){let q=J?`searched for local subcommand relative to directory '${J}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",G=`'${X}' does not exist
16
+ - if '${D._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
17
+ - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
18
+ - ${q}`;throw Error(G)}else if(W.code==="EACCES")throw Error(`'${X}' not executable`);if(!Y)y.exit(1);else{let q=new w0(1,"commander.executeSubCommandAsync","(error)");q.nestedError=W,Y(q)}}),this.runningCommand=Q}_dispatchSubcommand(D,F,B){let E=this._findCommand(D);if(!E)this.help({error:!0});let $;return $=this._chainOrCallSubCommandHook($,E,"preSubcommand"),$=this._chainOrCall($,()=>{if(E._executableHandler)this._executeSubCommand(E,F.concat(B));else return E._parseCommand(F,B)}),$}_dispatchHelpCommand(D){if(!D)this.help();let F=this._findCommand(D);if(F&&!F._executableHandler)F.help();return this._dispatchSubcommand(D,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((D,F)=>{if(D.required&&this.args[F]==null)this.missingArgument(D.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let D=(B,E,$)=>{let X=E;if(E!==null&&B.parseArg){let J=`error: command-argument value '${E}' is invalid for argument '${B.name()}'.`;X=this._callParseArg(B,E,$,J)}return X};this._checkNumberOfArguments();let F=[];this.registeredArguments.forEach((B,E)=>{let $=B.defaultValue;if(B.variadic){if(E<this.args.length){if($=this.args.slice(E),B.parseArg)$=$.reduce((X,J)=>{return D(B,J,X)},B.defaultValue)}else if($===void 0)$=[]}else if(E<this.args.length){if($=this.args[E],B.parseArg)$=D(B,$,B.defaultValue)}F[E]=$}),this.processedArgs=F}_chainOrCall(D,F){if(D&&D.then&&typeof D.then==="function")return D.then(()=>F());return F()}_chainOrCallHooks(D,F){let B=D,E=[];if(this._getCommandAndAncestors().reverse().filter(($)=>$._lifeCycleHooks[F]!==void 0).forEach(($)=>{$._lifeCycleHooks[F].forEach((X)=>{E.push({hookedCommand:$,callback:X})})}),F==="postAction")E.reverse();return E.forEach(($)=>{B=this._chainOrCall(B,()=>{return $.callback($.hookedCommand,this)})}),B}_chainOrCallSubCommandHook(D,F,B){let E=D;if(this._lifeCycleHooks[B]!==void 0)this._lifeCycleHooks[B].forEach(($)=>{E=this._chainOrCall(E,()=>{return $(this,F)})});return E}_parseCommand(D,F){let B=this.parseOptions(F);if(this._parseOptionsEnv(),this._parseOptionsImplied(),D=D.concat(B.operands),F=B.unknown,this.args=D.concat(F),D&&this._findCommand(D[0]))return this._dispatchSubcommand(D[0],D.slice(1),F);if(this._getHelpCommand()&&D[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(D[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(F),this._dispatchSubcommand(this._defaultCommandName,D,F);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(B.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let E=()=>{if(B.unknown.length>0)this.unknownOption(B.unknown[0])},$=`command:${this.name()}`;if(this._actionHandler){E(),this._processArguments();let X;if(X=this._chainOrCallHooks(X,"preAction"),X=this._chainOrCall(X,()=>this._actionHandler(this.processedArgs)),this.parent)X=this._chainOrCall(X,()=>{this.parent.emit($,D,F)});return X=this._chainOrCallHooks(X,"postAction"),X}if(this.parent&&this.parent.listenerCount($))E(),this._processArguments(),this.parent.emit($,D,F);else if(D.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",D,F);if(this.listenerCount("command:*"))this.emit("command:*",D,F);else if(this.commands.length)this.unknownCommand();else E(),this._processArguments()}else if(this.commands.length)E(),this.help({error:!0});else E(),this._processArguments()}_findCommand(D){if(!D)return;return this.commands.find((F)=>F._name===D||F._aliases.includes(D))}_findOption(D){return this.options.find((F)=>F.is(D))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((D)=>{D.options.forEach((F)=>{if(F.mandatory&&D.getOptionValue(F.attributeName())===void 0)D.missingMandatoryOptionValue(F)})})}_checkForConflictingLocalOptions(){let D=this.options.filter((B)=>{let E=B.attributeName();if(this.getOptionValue(E)===void 0)return!1;return this.getOptionValueSource(E)!=="default"});D.filter((B)=>B.conflictsWith.length>0).forEach((B)=>{let E=D.find(($)=>B.conflictsWith.includes($.attributeName()));if(E)this._conflictingOption(B,E)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((D)=>{D._checkForConflictingLocalOptions()})}parseOptions(D){let F=[],B=[],E=F,$=D.slice();function X(Q){return Q.length>1&&Q[0]==="-"}let J=null;while($.length){let Q=$.shift();if(Q==="--"){if(E===B)E.push(Q);E.push(...$);break}if(J&&!X(Q)){this.emit(`option:${J.name()}`,Q);continue}if(J=null,X(Q)){let Y=this._findOption(Q);if(Y){if(Y.required){let W=$.shift();if(W===void 0)this.optionMissingArgument(Y);this.emit(`option:${Y.name()}`,W)}else if(Y.optional){let W=null;if($.length>0&&!X($[0]))W=$.shift();this.emit(`option:${Y.name()}`,W)}else this.emit(`option:${Y.name()}`);J=Y.variadic?Y:null;continue}}if(Q.length>2&&Q[0]==="-"&&Q[1]!=="-"){let Y=this._findOption(`-${Q[1]}`);if(Y){if(Y.required||Y.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${Y.name()}`,Q.slice(2));else this.emit(`option:${Y.name()}`),$.unshift(`-${Q.slice(2)}`);continue}}if(/^--[^=]+=/.test(Q)){let Y=Q.indexOf("="),W=this._findOption(Q.slice(0,Y));if(W&&(W.required||W.optional)){this.emit(`option:${W.name()}`,Q.slice(Y+1));continue}}if(X(Q))E=B;if((this._enablePositionalOptions||this._passThroughOptions)&&F.length===0&&B.length===0){if(this._findCommand(Q)){if(F.push(Q),$.length>0)B.push(...$);break}else if(this._getHelpCommand()&&Q===this._getHelpCommand().name()){if(F.push(Q),$.length>0)F.push(...$);break}else if(this._defaultCommandName){if(B.push(Q),$.length>0)B.push(...$);break}}if(this._passThroughOptions){if(E.push(Q),$.length>0)E.push(...$);break}E.push(Q)}return{operands:F,unknown:B}}opts(){if(this._storeOptionsAsProperties){let D={},F=this.options.length;for(let B=0;B<F;B++){let E=this.options[B].attributeName();D[E]=E===this._versionOptionName?this._version:this[E]}return D}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((D,F)=>Object.assign(D,F.opts()),{})}error(D,F){if(this._outputConfiguration.outputError(`${D}
19
+ `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
20
+ `);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
21
+ `),this.outputHelp({error:!0});let B=F||{},E=B.exitCode||1,$=B.code||"commander.error";this._exit(E,$,D)}_parseOptionsEnv(){this.options.forEach((D)=>{if(D.envVar&&D.envVar in y.env){let F=D.attributeName();if(this.getOptionValue(F)===void 0||["default","config","env"].includes(this.getOptionValueSource(F)))if(D.required||D.optional)this.emit(`optionEnv:${D.name()}`,y.env[D.envVar]);else this.emit(`optionEnv:${D.name()}`)}})}_parseOptionsImplied(){let D=new GF(this.options),F=(B)=>{return this.getOptionValue(B)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(B))};this.options.filter((B)=>B.implied!==void 0&&F(B.attributeName())&&D.valueFromOption(this.getOptionValue(B.attributeName()),B)).forEach((B)=>{Object.keys(B.implied).filter((E)=>!F(E)).forEach((E)=>{this.setOptionValueWithSource(E,B.implied[E],"implied")})})}missingArgument(D){let F=`error: missing required argument '${D}'`;this.error(F,{code:"commander.missingArgument"})}optionMissingArgument(D){let F=`error: option '${D.flags}' argument missing`;this.error(F,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(D){let F=`error: required option '${D.flags}' not specified`;this.error(F,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(D,F){let B=(X)=>{let J=X.attributeName(),Q=this.getOptionValue(J),Y=this.options.find((q)=>q.negate&&J===q.attributeName()),W=this.options.find((q)=>!q.negate&&J===q.attributeName());if(Y&&(Y.presetArg===void 0&&Q===!1||Y.presetArg!==void 0&&Q===Y.presetArg))return Y;return W||X},E=(X)=>{let J=B(X),Q=J.attributeName();if(this.getOptionValueSource(Q)==="env")return`environment variable '${J.envVar}'`;return`option '${J.flags}'`},$=`error: ${E(D)} cannot be used with ${E(F)}`;this.error($,{code:"commander.conflictingOption"})}unknownOption(D){if(this._allowUnknownOption)return;let F="";if(D.startsWith("--")&&this._showSuggestionAfterError){let E=[],$=this;do{let X=$.createHelp().visibleOptions($).filter((J)=>J.long).map((J)=>J.long);E=E.concat(X),$=$.parent}while($&&!$._enablePositionalOptions);F=b3(D,E)}let B=`error: unknown option '${D}'${F}`;this.error(B,{code:"commander.unknownOption"})}_excessArguments(D){if(this._allowExcessArguments)return;let F=this.registeredArguments.length,B=F===1?"":"s",$=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${F} argument${B} but got ${D.length}.`;this.error($,{code:"commander.excessArguments"})}unknownCommand(){let D=this.args[0],F="";if(this._showSuggestionAfterError){let E=[];this.createHelp().visibleCommands(this).forEach(($)=>{if(E.push($.name()),$.alias())E.push($.alias())}),F=b3(D,E)}let B=`error: unknown command '${D}'${F}`;this.error(B,{code:"commander.unknownCommand"})}version(D,F,B){if(D===void 0)return this._version;this._version=D,F=F||"-V, --version",B=B||"output the version number";let E=this.createOption(F,B);return this._versionOptionName=E.attributeName(),this._registerOption(E),this.on("option:"+E.name(),()=>{this._outputConfiguration.writeOut(`${D}
22
+ `),this._exit(0,"commander.version",D)}),this}description(D,F){if(D===void 0&&F===void 0)return this._description;if(this._description=D,F)this._argsDescription=F;return this}summary(D){if(D===void 0)return this._summary;return this._summary=D,this}alias(D){if(D===void 0)return this._aliases[0];let F=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)F=this.commands[this.commands.length-1];if(D===F._name)throw Error("Command alias can't be the same as its name");let B=this.parent?._findCommand(D);if(B){let E=[B.name()].concat(B.aliases()).join("|");throw Error(`cannot add alias '${D}' to command '${this.name()}' as already have command '${E}'`)}return F._aliases.push(D),this}aliases(D){if(D===void 0)return this._aliases;return D.forEach((F)=>this.alias(F)),this}usage(D){if(D===void 0){if(this._usage)return this._usage;let F=this.registeredArguments.map((B)=>{return _F(B)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?F:[]).join(" ")}return this._usage=D,this}name(D){if(D===void 0)return this._name;return this._name=D,this}nameFromFilename(D){return this._name=GD.basename(D,GD.extname(D)),this}executableDir(D){if(D===void 0)return this._executableDir;return this._executableDir=D,this}helpInformation(D){let F=this.createHelp();if(F.helpWidth===void 0)F.helpWidth=D&&D.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth();return F.formatHelp(this,F)}_getHelpContext(D){D=D||{};let F={error:!!D.error},B;if(F.error)B=(E)=>this._outputConfiguration.writeErr(E);else B=(E)=>this._outputConfiguration.writeOut(E);return F.write=D.write||B,F.command=this,F}outputHelp(D){let F;if(typeof D==="function")F=D,D=void 0;let B=this._getHelpContext(D);this._getCommandAndAncestors().reverse().forEach(($)=>$.emit("beforeAllHelp",B)),this.emit("beforeHelp",B);let E=this.helpInformation(B);if(F){if(E=F(E),typeof E!=="string"&&!Buffer.isBuffer(E))throw Error("outputHelp callback must return a string or a Buffer")}if(B.write(E),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",B),this._getCommandAndAncestors().forEach(($)=>$.emit("afterAllHelp",B))}helpOption(D,F){if(typeof D==="boolean"){if(D)this._helpOption=this._helpOption??void 0;else this._helpOption=null;return this}return D=D??"-h, --help",F=F??"display help for command",this._helpOption=this.createOption(D,F),this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(D){return this._helpOption=D,this}help(D){this.outputHelp(D);let F=y.exitCode||0;if(F===0&&D&&typeof D!=="function"&&D.error)F=1;this._exit(F,"commander.help","(outputHelp)")}addHelpText(D,F){let B=["beforeAll","before","after","afterAll"];if(!B.includes(D))throw Error(`Unexpected value for position to addHelpText.
23
+ Expecting one of '${B.join("', '")}'`);let E=`${D}Help`;return this.on(E,($)=>{let X;if(typeof F==="function")X=F({error:$.error,command:$.command});else X=F;if(X)$.write(`${X}
24
+ `)}),this}_outputHelpIfRequested(D){let F=this._getHelpOption();if(F&&D.find((E)=>F.is(E)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function P3(D){return D.map((F)=>{if(!F.startsWith("--inspect"))return F;let B,E="127.0.0.1",$="9229",X;if((X=F.match(/^(--inspect(-brk)?)$/))!==null)B=X[1];else if((X=F.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(B=X[1],/^\d+$/.test(X[3]))$=X[3];else E=X[3];else if((X=F.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)B=X[1],E=X[3],$=X[4];if(B&&$!=="0")return`${B}=${E}:${parseInt($)+1}`;return F})}MF.Command=S0});var x3=h((UF)=>{var{Argument:v3}=l2(),{Command:u0}=k3(),{CommanderError:zF,InvalidArgumentError:Z3}=j2(),{Help:CF}=K0(),{Option:f3}=N0();UF.program=new u0;UF.createCommand=(D)=>new u0(D);UF.createOption=(D,F)=>new f3(D,F);UF.createArgument=(D,F)=>new v3(D,F);UF.Command=u0;UF.Option=f3;UF.Argument=v3;UF.Help=CF;UF.CommanderError=zF;UF.InvalidArgumentError=Z3;UF.InvalidOptionArgumentError=Z3});var V2=h((G9,p3)=>{var vF=QD("tty"),ZF=vF?.WriteStream?.prototype?.hasColors?.()??!1,O=(D,F)=>{if(!ZF)return($)=>$;let B=`\x1B[${D}m`,E=`\x1B[${F}m`;return($)=>{let X=$+"",J=X.indexOf(E);if(J===-1)return B+X+E;let Q=B,Y=0,q=(F===22?E:"")+B;while(J!==-1)Q+=X.slice(Y,J)+q,Y=J+E.length,J=X.indexOf(E,Y);return Q+=X.slice(Y)+E,Q}},N={};N.reset=O(0,0);N.bold=O(1,22);N.dim=O(2,22);N.italic=O(3,23);N.underline=O(4,24);N.overline=O(53,55);N.inverse=O(7,27);N.hidden=O(8,28);N.strikethrough=O(9,29);N.black=O(30,39);N.red=O(31,39);N.green=O(32,39);N.yellow=O(33,39);N.blue=O(34,39);N.magenta=O(35,39);N.cyan=O(36,39);N.white=O(37,39);N.gray=O(90,39);N.bgBlack=O(40,49);N.bgRed=O(41,49);N.bgGreen=O(42,49);N.bgYellow=O(43,49);N.bgBlue=O(44,49);N.bgMagenta=O(45,49);N.bgCyan=O(46,49);N.bgWhite=O(47,49);N.bgGray=O(100,49);N.redBright=O(91,39);N.greenBright=O(92,39);N.yellowBright=O(93,39);N.blueBright=O(94,39);N.magentaBright=O(95,39);N.cyanBright=O(96,39);N.whiteBright=O(97,39);N.bgRedBright=O(101,49);N.bgGreenBright=O(102,49);N.bgYellowBright=O(103,49);N.bgBlueBright=O(104,49);N.bgMagentaBright=O(105,49);N.bgCyanBright=O(106,49);N.bgWhiteBright=O(107,49);p3.exports=N});var o3=h((k9,r3)=>{r3.exports=pF;function lF(D){let F={defaultWidth:0,output:process.stdout,tty:QD("tty")};if(!D)return F;return Object.keys(F).forEach(function(B){if(!D[B])D[B]=F[B]}),D}function pF(D){let F=lF(D);if(F.output.getWindowSize)return F.output.getWindowSize()[0]||F.defaultWidth;if(F.tty.getWindowSize)return F.tty.getWindowSize()[1]||F.defaultWidth;if(F.output.columns)return F.output.columns;if(process.env.CLI_WIDTH){let B=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(B)&&B!==0)return B}return F.defaultWidth}});var t3=h((v9,s3)=>{s3.exports=({onlyFirst:D=!1}={})=>{let F=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(F,D?void 0:"g")}});var x0=h((Z9,e3)=>{var dF=t3();e3.exports=(D)=>typeof D==="string"?D.replace(dF(),""):D});var F8=h((f9,y0)=>{var D8=(D)=>{if(Number.isNaN(D))return!1;if(D>=4352&&(D<=4447||D===9001||D===9002||11904<=D&&D<=12871&&D!==12351||12880<=D&&D<=19903||19968<=D&&D<=42182||43360<=D&&D<=43388||44032<=D&&D<=55203||63744<=D&&D<=64255||65040<=D&&D<=65049||65072<=D&&D<=65131||65281<=D&&D<=65376||65504<=D&&D<=65510||110592<=D&&D<=110593||127488<=D&&D<=127569||131072<=D&&D<=262141))return!0;return!1};y0.exports=D8;y0.exports.default=D8});var E8=h((x9,B8)=>{B8.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\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\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])|\uD83C[\uDF3E\uDF73\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])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\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])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\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\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\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\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\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\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*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\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\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\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[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var X8=h((y9,h0)=>{var cF=x0(),nF=F8(),iF=E8(),$8=(D)=>{if(typeof D!=="string"||D.length===0)return 0;if(D=cF(D),D.length===0)return 0;D=D.replace(iF()," ");let F=0;for(let B=0;B<D.length;B++){let E=D.codePointAt(B);if(E<=31||E>=127&&E<=159)continue;if(E>=768&&E<=879)continue;if(E>65535)B++;F+=nF(E)?2:1}return F};h0.exports=$8;h0.exports.default=$8});var Q8=h((h9,J8)=>{J8.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var g0=h((g9,W8)=>{var N2=Q8(),Y8={};for(let D of Object.keys(N2))Y8[N2[D]]=D;var z={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};W8.exports=z;for(let D of Object.keys(z)){if(!("channels"in z[D]))throw Error("missing channels property: "+D);if(!("labels"in z[D]))throw Error("missing channel labels property: "+D);if(z[D].labels.length!==z[D].channels)throw Error("channel and label counts mismatch: "+D);let{channels:F,labels:B}=z[D];delete z[D].channels,delete z[D].labels,Object.defineProperty(z[D],"channels",{value:F}),Object.defineProperty(z[D],"labels",{value:B})}z.rgb.hsl=function(D){let F=D[0]/255,B=D[1]/255,E=D[2]/255,$=Math.min(F,B,E),X=Math.max(F,B,E),J=X-$,Q,Y;if(X===$)Q=0;else if(F===X)Q=(B-E)/J;else if(B===X)Q=2+(E-F)/J;else if(E===X)Q=4+(F-B)/J;if(Q=Math.min(Q*60,360),Q<0)Q+=360;let W=($+X)/2;if(X===$)Y=0;else if(W<=0.5)Y=J/(X+$);else Y=J/(2-X-$);return[Q,Y*100,W*100]};z.rgb.hsv=function(D){let F,B,E,$,X,J=D[0]/255,Q=D[1]/255,Y=D[2]/255,W=Math.max(J,Q,Y),q=W-Math.min(J,Q,Y),G=function(R){return(W-R)/6/q+0.5};if(q===0)$=0,X=0;else{if(X=q/W,F=G(J),B=G(Q),E=G(Y),J===W)$=E-B;else if(Q===W)$=0.3333333333333333+F-E;else if(Y===W)$=0.6666666666666666+B-F;if($<0)$+=1;else if($>1)$-=1}return[$*360,X*100,W*100]};z.rgb.hwb=function(D){let F=D[0],B=D[1],E=D[2],$=z.rgb.hsl(D)[0],X=0.00392156862745098*Math.min(F,Math.min(B,E));return E=1-0.00392156862745098*Math.max(F,Math.max(B,E)),[$,X*100,E*100]};z.rgb.cmyk=function(D){let F=D[0]/255,B=D[1]/255,E=D[2]/255,$=Math.min(1-F,1-B,1-E),X=(1-F-$)/(1-$)||0,J=(1-B-$)/(1-$)||0,Q=(1-E-$)/(1-$)||0;return[X*100,J*100,Q*100,$*100]};function aF(D,F){return(D[0]-F[0])**2+(D[1]-F[1])**2+(D[2]-F[2])**2}z.rgb.keyword=function(D){let F=Y8[D];if(F)return F;let B=1/0,E;for(let $ of Object.keys(N2)){let X=N2[$],J=aF(D,X);if(J<B)B=J,E=$}return E};z.keyword.rgb=function(D){return N2[D]};z.rgb.xyz=function(D){let F=D[0]/255,B=D[1]/255,E=D[2]/255;F=F>0.04045?((F+0.055)/1.055)**2.4:F/12.92,B=B>0.04045?((B+0.055)/1.055)**2.4:B/12.92,E=E>0.04045?((E+0.055)/1.055)**2.4:E/12.92;let $=F*0.4124+B*0.3576+E*0.1805,X=F*0.2126+B*0.7152+E*0.0722,J=F*0.0193+B*0.1192+E*0.9505;return[$*100,X*100,J*100]};z.rgb.lab=function(D){let F=z.rgb.xyz(D),B=F[0],E=F[1],$=F[2];B/=95.047,E/=100,$/=108.883,B=B>0.008856?B**0.3333333333333333:7.787*B+0.13793103448275862,E=E>0.008856?E**0.3333333333333333:7.787*E+0.13793103448275862,$=$>0.008856?$**0.3333333333333333:7.787*$+0.13793103448275862;let X=116*E-16,J=500*(B-E),Q=200*(E-$);return[X,J,Q]};z.hsl.rgb=function(D){let F=D[0]/360,B=D[1]/100,E=D[2]/100,$,X,J;if(B===0)return J=E*255,[J,J,J];if(E<0.5)$=E*(1+B);else $=E+B-E*B;let Q=2*E-$,Y=[0,0,0];for(let W=0;W<3;W++){if(X=F+0.3333333333333333*-(W-1),X<0)X++;if(X>1)X--;if(6*X<1)J=Q+($-Q)*6*X;else if(2*X<1)J=$;else if(3*X<2)J=Q+($-Q)*(0.6666666666666666-X)*6;else J=Q;Y[W]=J*255}return Y};z.hsl.hsv=function(D){let F=D[0],B=D[1]/100,E=D[2]/100,$=B,X=Math.max(E,0.01);E*=2,B*=E<=1?E:2-E,$*=X<=1?X:2-X;let J=(E+B)/2,Q=E===0?2*$/(X+$):2*B/(E+B);return[F,Q*100,J*100]};z.hsv.rgb=function(D){let F=D[0]/60,B=D[1]/100,E=D[2]/100,$=Math.floor(F)%6,X=F-Math.floor(F),J=255*E*(1-B),Q=255*E*(1-B*X),Y=255*E*(1-B*(1-X));switch(E*=255,$){case 0:return[E,Y,J];case 1:return[Q,E,J];case 2:return[J,E,Y];case 3:return[J,Q,E];case 4:return[Y,J,E];case 5:return[E,J,Q]}};z.hsv.hsl=function(D){let F=D[0],B=D[1]/100,E=D[2]/100,$=Math.max(E,0.01),X,J;J=(2-B)*E;let Q=(2-B)*$;return X=B*$,X/=Q<=1?Q:2-Q,X=X||0,J/=2,[F,X*100,J*100]};z.hwb.rgb=function(D){let F=D[0]/360,B=D[1]/100,E=D[2]/100,$=B+E,X;if($>1)B/=$,E/=$;let J=Math.floor(6*F),Q=1-E;if(X=6*F-J,(J&1)!==0)X=1-X;let Y=B+X*(Q-B),W,q,G;switch(J){default:case 6:case 0:W=Q,q=Y,G=B;break;case 1:W=Y,q=Q,G=B;break;case 2:W=B,q=Q,G=Y;break;case 3:W=B,q=Y,G=Q;break;case 4:W=Y,q=B,G=Q;break;case 5:W=Q,q=B,G=Y;break}return[W*255,q*255,G*255]};z.cmyk.rgb=function(D){let F=D[0]/100,B=D[1]/100,E=D[2]/100,$=D[3]/100,X=1-Math.min(1,F*(1-$)+$),J=1-Math.min(1,B*(1-$)+$),Q=1-Math.min(1,E*(1-$)+$);return[X*255,J*255,Q*255]};z.xyz.rgb=function(D){let F=D[0]/100,B=D[1]/100,E=D[2]/100,$,X,J;return $=F*3.2406+B*-1.5372+E*-0.4986,X=F*-0.9689+B*1.8758+E*0.0415,J=F*0.0557+B*-0.204+E*1.057,$=$>0.0031308?1.055*$**0.4166666666666667-0.055:$*12.92,X=X>0.0031308?1.055*X**0.4166666666666667-0.055:X*12.92,J=J>0.0031308?1.055*J**0.4166666666666667-0.055:J*12.92,$=Math.min(Math.max(0,$),1),X=Math.min(Math.max(0,X),1),J=Math.min(Math.max(0,J),1),[$*255,X*255,J*255]};z.xyz.lab=function(D){let F=D[0],B=D[1],E=D[2];F/=95.047,B/=100,E/=108.883,F=F>0.008856?F**0.3333333333333333:7.787*F+0.13793103448275862,B=B>0.008856?B**0.3333333333333333:7.787*B+0.13793103448275862,E=E>0.008856?E**0.3333333333333333:7.787*E+0.13793103448275862;let $=116*B-16,X=500*(F-B),J=200*(B-E);return[$,X,J]};z.lab.xyz=function(D){let F=D[0],B=D[1],E=D[2],$,X,J;X=(F+16)/116,$=B/500+X,J=X-E/200;let Q=X**3,Y=$**3,W=J**3;return X=Q>0.008856?Q:(X-0.13793103448275862)/7.787,$=Y>0.008856?Y:($-0.13793103448275862)/7.787,J=W>0.008856?W:(J-0.13793103448275862)/7.787,$*=95.047,X*=100,J*=108.883,[$,X,J]};z.lab.lch=function(D){let F=D[0],B=D[1],E=D[2],$;if($=Math.atan2(E,B)*360/2/Math.PI,$<0)$+=360;let J=Math.sqrt(B*B+E*E);return[F,J,$]};z.lch.lab=function(D){let F=D[0],B=D[1],$=D[2]/360*2*Math.PI,X=B*Math.cos($),J=B*Math.sin($);return[F,X,J]};z.rgb.ansi16=function(D,F=null){let[B,E,$]=D,X=F===null?z.rgb.hsv(D)[2]:F;if(X=Math.round(X/50),X===0)return 30;let J=30+(Math.round($/255)<<2|Math.round(E/255)<<1|Math.round(B/255));if(X===2)J+=60;return J};z.hsv.ansi16=function(D){return z.rgb.ansi16(z.hsv.rgb(D),D[2])};z.rgb.ansi256=function(D){let F=D[0],B=D[1],E=D[2];if(F===B&&B===E){if(F<8)return 16;if(F>248)return 231;return Math.round((F-8)/247*24)+232}return 16+36*Math.round(F/255*5)+6*Math.round(B/255*5)+Math.round(E/255*5)};z.ansi16.rgb=function(D){let F=D%10;if(F===0||F===7){if(D>50)F+=3.5;return F=F/10.5*255,[F,F,F]}let B=(~~(D>50)+1)*0.5,E=(F&1)*B*255,$=(F>>1&1)*B*255,X=(F>>2&1)*B*255;return[E,$,X]};z.ansi256.rgb=function(D){if(D>=232){let X=(D-232)*10+8;return[X,X,X]}D-=16;let F,B=Math.floor(D/36)/5*255,E=Math.floor((F=D%36)/6)/5*255,$=F%6/5*255;return[B,E,$]};z.rgb.hex=function(D){let B=(((Math.round(D[0])&255)<<16)+((Math.round(D[1])&255)<<8)+(Math.round(D[2])&255)).toString(16).toUpperCase();return"000000".substring(B.length)+B};z.hex.rgb=function(D){let F=D.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!F)return[0,0,0];let B=F[0];if(F[0].length===3)B=B.split("").map((Q)=>{return Q+Q}).join("");let E=parseInt(B,16),$=E>>16&255,X=E>>8&255,J=E&255;return[$,X,J]};z.rgb.hcg=function(D){let F=D[0]/255,B=D[1]/255,E=D[2]/255,$=Math.max(Math.max(F,B),E),X=Math.min(Math.min(F,B),E),J=$-X,Q,Y;if(J<1)Q=X/(1-J);else Q=0;if(J<=0)Y=0;else if($===F)Y=(B-E)/J%6;else if($===B)Y=2+(E-F)/J;else Y=4+(F-B)/J;return Y/=6,Y%=1,[Y*360,J*100,Q*100]};z.hsl.hcg=function(D){let F=D[1]/100,B=D[2]/100,E=B<0.5?2*F*B:2*F*(1-B),$=0;if(E<1)$=(B-0.5*E)/(1-E);return[D[0],E*100,$*100]};z.hsv.hcg=function(D){let F=D[1]/100,B=D[2]/100,E=F*B,$=0;if(E<1)$=(B-E)/(1-E);return[D[0],E*100,$*100]};z.hcg.rgb=function(D){let F=D[0]/360,B=D[1]/100,E=D[2]/100;if(B===0)return[E*255,E*255,E*255];let $=[0,0,0],X=F%1*6,J=X%1,Q=1-J,Y=0;switch(Math.floor(X)){case 0:$[0]=1,$[1]=J,$[2]=0;break;case 1:$[0]=Q,$[1]=1,$[2]=0;break;case 2:$[0]=0,$[1]=1,$[2]=J;break;case 3:$[0]=0,$[1]=Q,$[2]=1;break;case 4:$[0]=J,$[1]=0,$[2]=1;break;default:$[0]=1,$[1]=0,$[2]=Q}return Y=(1-B)*E,[(B*$[0]+Y)*255,(B*$[1]+Y)*255,(B*$[2]+Y)*255]};z.hcg.hsv=function(D){let F=D[1]/100,B=D[2]/100,E=F+B*(1-F),$=0;if(E>0)$=F/E;return[D[0],$*100,E*100]};z.hcg.hsl=function(D){let F=D[1]/100,E=D[2]/100*(1-F)+0.5*F,$=0;if(E>0&&E<0.5)$=F/(2*E);else if(E>=0.5&&E<1)$=F/(2*(1-E));return[D[0],$*100,E*100]};z.hcg.hwb=function(D){let F=D[1]/100,B=D[2]/100,E=F+B*(1-F);return[D[0],(E-F)*100,(1-E)*100]};z.hwb.hcg=function(D){let F=D[1]/100,E=1-D[2]/100,$=E-F,X=0;if($<1)X=(E-$)/(1-$);return[D[0],$*100,X*100]};z.apple.rgb=function(D){return[D[0]/65535*255,D[1]/65535*255,D[2]/65535*255]};z.rgb.apple=function(D){return[D[0]/255*65535,D[1]/255*65535,D[2]/255*65535]};z.gray.rgb=function(D){return[D[0]/100*255,D[0]/100*255,D[0]/100*255]};z.gray.hsl=function(D){return[0,0,D[0]]};z.gray.hsv=z.gray.hsl;z.gray.hwb=function(D){return[0,100,D[0]]};z.gray.cmyk=function(D){return[0,0,0,D[0]]};z.gray.lab=function(D){return[D[0],0,0]};z.gray.hex=function(D){let F=Math.round(D[0]/100*255)&255,E=((F<<16)+(F<<8)+F).toString(16).toUpperCase();return"000000".substring(E.length)+E};z.rgb.gray=function(D){return[(D[0]+D[1]+D[2])/3/255*100]}});var _8=h((m9,q8)=>{var c2=g0();function rF(){let D={},F=Object.keys(c2);for(let B=F.length,E=0;E<B;E++)D[F[E]]={distance:-1,parent:null};return D}function oF(D){let F=rF(),B=[D];F[D].distance=0;while(B.length){let E=B.pop(),$=Object.keys(c2[E]);for(let X=$.length,J=0;J<X;J++){let Q=$[J],Y=F[Q];if(Y.distance===-1)Y.distance=F[E].distance+1,Y.parent=E,B.unshift(Q)}}return F}function sF(D,F){return function(B){return F(D(B))}}function tF(D,F){let B=[F[D].parent,D],E=c2[F[D].parent][D],$=F[D].parent;while(F[$].parent)B.unshift(F[$].parent),E=sF(c2[F[$].parent][$],E),$=F[$].parent;return E.conversion=B,E}q8.exports=function(D){let F=oF(D),B={},E=Object.keys(F);for(let $=E.length,X=0;X<$;X++){let J=E[X];if(F[J].parent===null)continue;B[J]=tF(J,F)}return B}});var G8=h((l9,H8)=>{var m0=g0(),eF=_8(),tD={},D1=Object.keys(m0);function F1(D){let F=function(...B){let E=B[0];if(E===void 0||E===null)return E;if(E.length>1)B=E;return D(B)};if("conversion"in D)F.conversion=D.conversion;return F}function B1(D){let F=function(...B){let E=B[0];if(E===void 0||E===null)return E;if(E.length>1)B=E;let $=D(B);if(typeof $==="object")for(let X=$.length,J=0;J<X;J++)$[J]=Math.round($[J]);return $};if("conversion"in D)F.conversion=D.conversion;return F}D1.forEach((D)=>{tD[D]={},Object.defineProperty(tD[D],"channels",{value:m0[D].channels}),Object.defineProperty(tD[D],"labels",{value:m0[D].labels});let F=eF(D);Object.keys(F).forEach((E)=>{let $=F[E];tD[D][E]=B1($),tD[D][E].raw=F1($)})});H8.exports=tD});var j8=h((p9,U8)=>{var M8=(D,F)=>(...B)=>{return`\x1B[${D(...B)+F}m`},A8=(D,F)=>(...B)=>{let E=D(...B);return`\x1B[${38+F};5;${E}m`},z8=(D,F)=>(...B)=>{let E=D(...B);return`\x1B[${38+F};2;${E[0]};${E[1]};${E[2]}m`},n2=(D)=>D,C8=(D,F,B)=>[D,F,B],eD=(D,F,B)=>{Object.defineProperty(D,F,{get:()=>{let E=B();return Object.defineProperty(D,F,{value:E,enumerable:!0,configurable:!0}),E},enumerable:!0,configurable:!0})},l0,D2=(D,F,B,E)=>{if(l0===void 0)l0=G8();let $=E?10:0,X={};for(let[J,Q]of Object.entries(l0)){let Y=J==="ansi16"?"ansi":J;if(J===F)X[Y]=D(B,$);else if(typeof Q==="object")X[Y]=D(Q[F],$)}return X};function E1(){let D=new Map,F={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],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],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],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};F.color.gray=F.color.blackBright,F.bgColor.bgGray=F.bgColor.bgBlackBright,F.color.grey=F.color.blackBright,F.bgColor.bgGrey=F.bgColor.bgBlackBright;for(let[B,E]of Object.entries(F)){for(let[$,X]of Object.entries(E))F[$]={open:`\x1B[${X[0]}m`,close:`\x1B[${X[1]}m`},E[$]=F[$],D.set(X[0],X[1]);Object.defineProperty(F,B,{value:E,enumerable:!1})}return Object.defineProperty(F,"codes",{value:D,enumerable:!1}),F.color.close="\x1B[39m",F.bgColor.close="\x1B[49m",eD(F.color,"ansi",()=>D2(M8,"ansi16",n2,!1)),eD(F.color,"ansi256",()=>D2(A8,"ansi256",n2,!1)),eD(F.color,"ansi16m",()=>D2(z8,"rgb",C8,!1)),eD(F.bgColor,"ansi",()=>D2(M8,"ansi16",n2,!0)),eD(F.bgColor,"ansi256",()=>D2(A8,"ansi256",n2,!0)),eD(F.bgColor,"ansi16m",()=>D2(z8,"rgb",C8,!0)),F}Object.defineProperty(U8,"exports",{enumerable:!0,get:E1})});var K8=h((d9,V8)=>{var L2=X8(),$1=x0(),X1=j8(),d0=new Set(["\x1B","\x9B"]),R8=(D)=>`${d0.values().next().value}[${D}m`,J1=(D)=>D.split(" ").map((F)=>L2(F)),p0=(D,F,B)=>{let E=[...F],$=!1,X=L2($1(D[D.length-1]));for(let[J,Q]of E.entries()){let Y=L2(Q);if(X+Y<=B)D[D.length-1]+=Q;else D.push(Q),X=0;if(d0.has(Q))$=!0;else if($&&Q==="m"){$=!1;continue}if($)continue;if(X+=Y,X===B&&J<E.length-1)D.push(""),X=0}if(!X&&D[D.length-1].length>0&&D.length>1)D[D.length-2]+=D.pop()},Q1=(D)=>{let F=D.split(" "),B=F.length;while(B>0){if(L2(F[B-1])>0)break;B--}if(B===F.length)return D;return F.slice(0,B).join(" ")+F.slice(B).join("")},Y1=(D,F,B={})=>{if(B.trim!==!1&&D.trim()==="")return"";let E="",$="",X,J=J1(D),Q=[""];for(let[Y,W]of D.split(" ").entries()){if(B.trim!==!1)Q[Q.length-1]=Q[Q.length-1].trimLeft();let q=L2(Q[Q.length-1]);if(Y!==0){if(q>=F&&(B.wordWrap===!1||B.trim===!1))Q.push(""),q=0;if(q>0||B.trim===!1)Q[Q.length-1]+=" ",q++}if(B.hard&&J[Y]>F){let G=F-q,R=1+Math.floor((J[Y]-G-1)/F);if(Math.floor((J[Y]-1)/F)<R)Q.push("");p0(Q,W,F);continue}if(q+J[Y]>F&&q>0&&J[Y]>0){if(B.wordWrap===!1&&q<F){p0(Q,W,F);continue}Q.push("")}if(q+J[Y]>F&&B.wordWrap===!1){p0(Q,W,F);continue}Q[Q.length-1]+=W}if(B.trim!==!1)Q=Q.map(Q1);E=Q.join(`
25
+ `);for(let[Y,W]of[...E].entries()){if($+=W,d0.has(W)){let G=parseFloat(/\d[^m]*/.exec(E.slice(Y,Y+4)));X=G===39?null:G}let q=X1.codes.get(Number(X));if(X&&q){if(E[Y+1]===`
26
+ `)$+=R8(q);else if(W===`
27
+ `)$+=R8(X)}}return $};V8.exports=(D,F,B)=>{return String(D).normalize().replace(/\r\n/g,`
28
+ `).split(`
29
+ `).map((E)=>Y1(E,F,B)).join(`
30
+ `)}});var S8=h((o9,w8)=>{var q1=QD("stream");class O8 extends q1{#B=null;constructor(D={}){super(D);this.writable=this.readable=!0,this.muted=!1,this.on("pipe",this._onpipe),this.replace=D.replace,this._prompt=D.prompt||null,this._hadControl=!1}#F(D,F){if(this._dest)return this._dest[D];if(this._src)return this._src[D];return F}#D(D,...F){if(typeof this._dest?.[D]==="function")this._dest[D](...F);if(typeof this._src?.[D]==="function")this._src[D](...F)}get isTTY(){if(this.#B!==null)return this.#B;return this.#F("isTTY",!1)}set isTTY(D){this.#B=D}get rows(){return this.#F("rows")}get columns(){return this.#F("columns")}mute(){this.muted=!0}unmute(){this.muted=!1}_onpipe(D){this._src=D}pipe(D,F){return this._dest=D,super.pipe(D,F)}pause(){if(this._src)return this._src.pause()}resume(){if(this._src)return this._src.resume()}write(D){if(this.muted){if(!this.replace)return!0;if(D.match(/^\u001b/)){if(D.indexOf(this._prompt)===0)D=D.slice(this._prompt.length),D=D.replace(/./g,this.replace),D=this._prompt+D;return this._hadControl=!0,this.emit("data",D)}else{if(this._prompt&&this._hadControl&&D.indexOf(this._prompt)===0)this._hadControl=!1,this.emit("data",this._prompt),D=D.slice(this._prompt.length);D=D.toString().replace(/./g,this.replace)}}this.emit("data",D)}end(D){if(this.muted)if(D&&this.replace)D=D.toString().replace(/./g,this.replace);else D=null;if(D)this.emit("data",D);this.emit("end")}destroy(...D){return this.#D("destroy",...D)}destroySoon(...D){return this.#D("destroySoon",...D)}close(...D){return this.#D("close",...D)}}w8.exports=O8});var y3=KD(x3(),1),{program:n7,createCommand:i7,createArgument:a7,createOption:r7,CommanderError:o7,InvalidArgumentError:s7,InvalidOptionArgumentError:t7,Command:h3,Argument:e7,Option:D9,Help:F9}=y3.default;var MD=(D,F=[])=>D.name==="up"||F.includes("vim")&&D.name==="k"||F.includes("emacs")&&D.ctrl&&D.name==="p",TD=(D,F=[])=>D.name==="down"||F.includes("vim")&&D.name==="j"||F.includes("emacs")&&D.ctrl&&D.name==="n",I0=(D)=>D.name==="space",T0=(D)=>D.name==="backspace",bD=(D)=>D.name==="tab",b0=(D)=>"1234567890".includes(D.name),o=(D)=>D.name==="enter"||D.name==="return";class P0 extends Error{name="AbortPromptError";message="Prompt was aborted";constructor(D){super();this.cause=D?.cause}}class k0 extends Error{name="CancelPromptError";message="Prompt was canceled"}class p2 extends Error{name="ExitPromptError"}class v0 extends Error{name="HookError"}class R2 extends Error{name="ValidationError"}import{AsyncResource as kF}from"async_hooks";import{AsyncLocalStorage as TF,AsyncResource as bF}from"async_hooks";var g3=new TF;function PF(D){return{rl:D,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function m3(D,F){let B=PF(D);return g3.run(B,()=>{function E($){B.handleChange=()=>{B.index=0,$()},B.handleChange()}return F(E)})}function PD(){let D=g3.getStore();if(!D)throw new v0("[Inquirer] Hook functions can only be called from within a prompt");return D}function Z0(){return PD().rl}function f0(D){let F=(...B)=>{let E=PD(),$=!1,X=E.handleChange;E.handleChange=()=>{$=!0};let J=D(...B);if($)X();return E.handleChange=X,J};return bF.bind(F)}function sD(D){let F=PD(),{index:B}=F,E={get(){return F.hooks[B]},set(X){F.hooks[B]=X},initialized:B in F.hooks},$=D(E);return F.index++,$}function l3(){PD().handleChange()}var kD={queue(D){let F=PD(),{index:B}=F;F.hooksEffect.push(()=>{F.hooksCleanup[B]?.();let E=D(Z0());if(E!=null&&typeof E!=="function")throw new R2("useEffect return value must be a cleanup function or nothing.");F.hooksCleanup[B]=E})},run(){let D=PD();f0(()=>{D.hooksEffect.forEach((F)=>{F()}),D.hooksEffect.length=0})()},clearAll(){let D=PD();D.hooksCleanup.forEach((F)=>{F?.()}),D.hooksEffect.length=0,D.hooksCleanup.length=0}};function Z(D){return sD((F)=>{let B=kF.bind(function(X){if(F.get()!==X)F.set(X),l3()});if(F.initialized)return[F.get(),B];let E=typeof D==="function"?D():D;return F.set(E),[E,B]})}function AD(D,F){sD((B)=>{let E=B.get();if(!Array.isArray(E)||F.some((X,J)=>!Object.is(X,E[J])))kD.queue(D);B.set(F)})}var i=KD(V2(),1);import YD from"process";function fF(){if(YD.platform!=="win32")return YD.env.TERM!=="linux";return Boolean(YD.env.WT_SESSION)||Boolean(YD.env.TERMINUS_SUBLIME)||YD.env.ConEmuTask==="{cmd::Cmder}"||YD.env.TERM_PROGRAM==="Terminus-Sublime"||YD.env.TERM_PROGRAM==="vscode"||YD.env.TERM==="xterm-256color"||YD.env.TERM==="alacritty"||YD.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var d3={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},c3={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},xF={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},yF={...d3,...c3},hF={...d3,...xF},gF=fF(),mF=gF?yF:hF,WD=mF,A9=Object.entries(c3);var n3={prefix:{idle:i.default.blue("?"),done:i.default.green(WD.tick)},spinner:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"].map((D)=>i.default.yellow(D))},style:{answer:i.default.cyan,message:i.default.bold,error:(D)=>i.default.red(`> ${D}`),defaultAnswer:(D)=>i.default.dim(`(${D})`),help:i.default.dim,highlight:i.default.cyan,key:(D)=>i.default.cyan(i.default.bold(`<${D}>`))}};function i3(D){if(typeof D!=="object"||D===null)return!1;let F=D;while(Object.getPrototypeOf(F)!==null)F=Object.getPrototypeOf(F);return Object.getPrototypeOf(D)===F}function a3(...D){let F={};for(let B of D)for(let[E,$]of Object.entries(B)){let X=F[E];F[E]=i3(X)&&i3($)?a3(X,$):$}return F}function n(...D){let F=[n3,...D.filter((B)=>B!=null)];return a3(...F)}function s({status:D="idle",theme:F}){let[B,E]=Z(!1),[$,X]=Z(0),{prefix:J,spinner:Q}=n(F);if(AD(()=>{if(D==="loading"){let W,q=-1,G=setTimeout(()=>{E(!0),W=setInterval(()=>{q=q+1,X(q%Q.frames.length)},Q.interval)},300);return()=>{clearTimeout(G),clearInterval(W)}}else E(!1)},[D]),B)return Q.frames[$];return typeof J==="string"?J:J[D==="loading"?"idle":D]??J.idle}function K2(D,F){return sD((B)=>{let E=B.get();if(!E||E.dependencies.length!==F.length||E.dependencies.some(($,X)=>$!==F[X])){let $=D();return B.set({value:$,dependencies:F}),$}return E.value})}function d2(D){return Z({current:D})[0]}function t(D){let F=d2(D);F.current=D,AD((B)=>{let E=!1,$=f0((X,J)=>{if(E)return;F.current(J,B)});return B.input.on("keypress",$),()=>{E=!0,B.input.removeListener("keypress",$)}},[])}var N8=KD(o3(),1),L8=KD(K8(),1);function O2(D,F){return D.split(`
31
+ `).flatMap((B)=>L8.default(B,F,{trim:!1,hard:!0}).split(`
32
+ `).map((E)=>E.trimEnd())).join(`
33
+ `)}function i2(){return N8.default({defaultWidth:80,output:Z0().output})}function W1({active:D,renderedItems:F,pageSize:B,loop:E}){let $=d2({lastPointer:D,lastActive:void 0}),{lastPointer:X,lastActive:J}=$.current,Q=Math.floor(B/2),Y=F.reduce((G,R)=>G+R.length,0),W=F.slice(0,D).reduce((G,R)=>G+R.length,0),q=W;if(Y>B)if(E){if(q=X,J!=null&&J<D&&D-J<B)q=Math.min(Q,Math.abs(D-J)===1?Math.min(X+(F[J]?.length??0),Math.max(W,X)):X+D-J)}else{let G=F.slice(D).reduce((R,A)=>R+A.length,0);q=G<B-Q?B-G:Math.min(W,Q)}return $.current.lastPointer=q,$.current.lastActive=D,q}function w2({items:D,active:F,renderItem:B,pageSize:E,loop:$=!0}){let X=i2(),J=(V)=>(V%D.length+D.length)%D.length,Q=D.map((V,w)=>{if(V==null)return[];return O2(B({item:V,index:w,isActive:w===F}),X).split(`
34
+ `)}),Y=Q.reduce((V,w)=>V+w.length,0),W=(V)=>Q[V]??[],q=W1({active:F,renderedItems:Q,pageSize:E,loop:$}),G=W(F).slice(0,E),R=q+G.length<=E?q:E-G.length,A=Array.from({length:E});A.splice(R,G.length,...G);let I=new Set([F]),P=R+G.length,k=J(F+1);while(P<E&&!I.has(k)&&($&&Y>E?k!==F:k>F)){let w=W(k).slice(0,E-P);A.splice(P,w.length,...w),I.add(k),P+=w.length,k=J(k+1)}P=R-1,k=J(F-1);while(P>=0&&!I.has(k)&&($&&Y>E?k!==F:k<F)){let V=W(k),w=V.slice(Math.max(0,V.length-P-1));A.splice(P-w.length+1,w.length,...w),I.add(k),P-=w.length,k=J(k-1)}return A.filter((V)=>typeof V==="string").join(`
35
+ `)}var f8=KD(S8(),1);import*as Z8 from"readline";import{AsyncResource as z1}from"async_hooks";var vD=[];vD.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")vD.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")vD.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var a2=(D)=>!!D&&typeof D==="object"&&typeof D.removeListener==="function"&&typeof D.emit==="function"&&typeof D.reallyExit==="function"&&typeof D.listeners==="function"&&typeof D.kill==="function"&&typeof D.pid==="number"&&typeof D.on==="function",c0=Symbol.for("signal-exit emitter"),n0=globalThis,_1=Object.defineProperty.bind(Object);class u8{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(n0[c0])return n0[c0];_1(n0,c0,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(D,F){this.listeners[D].push(F)}removeListener(D,F){let B=this.listeners[D],E=B.indexOf(F);if(E===-1)return;if(E===0&&B.length===1)B.length=0;else B.splice(E,1)}emit(D,F,B){if(this.emitted[D])return!1;this.emitted[D]=!0;let E=!1;for(let $ of this.listeners[D])E=$(F,B)===!0||E;if(D==="exit")E=this.emit("afterExit",F,B)||E;return E}}class a0{}var H1=(D)=>{return{onExit(F,B){return D.onExit(F,B)},load(){return D.load()},unload(){return D.unload()}}};class I8 extends a0{onExit(){return()=>{}}load(){}unload(){}}class T8 extends a0{#B=i0.platform==="win32"?"SIGINT":"SIGHUP";#F=new u8;#D;#X;#J;#$={};#E=!1;constructor(D){super();this.#D=D,this.#$={};for(let F of vD)this.#$[F]=()=>{let B=this.#D.listeners(F),{count:E}=this.#F,$=D;if(typeof $.__signal_exit_emitter__==="object"&&typeof $.__signal_exit_emitter__.count==="number")E+=$.__signal_exit_emitter__.count;if(B.length===E){this.unload();let X=this.#F.emit("exit",null,F),J=F==="SIGHUP"?this.#B:F;if(!X)D.kill(D.pid,J)}};this.#J=D.reallyExit,this.#X=D.emit}onExit(D,F){if(!a2(this.#D))return()=>{};if(this.#E===!1)this.load();let B=F?.alwaysLast?"afterExit":"exit";return this.#F.on(B,D),()=>{if(this.#F.removeListener(B,D),this.#F.listeners.exit.length===0&&this.#F.listeners.afterExit.length===0)this.unload()}}load(){if(this.#E)return;this.#E=!0,this.#F.count+=1;for(let D of vD)try{let F=this.#$[D];if(F)this.#D.on(D,F)}catch(F){}this.#D.emit=(D,...F)=>{return this.#Y(D,...F)},this.#D.reallyExit=(D)=>{return this.#Q(D)}}unload(){if(!this.#E)return;this.#E=!1,vD.forEach((D)=>{let F=this.#$[D];if(!F)throw Error("Listener not defined for signal: "+D);try{this.#D.removeListener(D,F)}catch(B){}}),this.#D.emit=this.#X,this.#D.reallyExit=this.#J,this.#F.count-=1}#Q(D){if(!a2(this.#D))return 0;return this.#D.exitCode=D||0,this.#F.emit("exit",this.#D.exitCode,null),this.#J.call(this.#D,this.#D.exitCode)}#Y(D,...F){let B=this.#X;if(D==="exit"&&a2(this.#D)){if(typeof F[0]==="number")this.#D.exitCode=F[0];let E=B.call(this.#D,D,...F);return this.#F.emit("exit",this.#D.exitCode,null),E}else return B.call(this.#D,D,...F)}}var i0=globalThis.process,{onExit:b8,load:e9,unload:D4}=H1(a2(i0)?new T8(i0):new I8);import{stripVTControlCharacters as M1}from"util";var G1="\x1B[G",r2="\x1B[?25l",k8="\x1B[?25h",r0=(D=1)=>D>0?`\x1B[${D}A`:"",o0=(D=1)=>D>0?`\x1B[${D}B`:"",s0=(D,F)=>{if(typeof F==="number"&&!Number.isNaN(F))return`\x1B[${F+1};${D+1}H`;return`\x1B[${D+1}G`},P8="\x1B[2K",t0=(D)=>D>0?(P8+r0(1)).repeat(D-1)+P8+G1:"";var v8=(D)=>D.split(`
36
+ `).length,A1=(D)=>D.split(`
37
+ `).pop()??"";class o2{height=0;extraLinesUnderPrompt=0;cursorPos;rl;constructor(D){this.rl=D,this.cursorPos=D.getCursorPos()}write(D){this.rl.output.unmute(),this.rl.output.write(D),this.rl.output.mute()}render(D,F=""){let B=A1(D),E=M1(B),$=E;if(this.rl.line.length>0)$=$.slice(0,-this.rl.line.length);this.rl.setPrompt($),this.cursorPos=this.rl.getCursorPos();let X=i2();if(D=O2(D,X),F=O2(F,X),E.length%X===0)D+=`
38
+ `;let J=D+(F?`
39
+ `+F:""),Y=Math.floor(E.length/X)-this.cursorPos.rows+(F?v8(F):0);if(Y>0)J+=r0(Y);J+=s0(this.cursorPos.cols),this.write(o0(this.extraLinesUnderPrompt)+t0(this.height)+J),this.extraLinesUnderPrompt=Y,this.height=v8(J)}checkCursorPos(){let D=this.rl.getCursorPos();if(D.cols!==this.cursorPos.cols)this.write(s0(D.cols)),this.cursorPos=D}done({clearContent:D}){this.rl.setPrompt("");let F=o0(this.extraLinesUnderPrompt);F+=D?t0(this.height):`
40
+ `,F+=k8,this.write(F),this.rl.close()}}class e0 extends Promise{static withResolver(){let D,F;return{promise:new Promise((E,$)=>{D=E,F=$}),resolve:D,reject:F}}}function C1(){let D=Error.prepareStackTrace,F=[];try{Error.prepareStackTrace=(B,E)=>{let $=E.slice(1);return F=$,$},Error().stack}catch{return F}return Error.prepareStackTrace=D,F}function e(D){let F=C1();return(E,$={})=>{let{input:X=process.stdin,signal:J}=$,Q=new Set,Y=new f8.default;Y.pipe($.output??process.stdout);let W=Z8.createInterface({terminal:!0,input:X,output:Y}),q=new o2(W),{promise:G,resolve:R,reject:A}=e0.withResolver(),I=()=>A(new k0);if(J){let V=()=>A(new P0({cause:J.reason}));if(J.aborted)return V(),Object.assign(G,{cancel:I});J.addEventListener("abort",V),Q.add(()=>J.removeEventListener("abort",V))}Q.add(b8((V,w)=>{A(new p2(`User force closed the prompt with ${V} ${w}`))}));let P=()=>A(new p2("User force closed the prompt with SIGINT"));W.on("SIGINT",P),Q.add(()=>W.removeListener("SIGINT",P));let k=()=>q.checkCursorPos();return W.input.on("keypress",k),Q.add(()=>W.input.removeListener("keypress",k)),m3(W,(V)=>{let w=z1.bind(()=>kD.clearAll());return W.on("close",w),Q.add(()=>W.removeListener("close",w)),V(()=>{try{let f=D(E,(VD)=>{setImmediate(()=>R(VD))});if(f===void 0){let VD=F[1]?.getFileName();throw Error(`Prompt functions must return a string.
41
+ at ${VD}`)}let[c,p]=typeof f==="string"?[f]:f;q.render(c,p),kD.run()}catch(f){A(f)}}),Object.assign(G.then((f)=>{return kD.clearAll(),f},(f)=>{throw kD.clearAll(),f}).finally(()=>{Q.forEach((f)=>f()),q.done({clearContent:Boolean($.clearPromptOnDone)}),Y.end()}).then(()=>G),{cancel:I})})}}var x8=KD(V2(),1);class a{separator=x8.default.dim(Array.from({length:15}).join(WD.line));type="separator";constructor(D){if(D)this.separator=D}static isSeparator(D){return Boolean(D&&typeof D==="object"&&"type"in D&&D.type==="separator")}}var ZD=KD(V2(),1);var U1={icon:{checked:ZD.default.green(WD.circleFilled),unchecked:WD.circle,cursor:WD.pointer},style:{disabledChoice:(D)=>ZD.default.dim(`- ${D}`),renderSelectedChoices:(D)=>D.map((F)=>F.short).join(", "),description:(D)=>ZD.default.cyan(D),keysHelpTip:(D)=>D.map(([F,B])=>`${ZD.default.bold(F)} ${ZD.default.dim(B)}`).join(ZD.default.dim(" \u2022 "))},helpMode:"always",keybindings:[]};function ND(D){return!a.isSeparator(D)&&!D.disabled}function D3(D){return ND(D)&&D.checked}function F3(D){return ND(D)?{...D,checked:!D.checked}:D}function j1(D){return function(F){return ND(F)?{...F,checked:D}:F}}function R1(D){return D.map((F)=>{if(a.isSeparator(F))return F;if(typeof F==="string")return{value:F,name:F,short:F,checkedName:F,disabled:!1,checked:!1};let B=F.name??String(F.value),E={value:F.value,name:B,short:F.short??B,checkedName:F.checkedName??B,disabled:F.disabled??!1,checked:F.checked??!1};if(F.description)E.description=F.description;return E})}var B3=e((D,F)=>{let{instructions:B,pageSize:E=7,loop:$=!0,required:X,validate:J=()=>!0}=D,Q={all:"a",invert:"i",...D.shortcuts},Y=n(U1,D.theme),{keybindings:W}=Y,[q,G]=Z("idle"),R=s({status:q,theme:Y}),[A,I]=Z(R1(D.choices)),P=K2(()=>{let b=A.findIndex(ND),K=A.findLastIndex(ND);if(b===-1)throw new R2("[checkbox prompt] No selectable choices. All choices are disabled.");return{first:b,last:K}},[A]),[k,V]=Z(P.first),[w,f]=Z();t(async(b)=>{if(o(b)){let K=A.filter(D3),v=await J([...K]);if(X&&!A.some(D3))f("At least one choice must be selected");else if(v===!0)G("done"),F(K.map((g)=>g.value));else f(v||"You must select a valid value")}else if(MD(b,W)||TD(b,W)){if($||MD(b,W)&&k!==P.first||TD(b,W)&&k!==P.last){let K=MD(b,W)?-1:1,v=k;do v=(v+K+A.length)%A.length;while(!ND(A[v]));V(v)}}else if(I0(b))f(void 0),I(A.map((K,v)=>v===k?F3(K):K));else if(b.name===Q.all){let K=A.some((v)=>ND(v)&&!v.checked);I(A.map(j1(K)))}else if(b.name===Q.invert)I(A.map(F3));else if(b0(b)){let K=Number(b.name)-1,v=-1,g=A.findIndex((JD)=>{if(a.isSeparator(JD))return!1;return v++,v===K}),r=A[g];if(r&&ND(r))V(g),I(A.map((JD,U2)=>U2===g?F3(JD):JD))}});let c=Y.style.message(D.message,q),p,VD=w2({items:A,active:k,renderItem({item:b,isActive:K}){if(a.isSeparator(b))return` ${b.separator}`;if(b.disabled){let U2=typeof b.disabled==="string"?b.disabled:"(disabled)";return Y.style.disabledChoice(`${b.name} ${U2}`)}if(K)p=b.description;let v=b.checked?Y.icon.checked:Y.icon.unchecked,g=b.checked?b.checkedName:b.name,r=K?Y.style.highlight:(U2)=>U2,JD=K?Y.icon.cursor:" ";return r(`${JD}${v} ${g}`)},pageSize:E,loop:$});if(q==="done"){let b=A.filter(D3),K=Y.style.answer(Y.style.renderSelectedChoices(b,A));return[R,c,K].filter(Boolean).join(" ")}let oD;if(Y.helpMode!=="never"&&B!==!1)if(typeof B==="string")oD=B;else{let b=[["\u2191\u2193","navigate"],["space","select"]];if(Q.all)b.push([Q.all,"all"]);if(Q.invert)b.push([Q.invert,"invert"]);b.push(["\u23CE","submit"]),oD=Y.style.keysHelpTip(b)}return`${[[R,c].filter(Boolean).join(" "),VD," ",p?Y.style.description(p):"",w?Y.style.error(w):"",oD].filter(Boolean).join(`
42
+ `).trimEnd()}${r2}`});function y8(D,F){let B=F!==!1;if(/^(y|yes)/i.test(D))B=!0;else if(/^(n|no)/i.test(D))B=!1;return B}function h8(D){return D?"Yes":"No"}var fD=e((D,F)=>{let{transformer:B=h8}=D,[E,$]=Z("idle"),[X,J]=Z(""),Q=n(D.theme),Y=s({status:E,theme:Q});t((R,A)=>{if(E!=="idle")return;if(o(R)){let I=y8(X,D.default);J(B(I)),$("done"),F(I)}else if(bD(R)){let I=h8(!y8(X,D.default));A.clearLine(0),A.write(I),J(I)}else J(A.line)});let W=X,q="";if(E==="done")W=Q.style.answer(X);else q=` ${Q.style.defaultAnswer(D.default===!1?"y/N":"Y/n")}`;let G=Q.style.message(D.message,E);return`${Y} ${G}${q} ${W}`});var V1={validationFailureMode:"keep"},s2=e((D,F)=>{let{prefill:B="tab"}=D,E=n(V1,D.theme),[$,X]=Z("idle"),[J="",Q]=Z(D.default),[Y,W]=Z(),[q,G]=Z(""),R=s({status:$,theme:E});async function A(w){let{required:f,pattern:c,patternError:p="Invalid input"}=D;if(f&&!w)return"You must provide a value";if(c&&!c.test(w))return p;if(typeof D.validate==="function")return await D.validate(w)||"You must provide a valid value";return!0}t(async(w,f)=>{if($!=="idle")return;if(o(w)){let c=q||J;X("loading");let p=await A(c);if(p===!0)G(c),X("done"),F(c);else{if(E.validationFailureMode==="clear")G("");else f.write(q);W(p),X("idle")}}else if(T0(w)&&!q)Q(void 0);else if(bD(w)&&!q)Q(void 0),f.clearLine(0),f.write(J),G(J);else G(f.line),W(void 0)}),AD((w)=>{if(B==="editable"&&J)w.write(J),G(J)},[]);let I=E.style.message(D.message,$),P=q;if(typeof D.transformer==="function")P=D.transformer(q,{isFinal:$==="done"});else if($==="done")P=E.style.answer(q);let k;if(J&&$!=="done"&&!q)k=E.style.defaultAnswer(J);let V="";if(Y)V=E.style.error(Y);return[[R,I,k,P].filter((w)=>w!==void 0).join(" "),V]});var K1=e((D,F)=>{let{validate:B=()=>!0}=D,E=n(D.theme),[$,X]=Z("idle"),[J,Q]=Z(),[Y,W]=Z(""),q=s({status:$,theme:E});t(async(P,k)=>{if($!=="idle")return;if(o(P)){let V=Y;X("loading");let w=await B(V);if(w===!0)W(V),X("done"),F(V);else k.write(Y),Q(w||"You must provide a valid value"),X("idle")}else W(k.line),Q(void 0)});let G=E.style.message(D.message,$),R="",A;if(D.mask)R=(typeof D.mask==="string"?D.mask:"*").repeat(Y.length);else if($!=="done")A=`${E.style.help("[input is masked]")}${r2}`;if($==="done")R=E.style.answer(R);let I="";if(J)I=E.style.error(J);return[[q,G,D.mask?R:A].join(" "),I]});var xD=KD(V2(),1);var N1={icon:{cursor:WD.pointer},style:{disabled:(D)=>xD.default.dim(`- ${D}`),searchTerm:(D)=>xD.default.cyan(D),description:(D)=>xD.default.cyan(D),keysHelpTip:(D)=>D.map(([F,B])=>`${xD.default.bold(F)} ${xD.default.dim(B)}`).join(xD.default.dim(" \u2022 "))},helpMode:"always"};function E3(D){return!a.isSeparator(D)&&!D.disabled}function L1(D){return D.map((F)=>{if(a.isSeparator(F))return F;if(typeof F==="string")return{value:F,name:F,short:F,disabled:!1};let B=F.name??String(F.value),E={value:F.value,name:B,short:F.short??B,disabled:F.disabled??!1};if(F.description)E.description=F.description;return E})}var O1=e((D,F)=>{let{pageSize:B=7,validate:E=()=>!0}=D,$=n(N1,D.theme),[X,J]=Z("loading"),[Q,Y]=Z(""),[W,q]=Z([]),[G,R]=Z(),A=s({status:X,theme:$}),I=K2(()=>{let K=W.findIndex(E3),v=W.findLastIndex(E3);return{first:K,last:v}},[W]),[P=I.first,k]=Z();AD(()=>{let K=new AbortController;return J("loading"),R(void 0),(async()=>{try{let g=await D.source(Q||void 0,{signal:K.signal});if(!K.signal.aborted)k(void 0),R(void 0),q(L1(g)),J("idle")}catch(g){if(!K.signal.aborted&&g instanceof Error)R(g.message)}})(),()=>{K.abort()}},[Q]);let V=W[P];t(async(K,v)=>{if(o(K))if(V){J("loading");let g=await E(V.value);if(J("idle"),g===!0)J("done"),F(V.value);else if(V.name===Q)R(g||"You must provide a valid value");else v.write(V.name),Y(V.name)}else v.write(Q);else if(bD(K)&&V)v.clearLine(0),v.write(V.name),Y(V.name);else if(X!=="loading"&&(MD(K)||TD(K))){if(v.clearLine(0),MD(K)&&P!==I.first||TD(K)&&P!==I.last){let g=MD(K)?-1:1,r=P;do r=(r+g+W.length)%W.length;while(!E3(W[r]));k(r)}}else Y(v.line)});let w=$.style.message(D.message,X),f;if($.helpMode!=="never")if(D.instructions){let{pager:K,navigation:v}=D.instructions;f=$.style.help(W.length>B?K:v)}else f=$.style.keysHelpTip([["\u2191\u2193","navigate"],["\u23CE","select"]]);let c=w2({items:W,active:P,renderItem({item:K,isActive:v}){if(a.isSeparator(K))return` ${K.separator}`;if(K.disabled){let JD=typeof K.disabled==="string"?K.disabled:"(disabled)";return $.style.disabled(`${K.name} ${JD}`)}let g=v?$.style.highlight:(JD)=>JD,r=v?$.icon.cursor:" ";return g(`${r} ${K.name}`)},pageSize:B,loop:!1}),p;if(G)p=$.style.error(G);else if(W.length===0&&Q!==""&&X==="idle")p=$.style.error("No results found");let VD;if(X==="done"&&V)return[A,w,$.style.answer(V.short)].filter(Boolean).join(" ").trimEnd();else VD=$.style.searchTerm(Q);let oD=V?.description,N3=[A,w,VD].filter(Boolean).join(" ").trimEnd(),b=[p??c," ",oD?$.style.description(oD):"",f].filter(Boolean).join(`
43
+ `).trimEnd();return[N3,b]});import{spawn as z7}from"child_process";import{platform as w1,arch as S1}from"os";import{readFile as u1}from"fs/promises";var{$:t2}=globalThis.Bun;function I1(){let D=w1();if(D==="darwin")return"macos";if(D==="linux")return"linux";return"unknown"}async function T1(){try{let F=(await u1("/etc/os-release","utf-8")).split(`
44
+ `),B={};for(let X of F){let[J,...Q]=X.split("=");if(J&&Q.length>0)B[J]=Q.join("=").replace(/^"|"$/g,"")}let E=(B.ID||"").toLowerCase(),$=(B.ID_LIKE||"").toLowerCase();if(E==="ubuntu"||$.includes("ubuntu"))return"ubuntu";if(E==="debian"||$.includes("debian"))return"debian";if(E==="fedora"||$.includes("fedora"))return"fedora";if(E==="rhel"||E==="centos"||E==="rocky"||E==="almalinux"||$.includes("rhel"))return"rhel";if(E==="arch"||$.includes("arch"))return"arch";return"unknown"}catch{return"unknown"}}async function S2(D){try{return(await t2`which ${D}`.quiet()).exitCode===0}catch{return!1}}async function b1(){if(await S2("brew"))return"brew";if(await S2("apt"))return"apt";if(await S2("dnf"))return"dnf";if(await S2("yum"))return"yum";if(await S2("pacman"))return"pacman";return"none"}async function g8(){let D=I1(),F=S1(),B={os:D,arch:F,preferredPM:await b1()};if(D==="linux")B.linuxDistro=await T1();return B}async function yD(D){try{let B=(await t2`which ${D}`.quiet().text()).trim();if(!B)return{exists:!1};let E;try{let X=(await t2`${D} --version`.quiet().text()).split(`
45
+ `)[0].trim(),J=X.match(/(\d+\.[\d.]+[a-z0-9-]*)/i);E=J?J[1]:X.slice(0,50)}catch{try{let X=(await t2`${D} -v`.quiet().text()).split(`
46
+ `)[0].trim(),J=X.match(/(\d+\.[\d.]+[a-z0-9-]*)/i);E=J?J[1]:X.slice(0,50)}catch{}}return{exists:!0,version:E,path:B}}catch{return{exists:!1}}}var P1=[{name:"tmux",required:!0,description:"Terminal multiplexer for shared sessions"},{name:"bun",required:!0,description:"Fast JavaScript runtime and package manager"},{name:"claude",required:!1,description:"Claude Code CLI (optional, recommended)"}];async function m8(){let D=[];for(let F of P1){let B=await yD(F.name);D.push({name:F.name,installed:B.exists,version:B.version,path:B.path,required:F.required,description:F.description})}return D}function l8(D){return{ubuntu:"Ubuntu",debian:"Debian",fedora:"Fedora",rhel:"RHEL/CentOS",arch:"Arch Linux",unknown:"Linux"}[D]||"Linux"}import{existsSync as Q3,mkdirSync as r5,readFileSync as o5,writeFileSync as s5}from"fs";import{homedir as t5}from"os";import{join as D6}from"path";var T={};m6(T,{void:()=>z5,util:()=>u,unknown:()=>M5,union:()=>R5,undefined:()=>_5,tuple:()=>N5,transformer:()=>k5,symbol:()=>q5,string:()=>s8,strictObject:()=>j5,setErrorMap:()=>Z1,set:()=>w5,record:()=>L5,quotelessJson:()=>k1,promise:()=>P5,preprocess:()=>f5,pipeline:()=>x5,ostring:()=>y5,optional:()=>v5,onumber:()=>h5,oboolean:()=>g5,objectUtil:()=>$3,object:()=>U5,number:()=>t8,nullable:()=>Z5,null:()=>H5,never:()=>A5,nativeEnum:()=>b5,nan:()=>Q5,map:()=>O5,makeIssue:()=>u2,literal:()=>I5,lazy:()=>u5,late:()=>X5,isValid:()=>LD,isDirty:()=>D0,isAsync:()=>B2,isAborted:()=>e2,intersection:()=>K5,instanceof:()=>J5,getParsedType:()=>qD,getErrorMap:()=>F2,function:()=>S5,enum:()=>T5,effect:()=>k5,discriminatedUnion:()=>V5,defaultErrorMap:()=>zD,datetimeRegex:()=>a8,date:()=>W5,custom:()=>o8,coerce:()=>m5,boolean:()=>e8,bigint:()=>Y5,array:()=>C5,any:()=>G5,addIssueToContext:()=>M,ZodVoid:()=>T2,ZodUnknown:()=>OD,ZodUnion:()=>Y2,ZodUndefined:()=>J2,ZodType:()=>S,ZodTuple:()=>HD,ZodTransformer:()=>$D,ZodSymbol:()=>I2,ZodString:()=>DD,ZodSet:()=>lD,ZodSchema:()=>S,ZodRecord:()=>b2,ZodReadonly:()=>A2,ZodPromise:()=>pD,ZodPipeline:()=>v2,ZodParsedType:()=>H,ZodOptional:()=>BD,ZodObject:()=>x,ZodNumber:()=>wD,ZodNullable:()=>UD,ZodNull:()=>Q2,ZodNever:()=>_D,ZodNativeEnum:()=>H2,ZodNaN:()=>k2,ZodMap:()=>P2,ZodLiteral:()=>_2,ZodLazy:()=>q2,ZodIssueCode:()=>_,ZodIntersection:()=>W2,ZodFunction:()=>$2,ZodFirstPartyTypeKind:()=>j,ZodError:()=>d,ZodEnum:()=>uD,ZodEffects:()=>$D,ZodDiscriminatedUnion:()=>F0,ZodDefault:()=>G2,ZodDate:()=>gD,ZodCatch:()=>M2,ZodBranded:()=>B0,ZodBoolean:()=>X2,ZodBigInt:()=>SD,ZodArray:()=>FD,ZodAny:()=>mD,Schema:()=>S,ParseStatus:()=>m,OK:()=>l,NEVER:()=>l5,INVALID:()=>U,EMPTY_PATH:()=>f1,DIRTY:()=>hD,BRAND:()=>$5});var u;(function(D){D.assertEqual=($)=>{};function F($){}D.assertIs=F;function B($){throw Error()}D.assertNever=B,D.arrayToEnum=($)=>{let X={};for(let J of $)X[J]=J;return X},D.getValidEnumValues=($)=>{let X=D.objectKeys($).filter((Q)=>typeof $[$[Q]]!=="number"),J={};for(let Q of X)J[Q]=$[Q];return D.objectValues(J)},D.objectValues=($)=>{return D.objectKeys($).map(function(X){return $[X]})},D.objectKeys=typeof Object.keys==="function"?($)=>Object.keys($):($)=>{let X=[];for(let J in $)if(Object.prototype.hasOwnProperty.call($,J))X.push(J);return X},D.find=($,X)=>{for(let J of $)if(X(J))return J;return},D.isInteger=typeof Number.isInteger==="function"?($)=>Number.isInteger($):($)=>typeof $==="number"&&Number.isFinite($)&&Math.floor($)===$;function E($,X=" | "){return $.map((J)=>typeof J==="string"?`'${J}'`:J).join(X)}D.joinValues=E,D.jsonStringifyReplacer=($,X)=>{if(typeof X==="bigint")return X.toString();return X}})(u||(u={}));var $3;(function(D){D.mergeShapes=(F,B)=>{return{...F,...B}}})($3||($3={}));var H=u.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),qD=(D)=>{switch(typeof D){case"undefined":return H.undefined;case"string":return H.string;case"number":return Number.isNaN(D)?H.nan:H.number;case"boolean":return H.boolean;case"function":return H.function;case"bigint":return H.bigint;case"symbol":return H.symbol;case"object":if(Array.isArray(D))return H.array;if(D===null)return H.null;if(D.then&&typeof D.then==="function"&&D.catch&&typeof D.catch==="function")return H.promise;if(typeof Map<"u"&&D instanceof Map)return H.map;if(typeof Set<"u"&&D instanceof Set)return H.set;if(typeof Date<"u"&&D instanceof Date)return H.date;return H.object;default:return H.unknown}};var _=u.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),k1=(D)=>{return JSON.stringify(D,null,2).replace(/"([^"]+)":/g,"$1:")};class d extends Error{get errors(){return this.issues}constructor(D){super();this.issues=[],this.addIssue=(B)=>{this.issues=[...this.issues,B]},this.addIssues=(B=[])=>{this.issues=[...this.issues,...B]};let F=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,F);else this.__proto__=F;this.name="ZodError",this.issues=D}format(D){let F=D||function($){return $.message},B={_errors:[]},E=($)=>{for(let X of $.issues)if(X.code==="invalid_union")X.unionErrors.map(E);else if(X.code==="invalid_return_type")E(X.returnTypeError);else if(X.code==="invalid_arguments")E(X.argumentsError);else if(X.path.length===0)B._errors.push(F(X));else{let J=B,Q=0;while(Q<X.path.length){let Y=X.path[Q];if(Q!==X.path.length-1)J[Y]=J[Y]||{_errors:[]};else J[Y]=J[Y]||{_errors:[]},J[Y]._errors.push(F(X));J=J[Y],Q++}}};return E(this),B}static assert(D){if(!(D instanceof d))throw Error(`Not a ZodError: ${D}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,u.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(D=(F)=>F.message){let F={},B=[];for(let E of this.issues)if(E.path.length>0){let $=E.path[0];F[$]=F[$]||[],F[$].push(D(E))}else B.push(D(E));return{formErrors:B,fieldErrors:F}}get formErrors(){return this.flatten()}}d.create=(D)=>{return new d(D)};var v1=(D,F)=>{let B;switch(D.code){case _.invalid_type:if(D.received===H.undefined)B="Required";else B=`Expected ${D.expected}, received ${D.received}`;break;case _.invalid_literal:B=`Invalid literal value, expected ${JSON.stringify(D.expected,u.jsonStringifyReplacer)}`;break;case _.unrecognized_keys:B=`Unrecognized key(s) in object: ${u.joinValues(D.keys,", ")}`;break;case _.invalid_union:B="Invalid input";break;case _.invalid_union_discriminator:B=`Invalid discriminator value. Expected ${u.joinValues(D.options)}`;break;case _.invalid_enum_value:B=`Invalid enum value. Expected ${u.joinValues(D.options)}, received '${D.received}'`;break;case _.invalid_arguments:B="Invalid function arguments";break;case _.invalid_return_type:B="Invalid function return type";break;case _.invalid_date:B="Invalid date";break;case _.invalid_string:if(typeof D.validation==="object")if("includes"in D.validation){if(B=`Invalid input: must include "${D.validation.includes}"`,typeof D.validation.position==="number")B=`${B} at one or more positions greater than or equal to ${D.validation.position}`}else if("startsWith"in D.validation)B=`Invalid input: must start with "${D.validation.startsWith}"`;else if("endsWith"in D.validation)B=`Invalid input: must end with "${D.validation.endsWith}"`;else u.assertNever(D.validation);else if(D.validation!=="regex")B=`Invalid ${D.validation}`;else B="Invalid";break;case _.too_small:if(D.type==="array")B=`Array must contain ${D.exact?"exactly":D.inclusive?"at least":"more than"} ${D.minimum} element(s)`;else if(D.type==="string")B=`String must contain ${D.exact?"exactly":D.inclusive?"at least":"over"} ${D.minimum} character(s)`;else if(D.type==="number")B=`Number must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${D.minimum}`;else if(D.type==="bigint")B=`Number must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${D.minimum}`;else if(D.type==="date")B=`Date must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(D.minimum))}`;else B="Invalid input";break;case _.too_big:if(D.type==="array")B=`Array must contain ${D.exact?"exactly":D.inclusive?"at most":"less than"} ${D.maximum} element(s)`;else if(D.type==="string")B=`String must contain ${D.exact?"exactly":D.inclusive?"at most":"under"} ${D.maximum} character(s)`;else if(D.type==="number")B=`Number must be ${D.exact?"exactly":D.inclusive?"less than or equal to":"less than"} ${D.maximum}`;else if(D.type==="bigint")B=`BigInt must be ${D.exact?"exactly":D.inclusive?"less than or equal to":"less than"} ${D.maximum}`;else if(D.type==="date")B=`Date must be ${D.exact?"exactly":D.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(D.maximum))}`;else B="Invalid input";break;case _.custom:B="Invalid input";break;case _.invalid_intersection_types:B="Intersection results could not be merged";break;case _.not_multiple_of:B=`Number must be a multiple of ${D.multipleOf}`;break;case _.not_finite:B="Number must be finite";break;default:B=F.defaultError,u.assertNever(D)}return{message:B}},zD=v1;var p8=zD;function Z1(D){p8=D}function F2(){return p8}var u2=(D)=>{let{data:F,path:B,errorMaps:E,issueData:$}=D,X=[...B,...$.path||[]],J={...$,path:X};if($.message!==void 0)return{...$,path:X,message:$.message};let Q="",Y=E.filter((W)=>!!W).slice().reverse();for(let W of Y)Q=W(J,{data:F,defaultError:Q}).message;return{...$,path:X,message:Q}},f1=[];function M(D,F){let B=F2(),E=u2({issueData:F,data:D.data,path:D.path,errorMaps:[D.common.contextualErrorMap,D.schemaErrorMap,B,B===zD?void 0:zD].filter(($)=>!!$)});D.common.issues.push(E)}class m{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(D,F){let B=[];for(let E of F){if(E.status==="aborted")return U;if(E.status==="dirty")D.dirty();B.push(E.value)}return{status:D.value,value:B}}static async mergeObjectAsync(D,F){let B=[];for(let E of F){let $=await E.key,X=await E.value;B.push({key:$,value:X})}return m.mergeObjectSync(D,B)}static mergeObjectSync(D,F){let B={};for(let E of F){let{key:$,value:X}=E;if($.status==="aborted")return U;if(X.status==="aborted")return U;if($.status==="dirty")D.dirty();if(X.status==="dirty")D.dirty();if($.value!=="__proto__"&&(typeof X.value<"u"||E.alwaysSet))B[$.value]=X.value}return{status:D.value,value:B}}}var U=Object.freeze({status:"aborted"}),hD=(D)=>({status:"dirty",value:D}),l=(D)=>({status:"valid",value:D}),e2=(D)=>D.status==="aborted",D0=(D)=>D.status==="dirty",LD=(D)=>D.status==="valid",B2=(D)=>typeof Promise<"u"&&D instanceof Promise;var C;(function(D){D.errToObj=(F)=>typeof F==="string"?{message:F}:F||{},D.toString=(F)=>typeof F==="string"?F:F?.message})(C||(C={}));class ED{constructor(D,F,B,E){this._cachedPath=[],this.parent=D,this.data=F,this._path=B,this._key=E}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var d8=(D,F)=>{if(LD(F))return{success:!0,data:F.value};else{if(!D.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let B=new d(D.common.issues);return this._error=B,this._error}}}};function L(D){if(!D)return{};let{errorMap:F,invalid_type_error:B,required_error:E,description:$}=D;if(F&&(B||E))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(F)return{errorMap:F,description:$};return{errorMap:(J,Q)=>{let{message:Y}=D;if(J.code==="invalid_enum_value")return{message:Y??Q.defaultError};if(typeof Q.data>"u")return{message:Y??E??Q.defaultError};if(J.code!=="invalid_type")return{message:Q.defaultError};return{message:Y??B??Q.defaultError}},description:$}}class S{get description(){return this._def.description}_getType(D){return qD(D.data)}_getOrReturnCtx(D,F){return F||{common:D.parent.common,data:D.data,parsedType:qD(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}_processInputParams(D){return{status:new m,ctx:{common:D.parent.common,data:D.data,parsedType:qD(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}}_parseSync(D){let F=this._parse(D);if(B2(F))throw Error("Synchronous parse encountered promise.");return F}_parseAsync(D){let F=this._parse(D);return Promise.resolve(F)}parse(D,F){let B=this.safeParse(D,F);if(B.success)return B.data;throw B.error}safeParse(D,F){let B={common:{issues:[],async:F?.async??!1,contextualErrorMap:F?.errorMap},path:F?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:qD(D)},E=this._parseSync({data:D,path:B.path,parent:B});return d8(B,E)}"~validate"(D){let F={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:qD(D)};if(!this["~standard"].async)try{let B=this._parseSync({data:D,path:[],parent:F});return LD(B)?{value:B.value}:{issues:F.common.issues}}catch(B){if(B?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;F.common={issues:[],async:!0}}return this._parseAsync({data:D,path:[],parent:F}).then((B)=>LD(B)?{value:B.value}:{issues:F.common.issues})}async parseAsync(D,F){let B=await this.safeParseAsync(D,F);if(B.success)return B.data;throw B.error}async safeParseAsync(D,F){let B={common:{issues:[],contextualErrorMap:F?.errorMap,async:!0},path:F?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:qD(D)},E=this._parse({data:D,path:B.path,parent:B}),$=await(B2(E)?E:Promise.resolve(E));return d8(B,$)}refine(D,F){let B=(E)=>{if(typeof F==="string"||typeof F>"u")return{message:F};else if(typeof F==="function")return F(E);else return F};return this._refinement((E,$)=>{let X=D(E),J=()=>$.addIssue({code:_.custom,...B(E)});if(typeof Promise<"u"&&X instanceof Promise)return X.then((Q)=>{if(!Q)return J(),!1;else return!0});if(!X)return J(),!1;else return!0})}refinement(D,F){return this._refinement((B,E)=>{if(!D(B))return E.addIssue(typeof F==="function"?F(B,E):F),!1;else return!0})}_refinement(D){return new $D({schema:this,typeName:j.ZodEffects,effect:{type:"refinement",refinement:D}})}superRefine(D){return this._refinement(D)}constructor(D){this.spa=this.safeParseAsync,this._def=D,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(F)=>this["~validate"](F)}}optional(){return BD.create(this,this._def)}nullable(){return UD.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return FD.create(this)}promise(){return pD.create(this,this._def)}or(D){return Y2.create([this,D],this._def)}and(D){return W2.create(this,D,this._def)}transform(D){return new $D({...L(this._def),schema:this,typeName:j.ZodEffects,effect:{type:"transform",transform:D}})}default(D){let F=typeof D==="function"?D:()=>D;return new G2({...L(this._def),innerType:this,defaultValue:F,typeName:j.ZodDefault})}brand(){return new B0({typeName:j.ZodBranded,type:this,...L(this._def)})}catch(D){let F=typeof D==="function"?D:()=>D;return new M2({...L(this._def),innerType:this,catchValue:F,typeName:j.ZodCatch})}describe(D){return new this.constructor({...this._def,description:D})}pipe(D){return v2.create(this,D)}readonly(){return A2.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var x1=/^c[^\s-]{8,}$/i,y1=/^[0-9a-z]+$/,h1=/^[0-9A-HJKMNP-TV-Z]{26}$/i,g1=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,m1=/^[a-z0-9_-]{21}$/i,l1=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,p1=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,d1=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,c1="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",X3,n1=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,i1=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,a1=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,r1=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,o1=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,s1=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,n8="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",t1=new RegExp(`^${n8}$`);function i8(D){let F="[0-5]\\d";if(D.precision)F=`${F}\\.\\d{${D.precision}}`;else if(D.precision==null)F=`${F}(\\.\\d+)?`;let B=D.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${F})${B}`}function e1(D){return new RegExp(`^${i8(D)}$`)}function a8(D){let F=`${n8}T${i8(D)}`,B=[];if(B.push(D.local?"Z?":"Z"),D.offset)B.push("([+-]\\d{2}:?\\d{2})");return F=`${F}(${B.join("|")})`,new RegExp(`^${F}$`)}function D5(D,F){if((F==="v4"||!F)&&n1.test(D))return!0;if((F==="v6"||!F)&&a1.test(D))return!0;return!1}function F5(D,F){if(!l1.test(D))return!1;try{let[B]=D.split(".");if(!B)return!1;let E=B.replace(/-/g,"+").replace(/_/g,"/").padEnd(B.length+(4-B.length%4)%4,"="),$=JSON.parse(atob(E));if(typeof $!=="object"||$===null)return!1;if("typ"in $&&$?.typ!=="JWT")return!1;if(!$.alg)return!1;if(F&&$.alg!==F)return!1;return!0}catch{return!1}}function B5(D,F){if((F==="v4"||!F)&&i1.test(D))return!0;if((F==="v6"||!F)&&r1.test(D))return!0;return!1}class DD extends S{_parse(D){if(this._def.coerce)D.data=String(D.data);if(this._getType(D)!==H.string){let $=this._getOrReturnCtx(D);return M($,{code:_.invalid_type,expected:H.string,received:$.parsedType}),U}let B=new m,E=void 0;for(let $ of this._def.checks)if($.kind==="min"){if(D.data.length<$.value)E=this._getOrReturnCtx(D,E),M(E,{code:_.too_small,minimum:$.value,type:"string",inclusive:!0,exact:!1,message:$.message}),B.dirty()}else if($.kind==="max"){if(D.data.length>$.value)E=this._getOrReturnCtx(D,E),M(E,{code:_.too_big,maximum:$.value,type:"string",inclusive:!0,exact:!1,message:$.message}),B.dirty()}else if($.kind==="length"){let X=D.data.length>$.value,J=D.data.length<$.value;if(X||J){if(E=this._getOrReturnCtx(D,E),X)M(E,{code:_.too_big,maximum:$.value,type:"string",inclusive:!0,exact:!0,message:$.message});else if(J)M(E,{code:_.too_small,minimum:$.value,type:"string",inclusive:!0,exact:!0,message:$.message});B.dirty()}}else if($.kind==="email"){if(!d1.test(D.data))E=this._getOrReturnCtx(D,E),M(E,{validation:"email",code:_.invalid_string,message:$.message}),B.dirty()}else if($.kind==="emoji"){if(!X3)X3=new RegExp(c1,"u");if(!X3.test(D.data))E=this._getOrReturnCtx(D,E),M(E,{validation:"emoji",code:_.invalid_string,message:$.message}),B.dirty()}else if($.kind==="uuid"){if(!g1.test(D.data))E=this._getOrReturnCtx(D,E),M(E,{validation:"uuid",code:_.invalid_string,message:$.message}),B.dirty()}else if($.kind==="nanoid"){if(!m1.test(D.data))E=this._getOrReturnCtx(D,E),M(E,{validation:"nanoid",code:_.invalid_string,message:$.message}),B.dirty()}else if($.kind==="cuid"){if(!x1.test(D.data))E=this._getOrReturnCtx(D,E),M(E,{validation:"cuid",code:_.invalid_string,message:$.message}),B.dirty()}else if($.kind==="cuid2"){if(!y1.test(D.data))E=this._getOrReturnCtx(D,E),M(E,{validation:"cuid2",code:_.invalid_string,message:$.message}),B.dirty()}else if($.kind==="ulid"){if(!h1.test(D.data))E=this._getOrReturnCtx(D,E),M(E,{validation:"ulid",code:_.invalid_string,message:$.message}),B.dirty()}else if($.kind==="url")try{new URL(D.data)}catch{E=this._getOrReturnCtx(D,E),M(E,{validation:"url",code:_.invalid_string,message:$.message}),B.dirty()}else if($.kind==="regex"){if($.regex.lastIndex=0,!$.regex.test(D.data))E=this._getOrReturnCtx(D,E),M(E,{validation:"regex",code:_.invalid_string,message:$.message}),B.dirty()}else if($.kind==="trim")D.data=D.data.trim();else if($.kind==="includes"){if(!D.data.includes($.value,$.position))E=this._getOrReturnCtx(D,E),M(E,{code:_.invalid_string,validation:{includes:$.value,position:$.position},message:$.message}),B.dirty()}else if($.kind==="toLowerCase")D.data=D.data.toLowerCase();else if($.kind==="toUpperCase")D.data=D.data.toUpperCase();else if($.kind==="startsWith"){if(!D.data.startsWith($.value))E=this._getOrReturnCtx(D,E),M(E,{code:_.invalid_string,validation:{startsWith:$.value},message:$.message}),B.dirty()}else if($.kind==="endsWith"){if(!D.data.endsWith($.value))E=this._getOrReturnCtx(D,E),M(E,{code:_.invalid_string,validation:{endsWith:$.value},message:$.message}),B.dirty()}else if($.kind==="datetime"){if(!a8($).test(D.data))E=this._getOrReturnCtx(D,E),M(E,{code:_.invalid_string,validation:"datetime",message:$.message}),B.dirty()}else if($.kind==="date"){if(!t1.test(D.data))E=this._getOrReturnCtx(D,E),M(E,{code:_.invalid_string,validation:"date",message:$.message}),B.dirty()}else if($.kind==="time"){if(!e1($).test(D.data))E=this._getOrReturnCtx(D,E),M(E,{code:_.invalid_string,validation:"time",message:$.message}),B.dirty()}else if($.kind==="duration"){if(!p1.test(D.data))E=this._getOrReturnCtx(D,E),M(E,{validation:"duration",code:_.invalid_string,message:$.message}),B.dirty()}else if($.kind==="ip"){if(!D5(D.data,$.version))E=this._getOrReturnCtx(D,E),M(E,{validation:"ip",code:_.invalid_string,message:$.message}),B.dirty()}else if($.kind==="jwt"){if(!F5(D.data,$.alg))E=this._getOrReturnCtx(D,E),M(E,{validation:"jwt",code:_.invalid_string,message:$.message}),B.dirty()}else if($.kind==="cidr"){if(!B5(D.data,$.version))E=this._getOrReturnCtx(D,E),M(E,{validation:"cidr",code:_.invalid_string,message:$.message}),B.dirty()}else if($.kind==="base64"){if(!o1.test(D.data))E=this._getOrReturnCtx(D,E),M(E,{validation:"base64",code:_.invalid_string,message:$.message}),B.dirty()}else if($.kind==="base64url"){if(!s1.test(D.data))E=this._getOrReturnCtx(D,E),M(E,{validation:"base64url",code:_.invalid_string,message:$.message}),B.dirty()}else u.assertNever($);return{status:B.value,value:D.data}}_regex(D,F,B){return this.refinement((E)=>D.test(E),{validation:F,code:_.invalid_string,...C.errToObj(B)})}_addCheck(D){return new DD({...this._def,checks:[...this._def.checks,D]})}email(D){return this._addCheck({kind:"email",...C.errToObj(D)})}url(D){return this._addCheck({kind:"url",...C.errToObj(D)})}emoji(D){return this._addCheck({kind:"emoji",...C.errToObj(D)})}uuid(D){return this._addCheck({kind:"uuid",...C.errToObj(D)})}nanoid(D){return this._addCheck({kind:"nanoid",...C.errToObj(D)})}cuid(D){return this._addCheck({kind:"cuid",...C.errToObj(D)})}cuid2(D){return this._addCheck({kind:"cuid2",...C.errToObj(D)})}ulid(D){return this._addCheck({kind:"ulid",...C.errToObj(D)})}base64(D){return this._addCheck({kind:"base64",...C.errToObj(D)})}base64url(D){return this._addCheck({kind:"base64url",...C.errToObj(D)})}jwt(D){return this._addCheck({kind:"jwt",...C.errToObj(D)})}ip(D){return this._addCheck({kind:"ip",...C.errToObj(D)})}cidr(D){return this._addCheck({kind:"cidr",...C.errToObj(D)})}datetime(D){if(typeof D==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:D});return this._addCheck({kind:"datetime",precision:typeof D?.precision>"u"?null:D?.precision,offset:D?.offset??!1,local:D?.local??!1,...C.errToObj(D?.message)})}date(D){return this._addCheck({kind:"date",message:D})}time(D){if(typeof D==="string")return this._addCheck({kind:"time",precision:null,message:D});return this._addCheck({kind:"time",precision:typeof D?.precision>"u"?null:D?.precision,...C.errToObj(D?.message)})}duration(D){return this._addCheck({kind:"duration",...C.errToObj(D)})}regex(D,F){return this._addCheck({kind:"regex",regex:D,...C.errToObj(F)})}includes(D,F){return this._addCheck({kind:"includes",value:D,position:F?.position,...C.errToObj(F?.message)})}startsWith(D,F){return this._addCheck({kind:"startsWith",value:D,...C.errToObj(F)})}endsWith(D,F){return this._addCheck({kind:"endsWith",value:D,...C.errToObj(F)})}min(D,F){return this._addCheck({kind:"min",value:D,...C.errToObj(F)})}max(D,F){return this._addCheck({kind:"max",value:D,...C.errToObj(F)})}length(D,F){return this._addCheck({kind:"length",value:D,...C.errToObj(F)})}nonempty(D){return this.min(1,C.errToObj(D))}trim(){return new DD({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new DD({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new DD({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((D)=>D.kind==="datetime")}get isDate(){return!!this._def.checks.find((D)=>D.kind==="date")}get isTime(){return!!this._def.checks.find((D)=>D.kind==="time")}get isDuration(){return!!this._def.checks.find((D)=>D.kind==="duration")}get isEmail(){return!!this._def.checks.find((D)=>D.kind==="email")}get isURL(){return!!this._def.checks.find((D)=>D.kind==="url")}get isEmoji(){return!!this._def.checks.find((D)=>D.kind==="emoji")}get isUUID(){return!!this._def.checks.find((D)=>D.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((D)=>D.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((D)=>D.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((D)=>D.kind==="cuid2")}get isULID(){return!!this._def.checks.find((D)=>D.kind==="ulid")}get isIP(){return!!this._def.checks.find((D)=>D.kind==="ip")}get isCIDR(){return!!this._def.checks.find((D)=>D.kind==="cidr")}get isBase64(){return!!this._def.checks.find((D)=>D.kind==="base64")}get isBase64url(){return!!this._def.checks.find((D)=>D.kind==="base64url")}get minLength(){let D=null;for(let F of this._def.checks)if(F.kind==="min"){if(D===null||F.value>D)D=F.value}return D}get maxLength(){let D=null;for(let F of this._def.checks)if(F.kind==="max"){if(D===null||F.value<D)D=F.value}return D}}DD.create=(D)=>{return new DD({checks:[],typeName:j.ZodString,coerce:D?.coerce??!1,...L(D)})};function E5(D,F){let B=(D.toString().split(".")[1]||"").length,E=(F.toString().split(".")[1]||"").length,$=B>E?B:E,X=Number.parseInt(D.toFixed($).replace(".","")),J=Number.parseInt(F.toFixed($).replace(".",""));return X%J/10**$}class wD extends S{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(D){if(this._def.coerce)D.data=Number(D.data);if(this._getType(D)!==H.number){let $=this._getOrReturnCtx(D);return M($,{code:_.invalid_type,expected:H.number,received:$.parsedType}),U}let B=void 0,E=new m;for(let $ of this._def.checks)if($.kind==="int"){if(!u.isInteger(D.data))B=this._getOrReturnCtx(D,B),M(B,{code:_.invalid_type,expected:"integer",received:"float",message:$.message}),E.dirty()}else if($.kind==="min"){if($.inclusive?D.data<$.value:D.data<=$.value)B=this._getOrReturnCtx(D,B),M(B,{code:_.too_small,minimum:$.value,type:"number",inclusive:$.inclusive,exact:!1,message:$.message}),E.dirty()}else if($.kind==="max"){if($.inclusive?D.data>$.value:D.data>=$.value)B=this._getOrReturnCtx(D,B),M(B,{code:_.too_big,maximum:$.value,type:"number",inclusive:$.inclusive,exact:!1,message:$.message}),E.dirty()}else if($.kind==="multipleOf"){if(E5(D.data,$.value)!==0)B=this._getOrReturnCtx(D,B),M(B,{code:_.not_multiple_of,multipleOf:$.value,message:$.message}),E.dirty()}else if($.kind==="finite"){if(!Number.isFinite(D.data))B=this._getOrReturnCtx(D,B),M(B,{code:_.not_finite,message:$.message}),E.dirty()}else u.assertNever($);return{status:E.value,value:D.data}}gte(D,F){return this.setLimit("min",D,!0,C.toString(F))}gt(D,F){return this.setLimit("min",D,!1,C.toString(F))}lte(D,F){return this.setLimit("max",D,!0,C.toString(F))}lt(D,F){return this.setLimit("max",D,!1,C.toString(F))}setLimit(D,F,B,E){return new wD({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:B,message:C.toString(E)}]})}_addCheck(D){return new wD({...this._def,checks:[...this._def.checks,D]})}int(D){return this._addCheck({kind:"int",message:C.toString(D)})}positive(D){return this._addCheck({kind:"min",value:0,inclusive:!1,message:C.toString(D)})}negative(D){return this._addCheck({kind:"max",value:0,inclusive:!1,message:C.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:0,inclusive:!0,message:C.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:0,inclusive:!0,message:C.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:C.toString(F)})}finite(D){return this._addCheck({kind:"finite",message:C.toString(D)})}safe(D){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:C.toString(D)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:C.toString(D)})}get minValue(){let D=null;for(let F of this._def.checks)if(F.kind==="min"){if(D===null||F.value>D)D=F.value}return D}get maxValue(){let D=null;for(let F of this._def.checks)if(F.kind==="max"){if(D===null||F.value<D)D=F.value}return D}get isInt(){return!!this._def.checks.find((D)=>D.kind==="int"||D.kind==="multipleOf"&&u.isInteger(D.value))}get isFinite(){let D=null,F=null;for(let B of this._def.checks)if(B.kind==="finite"||B.kind==="int"||B.kind==="multipleOf")return!0;else if(B.kind==="min"){if(F===null||B.value>F)F=B.value}else if(B.kind==="max"){if(D===null||B.value<D)D=B.value}return Number.isFinite(F)&&Number.isFinite(D)}}wD.create=(D)=>{return new wD({checks:[],typeName:j.ZodNumber,coerce:D?.coerce||!1,...L(D)})};class SD extends S{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(D){if(this._def.coerce)try{D.data=BigInt(D.data)}catch{return this._getInvalidInput(D)}if(this._getType(D)!==H.bigint)return this._getInvalidInput(D);let B=void 0,E=new m;for(let $ of this._def.checks)if($.kind==="min"){if($.inclusive?D.data<$.value:D.data<=$.value)B=this._getOrReturnCtx(D,B),M(B,{code:_.too_small,type:"bigint",minimum:$.value,inclusive:$.inclusive,message:$.message}),E.dirty()}else if($.kind==="max"){if($.inclusive?D.data>$.value:D.data>=$.value)B=this._getOrReturnCtx(D,B),M(B,{code:_.too_big,type:"bigint",maximum:$.value,inclusive:$.inclusive,message:$.message}),E.dirty()}else if($.kind==="multipleOf"){if(D.data%$.value!==BigInt(0))B=this._getOrReturnCtx(D,B),M(B,{code:_.not_multiple_of,multipleOf:$.value,message:$.message}),E.dirty()}else u.assertNever($);return{status:E.value,value:D.data}}_getInvalidInput(D){let F=this._getOrReturnCtx(D);return M(F,{code:_.invalid_type,expected:H.bigint,received:F.parsedType}),U}gte(D,F){return this.setLimit("min",D,!0,C.toString(F))}gt(D,F){return this.setLimit("min",D,!1,C.toString(F))}lte(D,F){return this.setLimit("max",D,!0,C.toString(F))}lt(D,F){return this.setLimit("max",D,!1,C.toString(F))}setLimit(D,F,B,E){return new SD({...this._def,checks:[...this._def.checks,{kind:D,value:F,inclusive:B,message:C.toString(E)}]})}_addCheck(D){return new SD({...this._def,checks:[...this._def.checks,D]})}positive(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:C.toString(D)})}negative(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:C.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:C.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:C.toString(D)})}multipleOf(D,F){return this._addCheck({kind:"multipleOf",value:D,message:C.toString(F)})}get minValue(){let D=null;for(let F of this._def.checks)if(F.kind==="min"){if(D===null||F.value>D)D=F.value}return D}get maxValue(){let D=null;for(let F of this._def.checks)if(F.kind==="max"){if(D===null||F.value<D)D=F.value}return D}}SD.create=(D)=>{return new SD({checks:[],typeName:j.ZodBigInt,coerce:D?.coerce??!1,...L(D)})};class X2 extends S{_parse(D){if(this._def.coerce)D.data=Boolean(D.data);if(this._getType(D)!==H.boolean){let B=this._getOrReturnCtx(D);return M(B,{code:_.invalid_type,expected:H.boolean,received:B.parsedType}),U}return l(D.data)}}X2.create=(D)=>{return new X2({typeName:j.ZodBoolean,coerce:D?.coerce||!1,...L(D)})};class gD extends S{_parse(D){if(this._def.coerce)D.data=new Date(D.data);if(this._getType(D)!==H.date){let $=this._getOrReturnCtx(D);return M($,{code:_.invalid_type,expected:H.date,received:$.parsedType}),U}if(Number.isNaN(D.data.getTime())){let $=this._getOrReturnCtx(D);return M($,{code:_.invalid_date}),U}let B=new m,E=void 0;for(let $ of this._def.checks)if($.kind==="min"){if(D.data.getTime()<$.value)E=this._getOrReturnCtx(D,E),M(E,{code:_.too_small,message:$.message,inclusive:!0,exact:!1,minimum:$.value,type:"date"}),B.dirty()}else if($.kind==="max"){if(D.data.getTime()>$.value)E=this._getOrReturnCtx(D,E),M(E,{code:_.too_big,message:$.message,inclusive:!0,exact:!1,maximum:$.value,type:"date"}),B.dirty()}else u.assertNever($);return{status:B.value,value:new Date(D.data.getTime())}}_addCheck(D){return new gD({...this._def,checks:[...this._def.checks,D]})}min(D,F){return this._addCheck({kind:"min",value:D.getTime(),message:C.toString(F)})}max(D,F){return this._addCheck({kind:"max",value:D.getTime(),message:C.toString(F)})}get minDate(){let D=null;for(let F of this._def.checks)if(F.kind==="min"){if(D===null||F.value>D)D=F.value}return D!=null?new Date(D):null}get maxDate(){let D=null;for(let F of this._def.checks)if(F.kind==="max"){if(D===null||F.value<D)D=F.value}return D!=null?new Date(D):null}}gD.create=(D)=>{return new gD({checks:[],coerce:D?.coerce||!1,typeName:j.ZodDate,...L(D)})};class I2 extends S{_parse(D){if(this._getType(D)!==H.symbol){let B=this._getOrReturnCtx(D);return M(B,{code:_.invalid_type,expected:H.symbol,received:B.parsedType}),U}return l(D.data)}}I2.create=(D)=>{return new I2({typeName:j.ZodSymbol,...L(D)})};class J2 extends S{_parse(D){if(this._getType(D)!==H.undefined){let B=this._getOrReturnCtx(D);return M(B,{code:_.invalid_type,expected:H.undefined,received:B.parsedType}),U}return l(D.data)}}J2.create=(D)=>{return new J2({typeName:j.ZodUndefined,...L(D)})};class Q2 extends S{_parse(D){if(this._getType(D)!==H.null){let B=this._getOrReturnCtx(D);return M(B,{code:_.invalid_type,expected:H.null,received:B.parsedType}),U}return l(D.data)}}Q2.create=(D)=>{return new Q2({typeName:j.ZodNull,...L(D)})};class mD extends S{constructor(){super(...arguments);this._any=!0}_parse(D){return l(D.data)}}mD.create=(D)=>{return new mD({typeName:j.ZodAny,...L(D)})};class OD extends S{constructor(){super(...arguments);this._unknown=!0}_parse(D){return l(D.data)}}OD.create=(D)=>{return new OD({typeName:j.ZodUnknown,...L(D)})};class _D extends S{_parse(D){let F=this._getOrReturnCtx(D);return M(F,{code:_.invalid_type,expected:H.never,received:F.parsedType}),U}}_D.create=(D)=>{return new _D({typeName:j.ZodNever,...L(D)})};class T2 extends S{_parse(D){if(this._getType(D)!==H.undefined){let B=this._getOrReturnCtx(D);return M(B,{code:_.invalid_type,expected:H.void,received:B.parsedType}),U}return l(D.data)}}T2.create=(D)=>{return new T2({typeName:j.ZodVoid,...L(D)})};class FD extends S{_parse(D){let{ctx:F,status:B}=this._processInputParams(D),E=this._def;if(F.parsedType!==H.array)return M(F,{code:_.invalid_type,expected:H.array,received:F.parsedType}),U;if(E.exactLength!==null){let X=F.data.length>E.exactLength.value,J=F.data.length<E.exactLength.value;if(X||J)M(F,{code:X?_.too_big:_.too_small,minimum:J?E.exactLength.value:void 0,maximum:X?E.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:E.exactLength.message}),B.dirty()}if(E.minLength!==null){if(F.data.length<E.minLength.value)M(F,{code:_.too_small,minimum:E.minLength.value,type:"array",inclusive:!0,exact:!1,message:E.minLength.message}),B.dirty()}if(E.maxLength!==null){if(F.data.length>E.maxLength.value)M(F,{code:_.too_big,maximum:E.maxLength.value,type:"array",inclusive:!0,exact:!1,message:E.maxLength.message}),B.dirty()}if(F.common.async)return Promise.all([...F.data].map((X,J)=>{return E.type._parseAsync(new ED(F,X,F.path,J))})).then((X)=>{return m.mergeArray(B,X)});let $=[...F.data].map((X,J)=>{return E.type._parseSync(new ED(F,X,F.path,J))});return m.mergeArray(B,$)}get element(){return this._def.type}min(D,F){return new FD({...this._def,minLength:{value:D,message:C.toString(F)}})}max(D,F){return new FD({...this._def,maxLength:{value:D,message:C.toString(F)}})}length(D,F){return new FD({...this._def,exactLength:{value:D,message:C.toString(F)}})}nonempty(D){return this.min(1,D)}}FD.create=(D,F)=>{return new FD({type:D,minLength:null,maxLength:null,exactLength:null,typeName:j.ZodArray,...L(F)})};function E2(D){if(D instanceof x){let F={};for(let B in D.shape){let E=D.shape[B];F[B]=BD.create(E2(E))}return new x({...D._def,shape:()=>F})}else if(D instanceof FD)return new FD({...D._def,type:E2(D.element)});else if(D instanceof BD)return BD.create(E2(D.unwrap()));else if(D instanceof UD)return UD.create(E2(D.unwrap()));else if(D instanceof HD)return HD.create(D.items.map((F)=>E2(F)));else return D}class x extends S{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let D=this._def.shape(),F=u.objectKeys(D);return this._cached={shape:D,keys:F},this._cached}_parse(D){if(this._getType(D)!==H.object){let Y=this._getOrReturnCtx(D);return M(Y,{code:_.invalid_type,expected:H.object,received:Y.parsedType}),U}let{status:B,ctx:E}=this._processInputParams(D),{shape:$,keys:X}=this._getCached(),J=[];if(!(this._def.catchall instanceof _D&&this._def.unknownKeys==="strip")){for(let Y in E.data)if(!X.includes(Y))J.push(Y)}let Q=[];for(let Y of X){let W=$[Y],q=E.data[Y];Q.push({key:{status:"valid",value:Y},value:W._parse(new ED(E,q,E.path,Y)),alwaysSet:Y in E.data})}if(this._def.catchall instanceof _D){let Y=this._def.unknownKeys;if(Y==="passthrough")for(let W of J)Q.push({key:{status:"valid",value:W},value:{status:"valid",value:E.data[W]}});else if(Y==="strict"){if(J.length>0)M(E,{code:_.unrecognized_keys,keys:J}),B.dirty()}else if(Y==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let Y=this._def.catchall;for(let W of J){let q=E.data[W];Q.push({key:{status:"valid",value:W},value:Y._parse(new ED(E,q,E.path,W)),alwaysSet:W in E.data})}}if(E.common.async)return Promise.resolve().then(async()=>{let Y=[];for(let W of Q){let q=await W.key,G=await W.value;Y.push({key:q,value:G,alwaysSet:W.alwaysSet})}return Y}).then((Y)=>{return m.mergeObjectSync(B,Y)});else return m.mergeObjectSync(B,Q)}get shape(){return this._def.shape()}strict(D){return C.errToObj,new x({...this._def,unknownKeys:"strict",...D!==void 0?{errorMap:(F,B)=>{let E=this._def.errorMap?.(F,B).message??B.defaultError;if(F.code==="unrecognized_keys")return{message:C.errToObj(D).message??E};return{message:E}}}:{}})}strip(){return new x({...this._def,unknownKeys:"strip"})}passthrough(){return new x({...this._def,unknownKeys:"passthrough"})}extend(D){return new x({...this._def,shape:()=>({...this._def.shape(),...D})})}merge(D){return new x({unknownKeys:D._def.unknownKeys,catchall:D._def.catchall,shape:()=>({...this._def.shape(),...D._def.shape()}),typeName:j.ZodObject})}setKey(D,F){return this.augment({[D]:F})}catchall(D){return new x({...this._def,catchall:D})}pick(D){let F={};for(let B of u.objectKeys(D))if(D[B]&&this.shape[B])F[B]=this.shape[B];return new x({...this._def,shape:()=>F})}omit(D){let F={};for(let B of u.objectKeys(this.shape))if(!D[B])F[B]=this.shape[B];return new x({...this._def,shape:()=>F})}deepPartial(){return E2(this)}partial(D){let F={};for(let B of u.objectKeys(this.shape)){let E=this.shape[B];if(D&&!D[B])F[B]=E;else F[B]=E.optional()}return new x({...this._def,shape:()=>F})}required(D){let F={};for(let B of u.objectKeys(this.shape))if(D&&!D[B])F[B]=this.shape[B];else{let $=this.shape[B];while($ instanceof BD)$=$._def.innerType;F[B]=$}return new x({...this._def,shape:()=>F})}keyof(){return r8(u.objectKeys(this.shape))}}x.create=(D,F)=>{return new x({shape:()=>D,unknownKeys:"strip",catchall:_D.create(),typeName:j.ZodObject,...L(F)})};x.strictCreate=(D,F)=>{return new x({shape:()=>D,unknownKeys:"strict",catchall:_D.create(),typeName:j.ZodObject,...L(F)})};x.lazycreate=(D,F)=>{return new x({shape:D,unknownKeys:"strip",catchall:_D.create(),typeName:j.ZodObject,...L(F)})};class Y2 extends S{_parse(D){let{ctx:F}=this._processInputParams(D),B=this._def.options;function E($){for(let J of $)if(J.result.status==="valid")return J.result;for(let J of $)if(J.result.status==="dirty")return F.common.issues.push(...J.ctx.common.issues),J.result;let X=$.map((J)=>new d(J.ctx.common.issues));return M(F,{code:_.invalid_union,unionErrors:X}),U}if(F.common.async)return Promise.all(B.map(async($)=>{let X={...F,common:{...F.common,issues:[]},parent:null};return{result:await $._parseAsync({data:F.data,path:F.path,parent:X}),ctx:X}})).then(E);else{let $=void 0,X=[];for(let Q of B){let Y={...F,common:{...F.common,issues:[]},parent:null},W=Q._parseSync({data:F.data,path:F.path,parent:Y});if(W.status==="valid")return W;else if(W.status==="dirty"&&!$)$={result:W,ctx:Y};if(Y.common.issues.length)X.push(Y.common.issues)}if($)return F.common.issues.push(...$.ctx.common.issues),$.result;let J=X.map((Q)=>new d(Q));return M(F,{code:_.invalid_union,unionErrors:J}),U}}get options(){return this._def.options}}Y2.create=(D,F)=>{return new Y2({options:D,typeName:j.ZodUnion,...L(F)})};var CD=(D)=>{if(D instanceof q2)return CD(D.schema);else if(D instanceof $D)return CD(D.innerType());else if(D instanceof _2)return[D.value];else if(D instanceof uD)return D.options;else if(D instanceof H2)return u.objectValues(D.enum);else if(D instanceof G2)return CD(D._def.innerType);else if(D instanceof J2)return[void 0];else if(D instanceof Q2)return[null];else if(D instanceof BD)return[void 0,...CD(D.unwrap())];else if(D instanceof UD)return[null,...CD(D.unwrap())];else if(D instanceof B0)return CD(D.unwrap());else if(D instanceof A2)return CD(D.unwrap());else if(D instanceof M2)return CD(D._def.innerType);else return[]};class F0 extends S{_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==H.object)return M(F,{code:_.invalid_type,expected:H.object,received:F.parsedType}),U;let B=this.discriminator,E=F.data[B],$=this.optionsMap.get(E);if(!$)return M(F,{code:_.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[B]}),U;if(F.common.async)return $._parseAsync({data:F.data,path:F.path,parent:F});else return $._parseSync({data:F.data,path:F.path,parent:F})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(D,F,B){let E=new Map;for(let $ of F){let X=CD($.shape[D]);if(!X.length)throw Error(`A discriminator value for key \`${D}\` could not be extracted from all schema options`);for(let J of X){if(E.has(J))throw Error(`Discriminator property ${String(D)} has duplicate value ${String(J)}`);E.set(J,$)}}return new F0({typeName:j.ZodDiscriminatedUnion,discriminator:D,options:F,optionsMap:E,...L(B)})}}function J3(D,F){let B=qD(D),E=qD(F);if(D===F)return{valid:!0,data:D};else if(B===H.object&&E===H.object){let $=u.objectKeys(F),X=u.objectKeys(D).filter((Q)=>$.indexOf(Q)!==-1),J={...D,...F};for(let Q of X){let Y=J3(D[Q],F[Q]);if(!Y.valid)return{valid:!1};J[Q]=Y.data}return{valid:!0,data:J}}else if(B===H.array&&E===H.array){if(D.length!==F.length)return{valid:!1};let $=[];for(let X=0;X<D.length;X++){let J=D[X],Q=F[X],Y=J3(J,Q);if(!Y.valid)return{valid:!1};$.push(Y.data)}return{valid:!0,data:$}}else if(B===H.date&&E===H.date&&+D===+F)return{valid:!0,data:D};else return{valid:!1}}class W2 extends S{_parse(D){let{status:F,ctx:B}=this._processInputParams(D),E=($,X)=>{if(e2($)||e2(X))return U;let J=J3($.value,X.value);if(!J.valid)return M(B,{code:_.invalid_intersection_types}),U;if(D0($)||D0(X))F.dirty();return{status:F.value,value:J.data}};if(B.common.async)return Promise.all([this._def.left._parseAsync({data:B.data,path:B.path,parent:B}),this._def.right._parseAsync({data:B.data,path:B.path,parent:B})]).then(([$,X])=>E($,X));else return E(this._def.left._parseSync({data:B.data,path:B.path,parent:B}),this._def.right._parseSync({data:B.data,path:B.path,parent:B}))}}W2.create=(D,F,B)=>{return new W2({left:D,right:F,typeName:j.ZodIntersection,...L(B)})};class HD extends S{_parse(D){let{status:F,ctx:B}=this._processInputParams(D);if(B.parsedType!==H.array)return M(B,{code:_.invalid_type,expected:H.array,received:B.parsedType}),U;if(B.data.length<this._def.items.length)return M(B,{code:_.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),U;if(!this._def.rest&&B.data.length>this._def.items.length)M(B,{code:_.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F.dirty();let $=[...B.data].map((X,J)=>{let Q=this._def.items[J]||this._def.rest;if(!Q)return null;return Q._parse(new ED(B,X,B.path,J))}).filter((X)=>!!X);if(B.common.async)return Promise.all($).then((X)=>{return m.mergeArray(F,X)});else return m.mergeArray(F,$)}get items(){return this._def.items}rest(D){return new HD({...this._def,rest:D})}}HD.create=(D,F)=>{if(!Array.isArray(D))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new HD({items:D,typeName:j.ZodTuple,rest:null,...L(F)})};class b2 extends S{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:B}=this._processInputParams(D);if(B.parsedType!==H.object)return M(B,{code:_.invalid_type,expected:H.object,received:B.parsedType}),U;let E=[],$=this._def.keyType,X=this._def.valueType;for(let J in B.data)E.push({key:$._parse(new ED(B,J,B.path,J)),value:X._parse(new ED(B,B.data[J],B.path,J)),alwaysSet:J in B.data});if(B.common.async)return m.mergeObjectAsync(F,E);else return m.mergeObjectSync(F,E)}get element(){return this._def.valueType}static create(D,F,B){if(F instanceof S)return new b2({keyType:D,valueType:F,typeName:j.ZodRecord,...L(B)});return new b2({keyType:DD.create(),valueType:D,typeName:j.ZodRecord,...L(F)})}}class P2 extends S{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:F,ctx:B}=this._processInputParams(D);if(B.parsedType!==H.map)return M(B,{code:_.invalid_type,expected:H.map,received:B.parsedType}),U;let E=this._def.keyType,$=this._def.valueType,X=[...B.data.entries()].map(([J,Q],Y)=>{return{key:E._parse(new ED(B,J,B.path,[Y,"key"])),value:$._parse(new ED(B,Q,B.path,[Y,"value"]))}});if(B.common.async){let J=new Map;return Promise.resolve().then(async()=>{for(let Q of X){let Y=await Q.key,W=await Q.value;if(Y.status==="aborted"||W.status==="aborted")return U;if(Y.status==="dirty"||W.status==="dirty")F.dirty();J.set(Y.value,W.value)}return{status:F.value,value:J}})}else{let J=new Map;for(let Q of X){let{key:Y,value:W}=Q;if(Y.status==="aborted"||W.status==="aborted")return U;if(Y.status==="dirty"||W.status==="dirty")F.dirty();J.set(Y.value,W.value)}return{status:F.value,value:J}}}}P2.create=(D,F,B)=>{return new P2({valueType:F,keyType:D,typeName:j.ZodMap,...L(B)})};class lD extends S{_parse(D){let{status:F,ctx:B}=this._processInputParams(D);if(B.parsedType!==H.set)return M(B,{code:_.invalid_type,expected:H.set,received:B.parsedType}),U;let E=this._def;if(E.minSize!==null){if(B.data.size<E.minSize.value)M(B,{code:_.too_small,minimum:E.minSize.value,type:"set",inclusive:!0,exact:!1,message:E.minSize.message}),F.dirty()}if(E.maxSize!==null){if(B.data.size>E.maxSize.value)M(B,{code:_.too_big,maximum:E.maxSize.value,type:"set",inclusive:!0,exact:!1,message:E.maxSize.message}),F.dirty()}let $=this._def.valueType;function X(Q){let Y=new Set;for(let W of Q){if(W.status==="aborted")return U;if(W.status==="dirty")F.dirty();Y.add(W.value)}return{status:F.value,value:Y}}let J=[...B.data.values()].map((Q,Y)=>$._parse(new ED(B,Q,B.path,Y)));if(B.common.async)return Promise.all(J).then((Q)=>X(Q));else return X(J)}min(D,F){return new lD({...this._def,minSize:{value:D,message:C.toString(F)}})}max(D,F){return new lD({...this._def,maxSize:{value:D,message:C.toString(F)}})}size(D,F){return this.min(D,F).max(D,F)}nonempty(D){return this.min(1,D)}}lD.create=(D,F)=>{return new lD({valueType:D,minSize:null,maxSize:null,typeName:j.ZodSet,...L(F)})};class $2 extends S{constructor(){super(...arguments);this.validate=this.implement}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==H.function)return M(F,{code:_.invalid_type,expected:H.function,received:F.parsedType}),U;function B(J,Q){return u2({data:J,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,F2(),zD].filter((Y)=>!!Y),issueData:{code:_.invalid_arguments,argumentsError:Q}})}function E(J,Q){return u2({data:J,path:F.path,errorMaps:[F.common.contextualErrorMap,F.schemaErrorMap,F2(),zD].filter((Y)=>!!Y),issueData:{code:_.invalid_return_type,returnTypeError:Q}})}let $={errorMap:F.common.contextualErrorMap},X=F.data;if(this._def.returns instanceof pD){let J=this;return l(async function(...Q){let Y=new d([]),W=await J._def.args.parseAsync(Q,$).catch((R)=>{throw Y.addIssue(B(Q,R)),Y}),q=await Reflect.apply(X,this,W);return await J._def.returns._def.type.parseAsync(q,$).catch((R)=>{throw Y.addIssue(E(q,R)),Y})})}else{let J=this;return l(function(...Q){let Y=J._def.args.safeParse(Q,$);if(!Y.success)throw new d([B(Q,Y.error)]);let W=Reflect.apply(X,this,Y.data),q=J._def.returns.safeParse(W,$);if(!q.success)throw new d([E(W,q.error)]);return q.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...D){return new $2({...this._def,args:HD.create(D).rest(OD.create())})}returns(D){return new $2({...this._def,returns:D})}implement(D){return this.parse(D)}strictImplement(D){return this.parse(D)}static create(D,F,B){return new $2({args:D?D:HD.create([]).rest(OD.create()),returns:F||OD.create(),typeName:j.ZodFunction,...L(B)})}}class q2 extends S{get schema(){return this._def.getter()}_parse(D){let{ctx:F}=this._processInputParams(D);return this._def.getter()._parse({data:F.data,path:F.path,parent:F})}}q2.create=(D,F)=>{return new q2({getter:D,typeName:j.ZodLazy,...L(F)})};class _2 extends S{_parse(D){if(D.data!==this._def.value){let F=this._getOrReturnCtx(D);return M(F,{received:F.data,code:_.invalid_literal,expected:this._def.value}),U}return{status:"valid",value:D.data}}get value(){return this._def.value}}_2.create=(D,F)=>{return new _2({value:D,typeName:j.ZodLiteral,...L(F)})};function r8(D,F){return new uD({values:D,typeName:j.ZodEnum,...L(F)})}class uD extends S{_parse(D){if(typeof D.data!=="string"){let F=this._getOrReturnCtx(D),B=this._def.values;return M(F,{expected:u.joinValues(B),received:F.parsedType,code:_.invalid_type}),U}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(D.data)){let F=this._getOrReturnCtx(D),B=this._def.values;return M(F,{received:F.data,code:_.invalid_enum_value,options:B}),U}return l(D.data)}get options(){return this._def.values}get enum(){let D={};for(let F of this._def.values)D[F]=F;return D}get Values(){let D={};for(let F of this._def.values)D[F]=F;return D}get Enum(){let D={};for(let F of this._def.values)D[F]=F;return D}extract(D,F=this._def){return uD.create(D,{...this._def,...F})}exclude(D,F=this._def){return uD.create(this.options.filter((B)=>!D.includes(B)),{...this._def,...F})}}uD.create=r8;class H2 extends S{_parse(D){let F=u.getValidEnumValues(this._def.values),B=this._getOrReturnCtx(D);if(B.parsedType!==H.string&&B.parsedType!==H.number){let E=u.objectValues(F);return M(B,{expected:u.joinValues(E),received:B.parsedType,code:_.invalid_type}),U}if(!this._cache)this._cache=new Set(u.getValidEnumValues(this._def.values));if(!this._cache.has(D.data)){let E=u.objectValues(F);return M(B,{received:B.data,code:_.invalid_enum_value,options:E}),U}return l(D.data)}get enum(){return this._def.values}}H2.create=(D,F)=>{return new H2({values:D,typeName:j.ZodNativeEnum,...L(F)})};class pD extends S{unwrap(){return this._def.type}_parse(D){let{ctx:F}=this._processInputParams(D);if(F.parsedType!==H.promise&&F.common.async===!1)return M(F,{code:_.invalid_type,expected:H.promise,received:F.parsedType}),U;let B=F.parsedType===H.promise?F.data:Promise.resolve(F.data);return l(B.then((E)=>{return this._def.type.parseAsync(E,{path:F.path,errorMap:F.common.contextualErrorMap})}))}}pD.create=(D,F)=>{return new pD({type:D,typeName:j.ZodPromise,...L(F)})};class $D extends S{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===j.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(D){let{status:F,ctx:B}=this._processInputParams(D),E=this._def.effect||null,$={addIssue:(X)=>{if(M(B,X),X.fatal)F.abort();else F.dirty()},get path(){return B.path}};if($.addIssue=$.addIssue.bind($),E.type==="preprocess"){let X=E.transform(B.data,$);if(B.common.async)return Promise.resolve(X).then(async(J)=>{if(F.value==="aborted")return U;let Q=await this._def.schema._parseAsync({data:J,path:B.path,parent:B});if(Q.status==="aborted")return U;if(Q.status==="dirty")return hD(Q.value);if(F.value==="dirty")return hD(Q.value);return Q});else{if(F.value==="aborted")return U;let J=this._def.schema._parseSync({data:X,path:B.path,parent:B});if(J.status==="aborted")return U;if(J.status==="dirty")return hD(J.value);if(F.value==="dirty")return hD(J.value);return J}}if(E.type==="refinement"){let X=(J)=>{let Q=E.refinement(J,$);if(B.common.async)return Promise.resolve(Q);if(Q instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return J};if(B.common.async===!1){let J=this._def.schema._parseSync({data:B.data,path:B.path,parent:B});if(J.status==="aborted")return U;if(J.status==="dirty")F.dirty();return X(J.value),{status:F.value,value:J.value}}else return this._def.schema._parseAsync({data:B.data,path:B.path,parent:B}).then((J)=>{if(J.status==="aborted")return U;if(J.status==="dirty")F.dirty();return X(J.value).then(()=>{return{status:F.value,value:J.value}})})}if(E.type==="transform")if(B.common.async===!1){let X=this._def.schema._parseSync({data:B.data,path:B.path,parent:B});if(!LD(X))return U;let J=E.transform(X.value,$);if(J instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:F.value,value:J}}else return this._def.schema._parseAsync({data:B.data,path:B.path,parent:B}).then((X)=>{if(!LD(X))return U;return Promise.resolve(E.transform(X.value,$)).then((J)=>({status:F.value,value:J}))});u.assertNever(E)}}$D.create=(D,F,B)=>{return new $D({schema:D,typeName:j.ZodEffects,effect:F,...L(B)})};$D.createWithPreprocess=(D,F,B)=>{return new $D({schema:F,effect:{type:"preprocess",transform:D},typeName:j.ZodEffects,...L(B)})};class BD extends S{_parse(D){if(this._getType(D)===H.undefined)return l(void 0);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}}BD.create=(D,F)=>{return new BD({innerType:D,typeName:j.ZodOptional,...L(F)})};class UD extends S{_parse(D){if(this._getType(D)===H.null)return l(null);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}}UD.create=(D,F)=>{return new UD({innerType:D,typeName:j.ZodNullable,...L(F)})};class G2 extends S{_parse(D){let{ctx:F}=this._processInputParams(D),B=F.data;if(F.parsedType===H.undefined)B=this._def.defaultValue();return this._def.innerType._parse({data:B,path:F.path,parent:F})}removeDefault(){return this._def.innerType}}G2.create=(D,F)=>{return new G2({innerType:D,typeName:j.ZodDefault,defaultValue:typeof F.default==="function"?F.default:()=>F.default,...L(F)})};class M2 extends S{_parse(D){let{ctx:F}=this._processInputParams(D),B={...F,common:{...F.common,issues:[]}},E=this._def.innerType._parse({data:B.data,path:B.path,parent:{...B}});if(B2(E))return E.then(($)=>{return{status:"valid",value:$.status==="valid"?$.value:this._def.catchValue({get error(){return new d(B.common.issues)},input:B.data})}});else return{status:"valid",value:E.status==="valid"?E.value:this._def.catchValue({get error(){return new d(B.common.issues)},input:B.data})}}removeCatch(){return this._def.innerType}}M2.create=(D,F)=>{return new M2({innerType:D,typeName:j.ZodCatch,catchValue:typeof F.catch==="function"?F.catch:()=>F.catch,...L(F)})};class k2 extends S{_parse(D){if(this._getType(D)!==H.nan){let B=this._getOrReturnCtx(D);return M(B,{code:_.invalid_type,expected:H.nan,received:B.parsedType}),U}return{status:"valid",value:D.data}}}k2.create=(D)=>{return new k2({typeName:j.ZodNaN,...L(D)})};var $5=Symbol("zod_brand");class B0 extends S{_parse(D){let{ctx:F}=this._processInputParams(D),B=F.data;return this._def.type._parse({data:B,path:F.path,parent:F})}unwrap(){return this._def.type}}class v2 extends S{_parse(D){let{status:F,ctx:B}=this._processInputParams(D);if(B.common.async)return(async()=>{let $=await this._def.in._parseAsync({data:B.data,path:B.path,parent:B});if($.status==="aborted")return U;if($.status==="dirty")return F.dirty(),hD($.value);else return this._def.out._parseAsync({data:$.value,path:B.path,parent:B})})();else{let E=this._def.in._parseSync({data:B.data,path:B.path,parent:B});if(E.status==="aborted")return U;if(E.status==="dirty")return F.dirty(),{status:"dirty",value:E.value};else return this._def.out._parseSync({data:E.value,path:B.path,parent:B})}}static create(D,F){return new v2({in:D,out:F,typeName:j.ZodPipeline})}}class A2 extends S{_parse(D){let F=this._def.innerType._parse(D),B=(E)=>{if(LD(E))E.value=Object.freeze(E.value);return E};return B2(F)?F.then((E)=>B(E)):B(F)}unwrap(){return this._def.innerType}}A2.create=(D,F)=>{return new A2({innerType:D,typeName:j.ZodReadonly,...L(F)})};function c8(D,F){let B=typeof D==="function"?D(F):typeof D==="string"?{message:D}:D;return typeof B==="string"?{message:B}:B}function o8(D,F={},B){if(D)return mD.create().superRefine((E,$)=>{let X=D(E);if(X instanceof Promise)return X.then((J)=>{if(!J){let Q=c8(F,E),Y=Q.fatal??B??!0;$.addIssue({code:"custom",...Q,fatal:Y})}});if(!X){let J=c8(F,E),Q=J.fatal??B??!0;$.addIssue({code:"custom",...J,fatal:Q})}return});return mD.create()}var X5={object:x.lazycreate},j;(function(D){D.ZodString="ZodString",D.ZodNumber="ZodNumber",D.ZodNaN="ZodNaN",D.ZodBigInt="ZodBigInt",D.ZodBoolean="ZodBoolean",D.ZodDate="ZodDate",D.ZodSymbol="ZodSymbol",D.ZodUndefined="ZodUndefined",D.ZodNull="ZodNull",D.ZodAny="ZodAny",D.ZodUnknown="ZodUnknown",D.ZodNever="ZodNever",D.ZodVoid="ZodVoid",D.ZodArray="ZodArray",D.ZodObject="ZodObject",D.ZodUnion="ZodUnion",D.ZodDiscriminatedUnion="ZodDiscriminatedUnion",D.ZodIntersection="ZodIntersection",D.ZodTuple="ZodTuple",D.ZodRecord="ZodRecord",D.ZodMap="ZodMap",D.ZodSet="ZodSet",D.ZodFunction="ZodFunction",D.ZodLazy="ZodLazy",D.ZodLiteral="ZodLiteral",D.ZodEnum="ZodEnum",D.ZodEffects="ZodEffects",D.ZodNativeEnum="ZodNativeEnum",D.ZodOptional="ZodOptional",D.ZodNullable="ZodNullable",D.ZodDefault="ZodDefault",D.ZodCatch="ZodCatch",D.ZodPromise="ZodPromise",D.ZodBranded="ZodBranded",D.ZodPipeline="ZodPipeline",D.ZodReadonly="ZodReadonly"})(j||(j={}));var J5=(D,F={message:`Input not instance of ${D.name}`})=>o8((B)=>B instanceof D,F),s8=DD.create,t8=wD.create,Q5=k2.create,Y5=SD.create,e8=X2.create,W5=gD.create,q5=I2.create,_5=J2.create,H5=Q2.create,G5=mD.create,M5=OD.create,A5=_D.create,z5=T2.create,C5=FD.create,U5=x.create,j5=x.strictCreate,R5=Y2.create,V5=F0.create,K5=W2.create,N5=HD.create,L5=b2.create,O5=P2.create,w5=lD.create,S5=$2.create,u5=q2.create,I5=_2.create,T5=uD.create,b5=H2.create,P5=pD.create,k5=$D.create,v5=BD.create,Z5=UD.create,f5=$D.createWithPreprocess,x5=v2.create,y5=()=>s8().optional(),h5=()=>t8().optional(),g5=()=>e8().optional(),m5={string:(D)=>DD.create({...D,coerce:!0}),number:(D)=>wD.create({...D,coerce:!0}),boolean:(D)=>X2.create({...D,coerce:!0}),bigint:(D)=>SD.create({...D,coerce:!0}),date:(D)=>gD.create({...D,coerce:!0})};var l5=U;var p5=T.object({allowedPaths:T.array(T.string()).default(["~/projects","/tmp"])}),d5=T.object({logPath:T.string().default("~/.genie/audit.log")}),c5=T.object({alwaysAsk:T.array(T.string()).default(["Write","Edit"])}),n5=T.object({sessionName:T.string().default("genie"),windowName:T.string().default("shell")}),i5=T.object({enabled:T.array(T.enum(["collaborative","supervised","sandboxed","audited"])).default([]),collaborative:n5.optional(),supervised:c5.optional(),sandboxed:p5.optional(),audited:d5.optional()}),a5=T.object({name:T.string().default("genie"),defaultWindow:T.string().default("shell")}),Z2=T.object({hooks:i5.default({}),session:a5.default({})}),E0=[{name:"collaborative",title:"Collaborative",what:"All terminal commands run through tmux",why:"You can watch AI work in real-time",how:"Bash commands \u2192 term exec genie:shell",recommended:!0},{name:"supervised",title:"Supervised",what:"File changes require your approval",why:"Prevents accidental overwrites",how:"Write/Edit tools always ask permission"},{name:"sandboxed",title:"Sandboxed",what:"Restrict file access to specific directories",why:"Protects sensitive areas of your system",how:"Operations outside sandbox are blocked"},{name:"audited",title:"Audited",what:"Log all AI tool usage to a file",why:"Review what the AI did after a session",how:"Every tool call \u2192 ~/.genie/audit.log"}];var $0=D6(t5(),".genie"),f2=D6($0,"config.json");function vB(){return $0}function X0(){return f2}function J0(){return Q3(f2)}function e5(){if(!Q3($0))r5($0,{recursive:!0})}async function jD(){if(!Q3(f2))return Z2.parse({});try{let D=o5(f2,"utf-8"),F=JSON.parse(D);return Z2.parse(F)}catch(D){return console.warn(`Warning: Invalid genie config, using defaults: ${D.message}`),Z2.parse({})}}async function Y3(D){e5();try{let F=Z2.parse(D),B=JSON.stringify(F,null,2);s5(f2,B,"utf-8")}catch(F){throw Error(`Failed to save genie config: ${F.message}`)}}function z2(D){let F=[];for(let B of D.hooks.enabled)switch(B){case"collaborative":{let E=D.hooks.collaborative||{},$=E.sessionName||"genie",X=E.windowName||"shell";F.push(`Collaborative: Bash \u2192 term exec ${$}:${X}`);break}case"supervised":{let $=(D.hooks.supervised||{}).alwaysAsk||["Write","Edit"];F.push(`Supervised: ${$.join(", ")} require approval`);break}case"sandboxed":{let $=(D.hooks.sandboxed||{}).allowedPaths||["~/projects","/tmp"];F.push(`Sandboxed: Restricted to ${$.join(", ")}`);break}case"audited":{let $=(D.hooks.audited||{}).logPath||"~/.genie/audit.log";F.push(`Audited: Logging to ${$}`);break}}return F}function F6(D){return D.hooks.enabled.length>0}function XE(D){let F=["collaborative","supervised","sandboxed","audited"];return D.split(",").map((E)=>E.trim().toLowerCase()).filter((E)=>F.includes(E))}import{homedir as B6}from"os";import{join as XD}from"path";import{existsSync as dD,readFileSync as E6,writeFileSync as B7,mkdirSync as E7,appendFileSync as W3}from"fs";import*as $6 from"readline";function X6(){return`# Warp-like keyboard shortcuts (generated by genie-cli)
47
+ # To use: add to ~/.tmux.conf or source this file
48
+
49
+ # Ctrl+T: New window (tab) in current session
50
+ bind-key -n C-t new-window
51
+
52
+ # Ctrl+S: Vertical split (requires stty -ixon in shell rc)
53
+ bind-key -n C-s split-window -v
54
+
55
+ # Alt+S: Horizontal split
56
+ bind-key -n M-s split-window -h
57
+ `}function J6(){return`# Warp-like extra keys (generated by genie-cli)
58
+ # To use: add to ~/.termux/termux.properties
59
+
60
+ # Extra keys row with F-keys for shortcuts
61
+ # F1=New Tab, F2=VSplit, F3=HSplit
62
+ extra-keys = [['ESC','TAB','CTRL','ALT','F1','F2','F3']]
63
+ `}function $7(){return`# Warp-like shortcuts (generated by genie-cli)
64
+ # To use: add to ~/.bashrc or ~/.zshrc
65
+
66
+ # Disable Ctrl+S flow control (required for Ctrl+S to work in tmux)
67
+ stty -ixon 2>/dev/null
68
+
69
+ # Genie shortcuts (for Termux extra keys F1-F3)
70
+ genie-new-tab() {
71
+ local session
72
+ session=$(tmux display-message -p '#S' 2>/dev/null)
73
+ if [ -n "$session" ]; then
74
+ tmux new-window
75
+ else
76
+ echo "Not in a tmux session"
77
+ fi
78
+ }
79
+
80
+ genie-vsplit() {
81
+ if tmux display-message -p '#S' >/dev/null 2>&1; then
82
+ tmux split-window -v
83
+ else
84
+ echo "Not in a tmux session"
85
+ fi
86
+ }
87
+
88
+ genie-hsplit() {
89
+ if tmux display-message -p '#S' >/dev/null 2>&1; then
90
+ tmux split-window -h
91
+ else
92
+ echo "Not in a tmux session"
93
+ fi
94
+ }
95
+
96
+ # Bind F1-F3 to genie shortcuts (works in Termux)
97
+ bind -x '"eOP":"genie-new-tab"' 2>/dev/null # F1
98
+ bind -x '"eOQ":"genie-vsplit"' 2>/dev/null # F2
99
+ bind -x '"eOR":"genie-hsplit"' 2>/dev/null # F3
100
+ `}function _3(){console.log(`
101
+ Warp-like Terminal Shortcuts for tmux + Termux
102
+
103
+ \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510
104
+ \u2502 Shortcut \u2502 Action \u2502
105
+ \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524
106
+ \u2502 Ctrl+T \u2502 New tab (window) in current session \u2502
107
+ \u2502 Ctrl+S \u2502 Vertical split in current session \u2502
108
+ \u2502 Alt+S \u2502 Horizontal split in current session \u2502
109
+ \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518
110
+
111
+ Termux Extra Keys (F1-F3):
112
+ F1 \u2192 New tab F2 \u2192 Vertical split
113
+ F3 \u2192 Horizontal split
114
+
115
+ Commands:
116
+ term shortcuts --tmux Output tmux.conf snippet
117
+ term shortcuts --termux Output termux.properties snippet
118
+ term shortcuts --install Install to config files
119
+ `)}async function C2(D){let F=$6.createInterface({input:process.stdin,output:process.stdout});return new Promise((B)=>{F.question(D,(E)=>{F.close(),B(E.trim().toLowerCase())})})}function cD(D,F){if(!dD(D))return!1;return E6(D,"utf-8").includes(F)}async function x2(){let D=B6(),F="generated by genie-cli";console.log(`Installing Warp-like shortcuts...
120
+ `);let B=XD(D,".tmux.conf");if(cD(B,"generated by genie-cli"))console.log("\u2713 tmux.conf already has genie shortcuts");else if(await C2(`Add shortcuts to ${B}? [Y/n] `)!=="n"){let Y=`
121
+ `+X6();W3(B,Y),console.log(`\u2705 Added to ${B}`)}else console.log("\u23ED\uFE0F Skipped tmux.conf");let E=dD(XD(D,".zshrc"))?XD(D,".zshrc"):XD(D,".bashrc");if(cD(E,"generated by genie-cli"))console.log(`\u2713 ${E} already has genie shortcuts`);else if(await C2(`Add shell functions to ${E}? [Y/n] `)!=="n"){let Y=`
122
+ `+$7();W3(E,Y),console.log(`\u2705 Added to ${E}`)}else console.log(`\u23ED\uFE0F Skipped ${E}`);let $=XD(D,".termux"),X=XD($,"termux.properties"),J=dD($)||process.env.TERMUX_VERSION;if(J)if(cD(X,"generated by genie-cli"))console.log("\u2713 termux.properties already has genie shortcuts");else if(await C2(`Add extra keys to ${X}? [Y/n] `)!=="n"){if(!dD($))E7($,{recursive:!0});let Y=`
123
+ `+J6();W3(X,Y),console.log(`\u2705 Added to ${X}`),console.log(" Run: termux-reload-settings")}else console.log("\u23ED\uFE0F Skipped termux.properties");if(console.log(`
124
+ \u2705 Installation complete!`),console.log(`
125
+ Next steps:`),console.log(" 1. Reload tmux: tmux source ~/.tmux.conf"),console.log(" 2. Restart your shell or run: source ~/.bashrc"),J)console.log(" 3. Reload Termux: termux-reload-settings")}function y2(D){return cD(D,"generated by genie-cli")}function q3(D,F){if(!dD(D))return!1;let B=E6(D,"utf-8");if(!B.includes(F))return!1;let E=B.split(`
126
+ `),$=[],X=!1,J=-1;for(let Y=0;Y<E.length;Y++){let W=E[Y];if(W.includes(F)&&!X){if(X=!0,J===-1&&$.length>0&&$[$.length-1].trim()==="")$.pop();continue}if(X){if(W.trim()===""&&Y+1<E.length&&!E[Y+1].includes("genie")){X=!1;continue}if(!(W.includes("genie")||W.includes("Ctrl+")||W.includes("split-window")||W.includes("new-window")||W.includes("stty -ixon")||W.includes("Warp-like")||W.includes("bind-key -n")||W.includes("extra-keys")||W.includes("F1=")||W.includes("bind -x")||W.startsWith("#")&&E[Y-1]?.includes("genie"))&&W.trim()!=="")X=!1,$.push(W);continue}$.push(W)}while($.length>0&&$[$.length-1].trim()==="")$.pop();let Q=$.length>0?$.join(`
127
+ `)+`
128
+ `:"";return B7(D,Q),!0}async function Q6(){let D=B6(),F="generated by genie-cli";console.log(`Uninstalling Warp-like shortcuts...
129
+ `);let B=XD(D,".tmux.conf");if(!cD(B,"generated by genie-cli"))console.log("\u2713 tmux.conf has no genie shortcuts");else if(await C2(`Remove shortcuts from ${B}? [Y/n] `)!=="n"){if(q3(B,"generated by genie-cli"))console.log(`\u2705 Removed from ${B}`)}else console.log("\u23ED\uFE0F Skipped tmux.conf");let E=XD(D,".zshrc"),$=XD(D,".bashrc");for(let Y of[E,$]){if(!dD(Y))continue;if(!cD(Y,"generated by genie-cli"))console.log(`\u2713 ${Y} has no genie shortcuts`);else if(await C2(`Remove shell functions from ${Y}? [Y/n] `)!=="n"){if(q3(Y,"generated by genie-cli"))console.log(`\u2705 Removed from ${Y}`)}else console.log(`\u23ED\uFE0F Skipped ${Y}`)}let X=XD(D,".termux"),J=XD(X,"termux.properties"),Q=dD(X)||process.env.TERMUX_VERSION;if(Q)if(!cD(J,"generated by genie-cli"))console.log("\u2713 termux.properties has no genie shortcuts");else if(await C2(`Remove extra keys from ${J}? [Y/n] `)!=="n"){if(q3(J,"generated by genie-cli"))console.log(`\u2705 Removed from ${J}`),console.log(" Run: termux-reload-settings")}else console.log("\u23ED\uFE0F Skipped termux.properties");if(console.log(`
130
+ \u2705 Uninstallation complete!`),console.log(`
131
+ Next steps:`),console.log(" 1. Reload tmux: tmux source ~/.tmux.conf"),console.log(" 2. Restart your shell or run: source ~/.bashrc"),Q)console.log(" 3. Reload Termux: termux-reload-settings")}async function HE(D){if(D.tmux)console.log(X6());else if(D.termux)console.log(J6());else if(D.install)await x2();else _3()}import{homedir as X7}from"os";import{join as J7}from"path";function Q7(){console.log(),console.log("\x1B[1m\x1B[36m"+"\u2554"+"\u2550".repeat(62)+"\u2557"+"\x1B[0m"),console.log("\x1B[1m\x1B[36m"+"\u2551 "+"\x1B[0m\x1B[1m\uD83E\uDDDE Genie Setup - Configure Your AI Assistant"+" ".repeat(16)+"\x1B[36m\u2551\x1B[0m"),console.log("\x1B[1m\x1B[36m"+"\u255A"+"\u2550".repeat(62)+"\u255D"+"\x1B[0m"),console.log()}function Y7(){console.log("\x1B[1m\uD83D\uDCDA ABOUT HOOKS\x1B[0m"),console.log("\x1B[2mHooks let you control how the AI uses tools - without wasting\x1B[0m"),console.log('\x1B[2mtokens on prompts! Instead of telling the AI "please use term",\x1B[0m'),console.log("\x1B[2mhooks automatically enforce the behavior.\x1B[0m"),console.log(),console.log("\x1B[2m"+"\u2500".repeat(64)+"\x1B[0m"),console.log()}function W7(){console.log("\x1B[1m\uD83D\uDD27 AVAILABLE HOOK PRESETS\x1B[0m"),console.log();for(let D=0;D<E0.length;D++){let F=E0[D],B=D+1,E=F.recommended?" \x1B[32m(Recommended)\x1B[0m":"";console.log(`\x1B[1m${B}. ${F.title}\x1B[0m${E}`),console.log(` \u251C\u2500 What: ${F.what}`),console.log(` \u251C\u2500 Why: ${F.why}`),console.log(` \u2514\u2500 How: ${F.how}`),console.log()}console.log("\x1B[2m"+"\u2500".repeat(64)+"\x1B[0m"),console.log()}function q7(D,F){let B=D.recommended?" \x1B[32m(Recommended)\x1B[0m":"";return{name:`${D.title}${B} - ${D.what}`,value:D.name,checked:F}}function _7(D){console.log(),console.log(`\x1B[32m\u2713 Configuration saved to ${D}\x1B[0m`),console.log(),console.log("\x1B[1m\uD83D\uDCA1 TIP:\x1B[0m Claudio will automatically use these hooks."),console.log(" Run: \x1B[36mclaudio launch\x1B[0m"),console.log(" Watch: \x1B[36mtmux attach -t genie\x1B[0m"),console.log()}function H7(D){let F=z2(D);if(F.length===0)console.log("\x1B[33mNo hooks currently enabled.\x1B[0m");else{console.log("\x1B[1mCurrently enabled hooks:\x1B[0m");for(let B of F)console.log(` \u2022 ${B}`)}console.log()}async function G7(D){let F=D.hooks.sandboxed?.allowedPaths||["~/projects","/tmp"];console.log("\x1B[1mSandbox Configuration\x1B[0m"),console.log("\x1B[2mEnter paths where the AI can access files (comma-separated):\x1B[0m");let E=(await s2({message:"Allowed paths:",default:F.join(", ")})).split(",").map(($)=>$.trim()).filter(Boolean);D.hooks.sandboxed={allowedPaths:E}}async function M7(D){let F=D.hooks.audited?.logPath||"~/.genie/audit.log";console.log("\x1B[1mAudit Configuration\x1B[0m");let B=await s2({message:"Audit log path:",default:F});D.hooks.audited={logPath:B}}async function Q0(){Q7(),Y7(),W7();let D=await jD(),F=new Set(D.hooks.enabled);if(J0())console.log("\x1B[1m\uD83D\uDCCB CURRENT CONFIGURATION\x1B[0m"),H7(D);let B=E0.map(($)=>q7($,F.has($.name))),E=await B3({message:"Select hooks to enable (space to toggle, enter to confirm):",choices:B});if(D.hooks.enabled=E,E.includes("sandboxed"))console.log(),await G7(D);if(E.includes("audited")){if(console.log(),await fD({message:"Customize audit log path?",default:!1}))await M7(D)}if(await Y3(D),_7(X0()),E.length>0){console.log("\x1B[1mEnabled hooks:\x1B[0m");let $=z2(D);for(let X of $)console.log(` \x1B[32m\u2713\x1B[0m ${X}`);console.log()}await A7()}async function A7(){let D=X7(),F=J7(D,".tmux.conf");if(y2(F)){console.log("\x1B[2m\u2713 Tmux shortcuts already installed\x1B[0m"),console.log();return}if(console.log("\x1B[2m"+"\u2500".repeat(64)+"\x1B[0m"),console.log(),console.log("\x1B[1m\u2328\uFE0F KEYBOARD SHORTCUTS\x1B[0m"),console.log("\x1B[2mOptional: Install Warp-like tmux shortcuts for quick navigation:\x1B[0m"),console.log(" \u2022 Ctrl+T \u2192 New tab (window)"),console.log(" \u2022 Ctrl+S \u2192 Vertical split"),console.log(" \u2022 Alt+S \u2192 Horizontal split"),console.log(),await fD({message:"Install tmux keyboard shortcuts?",default:!1}))console.log(),await x2();else console.log(),console.log("\x1B[2mSkipped. Run \x1B[0m\x1B[36mgenie shortcuts install\x1B[0m\x1B[2m later to add them.\x1B[0m"),console.log()}async function Y6(){console.log("\x1B[1m\uD83E\uDDDE Quick Setup - Using recommended defaults\x1B[0m"),console.log();let D=await jD();D.hooks.enabled=["collaborative","audited"],await Y3(D),console.log("\x1B[32m\u2713 Enabled:\x1B[0m collaborative, audited"),console.log(),console.log("Run \x1B[36mgenie setup\x1B[0m to customize further."),console.log()}var C7={tmux:{brew:"brew install tmux",apt:"sudo apt update && sudo apt install -y tmux",dnf:"sudo dnf install -y tmux",yum:"sudo yum install -y tmux",pacman:"sudo pacman -S --noconfirm tmux",none:null},bun:{all:"curl -fsSL https://bun.sh/install | bash"},claude:{all:"npm install -g @anthropic-ai/claude-code"}};function U7(D,F){let B=C7[D];if(!B)return null;if(B.all)return B.all;if(F!=="none"&&B[F])return B[F];if(B.none!==void 0)return B.none;return null}function W6(D){switch(D){case"tmux":return"Visit https://github.com/tmux/tmux/wiki/Installing for installation instructions";case"bun":return"Visit https://bun.sh for installation instructions";case"claude":return"Run: npm install -g @anthropic-ai/claude-code (requires Node.js/npm)";default:return`Search for "${D} install" for installation instructions`}}async function j7(D){return new Promise((F)=>{console.log(`\x1B[2m$ ${D}\x1B[0m
132
+ `);let B=z7("bash",["-c",D],{stdio:"inherit",env:{...process.env,FORCE_COLOR:"1"}});B.on("close",(E)=>{F(E===0)}),B.on("error",(E)=>{console.error(`\x1B[31mError: ${E.message}\x1B[0m`),F(!1)})})}function R7(){console.log(),console.log("\x1B[1m\uD83D\uDD27 Genie Prerequisites Check\x1B[0m"),console.log()}function V7(D){let F=D.os==="macos"?"macOS":"Linux";if(D.linuxDistro&&D.linuxDistro!=="unknown")F=`Linux (${l8(D.linuxDistro)})`;console.log(`System: ${F} (${D.arch})`),console.log(`Package Manager: ${D.preferredPM==="none"?"none detected":D.preferredPM}`),console.log()}function K7(D){console.log("Checking prerequisites..."),console.log();for(let F of D)if(F.installed){let B=F.version?` ${F.version}`:"",E=F.path?`\x1B[2m (${F.path})\x1B[0m`:"";console.log(` \x1B[32m\u2705\x1B[0m ${F.name}${B}${E}`)}else if(F.required)console.log(` \x1B[31m\u274C\x1B[0m ${F.name} \x1B[31mnot found\x1B[0m`);else console.log(` \x1B[33m\u26A0\uFE0F\x1B[0m ${F.name} \x1B[33mnot found\x1B[0m \x1B[2m(optional)\x1B[0m`);console.log()}function Y0(){console.log("\x1B[2m"+"\u2500".repeat(40)+"\x1B[0m"),console.log()}async function N7(D,F,B){let E=D.required?"\x1B[31mrequired\x1B[0m":"\x1B[2moptional, recommended\x1B[0m";if(!F)return console.log(`\x1B[33mManual installation required for\x1B[0m ${D.name} (${E})`),console.log(` ${W6(D.name)}`),console.log(),"skipped";console.log(`Install \x1B[1m${D.name}\x1B[0m? (${E})`),console.log(` Command: \x1B[36m${F}\x1B[0m`);let $;if(B.yes)$=!0,console.log("\x1B[2mAuto-approved with --yes\x1B[0m");else $=await fD({message:"Proceed",default:D.required});if(!$)return console.log(`\x1B[33mSkipped: ${D.name}\x1B[0m`),console.log(),"skipped";if(console.log(),console.log(`Installing ${D.name}...`),console.log(),await j7(F)){let J=await yD(D.name);if(J.exists){let Q=J.version?` ${J.version}`:"";return console.log(),console.log(`\x1B[32m\u2705 ${D.name}${Q} installed\x1B[0m`),console.log(),"installed"}else return console.log(),console.log(`\x1B[33m\u26A0\uFE0F ${D.name} installed but not found in PATH\x1B[0m`),console.log("\x1B[2m You may need to restart your shell or source your profile\x1B[0m"),console.log(),"installed"}else return console.log(),console.log(`\x1B[31m\u274C Failed to install ${D.name}\x1B[0m`),console.log(`\x1B[2m ${W6(D.name)}\x1B[0m`),console.log(),"failed"}async function q6(D){if(J0()){console.log("\x1B[2m\u2713 Genie hooks already configured (~/.genie/config.json)\x1B[0m"),console.log(" Run \x1B[36mgenie setup\x1B[0m to reconfigure."),console.log();return}console.log(),Y0(),console.log("\x1B[1m\uD83E\uDDDE Configure Genie Hooks?\x1B[0m"),console.log(),console.log("\x1B[2mHooks let you control how AI tools execute - without wasting tokens!\x1B[0m"),console.log('\x1B[2mFor example, the "collaborative" hook routes all bash commands through\x1B[0m'),console.log("\x1B[2mtmux so you can watch the AI work in real-time.\x1B[0m"),console.log();let F;if(D.yes)F=!0,console.log("\x1B[2mAuto-approved with --yes\x1B[0m");else F=await fD({message:"Would you like to configure genie hooks now?",default:!0});if(F)console.log(),await Q0();else console.log(),console.log("\x1B[2mSkipped. Run \x1B[0m\x1B[36mgenie setup\x1B[0m\x1B[2m anytime to configure hooks.\x1B[0m"),console.log()}async function _6(D){R7();let F=await g8();V7(F);let B=await m8();K7(B);let E=B.filter((q)=>!q.installed),$=E.filter((q)=>q.required),X=E.filter((q)=>!q.required);if(E.length===0){console.log("\x1B[32m\u2705 All prerequisites are installed!\x1B[0m"),console.log(),await q6(D),console.log("Run \x1B[36mterm --help\x1B[0m or \x1B[36mclaudio --help\x1B[0m to get started."),console.log();return}if(console.log(`Missing: ${$.length} required, ${X.length} optional`),console.log(),D.check){if($.length>0)console.log("\x1B[31m\u274C Missing required prerequisites\x1B[0m"),console.log("Run \x1B[36mgenie install\x1B[0m to install them."),process.exit(1);return}Y0();let J={installed:[],skipped:[],failed:[]};for(let q of E){let G=U7(q.name,F.preferredPM),R=await N7(q,G,D);if(R==="installed")J.installed.push(q.name);else if(R==="skipped")J.skipped.push(q.name);else J.failed.push(q.name);if(q!==E[E.length-1])Y0()}Y0(),console.log("\x1B[1mSummary:\x1B[0m");let Q=J.installed.filter((q)=>$.some((G)=>G.name===q)),Y=J.failed.filter((q)=>$.some((G)=>G.name===q)),W=J.skipped.filter((q)=>X.some((G)=>G.name===q));if(Y.length>0)console.log(`\x1B[31m \u274C ${Y.length} required failed: ${Y.join(", ")}\x1B[0m`);else if(Q.length>0||$.length===0)console.log("\x1B[32m \u2705 All required prerequisites installed\x1B[0m");if(J.installed.length>0)console.log(`\x1B[32m \u2705 Installed: ${J.installed.join(", ")}\x1B[0m`);if(W.length>0)console.log(`\x1B[33m \u26A0\uFE0F ${W.length} optional skipped: ${W.join(", ")}\x1B[0m`);if(console.log(),Y.length===0)await q6(D),console.log("Run \x1B[36mterm --help\x1B[0m or \x1B[36mclaudio --help\x1B[0m to get started.");else console.log("\x1B[31mSome required prerequisites could not be installed.\x1B[0m"),console.log("Please install them manually and run this command again."),process.exit(1);console.log()}import{spawn as z6}from"child_process";import{existsSync as M3}from"fs";import{mkdir as H6,copyFile as C6,chmod as L7}from"fs/promises";import{join as ID}from"path";import{homedir as U6}from"os";var j6=process.env.GENIE_HOME||ID(U6(),".genie"),RD=ID(j6,"src"),G6=ID(j6,"bin"),M6=ID(U6(),".local","bin");function h2(D){console.log(`\x1B[32m\u25B8\x1B[0m ${D}`)}function H3(D){console.log(`\x1B[32m\u2714\x1B[0m ${D}`)}function nD(D){console.log(`\x1B[31m\u2716\x1B[0m ${D}`)}async function W0(D,F,B){return new Promise((E)=>{let $=[],X=z6(D,F,{cwd:B,stdio:["inherit","pipe","pipe"],env:{...process.env,FORCE_COLOR:"1"}});X.stdout?.on("data",(J)=>{let Q=J.toString();$.push(Q),process.stdout.write(Q)}),X.stderr?.on("data",(J)=>{let Q=J.toString();$.push(Q),process.stderr.write(Q)}),X.on("close",(J)=>{E({success:J===0,output:$.join("")})}),X.on("error",(J)=>{nD(J.message),E({success:!1,output:J.message})})})}async function A6(D){try{let F=await G3("git",["rev-parse","--abbrev-ref","HEAD"],D),B=await G3("git",["rev-parse","--short","HEAD"],D),E=await G3("git",["log","-1","--format=%ci"],D);if(F.success&&B.success&&E.success)return{branch:F.output.trim(),commit:B.output.trim(),commitDate:E.output.trim().split(" ")[0]}}catch{}return null}async function G3(D,F,B){return new Promise((E)=>{let $=[],X=z6(D,F,{cwd:B,stdio:["inherit","pipe","pipe"]});X.stdout?.on("data",(J)=>{$.push(J.toString())}),X.stderr?.on("data",(J)=>{$.push(J.toString())}),X.on("close",(J)=>{E({success:J===0,output:$.join("")})}),X.on("error",(J)=>{E({success:!1,output:J.message})})})}async function O7(D,F){let{symlink:B,unlink:E}=await import("fs/promises");try{if(M3(F))await E(F);await B(D,F)}catch{await C6(D,F)}}async function R6(){if(console.log(),console.log("\x1B[1m\uD83E\uDDDE Genie CLI Update\x1B[0m"),console.log("\x1B[2m\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\x1B[0m"),console.log(),!M3(RD)||!M3(ID(RD,".git")))nD("Genie CLI was not installed via install.sh"),console.log(),console.log("To install Genie CLI properly, run:"),console.log("\x1B[36m curl -fsSL https://raw.githubusercontent.com/namastexlabs/genie-cli/main/install.sh | bash\x1B[0m"),console.log(),process.exit(1);let D=await A6(RD);if(D)console.log(`Current: \x1B[2m${D.branch}@${D.commit} (${D.commitDate})\x1B[0m`),console.log();if(h2("Fetching latest changes..."),!(await W0("git",["fetch","origin"],RD)).success)nD("Failed to fetch from origin"),process.exit(1);if(h2("Resetting to origin/main..."),!(await W0("git",["reset","--hard","origin/main"],RD)).success)nD("Failed to reset to origin/main"),process.exit(1);console.log();let E=await A6(RD);if(D&&E&&D.commit===E.commit){H3("Already up to date!"),console.log();return}if(h2("Installing dependencies..."),!(await W0("bun",["install"],RD)).success)nD("Failed to install dependencies"),process.exit(1);if(console.log(),h2("Building..."),!(await W0("bun",["run","build"],RD)).success)nD("Failed to build"),process.exit(1);console.log(),h2("Installing binaries...");try{await H6(G6,{recursive:!0}),await H6(M6,{recursive:!0});let J=["genie.js","term.js","claudio.js"],Q=["genie","term","claudio"];for(let Y=0;Y<J.length;Y++){let W=ID(RD,"dist",J[Y]),q=ID(G6,J[Y]),G=ID(M6,Q[Y]);await C6(W,q),await L7(q,493),await O7(q,G)}H3("Binaries installed")}catch(J){nD(`Failed to install binaries: ${J}`),process.exit(1)}if(console.log(),console.log("\x1B[2m\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\x1B[0m"),H3("Genie CLI updated successfully!"),console.log(),E)console.log(`Version: \x1B[36m${E.branch}@${E.commit}\x1B[0m (${E.commitDate})`),console.log()}import{existsSync as z3,mkdirSync as K6,readFileSync as w7,writeFileSync as S7}from"fs";import{homedir as N6}from"os";import{join as G0}from"path";var _0=G0(N6(),".claude"),A3=G0(_0,"hooks"),H0=G0(_0,"settings.json"),u7=T.object({type:T.literal("command"),command:T.string(),timeout:T.number().optional()}).passthrough(),V6=T.object({matcher:T.string(),hooks:T.array(u7)}).passthrough(),I7=T.object({PreToolUse:T.array(V6).optional(),PostToolUse:T.array(V6).optional()}).passthrough(),q0=T.object({model:T.string().optional(),enabledPlugins:T.record(T.unknown()).optional(),hooks:I7.optional()}).passthrough(),C3="genie-bash-hook.sh",M0="Bash";function A0(){return H0}function iD(){return G0(A3,C3)}function L6(){if(!z3(_0))K6(_0,{recursive:!0})}function O6(){if(L6(),!z3(A3))K6(A3,{recursive:!0})}async function z0(){if(!z3(H0))return q0.parse({});try{let D=w7(H0,"utf-8"),F=JSON.parse(D);return q0.parse(F)}catch(D){return console.warn(`Warning: Invalid Claude settings, using defaults: ${D.message}`),q0.parse({})}}async function U3(D){L6();try{let F=q0.parse(D),B=JSON.stringify(F,null,2);S7(H0,B,"utf-8")}catch(F){throw Error(`Failed to save Claude settings: ${F.message}`)}}function T7(D){return{matcher:M0,hooks:[{type:"command",command:D,timeout:600}]}}function g2(D){let F=D.hooks?.PreToolUse;if(!F||!Array.isArray(F))return!1;return F.some((B)=>{if(B.matcher!==M0)return!1;if(!Array.isArray(B.hooks))return!1;return B.hooks.some((E)=>E.type==="command"&&E.command?.includes(C3))})}function w6(D){let F=iD(),B=T7(F);if(!D.hooks)D.hooks={};if(!D.hooks.PreToolUse)D.hooks.PreToolUse=[];if(g2(D))return D;return D.hooks.PreToolUse=D.hooks.PreToolUse.filter((E)=>!(E.matcher===M0&&E.hooks?.some(($)=>$.command?.includes("genie")))),D.hooks.PreToolUse.push(B),D}function S6(D){if(!D.hooks?.PreToolUse)return D;if(D.hooks.PreToolUse=D.hooks.PreToolUse.filter((F)=>{if(F.matcher!==M0)return!0;if(!Array.isArray(F.hooks))return!0;return!F.hooks.some((E)=>E.type==="command"&&E.command?.includes(C3))}),D.hooks.PreToolUse.length===0)delete D.hooks.PreToolUse;if(D.hooks&&Object.keys(D.hooks).length===0)delete D.hooks;return D}function aD(D){let F=N6();if(D.startsWith(F+"/"))return"~"+D.slice(F.length);if(D===F)return"~";return D}import{existsSync as j3,unlinkSync as b7,writeFileSync as P7,chmodSync as k7}from"fs";function C0(){return j3(iD())}function U0(){return aD(iD())}async function v7(){let D=await jD(),F=D.hooks.collaborative?.sessionName||"genie",B=D.hooks.collaborative?.windowName||"shell",E=`${F}:${B}`;return`#!/bin/bash
133
+ #
134
+ # Genie Bash Hook for Claude Code
135
+ #
136
+ # This hook intercepts Bash tool calls and rewrites them to execute
137
+ # through tmux via 'term exec', making all terminal operations visible
138
+ # in a shared tmux session.
139
+ #
140
+ # Generated by: genie hooks install
141
+ # Target session: ${E}
142
+ #
143
+
144
+ # Read the entire input from stdin
145
+ INPUT=$(cat)
146
+
147
+ # Extract the tool name to verify this is a Bash call
148
+ TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name // empty')
149
+
150
+ # If not a Bash tool call, allow it to proceed unchanged
151
+ if [ "$TOOL_NAME" != "Bash" ]; then
152
+ echo '{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"allow"}}'
153
+ exit 0
154
+ fi
155
+
156
+ # Extract the command from the tool input
157
+ COMMAND=$(echo "$INPUT" | jq -r '.tool_input.command // empty')
158
+
159
+ # If no command, allow it (shouldn't happen but be safe)
160
+ if [ -z "$COMMAND" ]; then
161
+ echo '{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"allow"}}'
162
+ exit 0
163
+ fi
164
+
165
+ # Escape single quotes in the command for safe shell embedding
166
+ # Replace ' with '\\'\\''
167
+ ESCAPED_COMMAND=$(echo "$COMMAND" | sed "s/'/'\\\\'\\\\''/" )
168
+
169
+ # Build the wrapped command that goes through term exec
170
+ WRAPPED_COMMAND="term exec ${E} '\${ESCAPED_COMMAND}'"
171
+
172
+ # Extract other fields from the original input to preserve them
173
+ TIMEOUT=$(echo "$INPUT" | jq -r '.tool_input.timeout // empty')
174
+ DESCRIPTION=$(echo "$INPUT" | jq -r '.tool_input.description // empty')
175
+ RUN_IN_BACKGROUND=$(echo "$INPUT" | jq -r '.tool_input.run_in_background // empty')
176
+
177
+ # Build the updated input object
178
+ UPDATED_INPUT=$(jq -n \\
179
+ --arg cmd "$WRAPPED_COMMAND" \\
180
+ --arg timeout "$TIMEOUT" \\
181
+ --arg desc "$DESCRIPTION" \\
182
+ --arg background "$RUN_IN_BACKGROUND" \\
183
+ '{
184
+ command: $cmd,
185
+ timeout: (if $timeout != "" then ($timeout | tonumber) else null end),
186
+ description: (if $desc != "" then ("[term] " + $desc) else null end),
187
+ run_in_background: (if $background == "true" then true elif $background == "false" then false else null end)
188
+ } | with_entries(select(.value != null))')
189
+
190
+ # Output the hook response in the correct format
191
+ jq -n \\
192
+ --argjson updatedInput "$UPDATED_INPUT" \\
193
+ '{
194
+ "hookSpecificOutput": {
195
+ "hookEventName": "PreToolUse",
196
+ "permissionDecision": "allow",
197
+ "updatedInput": $updatedInput,
198
+ "additionalContext": "Human can observe: tmux attach -t ${F}"
199
+ }
200
+ }'
201
+ `}async function u6(){O6();let D=iD(),F=await v7();P7(D,F,"utf-8"),k7(D,493)}function I6(){let D=iD();if(j3(D))b7(D)}async function T6(){let D=iD();if(!j3(D))return{success:!1,error:'Hook script not found. Run "genie hooks install" first.'};let F=JSON.stringify({hook_event_name:"PreToolUse",tool_name:"Bash",tool_input:{command:'echo "Hello, World!"',description:"Test command"}});try{let{$:B}=awaitPromise.resolve(globalThis.Bun),E=await B`echo ${F} | ${D}`.quiet();if(E.exitCode!==0)return{success:!1,error:`Script exited with code ${E.exitCode}`,output:E.stderr.toString()};let $=E.stdout.toString().trim();try{let X=JSON.parse($);if(!X.hookSpecificOutput)return{success:!1,error:"Output missing hookSpecificOutput field",output:$};if(X.hookSpecificOutput.hookEventName!=="PreToolUse")return{success:!1,error:"Output has wrong hookEventName",output:$};if(!["allow","deny","ask"].includes(X.hookSpecificOutput.permissionDecision))return{success:!1,error:"Output has invalid permissionDecision",output:$};if(X.hookSpecificOutput.updatedInput?.command){if(!X.hookSpecificOutput.updatedInput.command.includes("term exec"))return{success:!1,error:"Command was not wrapped with term exec",output:$}}return{success:!0,output:$}}catch(X){return{success:!1,error:`Output is not valid JSON: ${X.message}`,output:$}}}catch(B){return{success:!1,error:`Failed to run hook script: ${B.message}`}}}function b6(D){let F=Math.max(...D.map((E)=>E.length)),B=F+4;console.log(),console.log("\x1B[32m+"+"-".repeat(B)+"+\x1B[0m");for(let E of D){let $=" ".repeat(F-E.length);console.log("\x1B[32m| \x1B[0m"+E+$+"\x1B[32m |\x1B[0m")}console.log("\x1B[32m+"+"-".repeat(B)+"+\x1B[0m"),console.log()}async function Z7(){let D=[],F=await yD("jq"),B=await yD("tmux"),E=await yD("term");if(!F.exists)D.push("jq is required but not installed. Install with: brew install jq (or apt install jq)");return{jq:F.exists,tmux:B.exists,term:E.exists,errors:D}}async function P6(D={}){console.log(),console.log("\x1B[1m Installing Genie Hooks\x1B[0m"),console.log(),console.log("\x1B[2mChecking dependencies...\x1B[0m");let F=await Z7();if(F.jq)console.log(" \x1B[32m+\x1B[0m jq");else console.log(" \x1B[31m-\x1B[0m jq (required)");if(F.tmux)console.log(" \x1B[32m+\x1B[0m tmux");else console.log(" \x1B[33m-\x1B[0m tmux (recommended for collaborative mode)");if(F.term)console.log(" \x1B[32m+\x1B[0m term");else console.log(" \x1B[33m-\x1B[0m term (required for collaborative mode)");if(F.errors.length>0){console.log();for(let Q of F.errors)console.log("\x1B[31mError:\x1B[0m "+Q);process.exit(1)}console.log(),console.log("\x1B[2mLoading configuration...\x1B[0m");let B=await jD();if(!F6(B))console.log(),console.log("\x1B[33mNo hook presets are enabled.\x1B[0m"),console.log("Run \x1B[36mgenie setup\x1B[0m to configure hook presets first."),console.log(),process.exit(1);let E=z2(B);if(console.log(" \x1B[32m+\x1B[0m Enabled presets: "+B.hooks.enabled.join(", ")),console.log(),B.hooks.enabled.includes("collaborative")){if(!F.tmux)console.log("\x1B[33mWarning:\x1B[0m Collaborative mode enabled but tmux not found."),console.log("Install tmux for the best experience: brew install tmux (or apt install tmux)"),console.log();if(!F.term)console.log("\x1B[33mWarning:\x1B[0m Collaborative mode enabled but term not found."),console.log("The term command is required for collaborative mode to work."),console.log()}let $=await z0();if(g2($)&&!D.force){console.log("\x1B[33mGenie hooks are already installed.\x1B[0m"),console.log("Use \x1B[36m--force\x1B[0m to reinstall."),console.log();return}console.log("\x1B[2mWriting hook script...\x1B[0m"),await u6(),console.log(" \x1B[32m+\x1B[0m "+U0()),console.log(),console.log("\x1B[2mUpdating Claude Code settings...\x1B[0m");let X=w6($);await U3(X),console.log(" \x1B[32m+\x1B[0m Hook registered in "+aD(A0())),console.log();let J=B.hooks.collaborative?.sessionName||"genie";b6(["\x1B[32m+\x1B[0m Installation complete!","","Restart Claude Code for changes to take effect.","","After restart, all Bash commands will run in tmux.",`Watch with: tmux attach -t ${J}`])}async function k6(D={}){console.log(),console.log("\x1B[1m Uninstalling Genie Hooks\x1B[0m"),console.log(),console.log("\x1B[2mRemoving from Claude Code settings...\x1B[0m");let F=await z0();if(!g2(F))console.log(" \x1B[33m-\x1B[0m No genie hooks found in settings");else{let B=S6(F);await U3(B),console.log(" \x1B[32m+\x1B[0m Hook removed from "+aD(A0()))}if(console.log(),!D.keepScript){if(console.log("\x1B[2mRemoving hook script...\x1B[0m"),C0())I6(),console.log(" \x1B[32m+\x1B[0m Deleted "+U0());else console.log(" \x1B[33m-\x1B[0m Hook script not found");console.log()}else console.log("\x1B[2mKeeping hook script (--keep-script)\x1B[0m"),console.log();b6(["\x1B[32m+\x1B[0m Uninstallation complete!","","Restart Claude Code for changes to take effect."])}async function v6(){if(console.log(),console.log("\x1B[1m Testing Genie Hooks\x1B[0m"),console.log(),!C0())console.log("\x1B[31mError:\x1B[0m Hook script not found."),console.log("Run \x1B[36mgenie hooks install\x1B[0m first."),console.log(),process.exit(1);console.log("Script location: "+U0()),console.log(),console.log("\x1B[2mTesting with sample Bash input...\x1B[0m");let D=await T6();if(D.success){console.log("\x1B[32m+\x1B[0m Hook script works correctly!"),console.log(),console.log("\x1B[2mSample output:\x1B[0m");try{let F=JSON.parse(D.output||"{}");console.log(JSON.stringify(F,null,2))}catch{console.log(D.output)}}else{if(console.log("\x1B[31m-\x1B[0m Hook script test failed!"),console.log(),console.log("\x1B[31mError:\x1B[0m "+D.error),D.output)console.log(),console.log("\x1B[2mOutput:\x1B[0m"),console.log(D.output);process.exit(1)}console.log()}async function R3(){let D=await jD(),F=z2(D);if(console.log(),console.log("\x1B[1m Current Hook Configuration\x1B[0m"),console.log(` Genie config: ${aD(X0())}`),console.log(` Claude settings: ${aD(A0())}`),console.log(),F.length===0)console.log("\x1B[33m No hook presets enabled.\x1B[0m"),console.log(" Run \x1B[36mgenie setup\x1B[0m to configure hooks.");else{console.log("\x1B[2m Enabled presets:\x1B[0m");for(let X of F)console.log(` \x1B[32m+\x1B[0m ${X}`)}console.log();let B=await z0(),E=g2(B),$=C0();if(console.log("\x1B[2m Installation status:\x1B[0m"),E&&$)console.log(" \x1B[32m+\x1B[0m Hooks installed in Claude Code"),console.log(" \x1B[32m+\x1B[0m Hook script exists");else if(E&&!$)console.log(" \x1B[33m!\x1B[0m Hook registered but script missing"),console.log(" Run \x1B[36mgenie hooks install --force\x1B[0m to fix");else if(!E&&$)console.log(" \x1B[33m!\x1B[0m Script exists but hook not registered"),console.log(" Run \x1B[36mgenie hooks install\x1B[0m to register");else console.log(" \x1B[33m-\x1B[0m Hooks not installed"),console.log(" Run \x1B[36mgenie hooks install\x1B[0m to install");console.log()}import{homedir as f7}from"os";import{join as V3}from"path";import{existsSync as x7}from"fs";async function K3(){_3();let D=f7(),F=V3(D,".tmux.conf"),B=V3(D,".zshrc"),E=V3(D,".bashrc");if(console.log("Installation status:"),y2(F))console.log(" \x1B[32m\u2713\x1B[0m tmux.conf");else console.log(" \x1B[33m-\x1B[0m tmux.conf");let $=x7(B)?B:E;if(y2($))console.log(` \x1B[32m\u2713\x1B[0m ${$.replace(D,"~")}`);else console.log(` \x1B[33m-\x1B[0m ${$.replace(D,"~")}`);console.log(),console.log("Run \x1B[36mgenie shortcuts install\x1B[0m to install shortcuts."),console.log("Run \x1B[36mgenie shortcuts uninstall\x1B[0m to remove shortcuts."),console.log()}async function Z6(){await x2()}async function f6(){await Q6()}var rD=new h3;rD.name("genie").description("Genie CLI - Setup and utilities for AI-assisted development").version("0.1.0");rD.command("install").description("Verify and install prerequisites").option("--check","Only check prerequisites, do not install").option("--yes","Auto-approve all installations").action(_6);rD.command("setup").description("Configure hooks and settings (interactive wizard)").option("--quick","Use recommended defaults without prompts").action(async(D)=>{if(D.quick)await Y6();else await Q0()});rD.command("update").description("Update Genie CLI to the latest version").action(R6);var m2=rD.command("hooks").description("Manage Claude Code hooks");m2.action(R3);m2.command("show").description("Show current hook configuration").action(R3);m2.command("install").description("Install hooks into Claude Code").option("--force","Overwrite existing hooks").action(P6);m2.command("uninstall").description("Remove hooks from Claude Code").option("--keep-script","Keep the hook script file").action(k6);m2.command("test").description("Test the hook script").action(v6);var j0=rD.command("shortcuts").description("Manage tmux keyboard shortcuts");j0.action(K3);j0.command("show").description("Show available shortcuts and installation status").action(K3);j0.command("install").description("Install shortcuts to config files (~/.tmux.conf, shell rc)").action(Z6);j0.command("uninstall").description("Remove shortcuts from config files").action(f6);rD.parse();