@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.
Files changed (3) hide show
  1. package/dist/index.d.mts +742 -37
  2. package/dist/index.mjs +1969 -1311
  3. 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 k from "node:readline";
14
- import ot from "node:readline";
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$13 = __require("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$13.resolve(cwd, filepath);
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$12 = __require("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$12.sep,
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$11 = __require("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$11.sep === "\\";
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$10 = __require("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$10.basename(input));
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$9 = __require("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$9.basename(pattern);
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$9.isAbsolute(pattern);
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$8 = __require("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$8.sep);
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$7 = __require("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$7.sep);
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$6 = __require("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$6.resolve(this._settings.cwd, filepath);
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$5 = __require("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$5.resolve(this._settings.cwd, task.base);
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/@clack+core@1.0.1/node_modules/@clack/core/dist/index.mjs
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 B$1(t, e, s) {
19854
- if (!s.some((u) => !u.disabled)) return t;
19855
- const i = t + e, r = Math.max(s.length - 1, 0), n = i < 0 ? r : i > r ? 0 : i;
19856
- return s[n].disabled ? B$1(n, e < 0 ? -1 : 1, s) : n;
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
- const at$2 = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 170 || t === 173 || t === 174 || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || t === 198 || t === 208 || t === 215 || t === 216 || t >= 222 && t <= 225 || t === 230 || t >= 232 && t <= 234 || t === 236 || t === 237 || t === 240 || t === 242 || t === 243 || t >= 247 && t <= 250 || t === 252 || t === 254 || t === 257 || t === 273 || t === 275 || t === 283 || t === 294 || t === 295 || t === 299 || t >= 305 && t <= 307 || t === 312 || t >= 319 && t <= 322 || t === 324 || t >= 328 && t <= 331 || t === 333 || t === 338 || t === 339 || t === 358 || t === 359 || t === 363 || t === 462 || t === 464 || t === 466 || t === 468 || t === 470 || t === 472 || t === 474 || t === 476 || t === 593 || t === 609 || t === 708 || t === 711 || t >= 713 && t <= 715 || t === 717 || t === 720 || t >= 728 && t <= 731 || t === 733 || t === 735 || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || t === 1025 || t >= 1040 && t <= 1103 || t === 1105 || t === 8208 || t >= 8211 && t <= 8214 || t === 8216 || t === 8217 || t === 8220 || t === 8221 || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || t === 8240 || t === 8242 || t === 8243 || t === 8245 || t === 8251 || t === 8254 || t === 8308 || t === 8319 || t >= 8321 && t <= 8324 || t === 8364 || t === 8451 || t === 8453 || t === 8457 || t === 8467 || t === 8470 || t === 8481 || t === 8482 || t === 8486 || t === 8491 || t === 8531 || t === 8532 || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || t === 8585 || t >= 8592 && t <= 8601 || t === 8632 || t === 8633 || t === 8658 || t === 8660 || t === 8679 || t === 8704 || t === 8706 || t === 8707 || t === 8711 || t === 8712 || t === 8715 || t === 8719 || t === 8721 || t === 8725 || t === 8730 || t >= 8733 && t <= 8736 || t === 8739 || t === 8741 || t >= 8743 && t <= 8748 || t === 8750 || t >= 8756 && t <= 8759 || t === 8764 || t === 8765 || t === 8776 || t === 8780 || t === 8786 || t === 8800 || t === 8801 || t >= 8804 && t <= 8807 || t === 8810 || t === 8811 || t === 8814 || t === 8815 || t === 8834 || t === 8835 || t === 8838 || t === 8839 || t === 8853 || t === 8857 || t === 8869 || t === 8895 || t === 8978 || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || t === 9632 || t === 9633 || t >= 9635 && t <= 9641 || t === 9650 || t === 9651 || t === 9654 || t === 9655 || t === 9660 || t === 9661 || t === 9664 || t === 9665 || t >= 9670 && t <= 9672 || t === 9675 || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || t === 9711 || t === 9733 || t === 9734 || t === 9737 || t === 9742 || t === 9743 || t === 9756 || t === 9758 || t === 9792 || t === 9794 || t === 9824 || t === 9825 || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || t === 9836 || t === 9837 || t === 9839 || t === 9886 || t === 9887 || t === 9919 || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || t === 9955 || t === 9960 || t === 9961 || t >= 9963 && t <= 9969 || t === 9972 || t >= 9974 && t <= 9977 || t === 9979 || t === 9980 || t === 9982 || t === 9983 || t === 10045 || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || t === 65533 || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || t === 127375 || t === 127376 || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109, lt$2 = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510, ht$2 = (t) => t >= 4352 && t <= 4447 || t === 8986 || t === 8987 || t === 9001 || t === 9002 || t >= 9193 && t <= 9196 || t === 9200 || t === 9203 || t === 9725 || t === 9726 || t === 9748 || t === 9749 || t >= 9800 && t <= 9811 || t === 9855 || t === 9875 || t === 9889 || t === 9898 || t === 9899 || t === 9917 || t === 9918 || t === 9924 || t === 9925 || t === 9934 || t === 9940 || t === 9962 || t === 9970 || t === 9971 || t === 9973 || t === 9978 || t === 9981 || t === 9989 || t === 9994 || t === 9995 || t === 10024 || t === 10060 || t === 10062 || t >= 10067 && t <= 10069 || t === 10071 || t >= 10133 && t <= 10135 || t === 10160 || t === 10175 || t === 11035 || t === 11036 || t === 11088 || t === 11093 || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || t === 94192 || t === 94193 || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || t === 110589 || t === 110590 || t >= 110592 && t <= 110882 || t === 110898 || t >= 110928 && t <= 110930 || t === 110933 || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || t === 126980 || t === 127183 || t === 127374 || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || t === 127568 || t === 127569 || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || t === 127988 || t >= 127992 && t <= 128062 || t === 128064 || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || t === 128378 || t === 128405 || t === 128406 || t === 128420 || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || t === 128716 || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || t === 128747 || t === 128748 || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || t === 129008 || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141, O$1 = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y, y$1 = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, L$1 = /\t{1,1000}/y, P$1 = /[\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, M$2 = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, ct$2 = /\p{M}+/gu, ft$2 = {
19859
- limit: Infinity,
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 _$1 = {
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: !0
20031
- };
20032
- function It$2(t) {
20033
- if (t.aliases !== void 0) {
20034
- const e = t.aliases;
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
- _$1.actions.has(i) && (_$1.aliases.has(s) || _$1.aliases.set(s, i));
20208
+ i === void 0 || !settings.actions.has(i) || settings.aliases.has(s) || settings.aliases.set(s, i);
20039
20209
  }
20040
20210
  }
20041
- if (t.messages !== void 0) {
20042
- const e = t.messages;
20043
- e.cancel !== void 0 && (_$1.messages.cancel = e.cancel), e.error !== void 0 && (_$1.messages.error = e.error);
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 H$2(t, e) {
20048
- if (typeof t == "string") return _$1.aliases.get(t) === e;
20049
- for (const s of t) if (s !== void 0 && H$2(s, e)) return !0;
20050
- return !1;
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 _t$1(t, e) {
20053
- if (t === e) return;
20054
- const s = t.split(`
20055
- `), i = e.split(`
20056
- `), r = Math.max(s.length, i.length), n = [];
20057
- for (let u = 0; u < r; u++) s[u] !== i[u] && n.push(u);
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: n,
20060
- numLinesBefore: s.length,
20061
- numLinesAfter: i.length,
20232
+ lines: f,
20233
+ numLinesBefore: e.length,
20234
+ numLinesAfter: t.length,
20062
20235
  numLines: r
20063
20236
  };
20064
20237
  }
20065
- const bt$2 = globalThis.process.platform.startsWith("win"), z$1 = Symbol("clack:cancel");
20066
- function Ct$2(t) {
20067
- return t === z$1;
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 T(t, e) {
20070
- const s = t;
20071
- s.isTTY && s.setRawMode(e);
20243
+ function setRawMode(e, r) {
20244
+ const o = e;
20245
+ o.isTTY && o.setRawMode(r);
20072
20246
  }
20073
- function Bt$1({ input: t = stdin, output: e = stdout, overwrite: s = !0, hideCursor: i = !0 } = {}) {
20074
- const r = k.createInterface({
20075
- input: t,
20076
- output: e,
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
- k.emitKeypressEvents(t, r), t instanceof ReadStream && t.isTTY && t.setRawMode(!0);
20081
- const n = (u, { name: a, sequence: l }) => {
20082
- if (H$2([
20083
- String(u),
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
- l
20259
+ p
20086
20260
  ], "cancel")) {
20087
- i && e.write(import_src.cursor.show), process.exit(0);
20261
+ t && r.write(import_src.cursor.show), process.exit(0);
20088
20262
  return;
20089
20263
  }
20090
- if (!s) return;
20091
- const g = a === "return" ? 0 : -1, m = a === "return" ? -1 : 0;
20092
- k.moveCursor(e, g, m, () => {
20093
- k.clearLine(e, 1, () => {
20094
- t.once("keypress", n);
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 i && e.write(import_src.cursor.hide), t.once("keypress", n), () => {
20099
- t.off("keypress", n), i && e.write(import_src.cursor.show), t instanceof ReadStream && t.isTTY && !bt$2 && t.setRawMode(!1), r.terminal = !1, r.close();
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 rt$2 = (t) => "columns" in t && typeof t.columns == "number" ? t.columns : 80, nt$2 = (t) => "rows" in t && typeof t.rows == "number" ? t.rows : 20;
20103
- function xt$1(t, e, s, i = s) {
20104
- return K$2(e, rt$2(t ?? stdout) - s.length, {
20105
- hard: !0,
20106
- trim: !1
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((n, u) => `${u === 0 ? i : s}${n}`).join(`
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
- var x$1 = class {
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 = !1;
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(e, s = !0) {
20127
- const { input: i = stdin, output: r = stdout, render: n, signal: u, ...a } = e;
20128
- this.opts = a, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = s, this._abortSignal = u, this.input = i, this.output = r;
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
- setSubscriber(e, s) {
20134
- const i = this._subscribers.get(e) ?? [];
20135
- i.push(s), this._subscribers.set(e, i);
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
- on(e, s) {
20138
- this.setSubscriber(e, { cb: s });
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
- once(e, s) {
20141
- this.setSubscriber(e, {
20142
- cb: s,
20143
- once: !0
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
- emit(e, ...s) {
20147
- const i = this._subscribers.get(e) ?? [], r = [];
20148
- for (const n of i) n.cb(...s), n.once && r.push(() => i.splice(i.indexOf(n), 1));
20149
- for (const n of r) n();
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((e) => {
20359
+ return new Promise((t) => {
20153
20360
  if (this._abortSignal) {
20154
- if (this._abortSignal.aborted) return this.state = "cancel", this.close(), e(z$1);
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: !0 });
20364
+ }, { once: true });
20158
20365
  }
20159
- this.rl = ot.createInterface({
20366
+ this.rl = l__default.createInterface({
20160
20367
  input: this.input,
20161
20368
  tabSize: 2,
20162
20369
  prompt: "",
20163
20370
  escapeCodeTimeout: 50,
20164
- terminal: !0
20165
- }), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress), T(this.input, !0), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
20166
- this.output.write(import_src.cursor.show), this.output.off("resize", this.render), T(this.input, !1), e(this.value);
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), T(this.input, !1), e(z$1);
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(e, s) {
20173
- return e === " ";
20379
+ _isActionKey(t, e) {
20380
+ return t === " ";
20174
20381
  }
20175
- _setValue(e) {
20176
- this.value = e, this.emit("value", this.value);
20382
+ _shouldSubmit(t, e) {
20383
+ return true;
20384
+ }
20385
+ _setValue(t) {
20386
+ this.value = t, this.emit("value", this.value);
20177
20387
  }
20178
- _setUserInput(e, s) {
20179
- this.userInput = e ?? "", this.emit("userInput", this.userInput), s && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
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: !0,
20393
+ ctrl: true,
20184
20394
  name: "u"
20185
20395
  }), this._setUserInput("");
20186
20396
  }
20187
- onKeypress(e, s) {
20188
- if (this._track && s.name !== "return" && (s.name && this._isActionKey(e, s) && this.rl?.write(null, {
20189
- ctrl: !0,
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"), s?.name && (!this._track && _$1.aliases.has(s.name) && this.emit("cursor", _$1.aliases.get(s.name)), _$1.actions.has(s.name) && this.emit("cursor", s.name)), e && (e.toLowerCase() === "y" || e.toLowerCase() === "n") && this.emit("confirm", e.toLowerCase() === "y"), this.emit("key", e?.toLowerCase(), s), s?.name === "return") {
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(this.value);
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
- H$2([
20199
- e,
20200
- s?.name,
20201
- s?.sequence
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
- `), T(this.input, !1), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
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 e = K$2(this._prevFrame, process.stdout.columns, {
20210
- hard: !0,
20211
- trim: !1
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, e * -1));
20424
+ this.output.write(import_src.cursor.move(-999, t * -1));
20215
20425
  }
20216
20426
  render() {
20217
- const e = K$2(this._render(this) ?? "", process.stdout.columns, {
20218
- hard: !0,
20219
- trim: !1
20427
+ const t = wrapAnsi$1(this._render(this) ?? "", process.stdout.columns, {
20428
+ hard: true,
20429
+ trim: false
20220
20430
  });
20221
- if (e !== this._prevFrame) {
20431
+ if (t !== this._prevFrame) {
20222
20432
  if (this.state === "initial") this.output.write(import_src.cursor.hide);
20223
20433
  else {
20224
- const s = _t$1(this._prevFrame, e), i = nt$2(this.output);
20225
- if (this.restoreCursor(), s) {
20226
- const r = Math.max(0, s.numLinesAfter - i), n = Math.max(0, s.numLinesBefore - i);
20227
- let u = s.lines.find((a) => a >= r);
20228
- if (u === void 0) {
20229
- this._prevFrame = e;
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 (s.lines.length === 1) {
20233
- this.output.write(import_src.cursor.move(0, u - n)), this.output.write(import_src.erase.lines(1));
20234
- const a = e.split(`
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(a[u]), this._prevFrame = e, this.output.write(import_src.cursor.move(0, a.length - u - 1));
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 (s.lines.length > 1) {
20239
- if (r < n) u = r;
20448
+ } else if (e.lines.length > 1) {
20449
+ if (n < s) r = n;
20240
20450
  else {
20241
- const l = u - n;
20242
- l > 0 && this.output.write(import_src.cursor.move(0, l));
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 a = e.split(`
20246
- `).slice(u);
20247
- this.output.write(a.join(`
20248
- `)), this._prevFrame = e;
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(e), this.state === "initial" && (this.state = "active"), this._prevFrame = e;
20464
+ this.output.write(t), this.state === "initial" && (this.state = "active"), this._prevFrame = t;
20255
20465
  }
20256
20466
  }
20257
20467
  };
20258
- function wt$2(t, e) {
20259
- if (t === void 0 || e.length === 0) return 0;
20260
- const s = e.findIndex((i) => i.value === t);
20261
- return s !== -1 ? s : 0;
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 Dt$2(t, e) {
20264
- return (e.label ?? String(e.value)).toLowerCase().includes(t.toLowerCase());
20473
+ function g$1(l, e) {
20474
+ return (e.label ?? String(e.value)).toLowerCase().includes(l.toLowerCase());
20265
20475
  }
20266
- function St$2(t, e) {
20267
- if (e) return t ? e : e[0];
20476
+ function m$2(l, e) {
20477
+ if (e) return l ? e : e[0];
20268
20478
  }
20269
- var Vt$2 = class extends x$1 {
20479
+ let T$1 = class T extends V$1 {
20270
20480
  filteredOptions;
20271
20481
  multiple;
20272
- isNavigating = !1;
20482
+ isNavigating = false;
20273
20483
  selectedValues = [];
20274
20484
  focusedValue;
20275
- #t = 0;
20485
+ #e = 0;
20276
20486
  #s = "";
20487
+ #t;
20277
20488
  #i;
20278
- #e;
20489
+ #n;
20279
20490
  get cursor() {
20280
- return this.#t;
20491
+ return this.#e;
20281
20492
  }
20282
20493
  get userInputWithCursor() {
20283
- if (!this.userInput) return import_picocolors.default.inverse(import_picocolors.default.hidden("_"));
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._cursor), [s, ...i] = this.userInput.slice(this._cursor);
20286
- return `${e}${import_picocolors.default.inverse(s)}${i.join("")}`;
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.#e == "function" ? this.#e() : this.#e;
20500
+ return typeof this.#i == "function" ? this.#i() : this.#i;
20290
20501
  }
20291
20502
  constructor(e) {
20292
- super(e), this.#e = e.options;
20293
- const s = this.options;
20294
- this.filteredOptions = [...s], this.multiple = e.multiple === !0, this.#i = e.filter ?? Dt$2;
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].value]), i) for (const r of i) {
20297
- const n = s.findIndex((u) => u.value === r);
20298
- n !== -1 && (this.toggleSelected(r), this.#t = n);
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.#t]?.value, this.on("key", (r, n) => this.#r(r, n)), this.on("userInput", (r) => this.#n(r));
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, s) {
20303
- return e === " " || this.multiple && this.isNavigating && s.name === "space" && e !== void 0 && e !== "";
20513
+ _isActionKey(e, t) {
20514
+ return e === " " || this.multiple && this.isNavigating && t.name === "space" && e !== void 0 && e !== "";
20304
20515
  }
20305
- #r(e, s) {
20306
- const i = s.name === "up", r = s.name === "down", n = s.name === "return";
20307
- i || r ? (this.#t = B$1(this.#t, i ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#t]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = !0) : n ? this.value = St$2(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== void 0 && (s.name === "tab" || this.isNavigating && s.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = !1 : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = !1);
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((s) => s !== e) : this.selectedValues = [...this.selectedValues, e] : this.selectedValues = [e]);
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
- #n(e) {
20530
+ #u(e) {
20316
20531
  if (e !== this.#s) {
20317
20532
  this.#s = e;
20318
- const s = this.options;
20319
- e ? this.filteredOptions = s.filter((n) => this.#i(e, n)) : this.filteredOptions = [...s];
20320
- this.#t = B$1(wt$2(this.focusedValue, this.filteredOptions), 0, this.filteredOptions);
20321
- const r = this.filteredOptions[this.#t];
20322
- r && !r.disabled ? this.focusedValue = r.value : this.focusedValue = void 0, this.multiple || (this.focusedValue !== void 0 ? this.toggleSelected(this.focusedValue) : this.deselectAll());
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 kt$2 = class extends x$1 {
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(e) {
20334
- super(e, !1), this.value = !!e.initialValue, this.on("userInput", () => {
20548
+ constructor(t) {
20549
+ super(t, false), this.value = !!t.initialValue, this.on("userInput", () => {
20335
20550
  this.value = this._value;
20336
- }), this.on("confirm", (s) => {
20337
- this.output.write(import_src.cursor.move(0, -1)), this.value = s, this.state = "submit", this.close();
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
- var yt$2 = class extends x$1 {
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(e) {
20348
- return this.options.filter((s) => s.group === e);
20811
+ getGroupItems(t) {
20812
+ return this.options.filter((r) => r.group === t);
20349
20813
  }
20350
- isGroupSelected(e) {
20351
- const s = this.getGroupItems(e), i = this.value;
20352
- return i === void 0 ? !1 : s.every((r) => i.includes(r.value));
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 e = this.options[this.cursor];
20356
- if (this.value === void 0 && (this.value = []), e.group === !0) {
20357
- const s = e.value, i = this.getGroupItems(s);
20358
- this.isGroupSelected(s) ? this.value = this.value.filter((r) => i.findIndex((n) => n.value === r) === -1) : this.value = [...this.value, ...i.map((r) => r.value)], this.value = Array.from(new Set(this.value));
20359
- } else this.value = this.value.includes(e.value) ? this.value.filter((i) => i !== e.value) : [...this.value, e.value];
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(e) {
20362
- super(e, !1);
20363
- const { options: s } = e;
20364
- this.#t = e.selectableGroups !== !1, this.options = Object.entries(s).flatMap(([i, r]) => [{
20365
- value: i,
20366
- group: !0,
20367
- label: i
20368
- }, ...r.map((n) => ({
20369
- ...n,
20370
- group: i
20371
- }))]), this.value = [...e.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: i }) => i === e.cursorAt), this.#t ? 0 : 1), this.on("cursor", (i) => {
20372
- switch (i) {
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 r = this.options[this.cursor]?.group === !0;
20377
- !this.#t && r && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
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 r = this.options[this.cursor]?.group === !0;
20384
- !this.#t && r && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
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
- var Lt$2 = class extends x$1 {
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].value;
20948
+ return this.options[this.cursor]?.value;
20399
20949
  }
20400
20950
  get _enabledOptions() {
20401
- return this.options.filter((e) => e.disabled !== !0);
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((i) => i.value);
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((i) => !e.includes(i.value)).map((i) => i.value);
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((s) => s !== this._value) : [...this.value, this._value];
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, !1), this.options = e.options, this.value = [...e.initialValues ?? []];
20418
- const s = Math.max(this.options.findIndex(({ value: i }) => i === e.cursorAt), 0);
20419
- this.cursor = this.options[s].disabled ? B$1(s, 1, this.options) : s, this.on("key", (i) => {
20420
- i === "a" && this.toggleAll(), i === "i" && this.toggleInvert();
20421
- }), this.on("cursor", (i) => {
20422
- switch (i) {
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 = B$1(this.cursor, -1, this.options);
20975
+ this.cursor = findCursor(this.cursor, -1, this.options);
20426
20976
  break;
20427
20977
  case "down":
20428
20978
  case "right":
20429
- this.cursor = B$1(this.cursor, 1, this.options);
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 Mt$2 = class extends x$1 {
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 e = this.userInput;
20449
- if (this.cursor >= e.length) return `${this.masked}${import_picocolors.default.inverse(import_picocolors.default.hidden("_"))}`;
20450
- const s = this.masked, i = s.slice(0, this.cursor), r = s.slice(this.cursor);
20451
- return `${i}${import_picocolors.default.inverse(r[0])}${r.slice(1)}`;
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: e, ...s }) {
20457
- super(s), this._mask = e ?? "•", this.on("userInput", (i) => {
20458
- this._setValue(i);
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
- var Wt$2 = class extends x$1 {
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
- this.value = this._selectedValue.value;
21021
+ const e = this._selectedValue;
21022
+ this.value = e === void 0 ? void 0 : e.value;
20470
21023
  }
20471
21024
  constructor(e) {
20472
- super(e, !1), this.options = e.options;
20473
- const s = this.options.findIndex(({ value: r }) => r === e.initialValue), i = s === -1 ? 0 : s;
20474
- this.cursor = this.options[i].disabled ? B$1(i, 1, this.options) : i, this.changeValue(), this.on("cursor", (r) => {
20475
- switch (r) {
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 = B$1(this.cursor, -1, this.options);
21031
+ this.cursor = findCursor(this.cursor, -1, this.options);
20479
21032
  break;
20480
21033
  case "down":
20481
21034
  case "right":
20482
- this.cursor = B$1(this.cursor, 1, this.options);
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 Tt$2 = class extends x$1 {
21042
+ var u$3 = class extends V$1 {
20490
21043
  options;
20491
21044
  cursor = 0;
20492
- constructor(e) {
20493
- super(e, !1), this.options = e.options;
20494
- const s = e.caseSensitive === !0, i = this.options.map(({ value: [r] }) => s ? r : r?.toLowerCase());
20495
- this.cursor = Math.max(i.indexOf(e.initialValue), 0), this.on("key", (r, n) => {
20496
- if (!r) return;
20497
- const u = s && n.shift ? r.toUpperCase() : r;
20498
- if (!i.includes(u)) return;
20499
- const a = this.options.find(({ value: [l] }) => s ? l === u : l?.toLowerCase() === r);
20500
- a && (this.value = a.value, this.state = "submit", this.emit("submit"));
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 $t$2 = class extends x$1 {
21057
+ var n$2 = class extends V$1 {
20505
21058
  get userInputWithCursor() {
20506
21059
  if (this.state === "submit") return this.userInput;
20507
- const e = this.userInput;
20508
- if (this.cursor >= e.length) return `${this.userInput}\u2588`;
20509
- const s = e.slice(0, this.cursor), [i, ...r] = e.slice(this.cursor);
20510
- return `${s}${import_picocolors.default.inverse(i)}${r.join("")}`;
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(e) {
21068
+ constructor(t) {
20516
21069
  super({
20517
- ...e,
20518
- initialUserInput: e.initialUserInput ?? e.initialValue
20519
- }), this.on("userInput", (s) => {
20520
- this._setValue(s);
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 = e.defaultValue), this.value === void 0 && (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.1/node_modules/@clack/prompts/dist/index.mjs
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
- S_BAR: () => d,
20530
- S_BAR_END: () => x,
20531
- S_BAR_END_RIGHT: () => Pt$1,
20532
- S_BAR_H: () => rt$1,
20533
- S_BAR_START: () => ht$1,
20534
- S_BAR_START_RIGHT: () => Ot,
20535
- S_CHECKBOX_ACTIVE: () => st$1,
20536
- S_CHECKBOX_INACTIVE: () => q$1,
20537
- S_CHECKBOX_SELECTED: () => U$1,
20538
- S_CONNECT_LEFT: () => Wt$1,
20539
- S_CORNER_BOTTOM_LEFT: () => gt$1,
20540
- S_CORNER_BOTTOM_RIGHT: () => pt$1,
20541
- S_CORNER_TOP_LEFT: () => Lt$1,
20542
- S_CORNER_TOP_RIGHT: () => mt$1,
20543
- S_ERROR: () => Et$1,
20544
- S_INFO: () => ft$1,
20545
- S_PASSWORD_MASK: () => Nt$1,
20546
- S_RADIO_ACTIVE: () => Q$1,
20547
- S_RADIO_INACTIVE: () => H$1,
20548
- S_STEP_ACTIVE: () => Rt$1,
20549
- S_STEP_CANCEL: () => dt$1,
20550
- S_STEP_ERROR: () => $t$1,
20551
- S_STEP_SUBMIT: () => V$1,
20552
- S_SUCCESS: () => Ft$1,
20553
- S_WARN: () => yt$1,
20554
- autocomplete: () => Xt$1,
20555
- autocompleteMultiselect: () => xe,
20556
- box: () => Me$1,
20557
- cancel: () => Ne$1,
20558
- confirm: () => Re$1,
20559
- group: () => Oe$1,
20560
- groupMultiselect: () => Pe$1,
20561
- intro: () => We$1,
20562
- isCI: () => ct$1,
20563
- isCancel: () => Ct$2,
20564
- isTTY: () => Mt$1,
20565
- limitOptions: () => X$1,
20566
- log: () => R,
20567
- multiselect: () => je$1,
20568
- note: () => Ve$1,
20569
- outro: () => Le$1,
20570
- password: () => He$1,
20571
- path: () => Ue$1,
20572
- progress: () => qe$1,
20573
- select: () => Je$1,
20574
- selectKey: () => Xe$1,
20575
- settings: () => _$1,
20576
- spinner: () => bt$1,
20577
- stream: () => K$1,
20578
- symbol: () => W$1,
20579
- symbolBar: () => vt$1,
20580
- taskLog: () => Qe$1,
20581
- tasks: () => Ye$1,
20582
- text: () => Ze$1,
20583
- unicode: () => et$1,
20584
- unicodeOr: () => C$1,
20585
- updateSettings: () => It$2
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 me$1() {
20588
- return process$1.platform !== "win32" ? process$1.env.TERM !== "linux" : !!process$1.env.CI || !!process$1.env.WT_SESSION || !!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";
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 et$1 = me$1(), ct$1 = () => process.env.CI === "true", Mt$1 = (t) => t.isTTY === !0, C$1 = (t, r) => et$1 ? t : r, Rt$1 = C$1("◆", "*"), dt$1 = C$1("■", "x"), $t$1 = C$1("▲", "x"), V$1 = C$1("◇", "o"), ht$1 = C$1("┌", "T"), d = C$1("│", "|"), x = C$1("└", "—"), Ot = C$1("┐", "T"), Pt$1 = C$1("┘", "—"), Q$1 = C$1("●", ">"), H$1 = C$1("○", " "), st$1 = C$1("◻", "[•]"), U$1 = C$1("◼", "[+]"), q$1 = C$1("◻", "[ ]"), Nt$1 = C$1("▪", "•"), rt$1 = C$1("─", "-"), mt$1 = C$1("╮", "+"), Wt$1 = C$1("├", "+"), pt$1 = C$1("╯", "+"), gt$1 = C$1("╰", "+"), Lt$1 = C$1("╭", "+"), ft$1 = C$1("●", "•"), Ft$1 = C$1("◆", "*"), yt$1 = C$1("▲", "!"), Et$1 = C$1("■", "x"), W$1 = (t) => {
20591
- switch (t) {
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 import_picocolors.default.cyan(Rt$1);
20594
- case "cancel": return import_picocolors.default.red(dt$1);
20595
- case "error": return import_picocolors.default.yellow($t$1);
20596
- case "submit": return import_picocolors.default.green(V$1);
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
- }, vt$1 = (t) => {
20599
- switch (t) {
21157
+ }, symbolBar = (o) => {
21158
+ switch (o) {
20600
21159
  case "initial":
20601
- case "active": return import_picocolors.default.cyan(d);
20602
- case "cancel": return import_picocolors.default.red(d);
20603
- case "error": return import_picocolors.default.yellow(d);
20604
- case "submit": return import_picocolors.default.green(d);
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
- }, pe$1 = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 170 || t === 173 || t === 174 || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || t === 198 || t === 208 || t === 215 || t === 216 || t >= 222 && t <= 225 || t === 230 || t >= 232 && t <= 234 || t === 236 || t === 237 || t === 240 || t === 242 || t === 243 || t >= 247 && t <= 250 || t === 252 || t === 254 || t === 257 || t === 273 || t === 275 || t === 283 || t === 294 || t === 295 || t === 299 || t >= 305 && t <= 307 || t === 312 || t >= 319 && t <= 322 || t === 324 || t >= 328 && t <= 331 || t === 333 || t === 338 || t === 339 || t === 358 || t === 359 || t === 363 || t === 462 || t === 464 || t === 466 || t === 468 || t === 470 || t === 472 || t === 474 || t === 476 || t === 593 || t === 609 || t === 708 || t === 711 || t >= 713 && t <= 715 || t === 717 || t === 720 || t >= 728 && t <= 731 || t === 733 || t === 735 || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || t === 1025 || t >= 1040 && t <= 1103 || t === 1105 || t === 8208 || t >= 8211 && t <= 8214 || t === 8216 || t === 8217 || t === 8220 || t === 8221 || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || t === 8240 || t === 8242 || t === 8243 || t === 8245 || t === 8251 || t === 8254 || t === 8308 || t === 8319 || t >= 8321 && t <= 8324 || t === 8364 || t === 8451 || t === 8453 || t === 8457 || t === 8467 || t === 8470 || t === 8481 || t === 8482 || t === 8486 || t === 8491 || t === 8531 || t === 8532 || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || t === 8585 || t >= 8592 && t <= 8601 || t === 8632 || t === 8633 || t === 8658 || t === 8660 || t === 8679 || t === 8704 || t === 8706 || t === 8707 || t === 8711 || t === 8712 || t === 8715 || t === 8719 || t === 8721 || t === 8725 || t === 8730 || t >= 8733 && t <= 8736 || t === 8739 || t === 8741 || t >= 8743 && t <= 8748 || t === 8750 || t >= 8756 && t <= 8759 || t === 8764 || t === 8765 || t === 8776 || t === 8780 || t === 8786 || t === 8800 || t === 8801 || t >= 8804 && t <= 8807 || t === 8810 || t === 8811 || t === 8814 || t === 8815 || t === 8834 || t === 8835 || t === 8838 || t === 8839 || t === 8853 || t === 8857 || t === 8869 || t === 8895 || t === 8978 || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || t === 9632 || t === 9633 || t >= 9635 && t <= 9641 || t === 9650 || t === 9651 || t === 9654 || t === 9655 || t === 9660 || t === 9661 || t === 9664 || t === 9665 || t >= 9670 && t <= 9672 || t === 9675 || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || t === 9711 || t === 9733 || t === 9734 || t === 9737 || t === 9742 || t === 9743 || t === 9756 || t === 9758 || t === 9792 || t === 9794 || t === 9824 || t === 9825 || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || t === 9836 || t === 9837 || t === 9839 || t === 9886 || t === 9887 || t === 9919 || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || t === 9955 || t === 9960 || t === 9961 || t >= 9963 && t <= 9969 || t === 9972 || t >= 9974 && t <= 9977 || t === 9979 || t === 9980 || t === 9982 || t === 9983 || t === 10045 || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || t === 65533 || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || t === 127375 || t === 127376 || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109, ge$1 = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510, fe$1 = (t) => t >= 4352 && t <= 4447 || t === 8986 || t === 8987 || t === 9001 || t === 9002 || t >= 9193 && t <= 9196 || t === 9200 || t === 9203 || t === 9725 || t === 9726 || t === 9748 || t === 9749 || t >= 9800 && t <= 9811 || t === 9855 || t === 9875 || t === 9889 || t === 9898 || t === 9899 || t === 9917 || t === 9918 || t === 9924 || t === 9925 || t === 9934 || t === 9940 || t === 9962 || t === 9970 || t === 9971 || t === 9973 || t === 9978 || t === 9981 || t === 9989 || t === 9994 || t === 9995 || t === 10024 || t === 10060 || t === 10062 || t >= 10067 && t <= 10069 || t === 10071 || t >= 10133 && t <= 10135 || t === 10160 || t === 10175 || t === 11035 || t === 11036 || t === 11088 || t === 11093 || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || t === 94192 || t === 94193 || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || t === 110589 || t === 110590 || t >= 110592 && t <= 110882 || t === 110898 || t >= 110928 && t <= 110930 || t === 110933 || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || t === 126980 || t === 127183 || t === 127374 || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || t === 127568 || t === 127569 || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || t === 127988 || t >= 127992 && t <= 128062 || t === 128064 || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || t === 128378 || t === 128405 || t === 128406 || t === 128420 || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || t === 128716 || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || t === 128747 || t === 128748 || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || t === 129008 || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141, At$1 = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y, it$1 = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, nt$1 = /\t{1,1000}/y, wt$1 = /[\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, at$1 = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, Fe$1 = /\p{M}+/gu, ye$1 = {
20607
- limit: Infinity,
20608
- ellipsis: ""
20609
- }, jt$1 = (t, r = {}, s = {}) => {
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 be$1 = (t, r, s, i, a) => {
20757
- let o = r, u = 0;
20758
- for (let l = s; l < i; l++) {
20759
- const n = t[l];
20760
- if (o = o - n.length, u++, o <= a) break;
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: o,
20764
- removals: u
20765
- };
20766
- }, X$1 = (t) => {
20767
- const { cursor: r, options: s, style: i } = t, a = t.output ?? process.stdout, o = rt$2(a), u = t.columnPadding ?? 0, l = t.rowPadding ?? 4, n = o - u, c = nt$2(a), g = import_picocolors.default.dim("..."), F = t.maxItems ?? Number.POSITIVE_INFINITY, p = Math.max(c - l, 0), E = Math.max(Math.min(F, p), 5);
20768
- let $ = 0;
20769
- r >= E - 3 && ($ = Math.max(Math.min(r - E + 3, s.length - E), 0));
20770
- let m = E < s.length && $ > 0, h = E < s.length && $ + E < s.length;
20771
- const y = Math.min($ + E, s.length), f = [];
20772
- let v = 0;
20773
- m && v++, h && v++;
20774
- const S = $ + (m ? 1 : 0), I = y - (h ? 1 : 0);
20775
- for (let A = S; A < I; A++) {
20776
- const w = J$1(i(s[A], A === r), n, {
20777
- hard: !0,
20778
- trim: !1
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
- f.push(w), v += w.length;
21200
+ s.push(h), g += h.length;
20782
21201
  }
20783
- if (v > p) {
20784
- let A = 0, w = 0, _ = v;
20785
- const D = r - S, T = (Y, L) => be$1(f, _, Y, L, p);
20786
- m ? ({lineCount: _, removals: A} = T(0, D), _ > p && ({lineCount: _, removals: w} = T(D + 1, f.length))) : ({lineCount: _, removals: w} = T(D + 1, f.length), _ > p && ({lineCount: _, removals: A} = T(0, D))), A > 0 && (m = !0, f.splice(0, A)), w > 0 && (h = !0, f.splice(f.length - w, w));
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 B = [];
20789
- m && B.push(g);
20790
- for (const A of f) for (const w of A) B.push(w);
20791
- return h && B.push(g), B;
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 qt$1(t) {
21214
+ function P$1(t) {
20794
21215
  return t.label ?? String(t.value ?? "");
20795
21216
  }
20796
- function Jt$1(t, r) {
20797
- if (!t) return !0;
20798
- const s = (r.label ?? String(r.value ?? "")).toLowerCase(), i = (r.hint ?? "").toLowerCase(), a = String(r.value).toLowerCase(), o = t.toLowerCase();
20799
- return s.includes(o) || i.includes(o) || a.includes(o);
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 Be$1(t, r) {
20802
- const s = [];
20803
- for (const i of r) t.includes(i.value) && s.push(i);
20804
- return s;
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 Xt$1 = (t) => new Vt$2({
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
- filter: t.filter ?? ((r, s) => Jt$1(r, s)),
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 r = t.withGuide ?? _$1.withGuide, s = r ? [`${import_picocolors.default.gray(d)}`, `${W$1(this.state)} ${t.message}`] : [`${W$1(this.state)} ${t.message}`], i = this.userInput, a = this.options, o = t.placeholder, u = i === "" && o !== void 0, l = (n, c) => {
20817
- const g = qt$1(n), F = n.hint && n.value === this.focusedValue ? import_picocolors.default.dim(` (${n.hint})`) : "";
20818
- switch (c) {
20819
- case "active": return `${import_picocolors.default.green(Q$1)} ${g}${F}`;
20820
- case "inactive": return `${import_picocolors.default.dim(H$1)} ${import_picocolors.default.dim(g)}`;
20821
- case "disabled": return `${import_picocolors.default.gray(H$1)} ${import_picocolors.default.strikethrough(import_picocolors.default.gray(g))}`;
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 n = Be$1(this.selectedValues, a), c = n.length > 0 ? ` ${import_picocolors.default.dim(n.map(qt$1).join(", "))}` : "", g = r ? import_picocolors.default.gray(d) : "";
20827
- return `${s.join(`
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
- ${g}${c}`;
21251
+ ${a}${s}`;
20830
21252
  }
20831
21253
  case "cancel": {
20832
- const n = i ? ` ${import_picocolors.default.strikethrough(import_picocolors.default.dim(i))}` : "", c = r ? import_picocolors.default.gray(d) : "";
20833
- return `${s.join(`
21254
+ const r = l ? ` ${styleText(["strikethrough", "dim"], l)}` : "", s = n ? styleText("gray", S_BAR) : "";
21255
+ return `${i.join(`
20834
21256
  `)}
20835
- ${c}${n}`;
21257
+ ${s}${r}`;
20836
21258
  }
20837
21259
  default: {
20838
- const n = this.state === "error" ? import_picocolors.default.yellow : import_picocolors.default.cyan, c = r ? `${n(d)} ` : "", g = r ? n(x) : "";
20839
- let F = "";
20840
- if (this.isNavigating || u) {
20841
- const f = u ? o : i;
20842
- F = f !== "" ? ` ${import_picocolors.default.dim(f)}` : "";
20843
- } else F = ` ${this.userInputWithCursor}`;
20844
- const p = this.filteredOptions.length !== a.length ? import_picocolors.default.dim(` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`) : "", E = this.filteredOptions.length === 0 && i ? [`${c}${import_picocolors.default.yellow("No matches found")}`] : [], $ = this.state === "error" ? [`${c}${import_picocolors.default.yellow(this.error)}`] : [];
20845
- r && s.push(`${c.trimEnd()}`), s.push(`${c}${import_picocolors.default.dim("Search:")}${F}${p}`, ...E, ...$);
20846
- const h = [`${c}${[
20847
- `${import_picocolors.default.dim("↑/↓")} to select`,
20848
- `${import_picocolors.default.dim("Enter:")} confirm`,
20849
- `${import_picocolors.default.dim("Type:")} to search`
20850
- ].join(" • ")}`, g], y = this.filteredOptions.length === 0 ? [] : X$1({
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: r ? 3 : 0,
20854
- rowPadding: s.length + h.length,
20855
- style: (f, v) => l(f, f.disabled ? "disabled" : v ? "active" : "inactive"),
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
- ...s,
20861
- ...y.map((f) => `${c}${f}`),
20862
- ...h
21282
+ ...i,
21283
+ ...O.map((d) => `${s}${d}`),
21284
+ ...g
20863
21285
  ].join(`
20864
21286
  `);
20865
21287
  }
20866
21288
  }
20867
21289
  }
20868
- }).prompt(), xe = (t) => {
20869
- const r = (i, a, o, u) => {
20870
- const l = o.includes(i.value), n = i.label ?? String(i.value ?? ""), c = i.hint && u !== void 0 && i.value === u ? import_picocolors.default.dim(` (${i.hint})`) : "", g = l ? import_picocolors.default.green(U$1) : import_picocolors.default.dim(q$1);
20871
- return i.disabled ? `${import_picocolors.default.gray(q$1)} ${import_picocolors.default.strikethrough(import_picocolors.default.gray(n))}` : a ? `${g} ${n}${c}` : `${g} ${import_picocolors.default.dim(n)}`;
20872
- }, s = new Vt$2({
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: !0,
20875
- filter: t.filter ?? ((i, a) => Jt$1(i, a)),
21296
+ multiple: true,
21297
+ placeholder: t.placeholder,
21298
+ filter: t.filter ?? ((i, l) => E(i, l)),
20876
21299
  validate: () => {
20877
- if (t.required && s.selectedValues.length === 0) return "Please select at least one item";
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 = `${import_picocolors.default.gray(d)}
20885
- ${W$1(this.state)} ${t.message}
20886
- `, a = this.userInput, o = t.placeholder, u = a === "" && o !== void 0, l = this.isNavigating || u ? import_picocolors.default.dim(u ? o : a) : this.userInputWithCursor, n = this.options, c = this.filteredOptions.length !== n.length ? import_picocolors.default.dim(` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`) : "";
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 `${i}${import_picocolors.default.gray(d)} ${import_picocolors.default.dim(`${this.selectedValues.length} items selected`)}`;
20889
- case "cancel": return `${i}${import_picocolors.default.gray(d)} ${import_picocolors.default.strikethrough(import_picocolors.default.dim(a))}`;
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 g = this.state === "error" ? import_picocolors.default.yellow : import_picocolors.default.cyan, F = [
20892
- `${import_picocolors.default.dim("↑/↓")} to navigate`,
20893
- `${import_picocolors.default.dim(this.isNavigating ? "Space/Tab:" : "Tab:")} select`,
20894
- `${import_picocolors.default.dim("Enter:")} confirm`,
20895
- `${import_picocolors.default.dim("Type:")} to search`
20896
- ], p = this.filteredOptions.length === 0 && a ? [`${g(d)} ${import_picocolors.default.yellow("No matches found")}`] : [], E = this.state === "error" ? [`${g(d)} ${import_picocolors.default.yellow(this.error)}`] : [], $ = [
20897
- ...`${i}${g(d)}`.split(`
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
- `${g(d)} ${import_picocolors.default.dim("Search:")} ${l}${c}`,
20900
- ...p,
20901
- ...E
20902
- ], m = [`${g(d)} ${F.join(" • ")}`, `${g(x)}`], h = X$1({
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: (y, f) => r(y, f, this.selectedValues, this.focusedValue),
21328
+ style: (f, _) => c(f, _, this.selectedValues, this.focusedValue),
20906
21329
  maxItems: t.maxItems,
20907
21330
  output: t.output,
20908
- rowPadding: $.length + m.length
21331
+ rowPadding: g.length + O.length
20909
21332
  });
20910
21333
  return [
20911
- ...$,
20912
- ...h.map((y) => `${g(d)} ${y}`),
20913
- ...m
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 s.prompt();
20921
- }, _e$1 = [
20922
- Lt$1,
20923
- mt$1,
20924
- gt$1,
20925
- pt$1
20926
- ], De$1 = [
20927
- ht$1,
20928
- Ot,
20929
- x,
20930
- Pt$1
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 Yt$1(t, r, s, i) {
20933
- let a = s, o = s;
20934
- return i === "center" ? a = Math.floor((r - t) / 2) : i === "right" && (a = r - t - s), o = r - a - t, [a, o];
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 Te$1 = (t) => t, Me$1 = (t = "", r = "", s) => {
20937
- const i = s?.output ?? process.stdout, a = rt$2(i), o = 2, u = s?.titlePadding ?? 1, l = s?.contentPadding ?? 2, n = s?.width === void 0 || s.width === "auto" ? 1 : Math.min(1, s.width), c = s?.withGuide ?? _$1.withGuide ? `${d} ` : "", g = s?.formatBorder ?? Te$1, F = (s?.rounded ? _e$1 : De$1).map(g), p = g(rt$1), E = g(d), $ = M$1(c), m = M$1(r), h = a - $;
20938
- let y = Math.floor(a * n) - $;
20939
- if (s?.width === "auto") {
20940
- const _ = t.split(`
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 D = m + u * 2;
20943
- for (const Y of _) {
20944
- const L = M$1(Y) + l * 2;
20945
- L > D && (D = L);
20946
- }
20947
- const T = D + o;
20948
- T < y && (y = T);
20949
- }
20950
- y % 2 !== 0 && (y < h ? y++ : y--);
20951
- const f = y - o, v = f - u * 2, S = m > v ? `${r.slice(0, v - 3)}...` : r, [I, B] = Yt$1(M$1(S), f, u, s?.titleAlign), A = J$1(t, f - l * 2, {
20952
- hard: !0,
20953
- trim: !1
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
- i.write(`${c}${F[0]}${p.repeat(I)}${S}${p.repeat(B)}${F[1]}
21380
+ o.write(`${m}${a[0]}${_.repeat(y)}${T}${_.repeat(W)}${a[1]}
20956
21381
  `);
20957
- const w = A.split(`
21382
+ const E = L.split(`
20958
21383
  `);
20959
- for (const _ of w) {
20960
- const [D, T] = Yt$1(M$1(_), f, l, s?.contentAlign);
20961
- i.write(`${c}${E}${" ".repeat(D)}${_}${" ".repeat(T)}${E}
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
- i.write(`${c}${F[2]}${p.repeat(f)}${F[3]}
21389
+ o.write(`${m}${a[2]}${_.repeat(d)}${a[3]}
20965
21390
  `);
20966
- }, Re$1 = (t) => {
20967
- const r = t.active ?? "Yes", s = t.inactive ?? "No";
20968
- return new kt$2({
20969
- active: r,
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: t.signal,
20972
- input: t.input,
20973
- output: t.output,
20974
- initialValue: t.initialValue ?? !0,
21397
+ signal: i.signal,
21398
+ input: i.input,
21399
+ output: i.output,
21400
+ initialValue: i.initialValue ?? true,
20975
21401
  render() {
20976
- const i = t.withGuide ?? _$1.withGuide, a = `${i ? `${import_picocolors.default.gray(d)}
20977
- ` : ""}${W$1(this.state)} ${t.message}
20978
- `, o = this.value ? r : s;
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 `${a}${i ? `${import_picocolors.default.gray(d)} ` : ""}${import_picocolors.default.dim(o)}`;
20981
- case "cancel": return `${a}${i ? `${import_picocolors.default.gray(d)} ` : ""}${import_picocolors.default.strikethrough(import_picocolors.default.dim(o))}${i ? `
20982
- ${import_picocolors.default.gray(d)}` : ""}`;
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 u = i ? `${import_picocolors.default.cyan(d)} ` : "", l = i ? import_picocolors.default.cyan(x) : "";
20985
- return `${a}${u}${this.value ? `${import_picocolors.default.green(Q$1)} ${r}` : `${import_picocolors.default.dim(H$1)} ${import_picocolors.default.dim(r)}`}${t.vertical ? i ? `
20986
- ${import_picocolors.default.cyan(d)} ` : `
20987
- ` : ` ${import_picocolors.default.dim("/")} `}${this.value ? `${import_picocolors.default.dim(H$1)} ${import_picocolors.default.dim(s)}` : `${import_picocolors.default.green(Q$1)} ${s}`}
20988
- ${l}
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
- }, Oe$1 = async (t, r) => {
20995
- const s = {}, i = Object.keys(t);
20996
- for (const a of i) {
20997
- const o = t[a], u = await o({ results: s })?.catch((l) => {
20998
- throw l;
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
- if (typeof r?.onCancel == "function" && Ct$2(u)) {
21001
- s[a] = "canceled", r.onCancel({ results: s });
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
- s[a] = u;
21005
- }
21006
- return s;
21007
- }, Pe$1 = (t) => {
21008
- const { selectableGroups: r = !0, groupSpacing: s = 0 } = t, i = (o, u, l = []) => {
21009
- const n = o.label ?? String(o.value), c = typeof o.group == "string", g = c && (l[l.indexOf(o) + 1] ?? { group: !0 }), F = c && g && g.group === !0, p = c ? r ? `${F ? x : d} ` : " " : "";
21010
- let E = "";
21011
- if (s > 0 && !c) {
21012
- const m = `
21013
- ${import_picocolors.default.cyan(d)}`;
21014
- E = `${m.repeat(s - 1)}${m} `;
21015
- }
21016
- if (u === "active") return `${E}${import_picocolors.default.dim(p)}${import_picocolors.default.cyan(st$1)} ${n}${o.hint ? ` ${import_picocolors.default.dim(`(${o.hint})`)}` : ""}`;
21017
- if (u === "group-active") return `${E}${p}${import_picocolors.default.cyan(st$1)} ${import_picocolors.default.dim(n)}`;
21018
- if (u === "group-active-selected") return `${E}${p}${import_picocolors.default.green(U$1)} ${import_picocolors.default.dim(n)}`;
21019
- if (u === "selected") {
21020
- const m = c || r ? import_picocolors.default.green(U$1) : "";
21021
- return `${E}${import_picocolors.default.dim(p)}${m} ${import_picocolors.default.dim(n)}${o.hint ? ` ${import_picocolors.default.dim(`(${o.hint})`)}` : ""}`;
21022
- }
21023
- if (u === "cancelled") return `${import_picocolors.default.strikethrough(import_picocolors.default.dim(n))}`;
21024
- if (u === "active-selected") return `${E}${import_picocolors.default.dim(p)}${import_picocolors.default.green(U$1)} ${n}${o.hint ? ` ${import_picocolors.default.dim(`(${o.hint})`)}` : ""}`;
21025
- if (u === "submitted") return `${import_picocolors.default.dim(n)}`;
21026
- const $ = c || r ? import_picocolors.default.dim(q$1) : "";
21027
- return `${E}${import_picocolors.default.dim(p)}${$} ${import_picocolors.default.dim(n)}`;
21028
- }, a = t.required ?? !0;
21029
- return new yt$2({
21030
- options: t.options,
21031
- signal: t.signal,
21032
- input: t.input,
21033
- output: t.output,
21034
- initialValues: t.initialValues,
21035
- required: a,
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 o = `${import_picocolors.default.gray(d)}
21044
- ${W$1(this.state)} ${t.message}
21045
- `, u = this.value ?? [];
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 l = this.options.filter(({ value: c }) => u.includes(c)).map((c) => i(c, "submitted")), n = l.length === 0 ? "" : ` ${l.join(import_picocolors.default.dim(", "))}`;
21049
- return `${o}${import_picocolors.default.gray(d)}${n}`;
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 l = this.options.filter(({ value: n }) => u.includes(n)).map((n) => i(n, "cancelled")).join(import_picocolors.default.dim(", "));
21053
- return `${o}${import_picocolors.default.gray(d)} ${l.trim() ? `${l}
21054
- ${import_picocolors.default.gray(d)}` : ""}`;
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((n, c) => c === 0 ? `${import_picocolors.default.yellow(x)} ${import_picocolors.default.yellow(n)}` : ` ${n}`).join(`
21059
- `);
21060
- return `${o}${import_picocolors.default.yellow(d)} ${this.options.map((n, c, g) => {
21061
- const F = u.includes(n.value) || n.group === !0 && this.isGroupSelected(`${n.value}`), p = c === this.cursor;
21062
- return !p && typeof n.group == "string" && this.options[this.cursor].value === n.group ? i(n, F ? "group-active-selected" : "group-active", g) : p && F ? i(n, "active-selected", g) : F ? i(n, "selected", g) : i(n, p ? "active" : "inactive", g);
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
- ${import_picocolors.default.yellow(d)} `)}
21562
+ ${n}`)}
21065
21563
  ${l}
21066
21564
  `;
21067
21565
  }
21068
21566
  default: {
21069
- const l = this.options.map((c, g, F) => {
21070
- const p = u.includes(c.value) || c.group === !0 && this.isGroupSelected(`${c.value}`), E = g === this.cursor, $ = !E && typeof c.group == "string" && this.options[this.cursor].value === c.group;
21071
- let m = "";
21072
- return $ ? m = i(c, p ? "group-active-selected" : "group-active", F) : E && p ? m = i(c, "active-selected", F) : p ? m = i(c, "selected", F) : m = i(c, E ? "active" : "inactive", F), `${g !== 0 && !m.startsWith(`
21073
- `) ? " " : ""}${m}`;
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
- ${import_picocolors.default.cyan(d)}`), n = l.startsWith(`
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
- }, R = {
21085
- message: (t = [], { symbol: r = import_picocolors.default.gray(d), secondarySymbol: s = import_picocolors.default.gray(d), output: i = process.stdout, spacing: a = 1, withGuide: o } = {}) => {
21086
- const u = [], l = o ?? _$1.withGuide, n = l ? s : "", c = l ? `${r} ` : "", g = l ? `${s} ` : "";
21087
- for (let p = 0; p < a; p++) u.push(n);
21088
- const F = Array.isArray(t) ? t : t.split(`
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 (F.length > 0) {
21091
- const [p, ...E] = F;
21092
- p.length > 0 ? u.push(`${c}${p}`) : u.push(l ? r : "");
21093
- for (const $ of E) $.length > 0 ? u.push(`${g}${$}`) : u.push(l ? s : "");
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
- i.write(`${u.join(`
21692
+ m.write(`${t.join(`
21096
21693
  `)}
21097
21694
  `);
21098
21695
  },
21099
- info: (t, r) => {
21100
- R.message(t, {
21101
- ...r,
21102
- symbol: import_picocolors.default.blue(ft$1)
21696
+ info: (s, e) => {
21697
+ log$1.message(s, {
21698
+ ...e,
21699
+ symbol: styleText("blue", S_INFO)
21103
21700
  });
21104
21701
  },
21105
- success: (t, r) => {
21106
- R.message(t, {
21107
- ...r,
21108
- symbol: import_picocolors.default.green(Ft$1)
21702
+ success: (s, e) => {
21703
+ log$1.message(s, {
21704
+ ...e,
21705
+ symbol: styleText("green", S_SUCCESS)
21109
21706
  });
21110
21707
  },
21111
- step: (t, r) => {
21112
- R.message(t, {
21113
- ...r,
21114
- symbol: import_picocolors.default.green(V$1)
21708
+ step: (s, e) => {
21709
+ log$1.message(s, {
21710
+ ...e,
21711
+ symbol: styleText("green", S_STEP_SUBMIT)
21115
21712
  });
21116
21713
  },
21117
- warn: (t, r) => {
21118
- R.message(t, {
21119
- ...r,
21120
- symbol: import_picocolors.default.yellow(yt$1)
21714
+ warn: (s, e) => {
21715
+ log$1.message(s, {
21716
+ ...e,
21717
+ symbol: styleText("yellow", S_WARN)
21121
21718
  });
21122
21719
  },
21123
- warning: (t, r) => {
21124
- R.warn(t, r);
21720
+ warning: (s, e) => {
21721
+ log$1.warn(s, e);
21125
21722
  },
21126
- error: (t, r) => {
21127
- R.message(t, {
21128
- ...r,
21129
- symbol: import_picocolors.default.red(Et$1)
21723
+ error: (s, e) => {
21724
+ log$1.message(s, {
21725
+ ...e,
21726
+ symbol: styleText("red", S_ERROR)
21130
21727
  });
21131
21728
  }
21132
- }, Ne$1 = (t = "", r) => {
21133
- (r?.output ?? process.stdout).write(`${import_picocolors.default.gray(x)} ${import_picocolors.default.red(t)}
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
- }, We$1 = (t = "", r) => {
21137
- (r?.output ?? process.stdout).write(`${import_picocolors.default.gray(ht$1)} ${t}
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
- }, Le$1 = (t = "", r) => {
21140
- (r?.output ?? process.stdout).write(`${import_picocolors.default.gray(d)}
21141
- ${import_picocolors.default.gray(x)} ${t}
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
- }, Z$1 = (t, r) => t.split(`
21145
- `).map((s) => r(s)).join(`
21146
- `), je$1 = (t) => {
21147
- const r = (i, a) => {
21148
- const o = i.label ?? String(i.value);
21149
- return a === "disabled" ? `${import_picocolors.default.gray(q$1)} ${Z$1(o, (u) => import_picocolors.default.strikethrough(import_picocolors.default.gray(u)))}${i.hint ? ` ${import_picocolors.default.dim(`(${i.hint ?? "disabled"})`)}` : ""}` : a === "active" ? `${import_picocolors.default.cyan(st$1)} ${o}${i.hint ? ` ${import_picocolors.default.dim(`(${i.hint})`)}` : ""}` : a === "selected" ? `${import_picocolors.default.green(U$1)} ${Z$1(o, import_picocolors.default.dim)}${i.hint ? ` ${import_picocolors.default.dim(`(${i.hint})`)}` : ""}` : a === "cancelled" ? `${Z$1(o, (u) => import_picocolors.default.strikethrough(import_picocolors.default.dim(u)))}` : a === "active-selected" ? `${import_picocolors.default.green(U$1)} ${o}${i.hint ? ` ${import_picocolors.default.dim(`(${i.hint})`)}` : ""}` : a === "submitted" ? `${Z$1(o, import_picocolors.default.dim)}` : `${import_picocolors.default.dim(q$1)} ${Z$1(o, import_picocolors.default.dim)}`;
21150
- }, s = t.required ?? !0;
21151
- return new Lt$2({
21152
- options: t.options,
21153
- signal: t.signal,
21154
- input: t.input,
21155
- output: t.output,
21156
- initialValues: t.initialValues,
21157
- required: s,
21158
- cursorAt: t.cursorAt,
21159
- validate(i) {
21160
- if (s && (i === void 0 || i.length === 0)) return `Please select at least one option.
21161
- ${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`))}`;
21162
- },
21163
- render() {
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
- default: {
21202
- const l = `${import_picocolors.default.cyan(d)} `, n = a.split(`
21203
- `).length;
21204
- return `${a}${l}${X$1({
21205
- output: t.output,
21206
- options: this.options,
21207
- cursor: this.cursor,
21208
- maxItems: t.maxItems,
21209
- columnPadding: l.length,
21210
- rowPadding: n + 2,
21211
- style: u
21212
- }).join(`
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
- }).prompt();
21220
- }, Ge$1 = (t) => import_picocolors.default.dim(t), ke$1 = (t, r, s) => {
21221
- const i = {
21222
- hard: !0,
21223
- trim: !1
21224
- }, a = J$1(t, r, i).split(`
21225
- `), o = a.reduce((n, c) => Math.max(M$1(c), n), 0);
21226
- return J$1(t, r - (a.map(s).reduce((n, c) => Math.max(M$1(c), n), 0) - o), i);
21227
- }, Ve$1 = (t = "", r = "", s) => {
21228
- const i = s?.output ?? process$1.stdout, a = s?.withGuide ?? _$1.withGuide, o = s?.format ?? Ge$1, u = [
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
- ...ke$1(t, rt$2(i) - 6, o).split(`
21231
- `).map(o),
21795
+ ...C$1(o, getColumns(a) - 6, c).split(`
21796
+ `).map(c),
21232
21797
  ""
21233
- ], l = M$1(r), n = Math.max(u.reduce((p, E) => {
21234
- const $ = M$1(E);
21235
- return $ > p ? $ : p;
21236
- }, 0), l) + 2, c = u.map((p) => `${import_picocolors.default.gray(d)} ${p}${" ".repeat(n - M$1(p))}${import_picocolors.default.gray(d)}`).join(`
21237
- `), g = a ? `${import_picocolors.default.gray(d)}
21238
- ` : "", F = a ? Wt$1 : gt$1;
21239
- i.write(`${g}${import_picocolors.default.green(V$1)} ${import_picocolors.default.reset(r)} ${import_picocolors.default.gray(rt$1.repeat(Math.max(n - l - 1, 1)) + mt$1)}
21240
- ${c}
21241
- ${import_picocolors.default.gray(F + rt$1.repeat(n + 2) + pt$1)}
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
- }, He$1 = (t) => new Mt$2({
21244
- validate: t.validate,
21245
- mask: t.mask ?? Nt$1,
21246
- signal: t.signal,
21247
- input: t.input,
21248
- output: t.output,
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 r = t.withGuide ?? _$1.withGuide, s = `${r ? `${import_picocolors.default.gray(d)}
21251
- ` : ""}${W$1(this.state)} ${t.message}
21252
- `, i = this.userInputWithCursor, a = this.masked;
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 o = r ? `${import_picocolors.default.yellow(d)} ` : "", u = r ? `${import_picocolors.default.yellow(x)} ` : "", l = a ?? "";
21256
- return t.clearOnError && this.clear(), `${s.trim()}
21257
- ${o}${l}
21258
- ${u}${import_picocolors.default.yellow(this.error)}
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 `${s}${r ? `${import_picocolors.default.gray(d)} ` : ""}${a ? import_picocolors.default.dim(a) : ""}`;
21262
- case "cancel": return `${s}${r ? `${import_picocolors.default.gray(d)} ` : ""}${a ? import_picocolors.default.strikethrough(import_picocolors.default.dim(a)) : ""}${a && r ? `
21263
- ${import_picocolors.default.gray(d)}` : ""}`;
21264
- default: return `${s}${r ? `${import_picocolors.default.cyan(d)} ` : ""}${i}
21265
- ${r ? import_picocolors.default.cyan(x) : ""}
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(), Ue$1 = (t) => {
21270
- const r = t.validate;
21271
- return Xt$1({
21272
- ...t,
21273
- initialUserInput: t.initialValue ?? t.root ?? process.cwd(),
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(s) {
21276
- if (!Array.isArray(s)) {
21277
- if (!s) return "Please select a path";
21278
- if (r) return r(s);
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 s = this.userInput;
21283
- if (s === "") return [];
21849
+ const t = this.userInput;
21850
+ if (t === "") return [];
21284
21851
  try {
21285
21852
  let i;
21286
- return existsSync(s) ? lstatSync(s).isDirectory() ? i = s : i = dirname$1(s) : i = dirname$1(s), readdirSync(i).map((a) => {
21287
- const o = join(i, a);
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: a,
21290
- path: o,
21291
- isDirectory: lstatSync(o).isDirectory()
21858
+ name: r,
21859
+ path: n,
21860
+ isDirectory: lstatSync(n).isDirectory()
21292
21861
  };
21293
- }).filter(({ path: a, isDirectory: o }) => a.startsWith(s) && (t.directory || !o)).map((a) => ({ value: a.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
- }, Ke$1 = import_picocolors.default.magenta, bt$1 = ({ indicator: t = "dots", onCancel: r, output: s = process.stdout, cancelMessage: i, errorMessage: a, frames: o = et$1 ? [
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: u = et$1 ? 80 : 120, signal: l, ...n } = {}) => {
21310
- const c = ct$1();
21311
- let g, F, p = !1, E = !1, $ = "", m, h = performance.now();
21312
- const y = rt$2(s), f = n?.styleFrame ?? Ke$1, v = (b) => {
21313
- const O = b > 1 ? a ?? _$1.messages.error : i ?? _$1.messages.cancel;
21314
- E = b === 1, p && (L(O, b), E && typeof r == "function" && r());
21315
- }, S = () => v(2), I = () => v(1), B = () => {
21316
- process.on("uncaughtExceptionMonitor", S), process.on("unhandledRejection", S), process.on("SIGINT", I), process.on("SIGTERM", I), process.on("exit", v), l && l.addEventListener("abort", I);
21317
- }, A = () => {
21318
- process.removeListener("uncaughtExceptionMonitor", S), process.removeListener("unhandledRejection", S), process.removeListener("SIGINT", I), process.removeListener("SIGTERM", I), process.removeListener("exit", v), l && l.removeEventListener("abort", I);
21319
- }, w = () => {
21320
- if (m === void 0) return;
21321
- c && s.write(`
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 b = J$1(m, y, {
21324
- hard: !0,
21325
- trim: !1
21894
+ const r = wrapAnsi$1(p, x, {
21895
+ hard: true,
21896
+ trim: false
21326
21897
  }).split(`
21327
21898
  `);
21328
- b.length > 1 && s.write(import_src.cursor.up(b.length - 1)), s.write(import_src.cursor.to(0)), s.write(import_src.erase.down());
21329
- }, _ = (b) => b.replace(/\.+$/, ""), D = (b) => {
21330
- const O = (performance.now() - b) / 1e3, j = Math.floor(O / 60), G = Math.floor(O % 60);
21331
- return j > 0 ? `[${j}m ${G}s]` : `[${G}s]`;
21332
- }, T = n.withGuide ?? _$1.withGuide, Y = (b = "") => {
21333
- p = !0, g = Bt$1({ output: s }), $ = _(b), h = performance.now(), T && s.write(`${import_picocolors.default.gray(d)}
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 O = 0, j = 0;
21336
- B(), F = setInterval(() => {
21337
- if (c && $ === m) return;
21338
- w(), m = $;
21339
- const G = f(o[O]);
21340
- let tt;
21341
- if (c) tt = `${G} ${$}...`;
21342
- else if (t === "timer") tt = `${G} ${$} ${D(h)}`;
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 te = ".".repeat(Math.floor(j)).slice(0, 3);
21345
- tt = `${G} ${$}${te}`;
21915
+ const B = ".".repeat(Math.floor(t)).slice(0, 3);
21916
+ v = `${o} ${s}${B}`;
21346
21917
  }
21347
- const Zt = J$1(tt, y, {
21348
- hard: !0,
21349
- trim: !1
21918
+ const j = wrapAnsi$1(v, x, {
21919
+ hard: true,
21920
+ trim: false
21350
21921
  });
21351
- s.write(Zt), O = O + 1 < o.length ? O + 1 : 0, j = j < 4 ? j + .125 : 0;
21352
- }, u);
21353
- }, L = (b = "", O = 0, j = !1) => {
21354
- if (!p) return;
21355
- p = !1, clearInterval(F), w();
21356
- const G = O === 0 ? import_picocolors.default.green(V$1) : O === 1 ? import_picocolors.default.red(dt$1) : import_picocolors.default.red($t$1);
21357
- $ = b ?? $, j || (t === "timer" ? s.write(`${G} ${$} ${D(h)}
21358
- `) : s.write(`${G} ${$}
21359
- `)), A(), g();
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: Y,
21363
- stop: (b = "") => L(b, 0),
21364
- message: (b = "") => {
21365
- $ = _(b ?? $);
21366
- },
21367
- cancel: (b = "") => L(b, 1),
21368
- error: (b = "") => L(b, 2),
21369
- clear: () => L("", 0, !0),
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 E;
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
- function qe$1({ style: t = "heavy", max: r = 100, size: s = 40, ...i } = {}) {
21380
- const a = bt$1(i);
21381
- let o = 0, u = "";
21382
- const l = Math.max(1, r), n = Math.max(1, s), c = (E) => {
21383
- switch (E) {
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 import_picocolors.default.magenta;
21957
+ case "active": return (e) => styleText("magenta", e);
21386
21958
  case "error":
21387
- case "cancel": return import_picocolors.default.red;
21388
- case "submit": return import_picocolors.default.green;
21389
- default: return import_picocolors.default.magenta;
21390
- }
21391
- }, g = (E, $) => {
21392
- const m = Math.floor(o / l * n);
21393
- return `${c(E)(zt$1[t].repeat(m))}${import_picocolors.default.dim(zt$1[t].repeat(n - m))} ${$}`;
21394
- }, F = (E = "") => {
21395
- u = E, a.start(g("initial", E));
21396
- }, p = (E = 1, $) => {
21397
- o = Math.min(l, E + o), a.message(g("active", $ ?? u)), u = $ ?? u;
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: F,
21401
- stop: a.stop,
21402
- cancel: a.cancel,
21403
- error: a.error,
21404
- clear: a.clear,
21405
- advance: p,
21406
- isCancelled: a.isCancelled,
21407
- message: (E) => p(0, E)
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 lt$1 = (t, r) => t.includes(`
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((s) => r(s)).join(`
21413
- `) : r(t), Je$1 = (t) => {
21414
- const r = (s, i) => {
21415
- const a = s.label ?? String(s.value);
21416
- switch (i) {
21417
- case "disabled": return `${import_picocolors.default.gray(H$1)} ${lt$1(a, import_picocolors.default.gray)}${s.hint ? ` ${import_picocolors.default.dim(`(${s.hint ?? "disabled"})`)}` : ""}`;
21418
- case "selected": return `${lt$1(a, import_picocolors.default.dim)}`;
21419
- case "active": return `${import_picocolors.default.green(Q$1)} ${a}${s.hint ? ` ${import_picocolors.default.dim(`(${s.hint})`)}` : ""}`;
21420
- case "cancelled": return `${lt$1(a, (o) => import_picocolors.default.strikethrough(import_picocolors.default.dim(o)))}`;
21421
- default: return `${import_picocolors.default.dim(H$1)} ${lt$1(a, import_picocolors.default.dim)}`;
21422
- }
21423
- };
21424
- return new Wt$2({
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 s = t.withGuide ?? _$1.withGuide, i = `${W$1(this.state)} `, a = `${vt$1(this.state)} `, o = xt$1(t.output, t.message, a, i), u = `${s ? `${import_picocolors.default.gray(d)}
21432
- ` : ""}${o}
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 l = s ? `${import_picocolors.default.gray(d)} ` : "";
21437
- return `${u}${xt$1(t.output, r(this.options[this.cursor], "selected"), l)}`;
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 l = s ? `${import_picocolors.default.gray(d)} ` : "";
21441
- return `${u}${xt$1(t.output, r(this.options[this.cursor], "cancelled"), l)}${s ? `
21442
- ${import_picocolors.default.gray(d)}` : ""}`;
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 l = s ? `${import_picocolors.default.cyan(d)} ` : "", n = s ? import_picocolors.default.cyan(x) : "", c = u.split(`
21446
- `).length, g = s ? 2 : 1;
21447
- return `${u}${l}${X$1({
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: l.length,
21453
- rowPadding: c + g,
21454
- style: (F, p) => r(F, F.disabled ? "disabled" : p ? "active" : "inactive")
22028
+ columnPadding: r.length,
22029
+ rowPadding: a + f,
22030
+ style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
21455
22031
  }).join(`
21456
- ${l}`)}
21457
- ${n}
22032
+ ${r}`)}
22033
+ ${b}
21458
22034
  `;
21459
22035
  }
21460
22036
  }
21461
22037
  }
21462
22038
  }).prompt();
21463
- }, Xe$1 = (t) => {
21464
- const r = (s, i = "inactive") => {
21465
- const a = s.label ?? String(s.value);
21466
- return i === "selected" ? `${import_picocolors.default.dim(a)}` : i === "cancelled" ? `${import_picocolors.default.strikethrough(import_picocolors.default.dim(a))}` : i === "active" ? `${import_picocolors.default.bgCyan(import_picocolors.default.gray(` ${s.value} `))} ${a}${s.hint ? ` ${import_picocolors.default.dim(`(${s.hint})`)}` : ""}` : `${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(` ${s.value} `)))} ${a}${s.hint ? ` ${import_picocolors.default.dim(`(${s.hint})`)}` : ""}`;
21467
- };
21468
- return new Tt$2({
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 s = t.withGuide ?? _$1.withGuide, i = `${s ? `${import_picocolors.default.gray(d)}
21477
- ` : ""}${W$1(this.state)} ${t.message}
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 a = s ? `${import_picocolors.default.gray(d)} ` : "", o = this.options.find((l) => l.value === this.value) ?? t.options[0];
21482
- return `${i}${xt$1(t.output, r(o, "selected"), a)}`;
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 a = s ? `${import_picocolors.default.gray(d)} ` : "";
21486
- return `${i}${xt$1(t.output, r(this.options[0], "cancelled"), a)}${s ? `
21487
- ${import_picocolors.default.gray(d)}` : ""}`;
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 a = s ? `${import_picocolors.default.cyan(d)} ` : "", o = s ? import_picocolors.default.cyan(x) : "";
21491
- return `${i}${this.options.map((l, n) => xt$1(t.output, r(l, n === this.cursor ? "active" : "inactive"), a)).join(`
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
- ${o}
22075
+ ${s}
21494
22076
  `;
21495
22077
  }
21496
22078
  }
21497
22079
  }
21498
22080
  }).prompt();
21499
- }, Qt$1 = `${import_picocolors.default.gray(d)} `, K$1 = {
21500
- message: async (t, { symbol: r = import_picocolors.default.gray(d) } = {}) => {
21501
- process.stdout.write(`${import_picocolors.default.gray(d)}
21502
- ${r} `);
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 i of t) {
21505
- i = i.replace(/\n/g, `
21506
- ${Qt$1}`), i.includes(`
21507
- `) && (s = 3 + stripVTControlCharacters(i.slice(i.lastIndexOf(`
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 a = stripVTControlCharacters(i).length;
21510
- s + a < process.stdout.columns ? (s += a, process.stdout.write(i)) : (process.stdout.write(`
21511
- ${Qt$1}${i.trimStart()}`), s = 3 + stripVTControlCharacters(i.trimStart()).length);
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: (t) => K$1.message(t, { symbol: import_picocolors.default.blue(ft$1) }),
21517
- success: (t) => K$1.message(t, { symbol: import_picocolors.default.green(Ft$1) }),
21518
- step: (t) => K$1.message(t, { symbol: import_picocolors.default.green(V$1) }),
21519
- warn: (t) => K$1.message(t, { symbol: import_picocolors.default.yellow(yt$1) }),
21520
- warning: (t) => K$1.warn(t),
21521
- error: (t) => K$1.message(t, { symbol: import_picocolors.default.red(Et$1) })
21522
- }, Ye$1 = async (t, r) => {
21523
- for (const s of t) {
21524
- if (s.enabled === !1) continue;
21525
- const i = bt$1(r);
21526
- i.start(s.title);
21527
- const a = await s.task(i.message);
21528
- i.stop(a || s.title);
21529
- }
21530
- }, ze$1 = (t) => t.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g, ""), Qe$1 = (t) => {
21531
- const r = t.output ?? process.stdout, s = rt$2(r), i = import_picocolors.default.gray(d), a = t.spacing ?? 1, o = 3, u = t.retainLog === !0, l = !ct$1() && Mt$1(r);
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(`${import_picocolors.default.green(V$1)} ${t.title}
22120
+ `), r.write(`${styleText("green", S_STEP_SUBMIT)} ${l.title}
21534
22121
  `);
21535
- for (let h = 0; h < a; h++) r.write(`${i}
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 c = !1;
21542
- const g = (h) => {
22128
+ let v = false;
22129
+ const f = (e) => {
21543
22130
  if (n.length === 0) return;
21544
- let y = 0;
21545
- h && (y += a + 2);
21546
- for (const f of n) {
21547
- const { value: v, result: S } = f;
21548
- let I = S?.message ?? v;
21549
- if (I.length === 0) continue;
21550
- S === void 0 && f.header !== void 0 && f.header !== "" && (I += `
21551
- ${f.header}`);
21552
- const B = I.split(`
21553
- `).reduce((A, w) => w === "" ? A + 1 : A + Math.ceil((w.length + o) / s), 0);
21554
- y += B;
21555
- }
21556
- y > 0 && (y += 1, r.write(import_src.erase.lines(y)));
21557
- }, F = (h, y, f) => {
21558
- const v = f ? `${h.full}
21559
- ${h.value}` : h.value;
21560
- h.header !== void 0 && h.header !== "" && R.message(h.header.split(`
21561
- `).map(import_picocolors.default.bold), {
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
- }), R.message(v.split(`
21567
- `).map(import_picocolors.default.dim), {
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: y ?? a
22158
+ spacing: s ?? p
21572
22159
  });
21573
- }, p = () => {
21574
- for (const h of n) {
21575
- const { header: y, value: f, full: v } = h;
21576
- (y === void 0 || y.length === 0) && f.length === 0 || F(h, void 0, u === !0 && v.length > 0);
21577
- }
21578
- }, E = (h, y, f) => {
21579
- if (g(!1), (f?.raw !== !0 || !c) && h.value !== "" && (h.value += `
21580
- `), h.value += ze$1(y), c = f?.raw === !0, t.limit !== void 0) {
21581
- const v = h.value.split(`
21582
- `), S = v.length - t.limit;
21583
- if (S > 0) {
21584
- const I = v.splice(0, S);
21585
- u && (h.full += (h.full === "" ? "" : `
21586
- `) + I.join(`
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
- h.value = v.join(`
22176
+ e.value = o.join(`
21590
22177
  `);
21591
22178
  }
21592
- l && $();
21593
- }, $ = () => {
21594
- for (const h of n) h.result ? h.result.status === "error" ? R.error(h.result.message, {
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
- }) : R.success(h.result.message, {
22185
+ }) : log$1.success(e.result.message, {
21599
22186
  output: r,
21600
22187
  secondarySymbol: i,
21601
22188
  spacing: 0
21602
- }) : h.value !== "" && F(h, 0);
21603
- }, m = (h, y) => {
21604
- g(!1), h.result = y, l && $();
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(h, y) {
21608
- E(n[0], h, y);
22194
+ message(e, s) {
22195
+ L(n[0], e, s);
21609
22196
  },
21610
- group(h) {
21611
- const y = {
21612
- header: h,
22197
+ group(e) {
22198
+ const s = {
22199
+ header: e,
21613
22200
  value: "",
21614
22201
  full: ""
21615
22202
  };
21616
- return n.push(y), {
21617
- message(f, v) {
21618
- E(y, f, v);
22203
+ return n.push(s), {
22204
+ message(t, o) {
22205
+ L(s, t, o);
21619
22206
  },
21620
- error(f) {
21621
- m(y, {
22207
+ error(t) {
22208
+ B(s, {
21622
22209
  status: "error",
21623
- message: f
22210
+ message: t
21624
22211
  });
21625
22212
  },
21626
- success(f) {
21627
- m(y, {
22213
+ success(t) {
22214
+ B(s, {
21628
22215
  status: "success",
21629
- message: f
22216
+ message: t
21630
22217
  });
21631
22218
  }
21632
22219
  };
21633
22220
  },
21634
- error(h, y) {
21635
- g(!0), R.error(h, {
22221
+ error(e, s) {
22222
+ f(true), log$1.error(e, {
21636
22223
  output: r,
21637
22224
  secondarySymbol: i,
21638
22225
  spacing: 1
21639
- }), y?.showLog !== !1 && p(), n.splice(1, n.length - 1), n[0].value = "", n[0].full = "";
22226
+ }), s?.showLog !== false && T(), n.splice(1, n.length - 1), n[0].value = "", n[0].full = "";
21640
22227
  },
21641
- success(h, y) {
21642
- g(!0), R.success(h, {
22228
+ success(e, s) {
22229
+ f(true), log$1.success(e, {
21643
22230
  output: r,
21644
22231
  secondarySymbol: i,
21645
22232
  spacing: 1
21646
- }), y?.showLog === !0 && p(), n.splice(1, n.length - 1), n[0].value = "", n[0].full = "";
22233
+ }), s?.showLog === true && T(), n.splice(1, n.length - 1), n[0].value = "", n[0].full = "";
21647
22234
  }
21648
22235
  };
21649
- }, Ze$1 = (t) => new $t$2({
21650
- validate: t.validate,
21651
- placeholder: t.placeholder,
21652
- defaultValue: t.defaultValue,
21653
- initialValue: t.initialValue,
21654
- output: t.output,
21655
- signal: t.signal,
21656
- input: t.input,
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 r = t?.withGuide ?? _$1.withGuide, s = `${`${r ? `${import_picocolors.default.gray(d)}
21659
- ` : ""}${W$1(this.state)} `}${t.message}
21660
- `, i = t.placeholder ? import_picocolors.default.inverse(t.placeholder[0]) + import_picocolors.default.dim(t.placeholder.slice(1)) : import_picocolors.default.inverse(import_picocolors.default.hidden("_")), a = this.userInput ? this.userInputWithCursor : i, o = this.value ?? "";
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 u = this.error ? ` ${import_picocolors.default.yellow(this.error)}` : "", l = r ? `${import_picocolors.default.yellow(d)} ` : "", n = r ? import_picocolors.default.yellow(x) : "";
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
- ${l}${a}
21666
- ${n}${u}
22253
+ ${r}${o}
22254
+ ${d}${n}
21667
22255
  `;
21668
22256
  }
21669
22257
  case "submit": {
21670
- const u = o ? ` ${import_picocolors.default.dim(o)}` : "";
21671
- return `${s}${r ? import_picocolors.default.gray(d) : ""}${u}`;
22258
+ const n = l ? ` ${styleText("dim", l)}` : "";
22259
+ return `${s}${i ? styleText("gray", S_BAR) : ""}${n}`;
21672
22260
  }
21673
22261
  case "cancel": {
21674
- const u = o ? ` ${import_picocolors.default.strikethrough(import_picocolors.default.dim(o))}` : "", l = r ? import_picocolors.default.gray(d) : "";
21675
- return `${s}${l}${u}${o.trim() ? `
21676
- ${l}` : ""}`;
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}${r ? `${import_picocolors.default.cyan(d)} ` : ""}${a}
21679
- ${r ? import_picocolors.default.cyan(x) : ""}
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
- R.warn(`Failed to write build logs: ${message}`);
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
- R.warn(`Failed to initialize build log file: ${message}`);
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 = qe$1({
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
- R.info(`Build log stored at ${highlightedPath}`);
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$1 = 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 {
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$1];
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$1] = typeof e.autoClose == "boolean" ? e.autoClose : !0, typeof this[m] == "number" ? this[zt]() : this[ht]();
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$1] && typeof this[m] == "number") {
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$1] && typeof this[m] == "number") {
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$1];
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$1] = typeof e.autoClose == "boolean" ? e.autoClose : !0;
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$1] && typeof this[m] == "number") {
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$1] && typeof this[m] == "number") {
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 Ye$1([{
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
- R.error(result.stderr);
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) R.error(e.stderr || e.stdout || e.message);
42162
- else if (e instanceof Error) R.error(e.message);
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
- R.error(result.stderr);
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) R.error(e.stderr || e.stdout || e.message);
42184
- else if (e instanceof Error) R.error(e.message);
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
- R.warn(`Failed to parse react-native dependency path. Default values will be returned. This can cause fatal issue in this process.\n${e}`);
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, dist_exports as p, printBanner, promoteBundle, readPackageUp, renderImportStatements, resolveHotUpdaterServerVersion, resolvePackageVersion, stripAnsi, transformEnv, transformTemplate, writeHotUpdaterConfig };
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 };