create-rstack 1.9.0 → 1.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -4,15 +4,15 @@ import node_path, { delimiter, dirname, normalize as external_node_path_normaliz
4
4
  import { fileURLToPath } from "node:url";
5
5
  import node_util, { styleText } from "node:util";
6
6
  import node_process, { cwd as external_node_process_cwd, stdin, stdout } from "node:process";
7
- import node_tty, { ReadStream } from "node:tty";
7
+ import node_readline from "node:readline";
8
+ import node_tty from "node:tty";
8
9
  import node_os from "node:os";
9
10
  import { createRequire } from "node:module";
10
11
  import { spawn } from "node:child_process";
12
+ import { pipeline } from "node:stream/promises";
11
13
  import { PassThrough } from "node:stream";
12
- import node_readline from "node:readline";
13
14
  import { createRequire as __rspack_createRequire } from "node:module";
14
15
  const __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
15
- import * as __rspack_external_node_readline_91c31510 from "node:readline";
16
16
  var __webpack_modules__ = {};
17
17
  var __webpack_module_cache__ = {};
18
18
  function __webpack_require__(moduleId) {
@@ -51,7 +51,7 @@ __webpack_require__.m = __webpack_modules__;
51
51
  __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
52
52
  })();
53
53
  __webpack_require__.add({
54
- "./node_modules/.pnpm/@vercel+detect-agent@1.2.1/node_modules/@vercel/detect-agent/dist/index.js" (module, __unused_rspack_exports, __webpack_require__) {
54
+ "./node_modules/.pnpm/@vercel+detect-agent@1.2.2/node_modules/@vercel/detect-agent/dist/index.js" (module, __unused_rspack_exports, __webpack_require__) {
55
55
  var __defProp = Object.defineProperty;
56
56
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
57
57
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -81,7 +81,7 @@ __webpack_require__.add({
81
81
  });
82
82
  module.exports = __toCommonJS(src_exports);
83
83
  var import_promises = __webpack_require__("node:fs/promises");
84
- var import_node_fs = __webpack_require__("node:fs?31c0");
84
+ var import_node_fs = __webpack_require__("node:fs?9592");
85
85
  const DEVIN_LOCAL_PATH = "/opt/.devin";
86
86
  const CURSOR = "cursor";
87
87
  const CURSOR_CLI = "cursor-cli";
@@ -134,7 +134,7 @@ __webpack_require__.add({
134
134
  name: CURSOR
135
135
  }
136
136
  };
137
- if (process.env.CURSOR_AGENT) return {
137
+ if (process.env.CURSOR_AGENT || "agent-exec" === process.env.CURSOR_EXTENSION_HOST_ROLE) return {
138
138
  isAgent: true,
139
139
  agent: {
140
140
  name: CURSOR_CLI
@@ -527,172 +527,328 @@ __webpack_require__.add({
527
527
  beep
528
528
  };
529
529
  },
530
- "node:fs?31c0" (module) {
530
+ "node:fs?9592" (module) {
531
531
  module.exports = __rspack_createRequire_require("node:fs");
532
532
  },
533
533
  "node:fs/promises" (module) {
534
534
  module.exports = __rspack_createRequire_require("node:fs/promises");
535
535
  }
536
536
  });
537
- const src = __webpack_require__("./node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js");
538
- function x(t, e, s) {
539
- if (!s.some((u)=>!u.disabled)) return t;
540
- const i = t + e, r = Math.max(s.length - 1, 0), n = i < 0 ? r : i > r ? 0 : i;
541
- return s[n].disabled ? x(n, e < 0 ? -1 : 1, s) : n;
542
- }
543
- const dist_at = (t)=>161 === t || 164 === t || 167 === t || 168 === t || 170 === t || 173 === t || 174 === t || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || 198 === t || 208 === t || 215 === t || 216 === t || t >= 222 && t <= 225 || 230 === t || t >= 232 && t <= 234 || 236 === t || 237 === t || 240 === t || 242 === t || 243 === t || t >= 247 && t <= 250 || 252 === t || 254 === t || 257 === t || 273 === t || 275 === t || 283 === t || 294 === t || 295 === t || 299 === t || t >= 305 && t <= 307 || 312 === t || t >= 319 && t <= 322 || 324 === t || t >= 328 && t <= 331 || 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 || t >= 713 && t <= 715 || 717 === t || 720 === t || t >= 728 && t <= 731 || 733 === t || 735 === t || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || 1025 === t || t >= 1040 && t <= 1103 || 1105 === t || 8208 === t || t >= 8211 && t <= 8214 || 8216 === t || 8217 === t || 8220 === t || 8221 === t || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || 8240 === t || 8242 === t || 8243 === t || 8245 === t || 8251 === t || 8254 === t || 8308 === t || 8319 === t || t >= 8321 && t <= 8324 || 8364 === t || 8451 === t || 8453 === t || 8457 === t || 8467 === t || 8470 === t || 8481 === t || 8482 === t || 8486 === t || 8491 === t || 8531 === t || 8532 === t || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || 8585 === t || t >= 8592 && t <= 8601 || 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 || t >= 8733 && t <= 8736 || 8739 === t || 8741 === t || t >= 8743 && t <= 8748 || 8750 === t || t >= 8756 && t <= 8759 || 8764 === t || 8765 === t || 8776 === t || 8780 === t || 8786 === t || 8800 === t || 8801 === t || t >= 8804 && t <= 8807 || 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 || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || 9632 === t || 9633 === t || t >= 9635 && t <= 9641 || 9650 === t || 9651 === t || 9654 === t || 9655 === t || 9660 === t || 9661 === t || 9664 === t || 9665 === t || t >= 9670 && t <= 9672 || 9675 === t || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || 9711 === t || 9733 === t || 9734 === t || 9737 === t || 9742 === t || 9743 === t || 9756 === t || 9758 === t || 9792 === t || 9794 === t || 9824 === t || 9825 === t || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || 9836 === t || 9837 === t || 9839 === t || 9886 === t || 9887 === t || 9919 === t || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || 9955 === t || 9960 === t || 9961 === t || t >= 9963 && t <= 9969 || 9972 === t || t >= 9974 && t <= 9977 || 9979 === t || 9980 === t || 9982 === t || 9983 === t || 10045 === t || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || 65533 === t || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || 127375 === t || 127376 === t || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109, lt = (t)=>12288 === t || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510, dist_ht = (t)=>t >= 4352 && t <= 4447 || 8986 === t || 8987 === t || 9001 === t || 9002 === t || t >= 9193 && t <= 9196 || 9200 === t || 9203 === t || 9725 === t || 9726 === t || 9748 === t || 9749 === t || t >= 9800 && t <= 9811 || 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 || t >= 10067 && t <= 10069 || 10071 === t || t >= 10133 && t <= 10135 || 10160 === t || 10175 === t || 11035 === t || 11036 === t || 11088 === t || 11093 === t || 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 || 94192 === t || 94193 === t || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || 110589 === t || 110590 === t || t >= 110592 && t <= 110882 || 110898 === t || t >= 110928 && t <= 110930 || 110933 === t || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || 126980 === t || 127183 === t || 127374 === t || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || 127568 === t || 127569 === t || 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 || 127988 === t || t >= 127992 && t <= 128062 || 128064 === t || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || 128378 === t || 128405 === t || 128406 === t || 128420 === t || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || 128716 === t || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || 128747 === t || 128748 === t || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || 129008 === t || 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, dist_O = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y, dist_y = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, dist_L = /\t{1,1000}/y, dist_P = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu, dist_M = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, ct = /\p{M}+/gu, ft = {
537
+ const isAmbiguous = (x)=>0xA1 === x || 0xA4 === x || 0xA7 === x || 0xA8 === x || 0xAA === x || 0xAD === x || 0xAE === x || x >= 0xB0 && x <= 0xB4 || x >= 0xB6 && x <= 0xBA || x >= 0xBC && x <= 0xBF || 0xC6 === x || 0xD0 === x || 0xD7 === x || 0xD8 === x || x >= 0xDE && x <= 0xE1 || 0xE6 === x || x >= 0xE8 && x <= 0xEA || 0xEC === x || 0xED === x || 0xF0 === x || 0xF2 === x || 0xF3 === x || x >= 0xF7 && x <= 0xFA || 0xFC === x || 0xFE === x || 0x101 === x || 0x111 === x || 0x113 === x || 0x11B === x || 0x126 === x || 0x127 === x || 0x12B === x || x >= 0x131 && x <= 0x133 || 0x138 === x || x >= 0x13F && x <= 0x142 || 0x144 === x || x >= 0x148 && x <= 0x14B || 0x14D === x || 0x152 === x || 0x153 === x || 0x166 === x || 0x167 === x || 0x16B === x || 0x1CE === x || 0x1D0 === x || 0x1D2 === x || 0x1D4 === x || 0x1D6 === x || 0x1D8 === x || 0x1DA === x || 0x1DC === x || 0x251 === x || 0x261 === x || 0x2C4 === x || 0x2C7 === x || x >= 0x2C9 && x <= 0x2CB || 0x2CD === x || 0x2D0 === x || x >= 0x2D8 && x <= 0x2DB || 0x2DD === x || 0x2DF === x || x >= 0x300 && x <= 0x36F || x >= 0x391 && x <= 0x3A1 || x >= 0x3A3 && x <= 0x3A9 || x >= 0x3B1 && x <= 0x3C1 || x >= 0x3C3 && x <= 0x3C9 || 0x401 === x || x >= 0x410 && x <= 0x44F || 0x451 === x || 0x2010 === x || x >= 0x2013 && x <= 0x2016 || 0x2018 === x || 0x2019 === x || 0x201C === x || 0x201D === x || x >= 0x2020 && x <= 0x2022 || x >= 0x2024 && x <= 0x2027 || 0x2030 === x || 0x2032 === x || 0x2033 === x || 0x2035 === x || 0x203B === x || 0x203E === x || 0x2074 === x || 0x207F === x || x >= 0x2081 && x <= 0x2084 || 0x20AC === x || 0x2103 === x || 0x2105 === x || 0x2109 === x || 0x2113 === x || 0x2116 === x || 0x2121 === x || 0x2122 === x || 0x2126 === x || 0x212B === x || 0x2153 === x || 0x2154 === x || x >= 0x215B && x <= 0x215E || x >= 0x2160 && x <= 0x216B || x >= 0x2170 && x <= 0x2179 || 0x2189 === x || x >= 0x2190 && x <= 0x2199 || 0x21B8 === x || 0x21B9 === x || 0x21D2 === x || 0x21D4 === x || 0x21E7 === x || 0x2200 === x || 0x2202 === x || 0x2203 === x || 0x2207 === x || 0x2208 === x || 0x220B === x || 0x220F === x || 0x2211 === x || 0x2215 === x || 0x221A === x || x >= 0x221D && x <= 0x2220 || 0x2223 === x || 0x2225 === x || x >= 0x2227 && x <= 0x222C || 0x222E === x || x >= 0x2234 && x <= 0x2237 || 0x223C === x || 0x223D === x || 0x2248 === x || 0x224C === x || 0x2252 === x || 0x2260 === x || 0x2261 === x || x >= 0x2264 && x <= 0x2267 || 0x226A === x || 0x226B === x || 0x226E === x || 0x226F === x || 0x2282 === x || 0x2283 === x || 0x2286 === x || 0x2287 === x || 0x2295 === x || 0x2299 === x || 0x22A5 === x || 0x22BF === x || 0x2312 === x || x >= 0x2460 && x <= 0x24E9 || x >= 0x24EB && x <= 0x254B || x >= 0x2550 && x <= 0x2573 || x >= 0x2580 && x <= 0x258F || x >= 0x2592 && x <= 0x2595 || 0x25A0 === x || 0x25A1 === x || x >= 0x25A3 && x <= 0x25A9 || 0x25B2 === x || 0x25B3 === x || 0x25B6 === x || 0x25B7 === x || 0x25BC === x || 0x25BD === x || 0x25C0 === x || 0x25C1 === x || x >= 0x25C6 && x <= 0x25C8 || 0x25CB === x || x >= 0x25CE && x <= 0x25D1 || x >= 0x25E2 && x <= 0x25E5 || 0x25EF === x || 0x2605 === x || 0x2606 === x || 0x2609 === x || 0x260E === x || 0x260F === x || 0x261C === x || 0x261E === x || 0x2640 === x || 0x2642 === x || 0x2660 === x || 0x2661 === x || x >= 0x2663 && x <= 0x2665 || x >= 0x2667 && x <= 0x266A || 0x266C === x || 0x266D === x || 0x266F === x || 0x269E === x || 0x269F === x || 0x26BF === x || x >= 0x26C6 && x <= 0x26CD || x >= 0x26CF && x <= 0x26D3 || x >= 0x26D5 && x <= 0x26E1 || 0x26E3 === x || 0x26E8 === x || 0x26E9 === x || x >= 0x26EB && x <= 0x26F1 || 0x26F4 === x || x >= 0x26F6 && x <= 0x26F9 || 0x26FB === x || 0x26FC === x || 0x26FE === x || 0x26FF === x || 0x273D === x || x >= 0x2776 && x <= 0x277F || x >= 0x2B56 && x <= 0x2B59 || x >= 0x3248 && x <= 0x324F || x >= 0xE000 && x <= 0xF8FF || x >= 0xFE00 && x <= 0xFE0F || 0xFFFD === x || x >= 0x1F100 && x <= 0x1F10A || x >= 0x1F110 && x <= 0x1F12D || x >= 0x1F130 && x <= 0x1F169 || x >= 0x1F170 && x <= 0x1F18D || 0x1F18F === x || 0x1F190 === x || x >= 0x1F19B && x <= 0x1F1AC || x >= 0xE0100 && x <= 0xE01EF || x >= 0xF0000 && x <= 0xFFFFD || x >= 0x100000 && x <= 0x10FFFD;
538
+ const isFullWidth = (x)=>0x3000 === x || x >= 0xFF01 && x <= 0xFF60 || x >= 0xFFE0 && x <= 0xFFE6;
539
+ const isWide = (x)=>x >= 0x1100 && x <= 0x115F || 0x231A === x || 0x231B === x || 0x2329 === x || 0x232A === x || x >= 0x23E9 && x <= 0x23EC || 0x23F0 === x || 0x23F3 === x || 0x25FD === x || 0x25FE === x || 0x2614 === x || 0x2615 === x || x >= 0x2648 && x <= 0x2653 || 0x267F === x || 0x2693 === x || 0x26A1 === x || 0x26AA === x || 0x26AB === x || 0x26BD === x || 0x26BE === x || 0x26C4 === x || 0x26C5 === x || 0x26CE === x || 0x26D4 === x || 0x26EA === x || 0x26F2 === x || 0x26F3 === x || 0x26F5 === x || 0x26FA === x || 0x26FD === x || 0x2705 === x || 0x270A === x || 0x270B === x || 0x2728 === x || 0x274C === x || 0x274E === x || x >= 0x2753 && x <= 0x2755 || 0x2757 === x || x >= 0x2795 && x <= 0x2797 || 0x27B0 === x || 0x27BF === x || 0x2B1B === x || 0x2B1C === x || 0x2B50 === x || 0x2B55 === x || x >= 0x2E80 && x <= 0x2E99 || x >= 0x2E9B && x <= 0x2EF3 || x >= 0x2F00 && x <= 0x2FD5 || x >= 0x2FF0 && x <= 0x2FFF || x >= 0x3001 && x <= 0x303E || x >= 0x3041 && x <= 0x3096 || x >= 0x3099 && x <= 0x30FF || x >= 0x3105 && x <= 0x312F || x >= 0x3131 && x <= 0x318E || x >= 0x3190 && x <= 0x31E3 || x >= 0x31EF && x <= 0x321E || x >= 0x3220 && x <= 0x3247 || x >= 0x3250 && x <= 0x4DBF || x >= 0x4E00 && x <= 0xA48C || x >= 0xA490 && x <= 0xA4C6 || x >= 0xA960 && x <= 0xA97C || x >= 0xAC00 && x <= 0xD7A3 || x >= 0xF900 && x <= 0xFAFF || x >= 0xFE10 && x <= 0xFE19 || x >= 0xFE30 && x <= 0xFE52 || x >= 0xFE54 && x <= 0xFE66 || x >= 0xFE68 && x <= 0xFE6B || x >= 0x16FE0 && x <= 0x16FE4 || 0x16FF0 === x || 0x16FF1 === x || x >= 0x17000 && x <= 0x187F7 || x >= 0x18800 && x <= 0x18CD5 || x >= 0x18D00 && x <= 0x18D08 || x >= 0x1AFF0 && x <= 0x1AFF3 || x >= 0x1AFF5 && x <= 0x1AFFB || 0x1AFFD === x || 0x1AFFE === x || x >= 0x1B000 && x <= 0x1B122 || 0x1B132 === x || x >= 0x1B150 && x <= 0x1B152 || 0x1B155 === x || x >= 0x1B164 && x <= 0x1B167 || x >= 0x1B170 && x <= 0x1B2FB || 0x1F004 === x || 0x1F0CF === x || 0x1F18E === x || x >= 0x1F191 && x <= 0x1F19A || x >= 0x1F200 && x <= 0x1F202 || x >= 0x1F210 && x <= 0x1F23B || x >= 0x1F240 && x <= 0x1F248 || 0x1F250 === x || 0x1F251 === x || x >= 0x1F260 && x <= 0x1F265 || x >= 0x1F300 && x <= 0x1F320 || x >= 0x1F32D && x <= 0x1F335 || x >= 0x1F337 && x <= 0x1F37C || x >= 0x1F37E && x <= 0x1F393 || x >= 0x1F3A0 && x <= 0x1F3CA || x >= 0x1F3CF && x <= 0x1F3D3 || x >= 0x1F3E0 && x <= 0x1F3F0 || 0x1F3F4 === x || x >= 0x1F3F8 && x <= 0x1F43E || 0x1F440 === x || x >= 0x1F442 && x <= 0x1F4FC || x >= 0x1F4FF && x <= 0x1F53D || x >= 0x1F54B && x <= 0x1F54E || x >= 0x1F550 && x <= 0x1F567 || 0x1F57A === x || 0x1F595 === x || 0x1F596 === x || 0x1F5A4 === x || x >= 0x1F5FB && x <= 0x1F64F || x >= 0x1F680 && x <= 0x1F6C5 || 0x1F6CC === x || x >= 0x1F6D0 && x <= 0x1F6D2 || x >= 0x1F6D5 && x <= 0x1F6D7 || x >= 0x1F6DC && x <= 0x1F6DF || 0x1F6EB === x || 0x1F6EC === x || x >= 0x1F6F4 && x <= 0x1F6FC || x >= 0x1F7E0 && x <= 0x1F7EB || 0x1F7F0 === x || x >= 0x1F90C && x <= 0x1F93A || x >= 0x1F93C && x <= 0x1F945 || x >= 0x1F947 && x <= 0x1F9FF || x >= 0x1FA70 && x <= 0x1FA7C || x >= 0x1FA80 && x <= 0x1FA88 || x >= 0x1FA90 && x <= 0x1FABD || x >= 0x1FABF && x <= 0x1FAC5 || x >= 0x1FACE && x <= 0x1FADB || x >= 0x1FAE0 && x <= 0x1FAE8 || x >= 0x1FAF0 && x <= 0x1FAF8 || x >= 0x20000 && x <= 0x2FFFD || x >= 0x30000 && x <= 0x3FFFD;
540
+ const ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
541
+ const CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
542
+ const TAB_RE = /\t{1,1000}/y;
543
+ 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?))*/yu;
544
+ const LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
545
+ const MODIFIER_RE = /\p{M}+/gu;
546
+ const NO_TRUNCATION = {
544
547
  limit: 1 / 0,
545
- ellipsis: ""
546
- }, X = (t, e = {}, s = {})=>{
547
- const i = e.limit ?? 1 / 0, r = e.ellipsis ?? "", n = e?.ellipsisWidth ?? (r ? X(r, ft, s).width : 0), u = s.ansiWidth ?? 0, a = s.controlWidth ?? 0, l = s.tabWidth ?? 8, E = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, m = s.fullWidthWidth ?? 2, A = s.regularWidth ?? 1, V = s.wideWidth ?? 2;
548
- 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;
549
- t: for(;;){
550
- if (w > C || o >= p && o > h) {
551
- const ut = t.slice(C, w) || t.slice(h, o);
552
- v = 0;
553
- for (const Y of ut.replaceAll(ct, "")){
554
- const $ = Y.codePointAt(0) || 0;
555
- if (lt($) ? f = m : dist_ht($) ? f = V : E !== A && dist_at($) ? f = E : f = A, c + f > b && (d = Math.min(d, Math.max(C, h) + v)), c + f > i) {
556
- F = !0;
557
- break t;
548
+ ellipsis: ''
549
+ };
550
+ const getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {})=>{
551
+ const LIMIT = truncationOptions.limit ?? 1 / 0;
552
+ const ELLIPSIS = truncationOptions.ellipsis ?? '';
553
+ const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
554
+ const ANSI_WIDTH = widthOptions.ansiWidth ?? 0;
555
+ const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
556
+ const TAB_WIDTH = widthOptions.tabWidth ?? 8;
557
+ const AMBIGUOUS_WIDTH = widthOptions.ambiguousWidth ?? 1;
558
+ const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
559
+ const FULL_WIDTH_WIDTH = widthOptions.fullWidthWidth ?? 2;
560
+ const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
561
+ const WIDE_WIDTH = widthOptions.wideWidth ?? 2;
562
+ let indexPrev = 0;
563
+ let index = 0;
564
+ let length = input.length;
565
+ let lengthExtra = 0;
566
+ let truncationEnabled = false;
567
+ let truncationIndex = length;
568
+ let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
569
+ let unmatchedStart = 0;
570
+ let unmatchedEnd = 0;
571
+ let width = 0;
572
+ let widthExtra = 0;
573
+ outer: while(true){
574
+ if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
575
+ const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
576
+ lengthExtra = 0;
577
+ for (const char of unmatched.replaceAll(MODIFIER_RE, '')){
578
+ const codePoint = char.codePointAt(0) || 0;
579
+ widthExtra = isFullWidth(codePoint) ? FULL_WIDTH_WIDTH : isWide(codePoint) ? WIDE_WIDTH : AMBIGUOUS_WIDTH !== REGULAR_WIDTH && isAmbiguous(codePoint) ? AMBIGUOUS_WIDTH : REGULAR_WIDTH;
580
+ if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
581
+ if (width + widthExtra > LIMIT) {
582
+ truncationEnabled = true;
583
+ break outer;
558
584
  }
559
- v += Y.length, c += f;
585
+ lengthExtra += char.length;
586
+ width += widthExtra;
560
587
  }
561
- C = w = 0;
562
- }
563
- if (o >= p) break;
564
- if (dist_M.lastIndex = o, dist_M.test(t)) {
565
- if (v = dist_M.lastIndex - o, f = v * A, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / A))), c + f > i) {
566
- F = !0;
588
+ unmatchedStart = unmatchedEnd = 0;
589
+ }
590
+ if (index >= length) break;
591
+ LATIN_RE.lastIndex = index;
592
+ if (LATIN_RE.test(input)) {
593
+ lengthExtra = LATIN_RE.lastIndex - index;
594
+ widthExtra = lengthExtra * REGULAR_WIDTH;
595
+ if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / REGULAR_WIDTH));
596
+ if (width + widthExtra > LIMIT) {
597
+ truncationEnabled = true;
567
598
  break;
568
599
  }
569
- c += f, C = h, w = o, o = h = dist_M.lastIndex;
600
+ width += widthExtra;
601
+ unmatchedStart = indexPrev;
602
+ unmatchedEnd = index;
603
+ index = indexPrev = LATIN_RE.lastIndex;
570
604
  continue;
571
605
  }
572
- if (dist_O.lastIndex = o, dist_O.test(t)) {
573
- if (c + u > b && (d = Math.min(d, o)), c + u > i) {
574
- F = !0;
606
+ ANSI_RE.lastIndex = index;
607
+ if (ANSI_RE.test(input)) {
608
+ if (width + ANSI_WIDTH > truncationLimit) truncationIndex = Math.min(truncationIndex, index);
609
+ if (width + ANSI_WIDTH > LIMIT) {
610
+ truncationEnabled = true;
575
611
  break;
576
612
  }
577
- c += u, C = h, w = o, o = h = dist_O.lastIndex;
613
+ width += ANSI_WIDTH;
614
+ unmatchedStart = indexPrev;
615
+ unmatchedEnd = index;
616
+ index = indexPrev = ANSI_RE.lastIndex;
578
617
  continue;
579
618
  }
580
- if (dist_y.lastIndex = o, dist_y.test(t)) {
581
- if (v = dist_y.lastIndex - o, f = v * a, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / a))), c + f > i) {
582
- F = !0;
619
+ CONTROL_RE.lastIndex = index;
620
+ if (CONTROL_RE.test(input)) {
621
+ lengthExtra = CONTROL_RE.lastIndex - index;
622
+ widthExtra = lengthExtra * CONTROL_WIDTH;
623
+ if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / CONTROL_WIDTH));
624
+ if (width + widthExtra > LIMIT) {
625
+ truncationEnabled = true;
583
626
  break;
584
627
  }
585
- c += f, C = h, w = o, o = h = dist_y.lastIndex;
628
+ width += widthExtra;
629
+ unmatchedStart = indexPrev;
630
+ unmatchedEnd = index;
631
+ index = indexPrev = CONTROL_RE.lastIndex;
586
632
  continue;
587
633
  }
588
- if (dist_L.lastIndex = o, dist_L.test(t)) {
589
- if (v = dist_L.lastIndex - o, f = v * l, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / l))), c + f > i) {
590
- F = !0;
634
+ TAB_RE.lastIndex = index;
635
+ if (TAB_RE.test(input)) {
636
+ lengthExtra = TAB_RE.lastIndex - index;
637
+ widthExtra = lengthExtra * TAB_WIDTH;
638
+ if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / TAB_WIDTH));
639
+ if (width + widthExtra > LIMIT) {
640
+ truncationEnabled = true;
591
641
  break;
592
642
  }
593
- c += f, C = h, w = o, o = h = dist_L.lastIndex;
643
+ width += widthExtra;
644
+ unmatchedStart = indexPrev;
645
+ unmatchedEnd = index;
646
+ index = indexPrev = TAB_RE.lastIndex;
594
647
  continue;
595
648
  }
596
- if (dist_P.lastIndex = o, dist_P.test(t)) {
597
- if (c + g > b && (d = Math.min(d, o)), c + g > i) {
598
- F = !0;
649
+ EMOJI_RE.lastIndex = index;
650
+ if (EMOJI_RE.test(input)) {
651
+ if (width + EMOJI_WIDTH > truncationLimit) truncationIndex = Math.min(truncationIndex, index);
652
+ if (width + EMOJI_WIDTH > LIMIT) {
653
+ truncationEnabled = true;
599
654
  break;
600
655
  }
601
- c += g, C = h, w = o, o = h = dist_P.lastIndex;
656
+ width += EMOJI_WIDTH;
657
+ unmatchedStart = indexPrev;
658
+ unmatchedEnd = index;
659
+ index = indexPrev = EMOJI_RE.lastIndex;
602
660
  continue;
603
661
  }
604
- o += 1;
662
+ index += 1;
605
663
  }
606
664
  return {
607
- width: F ? b : c,
608
- index: F ? d : p,
609
- truncated: F,
610
- ellipsed: F && i >= n
665
+ width: truncationEnabled ? truncationLimit : width,
666
+ index: truncationEnabled ? truncationIndex : length,
667
+ truncated: truncationEnabled,
668
+ ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
611
669
  };
612
- }, pt = {
670
+ };
671
+ const dist = getStringTruncatedWidth;
672
+ const dist_NO_TRUNCATION = {
613
673
  limit: 1 / 0,
614
- ellipsis: "",
674
+ ellipsis: '',
615
675
  ellipsisWidth: 0
616
- }, dist_S = (t, e = {})=>X(t, pt, e).width, dist_T = "\x1B", dist_Z = "\x9B", Ft = 39, dist_j = "\x07", Q = "[", dist_dt = "]", tt = "m", U = `${dist_dt}8;;`, dist_et = new RegExp(`(?:\\${Q}(?<code>\\d+)m|\\${U}(?<uri>.*)${dist_j})`, "y"), mt = (t)=>{
617
- if (t >= 30 && t <= 37 || t >= 90 && t <= 97) return 39;
618
- if (t >= 40 && t <= 47 || t >= 100 && t <= 107) return 49;
619
- if (1 === t || 2 === t) return 22;
620
- if (3 === t) return 23;
621
- if (4 === t) return 24;
622
- if (7 === t) return 27;
623
- if (8 === t) return 28;
624
- if (9 === t) return 29;
625
- if (0 === t) return 0;
626
- }, dist_st = (t)=>`${dist_T}${Q}${t}${tt}`, dist_it = (t)=>`${dist_T}${U}${t}${dist_j}`, gt = (t)=>t.map((e)=>dist_S(e)), dist_G = (t, e, s)=>{
627
- const i = e[Symbol.iterator]();
628
- let r = !1, n = !1, u = t.at(-1), a = void 0 === u ? 0 : dist_S(u), l = i.next(), E = i.next(), g = 0;
629
- for(; !l.done;){
630
- const m = l.value, A = dist_S(m);
631
- a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m === dist_T || m === dist_Z) && (r = !0, n = e.startsWith(U, g + 1)), r ? n ? m === dist_j && (r = !1, n = !1) : m === tt && (r = !1) : (a += A, a !== s || E.done || (t.push(""), a = 0)), l = E, E = i.next(), g += m.length;
632
- }
633
- u = t.at(-1), !a && void 0 !== u && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
634
- }, vt = (t)=>{
635
- const e = t.split(" ");
636
- let s = e.length;
637
- for(; s > 0 && !(dist_S(e[s - 1]) > 0);)s--;
638
- return s === e.length ? t : e.slice(0, s).join(" ") + e.slice(s).join("");
639
- }, Et = (t, e, s = {})=>{
640
- if (!1 !== s.trim && "" === t.trim()) return "";
641
- let i = "", r, n;
642
- const u = t.split(" "), a = gt(u);
643
- let l = [
644
- ""
676
+ };
677
+ const fastStringWidth = (input, options = {})=>dist(input, dist_NO_TRUNCATION, options).width;
678
+ const fast_string_width_dist = fastStringWidth;
679
+ const ESC = '\x1B';
680
+ const CSI = '\x9B';
681
+ const END_CODE = 39;
682
+ const ANSI_ESCAPE_BELL = '\u0007';
683
+ const ANSI_CSI = '[';
684
+ const ANSI_OSC = ']';
685
+ const ANSI_SGR_TERMINATOR = 'm';
686
+ const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
687
+ const GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, 'y');
688
+ const getClosingCode = (openingCode)=>{
689
+ if (openingCode >= 30 && openingCode <= 37) return 39;
690
+ if (openingCode >= 90 && openingCode <= 97) return 39;
691
+ if (openingCode >= 40 && openingCode <= 47) return 49;
692
+ if (openingCode >= 100 && openingCode <= 107) return 49;
693
+ if (1 === openingCode || 2 === openingCode) return 22;
694
+ if (3 === openingCode) return 23;
695
+ if (4 === openingCode) return 24;
696
+ if (7 === openingCode) return 27;
697
+ if (8 === openingCode) return 28;
698
+ if (9 === openingCode) return 29;
699
+ if (0 === openingCode) return 0;
700
+ };
701
+ const wrapAnsiCode = (code)=>`${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
702
+ const wrapAnsiHyperlink = (url)=>`${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
703
+ const wrapWord = (rows, word, columns)=>{
704
+ const characters = word[Symbol.iterator]();
705
+ let isInsideEscape = false;
706
+ let isInsideLinkEscape = false;
707
+ let lastRow = rows.at(-1);
708
+ let visible = void 0 === lastRow ? 0 : fast_string_width_dist(lastRow);
709
+ let currentCharacter = characters.next();
710
+ let nextCharacter = characters.next();
711
+ let rawCharacterIndex = 0;
712
+ while(!currentCharacter.done){
713
+ const character = currentCharacter.value;
714
+ const characterLength = fast_string_width_dist(character);
715
+ if (visible + characterLength <= columns) rows[rows.length - 1] += character;
716
+ else {
717
+ rows.push(character);
718
+ visible = 0;
719
+ }
720
+ if (character === ESC || character === CSI) {
721
+ isInsideEscape = true;
722
+ isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
723
+ }
724
+ if (isInsideEscape) {
725
+ if (isInsideLinkEscape) {
726
+ if (character === ANSI_ESCAPE_BELL) {
727
+ isInsideEscape = false;
728
+ isInsideLinkEscape = false;
729
+ }
730
+ } else if (character === ANSI_SGR_TERMINATOR) isInsideEscape = false;
731
+ } else {
732
+ visible += characterLength;
733
+ if (visible === columns && !nextCharacter.done) {
734
+ rows.push('');
735
+ visible = 0;
736
+ }
737
+ }
738
+ currentCharacter = nextCharacter;
739
+ nextCharacter = characters.next();
740
+ rawCharacterIndex += character.length;
741
+ }
742
+ lastRow = rows.at(-1);
743
+ if (!visible && void 0 !== lastRow && lastRow.length && rows.length > 1) rows[rows.length - 2] += rows.pop();
744
+ };
745
+ const stringVisibleTrimSpacesRight = (string)=>{
746
+ const words = string.split(' ');
747
+ let last = words.length;
748
+ while(last){
749
+ if (fast_string_width_dist(words[last - 1])) break;
750
+ last--;
751
+ }
752
+ if (last === words.length) return string;
753
+ return words.slice(0, last).join(' ') + words.slice(last).join('');
754
+ };
755
+ const exec = (string, columns, options = {})=>{
756
+ if (false !== options.trim && '' === string.trim()) return '';
757
+ let returnValue = '';
758
+ let escapeCode;
759
+ let escapeUrl;
760
+ const words = string.split(' ');
761
+ let rows = [
762
+ ''
645
763
  ];
646
- for (const [h, o] of u.entries()){
647
- !1 !== s.trim && (l[l.length - 1] = (l.at(-1) ?? "").trimStart());
648
- let p = dist_S(l.at(-1) ?? "");
649
- if (0 !== h && (p >= e && (!1 === s.wordWrap || !1 === s.trim) && (l.push(""), p = 0), (p > 0 || !1 === s.trim) && (l[l.length - 1] += " ", p++)), s.hard && a[h] > e) {
650
- const v = e - p, F = 1 + Math.floor((a[h] - v - 1) / e);
651
- Math.floor((a[h] - 1) / e) < F && l.push(""), dist_G(l, o, e);
764
+ let rowLength = 0;
765
+ for(let index = 0; index < words.length; index++){
766
+ const word = words[index];
767
+ if (false !== options.trim) {
768
+ const row = rows.at(-1) ?? '';
769
+ const trimmed = row.trimStart();
770
+ if (row.length !== trimmed.length) {
771
+ rows[rows.length - 1] = trimmed;
772
+ rowLength = fast_string_width_dist(trimmed);
773
+ }
774
+ }
775
+ if (0 !== index) {
776
+ if (rowLength >= columns && (false === options.wordWrap || false === options.trim)) {
777
+ rows.push('');
778
+ rowLength = 0;
779
+ }
780
+ if (rowLength || false === options.trim) {
781
+ rows[rows.length - 1] += ' ';
782
+ rowLength++;
783
+ }
784
+ }
785
+ const wordLength = fast_string_width_dist(word);
786
+ if (options.hard && wordLength > columns) {
787
+ const remainingColumns = columns - rowLength;
788
+ const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
789
+ const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
790
+ if (breaksStartingNextLine < breaksStartingThisLine) rows.push('');
791
+ wrapWord(rows, word, columns);
792
+ rowLength = fast_string_width_dist(rows.at(-1) ?? '');
652
793
  continue;
653
794
  }
654
- if (p + a[h] > e && p > 0 && a[h] > 0) {
655
- if (!1 === s.wordWrap && p < e) {
656
- dist_G(l, o, e);
795
+ if (rowLength + wordLength > columns && rowLength && wordLength) {
796
+ if (false === options.wordWrap && rowLength < columns) {
797
+ wrapWord(rows, word, columns);
798
+ rowLength = fast_string_width_dist(rows.at(-1) ?? '');
657
799
  continue;
658
800
  }
659
- l.push("");
801
+ rows.push('');
802
+ rowLength = 0;
660
803
  }
661
- if (p + a[h] > e && !1 === s.wordWrap) {
662
- dist_G(l, o, e);
804
+ if (rowLength + wordLength > columns && false === options.wordWrap) {
805
+ wrapWord(rows, word, columns);
806
+ rowLength = fast_string_width_dist(rows.at(-1) ?? '');
663
807
  continue;
664
808
  }
665
- l[l.length - 1] += o;
666
- }
667
- !1 !== s.trim && (l = l.map((h)=>vt(h)));
668
- const E = l.join(`
669
- `), g = E[Symbol.iterator]();
670
- let m = g.next(), A = g.next(), V = 0;
671
- for(; !m.done;){
672
- const h = m.value, o = A.value;
673
- if (i += h, h === dist_T || h === dist_Z) {
674
- dist_et.lastIndex = V + 1;
675
- const F = dist_et.exec(E)?.groups;
676
- if (F?.code !== void 0) {
677
- const d = Number.parseFloat(F.code);
678
- r = d === Ft ? void 0 : d;
679
- } else F?.uri !== void 0 && (n = 0 === F.uri.length ? void 0 : F.uri);
680
- }
681
- const p = r ? mt(r) : void 0;
682
- o === `
683
- ` ? (n && (i += dist_it("")), r && p && (i += dist_st(p))) : h === `
684
- ` && (r && p && (i += dist_st(r)), n && (i += dist_it(n))), V += h.length, m = A, A = g.next();
685
- }
686
- return i;
809
+ rows[rows.length - 1] += word;
810
+ rowLength += wordLength;
811
+ }
812
+ if (false !== options.trim) rows = rows.map((row)=>stringVisibleTrimSpacesRight(row));
813
+ const preString = rows.join('\n');
814
+ let inSurrogate = false;
815
+ for(let i = 0; i < preString.length; i++){
816
+ const character = preString[i];
817
+ returnValue += character;
818
+ if (!inSurrogate) {
819
+ inSurrogate = character >= '\ud800' && character <= '\udbff';
820
+ if (character === ESC || character === CSI) {
821
+ GROUP_REGEX.lastIndex = i + 1;
822
+ const groupsResult = GROUP_REGEX.exec(preString);
823
+ const groups = groupsResult?.groups;
824
+ if (groups?.code !== void 0) {
825
+ const code = Number.parseFloat(groups.code);
826
+ escapeCode = code === END_CODE ? void 0 : code;
827
+ } else if (groups?.uri !== void 0) escapeUrl = 0 === groups.uri.length ? void 0 : groups.uri;
828
+ }
829
+ if ('\n' === preString[i + 1]) {
830
+ if (escapeUrl) returnValue += wrapAnsiHyperlink('');
831
+ const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
832
+ if (escapeCode && closingCode) returnValue += wrapAnsiCode(closingCode);
833
+ } else if ('\n' === character) {
834
+ if (escapeCode && getClosingCode(escapeCode)) returnValue += wrapAnsiCode(escapeCode);
835
+ if (escapeUrl) returnValue += wrapAnsiHyperlink(escapeUrl);
836
+ }
837
+ }
838
+ }
839
+ return returnValue;
687
840
  };
688
- function K(t, e, s) {
689
- return String(t).normalize().replaceAll(`\r
690
- `, `
691
- `).split(`
692
- `).map((i)=>Et(i, e, s)).join(`
693
- `);
841
+ const CRLF_OR_LF = /\r?\n/;
842
+ function wrapAnsi(string, columns, options) {
843
+ return String(string).normalize().split(CRLF_OR_LF).map((line)=>exec(line, columns, options)).join('\n');
844
+ }
845
+ const src = __webpack_require__("./node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js");
846
+ function dist_d(r, t, e) {
847
+ if (!e.some((o)=>!o.disabled)) return r;
848
+ const s = r + t, i = Math.max(e.length - 1, 0), n = s < 0 ? i : s > i ? 0 : s;
849
+ return e[n].disabled ? dist_d(n, t < 0 ? -1 : 1, e) : n;
694
850
  }
695
- const At = [
851
+ const E = [
696
852
  "up",
697
853
  "down",
698
854
  "left",
@@ -700,8 +856,21 @@ const At = [
700
856
  "space",
701
857
  "enter",
702
858
  "cancel"
703
- ], dist_ = {
704
- actions: new Set(At),
859
+ ], dist_G = [
860
+ "January",
861
+ "February",
862
+ "March",
863
+ "April",
864
+ "May",
865
+ "June",
866
+ "July",
867
+ "August",
868
+ "September",
869
+ "October",
870
+ "November",
871
+ "December"
872
+ ], dist_u = {
873
+ actions: new Set(E),
705
874
  aliases: new Map([
706
875
  [
707
876
  "k",
@@ -732,75 +901,58 @@ const At = [
732
901
  cancel: "Canceled",
733
902
  error: "Something went wrong"
734
903
  },
735
- withGuide: !0
904
+ withGuide: !0,
905
+ date: {
906
+ monthNames: [
907
+ ...dist_G
908
+ ],
909
+ messages: {
910
+ required: "Please enter a valid date",
911
+ invalidMonth: "There are only 12 months in a year",
912
+ invalidDay: (r, t)=>`There are only ${r} days in ${t}`,
913
+ afterMin: (r)=>`Date must be on or after ${r.toISOString().slice(0, 10)}`,
914
+ beforeMax: (r)=>`Date must be on or before ${r.toISOString().slice(0, 10)}`
915
+ }
916
+ }
736
917
  };
737
- function H(t, e) {
738
- if ("string" == typeof t) return dist_.aliases.get(t) === e;
739
- for (const s of t)if (void 0 !== s && H(s, e)) return !0;
918
+ function V(r, t) {
919
+ if ("string" == typeof r) return dist_u.aliases.get(r) === t;
920
+ for (const e of r)if (void 0 !== e && V(e, t)) return !0;
740
921
  return !1;
741
922
  }
742
- function _t(t, e) {
743
- if (t === e) return;
744
- const s = t.split(`
745
- `), i = e.split(`
746
- `), r = Math.max(s.length, i.length), n = [];
747
- for(let u = 0; u < r; u++)s[u] !== i[u] && n.push(u);
923
+ function dist_j(r, t) {
924
+ if (r === t) return;
925
+ const e = r.split(`
926
+ `), s = t.split(`
927
+ `), i = Math.max(e.length, s.length), n = [];
928
+ for(let o = 0; o < i; o++)e[o] !== s[o] && n.push(o);
748
929
  return {
749
930
  lines: n,
750
- numLinesBefore: s.length,
751
- numLinesAfter: i.length,
752
- numLines: r
931
+ numLinesBefore: e.length,
932
+ numLinesAfter: s.length,
933
+ numLines: i
753
934
  };
754
935
  }
755
- const bt = globalThis.process.platform.startsWith("win"), z = Symbol("clack:cancel");
756
- function Ct(t) {
757
- return t === z;
936
+ globalThis.process.platform.startsWith("win");
937
+ const dist_C = Symbol("clack:cancel");
938
+ function dist_q(r) {
939
+ return r === dist_C;
758
940
  }
759
- function W(t, e) {
760
- const s = t;
761
- s.isTTY && s.setRawMode(e);
941
+ function w(r, t) {
942
+ const e = r;
943
+ e.isTTY && e.setRawMode(t);
762
944
  }
763
- function xt({ input: t = stdin, output: e = stdout, overwrite: s = !0, hideCursor: i = !0 } = {}) {
764
- const r = __rspack_external_node_readline_91c31510.createInterface({
765
- input: t,
766
- output: e,
767
- prompt: "",
768
- tabSize: 1
769
- });
770
- __rspack_external_node_readline_91c31510.emitKeypressEvents(t, r), t instanceof ReadStream && t.isTTY && t.setRawMode(!0);
771
- const n = (u, { name: a, sequence: l })=>{
772
- const E = String(u);
773
- if (H([
774
- E,
775
- a,
776
- l
777
- ], "cancel")) {
778
- i && e.write(src.cursor.show), process.exit(0);
779
- return;
780
- }
781
- if (!s) return;
782
- const g = "return" === a ? 0 : -1, m = "return" === a ? -1 : 0;
783
- __rspack_external_node_readline_91c31510.moveCursor(e, g, m, ()=>{
784
- __rspack_external_node_readline_91c31510.clearLine(e, 1, ()=>{
785
- t.once("keypress", n);
786
- });
787
- });
788
- };
789
- return i && e.write(src.cursor.hide), t.once("keypress", n), ()=>{
790
- t.off("keypress", n), i && e.write(src.cursor.show), t instanceof ReadStream && t.isTTY && !bt && t.setRawMode(!1), r.terminal = !1, r.close();
791
- };
792
- }
793
- const dist_rt = (t)=>"columns" in t && "number" == typeof t.columns ? t.columns : 80, nt = (t)=>"rows" in t && "number" == typeof t.rows ? t.rows : 20;
794
- function Bt(t, e, s, i = s) {
795
- const r = dist_rt(t ?? stdout);
796
- return K(e, r - s.length, {
945
+ const O = (r)=>"columns" in r && "number" == typeof r.columns ? r.columns : 80, dist_A = (r)=>"rows" in r && "number" == typeof r.rows ? r.rows : 20;
946
+ function dist_R(r, t, e, s = e) {
947
+ const i = O(r ?? stdout);
948
+ return wrapAnsi(t, i - e.length, {
797
949
  hard: !0,
798
950
  trim: !1
799
951
  }).split(`
800
- `).map((n, u)=>`${0 === u ? i : s}${n}`).join(`
952
+ `).map((n, o)=>`${0 === o ? s : e}${n}`).join(`
801
953
  `);
802
954
  }
803
- class dist_B {
955
+ let dist_p = class {
804
956
  input;
805
957
  output;
806
958
  _abortSignal;
@@ -815,64 +967,64 @@ class dist_B {
815
967
  error = "";
816
968
  value;
817
969
  userInput = "";
818
- constructor(e, s = !0){
819
- const { input: i = stdin, output: r = stdout, render: n, signal: u, ...a } = e;
820
- 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;
970
+ constructor(t, e = !0){
971
+ const { input: s = stdin, output: i = stdout, render: n, signal: o, ...a } = t;
972
+ 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 = e, this._abortSignal = o, this.input = s, this.output = i;
821
973
  }
822
974
  unsubscribe() {
823
975
  this._subscribers.clear();
824
976
  }
825
- setSubscriber(e, s) {
826
- const i = this._subscribers.get(e) ?? [];
827
- i.push(s), this._subscribers.set(e, i);
977
+ setSubscriber(t, e) {
978
+ const s = this._subscribers.get(t) ?? [];
979
+ s.push(e), this._subscribers.set(t, s);
828
980
  }
829
- on(e, s) {
830
- this.setSubscriber(e, {
831
- cb: s
981
+ on(t, e) {
982
+ this.setSubscriber(t, {
983
+ cb: e
832
984
  });
833
985
  }
834
- once(e, s) {
835
- this.setSubscriber(e, {
836
- cb: s,
986
+ once(t, e) {
987
+ this.setSubscriber(t, {
988
+ cb: e,
837
989
  once: !0
838
990
  });
839
991
  }
840
- emit(e, ...s) {
841
- const i = this._subscribers.get(e) ?? [], r = [];
842
- for (const n of i)n.cb(...s), n.once && r.push(()=>i.splice(i.indexOf(n), 1));
843
- for (const n of r)n();
992
+ emit(t, ...e) {
993
+ const s = this._subscribers.get(t) ?? [], i = [];
994
+ for (const n of s)n.cb(...e), n.once && i.push(()=>s.splice(s.indexOf(n), 1));
995
+ for (const n of i)n();
844
996
  }
845
997
  prompt() {
846
- return new Promise((e)=>{
998
+ return new Promise((t)=>{
847
999
  if (this._abortSignal) {
848
- if (this._abortSignal.aborted) return this.state = "cancel", this.close(), e(z);
1000
+ if (this._abortSignal.aborted) return this.state = "cancel", this.close(), t(dist_C);
849
1001
  this._abortSignal.addEventListener("abort", ()=>{
850
1002
  this.state = "cancel", this.close();
851
1003
  }, {
852
1004
  once: !0
853
1005
  });
854
1006
  }
855
- this.rl = __rspack_external_node_readline_91c31510["default"].createInterface({
1007
+ this.rl = node_readline.createInterface({
856
1008
  input: this.input,
857
1009
  tabSize: 2,
858
1010
  prompt: "",
859
1011
  escapeCodeTimeout: 50,
860
1012
  terminal: !0
861
- }), this.rl.prompt(), void 0 !== this.opts.initialUserInput && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress), W(this.input, !0), this.output.on("resize", this.render), this.render(), this.once("submit", ()=>{
862
- this.output.write(src.cursor.show), this.output.off("resize", this.render), W(this.input, !1), e(this.value);
1013
+ }), this.rl.prompt(), void 0 !== this.opts.initialUserInput && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress), w(this.input, !0), this.output.on("resize", this.render), this.render(), this.once("submit", ()=>{
1014
+ this.output.write(src.cursor.show), this.output.off("resize", this.render), w(this.input, !1), t(this.value);
863
1015
  }), this.once("cancel", ()=>{
864
- this.output.write(src.cursor.show), this.output.off("resize", this.render), W(this.input, !1), e(z);
1016
+ this.output.write(src.cursor.show), this.output.off("resize", this.render), w(this.input, !1), t(dist_C);
865
1017
  });
866
1018
  });
867
1019
  }
868
- _isActionKey(e, s) {
869
- return " " === e;
1020
+ _isActionKey(t, e) {
1021
+ return " " === t;
870
1022
  }
871
- _setValue(e) {
872
- this.value = e, this.emit("value", this.value);
1023
+ _setValue(t) {
1024
+ this.value = t, this.emit("value", this.value);
873
1025
  }
874
- _setUserInput(e, s) {
875
- this.userInput = e ?? "", this.emit("userInput", this.userInput), s && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
1026
+ _setUserInput(t, e) {
1027
+ this.userInput = t ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
876
1028
  }
877
1029
  _clearUserInput() {
878
1030
  this.rl?.write(null, {
@@ -880,121 +1032,280 @@ class dist_B {
880
1032
  name: "u"
881
1033
  }), this._setUserInput("");
882
1034
  }
883
- onKeypress(e, s) {
884
- if (this._track && "return" !== s.name && (s.name && this._isActionKey(e, s) && this.rl?.write(null, {
1035
+ onKeypress(t, e) {
1036
+ if (this._track && "return" !== e.name && (e.name && this._isActionKey(t, e) && this.rl?.write(null, {
885
1037
  ctrl: !0,
886
1038
  name: "h"
887
- }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), "error" === this.state && (this.state = "active"), s?.name && (!this._track && dist_.aliases.has(s.name) && this.emit("cursor", dist_.aliases.get(s.name)), dist_.actions.has(s.name) && this.emit("cursor", s.name)), e && ("y" === e.toLowerCase() || "n" === e.toLowerCase()) && this.emit("confirm", "y" === e.toLowerCase()), this.emit("key", e?.toLowerCase(), s), s?.name === "return") {
1039
+ }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), "error" === this.state && (this.state = "active"), e?.name && (!this._track && dist_u.aliases.has(e.name) && this.emit("cursor", dist_u.aliases.get(e.name)), dist_u.actions.has(e.name) && this.emit("cursor", e.name)), t && ("y" === t.toLowerCase() || "n" === t.toLowerCase()) && this.emit("confirm", "y" === t.toLowerCase()), this.emit("key", t?.toLowerCase(), e), e?.name === "return") {
888
1040
  if (this.opts.validate) {
889
- const i = this.opts.validate(this.value);
890
- i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput));
1041
+ const s = this.opts.validate(this.value);
1042
+ s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
891
1043
  }
892
1044
  "error" !== this.state && (this.state = "submit");
893
1045
  }
894
- H([
895
- e,
896
- s?.name,
897
- s?.sequence
1046
+ V([
1047
+ t,
1048
+ e?.name,
1049
+ e?.sequence
898
1050
  ], "cancel") && (this.state = "cancel"), ("submit" === this.state || "cancel" === this.state) && this.emit("finalize"), this.render(), ("submit" === this.state || "cancel" === this.state) && this.close();
899
1051
  }
900
1052
  close() {
901
1053
  this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
902
- `), W(this.input, !1), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
1054
+ `), w(this.input, !1), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
903
1055
  }
904
1056
  restoreCursor() {
905
- const e = K(this._prevFrame, process.stdout.columns, {
1057
+ const t = wrapAnsi(this._prevFrame, process.stdout.columns, {
906
1058
  hard: !0,
907
1059
  trim: !1
908
1060
  }).split(`
909
1061
  `).length - 1;
910
- this.output.write(src.cursor.move(-999, -1 * e));
1062
+ this.output.write(src.cursor.move(-999, -1 * t));
911
1063
  }
912
1064
  render() {
913
- const e = K(this._render(this) ?? "", process.stdout.columns, {
1065
+ const t = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
914
1066
  hard: !0,
915
1067
  trim: !1
916
1068
  });
917
- if (e !== this._prevFrame) {
1069
+ if (t !== this._prevFrame) {
918
1070
  if ("initial" === this.state) this.output.write(src.cursor.hide);
919
1071
  else {
920
- const s = _t(this._prevFrame, e), i = nt(this.output);
921
- if (this.restoreCursor(), s) {
922
- const r = Math.max(0, s.numLinesAfter - i), n = Math.max(0, s.numLinesBefore - i);
923
- let u = s.lines.find((a)=>a >= r);
924
- if (void 0 === u) {
925
- this._prevFrame = e;
1072
+ const e = dist_j(this._prevFrame, t), s = dist_A(this.output);
1073
+ if (this.restoreCursor(), e) {
1074
+ const i = Math.max(0, e.numLinesAfter - s), n = Math.max(0, e.numLinesBefore - s);
1075
+ let o = e.lines.find((a)=>a >= i);
1076
+ if (void 0 === o) {
1077
+ this._prevFrame = t;
926
1078
  return;
927
1079
  }
928
- if (1 === s.lines.length) {
929
- this.output.write(src.cursor.move(0, u - n)), this.output.write(src.erase.lines(1));
930
- const a = e.split(`
1080
+ if (1 === e.lines.length) {
1081
+ this.output.write(src.cursor.move(0, o - n)), this.output.write(src.erase.lines(1));
1082
+ const a = t.split(`
931
1083
  `);
932
- this.output.write(a[u]), this._prevFrame = e, this.output.write(src.cursor.move(0, a.length - u - 1));
1084
+ this.output.write(a[o]), this._prevFrame = t, this.output.write(src.cursor.move(0, a.length - o - 1));
933
1085
  return;
934
1086
  }
935
- if (s.lines.length > 1) {
936
- if (r < n) u = r;
1087
+ if (e.lines.length > 1) {
1088
+ if (i < n) o = i;
937
1089
  else {
938
- const l = u - n;
939
- l > 0 && this.output.write(src.cursor.move(0, l));
1090
+ const h = o - n;
1091
+ h > 0 && this.output.write(src.cursor.move(0, h));
940
1092
  }
941
1093
  this.output.write(src.erase.down());
942
- const a = e.split(`
943
- `).slice(u);
1094
+ const a = t.split(`
1095
+ `).slice(o);
944
1096
  this.output.write(a.join(`
945
- `)), this._prevFrame = e;
1097
+ `)), this._prevFrame = t;
946
1098
  return;
947
1099
  }
948
1100
  }
949
1101
  this.output.write(src.erase.down());
950
1102
  }
951
- this.output.write(e), "initial" === this.state && (this.state = "active"), this._prevFrame = e;
1103
+ this.output.write(t), "initial" === this.state && (this.state = "active"), this._prevFrame = t;
1104
+ }
1105
+ }
1106
+ };
1107
+ function dist_W(r, t) {
1108
+ if (void 0 === r || 0 === t.length) return 0;
1109
+ const e = t.findIndex((s)=>s.value === r);
1110
+ return -1 !== e ? e : 0;
1111
+ }
1112
+ function dist_B(r, t) {
1113
+ return (t.label ?? String(t.value)).toLowerCase().includes(r.toLowerCase());
1114
+ }
1115
+ function J(r, t) {
1116
+ if (t) return r ? t : t[0];
1117
+ }
1118
+ let H = class extends dist_p {
1119
+ filteredOptions;
1120
+ multiple;
1121
+ isNavigating = !1;
1122
+ selectedValues = [];
1123
+ focusedValue;
1124
+ #e = 0;
1125
+ #o = "";
1126
+ #t;
1127
+ #n;
1128
+ #a;
1129
+ get cursor() {
1130
+ return this.#e;
1131
+ }
1132
+ get userInputWithCursor() {
1133
+ if (!this.userInput) return styleText([
1134
+ "inverse",
1135
+ "hidden"
1136
+ ], "_");
1137
+ if (this._cursor >= this.userInput.length) return `${this.userInput}\u2588`;
1138
+ const t = this.userInput.slice(0, this._cursor), [e, ...s] = this.userInput.slice(this._cursor);
1139
+ return `${t}${styleText("inverse", e)}${s.join("")}`;
1140
+ }
1141
+ get options() {
1142
+ return "function" == typeof this.#n ? this.#n() : this.#n;
1143
+ }
1144
+ constructor(t){
1145
+ super(t), this.#n = t.options, this.#a = t.placeholder;
1146
+ const e = this.options;
1147
+ this.filteredOptions = [
1148
+ ...e
1149
+ ], this.multiple = !0 === t.multiple, this.#t = "function" == typeof t.options ? t.filter : t.filter ?? dist_B;
1150
+ let s;
1151
+ if (t.initialValue && Array.isArray(t.initialValue) ? this.multiple ? s = t.initialValue : s = t.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (s = [
1152
+ this.options[0].value
1153
+ ]), s) for (const i of s){
1154
+ const n = e.findIndex((o)=>o.value === i);
1155
+ -1 !== n && (this.toggleSelected(i), this.#e = n);
1156
+ }
1157
+ this.focusedValue = this.options[this.#e]?.value, this.on("key", (i, n)=>this.#s(i, n)), this.on("userInput", (i)=>this.#i(i));
1158
+ }
1159
+ _isActionKey(t, e) {
1160
+ return " " === t || this.multiple && this.isNavigating && "space" === e.name && void 0 !== t && "" !== t;
1161
+ }
1162
+ #s(t, e) {
1163
+ const s = "up" === e.name, i = "down" === e.name, n = "return" === e.name, o = "" === this.userInput || " " === this.userInput, a = this.#a, h = this.options, l = void 0 !== a && "" !== a && h.some((f)=>!f.disabled && (this.#t ? this.#t(a, f) : !0));
1164
+ if ("tab" === e.name && o && l) {
1165
+ " " === this.userInput && this._clearUserInput(), this._setUserInput(a, !0), this.isNavigating = !1;
1166
+ return;
1167
+ }
1168
+ s || i ? (this.#e = dist_d(this.#e, s ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#e]?.value, this.multiple || (this.selectedValues = [
1169
+ this.focusedValue
1170
+ ]), this.isNavigating = !0) : n ? this.value = J(this.multiple, this.selectedValues) : this.multiple ? void 0 !== this.focusedValue && ("tab" === e.name || this.isNavigating && "space" === e.name) ? this.toggleSelected(this.focusedValue) : this.isNavigating = !1 : (this.focusedValue && (this.selectedValues = [
1171
+ this.focusedValue
1172
+ ]), this.isNavigating = !1);
1173
+ }
1174
+ deselectAll() {
1175
+ this.selectedValues = [];
1176
+ }
1177
+ toggleSelected(t) {
1178
+ 0 !== this.filteredOptions.length && (this.multiple ? this.selectedValues.includes(t) ? this.selectedValues = this.selectedValues.filter((e)=>e !== t) : this.selectedValues = [
1179
+ ...this.selectedValues,
1180
+ t
1181
+ ] : this.selectedValues = [
1182
+ t
1183
+ ]);
1184
+ }
1185
+ #i(t) {
1186
+ if (t !== this.#o) {
1187
+ this.#o = t;
1188
+ const e = this.options;
1189
+ t && this.#t ? this.filteredOptions = e.filter((n)=>this.#t?.(t, n)) : this.filteredOptions = [
1190
+ ...e
1191
+ ];
1192
+ const s = dist_W(this.focusedValue, this.filteredOptions);
1193
+ this.#e = dist_d(s, 0, this.filteredOptions);
1194
+ const i = this.filteredOptions[this.#e];
1195
+ i && !i.disabled ? this.focusedValue = i.value : this.focusedValue = void 0, this.multiple || (void 0 !== this.focusedValue ? this.toggleSelected(this.focusedValue) : this.deselectAll());
1196
+ }
1197
+ }
1198
+ };
1199
+ class st extends dist_p {
1200
+ options;
1201
+ cursor = 0;
1202
+ #e;
1203
+ getGroupItems(t) {
1204
+ return this.options.filter((e)=>e.group === t);
1205
+ }
1206
+ isGroupSelected(t) {
1207
+ const e = this.getGroupItems(t), s = this.value;
1208
+ return void 0 === s ? !1 : e.every((i)=>s.includes(i.value));
1209
+ }
1210
+ toggleValue() {
1211
+ const t = this.options[this.cursor];
1212
+ if (void 0 === this.value && (this.value = []), !0 === t.group) {
1213
+ const e = t.value, s = this.getGroupItems(e);
1214
+ this.isGroupSelected(e) ? this.value = this.value.filter((i)=>-1 === s.findIndex((n)=>n.value === i)) : this.value = [
1215
+ ...this.value,
1216
+ ...s.map((i)=>i.value)
1217
+ ], this.value = Array.from(new Set(this.value));
1218
+ } else {
1219
+ const e = this.value.includes(t.value);
1220
+ this.value = e ? this.value.filter((s)=>s !== t.value) : [
1221
+ ...this.value,
1222
+ t.value
1223
+ ];
952
1224
  }
953
1225
  }
1226
+ constructor(t){
1227
+ super(t, !1);
1228
+ const { options: e } = t;
1229
+ this.#e = !1 !== t.selectableGroups, this.options = Object.entries(e).flatMap(([s, i])=>[
1230
+ {
1231
+ value: s,
1232
+ group: !0,
1233
+ label: s
1234
+ },
1235
+ ...i.map((n)=>({
1236
+ ...n,
1237
+ group: s
1238
+ }))
1239
+ ]), this.value = [
1240
+ ...t.initialValues ?? []
1241
+ ], this.cursor = Math.max(this.options.findIndex(({ value: s })=>s === t.cursorAt), this.#e ? 0 : 1), this.on("cursor", (s)=>{
1242
+ switch(s){
1243
+ case "left":
1244
+ case "up":
1245
+ {
1246
+ this.cursor = 0 === this.cursor ? this.options.length - 1 : this.cursor - 1;
1247
+ const i = this.options[this.cursor]?.group === !0;
1248
+ !this.#e && i && (this.cursor = 0 === this.cursor ? this.options.length - 1 : this.cursor - 1);
1249
+ break;
1250
+ }
1251
+ case "down":
1252
+ case "right":
1253
+ {
1254
+ this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
1255
+ const i = this.options[this.cursor]?.group === !0;
1256
+ !this.#e && i && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
1257
+ break;
1258
+ }
1259
+ case "space":
1260
+ this.toggleValue();
1261
+ break;
1262
+ }
1263
+ });
1264
+ }
954
1265
  }
955
- let Lt = class extends dist_B {
1266
+ let it = class extends dist_p {
956
1267
  options;
957
1268
  cursor = 0;
958
1269
  get _value() {
959
1270
  return this.options[this.cursor].value;
960
1271
  }
961
1272
  get _enabledOptions() {
962
- return this.options.filter((e)=>!0 !== e.disabled);
1273
+ return this.options.filter((t)=>!0 !== t.disabled);
963
1274
  }
964
1275
  toggleAll() {
965
- const e = this._enabledOptions, s = void 0 !== this.value && this.value.length === e.length;
966
- this.value = s ? [] : e.map((i)=>i.value);
1276
+ const t = this._enabledOptions, e = void 0 !== this.value && this.value.length === t.length;
1277
+ this.value = e ? [] : t.map((s)=>s.value);
967
1278
  }
968
1279
  toggleInvert() {
969
- const e = this.value;
970
- if (!e) return;
971
- const s = this._enabledOptions.filter((i)=>!e.includes(i.value));
972
- this.value = s.map((i)=>i.value);
1280
+ const t = this.value;
1281
+ if (!t) return;
1282
+ const e = this._enabledOptions.filter((s)=>!t.includes(s.value));
1283
+ this.value = e.map((s)=>s.value);
973
1284
  }
974
1285
  toggleValue() {
975
1286
  void 0 === this.value && (this.value = []);
976
- const e = this.value.includes(this._value);
977
- this.value = e ? this.value.filter((s)=>s !== this._value) : [
1287
+ const t = this.value.includes(this._value);
1288
+ this.value = t ? this.value.filter((e)=>e !== this._value) : [
978
1289
  ...this.value,
979
1290
  this._value
980
1291
  ];
981
1292
  }
982
- constructor(e){
983
- super(e, !1), this.options = e.options, this.value = [
984
- ...e.initialValues ?? []
1293
+ constructor(t){
1294
+ super(t, !1), this.options = t.options, this.value = [
1295
+ ...t.initialValues ?? []
985
1296
  ];
986
- const s = Math.max(this.options.findIndex(({ value: i })=>i === e.cursorAt), 0);
987
- this.cursor = this.options[s].disabled ? x(s, 1, this.options) : s, this.on("key", (i)=>{
988
- "a" === i && this.toggleAll(), "i" === i && this.toggleInvert();
989
- }), this.on("cursor", (i)=>{
990
- switch(i){
1297
+ const e = Math.max(this.options.findIndex(({ value: s })=>s === t.cursorAt), 0);
1298
+ this.cursor = this.options[e].disabled ? dist_d(e, 1, this.options) : e, this.on("key", (s)=>{
1299
+ "a" === s && this.toggleAll(), "i" === s && this.toggleInvert();
1300
+ }), this.on("cursor", (s)=>{
1301
+ switch(s){
991
1302
  case "left":
992
1303
  case "up":
993
- this.cursor = x(this.cursor, -1, this.options);
1304
+ this.cursor = dist_d(this.cursor, -1, this.options);
994
1305
  break;
995
1306
  case "down":
996
1307
  case "right":
997
- this.cursor = x(this.cursor, 1, this.options);
1308
+ this.cursor = dist_d(this.cursor, 1, this.options);
998
1309
  break;
999
1310
  case "space":
1000
1311
  this.toggleValue();
@@ -1003,7 +1314,7 @@ let Lt = class extends dist_B {
1003
1314
  });
1004
1315
  }
1005
1316
  };
1006
- class Tt extends dist_B {
1317
+ class nt extends dist_p {
1007
1318
  options;
1008
1319
  cursor = 0;
1009
1320
  get _selectedValue() {
@@ -1012,335 +1323,379 @@ class Tt extends dist_B {
1012
1323
  changeValue() {
1013
1324
  this.value = this._selectedValue.value;
1014
1325
  }
1015
- constructor(e){
1016
- super(e, !1), this.options = e.options;
1017
- const s = this.options.findIndex(({ value: r })=>r === e.initialValue), i = -1 === s ? 0 : s;
1018
- this.cursor = this.options[i].disabled ? x(i, 1, this.options) : i, this.changeValue(), this.on("cursor", (r)=>{
1019
- switch(r){
1326
+ constructor(t){
1327
+ super(t, !1), this.options = t.options;
1328
+ const e = this.options.findIndex(({ value: i })=>i === t.initialValue), s = -1 === e ? 0 : e;
1329
+ this.cursor = this.options[s].disabled ? dist_d(s, 1, this.options) : s, this.changeValue(), this.on("cursor", (i)=>{
1330
+ switch(i){
1020
1331
  case "left":
1021
1332
  case "up":
1022
- this.cursor = x(this.cursor, -1, this.options);
1333
+ this.cursor = dist_d(this.cursor, -1, this.options);
1023
1334
  break;
1024
1335
  case "down":
1025
1336
  case "right":
1026
- this.cursor = x(this.cursor, 1, this.options);
1337
+ this.cursor = dist_d(this.cursor, 1, this.options);
1027
1338
  break;
1028
1339
  }
1029
1340
  this.changeValue();
1030
1341
  });
1031
1342
  }
1032
1343
  }
1033
- class dist_$t extends dist_B {
1344
+ class at extends dist_p {
1034
1345
  get userInputWithCursor() {
1035
1346
  if ("submit" === this.state) return this.userInput;
1036
- const e = this.userInput;
1037
- if (this.cursor >= e.length) return `${this.userInput}\u2588`;
1038
- const s = e.slice(0, this.cursor), [i, ...r] = e.slice(this.cursor);
1039
- return `${s}${styleText("inverse", i)}${r.join("")}`;
1347
+ const t = this.userInput;
1348
+ if (this.cursor >= t.length) return `${this.userInput}\u2588`;
1349
+ const e = t.slice(0, this.cursor), [s, ...i] = t.slice(this.cursor);
1350
+ return `${e}${styleText("inverse", s)}${i.join("")}`;
1040
1351
  }
1041
1352
  get cursor() {
1042
1353
  return this._cursor;
1043
1354
  }
1044
- constructor(e){
1355
+ constructor(t){
1045
1356
  super({
1046
- ...e,
1047
- initialUserInput: e.initialUserInput ?? e.initialValue
1048
- }), this.on("userInput", (s)=>{
1049
- this._setValue(s);
1357
+ ...t,
1358
+ initialUserInput: t.initialUserInput ?? t.initialValue
1359
+ }), this.on("userInput", (e)=>{
1360
+ this._setValue(e);
1050
1361
  }), this.on("finalize", ()=>{
1051
- this.value || (this.value = e.defaultValue), void 0 === this.value && (this.value = "");
1362
+ this.value || (this.value = t.defaultValue), void 0 === this.value && (this.value = "");
1052
1363
  });
1053
1364
  }
1054
1365
  }
1055
- function dist_pt() {
1366
+ function Ze() {
1056
1367
  return "win32" !== node_process.platform ? "linux" !== node_process.env.TERM : !!node_process.env.CI || !!node_process.env.WT_SESSION || !!node_process.env.TERMINUS_SUBLIME || "{cmd::Cmder}" === node_process.env.ConEmuTask || "Terminus-Sublime" === node_process.env.TERM_PROGRAM || "vscode" === node_process.env.TERM_PROGRAM || "xterm-256color" === node_process.env.TERM || "alacritty" === node_process.env.TERM || "JetBrains-JediTerm" === node_process.env.TERMINAL_EMULATOR;
1057
1368
  }
1058
- const ee = dist_pt(), ce = ()=>"true" === process.env.CI, I = (e, r)=>ee ? e : r, Re = I("\u25C6", "*"), $e = I("\u25A0", "x"), de = I("\u25B2", "x"), dist_V = I("\u25C7", "o"), dist_h = (I("\u250C", "T"), I("\u2502", "|")), dist_x = I("\u2514", "\u2014"), dist_z = (I("\u2510", "T"), I("\u2518", "\u2014"), I("\u25CF", ">")), dist_H = I("\u25CB", " "), te = I("\u25FB", "[\u2022]"), dist_U = I("\u25FC", "[+]"), q = I("\u25FB", "[ ]"), se = (I("\u25AA", "\u2022"), I("\u2500", "-")), pe = I("\u256E", "+"), We = I("\u251C", "+"), me = I("\u256F", "+"), ge = I("\u2570", "+"), fe = (I("\u256D", "+"), I("\u25CF", "\u2022")), Fe = I("\u25C6", "*"), ye = I("\u25B2", "!"), Ee = I("\u25A0", "x"), dist_W = (e)=>{
1369
+ const ee = Ze(), ae = ()=>"true" === process.env.CI, Te = (e)=>!0 === e.isTTY, dist_w = (e, i)=>ee ? e : i, _e = dist_w("\u25C6", "*"), oe = dist_w("\u25A0", "x"), ue = dist_w("\u25B2", "x"), dist_F = dist_w("\u25C7", "o"), prompts_dist_d = (dist_w("\u250C", "T"), dist_w("\u2502", "|")), dist_E = dist_w("\u2514", "\u2014"), dist_z = (dist_w("\u2510", "T"), dist_w("\u2518", "\u2014"), dist_w("\u25CF", ">")), dist_H = dist_w("\u25CB", " "), te = dist_w("\u25FB", "[\u2022]"), dist_U = dist_w("\u25FC", "[+]"), dist_J = dist_w("\u25FB", "[ ]"), se = (dist_w("\u25AA", "\u2022"), dist_w("\u2500", "-")), ce = dist_w("\u256E", "+"), Ge = dist_w("\u251C", "+"), $e = dist_w("\u256F", "+"), de = dist_w("\u2570", "+"), he = (dist_w("\u256D", "+"), dist_w("\u25CF", "\u2022")), pe = dist_w("\u25C6", "*"), me = dist_w("\u25B2", "!"), ge = dist_w("\u25A0", "x"), dist_V = (e)=>{
1059
1370
  switch(e){
1060
1371
  case "initial":
1061
1372
  case "active":
1062
- return styleText("cyan", Re);
1373
+ return styleText("cyan", _e);
1063
1374
  case "cancel":
1064
- return styleText("red", $e);
1375
+ return styleText("red", oe);
1065
1376
  case "error":
1066
- return styleText("yellow", de);
1377
+ return styleText("yellow", ue);
1067
1378
  case "submit":
1068
- return styleText("green", dist_V);
1379
+ return styleText("green", dist_F);
1069
1380
  }
1070
- }, ve = (e)=>{
1381
+ }, ye = (e)=>{
1071
1382
  switch(e){
1072
1383
  case "initial":
1073
1384
  case "active":
1074
- return styleText("cyan", dist_h);
1385
+ return styleText("cyan", prompts_dist_d);
1075
1386
  case "cancel":
1076
- return styleText("red", dist_h);
1387
+ return styleText("red", prompts_dist_d);
1077
1388
  case "error":
1078
- return styleText("yellow", dist_h);
1389
+ return styleText("yellow", prompts_dist_d);
1079
1390
  case "submit":
1080
- return styleText("green", dist_h);
1081
- }
1082
- }, dist_mt = (e)=>161 === e || 164 === e || 167 === e || 168 === e || 170 === e || 173 === e || 174 === e || e >= 176 && e <= 180 || e >= 182 && e <= 186 || e >= 188 && e <= 191 || 198 === e || 208 === e || 215 === e || 216 === e || e >= 222 && e <= 225 || 230 === e || e >= 232 && e <= 234 || 236 === e || 237 === e || 240 === e || 242 === e || 243 === e || e >= 247 && e <= 250 || 252 === e || 254 === e || 257 === e || 273 === e || 275 === e || 283 === e || 294 === e || 295 === e || 299 === e || e >= 305 && e <= 307 || 312 === e || e >= 319 && e <= 322 || 324 === e || e >= 328 && e <= 331 || 333 === e || 338 === e || 339 === e || 358 === e || 359 === e || 363 === e || 462 === e || 464 === e || 466 === e || 468 === e || 470 === e || 472 === e || 474 === e || 476 === e || 593 === e || 609 === e || 708 === e || 711 === e || e >= 713 && e <= 715 || 717 === e || 720 === e || e >= 728 && e <= 731 || 733 === e || 735 === e || e >= 768 && e <= 879 || e >= 913 && e <= 929 || e >= 931 && e <= 937 || e >= 945 && e <= 961 || e >= 963 && e <= 969 || 1025 === e || e >= 1040 && e <= 1103 || 1105 === e || 8208 === e || e >= 8211 && e <= 8214 || 8216 === e || 8217 === e || 8220 === e || 8221 === e || e >= 8224 && e <= 8226 || e >= 8228 && e <= 8231 || 8240 === e || 8242 === e || 8243 === e || 8245 === e || 8251 === e || 8254 === e || 8308 === e || 8319 === e || e >= 8321 && e <= 8324 || 8364 === e || 8451 === e || 8453 === e || 8457 === e || 8467 === e || 8470 === e || 8481 === e || 8482 === e || 8486 === e || 8491 === e || 8531 === e || 8532 === e || e >= 8539 && e <= 8542 || e >= 8544 && e <= 8555 || e >= 8560 && e <= 8569 || 8585 === e || e >= 8592 && e <= 8601 || 8632 === e || 8633 === e || 8658 === e || 8660 === e || 8679 === e || 8704 === e || 8706 === e || 8707 === e || 8711 === e || 8712 === e || 8715 === e || 8719 === e || 8721 === e || 8725 === e || 8730 === e || e >= 8733 && e <= 8736 || 8739 === e || 8741 === e || e >= 8743 && e <= 8748 || 8750 === e || e >= 8756 && e <= 8759 || 8764 === e || 8765 === e || 8776 === e || 8780 === e || 8786 === e || 8800 === e || 8801 === e || e >= 8804 && e <= 8807 || 8810 === e || 8811 === e || 8814 === e || 8815 === e || 8834 === e || 8835 === e || 8838 === e || 8839 === e || 8853 === e || 8857 === e || 8869 === e || 8895 === e || 8978 === e || e >= 9312 && e <= 9449 || e >= 9451 && e <= 9547 || e >= 9552 && e <= 9587 || e >= 9600 && e <= 9615 || e >= 9618 && e <= 9621 || 9632 === e || 9633 === e || e >= 9635 && e <= 9641 || 9650 === e || 9651 === e || 9654 === e || 9655 === e || 9660 === e || 9661 === e || 9664 === e || 9665 === e || e >= 9670 && e <= 9672 || 9675 === e || e >= 9678 && e <= 9681 || e >= 9698 && e <= 9701 || 9711 === e || 9733 === e || 9734 === e || 9737 === e || 9742 === e || 9743 === e || 9756 === e || 9758 === e || 9792 === e || 9794 === e || 9824 === e || 9825 === e || e >= 9827 && e <= 9829 || e >= 9831 && e <= 9834 || 9836 === e || 9837 === e || 9839 === e || 9886 === e || 9887 === e || 9919 === e || e >= 9926 && e <= 9933 || e >= 9935 && e <= 9939 || e >= 9941 && e <= 9953 || 9955 === e || 9960 === e || 9961 === e || e >= 9963 && e <= 9969 || 9972 === e || e >= 9974 && e <= 9977 || 9979 === e || 9980 === e || 9982 === e || 9983 === e || 10045 === e || e >= 10102 && e <= 10111 || e >= 11094 && e <= 11097 || e >= 12872 && e <= 12879 || e >= 57344 && e <= 63743 || e >= 65024 && e <= 65039 || 65533 === e || e >= 127232 && e <= 127242 || e >= 127248 && e <= 127277 || e >= 127280 && e <= 127337 || e >= 127344 && e <= 127373 || 127375 === e || 127376 === e || e >= 127387 && e <= 127404 || e >= 917760 && e <= 917999 || e >= 983040 && e <= 1048573 || e >= 1048576 && e <= 1114109, dist_gt = (e)=>12288 === e || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510, dist_ft = (e)=>e >= 4352 && e <= 4447 || 8986 === e || 8987 === e || 9001 === e || 9002 === e || e >= 9193 && e <= 9196 || 9200 === e || 9203 === e || 9725 === e || 9726 === e || 9748 === e || 9749 === e || e >= 9800 && e <= 9811 || 9855 === e || 9875 === e || 9889 === e || 9898 === e || 9899 === e || 9917 === e || 9918 === e || 9924 === e || 9925 === e || 9934 === e || 9940 === e || 9962 === e || 9970 === e || 9971 === e || 9973 === e || 9978 === e || 9981 === e || 9989 === e || 9994 === e || 9995 === e || 10024 === e || 10060 === e || 10062 === e || e >= 10067 && e <= 10069 || 10071 === e || e >= 10133 && e <= 10135 || 10160 === e || 10175 === e || 11035 === e || 11036 === e || 11088 === e || 11093 === e || e >= 11904 && e <= 11929 || e >= 11931 && e <= 12019 || e >= 12032 && e <= 12245 || e >= 12272 && e <= 12287 || e >= 12289 && e <= 12350 || e >= 12353 && e <= 12438 || e >= 12441 && e <= 12543 || e >= 12549 && e <= 12591 || e >= 12593 && e <= 12686 || e >= 12688 && e <= 12771 || e >= 12783 && e <= 12830 || e >= 12832 && e <= 12871 || e >= 12880 && e <= 19903 || e >= 19968 && e <= 42124 || e >= 42128 && e <= 42182 || e >= 43360 && e <= 43388 || e >= 44032 && e <= 55203 || e >= 63744 && e <= 64255 || e >= 65040 && e <= 65049 || e >= 65072 && e <= 65106 || e >= 65108 && e <= 65126 || e >= 65128 && e <= 65131 || e >= 94176 && e <= 94180 || 94192 === e || 94193 === e || e >= 94208 && e <= 100343 || e >= 100352 && e <= 101589 || e >= 101632 && e <= 101640 || e >= 110576 && e <= 110579 || e >= 110581 && e <= 110587 || 110589 === e || 110590 === e || e >= 110592 && e <= 110882 || 110898 === e || e >= 110928 && e <= 110930 || 110933 === e || e >= 110948 && e <= 110951 || e >= 110960 && e <= 111355 || 126980 === e || 127183 === e || 127374 === e || e >= 127377 && e <= 127386 || e >= 127488 && e <= 127490 || e >= 127504 && e <= 127547 || e >= 127552 && e <= 127560 || 127568 === e || 127569 === e || e >= 127584 && e <= 127589 || e >= 127744 && e <= 127776 || e >= 127789 && e <= 127797 || e >= 127799 && e <= 127868 || e >= 127870 && e <= 127891 || e >= 127904 && e <= 127946 || e >= 127951 && e <= 127955 || e >= 127968 && e <= 127984 || 127988 === e || e >= 127992 && e <= 128062 || 128064 === e || e >= 128066 && e <= 128252 || e >= 128255 && e <= 128317 || e >= 128331 && e <= 128334 || e >= 128336 && e <= 128359 || 128378 === e || 128405 === e || 128406 === e || 128420 === e || e >= 128507 && e <= 128591 || e >= 128640 && e <= 128709 || 128716 === e || e >= 128720 && e <= 128722 || e >= 128725 && e <= 128727 || e >= 128732 && e <= 128735 || 128747 === e || 128748 === e || e >= 128756 && e <= 128764 || e >= 128992 && e <= 129003 || 129008 === e || e >= 129292 && e <= 129338 || e >= 129340 && e <= 129349 || e >= 129351 && e <= 129535 || e >= 129648 && e <= 129660 || e >= 129664 && e <= 129672 || e >= 129680 && e <= 129725 || e >= 129727 && e <= 129733 || e >= 129742 && e <= 129755 || e >= 129760 && e <= 129768 || e >= 129776 && e <= 129784 || e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141, we = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y, re = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, ie = /\t{1,1000}/y, Ae = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu, ne = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, dist_Ft = /\p{M}+/gu, dist_yt = {
1083
- limit: 1 / 0,
1084
- ellipsis: ""
1085
- }, Le = (e, r = {}, s = {})=>{
1086
- const i = r.limit ?? 1 / 0, a = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (a ? Le(a, dist_yt, s).width : 0), u = s.ansiWidth ?? 0, l = s.controlWidth ?? 0, n = s.tabWidth ?? 8, c = s.ambiguousWidth ?? 1, p = s.emojiWidth ?? 2, f = s.fullWidthWidth ?? 2, g = s.regularWidth ?? 1, E = s.wideWidth ?? 2;
1087
- let $ = 0, m = 0, d = e.length, F = 0, y = !1, v = d, C = Math.max(0, i - o), A = 0, b = 0, w = 0, S = 0;
1088
- e: for(;;){
1089
- if (b > A || m >= d && m > $) {
1090
- const T = e.slice(A, b) || e.slice($, m);
1091
- F = 0;
1092
- for (const M of T.replaceAll(dist_Ft, "")){
1093
- const O = M.codePointAt(0) || 0;
1094
- if (dist_gt(O) ? S = f : dist_ft(O) ? S = E : c !== g && dist_mt(O) ? S = c : S = g, w + S > C && (v = Math.min(v, Math.max(A, $) + F)), w + S > i) {
1095
- y = !0;
1096
- break e;
1097
- }
1098
- F += M.length, w += S;
1099
- }
1100
- A = b = 0;
1101
- }
1102
- if (m >= d) break;
1103
- if (ne.lastIndex = m, ne.test(e)) {
1104
- if (F = ne.lastIndex - m, S = F * g, w + S > C && (v = Math.min(v, m + Math.floor((C - w) / g))), w + S > i) {
1105
- y = !0;
1106
- break;
1107
- }
1108
- w += S, A = $, b = m, m = $ = ne.lastIndex;
1109
- continue;
1110
- }
1111
- if (we.lastIndex = m, we.test(e)) {
1112
- if (w + u > C && (v = Math.min(v, m)), w + u > i) {
1113
- y = !0;
1114
- break;
1115
- }
1116
- w += u, A = $, b = m, m = $ = we.lastIndex;
1117
- continue;
1118
- }
1119
- if (re.lastIndex = m, re.test(e)) {
1120
- if (F = re.lastIndex - m, S = F * l, w + S > C && (v = Math.min(v, m + Math.floor((C - w) / l))), w + S > i) {
1121
- y = !0;
1122
- break;
1123
- }
1124
- w += S, A = $, b = m, m = $ = re.lastIndex;
1125
- continue;
1126
- }
1127
- if (ie.lastIndex = m, ie.test(e)) {
1128
- if (F = ie.lastIndex - m, S = F * n, w + S > C && (v = Math.min(v, m + Math.floor((C - w) / n))), w + S > i) {
1129
- y = !0;
1130
- break;
1131
- }
1132
- w += S, A = $, b = m, m = $ = ie.lastIndex;
1133
- continue;
1134
- }
1135
- if (Ae.lastIndex = m, Ae.test(e)) {
1136
- if (w + p > C && (v = Math.min(v, m)), w + p > i) {
1137
- y = !0;
1138
- break;
1139
- }
1140
- w += p, A = $, b = m, m = $ = Ae.lastIndex;
1141
- continue;
1142
- }
1143
- m += 1;
1391
+ return styleText("green", prompts_dist_d);
1144
1392
  }
1145
- return {
1146
- width: y ? C : w,
1147
- index: y ? v : d,
1148
- truncated: y,
1149
- ellipsed: y && i >= o
1150
- };
1151
- }, dist_Et = {
1152
- limit: 1 / 0,
1153
- ellipsis: "",
1154
- ellipsisWidth: 0
1155
- }, D = (e, r = {})=>Le(e, dist_Et, r).width, ae = "\x1B", je = "\x9B", dist_vt = 39, Ce = "\x07", ke = "[", dist_wt = "]", Ve = "m", Se = `${dist_wt}8;;`, He = new RegExp(`(?:\\${ke}(?<code>\\d+)m|\\${Se}(?<uri>.*)${Ce})`, "y"), dist_At = (e)=>{
1156
- if (e >= 30 && e <= 37 || e >= 90 && e <= 97) return 39;
1157
- if (e >= 40 && e <= 47 || e >= 100 && e <= 107) return 49;
1158
- if (1 === e || 2 === e) return 22;
1159
- if (3 === e) return 23;
1160
- if (4 === e) return 24;
1161
- if (7 === e) return 27;
1162
- if (8 === e) return 28;
1163
- if (9 === e) return 29;
1164
- if (0 === e) return 0;
1165
- }, Ue = (e)=>`${ae}${ke}${e}${Ve}`, Ke = (e)=>`${ae}${Se}${e}${Ce}`, dist_Ct = (e)=>e.map((r)=>D(r)), Ie = (e, r, s)=>{
1166
- const i = r[Symbol.iterator]();
1167
- let a = !1, o = !1, u = e.at(-1), l = void 0 === u ? 0 : D(u), n = i.next(), c = i.next(), p = 0;
1168
- for(; !n.done;){
1169
- const f = n.value, g = D(f);
1170
- l + g <= s ? e[e.length - 1] += f : (e.push(f), l = 0), (f === ae || f === je) && (a = !0, o = r.startsWith(Se, p + 1)), a ? o ? f === Ce && (a = !1, o = !1) : f === Ve && (a = !1) : (l += g, l !== s || c.done || (e.push(""), l = 0)), n = c, c = i.next(), p += f.length;
1171
- }
1172
- u = e.at(-1), !l && void 0 !== u && u.length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
1173
- }, dist_St = (e)=>{
1174
- const r = e.split(" ");
1175
- let s = r.length;
1176
- for(; s > 0 && !(D(r[s - 1]) > 0);)s--;
1177
- return s === r.length ? e : r.slice(0, s).join(" ") + r.slice(s).join("");
1178
- }, dist_It = (e, r, s = {})=>{
1179
- if (!1 !== s.trim && "" === e.trim()) return "";
1180
- let i = "", a, o;
1181
- const u = e.split(" "), l = dist_Ct(u);
1182
- let n = [
1183
- ""
1184
- ];
1185
- for (const [$, m] of u.entries()){
1186
- !1 !== s.trim && (n[n.length - 1] = (n.at(-1) ?? "").trimStart());
1187
- let d = D(n.at(-1) ?? "");
1188
- if (0 !== $ && (d >= r && (!1 === s.wordWrap || !1 === s.trim) && (n.push(""), d = 0), (d > 0 || !1 === s.trim) && (n[n.length - 1] += " ", d++)), s.hard && l[$] > r) {
1189
- const F = r - d, y = 1 + Math.floor((l[$] - F - 1) / r);
1190
- Math.floor((l[$] - 1) / r) < y && n.push(""), Ie(n, m, r);
1191
- continue;
1192
- }
1193
- if (d + l[$] > r && d > 0 && l[$] > 0) {
1194
- if (!1 === s.wordWrap && d < r) {
1195
- Ie(n, m, r);
1196
- continue;
1197
- }
1198
- n.push("");
1199
- }
1200
- if (d + l[$] > r && !1 === s.wordWrap) {
1201
- Ie(n, m, r);
1202
- continue;
1203
- }
1204
- n[n.length - 1] += m;
1205
- }
1206
- !1 !== s.trim && (n = n.map(($)=>dist_St($)));
1207
- const c = n.join(`
1208
- `), p = c[Symbol.iterator]();
1209
- let f = p.next(), g = p.next(), E = 0;
1210
- for(; !f.done;){
1211
- const $ = f.value, m = g.value;
1212
- if (i += $, $ === ae || $ === je) {
1213
- He.lastIndex = E + 1;
1214
- const y = He.exec(c)?.groups;
1215
- if (y?.code !== void 0) {
1216
- const v = Number.parseFloat(y.code);
1217
- a = v === dist_vt ? void 0 : v;
1218
- } else y?.uri !== void 0 && (o = 0 === y.uri.length ? void 0 : y.uri);
1219
- }
1220
- const d = a ? dist_At(a) : void 0;
1221
- m === `
1222
- ` ? (o && (i += Ke("")), a && d && (i += Ue(d))) : $ === `
1223
- ` && (a && d && (i += Ue(a)), o && (i += Ke(o))), E += $.length, f = g, g = p.next();
1224
- }
1225
- return i;
1226
- };
1227
- function J(e, r, s) {
1228
- return String(e).normalize().replaceAll(`\r
1229
- `, `
1230
- `).split(`
1231
- `).map((i)=>dist_It(i, r, s)).join(`
1232
- `);
1233
- }
1234
- const dist_bt = (e, r, s, i, a)=>{
1235
- let o = r, u = 0;
1236
- for(let l = s; l < i; l++){
1237
- const n = e[l];
1238
- if (o -= n.length, u++, o <= a) break;
1393
+ }, dist_et = (e, i, s, r, u)=>{
1394
+ let n = i, o = 0;
1395
+ for(let c = s; c < r; c++){
1396
+ const a = e[c];
1397
+ if (n -= a.length, o++, n <= u) break;
1239
1398
  }
1240
1399
  return {
1241
- lineCount: o,
1242
- removals: u
1400
+ lineCount: n,
1401
+ removals: o
1243
1402
  };
1244
- }, dist_X = ({ cursor: e, options: r, style: s, output: i = process.stdout, maxItems: a = 1 / 0, columnPadding: o = 0, rowPadding: u = 4 })=>{
1245
- const l = dist_rt(i) - o, n = nt(i), c = styleText("dim", "..."), p = Math.max(n - u, 0), f = Math.max(Math.min(a, p), 5);
1246
- let g = 0;
1247
- e >= f - 3 && (g = Math.max(Math.min(e - f + 3, r.length - f), 0));
1248
- let E = f < r.length && g > 0, $ = f < r.length && g + f < r.length;
1249
- const m = Math.min(g + f, r.length), d = [];
1250
- let F = 0;
1251
- E && F++, $ && F++;
1252
- const y = g + (E ? 1 : 0), v = m - ($ ? 1 : 0);
1253
- for(let A = y; A < v; A++){
1254
- const b = J(s(r[A], A === e), l, {
1403
+ }, dist_Y = ({ cursor: e, options: i, style: s, output: r = process.stdout, maxItems: u = 1 / 0, columnPadding: n = 0, rowPadding: o = 4 })=>{
1404
+ const c = O(r) - n, a = dist_A(r), l = styleText("dim", "..."), $ = Math.max(a - o, 0), y = Math.max(Math.min(u, $), 5);
1405
+ let p = 0;
1406
+ e >= y - 3 && (p = Math.max(Math.min(e - y + 3, i.length - y), 0));
1407
+ let m = y < i.length && p > 0, g = y < i.length && p + y < i.length;
1408
+ const S = Math.min(p + y, i.length), h = [];
1409
+ let f = 0;
1410
+ m && f++, g && f++;
1411
+ const v = p + (m ? 1 : 0), T = S - (g ? 1 : 0);
1412
+ for(let b = v; b < T; b++){
1413
+ const x = wrapAnsi(s(i[b], b === e), c, {
1255
1414
  hard: !0,
1256
1415
  trim: !1
1257
1416
  }).split(`
1258
1417
  `);
1259
- d.push(b), F += b.length;
1418
+ h.push(x), f += x.length;
1260
1419
  }
1261
- if (F > p) {
1262
- let A = 0, b = 0, w = F;
1263
- const S = e - y, T = (M, O)=>dist_bt(d, w, M, O, p);
1264
- E ? ({ lineCount: w, removals: A } = T(0, S), w > p && ({ lineCount: w, removals: b } = T(S + 1, d.length))) : ({ lineCount: w, removals: b } = T(S + 1, d.length), w > p && ({ lineCount: w, removals: A } = T(0, S))), A > 0 && (E = !0, d.splice(0, A)), b > 0 && ($ = !0, d.splice(d.length - b, b));
1420
+ if (f > $) {
1421
+ let b = 0, x = 0, G = f;
1422
+ const M = e - v, R = (j, D)=>dist_et(h, G, j, D, $);
1423
+ m ? ({ lineCount: G, removals: b } = R(0, M), G > $ && ({ lineCount: G, removals: x } = R(M + 1, h.length))) : ({ lineCount: G, removals: x } = R(M + 1, h.length), G > $ && ({ lineCount: G, removals: b } = R(0, M))), b > 0 && (m = !0, h.splice(0, b)), x > 0 && (g = !0, h.splice(h.length - x, x));
1265
1424
  }
1266
1425
  const C = [];
1267
- E && C.push(c);
1268
- for (const A of d)for (const b of A)C.push(b);
1269
- return $ && C.push(c), C;
1426
+ m && C.push(l);
1427
+ for (const b of h)for (const x of b)C.push(x);
1428
+ return g && C.push(l), C;
1270
1429
  };
1271
- const R = {
1272
- message: (e = [], { symbol: r = styleText("gray", dist_h), secondarySymbol: s = styleText("gray", dist_h), output: i = process.stdout, spacing: a = 1, withGuide: o } = {})=>{
1273
- const u = [], l = o ?? dist_.withGuide, n = l ? s : "", c = l ? `${r} ` : "", p = l ? `${s} ` : "";
1274
- for(let g = 0; g < a; g++)u.push(n);
1275
- const f = Array.isArray(e) ? e : e.split(`
1430
+ function Me(e) {
1431
+ return e.label ?? String(e.value ?? "");
1432
+ }
1433
+ function Re(e, i) {
1434
+ if (!e) return !0;
1435
+ const s = (i.label ?? String(i.value ?? "")).toLowerCase(), r = (i.hint ?? "").toLowerCase(), u = String(i.value).toLowerCase(), n = e.toLowerCase();
1436
+ return s.includes(n) || r.includes(n) || u.includes(n);
1437
+ }
1438
+ function dist_tt(e, i) {
1439
+ const s = [];
1440
+ for (const r of i)e.includes(r.value) && s.push(r);
1441
+ return s;
1442
+ }
1443
+ const Ae = (e)=>new H({
1444
+ options: e.options,
1445
+ initialValue: e.initialValue ? [
1446
+ e.initialValue
1447
+ ] : void 0,
1448
+ initialUserInput: e.initialUserInput,
1449
+ placeholder: e.placeholder,
1450
+ filter: e.filter ?? ((i, s)=>Re(i, s)),
1451
+ signal: e.signal,
1452
+ input: e.input,
1453
+ output: e.output,
1454
+ validate: e.validate,
1455
+ render () {
1456
+ const i = e.withGuide ?? dist_u.withGuide, s = i ? [
1457
+ `${styleText("gray", prompts_dist_d)}`,
1458
+ `${dist_V(this.state)} ${e.message}`
1459
+ ] : [
1460
+ `${dist_V(this.state)} ${e.message}`
1461
+ ], r = this.userInput, u = this.options, n = e.placeholder, o = "" === r && void 0 !== n, c = (a, l)=>{
1462
+ const $ = Me(a), y = a.hint && a.value === this.focusedValue ? styleText("dim", ` (${a.hint})`) : "";
1463
+ switch(l){
1464
+ case "active":
1465
+ return `${styleText("green", dist_z)} ${$}${y}`;
1466
+ case "inactive":
1467
+ return `${styleText("dim", dist_H)} ${styleText("dim", $)}`;
1468
+ case "disabled":
1469
+ return `${styleText("gray", dist_H)} ${styleText([
1470
+ "strikethrough",
1471
+ "gray"
1472
+ ], $)}`;
1473
+ }
1474
+ };
1475
+ switch(this.state){
1476
+ case "submit":
1477
+ {
1478
+ const a = dist_tt(this.selectedValues, u), l = a.length > 0 ? ` ${styleText("dim", a.map(Me).join(", "))}` : "", $ = i ? styleText("gray", prompts_dist_d) : "";
1479
+ return `${s.join(`
1480
+ `)}
1481
+ ${$}${l}`;
1482
+ }
1483
+ case "cancel":
1484
+ {
1485
+ const a = r ? ` ${styleText([
1486
+ "strikethrough",
1487
+ "dim"
1488
+ ], r)}` : "", l = i ? styleText("gray", prompts_dist_d) : "";
1489
+ return `${s.join(`
1490
+ `)}
1491
+ ${l}${a}`;
1492
+ }
1493
+ default:
1494
+ {
1495
+ const a = "error" === this.state ? "yellow" : "cyan", l = i ? `${styleText(a, prompts_dist_d)} ` : "", $ = i ? styleText(a, dist_E) : "";
1496
+ let y = "";
1497
+ if (this.isNavigating || o) {
1498
+ const v = o ? n : r;
1499
+ y = "" !== v ? ` ${styleText("dim", v)}` : "";
1500
+ } else y = ` ${this.userInputWithCursor}`;
1501
+ const p = this.filteredOptions.length !== u.length ? styleText("dim", ` (${this.filteredOptions.length} match${1 === this.filteredOptions.length ? "" : "es"})`) : "", m = 0 === this.filteredOptions.length && r ? [
1502
+ `${l}${styleText("yellow", "No matches found")}`
1503
+ ] : [], g = "error" === this.state ? [
1504
+ `${l}${styleText("yellow", this.error)}`
1505
+ ] : [];
1506
+ i && s.push(`${l.trimEnd()}`), s.push(`${l}${styleText("dim", "Search:")}${y}${p}`, ...m, ...g);
1507
+ const S = [
1508
+ `${styleText("dim", "\u2191/\u2193")} to select`,
1509
+ `${styleText("dim", "Enter:")} confirm`,
1510
+ `${styleText("dim", "Type:")} to search`
1511
+ ], h = [
1512
+ `${l}${S.join(" \u2022 ")}`,
1513
+ $
1514
+ ], f = 0 === this.filteredOptions.length ? [] : dist_Y({
1515
+ cursor: this.cursor,
1516
+ options: this.filteredOptions,
1517
+ columnPadding: i ? 3 : 0,
1518
+ rowPadding: s.length + h.length,
1519
+ style: (v, T)=>c(v, v.disabled ? "disabled" : T ? "active" : "inactive"),
1520
+ maxItems: e.maxItems,
1521
+ output: e.output
1522
+ });
1523
+ return [
1524
+ ...s,
1525
+ ...f.map((v)=>`${l}${v}`),
1526
+ ...h
1527
+ ].join(`
1528
+ `);
1529
+ }
1530
+ }
1531
+ }
1532
+ }).prompt();
1533
+ const ht = (e)=>{
1534
+ const { selectableGroups: i = !0, groupSpacing: s = 0 } = e, r = (n, o, c = [])=>{
1535
+ const a = n.label ?? String(n.value), l = "string" == typeof n.group, $ = l && (c[c.indexOf(n) + 1] ?? {
1536
+ group: !0
1537
+ }), y = l && $ && !0 === $.group, p = l ? i ? `${y ? dist_E : prompts_dist_d} ` : " " : "";
1538
+ let m = "";
1539
+ if (s > 0 && !l) {
1540
+ const S = `
1541
+ ${styleText("cyan", prompts_dist_d)}`;
1542
+ m = `${S.repeat(s - 1)}${S} `;
1543
+ }
1544
+ if ("active" === o) return `${m}${styleText("dim", p)}${styleText("cyan", te)} ${a}${n.hint ? ` ${styleText("dim", `(${n.hint})`)}` : ""}`;
1545
+ if ("group-active" === o) return `${m}${p}${styleText("cyan", te)} ${styleText("dim", a)}`;
1546
+ if ("group-active-selected" === o) return `${m}${p}${styleText("green", dist_U)} ${styleText("dim", a)}`;
1547
+ if ("selected" === o) {
1548
+ const S = l || i ? styleText("green", dist_U) : "";
1549
+ return `${m}${styleText("dim", p)}${S} ${styleText("dim", a)}${n.hint ? ` ${styleText("dim", `(${n.hint})`)}` : ""}`;
1550
+ }
1551
+ if ("cancelled" === o) return `${styleText([
1552
+ "strikethrough",
1553
+ "dim"
1554
+ ], a)}`;
1555
+ if ("active-selected" === o) return `${m}${styleText("dim", p)}${styleText("green", dist_U)} ${a}${n.hint ? ` ${styleText("dim", `(${n.hint})`)}` : ""}`;
1556
+ if ("submitted" === o) return `${styleText("dim", a)}`;
1557
+ const g = l || i ? styleText("dim", dist_J) : "";
1558
+ return `${m}${styleText("dim", p)}${g} ${styleText("dim", a)}`;
1559
+ }, u = e.required ?? !0;
1560
+ return new st({
1561
+ options: e.options,
1562
+ signal: e.signal,
1563
+ input: e.input,
1564
+ output: e.output,
1565
+ initialValues: e.initialValues,
1566
+ required: u,
1567
+ cursorAt: e.cursorAt,
1568
+ selectableGroups: i,
1569
+ validate (n) {
1570
+ if (u && (void 0 === n || 0 === n.length)) return `Please select at least one option.
1571
+ ${styleText("reset", styleText("dim", `Press ${styleText([
1572
+ "gray",
1573
+ "bgWhite",
1574
+ "inverse"
1575
+ ], " space ")} to select, ${styleText("gray", styleText([
1576
+ "bgWhite",
1577
+ "inverse"
1578
+ ], " enter "))} to submit`))}`;
1579
+ },
1580
+ render () {
1581
+ const n = e.withGuide ?? dist_u.withGuide, o = `${n ? `${styleText("gray", prompts_dist_d)}
1582
+ ` : ""}${dist_V(this.state)} ${e.message}
1583
+ `, c = this.value ?? [];
1584
+ switch(this.state){
1585
+ case "submit":
1586
+ {
1587
+ const a = this.options.filter(({ value: $ })=>c.includes($)).map(($)=>r($, "submitted")), l = 0 === a.length ? "" : ` ${a.join(styleText("dim", ", "))}`;
1588
+ return `${o}${n ? styleText("gray", prompts_dist_d) : ""}${l}`;
1589
+ }
1590
+ case "cancel":
1591
+ {
1592
+ const a = this.options.filter(({ value: l })=>c.includes(l)).map((l)=>r(l, "cancelled")).join(styleText("dim", ", "));
1593
+ return `${o}${n ? `${styleText("gray", prompts_dist_d)} ` : ""}${a.trim() ? `${a}${n ? `
1594
+ ${styleText("gray", prompts_dist_d)}` : ""}` : ""}`;
1595
+ }
1596
+ case "error":
1597
+ {
1598
+ const a = this.error.split(`
1599
+ `).map((l, $)=>0 === $ ? `${n ? `${styleText("yellow", dist_E)} ` : ""}${styleText("yellow", l)}` : ` ${l}`).join(`
1276
1600
  `);
1277
- if (f.length > 0) {
1278
- const [g, ...E] = f;
1279
- g.length > 0 ? u.push(`${c}${g}`) : u.push(l ? r : "");
1280
- for (const $ of E)$.length > 0 ? u.push(`${p}${$}`) : u.push(l ? s : "");
1601
+ return `${o}${n ? `${styleText("yellow", prompts_dist_d)} ` : ""}${this.options.map((l, $, y)=>{
1602
+ const p = c.includes(l.value) || !0 === l.group && this.isGroupSelected(`${l.value}`), m = $ === this.cursor;
1603
+ return m || "string" != typeof l.group || this.options[this.cursor].value !== l.group ? m && p ? r(l, "active-selected", y) : p ? r(l, "selected", y) : r(l, m ? "active" : "inactive", y) : r(l, p ? "group-active-selected" : "group-active", y);
1604
+ }).join(`
1605
+ ${n ? `${styleText("yellow", prompts_dist_d)} ` : ""}`)}
1606
+ ${a}
1607
+ `;
1608
+ }
1609
+ default:
1610
+ {
1611
+ const a = this.options.map(($, y, p)=>{
1612
+ const m = c.includes($.value) || !0 === $.group && this.isGroupSelected(`${$.value}`), g = y === this.cursor, S = !g && "string" == typeof $.group && this.options[this.cursor].value === $.group;
1613
+ let h = "";
1614
+ return S ? h = r($, m ? "group-active-selected" : "group-active", p) : g && m ? h = r($, "active-selected", p) : m ? h = r($, "selected", p) : h = r($, g ? "active" : "inactive", p), `${0 !== y && !h.startsWith(`
1615
+ `) ? " " : ""}${h}`;
1616
+ }).join(`
1617
+ ${n ? styleText("cyan", prompts_dist_d) : ""}`), l = a.startsWith(`
1618
+ `) ? "" : " ";
1619
+ return `${o}${n ? styleText("cyan", prompts_dist_d) : ""}${l}${a}
1620
+ ${n ? styleText("cyan", dist_E) : ""}
1621
+ `;
1622
+ }
1623
+ }
1281
1624
  }
1282
- i.write(`${u.join(`
1625
+ }).prompt();
1626
+ }, dist_O = {
1627
+ message: (e = [], { symbol: i = styleText("gray", prompts_dist_d), secondarySymbol: s = styleText("gray", prompts_dist_d), output: r = process.stdout, spacing: u = 1, withGuide: n } = {})=>{
1628
+ const o = [], c = n ?? dist_u.withGuide, a = c ? s : "", l = c ? `${i} ` : "", $ = c ? `${s} ` : "";
1629
+ for(let p = 0; p < u; p++)o.push(a);
1630
+ const y = Array.isArray(e) ? e : e.split(`
1631
+ `);
1632
+ if (y.length > 0) {
1633
+ const [p, ...m] = y;
1634
+ p.length > 0 ? o.push(`${l}${p}`) : o.push(c ? i : "");
1635
+ for (const g of m)g.length > 0 ? o.push(`${$}${g}`) : o.push(c ? s : "");
1636
+ }
1637
+ r.write(`${o.join(`
1283
1638
  `)}
1284
1639
  `);
1285
1640
  },
1286
- info: (e, r)=>{
1287
- R.message(e, {
1288
- ...r,
1289
- symbol: styleText("blue", fe)
1641
+ info: (e, i)=>{
1642
+ dist_O.message(e, {
1643
+ ...i,
1644
+ symbol: styleText("blue", he)
1290
1645
  });
1291
1646
  },
1292
- success: (e, r)=>{
1293
- R.message(e, {
1294
- ...r,
1295
- symbol: styleText("green", Fe)
1647
+ success: (e, i)=>{
1648
+ dist_O.message(e, {
1649
+ ...i,
1650
+ symbol: styleText("green", pe)
1296
1651
  });
1297
1652
  },
1298
- step: (e, r)=>{
1299
- R.message(e, {
1300
- ...r,
1301
- symbol: styleText("green", dist_V)
1653
+ step: (e, i)=>{
1654
+ dist_O.message(e, {
1655
+ ...i,
1656
+ symbol: styleText("green", dist_F)
1302
1657
  });
1303
1658
  },
1304
- warn: (e, r)=>{
1305
- R.message(e, {
1306
- ...r,
1307
- symbol: styleText("yellow", ye)
1659
+ warn: (e, i)=>{
1660
+ dist_O.message(e, {
1661
+ ...i,
1662
+ symbol: styleText("yellow", me)
1308
1663
  });
1309
1664
  },
1310
- warning: (e, r)=>{
1311
- R.warn(e, r);
1665
+ warning: (e, i)=>{
1666
+ dist_O.warn(e, i);
1312
1667
  },
1313
- error: (e, r)=>{
1314
- R.message(e, {
1315
- ...r,
1316
- symbol: styleText("red", Ee)
1668
+ error: (e, i)=>{
1669
+ dist_O.message(e, {
1670
+ ...i,
1671
+ symbol: styleText("red", ge)
1317
1672
  });
1318
1673
  }
1319
- }, Nt = (e = "", r)=>{
1320
- const s = r?.output ?? process.stdout, i = r?.withGuide ?? dist_.withGuide ? `${styleText("gray", dist_x)} ` : "";
1321
- s.write(`${i}${styleText("red", e)}
1674
+ }, pt = (e = "", i)=>{
1675
+ const s = i?.output ?? process.stdout, r = i?.withGuide ?? dist_u.withGuide ? `${styleText("gray", dist_E)} ` : "";
1676
+ s.write(`${r}${styleText("red", e)}
1322
1677
 
1323
1678
  `);
1324
- }, Gt = (e = "", r)=>{
1325
- const s = r?.output ?? process.stdout, i = r?.withGuide ?? dist_.withGuide ? `${styleText("gray", dist_h)}
1326
- ${styleText("gray", dist_x)} ` : "";
1327
- s.write(`${i}${e}
1679
+ }, gt = (e = "", i)=>{
1680
+ const s = i?.output ?? process.stdout, r = i?.withGuide ?? dist_u.withGuide ? `${styleText("gray", prompts_dist_d)}
1681
+ ${styleText("gray", dist_E)} ` : "";
1682
+ s.write(`${r}${e}
1328
1683
 
1329
1684
  `);
1330
- }, dist_Q = (e, r)=>e.split(`
1331
- `).map((s)=>r(s)).join(`
1332
- `), dist_Lt = (e)=>{
1333
- const r = (i, a)=>{
1334
- const o = i.label ?? String(i.value);
1335
- return "disabled" === a ? `${styleText("gray", q)} ${dist_Q(o, (u)=>styleText([
1685
+ }, dist_Q = (e, i)=>e.split(`
1686
+ `).map((s)=>i(s)).join(`
1687
+ `), yt = (e)=>{
1688
+ const i = (r, u)=>{
1689
+ const n = r.label ?? String(r.value);
1690
+ return "disabled" === u ? `${styleText("gray", dist_J)} ${dist_Q(n, (o)=>styleText([
1336
1691
  "strikethrough",
1337
1692
  "gray"
1338
- ], u))}${i.hint ? ` ${styleText("dim", `(${i.hint ?? "disabled"})`)}` : ""}` : "active" === a ? `${styleText("cyan", te)} ${o}${i.hint ? ` ${styleText("dim", `(${i.hint})`)}` : ""}` : "selected" === a ? `${styleText("green", dist_U)} ${dist_Q(o, (u)=>styleText("dim", u))}${i.hint ? ` ${styleText("dim", `(${i.hint})`)}` : ""}` : "cancelled" === a ? `${dist_Q(o, (u)=>styleText([
1693
+ ], o))}${r.hint ? ` ${styleText("dim", `(${r.hint ?? "disabled"})`)}` : ""}` : "active" === u ? `${styleText("cyan", te)} ${n}${r.hint ? ` ${styleText("dim", `(${r.hint})`)}` : ""}` : "selected" === u ? `${styleText("green", dist_U)} ${dist_Q(n, (o)=>styleText("dim", o))}${r.hint ? ` ${styleText("dim", `(${r.hint})`)}` : ""}` : "cancelled" === u ? `${dist_Q(n, (o)=>styleText([
1339
1694
  "strikethrough",
1340
1695
  "dim"
1341
- ], u))}` : "active-selected" === a ? `${styleText("green", dist_U)} ${o}${i.hint ? ` ${styleText("dim", `(${i.hint})`)}` : ""}` : "submitted" === a ? `${dist_Q(o, (u)=>styleText("dim", u))}` : `${styleText("dim", q)} ${dist_Q(o, (u)=>styleText("dim", u))}`;
1696
+ ], o))}` : "active-selected" === u ? `${styleText("green", dist_U)} ${n}${r.hint ? ` ${styleText("dim", `(${r.hint})`)}` : ""}` : "submitted" === u ? `${dist_Q(n, (o)=>styleText("dim", o))}` : `${styleText("dim", dist_J)} ${dist_Q(n, (o)=>styleText("dim", o))}`;
1342
1697
  }, s = e.required ?? !0;
1343
- return new Lt({
1698
+ return new it({
1344
1699
  options: e.options,
1345
1700
  signal: e.signal,
1346
1701
  input: e.input,
@@ -1348,8 +1703,8 @@ ${styleText("gray", dist_x)} ` : "";
1348
1703
  initialValues: e.initialValues,
1349
1704
  required: s,
1350
1705
  cursorAt: e.cursorAt,
1351
- validate (i) {
1352
- if (s && (void 0 === i || 0 === i.length)) return `Please select at least one option.
1706
+ validate (r) {
1707
+ if (s && (void 0 === r || 0 === r.length)) return `Please select at least one option.
1353
1708
  ${styleText("reset", styleText("dim", `Press ${styleText([
1354
1709
  "gray",
1355
1710
  "bgWhite",
@@ -1357,234 +1712,278 @@ ${styleText("reset", styleText("dim", `Press ${styleText([
1357
1712
  ], " space ")} to select, ${styleText("gray", styleText("bgWhite", styleText("inverse", " enter ")))} to submit`))}`;
1358
1713
  },
1359
1714
  render () {
1360
- const i = Bt(e.output, e.message, `${ve(this.state)} `, `${dist_W(this.state)} `), a = `${styleText("gray", dist_h)}
1361
- ${i}
1362
- `, o = this.value ?? [], u = (l, n)=>{
1363
- if (l.disabled) return r(l, "disabled");
1364
- const c = o.includes(l.value);
1365
- return n && c ? r(l, "active-selected") : c ? r(l, "selected") : r(l, n ? "active" : "inactive");
1715
+ const r = e.withGuide ?? dist_u.withGuide, u = dist_R(e.output, e.message, r ? `${ye(this.state)} ` : "", `${dist_V(this.state)} `), n = `${r ? `${styleText("gray", prompts_dist_d)}
1716
+ ` : ""}${u}
1717
+ `, o = this.value ?? [], c = (a, l)=>{
1718
+ if (a.disabled) return i(a, "disabled");
1719
+ const $ = o.includes(a.value);
1720
+ return l && $ ? i(a, "active-selected") : $ ? i(a, "selected") : i(a, l ? "active" : "inactive");
1366
1721
  };
1367
1722
  switch(this.state){
1368
1723
  case "submit":
1369
1724
  {
1370
- const l = this.options.filter(({ value: c })=>o.includes(c)).map((c)=>r(c, "submitted")).join(styleText("dim", ", ")) || styleText("dim", "none"), n = Bt(e.output, l, `${styleText("gray", dist_h)} `);
1371
- return `${a}${n}`;
1725
+ const a = this.options.filter(({ value: $ })=>o.includes($)).map(($)=>i($, "submitted")).join(styleText("dim", ", ")) || styleText("dim", "none"), l = dist_R(e.output, a, r ? `${styleText("gray", prompts_dist_d)} ` : "");
1726
+ return `${n}${l}`;
1372
1727
  }
1373
1728
  case "cancel":
1374
1729
  {
1375
- const l = this.options.filter(({ value: c })=>o.includes(c)).map((c)=>r(c, "cancelled")).join(styleText("dim", ", "));
1376
- if ("" === l.trim()) return `${a}${styleText("gray", dist_h)}`;
1377
- const n = Bt(e.output, l, `${styleText("gray", dist_h)} `);
1378
- return `${a}${n}
1379
- ${styleText("gray", dist_h)}`;
1730
+ const a = this.options.filter(({ value: $ })=>o.includes($)).map(($)=>i($, "cancelled")).join(styleText("dim", ", "));
1731
+ if ("" === a.trim()) return `${n}${styleText("gray", prompts_dist_d)}`;
1732
+ const l = dist_R(e.output, a, r ? `${styleText("gray", prompts_dist_d)} ` : "");
1733
+ return `${n}${l}${r ? `
1734
+ ${styleText("gray", prompts_dist_d)}` : ""}`;
1380
1735
  }
1381
1736
  case "error":
1382
1737
  {
1383
- const l = `${styleText("yellow", dist_h)} `, n = this.error.split(`
1384
- `).map((f, g)=>0 === g ? `${styleText("yellow", dist_x)} ${styleText("yellow", f)}` : ` ${f}`).join(`
1385
- `), c = a.split(`
1386
- `).length, p = n.split(`
1738
+ const a = r ? `${styleText("yellow", prompts_dist_d)} ` : "", l = this.error.split(`
1739
+ `).map((p, m)=>0 === m ? `${r ? `${styleText("yellow", dist_E)} ` : ""}${styleText("yellow", p)}` : ` ${p}`).join(`
1740
+ `), $ = n.split(`
1741
+ `).length, y = l.split(`
1387
1742
  `).length + 1;
1388
- return `${a}${l}${dist_X({
1743
+ return `${n}${a}${dist_Y({
1389
1744
  output: e.output,
1390
1745
  options: this.options,
1391
1746
  cursor: this.cursor,
1392
1747
  maxItems: e.maxItems,
1393
- columnPadding: l.length,
1394
- rowPadding: c + p,
1395
- style: u
1748
+ columnPadding: a.length,
1749
+ rowPadding: $ + y,
1750
+ style: c
1396
1751
  }).join(`
1397
- ${l}`)}
1398
- ${n}
1752
+ ${a}`)}
1753
+ ${l}
1399
1754
  `;
1400
1755
  }
1401
1756
  default:
1402
1757
  {
1403
- const l = `${styleText("cyan", dist_h)} `, n = a.split(`
1404
- `).length;
1405
- return `${a}${l}${dist_X({
1758
+ const a = r ? `${styleText("cyan", prompts_dist_d)} ` : "", l = n.split(`
1759
+ `).length, $ = r ? 2 : 1;
1760
+ return `${n}${a}${dist_Y({
1406
1761
  output: e.output,
1407
1762
  options: this.options,
1408
1763
  cursor: this.cursor,
1409
1764
  maxItems: e.maxItems,
1410
- columnPadding: l.length,
1411
- rowPadding: n + 2,
1412
- style: u
1765
+ columnPadding: a.length,
1766
+ rowPadding: l + $,
1767
+ style: c
1413
1768
  }).join(`
1414
- ${l}`)}
1415
- ${styleText("cyan", dist_x)}
1769
+ ${a}`)}
1770
+ ${r ? styleText("cyan", dist_E) : ""}
1416
1771
  `;
1417
1772
  }
1418
1773
  }
1419
1774
  }
1420
1775
  }).prompt();
1421
- }, jt = (e)=>styleText("dim", e), dist_kt = (e, r, s)=>{
1422
- const i = {
1776
+ }, ft = (e)=>styleText("dim", e), vt = (e, i, s)=>{
1777
+ const r = {
1423
1778
  hard: !0,
1424
1779
  trim: !1
1425
- }, a = J(e, r, i).split(`
1426
- `), o = a.reduce((n, c)=>Math.max(D(c), n), 0), u = a.map(s).reduce((n, c)=>Math.max(D(c), n), 0), l = r - (u - o);
1427
- return J(e, l, i);
1428
- }, dist_Vt = (e = "", r = "", s)=>{
1429
- const i = s?.output ?? node_process.stdout, a = s?.withGuide ?? dist_.withGuide, o = s?.format ?? jt, u = [
1780
+ }, u = wrapAnsi(e, i, r).split(`
1781
+ `), n = u.reduce((a, l)=>Math.max(fast_string_width_dist(l), a), 0), o = u.map(s).reduce((a, l)=>Math.max(fast_string_width_dist(l), a), 0), c = i - (o - n);
1782
+ return wrapAnsi(e, c, r);
1783
+ }, wt = (e = "", i = "", s)=>{
1784
+ const r = s?.output ?? node_process.stdout, u = s?.withGuide ?? dist_u.withGuide, n = s?.format ?? ft, o = [
1430
1785
  "",
1431
- ...dist_kt(e, dist_rt(i) - 6, o).split(`
1432
- `).map(o),
1786
+ ...vt(e, O(r) - 6, n).split(`
1787
+ `).map(n),
1433
1788
  ""
1434
- ], l = D(r), n = Math.max(u.reduce((g, E)=>{
1435
- const $ = D(E);
1436
- return $ > g ? $ : g;
1437
- }, 0), l) + 2, c = u.map((g)=>`${styleText("gray", dist_h)} ${g}${" ".repeat(n - D(g))}${styleText("gray", dist_h)}`).join(`
1438
- `), p = a ? `${styleText("gray", dist_h)}
1439
- ` : "", f = a ? We : ge;
1440
- i.write(`${p}${styleText("green", dist_V)} ${styleText("reset", r)} ${styleText("gray", se.repeat(Math.max(n - l - 1, 1)) + pe)}
1441
- ${c}
1442
- ${styleText("gray", f + se.repeat(n + 2) + me)}
1443
- `);
1444
- }, Kt = (e)=>styleText("magenta", e), be = ({ indicator: e = "dots", onCancel: r, output: s = process.stdout, cancelMessage: i, errorMessage: a, frames: o = ee ? [
1445
- "\u25D2",
1446
- "\u25D0",
1447
- "\u25D3",
1448
- "\u25D1"
1449
- ] : [
1450
- "\u2022",
1451
- "o",
1452
- "O",
1453
- "0"
1454
- ], delay: u = ee ? 80 : 120, signal: l, ...n } = {})=>{
1455
- const c = ce();
1456
- let p, f, g = !1, E = !1, $ = "", m, d = performance.now();
1457
- const F = dist_rt(s), y = n?.styleFrame ?? Kt, v = (B)=>{
1458
- const P = B > 1 ? a ?? dist_.messages.error : i ?? dist_.messages.cancel;
1459
- E = 1 === B, g && (k(P, B), E && "function" == typeof r && r());
1460
- }, C = ()=>v(2), A = ()=>v(1), b = ()=>{
1461
- process.on("uncaughtExceptionMonitor", C), process.on("unhandledRejection", C), process.on("SIGINT", A), process.on("SIGTERM", A), process.on("exit", v), l && l.addEventListener("abort", A);
1462
- }, w = ()=>{
1463
- process.removeListener("uncaughtExceptionMonitor", C), process.removeListener("unhandledRejection", C), process.removeListener("SIGINT", A), process.removeListener("SIGTERM", A), process.removeListener("exit", v), l && l.removeEventListener("abort", A);
1464
- }, S = ()=>{
1465
- if (void 0 === m) return;
1466
- c && s.write(`
1467
- `);
1468
- const B = J(m, F, {
1469
- hard: !0,
1470
- trim: !1
1471
- }).split(`
1472
- `);
1473
- B.length > 1 && s.write(src.cursor.up(B.length - 1)), s.write(src.cursor.to(0)), s.write(src.erase.down());
1474
- }, T = (B)=>B.replace(/\.+$/, ""), M = (B)=>{
1475
- const P = (performance.now() - B) / 1e3, G = Math.floor(P / 60), L = Math.floor(P % 60);
1476
- return G > 0 ? `[${G}m ${L}s]` : `[${L}s]`;
1477
- }, O = n.withGuide ?? dist_.withGuide, le = (B = "")=>{
1478
- g = !0, p = xt({
1479
- output: s
1480
- }), $ = T(B), d = performance.now(), O && s.write(`${styleText("gray", dist_h)}
1789
+ ], c = fast_string_width_dist(i), a = Math.max(o.reduce((p, m)=>{
1790
+ const g = fast_string_width_dist(m);
1791
+ return g > p ? g : p;
1792
+ }, 0), c) + 2, l = o.map((p)=>`${styleText("gray", prompts_dist_d)} ${p}${" ".repeat(a - fast_string_width_dist(p))}${styleText("gray", prompts_dist_d)}`).join(`
1793
+ `), $ = u ? `${styleText("gray", prompts_dist_d)}
1794
+ ` : "", y = u ? Ge : de;
1795
+ r.write(`${$}${styleText("green", dist_F)} ${styleText("reset", i)} ${styleText("gray", se.repeat(Math.max(a - c - 1, 1)) + ce)}
1796
+ ${l}
1797
+ ${styleText("gray", y + se.repeat(a + 2) + $e)}
1481
1798
  `);
1482
- let P = 0, G = 0;
1483
- b(), f = setInterval(()=>{
1484
- if (c && $ === m) return;
1485
- S(), m = $;
1486
- const L = y(o[P]);
1487
- let Z;
1488
- if (c) Z = `${L} ${$}...`;
1489
- else if ("timer" === e) Z = `${L} ${$} ${M(d)}`;
1490
- else {
1491
- const et = ".".repeat(Math.floor(G)).slice(0, 3);
1492
- Z = `${L} ${$}${et}`;
1493
- }
1494
- const Ze = J(Z, F, {
1495
- hard: !0,
1496
- trim: !1
1497
- });
1498
- s.write(Ze), P = P + 1 < o.length ? P + 1 : 0, G = G < 4 ? G + .125 : 0;
1499
- }, u);
1500
- }, k = (B = "", P = 0, G = !1)=>{
1501
- if (!g) return;
1502
- g = !1, clearInterval(f), S();
1503
- const L = 0 === P ? styleText("green", dist_V) : 1 === P ? styleText("red", $e) : styleText("red", de);
1504
- $ = B ?? $, G || ("timer" === e ? s.write(`${L} ${$} ${M(d)}
1505
- `) : s.write(`${L} ${$}
1506
- `)), w(), p();
1507
- };
1508
- return {
1509
- start: le,
1510
- stop: (B = "")=>k(B, 0),
1511
- message: (B = "")=>{
1512
- $ = T(B ?? $);
1513
- },
1514
- cancel: (B = "")=>k(B, 1),
1515
- error: (B = "")=>k(B, 2),
1516
- clear: ()=>k("", 0, !0),
1517
- get isCancelled () {
1518
- return E;
1519
- }
1520
- };
1521
1799
  };
1522
- I("\u2500", "-"), I("\u2501", "="), I("\u2588", "#");
1523
- const oe = (e, r)=>e.includes(`
1800
+ dist_w("\u2500", "-"), dist_w("\u2501", "="), dist_w("\u2588", "#");
1801
+ const re = (e, i)=>e.includes(`
1524
1802
  `) ? e.split(`
1525
- `).map((s)=>r(s)).join(`
1526
- `) : r(e), Jt = (e)=>{
1527
- const r = (s, i)=>{
1528
- const a = s.label ?? String(s.value);
1529
- switch(i){
1803
+ `).map((s)=>i(s)).join(`
1804
+ `) : i(e), _t = (e)=>{
1805
+ const i = (s, r)=>{
1806
+ const u = s.label ?? String(s.value);
1807
+ switch(r){
1530
1808
  case "disabled":
1531
- return `${styleText("gray", dist_H)} ${oe(a, (o)=>styleText("gray", o))}${s.hint ? ` ${styleText("dim", `(${s.hint ?? "disabled"})`)}` : ""}`;
1809
+ return `${styleText("gray", dist_H)} ${re(u, (n)=>styleText("gray", n))}${s.hint ? ` ${styleText("dim", `(${s.hint ?? "disabled"})`)}` : ""}`;
1532
1810
  case "selected":
1533
- return `${oe(a, (o)=>styleText("dim", o))}`;
1811
+ return `${re(u, (n)=>styleText("dim", n))}`;
1534
1812
  case "active":
1535
- return `${styleText("green", dist_z)} ${a}${s.hint ? ` ${styleText("dim", `(${s.hint})`)}` : ""}`;
1813
+ return `${styleText("green", dist_z)} ${u}${s.hint ? ` ${styleText("dim", `(${s.hint})`)}` : ""}`;
1536
1814
  case "cancelled":
1537
- return `${oe(a, (o)=>styleText([
1815
+ return `${re(u, (n)=>styleText([
1538
1816
  "strikethrough",
1539
1817
  "dim"
1540
- ], o))}`;
1818
+ ], n))}`;
1541
1819
  default:
1542
- return `${styleText("dim", dist_H)} ${oe(a, (o)=>styleText("dim", o))}`;
1820
+ return `${styleText("dim", dist_H)} ${re(u, (n)=>styleText("dim", n))}`;
1543
1821
  }
1544
1822
  };
1545
- return new Tt({
1823
+ return new nt({
1546
1824
  options: e.options,
1547
1825
  signal: e.signal,
1548
1826
  input: e.input,
1549
1827
  output: e.output,
1550
1828
  initialValue: e.initialValue,
1551
1829
  render () {
1552
- const s = e.withGuide ?? dist_.withGuide, i = `${dist_W(this.state)} `, a = `${ve(this.state)} `, o = Bt(e.output, e.message, a, i), u = `${s ? `${styleText("gray", dist_h)}
1553
- ` : ""}${o}
1830
+ const s = e.withGuide ?? dist_u.withGuide, r = `${dist_V(this.state)} `, u = `${ye(this.state)} `, n = dist_R(e.output, e.message, u, r), o = `${s ? `${styleText("gray", prompts_dist_d)}
1831
+ ` : ""}${n}
1554
1832
  `;
1555
1833
  switch(this.state){
1556
1834
  case "submit":
1557
1835
  {
1558
- const l = s ? `${styleText("gray", dist_h)} ` : "", n = Bt(e.output, r(this.options[this.cursor], "selected"), l);
1559
- return `${u}${n}`;
1836
+ const c = s ? `${styleText("gray", prompts_dist_d)} ` : "", a = dist_R(e.output, i(this.options[this.cursor], "selected"), c);
1837
+ return `${o}${a}`;
1560
1838
  }
1561
1839
  case "cancel":
1562
1840
  {
1563
- const l = s ? `${styleText("gray", dist_h)} ` : "", n = Bt(e.output, r(this.options[this.cursor], "cancelled"), l);
1564
- return `${u}${n}${s ? `
1565
- ${styleText("gray", dist_h)}` : ""}`;
1841
+ const c = s ? `${styleText("gray", prompts_dist_d)} ` : "", a = dist_R(e.output, i(this.options[this.cursor], "cancelled"), c);
1842
+ return `${o}${a}${s ? `
1843
+ ${styleText("gray", prompts_dist_d)}` : ""}`;
1566
1844
  }
1567
1845
  default:
1568
1846
  {
1569
- const l = s ? `${styleText("cyan", dist_h)} ` : "", n = s ? styleText("cyan", dist_x) : "", c = u.split(`
1570
- `).length, p = s ? 2 : 1;
1571
- return `${u}${l}${dist_X({
1847
+ const c = s ? `${styleText("cyan", prompts_dist_d)} ` : "", a = s ? styleText("cyan", dist_E) : "", l = o.split(`
1848
+ `).length, $ = s ? 2 : 1;
1849
+ return `${o}${c}${dist_Y({
1572
1850
  output: e.output,
1573
1851
  cursor: this.cursor,
1574
1852
  options: this.options,
1575
1853
  maxItems: e.maxItems,
1576
- columnPadding: l.length,
1577
- rowPadding: c + p,
1578
- style: (f, g)=>r(f, f.disabled ? "disabled" : g ? "active" : "inactive")
1854
+ columnPadding: c.length,
1855
+ rowPadding: l + $,
1856
+ style: (y, p)=>i(y, y.disabled ? "disabled" : p ? "active" : "inactive")
1579
1857
  }).join(`
1580
- ${l}`)}
1581
- ${n}
1858
+ ${c}`)}
1859
+ ${a}
1582
1860
  `;
1583
1861
  }
1584
1862
  }
1585
1863
  }
1586
1864
  }).prompt();
1587
- }, Zt = (styleText("gray", dist_h), (e)=>new dist_$t({
1865
+ }, xt = (styleText("gray", prompts_dist_d), (e)=>e.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g, "")), Gt = (e)=>{
1866
+ const i = e.output ?? process.stdout, s = O(i), r = styleText("gray", prompts_dist_d), u = e.spacing ?? 1, n = 3, o = !0 === e.retainLog, c = !ae() && Te(i);
1867
+ i.write(`${r}
1868
+ `), i.write(`${styleText("green", dist_F)} ${e.title}
1869
+ `);
1870
+ for(let h = 0; h < u; h++)i.write(`${r}
1871
+ `);
1872
+ const a = [
1873
+ {
1874
+ value: "",
1875
+ full: ""
1876
+ }
1877
+ ];
1878
+ let l = !1;
1879
+ const $ = (h)=>{
1880
+ if (0 === a.length) return;
1881
+ let f = 0;
1882
+ h && (f += u + 2);
1883
+ for (const v of a){
1884
+ const { value: T, result: C } = v;
1885
+ let b = C?.message ?? T;
1886
+ if (0 === b.length) continue;
1887
+ void 0 === C && void 0 !== v.header && "" !== v.header && (b += `
1888
+ ${v.header}`);
1889
+ const x = b.split(`
1890
+ `).reduce((G, M)=>"" === M ? G + 1 : G + Math.ceil((M.length + n) / s), 0);
1891
+ f += x;
1892
+ }
1893
+ f > 0 && (f += 1, i.write(src.erase.lines(f)));
1894
+ }, y = (h, f, v)=>{
1895
+ const T = v ? `${h.full}
1896
+ ${h.value}` : h.value;
1897
+ void 0 !== h.header && "" !== h.header && dist_O.message(h.header.split(`
1898
+ `).map((C)=>styleText("bold", C)), {
1899
+ output: i,
1900
+ secondarySymbol: r,
1901
+ symbol: r,
1902
+ spacing: 0
1903
+ }), dist_O.message(T.split(`
1904
+ `).map((C)=>styleText("dim", C)), {
1905
+ output: i,
1906
+ secondarySymbol: r,
1907
+ symbol: r,
1908
+ spacing: f ?? u
1909
+ });
1910
+ }, p = ()=>{
1911
+ for (const h of a){
1912
+ const { header: f, value: v, full: T } = h;
1913
+ (void 0 === f || 0 === f.length) && 0 === v.length || y(h, void 0, !0 === o && T.length > 0);
1914
+ }
1915
+ }, m = (h, f, v)=>{
1916
+ if ($(!1), v?.raw === !0 && l || "" === h.value || (h.value += `
1917
+ `), h.value += xt(f), l = v?.raw === !0, void 0 !== e.limit) {
1918
+ const T = h.value.split(`
1919
+ `), C = T.length - e.limit;
1920
+ if (C > 0) {
1921
+ const b = T.splice(0, C);
1922
+ o && (h.full += ("" === h.full ? "" : `
1923
+ `) + b.join(`
1924
+ `));
1925
+ }
1926
+ h.value = T.join(`
1927
+ `);
1928
+ }
1929
+ c && g();
1930
+ }, g = ()=>{
1931
+ for (const h of a)h.result ? "error" === h.result.status ? dist_O.error(h.result.message, {
1932
+ output: i,
1933
+ secondarySymbol: r,
1934
+ spacing: 0
1935
+ }) : dist_O.success(h.result.message, {
1936
+ output: i,
1937
+ secondarySymbol: r,
1938
+ spacing: 0
1939
+ }) : "" !== h.value && y(h, 0);
1940
+ }, S = (h, f)=>{
1941
+ $(!1), h.result = f, c && g();
1942
+ };
1943
+ return {
1944
+ message (h, f) {
1945
+ m(a[0], h, f);
1946
+ },
1947
+ group (h) {
1948
+ const f = {
1949
+ header: h,
1950
+ value: "",
1951
+ full: ""
1952
+ };
1953
+ return a.push(f), {
1954
+ message (v, T) {
1955
+ m(f, v, T);
1956
+ },
1957
+ error (v) {
1958
+ S(f, {
1959
+ status: "error",
1960
+ message: v
1961
+ });
1962
+ },
1963
+ success (v) {
1964
+ S(f, {
1965
+ status: "success",
1966
+ message: v
1967
+ });
1968
+ }
1969
+ };
1970
+ },
1971
+ error (h, f) {
1972
+ $(!0), dist_O.error(h, {
1973
+ output: i,
1974
+ secondarySymbol: r,
1975
+ spacing: 1
1976
+ }), f?.showLog !== !1 && p(), a.splice(1, a.length - 1), a[0].value = "", a[0].full = "";
1977
+ },
1978
+ success (h, f) {
1979
+ $(!0), dist_O.success(h, {
1980
+ output: i,
1981
+ secondarySymbol: r,
1982
+ spacing: 1
1983
+ }), f?.showLog === !0 && p(), a.splice(1, a.length - 1), a[0].value = "", a[0].full = "";
1984
+ }
1985
+ };
1986
+ }, Ot = (e)=>new at({
1588
1987
  validate: e.validate,
1589
1988
  placeholder: e.placeholder,
1590
1989
  defaultValue: e.defaultValue,
@@ -1593,45 +1992,45 @@ ${n}
1593
1992
  signal: e.signal,
1594
1993
  input: e.input,
1595
1994
  render () {
1596
- const r = e?.withGuide ?? dist_.withGuide, s = `${r ? `${styleText("gray", dist_h)}
1597
- ` : ""}${dist_W(this.state)} ${e.message}
1598
- `, i = e.placeholder ? styleText("inverse", e.placeholder[0]) + styleText("dim", e.placeholder.slice(1)) : styleText([
1995
+ const i = e?.withGuide ?? dist_u.withGuide, s = `${i ? `${styleText("gray", prompts_dist_d)}
1996
+ ` : ""}${dist_V(this.state)} ${e.message}
1997
+ `, r = e.placeholder ? styleText("inverse", e.placeholder[0]) + styleText("dim", e.placeholder.slice(1)) : styleText([
1599
1998
  "inverse",
1600
1999
  "hidden"
1601
- ], "_"), a = this.userInput ? this.userInputWithCursor : i, o = this.value ?? "";
2000
+ ], "_"), u = this.userInput ? this.userInputWithCursor : r, n = this.value ?? "";
1602
2001
  switch(this.state){
1603
2002
  case "error":
1604
2003
  {
1605
- const u = this.error ? ` ${styleText("yellow", this.error)}` : "", l = r ? `${styleText("yellow", dist_h)} ` : "", n = r ? styleText("yellow", dist_x) : "";
2004
+ const o = this.error ? ` ${styleText("yellow", this.error)}` : "", c = i ? `${styleText("yellow", prompts_dist_d)} ` : "", a = i ? styleText("yellow", dist_E) : "";
1606
2005
  return `${s.trim()}
1607
- ${l}${a}
1608
- ${n}${u}
2006
+ ${c}${u}
2007
+ ${a}${o}
1609
2008
  `;
1610
2009
  }
1611
2010
  case "submit":
1612
2011
  {
1613
- const u = o ? ` ${styleText("dim", o)}` : "", l = r ? styleText("gray", dist_h) : "";
1614
- return `${s}${l}${u}`;
2012
+ const o = n ? ` ${styleText("dim", n)}` : "", c = i ? styleText("gray", prompts_dist_d) : "";
2013
+ return `${s}${c}${o}`;
1615
2014
  }
1616
2015
  case "cancel":
1617
2016
  {
1618
- const u = o ? ` ${styleText([
2017
+ const o = n ? ` ${styleText([
1619
2018
  "strikethrough",
1620
2019
  "dim"
1621
- ], o)}` : "", l = r ? styleText("gray", dist_h) : "";
1622
- return `${s}${l}${u}${o.trim() ? `
1623
- ${l}` : ""}`;
2020
+ ], n)}` : "", c = i ? styleText("gray", prompts_dist_d) : "";
2021
+ return `${s}${c}${o}${n.trim() ? `
2022
+ ${c}` : ""}`;
1624
2023
  }
1625
2024
  default:
1626
2025
  {
1627
- const u = r ? `${styleText("cyan", dist_h)} ` : "", l = r ? styleText("cyan", dist_x) : "";
1628
- return `${s}${u}${a}
1629
- ${l}
2026
+ const o = i ? `${styleText("cyan", prompts_dist_d)} ` : "", c = i ? styleText("cyan", dist_E) : "";
2027
+ return `${s}${o}${u}
2028
+ ${c}
1630
2029
  `;
1631
2030
  }
1632
2031
  }
1633
2032
  }
1634
- }).prompt());
2033
+ }).prompt();
1635
2034
  function checkNodeVersion() {
1636
2035
  const { versions } = process;
1637
2036
  if ("styleText" in node_util || !versions.node || versions.bun || versions.deno) return;
@@ -1903,18 +2302,18 @@ let createLogger = (options = {})=>{
1903
2302
  return logger;
1904
2303
  };
1905
2304
  let src_logger = createLogger();
1906
- var main_l = (e, t)=>()=>(t || e((t = {
2305
+ var main_d = (e, t)=>()=>(t || e((t = {
1907
2306
  exports: {}
1908
2307
  }).exports, t), t.exports);
1909
- var main_u = /* @__PURE__ */ createRequire(import.meta.url);
1910
- const main_d = /^path$/i;
1911
- const main_f = {
2308
+ var main_f = /* @__PURE__ */ createRequire(import.meta.url);
2309
+ const main_p = /^path$/i;
2310
+ const main_m = {
1912
2311
  key: "PATH",
1913
2312
  value: ""
1914
2313
  };
1915
- function main_p(e) {
2314
+ function main_h(e) {
1916
2315
  for(const t in e){
1917
- if (!Object.prototype.hasOwnProperty.call(e, t) || !main_d.test(t)) continue;
2316
+ if (!Object.prototype.hasOwnProperty.call(e, t) || !main_p.test(t)) continue;
1918
2317
  const n = e[t];
1919
2318
  if (!n) break;
1920
2319
  return {
@@ -1922,51 +2321,49 @@ function main_p(e) {
1922
2321
  value: n
1923
2322
  };
1924
2323
  }
1925
- return main_f;
2324
+ return main_m;
1926
2325
  }
1927
- function main_m(e, t) {
1928
- const i = t.value.split(delimiter);
1929
- const o = [];
2326
+ function main_g(e, t) {
2327
+ const n = t.value.split(delimiter);
2328
+ const a = [];
1930
2329
  let s = e;
1931
2330
  let c;
1932
2331
  do {
1933
- o.push(resolve(s, "node_modules", ".bin"));
2332
+ a.push(resolve(s, "node_modules", ".bin"));
1934
2333
  c = s;
1935
2334
  s = dirname(s);
1936
2335
  }while (s !== c);
1937
- const l = o.concat(i).join(delimiter);
2336
+ a.push(dirname(process.execPath));
2337
+ const l = a.concat(n).join(delimiter);
1938
2338
  return {
1939
2339
  key: t.key,
1940
2340
  value: l
1941
2341
  };
1942
2342
  }
1943
- function main_h(e, t) {
2343
+ function main_(e, t) {
1944
2344
  const n = {
1945
2345
  ...process.env,
1946
2346
  ...t
1947
2347
  };
1948
- const r = main_m(e, main_p(n));
2348
+ const r = main_g(e, main_h(n));
1949
2349
  n[r.key] = r.value;
1950
2350
  return n;
1951
2351
  }
1952
- const main_g = (e)=>{
2352
+ const main_v = (e)=>{
1953
2353
  let t = e.length;
1954
2354
  const n = new PassThrough();
1955
2355
  const r = ()=>{
1956
- if (0 === --t) n.emit("end");
2356
+ if (0 === --t) n.end();
1957
2357
  };
1958
- for (const t of e){
1959
- t.pipe(n, {
1960
- end: false
1961
- });
1962
- t.on("end", r);
1963
- }
2358
+ for (const t of e)pipeline(t, n, {
2359
+ end: false
2360
+ }).then(r).catch(r);
1964
2361
  return n;
1965
2362
  };
1966
- var main_ = /* @__PURE__ */ main_l((e, t)=>{
2363
+ var main_y = /* @__PURE__ */ main_d((e, t)=>{
1967
2364
  t.exports = a;
1968
2365
  a.sync = o;
1969
- var n = main_u("fs");
2366
+ var n = main_f("fs");
1970
2367
  function r(e, t) {
1971
2368
  var n = void 0 !== t.pathExt ? t.pathExt : process.env.PATHEXT;
1972
2369
  if (!n) return true;
@@ -1991,10 +2388,10 @@ var main_ = /* @__PURE__ */ main_l((e, t)=>{
1991
2388
  return i(n.statSync(e), e, t);
1992
2389
  }
1993
2390
  });
1994
- var main_v = /* @__PURE__ */ main_l((e, t)=>{
2391
+ var main_b = /* @__PURE__ */ main_d((e, t)=>{
1995
2392
  t.exports = r;
1996
2393
  r.sync = i;
1997
- var n = main_u("fs");
2394
+ var n = main_f("fs");
1998
2395
  function r(e, t, r) {
1999
2396
  n.stat(e, function(e, n) {
2000
2397
  r(e, e ? false : a(n, t));
@@ -2019,10 +2416,10 @@ var main_v = /* @__PURE__ */ main_l((e, t)=>{
2019
2416
  return n & l || n & c && i === o || n & s && r === a || n & u && 0 === a;
2020
2417
  }
2021
2418
  });
2022
- var main_y = /* @__PURE__ */ main_l((e, t)=>{
2023
- main_u("fs");
2419
+ var main_x = /* @__PURE__ */ main_d((e, t)=>{
2420
+ main_f("fs");
2024
2421
  var n;
2025
- n = "win32" === process.platform || global.TESTING_WINDOWS ? main_() : main_v();
2422
+ n = "win32" === process.platform || global.TESTING_WINDOWS ? main_y() : main_b();
2026
2423
  t.exports = r;
2027
2424
  r.sync = i;
2028
2425
  function r(e, t, i) {
@@ -2058,11 +2455,11 @@ var main_y = /* @__PURE__ */ main_l((e, t)=>{
2058
2455
  }
2059
2456
  }
2060
2457
  });
2061
- var main_b = /* @__PURE__ */ main_l((e, t)=>{
2458
+ var main_S = /* @__PURE__ */ main_d((e, t)=>{
2062
2459
  const n = "win32" === process.platform || "cygwin" === process.env.OSTYPE || "msys" === process.env.OSTYPE;
2063
- const r = main_u("path");
2460
+ const r = main_f("path");
2064
2461
  const i = n ? ";" : ":";
2065
- const a = main_y();
2462
+ const a = main_x();
2066
2463
  const o = (e)=>Object.assign(/* @__PURE__ */ new Error(`not found: ${e}`), {
2067
2464
  code: "ENOENT"
2068
2465
  });
@@ -2143,7 +2540,7 @@ var main_b = /* @__PURE__ */ main_l((e, t)=>{
2143
2540
  t.exports = c;
2144
2541
  c.sync = l;
2145
2542
  });
2146
- var main_x = /* @__PURE__ */ main_l((e, t)=>{
2543
+ var main_C = /* @__PURE__ */ main_d((e, t)=>{
2147
2544
  const n = (e = {})=>{
2148
2545
  const t = e.env || process.env;
2149
2546
  if ("win32" !== (e.platform || process.platform)) return "PATH";
@@ -2152,10 +2549,10 @@ var main_x = /* @__PURE__ */ main_l((e, t)=>{
2152
2549
  t.exports = n;
2153
2550
  t.exports.default = n;
2154
2551
  });
2155
- var main_S = /* @__PURE__ */ main_l((e, t)=>{
2156
- const n = main_u("path");
2157
- const r = main_b();
2158
- const i = main_x();
2552
+ var main_w = /* @__PURE__ */ main_d((e, t)=>{
2553
+ const n = main_f("path");
2554
+ const r = main_S();
2555
+ const i = main_C();
2159
2556
  function a(e, t) {
2160
2557
  const a = e.options.env || process.env;
2161
2558
  const o = process.cwd();
@@ -2183,7 +2580,7 @@ var main_S = /* @__PURE__ */ main_l((e, t)=>{
2183
2580
  }
2184
2581
  t.exports = o;
2185
2582
  });
2186
- var main_C = /* @__PURE__ */ main_l((e, t)=>{
2583
+ var main_T = /* @__PURE__ */ main_d((e, t)=>{
2187
2584
  const n = /([()\][%!^"`<>&|;, *?])/g;
2188
2585
  function r(e) {
2189
2586
  e = e.replace(n, "^$1");
@@ -2201,11 +2598,11 @@ var main_C = /* @__PURE__ */ main_l((e, t)=>{
2201
2598
  t.exports.command = r;
2202
2599
  t.exports.argument = i;
2203
2600
  });
2204
- var main_w = /* @__PURE__ */ main_l((e, t)=>{
2601
+ var main_E = /* @__PURE__ */ main_d((e, t)=>{
2205
2602
  t.exports = /^#!(.*)/;
2206
2603
  });
2207
- var main_T = /* @__PURE__ */ main_l((e, t)=>{
2208
- const n = main_w();
2604
+ var main_D = /* @__PURE__ */ main_d((e, t)=>{
2605
+ const n = main_E();
2209
2606
  t.exports = (e = "")=>{
2210
2607
  const t = e.match(n);
2211
2608
  if (!t) return null;
@@ -2215,9 +2612,9 @@ var main_T = /* @__PURE__ */ main_l((e, t)=>{
2215
2612
  return i ? `${a} ${i}` : a;
2216
2613
  };
2217
2614
  });
2218
- var main_E = /* @__PURE__ */ main_l((e, t)=>{
2219
- const n = main_u("fs");
2220
- const r = main_T();
2615
+ var main_O = /* @__PURE__ */ main_d((e, t)=>{
2616
+ const n = main_f("fs");
2617
+ const r = main_D();
2221
2618
  function i(e) {
2222
2619
  const t = 150;
2223
2620
  const i = Buffer.alloc(t);
@@ -2231,11 +2628,11 @@ var main_E = /* @__PURE__ */ main_l((e, t)=>{
2231
2628
  }
2232
2629
  t.exports = i;
2233
2630
  });
2234
- var main_D = /* @__PURE__ */ main_l((e, t)=>{
2235
- const n = main_u("path");
2236
- const r = main_S();
2237
- const i = main_C();
2238
- const a = main_E();
2631
+ var main_k = /* @__PURE__ */ main_d((e, t)=>{
2632
+ const n = main_f("path");
2633
+ const r = main_w();
2634
+ const i = main_T();
2635
+ const a = main_O();
2239
2636
  const o = "win32" === process.platform;
2240
2637
  const s = /\.(?:com|exe)$/i;
2241
2638
  const c = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
@@ -2249,7 +2646,7 @@ var main_D = /* @__PURE__ */ main_l((e, t)=>{
2249
2646
  }
2250
2647
  return e.file;
2251
2648
  }
2252
- function d(e) {
2649
+ function u(e) {
2253
2650
  if (!o) return e;
2254
2651
  const t = l(e);
2255
2652
  const r = !s.test(t);
@@ -2271,7 +2668,7 @@ var main_D = /* @__PURE__ */ main_l((e, t)=>{
2271
2668
  }
2272
2669
  return e;
2273
2670
  }
2274
- function f(e, t, n) {
2671
+ function d(e, t, n) {
2275
2672
  if (t && !Array.isArray(t)) {
2276
2673
  n = t;
2277
2674
  t = null;
@@ -2288,11 +2685,11 @@ var main_D = /* @__PURE__ */ main_l((e, t)=>{
2288
2685
  args: t
2289
2686
  }
2290
2687
  };
2291
- return n.shell ? r : d(r);
2688
+ return n.shell ? r : u(r);
2292
2689
  }
2293
- t.exports = f;
2690
+ t.exports = d;
2294
2691
  });
2295
- var main_O = /* @__PURE__ */ main_l((e, t)=>{
2692
+ var main_A = /* @__PURE__ */ main_d((e, t)=>{
2296
2693
  const n = "win32" === process.platform;
2297
2694
  function r(e, t) {
2298
2695
  return Object.assign(/* @__PURE__ */ new Error(`${t} ${e.command} ENOENT`), {
@@ -2329,10 +2726,10 @@ var main_O = /* @__PURE__ */ main_l((e, t)=>{
2329
2726
  notFoundError: r
2330
2727
  };
2331
2728
  });
2332
- var main_k = /* @__PURE__ */ main_l((e, t)=>{
2333
- const n = main_u("child_process");
2334
- const r = main_D();
2335
- const i = main_O();
2729
+ var main_j = /* @__PURE__ */ main_d((e, t)=>{
2730
+ const n = main_f("child_process");
2731
+ const r = main_k();
2732
+ const i = main_A();
2336
2733
  function a(e, t, a) {
2337
2734
  const o = r(e, t, a);
2338
2735
  const s = n.spawn(o.command, o.args, o.options);
@@ -2351,10 +2748,8 @@ var main_k = /* @__PURE__ */ main_l((e, t)=>{
2351
2748
  t.exports._parse = r;
2352
2749
  t.exports._enoent = i;
2353
2750
  });
2354
- var main_A = main_k();
2355
- var main_j = class extends Error {
2356
- result;
2357
- output;
2751
+ var main_M = main_j();
2752
+ var main_N = class extends Error {
2358
2753
  get exitCode() {
2359
2754
  if (null !== this.result.exitCode) return this.result.exitCode;
2360
2755
  }
@@ -2364,20 +2759,20 @@ var main_j = class extends Error {
2364
2759
  this.output = t;
2365
2760
  }
2366
2761
  };
2367
- const main_M = {
2762
+ const main_F = {
2368
2763
  timeout: void 0,
2369
2764
  persist: false
2370
2765
  };
2371
- const N = {
2766
+ const main_L = {
2372
2767
  windowsHide: true
2373
2768
  };
2374
- function main_P(e, t) {
2769
+ function main_R(e, t) {
2375
2770
  return {
2376
2771
  command: external_node_path_normalize(e),
2377
2772
  args: t ?? []
2378
2773
  };
2379
2774
  }
2380
- function main_F(e) {
2775
+ function main_z(e) {
2381
2776
  const t = new AbortController();
2382
2777
  for (const n of e){
2383
2778
  if (n.aborted) {
@@ -2393,12 +2788,14 @@ function main_F(e) {
2393
2788
  }
2394
2789
  return t.signal;
2395
2790
  }
2396
- async function main_I(e) {
2791
+ async function main_B(e) {
2397
2792
  let t = "";
2398
- for await (const n of e)t += n.toString();
2793
+ try {
2794
+ for await (const n of e)t += n.toString();
2795
+ } catch {}
2399
2796
  return t;
2400
2797
  }
2401
- var main_L = class {
2798
+ var main_V = class {
2402
2799
  _process;
2403
2800
  _aborted = false;
2404
2801
  _options;
@@ -2418,7 +2815,7 @@ var main_L = class {
2418
2815
  }
2419
2816
  constructor(e, t, n){
2420
2817
  this._options = {
2421
- ...main_M,
2818
+ ...main_F,
2422
2819
  ...n
2423
2820
  };
2424
2821
  this._command = e;
@@ -2437,7 +2834,7 @@ var main_L = class {
2437
2834
  return this._process?.killed === true;
2438
2835
  }
2439
2836
  pipe(e, t, n) {
2440
- return main_z(e, t, {
2837
+ return main_W(e, t, {
2441
2838
  ...n,
2442
2839
  stdin: this
2443
2840
  });
@@ -2448,7 +2845,7 @@ var main_L = class {
2448
2845
  const t = [];
2449
2846
  if (this._streamErr) t.push(this._streamErr);
2450
2847
  if (this._streamOut) t.push(this._streamOut);
2451
- const n = main_g(t);
2848
+ const n = main_v(t);
2452
2849
  const r = node_readline.createInterface({
2453
2850
  input: n
2454
2851
  });
@@ -2456,26 +2853,27 @@ var main_L = class {
2456
2853
  await this._processClosed;
2457
2854
  e.removeAllListeners();
2458
2855
  if (this._thrownError) throw this._thrownError;
2459
- if (this._options?.throwOnError && 0 !== this.exitCode && void 0 !== this.exitCode) throw new main_j(this);
2856
+ if (this._options?.throwOnError && 0 !== this.exitCode && void 0 !== this.exitCode) throw new main_N(this);
2460
2857
  }
2461
2858
  async _waitForOutput() {
2462
2859
  const e = this._process;
2463
2860
  if (!e) throw new Error("No process was started");
2464
2861
  const [t, n] = await Promise.all([
2465
- this._streamOut ? main_I(this._streamOut) : "",
2466
- this._streamErr ? main_I(this._streamErr) : ""
2862
+ this._streamOut ? main_B(this._streamOut) : "",
2863
+ this._streamErr ? main_B(this._streamErr) : ""
2467
2864
  ]);
2468
2865
  await this._processClosed;
2469
- if (this._options?.stdin) await this._options.stdin;
2866
+ const { stdin: r } = this._options;
2867
+ if (r && "string" != typeof r) await r;
2470
2868
  e.removeAllListeners();
2471
2869
  if (this._thrownError) throw this._thrownError;
2472
- const r = {
2870
+ const i = {
2473
2871
  stderr: n,
2474
2872
  stdout: t,
2475
2873
  exitCode: this.exitCode
2476
2874
  };
2477
- if (this._options.throwOnError && 0 !== this.exitCode && void 0 !== this.exitCode) throw new main_j(this, r);
2478
- return r;
2875
+ if (this._options.throwOnError && 0 !== this.exitCode && void 0 !== this.exitCode) throw new main_N(this, i);
2876
+ return i;
2479
2877
  }
2480
2878
  then(e, t) {
2481
2879
  return this._waitForOutput().then(e, t);
@@ -2486,7 +2884,7 @@ var main_L = class {
2486
2884
  const e = external_node_process_cwd();
2487
2885
  const n = this._options;
2488
2886
  const r = {
2489
- ...N,
2887
+ ...main_L,
2490
2888
  ...n.nodeOptions
2491
2889
  };
2492
2890
  const i = [];
@@ -2494,19 +2892,20 @@ var main_L = class {
2494
2892
  if (void 0 !== n.timeout) i.push(AbortSignal.timeout(n.timeout));
2495
2893
  if (void 0 !== n.signal) i.push(n.signal);
2496
2894
  if (true === n.persist) r.detached = true;
2497
- if (i.length > 0) r.signal = main_F(i);
2498
- r.env = main_h(e, r.env);
2499
- const { command: a, args: s } = main_P(this._command, this._args);
2500
- const c = (0, main_A._parse)(a, s, r);
2895
+ if (i.length > 0) r.signal = main_z(i);
2896
+ r.env = main_(e, r.env);
2897
+ const { command: a, args: o } = main_R(this._command, this._args);
2898
+ const c = (0, main_M._parse)(a, o, r);
2501
2899
  const l = spawn(c.command, c.args, c.options);
2502
2900
  if (l.stderr) this._streamErr = l.stderr;
2503
2901
  if (l.stdout) this._streamOut = l.stdout;
2504
2902
  this._process = l;
2505
2903
  l.once("error", this._onError);
2506
2904
  l.once("close", this._onClose);
2507
- if (void 0 !== n.stdin && l.stdin && n.stdin.process) {
2508
- const { stdout: e } = n.stdin.process;
2509
- if (e) e.pipe(l.stdin);
2905
+ if (l.stdin) {
2906
+ const { stdin: e } = n;
2907
+ if ("string" == typeof e) l.stdin.end(e);
2908
+ else e?.process?.stdout?.pipe(l.stdin);
2510
2909
  }
2511
2910
  }
2512
2911
  _resetState() {
@@ -2527,13 +2926,13 @@ var main_L = class {
2527
2926
  if (this._resolveClose) this._resolveClose();
2528
2927
  };
2529
2928
  };
2530
- const main_R = (e, t, n)=>{
2531
- const r = new main_L(e, t, n);
2929
+ const main_U = (e, t, n)=>{
2930
+ const r = new main_V(e, t, n);
2532
2931
  r.spawn();
2533
2932
  return r;
2534
2933
  };
2535
- const main_z = main_R;
2536
- const dist = __webpack_require__("./node_modules/.pnpm/@vercel+detect-agent@1.2.1/node_modules/@vercel/detect-agent/dist/index.js");
2934
+ const main_W = main_U;
2935
+ const dist_0 = __webpack_require__("./node_modules/.pnpm/@vercel+detect-agent@1.2.2/node_modules/@vercel/detect-agent/dist/index.js");
2537
2936
  const cjs = __webpack_require__("./node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js");
2538
2937
  var cjs_default = /*#__PURE__*/ __webpack_require__.n(cjs);
2539
2938
  const minimist = __webpack_require__("./node_modules/.pnpm/minimist@1.2.8/node_modules/minimist/index.js");
@@ -2541,11 +2940,11 @@ var minimist_default = /*#__PURE__*/ __webpack_require__.n(minimist);
2541
2940
  const src_filename = fileURLToPath(import.meta.url);
2542
2941
  const src_dirname = dirname(src_filename);
2543
2942
  function cancelAndExit() {
2544
- Nt('Operation cancelled.');
2943
+ pt('Operation cancelled.');
2545
2944
  process.exit(0);
2546
2945
  }
2547
2946
  function checkCancel(value) {
2548
- if (Ct(value)) cancelAndExit();
2947
+ if (dist_q(value)) cancelAndExit();
2549
2948
  return value;
2550
2949
  }
2551
2950
  function formatProjectName(input) {
@@ -2654,7 +3053,7 @@ async function getTools({ tools, dir, template }, extraTools, templateName) {
2654
3053
  options.unshift(...filteredExtraTools.filter((tool)=>'pre' === tool.order).map(normalize));
2655
3054
  options.push(...filteredExtraTools.filter((tool)=>'pre' !== tool.order).map(normalize));
2656
3055
  }
2657
- return checkCancel(await dist_Lt({
3056
+ return checkCancel(await yt({
2658
3057
  message: 'Select additional tools (Use <space> to select, <enter> to continue)',
2659
3058
  options,
2660
3059
  required: false
@@ -2674,7 +3073,7 @@ function orderExtraSkills(extraSkills) {
2674
3073
  ...extraSkills.filter((extraSkill)=>'post' === extraSkill.order)
2675
3074
  ];
2676
3075
  }
2677
- async function getSkills({ skill, dir, template }, extraSkills, templateName, promptMultiselect = dist_Lt) {
3076
+ async function getSkills({ skill, dir, template }, extraSkills, templateName, promptMultiselect = yt) {
2678
3077
  const parsedSkills = parseSkillsOption(skill);
2679
3078
  const filteredExtraSkills = filterExtraSkills(extraSkills, templateName);
2680
3079
  if (null !== parsedSkills) return parsedSkills.filter((value)=>filteredExtraSkills?.some((extraSkill)=>extraSkill.value === value));
@@ -2720,7 +3119,7 @@ async function runCommand(command, cwd, packageManager) {
2720
3119
  if (replacement) command = command.replace('npm create ', replacement).replace(' -- --', ' --');
2721
3120
  if ('yarn' === packageManager) command = command.replace('@latest', '');
2722
3121
  }
2723
- const result = await main_R(command, [], {
3122
+ const result = await main_U(command, [], {
2724
3123
  nodeOptions: {
2725
3124
  shell: true,
2726
3125
  stdio: 'inherit',
@@ -2735,42 +3134,49 @@ async function runCommand(command, cwd, packageManager) {
2735
3134
  throw new Error(`Failed to run command: ${command}${details ? `\n${details}` : ''}`);
2736
3135
  }
2737
3136
  }
2738
- async function runSkillCommand(skill, cwd) {
3137
+ async function runSkillCommand(skills, cwd) {
3138
+ const [firstSkill] = skills;
3139
+ const installArgs = skills.flatMap((skill)=>[
3140
+ '--skill',
3141
+ skill.skill ?? skill.value
3142
+ ]);
2739
3143
  const args = [
2740
3144
  '-y',
2741
3145
  'skills',
2742
3146
  'add',
2743
- skill.source,
3147
+ firstSkill.source,
2744
3148
  '--agent',
2745
3149
  'universal',
2746
3150
  '--yes',
2747
3151
  '--copy',
2748
- '--skill',
2749
- skill.skill ?? skill.value
3152
+ ...installArgs
2750
3153
  ];
2751
3154
  const command = `npx ${args.join(' ')}`;
2752
- R.info(`Running skill install command: ${color.dim(command)}`);
2753
- const installationSpinner = be();
2754
- installationSpinner.start(`Installing skill ${skill.value}`);
2755
- const result = await main_R('npx', args, {
3155
+ dist_O.info(`Running skill install command: ${color.dim(command)}`);
3156
+ const skillLabel = skills.map((skill)=>skill.value).join(', ');
3157
+ const skillNoun = 1 === skills.length ? 'skill' : 'skills';
3158
+ const installationTaskLog = Gt({
3159
+ title: `Installing ${skillNoun} ${skillLabel}`
3160
+ });
3161
+ const proc = main_U('npx', args, {
2756
3162
  nodeOptions: {
2757
3163
  cwd,
2758
3164
  stdio: 'pipe'
2759
3165
  }
2760
3166
  });
3167
+ for await (const line of proc)installationTaskLog.message(line);
3168
+ const result = await proc;
2761
3169
  if (0 !== result.exitCode) {
2762
- installationSpinner.error(`Failed to install skill ${skill.value}`);
2763
- const details = [
2764
- result.stderr,
2765
- result.stdout
2766
- ].filter(Boolean).join('\n').trim();
2767
- throw new Error(`Failed to install skill "${skill.value}" from "${skill.source}" using command: ${command}${details ? `\n${details}` : ''}`);
3170
+ const quotedSkillLabel = skills.map((skill)=>`"${skill.value}"`).join(', ');
3171
+ const message = `Failed to install ${skillNoun} ${quotedSkillLabel} from "${firstSkill.source}" using command: ${command}`;
3172
+ installationTaskLog.error(message);
3173
+ throw new Error(message);
2768
3174
  }
2769
- installationSpinner.stop(`Installed skill ${skill.value}`);
3175
+ installationTaskLog.success(`Installed ${skillNoun} ${skillLabel}`);
2770
3176
  }
2771
3177
  async function create({ name, root, templates, skipFiles, getTemplateName, mapESLintTemplate, version, noteInformation, extraTools, extraSkills, argv: processArgv = process.argv }) {
2772
3178
  src_logger.greet(`\n◆ Create ${upperFirst(name)} Project`);
2773
- const { isAgent } = await (0, dist.determineAgent)();
3179
+ const { isAgent } = await (0, dist_0.determineAgent)();
2774
3180
  if (isAgent) {
2775
3181
  console.log('');
2776
3182
  src_logger.info(`To create a project non-interactively, run: npx -y create-${name} <DIR> --template <TEMPLATE>`);
@@ -2784,7 +3190,7 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
2784
3190
  packageManager
2785
3191
  };
2786
3192
  if (!version) version = (await readPackageJson(root)).version;
2787
- const projectName = argv.dir ?? checkCancel(await Zt({
3193
+ const projectName = argv.dir ?? checkCancel(await Ot({
2788
3194
  message: 'Project name or path',
2789
3195
  placeholder: `${name.toLowerCase()}-project`,
2790
3196
  defaultValue: `${name.toLowerCase()}-project`,
@@ -2797,7 +3203,7 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
2797
3203
  const packageName = argv.packageName || formatted.packageName;
2798
3204
  const distFolder = node_path.isAbsolute(targetDir) ? targetDir : node_path.join(cwd, targetDir);
2799
3205
  if (!argv.override && node_fs.existsSync(distFolder) && !isEmptyDir(distFolder)) {
2800
- const option = checkCancel(await Jt({
3206
+ const option = checkCancel(await _t({
2801
3207
  message: `"${targetDir}" is not empty, please choose:`,
2802
3208
  options: [
2803
3209
  {
@@ -2815,7 +3221,7 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
2815
3221
  const templateName = await getTemplateName(argv);
2816
3222
  const tools = await getTools(argv, extraTools, templateName);
2817
3223
  const filteredExtraSkills = filterExtraSkills(extraSkills, templateName);
2818
- const skills = await getSkills(argv, filteredExtraSkills, templateName, dist_Lt);
3224
+ const skills = await getSkills(argv, filteredExtraSkills, templateName, yt);
2819
3225
  const srcFolder = node_path.join(root, `template-${templateName}`);
2820
3226
  const commonFolder = node_path.join(root, 'template-common');
2821
3227
  if (!node_fs.existsSync(srcFolder)) throw new Error(`Invalid input: template "${templateName}" not found.`);
@@ -2834,10 +3240,22 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
2834
3240
  templateParameters,
2835
3241
  skipFiles
2836
3242
  });
3243
+ const skillsByValue = new Map((filteredExtraSkills ?? []).map((extraSkill)=>[
3244
+ extraSkill.value,
3245
+ extraSkill
3246
+ ]));
3247
+ let currentSkillBatch = [];
2837
3248
  for (const skillValue of skills){
2838
- const matchedSkill = filteredExtraSkills?.find((extraSkill)=>extraSkill.value === skillValue);
2839
- if (matchedSkill) await runSkillCommand(matchedSkill, distFolder);
3249
+ const matchedSkill = skillsByValue.get(skillValue);
3250
+ if (matchedSkill) {
3251
+ if (currentSkillBatch.length > 0 && currentSkillBatch[0].source !== matchedSkill.source) {
3252
+ await runSkillCommand(currentSkillBatch, distFolder);
3253
+ currentSkillBatch = [];
3254
+ }
3255
+ currentSkillBatch.push(matchedSkill);
3256
+ }
2840
3257
  }
3258
+ if (currentSkillBatch.length > 0) await runSkillCommand(currentSkillBatch, distFolder);
2841
3259
  const packageRoot = node_path.resolve(src_dirname, '..');
2842
3260
  const agentsMdSearchDirs = [
2843
3261
  commonFolder,
@@ -2898,8 +3316,8 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
2898
3316
  `3. ${color.cyan(`${packageManager} install`)}`,
2899
3317
  `4. ${color.cyan(`${packageManager} run dev`)}`
2900
3318
  ];
2901
- if (nextSteps.length) dist_Vt(nextSteps.map((step)=>color.reset(step)).join('\n'), 'Next steps');
2902
- Gt('All set, happy coding!');
3319
+ if (nextSteps.length) wt(nextSteps.map((step)=>color.reset(step)).join('\n'), 'Next steps');
3320
+ gt('All set, happy coding!');
2903
3321
  }
2904
3322
  function sortObjectKeys(obj) {
2905
3323
  const sortedKeys = Object.keys(obj).sort();
@@ -3062,4 +3480,4 @@ function collectAgentsFiles(agentsMdSearchDirs) {
3062
3480
  }
3063
3481
  return agentsFiles;
3064
3482
  }
3065
- export { BUILTIN_TOOLS, Jt as select, Zt as text, checkCancel, collectAgentsFiles, copyFolder, create, dist_Lt as multiselect, mergeAgentsFiles, mergePackageJson };
3483
+ export { Ae as autocomplete, BUILTIN_TOOLS, Ot as text, _t as select, checkCancel, collectAgentsFiles, copyFolder, create, ht as groupMultiselect, mergeAgentsFiles, mergePackageJson, yt as multiselect };