@afroze9/terrastudio-cli 0.47.2 → 0.48.2
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/bundle/cli.cjs +1070 -64
- package/package.json +2 -2
package/bundle/cli.cjs
CHANGED
|
@@ -892,27 +892,27 @@ var require_suggestSimilar = __commonJS({
|
|
|
892
892
|
for (let i = 0; i <= a.length; i++) {
|
|
893
893
|
d[i] = [i];
|
|
894
894
|
}
|
|
895
|
-
for (let
|
|
896
|
-
d[0][
|
|
895
|
+
for (let j2 = 0; j2 <= b.length; j2++) {
|
|
896
|
+
d[0][j2] = j2;
|
|
897
897
|
}
|
|
898
|
-
for (let
|
|
898
|
+
for (let j2 = 1; j2 <= b.length; j2++) {
|
|
899
899
|
for (let i = 1; i <= a.length; i++) {
|
|
900
900
|
let cost = 1;
|
|
901
|
-
if (a[i - 1] === b[
|
|
901
|
+
if (a[i - 1] === b[j2 - 1]) {
|
|
902
902
|
cost = 0;
|
|
903
903
|
} else {
|
|
904
904
|
cost = 1;
|
|
905
905
|
}
|
|
906
|
-
d[i][
|
|
907
|
-
d[i - 1][
|
|
906
|
+
d[i][j2] = Math.min(
|
|
907
|
+
d[i - 1][j2] + 1,
|
|
908
908
|
// deletion
|
|
909
|
-
d[i][
|
|
909
|
+
d[i][j2 - 1] + 1,
|
|
910
910
|
// insertion
|
|
911
|
-
d[i - 1][
|
|
911
|
+
d[i - 1][j2 - 1] + cost
|
|
912
912
|
// substitution
|
|
913
913
|
);
|
|
914
|
-
if (i > 1 &&
|
|
915
|
-
d[i][
|
|
914
|
+
if (i > 1 && j2 > 1 && a[i - 1] === b[j2 - 2] && a[i - 2] === b[j2 - 1]) {
|
|
915
|
+
d[i][j2] = Math.min(d[i][j2], d[i - 2][j2 - 2] + 1);
|
|
916
916
|
}
|
|
917
917
|
}
|
|
918
918
|
}
|
|
@@ -966,7 +966,7 @@ var require_command = __commonJS({
|
|
|
966
966
|
"../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/command.js"(exports2) {
|
|
967
967
|
var EventEmitter = require("node:events").EventEmitter;
|
|
968
968
|
var childProcess = require("node:child_process");
|
|
969
|
-
var
|
|
969
|
+
var path5 = require("node:path");
|
|
970
970
|
var fs2 = require("node:fs");
|
|
971
971
|
var process2 = require("node:process");
|
|
972
972
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
@@ -1899,9 +1899,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1899
1899
|
let launchWithNode = false;
|
|
1900
1900
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1901
1901
|
function findFile(baseDir, baseName) {
|
|
1902
|
-
const localBin =
|
|
1902
|
+
const localBin = path5.resolve(baseDir, baseName);
|
|
1903
1903
|
if (fs2.existsSync(localBin)) return localBin;
|
|
1904
|
-
if (sourceExt.includes(
|
|
1904
|
+
if (sourceExt.includes(path5.extname(baseName))) return void 0;
|
|
1905
1905
|
const foundExt = sourceExt.find(
|
|
1906
1906
|
(ext) => fs2.existsSync(`${localBin}${ext}`)
|
|
1907
1907
|
);
|
|
@@ -1919,17 +1919,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1919
1919
|
} catch (err) {
|
|
1920
1920
|
resolvedScriptPath = this._scriptPath;
|
|
1921
1921
|
}
|
|
1922
|
-
executableDir =
|
|
1923
|
-
|
|
1922
|
+
executableDir = path5.resolve(
|
|
1923
|
+
path5.dirname(resolvedScriptPath),
|
|
1924
1924
|
executableDir
|
|
1925
1925
|
);
|
|
1926
1926
|
}
|
|
1927
1927
|
if (executableDir) {
|
|
1928
1928
|
let localFile = findFile(executableDir, executableFile);
|
|
1929
1929
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
1930
|
-
const legacyName =
|
|
1930
|
+
const legacyName = path5.basename(
|
|
1931
1931
|
this._scriptPath,
|
|
1932
|
-
|
|
1932
|
+
path5.extname(this._scriptPath)
|
|
1933
1933
|
);
|
|
1934
1934
|
if (legacyName !== this._name) {
|
|
1935
1935
|
localFile = findFile(
|
|
@@ -1940,7 +1940,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1940
1940
|
}
|
|
1941
1941
|
executableFile = localFile || executableFile;
|
|
1942
1942
|
}
|
|
1943
|
-
launchWithNode = sourceExt.includes(
|
|
1943
|
+
launchWithNode = sourceExt.includes(path5.extname(executableFile));
|
|
1944
1944
|
let proc;
|
|
1945
1945
|
if (process2.platform !== "win32") {
|
|
1946
1946
|
if (launchWithNode) {
|
|
@@ -2780,7 +2780,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2780
2780
|
* @return {Command}
|
|
2781
2781
|
*/
|
|
2782
2782
|
nameFromFilename(filename) {
|
|
2783
|
-
this._name =
|
|
2783
|
+
this._name = path5.basename(filename, path5.extname(filename));
|
|
2784
2784
|
return this;
|
|
2785
2785
|
}
|
|
2786
2786
|
/**
|
|
@@ -2794,9 +2794,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2794
2794
|
* @param {string} [path]
|
|
2795
2795
|
* @return {(string|null|Command)}
|
|
2796
2796
|
*/
|
|
2797
|
-
executableDir(
|
|
2798
|
-
if (
|
|
2799
|
-
this._executableDir =
|
|
2797
|
+
executableDir(path6) {
|
|
2798
|
+
if (path6 === void 0) return this._executableDir;
|
|
2799
|
+
this._executableDir = path6;
|
|
2800
2800
|
return this;
|
|
2801
2801
|
}
|
|
2802
2802
|
/**
|
|
@@ -3026,6 +3026,62 @@ var require_commander = __commonJS({
|
|
|
3026
3026
|
}
|
|
3027
3027
|
});
|
|
3028
3028
|
|
|
3029
|
+
// ../../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
|
|
3030
|
+
var require_src = __commonJS({
|
|
3031
|
+
"../../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports2, module2) {
|
|
3032
|
+
"use strict";
|
|
3033
|
+
var ESC = "\x1B";
|
|
3034
|
+
var CSI = `${ESC}[`;
|
|
3035
|
+
var beep = "\x07";
|
|
3036
|
+
var cursor = {
|
|
3037
|
+
to(x3, y2) {
|
|
3038
|
+
if (!y2) return `${CSI}${x3 + 1}G`;
|
|
3039
|
+
return `${CSI}${y2 + 1};${x3 + 1}H`;
|
|
3040
|
+
},
|
|
3041
|
+
move(x3, y2) {
|
|
3042
|
+
let ret = "";
|
|
3043
|
+
if (x3 < 0) ret += `${CSI}${-x3}D`;
|
|
3044
|
+
else if (x3 > 0) ret += `${CSI}${x3}C`;
|
|
3045
|
+
if (y2 < 0) ret += `${CSI}${-y2}A`;
|
|
3046
|
+
else if (y2 > 0) ret += `${CSI}${y2}B`;
|
|
3047
|
+
return ret;
|
|
3048
|
+
},
|
|
3049
|
+
up: (count = 1) => `${CSI}${count}A`,
|
|
3050
|
+
down: (count = 1) => `${CSI}${count}B`,
|
|
3051
|
+
forward: (count = 1) => `${CSI}${count}C`,
|
|
3052
|
+
backward: (count = 1) => `${CSI}${count}D`,
|
|
3053
|
+
nextLine: (count = 1) => `${CSI}E`.repeat(count),
|
|
3054
|
+
prevLine: (count = 1) => `${CSI}F`.repeat(count),
|
|
3055
|
+
left: `${CSI}G`,
|
|
3056
|
+
hide: `${CSI}?25l`,
|
|
3057
|
+
show: `${CSI}?25h`,
|
|
3058
|
+
save: `${ESC}7`,
|
|
3059
|
+
restore: `${ESC}8`
|
|
3060
|
+
};
|
|
3061
|
+
var scroll = {
|
|
3062
|
+
up: (count = 1) => `${CSI}S`.repeat(count),
|
|
3063
|
+
down: (count = 1) => `${CSI}T`.repeat(count)
|
|
3064
|
+
};
|
|
3065
|
+
var erase = {
|
|
3066
|
+
screen: `${CSI}2J`,
|
|
3067
|
+
up: (count = 1) => `${CSI}1J`.repeat(count),
|
|
3068
|
+
down: (count = 1) => `${CSI}J`.repeat(count),
|
|
3069
|
+
line: `${CSI}2K`,
|
|
3070
|
+
lineEnd: `${CSI}K`,
|
|
3071
|
+
lineStart: `${CSI}1K`,
|
|
3072
|
+
lines(count) {
|
|
3073
|
+
let clear = "";
|
|
3074
|
+
for (let i = 0; i < count; i++)
|
|
3075
|
+
clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
3076
|
+
if (count)
|
|
3077
|
+
clear += cursor.left;
|
|
3078
|
+
return clear;
|
|
3079
|
+
}
|
|
3080
|
+
};
|
|
3081
|
+
module2.exports = { cursor, scroll, erase, beep };
|
|
3082
|
+
}
|
|
3083
|
+
});
|
|
3084
|
+
|
|
3029
3085
|
// ../core/dist/lib/diagram/edge-rules.js
|
|
3030
3086
|
var EdgeRuleValidator;
|
|
3031
3087
|
var init_edge_rules = __esm({
|
|
@@ -3046,7 +3102,7 @@ var init_edge_rules = __esm({
|
|
|
3046
3102
|
if (matchingRule) {
|
|
3047
3103
|
return { valid: true, rule: matchingRule };
|
|
3048
3104
|
}
|
|
3049
|
-
if (sourceHandle.startsWith("out-") && this.outputAcceptingHandles.some((
|
|
3105
|
+
if (sourceHandle.startsWith("out-") && this.outputAcceptingHandles.some((h2) => h2.targetType === targetType && h2.targetHandle === targetHandle)) {
|
|
3050
3106
|
const sourceAttribute = sourceHandle.slice(4);
|
|
3051
3107
|
return {
|
|
3052
3108
|
valid: true,
|
|
@@ -3072,13 +3128,13 @@ var init_edge_rules = __esm({
|
|
|
3072
3128
|
const results = this.rules.filter((rule) => rule.sourceType === sourceType && rule.sourceHandle === sourceHandle);
|
|
3073
3129
|
if (sourceHandle.startsWith("out-")) {
|
|
3074
3130
|
const sourceAttribute = sourceHandle.slice(4);
|
|
3075
|
-
for (const
|
|
3076
|
-
if (!results.some((r) => r.targetType ===
|
|
3131
|
+
for (const h2 of this.outputAcceptingHandles) {
|
|
3132
|
+
if (!results.some((r) => r.targetType === h2.targetType && r.targetHandle === h2.targetHandle)) {
|
|
3077
3133
|
results.push({
|
|
3078
3134
|
sourceType,
|
|
3079
3135
|
sourceHandle,
|
|
3080
|
-
targetType:
|
|
3081
|
-
targetHandle:
|
|
3136
|
+
targetType: h2.targetType,
|
|
3137
|
+
targetHandle: h2.targetHandle,
|
|
3082
3138
|
label: "Store as secret",
|
|
3083
3139
|
outputBinding: { sourceAttribute }
|
|
3084
3140
|
});
|
|
@@ -4984,8 +5040,8 @@ function applyNamingTemplate(template, tokens, constraints) {
|
|
|
4984
5040
|
for (const key of optionalTokens) {
|
|
4985
5041
|
const value = tokens[key];
|
|
4986
5042
|
if (!value) {
|
|
4987
|
-
const
|
|
4988
|
-
result = result.replace(
|
|
5043
|
+
const re2 = new RegExp(`(?:${separators}\\{${key}\\}|\\{${key}\\}${separators}|\\{${key}\\})`, "g");
|
|
5044
|
+
result = result.replace(re2, "");
|
|
4989
5045
|
} else {
|
|
4990
5046
|
result = result.replace(new RegExp(`\\{${key}\\}`, "g"), value);
|
|
4991
5047
|
}
|
|
@@ -15343,7 +15399,7 @@ var init_hcl_generator43 = __esm({
|
|
|
15343
15399
|
lines.push(` encryption_at_host_enabled = ${context.getPropertyExpression(resource, "encryption_at_host_enabled", encryptionAtHostEnabled ?? false)}`);
|
|
15344
15400
|
}
|
|
15345
15401
|
if (zones && zones.length > 0) {
|
|
15346
|
-
const zoneList = zones.map((
|
|
15402
|
+
const zoneList = zones.map((z3) => `"${e2(z3)}"`).join(", ");
|
|
15347
15403
|
lines.push(` zones = [${zoneList}]`);
|
|
15348
15404
|
}
|
|
15349
15405
|
lines.push("", " os_disk {");
|
|
@@ -16125,7 +16181,7 @@ var init_hcl_generator46 = __esm({
|
|
|
16125
16181
|
lines.push(` min_api_version = ${minExpr}`);
|
|
16126
16182
|
}
|
|
16127
16183
|
if (zones && zones.length > 0) {
|
|
16128
|
-
const zonesStr = `[${zones.map((
|
|
16184
|
+
const zonesStr = `[${zones.map((z3) => `"${z3}"`).join(", ")}]`;
|
|
16129
16185
|
lines.push(` zones = ${zonesStr}`);
|
|
16130
16186
|
}
|
|
16131
16187
|
if (vnetType !== "None") {
|
|
@@ -26070,7 +26126,7 @@ var init_hcl_generator87 = __esm({
|
|
|
26070
26126
|
lines.push(` endpoint_public_access = ${publicAccess}`);
|
|
26071
26127
|
lines.push(" }");
|
|
26072
26128
|
if (enabledLogTypes && enabledLogTypes.length > 0) {
|
|
26073
|
-
const logTypesFormatted = enabledLogTypes.map((
|
|
26129
|
+
const logTypesFormatted = enabledLogTypes.map((t2) => `"${t2}"`).join(", ");
|
|
26074
26130
|
lines.push("");
|
|
26075
26131
|
lines.push(` enabled_cluster_log_types = [${logTypesFormatted}]`);
|
|
26076
26132
|
}
|
|
@@ -27367,6 +27423,871 @@ var {
|
|
|
27367
27423
|
Help
|
|
27368
27424
|
} = import_index.default;
|
|
27369
27425
|
|
|
27426
|
+
// ../../node_modules/.pnpm/@clack+core@1.1.0/node_modules/@clack/core/dist/index.mjs
|
|
27427
|
+
var import_node_util = require("node:util");
|
|
27428
|
+
var import_node_process = require("node:process");
|
|
27429
|
+
var import_node_readline = __toESM(require("node:readline"), 1);
|
|
27430
|
+
var import_sisteransi = __toESM(require_src(), 1);
|
|
27431
|
+
function x(t2, e4, s) {
|
|
27432
|
+
if (!s.some((u) => !u.disabled)) return t2;
|
|
27433
|
+
const i = t2 + e4, r = Math.max(s.length - 1, 0), n = i < 0 ? r : i > r ? 0 : i;
|
|
27434
|
+
return s[n].disabled ? x(n, e4 < 0 ? -1 : 1, s) : n;
|
|
27435
|
+
}
|
|
27436
|
+
var at = (t2) => t2 === 161 || t2 === 164 || t2 === 167 || t2 === 168 || t2 === 170 || t2 === 173 || t2 === 174 || t2 >= 176 && t2 <= 180 || t2 >= 182 && t2 <= 186 || t2 >= 188 && t2 <= 191 || t2 === 198 || t2 === 208 || t2 === 215 || t2 === 216 || t2 >= 222 && t2 <= 225 || t2 === 230 || t2 >= 232 && t2 <= 234 || t2 === 236 || t2 === 237 || t2 === 240 || t2 === 242 || t2 === 243 || t2 >= 247 && t2 <= 250 || t2 === 252 || t2 === 254 || t2 === 257 || t2 === 273 || t2 === 275 || t2 === 283 || t2 === 294 || t2 === 295 || t2 === 299 || t2 >= 305 && t2 <= 307 || t2 === 312 || t2 >= 319 && t2 <= 322 || t2 === 324 || t2 >= 328 && t2 <= 331 || t2 === 333 || t2 === 338 || t2 === 339 || t2 === 358 || t2 === 359 || t2 === 363 || t2 === 462 || t2 === 464 || t2 === 466 || t2 === 468 || t2 === 470 || t2 === 472 || t2 === 474 || t2 === 476 || t2 === 593 || t2 === 609 || t2 === 708 || t2 === 711 || t2 >= 713 && t2 <= 715 || t2 === 717 || t2 === 720 || t2 >= 728 && t2 <= 731 || t2 === 733 || t2 === 735 || t2 >= 768 && t2 <= 879 || t2 >= 913 && t2 <= 929 || t2 >= 931 && t2 <= 937 || t2 >= 945 && t2 <= 961 || t2 >= 963 && t2 <= 969 || t2 === 1025 || t2 >= 1040 && t2 <= 1103 || t2 === 1105 || t2 === 8208 || t2 >= 8211 && t2 <= 8214 || t2 === 8216 || t2 === 8217 || t2 === 8220 || t2 === 8221 || t2 >= 8224 && t2 <= 8226 || t2 >= 8228 && t2 <= 8231 || t2 === 8240 || t2 === 8242 || t2 === 8243 || t2 === 8245 || t2 === 8251 || t2 === 8254 || t2 === 8308 || t2 === 8319 || t2 >= 8321 && t2 <= 8324 || t2 === 8364 || t2 === 8451 || t2 === 8453 || t2 === 8457 || t2 === 8467 || t2 === 8470 || t2 === 8481 || t2 === 8482 || t2 === 8486 || t2 === 8491 || t2 === 8531 || t2 === 8532 || t2 >= 8539 && t2 <= 8542 || t2 >= 8544 && t2 <= 8555 || t2 >= 8560 && t2 <= 8569 || t2 === 8585 || t2 >= 8592 && t2 <= 8601 || t2 === 8632 || t2 === 8633 || t2 === 8658 || t2 === 8660 || t2 === 8679 || t2 === 8704 || t2 === 8706 || t2 === 8707 || t2 === 8711 || t2 === 8712 || t2 === 8715 || t2 === 8719 || t2 === 8721 || t2 === 8725 || t2 === 8730 || t2 >= 8733 && t2 <= 8736 || t2 === 8739 || t2 === 8741 || t2 >= 8743 && t2 <= 8748 || t2 === 8750 || t2 >= 8756 && t2 <= 8759 || t2 === 8764 || t2 === 8765 || t2 === 8776 || t2 === 8780 || t2 === 8786 || t2 === 8800 || t2 === 8801 || t2 >= 8804 && t2 <= 8807 || t2 === 8810 || t2 === 8811 || t2 === 8814 || t2 === 8815 || t2 === 8834 || t2 === 8835 || t2 === 8838 || t2 === 8839 || t2 === 8853 || t2 === 8857 || t2 === 8869 || t2 === 8895 || t2 === 8978 || t2 >= 9312 && t2 <= 9449 || t2 >= 9451 && t2 <= 9547 || t2 >= 9552 && t2 <= 9587 || t2 >= 9600 && t2 <= 9615 || t2 >= 9618 && t2 <= 9621 || t2 === 9632 || t2 === 9633 || t2 >= 9635 && t2 <= 9641 || t2 === 9650 || t2 === 9651 || t2 === 9654 || t2 === 9655 || t2 === 9660 || t2 === 9661 || t2 === 9664 || t2 === 9665 || t2 >= 9670 && t2 <= 9672 || t2 === 9675 || t2 >= 9678 && t2 <= 9681 || t2 >= 9698 && t2 <= 9701 || t2 === 9711 || t2 === 9733 || t2 === 9734 || t2 === 9737 || t2 === 9742 || t2 === 9743 || t2 === 9756 || t2 === 9758 || t2 === 9792 || t2 === 9794 || t2 === 9824 || t2 === 9825 || t2 >= 9827 && t2 <= 9829 || t2 >= 9831 && t2 <= 9834 || t2 === 9836 || t2 === 9837 || t2 === 9839 || t2 === 9886 || t2 === 9887 || t2 === 9919 || t2 >= 9926 && t2 <= 9933 || t2 >= 9935 && t2 <= 9939 || t2 >= 9941 && t2 <= 9953 || t2 === 9955 || t2 === 9960 || t2 === 9961 || t2 >= 9963 && t2 <= 9969 || t2 === 9972 || t2 >= 9974 && t2 <= 9977 || t2 === 9979 || t2 === 9980 || t2 === 9982 || t2 === 9983 || t2 === 10045 || t2 >= 10102 && t2 <= 10111 || t2 >= 11094 && t2 <= 11097 || t2 >= 12872 && t2 <= 12879 || t2 >= 57344 && t2 <= 63743 || t2 >= 65024 && t2 <= 65039 || t2 === 65533 || t2 >= 127232 && t2 <= 127242 || t2 >= 127248 && t2 <= 127277 || t2 >= 127280 && t2 <= 127337 || t2 >= 127344 && t2 <= 127373 || t2 === 127375 || t2 === 127376 || t2 >= 127387 && t2 <= 127404 || t2 >= 917760 && t2 <= 917999 || t2 >= 983040 && t2 <= 1048573 || t2 >= 1048576 && t2 <= 1114109;
|
|
27437
|
+
var lt = (t2) => t2 === 12288 || t2 >= 65281 && t2 <= 65376 || t2 >= 65504 && t2 <= 65510;
|
|
27438
|
+
var ht = (t2) => t2 >= 4352 && t2 <= 4447 || t2 === 8986 || t2 === 8987 || t2 === 9001 || t2 === 9002 || t2 >= 9193 && t2 <= 9196 || t2 === 9200 || t2 === 9203 || t2 === 9725 || t2 === 9726 || t2 === 9748 || t2 === 9749 || t2 >= 9800 && t2 <= 9811 || t2 === 9855 || t2 === 9875 || t2 === 9889 || t2 === 9898 || t2 === 9899 || t2 === 9917 || t2 === 9918 || t2 === 9924 || t2 === 9925 || t2 === 9934 || t2 === 9940 || t2 === 9962 || t2 === 9970 || t2 === 9971 || t2 === 9973 || t2 === 9978 || t2 === 9981 || t2 === 9989 || t2 === 9994 || t2 === 9995 || t2 === 10024 || t2 === 10060 || t2 === 10062 || t2 >= 10067 && t2 <= 10069 || t2 === 10071 || t2 >= 10133 && t2 <= 10135 || t2 === 10160 || t2 === 10175 || t2 === 11035 || t2 === 11036 || t2 === 11088 || t2 === 11093 || t2 >= 11904 && t2 <= 11929 || t2 >= 11931 && t2 <= 12019 || t2 >= 12032 && t2 <= 12245 || t2 >= 12272 && t2 <= 12287 || t2 >= 12289 && t2 <= 12350 || t2 >= 12353 && t2 <= 12438 || t2 >= 12441 && t2 <= 12543 || t2 >= 12549 && t2 <= 12591 || t2 >= 12593 && t2 <= 12686 || t2 >= 12688 && t2 <= 12771 || t2 >= 12783 && t2 <= 12830 || t2 >= 12832 && t2 <= 12871 || t2 >= 12880 && t2 <= 19903 || t2 >= 19968 && t2 <= 42124 || t2 >= 42128 && t2 <= 42182 || t2 >= 43360 && t2 <= 43388 || t2 >= 44032 && t2 <= 55203 || t2 >= 63744 && t2 <= 64255 || t2 >= 65040 && t2 <= 65049 || t2 >= 65072 && t2 <= 65106 || t2 >= 65108 && t2 <= 65126 || t2 >= 65128 && t2 <= 65131 || t2 >= 94176 && t2 <= 94180 || t2 === 94192 || t2 === 94193 || t2 >= 94208 && t2 <= 100343 || t2 >= 100352 && t2 <= 101589 || t2 >= 101632 && t2 <= 101640 || t2 >= 110576 && t2 <= 110579 || t2 >= 110581 && t2 <= 110587 || t2 === 110589 || t2 === 110590 || t2 >= 110592 && t2 <= 110882 || t2 === 110898 || t2 >= 110928 && t2 <= 110930 || t2 === 110933 || t2 >= 110948 && t2 <= 110951 || t2 >= 110960 && t2 <= 111355 || t2 === 126980 || t2 === 127183 || t2 === 127374 || t2 >= 127377 && t2 <= 127386 || t2 >= 127488 && t2 <= 127490 || t2 >= 127504 && t2 <= 127547 || t2 >= 127552 && t2 <= 127560 || t2 === 127568 || t2 === 127569 || t2 >= 127584 && t2 <= 127589 || t2 >= 127744 && t2 <= 127776 || t2 >= 127789 && t2 <= 127797 || t2 >= 127799 && t2 <= 127868 || t2 >= 127870 && t2 <= 127891 || t2 >= 127904 && t2 <= 127946 || t2 >= 127951 && t2 <= 127955 || t2 >= 127968 && t2 <= 127984 || t2 === 127988 || t2 >= 127992 && t2 <= 128062 || t2 === 128064 || t2 >= 128066 && t2 <= 128252 || t2 >= 128255 && t2 <= 128317 || t2 >= 128331 && t2 <= 128334 || t2 >= 128336 && t2 <= 128359 || t2 === 128378 || t2 === 128405 || t2 === 128406 || t2 === 128420 || t2 >= 128507 && t2 <= 128591 || t2 >= 128640 && t2 <= 128709 || t2 === 128716 || t2 >= 128720 && t2 <= 128722 || t2 >= 128725 && t2 <= 128727 || t2 >= 128732 && t2 <= 128735 || t2 === 128747 || t2 === 128748 || t2 >= 128756 && t2 <= 128764 || t2 >= 128992 && t2 <= 129003 || t2 === 129008 || t2 >= 129292 && t2 <= 129338 || t2 >= 129340 && t2 <= 129349 || t2 >= 129351 && t2 <= 129535 || t2 >= 129648 && t2 <= 129660 || t2 >= 129664 && t2 <= 129672 || t2 >= 129680 && t2 <= 129725 || t2 >= 129727 && t2 <= 129733 || t2 >= 129742 && t2 <= 129755 || t2 >= 129760 && t2 <= 129768 || t2 >= 129776 && t2 <= 129784 || t2 >= 131072 && t2 <= 196605 || t2 >= 196608 && t2 <= 262141;
|
|
27439
|
+
var O = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
|
|
27440
|
+
var y = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
27441
|
+
var L = /\t{1,1000}/y;
|
|
27442
|
+
var P = new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*", "yu");
|
|
27443
|
+
var M = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
27444
|
+
var ct = new RegExp("\\p{M}+", "gu");
|
|
27445
|
+
var ft = { limit: 1 / 0, ellipsis: "" };
|
|
27446
|
+
var X = (t2, e4 = {}, s = {}) => {
|
|
27447
|
+
const i = e4.limit ?? 1 / 0, r = e4.ellipsis ?? "", n = e4?.ellipsisWidth ?? (r ? X(r, ft, s).width : 0), u = s.ansiWidth ?? 0, a = s.controlWidth ?? 0, l = s.tabWidth ?? 8, E = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, m = s.fullWidthWidth ?? 2, A = s.regularWidth ?? 1, V2 = s.wideWidth ?? 2;
|
|
27448
|
+
let h2 = 0, o = 0, p = t2.length, v = 0, F = false, d = p, b = Math.max(0, i - n), C = 0, w = 0, c = 0, f = 0;
|
|
27449
|
+
t: for (; ; ) {
|
|
27450
|
+
if (w > C || o >= p && o > h2) {
|
|
27451
|
+
const ut = t2.slice(C, w) || t2.slice(h2, o);
|
|
27452
|
+
v = 0;
|
|
27453
|
+
for (const Y of ut.replaceAll(ct, "")) {
|
|
27454
|
+
const $ = Y.codePointAt(0) || 0;
|
|
27455
|
+
if (lt($) ? f = m : ht($) ? f = V2 : E !== A && at($) ? f = E : f = A, c + f > b && (d = Math.min(d, Math.max(C, h2) + v)), c + f > i) {
|
|
27456
|
+
F = true;
|
|
27457
|
+
break t;
|
|
27458
|
+
}
|
|
27459
|
+
v += Y.length, c += f;
|
|
27460
|
+
}
|
|
27461
|
+
C = w = 0;
|
|
27462
|
+
}
|
|
27463
|
+
if (o >= p) break;
|
|
27464
|
+
if (M.lastIndex = o, M.test(t2)) {
|
|
27465
|
+
if (v = M.lastIndex - o, f = v * A, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / A))), c + f > i) {
|
|
27466
|
+
F = true;
|
|
27467
|
+
break;
|
|
27468
|
+
}
|
|
27469
|
+
c += f, C = h2, w = o, o = h2 = M.lastIndex;
|
|
27470
|
+
continue;
|
|
27471
|
+
}
|
|
27472
|
+
if (O.lastIndex = o, O.test(t2)) {
|
|
27473
|
+
if (c + u > b && (d = Math.min(d, o)), c + u > i) {
|
|
27474
|
+
F = true;
|
|
27475
|
+
break;
|
|
27476
|
+
}
|
|
27477
|
+
c += u, C = h2, w = o, o = h2 = O.lastIndex;
|
|
27478
|
+
continue;
|
|
27479
|
+
}
|
|
27480
|
+
if (y.lastIndex = o, y.test(t2)) {
|
|
27481
|
+
if (v = y.lastIndex - o, f = v * a, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / a))), c + f > i) {
|
|
27482
|
+
F = true;
|
|
27483
|
+
break;
|
|
27484
|
+
}
|
|
27485
|
+
c += f, C = h2, w = o, o = h2 = y.lastIndex;
|
|
27486
|
+
continue;
|
|
27487
|
+
}
|
|
27488
|
+
if (L.lastIndex = o, L.test(t2)) {
|
|
27489
|
+
if (v = L.lastIndex - o, f = v * l, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / l))), c + f > i) {
|
|
27490
|
+
F = true;
|
|
27491
|
+
break;
|
|
27492
|
+
}
|
|
27493
|
+
c += f, C = h2, w = o, o = h2 = L.lastIndex;
|
|
27494
|
+
continue;
|
|
27495
|
+
}
|
|
27496
|
+
if (P.lastIndex = o, P.test(t2)) {
|
|
27497
|
+
if (c + g > b && (d = Math.min(d, o)), c + g > i) {
|
|
27498
|
+
F = true;
|
|
27499
|
+
break;
|
|
27500
|
+
}
|
|
27501
|
+
c += g, C = h2, w = o, o = h2 = P.lastIndex;
|
|
27502
|
+
continue;
|
|
27503
|
+
}
|
|
27504
|
+
o += 1;
|
|
27505
|
+
}
|
|
27506
|
+
return { width: F ? b : c, index: F ? d : p, truncated: F, ellipsed: F && i >= n };
|
|
27507
|
+
};
|
|
27508
|
+
var pt = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
|
|
27509
|
+
var S = (t2, e4 = {}) => X(t2, pt, e4).width;
|
|
27510
|
+
var T = "\x1B";
|
|
27511
|
+
var Z = "\x9B";
|
|
27512
|
+
var Ft = 39;
|
|
27513
|
+
var j = "\x07";
|
|
27514
|
+
var Q = "[";
|
|
27515
|
+
var dt = "]";
|
|
27516
|
+
var tt = "m";
|
|
27517
|
+
var U = `${dt}8;;`;
|
|
27518
|
+
var et = new RegExp(`(?:\\${Q}(?<code>\\d+)m|\\${U}(?<uri>.*)${j})`, "y");
|
|
27519
|
+
var mt = (t2) => {
|
|
27520
|
+
if (t2 >= 30 && t2 <= 37 || t2 >= 90 && t2 <= 97) return 39;
|
|
27521
|
+
if (t2 >= 40 && t2 <= 47 || t2 >= 100 && t2 <= 107) return 49;
|
|
27522
|
+
if (t2 === 1 || t2 === 2) return 22;
|
|
27523
|
+
if (t2 === 3) return 23;
|
|
27524
|
+
if (t2 === 4) return 24;
|
|
27525
|
+
if (t2 === 7) return 27;
|
|
27526
|
+
if (t2 === 8) return 28;
|
|
27527
|
+
if (t2 === 9) return 29;
|
|
27528
|
+
if (t2 === 0) return 0;
|
|
27529
|
+
};
|
|
27530
|
+
var st = (t2) => `${T}${Q}${t2}${tt}`;
|
|
27531
|
+
var it = (t2) => `${T}${U}${t2}${j}`;
|
|
27532
|
+
var gt = (t2) => t2.map((e4) => S(e4));
|
|
27533
|
+
var G = (t2, e4, s) => {
|
|
27534
|
+
const i = e4[Symbol.iterator]();
|
|
27535
|
+
let r = false, n = false, u = t2.at(-1), a = u === void 0 ? 0 : S(u), l = i.next(), E = i.next(), g = 0;
|
|
27536
|
+
for (; !l.done; ) {
|
|
27537
|
+
const m = l.value, A = S(m);
|
|
27538
|
+
a + A <= s ? t2[t2.length - 1] += m : (t2.push(m), a = 0), (m === T || m === Z) && (r = true, n = e4.startsWith(U, g + 1)), r ? n ? m === j && (r = false, n = false) : m === tt && (r = false) : (a += A, a === s && !E.done && (t2.push(""), a = 0)), l = E, E = i.next(), g += m.length;
|
|
27539
|
+
}
|
|
27540
|
+
u = t2.at(-1), !a && u !== void 0 && u.length > 0 && t2.length > 1 && (t2[t2.length - 2] += t2.pop());
|
|
27541
|
+
};
|
|
27542
|
+
var vt = (t2) => {
|
|
27543
|
+
const e4 = t2.split(" ");
|
|
27544
|
+
let s = e4.length;
|
|
27545
|
+
for (; s > 0 && !(S(e4[s - 1]) > 0); ) s--;
|
|
27546
|
+
return s === e4.length ? t2 : e4.slice(0, s).join(" ") + e4.slice(s).join("");
|
|
27547
|
+
};
|
|
27548
|
+
var Et = (t2, e4, s = {}) => {
|
|
27549
|
+
if (s.trim !== false && t2.trim() === "") return "";
|
|
27550
|
+
let i = "", r, n;
|
|
27551
|
+
const u = t2.split(" "), a = gt(u);
|
|
27552
|
+
let l = [""];
|
|
27553
|
+
for (const [h2, o] of u.entries()) {
|
|
27554
|
+
s.trim !== false && (l[l.length - 1] = (l.at(-1) ?? "").trimStart());
|
|
27555
|
+
let p = S(l.at(-1) ?? "");
|
|
27556
|
+
if (h2 !== 0 && (p >= e4 && (s.wordWrap === false || s.trim === false) && (l.push(""), p = 0), (p > 0 || s.trim === false) && (l[l.length - 1] += " ", p++)), s.hard && a[h2] > e4) {
|
|
27557
|
+
const v = e4 - p, F = 1 + Math.floor((a[h2] - v - 1) / e4);
|
|
27558
|
+
Math.floor((a[h2] - 1) / e4) < F && l.push(""), G(l, o, e4);
|
|
27559
|
+
continue;
|
|
27560
|
+
}
|
|
27561
|
+
if (p + a[h2] > e4 && p > 0 && a[h2] > 0) {
|
|
27562
|
+
if (s.wordWrap === false && p < e4) {
|
|
27563
|
+
G(l, o, e4);
|
|
27564
|
+
continue;
|
|
27565
|
+
}
|
|
27566
|
+
l.push("");
|
|
27567
|
+
}
|
|
27568
|
+
if (p + a[h2] > e4 && s.wordWrap === false) {
|
|
27569
|
+
G(l, o, e4);
|
|
27570
|
+
continue;
|
|
27571
|
+
}
|
|
27572
|
+
l[l.length - 1] += o;
|
|
27573
|
+
}
|
|
27574
|
+
s.trim !== false && (l = l.map((h2) => vt(h2)));
|
|
27575
|
+
const E = l.join(`
|
|
27576
|
+
`), g = E[Symbol.iterator]();
|
|
27577
|
+
let m = g.next(), A = g.next(), V2 = 0;
|
|
27578
|
+
for (; !m.done; ) {
|
|
27579
|
+
const h2 = m.value, o = A.value;
|
|
27580
|
+
if (i += h2, h2 === T || h2 === Z) {
|
|
27581
|
+
et.lastIndex = V2 + 1;
|
|
27582
|
+
const F = et.exec(E)?.groups;
|
|
27583
|
+
if (F?.code !== void 0) {
|
|
27584
|
+
const d = Number.parseFloat(F.code);
|
|
27585
|
+
r = d === Ft ? void 0 : d;
|
|
27586
|
+
} else F?.uri !== void 0 && (n = F.uri.length === 0 ? void 0 : F.uri);
|
|
27587
|
+
}
|
|
27588
|
+
const p = r ? mt(r) : void 0;
|
|
27589
|
+
o === `
|
|
27590
|
+
` ? (n && (i += it("")), r && p && (i += st(p))) : h2 === `
|
|
27591
|
+
` && (r && p && (i += st(r)), n && (i += it(n))), V2 += h2.length, m = A, A = g.next();
|
|
27592
|
+
}
|
|
27593
|
+
return i;
|
|
27594
|
+
};
|
|
27595
|
+
function K(t2, e4, s) {
|
|
27596
|
+
return String(t2).normalize().replaceAll(`\r
|
|
27597
|
+
`, `
|
|
27598
|
+
`).split(`
|
|
27599
|
+
`).map((i) => Et(i, e4, s)).join(`
|
|
27600
|
+
`);
|
|
27601
|
+
}
|
|
27602
|
+
var At = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
27603
|
+
var _ = { actions: new Set(At), aliases: /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["", "cancel"], ["escape", "cancel"]]), messages: { cancel: "Canceled", error: "Something went wrong" }, withGuide: true };
|
|
27604
|
+
function H(t2, e4) {
|
|
27605
|
+
if (typeof t2 == "string") return _.aliases.get(t2) === e4;
|
|
27606
|
+
for (const s of t2) if (s !== void 0 && H(s, e4)) return true;
|
|
27607
|
+
return false;
|
|
27608
|
+
}
|
|
27609
|
+
function _t(t2, e4) {
|
|
27610
|
+
if (t2 === e4) return;
|
|
27611
|
+
const s = t2.split(`
|
|
27612
|
+
`), i = e4.split(`
|
|
27613
|
+
`), r = Math.max(s.length, i.length), n = [];
|
|
27614
|
+
for (let u = 0; u < r; u++) s[u] !== i[u] && n.push(u);
|
|
27615
|
+
return { lines: n, numLinesBefore: s.length, numLinesAfter: i.length, numLines: r };
|
|
27616
|
+
}
|
|
27617
|
+
var bt = globalThis.process.platform.startsWith("win");
|
|
27618
|
+
var z = /* @__PURE__ */ Symbol("clack:cancel");
|
|
27619
|
+
function Ct(t2) {
|
|
27620
|
+
return t2 === z;
|
|
27621
|
+
}
|
|
27622
|
+
function W(t2, e4) {
|
|
27623
|
+
const s = t2;
|
|
27624
|
+
s.isTTY && s.setRawMode(e4);
|
|
27625
|
+
}
|
|
27626
|
+
var rt = (t2) => "columns" in t2 && typeof t2.columns == "number" ? t2.columns : 80;
|
|
27627
|
+
var nt = (t2) => "rows" in t2 && typeof t2.rows == "number" ? t2.rows : 20;
|
|
27628
|
+
function Bt(t2, e4, s, i = s) {
|
|
27629
|
+
const r = rt(t2 ?? import_node_process.stdout);
|
|
27630
|
+
return K(e4, r - s.length, { hard: true, trim: false }).split(`
|
|
27631
|
+
`).map((n, u) => `${u === 0 ? i : s}${n}`).join(`
|
|
27632
|
+
`);
|
|
27633
|
+
}
|
|
27634
|
+
var B = class {
|
|
27635
|
+
input;
|
|
27636
|
+
output;
|
|
27637
|
+
_abortSignal;
|
|
27638
|
+
rl;
|
|
27639
|
+
opts;
|
|
27640
|
+
_render;
|
|
27641
|
+
_track = false;
|
|
27642
|
+
_prevFrame = "";
|
|
27643
|
+
_subscribers = /* @__PURE__ */ new Map();
|
|
27644
|
+
_cursor = 0;
|
|
27645
|
+
state = "initial";
|
|
27646
|
+
error = "";
|
|
27647
|
+
value;
|
|
27648
|
+
userInput = "";
|
|
27649
|
+
constructor(e4, s = true) {
|
|
27650
|
+
const { input: i = import_node_process.stdin, output: r = import_node_process.stdout, render: n, signal: u, ...a } = e4;
|
|
27651
|
+
this.opts = a, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = s, this._abortSignal = u, this.input = i, this.output = r;
|
|
27652
|
+
}
|
|
27653
|
+
unsubscribe() {
|
|
27654
|
+
this._subscribers.clear();
|
|
27655
|
+
}
|
|
27656
|
+
setSubscriber(e4, s) {
|
|
27657
|
+
const i = this._subscribers.get(e4) ?? [];
|
|
27658
|
+
i.push(s), this._subscribers.set(e4, i);
|
|
27659
|
+
}
|
|
27660
|
+
on(e4, s) {
|
|
27661
|
+
this.setSubscriber(e4, { cb: s });
|
|
27662
|
+
}
|
|
27663
|
+
once(e4, s) {
|
|
27664
|
+
this.setSubscriber(e4, { cb: s, once: true });
|
|
27665
|
+
}
|
|
27666
|
+
emit(e4, ...s) {
|
|
27667
|
+
const i = this._subscribers.get(e4) ?? [], r = [];
|
|
27668
|
+
for (const n of i) n.cb(...s), n.once && r.push(() => i.splice(i.indexOf(n), 1));
|
|
27669
|
+
for (const n of r) n();
|
|
27670
|
+
}
|
|
27671
|
+
prompt() {
|
|
27672
|
+
return new Promise((e4) => {
|
|
27673
|
+
if (this._abortSignal) {
|
|
27674
|
+
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), e4(z);
|
|
27675
|
+
this._abortSignal.addEventListener("abort", () => {
|
|
27676
|
+
this.state = "cancel", this.close();
|
|
27677
|
+
}, { once: true });
|
|
27678
|
+
}
|
|
27679
|
+
this.rl = import_node_readline.default.createInterface({ input: this.input, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), W(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
27680
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), W(this.input, false), e4(this.value);
|
|
27681
|
+
}), this.once("cancel", () => {
|
|
27682
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), W(this.input, false), e4(z);
|
|
27683
|
+
});
|
|
27684
|
+
});
|
|
27685
|
+
}
|
|
27686
|
+
_isActionKey(e4, s) {
|
|
27687
|
+
return e4 === " ";
|
|
27688
|
+
}
|
|
27689
|
+
_setValue(e4) {
|
|
27690
|
+
this.value = e4, this.emit("value", this.value);
|
|
27691
|
+
}
|
|
27692
|
+
_setUserInput(e4, s) {
|
|
27693
|
+
this.userInput = e4 ?? "", this.emit("userInput", this.userInput), s && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
|
|
27694
|
+
}
|
|
27695
|
+
_clearUserInput() {
|
|
27696
|
+
this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
|
|
27697
|
+
}
|
|
27698
|
+
onKeypress(e4, s) {
|
|
27699
|
+
if (this._track && s.name !== "return" && (s.name && this._isActionKey(e4, s) && 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"), s?.name && (!this._track && _.aliases.has(s.name) && this.emit("cursor", _.aliases.get(s.name)), _.actions.has(s.name) && this.emit("cursor", s.name)), e4 && (e4.toLowerCase() === "y" || e4.toLowerCase() === "n") && this.emit("confirm", e4.toLowerCase() === "y"), this.emit("key", e4?.toLowerCase(), s), s?.name === "return") {
|
|
27700
|
+
if (this.opts.validate) {
|
|
27701
|
+
const i = this.opts.validate(this.value);
|
|
27702
|
+
i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput));
|
|
27703
|
+
}
|
|
27704
|
+
this.state !== "error" && (this.state = "submit");
|
|
27705
|
+
}
|
|
27706
|
+
H([e4, s?.name, s?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
27707
|
+
}
|
|
27708
|
+
close() {
|
|
27709
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
27710
|
+
`), W(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
27711
|
+
}
|
|
27712
|
+
restoreCursor() {
|
|
27713
|
+
const e4 = K(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
|
|
27714
|
+
`).length - 1;
|
|
27715
|
+
this.output.write(import_sisteransi.cursor.move(-999, e4 * -1));
|
|
27716
|
+
}
|
|
27717
|
+
render() {
|
|
27718
|
+
const e4 = K(this._render(this) ?? "", process.stdout.columns, { hard: true, trim: false });
|
|
27719
|
+
if (e4 !== this._prevFrame) {
|
|
27720
|
+
if (this.state === "initial") this.output.write(import_sisteransi.cursor.hide);
|
|
27721
|
+
else {
|
|
27722
|
+
const s = _t(this._prevFrame, e4), i = nt(this.output);
|
|
27723
|
+
if (this.restoreCursor(), s) {
|
|
27724
|
+
const r = Math.max(0, s.numLinesAfter - i), n = Math.max(0, s.numLinesBefore - i);
|
|
27725
|
+
let u = s.lines.find((a) => a >= r);
|
|
27726
|
+
if (u === void 0) {
|
|
27727
|
+
this._prevFrame = e4;
|
|
27728
|
+
return;
|
|
27729
|
+
}
|
|
27730
|
+
if (s.lines.length === 1) {
|
|
27731
|
+
this.output.write(import_sisteransi.cursor.move(0, u - n)), this.output.write(import_sisteransi.erase.lines(1));
|
|
27732
|
+
const a = e4.split(`
|
|
27733
|
+
`);
|
|
27734
|
+
this.output.write(a[u]), this._prevFrame = e4, this.output.write(import_sisteransi.cursor.move(0, a.length - u - 1));
|
|
27735
|
+
return;
|
|
27736
|
+
} else if (s.lines.length > 1) {
|
|
27737
|
+
if (r < n) u = r;
|
|
27738
|
+
else {
|
|
27739
|
+
const l = u - n;
|
|
27740
|
+
l > 0 && this.output.write(import_sisteransi.cursor.move(0, l));
|
|
27741
|
+
}
|
|
27742
|
+
this.output.write(import_sisteransi.erase.down());
|
|
27743
|
+
const a = e4.split(`
|
|
27744
|
+
`).slice(u);
|
|
27745
|
+
this.output.write(a.join(`
|
|
27746
|
+
`)), this._prevFrame = e4;
|
|
27747
|
+
return;
|
|
27748
|
+
}
|
|
27749
|
+
}
|
|
27750
|
+
this.output.write(import_sisteransi.erase.down());
|
|
27751
|
+
}
|
|
27752
|
+
this.output.write(e4), this.state === "initial" && (this.state = "active"), this._prevFrame = e4;
|
|
27753
|
+
}
|
|
27754
|
+
}
|
|
27755
|
+
};
|
|
27756
|
+
var Lt = class extends B {
|
|
27757
|
+
options;
|
|
27758
|
+
cursor = 0;
|
|
27759
|
+
get _value() {
|
|
27760
|
+
return this.options[this.cursor].value;
|
|
27761
|
+
}
|
|
27762
|
+
get _enabledOptions() {
|
|
27763
|
+
return this.options.filter((e4) => e4.disabled !== true);
|
|
27764
|
+
}
|
|
27765
|
+
toggleAll() {
|
|
27766
|
+
const e4 = this._enabledOptions, s = this.value !== void 0 && this.value.length === e4.length;
|
|
27767
|
+
this.value = s ? [] : e4.map((i) => i.value);
|
|
27768
|
+
}
|
|
27769
|
+
toggleInvert() {
|
|
27770
|
+
const e4 = this.value;
|
|
27771
|
+
if (!e4) return;
|
|
27772
|
+
const s = this._enabledOptions.filter((i) => !e4.includes(i.value));
|
|
27773
|
+
this.value = s.map((i) => i.value);
|
|
27774
|
+
}
|
|
27775
|
+
toggleValue() {
|
|
27776
|
+
this.value === void 0 && (this.value = []);
|
|
27777
|
+
const e4 = this.value.includes(this._value);
|
|
27778
|
+
this.value = e4 ? this.value.filter((s) => s !== this._value) : [...this.value, this._value];
|
|
27779
|
+
}
|
|
27780
|
+
constructor(e4) {
|
|
27781
|
+
super(e4, false), this.options = e4.options, this.value = [...e4.initialValues ?? []];
|
|
27782
|
+
const s = Math.max(this.options.findIndex(({ value: i }) => i === e4.cursorAt), 0);
|
|
27783
|
+
this.cursor = this.options[s].disabled ? x(s, 1, this.options) : s, this.on("key", (i) => {
|
|
27784
|
+
i === "a" && this.toggleAll(), i === "i" && this.toggleInvert();
|
|
27785
|
+
}), this.on("cursor", (i) => {
|
|
27786
|
+
switch (i) {
|
|
27787
|
+
case "left":
|
|
27788
|
+
case "up":
|
|
27789
|
+
this.cursor = x(this.cursor, -1, this.options);
|
|
27790
|
+
break;
|
|
27791
|
+
case "down":
|
|
27792
|
+
case "right":
|
|
27793
|
+
this.cursor = x(this.cursor, 1, this.options);
|
|
27794
|
+
break;
|
|
27795
|
+
case "space":
|
|
27796
|
+
this.toggleValue();
|
|
27797
|
+
break;
|
|
27798
|
+
}
|
|
27799
|
+
});
|
|
27800
|
+
}
|
|
27801
|
+
};
|
|
27802
|
+
var Tt = class extends B {
|
|
27803
|
+
options;
|
|
27804
|
+
cursor = 0;
|
|
27805
|
+
get _selectedValue() {
|
|
27806
|
+
return this.options[this.cursor];
|
|
27807
|
+
}
|
|
27808
|
+
changeValue() {
|
|
27809
|
+
this.value = this._selectedValue.value;
|
|
27810
|
+
}
|
|
27811
|
+
constructor(e4) {
|
|
27812
|
+
super(e4, false), this.options = e4.options;
|
|
27813
|
+
const s = this.options.findIndex(({ value: r }) => r === e4.initialValue), i = s === -1 ? 0 : s;
|
|
27814
|
+
this.cursor = this.options[i].disabled ? x(i, 1, this.options) : i, this.changeValue(), this.on("cursor", (r) => {
|
|
27815
|
+
switch (r) {
|
|
27816
|
+
case "left":
|
|
27817
|
+
case "up":
|
|
27818
|
+
this.cursor = x(this.cursor, -1, this.options);
|
|
27819
|
+
break;
|
|
27820
|
+
case "down":
|
|
27821
|
+
case "right":
|
|
27822
|
+
this.cursor = x(this.cursor, 1, this.options);
|
|
27823
|
+
break;
|
|
27824
|
+
}
|
|
27825
|
+
this.changeValue();
|
|
27826
|
+
});
|
|
27827
|
+
}
|
|
27828
|
+
};
|
|
27829
|
+
var $t = class extends B {
|
|
27830
|
+
get userInputWithCursor() {
|
|
27831
|
+
if (this.state === "submit") return this.userInput;
|
|
27832
|
+
const e4 = this.userInput;
|
|
27833
|
+
if (this.cursor >= e4.length) return `${this.userInput}\u2588`;
|
|
27834
|
+
const s = e4.slice(0, this.cursor), [i, ...r] = e4.slice(this.cursor);
|
|
27835
|
+
return `${s}${(0, import_node_util.styleText)("inverse", i)}${r.join("")}`;
|
|
27836
|
+
}
|
|
27837
|
+
get cursor() {
|
|
27838
|
+
return this._cursor;
|
|
27839
|
+
}
|
|
27840
|
+
constructor(e4) {
|
|
27841
|
+
super({ ...e4, initialUserInput: e4.initialUserInput ?? e4.initialValue }), this.on("userInput", (s) => {
|
|
27842
|
+
this._setValue(s);
|
|
27843
|
+
}), this.on("finalize", () => {
|
|
27844
|
+
this.value || (this.value = e4.defaultValue), this.value === void 0 && (this.value = "");
|
|
27845
|
+
});
|
|
27846
|
+
}
|
|
27847
|
+
};
|
|
27848
|
+
|
|
27849
|
+
// ../../node_modules/.pnpm/@clack+prompts@1.1.0/node_modules/@clack/prompts/dist/index.mjs
|
|
27850
|
+
var import_node_util2 = require("node:util");
|
|
27851
|
+
var import_node_process2 = __toESM(require("node:process"), 1);
|
|
27852
|
+
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
27853
|
+
function pt2() {
|
|
27854
|
+
return import_node_process2.default.platform !== "win32" ? import_node_process2.default.env.TERM !== "linux" : !!import_node_process2.default.env.CI || !!import_node_process2.default.env.WT_SESSION || !!import_node_process2.default.env.TERMINUS_SUBLIME || import_node_process2.default.env.ConEmuTask === "{cmd::Cmder}" || import_node_process2.default.env.TERM_PROGRAM === "Terminus-Sublime" || import_node_process2.default.env.TERM_PROGRAM === "vscode" || import_node_process2.default.env.TERM === "xterm-256color" || import_node_process2.default.env.TERM === "alacritty" || import_node_process2.default.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
27855
|
+
}
|
|
27856
|
+
var ee = pt2();
|
|
27857
|
+
var I2 = (e4, r) => ee ? e4 : r;
|
|
27858
|
+
var Re = I2("\u25C6", "*");
|
|
27859
|
+
var $e = I2("\u25A0", "x");
|
|
27860
|
+
var de = I2("\u25B2", "x");
|
|
27861
|
+
var V = I2("\u25C7", "o");
|
|
27862
|
+
var he = I2("\u250C", "T");
|
|
27863
|
+
var h = I2("\u2502", "|");
|
|
27864
|
+
var x2 = I2("\u2514", "\u2014");
|
|
27865
|
+
var Oe = I2("\u2510", "T");
|
|
27866
|
+
var Pe = I2("\u2518", "\u2014");
|
|
27867
|
+
var z2 = I2("\u25CF", ">");
|
|
27868
|
+
var H2 = I2("\u25CB", " ");
|
|
27869
|
+
var te = I2("\u25FB", "[\u2022]");
|
|
27870
|
+
var U2 = I2("\u25FC", "[+]");
|
|
27871
|
+
var q2 = I2("\u25FB", "[ ]");
|
|
27872
|
+
var Ne = I2("\u25AA", "\u2022");
|
|
27873
|
+
var se = I2("\u2500", "-");
|
|
27874
|
+
var pe = I2("\u256E", "+");
|
|
27875
|
+
var We = I2("\u251C", "+");
|
|
27876
|
+
var me = I2("\u256F", "+");
|
|
27877
|
+
var ge = I2("\u2570", "+");
|
|
27878
|
+
var Ge = I2("\u256D", "+");
|
|
27879
|
+
var fe = I2("\u25CF", "\u2022");
|
|
27880
|
+
var Fe = I2("\u25C6", "*");
|
|
27881
|
+
var ye = I2("\u25B2", "!");
|
|
27882
|
+
var Ee = I2("\u25A0", "x");
|
|
27883
|
+
var W2 = (e4) => {
|
|
27884
|
+
switch (e4) {
|
|
27885
|
+
case "initial":
|
|
27886
|
+
case "active":
|
|
27887
|
+
return (0, import_node_util2.styleText)("cyan", Re);
|
|
27888
|
+
case "cancel":
|
|
27889
|
+
return (0, import_node_util2.styleText)("red", $e);
|
|
27890
|
+
case "error":
|
|
27891
|
+
return (0, import_node_util2.styleText)("yellow", de);
|
|
27892
|
+
case "submit":
|
|
27893
|
+
return (0, import_node_util2.styleText)("green", V);
|
|
27894
|
+
}
|
|
27895
|
+
};
|
|
27896
|
+
var ve = (e4) => {
|
|
27897
|
+
switch (e4) {
|
|
27898
|
+
case "initial":
|
|
27899
|
+
case "active":
|
|
27900
|
+
return (0, import_node_util2.styleText)("cyan", h);
|
|
27901
|
+
case "cancel":
|
|
27902
|
+
return (0, import_node_util2.styleText)("red", h);
|
|
27903
|
+
case "error":
|
|
27904
|
+
return (0, import_node_util2.styleText)("yellow", h);
|
|
27905
|
+
case "submit":
|
|
27906
|
+
return (0, import_node_util2.styleText)("green", h);
|
|
27907
|
+
}
|
|
27908
|
+
};
|
|
27909
|
+
var mt2 = (e4) => e4 === 161 || e4 === 164 || e4 === 167 || e4 === 168 || e4 === 170 || e4 === 173 || e4 === 174 || e4 >= 176 && e4 <= 180 || e4 >= 182 && e4 <= 186 || e4 >= 188 && e4 <= 191 || e4 === 198 || e4 === 208 || e4 === 215 || e4 === 216 || e4 >= 222 && e4 <= 225 || e4 === 230 || e4 >= 232 && e4 <= 234 || e4 === 236 || e4 === 237 || e4 === 240 || e4 === 242 || e4 === 243 || e4 >= 247 && e4 <= 250 || e4 === 252 || e4 === 254 || e4 === 257 || e4 === 273 || e4 === 275 || e4 === 283 || e4 === 294 || e4 === 295 || e4 === 299 || e4 >= 305 && e4 <= 307 || e4 === 312 || e4 >= 319 && e4 <= 322 || e4 === 324 || e4 >= 328 && e4 <= 331 || e4 === 333 || e4 === 338 || e4 === 339 || e4 === 358 || e4 === 359 || e4 === 363 || e4 === 462 || e4 === 464 || e4 === 466 || e4 === 468 || e4 === 470 || e4 === 472 || e4 === 474 || e4 === 476 || e4 === 593 || e4 === 609 || e4 === 708 || e4 === 711 || e4 >= 713 && e4 <= 715 || e4 === 717 || e4 === 720 || e4 >= 728 && e4 <= 731 || e4 === 733 || e4 === 735 || e4 >= 768 && e4 <= 879 || e4 >= 913 && e4 <= 929 || e4 >= 931 && e4 <= 937 || e4 >= 945 && e4 <= 961 || e4 >= 963 && e4 <= 969 || e4 === 1025 || e4 >= 1040 && e4 <= 1103 || e4 === 1105 || e4 === 8208 || e4 >= 8211 && e4 <= 8214 || e4 === 8216 || e4 === 8217 || e4 === 8220 || e4 === 8221 || e4 >= 8224 && e4 <= 8226 || e4 >= 8228 && e4 <= 8231 || e4 === 8240 || e4 === 8242 || e4 === 8243 || e4 === 8245 || e4 === 8251 || e4 === 8254 || e4 === 8308 || e4 === 8319 || e4 >= 8321 && e4 <= 8324 || e4 === 8364 || e4 === 8451 || e4 === 8453 || e4 === 8457 || e4 === 8467 || e4 === 8470 || e4 === 8481 || e4 === 8482 || e4 === 8486 || e4 === 8491 || e4 === 8531 || e4 === 8532 || e4 >= 8539 && e4 <= 8542 || e4 >= 8544 && e4 <= 8555 || e4 >= 8560 && e4 <= 8569 || e4 === 8585 || e4 >= 8592 && e4 <= 8601 || e4 === 8632 || e4 === 8633 || e4 === 8658 || e4 === 8660 || e4 === 8679 || e4 === 8704 || e4 === 8706 || e4 === 8707 || e4 === 8711 || e4 === 8712 || e4 === 8715 || e4 === 8719 || e4 === 8721 || e4 === 8725 || e4 === 8730 || e4 >= 8733 && e4 <= 8736 || e4 === 8739 || e4 === 8741 || e4 >= 8743 && e4 <= 8748 || e4 === 8750 || e4 >= 8756 && e4 <= 8759 || e4 === 8764 || e4 === 8765 || e4 === 8776 || e4 === 8780 || e4 === 8786 || e4 === 8800 || e4 === 8801 || e4 >= 8804 && e4 <= 8807 || e4 === 8810 || e4 === 8811 || e4 === 8814 || e4 === 8815 || e4 === 8834 || e4 === 8835 || e4 === 8838 || e4 === 8839 || e4 === 8853 || e4 === 8857 || e4 === 8869 || e4 === 8895 || e4 === 8978 || e4 >= 9312 && e4 <= 9449 || e4 >= 9451 && e4 <= 9547 || e4 >= 9552 && e4 <= 9587 || e4 >= 9600 && e4 <= 9615 || e4 >= 9618 && e4 <= 9621 || e4 === 9632 || e4 === 9633 || e4 >= 9635 && e4 <= 9641 || e4 === 9650 || e4 === 9651 || e4 === 9654 || e4 === 9655 || e4 === 9660 || e4 === 9661 || e4 === 9664 || e4 === 9665 || e4 >= 9670 && e4 <= 9672 || e4 === 9675 || e4 >= 9678 && e4 <= 9681 || e4 >= 9698 && e4 <= 9701 || e4 === 9711 || e4 === 9733 || e4 === 9734 || e4 === 9737 || e4 === 9742 || e4 === 9743 || e4 === 9756 || e4 === 9758 || e4 === 9792 || e4 === 9794 || e4 === 9824 || e4 === 9825 || e4 >= 9827 && e4 <= 9829 || e4 >= 9831 && e4 <= 9834 || e4 === 9836 || e4 === 9837 || e4 === 9839 || e4 === 9886 || e4 === 9887 || e4 === 9919 || e4 >= 9926 && e4 <= 9933 || e4 >= 9935 && e4 <= 9939 || e4 >= 9941 && e4 <= 9953 || e4 === 9955 || e4 === 9960 || e4 === 9961 || e4 >= 9963 && e4 <= 9969 || e4 === 9972 || e4 >= 9974 && e4 <= 9977 || e4 === 9979 || e4 === 9980 || e4 === 9982 || e4 === 9983 || e4 === 10045 || e4 >= 10102 && e4 <= 10111 || e4 >= 11094 && e4 <= 11097 || e4 >= 12872 && e4 <= 12879 || e4 >= 57344 && e4 <= 63743 || e4 >= 65024 && e4 <= 65039 || e4 === 65533 || e4 >= 127232 && e4 <= 127242 || e4 >= 127248 && e4 <= 127277 || e4 >= 127280 && e4 <= 127337 || e4 >= 127344 && e4 <= 127373 || e4 === 127375 || e4 === 127376 || e4 >= 127387 && e4 <= 127404 || e4 >= 917760 && e4 <= 917999 || e4 >= 983040 && e4 <= 1048573 || e4 >= 1048576 && e4 <= 1114109;
|
|
27910
|
+
var gt2 = (e4) => e4 === 12288 || e4 >= 65281 && e4 <= 65376 || e4 >= 65504 && e4 <= 65510;
|
|
27911
|
+
var ft2 = (e4) => e4 >= 4352 && e4 <= 4447 || e4 === 8986 || e4 === 8987 || e4 === 9001 || e4 === 9002 || e4 >= 9193 && e4 <= 9196 || e4 === 9200 || e4 === 9203 || e4 === 9725 || e4 === 9726 || e4 === 9748 || e4 === 9749 || e4 >= 9800 && e4 <= 9811 || e4 === 9855 || e4 === 9875 || e4 === 9889 || e4 === 9898 || e4 === 9899 || e4 === 9917 || e4 === 9918 || e4 === 9924 || e4 === 9925 || e4 === 9934 || e4 === 9940 || e4 === 9962 || e4 === 9970 || e4 === 9971 || e4 === 9973 || e4 === 9978 || e4 === 9981 || e4 === 9989 || e4 === 9994 || e4 === 9995 || e4 === 10024 || e4 === 10060 || e4 === 10062 || e4 >= 10067 && e4 <= 10069 || e4 === 10071 || e4 >= 10133 && e4 <= 10135 || e4 === 10160 || e4 === 10175 || e4 === 11035 || e4 === 11036 || e4 === 11088 || e4 === 11093 || e4 >= 11904 && e4 <= 11929 || e4 >= 11931 && e4 <= 12019 || e4 >= 12032 && e4 <= 12245 || e4 >= 12272 && e4 <= 12287 || e4 >= 12289 && e4 <= 12350 || e4 >= 12353 && e4 <= 12438 || e4 >= 12441 && e4 <= 12543 || e4 >= 12549 && e4 <= 12591 || e4 >= 12593 && e4 <= 12686 || e4 >= 12688 && e4 <= 12771 || e4 >= 12783 && e4 <= 12830 || e4 >= 12832 && e4 <= 12871 || e4 >= 12880 && e4 <= 19903 || e4 >= 19968 && e4 <= 42124 || e4 >= 42128 && e4 <= 42182 || e4 >= 43360 && e4 <= 43388 || e4 >= 44032 && e4 <= 55203 || e4 >= 63744 && e4 <= 64255 || e4 >= 65040 && e4 <= 65049 || e4 >= 65072 && e4 <= 65106 || e4 >= 65108 && e4 <= 65126 || e4 >= 65128 && e4 <= 65131 || e4 >= 94176 && e4 <= 94180 || e4 === 94192 || e4 === 94193 || e4 >= 94208 && e4 <= 100343 || e4 >= 100352 && e4 <= 101589 || e4 >= 101632 && e4 <= 101640 || e4 >= 110576 && e4 <= 110579 || e4 >= 110581 && e4 <= 110587 || e4 === 110589 || e4 === 110590 || e4 >= 110592 && e4 <= 110882 || e4 === 110898 || e4 >= 110928 && e4 <= 110930 || e4 === 110933 || e4 >= 110948 && e4 <= 110951 || e4 >= 110960 && e4 <= 111355 || e4 === 126980 || e4 === 127183 || e4 === 127374 || e4 >= 127377 && e4 <= 127386 || e4 >= 127488 && e4 <= 127490 || e4 >= 127504 && e4 <= 127547 || e4 >= 127552 && e4 <= 127560 || e4 === 127568 || e4 === 127569 || e4 >= 127584 && e4 <= 127589 || e4 >= 127744 && e4 <= 127776 || e4 >= 127789 && e4 <= 127797 || e4 >= 127799 && e4 <= 127868 || e4 >= 127870 && e4 <= 127891 || e4 >= 127904 && e4 <= 127946 || e4 >= 127951 && e4 <= 127955 || e4 >= 127968 && e4 <= 127984 || e4 === 127988 || e4 >= 127992 && e4 <= 128062 || e4 === 128064 || e4 >= 128066 && e4 <= 128252 || e4 >= 128255 && e4 <= 128317 || e4 >= 128331 && e4 <= 128334 || e4 >= 128336 && e4 <= 128359 || e4 === 128378 || e4 === 128405 || e4 === 128406 || e4 === 128420 || e4 >= 128507 && e4 <= 128591 || e4 >= 128640 && e4 <= 128709 || e4 === 128716 || e4 >= 128720 && e4 <= 128722 || e4 >= 128725 && e4 <= 128727 || e4 >= 128732 && e4 <= 128735 || e4 === 128747 || e4 === 128748 || e4 >= 128756 && e4 <= 128764 || e4 >= 128992 && e4 <= 129003 || e4 === 129008 || e4 >= 129292 && e4 <= 129338 || e4 >= 129340 && e4 <= 129349 || e4 >= 129351 && e4 <= 129535 || e4 >= 129648 && e4 <= 129660 || e4 >= 129664 && e4 <= 129672 || e4 >= 129680 && e4 <= 129725 || e4 >= 129727 && e4 <= 129733 || e4 >= 129742 && e4 <= 129755 || e4 >= 129760 && e4 <= 129768 || e4 >= 129776 && e4 <= 129784 || e4 >= 131072 && e4 <= 196605 || e4 >= 196608 && e4 <= 262141;
|
|
27912
|
+
var we = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
|
|
27913
|
+
var re = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
27914
|
+
var ie = /\t{1,1000}/y;
|
|
27915
|
+
var Ae = new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*", "yu");
|
|
27916
|
+
var ne = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
27917
|
+
var Ft2 = new RegExp("\\p{M}+", "gu");
|
|
27918
|
+
var yt2 = { limit: 1 / 0, ellipsis: "" };
|
|
27919
|
+
var Le = (e4, r = {}, s = {}) => {
|
|
27920
|
+
const i = r.limit ?? 1 / 0, a = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (a ? Le(a, yt2, s).width : 0), u = s.ansiWidth ?? 0, l = s.controlWidth ?? 0, n = s.tabWidth ?? 8, c = s.ambiguousWidth ?? 1, p = s.emojiWidth ?? 2, f = s.fullWidthWidth ?? 2, g = s.regularWidth ?? 1, E = s.wideWidth ?? 2;
|
|
27921
|
+
let $ = 0, m = 0, d = e4.length, F = 0, y2 = false, v = d, C = Math.max(0, i - o), A = 0, b = 0, w = 0, S2 = 0;
|
|
27922
|
+
e: for (; ; ) {
|
|
27923
|
+
if (b > A || m >= d && m > $) {
|
|
27924
|
+
const T2 = e4.slice(A, b) || e4.slice($, m);
|
|
27925
|
+
F = 0;
|
|
27926
|
+
for (const M2 of T2.replaceAll(Ft2, "")) {
|
|
27927
|
+
const O2 = M2.codePointAt(0) || 0;
|
|
27928
|
+
if (gt2(O2) ? S2 = f : ft2(O2) ? S2 = E : c !== g && mt2(O2) ? S2 = c : S2 = g, w + S2 > C && (v = Math.min(v, Math.max(A, $) + F)), w + S2 > i) {
|
|
27929
|
+
y2 = true;
|
|
27930
|
+
break e;
|
|
27931
|
+
}
|
|
27932
|
+
F += M2.length, w += S2;
|
|
27933
|
+
}
|
|
27934
|
+
A = b = 0;
|
|
27935
|
+
}
|
|
27936
|
+
if (m >= d) break;
|
|
27937
|
+
if (ne.lastIndex = m, ne.test(e4)) {
|
|
27938
|
+
if (F = ne.lastIndex - m, S2 = F * g, w + S2 > C && (v = Math.min(v, m + Math.floor((C - w) / g))), w + S2 > i) {
|
|
27939
|
+
y2 = true;
|
|
27940
|
+
break;
|
|
27941
|
+
}
|
|
27942
|
+
w += S2, A = $, b = m, m = $ = ne.lastIndex;
|
|
27943
|
+
continue;
|
|
27944
|
+
}
|
|
27945
|
+
if (we.lastIndex = m, we.test(e4)) {
|
|
27946
|
+
if (w + u > C && (v = Math.min(v, m)), w + u > i) {
|
|
27947
|
+
y2 = true;
|
|
27948
|
+
break;
|
|
27949
|
+
}
|
|
27950
|
+
w += u, A = $, b = m, m = $ = we.lastIndex;
|
|
27951
|
+
continue;
|
|
27952
|
+
}
|
|
27953
|
+
if (re.lastIndex = m, re.test(e4)) {
|
|
27954
|
+
if (F = re.lastIndex - m, S2 = F * l, w + S2 > C && (v = Math.min(v, m + Math.floor((C - w) / l))), w + S2 > i) {
|
|
27955
|
+
y2 = true;
|
|
27956
|
+
break;
|
|
27957
|
+
}
|
|
27958
|
+
w += S2, A = $, b = m, m = $ = re.lastIndex;
|
|
27959
|
+
continue;
|
|
27960
|
+
}
|
|
27961
|
+
if (ie.lastIndex = m, ie.test(e4)) {
|
|
27962
|
+
if (F = ie.lastIndex - m, S2 = F * n, w + S2 > C && (v = Math.min(v, m + Math.floor((C - w) / n))), w + S2 > i) {
|
|
27963
|
+
y2 = true;
|
|
27964
|
+
break;
|
|
27965
|
+
}
|
|
27966
|
+
w += S2, A = $, b = m, m = $ = ie.lastIndex;
|
|
27967
|
+
continue;
|
|
27968
|
+
}
|
|
27969
|
+
if (Ae.lastIndex = m, Ae.test(e4)) {
|
|
27970
|
+
if (w + p > C && (v = Math.min(v, m)), w + p > i) {
|
|
27971
|
+
y2 = true;
|
|
27972
|
+
break;
|
|
27973
|
+
}
|
|
27974
|
+
w += p, A = $, b = m, m = $ = Ae.lastIndex;
|
|
27975
|
+
continue;
|
|
27976
|
+
}
|
|
27977
|
+
m += 1;
|
|
27978
|
+
}
|
|
27979
|
+
return { width: y2 ? C : w, index: y2 ? v : d, truncated: y2, ellipsed: y2 && i >= o };
|
|
27980
|
+
};
|
|
27981
|
+
var Et2 = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
|
|
27982
|
+
var D2 = (e4, r = {}) => Le(e4, Et2, r).width;
|
|
27983
|
+
var ae = "\x1B";
|
|
27984
|
+
var je = "\x9B";
|
|
27985
|
+
var vt2 = 39;
|
|
27986
|
+
var Ce = "\x07";
|
|
27987
|
+
var ke = "[";
|
|
27988
|
+
var wt = "]";
|
|
27989
|
+
var Ve = "m";
|
|
27990
|
+
var Se = `${wt}8;;`;
|
|
27991
|
+
var He = new RegExp(`(?:\\${ke}(?<code>\\d+)m|\\${Se}(?<uri>.*)${Ce})`, "y");
|
|
27992
|
+
var At2 = (e4) => {
|
|
27993
|
+
if (e4 >= 30 && e4 <= 37 || e4 >= 90 && e4 <= 97) return 39;
|
|
27994
|
+
if (e4 >= 40 && e4 <= 47 || e4 >= 100 && e4 <= 107) return 49;
|
|
27995
|
+
if (e4 === 1 || e4 === 2) return 22;
|
|
27996
|
+
if (e4 === 3) return 23;
|
|
27997
|
+
if (e4 === 4) return 24;
|
|
27998
|
+
if (e4 === 7) return 27;
|
|
27999
|
+
if (e4 === 8) return 28;
|
|
28000
|
+
if (e4 === 9) return 29;
|
|
28001
|
+
if (e4 === 0) return 0;
|
|
28002
|
+
};
|
|
28003
|
+
var Ue = (e4) => `${ae}${ke}${e4}${Ve}`;
|
|
28004
|
+
var Ke = (e4) => `${ae}${Se}${e4}${Ce}`;
|
|
28005
|
+
var Ct2 = (e4) => e4.map((r) => D2(r));
|
|
28006
|
+
var Ie = (e4, r, s) => {
|
|
28007
|
+
const i = r[Symbol.iterator]();
|
|
28008
|
+
let a = false, o = false, u = e4.at(-1), l = u === void 0 ? 0 : D2(u), n = i.next(), c = i.next(), p = 0;
|
|
28009
|
+
for (; !n.done; ) {
|
|
28010
|
+
const f = n.value, g = D2(f);
|
|
28011
|
+
l + g <= s ? e4[e4.length - 1] += f : (e4.push(f), l = 0), (f === ae || f === je) && (a = true, o = r.startsWith(Se, p + 1)), a ? o ? f === Ce && (a = false, o = false) : f === Ve && (a = false) : (l += g, l === s && !c.done && (e4.push(""), l = 0)), n = c, c = i.next(), p += f.length;
|
|
28012
|
+
}
|
|
28013
|
+
u = e4.at(-1), !l && u !== void 0 && u.length > 0 && e4.length > 1 && (e4[e4.length - 2] += e4.pop());
|
|
28014
|
+
};
|
|
28015
|
+
var St = (e4) => {
|
|
28016
|
+
const r = e4.split(" ");
|
|
28017
|
+
let s = r.length;
|
|
28018
|
+
for (; s > 0 && !(D2(r[s - 1]) > 0); ) s--;
|
|
28019
|
+
return s === r.length ? e4 : r.slice(0, s).join(" ") + r.slice(s).join("");
|
|
28020
|
+
};
|
|
28021
|
+
var It2 = (e4, r, s = {}) => {
|
|
28022
|
+
if (s.trim !== false && e4.trim() === "") return "";
|
|
28023
|
+
let i = "", a, o;
|
|
28024
|
+
const u = e4.split(" "), l = Ct2(u);
|
|
28025
|
+
let n = [""];
|
|
28026
|
+
for (const [$, m] of u.entries()) {
|
|
28027
|
+
s.trim !== false && (n[n.length - 1] = (n.at(-1) ?? "").trimStart());
|
|
28028
|
+
let d = D2(n.at(-1) ?? "");
|
|
28029
|
+
if ($ !== 0 && (d >= r && (s.wordWrap === false || s.trim === false) && (n.push(""), d = 0), (d > 0 || s.trim === false) && (n[n.length - 1] += " ", d++)), s.hard && l[$] > r) {
|
|
28030
|
+
const F = r - d, y2 = 1 + Math.floor((l[$] - F - 1) / r);
|
|
28031
|
+
Math.floor((l[$] - 1) / r) < y2 && n.push(""), Ie(n, m, r);
|
|
28032
|
+
continue;
|
|
28033
|
+
}
|
|
28034
|
+
if (d + l[$] > r && d > 0 && l[$] > 0) {
|
|
28035
|
+
if (s.wordWrap === false && d < r) {
|
|
28036
|
+
Ie(n, m, r);
|
|
28037
|
+
continue;
|
|
28038
|
+
}
|
|
28039
|
+
n.push("");
|
|
28040
|
+
}
|
|
28041
|
+
if (d + l[$] > r && s.wordWrap === false) {
|
|
28042
|
+
Ie(n, m, r);
|
|
28043
|
+
continue;
|
|
28044
|
+
}
|
|
28045
|
+
n[n.length - 1] += m;
|
|
28046
|
+
}
|
|
28047
|
+
s.trim !== false && (n = n.map(($) => St($)));
|
|
28048
|
+
const c = n.join(`
|
|
28049
|
+
`), p = c[Symbol.iterator]();
|
|
28050
|
+
let f = p.next(), g = p.next(), E = 0;
|
|
28051
|
+
for (; !f.done; ) {
|
|
28052
|
+
const $ = f.value, m = g.value;
|
|
28053
|
+
if (i += $, $ === ae || $ === je) {
|
|
28054
|
+
He.lastIndex = E + 1;
|
|
28055
|
+
const y2 = He.exec(c)?.groups;
|
|
28056
|
+
if (y2?.code !== void 0) {
|
|
28057
|
+
const v = Number.parseFloat(y2.code);
|
|
28058
|
+
a = v === vt2 ? void 0 : v;
|
|
28059
|
+
} else y2?.uri !== void 0 && (o = y2.uri.length === 0 ? void 0 : y2.uri);
|
|
28060
|
+
}
|
|
28061
|
+
const d = a ? At2(a) : void 0;
|
|
28062
|
+
m === `
|
|
28063
|
+
` ? (o && (i += Ke("")), a && d && (i += Ue(d))) : $ === `
|
|
28064
|
+
` && (a && d && (i += Ue(a)), o && (i += Ke(o))), E += $.length, f = g, g = p.next();
|
|
28065
|
+
}
|
|
28066
|
+
return i;
|
|
28067
|
+
};
|
|
28068
|
+
function J(e4, r, s) {
|
|
28069
|
+
return String(e4).normalize().replaceAll(`\r
|
|
28070
|
+
`, `
|
|
28071
|
+
`).split(`
|
|
28072
|
+
`).map((i) => It2(i, r, s)).join(`
|
|
28073
|
+
`);
|
|
28074
|
+
}
|
|
28075
|
+
var bt2 = (e4, r, s, i, a) => {
|
|
28076
|
+
let o = r, u = 0;
|
|
28077
|
+
for (let l = s; l < i; l++) {
|
|
28078
|
+
const n = e4[l];
|
|
28079
|
+
if (o = o - n.length, u++, o <= a) break;
|
|
28080
|
+
}
|
|
28081
|
+
return { lineCount: o, removals: u };
|
|
28082
|
+
};
|
|
28083
|
+
var X2 = ({ cursor: e4, options: r, style: s, output: i = process.stdout, maxItems: a = Number.POSITIVE_INFINITY, columnPadding: o = 0, rowPadding: u = 4 }) => {
|
|
28084
|
+
const l = rt(i) - o, n = nt(i), c = (0, import_node_util2.styleText)("dim", "..."), p = Math.max(n - u, 0), f = Math.max(Math.min(a, p), 5);
|
|
28085
|
+
let g = 0;
|
|
28086
|
+
e4 >= f - 3 && (g = Math.max(Math.min(e4 - f + 3, r.length - f), 0));
|
|
28087
|
+
let E = f < r.length && g > 0, $ = f < r.length && g + f < r.length;
|
|
28088
|
+
const m = Math.min(g + f, r.length), d = [];
|
|
28089
|
+
let F = 0;
|
|
28090
|
+
E && F++, $ && F++;
|
|
28091
|
+
const y2 = g + (E ? 1 : 0), v = m - ($ ? 1 : 0);
|
|
28092
|
+
for (let A = y2; A < v; A++) {
|
|
28093
|
+
const b = J(s(r[A], A === e4), l, { hard: true, trim: false }).split(`
|
|
28094
|
+
`);
|
|
28095
|
+
d.push(b), F += b.length;
|
|
28096
|
+
}
|
|
28097
|
+
if (F > p) {
|
|
28098
|
+
let A = 0, b = 0, w = F;
|
|
28099
|
+
const S2 = e4 - y2, T2 = (M2, O2) => bt2(d, w, M2, O2, p);
|
|
28100
|
+
E ? ({ lineCount: w, removals: A } = T2(0, S2), w > p && ({ lineCount: w, removals: b } = T2(S2 + 1, d.length))) : ({ lineCount: w, removals: b } = T2(S2 + 1, d.length), w > p && ({ lineCount: w, removals: A } = T2(0, S2))), A > 0 && (E = true, d.splice(0, A)), b > 0 && ($ = true, d.splice(d.length - b, b));
|
|
28101
|
+
}
|
|
28102
|
+
const C = [];
|
|
28103
|
+
E && C.push(c);
|
|
28104
|
+
for (const A of d) for (const b of A) C.push(b);
|
|
28105
|
+
return $ && C.push(c), C;
|
|
28106
|
+
};
|
|
28107
|
+
var Ot = async (e4, r) => {
|
|
28108
|
+
const s = {}, i = Object.keys(e4);
|
|
28109
|
+
for (const a of i) {
|
|
28110
|
+
const o = e4[a], u = await o({ results: s })?.catch((l) => {
|
|
28111
|
+
throw l;
|
|
28112
|
+
});
|
|
28113
|
+
if (typeof r?.onCancel == "function" && Ct(u)) {
|
|
28114
|
+
s[a] = "canceled", r.onCancel({ results: s });
|
|
28115
|
+
continue;
|
|
28116
|
+
}
|
|
28117
|
+
s[a] = u;
|
|
28118
|
+
}
|
|
28119
|
+
return s;
|
|
28120
|
+
};
|
|
28121
|
+
var Nt = (e4 = "", r) => {
|
|
28122
|
+
const s = r?.output ?? process.stdout, i = r?.withGuide ?? _.withGuide ? `${(0, import_node_util2.styleText)("gray", x2)} ` : "";
|
|
28123
|
+
s.write(`${i}${(0, import_node_util2.styleText)("red", e4)}
|
|
28124
|
+
|
|
28125
|
+
`);
|
|
28126
|
+
};
|
|
28127
|
+
var Wt2 = (e4 = "", r) => {
|
|
28128
|
+
const s = r?.output ?? process.stdout, i = r?.withGuide ?? _.withGuide ? `${(0, import_node_util2.styleText)("gray", he)} ` : "";
|
|
28129
|
+
s.write(`${i}${e4}
|
|
28130
|
+
`);
|
|
28131
|
+
};
|
|
28132
|
+
var Gt = (e4 = "", r) => {
|
|
28133
|
+
const s = r?.output ?? process.stdout, i = r?.withGuide ?? _.withGuide ? `${(0, import_node_util2.styleText)("gray", h)}
|
|
28134
|
+
${(0, import_node_util2.styleText)("gray", x2)} ` : "";
|
|
28135
|
+
s.write(`${i}${e4}
|
|
28136
|
+
|
|
28137
|
+
`);
|
|
28138
|
+
};
|
|
28139
|
+
var Q2 = (e4, r) => e4.split(`
|
|
28140
|
+
`).map((s) => r(s)).join(`
|
|
28141
|
+
`);
|
|
28142
|
+
var Lt2 = (e4) => {
|
|
28143
|
+
const r = (i, a) => {
|
|
28144
|
+
const o = i.label ?? String(i.value);
|
|
28145
|
+
return a === "disabled" ? `${(0, import_node_util2.styleText)("gray", q2)} ${Q2(o, (u) => (0, import_node_util2.styleText)(["strikethrough", "gray"], u))}${i.hint ? ` ${(0, import_node_util2.styleText)("dim", `(${i.hint ?? "disabled"})`)}` : ""}` : a === "active" ? `${(0, import_node_util2.styleText)("cyan", te)} ${o}${i.hint ? ` ${(0, import_node_util2.styleText)("dim", `(${i.hint})`)}` : ""}` : a === "selected" ? `${(0, import_node_util2.styleText)("green", U2)} ${Q2(o, (u) => (0, import_node_util2.styleText)("dim", u))}${i.hint ? ` ${(0, import_node_util2.styleText)("dim", `(${i.hint})`)}` : ""}` : a === "cancelled" ? `${Q2(o, (u) => (0, import_node_util2.styleText)(["strikethrough", "dim"], u))}` : a === "active-selected" ? `${(0, import_node_util2.styleText)("green", U2)} ${o}${i.hint ? ` ${(0, import_node_util2.styleText)("dim", `(${i.hint})`)}` : ""}` : a === "submitted" ? `${Q2(o, (u) => (0, import_node_util2.styleText)("dim", u))}` : `${(0, import_node_util2.styleText)("dim", q2)} ${Q2(o, (u) => (0, import_node_util2.styleText)("dim", u))}`;
|
|
28146
|
+
}, s = e4.required ?? true;
|
|
28147
|
+
return new Lt({ options: e4.options, signal: e4.signal, input: e4.input, output: e4.output, initialValues: e4.initialValues, required: s, cursorAt: e4.cursorAt, validate(i) {
|
|
28148
|
+
if (s && (i === void 0 || i.length === 0)) return `Please select at least one option.
|
|
28149
|
+
${(0, import_node_util2.styleText)("reset", (0, import_node_util2.styleText)("dim", `Press ${(0, import_node_util2.styleText)(["gray", "bgWhite", "inverse"], " space ")} to select, ${(0, import_node_util2.styleText)("gray", (0, import_node_util2.styleText)("bgWhite", (0, import_node_util2.styleText)("inverse", " enter ")))} to submit`))}`;
|
|
28150
|
+
}, render() {
|
|
28151
|
+
const i = Bt(e4.output, e4.message, `${ve(this.state)} `, `${W2(this.state)} `), a = `${(0, import_node_util2.styleText)("gray", h)}
|
|
28152
|
+
${i}
|
|
28153
|
+
`, o = this.value ?? [], u = (l, n) => {
|
|
28154
|
+
if (l.disabled) return r(l, "disabled");
|
|
28155
|
+
const c = o.includes(l.value);
|
|
28156
|
+
return n && c ? r(l, "active-selected") : c ? r(l, "selected") : r(l, n ? "active" : "inactive");
|
|
28157
|
+
};
|
|
28158
|
+
switch (this.state) {
|
|
28159
|
+
case "submit": {
|
|
28160
|
+
const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "submitted")).join((0, import_node_util2.styleText)("dim", ", ")) || (0, import_node_util2.styleText)("dim", "none"), n = Bt(e4.output, l, `${(0, import_node_util2.styleText)("gray", h)} `);
|
|
28161
|
+
return `${a}${n}`;
|
|
28162
|
+
}
|
|
28163
|
+
case "cancel": {
|
|
28164
|
+
const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "cancelled")).join((0, import_node_util2.styleText)("dim", ", "));
|
|
28165
|
+
if (l.trim() === "") return `${a}${(0, import_node_util2.styleText)("gray", h)}`;
|
|
28166
|
+
const n = Bt(e4.output, l, `${(0, import_node_util2.styleText)("gray", h)} `);
|
|
28167
|
+
return `${a}${n}
|
|
28168
|
+
${(0, import_node_util2.styleText)("gray", h)}`;
|
|
28169
|
+
}
|
|
28170
|
+
case "error": {
|
|
28171
|
+
const l = `${(0, import_node_util2.styleText)("yellow", h)} `, n = this.error.split(`
|
|
28172
|
+
`).map((f, g) => g === 0 ? `${(0, import_node_util2.styleText)("yellow", x2)} ${(0, import_node_util2.styleText)("yellow", f)}` : ` ${f}`).join(`
|
|
28173
|
+
`), c = a.split(`
|
|
28174
|
+
`).length, p = n.split(`
|
|
28175
|
+
`).length + 1;
|
|
28176
|
+
return `${a}${l}${X2({ output: e4.output, options: this.options, cursor: this.cursor, maxItems: e4.maxItems, columnPadding: l.length, rowPadding: c + p, style: u }).join(`
|
|
28177
|
+
${l}`)}
|
|
28178
|
+
${n}
|
|
28179
|
+
`;
|
|
28180
|
+
}
|
|
28181
|
+
default: {
|
|
28182
|
+
const l = `${(0, import_node_util2.styleText)("cyan", h)} `, n = a.split(`
|
|
28183
|
+
`).length;
|
|
28184
|
+
return `${a}${l}${X2({ output: e4.output, options: this.options, cursor: this.cursor, maxItems: e4.maxItems, columnPadding: l.length, rowPadding: n + 2, style: u }).join(`
|
|
28185
|
+
${l}`)}
|
|
28186
|
+
${(0, import_node_util2.styleText)("cyan", x2)}
|
|
28187
|
+
`;
|
|
28188
|
+
}
|
|
28189
|
+
}
|
|
28190
|
+
} }).prompt();
|
|
28191
|
+
};
|
|
28192
|
+
var jt = (e4) => (0, import_node_util2.styleText)("dim", e4);
|
|
28193
|
+
var kt2 = (e4, r, s) => {
|
|
28194
|
+
const i = { hard: true, trim: false }, a = J(e4, r, i).split(`
|
|
28195
|
+
`), o = a.reduce((n, c) => Math.max(D2(c), n), 0), u = a.map(s).reduce((n, c) => Math.max(D2(c), n), 0), l = r - (u - o);
|
|
28196
|
+
return J(e4, l, i);
|
|
28197
|
+
};
|
|
28198
|
+
var Vt2 = (e4 = "", r = "", s) => {
|
|
28199
|
+
const i = s?.output ?? import_node_process2.default.stdout, a = s?.withGuide ?? _.withGuide, o = s?.format ?? jt, u = ["", ...kt2(e4, rt(i) - 6, o).split(`
|
|
28200
|
+
`).map(o), ""], l = D2(r), n = Math.max(u.reduce((g, E) => {
|
|
28201
|
+
const $ = D2(E);
|
|
28202
|
+
return $ > g ? $ : g;
|
|
28203
|
+
}, 0), l) + 2, c = u.map((g) => `${(0, import_node_util2.styleText)("gray", h)} ${g}${" ".repeat(n - D2(g))}${(0, import_node_util2.styleText)("gray", h)}`).join(`
|
|
28204
|
+
`), p = a ? `${(0, import_node_util2.styleText)("gray", h)}
|
|
28205
|
+
` : "", f = a ? We : ge;
|
|
28206
|
+
i.write(`${p}${(0, import_node_util2.styleText)("green", V)} ${(0, import_node_util2.styleText)("reset", r)} ${(0, import_node_util2.styleText)("gray", se.repeat(Math.max(n - l - 1, 1)) + pe)}
|
|
28207
|
+
${c}
|
|
28208
|
+
${(0, import_node_util2.styleText)("gray", f + se.repeat(n + 2) + me)}
|
|
28209
|
+
`);
|
|
28210
|
+
};
|
|
28211
|
+
var ze = { light: I2("\u2500", "-"), heavy: I2("\u2501", "="), block: I2("\u2588", "#") };
|
|
28212
|
+
var oe = (e4, r) => e4.includes(`
|
|
28213
|
+
`) ? e4.split(`
|
|
28214
|
+
`).map((s) => r(s)).join(`
|
|
28215
|
+
`) : r(e4);
|
|
28216
|
+
var Jt = (e4) => {
|
|
28217
|
+
const r = (s, i) => {
|
|
28218
|
+
const a = s.label ?? String(s.value);
|
|
28219
|
+
switch (i) {
|
|
28220
|
+
case "disabled":
|
|
28221
|
+
return `${(0, import_node_util2.styleText)("gray", H2)} ${oe(a, (o) => (0, import_node_util2.styleText)("gray", o))}${s.hint ? ` ${(0, import_node_util2.styleText)("dim", `(${s.hint ?? "disabled"})`)}` : ""}`;
|
|
28222
|
+
case "selected":
|
|
28223
|
+
return `${oe(a, (o) => (0, import_node_util2.styleText)("dim", o))}`;
|
|
28224
|
+
case "active":
|
|
28225
|
+
return `${(0, import_node_util2.styleText)("green", z2)} ${a}${s.hint ? ` ${(0, import_node_util2.styleText)("dim", `(${s.hint})`)}` : ""}`;
|
|
28226
|
+
case "cancelled":
|
|
28227
|
+
return `${oe(a, (o) => (0, import_node_util2.styleText)(["strikethrough", "dim"], o))}`;
|
|
28228
|
+
default:
|
|
28229
|
+
return `${(0, import_node_util2.styleText)("dim", H2)} ${oe(a, (o) => (0, import_node_util2.styleText)("dim", o))}`;
|
|
28230
|
+
}
|
|
28231
|
+
};
|
|
28232
|
+
return new Tt({ options: e4.options, signal: e4.signal, input: e4.input, output: e4.output, initialValue: e4.initialValue, render() {
|
|
28233
|
+
const s = e4.withGuide ?? _.withGuide, i = `${W2(this.state)} `, a = `${ve(this.state)} `, o = Bt(e4.output, e4.message, a, i), u = `${s ? `${(0, import_node_util2.styleText)("gray", h)}
|
|
28234
|
+
` : ""}${o}
|
|
28235
|
+
`;
|
|
28236
|
+
switch (this.state) {
|
|
28237
|
+
case "submit": {
|
|
28238
|
+
const l = s ? `${(0, import_node_util2.styleText)("gray", h)} ` : "", n = Bt(e4.output, r(this.options[this.cursor], "selected"), l);
|
|
28239
|
+
return `${u}${n}`;
|
|
28240
|
+
}
|
|
28241
|
+
case "cancel": {
|
|
28242
|
+
const l = s ? `${(0, import_node_util2.styleText)("gray", h)} ` : "", n = Bt(e4.output, r(this.options[this.cursor], "cancelled"), l);
|
|
28243
|
+
return `${u}${n}${s ? `
|
|
28244
|
+
${(0, import_node_util2.styleText)("gray", h)}` : ""}`;
|
|
28245
|
+
}
|
|
28246
|
+
default: {
|
|
28247
|
+
const l = s ? `${(0, import_node_util2.styleText)("cyan", h)} ` : "", n = s ? (0, import_node_util2.styleText)("cyan", x2) : "", c = u.split(`
|
|
28248
|
+
`).length, p = s ? 2 : 1;
|
|
28249
|
+
return `${u}${l}${X2({ output: e4.output, cursor: this.cursor, options: this.options, maxItems: e4.maxItems, columnPadding: l.length, rowPadding: c + p, style: (f, g) => r(f, f.disabled ? "disabled" : g ? "active" : "inactive") }).join(`
|
|
28250
|
+
${l}`)}
|
|
28251
|
+
${n}
|
|
28252
|
+
`;
|
|
28253
|
+
}
|
|
28254
|
+
}
|
|
28255
|
+
} }).prompt();
|
|
28256
|
+
};
|
|
28257
|
+
var Qe = `${(0, import_node_util2.styleText)("gray", h)} `;
|
|
28258
|
+
var Zt = (e4) => new $t({ validate: e4.validate, placeholder: e4.placeholder, defaultValue: e4.defaultValue, initialValue: e4.initialValue, output: e4.output, signal: e4.signal, input: e4.input, render() {
|
|
28259
|
+
const r = e4?.withGuide ?? _.withGuide, s = `${`${r ? `${(0, import_node_util2.styleText)("gray", h)}
|
|
28260
|
+
` : ""}${W2(this.state)} `}${e4.message}
|
|
28261
|
+
`, i = e4.placeholder ? (0, import_node_util2.styleText)("inverse", e4.placeholder[0]) + (0, import_node_util2.styleText)("dim", e4.placeholder.slice(1)) : (0, import_node_util2.styleText)(["inverse", "hidden"], "_"), a = this.userInput ? this.userInputWithCursor : i, o = this.value ?? "";
|
|
28262
|
+
switch (this.state) {
|
|
28263
|
+
case "error": {
|
|
28264
|
+
const u = this.error ? ` ${(0, import_node_util2.styleText)("yellow", this.error)}` : "", l = r ? `${(0, import_node_util2.styleText)("yellow", h)} ` : "", n = r ? (0, import_node_util2.styleText)("yellow", x2) : "";
|
|
28265
|
+
return `${s.trim()}
|
|
28266
|
+
${l}${a}
|
|
28267
|
+
${n}${u}
|
|
28268
|
+
`;
|
|
28269
|
+
}
|
|
28270
|
+
case "submit": {
|
|
28271
|
+
const u = o ? ` ${(0, import_node_util2.styleText)("dim", o)}` : "", l = r ? (0, import_node_util2.styleText)("gray", h) : "";
|
|
28272
|
+
return `${s}${l}${u}`;
|
|
28273
|
+
}
|
|
28274
|
+
case "cancel": {
|
|
28275
|
+
const u = o ? ` ${(0, import_node_util2.styleText)(["strikethrough", "dim"], o)}` : "", l = r ? (0, import_node_util2.styleText)("gray", h) : "";
|
|
28276
|
+
return `${s}${l}${u}${o.trim() ? `
|
|
28277
|
+
${l}` : ""}`;
|
|
28278
|
+
}
|
|
28279
|
+
default: {
|
|
28280
|
+
const u = r ? `${(0, import_node_util2.styleText)("cyan", h)} ` : "", l = r ? (0, import_node_util2.styleText)("cyan", x2) : "";
|
|
28281
|
+
return `${s}${u}${a}
|
|
28282
|
+
${l}
|
|
28283
|
+
`;
|
|
28284
|
+
}
|
|
28285
|
+
}
|
|
28286
|
+
} }).prompt();
|
|
28287
|
+
|
|
28288
|
+
// dist/commands/project.js
|
|
28289
|
+
var import_node_path3 = __toESM(require("node:path"), 1);
|
|
28290
|
+
|
|
27370
28291
|
// ../platform-node/dist/node-project-storage.js
|
|
27371
28292
|
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
27372
28293
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
@@ -27706,8 +28627,8 @@ var Project = class _Project {
|
|
|
27706
28627
|
moduleInstances;
|
|
27707
28628
|
/** Set after loading plugins to enable validation warnings on mutations. */
|
|
27708
28629
|
validator;
|
|
27709
|
-
constructor(
|
|
27710
|
-
this.path =
|
|
28630
|
+
constructor(path5, metadata, diagram) {
|
|
28631
|
+
this.path = path5;
|
|
27711
28632
|
this.name = metadata.name;
|
|
27712
28633
|
this.version = metadata.version;
|
|
27713
28634
|
this.projectConfig = metadata.projectConfig;
|
|
@@ -27933,21 +28854,106 @@ function redactSensitive(obj) {
|
|
|
27933
28854
|
}
|
|
27934
28855
|
function makeProjectCommand() {
|
|
27935
28856
|
const cmd = new Command("project").description("Project information and configuration");
|
|
27936
|
-
cmd.command("create
|
|
28857
|
+
cmd.command("create [name]").description("Create a new TerraStudio project directory").option("--path <parentPath>", "Parent directory (default: current directory)").option("--providers <providers...>", "Active providers (default: azurerm)").option("--location <location>", "Default Azure location (default: eastus)").option("--rg <resourceGroupName>", "Default resource group name").action(async (nameArg, options) => {
|
|
28858
|
+
const interactive = !nameArg;
|
|
28859
|
+
let name = nameArg;
|
|
28860
|
+
let parentPath = options.path ?? ".";
|
|
28861
|
+
let providers = options.providers;
|
|
28862
|
+
let location = options.location;
|
|
28863
|
+
let rg = options.rg;
|
|
28864
|
+
if (interactive) {
|
|
28865
|
+
Wt2("Create a new TerraStudio project");
|
|
28866
|
+
const answers = await Ot({
|
|
28867
|
+
name: () => Zt({
|
|
28868
|
+
message: "Project name",
|
|
28869
|
+
placeholder: "my-infra",
|
|
28870
|
+
validate: (val = "") => {
|
|
28871
|
+
if (!val.trim())
|
|
28872
|
+
return "Project name is required";
|
|
28873
|
+
if (/[<>:"/\\|?*]/.test(val))
|
|
28874
|
+
return "Project name contains invalid characters";
|
|
28875
|
+
}
|
|
28876
|
+
}),
|
|
28877
|
+
parentPath: () => Zt({
|
|
28878
|
+
message: "Project location",
|
|
28879
|
+
placeholder: ".",
|
|
28880
|
+
initialValue: "."
|
|
28881
|
+
}),
|
|
28882
|
+
providers: () => Lt2({
|
|
28883
|
+
message: "Select providers",
|
|
28884
|
+
options: [
|
|
28885
|
+
{ value: "azurerm", label: "Azure (azurerm)", hint: "Azure Resource Manager" },
|
|
28886
|
+
{ value: "aws", label: "AWS", hint: "Amazon Web Services" }
|
|
28887
|
+
],
|
|
28888
|
+
initialValues: ["azurerm"],
|
|
28889
|
+
required: true
|
|
28890
|
+
}),
|
|
28891
|
+
location: ({ results }) => {
|
|
28892
|
+
if (!results.providers?.includes("azurerm"))
|
|
28893
|
+
return;
|
|
28894
|
+
return Jt({
|
|
28895
|
+
message: "Default Azure location",
|
|
28896
|
+
options: [
|
|
28897
|
+
{ value: "eastus", label: "East US" },
|
|
28898
|
+
{ value: "eastus2", label: "East US 2" },
|
|
28899
|
+
{ value: "westus", label: "West US" },
|
|
28900
|
+
{ value: "westus2", label: "West US 2" },
|
|
28901
|
+
{ value: "westus3", label: "West US 3" },
|
|
28902
|
+
{ value: "centralus", label: "Central US" },
|
|
28903
|
+
{ value: "northeurope", label: "North Europe" },
|
|
28904
|
+
{ value: "westeurope", label: "West Europe" },
|
|
28905
|
+
{ value: "uksouth", label: "UK South" },
|
|
28906
|
+
{ value: "ukwest", label: "UK West" },
|
|
28907
|
+
{ value: "southeastasia", label: "Southeast Asia" },
|
|
28908
|
+
{ value: "australiaeast", label: "Australia East" },
|
|
28909
|
+
{ value: "canadacentral", label: "Canada Central" }
|
|
28910
|
+
],
|
|
28911
|
+
initialValue: "eastus"
|
|
28912
|
+
});
|
|
28913
|
+
},
|
|
28914
|
+
rg: ({ results }) => {
|
|
28915
|
+
const defaultRg = `rg-${results.name}`;
|
|
28916
|
+
return Zt({
|
|
28917
|
+
message: "Resource group name",
|
|
28918
|
+
placeholder: defaultRg,
|
|
28919
|
+
initialValue: defaultRg
|
|
28920
|
+
});
|
|
28921
|
+
}
|
|
28922
|
+
}, {
|
|
28923
|
+
onCancel: () => {
|
|
28924
|
+
Nt("Project creation cancelled.");
|
|
28925
|
+
process.exit(0);
|
|
28926
|
+
}
|
|
28927
|
+
});
|
|
28928
|
+
name = answers.name;
|
|
28929
|
+
parentPath = answers.parentPath || ".";
|
|
28930
|
+
providers = answers.providers;
|
|
28931
|
+
location = answers.location;
|
|
28932
|
+
rg = answers.rg;
|
|
28933
|
+
}
|
|
27937
28934
|
const stored = await storage.createProject(name, parentPath);
|
|
27938
|
-
if (
|
|
28935
|
+
if (providers || location || rg) {
|
|
27939
28936
|
const config = stored.metadata.projectConfig;
|
|
27940
|
-
if (
|
|
27941
|
-
config["activeProviders"] =
|
|
27942
|
-
if (
|
|
27943
|
-
config["location"] =
|
|
27944
|
-
if (
|
|
27945
|
-
config["resourceGroupName"] =
|
|
28937
|
+
if (providers)
|
|
28938
|
+
config["activeProviders"] = providers;
|
|
28939
|
+
if (location)
|
|
28940
|
+
config["location"] = location;
|
|
28941
|
+
if (rg)
|
|
28942
|
+
config["resourceGroupName"] = rg;
|
|
27946
28943
|
await storage.saveProjectConfig(stored.path, config);
|
|
27947
28944
|
}
|
|
27948
|
-
|
|
27949
|
-
const
|
|
27950
|
-
|
|
28945
|
+
const resolvedPath = import_node_path3.default.resolve(stored.path);
|
|
28946
|
+
const providerList = (providers ?? ["azurerm"]).join(", ");
|
|
28947
|
+
if (interactive) {
|
|
28948
|
+
Vt2([
|
|
28949
|
+
`cd ${resolvedPath}`,
|
|
28950
|
+
`tstudio generate .`
|
|
28951
|
+
].join("\n"), "Next steps");
|
|
28952
|
+
Gt(`Project "${name}" created successfully!`);
|
|
28953
|
+
} else {
|
|
28954
|
+
console.log(`Created project "${name}" at: ${resolvedPath}`);
|
|
28955
|
+
console.log(`Providers: ${providerList}`);
|
|
28956
|
+
}
|
|
27951
28957
|
});
|
|
27952
28958
|
cmd.command("info [path]").description("Show project metadata").action(async (projectPath) => {
|
|
27953
28959
|
const resolved = resolveProjectPath(projectPath);
|
|
@@ -28249,8 +29255,8 @@ function makeResourceCommand() {
|
|
|
28249
29255
|
console.error(`Node not found: ${nodeId}`);
|
|
28250
29256
|
process.exit(1);
|
|
28251
29257
|
}
|
|
28252
|
-
const
|
|
28253
|
-
const
|
|
29258
|
+
const x3 = options.x !== void 0 ? Number(options.x) : node.position.x;
|
|
29259
|
+
const y2 = options.y !== void 0 ? Number(options.y) : node.position.y;
|
|
28254
29260
|
let parentArg = void 0;
|
|
28255
29261
|
if (options.parent !== void 0) {
|
|
28256
29262
|
parentArg = options.parent === "" ? null : options.parent;
|
|
@@ -28261,9 +29267,9 @@ function makeResourceCommand() {
|
|
|
28261
29267
|
}
|
|
28262
29268
|
const providers = project.projectConfig.activeProviders ?? ["azurerm"];
|
|
28263
29269
|
project.validator = await loadValidator(providers);
|
|
28264
|
-
const { warnings } = project.moveNode(nodeId, { x, y }, parentArg);
|
|
29270
|
+
const { warnings } = project.moveNode(nodeId, { x: x3, y: y2 }, parentArg);
|
|
28265
29271
|
await storage.saveDiagram(resolved, project.toDiagramSnapshot());
|
|
28266
|
-
console.log(`Moved node ${nodeId} to (${
|
|
29272
|
+
console.log(`Moved node ${nodeId} to (${x3}, ${y2})`);
|
|
28267
29273
|
printWarnings(warnings);
|
|
28268
29274
|
});
|
|
28269
29275
|
cmd.command("resize [path] <nodeId>").description("Resize a node").requiredOption("--width <width>", "New width").requiredOption("--height <height>", "New height").action(async (projectPath, nodeId, options) => {
|
|
@@ -28332,7 +29338,7 @@ function makeResourceCommand() {
|
|
|
28332
29338
|
|
|
28333
29339
|
// dist/commands/hcl.js
|
|
28334
29340
|
init_dist();
|
|
28335
|
-
var
|
|
29341
|
+
var import_node_path4 = __toESM(require("node:path"), 1);
|
|
28336
29342
|
function makeHclCommand() {
|
|
28337
29343
|
const cmd = new Command("hcl").description("HCL generation and inspection");
|
|
28338
29344
|
cmd.command("generate [path]").description("Generate Terraform HCL from the diagram and write to terraform/").option("--dry-run", "Print files to stdout instead of writing to disk").option("--file <filename>", "With --dry-run: show only a specific file (e.g. main.tf)").option("--no-validate", "Skip diagram and network topology validation").action(async (projectPath, options) => {
|
|
@@ -28358,20 +29364,20 @@ Diagram validation failed (${validation.errors.length} resource(s) with errors).
|
|
|
28358
29364
|
}
|
|
28359
29365
|
const topologyNodes = project.nodes.filter((n) => n.type !== void 0);
|
|
28360
29366
|
const topologyErrors = validateNetworkTopology(topologyNodes);
|
|
28361
|
-
const hardErrors = topologyErrors.filter((
|
|
28362
|
-
const warnings = topologyErrors.filter((
|
|
28363
|
-
for (const
|
|
28364
|
-
const node = project.nodes.find((n) => n.id ===
|
|
28365
|
-
const label = node?.data?.label ??
|
|
28366
|
-
for (const e4 of
|
|
29367
|
+
const hardErrors = topologyErrors.filter((te2) => te2.errors.some((e4) => e4.severity === "error"));
|
|
29368
|
+
const warnings = topologyErrors.filter((te2) => te2.errors.some((e4) => e4.severity === "warning"));
|
|
29369
|
+
for (const te2 of warnings) {
|
|
29370
|
+
const node = project.nodes.find((n) => n.id === te2.instanceId);
|
|
29371
|
+
const label = node?.data?.label ?? te2.instanceId;
|
|
29372
|
+
for (const e4 of te2.errors.filter((x3) => x3.severity === "warning")) {
|
|
28367
29373
|
console.warn(` \u26A0 [${label}] ${e4.message}`);
|
|
28368
29374
|
}
|
|
28369
29375
|
}
|
|
28370
29376
|
if (hardErrors.length > 0) {
|
|
28371
|
-
for (const
|
|
28372
|
-
const node = project.nodes.find((n) => n.id ===
|
|
28373
|
-
const label = node?.data?.label ??
|
|
28374
|
-
for (const e4 of
|
|
29377
|
+
for (const te2 of hardErrors) {
|
|
29378
|
+
const node = project.nodes.find((n) => n.id === te2.instanceId);
|
|
29379
|
+
const label = node?.data?.label ?? te2.instanceId;
|
|
29380
|
+
for (const e4 of te2.errors.filter((x3) => x3.severity === "error")) {
|
|
28375
29381
|
console.error(` \u2717 [${label}] ${e4.message}`);
|
|
28376
29382
|
}
|
|
28377
29383
|
}
|
|
@@ -28421,7 +29427,7 @@ Diagram validation failed (${validation.errors.length} resource(s) with errors).
|
|
|
28421
29427
|
}
|
|
28422
29428
|
} else {
|
|
28423
29429
|
await storage.writeTerraformFiles(resolved, fileMap);
|
|
28424
|
-
const tfDir2 =
|
|
29430
|
+
const tfDir2 = import_node_path4.default.join(resolved, "terraform");
|
|
28425
29431
|
console.log(`Generated ${Object.keys(fileMap).length} file(s) to: ${tfDir2}`);
|
|
28426
29432
|
for (const filename of Object.keys(fileMap).sort()) {
|
|
28427
29433
|
console.log(` ${filename}`);
|
|
@@ -28696,9 +29702,9 @@ function makeModuleCommand() {
|
|
|
28696
29702
|
// dist/commands/terraform.js
|
|
28697
29703
|
var import_node_child_process = require("node:child_process");
|
|
28698
29704
|
var import_node_fs3 = require("node:fs");
|
|
28699
|
-
var
|
|
29705
|
+
var import_node_path5 = __toESM(require("node:path"), 1);
|
|
28700
29706
|
function tfDir(projectPath) {
|
|
28701
|
-
return
|
|
29707
|
+
return import_node_path5.default.join(projectPath, "terraform");
|
|
28702
29708
|
}
|
|
28703
29709
|
function runTerraform(cwd, args, allowedCodes = [0]) {
|
|
28704
29710
|
return new Promise((resolve2, reject) => {
|
|
@@ -28849,7 +29855,7 @@ function makeTerraformCommand() {
|
|
|
28849
29855
|
}
|
|
28850
29856
|
|
|
28851
29857
|
// dist/cli.js
|
|
28852
|
-
var version = true ? "0.
|
|
29858
|
+
var version = true ? "0.48.2" : "0.0.0-dev";
|
|
28853
29859
|
var program2 = new Command();
|
|
28854
29860
|
program2.name("tstudio").description("TerraStudio CLI \u2014 headless project manipulation and HCL generation").version(version);
|
|
28855
29861
|
program2.addCommand(makeProjectCommand());
|