@hippo-memo/cli 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +71 -71
- package/dist/template/skill/AGENTS.md +21 -0
- package/dist/template/skill/hippo-memory/SKILL.md +1 -1
- package/package.json +1 -1
- package/src/api/server.ts +4 -2
- package/src/commands/init.ts +51 -14
package/dist/index.js
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createRequire as U8}from"node:module";var J8=Object.create;var{getPrototypeOf:z8,defineProperty:b2,getOwnPropertyNames:Z8}=Object;var X8=Object.prototype.hasOwnProperty;function Q8(f){return this[f]}var G8,D8,w0=(f,$,M)=>{var Y=f!=null&&typeof f==="object";if(Y){var J=$?G8??=new WeakMap:D8??=new WeakMap,z=J.get(f);if(z)return z}M=f!=null?J8(z8(f)):{};let Z=$||!f||!f.__esModule?b2(M,"default",{value:f,enumerable:!0}):M;for(let X of Z8(f))if(!X8.call(Z,X))b2(Z,X,{get:Q8.bind(f,X),enumerable:!0});if(Y)J.set(f,Z);return Z};var V=(f,$)=>()=>($||f(($={exports:{}}).exports,$),$.exports);var o=U8(import.meta.url);var j0=V((W8)=>{class
|
|
2
|
+
import{createRequire as U8}from"node:module";var J8=Object.create;var{getPrototypeOf:z8,defineProperty:b2,getOwnPropertyNames:Z8}=Object;var X8=Object.prototype.hasOwnProperty;function Q8(f){return this[f]}var G8,D8,w0=(f,$,M)=>{var Y=f!=null&&typeof f==="object";if(Y){var J=$?G8??=new WeakMap:D8??=new WeakMap,z=J.get(f);if(z)return z}M=f!=null?J8(z8(f)):{};let Z=$||!f||!f.__esModule?b2(M,"default",{value:f,enumerable:!0}):M;for(let X of Z8(f))if(!X8.call(Z,X))b2(Z,X,{get:Q8.bind(f,X),enumerable:!0});if(Y)J.set(f,Z);return Z};var V=(f,$)=>()=>($||f(($={exports:{}}).exports,$),$.exports);var o=U8(import.meta.url);var j0=V((W8)=>{class z$ extends Error{constructor(f,$,M){super(M);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=$,this.exitCode=f,this.nestedError=void 0}}class _2 extends z${constructor(f){super(1,"commander.invalidArgument",f);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}W8.CommanderError=z$;W8.InvalidArgumentError=_2});var Zf=V((H8)=>{var{InvalidArgumentError:q8}=j0();class v2{constructor(f,$){switch(this.description=$||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,f[0]){case"<":this.required=!0,this._name=f.slice(1,-1);break;case"[":this.required=!1,this._name=f.slice(1,-1);break;default:this.required=!0,this._name=f;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(f,$){if($===this.defaultValue||!Array.isArray($))return[f];return $.concat(f)}default(f,$){return this.defaultValue=f,this.defaultValueDescription=$,this}argParser(f){return this.parseArg=f,this}choices(f){return this.argChoices=f.slice(),this.parseArg=($,M)=>{if(!this.argChoices.includes($))throw new q8(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue($,M);return $},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function B8(f){let $=f.name()+(f.variadic===!0?"...":"");return f.required?"<"+$+">":"["+$+"]"}H8.Argument=v2;H8.humanReadableArgName=B8});var Z$=V((N8)=>{var{humanReadableArgName:R8}=Zf();class u2{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(f){let $=f.commands.filter((Y)=>!Y._hidden),M=f._getHelpCommand();if(M&&!M._hidden)$.push(M);if(this.sortSubcommands)$.sort((Y,J)=>{return Y.name().localeCompare(J.name())});return $}compareOptions(f,$){let M=(Y)=>{return Y.short?Y.short.replace(/^-/,""):Y.long.replace(/^--/,"")};return M(f).localeCompare(M($))}visibleOptions(f){let $=f.options.filter((Y)=>!Y.hidden),M=f._getHelpOption();if(M&&!M.hidden){let Y=M.short&&f._findOption(M.short),J=M.long&&f._findOption(M.long);if(!Y&&!J)$.push(M);else if(M.long&&!J)$.push(f.createOption(M.long,M.description));else if(M.short&&!Y)$.push(f.createOption(M.short,M.description))}if(this.sortOptions)$.sort(this.compareOptions);return $}visibleGlobalOptions(f){if(!this.showGlobalOptions)return[];let $=[];for(let M=f.parent;M;M=M.parent){let Y=M.options.filter((J)=>!J.hidden);$.push(...Y)}if(this.sortOptions)$.sort(this.compareOptions);return $}visibleArguments(f){if(f._argsDescription)f.registeredArguments.forEach(($)=>{$.description=$.description||f._argsDescription[$.name()]||""});if(f.registeredArguments.find(($)=>$.description))return f.registeredArguments;return[]}subcommandTerm(f){let $=f.registeredArguments.map((M)=>R8(M)).join(" ");return f._name+(f._aliases[0]?"|"+f._aliases[0]:"")+(f.options.length?" [options]":"")+($?" "+$:"")}optionTerm(f){return f.flags}argumentTerm(f){return f.name()}longestSubcommandTermLength(f,$){return $.visibleCommands(f).reduce((M,Y)=>{return Math.max(M,$.subcommandTerm(Y).length)},0)}longestOptionTermLength(f,$){return $.visibleOptions(f).reduce((M,Y)=>{return Math.max(M,$.optionTerm(Y).length)},0)}longestGlobalOptionTermLength(f,$){return $.visibleGlobalOptions(f).reduce((M,Y)=>{return Math.max(M,$.optionTerm(Y).length)},0)}longestArgumentTermLength(f,$){return $.visibleArguments(f).reduce((M,Y)=>{return Math.max(M,$.argumentTerm(Y).length)},0)}commandUsage(f){let $=f._name;if(f._aliases[0])$=$+"|"+f._aliases[0];let M="";for(let Y=f.parent;Y;Y=Y.parent)M=Y.name()+" "+M;return M+$+" "+f.usage()}commandDescription(f){return f.description()}subcommandDescription(f){return f.summary()||f.description()}optionDescription(f){let $=[];if(f.argChoices)$.push(`choices: ${f.argChoices.map((M)=>JSON.stringify(M)).join(", ")}`);if(f.defaultValue!==void 0){if(f.required||f.optional||f.isBoolean()&&typeof f.defaultValue==="boolean")$.push(`default: ${f.defaultValueDescription||JSON.stringify(f.defaultValue)}`)}if(f.presetArg!==void 0&&f.optional)$.push(`preset: ${JSON.stringify(f.presetArg)}`);if(f.envVar!==void 0)$.push(`env: ${f.envVar}`);if($.length>0)return`${f.description} (${$.join(", ")})`;return f.description}argumentDescription(f){let $=[];if(f.argChoices)$.push(`choices: ${f.argChoices.map((M)=>JSON.stringify(M)).join(", ")}`);if(f.defaultValue!==void 0)$.push(`default: ${f.defaultValueDescription||JSON.stringify(f.defaultValue)}`);if($.length>0){let M=`(${$.join(", ")})`;if(f.description)return`${f.description} ${M}`;return M}return f.description}formatHelp(f,$){let M=$.padWidth(f,$),Y=$.helpWidth||80,J=2,z=2;function Z(W,B){if(B){let O=`${W.padEnd(M+2)}${B}`;return $.wrap(O,Y-2,M+2)}return W}function X(W){return W.join(`
|
|
3
3
|
`).replace(/^/gm," ".repeat(2))}let Q=[`Usage: ${$.commandUsage(f)}`,""],G=$.commandDescription(f);if(G.length>0)Q=Q.concat([$.wrap(G,Y,0),""]);let D=$.visibleArguments(f).map((W)=>{return Z($.argumentTerm(W),$.argumentDescription(W))});if(D.length>0)Q=Q.concat(["Arguments:",X(D),""]);let U=$.visibleOptions(f).map((W)=>{return Z($.optionTerm(W),$.optionDescription(W))});if(U.length>0)Q=Q.concat(["Options:",X(U),""]);if(this.showGlobalOptions){let W=$.visibleGlobalOptions(f).map((B)=>{return Z($.optionTerm(B),$.optionDescription(B))});if(W.length>0)Q=Q.concat(["Global Options:",X(W),""])}let K=$.visibleCommands(f).map((W)=>{return Z($.subcommandTerm(W),$.subcommandDescription(W))});if(K.length>0)Q=Q.concat(["Commands:",X(K),""]);return Q.join(`
|
|
4
4
|
`)}padWidth(f,$){return Math.max($.longestOptionTermLength(f,$),$.longestGlobalOptionTermLength(f,$),$.longestSubcommandTermLength(f,$),$.longestArgumentTermLength(f,$))}wrap(f,$,M,Y=40){let z=new RegExp(`[\\n][${" \\f\\t\\v - \uFEFF"}]+`);if(f.match(z))return f;let Z=$-M;if(Z<Y)return f;let X=f.slice(0,M),Q=f.slice(M).replace(`\r
|
|
5
5
|
`,`
|
|
6
6
|
`),G=" ".repeat(M),U=`\\s${""}`,K=new RegExp(`
|
|
7
|
-
|.{1,${Z-1}}([${U}]|$)|[^${U}]+?([${U}]|$)`,"g"),W=Q.match(K)||[];return X+W.map((B,
|
|
8
|
-
`)return"";return(
|
|
9
|
-
`)}}N8.Help=u2});var
|
|
7
|
+
|.{1,${Z-1}}([${U}]|$)|[^${U}]+?([${U}]|$)`,"g"),W=Q.match(K)||[];return X+W.map((B,O)=>{if(B===`
|
|
8
|
+
`)return"";return(O>0?G:"")+B.trimEnd()}).join(`
|
|
9
|
+
`)}}N8.Help=u2});var X$=V((T8)=>{var{InvalidArgumentError:A8}=j0();class h2{constructor(f,$){this.flags=f,this.description=$||"",this.required=f.includes("<"),this.optional=f.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(f),this.mandatory=!1;let M=P8(f);if(this.short=M.shortFlag,this.long=M.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(f,$){return this.defaultValue=f,this.defaultValueDescription=$,this}preset(f){return this.presetArg=f,this}conflicts(f){return this.conflictsWith=this.conflictsWith.concat(f),this}implies(f){let $=f;if(typeof f==="string")$={[f]:!0};return this.implied=Object.assign(this.implied||{},$),this}env(f){return this.envVar=f,this}argParser(f){return this.parseArg=f,this}makeOptionMandatory(f=!0){return this.mandatory=!!f,this}hideHelp(f=!0){return this.hidden=!!f,this}_concatValue(f,$){if($===this.defaultValue||!Array.isArray($))return[f];return $.concat(f)}choices(f){return this.argChoices=f.slice(),this.parseArg=($,M)=>{if(!this.argChoices.includes($))throw new A8(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue($,M);return $},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){return L8(this.name().replace(/^no-/,""))}is(f){return this.short===f||this.long===f}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class g2{constructor(f){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,f.forEach(($)=>{if($.negate)this.negativeOptions.set($.attributeName(),$);else this.positiveOptions.set($.attributeName(),$)}),this.negativeOptions.forEach(($,M)=>{if(this.positiveOptions.has(M))this.dualOptions.add(M)})}valueFromOption(f,$){let M=$.attributeName();if(!this.dualOptions.has(M))return!0;let Y=this.negativeOptions.get(M).presetArg,J=Y!==void 0?Y:!1;return $.negate===(J===f)}}function L8(f){return f.split("-").reduce(($,M)=>{return $+M[0].toUpperCase()+M.slice(1)})}function P8(f){let $,M,Y=f.split(/[ |,]+/);if(Y.length>1&&!/^[[<]/.test(Y[1]))$=Y.shift();if(M=Y.shift(),!$&&/^-[^-]$/.test(M))$=M,M=void 0;return{shortFlag:$,longFlag:M}}T8.Option=h2;T8.DualOptions=g2});var c2=V((E8)=>{function I8(f,$){if(Math.abs(f.length-$.length)>3)return Math.max(f.length,$.length);let M=[];for(let Y=0;Y<=f.length;Y++)M[Y]=[Y];for(let Y=0;Y<=$.length;Y++)M[0][Y]=Y;for(let Y=1;Y<=$.length;Y++)for(let J=1;J<=f.length;J++){let z=1;if(f[J-1]===$[Y-1])z=0;else z=1;if(M[J][Y]=Math.min(M[J-1][Y]+1,M[J][Y-1]+1,M[J-1][Y-1]+z),J>1&&Y>1&&f[J-1]===$[Y-2]&&f[J-2]===$[Y-1])M[J][Y]=Math.min(M[J][Y],M[J-2][Y-2]+1)}return M[f.length][$.length]}function C8(f,$){if(!$||$.length===0)return"";$=Array.from(new Set($));let M=f.startsWith("--");if(M)f=f.slice(2),$=$.map((Z)=>Z.slice(2));let Y=[],J=3,z=0.4;if($.forEach((Z)=>{if(Z.length<=1)return;let X=I8(f,Z),Q=Math.max(f.length,Z.length);if((Q-X)/Q>z){if(X<J)J=X,Y=[Z];else if(X===J)Y.push(Z)}}),Y.sort((Z,X)=>Z.localeCompare(X)),M)Y=Y.map((Z)=>`--${Z}`);if(Y.length>1)return`
|
|
10
10
|
(Did you mean one of ${Y.join(", ")}?)`;if(Y.length===1)return`
|
|
11
|
-
(Did you mean ${Y[0]}?)`;return""}E8.suggestSimilar=C8});var n2=V((u8)=>{var y8=o("node:events").EventEmitter,
|
|
11
|
+
(Did you mean ${Y[0]}?)`;return""}E8.suggestSimilar=C8});var n2=V((u8)=>{var y8=o("node:events").EventEmitter,Q$=o("node:child_process"),S1=o("node:path"),G$=o("node:fs"),k=o("node:process"),{Argument:k8,humanReadableArgName:b8}=Zf(),{CommanderError:D$}=j0(),{Help:_8}=Z$(),{Option:m2,DualOptions:v8}=X$(),{suggestSimilar:d2}=c2();class U$ extends y8{constructor(f){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=f||"",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:($)=>k.stdout.write($),writeErr:($)=>k.stderr.write($),getOutHelpWidth:()=>k.stdout.isTTY?k.stdout.columns:void 0,getErrHelpWidth:()=>k.stderr.isTTY?k.stderr.columns:void 0,outputError:($,M)=>M($)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(f){return this._outputConfiguration=f._outputConfiguration,this._helpOption=f._helpOption,this._helpCommand=f._helpCommand,this._helpConfiguration=f._helpConfiguration,this._exitCallback=f._exitCallback,this._storeOptionsAsProperties=f._storeOptionsAsProperties,this._combineFlagAndOptionalValue=f._combineFlagAndOptionalValue,this._allowExcessArguments=f._allowExcessArguments,this._enablePositionalOptions=f._enablePositionalOptions,this._showHelpAfterError=f._showHelpAfterError,this._showSuggestionAfterError=f._showSuggestionAfterError,this}_getCommandAndAncestors(){let f=[];for(let $=this;$;$=$.parent)f.push($);return f}command(f,$,M){let Y=$,J=M;if(typeof Y==="object"&&Y!==null)J=Y,Y=null;J=J||{};let[,z,Z]=f.match(/([^ ]+) *(.*)/),X=this.createCommand(z);if(Y)X.description(Y),X._executableHandler=!0;if(J.isDefault)this._defaultCommandName=X._name;if(X._hidden=!!(J.noHelp||J.hidden),X._executableFile=J.executableFile||null,Z)X.arguments(Z);if(this._registerCommand(X),X.parent=this,X.copyInheritedSettings(this),Y)return this;return X}createCommand(f){return new U$(f)}createHelp(){return Object.assign(new _8,this.configureHelp())}configureHelp(f){if(f===void 0)return this._helpConfiguration;return this._helpConfiguration=f,this}configureOutput(f){if(f===void 0)return this._outputConfiguration;return Object.assign(this._outputConfiguration,f),this}showHelpAfterError(f=!0){if(typeof f!=="string")f=!!f;return this._showHelpAfterError=f,this}showSuggestionAfterError(f=!0){return this._showSuggestionAfterError=!!f,this}addCommand(f,$){if(!f._name)throw Error(`Command passed to .addCommand() must have a name
|
|
12
12
|
- specify the name in Command constructor or using .name()`);if($=$||{},$.isDefault)this._defaultCommandName=f._name;if($.noHelp||$.hidden)f._hidden=!0;return this._registerCommand(f),f.parent=this,f._checkForBrokenPassThrough(),this}createArgument(f,$){return new k8(f,$)}argument(f,$,M,Y){let J=this.createArgument(f,$);if(typeof M==="function")J.default(Y).argParser(M);else J.default(M);return this.addArgument(J),this}arguments(f){return f.trim().split(/ +/).forEach(($)=>{this.argument($)}),this}addArgument(f){let $=this.registeredArguments.slice(-1)[0];if($&&$.variadic)throw Error(`only the last argument can be variadic '${$.name()}'`);if(f.required&&f.defaultValue!==void 0&&f.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${f.name()}'`);return this.registeredArguments.push(f),this}helpCommand(f,$){if(typeof f==="boolean")return this._addImplicitHelpCommand=f,this;f=f??"help [command]";let[,M,Y]=f.match(/([^ ]+) *(.*)/),J=$??"display help for command",z=this.createCommand(M);if(z.helpOption(!1),Y)z.arguments(Y);if(J)z.description(J);return this._addImplicitHelpCommand=!0,this._helpCommand=z,this}addHelpCommand(f,$){if(typeof f!=="object")return this.helpCommand(f,$),this;return this._addImplicitHelpCommand=!0,this._helpCommand=f,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(f,$){let M=["preSubcommand","preAction","postAction"];if(!M.includes(f))throw Error(`Unexpected value for event passed to hook : '${f}'.
|
|
13
|
-
Expecting one of '${M.join("', '")}'`);if(this._lifeCycleHooks[f])this._lifeCycleHooks[f].push($);else this._lifeCycleHooks[f]=[$];return this}exitOverride(f){if(f)this._exitCallback=f;else this._exitCallback=($)=>{if($.code!=="commander.executeSubCommandAsync")throw $};return this}_exit(f,$,M){if(this._exitCallback)this._exitCallback(new
|
|
14
|
-
- already used by option '${$.flags}'`)}this.options.push(f)}_registerCommand(f){let $=(Y)=>{return[Y.name()].concat(Y.aliases())},M=$(f).find((Y)=>this._findCommand(Y));if(M){let Y=$(this._findCommand(M)).join("|"),J=$(f).join("|");throw Error(`cannot add command '${J}' as already have command '${Y}'`)}this.commands.push(f)}addOption(f){this._registerOption(f);let $=f.name(),M=f.attributeName();if(f.negate){let J=f.long.replace(/^--no-/,"--");if(!this._findOption(J))this.setOptionValueWithSource(M,f.defaultValue===void 0?!0:f.defaultValue,"default")}else if(f.defaultValue!==void 0)this.setOptionValueWithSource(M,f.defaultValue,"default");let Y=(J,z,Z)=>{if(J==null&&f.presetArg!==void 0)J=f.presetArg;let X=this.getOptionValue(M);if(J!==null&&f.parseArg)J=this._callParseArg(f,J,X,z);else if(J!==null&&f.variadic)J=f._concatValue(J,X);if(J==null)if(f.negate)J=!1;else if(f.isBoolean()||f.optional)J=!0;else J="";this.setOptionValueWithSource(M,J,Z)};if(this.on("option:"+$,(J)=>{let z=`error: option '${f.flags}' argument '${J}' is invalid.`;Y(J,z,"cli")}),f.envVar)this.on("optionEnv:"+$,(J)=>{let z=`error: option '${f.flags}' value '${J}' from env '${f.envVar}' is invalid.`;Y(J,z,"env")});return this}_optionEx(f,$,M,Y,J){if(typeof $==="object"&&$ instanceof m2)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let z=this.createOption($,M);if(z.makeOptionMandatory(!!f.mandatory),typeof Y==="function")z.default(J).argParser(Y);else if(Y instanceof RegExp){let Z=Y;Y=(X,Q)=>{let G=Z.exec(X);return G?G[0]:Q},z.default(J).argParser(Y)}else z.default(Y);return this.addOption(z)}option(f,$,M,Y){return this._optionEx({},f,$,M,Y)}requiredOption(f,$,M,Y){return this._optionEx({mandatory:!0},f,$,M,Y)}combineFlagAndOptionalValue(f=!0){return this._combineFlagAndOptionalValue=!!f,this}allowUnknownOption(f=!0){return this._allowUnknownOption=!!f,this}allowExcessArguments(f=!0){return this._allowExcessArguments=!!f,this}enablePositionalOptions(f=!0){return this._enablePositionalOptions=!!f,this}passThroughOptions(f=!0){return this._passThroughOptions=!!f,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(f=!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=!!f,this}getOptionValue(f){if(this._storeOptionsAsProperties)return this[f];return this._optionValues[f]}setOptionValue(f,$){return this.setOptionValueWithSource(f,$,void 0)}setOptionValueWithSource(f,$,M){if(this._storeOptionsAsProperties)this[f]=$;else this._optionValues[f]=$;return this._optionValueSources[f]=M,this}getOptionValueSource(f){return this._optionValueSources[f]}getOptionValueSourceWithGlobals(f){let $;return this._getCommandAndAncestors().forEach((M)=>{if(M.getOptionValueSource(f)!==void 0)$=M.getOptionValueSource(f)}),$}_prepareUserArgs(f,$){if(f!==void 0&&!Array.isArray(f))throw Error("first parameter to parse must be array or undefined");if($=$||{},f===void 0&&$.from===void 0){if(k.versions?.electron)$.from="electron";let Y=k.execArgv??[];if(Y.includes("-e")||Y.includes("--eval")||Y.includes("-p")||Y.includes("--print"))$.from="eval"}if(f===void 0)f=k.argv;this.rawArgs=f.slice();let M;switch($.from){case void 0:case"node":this._scriptPath=f[1],M=f.slice(2);break;case"electron":if(k.defaultApp)this._scriptPath=f[1],M=f.slice(2);else M=f.slice(1);break;case"user":M=f.slice(0);break;case"eval":M=f.slice(1);break;default:throw Error(`unexpected parse option { from: '${$.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",M}parse(f,$){let M=this._prepareUserArgs(f,$);return this._parseCommand([],M),this}async parseAsync(f,$){let M=this._prepareUserArgs(f,$);return await this._parseCommand([],M),this}_executeSubCommand(f,$){$=$.slice();let M=!1,Y=[".js",".ts",".tsx",".mjs",".cjs"];function J(G,D){let U=S1.resolve(G,D);if(
|
|
13
|
+
Expecting one of '${M.join("', '")}'`);if(this._lifeCycleHooks[f])this._lifeCycleHooks[f].push($);else this._lifeCycleHooks[f]=[$];return this}exitOverride(f){if(f)this._exitCallback=f;else this._exitCallback=($)=>{if($.code!=="commander.executeSubCommandAsync")throw $};return this}_exit(f,$,M){if(this._exitCallback)this._exitCallback(new D$(f,$,M));k.exit(f)}action(f){let $=(M)=>{let Y=this.registeredArguments.length,J=M.slice(0,Y);if(this._storeOptionsAsProperties)J[Y]=this;else J[Y]=this.opts();return J.push(this),f.apply(this,J)};return this._actionHandler=$,this}createOption(f,$){return new m2(f,$)}_callParseArg(f,$,M,Y){try{return f.parseArg($,M)}catch(J){if(J.code==="commander.invalidArgument"){let z=`${Y} ${J.message}`;this.error(z,{exitCode:J.exitCode,code:J.code})}throw J}}_registerOption(f){let $=f.short&&this._findOption(f.short)||f.long&&this._findOption(f.long);if($){let M=f.long&&this._findOption(f.long)?f.long:f.short;throw Error(`Cannot add option '${f.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${M}'
|
|
14
|
+
- already used by option '${$.flags}'`)}this.options.push(f)}_registerCommand(f){let $=(Y)=>{return[Y.name()].concat(Y.aliases())},M=$(f).find((Y)=>this._findCommand(Y));if(M){let Y=$(this._findCommand(M)).join("|"),J=$(f).join("|");throw Error(`cannot add command '${J}' as already have command '${Y}'`)}this.commands.push(f)}addOption(f){this._registerOption(f);let $=f.name(),M=f.attributeName();if(f.negate){let J=f.long.replace(/^--no-/,"--");if(!this._findOption(J))this.setOptionValueWithSource(M,f.defaultValue===void 0?!0:f.defaultValue,"default")}else if(f.defaultValue!==void 0)this.setOptionValueWithSource(M,f.defaultValue,"default");let Y=(J,z,Z)=>{if(J==null&&f.presetArg!==void 0)J=f.presetArg;let X=this.getOptionValue(M);if(J!==null&&f.parseArg)J=this._callParseArg(f,J,X,z);else if(J!==null&&f.variadic)J=f._concatValue(J,X);if(J==null)if(f.negate)J=!1;else if(f.isBoolean()||f.optional)J=!0;else J="";this.setOptionValueWithSource(M,J,Z)};if(this.on("option:"+$,(J)=>{let z=`error: option '${f.flags}' argument '${J}' is invalid.`;Y(J,z,"cli")}),f.envVar)this.on("optionEnv:"+$,(J)=>{let z=`error: option '${f.flags}' value '${J}' from env '${f.envVar}' is invalid.`;Y(J,z,"env")});return this}_optionEx(f,$,M,Y,J){if(typeof $==="object"&&$ instanceof m2)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let z=this.createOption($,M);if(z.makeOptionMandatory(!!f.mandatory),typeof Y==="function")z.default(J).argParser(Y);else if(Y instanceof RegExp){let Z=Y;Y=(X,Q)=>{let G=Z.exec(X);return G?G[0]:Q},z.default(J).argParser(Y)}else z.default(Y);return this.addOption(z)}option(f,$,M,Y){return this._optionEx({},f,$,M,Y)}requiredOption(f,$,M,Y){return this._optionEx({mandatory:!0},f,$,M,Y)}combineFlagAndOptionalValue(f=!0){return this._combineFlagAndOptionalValue=!!f,this}allowUnknownOption(f=!0){return this._allowUnknownOption=!!f,this}allowExcessArguments(f=!0){return this._allowExcessArguments=!!f,this}enablePositionalOptions(f=!0){return this._enablePositionalOptions=!!f,this}passThroughOptions(f=!0){return this._passThroughOptions=!!f,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(f=!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=!!f,this}getOptionValue(f){if(this._storeOptionsAsProperties)return this[f];return this._optionValues[f]}setOptionValue(f,$){return this.setOptionValueWithSource(f,$,void 0)}setOptionValueWithSource(f,$,M){if(this._storeOptionsAsProperties)this[f]=$;else this._optionValues[f]=$;return this._optionValueSources[f]=M,this}getOptionValueSource(f){return this._optionValueSources[f]}getOptionValueSourceWithGlobals(f){let $;return this._getCommandAndAncestors().forEach((M)=>{if(M.getOptionValueSource(f)!==void 0)$=M.getOptionValueSource(f)}),$}_prepareUserArgs(f,$){if(f!==void 0&&!Array.isArray(f))throw Error("first parameter to parse must be array or undefined");if($=$||{},f===void 0&&$.from===void 0){if(k.versions?.electron)$.from="electron";let Y=k.execArgv??[];if(Y.includes("-e")||Y.includes("--eval")||Y.includes("-p")||Y.includes("--print"))$.from="eval"}if(f===void 0)f=k.argv;this.rawArgs=f.slice();let M;switch($.from){case void 0:case"node":this._scriptPath=f[1],M=f.slice(2);break;case"electron":if(k.defaultApp)this._scriptPath=f[1],M=f.slice(2);else M=f.slice(1);break;case"user":M=f.slice(0);break;case"eval":M=f.slice(1);break;default:throw Error(`unexpected parse option { from: '${$.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",M}parse(f,$){let M=this._prepareUserArgs(f,$);return this._parseCommand([],M),this}async parseAsync(f,$){let M=this._prepareUserArgs(f,$);return await this._parseCommand([],M),this}_executeSubCommand(f,$){$=$.slice();let M=!1,Y=[".js",".ts",".tsx",".mjs",".cjs"];function J(G,D){let U=S1.resolve(G,D);if(G$.existsSync(U))return U;if(Y.includes(S1.extname(D)))return;let K=Y.find((W)=>G$.existsSync(`${U}${W}`));if(K)return`${U}${K}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let z=f._executableFile||`${this._name}-${f._name}`,Z=this._executableDir||"";if(this._scriptPath){let G;try{G=G$.realpathSync(this._scriptPath)}catch(D){G=this._scriptPath}Z=S1.resolve(S1.dirname(G),Z)}if(Z){let G=J(Z,z);if(!G&&!f._executableFile&&this._scriptPath){let D=S1.basename(this._scriptPath,S1.extname(this._scriptPath));if(D!==this._name)G=J(Z,`${D}-${f._name}`)}z=G||z}M=Y.includes(S1.extname(z));let X;if(k.platform!=="win32")if(M)$.unshift(z),$=l2(k.execArgv).concat($),X=Q$.spawn(k.argv[0],$,{stdio:"inherit"});else X=Q$.spawn(z,$,{stdio:"inherit"});else $.unshift(z),$=l2(k.execArgv).concat($),X=Q$.spawn(k.execPath,$,{stdio:"inherit"});if(!X.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((D)=>{k.on(D,()=>{if(X.killed===!1&&X.exitCode===null)X.kill(D)})});let Q=this._exitCallback;X.on("close",(G)=>{if(G=G??1,!Q)k.exit(G);else Q(new D$(G,"commander.executeSubCommandAsync","(close)"))}),X.on("error",(G)=>{if(G.code==="ENOENT"){let D=Z?`searched for local subcommand relative to directory '${Z}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",U=`'${z}' does not exist
|
|
15
15
|
- if '${f._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
16
16
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
17
|
-
- ${D}`;throw Error(U)}else if(G.code==="EACCES")throw Error(`'${z}' not executable`);if(!Q)k.exit(1);else{let D=new
|
|
17
|
+
- ${D}`;throw Error(U)}else if(G.code==="EACCES")throw Error(`'${z}' not executable`);if(!Q)k.exit(1);else{let D=new D$(1,"commander.executeSubCommandAsync","(error)");D.nestedError=G,Q(D)}}),this.runningCommand=X}_dispatchSubcommand(f,$,M){let Y=this._findCommand(f);if(!Y)this.help({error:!0});let J;return J=this._chainOrCallSubCommandHook(J,Y,"preSubcommand"),J=this._chainOrCall(J,()=>{if(Y._executableHandler)this._executeSubCommand(Y,$.concat(M));else return Y._parseCommand($,M)}),J}_dispatchHelpCommand(f){if(!f)this.help();let $=this._findCommand(f);if($&&!$._executableHandler)$.help();return this._dispatchSubcommand(f,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((f,$)=>{if(f.required&&this.args[$]==null)this.missingArgument(f.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 f=(M,Y,J)=>{let z=Y;if(Y!==null&&M.parseArg){let Z=`error: command-argument value '${Y}' is invalid for argument '${M.name()}'.`;z=this._callParseArg(M,Y,J,Z)}return z};this._checkNumberOfArguments();let $=[];this.registeredArguments.forEach((M,Y)=>{let J=M.defaultValue;if(M.variadic){if(Y<this.args.length){if(J=this.args.slice(Y),M.parseArg)J=J.reduce((z,Z)=>{return f(M,Z,z)},M.defaultValue)}else if(J===void 0)J=[]}else if(Y<this.args.length){if(J=this.args[Y],M.parseArg)J=f(M,J,M.defaultValue)}$[Y]=J}),this.processedArgs=$}_chainOrCall(f,$){if(f&&f.then&&typeof f.then==="function")return f.then(()=>$());return $()}_chainOrCallHooks(f,$){let M=f,Y=[];if(this._getCommandAndAncestors().reverse().filter((J)=>J._lifeCycleHooks[$]!==void 0).forEach((J)=>{J._lifeCycleHooks[$].forEach((z)=>{Y.push({hookedCommand:J,callback:z})})}),$==="postAction")Y.reverse();return Y.forEach((J)=>{M=this._chainOrCall(M,()=>{return J.callback(J.hookedCommand,this)})}),M}_chainOrCallSubCommandHook(f,$,M){let Y=f;if(this._lifeCycleHooks[M]!==void 0)this._lifeCycleHooks[M].forEach((J)=>{Y=this._chainOrCall(Y,()=>{return J(this,$)})});return Y}_parseCommand(f,$){let M=this.parseOptions($);if(this._parseOptionsEnv(),this._parseOptionsImplied(),f=f.concat(M.operands),$=M.unknown,this.args=f.concat($),f&&this._findCommand(f[0]))return this._dispatchSubcommand(f[0],f.slice(1),$);if(this._getHelpCommand()&&f[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(f[1]);if(this._defaultCommandName)return this._outputHelpIfRequested($),this._dispatchSubcommand(this._defaultCommandName,f,$);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(M.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let Y=()=>{if(M.unknown.length>0)this.unknownOption(M.unknown[0])},J=`command:${this.name()}`;if(this._actionHandler){Y(),this._processArguments();let z;if(z=this._chainOrCallHooks(z,"preAction"),z=this._chainOrCall(z,()=>this._actionHandler(this.processedArgs)),this.parent)z=this._chainOrCall(z,()=>{this.parent.emit(J,f,$)});return z=this._chainOrCallHooks(z,"postAction"),z}if(this.parent&&this.parent.listenerCount(J))Y(),this._processArguments(),this.parent.emit(J,f,$);else if(f.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",f,$);if(this.listenerCount("command:*"))this.emit("command:*",f,$);else if(this.commands.length)this.unknownCommand();else Y(),this._processArguments()}else if(this.commands.length)Y(),this.help({error:!0});else Y(),this._processArguments()}_findCommand(f){if(!f)return;return this.commands.find(($)=>$._name===f||$._aliases.includes(f))}_findOption(f){return this.options.find(($)=>$.is(f))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((f)=>{f.options.forEach(($)=>{if($.mandatory&&f.getOptionValue($.attributeName())===void 0)f.missingMandatoryOptionValue($)})})}_checkForConflictingLocalOptions(){let f=this.options.filter((M)=>{let Y=M.attributeName();if(this.getOptionValue(Y)===void 0)return!1;return this.getOptionValueSource(Y)!=="default"});f.filter((M)=>M.conflictsWith.length>0).forEach((M)=>{let Y=f.find((J)=>M.conflictsWith.includes(J.attributeName()));if(Y)this._conflictingOption(M,Y)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((f)=>{f._checkForConflictingLocalOptions()})}parseOptions(f){let $=[],M=[],Y=$,J=f.slice();function z(X){return X.length>1&&X[0]==="-"}let Z=null;while(J.length){let X=J.shift();if(X==="--"){if(Y===M)Y.push(X);Y.push(...J);break}if(Z&&!z(X)){this.emit(`option:${Z.name()}`,X);continue}if(Z=null,z(X)){let Q=this._findOption(X);if(Q){if(Q.required){let G=J.shift();if(G===void 0)this.optionMissingArgument(Q);this.emit(`option:${Q.name()}`,G)}else if(Q.optional){let G=null;if(J.length>0&&!z(J[0]))G=J.shift();this.emit(`option:${Q.name()}`,G)}else this.emit(`option:${Q.name()}`);Z=Q.variadic?Q:null;continue}}if(X.length>2&&X[0]==="-"&&X[1]!=="-"){let Q=this._findOption(`-${X[1]}`);if(Q){if(Q.required||Q.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${Q.name()}`,X.slice(2));else this.emit(`option:${Q.name()}`),J.unshift(`-${X.slice(2)}`);continue}}if(/^--[^=]+=/.test(X)){let Q=X.indexOf("="),G=this._findOption(X.slice(0,Q));if(G&&(G.required||G.optional)){this.emit(`option:${G.name()}`,X.slice(Q+1));continue}}if(z(X))Y=M;if((this._enablePositionalOptions||this._passThroughOptions)&&$.length===0&&M.length===0){if(this._findCommand(X)){if($.push(X),J.length>0)M.push(...J);break}else if(this._getHelpCommand()&&X===this._getHelpCommand().name()){if($.push(X),J.length>0)$.push(...J);break}else if(this._defaultCommandName){if(M.push(X),J.length>0)M.push(...J);break}}if(this._passThroughOptions){if(Y.push(X),J.length>0)Y.push(...J);break}Y.push(X)}return{operands:$,unknown:M}}opts(){if(this._storeOptionsAsProperties){let f={},$=this.options.length;for(let M=0;M<$;M++){let Y=this.options[M].attributeName();f[Y]=Y===this._versionOptionName?this._version:this[Y]}return f}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((f,$)=>Object.assign(f,$.opts()),{})}error(f,$){if(this._outputConfiguration.outputError(`${f}
|
|
18
18
|
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
19
19
|
`);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
|
|
20
20
|
`),this.outputHelp({error:!0});let M=$||{},Y=M.exitCode||1,J=M.code||"commander.error";this._exit(Y,J,f)}_parseOptionsEnv(){this.options.forEach((f)=>{if(f.envVar&&f.envVar in k.env){let $=f.attributeName();if(this.getOptionValue($)===void 0||["default","config","env"].includes(this.getOptionValueSource($)))if(f.required||f.optional)this.emit(`optionEnv:${f.name()}`,k.env[f.envVar]);else this.emit(`optionEnv:${f.name()}`)}})}_parseOptionsImplied(){let f=new v8(this.options),$=(M)=>{return this.getOptionValue(M)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(M))};this.options.filter((M)=>M.implied!==void 0&&$(M.attributeName())&&f.valueFromOption(this.getOptionValue(M.attributeName()),M)).forEach((M)=>{Object.keys(M.implied).filter((Y)=>!$(Y)).forEach((Y)=>{this.setOptionValueWithSource(Y,M.implied[Y],"implied")})})}missingArgument(f){let $=`error: missing required argument '${f}'`;this.error($,{code:"commander.missingArgument"})}optionMissingArgument(f){let $=`error: option '${f.flags}' argument missing`;this.error($,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(f){let $=`error: required option '${f.flags}' not specified`;this.error($,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(f,$){let M=(z)=>{let Z=z.attributeName(),X=this.getOptionValue(Z),Q=this.options.find((D)=>D.negate&&Z===D.attributeName()),G=this.options.find((D)=>!D.negate&&Z===D.attributeName());if(Q&&(Q.presetArg===void 0&&X===!1||Q.presetArg!==void 0&&X===Q.presetArg))return Q;return G||z},Y=(z)=>{let Z=M(z),X=Z.attributeName();if(this.getOptionValueSource(X)==="env")return`environment variable '${Z.envVar}'`;return`option '${Z.flags}'`},J=`error: ${Y(f)} cannot be used with ${Y($)}`;this.error(J,{code:"commander.conflictingOption"})}unknownOption(f){if(this._allowUnknownOption)return;let $="";if(f.startsWith("--")&&this._showSuggestionAfterError){let Y=[],J=this;do{let z=J.createHelp().visibleOptions(J).filter((Z)=>Z.long).map((Z)=>Z.long);Y=Y.concat(z),J=J.parent}while(J&&!J._enablePositionalOptions);$=d2(f,Y)}let M=`error: unknown option '${f}'${$}`;this.error(M,{code:"commander.unknownOption"})}_excessArguments(f){if(this._allowExcessArguments)return;let $=this.registeredArguments.length,M=$===1?"":"s",J=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${$} argument${M} but got ${f.length}.`;this.error(J,{code:"commander.excessArguments"})}unknownCommand(){let f=this.args[0],$="";if(this._showSuggestionAfterError){let Y=[];this.createHelp().visibleCommands(this).forEach((J)=>{if(Y.push(J.name()),J.alias())Y.push(J.alias())}),$=d2(f,Y)}let M=`error: unknown command '${f}'${$}`;this.error(M,{code:"commander.unknownCommand"})}version(f,$,M){if(f===void 0)return this._version;this._version=f,$=$||"-V, --version",M=M||"output the version number";let Y=this.createOption($,M);return this._versionOptionName=Y.attributeName(),this._registerOption(Y),this.on("option:"+Y.name(),()=>{this._outputConfiguration.writeOut(`${f}
|
|
21
21
|
`),this._exit(0,"commander.version",f)}),this}description(f,$){if(f===void 0&&$===void 0)return this._description;if(this._description=f,$)this._argsDescription=$;return this}summary(f){if(f===void 0)return this._summary;return this._summary=f,this}alias(f){if(f===void 0)return this._aliases[0];let $=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)$=this.commands[this.commands.length-1];if(f===$._name)throw Error("Command alias can't be the same as its name");let M=this.parent?._findCommand(f);if(M){let Y=[M.name()].concat(M.aliases()).join("|");throw Error(`cannot add alias '${f}' to command '${this.name()}' as already have command '${Y}'`)}return $._aliases.push(f),this}aliases(f){if(f===void 0)return this._aliases;return f.forEach(($)=>this.alias($)),this}usage(f){if(f===void 0){if(this._usage)return this._usage;let $=this.registeredArguments.map((M)=>{return b8(M)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?$:[]).join(" ")}return this._usage=f,this}name(f){if(f===void 0)return this._name;return this._name=f,this}nameFromFilename(f){return this._name=S1.basename(f,S1.extname(f)),this}executableDir(f){if(f===void 0)return this._executableDir;return this._executableDir=f,this}helpInformation(f){let $=this.createHelp();if($.helpWidth===void 0)$.helpWidth=f&&f.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth();return $.formatHelp(this,$)}_getHelpContext(f){f=f||{};let $={error:!!f.error},M;if($.error)M=(Y)=>this._outputConfiguration.writeErr(Y);else M=(Y)=>this._outputConfiguration.writeOut(Y);return $.write=f.write||M,$.command=this,$}outputHelp(f){let $;if(typeof f==="function")$=f,f=void 0;let M=this._getHelpContext(f);this._getCommandAndAncestors().reverse().forEach((J)=>J.emit("beforeAllHelp",M)),this.emit("beforeHelp",M);let Y=this.helpInformation(M);if($){if(Y=$(Y),typeof Y!=="string"&&!Buffer.isBuffer(Y))throw Error("outputHelp callback must return a string or a Buffer")}if(M.write(Y),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",M),this._getCommandAndAncestors().forEach((J)=>J.emit("afterAllHelp",M))}helpOption(f,$){if(typeof f==="boolean"){if(f)this._helpOption=this._helpOption??void 0;else this._helpOption=null;return this}return f=f??"-h, --help",$=$??"display help for command",this._helpOption=this.createOption(f,$),this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(f){return this._helpOption=f,this}help(f){this.outputHelp(f);let $=k.exitCode||0;if($===0&&f&&typeof f!=="function"&&f.error)$=1;this._exit($,"commander.help","(outputHelp)")}addHelpText(f,$){let M=["beforeAll","before","after","afterAll"];if(!M.includes(f))throw Error(`Unexpected value for position to addHelpText.
|
|
22
22
|
Expecting one of '${M.join("', '")}'`);let Y=`${f}Help`;return this.on(Y,(J)=>{let z;if(typeof $==="function")z=$({error:J.error,command:J.command});else z=$;if(z)J.write(`${z}
|
|
23
|
-
`)}),this}_outputHelpIfRequested(f){let $=this._getHelpOption();if($&&f.find((Y)=>$.is(Y)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function l2(f){return f.map(($)=>{if(!$.startsWith("--inspect"))return $;let M,Y="127.0.0.1",J="9229",z;if((z=$.match(/^(--inspect(-brk)?)$/))!==null)M=z[1];else if((z=$.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(M=z[1],/^\d+$/.test(z[3]))J=z[3];else Y=z[3];else if((z=$.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)M=z[1],Y=z[3],J=z[4];if(M&&J!=="0")return`${M}=${Y}:${parseInt(J)+1}`;return $})}u8.Command=D$});var o2=V((m8)=>{var{Argument:r2}=Zf(),{Command:U$}=n2(),{CommanderError:g8,InvalidArgumentError:p2}=j0(),{Help:c8}=z$(),{Option:i2}=Z$();m8.program=new U$;m8.createCommand=(f)=>new U$(f);m8.createOption=(f,$)=>new i2(f,$);m8.createArgument=(f,$)=>new r2(f,$);m8.Command=U$;m8.Option=i2;m8.Argument=r2;m8.Help=c8;m8.CommanderError=g8;m8.InvalidArgumentError=p2;m8.InvalidOptionArgumentError=p2});var q$=V((K$,V$)=>{(function(f,$){typeof K$=="object"&&typeof V$<"u"?V$.exports=$():typeof define=="function"&&define.amd?define($):(f=typeof globalThis<"u"?globalThis:f||self).dayjs=$()})(K$,function(){var f=1000,$=60000,M=3600000,Y="millisecond",J="second",z="minute",Z="hour",X="day",Q="week",G="month",D="quarter",U="year",K="date",W="Invalid Date",B=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,A=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,F={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(O){var H=["th","st","nd","rd"],q=O%100;return"["+O+(H[(q-20)%10]||H[q]||H[0])+"]"}},T=function(O,H,q){var R=String(O);return!R||R.length>=H?O:""+Array(H+1-R.length).join(q)+O},c={s:T,z:function(O){var H=-O.utcOffset(),q=Math.abs(H),R=Math.floor(q/60),S=q%60;return(H<=0?"+":"-")+T(R,2,"0")+":"+T(S,2,"0")},m:function O(H,q){if(H.date()<q.date())return-O(q,H);var R=12*(q.year()-H.year())+(q.month()-H.month()),S=H.clone().add(R,G),L=q-S<0,P=H.clone().add(R+(L?-1:1),G);return+(-(R+(q-S)/(L?S-P:P-S))||0)},a:function(O){return O<0?Math.ceil(O)||0:Math.floor(O)},p:function(O){return{M:G,y:U,w:Q,d:X,D:K,h:Z,m:z,s:J,ms:Y,Q:D}[O]||String(O||"").toLowerCase().replace(/s$/,"")},u:function(O){return O===void 0}},r="en",J1={};J1[r]=F;var L0="$isDayjsObject",f1=function(O){return O instanceof p||!(!O||!O[L0])},f0=function O(H,q,R){var S;if(!H)return r;if(typeof H=="string"){var L=H.toLowerCase();J1[L]&&(S=L),q&&(J1[L]=q,S=L);var P=H.split("-");if(!S&&P.length>1)return O(P[0])}else{var C=H.name;J1[C]=H,S=C}return!R&&S&&(r=S),S||!R&&r},_=function(O,H){if(f1(O))return O.clone();var q=typeof H=="object"?H:{};return q.date=O,q.args=arguments,new p(q)},w=c;w.l=f0,w.i=f1,w.w=function(O,H){return _(O,{locale:H.$L,utc:H.$u,x:H.$x,$offset:H.$offset})};var p=function(){function O(q){this.$L=f0(q.locale,null,!0),this.parse(q),this.$x=this.$x||q.x||{},this[L0]=!0}var H=O.prototype;return H.parse=function(q){this.$d=function(R){var{date:S,utc:L}=R;if(S===null)return new Date(NaN);if(w.u(S))return new Date;if(S instanceof Date)return new Date(S);if(typeof S=="string"&&!/Z$/i.test(S)){var P=S.match(B);if(P){var C=P[2]-1||0,v=(P[7]||"0").substring(0,3);return L?new Date(Date.UTC(P[1],C,P[3]||1,P[4]||0,P[5]||0,P[6]||0,v)):new Date(P[1],C,P[3]||1,P[4]||0,P[5]||0,P[6]||0,v)}}return new Date(S)}(q),this.init()},H.init=function(){var q=this.$d;this.$y=q.getFullYear(),this.$M=q.getMonth(),this.$D=q.getDate(),this.$W=q.getDay(),this.$H=q.getHours(),this.$m=q.getMinutes(),this.$s=q.getSeconds(),this.$ms=q.getMilliseconds()},H.$utils=function(){return w},H.isValid=function(){return this.$d.toString()!==W},H.isSame=function(q,R){var S=_(q);return this.startOf(R)<=S&&S<=this.endOf(R)},H.isAfter=function(q,R){return _(q)<this.startOf(R)},H.isBefore=function(q,R){return this.endOf(R)<_(q)},H.$g=function(q,R,S){return w.u(q)?this[R]:this.set(S,q)},H.unix=function(){return Math.floor(this.valueOf()/1000)},H.valueOf=function(){return this.$d.getTime()},H.startOf=function(q,R){var S=this,L=!!w.u(R)||R,P=w.p(q),C=function(u1,i){var w1=w.w(S.$u?Date.UTC(S.$y,i,u1):new Date(S.$y,i,u1),S);return L?w1:w1.endOf(X)},v=function(u1,i){return w.w(S.toDate()[u1].apply(S.toDate("s"),(L?[0,0,0,0]:[23,59,59,999]).slice(i)),S)},g=this.$W,m=this.$M,$1=this.$D,$0="set"+(this.$u?"UTC":"");switch(P){case U:return L?C(1,0):C(31,11);case G:return L?C(1,m):C(0,m+1);case Q:var v1=this.$locale().weekStart||0,P0=(g<v1?g+7:g)-v1;return C(L?$1-P0:$1+(6-P0),m);case X:case K:return v($0+"Hours",0);case Z:return v($0+"Minutes",1);case z:return v($0+"Seconds",2);case J:return v($0+"Milliseconds",3);default:return this.clone()}},H.endOf=function(q){return this.startOf(q,!1)},H.$set=function(q,R){var S,L=w.p(q),P="set"+(this.$u?"UTC":""),C=(S={},S[X]=P+"Date",S[K]=P+"Date",S[G]=P+"Month",S[U]=P+"FullYear",S[Z]=P+"Hours",S[z]=P+"Minutes",S[J]=P+"Seconds",S[Y]=P+"Milliseconds",S)[L],v=L===X?this.$D+(R-this.$W):R;if(L===G||L===U){var g=this.clone().set(K,1);g.$d[C](v),g.init(),this.$d=g.set(K,Math.min(this.$D,g.daysInMonth())).$d}else C&&this.$d[C](v);return this.init(),this},H.set=function(q,R){return this.clone().$set(q,R)},H.get=function(q){return this[w.p(q)]()},H.add=function(q,R){var S,L=this;q=Number(q);var P=w.p(R),C=function(m){var $1=_(L);return w.w($1.date($1.date()+Math.round(m*q)),L)};if(P===G)return this.set(G,this.$M+q);if(P===U)return this.set(U,this.$y+q);if(P===X)return C(1);if(P===Q)return C(7);var v=(S={},S[z]=$,S[Z]=M,S[J]=f,S)[P]||1,g=this.$d.getTime()+q*v;return w.w(g,this)},H.subtract=function(q,R){return this.add(-1*q,R)},H.format=function(q){var R=this,S=this.$locale();if(!this.isValid())return S.invalidDate||W;var L=q||"YYYY-MM-DDTHH:mm:ssZ",P=w.z(this),C=this.$H,v=this.$m,g=this.$M,m=S.weekdays,$1=S.months,$0=S.meridiem,v1=function(i,w1,T0,zf){return i&&(i[w1]||i(R,L))||T0[w1].slice(0,zf)},P0=function(i){return w.s(C%12||12,i,"0")},u1=$0||function(i,w1,T0){var zf=i<12?"AM":"PM";return T0?zf.toLowerCase():zf};return L.replace(A,function(i,w1){return w1||function(T0){switch(T0){case"YY":return String(R.$y).slice(-2);case"YYYY":return w.s(R.$y,4,"0");case"M":return g+1;case"MM":return w.s(g+1,2,"0");case"MMM":return v1(S.monthsShort,g,$1,3);case"MMMM":return v1($1,g);case"D":return R.$D;case"DD":return w.s(R.$D,2,"0");case"d":return String(R.$W);case"dd":return v1(S.weekdaysMin,R.$W,m,2);case"ddd":return v1(S.weekdaysShort,R.$W,m,3);case"dddd":return m[R.$W];case"H":return String(C);case"HH":return w.s(C,2,"0");case"h":return P0(1);case"hh":return P0(2);case"a":return u1(C,v,!0);case"A":return u1(C,v,!1);case"m":return String(v);case"mm":return w.s(v,2,"0");case"s":return String(R.$s);case"ss":return w.s(R.$s,2,"0");case"SSS":return w.s(R.$ms,3,"0");case"Z":return P}return null}(i)||P.replace(":","")})},H.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},H.diff=function(q,R,S){var L,P=this,C=w.p(R),v=_(q),g=(v.utcOffset()-this.utcOffset())*$,m=this-v,$1=function(){return w.m(P,v)};switch(C){case U:L=$1()/12;break;case G:L=$1();break;case D:L=$1()/3;break;case Q:L=(m-g)/604800000;break;case X:L=(m-g)/86400000;break;case Z:L=m/M;break;case z:L=m/$;break;case J:L=m/f;break;default:L=m}return S?L:w.a(L)},H.daysInMonth=function(){return this.endOf(G).$D},H.$locale=function(){return J1[this.$L]},H.locale=function(q,R){if(!q)return this.$L;var S=this.clone(),L=f0(q,R,!0);return L&&(S.$L=L),S},H.clone=function(){return w.w(this.$d,this)},H.toDate=function(){return new Date(this.valueOf())},H.toJSON=function(){return this.isValid()?this.toISOString():null},H.toISOString=function(){return this.$d.toISOString()},H.toString=function(){return this.$d.toUTCString()},O}(),H1=p.prototype;return _.prototype=H1,[["$ms",Y],["$s",J],["$m",z],["$H",Z],["$W",X],["$M",G],["$y",U],["$D",K]].forEach(function(O){H1[O[1]]=function(H){return this.$g(H,O[0],O[1])}}),_.extend=function(O,H){return O.$i||(O(H,p,_),O.$i=!0),_},_.locale=f0,_.isDayjs=f1,_.unix=function(O){return _(1000*O)},_.en=J1[r],_.Ls=J1,_.p={},_})});var e2=V((B$,H$)=>{(function(f,$){typeof B$=="object"&&typeof H$<"u"?H$.exports=$(q$()):typeof define=="function"&&define.amd?define(["dayjs"],$):(f=typeof globalThis<"u"?globalThis:f||self).dayjs_locale_zh_cn=$(f.dayjs)})(B$,function(f){function $(J){return J&&typeof J=="object"&&"default"in J?J:{default:J}}var M=$(f),Y={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(J,z){return z==="W"?J+"周":J+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(J,z){var Z=100*J+z;return Z<600?"凌晨":Z<900?"早上":Z<1100?"上午":Z<1300?"中午":Z<1800?"下午":"晚上"}};return M.default.locale(Y,null,!0),Y})});var E0=V((oK,YM)=>{var MZ=Object.prototype.toString;YM.exports=function($){if($===void 0)return"undefined";if($===null)return"null";var M=typeof $;if(M==="boolean")return"boolean";if(M==="string")return"string";if(M==="number")return"number";if(M==="symbol")return"symbol";if(M==="function")return XZ($)?"generatorfunction":"function";if(YZ($))return"array";if(DZ($))return"buffer";if(GZ($))return"arguments";if(zZ($))return"date";if(JZ($))return"error";if(ZZ($))return"regexp";switch(MM($)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(QZ($))return"generator";switch(M=MZ.call($),M){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return M.slice(8,-1).toLowerCase().replace(/\s/g,"")};function MM(f){return typeof f.constructor==="function"?f.constructor.name:null}function YZ(f){if(Array.isArray)return Array.isArray(f);return f instanceof Array}function JZ(f){return f instanceof Error||typeof f.message==="string"&&f.constructor&&typeof f.constructor.stackTraceLimit==="number"}function zZ(f){if(f instanceof Date)return!0;return typeof f.toDateString==="function"&&typeof f.getDate==="function"&&typeof f.setDate==="function"}function ZZ(f){if(f instanceof RegExp)return!0;return typeof f.flags==="string"&&typeof f.ignoreCase==="boolean"&&typeof f.multiline==="boolean"&&typeof f.global==="boolean"}function XZ(f,$){return MM(f)==="GeneratorFunction"}function QZ(f){return typeof f.throw==="function"&&typeof f.return==="function"&&typeof f.next==="function"}function GZ(f){try{if(typeof f.length==="number"&&typeof f.callee==="function")return!0}catch($){if($.message.indexOf("callee")!==-1)return!0}return!1}function DZ(f){if(f.constructor&&typeof f.constructor.isBuffer==="function")return f.constructor.isBuffer(f);return!1}});var zM=V((sK,JM)=>{/*!
|
|
23
|
+
`)}),this}_outputHelpIfRequested(f){let $=this._getHelpOption();if($&&f.find((Y)=>$.is(Y)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function l2(f){return f.map(($)=>{if(!$.startsWith("--inspect"))return $;let M,Y="127.0.0.1",J="9229",z;if((z=$.match(/^(--inspect(-brk)?)$/))!==null)M=z[1];else if((z=$.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(M=z[1],/^\d+$/.test(z[3]))J=z[3];else Y=z[3];else if((z=$.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)M=z[1],Y=z[3],J=z[4];if(M&&J!=="0")return`${M}=${Y}:${parseInt(J)+1}`;return $})}u8.Command=U$});var o2=V((m8)=>{var{Argument:r2}=Zf(),{Command:W$}=n2(),{CommanderError:g8,InvalidArgumentError:p2}=j0(),{Help:c8}=Z$(),{Option:i2}=X$();m8.program=new W$;m8.createCommand=(f)=>new W$(f);m8.createOption=(f,$)=>new i2(f,$);m8.createArgument=(f,$)=>new r2(f,$);m8.Command=W$;m8.Option=i2;m8.Argument=r2;m8.Help=c8;m8.CommanderError=g8;m8.InvalidArgumentError=p2;m8.InvalidOptionArgumentError=p2});var B$=V((V$,q$)=>{(function(f,$){typeof V$=="object"&&typeof q$<"u"?q$.exports=$():typeof define=="function"&&define.amd?define($):(f=typeof globalThis<"u"?globalThis:f||self).dayjs=$()})(V$,function(){var f=1000,$=60000,M=3600000,Y="millisecond",J="second",z="minute",Z="hour",X="day",Q="week",G="month",D="quarter",U="year",K="date",W="Invalid Date",B=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,O=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,F={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(A){var H=["th","st","nd","rd"],q=A%100;return"["+A+(H[(q-20)%10]||H[q]||H[0])+"]"}},T=function(A,H,q){var R=String(A);return!R||R.length>=H?A:""+Array(H+1-R.length).join(q)+A},c={s:T,z:function(A){var H=-A.utcOffset(),q=Math.abs(H),R=Math.floor(q/60),S=q%60;return(H<=0?"+":"-")+T(R,2,"0")+":"+T(S,2,"0")},m:function A(H,q){if(H.date()<q.date())return-A(q,H);var R=12*(q.year()-H.year())+(q.month()-H.month()),S=H.clone().add(R,G),L=q-S<0,P=H.clone().add(R+(L?-1:1),G);return+(-(R+(q-S)/(L?S-P:P-S))||0)},a:function(A){return A<0?Math.ceil(A)||0:Math.floor(A)},p:function(A){return{M:G,y:U,w:Q,d:X,D:K,h:Z,m:z,s:J,ms:Y,Q:D}[A]||String(A||"").toLowerCase().replace(/s$/,"")},u:function(A){return A===void 0}},r="en",J1={};J1[r]=F;var L0="$isDayjsObject",$1=function(A){return A instanceof p||!(!A||!A[L0])},f0=function A(H,q,R){var S;if(!H)return r;if(typeof H=="string"){var L=H.toLowerCase();J1[L]&&(S=L),q&&(J1[L]=q,S=L);var P=H.split("-");if(!S&&P.length>1)return A(P[0])}else{var C=H.name;J1[C]=H,S=C}return!R&&S&&(r=S),S||!R&&r},_=function(A,H){if($1(A))return A.clone();var q=typeof H=="object"?H:{};return q.date=A,q.args=arguments,new p(q)},w=c;w.l=f0,w.i=$1,w.w=function(A,H){return _(A,{locale:H.$L,utc:H.$u,x:H.$x,$offset:H.$offset})};var p=function(){function A(q){this.$L=f0(q.locale,null,!0),this.parse(q),this.$x=this.$x||q.x||{},this[L0]=!0}var H=A.prototype;return H.parse=function(q){this.$d=function(R){var{date:S,utc:L}=R;if(S===null)return new Date(NaN);if(w.u(S))return new Date;if(S instanceof Date)return new Date(S);if(typeof S=="string"&&!/Z$/i.test(S)){var P=S.match(B);if(P){var C=P[2]-1||0,v=(P[7]||"0").substring(0,3);return L?new Date(Date.UTC(P[1],C,P[3]||1,P[4]||0,P[5]||0,P[6]||0,v)):new Date(P[1],C,P[3]||1,P[4]||0,P[5]||0,P[6]||0,v)}}return new Date(S)}(q),this.init()},H.init=function(){var q=this.$d;this.$y=q.getFullYear(),this.$M=q.getMonth(),this.$D=q.getDate(),this.$W=q.getDay(),this.$H=q.getHours(),this.$m=q.getMinutes(),this.$s=q.getSeconds(),this.$ms=q.getMilliseconds()},H.$utils=function(){return w},H.isValid=function(){return this.$d.toString()!==W},H.isSame=function(q,R){var S=_(q);return this.startOf(R)<=S&&S<=this.endOf(R)},H.isAfter=function(q,R){return _(q)<this.startOf(R)},H.isBefore=function(q,R){return this.endOf(R)<_(q)},H.$g=function(q,R,S){return w.u(q)?this[R]:this.set(S,q)},H.unix=function(){return Math.floor(this.valueOf()/1000)},H.valueOf=function(){return this.$d.getTime()},H.startOf=function(q,R){var S=this,L=!!w.u(R)||R,P=w.p(q),C=function(u1,i){var w1=w.w(S.$u?Date.UTC(S.$y,i,u1):new Date(S.$y,i,u1),S);return L?w1:w1.endOf(X)},v=function(u1,i){return w.w(S.toDate()[u1].apply(S.toDate("s"),(L?[0,0,0,0]:[23,59,59,999]).slice(i)),S)},g=this.$W,m=this.$M,M1=this.$D,$0="set"+(this.$u?"UTC":"");switch(P){case U:return L?C(1,0):C(31,11);case G:return L?C(1,m):C(0,m+1);case Q:var v1=this.$locale().weekStart||0,P0=(g<v1?g+7:g)-v1;return C(L?M1-P0:M1+(6-P0),m);case X:case K:return v($0+"Hours",0);case Z:return v($0+"Minutes",1);case z:return v($0+"Seconds",2);case J:return v($0+"Milliseconds",3);default:return this.clone()}},H.endOf=function(q){return this.startOf(q,!1)},H.$set=function(q,R){var S,L=w.p(q),P="set"+(this.$u?"UTC":""),C=(S={},S[X]=P+"Date",S[K]=P+"Date",S[G]=P+"Month",S[U]=P+"FullYear",S[Z]=P+"Hours",S[z]=P+"Minutes",S[J]=P+"Seconds",S[Y]=P+"Milliseconds",S)[L],v=L===X?this.$D+(R-this.$W):R;if(L===G||L===U){var g=this.clone().set(K,1);g.$d[C](v),g.init(),this.$d=g.set(K,Math.min(this.$D,g.daysInMonth())).$d}else C&&this.$d[C](v);return this.init(),this},H.set=function(q,R){return this.clone().$set(q,R)},H.get=function(q){return this[w.p(q)]()},H.add=function(q,R){var S,L=this;q=Number(q);var P=w.p(R),C=function(m){var M1=_(L);return w.w(M1.date(M1.date()+Math.round(m*q)),L)};if(P===G)return this.set(G,this.$M+q);if(P===U)return this.set(U,this.$y+q);if(P===X)return C(1);if(P===Q)return C(7);var v=(S={},S[z]=$,S[Z]=M,S[J]=f,S)[P]||1,g=this.$d.getTime()+q*v;return w.w(g,this)},H.subtract=function(q,R){return this.add(-1*q,R)},H.format=function(q){var R=this,S=this.$locale();if(!this.isValid())return S.invalidDate||W;var L=q||"YYYY-MM-DDTHH:mm:ssZ",P=w.z(this),C=this.$H,v=this.$m,g=this.$M,m=S.weekdays,M1=S.months,$0=S.meridiem,v1=function(i,w1,T0,zf){return i&&(i[w1]||i(R,L))||T0[w1].slice(0,zf)},P0=function(i){return w.s(C%12||12,i,"0")},u1=$0||function(i,w1,T0){var zf=i<12?"AM":"PM";return T0?zf.toLowerCase():zf};return L.replace(O,function(i,w1){return w1||function(T0){switch(T0){case"YY":return String(R.$y).slice(-2);case"YYYY":return w.s(R.$y,4,"0");case"M":return g+1;case"MM":return w.s(g+1,2,"0");case"MMM":return v1(S.monthsShort,g,M1,3);case"MMMM":return v1(M1,g);case"D":return R.$D;case"DD":return w.s(R.$D,2,"0");case"d":return String(R.$W);case"dd":return v1(S.weekdaysMin,R.$W,m,2);case"ddd":return v1(S.weekdaysShort,R.$W,m,3);case"dddd":return m[R.$W];case"H":return String(C);case"HH":return w.s(C,2,"0");case"h":return P0(1);case"hh":return P0(2);case"a":return u1(C,v,!0);case"A":return u1(C,v,!1);case"m":return String(v);case"mm":return w.s(v,2,"0");case"s":return String(R.$s);case"ss":return w.s(R.$s,2,"0");case"SSS":return w.s(R.$ms,3,"0");case"Z":return P}return null}(i)||P.replace(":","")})},H.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},H.diff=function(q,R,S){var L,P=this,C=w.p(R),v=_(q),g=(v.utcOffset()-this.utcOffset())*$,m=this-v,M1=function(){return w.m(P,v)};switch(C){case U:L=M1()/12;break;case G:L=M1();break;case D:L=M1()/3;break;case Q:L=(m-g)/604800000;break;case X:L=(m-g)/86400000;break;case Z:L=m/M;break;case z:L=m/$;break;case J:L=m/f;break;default:L=m}return S?L:w.a(L)},H.daysInMonth=function(){return this.endOf(G).$D},H.$locale=function(){return J1[this.$L]},H.locale=function(q,R){if(!q)return this.$L;var S=this.clone(),L=f0(q,R,!0);return L&&(S.$L=L),S},H.clone=function(){return w.w(this.$d,this)},H.toDate=function(){return new Date(this.valueOf())},H.toJSON=function(){return this.isValid()?this.toISOString():null},H.toISOString=function(){return this.$d.toISOString()},H.toString=function(){return this.$d.toUTCString()},A}(),H1=p.prototype;return _.prototype=H1,[["$ms",Y],["$s",J],["$m",z],["$H",Z],["$W",X],["$M",G],["$y",U],["$D",K]].forEach(function(A){H1[A[1]]=function(H){return this.$g(H,A[0],A[1])}}),_.extend=function(A,H){return A.$i||(A(H,p,_),A.$i=!0),_},_.locale=f0,_.isDayjs=$1,_.unix=function(A){return _(1000*A)},_.en=J1[r],_.Ls=J1,_.p={},_})});var e2=V((H$,S$)=>{(function(f,$){typeof H$=="object"&&typeof S$<"u"?S$.exports=$(B$()):typeof define=="function"&&define.amd?define(["dayjs"],$):(f=typeof globalThis<"u"?globalThis:f||self).dayjs_locale_zh_cn=$(f.dayjs)})(H$,function(f){function $(J){return J&&typeof J=="object"&&"default"in J?J:{default:J}}var M=$(f),Y={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(J,z){return z==="W"?J+"周":J+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(J,z){var Z=100*J+z;return Z<600?"凌晨":Z<900?"早上":Z<1100?"上午":Z<1300?"中午":Z<1800?"下午":"晚上"}};return M.default.locale(Y,null,!0),Y})});var E0=V((fV,YM)=>{var MZ=Object.prototype.toString;YM.exports=function($){if($===void 0)return"undefined";if($===null)return"null";var M=typeof $;if(M==="boolean")return"boolean";if(M==="string")return"string";if(M==="number")return"number";if(M==="symbol")return"symbol";if(M==="function")return XZ($)?"generatorfunction":"function";if(YZ($))return"array";if(DZ($))return"buffer";if(GZ($))return"arguments";if(zZ($))return"date";if(JZ($))return"error";if(ZZ($))return"regexp";switch(MM($)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(QZ($))return"generator";switch(M=MZ.call($),M){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return M.slice(8,-1).toLowerCase().replace(/\s/g,"")};function MM(f){return typeof f.constructor==="function"?f.constructor.name:null}function YZ(f){if(Array.isArray)return Array.isArray(f);return f instanceof Array}function JZ(f){return f instanceof Error||typeof f.message==="string"&&f.constructor&&typeof f.constructor.stackTraceLimit==="number"}function zZ(f){if(f instanceof Date)return!0;return typeof f.toDateString==="function"&&typeof f.getDate==="function"&&typeof f.setDate==="function"}function ZZ(f){if(f instanceof RegExp)return!0;return typeof f.flags==="string"&&typeof f.ignoreCase==="boolean"&&typeof f.multiline==="boolean"&&typeof f.global==="boolean"}function XZ(f,$){return MM(f)==="GeneratorFunction"}function QZ(f){return typeof f.throw==="function"&&typeof f.return==="function"&&typeof f.next==="function"}function GZ(f){try{if(typeof f.length==="number"&&typeof f.callee==="function")return!0}catch($){if($.message.indexOf("callee")!==-1)return!0}return!1}function DZ(f){if(f.constructor&&typeof f.constructor.isBuffer==="function")return f.constructor.isBuffer(f);return!1}});var zM=V(($V,JM)=>{/*!
|
|
24
24
|
* is-extendable <https://github.com/jonschlinkert/is-extendable>
|
|
25
25
|
*
|
|
26
26
|
* Copyright (c) 2015, Jon Schlinkert.
|
|
27
27
|
* Licensed under the MIT License.
|
|
28
|
-
*/JM.exports=function($){return typeof $<"u"&&$!==null&&(typeof $==="object"||typeof $==="function")}});var QM=V((
|
|
28
|
+
*/JM.exports=function($){return typeof $<"u"&&$!==null&&(typeof $==="object"||typeof $==="function")}});var QM=V((MV,XM)=>{var ZM=zM();XM.exports=function($){if(!ZM($))$={};var M=arguments.length;for(var Y=1;Y<M;Y++){var J=arguments[Y];if(ZM(J))UZ($,J)}return $};function UZ(f,$){for(var M in $)if(WZ($,M))f[M]=$[M]}function WZ(f,$){return Object.prototype.hasOwnProperty.call(f,$)}});var UM=V((YV,DM)=>{var KZ=E0(),VZ=QM();DM.exports=function(f,$){if(typeof $==="function")$={parse:$};var M=BZ(f),Y={section_delimiter:"---",parse:SZ},J=VZ({},Y,$),z=J.section_delimiter,Z=M.content.split(/\r?\n/),X=null,Q=GM(),G=[],D=[];function U(T){M.content=T,X=[],G=[]}function K(T){if(D.length)Q.key=HZ(D[0],z),Q.content=T,J.parse(Q,X),X.push(Q),Q=GM(),G=[],D=[]}for(var W=0;W<Z.length;W++){var B=Z[W],O=D.length,F=B.trim();if(qZ(F,z)){if(F.length===3&&W!==0){if(O===0||O===2){G.push(B);continue}D.push(F),Q.data=G.join(`
|
|
29
29
|
`),G=[];continue}if(X===null)U(G.join(`
|
|
30
|
-
`));if(
|
|
30
|
+
`));if(O===2)K(G.join(`
|
|
31
31
|
`));D.push(F);continue}G.push(B)}if(X===null)U(G.join(`
|
|
32
32
|
`));else K(G.join(`
|
|
33
|
-
`));return M.sections=X,M};function qZ(f,$){if(f.slice(0,$.length)!==$)return!1;if(f.charAt($.length+1)===$.slice(-1))return!1;return!0}function BZ(f){if(KZ(f)!=="object")f={content:f};if(typeof f.content!=="string"&&!FZ(f.content))throw TypeError("expected a buffer or string");return f.content=f.content.toString(),f.sections=[],f}function HZ(f,$){return f?f.slice($.length).trim():""}function GM(){return{key:"",data:"",content:""}}function SZ(f){return f}function FZ(f){if(f&&f.constructor&&typeof f.constructor.isBuffer==="function")return f.constructor.isBuffer(f);return!1}});var g1=V((PZ,h1)=>{function WM(f){return typeof f>"u"||f===null}function RZ(f){return typeof f==="object"&&f!==null}function NZ(f){if(Array.isArray(f))return f;else if(WM(f))return[];return[f]}function
|
|
33
|
+
`));return M.sections=X,M};function qZ(f,$){if(f.slice(0,$.length)!==$)return!1;if(f.charAt($.length+1)===$.slice(-1))return!1;return!0}function BZ(f){if(KZ(f)!=="object")f={content:f};if(typeof f.content!=="string"&&!FZ(f.content))throw TypeError("expected a buffer or string");return f.content=f.content.toString(),f.sections=[],f}function HZ(f,$){return f?f.slice($.length).trim():""}function GM(){return{key:"",data:"",content:""}}function SZ(f){return f}function FZ(f){if(f&&f.constructor&&typeof f.constructor.isBuffer==="function")return f.constructor.isBuffer(f);return!1}});var g1=V((PZ,h1)=>{function WM(f){return typeof f>"u"||f===null}function RZ(f){return typeof f==="object"&&f!==null}function NZ(f){if(Array.isArray(f))return f;else if(WM(f))return[];return[f]}function OZ(f,$){var M,Y,J,z;if($){z=Object.keys($);for(M=0,Y=z.length;M<Y;M+=1)J=z[M],f[J]=$[J]}return f}function AZ(f,$){var M="",Y;for(Y=0;Y<$;Y+=1)M+=f;return M}function LZ(f){return f===0&&Number.NEGATIVE_INFINITY===1/f}PZ.isNothing=WM;PZ.isObject=RZ;PZ.toArray=NZ;PZ.repeat=AZ;PZ.isNegativeZero=LZ;PZ.extend=OZ});var M0=V((JV,KM)=>{function x0(f,$){if(Error.call(this),this.name="YAMLException",this.reason=f,this.mark=$,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():""),Error.captureStackTrace)Error.captureStackTrace(this,this.constructor);else this.stack=Error().stack||""}x0.prototype=Object.create(Error.prototype);x0.prototype.constructor=x0;x0.prototype.toString=function($){var M=this.name+": ";if(M+=this.reason||"(unknown reason)",!$&&this.mark)M+=" "+this.mark.toString();return M};KM.exports=x0});var BM=V((zV,qM)=>{var VM=g1();function F$(f,$,M,Y,J){this.name=f,this.buffer=$,this.position=M,this.line=Y,this.column=J}F$.prototype.getSnippet=function($,M){var Y,J,z,Z,X;if(!this.buffer)return null;$=$||4,M=M||75,Y="",J=this.position;while(J>0&&`\x00\r
|
|
34
34
|
\u2028\u2029`.indexOf(this.buffer.charAt(J-1))===-1)if(J-=1,this.position-J>M/2-1){Y=" ... ",J+=5;break}z="",Z=this.position;while(Z<this.buffer.length&&`\x00\r
|
|
35
35
|
\u2028\u2029`.indexOf(this.buffer.charAt(Z))===-1)if(Z+=1,Z-this.position>M/2-1){z=" ... ",Z-=5;break}return X=this.buffer.slice(J,Z),VM.repeat(" ",$)+Y+X+z+`
|
|
36
|
-
`+VM.repeat(" ",$+this.position-J+Y.length)+"^"};
|
|
37
|
-
`+M}return Y};qM.exports=
|
|
38
|
-
\r`;function R7(f){if(f===null)return!1;var $,M,Y=0,J=f.length,z=
|
|
39
|
-
`:f===118?"\v":f===102?"\f":f===114?"\r":f===101?"\x1B":f===32?" ":f===34?'"':f===47?"/":f===92?"\\":f===78?"
":f===95?" ":f===76?"\u2028":f===80?"\u2029":""}function QX(f){if(f<=65535)return String.fromCharCode(f);return String.fromCharCode((f-65536>>10)+55296,(f-65536&1023)+56320)}function RY(f,$,M){if($==="__proto__")Object.defineProperty(f,$,{configurable:!0,enumerable:!0,writable:!0,value:M});else f[$]=M}var NY=Array(256),
|
|
40
|
-
`,$-1)}function DX(f,$,M){var Y,J,z,Z,X,Q,G,D,U=f.kind,K=f.result,W;if(W=f.input.charCodeAt(f.position),s(W)||z0(W)||W===35||W===38||W===42||W===33||W===124||W===62||W===39||W===34||W===37||W===64||W===96)return!1;if(W===63||W===45){if(J=f.input.charCodeAt(f.position+1),s(J)||M&&z0(J))return!1}f.kind="scalar",f.result="",z=Z=f.position,X=!1;while(W!==0){if(W===58){if(J=f.input.charCodeAt(f.position+1),s(J)||M&&z0(J))break}else if(W===35){if(Y=f.input.charCodeAt(f.position-1),s(Y))break}else if(f.position===f.lineStart&&Sf(f)||M&&z0(W))break;else if(Q1(W))if(Q=f.line,G=f.lineStart,D=f.lineIndent,u(f,!1,-1),f.lineIndent>=$){X=!0,W=f.input.charCodeAt(f.position);continue}else{f.position=Z,f.line=Q,f.lineStart=G,f.lineIndent=D;break}if(X)I1(f,z,Z,!1),
|
|
41
|
-
`,z?1+Q:Q);else if(J===
|
|
36
|
+
`+VM.repeat(" ",$+this.position-J+Y.length)+"^"};F$.prototype.toString=function($){var M,Y="";if(this.name)Y+='in "'+this.name+'" ';if(Y+="at line "+(this.line+1)+", column "+(this.column+1),!$){if(M=this.getSnippet(),M)Y+=`:
|
|
37
|
+
`+M}return Y};qM.exports=F$});var h=V((ZV,SM)=>{var HM=M0(),xZ=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],yZ=["scalar","sequence","mapping"];function kZ(f){var $={};if(f!==null)Object.keys(f).forEach(function(M){f[M].forEach(function(Y){$[String(Y)]=M})});return $}function bZ(f,$){if($=$||{},Object.keys($).forEach(function(M){if(xZ.indexOf(M)===-1)throw new HM('Unknown option "'+M+'" is met in definition of "'+f+'" YAML type.')}),this.tag=f,this.kind=$.kind||null,this.resolve=$.resolve||function(){return!0},this.construct=$.construct||function(M){return M},this.instanceOf=$.instanceOf||null,this.predicate=$.predicate||null,this.represent=$.represent||null,this.defaultStyle=$.defaultStyle||null,this.styleAliases=kZ($.styleAliases||null),yZ.indexOf(this.kind)===-1)throw new HM('Unknown kind "'+this.kind+'" is specified for "'+f+'" YAML type.')}SM.exports=bZ});var c1=V((XV,RM)=>{var FM=g1(),Wf=M0(),_Z=h();function R$(f,$,M){var Y=[];return f.include.forEach(function(J){M=R$(J,$,M)}),f[$].forEach(function(J){M.forEach(function(z,Z){if(z.tag===J.tag&&z.kind===J.kind)Y.push(Z)}),M.push(J)}),M.filter(function(J,z){return Y.indexOf(z)===-1})}function vZ(){var f={scalar:{},sequence:{},mapping:{},fallback:{}},$,M;function Y(J){f[J.kind][J.tag]=f.fallback[J.tag]=J}for($=0,M=arguments.length;$<M;$+=1)arguments[$].forEach(Y);return f}function Y0(f){this.include=f.include||[],this.implicit=f.implicit||[],this.explicit=f.explicit||[],this.implicit.forEach(function($){if($.loadKind&&$.loadKind!=="scalar")throw new Wf("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=R$(this,"implicit",[]),this.compiledExplicit=R$(this,"explicit",[]),this.compiledTypeMap=vZ(this.compiledImplicit,this.compiledExplicit)}Y0.DEFAULT=null;Y0.create=function(){var $,M;switch(arguments.length){case 1:$=Y0.DEFAULT,M=arguments[0];break;case 2:$=arguments[0],M=arguments[1];break;default:throw new Wf("Wrong number of arguments for Schema.create function")}if($=FM.toArray($),M=FM.toArray(M),!$.every(function(Y){return Y instanceof Y0}))throw new Wf("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");if(!M.every(function(Y){return Y instanceof _Z}))throw new Wf("Specified list of YAML types (or a single Type object) contains a non-Type object.");return new Y0({include:$,explicit:M})};RM.exports=Y0});var OM=V((QV,NM)=>{var uZ=h();NM.exports=new uZ("tag:yaml.org,2002:str",{kind:"scalar",construct:function(f){return f!==null?f:""}})});var LM=V((GV,AM)=>{var hZ=h();AM.exports=new hZ("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(f){return f!==null?f:[]}})});var TM=V((DV,PM)=>{var gZ=h();PM.exports=new gZ("tag:yaml.org,2002:map",{kind:"mapping",construct:function(f){return f!==null?f:{}}})});var Kf=V((UV,wM)=>{var cZ=c1();wM.exports=new cZ({explicit:[OM(),LM(),TM()]})});var IM=V((WV,jM)=>{var mZ=h();function dZ(f){if(f===null)return!0;var $=f.length;return $===1&&f==="~"||$===4&&(f==="null"||f==="Null"||f==="NULL")}function lZ(){return null}function nZ(f){return f===null}jM.exports=new mZ("tag:yaml.org,2002:null",{kind:"scalar",resolve:dZ,construct:lZ,predicate:nZ,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})});var EM=V((KV,CM)=>{var rZ=h();function pZ(f){if(f===null)return!1;var $=f.length;return $===4&&(f==="true"||f==="True"||f==="TRUE")||$===5&&(f==="false"||f==="False"||f==="FALSE")}function iZ(f){return f==="true"||f==="True"||f==="TRUE"}function oZ(f){return Object.prototype.toString.call(f)==="[object Boolean]"}CM.exports=new rZ("tag:yaml.org,2002:bool",{kind:"scalar",resolve:pZ,construct:iZ,predicate:oZ,represent:{lowercase:function(f){return f?"true":"false"},uppercase:function(f){return f?"TRUE":"FALSE"},camelcase:function(f){return f?"True":"False"}},defaultStyle:"lowercase"})});var yM=V((VV,xM)=>{var sZ=g1(),aZ=h();function tZ(f){return 48<=f&&f<=57||65<=f&&f<=70||97<=f&&f<=102}function eZ(f){return 48<=f&&f<=55}function f7(f){return 48<=f&&f<=57}function $7(f){if(f===null)return!1;var $=f.length,M=0,Y=!1,J;if(!$)return!1;if(J=f[M],J==="-"||J==="+")J=f[++M];if(J==="0"){if(M+1===$)return!0;if(J=f[++M],J==="b"){M++;for(;M<$;M++){if(J=f[M],J==="_")continue;if(J!=="0"&&J!=="1")return!1;Y=!0}return Y&&J!=="_"}if(J==="x"){M++;for(;M<$;M++){if(J=f[M],J==="_")continue;if(!tZ(f.charCodeAt(M)))return!1;Y=!0}return Y&&J!=="_"}for(;M<$;M++){if(J=f[M],J==="_")continue;if(!eZ(f.charCodeAt(M)))return!1;Y=!0}return Y&&J!=="_"}if(J==="_")return!1;for(;M<$;M++){if(J=f[M],J==="_")continue;if(J===":")break;if(!f7(f.charCodeAt(M)))return!1;Y=!0}if(!Y||J==="_")return!1;if(J!==":")return!0;return/^(:[0-5]?[0-9])+$/.test(f.slice(M))}function M7(f){var $=f,M=1,Y,J,z=[];if($.indexOf("_")!==-1)$=$.replace(/_/g,"");if(Y=$[0],Y==="-"||Y==="+"){if(Y==="-")M=-1;$=$.slice(1),Y=$[0]}if($==="0")return 0;if(Y==="0"){if($[1]==="b")return M*parseInt($.slice(2),2);if($[1]==="x")return M*parseInt($,16);return M*parseInt($,8)}if($.indexOf(":")!==-1)return $.split(":").forEach(function(Z){z.unshift(parseInt(Z,10))}),$=0,J=1,z.forEach(function(Z){$+=Z*J,J*=60}),M*$;return M*parseInt($,10)}function Y7(f){return Object.prototype.toString.call(f)==="[object Number]"&&(f%1===0&&!sZ.isNegativeZero(f))}xM.exports=new aZ("tag:yaml.org,2002:int",{kind:"scalar",resolve:$7,construct:M7,predicate:Y7,represent:{binary:function(f){return f>=0?"0b"+f.toString(2):"-0b"+f.toString(2).slice(1)},octal:function(f){return f>=0?"0"+f.toString(8):"-0"+f.toString(8).slice(1)},decimal:function(f){return f.toString(10)},hexadecimal:function(f){return f>=0?"0x"+f.toString(16).toUpperCase():"-0x"+f.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})});var _M=V((qV,bM)=>{var kM=g1(),J7=h(),z7=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function Z7(f){if(f===null)return!1;if(!z7.test(f)||f[f.length-1]==="_")return!1;return!0}function X7(f){var $,M,Y,J;if($=f.replace(/_/g,"").toLowerCase(),M=$[0]==="-"?-1:1,J=[],"+-".indexOf($[0])>=0)$=$.slice(1);if($===".inf")return M===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;else if($===".nan")return NaN;else if($.indexOf(":")>=0)return $.split(":").forEach(function(z){J.unshift(parseFloat(z,10))}),$=0,Y=1,J.forEach(function(z){$+=z*Y,Y*=60}),M*$;return M*parseFloat($,10)}var Q7=/^[-+]?[0-9]+e/;function G7(f,$){var M;if(isNaN(f))switch($){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===f)switch($){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===f)switch($){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(kM.isNegativeZero(f))return"-0.0";return M=f.toString(10),Q7.test(M)?M.replace("e",".e"):M}function D7(f){return Object.prototype.toString.call(f)==="[object Number]"&&(f%1!==0||kM.isNegativeZero(f))}bM.exports=new J7("tag:yaml.org,2002:float",{kind:"scalar",resolve:Z7,construct:X7,predicate:D7,represent:G7,defaultStyle:"lowercase"})});var N$=V((BV,vM)=>{var U7=c1();vM.exports=new U7({include:[Kf()],implicit:[IM(),EM(),yM(),_M()]})});var O$=V((HV,uM)=>{var W7=c1();uM.exports=new W7({include:[N$()]})});var mM=V((SV,cM)=>{var K7=h(),hM=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),gM=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function V7(f){if(f===null)return!1;if(hM.exec(f)!==null)return!0;if(gM.exec(f)!==null)return!0;return!1}function q7(f){var $,M,Y,J,z,Z,X,Q=0,G=null,D,U,K;if($=hM.exec(f),$===null)$=gM.exec(f);if($===null)throw Error("Date resolve error");if(M=+$[1],Y=+$[2]-1,J=+$[3],!$[4])return new Date(Date.UTC(M,Y,J));if(z=+$[4],Z=+$[5],X=+$[6],$[7]){Q=$[7].slice(0,3);while(Q.length<3)Q+="0";Q=+Q}if($[9]){if(D=+$[10],U=+($[11]||0),G=(D*60+U)*60000,$[9]==="-")G=-G}if(K=new Date(Date.UTC(M,Y,J,z,Z,X,Q)),G)K.setTime(K.getTime()-G);return K}function B7(f){return f.toISOString()}cM.exports=new K7("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:V7,construct:q7,instanceOf:Date,represent:B7})});var lM=V((FV,dM)=>{var H7=h();function S7(f){return f==="<<"||f===null}dM.exports=new H7("tag:yaml.org,2002:merge",{kind:"scalar",resolve:S7})});var rM=V((RV,nM)=>{var m1;try{A$=o,m1=A$("buffer").Buffer}catch(f){}var A$,F7=h(),L$=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
38
|
+
\r`;function R7(f){if(f===null)return!1;var $,M,Y=0,J=f.length,z=L$;for(M=0;M<J;M++){if($=z.indexOf(f.charAt(M)),$>64)continue;if($<0)return!1;Y+=6}return Y%8===0}function N7(f){var $,M,Y=f.replace(/[\r\n=]/g,""),J=Y.length,z=L$,Z=0,X=[];for($=0;$<J;$++){if($%4===0&&$)X.push(Z>>16&255),X.push(Z>>8&255),X.push(Z&255);Z=Z<<6|z.indexOf(Y.charAt($))}if(M=J%4*6,M===0)X.push(Z>>16&255),X.push(Z>>8&255),X.push(Z&255);else if(M===18)X.push(Z>>10&255),X.push(Z>>2&255);else if(M===12)X.push(Z>>4&255);if(m1)return m1.from?m1.from(X):new m1(X);return X}function O7(f){var $="",M=0,Y,J,z=f.length,Z=L$;for(Y=0;Y<z;Y++){if(Y%3===0&&Y)$+=Z[M>>18&63],$+=Z[M>>12&63],$+=Z[M>>6&63],$+=Z[M&63];M=(M<<8)+f[Y]}if(J=z%3,J===0)$+=Z[M>>18&63],$+=Z[M>>12&63],$+=Z[M>>6&63],$+=Z[M&63];else if(J===2)$+=Z[M>>10&63],$+=Z[M>>4&63],$+=Z[M<<2&63],$+=Z[64];else if(J===1)$+=Z[M>>2&63],$+=Z[M<<4&63],$+=Z[64],$+=Z[64];return $}function A7(f){return m1&&m1.isBuffer(f)}nM.exports=new F7("tag:yaml.org,2002:binary",{kind:"scalar",resolve:R7,construct:N7,predicate:A7,represent:O7})});var iM=V((OV,pM)=>{var L7=h(),P7=Object.prototype.hasOwnProperty,T7=Object.prototype.toString;function w7(f){if(f===null)return!0;var $=[],M,Y,J,z,Z,X=f;for(M=0,Y=X.length;M<Y;M+=1){if(J=X[M],Z=!1,T7.call(J)!=="[object Object]")return!1;for(z in J)if(P7.call(J,z))if(!Z)Z=!0;else return!1;if(!Z)return!1;if($.indexOf(z)===-1)$.push(z);else return!1}return!0}function j7(f){return f!==null?f:[]}pM.exports=new L7("tag:yaml.org,2002:omap",{kind:"sequence",resolve:w7,construct:j7})});var sM=V((AV,oM)=>{var I7=h(),C7=Object.prototype.toString;function E7(f){if(f===null)return!0;var $,M,Y,J,z,Z=f;z=Array(Z.length);for($=0,M=Z.length;$<M;$+=1){if(Y=Z[$],C7.call(Y)!=="[object Object]")return!1;if(J=Object.keys(Y),J.length!==1)return!1;z[$]=[J[0],Y[J[0]]]}return!0}function x7(f){if(f===null)return[];var $,M,Y,J,z,Z=f;z=Array(Z.length);for($=0,M=Z.length;$<M;$+=1)Y=Z[$],J=Object.keys(Y),z[$]=[J[0],Y[J[0]]];return z}oM.exports=new I7("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:E7,construct:x7})});var tM=V((LV,aM)=>{var y7=h(),k7=Object.prototype.hasOwnProperty;function b7(f){if(f===null)return!0;var $,M=f;for($ in M)if(k7.call(M,$)){if(M[$]!==null)return!1}return!0}function _7(f){return f!==null?f:{}}aM.exports=new y7("tag:yaml.org,2002:set",{kind:"mapping",resolve:b7,construct:_7})});var J0=V((PV,eM)=>{var v7=c1();eM.exports=new v7({include:[O$()],implicit:[mM(),lM()],explicit:[rM(),iM(),sM(),tM()]})});var $Y=V((TV,fY)=>{var u7=h();function h7(){return!0}function g7(){return}function c7(){return""}function m7(f){return typeof f>"u"}fY.exports=new u7("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:h7,construct:g7,predicate:m7,represent:c7})});var YY=V((wV,MY)=>{var d7=h();function l7(f){if(f===null)return!1;if(f.length===0)return!1;var $=f,M=/\/([gim]*)$/.exec(f),Y="";if($[0]==="/"){if(M)Y=M[1];if(Y.length>3)return!1;if($[$.length-Y.length-1]!=="/")return!1}return!0}function n7(f){var $=f,M=/\/([gim]*)$/.exec(f),Y="";if($[0]==="/"){if(M)Y=M[1];$=$.slice(1,$.length-Y.length-1)}return new RegExp($,Y)}function r7(f){var $="/"+f.source+"/";if(f.global)$+="g";if(f.multiline)$+="m";if(f.ignoreCase)$+="i";return $}function p7(f){return Object.prototype.toString.call(f)==="[object RegExp]"}MY.exports=new d7("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:l7,construct:n7,predicate:p7,represent:r7})});var zY=V((jV,JY)=>{var Vf;try{P$=o,Vf=P$("esprima")}catch(f){if(typeof window<"u")Vf=window.esprima}var P$,i7=h();function o7(f){if(f===null)return!1;try{var $="("+f+")",M=Vf.parse($,{range:!0});if(M.type!=="Program"||M.body.length!==1||M.body[0].type!=="ExpressionStatement"||M.body[0].expression.type!=="ArrowFunctionExpression"&&M.body[0].expression.type!=="FunctionExpression")return!1;return!0}catch(Y){return!1}}function s7(f){var $="("+f+")",M=Vf.parse($,{range:!0}),Y=[],J;if(M.type!=="Program"||M.body.length!==1||M.body[0].type!=="ExpressionStatement"||M.body[0].expression.type!=="ArrowFunctionExpression"&&M.body[0].expression.type!=="FunctionExpression")throw Error("Failed to resolve function");if(M.body[0].expression.params.forEach(function(z){Y.push(z.name)}),J=M.body[0].expression.body.range,M.body[0].expression.body.type==="BlockStatement")return Function(Y,$.slice(J[0]+1,J[1]-1));return Function(Y,"return "+$.slice(J[0],J[1]))}function a7(f){return f.toString()}function t7(f){return Object.prototype.toString.call(f)==="[object Function]"}JY.exports=new i7("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:o7,construct:s7,predicate:t7,represent:a7})});var y0=V((CV,XY)=>{var ZY=c1();XY.exports=ZY.DEFAULT=new ZY({include:[J0()],explicit:[$Y(),YY(),zY()]})});var wY=V((OX,k0)=>{var F1=g1(),VY=M0(),e7=BM(),qY=J0(),fX=y0(),C1=Object.prototype.hasOwnProperty,qf=1,BY=2,HY=3,Bf=4,T$=1,$X=2,QY=3,MX=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,YX=/[\x85\u2028\u2029]/,JX=/[,\[\]\{\}]/,SY=/^(?:!|!!|![a-z\-]+!)$/i,FY=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function GY(f){return Object.prototype.toString.call(f)}function Q1(f){return f===10||f===13}function d1(f){return f===9||f===32}function s(f){return f===9||f===32||f===10||f===13}function z0(f){return f===44||f===91||f===93||f===123||f===125}function zX(f){var $;if(48<=f&&f<=57)return f-48;if($=f|32,97<=$&&$<=102)return $-97+10;return-1}function ZX(f){if(f===120)return 2;if(f===117)return 4;if(f===85)return 8;return 0}function XX(f){if(48<=f&&f<=57)return f-48;return-1}function DY(f){return f===48?"\x00":f===97?"\x07":f===98?"\b":f===116?"\t":f===9?"\t":f===110?`
|
|
39
|
+
`:f===118?"\v":f===102?"\f":f===114?"\r":f===101?"\x1B":f===32?" ":f===34?'"':f===47?"/":f===92?"\\":f===78?"
":f===95?" ":f===76?"\u2028":f===80?"\u2029":""}function QX(f){if(f<=65535)return String.fromCharCode(f);return String.fromCharCode((f-65536>>10)+55296,(f-65536&1023)+56320)}function RY(f,$,M){if($==="__proto__")Object.defineProperty(f,$,{configurable:!0,enumerable:!0,writable:!0,value:M});else f[$]=M}var NY=Array(256),OY=Array(256);for(j1=0;j1<256;j1++)NY[j1]=DY(j1)?1:0,OY[j1]=DY(j1);var j1;function GX(f,$){this.input=f,this.filename=$.filename||null,this.schema=$.schema||fX,this.onWarning=$.onWarning||null,this.legacy=$.legacy||!1,this.json=$.json||!1,this.listener=$.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=f.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function AY(f,$){return new VY($,new e7(f.filename,f.input,f.position,f.line,f.position-f.lineStart))}function N(f,$){throw AY(f,$)}function Hf(f,$){if(f.onWarning)f.onWarning.call(null,AY(f,$))}var UY={YAML:function($,M,Y){var J,z,Z;if($.version!==null)N($,"duplication of %YAML directive");if(Y.length!==1)N($,"YAML directive accepts exactly one argument");if(J=/^([0-9]+)\.([0-9]+)$/.exec(Y[0]),J===null)N($,"ill-formed argument of the YAML directive");if(z=parseInt(J[1],10),Z=parseInt(J[2],10),z!==1)N($,"unacceptable YAML version of the document");if($.version=Y[0],$.checkLineBreaks=Z<2,Z!==1&&Z!==2)Hf($,"unsupported YAML version of the document")},TAG:function($,M,Y){var J,z;if(Y.length!==2)N($,"TAG directive accepts exactly two arguments");if(J=Y[0],z=Y[1],!SY.test(J))N($,"ill-formed tag handle (first argument) of the TAG directive");if(C1.call($.tagMap,J))N($,'there is a previously declared suffix for "'+J+'" tag handle');if(!FY.test(z))N($,"ill-formed tag prefix (second argument) of the TAG directive");$.tagMap[J]=z}};function I1(f,$,M,Y){var J,z,Z,X;if($<M){if(X=f.input.slice($,M),Y){for(J=0,z=X.length;J<z;J+=1)if(Z=X.charCodeAt(J),!(Z===9||32<=Z&&Z<=1114111))N(f,"expected valid JSON character")}else if(MX.test(X))N(f,"the stream contains non-printable characters");f.result+=X}}function WY(f,$,M,Y){var J,z,Z,X;if(!F1.isObject(M))N(f,"cannot merge mappings; the provided source object is unacceptable");J=Object.keys(M);for(Z=0,X=J.length;Z<X;Z+=1)if(z=J[Z],!C1.call($,z))RY($,z,M[z]),Y[z]=!0}function Z0(f,$,M,Y,J,z,Z,X){var Q,G;if(Array.isArray(J)){J=Array.prototype.slice.call(J);for(Q=0,G=J.length;Q<G;Q+=1){if(Array.isArray(J[Q]))N(f,"nested arrays are not supported inside keys");if(typeof J==="object"&&GY(J[Q])==="[object Object]")J[Q]="[object Object]"}}if(typeof J==="object"&&GY(J)==="[object Object]")J="[object Object]";if(J=String(J),$===null)$={};if(Y==="tag:yaml.org,2002:merge")if(Array.isArray(z))for(Q=0,G=z.length;Q<G;Q+=1)WY(f,$,z[Q],M);else WY(f,$,z,M);else{if(!f.json&&!C1.call(M,J)&&C1.call($,J))f.line=Z||f.line,f.position=X||f.position,N(f,"duplicated mapping key");RY($,J,z),delete M[J]}return $}function w$(f){var $=f.input.charCodeAt(f.position);if($===10)f.position++;else if($===13){if(f.position++,f.input.charCodeAt(f.position)===10)f.position++}else N(f,"a line break is expected");f.line+=1,f.lineStart=f.position}function u(f,$,M){var Y=0,J=f.input.charCodeAt(f.position);while(J!==0){while(d1(J))J=f.input.charCodeAt(++f.position);if($&&J===35)do J=f.input.charCodeAt(++f.position);while(J!==10&&J!==13&&J!==0);if(Q1(J)){w$(f),J=f.input.charCodeAt(f.position),Y++,f.lineIndent=0;while(J===32)f.lineIndent++,J=f.input.charCodeAt(++f.position)}else break}if(M!==-1&&Y!==0&&f.lineIndent<M)Hf(f,"deficient indentation");return Y}function Sf(f){var $=f.position,M;if(M=f.input.charCodeAt($),(M===45||M===46)&&M===f.input.charCodeAt($+1)&&M===f.input.charCodeAt($+2)){if($+=3,M=f.input.charCodeAt($),M===0||s(M))return!0}return!1}function j$(f,$){if($===1)f.result+=" ";else if($>1)f.result+=F1.repeat(`
|
|
40
|
+
`,$-1)}function DX(f,$,M){var Y,J,z,Z,X,Q,G,D,U=f.kind,K=f.result,W;if(W=f.input.charCodeAt(f.position),s(W)||z0(W)||W===35||W===38||W===42||W===33||W===124||W===62||W===39||W===34||W===37||W===64||W===96)return!1;if(W===63||W===45){if(J=f.input.charCodeAt(f.position+1),s(J)||M&&z0(J))return!1}f.kind="scalar",f.result="",z=Z=f.position,X=!1;while(W!==0){if(W===58){if(J=f.input.charCodeAt(f.position+1),s(J)||M&&z0(J))break}else if(W===35){if(Y=f.input.charCodeAt(f.position-1),s(Y))break}else if(f.position===f.lineStart&&Sf(f)||M&&z0(W))break;else if(Q1(W))if(Q=f.line,G=f.lineStart,D=f.lineIndent,u(f,!1,-1),f.lineIndent>=$){X=!0,W=f.input.charCodeAt(f.position);continue}else{f.position=Z,f.line=Q,f.lineStart=G,f.lineIndent=D;break}if(X)I1(f,z,Z,!1),j$(f,f.line-Q),z=Z=f.position,X=!1;if(!d1(W))Z=f.position+1;W=f.input.charCodeAt(++f.position)}if(I1(f,z,Z,!1),f.result)return!0;return f.kind=U,f.result=K,!1}function UX(f,$){var M,Y,J;if(M=f.input.charCodeAt(f.position),M!==39)return!1;f.kind="scalar",f.result="",f.position++,Y=J=f.position;while((M=f.input.charCodeAt(f.position))!==0)if(M===39)if(I1(f,Y,f.position,!0),M=f.input.charCodeAt(++f.position),M===39)Y=f.position,f.position++,J=f.position;else return!0;else if(Q1(M))I1(f,Y,J,!0),j$(f,u(f,!1,$)),Y=J=f.position;else if(f.position===f.lineStart&&Sf(f))N(f,"unexpected end of the document within a single quoted scalar");else f.position++,J=f.position;N(f,"unexpected end of the stream within a single quoted scalar")}function WX(f,$){var M,Y,J,z,Z,X;if(X=f.input.charCodeAt(f.position),X!==34)return!1;f.kind="scalar",f.result="",f.position++,M=Y=f.position;while((X=f.input.charCodeAt(f.position))!==0)if(X===34)return I1(f,M,f.position,!0),f.position++,!0;else if(X===92){if(I1(f,M,f.position,!0),X=f.input.charCodeAt(++f.position),Q1(X))u(f,!1,$);else if(X<256&&NY[X])f.result+=OY[X],f.position++;else if((Z=ZX(X))>0){J=Z,z=0;for(;J>0;J--)if(X=f.input.charCodeAt(++f.position),(Z=zX(X))>=0)z=(z<<4)+Z;else N(f,"expected hexadecimal character");f.result+=QX(z),f.position++}else N(f,"unknown escape sequence");M=Y=f.position}else if(Q1(X))I1(f,M,Y,!0),j$(f,u(f,!1,$)),M=Y=f.position;else if(f.position===f.lineStart&&Sf(f))N(f,"unexpected end of the document within a double quoted scalar");else f.position++,Y=f.position;N(f,"unexpected end of the stream within a double quoted scalar")}function KX(f,$){var M=!0,Y,J=f.tag,z,Z=f.anchor,X,Q,G,D,U,K={},W,B,O,F;if(F=f.input.charCodeAt(f.position),F===91)Q=93,U=!1,z=[];else if(F===123)Q=125,U=!0,z={};else return!1;if(f.anchor!==null)f.anchorMap[f.anchor]=z;F=f.input.charCodeAt(++f.position);while(F!==0){if(u(f,!0,$),F=f.input.charCodeAt(f.position),F===Q)return f.position++,f.tag=J,f.anchor=Z,f.kind=U?"mapping":"sequence",f.result=z,!0;else if(!M)N(f,"missed comma between flow collection entries");if(B=W=O=null,G=D=!1,F===63){if(X=f.input.charCodeAt(f.position+1),s(X))G=D=!0,f.position++,u(f,!0,$)}if(Y=f.line,X0(f,$,qf,!1,!0),B=f.tag,W=f.result,u(f,!0,$),F=f.input.charCodeAt(f.position),(D||f.line===Y)&&F===58)G=!0,F=f.input.charCodeAt(++f.position),u(f,!0,$),X0(f,$,qf,!1,!0),O=f.result;if(U)Z0(f,z,K,B,W,O);else if(G)z.push(Z0(f,null,K,B,W,O));else z.push(W);if(u(f,!0,$),F=f.input.charCodeAt(f.position),F===44)M=!0,F=f.input.charCodeAt(++f.position);else M=!1}N(f,"unexpected end of the stream within a flow collection")}function VX(f,$){var M,Y,J=T$,z=!1,Z=!1,X=$,Q=0,G=!1,D,U;if(U=f.input.charCodeAt(f.position),U===124)Y=!1;else if(U===62)Y=!0;else return!1;f.kind="scalar",f.result="";while(U!==0)if(U=f.input.charCodeAt(++f.position),U===43||U===45)if(T$===J)J=U===43?QY:$X;else N(f,"repeat of a chomping mode identifier");else if((D=XX(U))>=0)if(D===0)N(f,"bad explicit indentation width of a block scalar; it cannot be less than one");else if(!Z)X=$+D-1,Z=!0;else N(f,"repeat of an indentation width identifier");else break;if(d1(U)){do U=f.input.charCodeAt(++f.position);while(d1(U));if(U===35)do U=f.input.charCodeAt(++f.position);while(!Q1(U)&&U!==0)}while(U!==0){w$(f),f.lineIndent=0,U=f.input.charCodeAt(f.position);while((!Z||f.lineIndent<X)&&U===32)f.lineIndent++,U=f.input.charCodeAt(++f.position);if(!Z&&f.lineIndent>X)X=f.lineIndent;if(Q1(U)){Q++;continue}if(f.lineIndent<X){if(J===QY)f.result+=F1.repeat(`
|
|
41
|
+
`,z?1+Q:Q);else if(J===T$){if(z)f.result+=`
|
|
42
42
|
`}break}if(Y)if(d1(U))G=!0,f.result+=F1.repeat(`
|
|
43
43
|
`,z?1+Q:Q);else if(G)G=!1,f.result+=F1.repeat(`
|
|
44
44
|
`,Q+1);else if(Q===0){if(z)f.result+=" "}else f.result+=F1.repeat(`
|
|
45
45
|
`,Q);else f.result+=F1.repeat(`
|
|
46
|
-
`,z?1+Q:Q);z=!0,Z=!0,Q=0,M=f.position;while(!Q1(U)&&U!==0)U=f.input.charCodeAt(++f.position);I1(f,M,f.position,!1)}return!0}function KY(f,$){var M,Y=f.tag,J=f.anchor,z=[],Z,X=!1,Q;if(f.anchor!==null)f.anchorMap[f.anchor]=z;Q=f.input.charCodeAt(f.position);while(Q!==0){if(Q!==45)break;if(Z=f.input.charCodeAt(f.position+1),!s(Z))break;if(X=!0,f.position++,u(f,!0,-1)){if(f.lineIndent<=$){z.push(null),Q=f.input.charCodeAt(f.position);continue}}if(M=f.line,X0(f,$,HY,!1,!0),z.push(f.result),u(f,!0,-1),Q=f.input.charCodeAt(f.position),(f.line===M||f.lineIndent>$)&&Q!==0)N(f,"bad indentation of a sequence entry");else if(f.lineIndent<$)break}if(X)return f.tag=Y,f.anchor=J,f.kind="sequence",f.result=z,!0;return!1}function qX(f,$,M){var Y,J,z,Z,X=f.tag,Q=f.anchor,G={},D={},U=null,K=null,W=null,B=!1,
|
|
47
|
-
`;if(f.charCodeAt(0)===65279)f=f.slice(1)}var M=new GX(f,$),Y=f.indexOf("\x00");if(Y!==-1)M.position=Y,N(M,"null byte is not allowed in input");M.input+="\x00";while(M.input.charCodeAt(M.position)===32)M.lineIndent+=1,M.position+=1;while(M.position<M.length-1)FX(M);return M.documents}function PY(f,$,M){if($!==null&&typeof $==="object"&&typeof M>"u")M=$,$=null;var Y=LY(f,M);if(typeof $!=="function")return Y;for(var J=0,z=Y.length;J<z;J+=1)$(Y[J])}function TY(f,$){var M=LY(f,$);if(M.length===0)return;else if(M.length===1)return M[0];throw new VY("expected a single document in the stream, but found more")}function RX(f,$,M){if(typeof $==="object"&&$!==null&&typeof M>"u")M=$,$=null;return PY(f,$,F1.extend({schema:qY},M))}function NX(f,$){return TY(f,F1.extend({schema:qY},$))}
|
|
46
|
+
`,z?1+Q:Q);z=!0,Z=!0,Q=0,M=f.position;while(!Q1(U)&&U!==0)U=f.input.charCodeAt(++f.position);I1(f,M,f.position,!1)}return!0}function KY(f,$){var M,Y=f.tag,J=f.anchor,z=[],Z,X=!1,Q;if(f.anchor!==null)f.anchorMap[f.anchor]=z;Q=f.input.charCodeAt(f.position);while(Q!==0){if(Q!==45)break;if(Z=f.input.charCodeAt(f.position+1),!s(Z))break;if(X=!0,f.position++,u(f,!0,-1)){if(f.lineIndent<=$){z.push(null),Q=f.input.charCodeAt(f.position);continue}}if(M=f.line,X0(f,$,HY,!1,!0),z.push(f.result),u(f,!0,-1),Q=f.input.charCodeAt(f.position),(f.line===M||f.lineIndent>$)&&Q!==0)N(f,"bad indentation of a sequence entry");else if(f.lineIndent<$)break}if(X)return f.tag=Y,f.anchor=J,f.kind="sequence",f.result=z,!0;return!1}function qX(f,$,M){var Y,J,z,Z,X=f.tag,Q=f.anchor,G={},D={},U=null,K=null,W=null,B=!1,O=!1,F;if(f.anchor!==null)f.anchorMap[f.anchor]=G;F=f.input.charCodeAt(f.position);while(F!==0){if(Y=f.input.charCodeAt(f.position+1),z=f.line,Z=f.position,(F===63||F===58)&&s(Y)){if(F===63){if(B)Z0(f,G,D,U,K,null),U=K=W=null;O=!0,B=!0,J=!0}else if(B)B=!1,J=!0;else N(f,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");f.position+=1,F=Y}else if(X0(f,M,BY,!1,!0))if(f.line===z){F=f.input.charCodeAt(f.position);while(d1(F))F=f.input.charCodeAt(++f.position);if(F===58){if(F=f.input.charCodeAt(++f.position),!s(F))N(f,"a whitespace character is expected after the key-value separator within a block mapping");if(B)Z0(f,G,D,U,K,null),U=K=W=null;O=!0,B=!1,J=!1,U=f.tag,K=f.result}else if(O)N(f,"can not read an implicit mapping pair; a colon is missed");else return f.tag=X,f.anchor=Q,!0}else if(O)N(f,"can not read a block mapping entry; a multiline key may not be an implicit key");else return f.tag=X,f.anchor=Q,!0;else break;if(f.line===z||f.lineIndent>$){if(X0(f,$,Bf,!0,J))if(B)K=f.result;else W=f.result;if(!B)Z0(f,G,D,U,K,W,z,Z),U=K=W=null;u(f,!0,-1),F=f.input.charCodeAt(f.position)}if(f.lineIndent>$&&F!==0)N(f,"bad indentation of a mapping entry");else if(f.lineIndent<$)break}if(B)Z0(f,G,D,U,K,null);if(O)f.tag=X,f.anchor=Q,f.kind="mapping",f.result=G;return O}function BX(f){var $,M=!1,Y=!1,J,z,Z;if(Z=f.input.charCodeAt(f.position),Z!==33)return!1;if(f.tag!==null)N(f,"duplication of a tag property");if(Z=f.input.charCodeAt(++f.position),Z===60)M=!0,Z=f.input.charCodeAt(++f.position);else if(Z===33)Y=!0,J="!!",Z=f.input.charCodeAt(++f.position);else J="!";if($=f.position,M){do Z=f.input.charCodeAt(++f.position);while(Z!==0&&Z!==62);if(f.position<f.length)z=f.input.slice($,f.position),Z=f.input.charCodeAt(++f.position);else N(f,"unexpected end of the stream within a verbatim tag")}else{while(Z!==0&&!s(Z)){if(Z===33)if(!Y){if(J=f.input.slice($-1,f.position+1),!SY.test(J))N(f,"named tag handle cannot contain such characters");Y=!0,$=f.position+1}else N(f,"tag suffix cannot contain exclamation marks");Z=f.input.charCodeAt(++f.position)}if(z=f.input.slice($,f.position),JX.test(z))N(f,"tag suffix cannot contain flow indicator characters")}if(z&&!FY.test(z))N(f,"tag name cannot contain such characters: "+z);if(M)f.tag=z;else if(C1.call(f.tagMap,J))f.tag=f.tagMap[J]+z;else if(J==="!")f.tag="!"+z;else if(J==="!!")f.tag="tag:yaml.org,2002:"+z;else N(f,'undeclared tag handle "'+J+'"');return!0}function HX(f){var $,M;if(M=f.input.charCodeAt(f.position),M!==38)return!1;if(f.anchor!==null)N(f,"duplication of an anchor property");M=f.input.charCodeAt(++f.position),$=f.position;while(M!==0&&!s(M)&&!z0(M))M=f.input.charCodeAt(++f.position);if(f.position===$)N(f,"name of an anchor node must contain at least one character");return f.anchor=f.input.slice($,f.position),!0}function SX(f){var $,M,Y;if(Y=f.input.charCodeAt(f.position),Y!==42)return!1;Y=f.input.charCodeAt(++f.position),$=f.position;while(Y!==0&&!s(Y)&&!z0(Y))Y=f.input.charCodeAt(++f.position);if(f.position===$)N(f,"name of an alias node must contain at least one character");if(M=f.input.slice($,f.position),!C1.call(f.anchorMap,M))N(f,'unidentified alias "'+M+'"');return f.result=f.anchorMap[M],u(f,!0,-1),!0}function X0(f,$,M,Y,J){var z,Z,X,Q=1,G=!1,D=!1,U,K,W,B,O;if(f.listener!==null)f.listener("open",f);if(f.tag=null,f.anchor=null,f.kind=null,f.result=null,z=Z=X=Bf===M||HY===M,Y){if(u(f,!0,-1)){if(G=!0,f.lineIndent>$)Q=1;else if(f.lineIndent===$)Q=0;else if(f.lineIndent<$)Q=-1}}if(Q===1)while(BX(f)||HX(f))if(u(f,!0,-1)){if(G=!0,X=z,f.lineIndent>$)Q=1;else if(f.lineIndent===$)Q=0;else if(f.lineIndent<$)Q=-1}else X=!1;if(X)X=G||J;if(Q===1||Bf===M){if(qf===M||BY===M)B=$;else B=$+1;if(O=f.position-f.lineStart,Q===1)if(X&&(KY(f,O)||qX(f,O,B))||KX(f,B))D=!0;else{if(Z&&VX(f,B)||UX(f,B)||WX(f,B))D=!0;else if(SX(f)){if(D=!0,f.tag!==null||f.anchor!==null)N(f,"alias node should not have any properties")}else if(DX(f,B,qf===M)){if(D=!0,f.tag===null)f.tag="?"}if(f.anchor!==null)f.anchorMap[f.anchor]=f.result}else if(Q===0)D=X&&KY(f,O)}if(f.tag!==null&&f.tag!=="!")if(f.tag==="?"){if(f.result!==null&&f.kind!=="scalar")N(f,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+f.kind+'"');for(U=0,K=f.implicitTypes.length;U<K;U+=1)if(W=f.implicitTypes[U],W.resolve(f.result)){if(f.result=W.construct(f.result),f.tag=W.tag,f.anchor!==null)f.anchorMap[f.anchor]=f.result;break}}else if(C1.call(f.typeMap[f.kind||"fallback"],f.tag)){if(W=f.typeMap[f.kind||"fallback"][f.tag],f.result!==null&&W.kind!==f.kind)N(f,"unacceptable node kind for !<"+f.tag+'> tag; it should be "'+W.kind+'", not "'+f.kind+'"');if(!W.resolve(f.result))N(f,"cannot resolve a node with !<"+f.tag+"> explicit tag");else if(f.result=W.construct(f.result),f.anchor!==null)f.anchorMap[f.anchor]=f.result}else N(f,"unknown tag !<"+f.tag+">");if(f.listener!==null)f.listener("close",f);return f.tag!==null||f.anchor!==null||D}function FX(f){var $=f.position,M,Y,J,z=!1,Z;f.version=null,f.checkLineBreaks=f.legacy,f.tagMap={},f.anchorMap={};while((Z=f.input.charCodeAt(f.position))!==0){if(u(f,!0,-1),Z=f.input.charCodeAt(f.position),f.lineIndent>0||Z!==37)break;z=!0,Z=f.input.charCodeAt(++f.position),M=f.position;while(Z!==0&&!s(Z))Z=f.input.charCodeAt(++f.position);if(Y=f.input.slice(M,f.position),J=[],Y.length<1)N(f,"directive name must not be less than one character in length");while(Z!==0){while(d1(Z))Z=f.input.charCodeAt(++f.position);if(Z===35){do Z=f.input.charCodeAt(++f.position);while(Z!==0&&!Q1(Z));break}if(Q1(Z))break;M=f.position;while(Z!==0&&!s(Z))Z=f.input.charCodeAt(++f.position);J.push(f.input.slice(M,f.position))}if(Z!==0)w$(f);if(C1.call(UY,Y))UY[Y](f,Y,J);else Hf(f,'unknown document directive "'+Y+'"')}if(u(f,!0,-1),f.lineIndent===0&&f.input.charCodeAt(f.position)===45&&f.input.charCodeAt(f.position+1)===45&&f.input.charCodeAt(f.position+2)===45)f.position+=3,u(f,!0,-1);else if(z)N(f,"directives end mark is expected");if(X0(f,f.lineIndent-1,Bf,!1,!0),u(f,!0,-1),f.checkLineBreaks&&YX.test(f.input.slice($,f.position)))Hf(f,"non-ASCII line breaks are interpreted as content");if(f.documents.push(f.result),f.position===f.lineStart&&Sf(f)){if(f.input.charCodeAt(f.position)===46)f.position+=3,u(f,!0,-1);return}if(f.position<f.length-1)N(f,"end of the stream or a document separator is expected");else return}function LY(f,$){if(f=String(f),$=$||{},f.length!==0){if(f.charCodeAt(f.length-1)!==10&&f.charCodeAt(f.length-1)!==13)f+=`
|
|
47
|
+
`;if(f.charCodeAt(0)===65279)f=f.slice(1)}var M=new GX(f,$),Y=f.indexOf("\x00");if(Y!==-1)M.position=Y,N(M,"null byte is not allowed in input");M.input+="\x00";while(M.input.charCodeAt(M.position)===32)M.lineIndent+=1,M.position+=1;while(M.position<M.length-1)FX(M);return M.documents}function PY(f,$,M){if($!==null&&typeof $==="object"&&typeof M>"u")M=$,$=null;var Y=LY(f,M);if(typeof $!=="function")return Y;for(var J=0,z=Y.length;J<z;J+=1)$(Y[J])}function TY(f,$){var M=LY(f,$);if(M.length===0)return;else if(M.length===1)return M[0];throw new VY("expected a single document in the stream, but found more")}function RX(f,$,M){if(typeof $==="object"&&$!==null&&typeof M>"u")M=$,$=null;return PY(f,$,F1.extend({schema:qY},M))}function NX(f,$){return TY(f,F1.extend({schema:qY},$))}OX.loadAll=PY;OX.load=TY;OX.safeLoadAll=RX;OX.safeLoad=NX});var sY=V((XQ,x$)=>{var _0=g1(),v0=M0(),wX=y0(),jX=J0(),bY=Object.prototype.toString,_Y=Object.prototype.hasOwnProperty,IX=9,b0=10,CX=13,EX=32,xX=33,yX=34,vY=35,kX=37,bX=38,_X=39,vX=42,uY=44,uX=45,hY=58,hX=61,gX=62,cX=63,mX=64,gY=91,cY=93,dX=96,mY=123,lX=124,dY=125,d={};d[0]="\\0";d[7]="\\a";d[8]="\\b";d[9]="\\t";d[10]="\\n";d[11]="\\v";d[12]="\\f";d[13]="\\r";d[27]="\\e";d[34]="\\\"";d[92]="\\\\";d[133]="\\N";d[160]="\\_";d[8232]="\\L";d[8233]="\\P";var nX=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];function rX(f,$){var M,Y,J,z,Z,X,Q;if($===null)return{};M={},Y=Object.keys($);for(J=0,z=Y.length;J<z;J+=1){if(Z=Y[J],X=String($[Z]),Z.slice(0,2)==="!!")Z="tag:yaml.org,2002:"+Z.slice(2);if(Q=f.compiledTypeMap.fallback[Z],Q&&_Y.call(Q.styleAliases,X))X=Q.styleAliases[X];M[Z]=X}return M}function jY(f){var $,M,Y;if($=f.toString(16).toUpperCase(),f<=255)M="x",Y=2;else if(f<=65535)M="u",Y=4;else if(f<=4294967295)M="U",Y=8;else throw new v0("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+M+_0.repeat("0",Y-$.length)+$}function pX(f){this.schema=f.schema||wX,this.indent=Math.max(1,f.indent||2),this.noArrayIndent=f.noArrayIndent||!1,this.skipInvalid=f.skipInvalid||!1,this.flowLevel=_0.isNothing(f.flowLevel)?-1:f.flowLevel,this.styleMap=rX(this.schema,f.styles||null),this.sortKeys=f.sortKeys||!1,this.lineWidth=f.lineWidth||80,this.noRefs=f.noRefs||!1,this.noCompatMode=f.noCompatMode||!1,this.condenseFlow=f.condenseFlow||!1,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function IY(f,$){var M=_0.repeat(" ",$),Y=0,J=-1,z="",Z,X=f.length;while(Y<X){if(J=f.indexOf(`
|
|
48
48
|
`,Y),J===-1)Z=f.slice(Y),Y=X;else Z=f.slice(Y,J+1),Y=J+1;if(Z.length&&Z!==`
|
|
49
|
-
`)z+=M;z+=Z}return z}function
|
|
50
|
-
`+_0.repeat(" ",f.indent*$)}function iX(f,$){var M,Y,J;for(M=0,Y=f.implicitTypes.length;M<Y;M+=1)if(J=f.implicitTypes[M],J.resolve($))return!0;return!1}function
|
|
49
|
+
`)z+=M;z+=Z}return z}function I$(f,$){return`
|
|
50
|
+
`+_0.repeat(" ",f.indent*$)}function iX(f,$){var M,Y,J;for(M=0,Y=f.implicitTypes.length;M<Y;M+=1)if(J=f.implicitTypes[M],J.resolve($))return!0;return!1}function E$(f){return f===EX||f===IX}function Q0(f){return 32<=f&&f<=126||161<=f&&f<=55295&&f!==8232&&f!==8233||57344<=f&&f<=65533&&f!==65279||65536<=f&&f<=1114111}function oX(f){return Q0(f)&&!E$(f)&&f!==65279&&f!==CX&&f!==b0}function CY(f,$){return Q0(f)&&f!==65279&&f!==uY&&f!==gY&&f!==cY&&f!==mY&&f!==dY&&f!==hY&&(f!==vY||$&&oX($))}function sX(f){return Q0(f)&&f!==65279&&!E$(f)&&f!==uX&&f!==cX&&f!==hY&&f!==uY&&f!==gY&&f!==cY&&f!==mY&&f!==dY&&f!==vY&&f!==bX&&f!==vX&&f!==xX&&f!==lX&&f!==hX&&f!==gX&&f!==_X&&f!==yX&&f!==kX&&f!==mX&&f!==dX}function lY(f){var $=/^\n* /;return $.test(f)}var nY=1,rY=2,pY=3,iY=4,Ff=5;function aX(f,$,M,Y,J){var z,Z,X,Q=!1,G=!1,D=Y!==-1,U=-1,K=sX(f.charCodeAt(0))&&!E$(f.charCodeAt(f.length-1));if($)for(z=0;z<f.length;z++){if(Z=f.charCodeAt(z),!Q0(Z))return Ff;X=z>0?f.charCodeAt(z-1):null,K=K&&CY(Z,X)}else{for(z=0;z<f.length;z++){if(Z=f.charCodeAt(z),Z===b0){if(Q=!0,D)G=G||z-U-1>Y&&f[U+1]!==" ",U=z}else if(!Q0(Z))return Ff;X=z>0?f.charCodeAt(z-1):null,K=K&&CY(Z,X)}G=G||D&&(z-U-1>Y&&f[U+1]!==" ")}if(!Q&&!G)return K&&!J(f)?nY:rY;if(M>9&&lY(f))return Ff;return G?iY:pY}function tX(f,$,M,Y){f.dump=function(){if($.length===0)return"''";if(!f.noCompatMode&&nX.indexOf($)!==-1)return"'"+$+"'";var J=f.indent*Math.max(1,M),z=f.lineWidth===-1?-1:Math.max(Math.min(f.lineWidth,40),f.lineWidth-J),Z=Y||f.flowLevel>-1&&M>=f.flowLevel;function X(Q){return iX(f,Q)}switch(aX($,Z,f.indent,z,X)){case nY:return $;case rY:return"'"+$.replace(/'/g,"''")+"'";case pY:return"|"+EY($,f.indent)+xY(IY($,J));case iY:return">"+EY($,f.indent)+xY(IY(eX($,z),J));case Ff:return'"'+fQ($,z)+'"';default:throw new v0("impossible error: invalid scalar style")}}()}function EY(f,$){var M=lY(f)?String($):"",Y=f[f.length-1]===`
|
|
51
51
|
`,J=Y&&(f[f.length-2]===`
|
|
52
52
|
`||f===`
|
|
53
53
|
`),z=J?"+":Y?"":"-";return M+z+`
|
|
@@ -58,41 +58,41 @@ Expecting one of '${M.join("', '")}'`);let Y=`${f}Help`;return this.on(Y,(J)=>{l
|
|
|
58
58
|
`:"")+yY(Q,$),J=z}return Y}function yY(f,$){if(f===""||f[0]===" ")return f;var M=/ [^ ]/g,Y,J=0,z,Z=0,X=0,Q="";while(Y=M.exec(f)){if(X=Y.index,X-J>$)z=Z>J?Z:X,Q+=`
|
|
59
59
|
`+f.slice(J,z),J=z+1;Z=X}if(Q+=`
|
|
60
60
|
`,f.length-J>$&&Z>J)Q+=f.slice(J,Z)+`
|
|
61
|
-
`+f.slice(Z+1);else Q+=f.slice(J);return Q.slice(1)}function fQ(f){var $="",M,Y,J;for(var z=0;z<f.length;z++){if(M=f.charCodeAt(z),M>=55296&&M<=56319){if(Y=f.charCodeAt(z+1),Y>=56320&&Y<=57343){$+=jY((M-55296)*1024+Y-56320+65536),z++;continue}}J=d[M],$+=!J&&Q0(M)?f[z]:J||jY(M)}return $}function $Q(f,$,M){var Y="",J=f.tag,z,Z;for(z=0,Z=M.length;z<Z;z+=1)if(l1(f,$,M[z],!1,!1)){if(z!==0)Y+=","+(!f.condenseFlow?" ":"");Y+=f.dump}f.tag=J,f.dump="["+Y+"]"}function MQ(f,$,M,Y){var J="",z=f.tag,Z,X;for(Z=0,X=M.length;Z<X;Z+=1)if(l1(f,$+1,M[Z],!0,!0)){if(!Y||Z!==0)J+=
|
|
62
|
-
`;return""}function ZQ(f,$){return oY(f,_0.extend({schema:jX},$))}XQ.dump=oY;XQ.safeDump=ZQ});var tY=V((DQ,b)=>{var Rf=wY(),aY=sY();function Nf(f){return function(){throw Error("Function "+f+" is deprecated and cannot be used.")}}DQ.Type=h();DQ.Schema=c1();DQ.FAILSAFE_SCHEMA=Kf();DQ.JSON_SCHEMA=
|
|
61
|
+
`+f.slice(Z+1);else Q+=f.slice(J);return Q.slice(1)}function fQ(f){var $="",M,Y,J;for(var z=0;z<f.length;z++){if(M=f.charCodeAt(z),M>=55296&&M<=56319){if(Y=f.charCodeAt(z+1),Y>=56320&&Y<=57343){$+=jY((M-55296)*1024+Y-56320+65536),z++;continue}}J=d[M],$+=!J&&Q0(M)?f[z]:J||jY(M)}return $}function $Q(f,$,M){var Y="",J=f.tag,z,Z;for(z=0,Z=M.length;z<Z;z+=1)if(l1(f,$,M[z],!1,!1)){if(z!==0)Y+=","+(!f.condenseFlow?" ":"");Y+=f.dump}f.tag=J,f.dump="["+Y+"]"}function MQ(f,$,M,Y){var J="",z=f.tag,Z,X;for(Z=0,X=M.length;Z<X;Z+=1)if(l1(f,$+1,M[Z],!0,!0)){if(!Y||Z!==0)J+=I$(f,$);if(f.dump&&b0===f.dump.charCodeAt(0))J+="-";else J+="- ";J+=f.dump}f.tag=z,f.dump=J||"[]"}function YQ(f,$,M){var Y="",J=f.tag,z=Object.keys(M),Z,X,Q,G,D;for(Z=0,X=z.length;Z<X;Z+=1){if(D="",Z!==0)D+=", ";if(f.condenseFlow)D+='"';if(Q=z[Z],G=M[Q],!l1(f,$,Q,!1,!1))continue;if(f.dump.length>1024)D+="? ";if(D+=f.dump+(f.condenseFlow?'"':"")+":"+(f.condenseFlow?"":" "),!l1(f,$,G,!1,!1))continue;D+=f.dump,Y+=D}f.tag=J,f.dump="{"+Y+"}"}function JQ(f,$,M,Y){var J="",z=f.tag,Z=Object.keys(M),X,Q,G,D,U,K;if(f.sortKeys===!0)Z.sort();else if(typeof f.sortKeys==="function")Z.sort(f.sortKeys);else if(f.sortKeys)throw new v0("sortKeys must be a boolean or a function");for(X=0,Q=Z.length;X<Q;X+=1){if(K="",!Y||X!==0)K+=I$(f,$);if(G=Z[X],D=M[G],!l1(f,$+1,G,!0,!0,!0))continue;if(U=f.tag!==null&&f.tag!=="?"||f.dump&&f.dump.length>1024,U)if(f.dump&&b0===f.dump.charCodeAt(0))K+="?";else K+="? ";if(K+=f.dump,U)K+=I$(f,$);if(!l1(f,$+1,D,!0,U))continue;if(f.dump&&b0===f.dump.charCodeAt(0))K+=":";else K+=": ";K+=f.dump,J+=K}f.tag=z,f.dump=J||"{}"}function kY(f,$,M){var Y,J,z,Z,X,Q;J=M?f.explicitTypes:f.implicitTypes;for(z=0,Z=J.length;z<Z;z+=1)if(X=J[z],(X.instanceOf||X.predicate)&&(!X.instanceOf||typeof $==="object"&&$ instanceof X.instanceOf)&&(!X.predicate||X.predicate($))){if(f.tag=M?X.tag:"?",X.represent){if(Q=f.styleMap[X.tag]||X.defaultStyle,bY.call(X.represent)==="[object Function]")Y=X.represent($,Q);else if(_Y.call(X.represent,Q))Y=X.represent[Q]($,Q);else throw new v0("!<"+X.tag+'> tag resolver accepts not "'+Q+'" style');f.dump=Y}return!0}return!1}function l1(f,$,M,Y,J,z){if(f.tag=null,f.dump=M,!kY(f,M,!1))kY(f,M,!0);var Z=bY.call(f.dump);if(Y)Y=f.flowLevel<0||f.flowLevel>$;var X=Z==="[object Object]"||Z==="[object Array]",Q,G;if(X)Q=f.duplicates.indexOf(M),G=Q!==-1;if(f.tag!==null&&f.tag!=="?"||G||f.indent!==2&&$>0)J=!1;if(G&&f.usedDuplicates[Q])f.dump="*ref_"+Q;else{if(X&&G&&!f.usedDuplicates[Q])f.usedDuplicates[Q]=!0;if(Z==="[object Object]"){if(Y&&Object.keys(f.dump).length!==0){if(JQ(f,$,f.dump,J),G)f.dump="&ref_"+Q+f.dump}else if(YQ(f,$,f.dump),G)f.dump="&ref_"+Q+" "+f.dump}else if(Z==="[object Array]"){var D=f.noArrayIndent&&$>0?$-1:$;if(Y&&f.dump.length!==0){if(MQ(f,D,f.dump,J),G)f.dump="&ref_"+Q+f.dump}else if($Q(f,D,f.dump),G)f.dump="&ref_"+Q+" "+f.dump}else if(Z==="[object String]"){if(f.tag!=="?")tX(f,f.dump,$,z)}else{if(f.skipInvalid)return!1;throw new v0("unacceptable kind of an object to dump "+Z)}if(f.tag!==null&&f.tag!=="?")f.dump="!<"+f.tag+"> "+f.dump}return!0}function zQ(f,$){var M=[],Y=[],J,z;C$(f,M,Y);for(J=0,z=Y.length;J<z;J+=1)$.duplicates.push(M[Y[J]]);$.usedDuplicates=Array(z)}function C$(f,$,M){var Y,J,z;if(f!==null&&typeof f==="object")if(J=$.indexOf(f),J!==-1){if(M.indexOf(J)===-1)M.push(J)}else if($.push(f),Array.isArray(f))for(J=0,z=f.length;J<z;J+=1)C$(f[J],$,M);else{Y=Object.keys(f);for(J=0,z=Y.length;J<z;J+=1)C$(f[Y[J]],$,M)}}function oY(f,$){$=$||{};var M=new pX($);if(!M.noRefs)zQ(f,M);if(l1(M,0,f,!0,!0))return M.dump+`
|
|
62
|
+
`;return""}function ZQ(f,$){return oY(f,_0.extend({schema:jX},$))}XQ.dump=oY;XQ.safeDump=ZQ});var tY=V((DQ,b)=>{var Rf=wY(),aY=sY();function Nf(f){return function(){throw Error("Function "+f+" is deprecated and cannot be used.")}}DQ.Type=h();DQ.Schema=c1();DQ.FAILSAFE_SCHEMA=Kf();DQ.JSON_SCHEMA=N$();DQ.CORE_SCHEMA=O$();DQ.DEFAULT_SAFE_SCHEMA=J0();DQ.DEFAULT_FULL_SCHEMA=y0();DQ.load=Rf.load;DQ.loadAll=Rf.loadAll;DQ.safeLoad=Rf.safeLoad;DQ.safeLoadAll=Rf.safeLoadAll;DQ.dump=aY.dump;DQ.safeDump=aY.safeDump;DQ.YAMLException=M0();DQ.MINIMAL_SCHEMA=Kf();DQ.SAFE_SCHEMA=J0();DQ.DEFAULT_SCHEMA=y0();DQ.scan=Nf("scan");DQ.parse=Nf("parse");DQ.compose=Nf("compose");DQ.addConstructor=Nf("addConstructor")});var f4=V((EV,eY)=>{var xQ=tY();eY.exports=xQ});var _$=V((k$,b$)=>{var Of=f4(),y$=k$=b$.exports;y$.yaml={parse:Of.safeLoad.bind(Of),stringify:Of.safeDump.bind(Of)};y$.json={parse:JSON.parse.bind(JSON),stringify:function(f,$){let M=Object.assign({replacer:null,space:2},$);return JSON.stringify(f,M.replacer,M.space)}};y$.javascript={parse:function parse(str,options,wrap){try{if(wrap!==!1)str=`(function() {
|
|
63
63
|
return `+str.trim()+`;
|
|
64
|
-
}());`;return eval(str)||{}}catch(f){if(wrap!==!1&&/(unexpected|identifier)/i.test(f.message))return parse(str,options,!1);throw SyntaxError(f)}},stringify:function(){throw Error("stringifying JavaScript is not supported")}}});var M4=V((
|
|
64
|
+
}());`;return eval(str)||{}}catch(f){if(wrap!==!1&&/(unexpected|identifier)/i.test(f.message))return parse(str,options,!1);throw SyntaxError(f)}},stringify:function(){throw Error("stringifying JavaScript is not supported")}}});var M4=V((xV,$4)=>{/*!
|
|
65
65
|
* strip-bom-string <https://github.com/jonschlinkert/strip-bom-string>
|
|
66
66
|
*
|
|
67
67
|
* Copyright (c) 2015, 2017, Jon Schlinkert.
|
|
68
68
|
* Released under the MIT License.
|
|
69
|
-
*/$4.exports=function(f){if(typeof f==="string"&&f.charAt(0)==="\uFEFF")return f.slice(1);return f}});var
|
|
69
|
+
*/$4.exports=function(f){if(typeof f==="string"&&f.charAt(0)==="\uFEFF")return f.slice(1);return f}});var Af=V((yQ)=>{var Y4=M4(),J4=E0();yQ.define=function(f,$,M){Reflect.defineProperty(f,$,{enumerable:!1,configurable:!0,writable:!0,value:M})};yQ.isBuffer=function(f){return J4(f)==="buffer"};yQ.isObject=function(f){return J4(f)==="object"};yQ.toBuffer=function(f){return typeof f==="string"?Buffer.from(f):f};yQ.toString=function(f){if(yQ.isBuffer(f))return Y4(String(f));if(typeof f!=="string")throw TypeError("expected input to be a string or buffer");return Y4(f)};yQ.arrayify=function(f){return f?Array.isArray(f)?f:[f]:[]};yQ.startsWith=function(f,$,M){if(typeof M!=="number")M=$.length;return f.slice(0,M)===$}});var u0=V((kV,Z4)=>{var gQ=_$(),cQ=Af();Z4.exports=function(f){let $=Object.assign({},f);if($.delimiters=cQ.arrayify($.delims||$.delimiters||"---"),$.delimiters.length===1)$.delimiters.push($.delimiters[0]);return $.language=($.language||$.lang||"yaml").toLowerCase(),$.engines=Object.assign({},gQ,$.parsers,$.engines),$}});var v$=V((bV,X4)=>{X4.exports=function(f,$){let M=$.engines[f]||$.engines[mQ(f)];if(typeof M>"u")throw Error('gray-matter engine "'+f+'" is not registered');if(typeof M==="function")M={parse:M};return M};function mQ(f){switch(f.toLowerCase()){case"js":case"javascript":return"javascript";case"coffee":case"coffeescript":case"cson":return"coffee";case"yaml":case"yml":return"yaml";default:return f}}});var u$=V((_V,Q4)=>{var dQ=E0(),lQ=v$(),nQ=u0();Q4.exports=function(f,$,M){if($==null&&M==null)switch(dQ(f)){case"object":$=f.data,M={};break;case"string":return f;default:throw TypeError("expected file to be a string or object")}let Y=f.content,J=nQ(M);if($==null){if(!J.data)return f;$=J.data}let z=f.language||J.language,Z=lQ(z,J);if(typeof Z.stringify!=="function")throw TypeError('expected "'+z+'.stringify" to be a function');$=Object.assign({},f.data,$);let X=J.delimiters[0],Q=J.delimiters[1],G=Z.stringify($,M).trim(),D="";if(G!=="{}")D=G0(X)+G0(G)+G0(Q);if(typeof f.excerpt==="string"&&f.excerpt!==""){if(Y.indexOf(f.excerpt.trim())===-1)D+=G0(f.excerpt)+G0(Q)}return D+G0(Y)};function G0(f){return f.slice(-1)!==`
|
|
70
70
|
`?f+`
|
|
71
|
-
`:f}});var D4=V((
|
|
71
|
+
`:f}});var D4=V((vV,G4)=>{var rQ=u0();G4.exports=function(f,$){let M=rQ($);if(f.data==null)f.data={};if(typeof M.excerpt==="function")return M.excerpt(f,M);let Y=f.data.excerpt_separator||M.excerpt_separator;if(Y==null&&(M.excerpt===!1||M.excerpt==null))return f;let J=typeof M.excerpt==="string"?M.excerpt:Y||M.delimiters[0],z=f.content.indexOf(J);if(z!==-1)f.excerpt=f.content.slice(0,z);return f}});var K4=V((uV,W4)=>{var U4=E0(),pQ=u$(),D0=Af();W4.exports=function(f){if(U4(f)!=="object")f={content:f};if(U4(f.data)!=="object")f.data={};if(f.contents&&f.content==null)f.content=f.contents;return D0.define(f,"orig",D0.toBuffer(f.content)),D0.define(f,"language",f.language||""),D0.define(f,"matter",f.matter||""),D0.define(f,"stringify",function($,M){if(M&&M.language)f.language=M.language;return pQ(f,$,M)}),f.content=D0.toString(f.content),f.isEmpty=!1,f.excerpt="",f}});var q4=V((hV,V4)=>{var iQ=v$(),oQ=u0();V4.exports=function(f,$,M){let Y=oQ(M),J=iQ(f,Y);if(typeof J.parse!=="function")throw TypeError('expected "'+f+'.parse" to be a function');return J.parse($,Y)}});var F4=V((gV,S4)=>{var sQ=o("fs"),aQ=UM(),h$=u0(),tQ=u$(),B4=D4(),eQ=_$(),fG=K4(),$G=q4(),H4=Af();function l(f,$){if(f==="")return{data:{},content:f,excerpt:"",orig:f};let M=fG(f),Y=l.cache[M.content];if(!$){if(Y)return M=Object.assign({},Y),M.orig=Y.orig,M;l.cache[M.content]=M}return MG(M,$)}function MG(f,$){let M=h$($),Y=M.delimiters[0],J=`
|
|
72
72
|
`+M.delimiters[1],z=f.content;if(M.language)f.language=M.language;let Z=Y.length;if(!H4.startsWith(z,Y,Z))return B4(f,M),f;if(z.charAt(Z)===Y.slice(-1))return f;z=z.slice(Z);let X=z.length,Q=l.language(z,M);if(Q.name)f.language=Q.name,z=z.slice(Q.raw.length);let G=z.indexOf(J);if(G===-1)G=X;if(f.matter=z.slice(0,G),f.matter.replace(/^\s*#[^\n]+/gm,"").trim()==="")f.isEmpty=!0,f.empty=f.content,f.data={};else f.data=$G(f.language,f.matter,M);if(G===X)f.content="";else{if(f.content=z.slice(G+J.length),f.content[0]==="\r")f.content=f.content.slice(1);if(f.content[0]===`
|
|
73
|
-
`)f.content=f.content.slice(1)}if(B4(f,M),M.sections===!0||typeof M.section==="function")aQ(f,M.section);return f}l.engines=eQ;l.stringify=function(f,$,M){if(typeof f==="string")f=l(f,M);return tQ(f,$,M)};l.read=function(f,$){let M=sQ.readFileSync(f,"utf8"),Y=l(M,$);return Y.path=f,Y};l.test=function(f,$){return H4.startsWith(f,
|
|
74
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var z=!0,Z=!1,X;return{s:function(){M=M.call(f)},n:function(){var G=M.next();return z=G.done,G},e:function(G){Z=!0,X=G},f:function(){try{if(!z&&M.return!=null)M.return()}finally{if(Z)throw X}}}}function SG(f,$){if(!f)return;if(typeof f==="string")return c4(f,$);var M=Object.prototype.toString.call(f).slice(8,-1);if(M==="Object"&&f.constructor)M=f.constructor.name;if(M==="Map"||M==="Set")return Array.from(f);if(M==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(M))return c4(f,$)}function c4(f,$){if($==null||$>f.length)$=f.length;for(var M=0,Y=Array($);M<$;M++)Y[M]=f[M];return Y}var FG=Pf(),d4=y(),m4=d4.erase,RG=d4.cursor,NG=(f)=>[...FG(f)].length;l4.exports=function(f,$){if(!$)return m4.line+RG.to(0);let M=0,Y=f.split(/\r?\n/);var J=HG(Y),z;try{for(J.s();!(z=J.n()).done;){let Z=z.value;M+=1+Math.floor(Math.max(NG(Z)-1,0)/$)}}catch(Z){J.e(Z)}finally{J.f()}return m4.lines(M)}});var
|
|
73
|
+
`)f.content=f.content.slice(1)}if(B4(f,M),M.sections===!0||typeof M.section==="function")aQ(f,M.section);return f}l.engines=eQ;l.stringify=function(f,$,M){if(typeof f==="string")f=l(f,M);return tQ(f,$,M)};l.read=function(f,$){let M=sQ.readFileSync(f,"utf8"),Y=l(M,$);return Y.path=f,Y};l.test=function(f,$){return H4.startsWith(f,h$($).delimiters[0])};l.language=function(f,$){let Y=h$($).delimiters[0];if(l.test(f))f=f.slice(Y.length);let J=f.slice(0,f.search(/\r?\n/));return{raw:J,name:J?J.trim():""}};l.cache={};l.clearCache=function(){l.cache={}};S4.exports=l});var x=V((yq,_4)=>{var{FORCE_COLOR:UG,NODE_DISABLE_COLORS:WG,TERM:KG}=process.env,j={enabled:!WG&&KG!=="dumb"&&UG!=="0",reset:E(0,0),bold:E(1,22),dim:E(2,22),italic:E(3,23),underline:E(4,24),inverse:E(7,27),hidden:E(8,28),strikethrough:E(9,29),black:E(30,39),red:E(31,39),green:E(32,39),yellow:E(33,39),blue:E(34,39),magenta:E(35,39),cyan:E(36,39),white:E(37,39),gray:E(90,39),grey:E(90,39),bgBlack:E(40,49),bgRed:E(41,49),bgGreen:E(42,49),bgYellow:E(43,49),bgBlue:E(44,49),bgMagenta:E(45,49),bgCyan:E(46,49),bgWhite:E(47,49)};function b4(f,$){let M=0,Y,J="",z="";for(;M<f.length;M++)if(Y=f[M],J+=Y.open,z+=Y.close,$.includes(Y.close))$=$.replace(Y.rgx,Y.close+Y.open);return J+$+z}function VG(f,$){let M={has:f,keys:$};return M.reset=j.reset.bind(M),M.bold=j.bold.bind(M),M.dim=j.dim.bind(M),M.italic=j.italic.bind(M),M.underline=j.underline.bind(M),M.inverse=j.inverse.bind(M),M.hidden=j.hidden.bind(M),M.strikethrough=j.strikethrough.bind(M),M.black=j.black.bind(M),M.red=j.red.bind(M),M.green=j.green.bind(M),M.yellow=j.yellow.bind(M),M.blue=j.blue.bind(M),M.magenta=j.magenta.bind(M),M.cyan=j.cyan.bind(M),M.white=j.white.bind(M),M.gray=j.gray.bind(M),M.grey=j.grey.bind(M),M.bgBlack=j.bgBlack.bind(M),M.bgRed=j.bgRed.bind(M),M.bgGreen=j.bgGreen.bind(M),M.bgYellow=j.bgYellow.bind(M),M.bgBlue=j.bgBlue.bind(M),M.bgMagenta=j.bgMagenta.bind(M),M.bgCyan=j.bgCyan.bind(M),M.bgWhite=j.bgWhite.bind(M),M}function E(f,$){let M={open:`\x1B[${f}m`,close:`\x1B[${$}m`,rgx:new RegExp(`\\x1b\\[${$}m`,"g")};return function(Y){if(this!==void 0&&this.has!==void 0)return this.has.includes(f)||(this.has.push(f),this.keys.push(M)),Y===void 0?this:j.enabled?b4(this.keys,Y+""):Y+"";return Y===void 0?VG([f],[M]):j.enabled?b4([M],Y+""):Y+""}}_4.exports=j});var u4=V((kq,v4)=>{v4.exports=(f,$)=>{if(f.meta&&f.name!=="escape")return;if(f.ctrl){if(f.name==="a")return"first";if(f.name==="c")return"abort";if(f.name==="d")return"abort";if(f.name==="e")return"last";if(f.name==="g")return"reset"}if($){if(f.name==="j")return"down";if(f.name==="k")return"up"}if(f.name==="return")return"submit";if(f.name==="enter")return"submit";if(f.name==="backspace")return"delete";if(f.name==="delete")return"deleteForward";if(f.name==="abort")return"abort";if(f.name==="escape")return"exit";if(f.name==="tab")return"next";if(f.name==="pagedown")return"nextPage";if(f.name==="pageup")return"prevPage";if(f.name==="home")return"home";if(f.name==="end")return"end";if(f.name==="up")return"up";if(f.name==="down")return"down";if(f.name==="right")return"right";if(f.name==="left")return"left";return!1}});var Pf=V((bq,h4)=>{h4.exports=(f)=>{let $=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),M=new RegExp($,"g");return typeof f==="string"?f.replace(M,""):f}});var y=V((_q,g4)=>{var l$={to(f,$){if(!$)return`\x1B[${f+1}G`;return`\x1B[${$+1};${f+1}H`},move(f,$){let M="";if(f<0)M+=`\x1B[${-f}D`;else if(f>0)M+=`\x1B[${f}C`;if($<0)M+=`\x1B[${-$}A`;else if($>0)M+=`\x1B[${$}B`;return M},up:(f=1)=>`\x1B[${f}A`,down:(f=1)=>`\x1B[${f}B`,forward:(f=1)=>`\x1B[${f}C`,backward:(f=1)=>`\x1B[${f}D`,nextLine:(f=1)=>"\x1B[E".repeat(f),prevLine:(f=1)=>"\x1B[F".repeat(f),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},qG={up:(f=1)=>"\x1B[S".repeat(f),down:(f=1)=>"\x1B[T".repeat(f)},BG={screen:"\x1B[2J",up:(f=1)=>"\x1B[1J".repeat(f),down:(f=1)=>"\x1B[J".repeat(f),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(f){let $="";for(let M=0;M<f;M++)$+=this.line+(M<f-1?l$.up():"");if(f)$+=l$.left;return $}};g4.exports={cursor:l$,scroll:qG,erase:BG,beep:"\x07"}});var n4=V((vq,l4)=>{function HG(f,$){var M=typeof Symbol<"u"&&f[Symbol.iterator]||f["@@iterator"];if(!M){if(Array.isArray(f)||(M=SG(f))||$&&f&&typeof f.length==="number"){if(M)f=M;var Y=0,J=function(){};return{s:J,n:function(){if(Y>=f.length)return{done:!0};return{done:!1,value:f[Y++]}},e:function(G){throw G},f:J}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
74
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var z=!0,Z=!1,X;return{s:function(){M=M.call(f)},n:function(){var G=M.next();return z=G.done,G},e:function(G){Z=!0,X=G},f:function(){try{if(!z&&M.return!=null)M.return()}finally{if(Z)throw X}}}}function SG(f,$){if(!f)return;if(typeof f==="string")return c4(f,$);var M=Object.prototype.toString.call(f).slice(8,-1);if(M==="Object"&&f.constructor)M=f.constructor.name;if(M==="Map"||M==="Set")return Array.from(f);if(M==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(M))return c4(f,$)}function c4(f,$){if($==null||$>f.length)$=f.length;for(var M=0,Y=Array($);M<$;M++)Y[M]=f[M];return Y}var FG=Pf(),d4=y(),m4=d4.erase,RG=d4.cursor,NG=(f)=>[...FG(f)].length;l4.exports=function(f,$){if(!$)return m4.line+RG.to(0);let M=0,Y=f.split(/\r?\n/);var J=HG(Y),z;try{for(J.s();!(z=J.n()).done;){let Z=z.value;M+=1+Math.floor(Math.max(NG(Z)-1,0)/$)}}catch(Z){J.e(Z)}finally{J.f()}return m4.lines(M)}});var n$=V((uq,r4)=>{var h0={arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",radioOn:"◉",radioOff:"◯",tick:"✔",cross:"✖",ellipsis:"…",pointerSmall:"›",line:"─",pointer:"❯"},OG={arrowUp:h0.arrowUp,arrowDown:h0.arrowDown,arrowLeft:h0.arrowLeft,arrowRight:h0.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"√",cross:"×",ellipsis:"...",pointerSmall:"»",line:"─",pointer:">"},AG=process.platform==="win32"?OG:h0;r4.exports=AG});var i4=V((hq,p4)=>{var q0=x(),p1=n$(),r$=Object.freeze({password:{scale:1,render:(f)=>"*".repeat(f.length)},emoji:{scale:2,render:(f)=>"\uD83D\uDE03".repeat(f.length)},invisible:{scale:0,render:(f)=>""},default:{scale:1,render:(f)=>`${f}`}}),LG=(f)=>r$[f]||r$.default,g0=Object.freeze({aborted:q0.red(p1.cross),done:q0.green(p1.tick),exited:q0.yellow(p1.cross),default:q0.cyan("?")}),PG=(f,$,M)=>$?g0.aborted:M?g0.exited:f?g0.done:g0.default,TG=(f)=>q0.gray(f?p1.ellipsis:p1.pointerSmall),wG=(f,$)=>q0.gray(f?$?p1.pointerSmall:"+":p1.line);p4.exports={styles:r$,render:LG,symbols:g0,symbol:PG,delimiter:TG,item:wG}});var s4=V((gq,o4)=>{var jG=Pf();o4.exports=function(f,$){let M=String(jG(f)||"").split(/\r?\n/);if(!$)return M.length;return M.map((Y)=>Math.ceil(Y.length/$)).reduce((Y,J)=>Y+J)}});var t4=V((cq,a4)=>{a4.exports=(f,$={})=>{let M=Number.isSafeInteger(parseInt($.margin))?Array(parseInt($.margin)).fill(" ").join(""):$.margin||"",Y=$.width;return(f||"").split(/\r?\n/g).map((J)=>J.split(/\s+/g).reduce((z,Z)=>{if(Z.length+M.length>=Y||z[z.length-1].length+Z.length+1<Y)z[z.length-1]+=` ${Z}`;else z.push(`${M}${Z}`);return z},[M]).join(`
|
|
75
75
|
`)).join(`
|
|
76
|
-
`)}});var f9=V((
|
|
76
|
+
`)}});var f9=V((mq,e4)=>{e4.exports=(f,$,M)=>{M=M||$;let Y=Math.min($-M,f-Math.floor(M/2));if(Y<0)Y=0;let J=Math.min(Y+M,$);return{startIndex:Y,endIndex:J}}});var z1=V((dq,$9)=>{$9.exports={action:u4(),clear:n4(),style:i4(),strip:Pf(),figures:n$(),lines:s4(),wrap:t4(),entriesToDisplay:f9()}});var R1=V((lq,z9)=>{var M9=o("readline"),IG=z1(),CG=IG.action,EG=o("events"),Y9=y(),xG=Y9.beep,yG=Y9.cursor,kG=x();class J9 extends EG{constructor(f={}){super();this.firstRender=!0,this.in=f.stdin||process.stdin,this.out=f.stdout||process.stdout,this.onRender=(f.onRender||(()=>{return})).bind(this);let $=M9.createInterface({input:this.in,escapeCodeTimeout:50});if(M9.emitKeypressEvents(this.in,$),this.in.isTTY)this.in.setRawMode(!0);let M=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,Y=(J,z)=>{let Z=CG(z,M);if(Z===!1)this._&&this._(J,z);else if(typeof this[Z]==="function")this[Z](z);else this.bell()};this.close=()=>{if(this.out.write(yG.show),this.in.removeListener("keypress",Y),this.in.isTTY)this.in.setRawMode(!1);$.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",Y)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(xG)}render(){if(this.onRender(kG),this.firstRender)this.firstRender=!1}}z9.exports=J9});var U9=V((nq,D9)=>{function Z9(f,$,M,Y,J,z,Z){try{var X=f[z](Z),Q=X.value}catch(G){M(G);return}if(X.done)$(Q);else Promise.resolve(Q).then(Y,J)}function X9(f){return function(){var $=this,M=arguments;return new Promise(function(Y,J){var z=f.apply($,M);function Z(Q){Z9(z,Y,J,Z,X,"next",Q)}function X(Q){Z9(z,Y,J,Z,X,"throw",Q)}Z(void 0)})}}var Tf=x(),bG=R1(),Q9=y(),_G=Q9.erase,c0=Q9.cursor,wf=z1(),p$=wf.style,i$=wf.clear,vG=wf.lines,uG=wf.figures;class G9 extends bG{constructor(f={}){super(f);this.transform=p$.render(f.style),this.scale=this.transform.scale,this.msg=f.message,this.initial=f.initial||"",this.validator=f.validate||(()=>!0),this.value="",this.errorMsg=f.error||"Please Enter A Valid Value",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.clear=i$("",this.out.columns),this.render()}set value(f){if(!f&&this.initial)this.placeholder=!0,this.rendered=Tf.gray(this.transform.render(this.initial));else this.placeholder=!1,this.rendered=this.transform.render(f);this._value=f,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
|
|
77
77
|
`),this.close()}validate(){var f=this;return X9(function*(){let $=yield f.validator(f.value);if(typeof $==="string")f.errorMsg=$,$=!1;f.error=!$})()}submit(){var f=this;return X9(function*(){if(f.value=f.value||f.initial,f.cursorOffset=0,f.cursor=f.rendered.length,yield f.validate(),f.error){f.red=!0,f.fire(),f.render();return}f.done=!0,f.aborted=!1,f.fire(),f.render(),f.out.write(`
|
|
78
|
-
`),f.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(f){if(this.placeholder)return;this.cursor=this.cursor+f,this.cursorOffset+=f}_(f,$){let M=this.value.slice(0,this.cursor),Y=this.value.slice(this.cursor);this.value=`${M}${f}${Y}`,this.red=!1,this.cursor=this.placeholder?0:M.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let f=this.value.slice(0,this.cursor-1),$=this.value.slice(this.cursor);if(this.value=`${f}${$}`,this.red=!1,this.isCursorAtStart())this.cursorOffset=0;else this.cursorOffset++,this.moveCursor(-1);this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let f=this.value.slice(0,this.cursor),$=this.value.slice(this.cursor+1);if(this.value=`${f}${$}`,this.red=!1,this.isCursorAtEnd())this.cursorOffset=0;else this.cursorOffset++;this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){if(this.closed)return;if(!this.firstRender){if(this.outputError)this.out.write(c0.down(vG(this.outputError,this.out.columns)-1)+
|
|
78
|
+
`),f.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(f){if(this.placeholder)return;this.cursor=this.cursor+f,this.cursorOffset+=f}_(f,$){let M=this.value.slice(0,this.cursor),Y=this.value.slice(this.cursor);this.value=`${M}${f}${Y}`,this.red=!1,this.cursor=this.placeholder?0:M.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let f=this.value.slice(0,this.cursor-1),$=this.value.slice(this.cursor);if(this.value=`${f}${$}`,this.red=!1,this.isCursorAtStart())this.cursorOffset=0;else this.cursorOffset++,this.moveCursor(-1);this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let f=this.value.slice(0,this.cursor),$=this.value.slice(this.cursor+1);if(this.value=`${f}${$}`,this.red=!1,this.isCursorAtEnd())this.cursorOffset=0;else this.cursorOffset++;this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){if(this.closed)return;if(!this.firstRender){if(this.outputError)this.out.write(c0.down(vG(this.outputError,this.out.columns)-1)+i$(this.outputError,this.out.columns));this.out.write(i$(this.outputText,this.out.columns))}if(super.render(),this.outputError="",this.outputText=[p$.symbol(this.done,this.aborted),Tf.bold(this.msg),p$.delimiter(this.done),this.red?Tf.red(this.rendered):this.rendered].join(" "),this.error)this.outputError+=this.errorMsg.split(`
|
|
79
79
|
`).reduce((f,$,M)=>f+`
|
|
80
|
-
${M?" ":uG.pointerSmall} ${Tf.red().italic($)}`,"");this.out.write(_G.line+c0.to(0)+this.outputText+c0.save+this.outputError+c0.restore+c0.move(this.cursorOffset,0))}}D9.exports=G9});var B9=V((
|
|
80
|
+
${M?" ":uG.pointerSmall} ${Tf.red().italic($)}`,"");this.out.write(_G.line+c0.to(0)+this.outputText+c0.save+this.outputError+c0.restore+c0.move(this.cursorOffset,0))}}D9.exports=G9});var B9=V((rq,q9)=>{var N1=x(),hG=R1(),m0=z1(),W9=m0.style,K9=m0.clear,jf=m0.figures,gG=m0.wrap,cG=m0.entriesToDisplay,mG=y(),dG=mG.cursor;class V9 extends hG{constructor(f={}){super(f);this.msg=f.message,this.hint=f.hint||"- Use arrow-keys. Return to submit.",this.warn=f.warn||"- This option is disabled",this.cursor=f.initial||0,this.choices=f.choices.map(($,M)=>{if(typeof $==="string")$={title:$,value:M};return{title:$&&($.title||$.value||$),value:$&&($.value===void 0?M:$.value),description:$&&$.description,selected:$&&$.selected,disabled:$&&$.disabled}}),this.optionsPerPage=f.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=K9("",this.out.columns),this.render()}moveCursor(f){this.cursor=f,this.value=this.choices[f].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
81
81
|
`),this.close()}submit(){if(!this.selection.disabled)this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
82
82
|
`),this.close();else this.bell()}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){if(this.cursor===0)this.moveCursor(this.choices.length-1);else this.moveCursor(this.cursor-1);this.render()}down(){if(this.cursor===this.choices.length-1)this.moveCursor(0);else this.moveCursor(this.cursor+1);this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(f,$){if(f===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;if(this.firstRender)this.out.write(dG.hide);else this.out.write(K9(this.outputText,this.out.columns));super.render();let f=cG(this.cursor,this.choices.length,this.optionsPerPage),$=f.startIndex,M=f.endIndex;if(this.outputText=[W9.symbol(this.done,this.aborted),N1.bold(this.msg),W9.delimiter(!1),this.done?this.selection.title:this.selection.disabled?N1.yellow(this.warn):N1.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
83
83
|
`;for(let Y=$;Y<M;Y++){let J,z,Z="",X=this.choices[Y];if(Y===$&&$>0)z=jf.arrowUp;else if(Y===M-1&&M<this.choices.length)z=jf.arrowDown;else z=" ";if(X.disabled)J=this.cursor===Y?N1.gray().underline(X.title):N1.strikethrough().gray(X.title),z=(this.cursor===Y?N1.bold().gray(jf.pointer)+" ":" ")+z;else if(J=this.cursor===Y?N1.cyan().underline(X.title):X.title,z=(this.cursor===Y?N1.cyan(jf.pointer)+" ":" ")+z,X.description&&this.cursor===Y){if(Z=` - ${X.description}`,z.length+J.length+Z.length>=this.out.columns||X.description.split(/\r?\n/).length>1)Z=`
|
|
84
84
|
`+gG(X.description,{margin:3,width:this.out.columns})}this.outputText+=`${z} ${J}${N1.gray(Z)}
|
|
85
|
-
`}}this.out.write(this.outputText)}}q9.exports=V9});var
|
|
85
|
+
`}}this.out.write(this.outputText)}}q9.exports=V9});var A9=V((pq,O9)=>{var If=x(),lG=R1(),F9=z1(),H9=F9.style,nG=F9.clear,R9=y(),S9=R9.cursor,rG=R9.erase;class N9 extends lG{constructor(f={}){super(f);this.msg=f.message,this.value=!!f.initial,this.active=f.active||"on",this.inactive=f.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
86
86
|
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
87
|
-
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(f,$){if(f===" ")this.value=!this.value;else if(f==="1")this.value=!0;else if(f==="0")this.value=!1;else return this.bell();this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(S9.hide);else this.out.write(nG(this.outputText,this.out.columns));super.render(),this.outputText=[H9.symbol(this.done,this.aborted),If.bold(this.msg),H9.delimiter(this.done),this.value?this.inactive:If.cyan().underline(this.inactive),If.gray("/"),this.value?If.cyan().underline(this.active):this.active].join(" "),this.out.write(rG.line+S9.to(0)+this.outputText)}}
|
|
87
|
+
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(f,$){if(f===" ")this.value=!this.value;else if(f==="1")this.value=!0;else if(f==="0")this.value=!1;else return this.bell();this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(S9.hide);else this.out.write(nG(this.outputText,this.out.columns));super.render(),this.outputText=[H9.symbol(this.done,this.aborted),If.bold(this.msg),H9.delimiter(this.done),this.value?this.inactive:If.cyan().underline(this.inactive),If.gray("/"),this.value?If.cyan().underline(this.active):this.active].join(" "),this.out.write(rG.line+S9.to(0)+this.outputText)}}O9.exports=N9});var U1=V((iq,L9)=>{class Cf{constructor({token:f,date:$,parts:M,locales:Y}){this.token=f,this.date=$||new Date,this.parts=M||[this],this.locales=Y||{}}up(){}down(){}next(){let f=this.parts.indexOf(this);return this.parts.find(($,M)=>M>f&&$ instanceof Cf)}setTo(f){}prev(){let f=[].concat(this.parts).reverse(),$=f.indexOf(this);return f.find((M,Y)=>Y>$&&M instanceof Cf)}toString(){return String(this.date)}}L9.exports=Cf});var w9=V((oq,T9)=>{var pG=U1();class P9 extends pG{constructor(f={}){super(f)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let f=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?f.toUpperCase():f}}T9.exports=P9});var C9=V((sq,I9)=>{var iG=U1(),oG=(f)=>{return f=f%10,f===1?"st":f===2?"nd":f===3?"rd":"th"};class j9 extends iG{constructor(f={}){super(f)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(f){this.date.setDate(parseInt(f.substr(-2)))}toString(){let f=this.date.getDate(),$=this.date.getDay();return this.token==="DD"?String(f).padStart(2,"0"):this.token==="Do"?f+oG(f):this.token==="d"?$+1:this.token==="ddd"?this.locales.weekdaysShort[$]:this.token==="dddd"?this.locales.weekdays[$]:f}}I9.exports=j9});var y9=V((aq,x9)=>{var sG=U1();class E9 extends sG{constructor(f={}){super(f)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(f){this.date.setHours(parseInt(f.substr(-2)))}toString(){let f=this.date.getHours();if(/h/.test(this.token))f=f%12||12;return this.token.length>1?String(f).padStart(2,"0"):f}}x9.exports=E9});var _9=V((tq,b9)=>{var aG=U1();class k9 extends aG{constructor(f={}){super(f)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(f){this.date.setMilliseconds(parseInt(f.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}b9.exports=k9});var h9=V((eq,u9)=>{var tG=U1();class v9 extends tG{constructor(f={}){super(f)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(f){this.date.setMinutes(parseInt(f.substr(-2)))}toString(){let f=this.date.getMinutes();return this.token.length>1?String(f).padStart(2,"0"):f}}u9.exports=v9});var m9=V((f3,c9)=>{var eG=U1();class g9 extends eG{constructor(f={}){super(f)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(f){f=parseInt(f.substr(-2))-1,this.date.setMonth(f<0?0:f)}toString(){let f=this.date.getMonth(),$=this.token.length;return $===2?String(f+1).padStart(2,"0"):$===3?this.locales.monthsShort[f]:$===4?this.locales.months[f]:String(f+1)}}c9.exports=g9});var n9=V(($3,l9)=>{var fD=U1();class d9 extends fD{constructor(f={}){super(f)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(f){this.date.setSeconds(parseInt(f.substr(-2)))}toString(){let f=this.date.getSeconds();return this.token.length>1?String(f).padStart(2,"0"):f}}l9.exports=d9});var i9=V((M3,p9)=>{var $D=U1();class r9 extends $D{constructor(f={}){super(f)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(f){this.date.setFullYear(f.substr(-4))}toString(){let f=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?f.substr(-2):f}}p9.exports=r9});var s9=V((Y3,o9)=>{o9.exports={DatePart:U1(),Meridiem:w9(),Day:C9(),Hours:y9(),Milliseconds:_9(),Minutes:h9(),Month:m9(),Seconds:n9(),Year:i9()}});var XJ=V((J3,ZJ)=>{function a9(f,$,M,Y,J,z,Z){try{var X=f[z](Z),Q=X.value}catch(G){M(G);return}if(X.done)$(Q);else Promise.resolve(Q).then(Y,J)}function t9(f){return function(){var $=this,M=arguments;return new Promise(function(Y,J){var z=f.apply($,M);function Z(Q){a9(z,Y,J,Z,X,"next",Q)}function X(Q){a9(z,Y,J,Z,X,"throw",Q)}Z(void 0)})}}var o$=x(),MD=R1(),s$=z1(),e9=s$.style,fJ=s$.clear,YD=s$.figures,JJ=y(),JD=JJ.erase,$J=JJ.cursor,O1=s9(),MJ=O1.DatePart,zD=O1.Meridiem,ZD=O1.Day,XD=O1.Hours,QD=O1.Milliseconds,GD=O1.Minutes,DD=O1.Month,UD=O1.Seconds,WD=O1.Year,KD=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,YJ={1:({token:f})=>f.replace(/\\(.)/g,"$1"),2:(f)=>new ZD(f),3:(f)=>new DD(f),4:(f)=>new WD(f),5:(f)=>new zD(f),6:(f)=>new XD(f),7:(f)=>new GD(f),8:(f)=>new UD(f),9:(f)=>new QD(f)},VD={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")};class zJ extends MD{constructor(f={}){super(f);this.msg=f.message,this.cursor=0,this.typed="",this.locales=Object.assign(VD,f.locales),this._date=f.initial||new Date,this.errorMsg=f.error||"Please Enter A Valid Value",this.validator=f.validate||(()=>!0),this.mask=f.mask||"YYYY-MM-DD HH:mm:ss",this.clear=fJ("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(f){if(f)this._date.setTime(f.getTime())}set mask(f){let $;this.parts=[];while($=KD.exec(f)){let Y=$.shift(),J=$.findIndex((z)=>z!=null);this.parts.push(J in YJ?YJ[J]({token:$[J]||Y,date:this.date,parts:this.parts,locales:this.locales}):$[J]||Y)}let M=this.parts.reduce((Y,J)=>{if(typeof J==="string"&&typeof Y[Y.length-1]==="string")Y[Y.length-1]+=J;else Y.push(J);return Y},[]);this.parts.splice(0),this.parts.push(...M),this.reset()}moveCursor(f){this.typed="",this.cursor=f,this.fire()}reset(){this.moveCursor(this.parts.findIndex((f)=>f instanceof MJ)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
88
88
|
`),this.close()}validate(){var f=this;return t9(function*(){let $=yield f.validator(f.value);if(typeof $==="string")f.errorMsg=$,$=!1;f.error=!$})()}submit(){var f=this;return t9(function*(){if(yield f.validate(),f.error){f.color="red",f.fire(),f.render();return}f.done=!0,f.aborted=!1,f.fire(),f.render(),f.out.write(`
|
|
89
|
-
`),f.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let f=this.parts[this.cursor].prev();if(f==null)return this.bell();this.moveCursor(this.parts.indexOf(f)),this.render()}right(){let f=this.parts[this.cursor].next();if(f==null)return this.bell();this.moveCursor(this.parts.indexOf(f)),this.render()}next(){let f=this.parts[this.cursor].next();this.moveCursor(f?this.parts.indexOf(f):this.parts.findIndex(($)=>$ instanceof MJ)),this.render()}_(f){if(/\d/.test(f))this.typed+=f,this.parts[this.cursor].setTo(this.typed),this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write($J.hide);else this.out.write(fJ(this.outputText,this.out.columns));if(super.render(),this.outputText=[e9.symbol(this.done,this.aborted),
|
|
89
|
+
`),f.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let f=this.parts[this.cursor].prev();if(f==null)return this.bell();this.moveCursor(this.parts.indexOf(f)),this.render()}right(){let f=this.parts[this.cursor].next();if(f==null)return this.bell();this.moveCursor(this.parts.indexOf(f)),this.render()}next(){let f=this.parts[this.cursor].next();this.moveCursor(f?this.parts.indexOf(f):this.parts.findIndex(($)=>$ instanceof MJ)),this.render()}_(f){if(/\d/.test(f))this.typed+=f,this.parts[this.cursor].setTo(this.typed),this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write($J.hide);else this.out.write(fJ(this.outputText,this.out.columns));if(super.render(),this.outputText=[e9.symbol(this.done,this.aborted),o$.bold(this.msg),e9.delimiter(!1),this.parts.reduce((f,$,M)=>f.concat(M===this.cursor&&!this.done?o$.cyan().underline($.toString()):$),[]).join("")].join(" "),this.error)this.outputText+=this.errorMsg.split(`
|
|
90
90
|
`).reduce((f,$,M)=>f+`
|
|
91
|
-
${M?" ":YD.pointerSmall} ${
|
|
91
|
+
${M?" ":YD.pointerSmall} ${o$.red().italic($)}`,"");this.out.write(JD.line+$J.to(0)+this.outputText)}}ZJ.exports=zJ});var qJ=V((z3,VJ)=>{function QJ(f,$,M,Y,J,z,Z){try{var X=f[z](Z),Q=X.value}catch(G){M(G);return}if(X.done)$(Q);else Promise.resolve(Q).then(Y,J)}function GJ(f){return function(){var $=this,M=arguments;return new Promise(function(Y,J){var z=f.apply($,M);function Z(Q){QJ(z,Y,J,Z,X,"next",Q)}function X(Q){QJ(z,Y,J,Z,X,"throw",Q)}Z(void 0)})}}var Ef=x(),qD=R1(),WJ=y(),xf=WJ.cursor,BD=WJ.erase,yf=z1(),a$=yf.style,HD=yf.figures,DJ=yf.clear,SD=yf.lines,FD=/[0-9]/,t$=(f)=>f!==void 0,UJ=(f,$)=>{let M=Math.pow(10,$);return Math.round(f*M)/M};class KJ extends qD{constructor(f={}){super(f);this.transform=a$.render(f.style),this.msg=f.message,this.initial=t$(f.initial)?f.initial:"",this.float=!!f.float,this.round=f.round||2,this.inc=f.increment||1,this.min=t$(f.min)?f.min:-1/0,this.max=t$(f.max)?f.max:1/0,this.errorMsg=f.error||"Please Enter A Valid Value",this.validator=f.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(f){if(!f&&f!==0)this.placeholder=!0,this.rendered=Ef.gray(this.transform.render(`${this.initial}`)),this._value="";else this.placeholder=!1,this.rendered=this.transform.render(`${UJ(f,this.round)}`),this._value=UJ(f,this.round);this.fire()}get value(){return this._value}parse(f){return this.float?parseFloat(f):parseInt(f)}valid(f){return f==="-"||f==="."&&this.float||FD.test(f)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let f=this.value;this.value=f!==""?f:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
92
92
|
`),this.close()}validate(){var f=this;return GJ(function*(){let $=yield f.validator(f.value);if(typeof $==="string")f.errorMsg=$,$=!1;f.error=!$})()}submit(){var f=this;return GJ(function*(){if(yield f.validate(),f.error){f.color="red",f.fire(),f.render();return}let $=f.value;f.value=$!==""?$:f.initial,f.done=!0,f.aborted=!1,f.error=!1,f.fire(),f.render(),f.out.write(`
|
|
93
|
-
`),f.close()})()}up(){if(this.typed="",this.value==="")this.value=this.min-this.inc;if(this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value==="")this.value=this.min+this.inc;if(this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let f=this.value.toString();if(f.length===0)return this.bell();if(this.value=this.parse(f=f.slice(0,-1))||"",this.value!==""&&this.value<this.min)this.value=this.min;this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(f,$){if(!this.valid(f))return this.bell();let M=Date.now();if(M-this.lastHit>1000)this.typed="";if(this.typed+=f,this.lastHit=M,this.color="cyan",f===".")return this.fire();if(this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max)this.value=this.max;if(this.value<this.min)this.value=this.min;this.fire(),this.render()}render(){if(this.closed)return;if(!this.firstRender){if(this.outputError)this.out.write(xf.down(SD(this.outputError,this.out.columns)-1)+DJ(this.outputError,this.out.columns));this.out.write(DJ(this.outputText,this.out.columns))}if(super.render(),this.outputError="",this.outputText=[
|
|
93
|
+
`),f.close()})()}up(){if(this.typed="",this.value==="")this.value=this.min-this.inc;if(this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value==="")this.value=this.min+this.inc;if(this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let f=this.value.toString();if(f.length===0)return this.bell();if(this.value=this.parse(f=f.slice(0,-1))||"",this.value!==""&&this.value<this.min)this.value=this.min;this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(f,$){if(!this.valid(f))return this.bell();let M=Date.now();if(M-this.lastHit>1000)this.typed="";if(this.typed+=f,this.lastHit=M,this.color="cyan",f===".")return this.fire();if(this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max)this.value=this.max;if(this.value<this.min)this.value=this.min;this.fire(),this.render()}render(){if(this.closed)return;if(!this.firstRender){if(this.outputError)this.out.write(xf.down(SD(this.outputError,this.out.columns)-1)+DJ(this.outputError,this.out.columns));this.out.write(DJ(this.outputText,this.out.columns))}if(super.render(),this.outputError="",this.outputText=[a$.symbol(this.done,this.aborted),Ef.bold(this.msg),a$.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Ef[this.color]().underline(this.rendered):this.rendered].join(" "),this.error)this.outputError+=this.errorMsg.split(`
|
|
94
94
|
`).reduce((f,$,M)=>f+`
|
|
95
|
-
${M?" ":HD.pointerSmall} ${Ef.red().italic($)}`,"");this.out.write(BD.line+xf.to(0)+this.outputText+xf.save+this.outputError+xf.restore)}}VJ.exports=KJ});var
|
|
95
|
+
${M?" ":HD.pointerSmall} ${Ef.red().italic($)}`,"");this.out.write(BD.line+xf.to(0)+this.outputText+xf.save+this.outputError+xf.restore)}}VJ.exports=KJ});var e$=V((Z3,FJ)=>{var W1=x(),RD=y(),ND=RD.cursor,OD=R1(),d0=z1(),BJ=d0.clear,E1=d0.figures,HJ=d0.style,AD=d0.wrap,LD=d0.entriesToDisplay;class SJ extends OD{constructor(f={}){super(f);if(this.msg=f.message,this.cursor=f.cursor||0,this.scrollIndex=f.cursor||0,this.hint=f.hint||"",this.warn=f.warn||"- This option is disabled -",this.minSelected=f.min,this.showMinError=!1,this.maxChoices=f.max,this.instructions=f.instructions,this.optionsPerPage=f.optionsPerPage||10,this.value=f.choices.map(($,M)=>{if(typeof $==="string")$={title:$,value:M};return{title:$&&($.title||$.value||$),description:$&&$.description,value:$&&($.value===void 0?M:$.value),selected:$&&$.selected,disabled:$&&$.disabled}}),this.clear=BJ("",this.out.columns),!f.overrideRender)this.render()}reset(){this.value.map((f)=>!f.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter((f)=>f.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
96
96
|
`),this.close()}submit(){let f=this.value.filter(($)=>$.selected);if(this.minSelected&&f.length<this.minSelected)this.showMinError=!0,this.render();else this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
97
97
|
`),this.close()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){if(this.cursor===0)this.cursor=this.value.length-1;else this.cursor--;this.render()}down(){if(this.cursor===this.value.length-1)this.cursor=0;else this.cursor++;this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter((f)=>f.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let f=this.value[this.cursor];if(f.selected)f.selected=!1,this.render();else if(f.disabled||this.value.filter(($)=>$.selected).length>=this.maxChoices)return this.bell();else f.selected=!0,this.render()}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let f=!this.value[this.cursor].selected;this.value.filter(($)=>!$.disabled).forEach(($)=>$.selected=f),this.render()}_(f,$){if(f===" ")this.handleSpaceToggle();else if(f==="a")this.toggleAll();else return this.bell()}renderInstructions(){if(this.instructions===void 0||this.instructions){if(typeof this.instructions==="string")return this.instructions;return`
|
|
98
98
|
Instructions:
|
|
@@ -100,47 +100,47 @@ Instructions:
|
|
|
100
100
|
${E1.arrowLeft}/${E1.arrowRight}/[space]: Toggle selection
|
|
101
101
|
`+(this.maxChoices===void 0?` a: Toggle all
|
|
102
102
|
`:"")+" enter/return: Complete answer"}return""}renderOption(f,$,M,Y){let J=($.selected?W1.green(E1.radioOn):E1.radioOff)+" "+Y+" ",z,Z;if($.disabled)z=f===M?W1.gray().underline($.title):W1.strikethrough().gray($.title);else if(z=f===M?W1.cyan().underline($.title):$.title,f===M&&$.description){if(Z=` - ${$.description}`,J.length+z.length+Z.length>=this.out.columns||$.description.split(/\r?\n/).length>1)Z=`
|
|
103
|
-
`+
|
|
103
|
+
`+AD($.description,{margin:J.length,width:this.out.columns})}return J+z+W1.gray(Z||"")}paginateOptions(f){if(f.length===0)return W1.red("No matches for this query.");let $=LD(this.cursor,f.length,this.optionsPerPage),M=$.startIndex,Y=$.endIndex,J,z=[];for(let Z=M;Z<Y;Z++){if(Z===M&&M>0)J=E1.arrowUp;else if(Z===Y-1&&Y<f.length)J=E1.arrowDown;else J=" ";z.push(this.renderOption(this.cursor,f[Z],Z,J))}return`
|
|
104
104
|
`+z.join(`
|
|
105
|
-
`)}renderOptions(f){if(!this.done)return this.paginateOptions(f);return""}renderDoneOrInstructions(){if(this.done)return this.value.filter(($)=>$.selected).map(($)=>$.title).join(", ");let f=[W1.gray(this.hint),this.renderInstructions()];if(this.value[this.cursor].disabled)f.push(W1.yellow(this.warn));return f.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(ND.hide);super.render();let f=[HJ.symbol(this.done,this.aborted),W1.bold(this.msg),HJ.delimiter(!1),this.renderDoneOrInstructions()].join(" ");if(this.showMinError)f+=W1.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1;f+=this.renderOptions(this.value),this.out.write(this.clear+f),this.clear=BJ(f,this.out.columns)}}FJ.exports=SJ});var wJ=V((
|
|
105
|
+
`)}renderOptions(f){if(!this.done)return this.paginateOptions(f);return""}renderDoneOrInstructions(){if(this.done)return this.value.filter(($)=>$.selected).map(($)=>$.title).join(", ");let f=[W1.gray(this.hint),this.renderInstructions()];if(this.value[this.cursor].disabled)f.push(W1.yellow(this.warn));return f.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(ND.hide);super.render();let f=[HJ.symbol(this.done,this.aborted),W1.bold(this.msg),HJ.delimiter(!1),this.renderDoneOrInstructions()].join(" ");if(this.showMinError)f+=W1.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1;f+=this.renderOptions(this.value),this.out.write(this.clear+f),this.clear=BJ(f,this.out.columns)}}FJ.exports=SJ});var wJ=V((X3,TJ)=>{function RJ(f,$,M,Y,J,z,Z){try{var X=f[z](Z),Q=X.value}catch(G){M(G);return}if(X.done)$(Q);else Promise.resolve(Q).then(Y,J)}function PD(f){return function(){var $=this,M=arguments;return new Promise(function(Y,J){var z=f.apply($,M);function Z(Q){RJ(z,Y,J,Z,X,"next",Q)}function X(Q){RJ(z,Y,J,Z,X,"throw",Q)}Z(void 0)})}}var l0=x(),TD=R1(),LJ=y(),wD=LJ.erase,NJ=LJ.cursor,n0=z1(),f2=n0.style,OJ=n0.clear,$2=n0.figures,jD=n0.wrap,ID=n0.entriesToDisplay,AJ=(f,$)=>f[$]&&(f[$].value||f[$].title||f[$]),CD=(f,$)=>f[$]&&(f[$].title||f[$].value||f[$]),ED=(f,$)=>{let M=f.findIndex((Y)=>Y.value===$||Y.title===$);return M>-1?M:void 0};class PJ extends TD{constructor(f={}){super(f);this.msg=f.message,this.suggest=f.suggest,this.choices=f.choices,this.initial=typeof f.initial==="number"?f.initial:ED(f.choices,f.initial),this.select=this.initial||f.cursor||0,this.i18n={noMatches:f.noMatches||"no matches found"},this.fallback=f.fallback||this.initial,this.clearFirst=f.clearFirst||!1,this.suggestions=[],this.input="",this.limit=f.limit||10,this.cursor=0,this.transform=f2.render(f.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=OJ("",this.out.columns),this.complete(this.render),this.render()}set fallback(f){this._fb=Number.isSafeInteger(parseInt(f))?parseInt(f):f}get fallback(){let f;if(typeof this._fb==="number")f=this.choices[this._fb];else if(typeof this._fb==="string")f={title:this._fb};return f||this._fb||{title:this.i18n.noMatches}}moveSelect(f){if(this.select=f,this.suggestions.length>0)this.value=AJ(this.suggestions,f);else this.value=this.fallback.value;this.fire()}complete(f){var $=this;return PD(function*(){let M=$.completing=$.suggest($.input,$.choices),Y=yield M;if($.completing!==M)return;$.suggestions=Y.map((z,Z,X)=>({title:CD(X,Z),value:AJ(X,Z),description:z.description})),$.completing=!1;let J=Math.max(Y.length-1,0);$.moveSelect(Math.min(J,$.select)),f&&f()})()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){if(this.clearFirst&&this.input.length>0)this.reset();else this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
106
106
|
`),this.close()}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
107
107
|
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
108
|
-
`),this.close()}_(f,$){let M=this.input.slice(0,this.cursor),Y=this.input.slice(this.cursor);this.input=`${M}${f}${Y}`,this.cursor=M.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let f=this.input.slice(0,this.cursor-1),$=this.input.slice(this.cursor);this.input=`${f}${$}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let f=this.input.slice(0,this.cursor),$=this.input.slice(this.cursor+1);this.input=`${f}${$}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){if(this.select===0)this.moveSelect(this.suggestions.length-1);else this.moveSelect(this.select-1);this.render()}down(){if(this.select===this.suggestions.length-1)this.moveSelect(0);else this.moveSelect(this.select+1);this.render()}next(){if(this.select===this.suggestions.length-1)this.moveSelect(0);else this.moveSelect(this.select+1);this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(f,$,M,Y){let J,z=M
|
|
109
|
-
`+jD(f.description,{margin:3,width:this.out.columns})}return z+" "+Z+l0.gray(J||"")}render(){if(this.closed)return;if(this.firstRender)this.out.write(NJ.hide);else this.out.write(
|
|
108
|
+
`),this.close()}_(f,$){let M=this.input.slice(0,this.cursor),Y=this.input.slice(this.cursor);this.input=`${M}${f}${Y}`,this.cursor=M.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let f=this.input.slice(0,this.cursor-1),$=this.input.slice(this.cursor);this.input=`${f}${$}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let f=this.input.slice(0,this.cursor),$=this.input.slice(this.cursor+1);this.input=`${f}${$}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){if(this.select===0)this.moveSelect(this.suggestions.length-1);else this.moveSelect(this.select-1);this.render()}down(){if(this.select===this.suggestions.length-1)this.moveSelect(0);else this.moveSelect(this.select+1);this.render()}next(){if(this.select===this.suggestions.length-1)this.moveSelect(0);else this.moveSelect(this.select+1);this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(f,$,M,Y){let J,z=M?$2.arrowUp:Y?$2.arrowDown:" ",Z=$?l0.cyan().underline(f.title):f.title;if(z=($?l0.cyan($2.pointer)+" ":" ")+z,f.description){if(J=` - ${f.description}`,z.length+Z.length+J.length>=this.out.columns||f.description.split(/\r?\n/).length>1)J=`
|
|
109
|
+
`+jD(f.description,{margin:3,width:this.out.columns})}return z+" "+Z+l0.gray(J||"")}render(){if(this.closed)return;if(this.firstRender)this.out.write(NJ.hide);else this.out.write(OJ(this.outputText,this.out.columns));super.render();let f=ID(this.select,this.choices.length,this.limit),$=f.startIndex,M=f.endIndex;if(this.outputText=[f2.symbol(this.done,this.aborted,this.exited),l0.bold(this.msg),f2.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let Y=this.suggestions.slice($,M).map((J,z)=>this.renderOption(J,this.select===z+$,z===0&&$>0,z+$===M-1&&M<this.choices.length)).join(`
|
|
110
110
|
`);this.outputText+=`
|
|
111
|
-
`+(Y||l0.gray(this.fallback.title))}this.out.write(wD.line+NJ.to(0)+this.outputText)}}TJ.exports=PJ});var xJ=V((
|
|
111
|
+
`+(Y||l0.gray(this.fallback.title))}this.out.write(wD.line+NJ.to(0)+this.outputText)}}TJ.exports=PJ});var xJ=V((Q3,EJ)=>{var A1=x(),xD=y(),yD=xD.cursor,kD=e$(),M2=z1(),jJ=M2.clear,IJ=M2.style,B0=M2.figures;class CJ extends kD{constructor(f={}){f.overrideRender=!0;super(f);this.inputValue="",this.clear=jJ("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){if(this.cursor===0)this.cursor=this.filteredOptions.length-1;else this.cursor--;this.render()}down(){if(this.cursor===this.filteredOptions.length-1)this.cursor=0;else this.cursor++;this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter((f)=>f.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){if(this.inputValue.length)this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions()}updateFilteredOptions(){let f=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter((M)=>{if(this.inputValue){if(typeof M.title==="string"){if(M.title.toLowerCase().includes(this.inputValue.toLowerCase()))return!0}if(typeof M.value==="string"){if(M.value.toLowerCase().includes(this.inputValue.toLowerCase()))return!0}return!1}return!0});let $=this.filteredOptions.findIndex((M)=>M===f);this.cursor=$<0?0:$,this.render()}handleSpaceToggle(){let f=this.filteredOptions[this.cursor];if(f.selected)f.selected=!1,this.render();else if(f.disabled||this.value.filter(($)=>$.selected).length>=this.maxChoices)return this.bell();else f.selected=!0,this.render()}handleInputChange(f){this.inputValue=this.inputValue+f,this.updateFilteredOptions()}_(f,$){if(f===" ")this.handleSpaceToggle();else this.handleInputChange(f)}renderInstructions(){if(this.instructions===void 0||this.instructions){if(typeof this.instructions==="string")return this.instructions;return`
|
|
112
112
|
Instructions:
|
|
113
113
|
${B0.arrowUp}/${B0.arrowDown}: Highlight option
|
|
114
114
|
${B0.arrowLeft}/${B0.arrowRight}/[space]: Toggle selection
|
|
115
115
|
[a,b,c]/delete: Filter choices
|
|
116
116
|
enter/return: Complete answer
|
|
117
117
|
`}return""}renderCurrentInput(){return`
|
|
118
|
-
Filtered results for: ${this.inputValue?this.inputValue:
|
|
119
|
-
`}renderOption(f,$,M){let Y;if($.disabled)Y=f===M?
|
|
118
|
+
Filtered results for: ${this.inputValue?this.inputValue:A1.gray("Enter something to filter")}
|
|
119
|
+
`}renderOption(f,$,M){let Y;if($.disabled)Y=f===M?A1.gray().underline($.title):A1.strikethrough().gray($.title);else Y=f===M?A1.cyan().underline($.title):$.title;return($.selected?A1.green(B0.radioOn):B0.radioOff)+" "+Y}renderDoneOrInstructions(){if(this.done)return this.value.filter(($)=>$.selected).map(($)=>$.title).join(", ");let f=[A1.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];if(this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled)f.push(A1.yellow(this.warn));return f.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(yD.hide);super.render();let f=[IJ.symbol(this.done,this.aborted),A1.bold(this.msg),IJ.delimiter(!1),this.renderDoneOrInstructions()].join(" ");if(this.showMinError)f+=A1.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1;f+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+f),this.clear=jJ(f,this.out.columns)}}EJ.exports=CJ});var gJ=V((G3,hJ)=>{var yJ=x(),bD=R1(),_J=z1(),kJ=_J.style,_D=_J.clear,vJ=y(),vD=vJ.erase,bJ=vJ.cursor;class uJ extends bD{constructor(f={}){super(f);this.msg=f.message,this.value=f.initial,this.initialValue=!!f.initial,this.yesMsg=f.yes||"yes",this.yesOption=f.yesOption||"(Y/n)",this.noMsg=f.no||"no",this.noOption=f.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
120
120
|
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
121
|
-
`),this.close()}_(f,$){if(f.toLowerCase()==="y")return this.value=!0,this.submit();if(f.toLowerCase()==="n")return this.value=!1,this.submit();return this.bell()}render(){if(this.closed)return;if(this.firstRender)this.out.write(bJ.hide);else this.out.write(_D(this.outputText,this.out.columns));super.render(),this.outputText=[kJ.symbol(this.done,this.aborted),yJ.bold(this.msg),kJ.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:yJ.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(vD.line+bJ.to(0)+this.outputText)}}hJ.exports=uJ});var mJ=V((
|
|
122
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var z=!0,Z=!1,X;return{s:function(){M=M.call(f)},n:function(){var G=M.next();return z=G.done,G},e:function(G){Z=!0,X=G},f:function(){try{if(!z&&M.return!=null)M.return()}finally{if(Z)throw X}}}}function mD(f,$){if(!f)return;if(typeof f==="string")return pJ(f,$);var M=Object.prototype.toString.call(f).slice(8,-1);if(M==="Object"&&f.constructor)M=f.constructor.name;if(M==="Map"||M==="Set")return Array.from(f);if(M==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(M))return pJ(f,$)}function pJ(f,$){if($==null||$>f.length)$=f.length;for(var M=0,Y=Array($);M<$;M++)Y[M]=f[M];return Y}function iJ(f,$,M,Y,J,z,Z){try{var X=f[z](Z),Q=X.value}catch(G){M(G);return}if(X.done)$(Q);else Promise.resolve(Q).then(Y,J)}function oJ(f){return function(){var $=this,M=arguments;return new Promise(function(Y,J){var z=f.apply($,M);function Z(Q){iJ(z,Y,J,Z,X,"next",Q)}function X(Q){iJ(z,Y,J,Z,X,"throw",Q)}Z(void 0)})}}var
|
|
121
|
+
`),this.close()}_(f,$){if(f.toLowerCase()==="y")return this.value=!0,this.submit();if(f.toLowerCase()==="n")return this.value=!1,this.submit();return this.bell()}render(){if(this.closed)return;if(this.firstRender)this.out.write(bJ.hide);else this.out.write(_D(this.outputText,this.out.columns));super.render(),this.outputText=[kJ.symbol(this.done,this.aborted),yJ.bold(this.msg),kJ.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:yJ.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(vD.line+bJ.to(0)+this.outputText)}}hJ.exports=uJ});var mJ=V((D3,cJ)=>{cJ.exports={TextPrompt:U9(),SelectPrompt:B9(),TogglePrompt:A9(),DatePrompt:XJ(),NumberPrompt:qJ(),MultiselectPrompt:e$(),AutocompletePrompt:wJ(),AutocompleteMultiselectPrompt:xJ(),ConfirmPrompt:gJ()}});var lJ=V((dJ)=>{var a=dJ,uD=mJ(),kf=(f)=>f;function K1(f,$,M={}){return new Promise((Y,J)=>{let z=new uD[f]($),Z=M.onAbort||kf,X=M.onSubmit||kf,Q=M.onExit||kf;z.on("state",$.onState||kf),z.on("submit",(G)=>Y(X(G))),z.on("exit",(G)=>Y(Q(G))),z.on("abort",(G)=>J(Z(G)))})}a.text=(f)=>K1("TextPrompt",f);a.password=(f)=>{return f.style="password",a.text(f)};a.invisible=(f)=>{return f.style="invisible",a.text(f)};a.number=(f)=>K1("NumberPrompt",f);a.date=(f)=>K1("DatePrompt",f);a.confirm=(f)=>K1("ConfirmPrompt",f);a.list=(f)=>{let $=f.separator||",";return K1("TextPrompt",f,{onSubmit:(M)=>M.split($).map((Y)=>Y.trim())})};a.toggle=(f)=>K1("TogglePrompt",f);a.select=(f)=>K1("SelectPrompt",f);a.multiselect=(f)=>{f.choices=[].concat(f.choices||[]);let $=(M)=>M.filter((Y)=>Y.selected).map((Y)=>Y.value);return K1("MultiselectPrompt",f,{onAbort:$,onSubmit:$})};a.autocompleteMultiselect=(f)=>{f.choices=[].concat(f.choices||[]);let $=(M)=>M.filter((Y)=>Y.selected).map((Y)=>Y.value);return K1("AutocompleteMultiselectPrompt",f,{onAbort:$,onSubmit:$})};var hD=(f,$)=>Promise.resolve($.filter((M)=>M.title.slice(0,f.length).toLowerCase()===f.toLowerCase()));a.autocomplete=(f)=>{return f.suggest=f.suggest||hD,f.choices=[].concat(f.choices||[]),K1("AutocompletePrompt",f)}});var tJ=V((W3,aJ)=>{function nJ(f,$){var M=Object.keys(f);if(Object.getOwnPropertySymbols){var Y=Object.getOwnPropertySymbols(f);if($)Y=Y.filter(function(J){return Object.getOwnPropertyDescriptor(f,J).enumerable});M.push.apply(M,Y)}return M}function rJ(f){for(var $=1;$<arguments.length;$++){var M=arguments[$]!=null?arguments[$]:{};if($%2)nJ(Object(M),!0).forEach(function(Y){gD(f,Y,M[Y])});else if(Object.getOwnPropertyDescriptors)Object.defineProperties(f,Object.getOwnPropertyDescriptors(M));else nJ(Object(M)).forEach(function(Y){Object.defineProperty(f,Y,Object.getOwnPropertyDescriptor(M,Y))})}return f}function gD(f,$,M){if($ in f)Object.defineProperty(f,$,{value:M,enumerable:!0,configurable:!0,writable:!0});else f[$]=M;return f}function cD(f,$){var M=typeof Symbol<"u"&&f[Symbol.iterator]||f["@@iterator"];if(!M){if(Array.isArray(f)||(M=mD(f))||$&&f&&typeof f.length==="number"){if(M)f=M;var Y=0,J=function(){};return{s:J,n:function(){if(Y>=f.length)return{done:!0};return{done:!1,value:f[Y++]}},e:function(G){throw G},f:J}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
122
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var z=!0,Z=!1,X;return{s:function(){M=M.call(f)},n:function(){var G=M.next();return z=G.done,G},e:function(G){Z=!0,X=G},f:function(){try{if(!z&&M.return!=null)M.return()}finally{if(Z)throw X}}}}function mD(f,$){if(!f)return;if(typeof f==="string")return pJ(f,$);var M=Object.prototype.toString.call(f).slice(8,-1);if(M==="Object"&&f.constructor)M=f.constructor.name;if(M==="Map"||M==="Set")return Array.from(f);if(M==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(M))return pJ(f,$)}function pJ(f,$){if($==null||$>f.length)$=f.length;for(var M=0,Y=Array($);M<$;M++)Y[M]=f[M];return Y}function iJ(f,$,M,Y,J,z,Z){try{var X=f[z](Z),Q=X.value}catch(G){M(G);return}if(X.done)$(Q);else Promise.resolve(Q).then(Y,J)}function oJ(f){return function(){var $=this,M=arguments;return new Promise(function(Y,J){var z=f.apply($,M);function Z(Q){iJ(z,Y,J,Z,X,"next",Q)}function X(Q){iJ(z,Y,J,Z,X,"throw",Q)}Z(void 0)})}}var Y2=lJ(),dD=["suggest","format","onState","validate","onRender","type"],sJ=()=>{};function x1(){return J2.apply(this,arguments)}function J2(){return J2=oJ(function*(f=[],{onSubmit:$=sJ,onCancel:M=sJ}={}){let Y={},J=x1._override||{};f=[].concat(f);let z,Z,X,Q,G,D,U=function(){var F=oJ(function*(T,c,r=!1){if(!r&&T.validate&&T.validate(c)!==!0)return;return T.format?yield T.format(c,Y):c});return function(c,r){return F.apply(this,arguments)}}();var K=cD(f),W;try{for(K.s();!(W=K.n()).done;){Z=W.value;var B=Z;if(Q=B.name,G=B.type,typeof G==="function")G=yield G(z,rJ({},Y),Z),Z.type=G;if(!G)continue;for(let F in Z){if(dD.includes(F))continue;let T=Z[F];Z[F]=typeof T==="function"?yield T(z,rJ({},Y),D):T}if(D=Z,typeof Z.message!=="string")throw Error("prompt message is required");var O=Z;if(Q=O.name,G=O.type,Y2[G]===void 0)throw Error(`prompt type (${G}) is not defined`);if(J[Z.name]!==void 0){if(z=yield U(Z,J[Z.name]),z!==void 0){Y[Q]=z;continue}}try{z=x1._injected?lD(x1._injected,Z.initial):yield Y2[G](Z),Y[Q]=z=yield U(Z,z,!0),X=yield $(Z,z,Y)}catch(F){X=!(yield M(Z,Y))}if(X)return Y}}catch(F){K.e(F)}finally{K.f()}return Y}),J2.apply(this,arguments)}function lD(f,$){let M=f.shift();if(M instanceof Error)throw M;return M===void 0?$:M}function nD(f){x1._injected=(x1._injected||[]).concat(f)}function rD(f){x1._override=Object.assign({},f)}aJ.exports=Object.assign(x1,{prompt:x1,prompts:Y2,inject:nD,override:rD})});var f5=V((K3,eJ)=>{eJ.exports=(f,$)=>{if(f.meta&&f.name!=="escape")return;if(f.ctrl){if(f.name==="a")return"first";if(f.name==="c")return"abort";if(f.name==="d")return"abort";if(f.name==="e")return"last";if(f.name==="g")return"reset"}if($){if(f.name==="j")return"down";if(f.name==="k")return"up"}if(f.name==="return")return"submit";if(f.name==="enter")return"submit";if(f.name==="backspace")return"delete";if(f.name==="delete")return"deleteForward";if(f.name==="abort")return"abort";if(f.name==="escape")return"exit";if(f.name==="tab")return"next";if(f.name==="pagedown")return"nextPage";if(f.name==="pageup")return"prevPage";if(f.name==="home")return"home";if(f.name==="end")return"end";if(f.name==="up")return"up";if(f.name==="down")return"down";if(f.name==="right")return"right";if(f.name==="left")return"left";return!1}});var bf=V((V3,$5)=>{$5.exports=(f)=>{let $=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),M=new RegExp($,"g");return typeof f==="string"?f.replace(M,""):f}});var J5=V((q3,Y5)=>{var pD=bf(),{erase:M5,cursor:iD}=y(),oD=(f)=>[...pD(f)].length;Y5.exports=function(f,$){if(!$)return M5.line+iD.to(0);let M=0,Y=f.split(/\r?\n/);for(let J of Y)M+=1+Math.floor(Math.max(oD(J)-1,0)/$);return M5.lines(M)}});var z2=V((B3,z5)=>{var r0={arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",radioOn:"◉",radioOff:"◯",tick:"✔",cross:"✖",ellipsis:"…",pointerSmall:"›",line:"─",pointer:"❯"},sD={arrowUp:r0.arrowUp,arrowDown:r0.arrowDown,arrowLeft:r0.arrowLeft,arrowRight:r0.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"√",cross:"×",ellipsis:"...",pointerSmall:"»",line:"─",pointer:">"},aD=process.platform==="win32"?sD:r0;z5.exports=aD});var X5=V((H3,Z5)=>{var H0=x(),i1=z2(),Z2=Object.freeze({password:{scale:1,render:(f)=>"*".repeat(f.length)},emoji:{scale:2,render:(f)=>"\uD83D\uDE03".repeat(f.length)},invisible:{scale:0,render:(f)=>""},default:{scale:1,render:(f)=>`${f}`}}),tD=(f)=>Z2[f]||Z2.default,p0=Object.freeze({aborted:H0.red(i1.cross),done:H0.green(i1.tick),exited:H0.yellow(i1.cross),default:H0.cyan("?")}),eD=(f,$,M)=>$?p0.aborted:M?p0.exited:f?p0.done:p0.default,fU=(f)=>H0.gray(f?i1.ellipsis:i1.pointerSmall),$U=(f,$)=>H0.gray(f?$?i1.pointerSmall:"+":i1.line);Z5.exports={styles:Z2,render:tD,symbols:p0,symbol:eD,delimiter:fU,item:$U}});var G5=V((S3,Q5)=>{var MU=bf();Q5.exports=function(f,$){let M=String(MU(f)||"").split(/\r?\n/);if(!$)return M.length;return M.map((Y)=>Math.ceil(Y.length/$)).reduce((Y,J)=>Y+J)}});var U5=V((F3,D5)=>{D5.exports=(f,$={})=>{let M=Number.isSafeInteger(parseInt($.margin))?Array(parseInt($.margin)).fill(" ").join(""):$.margin||"",Y=$.width;return(f||"").split(/\r?\n/g).map((J)=>J.split(/\s+/g).reduce((z,Z)=>{if(Z.length+M.length>=Y||z[z.length-1].length+Z.length+1<Y)z[z.length-1]+=` ${Z}`;else z.push(`${M}${Z}`);return z},[M]).join(`
|
|
123
123
|
`)).join(`
|
|
124
|
-
`)}});var K5=V((
|
|
124
|
+
`)}});var K5=V((R3,W5)=>{W5.exports=(f,$,M)=>{M=M||$;let Y=Math.min($-M,f-Math.floor(M/2));if(Y<0)Y=0;let J=Math.min(Y+M,$);return{startIndex:Y,endIndex:J}}});var Z1=V((N3,V5)=>{V5.exports={action:f5(),clear:J5(),style:X5(),strip:bf(),figures:z2(),lines:G5(),wrap:U5(),entriesToDisplay:K5()}});var L1=V((O3,H5)=>{var q5=o("readline"),{action:YU}=Z1(),JU=o("events"),{beep:zU,cursor:ZU}=y(),XU=x();class B5 extends JU{constructor(f={}){super();this.firstRender=!0,this.in=f.stdin||process.stdin,this.out=f.stdout||process.stdout,this.onRender=(f.onRender||(()=>{return})).bind(this);let $=q5.createInterface({input:this.in,escapeCodeTimeout:50});if(q5.emitKeypressEvents(this.in,$),this.in.isTTY)this.in.setRawMode(!0);let M=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,Y=(J,z)=>{let Z=YU(z,M);if(Z===!1)this._&&this._(J,z);else if(typeof this[Z]==="function")this[Z](z);else this.bell()};this.close=()=>{if(this.out.write(ZU.show),this.in.removeListener("keypress",Y),this.in.isTTY)this.in.setRawMode(!1);$.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",Y)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(zU)}render(){if(this.onRender(XU),this.firstRender)this.firstRender=!1}}H5.exports=B5});var R5=V((A3,F5)=>{var _f=x(),QU=L1(),{erase:GU,cursor:i0}=y(),{style:X2,clear:Q2,lines:DU,figures:UU}=Z1();class S5 extends QU{constructor(f={}){super(f);this.transform=X2.render(f.style),this.scale=this.transform.scale,this.msg=f.message,this.initial=f.initial||"",this.validator=f.validate||(()=>!0),this.value="",this.errorMsg=f.error||"Please Enter A Valid Value",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.clear=Q2("",this.out.columns),this.render()}set value(f){if(!f&&this.initial)this.placeholder=!0,this.rendered=_f.gray(this.transform.render(this.initial));else this.placeholder=!1,this.rendered=this.transform.render(f);this._value=f,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
|
|
125
125
|
`),this.close()}async validate(){let f=await this.validator(this.value);if(typeof f==="string")this.errorMsg=f,f=!1;this.error=!f}async submit(){if(this.value=this.value||this.initial,this.cursorOffset=0,this.cursor=this.rendered.length,await this.validate(),this.error){this.red=!0,this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
126
|
-
`),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(f){if(this.placeholder)return;this.cursor=this.cursor+f,this.cursorOffset+=f}_(f,$){let M=this.value.slice(0,this.cursor),Y=this.value.slice(this.cursor);this.value=`${M}${f}${Y}`,this.red=!1,this.cursor=this.placeholder?0:M.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let f=this.value.slice(0,this.cursor-1),$=this.value.slice(this.cursor);if(this.value=`${f}${$}`,this.red=!1,this.isCursorAtStart())this.cursorOffset=0;else this.cursorOffset++,this.moveCursor(-1);this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let f=this.value.slice(0,this.cursor),$=this.value.slice(this.cursor+1);if(this.value=`${f}${$}`,this.red=!1,this.isCursorAtEnd())this.cursorOffset=0;else this.cursorOffset++;this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){if(this.closed)return;if(!this.firstRender){if(this.outputError)this.out.write(i0.down(DU(this.outputError,this.out.columns)-1)+
|
|
126
|
+
`),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(f){if(this.placeholder)return;this.cursor=this.cursor+f,this.cursorOffset+=f}_(f,$){let M=this.value.slice(0,this.cursor),Y=this.value.slice(this.cursor);this.value=`${M}${f}${Y}`,this.red=!1,this.cursor=this.placeholder?0:M.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let f=this.value.slice(0,this.cursor-1),$=this.value.slice(this.cursor);if(this.value=`${f}${$}`,this.red=!1,this.isCursorAtStart())this.cursorOffset=0;else this.cursorOffset++,this.moveCursor(-1);this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let f=this.value.slice(0,this.cursor),$=this.value.slice(this.cursor+1);if(this.value=`${f}${$}`,this.red=!1,this.isCursorAtEnd())this.cursorOffset=0;else this.cursorOffset++;this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){if(this.closed)return;if(!this.firstRender){if(this.outputError)this.out.write(i0.down(DU(this.outputError,this.out.columns)-1)+Q2(this.outputError,this.out.columns));this.out.write(Q2(this.outputText,this.out.columns))}if(super.render(),this.outputError="",this.outputText=[X2.symbol(this.done,this.aborted),_f.bold(this.msg),X2.delimiter(this.done),this.red?_f.red(this.rendered):this.rendered].join(" "),this.error)this.outputError+=this.errorMsg.split(`
|
|
127
127
|
`).reduce((f,$,M)=>f+`
|
|
128
|
-
${M?" ":UU.pointerSmall} ${_f.red().italic($)}`,"");this.out.write(GU.line+i0.to(0)+this.outputText+i0.save+this.outputError+i0.restore+i0.move(this.cursorOffset,0))}}F5.exports=S5});var P5=V((
|
|
128
|
+
${M?" ":UU.pointerSmall} ${_f.red().italic($)}`,"");this.out.write(GU.line+i0.to(0)+this.outputText+i0.save+this.outputError+i0.restore+i0.move(this.cursorOffset,0))}}F5.exports=S5});var P5=V((L3,L5)=>{var P1=x(),WU=L1(),{style:N5,clear:O5,figures:vf,wrap:KU,entriesToDisplay:VU}=Z1(),{cursor:qU}=y();class A5 extends WU{constructor(f={}){super(f);this.msg=f.message,this.hint=f.hint||"- Use arrow-keys. Return to submit.",this.warn=f.warn||"- This option is disabled",this.cursor=f.initial||0,this.choices=f.choices.map(($,M)=>{if(typeof $==="string")$={title:$,value:M};return{title:$&&($.title||$.value||$),value:$&&($.value===void 0?M:$.value),description:$&&$.description,selected:$&&$.selected,disabled:$&&$.disabled}}),this.optionsPerPage=f.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=O5("",this.out.columns),this.render()}moveCursor(f){this.cursor=f,this.value=this.choices[f].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
129
129
|
`),this.close()}submit(){if(!this.selection.disabled)this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
130
|
-
`),this.close();else this.bell()}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){if(this.cursor===0)this.moveCursor(this.choices.length-1);else this.moveCursor(this.cursor-1);this.render()}down(){if(this.cursor===this.choices.length-1)this.moveCursor(0);else this.moveCursor(this.cursor+1);this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(f,$){if(f===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;if(this.firstRender)this.out.write(qU.hide);else this.out.write(
|
|
130
|
+
`),this.close();else this.bell()}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){if(this.cursor===0)this.moveCursor(this.choices.length-1);else this.moveCursor(this.cursor-1);this.render()}down(){if(this.cursor===this.choices.length-1)this.moveCursor(0);else this.moveCursor(this.cursor+1);this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(f,$){if(f===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;if(this.firstRender)this.out.write(qU.hide);else this.out.write(O5(this.outputText,this.out.columns));super.render();let{startIndex:f,endIndex:$}=VU(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[N5.symbol(this.done,this.aborted),P1.bold(this.msg),N5.delimiter(!1),this.done?this.selection.title:this.selection.disabled?P1.yellow(this.warn):P1.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
131
131
|
`;for(let M=f;M<$;M++){let Y,J,z="",Z=this.choices[M];if(M===f&&f>0)J=vf.arrowUp;else if(M===$-1&&$<this.choices.length)J=vf.arrowDown;else J=" ";if(Z.disabled)Y=this.cursor===M?P1.gray().underline(Z.title):P1.strikethrough().gray(Z.title),J=(this.cursor===M?P1.bold().gray(vf.pointer)+" ":" ")+J;else if(Y=this.cursor===M?P1.cyan().underline(Z.title):Z.title,J=(this.cursor===M?P1.cyan(vf.pointer)+" ":" ")+J,Z.description&&this.cursor===M){if(z=` - ${Z.description}`,J.length+Y.length+z.length>=this.out.columns||Z.description.split(/\r?\n/).length>1)z=`
|
|
132
132
|
`+KU(Z.description,{margin:3,width:this.out.columns})}this.outputText+=`${J} ${Y}${P1.gray(z)}
|
|
133
|
-
`}}this.out.write(this.outputText)}}L5.exports=
|
|
133
|
+
`}}this.out.write(this.outputText)}}L5.exports=A5});var C5=V((P3,I5)=>{var uf=x(),BU=L1(),{style:T5,clear:HU}=Z1(),{cursor:w5,erase:SU}=y();class j5 extends BU{constructor(f={}){super(f);this.msg=f.message,this.value=!!f.initial,this.active=f.active||"on",this.inactive=f.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
134
134
|
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
135
|
-
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(f,$){if(f===" ")this.value=!this.value;else if(f==="1")this.value=!0;else if(f==="0")this.value=!1;else return this.bell();this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(w5.hide);else this.out.write(HU(this.outputText,this.out.columns));super.render(),this.outputText=[T5.symbol(this.done,this.aborted),uf.bold(this.msg),T5.delimiter(this.done),this.value?this.inactive:uf.cyan().underline(this.inactive),uf.gray("/"),this.value?uf.cyan().underline(this.active):this.active].join(" "),this.out.write(SU.line+w5.to(0)+this.outputText)}}I5.exports=j5});var V1=V((
|
|
135
|
+
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(f,$){if(f===" ")this.value=!this.value;else if(f==="1")this.value=!0;else if(f==="0")this.value=!1;else return this.bell();this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(w5.hide);else this.out.write(HU(this.outputText,this.out.columns));super.render(),this.outputText=[T5.symbol(this.done,this.aborted),uf.bold(this.msg),T5.delimiter(this.done),this.value?this.inactive:uf.cyan().underline(this.inactive),uf.gray("/"),this.value?uf.cyan().underline(this.active):this.active].join(" "),this.out.write(SU.line+w5.to(0)+this.outputText)}}I5.exports=j5});var V1=V((T3,E5)=>{class hf{constructor({token:f,date:$,parts:M,locales:Y}){this.token=f,this.date=$||new Date,this.parts=M||[this],this.locales=Y||{}}up(){}down(){}next(){let f=this.parts.indexOf(this);return this.parts.find(($,M)=>M>f&&$ instanceof hf)}setTo(f){}prev(){let f=[].concat(this.parts).reverse(),$=f.indexOf(this);return f.find((M,Y)=>Y>$&&M instanceof hf)}toString(){return String(this.date)}}E5.exports=hf});var k5=V((w3,y5)=>{var FU=V1();class x5 extends FU{constructor(f={}){super(f)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let f=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?f.toUpperCase():f}}y5.exports=x5});var v5=V((j3,_5)=>{var RU=V1(),NU=(f)=>{return f=f%10,f===1?"st":f===2?"nd":f===3?"rd":"th"};class b5 extends RU{constructor(f={}){super(f)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(f){this.date.setDate(parseInt(f.substr(-2)))}toString(){let f=this.date.getDate(),$=this.date.getDay();return this.token==="DD"?String(f).padStart(2,"0"):this.token==="Do"?f+NU(f):this.token==="d"?$+1:this.token==="ddd"?this.locales.weekdaysShort[$]:this.token==="dddd"?this.locales.weekdays[$]:f}}_5.exports=b5});var g5=V((I3,h5)=>{var OU=V1();class u5 extends OU{constructor(f={}){super(f)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(f){this.date.setHours(parseInt(f.substr(-2)))}toString(){let f=this.date.getHours();if(/h/.test(this.token))f=f%12||12;return this.token.length>1?String(f).padStart(2,"0"):f}}h5.exports=u5});var d5=V((C3,m5)=>{var AU=V1();class c5 extends AU{constructor(f={}){super(f)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(f){this.date.setMilliseconds(parseInt(f.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}m5.exports=c5});var r5=V((E3,n5)=>{var LU=V1();class l5 extends LU{constructor(f={}){super(f)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(f){this.date.setMinutes(parseInt(f.substr(-2)))}toString(){let f=this.date.getMinutes();return this.token.length>1?String(f).padStart(2,"0"):f}}n5.exports=l5});var o5=V((x3,i5)=>{var PU=V1();class p5 extends PU{constructor(f={}){super(f)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(f){f=parseInt(f.substr(-2))-1,this.date.setMonth(f<0?0:f)}toString(){let f=this.date.getMonth(),$=this.token.length;return $===2?String(f+1).padStart(2,"0"):$===3?this.locales.monthsShort[f]:$===4?this.locales.months[f]:String(f+1)}}i5.exports=p5});var t5=V((y3,a5)=>{var TU=V1();class s5 extends TU{constructor(f={}){super(f)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(f){this.date.setSeconds(parseInt(f.substr(-2)))}toString(){let f=this.date.getSeconds();return this.token.length>1?String(f).padStart(2,"0"):f}}a5.exports=s5});var $z=V((k3,fz)=>{var wU=V1();class e5 extends wU{constructor(f={}){super(f)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(f){this.date.setFullYear(f.substr(-4))}toString(){let f=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?f.substr(-2):f}}fz.exports=e5});var Yz=V((b3,Mz)=>{Mz.exports={DatePart:V1(),Meridiem:k5(),Day:v5(),Hours:g5(),Milliseconds:d5(),Minutes:r5(),Month:o5(),Seconds:t5(),Year:$z()}});var Uz=V((_3,Dz)=>{var G2=x(),jU=L1(),{style:Jz,clear:zz,figures:IU}=Z1(),{erase:CU,cursor:Zz}=y(),{DatePart:Xz,Meridiem:EU,Day:xU,Hours:yU,Milliseconds:kU,Minutes:bU,Month:_U,Seconds:vU,Year:uU}=Yz(),hU=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,Qz={1:({token:f})=>f.replace(/\\(.)/g,"$1"),2:(f)=>new xU(f),3:(f)=>new _U(f),4:(f)=>new uU(f),5:(f)=>new EU(f),6:(f)=>new yU(f),7:(f)=>new bU(f),8:(f)=>new vU(f),9:(f)=>new kU(f)},gU={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")};class Gz extends jU{constructor(f={}){super(f);this.msg=f.message,this.cursor=0,this.typed="",this.locales=Object.assign(gU,f.locales),this._date=f.initial||new Date,this.errorMsg=f.error||"Please Enter A Valid Value",this.validator=f.validate||(()=>!0),this.mask=f.mask||"YYYY-MM-DD HH:mm:ss",this.clear=zz("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(f){if(f)this._date.setTime(f.getTime())}set mask(f){let $;this.parts=[];while($=hU.exec(f)){let Y=$.shift(),J=$.findIndex((z)=>z!=null);this.parts.push(J in Qz?Qz[J]({token:$[J]||Y,date:this.date,parts:this.parts,locales:this.locales}):$[J]||Y)}let M=this.parts.reduce((Y,J)=>{if(typeof J==="string"&&typeof Y[Y.length-1]==="string")Y[Y.length-1]+=J;else Y.push(J);return Y},[]);this.parts.splice(0),this.parts.push(...M),this.reset()}moveCursor(f){this.typed="",this.cursor=f,this.fire()}reset(){this.moveCursor(this.parts.findIndex((f)=>f instanceof Xz)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
136
136
|
`),this.close()}async validate(){let f=await this.validator(this.value);if(typeof f==="string")this.errorMsg=f,f=!1;this.error=!f}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
137
|
-
`),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let f=this.parts[this.cursor].prev();if(f==null)return this.bell();this.moveCursor(this.parts.indexOf(f)),this.render()}right(){let f=this.parts[this.cursor].next();if(f==null)return this.bell();this.moveCursor(this.parts.indexOf(f)),this.render()}next(){let f=this.parts[this.cursor].next();this.moveCursor(f?this.parts.indexOf(f):this.parts.findIndex(($)=>$ instanceof Xz)),this.render()}_(f){if(/\d/.test(f))this.typed+=f,this.parts[this.cursor].setTo(this.typed),this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(Zz.hide);else this.out.write(zz(this.outputText,this.out.columns));if(super.render(),this.outputText=[Jz.symbol(this.done,this.aborted),
|
|
137
|
+
`),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let f=this.parts[this.cursor].prev();if(f==null)return this.bell();this.moveCursor(this.parts.indexOf(f)),this.render()}right(){let f=this.parts[this.cursor].next();if(f==null)return this.bell();this.moveCursor(this.parts.indexOf(f)),this.render()}next(){let f=this.parts[this.cursor].next();this.moveCursor(f?this.parts.indexOf(f):this.parts.findIndex(($)=>$ instanceof Xz)),this.render()}_(f){if(/\d/.test(f))this.typed+=f,this.parts[this.cursor].setTo(this.typed),this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(Zz.hide);else this.out.write(zz(this.outputText,this.out.columns));if(super.render(),this.outputText=[Jz.symbol(this.done,this.aborted),G2.bold(this.msg),Jz.delimiter(!1),this.parts.reduce((f,$,M)=>f.concat(M===this.cursor&&!this.done?G2.cyan().underline($.toString()):$),[]).join("")].join(" "),this.error)this.outputText+=this.errorMsg.split(`
|
|
138
138
|
`).reduce((f,$,M)=>f+`
|
|
139
|
-
${M?" ":IU.pointerSmall} ${
|
|
139
|
+
${M?" ":IU.pointerSmall} ${G2.red().italic($)}`,"");this.out.write(CU.line+Zz.to(0)+this.outputText)}}Dz.exports=Gz});var Bz=V((v3,qz)=>{var gf=x(),cU=L1(),{cursor:cf,erase:mU}=y(),{style:D2,figures:dU,clear:Wz,lines:lU}=Z1(),nU=/[0-9]/,U2=(f)=>f!==void 0,Kz=(f,$)=>{let M=Math.pow(10,$);return Math.round(f*M)/M};class Vz extends cU{constructor(f={}){super(f);this.transform=D2.render(f.style),this.msg=f.message,this.initial=U2(f.initial)?f.initial:"",this.float=!!f.float,this.round=f.round||2,this.inc=f.increment||1,this.min=U2(f.min)?f.min:-1/0,this.max=U2(f.max)?f.max:1/0,this.errorMsg=f.error||"Please Enter A Valid Value",this.validator=f.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(f){if(!f&&f!==0)this.placeholder=!0,this.rendered=gf.gray(this.transform.render(`${this.initial}`)),this._value="";else this.placeholder=!1,this.rendered=this.transform.render(`${Kz(f,this.round)}`),this._value=Kz(f,this.round);this.fire()}get value(){return this._value}parse(f){return this.float?parseFloat(f):parseInt(f)}valid(f){return f==="-"||f==="."&&this.float||nU.test(f)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let f=this.value;this.value=f!==""?f:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
140
140
|
`),this.close()}async validate(){let f=await this.validator(this.value);if(typeof f==="string")this.errorMsg=f,f=!1;this.error=!f}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let f=this.value;this.value=f!==""?f:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
141
|
-
`),this.close()}up(){if(this.typed="",this.value==="")this.value=this.min-this.inc;if(this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value==="")this.value=this.min+this.inc;if(this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let f=this.value.toString();if(f.length===0)return this.bell();if(this.value=this.parse(f=f.slice(0,-1))||"",this.value!==""&&this.value<this.min)this.value=this.min;this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(f,$){if(!this.valid(f))return this.bell();let M=Date.now();if(M-this.lastHit>1000)this.typed="";if(this.typed+=f,this.lastHit=M,this.color="cyan",f===".")return this.fire();if(this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max)this.value=this.max;if(this.value<this.min)this.value=this.min;this.fire(),this.render()}render(){if(this.closed)return;if(!this.firstRender){if(this.outputError)this.out.write(cf.down(lU(this.outputError,this.out.columns)-1)+Wz(this.outputError,this.out.columns));this.out.write(Wz(this.outputText,this.out.columns))}if(super.render(),this.outputError="",this.outputText=[
|
|
141
|
+
`),this.close()}up(){if(this.typed="",this.value==="")this.value=this.min-this.inc;if(this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value==="")this.value=this.min+this.inc;if(this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let f=this.value.toString();if(f.length===0)return this.bell();if(this.value=this.parse(f=f.slice(0,-1))||"",this.value!==""&&this.value<this.min)this.value=this.min;this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(f,$){if(!this.valid(f))return this.bell();let M=Date.now();if(M-this.lastHit>1000)this.typed="";if(this.typed+=f,this.lastHit=M,this.color="cyan",f===".")return this.fire();if(this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max)this.value=this.max;if(this.value<this.min)this.value=this.min;this.fire(),this.render()}render(){if(this.closed)return;if(!this.firstRender){if(this.outputError)this.out.write(cf.down(lU(this.outputError,this.out.columns)-1)+Wz(this.outputError,this.out.columns));this.out.write(Wz(this.outputText,this.out.columns))}if(super.render(),this.outputError="",this.outputText=[D2.symbol(this.done,this.aborted),gf.bold(this.msg),D2.delimiter(this.done),!this.done||!this.done&&!this.placeholder?gf[this.color]().underline(this.rendered):this.rendered].join(" "),this.error)this.outputError+=this.errorMsg.split(`
|
|
142
142
|
`).reduce((f,$,M)=>f+`
|
|
143
|
-
${M?" ":dU.pointerSmall} ${gf.red().italic($)}`,"");this.out.write(mU.line+cf.to(0)+this.outputText+cf.save+this.outputError+cf.restore)}}qz.exports=Vz});var
|
|
143
|
+
${M?" ":dU.pointerSmall} ${gf.red().italic($)}`,"");this.out.write(mU.line+cf.to(0)+this.outputText+cf.save+this.outputError+cf.restore)}}qz.exports=Vz});var W2=V((u3,Rz)=>{var q1=x(),{cursor:rU}=y(),pU=L1(),{clear:Hz,figures:y1,style:Sz,wrap:iU,entriesToDisplay:oU}=Z1();class Fz extends pU{constructor(f={}){super(f);if(this.msg=f.message,this.cursor=f.cursor||0,this.scrollIndex=f.cursor||0,this.hint=f.hint||"",this.warn=f.warn||"- This option is disabled -",this.minSelected=f.min,this.showMinError=!1,this.maxChoices=f.max,this.instructions=f.instructions,this.optionsPerPage=f.optionsPerPage||10,this.value=f.choices.map(($,M)=>{if(typeof $==="string")$={title:$,value:M};return{title:$&&($.title||$.value||$),description:$&&$.description,value:$&&($.value===void 0?M:$.value),selected:$&&$.selected,disabled:$&&$.disabled}}),this.clear=Hz("",this.out.columns),!f.overrideRender)this.render()}reset(){this.value.map((f)=>!f.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter((f)=>f.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
144
144
|
`),this.close()}submit(){let f=this.value.filter(($)=>$.selected);if(this.minSelected&&f.length<this.minSelected)this.showMinError=!0,this.render();else this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
145
145
|
`),this.close()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){if(this.cursor===0)this.cursor=this.value.length-1;else this.cursor--;this.render()}down(){if(this.cursor===this.value.length-1)this.cursor=0;else this.cursor++;this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter((f)=>f.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let f=this.value[this.cursor];if(f.selected)f.selected=!1,this.render();else if(f.disabled||this.value.filter(($)=>$.selected).length>=this.maxChoices)return this.bell();else f.selected=!0,this.render()}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let f=!this.value[this.cursor].selected;this.value.filter(($)=>!$.disabled).forEach(($)=>$.selected=f),this.render()}_(f,$){if(f===" ")this.handleSpaceToggle();else if(f==="a")this.toggleAll();else return this.bell()}renderInstructions(){if(this.instructions===void 0||this.instructions){if(typeof this.instructions==="string")return this.instructions;return`
|
|
146
146
|
Instructions:
|
|
@@ -150,13 +150,13 @@ Instructions:
|
|
|
150
150
|
`:"")+" enter/return: Complete answer"}return""}renderOption(f,$,M,Y){let J=($.selected?q1.green(y1.radioOn):y1.radioOff)+" "+Y+" ",z,Z;if($.disabled)z=f===M?q1.gray().underline($.title):q1.strikethrough().gray($.title);else if(z=f===M?q1.cyan().underline($.title):$.title,f===M&&$.description){if(Z=` - ${$.description}`,J.length+z.length+Z.length>=this.out.columns||$.description.split(/\r?\n/).length>1)Z=`
|
|
151
151
|
`+iU($.description,{margin:J.length,width:this.out.columns})}return J+z+q1.gray(Z||"")}paginateOptions(f){if(f.length===0)return q1.red("No matches for this query.");let{startIndex:$,endIndex:M}=oU(this.cursor,f.length,this.optionsPerPage),Y,J=[];for(let z=$;z<M;z++){if(z===$&&$>0)Y=y1.arrowUp;else if(z===M-1&&M<f.length)Y=y1.arrowDown;else Y=" ";J.push(this.renderOption(this.cursor,f[z],z,Y))}return`
|
|
152
152
|
`+J.join(`
|
|
153
|
-
`)}renderOptions(f){if(!this.done)return this.paginateOptions(f);return""}renderDoneOrInstructions(){if(this.done)return this.value.filter(($)=>$.selected).map(($)=>$.title).join(", ");let f=[q1.gray(this.hint),this.renderInstructions()];if(this.value[this.cursor].disabled)f.push(q1.yellow(this.warn));return f.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(rU.hide);super.render();let f=[Sz.symbol(this.done,this.aborted),q1.bold(this.msg),Sz.delimiter(!1),this.renderDoneOrInstructions()].join(" ");if(this.showMinError)f+=q1.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1;f+=this.renderOptions(this.value),this.out.write(this.clear+f),this.clear=Hz(f,this.out.columns)}}Rz.exports=Fz});var Tz=V((
|
|
153
|
+
`)}renderOptions(f){if(!this.done)return this.paginateOptions(f);return""}renderDoneOrInstructions(){if(this.done)return this.value.filter(($)=>$.selected).map(($)=>$.title).join(", ");let f=[q1.gray(this.hint),this.renderInstructions()];if(this.value[this.cursor].disabled)f.push(q1.yellow(this.warn));return f.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(rU.hide);super.render();let f=[Sz.symbol(this.done,this.aborted),q1.bold(this.msg),Sz.delimiter(!1),this.renderDoneOrInstructions()].join(" ");if(this.showMinError)f+=q1.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1;f+=this.renderOptions(this.value),this.out.write(this.clear+f),this.clear=Hz(f,this.out.columns)}}Rz.exports=Fz});var Tz=V((h3,Pz)=>{var o0=x(),sU=L1(),{erase:aU,cursor:Nz}=y(),{style:K2,clear:Oz,figures:V2,wrap:tU,entriesToDisplay:eU}=Z1(),Az=(f,$)=>f[$]&&(f[$].value||f[$].title||f[$]),fW=(f,$)=>f[$]&&(f[$].title||f[$].value||f[$]),$W=(f,$)=>{let M=f.findIndex((Y)=>Y.value===$||Y.title===$);return M>-1?M:void 0};class Lz extends sU{constructor(f={}){super(f);this.msg=f.message,this.suggest=f.suggest,this.choices=f.choices,this.initial=typeof f.initial==="number"?f.initial:$W(f.choices,f.initial),this.select=this.initial||f.cursor||0,this.i18n={noMatches:f.noMatches||"no matches found"},this.fallback=f.fallback||this.initial,this.clearFirst=f.clearFirst||!1,this.suggestions=[],this.input="",this.limit=f.limit||10,this.cursor=0,this.transform=K2.render(f.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=Oz("",this.out.columns),this.complete(this.render),this.render()}set fallback(f){this._fb=Number.isSafeInteger(parseInt(f))?parseInt(f):f}get fallback(){let f;if(typeof this._fb==="number")f=this.choices[this._fb];else if(typeof this._fb==="string")f={title:this._fb};return f||this._fb||{title:this.i18n.noMatches}}moveSelect(f){if(this.select=f,this.suggestions.length>0)this.value=Az(this.suggestions,f);else this.value=this.fallback.value;this.fire()}async complete(f){let $=this.completing=this.suggest(this.input,this.choices),M=await $;if(this.completing!==$)return;this.suggestions=M.map((J,z,Z)=>({title:fW(Z,z),value:Az(Z,z),description:J.description})),this.completing=!1;let Y=Math.max(M.length-1,0);this.moveSelect(Math.min(Y,this.select)),f&&f()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){if(this.clearFirst&&this.input.length>0)this.reset();else this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
154
154
|
`),this.close()}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
155
155
|
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
156
|
-
`),this.close()}_(f,$){let M=this.input.slice(0,this.cursor),Y=this.input.slice(this.cursor);this.input=`${M}${f}${Y}`,this.cursor=M.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let f=this.input.slice(0,this.cursor-1),$=this.input.slice(this.cursor);this.input=`${f}${$}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let f=this.input.slice(0,this.cursor),$=this.input.slice(this.cursor+1);this.input=`${f}${$}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){if(this.select===0)this.moveSelect(this.suggestions.length-1);else this.moveSelect(this.select-1);this.render()}down(){if(this.select===this.suggestions.length-1)this.moveSelect(0);else this.moveSelect(this.select+1);this.render()}next(){if(this.select===this.suggestions.length-1)this.moveSelect(0);else this.moveSelect(this.select+1);this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(f,$,M,Y){let J,z=M?
|
|
157
|
-
`+tU(f.description,{margin:3,width:this.out.columns})}return z+" "+Z+o0.gray(J||"")}render(){if(this.closed)return;if(this.firstRender)this.out.write(Nz.hide);else this.out.write(
|
|
156
|
+
`),this.close()}_(f,$){let M=this.input.slice(0,this.cursor),Y=this.input.slice(this.cursor);this.input=`${M}${f}${Y}`,this.cursor=M.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let f=this.input.slice(0,this.cursor-1),$=this.input.slice(this.cursor);this.input=`${f}${$}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let f=this.input.slice(0,this.cursor),$=this.input.slice(this.cursor+1);this.input=`${f}${$}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){if(this.select===0)this.moveSelect(this.suggestions.length-1);else this.moveSelect(this.select-1);this.render()}down(){if(this.select===this.suggestions.length-1)this.moveSelect(0);else this.moveSelect(this.select+1);this.render()}next(){if(this.select===this.suggestions.length-1)this.moveSelect(0);else this.moveSelect(this.select+1);this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(f,$,M,Y){let J,z=M?V2.arrowUp:Y?V2.arrowDown:" ",Z=$?o0.cyan().underline(f.title):f.title;if(z=($?o0.cyan(V2.pointer)+" ":" ")+z,f.description){if(J=` - ${f.description}`,z.length+Z.length+J.length>=this.out.columns||f.description.split(/\r?\n/).length>1)J=`
|
|
157
|
+
`+tU(f.description,{margin:3,width:this.out.columns})}return z+" "+Z+o0.gray(J||"")}render(){if(this.closed)return;if(this.firstRender)this.out.write(Nz.hide);else this.out.write(Oz(this.outputText,this.out.columns));super.render();let{startIndex:f,endIndex:$}=eU(this.select,this.choices.length,this.limit);if(this.outputText=[K2.symbol(this.done,this.aborted,this.exited),o0.bold(this.msg),K2.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let M=this.suggestions.slice(f,$).map((Y,J)=>this.renderOption(Y,this.select===J+f,J===0&&f>0,J+f===$-1&&$<this.choices.length)).join(`
|
|
158
158
|
`);this.outputText+=`
|
|
159
|
-
`+(M||o0.gray(this.fallback.title))}this.out.write(aU.line+Nz.to(0)+this.outputText)}}Pz.exports=Lz});var Ez=V((
|
|
159
|
+
`+(M||o0.gray(this.fallback.title))}this.out.write(aU.line+Nz.to(0)+this.outputText)}}Pz.exports=Lz});var Ez=V((g3,Cz)=>{var T1=x(),{cursor:MW}=y(),YW=W2(),{clear:wz,style:jz,figures:S0}=Z1();class Iz extends YW{constructor(f={}){f.overrideRender=!0;super(f);this.inputValue="",this.clear=wz("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){if(this.cursor===0)this.cursor=this.filteredOptions.length-1;else this.cursor--;this.render()}down(){if(this.cursor===this.filteredOptions.length-1)this.cursor=0;else this.cursor++;this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter((f)=>f.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){if(this.inputValue.length)this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions()}updateFilteredOptions(){let f=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter((M)=>{if(this.inputValue){if(typeof M.title==="string"){if(M.title.toLowerCase().includes(this.inputValue.toLowerCase()))return!0}if(typeof M.value==="string"){if(M.value.toLowerCase().includes(this.inputValue.toLowerCase()))return!0}return!1}return!0});let $=this.filteredOptions.findIndex((M)=>M===f);this.cursor=$<0?0:$,this.render()}handleSpaceToggle(){let f=this.filteredOptions[this.cursor];if(f.selected)f.selected=!1,this.render();else if(f.disabled||this.value.filter(($)=>$.selected).length>=this.maxChoices)return this.bell();else f.selected=!0,this.render()}handleInputChange(f){this.inputValue=this.inputValue+f,this.updateFilteredOptions()}_(f,$){if(f===" ")this.handleSpaceToggle();else this.handleInputChange(f)}renderInstructions(){if(this.instructions===void 0||this.instructions){if(typeof this.instructions==="string")return this.instructions;return`
|
|
160
160
|
Instructions:
|
|
161
161
|
${S0.arrowUp}/${S0.arrowDown}: Highlight option
|
|
162
162
|
${S0.arrowLeft}/${S0.arrowRight}/[space]: Toggle selection
|
|
@@ -164,9 +164,9 @@ Instructions:
|
|
|
164
164
|
enter/return: Complete answer
|
|
165
165
|
`}return""}renderCurrentInput(){return`
|
|
166
166
|
Filtered results for: ${this.inputValue?this.inputValue:T1.gray("Enter something to filter")}
|
|
167
|
-
`}renderOption(f,$,M){let Y;if($.disabled)Y=f===M?T1.gray().underline($.title):T1.strikethrough().gray($.title);else Y=f===M?T1.cyan().underline($.title):$.title;return($.selected?T1.green(S0.radioOn):S0.radioOff)+" "+Y}renderDoneOrInstructions(){if(this.done)return this.value.filter(($)=>$.selected).map(($)=>$.title).join(", ");let f=[T1.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];if(this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled)f.push(T1.yellow(this.warn));return f.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(MW.hide);super.render();let f=[jz.symbol(this.done,this.aborted),T1.bold(this.msg),jz.delimiter(!1),this.renderDoneOrInstructions()].join(" ");if(this.showMinError)f+=T1.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1;f+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+f),this.clear=wz(f,this.out.columns)}}Cz.exports=Iz});var vz=V((
|
|
167
|
+
`}renderOption(f,$,M){let Y;if($.disabled)Y=f===M?T1.gray().underline($.title):T1.strikethrough().gray($.title);else Y=f===M?T1.cyan().underline($.title):$.title;return($.selected?T1.green(S0.radioOn):S0.radioOff)+" "+Y}renderDoneOrInstructions(){if(this.done)return this.value.filter(($)=>$.selected).map(($)=>$.title).join(", ");let f=[T1.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];if(this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled)f.push(T1.yellow(this.warn));return f.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(MW.hide);super.render();let f=[jz.symbol(this.done,this.aborted),T1.bold(this.msg),jz.delimiter(!1),this.renderDoneOrInstructions()].join(" ");if(this.showMinError)f+=T1.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1;f+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+f),this.clear=wz(f,this.out.columns)}}Cz.exports=Iz});var vz=V((c3,_z)=>{var xz=x(),JW=L1(),{style:yz,clear:zW}=Z1(),{erase:ZW,cursor:kz}=y();class bz extends JW{constructor(f={}){super(f);this.msg=f.message,this.value=f.initial,this.initialValue=!!f.initial,this.yesMsg=f.yes||"yes",this.yesOption=f.yesOption||"(Y/n)",this.noMsg=f.no||"no",this.noOption=f.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
168
168
|
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
169
|
-
`),this.close()}_(f,$){if(f.toLowerCase()==="y")return this.value=!0,this.submit();if(f.toLowerCase()==="n")return this.value=!1,this.submit();return this.bell()}render(){if(this.closed)return;if(this.firstRender)this.out.write(kz.hide);else this.out.write(zW(this.outputText,this.out.columns));super.render(),this.outputText=[yz.symbol(this.done,this.aborted),xz.bold(this.msg),yz.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:xz.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(ZW.line+kz.to(0)+this.outputText)}}_z.exports=bz});var hz=V((
|
|
169
|
+
`),this.close()}_(f,$){if(f.toLowerCase()==="y")return this.value=!0,this.submit();if(f.toLowerCase()==="n")return this.value=!1,this.submit();return this.bell()}render(){if(this.closed)return;if(this.firstRender)this.out.write(kz.hide);else this.out.write(zW(this.outputText,this.out.columns));super.render(),this.outputText=[yz.symbol(this.done,this.aborted),xz.bold(this.msg),yz.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:xz.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(ZW.line+kz.to(0)+this.outputText)}}_z.exports=bz});var hz=V((m3,uz)=>{uz.exports={TextPrompt:R5(),SelectPrompt:P5(),TogglePrompt:C5(),DatePrompt:Uz(),NumberPrompt:Bz(),MultiselectPrompt:W2(),AutocompletePrompt:Tz(),AutocompleteMultiselectPrompt:Ez(),ConfirmPrompt:vz()}});var cz=V((gz)=>{var t=gz,XW=hz(),mf=(f)=>f;function B1(f,$,M={}){return new Promise((Y,J)=>{let z=new XW[f]($),Z=M.onAbort||mf,X=M.onSubmit||mf,Q=M.onExit||mf;z.on("state",$.onState||mf),z.on("submit",(G)=>Y(X(G))),z.on("exit",(G)=>Y(Q(G))),z.on("abort",(G)=>J(Z(G)))})}t.text=(f)=>B1("TextPrompt",f);t.password=(f)=>{return f.style="password",t.text(f)};t.invisible=(f)=>{return f.style="invisible",t.text(f)};t.number=(f)=>B1("NumberPrompt",f);t.date=(f)=>B1("DatePrompt",f);t.confirm=(f)=>B1("ConfirmPrompt",f);t.list=(f)=>{let $=f.separator||",";return B1("TextPrompt",f,{onSubmit:(M)=>M.split($).map((Y)=>Y.trim())})};t.toggle=(f)=>B1("TogglePrompt",f);t.select=(f)=>B1("SelectPrompt",f);t.multiselect=(f)=>{f.choices=[].concat(f.choices||[]);let $=(M)=>M.filter((Y)=>Y.selected).map((Y)=>Y.value);return B1("MultiselectPrompt",f,{onAbort:$,onSubmit:$})};t.autocompleteMultiselect=(f)=>{f.choices=[].concat(f.choices||[]);let $=(M)=>M.filter((Y)=>Y.selected).map((Y)=>Y.value);return B1("AutocompleteMultiselectPrompt",f,{onAbort:$,onSubmit:$})};var QW=(f,$)=>Promise.resolve($.filter((M)=>M.title.slice(0,f.length).toLowerCase()===f.toLowerCase()));t.autocomplete=(f)=>{return f.suggest=f.suggest||QW,f.choices=[].concat(f.choices||[]),B1("AutocompletePrompt",f)}});var lz=V((l3,dz)=>{var q2=cz(),GW=["suggest","format","onState","validate","onRender","type"],mz=()=>{};async function k1(f=[],{onSubmit:$=mz,onCancel:M=mz}={}){let Y={},J=k1._override||{};f=[].concat(f);let z,Z,X,Q,G,D,U=async(K,W,B=!1)=>{if(!B&&K.validate&&K.validate(W)!==!0)return;return K.format?await K.format(W,Y):W};for(Z of f){if({name:Q,type:G}=Z,typeof G==="function")G=await G(z,{...Y},Z),Z.type=G;if(!G)continue;for(let K in Z){if(GW.includes(K))continue;let W=Z[K];Z[K]=typeof W==="function"?await W(z,{...Y},D):W}if(D=Z,typeof Z.message!=="string")throw Error("prompt message is required");if({name:Q,type:G}=Z,q2[G]===void 0)throw Error(`prompt type (${G}) is not defined`);if(J[Z.name]!==void 0){if(z=await U(Z,J[Z.name]),z!==void 0){Y[Q]=z;continue}}try{z=k1._injected?DW(k1._injected,Z.initial):await q2[G](Z),Y[Q]=z=await U(Z,z,!0),X=await $(Z,z,Y)}catch(K){X=!await M(Z,Y)}if(X)return Y}return Y}function DW(f,$){let M=f.shift();if(M instanceof Error)throw M;return M===void 0?$:M}function UW(f){k1._injected=(k1._injected||[]).concat(f)}function WW(f){k1._override=Object.assign({},f)}dz.exports=Object.assign(k1,{prompt:k1,prompts:q2,inject:UW,override:WW})});var rz=V((n3,nz)=>{function KW(f){f=(Array.isArray(f)?f:f.split(".")).map(Number);let $=0,M=process.versions.node.split(".").map(Number);for(;$<f.length;$++){if(M[$]>f[$])return!1;if(f[$]>M[$])return!0}return!1}nz.exports=KW("8.6.0")?tJ():lz()});var s2=w0(o2(),1),{program:EK,createCommand:xK,createArgument:yK,createOption:kK,CommanderError:bK,InvalidArgumentError:_K,InvalidOptionArgumentError:vK,Command:Xf,Argument:uK,Option:hK,Help:gK}=s2.default;import{access as df,constants as lf,cp as VW,mkdir as B2,readFile as s0,writeFile as oz}from"node:fs/promises";import{EOL as b1}from"node:os";import{dirname as qW,join as e}from"node:path";import{fileURLToPath as BW}from"node:url";import{mkdir as x4,readdir as QG,readFile as c$,stat as GG,unlink as y4,writeFile as W0}from"node:fs/promises";import{dirname as k4,extname as DG,join as m$}from"node:path";var Qf=".memory",a2=".",I0="system://boot",C0="system://index",K$="system://recent",t2=["system://agent","system://soul","system://user"];var Gf="---",Df=".md";var fM=w0(B$(),1),oK=w0(e2(),1);function fZ(f,$="YYYY-MM-DD HH:mm"){return fM.default(f).format($)}function Uf(f){return fZ(f,"YYYY-MM-DD HH:mm")}var $Z=5;async function $M(f){let $=[];for(let Z of t2)try{let X=await f.getMemory(Z);if(X)$.push(`${X.content}`)}catch{}let Y=(await f.getAllMemories({includeDeleted:!1})).sort((Z,X)=>{let Q=new Date(Z.updatedAt).getTime();return new Date(X.updatedAt).getTime()-Q}).slice(0,$Z),J=[];if($.length>0)J.push(`# Core Memories
|
|
170
170
|
|
|
171
171
|
`),J.push($.join(`
|
|
172
172
|
|
|
@@ -182,7 +182,7 @@ Filtered results for: ${this.inputValue?this.inputValue:T1.gray("Enter something
|
|
|
182
182
|
`:"";J.push(`${Z.uri}${G} modified: ${Q}
|
|
183
183
|
${D}
|
|
184
184
|
`)}}}let z=J.join("");return{uri:I0,memoryId:I0,content:z,priority:10,disclosure:"",isAlias:!1,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),deleted:!1}}var R4=w0(F4(),1);function Lf(f){return R4.default(f,{delimiters:Gf})}function n1(f){let $=[Gf],M=[["memoryId",f.memoryId],["uri",f.uri],["priority",f.priority],["isAlias",f.isAlias],["createdAt",f.createdAt],["updatedAt",f.updatedAt]];if(f.disclosure)M.push(["disclosure",f.disclosure]);if(f.targetUri)M.push(["targetUri",f.targetUri]);if(f.deleted)M.push(["deleted",!0]);for(let[Y,J]of M)if(typeof J==="string")$.push(`${Y}: "${J}"`);else if(typeof J==="boolean")$.push(`${Y}: ${J?"true":"false"}`);else $.push(`${Y}: ${J}`);return $.push(Gf,""),$.join(`
|
|
185
|
-
`)}var N4=/^([^:]+):\/\/(.+)$/;function G1(f){let $=f.match(N4);if(!$)throw Error(`Invalid URI format: ${f}`);return{domain:$[1],path:$[2]}}function D1(f){return N4.test(f)}function
|
|
185
|
+
`)}var N4=/^([^:]+):\/\/(.+)$/;function G1(f){let $=f.match(N4);if(!$)throw Error(`Invalid URI format: ${f}`);return{domain:$[1],path:$[2]}}function D1(f){return N4.test(f)}function O4(f){return G1(f).path.split("/").filter(Boolean)}function g$(f,$){let M=G1(f),Y=G1($);if(M.domain!==Y.domain)return null;let J=O4(f),z=O4($),Z=z.length-J.length;if(Z===1){if(A4(J,z))return{isDirect:!0,parentUri:f,childUri:$}}else if(Z===-1){if(A4(z,J))return{isDirect:!0,parentUri:$,childUri:f}}return null}function A4(f,$){if(f.length>=$.length)return!1;for(let M=0;M<f.length;M++)if(f[M]!==$[M])return!1;return!0}import{webcrypto as P4}from"node:crypto";var L4="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var YG=128,r1,U0;function JG(f){if(!r1||r1.length<f)r1=Buffer.allocUnsafe(f*YG),P4.getRandomValues(r1),U0=0;else if(U0+f>r1.length)P4.getRandomValues(r1),U0=0;U0+=f}function T4(f=21){JG(f|=0);let $="";for(let M=U0-f;M<U0;M++)$+=L4[r1[M]&63];return $}var zG="mem",ZG=12;function w4(){return`${zG}_${T4(ZG)}`}async function j4(f){let $=await f.getAllMemories({includeDeleted:!1}),M=new Map;for(let Z of $){let{domain:X}=G1(Z.uri);if(!M.has(X))M.set(X,[]);M.get(X).push(Z)}let Y=[];Y.push(`# Memory Index
|
|
186
186
|
`),Y.push(`# Total entries: ${$.length}
|
|
187
187
|
`),Y.push(`Legend: [ID] = Memory ID (same ID = alias), [★N] = priority
|
|
188
188
|
`);let J=Array.from(M.keys()).sort();for(let Z of J){let X=M.get(Z);Y.push(`
|
|
@@ -193,22 +193,22 @@ ${D}
|
|
|
193
193
|
`)}else{Y.push(`
|
|
194
194
|
### ${D}
|
|
195
195
|
`);for(let K of U){let W=K.priority>7?` [★${K.priority}]`:"";Y.push(` - ${K.uri} [${K.memoryId}]${W}
|
|
196
|
-
`)}}}}let z=Y.join("");return{uri:C0,memoryId:C0,content:z,priority:10,disclosure:"",isAlias:!1,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),deleted:!1}}import{sep as I4}from"node:path";var XG="/";function
|
|
196
|
+
`)}}}}let z=Y.join("");return{uri:C0,memoryId:C0,content:z,priority:10,disclosure:"",isAlias:!1,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),deleted:!1}}import{sep as I4}from"node:path";var XG="/";function Y1(f,$){let M=G1(f),J=M.path.split(XG).filter(Boolean).join(I4);return[$,M.domain,`${J}${Df}`].join(I4)}var C4="system://recent";async function E4(f,$){let J=10,z=$.match(/^system:\/\/recent(?:\/(\d+))?$/);if(z?.[1]){let U=Number.parseInt(z[1],10);if(Number.isNaN(U)||U<1)J=10;else if(U>1000)J=1000;else J=U}let X=(await f.getAllMemories({includeDeleted:!1})).sort((U,K)=>{let W=new Date(U.updatedAt).getTime();return new Date(K.updatedAt).getTime()-W}).slice(0,J),Q=[];for(let U of X){let K=await f.getMemory(U.uri);if(K)Q.push(K)}let G=[];G.push(`# Recently Modified Memories
|
|
197
197
|
`),G.push(`# Showing: ${J} most recent entries
|
|
198
198
|
`);for(let U of Q){let K=U.priority>7?` [★${U.priority}]`:"",W=Uf(U.updatedAt);if(G.push(`${U.uri}${K} modified: ${W}
|
|
199
199
|
`),U.disclosure)G.push(`disclosure: ${U.disclosure}
|
|
200
|
-
`)}let D=G.join("");return{uri:C4,memoryId:C4,content:D,priority:10,disclosure:"",isAlias:!1,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),deleted:!1}}class
|
|
201
|
-
`).find((Y)=>Y.trim()!=="")?.trim()||""}function
|
|
202
|
-
`).find((J)=>J.trim()!=="")?.trim()===$}async function pz(f,$){try{let M="";try{M=await s0(f,"utf-8")}catch{M=""}let Y=
|
|
200
|
+
`)}let D=G.join("");return{uri:C4,memoryId:C4,content:D,priority:10,disclosure:"",isAlias:!1,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),deleted:!1}}class d${memoryRoot;constructor(f){let $=f.memoryRoot??a2;this.memoryRoot=m$($,Qf)}async _getMemoryRaw(f){try{let $=Y1(f,this.memoryRoot),M=await c$($,"utf-8"),{data:Y,content:J}=Lf(M);return{uri:Y.uri,memoryId:Y.memoryId,content:J,priority:Y.priority,disclosure:Y.disclosure,isAlias:Y.isAlias??!1,targetUri:Y.targetUri,createdAt:Y.createdAt,updatedAt:Y.updatedAt,deleted:Y.deleted??!1}}catch{return null}}async _targetFileExists(f){try{let $=Y1(f,this.memoryRoot);return await GG($),!0}catch{return!1}}async getMemory(f,$){if(!D1(f))throw Error(`Invalid URI format: ${f}. Expected format: 'domain://path/to/memory'`);if(f===I0)return $M(this);if(f===C0)return j4(this);if(f===K$||f.startsWith(`${K$}/`))return E4(this,f);let M=$?.includeDeleted??!1;try{let Y=Y1(f,this.memoryRoot),J=await c$(Y,"utf-8"),{data:z,content:Z}=Lf(J);if(!M&&(z.deleted??!1))return null;if(z.isAlias&&z.targetUri){let X=await this._getMemoryRaw(z.targetUri);return{uri:z.uri,memoryId:z.memoryId,content:X?.content??"",priority:z.priority,disclosure:z.disclosure,isAlias:!0,targetUri:z.targetUri,createdAt:z.createdAt,updatedAt:z.updatedAt,deleted:z.deleted??!1}}return{uri:z.uri,memoryId:z.memoryId,content:Z,priority:z.priority,disclosure:z.disclosure,isAlias:z.isAlias??!1,targetUri:z.targetUri,createdAt:z.createdAt,updatedAt:z.updatedAt,deleted:z.deleted??!1}}catch{return null}}async createMemory(f){if(!D1(f.uri))throw Error(`Invalid URI format: ${f.uri}. Expected format: 'domain://path/to/memory'`);let $=await this._getMemoryRaw(f.uri);if($&&!$.deleted)throw Error(`Memory already exists at URI: ${f.uri}`);let M=w4(),Y=new Date().toISOString(),J=f.uri,z=Y1(J,this.memoryRoot),Z=k4(z);await x4(Z,{recursive:!0});let Q=n1({memoryId:M,uri:J,priority:f.priority??5,disclosure:f.disclosure,isAlias:!1,createdAt:Y,updatedAt:Y})+f.content;return await W0(z,Q,"utf-8"),{uri:J,memoryId:M,content:f.content,priority:f.priority??5,disclosure:f.disclosure,isAlias:!1,createdAt:Y,updatedAt:Y,deleted:!1}}async updateMemory(f){if(!D1(f.uri))throw Error(`Invalid URI format: ${f.uri}. Expected format: 'domain://path/to/memory'`);let $=await this._getMemoryRaw(f.uri);if(!$||$.deleted)throw Error("Memory not found");if($.isAlias&&$.targetUri){if(!await this._targetFileExists($.targetUri))throw Error("Target memory file not found");let Q=await this._getMemoryRaw($.targetUri);if(Q){let G=Y1($.targetUri,this.memoryRoot),D=new Date().toISOString(),K=n1({memoryId:Q.memoryId,uri:Q.uri,priority:Q.priority,disclosure:Q.disclosure,isAlias:Q.isAlias,targetUri:Q.targetUri,createdAt:Q.createdAt,updatedAt:D,deleted:Q.deleted})+f.content;return await W0(G,K,"utf-8"),{...$,content:f.content,updatedAt:D}}throw Error("Target memory not found")}let M=Y1(f.uri,this.memoryRoot),Y=new Date().toISOString(),z=n1({memoryId:$.memoryId,uri:$.uri,priority:f.priority??$.priority,disclosure:f.disclosure??$.disclosure,isAlias:$.isAlias,targetUri:$.targetUri,createdAt:$.createdAt,updatedAt:Y,deleted:$.deleted})+f.content;return await W0(M,z,"utf-8"),{...$,content:f.content,priority:f.priority??$.priority,disclosure:f.disclosure??$.disclosure,updatedAt:Y}}async deleteMemory(f,$={}){if(!D1(f))throw Error(`Invalid URI format: ${f}. Expected format: 'domain://path/to/memory'`);let{recursive:M=!1,permanent:Y=!1}=$;if(!Y){let z=await this.getMemory(f);if(!z||z.deleted)throw Error("Memory not found");let Z=Y1(f,this.memoryRoot),X=new Date().toISOString(),G=n1({memoryId:z.memoryId,uri:z.uri,priority:z.priority,disclosure:z.disclosure,isAlias:z.isAlias,targetUri:z.targetUri,createdAt:z.createdAt,updatedAt:X,deleted:!0})+z.content;if(await W0(Z,G,"utf-8"),M){let D=await this.getAllMemories({includeDeleted:!1});for(let U of D)if(U.uri.startsWith(`${f}/`))await this.deleteMemory(U.uri,{recursive:!0,permanent:!1})}return}let J=Y1(f,this.memoryRoot);if(await y4(J),M){let z=await this.getAllMemories({includeDeleted:!1});for(let Z of z)if(Z.uri.startsWith(`${f}/`)){let X=Y1(Z.uri,this.memoryRoot);await y4(X)}}}async restoreMemory(f){if(!D1(f))throw Error(`Invalid URI format: ${f}. Expected format: 'domain://path/to/memory'`);let $=await this._getMemoryRaw(f);if(!$)throw Error("Memory not found");if(!$.deleted)throw Error("Memory is not deleted");let M=Y1(f,this.memoryRoot),Y=new Date().toISOString(),z=n1({memoryId:$.memoryId,uri:$.uri,priority:$.priority,disclosure:$.disclosure,isAlias:$.isAlias,targetUri:$.targetUri,createdAt:$.createdAt,updatedAt:Y,deleted:!1})+$.content;return await W0(M,z,"utf-8"),{...$,updatedAt:Y,deleted:!1}}async addAlias(f){if(!D1(f.newUri))throw Error(`Invalid URI format for newUri: ${f.newUri}. Expected format: 'domain://path/to/memory'`);if(!D1(f.targetUri))throw Error(`Invalid URI format for targetUri: ${f.targetUri}. Expected format: 'domain://path/to/memory'`);let $=await this.getMemory(f.targetUri);if(!$)throw Error("Target memory not found");if(await this.getMemory(f.newUri))throw Error(`Memory already exists at alias URI: ${f.newUri}`);let Y=new Date().toISOString(),J=$.memoryId,z=Y1(f.newUri,this.memoryRoot),Z=k4(z);await x4(Z,{recursive:!0});let X=n1({memoryId:J,uri:f.newUri,priority:f.priority??$.priority,disclosure:f.disclosure??$.disclosure,isAlias:!0,targetUri:f.targetUri,createdAt:Y,updatedAt:Y});return await W0(z,X,"utf-8"),{uri:f.newUri,memoryId:J,content:$.content,priority:f.priority??$.priority,disclosure:f.disclosure??$.disclosure,isAlias:!0,targetUri:f.targetUri,createdAt:Y,updatedAt:Y,deleted:!1}}async searchMemory(f,$={}){let M=await this.getAllMemories({domain:$.domain,includeDeleted:!1}),Y=f.toLowerCase(),J=[],z=$.limit??10;for(let Z of M){if(J.length>=z)break;try{let X=await this.getMemory(Z.uri);if(!X||X.deleted)continue;let Q=X.uri.toLowerCase().includes(Y),G=X.content.toLowerCase().includes(Y);if(Q||G)J.push(X)}catch{}}return J}async getChildren(f){if(!D1(f))return[];try{let $=await this.getAllMemories({includeDeleted:!1}),M=[];for(let Y of $){let J=g$(f,Y.uri);if(J?.isDirect&&J?.parentUri===f)M.push(Y)}return M.sort((Y,J)=>J.priority-Y.priority)}catch{return[]}}async getAllMemories(f={}){let $=[],M=f.domain?m$(this.memoryRoot,f.domain):this.memoryRoot,Y=async(J)=>{try{let z=await QG(J,{withFileTypes:!0});for(let Z of z){let X=m$(J,Z.name);if(Z.isDirectory())await Y(X);else if(DG(Z.name)===Df){let Q=await c$(X,"utf-8"),{data:G,content:D}=Lf(Q);if(!G.deleted||f.includeDeleted)$.push({uri:G.uri,memoryId:G.memoryId,content:D,priority:G.priority,disclosure:G.disclosure,isAlias:G.isAlias??!1,targetUri:G.targetUri,createdAt:G.createdAt,updatedAt:G.updatedAt,deleted:G.deleted??!1})}}}catch{}};return await Y(M),$}async getRelationships(f){let{uri:$,domain:M}=f||{},Y=[],J=await this.getAllMemories({domain:M,includeDeleted:!0});if($){if(!D1($))return Y;let z=await this.getMemory($);if(!z)return Y;for(let Z of J){if(Z.uri===$)continue;let X=g$($,Z.uri);if(X)Y.push({fromUri:X.parentUri,toUri:X.childUri,type:"parent_child",weight:1});if(Z.isAlias&&Z.targetUri===$)Y.push({fromUri:Z.uri,toUri:$,type:"alias",weight:1});try{let Q=await this.getMemory(Z.uri);if(Q){let G=Q.content.includes($),D=z.content.includes(Z.uri);if(G||D)Y.push({fromUri:G?Z.uri:$,toUri:G?$:Z.uri,type:"reference",weight:0.5})}}catch{}}}else{let z=J.map((X)=>X.uri),Z=new Set;for(let X of z){let Q=await this.getRelationships({uri:X,domain:M});for(let G of Q){let D=`${G.fromUri}-${G.toUri}-${G.type}`;if(!Z.has(D))Z.add(D),Y.push(G)}}}return Y}}function K0(f){switch(f.type){case"filesystem":return new d$(f.config);case"sqlite":throw Error("SQLite adapter not implemented yet");default:throw Error(`Unknown store type: ${f.type}`)}}function V0(f){return{memoryRoot:f}}var a0=w0(rz(),1),nf=qW(BW(import.meta.url)),HW=e(nf,"./template/system"),SW=e(nf,"./template/mcp/AGENTS.md"),FW=e(nf,"./template/skill/AGENTS.md"),RW=e(nf,"./template/skill"),NW={agent:"system://agent",soul:"system://soul",user:"system://user"};async function OW(f){return s0(e(HW,f),"utf-8")}function H2(f){return f.split(`
|
|
201
|
+
`).find((Y)=>Y.trim()!=="")?.trim()||""}function S2(f,$){return f.split(`
|
|
202
|
+
`).find((J)=>J.trim()!=="")?.trim()===$}async function pz(f,$){try{let M="";try{M=await s0(f,"utf-8")}catch{M=""}let Y=H2($);if(M&&S2(M,Y)){console.log("› Skipped: content already exists");return}let J=M?`${b1}${b1}`:"",z=`${$}${J}${M}`;await oz(f,z,"utf-8"),console.log(`✔ Injected: ${f}`)}catch(M){throw console.error(`✖ Failed: ${f}`,M),M}}async function iz(f,$,M){let Y=e(f,"AGENTS.md"),J=e(f,"CLAUDE.md"),z=!1,Z=!1;try{await df(Y,lf.F_OK),z=!0}catch{}try{await df(J,lf.F_OK),Z=!0}catch{}let X=await s0($,"utf-8"),Q=M==="mcp"?"MCP":"Skill";if(Z){console.log("› Found: CLAUDE.md");let G=await s0(J,"utf-8"),D=H2(X);if(!S2(G,D)){let U=await a0.default({type:"confirm",name:"inject",message:`Inject ${Q} configuration to CLAUDE.md?`,initial:!0});if(U.inject===void 0)process.exit(0);if(U.inject)await pz(J,X);else console.log("› Skipped: CLAUDE.md")}else console.log("› Skipped: content already exists")}else if(z){console.log("› Found: AGENTS.md");let G=await s0(Y,"utf-8"),D=H2(X);if(!S2(G,D)){let U=await a0.default({type:"confirm",name:"inject",message:`Inject ${Q} configuration to AGENTS.md?`,initial:!0});if(U.inject===void 0)process.exit(0);if(U.inject)await pz(Y,X);else console.log("› Skipped: AGENTS.md")}else console.log("› Skipped: content already exists")}else console.log("✔ Created: AGENTS.md"),await oz(Y,X,"utf-8")}async function AW(f){let $=e(f,".claude","skills");try{await B2($,{recursive:!0})}catch{}let M=["hippo-memory"];for(let Y of M){let J=e(RW,Y),z=e($,Y),Z=e(z,"SKILL.md");try{await B2(z,{recursive:!0});let X=!1;try{await df(Z,lf.F_OK),X=!0}catch{}if(X){let Q=await a0.default({type:"confirm",name:"overwrite",message:`Skill ${Y} already exists. Overwrite?`,initial:!1});if(Q.overwrite===void 0)process.exit(0);if(!Q.overwrite){console.log(`› Skipped: ${Y}`);continue}}await VW(e(J,"SKILL.md"),Z),console.log(`✔ Installed skill: ${Y}`)}catch(X){console.error(`✖ Failed to install skill: ${Y}`,X)}}}async function LW(){let f=await a0.default({type:"select",name:"mode",message:"选择 Claude Code 集成方式:",choices:[{title:"\uD83D\uDD0C MCP 模式 (推荐全局配置)",description:"适用于跨项目共享记忆,需要单独配置 MCP 服务器",value:"mcp"},{title:"\uD83D\uDCDC Skill 模式 (推荐项目配置)",description:"项目级技能,可提交到 Git 与团队共享",value:"skill"}],initial:1});if(!f.mode)process.exit(0);return f.mode}async function sz(f){let $=e(f,Qf);try{await df($,lf.F_OK),console.log(`Memory directory already exists at ${$}`)}catch{await B2($,{recursive:!0});let Y=K0({type:"filesystem",config:V0(f)});await Promise.all(Object.entries(NW).map(async([J,z])=>{let Z=await OW(`${J}.md`);await Y.createMemory({uri:z,content:Z,priority:10})})),console.log(`✔ Initialized hippo memory at ${$}`)}let M=await LW();if(M==="mcp")console.log(`${b1}◇ Setting up MCP integration...`),await iz(f,SW,M),console.log(`${b1}✨ Setup complete!${b1}`),console.log("\uD83D\uDCCC Next steps:"),console.log(" 1. Configure MCP server in Claude Code settings"),console.log(" 2. Run: hippo web -p 3000"),console.log("");if(M==="skill")console.log(`${b1}◇ Installing Claude Code Skills...`),await iz(f,FW,M),await AW(f),console.log(`${b1}✨ Setup complete!${b1}`),console.log("\uD83D\uDCCC Next steps:"),console.log(" 1. Skills installed in .claude/skills/"),console.log(" 2. Configuration injected to CLAUDE.md"),console.log(" 3. LLM will automatically trigger when needed"),console.log(" 4. Commit to Git to share with your team"),console.log("")}import{existsSync as PW}from"node:fs";function az(f){return f.replace(/\\r\\n/g,`
|
|
203
203
|
`).replace(/\\n/g,`
|
|
204
|
-
`)}function o1(f){let $=f||process.cwd();if(!
|
|
204
|
+
`)}function o1(f){let $=f||process.cwd();if(!PW($))throw Error(`目录不存在: ${$}`);return K0({type:"filesystem",config:V0($)})}async function tz(f,$,M){try{let Y=o1(M.dir),J=M.priority?Number.parseInt(M.priority,10):5;await Y.createMemory({uri:f,content:az($),priority:J,disclosure:M.disclosure}),console.log("OK")}catch(Y){console.error(Y instanceof Error?Y.message:String(Y)),process.exit(1)}}async function ez(f,$){try{let Y=await o1($.dir).getMemory(f);if(!Y)console.error("Memory not found"),process.exit(1);if(!Y.content||Y.content.trim()===""){console.log("No Content");return}console.log(Y.content)}catch(M){console.error(M instanceof Error?M.message:String(M)),process.exit(1)}}async function f6(f,$,M){try{let Y=o1(M.dir),J={uri:f,content:az($)};if(M.priority)J.priority=Number.parseInt(M.priority,10);if(M.disclosure)J.disclosure=M.disclosure;await Y.updateMemory(J),console.log("OK")}catch(Y){console.error(Y instanceof Error?Y.message:String(Y)),process.exit(1)}}async function $6(f,$){try{await o1($.dir).deleteMemory(f,{recursive:$.recursive}),console.log("OK")}catch(M){console.error(M instanceof Error?M.message:String(M)),process.exit(1)}}async function M6(f,$){try{let M=o1($.dir),Y=$.limit?Number.parseInt($.limit,10):10,J=await M.searchMemory(f,{domain:$.domain,limit:Y});if(J.length===0){console.log(`No memories found matching "${f}"`);return}let z=(X,Q,G=50)=>{if(X.length<=G)return X;let D=X.toLowerCase(),U=Q.toLowerCase(),K=D.indexOf(U);if(K===-1)return`${X.slice(0,G-3)}...`;let W=Q.length,B=K-Math.floor((G-W)/2),O=K+W+Math.ceil((G-W)/2);if(B<0)O+=-B,B=0;if(O>X.length)B-=O-X.length,O=X.length;B=Math.max(0,B);let F=X.slice(B,O);if(B>0)F=`...${F}`;if(O<X.length)F=`${F}...`;return F},Z=J.map((X)=>{let Q=[`- ${X.uri} [★${X.priority}]`,` content: ${z(X.content,f)}`];if(X.disclosure)Q.splice(1,0,` disclosure: ${X.disclosure}`);return Q.join(`
|
|
205
205
|
`)}).join(`
|
|
206
206
|
|
|
207
207
|
`);console.log(`Found ${J.length} memories:
|
|
208
208
|
|
|
209
|
-
${Z}`)}catch(M){console.error(M instanceof Error?M.message:String(M)),process.exit(1)}}async function
|
|
209
|
+
${Z}`)}catch(M){console.error(M instanceof Error?M.message:String(M)),process.exit(1)}}async function Y6(f){try{let $=o1(f.dir),M=f.limit?Number.parseInt(f.limit,10):void 0,Y=await $.getAllMemories({domain:f.domain}),J=M?Y.slice(0,M):Y;if(J.length===0){console.log("No memories found.");return}let z=(D,U=50)=>{if(D.length<=U)return D;return`${D.slice(0,U-3)}...`},Z=J.map((D)=>{let U=[`- ${D.uri} [★${D.priority}]`,` content: ${z(D.content)}`];if(D.disclosure)U.splice(1,0,` disclosure: ${D.disclosure}`);return U.join(`
|
|
210
210
|
`)}).join(`
|
|
211
211
|
|
|
212
212
|
`),X=Y.length,Q=J.length,G=M&&X>M?`Showing ${Q} of ${X} memories`:`Total: ${X} memories`;console.log(`${G}
|
|
213
213
|
|
|
214
|
-
${Z}`)}catch($){console.error($ instanceof Error?$.message:String($)),process.exit(1)}}async function Y6(f,$,M){try{let Y=o1(M.dir),J={newUri:f,targetUri:$};if(M.priority)J.priority=Number.parseInt(M.priority,10);if(M.disclosure)J.disclosure=M.disclosure;await Y.addAlias(J),console.log("OK")}catch(Y){console.error(Y instanceof Error?Y.message:String(Y)),process.exit(1)}}var _1=new Xf("memory").description("Memory 管理操作 (无需 init,直接使用当前目录)");_1.command("create <uri> <content>").description("创建新记忆").option("-p, --priority <number>","优先级 (1-10)","5").option("-d, --disclosure <string>","触发条件").option("--dir <directory>","项目根目录 (默认: .)",".").action(az);_1.command("read <uri>").description("读取指定记忆").option("--dir <directory>","项目根目录 (默认: .)",".").action(tz);_1.command("update <uri> <content>").description("更新记忆内容").option("-p, --priority <number>","优先级 (1-10)").option("-d, --disclosure <string>","触发条件").option("--dir <directory>","项目根目录 (默认: .)",".").action(ez);_1.command("delete <uri>").description("删除记忆").option("-r, --recursive","递归删除子记忆").option("--permanent","永久删除(不进入回收站)").option("--dir <directory>","项目根目录 (默认: .)",".").action(f6);_1.command("search <query>").description("搜索记忆").option("--domain <string>","限定域名").option("-l, --limit <number>","结果数量","10").option("--dir <directory>","项目根目录 (默认: .)",".").action($6);_1.command("alias <newUri> <targetUri>").description("为已有记忆添加别名").option("-p, --priority <number>","别名优先级 (继承目标默认)").option("-d, --disclosure <string>","别名触发条件").option("--dir <directory>","项目根目录 (默认: .)",".").action(Y6);_1.command("list").description("列出所有记忆").option("--domain <string>","限定域名").option("-l, --limit <number>","结果数量").option("--dir <directory>","项目根目录 (默认: .)",".").action(async(f)=>{await M6(f)});var J6=_1;import{join as $8}from"node:path";import{createServer as LW}from"http";import{Http2ServerRequest as PW}from"http2";import{Http2ServerRequest as F2}from"http2";import{Readable as z6}from"stream";import vW from"crypto";var s1=class extends Error{constructor(f,$){super(f,$);this.name="RequestError"}},TW=(f)=>{if(f instanceof s1)return f;return new s1(f.message,{cause:f})},wW=global.Request,t0=class extends wW{constructor(f,$){if(typeof f==="object"&&N0 in f)f=f[N0]();if(typeof $?.body?.getReader<"u")$.duplex??="half";super(f,$)}},jW=(f)=>{let $=[],M=f.rawHeaders;for(let Y=0;Y<M.length;Y+=2){let{[Y]:J,[Y+1]:z}=M;if(J.charCodeAt(0)!==58)$.push([J,z])}return new Headers($)},X6=Symbol("wrapBodyStream"),IW=(f,$,M,Y,J)=>{let z={method:f,headers:M,signal:J.signal};if(f==="TRACE"){z.method="GET";let Z=new t0($,z);return Object.defineProperty(Z,"method",{get(){return"TRACE"}}),Z}if(!(f==="GET"||f==="HEAD"))if("rawBody"in Y&&Y.rawBody instanceof Buffer)z.body=new ReadableStream({start(Z){Z.enqueue(Y.rawBody),Z.close()}});else if(Y[X6]){let Z;z.body=new ReadableStream({async pull(X){try{Z||=z6.toWeb(Y).getReader();let{done:Q,value:G}=await Z.read();if(Q)X.close();else X.enqueue(G)}catch(Q){X.error(Q)}}})}else z.body=z6.toWeb(Y);return new t0($,z)},N0=Symbol("getRequestCache"),CW=Symbol("requestCache"),nf=Symbol("incomingKey"),rf=Symbol("urlKey"),EW=Symbol("headersKey"),R0=Symbol("abortControllerKey"),xW=Symbol("getAbortController"),pf={get method(){return this[nf].method||"GET"},get url(){return this[rf]},get headers(){return this[EW]||=jW(this[nf])},[xW](){return this[N0](),this[R0]},[N0](){return this[R0]||=new AbortController,this[CW]||=IW(this.method,this[rf],this.headers,this[nf],this[R0])}};["body","bodyUsed","cache","credentials","destination","integrity","mode","redirect","referrer","referrerPolicy","signal","keepalive"].forEach((f)=>{Object.defineProperty(pf,f,{get(){return this[N0]()[f]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach((f)=>{Object.defineProperty(pf,f,{value:function(){return this[N0]()[f]()}})});Object.setPrototypeOf(pf,t0.prototype);var yW=(f,$)=>{let M=Object.create(pf);M[nf]=f;let Y=f.url||"";if(Y[0]!=="/"&&(Y.startsWith("http://")||Y.startsWith("https://"))){if(f instanceof F2)throw new s1("Absolute URL for :path is not allowed in HTTP/2");try{let X=new URL(Y);M[rf]=X.href}catch(X){throw new s1("Invalid absolute URL",{cause:X})}return M}let J=(f instanceof F2?f.authority:f.headers.host)||$;if(!J)throw new s1("Missing host header");let z;if(f instanceof F2){if(z=f.scheme,!(z==="http"||z==="https"))throw new s1("Unsupported scheme")}else z=f.socket&&f.socket.encrypted?"https":"http";let Z=new URL(`${z}://${J}${Y}`);if(Z.hostname.length!==J.length&&Z.hostname!==J.replace(/:\d+$/,""))throw new s1("Invalid host header");return M[rf]=Z.href,M},Z6=Symbol("responseCache"),F0=Symbol("getResponseCache"),a1=Symbol("cache"),N2=global.Response,e0=class f{#$;#f;[F0](){return delete this[a1],this[Z6]||=new N2(this.#$,this.#f)}constructor($,M){let Y;if(this.#$=$,M instanceof f){let J=M[Z6];if(J){this.#f=J,this[F0]();return}else this.#f=M.#f,Y=new Headers(M.#f.headers)}else this.#f=M;if(typeof $==="string"||typeof $?.getReader<"u"||$ instanceof Blob||$ instanceof Uint8Array)Y||=M?.headers||{"content-type":"text/plain; charset=UTF-8"},this[a1]=[M?.status||200,$,Y]}get headers(){let $=this[a1];if($){if(!($[2]instanceof Headers))$[2]=new Headers($[2]);return $[2]}return this[F0]().headers}get status(){return this[a1]?.[0]??this[F0]().status}get ok(){let $=this.status;return $>=200&&$<300}};["body","bodyUsed","redirected","statusText","trailers","type","url"].forEach((f)=>{Object.defineProperty(e0.prototype,f,{get(){return this[F0]()[f]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach((f)=>{Object.defineProperty(e0.prototype,f,{value:function(){return this[F0]()[f]()}})});Object.setPrototypeOf(e0,N2);Object.setPrototypeOf(e0.prototype,N2.prototype);async function kW(f){return Promise.race([f,Promise.resolve().then(()=>Promise.resolve(void 0))])}function Q6(f,$,M){let Y=(X)=>{f.cancel(X).catch(()=>{})};return $.on("close",Y),$.on("error",Y),(M??f.read()).then(Z,J),f.closed.finally(()=>{$.off("close",Y),$.off("error",Y)});function J(X){if(X)$.destroy(X)}function z(){f.read().then(Z,J)}function Z({done:X,value:Q}){try{if(X)$.end();else if(!$.write(Q))$.once("drain",z);else return f.read().then(Z,J)}catch(G){J(G)}}}function bW(f,$){if(f.locked)throw TypeError("ReadableStream is locked.");else if($.destroyed)return;return Q6(f.getReader(),$)}var G6=(f)=>{let $={};if(!(f instanceof Headers))f=new Headers(f??void 0);let M=[];for(let[Y,J]of f)if(Y==="set-cookie")M.push(J);else $[Y]=J;if(M.length>0)$["set-cookie"]=M;return $["content-type"]??="text/plain; charset=UTF-8",$},_W="x-hono-already-sent";if(typeof global.crypto>"u")global.crypto=vW;var A2=Symbol("outgoingEnded"),uW=()=>new Response(null,{status:400}),D6=(f)=>new Response(null,{status:f instanceof Error&&(f.name==="TimeoutError"||f.constructor.name==="TimeoutError")?504:500}),R2=(f,$)=>{let M=f instanceof Error?f:Error("unknown error",{cause:f});if(M.code==="ERR_STREAM_PREMATURE_CLOSE")console.info("The user aborted a request.");else{if(console.error(f),!$.headersSent)$.writeHead(500,{"Content-Type":"text/plain"});$.end(`Error: ${M.message}`),$.destroy(M)}},U6=(f)=>{if("flushHeaders"in f&&f.writable)f.flushHeaders()},W6=async(f,$)=>{let[M,Y,J]=f[a1];if(J instanceof Headers)J=G6(J);if(typeof Y==="string")J["Content-Length"]=Buffer.byteLength(Y);else if(Y instanceof Uint8Array)J["Content-Length"]=Y.byteLength;else if(Y instanceof Blob)J["Content-Length"]=Y.size;if($.writeHead(M,J),typeof Y==="string"||Y instanceof Uint8Array)$.end(Y);else if(Y instanceof Blob)$.end(new Uint8Array(await Y.arrayBuffer()));else U6($),await bW(Y,$)?.catch((z)=>R2(z,$));$[A2]?.()},hW=(f)=>typeof f.then==="function",gW=async(f,$,M={})=>{if(hW(f))if(M.errorHandler)try{f=await f}catch(J){let z=await M.errorHandler(J);if(!z)return;f=z}else f=await f.catch(D6);if(a1 in f)return W6(f,$);let Y=G6(f.headers);if(f.body){let J=f.body.getReader(),z=[],Z=!1,X=void 0;if(Y["transfer-encoding"]!=="chunked"){let Q=2;for(let G=0;G<Q;G++){X||=J.read();let D=await kW(X).catch((U)=>{console.error(U),Z=!0});if(!D){if(G===1){await new Promise((U)=>setTimeout(U)),Q=3;continue}break}if(X=void 0,D.value)z.push(D.value);if(D.done){Z=!0;break}}if(Z&&!("content-length"in Y))Y["content-length"]=z.reduce((G,D)=>G+D.length,0)}if($.writeHead(f.status,Y),z.forEach((Q)=>{$.write(Q)}),Z)$.end();else{if(z.length===0)U6($);await Q6(J,$,X)}}else if(Y[_W]);else $.writeHead(f.status,Y),$.end();$[A2]?.()},cW=(f,$={})=>{let M=$.autoCleanupIncoming??!0;if($.overrideGlobalObjects!==!1&&global.Request!==t0)Object.defineProperty(global,"Request",{value:t0}),Object.defineProperty(global,"Response",{value:e0});return async(Y,J)=>{let z,Z;try{Z=yW(Y,$.hostname);let X=!M||Y.method==="GET"||Y.method==="HEAD";if(!X){if(Y[X6]=!0,Y.on("end",()=>{X=!0}),Y instanceof PW)J[A2]=()=>{if(!X)setTimeout(()=>{if(!X)setTimeout(()=>{Y.destroy(),J.destroy()})})}}if(J.on("close",()=>{if(Z[R0]){if(Y.errored)Z[R0].abort(Y.errored.toString());else if(!J.writableFinished)Z[R0].abort("Client connection prematurely closed.")}if(!X)setTimeout(()=>{if(!X)setTimeout(()=>{Y.destroy()})})}),z=f(Z,{incoming:Y,outgoing:J}),a1 in z)return W6(z,J)}catch(X){if(!z)if($.errorHandler){if(z=await $.errorHandler(Z?X:TW(X)),!z)return}else if(!Z)z=uW();else z=D6(X);else return R2(X,J)}try{return await gW(z,J,$)}catch(X){return R2(X,J)}}},mW=(f)=>{let $=f.fetch,M=cW($,{hostname:f.hostname,overrideGlobalObjects:f.overrideGlobalObjects,autoCleanupIncoming:f.autoCleanupIncoming});return(f.createServer||LW)(f.serverOptions||{},M)},K6=(f,$)=>{let M=mW(f);return M.listen(f?.port??3000,f.hostname,()=>{let Y=M.address();$&&$(Y)}),M};var V6=(f,$=lW)=>{let M=/\.([a-zA-Z0-9]+?)$/,Y=f.match(M);if(!Y)return;let J=$[Y[1]];if(J&&J.startsWith("text"))J+="; charset=utf-8";return J};var dW={aac:"audio/aac",avi:"video/x-msvideo",avif:"image/avif",av1:"video/av1",bin:"application/octet-stream",bmp:"image/bmp",css:"text/css",csv:"text/csv",eot:"application/vnd.ms-fontobject",epub:"application/epub+zip",gif:"image/gif",gz:"application/gzip",htm:"text/html",html:"text/html",ico:"image/x-icon",ics:"text/calendar",jpeg:"image/jpeg",jpg:"image/jpeg",js:"text/javascript",json:"application/json",jsonld:"application/ld+json",map:"application/json",mid:"audio/x-midi",midi:"audio/x-midi",mjs:"text/javascript",mp3:"audio/mpeg",mp4:"video/mp4",mpeg:"video/mpeg",oga:"audio/ogg",ogv:"video/ogg",ogx:"application/ogg",opus:"audio/opus",otf:"font/otf",pdf:"application/pdf",png:"image/png",rtf:"application/rtf",svg:"image/svg+xml",tif:"image/tiff",tiff:"image/tiff",ts:"video/mp2t",ttf:"font/ttf",txt:"text/plain",wasm:"application/wasm",webm:"video/webm",weba:"audio/webm",webmanifest:"application/manifest+json",webp:"image/webp",woff:"font/woff",woff2:"font/woff2",xhtml:"application/xhtml+xml",xml:"application/xml",zip:"application/zip","3gp":"video/3gpp","3g2":"video/3gpp2",gltf:"model/gltf+json",glb:"model/gltf-binary"},lW=dW;import{createReadStream as q6,statSync as nW,existsSync as rW}from"fs";import{join as B6}from"path";import{versions as pW}from"process";import{Readable as iW}from"stream";var oW=/^\s*(?:text\/[^;\s]+|application\/(?:javascript|json|xml|xml-dtd|ecmascript|dart|postscript|rtf|tar|toml|vnd\.dart|vnd\.ms-fontobject|vnd\.ms-opentype|wasm|x-httpd-php|x-javascript|x-ns-proxy-autoconfig|x-sh|x-tar|x-virtualbox-hdd|x-virtualbox-ova|x-virtualbox-ovf|x-virtualbox-vbox|x-virtualbox-vdi|x-virtualbox-vhd|x-virtualbox-vmdk|x-www-form-urlencoded)|font\/(?:otf|ttf)|image\/(?:bmp|vnd\.adobe\.photoshop|vnd\.microsoft\.icon|vnd\.ms-dds|x-icon|x-ms-bmp)|message\/rfc822|model\/gltf-binary|x-shader\/x-fragment|x-shader\/x-vertex|[^;\s]+?\+(?:json|text|xml|yaml))(?:[;\s]|$)/i,L2={br:".br",zstd:".zst",gzip:".gz"},sW=Object.keys(L2),aW=()=>{let[f,$]=pW.node.split(".").map((M)=>parseInt(M));return f>=23||f===22&&$>=7||f===20&&$>=18},tW=aW(),H6=(f)=>{if(tW)return iW.toWeb(f);return new ReadableStream({start(M){f.on("data",(Y)=>{M.enqueue(Y)}),f.on("error",(Y)=>{M.error(Y)}),f.on("end",()=>{M.close()})},cancel(){f.destroy()}})},O2=(f)=>{let $;try{$=nW(f)}catch{}return $},P2=(f={root:""})=>{let $=f.root||"",M=f.path;if($!==""&&!rW($))console.error(`serveStatic: root path '${$}' is not found, are you sure it's correct?`);return async(Y,J)=>{if(Y.finalized)return J();let z;if(M)z=M;else try{if(z=decodeURIComponent(Y.req.path),/(?:^|[\/\\])\.\.(?:$|[\/\\])/.test(z))throw Error()}catch{return await f.onNotFound?.(Y.req.path,Y),J()}let Z=B6($,!M&&f.rewriteRequestPath?f.rewriteRequestPath(z,Y):z),X=O2(Z);if(X&&X.isDirectory()){let K=f.index??"index.html";Z=B6(Z,K),X=O2(Z)}if(!X)return await f.onNotFound?.(Z,Y),J();let Q=V6(Z);if(Y.header("Content-Type",Q||"application/octet-stream"),f.precompressed&&(!Q||oW.test(Q))){let K=new Set(Y.req.header("Accept-Encoding")?.split(",").map((W)=>W.trim()));for(let W of sW){if(!K.has(W))continue;let B=O2(Z+L2[W]);if(B){Y.header("Content-Encoding",W),Y.header("Vary","Accept-Encoding",{append:!0}),X=B,Z=Z+L2[W];break}}}let G,D=X.size,U=Y.req.header("range")||"";if(Y.req.method=="HEAD"||Y.req.method=="OPTIONS")Y.header("Content-Length",D.toString()),Y.status(200),G=Y.body(null);else if(!U)Y.header("Content-Length",D.toString()),G=Y.body(H6(q6(Z)),200);else{Y.header("Accept-Ranges","bytes"),Y.header("Date",X.birthtime.toUTCString());let K=U.replace(/bytes=/,"").split("-",2),W=parseInt(K[0],10)||0,B=parseInt(K[1],10)||D-1;if(D<B-W+1)B=D-1;let A=B-W+1,F=q6(Z,{start:W,end:B});Y.header("Content-Length",A.toString()),Y.header("Content-Range",`bytes ${W}-${B}/${X.size}`),G=Y.body(H6(F),206)}return await f.onFound?.(Z,Y),G}};var T2=(f,$,M)=>{return(Y,J)=>{let z=-1;return Z(0);async function Z(X){if(X<=z)throw Error("next() called multiple times");z=X;let Q,G=!1,D;if(f[X])D=f[X][0][0],Y.req.routeIndex=X;else D=X===f.length&&J||void 0;if(D)try{Q=await D(Y,()=>Z(X+1))}catch(U){if(U instanceof Error&&$)Y.error=U,Q=await $(U,Y),G=!0;else throw U}else if(Y.finalized===!1&&M)Q=await M(Y);if(Q&&(Y.finalized===!1||G))Y.res=Q;return Y}}};var S6=Symbol();var F6=async(f,$=Object.create(null))=>{let{all:M=!1,dot:Y=!1}=$,z=(f instanceof of?f.raw.headers:f.headers).get("Content-Type");if(z?.startsWith("multipart/form-data")||z?.startsWith("application/x-www-form-urlencoded"))return eW(f,{all:M,dot:Y});return{}};async function eW(f,$){let M=await f.formData();if(M)return fK(M,$);return{}}function fK(f,$){let M=Object.create(null);if(f.forEach((Y,J)=>{if(!($.all||J.endsWith("[]")))M[J]=Y;else $K(M,J,Y)}),$.dot)Object.entries(M).forEach(([Y,J])=>{if(Y.includes("."))MK(M,Y,J),delete M[Y]});return M}var $K=(f,$,M)=>{if(f[$]!==void 0)if(Array.isArray(f[$]))f[$].push(M);else f[$]=[f[$],M];else if(!$.endsWith("[]"))f[$]=M;else f[$]=[M]},MK=(f,$,M)=>{let Y=f,J=$.split(".");J.forEach((z,Z)=>{if(Z===J.length-1)Y[z]=M;else{if(!Y[z]||typeof Y[z]!=="object"||Array.isArray(Y[z])||Y[z]instanceof File)Y[z]=Object.create(null);Y=Y[z]}})};var j2=(f)=>{let $=f.split("/");if($[0]==="")$.shift();return $},R6=(f)=>{let{groups:$,path:M}=YK(f),Y=j2(M);return JK(Y,$)},YK=(f)=>{let $=[];return f=f.replace(/\{[^}]+\}/g,(M,Y)=>{let J=`@${Y}`;return $.push([J,M]),J}),{groups:$,path:f}},JK=(f,$)=>{for(let M=$.length-1;M>=0;M--){let[Y]=$[M];for(let J=f.length-1;J>=0;J--)if(f[J].includes(Y)){f[J]=f[J].replace(Y,$[M][1]);break}}return f},sf={},N6=(f,$)=>{if(f==="*")return"*";let M=f.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(M){let Y=`${f}#${$}`;if(!sf[Y])if(M[2])sf[Y]=$&&$[0]!==":"&&$[0]!=="*"?[Y,M[1],new RegExp(`^${M[2]}(?=/${$})`)]:[f,M[1],new RegExp(`^${M[2]}$`)];else sf[Y]=[f,M[1],!0];return sf[Y]}return null},af=(f,$)=>{try{return $(f)}catch{return f.replace(/(?:%[0-9A-Fa-f]{2})+/g,(M)=>{try{return $(M)}catch{return M}})}},zK=(f)=>af(f,decodeURI),I2=(f)=>{let $=f.url,M=$.indexOf("/",$.indexOf(":")+4),Y=M;for(;Y<$.length;Y++){let J=$.charCodeAt(Y);if(J===37){let z=$.indexOf("?",Y),Z=$.indexOf("#",Y),X=z===-1?Z===-1?void 0:Z:Z===-1?z:Math.min(z,Z),Q=$.slice(M,X);return zK(Q.includes("%25")?Q.replace(/%25/g,"%2525"):Q)}else if(J===63||J===35)break}return $.slice(M,Y)};var A6=(f)=>{let $=I2(f);return $.length>1&&$.at(-1)==="/"?$.slice(0,-1):$},t1=(f,$,...M)=>{if(M.length)$=t1($,...M);return`${f?.[0]==="/"?"":"/"}${f}${$==="/"?"":`${f?.at(-1)==="/"?"":"/"}${$?.[0]==="/"?$.slice(1):$}`}`},tf=(f)=>{if(f.charCodeAt(f.length-1)!==63||!f.includes(":"))return null;let $=f.split("/"),M=[],Y="";return $.forEach((J)=>{if(J!==""&&!/\:/.test(J))Y+="/"+J;else if(/\:/.test(J))if(/\?/.test(J)){if(M.length===0&&Y==="")M.push("/");else M.push(Y);let z=J.replace("?","");Y+="/"+z,M.push(Y)}else Y+="/"+J}),M.filter((J,z,Z)=>Z.indexOf(J)===z)},w2=(f)=>{if(!/[%+]/.test(f))return f;if(f.indexOf("+")!==-1)f=f.replace(/\+/g," ");return f.indexOf("%")!==-1?af(f,C2):f},O6=(f,$,M)=>{let Y;if(!M&&$&&!/[%+]/.test($)){let Z=f.indexOf("?",8);if(Z===-1)return;if(!f.startsWith($,Z+1))Z=f.indexOf(`&${$}`,Z+1);while(Z!==-1){let X=f.charCodeAt(Z+$.length+1);if(X===61){let Q=Z+$.length+2,G=f.indexOf("&",Q);return w2(f.slice(Q,G===-1?void 0:G))}else if(X==38||isNaN(X))return"";Z=f.indexOf(`&${$}`,Z+1)}if(Y=/[%+]/.test(f),!Y)return}let J={};Y??=/[%+]/.test(f);let z=f.indexOf("?",8);while(z!==-1){let Z=f.indexOf("&",z+1),X=f.indexOf("=",z);if(X>Z&&Z!==-1)X=-1;let Q=f.slice(z+1,X===-1?Z===-1?void 0:Z:X);if(Y)Q=w2(Q);if(z=Z,Q==="")continue;let G;if(X===-1)G="";else if(G=f.slice(X+1,Z===-1?void 0:Z),Y)G=w2(G);if(M){if(!(J[Q]&&Array.isArray(J[Q])))J[Q]=[];J[Q].push(G)}else J[Q]??=G}return $?J[$]:J},L6=O6,P6=(f,$)=>{return O6(f,$,!0)},C2=decodeURIComponent;var T6=(f)=>af(f,C2),of=class{raw;#$;#f;routeIndex=0;path;bodyCache={};constructor(f,$="/",M=[[]]){this.raw=f,this.path=$,this.#f=M,this.#$={}}param(f){return f?this.#M(f):this.#z()}#M(f){let $=this.#f[0][this.routeIndex][1][f],M=this.#J($);return M&&/\%/.test(M)?T6(M):M}#z(){let f={},$=Object.keys(this.#f[0][this.routeIndex][1]);for(let M of $){let Y=this.#J(this.#f[0][this.routeIndex][1][M]);if(Y!==void 0)f[M]=/\%/.test(Y)?T6(Y):Y}return f}#J(f){return this.#f[1]?this.#f[1][f]:f}query(f){return L6(this.url,f)}queries(f){return P6(this.url,f)}header(f){if(f)return this.raw.headers.get(f)??void 0;let $={};return this.raw.headers.forEach((M,Y)=>{$[Y]=M}),$}async parseBody(f){return this.bodyCache.parsedBody??=await F6(this,f)}#Y=(f)=>{let{bodyCache:$,raw:M}=this,Y=$[f];if(Y)return Y;let J=Object.keys($)[0];if(J)return $[J].then((z)=>{if(J==="json")z=JSON.stringify(z);return new Response(z)[f]()});return $[f]=M[f]()};json(){return this.#Y("text").then((f)=>JSON.parse(f))}text(){return this.#Y("text")}arrayBuffer(){return this.#Y("arrayBuffer")}blob(){return this.#Y("blob")}formData(){return this.#Y("formData")}addValidatedData(f,$){this.#$[f]=$}valid(f){return this.#$[f]}get url(){return this.raw.url}get method(){return this.raw.method}get[S6](){return this.#f}get matchedRoutes(){return this.#f[0].map(([[,f]])=>f)}get routePath(){return this.#f[0].map(([[,f]])=>f)[this.routeIndex].path}};var w6={Stringify:1,BeforeStream:2,Stream:3},ZK=(f,$)=>{let M=new String(f);return M.isEscaped=!0,M.callbacks=$,M};var E2=async(f,$,M,Y,J)=>{if(typeof f==="object"&&!(f instanceof String)){if(!(f instanceof Promise))f=f.toString();if(f instanceof Promise)f=await f}let z=f.callbacks;if(!z?.length)return Promise.resolve(f);if(J)J[0]+=f;else J=[f];let Z=Promise.all(z.map((X)=>X({phase:$,buffer:J,context:Y}))).then((X)=>Promise.all(X.filter(Boolean).map((Q)=>E2(Q,$,!1,Y,J))).then(()=>J[0]));if(M)return ZK(await Z,z);else return Z};var XK="text/plain; charset=UTF-8",x2=(f,$)=>{return{"Content-Type":f,...$}},A0=(f,$)=>new Response(f,$),j6=class{#$;#f;env={};#M;finalized=!1;error;#z;#J;#Y;#D;#Q;#G;#X;#U;#W;constructor(f,$){if(this.#$=f,$)this.#J=$.executionCtx,this.env=$.env,this.#G=$.notFoundHandler,this.#W=$.path,this.#U=$.matchResult}get req(){return this.#f??=new of(this.#$,this.#W,this.#U),this.#f}get event(){if(this.#J&&"respondWith"in this.#J)return this.#J;else throw Error("This context has no FetchEvent")}get executionCtx(){if(this.#J)return this.#J;else throw Error("This context has no ExecutionContext")}get res(){return this.#Y||=A0(null,{headers:this.#X??=new Headers})}set res(f){if(this.#Y&&f){f=A0(f.body,f);for(let[$,M]of this.#Y.headers.entries()){if($==="content-type")continue;if($==="set-cookie"){let Y=this.#Y.headers.getSetCookie();f.headers.delete("set-cookie");for(let J of Y)f.headers.append("set-cookie",J)}else f.headers.set($,M)}}this.#Y=f,this.finalized=!0}render=(...f)=>{return this.#Q??=($)=>this.html($),this.#Q(...f)};setLayout=(f)=>this.#D=f;getLayout=()=>this.#D;setRenderer=(f)=>{this.#Q=f};header=(f,$,M)=>{if(this.finalized)this.#Y=A0(this.#Y.body,this.#Y);let Y=this.#Y?this.#Y.headers:this.#X??=new Headers;if($===void 0)Y.delete(f);else if(M?.append)Y.append(f,$);else Y.set(f,$)};status=(f)=>{this.#z=f};set=(f,$)=>{this.#M??=new Map,this.#M.set(f,$)};get=(f)=>{return this.#M?this.#M.get(f):void 0};get var(){if(!this.#M)return{};return Object.fromEntries(this.#M)}#Z(f,$,M){let Y=this.#Y?new Headers(this.#Y.headers):this.#X??new Headers;if(typeof $==="object"&&"headers"in $){let z=$.headers instanceof Headers?$.headers:new Headers($.headers);for(let[Z,X]of z)if(Z.toLowerCase()==="set-cookie")Y.append(Z,X);else Y.set(Z,X)}if(M)for(let[z,Z]of Object.entries(M))if(typeof Z==="string")Y.set(z,Z);else{Y.delete(z);for(let X of Z)Y.append(z,X)}let J=typeof $==="number"?$:$?.status??this.#z;return A0(f,{status:J,headers:Y})}newResponse=(...f)=>this.#Z(...f);body=(f,$,M)=>this.#Z(f,$,M);#K(){return!this.#X&&!this.#z&&!this.finalized}text=(f,$,M)=>{return this.#K()&&!$&&!M?A0(f):this.#Z(f,$,x2(XK,M))};json=(f,$,M)=>{return this.#K()&&!$&&!M?Response.json(f):this.#Z(JSON.stringify(f),$,x2("application/json",M))};html=(f,$,M)=>{let Y=(J)=>this.#Z(J,$,x2("text/html; charset=UTF-8",M));return typeof f==="object"?E2(f,w6.Stringify,!1,{}).then(Y):Y(f)};redirect=(f,$)=>{let M=String(f);return this.header("Location",!/[^\x00-\xFF]/.test(M)?M:encodeURI(M)),this.newResponse(null,$??302)};notFound=()=>{return this.#G??=()=>A0(),this.#G(this)}};var I="ALL",I6="all",C6=["get","post","put","delete","options","patch"],ef="Can not add a route since the matcher is already built.",f$=class extends Error{};var E6="__COMPOSED_HANDLER";var QK=(f)=>{return f.text("404 Not Found",404)},x6=(f,$)=>{if("getResponse"in f){let M=f.getResponse();return $.newResponse(M.body,M)}return console.error(f),$.text("Internal Server Error",500)},y6=class f{get;post;put;delete;options;patch;all;on;use;router;getPath;_basePath="/";#$="/";routes=[];constructor($={}){[...C6,I6].forEach((z)=>{this[z]=(Z,...X)=>{if(typeof Z==="string")this.#$=Z;else this.#z(z,this.#$,Z);return X.forEach((Q)=>{this.#z(z,this.#$,Q)}),this}}),this.on=(z,Z,...X)=>{for(let Q of[Z].flat()){this.#$=Q;for(let G of[z].flat())X.map((D)=>{this.#z(G.toUpperCase(),this.#$,D)})}return this},this.use=(z,...Z)=>{if(typeof z==="string")this.#$=z;else this.#$="*",Z.unshift(z);return Z.forEach((X)=>{this.#z(I,this.#$,X)}),this};let{strict:Y,...J}=$;Object.assign(this,J),this.getPath=Y??!0?$.getPath??I2:A6}#f(){let $=new f({router:this.router,getPath:this.getPath});return $.errorHandler=this.errorHandler,$.#M=this.#M,$.routes=this.routes,$}#M=QK;errorHandler=x6;route($,M){let Y=this.basePath($);return M.routes.map((J)=>{let z;if(M.errorHandler===x6)z=J.handler;else z=async(Z,X)=>(await T2([],M.errorHandler)(Z,()=>J.handler(Z,X))).res,z[E6]=J.handler;Y.#z(J.method,J.path,z)}),this}basePath($){let M=this.#f();return M._basePath=t1(this._basePath,$),M}onError=($)=>{return this.errorHandler=$,this};notFound=($)=>{return this.#M=$,this};mount($,M,Y){let J,z;if(Y)if(typeof Y==="function")z=Y;else if(z=Y.optionHandler,Y.replaceRequest===!1)J=(Q)=>Q;else J=Y.replaceRequest;let Z=z?(Q)=>{let G=z(Q);return Array.isArray(G)?G:[G]}:(Q)=>{let G=void 0;try{G=Q.executionCtx}catch{}return[Q.env,G]};J||=(()=>{let Q=t1(this._basePath,$),G=Q==="/"?0:Q.length;return(D)=>{let U=new URL(D.url);return U.pathname=U.pathname.slice(G)||"/",new Request(U,D)}})();let X=async(Q,G)=>{let D=await M(J(Q.req.raw),...Z(Q));if(D)return D;await G()};return this.#z(I,t1($,"*"),X),this}#z($,M,Y){$=$.toUpperCase(),M=t1(this._basePath,M);let J={basePath:this._basePath,path:M,method:$,handler:Y};this.router.add($,M,[Y,J]),this.routes.push(J)}#J($,M){if($ instanceof Error)return this.errorHandler($,M);throw $}#Y($,M,Y,J){if(J==="HEAD")return(async()=>new Response(null,await this.#Y($,M,Y,"GET")))();let z=this.getPath($,{env:Y}),Z=this.router.match(J,z),X=new j6($,{path:z,matchResult:Z,env:Y,executionCtx:M,notFoundHandler:this.#M});if(Z[0].length===1){let G;try{G=Z[0][0][0][0](X,async()=>{X.res=await this.#M(X)})}catch(D){return this.#J(D,X)}return G instanceof Promise?G.then((D)=>D||(X.finalized?X.res:this.#M(X))).catch((D)=>this.#J(D,X)):G??this.#M(X)}let Q=T2(Z[0],this.errorHandler,this.#M);return(async()=>{try{let G=await Q(X);if(!G.finalized)throw Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return G.res}catch(G){return this.#J(G,X)}})()}fetch=($,...M)=>{return this.#Y($,M[1],M[0],$.method)};request=($,M,Y,J)=>{if($ instanceof Request)return this.fetch(M?new Request($,M):$,Y,J);return $=$.toString(),this.fetch(new Request(/^https?:\/\//.test($)?$:`http://localhost${t1("/",$)}`,M),Y,J)};fire=()=>{addEventListener("fetch",($)=>{$.respondWith(this.#Y($.request,$,void 0,$.request.method))})}};var ff=[];function $$(f,$){let M=this.buildAllMatchers(),Y=(J,z)=>{let Z=M[J]||M[I],X=Z[2][z];if(X)return X;let Q=z.match(Z[0]);if(!Q)return[[],ff];let G=Q.indexOf("",1);return[Z[1][G],Q]};return this.match=Y,Y(f,$)}var M$="[^/]+",$f=".*",Mf="(?:|/.*)",e1=Symbol(),GK=new Set(".\\+*[^]$()");function DK(f,$){if(f.length===1)return $.length===1?f<$?-1:1:-1;if($.length===1)return 1;if(f===$f||f===Mf)return 1;else if($===$f||$===Mf)return-1;if(f===M$)return 1;else if($===M$)return-1;return f.length===$.length?f<$?-1:1:$.length-f.length}var k6=class f{#$;#f;#M=Object.create(null);insert($,M,Y,J,z){if($.length===0){if(this.#$!==void 0)throw e1;if(z)return;this.#$=M;return}let[Z,...X]=$,Q=Z==="*"?X.length===0?["","",$f]:["","",M$]:Z==="/*"?["","",Mf]:Z.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/),G;if(Q){let D=Q[1],U=Q[2]||M$;if(D&&Q[2]){if(U===".*")throw e1;if(U=U.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(U))throw e1}if(G=this.#M[U],!G){if(Object.keys(this.#M).some((K)=>K!==$f&&K!==Mf))throw e1;if(z)return;if(G=this.#M[U]=new f,D!=="")G.#f=J.varIndex++}if(!z&&D!=="")Y.push([D,G.#f])}else if(G=this.#M[Z],!G){if(Object.keys(this.#M).some((D)=>D.length>1&&D!==$f&&D!==Mf))throw e1;if(z)return;G=this.#M[Z]=new f}G.insert(X,M,Y,J,z)}buildRegExpStr(){let M=Object.keys(this.#M).sort(DK).map((Y)=>{let J=this.#M[Y];return(typeof J.#f==="number"?`(${Y})@${J.#f}`:GK.has(Y)?`\\${Y}`:Y)+J.buildRegExpStr()});if(typeof this.#$==="number")M.unshift(`#${this.#$}`);if(M.length===0)return"";if(M.length===1)return M[0];return"(?:"+M.join("|")+")"}};var b6=class{#$={varIndex:0};#f=new k6;insert(f,$,M){let Y=[],J=[];for(let Z=0;;){let X=!1;if(f=f.replace(/\{[^}]+\}/g,(Q)=>{let G=`@\\${Z}`;return J[Z]=[G,Q],Z++,X=!0,G}),!X)break}let z=f.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let Z=J.length-1;Z>=0;Z--){let[X]=J[Z];for(let Q=z.length-1;Q>=0;Q--)if(z[Q].indexOf(X)!==-1){z[Q]=z[Q].replace(X,J[Z][1]);break}}return this.#f.insert(z,$,Y,this.#$,M),Y}buildRegExp(){let f=this.#f.buildRegExpStr();if(f==="")return[/^$/,[],[]];let $=0,M=[],Y=[];return f=f.replace(/#(\d+)|@(\d+)|\.\*\$/g,(J,z,Z)=>{if(z!==void 0)return M[++$]=Number(z),"$()";if(Z!==void 0)return Y[Number(Z)]=++$,"";return""}),[new RegExp(`^${f}`),M,Y]}};var UK=[/^$/,[],Object.create(null)],_6=Object.create(null);function v6(f){return _6[f]??=new RegExp(f==="*"?"":`^${f.replace(/\/\*$|([.\\+*[^\]$()])/g,($,M)=>M?`\\${M}`:"(?:|/.*)")}$`)}function WK(){_6=Object.create(null)}function KK(f){let $=new b6,M=[];if(f.length===0)return UK;let Y=f.map((G)=>[!/\*|\/:/.test(G[0]),...G]).sort(([G,D],[U,K])=>G?1:U?-1:D.length-K.length),J=Object.create(null);for(let G=0,D=-1,U=Y.length;G<U;G++){let[K,W,B]=Y[G];if(K)J[W]=[B.map(([F])=>[F,Object.create(null)]),ff];else D++;let A;try{A=$.insert(W,D,K)}catch(F){throw F===e1?new f$(W):F}if(K)continue;M[D]=B.map(([F,T])=>{let c=Object.create(null);T-=1;for(;T>=0;T--){let[r,J1]=A[T];c[r]=J1}return[F,c]})}let[z,Z,X]=$.buildRegExp();for(let G=0,D=M.length;G<D;G++)for(let U=0,K=M[G].length;U<K;U++){let W=M[G][U]?.[1];if(!W)continue;let B=Object.keys(W);for(let A=0,F=B.length;A<F;A++)W[B[A]]=X[W[B[A]]]}let Q=[];for(let G in Z)Q[G]=M[Z[G]];return[z,Q,J]}function O0(f,$){if(!f)return;for(let M of Object.keys(f).sort((Y,J)=>J.length-Y.length))if(v6(M).test($))return[...f[M]];return}var Y$=class{name="RegExpRouter";#$;#f;constructor(){this.#$={[I]:Object.create(null)},this.#f={[I]:Object.create(null)}}add(f,$,M){let Y=this.#$,J=this.#f;if(!Y||!J)throw Error(ef);if(!Y[f])[Y,J].forEach((X)=>{X[f]=Object.create(null),Object.keys(X[I]).forEach((Q)=>{X[f][Q]=[...X[I][Q]]})});if($==="/*")$="*";let z=($.match(/\/:/g)||[]).length;if(/\*$/.test($)){let X=v6($);if(f===I)Object.keys(Y).forEach((Q)=>{Y[Q][$]||=O0(Y[Q],$)||O0(Y[I],$)||[]});else Y[f][$]||=O0(Y[f],$)||O0(Y[I],$)||[];Object.keys(Y).forEach((Q)=>{if(f===I||f===Q)Object.keys(Y[Q]).forEach((G)=>{X.test(G)&&Y[Q][G].push([M,z])})}),Object.keys(J).forEach((Q)=>{if(f===I||f===Q)Object.keys(J[Q]).forEach((G)=>X.test(G)&&J[Q][G].push([M,z]))});return}let Z=tf($)||[$];for(let X=0,Q=Z.length;X<Q;X++){let G=Z[X];Object.keys(J).forEach((D)=>{if(f===I||f===D)J[D][G]||=[...O0(Y[D],G)||O0(Y[I],G)||[]],J[D][G].push([M,z-Q+X+1])})}}match=$$;buildAllMatchers(){let f=Object.create(null);return Object.keys(this.#f).concat(Object.keys(this.#$)).forEach(($)=>{f[$]||=this.#M($)}),this.#$=this.#f=void 0,WK(),f}#M(f){let $=[],M=f===I;if([this.#$,this.#f].forEach((Y)=>{let J=Y[f]?Object.keys(Y[f]).map((z)=>[z,Y[f][z]]):[];if(J.length!==0)M||=!0,$.push(...J);else if(f!==I)$.push(...Object.keys(Y[I]).map((z)=>[z,Y[I][z]]))}),!M)return null;else return KK($)}};var VK=class{name="PreparedRegExpRouter";#$;#f;constructor(f,$){this.#$=f,this.#f=$}#M(f,$){let M=this.#$[f];M[1].forEach((Y)=>Y&&Y.push($)),Object.values(M[2]).forEach((Y)=>Y[0].push($))}#z(f,$,M,Y,J){let z=this.#$[f];if(!J)z[2][$][0].push([M,{}]);else Y.forEach((Z)=>{if(typeof Z==="number")z[1][Z].push([M,J]);else z[2][Z||$][0].push([M,J])})}add(f,$,M){if(!this.#$[f]){let J=this.#$[I],z={};for(let Z in J[2])z[Z]=[J[2][Z][0].slice(),ff];this.#$[f]=[J[0],J[1].map((Z)=>Array.isArray(Z)?Z.slice():0),z]}if($==="/*"||$==="*"){let J=[M,{}];if(f===I)for(let z in this.#$)this.#M(z,J);else this.#M(f,J);return}let Y=this.#f[$];if(!Y)throw Error(`Path ${$} is not registered`);for(let[J,z]of Y)if(f===I)for(let Z in this.#$)this.#z(Z,$,M,J,z);else this.#z(f,$,M,J,z)}buildAllMatchers(){return this.#$}match=$$};var y2=class{name="SmartRouter";#$=[];#f=[];constructor(f){this.#$=f.routers}add(f,$,M){if(!this.#f)throw Error(ef);this.#f.push([f,$,M])}match(f,$){if(!this.#f)throw Error("Fatal error");let M=this.#$,Y=this.#f,J=M.length,z=0,Z;for(;z<J;z++){let X=M[z];try{for(let Q=0,G=Y.length;Q<G;Q++)X.add(...Y[Q]);Z=X.match(f,$)}catch(Q){if(Q instanceof f$)continue;throw Q}this.match=X.match.bind(X),this.#$=[X],this.#f=void 0;break}if(z===J)throw Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,Z}get activeRouter(){if(this.#f||this.#$.length!==1)throw Error("No active router has been determined yet.");return this.#$[0]}};var Yf=Object.create(null),qK=(f)=>{for(let $ in f)return!0;return!1},u6=class f{#$;#f;#M;#z=0;#J=Yf;constructor($,M,Y){if(this.#f=Y||Object.create(null),this.#$=[],$&&M){let J=Object.create(null);J[$]={handler:M,possibleKeys:[],score:0},this.#$=[J]}this.#M=[]}insert($,M,Y){this.#z=++this.#z;let J=this,z=R6(M),Z=[];for(let X=0,Q=z.length;X<Q;X++){let G=z[X],D=z[X+1],U=N6(G,D),K=Array.isArray(U)?U[0]:G;if(K in J.#f){if(J=J.#f[K],U)Z.push(U[1]);continue}if(J.#f[K]=new f,U)J.#M.push(U),Z.push(U[1]);J=J.#f[K]}return J.#$.push({[$]:{handler:Y,possibleKeys:Z.filter((X,Q,G)=>G.indexOf(X)===Q),score:this.#z}}),J}#Y($,M,Y,J,z){for(let Z=0,X=M.#$.length;Z<X;Z++){let Q=M.#$[Z],G=Q[Y]||Q[I],D={};if(G!==void 0){if(G.params=Object.create(null),$.push(G),J!==Yf||z&&z!==Yf)for(let U=0,K=G.possibleKeys.length;U<K;U++){let W=G.possibleKeys[U],B=D[G.score];G.params[W]=z?.[W]&&!B?z[W]:J[W]??z?.[W],D[G.score]=!0}}}}search($,M){let Y=[];this.#J=Yf;let z=[this],Z=j2(M),X=[],Q=Z.length,G=null;for(let D=0;D<Q;D++){let U=Z[D],K=D===Q-1,W=[];for(let A=0,F=z.length;A<F;A++){let T=z[A],c=T.#f[U];if(c)if(c.#J=T.#J,K){if(c.#f["*"])this.#Y(Y,c.#f["*"],$,T.#J);this.#Y(Y,c,$,T.#J)}else W.push(c);for(let r=0,J1=T.#M.length;r<J1;r++){let L0=T.#M[r],f1=T.#J===Yf?{}:{...T.#J};if(L0==="*"){let H1=T.#f["*"];if(H1)this.#Y(Y,H1,$,T.#J),H1.#J=f1,W.push(H1);continue}let[f0,_,w]=L0;if(!U&&!(w instanceof RegExp))continue;let p=T.#f[f0];if(w instanceof RegExp){if(G===null){G=Array(Q);let H=M[0]==="/"?1:0;for(let q=0;q<Q;q++)G[q]=H,H+=Z[q].length+1}let H1=M.substring(G[D]),O=w.exec(H1);if(O){if(f1[_]=O[0],this.#Y(Y,p,$,T.#J,f1),qK(p.#f)){p.#J=f1;let H=O[0].match(/\//)?.length??0;(X[H]||=[]).push(p)}continue}}if(w===!0||w.test(U))if(f1[_]=U,K){if(this.#Y(Y,p,$,f1,T.#J),p.#f["*"])this.#Y(Y,p.#f["*"],$,f1,T.#J)}else p.#J=f1,W.push(p)}}let B=X.shift();z=B?W.concat(B):W}if(Y.length>1)Y.sort((D,U)=>{return D.score-U.score});return[Y.map(({handler:D,params:U})=>[D,U])]}};var k2=class{name="TrieRouter";#$;constructor(){this.#$=new u6}add(f,$,M){let Y=tf($);if(Y){for(let J=0,z=Y.length;J<z;J++)this.#$.insert(f,Y[J],M);return}this.#$.insert(f,$,M)}match(f,$){return this.#$.search(f,$)}};var e=class extends y6{constructor(f={}){super(f);this.router=f.router??new y2({routers:[new Y$,new k2]})}};function n(f,$){return f.json({code:1,data:$,msg:""})}function X1(f,$){return f.json({code:-1,data:null,msg:$})}function h6(f){return async($)=>{let M=await $.req.json(),Y=await f.addAlias(M);if(!Y.success)return X1($,Y.error);return n($,Y.data)}}function g6(f){return async($)=>{let M=decodeURIComponent($.req.param("uri")??""),Y=await f.getChildren(M);return n($,Y)}}function c6(f){return async($)=>{let M=$.req.query("domain"),Y=await f.getAllMemories({domain:M,includeDeleted:!0});return n($,Y)}}function m6(f){return async($)=>{let M=$.req.query("uri"),Y=$.req.query("domain"),J=await f.getRelationships({uri:M,domain:Y});return n($,J)}}function d6(f){return async($)=>{let M=decodeURIComponent($.req.param("uri")??""),Y=$.req.query("includeDeleted")==="true";try{let J=await f.getMemory(M,{includeDeleted:Y});if(!J)return X1($,"Memory not found");return n($,J)}catch(J){return X1($,J instanceof Error?J.message:String(J))}}}function l6(f){return async($)=>{let M=await $.req.json();try{let Y=await f.createMemory(M);return n($,Y)}catch(Y){return X1($,Y instanceof Error?Y.message:String(Y))}}}function n6(f){return async($)=>{let M=decodeURIComponent($.req.param("uri")??""),Y=await $.req.json();try{let J=await f.updateMemory({...Y,uri:M});return n($,J)}catch(J){return X1($,J instanceof Error?J.message:String(J))}}}function r6(f){return async($)=>{let M=decodeURIComponent($.req.param("uri")??""),Y=$.req.query("recursive")==="true",J=$.req.query("permanent")==="true";try{return await f.deleteMemory(M,{recursive:Y,permanent:J}),n($,null)}catch(z){return X1($,z instanceof Error?z.message:String(z))}}}function p6(f){return async($)=>{let M=decodeURIComponent($.req.param("uri")??"");try{let Y=await f.restoreMemory(M);return n($,Y)}catch(Y){return X1($,Y instanceof Error?Y.message:String(Y))}}}function i6(f){return async($)=>{let M=$.req.query("q")??"",Y=$.req.query("domain"),J=$.req.query("limit")?Number.parseInt($.req.query("limit"),10):10;if(!M)return X1($,"Query parameter 'q' is required");let z=await f.searchMemory(M,{query:M,domain:Y,limit:J});return n($,z)}}function o6(f){let $=new e().basePath("/alias");return $.post("/",h6(f)),$}function s6(f){let $=new e().basePath("/children");return $.get("/:uri",g6(f)),$}function a6(f){let $=new e().basePath("/graph");return $.get("/nodes",c6(f)),$.get("/relationships",m6(f)),$}function t6(f){let $=new e().basePath("/memories");return $.get("/:uri",d6(f)),$.post("/",l6(f)),$.put("/:uri",n6(f)),$.delete("/:uri",r6(f)),$.post("/:uri/restore",p6(f)),$}function e6(f){let $=new e().basePath("/search");return $.get("/",i6(f)),$}function f8(f,$){let M=f.basePath("/api");M.route("/",t6($)),M.route("/",e6($)),M.route("/",s6($)),M.route("/",a6($)),M.route("/",o6($))}var __dirname="/home/runner/work/hippo-memo/hippo-memo/packages/cli/src/api";function BK(f){let $=new e,M=process.env.WEB_DIST||$8(__dirname,"../../dist");return f8($,f),$.get("/*",P2({root:M})),$.get("*",P2({path:$8(M,"index.html")})),$}async function M8(f,$){let M=BK(f);K6({fetch:M.fetch,port:$}),console.log(`Hippo web server started on http://localhost:${$}`),console.log("Press Ctrl+C to stop")}async function Y8(f,$,M){let Y=V0(f),J=K0({type:M,config:Y});await M8(J,$)}var Jf=new Xf;Jf.name("hippo").description("Hippo Memory Store CLI").version("1.0.0");Jf.command("init").description("Initialize a new hippo memory directory").argument("[directory]","Directory to initialize",".").action(async(f)=>{await oz(f)});Jf.command("web").description("Start the web server").argument("[directory]","Project directory",".").option("-p, --port <port>","Port to listen on","3000").option("-s, --store-type <type>","Store type (filesystem or sqlite)","filesystem").action(async(f,$)=>{let M=Number.parseInt($.port,10),Y=$.storeType;await Y8(f,M,Y)});Jf.addCommand(J6);Jf.parse();
|
|
214
|
+
${Z}`)}catch($){console.error($ instanceof Error?$.message:String($)),process.exit(1)}}async function J6(f,$,M){try{let Y=o1(M.dir),J={newUri:f,targetUri:$};if(M.priority)J.priority=Number.parseInt(M.priority,10);if(M.disclosure)J.disclosure=M.disclosure;await Y.addAlias(J),console.log("OK")}catch(Y){console.error(Y instanceof Error?Y.message:String(Y)),process.exit(1)}}var _1=new Xf("memory").description("Memory 管理操作 (无需 init,直接使用当前目录)");_1.command("create <uri> <content>").description("创建新记忆").option("-p, --priority <number>","优先级 (1-10)","5").option("-d, --disclosure <string>","触发条件").option("--dir <directory>","项目根目录 (默认: .)",".").action(tz);_1.command("read <uri>").description("读取指定记忆").option("--dir <directory>","项目根目录 (默认: .)",".").action(ez);_1.command("update <uri> <content>").description("更新记忆内容").option("-p, --priority <number>","优先级 (1-10)").option("-d, --disclosure <string>","触发条件").option("--dir <directory>","项目根目录 (默认: .)",".").action(f6);_1.command("delete <uri>").description("删除记忆").option("-r, --recursive","递归删除子记忆").option("--permanent","永久删除(不进入回收站)").option("--dir <directory>","项目根目录 (默认: .)",".").action($6);_1.command("search <query>").description("搜索记忆").option("--domain <string>","限定域名").option("-l, --limit <number>","结果数量","10").option("--dir <directory>","项目根目录 (默认: .)",".").action(M6);_1.command("alias <newUri> <targetUri>").description("为已有记忆添加别名").option("-p, --priority <number>","别名优先级 (继承目标默认)").option("-d, --disclosure <string>","别名触发条件").option("--dir <directory>","项目根目录 (默认: .)",".").action(J6);_1.command("list").description("列出所有记忆").option("--domain <string>","限定域名").option("-l, --limit <number>","结果数量").option("--dir <directory>","项目根目录 (默认: .)",".").action(async(f)=>{await Y6(f)});var z6=_1;import{dirname as SK,join as FK}from"node:path";import{fileURLToPath as RK}from"node:url";import{createServer as TW}from"http";import{Http2ServerRequest as wW}from"http2";import{Http2ServerRequest as F2}from"http2";import{Readable as Z6}from"stream";import hW from"crypto";var s1=class extends Error{constructor(f,$){super(f,$);this.name="RequestError"}},jW=(f)=>{if(f instanceof s1)return f;return new s1(f.message,{cause:f})},IW=global.Request,t0=class extends IW{constructor(f,$){if(typeof f==="object"&&N0 in f)f=f[N0]();if(typeof $?.body?.getReader<"u")$.duplex??="half";super(f,$)}},CW=(f)=>{let $=[],M=f.rawHeaders;for(let Y=0;Y<M.length;Y+=2){let{[Y]:J,[Y+1]:z}=M;if(J.charCodeAt(0)!==58)$.push([J,z])}return new Headers($)},Q6=Symbol("wrapBodyStream"),EW=(f,$,M,Y,J)=>{let z={method:f,headers:M,signal:J.signal};if(f==="TRACE"){z.method="GET";let Z=new t0($,z);return Object.defineProperty(Z,"method",{get(){return"TRACE"}}),Z}if(!(f==="GET"||f==="HEAD"))if("rawBody"in Y&&Y.rawBody instanceof Buffer)z.body=new ReadableStream({start(Z){Z.enqueue(Y.rawBody),Z.close()}});else if(Y[Q6]){let Z;z.body=new ReadableStream({async pull(X){try{Z||=Z6.toWeb(Y).getReader();let{done:Q,value:G}=await Z.read();if(Q)X.close();else X.enqueue(G)}catch(Q){X.error(Q)}}})}else z.body=Z6.toWeb(Y);return new t0($,z)},N0=Symbol("getRequestCache"),xW=Symbol("requestCache"),rf=Symbol("incomingKey"),pf=Symbol("urlKey"),yW=Symbol("headersKey"),R0=Symbol("abortControllerKey"),kW=Symbol("getAbortController"),of={get method(){return this[rf].method||"GET"},get url(){return this[pf]},get headers(){return this[yW]||=CW(this[rf])},[kW](){return this[N0](),this[R0]},[N0](){return this[R0]||=new AbortController,this[xW]||=EW(this.method,this[pf],this.headers,this[rf],this[R0])}};["body","bodyUsed","cache","credentials","destination","integrity","mode","redirect","referrer","referrerPolicy","signal","keepalive"].forEach((f)=>{Object.defineProperty(of,f,{get(){return this[N0]()[f]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach((f)=>{Object.defineProperty(of,f,{value:function(){return this[N0]()[f]()}})});Object.setPrototypeOf(of,t0.prototype);var bW=(f,$)=>{let M=Object.create(of);M[rf]=f;let Y=f.url||"";if(Y[0]!=="/"&&(Y.startsWith("http://")||Y.startsWith("https://"))){if(f instanceof F2)throw new s1("Absolute URL for :path is not allowed in HTTP/2");try{let X=new URL(Y);M[pf]=X.href}catch(X){throw new s1("Invalid absolute URL",{cause:X})}return M}let J=(f instanceof F2?f.authority:f.headers.host)||$;if(!J)throw new s1("Missing host header");let z;if(f instanceof F2){if(z=f.scheme,!(z==="http"||z==="https"))throw new s1("Unsupported scheme")}else z=f.socket&&f.socket.encrypted?"https":"http";let Z=new URL(`${z}://${J}${Y}`);if(Z.hostname.length!==J.length&&Z.hostname!==J.replace(/:\d+$/,""))throw new s1("Invalid host header");return M[pf]=Z.href,M},X6=Symbol("responseCache"),F0=Symbol("getResponseCache"),a1=Symbol("cache"),N2=global.Response,e0=class f{#$;#f;[F0](){return delete this[a1],this[X6]||=new N2(this.#$,this.#f)}constructor($,M){let Y;if(this.#$=$,M instanceof f){let J=M[X6];if(J){this.#f=J,this[F0]();return}else this.#f=M.#f,Y=new Headers(M.#f.headers)}else this.#f=M;if(typeof $==="string"||typeof $?.getReader<"u"||$ instanceof Blob||$ instanceof Uint8Array)Y||=M?.headers||{"content-type":"text/plain; charset=UTF-8"},this[a1]=[M?.status||200,$,Y]}get headers(){let $=this[a1];if($){if(!($[2]instanceof Headers))$[2]=new Headers($[2]);return $[2]}return this[F0]().headers}get status(){return this[a1]?.[0]??this[F0]().status}get ok(){let $=this.status;return $>=200&&$<300}};["body","bodyUsed","redirected","statusText","trailers","type","url"].forEach((f)=>{Object.defineProperty(e0.prototype,f,{get(){return this[F0]()[f]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach((f)=>{Object.defineProperty(e0.prototype,f,{value:function(){return this[F0]()[f]()}})});Object.setPrototypeOf(e0,N2);Object.setPrototypeOf(e0.prototype,N2.prototype);async function _W(f){return Promise.race([f,Promise.resolve().then(()=>Promise.resolve(void 0))])}function G6(f,$,M){let Y=(X)=>{f.cancel(X).catch(()=>{})};return $.on("close",Y),$.on("error",Y),(M??f.read()).then(Z,J),f.closed.finally(()=>{$.off("close",Y),$.off("error",Y)});function J(X){if(X)$.destroy(X)}function z(){f.read().then(Z,J)}function Z({done:X,value:Q}){try{if(X)$.end();else if(!$.write(Q))$.once("drain",z);else return f.read().then(Z,J)}catch(G){J(G)}}}function vW(f,$){if(f.locked)throw TypeError("ReadableStream is locked.");else if($.destroyed)return;return G6(f.getReader(),$)}var D6=(f)=>{let $={};if(!(f instanceof Headers))f=new Headers(f??void 0);let M=[];for(let[Y,J]of f)if(Y==="set-cookie")M.push(J);else $[Y]=J;if(M.length>0)$["set-cookie"]=M;return $["content-type"]??="text/plain; charset=UTF-8",$},uW="x-hono-already-sent";if(typeof global.crypto>"u")global.crypto=hW;var O2=Symbol("outgoingEnded"),gW=()=>new Response(null,{status:400}),U6=(f)=>new Response(null,{status:f instanceof Error&&(f.name==="TimeoutError"||f.constructor.name==="TimeoutError")?504:500}),R2=(f,$)=>{let M=f instanceof Error?f:Error("unknown error",{cause:f});if(M.code==="ERR_STREAM_PREMATURE_CLOSE")console.info("The user aborted a request.");else{if(console.error(f),!$.headersSent)$.writeHead(500,{"Content-Type":"text/plain"});$.end(`Error: ${M.message}`),$.destroy(M)}},W6=(f)=>{if("flushHeaders"in f&&f.writable)f.flushHeaders()},K6=async(f,$)=>{let[M,Y,J]=f[a1];if(J instanceof Headers)J=D6(J);if(typeof Y==="string")J["Content-Length"]=Buffer.byteLength(Y);else if(Y instanceof Uint8Array)J["Content-Length"]=Y.byteLength;else if(Y instanceof Blob)J["Content-Length"]=Y.size;if($.writeHead(M,J),typeof Y==="string"||Y instanceof Uint8Array)$.end(Y);else if(Y instanceof Blob)$.end(new Uint8Array(await Y.arrayBuffer()));else W6($),await vW(Y,$)?.catch((z)=>R2(z,$));$[O2]?.()},cW=(f)=>typeof f.then==="function",mW=async(f,$,M={})=>{if(cW(f))if(M.errorHandler)try{f=await f}catch(J){let z=await M.errorHandler(J);if(!z)return;f=z}else f=await f.catch(U6);if(a1 in f)return K6(f,$);let Y=D6(f.headers);if(f.body){let J=f.body.getReader(),z=[],Z=!1,X=void 0;if(Y["transfer-encoding"]!=="chunked"){let Q=2;for(let G=0;G<Q;G++){X||=J.read();let D=await _W(X).catch((U)=>{console.error(U),Z=!0});if(!D){if(G===1){await new Promise((U)=>setTimeout(U)),Q=3;continue}break}if(X=void 0,D.value)z.push(D.value);if(D.done){Z=!0;break}}if(Z&&!("content-length"in Y))Y["content-length"]=z.reduce((G,D)=>G+D.length,0)}if($.writeHead(f.status,Y),z.forEach((Q)=>{$.write(Q)}),Z)$.end();else{if(z.length===0)W6($);await G6(J,$,X)}}else if(Y[uW]);else $.writeHead(f.status,Y),$.end();$[O2]?.()},dW=(f,$={})=>{let M=$.autoCleanupIncoming??!0;if($.overrideGlobalObjects!==!1&&global.Request!==t0)Object.defineProperty(global,"Request",{value:t0}),Object.defineProperty(global,"Response",{value:e0});return async(Y,J)=>{let z,Z;try{Z=bW(Y,$.hostname);let X=!M||Y.method==="GET"||Y.method==="HEAD";if(!X){if(Y[Q6]=!0,Y.on("end",()=>{X=!0}),Y instanceof wW)J[O2]=()=>{if(!X)setTimeout(()=>{if(!X)setTimeout(()=>{Y.destroy(),J.destroy()})})}}if(J.on("close",()=>{if(Z[R0]){if(Y.errored)Z[R0].abort(Y.errored.toString());else if(!J.writableFinished)Z[R0].abort("Client connection prematurely closed.")}if(!X)setTimeout(()=>{if(!X)setTimeout(()=>{Y.destroy()})})}),z=f(Z,{incoming:Y,outgoing:J}),a1 in z)return K6(z,J)}catch(X){if(!z)if($.errorHandler){if(z=await $.errorHandler(Z?X:jW(X)),!z)return}else if(!Z)z=gW();else z=U6(X);else return R2(X,J)}try{return await mW(z,J,$)}catch(X){return R2(X,J)}}},lW=(f)=>{let $=f.fetch,M=dW($,{hostname:f.hostname,overrideGlobalObjects:f.overrideGlobalObjects,autoCleanupIncoming:f.autoCleanupIncoming});return(f.createServer||TW)(f.serverOptions||{},M)},V6=(f,$)=>{let M=lW(f);return M.listen(f?.port??3000,f.hostname,()=>{let Y=M.address();$&&$(Y)}),M};var q6=(f,$=rW)=>{let M=/\.([a-zA-Z0-9]+?)$/,Y=f.match(M);if(!Y)return;let J=$[Y[1]];if(J&&J.startsWith("text"))J+="; charset=utf-8";return J};var nW={aac:"audio/aac",avi:"video/x-msvideo",avif:"image/avif",av1:"video/av1",bin:"application/octet-stream",bmp:"image/bmp",css:"text/css",csv:"text/csv",eot:"application/vnd.ms-fontobject",epub:"application/epub+zip",gif:"image/gif",gz:"application/gzip",htm:"text/html",html:"text/html",ico:"image/x-icon",ics:"text/calendar",jpeg:"image/jpeg",jpg:"image/jpeg",js:"text/javascript",json:"application/json",jsonld:"application/ld+json",map:"application/json",mid:"audio/x-midi",midi:"audio/x-midi",mjs:"text/javascript",mp3:"audio/mpeg",mp4:"video/mp4",mpeg:"video/mpeg",oga:"audio/ogg",ogv:"video/ogg",ogx:"application/ogg",opus:"audio/opus",otf:"font/otf",pdf:"application/pdf",png:"image/png",rtf:"application/rtf",svg:"image/svg+xml",tif:"image/tiff",tiff:"image/tiff",ts:"video/mp2t",ttf:"font/ttf",txt:"text/plain",wasm:"application/wasm",webm:"video/webm",weba:"audio/webm",webmanifest:"application/manifest+json",webp:"image/webp",woff:"font/woff",woff2:"font/woff2",xhtml:"application/xhtml+xml",xml:"application/xml",zip:"application/zip","3gp":"video/3gpp","3g2":"video/3gpp2",gltf:"model/gltf+json",glb:"model/gltf-binary"},rW=nW;import{createReadStream as B6,statSync as pW,existsSync as iW}from"fs";import{join as H6}from"path";import{versions as oW}from"process";import{Readable as sW}from"stream";var aW=/^\s*(?:text\/[^;\s]+|application\/(?:javascript|json|xml|xml-dtd|ecmascript|dart|postscript|rtf|tar|toml|vnd\.dart|vnd\.ms-fontobject|vnd\.ms-opentype|wasm|x-httpd-php|x-javascript|x-ns-proxy-autoconfig|x-sh|x-tar|x-virtualbox-hdd|x-virtualbox-ova|x-virtualbox-ovf|x-virtualbox-vbox|x-virtualbox-vdi|x-virtualbox-vhd|x-virtualbox-vmdk|x-www-form-urlencoded)|font\/(?:otf|ttf)|image\/(?:bmp|vnd\.adobe\.photoshop|vnd\.microsoft\.icon|vnd\.ms-dds|x-icon|x-ms-bmp)|message\/rfc822|model\/gltf-binary|x-shader\/x-fragment|x-shader\/x-vertex|[^;\s]+?\+(?:json|text|xml|yaml))(?:[;\s]|$)/i,L2={br:".br",zstd:".zst",gzip:".gz"},tW=Object.keys(L2),eW=()=>{let[f,$]=oW.node.split(".").map((M)=>parseInt(M));return f>=23||f===22&&$>=7||f===20&&$>=18},fK=eW(),S6=(f)=>{if(fK)return sW.toWeb(f);return new ReadableStream({start(M){f.on("data",(Y)=>{M.enqueue(Y)}),f.on("error",(Y)=>{M.error(Y)}),f.on("end",()=>{M.close()})},cancel(){f.destroy()}})},A2=(f)=>{let $;try{$=pW(f)}catch{}return $},P2=(f={root:""})=>{let $=f.root||"",M=f.path;if($!==""&&!iW($))console.error(`serveStatic: root path '${$}' is not found, are you sure it's correct?`);return async(Y,J)=>{if(Y.finalized)return J();let z;if(M)z=M;else try{if(z=decodeURIComponent(Y.req.path),/(?:^|[\/\\])\.\.(?:$|[\/\\])/.test(z))throw Error()}catch{return await f.onNotFound?.(Y.req.path,Y),J()}let Z=H6($,!M&&f.rewriteRequestPath?f.rewriteRequestPath(z,Y):z),X=A2(Z);if(X&&X.isDirectory()){let K=f.index??"index.html";Z=H6(Z,K),X=A2(Z)}if(!X)return await f.onNotFound?.(Z,Y),J();let Q=q6(Z);if(Y.header("Content-Type",Q||"application/octet-stream"),f.precompressed&&(!Q||aW.test(Q))){let K=new Set(Y.req.header("Accept-Encoding")?.split(",").map((W)=>W.trim()));for(let W of tW){if(!K.has(W))continue;let B=A2(Z+L2[W]);if(B){Y.header("Content-Encoding",W),Y.header("Vary","Accept-Encoding",{append:!0}),X=B,Z=Z+L2[W];break}}}let G,D=X.size,U=Y.req.header("range")||"";if(Y.req.method=="HEAD"||Y.req.method=="OPTIONS")Y.header("Content-Length",D.toString()),Y.status(200),G=Y.body(null);else if(!U)Y.header("Content-Length",D.toString()),G=Y.body(S6(B6(Z)),200);else{Y.header("Accept-Ranges","bytes"),Y.header("Date",X.birthtime.toUTCString());let K=U.replace(/bytes=/,"").split("-",2),W=parseInt(K[0],10)||0,B=parseInt(K[1],10)||D-1;if(D<B-W+1)B=D-1;let O=B-W+1,F=B6(Z,{start:W,end:B});Y.header("Content-Length",O.toString()),Y.header("Content-Range",`bytes ${W}-${B}/${X.size}`),G=Y.body(S6(F),206)}return await f.onFound?.(Z,Y),G}};var T2=(f,$,M)=>{return(Y,J)=>{let z=-1;return Z(0);async function Z(X){if(X<=z)throw Error("next() called multiple times");z=X;let Q,G=!1,D;if(f[X])D=f[X][0][0],Y.req.routeIndex=X;else D=X===f.length&&J||void 0;if(D)try{Q=await D(Y,()=>Z(X+1))}catch(U){if(U instanceof Error&&$)Y.error=U,Q=await $(U,Y),G=!0;else throw U}else if(Y.finalized===!1&&M)Q=await M(Y);if(Q&&(Y.finalized===!1||G))Y.res=Q;return Y}}};var F6=Symbol();var R6=async(f,$=Object.create(null))=>{let{all:M=!1,dot:Y=!1}=$,z=(f instanceof sf?f.raw.headers:f.headers).get("Content-Type");if(z?.startsWith("multipart/form-data")||z?.startsWith("application/x-www-form-urlencoded"))return $K(f,{all:M,dot:Y});return{}};async function $K(f,$){let M=await f.formData();if(M)return MK(M,$);return{}}function MK(f,$){let M=Object.create(null);if(f.forEach((Y,J)=>{if(!($.all||J.endsWith("[]")))M[J]=Y;else YK(M,J,Y)}),$.dot)Object.entries(M).forEach(([Y,J])=>{if(Y.includes("."))JK(M,Y,J),delete M[Y]});return M}var YK=(f,$,M)=>{if(f[$]!==void 0)if(Array.isArray(f[$]))f[$].push(M);else f[$]=[f[$],M];else if(!$.endsWith("[]"))f[$]=M;else f[$]=[M]},JK=(f,$,M)=>{let Y=f,J=$.split(".");J.forEach((z,Z)=>{if(Z===J.length-1)Y[z]=M;else{if(!Y[z]||typeof Y[z]!=="object"||Array.isArray(Y[z])||Y[z]instanceof File)Y[z]=Object.create(null);Y=Y[z]}})};var j2=(f)=>{let $=f.split("/");if($[0]==="")$.shift();return $},N6=(f)=>{let{groups:$,path:M}=zK(f),Y=j2(M);return ZK(Y,$)},zK=(f)=>{let $=[];return f=f.replace(/\{[^}]+\}/g,(M,Y)=>{let J=`@${Y}`;return $.push([J,M]),J}),{groups:$,path:f}},ZK=(f,$)=>{for(let M=$.length-1;M>=0;M--){let[Y]=$[M];for(let J=f.length-1;J>=0;J--)if(f[J].includes(Y)){f[J]=f[J].replace(Y,$[M][1]);break}}return f},af={},O6=(f,$)=>{if(f==="*")return"*";let M=f.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(M){let Y=`${f}#${$}`;if(!af[Y])if(M[2])af[Y]=$&&$[0]!==":"&&$[0]!=="*"?[Y,M[1],new RegExp(`^${M[2]}(?=/${$})`)]:[f,M[1],new RegExp(`^${M[2]}$`)];else af[Y]=[f,M[1],!0];return af[Y]}return null},tf=(f,$)=>{try{return $(f)}catch{return f.replace(/(?:%[0-9A-Fa-f]{2})+/g,(M)=>{try{return $(M)}catch{return M}})}},XK=(f)=>tf(f,decodeURI),I2=(f)=>{let $=f.url,M=$.indexOf("/",$.indexOf(":")+4),Y=M;for(;Y<$.length;Y++){let J=$.charCodeAt(Y);if(J===37){let z=$.indexOf("?",Y),Z=$.indexOf("#",Y),X=z===-1?Z===-1?void 0:Z:Z===-1?z:Math.min(z,Z),Q=$.slice(M,X);return XK(Q.includes("%25")?Q.replace(/%25/g,"%2525"):Q)}else if(J===63||J===35)break}return $.slice(M,Y)};var A6=(f)=>{let $=I2(f);return $.length>1&&$.at(-1)==="/"?$.slice(0,-1):$},t1=(f,$,...M)=>{if(M.length)$=t1($,...M);return`${f?.[0]==="/"?"":"/"}${f}${$==="/"?"":`${f?.at(-1)==="/"?"":"/"}${$?.[0]==="/"?$.slice(1):$}`}`},ef=(f)=>{if(f.charCodeAt(f.length-1)!==63||!f.includes(":"))return null;let $=f.split("/"),M=[],Y="";return $.forEach((J)=>{if(J!==""&&!/\:/.test(J))Y+="/"+J;else if(/\:/.test(J))if(/\?/.test(J)){if(M.length===0&&Y==="")M.push("/");else M.push(Y);let z=J.replace("?","");Y+="/"+z,M.push(Y)}else Y+="/"+J}),M.filter((J,z,Z)=>Z.indexOf(J)===z)},w2=(f)=>{if(!/[%+]/.test(f))return f;if(f.indexOf("+")!==-1)f=f.replace(/\+/g," ");return f.indexOf("%")!==-1?tf(f,C2):f},L6=(f,$,M)=>{let Y;if(!M&&$&&!/[%+]/.test($)){let Z=f.indexOf("?",8);if(Z===-1)return;if(!f.startsWith($,Z+1))Z=f.indexOf(`&${$}`,Z+1);while(Z!==-1){let X=f.charCodeAt(Z+$.length+1);if(X===61){let Q=Z+$.length+2,G=f.indexOf("&",Q);return w2(f.slice(Q,G===-1?void 0:G))}else if(X==38||isNaN(X))return"";Z=f.indexOf(`&${$}`,Z+1)}if(Y=/[%+]/.test(f),!Y)return}let J={};Y??=/[%+]/.test(f);let z=f.indexOf("?",8);while(z!==-1){let Z=f.indexOf("&",z+1),X=f.indexOf("=",z);if(X>Z&&Z!==-1)X=-1;let Q=f.slice(z+1,X===-1?Z===-1?void 0:Z:X);if(Y)Q=w2(Q);if(z=Z,Q==="")continue;let G;if(X===-1)G="";else if(G=f.slice(X+1,Z===-1?void 0:Z),Y)G=w2(G);if(M){if(!(J[Q]&&Array.isArray(J[Q])))J[Q]=[];J[Q].push(G)}else J[Q]??=G}return $?J[$]:J},P6=L6,T6=(f,$)=>{return L6(f,$,!0)},C2=decodeURIComponent;var w6=(f)=>tf(f,C2),sf=class{raw;#$;#f;routeIndex=0;path;bodyCache={};constructor(f,$="/",M=[[]]){this.raw=f,this.path=$,this.#f=M,this.#$={}}param(f){return f?this.#M(f):this.#z()}#M(f){let $=this.#f[0][this.routeIndex][1][f],M=this.#J($);return M&&/\%/.test(M)?w6(M):M}#z(){let f={},$=Object.keys(this.#f[0][this.routeIndex][1]);for(let M of $){let Y=this.#J(this.#f[0][this.routeIndex][1][M]);if(Y!==void 0)f[M]=/\%/.test(Y)?w6(Y):Y}return f}#J(f){return this.#f[1]?this.#f[1][f]:f}query(f){return P6(this.url,f)}queries(f){return T6(this.url,f)}header(f){if(f)return this.raw.headers.get(f)??void 0;let $={};return this.raw.headers.forEach((M,Y)=>{$[Y]=M}),$}async parseBody(f){return this.bodyCache.parsedBody??=await R6(this,f)}#Y=(f)=>{let{bodyCache:$,raw:M}=this,Y=$[f];if(Y)return Y;let J=Object.keys($)[0];if(J)return $[J].then((z)=>{if(J==="json")z=JSON.stringify(z);return new Response(z)[f]()});return $[f]=M[f]()};json(){return this.#Y("text").then((f)=>JSON.parse(f))}text(){return this.#Y("text")}arrayBuffer(){return this.#Y("arrayBuffer")}blob(){return this.#Y("blob")}formData(){return this.#Y("formData")}addValidatedData(f,$){this.#$[f]=$}valid(f){return this.#$[f]}get url(){return this.raw.url}get method(){return this.raw.method}get[F6](){return this.#f}get matchedRoutes(){return this.#f[0].map(([[,f]])=>f)}get routePath(){return this.#f[0].map(([[,f]])=>f)[this.routeIndex].path}};var j6={Stringify:1,BeforeStream:2,Stream:3},QK=(f,$)=>{let M=new String(f);return M.isEscaped=!0,M.callbacks=$,M};var E2=async(f,$,M,Y,J)=>{if(typeof f==="object"&&!(f instanceof String)){if(!(f instanceof Promise))f=f.toString();if(f instanceof Promise)f=await f}let z=f.callbacks;if(!z?.length)return Promise.resolve(f);if(J)J[0]+=f;else J=[f];let Z=Promise.all(z.map((X)=>X({phase:$,buffer:J,context:Y}))).then((X)=>Promise.all(X.filter(Boolean).map((Q)=>E2(Q,$,!1,Y,J))).then(()=>J[0]));if(M)return QK(await Z,z);else return Z};var GK="text/plain; charset=UTF-8",x2=(f,$)=>{return{"Content-Type":f,...$}},O0=(f,$)=>new Response(f,$),I6=class{#$;#f;env={};#M;finalized=!1;error;#z;#J;#Y;#D;#Q;#G;#X;#U;#W;constructor(f,$){if(this.#$=f,$)this.#J=$.executionCtx,this.env=$.env,this.#G=$.notFoundHandler,this.#W=$.path,this.#U=$.matchResult}get req(){return this.#f??=new sf(this.#$,this.#W,this.#U),this.#f}get event(){if(this.#J&&"respondWith"in this.#J)return this.#J;else throw Error("This context has no FetchEvent")}get executionCtx(){if(this.#J)return this.#J;else throw Error("This context has no ExecutionContext")}get res(){return this.#Y||=O0(null,{headers:this.#X??=new Headers})}set res(f){if(this.#Y&&f){f=O0(f.body,f);for(let[$,M]of this.#Y.headers.entries()){if($==="content-type")continue;if($==="set-cookie"){let Y=this.#Y.headers.getSetCookie();f.headers.delete("set-cookie");for(let J of Y)f.headers.append("set-cookie",J)}else f.headers.set($,M)}}this.#Y=f,this.finalized=!0}render=(...f)=>{return this.#Q??=($)=>this.html($),this.#Q(...f)};setLayout=(f)=>this.#D=f;getLayout=()=>this.#D;setRenderer=(f)=>{this.#Q=f};header=(f,$,M)=>{if(this.finalized)this.#Y=O0(this.#Y.body,this.#Y);let Y=this.#Y?this.#Y.headers:this.#X??=new Headers;if($===void 0)Y.delete(f);else if(M?.append)Y.append(f,$);else Y.set(f,$)};status=(f)=>{this.#z=f};set=(f,$)=>{this.#M??=new Map,this.#M.set(f,$)};get=(f)=>{return this.#M?this.#M.get(f):void 0};get var(){if(!this.#M)return{};return Object.fromEntries(this.#M)}#Z(f,$,M){let Y=this.#Y?new Headers(this.#Y.headers):this.#X??new Headers;if(typeof $==="object"&&"headers"in $){let z=$.headers instanceof Headers?$.headers:new Headers($.headers);for(let[Z,X]of z)if(Z.toLowerCase()==="set-cookie")Y.append(Z,X);else Y.set(Z,X)}if(M)for(let[z,Z]of Object.entries(M))if(typeof Z==="string")Y.set(z,Z);else{Y.delete(z);for(let X of Z)Y.append(z,X)}let J=typeof $==="number"?$:$?.status??this.#z;return O0(f,{status:J,headers:Y})}newResponse=(...f)=>this.#Z(...f);body=(f,$,M)=>this.#Z(f,$,M);#K(){return!this.#X&&!this.#z&&!this.finalized}text=(f,$,M)=>{return this.#K()&&!$&&!M?O0(f):this.#Z(f,$,x2(GK,M))};json=(f,$,M)=>{return this.#K()&&!$&&!M?Response.json(f):this.#Z(JSON.stringify(f),$,x2("application/json",M))};html=(f,$,M)=>{let Y=(J)=>this.#Z(J,$,x2("text/html; charset=UTF-8",M));return typeof f==="object"?E2(f,j6.Stringify,!1,{}).then(Y):Y(f)};redirect=(f,$)=>{let M=String(f);return this.header("Location",!/[^\x00-\xFF]/.test(M)?M:encodeURI(M)),this.newResponse(null,$??302)};notFound=()=>{return this.#G??=()=>O0(),this.#G(this)}};var I="ALL",C6="all",E6=["get","post","put","delete","options","patch"],f$="Can not add a route since the matcher is already built.",$$=class extends Error{};var x6="__COMPOSED_HANDLER";var DK=(f)=>{return f.text("404 Not Found",404)},y6=(f,$)=>{if("getResponse"in f){let M=f.getResponse();return $.newResponse(M.body,M)}return console.error(f),$.text("Internal Server Error",500)},k6=class f{get;post;put;delete;options;patch;all;on;use;router;getPath;_basePath="/";#$="/";routes=[];constructor($={}){[...E6,C6].forEach((z)=>{this[z]=(Z,...X)=>{if(typeof Z==="string")this.#$=Z;else this.#z(z,this.#$,Z);return X.forEach((Q)=>{this.#z(z,this.#$,Q)}),this}}),this.on=(z,Z,...X)=>{for(let Q of[Z].flat()){this.#$=Q;for(let G of[z].flat())X.map((D)=>{this.#z(G.toUpperCase(),this.#$,D)})}return this},this.use=(z,...Z)=>{if(typeof z==="string")this.#$=z;else this.#$="*",Z.unshift(z);return Z.forEach((X)=>{this.#z(I,this.#$,X)}),this};let{strict:Y,...J}=$;Object.assign(this,J),this.getPath=Y??!0?$.getPath??I2:A6}#f(){let $=new f({router:this.router,getPath:this.getPath});return $.errorHandler=this.errorHandler,$.#M=this.#M,$.routes=this.routes,$}#M=DK;errorHandler=y6;route($,M){let Y=this.basePath($);return M.routes.map((J)=>{let z;if(M.errorHandler===y6)z=J.handler;else z=async(Z,X)=>(await T2([],M.errorHandler)(Z,()=>J.handler(Z,X))).res,z[x6]=J.handler;Y.#z(J.method,J.path,z)}),this}basePath($){let M=this.#f();return M._basePath=t1(this._basePath,$),M}onError=($)=>{return this.errorHandler=$,this};notFound=($)=>{return this.#M=$,this};mount($,M,Y){let J,z;if(Y)if(typeof Y==="function")z=Y;else if(z=Y.optionHandler,Y.replaceRequest===!1)J=(Q)=>Q;else J=Y.replaceRequest;let Z=z?(Q)=>{let G=z(Q);return Array.isArray(G)?G:[G]}:(Q)=>{let G=void 0;try{G=Q.executionCtx}catch{}return[Q.env,G]};J||=(()=>{let Q=t1(this._basePath,$),G=Q==="/"?0:Q.length;return(D)=>{let U=new URL(D.url);return U.pathname=U.pathname.slice(G)||"/",new Request(U,D)}})();let X=async(Q,G)=>{let D=await M(J(Q.req.raw),...Z(Q));if(D)return D;await G()};return this.#z(I,t1($,"*"),X),this}#z($,M,Y){$=$.toUpperCase(),M=t1(this._basePath,M);let J={basePath:this._basePath,path:M,method:$,handler:Y};this.router.add($,M,[Y,J]),this.routes.push(J)}#J($,M){if($ instanceof Error)return this.errorHandler($,M);throw $}#Y($,M,Y,J){if(J==="HEAD")return(async()=>new Response(null,await this.#Y($,M,Y,"GET")))();let z=this.getPath($,{env:Y}),Z=this.router.match(J,z),X=new I6($,{path:z,matchResult:Z,env:Y,executionCtx:M,notFoundHandler:this.#M});if(Z[0].length===1){let G;try{G=Z[0][0][0][0](X,async()=>{X.res=await this.#M(X)})}catch(D){return this.#J(D,X)}return G instanceof Promise?G.then((D)=>D||(X.finalized?X.res:this.#M(X))).catch((D)=>this.#J(D,X)):G??this.#M(X)}let Q=T2(Z[0],this.errorHandler,this.#M);return(async()=>{try{let G=await Q(X);if(!G.finalized)throw Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return G.res}catch(G){return this.#J(G,X)}})()}fetch=($,...M)=>{return this.#Y($,M[1],M[0],$.method)};request=($,M,Y,J)=>{if($ instanceof Request)return this.fetch(M?new Request($,M):$,Y,J);return $=$.toString(),this.fetch(new Request(/^https?:\/\//.test($)?$:`http://localhost${t1("/",$)}`,M),Y,J)};fire=()=>{addEventListener("fetch",($)=>{$.respondWith(this.#Y($.request,$,void 0,$.request.method))})}};var ff=[];function M$(f,$){let M=this.buildAllMatchers(),Y=(J,z)=>{let Z=M[J]||M[I],X=Z[2][z];if(X)return X;let Q=z.match(Z[0]);if(!Q)return[[],ff];let G=Q.indexOf("",1);return[Z[1][G],Q]};return this.match=Y,Y(f,$)}var Y$="[^/]+",$f=".*",Mf="(?:|/.*)",e1=Symbol(),UK=new Set(".\\+*[^]$()");function WK(f,$){if(f.length===1)return $.length===1?f<$?-1:1:-1;if($.length===1)return 1;if(f===$f||f===Mf)return 1;else if($===$f||$===Mf)return-1;if(f===Y$)return 1;else if($===Y$)return-1;return f.length===$.length?f<$?-1:1:$.length-f.length}var b6=class f{#$;#f;#M=Object.create(null);insert($,M,Y,J,z){if($.length===0){if(this.#$!==void 0)throw e1;if(z)return;this.#$=M;return}let[Z,...X]=$,Q=Z==="*"?X.length===0?["","",$f]:["","",Y$]:Z==="/*"?["","",Mf]:Z.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/),G;if(Q){let D=Q[1],U=Q[2]||Y$;if(D&&Q[2]){if(U===".*")throw e1;if(U=U.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(U))throw e1}if(G=this.#M[U],!G){if(Object.keys(this.#M).some((K)=>K!==$f&&K!==Mf))throw e1;if(z)return;if(G=this.#M[U]=new f,D!=="")G.#f=J.varIndex++}if(!z&&D!=="")Y.push([D,G.#f])}else if(G=this.#M[Z],!G){if(Object.keys(this.#M).some((D)=>D.length>1&&D!==$f&&D!==Mf))throw e1;if(z)return;G=this.#M[Z]=new f}G.insert(X,M,Y,J,z)}buildRegExpStr(){let M=Object.keys(this.#M).sort(WK).map((Y)=>{let J=this.#M[Y];return(typeof J.#f==="number"?`(${Y})@${J.#f}`:UK.has(Y)?`\\${Y}`:Y)+J.buildRegExpStr()});if(typeof this.#$==="number")M.unshift(`#${this.#$}`);if(M.length===0)return"";if(M.length===1)return M[0];return"(?:"+M.join("|")+")"}};var _6=class{#$={varIndex:0};#f=new b6;insert(f,$,M){let Y=[],J=[];for(let Z=0;;){let X=!1;if(f=f.replace(/\{[^}]+\}/g,(Q)=>{let G=`@\\${Z}`;return J[Z]=[G,Q],Z++,X=!0,G}),!X)break}let z=f.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let Z=J.length-1;Z>=0;Z--){let[X]=J[Z];for(let Q=z.length-1;Q>=0;Q--)if(z[Q].indexOf(X)!==-1){z[Q]=z[Q].replace(X,J[Z][1]);break}}return this.#f.insert(z,$,Y,this.#$,M),Y}buildRegExp(){let f=this.#f.buildRegExpStr();if(f==="")return[/^$/,[],[]];let $=0,M=[],Y=[];return f=f.replace(/#(\d+)|@(\d+)|\.\*\$/g,(J,z,Z)=>{if(z!==void 0)return M[++$]=Number(z),"$()";if(Z!==void 0)return Y[Number(Z)]=++$,"";return""}),[new RegExp(`^${f}`),M,Y]}};var KK=[/^$/,[],Object.create(null)],v6=Object.create(null);function u6(f){return v6[f]??=new RegExp(f==="*"?"":`^${f.replace(/\/\*$|([.\\+*[^\]$()])/g,($,M)=>M?`\\${M}`:"(?:|/.*)")}$`)}function VK(){v6=Object.create(null)}function qK(f){let $=new _6,M=[];if(f.length===0)return KK;let Y=f.map((G)=>[!/\*|\/:/.test(G[0]),...G]).sort(([G,D],[U,K])=>G?1:U?-1:D.length-K.length),J=Object.create(null);for(let G=0,D=-1,U=Y.length;G<U;G++){let[K,W,B]=Y[G];if(K)J[W]=[B.map(([F])=>[F,Object.create(null)]),ff];else D++;let O;try{O=$.insert(W,D,K)}catch(F){throw F===e1?new $$(W):F}if(K)continue;M[D]=B.map(([F,T])=>{let c=Object.create(null);T-=1;for(;T>=0;T--){let[r,J1]=O[T];c[r]=J1}return[F,c]})}let[z,Z,X]=$.buildRegExp();for(let G=0,D=M.length;G<D;G++)for(let U=0,K=M[G].length;U<K;U++){let W=M[G][U]?.[1];if(!W)continue;let B=Object.keys(W);for(let O=0,F=B.length;O<F;O++)W[B[O]]=X[W[B[O]]]}let Q=[];for(let G in Z)Q[G]=M[Z[G]];return[z,Q,J]}function A0(f,$){if(!f)return;for(let M of Object.keys(f).sort((Y,J)=>J.length-Y.length))if(u6(M).test($))return[...f[M]];return}var J$=class{name="RegExpRouter";#$;#f;constructor(){this.#$={[I]:Object.create(null)},this.#f={[I]:Object.create(null)}}add(f,$,M){let Y=this.#$,J=this.#f;if(!Y||!J)throw Error(f$);if(!Y[f])[Y,J].forEach((X)=>{X[f]=Object.create(null),Object.keys(X[I]).forEach((Q)=>{X[f][Q]=[...X[I][Q]]})});if($==="/*")$="*";let z=($.match(/\/:/g)||[]).length;if(/\*$/.test($)){let X=u6($);if(f===I)Object.keys(Y).forEach((Q)=>{Y[Q][$]||=A0(Y[Q],$)||A0(Y[I],$)||[]});else Y[f][$]||=A0(Y[f],$)||A0(Y[I],$)||[];Object.keys(Y).forEach((Q)=>{if(f===I||f===Q)Object.keys(Y[Q]).forEach((G)=>{X.test(G)&&Y[Q][G].push([M,z])})}),Object.keys(J).forEach((Q)=>{if(f===I||f===Q)Object.keys(J[Q]).forEach((G)=>X.test(G)&&J[Q][G].push([M,z]))});return}let Z=ef($)||[$];for(let X=0,Q=Z.length;X<Q;X++){let G=Z[X];Object.keys(J).forEach((D)=>{if(f===I||f===D)J[D][G]||=[...A0(Y[D],G)||A0(Y[I],G)||[]],J[D][G].push([M,z-Q+X+1])})}}match=M$;buildAllMatchers(){let f=Object.create(null);return Object.keys(this.#f).concat(Object.keys(this.#$)).forEach(($)=>{f[$]||=this.#M($)}),this.#$=this.#f=void 0,VK(),f}#M(f){let $=[],M=f===I;if([this.#$,this.#f].forEach((Y)=>{let J=Y[f]?Object.keys(Y[f]).map((z)=>[z,Y[f][z]]):[];if(J.length!==0)M||=!0,$.push(...J);else if(f!==I)$.push(...Object.keys(Y[I]).map((z)=>[z,Y[I][z]]))}),!M)return null;else return qK($)}};var BK=class{name="PreparedRegExpRouter";#$;#f;constructor(f,$){this.#$=f,this.#f=$}#M(f,$){let M=this.#$[f];M[1].forEach((Y)=>Y&&Y.push($)),Object.values(M[2]).forEach((Y)=>Y[0].push($))}#z(f,$,M,Y,J){let z=this.#$[f];if(!J)z[2][$][0].push([M,{}]);else Y.forEach((Z)=>{if(typeof Z==="number")z[1][Z].push([M,J]);else z[2][Z||$][0].push([M,J])})}add(f,$,M){if(!this.#$[f]){let J=this.#$[I],z={};for(let Z in J[2])z[Z]=[J[2][Z][0].slice(),ff];this.#$[f]=[J[0],J[1].map((Z)=>Array.isArray(Z)?Z.slice():0),z]}if($==="/*"||$==="*"){let J=[M,{}];if(f===I)for(let z in this.#$)this.#M(z,J);else this.#M(f,J);return}let Y=this.#f[$];if(!Y)throw Error(`Path ${$} is not registered`);for(let[J,z]of Y)if(f===I)for(let Z in this.#$)this.#z(Z,$,M,J,z);else this.#z(f,$,M,J,z)}buildAllMatchers(){return this.#$}match=M$};var y2=class{name="SmartRouter";#$=[];#f=[];constructor(f){this.#$=f.routers}add(f,$,M){if(!this.#f)throw Error(f$);this.#f.push([f,$,M])}match(f,$){if(!this.#f)throw Error("Fatal error");let M=this.#$,Y=this.#f,J=M.length,z=0,Z;for(;z<J;z++){let X=M[z];try{for(let Q=0,G=Y.length;Q<G;Q++)X.add(...Y[Q]);Z=X.match(f,$)}catch(Q){if(Q instanceof $$)continue;throw Q}this.match=X.match.bind(X),this.#$=[X],this.#f=void 0;break}if(z===J)throw Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,Z}get activeRouter(){if(this.#f||this.#$.length!==1)throw Error("No active router has been determined yet.");return this.#$[0]}};var Yf=Object.create(null),HK=(f)=>{for(let $ in f)return!0;return!1},h6=class f{#$;#f;#M;#z=0;#J=Yf;constructor($,M,Y){if(this.#f=Y||Object.create(null),this.#$=[],$&&M){let J=Object.create(null);J[$]={handler:M,possibleKeys:[],score:0},this.#$=[J]}this.#M=[]}insert($,M,Y){this.#z=++this.#z;let J=this,z=N6(M),Z=[];for(let X=0,Q=z.length;X<Q;X++){let G=z[X],D=z[X+1],U=O6(G,D),K=Array.isArray(U)?U[0]:G;if(K in J.#f){if(J=J.#f[K],U)Z.push(U[1]);continue}if(J.#f[K]=new f,U)J.#M.push(U),Z.push(U[1]);J=J.#f[K]}return J.#$.push({[$]:{handler:Y,possibleKeys:Z.filter((X,Q,G)=>G.indexOf(X)===Q),score:this.#z}}),J}#Y($,M,Y,J,z){for(let Z=0,X=M.#$.length;Z<X;Z++){let Q=M.#$[Z],G=Q[Y]||Q[I],D={};if(G!==void 0){if(G.params=Object.create(null),$.push(G),J!==Yf||z&&z!==Yf)for(let U=0,K=G.possibleKeys.length;U<K;U++){let W=G.possibleKeys[U],B=D[G.score];G.params[W]=z?.[W]&&!B?z[W]:J[W]??z?.[W],D[G.score]=!0}}}}search($,M){let Y=[];this.#J=Yf;let z=[this],Z=j2(M),X=[],Q=Z.length,G=null;for(let D=0;D<Q;D++){let U=Z[D],K=D===Q-1,W=[];for(let O=0,F=z.length;O<F;O++){let T=z[O],c=T.#f[U];if(c)if(c.#J=T.#J,K){if(c.#f["*"])this.#Y(Y,c.#f["*"],$,T.#J);this.#Y(Y,c,$,T.#J)}else W.push(c);for(let r=0,J1=T.#M.length;r<J1;r++){let L0=T.#M[r],$1=T.#J===Yf?{}:{...T.#J};if(L0==="*"){let H1=T.#f["*"];if(H1)this.#Y(Y,H1,$,T.#J),H1.#J=$1,W.push(H1);continue}let[f0,_,w]=L0;if(!U&&!(w instanceof RegExp))continue;let p=T.#f[f0];if(w instanceof RegExp){if(G===null){G=Array(Q);let H=M[0]==="/"?1:0;for(let q=0;q<Q;q++)G[q]=H,H+=Z[q].length+1}let H1=M.substring(G[D]),A=w.exec(H1);if(A){if($1[_]=A[0],this.#Y(Y,p,$,T.#J,$1),HK(p.#f)){p.#J=$1;let H=A[0].match(/\//)?.length??0;(X[H]||=[]).push(p)}continue}}if(w===!0||w.test(U))if($1[_]=U,K){if(this.#Y(Y,p,$,$1,T.#J),p.#f["*"])this.#Y(Y,p.#f["*"],$,$1,T.#J)}else p.#J=$1,W.push(p)}}let B=X.shift();z=B?W.concat(B):W}if(Y.length>1)Y.sort((D,U)=>{return D.score-U.score});return[Y.map(({handler:D,params:U})=>[D,U])]}};var k2=class{name="TrieRouter";#$;constructor(){this.#$=new h6}add(f,$,M){let Y=ef($);if(Y){for(let J=0,z=Y.length;J<z;J++)this.#$.insert(f,Y[J],M);return}this.#$.insert(f,$,M)}match(f,$){return this.#$.search(f,$)}};var f1=class extends k6{constructor(f={}){super(f);this.router=f.router??new y2({routers:[new J$,new k2]})}};function n(f,$){return f.json({code:1,data:$,msg:""})}function X1(f,$){return f.json({code:-1,data:null,msg:$})}function g6(f){return async($)=>{let M=await $.req.json(),Y=await f.addAlias(M);if(!Y.success)return X1($,Y.error);return n($,Y.data)}}function c6(f){return async($)=>{let M=decodeURIComponent($.req.param("uri")??""),Y=await f.getChildren(M);return n($,Y)}}function m6(f){return async($)=>{let M=$.req.query("domain"),Y=await f.getAllMemories({domain:M,includeDeleted:!0});return n($,Y)}}function d6(f){return async($)=>{let M=$.req.query("uri"),Y=$.req.query("domain"),J=await f.getRelationships({uri:M,domain:Y});return n($,J)}}function l6(f){return async($)=>{let M=decodeURIComponent($.req.param("uri")??""),Y=$.req.query("includeDeleted")==="true";try{let J=await f.getMemory(M,{includeDeleted:Y});if(!J)return X1($,"Memory not found");return n($,J)}catch(J){return X1($,J instanceof Error?J.message:String(J))}}}function n6(f){return async($)=>{let M=await $.req.json();try{let Y=await f.createMemory(M);return n($,Y)}catch(Y){return X1($,Y instanceof Error?Y.message:String(Y))}}}function r6(f){return async($)=>{let M=decodeURIComponent($.req.param("uri")??""),Y=await $.req.json();try{let J=await f.updateMemory({...Y,uri:M});return n($,J)}catch(J){return X1($,J instanceof Error?J.message:String(J))}}}function p6(f){return async($)=>{let M=decodeURIComponent($.req.param("uri")??""),Y=$.req.query("recursive")==="true",J=$.req.query("permanent")==="true";try{return await f.deleteMemory(M,{recursive:Y,permanent:J}),n($,null)}catch(z){return X1($,z instanceof Error?z.message:String(z))}}}function i6(f){return async($)=>{let M=decodeURIComponent($.req.param("uri")??"");try{let Y=await f.restoreMemory(M);return n($,Y)}catch(Y){return X1($,Y instanceof Error?Y.message:String(Y))}}}function o6(f){return async($)=>{let M=$.req.query("q")??"",Y=$.req.query("domain"),J=$.req.query("limit")?Number.parseInt($.req.query("limit"),10):10;if(!M)return X1($,"Query parameter 'q' is required");let z=await f.searchMemory(M,{query:M,domain:Y,limit:J});return n($,z)}}function s6(f){let $=new f1().basePath("/alias");return $.post("/",g6(f)),$}function a6(f){let $=new f1().basePath("/children");return $.get("/:uri",c6(f)),$}function t6(f){let $=new f1().basePath("/graph");return $.get("/nodes",m6(f)),$.get("/relationships",d6(f)),$}function e6(f){let $=new f1().basePath("/memories");return $.get("/:uri",l6(f)),$.post("/",n6(f)),$.put("/:uri",r6(f)),$.delete("/:uri",p6(f)),$.post("/:uri/restore",i6(f)),$}function f8(f){let $=new f1().basePath("/search");return $.get("/",o6(f)),$}function $8(f,$){let M=f.basePath("/api");M.route("/",e6($)),M.route("/",f8($)),M.route("/",a6($)),M.route("/",t6($)),M.route("/",s6($))}function NK(f){let $=new f1,M=SK(RK(import.meta.url)),Y=process.env.WEB_DIST||M;return $8($,f),$.get("/*",P2({root:Y})),$.get("*",P2({path:FK(Y,"index.html")})),$}async function M8(f,$){let M=NK(f);V6({fetch:M.fetch,port:$}),console.log(`Hippo web server started on http://localhost:${$}`),console.log("Press Ctrl+C to stop")}async function Y8(f,$,M){let Y=V0(f),J=K0({type:M,config:Y});await M8(J,$)}var Jf=new Xf;Jf.name("hippo").description("Hippo Memory Store CLI").version("1.0.0");Jf.command("init").description("Initialize a new hippo memory directory").argument("[directory]","Directory to initialize",".").action(async(f)=>{await sz(f)});Jf.command("web").description("Start the web server").argument("[directory]","Project directory",".").option("-p, --port <port>","Port to listen on","3000").option("-s, --store-type <type>","Store type (filesystem or sqlite)","filesystem").action(async(f,$)=>{let M=Number.parseInt($.port,10),Y=$.storeType;await Y8(f,M,Y)});Jf.addCommand(z6);Jf.parse();
|