create-rstack 1.8.2 → 1.9.1

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
@@ -1,12 +1,15 @@
1
1
  import "node:module";
2
2
  import node_fs from "node:fs";
3
- import node_path, { dirname } from "node:path";
3
+ import node_path, { delimiter, dirname, normalize as external_node_path_normalize, resolve } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import node_util, { styleText } from "node:util";
6
- import node_process, { stdin, stdout } from "node:process";
6
+ import node_process, { cwd as external_node_process_cwd, stdin, stdout } from "node:process";
7
7
  import node_readline from "node:readline";
8
8
  import node_tty from "node:tty";
9
9
  import node_os from "node:os";
10
+ import { createRequire } from "node:module";
11
+ import { spawn } from "node:child_process";
12
+ import { PassThrough } from "node:stream";
10
13
  import { createRequire as __rspack_createRequire } from "node:module";
11
14
  const __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
12
15
  var __webpack_modules__ = {};
@@ -207,192 +210,6 @@ __webpack_require__.add({
207
210
  };
208
211
  }
209
212
  },
210
- "./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js" (module, __unused_rspack_exports, __webpack_require__) {
211
- const cp = __webpack_require__("child_process");
212
- const parse = __webpack_require__("./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js");
213
- const enoent = __webpack_require__("./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js");
214
- function spawn(command, args, options) {
215
- const parsed = parse(command, args, options);
216
- const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
217
- enoent.hookChildProcess(spawned, parsed);
218
- return spawned;
219
- }
220
- function spawnSync(command, args, options) {
221
- const parsed = parse(command, args, options);
222
- const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
223
- result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
224
- return result;
225
- }
226
- module.exports = spawn;
227
- module.exports.spawn = spawn;
228
- module.exports.sync = spawnSync;
229
- module.exports._parse = parse;
230
- module.exports._enoent = enoent;
231
- },
232
- "./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js" (module) {
233
- const isWin = 'win32' === process.platform;
234
- function notFoundError(original, syscall) {
235
- return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
236
- code: 'ENOENT',
237
- errno: 'ENOENT',
238
- syscall: `${syscall} ${original.command}`,
239
- path: original.command,
240
- spawnargs: original.args
241
- });
242
- }
243
- function hookChildProcess(cp, parsed) {
244
- if (!isWin) return;
245
- const originalEmit = cp.emit;
246
- cp.emit = function(name, arg1) {
247
- if ('exit' === name) {
248
- const err = verifyENOENT(arg1, parsed);
249
- if (err) return originalEmit.call(cp, 'error', err);
250
- }
251
- return originalEmit.apply(cp, arguments);
252
- };
253
- }
254
- function verifyENOENT(status, parsed) {
255
- if (isWin && 1 === status && !parsed.file) return notFoundError(parsed.original, 'spawn');
256
- return null;
257
- }
258
- function verifyENOENTSync(status, parsed) {
259
- if (isWin && 1 === status && !parsed.file) return notFoundError(parsed.original, 'spawnSync');
260
- return null;
261
- }
262
- module.exports = {
263
- hookChildProcess,
264
- verifyENOENT,
265
- verifyENOENTSync,
266
- notFoundError
267
- };
268
- },
269
- "./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js" (module, __unused_rspack_exports, __webpack_require__) {
270
- const path = __webpack_require__("path");
271
- const resolveCommand = __webpack_require__("./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js");
272
- const escape = __webpack_require__("./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js");
273
- const readShebang = __webpack_require__("./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js");
274
- const isWin = 'win32' === process.platform;
275
- const isExecutableRegExp = /\.(?:com|exe)$/i;
276
- const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
277
- function detectShebang(parsed) {
278
- parsed.file = resolveCommand(parsed);
279
- const shebang = parsed.file && readShebang(parsed.file);
280
- if (shebang) {
281
- parsed.args.unshift(parsed.file);
282
- parsed.command = shebang;
283
- return resolveCommand(parsed);
284
- }
285
- return parsed.file;
286
- }
287
- function parseNonShell(parsed) {
288
- if (!isWin) return parsed;
289
- const commandFile = detectShebang(parsed);
290
- const needsShell = !isExecutableRegExp.test(commandFile);
291
- if (parsed.options.forceShell || needsShell) {
292
- const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
293
- parsed.command = path.normalize(parsed.command);
294
- parsed.command = escape.command(parsed.command);
295
- parsed.args = parsed.args.map((arg)=>escape.argument(arg, needsDoubleEscapeMetaChars));
296
- const shellCommand = [
297
- parsed.command
298
- ].concat(parsed.args).join(' ');
299
- parsed.args = [
300
- '/d',
301
- '/s',
302
- '/c',
303
- `"${shellCommand}"`
304
- ];
305
- parsed.command = process.env.comspec || 'cmd.exe';
306
- parsed.options.windowsVerbatimArguments = true;
307
- }
308
- return parsed;
309
- }
310
- function parse(command, args, options) {
311
- if (args && !Array.isArray(args)) {
312
- options = args;
313
- args = null;
314
- }
315
- args = args ? args.slice(0) : [];
316
- options = Object.assign({}, options);
317
- const parsed = {
318
- command,
319
- args,
320
- options,
321
- file: void 0,
322
- original: {
323
- command,
324
- args
325
- }
326
- };
327
- return options.shell ? parsed : parseNonShell(parsed);
328
- }
329
- module.exports = parse;
330
- },
331
- "./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js" (module) {
332
- const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
333
- function escapeCommand(arg) {
334
- arg = arg.replace(metaCharsRegExp, '^$1');
335
- return arg;
336
- }
337
- function escapeArgument(arg, doubleEscapeMetaChars) {
338
- arg = `${arg}`;
339
- arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"');
340
- arg = arg.replace(/(?=(\\+?)?)\1$/, '$1$1');
341
- arg = `"${arg}"`;
342
- arg = arg.replace(metaCharsRegExp, '^$1');
343
- if (doubleEscapeMetaChars) arg = arg.replace(metaCharsRegExp, '^$1');
344
- return arg;
345
- }
346
- module.exports.command = escapeCommand;
347
- module.exports.argument = escapeArgument;
348
- },
349
- "./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js" (module, __unused_rspack_exports, __webpack_require__) {
350
- const fs = __webpack_require__("fs");
351
- const shebangCommand = __webpack_require__("./node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js");
352
- function readShebang(command) {
353
- const size = 150;
354
- const buffer = Buffer.alloc(size);
355
- let fd;
356
- try {
357
- fd = fs.openSync(command, 'r');
358
- fs.readSync(fd, buffer, 0, size, 0);
359
- fs.closeSync(fd);
360
- } catch (e) {}
361
- return shebangCommand(buffer.toString());
362
- }
363
- module.exports = readShebang;
364
- },
365
- "./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js" (module, __unused_rspack_exports, __webpack_require__) {
366
- const path = __webpack_require__("path");
367
- const which = __webpack_require__("./node_modules/.pnpm/which@2.0.2/node_modules/which/which.js");
368
- const getPathKey = __webpack_require__("./node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js");
369
- function resolveCommandAttempt(parsed, withoutPathExt) {
370
- const env = parsed.options.env || process.env;
371
- const cwd = process.cwd();
372
- const hasCustomCwd = null != parsed.options.cwd;
373
- const shouldSwitchCwd = hasCustomCwd && void 0 !== process.chdir && !process.chdir.disabled;
374
- if (shouldSwitchCwd) try {
375
- process.chdir(parsed.options.cwd);
376
- } catch (err) {}
377
- let resolved;
378
- try {
379
- resolved = which.sync(parsed.command, {
380
- path: env[getPathKey({
381
- env
382
- })],
383
- pathExt: withoutPathExt ? path.delimiter : void 0
384
- });
385
- } catch (e) {} finally{
386
- if (shouldSwitchCwd) process.chdir(cwd);
387
- }
388
- if (resolved) resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : '', resolved);
389
- return resolved;
390
- }
391
- function resolveCommand(parsed) {
392
- return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
393
- }
394
- module.exports = resolveCommand;
395
- },
396
213
  "./node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js" (module) {
397
214
  var isMergeableObject = function(value) {
398
215
  return isNonNullObject(value) && !isSpecial(value);
@@ -476,102 +293,6 @@ __webpack_require__.add({
476
293
  var deepmerge_1 = deepmerge;
477
294
  module.exports = deepmerge_1;
478
295
  },
479
- "./node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js" (module, __unused_rspack_exports, __webpack_require__) {
480
- __webpack_require__("fs");
481
- var core;
482
- core = 'win32' === process.platform || global.TESTING_WINDOWS ? __webpack_require__("./node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js") : __webpack_require__("./node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js");
483
- module.exports = isexe;
484
- isexe.sync = sync;
485
- function isexe(path, options, cb) {
486
- if ('function' == typeof options) {
487
- cb = options;
488
- options = {};
489
- }
490
- if (!cb) {
491
- if ('function' != typeof Promise) throw new TypeError('callback not provided');
492
- return new Promise(function(resolve, reject) {
493
- isexe(path, options || {}, function(er, is) {
494
- if (er) reject(er);
495
- else resolve(is);
496
- });
497
- });
498
- }
499
- core(path, options || {}, function(er, is) {
500
- if (er) {
501
- if ('EACCES' === er.code || options && options.ignoreErrors) {
502
- er = null;
503
- is = false;
504
- }
505
- }
506
- cb(er, is);
507
- });
508
- }
509
- function sync(path, options) {
510
- try {
511
- return core.sync(path, options || {});
512
- } catch (er) {
513
- if (options && options.ignoreErrors || 'EACCES' === er.code) return false;
514
- throw er;
515
- }
516
- }
517
- },
518
- "./node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js" (module, __unused_rspack_exports, __webpack_require__) {
519
- module.exports = isexe;
520
- isexe.sync = sync;
521
- var fs = __webpack_require__("fs");
522
- function isexe(path, options, cb) {
523
- fs.stat(path, function(er, stat) {
524
- cb(er, er ? false : checkStat(stat, options));
525
- });
526
- }
527
- function sync(path, options) {
528
- return checkStat(fs.statSync(path), options);
529
- }
530
- function checkStat(stat, options) {
531
- return stat.isFile() && checkMode(stat, options);
532
- }
533
- function checkMode(stat, options) {
534
- var mod = stat.mode;
535
- var uid = stat.uid;
536
- var gid = stat.gid;
537
- var myUid = void 0 !== options.uid ? options.uid : process.getuid && process.getuid();
538
- var myGid = void 0 !== options.gid ? options.gid : process.getgid && process.getgid();
539
- var u = parseInt('100', 8);
540
- var g = parseInt('010', 8);
541
- var o = parseInt('001', 8);
542
- var ug = u | g;
543
- var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && 0 === myUid;
544
- return ret;
545
- }
546
- },
547
- "./node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js" (module, __unused_rspack_exports, __webpack_require__) {
548
- module.exports = isexe;
549
- isexe.sync = sync;
550
- var fs = __webpack_require__("fs");
551
- function checkPathExt(path, options) {
552
- var pathext = void 0 !== options.pathExt ? options.pathExt : process.env.PATHEXT;
553
- if (!pathext) return true;
554
- pathext = pathext.split(';');
555
- if (-1 !== pathext.indexOf('')) return true;
556
- for(var i = 0; i < pathext.length; i++){
557
- var p = pathext[i].toLowerCase();
558
- if (p && path.substr(-p.length).toLowerCase() === p) return true;
559
- }
560
- return false;
561
- }
562
- function checkStat(stat, path, options) {
563
- if (!stat.isSymbolicLink() && !stat.isFile()) return false;
564
- return checkPathExt(path, options);
565
- }
566
- function isexe(path, options, cb) {
567
- fs.stat(path, function(er, stat) {
568
- cb(er, er ? false : checkStat(stat, path, options));
569
- });
570
- }
571
- function sync(path, options) {
572
- return checkStat(fs.statSync(path), path, options);
573
- }
574
- },
575
296
  "./node_modules/.pnpm/minimist@1.2.8/node_modules/minimist/index.js" (module) {
576
297
  function hasKey(obj, keys) {
577
298
  var o = obj;
@@ -751,30 +472,6 @@ __webpack_require__.add({
751
472
  return argv;
752
473
  };
753
474
  },
754
- "./node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js" (module) {
755
- const pathKey = (options = {})=>{
756
- const environment = options.env || process.env;
757
- const platform = options.platform || process.platform;
758
- if ('win32' !== platform) return 'PATH';
759
- return Object.keys(environment).reverse().find((key)=>'PATH' === key.toUpperCase()) || 'Path';
760
- };
761
- module.exports = pathKey;
762
- module.exports["default"] = pathKey;
763
- },
764
- "./node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js" (module, __unused_rspack_exports, __webpack_require__) {
765
- const shebangRegex = __webpack_require__("./node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js");
766
- module.exports = (string = '')=>{
767
- const match = string.match(shebangRegex);
768
- if (!match) return null;
769
- const [path, argument] = match[0].replace(/#! ?/, '').split(' ');
770
- const binary = path.split('/').pop();
771
- if ('env' === binary) return argument;
772
- return argument ? `${binary} ${argument}` : binary;
773
- };
774
- },
775
- "./node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js" (module) {
776
- module.exports = /^#!(.*)/;
777
- },
778
475
  "./node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js" (module) {
779
476
  const ESC = '\x1B';
780
477
  const CSI = `${ESC}[`;
@@ -829,268 +526,328 @@ __webpack_require__.add({
829
526
  beep
830
527
  };
831
528
  },
832
- "./node_modules/.pnpm/which@2.0.2/node_modules/which/which.js" (module, __unused_rspack_exports, __webpack_require__) {
833
- const isWindows = 'win32' === process.platform || 'cygwin' === process.env.OSTYPE || 'msys' === process.env.OSTYPE;
834
- const path = __webpack_require__("path");
835
- const COLON = isWindows ? ';' : ':';
836
- const isexe = __webpack_require__("./node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js");
837
- const getNotFoundError = (cmd)=>Object.assign(new Error(`not found: ${cmd}`), {
838
- code: 'ENOENT'
839
- });
840
- const getPathInfo = (cmd, opt)=>{
841
- const colon = opt.colon || COLON;
842
- const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [
843
- ''
844
- ] : [
845
- ...isWindows ? [
846
- process.cwd()
847
- ] : [],
848
- ...(opt.path || process.env.PATH || '').split(colon)
849
- ];
850
- const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM' : '';
851
- const pathExt = isWindows ? pathExtExe.split(colon) : [
852
- ''
853
- ];
854
- if (isWindows) {
855
- if (-1 !== cmd.indexOf('.') && '' !== pathExt[0]) pathExt.unshift('');
856
- }
857
- return {
858
- pathEnv,
859
- pathExt,
860
- pathExtExe
861
- };
862
- };
863
- const which = (cmd, opt, cb)=>{
864
- if ('function' == typeof opt) {
865
- cb = opt;
866
- opt = {};
867
- }
868
- if (!opt) opt = {};
869
- const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
870
- const found = [];
871
- const step = (i)=>new Promise((resolve, reject)=>{
872
- if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
873
- const ppRaw = pathEnv[i];
874
- const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
875
- const pCmd = path.join(pathPart, cmd);
876
- const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
877
- resolve(subStep(p, i, 0));
878
- });
879
- const subStep = (p, i, ii)=>new Promise((resolve, reject)=>{
880
- if (ii === pathExt.length) return resolve(step(i + 1));
881
- const ext = pathExt[ii];
882
- isexe(p + ext, {
883
- pathExt: pathExtExe
884
- }, (er, is)=>{
885
- if (!er && is) if (!opt.all) return resolve(p + ext);
886
- else found.push(p + ext);
887
- return resolve(subStep(p, i, ii + 1));
888
- });
889
- });
890
- return cb ? step(0).then((res)=>cb(null, res), cb) : step(0);
891
- };
892
- const whichSync = (cmd, opt)=>{
893
- opt = opt || {};
894
- const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
895
- const found = [];
896
- for(let i = 0; i < pathEnv.length; i++){
897
- const ppRaw = pathEnv[i];
898
- const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
899
- const pCmd = path.join(pathPart, cmd);
900
- const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
901
- for(let j = 0; j < pathExt.length; j++){
902
- const cur = p + pathExt[j];
903
- try {
904
- const is = isexe.sync(cur, {
905
- pathExt: pathExtExe
906
- });
907
- if (is) if (!opt.all) return cur;
908
- else found.push(cur);
909
- } catch (ex) {}
910
- }
911
- }
912
- if (opt.all && found.length) return found;
913
- if (opt.nothrow) return null;
914
- throw getNotFoundError(cmd);
915
- };
916
- module.exports = which;
917
- which.sync = whichSync;
918
- },
919
- child_process (module) {
920
- module.exports = __rspack_createRequire_require("child_process");
921
- },
922
- fs (module) {
923
- module.exports = __rspack_createRequire_require("fs");
924
- },
925
529
  "node:fs?31c0" (module) {
926
530
  module.exports = __rspack_createRequire_require("node:fs");
927
531
  },
928
532
  "node:fs/promises" (module) {
929
533
  module.exports = __rspack_createRequire_require("node:fs/promises");
930
- },
931
- path (module) {
932
- module.exports = __rspack_createRequire_require("path");
933
534
  }
934
535
  });
935
- const src = __webpack_require__("./node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js");
936
- function x(t, e, s) {
937
- if (!s.some((u)=>!u.disabled)) return t;
938
- const i = t + e, r = Math.max(s.length - 1, 0), n = i < 0 ? r : i > r ? 0 : i;
939
- return s[n].disabled ? x(n, e < 0 ? -1 : 1, s) : n;
940
- }
941
- 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 = {
536
+ 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;
537
+ const isFullWidth = (x)=>0x3000 === x || x >= 0xFF01 && x <= 0xFF60 || x >= 0xFFE0 && x <= 0xFFE6;
538
+ 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;
539
+ const ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
540
+ const CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
541
+ const TAB_RE = /\t{1,1000}/y;
542
+ 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;
543
+ const LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
544
+ const MODIFIER_RE = /\p{M}+/gu;
545
+ const NO_TRUNCATION = {
942
546
  limit: 1 / 0,
943
- ellipsis: ""
944
- }, X = (t, e = {}, s = {})=>{
945
- 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;
946
- 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;
947
- t: for(;;){
948
- if (w > C || o >= p && o > h) {
949
- const ut = t.slice(C, w) || t.slice(h, o);
950
- v = 0;
951
- for (const Y of ut.replaceAll(ct, "")){
952
- const $ = Y.codePointAt(0) || 0;
953
- 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) {
954
- F = !0;
955
- break t;
547
+ ellipsis: ''
548
+ };
549
+ const getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {})=>{
550
+ const LIMIT = truncationOptions.limit ?? 1 / 0;
551
+ const ELLIPSIS = truncationOptions.ellipsis ?? '';
552
+ const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
553
+ const ANSI_WIDTH = widthOptions.ansiWidth ?? 0;
554
+ const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
555
+ const TAB_WIDTH = widthOptions.tabWidth ?? 8;
556
+ const AMBIGUOUS_WIDTH = widthOptions.ambiguousWidth ?? 1;
557
+ const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
558
+ const FULL_WIDTH_WIDTH = widthOptions.fullWidthWidth ?? 2;
559
+ const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
560
+ const WIDE_WIDTH = widthOptions.wideWidth ?? 2;
561
+ let indexPrev = 0;
562
+ let index = 0;
563
+ let length = input.length;
564
+ let lengthExtra = 0;
565
+ let truncationEnabled = false;
566
+ let truncationIndex = length;
567
+ let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
568
+ let unmatchedStart = 0;
569
+ let unmatchedEnd = 0;
570
+ let width = 0;
571
+ let widthExtra = 0;
572
+ outer: while(true){
573
+ if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
574
+ const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
575
+ lengthExtra = 0;
576
+ for (const char of unmatched.replaceAll(MODIFIER_RE, '')){
577
+ const codePoint = char.codePointAt(0) || 0;
578
+ widthExtra = isFullWidth(codePoint) ? FULL_WIDTH_WIDTH : isWide(codePoint) ? WIDE_WIDTH : AMBIGUOUS_WIDTH !== REGULAR_WIDTH && isAmbiguous(codePoint) ? AMBIGUOUS_WIDTH : REGULAR_WIDTH;
579
+ if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
580
+ if (width + widthExtra > LIMIT) {
581
+ truncationEnabled = true;
582
+ break outer;
956
583
  }
957
- v += Y.length, c += f;
584
+ lengthExtra += char.length;
585
+ width += widthExtra;
958
586
  }
959
- C = w = 0;
960
- }
961
- if (o >= p) break;
962
- if (dist_M.lastIndex = o, dist_M.test(t)) {
963
- 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) {
964
- F = !0;
587
+ unmatchedStart = unmatchedEnd = 0;
588
+ }
589
+ if (index >= length) break;
590
+ LATIN_RE.lastIndex = index;
591
+ if (LATIN_RE.test(input)) {
592
+ lengthExtra = LATIN_RE.lastIndex - index;
593
+ widthExtra = lengthExtra * REGULAR_WIDTH;
594
+ if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / REGULAR_WIDTH));
595
+ if (width + widthExtra > LIMIT) {
596
+ truncationEnabled = true;
965
597
  break;
966
598
  }
967
- c += f, C = h, w = o, o = h = dist_M.lastIndex;
599
+ width += widthExtra;
600
+ unmatchedStart = indexPrev;
601
+ unmatchedEnd = index;
602
+ index = indexPrev = LATIN_RE.lastIndex;
968
603
  continue;
969
604
  }
970
- if (dist_O.lastIndex = o, dist_O.test(t)) {
971
- if (c + u > b && (d = Math.min(d, o)), c + u > i) {
972
- F = !0;
605
+ ANSI_RE.lastIndex = index;
606
+ if (ANSI_RE.test(input)) {
607
+ if (width + ANSI_WIDTH > truncationLimit) truncationIndex = Math.min(truncationIndex, index);
608
+ if (width + ANSI_WIDTH > LIMIT) {
609
+ truncationEnabled = true;
973
610
  break;
974
611
  }
975
- c += u, C = h, w = o, o = h = dist_O.lastIndex;
612
+ width += ANSI_WIDTH;
613
+ unmatchedStart = indexPrev;
614
+ unmatchedEnd = index;
615
+ index = indexPrev = ANSI_RE.lastIndex;
976
616
  continue;
977
617
  }
978
- if (dist_y.lastIndex = o, dist_y.test(t)) {
979
- 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) {
980
- F = !0;
618
+ CONTROL_RE.lastIndex = index;
619
+ if (CONTROL_RE.test(input)) {
620
+ lengthExtra = CONTROL_RE.lastIndex - index;
621
+ widthExtra = lengthExtra * CONTROL_WIDTH;
622
+ if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / CONTROL_WIDTH));
623
+ if (width + widthExtra > LIMIT) {
624
+ truncationEnabled = true;
981
625
  break;
982
626
  }
983
- c += f, C = h, w = o, o = h = dist_y.lastIndex;
627
+ width += widthExtra;
628
+ unmatchedStart = indexPrev;
629
+ unmatchedEnd = index;
630
+ index = indexPrev = CONTROL_RE.lastIndex;
984
631
  continue;
985
632
  }
986
- if (dist_L.lastIndex = o, dist_L.test(t)) {
987
- 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) {
988
- F = !0;
633
+ TAB_RE.lastIndex = index;
634
+ if (TAB_RE.test(input)) {
635
+ lengthExtra = TAB_RE.lastIndex - index;
636
+ widthExtra = lengthExtra * TAB_WIDTH;
637
+ if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / TAB_WIDTH));
638
+ if (width + widthExtra > LIMIT) {
639
+ truncationEnabled = true;
989
640
  break;
990
641
  }
991
- c += f, C = h, w = o, o = h = dist_L.lastIndex;
642
+ width += widthExtra;
643
+ unmatchedStart = indexPrev;
644
+ unmatchedEnd = index;
645
+ index = indexPrev = TAB_RE.lastIndex;
992
646
  continue;
993
647
  }
994
- if (dist_P.lastIndex = o, dist_P.test(t)) {
995
- if (c + g > b && (d = Math.min(d, o)), c + g > i) {
996
- F = !0;
648
+ EMOJI_RE.lastIndex = index;
649
+ if (EMOJI_RE.test(input)) {
650
+ if (width + EMOJI_WIDTH > truncationLimit) truncationIndex = Math.min(truncationIndex, index);
651
+ if (width + EMOJI_WIDTH > LIMIT) {
652
+ truncationEnabled = true;
997
653
  break;
998
654
  }
999
- c += g, C = h, w = o, o = h = dist_P.lastIndex;
655
+ width += EMOJI_WIDTH;
656
+ unmatchedStart = indexPrev;
657
+ unmatchedEnd = index;
658
+ index = indexPrev = EMOJI_RE.lastIndex;
1000
659
  continue;
1001
660
  }
1002
- o += 1;
661
+ index += 1;
1003
662
  }
1004
663
  return {
1005
- width: F ? b : c,
1006
- index: F ? d : p,
1007
- truncated: F,
1008
- ellipsed: F && i >= n
664
+ width: truncationEnabled ? truncationLimit : width,
665
+ index: truncationEnabled ? truncationIndex : length,
666
+ truncated: truncationEnabled,
667
+ ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
1009
668
  };
1010
- }, pt = {
669
+ };
670
+ const dist = getStringTruncatedWidth;
671
+ const dist_NO_TRUNCATION = {
1011
672
  limit: 1 / 0,
1012
- ellipsis: "",
673
+ ellipsis: '',
1013
674
  ellipsisWidth: 0
1014
- }, 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)=>{
1015
- if (t >= 30 && t <= 37 || t >= 90 && t <= 97) return 39;
1016
- if (t >= 40 && t <= 47 || t >= 100 && t <= 107) return 49;
1017
- if (1 === t || 2 === t) return 22;
1018
- if (3 === t) return 23;
1019
- if (4 === t) return 24;
1020
- if (7 === t) return 27;
1021
- if (8 === t) return 28;
1022
- if (9 === t) return 29;
1023
- if (0 === t) return 0;
1024
- }, 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)=>{
1025
- const i = e[Symbol.iterator]();
1026
- 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;
1027
- for(; !l.done;){
1028
- const m = l.value, A = dist_S(m);
1029
- 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;
1030
- }
1031
- u = t.at(-1), !a && void 0 !== u && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
1032
- }, vt = (t)=>{
1033
- const e = t.split(" ");
1034
- let s = e.length;
1035
- for(; s > 0 && !(dist_S(e[s - 1]) > 0);)s--;
1036
- return s === e.length ? t : e.slice(0, s).join(" ") + e.slice(s).join("");
1037
- }, Et = (t, e, s = {})=>{
1038
- if (!1 !== s.trim && "" === t.trim()) return "";
1039
- let i = "", r, n;
1040
- const u = t.split(" "), a = gt(u);
1041
- let l = [
1042
- ""
675
+ };
676
+ const fastStringWidth = (input, options = {})=>dist(input, dist_NO_TRUNCATION, options).width;
677
+ const fast_string_width_dist = fastStringWidth;
678
+ const ESC = '\x1B';
679
+ const CSI = '\x9B';
680
+ const END_CODE = 39;
681
+ const ANSI_ESCAPE_BELL = '\u0007';
682
+ const ANSI_CSI = '[';
683
+ const ANSI_OSC = ']';
684
+ const ANSI_SGR_TERMINATOR = 'm';
685
+ const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
686
+ const GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, 'y');
687
+ const getClosingCode = (openingCode)=>{
688
+ if (openingCode >= 30 && openingCode <= 37) return 39;
689
+ if (openingCode >= 90 && openingCode <= 97) return 39;
690
+ if (openingCode >= 40 && openingCode <= 47) return 49;
691
+ if (openingCode >= 100 && openingCode <= 107) return 49;
692
+ if (1 === openingCode || 2 === openingCode) return 22;
693
+ if (3 === openingCode) return 23;
694
+ if (4 === openingCode) return 24;
695
+ if (7 === openingCode) return 27;
696
+ if (8 === openingCode) return 28;
697
+ if (9 === openingCode) return 29;
698
+ if (0 === openingCode) return 0;
699
+ };
700
+ const wrapAnsiCode = (code)=>`${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
701
+ const wrapAnsiHyperlink = (url)=>`${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
702
+ const wrapWord = (rows, word, columns)=>{
703
+ const characters = word[Symbol.iterator]();
704
+ let isInsideEscape = false;
705
+ let isInsideLinkEscape = false;
706
+ let lastRow = rows.at(-1);
707
+ let visible = void 0 === lastRow ? 0 : fast_string_width_dist(lastRow);
708
+ let currentCharacter = characters.next();
709
+ let nextCharacter = characters.next();
710
+ let rawCharacterIndex = 0;
711
+ while(!currentCharacter.done){
712
+ const character = currentCharacter.value;
713
+ const characterLength = fast_string_width_dist(character);
714
+ if (visible + characterLength <= columns) rows[rows.length - 1] += character;
715
+ else {
716
+ rows.push(character);
717
+ visible = 0;
718
+ }
719
+ if (character === ESC || character === CSI) {
720
+ isInsideEscape = true;
721
+ isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
722
+ }
723
+ if (isInsideEscape) {
724
+ if (isInsideLinkEscape) {
725
+ if (character === ANSI_ESCAPE_BELL) {
726
+ isInsideEscape = false;
727
+ isInsideLinkEscape = false;
728
+ }
729
+ } else if (character === ANSI_SGR_TERMINATOR) isInsideEscape = false;
730
+ } else {
731
+ visible += characterLength;
732
+ if (visible === columns && !nextCharacter.done) {
733
+ rows.push('');
734
+ visible = 0;
735
+ }
736
+ }
737
+ currentCharacter = nextCharacter;
738
+ nextCharacter = characters.next();
739
+ rawCharacterIndex += character.length;
740
+ }
741
+ lastRow = rows.at(-1);
742
+ if (!visible && void 0 !== lastRow && lastRow.length && rows.length > 1) rows[rows.length - 2] += rows.pop();
743
+ };
744
+ const stringVisibleTrimSpacesRight = (string)=>{
745
+ const words = string.split(' ');
746
+ let last = words.length;
747
+ while(last){
748
+ if (fast_string_width_dist(words[last - 1])) break;
749
+ last--;
750
+ }
751
+ if (last === words.length) return string;
752
+ return words.slice(0, last).join(' ') + words.slice(last).join('');
753
+ };
754
+ const exec = (string, columns, options = {})=>{
755
+ if (false !== options.trim && '' === string.trim()) return '';
756
+ let returnValue = '';
757
+ let escapeCode;
758
+ let escapeUrl;
759
+ const words = string.split(' ');
760
+ let rows = [
761
+ ''
1043
762
  ];
1044
- for (const [h, o] of u.entries()){
1045
- !1 !== s.trim && (l[l.length - 1] = (l.at(-1) ?? "").trimStart());
1046
- let p = dist_S(l.at(-1) ?? "");
1047
- 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) {
1048
- const v = e - p, F = 1 + Math.floor((a[h] - v - 1) / e);
1049
- Math.floor((a[h] - 1) / e) < F && l.push(""), dist_G(l, o, e);
763
+ let rowLength = 0;
764
+ for(let index = 0; index < words.length; index++){
765
+ const word = words[index];
766
+ if (false !== options.trim) {
767
+ const row = rows.at(-1) ?? '';
768
+ const trimmed = row.trimStart();
769
+ if (row.length !== trimmed.length) {
770
+ rows[rows.length - 1] = trimmed;
771
+ rowLength = fast_string_width_dist(trimmed);
772
+ }
773
+ }
774
+ if (0 !== index) {
775
+ if (rowLength >= columns && (false === options.wordWrap || false === options.trim)) {
776
+ rows.push('');
777
+ rowLength = 0;
778
+ }
779
+ if (rowLength || false === options.trim) {
780
+ rows[rows.length - 1] += ' ';
781
+ rowLength++;
782
+ }
783
+ }
784
+ const wordLength = fast_string_width_dist(word);
785
+ if (options.hard && wordLength > columns) {
786
+ const remainingColumns = columns - rowLength;
787
+ const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
788
+ const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
789
+ if (breaksStartingNextLine < breaksStartingThisLine) rows.push('');
790
+ wrapWord(rows, word, columns);
791
+ rowLength = fast_string_width_dist(rows.at(-1) ?? '');
1050
792
  continue;
1051
793
  }
1052
- if (p + a[h] > e && p > 0 && a[h] > 0) {
1053
- if (!1 === s.wordWrap && p < e) {
1054
- dist_G(l, o, e);
794
+ if (rowLength + wordLength > columns && rowLength && wordLength) {
795
+ if (false === options.wordWrap && rowLength < columns) {
796
+ wrapWord(rows, word, columns);
797
+ rowLength = fast_string_width_dist(rows.at(-1) ?? '');
1055
798
  continue;
1056
799
  }
1057
- l.push("");
800
+ rows.push('');
801
+ rowLength = 0;
1058
802
  }
1059
- if (p + a[h] > e && !1 === s.wordWrap) {
1060
- dist_G(l, o, e);
803
+ if (rowLength + wordLength > columns && false === options.wordWrap) {
804
+ wrapWord(rows, word, columns);
805
+ rowLength = fast_string_width_dist(rows.at(-1) ?? '');
1061
806
  continue;
1062
807
  }
1063
- l[l.length - 1] += o;
1064
- }
1065
- !1 !== s.trim && (l = l.map((h)=>vt(h)));
1066
- const E = l.join(`
1067
- `), g = E[Symbol.iterator]();
1068
- let m = g.next(), A = g.next(), V = 0;
1069
- for(; !m.done;){
1070
- const h = m.value, o = A.value;
1071
- if (i += h, h === dist_T || h === dist_Z) {
1072
- dist_et.lastIndex = V + 1;
1073
- const F = dist_et.exec(E)?.groups;
1074
- if (F?.code !== void 0) {
1075
- const d = Number.parseFloat(F.code);
1076
- r = d === Ft ? void 0 : d;
1077
- } else F?.uri !== void 0 && (n = 0 === F.uri.length ? void 0 : F.uri);
1078
- }
1079
- const p = r ? mt(r) : void 0;
1080
- o === `
1081
- ` ? (n && (i += dist_it("")), r && p && (i += dist_st(p))) : h === `
1082
- ` && (r && p && (i += dist_st(r)), n && (i += dist_it(n))), V += h.length, m = A, A = g.next();
1083
- }
1084
- return i;
808
+ rows[rows.length - 1] += word;
809
+ rowLength += wordLength;
810
+ }
811
+ if (false !== options.trim) rows = rows.map((row)=>stringVisibleTrimSpacesRight(row));
812
+ const preString = rows.join('\n');
813
+ let inSurrogate = false;
814
+ for(let i = 0; i < preString.length; i++){
815
+ const character = preString[i];
816
+ returnValue += character;
817
+ if (!inSurrogate) {
818
+ inSurrogate = character >= '\ud800' && character <= '\udbff';
819
+ if (character === ESC || character === CSI) {
820
+ GROUP_REGEX.lastIndex = i + 1;
821
+ const groupsResult = GROUP_REGEX.exec(preString);
822
+ const groups = groupsResult?.groups;
823
+ if (groups?.code !== void 0) {
824
+ const code = Number.parseFloat(groups.code);
825
+ escapeCode = code === END_CODE ? void 0 : code;
826
+ } else if (groups?.uri !== void 0) escapeUrl = 0 === groups.uri.length ? void 0 : groups.uri;
827
+ }
828
+ if ('\n' === preString[i + 1]) {
829
+ if (escapeUrl) returnValue += wrapAnsiHyperlink('');
830
+ const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
831
+ if (escapeCode && closingCode) returnValue += wrapAnsiCode(closingCode);
832
+ } else if ('\n' === character) {
833
+ if (escapeCode && getClosingCode(escapeCode)) returnValue += wrapAnsiCode(escapeCode);
834
+ if (escapeUrl) returnValue += wrapAnsiHyperlink(escapeUrl);
835
+ }
836
+ }
837
+ }
838
+ return returnValue;
1085
839
  };
1086
- function K(t, e, s) {
1087
- return String(t).normalize().replaceAll(`\r
1088
- `, `
1089
- `).split(`
1090
- `).map((i)=>Et(i, e, s)).join(`
1091
- `);
840
+ const CRLF_OR_LF = /\r?\n/;
841
+ function wrapAnsi(string, columns, options) {
842
+ return String(string).normalize().split(CRLF_OR_LF).map((line)=>exec(line, columns, options)).join('\n');
843
+ }
844
+ const src = __webpack_require__("./node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js");
845
+ function dist_d(r, t, e) {
846
+ if (!e.some((o)=>!o.disabled)) return r;
847
+ const s = r + t, i = Math.max(e.length - 1, 0), n = s < 0 ? i : s > i ? 0 : s;
848
+ return e[n].disabled ? dist_d(n, t < 0 ? -1 : 1, e) : n;
1092
849
  }
1093
- const At = [
850
+ const E = [
1094
851
  "up",
1095
852
  "down",
1096
853
  "left",
@@ -1098,8 +855,21 @@ const At = [
1098
855
  "space",
1099
856
  "enter",
1100
857
  "cancel"
1101
- ], dist_ = {
1102
- actions: new Set(At),
858
+ ], dist_G = [
859
+ "January",
860
+ "February",
861
+ "March",
862
+ "April",
863
+ "May",
864
+ "June",
865
+ "July",
866
+ "August",
867
+ "September",
868
+ "October",
869
+ "November",
870
+ "December"
871
+ ], dist_u = {
872
+ actions: new Set(E),
1103
873
  aliases: new Map([
1104
874
  [
1105
875
  "k",
@@ -1130,46 +900,58 @@ const At = [
1130
900
  cancel: "Canceled",
1131
901
  error: "Something went wrong"
1132
902
  },
1133
- withGuide: !0
903
+ withGuide: !0,
904
+ date: {
905
+ monthNames: [
906
+ ...dist_G
907
+ ],
908
+ messages: {
909
+ required: "Please enter a valid date",
910
+ invalidMonth: "There are only 12 months in a year",
911
+ invalidDay: (r, t)=>`There are only ${r} days in ${t}`,
912
+ afterMin: (r)=>`Date must be on or after ${r.toISOString().slice(0, 10)}`,
913
+ beforeMax: (r)=>`Date must be on or before ${r.toISOString().slice(0, 10)}`
914
+ }
915
+ }
1134
916
  };
1135
- function H(t, e) {
1136
- if ("string" == typeof t) return dist_.aliases.get(t) === e;
1137
- for (const s of t)if (void 0 !== s && H(s, e)) return !0;
917
+ function V(r, t) {
918
+ if ("string" == typeof r) return dist_u.aliases.get(r) === t;
919
+ for (const e of r)if (void 0 !== e && V(e, t)) return !0;
1138
920
  return !1;
1139
921
  }
1140
- function _t(t, e) {
1141
- if (t === e) return;
1142
- const s = t.split(`
1143
- `), i = e.split(`
1144
- `), r = Math.max(s.length, i.length), n = [];
1145
- for(let u = 0; u < r; u++)s[u] !== i[u] && n.push(u);
922
+ function dist_j(r, t) {
923
+ if (r === t) return;
924
+ const e = r.split(`
925
+ `), s = t.split(`
926
+ `), i = Math.max(e.length, s.length), n = [];
927
+ for(let o = 0; o < i; o++)e[o] !== s[o] && n.push(o);
1146
928
  return {
1147
929
  lines: n,
1148
- numLinesBefore: s.length,
1149
- numLinesAfter: i.length,
1150
- numLines: r
930
+ numLinesBefore: e.length,
931
+ numLinesAfter: s.length,
932
+ numLines: i
1151
933
  };
1152
934
  }
1153
935
  globalThis.process.platform.startsWith("win");
1154
- const z = Symbol("clack:cancel");
1155
- function Ct(t) {
1156
- return t === z;
936
+ const dist_C = Symbol("clack:cancel");
937
+ function dist_q(r) {
938
+ return r === dist_C;
1157
939
  }
1158
- function W(t, e) {
1159
- const s = t;
1160
- s.isTTY && s.setRawMode(e);
940
+ function w(r, t) {
941
+ const e = r;
942
+ e.isTTY && e.setRawMode(t);
1161
943
  }
1162
- 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;
1163
- function Bt(t, e, s, i = s) {
1164
- const r = dist_rt(t ?? stdout);
1165
- return K(e, r - s.length, {
944
+ 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;
945
+ function dist_R(r, t, e, s = e) {
946
+ const i = O(r ?? stdout);
947
+ return wrapAnsi(t, i - e.length, {
1166
948
  hard: !0,
1167
949
  trim: !1
1168
950
  }).split(`
1169
- `).map((n, u)=>`${0 === u ? i : s}${n}`).join(`
951
+ `).map((n, o)=>`${0 === o ? s : e}${n}`).join(`
1170
952
  `);
1171
953
  }
1172
- class dist_B {
954
+ let dist_p = class {
1173
955
  input;
1174
956
  output;
1175
957
  _abortSignal;
@@ -1184,37 +966,37 @@ class dist_B {
1184
966
  error = "";
1185
967
  value;
1186
968
  userInput = "";
1187
- constructor(e, s = !0){
1188
- const { input: i = stdin, output: r = stdout, render: n, signal: u, ...a } = e;
1189
- 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;
969
+ constructor(t, e = !0){
970
+ const { input: s = stdin, output: i = stdout, render: n, signal: o, ...a } = t;
971
+ 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;
1190
972
  }
1191
973
  unsubscribe() {
1192
974
  this._subscribers.clear();
1193
975
  }
1194
- setSubscriber(e, s) {
1195
- const i = this._subscribers.get(e) ?? [];
1196
- i.push(s), this._subscribers.set(e, i);
976
+ setSubscriber(t, e) {
977
+ const s = this._subscribers.get(t) ?? [];
978
+ s.push(e), this._subscribers.set(t, s);
1197
979
  }
1198
- on(e, s) {
1199
- this.setSubscriber(e, {
1200
- cb: s
980
+ on(t, e) {
981
+ this.setSubscriber(t, {
982
+ cb: e
1201
983
  });
1202
984
  }
1203
- once(e, s) {
1204
- this.setSubscriber(e, {
1205
- cb: s,
985
+ once(t, e) {
986
+ this.setSubscriber(t, {
987
+ cb: e,
1206
988
  once: !0
1207
989
  });
1208
990
  }
1209
- emit(e, ...s) {
1210
- const i = this._subscribers.get(e) ?? [], r = [];
1211
- for (const n of i)n.cb(...s), n.once && r.push(()=>i.splice(i.indexOf(n), 1));
1212
- for (const n of r)n();
991
+ emit(t, ...e) {
992
+ const s = this._subscribers.get(t) ?? [], i = [];
993
+ for (const n of s)n.cb(...e), n.once && i.push(()=>s.splice(s.indexOf(n), 1));
994
+ for (const n of i)n();
1213
995
  }
1214
996
  prompt() {
1215
- return new Promise((e)=>{
997
+ return new Promise((t)=>{
1216
998
  if (this._abortSignal) {
1217
- if (this._abortSignal.aborted) return this.state = "cancel", this.close(), e(z);
999
+ if (this._abortSignal.aborted) return this.state = "cancel", this.close(), t(dist_C);
1218
1000
  this._abortSignal.addEventListener("abort", ()=>{
1219
1001
  this.state = "cancel", this.close();
1220
1002
  }, {
@@ -1227,21 +1009,21 @@ class dist_B {
1227
1009
  prompt: "",
1228
1010
  escapeCodeTimeout: 50,
1229
1011
  terminal: !0
1230
- }), 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", ()=>{
1231
- this.output.write(src.cursor.show), this.output.off("resize", this.render), W(this.input, !1), e(this.value);
1012
+ }), 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", ()=>{
1013
+ this.output.write(src.cursor.show), this.output.off("resize", this.render), w(this.input, !1), t(this.value);
1232
1014
  }), this.once("cancel", ()=>{
1233
- this.output.write(src.cursor.show), this.output.off("resize", this.render), W(this.input, !1), e(z);
1015
+ this.output.write(src.cursor.show), this.output.off("resize", this.render), w(this.input, !1), t(dist_C);
1234
1016
  });
1235
1017
  });
1236
1018
  }
1237
- _isActionKey(e, s) {
1238
- return " " === e;
1019
+ _isActionKey(t, e) {
1020
+ return " " === t;
1239
1021
  }
1240
- _setValue(e) {
1241
- this.value = e, this.emit("value", this.value);
1022
+ _setValue(t) {
1023
+ this.value = t, this.emit("value", this.value);
1242
1024
  }
1243
- _setUserInput(e, s) {
1244
- this.userInput = e ?? "", this.emit("userInput", this.userInput), s && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
1025
+ _setUserInput(t, e) {
1026
+ this.userInput = t ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
1245
1027
  }
1246
1028
  _clearUserInput() {
1247
1029
  this.rl?.write(null, {
@@ -1249,121 +1031,280 @@ class dist_B {
1249
1031
  name: "u"
1250
1032
  }), this._setUserInput("");
1251
1033
  }
1252
- onKeypress(e, s) {
1253
- if (this._track && "return" !== s.name && (s.name && this._isActionKey(e, s) && this.rl?.write(null, {
1034
+ onKeypress(t, e) {
1035
+ if (this._track && "return" !== e.name && (e.name && this._isActionKey(t, e) && this.rl?.write(null, {
1254
1036
  ctrl: !0,
1255
1037
  name: "h"
1256
- }), 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") {
1038
+ }), 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") {
1257
1039
  if (this.opts.validate) {
1258
- const i = this.opts.validate(this.value);
1259
- i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput));
1040
+ const s = this.opts.validate(this.value);
1041
+ s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
1260
1042
  }
1261
1043
  "error" !== this.state && (this.state = "submit");
1262
1044
  }
1263
- H([
1264
- e,
1265
- s?.name,
1266
- s?.sequence
1045
+ V([
1046
+ t,
1047
+ e?.name,
1048
+ e?.sequence
1267
1049
  ], "cancel") && (this.state = "cancel"), ("submit" === this.state || "cancel" === this.state) && this.emit("finalize"), this.render(), ("submit" === this.state || "cancel" === this.state) && this.close();
1268
1050
  }
1269
1051
  close() {
1270
1052
  this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
1271
- `), W(this.input, !1), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
1053
+ `), w(this.input, !1), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
1272
1054
  }
1273
1055
  restoreCursor() {
1274
- const e = K(this._prevFrame, process.stdout.columns, {
1056
+ const t = wrapAnsi(this._prevFrame, process.stdout.columns, {
1275
1057
  hard: !0,
1276
1058
  trim: !1
1277
1059
  }).split(`
1278
1060
  `).length - 1;
1279
- this.output.write(src.cursor.move(-999, -1 * e));
1061
+ this.output.write(src.cursor.move(-999, -1 * t));
1280
1062
  }
1281
1063
  render() {
1282
- const e = K(this._render(this) ?? "", process.stdout.columns, {
1064
+ const t = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
1283
1065
  hard: !0,
1284
1066
  trim: !1
1285
1067
  });
1286
- if (e !== this._prevFrame) {
1068
+ if (t !== this._prevFrame) {
1287
1069
  if ("initial" === this.state) this.output.write(src.cursor.hide);
1288
1070
  else {
1289
- const s = _t(this._prevFrame, e), i = nt(this.output);
1290
- if (this.restoreCursor(), s) {
1291
- const r = Math.max(0, s.numLinesAfter - i), n = Math.max(0, s.numLinesBefore - i);
1292
- let u = s.lines.find((a)=>a >= r);
1293
- if (void 0 === u) {
1294
- this._prevFrame = e;
1071
+ const e = dist_j(this._prevFrame, t), s = dist_A(this.output);
1072
+ if (this.restoreCursor(), e) {
1073
+ const i = Math.max(0, e.numLinesAfter - s), n = Math.max(0, e.numLinesBefore - s);
1074
+ let o = e.lines.find((a)=>a >= i);
1075
+ if (void 0 === o) {
1076
+ this._prevFrame = t;
1295
1077
  return;
1296
1078
  }
1297
- if (1 === s.lines.length) {
1298
- this.output.write(src.cursor.move(0, u - n)), this.output.write(src.erase.lines(1));
1299
- const a = e.split(`
1079
+ if (1 === e.lines.length) {
1080
+ this.output.write(src.cursor.move(0, o - n)), this.output.write(src.erase.lines(1));
1081
+ const a = t.split(`
1300
1082
  `);
1301
- this.output.write(a[u]), this._prevFrame = e, this.output.write(src.cursor.move(0, a.length - u - 1));
1083
+ this.output.write(a[o]), this._prevFrame = t, this.output.write(src.cursor.move(0, a.length - o - 1));
1302
1084
  return;
1303
1085
  }
1304
- if (s.lines.length > 1) {
1305
- if (r < n) u = r;
1086
+ if (e.lines.length > 1) {
1087
+ if (i < n) o = i;
1306
1088
  else {
1307
- const l = u - n;
1308
- l > 0 && this.output.write(src.cursor.move(0, l));
1089
+ const h = o - n;
1090
+ h > 0 && this.output.write(src.cursor.move(0, h));
1309
1091
  }
1310
1092
  this.output.write(src.erase.down());
1311
- const a = e.split(`
1312
- `).slice(u);
1093
+ const a = t.split(`
1094
+ `).slice(o);
1313
1095
  this.output.write(a.join(`
1314
- `)), this._prevFrame = e;
1096
+ `)), this._prevFrame = t;
1315
1097
  return;
1316
1098
  }
1317
1099
  }
1318
1100
  this.output.write(src.erase.down());
1319
1101
  }
1320
- this.output.write(e), "initial" === this.state && (this.state = "active"), this._prevFrame = e;
1102
+ this.output.write(t), "initial" === this.state && (this.state = "active"), this._prevFrame = t;
1321
1103
  }
1322
1104
  }
1105
+ };
1106
+ function dist_W(r, t) {
1107
+ if (void 0 === r || 0 === t.length) return 0;
1108
+ const e = t.findIndex((s)=>s.value === r);
1109
+ return -1 !== e ? e : 0;
1323
1110
  }
1324
- let Lt = class extends dist_B {
1111
+ function dist_B(r, t) {
1112
+ return (t.label ?? String(t.value)).toLowerCase().includes(r.toLowerCase());
1113
+ }
1114
+ function J(r, t) {
1115
+ if (t) return r ? t : t[0];
1116
+ }
1117
+ let H = class extends dist_p {
1118
+ filteredOptions;
1119
+ multiple;
1120
+ isNavigating = !1;
1121
+ selectedValues = [];
1122
+ focusedValue;
1123
+ #e = 0;
1124
+ #o = "";
1125
+ #t;
1126
+ #n;
1127
+ #a;
1128
+ get cursor() {
1129
+ return this.#e;
1130
+ }
1131
+ get userInputWithCursor() {
1132
+ if (!this.userInput) return styleText([
1133
+ "inverse",
1134
+ "hidden"
1135
+ ], "_");
1136
+ if (this._cursor >= this.userInput.length) return `${this.userInput}\u2588`;
1137
+ const t = this.userInput.slice(0, this._cursor), [e, ...s] = this.userInput.slice(this._cursor);
1138
+ return `${t}${styleText("inverse", e)}${s.join("")}`;
1139
+ }
1140
+ get options() {
1141
+ return "function" == typeof this.#n ? this.#n() : this.#n;
1142
+ }
1143
+ constructor(t){
1144
+ super(t), this.#n = t.options, this.#a = t.placeholder;
1145
+ const e = this.options;
1146
+ this.filteredOptions = [
1147
+ ...e
1148
+ ], this.multiple = !0 === t.multiple, this.#t = "function" == typeof t.options ? t.filter : t.filter ?? dist_B;
1149
+ let s;
1150
+ 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 = [
1151
+ this.options[0].value
1152
+ ]), s) for (const i of s){
1153
+ const n = e.findIndex((o)=>o.value === i);
1154
+ -1 !== n && (this.toggleSelected(i), this.#e = n);
1155
+ }
1156
+ this.focusedValue = this.options[this.#e]?.value, this.on("key", (i, n)=>this.#s(i, n)), this.on("userInput", (i)=>this.#i(i));
1157
+ }
1158
+ _isActionKey(t, e) {
1159
+ return " " === t || this.multiple && this.isNavigating && "space" === e.name && void 0 !== t && "" !== t;
1160
+ }
1161
+ #s(t, e) {
1162
+ 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));
1163
+ if ("tab" === e.name && o && l) {
1164
+ " " === this.userInput && this._clearUserInput(), this._setUserInput(a, !0), this.isNavigating = !1;
1165
+ return;
1166
+ }
1167
+ s || i ? (this.#e = dist_d(this.#e, s ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#e]?.value, this.multiple || (this.selectedValues = [
1168
+ this.focusedValue
1169
+ ]), 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 = [
1170
+ this.focusedValue
1171
+ ]), this.isNavigating = !1);
1172
+ }
1173
+ deselectAll() {
1174
+ this.selectedValues = [];
1175
+ }
1176
+ toggleSelected(t) {
1177
+ 0 !== this.filteredOptions.length && (this.multiple ? this.selectedValues.includes(t) ? this.selectedValues = this.selectedValues.filter((e)=>e !== t) : this.selectedValues = [
1178
+ ...this.selectedValues,
1179
+ t
1180
+ ] : this.selectedValues = [
1181
+ t
1182
+ ]);
1183
+ }
1184
+ #i(t) {
1185
+ if (t !== this.#o) {
1186
+ this.#o = t;
1187
+ const e = this.options;
1188
+ t && this.#t ? this.filteredOptions = e.filter((n)=>this.#t?.(t, n)) : this.filteredOptions = [
1189
+ ...e
1190
+ ];
1191
+ const s = dist_W(this.focusedValue, this.filteredOptions);
1192
+ this.#e = dist_d(s, 0, this.filteredOptions);
1193
+ const i = this.filteredOptions[this.#e];
1194
+ i && !i.disabled ? this.focusedValue = i.value : this.focusedValue = void 0, this.multiple || (void 0 !== this.focusedValue ? this.toggleSelected(this.focusedValue) : this.deselectAll());
1195
+ }
1196
+ }
1197
+ };
1198
+ class st extends dist_p {
1199
+ options;
1200
+ cursor = 0;
1201
+ #e;
1202
+ getGroupItems(t) {
1203
+ return this.options.filter((e)=>e.group === t);
1204
+ }
1205
+ isGroupSelected(t) {
1206
+ const e = this.getGroupItems(t), s = this.value;
1207
+ return void 0 === s ? !1 : e.every((i)=>s.includes(i.value));
1208
+ }
1209
+ toggleValue() {
1210
+ const t = this.options[this.cursor];
1211
+ if (void 0 === this.value && (this.value = []), !0 === t.group) {
1212
+ const e = t.value, s = this.getGroupItems(e);
1213
+ this.isGroupSelected(e) ? this.value = this.value.filter((i)=>-1 === s.findIndex((n)=>n.value === i)) : this.value = [
1214
+ ...this.value,
1215
+ ...s.map((i)=>i.value)
1216
+ ], this.value = Array.from(new Set(this.value));
1217
+ } else {
1218
+ const e = this.value.includes(t.value);
1219
+ this.value = e ? this.value.filter((s)=>s !== t.value) : [
1220
+ ...this.value,
1221
+ t.value
1222
+ ];
1223
+ }
1224
+ }
1225
+ constructor(t){
1226
+ super(t, !1);
1227
+ const { options: e } = t;
1228
+ this.#e = !1 !== t.selectableGroups, this.options = Object.entries(e).flatMap(([s, i])=>[
1229
+ {
1230
+ value: s,
1231
+ group: !0,
1232
+ label: s
1233
+ },
1234
+ ...i.map((n)=>({
1235
+ ...n,
1236
+ group: s
1237
+ }))
1238
+ ]), this.value = [
1239
+ ...t.initialValues ?? []
1240
+ ], this.cursor = Math.max(this.options.findIndex(({ value: s })=>s === t.cursorAt), this.#e ? 0 : 1), this.on("cursor", (s)=>{
1241
+ switch(s){
1242
+ case "left":
1243
+ case "up":
1244
+ {
1245
+ this.cursor = 0 === this.cursor ? this.options.length - 1 : this.cursor - 1;
1246
+ const i = this.options[this.cursor]?.group === !0;
1247
+ !this.#e && i && (this.cursor = 0 === this.cursor ? this.options.length - 1 : this.cursor - 1);
1248
+ break;
1249
+ }
1250
+ case "down":
1251
+ case "right":
1252
+ {
1253
+ this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
1254
+ const i = this.options[this.cursor]?.group === !0;
1255
+ !this.#e && i && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
1256
+ break;
1257
+ }
1258
+ case "space":
1259
+ this.toggleValue();
1260
+ break;
1261
+ }
1262
+ });
1263
+ }
1264
+ }
1265
+ let it = class extends dist_p {
1325
1266
  options;
1326
1267
  cursor = 0;
1327
1268
  get _value() {
1328
1269
  return this.options[this.cursor].value;
1329
1270
  }
1330
1271
  get _enabledOptions() {
1331
- return this.options.filter((e)=>!0 !== e.disabled);
1272
+ return this.options.filter((t)=>!0 !== t.disabled);
1332
1273
  }
1333
1274
  toggleAll() {
1334
- const e = this._enabledOptions, s = void 0 !== this.value && this.value.length === e.length;
1335
- this.value = s ? [] : e.map((i)=>i.value);
1275
+ const t = this._enabledOptions, e = void 0 !== this.value && this.value.length === t.length;
1276
+ this.value = e ? [] : t.map((s)=>s.value);
1336
1277
  }
1337
1278
  toggleInvert() {
1338
- const e = this.value;
1339
- if (!e) return;
1340
- const s = this._enabledOptions.filter((i)=>!e.includes(i.value));
1341
- this.value = s.map((i)=>i.value);
1279
+ const t = this.value;
1280
+ if (!t) return;
1281
+ const e = this._enabledOptions.filter((s)=>!t.includes(s.value));
1282
+ this.value = e.map((s)=>s.value);
1342
1283
  }
1343
1284
  toggleValue() {
1344
1285
  void 0 === this.value && (this.value = []);
1345
- const e = this.value.includes(this._value);
1346
- this.value = e ? this.value.filter((s)=>s !== this._value) : [
1286
+ const t = this.value.includes(this._value);
1287
+ this.value = t ? this.value.filter((e)=>e !== this._value) : [
1347
1288
  ...this.value,
1348
1289
  this._value
1349
1290
  ];
1350
1291
  }
1351
- constructor(e){
1352
- super(e, !1), this.options = e.options, this.value = [
1353
- ...e.initialValues ?? []
1292
+ constructor(t){
1293
+ super(t, !1), this.options = t.options, this.value = [
1294
+ ...t.initialValues ?? []
1354
1295
  ];
1355
- const s = Math.max(this.options.findIndex(({ value: i })=>i === e.cursorAt), 0);
1356
- this.cursor = this.options[s].disabled ? x(s, 1, this.options) : s, this.on("key", (i)=>{
1357
- "a" === i && this.toggleAll(), "i" === i && this.toggleInvert();
1358
- }), this.on("cursor", (i)=>{
1359
- switch(i){
1296
+ const e = Math.max(this.options.findIndex(({ value: s })=>s === t.cursorAt), 0);
1297
+ this.cursor = this.options[e].disabled ? dist_d(e, 1, this.options) : e, this.on("key", (s)=>{
1298
+ "a" === s && this.toggleAll(), "i" === s && this.toggleInvert();
1299
+ }), this.on("cursor", (s)=>{
1300
+ switch(s){
1360
1301
  case "left":
1361
1302
  case "up":
1362
- this.cursor = x(this.cursor, -1, this.options);
1303
+ this.cursor = dist_d(this.cursor, -1, this.options);
1363
1304
  break;
1364
1305
  case "down":
1365
1306
  case "right":
1366
- this.cursor = x(this.cursor, 1, this.options);
1307
+ this.cursor = dist_d(this.cursor, 1, this.options);
1367
1308
  break;
1368
1309
  case "space":
1369
1310
  this.toggleValue();
@@ -1372,7 +1313,7 @@ let Lt = class extends dist_B {
1372
1313
  });
1373
1314
  }
1374
1315
  };
1375
- class Tt extends dist_B {
1316
+ class nt extends dist_p {
1376
1317
  options;
1377
1318
  cursor = 0;
1378
1319
  get _selectedValue() {
@@ -1381,287 +1322,379 @@ class Tt extends dist_B {
1381
1322
  changeValue() {
1382
1323
  this.value = this._selectedValue.value;
1383
1324
  }
1384
- constructor(e){
1385
- super(e, !1), this.options = e.options;
1386
- const s = this.options.findIndex(({ value: r })=>r === e.initialValue), i = -1 === s ? 0 : s;
1387
- this.cursor = this.options[i].disabled ? x(i, 1, this.options) : i, this.changeValue(), this.on("cursor", (r)=>{
1388
- switch(r){
1325
+ constructor(t){
1326
+ super(t, !1), this.options = t.options;
1327
+ const e = this.options.findIndex(({ value: i })=>i === t.initialValue), s = -1 === e ? 0 : e;
1328
+ this.cursor = this.options[s].disabled ? dist_d(s, 1, this.options) : s, this.changeValue(), this.on("cursor", (i)=>{
1329
+ switch(i){
1389
1330
  case "left":
1390
1331
  case "up":
1391
- this.cursor = x(this.cursor, -1, this.options);
1332
+ this.cursor = dist_d(this.cursor, -1, this.options);
1392
1333
  break;
1393
1334
  case "down":
1394
1335
  case "right":
1395
- this.cursor = x(this.cursor, 1, this.options);
1336
+ this.cursor = dist_d(this.cursor, 1, this.options);
1396
1337
  break;
1397
1338
  }
1398
1339
  this.changeValue();
1399
1340
  });
1400
1341
  }
1401
1342
  }
1402
- class dist_$t extends dist_B {
1343
+ class at extends dist_p {
1403
1344
  get userInputWithCursor() {
1404
1345
  if ("submit" === this.state) return this.userInput;
1405
- const e = this.userInput;
1406
- if (this.cursor >= e.length) return `${this.userInput}\u2588`;
1407
- const s = e.slice(0, this.cursor), [i, ...r] = e.slice(this.cursor);
1408
- return `${s}${styleText("inverse", i)}${r.join("")}`;
1346
+ const t = this.userInput;
1347
+ if (this.cursor >= t.length) return `${this.userInput}\u2588`;
1348
+ const e = t.slice(0, this.cursor), [s, ...i] = t.slice(this.cursor);
1349
+ return `${e}${styleText("inverse", s)}${i.join("")}`;
1409
1350
  }
1410
1351
  get cursor() {
1411
1352
  return this._cursor;
1412
1353
  }
1413
- constructor(e){
1354
+ constructor(t){
1414
1355
  super({
1415
- ...e,
1416
- initialUserInput: e.initialUserInput ?? e.initialValue
1417
- }), this.on("userInput", (s)=>{
1418
- this._setValue(s);
1356
+ ...t,
1357
+ initialUserInput: t.initialUserInput ?? t.initialValue
1358
+ }), this.on("userInput", (e)=>{
1359
+ this._setValue(e);
1419
1360
  }), this.on("finalize", ()=>{
1420
- this.value || (this.value = e.defaultValue), void 0 === this.value && (this.value = "");
1361
+ this.value || (this.value = t.defaultValue), void 0 === this.value && (this.value = "");
1421
1362
  });
1422
1363
  }
1423
1364
  }
1424
- function dist_pt() {
1365
+ function Ze() {
1425
1366
  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;
1426
1367
  }
1427
- const ee = dist_pt(), dist_I = (e, r)=>ee ? e : r, Re = dist_I("\u25C6", "*"), $e = dist_I("\u25A0", "x"), de = dist_I("\u25B2", "x"), dist_V = dist_I("\u25C7", "o"), dist_h = (dist_I("\u250C", "T"), dist_I("\u2502", "|")), dist_x = dist_I("\u2514", "\u2014"), dist_z = (dist_I("\u2510", "T"), dist_I("\u2518", "\u2014"), dist_I("\u25CF", ">")), dist_H = dist_I("\u25CB", " "), te = dist_I("\u25FB", "[\u2022]"), dist_U = dist_I("\u25FC", "[+]"), dist_q = dist_I("\u25FB", "[ ]"), se = (dist_I("\u25AA", "\u2022"), dist_I("\u2500", "-")), pe = dist_I("\u256E", "+"), We = dist_I("\u251C", "+"), me = dist_I("\u256F", "+"), ge = dist_I("\u2570", "+"), dist_W = (dist_I("\u256D", "+"), dist_I("\u25CF", "\u2022"), dist_I("\u25C6", "*"), dist_I("\u25B2", "!"), dist_I("\u25A0", "x"), (e)=>{
1368
+ 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)=>{
1428
1369
  switch(e){
1429
1370
  case "initial":
1430
1371
  case "active":
1431
- return styleText("cyan", Re);
1372
+ return styleText("cyan", _e);
1432
1373
  case "cancel":
1433
- return styleText("red", $e);
1374
+ return styleText("red", oe);
1434
1375
  case "error":
1435
- return styleText("yellow", de);
1376
+ return styleText("yellow", ue);
1436
1377
  case "submit":
1437
- return styleText("green", dist_V);
1378
+ return styleText("green", dist_F);
1438
1379
  }
1439
- }), ve = (e)=>{
1380
+ }, ye = (e)=>{
1440
1381
  switch(e){
1441
1382
  case "initial":
1442
1383
  case "active":
1443
- return styleText("cyan", dist_h);
1384
+ return styleText("cyan", prompts_dist_d);
1444
1385
  case "cancel":
1445
- return styleText("red", dist_h);
1386
+ return styleText("red", prompts_dist_d);
1446
1387
  case "error":
1447
- return styleText("yellow", dist_h);
1388
+ return styleText("yellow", prompts_dist_d);
1448
1389
  case "submit":
1449
- return styleText("green", dist_h);
1450
- }
1451
- }, 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 = {
1452
- limit: 1 / 0,
1453
- ellipsis: ""
1454
- }, Le = (e, r = {}, s = {})=>{
1455
- 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;
1456
- 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;
1457
- e: for(;;){
1458
- if (b > A || m >= d && m > $) {
1459
- const T = e.slice(A, b) || e.slice($, m);
1460
- F = 0;
1461
- for (const M of T.replaceAll(dist_Ft, "")){
1462
- const O = M.codePointAt(0) || 0;
1463
- 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) {
1464
- y = !0;
1465
- break e;
1466
- }
1467
- F += M.length, w += S;
1468
- }
1469
- A = b = 0;
1470
- }
1471
- if (m >= d) break;
1472
- if (ne.lastIndex = m, ne.test(e)) {
1473
- if (F = ne.lastIndex - m, S = F * g, w + S > C && (v = Math.min(v, m + Math.floor((C - w) / g))), w + S > i) {
1474
- y = !0;
1475
- break;
1476
- }
1477
- w += S, A = $, b = m, m = $ = ne.lastIndex;
1478
- continue;
1479
- }
1480
- if (we.lastIndex = m, we.test(e)) {
1481
- if (w + u > C && (v = Math.min(v, m)), w + u > i) {
1482
- y = !0;
1483
- break;
1484
- }
1485
- w += u, A = $, b = m, m = $ = we.lastIndex;
1486
- continue;
1487
- }
1488
- if (re.lastIndex = m, re.test(e)) {
1489
- if (F = re.lastIndex - m, S = F * l, w + S > C && (v = Math.min(v, m + Math.floor((C - w) / l))), w + S > i) {
1490
- y = !0;
1491
- break;
1492
- }
1493
- w += S, A = $, b = m, m = $ = re.lastIndex;
1494
- continue;
1495
- }
1496
- if (ie.lastIndex = m, ie.test(e)) {
1497
- if (F = ie.lastIndex - m, S = F * n, w + S > C && (v = Math.min(v, m + Math.floor((C - w) / n))), w + S > i) {
1498
- y = !0;
1499
- break;
1500
- }
1501
- w += S, A = $, b = m, m = $ = ie.lastIndex;
1502
- continue;
1503
- }
1504
- if (Ae.lastIndex = m, Ae.test(e)) {
1505
- if (w + p > C && (v = Math.min(v, m)), w + p > i) {
1506
- y = !0;
1507
- break;
1508
- }
1509
- w += p, A = $, b = m, m = $ = Ae.lastIndex;
1510
- continue;
1511
- }
1512
- m += 1;
1390
+ return styleText("green", prompts_dist_d);
1513
1391
  }
1514
- return {
1515
- width: y ? C : w,
1516
- index: y ? v : d,
1517
- truncated: y,
1518
- ellipsed: y && i >= o
1519
- };
1520
- }, dist_Et = {
1521
- limit: 1 / 0,
1522
- ellipsis: "",
1523
- ellipsisWidth: 0
1524
- }, 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)=>{
1525
- if (e >= 30 && e <= 37 || e >= 90 && e <= 97) return 39;
1526
- if (e >= 40 && e <= 47 || e >= 100 && e <= 107) return 49;
1527
- if (1 === e || 2 === e) return 22;
1528
- if (3 === e) return 23;
1529
- if (4 === e) return 24;
1530
- if (7 === e) return 27;
1531
- if (8 === e) return 28;
1532
- if (9 === e) return 29;
1533
- if (0 === e) return 0;
1534
- }, Ue = (e)=>`${ae}${ke}${e}${Ve}`, Ke = (e)=>`${ae}${Se}${e}${Ce}`, dist_Ct = (e)=>e.map((r)=>D(r)), Ie = (e, r, s)=>{
1535
- const i = r[Symbol.iterator]();
1536
- let a = !1, o = !1, u = e.at(-1), l = void 0 === u ? 0 : D(u), n = i.next(), c = i.next(), p = 0;
1537
- for(; !n.done;){
1538
- const f = n.value, g = D(f);
1539
- 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;
1540
- }
1541
- u = e.at(-1), !l && void 0 !== u && u.length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
1542
- }, dist_St = (e)=>{
1543
- const r = e.split(" ");
1544
- let s = r.length;
1545
- for(; s > 0 && !(D(r[s - 1]) > 0);)s--;
1546
- return s === r.length ? e : r.slice(0, s).join(" ") + r.slice(s).join("");
1547
- }, dist_It = (e, r, s = {})=>{
1548
- if (!1 !== s.trim && "" === e.trim()) return "";
1549
- let i = "", a, o;
1550
- const u = e.split(" "), l = dist_Ct(u);
1551
- let n = [
1552
- ""
1553
- ];
1554
- for (const [$, m] of u.entries()){
1555
- !1 !== s.trim && (n[n.length - 1] = (n.at(-1) ?? "").trimStart());
1556
- let d = D(n.at(-1) ?? "");
1557
- 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) {
1558
- const F = r - d, y = 1 + Math.floor((l[$] - F - 1) / r);
1559
- Math.floor((l[$] - 1) / r) < y && n.push(""), Ie(n, m, r);
1560
- continue;
1561
- }
1562
- if (d + l[$] > r && d > 0 && l[$] > 0) {
1563
- if (!1 === s.wordWrap && d < r) {
1564
- Ie(n, m, r);
1565
- continue;
1566
- }
1567
- n.push("");
1568
- }
1569
- if (d + l[$] > r && !1 === s.wordWrap) {
1570
- Ie(n, m, r);
1571
- continue;
1572
- }
1573
- n[n.length - 1] += m;
1574
- }
1575
- !1 !== s.trim && (n = n.map(($)=>dist_St($)));
1576
- const c = n.join(`
1577
- `), p = c[Symbol.iterator]();
1578
- let f = p.next(), g = p.next(), E = 0;
1579
- for(; !f.done;){
1580
- const $ = f.value, m = g.value;
1581
- if (i += $, $ === ae || $ === je) {
1582
- He.lastIndex = E + 1;
1583
- const y = He.exec(c)?.groups;
1584
- if (y?.code !== void 0) {
1585
- const v = Number.parseFloat(y.code);
1586
- a = v === dist_vt ? void 0 : v;
1587
- } else y?.uri !== void 0 && (o = 0 === y.uri.length ? void 0 : y.uri);
1588
- }
1589
- const d = a ? dist_At(a) : void 0;
1590
- m === `
1591
- ` ? (o && (i += Ke("")), a && d && (i += Ue(d))) : $ === `
1592
- ` && (a && d && (i += Ue(a)), o && (i += Ke(o))), E += $.length, f = g, g = p.next();
1593
- }
1594
- return i;
1595
- };
1596
- function dist_J(e, r, s) {
1597
- return String(e).normalize().replaceAll(`\r
1598
- `, `
1599
- `).split(`
1600
- `).map((i)=>dist_It(i, r, s)).join(`
1601
- `);
1602
- }
1603
- const dist_bt = (e, r, s, i, a)=>{
1604
- let o = r, u = 0;
1605
- for(let l = s; l < i; l++){
1606
- const n = e[l];
1607
- if (o -= n.length, u++, o <= a) break;
1392
+ }, dist_et = (e, i, s, r, u)=>{
1393
+ let n = i, o = 0;
1394
+ for(let c = s; c < r; c++){
1395
+ const a = e[c];
1396
+ if (n -= a.length, o++, n <= u) break;
1608
1397
  }
1609
1398
  return {
1610
- lineCount: o,
1611
- removals: u
1399
+ lineCount: n,
1400
+ removals: o
1612
1401
  };
1613
- }, dist_X = ({ cursor: e, options: r, style: s, output: i = process.stdout, maxItems: a = 1 / 0, columnPadding: o = 0, rowPadding: u = 4 })=>{
1614
- 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);
1615
- let g = 0;
1616
- e >= f - 3 && (g = Math.max(Math.min(e - f + 3, r.length - f), 0));
1617
- let E = f < r.length && g > 0, $ = f < r.length && g + f < r.length;
1618
- const m = Math.min(g + f, r.length), d = [];
1619
- let F = 0;
1620
- E && F++, $ && F++;
1621
- const y = g + (E ? 1 : 0), v = m - ($ ? 1 : 0);
1622
- for(let A = y; A < v; A++){
1623
- const b = dist_J(s(r[A], A === e), l, {
1402
+ }, dist_Y = ({ cursor: e, options: i, style: s, output: r = process.stdout, maxItems: u = 1 / 0, columnPadding: n = 0, rowPadding: o = 4 })=>{
1403
+ const c = O(r) - n, a = dist_A(r), l = styleText("dim", "..."), $ = Math.max(a - o, 0), y = Math.max(Math.min(u, $), 5);
1404
+ let p = 0;
1405
+ e >= y - 3 && (p = Math.max(Math.min(e - y + 3, i.length - y), 0));
1406
+ let m = y < i.length && p > 0, g = y < i.length && p + y < i.length;
1407
+ const S = Math.min(p + y, i.length), h = [];
1408
+ let f = 0;
1409
+ m && f++, g && f++;
1410
+ const v = p + (m ? 1 : 0), T = S - (g ? 1 : 0);
1411
+ for(let b = v; b < T; b++){
1412
+ const x = wrapAnsi(s(i[b], b === e), c, {
1624
1413
  hard: !0,
1625
1414
  trim: !1
1626
1415
  }).split(`
1627
1416
  `);
1628
- d.push(b), F += b.length;
1417
+ h.push(x), f += x.length;
1629
1418
  }
1630
- if (F > p) {
1631
- let A = 0, b = 0, w = F;
1632
- const S = e - y, T = (M, O)=>dist_bt(d, w, M, O, p);
1633
- 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));
1419
+ if (f > $) {
1420
+ let b = 0, x = 0, G = f;
1421
+ const M = e - v, R = (j, D)=>dist_et(h, G, j, D, $);
1422
+ 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));
1634
1423
  }
1635
1424
  const C = [];
1636
- E && C.push(c);
1637
- for (const A of d)for (const b of A)C.push(b);
1638
- return $ && C.push(c), C;
1425
+ m && C.push(l);
1426
+ for (const b of h)for (const x of b)C.push(x);
1427
+ return g && C.push(l), C;
1639
1428
  };
1640
- const Nt = (e = "", r)=>{
1641
- const s = r?.output ?? process.stdout, i = r?.withGuide ?? dist_.withGuide ? `${styleText("gray", dist_x)} ` : "";
1642
- s.write(`${i}${styleText("red", e)}
1429
+ function Me(e) {
1430
+ return e.label ?? String(e.value ?? "");
1431
+ }
1432
+ function Re(e, i) {
1433
+ if (!e) return !0;
1434
+ const s = (i.label ?? String(i.value ?? "")).toLowerCase(), r = (i.hint ?? "").toLowerCase(), u = String(i.value).toLowerCase(), n = e.toLowerCase();
1435
+ return s.includes(n) || r.includes(n) || u.includes(n);
1436
+ }
1437
+ function dist_tt(e, i) {
1438
+ const s = [];
1439
+ for (const r of i)e.includes(r.value) && s.push(r);
1440
+ return s;
1441
+ }
1442
+ const Ae = (e)=>new H({
1443
+ options: e.options,
1444
+ initialValue: e.initialValue ? [
1445
+ e.initialValue
1446
+ ] : void 0,
1447
+ initialUserInput: e.initialUserInput,
1448
+ placeholder: e.placeholder,
1449
+ filter: e.filter ?? ((i, s)=>Re(i, s)),
1450
+ signal: e.signal,
1451
+ input: e.input,
1452
+ output: e.output,
1453
+ validate: e.validate,
1454
+ render () {
1455
+ const i = e.withGuide ?? dist_u.withGuide, s = i ? [
1456
+ `${styleText("gray", prompts_dist_d)}`,
1457
+ `${dist_V(this.state)} ${e.message}`
1458
+ ] : [
1459
+ `${dist_V(this.state)} ${e.message}`
1460
+ ], r = this.userInput, u = this.options, n = e.placeholder, o = "" === r && void 0 !== n, c = (a, l)=>{
1461
+ const $ = Me(a), y = a.hint && a.value === this.focusedValue ? styleText("dim", ` (${a.hint})`) : "";
1462
+ switch(l){
1463
+ case "active":
1464
+ return `${styleText("green", dist_z)} ${$}${y}`;
1465
+ case "inactive":
1466
+ return `${styleText("dim", dist_H)} ${styleText("dim", $)}`;
1467
+ case "disabled":
1468
+ return `${styleText("gray", dist_H)} ${styleText([
1469
+ "strikethrough",
1470
+ "gray"
1471
+ ], $)}`;
1472
+ }
1473
+ };
1474
+ switch(this.state){
1475
+ case "submit":
1476
+ {
1477
+ const a = dist_tt(this.selectedValues, u), l = a.length > 0 ? ` ${styleText("dim", a.map(Me).join(", "))}` : "", $ = i ? styleText("gray", prompts_dist_d) : "";
1478
+ return `${s.join(`
1479
+ `)}
1480
+ ${$}${l}`;
1481
+ }
1482
+ case "cancel":
1483
+ {
1484
+ const a = r ? ` ${styleText([
1485
+ "strikethrough",
1486
+ "dim"
1487
+ ], r)}` : "", l = i ? styleText("gray", prompts_dist_d) : "";
1488
+ return `${s.join(`
1489
+ `)}
1490
+ ${l}${a}`;
1491
+ }
1492
+ default:
1493
+ {
1494
+ const a = "error" === this.state ? "yellow" : "cyan", l = i ? `${styleText(a, prompts_dist_d)} ` : "", $ = i ? styleText(a, dist_E) : "";
1495
+ let y = "";
1496
+ if (this.isNavigating || o) {
1497
+ const v = o ? n : r;
1498
+ y = "" !== v ? ` ${styleText("dim", v)}` : "";
1499
+ } else y = ` ${this.userInputWithCursor}`;
1500
+ const p = this.filteredOptions.length !== u.length ? styleText("dim", ` (${this.filteredOptions.length} match${1 === this.filteredOptions.length ? "" : "es"})`) : "", m = 0 === this.filteredOptions.length && r ? [
1501
+ `${l}${styleText("yellow", "No matches found")}`
1502
+ ] : [], g = "error" === this.state ? [
1503
+ `${l}${styleText("yellow", this.error)}`
1504
+ ] : [];
1505
+ i && s.push(`${l.trimEnd()}`), s.push(`${l}${styleText("dim", "Search:")}${y}${p}`, ...m, ...g);
1506
+ const S = [
1507
+ `${styleText("dim", "\u2191/\u2193")} to select`,
1508
+ `${styleText("dim", "Enter:")} confirm`,
1509
+ `${styleText("dim", "Type:")} to search`
1510
+ ], h = [
1511
+ `${l}${S.join(" \u2022 ")}`,
1512
+ $
1513
+ ], f = 0 === this.filteredOptions.length ? [] : dist_Y({
1514
+ cursor: this.cursor,
1515
+ options: this.filteredOptions,
1516
+ columnPadding: i ? 3 : 0,
1517
+ rowPadding: s.length + h.length,
1518
+ style: (v, T)=>c(v, v.disabled ? "disabled" : T ? "active" : "inactive"),
1519
+ maxItems: e.maxItems,
1520
+ output: e.output
1521
+ });
1522
+ return [
1523
+ ...s,
1524
+ ...f.map((v)=>`${l}${v}`),
1525
+ ...h
1526
+ ].join(`
1527
+ `);
1528
+ }
1529
+ }
1530
+ }
1531
+ }).prompt();
1532
+ const ht = (e)=>{
1533
+ const { selectableGroups: i = !0, groupSpacing: s = 0 } = e, r = (n, o, c = [])=>{
1534
+ const a = n.label ?? String(n.value), l = "string" == typeof n.group, $ = l && (c[c.indexOf(n) + 1] ?? {
1535
+ group: !0
1536
+ }), y = l && $ && !0 === $.group, p = l ? i ? `${y ? dist_E : prompts_dist_d} ` : " " : "";
1537
+ let m = "";
1538
+ if (s > 0 && !l) {
1539
+ const S = `
1540
+ ${styleText("cyan", prompts_dist_d)}`;
1541
+ m = `${S.repeat(s - 1)}${S} `;
1542
+ }
1543
+ if ("active" === o) return `${m}${styleText("dim", p)}${styleText("cyan", te)} ${a}${n.hint ? ` ${styleText("dim", `(${n.hint})`)}` : ""}`;
1544
+ if ("group-active" === o) return `${m}${p}${styleText("cyan", te)} ${styleText("dim", a)}`;
1545
+ if ("group-active-selected" === o) return `${m}${p}${styleText("green", dist_U)} ${styleText("dim", a)}`;
1546
+ if ("selected" === o) {
1547
+ const S = l || i ? styleText("green", dist_U) : "";
1548
+ return `${m}${styleText("dim", p)}${S} ${styleText("dim", a)}${n.hint ? ` ${styleText("dim", `(${n.hint})`)}` : ""}`;
1549
+ }
1550
+ if ("cancelled" === o) return `${styleText([
1551
+ "strikethrough",
1552
+ "dim"
1553
+ ], a)}`;
1554
+ if ("active-selected" === o) return `${m}${styleText("dim", p)}${styleText("green", dist_U)} ${a}${n.hint ? ` ${styleText("dim", `(${n.hint})`)}` : ""}`;
1555
+ if ("submitted" === o) return `${styleText("dim", a)}`;
1556
+ const g = l || i ? styleText("dim", dist_J) : "";
1557
+ return `${m}${styleText("dim", p)}${g} ${styleText("dim", a)}`;
1558
+ }, u = e.required ?? !0;
1559
+ return new st({
1560
+ options: e.options,
1561
+ signal: e.signal,
1562
+ input: e.input,
1563
+ output: e.output,
1564
+ initialValues: e.initialValues,
1565
+ required: u,
1566
+ cursorAt: e.cursorAt,
1567
+ selectableGroups: i,
1568
+ validate (n) {
1569
+ if (u && (void 0 === n || 0 === n.length)) return `Please select at least one option.
1570
+ ${styleText("reset", styleText("dim", `Press ${styleText([
1571
+ "gray",
1572
+ "bgWhite",
1573
+ "inverse"
1574
+ ], " space ")} to select, ${styleText("gray", styleText([
1575
+ "bgWhite",
1576
+ "inverse"
1577
+ ], " enter "))} to submit`))}`;
1578
+ },
1579
+ render () {
1580
+ const n = e.withGuide ?? dist_u.withGuide, o = `${n ? `${styleText("gray", prompts_dist_d)}
1581
+ ` : ""}${dist_V(this.state)} ${e.message}
1582
+ `, c = this.value ?? [];
1583
+ switch(this.state){
1584
+ case "submit":
1585
+ {
1586
+ const a = this.options.filter(({ value: $ })=>c.includes($)).map(($)=>r($, "submitted")), l = 0 === a.length ? "" : ` ${a.join(styleText("dim", ", "))}`;
1587
+ return `${o}${n ? styleText("gray", prompts_dist_d) : ""}${l}`;
1588
+ }
1589
+ case "cancel":
1590
+ {
1591
+ const a = this.options.filter(({ value: l })=>c.includes(l)).map((l)=>r(l, "cancelled")).join(styleText("dim", ", "));
1592
+ return `${o}${n ? `${styleText("gray", prompts_dist_d)} ` : ""}${a.trim() ? `${a}${n ? `
1593
+ ${styleText("gray", prompts_dist_d)}` : ""}` : ""}`;
1594
+ }
1595
+ case "error":
1596
+ {
1597
+ const a = this.error.split(`
1598
+ `).map((l, $)=>0 === $ ? `${n ? `${styleText("yellow", dist_E)} ` : ""}${styleText("yellow", l)}` : ` ${l}`).join(`
1599
+ `);
1600
+ return `${o}${n ? `${styleText("yellow", prompts_dist_d)} ` : ""}${this.options.map((l, $, y)=>{
1601
+ const p = c.includes(l.value) || !0 === l.group && this.isGroupSelected(`${l.value}`), m = $ === this.cursor;
1602
+ 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);
1603
+ }).join(`
1604
+ ${n ? `${styleText("yellow", prompts_dist_d)} ` : ""}`)}
1605
+ ${a}
1606
+ `;
1607
+ }
1608
+ default:
1609
+ {
1610
+ const a = this.options.map(($, y, p)=>{
1611
+ 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;
1612
+ let h = "";
1613
+ 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(`
1614
+ `) ? " " : ""}${h}`;
1615
+ }).join(`
1616
+ ${n ? styleText("cyan", prompts_dist_d) : ""}`), l = a.startsWith(`
1617
+ `) ? "" : " ";
1618
+ return `${o}${n ? styleText("cyan", prompts_dist_d) : ""}${l}${a}
1619
+ ${n ? styleText("cyan", dist_E) : ""}
1620
+ `;
1621
+ }
1622
+ }
1623
+ }
1624
+ }).prompt();
1625
+ }, dist_O = {
1626
+ 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 } = {})=>{
1627
+ const o = [], c = n ?? dist_u.withGuide, a = c ? s : "", l = c ? `${i} ` : "", $ = c ? `${s} ` : "";
1628
+ for(let p = 0; p < u; p++)o.push(a);
1629
+ const y = Array.isArray(e) ? e : e.split(`
1630
+ `);
1631
+ if (y.length > 0) {
1632
+ const [p, ...m] = y;
1633
+ p.length > 0 ? o.push(`${l}${p}`) : o.push(c ? i : "");
1634
+ for (const g of m)g.length > 0 ? o.push(`${$}${g}`) : o.push(c ? s : "");
1635
+ }
1636
+ r.write(`${o.join(`
1637
+ `)}
1638
+ `);
1639
+ },
1640
+ info: (e, i)=>{
1641
+ dist_O.message(e, {
1642
+ ...i,
1643
+ symbol: styleText("blue", he)
1644
+ });
1645
+ },
1646
+ success: (e, i)=>{
1647
+ dist_O.message(e, {
1648
+ ...i,
1649
+ symbol: styleText("green", pe)
1650
+ });
1651
+ },
1652
+ step: (e, i)=>{
1653
+ dist_O.message(e, {
1654
+ ...i,
1655
+ symbol: styleText("green", dist_F)
1656
+ });
1657
+ },
1658
+ warn: (e, i)=>{
1659
+ dist_O.message(e, {
1660
+ ...i,
1661
+ symbol: styleText("yellow", me)
1662
+ });
1663
+ },
1664
+ warning: (e, i)=>{
1665
+ dist_O.warn(e, i);
1666
+ },
1667
+ error: (e, i)=>{
1668
+ dist_O.message(e, {
1669
+ ...i,
1670
+ symbol: styleText("red", ge)
1671
+ });
1672
+ }
1673
+ }, pt = (e = "", i)=>{
1674
+ const s = i?.output ?? process.stdout, r = i?.withGuide ?? dist_u.withGuide ? `${styleText("gray", dist_E)} ` : "";
1675
+ s.write(`${r}${styleText("red", e)}
1643
1676
 
1644
1677
  `);
1645
- }, Gt = (e = "", r)=>{
1646
- const s = r?.output ?? process.stdout, i = r?.withGuide ?? dist_.withGuide ? `${styleText("gray", dist_h)}
1647
- ${styleText("gray", dist_x)} ` : "";
1648
- s.write(`${i}${e}
1678
+ }, gt = (e = "", i)=>{
1679
+ const s = i?.output ?? process.stdout, r = i?.withGuide ?? dist_u.withGuide ? `${styleText("gray", prompts_dist_d)}
1680
+ ${styleText("gray", dist_E)} ` : "";
1681
+ s.write(`${r}${e}
1649
1682
 
1650
1683
  `);
1651
- }, dist_Q = (e, r)=>e.split(`
1652
- `).map((s)=>r(s)).join(`
1653
- `), dist_Lt = (e)=>{
1654
- const r = (i, a)=>{
1655
- const o = i.label ?? String(i.value);
1656
- return "disabled" === a ? `${styleText("gray", dist_q)} ${dist_Q(o, (u)=>styleText([
1684
+ }, dist_Q = (e, i)=>e.split(`
1685
+ `).map((s)=>i(s)).join(`
1686
+ `), yt = (e)=>{
1687
+ const i = (r, u)=>{
1688
+ const n = r.label ?? String(r.value);
1689
+ return "disabled" === u ? `${styleText("gray", dist_J)} ${dist_Q(n, (o)=>styleText([
1657
1690
  "strikethrough",
1658
1691
  "gray"
1659
- ], 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([
1692
+ ], 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([
1660
1693
  "strikethrough",
1661
1694
  "dim"
1662
- ], 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", dist_q)} ${dist_Q(o, (u)=>styleText("dim", u))}`;
1695
+ ], 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))}`;
1663
1696
  }, s = e.required ?? !0;
1664
- return new Lt({
1697
+ return new it({
1665
1698
  options: e.options,
1666
1699
  signal: e.signal,
1667
1700
  input: e.input,
@@ -1669,8 +1702,8 @@ ${styleText("gray", dist_x)} ` : "";
1669
1702
  initialValues: e.initialValues,
1670
1703
  required: s,
1671
1704
  cursorAt: e.cursorAt,
1672
- validate (i) {
1673
- if (s && (void 0 === i || 0 === i.length)) return `Please select at least one option.
1705
+ validate (r) {
1706
+ if (s && (void 0 === r || 0 === r.length)) return `Please select at least one option.
1674
1707
  ${styleText("reset", styleText("dim", `Press ${styleText([
1675
1708
  "gray",
1676
1709
  "bgWhite",
@@ -1678,157 +1711,278 @@ ${styleText("reset", styleText("dim", `Press ${styleText([
1678
1711
  ], " space ")} to select, ${styleText("gray", styleText("bgWhite", styleText("inverse", " enter ")))} to submit`))}`;
1679
1712
  },
1680
1713
  render () {
1681
- const i = Bt(e.output, e.message, `${ve(this.state)} `, `${dist_W(this.state)} `), a = `${styleText("gray", dist_h)}
1682
- ${i}
1683
- `, o = this.value ?? [], u = (l, n)=>{
1684
- if (l.disabled) return r(l, "disabled");
1685
- const c = o.includes(l.value);
1686
- return n && c ? r(l, "active-selected") : c ? r(l, "selected") : r(l, n ? "active" : "inactive");
1714
+ 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)}
1715
+ ` : ""}${u}
1716
+ `, o = this.value ?? [], c = (a, l)=>{
1717
+ if (a.disabled) return i(a, "disabled");
1718
+ const $ = o.includes(a.value);
1719
+ return l && $ ? i(a, "active-selected") : $ ? i(a, "selected") : i(a, l ? "active" : "inactive");
1687
1720
  };
1688
1721
  switch(this.state){
1689
1722
  case "submit":
1690
1723
  {
1691
- 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)} `);
1692
- return `${a}${n}`;
1724
+ 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)} ` : "");
1725
+ return `${n}${l}`;
1693
1726
  }
1694
1727
  case "cancel":
1695
1728
  {
1696
- const l = this.options.filter(({ value: c })=>o.includes(c)).map((c)=>r(c, "cancelled")).join(styleText("dim", ", "));
1697
- if ("" === l.trim()) return `${a}${styleText("gray", dist_h)}`;
1698
- const n = Bt(e.output, l, `${styleText("gray", dist_h)} `);
1699
- return `${a}${n}
1700
- ${styleText("gray", dist_h)}`;
1729
+ const a = this.options.filter(({ value: $ })=>o.includes($)).map(($)=>i($, "cancelled")).join(styleText("dim", ", "));
1730
+ if ("" === a.trim()) return `${n}${styleText("gray", prompts_dist_d)}`;
1731
+ const l = dist_R(e.output, a, r ? `${styleText("gray", prompts_dist_d)} ` : "");
1732
+ return `${n}${l}${r ? `
1733
+ ${styleText("gray", prompts_dist_d)}` : ""}`;
1701
1734
  }
1702
1735
  case "error":
1703
1736
  {
1704
- const l = `${styleText("yellow", dist_h)} `, n = this.error.split(`
1705
- `).map((f, g)=>0 === g ? `${styleText("yellow", dist_x)} ${styleText("yellow", f)}` : ` ${f}`).join(`
1706
- `), c = a.split(`
1707
- `).length, p = n.split(`
1737
+ const a = r ? `${styleText("yellow", prompts_dist_d)} ` : "", l = this.error.split(`
1738
+ `).map((p, m)=>0 === m ? `${r ? `${styleText("yellow", dist_E)} ` : ""}${styleText("yellow", p)}` : ` ${p}`).join(`
1739
+ `), $ = n.split(`
1740
+ `).length, y = l.split(`
1708
1741
  `).length + 1;
1709
- return `${a}${l}${dist_X({
1742
+ return `${n}${a}${dist_Y({
1710
1743
  output: e.output,
1711
1744
  options: this.options,
1712
1745
  cursor: this.cursor,
1713
1746
  maxItems: e.maxItems,
1714
- columnPadding: l.length,
1715
- rowPadding: c + p,
1716
- style: u
1747
+ columnPadding: a.length,
1748
+ rowPadding: $ + y,
1749
+ style: c
1717
1750
  }).join(`
1718
- ${l}`)}
1719
- ${n}
1751
+ ${a}`)}
1752
+ ${l}
1720
1753
  `;
1721
1754
  }
1722
1755
  default:
1723
1756
  {
1724
- const l = `${styleText("cyan", dist_h)} `, n = a.split(`
1725
- `).length;
1726
- return `${a}${l}${dist_X({
1757
+ const a = r ? `${styleText("cyan", prompts_dist_d)} ` : "", l = n.split(`
1758
+ `).length, $ = r ? 2 : 1;
1759
+ return `${n}${a}${dist_Y({
1727
1760
  output: e.output,
1728
1761
  options: this.options,
1729
1762
  cursor: this.cursor,
1730
1763
  maxItems: e.maxItems,
1731
- columnPadding: l.length,
1732
- rowPadding: n + 2,
1733
- style: u
1764
+ columnPadding: a.length,
1765
+ rowPadding: l + $,
1766
+ style: c
1734
1767
  }).join(`
1735
- ${l}`)}
1736
- ${styleText("cyan", dist_x)}
1768
+ ${a}`)}
1769
+ ${r ? styleText("cyan", dist_E) : ""}
1737
1770
  `;
1738
1771
  }
1739
1772
  }
1740
1773
  }
1741
1774
  }).prompt();
1742
- }, jt = (e)=>styleText("dim", e), dist_kt = (e, r, s)=>{
1743
- const i = {
1775
+ }, ft = (e)=>styleText("dim", e), vt = (e, i, s)=>{
1776
+ const r = {
1744
1777
  hard: !0,
1745
1778
  trim: !1
1746
- }, a = dist_J(e, r, i).split(`
1747
- `), 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);
1748
- return dist_J(e, l, i);
1749
- }, dist_Vt = (e = "", r = "", s)=>{
1750
- const i = s?.output ?? node_process.stdout, a = s?.withGuide ?? dist_.withGuide, o = s?.format ?? jt, u = [
1779
+ }, u = wrapAnsi(e, i, r).split(`
1780
+ `), 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);
1781
+ return wrapAnsi(e, c, r);
1782
+ }, wt = (e = "", i = "", s)=>{
1783
+ const r = s?.output ?? node_process.stdout, u = s?.withGuide ?? dist_u.withGuide, n = s?.format ?? ft, o = [
1751
1784
  "",
1752
- ...dist_kt(e, dist_rt(i) - 6, o).split(`
1753
- `).map(o),
1785
+ ...vt(e, O(r) - 6, n).split(`
1786
+ `).map(n),
1754
1787
  ""
1755
- ], l = D(r), n = Math.max(u.reduce((g, E)=>{
1756
- const $ = D(E);
1757
- return $ > g ? $ : g;
1758
- }, 0), l) + 2, c = u.map((g)=>`${styleText("gray", dist_h)} ${g}${" ".repeat(n - D(g))}${styleText("gray", dist_h)}`).join(`
1759
- `), p = a ? `${styleText("gray", dist_h)}
1760
- ` : "", f = a ? We : ge;
1761
- i.write(`${p}${styleText("green", dist_V)} ${styleText("reset", r)} ${styleText("gray", se.repeat(Math.max(n - l - 1, 1)) + pe)}
1762
- ${c}
1763
- ${styleText("gray", f + se.repeat(n + 2) + me)}
1788
+ ], c = fast_string_width_dist(i), a = Math.max(o.reduce((p, m)=>{
1789
+ const g = fast_string_width_dist(m);
1790
+ return g > p ? g : p;
1791
+ }, 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(`
1792
+ `), $ = u ? `${styleText("gray", prompts_dist_d)}
1793
+ ` : "", y = u ? Ge : de;
1794
+ r.write(`${$}${styleText("green", dist_F)} ${styleText("reset", i)} ${styleText("gray", se.repeat(Math.max(a - c - 1, 1)) + ce)}
1795
+ ${l}
1796
+ ${styleText("gray", y + se.repeat(a + 2) + $e)}
1764
1797
  `);
1765
1798
  };
1766
- dist_I("\u2500", "-"), dist_I("\u2501", "="), dist_I("\u2588", "#");
1767
- const oe = (e, r)=>e.includes(`
1799
+ dist_w("\u2500", "-"), dist_w("\u2501", "="), dist_w("\u2588", "#");
1800
+ const re = (e, i)=>e.includes(`
1768
1801
  `) ? e.split(`
1769
- `).map((s)=>r(s)).join(`
1770
- `) : r(e), Jt = (e)=>{
1771
- const r = (s, i)=>{
1772
- const a = s.label ?? String(s.value);
1773
- switch(i){
1802
+ `).map((s)=>i(s)).join(`
1803
+ `) : i(e), _t = (e)=>{
1804
+ const i = (s, r)=>{
1805
+ const u = s.label ?? String(s.value);
1806
+ switch(r){
1774
1807
  case "disabled":
1775
- return `${styleText("gray", dist_H)} ${oe(a, (o)=>styleText("gray", o))}${s.hint ? ` ${styleText("dim", `(${s.hint ?? "disabled"})`)}` : ""}`;
1808
+ return `${styleText("gray", dist_H)} ${re(u, (n)=>styleText("gray", n))}${s.hint ? ` ${styleText("dim", `(${s.hint ?? "disabled"})`)}` : ""}`;
1776
1809
  case "selected":
1777
- return `${oe(a, (o)=>styleText("dim", o))}`;
1810
+ return `${re(u, (n)=>styleText("dim", n))}`;
1778
1811
  case "active":
1779
- return `${styleText("green", dist_z)} ${a}${s.hint ? ` ${styleText("dim", `(${s.hint})`)}` : ""}`;
1812
+ return `${styleText("green", dist_z)} ${u}${s.hint ? ` ${styleText("dim", `(${s.hint})`)}` : ""}`;
1780
1813
  case "cancelled":
1781
- return `${oe(a, (o)=>styleText([
1814
+ return `${re(u, (n)=>styleText([
1782
1815
  "strikethrough",
1783
1816
  "dim"
1784
- ], o))}`;
1817
+ ], n))}`;
1785
1818
  default:
1786
- return `${styleText("dim", dist_H)} ${oe(a, (o)=>styleText("dim", o))}`;
1819
+ return `${styleText("dim", dist_H)} ${re(u, (n)=>styleText("dim", n))}`;
1787
1820
  }
1788
1821
  };
1789
- return new Tt({
1822
+ return new nt({
1790
1823
  options: e.options,
1791
1824
  signal: e.signal,
1792
1825
  input: e.input,
1793
1826
  output: e.output,
1794
1827
  initialValue: e.initialValue,
1795
1828
  render () {
1796
- 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)}
1797
- ` : ""}${o}
1829
+ 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)}
1830
+ ` : ""}${n}
1798
1831
  `;
1799
1832
  switch(this.state){
1800
1833
  case "submit":
1801
1834
  {
1802
- const l = s ? `${styleText("gray", dist_h)} ` : "", n = Bt(e.output, r(this.options[this.cursor], "selected"), l);
1803
- return `${u}${n}`;
1835
+ const c = s ? `${styleText("gray", prompts_dist_d)} ` : "", a = dist_R(e.output, i(this.options[this.cursor], "selected"), c);
1836
+ return `${o}${a}`;
1804
1837
  }
1805
1838
  case "cancel":
1806
1839
  {
1807
- const l = s ? `${styleText("gray", dist_h)} ` : "", n = Bt(e.output, r(this.options[this.cursor], "cancelled"), l);
1808
- return `${u}${n}${s ? `
1809
- ${styleText("gray", dist_h)}` : ""}`;
1840
+ const c = s ? `${styleText("gray", prompts_dist_d)} ` : "", a = dist_R(e.output, i(this.options[this.cursor], "cancelled"), c);
1841
+ return `${o}${a}${s ? `
1842
+ ${styleText("gray", prompts_dist_d)}` : ""}`;
1810
1843
  }
1811
1844
  default:
1812
1845
  {
1813
- const l = s ? `${styleText("cyan", dist_h)} ` : "", n = s ? styleText("cyan", dist_x) : "", c = u.split(`
1814
- `).length, p = s ? 2 : 1;
1815
- return `${u}${l}${dist_X({
1846
+ const c = s ? `${styleText("cyan", prompts_dist_d)} ` : "", a = s ? styleText("cyan", dist_E) : "", l = o.split(`
1847
+ `).length, $ = s ? 2 : 1;
1848
+ return `${o}${c}${dist_Y({
1816
1849
  output: e.output,
1817
1850
  cursor: this.cursor,
1818
1851
  options: this.options,
1819
1852
  maxItems: e.maxItems,
1820
- columnPadding: l.length,
1821
- rowPadding: c + p,
1822
- style: (f, g)=>r(f, f.disabled ? "disabled" : g ? "active" : "inactive")
1853
+ columnPadding: c.length,
1854
+ rowPadding: l + $,
1855
+ style: (y, p)=>i(y, y.disabled ? "disabled" : p ? "active" : "inactive")
1823
1856
  }).join(`
1824
- ${l}`)}
1825
- ${n}
1857
+ ${c}`)}
1858
+ ${a}
1826
1859
  `;
1827
1860
  }
1828
1861
  }
1829
1862
  }
1830
1863
  }).prompt();
1831
- }, Zt = (styleText("gray", dist_h), (e)=>new dist_$t({
1864
+ }, xt = (styleText("gray", prompts_dist_d), (e)=>e.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g, "")), Gt = (e)=>{
1865
+ 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);
1866
+ i.write(`${r}
1867
+ `), i.write(`${styleText("green", dist_F)} ${e.title}
1868
+ `);
1869
+ for(let h = 0; h < u; h++)i.write(`${r}
1870
+ `);
1871
+ const a = [
1872
+ {
1873
+ value: "",
1874
+ full: ""
1875
+ }
1876
+ ];
1877
+ let l = !1;
1878
+ const $ = (h)=>{
1879
+ if (0 === a.length) return;
1880
+ let f = 0;
1881
+ h && (f += u + 2);
1882
+ for (const v of a){
1883
+ const { value: T, result: C } = v;
1884
+ let b = C?.message ?? T;
1885
+ if (0 === b.length) continue;
1886
+ void 0 === C && void 0 !== v.header && "" !== v.header && (b += `
1887
+ ${v.header}`);
1888
+ const x = b.split(`
1889
+ `).reduce((G, M)=>"" === M ? G + 1 : G + Math.ceil((M.length + n) / s), 0);
1890
+ f += x;
1891
+ }
1892
+ f > 0 && (f += 1, i.write(src.erase.lines(f)));
1893
+ }, y = (h, f, v)=>{
1894
+ const T = v ? `${h.full}
1895
+ ${h.value}` : h.value;
1896
+ void 0 !== h.header && "" !== h.header && dist_O.message(h.header.split(`
1897
+ `).map((C)=>styleText("bold", C)), {
1898
+ output: i,
1899
+ secondarySymbol: r,
1900
+ symbol: r,
1901
+ spacing: 0
1902
+ }), dist_O.message(T.split(`
1903
+ `).map((C)=>styleText("dim", C)), {
1904
+ output: i,
1905
+ secondarySymbol: r,
1906
+ symbol: r,
1907
+ spacing: f ?? u
1908
+ });
1909
+ }, p = ()=>{
1910
+ for (const h of a){
1911
+ const { header: f, value: v, full: T } = h;
1912
+ (void 0 === f || 0 === f.length) && 0 === v.length || y(h, void 0, !0 === o && T.length > 0);
1913
+ }
1914
+ }, m = (h, f, v)=>{
1915
+ if ($(!1), v?.raw === !0 && l || "" === h.value || (h.value += `
1916
+ `), h.value += xt(f), l = v?.raw === !0, void 0 !== e.limit) {
1917
+ const T = h.value.split(`
1918
+ `), C = T.length - e.limit;
1919
+ if (C > 0) {
1920
+ const b = T.splice(0, C);
1921
+ o && (h.full += ("" === h.full ? "" : `
1922
+ `) + b.join(`
1923
+ `));
1924
+ }
1925
+ h.value = T.join(`
1926
+ `);
1927
+ }
1928
+ c && g();
1929
+ }, g = ()=>{
1930
+ for (const h of a)h.result ? "error" === h.result.status ? dist_O.error(h.result.message, {
1931
+ output: i,
1932
+ secondarySymbol: r,
1933
+ spacing: 0
1934
+ }) : dist_O.success(h.result.message, {
1935
+ output: i,
1936
+ secondarySymbol: r,
1937
+ spacing: 0
1938
+ }) : "" !== h.value && y(h, 0);
1939
+ }, S = (h, f)=>{
1940
+ $(!1), h.result = f, c && g();
1941
+ };
1942
+ return {
1943
+ message (h, f) {
1944
+ m(a[0], h, f);
1945
+ },
1946
+ group (h) {
1947
+ const f = {
1948
+ header: h,
1949
+ value: "",
1950
+ full: ""
1951
+ };
1952
+ return a.push(f), {
1953
+ message (v, T) {
1954
+ m(f, v, T);
1955
+ },
1956
+ error (v) {
1957
+ S(f, {
1958
+ status: "error",
1959
+ message: v
1960
+ });
1961
+ },
1962
+ success (v) {
1963
+ S(f, {
1964
+ status: "success",
1965
+ message: v
1966
+ });
1967
+ }
1968
+ };
1969
+ },
1970
+ error (h, f) {
1971
+ $(!0), dist_O.error(h, {
1972
+ output: i,
1973
+ secondarySymbol: r,
1974
+ spacing: 1
1975
+ }), f?.showLog !== !1 && p(), a.splice(1, a.length - 1), a[0].value = "", a[0].full = "";
1976
+ },
1977
+ success (h, f) {
1978
+ $(!0), dist_O.success(h, {
1979
+ output: i,
1980
+ secondarySymbol: r,
1981
+ spacing: 1
1982
+ }), f?.showLog === !0 && p(), a.splice(1, a.length - 1), a[0].value = "", a[0].full = "";
1983
+ }
1984
+ };
1985
+ }, Ot = (e)=>new at({
1832
1986
  validate: e.validate,
1833
1987
  placeholder: e.placeholder,
1834
1988
  defaultValue: e.defaultValue,
@@ -1837,45 +1991,45 @@ ${n}
1837
1991
  signal: e.signal,
1838
1992
  input: e.input,
1839
1993
  render () {
1840
- const r = e?.withGuide ?? dist_.withGuide, s = `${r ? `${styleText("gray", dist_h)}
1841
- ` : ""}${dist_W(this.state)} ${e.message}
1842
- `, i = e.placeholder ? styleText("inverse", e.placeholder[0]) + styleText("dim", e.placeholder.slice(1)) : styleText([
1994
+ const i = e?.withGuide ?? dist_u.withGuide, s = `${i ? `${styleText("gray", prompts_dist_d)}
1995
+ ` : ""}${dist_V(this.state)} ${e.message}
1996
+ `, r = e.placeholder ? styleText("inverse", e.placeholder[0]) + styleText("dim", e.placeholder.slice(1)) : styleText([
1843
1997
  "inverse",
1844
1998
  "hidden"
1845
- ], "_"), a = this.userInput ? this.userInputWithCursor : i, o = this.value ?? "";
1999
+ ], "_"), u = this.userInput ? this.userInputWithCursor : r, n = this.value ?? "";
1846
2000
  switch(this.state){
1847
2001
  case "error":
1848
2002
  {
1849
- const u = this.error ? ` ${styleText("yellow", this.error)}` : "", l = r ? `${styleText("yellow", dist_h)} ` : "", n = r ? styleText("yellow", dist_x) : "";
2003
+ const o = this.error ? ` ${styleText("yellow", this.error)}` : "", c = i ? `${styleText("yellow", prompts_dist_d)} ` : "", a = i ? styleText("yellow", dist_E) : "";
1850
2004
  return `${s.trim()}
1851
- ${l}${a}
1852
- ${n}${u}
2005
+ ${c}${u}
2006
+ ${a}${o}
1853
2007
  `;
1854
2008
  }
1855
2009
  case "submit":
1856
2010
  {
1857
- const u = o ? ` ${styleText("dim", o)}` : "", l = r ? styleText("gray", dist_h) : "";
1858
- return `${s}${l}${u}`;
2011
+ const o = n ? ` ${styleText("dim", n)}` : "", c = i ? styleText("gray", prompts_dist_d) : "";
2012
+ return `${s}${c}${o}`;
1859
2013
  }
1860
2014
  case "cancel":
1861
2015
  {
1862
- const u = o ? ` ${styleText([
2016
+ const o = n ? ` ${styleText([
1863
2017
  "strikethrough",
1864
2018
  "dim"
1865
- ], o)}` : "", l = r ? styleText("gray", dist_h) : "";
1866
- return `${s}${l}${u}${o.trim() ? `
1867
- ${l}` : ""}`;
2019
+ ], n)}` : "", c = i ? styleText("gray", prompts_dist_d) : "";
2020
+ return `${s}${c}${o}${n.trim() ? `
2021
+ ${c}` : ""}`;
1868
2022
  }
1869
2023
  default:
1870
2024
  {
1871
- const u = r ? `${styleText("cyan", dist_h)} ` : "", l = r ? styleText("cyan", dist_x) : "";
1872
- return `${s}${u}${a}
1873
- ${l}
2025
+ const o = i ? `${styleText("cyan", prompts_dist_d)} ` : "", c = i ? styleText("cyan", dist_E) : "";
2026
+ return `${s}${o}${u}
2027
+ ${c}
1874
2028
  `;
1875
2029
  }
1876
2030
  }
1877
2031
  }
1878
- }).prompt());
2032
+ }).prompt();
1879
2033
  function checkNodeVersion() {
1880
2034
  const { versions } = process;
1881
2035
  if ("styleText" in node_util || !versions.node || versions.bun || versions.deno) return;
@@ -2147,9 +2301,637 @@ let createLogger = (options = {})=>{
2147
2301
  return logger;
2148
2302
  };
2149
2303
  let src_logger = createLogger();
2150
- const dist = __webpack_require__("./node_modules/.pnpm/@vercel+detect-agent@1.2.1/node_modules/@vercel/detect-agent/dist/index.js");
2151
- const cross_spawn = __webpack_require__("./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js");
2152
- var cross_spawn_default = /*#__PURE__*/ __webpack_require__.n(cross_spawn);
2304
+ var main_l = (e, t)=>()=>(t || e((t = {
2305
+ exports: {}
2306
+ }).exports, t), t.exports);
2307
+ var main_u = /* @__PURE__ */ createRequire(import.meta.url);
2308
+ const main_d = /^path$/i;
2309
+ const main_f = {
2310
+ key: "PATH",
2311
+ value: ""
2312
+ };
2313
+ function main_p(e) {
2314
+ for(const t in e){
2315
+ if (!Object.prototype.hasOwnProperty.call(e, t) || !main_d.test(t)) continue;
2316
+ const n = e[t];
2317
+ if (!n) break;
2318
+ return {
2319
+ key: t,
2320
+ value: n
2321
+ };
2322
+ }
2323
+ return main_f;
2324
+ }
2325
+ function main_m(e, t) {
2326
+ const i = t.value.split(delimiter);
2327
+ const o = [];
2328
+ let s = e;
2329
+ let c;
2330
+ do {
2331
+ o.push(resolve(s, "node_modules", ".bin"));
2332
+ c = s;
2333
+ s = dirname(s);
2334
+ }while (s !== c);
2335
+ const l = o.concat(i).join(delimiter);
2336
+ return {
2337
+ key: t.key,
2338
+ value: l
2339
+ };
2340
+ }
2341
+ function main_h(e, t) {
2342
+ const n = {
2343
+ ...process.env,
2344
+ ...t
2345
+ };
2346
+ const r = main_m(e, main_p(n));
2347
+ n[r.key] = r.value;
2348
+ return n;
2349
+ }
2350
+ const main_g = (e)=>{
2351
+ let t = e.length;
2352
+ const n = new PassThrough();
2353
+ const r = ()=>{
2354
+ if (0 === --t) n.emit("end");
2355
+ };
2356
+ for (const t of e){
2357
+ t.pipe(n, {
2358
+ end: false
2359
+ });
2360
+ t.on("end", r);
2361
+ }
2362
+ return n;
2363
+ };
2364
+ var main_ = /* @__PURE__ */ main_l((e, t)=>{
2365
+ t.exports = a;
2366
+ a.sync = o;
2367
+ var n = main_u("fs");
2368
+ function r(e, t) {
2369
+ var n = void 0 !== t.pathExt ? t.pathExt : process.env.PATHEXT;
2370
+ if (!n) return true;
2371
+ n = n.split(";");
2372
+ if (-1 !== n.indexOf("")) return true;
2373
+ for(var r = 0; r < n.length; r++){
2374
+ var i = n[r].toLowerCase();
2375
+ if (i && e.substr(-i.length).toLowerCase() === i) return true;
2376
+ }
2377
+ return false;
2378
+ }
2379
+ function i(e, t, n) {
2380
+ if (!e.isSymbolicLink() && !e.isFile()) return false;
2381
+ return r(t, n);
2382
+ }
2383
+ function a(e, t, r) {
2384
+ n.stat(e, function(n, a) {
2385
+ r(n, n ? false : i(a, e, t));
2386
+ });
2387
+ }
2388
+ function o(e, t) {
2389
+ return i(n.statSync(e), e, t);
2390
+ }
2391
+ });
2392
+ var main_v = /* @__PURE__ */ main_l((e, t)=>{
2393
+ t.exports = r;
2394
+ r.sync = i;
2395
+ var n = main_u("fs");
2396
+ function r(e, t, r) {
2397
+ n.stat(e, function(e, n) {
2398
+ r(e, e ? false : a(n, t));
2399
+ });
2400
+ }
2401
+ function i(e, t) {
2402
+ return a(n.statSync(e), t);
2403
+ }
2404
+ function a(e, t) {
2405
+ return e.isFile() && o(e, t);
2406
+ }
2407
+ function o(e, t) {
2408
+ var n = e.mode;
2409
+ var r = e.uid;
2410
+ var i = e.gid;
2411
+ var a = void 0 !== t.uid ? t.uid : process.getuid && process.getuid();
2412
+ var o = void 0 !== t.gid ? t.gid : process.getgid && process.getgid();
2413
+ var s = parseInt("100", 8);
2414
+ var c = parseInt("010", 8);
2415
+ var l = parseInt("001", 8);
2416
+ var u = s | c;
2417
+ return n & l || n & c && i === o || n & s && r === a || n & u && 0 === a;
2418
+ }
2419
+ });
2420
+ var main_y = /* @__PURE__ */ main_l((e, t)=>{
2421
+ main_u("fs");
2422
+ var n;
2423
+ n = "win32" === process.platform || global.TESTING_WINDOWS ? main_() : main_v();
2424
+ t.exports = r;
2425
+ r.sync = i;
2426
+ function r(e, t, i) {
2427
+ if ("function" == typeof t) {
2428
+ i = t;
2429
+ t = {};
2430
+ }
2431
+ if (!i) {
2432
+ if ("function" != typeof Promise) throw new TypeError("callback not provided");
2433
+ return new Promise(function(n, i) {
2434
+ r(e, t || {}, function(e, t) {
2435
+ if (e) i(e);
2436
+ else n(t);
2437
+ });
2438
+ });
2439
+ }
2440
+ n(e, t || {}, function(e, n) {
2441
+ if (e) {
2442
+ if ("EACCES" === e.code || t && t.ignoreErrors) {
2443
+ e = null;
2444
+ n = false;
2445
+ }
2446
+ }
2447
+ i(e, n);
2448
+ });
2449
+ }
2450
+ function i(e, t) {
2451
+ try {
2452
+ return n.sync(e, t || {});
2453
+ } catch (e) {
2454
+ if (t && t.ignoreErrors || "EACCES" === e.code) return false;
2455
+ throw e;
2456
+ }
2457
+ }
2458
+ });
2459
+ var main_b = /* @__PURE__ */ main_l((e, t)=>{
2460
+ const n = "win32" === process.platform || "cygwin" === process.env.OSTYPE || "msys" === process.env.OSTYPE;
2461
+ const r = main_u("path");
2462
+ const i = n ? ";" : ":";
2463
+ const a = main_y();
2464
+ const o = (e)=>Object.assign(/* @__PURE__ */ new Error(`not found: ${e}`), {
2465
+ code: "ENOENT"
2466
+ });
2467
+ const s = (e, t)=>{
2468
+ const r = t.colon || i;
2469
+ const a = e.match(/\//) || n && e.match(/\\/) ? [
2470
+ ""
2471
+ ] : [
2472
+ ...n ? [
2473
+ process.cwd()
2474
+ ] : [],
2475
+ ...(t.path || process.env.PATH || "").split(r)
2476
+ ];
2477
+ const o = n ? t.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
2478
+ const s = n ? o.split(r) : [
2479
+ ""
2480
+ ];
2481
+ if (n) {
2482
+ if (-1 !== e.indexOf(".") && "" !== s[0]) s.unshift("");
2483
+ }
2484
+ return {
2485
+ pathEnv: a,
2486
+ pathExt: s,
2487
+ pathExtExe: o
2488
+ };
2489
+ };
2490
+ const c = (e, t, n)=>{
2491
+ if ("function" == typeof t) {
2492
+ n = t;
2493
+ t = {};
2494
+ }
2495
+ if (!t) t = {};
2496
+ const { pathEnv: i, pathExt: c, pathExtExe: l } = s(e, t);
2497
+ const u = [];
2498
+ const d = (n)=>new Promise((a, s)=>{
2499
+ if (n === i.length) return t.all && u.length ? a(u) : s(o(e));
2500
+ const c = i[n];
2501
+ const l = /^".*"$/.test(c) ? c.slice(1, -1) : c;
2502
+ const d = r.join(l, e);
2503
+ a(f(!l && /^\.[\\\/]/.test(e) ? e.slice(0, 2) + d : d, n, 0));
2504
+ });
2505
+ const f = (e, n, r)=>new Promise((i, o)=>{
2506
+ if (r === c.length) return i(d(n + 1));
2507
+ const s = c[r];
2508
+ a(e + s, {
2509
+ pathExt: l
2510
+ }, (a, o)=>{
2511
+ if (!a && o) if (!t.all) return i(e + s);
2512
+ else u.push(e + s);
2513
+ return i(f(e, n, r + 1));
2514
+ });
2515
+ });
2516
+ return n ? d(0).then((e)=>n(null, e), n) : d(0);
2517
+ };
2518
+ const l = (e, t)=>{
2519
+ t = t || {};
2520
+ const { pathEnv: n, pathExt: i, pathExtExe: c } = s(e, t);
2521
+ const l = [];
2522
+ for(let o = 0; o < n.length; o++){
2523
+ const s = n[o];
2524
+ const u = /^".*"$/.test(s) ? s.slice(1, -1) : s;
2525
+ const d = r.join(u, e);
2526
+ const f = !u && /^\.[\\\/]/.test(e) ? e.slice(0, 2) + d : d;
2527
+ for(let e = 0; e < i.length; e++){
2528
+ const n = f + i[e];
2529
+ try {
2530
+ if (a.sync(n, {
2531
+ pathExt: c
2532
+ })) if (!t.all) return n;
2533
+ else l.push(n);
2534
+ } catch (e) {}
2535
+ }
2536
+ }
2537
+ if (t.all && l.length) return l;
2538
+ if (t.nothrow) return null;
2539
+ throw o(e);
2540
+ };
2541
+ t.exports = c;
2542
+ c.sync = l;
2543
+ });
2544
+ var main_x = /* @__PURE__ */ main_l((e, t)=>{
2545
+ const n = (e = {})=>{
2546
+ const t = e.env || process.env;
2547
+ if ("win32" !== (e.platform || process.platform)) return "PATH";
2548
+ return Object.keys(t).reverse().find((e)=>"PATH" === e.toUpperCase()) || "Path";
2549
+ };
2550
+ t.exports = n;
2551
+ t.exports.default = n;
2552
+ });
2553
+ var main_S = /* @__PURE__ */ main_l((e, t)=>{
2554
+ const n = main_u("path");
2555
+ const r = main_b();
2556
+ const i = main_x();
2557
+ function a(e, t) {
2558
+ const a = e.options.env || process.env;
2559
+ const o = process.cwd();
2560
+ const s = null != e.options.cwd;
2561
+ const c = s && void 0 !== process.chdir && !process.chdir.disabled;
2562
+ if (c) try {
2563
+ process.chdir(e.options.cwd);
2564
+ } catch (e) {}
2565
+ let l;
2566
+ try {
2567
+ l = r.sync(e.command, {
2568
+ path: a[i({
2569
+ env: a
2570
+ })],
2571
+ pathExt: t ? n.delimiter : void 0
2572
+ });
2573
+ } catch (e) {} finally{
2574
+ if (c) process.chdir(o);
2575
+ }
2576
+ if (l) l = n.resolve(s ? e.options.cwd : "", l);
2577
+ return l;
2578
+ }
2579
+ function o(e) {
2580
+ return a(e) || a(e, true);
2581
+ }
2582
+ t.exports = o;
2583
+ });
2584
+ var main_C = /* @__PURE__ */ main_l((e, t)=>{
2585
+ const n = /([()\][%!^"`<>&|;, *?])/g;
2586
+ function r(e) {
2587
+ e = e.replace(n, "^$1");
2588
+ return e;
2589
+ }
2590
+ function i(e, t) {
2591
+ e = `${e}`;
2592
+ e = e.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
2593
+ e = e.replace(/(?=(\\+?)?)\1$/, "$1$1");
2594
+ e = `"${e}"`;
2595
+ e = e.replace(n, "^$1");
2596
+ if (t) e = e.replace(n, "^$1");
2597
+ return e;
2598
+ }
2599
+ t.exports.command = r;
2600
+ t.exports.argument = i;
2601
+ });
2602
+ var main_w = /* @__PURE__ */ main_l((e, t)=>{
2603
+ t.exports = /^#!(.*)/;
2604
+ });
2605
+ var main_T = /* @__PURE__ */ main_l((e, t)=>{
2606
+ const n = main_w();
2607
+ t.exports = (e = "")=>{
2608
+ const t = e.match(n);
2609
+ if (!t) return null;
2610
+ const [r, i] = t[0].replace(/#! ?/, "").split(" ");
2611
+ const a = r.split("/").pop();
2612
+ if ("env" === a) return i;
2613
+ return i ? `${a} ${i}` : a;
2614
+ };
2615
+ });
2616
+ var main_E = /* @__PURE__ */ main_l((e, t)=>{
2617
+ const n = main_u("fs");
2618
+ const r = main_T();
2619
+ function i(e) {
2620
+ const t = 150;
2621
+ const i = Buffer.alloc(t);
2622
+ let a;
2623
+ try {
2624
+ a = n.openSync(e, "r");
2625
+ n.readSync(a, i, 0, t, 0);
2626
+ n.closeSync(a);
2627
+ } catch (e) {}
2628
+ return r(i.toString());
2629
+ }
2630
+ t.exports = i;
2631
+ });
2632
+ var main_D = /* @__PURE__ */ main_l((e, t)=>{
2633
+ const n = main_u("path");
2634
+ const r = main_S();
2635
+ const i = main_C();
2636
+ const a = main_E();
2637
+ const o = "win32" === process.platform;
2638
+ const s = /\.(?:com|exe)$/i;
2639
+ const c = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
2640
+ function l(e) {
2641
+ e.file = r(e);
2642
+ const t = e.file && a(e.file);
2643
+ if (t) {
2644
+ e.args.unshift(e.file);
2645
+ e.command = t;
2646
+ return r(e);
2647
+ }
2648
+ return e.file;
2649
+ }
2650
+ function d(e) {
2651
+ if (!o) return e;
2652
+ const t = l(e);
2653
+ const r = !s.test(t);
2654
+ if (e.options.forceShell || r) {
2655
+ const r = c.test(t);
2656
+ e.command = n.normalize(e.command);
2657
+ e.command = i.command(e.command);
2658
+ e.args = e.args.map((e)=>i.argument(e, r));
2659
+ e.args = [
2660
+ "/d",
2661
+ "/s",
2662
+ "/c",
2663
+ `"${[
2664
+ e.command
2665
+ ].concat(e.args).join(" ")}"`
2666
+ ];
2667
+ e.command = process.env.comspec || "cmd.exe";
2668
+ e.options.windowsVerbatimArguments = true;
2669
+ }
2670
+ return e;
2671
+ }
2672
+ function f(e, t, n) {
2673
+ if (t && !Array.isArray(t)) {
2674
+ n = t;
2675
+ t = null;
2676
+ }
2677
+ t = t ? t.slice(0) : [];
2678
+ n = Object.assign({}, n);
2679
+ const r = {
2680
+ command: e,
2681
+ args: t,
2682
+ options: n,
2683
+ file: void 0,
2684
+ original: {
2685
+ command: e,
2686
+ args: t
2687
+ }
2688
+ };
2689
+ return n.shell ? r : d(r);
2690
+ }
2691
+ t.exports = f;
2692
+ });
2693
+ var main_O = /* @__PURE__ */ main_l((e, t)=>{
2694
+ const n = "win32" === process.platform;
2695
+ function r(e, t) {
2696
+ return Object.assign(/* @__PURE__ */ new Error(`${t} ${e.command} ENOENT`), {
2697
+ code: "ENOENT",
2698
+ errno: "ENOENT",
2699
+ syscall: `${t} ${e.command}`,
2700
+ path: e.command,
2701
+ spawnargs: e.args
2702
+ });
2703
+ }
2704
+ function i(e, t) {
2705
+ if (!n) return;
2706
+ const r = e.emit;
2707
+ e.emit = function(n, i) {
2708
+ if ("exit" === n) {
2709
+ const n = a(i, t);
2710
+ if (n) return r.call(e, "error", n);
2711
+ }
2712
+ return r.apply(e, arguments);
2713
+ };
2714
+ }
2715
+ function a(e, t) {
2716
+ if (n && 1 === e && !t.file) return r(t.original, "spawn");
2717
+ return null;
2718
+ }
2719
+ function o(e, t) {
2720
+ if (n && 1 === e && !t.file) return r(t.original, "spawnSync");
2721
+ return null;
2722
+ }
2723
+ t.exports = {
2724
+ hookChildProcess: i,
2725
+ verifyENOENT: a,
2726
+ verifyENOENTSync: o,
2727
+ notFoundError: r
2728
+ };
2729
+ });
2730
+ var main_k = /* @__PURE__ */ main_l((e, t)=>{
2731
+ const n = main_u("child_process");
2732
+ const r = main_D();
2733
+ const i = main_O();
2734
+ function a(e, t, a) {
2735
+ const o = r(e, t, a);
2736
+ const s = n.spawn(o.command, o.args, o.options);
2737
+ i.hookChildProcess(s, o);
2738
+ return s;
2739
+ }
2740
+ function o(e, t, a) {
2741
+ const o = r(e, t, a);
2742
+ const s = n.spawnSync(o.command, o.args, o.options);
2743
+ s.error = s.error || i.verifyENOENTSync(s.status, o);
2744
+ return s;
2745
+ }
2746
+ t.exports = a;
2747
+ t.exports.spawn = a;
2748
+ t.exports.sync = o;
2749
+ t.exports._parse = r;
2750
+ t.exports._enoent = i;
2751
+ });
2752
+ var main_A = main_k();
2753
+ var main_j = class extends Error {
2754
+ result;
2755
+ output;
2756
+ get exitCode() {
2757
+ if (null !== this.result.exitCode) return this.result.exitCode;
2758
+ }
2759
+ constructor(e, t){
2760
+ super(`Process exited with non-zero status (${e.exitCode})`);
2761
+ this.result = e;
2762
+ this.output = t;
2763
+ }
2764
+ };
2765
+ const main_M = {
2766
+ timeout: void 0,
2767
+ persist: false
2768
+ };
2769
+ const main_N = {
2770
+ windowsHide: true
2771
+ };
2772
+ function P(e, t) {
2773
+ return {
2774
+ command: external_node_path_normalize(e),
2775
+ args: t ?? []
2776
+ };
2777
+ }
2778
+ function main_F(e) {
2779
+ const t = new AbortController();
2780
+ for (const n of e){
2781
+ if (n.aborted) {
2782
+ t.abort();
2783
+ return n;
2784
+ }
2785
+ const e = ()=>{
2786
+ t.abort(n.reason);
2787
+ };
2788
+ n.addEventListener("abort", e, {
2789
+ signal: t.signal
2790
+ });
2791
+ }
2792
+ return t.signal;
2793
+ }
2794
+ async function main_I(e) {
2795
+ let t = "";
2796
+ for await (const n of e)t += n.toString();
2797
+ return t;
2798
+ }
2799
+ var main_L = class {
2800
+ _process;
2801
+ _aborted = false;
2802
+ _options;
2803
+ _command;
2804
+ _args;
2805
+ _resolveClose;
2806
+ _processClosed;
2807
+ _thrownError;
2808
+ get process() {
2809
+ return this._process;
2810
+ }
2811
+ get pid() {
2812
+ return this._process?.pid;
2813
+ }
2814
+ get exitCode() {
2815
+ if (this._process && null !== this._process.exitCode) return this._process.exitCode;
2816
+ }
2817
+ constructor(e, t, n){
2818
+ this._options = {
2819
+ ...main_M,
2820
+ ...n
2821
+ };
2822
+ this._command = e;
2823
+ this._args = t ?? [];
2824
+ this._processClosed = new Promise((e)=>{
2825
+ this._resolveClose = e;
2826
+ });
2827
+ }
2828
+ kill(e) {
2829
+ return this._process?.kill(e) === true;
2830
+ }
2831
+ get aborted() {
2832
+ return this._aborted;
2833
+ }
2834
+ get killed() {
2835
+ return this._process?.killed === true;
2836
+ }
2837
+ pipe(e, t, n) {
2838
+ return main_z(e, t, {
2839
+ ...n,
2840
+ stdin: this
2841
+ });
2842
+ }
2843
+ async *[Symbol.asyncIterator]() {
2844
+ const e = this._process;
2845
+ if (!e) return;
2846
+ const t = [];
2847
+ if (this._streamErr) t.push(this._streamErr);
2848
+ if (this._streamOut) t.push(this._streamOut);
2849
+ const n = main_g(t);
2850
+ const r = node_readline.createInterface({
2851
+ input: n
2852
+ });
2853
+ for await (const e of r)yield e.toString();
2854
+ await this._processClosed;
2855
+ e.removeAllListeners();
2856
+ if (this._thrownError) throw this._thrownError;
2857
+ if (this._options?.throwOnError && 0 !== this.exitCode && void 0 !== this.exitCode) throw new main_j(this);
2858
+ }
2859
+ async _waitForOutput() {
2860
+ const e = this._process;
2861
+ if (!e) throw new Error("No process was started");
2862
+ const [t, n] = await Promise.all([
2863
+ this._streamOut ? main_I(this._streamOut) : "",
2864
+ this._streamErr ? main_I(this._streamErr) : ""
2865
+ ]);
2866
+ await this._processClosed;
2867
+ if (this._options?.stdin) await this._options.stdin;
2868
+ e.removeAllListeners();
2869
+ if (this._thrownError) throw this._thrownError;
2870
+ const r = {
2871
+ stderr: n,
2872
+ stdout: t,
2873
+ exitCode: this.exitCode
2874
+ };
2875
+ if (this._options.throwOnError && 0 !== this.exitCode && void 0 !== this.exitCode) throw new main_j(this, r);
2876
+ return r;
2877
+ }
2878
+ then(e, t) {
2879
+ return this._waitForOutput().then(e, t);
2880
+ }
2881
+ _streamOut;
2882
+ _streamErr;
2883
+ spawn() {
2884
+ const e = external_node_process_cwd();
2885
+ const n = this._options;
2886
+ const r = {
2887
+ ...main_N,
2888
+ ...n.nodeOptions
2889
+ };
2890
+ const i = [];
2891
+ this._resetState();
2892
+ if (void 0 !== n.timeout) i.push(AbortSignal.timeout(n.timeout));
2893
+ if (void 0 !== n.signal) i.push(n.signal);
2894
+ if (true === n.persist) r.detached = true;
2895
+ if (i.length > 0) r.signal = main_F(i);
2896
+ r.env = main_h(e, r.env);
2897
+ const { command: a, args: s } = P(this._command, this._args);
2898
+ const c = (0, main_A._parse)(a, s, r);
2899
+ const l = spawn(c.command, c.args, c.options);
2900
+ if (l.stderr) this._streamErr = l.stderr;
2901
+ if (l.stdout) this._streamOut = l.stdout;
2902
+ this._process = l;
2903
+ l.once("error", this._onError);
2904
+ l.once("close", this._onClose);
2905
+ if (void 0 !== n.stdin && l.stdin && n.stdin.process) {
2906
+ const { stdout: e } = n.stdin.process;
2907
+ if (e) e.pipe(l.stdin);
2908
+ }
2909
+ }
2910
+ _resetState() {
2911
+ this._aborted = false;
2912
+ this._processClosed = new Promise((e)=>{
2913
+ this._resolveClose = e;
2914
+ });
2915
+ this._thrownError = void 0;
2916
+ }
2917
+ _onError = (e)=>{
2918
+ if ("AbortError" === e.name && (!(e.cause instanceof Error) || "TimeoutError" !== e.cause.name)) {
2919
+ this._aborted = true;
2920
+ return;
2921
+ }
2922
+ this._thrownError = e;
2923
+ };
2924
+ _onClose = ()=>{
2925
+ if (this._resolveClose) this._resolveClose();
2926
+ };
2927
+ };
2928
+ const main_R = (e, t, n)=>{
2929
+ const r = new main_L(e, t, n);
2930
+ r.spawn();
2931
+ return r;
2932
+ };
2933
+ const main_z = main_R;
2934
+ const dist_0 = __webpack_require__("./node_modules/.pnpm/@vercel+detect-agent@1.2.1/node_modules/@vercel/detect-agent/dist/index.js");
2153
2935
  const cjs = __webpack_require__("./node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js");
2154
2936
  var cjs_default = /*#__PURE__*/ __webpack_require__.n(cjs);
2155
2937
  const minimist = __webpack_require__("./node_modules/.pnpm/minimist@1.2.8/node_modules/minimist/index.js");
@@ -2157,11 +2939,11 @@ var minimist_default = /*#__PURE__*/ __webpack_require__.n(minimist);
2157
2939
  const src_filename = fileURLToPath(import.meta.url);
2158
2940
  const src_dirname = dirname(src_filename);
2159
2941
  function cancelAndExit() {
2160
- Nt('Operation cancelled.');
2942
+ pt('Operation cancelled.');
2161
2943
  process.exit(0);
2162
2944
  }
2163
2945
  function checkCancel(value) {
2164
- if (Ct(value)) cancelAndExit();
2946
+ if (dist_q(value)) cancelAndExit();
2165
2947
  return value;
2166
2948
  }
2167
2949
  function formatProjectName(input) {
@@ -2191,36 +2973,49 @@ function parseToolsOption(tools) {
2191
2973
  ];
2192
2974
  return toolsArr.flatMap((tool)=>tool.split(',')).map((tool)=>tool.trim()).filter(Boolean);
2193
2975
  }
2976
+ function parseSkillsOption(skills) {
2977
+ if (void 0 === skills) return null;
2978
+ const skillsArr = Array.isArray(skills) ? skills : [
2979
+ skills
2980
+ ];
2981
+ return skillsArr.flatMap((skill)=>skill.split(',')).map((skill)=>skill.trim()).filter(Boolean);
2982
+ }
2194
2983
  const BUILTIN_TOOLS = [
2195
2984
  'biome',
2196
2985
  'eslint',
2197
2986
  'prettier'
2198
2987
  ];
2199
- function logHelpMessage(name, templates, extraTools) {
2988
+ function logHelpMessage(name, templates, extraTools, extraSkills) {
2200
2989
  const toolsList = [
2201
2990
  ...BUILTIN_TOOLS
2202
2991
  ];
2992
+ const skillsList = (extraSkills ?? []).map((skill)=>skill.value).filter(Boolean);
2993
+ const hasSkills = skillsList.length > 0;
2203
2994
  if (extraTools) {
2204
2995
  for (const tool of extraTools)if (tool.value) if ('pre' === tool.order) toolsList.unshift(tool.value);
2205
2996
  else toolsList.push(tool.value);
2206
2997
  }
2998
+ const skillsOptionLine = hasSkills ? ' --skill <skill> add optional skills, comma separated\n' : '';
2999
+ const optionalSkillsSection = hasSkills ? `
3000
+ Optional skills:
3001
+ ${skillsList.join(', ')}` : '';
2207
3002
  src_logger.log(`
2208
3003
  Usage: create-${name} [dir] [options]
2209
3004
 
2210
3005
  Options:
2211
3006
 
2212
3007
  -h, --help display help for command
2213
- -d, --dir <dir> create project in specified directory
2214
- -t, --template <tpl> specify the template to use
2215
- --tools <tool> add additional tools, comma separated
2216
- --override override files in target directory
2217
- --packageName <name> specify the package name
2218
-
2219
- Available templates:
2220
- ${templates.join(', ')}
3008
+ -d, --dir <dir> create project in specified directory
3009
+ -t, --template <tpl> specify the template to use
3010
+ --tools <tool> add additional tools, comma separated
3011
+ ${skillsOptionLine} --override override files in target directory
3012
+ --packageName <name> specify the package name
3013
+
3014
+ Available templates:
3015
+ ${templates.join(', ')}
2221
3016
 
2222
- Optional tools:
2223
- ${toolsList.join(', ')}
3017
+ Optional tools:
3018
+ ${toolsList.join(', ')}${optionalSkillsSection}
2224
3019
  `);
2225
3020
  }
2226
3021
  async function getTools({ tools, dir, template }, extraTools, templateName) {
@@ -2257,12 +3052,43 @@ async function getTools({ tools, dir, template }, extraTools, templateName) {
2257
3052
  options.unshift(...filteredExtraTools.filter((tool)=>'pre' === tool.order).map(normalize));
2258
3053
  options.push(...filteredExtraTools.filter((tool)=>'pre' !== tool.order).map(normalize));
2259
3054
  }
2260
- return checkCancel(await dist_Lt({
3055
+ return checkCancel(await yt({
2261
3056
  message: 'Select additional tools (Use <space> to select, <enter> to continue)',
2262
3057
  options,
2263
3058
  required: false
2264
3059
  }));
2265
3060
  }
3061
+ function filterExtraSkills(extraSkills, templateName) {
3062
+ return extraSkills?.filter((extraSkill)=>{
3063
+ const when = extraSkill.when ?? (()=>true);
3064
+ return templateName ? when(templateName) : true;
3065
+ });
3066
+ }
3067
+ function orderExtraSkills(extraSkills) {
3068
+ if (!extraSkills) return [];
3069
+ return [
3070
+ ...extraSkills.filter((extraSkill)=>'pre' === extraSkill.order),
3071
+ ...extraSkills.filter((extraSkill)=>void 0 === extraSkill.order),
3072
+ ...extraSkills.filter((extraSkill)=>'post' === extraSkill.order)
3073
+ ];
3074
+ }
3075
+ async function getSkills({ skill, dir, template }, extraSkills, templateName, promptMultiselect = yt) {
3076
+ const parsedSkills = parseSkillsOption(skill);
3077
+ const filteredExtraSkills = filterExtraSkills(extraSkills, templateName);
3078
+ if (null !== parsedSkills) return parsedSkills.filter((value)=>filteredExtraSkills?.some((extraSkill)=>extraSkill.value === value));
3079
+ if (dir && template) return [];
3080
+ if (!filteredExtraSkills?.length) return [];
3081
+ const orderedExtraSkills = orderExtraSkills(filteredExtraSkills);
3082
+ return checkCancel(await promptMultiselect({
3083
+ message: 'Select optional skills (Use <space> to select, <enter> to continue)',
3084
+ options: orderedExtraSkills.map((extraSkill)=>({
3085
+ value: extraSkill.value,
3086
+ label: extraSkill.label,
3087
+ hint: extraSkill.source
3088
+ })),
3089
+ required: false
3090
+ }));
3091
+ }
2266
3092
  function upperFirst(str) {
2267
3093
  return str.charAt(0).toUpperCase() + str.slice(1);
2268
3094
  }
@@ -2280,7 +3106,7 @@ const parseArgv = (processArgv)=>{
2280
3106
  if (argv['package-name']) argv.packageName = argv['package-name'];
2281
3107
  return argv;
2282
3108
  };
2283
- function runCommand(command, cwd, packageManager) {
3109
+ async function runCommand(command, cwd, packageManager) {
2284
3110
  if (command.startsWith('npm create ')) {
2285
3111
  const createReplacements = {
2286
3112
  bun: 'bun create ',
@@ -2292,21 +3118,63 @@ function runCommand(command, cwd, packageManager) {
2292
3118
  if (replacement) command = command.replace('npm create ', replacement).replace(' -- --', ' --');
2293
3119
  if ('yarn' === packageManager) command = command.replace('@latest', '');
2294
3120
  }
2295
- const [bin, ...args] = command.split(' ');
2296
- cross_spawn_default().sync(bin, args, {
2297
- stdio: 'inherit',
2298
- cwd
3121
+ const result = await main_R(command, [], {
3122
+ nodeOptions: {
3123
+ shell: true,
3124
+ stdio: 'inherit',
3125
+ cwd
3126
+ }
3127
+ });
3128
+ if (0 !== result.exitCode) {
3129
+ const details = [
3130
+ result.stderr,
3131
+ result.stdout
3132
+ ].filter(Boolean).join('\n').trim();
3133
+ throw new Error(`Failed to run command: ${command}${details ? `\n${details}` : ''}`);
3134
+ }
3135
+ }
3136
+ async function runSkillCommand(skill, cwd) {
3137
+ const args = [
3138
+ '-y',
3139
+ 'skills',
3140
+ 'add',
3141
+ skill.source,
3142
+ '--agent',
3143
+ 'universal',
3144
+ '--yes',
3145
+ '--copy',
3146
+ '--skill',
3147
+ skill.skill ?? skill.value
3148
+ ];
3149
+ const command = `npx ${args.join(' ')}`;
3150
+ dist_O.info(`Running skill install command: ${color.dim(command)}`);
3151
+ const installationTaskLog = Gt({
3152
+ title: `Installing skill ${skill.value}`
2299
3153
  });
3154
+ const proc = main_R('npx', args, {
3155
+ nodeOptions: {
3156
+ cwd,
3157
+ stdio: 'pipe'
3158
+ }
3159
+ });
3160
+ for await (const line of proc)installationTaskLog.message(line);
3161
+ const result = await proc;
3162
+ if (0 !== result.exitCode) {
3163
+ const message = `Failed to install skill "${skill.value}" from "${skill.source}" using command: ${command}`;
3164
+ installationTaskLog.error(message);
3165
+ throw new Error(message);
3166
+ }
3167
+ installationTaskLog.success(`Installed skill ${skill.value}`);
2300
3168
  }
2301
- async function create({ name, root, templates, skipFiles, getTemplateName, mapESLintTemplate, version, noteInformation, extraTools, argv: processArgv = process.argv }) {
3169
+ async function create({ name, root, templates, skipFiles, getTemplateName, mapESLintTemplate, version, noteInformation, extraTools, extraSkills, argv: processArgv = process.argv }) {
2302
3170
  src_logger.greet(`\n◆ Create ${upperFirst(name)} Project`);
2303
- const { isAgent } = await (0, dist.determineAgent)();
3171
+ const { isAgent } = await (0, dist_0.determineAgent)();
2304
3172
  if (isAgent) {
2305
3173
  console.log('');
2306
3174
  src_logger.info(`To create a project non-interactively, run: npx -y create-${name} <DIR> --template <TEMPLATE>`);
2307
3175
  }
2308
3176
  const argv = parseArgv(processArgv);
2309
- if (argv.help) return void logHelpMessage(name, templates, extraTools);
3177
+ if (argv.help) return void logHelpMessage(name, templates, extraTools, extraSkills);
2310
3178
  const cwd = process.cwd();
2311
3179
  const pkgInfo = pkgFromUserAgent(process.env.npm_config_user_agent);
2312
3180
  const packageManager = pkgInfo ? pkgInfo.name : 'npm';
@@ -2314,7 +3182,7 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
2314
3182
  packageManager
2315
3183
  };
2316
3184
  if (!version) version = (await readPackageJson(root)).version;
2317
- const projectName = argv.dir ?? checkCancel(await Zt({
3185
+ const projectName = argv.dir ?? checkCancel(await Ot({
2318
3186
  message: 'Project name or path',
2319
3187
  placeholder: `${name.toLowerCase()}-project`,
2320
3188
  defaultValue: `${name.toLowerCase()}-project`,
@@ -2327,7 +3195,7 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
2327
3195
  const packageName = argv.packageName || formatted.packageName;
2328
3196
  const distFolder = node_path.isAbsolute(targetDir) ? targetDir : node_path.join(cwd, targetDir);
2329
3197
  if (!argv.override && node_fs.existsSync(distFolder) && !isEmptyDir(distFolder)) {
2330
- const option = checkCancel(await Jt({
3198
+ const option = checkCancel(await _t({
2331
3199
  message: `"${targetDir}" is not empty, please choose:`,
2332
3200
  options: [
2333
3201
  {
@@ -2344,6 +3212,8 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
2344
3212
  }
2345
3213
  const templateName = await getTemplateName(argv);
2346
3214
  const tools = await getTools(argv, extraTools, templateName);
3215
+ const filteredExtraSkills = filterExtraSkills(extraSkills, templateName);
3216
+ const skills = await getSkills(argv, filteredExtraSkills, templateName, yt);
2347
3217
  const srcFolder = node_path.join(root, `template-${templateName}`);
2348
3218
  const commonFolder = node_path.join(root, 'template-common');
2349
3219
  if (!node_fs.existsSync(srcFolder)) throw new Error(`Invalid input: template "${templateName}" not found.`);
@@ -2362,6 +3232,10 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
2362
3232
  templateParameters,
2363
3233
  skipFiles
2364
3234
  });
3235
+ for (const skillValue of skills){
3236
+ const matchedSkill = filteredExtraSkills?.find((extraSkill)=>extraSkill.value === skillValue);
3237
+ if (matchedSkill) await runSkillCommand(matchedSkill, distFolder);
3238
+ }
2365
3239
  const packageRoot = node_path.resolve(src_dirname, '..');
2366
3240
  const agentsMdSearchDirs = [
2367
3241
  commonFolder,
@@ -2376,7 +3250,7 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
2376
3250
  distFolder,
2377
3251
  addAgentsMdSearchDirs: (dir)=>agentsMdSearchDirs.push(dir)
2378
3252
  });
2379
- if (matchedTool.command) runCommand(matchedTool.command, distFolder, packageManager);
3253
+ if (matchedTool.command) await runCommand(matchedTool.command, distFolder, packageManager);
2380
3254
  continue;
2381
3255
  }
2382
3256
  }
@@ -2422,8 +3296,8 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
2422
3296
  `3. ${color.cyan(`${packageManager} install`)}`,
2423
3297
  `4. ${color.cyan(`${packageManager} run dev`)}`
2424
3298
  ];
2425
- if (nextSteps.length) dist_Vt(nextSteps.map((step)=>color.reset(step)).join('\n'), 'Next steps');
2426
- Gt('All set, happy coding!');
3299
+ if (nextSteps.length) wt(nextSteps.map((step)=>color.reset(step)).join('\n'), 'Next steps');
3300
+ gt('All set, happy coding!');
2427
3301
  }
2428
3302
  function sortObjectKeys(obj) {
2429
3303
  const sortedKeys = Object.keys(obj).sort();
@@ -2586,4 +3460,4 @@ function collectAgentsFiles(agentsMdSearchDirs) {
2586
3460
  }
2587
3461
  return agentsFiles;
2588
3462
  }
2589
- export { BUILTIN_TOOLS, Jt as select, Zt as text, checkCancel, collectAgentsFiles, copyFolder, create, dist_Lt as multiselect, mergeAgentsFiles, mergePackageJson };
3463
+ export { Ae as autocomplete, BUILTIN_TOOLS, Ot as text, _t as select, checkCancel, collectAgentsFiles, copyFolder, create, ht as groupMultiselect, mergeAgentsFiles, mergePackageJson, yt as multiselect };