create-mastra 1.34.3-alpha.3 → 1.34.3-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{api-C943QZP2-DFG4x1Vg.js → api-C943QZP2-BYQPfDc3.js} +1 -1
- package/dist/api-CmMjRD3d-Clo6rltu.js +2 -0
- package/dist/{client-CjwEyp8q-BKiCNR2M.js → client-CjwEyp8q-CmXqEtbF.js} +1 -1
- package/dist/{credentials-DOGNs6Oq-BZEdZ4jK.js → credentials-DOGNs6Oq-CNi90c5S.js} +1 -1
- package/dist/{credentials-DSp55v-D-Cp45w0Gg.js → credentials-DSp55v-D-MNcatpqE.js} +115 -91
- package/dist/index.js +4089 -1997
- package/package.json +4 -5
- package/dist/api-CmMjRD3d-C_qR7hsZ.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as throwApiError, r as createApiClient } from "./client-CjwEyp8q-
|
|
1
|
+
import { a as throwApiError, r as createApiClient } from "./client-CjwEyp8q-CmXqEtbF.js";
|
|
2
2
|
//#region ../cli/dist/api-C943QZP2.js
|
|
3
3
|
async function fetchOrgs(token) {
|
|
4
4
|
const { data, error, response } = await createApiClient(token).GET("/v1/auth/orgs");
|
|
@@ -443,7 +443,7 @@ async function authenticatedFetch(input, init) {
|
|
|
443
443
|
if (response.status !== 401 || !_currentToken) return response;
|
|
444
444
|
if (!_refreshInFlight) _refreshInFlight = (async () => {
|
|
445
445
|
try {
|
|
446
|
-
const { tryRefreshToken, loadCredentials } = await import("./credentials-DOGNs6Oq-
|
|
446
|
+
const { tryRefreshToken, loadCredentials } = await import("./credentials-DOGNs6Oq-CNi90c5S.js");
|
|
447
447
|
const creds = await loadCredentials();
|
|
448
448
|
if (!creds) throw new Error("No credentials");
|
|
449
449
|
const newToken = await tryRefreshToken(creds);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as loadCredentials, o as tryRefreshToken } from "./credentials-DSp55v-D-
|
|
1
|
+
import { i as loadCredentials, o as tryRefreshToken } from "./credentials-DSp55v-D-MNcatpqE.js";
|
|
2
2
|
export { loadCredentials, tryRefreshToken };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as MASTRA_PLATFORM_API_URL } from "./client-CjwEyp8q-
|
|
1
|
+
import { t as MASTRA_PLATFORM_API_URL } from "./client-CjwEyp8q-CmXqEtbF.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import "node:path";
|
|
4
4
|
import process$1, { stdin, stdout } from "node:process";
|
|
@@ -318,7 +318,7 @@ function wrapAnsi(string, columns, options) {
|
|
|
318
318
|
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
319
319
|
}
|
|
320
320
|
//#endregion
|
|
321
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@clack/core/1.
|
|
321
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@clack/core/1.5.1/24dbef356d54e18db6b3cfab6de4dafdef8f75bd1bd4366d1da0394c51561b99/node_modules/@clack/core/dist/index.mjs
|
|
322
322
|
var import_src = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
323
323
|
const ESC = "\x1B";
|
|
324
324
|
const CSI = `${ESC}[`;
|
|
@@ -399,6 +399,7 @@ const settings = {
|
|
|
399
399
|
error: "Something went wrong"
|
|
400
400
|
},
|
|
401
401
|
withGuide: true,
|
|
402
|
+
accessible: void 0,
|
|
402
403
|
date: {
|
|
403
404
|
monthNames: [...[
|
|
404
405
|
"January",
|
|
@@ -423,6 +424,12 @@ const settings = {
|
|
|
423
424
|
}
|
|
424
425
|
}
|
|
425
426
|
};
|
|
427
|
+
function isAccessible(n) {
|
|
428
|
+
if (n !== void 0) return n;
|
|
429
|
+
if (settings.accessible !== void 0) return settings.accessible;
|
|
430
|
+
const e = process.env.ACCESSIBLE;
|
|
431
|
+
return e !== void 0 && e !== "" && e !== "0" && e !== "false";
|
|
432
|
+
}
|
|
426
433
|
function isActionKey(n, e) {
|
|
427
434
|
if (typeof n == "string") return settings.aliases.get(n) === e;
|
|
428
435
|
for (const s of n) if (s !== void 0 && isActionKey(s, e)) return true;
|
|
@@ -450,7 +457,7 @@ function setRawMode(e, r) {
|
|
|
450
457
|
const o = e;
|
|
451
458
|
o.isTTY && o.setRawMode(r);
|
|
452
459
|
}
|
|
453
|
-
function block({ input: e = stdin, output: r = stdout, overwrite: o = true, hideCursor:
|
|
460
|
+
function block({ input: e = stdin, output: r = stdout, overwrite: o = true, hideCursor: n = true } = {}) {
|
|
454
461
|
const s = l.createInterface({
|
|
455
462
|
input: e,
|
|
456
463
|
output: r,
|
|
@@ -458,49 +465,48 @@ function block({ input: e = stdin, output: r = stdout, overwrite: o = true, hide
|
|
|
458
465
|
tabSize: 1
|
|
459
466
|
});
|
|
460
467
|
l.emitKeypressEvents(e, s), e instanceof ReadStream && e.isTTY && e.setRawMode(true);
|
|
461
|
-
const
|
|
468
|
+
const t = (f, { name: a, sequence: w }) => {
|
|
462
469
|
if (isActionKey([
|
|
463
470
|
String(f),
|
|
464
471
|
a,
|
|
465
|
-
|
|
472
|
+
w
|
|
466
473
|
], "cancel")) {
|
|
467
|
-
|
|
474
|
+
n && r.write(import_src.cursor.show), process.exit(0);
|
|
468
475
|
return;
|
|
469
476
|
}
|
|
470
477
|
if (!o) return;
|
|
471
478
|
const i = a === "return" ? 0 : -1, m = a === "return" ? -1 : 0;
|
|
472
479
|
l.moveCursor(r, i, m, () => {
|
|
473
480
|
l.clearLine(r, 1, () => {
|
|
474
|
-
e.once("keypress",
|
|
481
|
+
e.once("keypress", t);
|
|
475
482
|
});
|
|
476
483
|
});
|
|
477
484
|
};
|
|
478
|
-
return
|
|
479
|
-
e.off("keypress",
|
|
485
|
+
return n && r.write(import_src.cursor.hide), e.once("keypress", t), () => {
|
|
486
|
+
e.off("keypress", t), n && r.write(import_src.cursor.show), e instanceof ReadStream && e.isTTY && !R && e.setRawMode(false), s.terminal = false, s.close();
|
|
480
487
|
};
|
|
481
488
|
}
|
|
482
489
|
const getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
|
|
483
490
|
const getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
|
|
484
|
-
function wrapTextWithPrefix(e, r, o,
|
|
491
|
+
function wrapTextWithPrefix(e, r, o, n = o, s = o, t) {
|
|
485
492
|
return wrapAnsi(r, getColumns(e ?? stdout) - o.length, {
|
|
486
493
|
hard: true,
|
|
487
494
|
trim: false
|
|
488
495
|
}).split(`
|
|
489
496
|
`).map((c, i, m) => {
|
|
490
|
-
const d =
|
|
491
|
-
return i === 0 ? `${
|
|
497
|
+
const d = t ? t(c, i) : c;
|
|
498
|
+
return i === 0 ? `${n}${d}` : i === m.length - 1 ? `${s}${d}` : `${o}${d}`;
|
|
492
499
|
}).join(`
|
|
493
500
|
`);
|
|
494
501
|
}
|
|
495
|
-
function runValidation(e,
|
|
502
|
+
function runValidation(e, a) {
|
|
496
503
|
if ("~standard" in e) {
|
|
497
|
-
const
|
|
498
|
-
|
|
499
|
-
return a.issues?.at(0)?.message;
|
|
504
|
+
const n = e["~standard"].validate(a);
|
|
505
|
+
return n instanceof Promise ? n.then((r) => r.issues?.at(0)?.message) : n.issues?.at(0)?.message;
|
|
500
506
|
}
|
|
501
|
-
return e(
|
|
507
|
+
return e(a);
|
|
502
508
|
}
|
|
503
|
-
var
|
|
509
|
+
var y = class {
|
|
504
510
|
input;
|
|
505
511
|
output;
|
|
506
512
|
_abortSignal;
|
|
@@ -515,9 +521,17 @@ var V = class {
|
|
|
515
521
|
error = "";
|
|
516
522
|
value;
|
|
517
523
|
userInput = "";
|
|
524
|
+
/**
|
|
525
|
+
* Whether accessible (static, screen-reader friendly) output is enabled for
|
|
526
|
+
* this prompt, resolved from the `accessible` option, the global setting,
|
|
527
|
+
* and the `ACCESSIBLE` env var.
|
|
528
|
+
*/
|
|
529
|
+
get accessible() {
|
|
530
|
+
return isAccessible(this.opts.accessible);
|
|
531
|
+
}
|
|
518
532
|
constructor(t, e = true) {
|
|
519
|
-
const { input: i = stdin, output:
|
|
520
|
-
this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render =
|
|
533
|
+
const { input: i = stdin, output: s = stdout, render: r, signal: n, ...o } = t;
|
|
534
|
+
this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = r.bind(this), this._track = e, this._abortSignal = n, this.input = i, this.output = s;
|
|
521
535
|
}
|
|
522
536
|
/**
|
|
523
537
|
* Unsubscribe all listeners
|
|
@@ -558,9 +572,9 @@ var V = class {
|
|
|
558
572
|
* @param data - The data to pass to the callback
|
|
559
573
|
*/
|
|
560
574
|
emit(t, ...e) {
|
|
561
|
-
const i = this._subscribers.get(t) ?? [],
|
|
562
|
-
for (const
|
|
563
|
-
for (const
|
|
575
|
+
const i = this._subscribers.get(t) ?? [], s = [];
|
|
576
|
+
for (const r of i) r.cb(...e), r.once && s.push(() => i.splice(i.indexOf(r), 1));
|
|
577
|
+
for (const r of s) r();
|
|
564
578
|
}
|
|
565
579
|
prompt() {
|
|
566
580
|
return new Promise((t) => {
|
|
@@ -601,22 +615,25 @@ var V = class {
|
|
|
601
615
|
name: "u"
|
|
602
616
|
}), this._setUserInput("");
|
|
603
617
|
}
|
|
604
|
-
onKeypress(t, e) {
|
|
605
|
-
if (this.
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
618
|
+
async onKeypress(t, e) {
|
|
619
|
+
if (this.state !== "validating") {
|
|
620
|
+
if (this._track && e.name !== "return" && (e.name && this._isActionKey(t, e) && this.rl?.write(null, {
|
|
621
|
+
ctrl: true,
|
|
622
|
+
name: "h"
|
|
623
|
+
}), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit("cursor", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit("cursor", e.name)), t && (t.toLowerCase() === "y" || t.toLowerCase() === "n") && this.emit("confirm", t.toLowerCase() === "y"), this.emit("key", t, e), e?.name === "return" && this._shouldSubmit(t, e)) {
|
|
624
|
+
if (this.opts.validate) {
|
|
625
|
+
const i = runValidation(this.opts.validate, this.value);
|
|
626
|
+
let s;
|
|
627
|
+
i instanceof Promise ? (this.state = "validating", this.render(), s = await i) : s = i, s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
|
|
628
|
+
}
|
|
629
|
+
this.state !== "error" && (this.state = "submit");
|
|
612
630
|
}
|
|
613
|
-
|
|
631
|
+
isActionKey([
|
|
632
|
+
t,
|
|
633
|
+
e?.name,
|
|
634
|
+
e?.sequence
|
|
635
|
+
], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
614
636
|
}
|
|
615
|
-
isActionKey([
|
|
616
|
-
t,
|
|
617
|
-
e?.name,
|
|
618
|
-
e?.sequence
|
|
619
|
-
], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
620
637
|
}
|
|
621
638
|
close() {
|
|
622
639
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
@@ -640,27 +657,27 @@ var V = class {
|
|
|
640
657
|
else {
|
|
641
658
|
const e = diffLines(this._prevFrame, t), i = getRows(this.output);
|
|
642
659
|
if (this.restoreCursor(), e) {
|
|
643
|
-
const
|
|
644
|
-
let
|
|
645
|
-
if (
|
|
660
|
+
const s = Math.max(0, e.numLinesAfter - i), r = Math.max(0, e.numLinesBefore - i);
|
|
661
|
+
let n = e.lines.find((o) => o >= s);
|
|
662
|
+
if (n === void 0) {
|
|
646
663
|
this._prevFrame = t;
|
|
647
664
|
return;
|
|
648
665
|
}
|
|
649
666
|
if (e.lines.length === 1) {
|
|
650
|
-
this.output.write(import_src.cursor.move(0,
|
|
667
|
+
this.output.write(import_src.cursor.move(0, n - r)), this.output.write(import_src.erase.lines(1));
|
|
651
668
|
const o = t.split(`
|
|
652
669
|
`);
|
|
653
|
-
this.output.write(o[
|
|
670
|
+
this.output.write(o[n]), this._prevFrame = t, this.output.write(import_src.cursor.move(0, o.length - n - 1));
|
|
654
671
|
return;
|
|
655
672
|
} else if (e.lines.length > 1) {
|
|
656
|
-
if (
|
|
673
|
+
if (s < r) n = s;
|
|
657
674
|
else {
|
|
658
|
-
const h =
|
|
675
|
+
const h = n - r;
|
|
659
676
|
h > 0 && this.output.write(import_src.cursor.move(0, h));
|
|
660
677
|
}
|
|
661
678
|
this.output.write(import_src.erase.down());
|
|
662
679
|
const f = t.split(`
|
|
663
|
-
`).slice(
|
|
680
|
+
`).slice(n);
|
|
664
681
|
this.output.write(f.join(`
|
|
665
682
|
`)), this._prevFrame = t;
|
|
666
683
|
return;
|
|
@@ -672,7 +689,7 @@ var V = class {
|
|
|
672
689
|
}
|
|
673
690
|
}
|
|
674
691
|
};
|
|
675
|
-
let u$1 = class u extends
|
|
692
|
+
let u$1 = class u extends y {
|
|
676
693
|
_mask = "•";
|
|
677
694
|
get cursor() {
|
|
678
695
|
return this._cursor;
|
|
@@ -698,7 +715,7 @@ let u$1 = class u extends V {
|
|
|
698
715
|
});
|
|
699
716
|
}
|
|
700
717
|
};
|
|
701
|
-
let n$1 = class n extends
|
|
718
|
+
let n$1 = class n extends y {
|
|
702
719
|
options;
|
|
703
720
|
cursor = 0;
|
|
704
721
|
get _selectedValue() {
|
|
@@ -726,7 +743,7 @@ let n$1 = class n extends V {
|
|
|
726
743
|
});
|
|
727
744
|
}
|
|
728
745
|
};
|
|
729
|
-
var n = class extends
|
|
746
|
+
var n = class extends y {
|
|
730
747
|
get userInputWithCursor() {
|
|
731
748
|
if (this.state === "submit") return this.userInput;
|
|
732
749
|
const t = this.userInput;
|
|
@@ -749,7 +766,7 @@ var n = class extends V {
|
|
|
749
766
|
}
|
|
750
767
|
};
|
|
751
768
|
//#endregion
|
|
752
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@clack/prompts/1.
|
|
769
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@clack/prompts/1.8.1/084b8653d627633f7deced264e8f28e7c2481bb2dde0804f7f5aee6b0184add2/node_modules/@clack/prompts/dist/index.mjs
|
|
753
770
|
function isUnicodeSupported() {
|
|
754
771
|
if (process$1.platform !== "win32") return process$1.env.TERM !== "linux";
|
|
755
772
|
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";
|
|
@@ -782,6 +799,7 @@ const symbol = (o) => {
|
|
|
782
799
|
case "cancel": return styleText("red", S_STEP_CANCEL);
|
|
783
800
|
case "error": return styleText("yellow", S_STEP_ERROR);
|
|
784
801
|
case "submit": return styleText("green", S_STEP_SUBMIT);
|
|
802
|
+
case "validating": return styleText("dim", S_STEP_ACTIVE);
|
|
785
803
|
}
|
|
786
804
|
};
|
|
787
805
|
const symbolBar = (o) => {
|
|
@@ -931,29 +949,29 @@ ${h}
|
|
|
931
949
|
${styleText("gray", l$1 + S_BAR_H.repeat(t + 2) + S_CORNER_BOTTOM_RIGHT)}
|
|
932
950
|
`);
|
|
933
951
|
};
|
|
934
|
-
const password = (
|
|
935
|
-
validate:
|
|
936
|
-
mask:
|
|
937
|
-
signal:
|
|
938
|
-
input:
|
|
939
|
-
output:
|
|
952
|
+
const password = (e) => new u$1({
|
|
953
|
+
validate: e.validate,
|
|
954
|
+
mask: e.mask ?? S_PASSWORD_MASK,
|
|
955
|
+
signal: e.signal,
|
|
956
|
+
input: e.input,
|
|
957
|
+
output: e.output,
|
|
940
958
|
render() {
|
|
941
|
-
const
|
|
942
|
-
` : ""}${symbol(this.state)} ${
|
|
943
|
-
`,
|
|
959
|
+
const r = e.withGuide ?? settings.withGuide, o = `${r ? `${styleText("gray", S_BAR)}
|
|
960
|
+
` : ""}${symbol(this.state)} ${e.message}
|
|
961
|
+
`, m = this.userInputWithCursor, i = this.masked;
|
|
944
962
|
switch (this.state) {
|
|
945
963
|
case "error": {
|
|
946
|
-
const s =
|
|
947
|
-
return
|
|
948
|
-
${s}${
|
|
964
|
+
const s = r ? `${styleText("yellow", S_BAR)} ` : "", n = r ? `${styleText("yellow", S_BAR_END)} ` : "", d = i ?? "";
|
|
965
|
+
return e.clearOnError && this.clear(), `${o.trim()}
|
|
966
|
+
${s}${d}
|
|
949
967
|
${n}${styleText("yellow", this.error)}
|
|
950
968
|
`;
|
|
951
969
|
}
|
|
952
|
-
case "submit": return `${o}${
|
|
953
|
-
case "cancel": return `${o}${
|
|
970
|
+
case "submit": return `${o}${r ? `${styleText("gray", S_BAR)} ` : ""}${i ? styleText("dim", i) : ""}`;
|
|
971
|
+
case "cancel": return `${o}${r ? `${styleText("gray", S_BAR)} ` : ""}${i ? styleText(["strikethrough", "dim"], i) : ""}${i && r ? `
|
|
954
972
|
${styleText("gray", S_BAR)}` : ""}`;
|
|
955
|
-
default: return `${o}${
|
|
956
|
-
${
|
|
973
|
+
default: return `${o}${r ? `${styleText("cyan", S_BAR)} ` : ""}${m}
|
|
974
|
+
${r ? styleText("cyan", S_BAR_END) : ""}
|
|
957
975
|
`;
|
|
958
976
|
}
|
|
959
977
|
}
|
|
@@ -1074,19 +1092,19 @@ ${styleText("gray", S_BAR)}` : ""}`;
|
|
|
1074
1092
|
}
|
|
1075
1093
|
default: {
|
|
1076
1094
|
const r = n ? `${styleText("cyan", S_BAR)} ` : "", a = u.split(`
|
|
1077
|
-
`).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n) : n ? [styleText("cyan", S_BAR_END)] : [],
|
|
1078
|
-
`),
|
|
1095
|
+
`).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n) : n ? [styleText("cyan", S_BAR_END)] : [], f = p.join(`
|
|
1096
|
+
`), b = p.length + 1;
|
|
1079
1097
|
return `${u}${r}${limitOptions({
|
|
1080
1098
|
output: t.output,
|
|
1081
1099
|
cursor: this.cursor,
|
|
1082
1100
|
options: this.options,
|
|
1083
1101
|
maxItems: t.maxItems,
|
|
1084
1102
|
columnPadding: r.length,
|
|
1085
|
-
rowPadding: a +
|
|
1103
|
+
rowPadding: a + b,
|
|
1086
1104
|
style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
|
|
1087
1105
|
}).join(`
|
|
1088
1106
|
${r}`)}
|
|
1089
|
-
${
|
|
1107
|
+
${f}
|
|
1090
1108
|
`;
|
|
1091
1109
|
}
|
|
1092
1110
|
}
|
|
@@ -1094,37 +1112,43 @@ ${b}
|
|
|
1094
1112
|
}).prompt();
|
|
1095
1113
|
};
|
|
1096
1114
|
`${styleText("gray", S_BAR)}`;
|
|
1097
|
-
const text = (
|
|
1098
|
-
validate:
|
|
1099
|
-
placeholder:
|
|
1100
|
-
defaultValue:
|
|
1101
|
-
initialValue:
|
|
1102
|
-
output:
|
|
1103
|
-
signal:
|
|
1104
|
-
input:
|
|
1115
|
+
const text = (t) => new n({
|
|
1116
|
+
validate: t.validate,
|
|
1117
|
+
placeholder: t.placeholder,
|
|
1118
|
+
defaultValue: t.defaultValue,
|
|
1119
|
+
initialValue: t.initialValue,
|
|
1120
|
+
output: t.output,
|
|
1121
|
+
signal: t.signal,
|
|
1122
|
+
input: t.input,
|
|
1105
1123
|
render() {
|
|
1106
|
-
const
|
|
1107
|
-
` : ""}${symbol(this.state)} `}${
|
|
1108
|
-
`,
|
|
1124
|
+
const r = t?.withGuide ?? settings.withGuide, l = `${`${r ? `${styleText("gray", S_BAR)}
|
|
1125
|
+
` : ""}${symbol(this.state)} `}${t.message}
|
|
1126
|
+
`, d = t.placeholder && t.placeholder.length > 0 ? styleText("inverse", t.placeholder[0]) + styleText("dim", t.placeholder.slice(1)) : styleText(["inverse", "hidden"], "_"), o = this.userInput ? this.userInputWithCursor : d, s = this.value ?? "";
|
|
1109
1127
|
switch (this.state) {
|
|
1128
|
+
case "validating": {
|
|
1129
|
+
const n = r ? `${styleText("cyan", S_BAR)} ` : "", i = r ? styleText("cyan", S_BAR_END) : "";
|
|
1130
|
+
return `${l}${n}${styleText("dim", o)}
|
|
1131
|
+
${i} ${styleText("dim", "Validating...")}
|
|
1132
|
+
`;
|
|
1133
|
+
}
|
|
1110
1134
|
case "error": {
|
|
1111
|
-
const n = this.error ? ` ${styleText("yellow", this.error)}` : "",
|
|
1112
|
-
return `${
|
|
1113
|
-
${
|
|
1114
|
-
${
|
|
1135
|
+
const n = this.error ? ` ${styleText("yellow", this.error)}` : "", i = r ? `${styleText("yellow", S_BAR)} ` : "", c = r ? styleText("yellow", S_BAR_END) : "";
|
|
1136
|
+
return `${l.trim()}
|
|
1137
|
+
${i}${o}
|
|
1138
|
+
${c}${n}
|
|
1115
1139
|
`;
|
|
1116
1140
|
}
|
|
1117
1141
|
case "submit": {
|
|
1118
|
-
const n =
|
|
1119
|
-
return `${
|
|
1142
|
+
const n = s ? `${r ? " " : ""}${styleText("dim", s)}` : "";
|
|
1143
|
+
return `${l}${r ? styleText("gray", S_BAR) : ""}${n}`;
|
|
1120
1144
|
}
|
|
1121
1145
|
case "cancel": {
|
|
1122
|
-
const n =
|
|
1123
|
-
return `${
|
|
1124
|
-
${
|
|
1146
|
+
const n = s ? ` ${styleText(["strikethrough", "dim"], s)}` : "", i = r ? styleText("gray", S_BAR) : "";
|
|
1147
|
+
return `${l}${i}${n}${s.trim() ? `
|
|
1148
|
+
${i}` : ""}`;
|
|
1125
1149
|
}
|
|
1126
|
-
default: return `${
|
|
1127
|
-
${
|
|
1150
|
+
default: return `${l}${r ? `${styleText("cyan", S_BAR)} ` : ""}${o}
|
|
1151
|
+
${r ? styleText("cyan", S_BAR_END) : ""}
|
|
1128
1152
|
`;
|
|
1129
1153
|
}
|
|
1130
1154
|
}
|