use-agentz 0.1.0 → 0.1.1
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/authoring/define.js +20 -2
- package/dist/cli.js +1383 -1331
- package/dist/config/define.js +20 -2
- package/dist/ui/api.ts +286 -0
- package/package.json +8 -8
package/dist/cli.js
CHANGED
|
@@ -5,25 +5,43 @@ var __getProtoOf = Object.getPrototypeOf;
|
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
function __accessProp(key) {
|
|
9
|
+
return this[key];
|
|
10
|
+
}
|
|
11
|
+
var __toESMCache_node;
|
|
12
|
+
var __toESMCache_esm;
|
|
8
13
|
var __toESM = (mod, isNodeMode, target) => {
|
|
14
|
+
var canCache = mod != null && typeof mod === "object";
|
|
15
|
+
if (canCache) {
|
|
16
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
17
|
+
var cached = cache.get(mod);
|
|
18
|
+
if (cached)
|
|
19
|
+
return cached;
|
|
20
|
+
}
|
|
9
21
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
10
22
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
11
23
|
for (let key of __getOwnPropNames(mod))
|
|
12
24
|
if (!__hasOwnProp.call(to, key))
|
|
13
25
|
__defProp(to, key, {
|
|
14
|
-
get: (
|
|
26
|
+
get: __accessProp.bind(mod, key),
|
|
15
27
|
enumerable: true
|
|
16
28
|
});
|
|
29
|
+
if (canCache)
|
|
30
|
+
cache.set(mod, to);
|
|
17
31
|
return to;
|
|
18
32
|
};
|
|
19
33
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
34
|
+
var __returnValue = (v) => v;
|
|
35
|
+
function __exportSetter(name, newValue) {
|
|
36
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
37
|
+
}
|
|
20
38
|
var __export = (target, all) => {
|
|
21
39
|
for (var name in all)
|
|
22
40
|
__defProp(target, name, {
|
|
23
41
|
get: all[name],
|
|
24
42
|
enumerable: true,
|
|
25
43
|
configurable: true,
|
|
26
|
-
set: (
|
|
44
|
+
set: __exportSetter.bind(all, name)
|
|
27
45
|
});
|
|
28
46
|
};
|
|
29
47
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
@@ -11261,7 +11279,7 @@ function finalize(ctx, schema) {
|
|
|
11261
11279
|
result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
11262
11280
|
} else if (ctx.target === "draft-04") {
|
|
11263
11281
|
result.$schema = "http://json-schema.org/draft-04/schema#";
|
|
11264
|
-
} else if (ctx.target === "openapi-3.0") {}
|
|
11282
|
+
} else if (ctx.target === "openapi-3.0") {}
|
|
11265
11283
|
if (ctx.external?.uri) {
|
|
11266
11284
|
const id = ctx.external.registry.get(schema)?.id;
|
|
11267
11285
|
if (!id)
|
|
@@ -11522,7 +11540,7 @@ var formatMap, stringProcessor = (schema, ctx, _json, _params) => {
|
|
|
11522
11540
|
if (val === undefined) {
|
|
11523
11541
|
if (ctx.unrepresentable === "throw") {
|
|
11524
11542
|
throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
11525
|
-
}
|
|
11543
|
+
}
|
|
11526
11544
|
} else if (typeof val === "bigint") {
|
|
11527
11545
|
if (ctx.unrepresentable === "throw") {
|
|
11528
11546
|
throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
@@ -15926,131 +15944,131 @@ import * as l3 from "readline";
|
|
|
15926
15944
|
import l__default from "readline";
|
|
15927
15945
|
import { ReadStream } from "tty";
|
|
15928
15946
|
function findCursor(s3, o5, l4) {
|
|
15929
|
-
if (!l4.some((
|
|
15947
|
+
if (!l4.some((r7) => !r7.disabled))
|
|
15930
15948
|
return s3;
|
|
15931
|
-
const
|
|
15932
|
-
return l4[
|
|
15949
|
+
const t6 = s3 + o5, n6 = Math.max(l4.length - 1, 0), e6 = t6 < 0 ? n6 : t6 > n6 ? 0 : t6;
|
|
15950
|
+
return l4[e6]?.disabled ? findCursor(e6, o5 < 0 ? -1 : 1, l4) : e6;
|
|
15933
15951
|
}
|
|
15934
15952
|
function findTextCursor(s3, o5, l4, i8) {
|
|
15935
|
-
const
|
|
15953
|
+
const t6 = i8.split(`
|
|
15936
15954
|
`);
|
|
15937
|
-
let
|
|
15938
|
-
for (const
|
|
15939
|
-
if (
|
|
15955
|
+
let n6 = 0, e6 = s3;
|
|
15956
|
+
for (const r7 of t6) {
|
|
15957
|
+
if (e6 <= r7.length)
|
|
15940
15958
|
break;
|
|
15941
|
-
|
|
15959
|
+
e6 -= r7.length + 1, n6++;
|
|
15942
15960
|
}
|
|
15943
|
-
for (
|
|
15944
|
-
|
|
15945
|
-
for (;
|
|
15946
|
-
|
|
15947
|
-
|
|
15961
|
+
for (n6 = Math.max(0, Math.min(t6.length - 1, n6 + l4)), e6 = Math.min(e6, t6[n6].length) + o5;e6 < 0 && n6 > 0; )
|
|
15962
|
+
n6--, e6 += t6[n6].length + 1;
|
|
15963
|
+
for (;e6 > t6[n6].length && n6 < t6.length - 1; )
|
|
15964
|
+
e6 -= t6[n6].length + 1, n6++;
|
|
15965
|
+
e6 = Math.max(0, Math.min(t6[n6].length, e6));
|
|
15948
15966
|
let h4 = 0;
|
|
15949
|
-
for (let
|
|
15950
|
-
h4 +=
|
|
15951
|
-
return h4 +
|
|
15952
|
-
}
|
|
15953
|
-
function updateSettings(
|
|
15954
|
-
if (
|
|
15955
|
-
const
|
|
15956
|
-
for (const s3 in
|
|
15957
|
-
if (!Object.hasOwn(
|
|
15967
|
+
for (let r7 = 0;r7 < n6; r7++)
|
|
15968
|
+
h4 += t6[r7].length + 1;
|
|
15969
|
+
return h4 + e6;
|
|
15970
|
+
}
|
|
15971
|
+
function updateSettings(n6) {
|
|
15972
|
+
if (n6.aliases !== undefined) {
|
|
15973
|
+
const e6 = n6.aliases;
|
|
15974
|
+
for (const s3 in e6) {
|
|
15975
|
+
if (!Object.hasOwn(e6, s3))
|
|
15958
15976
|
continue;
|
|
15959
|
-
const i8 =
|
|
15960
|
-
settings.actions.has(i8)
|
|
15977
|
+
const i8 = e6[s3];
|
|
15978
|
+
i8 === undefined || !settings.actions.has(i8) || settings.aliases.has(s3) || settings.aliases.set(s3, i8);
|
|
15961
15979
|
}
|
|
15962
15980
|
}
|
|
15963
|
-
if (
|
|
15964
|
-
const
|
|
15965
|
-
|
|
15981
|
+
if (n6.messages !== undefined) {
|
|
15982
|
+
const e6 = n6.messages;
|
|
15983
|
+
e6.cancel !== undefined && (settings.messages.cancel = e6.cancel), e6.error !== undefined && (settings.messages.error = e6.error);
|
|
15966
15984
|
}
|
|
15967
|
-
if (
|
|
15968
|
-
const
|
|
15969
|
-
|
|
15985
|
+
if (n6.withGuide !== undefined && (settings.withGuide = n6.withGuide !== false), n6.date !== undefined) {
|
|
15986
|
+
const e6 = n6.date;
|
|
15987
|
+
e6.monthNames !== undefined && (settings.date.monthNames = [...e6.monthNames]), e6.messages !== undefined && (e6.messages.required !== undefined && (settings.date.messages.required = e6.messages.required), e6.messages.invalidMonth !== undefined && (settings.date.messages.invalidMonth = e6.messages.invalidMonth), e6.messages.invalidDay !== undefined && (settings.date.messages.invalidDay = e6.messages.invalidDay), e6.messages.afterMin !== undefined && (settings.date.messages.afterMin = e6.messages.afterMin), e6.messages.beforeMax !== undefined && (settings.date.messages.beforeMax = e6.messages.beforeMax));
|
|
15970
15988
|
}
|
|
15971
15989
|
}
|
|
15972
|
-
function isActionKey(
|
|
15973
|
-
if (typeof
|
|
15974
|
-
return settings.aliases.get(
|
|
15975
|
-
for (const s3 of
|
|
15976
|
-
if (s3 !== undefined && isActionKey(s3,
|
|
15990
|
+
function isActionKey(n6, e6) {
|
|
15991
|
+
if (typeof n6 == "string")
|
|
15992
|
+
return settings.aliases.get(n6) === e6;
|
|
15993
|
+
for (const s3 of n6)
|
|
15994
|
+
if (s3 !== undefined && isActionKey(s3, e6))
|
|
15977
15995
|
return true;
|
|
15978
15996
|
return false;
|
|
15979
15997
|
}
|
|
15980
15998
|
function diffLines(i8, s3) {
|
|
15981
15999
|
if (i8 === s3)
|
|
15982
16000
|
return;
|
|
15983
|
-
const
|
|
15984
|
-
`),
|
|
15985
|
-
`),
|
|
15986
|
-
for (let
|
|
15987
|
-
|
|
16001
|
+
const e6 = i8.split(`
|
|
16002
|
+
`), t7 = s3.split(`
|
|
16003
|
+
`), r7 = Math.max(e6.length, t7.length), f4 = [];
|
|
16004
|
+
for (let n6 = 0;n6 < r7; n6++)
|
|
16005
|
+
e6[n6] !== t7[n6] && f4.push(n6);
|
|
15988
16006
|
return {
|
|
15989
16007
|
lines: f4,
|
|
15990
|
-
numLinesBefore:
|
|
15991
|
-
numLinesAfter:
|
|
15992
|
-
numLines:
|
|
16008
|
+
numLinesBefore: e6.length,
|
|
16009
|
+
numLinesAfter: t7.length,
|
|
16010
|
+
numLines: r7
|
|
15993
16011
|
};
|
|
15994
16012
|
}
|
|
15995
|
-
function isCancel(
|
|
15996
|
-
return
|
|
16013
|
+
function isCancel(e6) {
|
|
16014
|
+
return e6 === CANCEL_SYMBOL;
|
|
15997
16015
|
}
|
|
15998
|
-
function setRawMode(
|
|
15999
|
-
const o5 =
|
|
16000
|
-
o5.isTTY && o5.setRawMode(
|
|
16016
|
+
function setRawMode(e6, r7) {
|
|
16017
|
+
const o5 = e6;
|
|
16018
|
+
o5.isTTY && o5.setRawMode(r7);
|
|
16001
16019
|
}
|
|
16002
16020
|
function block({
|
|
16003
|
-
input:
|
|
16004
|
-
output:
|
|
16021
|
+
input: e6 = stdin,
|
|
16022
|
+
output: r7 = stdout,
|
|
16005
16023
|
overwrite: o5 = true,
|
|
16006
|
-
hideCursor:
|
|
16024
|
+
hideCursor: t7 = true
|
|
16007
16025
|
} = {}) {
|
|
16008
16026
|
const s3 = l3.createInterface({
|
|
16009
|
-
input:
|
|
16010
|
-
output:
|
|
16027
|
+
input: e6,
|
|
16028
|
+
output: r7,
|
|
16011
16029
|
prompt: "",
|
|
16012
16030
|
tabSize: 1
|
|
16013
16031
|
});
|
|
16014
|
-
l3.emitKeypressEvents(
|
|
16015
|
-
const
|
|
16032
|
+
l3.emitKeypressEvents(e6, s3), e6 instanceof ReadStream && e6.isTTY && e6.setRawMode(true);
|
|
16033
|
+
const n6 = (f4, { name: a7, sequence: p4 }) => {
|
|
16016
16034
|
const c3 = String(f4);
|
|
16017
16035
|
if (isActionKey([c3, a7, p4], "cancel")) {
|
|
16018
|
-
|
|
16036
|
+
t7 && r7.write(import_sisteransi.cursor.show), process.exit(0);
|
|
16019
16037
|
return;
|
|
16020
16038
|
}
|
|
16021
16039
|
if (!o5)
|
|
16022
16040
|
return;
|
|
16023
16041
|
const i8 = a7 === "return" ? 0 : -1, m4 = a7 === "return" ? -1 : 0;
|
|
16024
|
-
l3.moveCursor(
|
|
16025
|
-
l3.clearLine(
|
|
16026
|
-
|
|
16042
|
+
l3.moveCursor(r7, i8, m4, () => {
|
|
16043
|
+
l3.clearLine(r7, 1, () => {
|
|
16044
|
+
e6.once("keypress", n6);
|
|
16027
16045
|
});
|
|
16028
16046
|
});
|
|
16029
16047
|
};
|
|
16030
|
-
return
|
|
16031
|
-
|
|
16048
|
+
return t7 && r7.write(import_sisteransi.cursor.hide), e6.once("keypress", n6), () => {
|
|
16049
|
+
e6.off("keypress", n6), t7 && r7.write(import_sisteransi.cursor.show), e6 instanceof ReadStream && e6.isTTY && !R2 && e6.setRawMode(false), s3.terminal = false, s3.close();
|
|
16032
16050
|
};
|
|
16033
16051
|
}
|
|
16034
|
-
function wrapTextWithPrefix(
|
|
16035
|
-
const f4 = getColumns(
|
|
16036
|
-
return wrapAnsi(
|
|
16052
|
+
function wrapTextWithPrefix(e6, r7, o5, t7 = o5, s3 = o5, n6) {
|
|
16053
|
+
const f4 = getColumns(e6 ?? stdout);
|
|
16054
|
+
return wrapAnsi(r7, f4 - o5.length, {
|
|
16037
16055
|
hard: true,
|
|
16038
16056
|
trim: false
|
|
16039
16057
|
}).split(`
|
|
16040
16058
|
`).map((c3, i8, m4) => {
|
|
16041
|
-
const
|
|
16042
|
-
return i8 === 0 ? `${
|
|
16059
|
+
const d5 = n6 ? n6(c3, i8) : c3;
|
|
16060
|
+
return i8 === 0 ? `${t7}${d5}` : i8 === m4.length - 1 ? `${s3}${d5}` : `${o5}${d5}`;
|
|
16043
16061
|
}).join(`
|
|
16044
16062
|
`);
|
|
16045
16063
|
}
|
|
16046
|
-
function runValidation(
|
|
16047
|
-
if ("~standard" in
|
|
16048
|
-
const a7 =
|
|
16064
|
+
function runValidation(e6, n6) {
|
|
16065
|
+
if ("~standard" in e6) {
|
|
16066
|
+
const a7 = e6["~standard"].validate(n6);
|
|
16049
16067
|
if (a7 instanceof Promise)
|
|
16050
16068
|
throw new TypeError("Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic.");
|
|
16051
16069
|
return a7.issues?.at(0)?.message;
|
|
16052
16070
|
}
|
|
16053
|
-
return
|
|
16071
|
+
return e6(n6);
|
|
16054
16072
|
}
|
|
16055
16073
|
|
|
16056
16074
|
class V2 {
|
|
@@ -16068,35 +16086,35 @@ class V2 {
|
|
|
16068
16086
|
error = "";
|
|
16069
16087
|
value;
|
|
16070
16088
|
userInput = "";
|
|
16071
|
-
constructor(
|
|
16072
|
-
const { input: i8 = stdin, output:
|
|
16073
|
-
this.opts = o5, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = s3.bind(this), this._track =
|
|
16089
|
+
constructor(t7, e6 = true) {
|
|
16090
|
+
const { input: i8 = stdin, output: n6 = stdout, render: s3, signal: r7, ...o5 } = t7;
|
|
16091
|
+
this.opts = o5, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = s3.bind(this), this._track = e6, this._abortSignal = r7, this.input = i8, this.output = n6;
|
|
16074
16092
|
}
|
|
16075
16093
|
unsubscribe() {
|
|
16076
16094
|
this._subscribers.clear();
|
|
16077
16095
|
}
|
|
16078
|
-
setSubscriber(
|
|
16079
|
-
const i8 = this._subscribers.get(
|
|
16080
|
-
i8.push(
|
|
16096
|
+
setSubscriber(t7, e6) {
|
|
16097
|
+
const i8 = this._subscribers.get(t7) ?? [];
|
|
16098
|
+
i8.push(e6), this._subscribers.set(t7, i8);
|
|
16081
16099
|
}
|
|
16082
|
-
on(
|
|
16083
|
-
this.setSubscriber(
|
|
16100
|
+
on(t7, e6) {
|
|
16101
|
+
this.setSubscriber(t7, { cb: e6 });
|
|
16084
16102
|
}
|
|
16085
|
-
once(
|
|
16086
|
-
this.setSubscriber(
|
|
16103
|
+
once(t7, e6) {
|
|
16104
|
+
this.setSubscriber(t7, { cb: e6, once: true });
|
|
16087
16105
|
}
|
|
16088
|
-
emit(
|
|
16089
|
-
const i8 = this._subscribers.get(
|
|
16106
|
+
emit(t7, ...e6) {
|
|
16107
|
+
const i8 = this._subscribers.get(t7) ?? [], n6 = [];
|
|
16090
16108
|
for (const s3 of i8)
|
|
16091
|
-
s3.cb(...
|
|
16092
|
-
for (const s3 of
|
|
16109
|
+
s3.cb(...e6), s3.once && n6.push(() => i8.splice(i8.indexOf(s3), 1));
|
|
16110
|
+
for (const s3 of n6)
|
|
16093
16111
|
s3();
|
|
16094
16112
|
}
|
|
16095
16113
|
prompt() {
|
|
16096
|
-
return new Promise((
|
|
16114
|
+
return new Promise((t7) => {
|
|
16097
16115
|
if (this._abortSignal) {
|
|
16098
16116
|
if (this._abortSignal.aborted)
|
|
16099
|
-
return this.state = "cancel", this.close(),
|
|
16117
|
+
return this.state = "cancel", this.close(), t7(CANCEL_SYMBOL);
|
|
16100
16118
|
this._abortSignal.addEventListener("abort", () => {
|
|
16101
16119
|
this.state = "cancel", this.close();
|
|
16102
16120
|
}, { once: true });
|
|
@@ -16108,166 +16126,166 @@ class V2 {
|
|
|
16108
16126
|
escapeCodeTimeout: 50,
|
|
16109
16127
|
terminal: true
|
|
16110
16128
|
}), this.rl.prompt(), this.opts.initialUserInput !== undefined && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), setRawMode(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
16111
|
-
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false),
|
|
16129
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t7(this.value);
|
|
16112
16130
|
}), this.once("cancel", () => {
|
|
16113
|
-
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false),
|
|
16131
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t7(CANCEL_SYMBOL);
|
|
16114
16132
|
});
|
|
16115
16133
|
});
|
|
16116
16134
|
}
|
|
16117
|
-
_isActionKey(
|
|
16118
|
-
return
|
|
16135
|
+
_isActionKey(t7, e6) {
|
|
16136
|
+
return t7 === "\t";
|
|
16119
16137
|
}
|
|
16120
|
-
_shouldSubmit(
|
|
16138
|
+
_shouldSubmit(t7, e6) {
|
|
16121
16139
|
return true;
|
|
16122
16140
|
}
|
|
16123
|
-
_setValue(
|
|
16124
|
-
this.value =
|
|
16141
|
+
_setValue(t7) {
|
|
16142
|
+
this.value = t7, this.emit("value", this.value);
|
|
16125
16143
|
}
|
|
16126
|
-
_setUserInput(
|
|
16127
|
-
this.userInput =
|
|
16144
|
+
_setUserInput(t7, e6) {
|
|
16145
|
+
this.userInput = t7 ?? "", this.emit("userInput", this.userInput), e6 && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
|
|
16128
16146
|
}
|
|
16129
16147
|
_clearUserInput() {
|
|
16130
16148
|
this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
|
|
16131
16149
|
}
|
|
16132
|
-
onKeypress(
|
|
16133
|
-
if (this._track &&
|
|
16150
|
+
onKeypress(t7, e6) {
|
|
16151
|
+
if (this._track && e6.name !== "return" && (e6.name && this._isActionKey(t7, e6) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e6?.name && (!this._track && settings.aliases.has(e6.name) && this.emit("cursor", settings.aliases.get(e6.name)), settings.actions.has(e6.name) && this.emit("cursor", e6.name)), t7 && (t7.toLowerCase() === "y" || t7.toLowerCase() === "n") && this.emit("confirm", t7.toLowerCase() === "y"), this.emit("key", t7, e6), e6?.name === "return" && this._shouldSubmit(t7, e6)) {
|
|
16134
16152
|
if (this.opts.validate) {
|
|
16135
16153
|
const i8 = runValidation(this.opts.validate, this.value);
|
|
16136
16154
|
i8 && (this.error = i8 instanceof Error ? i8.message : i8, this.state = "error", this.rl?.write(this.userInput));
|
|
16137
16155
|
}
|
|
16138
16156
|
this.state !== "error" && (this.state = "submit");
|
|
16139
16157
|
}
|
|
16140
|
-
isActionKey([
|
|
16158
|
+
isActionKey([t7, e6?.name, e6?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
16141
16159
|
}
|
|
16142
16160
|
close() {
|
|
16143
16161
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
16144
16162
|
`), setRawMode(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
16145
16163
|
}
|
|
16146
16164
|
restoreCursor() {
|
|
16147
|
-
const
|
|
16165
|
+
const t7 = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
|
|
16148
16166
|
`).length - 1;
|
|
16149
|
-
this.output.write(import_sisteransi.cursor.move(-999,
|
|
16167
|
+
this.output.write(import_sisteransi.cursor.move(-999, t7 * -1));
|
|
16150
16168
|
}
|
|
16151
16169
|
render() {
|
|
16152
|
-
const
|
|
16170
|
+
const t7 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
|
|
16153
16171
|
hard: true,
|
|
16154
16172
|
trim: false
|
|
16155
16173
|
});
|
|
16156
|
-
if (
|
|
16174
|
+
if (t7 !== this._prevFrame) {
|
|
16157
16175
|
if (this.state === "initial")
|
|
16158
16176
|
this.output.write(import_sisteransi.cursor.hide);
|
|
16159
16177
|
else {
|
|
16160
|
-
const
|
|
16161
|
-
if (this.restoreCursor(),
|
|
16162
|
-
const
|
|
16163
|
-
let
|
|
16164
|
-
if (
|
|
16165
|
-
this._prevFrame =
|
|
16178
|
+
const e6 = diffLines(this._prevFrame, t7), i8 = getRows(this.output);
|
|
16179
|
+
if (this.restoreCursor(), e6) {
|
|
16180
|
+
const n6 = Math.max(0, e6.numLinesAfter - i8), s3 = Math.max(0, e6.numLinesBefore - i8);
|
|
16181
|
+
let r7 = e6.lines.find((o5) => o5 >= n6);
|
|
16182
|
+
if (r7 === undefined) {
|
|
16183
|
+
this._prevFrame = t7;
|
|
16166
16184
|
return;
|
|
16167
16185
|
}
|
|
16168
|
-
if (
|
|
16169
|
-
this.output.write(import_sisteransi.cursor.move(0,
|
|
16170
|
-
const o5 =
|
|
16186
|
+
if (e6.lines.length === 1) {
|
|
16187
|
+
this.output.write(import_sisteransi.cursor.move(0, r7 - s3)), this.output.write(import_sisteransi.erase.lines(1));
|
|
16188
|
+
const o5 = t7.split(`
|
|
16171
16189
|
`);
|
|
16172
|
-
this.output.write(o5[
|
|
16190
|
+
this.output.write(o5[r7]), this._prevFrame = t7, this.output.write(import_sisteransi.cursor.move(0, o5.length - r7 - 1));
|
|
16173
16191
|
return;
|
|
16174
|
-
} else if (
|
|
16175
|
-
if (
|
|
16176
|
-
|
|
16192
|
+
} else if (e6.lines.length > 1) {
|
|
16193
|
+
if (n6 < s3)
|
|
16194
|
+
r7 = n6;
|
|
16177
16195
|
else {
|
|
16178
|
-
const h4 =
|
|
16196
|
+
const h4 = r7 - s3;
|
|
16179
16197
|
h4 > 0 && this.output.write(import_sisteransi.cursor.move(0, h4));
|
|
16180
16198
|
}
|
|
16181
16199
|
this.output.write(import_sisteransi.erase.down());
|
|
16182
|
-
const f4 =
|
|
16183
|
-
`).slice(
|
|
16200
|
+
const f4 = t7.split(`
|
|
16201
|
+
`).slice(r7);
|
|
16184
16202
|
this.output.write(f4.join(`
|
|
16185
|
-
`)), this._prevFrame =
|
|
16203
|
+
`)), this._prevFrame = t7;
|
|
16186
16204
|
return;
|
|
16187
16205
|
}
|
|
16188
16206
|
}
|
|
16189
16207
|
this.output.write(import_sisteransi.erase.down());
|
|
16190
16208
|
}
|
|
16191
|
-
this.output.write(
|
|
16209
|
+
this.output.write(t7), this.state === "initial" && (this.state = "active"), this._prevFrame = t7;
|
|
16192
16210
|
}
|
|
16193
16211
|
}
|
|
16194
16212
|
}
|
|
16195
|
-
function p$1(l4,
|
|
16196
|
-
if (l4 === undefined ||
|
|
16213
|
+
function p$1(l4, e6) {
|
|
16214
|
+
if (l4 === undefined || e6.length === 0)
|
|
16197
16215
|
return 0;
|
|
16198
|
-
const i8 =
|
|
16216
|
+
const i8 = e6.findIndex((s3) => s3.value === l4);
|
|
16199
16217
|
return i8 !== -1 ? i8 : 0;
|
|
16200
16218
|
}
|
|
16201
|
-
function g3(l4,
|
|
16202
|
-
return (
|
|
16219
|
+
function g3(l4, e6) {
|
|
16220
|
+
return (e6.label ?? String(e6.value)).toLowerCase().includes(l4.toLowerCase());
|
|
16203
16221
|
}
|
|
16204
|
-
function m4(l4,
|
|
16205
|
-
if (
|
|
16206
|
-
return l4 ?
|
|
16222
|
+
function m4(l4, e6) {
|
|
16223
|
+
if (e6)
|
|
16224
|
+
return l4 ? e6 : e6[0];
|
|
16207
16225
|
}
|
|
16208
|
-
function M2(
|
|
16209
|
-
return [...
|
|
16226
|
+
function M2(r8) {
|
|
16227
|
+
return [...r8].map((t7) => _3[t7]);
|
|
16210
16228
|
}
|
|
16211
|
-
function P2(
|
|
16212
|
-
const i8 = new Intl.DateTimeFormat(
|
|
16229
|
+
function P2(r8) {
|
|
16230
|
+
const i8 = new Intl.DateTimeFormat(r8, {
|
|
16213
16231
|
year: "numeric",
|
|
16214
16232
|
month: "2-digit",
|
|
16215
16233
|
day: "2-digit"
|
|
16216
16234
|
}).formatToParts(new Date(2000, 0, 15)), s3 = [];
|
|
16217
|
-
let
|
|
16218
|
-
for (const
|
|
16219
|
-
|
|
16220
|
-
return { segments: s3, separator:
|
|
16235
|
+
let n6 = "/";
|
|
16236
|
+
for (const e6 of i8)
|
|
16237
|
+
e6.type === "literal" ? n6 = e6.value.trim() || e6.value : (e6.type === "year" || e6.type === "month" || e6.type === "day") && s3.push({ type: e6.type, len: e6.type === "year" ? 4 : 2 });
|
|
16238
|
+
return { segments: s3, separator: n6 };
|
|
16221
16239
|
}
|
|
16222
|
-
function p4(
|
|
16223
|
-
return Number.parseInt((
|
|
16240
|
+
function p4(r8) {
|
|
16241
|
+
return Number.parseInt((r8 || "0").replace(/_/g, "0"), 10) || 0;
|
|
16224
16242
|
}
|
|
16225
|
-
function f4(
|
|
16243
|
+
function f4(r8) {
|
|
16226
16244
|
return {
|
|
16227
|
-
year: p4(
|
|
16228
|
-
month: p4(
|
|
16229
|
-
day: p4(
|
|
16245
|
+
year: p4(r8.year),
|
|
16246
|
+
month: p4(r8.month),
|
|
16247
|
+
day: p4(r8.day)
|
|
16230
16248
|
};
|
|
16231
16249
|
}
|
|
16232
|
-
function c3(
|
|
16233
|
-
return new Date(
|
|
16250
|
+
function c3(r8, t7) {
|
|
16251
|
+
return new Date(r8 || 2001, t7 || 1, 0).getDate();
|
|
16234
16252
|
}
|
|
16235
|
-
function b3(
|
|
16236
|
-
const { year:
|
|
16237
|
-
if (!
|
|
16253
|
+
function b3(r8) {
|
|
16254
|
+
const { year: t7, month: i8, day: s3 } = f4(r8);
|
|
16255
|
+
if (!t7 || t7 < 0 || t7 > 9999 || !i8 || i8 < 1 || i8 > 12 || !s3 || s3 < 1)
|
|
16238
16256
|
return;
|
|
16239
|
-
const
|
|
16240
|
-
if (!(
|
|
16241
|
-
return { year:
|
|
16257
|
+
const n6 = new Date(Date.UTC(t7, i8 - 1, s3));
|
|
16258
|
+
if (!(n6.getUTCFullYear() !== t7 || n6.getUTCMonth() !== i8 - 1 || n6.getUTCDate() !== s3))
|
|
16259
|
+
return { year: t7, month: i8, day: s3 };
|
|
16242
16260
|
}
|
|
16243
|
-
function C3(
|
|
16244
|
-
const
|
|
16245
|
-
return
|
|
16261
|
+
function C3(r8) {
|
|
16262
|
+
const t7 = b3(r8);
|
|
16263
|
+
return t7 ? new Date(Date.UTC(t7.year, t7.month - 1, t7.day)) : undefined;
|
|
16246
16264
|
}
|
|
16247
|
-
function T4(
|
|
16248
|
-
const
|
|
16265
|
+
function T4(r8, t7, i8, s3) {
|
|
16266
|
+
const n6 = i8 ? {
|
|
16249
16267
|
year: i8.getUTCFullYear(),
|
|
16250
16268
|
month: i8.getUTCMonth() + 1,
|
|
16251
16269
|
day: i8.getUTCDate()
|
|
16252
|
-
} : null,
|
|
16270
|
+
} : null, e6 = s3 ? {
|
|
16253
16271
|
year: s3.getUTCFullYear(),
|
|
16254
16272
|
month: s3.getUTCMonth() + 1,
|
|
16255
16273
|
day: s3.getUTCDate()
|
|
16256
16274
|
} : null;
|
|
16257
|
-
return
|
|
16258
|
-
min:
|
|
16259
|
-
max:
|
|
16275
|
+
return r8 === "year" ? { min: n6?.year ?? 1, max: e6?.year ?? 9999 } : r8 === "month" ? {
|
|
16276
|
+
min: n6 && t7.year === n6.year ? n6.month : 1,
|
|
16277
|
+
max: e6 && t7.year === e6.year ? e6.month : 12
|
|
16260
16278
|
} : {
|
|
16261
|
-
min:
|
|
16262
|
-
max:
|
|
16279
|
+
min: n6 && t7.year === n6.year && t7.month === n6.month ? n6.day : 1,
|
|
16280
|
+
max: e6 && t7.year === e6.year && t7.month === e6.month ? e6.day : c3(t7.year, t7.month)
|
|
16263
16281
|
};
|
|
16264
16282
|
}
|
|
16265
|
-
var import_sisteransi, a$
|
|
16283
|
+
var import_sisteransi, a$1, t6, settings, R2, CANCEL_SYMBOL, getColumns = (e6) => ("columns" in e6) && typeof e6.columns == "number" ? e6.columns : 80, getRows = (e6) => ("rows" in e6) && typeof e6.rows == "number" ? e6.rows : 20, T$1, r7, _3, U2, u$2, o5, h4, a7, u$1, n$1, u6, n7;
|
|
16266
16284
|
var init_dist3 = __esm(() => {
|
|
16267
16285
|
init_main();
|
|
16268
16286
|
import_sisteransi = __toESM(require_src(), 1);
|
|
16269
|
-
a$
|
|
16270
|
-
|
|
16287
|
+
a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
16288
|
+
t6 = [
|
|
16271
16289
|
"January",
|
|
16272
16290
|
"February",
|
|
16273
16291
|
"March",
|
|
@@ -16282,7 +16300,7 @@ var init_dist3 = __esm(() => {
|
|
|
16282
16300
|
"December"
|
|
16283
16301
|
];
|
|
16284
16302
|
settings = {
|
|
16285
|
-
actions: new Set(a$
|
|
16303
|
+
actions: new Set(a$1),
|
|
16286
16304
|
aliases: /* @__PURE__ */ new Map([
|
|
16287
16305
|
["k", "up"],
|
|
16288
16306
|
["j", "down"],
|
|
@@ -16297,13 +16315,13 @@ var init_dist3 = __esm(() => {
|
|
|
16297
16315
|
},
|
|
16298
16316
|
withGuide: true,
|
|
16299
16317
|
date: {
|
|
16300
|
-
monthNames: [...
|
|
16318
|
+
monthNames: [...t6],
|
|
16301
16319
|
messages: {
|
|
16302
16320
|
required: "Please enter a valid date",
|
|
16303
16321
|
invalidMonth: "There are only 12 months in a year",
|
|
16304
|
-
invalidDay: (
|
|
16305
|
-
afterMin: (
|
|
16306
|
-
beforeMax: (
|
|
16322
|
+
invalidDay: (n6, e6) => `There are only ${n6} days in ${e6}`,
|
|
16323
|
+
afterMin: (n6) => `Date must be on or after ${n6.toISOString().slice(0, 10)}`,
|
|
16324
|
+
beforeMax: (n6) => `Date must be on or before ${n6.toISOString().slice(0, 10)}`
|
|
16307
16325
|
}
|
|
16308
16326
|
}
|
|
16309
16327
|
};
|
|
@@ -16328,46 +16346,46 @@ var init_dist3 = __esm(() => {
|
|
|
16328
16346
|
return styleText(["inverse", "hidden"], "_");
|
|
16329
16347
|
if (this._cursor >= this.userInput.length)
|
|
16330
16348
|
return `${this.userInput}\u2588`;
|
|
16331
|
-
const
|
|
16332
|
-
return `${
|
|
16349
|
+
const e6 = this.userInput.slice(0, this.cursor), t7 = this.userInput.slice(this.cursor, this.cursor + 1), i8 = this.userInput.slice(this.cursor + 1);
|
|
16350
|
+
return `${e6}${styleText("inverse", t7)}${i8}`;
|
|
16333
16351
|
}
|
|
16334
16352
|
get options() {
|
|
16335
16353
|
return typeof this.#i == "function" ? this.#i() : this.#i;
|
|
16336
16354
|
}
|
|
16337
|
-
constructor(
|
|
16338
|
-
super(
|
|
16339
|
-
const
|
|
16340
|
-
this.filteredOptions = [...
|
|
16355
|
+
constructor(e6) {
|
|
16356
|
+
super(e6), this.#i = e6.options, this.#n = e6.placeholder;
|
|
16357
|
+
const t7 = this.options;
|
|
16358
|
+
this.filteredOptions = [...t7], this.multiple = e6.multiple === true, this.#t = typeof e6.options == "function" ? e6.filter : e6.filter ?? g3;
|
|
16341
16359
|
let i8;
|
|
16342
|
-
if (
|
|
16360
|
+
if (e6.initialValue && Array.isArray(e6.initialValue) ? this.multiple ? i8 = e6.initialValue : i8 = e6.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (i8 = [this.options[0]?.value]), i8)
|
|
16343
16361
|
for (const s3 of i8) {
|
|
16344
|
-
const
|
|
16345
|
-
|
|
16362
|
+
const n6 = t7.findIndex((o5) => o5.value === s3);
|
|
16363
|
+
n6 !== -1 && (this.toggleSelected(s3), this.#e = n6);
|
|
16346
16364
|
}
|
|
16347
|
-
this.focusedValue = this.options[this.#e]?.value, this.on("key", (s3,
|
|
16365
|
+
this.focusedValue = this.options[this.#e]?.value, this.on("key", (s3, n6) => this.#l(s3, n6)), this.on("userInput", (s3) => this.#u(s3));
|
|
16348
16366
|
}
|
|
16349
|
-
_isActionKey(
|
|
16350
|
-
return
|
|
16367
|
+
_isActionKey(e6, t7) {
|
|
16368
|
+
return e6 === "\t" || this.multiple && this.isNavigating && t7.name === "space" && e6 !== undefined && e6 !== "";
|
|
16351
16369
|
}
|
|
16352
|
-
#l(
|
|
16353
|
-
const i8 =
|
|
16354
|
-
if (
|
|
16355
|
-
this.userInput === "\t" && this._clearUserInput(), this._setUserInput(
|
|
16370
|
+
#l(e6, t7) {
|
|
16371
|
+
const i8 = t7.name === "up", s3 = t7.name === "down", n6 = t7.name === "return", o5 = this.userInput === "" || this.userInput === "\t", u4 = this.#n, a7 = this.options, f4 = u4 !== undefined && u4 !== "" && a7.some((r7) => !r7.disabled && (this.#t ? this.#t(u4, r7) : true));
|
|
16372
|
+
if (t7.name === "tab" && o5 && f4) {
|
|
16373
|
+
this.userInput === "\t" && this._clearUserInput(), this._setUserInput(u4, true), this.isNavigating = false;
|
|
16356
16374
|
return;
|
|
16357
16375
|
}
|
|
16358
|
-
i8 || s3 ? (this.#e = findCursor(this.#e, i8 ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#e]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = true) :
|
|
16376
|
+
i8 || s3 ? (this.#e = findCursor(this.#e, i8 ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#e]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = true) : n6 ? this.value = m4(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== undefined && (t7.name === "tab" || this.isNavigating && t7.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = false : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = false);
|
|
16359
16377
|
}
|
|
16360
16378
|
deselectAll() {
|
|
16361
16379
|
this.selectedValues = [];
|
|
16362
16380
|
}
|
|
16363
|
-
toggleSelected(
|
|
16364
|
-
this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(
|
|
16381
|
+
toggleSelected(e6) {
|
|
16382
|
+
this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(e6) ? this.selectedValues = this.selectedValues.filter((t7) => t7 !== e6) : this.selectedValues = [...this.selectedValues, e6] : this.selectedValues = [e6]);
|
|
16365
16383
|
}
|
|
16366
|
-
#u(
|
|
16367
|
-
if (
|
|
16368
|
-
this.#s =
|
|
16369
|
-
const
|
|
16370
|
-
|
|
16384
|
+
#u(e6) {
|
|
16385
|
+
if (e6 !== this.#s) {
|
|
16386
|
+
this.#s = e6;
|
|
16387
|
+
const t7 = this.options;
|
|
16388
|
+
e6 && this.#t ? this.filteredOptions = t7.filter((n6) => this.#t?.(e6, n6)) : this.filteredOptions = [...t7];
|
|
16371
16389
|
const i8 = p$1(this.focusedValue, this.filteredOptions);
|
|
16372
16390
|
this.#e = findCursor(i8, 0, this.filteredOptions);
|
|
16373
16391
|
const s3 = this.filteredOptions[this.#e];
|
|
@@ -16375,15 +16393,15 @@ var init_dist3 = __esm(() => {
|
|
|
16375
16393
|
}
|
|
16376
16394
|
}
|
|
16377
16395
|
};
|
|
16378
|
-
|
|
16396
|
+
r7 = class r7 extends V2 {
|
|
16379
16397
|
get cursor() {
|
|
16380
16398
|
return this.value ? 0 : 1;
|
|
16381
16399
|
}
|
|
16382
16400
|
get _value() {
|
|
16383
16401
|
return this.cursor === 0;
|
|
16384
16402
|
}
|
|
16385
|
-
constructor(
|
|
16386
|
-
super(
|
|
16403
|
+
constructor(t7) {
|
|
16404
|
+
super(t7, false), this.value = !!t7.initialValue, this.on("userInput", () => {
|
|
16387
16405
|
this.value = this._value;
|
|
16388
16406
|
}), this.on("confirm", (i8) => {
|
|
16389
16407
|
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = i8, this.state = "submit", this.close();
|
|
@@ -16422,44 +16440,44 @@ var init_dist3 = __esm(() => {
|
|
|
16422
16440
|
get formattedValue() {
|
|
16423
16441
|
return this.#l(this.#t);
|
|
16424
16442
|
}
|
|
16425
|
-
#l(
|
|
16426
|
-
return this.#i.map((i8) =>
|
|
16443
|
+
#l(t7) {
|
|
16444
|
+
return this.#i.map((i8) => t7[i8.type]).join(this.#o);
|
|
16427
16445
|
}
|
|
16428
16446
|
#r() {
|
|
16429
16447
|
this._setUserInput(this.#l(this.#t)), this._setValue(C3(this.#t) ?? undefined);
|
|
16430
16448
|
}
|
|
16431
|
-
constructor(
|
|
16432
|
-
const i8 =
|
|
16433
|
-
year: String(
|
|
16434
|
-
month: String(
|
|
16435
|
-
day: String(
|
|
16436
|
-
} : { year: "____", month: "__", day: "__" }, o5 =
|
|
16437
|
-
super({ ...
|
|
16449
|
+
constructor(t7) {
|
|
16450
|
+
const i8 = t7.format ? { segments: M2(t7.format), separator: t7.separator ?? "/" } : P2(t7.locale), s3 = t7.separator ?? i8.separator, n6 = t7.format ? M2(t7.format) : i8.segments, e6 = t7.initialValue ?? t7.defaultValue, m5 = e6 ? {
|
|
16451
|
+
year: String(e6.getUTCFullYear()).padStart(4, "0"),
|
|
16452
|
+
month: String(e6.getUTCMonth() + 1).padStart(2, "0"),
|
|
16453
|
+
day: String(e6.getUTCDate()).padStart(2, "0")
|
|
16454
|
+
} : { year: "____", month: "__", day: "__" }, o5 = n6.map((a7) => m5[a7.type]).join(s3);
|
|
16455
|
+
super({ ...t7, initialUserInput: o5 }, false), this.#i = n6, this.#o = s3, this.#t = m5, this.#h = t7.minDate, this.#u = t7.maxDate, this.#r(), this.on("cursor", (a7) => this.#f(a7)), this.on("key", (a7, u4) => this.#y(a7, u4)), this.on("finalize", () => this.#p(t7));
|
|
16438
16456
|
}
|
|
16439
16457
|
#a() {
|
|
16440
|
-
const
|
|
16458
|
+
const t7 = Math.max(0, Math.min(this.#e.segmentIndex, this.#i.length - 1)), i8 = this.#i[t7];
|
|
16441
16459
|
if (i8)
|
|
16442
|
-
return this.#e.positionInSegment = Math.max(0, Math.min(this.#e.positionInSegment, i8.len - 1)), { segment: i8, index:
|
|
16460
|
+
return this.#e.positionInSegment = Math.max(0, Math.min(this.#e.positionInSegment, i8.len - 1)), { segment: i8, index: t7 };
|
|
16443
16461
|
}
|
|
16444
|
-
#m(
|
|
16462
|
+
#m(t7) {
|
|
16445
16463
|
this.inlineError = "", this.#s = null;
|
|
16446
16464
|
const i8 = this.#a();
|
|
16447
|
-
i8 && (this.#e.segmentIndex = Math.max(0, Math.min(this.#i.length - 1, i8.index +
|
|
16465
|
+
i8 && (this.#e.segmentIndex = Math.max(0, Math.min(this.#i.length - 1, i8.index + t7)), this.#e.positionInSegment = 0, this.#n = true);
|
|
16448
16466
|
}
|
|
16449
|
-
#d(
|
|
16467
|
+
#d(t7) {
|
|
16450
16468
|
const i8 = this.#a();
|
|
16451
16469
|
if (!i8)
|
|
16452
16470
|
return;
|
|
16453
|
-
const { segment: s3 } = i8,
|
|
16471
|
+
const { segment: s3 } = i8, n6 = this.#t[s3.type], e6 = !n6 || n6.replace(/_/g, "") === "", m5 = Number.parseInt((n6 || "0").replace(/_/g, "0"), 10) || 0, o5 = T4(s3.type, f4(this.#t), this.#h, this.#u);
|
|
16454
16472
|
let a7;
|
|
16455
|
-
|
|
16473
|
+
e6 ? a7 = t7 === 1 ? o5.min : o5.max : a7 = Math.max(Math.min(o5.max, m5 + t7), o5.min), this.#t = {
|
|
16456
16474
|
...this.#t,
|
|
16457
16475
|
[s3.type]: a7.toString().padStart(s3.len, "0")
|
|
16458
16476
|
}, this.#n = true, this.#s = null, this.#r();
|
|
16459
16477
|
}
|
|
16460
|
-
#f(
|
|
16461
|
-
if (
|
|
16462
|
-
switch (
|
|
16478
|
+
#f(t7) {
|
|
16479
|
+
if (t7)
|
|
16480
|
+
switch (t7) {
|
|
16463
16481
|
case "right":
|
|
16464
16482
|
return this.#m(1);
|
|
16465
16483
|
case "left":
|
|
@@ -16470,121 +16488,122 @@ var init_dist3 = __esm(() => {
|
|
|
16470
16488
|
return this.#d(-1);
|
|
16471
16489
|
}
|
|
16472
16490
|
}
|
|
16473
|
-
#y(
|
|
16474
|
-
if (i8?.name === "backspace" || i8?.sequence === "\x7F" || i8?.sequence === "\b" ||
|
|
16491
|
+
#y(t7, i8) {
|
|
16492
|
+
if (i8?.name === "backspace" || i8?.sequence === "\x7F" || i8?.sequence === "\b" || t7 === "\x7F" || t7 === "\b") {
|
|
16475
16493
|
this.inlineError = "";
|
|
16476
|
-
const
|
|
16477
|
-
if (!
|
|
16494
|
+
const n6 = this.#a();
|
|
16495
|
+
if (!n6)
|
|
16478
16496
|
return;
|
|
16479
|
-
if (!this.#t[
|
|
16497
|
+
if (!this.#t[n6.segment.type].replace(/_/g, "")) {
|
|
16480
16498
|
this.#m(-1);
|
|
16481
16499
|
return;
|
|
16482
16500
|
}
|
|
16483
|
-
this.#t[
|
|
16501
|
+
this.#t[n6.segment.type] = "_".repeat(n6.segment.len), this.#n = true, this.#e.positionInSegment = 0, this.#r();
|
|
16484
16502
|
return;
|
|
16485
16503
|
}
|
|
16486
16504
|
if (i8?.name === "tab") {
|
|
16487
16505
|
this.inlineError = "";
|
|
16488
|
-
const
|
|
16489
|
-
if (!
|
|
16506
|
+
const n6 = this.#a();
|
|
16507
|
+
if (!n6)
|
|
16490
16508
|
return;
|
|
16491
|
-
const
|
|
16509
|
+
const e6 = i8.shift ? -1 : 1, m5 = n6.index + e6;
|
|
16492
16510
|
m5 >= 0 && m5 < this.#i.length && (this.#e.segmentIndex = m5, this.#e.positionInSegment = 0, this.#n = true);
|
|
16493
16511
|
return;
|
|
16494
16512
|
}
|
|
16495
|
-
if (
|
|
16496
|
-
const
|
|
16497
|
-
if (!
|
|
16513
|
+
if (t7 && /^[0-9]$/.test(t7)) {
|
|
16514
|
+
const n6 = this.#a();
|
|
16515
|
+
if (!n6)
|
|
16498
16516
|
return;
|
|
16499
|
-
const { segment:
|
|
16517
|
+
const { segment: e6 } = n6, m5 = !this.#t[e6.type].replace(/_/g, "");
|
|
16500
16518
|
if (this.#n && this.#s !== null && !m5) {
|
|
16501
|
-
const h4 = this.#s +
|
|
16519
|
+
const h4 = this.#s + t7, d5 = { ...this.#t, [e6.type]: h4 }, g4 = this.#g(d5, e6);
|
|
16502
16520
|
if (g4) {
|
|
16503
16521
|
this.inlineError = g4, this.#s = null, this.#n = false;
|
|
16504
16522
|
return;
|
|
16505
16523
|
}
|
|
16506
|
-
this.inlineError = "", this.#t[
|
|
16524
|
+
this.inlineError = "", this.#t[e6.type] = h4, this.#s = null, this.#n = false, this.#r(), n6.index < this.#i.length - 1 && (this.#e.segmentIndex = n6.index + 1, this.#e.positionInSegment = 0, this.#n = true);
|
|
16507
16525
|
return;
|
|
16508
16526
|
}
|
|
16509
|
-
this.#n && !m5 && (this.#t[
|
|
16510
|
-
const o5 = this.#t[
|
|
16511
|
-
if (
|
|
16527
|
+
this.#n && !m5 && (this.#t[e6.type] = "_".repeat(e6.len), this.#e.positionInSegment = 0), this.#n = false, this.#s = null;
|
|
16528
|
+
const o5 = this.#t[e6.type], a7 = o5.indexOf("_"), u4 = a7 >= 0 ? a7 : Math.min(this.#e.positionInSegment, e6.len - 1);
|
|
16529
|
+
if (u4 < 0 || u4 >= e6.len)
|
|
16512
16530
|
return;
|
|
16513
|
-
let l4 = o5.slice(0,
|
|
16514
|
-
if (
|
|
16515
|
-
const h4 = Number.parseInt(
|
|
16516
|
-
l4 = `0${
|
|
16517
|
-
}
|
|
16518
|
-
if (
|
|
16519
|
-
const h4 = { ...this.#t, [
|
|
16520
|
-
if (
|
|
16521
|
-
this.inlineError =
|
|
16531
|
+
let l4 = o5.slice(0, u4) + t7 + o5.slice(u4 + 1), D2 = false;
|
|
16532
|
+
if (u4 === 0 && o5 === "__" && (e6.type === "month" || e6.type === "day")) {
|
|
16533
|
+
const h4 = Number.parseInt(t7, 10);
|
|
16534
|
+
l4 = `0${t7}`, D2 = h4 <= (e6.type === "month" ? 1 : 2);
|
|
16535
|
+
}
|
|
16536
|
+
if (e6.type === "year" && (l4 = (o5.replace(/_/g, "") + t7).padStart(e6.len, "_")), !l4.includes("_")) {
|
|
16537
|
+
const h4 = { ...this.#t, [e6.type]: l4 }, d5 = this.#g(h4, e6);
|
|
16538
|
+
if (d5) {
|
|
16539
|
+
this.inlineError = d5;
|
|
16522
16540
|
return;
|
|
16523
16541
|
}
|
|
16524
16542
|
}
|
|
16525
|
-
this.inlineError = "", this.#t[
|
|
16543
|
+
this.inlineError = "", this.#t[e6.type] = l4;
|
|
16526
16544
|
const y3 = l4.includes("_") ? undefined : b3(this.#t);
|
|
16527
16545
|
if (y3) {
|
|
16528
|
-
const { year: h4, month:
|
|
16546
|
+
const { year: h4, month: d5 } = y3, g4 = c3(h4, d5);
|
|
16529
16547
|
this.#t = {
|
|
16530
16548
|
year: String(Math.max(0, Math.min(9999, h4))).padStart(4, "0"),
|
|
16531
|
-
month: String(Math.max(1, Math.min(12,
|
|
16549
|
+
month: String(Math.max(1, Math.min(12, d5))).padStart(2, "0"),
|
|
16532
16550
|
day: String(Math.max(1, Math.min(g4, y3.day))).padStart(2, "0")
|
|
16533
16551
|
};
|
|
16534
16552
|
}
|
|
16535
16553
|
this.#r();
|
|
16536
16554
|
const S3 = l4.indexOf("_");
|
|
16537
|
-
D2 ? (this.#n = true, this.#s =
|
|
16555
|
+
D2 ? (this.#n = true, this.#s = t7) : S3 >= 0 ? this.#e.positionInSegment = S3 : a7 >= 0 && n6.index < this.#i.length - 1 ? (this.#e.segmentIndex = n6.index + 1, this.#e.positionInSegment = 0, this.#n = true) : this.#e.positionInSegment = Math.min(u4 + 1, e6.len - 1);
|
|
16538
16556
|
}
|
|
16539
16557
|
}
|
|
16540
|
-
#g(
|
|
16541
|
-
const { month: s3, day:
|
|
16558
|
+
#g(t7, i8) {
|
|
16559
|
+
const { month: s3, day: n6 } = f4(t7);
|
|
16542
16560
|
if (i8.type === "month" && (s3 < 0 || s3 > 12))
|
|
16543
16561
|
return settings.date.messages.invalidMonth;
|
|
16544
|
-
if (i8.type === "day" && (
|
|
16562
|
+
if (i8.type === "day" && (n6 < 0 || n6 > 31))
|
|
16545
16563
|
return settings.date.messages.invalidDay(31, "any month");
|
|
16546
16564
|
}
|
|
16547
|
-
#p(
|
|
16548
|
-
const { year: i8, month: s3, day:
|
|
16549
|
-
if (i8 && s3 &&
|
|
16550
|
-
const
|
|
16565
|
+
#p(t7) {
|
|
16566
|
+
const { year: i8, month: s3, day: n6 } = f4(this.#t);
|
|
16567
|
+
if (i8 && s3 && n6) {
|
|
16568
|
+
const e6 = c3(i8, s3);
|
|
16551
16569
|
this.#t = {
|
|
16552
16570
|
...this.#t,
|
|
16553
|
-
day: String(Math.min(
|
|
16571
|
+
day: String(Math.min(n6, e6)).padStart(2, "0")
|
|
16554
16572
|
};
|
|
16555
16573
|
}
|
|
16556
|
-
this.value = C3(this.#t) ??
|
|
16574
|
+
this.value = C3(this.#t) ?? t7.defaultValue ?? undefined;
|
|
16557
16575
|
}
|
|
16558
16576
|
};
|
|
16559
|
-
u$
|
|
16577
|
+
u$2 = class u4 extends V2 {
|
|
16560
16578
|
options;
|
|
16561
16579
|
cursor = 0;
|
|
16562
16580
|
#t;
|
|
16563
|
-
getGroupItems(
|
|
16564
|
-
return this.options.filter((
|
|
16581
|
+
getGroupItems(t7) {
|
|
16582
|
+
return this.options.filter((r8) => r8.group === t7);
|
|
16565
16583
|
}
|
|
16566
|
-
isGroupSelected(
|
|
16567
|
-
const
|
|
16568
|
-
return
|
|
16584
|
+
isGroupSelected(t7) {
|
|
16585
|
+
const r8 = this.getGroupItems(t7), e6 = this.value;
|
|
16586
|
+
return e6 === undefined ? false : r8.every((s3) => e6.includes(s3.value));
|
|
16569
16587
|
}
|
|
16570
16588
|
toggleValue() {
|
|
16571
|
-
const
|
|
16572
|
-
if (
|
|
16573
|
-
|
|
16574
|
-
|
|
16575
|
-
|
|
16576
|
-
|
|
16577
|
-
|
|
16578
|
-
|
|
16579
|
-
|
|
16580
|
-
|
|
16581
|
-
|
|
16582
|
-
|
|
16583
|
-
|
|
16584
|
-
|
|
16585
|
-
|
|
16586
|
-
|
|
16587
|
-
|
|
16589
|
+
const t7 = this.options[this.cursor];
|
|
16590
|
+
if (t7 !== undefined)
|
|
16591
|
+
if (this.value === undefined && (this.value = []), t7.group === true) {
|
|
16592
|
+
const r8 = t7.value, e6 = this.getGroupItems(r8);
|
|
16593
|
+
this.isGroupSelected(r8) ? this.value = this.value.filter((s3) => e6.findIndex((i8) => i8.value === s3) === -1) : this.value = [...this.value, ...e6.map((s3) => s3.value)], this.value = Array.from(new Set(this.value));
|
|
16594
|
+
} else {
|
|
16595
|
+
const r8 = this.value.includes(t7.value);
|
|
16596
|
+
this.value = r8 ? this.value.filter((e6) => e6 !== t7.value) : [...this.value, t7.value];
|
|
16597
|
+
}
|
|
16598
|
+
}
|
|
16599
|
+
constructor(t7) {
|
|
16600
|
+
super(t7, false);
|
|
16601
|
+
const { options: r8 } = t7;
|
|
16602
|
+
this.#t = t7.selectableGroups !== false, this.options = Object.entries(r8).flatMap(([e6, s3]) => [
|
|
16603
|
+
{ value: e6, group: true, label: e6 },
|
|
16604
|
+
...s3.map((i8) => ({ ...i8, group: e6 }))
|
|
16605
|
+
]), this.value = [...t7.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: e6 }) => e6 === t7.cursorAt), this.#t ? 0 : 1), this.on("cursor", (e6) => {
|
|
16606
|
+
switch (e6) {
|
|
16588
16607
|
case "left":
|
|
16589
16608
|
case "up": {
|
|
16590
16609
|
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
@@ -16606,35 +16625,35 @@ var init_dist3 = __esm(() => {
|
|
|
16606
16625
|
});
|
|
16607
16626
|
}
|
|
16608
16627
|
};
|
|
16609
|
-
|
|
16628
|
+
o5 = /* @__PURE__ */ new Set(["up", "down", "left", "right"]);
|
|
16610
16629
|
h4 = class h4 extends V2 {
|
|
16611
|
-
#
|
|
16612
|
-
#
|
|
16630
|
+
#t = false;
|
|
16631
|
+
#s;
|
|
16613
16632
|
focused = "editor";
|
|
16614
16633
|
get userInputWithCursor() {
|
|
16615
16634
|
if (this.state === "submit")
|
|
16616
16635
|
return this.userInput;
|
|
16617
|
-
const
|
|
16618
|
-
if (this.cursor >=
|
|
16619
|
-
return `${
|
|
16620
|
-
const s3 =
|
|
16621
|
-
return
|
|
16636
|
+
const t7 = this.userInput;
|
|
16637
|
+
if (this.cursor >= t7.length)
|
|
16638
|
+
return `${t7}\u2588`;
|
|
16639
|
+
const s3 = t7.slice(0, this.cursor), r8 = t7.slice(this.cursor, this.cursor + 1), i8 = t7.slice(this.cursor + 1);
|
|
16640
|
+
return r8 === `
|
|
16622
16641
|
` ? `${s3}\u2588
|
|
16623
|
-
${
|
|
16642
|
+
${i8}` : `${s3}${styleText("inverse", r8)}${i8}`;
|
|
16624
16643
|
}
|
|
16625
16644
|
get cursor() {
|
|
16626
16645
|
return this._cursor;
|
|
16627
16646
|
}
|
|
16628
|
-
#r(
|
|
16647
|
+
#r(t7) {
|
|
16629
16648
|
if (this.userInput.length === 0) {
|
|
16630
|
-
this._setUserInput(
|
|
16649
|
+
this._setUserInput(t7);
|
|
16631
16650
|
return;
|
|
16632
16651
|
}
|
|
16633
|
-
this._setUserInput(this.userInput.slice(0, this.cursor) +
|
|
16652
|
+
this._setUserInput(this.userInput.slice(0, this.cursor) + t7 + this.userInput.slice(this.cursor));
|
|
16634
16653
|
}
|
|
16635
|
-
#i(
|
|
16654
|
+
#i(t7) {
|
|
16636
16655
|
const s3 = this.value ?? "";
|
|
16637
|
-
switch (
|
|
16656
|
+
switch (t7) {
|
|
16638
16657
|
case "up":
|
|
16639
16658
|
this._cursor = findTextCursor(this._cursor, 0, -1, s3);
|
|
16640
16659
|
return;
|
|
@@ -16649,75 +16668,79 @@ ${e5}` : `${s3}${styleText("inverse", r7)}${e5}`;
|
|
|
16649
16668
|
return;
|
|
16650
16669
|
}
|
|
16651
16670
|
}
|
|
16652
|
-
_shouldSubmit(
|
|
16653
|
-
if (this.#
|
|
16671
|
+
_shouldSubmit(t7, s3) {
|
|
16672
|
+
if (this.#s)
|
|
16654
16673
|
return this.focused === "submit" ? true : (this.#r(`
|
|
16655
16674
|
`), this._cursor++, false);
|
|
16656
|
-
const
|
|
16657
|
-
return this.#
|
|
16675
|
+
const r8 = this.#t;
|
|
16676
|
+
return this.#t = true, r8 && this.cursor === this.userInput.length ? (this.userInput[this.cursor - 1] === `
|
|
16658
16677
|
` && (this._setUserInput(this.userInput.slice(0, this.cursor - 1) + this.userInput.slice(this.cursor)), this._cursor--), true) : (this.#r(`
|
|
16659
16678
|
`), this._cursor++, false);
|
|
16660
16679
|
}
|
|
16661
|
-
constructor(
|
|
16662
|
-
|
|
16663
|
-
|
|
16664
|
-
|
|
16680
|
+
constructor(t7) {
|
|
16681
|
+
const s3 = t7.initialUserInput ?? t7.initialValue;
|
|
16682
|
+
super({
|
|
16683
|
+
...t7,
|
|
16684
|
+
initialUserInput: s3
|
|
16685
|
+
}, false), s3 !== undefined && (this._cursor = s3.length), this.#s = t7.showSubmit ?? false, this.on("key", (r8, i8) => {
|
|
16686
|
+
if (i8?.name && o5.has(i8.name)) {
|
|
16687
|
+
this.#t = false, this.#i(i8.name);
|
|
16665
16688
|
return;
|
|
16666
16689
|
}
|
|
16667
|
-
if (
|
|
16690
|
+
if (r8 === "\t" && this.#s) {
|
|
16668
16691
|
this.focused = this.focused === "editor" ? "submit" : "editor";
|
|
16669
16692
|
return;
|
|
16670
16693
|
}
|
|
16671
|
-
if (
|
|
16672
|
-
if (this.#
|
|
16694
|
+
if (i8?.name !== "return") {
|
|
16695
|
+
if (this.#t = false, i8?.name === "backspace" && this.cursor > 0) {
|
|
16673
16696
|
this._setUserInput(this.userInput.slice(0, this.cursor - 1) + this.userInput.slice(this.cursor)), this._cursor--;
|
|
16674
16697
|
return;
|
|
16675
16698
|
}
|
|
16676
|
-
if (
|
|
16699
|
+
if (i8?.name === "delete" && this.cursor < this.userInput.length) {
|
|
16677
16700
|
this._setUserInput(this.userInput.slice(0, this.cursor) + this.userInput.slice(this.cursor + 1));
|
|
16678
16701
|
return;
|
|
16679
16702
|
}
|
|
16680
|
-
|
|
16703
|
+
r8 && (this.#s && this.focused === "submit" && (this.focused = "editor"), this.#r(r8 ?? ""), this._cursor++);
|
|
16681
16704
|
}
|
|
16682
|
-
}), this.on("userInput", (
|
|
16683
|
-
this._setValue(
|
|
16705
|
+
}), this.on("userInput", (r8) => {
|
|
16706
|
+
this._setValue(r8);
|
|
16684
16707
|
}), this.on("finalize", () => {
|
|
16685
|
-
this.value || (this.value =
|
|
16708
|
+
this.value || (this.value = t7.defaultValue), this.value === undefined && (this.value = "");
|
|
16686
16709
|
});
|
|
16687
16710
|
}
|
|
16688
16711
|
};
|
|
16689
|
-
|
|
16712
|
+
a7 = class a7 extends V2 {
|
|
16690
16713
|
options;
|
|
16691
16714
|
cursor = 0;
|
|
16692
16715
|
get _value() {
|
|
16693
|
-
return this.options[this.cursor]
|
|
16716
|
+
return this.options[this.cursor]?.value;
|
|
16694
16717
|
}
|
|
16695
16718
|
get _enabledOptions() {
|
|
16696
|
-
return this.options.filter((
|
|
16719
|
+
return this.options.filter((e6) => e6.disabled !== true);
|
|
16697
16720
|
}
|
|
16698
16721
|
toggleAll() {
|
|
16699
|
-
const
|
|
16700
|
-
this.value = i8 ? [] :
|
|
16722
|
+
const e6 = this._enabledOptions, i8 = this.value !== undefined && this.value.length === e6.length;
|
|
16723
|
+
this.value = i8 ? [] : e6.map((t7) => t7.value);
|
|
16701
16724
|
}
|
|
16702
16725
|
toggleInvert() {
|
|
16703
|
-
const
|
|
16704
|
-
if (!
|
|
16726
|
+
const e6 = this.value;
|
|
16727
|
+
if (!e6)
|
|
16705
16728
|
return;
|
|
16706
|
-
const i8 = this._enabledOptions.filter((
|
|
16707
|
-
this.value = i8.map((
|
|
16729
|
+
const i8 = this._enabledOptions.filter((t7) => !e6.includes(t7.value));
|
|
16730
|
+
this.value = i8.map((t7) => t7.value);
|
|
16708
16731
|
}
|
|
16709
16732
|
toggleValue() {
|
|
16710
16733
|
this.value === undefined && (this.value = []);
|
|
16711
|
-
const
|
|
16712
|
-
this.value =
|
|
16734
|
+
const e6 = this.value.includes(this._value);
|
|
16735
|
+
this.value = e6 ? this.value.filter((i8) => i8 !== this._value) : [...this.value, this._value];
|
|
16713
16736
|
}
|
|
16714
|
-
constructor(
|
|
16715
|
-
super(
|
|
16716
|
-
const i8 = Math.max(this.options.findIndex(({ value:
|
|
16717
|
-
this.cursor = this.options[i8]
|
|
16737
|
+
constructor(e6) {
|
|
16738
|
+
super(e6, false), this.options = e6.options, this.value = [...e6.initialValues ?? []];
|
|
16739
|
+
const i8 = Math.max(this.options.findIndex(({ value: t7 }) => t7 === e6.cursorAt), 0);
|
|
16740
|
+
this.cursor = this.options[i8]?.disabled ? findCursor(i8, 1, this.options) : i8, this.on("key", (t7, l4) => {
|
|
16718
16741
|
l4.name === "a" && this.toggleAll(), l4.name === "i" && this.toggleInvert();
|
|
16719
|
-
}), this.on("cursor", (
|
|
16720
|
-
switch (
|
|
16742
|
+
}), this.on("cursor", (t7) => {
|
|
16743
|
+
switch (t7) {
|
|
16721
16744
|
case "left":
|
|
16722
16745
|
case "up":
|
|
16723
16746
|
this.cursor = findCursor(this.cursor, -1, this.options);
|
|
@@ -16733,7 +16756,7 @@ ${e5}` : `${s3}${styleText("inverse", r7)}${e5}`;
|
|
|
16733
16756
|
});
|
|
16734
16757
|
}
|
|
16735
16758
|
};
|
|
16736
|
-
|
|
16759
|
+
u$1 = class u5 extends V2 {
|
|
16737
16760
|
_mask = "\u2022";
|
|
16738
16761
|
get cursor() {
|
|
16739
16762
|
return this._cursor;
|
|
@@ -16744,34 +16767,37 @@ ${e5}` : `${s3}${styleText("inverse", r7)}${e5}`;
|
|
|
16744
16767
|
get userInputWithCursor() {
|
|
16745
16768
|
if (this.state === "submit" || this.state === "cancel")
|
|
16746
16769
|
return this.masked;
|
|
16747
|
-
const
|
|
16748
|
-
if (this.cursor >=
|
|
16770
|
+
const t7 = this.userInput;
|
|
16771
|
+
if (this.cursor >= t7.length)
|
|
16749
16772
|
return `${this.masked}${styleText(["inverse", "hidden"], "_")}`;
|
|
16750
|
-
const s3 = this.masked,
|
|
16751
|
-
return `${
|
|
16773
|
+
const s3 = this.masked, r8 = s3.slice(0, this.cursor), i8 = s3.slice(this.cursor, this.cursor + 1), o6 = s3.slice(this.cursor + 1);
|
|
16774
|
+
return `${r8}${styleText("inverse", i8)}${o6}`;
|
|
16752
16775
|
}
|
|
16753
16776
|
clear() {
|
|
16754
16777
|
this._clearUserInput();
|
|
16755
16778
|
}
|
|
16756
|
-
constructor({ mask:
|
|
16757
|
-
super(s3), this._mask =
|
|
16758
|
-
this._setValue(
|
|
16779
|
+
constructor({ mask: t7, ...s3 }) {
|
|
16780
|
+
super(s3), this._mask = t7 ?? "\u2022", this.on("userInput", (r8) => {
|
|
16781
|
+
this._setValue(r8);
|
|
16782
|
+
}), this.on("finalize", () => {
|
|
16783
|
+
this.value === undefined && (this.value = "");
|
|
16759
16784
|
});
|
|
16760
16785
|
}
|
|
16761
16786
|
};
|
|
16762
|
-
|
|
16787
|
+
n$1 = class n6 extends V2 {
|
|
16763
16788
|
options;
|
|
16764
16789
|
cursor = 0;
|
|
16765
16790
|
get _selectedValue() {
|
|
16766
16791
|
return this.options[this.cursor];
|
|
16767
16792
|
}
|
|
16768
16793
|
changeValue() {
|
|
16769
|
-
|
|
16794
|
+
const e6 = this._selectedValue;
|
|
16795
|
+
this.value = e6 === undefined ? undefined : e6.value;
|
|
16770
16796
|
}
|
|
16771
|
-
constructor(
|
|
16772
|
-
super(
|
|
16773
|
-
const
|
|
16774
|
-
this.cursor = this.options[
|
|
16797
|
+
constructor(e6) {
|
|
16798
|
+
super(e6, false), this.options = e6.options;
|
|
16799
|
+
const o6 = this.options.findIndex(({ value: s3 }) => s3 === e6.initialValue), t7 = o6 === -1 ? 0 : o6;
|
|
16800
|
+
this.cursor = this.options[t7]?.disabled ? findCursor(t7, 1, this.options) : t7, this.changeValue(), this.on("cursor", (s3) => {
|
|
16775
16801
|
switch (s3) {
|
|
16776
16802
|
case "left":
|
|
16777
16803
|
case "up":
|
|
@@ -16786,44 +16812,44 @@ ${e5}` : `${s3}${styleText("inverse", r7)}${e5}`;
|
|
|
16786
16812
|
});
|
|
16787
16813
|
}
|
|
16788
16814
|
};
|
|
16789
|
-
|
|
16815
|
+
u6 = class u6 extends V2 {
|
|
16790
16816
|
options;
|
|
16791
16817
|
cursor = 0;
|
|
16792
|
-
constructor(
|
|
16793
|
-
super(
|
|
16794
|
-
const s3 =
|
|
16795
|
-
this.cursor = Math.max(i8.indexOf(
|
|
16796
|
-
if (!
|
|
16818
|
+
constructor(t7) {
|
|
16819
|
+
super(t7, false), this.options = t7.options;
|
|
16820
|
+
const s3 = t7.caseSensitive === true, i8 = this.options.map(({ value: [e6] }) => s3 ? e6 : e6?.toLowerCase());
|
|
16821
|
+
this.cursor = Math.max(i8.indexOf(t7.initialValue), 0), this.on("key", (e6) => {
|
|
16822
|
+
if (!e6)
|
|
16797
16823
|
return;
|
|
16798
|
-
const o6 = s3 ?
|
|
16824
|
+
const o6 = s3 ? e6 : e6.toLowerCase();
|
|
16799
16825
|
if (!i8.includes(o6))
|
|
16800
16826
|
return;
|
|
16801
|
-
const
|
|
16802
|
-
|
|
16827
|
+
const n7 = this.options.find(({ value: [r8] }) => s3 ? r8 === o6 : r8?.toLowerCase() === o6);
|
|
16828
|
+
n7 && (this.value = n7.value, this.state = "submit", this.emit("submit"));
|
|
16803
16829
|
});
|
|
16804
16830
|
}
|
|
16805
16831
|
};
|
|
16806
|
-
|
|
16832
|
+
n7 = class n7 extends V2 {
|
|
16807
16833
|
get userInputWithCursor() {
|
|
16808
16834
|
if (this.state === "submit")
|
|
16809
16835
|
return this.userInput;
|
|
16810
|
-
const
|
|
16811
|
-
if (this.cursor >=
|
|
16836
|
+
const t7 = this.userInput;
|
|
16837
|
+
if (this.cursor >= t7.length)
|
|
16812
16838
|
return `${this.userInput}\u2588`;
|
|
16813
|
-
const
|
|
16814
|
-
return `${
|
|
16839
|
+
const r8 = t7.slice(0, this.cursor), s3 = t7.slice(this.cursor, this.cursor + 1), e6 = t7.slice(this.cursor + 1);
|
|
16840
|
+
return `${r8}${styleText("inverse", s3)}${e6}`;
|
|
16815
16841
|
}
|
|
16816
16842
|
get cursor() {
|
|
16817
16843
|
return this._cursor;
|
|
16818
16844
|
}
|
|
16819
|
-
constructor(
|
|
16845
|
+
constructor(t7) {
|
|
16820
16846
|
super({
|
|
16821
|
-
...
|
|
16822
|
-
initialUserInput:
|
|
16823
|
-
}), this.on("userInput", (
|
|
16824
|
-
this._setValue(
|
|
16847
|
+
...t7,
|
|
16848
|
+
initialUserInput: t7.initialUserInput ?? t7.initialValue
|
|
16849
|
+
}), this.on("userInput", (r8) => {
|
|
16850
|
+
this._setValue(r8);
|
|
16825
16851
|
}), this.on("finalize", () => {
|
|
16826
|
-
this.value || (this.value =
|
|
16852
|
+
this.value || (this.value = t7.defaultValue), this.value === undefined && (this.value = "");
|
|
16827
16853
|
});
|
|
16828
16854
|
}
|
|
16829
16855
|
};
|
|
@@ -16860,6 +16886,7 @@ __export(exports_dist, {
|
|
|
16860
16886
|
intro: () => intro,
|
|
16861
16887
|
groupMultiselect: () => groupMultiselect,
|
|
16862
16888
|
group: () => group,
|
|
16889
|
+
formatInstructionFooter: () => formatInstructionFooter,
|
|
16863
16890
|
date: () => date5,
|
|
16864
16891
|
confirm: () => confirm,
|
|
16865
16892
|
cancel: () => cancel,
|
|
@@ -16890,7 +16917,9 @@ __export(exports_dist, {
|
|
|
16890
16917
|
S_BAR_H: () => S_BAR_H,
|
|
16891
16918
|
S_BAR_END_RIGHT: () => S_BAR_END_RIGHT,
|
|
16892
16919
|
S_BAR_END: () => S_BAR_END,
|
|
16893
|
-
S_BAR: () => S_BAR
|
|
16920
|
+
S_BAR: () => S_BAR,
|
|
16921
|
+
SELECT_INSTRUCTIONS: () => SELECT_INSTRUCTIONS,
|
|
16922
|
+
MULTISELECT_INSTRUCTIONS: () => MULTISELECT_INSTRUCTIONS
|
|
16894
16923
|
});
|
|
16895
16924
|
import { styleText as styleText2, stripVTControlCharacters } from "util";
|
|
16896
16925
|
import process$1 from "process";
|
|
@@ -16902,38 +16931,42 @@ function isUnicodeSupported() {
|
|
|
16902
16931
|
}
|
|
16903
16932
|
return Boolean(process$1.env.CI) || Boolean(process$1.env.WT_SESSION) || Boolean(process$1.env.TERMINUS_SUBLIME) || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
16904
16933
|
}
|
|
16905
|
-
function
|
|
16906
|
-
|
|
16934
|
+
function formatInstructionFooter(o6, e6) {
|
|
16935
|
+
const r8 = [`${e6 ? `${styleText2("cyan", S_BAR)} ` : ""}${o6.join(" \u2022 ")}`];
|
|
16936
|
+
return e6 && r8.push(styleText2("cyan", S_BAR_END)), r8;
|
|
16907
16937
|
}
|
|
16908
|
-
function
|
|
16909
|
-
|
|
16938
|
+
function P3(t7) {
|
|
16939
|
+
return t7.label ?? String(t7.value ?? "");
|
|
16940
|
+
}
|
|
16941
|
+
function E2(t7, c4) {
|
|
16942
|
+
if (!t7)
|
|
16910
16943
|
return true;
|
|
16911
|
-
const
|
|
16912
|
-
return
|
|
16944
|
+
const n8 = (c4.label ?? String(c4.value ?? "")).toLowerCase(), i8 = (c4.hint ?? "").toLowerCase(), l4 = String(c4.value).toLowerCase(), o6 = t7.toLowerCase();
|
|
16945
|
+
return n8.includes(o6) || i8.includes(o6) || l4.includes(o6);
|
|
16913
16946
|
}
|
|
16914
|
-
function N2(
|
|
16915
|
-
const
|
|
16947
|
+
function N2(t7, c4) {
|
|
16948
|
+
const n8 = [];
|
|
16916
16949
|
for (const i8 of c4)
|
|
16917
|
-
|
|
16918
|
-
return
|
|
16919
|
-
}
|
|
16920
|
-
function A$1(
|
|
16921
|
-
let i8 =
|
|
16922
|
-
return o6 === "center" ? i8 = Math.floor((
|
|
16923
|
-
}
|
|
16924
|
-
function b4(
|
|
16925
|
-
const { segmentValues:
|
|
16926
|
-
if (
|
|
16927
|
-
return
|
|
16928
|
-
const i8 = styleText2("gray",
|
|
16929
|
-
return
|
|
16930
|
-
const c4 =
|
|
16931
|
-
return x3(
|
|
16950
|
+
t7.includes(i8.value) && n8.push(i8);
|
|
16951
|
+
return n8;
|
|
16952
|
+
}
|
|
16953
|
+
function A$1(n8, e6, t7, o6) {
|
|
16954
|
+
let i8 = t7, f5 = t7;
|
|
16955
|
+
return o6 === "center" ? i8 = Math.floor((e6 - n8) / 2) : o6 === "right" && (i8 = e6 - n8 - t7), f5 = e6 - i8 - n8, [i8, f5];
|
|
16956
|
+
}
|
|
16957
|
+
function b4(e6, r8) {
|
|
16958
|
+
const { segmentValues: t7, segmentCursor: o6 } = e6;
|
|
16959
|
+
if (r8 === "submit" || r8 === "cancel")
|
|
16960
|
+
return e6.formattedValue;
|
|
16961
|
+
const i8 = styleText2("gray", e6.separator);
|
|
16962
|
+
return e6.segments.map((l4, d5) => {
|
|
16963
|
+
const c4 = d5 === o6.segmentIndex && !["submit", "cancel"].includes(r8), a8 = p5[l4.type];
|
|
16964
|
+
return x3(t7[l4.type], { isActive: c4, label: a8 });
|
|
16932
16965
|
}).join(i8);
|
|
16933
16966
|
}
|
|
16934
|
-
function x3(
|
|
16935
|
-
const
|
|
16936
|
-
return
|
|
16967
|
+
function x3(e6, r8) {
|
|
16968
|
+
const t7 = !e6 || e6.replace(/_/g, "") === "";
|
|
16969
|
+
return r8.isActive ? styleText2("inverse", t7 ? r8.label : e6.replace(/_/g, " ")) : t7 ? styleText2("dim", r8.label) : e6.replace(/_/g, styleText2("dim", " "));
|
|
16937
16970
|
}
|
|
16938
16971
|
function progress({
|
|
16939
16972
|
style: o6 = "heavy",
|
|
@@ -16941,42 +16974,42 @@ function progress({
|
|
|
16941
16974
|
size: v3 = 40,
|
|
16942
16975
|
...x4
|
|
16943
16976
|
} = {}) {
|
|
16944
|
-
const
|
|
16945
|
-
let
|
|
16946
|
-
const c4 = Math.max(1, d5), l4 = Math.max(1, v3), S3 = (
|
|
16947
|
-
switch (
|
|
16977
|
+
const r8 = spinner(x4);
|
|
16978
|
+
let a8 = 0, n8 = "";
|
|
16979
|
+
const c4 = Math.max(1, d5), l4 = Math.max(1, v3), S3 = (t7) => {
|
|
16980
|
+
switch (t7) {
|
|
16948
16981
|
case "initial":
|
|
16949
16982
|
case "active":
|
|
16950
|
-
return (
|
|
16983
|
+
return (e6) => styleText2("magenta", e6);
|
|
16951
16984
|
case "error":
|
|
16952
16985
|
case "cancel":
|
|
16953
|
-
return (
|
|
16986
|
+
return (e6) => styleText2("red", e6);
|
|
16954
16987
|
case "submit":
|
|
16955
|
-
return (
|
|
16988
|
+
return (e6) => styleText2("green", e6);
|
|
16956
16989
|
default:
|
|
16957
|
-
return (
|
|
16990
|
+
return (e6) => styleText2("magenta", e6);
|
|
16958
16991
|
}
|
|
16959
|
-
}, p6 = (
|
|
16960
|
-
const
|
|
16961
|
-
return `${S3(
|
|
16962
|
-
}, h5 = (
|
|
16963
|
-
|
|
16964
|
-
}, g4 = (
|
|
16965
|
-
|
|
16992
|
+
}, p6 = (t7, e6) => {
|
|
16993
|
+
const m6 = Math.floor(a8 / c4 * l4);
|
|
16994
|
+
return `${S3(t7)(u7[o6].repeat(m6))}${styleText2("dim", u7[o6].repeat(l4 - m6))} ${e6}`;
|
|
16995
|
+
}, h5 = (t7 = "") => {
|
|
16996
|
+
n8 = t7, r8.start(p6("initial", t7));
|
|
16997
|
+
}, g4 = (t7 = 1, e6) => {
|
|
16998
|
+
a8 = Math.min(c4, t7 + a8), r8.message(p6("active", e6 ?? n8)), n8 = e6 ?? n8;
|
|
16966
16999
|
};
|
|
16967
17000
|
return {
|
|
16968
17001
|
start: h5,
|
|
16969
|
-
stop:
|
|
16970
|
-
cancel:
|
|
16971
|
-
error:
|
|
16972
|
-
clear:
|
|
17002
|
+
stop: r8.stop,
|
|
17003
|
+
cancel: r8.cancel,
|
|
17004
|
+
error: r8.error,
|
|
17005
|
+
clear: r8.clear,
|
|
16973
17006
|
advance: g4,
|
|
16974
|
-
isCancelled:
|
|
16975
|
-
message: (
|
|
17007
|
+
isCancelled: r8.isCancelled,
|
|
17008
|
+
message: (t7) => g4(0, t7)
|
|
16976
17009
|
};
|
|
16977
17010
|
}
|
|
16978
|
-
var import_sisteransi2, unicode, isCI = () => process.env.CI === "true", isTTY = (
|
|
16979
|
-
switch (
|
|
17011
|
+
var import_sisteransi2, unicode, isCI = () => process.env.CI === "true", isTTY = (o6) => o6.isTTY === true, unicodeOr = (o6, e6) => unicode ? o6 : e6, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_BAR_START, S_BAR, S_BAR_END, S_BAR_START_RIGHT, S_BAR_END_RIGHT, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_CHECKBOX_ACTIVE, S_CHECKBOX_SELECTED, S_CHECKBOX_INACTIVE, S_PASSWORD_MASK, S_BAR_H, S_CORNER_TOP_RIGHT, S_CONNECT_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_BOTTOM_LEFT, S_CORNER_TOP_LEFT, S_INFO, S_SUCCESS, S_WARN, S_ERROR, symbol2 = (o6) => {
|
|
17012
|
+
switch (o6) {
|
|
16980
17013
|
case "initial":
|
|
16981
17014
|
case "active":
|
|
16982
17015
|
return styleText2("cyan", S_STEP_ACTIVE);
|
|
@@ -16987,8 +17020,8 @@ var import_sisteransi2, unicode, isCI = () => process.env.CI === "true", isTTY =
|
|
|
16987
17020
|
case "submit":
|
|
16988
17021
|
return styleText2("green", S_STEP_SUBMIT);
|
|
16989
17022
|
}
|
|
16990
|
-
}, symbolBar = (
|
|
16991
|
-
switch (
|
|
17023
|
+
}, symbolBar = (o6) => {
|
|
17024
|
+
switch (o6) {
|
|
16992
17025
|
case "initial":
|
|
16993
17026
|
case "active":
|
|
16994
17027
|
return styleText2("cyan", S_BAR);
|
|
@@ -16999,169 +17032,175 @@ var import_sisteransi2, unicode, isCI = () => process.env.CI === "true", isTTY =
|
|
|
16999
17032
|
case "submit":
|
|
17000
17033
|
return styleText2("green", S_BAR);
|
|
17001
17034
|
}
|
|
17002
|
-
},
|
|
17003
|
-
let
|
|
17004
|
-
if (
|
|
17005
|
-
for (let i8 =
|
|
17006
|
-
;
|
|
17035
|
+
}, I2 = (l4, e6, w3, p5, b4, C4 = false) => {
|
|
17036
|
+
let r8 = e6, O2 = 0;
|
|
17037
|
+
if (C4)
|
|
17038
|
+
for (let i8 = p5 - 1;i8 >= w3; i8--) {
|
|
17039
|
+
const m5 = l4[i8];
|
|
17040
|
+
if (m5 && (r8 -= m5.length), O2++, r8 <= b4)
|
|
17041
|
+
break;
|
|
17042
|
+
}
|
|
17007
17043
|
else
|
|
17008
|
-
for (let i8 =
|
|
17009
|
-
;
|
|
17010
|
-
|
|
17044
|
+
for (let i8 = w3;i8 < p5; i8++) {
|
|
17045
|
+
const m5 = l4[i8];
|
|
17046
|
+
if (m5 && (r8 -= m5.length), O2++, r8 <= b4)
|
|
17047
|
+
break;
|
|
17048
|
+
}
|
|
17049
|
+
return { lineCount: r8, removals: O2 };
|
|
17011
17050
|
}, limitOptions = ({
|
|
17012
17051
|
cursor: l4,
|
|
17013
|
-
options:
|
|
17014
|
-
style:
|
|
17015
|
-
output:
|
|
17016
|
-
maxItems:
|
|
17017
|
-
columnPadding:
|
|
17018
|
-
rowPadding:
|
|
17052
|
+
options: e6,
|
|
17053
|
+
style: w3,
|
|
17054
|
+
output: p5 = process.stdout,
|
|
17055
|
+
maxItems: b4 = Number.POSITIVE_INFINITY,
|
|
17056
|
+
columnPadding: C4 = 0,
|
|
17057
|
+
rowPadding: r8 = 4
|
|
17019
17058
|
}) => {
|
|
17020
|
-
const i8 = getColumns(
|
|
17021
|
-
let
|
|
17022
|
-
l4 >=
|
|
17023
|
-
let
|
|
17024
|
-
const W2 = Math.min(
|
|
17025
|
-
let
|
|
17026
|
-
|
|
17027
|
-
const
|
|
17028
|
-
for (let
|
|
17029
|
-
const
|
|
17059
|
+
const i8 = getColumns(p5) - C4, m5 = getRows(p5), M3 = styleText2("dim", "..."), v3 = Math.max(m5 - r8, 0), a8 = Math.max(Math.min(b4, v3), 5);
|
|
17060
|
+
let f5 = 0;
|
|
17061
|
+
l4 >= a8 - 3 && (f5 = Math.max(Math.min(l4 - a8 + 3, e6.length - a8), 0));
|
|
17062
|
+
let d5 = a8 < e6.length && f5 > 0, c4 = a8 < e6.length && f5 + a8 < e6.length;
|
|
17063
|
+
const W2 = Math.min(f5 + a8, e6.length), s3 = [];
|
|
17064
|
+
let g4 = 0;
|
|
17065
|
+
d5 && g4++, c4 && g4++;
|
|
17066
|
+
const T5 = f5 + (d5 ? 1 : 0), y3 = W2 - (c4 ? 1 : 0);
|
|
17067
|
+
for (let t7 = T5;t7 < y3; t7++) {
|
|
17068
|
+
const n8 = e6[t7], o6 = n8 ? w3(n8, t7 === l4) : "", h5 = wrapAnsi(o6, i8, {
|
|
17030
17069
|
hard: true,
|
|
17031
17070
|
trim: false
|
|
17032
17071
|
}).split(`
|
|
17033
17072
|
`);
|
|
17034
|
-
|
|
17035
|
-
}
|
|
17036
|
-
if (
|
|
17037
|
-
let
|
|
17038
|
-
const
|
|
17039
|
-
let
|
|
17040
|
-
const
|
|
17041
|
-
|
|
17042
|
-
}
|
|
17043
|
-
const
|
|
17044
|
-
|
|
17045
|
-
for (const
|
|
17046
|
-
for (const
|
|
17047
|
-
|
|
17048
|
-
return
|
|
17049
|
-
}, autocomplete = (
|
|
17050
|
-
options:
|
|
17051
|
-
initialValue:
|
|
17052
|
-
initialUserInput:
|
|
17053
|
-
placeholder:
|
|
17054
|
-
filter:
|
|
17055
|
-
signal:
|
|
17056
|
-
input:
|
|
17057
|
-
output:
|
|
17058
|
-
validate:
|
|
17073
|
+
s3.push(h5), g4 += h5.length;
|
|
17074
|
+
}
|
|
17075
|
+
if (g4 > v3) {
|
|
17076
|
+
let t7 = 0, n8 = 0, o6 = g4;
|
|
17077
|
+
const h5 = l4 - T5;
|
|
17078
|
+
let u7 = v3;
|
|
17079
|
+
const L2 = () => I2(s3, o6, 0, h5, u7), E2 = () => I2(s3, o6, h5 + 1, s3.length, u7, true);
|
|
17080
|
+
d5 ? ({ lineCount: o6, removals: t7 } = L2(), o6 > u7 && (c4 || (u7 -= 1), { lineCount: o6, removals: n8 } = E2())) : (c4 || (u7 -= 1), { lineCount: o6, removals: n8 } = E2(), o6 > u7 && (u7 -= 1, { lineCount: o6, removals: t7 } = L2())), t7 > 0 && (d5 = true, s3.splice(0, t7)), n8 > 0 && (c4 = true, s3.splice(s3.length - n8, n8));
|
|
17081
|
+
}
|
|
17082
|
+
const x3 = [];
|
|
17083
|
+
d5 && x3.push(M3);
|
|
17084
|
+
for (const t7 of s3)
|
|
17085
|
+
for (const n8 of t7)
|
|
17086
|
+
x3.push(n8);
|
|
17087
|
+
return c4 && x3.push(M3), x3;
|
|
17088
|
+
}, autocomplete = (t7) => new T$1({
|
|
17089
|
+
options: t7.options,
|
|
17090
|
+
initialValue: t7.initialValue ? [t7.initialValue] : undefined,
|
|
17091
|
+
initialUserInput: t7.initialUserInput,
|
|
17092
|
+
placeholder: t7.placeholder,
|
|
17093
|
+
filter: t7.filter ?? ((n8, i8) => E2(n8, i8)),
|
|
17094
|
+
signal: t7.signal,
|
|
17095
|
+
input: t7.input,
|
|
17096
|
+
output: t7.output,
|
|
17097
|
+
validate: t7.validate,
|
|
17059
17098
|
render() {
|
|
17060
|
-
const
|
|
17061
|
-
const
|
|
17099
|
+
const n8 = t7.withGuide ?? settings.withGuide, i8 = n8 ? [`${styleText2("gray", S_BAR)}`, `${symbol2(this.state)} ${t7.message}`] : [`${symbol2(this.state)} ${t7.message}`], l4 = this.userInput, o6 = this.options, m5 = t7.placeholder, p5 = l4 === "" && m5 !== undefined, $2 = (r8, s3) => {
|
|
17100
|
+
const a8 = P3(r8), u7 = r8.hint && r8.value === this.focusedValue ? styleText2("dim", ` (${r8.hint})`) : "";
|
|
17062
17101
|
switch (s3) {
|
|
17063
17102
|
case "active":
|
|
17064
|
-
return `${styleText2("green", S_RADIO_ACTIVE)} ${
|
|
17103
|
+
return `${styleText2("green", S_RADIO_ACTIVE)} ${a8}${u7}`;
|
|
17065
17104
|
case "inactive":
|
|
17066
|
-
return `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim",
|
|
17105
|
+
return `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a8)}`;
|
|
17067
17106
|
case "disabled":
|
|
17068
|
-
return `${styleText2("gray", S_RADIO_INACTIVE)} ${styleText2(["strikethrough", "gray"],
|
|
17107
|
+
return `${styleText2("gray", S_RADIO_INACTIVE)} ${styleText2(["strikethrough", "gray"], a8)}`;
|
|
17069
17108
|
}
|
|
17070
17109
|
};
|
|
17071
17110
|
switch (this.state) {
|
|
17072
17111
|
case "submit": {
|
|
17073
|
-
const
|
|
17112
|
+
const r8 = N2(this.selectedValues, o6), s3 = r8.length > 0 ? ` ${styleText2("dim", r8.map(P3).join(", "))}` : "", a8 = n8 ? styleText2("gray", S_BAR) : "";
|
|
17074
17113
|
return `${i8.join(`
|
|
17075
17114
|
`)}
|
|
17076
|
-
${
|
|
17115
|
+
${a8}${s3}`;
|
|
17077
17116
|
}
|
|
17078
17117
|
case "cancel": {
|
|
17079
|
-
const
|
|
17118
|
+
const r8 = l4 ? ` ${styleText2(["strikethrough", "dim"], l4)}` : "", s3 = n8 ? styleText2("gray", S_BAR) : "";
|
|
17080
17119
|
return `${i8.join(`
|
|
17081
17120
|
`)}
|
|
17082
|
-
${s3}${
|
|
17121
|
+
${s3}${r8}`;
|
|
17083
17122
|
}
|
|
17084
17123
|
default: {
|
|
17085
|
-
const
|
|
17086
|
-
let
|
|
17124
|
+
const r8 = this.state === "error" ? "yellow" : "cyan", s3 = n8 ? `${styleText2(r8, S_BAR)} ` : "", a8 = n8 ? styleText2(r8, S_BAR_END) : "";
|
|
17125
|
+
let u7 = "";
|
|
17087
17126
|
if (this.isNavigating || p5) {
|
|
17088
|
-
const
|
|
17089
|
-
|
|
17127
|
+
const d5 = p5 ? m5 : l4;
|
|
17128
|
+
u7 = d5 !== "" ? ` ${styleText2("dim", d5)}` : "";
|
|
17090
17129
|
} else
|
|
17091
|
-
|
|
17130
|
+
u7 = ` ${this.userInputWithCursor}`;
|
|
17092
17131
|
const V3 = this.filteredOptions.length !== o6.length ? styleText2("dim", ` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`) : "", y3 = this.filteredOptions.length === 0 && l4 ? [`${s3}${styleText2("yellow", "No matches found")}`] : [], b4 = this.state === "error" ? [`${s3}${styleText2("yellow", this.error)}`] : [];
|
|
17093
|
-
|
|
17132
|
+
n8 && i8.push(`${s3.trimEnd()}`), i8.push(`${s3}${styleText2("dim", "Search:")}${u7}${V3}`, ...y3, ...b4);
|
|
17094
17133
|
const v3 = [
|
|
17095
17134
|
`${styleText2("dim", "\u2191/\u2193")} to select`,
|
|
17096
17135
|
`${styleText2("dim", "Enter:")} confirm`,
|
|
17097
17136
|
`${styleText2("dim", "Type:")} to search`
|
|
17098
|
-
], g4 = [`${s3}${v3.join(" \u2022 ")}`,
|
|
17137
|
+
], g4 = [`${s3}${v3.join(" \u2022 ")}`, a8], O2 = this.filteredOptions.length === 0 ? [] : limitOptions({
|
|
17099
17138
|
cursor: this.cursor,
|
|
17100
17139
|
options: this.filteredOptions,
|
|
17101
|
-
columnPadding:
|
|
17140
|
+
columnPadding: n8 ? 3 : 0,
|
|
17102
17141
|
rowPadding: i8.length + g4.length,
|
|
17103
|
-
style: (
|
|
17104
|
-
maxItems:
|
|
17105
|
-
output:
|
|
17142
|
+
style: (d5, f5) => $2(d5, d5.disabled ? "disabled" : f5 ? "active" : "inactive"),
|
|
17143
|
+
maxItems: t7.maxItems,
|
|
17144
|
+
output: t7.output
|
|
17106
17145
|
});
|
|
17107
17146
|
return [
|
|
17108
17147
|
...i8,
|
|
17109
|
-
...O2.map((
|
|
17148
|
+
...O2.map((d5) => `${s3}${d5}`),
|
|
17110
17149
|
...g4
|
|
17111
17150
|
].join(`
|
|
17112
17151
|
`);
|
|
17113
17152
|
}
|
|
17114
17153
|
}
|
|
17115
17154
|
}
|
|
17116
|
-
}).prompt(), autocompleteMultiselect = (
|
|
17155
|
+
}).prompt(), autocompleteMultiselect = (t7) => {
|
|
17117
17156
|
const c4 = (i8, l4, o6, m5) => {
|
|
17118
|
-
const p5 = o6.includes(i8.value), $2 = i8.label ?? String(i8.value ?? ""),
|
|
17119
|
-
return i8.disabled ? `${styleText2("gray", S_CHECKBOX_INACTIVE)} ${styleText2(["strikethrough", "gray"], $2)}` : l4 ? `${s3} ${$2}${
|
|
17120
|
-
},
|
|
17121
|
-
options:
|
|
17157
|
+
const p5 = o6.includes(i8.value), $2 = i8.label ?? String(i8.value ?? ""), r8 = i8.hint && m5 !== undefined && i8.value === m5 ? styleText2("dim", ` (${i8.hint})`) : "", s3 = p5 ? styleText2("green", S_CHECKBOX_SELECTED) : styleText2("dim", S_CHECKBOX_INACTIVE);
|
|
17158
|
+
return i8.disabled ? `${styleText2("gray", S_CHECKBOX_INACTIVE)} ${styleText2(["strikethrough", "gray"], $2)}` : l4 ? `${s3} ${$2}${r8}` : `${s3} ${styleText2("dim", $2)}`;
|
|
17159
|
+
}, n8 = new T$1({
|
|
17160
|
+
options: t7.options,
|
|
17122
17161
|
multiple: true,
|
|
17123
|
-
placeholder:
|
|
17124
|
-
filter:
|
|
17162
|
+
placeholder: t7.placeholder,
|
|
17163
|
+
filter: t7.filter ?? ((i8, l4) => E2(i8, l4)),
|
|
17125
17164
|
validate: () => {
|
|
17126
|
-
if (
|
|
17165
|
+
if (t7.required && n8.selectedValues.length === 0)
|
|
17127
17166
|
return "Please select at least one item";
|
|
17128
17167
|
},
|
|
17129
|
-
initialValue:
|
|
17130
|
-
signal:
|
|
17131
|
-
input:
|
|
17132
|
-
output:
|
|
17168
|
+
initialValue: t7.initialValues,
|
|
17169
|
+
signal: t7.signal,
|
|
17170
|
+
input: t7.input,
|
|
17171
|
+
output: t7.output,
|
|
17133
17172
|
render() {
|
|
17134
|
-
const i8 =
|
|
17135
|
-
` : ""}${symbol2(this.state)} ${
|
|
17136
|
-
`, o6 = this.userInput, m5 =
|
|
17173
|
+
const i8 = t7.withGuide ?? settings.withGuide, l4 = `${i8 ? `${styleText2("gray", S_BAR)}
|
|
17174
|
+
` : ""}${symbol2(this.state)} ${t7.message}
|
|
17175
|
+
`, o6 = this.userInput, m5 = t7.placeholder, p5 = o6 === "" && m5 !== undefined, $2 = this.isNavigating || p5 ? styleText2("dim", p5 ? m5 : o6) : this.userInputWithCursor, r8 = this.options, s3 = this.filteredOptions.length !== r8.length ? styleText2("dim", ` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`) : "";
|
|
17137
17176
|
switch (this.state) {
|
|
17138
17177
|
case "submit":
|
|
17139
17178
|
return `${l4}${i8 ? `${styleText2("gray", S_BAR)} ` : ""}${styleText2("dim", `${this.selectedValues.length} items selected`)}`;
|
|
17140
17179
|
case "cancel":
|
|
17141
17180
|
return `${l4}${i8 ? `${styleText2("gray", S_BAR)} ` : ""}${styleText2(["strikethrough", "dim"], o6)}`;
|
|
17142
17181
|
default: {
|
|
17143
|
-
const
|
|
17182
|
+
const a8 = this.state === "error" ? "yellow" : "cyan", u7 = i8 ? `${styleText2(a8, S_BAR)} ` : "", V3 = i8 ? styleText2(a8, S_BAR_END) : "", y3 = [
|
|
17144
17183
|
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
17145
17184
|
`${styleText2("dim", this.isNavigating ? "Space/Tab:" : "Tab:")} select`,
|
|
17146
17185
|
`${styleText2("dim", "Enter:")} confirm`,
|
|
17147
17186
|
`${styleText2("dim", "Type:")} to search`
|
|
17148
|
-
], b4 = this.filteredOptions.length === 0 && o6 ? [`${
|
|
17149
|
-
...`${l4}${i8 ? styleText2(
|
|
17187
|
+
], b4 = this.filteredOptions.length === 0 && o6 ? [`${u7}${styleText2("yellow", "No matches found")}`] : [], v3 = this.state === "error" ? [`${u7}${styleText2("yellow", this.error)}`] : [], g4 = [
|
|
17188
|
+
...`${l4}${i8 ? styleText2(a8, S_BAR) : ""}`.split(`
|
|
17150
17189
|
`),
|
|
17151
|
-
`${
|
|
17190
|
+
`${u7}${styleText2("dim", "Search:")} ${$2}${s3}`,
|
|
17152
17191
|
...b4,
|
|
17153
17192
|
...v3
|
|
17154
|
-
], O2 = [`${
|
|
17193
|
+
], O2 = [`${u7}${y3.join(" \u2022 ")}`, V3], d5 = limitOptions({
|
|
17155
17194
|
cursor: this.cursor,
|
|
17156
17195
|
options: this.filteredOptions,
|
|
17157
17196
|
style: (f5, _4) => c4(f5, _4, this.selectedValues, this.focusedValue),
|
|
17158
|
-
maxItems:
|
|
17159
|
-
output:
|
|
17197
|
+
maxItems: t7.maxItems,
|
|
17198
|
+
output: t7.output,
|
|
17160
17199
|
rowPadding: g4.length + O2.length
|
|
17161
17200
|
});
|
|
17162
17201
|
return [
|
|
17163
17202
|
...g4,
|
|
17164
|
-
...
|
|
17203
|
+
...d5.map((f5) => `${u7}${f5}`),
|
|
17165
17204
|
...O2
|
|
17166
17205
|
].join(`
|
|
17167
17206
|
`);
|
|
@@ -17169,63 +17208,63 @@ ${s3}${r7}`;
|
|
|
17169
17208
|
}
|
|
17170
17209
|
}
|
|
17171
17210
|
});
|
|
17172
|
-
return
|
|
17173
|
-
}, J2, K2, Q2 = (
|
|
17174
|
-
const o6 =
|
|
17175
|
-
let
|
|
17176
|
-
if (
|
|
17177
|
-
const c4 =
|
|
17211
|
+
return n8.prompt();
|
|
17212
|
+
}, J2, K2, Q2 = (n8) => n8, box = (n8 = "", e6 = "", t7) => {
|
|
17213
|
+
const o6 = t7?.output ?? process.stdout, i8 = getColumns(o6), R3 = 1 * 2, u7 = t7?.titlePadding ?? 1, h5 = t7?.contentPadding ?? 2, w3 = t7?.width === undefined || t7.width === "auto" ? 1 : Math.min(1, t7.width), m5 = t7?.withGuide ?? settings.withGuide ? `${S_BAR} ` : "", b4 = t7?.formatBorder ?? Q2, a8 = ((t7?.rounded) ? J2 : K2).map(b4), _4 = b4(S_BAR_H), B2 = b4(S_BAR), p5 = dist_default2(m5), x3 = dist_default2(e6), O2 = i8 - p5;
|
|
17214
|
+
let r8 = Math.floor(i8 * w3) - p5;
|
|
17215
|
+
if (t7?.width === "auto") {
|
|
17216
|
+
const c4 = n8.split(`
|
|
17178
17217
|
`);
|
|
17179
|
-
let s3 = x3 +
|
|
17218
|
+
let s3 = x3 + u7 * 2;
|
|
17180
17219
|
for (const G2 of c4) {
|
|
17181
17220
|
const P4 = dist_default2(G2) + h5 * 2;
|
|
17182
17221
|
P4 > s3 && (s3 = P4);
|
|
17183
17222
|
}
|
|
17184
17223
|
const g4 = s3 + R3;
|
|
17185
|
-
g4 <
|
|
17224
|
+
g4 < r8 && (r8 = g4);
|
|
17186
17225
|
}
|
|
17187
|
-
|
|
17188
|
-
const
|
|
17226
|
+
r8 % 2 !== 0 && (r8 < O2 ? r8++ : r8--);
|
|
17227
|
+
const d5 = r8 - R3, S3 = d5 - u7 * 2, T5 = x3 > S3 ? `${e6.slice(0, S3 - 3)}...` : e6, [y3, W2] = A$1(dist_default2(T5), d5, u7, t7?.titleAlign), L2 = wrapAnsi(n8, d5 - h5 * 2, {
|
|
17189
17228
|
hard: true,
|
|
17190
17229
|
trim: false
|
|
17191
17230
|
});
|
|
17192
|
-
o6.write(`${m5}${
|
|
17231
|
+
o6.write(`${m5}${a8[0]}${_4.repeat(y3)}${T5}${_4.repeat(W2)}${a8[1]}
|
|
17193
17232
|
`);
|
|
17194
17233
|
const E3 = L2.split(`
|
|
17195
17234
|
`);
|
|
17196
17235
|
for (const c4 of E3) {
|
|
17197
|
-
const [s3, g4] = A$1(dist_default2(c4),
|
|
17236
|
+
const [s3, g4] = A$1(dist_default2(c4), d5, h5, t7?.contentAlign);
|
|
17198
17237
|
o6.write(`${m5}${B2}${" ".repeat(s3)}${c4}${" ".repeat(g4)}${B2}
|
|
17199
17238
|
`);
|
|
17200
17239
|
}
|
|
17201
|
-
o6.write(`${m5}${
|
|
17240
|
+
o6.write(`${m5}${a8[2]}${_4.repeat(d5)}${a8[3]}
|
|
17202
17241
|
`);
|
|
17203
17242
|
}, confirm = (i8) => {
|
|
17204
|
-
const
|
|
17205
|
-
return new
|
|
17206
|
-
active:
|
|
17243
|
+
const a8 = i8.active ?? "Yes", s3 = i8.inactive ?? "No";
|
|
17244
|
+
return new r7({
|
|
17245
|
+
active: a8,
|
|
17207
17246
|
inactive: s3,
|
|
17208
17247
|
signal: i8.signal,
|
|
17209
17248
|
input: i8.input,
|
|
17210
17249
|
output: i8.output,
|
|
17211
17250
|
initialValue: i8.initialValue ?? true,
|
|
17212
17251
|
render() {
|
|
17213
|
-
const
|
|
17252
|
+
const e6 = i8.withGuide ?? settings.withGuide, u7 = `${symbol2(this.state)} `, l4 = e6 ? `${styleText2("gray", S_BAR)} ` : "", f5 = wrapTextWithPrefix(i8.output, i8.message, l4, u7), o6 = `${e6 ? `${styleText2("gray", S_BAR)}
|
|
17214
17253
|
` : ""}${f5}
|
|
17215
|
-
`, c4 = this.value ?
|
|
17254
|
+
`, c4 = this.value ? a8 : s3;
|
|
17216
17255
|
switch (this.state) {
|
|
17217
17256
|
case "submit": {
|
|
17218
|
-
const
|
|
17219
|
-
return `${o6}${
|
|
17257
|
+
const r8 = e6 ? `${styleText2("gray", S_BAR)} ` : "";
|
|
17258
|
+
return `${o6}${r8}${styleText2("dim", c4)}`;
|
|
17220
17259
|
}
|
|
17221
17260
|
case "cancel": {
|
|
17222
|
-
const
|
|
17223
|
-
return `${o6}${
|
|
17261
|
+
const r8 = e6 ? `${styleText2("gray", S_BAR)} ` : "";
|
|
17262
|
+
return `${o6}${r8}${styleText2(["strikethrough", "dim"], c4)}${e6 ? `
|
|
17224
17263
|
${styleText2("gray", S_BAR)}` : ""}`;
|
|
17225
17264
|
}
|
|
17226
17265
|
default: {
|
|
17227
|
-
const
|
|
17228
|
-
return `${o6}${
|
|
17266
|
+
const r8 = e6 ? `${styleText2("cyan", S_BAR)} ` : "", g4 = e6 ? styleText2("cyan", S_BAR_END) : "";
|
|
17267
|
+
return `${o6}${r8}${this.value ? `${styleText2("green", S_RADIO_ACTIVE)} ${a8}` : `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a8)}`}${i8.vertical ? e6 ? `
|
|
17229
17268
|
${styleText2("cyan", S_BAR)} ` : `
|
|
17230
17269
|
` : ` ${styleText2("dim", "/")} `}${this.value ? `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", s3)}` : `${styleText2("green", S_RADIO_ACTIVE)} ${s3}`}
|
|
17231
17270
|
${g4}
|
|
@@ -17234,377 +17273,379 @@ ${g4}
|
|
|
17234
17273
|
}
|
|
17235
17274
|
}
|
|
17236
17275
|
}).prompt();
|
|
17237
|
-
}, date5 = (
|
|
17238
|
-
const
|
|
17276
|
+
}, date5 = (e6) => {
|
|
17277
|
+
const r8 = e6.validate;
|
|
17239
17278
|
return new U2({
|
|
17240
|
-
...
|
|
17241
|
-
validate(
|
|
17242
|
-
if (
|
|
17243
|
-
return
|
|
17279
|
+
...e6,
|
|
17280
|
+
validate(t7) {
|
|
17281
|
+
if (t7 === undefined)
|
|
17282
|
+
return e6.defaultValue !== undefined ? undefined : r8 ? runValidation(r8, t7) : settings.date.messages.required;
|
|
17244
17283
|
const o6 = (i8) => i8.toISOString().slice(0, 10);
|
|
17245
|
-
if (
|
|
17246
|
-
return settings.date.messages.afterMin(
|
|
17247
|
-
if (
|
|
17248
|
-
return settings.date.messages.beforeMax(
|
|
17249
|
-
if (
|
|
17250
|
-
return runValidation(
|
|
17284
|
+
if (e6.minDate && o6(t7) < o6(e6.minDate))
|
|
17285
|
+
return settings.date.messages.afterMin(e6.minDate);
|
|
17286
|
+
if (e6.maxDate && o6(t7) > o6(e6.maxDate))
|
|
17287
|
+
return settings.date.messages.beforeMax(e6.maxDate);
|
|
17288
|
+
if (r8)
|
|
17289
|
+
return runValidation(r8, t7);
|
|
17251
17290
|
},
|
|
17252
17291
|
render() {
|
|
17253
|
-
const
|
|
17254
|
-
` : ""}${symbol2(this.state)} `}${
|
|
17255
|
-
`, l4 = this.state !== "initial" ? this.state : "active",
|
|
17292
|
+
const t7 = (e6?.withGuide ?? settings.withGuide) !== false, i8 = `${`${t7 ? `${styleText2("gray", S_BAR)}
|
|
17293
|
+
` : ""}${symbol2(this.state)} `}${e6.message}
|
|
17294
|
+
`, l4 = this.state !== "initial" ? this.state : "active", d5 = b4(this, l4), c4 = this.value instanceof Date ? this.formattedValue : "";
|
|
17256
17295
|
switch (this.state) {
|
|
17257
17296
|
case "error": {
|
|
17258
|
-
const
|
|
17297
|
+
const a8 = this.error ? ` ${styleText2("yellow", this.error)}` : "", s3 = t7 ? `${styleText2("yellow", S_BAR)} ` : "", f5 = t7 ? styleText2("yellow", S_BAR_END) : "";
|
|
17259
17298
|
return `${i8.trim()}
|
|
17260
|
-
${s3}${
|
|
17261
|
-
${f5}${
|
|
17299
|
+
${s3}${d5}
|
|
17300
|
+
${f5}${a8}
|
|
17262
17301
|
`;
|
|
17263
17302
|
}
|
|
17264
17303
|
case "submit": {
|
|
17265
|
-
const
|
|
17266
|
-
return `${i8}${s3}${
|
|
17304
|
+
const a8 = c4 ? ` ${styleText2("dim", c4)}` : "", s3 = t7 ? styleText2("gray", S_BAR) : "";
|
|
17305
|
+
return `${i8}${s3}${a8}`;
|
|
17267
17306
|
}
|
|
17268
17307
|
case "cancel": {
|
|
17269
|
-
const
|
|
17270
|
-
return `${i8}${s3}${
|
|
17308
|
+
const a8 = c4 ? ` ${styleText2(["strikethrough", "dim"], c4)}` : "", s3 = t7 ? styleText2("gray", S_BAR) : "";
|
|
17309
|
+
return `${i8}${s3}${a8}${c4.trim() ? `
|
|
17271
17310
|
${s3}` : ""}`;
|
|
17272
17311
|
}
|
|
17273
17312
|
default: {
|
|
17274
|
-
const
|
|
17313
|
+
const a8 = t7 ? `${styleText2("cyan", S_BAR)} ` : "", s3 = t7 ? styleText2("cyan", S_BAR_END) : "", f5 = t7 ? `${styleText2("cyan", S_BAR)} ` : "", g4 = this.inlineError ? `
|
|
17275
17314
|
${f5}${styleText2("yellow", this.inlineError)}` : "";
|
|
17276
|
-
return `${i8}${
|
|
17315
|
+
return `${i8}${a8}${d5}${g4}
|
|
17277
17316
|
${s3}
|
|
17278
17317
|
`;
|
|
17279
17318
|
}
|
|
17280
17319
|
}
|
|
17281
17320
|
}
|
|
17282
17321
|
}).prompt();
|
|
17283
|
-
}, p5, group = async (o6,
|
|
17284
|
-
const
|
|
17285
|
-
for (const
|
|
17286
|
-
const i8 = o6[
|
|
17287
|
-
throw
|
|
17322
|
+
}, p5, group = async (o6, r8) => {
|
|
17323
|
+
const t7 = {}, p6 = Object.keys(o6);
|
|
17324
|
+
for (const e6 of p6) {
|
|
17325
|
+
const i8 = o6[e6], n8 = await i8({ results: t7 })?.catch((a8) => {
|
|
17326
|
+
throw a8;
|
|
17288
17327
|
});
|
|
17289
|
-
if (typeof
|
|
17290
|
-
|
|
17328
|
+
if (typeof r8?.onCancel == "function" && isCancel(n8)) {
|
|
17329
|
+
t7[e6] = "canceled", r8.onCancel({ results: t7 });
|
|
17291
17330
|
continue;
|
|
17292
17331
|
}
|
|
17293
|
-
|
|
17294
|
-
}
|
|
17295
|
-
return
|
|
17296
|
-
},
|
|
17297
|
-
|
|
17298
|
-
|
|
17299
|
-
|
|
17300
|
-
|
|
17301
|
-
|
|
17302
|
-
|
|
17332
|
+
t7[e6] = n8;
|
|
17333
|
+
}
|
|
17334
|
+
return t7;
|
|
17335
|
+
}, MULTISELECT_INSTRUCTIONS, m5 = (i8, u7) => i8.split(`
|
|
17336
|
+
`).map((d5) => u7(d5)).join(`
|
|
17337
|
+
`), multiselect = (i8) => {
|
|
17338
|
+
const u7 = (t7, a8) => {
|
|
17339
|
+
const r8 = t7.label ?? String(t7.value);
|
|
17340
|
+
return a8 === "disabled" ? `${styleText2("gray", S_CHECKBOX_INACTIVE)} ${m5(r8, (o6) => styleText2(["strikethrough", "gray"], o6))}${t7.hint ? ` ${styleText2("dim", `(${t7.hint ?? "disabled"})`)}` : ""}` : a8 === "active" ? `${styleText2("cyan", S_CHECKBOX_ACTIVE)} ${r8}${t7.hint ? ` ${styleText2("dim", `(${t7.hint})`)}` : ""}` : a8 === "selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${m5(r8, (o6) => styleText2("dim", o6))}${t7.hint ? ` ${styleText2("dim", `(${t7.hint})`)}` : ""}` : a8 === "cancelled" ? `${m5(r8, (o6) => styleText2(["strikethrough", "dim"], o6))}` : a8 === "active-selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${r8}${t7.hint ? ` ${styleText2("dim", `(${t7.hint})`)}` : ""}` : a8 === "submitted" ? `${m5(r8, (o6) => styleText2("dim", o6))}` : `${styleText2("dim", S_CHECKBOX_INACTIVE)} ${m5(r8, (o6) => styleText2("dim", o6))}`;
|
|
17341
|
+
}, d5 = i8.required ?? true, v3 = i8.showInstructions ?? true;
|
|
17342
|
+
return new a7({
|
|
17343
|
+
options: i8.options,
|
|
17344
|
+
signal: i8.signal,
|
|
17345
|
+
input: i8.input,
|
|
17346
|
+
output: i8.output,
|
|
17347
|
+
initialValues: i8.initialValues,
|
|
17348
|
+
required: d5,
|
|
17349
|
+
cursorAt: i8.cursorAt,
|
|
17350
|
+
validate(t7) {
|
|
17351
|
+
if (d5 && (t7 === undefined || t7.length === 0))
|
|
17352
|
+
return `Please select at least one option.
|
|
17353
|
+
${styleText2("reset", styleText2("dim", `Press ${styleText2(["gray", "bgWhite", "inverse"], " space ")} to select, ${styleText2("gray", styleText2("bgWhite", styleText2("inverse", " enter ")))} to submit`))}`;
|
|
17354
|
+
},
|
|
17355
|
+
render() {
|
|
17356
|
+
const t7 = i8.withGuide ?? settings.withGuide, a8 = wrapTextWithPrefix(i8.output, i8.message, t7 ? `${symbolBar(this.state)} ` : "", `${symbol2(this.state)} `), r8 = `${t7 ? `${styleText2("gray", S_BAR)}
|
|
17357
|
+
` : ""}${a8}
|
|
17358
|
+
`, o6 = this.value ?? [], p6 = (n8, l4) => {
|
|
17359
|
+
if (n8.disabled)
|
|
17360
|
+
return u7(n8, "disabled");
|
|
17361
|
+
const s3 = o6.includes(n8.value);
|
|
17362
|
+
return l4 && s3 ? u7(n8, "active-selected") : s3 ? u7(n8, "selected") : u7(n8, l4 ? "active" : "inactive");
|
|
17363
|
+
};
|
|
17364
|
+
switch (this.state) {
|
|
17365
|
+
case "submit": {
|
|
17366
|
+
const n8 = this.options.filter(({ value: s3 }) => o6.includes(s3)).map((s3) => u7(s3, "submitted")).join(styleText2("dim", ", ")) || styleText2("dim", "none"), l4 = wrapTextWithPrefix(i8.output, n8, t7 ? `${styleText2("gray", S_BAR)} ` : "");
|
|
17367
|
+
return `${r8}${l4}`;
|
|
17368
|
+
}
|
|
17369
|
+
case "cancel": {
|
|
17370
|
+
const n8 = this.options.filter(({ value: s3 }) => o6.includes(s3)).map((s3) => u7(s3, "cancelled")).join(styleText2("dim", ", "));
|
|
17371
|
+
if (n8.trim() === "")
|
|
17372
|
+
return `${r8}${styleText2("gray", S_BAR)}`;
|
|
17373
|
+
const l4 = wrapTextWithPrefix(i8.output, n8, t7 ? `${styleText2("gray", S_BAR)} ` : "");
|
|
17374
|
+
return `${r8}${l4}${t7 ? `
|
|
17375
|
+
${styleText2("gray", S_BAR)}` : ""}`;
|
|
17376
|
+
}
|
|
17377
|
+
case "error": {
|
|
17378
|
+
const n8 = t7 ? `${styleText2("yellow", S_BAR)} ` : "", l4 = this.error.split(`
|
|
17379
|
+
`).map(($2, C4) => C4 === 0 ? `${t7 ? `${styleText2("yellow", S_BAR_END)} ` : ""}${styleText2("yellow", $2)}` : ` ${$2}`).join(`
|
|
17380
|
+
`), s3 = r8.split(`
|
|
17381
|
+
`).length, h5 = l4.split(`
|
|
17382
|
+
`).length + 1;
|
|
17383
|
+
return `${r8}${n8}${limitOptions({
|
|
17384
|
+
output: i8.output,
|
|
17385
|
+
options: this.options,
|
|
17386
|
+
cursor: this.cursor,
|
|
17387
|
+
maxItems: i8.maxItems,
|
|
17388
|
+
columnPadding: n8.length,
|
|
17389
|
+
rowPadding: s3 + h5,
|
|
17390
|
+
style: p6
|
|
17391
|
+
}).join(`
|
|
17392
|
+
${n8}`)}
|
|
17393
|
+
${l4}
|
|
17394
|
+
`;
|
|
17395
|
+
}
|
|
17396
|
+
default: {
|
|
17397
|
+
const n8 = t7 ? `${styleText2("cyan", S_BAR)} ` : "", l4 = r8.split(`
|
|
17398
|
+
`).length, s3 = v3 ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, t7) : t7 ? [styleText2("cyan", S_BAR_END)] : [], h5 = s3.join(`
|
|
17399
|
+
`), $2 = s3.length + 1;
|
|
17400
|
+
return `${r8}${n8}${limitOptions({
|
|
17401
|
+
output: i8.output,
|
|
17402
|
+
options: this.options,
|
|
17403
|
+
cursor: this.cursor,
|
|
17404
|
+
maxItems: i8.maxItems,
|
|
17405
|
+
columnPadding: n8.length,
|
|
17406
|
+
rowPadding: l4 + $2,
|
|
17407
|
+
style: p6
|
|
17408
|
+
}).join(`
|
|
17409
|
+
${n8}`)}
|
|
17410
|
+
${h5}
|
|
17411
|
+
`;
|
|
17412
|
+
}
|
|
17413
|
+
}
|
|
17414
|
+
}
|
|
17415
|
+
}).prompt();
|
|
17416
|
+
}, groupMultiselect = (o6) => {
|
|
17417
|
+
const { selectableGroups: h5 = true, groupSpacing: x4 = 0 } = o6, m6 = (n8, l4, g4 = []) => {
|
|
17418
|
+
const a8 = n8.label ?? String(n8.value), t7 = typeof n8.group == "string", s3 = t7 && (g4[g4.indexOf(n8) + 1] ?? { group: true }), u7 = t7 && s3 && s3.group === true;
|
|
17419
|
+
let r8 = "", c4 = "";
|
|
17420
|
+
t7 && (h5 ? (r8 = u7 ? `${S_BAR_END} ` : `${S_BAR} `, c4 = u7 ? " " : `${S_BAR} `) : r8 = " ");
|
|
17421
|
+
let i8 = "";
|
|
17422
|
+
if (x4 > 0 && !t7 && (i8 = `
|
|
17303
17423
|
`.repeat(x4)), l4 === "active")
|
|
17304
|
-
return wrapTextWithPrefix(
|
|
17424
|
+
return wrapTextWithPrefix(o6.output, `${a8}${n8.hint ? ` ${styleText2("dim", `(${n8.hint})`)}` : ""}`, `${i8}${styleText2("dim", r8)} `, `${i8}${styleText2("dim", r8)}${styleText2("cyan", S_CHECKBOX_ACTIVE)} `, `${i8}${styleText2("dim", c4)} `);
|
|
17305
17425
|
if (l4 === "group-active")
|
|
17306
|
-
return wrapTextWithPrefix(
|
|
17426
|
+
return wrapTextWithPrefix(o6.output, a8, `${i8}${r8} `, `${i8}${r8}${styleText2("cyan", S_CHECKBOX_ACTIVE)} `, `${i8}${c4} `, (d5) => styleText2("dim", d5));
|
|
17307
17427
|
if (l4 === "group-active-selected")
|
|
17308
|
-
return wrapTextWithPrefix(
|
|
17428
|
+
return wrapTextWithPrefix(o6.output, a8, `${i8}${r8} `, `${i8}${r8}${styleText2("green", S_CHECKBOX_SELECTED)} `, `${i8}${c4} `, (d5) => styleText2("dim", d5));
|
|
17309
17429
|
if (l4 === "selected") {
|
|
17310
|
-
const
|
|
17311
|
-
return wrapTextWithPrefix(
|
|
17430
|
+
const d5 = t7 || h5 ? styleText2("green", S_CHECKBOX_SELECTED) : "";
|
|
17431
|
+
return wrapTextWithPrefix(o6.output, `${a8}${n8.hint ? ` (${n8.hint})` : ""}`, `${i8}${styleText2("dim", r8)} `, `${i8}${styleText2("dim", r8)}${d5} `, `${i8}${styleText2("dim", c4)} `, (S3) => styleText2("dim", S3));
|
|
17312
17432
|
}
|
|
17313
17433
|
if (l4 === "cancelled")
|
|
17314
|
-
return `${styleText2(["strikethrough", "dim"],
|
|
17434
|
+
return `${styleText2(["strikethrough", "dim"], a8)}`;
|
|
17315
17435
|
if (l4 === "active-selected")
|
|
17316
|
-
return wrapTextWithPrefix(
|
|
17436
|
+
return wrapTextWithPrefix(o6.output, `${a8}${n8.hint ? ` ${styleText2("dim", `(${n8.hint})`)}` : ""}`, `${i8}${styleText2("dim", r8)} `, `${i8}${styleText2("dim", r8)}${styleText2("green", S_CHECKBOX_SELECTED)} `, `${i8}${styleText2("dim", c4)} `);
|
|
17317
17437
|
if (l4 === "submitted")
|
|
17318
|
-
return `${styleText2("dim",
|
|
17319
|
-
const f5 =
|
|
17320
|
-
return wrapTextWithPrefix(
|
|
17321
|
-
}, y3 =
|
|
17322
|
-
return new u$
|
|
17323
|
-
options:
|
|
17324
|
-
signal:
|
|
17325
|
-
input:
|
|
17326
|
-
output:
|
|
17327
|
-
initialValues:
|
|
17438
|
+
return `${styleText2("dim", a8)}`;
|
|
17439
|
+
const f5 = t7 || h5 ? styleText2("dim", S_CHECKBOX_INACTIVE) : "";
|
|
17440
|
+
return wrapTextWithPrefix(o6.output, a8, `${i8}${styleText2("dim", r8)} `, `${i8}${styleText2("dim", r8)}${f5} `, `${i8}${styleText2("dim", c4)} `, (d5) => styleText2("dim", d5));
|
|
17441
|
+
}, y3 = o6.required ?? true, I3 = o6.showInstructions ?? true;
|
|
17442
|
+
return new u$2({
|
|
17443
|
+
options: o6.options,
|
|
17444
|
+
signal: o6.signal,
|
|
17445
|
+
input: o6.input,
|
|
17446
|
+
output: o6.output,
|
|
17447
|
+
initialValues: o6.initialValues,
|
|
17328
17448
|
required: y3,
|
|
17329
|
-
cursorAt:
|
|
17449
|
+
cursorAt: o6.cursorAt,
|
|
17330
17450
|
selectableGroups: h5,
|
|
17331
|
-
validate(
|
|
17332
|
-
if (y3 && (
|
|
17451
|
+
validate(n8) {
|
|
17452
|
+
if (y3 && (n8 === undefined || n8.length === 0))
|
|
17333
17453
|
return `Please select at least one option.
|
|
17334
17454
|
${styleText2("reset", styleText2("dim", `Press ${styleText2(["gray", "bgWhite", "inverse"], " space ")} to select, ${styleText2("gray", styleText2(["bgWhite", "inverse"], " enter "))} to submit`))}`;
|
|
17335
17455
|
},
|
|
17336
17456
|
render() {
|
|
17337
|
-
const
|
|
17338
|
-
` : ""}${symbol2(this.state)} ${
|
|
17339
|
-
`, g4 = this.value ?? [],
|
|
17340
|
-
const
|
|
17341
|
-
return !s3 && typeof
|
|
17457
|
+
const n8 = o6.withGuide ?? settings.withGuide, l4 = `${n8 ? `${styleText2("gray", S_BAR)}
|
|
17458
|
+
` : ""}${symbol2(this.state)} ${o6.message}
|
|
17459
|
+
`, g4 = this.value ?? [], a8 = (t7, s3) => {
|
|
17460
|
+
const u7 = this.options, r8 = g4.includes(t7.value) || t7.group === true && this.isGroupSelected(`${t7.value}`);
|
|
17461
|
+
return !s3 && typeof t7.group == "string" && this.options[this.cursor]?.value === t7.group ? m6(t7, r8 ? "group-active-selected" : "group-active", u7) : s3 && r8 ? m6(t7, "active-selected", u7) : r8 ? m6(t7, "selected", u7) : m6(t7, s3 ? "active" : "inactive", u7);
|
|
17342
17462
|
};
|
|
17343
17463
|
switch (this.state) {
|
|
17344
17464
|
case "submit": {
|
|
17345
|
-
const
|
|
17346
|
-
return `${l4}${
|
|
17465
|
+
const t7 = this.options.filter(({ value: u7 }) => g4.includes(u7)).map((u7) => m6(u7, "submitted")), s3 = t7.length === 0 ? "" : ` ${t7.join(styleText2("dim", ", "))}`;
|
|
17466
|
+
return `${l4}${n8 ? styleText2("gray", S_BAR) : ""}${s3}`;
|
|
17347
17467
|
}
|
|
17348
17468
|
case "cancel": {
|
|
17349
|
-
const
|
|
17350
|
-
return `${l4}${
|
|
17469
|
+
const t7 = this.options.filter(({ value: s3 }) => g4.includes(s3)).map((s3) => m6(s3, "cancelled")).join(styleText2("dim", ", "));
|
|
17470
|
+
return `${l4}${n8 ? `${styleText2("gray", S_BAR)} ` : ""}${t7.trim() ? `${t7}${n8 ? `
|
|
17351
17471
|
${styleText2("gray", S_BAR)}` : ""}` : ""}`;
|
|
17352
17472
|
}
|
|
17353
17473
|
case "error": {
|
|
17354
|
-
const
|
|
17355
|
-
`).map((
|
|
17356
|
-
`),
|
|
17357
|
-
`).length,
|
|
17358
|
-
`).length + 1,
|
|
17359
|
-
output:
|
|
17474
|
+
const t7 = n8 ? `${styleText2("yellow", S_BAR)} ` : "", s3 = this.error.split(`
|
|
17475
|
+
`).map((i8, f5) => f5 === 0 ? `${n8 ? `${styleText2("yellow", S_BAR_END)} ` : ""}${styleText2("yellow", i8)}` : ` ${i8}`).join(`
|
|
17476
|
+
`), u7 = l4.split(`
|
|
17477
|
+
`).length, r8 = s3.split(`
|
|
17478
|
+
`).length + 1, c4 = limitOptions({
|
|
17479
|
+
output: o6.output,
|
|
17360
17480
|
options: this.options,
|
|
17361
17481
|
cursor: this.cursor,
|
|
17362
|
-
maxItems:
|
|
17363
|
-
columnPadding:
|
|
17364
|
-
rowPadding:
|
|
17365
|
-
style:
|
|
17482
|
+
maxItems: o6.maxItems,
|
|
17483
|
+
columnPadding: t7.length,
|
|
17484
|
+
rowPadding: u7 + r8,
|
|
17485
|
+
style: a8
|
|
17366
17486
|
}).join(`
|
|
17367
|
-
${
|
|
17368
|
-
return `${l4}${
|
|
17487
|
+
${t7}`);
|
|
17488
|
+
return `${l4}${t7}${c4}
|
|
17369
17489
|
${s3}
|
|
17370
17490
|
`;
|
|
17371
17491
|
}
|
|
17372
17492
|
default: {
|
|
17373
|
-
const
|
|
17374
|
-
`).length,
|
|
17375
|
-
|
|
17493
|
+
const t7 = n8 ? `${styleText2("cyan", S_BAR)} ` : "", s3 = l4.split(`
|
|
17494
|
+
`).length, u7 = I3 ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, n8) : n8 ? [styleText2("cyan", S_BAR_END)] : [], r8 = u7.join(`
|
|
17495
|
+
`), c4 = u7.length + 1, i8 = limitOptions({
|
|
17496
|
+
output: o6.output,
|
|
17376
17497
|
options: this.options,
|
|
17377
17498
|
cursor: this.cursor,
|
|
17378
|
-
maxItems:
|
|
17379
|
-
columnPadding:
|
|
17380
|
-
rowPadding: s3 +
|
|
17381
|
-
style:
|
|
17499
|
+
maxItems: o6.maxItems,
|
|
17500
|
+
columnPadding: t7.length,
|
|
17501
|
+
rowPadding: s3 + c4,
|
|
17502
|
+
style: a8
|
|
17382
17503
|
}).join(`
|
|
17383
|
-
${
|
|
17384
|
-
return `${l4}${
|
|
17385
|
-
${
|
|
17504
|
+
${t7}`);
|
|
17505
|
+
return `${l4}${t7}${i8}
|
|
17506
|
+
${r8}
|
|
17386
17507
|
`;
|
|
17387
17508
|
}
|
|
17388
17509
|
}
|
|
17389
17510
|
}
|
|
17390
17511
|
}).prompt();
|
|
17391
|
-
}, log, cancel = (o6 = "",
|
|
17392
|
-
const i8 =
|
|
17393
|
-
i8.write(`${
|
|
17512
|
+
}, log, cancel = (o6 = "", t7) => {
|
|
17513
|
+
const i8 = t7?.output ?? process.stdout, e6 = t7?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_END)} ` : "";
|
|
17514
|
+
i8.write(`${e6}${styleText2("red", o6)}
|
|
17394
17515
|
|
|
17395
17516
|
`);
|
|
17396
|
-
}, intro = (o6 = "",
|
|
17397
|
-
const i8 =
|
|
17398
|
-
i8.write(`${
|
|
17517
|
+
}, intro = (o6 = "", t7) => {
|
|
17518
|
+
const i8 = t7?.output ?? process.stdout, e6 = t7?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_START)} ` : "";
|
|
17519
|
+
i8.write(`${e6}${o6}
|
|
17399
17520
|
`);
|
|
17400
|
-
}, outro = (o6 = "",
|
|
17401
|
-
const i8 =
|
|
17521
|
+
}, outro = (o6 = "", t7) => {
|
|
17522
|
+
const i8 = t7?.output ?? process.stdout, e6 = t7?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR)}
|
|
17402
17523
|
${styleText2("gray", S_BAR_END)} ` : "";
|
|
17403
|
-
i8.write(`${
|
|
17524
|
+
i8.write(`${e6}${o6}
|
|
17404
17525
|
|
|
17405
17526
|
`);
|
|
17406
|
-
}, multiline = (
|
|
17407
|
-
validate:
|
|
17408
|
-
placeholder:
|
|
17409
|
-
defaultValue:
|
|
17410
|
-
initialValue:
|
|
17411
|
-
showSubmit:
|
|
17412
|
-
output:
|
|
17413
|
-
signal:
|
|
17414
|
-
input:
|
|
17527
|
+
}, multiline = (e6) => new h4({
|
|
17528
|
+
validate: e6.validate,
|
|
17529
|
+
placeholder: e6.placeholder,
|
|
17530
|
+
defaultValue: e6.defaultValue,
|
|
17531
|
+
initialValue: e6.initialValue,
|
|
17532
|
+
showSubmit: e6.showSubmit,
|
|
17533
|
+
output: e6.output,
|
|
17534
|
+
signal: e6.signal,
|
|
17535
|
+
input: e6.input,
|
|
17415
17536
|
render() {
|
|
17416
|
-
const i8 =
|
|
17417
|
-
` : ""}${symbol2(this.state)} `}${
|
|
17418
|
-
`,
|
|
17537
|
+
const i8 = e6?.withGuide ?? settings.withGuide, o6 = `${`${i8 ? `${styleText2("gray", S_BAR)}
|
|
17538
|
+
` : ""}${symbol2(this.state)} `}${e6.message}
|
|
17539
|
+
`, m6 = e6.placeholder && e6.placeholder.length > 0 ? styleText2("inverse", e6.placeholder[0]) + styleText2("dim", e6.placeholder.slice(1)) : styleText2(["inverse", "hidden"], "_"), a8 = this.userInput ? this.userInputWithCursor : m6, l4 = this.value ?? "", c4 = e6.showSubmit ? `
|
|
17419
17540
|
${styleText2(this.focused === "submit" ? "cyan" : "dim", "[ submit ]")}` : "";
|
|
17420
17541
|
switch (this.state) {
|
|
17421
17542
|
case "error": {
|
|
17422
|
-
const
|
|
17423
|
-
return `${o6}${
|
|
17424
|
-
${
|
|
17543
|
+
const n8 = `${styleText2("yellow", S_BAR)} `, r8 = i8 ? wrapTextWithPrefix(e6.output, a8, n8, undefined) : a8, u7 = styleText2("yellow", S_BAR_END);
|
|
17544
|
+
return `${o6}${r8}
|
|
17545
|
+
${u7} ${styleText2("yellow", this.error)}${c4}
|
|
17425
17546
|
`;
|
|
17426
17547
|
}
|
|
17427
17548
|
case "submit": {
|
|
17428
|
-
const
|
|
17429
|
-
return `${o6}${
|
|
17549
|
+
const n8 = `${styleText2("gray", S_BAR)} `, r8 = i8 ? wrapTextWithPrefix(e6.output, l4, n8, undefined, undefined, (u7) => styleText2("dim", u7)) : l4 ? styleText2("dim", l4) : "";
|
|
17550
|
+
return `${o6}${r8}`;
|
|
17430
17551
|
}
|
|
17431
17552
|
case "cancel": {
|
|
17432
|
-
const
|
|
17433
|
-
return `${o6}${
|
|
17553
|
+
const n8 = `${styleText2("gray", S_BAR)} `, r8 = i8 ? wrapTextWithPrefix(e6.output, l4, n8, undefined, undefined, (u7) => styleText2(["strikethrough", "dim"], u7)) : l4 ? styleText2(["strikethrough", "dim"], l4) : "";
|
|
17554
|
+
return `${o6}${r8}`;
|
|
17434
17555
|
}
|
|
17435
17556
|
default: {
|
|
17436
|
-
const
|
|
17437
|
-
return `${o6}${
|
|
17438
|
-
${
|
|
17557
|
+
const n8 = i8 ? `${styleText2("cyan", S_BAR)} ` : "", r8 = i8 ? styleText2("cyan", S_BAR_END) : "", u7 = i8 ? wrapTextWithPrefix(e6.output, a8, n8) : a8;
|
|
17558
|
+
return `${o6}${u7}
|
|
17559
|
+
${r8}${c4}
|
|
17439
17560
|
`;
|
|
17440
17561
|
}
|
|
17441
17562
|
}
|
|
17442
17563
|
}
|
|
17443
|
-
}).prompt(),
|
|
17444
|
-
|
|
17445
|
-
`), multiselect = (n6) => {
|
|
17446
|
-
const a9 = (t6, o6) => {
|
|
17447
|
-
const r7 = t6.label ?? String(t6.value);
|
|
17448
|
-
return o6 === "disabled" ? `${styleText2("gray", S_CHECKBOX_INACTIVE)} ${d4(r7, (l4) => styleText2(["strikethrough", "gray"], l4))}${t6.hint ? ` ${styleText2("dim", `(${t6.hint ?? "disabled"})`)}` : ""}` : o6 === "active" ? `${styleText2("cyan", S_CHECKBOX_ACTIVE)} ${r7}${t6.hint ? ` ${styleText2("dim", `(${t6.hint})`)}` : ""}` : o6 === "selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${d4(r7, (l4) => styleText2("dim", l4))}${t6.hint ? ` ${styleText2("dim", `(${t6.hint})`)}` : ""}` : o6 === "cancelled" ? `${d4(r7, (l4) => styleText2(["strikethrough", "dim"], l4))}` : o6 === "active-selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${r7}${t6.hint ? ` ${styleText2("dim", `(${t6.hint})`)}` : ""}` : o6 === "submitted" ? `${d4(r7, (l4) => styleText2("dim", l4))}` : `${styleText2("dim", S_CHECKBOX_INACTIVE)} ${d4(r7, (l4) => styleText2("dim", l4))}`;
|
|
17449
|
-
}, m5 = n6.required ?? true;
|
|
17450
|
-
return new a$1({
|
|
17451
|
-
options: n6.options,
|
|
17452
|
-
signal: n6.signal,
|
|
17453
|
-
input: n6.input,
|
|
17454
|
-
output: n6.output,
|
|
17455
|
-
initialValues: n6.initialValues,
|
|
17456
|
-
required: m5,
|
|
17457
|
-
cursorAt: n6.cursorAt,
|
|
17458
|
-
validate(t6) {
|
|
17459
|
-
if (m5 && (t6 === undefined || t6.length === 0))
|
|
17460
|
-
return `Please select at least one option.
|
|
17461
|
-
${styleText2("reset", styleText2("dim", `Press ${styleText2(["gray", "bgWhite", "inverse"], " space ")} to select, ${styleText2("gray", styleText2("bgWhite", styleText2("inverse", " enter ")))} to submit`))}`;
|
|
17462
|
-
},
|
|
17463
|
-
render() {
|
|
17464
|
-
const t6 = n6.withGuide ?? settings.withGuide, o6 = wrapTextWithPrefix(n6.output, n6.message, t6 ? `${symbolBar(this.state)} ` : "", `${symbol2(this.state)} `), r7 = `${t6 ? `${styleText2("gray", S_BAR)}
|
|
17465
|
-
` : ""}${o6}
|
|
17466
|
-
`, l4 = this.value ?? [], g4 = (i8, u5) => {
|
|
17467
|
-
if (i8.disabled)
|
|
17468
|
-
return a9(i8, "disabled");
|
|
17469
|
-
const s3 = l4.includes(i8.value);
|
|
17470
|
-
return u5 && s3 ? a9(i8, "active-selected") : s3 ? a9(i8, "selected") : a9(i8, u5 ? "active" : "inactive");
|
|
17471
|
-
};
|
|
17472
|
-
switch (this.state) {
|
|
17473
|
-
case "submit": {
|
|
17474
|
-
const i8 = this.options.filter(({ value: s3 }) => l4.includes(s3)).map((s3) => a9(s3, "submitted")).join(styleText2("dim", ", ")) || styleText2("dim", "none"), u5 = wrapTextWithPrefix(n6.output, i8, t6 ? `${styleText2("gray", S_BAR)} ` : "");
|
|
17475
|
-
return `${r7}${u5}`;
|
|
17476
|
-
}
|
|
17477
|
-
case "cancel": {
|
|
17478
|
-
const i8 = this.options.filter(({ value: s3 }) => l4.includes(s3)).map((s3) => a9(s3, "cancelled")).join(styleText2("dim", ", "));
|
|
17479
|
-
if (i8.trim() === "")
|
|
17480
|
-
return `${r7}${styleText2("gray", S_BAR)}`;
|
|
17481
|
-
const u5 = wrapTextWithPrefix(n6.output, i8, t6 ? `${styleText2("gray", S_BAR)} ` : "");
|
|
17482
|
-
return `${r7}${u5}${t6 ? `
|
|
17483
|
-
${styleText2("gray", S_BAR)}` : ""}`;
|
|
17484
|
-
}
|
|
17485
|
-
case "error": {
|
|
17486
|
-
const i8 = t6 ? `${styleText2("yellow", S_BAR)} ` : "", u5 = this.error.split(`
|
|
17487
|
-
`).map((h5, x4) => x4 === 0 ? `${t6 ? `${styleText2("yellow", S_BAR_END)} ` : ""}${styleText2("yellow", h5)}` : ` ${h5}`).join(`
|
|
17488
|
-
`), s3 = r7.split(`
|
|
17489
|
-
`).length, v3 = u5.split(`
|
|
17490
|
-
`).length + 1;
|
|
17491
|
-
return `${r7}${i8}${limitOptions({
|
|
17492
|
-
output: n6.output,
|
|
17493
|
-
options: this.options,
|
|
17494
|
-
cursor: this.cursor,
|
|
17495
|
-
maxItems: n6.maxItems,
|
|
17496
|
-
columnPadding: i8.length,
|
|
17497
|
-
rowPadding: s3 + v3,
|
|
17498
|
-
style: g4
|
|
17499
|
-
}).join(`
|
|
17500
|
-
${i8}`)}
|
|
17501
|
-
${u5}
|
|
17502
|
-
`;
|
|
17503
|
-
}
|
|
17504
|
-
default: {
|
|
17505
|
-
const i8 = t6 ? `${styleText2("cyan", S_BAR)} ` : "", u5 = r7.split(`
|
|
17506
|
-
`).length, s3 = t6 ? 2 : 1;
|
|
17507
|
-
return `${r7}${i8}${limitOptions({
|
|
17508
|
-
output: n6.output,
|
|
17509
|
-
options: this.options,
|
|
17510
|
-
cursor: this.cursor,
|
|
17511
|
-
maxItems: n6.maxItems,
|
|
17512
|
-
columnPadding: i8.length,
|
|
17513
|
-
rowPadding: u5 + s3,
|
|
17514
|
-
style: g4
|
|
17515
|
-
}).join(`
|
|
17516
|
-
${i8}`)}
|
|
17517
|
-
${t6 ? styleText2("cyan", S_BAR_END) : ""}
|
|
17518
|
-
`;
|
|
17519
|
-
}
|
|
17520
|
-
}
|
|
17521
|
-
}
|
|
17522
|
-
}).prompt();
|
|
17523
|
-
}, W$1 = (o6) => styleText2("dim", o6), C4 = (o6, e5, s3) => {
|
|
17524
|
-
const a9 = {
|
|
17564
|
+
}).prompt(), W$1 = (o6) => o6, C4 = (o6, e6, s3) => {
|
|
17565
|
+
const a8 = {
|
|
17525
17566
|
hard: true,
|
|
17526
17567
|
trim: false
|
|
17527
|
-
}, i8 = wrapAnsi(o6,
|
|
17528
|
-
`), c4 = i8.reduce((
|
|
17529
|
-
return wrapAnsi(o6, g4,
|
|
17530
|
-
}, note = (o6 = "",
|
|
17531
|
-
const
|
|
17532
|
-
`).map(c4), ""],
|
|
17568
|
+
}, i8 = wrapAnsi(o6, e6, a8).split(`
|
|
17569
|
+
`), c4 = i8.reduce((n8, t7) => Math.max(dist_default2(t7), n8), 0), u7 = i8.map(s3).reduce((n8, t7) => Math.max(dist_default2(t7), n8), 0), g4 = e6 - (u7 - c4);
|
|
17570
|
+
return wrapAnsi(o6, g4, a8);
|
|
17571
|
+
}, note = (o6 = "", e6 = "", s3) => {
|
|
17572
|
+
const a8 = s3?.output ?? process$1.stdout, i8 = s3?.withGuide ?? settings.withGuide, c4 = s3?.format ?? W$1, g4 = ["", ...C4(o6, getColumns(a8) - 6, c4).split(`
|
|
17573
|
+
`).map(c4), ""], n8 = dist_default2(e6), t7 = Math.max(g4.reduce((m6, F3) => {
|
|
17533
17574
|
const O2 = dist_default2(F3);
|
|
17534
|
-
return O2 >
|
|
17535
|
-
}, 0),
|
|
17575
|
+
return O2 > m6 ? O2 : m6;
|
|
17576
|
+
}, 0), n8) + 2, h5 = g4.map((m6) => `${styleText2("gray", S_BAR)} ${m6}${" ".repeat(t7 - dist_default2(m6))}${styleText2("gray", S_BAR)}`).join(`
|
|
17536
17577
|
`), T5 = i8 ? `${styleText2("gray", S_BAR)}
|
|
17537
17578
|
` : "", l$1 = i8 ? S_CONNECT_LEFT : S_CORNER_BOTTOM_LEFT;
|
|
17538
|
-
|
|
17579
|
+
a8.write(`${T5}${styleText2("green", S_STEP_SUBMIT)} ${styleText2("reset", e6)} ${styleText2("gray", S_BAR_H.repeat(Math.max(t7 - n8 - 1, 1)) + S_CORNER_TOP_RIGHT)}
|
|
17539
17580
|
${h5}
|
|
17540
|
-
${styleText2("gray", l$1 + S_BAR_H.repeat(
|
|
17581
|
+
${styleText2("gray", l$1 + S_BAR_H.repeat(t7 + 2) + S_CORNER_BOTTOM_RIGHT)}
|
|
17541
17582
|
`);
|
|
17542
|
-
}, password = (
|
|
17543
|
-
validate:
|
|
17544
|
-
mask:
|
|
17545
|
-
signal:
|
|
17546
|
-
input:
|
|
17547
|
-
output:
|
|
17583
|
+
}, password = (r8) => new u$1({
|
|
17584
|
+
validate: r8.validate,
|
|
17585
|
+
mask: r8.mask ?? S_PASSWORD_MASK,
|
|
17586
|
+
signal: r8.signal,
|
|
17587
|
+
input: r8.input,
|
|
17588
|
+
output: r8.output,
|
|
17548
17589
|
render() {
|
|
17549
|
-
const
|
|
17550
|
-
` : ""}${symbol2(this.state)} ${
|
|
17590
|
+
const e6 = r8.withGuide ?? settings.withGuide, o6 = `${e6 ? `${styleText2("gray", S_BAR)}
|
|
17591
|
+
` : ""}${symbol2(this.state)} ${r8.message}
|
|
17551
17592
|
`, c4 = this.userInputWithCursor, i8 = this.masked;
|
|
17552
17593
|
switch (this.state) {
|
|
17553
17594
|
case "error": {
|
|
17554
|
-
const s3 =
|
|
17555
|
-
return
|
|
17595
|
+
const s3 = e6 ? `${styleText2("yellow", S_BAR)} ` : "", n8 = e6 ? `${styleText2("yellow", S_BAR_END)} ` : "", l4 = i8 ?? "";
|
|
17596
|
+
return r8.clearOnError && this.clear(), `${o6.trim()}
|
|
17556
17597
|
${s3}${l4}
|
|
17557
|
-
${
|
|
17598
|
+
${n8}${styleText2("yellow", this.error)}
|
|
17558
17599
|
`;
|
|
17559
17600
|
}
|
|
17560
17601
|
case "submit": {
|
|
17561
|
-
const s3 =
|
|
17562
|
-
return `${o6}${s3}${
|
|
17602
|
+
const s3 = e6 ? `${styleText2("gray", S_BAR)} ` : "", n8 = i8 ? styleText2("dim", i8) : "";
|
|
17603
|
+
return `${o6}${s3}${n8}`;
|
|
17563
17604
|
}
|
|
17564
17605
|
case "cancel": {
|
|
17565
|
-
const s3 =
|
|
17566
|
-
return `${o6}${s3}${
|
|
17606
|
+
const s3 = e6 ? `${styleText2("gray", S_BAR)} ` : "", n8 = i8 ? styleText2(["strikethrough", "dim"], i8) : "";
|
|
17607
|
+
return `${o6}${s3}${n8}${i8 && e6 ? `
|
|
17567
17608
|
${styleText2("gray", S_BAR)}` : ""}`;
|
|
17568
17609
|
}
|
|
17569
17610
|
default: {
|
|
17570
|
-
const s3 =
|
|
17611
|
+
const s3 = e6 ? `${styleText2("cyan", S_BAR)} ` : "", n8 = e6 ? styleText2("cyan", S_BAR_END) : "";
|
|
17571
17612
|
return `${o6}${s3}${c4}
|
|
17572
|
-
${
|
|
17613
|
+
${n8}
|
|
17573
17614
|
`;
|
|
17574
17615
|
}
|
|
17575
17616
|
}
|
|
17576
17617
|
}
|
|
17577
|
-
}).prompt(), path = (
|
|
17578
|
-
const
|
|
17618
|
+
}).prompt(), path = (e6) => {
|
|
17619
|
+
const a8 = e6.validate;
|
|
17579
17620
|
return autocomplete({
|
|
17580
|
-
...
|
|
17581
|
-
initialUserInput:
|
|
17621
|
+
...e6,
|
|
17622
|
+
initialUserInput: e6.initialValue ?? e6.root ?? process.cwd(),
|
|
17582
17623
|
maxItems: 5,
|
|
17583
|
-
validate(
|
|
17584
|
-
if (!Array.isArray(
|
|
17585
|
-
if (!
|
|
17624
|
+
validate(t7) {
|
|
17625
|
+
if (!Array.isArray(t7)) {
|
|
17626
|
+
if (!t7)
|
|
17586
17627
|
return "Please select a path";
|
|
17587
|
-
if (
|
|
17588
|
-
return runValidation(
|
|
17628
|
+
if (a8)
|
|
17629
|
+
return runValidation(a8, t7);
|
|
17589
17630
|
}
|
|
17590
17631
|
},
|
|
17591
17632
|
options() {
|
|
17592
|
-
const
|
|
17593
|
-
if (
|
|
17633
|
+
const t7 = this.userInput;
|
|
17634
|
+
if (t7 === "")
|
|
17594
17635
|
return [];
|
|
17595
17636
|
try {
|
|
17596
17637
|
let i8;
|
|
17597
|
-
existsSync9(
|
|
17598
|
-
const c4 =
|
|
17599
|
-
return readdirSync(i8).map((
|
|
17600
|
-
const
|
|
17638
|
+
existsSync9(t7) ? lstatSync(t7).isDirectory() && (!e6.directory || t7.endsWith("/")) ? i8 = t7 : i8 = dirname6(t7) : i8 = dirname6(t7);
|
|
17639
|
+
const c4 = t7.length > 1 && t7.endsWith("/") ? t7.slice(0, -1) : t7;
|
|
17640
|
+
return readdirSync(i8).map((r8) => {
|
|
17641
|
+
const n8 = join12(i8, r8), m6 = lstatSync(n8);
|
|
17601
17642
|
return {
|
|
17602
|
-
name:
|
|
17603
|
-
path:
|
|
17604
|
-
isDirectory:
|
|
17643
|
+
name: r8,
|
|
17644
|
+
path: n8,
|
|
17645
|
+
isDirectory: m6.isDirectory()
|
|
17605
17646
|
};
|
|
17606
|
-
}).filter(({ path:
|
|
17607
|
-
value:
|
|
17647
|
+
}).filter(({ path: r8, isDirectory: n8 }) => r8.startsWith(c4) && (n8 || !e6.directory)).map((r8) => ({
|
|
17648
|
+
value: r8.path
|
|
17608
17649
|
}));
|
|
17609
17650
|
} catch {
|
|
17610
17651
|
return [];
|
|
@@ -17614,328 +17655,333 @@ ${n6}
|
|
|
17614
17655
|
}, W2 = (l4) => styleText2("magenta", l4), spinner = ({
|
|
17615
17656
|
indicator: l4 = "dots",
|
|
17616
17657
|
onCancel: h5,
|
|
17617
|
-
output:
|
|
17658
|
+
output: n8 = process.stdout,
|
|
17618
17659
|
cancelMessage: G2,
|
|
17619
17660
|
errorMessage: O2,
|
|
17620
17661
|
frames: E3 = unicode ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"],
|
|
17621
17662
|
delay: F3 = unicode ? 80 : 120,
|
|
17622
|
-
signal:
|
|
17623
|
-
...
|
|
17663
|
+
signal: m6,
|
|
17664
|
+
...I3
|
|
17624
17665
|
} = {}) => {
|
|
17625
|
-
const
|
|
17666
|
+
const u7 = isCI();
|
|
17626
17667
|
let M3, T5, d5 = false, S3 = false, s3 = "", p6, w3 = performance.now();
|
|
17627
|
-
const x4 = getColumns(
|
|
17628
|
-
const
|
|
17629
|
-
S3 =
|
|
17668
|
+
const x4 = getColumns(n8), k2 = I3?.styleFrame ?? W2, g4 = (e6) => {
|
|
17669
|
+
const r8 = e6 > 1 ? O2 ?? settings.messages.error : G2 ?? settings.messages.cancel;
|
|
17670
|
+
S3 = e6 === 1, d5 && (a8(r8, e6), S3 && typeof h5 == "function" && h5());
|
|
17630
17671
|
}, f5 = () => g4(2), i8 = () => g4(1), A2 = () => {
|
|
17631
|
-
process.on("uncaughtExceptionMonitor", f5), process.on("unhandledRejection", f5), process.on("SIGINT", i8), process.on("SIGTERM", i8), process.on("exit", g4),
|
|
17672
|
+
process.on("uncaughtExceptionMonitor", f5), process.on("unhandledRejection", f5), process.on("SIGINT", i8), process.on("SIGTERM", i8), process.on("exit", g4), m6 && m6.addEventListener("abort", i8);
|
|
17632
17673
|
}, H2 = () => {
|
|
17633
|
-
process.removeListener("uncaughtExceptionMonitor", f5), process.removeListener("unhandledRejection", f5), process.removeListener("SIGINT", i8), process.removeListener("SIGTERM", i8), process.removeListener("exit", g4),
|
|
17674
|
+
process.removeListener("uncaughtExceptionMonitor", f5), process.removeListener("unhandledRejection", f5), process.removeListener("SIGINT", i8), process.removeListener("SIGTERM", i8), process.removeListener("exit", g4), m6 && m6.removeEventListener("abort", i8);
|
|
17634
17675
|
}, y3 = () => {
|
|
17635
17676
|
if (p6 === undefined)
|
|
17636
17677
|
return;
|
|
17637
|
-
|
|
17678
|
+
u7 && n8.write(`
|
|
17638
17679
|
`);
|
|
17639
|
-
const
|
|
17680
|
+
const r8 = wrapAnsi(p6, x4, {
|
|
17640
17681
|
hard: true,
|
|
17641
17682
|
trim: false
|
|
17642
17683
|
}).split(`
|
|
17643
17684
|
`);
|
|
17644
|
-
|
|
17645
|
-
}, C5 = (
|
|
17646
|
-
const
|
|
17647
|
-
return
|
|
17648
|
-
}, N3 =
|
|
17649
|
-
d5 = true, M3 = block({ output:
|
|
17685
|
+
r8.length > 1 && n8.write(import_sisteransi2.cursor.up(r8.length - 1)), n8.write(import_sisteransi2.cursor.to(0)), n8.write(import_sisteransi2.erase.down());
|
|
17686
|
+
}, C5 = (e6) => e6.replace(/\.+$/, ""), _4 = (e6) => {
|
|
17687
|
+
const r8 = (performance.now() - e6) / 1000, t7 = Math.floor(r8 / 60), o6 = Math.floor(r8 % 60);
|
|
17688
|
+
return t7 > 0 ? `[${t7}m ${o6}s]` : `[${o6}s]`;
|
|
17689
|
+
}, N3 = I3.withGuide ?? settings.withGuide, P4 = (e6 = "") => {
|
|
17690
|
+
d5 = true, M3 = block({ output: n8 }), s3 = C5(e6), w3 = performance.now(), N3 && n8.write(`${styleText2("gray", S_BAR)}
|
|
17650
17691
|
`);
|
|
17651
|
-
let
|
|
17692
|
+
let r8 = 0, t7 = 0;
|
|
17652
17693
|
A2(), T5 = setInterval(() => {
|
|
17653
|
-
if (
|
|
17694
|
+
if (u7 && s3 === p6)
|
|
17654
17695
|
return;
|
|
17655
17696
|
y3(), p6 = s3;
|
|
17656
|
-
const o6 = k2(E3[
|
|
17697
|
+
const o6 = k2(E3[r8]);
|
|
17657
17698
|
let v3;
|
|
17658
|
-
if (
|
|
17699
|
+
if (u7)
|
|
17659
17700
|
v3 = `${o6} ${s3}...`;
|
|
17660
17701
|
else if (l4 === "timer")
|
|
17661
17702
|
v3 = `${o6} ${s3} ${_4(w3)}`;
|
|
17662
17703
|
else {
|
|
17663
|
-
const B2 = ".".repeat(Math.floor(
|
|
17704
|
+
const B2 = ".".repeat(Math.floor(t7)).slice(0, 3);
|
|
17664
17705
|
v3 = `${o6} ${s3}${B2}`;
|
|
17665
17706
|
}
|
|
17666
17707
|
const j2 = wrapAnsi(v3, x4, {
|
|
17667
17708
|
hard: true,
|
|
17668
17709
|
trim: false
|
|
17669
17710
|
});
|
|
17670
|
-
|
|
17711
|
+
n8.write(j2), r8 = r8 + 1 < E3.length ? r8 + 1 : 0, t7 = t7 < 4 ? t7 + 0.125 : 0;
|
|
17671
17712
|
}, F3);
|
|
17672
|
-
},
|
|
17713
|
+
}, a8 = (e6 = "", r8 = 0, t7 = false) => {
|
|
17673
17714
|
if (!d5)
|
|
17674
17715
|
return;
|
|
17675
17716
|
d5 = false, clearInterval(T5), y3();
|
|
17676
|
-
const o6 =
|
|
17677
|
-
s3 =
|
|
17678
|
-
`) :
|
|
17717
|
+
const o6 = r8 === 0 ? styleText2("green", S_STEP_SUBMIT) : r8 === 1 ? styleText2("red", S_STEP_CANCEL) : styleText2("red", S_STEP_ERROR);
|
|
17718
|
+
s3 = e6 ?? s3, t7 || (l4 === "timer" ? n8.write(`${o6} ${s3} ${_4(w3)}
|
|
17719
|
+
`) : n8.write(`${o6} ${s3}
|
|
17679
17720
|
`)), H2(), M3();
|
|
17680
17721
|
};
|
|
17681
17722
|
return {
|
|
17682
17723
|
start: P4,
|
|
17683
|
-
stop: (
|
|
17684
|
-
message: (
|
|
17685
|
-
s3 = C5(
|
|
17724
|
+
stop: (e6 = "") => a8(e6, 0),
|
|
17725
|
+
message: (e6 = "") => {
|
|
17726
|
+
s3 = C5(e6 ?? s3);
|
|
17686
17727
|
},
|
|
17687
|
-
cancel: (
|
|
17688
|
-
error: (
|
|
17689
|
-
clear: () =>
|
|
17728
|
+
cancel: (e6 = "") => a8(e6, 1),
|
|
17729
|
+
error: (e6 = "") => a8(e6, 2),
|
|
17730
|
+
clear: () => a8("", 0, true),
|
|
17690
17731
|
get isCancelled() {
|
|
17691
17732
|
return S3;
|
|
17692
17733
|
}
|
|
17693
17734
|
};
|
|
17694
|
-
},
|
|
17695
|
-
`) ?
|
|
17696
|
-
`).map((
|
|
17697
|
-
`) :
|
|
17698
|
-
const
|
|
17699
|
-
|
|
17700
|
-
|
|
17735
|
+
}, u7, SELECT_INSTRUCTIONS, c4 = (t7, o6) => t7.includes(`
|
|
17736
|
+
`) ? t7.split(`
|
|
17737
|
+
`).map((d5) => o6(d5)).join(`
|
|
17738
|
+
`) : o6(t7), select = (t7) => {
|
|
17739
|
+
const o6 = (n8, m6) => {
|
|
17740
|
+
if (n8 === undefined)
|
|
17741
|
+
return "";
|
|
17742
|
+
const s3 = n8.label ?? String(n8.value);
|
|
17743
|
+
switch (m6) {
|
|
17701
17744
|
case "disabled":
|
|
17702
|
-
return `${styleText2("gray", S_RADIO_INACTIVE)} ${c4(s3, (
|
|
17745
|
+
return `${styleText2("gray", S_RADIO_INACTIVE)} ${c4(s3, (i8) => styleText2("gray", i8))}${n8.hint ? ` ${styleText2("dim", `(${n8.hint ?? "disabled"})`)}` : ""}`;
|
|
17703
17746
|
case "selected":
|
|
17704
|
-
return `${c4(s3, (
|
|
17747
|
+
return `${c4(s3, (i8) => styleText2("dim", i8))}`;
|
|
17705
17748
|
case "active":
|
|
17706
|
-
return `${styleText2("green", S_RADIO_ACTIVE)} ${s3}${
|
|
17749
|
+
return `${styleText2("green", S_RADIO_ACTIVE)} ${s3}${n8.hint ? ` ${styleText2("dim", `(${n8.hint})`)}` : ""}`;
|
|
17707
17750
|
case "cancelled":
|
|
17708
|
-
return `${c4(s3, (
|
|
17751
|
+
return `${c4(s3, (i8) => styleText2(["strikethrough", "dim"], i8))}`;
|
|
17709
17752
|
default:
|
|
17710
|
-
return `${styleText2("dim", S_RADIO_INACTIVE)} ${c4(s3, (
|
|
17711
|
-
}
|
|
17712
|
-
};
|
|
17713
|
-
return new
|
|
17714
|
-
options:
|
|
17715
|
-
signal:
|
|
17716
|
-
input:
|
|
17717
|
-
output:
|
|
17718
|
-
initialValue:
|
|
17753
|
+
return `${styleText2("dim", S_RADIO_INACTIVE)} ${c4(s3, (i8) => styleText2("dim", i8))}`;
|
|
17754
|
+
}
|
|
17755
|
+
}, d5 = t7.showInstructions ?? true;
|
|
17756
|
+
return new n$1({
|
|
17757
|
+
options: t7.options,
|
|
17758
|
+
signal: t7.signal,
|
|
17759
|
+
input: t7.input,
|
|
17760
|
+
output: t7.output,
|
|
17761
|
+
initialValue: t7.initialValue,
|
|
17719
17762
|
render() {
|
|
17720
|
-
const
|
|
17721
|
-
` : ""}${
|
|
17763
|
+
const n8 = t7.withGuide ?? settings.withGuide, m6 = `${symbol2(this.state)} `, s3 = `${symbolBar(this.state)} `, i8 = wrapTextWithPrefix(t7.output, t7.message, s3, m6), u8 = `${n8 ? `${styleText2("gray", S_BAR)}
|
|
17764
|
+
` : ""}${i8}
|
|
17722
17765
|
`;
|
|
17723
17766
|
switch (this.state) {
|
|
17724
17767
|
case "submit": {
|
|
17725
|
-
const
|
|
17726
|
-
return `${
|
|
17768
|
+
const r8 = n8 ? `${styleText2("gray", S_BAR)} ` : "", a8 = wrapTextWithPrefix(t7.output, o6(this.options[this.cursor], "selected"), r8);
|
|
17769
|
+
return `${u8}${a8}`;
|
|
17727
17770
|
}
|
|
17728
17771
|
case "cancel": {
|
|
17729
|
-
const
|
|
17730
|
-
return `${
|
|
17772
|
+
const r8 = n8 ? `${styleText2("gray", S_BAR)} ` : "", a8 = wrapTextWithPrefix(t7.output, o6(this.options[this.cursor], "cancelled"), r8);
|
|
17773
|
+
return `${u8}${a8}${n8 ? `
|
|
17731
17774
|
${styleText2("gray", S_BAR)}` : ""}`;
|
|
17732
17775
|
}
|
|
17733
17776
|
default: {
|
|
17734
|
-
const
|
|
17735
|
-
`).length,
|
|
17736
|
-
|
|
17737
|
-
|
|
17777
|
+
const r8 = n8 ? `${styleText2("cyan", S_BAR)} ` : "", a8 = u8.split(`
|
|
17778
|
+
`).length, p6 = d5 ? formatInstructionFooter(SELECT_INSTRUCTIONS, n8) : n8 ? [styleText2("cyan", S_BAR_END)] : [], b5 = p6.join(`
|
|
17779
|
+
`), f5 = p6.length + 1;
|
|
17780
|
+
return `${u8}${r8}${limitOptions({
|
|
17781
|
+
output: t7.output,
|
|
17738
17782
|
cursor: this.cursor,
|
|
17739
17783
|
options: this.options,
|
|
17740
|
-
maxItems:
|
|
17741
|
-
columnPadding:
|
|
17742
|
-
rowPadding:
|
|
17743
|
-
style: (
|
|
17784
|
+
maxItems: t7.maxItems,
|
|
17785
|
+
columnPadding: r8.length,
|
|
17786
|
+
rowPadding: a8 + f5,
|
|
17787
|
+
style: (g4, x4) => o6(g4, g4.disabled ? "disabled" : x4 ? "active" : "inactive")
|
|
17744
17788
|
}).join(`
|
|
17745
|
-
${
|
|
17746
|
-
${
|
|
17789
|
+
${r8}`)}
|
|
17790
|
+
${b5}
|
|
17747
17791
|
`;
|
|
17748
17792
|
}
|
|
17749
17793
|
}
|
|
17750
17794
|
}
|
|
17751
17795
|
}).prompt();
|
|
17752
|
-
}, selectKey = (
|
|
17753
|
-
const l4 = (
|
|
17754
|
-
|
|
17755
|
-
|
|
17756
|
-
|
|
17757
|
-
|
|
17758
|
-
|
|
17759
|
-
|
|
17760
|
-
|
|
17761
|
-
|
|
17762
|
-
|
|
17763
|
-
|
|
17796
|
+
}, selectKey = (t7) => {
|
|
17797
|
+
const l4 = (e6, a8 = "inactive") => {
|
|
17798
|
+
if (e6 === undefined)
|
|
17799
|
+
return "";
|
|
17800
|
+
const n8 = e6.label ?? String(e6.value);
|
|
17801
|
+
return a8 === "selected" ? `${styleText2("dim", n8)}` : a8 === "cancelled" ? `${styleText2(["strikethrough", "dim"], n8)}` : a8 === "active" ? `${styleText2(["bgCyan", "gray"], ` ${e6.value} `)} ${n8}${e6.hint ? ` ${styleText2("dim", `(${e6.hint})`)}` : ""}` : `${styleText2(["gray", "bgWhite", "inverse"], ` ${e6.value} `)} ${n8}${e6.hint ? ` ${styleText2("dim", `(${e6.hint})`)}` : ""}`;
|
|
17802
|
+
};
|
|
17803
|
+
return new u6({
|
|
17804
|
+
options: t7.options,
|
|
17805
|
+
signal: t7.signal,
|
|
17806
|
+
input: t7.input,
|
|
17807
|
+
output: t7.output,
|
|
17808
|
+
initialValue: t7.initialValue,
|
|
17809
|
+
caseSensitive: t7.caseSensitive,
|
|
17764
17810
|
render() {
|
|
17765
|
-
const
|
|
17766
|
-
` : ""}${symbol2(this.state)} ${
|
|
17811
|
+
const e6 = t7.withGuide ?? settings.withGuide, a8 = `${e6 ? `${styleText2("gray", S_BAR)}
|
|
17812
|
+
` : ""}${symbol2(this.state)} ${t7.message}
|
|
17767
17813
|
`;
|
|
17768
17814
|
switch (this.state) {
|
|
17769
17815
|
case "submit": {
|
|
17770
|
-
const
|
|
17771
|
-
return `${
|
|
17816
|
+
const n8 = e6 ? `${styleText2("gray", S_BAR)} ` : "", s3 = this.options.find((u8) => u8.value === this.value) ?? t7.options[0], c5 = wrapTextWithPrefix(t7.output, l4(s3, "selected"), n8);
|
|
17817
|
+
return `${a8}${c5}`;
|
|
17772
17818
|
}
|
|
17773
17819
|
case "cancel": {
|
|
17774
|
-
const
|
|
17775
|
-
return `${
|
|
17820
|
+
const n8 = e6 ? `${styleText2("gray", S_BAR)} ` : "", s3 = wrapTextWithPrefix(t7.output, l4(this.options[0], "cancelled"), n8);
|
|
17821
|
+
return `${a8}${s3}${e6 ? `
|
|
17776
17822
|
${styleText2("gray", S_BAR)}` : ""}`;
|
|
17777
17823
|
}
|
|
17778
17824
|
default: {
|
|
17779
|
-
const
|
|
17825
|
+
const n8 = e6 ? `${styleText2("cyan", S_BAR)} ` : "", s3 = e6 ? styleText2("cyan", S_BAR_END) : "", c5 = this.options.map((u8, d5) => wrapTextWithPrefix(t7.output, l4(u8, d5 === this.cursor ? "active" : "inactive"), n8)).join(`
|
|
17780
17826
|
`);
|
|
17781
|
-
return `${
|
|
17827
|
+
return `${a8}${c5}
|
|
17782
17828
|
${s3}
|
|
17783
17829
|
`;
|
|
17784
17830
|
}
|
|
17785
17831
|
}
|
|
17786
17832
|
}
|
|
17787
17833
|
}).prompt();
|
|
17788
|
-
}, i8, stream, tasks = async (o6,
|
|
17789
|
-
for (const
|
|
17790
|
-
if (
|
|
17834
|
+
}, i8, stream, tasks = async (o6, e6) => {
|
|
17835
|
+
for (const t7 of o6) {
|
|
17836
|
+
if (t7.enabled === false)
|
|
17791
17837
|
continue;
|
|
17792
|
-
const s3 = spinner(
|
|
17793
|
-
s3.start(
|
|
17794
|
-
const
|
|
17795
|
-
s3.stop(
|
|
17838
|
+
const s3 = spinner(e6);
|
|
17839
|
+
s3.start(t7.title);
|
|
17840
|
+
const n8 = await t7.task(s3.message);
|
|
17841
|
+
s3.stop(n8 || t7.title);
|
|
17796
17842
|
}
|
|
17797
17843
|
}, A2 = (l4) => l4.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g, ""), taskLog = (l4) => {
|
|
17798
|
-
const
|
|
17799
|
-
|
|
17800
|
-
`),
|
|
17844
|
+
const r8 = l4.output ?? process.stdout, O2 = getColumns(r8), i9 = styleText2("gray", S_BAR), p6 = l4.spacing ?? 1, k2 = 3, m6 = l4.retainLog === true, d5 = !isCI() && isTTY(r8);
|
|
17845
|
+
r8.write(`${i9}
|
|
17846
|
+
`), r8.write(`${styleText2("green", S_STEP_SUBMIT)} ${l4.title}
|
|
17801
17847
|
`);
|
|
17802
|
-
for (let
|
|
17803
|
-
|
|
17848
|
+
for (let e6 = 0;e6 < p6; e6++)
|
|
17849
|
+
r8.write(`${i9}
|
|
17804
17850
|
`);
|
|
17805
|
-
const
|
|
17851
|
+
const n8 = [
|
|
17806
17852
|
{
|
|
17807
17853
|
value: "",
|
|
17808
17854
|
full: ""
|
|
17809
17855
|
}
|
|
17810
17856
|
];
|
|
17811
17857
|
let v3 = false;
|
|
17812
|
-
const f5 = (
|
|
17813
|
-
if (
|
|
17858
|
+
const f5 = (e6) => {
|
|
17859
|
+
if (n8.length === 0)
|
|
17814
17860
|
return;
|
|
17815
17861
|
let s3 = 0;
|
|
17816
|
-
|
|
17817
|
-
for (const
|
|
17818
|
-
const { value: o6, result:
|
|
17819
|
-
let g4 =
|
|
17862
|
+
e6 && (s3 += p6 + 2);
|
|
17863
|
+
for (const t7 of n8) {
|
|
17864
|
+
const { value: o6, result: a8 } = t7;
|
|
17865
|
+
let g4 = a8?.message ?? o6;
|
|
17820
17866
|
if (g4.length === 0)
|
|
17821
17867
|
continue;
|
|
17822
|
-
|
|
17823
|
-
${
|
|
17824
|
-
const
|
|
17868
|
+
a8 === undefined && t7.header !== undefined && t7.header !== "" && (g4 += `
|
|
17869
|
+
${t7.header}`);
|
|
17870
|
+
const E3 = g4.split(`
|
|
17825
17871
|
`).reduce((b5, w3) => w3 === "" ? b5 + 1 : b5 + Math.ceil((w3.length + k2) / O2), 0);
|
|
17826
|
-
s3 +=
|
|
17827
|
-
}
|
|
17828
|
-
s3 > 0 && (s3 += 1,
|
|
17829
|
-
}, h5 = (
|
|
17830
|
-
const o6 =
|
|
17831
|
-
${
|
|
17832
|
-
|
|
17833
|
-
`).map((
|
|
17834
|
-
output:
|
|
17872
|
+
s3 += E3;
|
|
17873
|
+
}
|
|
17874
|
+
s3 > 0 && (s3 += 1, r8.write(import_sisteransi2.erase.lines(s3)));
|
|
17875
|
+
}, h5 = (e6, s3, t7) => {
|
|
17876
|
+
const o6 = t7 ? `${e6.full}
|
|
17877
|
+
${e6.value}` : e6.value;
|
|
17878
|
+
e6.header !== undefined && e6.header !== "" && log.message(e6.header.split(`
|
|
17879
|
+
`).map((a8) => styleText2("bold", a8)), {
|
|
17880
|
+
output: r8,
|
|
17835
17881
|
secondarySymbol: i9,
|
|
17836
17882
|
symbol: i9,
|
|
17837
17883
|
spacing: 0
|
|
17838
17884
|
}), log.message(o6.split(`
|
|
17839
|
-
`).map((
|
|
17840
|
-
output:
|
|
17885
|
+
`).map((a8) => styleText2("dim", a8)), {
|
|
17886
|
+
output: r8,
|
|
17841
17887
|
secondarySymbol: i9,
|
|
17842
17888
|
symbol: i9,
|
|
17843
17889
|
spacing: s3 ?? p6
|
|
17844
17890
|
});
|
|
17845
17891
|
}, T5 = () => {
|
|
17846
|
-
for (const
|
|
17847
|
-
const { header: s3, value:
|
|
17848
|
-
(s3 === undefined || s3.length === 0) &&
|
|
17849
|
-
}
|
|
17850
|
-
}, L2 = (
|
|
17851
|
-
if (f5(false), (
|
|
17852
|
-
`),
|
|
17853
|
-
const o6 =
|
|
17854
|
-
`),
|
|
17855
|
-
if (
|
|
17856
|
-
const g4 = o6.splice(0,
|
|
17857
|
-
|
|
17892
|
+
for (const e6 of n8) {
|
|
17893
|
+
const { header: s3, value: t7, full: o6 } = e6;
|
|
17894
|
+
(s3 === undefined || s3.length === 0) && t7.length === 0 || h5(e6, undefined, m6 === true && o6.length > 0);
|
|
17895
|
+
}
|
|
17896
|
+
}, L2 = (e6, s3, t7) => {
|
|
17897
|
+
if (f5(false), (t7?.raw !== true || !v3) && e6.value !== "" && (e6.value += `
|
|
17898
|
+
`), e6.value += A2(s3), v3 = t7?.raw === true, l4.limit !== undefined) {
|
|
17899
|
+
const o6 = e6.value.split(`
|
|
17900
|
+
`), a8 = o6.length - l4.limit;
|
|
17901
|
+
if (a8 > 0) {
|
|
17902
|
+
const g4 = o6.splice(0, a8);
|
|
17903
|
+
m6 && (e6.full += (e6.full === "" ? "" : `
|
|
17858
17904
|
`) + g4.join(`
|
|
17859
17905
|
`));
|
|
17860
17906
|
}
|
|
17861
|
-
|
|
17907
|
+
e6.value = o6.join(`
|
|
17862
17908
|
`);
|
|
17863
17909
|
}
|
|
17864
17910
|
d5 && y3();
|
|
17865
17911
|
}, y3 = () => {
|
|
17866
|
-
for (const
|
|
17867
|
-
|
|
17868
|
-
}, B2 = (
|
|
17869
|
-
f5(false),
|
|
17912
|
+
for (const e6 of n8)
|
|
17913
|
+
e6.result ? e6.result.status === "error" ? log.error(e6.result.message, { output: r8, secondarySymbol: i9, spacing: 0 }) : log.success(e6.result.message, { output: r8, secondarySymbol: i9, spacing: 0 }) : e6.value !== "" && h5(e6, 0);
|
|
17914
|
+
}, B2 = (e6, s3) => {
|
|
17915
|
+
f5(false), e6.result = s3, d5 && y3();
|
|
17870
17916
|
};
|
|
17871
17917
|
return {
|
|
17872
|
-
message(
|
|
17873
|
-
L2(
|
|
17918
|
+
message(e6, s3) {
|
|
17919
|
+
L2(n8[0], e6, s3);
|
|
17874
17920
|
},
|
|
17875
|
-
group(
|
|
17921
|
+
group(e6) {
|
|
17876
17922
|
const s3 = {
|
|
17877
|
-
header:
|
|
17923
|
+
header: e6,
|
|
17878
17924
|
value: "",
|
|
17879
17925
|
full: ""
|
|
17880
17926
|
};
|
|
17881
|
-
return
|
|
17882
|
-
message(
|
|
17883
|
-
L2(s3,
|
|
17927
|
+
return n8.push(s3), {
|
|
17928
|
+
message(t7, o6) {
|
|
17929
|
+
L2(s3, t7, o6);
|
|
17884
17930
|
},
|
|
17885
|
-
error(
|
|
17931
|
+
error(t7) {
|
|
17886
17932
|
B2(s3, {
|
|
17887
17933
|
status: "error",
|
|
17888
|
-
message:
|
|
17934
|
+
message: t7
|
|
17889
17935
|
});
|
|
17890
17936
|
},
|
|
17891
|
-
success(
|
|
17937
|
+
success(t7) {
|
|
17892
17938
|
B2(s3, {
|
|
17893
17939
|
status: "success",
|
|
17894
|
-
message:
|
|
17940
|
+
message: t7
|
|
17895
17941
|
});
|
|
17896
17942
|
}
|
|
17897
17943
|
};
|
|
17898
17944
|
},
|
|
17899
|
-
error(
|
|
17900
|
-
f5(true), log.error(
|
|
17945
|
+
error(e6, s3) {
|
|
17946
|
+
f5(true), log.error(e6, { output: r8, secondarySymbol: i9, spacing: 1 }), s3?.showLog !== false && T5(), n8.splice(1, n8.length - 1), n8[0].value = "", n8[0].full = "";
|
|
17901
17947
|
},
|
|
17902
|
-
success(
|
|
17903
|
-
f5(true), log.success(
|
|
17904
|
-
}
|
|
17905
|
-
};
|
|
17906
|
-
}, text = (
|
|
17907
|
-
validate:
|
|
17908
|
-
placeholder:
|
|
17909
|
-
defaultValue:
|
|
17910
|
-
initialValue:
|
|
17911
|
-
output:
|
|
17912
|
-
signal:
|
|
17913
|
-
input:
|
|
17948
|
+
success(e6, s3) {
|
|
17949
|
+
f5(true), log.success(e6, { output: r8, secondarySymbol: i9, spacing: 1 }), s3?.showLog === true && T5(), n8.splice(1, n8.length - 1), n8[0].value = "", n8[0].full = "";
|
|
17950
|
+
}
|
|
17951
|
+
};
|
|
17952
|
+
}, text = (e6) => new n7({
|
|
17953
|
+
validate: e6.validate,
|
|
17954
|
+
placeholder: e6.placeholder,
|
|
17955
|
+
defaultValue: e6.defaultValue,
|
|
17956
|
+
initialValue: e6.initialValue,
|
|
17957
|
+
output: e6.output,
|
|
17958
|
+
signal: e6.signal,
|
|
17959
|
+
input: e6.input,
|
|
17914
17960
|
render() {
|
|
17915
|
-
const i9 =
|
|
17916
|
-
` : ""}${symbol2(this.state)} `}${
|
|
17917
|
-
`, c5 =
|
|
17961
|
+
const i9 = e6?.withGuide ?? settings.withGuide, s3 = `${`${i9 ? `${styleText2("gray", S_BAR)}
|
|
17962
|
+
` : ""}${symbol2(this.state)} `}${e6.message}
|
|
17963
|
+
`, c5 = e6.placeholder && e6.placeholder.length > 0 ? styleText2("inverse", e6.placeholder[0]) + styleText2("dim", e6.placeholder.slice(1)) : styleText2(["inverse", "hidden"], "_"), o6 = this.userInput ? this.userInputWithCursor : c5, l4 = this.value ?? "";
|
|
17918
17964
|
switch (this.state) {
|
|
17919
17965
|
case "error": {
|
|
17920
|
-
const
|
|
17966
|
+
const n8 = this.error ? ` ${styleText2("yellow", this.error)}` : "", r8 = i9 ? `${styleText2("yellow", S_BAR)} ` : "", d5 = i9 ? styleText2("yellow", S_BAR_END) : "";
|
|
17921
17967
|
return `${s3.trim()}
|
|
17922
|
-
${
|
|
17923
|
-
${d5}${
|
|
17968
|
+
${r8}${o6}
|
|
17969
|
+
${d5}${n8}
|
|
17924
17970
|
`;
|
|
17925
17971
|
}
|
|
17926
17972
|
case "submit": {
|
|
17927
|
-
const
|
|
17928
|
-
return `${s3}${
|
|
17973
|
+
const n8 = l4 ? ` ${styleText2("dim", l4)}` : "", r8 = i9 ? styleText2("gray", S_BAR) : "";
|
|
17974
|
+
return `${s3}${r8}${n8}`;
|
|
17929
17975
|
}
|
|
17930
17976
|
case "cancel": {
|
|
17931
|
-
const
|
|
17932
|
-
return `${s3}${
|
|
17933
|
-
${
|
|
17977
|
+
const n8 = l4 ? ` ${styleText2(["strikethrough", "dim"], l4)}` : "", r8 = i9 ? styleText2("gray", S_BAR) : "";
|
|
17978
|
+
return `${s3}${r8}${n8}${l4.trim() ? `
|
|
17979
|
+
${r8}` : ""}`;
|
|
17934
17980
|
}
|
|
17935
17981
|
default: {
|
|
17936
|
-
const
|
|
17937
|
-
return `${s3}${
|
|
17938
|
-
${
|
|
17982
|
+
const n8 = i9 ? `${styleText2("cyan", S_BAR)} ` : "", r8 = i9 ? styleText2("cyan", S_BAR_END) : "";
|
|
17983
|
+
return `${s3}${n8}${o6}
|
|
17984
|
+
${r8}
|
|
17939
17985
|
`;
|
|
17940
17986
|
}
|
|
17941
17987
|
}
|
|
@@ -17985,77 +18031,86 @@ var init_dist4 = __esm(() => {
|
|
|
17985
18031
|
month: "mm",
|
|
17986
18032
|
day: "dd"
|
|
17987
18033
|
};
|
|
18034
|
+
MULTISELECT_INSTRUCTIONS = [
|
|
18035
|
+
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
18036
|
+
`${styleText2("dim", "Space:")} select`,
|
|
18037
|
+
`${styleText2("dim", "Enter:")} confirm`
|
|
18038
|
+
];
|
|
17988
18039
|
log = {
|
|
17989
18040
|
message: (s3 = [], {
|
|
17990
|
-
symbol:
|
|
17991
|
-
secondarySymbol:
|
|
17992
|
-
output:
|
|
18041
|
+
symbol: e6 = styleText2("gray", S_BAR),
|
|
18042
|
+
secondarySymbol: r8 = styleText2("gray", S_BAR),
|
|
18043
|
+
output: m6 = process.stdout,
|
|
17993
18044
|
spacing: l4 = 1,
|
|
17994
18045
|
withGuide: c4
|
|
17995
18046
|
} = {}) => {
|
|
17996
|
-
const
|
|
18047
|
+
const t7 = [], o6 = c4 ?? settings.withGuide, f5 = o6 ? r8 : "", O2 = o6 ? `${e6} ` : "", u7 = o6 ? `${r8} ` : "";
|
|
17997
18048
|
for (let i8 = 0;i8 < l4; i8++)
|
|
17998
|
-
|
|
18049
|
+
t7.push(f5);
|
|
17999
18050
|
const g4 = Array.isArray(s3) ? s3 : s3.split(`
|
|
18000
18051
|
`);
|
|
18001
18052
|
if (g4.length > 0) {
|
|
18002
18053
|
const [i8, ...y3] = g4;
|
|
18003
|
-
i8.length > 0 ?
|
|
18054
|
+
i8.length > 0 ? t7.push(`${O2}${i8}`) : t7.push(o6 ? e6 : "");
|
|
18004
18055
|
for (const p6 of y3)
|
|
18005
|
-
p6.length > 0 ?
|
|
18056
|
+
p6.length > 0 ? t7.push(`${u7}${p6}`) : t7.push(o6 ? r8 : "");
|
|
18006
18057
|
}
|
|
18007
|
-
|
|
18058
|
+
m6.write(`${t7.join(`
|
|
18008
18059
|
`)}
|
|
18009
18060
|
`);
|
|
18010
18061
|
},
|
|
18011
|
-
info: (s3,
|
|
18012
|
-
log.message(s3, { ...
|
|
18062
|
+
info: (s3, e6) => {
|
|
18063
|
+
log.message(s3, { ...e6, symbol: styleText2("blue", S_INFO) });
|
|
18013
18064
|
},
|
|
18014
|
-
success: (s3,
|
|
18015
|
-
log.message(s3, { ...
|
|
18065
|
+
success: (s3, e6) => {
|
|
18066
|
+
log.message(s3, { ...e6, symbol: styleText2("green", S_SUCCESS) });
|
|
18016
18067
|
},
|
|
18017
|
-
step: (s3,
|
|
18018
|
-
log.message(s3, { ...
|
|
18068
|
+
step: (s3, e6) => {
|
|
18069
|
+
log.message(s3, { ...e6, symbol: styleText2("green", S_STEP_SUBMIT) });
|
|
18019
18070
|
},
|
|
18020
|
-
warn: (s3,
|
|
18021
|
-
log.message(s3, { ...
|
|
18071
|
+
warn: (s3, e6) => {
|
|
18072
|
+
log.message(s3, { ...e6, symbol: styleText2("yellow", S_WARN) });
|
|
18022
18073
|
},
|
|
18023
|
-
warning: (s3,
|
|
18024
|
-
log.warn(s3,
|
|
18074
|
+
warning: (s3, e6) => {
|
|
18075
|
+
log.warn(s3, e6);
|
|
18025
18076
|
},
|
|
18026
|
-
error: (s3,
|
|
18027
|
-
log.message(s3, { ...
|
|
18077
|
+
error: (s3, e6) => {
|
|
18078
|
+
log.message(s3, { ...e6, symbol: styleText2("red", S_ERROR) });
|
|
18028
18079
|
}
|
|
18029
18080
|
};
|
|
18030
|
-
|
|
18081
|
+
u7 = {
|
|
18031
18082
|
light: unicodeOr("\u2500", "-"),
|
|
18032
18083
|
heavy: unicodeOr("\u2501", "="),
|
|
18033
18084
|
block: unicodeOr("\u2588", "#")
|
|
18034
18085
|
};
|
|
18086
|
+
SELECT_INSTRUCTIONS = [
|
|
18087
|
+
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
18088
|
+
`${styleText2("dim", "Enter:")} confirm`
|
|
18089
|
+
];
|
|
18035
18090
|
i8 = `${styleText2("gray", S_BAR)} `;
|
|
18036
18091
|
stream = {
|
|
18037
|
-
message: async (
|
|
18092
|
+
message: async (e6, { symbol: l4 = styleText2("gray", S_BAR) } = {}) => {
|
|
18038
18093
|
process.stdout.write(`${styleText2("gray", S_BAR)}
|
|
18039
18094
|
${l4} `);
|
|
18040
18095
|
let s3 = 3;
|
|
18041
|
-
for await (let
|
|
18042
|
-
|
|
18043
|
-
${i8}`),
|
|
18044
|
-
`) && (s3 = 3 + stripVTControlCharacters(
|
|
18096
|
+
for await (let r8 of e6) {
|
|
18097
|
+
r8 = r8.replace(/\n/g, `
|
|
18098
|
+
${i8}`), r8.includes(`
|
|
18099
|
+
`) && (s3 = 3 + stripVTControlCharacters(r8.slice(r8.lastIndexOf(`
|
|
18045
18100
|
`))).length);
|
|
18046
|
-
const o6 = stripVTControlCharacters(
|
|
18047
|
-
s3 + o6 < process.stdout.columns ? (s3 += o6, process.stdout.write(
|
|
18048
|
-
${i8}${
|
|
18101
|
+
const o6 = stripVTControlCharacters(r8).length;
|
|
18102
|
+
s3 + o6 < process.stdout.columns ? (s3 += o6, process.stdout.write(r8)) : (process.stdout.write(`
|
|
18103
|
+
${i8}${r8.trimStart()}`), s3 = 3 + stripVTControlCharacters(r8.trimStart()).length);
|
|
18049
18104
|
}
|
|
18050
18105
|
process.stdout.write(`
|
|
18051
18106
|
`);
|
|
18052
18107
|
},
|
|
18053
|
-
info: (
|
|
18054
|
-
success: (
|
|
18055
|
-
step: (
|
|
18056
|
-
warn: (
|
|
18057
|
-
warning: (
|
|
18058
|
-
error: (
|
|
18108
|
+
info: (e6) => stream.message(e6, { symbol: styleText2("blue", S_INFO) }),
|
|
18109
|
+
success: (e6) => stream.message(e6, { symbol: styleText2("green", S_SUCCESS) }),
|
|
18110
|
+
step: (e6) => stream.message(e6, { symbol: styleText2("green", S_STEP_SUBMIT) }),
|
|
18111
|
+
warn: (e6) => stream.message(e6, { symbol: styleText2("yellow", S_WARN) }),
|
|
18112
|
+
warning: (e6) => stream.warn(e6),
|
|
18113
|
+
error: (e6) => stream.message(e6, { symbol: styleText2("red", S_ERROR) })
|
|
18059
18114
|
};
|
|
18060
18115
|
});
|
|
18061
18116
|
|
|
@@ -18069,7 +18124,7 @@ function collectExternalDeps(setup) {
|
|
|
18069
18124
|
const selected = new Set(setup.spec.targets);
|
|
18070
18125
|
const lspApplies = (lsp) => {
|
|
18071
18126
|
const lspTargets = lsp.targets ?? DEFAULT_LSP_TARGETS;
|
|
18072
|
-
return lspTargets.some((
|
|
18127
|
+
return lspTargets.some((t7) => selected.has(t7));
|
|
18073
18128
|
};
|
|
18074
18129
|
const seen = new Set;
|
|
18075
18130
|
const out = [];
|
|
@@ -18204,14 +18259,14 @@ function anyPathExists(dep, opts) {
|
|
|
18204
18259
|
return dep.checkPaths.some((p6) => existsSync10(expandPath(p6, opts.projectDir, home)));
|
|
18205
18260
|
}
|
|
18206
18261
|
function reportFailures(results) {
|
|
18207
|
-
const failed = results.filter((
|
|
18262
|
+
const failed = results.filter((r8) => r8.status === "failed");
|
|
18208
18263
|
if (failed.length === 0)
|
|
18209
18264
|
return;
|
|
18210
18265
|
console.log(pc.yellow(`
|
|
18211
|
-
${failed.length} external dependency install(s) failed: ` + failed.map((
|
|
18266
|
+
${failed.length} external dependency install(s) failed: ` + failed.map((r8) => r8.dep.label).join(", ") + ". The installed item(s) may not work until these are installed."));
|
|
18212
18267
|
}
|
|
18213
18268
|
function fmt(argv) {
|
|
18214
|
-
return argv.map((
|
|
18269
|
+
return argv.map((a8) => /\s/.test(a8) ? JSON.stringify(a8) : a8).join(" ");
|
|
18215
18270
|
}
|
|
18216
18271
|
function defaultSpawn(argv, cwd) {
|
|
18217
18272
|
const [command, ...args] = argv;
|
|
@@ -18312,10 +18367,10 @@ function ownershipKeys(items) {
|
|
|
18312
18367
|
files.add(lockPathKey(f5));
|
|
18313
18368
|
for (const b5 of i9.blocks ?? [])
|
|
18314
18369
|
blocks.add(`${lockPathKey(b5)}\x00${b5.marker}`);
|
|
18315
|
-
for (const
|
|
18316
|
-
json2.add(`${lockPathKey(
|
|
18317
|
-
for (const
|
|
18318
|
-
objects.add(`${lockPathKey(
|
|
18370
|
+
for (const e6 of i9.jsonEntries ?? [])
|
|
18371
|
+
json2.add(`${lockPathKey(e6)}\x00${e6.key}\x00${e6.value}`);
|
|
18372
|
+
for (const e6 of i9.objectEntries ?? [])
|
|
18373
|
+
objects.add(`${lockPathKey(e6)}\x00${e6.key}\x00${e6.subKey}`);
|
|
18319
18374
|
}
|
|
18320
18375
|
return { files, blocks, json: json2, objects };
|
|
18321
18376
|
}
|
|
@@ -18323,8 +18378,8 @@ function renderPrunePlan(items, projectDir, remaining = []) {
|
|
|
18323
18378
|
const keep = ownershipKeys(remaining);
|
|
18324
18379
|
const fileDeletes = items.flatMap((i9) => i9.files.filter((f5) => !keep.files.has(lockPathKey(f5))).map((f5) => resolveLockedPath(projectDir, f5)));
|
|
18325
18380
|
const blockStrips = items.flatMap((i9) => (i9.blocks ?? []).filter((b5) => !keep.blocks.has(`${lockPathKey(b5)}\x00${b5.marker}`)).map((b5) => ({ ...b5, path: resolveLockedPath(projectDir, b5) })));
|
|
18326
|
-
const jsonStrips = items.flatMap((i9) => (i9.jsonEntries ?? []).filter((
|
|
18327
|
-
const objectStrips = items.flatMap((i9) => (i9.objectEntries ?? []).filter((
|
|
18381
|
+
const jsonStrips = items.flatMap((i9) => (i9.jsonEntries ?? []).filter((e6) => !keep.json.has(`${lockPathKey(e6)}\x00${e6.key}\x00${e6.value}`)).map((e6) => ({ ...e6, path: resolveLockedPath(projectDir, e6) })));
|
|
18382
|
+
const objectStrips = items.flatMap((i9) => (i9.objectEntries ?? []).filter((e6) => !keep.objects.has(`${lockPathKey(e6)}\x00${e6.key}\x00${e6.subKey}`)).map((e6) => ({ ...e6, path: resolveLockedPath(projectDir, e6) })));
|
|
18328
18383
|
if (fileDeletes.length) {
|
|
18329
18384
|
console.log(pc2.bold("Files to delete:"));
|
|
18330
18385
|
for (const p6 of fileDeletes)
|
|
@@ -18338,14 +18393,14 @@ function renderPrunePlan(items, projectDir, remaining = []) {
|
|
|
18338
18393
|
}
|
|
18339
18394
|
if (jsonStrips.length) {
|
|
18340
18395
|
console.log(pc2.bold("Config entries to prune:"));
|
|
18341
|
-
for (const
|
|
18342
|
-
console.log(` ${pc2.magenta("unset")} ${
|
|
18396
|
+
for (const e6 of jsonStrips) {
|
|
18397
|
+
console.log(` ${pc2.magenta("unset")} ${e6.key}[]=${e6.value} in ${shorten(e6.path, projectDir)}`);
|
|
18343
18398
|
}
|
|
18344
18399
|
}
|
|
18345
18400
|
if (objectStrips.length) {
|
|
18346
18401
|
console.log(pc2.bold("Config entries to prune:"));
|
|
18347
|
-
for (const
|
|
18348
|
-
console.log(` ${pc2.magenta("unset")} ${
|
|
18402
|
+
for (const e6 of objectStrips) {
|
|
18403
|
+
console.log(` ${pc2.magenta("unset")} ${e6.key}.${e6.subKey} in ${shorten(e6.path, projectDir)}`);
|
|
18349
18404
|
}
|
|
18350
18405
|
}
|
|
18351
18406
|
}
|
|
@@ -18400,12 +18455,12 @@ function executePrune(items, projectDir, remaining = [], mutatedConfig) {
|
|
|
18400
18455
|
console.log(`${pc2.blue("updated".padEnd(10))} ${shorten(block2.path, projectDir)} (block stripped)`);
|
|
18401
18456
|
}
|
|
18402
18457
|
}
|
|
18403
|
-
const jsonEntries = items.flatMap((i9) => (i9.jsonEntries ?? []).filter((
|
|
18458
|
+
const jsonEntries = items.flatMap((i9) => (i9.jsonEntries ?? []).filter((e6) => !keep.json.has(`${lockPathKey(e6)}\x00${e6.key}\x00${e6.value}`)).map((e6) => ({ ...e6, path: resolveLockedPath(projectDir, e6) })));
|
|
18404
18459
|
const byPath = new Map;
|
|
18405
|
-
for (const
|
|
18406
|
-
const list = byPath.get(
|
|
18407
|
-
list.push(
|
|
18408
|
-
byPath.set(
|
|
18460
|
+
for (const e6 of jsonEntries) {
|
|
18461
|
+
const list = byPath.get(e6.path) ?? [];
|
|
18462
|
+
list.push(e6);
|
|
18463
|
+
byPath.set(e6.path, list);
|
|
18409
18464
|
}
|
|
18410
18465
|
for (const [path2, entries] of byPath) {
|
|
18411
18466
|
if (!existsSync11(path2))
|
|
@@ -18417,12 +18472,12 @@ function executePrune(items, projectDir, remaining = [], mutatedConfig) {
|
|
|
18417
18472
|
mutatedConfig?.add(relative6(projectDir, path2));
|
|
18418
18473
|
console.log(`${pc2.blue("updated".padEnd(10))} ${shorten(path2, projectDir)} (config entries pruned)`);
|
|
18419
18474
|
}
|
|
18420
|
-
const objectEntries = items.flatMap((i9) => (i9.objectEntries ?? []).filter((
|
|
18475
|
+
const objectEntries = items.flatMap((i9) => (i9.objectEntries ?? []).filter((e6) => !keep.objects.has(`${lockPathKey(e6)}\x00${e6.key}\x00${e6.subKey}`)).map((e6) => ({ ...e6, path: resolveLockedPath(projectDir, e6) })));
|
|
18421
18476
|
const objByPath = new Map;
|
|
18422
|
-
for (const
|
|
18423
|
-
const list = objByPath.get(
|
|
18424
|
-
list.push(
|
|
18425
|
-
objByPath.set(
|
|
18477
|
+
for (const e6 of objectEntries) {
|
|
18478
|
+
const list = objByPath.get(e6.path) ?? [];
|
|
18479
|
+
list.push(e6);
|
|
18480
|
+
objByPath.set(e6.path, list);
|
|
18426
18481
|
}
|
|
18427
18482
|
for (const [path2, entries] of objByPath) {
|
|
18428
18483
|
if (!existsSync11(path2))
|
|
@@ -18615,7 +18670,7 @@ function actionLabel(action) {
|
|
|
18615
18670
|
function renderPlans(plans, projectDir) {
|
|
18616
18671
|
const lines = [];
|
|
18617
18672
|
for (const plan of plans) {
|
|
18618
|
-
const visible = plan.actions.filter((
|
|
18673
|
+
const visible = plan.actions.filter((a8) => a8.kind !== "remove-block");
|
|
18619
18674
|
lines.push(pc2.bold(`${plan.target} (${visible.length} file action(s))`));
|
|
18620
18675
|
for (const action of plan.actions) {
|
|
18621
18676
|
if (action.kind === "remove-block")
|
|
@@ -18733,7 +18788,7 @@ async function confirmExecItems(items, choices) {
|
|
|
18733
18788
|
}
|
|
18734
18789
|
if (risky.length === 0)
|
|
18735
18790
|
return true;
|
|
18736
|
-
const count = risky.reduce((
|
|
18791
|
+
const count = risky.reduce((n8, r8) => n8 + r8.infos.length, 0);
|
|
18737
18792
|
console.log(pc2.yellow(`
|
|
18738
18793
|
The following item(s) run a local command from a non-builtin registry:`));
|
|
18739
18794
|
for (const { item, infos } of risky) {
|
|
@@ -18822,9 +18877,9 @@ function warnHollowFablePack(items, lockedAgentIds) {
|
|
|
18822
18877
|
function lockedAgentIds(lock) {
|
|
18823
18878
|
const out = [];
|
|
18824
18879
|
for (const item of lock.items) {
|
|
18825
|
-
const
|
|
18826
|
-
if (
|
|
18827
|
-
out.push(
|
|
18880
|
+
const m6 = /(?:^|\/)agent:([a-z0-9][a-z0-9-]*)$/.exec(item.ref);
|
|
18881
|
+
if (m6)
|
|
18882
|
+
out.push(m6[1]);
|
|
18828
18883
|
}
|
|
18829
18884
|
return out;
|
|
18830
18885
|
}
|
|
@@ -18850,10 +18905,10 @@ async function registryDefaultModels(sources) {
|
|
|
18850
18905
|
async function installedPresetModels(sources, lock) {
|
|
18851
18906
|
const out = {};
|
|
18852
18907
|
for (const item of lock.items) {
|
|
18853
|
-
const
|
|
18854
|
-
if (!
|
|
18908
|
+
const m6 = PRESET_REF.exec(item.ref);
|
|
18909
|
+
if (!m6)
|
|
18855
18910
|
continue;
|
|
18856
|
-
const name =
|
|
18911
|
+
const name = m6[1];
|
|
18857
18912
|
try {
|
|
18858
18913
|
const manifest = await sources.loadManifest("preset", name);
|
|
18859
18914
|
const models = manifest.meta?.models;
|
|
@@ -18916,140 +18971,128 @@ import { dirname as dirname3 } from "path";
|
|
|
18916
18971
|
|
|
18917
18972
|
// src/core/configfile.ts
|
|
18918
18973
|
import { pathToFileURL } from "url";
|
|
18919
|
-
|
|
18920
|
-
// node_modules/confbox/dist/_chunks/_format.mjs
|
|
18921
|
-
var t = Symbol.for(`__confbox_fmt__`);
|
|
18922
|
-
var n = /^(\s+)/;
|
|
18923
|
-
var r = /(\s+)$/;
|
|
18924
|
-
function i(e, t2 = {}) {
|
|
18925
|
-
return { sample: t2.indent === undefined && t2.preserveIndentation !== false && e.slice(0, t2?.sampleSize || 1024), whiteSpace: t2.preserveWhitespace === false ? undefined : { start: n.exec(e)?.[0] || ``, end: r.exec(e)?.[0] || `` } };
|
|
18926
|
-
}
|
|
18927
|
-
function a(e, n2, r2) {
|
|
18928
|
-
!n2 || typeof n2 != `object` || Object.defineProperty(n2, t, { enumerable: false, configurable: true, writable: true, value: i(e, r2) });
|
|
18929
|
-
}
|
|
18930
|
-
|
|
18931
18974
|
// node_modules/confbox/dist/_chunks/libs/jsonc-parser.mjs
|
|
18932
|
-
function e(e2,
|
|
18933
|
-
let
|
|
18934
|
-
function h(
|
|
18935
|
-
let
|
|
18936
|
-
for (;
|
|
18937
|
-
let
|
|
18938
|
-
if (
|
|
18939
|
-
|
|
18940
|
-
else if (
|
|
18941
|
-
|
|
18942
|
-
else if (
|
|
18943
|
-
|
|
18975
|
+
function e(e2, i = false) {
|
|
18976
|
+
let a = e2.length, o = 0, s = ``, c = 0, l = 16, u = 0, d = 0, f = 0, p = 0, m = 0;
|
|
18977
|
+
function h(t, n) {
|
|
18978
|
+
let r = 0, i2 = 0;
|
|
18979
|
+
for (;r < t || !n; ) {
|
|
18980
|
+
let t2 = e2.charCodeAt(o);
|
|
18981
|
+
if (t2 >= 48 && t2 <= 57)
|
|
18982
|
+
i2 = i2 * 16 + t2 - 48;
|
|
18983
|
+
else if (t2 >= 65 && t2 <= 70)
|
|
18984
|
+
i2 = i2 * 16 + t2 - 65 + 10;
|
|
18985
|
+
else if (t2 >= 97 && t2 <= 102)
|
|
18986
|
+
i2 = i2 * 16 + t2 - 97 + 10;
|
|
18944
18987
|
else
|
|
18945
18988
|
break;
|
|
18946
|
-
o++,
|
|
18989
|
+
o++, r++;
|
|
18947
18990
|
}
|
|
18948
|
-
return
|
|
18991
|
+
return r < t && (i2 = -1), i2;
|
|
18949
18992
|
}
|
|
18950
18993
|
function g(e3) {
|
|
18951
18994
|
o = e3, s = ``, c = 0, l = 16, m = 0;
|
|
18952
18995
|
}
|
|
18953
18996
|
function _() {
|
|
18954
|
-
let
|
|
18997
|
+
let t = o;
|
|
18955
18998
|
if (e2.charCodeAt(o) === 48)
|
|
18956
18999
|
o++;
|
|
18957
19000
|
else
|
|
18958
|
-
for (o++;o < e2.length &&
|
|
19001
|
+
for (o++;o < e2.length && r(e2.charCodeAt(o)); )
|
|
18959
19002
|
o++;
|
|
18960
19003
|
if (o < e2.length && e2.charCodeAt(o) === 46)
|
|
18961
|
-
if (o++, o < e2.length &&
|
|
18962
|
-
for (o++;o < e2.length &&
|
|
19004
|
+
if (o++, o < e2.length && r(e2.charCodeAt(o)))
|
|
19005
|
+
for (o++;o < e2.length && r(e2.charCodeAt(o)); )
|
|
18963
19006
|
o++;
|
|
18964
19007
|
else
|
|
18965
|
-
return m = 3, e2.substring(
|
|
18966
|
-
let
|
|
19008
|
+
return m = 3, e2.substring(t, o);
|
|
19009
|
+
let n = o;
|
|
18967
19010
|
if (o < e2.length && (e2.charCodeAt(o) === 69 || e2.charCodeAt(o) === 101))
|
|
18968
|
-
if (o++, (o < e2.length && e2.charCodeAt(o) === 43 || e2.charCodeAt(o) === 45) && o++, o < e2.length &&
|
|
18969
|
-
for (o++;o < e2.length &&
|
|
19011
|
+
if (o++, (o < e2.length && e2.charCodeAt(o) === 43 || e2.charCodeAt(o) === 45) && o++, o < e2.length && r(e2.charCodeAt(o))) {
|
|
19012
|
+
for (o++;o < e2.length && r(e2.charCodeAt(o)); )
|
|
18970
19013
|
o++;
|
|
18971
|
-
|
|
19014
|
+
n = o;
|
|
18972
19015
|
} else
|
|
18973
19016
|
m = 3;
|
|
18974
|
-
return e2.substring(
|
|
19017
|
+
return e2.substring(t, n);
|
|
18975
19018
|
}
|
|
18976
19019
|
function v() {
|
|
18977
|
-
let
|
|
19020
|
+
let t = ``, r = o;
|
|
18978
19021
|
for (;; ) {
|
|
18979
|
-
if (o >=
|
|
18980
|
-
|
|
19022
|
+
if (o >= a) {
|
|
19023
|
+
t += e2.substring(r, o), m = 2;
|
|
18981
19024
|
break;
|
|
18982
19025
|
}
|
|
18983
|
-
let
|
|
18984
|
-
if (
|
|
18985
|
-
|
|
19026
|
+
let i2 = e2.charCodeAt(o);
|
|
19027
|
+
if (i2 === 34) {
|
|
19028
|
+
t += e2.substring(r, o), o++;
|
|
18986
19029
|
break;
|
|
18987
19030
|
}
|
|
18988
|
-
if (
|
|
18989
|
-
if (
|
|
19031
|
+
if (i2 === 92) {
|
|
19032
|
+
if (t += e2.substring(r, o), o++, o >= a) {
|
|
18990
19033
|
m = 2;
|
|
18991
19034
|
break;
|
|
18992
19035
|
}
|
|
18993
19036
|
switch (e2.charCodeAt(o++)) {
|
|
18994
19037
|
case 34:
|
|
18995
|
-
|
|
19038
|
+
t += `"`;
|
|
18996
19039
|
break;
|
|
18997
19040
|
case 92:
|
|
18998
|
-
|
|
19041
|
+
t += `\\`;
|
|
18999
19042
|
break;
|
|
19000
19043
|
case 47:
|
|
19001
|
-
|
|
19044
|
+
t += `/`;
|
|
19002
19045
|
break;
|
|
19003
19046
|
case 98:
|
|
19004
|
-
|
|
19047
|
+
t += `\b`;
|
|
19005
19048
|
break;
|
|
19006
19049
|
case 102:
|
|
19007
|
-
|
|
19050
|
+
t += `\f`;
|
|
19008
19051
|
break;
|
|
19009
19052
|
case 110:
|
|
19010
|
-
|
|
19053
|
+
t += `
|
|
19011
19054
|
`;
|
|
19012
19055
|
break;
|
|
19013
19056
|
case 114:
|
|
19014
|
-
|
|
19057
|
+
t += `\r`;
|
|
19015
19058
|
break;
|
|
19016
19059
|
case 116:
|
|
19017
|
-
|
|
19060
|
+
t += ` `;
|
|
19018
19061
|
break;
|
|
19019
19062
|
case 117:
|
|
19020
19063
|
let e3 = h(4, true);
|
|
19021
|
-
e3 >= 0 ?
|
|
19064
|
+
e3 >= 0 ? t += String.fromCharCode(e3) : m = 4;
|
|
19022
19065
|
break;
|
|
19023
19066
|
default:
|
|
19024
19067
|
m = 5;
|
|
19025
19068
|
}
|
|
19026
|
-
|
|
19069
|
+
r = o;
|
|
19027
19070
|
continue;
|
|
19028
19071
|
}
|
|
19029
|
-
if (
|
|
19030
|
-
if (
|
|
19031
|
-
|
|
19072
|
+
if (i2 >= 0 && i2 <= 31)
|
|
19073
|
+
if (n(i2)) {
|
|
19074
|
+
t += e2.substring(r, o), m = 2;
|
|
19032
19075
|
break;
|
|
19033
19076
|
} else
|
|
19034
19077
|
m = 6;
|
|
19035
19078
|
o++;
|
|
19036
19079
|
}
|
|
19037
|
-
return
|
|
19080
|
+
return t;
|
|
19038
19081
|
}
|
|
19039
19082
|
function y() {
|
|
19040
|
-
if (s = ``, m = 0, c = o, d = u, p = f, o >=
|
|
19041
|
-
return c =
|
|
19042
|
-
let
|
|
19043
|
-
if (
|
|
19083
|
+
if (s = ``, m = 0, c = o, d = u, p = f, o >= a)
|
|
19084
|
+
return c = a, l = 17;
|
|
19085
|
+
let i2 = e2.charCodeAt(o);
|
|
19086
|
+
if (t(i2)) {
|
|
19044
19087
|
do
|
|
19045
|
-
o++, s += String.fromCharCode(
|
|
19046
|
-
while (
|
|
19088
|
+
o++, s += String.fromCharCode(i2), i2 = e2.charCodeAt(o);
|
|
19089
|
+
while (t(i2));
|
|
19047
19090
|
return l = 15;
|
|
19048
19091
|
}
|
|
19049
|
-
if (
|
|
19050
|
-
return o++, s += String.fromCharCode(
|
|
19092
|
+
if (n(i2))
|
|
19093
|
+
return o++, s += String.fromCharCode(i2), i2 === 13 && e2.charCodeAt(o) === 10 && (o++, s += `
|
|
19051
19094
|
`), u++, f = o, l = 14;
|
|
19052
|
-
switch (
|
|
19095
|
+
switch (i2) {
|
|
19053
19096
|
case 123:
|
|
19054
19097
|
return o++, l = 1;
|
|
19055
19098
|
case 125:
|
|
@@ -19065,28 +19108,28 @@ function e(e2, i2 = false) {
|
|
|
19065
19108
|
case 34:
|
|
19066
19109
|
return o++, s = v(), l = 10;
|
|
19067
19110
|
case 47:
|
|
19068
|
-
let
|
|
19111
|
+
let t = o - 1;
|
|
19069
19112
|
if (e2.charCodeAt(o + 1) === 47) {
|
|
19070
|
-
for (o += 2;o <
|
|
19113
|
+
for (o += 2;o < a && !n(e2.charCodeAt(o)); )
|
|
19071
19114
|
o++;
|
|
19072
|
-
return s = e2.substring(
|
|
19115
|
+
return s = e2.substring(t, o), l = 12;
|
|
19073
19116
|
}
|
|
19074
19117
|
if (e2.charCodeAt(o + 1) === 42) {
|
|
19075
19118
|
o += 2;
|
|
19076
|
-
let
|
|
19077
|
-
for (;o <
|
|
19078
|
-
let
|
|
19079
|
-
if (
|
|
19080
|
-
o += 2,
|
|
19119
|
+
let r = a - 1, i3 = false;
|
|
19120
|
+
for (;o < r; ) {
|
|
19121
|
+
let t2 = e2.charCodeAt(o);
|
|
19122
|
+
if (t2 === 42 && e2.charCodeAt(o + 1) === 47) {
|
|
19123
|
+
o += 2, i3 = true;
|
|
19081
19124
|
break;
|
|
19082
19125
|
}
|
|
19083
|
-
o++,
|
|
19126
|
+
o++, n(t2) && (t2 === 13 && e2.charCodeAt(o) === 10 && o++, u++, f = o);
|
|
19084
19127
|
}
|
|
19085
|
-
return
|
|
19128
|
+
return i3 || (o++, m = 1), s = e2.substring(t, o), l = 13;
|
|
19086
19129
|
}
|
|
19087
|
-
return s += String.fromCharCode(
|
|
19130
|
+
return s += String.fromCharCode(i2), o++, l = 16;
|
|
19088
19131
|
case 45:
|
|
19089
|
-
if (s += String.fromCharCode(
|
|
19132
|
+
if (s += String.fromCharCode(i2), o++, o === a || !r(e2.charCodeAt(o)))
|
|
19090
19133
|
return l = 16;
|
|
19091
19134
|
case 48:
|
|
19092
19135
|
case 49:
|
|
@@ -19100,8 +19143,8 @@ function e(e2, i2 = false) {
|
|
|
19100
19143
|
case 57:
|
|
19101
19144
|
return s += _(), l = 11;
|
|
19102
19145
|
default:
|
|
19103
|
-
for (;o <
|
|
19104
|
-
o++,
|
|
19146
|
+
for (;o < a && b(i2); )
|
|
19147
|
+
o++, i2 = e2.charCodeAt(o);
|
|
19105
19148
|
if (c !== o) {
|
|
19106
19149
|
switch (s = e2.substring(c, o), s) {
|
|
19107
19150
|
case `true`:
|
|
@@ -19113,11 +19156,11 @@ function e(e2, i2 = false) {
|
|
|
19113
19156
|
}
|
|
19114
19157
|
return l = 16;
|
|
19115
19158
|
}
|
|
19116
|
-
return s += String.fromCharCode(
|
|
19159
|
+
return s += String.fromCharCode(i2), o++, l = 16;
|
|
19117
19160
|
}
|
|
19118
19161
|
}
|
|
19119
19162
|
function b(e3) {
|
|
19120
|
-
if (
|
|
19163
|
+
if (t(e3) || n(e3))
|
|
19121
19164
|
return false;
|
|
19122
19165
|
switch (e3) {
|
|
19123
19166
|
case 125:
|
|
@@ -19139,76 +19182,76 @@ function e(e2, i2 = false) {
|
|
|
19139
19182
|
while (e3 >= 12 && e3 <= 15);
|
|
19140
19183
|
return e3;
|
|
19141
19184
|
}
|
|
19142
|
-
return { setPosition: g, getPosition: () => o, scan:
|
|
19185
|
+
return { setPosition: g, getPosition: () => o, scan: i ? x : y, getToken: () => l, getTokenValue: () => s, getTokenOffset: () => c, getTokenLength: () => o - c, getTokenStartLine: () => d, getTokenStartCharacter: () => c - p, getTokenError: () => m };
|
|
19143
19186
|
}
|
|
19144
|
-
function
|
|
19187
|
+
function t(e2) {
|
|
19145
19188
|
return e2 === 32 || e2 === 9;
|
|
19146
19189
|
}
|
|
19147
|
-
function
|
|
19190
|
+
function n(e2) {
|
|
19148
19191
|
return e2 === 10 || e2 === 13;
|
|
19149
19192
|
}
|
|
19150
|
-
function
|
|
19193
|
+
function r(e2) {
|
|
19151
19194
|
return e2 >= 48 && e2 <= 57;
|
|
19152
19195
|
}
|
|
19153
|
-
var
|
|
19196
|
+
var i;
|
|
19154
19197
|
(function(e2) {
|
|
19155
19198
|
e2[e2.lineFeed = 10] = `lineFeed`, e2[e2.carriageReturn = 13] = `carriageReturn`, e2[e2.space = 32] = `space`, e2[e2._0 = 48] = `_0`, e2[e2._1 = 49] = `_1`, e2[e2._2 = 50] = `_2`, e2[e2._3 = 51] = `_3`, e2[e2._4 = 52] = `_4`, e2[e2._5 = 53] = `_5`, e2[e2._6 = 54] = `_6`, e2[e2._7 = 55] = `_7`, e2[e2._8 = 56] = `_8`, e2[e2._9 = 57] = `_9`, e2[e2.a = 97] = `a`, e2[e2.b = 98] = `b`, e2[e2.c = 99] = `c`, e2[e2.d = 100] = `d`, e2[e2.e = 101] = `e`, e2[e2.f = 102] = `f`, e2[e2.g = 103] = `g`, e2[e2.h = 104] = `h`, e2[e2.i = 105] = `i`, e2[e2.j = 106] = `j`, e2[e2.k = 107] = `k`, e2[e2.l = 108] = `l`, e2[e2.m = 109] = `m`, e2[e2.n = 110] = `n`, e2[e2.o = 111] = `o`, e2[e2.p = 112] = `p`, e2[e2.q = 113] = `q`, e2[e2.r = 114] = `r`, e2[e2.s = 115] = `s`, e2[e2.t = 116] = `t`, e2[e2.u = 117] = `u`, e2[e2.v = 118] = `v`, e2[e2.w = 119] = `w`, e2[e2.x = 120] = `x`, e2[e2.y = 121] = `y`, e2[e2.z = 122] = `z`, e2[e2.A = 65] = `A`, e2[e2.B = 66] = `B`, e2[e2.C = 67] = `C`, e2[e2.D = 68] = `D`, e2[e2.E = 69] = `E`, e2[e2.F = 70] = `F`, e2[e2.G = 71] = `G`, e2[e2.H = 72] = `H`, e2[e2.I = 73] = `I`, e2[e2.J = 74] = `J`, e2[e2.K = 75] = `K`, e2[e2.L = 76] = `L`, e2[e2.M = 77] = `M`, e2[e2.N = 78] = `N`, e2[e2.O = 79] = `O`, e2[e2.P = 80] = `P`, e2[e2.Q = 81] = `Q`, e2[e2.R = 82] = `R`, e2[e2.S = 83] = `S`, e2[e2.T = 84] = `T`, e2[e2.U = 85] = `U`, e2[e2.V = 86] = `V`, e2[e2.W = 87] = `W`, e2[e2.X = 88] = `X`, e2[e2.Y = 89] = `Y`, e2[e2.Z = 90] = `Z`, e2[e2.asterisk = 42] = `asterisk`, e2[e2.backslash = 92] = `backslash`, e2[e2.closeBrace = 125] = `closeBrace`, e2[e2.closeBracket = 93] = `closeBracket`, e2[e2.colon = 58] = `colon`, e2[e2.comma = 44] = `comma`, e2[e2.dot = 46] = `dot`, e2[e2.doubleQuote = 34] = `doubleQuote`, e2[e2.minus = 45] = `minus`, e2[e2.openBrace = 123] = `openBrace`, e2[e2.openBracket = 91] = `openBracket`, e2[e2.plus = 43] = `plus`, e2[e2.slash = 47] = `slash`, e2[e2.formFeed = 12] = `formFeed`, e2[e2.tab = 9] = `tab`;
|
|
19156
|
-
})(
|
|
19157
|
-
` + ` `.repeat(
|
|
19158
|
-
` + ` `.repeat(
|
|
19159
|
-
` + ` `.repeat(
|
|
19160
|
-
` + ` `.repeat(
|
|
19161
|
-
var
|
|
19199
|
+
})(i ||= {}), Array(20).fill(0).map((e2, t2) => ` `.repeat(t2)), Array(200).fill(0).map((e2, t2) => `
|
|
19200
|
+
` + ` `.repeat(t2)), Array(200).fill(0).map((e2, t2) => `\r` + ` `.repeat(t2)), Array(200).fill(0).map((e2, t2) => `\r
|
|
19201
|
+
` + ` `.repeat(t2)), Array(200).fill(0).map((e2, t2) => `
|
|
19202
|
+
` + ` `.repeat(t2)), Array(200).fill(0).map((e2, t2) => `\r` + ` `.repeat(t2)), Array(200).fill(0).map((e2, t2) => `\r
|
|
19203
|
+
` + ` `.repeat(t2));
|
|
19204
|
+
var a;
|
|
19162
19205
|
(function(e2) {
|
|
19163
19206
|
e2.DEFAULT = { allowTrailingComma: false };
|
|
19164
|
-
})(
|
|
19165
|
-
function o(e2,
|
|
19166
|
-
let
|
|
19207
|
+
})(a ||= {});
|
|
19208
|
+
function o(e2, t2 = [], n2 = a.DEFAULT) {
|
|
19209
|
+
let r2 = null, i2 = [], o2 = [];
|
|
19167
19210
|
function s(e3) {
|
|
19168
|
-
Array.isArray(
|
|
19211
|
+
Array.isArray(i2) ? i2.push(e3) : r2 !== null && (i2[r2] = e3);
|
|
19169
19212
|
}
|
|
19170
19213
|
return d(e2, { onObjectBegin: () => {
|
|
19171
19214
|
let e3 = {};
|
|
19172
|
-
s(e3), o2.push(
|
|
19215
|
+
s(e3), o2.push(i2), i2 = e3, r2 = null;
|
|
19173
19216
|
}, onObjectProperty: (e3) => {
|
|
19174
|
-
|
|
19217
|
+
r2 = e3;
|
|
19175
19218
|
}, onObjectEnd: () => {
|
|
19176
|
-
|
|
19219
|
+
i2 = o2.pop();
|
|
19177
19220
|
}, onArrayBegin: () => {
|
|
19178
19221
|
let e3 = [];
|
|
19179
|
-
s(e3), o2.push(
|
|
19222
|
+
s(e3), o2.push(i2), i2 = e3, r2 = null;
|
|
19180
19223
|
}, onArrayEnd: () => {
|
|
19181
|
-
|
|
19182
|
-
}, onLiteralValue: s, onError: (e3,
|
|
19183
|
-
|
|
19184
|
-
} },
|
|
19224
|
+
i2 = o2.pop();
|
|
19225
|
+
}, onLiteralValue: s, onError: (e3, n3, r3) => {
|
|
19226
|
+
t2.push({ error: e3, offset: n3, length: r3 });
|
|
19227
|
+
} }, n2), i2[0];
|
|
19185
19228
|
}
|
|
19186
|
-
function d(
|
|
19187
|
-
let
|
|
19229
|
+
function d(t2, n2, r2 = a.DEFAULT) {
|
|
19230
|
+
let i2 = e(t2, false), o2 = [], s = 0;
|
|
19188
19231
|
function c(e2) {
|
|
19189
|
-
return e2 ? () => s === 0 && e2(
|
|
19232
|
+
return e2 ? () => s === 0 && e2(i2.getTokenOffset(), i2.getTokenLength(), i2.getTokenStartLine(), i2.getTokenStartCharacter()) : () => true;
|
|
19190
19233
|
}
|
|
19191
19234
|
function l(e2) {
|
|
19192
|
-
return e2 ? (
|
|
19235
|
+
return e2 ? (t3) => s === 0 && e2(t3, i2.getTokenOffset(), i2.getTokenLength(), i2.getTokenStartLine(), i2.getTokenStartCharacter()) : () => true;
|
|
19193
19236
|
}
|
|
19194
19237
|
function u(e2) {
|
|
19195
|
-
return e2 ? (
|
|
19238
|
+
return e2 ? (t3) => s === 0 && e2(t3, i2.getTokenOffset(), i2.getTokenLength(), i2.getTokenStartLine(), i2.getTokenStartCharacter(), () => o2.slice()) : () => true;
|
|
19196
19239
|
}
|
|
19197
19240
|
function d2(e2) {
|
|
19198
19241
|
return e2 ? () => {
|
|
19199
|
-
s > 0 ? s++ : e2(
|
|
19242
|
+
s > 0 ? s++ : e2(i2.getTokenOffset(), i2.getTokenLength(), i2.getTokenStartLine(), i2.getTokenStartCharacter(), () => o2.slice()) === false && (s = 1);
|
|
19200
19243
|
} : () => true;
|
|
19201
19244
|
}
|
|
19202
19245
|
function f(e2) {
|
|
19203
19246
|
return e2 ? () => {
|
|
19204
|
-
s > 0 && s--, s === 0 && e2(
|
|
19247
|
+
s > 0 && s--, s === 0 && e2(i2.getTokenOffset(), i2.getTokenLength(), i2.getTokenStartLine(), i2.getTokenStartCharacter());
|
|
19205
19248
|
} : () => true;
|
|
19206
19249
|
}
|
|
19207
|
-
let p = d2(
|
|
19250
|
+
let p = d2(n2.onObjectBegin), m = u(n2.onObjectProperty), h = f(n2.onObjectEnd), g = d2(n2.onArrayBegin), _ = f(n2.onArrayEnd), v = u(n2.onLiteralValue), y = l(n2.onSeparator), b = c(n2.onComment), x = l(n2.onError), S = r2 && r2.disallowComments, C = r2 && r2.allowTrailingComma;
|
|
19208
19251
|
function w() {
|
|
19209
19252
|
for (;; ) {
|
|
19210
|
-
let e2 =
|
|
19211
|
-
switch (
|
|
19253
|
+
let e2 = i2.scan();
|
|
19254
|
+
switch (i2.getTokenError()) {
|
|
19212
19255
|
case 4:
|
|
19213
19256
|
T(14);
|
|
19214
19257
|
break;
|
|
@@ -19244,28 +19287,28 @@ function d(t3, n3, r3 = a2.DEFAULT) {
|
|
|
19244
19287
|
}
|
|
19245
19288
|
}
|
|
19246
19289
|
}
|
|
19247
|
-
function T(e2,
|
|
19248
|
-
if (x(e2),
|
|
19249
|
-
let e3 =
|
|
19290
|
+
function T(e2, t3 = [], n3 = []) {
|
|
19291
|
+
if (x(e2), t3.length + n3.length > 0) {
|
|
19292
|
+
let e3 = i2.getToken();
|
|
19250
19293
|
for (;e3 !== 17; ) {
|
|
19251
|
-
if (
|
|
19294
|
+
if (t3.indexOf(e3) !== -1) {
|
|
19252
19295
|
w();
|
|
19253
19296
|
break;
|
|
19254
|
-
} else if (
|
|
19297
|
+
} else if (n3.indexOf(e3) !== -1)
|
|
19255
19298
|
break;
|
|
19256
19299
|
e3 = w();
|
|
19257
19300
|
}
|
|
19258
19301
|
}
|
|
19259
19302
|
}
|
|
19260
19303
|
function E(e2) {
|
|
19261
|
-
let
|
|
19262
|
-
return e2 ? v(
|
|
19304
|
+
let t3 = i2.getTokenValue();
|
|
19305
|
+
return e2 ? v(t3) : (m(t3), o2.push(t3)), w(), true;
|
|
19263
19306
|
}
|
|
19264
19307
|
function D() {
|
|
19265
|
-
switch (
|
|
19308
|
+
switch (i2.getToken()) {
|
|
19266
19309
|
case 11:
|
|
19267
|
-
let e2 =
|
|
19268
|
-
isNaN(
|
|
19310
|
+
let e2 = i2.getTokenValue(), t3 = Number(e2);
|
|
19311
|
+
isNaN(t3) && (T(2), t3 = 0), v(t3);
|
|
19269
19312
|
break;
|
|
19270
19313
|
case 7:
|
|
19271
19314
|
v(null);
|
|
@@ -19282,36 +19325,36 @@ function d(t3, n3, r3 = a2.DEFAULT) {
|
|
|
19282
19325
|
return w(), true;
|
|
19283
19326
|
}
|
|
19284
19327
|
function O() {
|
|
19285
|
-
return
|
|
19328
|
+
return i2.getToken() === 10 ? (E(false), i2.getToken() === 6 ? (y(`:`), w(), j() || T(4, [], [2, 5])) : T(5, [], [2, 5]), o2.pop(), true) : (T(3, [], [2, 5]), false);
|
|
19286
19329
|
}
|
|
19287
19330
|
function k() {
|
|
19288
19331
|
p(), w();
|
|
19289
19332
|
let e2 = false;
|
|
19290
|
-
for (;
|
|
19291
|
-
if (
|
|
19292
|
-
if (e2 || T(4, [], []), y(`,`), w(),
|
|
19333
|
+
for (;i2.getToken() !== 2 && i2.getToken() !== 17; ) {
|
|
19334
|
+
if (i2.getToken() === 5) {
|
|
19335
|
+
if (e2 || T(4, [], []), y(`,`), w(), i2.getToken() === 2 && C)
|
|
19293
19336
|
break;
|
|
19294
19337
|
} else
|
|
19295
19338
|
e2 && T(6, [], []);
|
|
19296
19339
|
O() || T(4, [], [2, 5]), e2 = true;
|
|
19297
19340
|
}
|
|
19298
|
-
return h(),
|
|
19341
|
+
return h(), i2.getToken() === 2 ? w() : T(7, [2], []), true;
|
|
19299
19342
|
}
|
|
19300
19343
|
function A() {
|
|
19301
19344
|
g(), w();
|
|
19302
|
-
let e2 = true,
|
|
19303
|
-
for (;
|
|
19304
|
-
if (
|
|
19305
|
-
if (
|
|
19345
|
+
let e2 = true, t3 = false;
|
|
19346
|
+
for (;i2.getToken() !== 4 && i2.getToken() !== 17; ) {
|
|
19347
|
+
if (i2.getToken() === 5) {
|
|
19348
|
+
if (t3 || T(4, [], []), y(`,`), w(), i2.getToken() === 4 && C)
|
|
19306
19349
|
break;
|
|
19307
19350
|
} else
|
|
19308
|
-
|
|
19309
|
-
e2 ? (o2.push(0), e2 = false) : o2[o2.length - 1]++, j() || T(4, [], [4, 5]),
|
|
19351
|
+
t3 && T(6, [], []);
|
|
19352
|
+
e2 ? (o2.push(0), e2 = false) : o2[o2.length - 1]++, j() || T(4, [], [4, 5]), t3 = true;
|
|
19310
19353
|
}
|
|
19311
|
-
return _(), e2 || o2.pop(),
|
|
19354
|
+
return _(), e2 || o2.pop(), i2.getToken() === 4 ? w() : T(8, [4], []), true;
|
|
19312
19355
|
}
|
|
19313
19356
|
function j() {
|
|
19314
|
-
switch (
|
|
19357
|
+
switch (i2.getToken()) {
|
|
19315
19358
|
case 3:
|
|
19316
19359
|
return A();
|
|
19317
19360
|
case 1:
|
|
@@ -19322,7 +19365,7 @@ function d(t3, n3, r3 = a2.DEFAULT) {
|
|
|
19322
19365
|
return D();
|
|
19323
19366
|
}
|
|
19324
19367
|
}
|
|
19325
|
-
return w(),
|
|
19368
|
+
return w(), i2.getToken() === 17 ? r2.allowEmptyContent ? true : (T(4, [], []), false) : j() ? (i2.getToken() !== 17 && T(9, [], []), true) : (T(4, [], []), false);
|
|
19326
19369
|
}
|
|
19327
19370
|
var f;
|
|
19328
19371
|
(function(e2) {
|
|
@@ -19337,11 +19380,21 @@ var h;
|
|
|
19337
19380
|
(function(e2) {
|
|
19338
19381
|
e2[e2.InvalidSymbol = 1] = `InvalidSymbol`, e2[e2.InvalidNumberFormat = 2] = `InvalidNumberFormat`, e2[e2.PropertyNameExpected = 3] = `PropertyNameExpected`, e2[e2.ValueExpected = 4] = `ValueExpected`, e2[e2.ColonExpected = 5] = `ColonExpected`, e2[e2.CommaExpected = 6] = `CommaExpected`, e2[e2.CloseBraceExpected = 7] = `CloseBraceExpected`, e2[e2.CloseBracketExpected = 8] = `CloseBracketExpected`, e2[e2.EndOfFileExpected = 9] = `EndOfFileExpected`, e2[e2.InvalidCommentToken = 10] = `InvalidCommentToken`, e2[e2.UnexpectedEndOfComment = 11] = `UnexpectedEndOfComment`, e2[e2.UnexpectedEndOfString = 12] = `UnexpectedEndOfString`, e2[e2.UnexpectedEndOfNumber = 13] = `UnexpectedEndOfNumber`, e2[e2.InvalidUnicode = 14] = `InvalidUnicode`, e2[e2.InvalidEscapeCharacter = 15] = `InvalidEscapeCharacter`, e2[e2.InvalidCharacter = 16] = `InvalidCharacter`;
|
|
19339
19382
|
})(h ||= {});
|
|
19383
|
+
// node_modules/confbox/dist/_chunks/_format.mjs
|
|
19384
|
+
var t2 = Symbol.for(`__confbox_fmt__`);
|
|
19385
|
+
var n2 = /^(\s+)/;
|
|
19386
|
+
var r2 = /(\s+)$/;
|
|
19387
|
+
function i2(e2, t3 = {}) {
|
|
19388
|
+
return { sample: t3.indent === undefined && t3.preserveIndentation !== false && e2.slice(0, t3?.sampleSize || 1024), whiteSpace: t3.preserveWhitespace === false ? undefined : { start: n2.exec(e2)?.[0] || ``, end: r2.exec(e2)?.[0] || `` } };
|
|
19389
|
+
}
|
|
19390
|
+
function a2(e2, n3, r3) {
|
|
19391
|
+
!n3 || typeof n3 != `object` || Object.defineProperty(n3, t2, { enumerable: false, configurable: true, writable: true, value: i2(e2, r3) });
|
|
19392
|
+
}
|
|
19340
19393
|
|
|
19341
19394
|
// node_modules/confbox/dist/jsonc.mjs
|
|
19342
19395
|
function r3(n3, r4) {
|
|
19343
19396
|
let i3 = m(n3, r4?.errors, r4);
|
|
19344
|
-
return
|
|
19397
|
+
return a2(n3, i3, r4), i3;
|
|
19345
19398
|
}
|
|
19346
19399
|
|
|
19347
19400
|
// node_modules/confbox/dist/_chunks/libs/js-yaml.mjs
|
|
@@ -20504,7 +20557,7 @@ var Ln = Fn.dump;
|
|
|
20504
20557
|
// node_modules/confbox/dist/yaml.mjs
|
|
20505
20558
|
function i4(t4, r5) {
|
|
20506
20559
|
let i5 = In(t4, r5);
|
|
20507
|
-
return
|
|
20560
|
+
return a2(t4, i5, r5), i5;
|
|
20508
20561
|
}
|
|
20509
20562
|
|
|
20510
20563
|
// node_modules/confbox/dist/_chunks/libs/smol-toml.mjs
|
|
@@ -21107,9 +21160,8 @@ function T2(e5, { maxDepth: t5 = 1000, integersAsBigInt: r6 } = {}) {
|
|
|
21107
21160
|
// node_modules/confbox/dist/toml.mjs
|
|
21108
21161
|
function i6(t5) {
|
|
21109
21162
|
let r6 = T2(t5);
|
|
21110
|
-
return
|
|
21163
|
+
return a2(t5, r6, { preserveIndentation: false }), r6;
|
|
21111
21164
|
}
|
|
21112
|
-
|
|
21113
21165
|
// src/core/configfile.ts
|
|
21114
21166
|
init_state();
|
|
21115
21167
|
function isCodeConfig(path) {
|
|
@@ -22251,7 +22303,7 @@ function settingsFromEnv(env) {
|
|
|
22251
22303
|
function expand(value) {
|
|
22252
22304
|
if (value === undefined)
|
|
22253
22305
|
return {};
|
|
22254
|
-
return Object.fromEntries(TARGET_IDS.map((
|
|
22306
|
+
return Object.fromEntries(TARGET_IDS.map((t6) => [t6, value]));
|
|
22255
22307
|
}
|
|
22256
22308
|
}
|
|
22257
22309
|
function stateEnv(env, suffix) {
|
|
@@ -22334,7 +22386,7 @@ function ruleBlockActions(setup, memoryPath, vars) {
|
|
|
22334
22386
|
return actions;
|
|
22335
22387
|
}
|
|
22336
22388
|
function agentsMdOwners(setup) {
|
|
22337
|
-
return (setup.rules ?? []).filter((
|
|
22389
|
+
return (setup.rules ?? []).filter((r7) => r7.placement === "agents-md").map((r7) => ({ type: "rule", name: r7.name }));
|
|
22338
22390
|
}
|
|
22339
22391
|
function modelVars(setup, target) {
|
|
22340
22392
|
return {
|
|
@@ -22354,7 +22406,7 @@ function installedListVars(setup, target) {
|
|
|
22354
22406
|
`);
|
|
22355
22407
|
const skills = setup.skills.map((s3) => `- ${s3.id}${tail(s3.description)}`).join(`
|
|
22356
22408
|
`);
|
|
22357
|
-
const tools = setup.tools.map((
|
|
22409
|
+
const tools = setup.tools.map((t6) => `- ${t6.id}${tail(t6.description)}`).join(`
|
|
22358
22410
|
`);
|
|
22359
22411
|
const mcps = setup.mcps.map((m4) => `- ${m4.id}${tail(m4.description)}`).join(`
|
|
22360
22412
|
`);
|
|
@@ -22650,7 +22702,7 @@ var opencode = {
|
|
|
22650
22702
|
}
|
|
22651
22703
|
const instructionPaths = [];
|
|
22652
22704
|
const instructionOwners = [];
|
|
22653
|
-
const instructionRules = (setup.rules ?? []).filter((
|
|
22705
|
+
const instructionRules = (setup.rules ?? []).filter((r7) => r7.placement === "instructions");
|
|
22654
22706
|
for (const rule of instructionRules) {
|
|
22655
22707
|
const filePath = join5(cfgDir, "rules", `${rule.name}.md`);
|
|
22656
22708
|
actions.push(write(filePath, withManagedHeader(render(rule.content, vars, setup.flags))));
|
|
@@ -22661,7 +22713,7 @@ var opencode = {
|
|
|
22661
22713
|
if (setup.agentsMdBlock && ctx.scope === "project") {
|
|
22662
22714
|
const agentsMdEntry = relative4(ctx.projectDir, agentsMdPath);
|
|
22663
22715
|
instructionPaths.unshift(agentsMdEntry);
|
|
22664
|
-
const agentsMdRules = (setup.rules ?? []).filter((
|
|
22716
|
+
const agentsMdRules = (setup.rules ?? []).filter((r7) => r7.placement === "agents-md");
|
|
22665
22717
|
for (const rule of agentsMdRules) {
|
|
22666
22718
|
instructionOwners.push({ key: "instructions", value: agentsMdEntry, ruleName: rule.name });
|
|
22667
22719
|
}
|
|
@@ -23125,7 +23177,7 @@ function fileContent(item, fallbackPath) {
|
|
|
23125
23177
|
return file2.content;
|
|
23126
23178
|
}
|
|
23127
23179
|
function depNames(item, type) {
|
|
23128
|
-
return (item.dependencies ?? []).filter((
|
|
23180
|
+
return (item.dependencies ?? []).filter((d5) => d5.startsWith(`${type}:`)).map((d5) => d5.slice(type.length + 1)).map((d5) => d5.includes("/") ? d5.slice(d5.lastIndexOf("/") + 1) : d5);
|
|
23129
23181
|
}
|
|
23130
23182
|
function toAgentDef(item) {
|
|
23131
23183
|
const cfg = item.config?.agents ?? {};
|
|
@@ -23299,7 +23351,7 @@ function assertRuleInvariants(rules) {
|
|
|
23299
23351
|
}
|
|
23300
23352
|
}
|
|
23301
23353
|
function composeAgentsMdBlock(rules) {
|
|
23302
|
-
const agentsMd = rules.filter((
|
|
23354
|
+
const agentsMd = rules.filter((r7) => r7.placement === "agents-md");
|
|
23303
23355
|
if (agentsMd.length === 0)
|
|
23304
23356
|
return null;
|
|
23305
23357
|
const sorted = [...agentsMd].sort((a7, b3) => {
|
|
@@ -23307,7 +23359,7 @@ function composeAgentsMdBlock(rules) {
|
|
|
23307
23359
|
const ob = b3.order ?? 100;
|
|
23308
23360
|
return oa !== ob ? oa - ob : a7.name.localeCompare(b3.name);
|
|
23309
23361
|
});
|
|
23310
|
-
return sorted.map((
|
|
23362
|
+
return sorted.map((r7) => r7.content).join(`
|
|
23311
23363
|
|
|
23312
23364
|
`);
|
|
23313
23365
|
}
|
|
@@ -23387,7 +23439,7 @@ function planManifests(items, config2, ctx) {
|
|
|
23387
23439
|
guardManifestPaths(items);
|
|
23388
23440
|
const { vars, flags } = splitVars(config2.vars);
|
|
23389
23441
|
const notes = [];
|
|
23390
|
-
const byType = (
|
|
23442
|
+
const byType = (t6) => items.filter((i8) => i8.type === t6);
|
|
23391
23443
|
const presets = byType("preset");
|
|
23392
23444
|
const agentOverrides = config2.agents ?? {};
|
|
23393
23445
|
const agents = byType("agent").map(toAgentDef).map((a7) => applyAgentOverride(a7, agentOverrides[a7.id]));
|
|
@@ -23487,7 +23539,7 @@ function planManifests(items, config2, ctx) {
|
|
|
23487
23539
|
validateVars(items, available);
|
|
23488
23540
|
const missingTierModels = [...requiredTiers].filter((tier) => tierDefaults[tier] === undefined && settings.models[tier] === undefined);
|
|
23489
23541
|
if (missingTierModels.length > 0) {
|
|
23490
|
-
throw new Error(`Missing model id(s) for tier(s): ${missingTierModels.map((
|
|
23542
|
+
throw new Error(`Missing model id(s) for tier(s): ${missingTierModels.map((t6) => `model.${t6}`).sort().join(", ")}. Set them in agentz.json "vars".`);
|
|
23491
23543
|
}
|
|
23492
23544
|
const modelFor = (tier, target) => {
|
|
23493
23545
|
try {
|
|
@@ -23505,7 +23557,7 @@ function planManifests(items, config2, ctx) {
|
|
|
23505
23557
|
for (const [k2, v3] of Object.entries(vars))
|
|
23506
23558
|
if (!k2.startsWith("model."))
|
|
23507
23559
|
extraVars[k2] = v3;
|
|
23508
|
-
const hasScratchpad = tools.some((
|
|
23560
|
+
const hasScratchpad = tools.some((t6) => t6.id === "scratchpad");
|
|
23509
23561
|
const mergedFlags = {
|
|
23510
23562
|
...flags,
|
|
23511
23563
|
...installedFlags({ agents, tools, mcps }),
|
|
@@ -23521,7 +23573,7 @@ function planManifests(items, config2, ctx) {
|
|
|
23521
23573
|
skillGroups: [],
|
|
23522
23574
|
mcps: mcps.map((m4) => m4.id),
|
|
23523
23575
|
...lsps.length ? { lsps: lsps.map((l3) => l3.id) } : {},
|
|
23524
|
-
tools: tools.map((
|
|
23576
|
+
tools: tools.map((t6) => t6.id),
|
|
23525
23577
|
agentsMd: effectiveAgentsMd,
|
|
23526
23578
|
disableDefaults: effectiveDisableDefaults,
|
|
23527
23579
|
scratchpad: hasScratchpad,
|
|
@@ -23536,7 +23588,7 @@ function planManifests(items, config2, ctx) {
|
|
|
23536
23588
|
...commands.length ? { commands } : {},
|
|
23537
23589
|
...Object.keys(opencodeSettings).length ? { opencodeSettings } : {},
|
|
23538
23590
|
agentsMdBlock: effectiveAgentsMd ? agentsMdBlock : null,
|
|
23539
|
-
rules: allRules.filter((
|
|
23591
|
+
rules: allRules.filter((r7) => r7.placement === "agents-md" ? effectiveAgentsMd : true),
|
|
23540
23592
|
notes,
|
|
23541
23593
|
flags: mergedFlags,
|
|
23542
23594
|
extraVars,
|
|
@@ -23641,7 +23693,7 @@ added ${items.length} item(s); lock updated.`));
|
|
|
23641
23693
|
function forceOverwrite(plans) {
|
|
23642
23694
|
return plans.map((plan) => ({
|
|
23643
23695
|
...plan,
|
|
23644
|
-
actions: plan.actions.map((
|
|
23696
|
+
actions: plan.actions.map((a8) => a8.kind === "write" && a8.overwrite === "ifManaged" ? { ...a8, overwrite: "always" } : a8)
|
|
23645
23697
|
}));
|
|
23646
23698
|
}
|
|
23647
23699
|
function buildLockItems(items, plans, lockRef, projectDir, results, prevLock) {
|
|
@@ -23650,25 +23702,25 @@ function buildLockItems(items, plans, lockRef, projectDir, results, prevLock) {
|
|
|
23650
23702
|
const mergeActions = plans.flatMap((p6) => p6.actions).filter(isMergeJson);
|
|
23651
23703
|
const ownedPath = (path2) => normalizeLockPath(path2, projectDir);
|
|
23652
23704
|
const pathKey = (path2) => lockPathKey(ownedPath(path2));
|
|
23653
|
-
const addedSet = results ? new Set(results.flatMap((
|
|
23654
|
-
const addedObjSet = results ? new Set(results.flatMap((
|
|
23655
|
-
const updatedObjSet = results ? new Set(results.flatMap((
|
|
23705
|
+
const addedSet = results ? new Set(results.flatMap((r8) => (r8.addedArrayEntries ?? []).map((e6) => `${pathKey(r8.action.path)}\x00${e6.key}\x00${e6.value}\x00${e6.ruleName}`))) : null;
|
|
23706
|
+
const addedObjSet = results ? new Set(results.flatMap((r8) => (r8.addedObjectEntries ?? []).map((e6) => `${pathKey(r8.action.path)}\x00${e6.key}\x00${e6.subKey}\x00${e6.ownerName}`))) : null;
|
|
23707
|
+
const updatedObjSet = results ? new Set(results.flatMap((r8) => (r8.updatedObjectEntries ?? []).map((e6) => `${pathKey(r8.action.path)}\x00${e6.key}\x00${e6.subKey}\x00${e6.ownerName}`))) : null;
|
|
23656
23708
|
const writtenSideAssets = results ? new Set(results.filter((result) => result.action.kind === "write" && result.action.sideAsset === true && (result.status === "created" || result.status === "updated")).map((result) => pathKey(result.action.path))) : null;
|
|
23657
23709
|
const previouslyOwnedSideAssets = new Set((prevLock?.items ?? []).flatMap((item) => item.files.filter((file2) => file2.sideAsset).map((file2) => `${lockPathKey(file2)}\x00${file2.hash}`)));
|
|
23658
23710
|
const prevByRef = new Map(prevLock?.items.map((i9) => [i9.ref, i9]) ?? []);
|
|
23659
|
-
const prevOwnedKey = (ref) => new Set((prevByRef.get(ref)?.jsonEntries ?? []).map((
|
|
23660
|
-
const anyPrevOwned = new Set((prevLock?.items ?? []).flatMap((i9) => (i9.jsonEntries ?? []).map((
|
|
23661
|
-
const prevOwnedObjKey = (ref) => new Set((prevByRef.get(ref)?.objectEntries ?? []).map((
|
|
23711
|
+
const prevOwnedKey = (ref) => new Set((prevByRef.get(ref)?.jsonEntries ?? []).map((e6) => `${lockPathKey(e6)}\x00${e6.key}\x00${e6.value}`));
|
|
23712
|
+
const anyPrevOwned = new Set((prevLock?.items ?? []).flatMap((i9) => (i9.jsonEntries ?? []).map((e6) => `${lockPathKey(e6)}\x00${e6.key}\x00${e6.value}`)));
|
|
23713
|
+
const prevOwnedObjKey = (ref) => new Set((prevByRef.get(ref)?.objectEntries ?? []).map((e6) => `${lockPathKey(e6)}\x00${e6.key}\x00${e6.subKey}\x00${e6.value ?? ""}`));
|
|
23662
23714
|
const anyPrevOwnedObj = new Set((prevLock?.items ?? []).flatMap((item) => (item.objectEntries ?? []).filter((entry) => entry.value !== undefined).map((entry) => `${lockPathKey(entry)}\x00${entry.key}\x00${entry.subKey}\x00${entry.value}`)));
|
|
23663
23715
|
const out = [];
|
|
23664
23716
|
for (const item of items) {
|
|
23665
|
-
const
|
|
23717
|
+
const m6 = item.manifest;
|
|
23666
23718
|
const ref = lockRef(item);
|
|
23667
23719
|
const prevOwned = prevOwnedKey(ref);
|
|
23668
|
-
const owned = writeActions.filter((
|
|
23669
|
-
const files = owned.map((
|
|
23670
|
-
action:
|
|
23671
|
-
entry: fileEntry(
|
|
23720
|
+
const owned = writeActions.filter((a8) => ownsWriteAction(m6.name, m6.type, a8));
|
|
23721
|
+
const files = owned.map((a8) => ({
|
|
23722
|
+
action: a8,
|
|
23723
|
+
entry: fileEntry(a8.path, projectDir, manifestLogical(m6, a8.path), a8.sideAsset === true)
|
|
23672
23724
|
})).filter((candidate) => {
|
|
23673
23725
|
if (candidate.entry === null)
|
|
23674
23726
|
return false;
|
|
@@ -23676,19 +23728,19 @@ function buildLockItems(items, plans, lockRef, projectDir, results, prevLock) {
|
|
|
23676
23728
|
return true;
|
|
23677
23729
|
return writtenSideAssets.has(pathKey(candidate.action.path)) || previouslyOwnedSideAssets.has(`${lockPathKey(candidate.entry)}\x00${candidate.entry.hash}`);
|
|
23678
23730
|
}).map((candidate) => candidate.entry);
|
|
23679
|
-
const blocks = blockActions.filter((action) => ownsBlockAction(
|
|
23731
|
+
const blocks = blockActions.filter((action) => ownsBlockAction(m6, action)).map((action) => ({
|
|
23680
23732
|
...ownedPath(action.path),
|
|
23681
23733
|
marker: action.marker,
|
|
23682
23734
|
comment: action.comment,
|
|
23683
23735
|
hash: hashContent(blockText(action.marker, action.content, action.comment))
|
|
23684
23736
|
}));
|
|
23685
|
-
const jsonEntries =
|
|
23737
|
+
const jsonEntries = m6.type === "rule" ? mergeActions.flatMap((a8) => (a8.arrayEntries ?? []).filter((e6) => e6.ruleName === m6.name).filter((e6) => addedSet === null || addedSet.has(`${pathKey(a8.path)}\x00${e6.key}\x00${e6.value}\x00${e6.ruleName}`) || prevOwned.has(`${pathKey(a8.path)}\x00${e6.key}\x00${e6.value}`) || anyPrevOwned.has(`${pathKey(a8.path)}\x00${e6.key}\x00${e6.value}`)).map((e6) => ({ ...ownedPath(a8.path), key: e6.key, value: e6.value }))) : [];
|
|
23686
23738
|
const prevOwnedObj = prevOwnedObjKey(ref);
|
|
23687
|
-
const objectEntries =
|
|
23688
|
-
const sourceHash = manifestSourceHash(
|
|
23739
|
+
const objectEntries = m6.type === "lsp" || m6.type === "mcp" || m6.type === "tool" ? mergeActions.flatMap((a8) => (a8.objectEntries ?? []).filter((e6) => e6.ownerName === m6.name).filter((e6) => addedObjSet === null || addedObjSet.has(`${pathKey(a8.path)}\x00${e6.key}\x00${e6.subKey}\x00${e6.ownerName}`) || updatedObjSet?.has(`${pathKey(a8.path)}\x00${e6.key}\x00${e6.subKey}\x00${e6.ownerName}`) || prevOwnedObj.has(`${pathKey(a8.path)}\x00${e6.key}\x00${e6.subKey}\x00${e6.value}`) || anyPrevOwnedObj.has(`${pathKey(a8.path)}\x00${e6.key}\x00${e6.subKey}\x00${e6.value}`)).map((e6) => ({ ...ownedPath(a8.path), key: e6.key, subKey: e6.subKey, value: e6.value }))) : [];
|
|
23740
|
+
const sourceHash = manifestSourceHash(m6.files);
|
|
23689
23741
|
out.push({
|
|
23690
23742
|
ref,
|
|
23691
|
-
...
|
|
23743
|
+
...m6.version ? { version: m6.version } : {},
|
|
23692
23744
|
registry: item.registryLabel,
|
|
23693
23745
|
files,
|
|
23694
23746
|
...blocks.length ? { blocks } : {},
|
|
@@ -23699,14 +23751,14 @@ function buildLockItems(items, plans, lockRef, projectDir, results, prevLock) {
|
|
|
23699
23751
|
}
|
|
23700
23752
|
return out;
|
|
23701
23753
|
}
|
|
23702
|
-
function isWrite(
|
|
23703
|
-
return
|
|
23754
|
+
function isWrite(a8) {
|
|
23755
|
+
return a8.kind === "write";
|
|
23704
23756
|
}
|
|
23705
|
-
function isAppendBlock(
|
|
23706
|
-
return
|
|
23757
|
+
function isAppendBlock(a8) {
|
|
23758
|
+
return a8.kind === "append-block";
|
|
23707
23759
|
}
|
|
23708
|
-
function isMergeJson(
|
|
23709
|
-
return
|
|
23760
|
+
function isMergeJson(a8) {
|
|
23761
|
+
return a8.kind === "merge-json";
|
|
23710
23762
|
}
|
|
23711
23763
|
function ownsBlockAction(manifest, action) {
|
|
23712
23764
|
if (action.owners?.some((owner) => owner.type === manifest.type && owner.name === manifest.name)) {
|
|
@@ -23764,33 +23816,33 @@ async function lockedAgentsMdRuleManifests(sources, lock, present) {
|
|
|
23764
23816
|
const { items } = await sources.resolve(found);
|
|
23765
23817
|
const out = [];
|
|
23766
23818
|
for (const it2 of items) {
|
|
23767
|
-
const
|
|
23768
|
-
if (
|
|
23819
|
+
const m6 = it2.manifest;
|
|
23820
|
+
if (m6.type !== "rule")
|
|
23769
23821
|
continue;
|
|
23770
|
-
if (presentRuleNames.has(
|
|
23822
|
+
if (presentRuleNames.has(m6.name))
|
|
23771
23823
|
continue;
|
|
23772
|
-
if (rulePlacement(
|
|
23824
|
+
if (rulePlacement(m6) !== "agents-md")
|
|
23773
23825
|
continue;
|
|
23774
|
-
out.push(
|
|
23775
|
-
presentRuleNames.add(
|
|
23826
|
+
out.push(m6);
|
|
23827
|
+
presentRuleNames.add(m6.name);
|
|
23776
23828
|
}
|
|
23777
23829
|
return out;
|
|
23778
23830
|
}
|
|
23779
|
-
function rulePlacement(
|
|
23780
|
-
const raw =
|
|
23831
|
+
function rulePlacement(m6) {
|
|
23832
|
+
const raw = m6.config?.rules?.placement;
|
|
23781
23833
|
if (raw === "agents-md" || raw === "instructions")
|
|
23782
23834
|
return raw;
|
|
23783
|
-
return
|
|
23835
|
+
return m6.files?.some((f5) => f5.path === "AGENTS.md") ? "agents-md" : "instructions";
|
|
23784
23836
|
}
|
|
23785
|
-
function ruleContradicts(
|
|
23786
|
-
const raw =
|
|
23837
|
+
function ruleContradicts(m6) {
|
|
23838
|
+
const raw = m6.meta?.contradicts;
|
|
23787
23839
|
return Array.isArray(raw) ? raw.filter((x4) => typeof x4 === "string") : [];
|
|
23788
23840
|
}
|
|
23789
23841
|
async function warnRuleContradictions(sources, present, lock) {
|
|
23790
23842
|
const batch = present.filter((i9) => i9.manifest.type === "rule").map((i9) => i9.manifest);
|
|
23791
23843
|
if (batch.length === 0)
|
|
23792
23844
|
return;
|
|
23793
|
-
const batchNames = new Set(batch.map((
|
|
23845
|
+
const batchNames = new Set(batch.map((m6) => m6.name));
|
|
23794
23846
|
const lockedRuleRefs = lock.items.map((i9) => i9.ref).filter((ref) => /(?:^|\/)rule:[a-z0-9][a-z0-9-]*$/.test(ref));
|
|
23795
23847
|
const installed = [];
|
|
23796
23848
|
if (lockedRuleRefs.length > 0) {
|
|
@@ -23798,15 +23850,15 @@ async function warnRuleContradictions(sources, present, lock) {
|
|
|
23798
23850
|
if (found.length > 0) {
|
|
23799
23851
|
const { items } = await sources.resolve(found);
|
|
23800
23852
|
for (const it2 of items) {
|
|
23801
|
-
const
|
|
23802
|
-
if (
|
|
23803
|
-
installed.push(
|
|
23853
|
+
const m6 = it2.manifest;
|
|
23854
|
+
if (m6.type === "rule" && !batchNames.has(m6.name))
|
|
23855
|
+
installed.push(m6);
|
|
23804
23856
|
}
|
|
23805
23857
|
}
|
|
23806
23858
|
}
|
|
23807
23859
|
const byName = new Map;
|
|
23808
|
-
for (const
|
|
23809
|
-
byName.set(
|
|
23860
|
+
for (const m6 of [...installed, ...batch])
|
|
23861
|
+
byName.set(m6.name, m6);
|
|
23810
23862
|
const seenPairs = new Set;
|
|
23811
23863
|
const warn = (incoming, other, otherInstalled) => {
|
|
23812
23864
|
const key = [incoming.name, other.name].sort().join("|");
|
|
@@ -23831,9 +23883,9 @@ async function warnRuleContradictions(sources, present, lock) {
|
|
|
23831
23883
|
async function noteGroupOnlySkills(refs, items, sources) {
|
|
23832
23884
|
const askedNames = new Set;
|
|
23833
23885
|
for (const raw of refs) {
|
|
23834
|
-
const
|
|
23835
|
-
if (
|
|
23836
|
-
askedNames.add(
|
|
23886
|
+
const m6 = /(?:^|\/)(?:skill:)?([a-z0-9][a-z0-9-]*)$/.exec(raw.trim());
|
|
23887
|
+
if (m6)
|
|
23888
|
+
askedNames.add(m6[1]);
|
|
23837
23889
|
}
|
|
23838
23890
|
const groupOnly = items.filter((it2) => it2.manifest.type === "skill" && it2.manifest.standalone === false && askedNames.has(it2.manifest.name));
|
|
23839
23891
|
if (groupOnly.length === 0)
|
|
@@ -23974,9 +24026,9 @@ function renderPreview(p6) {
|
|
|
23974
24026
|
row("AGENTS.md", agentsMdText(p6.agentsMd));
|
|
23975
24027
|
out.push("");
|
|
23976
24028
|
head(`agents (${p6.agents.length})`);
|
|
23977
|
-
for (const
|
|
23978
|
-
const effort =
|
|
23979
|
-
out.push(` ${
|
|
24029
|
+
for (const a8 of p6.agents) {
|
|
24030
|
+
const effort = a8.reasoningEffort ? pc6.dim(` effort=${a8.reasoningEffort}`) : "";
|
|
24031
|
+
out.push(` ${a8.id.padEnd(20)} ${pc6.dim(a8.tier.padEnd(7))} ${a8.model}${effort}`);
|
|
23980
24032
|
}
|
|
23981
24033
|
section(out, "skills", p6.skills);
|
|
23982
24034
|
section(out, "tools", p6.tools);
|
|
@@ -23985,12 +24037,12 @@ function renderPreview(p6) {
|
|
|
23985
24037
|
if (p6.mcps.length > 0) {
|
|
23986
24038
|
out.push("");
|
|
23987
24039
|
head(`MCP servers (${p6.mcps.length})`);
|
|
23988
|
-
for (const
|
|
23989
|
-
out.push(` ${
|
|
24040
|
+
for (const m6 of p6.mcps)
|
|
24041
|
+
out.push(` ${m6.id.padEnd(20)} ${pc6.dim(m6.detail)}`);
|
|
23990
24042
|
}
|
|
23991
24043
|
section(out, "language servers", p6.lsps);
|
|
23992
24044
|
out.push("");
|
|
23993
|
-
const files = Object.entries(p6.fileCounts).map(([
|
|
24045
|
+
const files = Object.entries(p6.fileCounts).map(([t7, n8]) => `${t7}:${n8}`).join(" ");
|
|
23994
24046
|
row("file actions", files || "none");
|
|
23995
24047
|
for (const note2 of p6.notes)
|
|
23996
24048
|
out.push(pc6.dim(` note: ${note2}`));
|
|
@@ -24144,7 +24196,7 @@ async function buildPreview(sources, ctx, state) {
|
|
|
24144
24196
|
const items = filterExcluded(resolved, state);
|
|
24145
24197
|
const config2 = buildConfig(state);
|
|
24146
24198
|
const packInfo = normalizeModelPack(state.modelPack);
|
|
24147
|
-
const lock = await Promise.resolve().then(() => (init_shared(), exports_shared)).then((
|
|
24199
|
+
const lock = await Promise.resolve().then(() => (init_shared(), exports_shared)).then((m6) => m6.loadLock(ctx.projectDir));
|
|
24148
24200
|
const fallbackModels = await fallbackTierModels(sources, lock);
|
|
24149
24201
|
const agentsMdBool = agentsModeToBool(state.agentsMd);
|
|
24150
24202
|
const { setup, plans, notes } = planManifests(items.map((i9) => i9.manifest), {
|
|
@@ -24164,40 +24216,40 @@ async function buildPreview(sources, ctx, state) {
|
|
|
24164
24216
|
targets: state.targets,
|
|
24165
24217
|
scope: ctx.scope,
|
|
24166
24218
|
agentsMd: previewAgentsMd(setup),
|
|
24167
|
-
agents: setup.agents.map((
|
|
24168
|
-
id:
|
|
24169
|
-
label:
|
|
24170
|
-
tier:
|
|
24171
|
-
model: setup.modelForAgent(
|
|
24172
|
-
...
|
|
24219
|
+
agents: setup.agents.map((a8) => ({
|
|
24220
|
+
id: a8.id,
|
|
24221
|
+
label: a8.label,
|
|
24222
|
+
tier: a8.tier,
|
|
24223
|
+
model: setup.modelForAgent(a8, target),
|
|
24224
|
+
...a8.thinking?.reasoningEffort ? { reasoningEffort: a8.thinking.reasoningEffort } : {}
|
|
24173
24225
|
})),
|
|
24174
24226
|
skills: setup.skills.map((s3) => ({ id: s3.id, label: s3.label })),
|
|
24175
|
-
tools: setup.tools.map((
|
|
24227
|
+
tools: setup.tools.map((t7) => ({ id: t7.id, label: t7.label })),
|
|
24176
24228
|
plugins: (setup.plugins ?? []).map((p6) => ({ id: p6.id, label: p6.label })),
|
|
24177
24229
|
commands: (setup.commands ?? []).map((c5) => ({ id: c5.id, label: c5.label })),
|
|
24178
24230
|
rules: previewRules(setup.rules ?? []),
|
|
24179
|
-
mcps: setup.mcps.map((
|
|
24231
|
+
mcps: setup.mcps.map((m6) => ({ id: m6.id, label: m6.label, detail: mcpDetail(m6) })),
|
|
24180
24232
|
lsps: (setup.lsps ?? []).map((l4) => ({ id: l4.id, label: l4.label })),
|
|
24181
|
-
fileCounts: Object.fromEntries(plans.map((p6) => [p6.target, p6.actions.filter((
|
|
24233
|
+
fileCounts: Object.fromEntries(plans.map((p6) => [p6.target, p6.actions.filter((a8) => a8.kind !== "remove-block").length])),
|
|
24182
24234
|
notes: packInfo.note ? [packInfo.note, ...notes] : notes
|
|
24183
24235
|
};
|
|
24184
24236
|
return { preview, items, setup, plans };
|
|
24185
24237
|
}
|
|
24186
24238
|
function previewRules(rules) {
|
|
24187
|
-
const names = new Set(rules.map((
|
|
24239
|
+
const names = new Set(rules.map((r8) => r8.name));
|
|
24188
24240
|
const edges = new Map;
|
|
24189
|
-
const link = (
|
|
24190
|
-
if (
|
|
24241
|
+
const link = (a8, b5) => {
|
|
24242
|
+
if (a8 === b5 || !names.has(a8) || !names.has(b5))
|
|
24191
24243
|
return;
|
|
24192
|
-
(edges.get(
|
|
24193
|
-
(edges.get(b5) ?? edges.set(b5, new Set).get(b5)).add(
|
|
24244
|
+
(edges.get(a8) ?? edges.set(a8, new Set).get(a8)).add(b5);
|
|
24245
|
+
(edges.get(b5) ?? edges.set(b5, new Set).get(b5)).add(a8);
|
|
24194
24246
|
};
|
|
24195
|
-
for (const
|
|
24196
|
-
for (const other of
|
|
24197
|
-
link(
|
|
24198
|
-
return rules.filter((
|
|
24199
|
-
const conflicts = [...edges.get(
|
|
24200
|
-
return { id:
|
|
24247
|
+
for (const r8 of rules)
|
|
24248
|
+
for (const other of r8.contradicts ?? [])
|
|
24249
|
+
link(r8.name, other);
|
|
24250
|
+
return rules.filter((r8) => r8.placement !== "agents-md").map((r8) => {
|
|
24251
|
+
const conflicts = [...edges.get(r8.name) ?? []].sort();
|
|
24252
|
+
return { id: r8.name, label: r8.name, ...conflicts.length ? { contradicts: conflicts } : {} };
|
|
24201
24253
|
});
|
|
24202
24254
|
}
|
|
24203
24255
|
function previewAgentsMd(setup) {
|
|
@@ -24205,8 +24257,8 @@ function previewAgentsMd(setup) {
|
|
|
24205
24257
|
return false;
|
|
24206
24258
|
return setup.flags.agentsMdFull ? "full" : "lean";
|
|
24207
24259
|
}
|
|
24208
|
-
function mcpDetail(
|
|
24209
|
-
const withOpts = applyMcpOptions(
|
|
24260
|
+
function mcpDetail(m6) {
|
|
24261
|
+
const withOpts = applyMcpOptions(m6, undefined);
|
|
24210
24262
|
if (withOpts.transport.type === "local")
|
|
24211
24263
|
return withOpts.transport.command.join(" ");
|
|
24212
24264
|
return withOpts.transport.url;
|
|
@@ -24229,24 +24281,24 @@ function applyTweak(state, tweak) {
|
|
|
24229
24281
|
};
|
|
24230
24282
|
switch (tweak.kind) {
|
|
24231
24283
|
case "agentModel": {
|
|
24232
|
-
const
|
|
24284
|
+
const a8 = next.agents[tweak.agentId] ??= {};
|
|
24233
24285
|
if (tweak.model)
|
|
24234
|
-
|
|
24286
|
+
a8.model = tweak.model;
|
|
24235
24287
|
else
|
|
24236
|
-
delete
|
|
24288
|
+
delete a8.model;
|
|
24237
24289
|
pruneAgent(next.agents, tweak.agentId);
|
|
24238
24290
|
return next;
|
|
24239
24291
|
}
|
|
24240
24292
|
case "agentEffort": {
|
|
24241
|
-
const
|
|
24293
|
+
const a8 = next.agents[tweak.agentId] ??= {};
|
|
24242
24294
|
if (tweak.effort)
|
|
24243
|
-
|
|
24244
|
-
else if (
|
|
24245
|
-
const { reasoningEffort: _drop, ...rest } =
|
|
24295
|
+
a8.thinking = { ...a8.thinking ?? {}, reasoningEffort: tweak.effort };
|
|
24296
|
+
else if (a8.thinking) {
|
|
24297
|
+
const { reasoningEffort: _drop, ...rest } = a8.thinking;
|
|
24246
24298
|
if (Object.keys(rest).length)
|
|
24247
|
-
|
|
24299
|
+
a8.thinking = rest;
|
|
24248
24300
|
else
|
|
24249
|
-
delete
|
|
24301
|
+
delete a8.thinking;
|
|
24250
24302
|
}
|
|
24251
24303
|
pruneAgent(next.agents, tweak.agentId);
|
|
24252
24304
|
return next;
|
|
@@ -24257,7 +24309,7 @@ function applyTweak(state, tweak) {
|
|
|
24257
24309
|
if (tweak.excluded && !has)
|
|
24258
24310
|
list2.push(tweak.name);
|
|
24259
24311
|
if (!tweak.excluded && has)
|
|
24260
|
-
next.excluded[tweak.toggle] = list2.filter((
|
|
24312
|
+
next.excluded[tweak.toggle] = list2.filter((n8) => n8 !== tweak.name);
|
|
24261
24313
|
return next;
|
|
24262
24314
|
}
|
|
24263
24315
|
case "tierEffort": {
|
|
@@ -24317,10 +24369,10 @@ async function runWizardPrompts(ctx, detected) {
|
|
|
24317
24369
|
p6.intro(pc7.bgCyan(pc7.black(" agentz init ")));
|
|
24318
24370
|
const targets = await p6.multiselect({
|
|
24319
24371
|
message: "Install for which frameworks?",
|
|
24320
|
-
options: adapters.map((
|
|
24321
|
-
value:
|
|
24322
|
-
label:
|
|
24323
|
-
...detected.includes(
|
|
24372
|
+
options: adapters.map((a8) => ({
|
|
24373
|
+
value: a8.id,
|
|
24374
|
+
label: a8.label,
|
|
24375
|
+
...detected.includes(a8.id) ? { hint: "detected" } : {}
|
|
24324
24376
|
})),
|
|
24325
24377
|
initialValues: detected.length > 0 ? detected : ["opencode"],
|
|
24326
24378
|
required: true
|
|
@@ -24411,7 +24463,7 @@ async function runTweak(p6, action, state, preview, presets, packHints) {
|
|
|
24411
24463
|
return state;
|
|
24412
24464
|
const model = await p6.text({
|
|
24413
24465
|
message: `Model id for "${agentId}"? (blank = keep default)`,
|
|
24414
|
-
placeholder: preview.agents.find((
|
|
24466
|
+
placeholder: preview.agents.find((a8) => a8.id === agentId)?.model ?? ""
|
|
24415
24467
|
});
|
|
24416
24468
|
if (p6.isCancel(model))
|
|
24417
24469
|
return null;
|
|
@@ -24430,7 +24482,7 @@ async function runTweak(p6, action, state, preview, presets, packHints) {
|
|
|
24430
24482
|
message: `Reasoning effort for "${agentId}"?`,
|
|
24431
24483
|
options: [
|
|
24432
24484
|
{ value: "", label: "(default)" },
|
|
24433
|
-
...REASONING_EFFORTS.map((
|
|
24485
|
+
...REASONING_EFFORTS.map((e6) => ({ value: e6, label: e6 }))
|
|
24434
24486
|
],
|
|
24435
24487
|
initialValue: ""
|
|
24436
24488
|
});
|
|
@@ -24461,7 +24513,7 @@ async function runTweak(p6, action, state, preview, presets, packHints) {
|
|
|
24461
24513
|
case "targets": {
|
|
24462
24514
|
const targets = await p6.multiselect({
|
|
24463
24515
|
message: "Install for which frameworks?",
|
|
24464
|
-
options: adapters.map((
|
|
24516
|
+
options: adapters.map((a8) => ({ value: a8.id, label: a8.label })),
|
|
24465
24517
|
initialValues: state.targets,
|
|
24466
24518
|
required: true
|
|
24467
24519
|
});
|
|
@@ -24518,7 +24570,7 @@ async function pickAgent(p6, preview) {
|
|
|
24518
24570
|
return null;
|
|
24519
24571
|
const id = await p6.select({
|
|
24520
24572
|
message: "Which agent?",
|
|
24521
|
-
options: preview.agents.map((
|
|
24573
|
+
options: preview.agents.map((a8) => ({ value: a8.id, label: a8.id, hint: a8.model }))
|
|
24522
24574
|
});
|
|
24523
24575
|
if (p6.isCancel(id))
|
|
24524
24576
|
return null;
|
|
@@ -24542,7 +24594,7 @@ async function toggleItems(p6, state, preview) {
|
|
|
24542
24594
|
const group2 = kinds.find((k2) => k2.kind === kind);
|
|
24543
24595
|
const present = new Set(group2.items.map((i9) => i9.id));
|
|
24544
24596
|
const conflictLabel = (i9) => {
|
|
24545
|
-
const active = (i9.contradicts ?? []).filter((
|
|
24597
|
+
const active = (i9.contradicts ?? []).filter((n8) => present.has(n8));
|
|
24546
24598
|
return active.length ? `${i9.id} (contradicts ${active.join(", ")})` : i9.id;
|
|
24547
24599
|
};
|
|
24548
24600
|
const keep = await p6.multiselect({
|
|
@@ -24590,7 +24642,7 @@ async function askMcpOptions(p6, sources, state) {
|
|
|
24590
24642
|
return out;
|
|
24591
24643
|
}
|
|
24592
24644
|
function presetSummaries(index) {
|
|
24593
|
-
return index.items.filter((i9) => i9.type === "preset").sort((
|
|
24645
|
+
return index.items.filter((i9) => i9.type === "preset").sort((a8, b5) => a8.name.localeCompare(b5.name));
|
|
24594
24646
|
}
|
|
24595
24647
|
async function packTierHints(sources) {
|
|
24596
24648
|
const out = {};
|
|
@@ -24674,7 +24726,7 @@ async function runInteractive(opts) {
|
|
|
24674
24726
|
if (nonJson.length > 0) {
|
|
24675
24727
|
throw new Error(`This project uses ${nonJson.map((f5) => `agentz.${f5.format}`).join(", ")}. ` + "init only writes agentz.json \u2014 edit that file by hand and run `agentz update`.");
|
|
24676
24728
|
}
|
|
24677
|
-
const detected = adapters.filter((
|
|
24729
|
+
const detected = adapters.filter((a8) => a8.detect(ctx)).map((a8) => a8.id);
|
|
24678
24730
|
const state = await runWizardPrompts(ctx, detected);
|
|
24679
24731
|
if (state === null)
|
|
24680
24732
|
return;
|
|
@@ -24733,14 +24785,14 @@ installed ${items.length} item(s); lock written.`));
|
|
|
24733
24785
|
});
|
|
24734
24786
|
}
|
|
24735
24787
|
function bareName(ref) {
|
|
24736
|
-
const
|
|
24737
|
-
const afterNs =
|
|
24788
|
+
const t7 = ref.trim();
|
|
24789
|
+
const afterNs = t7.includes("/preset:") ? t7.slice(t7.indexOf("/preset:") + 8) : t7;
|
|
24738
24790
|
return afterNs.startsWith("preset:") ? afterNs.slice("preset:".length) : afterNs;
|
|
24739
24791
|
}
|
|
24740
24792
|
function pickTargets(explicit, ctx) {
|
|
24741
24793
|
if (explicit && explicit.length > 0)
|
|
24742
24794
|
return explicit;
|
|
24743
|
-
const detected = adapters.filter((
|
|
24795
|
+
const detected = adapters.filter((a8) => a8.detect(ctx)).map((a8) => a8.id);
|
|
24744
24796
|
return detected.length > 0 ? detected : ["opencode"];
|
|
24745
24797
|
}
|
|
24746
24798
|
function configScope(scope) {
|
|
@@ -24777,7 +24829,7 @@ var TARGET_DIR_DEFAULTS = {
|
|
|
24777
24829
|
};
|
|
24778
24830
|
async function prune(opts) {
|
|
24779
24831
|
const { ctx } = opts;
|
|
24780
|
-
const targetIds = opts.targets && opts.targets.length > 0 ? opts.targets : adapters.filter((
|
|
24832
|
+
const targetIds = opts.targets && opts.targets.length > 0 ? opts.targets : adapters.filter((a8) => a8.detect(ctx)).map((a8) => a8.id);
|
|
24781
24833
|
const seenBase = new Set;
|
|
24782
24834
|
const victims = [];
|
|
24783
24835
|
for (const id of targetIds) {
|
|
@@ -24883,7 +24935,7 @@ function unmirroredEntries(base, singular) {
|
|
|
24883
24935
|
const singularEntries = readdirSync2(join15(base, singular));
|
|
24884
24936
|
const pluralDir = join15(base, `${singular}s`);
|
|
24885
24937
|
const pluralEntries = new Set(existsSync13(pluralDir) ? readdirSync2(pluralDir) : []);
|
|
24886
|
-
return singularEntries.filter((
|
|
24938
|
+
return singularEntries.filter((n8) => !pluralEntries.has(n8));
|
|
24887
24939
|
} catch {
|
|
24888
24940
|
return [];
|
|
24889
24941
|
}
|
|
@@ -25041,7 +25093,7 @@ function flatten(raw) {
|
|
|
25041
25093
|
});
|
|
25042
25094
|
}
|
|
25043
25095
|
}
|
|
25044
|
-
return out.sort((
|
|
25096
|
+
return out.sort((a8, b5) => a8.id.localeCompare(b5.id));
|
|
25045
25097
|
}
|
|
25046
25098
|
function readLocalCache() {
|
|
25047
25099
|
for (const path2 of cacheCandidates()) {
|
|
@@ -25100,7 +25152,7 @@ async function getModelsFor(projectDir) {
|
|
|
25100
25152
|
const providers = connectedProviders(projectDir);
|
|
25101
25153
|
if (providers.size === 0)
|
|
25102
25154
|
return { models: all, connected: false };
|
|
25103
|
-
const scoped = all.filter((
|
|
25155
|
+
const scoped = all.filter((m6) => providers.has(providerOf(m6.id)));
|
|
25104
25156
|
if (scoped.length === 0)
|
|
25105
25157
|
return { models: all, connected: false };
|
|
25106
25158
|
return { models: scoped, connected: true };
|
|
@@ -25230,8 +25282,8 @@ async function startUiServer(opts) {
|
|
|
25230
25282
|
let reqCtx;
|
|
25231
25283
|
try {
|
|
25232
25284
|
reqCtx = resolveProject(ctx, url2.searchParams.get("project"));
|
|
25233
|
-
} catch (
|
|
25234
|
-
return json2({ error:
|
|
25285
|
+
} catch (e6) {
|
|
25286
|
+
return json2({ error: e6.message }, 400);
|
|
25235
25287
|
}
|
|
25236
25288
|
return await api2(path2, req, reqCtx, shutdownToken);
|
|
25237
25289
|
}
|
|
@@ -25400,13 +25452,13 @@ function pickDefaultPreset(presets) {
|
|
|
25400
25452
|
return presets.some((p6) => p6.name === RECOMMENDED_PRESET) ? RECOMMENDED_PRESET : presets[0]?.name ?? RECOMMENDED_PRESET;
|
|
25401
25453
|
}
|
|
25402
25454
|
async function getCatalog(ctx) {
|
|
25403
|
-
const detected = adapters.filter((
|
|
25455
|
+
const detected = adapters.filter((a8) => a8.detect(ctx)).map((a8) => a8.id);
|
|
25404
25456
|
const seedTargets = detected.length > 0 ? detected : ["opencode"];
|
|
25405
25457
|
const sources = builtinSources(ctx, seedTargets);
|
|
25406
25458
|
const index = (await sources.defaultIndex()).index;
|
|
25407
|
-
const byType = (type) => index.items.filter((i9) => i9.type === type).sort((
|
|
25459
|
+
const byType = (type) => index.items.filter((i9) => i9.type === type).sort((a8, b5) => a8.name.localeCompare(b5.name));
|
|
25408
25460
|
const asItems = (type) => byType(type).map((i9) => ({ name: i9.name, label: i9.title, description: i9.description }));
|
|
25409
|
-
const presets = asItems("preset").sort((
|
|
25461
|
+
const presets = asItems("preset").sort((a8, b5) => a8.name === RECOMMENDED_PRESET ? -1 : b5.name === RECOMMENDED_PRESET ? 1 : 0);
|
|
25410
25462
|
const mcps = [];
|
|
25411
25463
|
for (const summary of byType("mcp")) {
|
|
25412
25464
|
const manifest = await sources.loadManifest("mcp", summary.name);
|
|
@@ -25456,14 +25508,14 @@ async function getCatalog(ctx) {
|
|
|
25456
25508
|
mcps,
|
|
25457
25509
|
lsps: asItems("lsp"),
|
|
25458
25510
|
rules,
|
|
25459
|
-
targets: adapters.map((
|
|
25460
|
-
id:
|
|
25461
|
-
label:
|
|
25462
|
-
detected: detected.includes(
|
|
25511
|
+
targets: adapters.map((a8) => ({
|
|
25512
|
+
id: a8.id,
|
|
25513
|
+
label: a8.label,
|
|
25514
|
+
detected: detected.includes(a8.id)
|
|
25463
25515
|
})),
|
|
25464
25516
|
reasoningEfforts: [...REASONING_EFFORTS],
|
|
25465
25517
|
agentsModes: [
|
|
25466
|
-
...AGENTS_MD_MODES.map((
|
|
25518
|
+
...AGENTS_MD_MODES.map((m6) => ({ value: m6, label: m6 })),
|
|
25467
25519
|
{ value: "off", label: "off" }
|
|
25468
25520
|
],
|
|
25469
25521
|
defaultPreset: pickDefaultPreset(presets),
|
|
@@ -25479,7 +25531,7 @@ var EXTRAS_BUCKET_TYPE = {
|
|
|
25479
25531
|
commands: "command"
|
|
25480
25532
|
};
|
|
25481
25533
|
async function getGraph(ctx) {
|
|
25482
|
-
const detected = adapters.filter((
|
|
25534
|
+
const detected = adapters.filter((a8) => a8.detect(ctx)).map((a8) => a8.id);
|
|
25483
25535
|
const seedTargets = detected.length > 0 ? detected : ["opencode"];
|
|
25484
25536
|
const sources = builtinSources(ctx, seedTargets);
|
|
25485
25537
|
const index = (await sources.defaultIndex()).index;
|
|
@@ -25573,7 +25625,7 @@ async function getState(ctx) {
|
|
|
25573
25625
|
return out;
|
|
25574
25626
|
}
|
|
25575
25627
|
async function computeExtras(ctx, lock, presetNames, modelPack, config2) {
|
|
25576
|
-
const refs = presetNames.map((
|
|
25628
|
+
const refs = presetNames.map((n8) => `preset:${n8}`);
|
|
25577
25629
|
if (modelPack)
|
|
25578
25630
|
refs.push(`pack:${modelPack}`);
|
|
25579
25631
|
const covered = new Set(refs);
|
|
@@ -25597,7 +25649,7 @@ async function computeExtras(ctx, lock, presetNames, modelPack, config2) {
|
|
|
25597
25649
|
let missingSet;
|
|
25598
25650
|
try {
|
|
25599
25651
|
const { missing } = await sources.partitionRefs(candidates);
|
|
25600
|
-
missingSet = new Set(missing.map((
|
|
25652
|
+
missingSet = new Set(missing.map((m6) => m6.ref));
|
|
25601
25653
|
} catch {
|
|
25602
25654
|
return { extras: candidates, dropped: [] };
|
|
25603
25655
|
}
|
|
@@ -25627,18 +25679,18 @@ function extractOpencodeFiles(plans) {
|
|
|
25627
25679
|
const opencode2 = plans.find((p6) => p6.target === "opencode");
|
|
25628
25680
|
let opencodeJson = "";
|
|
25629
25681
|
let agentsMd = null;
|
|
25630
|
-
for (const
|
|
25631
|
-
const base =
|
|
25682
|
+
for (const a8 of opencode2?.actions ?? []) {
|
|
25683
|
+
const base = a8.path.split(/[\\/]/).pop() ?? a8.path;
|
|
25632
25684
|
if (base === "opencode.json") {
|
|
25633
|
-
if (
|
|
25634
|
-
opencodeJson = JSON.stringify(
|
|
25635
|
-
else if (
|
|
25636
|
-
opencodeJson =
|
|
25685
|
+
if (a8.kind === "merge-json")
|
|
25686
|
+
opencodeJson = JSON.stringify(a8.value, null, 2);
|
|
25687
|
+
else if (a8.kind === "write")
|
|
25688
|
+
opencodeJson = a8.content;
|
|
25637
25689
|
} else if (base === "AGENTS.md") {
|
|
25638
|
-
if (
|
|
25639
|
-
agentsMd =
|
|
25640
|
-
else if (
|
|
25641
|
-
agentsMd =
|
|
25690
|
+
if (a8.kind === "append-block")
|
|
25691
|
+
agentsMd = a8.content;
|
|
25692
|
+
else if (a8.kind === "write")
|
|
25693
|
+
agentsMd = a8.content;
|
|
25642
25694
|
}
|
|
25643
25695
|
}
|
|
25644
25696
|
return { opencodeJson, agentsMd };
|
|
@@ -25695,7 +25747,7 @@ async function runInstall(sources, state, items, ctx) {
|
|
|
25695
25747
|
const stale = computeStaleItems(lock, newRefs);
|
|
25696
25748
|
const prunedConfig = new Set;
|
|
25697
25749
|
const removed = stale.length > 0 ? executePrune(stale, ctx.projectDir, newItems, prunedConfig) : new Set;
|
|
25698
|
-
const files = results.filter((
|
|
25750
|
+
const files = results.filter((r8) => r8.status === "created" || r8.status === "updated").map((r8) => ({ path: relative7(ctx.projectDir, r8.action.path), status: r8.status }));
|
|
25699
25751
|
for (const { ref, path: path2 } of computeStaleDeletions(stale, newItems)) {
|
|
25700
25752
|
if (!removed.has(ref))
|
|
25701
25753
|
continue;
|
|
@@ -25894,8 +25946,8 @@ function pruneStaleArtifacts(oldLock, newItems, updatedRefs, projectDir) {
|
|
|
25894
25946
|
...oldLock.items.filter((i9) => !updatedRefs.has(i9.ref))
|
|
25895
25947
|
];
|
|
25896
25948
|
const keepBlocks = new Set(surviving.flatMap((i9) => (i9.blocks ?? []).map((b5) => `${lockPathKey(b5)}\x00${b5.marker}`)));
|
|
25897
|
-
const keepJson = new Set(surviving.flatMap((i9) => (i9.jsonEntries ?? []).map((
|
|
25898
|
-
const keepObjects = new Set(surviving.flatMap((i9) => (i9.objectEntries ?? []).map((
|
|
25949
|
+
const keepJson = new Set(surviving.flatMap((i9) => (i9.jsonEntries ?? []).map((e6) => `${lockPathKey(e6)}\x00${e6.key}\x00${e6.value}`)));
|
|
25950
|
+
const keepObjects = new Set(surviving.flatMap((i9) => (i9.objectEntries ?? []).map((e6) => `${lockPathKey(e6)}\x00${e6.key}\x00${e6.subKey}`)));
|
|
25899
25951
|
const keepFiles = new Set(surviving.flatMap((i9) => i9.files.map(lockPathKey)));
|
|
25900
25952
|
const staleBlocks = [];
|
|
25901
25953
|
const staleAssets = [];
|
|
@@ -25913,15 +25965,15 @@ function pruneStaleArtifacts(oldLock, newItems, updatedRefs, projectDir) {
|
|
|
25913
25965
|
if (file2.sideAsset && !keepFiles.has(lockPathKey(file2)))
|
|
25914
25966
|
staleAssets.push(file2);
|
|
25915
25967
|
}
|
|
25916
|
-
for (const
|
|
25917
|
-
const key = `${lockPathKey(
|
|
25968
|
+
for (const e6 of old.jsonEntries ?? []) {
|
|
25969
|
+
const key = `${lockPathKey(e6)}\x00${e6.key}\x00${e6.value}`;
|
|
25918
25970
|
if (!keepJson.has(key))
|
|
25919
|
-
staleJson.push(
|
|
25971
|
+
staleJson.push(e6);
|
|
25920
25972
|
}
|
|
25921
|
-
for (const
|
|
25922
|
-
const key = `${lockPathKey(
|
|
25973
|
+
for (const e6 of old.objectEntries ?? []) {
|
|
25974
|
+
const key = `${lockPathKey(e6)}\x00${e6.key}\x00${e6.subKey}`;
|
|
25923
25975
|
if (!keepObjects.has(key))
|
|
25924
|
-
staleObjects.push(
|
|
25976
|
+
staleObjects.push(e6);
|
|
25925
25977
|
}
|
|
25926
25978
|
}
|
|
25927
25979
|
for (const blocks of groupLockBlocks(staleBlocks).values()) {
|
|
@@ -26015,7 +26067,7 @@ function lockedTextRefs(lock) {
|
|
|
26015
26067
|
return lock.items.filter((i9) => !i9.ref.includes("#")).map((i9) => i9.ref);
|
|
26016
26068
|
}
|
|
26017
26069
|
function staleLockFiles(lock, plans, projectDir, updatedRefs) {
|
|
26018
|
-
const planned = new Set(plans.flatMap((p6) => p6.actions).filter((
|
|
26070
|
+
const planned = new Set(plans.flatMap((p6) => p6.actions).filter((a8) => a8.kind === "write").map((a8) => lockPathKey(normalizeLockPath(a8.path, projectDir))));
|
|
26019
26071
|
const surviving = new Set(lock.items.filter((item) => !updatedRefs.has(item.ref)).flatMap((item) => item.files.map(lockPathKey)));
|
|
26020
26072
|
const stale = new Map;
|
|
26021
26073
|
for (const item of lock.items) {
|
|
@@ -26067,11 +26119,11 @@ function formatArgv(argv) {
|
|
|
26067
26119
|
async function handleMissingRefs(missing, targetRefs, lock, opts) {
|
|
26068
26120
|
console.log(pc12.yellow(`
|
|
26069
26121
|
${missing.length} locked item(s) no longer in their registry:`));
|
|
26070
|
-
for (const
|
|
26071
|
-
console.log(pc12.yellow(` ${
|
|
26122
|
+
for (const m6 of missing) {
|
|
26123
|
+
console.log(pc12.yellow(` ${m6.ref} \u2014 no longer in registry "${m6.registryLabel}"`));
|
|
26072
26124
|
}
|
|
26073
|
-
const missingRefs = new Set(missing.map((
|
|
26074
|
-
const survivors = targetRefs.filter((
|
|
26125
|
+
const missingRefs = new Set(missing.map((m6) => m6.ref));
|
|
26126
|
+
const survivors = targetRefs.filter((r8) => !missingRefs.has(r8));
|
|
26075
26127
|
const prunable = lock.items.filter((i9) => missingRefs.has(i9.ref));
|
|
26076
26128
|
const remaining = lock.items.filter((i9) => !missingRefs.has(i9.ref));
|
|
26077
26129
|
if (prunable.length === 0)
|
|
@@ -26117,7 +26169,7 @@ init_types();
|
|
|
26117
26169
|
// package.json
|
|
26118
26170
|
var package_default = {
|
|
26119
26171
|
name: "use-agentz",
|
|
26120
|
-
version: "0.1.
|
|
26172
|
+
version: "0.1.1",
|
|
26121
26173
|
description: "AgentZ is a Bun-native AI agent setup builder.",
|
|
26122
26174
|
type: "module",
|
|
26123
26175
|
bin: {
|
|
@@ -26151,21 +26203,21 @@ var package_default = {
|
|
|
26151
26203
|
},
|
|
26152
26204
|
devDependencies: {
|
|
26153
26205
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
26154
|
-
"@opencode-ai/plugin": "^1.
|
|
26206
|
+
"@opencode-ai/plugin": "^1.18.4",
|
|
26155
26207
|
"@types/bun": "^1.3.14",
|
|
26156
|
-
"@types/react": "^19.
|
|
26157
|
-
"@types/react-dom": "^19.
|
|
26208
|
+
"@types/react": "^19.2.17",
|
|
26209
|
+
"@types/react-dom": "^19.2.3",
|
|
26158
26210
|
"pdf-lib": "^1.17.1",
|
|
26159
26211
|
pptxgenjs: "^4.0.1",
|
|
26160
|
-
typescript: "^
|
|
26212
|
+
typescript: "^7.0.2"
|
|
26161
26213
|
},
|
|
26162
26214
|
dependencies: {
|
|
26163
26215
|
"@base-ui-components/react": "^1.0.0-rc.0",
|
|
26164
|
-
"@clack/prompts": "^1.
|
|
26216
|
+
"@clack/prompts": "^1.7.0",
|
|
26165
26217
|
confbox: "^0.2.4",
|
|
26166
26218
|
picocolors: "^1.1.1",
|
|
26167
|
-
react: "^19.
|
|
26168
|
-
"react-dom": "^19.
|
|
26219
|
+
react: "^19.2.8",
|
|
26220
|
+
"react-dom": "^19.2.8",
|
|
26169
26221
|
zod: "^4.4.3"
|
|
26170
26222
|
}
|
|
26171
26223
|
};
|