@hot-updater/cli-tools 0.35.7 → 0.35.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +742 -37
- package/dist/index.mjs +1969 -1311
- package/package.json +7 -7
package/dist/index.mjs
CHANGED
|
@@ -9,13 +9,13 @@ import $r, { EventEmitter } from "events";
|
|
|
9
9
|
import Pi from "assert";
|
|
10
10
|
import crypto from "crypto";
|
|
11
11
|
import { Buffer as Buffer$1 } from "buffer";
|
|
12
|
+
import { aborted, callbackify, debuglog, inspect, promisify, stripVTControlCharacters, styleText } from "node:util";
|
|
12
13
|
import process$1, { execArgv, execPath, hrtime, platform, stdin, stdout } from "node:process";
|
|
13
|
-
import * as
|
|
14
|
-
import
|
|
14
|
+
import * as l from "node:readline";
|
|
15
|
+
import l__default from "node:readline";
|
|
15
16
|
import tty, { ReadStream } from "node:tty";
|
|
16
17
|
import fs$2, { appendFileSync, createReadStream, createWriteStream as createWriteStream$1, existsSync, lstatSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
17
18
|
import path$1, { basename, dirname as dirname$1, join, posix, win32 } from "node:path";
|
|
18
|
-
import { aborted, callbackify, debuglog, inspect, promisify, stripVTControlCharacters } from "node:util";
|
|
19
19
|
import os, { constants } from "node:os";
|
|
20
20
|
import { pipeline } from "stream/promises";
|
|
21
21
|
import * as Ms from "zlib";
|
|
@@ -409,7 +409,7 @@ var require_path = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
409
409
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
410
410
|
exports.convertPosixPathToPattern = exports.convertWindowsPathToPattern = exports.convertPathToPattern = exports.escapePosixPath = exports.escapeWindowsPath = exports.escape = exports.removeLeadingDotSegment = exports.makeAbsolute = exports.unixify = void 0;
|
|
411
411
|
const os$3 = __require("os");
|
|
412
|
-
const path$
|
|
412
|
+
const path$14 = __require("path");
|
|
413
413
|
const IS_WINDOWS_PLATFORM = os$3.platform() === "win32";
|
|
414
414
|
const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
|
|
415
415
|
/**
|
|
@@ -438,7 +438,7 @@ var require_path = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
438
438
|
}
|
|
439
439
|
exports.unixify = unixify;
|
|
440
440
|
function makeAbsolute(cwd, filepath) {
|
|
441
|
-
return path$
|
|
441
|
+
return path$14.resolve(cwd, filepath);
|
|
442
442
|
}
|
|
443
443
|
exports.makeAbsolute = makeAbsolute;
|
|
444
444
|
function removeLeadingDotSegment(entry) {
|
|
@@ -1690,7 +1690,7 @@ var require_braces = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1690
1690
|
//#endregion
|
|
1691
1691
|
//#region ../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/constants.js
|
|
1692
1692
|
var require_constants$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1693
|
-
const path$
|
|
1693
|
+
const path$13 = __require("path");
|
|
1694
1694
|
const WIN_SLASH = "\\\\/";
|
|
1695
1695
|
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
1696
1696
|
const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
|
|
@@ -1815,7 +1815,7 @@ var require_constants$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1815
1815
|
CHAR_UNDERSCORE: 95,
|
|
1816
1816
|
CHAR_VERTICAL_LINE: 124,
|
|
1817
1817
|
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
1818
|
-
SEP: path$
|
|
1818
|
+
SEP: path$13.sep,
|
|
1819
1819
|
extglobChars(chars) {
|
|
1820
1820
|
return {
|
|
1821
1821
|
"!": {
|
|
@@ -1853,7 +1853,7 @@ var require_constants$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1853
1853
|
//#endregion
|
|
1854
1854
|
//#region ../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/utils.js
|
|
1855
1855
|
var require_utils$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1856
|
-
const path$
|
|
1856
|
+
const path$12 = __require("path");
|
|
1857
1857
|
const win32 = process.platform === "win32";
|
|
1858
1858
|
const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants$3();
|
|
1859
1859
|
exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
@@ -1873,7 +1873,7 @@ var require_utils$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1873
1873
|
};
|
|
1874
1874
|
exports.isWindows = (options) => {
|
|
1875
1875
|
if (options && typeof options.windows === "boolean") return options.windows;
|
|
1876
|
-
return win32 === true || path$
|
|
1876
|
+
return win32 === true || path$12.sep === "\\";
|
|
1877
1877
|
};
|
|
1878
1878
|
exports.escapeLast = (input, char, lastIdx) => {
|
|
1879
1879
|
const idx = input.lastIndexOf(char, lastIdx);
|
|
@@ -3243,7 +3243,7 @@ var require_parse$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3243
3243
|
//#endregion
|
|
3244
3244
|
//#region ../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/picomatch.js
|
|
3245
3245
|
var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3246
|
-
const path$
|
|
3246
|
+
const path$11 = __require("path");
|
|
3247
3247
|
const scan = require_scan();
|
|
3248
3248
|
const parse = require_parse$2();
|
|
3249
3249
|
const utils = require_utils$4();
|
|
@@ -3382,7 +3382,7 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3382
3382
|
* @api public
|
|
3383
3383
|
*/
|
|
3384
3384
|
picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
|
|
3385
|
-
return (glob instanceof RegExp ? glob : picomatch.makeRe(glob, options)).test(path$
|
|
3385
|
+
return (glob instanceof RegExp ? glob : picomatch.makeRe(glob, options)).test(path$11.basename(input));
|
|
3386
3386
|
};
|
|
3387
3387
|
/**
|
|
3388
3388
|
* Returns true if **any** of the given glob `patterns` match the specified `string`.
|
|
@@ -3937,7 +3937,7 @@ var require_micromatch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3937
3937
|
var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3938
3938
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3939
3939
|
exports.isAbsolute = exports.partitionAbsoluteAndRelative = exports.removeDuplicateSlashes = exports.matchAny = exports.convertPatternsToRe = exports.makeRe = exports.getPatternParts = exports.expandBraceExpansion = exports.expandPatternsWithBraceExpansion = exports.isAffectDepthOfReadingPattern = exports.endsWithSlashGlobStar = exports.hasGlobStar = exports.getBaseDirectory = exports.isPatternRelatedToParentDirectory = exports.getPatternsOutsideCurrentDirectory = exports.getPatternsInsideCurrentDirectory = exports.getPositivePatterns = exports.getNegativePatterns = exports.isPositivePattern = exports.isNegativePattern = exports.convertToNegativePattern = exports.convertToPositivePattern = exports.isDynamicPattern = exports.isStaticPattern = void 0;
|
|
3940
|
-
const path$
|
|
3940
|
+
const path$10 = __require("path");
|
|
3941
3941
|
const globParent = require_glob_parent();
|
|
3942
3942
|
const micromatch = require_micromatch();
|
|
3943
3943
|
const GLOBSTAR = "**";
|
|
@@ -4045,7 +4045,7 @@ var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4045
4045
|
}
|
|
4046
4046
|
exports.endsWithSlashGlobStar = endsWithSlashGlobStar;
|
|
4047
4047
|
function isAffectDepthOfReadingPattern(pattern) {
|
|
4048
|
-
const basename = path$
|
|
4048
|
+
const basename = path$10.basename(pattern);
|
|
4049
4049
|
return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
|
|
4050
4050
|
}
|
|
4051
4051
|
exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
|
|
@@ -4119,7 +4119,7 @@ var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4119
4119
|
}
|
|
4120
4120
|
exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
|
|
4121
4121
|
function isAbsolute(pattern) {
|
|
4122
|
-
return path$
|
|
4122
|
+
return path$10.isAbsolute(pattern);
|
|
4123
4123
|
}
|
|
4124
4124
|
exports.isAbsolute = isAbsolute;
|
|
4125
4125
|
}));
|
|
@@ -4747,7 +4747,7 @@ var require_fs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4747
4747
|
//#region ../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/settings.js
|
|
4748
4748
|
var require_settings$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
4749
4749
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4750
|
-
const path$
|
|
4750
|
+
const path$9 = __require("path");
|
|
4751
4751
|
const fsStat = require_out$3();
|
|
4752
4752
|
const fs = require_fs();
|
|
4753
4753
|
var Settings = class {
|
|
@@ -4755,7 +4755,7 @@ var require_settings$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4755
4755
|
this._options = _options;
|
|
4756
4756
|
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
|
|
4757
4757
|
this.fs = fs.createFileSystemAdapter(this._options.fs);
|
|
4758
|
-
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$
|
|
4758
|
+
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$9.sep);
|
|
4759
4759
|
this.stats = this._getValue(this._options.stats, false);
|
|
4760
4760
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
|
4761
4761
|
this.fsStatSettings = new fsStat.Settings({
|
|
@@ -5349,7 +5349,7 @@ var require_sync$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5349
5349
|
//#region ../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/settings.js
|
|
5350
5350
|
var require_settings$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5351
5351
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5352
|
-
const path$
|
|
5352
|
+
const path$8 = __require("path");
|
|
5353
5353
|
const fsScandir = require_out$2();
|
|
5354
5354
|
var Settings = class {
|
|
5355
5355
|
constructor(_options = {}) {
|
|
@@ -5359,7 +5359,7 @@ var require_settings$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5359
5359
|
this.deepFilter = this._getValue(this._options.deepFilter, null);
|
|
5360
5360
|
this.entryFilter = this._getValue(this._options.entryFilter, null);
|
|
5361
5361
|
this.errorFilter = this._getValue(this._options.errorFilter, null);
|
|
5362
|
-
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$
|
|
5362
|
+
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$8.sep);
|
|
5363
5363
|
this.fsScandirSettings = new fsScandir.Settings({
|
|
5364
5364
|
followSymbolicLinks: this._options.followSymbolicLinks,
|
|
5365
5365
|
fs: this._options.fs,
|
|
@@ -5411,7 +5411,7 @@ var require_out$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5411
5411
|
//#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/readers/reader.js
|
|
5412
5412
|
var require_reader = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5413
5413
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5414
|
-
const path$
|
|
5414
|
+
const path$7 = __require("path");
|
|
5415
5415
|
const fsStat = require_out$3();
|
|
5416
5416
|
const utils = require_utils$3();
|
|
5417
5417
|
var Reader = class {
|
|
@@ -5424,7 +5424,7 @@ var require_reader = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5424
5424
|
});
|
|
5425
5425
|
}
|
|
5426
5426
|
_getFullEntryPath(filepath) {
|
|
5427
|
-
return path$
|
|
5427
|
+
return path$7.resolve(this._settings.cwd, filepath);
|
|
5428
5428
|
}
|
|
5429
5429
|
_makeEntry(stats, pattern) {
|
|
5430
5430
|
const entry = {
|
|
@@ -5759,7 +5759,7 @@ var require_entry = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5759
5759
|
//#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/provider.js
|
|
5760
5760
|
var require_provider = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5761
5761
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5762
|
-
const path$
|
|
5762
|
+
const path$6 = __require("path");
|
|
5763
5763
|
const deep_1 = require_deep();
|
|
5764
5764
|
const entry_1 = require_entry$1();
|
|
5765
5765
|
const error_1 = require_error();
|
|
@@ -5773,7 +5773,7 @@ var require_provider = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5773
5773
|
this.entryTransformer = new entry_2.default(this._settings);
|
|
5774
5774
|
}
|
|
5775
5775
|
_getRootDirectory(task) {
|
|
5776
|
-
return path$
|
|
5776
|
+
return path$6.resolve(this._settings.cwd, task.base);
|
|
5777
5777
|
}
|
|
5778
5778
|
_getReaderOptions(task) {
|
|
5779
5779
|
const basePath = task.base === "." ? "" : task.base;
|
|
@@ -19797,7 +19797,289 @@ var import_lib$1 = (/* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
19797
19797
|
})))();
|
|
19798
19798
|
const getCwd = () => (0, import_lib$1.findPackageRoot)(process.cwd()) ?? process.cwd();
|
|
19799
19799
|
//#endregion
|
|
19800
|
-
//#region ../../node_modules/.pnpm
|
|
19800
|
+
//#region ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
|
|
19801
|
+
const getCodePointsLength = (() => {
|
|
19802
|
+
const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
19803
|
+
return (input) => {
|
|
19804
|
+
let surrogatePairsNr = 0;
|
|
19805
|
+
SURROGATE_PAIR_RE.lastIndex = 0;
|
|
19806
|
+
while (SURROGATE_PAIR_RE.test(input)) surrogatePairsNr += 1;
|
|
19807
|
+
return input.length - surrogatePairsNr;
|
|
19808
|
+
};
|
|
19809
|
+
})();
|
|
19810
|
+
const isFullWidth$1 = (x) => {
|
|
19811
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
19812
|
+
};
|
|
19813
|
+
const isWideNotCJKTNotEmoji = (x) => {
|
|
19814
|
+
return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
19815
|
+
};
|
|
19816
|
+
//#endregion
|
|
19817
|
+
//#region ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
|
|
19818
|
+
const ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
|
|
19819
|
+
const CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
19820
|
+
const CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy;
|
|
19821
|
+
const TAB_RE = /\t{1,1000}/y;
|
|
19822
|
+
const EMOJI_RE = /[\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?))*/uy;
|
|
19823
|
+
const LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
19824
|
+
const MODIFIER_RE = /\p{M}+/gu;
|
|
19825
|
+
const NO_TRUNCATION$1 = {
|
|
19826
|
+
limit: Infinity,
|
|
19827
|
+
ellipsis: ""
|
|
19828
|
+
};
|
|
19829
|
+
const getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
|
|
19830
|
+
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
19831
|
+
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
19832
|
+
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION$1, widthOptions).width : 0);
|
|
19833
|
+
const ANSI_WIDTH = 0;
|
|
19834
|
+
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
19835
|
+
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
19836
|
+
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
19837
|
+
const FULL_WIDTH_WIDTH = 2;
|
|
19838
|
+
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
19839
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
|
|
19840
|
+
const PARSE_BLOCKS = [
|
|
19841
|
+
[LATIN_RE, REGULAR_WIDTH],
|
|
19842
|
+
[ANSI_RE, ANSI_WIDTH],
|
|
19843
|
+
[CONTROL_RE, CONTROL_WIDTH],
|
|
19844
|
+
[TAB_RE, TAB_WIDTH],
|
|
19845
|
+
[EMOJI_RE, EMOJI_WIDTH],
|
|
19846
|
+
[CJKT_WIDE_RE, WIDE_WIDTH]
|
|
19847
|
+
];
|
|
19848
|
+
let indexPrev = 0;
|
|
19849
|
+
let index = 0;
|
|
19850
|
+
let length = input.length;
|
|
19851
|
+
let lengthExtra = 0;
|
|
19852
|
+
let truncationEnabled = false;
|
|
19853
|
+
let truncationIndex = length;
|
|
19854
|
+
let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
|
|
19855
|
+
let unmatchedStart = 0;
|
|
19856
|
+
let unmatchedEnd = 0;
|
|
19857
|
+
let width = 0;
|
|
19858
|
+
let widthExtra = 0;
|
|
19859
|
+
outer: while (true) {
|
|
19860
|
+
if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
|
|
19861
|
+
const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
|
|
19862
|
+
lengthExtra = 0;
|
|
19863
|
+
for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
|
|
19864
|
+
const codePoint = char.codePointAt(0) || 0;
|
|
19865
|
+
if (isFullWidth$1(codePoint)) widthExtra = FULL_WIDTH_WIDTH;
|
|
19866
|
+
else if (isWideNotCJKTNotEmoji(codePoint)) widthExtra = WIDE_WIDTH;
|
|
19867
|
+
else widthExtra = REGULAR_WIDTH;
|
|
19868
|
+
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
|
|
19869
|
+
if (width + widthExtra > LIMIT) {
|
|
19870
|
+
truncationEnabled = true;
|
|
19871
|
+
break outer;
|
|
19872
|
+
}
|
|
19873
|
+
lengthExtra += char.length;
|
|
19874
|
+
width += widthExtra;
|
|
19875
|
+
}
|
|
19876
|
+
unmatchedStart = unmatchedEnd = 0;
|
|
19877
|
+
}
|
|
19878
|
+
if (index >= length) break outer;
|
|
19879
|
+
for (let i = 0, l = PARSE_BLOCKS.length; i < l; i++) {
|
|
19880
|
+
const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];
|
|
19881
|
+
BLOCK_RE.lastIndex = index;
|
|
19882
|
+
if (BLOCK_RE.test(input)) {
|
|
19883
|
+
lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
|
|
19884
|
+
widthExtra = lengthExtra * BLOCK_WIDTH;
|
|
19885
|
+
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
|
|
19886
|
+
if (width + widthExtra > LIMIT) {
|
|
19887
|
+
truncationEnabled = true;
|
|
19888
|
+
break outer;
|
|
19889
|
+
}
|
|
19890
|
+
width += widthExtra;
|
|
19891
|
+
unmatchedStart = indexPrev;
|
|
19892
|
+
unmatchedEnd = index;
|
|
19893
|
+
index = indexPrev = BLOCK_RE.lastIndex;
|
|
19894
|
+
continue outer;
|
|
19895
|
+
}
|
|
19896
|
+
}
|
|
19897
|
+
index += 1;
|
|
19898
|
+
}
|
|
19899
|
+
return {
|
|
19900
|
+
width: truncationEnabled ? truncationLimit : width,
|
|
19901
|
+
index: truncationEnabled ? truncationIndex : length,
|
|
19902
|
+
truncated: truncationEnabled,
|
|
19903
|
+
ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
|
|
19904
|
+
};
|
|
19905
|
+
};
|
|
19906
|
+
//#endregion
|
|
19907
|
+
//#region ../../node_modules/.pnpm/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
|
|
19908
|
+
const NO_TRUNCATION = {
|
|
19909
|
+
limit: Infinity,
|
|
19910
|
+
ellipsis: "",
|
|
19911
|
+
ellipsisWidth: 0
|
|
19912
|
+
};
|
|
19913
|
+
const fastStringWidth = (input, options = {}) => {
|
|
19914
|
+
return getStringTruncatedWidth(input, NO_TRUNCATION, options).width;
|
|
19915
|
+
};
|
|
19916
|
+
//#endregion
|
|
19917
|
+
//#region ../../node_modules/.pnpm/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js
|
|
19918
|
+
const ESC = "\x1B";
|
|
19919
|
+
const CSI = "";
|
|
19920
|
+
const END_CODE$1 = 39;
|
|
19921
|
+
const ANSI_ESCAPE_BELL$1 = "\x07";
|
|
19922
|
+
const ANSI_CSI$1 = "[";
|
|
19923
|
+
const ANSI_OSC$1 = "]";
|
|
19924
|
+
const ANSI_SGR_TERMINATOR$1 = "m";
|
|
19925
|
+
const ANSI_ESCAPE_LINK$1 = `${ANSI_OSC$1}8;;`;
|
|
19926
|
+
const GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI$1}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK$1}(?<uri>.*)${ANSI_ESCAPE_BELL$1})`, "y");
|
|
19927
|
+
const getClosingCode = (openingCode) => {
|
|
19928
|
+
if (openingCode >= 30 && openingCode <= 37) return 39;
|
|
19929
|
+
if (openingCode >= 90 && openingCode <= 97) return 39;
|
|
19930
|
+
if (openingCode >= 40 && openingCode <= 47) return 49;
|
|
19931
|
+
if (openingCode >= 100 && openingCode <= 107) return 49;
|
|
19932
|
+
if (openingCode === 1 || openingCode === 2) return 22;
|
|
19933
|
+
if (openingCode === 3) return 23;
|
|
19934
|
+
if (openingCode === 4) return 24;
|
|
19935
|
+
if (openingCode === 7) return 27;
|
|
19936
|
+
if (openingCode === 8) return 28;
|
|
19937
|
+
if (openingCode === 9) return 29;
|
|
19938
|
+
if (openingCode === 0) return 0;
|
|
19939
|
+
};
|
|
19940
|
+
const wrapAnsiCode$1 = (code) => `${ESC}${ANSI_CSI$1}${code}${ANSI_SGR_TERMINATOR$1}`;
|
|
19941
|
+
const wrapAnsiHyperlink$1 = (url) => `${ESC}${ANSI_ESCAPE_LINK$1}${url}${ANSI_ESCAPE_BELL$1}`;
|
|
19942
|
+
const wrapWord$1 = (rows, word, columns) => {
|
|
19943
|
+
const characters = word[Symbol.iterator]();
|
|
19944
|
+
let isInsideEscape = false;
|
|
19945
|
+
let isInsideLinkEscape = false;
|
|
19946
|
+
let lastRow = rows.at(-1);
|
|
19947
|
+
let visible = lastRow === void 0 ? 0 : fastStringWidth(lastRow);
|
|
19948
|
+
let currentCharacter = characters.next();
|
|
19949
|
+
let nextCharacter = characters.next();
|
|
19950
|
+
let rawCharacterIndex = 0;
|
|
19951
|
+
while (!currentCharacter.done) {
|
|
19952
|
+
const character = currentCharacter.value;
|
|
19953
|
+
const characterLength = fastStringWidth(character);
|
|
19954
|
+
if (visible + characterLength <= columns) rows[rows.length - 1] += character;
|
|
19955
|
+
else {
|
|
19956
|
+
rows.push(character);
|
|
19957
|
+
visible = 0;
|
|
19958
|
+
}
|
|
19959
|
+
if (character === ESC || character === CSI) {
|
|
19960
|
+
isInsideEscape = true;
|
|
19961
|
+
isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK$1, rawCharacterIndex + 1);
|
|
19962
|
+
}
|
|
19963
|
+
if (isInsideEscape) {
|
|
19964
|
+
if (isInsideLinkEscape) {
|
|
19965
|
+
if (character === ANSI_ESCAPE_BELL$1) {
|
|
19966
|
+
isInsideEscape = false;
|
|
19967
|
+
isInsideLinkEscape = false;
|
|
19968
|
+
}
|
|
19969
|
+
} else if (character === ANSI_SGR_TERMINATOR$1) isInsideEscape = false;
|
|
19970
|
+
} else {
|
|
19971
|
+
visible += characterLength;
|
|
19972
|
+
if (visible === columns && !nextCharacter.done) {
|
|
19973
|
+
rows.push("");
|
|
19974
|
+
visible = 0;
|
|
19975
|
+
}
|
|
19976
|
+
}
|
|
19977
|
+
currentCharacter = nextCharacter;
|
|
19978
|
+
nextCharacter = characters.next();
|
|
19979
|
+
rawCharacterIndex += character.length;
|
|
19980
|
+
}
|
|
19981
|
+
lastRow = rows.at(-1);
|
|
19982
|
+
if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) rows[rows.length - 2] += rows.pop();
|
|
19983
|
+
};
|
|
19984
|
+
const stringVisibleTrimSpacesRight$1 = (string) => {
|
|
19985
|
+
const words = string.split(" ");
|
|
19986
|
+
let last = words.length;
|
|
19987
|
+
while (last) {
|
|
19988
|
+
if (fastStringWidth(words[last - 1])) break;
|
|
19989
|
+
last--;
|
|
19990
|
+
}
|
|
19991
|
+
if (last === words.length) return string;
|
|
19992
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
19993
|
+
};
|
|
19994
|
+
const exec$1 = (string, columns, options = {}) => {
|
|
19995
|
+
if (options.trim !== false && string.trim() === "") return "";
|
|
19996
|
+
let returnValue = "";
|
|
19997
|
+
let escapeCode;
|
|
19998
|
+
let escapeUrl;
|
|
19999
|
+
const words = string.split(" ");
|
|
20000
|
+
let rows = [""];
|
|
20001
|
+
let rowLength = 0;
|
|
20002
|
+
for (let index = 0; index < words.length; index++) {
|
|
20003
|
+
const word = words[index];
|
|
20004
|
+
if (options.trim !== false) {
|
|
20005
|
+
const row = rows.at(-1) ?? "";
|
|
20006
|
+
const trimmed = row.trimStart();
|
|
20007
|
+
if (row.length !== trimmed.length) {
|
|
20008
|
+
rows[rows.length - 1] = trimmed;
|
|
20009
|
+
rowLength = fastStringWidth(trimmed);
|
|
20010
|
+
}
|
|
20011
|
+
}
|
|
20012
|
+
if (index !== 0) {
|
|
20013
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
20014
|
+
rows.push("");
|
|
20015
|
+
rowLength = 0;
|
|
20016
|
+
}
|
|
20017
|
+
if (rowLength || options.trim === false) {
|
|
20018
|
+
rows[rows.length - 1] += " ";
|
|
20019
|
+
rowLength++;
|
|
20020
|
+
}
|
|
20021
|
+
}
|
|
20022
|
+
const wordLength = fastStringWidth(word);
|
|
20023
|
+
if (options.hard && wordLength > columns) {
|
|
20024
|
+
const remainingColumns = columns - rowLength;
|
|
20025
|
+
const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
|
|
20026
|
+
if (Math.floor((wordLength - 1) / columns) < breaksStartingThisLine) rows.push("");
|
|
20027
|
+
wrapWord$1(rows, word, columns);
|
|
20028
|
+
rowLength = fastStringWidth(rows.at(-1) ?? "");
|
|
20029
|
+
continue;
|
|
20030
|
+
}
|
|
20031
|
+
if (rowLength + wordLength > columns && rowLength && wordLength) {
|
|
20032
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
20033
|
+
wrapWord$1(rows, word, columns);
|
|
20034
|
+
rowLength = fastStringWidth(rows.at(-1) ?? "");
|
|
20035
|
+
continue;
|
|
20036
|
+
}
|
|
20037
|
+
rows.push("");
|
|
20038
|
+
rowLength = 0;
|
|
20039
|
+
}
|
|
20040
|
+
if (rowLength + wordLength > columns && options.wordWrap === false) {
|
|
20041
|
+
wrapWord$1(rows, word, columns);
|
|
20042
|
+
rowLength = fastStringWidth(rows.at(-1) ?? "");
|
|
20043
|
+
continue;
|
|
20044
|
+
}
|
|
20045
|
+
rows[rows.length - 1] += word;
|
|
20046
|
+
rowLength += wordLength;
|
|
20047
|
+
}
|
|
20048
|
+
if (options.trim !== false) rows = rows.map((row) => stringVisibleTrimSpacesRight$1(row));
|
|
20049
|
+
const preString = rows.join("\n");
|
|
20050
|
+
let inSurrogate = false;
|
|
20051
|
+
for (let i = 0; i < preString.length; i++) {
|
|
20052
|
+
const character = preString[i];
|
|
20053
|
+
returnValue += character;
|
|
20054
|
+
if (!inSurrogate) {
|
|
20055
|
+
inSurrogate = character >= "\ud800" && character <= "\udbff";
|
|
20056
|
+
if (inSurrogate) continue;
|
|
20057
|
+
} else inSurrogate = false;
|
|
20058
|
+
if (character === ESC || character === CSI) {
|
|
20059
|
+
GROUP_REGEX.lastIndex = i + 1;
|
|
20060
|
+
const groups = GROUP_REGEX.exec(preString)?.groups;
|
|
20061
|
+
if (groups?.code !== void 0) {
|
|
20062
|
+
const code = Number.parseFloat(groups.code);
|
|
20063
|
+
escapeCode = code === END_CODE$1 ? void 0 : code;
|
|
20064
|
+
} else if (groups?.uri !== void 0) escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
20065
|
+
}
|
|
20066
|
+
if (preString[i + 1] === "\n") {
|
|
20067
|
+
if (escapeUrl) returnValue += wrapAnsiHyperlink$1("");
|
|
20068
|
+
const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
|
|
20069
|
+
if (escapeCode && closingCode) returnValue += wrapAnsiCode$1(closingCode);
|
|
20070
|
+
} else if (character === "\n") {
|
|
20071
|
+
if (escapeCode && getClosingCode(escapeCode)) returnValue += wrapAnsiCode$1(escapeCode);
|
|
20072
|
+
if (escapeUrl) returnValue += wrapAnsiHyperlink$1(escapeUrl);
|
|
20073
|
+
}
|
|
20074
|
+
}
|
|
20075
|
+
return returnValue;
|
|
20076
|
+
};
|
|
20077
|
+
const CRLF_OR_LF = /\r?\n/;
|
|
20078
|
+
function wrapAnsi$1(string, columns, options) {
|
|
20079
|
+
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec$1(line, columns, options)).join("\n");
|
|
20080
|
+
}
|
|
20081
|
+
//#endregion
|
|
20082
|
+
//#region ../../node_modules/.pnpm/@clack+core@1.4.3/node_modules/@clack/core/dist/index.mjs
|
|
19801
20083
|
var import_src = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
19802
20084
|
const ESC = "\x1B";
|
|
19803
20085
|
const CSI = `${ESC}[`;
|
|
@@ -19850,162 +20132,27 @@ var import_src = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
19850
20132
|
beep
|
|
19851
20133
|
};
|
|
19852
20134
|
})))();
|
|
19853
|
-
function
|
|
19854
|
-
if (!
|
|
19855
|
-
const
|
|
19856
|
-
return
|
|
20135
|
+
function findCursor(s, o, l) {
|
|
20136
|
+
if (!l.some((r) => !r.disabled)) return s;
|
|
20137
|
+
const t = s + o, n = Math.max(l.length - 1, 0), e = t < 0 ? n : t > n ? 0 : t;
|
|
20138
|
+
return l[e]?.disabled ? findCursor(e, o < 0 ? -1 : 1, l) : e;
|
|
19857
20139
|
}
|
|
19858
|
-
|
|
19859
|
-
|
|
19860
|
-
ellipsis: ""
|
|
19861
|
-
}, X$2 = (t, e = {}, s = {}) => {
|
|
19862
|
-
const i = e.limit ?? Infinity, r = e.ellipsis ?? "", n = e?.ellipsisWidth ?? (r ? X$2(r, ft$2, 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, V = s.wideWidth ?? 2;
|
|
19863
|
-
let h = 0, o = 0, p = t.length, v = 0, F = !1, d = p, b = Math.max(0, i - n), C = 0, w = 0, c = 0, f = 0;
|
|
19864
|
-
t: for (;;) {
|
|
19865
|
-
if (w > C || o >= p && o > h) {
|
|
19866
|
-
const ut = t.slice(C, w) || t.slice(h, o);
|
|
19867
|
-
v = 0;
|
|
19868
|
-
for (const Y of ut.replaceAll(ct$2, "")) {
|
|
19869
|
-
const $ = Y.codePointAt(0) || 0;
|
|
19870
|
-
if (lt$2($) ? f = m : ht$2($) ? f = V : E !== A && at$2($) ? f = E : f = A, c + f > b && (d = Math.min(d, Math.max(C, h) + v)), c + f > i) {
|
|
19871
|
-
F = !0;
|
|
19872
|
-
break t;
|
|
19873
|
-
}
|
|
19874
|
-
v += Y.length, c += f;
|
|
19875
|
-
}
|
|
19876
|
-
C = w = 0;
|
|
19877
|
-
}
|
|
19878
|
-
if (o >= p) break;
|
|
19879
|
-
if (M$2.lastIndex = o, M$2.test(t)) {
|
|
19880
|
-
if (v = M$2.lastIndex - o, f = v * A, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / A))), c + f > i) {
|
|
19881
|
-
F = !0;
|
|
19882
|
-
break;
|
|
19883
|
-
}
|
|
19884
|
-
c += f, C = h, w = o, o = h = M$2.lastIndex;
|
|
19885
|
-
continue;
|
|
19886
|
-
}
|
|
19887
|
-
if (O$1.lastIndex = o, O$1.test(t)) {
|
|
19888
|
-
if (c + u > b && (d = Math.min(d, o)), c + u > i) {
|
|
19889
|
-
F = !0;
|
|
19890
|
-
break;
|
|
19891
|
-
}
|
|
19892
|
-
c += u, C = h, w = o, o = h = O$1.lastIndex;
|
|
19893
|
-
continue;
|
|
19894
|
-
}
|
|
19895
|
-
if (y$1.lastIndex = o, y$1.test(t)) {
|
|
19896
|
-
if (v = y$1.lastIndex - o, f = v * a, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / a))), c + f > i) {
|
|
19897
|
-
F = !0;
|
|
19898
|
-
break;
|
|
19899
|
-
}
|
|
19900
|
-
c += f, C = h, w = o, o = h = y$1.lastIndex;
|
|
19901
|
-
continue;
|
|
19902
|
-
}
|
|
19903
|
-
if (L$1.lastIndex = o, L$1.test(t)) {
|
|
19904
|
-
if (v = L$1.lastIndex - o, f = v * l, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / l))), c + f > i) {
|
|
19905
|
-
F = !0;
|
|
19906
|
-
break;
|
|
19907
|
-
}
|
|
19908
|
-
c += f, C = h, w = o, o = h = L$1.lastIndex;
|
|
19909
|
-
continue;
|
|
19910
|
-
}
|
|
19911
|
-
if (P$1.lastIndex = o, P$1.test(t)) {
|
|
19912
|
-
if (c + g > b && (d = Math.min(d, o)), c + g > i) {
|
|
19913
|
-
F = !0;
|
|
19914
|
-
break;
|
|
19915
|
-
}
|
|
19916
|
-
c += g, C = h, w = o, o = h = P$1.lastIndex;
|
|
19917
|
-
continue;
|
|
19918
|
-
}
|
|
19919
|
-
o += 1;
|
|
19920
|
-
}
|
|
19921
|
-
return {
|
|
19922
|
-
width: F ? b : c,
|
|
19923
|
-
index: F ? d : p,
|
|
19924
|
-
truncated: F,
|
|
19925
|
-
ellipsed: F && i >= n
|
|
19926
|
-
};
|
|
19927
|
-
}, pt$2 = {
|
|
19928
|
-
limit: Infinity,
|
|
19929
|
-
ellipsis: "",
|
|
19930
|
-
ellipsisWidth: 0
|
|
19931
|
-
}, S = (t, e = {}) => X$2(t, pt$2, e).width, W$2 = "\x1B", Z$2 = "", Ft$2 = 39, j$1 = "\x07", Q$2 = "[", dt$2 = "]", tt$1 = "m", U$2 = `${dt$2}8;;`, et$2 = new RegExp(`(?:\\${Q$2}(?<code>\\d+)m|\\${U$2}(?<uri>.*)${j$1})`, "y"), mt$2 = (t) => {
|
|
19932
|
-
if (t >= 30 && t <= 37 || t >= 90 && t <= 97) return 39;
|
|
19933
|
-
if (t >= 40 && t <= 47 || t >= 100 && t <= 107) return 49;
|
|
19934
|
-
if (t === 1 || t === 2) return 22;
|
|
19935
|
-
if (t === 3) return 23;
|
|
19936
|
-
if (t === 4) return 24;
|
|
19937
|
-
if (t === 7) return 27;
|
|
19938
|
-
if (t === 8) return 28;
|
|
19939
|
-
if (t === 9) return 29;
|
|
19940
|
-
if (t === 0) return 0;
|
|
19941
|
-
}, st$2 = (t) => `${W$2}${Q$2}${t}${tt$1}`, it$2 = (t) => `${W$2}${U$2}${t}${j$1}`, gt$2 = (t) => t.map((e) => S(e)), G$1 = (t, e, s) => {
|
|
19942
|
-
const i = e[Symbol.iterator]();
|
|
19943
|
-
let r = !1, n = !1, u = t.at(-1), a = u === void 0 ? 0 : S(u), l = i.next(), E = i.next(), g = 0;
|
|
19944
|
-
for (; !l.done;) {
|
|
19945
|
-
const m = l.value, A = S(m);
|
|
19946
|
-
a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m === W$2 || m === Z$2) && (r = !0, n = e.startsWith(U$2, g + 1)), r ? n ? m === j$1 && (r = !1, n = !1) : m === tt$1 && (r = !1) : (a += A, a === s && !E.done && (t.push(""), a = 0)), l = E, E = i.next(), g += m.length;
|
|
19947
|
-
}
|
|
19948
|
-
u = t.at(-1), !a && u !== void 0 && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
|
|
19949
|
-
}, vt$2 = (t) => {
|
|
19950
|
-
const e = t.split(" ");
|
|
19951
|
-
let s = e.length;
|
|
19952
|
-
for (; s > 0 && !(S(e[s - 1]) > 0);) s--;
|
|
19953
|
-
return s === e.length ? t : e.slice(0, s).join(" ") + e.slice(s).join("");
|
|
19954
|
-
}, Et$2 = (t, e, s = {}) => {
|
|
19955
|
-
if (s.trim !== !1 && t.trim() === "") return "";
|
|
19956
|
-
let i = "", r, n;
|
|
19957
|
-
const u = t.split(" "), a = gt$2(u);
|
|
19958
|
-
let l = [""];
|
|
19959
|
-
for (const [h, o] of u.entries()) {
|
|
19960
|
-
s.trim !== !1 && (l[l.length - 1] = (l.at(-1) ?? "").trimStart());
|
|
19961
|
-
let p = S(l.at(-1) ?? "");
|
|
19962
|
-
if (h !== 0 && (p >= e && (s.wordWrap === !1 || s.trim === !1) && (l.push(""), p = 0), (p > 0 || s.trim === !1) && (l[l.length - 1] += " ", p++)), s.hard && a[h] > e) {
|
|
19963
|
-
const v = e - p, F = 1 + Math.floor((a[h] - v - 1) / e);
|
|
19964
|
-
Math.floor((a[h] - 1) / e) < F && l.push(""), G$1(l, o, e);
|
|
19965
|
-
continue;
|
|
19966
|
-
}
|
|
19967
|
-
if (p + a[h] > e && p > 0 && a[h] > 0) {
|
|
19968
|
-
if (s.wordWrap === !1 && p < e) {
|
|
19969
|
-
G$1(l, o, e);
|
|
19970
|
-
continue;
|
|
19971
|
-
}
|
|
19972
|
-
l.push("");
|
|
19973
|
-
}
|
|
19974
|
-
if (p + a[h] > e && s.wordWrap === !1) {
|
|
19975
|
-
G$1(l, o, e);
|
|
19976
|
-
continue;
|
|
19977
|
-
}
|
|
19978
|
-
l[l.length - 1] += o;
|
|
19979
|
-
}
|
|
19980
|
-
s.trim !== !1 && (l = l.map((h) => vt$2(h)));
|
|
19981
|
-
const E = l.join(`
|
|
19982
|
-
`), g = E[Symbol.iterator]();
|
|
19983
|
-
let m = g.next(), A = g.next(), V = 0;
|
|
19984
|
-
for (; !m.done;) {
|
|
19985
|
-
const h = m.value, o = A.value;
|
|
19986
|
-
if (i += h, h === W$2 || h === Z$2) {
|
|
19987
|
-
et$2.lastIndex = V + 1;
|
|
19988
|
-
const F = et$2.exec(E)?.groups;
|
|
19989
|
-
if (F?.code !== void 0) {
|
|
19990
|
-
const d = Number.parseFloat(F.code);
|
|
19991
|
-
r = d === Ft$2 ? void 0 : d;
|
|
19992
|
-
} else F?.uri !== void 0 && (n = F.uri.length === 0 ? void 0 : F.uri);
|
|
19993
|
-
}
|
|
19994
|
-
const p = r ? mt$2(r) : void 0;
|
|
19995
|
-
o === `
|
|
19996
|
-
` ? (n && (i += it$2("")), r && p && (i += st$2(p))) : h === `
|
|
19997
|
-
` && (r && p && (i += st$2(r)), n && (i += it$2(n))), V += h.length, m = A, A = g.next();
|
|
19998
|
-
}
|
|
19999
|
-
return i;
|
|
20000
|
-
};
|
|
20001
|
-
function K$2(t, e, s) {
|
|
20002
|
-
return String(t).normalize().replaceAll(`\r
|
|
20003
|
-
`, `
|
|
20004
|
-
`).split(`
|
|
20005
|
-
`).map((i) => Et$2(i, e, s)).join(`
|
|
20140
|
+
function findTextCursor(s, o, l, i) {
|
|
20141
|
+
const t = i.split(`
|
|
20006
20142
|
`);
|
|
20143
|
+
let n = 0, e = s;
|
|
20144
|
+
for (const r of t) {
|
|
20145
|
+
if (e <= r.length) break;
|
|
20146
|
+
e -= r.length + 1, n++;
|
|
20147
|
+
}
|
|
20148
|
+
for (n = Math.max(0, Math.min(t.length - 1, n + l)), e = Math.min(e, t[n].length) + o; e < 0 && n > 0;) n--, e += t[n].length + 1;
|
|
20149
|
+
for (; e > t[n].length && n < t.length - 1;) e -= t[n].length + 1, n++;
|
|
20150
|
+
e = Math.max(0, Math.min(t[n].length, e));
|
|
20151
|
+
let h = 0;
|
|
20152
|
+
for (let r = 0; r < n; r++) h += t[r].length + 1;
|
|
20153
|
+
return h + e;
|
|
20007
20154
|
}
|
|
20008
|
-
const
|
|
20155
|
+
const settings = {
|
|
20009
20156
|
actions: new Set([
|
|
20010
20157
|
"up",
|
|
20011
20158
|
"down",
|
|
@@ -20015,7 +20162,7 @@ const _$1 = {
|
|
|
20015
20162
|
"enter",
|
|
20016
20163
|
"cancel"
|
|
20017
20164
|
]),
|
|
20018
|
-
aliases: new Map([
|
|
20165
|
+
aliases: /* @__PURE__ */ new Map([
|
|
20019
20166
|
["k", "up"],
|
|
20020
20167
|
["j", "down"],
|
|
20021
20168
|
["h", "left"],
|
|
@@ -20027,95 +20174,133 @@ const _$1 = {
|
|
|
20027
20174
|
cancel: "Canceled",
|
|
20028
20175
|
error: "Something went wrong"
|
|
20029
20176
|
},
|
|
20030
|
-
withGuide:
|
|
20031
|
-
|
|
20032
|
-
|
|
20033
|
-
|
|
20034
|
-
|
|
20177
|
+
withGuide: true,
|
|
20178
|
+
date: {
|
|
20179
|
+
monthNames: [...[
|
|
20180
|
+
"January",
|
|
20181
|
+
"February",
|
|
20182
|
+
"March",
|
|
20183
|
+
"April",
|
|
20184
|
+
"May",
|
|
20185
|
+
"June",
|
|
20186
|
+
"July",
|
|
20187
|
+
"August",
|
|
20188
|
+
"September",
|
|
20189
|
+
"October",
|
|
20190
|
+
"November",
|
|
20191
|
+
"December"
|
|
20192
|
+
]],
|
|
20193
|
+
messages: {
|
|
20194
|
+
required: "Please enter a valid date",
|
|
20195
|
+
invalidMonth: "There are only 12 months in a year",
|
|
20196
|
+
invalidDay: (n, e) => `There are only ${n} days in ${e}`,
|
|
20197
|
+
afterMin: (n) => `Date must be on or after ${n.toISOString().slice(0, 10)}`,
|
|
20198
|
+
beforeMax: (n) => `Date must be on or before ${n.toISOString().slice(0, 10)}`
|
|
20199
|
+
}
|
|
20200
|
+
}
|
|
20201
|
+
};
|
|
20202
|
+
function updateSettings(n) {
|
|
20203
|
+
if (n.aliases !== void 0) {
|
|
20204
|
+
const e = n.aliases;
|
|
20035
20205
|
for (const s in e) {
|
|
20036
20206
|
if (!Object.hasOwn(e, s)) continue;
|
|
20037
20207
|
const i = e[s];
|
|
20038
|
-
|
|
20208
|
+
i === void 0 || !settings.actions.has(i) || settings.aliases.has(s) || settings.aliases.set(s, i);
|
|
20039
20209
|
}
|
|
20040
20210
|
}
|
|
20041
|
-
if (
|
|
20042
|
-
const e =
|
|
20043
|
-
e.cancel !== void 0 && (
|
|
20211
|
+
if (n.messages !== void 0) {
|
|
20212
|
+
const e = n.messages;
|
|
20213
|
+
e.cancel !== void 0 && (settings.messages.cancel = e.cancel), e.error !== void 0 && (settings.messages.error = e.error);
|
|
20214
|
+
}
|
|
20215
|
+
if (n.withGuide !== void 0 && (settings.withGuide = n.withGuide !== false), n.date !== void 0) {
|
|
20216
|
+
const e = n.date;
|
|
20217
|
+
e.monthNames !== void 0 && (settings.date.monthNames = [...e.monthNames]), e.messages !== void 0 && (e.messages.required !== void 0 && (settings.date.messages.required = e.messages.required), e.messages.invalidMonth !== void 0 && (settings.date.messages.invalidMonth = e.messages.invalidMonth), e.messages.invalidDay !== void 0 && (settings.date.messages.invalidDay = e.messages.invalidDay), e.messages.afterMin !== void 0 && (settings.date.messages.afterMin = e.messages.afterMin), e.messages.beforeMax !== void 0 && (settings.date.messages.beforeMax = e.messages.beforeMax));
|
|
20044
20218
|
}
|
|
20045
|
-
t.withGuide !== void 0 && (_$1.withGuide = t.withGuide !== !1);
|
|
20046
20219
|
}
|
|
20047
|
-
function
|
|
20048
|
-
if (typeof
|
|
20049
|
-
for (const s of
|
|
20050
|
-
return
|
|
20220
|
+
function isActionKey(n, e) {
|
|
20221
|
+
if (typeof n == "string") return settings.aliases.get(n) === e;
|
|
20222
|
+
for (const s of n) if (s !== void 0 && isActionKey(s, e)) return true;
|
|
20223
|
+
return false;
|
|
20051
20224
|
}
|
|
20052
|
-
function
|
|
20053
|
-
if (
|
|
20054
|
-
const
|
|
20055
|
-
`),
|
|
20056
|
-
`), r = Math.max(
|
|
20057
|
-
for (let
|
|
20225
|
+
function diffLines(i, s) {
|
|
20226
|
+
if (i === s) return;
|
|
20227
|
+
const e = i.split(`
|
|
20228
|
+
`), t = s.split(`
|
|
20229
|
+
`), r = Math.max(e.length, t.length), f = [];
|
|
20230
|
+
for (let n = 0; n < r; n++) e[n] !== t[n] && f.push(n);
|
|
20058
20231
|
return {
|
|
20059
|
-
lines:
|
|
20060
|
-
numLinesBefore:
|
|
20061
|
-
numLinesAfter:
|
|
20232
|
+
lines: f,
|
|
20233
|
+
numLinesBefore: e.length,
|
|
20234
|
+
numLinesAfter: t.length,
|
|
20062
20235
|
numLines: r
|
|
20063
20236
|
};
|
|
20064
20237
|
}
|
|
20065
|
-
const
|
|
20066
|
-
|
|
20067
|
-
|
|
20238
|
+
const R = globalThis.process.platform.startsWith("win");
|
|
20239
|
+
const CANCEL_SYMBOL = Symbol("clack:cancel");
|
|
20240
|
+
function isCancel(e) {
|
|
20241
|
+
return e === CANCEL_SYMBOL;
|
|
20068
20242
|
}
|
|
20069
|
-
function
|
|
20070
|
-
const
|
|
20071
|
-
|
|
20243
|
+
function setRawMode(e, r) {
|
|
20244
|
+
const o = e;
|
|
20245
|
+
o.isTTY && o.setRawMode(r);
|
|
20072
20246
|
}
|
|
20073
|
-
function
|
|
20074
|
-
const
|
|
20075
|
-
input:
|
|
20076
|
-
output:
|
|
20247
|
+
function block({ input: e = stdin, output: r = stdout, overwrite: o = true, hideCursor: t = true } = {}) {
|
|
20248
|
+
const s = l.createInterface({
|
|
20249
|
+
input: e,
|
|
20250
|
+
output: r,
|
|
20077
20251
|
prompt: "",
|
|
20078
20252
|
tabSize: 1
|
|
20079
20253
|
});
|
|
20080
|
-
|
|
20081
|
-
const n = (
|
|
20082
|
-
if (
|
|
20083
|
-
String(
|
|
20254
|
+
l.emitKeypressEvents(e, s), e instanceof ReadStream && e.isTTY && e.setRawMode(true);
|
|
20255
|
+
const n = (f, { name: a, sequence: p }) => {
|
|
20256
|
+
if (isActionKey([
|
|
20257
|
+
String(f),
|
|
20084
20258
|
a,
|
|
20085
|
-
|
|
20259
|
+
p
|
|
20086
20260
|
], "cancel")) {
|
|
20087
|
-
|
|
20261
|
+
t && r.write(import_src.cursor.show), process.exit(0);
|
|
20088
20262
|
return;
|
|
20089
20263
|
}
|
|
20090
|
-
if (!
|
|
20091
|
-
const
|
|
20092
|
-
|
|
20093
|
-
|
|
20094
|
-
|
|
20264
|
+
if (!o) return;
|
|
20265
|
+
const i = a === "return" ? 0 : -1, m = a === "return" ? -1 : 0;
|
|
20266
|
+
l.moveCursor(r, i, m, () => {
|
|
20267
|
+
l.clearLine(r, 1, () => {
|
|
20268
|
+
e.once("keypress", n);
|
|
20095
20269
|
});
|
|
20096
20270
|
});
|
|
20097
20271
|
};
|
|
20098
|
-
return
|
|
20099
|
-
|
|
20272
|
+
return t && r.write(import_src.cursor.hide), e.once("keypress", n), () => {
|
|
20273
|
+
e.off("keypress", n), t && r.write(import_src.cursor.show), e instanceof ReadStream && e.isTTY && !R && e.setRawMode(false), s.terminal = false, s.close();
|
|
20100
20274
|
};
|
|
20101
20275
|
}
|
|
20102
|
-
const
|
|
20103
|
-
function
|
|
20104
|
-
return
|
|
20105
|
-
hard:
|
|
20106
|
-
trim:
|
|
20276
|
+
const getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80, getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
|
|
20277
|
+
function wrapTextWithPrefix(e, r, o, t = o, s = o, n) {
|
|
20278
|
+
return wrapAnsi$1(r, getColumns(e ?? stdout) - o.length, {
|
|
20279
|
+
hard: true,
|
|
20280
|
+
trim: false
|
|
20107
20281
|
}).split(`
|
|
20108
|
-
`).map((
|
|
20282
|
+
`).map((c, i, m) => {
|
|
20283
|
+
const d = n ? n(c, i) : c;
|
|
20284
|
+
return i === 0 ? `${t}${d}` : i === m.length - 1 ? `${s}${d}` : `${o}${d}`;
|
|
20285
|
+
}).join(`
|
|
20109
20286
|
`);
|
|
20110
20287
|
}
|
|
20111
|
-
|
|
20288
|
+
function runValidation(e, n) {
|
|
20289
|
+
if ("~standard" in e) {
|
|
20290
|
+
const a = e["~standard"].validate(n);
|
|
20291
|
+
if (a instanceof Promise) throw new TypeError("Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic.");
|
|
20292
|
+
return a.issues?.at(0)?.message;
|
|
20293
|
+
}
|
|
20294
|
+
return e(n);
|
|
20295
|
+
}
|
|
20296
|
+
var V$1 = class {
|
|
20112
20297
|
input;
|
|
20113
20298
|
output;
|
|
20114
20299
|
_abortSignal;
|
|
20115
20300
|
rl;
|
|
20116
20301
|
opts;
|
|
20117
20302
|
_render;
|
|
20118
|
-
_track =
|
|
20303
|
+
_track = false;
|
|
20119
20304
|
_prevFrame = "";
|
|
20120
20305
|
_subscribers = /* @__PURE__ */ new Map();
|
|
20121
20306
|
_cursor = 0;
|
|
@@ -20123,265 +20308,544 @@ var x$1 = class {
|
|
|
20123
20308
|
error = "";
|
|
20124
20309
|
value;
|
|
20125
20310
|
userInput = "";
|
|
20126
|
-
constructor(
|
|
20127
|
-
const { input: i = stdin, output:
|
|
20128
|
-
this.opts =
|
|
20311
|
+
constructor(t, e = true) {
|
|
20312
|
+
const { input: i = stdin, output: n = stdout, render: s, signal: r, ...o } = t;
|
|
20313
|
+
this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = s.bind(this), this._track = e, this._abortSignal = r, this.input = i, this.output = n;
|
|
20129
20314
|
}
|
|
20315
|
+
/**
|
|
20316
|
+
* Unsubscribe all listeners
|
|
20317
|
+
*/
|
|
20130
20318
|
unsubscribe() {
|
|
20131
20319
|
this._subscribers.clear();
|
|
20132
20320
|
}
|
|
20133
|
-
|
|
20134
|
-
|
|
20135
|
-
|
|
20321
|
+
/**
|
|
20322
|
+
* Set a subscriber with opts
|
|
20323
|
+
* @param event - The event name
|
|
20324
|
+
*/
|
|
20325
|
+
setSubscriber(t, e) {
|
|
20326
|
+
const i = this._subscribers.get(t) ?? [];
|
|
20327
|
+
i.push(e), this._subscribers.set(t, i);
|
|
20136
20328
|
}
|
|
20137
|
-
|
|
20138
|
-
|
|
20329
|
+
/**
|
|
20330
|
+
* Subscribe to an event
|
|
20331
|
+
* @param event - The event name
|
|
20332
|
+
* @param cb - The callback
|
|
20333
|
+
*/
|
|
20334
|
+
on(t, e) {
|
|
20335
|
+
this.setSubscriber(t, { cb: e });
|
|
20139
20336
|
}
|
|
20140
|
-
|
|
20141
|
-
|
|
20142
|
-
|
|
20143
|
-
|
|
20337
|
+
/**
|
|
20338
|
+
* Subscribe to an event once
|
|
20339
|
+
* @param event - The event name
|
|
20340
|
+
* @param cb - The callback
|
|
20341
|
+
*/
|
|
20342
|
+
once(t, e) {
|
|
20343
|
+
this.setSubscriber(t, {
|
|
20344
|
+
cb: e,
|
|
20345
|
+
once: true
|
|
20144
20346
|
});
|
|
20145
20347
|
}
|
|
20146
|
-
|
|
20147
|
-
|
|
20148
|
-
|
|
20149
|
-
|
|
20348
|
+
/**
|
|
20349
|
+
* Emit an event with data
|
|
20350
|
+
* @param event - The event name
|
|
20351
|
+
* @param data - The data to pass to the callback
|
|
20352
|
+
*/
|
|
20353
|
+
emit(t, ...e) {
|
|
20354
|
+
const i = this._subscribers.get(t) ?? [], n = [];
|
|
20355
|
+
for (const s of i) s.cb(...e), s.once && n.push(() => i.splice(i.indexOf(s), 1));
|
|
20356
|
+
for (const s of n) s();
|
|
20150
20357
|
}
|
|
20151
20358
|
prompt() {
|
|
20152
|
-
return new Promise((
|
|
20359
|
+
return new Promise((t) => {
|
|
20153
20360
|
if (this._abortSignal) {
|
|
20154
|
-
if (this._abortSignal.aborted) return this.state = "cancel", this.close(),
|
|
20361
|
+
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), t(CANCEL_SYMBOL);
|
|
20155
20362
|
this._abortSignal.addEventListener("abort", () => {
|
|
20156
20363
|
this.state = "cancel", this.close();
|
|
20157
|
-
}, { once:
|
|
20364
|
+
}, { once: true });
|
|
20158
20365
|
}
|
|
20159
|
-
this.rl =
|
|
20366
|
+
this.rl = l__default.createInterface({
|
|
20160
20367
|
input: this.input,
|
|
20161
20368
|
tabSize: 2,
|
|
20162
20369
|
prompt: "",
|
|
20163
20370
|
escapeCodeTimeout: 50,
|
|
20164
|
-
terminal:
|
|
20165
|
-
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput,
|
|
20166
|
-
this.output.write(import_src.cursor.show), this.output.off("resize", this.render),
|
|
20371
|
+
terminal: true
|
|
20372
|
+
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), setRawMode(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
20373
|
+
this.output.write(import_src.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t(this.value);
|
|
20167
20374
|
}), this.once("cancel", () => {
|
|
20168
|
-
this.output.write(import_src.cursor.show), this.output.off("resize", this.render),
|
|
20375
|
+
this.output.write(import_src.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t(CANCEL_SYMBOL);
|
|
20169
20376
|
});
|
|
20170
20377
|
});
|
|
20171
20378
|
}
|
|
20172
|
-
_isActionKey(
|
|
20173
|
-
return
|
|
20379
|
+
_isActionKey(t, e) {
|
|
20380
|
+
return t === " ";
|
|
20174
20381
|
}
|
|
20175
|
-
|
|
20176
|
-
|
|
20382
|
+
_shouldSubmit(t, e) {
|
|
20383
|
+
return true;
|
|
20384
|
+
}
|
|
20385
|
+
_setValue(t) {
|
|
20386
|
+
this.value = t, this.emit("value", this.value);
|
|
20177
20387
|
}
|
|
20178
|
-
_setUserInput(
|
|
20179
|
-
this.userInput =
|
|
20388
|
+
_setUserInput(t, e) {
|
|
20389
|
+
this.userInput = t ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
|
|
20180
20390
|
}
|
|
20181
20391
|
_clearUserInput() {
|
|
20182
20392
|
this.rl?.write(null, {
|
|
20183
|
-
ctrl:
|
|
20393
|
+
ctrl: true,
|
|
20184
20394
|
name: "u"
|
|
20185
20395
|
}), this._setUserInput("");
|
|
20186
20396
|
}
|
|
20187
|
-
onKeypress(
|
|
20188
|
-
if (this._track &&
|
|
20189
|
-
ctrl:
|
|
20397
|
+
onKeypress(t, e) {
|
|
20398
|
+
if (this._track && e.name !== "return" && (e.name && this._isActionKey(t, e) && this.rl?.write(null, {
|
|
20399
|
+
ctrl: true,
|
|
20190
20400
|
name: "h"
|
|
20191
|
-
}), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"),
|
|
20401
|
+
}), 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)) {
|
|
20192
20402
|
if (this.opts.validate) {
|
|
20193
|
-
const i = this.opts.validate
|
|
20403
|
+
const i = runValidation(this.opts.validate, this.value);
|
|
20194
20404
|
i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput));
|
|
20195
20405
|
}
|
|
20196
20406
|
this.state !== "error" && (this.state = "submit");
|
|
20197
20407
|
}
|
|
20198
|
-
|
|
20199
|
-
|
|
20200
|
-
|
|
20201
|
-
|
|
20408
|
+
isActionKey([
|
|
20409
|
+
t,
|
|
20410
|
+
e?.name,
|
|
20411
|
+
e?.sequence
|
|
20202
20412
|
], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
20203
20413
|
}
|
|
20204
20414
|
close() {
|
|
20205
20415
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
20206
|
-
`),
|
|
20416
|
+
`), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
20207
20417
|
}
|
|
20208
20418
|
restoreCursor() {
|
|
20209
|
-
const
|
|
20210
|
-
hard:
|
|
20211
|
-
trim:
|
|
20419
|
+
const t = wrapAnsi$1(this._prevFrame, process.stdout.columns, {
|
|
20420
|
+
hard: true,
|
|
20421
|
+
trim: false
|
|
20212
20422
|
}).split(`
|
|
20213
20423
|
`).length - 1;
|
|
20214
|
-
this.output.write(import_src.cursor.move(-999,
|
|
20424
|
+
this.output.write(import_src.cursor.move(-999, t * -1));
|
|
20215
20425
|
}
|
|
20216
20426
|
render() {
|
|
20217
|
-
const
|
|
20218
|
-
hard:
|
|
20219
|
-
trim:
|
|
20427
|
+
const t = wrapAnsi$1(this._render(this) ?? "", process.stdout.columns, {
|
|
20428
|
+
hard: true,
|
|
20429
|
+
trim: false
|
|
20220
20430
|
});
|
|
20221
|
-
if (
|
|
20431
|
+
if (t !== this._prevFrame) {
|
|
20222
20432
|
if (this.state === "initial") this.output.write(import_src.cursor.hide);
|
|
20223
20433
|
else {
|
|
20224
|
-
const
|
|
20225
|
-
if (this.restoreCursor(),
|
|
20226
|
-
const
|
|
20227
|
-
let
|
|
20228
|
-
if (
|
|
20229
|
-
this._prevFrame =
|
|
20434
|
+
const e = diffLines(this._prevFrame, t), i = getRows(this.output);
|
|
20435
|
+
if (this.restoreCursor(), e) {
|
|
20436
|
+
const n = Math.max(0, e.numLinesAfter - i), s = Math.max(0, e.numLinesBefore - i);
|
|
20437
|
+
let r = e.lines.find((o) => o >= n);
|
|
20438
|
+
if (r === void 0) {
|
|
20439
|
+
this._prevFrame = t;
|
|
20230
20440
|
return;
|
|
20231
20441
|
}
|
|
20232
|
-
if (
|
|
20233
|
-
this.output.write(import_src.cursor.move(0,
|
|
20234
|
-
const
|
|
20442
|
+
if (e.lines.length === 1) {
|
|
20443
|
+
this.output.write(import_src.cursor.move(0, r - s)), this.output.write(import_src.erase.lines(1));
|
|
20444
|
+
const o = t.split(`
|
|
20235
20445
|
`);
|
|
20236
|
-
this.output.write(
|
|
20446
|
+
this.output.write(o[r]), this._prevFrame = t, this.output.write(import_src.cursor.move(0, o.length - r - 1));
|
|
20237
20447
|
return;
|
|
20238
|
-
} else if (
|
|
20239
|
-
if (
|
|
20448
|
+
} else if (e.lines.length > 1) {
|
|
20449
|
+
if (n < s) r = n;
|
|
20240
20450
|
else {
|
|
20241
|
-
const
|
|
20242
|
-
|
|
20451
|
+
const h = r - s;
|
|
20452
|
+
h > 0 && this.output.write(import_src.cursor.move(0, h));
|
|
20243
20453
|
}
|
|
20244
20454
|
this.output.write(import_src.erase.down());
|
|
20245
|
-
const
|
|
20246
|
-
`).slice(
|
|
20247
|
-
this.output.write(
|
|
20248
|
-
`)), this._prevFrame =
|
|
20455
|
+
const f = t.split(`
|
|
20456
|
+
`).slice(r);
|
|
20457
|
+
this.output.write(f.join(`
|
|
20458
|
+
`)), this._prevFrame = t;
|
|
20249
20459
|
return;
|
|
20250
20460
|
}
|
|
20251
20461
|
}
|
|
20252
20462
|
this.output.write(import_src.erase.down());
|
|
20253
20463
|
}
|
|
20254
|
-
this.output.write(
|
|
20464
|
+
this.output.write(t), this.state === "initial" && (this.state = "active"), this._prevFrame = t;
|
|
20255
20465
|
}
|
|
20256
20466
|
}
|
|
20257
20467
|
};
|
|
20258
|
-
function
|
|
20259
|
-
if (
|
|
20260
|
-
const
|
|
20261
|
-
return
|
|
20468
|
+
function p$1$1(l, e) {
|
|
20469
|
+
if (l === void 0 || e.length === 0) return 0;
|
|
20470
|
+
const i = e.findIndex((s) => s.value === l);
|
|
20471
|
+
return i !== -1 ? i : 0;
|
|
20262
20472
|
}
|
|
20263
|
-
function
|
|
20264
|
-
return (e.label ?? String(e.value)).toLowerCase().includes(
|
|
20473
|
+
function g$1(l, e) {
|
|
20474
|
+
return (e.label ?? String(e.value)).toLowerCase().includes(l.toLowerCase());
|
|
20265
20475
|
}
|
|
20266
|
-
function
|
|
20267
|
-
if (e) return
|
|
20476
|
+
function m$2(l, e) {
|
|
20477
|
+
if (e) return l ? e : e[0];
|
|
20268
20478
|
}
|
|
20269
|
-
|
|
20479
|
+
let T$1 = class T extends V$1 {
|
|
20270
20480
|
filteredOptions;
|
|
20271
20481
|
multiple;
|
|
20272
|
-
isNavigating =
|
|
20482
|
+
isNavigating = false;
|
|
20273
20483
|
selectedValues = [];
|
|
20274
20484
|
focusedValue;
|
|
20275
|
-
#
|
|
20485
|
+
#e = 0;
|
|
20276
20486
|
#s = "";
|
|
20487
|
+
#t;
|
|
20277
20488
|
#i;
|
|
20278
|
-
#
|
|
20489
|
+
#n;
|
|
20279
20490
|
get cursor() {
|
|
20280
|
-
return this.#
|
|
20491
|
+
return this.#e;
|
|
20281
20492
|
}
|
|
20282
20493
|
get userInputWithCursor() {
|
|
20283
|
-
if (!this.userInput) return
|
|
20494
|
+
if (!this.userInput) return styleText(["inverse", "hidden"], "_");
|
|
20284
20495
|
if (this._cursor >= this.userInput.length) return `${this.userInput}\u2588`;
|
|
20285
|
-
const e = this.userInput.slice(0, this.
|
|
20286
|
-
return `${e}${
|
|
20496
|
+
const e = this.userInput.slice(0, this.cursor), t = this.userInput.slice(this.cursor, this.cursor + 1), i = this.userInput.slice(this.cursor + 1);
|
|
20497
|
+
return `${e}${styleText("inverse", t)}${i}`;
|
|
20287
20498
|
}
|
|
20288
20499
|
get options() {
|
|
20289
|
-
return typeof this.#
|
|
20500
|
+
return typeof this.#i == "function" ? this.#i() : this.#i;
|
|
20290
20501
|
}
|
|
20291
20502
|
constructor(e) {
|
|
20292
|
-
super(e), this.#e = e.
|
|
20293
|
-
const
|
|
20294
|
-
this.filteredOptions = [...
|
|
20503
|
+
super(e), this.#i = e.options, this.#n = e.placeholder;
|
|
20504
|
+
const t = this.options;
|
|
20505
|
+
this.filteredOptions = [...t], this.multiple = e.multiple === true, this.#t = typeof e.options == "function" ? e.filter : e.filter ?? g$1;
|
|
20295
20506
|
let i;
|
|
20296
|
-
if (e.initialValue && Array.isArray(e.initialValue) ? this.multiple ? i = e.initialValue : i = e.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (i = [this.options[0]
|
|
20297
|
-
const n =
|
|
20298
|
-
n !== -1 && (this.toggleSelected(
|
|
20507
|
+
if (e.initialValue && Array.isArray(e.initialValue) ? this.multiple ? i = e.initialValue : i = e.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (i = [this.options[0]?.value]), i) for (const s of i) {
|
|
20508
|
+
const n = t.findIndex((o) => o.value === s);
|
|
20509
|
+
n !== -1 && (this.toggleSelected(s), this.#e = n);
|
|
20299
20510
|
}
|
|
20300
|
-
this.focusedValue = this.options[this.#
|
|
20511
|
+
this.focusedValue = this.options[this.#e]?.value, this.on("key", (s, n) => this.#l(s, n)), this.on("userInput", (s) => this.#u(s));
|
|
20301
20512
|
}
|
|
20302
|
-
_isActionKey(e,
|
|
20303
|
-
return e === " " || this.multiple && this.isNavigating &&
|
|
20513
|
+
_isActionKey(e, t) {
|
|
20514
|
+
return e === " " || this.multiple && this.isNavigating && t.name === "space" && e !== void 0 && e !== "";
|
|
20304
20515
|
}
|
|
20305
|
-
#
|
|
20306
|
-
const i =
|
|
20307
|
-
|
|
20516
|
+
#l(e, t) {
|
|
20517
|
+
const i = t.name === "up", s = t.name === "down", n = t.name === "return", o = this.userInput === "" || this.userInput === " ", u = this.#n, a = this.options, f = u !== void 0 && u !== "" && a.some((r) => !r.disabled && (this.#t ? this.#t(u, r) : true));
|
|
20518
|
+
if (t.name === "tab" && o && f) {
|
|
20519
|
+
this.userInput === " " && this._clearUserInput(), this._setUserInput(u, true), this.isNavigating = false;
|
|
20520
|
+
return;
|
|
20521
|
+
}
|
|
20522
|
+
i || s ? (this.#e = findCursor(this.#e, i ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#e]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = true) : n ? this.value = m$2(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== void 0 && (t.name === "tab" || this.isNavigating && t.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = false : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = false);
|
|
20308
20523
|
}
|
|
20309
20524
|
deselectAll() {
|
|
20310
20525
|
this.selectedValues = [];
|
|
20311
20526
|
}
|
|
20312
20527
|
toggleSelected(e) {
|
|
20313
|
-
this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(e) ? this.selectedValues = this.selectedValues.filter((
|
|
20528
|
+
this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(e) ? this.selectedValues = this.selectedValues.filter((t) => t !== e) : this.selectedValues = [...this.selectedValues, e] : this.selectedValues = [e]);
|
|
20314
20529
|
}
|
|
20315
|
-
#
|
|
20530
|
+
#u(e) {
|
|
20316
20531
|
if (e !== this.#s) {
|
|
20317
20532
|
this.#s = e;
|
|
20318
|
-
const
|
|
20319
|
-
e ? this.filteredOptions =
|
|
20320
|
-
this.#
|
|
20321
|
-
const
|
|
20322
|
-
|
|
20533
|
+
const t = this.options;
|
|
20534
|
+
e && this.#t ? this.filteredOptions = t.filter((n) => this.#t?.(e, n)) : this.filteredOptions = [...t];
|
|
20535
|
+
this.#e = findCursor(p$1$1(this.focusedValue, this.filteredOptions), 0, this.filteredOptions);
|
|
20536
|
+
const s = this.filteredOptions[this.#e];
|
|
20537
|
+
s && !s.disabled ? this.focusedValue = s.value : this.focusedValue = void 0, this.multiple || (this.focusedValue !== void 0 ? this.toggleSelected(this.focusedValue) : this.deselectAll());
|
|
20323
20538
|
}
|
|
20324
20539
|
}
|
|
20325
20540
|
};
|
|
20326
|
-
var
|
|
20541
|
+
var r = class extends V$1 {
|
|
20327
20542
|
get cursor() {
|
|
20328
20543
|
return this.value ? 0 : 1;
|
|
20329
20544
|
}
|
|
20330
20545
|
get _value() {
|
|
20331
20546
|
return this.cursor === 0;
|
|
20332
20547
|
}
|
|
20333
|
-
constructor(
|
|
20334
|
-
super(
|
|
20548
|
+
constructor(t) {
|
|
20549
|
+
super(t, false), this.value = !!t.initialValue, this.on("userInput", () => {
|
|
20335
20550
|
this.value = this._value;
|
|
20336
|
-
}), this.on("confirm", (
|
|
20337
|
-
this.output.write(import_src.cursor.move(0, -1)), this.value =
|
|
20551
|
+
}), this.on("confirm", (i) => {
|
|
20552
|
+
this.output.write(import_src.cursor.move(0, -1)), this.value = i, this.state = "submit", this.close();
|
|
20338
20553
|
}), this.on("cursor", () => {
|
|
20339
20554
|
this.value = !this.value;
|
|
20340
20555
|
});
|
|
20341
20556
|
}
|
|
20342
20557
|
};
|
|
20343
|
-
|
|
20558
|
+
const _$1 = {
|
|
20559
|
+
Y: {
|
|
20560
|
+
type: "year",
|
|
20561
|
+
len: 4
|
|
20562
|
+
},
|
|
20563
|
+
M: {
|
|
20564
|
+
type: "month",
|
|
20565
|
+
len: 2
|
|
20566
|
+
},
|
|
20567
|
+
D: {
|
|
20568
|
+
type: "day",
|
|
20569
|
+
len: 2
|
|
20570
|
+
}
|
|
20571
|
+
};
|
|
20572
|
+
function M$1(r) {
|
|
20573
|
+
return [...r].map((t) => _$1[t]);
|
|
20574
|
+
}
|
|
20575
|
+
function P$2(r) {
|
|
20576
|
+
const i = new Intl.DateTimeFormat(r, {
|
|
20577
|
+
year: "numeric",
|
|
20578
|
+
month: "2-digit",
|
|
20579
|
+
day: "2-digit"
|
|
20580
|
+
}).formatToParts(new Date(2e3, 0, 15)), s = [];
|
|
20581
|
+
let n = "/";
|
|
20582
|
+
for (const e of i) e.type === "literal" ? n = e.value.trim() || e.value : (e.type === "year" || e.type === "month" || e.type === "day") && s.push({
|
|
20583
|
+
type: e.type,
|
|
20584
|
+
len: e.type === "year" ? 4 : 2
|
|
20585
|
+
});
|
|
20586
|
+
return {
|
|
20587
|
+
segments: s,
|
|
20588
|
+
separator: n
|
|
20589
|
+
};
|
|
20590
|
+
}
|
|
20591
|
+
function p$3(r) {
|
|
20592
|
+
return Number.parseInt((r || "0").replace(/_/g, "0"), 10) || 0;
|
|
20593
|
+
}
|
|
20594
|
+
function f$1(r) {
|
|
20595
|
+
return {
|
|
20596
|
+
year: p$3(r.year),
|
|
20597
|
+
month: p$3(r.month),
|
|
20598
|
+
day: p$3(r.day)
|
|
20599
|
+
};
|
|
20600
|
+
}
|
|
20601
|
+
function c$2(r, t) {
|
|
20602
|
+
return new Date(r || 2001, t || 1, 0).getDate();
|
|
20603
|
+
}
|
|
20604
|
+
function b$2(r) {
|
|
20605
|
+
const { year: t, month: i, day: s } = f$1(r);
|
|
20606
|
+
if (!t || t < 0 || t > 9999 || !i || i < 1 || i > 12 || !s || s < 1) return;
|
|
20607
|
+
const n = new Date(Date.UTC(t, i - 1, s));
|
|
20608
|
+
if (!(n.getUTCFullYear() !== t || n.getUTCMonth() !== i - 1 || n.getUTCDate() !== s)) return {
|
|
20609
|
+
year: t,
|
|
20610
|
+
month: i,
|
|
20611
|
+
day: s
|
|
20612
|
+
};
|
|
20613
|
+
}
|
|
20614
|
+
function C$2(r) {
|
|
20615
|
+
const t = b$2(r);
|
|
20616
|
+
return t ? new Date(Date.UTC(t.year, t.month - 1, t.day)) : void 0;
|
|
20617
|
+
}
|
|
20618
|
+
function T(r, t, i, s) {
|
|
20619
|
+
const n = i ? {
|
|
20620
|
+
year: i.getUTCFullYear(),
|
|
20621
|
+
month: i.getUTCMonth() + 1,
|
|
20622
|
+
day: i.getUTCDate()
|
|
20623
|
+
} : null, e = s ? {
|
|
20624
|
+
year: s.getUTCFullYear(),
|
|
20625
|
+
month: s.getUTCMonth() + 1,
|
|
20626
|
+
day: s.getUTCDate()
|
|
20627
|
+
} : null;
|
|
20628
|
+
return r === "year" ? {
|
|
20629
|
+
min: n?.year ?? 1,
|
|
20630
|
+
max: e?.year ?? 9999
|
|
20631
|
+
} : r === "month" ? {
|
|
20632
|
+
min: n && t.year === n.year ? n.month : 1,
|
|
20633
|
+
max: e && t.year === e.year ? e.month : 12
|
|
20634
|
+
} : {
|
|
20635
|
+
min: n && t.year === n.year && t.month === n.month ? n.day : 1,
|
|
20636
|
+
max: e && t.year === e.year && t.month === e.month ? e.day : c$2(t.year, t.month)
|
|
20637
|
+
};
|
|
20638
|
+
}
|
|
20639
|
+
var U$1 = class extends V$1 {
|
|
20640
|
+
#i;
|
|
20641
|
+
#o;
|
|
20642
|
+
#t;
|
|
20643
|
+
#h;
|
|
20644
|
+
#u;
|
|
20645
|
+
#e = {
|
|
20646
|
+
segmentIndex: 0,
|
|
20647
|
+
positionInSegment: 0
|
|
20648
|
+
};
|
|
20649
|
+
#n = true;
|
|
20650
|
+
#s = null;
|
|
20651
|
+
inlineError = "";
|
|
20652
|
+
get segmentCursor() {
|
|
20653
|
+
return { ...this.#e };
|
|
20654
|
+
}
|
|
20655
|
+
get segmentValues() {
|
|
20656
|
+
return { ...this.#t };
|
|
20657
|
+
}
|
|
20658
|
+
get segments() {
|
|
20659
|
+
return this.#i;
|
|
20660
|
+
}
|
|
20661
|
+
get separator() {
|
|
20662
|
+
return this.#o;
|
|
20663
|
+
}
|
|
20664
|
+
get formattedValue() {
|
|
20665
|
+
return this.#l(this.#t);
|
|
20666
|
+
}
|
|
20667
|
+
#l(t) {
|
|
20668
|
+
return this.#i.map((i) => t[i.type]).join(this.#o);
|
|
20669
|
+
}
|
|
20670
|
+
#r() {
|
|
20671
|
+
this._setUserInput(this.#l(this.#t)), this._setValue(C$2(this.#t) ?? void 0);
|
|
20672
|
+
}
|
|
20673
|
+
constructor(t) {
|
|
20674
|
+
const i = t.format ? {
|
|
20675
|
+
segments: M$1(t.format),
|
|
20676
|
+
separator: t.separator ?? "/"
|
|
20677
|
+
} : P$2(t.locale), s = t.separator ?? i.separator, n = t.format ? M$1(t.format) : i.segments, e = t.initialValue ?? t.defaultValue, m = e ? {
|
|
20678
|
+
year: String(e.getUTCFullYear()).padStart(4, "0"),
|
|
20679
|
+
month: String(e.getUTCMonth() + 1).padStart(2, "0"),
|
|
20680
|
+
day: String(e.getUTCDate()).padStart(2, "0")
|
|
20681
|
+
} : {
|
|
20682
|
+
year: "____",
|
|
20683
|
+
month: "__",
|
|
20684
|
+
day: "__"
|
|
20685
|
+
}, o = n.map((a) => m[a.type]).join(s);
|
|
20686
|
+
super({
|
|
20687
|
+
...t,
|
|
20688
|
+
initialUserInput: o
|
|
20689
|
+
}, false), this.#i = n, this.#o = s, this.#t = m, this.#h = t.minDate, this.#u = t.maxDate, this.#r(), this.on("cursor", (a) => this.#f(a)), this.on("key", (a, u) => this.#y(a, u)), this.on("finalize", () => this.#p(t));
|
|
20690
|
+
}
|
|
20691
|
+
#a() {
|
|
20692
|
+
const t = Math.max(0, Math.min(this.#e.segmentIndex, this.#i.length - 1)), i = this.#i[t];
|
|
20693
|
+
if (i) return this.#e.positionInSegment = Math.max(0, Math.min(this.#e.positionInSegment, i.len - 1)), {
|
|
20694
|
+
segment: i,
|
|
20695
|
+
index: t
|
|
20696
|
+
};
|
|
20697
|
+
}
|
|
20698
|
+
#m(t) {
|
|
20699
|
+
this.inlineError = "", this.#s = null;
|
|
20700
|
+
const i = this.#a();
|
|
20701
|
+
i && (this.#e.segmentIndex = Math.max(0, Math.min(this.#i.length - 1, i.index + t)), this.#e.positionInSegment = 0, this.#n = true);
|
|
20702
|
+
}
|
|
20703
|
+
#d(t) {
|
|
20704
|
+
const i = this.#a();
|
|
20705
|
+
if (!i) return;
|
|
20706
|
+
const { segment: s } = i, n = this.#t[s.type], e = !n || n.replace(/_/g, "") === "", m = Number.parseInt((n || "0").replace(/_/g, "0"), 10) || 0, o = T(s.type, f$1(this.#t), this.#h, this.#u);
|
|
20707
|
+
let a;
|
|
20708
|
+
e ? a = t === 1 ? o.min : o.max : a = Math.max(Math.min(o.max, m + t), o.min), this.#t = {
|
|
20709
|
+
...this.#t,
|
|
20710
|
+
[s.type]: a.toString().padStart(s.len, "0")
|
|
20711
|
+
}, this.#n = true, this.#s = null, this.#r();
|
|
20712
|
+
}
|
|
20713
|
+
#f(t) {
|
|
20714
|
+
if (t) switch (t) {
|
|
20715
|
+
case "right": return this.#m(1);
|
|
20716
|
+
case "left": return this.#m(-1);
|
|
20717
|
+
case "up": return this.#d(1);
|
|
20718
|
+
case "down": return this.#d(-1);
|
|
20719
|
+
}
|
|
20720
|
+
}
|
|
20721
|
+
#y(t, i) {
|
|
20722
|
+
if (i?.name === "backspace" || i?.sequence === "" || i?.sequence === "\b" || t === "" || t === "\b") {
|
|
20723
|
+
this.inlineError = "";
|
|
20724
|
+
const n = this.#a();
|
|
20725
|
+
if (!n) return;
|
|
20726
|
+
if (!this.#t[n.segment.type].replace(/_/g, "")) {
|
|
20727
|
+
this.#m(-1);
|
|
20728
|
+
return;
|
|
20729
|
+
}
|
|
20730
|
+
this.#t[n.segment.type] = "_".repeat(n.segment.len), this.#n = true, this.#e.positionInSegment = 0, this.#r();
|
|
20731
|
+
return;
|
|
20732
|
+
}
|
|
20733
|
+
if (i?.name === "tab") {
|
|
20734
|
+
this.inlineError = "";
|
|
20735
|
+
const n = this.#a();
|
|
20736
|
+
if (!n) return;
|
|
20737
|
+
const e = i.shift ? -1 : 1, m = n.index + e;
|
|
20738
|
+
m >= 0 && m < this.#i.length && (this.#e.segmentIndex = m, this.#e.positionInSegment = 0, this.#n = true);
|
|
20739
|
+
return;
|
|
20740
|
+
}
|
|
20741
|
+
if (t && /^[0-9]$/.test(t)) {
|
|
20742
|
+
const n = this.#a();
|
|
20743
|
+
if (!n) return;
|
|
20744
|
+
const { segment: e } = n, m = !this.#t[e.type].replace(/_/g, "");
|
|
20745
|
+
if (this.#n && this.#s !== null && !m) {
|
|
20746
|
+
const h = this.#s + t, d = {
|
|
20747
|
+
...this.#t,
|
|
20748
|
+
[e.type]: h
|
|
20749
|
+
}, g = this.#g(d, e);
|
|
20750
|
+
if (g) {
|
|
20751
|
+
this.inlineError = g, this.#s = null, this.#n = false;
|
|
20752
|
+
return;
|
|
20753
|
+
}
|
|
20754
|
+
this.inlineError = "", this.#t[e.type] = h, this.#s = null, this.#n = false, this.#r(), n.index < this.#i.length - 1 && (this.#e.segmentIndex = n.index + 1, this.#e.positionInSegment = 0, this.#n = true);
|
|
20755
|
+
return;
|
|
20756
|
+
}
|
|
20757
|
+
this.#n && !m && (this.#t[e.type] = "_".repeat(e.len), this.#e.positionInSegment = 0), this.#n = false, this.#s = null;
|
|
20758
|
+
const o = this.#t[e.type], a = o.indexOf("_"), u = a >= 0 ? a : Math.min(this.#e.positionInSegment, e.len - 1);
|
|
20759
|
+
if (u < 0 || u >= e.len) return;
|
|
20760
|
+
let l = o.slice(0, u) + t + o.slice(u + 1), D = false;
|
|
20761
|
+
if (u === 0 && o === "__" && (e.type === "month" || e.type === "day")) {
|
|
20762
|
+
const h = Number.parseInt(t, 10);
|
|
20763
|
+
l = `0${t}`, D = h <= (e.type === "month" ? 1 : 2);
|
|
20764
|
+
}
|
|
20765
|
+
if (e.type === "year" && (l = (o.replace(/_/g, "") + t).padStart(e.len, "_")), !l.includes("_")) {
|
|
20766
|
+
const h = {
|
|
20767
|
+
...this.#t,
|
|
20768
|
+
[e.type]: l
|
|
20769
|
+
}, d = this.#g(h, e);
|
|
20770
|
+
if (d) {
|
|
20771
|
+
this.inlineError = d;
|
|
20772
|
+
return;
|
|
20773
|
+
}
|
|
20774
|
+
}
|
|
20775
|
+
this.inlineError = "", this.#t[e.type] = l;
|
|
20776
|
+
const y = l.includes("_") ? void 0 : b$2(this.#t);
|
|
20777
|
+
if (y) {
|
|
20778
|
+
const { year: h, month: d } = y, g = c$2(h, d);
|
|
20779
|
+
this.#t = {
|
|
20780
|
+
year: String(Math.max(0, Math.min(9999, h))).padStart(4, "0"),
|
|
20781
|
+
month: String(Math.max(1, Math.min(12, d))).padStart(2, "0"),
|
|
20782
|
+
day: String(Math.max(1, Math.min(g, y.day))).padStart(2, "0")
|
|
20783
|
+
};
|
|
20784
|
+
}
|
|
20785
|
+
this.#r();
|
|
20786
|
+
const S = l.indexOf("_");
|
|
20787
|
+
D ? (this.#n = true, this.#s = t) : S >= 0 ? this.#e.positionInSegment = S : a >= 0 && n.index < this.#i.length - 1 ? (this.#e.segmentIndex = n.index + 1, this.#e.positionInSegment = 0, this.#n = true) : this.#e.positionInSegment = Math.min(u + 1, e.len - 1);
|
|
20788
|
+
}
|
|
20789
|
+
}
|
|
20790
|
+
#g(t, i) {
|
|
20791
|
+
const { month: s, day: n } = f$1(t);
|
|
20792
|
+
if (i.type === "month" && (s < 0 || s > 12)) return settings.date.messages.invalidMonth;
|
|
20793
|
+
if (i.type === "day" && (n < 0 || n > 31)) return settings.date.messages.invalidDay(31, "any month");
|
|
20794
|
+
}
|
|
20795
|
+
#p(t) {
|
|
20796
|
+
const { year: i, month: s, day: n } = f$1(this.#t);
|
|
20797
|
+
if (i && s && n) {
|
|
20798
|
+
const e = c$2(i, s);
|
|
20799
|
+
this.#t = {
|
|
20800
|
+
...this.#t,
|
|
20801
|
+
day: String(Math.min(n, e)).padStart(2, "0")
|
|
20802
|
+
};
|
|
20803
|
+
}
|
|
20804
|
+
this.value = C$2(this.#t) ?? t.defaultValue ?? void 0;
|
|
20805
|
+
}
|
|
20806
|
+
};
|
|
20807
|
+
let u$2 = class u extends V$1 {
|
|
20344
20808
|
options;
|
|
20345
20809
|
cursor = 0;
|
|
20346
20810
|
#t;
|
|
20347
|
-
getGroupItems(
|
|
20348
|
-
return this.options.filter((
|
|
20811
|
+
getGroupItems(t) {
|
|
20812
|
+
return this.options.filter((r) => r.group === t);
|
|
20349
20813
|
}
|
|
20350
|
-
isGroupSelected(
|
|
20351
|
-
const
|
|
20352
|
-
return
|
|
20814
|
+
isGroupSelected(t) {
|
|
20815
|
+
const r = this.getGroupItems(t), e = this.value;
|
|
20816
|
+
return e === void 0 ? false : r.every((s) => e.includes(s.value));
|
|
20353
20817
|
}
|
|
20354
20818
|
toggleValue() {
|
|
20355
|
-
const
|
|
20356
|
-
if (this.value === void 0 && (this.value = []),
|
|
20357
|
-
const
|
|
20358
|
-
this.isGroupSelected(
|
|
20359
|
-
} else this.value = this.value.includes(
|
|
20819
|
+
const t = this.options[this.cursor];
|
|
20820
|
+
if (t !== void 0) if (this.value === void 0 && (this.value = []), t.group === true) {
|
|
20821
|
+
const r = t.value, e = this.getGroupItems(r);
|
|
20822
|
+
this.isGroupSelected(r) ? this.value = this.value.filter((s) => e.findIndex((i) => i.value === s) === -1) : this.value = [...this.value, ...e.map((s) => s.value)], this.value = Array.from(new Set(this.value));
|
|
20823
|
+
} else this.value = this.value.includes(t.value) ? this.value.filter((e) => e !== t.value) : [...this.value, t.value];
|
|
20360
20824
|
}
|
|
20361
|
-
constructor(
|
|
20362
|
-
super(
|
|
20363
|
-
const { options:
|
|
20364
|
-
this.#t =
|
|
20365
|
-
value:
|
|
20366
|
-
group:
|
|
20367
|
-
label:
|
|
20368
|
-
}, ...
|
|
20369
|
-
...
|
|
20370
|
-
group:
|
|
20371
|
-
}))]), this.value = [...
|
|
20372
|
-
switch (
|
|
20825
|
+
constructor(t) {
|
|
20826
|
+
super(t, false);
|
|
20827
|
+
const { options: r } = t;
|
|
20828
|
+
this.#t = t.selectableGroups !== false, this.options = Object.entries(r).flatMap(([e, s]) => [{
|
|
20829
|
+
value: e,
|
|
20830
|
+
group: true,
|
|
20831
|
+
label: e
|
|
20832
|
+
}, ...s.map((i) => ({
|
|
20833
|
+
...i,
|
|
20834
|
+
group: e
|
|
20835
|
+
}))]), this.value = [...t.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: e }) => e === t.cursorAt), this.#t ? 0 : 1), this.on("cursor", (e) => {
|
|
20836
|
+
switch (e) {
|
|
20373
20837
|
case "left":
|
|
20374
20838
|
case "up": {
|
|
20375
20839
|
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
20376
|
-
const
|
|
20377
|
-
!this.#t &&
|
|
20840
|
+
const s = this.options[this.cursor]?.group === true;
|
|
20841
|
+
!this.#t && s && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
|
|
20378
20842
|
break;
|
|
20379
20843
|
}
|
|
20380
20844
|
case "down":
|
|
20381
20845
|
case "right": {
|
|
20382
20846
|
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
20383
|
-
const
|
|
20384
|
-
!this.#t &&
|
|
20847
|
+
const s = this.options[this.cursor]?.group === true;
|
|
20848
|
+
!this.#t && s && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
|
|
20385
20849
|
break;
|
|
20386
20850
|
}
|
|
20387
20851
|
case "space":
|
|
@@ -20391,42 +20855,128 @@ var yt$2 = class extends x$1 {
|
|
|
20391
20855
|
});
|
|
20392
20856
|
}
|
|
20393
20857
|
};
|
|
20394
|
-
|
|
20858
|
+
const o$1 = /* @__PURE__ */ new Set([
|
|
20859
|
+
"up",
|
|
20860
|
+
"down",
|
|
20861
|
+
"left",
|
|
20862
|
+
"right"
|
|
20863
|
+
]);
|
|
20864
|
+
var h$1 = class extends V$1 {
|
|
20865
|
+
#t = false;
|
|
20866
|
+
#s;
|
|
20867
|
+
focused = "editor";
|
|
20868
|
+
get userInputWithCursor() {
|
|
20869
|
+
if (this.state === "submit") return this.userInput;
|
|
20870
|
+
const t = this.userInput;
|
|
20871
|
+
if (this.cursor >= t.length) return `${t}\u2588`;
|
|
20872
|
+
const s = t.slice(0, this.cursor), r = t.slice(this.cursor, this.cursor + 1), i = t.slice(this.cursor + 1);
|
|
20873
|
+
return r === `
|
|
20874
|
+
` ? `${s}\u2588
|
|
20875
|
+
${i}` : `${s}${styleText("inverse", r)}${i}`;
|
|
20876
|
+
}
|
|
20877
|
+
get cursor() {
|
|
20878
|
+
return this._cursor;
|
|
20879
|
+
}
|
|
20880
|
+
#r(t) {
|
|
20881
|
+
if (this.userInput.length === 0) {
|
|
20882
|
+
this._setUserInput(t);
|
|
20883
|
+
return;
|
|
20884
|
+
}
|
|
20885
|
+
this._setUserInput(this.userInput.slice(0, this.cursor) + t + this.userInput.slice(this.cursor));
|
|
20886
|
+
}
|
|
20887
|
+
#i(t) {
|
|
20888
|
+
const s = this.value ?? "";
|
|
20889
|
+
switch (t) {
|
|
20890
|
+
case "up":
|
|
20891
|
+
this._cursor = findTextCursor(this._cursor, 0, -1, s);
|
|
20892
|
+
return;
|
|
20893
|
+
case "down":
|
|
20894
|
+
this._cursor = findTextCursor(this._cursor, 0, 1, s);
|
|
20895
|
+
return;
|
|
20896
|
+
case "left":
|
|
20897
|
+
this._cursor = findTextCursor(this._cursor, -1, 0, s);
|
|
20898
|
+
return;
|
|
20899
|
+
case "right":
|
|
20900
|
+
this._cursor = findTextCursor(this._cursor, 1, 0, s);
|
|
20901
|
+
return;
|
|
20902
|
+
}
|
|
20903
|
+
}
|
|
20904
|
+
_shouldSubmit(t, s) {
|
|
20905
|
+
if (this.#s) return this.focused === "submit" ? true : (this.#r(`
|
|
20906
|
+
`), this._cursor++, false);
|
|
20907
|
+
const r = this.#t;
|
|
20908
|
+
return this.#t = true, r && this.cursor === this.userInput.length ? (this.userInput[this.cursor - 1] === `
|
|
20909
|
+
` && (this._setUserInput(this.userInput.slice(0, this.cursor - 1) + this.userInput.slice(this.cursor)), this._cursor--), true) : (this.#r(`
|
|
20910
|
+
`), this._cursor++, false);
|
|
20911
|
+
}
|
|
20912
|
+
constructor(t) {
|
|
20913
|
+
const s = t.initialUserInput ?? t.initialValue;
|
|
20914
|
+
super({
|
|
20915
|
+
...t,
|
|
20916
|
+
initialUserInput: s
|
|
20917
|
+
}, false), s !== void 0 && (this._cursor = s.length), this.#s = t.showSubmit ?? false, this.on("key", (r, i) => {
|
|
20918
|
+
if (i?.name && o$1.has(i.name)) {
|
|
20919
|
+
this.#t = false, this.#i(i.name);
|
|
20920
|
+
return;
|
|
20921
|
+
}
|
|
20922
|
+
if (r === " " && this.#s) {
|
|
20923
|
+
this.focused = this.focused === "editor" ? "submit" : "editor";
|
|
20924
|
+
return;
|
|
20925
|
+
}
|
|
20926
|
+
if (i?.name !== "return") {
|
|
20927
|
+
if (this.#t = false, i?.name === "backspace" && this.cursor > 0) {
|
|
20928
|
+
this._setUserInput(this.userInput.slice(0, this.cursor - 1) + this.userInput.slice(this.cursor)), this._cursor--;
|
|
20929
|
+
return;
|
|
20930
|
+
}
|
|
20931
|
+
if (i?.name === "delete" && this.cursor < this.userInput.length) {
|
|
20932
|
+
this._setUserInput(this.userInput.slice(0, this.cursor) + this.userInput.slice(this.cursor + 1));
|
|
20933
|
+
return;
|
|
20934
|
+
}
|
|
20935
|
+
r && (this.#s && this.focused === "submit" && (this.focused = "editor"), this.#r(r ?? ""), this._cursor++);
|
|
20936
|
+
}
|
|
20937
|
+
}), this.on("userInput", (r) => {
|
|
20938
|
+
this._setValue(r);
|
|
20939
|
+
}), this.on("finalize", () => {
|
|
20940
|
+
this.value || (this.value = t.defaultValue), this.value === void 0 && (this.value = "");
|
|
20941
|
+
});
|
|
20942
|
+
}
|
|
20943
|
+
};
|
|
20944
|
+
var a$1 = class extends V$1 {
|
|
20395
20945
|
options;
|
|
20396
20946
|
cursor = 0;
|
|
20397
20947
|
get _value() {
|
|
20398
|
-
return this.options[this.cursor]
|
|
20948
|
+
return this.options[this.cursor]?.value;
|
|
20399
20949
|
}
|
|
20400
20950
|
get _enabledOptions() {
|
|
20401
|
-
return this.options.filter((e) => e.disabled !==
|
|
20951
|
+
return this.options.filter((e) => e.disabled !== true);
|
|
20402
20952
|
}
|
|
20403
20953
|
toggleAll() {
|
|
20404
20954
|
const e = this._enabledOptions;
|
|
20405
|
-
this.value = this.value !== void 0 && this.value.length === e.length ? [] : e.map((
|
|
20955
|
+
this.value = this.value !== void 0 && this.value.length === e.length ? [] : e.map((t) => t.value);
|
|
20406
20956
|
}
|
|
20407
20957
|
toggleInvert() {
|
|
20408
20958
|
const e = this.value;
|
|
20409
20959
|
if (!e) return;
|
|
20410
|
-
this.value = this._enabledOptions.filter((
|
|
20960
|
+
this.value = this._enabledOptions.filter((t) => !e.includes(t.value)).map((t) => t.value);
|
|
20411
20961
|
}
|
|
20412
20962
|
toggleValue() {
|
|
20413
20963
|
this.value === void 0 && (this.value = []);
|
|
20414
|
-
this.value = this.value.includes(this._value) ? this.value.filter((
|
|
20964
|
+
this.value = this.value.includes(this._value) ? this.value.filter((i) => i !== this._value) : [...this.value, this._value];
|
|
20415
20965
|
}
|
|
20416
20966
|
constructor(e) {
|
|
20417
|
-
super(e,
|
|
20418
|
-
const
|
|
20419
|
-
this.cursor = this.options[
|
|
20420
|
-
|
|
20421
|
-
}), this.on("cursor", (
|
|
20422
|
-
switch (
|
|
20967
|
+
super(e, false), this.options = e.options, this.value = [...e.initialValues ?? []];
|
|
20968
|
+
const i = Math.max(this.options.findIndex(({ value: t }) => t === e.cursorAt), 0);
|
|
20969
|
+
this.cursor = this.options[i]?.disabled ? findCursor(i, 1, this.options) : i, this.on("key", (t, l) => {
|
|
20970
|
+
l.name === "a" && this.toggleAll(), l.name === "i" && this.toggleInvert();
|
|
20971
|
+
}), this.on("cursor", (t) => {
|
|
20972
|
+
switch (t) {
|
|
20423
20973
|
case "left":
|
|
20424
20974
|
case "up":
|
|
20425
|
-
this.cursor =
|
|
20975
|
+
this.cursor = findCursor(this.cursor, -1, this.options);
|
|
20426
20976
|
break;
|
|
20427
20977
|
case "down":
|
|
20428
20978
|
case "right":
|
|
20429
|
-
this.cursor =
|
|
20979
|
+
this.cursor = findCursor(this.cursor, 1, this.options);
|
|
20430
20980
|
break;
|
|
20431
20981
|
case "space":
|
|
20432
20982
|
this.toggleValue();
|
|
@@ -20435,7 +20985,7 @@ var Lt$2 = class extends x$1 {
|
|
|
20435
20985
|
});
|
|
20436
20986
|
}
|
|
20437
20987
|
};
|
|
20438
|
-
let
|
|
20988
|
+
let u$1$1 = class u extends V$1 {
|
|
20439
20989
|
_mask = "•";
|
|
20440
20990
|
get cursor() {
|
|
20441
20991
|
return this._cursor;
|
|
@@ -20445,858 +20995,879 @@ let Mt$2 = class extends x$1 {
|
|
|
20445
20995
|
}
|
|
20446
20996
|
get userInputWithCursor() {
|
|
20447
20997
|
if (this.state === "submit" || this.state === "cancel") return this.masked;
|
|
20448
|
-
const
|
|
20449
|
-
if (this.cursor >=
|
|
20450
|
-
const s = this.masked,
|
|
20451
|
-
return `${
|
|
20998
|
+
const t = this.userInput;
|
|
20999
|
+
if (this.cursor >= t.length) return `${this.masked}${styleText(["inverse", "hidden"], "_")}`;
|
|
21000
|
+
const s = this.masked, r = s.slice(0, this.cursor), i = s.slice(this.cursor, this.cursor + 1), o = s.slice(this.cursor + 1);
|
|
21001
|
+
return `${r}${styleText("inverse", i)}${o}`;
|
|
20452
21002
|
}
|
|
20453
21003
|
clear() {
|
|
20454
21004
|
this._clearUserInput();
|
|
20455
21005
|
}
|
|
20456
|
-
constructor({ mask:
|
|
20457
|
-
super(s), this._mask =
|
|
20458
|
-
this._setValue(
|
|
21006
|
+
constructor({ mask: t, ...s }) {
|
|
21007
|
+
super(s), this._mask = t ?? "•", this.on("userInput", (r) => {
|
|
21008
|
+
this._setValue(r);
|
|
21009
|
+
}), this.on("finalize", () => {
|
|
21010
|
+
this.value === void 0 && (this.value = "");
|
|
20459
21011
|
});
|
|
20460
21012
|
}
|
|
20461
21013
|
};
|
|
20462
|
-
|
|
21014
|
+
let n$1 = class n extends V$1 {
|
|
20463
21015
|
options;
|
|
20464
21016
|
cursor = 0;
|
|
20465
21017
|
get _selectedValue() {
|
|
20466
21018
|
return this.options[this.cursor];
|
|
20467
21019
|
}
|
|
20468
21020
|
changeValue() {
|
|
20469
|
-
|
|
21021
|
+
const e = this._selectedValue;
|
|
21022
|
+
this.value = e === void 0 ? void 0 : e.value;
|
|
20470
21023
|
}
|
|
20471
21024
|
constructor(e) {
|
|
20472
|
-
super(e,
|
|
20473
|
-
const
|
|
20474
|
-
this.cursor = this.options[
|
|
20475
|
-
switch (
|
|
21025
|
+
super(e, false), this.options = e.options;
|
|
21026
|
+
const o = this.options.findIndex(({ value: s }) => s === e.initialValue), t = o === -1 ? 0 : o;
|
|
21027
|
+
this.cursor = this.options[t]?.disabled ? findCursor(t, 1, this.options) : t, this.changeValue(), this.on("cursor", (s) => {
|
|
21028
|
+
switch (s) {
|
|
20476
21029
|
case "left":
|
|
20477
21030
|
case "up":
|
|
20478
|
-
this.cursor =
|
|
21031
|
+
this.cursor = findCursor(this.cursor, -1, this.options);
|
|
20479
21032
|
break;
|
|
20480
21033
|
case "down":
|
|
20481
21034
|
case "right":
|
|
20482
|
-
this.cursor =
|
|
21035
|
+
this.cursor = findCursor(this.cursor, 1, this.options);
|
|
20483
21036
|
break;
|
|
20484
21037
|
}
|
|
20485
21038
|
this.changeValue();
|
|
20486
21039
|
});
|
|
20487
21040
|
}
|
|
20488
21041
|
};
|
|
20489
|
-
var
|
|
21042
|
+
var u$3 = class extends V$1 {
|
|
20490
21043
|
options;
|
|
20491
21044
|
cursor = 0;
|
|
20492
|
-
constructor(
|
|
20493
|
-
super(
|
|
20494
|
-
const s =
|
|
20495
|
-
this.cursor = Math.max(i.indexOf(
|
|
20496
|
-
if (!
|
|
20497
|
-
const
|
|
20498
|
-
if (!i.includes(
|
|
20499
|
-
const
|
|
20500
|
-
|
|
21045
|
+
constructor(t) {
|
|
21046
|
+
super(t, false), this.options = t.options;
|
|
21047
|
+
const s = t.caseSensitive === true, i = this.options.map(({ value: [e] }) => s ? e : e?.toLowerCase());
|
|
21048
|
+
this.cursor = Math.max(i.indexOf(t.initialValue), 0), this.on("key", (e) => {
|
|
21049
|
+
if (!e) return;
|
|
21050
|
+
const o = s ? e : e.toLowerCase();
|
|
21051
|
+
if (!i.includes(o)) return;
|
|
21052
|
+
const n = this.options.find(({ value: [r] }) => s ? r === o : r?.toLowerCase() === o);
|
|
21053
|
+
n && (this.value = n.value, this.state = "submit", this.emit("submit"));
|
|
20501
21054
|
});
|
|
20502
21055
|
}
|
|
20503
21056
|
};
|
|
20504
|
-
var $
|
|
21057
|
+
var n$2 = class extends V$1 {
|
|
20505
21058
|
get userInputWithCursor() {
|
|
20506
21059
|
if (this.state === "submit") return this.userInput;
|
|
20507
|
-
const
|
|
20508
|
-
if (this.cursor >=
|
|
20509
|
-
const
|
|
20510
|
-
return `${
|
|
21060
|
+
const t = this.userInput;
|
|
21061
|
+
if (this.cursor >= t.length) return `${this.userInput}\u2588`;
|
|
21062
|
+
const r = t.slice(0, this.cursor), s = t.slice(this.cursor, this.cursor + 1), e = t.slice(this.cursor + 1);
|
|
21063
|
+
return `${r}${styleText("inverse", s)}${e}`;
|
|
20511
21064
|
}
|
|
20512
21065
|
get cursor() {
|
|
20513
21066
|
return this._cursor;
|
|
20514
21067
|
}
|
|
20515
|
-
constructor(
|
|
21068
|
+
constructor(t) {
|
|
20516
21069
|
super({
|
|
20517
|
-
...
|
|
20518
|
-
initialUserInput:
|
|
20519
|
-
}), this.on("userInput", (
|
|
20520
|
-
this._setValue(
|
|
21070
|
+
...t,
|
|
21071
|
+
initialUserInput: t.initialUserInput ?? t.initialValue
|
|
21072
|
+
}), this.on("userInput", (r) => {
|
|
21073
|
+
this._setValue(r);
|
|
20521
21074
|
}), this.on("finalize", () => {
|
|
20522
|
-
this.value || (this.value =
|
|
21075
|
+
this.value || (this.value = t.defaultValue), this.value === void 0 && (this.value = "");
|
|
20523
21076
|
});
|
|
20524
21077
|
}
|
|
20525
21078
|
};
|
|
20526
21079
|
//#endregion
|
|
20527
|
-
//#region ../../node_modules/.pnpm/@clack+prompts@1.0
|
|
21080
|
+
//#region ../../node_modules/.pnpm/@clack+prompts@1.7.0/node_modules/@clack/prompts/dist/index.mjs
|
|
20528
21081
|
var dist_exports = /* @__PURE__ */ __exportAll({
|
|
20529
|
-
|
|
20530
|
-
|
|
20531
|
-
|
|
20532
|
-
|
|
20533
|
-
|
|
20534
|
-
|
|
20535
|
-
|
|
20536
|
-
|
|
20537
|
-
|
|
20538
|
-
|
|
20539
|
-
|
|
20540
|
-
|
|
20541
|
-
|
|
20542
|
-
|
|
20543
|
-
|
|
20544
|
-
|
|
20545
|
-
|
|
20546
|
-
|
|
20547
|
-
|
|
20548
|
-
|
|
20549
|
-
|
|
20550
|
-
|
|
20551
|
-
|
|
20552
|
-
|
|
20553
|
-
|
|
20554
|
-
|
|
20555
|
-
|
|
20556
|
-
|
|
20557
|
-
|
|
20558
|
-
|
|
20559
|
-
|
|
20560
|
-
|
|
20561
|
-
|
|
20562
|
-
|
|
20563
|
-
|
|
20564
|
-
|
|
20565
|
-
|
|
20566
|
-
|
|
20567
|
-
|
|
20568
|
-
|
|
20569
|
-
|
|
20570
|
-
|
|
20571
|
-
|
|
20572
|
-
|
|
20573
|
-
|
|
20574
|
-
|
|
20575
|
-
|
|
20576
|
-
|
|
20577
|
-
|
|
20578
|
-
|
|
20579
|
-
|
|
20580
|
-
|
|
20581
|
-
|
|
20582
|
-
|
|
20583
|
-
|
|
20584
|
-
|
|
20585
|
-
|
|
21082
|
+
MULTISELECT_INSTRUCTIONS: () => MULTISELECT_INSTRUCTIONS,
|
|
21083
|
+
SELECT_INSTRUCTIONS: () => SELECT_INSTRUCTIONS,
|
|
21084
|
+
S_BAR: () => S_BAR,
|
|
21085
|
+
S_BAR_END: () => S_BAR_END,
|
|
21086
|
+
S_BAR_END_RIGHT: () => S_BAR_END_RIGHT,
|
|
21087
|
+
S_BAR_H: () => S_BAR_H,
|
|
21088
|
+
S_BAR_START: () => S_BAR_START,
|
|
21089
|
+
S_BAR_START_RIGHT: () => S_BAR_START_RIGHT,
|
|
21090
|
+
S_CHECKBOX_ACTIVE: () => S_CHECKBOX_ACTIVE,
|
|
21091
|
+
S_CHECKBOX_INACTIVE: () => S_CHECKBOX_INACTIVE,
|
|
21092
|
+
S_CHECKBOX_SELECTED: () => S_CHECKBOX_SELECTED,
|
|
21093
|
+
S_CONNECT_LEFT: () => S_CONNECT_LEFT,
|
|
21094
|
+
S_CORNER_BOTTOM_LEFT: () => S_CORNER_BOTTOM_LEFT,
|
|
21095
|
+
S_CORNER_BOTTOM_RIGHT: () => S_CORNER_BOTTOM_RIGHT,
|
|
21096
|
+
S_CORNER_TOP_LEFT: () => S_CORNER_TOP_LEFT,
|
|
21097
|
+
S_CORNER_TOP_RIGHT: () => S_CORNER_TOP_RIGHT,
|
|
21098
|
+
S_ERROR: () => S_ERROR,
|
|
21099
|
+
S_INFO: () => S_INFO,
|
|
21100
|
+
S_PASSWORD_MASK: () => S_PASSWORD_MASK,
|
|
21101
|
+
S_RADIO_ACTIVE: () => S_RADIO_ACTIVE,
|
|
21102
|
+
S_RADIO_INACTIVE: () => S_RADIO_INACTIVE,
|
|
21103
|
+
S_STEP_ACTIVE: () => S_STEP_ACTIVE,
|
|
21104
|
+
S_STEP_CANCEL: () => S_STEP_CANCEL,
|
|
21105
|
+
S_STEP_ERROR: () => S_STEP_ERROR,
|
|
21106
|
+
S_STEP_SUBMIT: () => S_STEP_SUBMIT,
|
|
21107
|
+
S_SUCCESS: () => S_SUCCESS,
|
|
21108
|
+
S_WARN: () => S_WARN,
|
|
21109
|
+
autocomplete: () => autocomplete,
|
|
21110
|
+
autocompleteMultiselect: () => autocompleteMultiselect,
|
|
21111
|
+
box: () => box,
|
|
21112
|
+
cancel: () => cancel,
|
|
21113
|
+
confirm: () => confirm,
|
|
21114
|
+
date: () => date,
|
|
21115
|
+
formatInstructionFooter: () => formatInstructionFooter,
|
|
21116
|
+
group: () => group,
|
|
21117
|
+
groupMultiselect: () => groupMultiselect,
|
|
21118
|
+
intro: () => intro,
|
|
21119
|
+
isCI: () => isCI,
|
|
21120
|
+
isCancel: () => isCancel,
|
|
21121
|
+
isTTY: () => isTTY,
|
|
21122
|
+
limitOptions: () => limitOptions,
|
|
21123
|
+
log: () => log$1,
|
|
21124
|
+
multiline: () => multiline,
|
|
21125
|
+
multiselect: () => multiselect,
|
|
21126
|
+
note: () => note,
|
|
21127
|
+
outro: () => outro,
|
|
21128
|
+
password: () => password,
|
|
21129
|
+
path: () => path$5,
|
|
21130
|
+
progress: () => progress$1,
|
|
21131
|
+
select: () => select,
|
|
21132
|
+
selectKey: () => selectKey,
|
|
21133
|
+
settings: () => settings,
|
|
21134
|
+
spinner: () => spinner$1,
|
|
21135
|
+
stream: () => stream,
|
|
21136
|
+
symbol: () => symbol,
|
|
21137
|
+
symbolBar: () => symbolBar,
|
|
21138
|
+
taskLog: () => taskLog,
|
|
21139
|
+
tasks: () => tasks$1,
|
|
21140
|
+
text: () => text,
|
|
21141
|
+
unicode: () => unicode,
|
|
21142
|
+
unicodeOr: () => unicodeOr,
|
|
21143
|
+
updateSettings: () => updateSettings
|
|
20586
21144
|
});
|
|
20587
|
-
function
|
|
20588
|
-
|
|
21145
|
+
function isUnicodeSupported$1() {
|
|
21146
|
+
if (process$1.platform !== "win32") return process$1.env.TERM !== "linux";
|
|
21147
|
+
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";
|
|
20589
21148
|
}
|
|
20590
|
-
const
|
|
20591
|
-
switch (
|
|
21149
|
+
const unicode = isUnicodeSupported$1(), isCI = () => process.env.CI === "true", isTTY = (o) => o.isTTY === true, unicodeOr = (o, e) => unicode ? o : e, S_STEP_ACTIVE = unicodeOr("◆", "*"), S_STEP_CANCEL = unicodeOr("■", "x"), S_STEP_ERROR = unicodeOr("▲", "x"), S_STEP_SUBMIT = unicodeOr("◇", "o"), S_BAR_START = unicodeOr("┌", "T"), S_BAR = unicodeOr("│", "|"), S_BAR_END = unicodeOr("└", "—"), S_BAR_START_RIGHT = unicodeOr("┐", "T"), S_BAR_END_RIGHT = unicodeOr("┘", "—"), S_RADIO_ACTIVE = unicodeOr("●", ">"), S_RADIO_INACTIVE = unicodeOr("○", " "), S_CHECKBOX_ACTIVE = unicodeOr("◻", "[•]"), S_CHECKBOX_SELECTED = unicodeOr("◼", "[+]"), S_CHECKBOX_INACTIVE = unicodeOr("◻", "[ ]"), S_PASSWORD_MASK = unicodeOr("▪", "•"), S_BAR_H = unicodeOr("─", "-"), S_CORNER_TOP_RIGHT = unicodeOr("╮", "+"), S_CONNECT_LEFT = unicodeOr("├", "+"), S_CORNER_BOTTOM_RIGHT = unicodeOr("╯", "+"), S_CORNER_BOTTOM_LEFT = unicodeOr("╰", "+"), S_CORNER_TOP_LEFT = unicodeOr("╭", "+"), S_INFO = unicodeOr("●", "•"), S_SUCCESS = unicodeOr("◆", "*"), S_WARN = unicodeOr("▲", "!"), S_ERROR = unicodeOr("■", "x"), symbol = (o) => {
|
|
21150
|
+
switch (o) {
|
|
20592
21151
|
case "initial":
|
|
20593
|
-
case "active": return
|
|
20594
|
-
case "cancel": return
|
|
20595
|
-
case "error": return
|
|
20596
|
-
case "submit": return
|
|
21152
|
+
case "active": return styleText("cyan", S_STEP_ACTIVE);
|
|
21153
|
+
case "cancel": return styleText("red", S_STEP_CANCEL);
|
|
21154
|
+
case "error": return styleText("yellow", S_STEP_ERROR);
|
|
21155
|
+
case "submit": return styleText("green", S_STEP_SUBMIT);
|
|
20597
21156
|
}
|
|
20598
|
-
},
|
|
20599
|
-
switch (
|
|
21157
|
+
}, symbolBar = (o) => {
|
|
21158
|
+
switch (o) {
|
|
20600
21159
|
case "initial":
|
|
20601
|
-
case "active": return
|
|
20602
|
-
case "cancel": return
|
|
20603
|
-
case "error": return
|
|
20604
|
-
case "submit": return
|
|
21160
|
+
case "active": return styleText("cyan", S_BAR);
|
|
21161
|
+
case "cancel": return styleText("red", S_BAR);
|
|
21162
|
+
case "error": return styleText("yellow", S_BAR);
|
|
21163
|
+
case "submit": return styleText("green", S_BAR);
|
|
20605
21164
|
}
|
|
20606
|
-
}
|
|
20607
|
-
|
|
20608
|
-
|
|
20609
|
-
|
|
20610
|
-
const i = r.limit ?? Infinity, a = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (a ? jt$1(a, ye$1, s).width : 0), u = s.ansiWidth ?? 0, l = s.controlWidth ?? 0, n = s.tabWidth ?? 8, c = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, F = s.fullWidthWidth ?? 2, p = s.regularWidth ?? 1, E = s.wideWidth ?? 2;
|
|
20611
|
-
let $ = 0, m = 0, h = t.length, y = 0, f = !1, v = h, S = Math.max(0, i - o), I = 0, B = 0, A = 0, w = 0;
|
|
20612
|
-
t: for (;;) {
|
|
20613
|
-
if (B > I || m >= h && m > $) {
|
|
20614
|
-
const _ = t.slice(I, B) || t.slice($, m);
|
|
20615
|
-
y = 0;
|
|
20616
|
-
for (const D of _.replaceAll(Fe$1, "")) {
|
|
20617
|
-
const T = D.codePointAt(0) || 0;
|
|
20618
|
-
if (ge$1(T) ? w = F : fe$1(T) ? w = E : c !== p && pe$1(T) ? w = c : w = p, A + w > S && (v = Math.min(v, Math.max(I, $) + y)), A + w > i) {
|
|
20619
|
-
f = !0;
|
|
20620
|
-
break t;
|
|
20621
|
-
}
|
|
20622
|
-
y += D.length, A += w;
|
|
20623
|
-
}
|
|
20624
|
-
I = B = 0;
|
|
20625
|
-
}
|
|
20626
|
-
if (m >= h) break;
|
|
20627
|
-
if (at$1.lastIndex = m, at$1.test(t)) {
|
|
20628
|
-
if (y = at$1.lastIndex - m, w = y * p, A + w > S && (v = Math.min(v, m + Math.floor((S - A) / p))), A + w > i) {
|
|
20629
|
-
f = !0;
|
|
20630
|
-
break;
|
|
20631
|
-
}
|
|
20632
|
-
A += w, I = $, B = m, m = $ = at$1.lastIndex;
|
|
20633
|
-
continue;
|
|
20634
|
-
}
|
|
20635
|
-
if (At$1.lastIndex = m, At$1.test(t)) {
|
|
20636
|
-
if (A + u > S && (v = Math.min(v, m)), A + u > i) {
|
|
20637
|
-
f = !0;
|
|
20638
|
-
break;
|
|
20639
|
-
}
|
|
20640
|
-
A += u, I = $, B = m, m = $ = At$1.lastIndex;
|
|
20641
|
-
continue;
|
|
20642
|
-
}
|
|
20643
|
-
if (it$1.lastIndex = m, it$1.test(t)) {
|
|
20644
|
-
if (y = it$1.lastIndex - m, w = y * l, A + w > S && (v = Math.min(v, m + Math.floor((S - A) / l))), A + w > i) {
|
|
20645
|
-
f = !0;
|
|
20646
|
-
break;
|
|
20647
|
-
}
|
|
20648
|
-
A += w, I = $, B = m, m = $ = it$1.lastIndex;
|
|
20649
|
-
continue;
|
|
20650
|
-
}
|
|
20651
|
-
if (nt$1.lastIndex = m, nt$1.test(t)) {
|
|
20652
|
-
if (y = nt$1.lastIndex - m, w = y * n, A + w > S && (v = Math.min(v, m + Math.floor((S - A) / n))), A + w > i) {
|
|
20653
|
-
f = !0;
|
|
20654
|
-
break;
|
|
20655
|
-
}
|
|
20656
|
-
A += w, I = $, B = m, m = $ = nt$1.lastIndex;
|
|
20657
|
-
continue;
|
|
20658
|
-
}
|
|
20659
|
-
if (wt$1.lastIndex = m, wt$1.test(t)) {
|
|
20660
|
-
if (A + g > S && (v = Math.min(v, m)), A + g > i) {
|
|
20661
|
-
f = !0;
|
|
20662
|
-
break;
|
|
20663
|
-
}
|
|
20664
|
-
A += g, I = $, B = m, m = $ = wt$1.lastIndex;
|
|
20665
|
-
continue;
|
|
20666
|
-
}
|
|
20667
|
-
m += 1;
|
|
20668
|
-
}
|
|
20669
|
-
return {
|
|
20670
|
-
width: f ? S : A,
|
|
20671
|
-
index: f ? v : h,
|
|
20672
|
-
truncated: f,
|
|
20673
|
-
ellipsed: f && i >= o
|
|
20674
|
-
};
|
|
20675
|
-
}, Ee = {
|
|
20676
|
-
limit: Infinity,
|
|
20677
|
-
ellipsis: "",
|
|
20678
|
-
ellipsisWidth: 0
|
|
20679
|
-
}, M$1 = (t, r = {}) => jt$1(t, Ee, r).width, ot$2 = "\x1B", Gt$1 = "", ve$1 = 39, Ct$1 = "\x07", kt$1 = "[", Ae$1 = "]", Vt$1 = "m", St$1 = `${Ae$1}8;;`, Ht$1 = new RegExp(`(?:\\${kt$1}(?<code>\\d+)m|\\${St$1}(?<uri>.*)${Ct$1})`, "y"), we$1 = (t) => {
|
|
20680
|
-
if (t >= 30 && t <= 37 || t >= 90 && t <= 97) return 39;
|
|
20681
|
-
if (t >= 40 && t <= 47 || t >= 100 && t <= 107) return 49;
|
|
20682
|
-
if (t === 1 || t === 2) return 22;
|
|
20683
|
-
if (t === 3) return 23;
|
|
20684
|
-
if (t === 4) return 24;
|
|
20685
|
-
if (t === 7) return 27;
|
|
20686
|
-
if (t === 8) return 28;
|
|
20687
|
-
if (t === 9) return 29;
|
|
20688
|
-
if (t === 0) return 0;
|
|
20689
|
-
}, Ut$1 = (t) => `${ot$2}${kt$1}${t}${Vt$1}`, Kt = (t) => `${ot$2}${St$1}${t}${Ct$1}`, Ce$1 = (t) => t.map((r) => M$1(r)), It$1 = (t, r, s) => {
|
|
20690
|
-
const i = r[Symbol.iterator]();
|
|
20691
|
-
let a = !1, o = !1, u = t.at(-1), l = u === void 0 ? 0 : M$1(u), n = i.next(), c = i.next(), g = 0;
|
|
20692
|
-
for (; !n.done;) {
|
|
20693
|
-
const F = n.value, p = M$1(F);
|
|
20694
|
-
l + p <= s ? t[t.length - 1] += F : (t.push(F), l = 0), (F === ot$2 || F === Gt$1) && (a = !0, o = r.startsWith(St$1, g + 1)), a ? o ? F === Ct$1 && (a = !1, o = !1) : F === Vt$1 && (a = !1) : (l += p, l === s && !c.done && (t.push(""), l = 0)), n = c, c = i.next(), g += F.length;
|
|
20695
|
-
}
|
|
20696
|
-
u = t.at(-1), !l && u !== void 0 && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
|
|
20697
|
-
}, Se$1 = (t) => {
|
|
20698
|
-
const r = t.split(" ");
|
|
20699
|
-
let s = r.length;
|
|
20700
|
-
for (; s > 0 && !(M$1(r[s - 1]) > 0);) s--;
|
|
20701
|
-
return s === r.length ? t : r.slice(0, s).join(" ") + r.slice(s).join("");
|
|
20702
|
-
}, Ie$1 = (t, r, s = {}) => {
|
|
20703
|
-
if (s.trim !== !1 && t.trim() === "") return "";
|
|
20704
|
-
let i = "", a, o;
|
|
20705
|
-
const u = t.split(" "), l = Ce$1(u);
|
|
20706
|
-
let n = [""];
|
|
20707
|
-
for (const [$, m] of u.entries()) {
|
|
20708
|
-
s.trim !== !1 && (n[n.length - 1] = (n.at(-1) ?? "").trimStart());
|
|
20709
|
-
let h = M$1(n.at(-1) ?? "");
|
|
20710
|
-
if ($ !== 0 && (h >= r && (s.wordWrap === !1 || s.trim === !1) && (n.push(""), h = 0), (h > 0 || s.trim === !1) && (n[n.length - 1] += " ", h++)), s.hard && l[$] > r) {
|
|
20711
|
-
const y = r - h, f = 1 + Math.floor((l[$] - y - 1) / r);
|
|
20712
|
-
Math.floor((l[$] - 1) / r) < f && n.push(""), It$1(n, m, r);
|
|
20713
|
-
continue;
|
|
20714
|
-
}
|
|
20715
|
-
if (h + l[$] > r && h > 0 && l[$] > 0) {
|
|
20716
|
-
if (s.wordWrap === !1 && h < r) {
|
|
20717
|
-
It$1(n, m, r);
|
|
20718
|
-
continue;
|
|
20719
|
-
}
|
|
20720
|
-
n.push("");
|
|
20721
|
-
}
|
|
20722
|
-
if (h + l[$] > r && s.wordWrap === !1) {
|
|
20723
|
-
It$1(n, m, r);
|
|
20724
|
-
continue;
|
|
20725
|
-
}
|
|
20726
|
-
n[n.length - 1] += m;
|
|
20727
|
-
}
|
|
20728
|
-
s.trim !== !1 && (n = n.map(($) => Se$1($)));
|
|
20729
|
-
const c = n.join(`
|
|
20730
|
-
`), g = c[Symbol.iterator]();
|
|
20731
|
-
let F = g.next(), p = g.next(), E = 0;
|
|
20732
|
-
for (; !F.done;) {
|
|
20733
|
-
const $ = F.value, m = p.value;
|
|
20734
|
-
if (i += $, $ === ot$2 || $ === Gt$1) {
|
|
20735
|
-
Ht$1.lastIndex = E + 1;
|
|
20736
|
-
const f = Ht$1.exec(c)?.groups;
|
|
20737
|
-
if (f?.code !== void 0) {
|
|
20738
|
-
const v = Number.parseFloat(f.code);
|
|
20739
|
-
a = v === ve$1 ? void 0 : v;
|
|
20740
|
-
} else f?.uri !== void 0 && (o = f.uri.length === 0 ? void 0 : f.uri);
|
|
20741
|
-
}
|
|
20742
|
-
const h = a ? we$1(a) : void 0;
|
|
20743
|
-
m === `
|
|
20744
|
-
` ? (o && (i += Kt("")), a && h && (i += Ut$1(h))) : $ === `
|
|
20745
|
-
` && (a && h && (i += Ut$1(a)), o && (i += Kt(o))), E += $.length, F = p, p = g.next();
|
|
20746
|
-
}
|
|
20747
|
-
return i;
|
|
20748
|
-
};
|
|
20749
|
-
function J$1(t, r, s) {
|
|
20750
|
-
return String(t).normalize().replaceAll(`\r
|
|
20751
|
-
`, `
|
|
20752
|
-
`).split(`
|
|
20753
|
-
`).map((i) => Ie$1(i, r, s)).join(`
|
|
20754
|
-
`);
|
|
21165
|
+
};
|
|
21166
|
+
function formatInstructionFooter(o, e) {
|
|
21167
|
+
const r = [`${e ? `${styleText("cyan", S_BAR)} ` : ""}${o.join(" • ")}`];
|
|
21168
|
+
return e && r.push(styleText("cyan", S_BAR_END)), r;
|
|
20755
21169
|
}
|
|
20756
|
-
const
|
|
20757
|
-
let
|
|
20758
|
-
for (let
|
|
20759
|
-
const
|
|
20760
|
-
if (
|
|
21170
|
+
const I = (l, e, w, p, b, C = false) => {
|
|
21171
|
+
let r = e, O = 0;
|
|
21172
|
+
if (C) for (let i = p - 1; i >= w; i--) {
|
|
21173
|
+
const m = l[i];
|
|
21174
|
+
if (m && (r -= m.length), O++, r <= b) break;
|
|
21175
|
+
}
|
|
21176
|
+
else for (let i = w; i < p; i++) {
|
|
21177
|
+
const m = l[i];
|
|
21178
|
+
if (m && (r -= m.length), O++, r <= b) break;
|
|
20761
21179
|
}
|
|
20762
21180
|
return {
|
|
20763
|
-
lineCount:
|
|
20764
|
-
removals:
|
|
20765
|
-
};
|
|
20766
|
-
}
|
|
20767
|
-
|
|
20768
|
-
|
|
20769
|
-
|
|
20770
|
-
|
|
20771
|
-
|
|
20772
|
-
|
|
20773
|
-
|
|
20774
|
-
|
|
20775
|
-
|
|
20776
|
-
|
|
20777
|
-
|
|
20778
|
-
|
|
21181
|
+
lineCount: r,
|
|
21182
|
+
removals: O
|
|
21183
|
+
};
|
|
21184
|
+
};
|
|
21185
|
+
const limitOptions = ({ cursor: l, options: e, style: w, output: p = process.stdout, maxItems: b = Number.POSITIVE_INFINITY, columnPadding: C = 0, rowPadding: r = 4 }) => {
|
|
21186
|
+
const i = getColumns(p) - C, m = getRows(p), M = styleText("dim", "..."), v = Math.max(m - r, 0), a = Math.max(Math.min(b, v), 5);
|
|
21187
|
+
let f = 0;
|
|
21188
|
+
l >= a - 3 && (f = Math.max(Math.min(l - a + 3, e.length - a), 0));
|
|
21189
|
+
let d = a < e.length && f > 0, c = a < e.length && f + a < e.length;
|
|
21190
|
+
const W = Math.min(f + a, e.length), s = [];
|
|
21191
|
+
let g = 0;
|
|
21192
|
+
d && g++, c && g++;
|
|
21193
|
+
const T = f + (d ? 1 : 0), y = W - (c ? 1 : 0);
|
|
21194
|
+
for (let t = T; t < y; t++) {
|
|
21195
|
+
const n = e[t], h = wrapAnsi$1(n ? w(n, t === l) : "", i, {
|
|
21196
|
+
hard: true,
|
|
21197
|
+
trim: false
|
|
20779
21198
|
}).split(`
|
|
20780
21199
|
`);
|
|
20781
|
-
|
|
21200
|
+
s.push(h), g += h.length;
|
|
20782
21201
|
}
|
|
20783
|
-
if (
|
|
20784
|
-
let
|
|
20785
|
-
const
|
|
20786
|
-
|
|
21202
|
+
if (g > v) {
|
|
21203
|
+
let t = 0, n = 0, o = g;
|
|
21204
|
+
const h = l - T;
|
|
21205
|
+
let u = v;
|
|
21206
|
+
const L = () => I(s, o, 0, h, u), E = () => I(s, o, h + 1, s.length, u, true);
|
|
21207
|
+
d ? ({lineCount: o, removals: t} = L(), o > u && (c || (u -= 1), {lineCount: o, removals: n} = E())) : (c || (u -= 1), {lineCount: o, removals: n} = E(), o > u && (u -= 1, {lineCount: o, removals: t} = L())), t > 0 && (d = true, s.splice(0, t)), n > 0 && (c = true, s.splice(s.length - n, n));
|
|
20787
21208
|
}
|
|
20788
|
-
const
|
|
20789
|
-
|
|
20790
|
-
for (const
|
|
20791
|
-
return
|
|
21209
|
+
const x = [];
|
|
21210
|
+
d && x.push(M);
|
|
21211
|
+
for (const t of s) for (const n of t) x.push(n);
|
|
21212
|
+
return c && x.push(M), x;
|
|
20792
21213
|
};
|
|
20793
|
-
function
|
|
21214
|
+
function P$1(t) {
|
|
20794
21215
|
return t.label ?? String(t.value ?? "");
|
|
20795
21216
|
}
|
|
20796
|
-
function
|
|
20797
|
-
if (!t) return
|
|
20798
|
-
const
|
|
20799
|
-
return
|
|
21217
|
+
function E(t, c) {
|
|
21218
|
+
if (!t) return true;
|
|
21219
|
+
const n = (c.label ?? String(c.value ?? "")).toLowerCase(), i = (c.hint ?? "").toLowerCase(), l = String(c.value).toLowerCase(), o = t.toLowerCase();
|
|
21220
|
+
return n.includes(o) || i.includes(o) || l.includes(o);
|
|
20800
21221
|
}
|
|
20801
|
-
function
|
|
20802
|
-
const
|
|
20803
|
-
for (const i of
|
|
20804
|
-
return
|
|
21222
|
+
function N(t, c) {
|
|
21223
|
+
const n = [];
|
|
21224
|
+
for (const i of c) t.includes(i.value) && n.push(i);
|
|
21225
|
+
return n;
|
|
20805
21226
|
}
|
|
20806
|
-
const
|
|
21227
|
+
const autocomplete = (t) => new T$1({
|
|
20807
21228
|
options: t.options,
|
|
20808
21229
|
initialValue: t.initialValue ? [t.initialValue] : void 0,
|
|
20809
21230
|
initialUserInput: t.initialUserInput,
|
|
20810
|
-
|
|
21231
|
+
placeholder: t.placeholder,
|
|
21232
|
+
filter: t.filter ?? ((n, i) => E(n, i)),
|
|
20811
21233
|
signal: t.signal,
|
|
20812
21234
|
input: t.input,
|
|
20813
21235
|
output: t.output,
|
|
20814
21236
|
validate: t.validate,
|
|
20815
21237
|
render() {
|
|
20816
|
-
const
|
|
20817
|
-
const
|
|
20818
|
-
switch (
|
|
20819
|
-
case "active": return `${
|
|
20820
|
-
case "inactive": return `${
|
|
20821
|
-
case "disabled": return `${
|
|
21238
|
+
const n = t.withGuide ?? settings.withGuide, i = n ? [`${styleText("gray", S_BAR)}`, `${symbol(this.state)} ${t.message}`] : [`${symbol(this.state)} ${t.message}`], l = this.userInput, o = this.options, m = t.placeholder, p = l === "" && m !== void 0, $ = (r, s) => {
|
|
21239
|
+
const a = P$1(r), u = r.hint && r.value === this.focusedValue ? styleText("dim", ` (${r.hint})`) : "";
|
|
21240
|
+
switch (s) {
|
|
21241
|
+
case "active": return `${styleText("green", S_RADIO_ACTIVE)} ${a}${u}`;
|
|
21242
|
+
case "inactive": return `${styleText("dim", S_RADIO_INACTIVE)} ${styleText("dim", a)}`;
|
|
21243
|
+
case "disabled": return `${styleText("gray", S_RADIO_INACTIVE)} ${styleText(["strikethrough", "gray"], a)}`;
|
|
20822
21244
|
}
|
|
20823
21245
|
};
|
|
20824
21246
|
switch (this.state) {
|
|
20825
21247
|
case "submit": {
|
|
20826
|
-
const
|
|
20827
|
-
return `${
|
|
21248
|
+
const r = N(this.selectedValues, o), s = r.length > 0 ? ` ${styleText("dim", r.map(P$1).join(", "))}` : "", a = n ? styleText("gray", S_BAR) : "";
|
|
21249
|
+
return `${i.join(`
|
|
20828
21250
|
`)}
|
|
20829
|
-
${
|
|
21251
|
+
${a}${s}`;
|
|
20830
21252
|
}
|
|
20831
21253
|
case "cancel": {
|
|
20832
|
-
const
|
|
20833
|
-
return `${
|
|
21254
|
+
const r = l ? ` ${styleText(["strikethrough", "dim"], l)}` : "", s = n ? styleText("gray", S_BAR) : "";
|
|
21255
|
+
return `${i.join(`
|
|
20834
21256
|
`)}
|
|
20835
|
-
${
|
|
21257
|
+
${s}${r}`;
|
|
20836
21258
|
}
|
|
20837
21259
|
default: {
|
|
20838
|
-
const
|
|
20839
|
-
let
|
|
20840
|
-
if (this.isNavigating ||
|
|
20841
|
-
const
|
|
20842
|
-
|
|
20843
|
-
} else
|
|
20844
|
-
const
|
|
20845
|
-
|
|
20846
|
-
const
|
|
20847
|
-
`${
|
|
20848
|
-
`${
|
|
20849
|
-
`${
|
|
20850
|
-
].join(" • ")}`,
|
|
21260
|
+
const r = this.state === "error" ? "yellow" : "cyan", s = n ? `${styleText(r, S_BAR)} ` : "", a = n ? styleText(r, S_BAR_END) : "";
|
|
21261
|
+
let u = "";
|
|
21262
|
+
if (this.isNavigating || p) {
|
|
21263
|
+
const d = p ? m : l;
|
|
21264
|
+
u = d !== "" ? ` ${styleText("dim", d)}` : "";
|
|
21265
|
+
} else u = ` ${this.userInputWithCursor}`;
|
|
21266
|
+
const V = this.filteredOptions.length !== o.length ? styleText("dim", ` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`) : "", y = this.filteredOptions.length === 0 && l ? [`${s}${styleText("yellow", "No matches found")}`] : [], b = this.state === "error" ? [`${s}${styleText("yellow", this.error)}`] : [];
|
|
21267
|
+
n && i.push(`${s.trimEnd()}`), i.push(`${s}${styleText("dim", "Search:")}${u}${V}`, ...y, ...b);
|
|
21268
|
+
const g = [`${s}${[
|
|
21269
|
+
`${styleText("dim", "↑/↓")} to select`,
|
|
21270
|
+
`${styleText("dim", "Enter:")} confirm`,
|
|
21271
|
+
`${styleText("dim", "Type:")} to search`
|
|
21272
|
+
].join(" • ")}`, a], O = this.filteredOptions.length === 0 ? [] : limitOptions({
|
|
20851
21273
|
cursor: this.cursor,
|
|
20852
21274
|
options: this.filteredOptions,
|
|
20853
|
-
columnPadding:
|
|
20854
|
-
rowPadding:
|
|
20855
|
-
style: (
|
|
21275
|
+
columnPadding: n ? 3 : 0,
|
|
21276
|
+
rowPadding: i.length + g.length,
|
|
21277
|
+
style: (d, f) => $(d, d.disabled ? "disabled" : f ? "active" : "inactive"),
|
|
20856
21278
|
maxItems: t.maxItems,
|
|
20857
21279
|
output: t.output
|
|
20858
21280
|
});
|
|
20859
21281
|
return [
|
|
20860
|
-
...
|
|
20861
|
-
...
|
|
20862
|
-
...
|
|
21282
|
+
...i,
|
|
21283
|
+
...O.map((d) => `${s}${d}`),
|
|
21284
|
+
...g
|
|
20863
21285
|
].join(`
|
|
20864
21286
|
`);
|
|
20865
21287
|
}
|
|
20866
21288
|
}
|
|
20867
21289
|
}
|
|
20868
|
-
}).prompt(),
|
|
20869
|
-
const
|
|
20870
|
-
const
|
|
20871
|
-
return i.disabled ? `${
|
|
20872
|
-
},
|
|
21290
|
+
}).prompt(), autocompleteMultiselect = (t) => {
|
|
21291
|
+
const c = (i, l, o, m) => {
|
|
21292
|
+
const p = o.includes(i.value), $ = i.label ?? String(i.value ?? ""), r = i.hint && m !== void 0 && i.value === m ? styleText("dim", ` (${i.hint})`) : "", s = p ? styleText("green", S_CHECKBOX_SELECTED) : styleText("dim", S_CHECKBOX_INACTIVE);
|
|
21293
|
+
return i.disabled ? `${styleText("gray", S_CHECKBOX_INACTIVE)} ${styleText(["strikethrough", "gray"], $)}` : l ? `${s} ${$}${r}` : `${s} ${styleText("dim", $)}`;
|
|
21294
|
+
}, n = new T$1({
|
|
20873
21295
|
options: t.options,
|
|
20874
|
-
multiple:
|
|
20875
|
-
|
|
21296
|
+
multiple: true,
|
|
21297
|
+
placeholder: t.placeholder,
|
|
21298
|
+
filter: t.filter ?? ((i, l) => E(i, l)),
|
|
20876
21299
|
validate: () => {
|
|
20877
|
-
if (t.required &&
|
|
21300
|
+
if (t.required && n.selectedValues.length === 0) return "Please select at least one item";
|
|
20878
21301
|
},
|
|
20879
21302
|
initialValue: t.initialValues,
|
|
20880
21303
|
signal: t.signal,
|
|
20881
21304
|
input: t.input,
|
|
20882
21305
|
output: t.output,
|
|
20883
21306
|
render() {
|
|
20884
|
-
const i = `${
|
|
20885
|
-
${
|
|
20886
|
-
`,
|
|
21307
|
+
const i = t.withGuide ?? settings.withGuide, l = `${i ? `${styleText("gray", S_BAR)}
|
|
21308
|
+
` : ""}${symbol(this.state)} ${t.message}
|
|
21309
|
+
`, o = this.userInput, m = t.placeholder, p = o === "" && m !== void 0, $ = this.isNavigating || p ? styleText("dim", p ? m : o) : this.userInputWithCursor, r = this.options, s = this.filteredOptions.length !== r.length ? styleText("dim", ` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`) : "";
|
|
20887
21310
|
switch (this.state) {
|
|
20888
|
-
case "submit": return `${
|
|
20889
|
-
case "cancel": return `${
|
|
21311
|
+
case "submit": return `${l}${i ? `${styleText("gray", S_BAR)} ` : ""}${styleText("dim", `${this.selectedValues.length} items selected`)}`;
|
|
21312
|
+
case "cancel": return `${l}${i ? `${styleText("gray", S_BAR)} ` : ""}${styleText(["strikethrough", "dim"], o)}`;
|
|
20890
21313
|
default: {
|
|
20891
|
-
const
|
|
20892
|
-
`${
|
|
20893
|
-
`${
|
|
20894
|
-
`${
|
|
20895
|
-
`${
|
|
20896
|
-
],
|
|
20897
|
-
...`${
|
|
21314
|
+
const a = this.state === "error" ? "yellow" : "cyan", u = i ? `${styleText(a, S_BAR)} ` : "", V = i ? styleText(a, S_BAR_END) : "", y = [
|
|
21315
|
+
`${styleText("dim", "↑/↓")} to navigate`,
|
|
21316
|
+
`${styleText("dim", this.isNavigating ? "Space/Tab:" : "Tab:")} select`,
|
|
21317
|
+
`${styleText("dim", "Enter:")} confirm`,
|
|
21318
|
+
`${styleText("dim", "Type:")} to search`
|
|
21319
|
+
], b = this.filteredOptions.length === 0 && o ? [`${u}${styleText("yellow", "No matches found")}`] : [], v = this.state === "error" ? [`${u}${styleText("yellow", this.error)}`] : [], g = [
|
|
21320
|
+
...`${l}${i ? styleText(a, S_BAR) : ""}`.split(`
|
|
20898
21321
|
`),
|
|
20899
|
-
`${
|
|
20900
|
-
...
|
|
20901
|
-
...
|
|
20902
|
-
],
|
|
21322
|
+
`${u}${styleText("dim", "Search:")} ${$}${s}`,
|
|
21323
|
+
...b,
|
|
21324
|
+
...v
|
|
21325
|
+
], O = [`${u}${y.join(" • ")}`, V], d = limitOptions({
|
|
20903
21326
|
cursor: this.cursor,
|
|
20904
21327
|
options: this.filteredOptions,
|
|
20905
|
-
style: (
|
|
21328
|
+
style: (f, _) => c(f, _, this.selectedValues, this.focusedValue),
|
|
20906
21329
|
maxItems: t.maxItems,
|
|
20907
21330
|
output: t.output,
|
|
20908
|
-
rowPadding:
|
|
21331
|
+
rowPadding: g.length + O.length
|
|
20909
21332
|
});
|
|
20910
21333
|
return [
|
|
20911
|
-
|
|
20912
|
-
...
|
|
20913
|
-
...
|
|
21334
|
+
...g,
|
|
21335
|
+
...d.map((f) => `${u}${f}`),
|
|
21336
|
+
...O
|
|
20914
21337
|
].join(`
|
|
20915
21338
|
`);
|
|
20916
21339
|
}
|
|
20917
21340
|
}
|
|
20918
21341
|
}
|
|
20919
21342
|
});
|
|
20920
|
-
return
|
|
20921
|
-
}
|
|
20922
|
-
|
|
20923
|
-
|
|
20924
|
-
|
|
20925
|
-
|
|
20926
|
-
|
|
20927
|
-
|
|
20928
|
-
|
|
20929
|
-
|
|
20930
|
-
|
|
21343
|
+
return n.prompt();
|
|
21344
|
+
};
|
|
21345
|
+
const J$1 = [
|
|
21346
|
+
S_CORNER_TOP_LEFT,
|
|
21347
|
+
S_CORNER_TOP_RIGHT,
|
|
21348
|
+
S_CORNER_BOTTOM_LEFT,
|
|
21349
|
+
S_CORNER_BOTTOM_RIGHT
|
|
21350
|
+
], K$1 = [
|
|
21351
|
+
S_BAR_START,
|
|
21352
|
+
S_BAR_START_RIGHT,
|
|
21353
|
+
S_BAR_END,
|
|
21354
|
+
S_BAR_END_RIGHT
|
|
20931
21355
|
];
|
|
20932
|
-
function
|
|
20933
|
-
let
|
|
20934
|
-
return
|
|
21356
|
+
function A$1(n, e, t, o) {
|
|
21357
|
+
let i = t, f = t;
|
|
21358
|
+
return o === "center" ? i = Math.floor((e - n) / 2) : o === "right" && (i = e - n - t), f = e - i - n, [i, f];
|
|
20935
21359
|
}
|
|
20936
|
-
const
|
|
20937
|
-
|
|
20938
|
-
|
|
20939
|
-
|
|
20940
|
-
|
|
21360
|
+
const Q$1 = (n) => n;
|
|
21361
|
+
const box = (n = "", e = "", t) => {
|
|
21362
|
+
const o = t?.output ?? process.stdout, i = getColumns(o), R = 2, u = t?.titlePadding ?? 1, h = t?.contentPadding ?? 2, w = t?.width === void 0 || t.width === "auto" ? 1 : Math.min(1, t.width), m = t?.withGuide ?? settings.withGuide ? `${S_BAR} ` : "", b = t?.formatBorder ?? Q$1, a = (t?.rounded ? J$1 : K$1).map(b), _ = b(S_BAR_H), B = b(S_BAR), p = fastStringWidth(m), x = fastStringWidth(e), O = i - p;
|
|
21363
|
+
let r = Math.floor(i * w) - p;
|
|
21364
|
+
if (t?.width === "auto") {
|
|
21365
|
+
const c = n.split(`
|
|
20941
21366
|
`);
|
|
20942
|
-
let
|
|
20943
|
-
for (const
|
|
20944
|
-
const
|
|
20945
|
-
|
|
20946
|
-
}
|
|
20947
|
-
const
|
|
20948
|
-
|
|
20949
|
-
}
|
|
20950
|
-
|
|
20951
|
-
const
|
|
20952
|
-
hard:
|
|
20953
|
-
trim:
|
|
21367
|
+
let s = x + u * 2;
|
|
21368
|
+
for (const G of c) {
|
|
21369
|
+
const P = fastStringWidth(G) + h * 2;
|
|
21370
|
+
P > s && (s = P);
|
|
21371
|
+
}
|
|
21372
|
+
const g = s + R;
|
|
21373
|
+
g < r && (r = g);
|
|
21374
|
+
}
|
|
21375
|
+
r % 2 !== 0 && (r < O ? r++ : r--);
|
|
21376
|
+
const d = r - R, S = d - u * 2, T = x > S ? `${e.slice(0, S - 3)}...` : e, [y, W] = A$1(fastStringWidth(T), d, u, t?.titleAlign), L = wrapAnsi$1(n, d - h * 2, {
|
|
21377
|
+
hard: true,
|
|
21378
|
+
trim: false
|
|
20954
21379
|
});
|
|
20955
|
-
|
|
21380
|
+
o.write(`${m}${a[0]}${_.repeat(y)}${T}${_.repeat(W)}${a[1]}
|
|
20956
21381
|
`);
|
|
20957
|
-
const
|
|
21382
|
+
const E = L.split(`
|
|
20958
21383
|
`);
|
|
20959
|
-
for (const
|
|
20960
|
-
const [
|
|
20961
|
-
|
|
21384
|
+
for (const c of E) {
|
|
21385
|
+
const [s, g] = A$1(fastStringWidth(c), d, h, t?.contentAlign);
|
|
21386
|
+
o.write(`${m}${B}${" ".repeat(s)}${c}${" ".repeat(g)}${B}
|
|
20962
21387
|
`);
|
|
20963
21388
|
}
|
|
20964
|
-
|
|
21389
|
+
o.write(`${m}${a[2]}${_.repeat(d)}${a[3]}
|
|
20965
21390
|
`);
|
|
20966
|
-
}
|
|
20967
|
-
|
|
20968
|
-
|
|
20969
|
-
|
|
21391
|
+
};
|
|
21392
|
+
const confirm = (i) => {
|
|
21393
|
+
const a = i.active ?? "Yes", s = i.inactive ?? "No";
|
|
21394
|
+
return new r({
|
|
21395
|
+
active: a,
|
|
20970
21396
|
inactive: s,
|
|
20971
|
-
signal:
|
|
20972
|
-
input:
|
|
20973
|
-
output:
|
|
20974
|
-
initialValue:
|
|
21397
|
+
signal: i.signal,
|
|
21398
|
+
input: i.input,
|
|
21399
|
+
output: i.output,
|
|
21400
|
+
initialValue: i.initialValue ?? true,
|
|
20975
21401
|
render() {
|
|
20976
|
-
const
|
|
20977
|
-
` : ""}${
|
|
20978
|
-
`,
|
|
21402
|
+
const e = i.withGuide ?? settings.withGuide, u = `${symbol(this.state)} `, l = e ? `${styleText("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(i.output, i.message, l, u), o = `${e ? `${styleText("gray", S_BAR)}
|
|
21403
|
+
` : ""}${f}
|
|
21404
|
+
`, c = this.value ? a : s;
|
|
20979
21405
|
switch (this.state) {
|
|
20980
|
-
case "submit": return `${
|
|
20981
|
-
case "cancel": return `${
|
|
20982
|
-
${
|
|
21406
|
+
case "submit": return `${o}${e ? `${styleText("gray", S_BAR)} ` : ""}${styleText("dim", c)}`;
|
|
21407
|
+
case "cancel": return `${o}${e ? `${styleText("gray", S_BAR)} ` : ""}${styleText(["strikethrough", "dim"], c)}${e ? `
|
|
21408
|
+
${styleText("gray", S_BAR)}` : ""}`;
|
|
20983
21409
|
default: {
|
|
20984
|
-
const
|
|
20985
|
-
return `${
|
|
20986
|
-
${
|
|
20987
|
-
` : ` ${
|
|
20988
|
-
${
|
|
21410
|
+
const r = e ? `${styleText("cyan", S_BAR)} ` : "", g = e ? styleText("cyan", S_BAR_END) : "";
|
|
21411
|
+
return `${o}${r}${this.value ? `${styleText("green", S_RADIO_ACTIVE)} ${a}` : `${styleText("dim", S_RADIO_INACTIVE)} ${styleText("dim", a)}`}${i.vertical ? e ? `
|
|
21412
|
+
${styleText("cyan", S_BAR)} ` : `
|
|
21413
|
+
` : ` ${styleText("dim", "/")} `}${this.value ? `${styleText("dim", S_RADIO_INACTIVE)} ${styleText("dim", s)}` : `${styleText("green", S_RADIO_ACTIVE)} ${s}`}
|
|
21414
|
+
${g}
|
|
21415
|
+
`;
|
|
21416
|
+
}
|
|
21417
|
+
}
|
|
21418
|
+
}
|
|
21419
|
+
}).prompt();
|
|
21420
|
+
};
|
|
21421
|
+
const date = (e) => {
|
|
21422
|
+
const r = e.validate;
|
|
21423
|
+
return new U$1({
|
|
21424
|
+
...e,
|
|
21425
|
+
validate(t) {
|
|
21426
|
+
if (t === void 0) return e.defaultValue !== void 0 ? void 0 : r ? runValidation(r, t) : settings.date.messages.required;
|
|
21427
|
+
const o = (i) => i.toISOString().slice(0, 10);
|
|
21428
|
+
if (e.minDate && o(t) < o(e.minDate)) return settings.date.messages.afterMin(e.minDate);
|
|
21429
|
+
if (e.maxDate && o(t) > o(e.maxDate)) return settings.date.messages.beforeMax(e.maxDate);
|
|
21430
|
+
if (r) return runValidation(r, t);
|
|
21431
|
+
},
|
|
21432
|
+
render() {
|
|
21433
|
+
const t = (e?.withGuide ?? settings.withGuide) !== false, i = `${`${t ? `${styleText("gray", S_BAR)}
|
|
21434
|
+
` : ""}${symbol(this.state)} `}${e.message}
|
|
21435
|
+
`, l = this.state !== "initial" ? this.state : "active", d = b$1(this, l), c = this.value instanceof Date ? this.formattedValue : "";
|
|
21436
|
+
switch (this.state) {
|
|
21437
|
+
case "error": {
|
|
21438
|
+
const a = this.error ? ` ${styleText("yellow", this.error)}` : "", s = t ? `${styleText("yellow", S_BAR)} ` : "", f = t ? styleText("yellow", S_BAR_END) : "";
|
|
21439
|
+
return `${i.trim()}
|
|
21440
|
+
${s}${d}
|
|
21441
|
+
${f}${a}
|
|
21442
|
+
`;
|
|
21443
|
+
}
|
|
21444
|
+
case "submit": {
|
|
21445
|
+
const a = c ? ` ${styleText("dim", c)}` : "";
|
|
21446
|
+
return `${i}${t ? styleText("gray", S_BAR) : ""}${a}`;
|
|
21447
|
+
}
|
|
21448
|
+
case "cancel": {
|
|
21449
|
+
const a = c ? ` ${styleText(["strikethrough", "dim"], c)}` : "", s = t ? styleText("gray", S_BAR) : "";
|
|
21450
|
+
return `${i}${s}${a}${c.trim() ? `
|
|
21451
|
+
${s}` : ""}`;
|
|
21452
|
+
}
|
|
21453
|
+
default: {
|
|
21454
|
+
const a = t ? `${styleText("cyan", S_BAR)} ` : "", s = t ? styleText("cyan", S_BAR_END) : "", f = t ? `${styleText("cyan", S_BAR)} ` : "";
|
|
21455
|
+
return `${i}${a}${d}${this.inlineError ? `
|
|
21456
|
+
${f}${styleText("yellow", this.inlineError)}` : ""}
|
|
21457
|
+
${s}
|
|
20989
21458
|
`;
|
|
20990
21459
|
}
|
|
20991
21460
|
}
|
|
20992
21461
|
}
|
|
20993
21462
|
}).prompt();
|
|
20994
|
-
}
|
|
20995
|
-
|
|
20996
|
-
|
|
20997
|
-
|
|
20998
|
-
|
|
21463
|
+
};
|
|
21464
|
+
function b$1(e, r) {
|
|
21465
|
+
const t = e.segmentValues, o = e.segmentCursor;
|
|
21466
|
+
if (r === "submit" || r === "cancel") return e.formattedValue;
|
|
21467
|
+
const i = styleText("gray", e.separator);
|
|
21468
|
+
return e.segments.map((l, d) => {
|
|
21469
|
+
const c = d === o.segmentIndex && !["submit", "cancel"].includes(r), a = p$2[l.type];
|
|
21470
|
+
return x(t[l.type], {
|
|
21471
|
+
isActive: c,
|
|
21472
|
+
label: a
|
|
20999
21473
|
});
|
|
21000
|
-
|
|
21001
|
-
|
|
21474
|
+
}).join(i);
|
|
21475
|
+
}
|
|
21476
|
+
function x(e, r) {
|
|
21477
|
+
const t = !e || e.replace(/_/g, "") === "";
|
|
21478
|
+
return r.isActive ? styleText("inverse", t ? r.label : e.replace(/_/g, " ")) : t ? styleText("dim", r.label) : e.replace(/_/g, styleText("dim", " "));
|
|
21479
|
+
}
|
|
21480
|
+
const p$2 = {
|
|
21481
|
+
year: "yyyy",
|
|
21482
|
+
month: "mm",
|
|
21483
|
+
day: "dd"
|
|
21484
|
+
};
|
|
21485
|
+
const group = async (o, r) => {
|
|
21486
|
+
const t = {}, p = Object.keys(o);
|
|
21487
|
+
for (const e of p) {
|
|
21488
|
+
const i = o[e], n = await i({ results: t })?.catch((a) => {
|
|
21489
|
+
throw a;
|
|
21490
|
+
});
|
|
21491
|
+
if (typeof r?.onCancel == "function" && isCancel(n)) {
|
|
21492
|
+
t[e] = "canceled", r.onCancel({ results: t });
|
|
21002
21493
|
continue;
|
|
21003
21494
|
}
|
|
21004
|
-
|
|
21005
|
-
}
|
|
21006
|
-
return
|
|
21007
|
-
}
|
|
21008
|
-
|
|
21009
|
-
|
|
21010
|
-
|
|
21011
|
-
|
|
21012
|
-
|
|
21013
|
-
$
|
|
21014
|
-
|
|
21015
|
-
|
|
21016
|
-
|
|
21017
|
-
|
|
21018
|
-
|
|
21019
|
-
|
|
21020
|
-
|
|
21021
|
-
|
|
21022
|
-
|
|
21023
|
-
|
|
21024
|
-
|
|
21025
|
-
|
|
21026
|
-
|
|
21027
|
-
|
|
21028
|
-
|
|
21029
|
-
|
|
21030
|
-
|
|
21031
|
-
|
|
21032
|
-
|
|
21033
|
-
|
|
21034
|
-
|
|
21035
|
-
|
|
21036
|
-
cursorAt: t.cursorAt,
|
|
21037
|
-
selectableGroups: r,
|
|
21038
|
-
validate(o) {
|
|
21039
|
-
if (a && (o === void 0 || o.length === 0)) return `Please select at least one option.
|
|
21040
|
-
${import_picocolors.default.reset(import_picocolors.default.dim(`Press ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" space ")))} to select, ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" enter ")))} to submit`))}`;
|
|
21495
|
+
t[e] = n;
|
|
21496
|
+
}
|
|
21497
|
+
return t;
|
|
21498
|
+
};
|
|
21499
|
+
const MULTISELECT_INSTRUCTIONS = [
|
|
21500
|
+
`${styleText("dim", "↑/↓")} to navigate`,
|
|
21501
|
+
`${styleText("dim", "Space:")} select`,
|
|
21502
|
+
`${styleText("dim", "Enter:")} confirm`
|
|
21503
|
+
];
|
|
21504
|
+
const m$1 = (i, u) => i.split(`
|
|
21505
|
+
`).map((d) => u(d)).join(`
|
|
21506
|
+
`);
|
|
21507
|
+
const multiselect = (i) => {
|
|
21508
|
+
const u = (t, a) => {
|
|
21509
|
+
const r = t.label ?? String(t.value);
|
|
21510
|
+
return a === "disabled" ? `${styleText("gray", S_CHECKBOX_INACTIVE)} ${m$1(r, (o) => styleText(["strikethrough", "gray"], o))}${t.hint ? ` ${styleText("dim", `(${t.hint ?? "disabled"})`)}` : ""}` : a === "active" ? `${styleText("cyan", S_CHECKBOX_ACTIVE)} ${r}${t.hint ? ` ${styleText("dim", `(${t.hint})`)}` : ""}` : a === "selected" ? `${styleText("green", S_CHECKBOX_SELECTED)} ${m$1(r, (o) => styleText("dim", o))}${t.hint ? ` ${styleText("dim", `(${t.hint})`)}` : ""}` : a === "cancelled" ? `${m$1(r, (o) => styleText(["strikethrough", "dim"], o))}` : a === "active-selected" ? `${styleText("green", S_CHECKBOX_SELECTED)} ${r}${t.hint ? ` ${styleText("dim", `(${t.hint})`)}` : ""}` : a === "submitted" ? `${m$1(r, (o) => styleText("dim", o))}` : `${styleText("dim", S_CHECKBOX_INACTIVE)} ${m$1(r, (o) => styleText("dim", o))}`;
|
|
21511
|
+
}, d = i.required ?? true, v = i.showInstructions ?? true;
|
|
21512
|
+
return new a$1({
|
|
21513
|
+
options: i.options,
|
|
21514
|
+
signal: i.signal,
|
|
21515
|
+
input: i.input,
|
|
21516
|
+
output: i.output,
|
|
21517
|
+
initialValues: i.initialValues,
|
|
21518
|
+
required: d,
|
|
21519
|
+
cursorAt: i.cursorAt,
|
|
21520
|
+
validate(t) {
|
|
21521
|
+
if (d && (t === void 0 || t.length === 0)) return `Please select at least one option.
|
|
21522
|
+
${styleText("reset", styleText("dim", `Press ${styleText([
|
|
21523
|
+
"gray",
|
|
21524
|
+
"bgWhite",
|
|
21525
|
+
"inverse"
|
|
21526
|
+
], " space ")} to select, ${styleText("gray", styleText("bgWhite", styleText("inverse", " enter ")))} to submit`))}`;
|
|
21041
21527
|
},
|
|
21042
21528
|
render() {
|
|
21043
|
-
const
|
|
21044
|
-
|
|
21045
|
-
`,
|
|
21529
|
+
const t = i.withGuide ?? settings.withGuide, a = wrapTextWithPrefix(i.output, i.message, t ? `${symbolBar(this.state)} ` : "", `${symbol(this.state)} `), r = `${t ? `${styleText("gray", S_BAR)}
|
|
21530
|
+
` : ""}${a}
|
|
21531
|
+
`, o = this.value ?? [], p = (n, l) => {
|
|
21532
|
+
if (n.disabled) return u(n, "disabled");
|
|
21533
|
+
const s = o.includes(n.value);
|
|
21534
|
+
return l && s ? u(n, "active-selected") : s ? u(n, "selected") : u(n, l ? "active" : "inactive");
|
|
21535
|
+
};
|
|
21046
21536
|
switch (this.state) {
|
|
21047
21537
|
case "submit": {
|
|
21048
|
-
const
|
|
21049
|
-
return `${
|
|
21538
|
+
const n = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u(s, "submitted")).join(styleText("dim", ", ")) || styleText("dim", "none");
|
|
21539
|
+
return `${r}${wrapTextWithPrefix(i.output, n, t ? `${styleText("gray", S_BAR)} ` : "")}`;
|
|
21050
21540
|
}
|
|
21051
21541
|
case "cancel": {
|
|
21052
|
-
const
|
|
21053
|
-
|
|
21054
|
-
${
|
|
21542
|
+
const n = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u(s, "cancelled")).join(styleText("dim", ", "));
|
|
21543
|
+
if (n.trim() === "") return `${r}${styleText("gray", S_BAR)}`;
|
|
21544
|
+
return `${r}${wrapTextWithPrefix(i.output, n, t ? `${styleText("gray", S_BAR)} ` : "")}${t ? `
|
|
21545
|
+
${styleText("gray", S_BAR)}` : ""}`;
|
|
21055
21546
|
}
|
|
21056
21547
|
case "error": {
|
|
21057
|
-
const l = this.error.split(`
|
|
21058
|
-
`).map((
|
|
21059
|
-
`)
|
|
21060
|
-
|
|
21061
|
-
|
|
21062
|
-
|
|
21548
|
+
const n = t ? `${styleText("yellow", S_BAR)} ` : "", l = this.error.split(`
|
|
21549
|
+
`).map(($, C) => C === 0 ? `${t ? `${styleText("yellow", S_BAR_END)} ` : ""}${styleText("yellow", $)}` : ` ${$}`).join(`
|
|
21550
|
+
`), s = r.split(`
|
|
21551
|
+
`).length, h = l.split(`
|
|
21552
|
+
`).length + 1;
|
|
21553
|
+
return `${r}${n}${limitOptions({
|
|
21554
|
+
output: i.output,
|
|
21555
|
+
options: this.options,
|
|
21556
|
+
cursor: this.cursor,
|
|
21557
|
+
maxItems: i.maxItems,
|
|
21558
|
+
columnPadding: n.length,
|
|
21559
|
+
rowPadding: s + h,
|
|
21560
|
+
style: p
|
|
21063
21561
|
}).join(`
|
|
21064
|
-
${
|
|
21562
|
+
${n}`)}
|
|
21065
21563
|
${l}
|
|
21066
21564
|
`;
|
|
21067
21565
|
}
|
|
21068
21566
|
default: {
|
|
21069
|
-
const
|
|
21070
|
-
|
|
21071
|
-
|
|
21072
|
-
|
|
21073
|
-
|
|
21567
|
+
const n = t ? `${styleText("cyan", S_BAR)} ` : "", l = r.split(`
|
|
21568
|
+
`).length, s = v ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, t) : t ? [styleText("cyan", S_BAR_END)] : [], h = s.join(`
|
|
21569
|
+
`), $ = s.length + 1;
|
|
21570
|
+
return `${r}${n}${limitOptions({
|
|
21571
|
+
output: i.output,
|
|
21572
|
+
options: this.options,
|
|
21573
|
+
cursor: this.cursor,
|
|
21574
|
+
maxItems: i.maxItems,
|
|
21575
|
+
columnPadding: n.length,
|
|
21576
|
+
rowPadding: l + $,
|
|
21577
|
+
style: p
|
|
21578
|
+
}).join(`
|
|
21579
|
+
${n}`)}
|
|
21580
|
+
${h}
|
|
21581
|
+
`;
|
|
21582
|
+
}
|
|
21583
|
+
}
|
|
21584
|
+
}
|
|
21585
|
+
}).prompt();
|
|
21586
|
+
};
|
|
21587
|
+
const groupMultiselect = (o) => {
|
|
21588
|
+
const { selectableGroups: h = true, groupSpacing: x = 0 } = o, m = (n, l, g = []) => {
|
|
21589
|
+
const a = n.label ?? String(n.value), t = typeof n.group == "string", s = t && (g[g.indexOf(n) + 1] ?? { group: true }), u = t && s && s.group === true;
|
|
21590
|
+
let r = "", c = "";
|
|
21591
|
+
t && (h ? (r = u ? `${S_BAR_END} ` : `${S_BAR} `, c = u ? " " : `${S_BAR} `) : r = " ");
|
|
21592
|
+
let i = "";
|
|
21593
|
+
if (x > 0 && !t && (i = `
|
|
21594
|
+
`.repeat(x)), l === "active") return wrapTextWithPrefix(o.output, `${a}${n.hint ? ` ${styleText("dim", `(${n.hint})`)}` : ""}`, `${i}${styleText("dim", r)} `, `${i}${styleText("dim", r)}${styleText("cyan", S_CHECKBOX_ACTIVE)} `, `${i}${styleText("dim", c)} `);
|
|
21595
|
+
if (l === "group-active") return wrapTextWithPrefix(o.output, a, `${i}${r} `, `${i}${r}${styleText("cyan", S_CHECKBOX_ACTIVE)} `, `${i}${c} `, (d) => styleText("dim", d));
|
|
21596
|
+
if (l === "group-active-selected") return wrapTextWithPrefix(o.output, a, `${i}${r} `, `${i}${r}${styleText("green", S_CHECKBOX_SELECTED)} `, `${i}${c} `, (d) => styleText("dim", d));
|
|
21597
|
+
if (l === "selected") {
|
|
21598
|
+
const d = t || h ? styleText("green", S_CHECKBOX_SELECTED) : "";
|
|
21599
|
+
return wrapTextWithPrefix(o.output, `${a}${n.hint ? ` (${n.hint})` : ""}`, `${i}${styleText("dim", r)} `, `${i}${styleText("dim", r)}${d} `, `${i}${styleText("dim", c)} `, (S) => styleText("dim", S));
|
|
21600
|
+
}
|
|
21601
|
+
if (l === "cancelled") return `${styleText(["strikethrough", "dim"], a)}`;
|
|
21602
|
+
if (l === "active-selected") return wrapTextWithPrefix(o.output, `${a}${n.hint ? ` ${styleText("dim", `(${n.hint})`)}` : ""}`, `${i}${styleText("dim", r)} `, `${i}${styleText("dim", r)}${styleText("green", S_CHECKBOX_SELECTED)} `, `${i}${styleText("dim", c)} `);
|
|
21603
|
+
if (l === "submitted") return `${styleText("dim", a)}`;
|
|
21604
|
+
const f = t || h ? styleText("dim", S_CHECKBOX_INACTIVE) : "";
|
|
21605
|
+
return wrapTextWithPrefix(o.output, a, `${i}${styleText("dim", r)} `, `${i}${styleText("dim", r)}${f} `, `${i}${styleText("dim", c)} `, (d) => styleText("dim", d));
|
|
21606
|
+
}, y = o.required ?? true, I = o.showInstructions ?? true;
|
|
21607
|
+
return new u$2({
|
|
21608
|
+
options: o.options,
|
|
21609
|
+
signal: o.signal,
|
|
21610
|
+
input: o.input,
|
|
21611
|
+
output: o.output,
|
|
21612
|
+
initialValues: o.initialValues,
|
|
21613
|
+
required: y,
|
|
21614
|
+
cursorAt: o.cursorAt,
|
|
21615
|
+
selectableGroups: h,
|
|
21616
|
+
validate(n) {
|
|
21617
|
+
if (y && (n === void 0 || n.length === 0)) return `Please select at least one option.
|
|
21618
|
+
${styleText("reset", styleText("dim", `Press ${styleText([
|
|
21619
|
+
"gray",
|
|
21620
|
+
"bgWhite",
|
|
21621
|
+
"inverse"
|
|
21622
|
+
], " space ")} to select, ${styleText("gray", styleText(["bgWhite", "inverse"], " enter "))} to submit`))}`;
|
|
21623
|
+
},
|
|
21624
|
+
render() {
|
|
21625
|
+
const n = o.withGuide ?? settings.withGuide, l = `${n ? `${styleText("gray", S_BAR)}
|
|
21626
|
+
` : ""}${symbol(this.state)} ${o.message}
|
|
21627
|
+
`, g = this.value ?? [], a = (t, s) => {
|
|
21628
|
+
const u = this.options, r = g.includes(t.value) || t.group === true && this.isGroupSelected(`${t.value}`);
|
|
21629
|
+
return !s && typeof t.group == "string" && this.options[this.cursor]?.value === t.group ? m(t, r ? "group-active-selected" : "group-active", u) : s && r ? m(t, "active-selected", u) : r ? m(t, "selected", u) : m(t, s ? "active" : "inactive", u);
|
|
21630
|
+
};
|
|
21631
|
+
switch (this.state) {
|
|
21632
|
+
case "submit": {
|
|
21633
|
+
const t = this.options.filter(({ value: u }) => g.includes(u)).map((u) => m(u, "submitted")), s = t.length === 0 ? "" : ` ${t.join(styleText("dim", ", "))}`;
|
|
21634
|
+
return `${l}${n ? styleText("gray", S_BAR) : ""}${s}`;
|
|
21635
|
+
}
|
|
21636
|
+
case "cancel": {
|
|
21637
|
+
const t = this.options.filter(({ value: s }) => g.includes(s)).map((s) => m(s, "cancelled")).join(styleText("dim", ", "));
|
|
21638
|
+
return `${l}${n ? `${styleText("gray", S_BAR)} ` : ""}${t.trim() ? `${t}${n ? `
|
|
21639
|
+
${styleText("gray", S_BAR)}` : ""}` : ""}`;
|
|
21640
|
+
}
|
|
21641
|
+
case "error": {
|
|
21642
|
+
const t = n ? `${styleText("yellow", S_BAR)} ` : "", s = this.error.split(`
|
|
21643
|
+
`).map((i, f) => f === 0 ? `${n ? `${styleText("yellow", S_BAR_END)} ` : ""}${styleText("yellow", i)}` : ` ${i}`).join(`
|
|
21644
|
+
`), u = l.split(`
|
|
21645
|
+
`).length, r = s.split(`
|
|
21646
|
+
`).length + 1;
|
|
21647
|
+
return `${l}${t}${limitOptions({
|
|
21648
|
+
output: o.output,
|
|
21649
|
+
options: this.options,
|
|
21650
|
+
cursor: this.cursor,
|
|
21651
|
+
maxItems: o.maxItems,
|
|
21652
|
+
columnPadding: t.length,
|
|
21653
|
+
rowPadding: u + r,
|
|
21654
|
+
style: a
|
|
21655
|
+
}).join(`
|
|
21656
|
+
${t}`)}
|
|
21657
|
+
${s}
|
|
21658
|
+
`;
|
|
21659
|
+
}
|
|
21660
|
+
default: {
|
|
21661
|
+
const t = n ? `${styleText("cyan", S_BAR)} ` : "", s = l.split(`
|
|
21662
|
+
`).length, u = I ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, n) : n ? [styleText("cyan", S_BAR_END)] : [], r = u.join(`
|
|
21663
|
+
`), c = u.length + 1;
|
|
21664
|
+
return `${l}${t}${limitOptions({
|
|
21665
|
+
output: o.output,
|
|
21666
|
+
options: this.options,
|
|
21667
|
+
cursor: this.cursor,
|
|
21668
|
+
maxItems: o.maxItems,
|
|
21669
|
+
columnPadding: t.length,
|
|
21670
|
+
rowPadding: s + c,
|
|
21671
|
+
style: a
|
|
21074
21672
|
}).join(`
|
|
21075
|
-
${
|
|
21076
|
-
|
|
21077
|
-
return `${o}${import_picocolors.default.cyan(d)}${n}${l}
|
|
21078
|
-
${import_picocolors.default.cyan(x)}
|
|
21673
|
+
${t}`)}
|
|
21674
|
+
${r}
|
|
21079
21675
|
`;
|
|
21080
21676
|
}
|
|
21081
21677
|
}
|
|
21082
21678
|
}
|
|
21083
21679
|
}).prompt();
|
|
21084
|
-
}
|
|
21085
|
-
|
|
21086
|
-
|
|
21087
|
-
|
|
21088
|
-
|
|
21680
|
+
};
|
|
21681
|
+
const log$1 = {
|
|
21682
|
+
message: (s = [], { symbol: e = styleText("gray", S_BAR), secondarySymbol: r = styleText("gray", S_BAR), output: m = process.stdout, spacing: l = 1, withGuide: c } = {}) => {
|
|
21683
|
+
const t = [], o = c ?? settings.withGuide, f = o ? r : "", O = o ? `${e} ` : "", u = o ? `${r} ` : "";
|
|
21684
|
+
for (let i = 0; i < l; i++) t.push(f);
|
|
21685
|
+
const g = Array.isArray(s) ? s : s.split(`
|
|
21089
21686
|
`);
|
|
21090
|
-
if (
|
|
21091
|
-
const [
|
|
21092
|
-
|
|
21093
|
-
for (const
|
|
21687
|
+
if (g.length > 0) {
|
|
21688
|
+
const [i, ...y] = g;
|
|
21689
|
+
i.length > 0 ? t.push(`${O}${i}`) : t.push(o ? e : "");
|
|
21690
|
+
for (const p of y) p.length > 0 ? t.push(`${u}${p}`) : t.push(o ? r : "");
|
|
21094
21691
|
}
|
|
21095
|
-
|
|
21692
|
+
m.write(`${t.join(`
|
|
21096
21693
|
`)}
|
|
21097
21694
|
`);
|
|
21098
21695
|
},
|
|
21099
|
-
info: (
|
|
21100
|
-
|
|
21101
|
-
...
|
|
21102
|
-
symbol:
|
|
21696
|
+
info: (s, e) => {
|
|
21697
|
+
log$1.message(s, {
|
|
21698
|
+
...e,
|
|
21699
|
+
symbol: styleText("blue", S_INFO)
|
|
21103
21700
|
});
|
|
21104
21701
|
},
|
|
21105
|
-
success: (
|
|
21106
|
-
|
|
21107
|
-
...
|
|
21108
|
-
symbol:
|
|
21702
|
+
success: (s, e) => {
|
|
21703
|
+
log$1.message(s, {
|
|
21704
|
+
...e,
|
|
21705
|
+
symbol: styleText("green", S_SUCCESS)
|
|
21109
21706
|
});
|
|
21110
21707
|
},
|
|
21111
|
-
step: (
|
|
21112
|
-
|
|
21113
|
-
...
|
|
21114
|
-
symbol:
|
|
21708
|
+
step: (s, e) => {
|
|
21709
|
+
log$1.message(s, {
|
|
21710
|
+
...e,
|
|
21711
|
+
symbol: styleText("green", S_STEP_SUBMIT)
|
|
21115
21712
|
});
|
|
21116
21713
|
},
|
|
21117
|
-
warn: (
|
|
21118
|
-
|
|
21119
|
-
...
|
|
21120
|
-
symbol:
|
|
21714
|
+
warn: (s, e) => {
|
|
21715
|
+
log$1.message(s, {
|
|
21716
|
+
...e,
|
|
21717
|
+
symbol: styleText("yellow", S_WARN)
|
|
21121
21718
|
});
|
|
21122
21719
|
},
|
|
21123
|
-
warning: (
|
|
21124
|
-
|
|
21720
|
+
warning: (s, e) => {
|
|
21721
|
+
log$1.warn(s, e);
|
|
21125
21722
|
},
|
|
21126
|
-
error: (
|
|
21127
|
-
|
|
21128
|
-
...
|
|
21129
|
-
symbol:
|
|
21723
|
+
error: (s, e) => {
|
|
21724
|
+
log$1.message(s, {
|
|
21725
|
+
...e,
|
|
21726
|
+
symbol: styleText("red", S_ERROR)
|
|
21130
21727
|
});
|
|
21131
21728
|
}
|
|
21132
|
-
}
|
|
21133
|
-
|
|
21729
|
+
};
|
|
21730
|
+
const cancel = (o = "", t) => {
|
|
21731
|
+
const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText("gray", S_BAR_END)} ` : "";
|
|
21732
|
+
i.write(`${e}${styleText("red", o)}
|
|
21134
21733
|
|
|
21135
21734
|
`);
|
|
21136
|
-
},
|
|
21137
|
-
|
|
21735
|
+
}, intro = (o = "", t) => {
|
|
21736
|
+
const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText("gray", S_BAR_START)} ` : "";
|
|
21737
|
+
i.write(`${e}${o}
|
|
21138
21738
|
`);
|
|
21139
|
-
},
|
|
21140
|
-
|
|
21141
|
-
${
|
|
21739
|
+
}, outro = (o = "", t) => {
|
|
21740
|
+
const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText("gray", S_BAR)}
|
|
21741
|
+
${styleText("gray", S_BAR_END)} ` : "";
|
|
21742
|
+
i.write(`${e}${o}
|
|
21142
21743
|
|
|
21143
21744
|
`);
|
|
21144
|
-
}
|
|
21145
|
-
|
|
21146
|
-
|
|
21147
|
-
|
|
21148
|
-
|
|
21149
|
-
|
|
21150
|
-
|
|
21151
|
-
|
|
21152
|
-
|
|
21153
|
-
|
|
21154
|
-
|
|
21155
|
-
|
|
21156
|
-
|
|
21157
|
-
|
|
21158
|
-
|
|
21159
|
-
|
|
21160
|
-
|
|
21161
|
-
|
|
21162
|
-
|
|
21163
|
-
|
|
21164
|
-
const i = xt$1(t.output, t.message, `${vt$1(this.state)} `, `${W$1(this.state)} `), a = `${import_picocolors.default.gray(d)}
|
|
21165
|
-
${i}
|
|
21166
|
-
`, o = this.value ?? [], u = (l, n) => {
|
|
21167
|
-
if (l.disabled) return r(l, "disabled");
|
|
21168
|
-
const c = o.includes(l.value);
|
|
21169
|
-
return n && c ? r(l, "active-selected") : c ? r(l, "selected") : r(l, n ? "active" : "inactive");
|
|
21170
|
-
};
|
|
21171
|
-
switch (this.state) {
|
|
21172
|
-
case "submit": {
|
|
21173
|
-
const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "submitted")).join(import_picocolors.default.dim(", ")) || import_picocolors.default.dim("none");
|
|
21174
|
-
return `${a}${xt$1(t.output, l, `${import_picocolors.default.gray(d)} `)}`;
|
|
21175
|
-
}
|
|
21176
|
-
case "cancel": {
|
|
21177
|
-
const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "cancelled")).join(import_picocolors.default.dim(", "));
|
|
21178
|
-
if (l.trim() === "") return `${a}${import_picocolors.default.gray(d)}`;
|
|
21179
|
-
return `${a}${xt$1(t.output, l, `${import_picocolors.default.gray(d)} `)}
|
|
21180
|
-
${import_picocolors.default.gray(d)}`;
|
|
21181
|
-
}
|
|
21182
|
-
case "error": {
|
|
21183
|
-
const l = `${import_picocolors.default.yellow(d)} `, n = this.error.split(`
|
|
21184
|
-
`).map((F, p) => p === 0 ? `${import_picocolors.default.yellow(x)} ${import_picocolors.default.yellow(F)}` : ` ${F}`).join(`
|
|
21185
|
-
`), c = a.split(`
|
|
21186
|
-
`).length, g = n.split(`
|
|
21187
|
-
`).length + 1;
|
|
21188
|
-
return `${a}${l}${X$1({
|
|
21189
|
-
output: t.output,
|
|
21190
|
-
options: this.options,
|
|
21191
|
-
cursor: this.cursor,
|
|
21192
|
-
maxItems: t.maxItems,
|
|
21193
|
-
columnPadding: l.length,
|
|
21194
|
-
rowPadding: c + g,
|
|
21195
|
-
style: u
|
|
21196
|
-
}).join(`
|
|
21197
|
-
${l}`)}
|
|
21198
|
-
${n}
|
|
21745
|
+
};
|
|
21746
|
+
const multiline = (e) => new h$1({
|
|
21747
|
+
validate: e.validate,
|
|
21748
|
+
placeholder: e.placeholder,
|
|
21749
|
+
defaultValue: e.defaultValue,
|
|
21750
|
+
initialValue: e.initialValue,
|
|
21751
|
+
showSubmit: e.showSubmit,
|
|
21752
|
+
output: e.output,
|
|
21753
|
+
signal: e.signal,
|
|
21754
|
+
input: e.input,
|
|
21755
|
+
render() {
|
|
21756
|
+
const i = e?.withGuide ?? settings.withGuide, o = `${`${i ? `${styleText("gray", S_BAR)}
|
|
21757
|
+
` : ""}${symbol(this.state)} `}${e.message}
|
|
21758
|
+
`, m = e.placeholder && e.placeholder.length > 0 ? styleText("inverse", e.placeholder[0]) + styleText("dim", e.placeholder.slice(1)) : styleText(["inverse", "hidden"], "_"), a = this.userInput ? this.userInputWithCursor : m, l = this.value ?? "", c = e.showSubmit ? `
|
|
21759
|
+
${styleText(this.focused === "submit" ? "cyan" : "dim", "[ submit ]")}` : "";
|
|
21760
|
+
switch (this.state) {
|
|
21761
|
+
case "error": {
|
|
21762
|
+
const n = `${styleText("yellow", S_BAR)} `;
|
|
21763
|
+
return `${o}${i ? wrapTextWithPrefix(e.output, a, n, void 0) : a}
|
|
21764
|
+
${styleText("yellow", S_BAR_END)} ${styleText("yellow", this.error)}${c}
|
|
21199
21765
|
`;
|
|
21200
|
-
|
|
21201
|
-
|
|
21202
|
-
|
|
21203
|
-
|
|
21204
|
-
|
|
21205
|
-
|
|
21206
|
-
|
|
21207
|
-
|
|
21208
|
-
|
|
21209
|
-
|
|
21210
|
-
|
|
21211
|
-
|
|
21212
|
-
|
|
21213
|
-
${l}`)}
|
|
21214
|
-
${import_picocolors.default.cyan(x)}
|
|
21766
|
+
}
|
|
21767
|
+
case "submit": {
|
|
21768
|
+
const n = `${styleText("gray", S_BAR)} `;
|
|
21769
|
+
return `${o}${i ? wrapTextWithPrefix(e.output, l, n, void 0, void 0, (u) => styleText("dim", u)) : l ? styleText("dim", l) : ""}`;
|
|
21770
|
+
}
|
|
21771
|
+
case "cancel": {
|
|
21772
|
+
const n = `${styleText("gray", S_BAR)} `;
|
|
21773
|
+
return `${o}${i ? wrapTextWithPrefix(e.output, l, n, void 0, void 0, (u) => styleText(["strikethrough", "dim"], u)) : l ? styleText(["strikethrough", "dim"], l) : ""}`;
|
|
21774
|
+
}
|
|
21775
|
+
default: {
|
|
21776
|
+
const n = i ? `${styleText("cyan", S_BAR)} ` : "", r = i ? styleText("cyan", S_BAR_END) : "";
|
|
21777
|
+
return `${o}${i ? wrapTextWithPrefix(e.output, a, n) : a}
|
|
21778
|
+
${r}${c}
|
|
21215
21779
|
`;
|
|
21216
|
-
}
|
|
21217
21780
|
}
|
|
21218
21781
|
}
|
|
21219
|
-
}
|
|
21220
|
-
}
|
|
21221
|
-
|
|
21222
|
-
|
|
21223
|
-
|
|
21224
|
-
|
|
21225
|
-
|
|
21226
|
-
|
|
21227
|
-
|
|
21228
|
-
|
|
21782
|
+
}
|
|
21783
|
+
}).prompt();
|
|
21784
|
+
const W$1 = (o) => o, C$1 = (o, e, s) => {
|
|
21785
|
+
const a = {
|
|
21786
|
+
hard: true,
|
|
21787
|
+
trim: false
|
|
21788
|
+
}, i = wrapAnsi$1(o, e, a).split(`
|
|
21789
|
+
`), c = i.reduce((n, t) => Math.max(fastStringWidth(t), n), 0);
|
|
21790
|
+
return wrapAnsi$1(o, e - (i.map(s).reduce((n, t) => Math.max(fastStringWidth(t), n), 0) - c), a);
|
|
21791
|
+
};
|
|
21792
|
+
const note = (o = "", e = "", s) => {
|
|
21793
|
+
const a = s?.output ?? process$1.stdout, i = s?.withGuide ?? settings.withGuide, c = s?.format ?? W$1, g = [
|
|
21229
21794
|
"",
|
|
21230
|
-
...
|
|
21231
|
-
`).map(
|
|
21795
|
+
...C$1(o, getColumns(a) - 6, c).split(`
|
|
21796
|
+
`).map(c),
|
|
21232
21797
|
""
|
|
21233
|
-
],
|
|
21234
|
-
const
|
|
21235
|
-
return
|
|
21236
|
-
}, 0),
|
|
21237
|
-
`),
|
|
21238
|
-
` : "",
|
|
21239
|
-
|
|
21240
|
-
${
|
|
21241
|
-
${
|
|
21798
|
+
], n = fastStringWidth(e), t = Math.max(g.reduce((m, F) => {
|
|
21799
|
+
const O = fastStringWidth(F);
|
|
21800
|
+
return O > m ? O : m;
|
|
21801
|
+
}, 0), n) + 2, h = g.map((m) => `${styleText("gray", S_BAR)} ${m}${" ".repeat(t - fastStringWidth(m))}${styleText("gray", S_BAR)}`).join(`
|
|
21802
|
+
`), T = i ? `${styleText("gray", S_BAR)}
|
|
21803
|
+
` : "", l$1 = i ? S_CONNECT_LEFT : S_CORNER_BOTTOM_LEFT;
|
|
21804
|
+
a.write(`${T}${styleText("green", S_STEP_SUBMIT)} ${styleText("reset", e)} ${styleText("gray", S_BAR_H.repeat(Math.max(t - n - 1, 1)) + S_CORNER_TOP_RIGHT)}
|
|
21805
|
+
${h}
|
|
21806
|
+
${styleText("gray", l$1 + S_BAR_H.repeat(t + 2) + S_CORNER_BOTTOM_RIGHT)}
|
|
21242
21807
|
`);
|
|
21243
|
-
}
|
|
21244
|
-
|
|
21245
|
-
|
|
21246
|
-
|
|
21247
|
-
|
|
21248
|
-
|
|
21808
|
+
};
|
|
21809
|
+
const password = (r) => new u$1$1({
|
|
21810
|
+
validate: r.validate,
|
|
21811
|
+
mask: r.mask ?? S_PASSWORD_MASK,
|
|
21812
|
+
signal: r.signal,
|
|
21813
|
+
input: r.input,
|
|
21814
|
+
output: r.output,
|
|
21249
21815
|
render() {
|
|
21250
|
-
const
|
|
21251
|
-
` : ""}${
|
|
21252
|
-
`,
|
|
21816
|
+
const e = r.withGuide ?? settings.withGuide, o = `${e ? `${styleText("gray", S_BAR)}
|
|
21817
|
+
` : ""}${symbol(this.state)} ${r.message}
|
|
21818
|
+
`, c = this.userInputWithCursor, i = this.masked;
|
|
21253
21819
|
switch (this.state) {
|
|
21254
21820
|
case "error": {
|
|
21255
|
-
const
|
|
21256
|
-
return
|
|
21257
|
-
${
|
|
21258
|
-
${
|
|
21821
|
+
const s = e ? `${styleText("yellow", S_BAR)} ` : "", n = e ? `${styleText("yellow", S_BAR_END)} ` : "", l = i ?? "";
|
|
21822
|
+
return r.clearOnError && this.clear(), `${o.trim()}
|
|
21823
|
+
${s}${l}
|
|
21824
|
+
${n}${styleText("yellow", this.error)}
|
|
21259
21825
|
`;
|
|
21260
21826
|
}
|
|
21261
|
-
case "submit": return `${
|
|
21262
|
-
case "cancel": return `${
|
|
21263
|
-
${
|
|
21264
|
-
default: return `${
|
|
21265
|
-
${
|
|
21827
|
+
case "submit": return `${o}${e ? `${styleText("gray", S_BAR)} ` : ""}${i ? styleText("dim", i) : ""}`;
|
|
21828
|
+
case "cancel": return `${o}${e ? `${styleText("gray", S_BAR)} ` : ""}${i ? styleText(["strikethrough", "dim"], i) : ""}${i && e ? `
|
|
21829
|
+
${styleText("gray", S_BAR)}` : ""}`;
|
|
21830
|
+
default: return `${o}${e ? `${styleText("cyan", S_BAR)} ` : ""}${c}
|
|
21831
|
+
${e ? styleText("cyan", S_BAR_END) : ""}
|
|
21266
21832
|
`;
|
|
21267
21833
|
}
|
|
21268
21834
|
}
|
|
21269
|
-
}).prompt()
|
|
21270
|
-
|
|
21271
|
-
|
|
21272
|
-
|
|
21273
|
-
|
|
21835
|
+
}).prompt();
|
|
21836
|
+
const path$5 = (e) => {
|
|
21837
|
+
const a = e.validate;
|
|
21838
|
+
return autocomplete({
|
|
21839
|
+
...e,
|
|
21840
|
+
initialUserInput: e.initialValue ?? e.root ?? process.cwd(),
|
|
21274
21841
|
maxItems: 5,
|
|
21275
|
-
validate(
|
|
21276
|
-
if (!Array.isArray(
|
|
21277
|
-
if (!
|
|
21278
|
-
if (
|
|
21842
|
+
validate(t) {
|
|
21843
|
+
if (!Array.isArray(t)) {
|
|
21844
|
+
if (!t) return "Please select a path";
|
|
21845
|
+
if (a) return runValidation(a, t);
|
|
21279
21846
|
}
|
|
21280
21847
|
},
|
|
21281
21848
|
options() {
|
|
21282
|
-
const
|
|
21283
|
-
if (
|
|
21849
|
+
const t = this.userInput;
|
|
21850
|
+
if (t === "") return [];
|
|
21284
21851
|
try {
|
|
21285
21852
|
let i;
|
|
21286
|
-
|
|
21287
|
-
|
|
21853
|
+
existsSync(t) ? lstatSync(t).isDirectory() && (!e.directory || t.endsWith("/")) ? i = t : i = dirname$1(t) : i = dirname$1(t);
|
|
21854
|
+
const c = t.length > 1 && t.endsWith("/") ? t.slice(0, -1) : t;
|
|
21855
|
+
return readdirSync(i).map((r) => {
|
|
21856
|
+
const n = join(i, r);
|
|
21288
21857
|
return {
|
|
21289
|
-
name:
|
|
21290
|
-
path:
|
|
21291
|
-
isDirectory: lstatSync(
|
|
21858
|
+
name: r,
|
|
21859
|
+
path: n,
|
|
21860
|
+
isDirectory: lstatSync(n).isDirectory()
|
|
21292
21861
|
};
|
|
21293
|
-
}).filter(({ path:
|
|
21862
|
+
}).filter(({ path: r, isDirectory: n }) => r.startsWith(c) && (n || !e.directory)).map((r) => ({ value: r.path }));
|
|
21294
21863
|
} catch {
|
|
21295
21864
|
return [];
|
|
21296
21865
|
}
|
|
21297
21866
|
}
|
|
21298
21867
|
});
|
|
21299
|
-
}
|
|
21868
|
+
};
|
|
21869
|
+
const W$2 = (l) => styleText("magenta", l);
|
|
21870
|
+
const spinner$1 = ({ indicator: l = "dots", onCancel: h, output: n = process.stdout, cancelMessage: G, errorMessage: O, frames: E = unicode ? [
|
|
21300
21871
|
"◒",
|
|
21301
21872
|
"◐",
|
|
21302
21873
|
"◓",
|
|
@@ -21306,166 +21877,177 @@ ${r ? import_picocolors.default.cyan(x) : ""}
|
|
|
21306
21877
|
"o",
|
|
21307
21878
|
"O",
|
|
21308
21879
|
"0"
|
|
21309
|
-
], delay:
|
|
21310
|
-
const
|
|
21311
|
-
let
|
|
21312
|
-
const
|
|
21313
|
-
const
|
|
21314
|
-
|
|
21315
|
-
},
|
|
21316
|
-
process.on("uncaughtExceptionMonitor",
|
|
21317
|
-
},
|
|
21318
|
-
process.removeListener("uncaughtExceptionMonitor",
|
|
21319
|
-
},
|
|
21320
|
-
if (
|
|
21321
|
-
|
|
21880
|
+
], delay: F = unicode ? 80 : 120, signal: m, ...I } = {}) => {
|
|
21881
|
+
const u = isCI();
|
|
21882
|
+
let M, T, d = false, S = false, s = "", p, w = performance.now();
|
|
21883
|
+
const x = getColumns(n), k = I?.styleFrame ?? W$2, g = (e) => {
|
|
21884
|
+
const r = e > 1 ? O ?? settings.messages.error : G ?? settings.messages.cancel;
|
|
21885
|
+
S = e === 1, d && (a(r, e), S && typeof h == "function" && h());
|
|
21886
|
+
}, f = () => g(2), i = () => g(1), A = () => {
|
|
21887
|
+
process.on("uncaughtExceptionMonitor", f), process.on("unhandledRejection", f), process.on("SIGINT", i), process.on("SIGTERM", i), process.on("exit", g), m && m.addEventListener("abort", i);
|
|
21888
|
+
}, H = () => {
|
|
21889
|
+
process.removeListener("uncaughtExceptionMonitor", f), process.removeListener("unhandledRejection", f), process.removeListener("SIGINT", i), process.removeListener("SIGTERM", i), process.removeListener("exit", g), m && m.removeEventListener("abort", i);
|
|
21890
|
+
}, y = () => {
|
|
21891
|
+
if (p === void 0) return;
|
|
21892
|
+
u && n.write(`
|
|
21322
21893
|
`);
|
|
21323
|
-
const
|
|
21324
|
-
hard:
|
|
21325
|
-
trim:
|
|
21894
|
+
const r = wrapAnsi$1(p, x, {
|
|
21895
|
+
hard: true,
|
|
21896
|
+
trim: false
|
|
21326
21897
|
}).split(`
|
|
21327
21898
|
`);
|
|
21328
|
-
|
|
21329
|
-
},
|
|
21330
|
-
const
|
|
21331
|
-
return
|
|
21332
|
-
},
|
|
21333
|
-
|
|
21899
|
+
r.length > 1 && n.write(import_src.cursor.up(r.length - 1)), n.write(import_src.cursor.to(0)), n.write(import_src.erase.down());
|
|
21900
|
+
}, C = (e) => e.replace(/\.+$/, ""), _ = (e) => {
|
|
21901
|
+
const r = (performance.now() - e) / 1e3, t = Math.floor(r / 60), o = Math.floor(r % 60);
|
|
21902
|
+
return t > 0 ? `[${t}m ${o}s]` : `[${o}s]`;
|
|
21903
|
+
}, N = I.withGuide ?? settings.withGuide, P = (e = "") => {
|
|
21904
|
+
d = true, M = block({ output: n }), s = C(e), w = performance.now(), N && n.write(`${styleText("gray", S_BAR)}
|
|
21334
21905
|
`);
|
|
21335
|
-
let
|
|
21336
|
-
|
|
21337
|
-
if (
|
|
21338
|
-
|
|
21339
|
-
const
|
|
21340
|
-
let
|
|
21341
|
-
if (
|
|
21342
|
-
else if (
|
|
21906
|
+
let r = 0, t = 0;
|
|
21907
|
+
A(), T = setInterval(() => {
|
|
21908
|
+
if (u && s === p) return;
|
|
21909
|
+
y(), p = s;
|
|
21910
|
+
const o = k(E[r]);
|
|
21911
|
+
let v;
|
|
21912
|
+
if (u) v = `${o} ${s}...`;
|
|
21913
|
+
else if (l === "timer") v = `${o} ${s} ${_(w)}`;
|
|
21343
21914
|
else {
|
|
21344
|
-
const
|
|
21345
|
-
|
|
21915
|
+
const B = ".".repeat(Math.floor(t)).slice(0, 3);
|
|
21916
|
+
v = `${o} ${s}${B}`;
|
|
21346
21917
|
}
|
|
21347
|
-
const
|
|
21348
|
-
hard:
|
|
21349
|
-
trim:
|
|
21918
|
+
const j = wrapAnsi$1(v, x, {
|
|
21919
|
+
hard: true,
|
|
21920
|
+
trim: false
|
|
21350
21921
|
});
|
|
21351
|
-
|
|
21352
|
-
},
|
|
21353
|
-
},
|
|
21354
|
-
if (!
|
|
21355
|
-
|
|
21356
|
-
const
|
|
21357
|
-
|
|
21358
|
-
`) :
|
|
21359
|
-
`)),
|
|
21922
|
+
n.write(j), r = r + 1 < E.length ? r + 1 : 0, t = t < 4 ? t + .125 : 0;
|
|
21923
|
+
}, F);
|
|
21924
|
+
}, a = (e = "", r = 0, t = false) => {
|
|
21925
|
+
if (!d) return;
|
|
21926
|
+
d = false, clearInterval(T), y();
|
|
21927
|
+
const o = r === 0 ? styleText("green", S_STEP_SUBMIT) : r === 1 ? styleText("red", S_STEP_CANCEL) : styleText("red", S_STEP_ERROR);
|
|
21928
|
+
s = e ?? s, t || (l === "timer" ? n.write(`${o} ${s} ${_(w)}
|
|
21929
|
+
`) : n.write(`${o} ${s}
|
|
21930
|
+
`)), H(), M();
|
|
21360
21931
|
};
|
|
21361
21932
|
return {
|
|
21362
|
-
start:
|
|
21363
|
-
stop: (
|
|
21364
|
-
message: (
|
|
21365
|
-
|
|
21366
|
-
},
|
|
21367
|
-
cancel: (
|
|
21368
|
-
error: (
|
|
21369
|
-
clear: () =>
|
|
21933
|
+
start: P,
|
|
21934
|
+
stop: (e = "") => a(e, 0),
|
|
21935
|
+
message: (e = "") => {
|
|
21936
|
+
s = C(e ?? s);
|
|
21937
|
+
},
|
|
21938
|
+
cancel: (e = "") => a(e, 1),
|
|
21939
|
+
error: (e = "") => a(e, 2),
|
|
21940
|
+
clear: () => a("", 0, true),
|
|
21370
21941
|
get isCancelled() {
|
|
21371
|
-
return
|
|
21942
|
+
return S;
|
|
21372
21943
|
}
|
|
21373
21944
|
};
|
|
21374
|
-
}, zt$1 = {
|
|
21375
|
-
light: C$1("─", "-"),
|
|
21376
|
-
heavy: C$1("━", "="),
|
|
21377
|
-
block: C$1("█", "#")
|
|
21378
21945
|
};
|
|
21379
|
-
|
|
21380
|
-
|
|
21381
|
-
|
|
21382
|
-
|
|
21383
|
-
|
|
21946
|
+
const u$1 = {
|
|
21947
|
+
light: unicodeOr("─", "-"),
|
|
21948
|
+
heavy: unicodeOr("━", "="),
|
|
21949
|
+
block: unicodeOr("█", "#")
|
|
21950
|
+
};
|
|
21951
|
+
function progress$1({ style: o = "heavy", max: d = 100, size: v = 40, ...x } = {}) {
|
|
21952
|
+
const r = spinner$1(x);
|
|
21953
|
+
let a = 0, n = "";
|
|
21954
|
+
const c = Math.max(1, d), l = Math.max(1, v), S = (t) => {
|
|
21955
|
+
switch (t) {
|
|
21384
21956
|
case "initial":
|
|
21385
|
-
case "active": return
|
|
21957
|
+
case "active": return (e) => styleText("magenta", e);
|
|
21386
21958
|
case "error":
|
|
21387
|
-
case "cancel": return
|
|
21388
|
-
case "submit": return
|
|
21389
|
-
default: return
|
|
21390
|
-
}
|
|
21391
|
-
},
|
|
21392
|
-
const m = Math.floor(
|
|
21393
|
-
return `${
|
|
21394
|
-
},
|
|
21395
|
-
|
|
21396
|
-
},
|
|
21397
|
-
|
|
21959
|
+
case "cancel": return (e) => styleText("red", e);
|
|
21960
|
+
case "submit": return (e) => styleText("green", e);
|
|
21961
|
+
default: return (e) => styleText("magenta", e);
|
|
21962
|
+
}
|
|
21963
|
+
}, p = (t, e) => {
|
|
21964
|
+
const m = Math.floor(a / c * l);
|
|
21965
|
+
return `${S(t)(u$1[o].repeat(m))}${styleText("dim", u$1[o].repeat(l - m))} ${e}`;
|
|
21966
|
+
}, h = (t = "") => {
|
|
21967
|
+
n = t, r.start(p("initial", t));
|
|
21968
|
+
}, g = (t = 1, e) => {
|
|
21969
|
+
a = Math.min(c, t + a), r.message(p("active", e ?? n)), n = e ?? n;
|
|
21398
21970
|
};
|
|
21399
21971
|
return {
|
|
21400
|
-
start:
|
|
21401
|
-
stop:
|
|
21402
|
-
cancel:
|
|
21403
|
-
error:
|
|
21404
|
-
clear:
|
|
21405
|
-
advance:
|
|
21406
|
-
isCancelled:
|
|
21407
|
-
message: (
|
|
21972
|
+
start: h,
|
|
21973
|
+
stop: r.stop,
|
|
21974
|
+
cancel: r.cancel,
|
|
21975
|
+
error: r.error,
|
|
21976
|
+
clear: r.clear,
|
|
21977
|
+
advance: g,
|
|
21978
|
+
isCancelled: r.isCancelled,
|
|
21979
|
+
message: (t) => g(0, t)
|
|
21408
21980
|
};
|
|
21409
21981
|
}
|
|
21410
|
-
const
|
|
21982
|
+
const SELECT_INSTRUCTIONS = [`${styleText("dim", "↑/↓")} to navigate`, `${styleText("dim", "Enter:")} confirm`];
|
|
21983
|
+
const c$1 = (t, o) => t.includes(`
|
|
21411
21984
|
`) ? t.split(`
|
|
21412
|
-
`).map((
|
|
21413
|
-
`) :
|
|
21414
|
-
|
|
21415
|
-
|
|
21416
|
-
|
|
21417
|
-
|
|
21418
|
-
|
|
21419
|
-
case "
|
|
21420
|
-
case "
|
|
21421
|
-
|
|
21422
|
-
|
|
21423
|
-
|
|
21424
|
-
|
|
21985
|
+
`).map((d) => o(d)).join(`
|
|
21986
|
+
`) : o(t);
|
|
21987
|
+
const select = (t) => {
|
|
21988
|
+
const o = (n, m) => {
|
|
21989
|
+
if (n === void 0) return "";
|
|
21990
|
+
const s = n.label ?? String(n.value);
|
|
21991
|
+
switch (m) {
|
|
21992
|
+
case "disabled": return `${styleText("gray", S_RADIO_INACTIVE)} ${c$1(s, (i) => styleText("gray", i))}${n.hint ? ` ${styleText("dim", `(${n.hint ?? "disabled"})`)}` : ""}`;
|
|
21993
|
+
case "selected": return `${c$1(s, (i) => styleText("dim", i))}`;
|
|
21994
|
+
case "active": return `${styleText("green", S_RADIO_ACTIVE)} ${s}${n.hint ? ` ${styleText("dim", `(${n.hint})`)}` : ""}`;
|
|
21995
|
+
case "cancelled": return `${c$1(s, (i) => styleText(["strikethrough", "dim"], i))}`;
|
|
21996
|
+
default: return `${styleText("dim", S_RADIO_INACTIVE)} ${c$1(s, (i) => styleText("dim", i))}`;
|
|
21997
|
+
}
|
|
21998
|
+
}, d = t.showInstructions ?? true;
|
|
21999
|
+
return new n$1({
|
|
21425
22000
|
options: t.options,
|
|
21426
22001
|
signal: t.signal,
|
|
21427
22002
|
input: t.input,
|
|
21428
22003
|
output: t.output,
|
|
21429
22004
|
initialValue: t.initialValue,
|
|
21430
22005
|
render() {
|
|
21431
|
-
const
|
|
21432
|
-
` : ""}${
|
|
22006
|
+
const n = t.withGuide ?? settings.withGuide, m = `${symbol(this.state)} `, s = `${symbolBar(this.state)} `, i = wrapTextWithPrefix(t.output, t.message, s, m), u = `${n ? `${styleText("gray", S_BAR)}
|
|
22007
|
+
` : ""}${i}
|
|
21433
22008
|
`;
|
|
21434
22009
|
switch (this.state) {
|
|
21435
22010
|
case "submit": {
|
|
21436
|
-
const
|
|
21437
|
-
return `${u}${
|
|
22011
|
+
const r = n ? `${styleText("gray", S_BAR)} ` : "";
|
|
22012
|
+
return `${u}${wrapTextWithPrefix(t.output, o(this.options[this.cursor], "selected"), r)}`;
|
|
21438
22013
|
}
|
|
21439
22014
|
case "cancel": {
|
|
21440
|
-
const
|
|
21441
|
-
return `${u}${
|
|
21442
|
-
${
|
|
22015
|
+
const r = n ? `${styleText("gray", S_BAR)} ` : "";
|
|
22016
|
+
return `${u}${wrapTextWithPrefix(t.output, o(this.options[this.cursor], "cancelled"), r)}${n ? `
|
|
22017
|
+
${styleText("gray", S_BAR)}` : ""}`;
|
|
21443
22018
|
}
|
|
21444
22019
|
default: {
|
|
21445
|
-
const
|
|
21446
|
-
`).length,
|
|
21447
|
-
|
|
22020
|
+
const r = n ? `${styleText("cyan", S_BAR)} ` : "", a = u.split(`
|
|
22021
|
+
`).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n) : n ? [styleText("cyan", S_BAR_END)] : [], b = p.join(`
|
|
22022
|
+
`), f = p.length + 1;
|
|
22023
|
+
return `${u}${r}${limitOptions({
|
|
21448
22024
|
output: t.output,
|
|
21449
22025
|
cursor: this.cursor,
|
|
21450
22026
|
options: this.options,
|
|
21451
22027
|
maxItems: t.maxItems,
|
|
21452
|
-
columnPadding:
|
|
21453
|
-
rowPadding:
|
|
21454
|
-
style: (
|
|
22028
|
+
columnPadding: r.length,
|
|
22029
|
+
rowPadding: a + f,
|
|
22030
|
+
style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
|
|
21455
22031
|
}).join(`
|
|
21456
|
-
${
|
|
21457
|
-
${
|
|
22032
|
+
${r}`)}
|
|
22033
|
+
${b}
|
|
21458
22034
|
`;
|
|
21459
22035
|
}
|
|
21460
22036
|
}
|
|
21461
22037
|
}
|
|
21462
22038
|
}).prompt();
|
|
21463
|
-
}
|
|
21464
|
-
|
|
21465
|
-
|
|
21466
|
-
|
|
21467
|
-
|
|
21468
|
-
|
|
22039
|
+
};
|
|
22040
|
+
const selectKey = (t) => {
|
|
22041
|
+
const l = (e, a = "inactive") => {
|
|
22042
|
+
if (e === void 0) return "";
|
|
22043
|
+
const n = e.label ?? String(e.value);
|
|
22044
|
+
return a === "selected" ? `${styleText("dim", n)}` : a === "cancelled" ? `${styleText(["strikethrough", "dim"], n)}` : a === "active" ? `${styleText(["bgCyan", "gray"], ` ${e.value} `)} ${n}${e.hint ? ` ${styleText("dim", `(${e.hint})`)}` : ""}` : `${styleText([
|
|
22045
|
+
"gray",
|
|
22046
|
+
"bgWhite",
|
|
22047
|
+
"inverse"
|
|
22048
|
+
], ` ${e.value} `)} ${n}${e.hint ? ` ${styleText("dim", `(${e.hint})`)}` : ""}`;
|
|
22049
|
+
};
|
|
22050
|
+
return new u$3({
|
|
21469
22051
|
options: t.options,
|
|
21470
22052
|
signal: t.signal,
|
|
21471
22053
|
input: t.input,
|
|
@@ -21473,215 +22055,291 @@ ${n}
|
|
|
21473
22055
|
initialValue: t.initialValue,
|
|
21474
22056
|
caseSensitive: t.caseSensitive,
|
|
21475
22057
|
render() {
|
|
21476
|
-
const
|
|
21477
|
-
` : ""}${
|
|
22058
|
+
const e = t.withGuide ?? settings.withGuide, a = `${e ? `${styleText("gray", S_BAR)}
|
|
22059
|
+
` : ""}${symbol(this.state)} ${t.message}
|
|
21478
22060
|
`;
|
|
21479
22061
|
switch (this.state) {
|
|
21480
22062
|
case "submit": {
|
|
21481
|
-
const
|
|
21482
|
-
return `${
|
|
22063
|
+
const n = e ? `${styleText("gray", S_BAR)} ` : "", s = this.options.find((u) => u.value === this.value) ?? t.options[0];
|
|
22064
|
+
return `${a}${wrapTextWithPrefix(t.output, l(s, "selected"), n)}`;
|
|
21483
22065
|
}
|
|
21484
22066
|
case "cancel": {
|
|
21485
|
-
const
|
|
21486
|
-
return `${
|
|
21487
|
-
${
|
|
22067
|
+
const n = e ? `${styleText("gray", S_BAR)} ` : "";
|
|
22068
|
+
return `${a}${wrapTextWithPrefix(t.output, l(this.options[0], "cancelled"), n)}${e ? `
|
|
22069
|
+
${styleText("gray", S_BAR)}` : ""}`;
|
|
21488
22070
|
}
|
|
21489
22071
|
default: {
|
|
21490
|
-
const
|
|
21491
|
-
return `${
|
|
22072
|
+
const n = e ? `${styleText("cyan", S_BAR)} ` : "", s = e ? styleText("cyan", S_BAR_END) : "";
|
|
22073
|
+
return `${a}${this.options.map((u, d) => wrapTextWithPrefix(t.output, l(u, d === this.cursor ? "active" : "inactive"), n)).join(`
|
|
21492
22074
|
`)}
|
|
21493
|
-
${
|
|
22075
|
+
${s}
|
|
21494
22076
|
`;
|
|
21495
22077
|
}
|
|
21496
22078
|
}
|
|
21497
22079
|
}
|
|
21498
22080
|
}).prompt();
|
|
21499
|
-
}
|
|
21500
|
-
|
|
21501
|
-
|
|
21502
|
-
|
|
22081
|
+
};
|
|
22082
|
+
const i$1 = `${styleText("gray", S_BAR)} `;
|
|
22083
|
+
const stream = {
|
|
22084
|
+
message: async (e, { symbol: l = styleText("gray", S_BAR) } = {}) => {
|
|
22085
|
+
process.stdout.write(`${styleText("gray", S_BAR)}
|
|
22086
|
+
${l} `);
|
|
21503
22087
|
let s = 3;
|
|
21504
|
-
for await (let
|
|
21505
|
-
|
|
21506
|
-
${
|
|
21507
|
-
`) && (s = 3 + stripVTControlCharacters(
|
|
22088
|
+
for await (let r of e) {
|
|
22089
|
+
r = r.replace(/\n/g, `
|
|
22090
|
+
${i$1}`), r.includes(`
|
|
22091
|
+
`) && (s = 3 + stripVTControlCharacters(r.slice(r.lastIndexOf(`
|
|
21508
22092
|
`))).length);
|
|
21509
|
-
const
|
|
21510
|
-
s +
|
|
21511
|
-
${
|
|
22093
|
+
const o = stripVTControlCharacters(r).length;
|
|
22094
|
+
s + o < process.stdout.columns ? (s += o, process.stdout.write(r)) : (process.stdout.write(`
|
|
22095
|
+
${i$1}${r.trimStart()}`), s = 3 + stripVTControlCharacters(r.trimStart()).length);
|
|
21512
22096
|
}
|
|
21513
22097
|
process.stdout.write(`
|
|
21514
22098
|
`);
|
|
21515
22099
|
},
|
|
21516
|
-
info: (
|
|
21517
|
-
success: (
|
|
21518
|
-
step: (
|
|
21519
|
-
warn: (
|
|
21520
|
-
warning: (
|
|
21521
|
-
error: (
|
|
21522
|
-
}
|
|
21523
|
-
|
|
21524
|
-
|
|
21525
|
-
|
|
21526
|
-
|
|
21527
|
-
|
|
21528
|
-
|
|
21529
|
-
|
|
21530
|
-
}
|
|
21531
|
-
|
|
22100
|
+
info: (e) => stream.message(e, { symbol: styleText("blue", S_INFO) }),
|
|
22101
|
+
success: (e) => stream.message(e, { symbol: styleText("green", S_SUCCESS) }),
|
|
22102
|
+
step: (e) => stream.message(e, { symbol: styleText("green", S_STEP_SUBMIT) }),
|
|
22103
|
+
warn: (e) => stream.message(e, { symbol: styleText("yellow", S_WARN) }),
|
|
22104
|
+
warning: (e) => stream.warn(e),
|
|
22105
|
+
error: (e) => stream.message(e, { symbol: styleText("red", S_ERROR) })
|
|
22106
|
+
};
|
|
22107
|
+
const tasks$1 = async (o, e) => {
|
|
22108
|
+
for (const t of o) {
|
|
22109
|
+
if (t.enabled === false) continue;
|
|
22110
|
+
const s = spinner$1(e);
|
|
22111
|
+
s.start(t.title);
|
|
22112
|
+
const n = await t.task(s.message);
|
|
22113
|
+
s.stop(n || t.title);
|
|
22114
|
+
}
|
|
22115
|
+
};
|
|
22116
|
+
const A$2 = (l) => l.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g, "");
|
|
22117
|
+
const taskLog = (l) => {
|
|
22118
|
+
const r = l.output ?? process.stdout, O = getColumns(r), i = styleText("gray", S_BAR), p = l.spacing ?? 1, k = 3, m = l.retainLog === true, d = !isCI() && isTTY(r);
|
|
21532
22119
|
r.write(`${i}
|
|
21533
|
-
`), r.write(`${
|
|
22120
|
+
`), r.write(`${styleText("green", S_STEP_SUBMIT)} ${l.title}
|
|
21534
22121
|
`);
|
|
21535
|
-
for (let
|
|
22122
|
+
for (let e = 0; e < p; e++) r.write(`${i}
|
|
21536
22123
|
`);
|
|
21537
22124
|
const n = [{
|
|
21538
22125
|
value: "",
|
|
21539
22126
|
full: ""
|
|
21540
22127
|
}];
|
|
21541
|
-
let
|
|
21542
|
-
const
|
|
22128
|
+
let v = false;
|
|
22129
|
+
const f = (e) => {
|
|
21543
22130
|
if (n.length === 0) return;
|
|
21544
|
-
let
|
|
21545
|
-
|
|
21546
|
-
for (const
|
|
21547
|
-
const { value:
|
|
21548
|
-
let
|
|
21549
|
-
if (
|
|
21550
|
-
|
|
21551
|
-
${
|
|
21552
|
-
const
|
|
21553
|
-
`).reduce((
|
|
21554
|
-
|
|
21555
|
-
}
|
|
21556
|
-
|
|
21557
|
-
},
|
|
21558
|
-
const
|
|
21559
|
-
${
|
|
21560
|
-
|
|
21561
|
-
`).map(
|
|
22131
|
+
let s = 0;
|
|
22132
|
+
e && (s += p + 2);
|
|
22133
|
+
for (const t of n) {
|
|
22134
|
+
const { value: o, result: a } = t;
|
|
22135
|
+
let g = a?.message ?? o;
|
|
22136
|
+
if (g.length === 0) continue;
|
|
22137
|
+
a === void 0 && t.header !== void 0 && t.header !== "" && (g += `
|
|
22138
|
+
${t.header}`);
|
|
22139
|
+
const E = g.split(`
|
|
22140
|
+
`).reduce((b, w) => w === "" ? b + 1 : b + Math.ceil((w.length + k) / O), 0);
|
|
22141
|
+
s += E;
|
|
22142
|
+
}
|
|
22143
|
+
s > 0 && (s += 1, r.write(import_src.erase.lines(s)));
|
|
22144
|
+
}, h = (e, s, t) => {
|
|
22145
|
+
const o = t ? `${e.full}
|
|
22146
|
+
${e.value}` : e.value;
|
|
22147
|
+
e.header !== void 0 && e.header !== "" && log$1.message(e.header.split(`
|
|
22148
|
+
`).map((a) => styleText("bold", a)), {
|
|
21562
22149
|
output: r,
|
|
21563
22150
|
secondarySymbol: i,
|
|
21564
22151
|
symbol: i,
|
|
21565
22152
|
spacing: 0
|
|
21566
|
-
}),
|
|
21567
|
-
`).map(
|
|
22153
|
+
}), log$1.message(o.split(`
|
|
22154
|
+
`).map((a) => styleText("dim", a)), {
|
|
21568
22155
|
output: r,
|
|
21569
22156
|
secondarySymbol: i,
|
|
21570
22157
|
symbol: i,
|
|
21571
|
-
spacing:
|
|
22158
|
+
spacing: s ?? p
|
|
21572
22159
|
});
|
|
21573
|
-
},
|
|
21574
|
-
for (const
|
|
21575
|
-
const { header:
|
|
21576
|
-
(
|
|
21577
|
-
}
|
|
21578
|
-
},
|
|
21579
|
-
if (
|
|
21580
|
-
`),
|
|
21581
|
-
const
|
|
21582
|
-
`),
|
|
21583
|
-
if (
|
|
21584
|
-
const
|
|
21585
|
-
|
|
21586
|
-
`) +
|
|
22160
|
+
}, T = () => {
|
|
22161
|
+
for (const e of n) {
|
|
22162
|
+
const { header: s, value: t, full: o } = e;
|
|
22163
|
+
(s === void 0 || s.length === 0) && t.length === 0 || h(e, void 0, m === true && o.length > 0);
|
|
22164
|
+
}
|
|
22165
|
+
}, L = (e, s, t) => {
|
|
22166
|
+
if (f(false), (t?.raw !== true || !v) && e.value !== "" && (e.value += `
|
|
22167
|
+
`), e.value += A$2(s), v = t?.raw === true, l.limit !== void 0) {
|
|
22168
|
+
const o = e.value.split(`
|
|
22169
|
+
`), a = o.length - l.limit;
|
|
22170
|
+
if (a > 0) {
|
|
22171
|
+
const g = o.splice(0, a);
|
|
22172
|
+
m && (e.full += (e.full === "" ? "" : `
|
|
22173
|
+
`) + g.join(`
|
|
21587
22174
|
`));
|
|
21588
22175
|
}
|
|
21589
|
-
|
|
22176
|
+
e.value = o.join(`
|
|
21590
22177
|
`);
|
|
21591
22178
|
}
|
|
21592
|
-
|
|
21593
|
-
},
|
|
21594
|
-
for (const
|
|
22179
|
+
d && y();
|
|
22180
|
+
}, y = () => {
|
|
22181
|
+
for (const e of n) e.result ? e.result.status === "error" ? log$1.error(e.result.message, {
|
|
21595
22182
|
output: r,
|
|
21596
22183
|
secondarySymbol: i,
|
|
21597
22184
|
spacing: 0
|
|
21598
|
-
}) :
|
|
22185
|
+
}) : log$1.success(e.result.message, {
|
|
21599
22186
|
output: r,
|
|
21600
22187
|
secondarySymbol: i,
|
|
21601
22188
|
spacing: 0
|
|
21602
|
-
}) :
|
|
21603
|
-
},
|
|
21604
|
-
|
|
22189
|
+
}) : e.value !== "" && h(e, 0);
|
|
22190
|
+
}, B = (e, s) => {
|
|
22191
|
+
f(false), e.result = s, d && y();
|
|
21605
22192
|
};
|
|
21606
22193
|
return {
|
|
21607
|
-
message(
|
|
21608
|
-
|
|
22194
|
+
message(e, s) {
|
|
22195
|
+
L(n[0], e, s);
|
|
21609
22196
|
},
|
|
21610
|
-
group(
|
|
21611
|
-
const
|
|
21612
|
-
header:
|
|
22197
|
+
group(e) {
|
|
22198
|
+
const s = {
|
|
22199
|
+
header: e,
|
|
21613
22200
|
value: "",
|
|
21614
22201
|
full: ""
|
|
21615
22202
|
};
|
|
21616
|
-
return n.push(
|
|
21617
|
-
message(
|
|
21618
|
-
|
|
22203
|
+
return n.push(s), {
|
|
22204
|
+
message(t, o) {
|
|
22205
|
+
L(s, t, o);
|
|
21619
22206
|
},
|
|
21620
|
-
error(
|
|
21621
|
-
|
|
22207
|
+
error(t) {
|
|
22208
|
+
B(s, {
|
|
21622
22209
|
status: "error",
|
|
21623
|
-
message:
|
|
22210
|
+
message: t
|
|
21624
22211
|
});
|
|
21625
22212
|
},
|
|
21626
|
-
success(
|
|
21627
|
-
|
|
22213
|
+
success(t) {
|
|
22214
|
+
B(s, {
|
|
21628
22215
|
status: "success",
|
|
21629
|
-
message:
|
|
22216
|
+
message: t
|
|
21630
22217
|
});
|
|
21631
22218
|
}
|
|
21632
22219
|
};
|
|
21633
22220
|
},
|
|
21634
|
-
error(
|
|
21635
|
-
|
|
22221
|
+
error(e, s) {
|
|
22222
|
+
f(true), log$1.error(e, {
|
|
21636
22223
|
output: r,
|
|
21637
22224
|
secondarySymbol: i,
|
|
21638
22225
|
spacing: 1
|
|
21639
|
-
}),
|
|
22226
|
+
}), s?.showLog !== false && T(), n.splice(1, n.length - 1), n[0].value = "", n[0].full = "";
|
|
21640
22227
|
},
|
|
21641
|
-
success(
|
|
21642
|
-
|
|
22228
|
+
success(e, s) {
|
|
22229
|
+
f(true), log$1.success(e, {
|
|
21643
22230
|
output: r,
|
|
21644
22231
|
secondarySymbol: i,
|
|
21645
22232
|
spacing: 1
|
|
21646
|
-
}),
|
|
22233
|
+
}), s?.showLog === true && T(), n.splice(1, n.length - 1), n[0].value = "", n[0].full = "";
|
|
21647
22234
|
}
|
|
21648
22235
|
};
|
|
21649
|
-
}
|
|
21650
|
-
|
|
21651
|
-
|
|
21652
|
-
|
|
21653
|
-
|
|
21654
|
-
|
|
21655
|
-
|
|
21656
|
-
|
|
22236
|
+
};
|
|
22237
|
+
const text = (e) => new n$2({
|
|
22238
|
+
validate: e.validate,
|
|
22239
|
+
placeholder: e.placeholder,
|
|
22240
|
+
defaultValue: e.defaultValue,
|
|
22241
|
+
initialValue: e.initialValue,
|
|
22242
|
+
output: e.output,
|
|
22243
|
+
signal: e.signal,
|
|
22244
|
+
input: e.input,
|
|
21657
22245
|
render() {
|
|
21658
|
-
const
|
|
21659
|
-
` : ""}${
|
|
21660
|
-
`,
|
|
22246
|
+
const i = e?.withGuide ?? settings.withGuide, s = `${`${i ? `${styleText("gray", S_BAR)}
|
|
22247
|
+
` : ""}${symbol(this.state)} `}${e.message}
|
|
22248
|
+
`, c = e.placeholder && e.placeholder.length > 0 ? styleText("inverse", e.placeholder[0]) + styleText("dim", e.placeholder.slice(1)) : styleText(["inverse", "hidden"], "_"), o = this.userInput ? this.userInputWithCursor : c, l = this.value ?? "";
|
|
21661
22249
|
switch (this.state) {
|
|
21662
22250
|
case "error": {
|
|
21663
|
-
const
|
|
22251
|
+
const n = this.error ? ` ${styleText("yellow", this.error)}` : "", r = i ? `${styleText("yellow", S_BAR)} ` : "", d = i ? styleText("yellow", S_BAR_END) : "";
|
|
21664
22252
|
return `${s.trim()}
|
|
21665
|
-
${
|
|
21666
|
-
${
|
|
22253
|
+
${r}${o}
|
|
22254
|
+
${d}${n}
|
|
21667
22255
|
`;
|
|
21668
22256
|
}
|
|
21669
22257
|
case "submit": {
|
|
21670
|
-
const
|
|
21671
|
-
return `${s}${
|
|
22258
|
+
const n = l ? ` ${styleText("dim", l)}` : "";
|
|
22259
|
+
return `${s}${i ? styleText("gray", S_BAR) : ""}${n}`;
|
|
21672
22260
|
}
|
|
21673
22261
|
case "cancel": {
|
|
21674
|
-
const
|
|
21675
|
-
return `${s}${
|
|
21676
|
-
${
|
|
22262
|
+
const n = l ? ` ${styleText(["strikethrough", "dim"], l)}` : "", r = i ? styleText("gray", S_BAR) : "";
|
|
22263
|
+
return `${s}${r}${n}${l.trim() ? `
|
|
22264
|
+
${r}` : ""}`;
|
|
21677
22265
|
}
|
|
21678
|
-
default: return `${s}${
|
|
21679
|
-
${
|
|
22266
|
+
default: return `${s}${i ? `${styleText("cyan", S_BAR)} ` : ""}${o}
|
|
22267
|
+
${i ? styleText("cyan", S_BAR_END) : ""}
|
|
21680
22268
|
`;
|
|
21681
22269
|
}
|
|
21682
22270
|
}
|
|
21683
22271
|
}).prompt();
|
|
21684
22272
|
//#endregion
|
|
22273
|
+
//#region src/prompts.ts
|
|
22274
|
+
const createStaticSpinner = ({ onCancel, output = process.stdout, withGuide } = {}) => {
|
|
22275
|
+
let active = false;
|
|
22276
|
+
let cancelled = false;
|
|
22277
|
+
let latestMessage = "";
|
|
22278
|
+
const logOptions = {
|
|
22279
|
+
output,
|
|
22280
|
+
withGuide
|
|
22281
|
+
};
|
|
22282
|
+
const finish = (message, log) => {
|
|
22283
|
+
if (!active) return;
|
|
22284
|
+
active = false;
|
|
22285
|
+
const finalMessage = message || latestMessage;
|
|
22286
|
+
if (finalMessage) log(finalMessage, logOptions);
|
|
22287
|
+
};
|
|
22288
|
+
return {
|
|
22289
|
+
start: (message = "") => {
|
|
22290
|
+
active = true;
|
|
22291
|
+
latestMessage = message;
|
|
22292
|
+
if (message) log$1.step(message, logOptions);
|
|
22293
|
+
},
|
|
22294
|
+
stop: (message) => finish(message, log$1.success),
|
|
22295
|
+
cancel: (message) => {
|
|
22296
|
+
const wasActive = active;
|
|
22297
|
+
cancelled = wasActive;
|
|
22298
|
+
finish(message, log$1.warn);
|
|
22299
|
+
if (wasActive) onCancel?.();
|
|
22300
|
+
},
|
|
22301
|
+
error: (message) => finish(message, log$1.error),
|
|
22302
|
+
message: (message = "") => {
|
|
22303
|
+
latestMessage = message;
|
|
22304
|
+
},
|
|
22305
|
+
clear: () => {
|
|
22306
|
+
active = false;
|
|
22307
|
+
},
|
|
22308
|
+
get isCancelled() {
|
|
22309
|
+
return cancelled;
|
|
22310
|
+
}
|
|
22311
|
+
};
|
|
22312
|
+
};
|
|
22313
|
+
const spinner = (options = {}) => {
|
|
22314
|
+
return isTTY(options.output ?? process.stdout) && !isCI() ? spinner$1(options) : createStaticSpinner(options);
|
|
22315
|
+
};
|
|
22316
|
+
const progress = (options = {}) => {
|
|
22317
|
+
if (isTTY(options.output ?? process.stdout) && !isCI()) return progress$1(options);
|
|
22318
|
+
const staticSpinner = createStaticSpinner(options);
|
|
22319
|
+
return {
|
|
22320
|
+
...staticSpinner,
|
|
22321
|
+
advance: (_step, message) => staticSpinner.message(message),
|
|
22322
|
+
get isCancelled() {
|
|
22323
|
+
return staticSpinner.isCancelled;
|
|
22324
|
+
}
|
|
22325
|
+
};
|
|
22326
|
+
};
|
|
22327
|
+
const tasks = async (taskList, options) => {
|
|
22328
|
+
for (const task of taskList) {
|
|
22329
|
+
if (task.enabled === false) continue;
|
|
22330
|
+
const taskSpinner = spinner(options);
|
|
22331
|
+
taskSpinner.start(task.title);
|
|
22332
|
+
const result = await task.task(taskSpinner.message);
|
|
22333
|
+
taskSpinner.stop(result || task.title);
|
|
22334
|
+
}
|
|
22335
|
+
};
|
|
22336
|
+
const p = {
|
|
22337
|
+
...dist_exports,
|
|
22338
|
+
progress,
|
|
22339
|
+
spinner,
|
|
22340
|
+
tasks
|
|
22341
|
+
};
|
|
22342
|
+
//#endregion
|
|
21685
22343
|
//#region src/LogWriter.ts
|
|
21686
22344
|
const initializedLogFilesInProcess = /* @__PURE__ */ new Set();
|
|
21687
22345
|
const stripAnsi = (value) => {
|
|
@@ -21727,7 +22385,7 @@ const createLogWriter = async ({ prefix, logFilePath }) => {
|
|
|
21727
22385
|
stream.write(`[${(/* @__PURE__ */ new Date()).toISOString()}] ${sanitizedPrefix}\n`);
|
|
21728
22386
|
stream.on("error", (error) => {
|
|
21729
22387
|
const message = error instanceof Error ? error.message : String(error);
|
|
21730
|
-
|
|
22388
|
+
p.log.warn(`Failed to write build logs: ${message}`);
|
|
21731
22389
|
});
|
|
21732
22390
|
const writeChunk = (value) => {
|
|
21733
22391
|
if (!stream.writable || stream.destroyed) return;
|
|
@@ -21757,7 +22415,7 @@ const createLogWriter = async ({ prefix, logFilePath }) => {
|
|
|
21757
22415
|
};
|
|
21758
22416
|
} catch (error) {
|
|
21759
22417
|
const message = error instanceof Error ? error.message : String(error);
|
|
21760
|
-
|
|
22418
|
+
p.log.warn(`Failed to initialize build log file: ${message}`);
|
|
21761
22419
|
return {
|
|
21762
22420
|
logFilePath: null,
|
|
21763
22421
|
writeStream: async () => {},
|
|
@@ -21827,7 +22485,7 @@ var BuildLogger = class {
|
|
|
21827
22485
|
constructor(config) {
|
|
21828
22486
|
this.config = config;
|
|
21829
22487
|
this.stageCount = config.progressStages.length;
|
|
21830
|
-
this.promptProgress =
|
|
22488
|
+
this.promptProgress = p.progress({
|
|
21831
22489
|
indicator: "timer",
|
|
21832
22490
|
max: config.progressStages.length,
|
|
21833
22491
|
delay: 500
|
|
@@ -21920,7 +22578,7 @@ var BuildLogger = class {
|
|
|
21920
22578
|
if (!this.logWriter?.logFilePath) return;
|
|
21921
22579
|
const relativePath = path.relative(getCwd(), this.logWriter.logFilePath);
|
|
21922
22580
|
const highlightedPath = typedColors.blueBright(relativePath);
|
|
21923
|
-
|
|
22581
|
+
p.log.info(`Build log stored at ${highlightedPath}`);
|
|
21924
22582
|
}
|
|
21925
22583
|
};
|
|
21926
22584
|
//#endregion
|
|
@@ -24378,7 +25036,7 @@ while (this[Ns](this[Ae]()) && this[b].length);
|
|
|
24378
25036
|
return zr;
|
|
24379
25037
|
}
|
|
24380
25038
|
};
|
|
24381
|
-
var Xr = fs.writev, ot
|
|
25039
|
+
var Xr = fs.writev, ot = Symbol("_autoClose"), H = Symbol("_close"), te = Symbol("_ended"), m = Symbol("_fd"), Ni = Symbol("_finished"), j = Symbol("_flags"), Di = Symbol("_flush"), Ci = Symbol("_handleChunk"), ki = Symbol("_makeBuf"), ie = Symbol("_mode"), Ce = Symbol("_needDrain"), Ut = Symbol("_onerror"), Ht = Symbol("_onopen"), Ai = Symbol("_onread"), Pt = Symbol("_onwrite"), ht = Symbol("_open"), U = Symbol("_path"), nt = Symbol("_pos"), Y = Symbol("_queue"), zt = Symbol("_read"), Ii = Symbol("_readSize"), J = Symbol("_reading"), ee = Symbol("_remain"), Fi = Symbol("_size"), ke = Symbol("_write"), gt = Symbol("_writing"), ve = Symbol("_defaultFlag"), bt = Symbol("_errored"), _t = class extends A {
|
|
24382
25040
|
[bt] = !1;
|
|
24383
25041
|
[m];
|
|
24384
25042
|
[U];
|
|
@@ -24386,10 +25044,10 @@ var Xr = fs.writev, ot$1 = Symbol("_autoClose"), H = Symbol("_close"), te = Symb
|
|
|
24386
25044
|
[J] = !1;
|
|
24387
25045
|
[Fi];
|
|
24388
25046
|
[ee];
|
|
24389
|
-
[ot
|
|
25047
|
+
[ot];
|
|
24390
25048
|
constructor(t, e) {
|
|
24391
25049
|
if (e = e || {}, super(e), this.readable = !0, this.writable = !1, typeof t != "string") throw new TypeError("path must be a string");
|
|
24392
|
-
this[bt] = !1, this[m] = typeof e.fd == "number" ? e.fd : void 0, this[U] = t, this[Ii] = e.readSize || 16 * 1024 * 1024, this[J] = !1, this[Fi] = typeof e.size == "number" ? e.size : Infinity, this[ee] = this[Fi], this[ot
|
|
25050
|
+
this[bt] = !1, this[m] = typeof e.fd == "number" ? e.fd : void 0, this[U] = t, this[Ii] = e.readSize || 16 * 1024 * 1024, this[J] = !1, this[Fi] = typeof e.size == "number" ? e.size : Infinity, this[ee] = this[Fi], this[ot] = typeof e.autoClose == "boolean" ? e.autoClose : !0, typeof this[m] == "number" ? this[zt]() : this[ht]();
|
|
24393
25051
|
}
|
|
24394
25052
|
get fd() {
|
|
24395
25053
|
return this[m];
|
|
@@ -24424,7 +25082,7 @@ var Xr = fs.writev, ot$1 = Symbol("_autoClose"), H = Symbol("_close"), te = Symb
|
|
|
24424
25082
|
this[J] = !1, t ? this[Ut](t) : this[Ci](e, i) && this[zt]();
|
|
24425
25083
|
}
|
|
24426
25084
|
[H]() {
|
|
24427
|
-
if (this[ot
|
|
25085
|
+
if (this[ot] && typeof this[m] == "number") {
|
|
24428
25086
|
let t = this[m];
|
|
24429
25087
|
this[m] = void 0, fs.close(t, (e) => e ? this.emit("error", e) : this.emit("close"));
|
|
24430
25088
|
}
|
|
@@ -24471,7 +25129,7 @@ var Xr = fs.writev, ot$1 = Symbol("_autoClose"), H = Symbol("_close"), te = Symb
|
|
|
24471
25129
|
}
|
|
24472
25130
|
}
|
|
24473
25131
|
[H]() {
|
|
24474
|
-
if (this[ot
|
|
25132
|
+
if (this[ot] && typeof this[m] == "number") {
|
|
24475
25133
|
let t = this[m];
|
|
24476
25134
|
this[m] = void 0, fs.closeSync(t), this.emit("close");
|
|
24477
25135
|
}
|
|
@@ -24486,14 +25144,14 @@ var Xr = fs.writev, ot$1 = Symbol("_autoClose"), H = Symbol("_close"), te = Symb
|
|
|
24486
25144
|
[Ce] = !1;
|
|
24487
25145
|
[U];
|
|
24488
25146
|
[ie];
|
|
24489
|
-
[ot
|
|
25147
|
+
[ot];
|
|
24490
25148
|
[m];
|
|
24491
25149
|
[ve];
|
|
24492
25150
|
[j];
|
|
24493
25151
|
[Ni] = !1;
|
|
24494
25152
|
[nt];
|
|
24495
25153
|
constructor(t, e) {
|
|
24496
|
-
e = e || {}, super(e), this[U] = t, this[m] = typeof e.fd == "number" ? e.fd : void 0, this[ie] = e.mode === void 0 ? 438 : e.mode, this[nt] = typeof e.start == "number" ? e.start : void 0, this[ot
|
|
25154
|
+
e = e || {}, super(e), this[U] = t, this[m] = typeof e.fd == "number" ? e.fd : void 0, this[ie] = e.mode === void 0 ? 438 : e.mode, this[nt] = typeof e.start == "number" ? e.start : void 0, this[ot] = typeof e.autoClose == "boolean" ? e.autoClose : !0;
|
|
24497
25155
|
let i = this[nt] !== void 0 ? "r+" : "w";
|
|
24498
25156
|
this[ve] = e.flags === void 0, this[j] = e.flags === void 0 ? i : e.flags, this[m] === void 0 && this[ht]();
|
|
24499
25157
|
}
|
|
@@ -24540,7 +25198,7 @@ var Xr = fs.writev, ot$1 = Symbol("_autoClose"), H = Symbol("_close"), te = Symb
|
|
|
24540
25198
|
}
|
|
24541
25199
|
}
|
|
24542
25200
|
[H]() {
|
|
24543
|
-
if (this[ot
|
|
25201
|
+
if (this[ot] && typeof this[m] == "number") {
|
|
24544
25202
|
let t = this[m];
|
|
24545
25203
|
this[m] = void 0, fs.close(t, (e) => e ? this.emit("error", e) : this.emit("close"));
|
|
24546
25204
|
}
|
|
@@ -24558,7 +25216,7 @@ var Xr = fs.writev, ot$1 = Symbol("_autoClose"), H = Symbol("_close"), te = Symb
|
|
|
24558
25216
|
this[Ht](null, t);
|
|
24559
25217
|
}
|
|
24560
25218
|
[H]() {
|
|
24561
|
-
if (this[ot
|
|
25219
|
+
if (this[ot] && typeof this[m] == "number") {
|
|
24562
25220
|
let t = this[m];
|
|
24563
25221
|
this[m] = void 0, fs.closeSync(t), this.emit("close");
|
|
24564
25222
|
}
|
|
@@ -25192,7 +25850,7 @@ var Tn = 1024 * 1024, Vi = Buffer.from([31, 139]), $i = Buffer.from([
|
|
|
25192
25850
|
181,
|
|
25193
25851
|
47,
|
|
25194
25852
|
253
|
|
25195
|
-
]), xn = Math.max(Vi.length, $i.length), B = Symbol("state"), Dt = Symbol("writeEntry"), et = Symbol("readEntry"), Gi = Symbol("nextEntry"), Ws = Symbol("processEntry"), V = Symbol("extendedHeader"), he = Symbol("globalExtendedHeader"), ft = Symbol("meta"), Gs = Symbol("emitMeta"), p = Symbol("buffer"), it = Symbol("queue"), dt = Symbol("ended"), Zi = Symbol("emittedEnd"), At = Symbol("emit"), y = Symbol("unzip"), $e = Symbol("consumeChunk"), Xe = Symbol("consumeChunkSub"), Yi = Symbol("consumeBody"), Zs = Symbol("consumeMeta"), Ys = Symbol("consumeHeader"), ae = Symbol("consuming"), Ki = Symbol("bufferConcat"), qe = Symbol("maybeEnd"), Yt = Symbol("writing"), ut = Symbol("aborted"), Qe = Symbol("onDone"), It = Symbol("sawValidEntry"), Je = Symbol("sawNullBlock"), je = Symbol("sawEOF"), Ks = Symbol("closeStream"), Ln = () => !0, st = class extends EventEmitter {
|
|
25853
|
+
]), xn = Math.max(Vi.length, $i.length), B = Symbol("state"), Dt = Symbol("writeEntry"), et = Symbol("readEntry"), Gi = Symbol("nextEntry"), Ws = Symbol("processEntry"), V = Symbol("extendedHeader"), he = Symbol("globalExtendedHeader"), ft = Symbol("meta"), Gs = Symbol("emitMeta"), p$1 = Symbol("buffer"), it = Symbol("queue"), dt = Symbol("ended"), Zi = Symbol("emittedEnd"), At = Symbol("emit"), y = Symbol("unzip"), $e = Symbol("consumeChunk"), Xe = Symbol("consumeChunkSub"), Yi = Symbol("consumeBody"), Zs = Symbol("consumeMeta"), Ys = Symbol("consumeHeader"), ae = Symbol("consuming"), Ki = Symbol("bufferConcat"), qe = Symbol("maybeEnd"), Yt = Symbol("writing"), ut = Symbol("aborted"), Qe = Symbol("onDone"), It = Symbol("sawValidEntry"), Je = Symbol("sawNullBlock"), je = Symbol("sawEOF"), Ks = Symbol("closeStream"), Ln = () => !0, st = class extends EventEmitter {
|
|
25196
25854
|
file;
|
|
25197
25855
|
strict;
|
|
25198
25856
|
maxMetaEntrySize;
|
|
@@ -25202,7 +25860,7 @@ var Tn = 1024 * 1024, Vi = Buffer.from([31, 139]), $i = Buffer.from([
|
|
|
25202
25860
|
writable = !0;
|
|
25203
25861
|
readable = !1;
|
|
25204
25862
|
[it] = [];
|
|
25205
|
-
[p];
|
|
25863
|
+
[p$1];
|
|
25206
25864
|
[et];
|
|
25207
25865
|
[Dt];
|
|
25208
25866
|
[B] = "begin";
|
|
@@ -25325,7 +25983,7 @@ while (this[Ws](this[it].shift()));
|
|
|
25325
25983
|
write(t, e, i) {
|
|
25326
25984
|
if (typeof e == "function" && (i = e, e = void 0), typeof t == "string" && (t = Buffer.from(t, typeof e == "string" ? e : "utf8")), this[ut]) return i?.(), !1;
|
|
25327
25985
|
if ((this[y] === void 0 || this.brotli === void 0 && this[y] === !1) && t) {
|
|
25328
|
-
if (this[p] && (t = Buffer.concat([this[p], t]), this[p] = void 0), t.length < xn) return this[p] = t, i?.(), !0;
|
|
25986
|
+
if (this[p$1] && (t = Buffer.concat([this[p$1], t]), this[p$1] = void 0), t.length < xn) return this[p$1] = t, i?.(), !0;
|
|
25329
25987
|
for (let h = 0; this[y] === void 0 && h < Vi.length; h++) t[h] !== Vi[h] && (this[y] = !1);
|
|
25330
25988
|
let o = !1;
|
|
25331
25989
|
if (this[y] === !1 && this.zstd !== !1) {
|
|
@@ -25337,7 +25995,7 @@ while (this[Ws](this[it].shift()));
|
|
|
25337
25995
|
}
|
|
25338
25996
|
let a = this.brotli === void 0 && !o;
|
|
25339
25997
|
if (this[y] === !1 && a) if (t.length < 512) if (this[dt]) this.brotli = !0;
|
|
25340
|
-
else return this[p] = t, i?.(), !0;
|
|
25998
|
+
else return this[p$1] = t, i?.(), !0;
|
|
25341
25999
|
else try {
|
|
25342
26000
|
new C(t.subarray(0, 512)), this.brotli = !1;
|
|
25343
26001
|
} catch {
|
|
@@ -25357,35 +26015,35 @@ while (this[Ws](this[it].shift()));
|
|
|
25357
26015
|
return !n && this[it].length === 0 && this[et]?.once("drain", () => this.emit("drain")), i?.(), n;
|
|
25358
26016
|
}
|
|
25359
26017
|
[Ki](t) {
|
|
25360
|
-
t && !this[ut] && (this[p] = this[p] ? Buffer.concat([this[p], t]) : t);
|
|
26018
|
+
t && !this[ut] && (this[p$1] = this[p$1] ? Buffer.concat([this[p$1], t]) : t);
|
|
25361
26019
|
}
|
|
25362
26020
|
[qe]() {
|
|
25363
26021
|
if (this[dt] && !this[Zi] && !this[ut] && !this[ae]) {
|
|
25364
26022
|
this[Zi] = !0;
|
|
25365
26023
|
let t = this[Dt];
|
|
25366
26024
|
if (t && t.blockRemain) {
|
|
25367
|
-
let e = this[p] ? this[p].length : 0;
|
|
25368
|
-
this.warn("TAR_BAD_ARCHIVE", `Truncated input (needed ${t.blockRemain} more bytes, only ${e} available)`, { entry: t }), this[p] && t.write(this[p]), t.end();
|
|
26025
|
+
let e = this[p$1] ? this[p$1].length : 0;
|
|
26026
|
+
this.warn("TAR_BAD_ARCHIVE", `Truncated input (needed ${t.blockRemain} more bytes, only ${e} available)`, { entry: t }), this[p$1] && t.write(this[p$1]), t.end();
|
|
25369
26027
|
}
|
|
25370
26028
|
this[At](Qe);
|
|
25371
26029
|
}
|
|
25372
26030
|
}
|
|
25373
26031
|
[$e](t) {
|
|
25374
26032
|
if (this[ae] && t) this[Ki](t);
|
|
25375
|
-
else if (!t && !this[p]) this[qe]();
|
|
26033
|
+
else if (!t && !this[p$1]) this[qe]();
|
|
25376
26034
|
else if (t) {
|
|
25377
|
-
if (this[ae] = !0, this[p]) {
|
|
26035
|
+
if (this[ae] = !0, this[p$1]) {
|
|
25378
26036
|
this[Ki](t);
|
|
25379
|
-
let e = this[p];
|
|
25380
|
-
this[p] = void 0, this[Xe](e);
|
|
26037
|
+
let e = this[p$1];
|
|
26038
|
+
this[p$1] = void 0, this[Xe](e);
|
|
25381
26039
|
} else this[Xe](t);
|
|
25382
|
-
for (; this[p] && this[p]?.length >= 512 && !this[ut] && !this[je];) {
|
|
25383
|
-
let e = this[p];
|
|
25384
|
-
this[p] = void 0, this[Xe](e);
|
|
26040
|
+
for (; this[p$1] && this[p$1]?.length >= 512 && !this[ut] && !this[je];) {
|
|
26041
|
+
let e = this[p$1];
|
|
26042
|
+
this[p$1] = void 0, this[Xe](e);
|
|
25385
26043
|
}
|
|
25386
26044
|
this[ae] = !1;
|
|
25387
26045
|
}
|
|
25388
|
-
(!this[p] || this[dt]) && this[qe]();
|
|
26046
|
+
(!this[p$1] || this[dt]) && this[qe]();
|
|
25389
26047
|
}
|
|
25390
26048
|
[Xe](t) {
|
|
25391
26049
|
let e = 0, i = t.length;
|
|
@@ -25403,7 +26061,7 @@ while (this[Ws](this[it].shift()));
|
|
|
25403
26061
|
break;
|
|
25404
26062
|
default: throw new Error("invalid state: " + this[B]);
|
|
25405
26063
|
}
|
|
25406
|
-
e < i && (this[p] = this[p] ? Buffer.concat([t.subarray(e), this[p]]) : t.subarray(e));
|
|
26064
|
+
e < i && (this[p$1] = this[p$1] ? Buffer.concat([t.subarray(e), this[p$1]]) : t.subarray(e));
|
|
25407
26065
|
}
|
|
25408
26066
|
end(t, e, i) {
|
|
25409
26067
|
return typeof t == "function" && (i = t, e = void 0, t = void 0), typeof e == "function" && (i = e, e = void 0), typeof t == "string" && (t = Buffer.from(t, e)), i && this.once("finish", i), this[ut] || (this[y] ? (t && this[y].write(t), this[y].end()) : (this[dt] = !0, (this.brotli === void 0 || this.zstd === void 0) && (t = t || Buffer.alloc(0)), t && this.write(t), this[qe]())), this;
|
|
@@ -42145,7 +42803,7 @@ const ensureInstallPackages = async (packages, options) => {
|
|
|
42145
42803
|
return !pkgJson?.packageJson?.devDependencies?.[pkg];
|
|
42146
42804
|
});
|
|
42147
42805
|
const packageManager = getPackageManager();
|
|
42148
|
-
await
|
|
42806
|
+
await p.tasks([{
|
|
42149
42807
|
enabled: dependenciesToInstall.length > 0,
|
|
42150
42808
|
title: "Installing dependencies",
|
|
42151
42809
|
task: async (message) => {
|
|
@@ -42153,13 +42811,13 @@ const ensureInstallPackages = async (packages, options) => {
|
|
|
42153
42811
|
try {
|
|
42154
42812
|
const result = await execa(packageManager, [packageManager === "yarn" ? "add" : "install", ...dependenciesToInstall.map(versionResolver)]);
|
|
42155
42813
|
if (result.exitCode !== 0 && result.stderr) {
|
|
42156
|
-
|
|
42814
|
+
p.log.error(result.stderr);
|
|
42157
42815
|
process.exit(1);
|
|
42158
42816
|
}
|
|
42159
42817
|
return `Installed ${dependenciesToInstall.join(", ")}`;
|
|
42160
42818
|
} catch (e) {
|
|
42161
|
-
if (e instanceof ExecaError)
|
|
42162
|
-
else if (e instanceof Error)
|
|
42819
|
+
if (e instanceof ExecaError) p.log.error(e.stderr || e.stdout || e.message);
|
|
42820
|
+
else if (e instanceof Error) p.log.error(e.message);
|
|
42163
42821
|
process.exit(1);
|
|
42164
42822
|
}
|
|
42165
42823
|
}
|
|
@@ -42175,13 +42833,13 @@ const ensureInstallPackages = async (packages, options) => {
|
|
|
42175
42833
|
packageManager === "yarn" ? "--dev" : "--save-dev"
|
|
42176
42834
|
]);
|
|
42177
42835
|
if (result.exitCode !== 0 && result.stderr) {
|
|
42178
|
-
|
|
42836
|
+
p.log.error(result.stderr);
|
|
42179
42837
|
process.exit(1);
|
|
42180
42838
|
}
|
|
42181
42839
|
return `Installed ${devDependenciesToInstall.join(", ")}`;
|
|
42182
42840
|
} catch (e) {
|
|
42183
|
-
if (e instanceof ExecaError)
|
|
42184
|
-
else if (e instanceof Error)
|
|
42841
|
+
if (e instanceof ExecaError) p.log.error(e.stderr || e.stdout || e.message);
|
|
42842
|
+
else if (e instanceof Error) p.log.error(e.message);
|
|
42185
42843
|
process.exit(1);
|
|
42186
42844
|
}
|
|
42187
42845
|
}
|
|
@@ -42562,7 +43220,7 @@ const getReactNativeMetadatas = (cwd) => {
|
|
|
42562
43220
|
}
|
|
42563
43221
|
};
|
|
42564
43222
|
} catch (e) {
|
|
42565
|
-
|
|
43223
|
+
p.log.warn(`Failed to parse react-native dependency path. Default values will be returned. This can cause fatal issue in this process.\n${e}`);
|
|
42566
43224
|
return {
|
|
42567
43225
|
packagePath: path.join(cwd, "node_modules", "react-native"),
|
|
42568
43226
|
versionRaw: "0.0.0",
|
|
@@ -43570,4 +44228,4 @@ function transformTemplate(templateString, values) {
|
|
|
43570
44228
|
return result;
|
|
43571
44229
|
}
|
|
43572
44230
|
//#endregion
|
|
43573
|
-
export { BuildLogger, ConfigBuilder, HOT_UPDATER_SERVER_PACKAGE_VERSION_ENV, HotUpdateDirUtil, LEGACY_BUNDLE_ERROR, banner, typedColors as colors, copyDirToTmp, createCopiedBundleArchive, createHotUpdaterConfigScaffold, createHotUpdaterConfigScaffoldFromBuilder, createLogWriter, createTarBr, createTarBrTargetFiles, createTarGz, createTarGzTargetFiles, createZip, createZipTargetFiles, decryptJson, encryptJson, ensureInstallPackages, getAndroidSdkPath, getCwd, getPackageManager, getReactNativeMetadatas, link, loadConfig, log, makeEnv,
|
|
44231
|
+
export { BuildLogger, ConfigBuilder, HOT_UPDATER_SERVER_PACKAGE_VERSION_ENV, HotUpdateDirUtil, LEGACY_BUNDLE_ERROR, banner, typedColors as colors, copyDirToTmp, createCopiedBundleArchive, createHotUpdaterConfigScaffold, createHotUpdaterConfigScaffoldFromBuilder, createLogWriter, createTarBr, createTarBrTargetFiles, createTarGz, createTarGzTargetFiles, createZip, createZipTargetFiles, decryptJson, encryptJson, ensureInstallPackages, getAndroidSdkPath, getCwd, getPackageManager, getReactNativeMetadatas, link, loadConfig, log, makeEnv, p, printBanner, promoteBundle, readPackageUp, renderImportStatements, resolveHotUpdaterServerVersion, resolvePackageVersion, stripAnsi, transformEnv, transformTemplate, writeHotUpdaterConfig };
|