superslate 0.4.0 → 0.8.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.
Files changed (2) hide show
  1. package/dist/cli.js +721 -1073
  2. package/package.json +4 -4
package/dist/cli.js CHANGED
@@ -19,13 +19,15 @@ var __toESM = (mod, isNodeMode, target) => {
19
19
  return cached;
20
20
  }
21
21
  target = mod != null ? __create(__getProtoOf(mod)) : {};
22
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
23
- for (let key of __getOwnPropNames(mod))
24
- if (!__hasOwnProp.call(to, key))
25
- __defProp(to, key, {
26
- get: __accessProp.bind(mod, key),
27
- enumerable: true
28
- });
22
+ const to = isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
23
+ if (mod && typeof mod === "object" || typeof mod === "function") {
24
+ for (let key of __getOwnPropNames(mod))
25
+ if (!__hasOwnProp.call(to, key))
26
+ __defProp(to, key, {
27
+ get: __accessProp.bind(mod, key),
28
+ enumerable: true
29
+ });
30
+ }
29
31
  if (canCache)
30
32
  cache.set(mod, to);
31
33
  return to;
@@ -33,51 +35,51 @@ var __toESM = (mod, isNodeMode, target) => {
33
35
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
34
36
 
35
37
  // node_modules/sisteransi/src/index.js
36
- var require_src = __commonJS((exports, module) => {
37
- var ESC2 = "\x1B";
38
- var CSI2 = `${ESC2}[`;
38
+ var require_src = __commonJS(function(exports, module) {
39
+ var ESC = "\x1B";
40
+ var CSI = `${ESC}[`;
39
41
  var beep = "\x07";
40
42
  var cursor = {
41
43
  to(x, y) {
42
44
  if (!y)
43
- return `${CSI2}${x + 1}G`;
44
- return `${CSI2}${y + 1};${x + 1}H`;
45
+ return `${CSI}${x + 1}G`;
46
+ return `${CSI}${y + 1};${x + 1}H`;
45
47
  },
46
48
  move(x, y) {
47
49
  let ret = "";
48
50
  if (x < 0)
49
- ret += `${CSI2}${-x}D`;
51
+ ret += `${CSI}${-x}D`;
50
52
  else if (x > 0)
51
- ret += `${CSI2}${x}C`;
53
+ ret += `${CSI}${x}C`;
52
54
  if (y < 0)
53
- ret += `${CSI2}${-y}A`;
55
+ ret += `${CSI}${-y}A`;
54
56
  else if (y > 0)
55
- ret += `${CSI2}${y}B`;
57
+ ret += `${CSI}${y}B`;
56
58
  return ret;
57
59
  },
58
- up: (count = 1) => `${CSI2}${count}A`,
59
- down: (count = 1) => `${CSI2}${count}B`,
60
- forward: (count = 1) => `${CSI2}${count}C`,
61
- backward: (count = 1) => `${CSI2}${count}D`,
62
- nextLine: (count = 1) => `${CSI2}E`.repeat(count),
63
- prevLine: (count = 1) => `${CSI2}F`.repeat(count),
64
- left: `${CSI2}G`,
65
- hide: `${CSI2}?25l`,
66
- show: `${CSI2}?25h`,
67
- save: `${ESC2}7`,
68
- restore: `${ESC2}8`
60
+ up: (count = 1) => `${CSI}${count}A`,
61
+ down: (count = 1) => `${CSI}${count}B`,
62
+ forward: (count = 1) => `${CSI}${count}C`,
63
+ backward: (count = 1) => `${CSI}${count}D`,
64
+ nextLine: (count = 1) => `${CSI}E`.repeat(count),
65
+ prevLine: (count = 1) => `${CSI}F`.repeat(count),
66
+ left: `${CSI}G`,
67
+ hide: `${CSI}?25l`,
68
+ show: `${CSI}?25h`,
69
+ save: `${ESC}7`,
70
+ restore: `${ESC}8`
69
71
  };
70
72
  var scroll = {
71
- up: (count = 1) => `${CSI2}S`.repeat(count),
72
- down: (count = 1) => `${CSI2}T`.repeat(count)
73
+ up: (count = 1) => `${CSI}S`.repeat(count),
74
+ down: (count = 1) => `${CSI}T`.repeat(count)
73
75
  };
74
76
  var erase = {
75
- screen: `${CSI2}2J`,
76
- up: (count = 1) => `${CSI2}1J`.repeat(count),
77
- down: (count = 1) => `${CSI2}J`.repeat(count),
78
- line: `${CSI2}2K`,
79
- lineEnd: `${CSI2}K`,
80
- lineStart: `${CSI2}1K`,
77
+ screen: `${CSI}2J`,
78
+ up: (count = 1) => `${CSI}1J`.repeat(count),
79
+ down: (count = 1) => `${CSI}J`.repeat(count),
80
+ line: `${CSI}2K`,
81
+ lineEnd: `${CSI}K`,
82
+ lineStart: `${CSI}1K`,
81
83
  lines(count) {
82
84
  let clear = "";
83
85
  for (let i = 0;i < count; i++)
@@ -440,30 +442,11 @@ function wrapAnsi(string, columns, options) {
440
442
  // node_modules/@clack/core/dist/index.mjs
441
443
  var import_sisteransi = __toESM(require_src(), 1);
442
444
  import { ReadStream } from "node:tty";
443
- function findCursor(s, o, l2) {
444
- if (!l2.some((r) => !r.disabled))
445
+ function findCursor(s, o, l) {
446
+ if (!l.some((r) => !r.disabled))
445
447
  return s;
446
- const t = s + o, n = Math.max(l2.length - 1, 0), e = t < 0 ? n : t > n ? 0 : t;
447
- return l2[e]?.disabled ? findCursor(e, o < 0 ? -1 : 1, l2) : e;
448
- }
449
- function findTextCursor(s, o, l2, i) {
450
- const t = i.split(`
451
- `);
452
- let n = 0, e = s;
453
- for (const r of t) {
454
- if (e <= r.length)
455
- break;
456
- e -= r.length + 1, n++;
457
- }
458
- for (n = Math.max(0, Math.min(t.length - 1, n + l2)), e = Math.min(e, t[n].length) + o;e < 0 && n > 0; )
459
- n--, e += t[n].length + 1;
460
- for (;e > t[n].length && n < t.length - 1; )
461
- e -= t[n].length + 1, n++;
462
- e = Math.max(0, Math.min(t[n].length, e));
463
- let h = 0;
464
- for (let r = 0;r < n; r++)
465
- h += t[r].length + 1;
466
- return h + e;
448
+ const t = s + o, n = Math.max(l.length - 1, 0), e = t < 0 ? n : t > n ? 0 : t;
449
+ return l[e]?.disabled ? findCursor(e, o < 0 ? -1 : 1, l) : e;
467
450
  }
468
451
  var a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
469
452
  var t = [
@@ -495,6 +478,7 @@ var settings = {
495
478
  error: "Something went wrong"
496
479
  },
497
480
  withGuide: true,
481
+ accessible: undefined,
498
482
  date: {
499
483
  monthNames: [...t],
500
484
  messages: {
@@ -506,6 +490,14 @@ var settings = {
506
490
  }
507
491
  }
508
492
  };
493
+ function isAccessible(n) {
494
+ if (n !== undefined)
495
+ return n;
496
+ if (settings.accessible !== undefined)
497
+ return settings.accessible;
498
+ const e = process.env.ACCESSIBLE;
499
+ return e !== undefined && e !== "" && e !== "0" && e !== "false";
500
+ }
509
501
  function isActionKey(n, e) {
510
502
  if (typeof n == "string")
511
503
  return settings.aliases.get(n) === e;
@@ -518,14 +510,14 @@ function diffLines(i, s) {
518
510
  if (i === s)
519
511
  return;
520
512
  const e = i.split(`
521
- `), t2 = s.split(`
522
- `), r = Math.max(e.length, t2.length), f = [];
513
+ `), t = s.split(`
514
+ `), r = Math.max(e.length, t.length), f = [];
523
515
  for (let n = 0;n < r; n++)
524
- e[n] !== t2[n] && f.push(n);
516
+ e[n] !== t[n] && f.push(n);
525
517
  return {
526
518
  lines: f,
527
519
  numLinesBefore: e.length,
528
- numLinesAfter: t2.length,
520
+ numLinesAfter: t.length,
529
521
  numLines: r
530
522
  };
531
523
  }
@@ -542,7 +534,7 @@ function block({
542
534
  input: e = stdin,
543
535
  output: r = stdout,
544
536
  overwrite: o = true,
545
- hideCursor: t2 = true
537
+ hideCursor: n = true
546
538
  } = {}) {
547
539
  const s = l.createInterface({
548
540
  input: e,
@@ -551,10 +543,10 @@ function block({
551
543
  tabSize: 1
552
544
  });
553
545
  l.emitKeypressEvents(e, s), e instanceof ReadStream && e.isTTY && e.setRawMode(true);
554
- const n = (f, { name: a, sequence: p }) => {
546
+ const t = (f, { name: a, sequence: w }) => {
555
547
  const c = String(f);
556
- if (isActionKey([c, a, p], "cancel")) {
557
- t2 && r.write(import_sisteransi.cursor.show), process.exit(0);
548
+ if (isActionKey([c, a, w], "cancel")) {
549
+ n && r.write(import_sisteransi.cursor.show), process.exit(0);
558
550
  return;
559
551
  }
560
552
  if (!o)
@@ -562,39 +554,37 @@ function block({
562
554
  const i = a === "return" ? 0 : -1, m = a === "return" ? -1 : 0;
563
555
  l.moveCursor(r, i, m, () => {
564
556
  l.clearLine(r, 1, () => {
565
- e.once("keypress", n);
557
+ e.once("keypress", t);
566
558
  });
567
559
  });
568
560
  };
569
- return t2 && r.write(import_sisteransi.cursor.hide), e.once("keypress", n), () => {
570
- e.off("keypress", n), t2 && r.write(import_sisteransi.cursor.show), e instanceof ReadStream && e.isTTY && !R && e.setRawMode(false), s.terminal = false, s.close();
561
+ return n && r.write(import_sisteransi.cursor.hide), e.once("keypress", t), () => {
562
+ e.off("keypress", t), n && r.write(import_sisteransi.cursor.show), e instanceof ReadStream && e.isTTY && !R && e.setRawMode(false), s.terminal = false, s.close();
571
563
  };
572
564
  }
573
565
  var getColumns = (e) => ("columns" in e) && typeof e.columns == "number" ? e.columns : 80;
574
566
  var getRows = (e) => ("rows" in e) && typeof e.rows == "number" ? e.rows : 20;
575
- function wrapTextWithPrefix(e, r, o, t2 = o, s = o, n) {
567
+ function wrapTextWithPrefix(e, r, o, n = o, s = o, t) {
576
568
  const f = getColumns(e ?? stdout);
577
569
  return wrapAnsi(r, f - o.length, {
578
570
  hard: true,
579
571
  trim: false
580
572
  }).split(`
581
573
  `).map((c, i, m) => {
582
- const d = n ? n(c, i) : c;
583
- return i === 0 ? `${t2}${d}` : i === m.length - 1 ? `${s}${d}` : `${o}${d}`;
574
+ const d = t ? t(c, i) : c;
575
+ return i === 0 ? `${n}${d}` : i === m.length - 1 ? `${s}${d}` : `${o}${d}`;
584
576
  }).join(`
585
577
  `);
586
578
  }
587
- function runValidation(e, n) {
579
+ function runValidation(e, a) {
588
580
  if ("~standard" in e) {
589
- const a = e["~standard"].validate(n);
590
- if (a instanceof Promise)
591
- throw new TypeError("Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic.");
592
- return a.issues?.at(0)?.message;
581
+ const n = e["~standard"].validate(a);
582
+ return n instanceof Promise ? n.then((r) => r.issues?.at(0)?.message) : n.issues?.at(0)?.message;
593
583
  }
594
- return e(n);
584
+ return e(a);
595
585
  }
596
586
 
597
- class V {
587
+ class y {
598
588
  input;
599
589
  output;
600
590
  _abortSignal;
@@ -609,35 +599,38 @@ class V {
609
599
  error = "";
610
600
  value;
611
601
  userInput = "";
612
- constructor(t2, e = true) {
613
- const { input: i = stdin, output: n = stdout, render: s, signal: r, ...o } = t2;
614
- this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = s.bind(this), this._track = e, this._abortSignal = r, this.input = i, this.output = n;
602
+ get accessible() {
603
+ return isAccessible(this.opts.accessible);
604
+ }
605
+ constructor(t, e = true) {
606
+ const { input: i = stdin, output: s = stdout, render: r, signal: n, ...o } = t;
607
+ this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = r.bind(this), this._track = e, this._abortSignal = n, this.input = i, this.output = s;
615
608
  }
616
609
  unsubscribe() {
617
610
  this._subscribers.clear();
618
611
  }
619
- setSubscriber(t2, e) {
620
- const i = this._subscribers.get(t2) ?? [];
621
- i.push(e), this._subscribers.set(t2, i);
612
+ setSubscriber(t, e) {
613
+ const i = this._subscribers.get(t) ?? [];
614
+ i.push(e), this._subscribers.set(t, i);
622
615
  }
623
- on(t2, e) {
624
- this.setSubscriber(t2, { cb: e });
616
+ on(t, e) {
617
+ this.setSubscriber(t, { cb: e });
625
618
  }
626
- once(t2, e) {
627
- this.setSubscriber(t2, { cb: e, once: true });
619
+ once(t, e) {
620
+ this.setSubscriber(t, { cb: e, once: true });
628
621
  }
629
- emit(t2, ...e) {
630
- const i = this._subscribers.get(t2) ?? [], n = [];
631
- for (const s of i)
632
- s.cb(...e), s.once && n.push(() => i.splice(i.indexOf(s), 1));
633
- for (const s of n)
634
- s();
622
+ emit(t, ...e) {
623
+ const i = this._subscribers.get(t) ?? [], s = [];
624
+ for (const r of i)
625
+ r.cb(...e), r.once && s.push(() => i.splice(i.indexOf(r), 1));
626
+ for (const r of s)
627
+ r();
635
628
  }
636
629
  prompt() {
637
- return new Promise((t2) => {
630
+ return new Promise((t) => {
638
631
  if (this._abortSignal) {
639
632
  if (this._abortSignal.aborted)
640
- return this.state = "cancel", this.close(), t2(CANCEL_SYMBOL);
633
+ return this.state = "cancel", this.close(), t(CANCEL_SYMBOL);
641
634
  this._abortSignal.addEventListener("abort", () => {
642
635
  this.state = "cancel", this.close();
643
636
  }, { once: true });
@@ -649,179 +642,102 @@ class V {
649
642
  escapeCodeTimeout: 50,
650
643
  terminal: true
651
644
  }), this.rl.prompt(), this.opts.initialUserInput !== undefined && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), setRawMode(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
652
- this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(this.value);
645
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t(this.value);
653
646
  }), this.once("cancel", () => {
654
- this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(CANCEL_SYMBOL);
647
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t(CANCEL_SYMBOL);
655
648
  });
656
649
  });
657
650
  }
658
- _isActionKey(t2, e) {
659
- return t2 === "\t";
651
+ _isActionKey(t, e) {
652
+ return t === "\t";
660
653
  }
661
- _shouldSubmit(t2, e) {
654
+ _shouldSubmit(t, e) {
662
655
  return true;
663
656
  }
664
- _setValue(t2) {
665
- this.value = t2, this.emit("value", this.value);
657
+ _setValue(t) {
658
+ this.value = t, this.emit("value", this.value);
666
659
  }
667
- _setUserInput(t2, e) {
668
- this.userInput = t2 ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
660
+ _setUserInput(t, e) {
661
+ this.userInput = t ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
669
662
  }
670
663
  _clearUserInput() {
671
664
  this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
672
665
  }
673
- onKeypress(t2, e) {
674
- if (this._track && e.name !== "return" && (e.name && this._isActionKey(t2, e) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit("cursor", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit("cursor", e.name)), t2 && (t2.toLowerCase() === "y" || t2.toLowerCase() === "n") && this.emit("confirm", t2.toLowerCase() === "y"), this.emit("key", t2, e), e?.name === "return" && this._shouldSubmit(t2, e)) {
675
- if (this.opts.validate) {
676
- const i = runValidation(this.opts.validate, this.value);
677
- i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput));
666
+ async onKeypress(t, e) {
667
+ if (this.state !== "validating") {
668
+ if (this._track && e.name !== "return" && (e.name && this._isActionKey(t, e) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit("cursor", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit("cursor", e.name)), t && (t.toLowerCase() === "y" || t.toLowerCase() === "n") && this.emit("confirm", t.toLowerCase() === "y"), this.emit("key", t, e), e?.name === "return" && this._shouldSubmit(t, e)) {
669
+ if (this.opts.validate) {
670
+ const i = runValidation(this.opts.validate, this.value);
671
+ let s;
672
+ i instanceof Promise ? (this.state = "validating", this.render(), s = await i) : s = i, s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
673
+ }
674
+ this.state !== "error" && (this.state = "submit");
678
675
  }
679
- this.state !== "error" && (this.state = "submit");
676
+ isActionKey([t, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
680
677
  }
681
- isActionKey([t2, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
682
678
  }
683
679
  close() {
684
680
  this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
685
681
  `), setRawMode(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
686
682
  }
687
683
  restoreCursor() {
688
- const t2 = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
684
+ const t = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
689
685
  `).length - 1;
690
- this.output.write(import_sisteransi.cursor.move(-999, t2 * -1));
686
+ this.output.write(import_sisteransi.cursor.move(-999, t * -1));
691
687
  }
692
688
  render() {
693
- const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
689
+ const t = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
694
690
  hard: true,
695
691
  trim: false
696
692
  });
697
- if (t2 !== this._prevFrame) {
693
+ if (t !== this._prevFrame) {
698
694
  if (this.state === "initial")
699
695
  this.output.write(import_sisteransi.cursor.hide);
700
696
  else {
701
- const e = diffLines(this._prevFrame, t2), i = getRows(this.output);
697
+ const e = diffLines(this._prevFrame, t), i = getRows(this.output);
702
698
  if (this.restoreCursor(), e) {
703
- const n = Math.max(0, e.numLinesAfter - i), s = Math.max(0, e.numLinesBefore - i);
704
- let r = e.lines.find((o) => o >= n);
705
- if (r === undefined) {
706
- this._prevFrame = t2;
699
+ const s = Math.max(0, e.numLinesAfter - i), r = Math.max(0, e.numLinesBefore - i);
700
+ let n = e.lines.find((o) => o >= s);
701
+ if (n === undefined) {
702
+ this._prevFrame = t;
707
703
  return;
708
704
  }
709
705
  if (e.lines.length === 1) {
710
- this.output.write(import_sisteransi.cursor.move(0, r - s)), this.output.write(import_sisteransi.erase.lines(1));
711
- const o = t2.split(`
706
+ this.output.write(import_sisteransi.cursor.move(0, n - r)), this.output.write(import_sisteransi.erase.lines(1));
707
+ const o = t.split(`
712
708
  `);
713
- this.output.write(o[r]), this._prevFrame = t2, this.output.write(import_sisteransi.cursor.move(0, o.length - r - 1));
709
+ this.output.write(o[n]), this._prevFrame = t, this.output.write(import_sisteransi.cursor.move(0, o.length - n - 1));
714
710
  return;
715
711
  } else if (e.lines.length > 1) {
716
- if (n < s)
717
- r = n;
712
+ if (s < r)
713
+ n = s;
718
714
  else {
719
- const h = r - s;
715
+ const h = n - r;
720
716
  h > 0 && this.output.write(import_sisteransi.cursor.move(0, h));
721
717
  }
722
718
  this.output.write(import_sisteransi.erase.down());
723
- const f = t2.split(`
724
- `).slice(r);
719
+ const f = t.split(`
720
+ `).slice(n);
725
721
  this.output.write(f.join(`
726
- `)), this._prevFrame = t2;
722
+ `)), this._prevFrame = t;
727
723
  return;
728
724
  }
729
725
  }
730
726
  this.output.write(import_sisteransi.erase.down());
731
727
  }
732
- this.output.write(t2), this.state === "initial" && (this.state = "active"), this._prevFrame = t2;
728
+ this.output.write(t), this.state === "initial" && (this.state = "active"), this._prevFrame = t;
733
729
  }
734
730
  }
735
731
  }
736
- function p$1(l2, e) {
737
- if (l2 === undefined || e.length === 0)
738
- return 0;
739
- const i = e.findIndex((s) => s.value === l2);
740
- return i !== -1 ? i : 0;
741
- }
742
- function g(l2, e) {
743
- return (e.label ?? String(e.value)).toLowerCase().includes(l2.toLowerCase());
744
- }
745
- function m(l2, e) {
746
- if (e)
747
- return l2 ? e : e[0];
748
- }
749
- var T$1 = class T extends V {
750
- filteredOptions;
751
- multiple;
752
- isNavigating = false;
753
- selectedValues = [];
754
- focusedValue;
755
- #e = 0;
756
- #s = "";
757
- #t;
758
- #i;
759
- #n;
760
- get cursor() {
761
- return this.#e;
762
- }
763
- get userInputWithCursor() {
764
- if (!this.userInput)
765
- return styleText(["inverse", "hidden"], "_");
766
- if (this._cursor >= this.userInput.length)
767
- return `${this.userInput}█`;
768
- const e = this.userInput.slice(0, this.cursor), t2 = this.userInput.slice(this.cursor, this.cursor + 1), i = this.userInput.slice(this.cursor + 1);
769
- return `${e}${styleText("inverse", t2)}${i}`;
770
- }
771
- get options() {
772
- return typeof this.#i == "function" ? this.#i() : this.#i;
773
- }
774
- constructor(e) {
775
- super(e), this.#i = e.options, this.#n = e.placeholder;
776
- const t2 = this.options;
777
- this.filteredOptions = [...t2], this.multiple = e.multiple === true, this.#t = typeof e.options == "function" ? e.filter : e.filter ?? g;
778
- let i;
779
- if (e.initialValue && Array.isArray(e.initialValue) ? this.multiple ? i = e.initialValue : i = e.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (i = [this.options[0]?.value]), i)
780
- for (const s of i) {
781
- const n = t2.findIndex((o) => o.value === s);
782
- n !== -1 && (this.toggleSelected(s), this.#e = n);
783
- }
784
- this.focusedValue = this.options[this.#e]?.value, this.on("key", (s, n) => this.#l(s, n)), this.on("userInput", (s) => this.#u(s));
785
- }
786
- _isActionKey(e, t2) {
787
- return e === "\t" || this.multiple && this.isNavigating && t2.name === "space" && e !== undefined && e !== "";
788
- }
789
- #l(e, t2) {
790
- const i = t2.name === "up", s = t2.name === "down", n = t2.name === "return", o = this.userInput === "" || this.userInput === "\t", u = this.#n, a = this.options, f = u !== undefined && u !== "" && a.some((r) => !r.disabled && (this.#t ? this.#t(u, r) : true));
791
- if (t2.name === "tab" && o && f) {
792
- this.userInput === "\t" && this._clearUserInput(), this._setUserInput(u, true), this.isNavigating = false;
793
- return;
794
- }
795
- i || s ? (this.#e = findCursor(this.#e, i ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#e]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = true) : n ? this.value = m(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== undefined && (t2.name === "tab" || this.isNavigating && t2.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = false : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = false);
796
- }
797
- deselectAll() {
798
- this.selectedValues = [];
799
- }
800
- toggleSelected(e) {
801
- this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(e) ? this.selectedValues = this.selectedValues.filter((t2) => t2 !== e) : this.selectedValues = [...this.selectedValues, e] : this.selectedValues = [e]);
802
- }
803
- #u(e) {
804
- if (e !== this.#s) {
805
- this.#s = e;
806
- const t2 = this.options;
807
- e && this.#t ? this.filteredOptions = t2.filter((n) => this.#t?.(e, n)) : this.filteredOptions = [...t2];
808
- const i = p$1(this.focusedValue, this.filteredOptions);
809
- this.#e = findCursor(i, 0, this.filteredOptions);
810
- const s = this.filteredOptions[this.#e];
811
- s && !s.disabled ? this.focusedValue = s.value : this.focusedValue = undefined, this.multiple || (this.focusedValue !== undefined ? this.toggleSelected(this.focusedValue) : this.deselectAll());
812
- }
813
- }
814
- };
815
-
816
- class r extends V {
732
+ class r extends y {
817
733
  get cursor() {
818
734
  return this.value ? 0 : 1;
819
735
  }
820
736
  get _value() {
821
737
  return this.cursor === 0;
822
738
  }
823
- constructor(t2) {
824
- super(t2, false), this.value = !!t2.initialValue, this.on("userInput", () => {
739
+ constructor(t) {
740
+ super(t, false), this.value = !!t.initialValue, this.on("userInput", () => {
825
741
  this.value = this._value;
826
742
  }), this.on("confirm", (i) => {
827
743
  this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = i, this.state = "submit", this.close();
@@ -830,366 +746,7 @@ class r extends V {
830
746
  });
831
747
  }
832
748
  }
833
- var _ = {
834
- Y: { type: "year", len: 4 },
835
- M: { type: "month", len: 2 },
836
- D: { type: "day", len: 2 }
837
- };
838
- function M(r2) {
839
- return [...r2].map((t2) => _[t2]);
840
- }
841
- function P(r2) {
842
- const i = new Intl.DateTimeFormat(r2, {
843
- year: "numeric",
844
- month: "2-digit",
845
- day: "2-digit"
846
- }).formatToParts(new Date(2000, 0, 15)), s = [];
847
- let n = "/";
848
- for (const e of i)
849
- e.type === "literal" ? n = e.value.trim() || e.value : (e.type === "year" || e.type === "month" || e.type === "day") && s.push({ type: e.type, len: e.type === "year" ? 4 : 2 });
850
- return { segments: s, separator: n };
851
- }
852
- function p(r2) {
853
- return Number.parseInt((r2 || "0").replace(/_/g, "0"), 10) || 0;
854
- }
855
- function f(r2) {
856
- return {
857
- year: p(r2.year),
858
- month: p(r2.month),
859
- day: p(r2.day)
860
- };
861
- }
862
- function c(r2, t2) {
863
- return new Date(r2 || 2001, t2 || 1, 0).getDate();
864
- }
865
- function b(r2) {
866
- const { year: t2, month: i, day: s } = f(r2);
867
- if (!t2 || t2 < 0 || t2 > 9999 || !i || i < 1 || i > 12 || !s || s < 1)
868
- return;
869
- const n = new Date(Date.UTC(t2, i - 1, s));
870
- if (!(n.getUTCFullYear() !== t2 || n.getUTCMonth() !== i - 1 || n.getUTCDate() !== s))
871
- return { year: t2, month: i, day: s };
872
- }
873
- function C(r2) {
874
- const t2 = b(r2);
875
- return t2 ? new Date(Date.UTC(t2.year, t2.month - 1, t2.day)) : undefined;
876
- }
877
- function T2(r2, t2, i, s) {
878
- const n = i ? {
879
- year: i.getUTCFullYear(),
880
- month: i.getUTCMonth() + 1,
881
- day: i.getUTCDate()
882
- } : null, e = s ? {
883
- year: s.getUTCFullYear(),
884
- month: s.getUTCMonth() + 1,
885
- day: s.getUTCDate()
886
- } : null;
887
- return r2 === "year" ? { min: n?.year ?? 1, max: e?.year ?? 9999 } : r2 === "month" ? {
888
- min: n && t2.year === n.year ? n.month : 1,
889
- max: e && t2.year === e.year ? e.month : 12
890
- } : {
891
- min: n && t2.year === n.year && t2.month === n.month ? n.day : 1,
892
- max: e && t2.year === e.year && t2.month === e.month ? e.day : c(t2.year, t2.month)
893
- };
894
- }
895
-
896
- class U extends V {
897
- #i;
898
- #o;
899
- #t;
900
- #h;
901
- #u;
902
- #e = { segmentIndex: 0, positionInSegment: 0 };
903
- #n = true;
904
- #s = null;
905
- inlineError = "";
906
- get segmentCursor() {
907
- return { ...this.#e };
908
- }
909
- get segmentValues() {
910
- return { ...this.#t };
911
- }
912
- get segments() {
913
- return this.#i;
914
- }
915
- get separator() {
916
- return this.#o;
917
- }
918
- get formattedValue() {
919
- return this.#l(this.#t);
920
- }
921
- #l(t2) {
922
- return this.#i.map((i) => t2[i.type]).join(this.#o);
923
- }
924
- #r() {
925
- this._setUserInput(this.#l(this.#t)), this._setValue(C(this.#t) ?? undefined);
926
- }
927
- constructor(t2) {
928
- const i = t2.format ? { segments: M(t2.format), separator: t2.separator ?? "/" } : P(t2.locale), s = t2.separator ?? i.separator, n = t2.format ? M(t2.format) : i.segments, e = t2.initialValue ?? t2.defaultValue, m2 = e ? {
929
- year: String(e.getUTCFullYear()).padStart(4, "0"),
930
- month: String(e.getUTCMonth() + 1).padStart(2, "0"),
931
- day: String(e.getUTCDate()).padStart(2, "0")
932
- } : { year: "____", month: "__", day: "__" }, o = n.map((a) => m2[a.type]).join(s);
933
- super({ ...t2, initialUserInput: o }, false), this.#i = n, this.#o = s, this.#t = m2, this.#h = t2.minDate, this.#u = t2.maxDate, this.#r(), this.on("cursor", (a) => this.#f(a)), this.on("key", (a, u) => this.#y(a, u)), this.on("finalize", () => this.#p(t2));
934
- }
935
- #a() {
936
- const t2 = Math.max(0, Math.min(this.#e.segmentIndex, this.#i.length - 1)), i = this.#i[t2];
937
- if (i)
938
- return this.#e.positionInSegment = Math.max(0, Math.min(this.#e.positionInSegment, i.len - 1)), { segment: i, index: t2 };
939
- }
940
- #m(t2) {
941
- this.inlineError = "", this.#s = null;
942
- const i = this.#a();
943
- i && (this.#e.segmentIndex = Math.max(0, Math.min(this.#i.length - 1, i.index + t2)), this.#e.positionInSegment = 0, this.#n = true);
944
- }
945
- #d(t2) {
946
- const i = this.#a();
947
- if (!i)
948
- return;
949
- const { segment: s } = i, n = this.#t[s.type], e = !n || n.replace(/_/g, "") === "", m2 = Number.parseInt((n || "0").replace(/_/g, "0"), 10) || 0, o = T2(s.type, f(this.#t), this.#h, this.#u);
950
- let a;
951
- e ? a = t2 === 1 ? o.min : o.max : a = Math.max(Math.min(o.max, m2 + t2), o.min), this.#t = {
952
- ...this.#t,
953
- [s.type]: a.toString().padStart(s.len, "0")
954
- }, this.#n = true, this.#s = null, this.#r();
955
- }
956
- #f(t2) {
957
- if (t2)
958
- switch (t2) {
959
- case "right":
960
- return this.#m(1);
961
- case "left":
962
- return this.#m(-1);
963
- case "up":
964
- return this.#d(1);
965
- case "down":
966
- return this.#d(-1);
967
- }
968
- }
969
- #y(t2, i) {
970
- if (i?.name === "backspace" || i?.sequence === "" || i?.sequence === "\b" || t2 === "" || t2 === "\b") {
971
- this.inlineError = "";
972
- const n = this.#a();
973
- if (!n)
974
- return;
975
- if (!this.#t[n.segment.type].replace(/_/g, "")) {
976
- this.#m(-1);
977
- return;
978
- }
979
- this.#t[n.segment.type] = "_".repeat(n.segment.len), this.#n = true, this.#e.positionInSegment = 0, this.#r();
980
- return;
981
- }
982
- if (i?.name === "tab") {
983
- this.inlineError = "";
984
- const n = this.#a();
985
- if (!n)
986
- return;
987
- const e = i.shift ? -1 : 1, m2 = n.index + e;
988
- m2 >= 0 && m2 < this.#i.length && (this.#e.segmentIndex = m2, this.#e.positionInSegment = 0, this.#n = true);
989
- return;
990
- }
991
- if (t2 && /^[0-9]$/.test(t2)) {
992
- const n = this.#a();
993
- if (!n)
994
- return;
995
- const { segment: e } = n, m2 = !this.#t[e.type].replace(/_/g, "");
996
- if (this.#n && this.#s !== null && !m2) {
997
- const h = this.#s + t2, d = { ...this.#t, [e.type]: h }, g2 = this.#g(d, e);
998
- if (g2) {
999
- this.inlineError = g2, this.#s = null, this.#n = false;
1000
- return;
1001
- }
1002
- this.inlineError = "", this.#t[e.type] = h, this.#s = null, this.#n = false, this.#r(), n.index < this.#i.length - 1 && (this.#e.segmentIndex = n.index + 1, this.#e.positionInSegment = 0, this.#n = true);
1003
- return;
1004
- }
1005
- this.#n && !m2 && (this.#t[e.type] = "_".repeat(e.len), this.#e.positionInSegment = 0), this.#n = false, this.#s = null;
1006
- const o = this.#t[e.type], a = o.indexOf("_"), u = a >= 0 ? a : Math.min(this.#e.positionInSegment, e.len - 1);
1007
- if (u < 0 || u >= e.len)
1008
- return;
1009
- let l2 = o.slice(0, u) + t2 + o.slice(u + 1), D = false;
1010
- if (u === 0 && o === "__" && (e.type === "month" || e.type === "day")) {
1011
- const h = Number.parseInt(t2, 10);
1012
- l2 = `0${t2}`, D = h <= (e.type === "month" ? 1 : 2);
1013
- }
1014
- if (e.type === "year" && (l2 = (o.replace(/_/g, "") + t2).padStart(e.len, "_")), !l2.includes("_")) {
1015
- const h = { ...this.#t, [e.type]: l2 }, d = this.#g(h, e);
1016
- if (d) {
1017
- this.inlineError = d;
1018
- return;
1019
- }
1020
- }
1021
- this.inlineError = "", this.#t[e.type] = l2;
1022
- const y = l2.includes("_") ? undefined : b(this.#t);
1023
- if (y) {
1024
- const { year: h, month: d } = y, g2 = c(h, d);
1025
- this.#t = {
1026
- year: String(Math.max(0, Math.min(9999, h))).padStart(4, "0"),
1027
- month: String(Math.max(1, Math.min(12, d))).padStart(2, "0"),
1028
- day: String(Math.max(1, Math.min(g2, y.day))).padStart(2, "0")
1029
- };
1030
- }
1031
- this.#r();
1032
- const S = l2.indexOf("_");
1033
- D ? (this.#n = true, this.#s = t2) : S >= 0 ? this.#e.positionInSegment = S : a >= 0 && n.index < this.#i.length - 1 ? (this.#e.segmentIndex = n.index + 1, this.#e.positionInSegment = 0, this.#n = true) : this.#e.positionInSegment = Math.min(u + 1, e.len - 1);
1034
- }
1035
- }
1036
- #g(t2, i) {
1037
- const { month: s, day: n } = f(t2);
1038
- if (i.type === "month" && (s < 0 || s > 12))
1039
- return settings.date.messages.invalidMonth;
1040
- if (i.type === "day" && (n < 0 || n > 31))
1041
- return settings.date.messages.invalidDay(31, "any month");
1042
- }
1043
- #p(t2) {
1044
- const { year: i, month: s, day: n } = f(this.#t);
1045
- if (i && s && n) {
1046
- const e = c(i, s);
1047
- this.#t = {
1048
- ...this.#t,
1049
- day: String(Math.min(n, e)).padStart(2, "0")
1050
- };
1051
- }
1052
- this.value = C(this.#t) ?? t2.defaultValue ?? undefined;
1053
- }
1054
- }
1055
- var u$2 = class u extends V {
1056
- options;
1057
- cursor = 0;
1058
- #t;
1059
- getGroupItems(t2) {
1060
- return this.options.filter((r2) => r2.group === t2);
1061
- }
1062
- isGroupSelected(t2) {
1063
- const r2 = this.getGroupItems(t2), e = this.value;
1064
- return e === undefined ? false : r2.every((s) => e.includes(s.value));
1065
- }
1066
- toggleValue() {
1067
- const t2 = this.options[this.cursor];
1068
- if (t2 !== undefined)
1069
- if (this.value === undefined && (this.value = []), t2.group === true) {
1070
- const r2 = t2.value, e = this.getGroupItems(r2);
1071
- this.isGroupSelected(r2) ? this.value = this.value.filter((s) => e.findIndex((i) => i.value === s) === -1) : this.value = [...this.value, ...e.map((s) => s.value)], this.value = Array.from(new Set(this.value));
1072
- } else {
1073
- const r2 = this.value.includes(t2.value);
1074
- this.value = r2 ? this.value.filter((e) => e !== t2.value) : [...this.value, t2.value];
1075
- }
1076
- }
1077
- constructor(t2) {
1078
- super(t2, false);
1079
- const { options: r2 } = t2;
1080
- this.#t = t2.selectableGroups !== false, this.options = Object.entries(r2).flatMap(([e, s]) => [
1081
- { value: e, group: true, label: e },
1082
- ...s.map((i) => ({ ...i, group: e }))
1083
- ]), this.value = [...t2.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: e }) => e === t2.cursorAt), this.#t ? 0 : 1), this.on("cursor", (e) => {
1084
- switch (e) {
1085
- case "left":
1086
- case "up": {
1087
- this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
1088
- const s = this.options[this.cursor]?.group === true;
1089
- !this.#t && s && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
1090
- break;
1091
- }
1092
- case "down":
1093
- case "right": {
1094
- this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
1095
- const s = this.options[this.cursor]?.group === true;
1096
- !this.#t && s && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
1097
- break;
1098
- }
1099
- case "space":
1100
- this.toggleValue();
1101
- break;
1102
- }
1103
- });
1104
- }
1105
- };
1106
- var o = /* @__PURE__ */ new Set(["up", "down", "left", "right"]);
1107
-
1108
- class h extends V {
1109
- #t = false;
1110
- #s;
1111
- focused = "editor";
1112
- get userInputWithCursor() {
1113
- if (this.state === "submit")
1114
- return this.userInput;
1115
- const t2 = this.userInput;
1116
- if (this.cursor >= t2.length)
1117
- return `${t2}█`;
1118
- const s = t2.slice(0, this.cursor), r2 = t2.slice(this.cursor, this.cursor + 1), i = t2.slice(this.cursor + 1);
1119
- return r2 === `
1120
- ` ? `${s}█
1121
- ${i}` : `${s}${styleText("inverse", r2)}${i}`;
1122
- }
1123
- get cursor() {
1124
- return this._cursor;
1125
- }
1126
- #r(t2) {
1127
- if (this.userInput.length === 0) {
1128
- this._setUserInput(t2);
1129
- return;
1130
- }
1131
- this._setUserInput(this.userInput.slice(0, this.cursor) + t2 + this.userInput.slice(this.cursor));
1132
- }
1133
- #i(t2) {
1134
- const s = this.value ?? "";
1135
- switch (t2) {
1136
- case "up":
1137
- this._cursor = findTextCursor(this._cursor, 0, -1, s);
1138
- return;
1139
- case "down":
1140
- this._cursor = findTextCursor(this._cursor, 0, 1, s);
1141
- return;
1142
- case "left":
1143
- this._cursor = findTextCursor(this._cursor, -1, 0, s);
1144
- return;
1145
- case "right":
1146
- this._cursor = findTextCursor(this._cursor, 1, 0, s);
1147
- return;
1148
- }
1149
- }
1150
- _shouldSubmit(t2, s) {
1151
- if (this.#s)
1152
- return this.focused === "submit" ? true : (this.#r(`
1153
- `), this._cursor++, false);
1154
- const r2 = this.#t;
1155
- return this.#t = true, r2 && this.cursor === this.userInput.length ? (this.userInput[this.cursor - 1] === `
1156
- ` && (this._setUserInput(this.userInput.slice(0, this.cursor - 1) + this.userInput.slice(this.cursor)), this._cursor--), true) : (this.#r(`
1157
- `), this._cursor++, false);
1158
- }
1159
- constructor(t2) {
1160
- const s = t2.initialUserInput ?? t2.initialValue;
1161
- super({
1162
- ...t2,
1163
- initialUserInput: s
1164
- }, false), s !== undefined && (this._cursor = s.length), this.#s = t2.showSubmit ?? false, this.on("key", (r2, i) => {
1165
- if (i?.name && o.has(i.name)) {
1166
- this.#t = false, this.#i(i.name);
1167
- return;
1168
- }
1169
- if (r2 === "\t" && this.#s) {
1170
- this.focused = this.focused === "editor" ? "submit" : "editor";
1171
- return;
1172
- }
1173
- if (i?.name !== "return") {
1174
- if (this.#t = false, i?.name === "backspace" && this.cursor > 0) {
1175
- this._setUserInput(this.userInput.slice(0, this.cursor - 1) + this.userInput.slice(this.cursor)), this._cursor--;
1176
- return;
1177
- }
1178
- if (i?.name === "delete" && this.cursor < this.userInput.length) {
1179
- this._setUserInput(this.userInput.slice(0, this.cursor) + this.userInput.slice(this.cursor + 1));
1180
- return;
1181
- }
1182
- r2 && (this.#s && this.focused === "submit" && (this.focused = "editor"), this.#r(r2 ?? ""), this._cursor++);
1183
- }
1184
- }), this.on("userInput", (r2) => {
1185
- this._setValue(r2);
1186
- }), this.on("finalize", () => {
1187
- this.value || (this.value = t2.defaultValue), this.value === undefined && (this.value = "");
1188
- });
1189
- }
1190
- }
1191
-
1192
- class a extends V {
749
+ class a extends y {
1193
750
  options;
1194
751
  cursor = 0;
1195
752
  get _value() {
@@ -1200,14 +757,14 @@ class a extends V {
1200
757
  }
1201
758
  toggleAll() {
1202
759
  const e = this._enabledOptions, i = this.value !== undefined && this.value.length === e.length;
1203
- this.value = i ? [] : e.map((t2) => t2.value);
760
+ this.value = i ? [] : e.map((t) => t.value);
1204
761
  }
1205
762
  toggleInvert() {
1206
763
  const e = this.value;
1207
764
  if (!e)
1208
765
  return;
1209
- const i = this._enabledOptions.filter((t2) => !e.includes(t2.value));
1210
- this.value = i.map((t2) => t2.value);
766
+ const i = this._enabledOptions.filter((t) => !e.includes(t.value));
767
+ this.value = i.map((t) => t.value);
1211
768
  }
1212
769
  toggleValue() {
1213
770
  this.value === undefined && (this.value = []);
@@ -1216,11 +773,11 @@ class a extends V {
1216
773
  }
1217
774
  constructor(e) {
1218
775
  super(e, false), this.options = e.options, this.value = [...e.initialValues ?? []];
1219
- const i = Math.max(this.options.findIndex(({ value: t2 }) => t2 === e.cursorAt), 0);
1220
- this.cursor = this.options[i]?.disabled ? findCursor(i, 1, this.options) : i, this.on("key", (t2, l2) => {
1221
- l2.name === "a" && this.toggleAll(), l2.name === "i" && this.toggleInvert();
1222
- }), this.on("cursor", (t2) => {
1223
- switch (t2) {
776
+ const i = Math.max(this.options.findIndex(({ value: t }) => t === e.cursorAt), 0);
777
+ this.cursor = this.options[i]?.disabled ? findCursor(i, 1, this.options) : i, this.on("key", (t, l) => {
778
+ l.name === "a" && this.toggleAll(), l.name === "i" && this.toggleInvert();
779
+ }), this.on("cursor", (t) => {
780
+ switch (t) {
1224
781
  case "left":
1225
782
  case "up":
1226
783
  this.cursor = findCursor(this.cursor, -1, this.options);
@@ -1236,7 +793,7 @@ class a extends V {
1236
793
  });
1237
794
  }
1238
795
  }
1239
- var u$1 = class u2 extends V {
796
+ var u$1 = class u extends y {
1240
797
  _mask = "•";
1241
798
  get cursor() {
1242
799
  return this._cursor;
@@ -1247,24 +804,24 @@ var u$1 = class u2 extends V {
1247
804
  get userInputWithCursor() {
1248
805
  if (this.state === "submit" || this.state === "cancel")
1249
806
  return this.masked;
1250
- const t2 = this.userInput;
1251
- if (this.cursor >= t2.length)
807
+ const t = this.userInput;
808
+ if (this.cursor >= t.length)
1252
809
  return `${this.masked}${styleText(["inverse", "hidden"], "_")}`;
1253
- const s = this.masked, r2 = s.slice(0, this.cursor), i = s.slice(this.cursor, this.cursor + 1), o2 = s.slice(this.cursor + 1);
1254
- return `${r2}${styleText("inverse", i)}${o2}`;
810
+ const s = this.masked, r = s.slice(0, this.cursor), i = s.slice(this.cursor, this.cursor + 1), o = s.slice(this.cursor + 1);
811
+ return `${r}${styleText("inverse", i)}${o}`;
1255
812
  }
1256
813
  clear() {
1257
814
  this._clearUserInput();
1258
815
  }
1259
- constructor({ mask: t2, ...s }) {
1260
- super(s), this._mask = t2 ?? "•", this.on("userInput", (r2) => {
1261
- this._setValue(r2);
816
+ constructor({ mask: t, ...s }) {
817
+ super(s), this._mask = t ?? "•", this.on("userInput", (r) => {
818
+ this._setValue(r);
1262
819
  }), this.on("finalize", () => {
1263
820
  this.value === undefined && (this.value = "");
1264
821
  });
1265
822
  }
1266
823
  };
1267
- var n$1 = class n extends V {
824
+ var n$1 = class n extends y {
1268
825
  options;
1269
826
  cursor = 0;
1270
827
  get _selectedValue() {
@@ -1276,8 +833,8 @@ var n$1 = class n extends V {
1276
833
  }
1277
834
  constructor(e) {
1278
835
  super(e, false), this.options = e.options;
1279
- const o2 = this.options.findIndex(({ value: s }) => s === e.initialValue), t2 = o2 === -1 ? 0 : o2;
1280
- this.cursor = this.options[t2]?.disabled ? findCursor(t2, 1, this.options) : t2, this.changeValue(), this.on("cursor", (s) => {
836
+ const o = this.options.findIndex(({ value: s }) => s === e.initialValue), t = o === -1 ? 0 : o;
837
+ this.cursor = this.options[t]?.disabled ? findCursor(t, 1, this.options) : t, this.changeValue(), this.on("cursor", (s) => {
1281
838
  switch (s) {
1282
839
  case "left":
1283
840
  case "up":
@@ -1292,27 +849,27 @@ var n$1 = class n extends V {
1292
849
  });
1293
850
  }
1294
851
  };
1295
- class n2 extends V {
852
+ class n extends y {
1296
853
  get userInputWithCursor() {
1297
854
  if (this.state === "submit")
1298
855
  return this.userInput;
1299
- const t2 = this.userInput;
1300
- if (this.cursor >= t2.length)
856
+ const t = this.userInput;
857
+ if (this.cursor >= t.length)
1301
858
  return `${this.userInput}█`;
1302
- const r2 = t2.slice(0, this.cursor), s = t2.slice(this.cursor, this.cursor + 1), e = t2.slice(this.cursor + 1);
1303
- return `${r2}${styleText("inverse", s)}${e}`;
859
+ const r = t.slice(0, this.cursor), s = t.slice(this.cursor, this.cursor + 1), e = t.slice(this.cursor + 1);
860
+ return `${r}${styleText("inverse", s)}${e}`;
1304
861
  }
1305
862
  get cursor() {
1306
863
  return this._cursor;
1307
864
  }
1308
- constructor(t2) {
865
+ constructor(t) {
1309
866
  super({
1310
- ...t2,
1311
- initialUserInput: t2.initialUserInput ?? t2.initialValue
1312
- }), this.on("userInput", (r2) => {
1313
- this._setValue(r2);
867
+ ...t,
868
+ initialUserInput: t.initialUserInput ?? t.initialValue
869
+ }), this.on("userInput", (r) => {
870
+ this._setValue(r);
1314
871
  }), this.on("finalize", () => {
1315
- this.value || (this.value = t2.defaultValue), this.value === undefined && (this.value = "");
872
+ this.value || (this.value = t.defaultValue), this.value === undefined && (this.value = "");
1316
873
  });
1317
874
  }
1318
875
  }
@@ -1329,8 +886,8 @@ function isUnicodeSupported() {
1329
886
  }
1330
887
  var unicode = isUnicodeSupported();
1331
888
  var isCI = () => process.env.CI === "true";
1332
- var isTTY = (o2) => o2.isTTY === true;
1333
- var unicodeOr = (o2, e) => unicode ? o2 : e;
889
+ var isTTY = (o) => o.isTTY === true;
890
+ var unicodeOr = (o, e) => unicode ? o : e;
1334
891
  var S_STEP_ACTIVE = unicodeOr("◆", "*");
1335
892
  var S_STEP_CANCEL = unicodeOr("■", "x");
1336
893
  var S_STEP_ERROR = unicodeOr("▲", "x");
@@ -1356,8 +913,8 @@ var S_INFO = unicodeOr("●", "•");
1356
913
  var S_SUCCESS = unicodeOr("◆", "*");
1357
914
  var S_WARN = unicodeOr("▲", "!");
1358
915
  var S_ERROR = unicodeOr("■", "x");
1359
- var symbol = (o2) => {
1360
- switch (o2) {
916
+ var symbol = (o) => {
917
+ switch (o) {
1361
918
  case "initial":
1362
919
  case "active":
1363
920
  return styleText2("cyan", S_STEP_ACTIVE);
@@ -1367,37 +924,39 @@ var symbol = (o2) => {
1367
924
  return styleText2("yellow", S_STEP_ERROR);
1368
925
  case "submit":
1369
926
  return styleText2("green", S_STEP_SUBMIT);
927
+ case "validating":
928
+ return styleText2("dim", S_STEP_ACTIVE);
1370
929
  }
1371
930
  };
1372
- var confirm = (i) => {
1373
- const a2 = i.active ?? "Yes", s = i.inactive ?? "No";
931
+ var confirm = (e) => {
932
+ const a = e.active ?? "Yes", o = e.inactive ?? "No";
1374
933
  return new r({
1375
- active: a2,
1376
- inactive: s,
1377
- signal: i.signal,
1378
- input: i.input,
1379
- output: i.output,
1380
- initialValue: i.initialValue ?? true,
934
+ active: a,
935
+ inactive: o,
936
+ signal: e.signal,
937
+ input: e.input,
938
+ output: e.output,
939
+ initialValue: e.initialValue ?? true,
1381
940
  render() {
1382
- const e = i.withGuide ?? settings.withGuide, u4 = `${symbol(this.state)} `, l2 = e ? `${styleText2("gray", S_BAR)} ` : "", f2 = wrapTextWithPrefix(i.output, i.message, l2, u4), o2 = `${e ? `${styleText2("gray", S_BAR)}
1383
- ` : ""}${f2}
1384
- `, c2 = this.value ? a2 : s;
941
+ const i = e.withGuide ?? settings.withGuide, u = `${symbol(this.state)} `, l = i ? `${styleText2("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(e.output, e.message, l, u), s = `${i ? `${styleText2("gray", S_BAR)}
942
+ ` : ""}${f}
943
+ `, c = this.value ? a : o;
1385
944
  switch (this.state) {
1386
945
  case "submit": {
1387
- const r2 = e ? `${styleText2("gray", S_BAR)} ` : "";
1388
- return `${o2}${r2}${styleText2("dim", c2)}`;
946
+ const r = i ? `${styleText2("gray", S_BAR)} ` : "";
947
+ return `${s}${r}${styleText2("dim", c)}`;
1389
948
  }
1390
949
  case "cancel": {
1391
- const r2 = e ? `${styleText2("gray", S_BAR)} ` : "";
1392
- return `${o2}${r2}${styleText2(["strikethrough", "dim"], c2)}${e ? `
950
+ const r = i ? `${styleText2("gray", S_BAR)} ` : "";
951
+ return `${s}${r}${styleText2(["strikethrough", "dim"], c)}${i ? `
1393
952
  ${styleText2("gray", S_BAR)}` : ""}`;
1394
953
  }
1395
954
  default: {
1396
- const r2 = e ? `${styleText2("cyan", S_BAR)} ` : "", g2 = e ? styleText2("cyan", S_BAR_END) : "";
1397
- return `${o2}${r2}${this.value ? `${styleText2("green", S_RADIO_ACTIVE)} ${a2}` : `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a2)}`}${i.vertical ? e ? `
955
+ const r = i ? `${styleText2("cyan", S_BAR)} ` : "", g = i ? styleText2("cyan", S_BAR_END) : "";
956
+ return `${s}${r}${this.value ? `${styleText2("green", S_RADIO_ACTIVE)} ${a}` : `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a)}`}${e.vertical ? i ? `
1398
957
  ${styleText2("cyan", S_BAR)} ` : `
1399
- ` : ` ${styleText2("dim", "/")} `}${this.value ? `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", s)}` : `${styleText2("green", S_RADIO_ACTIVE)} ${s}`}
1400
- ${g2}
958
+ ` : ` ${styleText2("dim", "/")} `}${this.value ? `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", o)}` : `${styleText2("green", S_RADIO_ACTIVE)} ${o}`}
959
+ ${g}
1401
960
  `;
1402
961
  }
1403
962
  }
@@ -1412,23 +971,23 @@ var MULTISELECT_INSTRUCTIONS = [
1412
971
  var log = {
1413
972
  message: (s = [], {
1414
973
  symbol: e = styleText2("gray", S_BAR),
1415
- secondarySymbol: r2 = styleText2("gray", S_BAR),
1416
- output: m2 = process.stdout,
1417
- spacing: l2 = 1,
1418
- withGuide: c2
974
+ secondarySymbol: r = styleText2("gray", S_BAR),
975
+ output: m = process.stdout,
976
+ spacing: l = 1,
977
+ withGuide: c
1419
978
  } = {}) => {
1420
- const t2 = [], o2 = c2 ?? settings.withGuide, f2 = o2 ? r2 : "", O = o2 ? `${e} ` : "", u4 = o2 ? `${r2} ` : "";
1421
- for (let i = 0;i < l2; i++)
1422
- t2.push(f2);
1423
- const g2 = Array.isArray(s) ? s : s.split(`
979
+ const t = [], o = c ?? settings.withGuide, f = o ? r : "", O = o ? `${e} ` : "", u = o ? `${r} ` : "";
980
+ for (let i = 0;i < l; i++)
981
+ t.push(f);
982
+ const g = Array.isArray(s) ? s : s.split(`
1424
983
  `);
1425
- if (g2.length > 0) {
1426
- const [i, ...y] = g2;
1427
- i.length > 0 ? t2.push(`${O}${i}`) : t2.push(o2 ? e : "");
1428
- for (const p2 of y)
1429
- p2.length > 0 ? t2.push(`${u4}${p2}`) : t2.push(o2 ? r2 : "");
984
+ if (g.length > 0) {
985
+ const [i, ...y] = g;
986
+ i.length > 0 ? t.push(`${O}${i}`) : t.push(o ? e : "");
987
+ for (const p of y)
988
+ p.length > 0 ? t.push(`${u}${p}`) : t.push(o ? r : "");
1430
989
  }
1431
- m2.write(`${t2.join(`
990
+ m.write(`${t.join(`
1432
991
  `)}
1433
992
  `);
1434
993
  },
@@ -1451,157 +1010,157 @@ var log = {
1451
1010
  log.message(s, { ...e, symbol: styleText2("red", S_ERROR) });
1452
1011
  }
1453
1012
  };
1454
- var cancel = (o2 = "", t2) => {
1455
- const i = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_END)} ` : "";
1456
- i.write(`${e}${styleText2("red", o2)}
1013
+ var cancel = (o = "", t) => {
1014
+ const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_END)} ` : "";
1015
+ i.write(`${e}${styleText2("red", o)}
1457
1016
 
1458
1017
  `);
1459
1018
  };
1460
- var intro = (o2 = "", t2) => {
1461
- const i = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_START)} ` : "";
1462
- i.write(`${e}${o2}
1019
+ var intro = (o = "", t) => {
1020
+ const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_START)} ` : "";
1021
+ i.write(`${e}${o}
1463
1022
  `);
1464
1023
  };
1465
- var outro = (o2 = "", t2) => {
1466
- const i = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR)}
1024
+ var outro = (o = "", t) => {
1025
+ const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR)}
1467
1026
  ${styleText2("gray", S_BAR_END)} ` : "";
1468
- i.write(`${e}${o2}
1027
+ i.write(`${e}${o}
1469
1028
 
1470
1029
  `);
1471
1030
  };
1472
- var password = (r2) => new u$1({
1473
- validate: r2.validate,
1474
- mask: r2.mask ?? S_PASSWORD_MASK,
1475
- signal: r2.signal,
1476
- input: r2.input,
1477
- output: r2.output,
1031
+ var password = (e) => new u$1({
1032
+ validate: e.validate,
1033
+ mask: e.mask ?? S_PASSWORD_MASK,
1034
+ signal: e.signal,
1035
+ input: e.input,
1036
+ output: e.output,
1478
1037
  render() {
1479
- const e = r2.withGuide ?? settings.withGuide, o2 = `${e ? `${styleText2("gray", S_BAR)}
1480
- ` : ""}${symbol(this.state)} ${r2.message}
1481
- `, c2 = this.userInputWithCursor, i = this.masked;
1038
+ const r = e.withGuide ?? settings.withGuide, o = `${r ? `${styleText2("gray", S_BAR)}
1039
+ ` : ""}${symbol(this.state)} ${e.message}
1040
+ `, m = this.userInputWithCursor, i = this.masked;
1482
1041
  switch (this.state) {
1483
1042
  case "error": {
1484
- const s = e ? `${styleText2("yellow", S_BAR)} ` : "", n3 = e ? `${styleText2("yellow", S_BAR_END)} ` : "", l2 = i ?? "";
1485
- return r2.clearOnError && this.clear(), `${o2.trim()}
1486
- ${s}${l2}
1487
- ${n3}${styleText2("yellow", this.error)}
1043
+ const s = r ? `${styleText2("yellow", S_BAR)} ` : "", n = r ? `${styleText2("yellow", S_BAR_END)} ` : "", d = i ?? "";
1044
+ return e.clearOnError && this.clear(), `${o.trim()}
1045
+ ${s}${d}
1046
+ ${n}${styleText2("yellow", this.error)}
1488
1047
  `;
1489
1048
  }
1490
1049
  case "submit": {
1491
- const s = e ? `${styleText2("gray", S_BAR)} ` : "", n3 = i ? styleText2("dim", i) : "";
1492
- return `${o2}${s}${n3}`;
1050
+ const s = r ? `${styleText2("gray", S_BAR)} ` : "", n = i ? styleText2("dim", i) : "";
1051
+ return `${o}${s}${n}`;
1493
1052
  }
1494
1053
  case "cancel": {
1495
- const s = e ? `${styleText2("gray", S_BAR)} ` : "", n3 = i ? styleText2(["strikethrough", "dim"], i) : "";
1496
- return `${o2}${s}${n3}${i && e ? `
1054
+ const s = r ? `${styleText2("gray", S_BAR)} ` : "", n = i ? styleText2(["strikethrough", "dim"], i) : "";
1055
+ return `${o}${s}${n}${i && r ? `
1497
1056
  ${styleText2("gray", S_BAR)}` : ""}`;
1498
1057
  }
1499
1058
  default: {
1500
- const s = e ? `${styleText2("cyan", S_BAR)} ` : "", n3 = e ? styleText2("cyan", S_BAR_END) : "";
1501
- return `${o2}${s}${c2}
1502
- ${n3}
1059
+ const s = r ? `${styleText2("cyan", S_BAR)} ` : "", n = r ? styleText2("cyan", S_BAR_END) : "";
1060
+ return `${o}${s}${m}
1061
+ ${n}
1503
1062
  `;
1504
1063
  }
1505
1064
  }
1506
1065
  }
1507
1066
  }).prompt();
1508
- var W = (l2) => styleText2("magenta", l2);
1067
+ var W = (l) => styleText2("magenta", l);
1509
1068
  var spinner = ({
1510
- indicator: l2 = "dots",
1511
- onCancel: h2,
1512
- output: n3 = process.stdout,
1069
+ indicator: l = "dots",
1070
+ onCancel: h,
1071
+ output: n = process.stdout,
1513
1072
  cancelMessage: G,
1514
1073
  errorMessage: O,
1515
1074
  frames: E = unicode ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"],
1516
1075
  delay: F = unicode ? 80 : 120,
1517
- signal: m2,
1076
+ signal: m,
1518
1077
  ...I
1519
1078
  } = {}) => {
1520
- const u4 = isCI();
1521
- let M2, T3, d = false, S = false, s = "", p2, w = performance.now();
1522
- const x = getColumns(n3), k = I?.styleFrame ?? W, g2 = (e) => {
1523
- const r2 = e > 1 ? O ?? settings.messages.error : G ?? settings.messages.cancel;
1524
- S = e === 1, d && (a2(r2, e), S && typeof h2 == "function" && h2());
1525
- }, f2 = () => g2(2), i = () => g2(1), A = () => {
1526
- process.on("uncaughtExceptionMonitor", f2), process.on("unhandledRejection", f2), process.on("SIGINT", i), process.on("SIGTERM", i), process.on("exit", g2), m2 && m2.addEventListener("abort", i);
1079
+ const u = isCI();
1080
+ let M, T, d = false, S = false, s = "", p, w = performance.now();
1081
+ const x = getColumns(n), k = I?.styleFrame ?? W, g = (e) => {
1082
+ const r = e > 1 ? O ?? settings.messages.error : G ?? settings.messages.cancel;
1083
+ S = e === 1, d && (a(r, e), S && typeof h == "function" && h());
1084
+ }, f = () => g(2), i = () => g(1), A = () => {
1085
+ process.on("uncaughtExceptionMonitor", f), process.on("unhandledRejection", f), process.on("SIGINT", i), process.on("SIGTERM", i), process.on("exit", g), m && m.addEventListener("abort", i);
1527
1086
  }, H = () => {
1528
- process.removeListener("uncaughtExceptionMonitor", f2), process.removeListener("unhandledRejection", f2), process.removeListener("SIGINT", i), process.removeListener("SIGTERM", i), process.removeListener("exit", g2), m2 && m2.removeEventListener("abort", i);
1087
+ process.removeListener("uncaughtExceptionMonitor", f), process.removeListener("unhandledRejection", f), process.removeListener("SIGINT", i), process.removeListener("SIGTERM", i), process.removeListener("exit", g), m && m.removeEventListener("abort", i);
1529
1088
  }, y = () => {
1530
- if (p2 === undefined)
1089
+ if (p === undefined)
1531
1090
  return;
1532
- u4 && n3.write(`
1091
+ u && n.write(`
1533
1092
  `);
1534
- const r2 = wrapAnsi(p2, x, {
1093
+ const r = wrapAnsi(p, x, {
1535
1094
  hard: true,
1536
1095
  trim: false
1537
1096
  }).split(`
1538
1097
  `);
1539
- r2.length > 1 && n3.write(import_sisteransi2.cursor.up(r2.length - 1)), n3.write(import_sisteransi2.cursor.to(0)), n3.write(import_sisteransi2.erase.down());
1540
- }, C2 = (e) => e.replace(/\.+$/, ""), _2 = (e) => {
1541
- const r2 = (performance.now() - e) / 1000, t2 = Math.floor(r2 / 60), o2 = Math.floor(r2 % 60);
1542
- return t2 > 0 ? `[${t2}m ${o2}s]` : `[${o2}s]`;
1543
- }, N = I.withGuide ?? settings.withGuide, P2 = (e = "") => {
1544
- d = true, M2 = block({ output: n3 }), s = C2(e), w = performance.now(), N && n3.write(`${styleText2("gray", S_BAR)}
1098
+ r.length > 1 && n.write(import_sisteransi2.cursor.up(r.length - 1)), n.write(import_sisteransi2.cursor.to(0)), n.write(import_sisteransi2.erase.down());
1099
+ }, C = (e) => e.replace(/\.+$/, ""), _ = (e) => {
1100
+ const r = (performance.now() - e) / 1000, t = Math.floor(r / 60), o = Math.floor(r % 60);
1101
+ return t > 0 ? `[${t}m ${o}s]` : `[${o}s]`;
1102
+ }, N = I.withGuide ?? settings.withGuide, P = (e = "") => {
1103
+ d = true, M = block({ output: n }), s = C(e), w = performance.now(), N && n.write(`${styleText2("gray", S_BAR)}
1545
1104
  `);
1546
- let r2 = 0, t2 = 0;
1547
- A(), T3 = setInterval(() => {
1548
- if (u4 && s === p2)
1105
+ let r = 0, t = 0;
1106
+ A(), T = setInterval(() => {
1107
+ if (u && s === p)
1549
1108
  return;
1550
- y(), p2 = s;
1551
- const o2 = k(E[r2]);
1109
+ y(), p = s;
1110
+ const o = k(E[r]);
1552
1111
  let v;
1553
- if (u4)
1554
- v = `${o2} ${s}...`;
1555
- else if (l2 === "timer")
1556
- v = `${o2} ${s} ${_2(w)}`;
1112
+ if (u)
1113
+ v = `${o} ${s}...`;
1114
+ else if (l === "timer")
1115
+ v = `${o} ${s} ${_(w)}`;
1557
1116
  else {
1558
- const B = ".".repeat(Math.floor(t2)).slice(0, 3);
1559
- v = `${o2} ${s}${B}`;
1117
+ const B = ".".repeat(Math.floor(t)).slice(0, 3);
1118
+ v = `${o} ${s}${B}`;
1560
1119
  }
1561
1120
  const j = wrapAnsi(v, x, {
1562
1121
  hard: true,
1563
1122
  trim: false
1564
1123
  });
1565
- n3.write(j), r2 = r2 + 1 < E.length ? r2 + 1 : 0, t2 = t2 < 4 ? t2 + 0.125 : 0;
1124
+ n.write(j), r = r + 1 < E.length ? r + 1 : 0, t = t < 4 ? t + 0.125 : 0;
1566
1125
  }, F);
1567
- }, a2 = (e = "", r2 = 0, t2 = false) => {
1126
+ }, a = (e = "", r = 0, t = false) => {
1568
1127
  if (!d)
1569
1128
  return;
1570
- d = false, clearInterval(T3), y();
1571
- const o2 = r2 === 0 ? styleText2("green", S_STEP_SUBMIT) : r2 === 1 ? styleText2("red", S_STEP_CANCEL) : styleText2("red", S_STEP_ERROR);
1572
- s = e ?? s, t2 || (l2 === "timer" ? n3.write(`${o2} ${s} ${_2(w)}
1573
- `) : n3.write(`${o2} ${s}
1574
- `)), H(), M2();
1129
+ d = false, clearInterval(T), y();
1130
+ const o = r === 0 ? styleText2("green", S_STEP_SUBMIT) : r === 1 ? styleText2("red", S_STEP_CANCEL) : styleText2("red", S_STEP_ERROR);
1131
+ s = e ?? s, t || (l === "timer" ? n.write(`${o} ${s} ${_(w)}
1132
+ `) : n.write(`${o} ${s}
1133
+ `)), H(), M();
1575
1134
  };
1576
1135
  return {
1577
- start: P2,
1578
- stop: (e = "") => a2(e, 0),
1136
+ start: P,
1137
+ stop: (e = "") => a(e, 0),
1579
1138
  message: (e = "") => {
1580
- s = C2(e ?? s);
1139
+ s = C(e ?? s);
1581
1140
  },
1582
- cancel: (e = "") => a2(e, 1),
1583
- error: (e = "") => a2(e, 2),
1584
- clear: () => a2("", 0, true),
1141
+ cancel: (e = "") => a(e, 1),
1142
+ error: (e = "") => a(e, 2),
1143
+ clear: () => a("", 0, true),
1585
1144
  get isCancelled() {
1586
1145
  return S;
1587
1146
  }
1588
1147
  };
1589
1148
  };
1590
- var u4 = {
1149
+ var u2 = {
1591
1150
  light: unicodeOr("─", "-"),
1592
1151
  heavy: unicodeOr("━", "="),
1593
1152
  block: unicodeOr("█", "#")
1594
1153
  };
1595
1154
  function progress({
1596
- style: o2 = "heavy",
1155
+ style: o = "heavy",
1597
1156
  max: d = 100,
1598
1157
  size: v = 40,
1599
1158
  ...x
1600
1159
  } = {}) {
1601
- const r2 = spinner(x);
1602
- let a2 = 0, n3 = "";
1603
- const c2 = Math.max(1, d), l2 = Math.max(1, v), S = (t2) => {
1604
- switch (t2) {
1160
+ const r = spinner(x);
1161
+ let a = 0, n = "";
1162
+ const c = Math.max(1, d), l = Math.max(1, v), S = (t) => {
1163
+ switch (t) {
1605
1164
  case "initial":
1606
1165
  case "active":
1607
1166
  return (e) => styleText2("magenta", e);
@@ -1613,23 +1172,23 @@ function progress({
1613
1172
  default:
1614
1173
  return (e) => styleText2("magenta", e);
1615
1174
  }
1616
- }, p2 = (t2, e) => {
1617
- const m2 = Math.floor(a2 / c2 * l2);
1618
- return `${S(t2)(u4[o2].repeat(m2))}${styleText2("dim", u4[o2].repeat(l2 - m2))} ${e}`;
1619
- }, h2 = (t2 = "") => {
1620
- n3 = t2, r2.start(p2("initial", t2));
1621
- }, g2 = (t2 = 1, e) => {
1622
- a2 = Math.min(c2, t2 + a2), r2.message(p2("active", e ?? n3)), n3 = e ?? n3;
1175
+ }, p = (t, e) => {
1176
+ const m = Math.floor(a / c * l);
1177
+ return `${S(t)(u2[o].repeat(m))}${styleText2("dim", u2[o].repeat(l - m))} ${e}`;
1178
+ }, h = (t = "") => {
1179
+ n = t, r.start(p("initial", t));
1180
+ }, g = (t = 1, e) => {
1181
+ a = Math.min(c, t + a), r.message(p("active", e ?? n)), n = e ?? n;
1623
1182
  };
1624
1183
  return {
1625
- start: h2,
1626
- stop: r2.stop,
1627
- cancel: r2.cancel,
1628
- error: r2.error,
1629
- clear: r2.clear,
1630
- advance: g2,
1631
- isCancelled: r2.isCancelled,
1632
- message: (t2) => g2(0, t2)
1184
+ start: h,
1185
+ stop: r.stop,
1186
+ cancel: r.cancel,
1187
+ error: r.error,
1188
+ clear: r.clear,
1189
+ advance: g,
1190
+ isCancelled: r.isCancelled,
1191
+ message: (t) => g(0, t)
1633
1192
  };
1634
1193
  }
1635
1194
  var SELECT_INSTRUCTIONS = [
@@ -1637,39 +1196,45 @@ var SELECT_INSTRUCTIONS = [
1637
1196
  `${styleText2("dim", "Enter:")} confirm`
1638
1197
  ];
1639
1198
  var i = `${styleText2("gray", S_BAR)} `;
1640
- var text = (e) => new n2({
1641
- validate: e.validate,
1642
- placeholder: e.placeholder,
1643
- defaultValue: e.defaultValue,
1644
- initialValue: e.initialValue,
1645
- output: e.output,
1646
- signal: e.signal,
1647
- input: e.input,
1199
+ var text = (t) => new n({
1200
+ validate: t.validate,
1201
+ placeholder: t.placeholder,
1202
+ defaultValue: t.defaultValue,
1203
+ initialValue: t.initialValue,
1204
+ output: t.output,
1205
+ signal: t.signal,
1206
+ input: t.input,
1648
1207
  render() {
1649
- const i2 = e?.withGuide ?? settings.withGuide, s = `${`${i2 ? `${styleText2("gray", S_BAR)}
1650
- ` : ""}${symbol(this.state)} `}${e.message}
1651
- `, c2 = e.placeholder && e.placeholder.length > 0 ? styleText2("inverse", e.placeholder[0]) + styleText2("dim", e.placeholder.slice(1)) : styleText2(["inverse", "hidden"], "_"), o2 = this.userInput ? this.userInputWithCursor : c2, l2 = this.value ?? "";
1208
+ const r = t?.withGuide ?? settings.withGuide, l = `${`${r ? `${styleText2("gray", S_BAR)}
1209
+ ` : ""}${symbol(this.state)} `}${t.message}
1210
+ `, d = t.placeholder && t.placeholder.length > 0 ? styleText2("inverse", t.placeholder[0]) + styleText2("dim", t.placeholder.slice(1)) : styleText2(["inverse", "hidden"], "_"), o = this.userInput ? this.userInputWithCursor : d, s = this.value ?? "";
1652
1211
  switch (this.state) {
1212
+ case "validating": {
1213
+ const n = r ? `${styleText2("cyan", S_BAR)} ` : "", i = r ? styleText2("cyan", S_BAR_END) : "", c = styleText2("dim", o), $ = styleText2("dim", "Validating...");
1214
+ return `${l}${n}${c}
1215
+ ${i} ${$}
1216
+ `;
1217
+ }
1653
1218
  case "error": {
1654
- const n3 = this.error ? ` ${styleText2("yellow", this.error)}` : "", r2 = i2 ? `${styleText2("yellow", S_BAR)} ` : "", d = i2 ? styleText2("yellow", S_BAR_END) : "";
1655
- return `${s.trim()}
1656
- ${r2}${o2}
1657
- ${d}${n3}
1219
+ const n = this.error ? ` ${styleText2("yellow", this.error)}` : "", i = r ? `${styleText2("yellow", S_BAR)} ` : "", c = r ? styleText2("yellow", S_BAR_END) : "";
1220
+ return `${l.trim()}
1221
+ ${i}${o}
1222
+ ${c}${n}
1658
1223
  `;
1659
1224
  }
1660
1225
  case "submit": {
1661
- const n3 = l2 ? ` ${styleText2("dim", l2)}` : "", r2 = i2 ? styleText2("gray", S_BAR) : "";
1662
- return `${s}${r2}${n3}`;
1226
+ const n = s ? `${r ? " " : ""}${styleText2("dim", s)}` : "", i = r ? styleText2("gray", S_BAR) : "";
1227
+ return `${l}${i}${n}`;
1663
1228
  }
1664
1229
  case "cancel": {
1665
- const n3 = l2 ? ` ${styleText2(["strikethrough", "dim"], l2)}` : "", r2 = i2 ? styleText2("gray", S_BAR) : "";
1666
- return `${s}${r2}${n3}${l2.trim() ? `
1667
- ${r2}` : ""}`;
1230
+ const n = s ? ` ${styleText2(["strikethrough", "dim"], s)}` : "", i = r ? styleText2("gray", S_BAR) : "";
1231
+ return `${l}${i}${n}${s.trim() ? `
1232
+ ${i}` : ""}`;
1668
1233
  }
1669
1234
  default: {
1670
- const n3 = i2 ? `${styleText2("cyan", S_BAR)} ` : "", r2 = i2 ? styleText2("cyan", S_BAR_END) : "";
1671
- return `${s}${n3}${o2}
1672
- ${r2}
1235
+ const n = r ? `${styleText2("cyan", S_BAR)} ` : "", i = r ? styleText2("cyan", S_BAR_END) : "";
1236
+ return `${l}${n}${o}
1237
+ ${i}
1673
1238
  `;
1674
1239
  }
1675
1240
  }
@@ -1681,7 +1246,7 @@ import { existsSync, readdirSync, statSync } from "fs";
1681
1246
  import { mkdir as mkdir5, mkdtemp as mkdtemp2, readFile as readFile6, readdir as readdir2, rename as rename2, rm as rm5, rmdir, stat as stat5 } from "fs/promises";
1682
1247
  import { createConnection, createServer } from "net";
1683
1248
  import { fileURLToPath as fileURLToPath2 } from "url";
1684
- import { dirname as dirname2, join as join8, relative as relative2, resolve as resolve4, sep } from "path";
1249
+ import { dirname as dirname3, join as join8, relative as relative2, resolve as resolve4, sep } from "path";
1685
1250
 
1686
1251
  // src/constants.ts
1687
1252
  var CLI_NAME = "superslate";
@@ -1694,6 +1259,7 @@ var BUYER_CLI_NAME = "create-app";
1694
1259
  var BUYER_CLI_PACKAGE_NAME = "create-app";
1695
1260
  var DEFAULT_SCOPE = "@app";
1696
1261
  var SOURCE_BRAND_NAME = "superslate";
1262
+ var DOCS_BASE_URL = "https://docs.superslate.dev";
1697
1263
  var DELIVERY_BASE_URL = "https://dl.superslate.dev";
1698
1264
  var DELIVERY_URL_VARIABLE = "SUPERSLATE_DELIVERY_URL";
1699
1265
  var LICENSE_KEY_VARIABLE2 = "SUPERSLATE_LICENSE_KEY";
@@ -1771,7 +1337,7 @@ function isUnicodeSupported2() {
1771
1337
  }
1772
1338
  var unicode2 = isUnicodeSupported2();
1773
1339
  var isCI2 = () => process.env.CI === "true";
1774
- var unicodeOr2 = (o2, e) => unicode2 ? o2 : e;
1340
+ var unicodeOr2 = (o, e) => unicode2 ? o : e;
1775
1341
  var S_STEP_ACTIVE2 = unicodeOr2("◆", "*");
1776
1342
  var S_STEP_CANCEL2 = unicodeOr2("■", "x");
1777
1343
  var S_STEP_ERROR2 = unicodeOr2("▲", "x");
@@ -1797,8 +1363,8 @@ var S_INFO2 = unicodeOr2("●", "•");
1797
1363
  var S_SUCCESS2 = unicodeOr2("◆", "*");
1798
1364
  var S_WARN2 = unicodeOr2("▲", "!");
1799
1365
  var S_ERROR2 = unicodeOr2("■", "x");
1800
- var symbol2 = (o2) => {
1801
- switch (o2) {
1366
+ var symbol2 = (o) => {
1367
+ switch (o) {
1802
1368
  case "initial":
1803
1369
  case "active":
1804
1370
  return styleText3("cyan", S_STEP_ACTIVE2);
@@ -1808,10 +1374,12 @@ var symbol2 = (o2) => {
1808
1374
  return styleText3("yellow", S_STEP_ERROR2);
1809
1375
  case "submit":
1810
1376
  return styleText3("green", S_STEP_SUBMIT2);
1377
+ case "validating":
1378
+ return styleText3("dim", S_STEP_ACTIVE2);
1811
1379
  }
1812
1380
  };
1813
- var symbolBar = (o2) => {
1814
- switch (o2) {
1381
+ var symbolBar = (o) => {
1382
+ switch (o) {
1815
1383
  case "initial":
1816
1384
  case "active":
1817
1385
  return styleText3("cyan", S_BAR2);
@@ -1823,94 +1391,94 @@ var symbolBar = (o2) => {
1823
1391
  return styleText3("green", S_BAR2);
1824
1392
  }
1825
1393
  };
1826
- function formatInstructionFooter(o2, e) {
1827
- const r2 = [`${e ? `${styleText3("cyan", S_BAR2)} ` : ""}${o2.join(" • ")}`];
1828
- return e && r2.push(styleText3("cyan", S_BAR_END2)), r2;
1829
- }
1830
- var I = (l2, e, w, p2, b2, C2 = false) => {
1831
- let r2 = e, O = 0;
1832
- if (C2)
1833
- for (let i2 = p2 - 1;i2 >= w; i2--) {
1834
- const m2 = l2[i2];
1835
- if (m2 && (r2 -= m2.length), O++, r2 <= b2)
1394
+ function formatInstructionFooter(o, e) {
1395
+ const r = [`${e ? `${styleText3("cyan", S_BAR2)} ` : ""}${o.join(" • ")}`];
1396
+ return e && r.push(styleText3("cyan", S_BAR_END2)), r;
1397
+ }
1398
+ var I = (l, e, w, p, b, C = false) => {
1399
+ let r = e, O = 0;
1400
+ if (C)
1401
+ for (let i = p - 1;i >= w; i--) {
1402
+ const m = l[i];
1403
+ if (m && (r -= m.length), O++, r <= b)
1836
1404
  break;
1837
1405
  }
1838
1406
  else
1839
- for (let i2 = w;i2 < p2; i2++) {
1840
- const m2 = l2[i2];
1841
- if (m2 && (r2 -= m2.length), O++, r2 <= b2)
1407
+ for (let i = w;i < p; i++) {
1408
+ const m = l[i];
1409
+ if (m && (r -= m.length), O++, r <= b)
1842
1410
  break;
1843
1411
  }
1844
- return { lineCount: r2, removals: O };
1412
+ return { lineCount: r, removals: O };
1845
1413
  };
1846
1414
  var limitOptions = ({
1847
- cursor: l2,
1415
+ cursor: l,
1848
1416
  options: e,
1849
1417
  style: w,
1850
- output: p2 = process.stdout,
1851
- maxItems: b2 = Number.POSITIVE_INFINITY,
1852
- columnPadding: C2 = 0,
1853
- rowPadding: r2 = 4
1418
+ output: p = process.stdout,
1419
+ maxItems: b = Number.POSITIVE_INFINITY,
1420
+ columnPadding: C = 0,
1421
+ rowPadding: r = 4
1854
1422
  }) => {
1855
- const i2 = getColumns(p2) - C2, m2 = getRows(p2), M2 = styleText3("dim", "..."), v = Math.max(m2 - r2, 0), a2 = Math.max(Math.min(b2, v), 5);
1856
- let f2 = 0;
1857
- l2 >= a2 - 3 && (f2 = Math.max(Math.min(l2 - a2 + 3, e.length - a2), 0));
1858
- let d = a2 < e.length && f2 > 0, c2 = a2 < e.length && f2 + a2 < e.length;
1859
- const W2 = Math.min(f2 + a2, e.length), s = [];
1860
- let g2 = 0;
1861
- d && g2++, c2 && g2++;
1862
- const T3 = f2 + (d ? 1 : 0), y = W2 - (c2 ? 1 : 0);
1863
- for (let t2 = T3;t2 < y; t2++) {
1864
- const n3 = e[t2], o2 = n3 ? w(n3, t2 === l2) : "", h2 = wrapAnsi(o2, i2, {
1423
+ const i = getColumns(p) - C, m = getRows(p), M = styleText3("dim", "..."), v = Math.max(m - r, 0), a = Math.max(Math.min(b, v), 5);
1424
+ let f = 0;
1425
+ l >= a - 3 && (f = Math.max(Math.min(l - a + 3, e.length - a), 0));
1426
+ let d = a < e.length && f > 0, c = a < e.length && f + a < e.length;
1427
+ const W = Math.min(f + a, e.length), s = [];
1428
+ let g = 0;
1429
+ d && g++, c && g++;
1430
+ const T = f + (d ? 1 : 0), y = W - (c ? 1 : 0);
1431
+ for (let t = T;t < y; t++) {
1432
+ const n = e[t], o = n ? w(n, t === l) : "", h = wrapAnsi(o, i, {
1865
1433
  hard: true,
1866
1434
  trim: false
1867
1435
  }).split(`
1868
1436
  `);
1869
- s.push(h2), g2 += h2.length;
1437
+ s.push(h), g += h.length;
1870
1438
  }
1871
- if (g2 > v) {
1872
- let t2 = 0, n3 = 0, o2 = g2;
1873
- const h2 = l2 - T3;
1874
- let u5 = v;
1875
- const L = () => I(s, o2, 0, h2, u5), E = () => I(s, o2, h2 + 1, s.length, u5, true);
1876
- d ? ({ lineCount: o2, removals: t2 } = L(), o2 > u5 && (c2 || (u5 -= 1), { lineCount: o2, removals: n3 } = E())) : (c2 || (u5 -= 1), { lineCount: o2, removals: n3 } = E(), o2 > u5 && (u5 -= 1, { lineCount: o2, removals: t2 } = L())), t2 > 0 && (d = true, s.splice(0, t2)), n3 > 0 && (c2 = true, s.splice(s.length - n3, n3));
1439
+ if (g > v) {
1440
+ let t = 0, n = 0, o = g;
1441
+ const h = l - T;
1442
+ let u = v;
1443
+ const L = () => I(s, o, 0, h, u), E = () => I(s, o, h + 1, s.length, u, true);
1444
+ d ? ({ lineCount: o, removals: t } = L(), o > u && (c || (u -= 1), { lineCount: o, removals: n } = E())) : (c || (u -= 1), { lineCount: o, removals: n } = E(), o > u && (u -= 1, { lineCount: o, removals: t } = L())), t > 0 && (d = true, s.splice(0, t)), n > 0 && (c = true, s.splice(s.length - n, n));
1877
1445
  }
1878
1446
  const x = [];
1879
- d && x.push(M2);
1880
- for (const t2 of s)
1881
- for (const n3 of t2)
1882
- x.push(n3);
1883
- return c2 && x.push(M2), x;
1447
+ d && x.push(M);
1448
+ for (const t of s)
1449
+ for (const n of t)
1450
+ x.push(n);
1451
+ return c && x.push(M), x;
1884
1452
  };
1885
- var confirm2 = (i2) => {
1886
- const a2 = i2.active ?? "Yes", s = i2.inactive ?? "No";
1453
+ var confirm2 = (e) => {
1454
+ const a = e.active ?? "Yes", o = e.inactive ?? "No";
1887
1455
  return new r({
1888
- active: a2,
1889
- inactive: s,
1890
- signal: i2.signal,
1891
- input: i2.input,
1892
- output: i2.output,
1893
- initialValue: i2.initialValue ?? true,
1456
+ active: a,
1457
+ inactive: o,
1458
+ signal: e.signal,
1459
+ input: e.input,
1460
+ output: e.output,
1461
+ initialValue: e.initialValue ?? true,
1894
1462
  render() {
1895
- const e = i2.withGuide ?? settings.withGuide, u5 = `${symbol2(this.state)} `, l2 = e ? `${styleText3("gray", S_BAR2)} ` : "", f2 = wrapTextWithPrefix(i2.output, i2.message, l2, u5), o2 = `${e ? `${styleText3("gray", S_BAR2)}
1896
- ` : ""}${f2}
1897
- `, c2 = this.value ? a2 : s;
1463
+ const i = e.withGuide ?? settings.withGuide, u = `${symbol2(this.state)} `, l = i ? `${styleText3("gray", S_BAR2)} ` : "", f = wrapTextWithPrefix(e.output, e.message, l, u), s = `${i ? `${styleText3("gray", S_BAR2)}
1464
+ ` : ""}${f}
1465
+ `, c = this.value ? a : o;
1898
1466
  switch (this.state) {
1899
1467
  case "submit": {
1900
- const r2 = e ? `${styleText3("gray", S_BAR2)} ` : "";
1901
- return `${o2}${r2}${styleText3("dim", c2)}`;
1468
+ const r = i ? `${styleText3("gray", S_BAR2)} ` : "";
1469
+ return `${s}${r}${styleText3("dim", c)}`;
1902
1470
  }
1903
1471
  case "cancel": {
1904
- const r2 = e ? `${styleText3("gray", S_BAR2)} ` : "";
1905
- return `${o2}${r2}${styleText3(["strikethrough", "dim"], c2)}${e ? `
1472
+ const r = i ? `${styleText3("gray", S_BAR2)} ` : "";
1473
+ return `${s}${r}${styleText3(["strikethrough", "dim"], c)}${i ? `
1906
1474
  ${styleText3("gray", S_BAR2)}` : ""}`;
1907
1475
  }
1908
1476
  default: {
1909
- const r2 = e ? `${styleText3("cyan", S_BAR2)} ` : "", g2 = e ? styleText3("cyan", S_BAR_END2) : "";
1910
- return `${o2}${r2}${this.value ? `${styleText3("green", S_RADIO_ACTIVE2)} ${a2}` : `${styleText3("dim", S_RADIO_INACTIVE2)} ${styleText3("dim", a2)}`}${i2.vertical ? e ? `
1477
+ const r = i ? `${styleText3("cyan", S_BAR2)} ` : "", g = i ? styleText3("cyan", S_BAR_END2) : "";
1478
+ return `${s}${r}${this.value ? `${styleText3("green", S_RADIO_ACTIVE2)} ${a}` : `${styleText3("dim", S_RADIO_INACTIVE2)} ${styleText3("dim", a)}`}${e.vertical ? i ? `
1911
1479
  ${styleText3("cyan", S_BAR2)} ` : `
1912
- ` : ` ${styleText3("dim", "/")} `}${this.value ? `${styleText3("dim", S_RADIO_INACTIVE2)} ${styleText3("dim", s)}` : `${styleText3("green", S_RADIO_ACTIVE2)} ${s}`}
1913
- ${g2}
1480
+ ` : ` ${styleText3("dim", "/")} `}${this.value ? `${styleText3("dim", S_RADIO_INACTIVE2)} ${styleText3("dim", o)}` : `${styleText3("green", S_RADIO_ACTIVE2)} ${o}`}
1481
+ ${g}
1914
1482
  `;
1915
1483
  }
1916
1484
  }
@@ -1922,83 +1490,83 @@ var MULTISELECT_INSTRUCTIONS2 = [
1922
1490
  `${styleText3("dim", "Space:")} select`,
1923
1491
  `${styleText3("dim", "Enter:")} confirm`
1924
1492
  ];
1925
- var m2 = (i2, u5) => i2.split(`
1926
- `).map((d) => u5(d)).join(`
1493
+ var m = (i, u) => i.split(`
1494
+ `).map((d) => u(d)).join(`
1927
1495
  `);
1928
- var multiselect = (i2) => {
1929
- const u5 = (t2, a2) => {
1930
- const r2 = t2.label ?? String(t2.value);
1931
- return a2 === "disabled" ? `${styleText3("gray", S_CHECKBOX_INACTIVE2)} ${m2(r2, (o2) => styleText3(["strikethrough", "gray"], o2))}${t2.hint ? ` ${styleText3("dim", `(${t2.hint ?? "disabled"})`)}` : ""}` : a2 === "active" ? `${styleText3("cyan", S_CHECKBOX_ACTIVE2)} ${r2}${t2.hint ? ` ${styleText3("dim", `(${t2.hint})`)}` : ""}` : a2 === "selected" ? `${styleText3("green", S_CHECKBOX_SELECTED2)} ${m2(r2, (o2) => styleText3("dim", o2))}${t2.hint ? ` ${styleText3("dim", `(${t2.hint})`)}` : ""}` : a2 === "cancelled" ? `${m2(r2, (o2) => styleText3(["strikethrough", "dim"], o2))}` : a2 === "active-selected" ? `${styleText3("green", S_CHECKBOX_SELECTED2)} ${r2}${t2.hint ? ` ${styleText3("dim", `(${t2.hint})`)}` : ""}` : a2 === "submitted" ? `${m2(r2, (o2) => styleText3("dim", o2))}` : `${styleText3("dim", S_CHECKBOX_INACTIVE2)} ${m2(r2, (o2) => styleText3("dim", o2))}`;
1932
- }, d = i2.required ?? true, v = i2.showInstructions ?? true;
1496
+ var multiselect = (i) => {
1497
+ const u = (t, a) => {
1498
+ const r = t.label ?? String(t.value);
1499
+ return a === "disabled" ? `${styleText3("gray", S_CHECKBOX_INACTIVE2)} ${m(r, (o) => styleText3(["strikethrough", "gray"], o))}${t.hint ? ` ${styleText3("dim", `(${t.hint ?? "disabled"})`)}` : ""}` : a === "active" ? `${styleText3("cyan", S_CHECKBOX_ACTIVE2)} ${r}${t.hint ? ` ${styleText3("dim", `(${t.hint})`)}` : ""}` : a === "selected" ? `${styleText3("green", S_CHECKBOX_SELECTED2)} ${m(r, (o) => styleText3("dim", o))}${t.hint ? ` ${styleText3("dim", `(${t.hint})`)}` : ""}` : a === "cancelled" ? `${m(r, (o) => styleText3(["strikethrough", "dim"], o))}` : a === "active-selected" ? `${styleText3("green", S_CHECKBOX_SELECTED2)} ${r}${t.hint ? ` ${styleText3("dim", `(${t.hint})`)}` : ""}` : a === "submitted" ? `${m(r, (o) => styleText3("dim", o))}` : `${styleText3("dim", S_CHECKBOX_INACTIVE2)} ${m(r, (o) => styleText3("dim", o))}`;
1500
+ }, d = i.required ?? true, x = i.showInstructions ?? true;
1933
1501
  return new a({
1934
- options: i2.options,
1935
- signal: i2.signal,
1936
- input: i2.input,
1937
- output: i2.output,
1938
- initialValues: i2.initialValues,
1502
+ options: i.options,
1503
+ signal: i.signal,
1504
+ input: i.input,
1505
+ output: i.output,
1506
+ initialValues: i.initialValues,
1939
1507
  required: d,
1940
- cursorAt: i2.cursorAt,
1941
- validate(t2) {
1942
- if (d && (t2 === undefined || t2.length === 0))
1508
+ cursorAt: i.cursorAt,
1509
+ validate(t) {
1510
+ if (d && (t === undefined || t.length === 0))
1943
1511
  return `Please select at least one option.
1944
1512
  ${styleText3("reset", styleText3("dim", `Press ${styleText3(["gray", "bgWhite", "inverse"], " space ")} to select, ${styleText3("gray", styleText3("bgWhite", styleText3("inverse", " enter ")))} to submit`))}`;
1945
1513
  },
1946
1514
  render() {
1947
- const t2 = i2.withGuide ?? settings.withGuide, a2 = wrapTextWithPrefix(i2.output, i2.message, t2 ? `${symbolBar(this.state)} ` : "", `${symbol2(this.state)} `), r2 = `${t2 ? `${styleText3("gray", S_BAR2)}
1948
- ` : ""}${a2}
1949
- `, o2 = this.value ?? [], p2 = (n3, l2) => {
1950
- if (n3.disabled)
1951
- return u5(n3, "disabled");
1952
- const s = o2.includes(n3.value);
1953
- return l2 && s ? u5(n3, "active-selected") : s ? u5(n3, "selected") : u5(n3, l2 ? "active" : "inactive");
1515
+ const t = i.withGuide ?? settings.withGuide, a = wrapTextWithPrefix(i.output, i.message, t ? `${symbolBar(this.state)} ` : "", `${symbol2(this.state)} `), r = `${t ? `${styleText3("gray", S_BAR2)}
1516
+ ` : ""}${a}
1517
+ `, o = this.value ?? [], g = (n, l) => {
1518
+ if (n.disabled)
1519
+ return u(n, "disabled");
1520
+ const s = o.includes(n.value);
1521
+ return l && s ? u(n, "active-selected") : s ? u(n, "selected") : u(n, l ? "active" : "inactive");
1954
1522
  };
1955
1523
  switch (this.state) {
1956
1524
  case "submit": {
1957
- const n3 = this.options.filter(({ value: s }) => o2.includes(s)).map((s) => u5(s, "submitted")).join(styleText3("dim", ", ")) || styleText3("dim", "none"), l2 = wrapTextWithPrefix(i2.output, n3, t2 ? `${styleText3("gray", S_BAR2)} ` : "");
1958
- return `${r2}${l2}`;
1525
+ const n = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u(s, "submitted")).join(styleText3("dim", ", ")) || styleText3("dim", "none"), l = wrapTextWithPrefix(i.output, n, t ? `${styleText3("gray", S_BAR2)} ` : "");
1526
+ return `${r}${l}`;
1959
1527
  }
1960
1528
  case "cancel": {
1961
- const n3 = this.options.filter(({ value: s }) => o2.includes(s)).map((s) => u5(s, "cancelled")).join(styleText3("dim", ", "));
1962
- if (n3.trim() === "")
1963
- return `${r2}${styleText3("gray", S_BAR2)}`;
1964
- const l2 = wrapTextWithPrefix(i2.output, n3, t2 ? `${styleText3("gray", S_BAR2)} ` : "");
1965
- return `${r2}${l2}${t2 ? `
1529
+ const n = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u(s, "cancelled")).join(styleText3("dim", ", "));
1530
+ if (n.trim() === "")
1531
+ return `${r}${styleText3("gray", S_BAR2)}`;
1532
+ const l = wrapTextWithPrefix(i.output, n, t ? `${styleText3("gray", S_BAR2)} ` : "");
1533
+ return `${r}${l}${t ? `
1966
1534
  ${styleText3("gray", S_BAR2)}` : ""}`;
1967
1535
  }
1968
1536
  case "error": {
1969
- const n3 = t2 ? `${styleText3("yellow", S_BAR2)} ` : "", l2 = this.error.split(`
1970
- `).map(($, C2) => C2 === 0 ? `${t2 ? `${styleText3("yellow", S_BAR_END2)} ` : ""}${styleText3("yellow", $)}` : ` ${$}`).join(`
1971
- `), s = r2.split(`
1972
- `).length, h2 = l2.split(`
1537
+ const n = t ? `${styleText3("yellow", S_BAR2)} ` : "", l = this.error.split(`
1538
+ `).map(($, v) => v === 0 ? `${t ? `${styleText3("yellow", S_BAR_END2)} ` : ""}${styleText3("yellow", $)}` : ` ${$}`).join(`
1539
+ `), s = r.split(`
1540
+ `).length, h = l.split(`
1973
1541
  `).length + 1;
1974
- return `${r2}${n3}${limitOptions({
1975
- output: i2.output,
1542
+ return `${r}${n}${limitOptions({
1543
+ output: i.output,
1976
1544
  options: this.options,
1977
1545
  cursor: this.cursor,
1978
- maxItems: i2.maxItems,
1979
- columnPadding: n3.length,
1980
- rowPadding: s + h2,
1981
- style: p2
1546
+ maxItems: i.maxItems,
1547
+ columnPadding: n.length,
1548
+ rowPadding: s + h,
1549
+ style: g
1982
1550
  }).join(`
1983
- ${n3}`)}
1984
- ${l2}
1551
+ ${n}`)}
1552
+ ${l}
1985
1553
  `;
1986
1554
  }
1987
1555
  default: {
1988
- const n3 = t2 ? `${styleText3("cyan", S_BAR2)} ` : "", l2 = r2.split(`
1989
- `).length, s = v ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS2, t2) : t2 ? [styleText3("cyan", S_BAR_END2)] : [], h2 = s.join(`
1556
+ const n = t ? `${styleText3("cyan", S_BAR2)} ` : "", l = r.split(`
1557
+ `).length, s = x ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS2, t) : t ? [styleText3("cyan", S_BAR_END2)] : [], h = s.join(`
1990
1558
  `), $ = s.length + 1;
1991
- return `${r2}${n3}${limitOptions({
1992
- output: i2.output,
1559
+ return `${r}${n}${limitOptions({
1560
+ output: i.output,
1993
1561
  options: this.options,
1994
1562
  cursor: this.cursor,
1995
- maxItems: i2.maxItems,
1996
- columnPadding: n3.length,
1997
- rowPadding: l2 + $,
1998
- style: p2
1563
+ maxItems: i.maxItems,
1564
+ columnPadding: n.length,
1565
+ rowPadding: l + $,
1566
+ style: g
1999
1567
  }).join(`
2000
- ${n3}`)}
2001
- ${h2}
1568
+ ${n}`)}
1569
+ ${h}
2002
1570
  `;
2003
1571
  }
2004
1572
  }
@@ -2008,23 +1576,23 @@ ${h2}
2008
1576
  var log2 = {
2009
1577
  message: (s = [], {
2010
1578
  symbol: e = styleText3("gray", S_BAR2),
2011
- secondarySymbol: r2 = styleText3("gray", S_BAR2),
2012
- output: m3 = process.stdout,
2013
- spacing: l2 = 1,
2014
- withGuide: c2
1579
+ secondarySymbol: r = styleText3("gray", S_BAR2),
1580
+ output: m = process.stdout,
1581
+ spacing: l = 1,
1582
+ withGuide: c
2015
1583
  } = {}) => {
2016
- const t2 = [], o2 = c2 ?? settings.withGuide, f2 = o2 ? r2 : "", O = o2 ? `${e} ` : "", u5 = o2 ? `${r2} ` : "";
2017
- for (let i2 = 0;i2 < l2; i2++)
2018
- t2.push(f2);
2019
- const g2 = Array.isArray(s) ? s : s.split(`
1584
+ const t = [], o = c ?? settings.withGuide, f = o ? r : "", O = o ? `${e} ` : "", u = o ? `${r} ` : "";
1585
+ for (let i = 0;i < l; i++)
1586
+ t.push(f);
1587
+ const g = Array.isArray(s) ? s : s.split(`
2020
1588
  `);
2021
- if (g2.length > 0) {
2022
- const [i2, ...y] = g2;
2023
- i2.length > 0 ? t2.push(`${O}${i2}`) : t2.push(o2 ? e : "");
2024
- for (const p2 of y)
2025
- p2.length > 0 ? t2.push(`${u5}${p2}`) : t2.push(o2 ? r2 : "");
1589
+ if (g.length > 0) {
1590
+ const [i, ...y] = g;
1591
+ i.length > 0 ? t.push(`${O}${i}`) : t.push(o ? e : "");
1592
+ for (const p of y)
1593
+ p.length > 0 ? t.push(`${u}${p}`) : t.push(o ? r : "");
2026
1594
  }
2027
- m3.write(`${t2.join(`
1595
+ m.write(`${t.join(`
2028
1596
  `)}
2029
1597
  `);
2030
1598
  },
@@ -2047,107 +1615,107 @@ var log2 = {
2047
1615
  log2.message(s, { ...e, symbol: styleText3("red", S_ERROR2) });
2048
1616
  }
2049
1617
  };
2050
- var cancel2 = (o2 = "", t2) => {
2051
- const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText3("gray", S_BAR_END2)} ` : "";
2052
- i2.write(`${e}${styleText3("red", o2)}
1618
+ var cancel2 = (o = "", t) => {
1619
+ const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText3("gray", S_BAR_END2)} ` : "";
1620
+ i.write(`${e}${styleText3("red", o)}
2053
1621
 
2054
1622
  `);
2055
1623
  };
2056
- var intro2 = (o2 = "", t2) => {
2057
- const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText3("gray", S_BAR_START2)} ` : "";
2058
- i2.write(`${e}${o2}
1624
+ var intro2 = (o = "", t) => {
1625
+ const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText3("gray", S_BAR_START2)} ` : "";
1626
+ i.write(`${e}${o}
2059
1627
  `);
2060
1628
  };
2061
- var outro2 = (o2 = "", t2) => {
2062
- const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText3("gray", S_BAR2)}
1629
+ var outro2 = (o = "", t) => {
1630
+ const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText3("gray", S_BAR2)}
2063
1631
  ${styleText3("gray", S_BAR_END2)} ` : "";
2064
- i2.write(`${e}${o2}
1632
+ i.write(`${e}${o}
2065
1633
 
2066
1634
  `);
2067
1635
  };
2068
- var W2 = (l2) => styleText3("magenta", l2);
1636
+ var W2 = (l) => styleText3("magenta", l);
2069
1637
  var spinner2 = ({
2070
- indicator: l2 = "dots",
2071
- onCancel: h2,
2072
- output: n3 = process.stdout,
1638
+ indicator: l = "dots",
1639
+ onCancel: h,
1640
+ output: n = process.stdout,
2073
1641
  cancelMessage: G,
2074
1642
  errorMessage: O,
2075
1643
  frames: E = unicode2 ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"],
2076
1644
  delay: F = unicode2 ? 80 : 120,
2077
- signal: m3,
2078
- ...I2
1645
+ signal: m,
1646
+ ...I
2079
1647
  } = {}) => {
2080
- const u5 = isCI2();
2081
- let M2, T3, d = false, S = false, s = "", p2, w = performance.now();
2082
- const x = getColumns(n3), k = I2?.styleFrame ?? W2, g2 = (e) => {
2083
- const r2 = e > 1 ? O ?? settings.messages.error : G ?? settings.messages.cancel;
2084
- S = e === 1, d && (a2(r2, e), S && typeof h2 == "function" && h2());
2085
- }, f2 = () => g2(2), i2 = () => g2(1), A = () => {
2086
- process.on("uncaughtExceptionMonitor", f2), process.on("unhandledRejection", f2), process.on("SIGINT", i2), process.on("SIGTERM", i2), process.on("exit", g2), m3 && m3.addEventListener("abort", i2);
1648
+ const u = isCI2();
1649
+ let M, T, d = false, S = false, s = "", p, w = performance.now();
1650
+ const x = getColumns(n), k = I?.styleFrame ?? W2, g = (e) => {
1651
+ const r = e > 1 ? O ?? settings.messages.error : G ?? settings.messages.cancel;
1652
+ S = e === 1, d && (a(r, e), S && typeof h == "function" && h());
1653
+ }, f = () => g(2), i = () => g(1), A = () => {
1654
+ process.on("uncaughtExceptionMonitor", f), process.on("unhandledRejection", f), process.on("SIGINT", i), process.on("SIGTERM", i), process.on("exit", g), m && m.addEventListener("abort", i);
2087
1655
  }, H = () => {
2088
- process.removeListener("uncaughtExceptionMonitor", f2), process.removeListener("unhandledRejection", f2), process.removeListener("SIGINT", i2), process.removeListener("SIGTERM", i2), process.removeListener("exit", g2), m3 && m3.removeEventListener("abort", i2);
1656
+ process.removeListener("uncaughtExceptionMonitor", f), process.removeListener("unhandledRejection", f), process.removeListener("SIGINT", i), process.removeListener("SIGTERM", i), process.removeListener("exit", g), m && m.removeEventListener("abort", i);
2089
1657
  }, y = () => {
2090
- if (p2 === undefined)
1658
+ if (p === undefined)
2091
1659
  return;
2092
- u5 && n3.write(`
1660
+ u && n.write(`
2093
1661
  `);
2094
- const r2 = wrapAnsi(p2, x, {
1662
+ const r = wrapAnsi(p, x, {
2095
1663
  hard: true,
2096
1664
  trim: false
2097
1665
  }).split(`
2098
1666
  `);
2099
- r2.length > 1 && n3.write(import_sisteransi3.cursor.up(r2.length - 1)), n3.write(import_sisteransi3.cursor.to(0)), n3.write(import_sisteransi3.erase.down());
2100
- }, C2 = (e) => e.replace(/\.+$/, ""), _2 = (e) => {
2101
- const r2 = (performance.now() - e) / 1000, t2 = Math.floor(r2 / 60), o2 = Math.floor(r2 % 60);
2102
- return t2 > 0 ? `[${t2}m ${o2}s]` : `[${o2}s]`;
2103
- }, N = I2.withGuide ?? settings.withGuide, P2 = (e = "") => {
2104
- d = true, M2 = block({ output: n3 }), s = C2(e), w = performance.now(), N && n3.write(`${styleText3("gray", S_BAR2)}
1667
+ r.length > 1 && n.write(import_sisteransi3.cursor.up(r.length - 1)), n.write(import_sisteransi3.cursor.to(0)), n.write(import_sisteransi3.erase.down());
1668
+ }, C = (e) => e.replace(/\.+$/, ""), _ = (e) => {
1669
+ const r = (performance.now() - e) / 1000, t = Math.floor(r / 60), o = Math.floor(r % 60);
1670
+ return t > 0 ? `[${t}m ${o}s]` : `[${o}s]`;
1671
+ }, N = I.withGuide ?? settings.withGuide, P = (e = "") => {
1672
+ d = true, M = block({ output: n }), s = C(e), w = performance.now(), N && n.write(`${styleText3("gray", S_BAR2)}
2105
1673
  `);
2106
- let r2 = 0, t2 = 0;
2107
- A(), T3 = setInterval(() => {
2108
- if (u5 && s === p2)
1674
+ let r = 0, t = 0;
1675
+ A(), T = setInterval(() => {
1676
+ if (u && s === p)
2109
1677
  return;
2110
- y(), p2 = s;
2111
- const o2 = k(E[r2]);
1678
+ y(), p = s;
1679
+ const o = k(E[r]);
2112
1680
  let v;
2113
- if (u5)
2114
- v = `${o2} ${s}...`;
2115
- else if (l2 === "timer")
2116
- v = `${o2} ${s} ${_2(w)}`;
1681
+ if (u)
1682
+ v = `${o} ${s}...`;
1683
+ else if (l === "timer")
1684
+ v = `${o} ${s} ${_(w)}`;
2117
1685
  else {
2118
- const B = ".".repeat(Math.floor(t2)).slice(0, 3);
2119
- v = `${o2} ${s}${B}`;
1686
+ const B = ".".repeat(Math.floor(t)).slice(0, 3);
1687
+ v = `${o} ${s}${B}`;
2120
1688
  }
2121
1689
  const j = wrapAnsi(v, x, {
2122
1690
  hard: true,
2123
1691
  trim: false
2124
1692
  });
2125
- n3.write(j), r2 = r2 + 1 < E.length ? r2 + 1 : 0, t2 = t2 < 4 ? t2 + 0.125 : 0;
1693
+ n.write(j), r = r + 1 < E.length ? r + 1 : 0, t = t < 4 ? t + 0.125 : 0;
2126
1694
  }, F);
2127
- }, a2 = (e = "", r2 = 0, t2 = false) => {
1695
+ }, a = (e = "", r = 0, t = false) => {
2128
1696
  if (!d)
2129
1697
  return;
2130
- d = false, clearInterval(T3), y();
2131
- const o2 = r2 === 0 ? styleText3("green", S_STEP_SUBMIT2) : r2 === 1 ? styleText3("red", S_STEP_CANCEL2) : styleText3("red", S_STEP_ERROR2);
2132
- s = e ?? s, t2 || (l2 === "timer" ? n3.write(`${o2} ${s} ${_2(w)}
2133
- `) : n3.write(`${o2} ${s}
2134
- `)), H(), M2();
1698
+ d = false, clearInterval(T), y();
1699
+ const o = r === 0 ? styleText3("green", S_STEP_SUBMIT2) : r === 1 ? styleText3("red", S_STEP_CANCEL2) : styleText3("red", S_STEP_ERROR2);
1700
+ s = e ?? s, t || (l === "timer" ? n.write(`${o} ${s} ${_(w)}
1701
+ `) : n.write(`${o} ${s}
1702
+ `)), H(), M();
2135
1703
  };
2136
1704
  return {
2137
- start: P2,
2138
- stop: (e = "") => a2(e, 0),
1705
+ start: P,
1706
+ stop: (e = "") => a(e, 0),
2139
1707
  message: (e = "") => {
2140
- s = C2(e ?? s);
1708
+ s = C(e ?? s);
2141
1709
  },
2142
- cancel: (e = "") => a2(e, 1),
2143
- error: (e = "") => a2(e, 2),
2144
- clear: () => a2("", 0, true),
1710
+ cancel: (e = "") => a(e, 1),
1711
+ error: (e = "") => a(e, 2),
1712
+ clear: () => a("", 0, true),
2145
1713
  get isCancelled() {
2146
1714
  return S;
2147
1715
  }
2148
1716
  };
2149
1717
  };
2150
- var u5 = {
1718
+ var u3 = {
2151
1719
  light: unicodeOr2("─", "-"),
2152
1720
  heavy: unicodeOr2("━", "="),
2153
1721
  block: unicodeOr2("█", "#")
@@ -2156,63 +1724,63 @@ var SELECT_INSTRUCTIONS2 = [
2156
1724
  `${styleText3("dim", "↑/↓")} to navigate`,
2157
1725
  `${styleText3("dim", "Enter:")} confirm`
2158
1726
  ];
2159
- var c2 = (t2, o2) => t2.includes(`
2160
- `) ? t2.split(`
2161
- `).map((d) => o2(d)).join(`
2162
- `) : o2(t2);
2163
- var select = (t2) => {
2164
- const o2 = (n3, m3) => {
2165
- if (n3 === undefined)
1727
+ var c = (t, o) => t.includes(`
1728
+ `) ? t.split(`
1729
+ `).map((d) => o(d)).join(`
1730
+ `) : o(t);
1731
+ var select = (t) => {
1732
+ const o = (n, m) => {
1733
+ if (n === undefined)
2166
1734
  return "";
2167
- const s = n3.label ?? String(n3.value);
2168
- switch (m3) {
1735
+ const s = n.label ?? String(n.value);
1736
+ switch (m) {
2169
1737
  case "disabled":
2170
- return `${styleText3("gray", S_RADIO_INACTIVE2)} ${c2(s, (i2) => styleText3("gray", i2))}${n3.hint ? ` ${styleText3("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
1738
+ return `${styleText3("gray", S_RADIO_INACTIVE2)} ${c(s, (i) => styleText3("gray", i))}${n.hint ? ` ${styleText3("dim", `(${n.hint ?? "disabled"})`)}` : ""}`;
2171
1739
  case "selected":
2172
- return `${c2(s, (i2) => styleText3("dim", i2))}`;
1740
+ return `${c(s, (i) => styleText3("dim", i))}`;
2173
1741
  case "active":
2174
- return `${styleText3("green", S_RADIO_ACTIVE2)} ${s}${n3.hint ? ` ${styleText3("dim", `(${n3.hint})`)}` : ""}`;
1742
+ return `${styleText3("green", S_RADIO_ACTIVE2)} ${s}${n.hint ? ` ${styleText3("dim", `(${n.hint})`)}` : ""}`;
2175
1743
  case "cancelled":
2176
- return `${c2(s, (i2) => styleText3(["strikethrough", "dim"], i2))}`;
1744
+ return `${c(s, (i) => styleText3(["strikethrough", "dim"], i))}`;
2177
1745
  default:
2178
- return `${styleText3("dim", S_RADIO_INACTIVE2)} ${c2(s, (i2) => styleText3("dim", i2))}`;
1746
+ return `${styleText3("dim", S_RADIO_INACTIVE2)} ${c(s, (i) => styleText3("dim", i))}`;
2179
1747
  }
2180
- }, d = t2.showInstructions ?? true;
1748
+ }, d = t.showInstructions ?? true;
2181
1749
  return new n$1({
2182
- options: t2.options,
2183
- signal: t2.signal,
2184
- input: t2.input,
2185
- output: t2.output,
2186
- initialValue: t2.initialValue,
1750
+ options: t.options,
1751
+ signal: t.signal,
1752
+ input: t.input,
1753
+ output: t.output,
1754
+ initialValue: t.initialValue,
2187
1755
  render() {
2188
- const n3 = t2.withGuide ?? settings.withGuide, m3 = `${symbol2(this.state)} `, s = `${symbolBar(this.state)} `, i2 = wrapTextWithPrefix(t2.output, t2.message, s, m3), u6 = `${n3 ? `${styleText3("gray", S_BAR2)}
2189
- ` : ""}${i2}
1756
+ const n = t.withGuide ?? settings.withGuide, m = `${symbol2(this.state)} `, s = `${symbolBar(this.state)} `, i = wrapTextWithPrefix(t.output, t.message, s, m), u = `${n ? `${styleText3("gray", S_BAR2)}
1757
+ ` : ""}${i}
2190
1758
  `;
2191
1759
  switch (this.state) {
2192
1760
  case "submit": {
2193
- const r2 = n3 ? `${styleText3("gray", S_BAR2)} ` : "", a2 = wrapTextWithPrefix(t2.output, o2(this.options[this.cursor], "selected"), r2);
2194
- return `${u6}${a2}`;
1761
+ const r = n ? `${styleText3("gray", S_BAR2)} ` : "", a = wrapTextWithPrefix(t.output, o(this.options[this.cursor], "selected"), r);
1762
+ return `${u}${a}`;
2195
1763
  }
2196
1764
  case "cancel": {
2197
- const r2 = n3 ? `${styleText3("gray", S_BAR2)} ` : "", a2 = wrapTextWithPrefix(t2.output, o2(this.options[this.cursor], "cancelled"), r2);
2198
- return `${u6}${a2}${n3 ? `
1765
+ const r = n ? `${styleText3("gray", S_BAR2)} ` : "", a = wrapTextWithPrefix(t.output, o(this.options[this.cursor], "cancelled"), r);
1766
+ return `${u}${a}${n ? `
2199
1767
  ${styleText3("gray", S_BAR2)}` : ""}`;
2200
1768
  }
2201
1769
  default: {
2202
- const r2 = n3 ? `${styleText3("cyan", S_BAR2)} ` : "", a2 = u6.split(`
2203
- `).length, p2 = d ? formatInstructionFooter(SELECT_INSTRUCTIONS2, n3) : n3 ? [styleText3("cyan", S_BAR_END2)] : [], b2 = p2.join(`
2204
- `), f2 = p2.length + 1;
2205
- return `${u6}${r2}${limitOptions({
2206
- output: t2.output,
1770
+ const r = n ? `${styleText3("cyan", S_BAR2)} ` : "", a = u.split(`
1771
+ `).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS2, n) : n ? [styleText3("cyan", S_BAR_END2)] : [], f = p.join(`
1772
+ `), b = p.length + 1;
1773
+ return `${u}${r}${limitOptions({
1774
+ output: t.output,
2207
1775
  cursor: this.cursor,
2208
1776
  options: this.options,
2209
- maxItems: t2.maxItems,
2210
- columnPadding: r2.length,
2211
- rowPadding: a2 + f2,
2212
- style: (g2, x) => o2(g2, g2.disabled ? "disabled" : x ? "active" : "inactive")
1777
+ maxItems: t.maxItems,
1778
+ columnPadding: r.length,
1779
+ rowPadding: a + b,
1780
+ style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
2213
1781
  }).join(`
2214
- ${r2}`)}
2215
- ${b2}
1782
+ ${r}`)}
1783
+ ${f}
2216
1784
  `;
2217
1785
  }
2218
1786
  }
@@ -2220,39 +1788,45 @@ ${b2}
2220
1788
  }).prompt();
2221
1789
  };
2222
1790
  var i2 = `${styleText3("gray", S_BAR2)} `;
2223
- var text2 = (e) => new n2({
2224
- validate: e.validate,
2225
- placeholder: e.placeholder,
2226
- defaultValue: e.defaultValue,
2227
- initialValue: e.initialValue,
2228
- output: e.output,
2229
- signal: e.signal,
2230
- input: e.input,
1791
+ var text2 = (t) => new n({
1792
+ validate: t.validate,
1793
+ placeholder: t.placeholder,
1794
+ defaultValue: t.defaultValue,
1795
+ initialValue: t.initialValue,
1796
+ output: t.output,
1797
+ signal: t.signal,
1798
+ input: t.input,
2231
1799
  render() {
2232
- const i3 = e?.withGuide ?? settings.withGuide, s = `${`${i3 ? `${styleText3("gray", S_BAR2)}
2233
- ` : ""}${symbol2(this.state)} `}${e.message}
2234
- `, c3 = e.placeholder && e.placeholder.length > 0 ? styleText3("inverse", e.placeholder[0]) + styleText3("dim", e.placeholder.slice(1)) : styleText3(["inverse", "hidden"], "_"), o2 = this.userInput ? this.userInputWithCursor : c3, l2 = this.value ?? "";
1800
+ const r = t?.withGuide ?? settings.withGuide, l = `${`${r ? `${styleText3("gray", S_BAR2)}
1801
+ ` : ""}${symbol2(this.state)} `}${t.message}
1802
+ `, d = t.placeholder && t.placeholder.length > 0 ? styleText3("inverse", t.placeholder[0]) + styleText3("dim", t.placeholder.slice(1)) : styleText3(["inverse", "hidden"], "_"), o = this.userInput ? this.userInputWithCursor : d, s = this.value ?? "";
2235
1803
  switch (this.state) {
1804
+ case "validating": {
1805
+ const n = r ? `${styleText3("cyan", S_BAR2)} ` : "", i = r ? styleText3("cyan", S_BAR_END2) : "", c = styleText3("dim", o), $ = styleText3("dim", "Validating...");
1806
+ return `${l}${n}${c}
1807
+ ${i} ${$}
1808
+ `;
1809
+ }
2236
1810
  case "error": {
2237
- const n3 = this.error ? ` ${styleText3("yellow", this.error)}` : "", r2 = i3 ? `${styleText3("yellow", S_BAR2)} ` : "", d = i3 ? styleText3("yellow", S_BAR_END2) : "";
2238
- return `${s.trim()}
2239
- ${r2}${o2}
2240
- ${d}${n3}
1811
+ const n = this.error ? ` ${styleText3("yellow", this.error)}` : "", i = r ? `${styleText3("yellow", S_BAR2)} ` : "", c = r ? styleText3("yellow", S_BAR_END2) : "";
1812
+ return `${l.trim()}
1813
+ ${i}${o}
1814
+ ${c}${n}
2241
1815
  `;
2242
1816
  }
2243
1817
  case "submit": {
2244
- const n3 = l2 ? ` ${styleText3("dim", l2)}` : "", r2 = i3 ? styleText3("gray", S_BAR2) : "";
2245
- return `${s}${r2}${n3}`;
1818
+ const n = s ? `${r ? " " : ""}${styleText3("dim", s)}` : "", i = r ? styleText3("gray", S_BAR2) : "";
1819
+ return `${l}${i}${n}`;
2246
1820
  }
2247
1821
  case "cancel": {
2248
- const n3 = l2 ? ` ${styleText3(["strikethrough", "dim"], l2)}` : "", r2 = i3 ? styleText3("gray", S_BAR2) : "";
2249
- return `${s}${r2}${n3}${l2.trim() ? `
2250
- ${r2}` : ""}`;
1822
+ const n = s ? ` ${styleText3(["strikethrough", "dim"], s)}` : "", i = r ? styleText3("gray", S_BAR2) : "";
1823
+ return `${l}${i}${n}${s.trim() ? `
1824
+ ${i}` : ""}`;
2251
1825
  }
2252
1826
  default: {
2253
- const n3 = i3 ? `${styleText3("cyan", S_BAR2)} ` : "", r2 = i3 ? styleText3("cyan", S_BAR_END2) : "";
2254
- return `${s}${n3}${o2}
2255
- ${r2}
1827
+ const n = r ? `${styleText3("cyan", S_BAR2)} ` : "", i = r ? styleText3("cyan", S_BAR_END2) : "";
1828
+ return `${l}${n}${o}
1829
+ ${i}
2256
1830
  `;
2257
1831
  }
2258
1832
  }
@@ -2277,19 +1851,19 @@ function runCaptured(command, options) {
2277
1851
  env: options.env ?? process.env,
2278
1852
  stdio: ["ignore", "pipe", "pipe"]
2279
1853
  });
2280
- let stdout2 = "";
1854
+ let stdout = "";
2281
1855
  let stderr = "";
2282
1856
  child.stdout.setEncoding("utf8");
2283
1857
  child.stderr.setEncoding("utf8");
2284
1858
  child.stdout.on("data", (chunk) => {
2285
- stdout2 += chunk;
1859
+ stdout += chunk;
2286
1860
  });
2287
1861
  child.stderr.on("data", (chunk) => {
2288
1862
  stderr += chunk;
2289
1863
  });
2290
1864
  child.on("error", reject);
2291
1865
  child.on("close", (code, signal) => {
2292
- resolve({ exitCode: code ?? (signal ? 1 : 0), stdout: stdout2, stderr });
1866
+ resolve({ exitCode: code ?? (signal ? 1 : 0), stdout, stderr });
2293
1867
  });
2294
1868
  });
2295
1869
  }
@@ -2319,9 +1893,17 @@ function isExecutable(path) {
2319
1893
 
2320
1894
  // src/agent-setup.ts
2321
1895
  var CLIENTS = ["codex", "claude", "cursor"];
2322
- var SERVER_NAME = "superslate-docs";
2323
- var CODEX_START = "# superslate-agent-context:start";
2324
- var CODEX_END = "# superslate-agent-context:end";
1896
+ var SERVER_NAME = "agent-docs";
1897
+ var CODEX_START = "# agent-context:start";
1898
+ var CODEX_END = "# agent-context:end";
1899
+ var AGENT_CONTEXT_TOOLS = [
1900
+ "search_docs",
1901
+ "search_implementation",
1902
+ "get_repository_map",
1903
+ "plan_change",
1904
+ "get_invariants",
1905
+ "get_verification"
1906
+ ];
2325
1907
  function takeValue(args, index, flag) {
2326
1908
  const value = args[index + 1];
2327
1909
  if (!value || value.startsWith("-"))
@@ -2352,7 +1934,7 @@ function parseAgentSetupArguments(argv) {
2352
1934
  function agentSetupUsage(cliName) {
2353
1935
  return `Usage: ${cliName} agent setup [options]
2354
1936
 
2355
- Connect local coding clients to this checkout's read-only superslate documentation server.
1937
+ Connect local coding clients to this checkout's read-only project context server.
2356
1938
 
2357
1939
  Options:
2358
1940
  --clients <list> Comma-separated clients: codex,claude,cursor
@@ -2373,12 +1955,12 @@ async function findAgentRepositoryRoot(start = process.cwd()) {
2373
1955
  }
2374
1956
  const parent = dirname(current);
2375
1957
  if (parent === current)
2376
- throw new Error("Run agent setup inside a superslate repository.");
1958
+ throw new Error("Run agent setup inside a project repository.");
2377
1959
  current = parent;
2378
1960
  }
2379
1961
  }
2380
1962
  function serverCommand(root) {
2381
- return { command: "pnpm", args: ["--dir", resolve(root), "superslate:mcp"] };
1963
+ return { command: "pnpm", args: ["--dir", resolve(root), "agent:mcp"] };
2382
1964
  }
2383
1965
  function codexManagedBlock(root) {
2384
1966
  const server = serverCommand(root);
@@ -2388,7 +1970,7 @@ function codexManagedBlock(root) {
2388
1970
  command = ${JSON.stringify(server.command)}
2389
1971
  args = [${args}]
2390
1972
  required = false
2391
- enabled_tools = ["search_docs", "get_repository_map", "plan_change", "get_invariants", "get_verification"]
1973
+ enabled_tools = ${JSON.stringify(AGENT_CONTEXT_TOOLS)}
2392
1974
  ${CODEX_END}`;
2393
1975
  }
2394
1976
  function mergeCodexConfig(existing, root) {
@@ -2397,14 +1979,14 @@ function mergeCodexConfig(existing, root) {
2397
1979
  const end = existing.indexOf(CODEX_END);
2398
1980
  if (start >= 0 || end >= 0) {
2399
1981
  if (start < 0 || end < start)
2400
- throw new Error("Codex config has an incomplete superslate block.");
1982
+ throw new Error("Codex config has an incomplete agent-context block.");
2401
1983
  const after = end + CODEX_END.length;
2402
1984
  return `${existing.slice(0, start).trimEnd()}
2403
1985
 
2404
1986
  ${managed}${existing.slice(after)}`.trimStart();
2405
1987
  }
2406
- if (/^\[mcp_servers\.(?:superslate-docs|superslate_docs|"superslate-docs")\]$/m.test(existing)) {
2407
- throw new Error("Codex already has an unmanaged superslate-docs server; remove or rename it first.");
1988
+ if (/^\[mcp_servers\.(?:agent-docs|agent_docs|"agent-docs")\]$/m.test(existing)) {
1989
+ throw new Error("Codex already has an unmanaged agent-docs server; remove or rename it first.");
2408
1990
  }
2409
1991
  return `${existing.trimEnd()}${existing.trim() ? `
2410
1992
 
@@ -2430,7 +2012,7 @@ function mergeCursorConfig(existing, root) {
2430
2012
  const current = servers[SERVER_NAME];
2431
2013
  const desired = serverCommand(root);
2432
2014
  if (current !== undefined && JSON.stringify(current) !== JSON.stringify(desired)) {
2433
- throw new Error("Cursor already has a different superslate-docs server; remove or rename it first.");
2015
+ throw new Error("Cursor already has a different agent-docs server; remove or rename it first.");
2434
2016
  }
2435
2017
  config.mcpServers = { ...servers, [SERVER_NAME]: desired };
2436
2018
  return `${JSON.stringify(config, null, 2)}
@@ -2460,7 +2042,7 @@ async function addGitInfoExcludes(root, paths) {
2460
2042
  const prefix = existing && !existing.endsWith(`
2461
2043
  `) ? `
2462
2044
  ` : "";
2463
- const marker = "# superslate local agent configuration";
2045
+ const marker = "# Local agent configuration";
2464
2046
  const heading = existing.split(/\r?\n/).includes(marker) ? "" : `${marker}
2465
2047
  `;
2466
2048
  await atomicWrite(excludePath, `${existing}${prefix}${heading}${missing.join(`
@@ -2491,10 +2073,10 @@ async function configureClaude(root) {
2491
2073
  if (existing.exitCode === 0) {
2492
2074
  const combined = `${existing.stdout}
2493
2075
  ${existing.stderr}`;
2494
- if (combined.includes("superslate:mcp") && combined.includes(root)) {
2076
+ if (combined.includes("agent:mcp") && combined.includes(root)) {
2495
2077
  return "Claude Code already has the matching local server.";
2496
2078
  }
2497
- throw new Error("Claude Code already has a different superslate-docs server; remove it first.");
2079
+ throw new Error("Claude Code already has a different agent-docs server; remove it first.");
2498
2080
  }
2499
2081
  const server = serverCommand(root);
2500
2082
  const result = await capture(["claude", "mcp", "add", SERVER_NAME, "--scope", "local", "--", server.command, ...server.args], root);
@@ -2505,14 +2087,15 @@ ${existing.stderr}`;
2505
2087
  return "Configured Claude Code local project scope.";
2506
2088
  }
2507
2089
  async function smokeServer(root) {
2508
- const result = await capture(["pnpm", "--dir", root, "superslate:mcp", "--check", "--root", root], root);
2090
+ const result = await capture(["pnpm", "--dir", root, "agent:mcp", "--check", "--root", root], root);
2509
2091
  if (result.exitCode !== 0) {
2510
2092
  const output = result.stderr.trim() || result.stdout.trim();
2511
- throw new Error(`superslate MCP self-check failed${output ? `: ${output}` : "."}`);
2093
+ throw new Error(`Agent context MCP self-check failed${output ? `: ${output}` : "."}`);
2512
2094
  }
2513
2095
  const report = JSON.parse(result.stdout);
2514
- if (!report.ok || report.tools !== 5)
2515
- throw new Error("superslate MCP self-check was incomplete.");
2096
+ if (!report.ok || report.tools !== AGENT_CONTEXT_TOOLS.length) {
2097
+ throw new Error("Agent context MCP self-check was incomplete.");
2098
+ }
2516
2099
  }
2517
2100
  function detectedClients() {
2518
2101
  return CLIENTS.filter((client) => {
@@ -2582,7 +2165,7 @@ async function runAgentSetup(argv, cliName) {
2582
2165
  const clients = await chooseClients(parsed);
2583
2166
  if (!clients)
2584
2167
  return;
2585
- intro2("superslate local agent context");
2168
+ intro2("Local agent context");
2586
2169
  if (parsed.dryRun) {
2587
2170
  for (const client of clients) {
2588
2171
  log2.info(`${client}
@@ -2591,16 +2174,16 @@ ${dryRunDescription(client, root)}`);
2591
2174
  outro2("Dry run complete. No client configuration was changed.");
2592
2175
  return;
2593
2176
  }
2594
- const progress2 = spinner2();
2595
- progress2.start("Testing the local MCP server");
2177
+ const progress = spinner2();
2178
+ progress.start("Testing the local MCP server");
2596
2179
  await smokeServer(root);
2597
- progress2.stop("Local MCP server passed its protocol self-check");
2180
+ progress.stop("Local MCP server passed its protocol self-check");
2598
2181
  for (const client of clients) {
2599
2182
  const result = client === "codex" ? await configureCodex(root) : client === "cursor" ? await configureCursor(root) : await configureClaude(root);
2600
2183
  log2.success(`${client}: ${result}`);
2601
2184
  }
2602
2185
  log2.info("Restart configured clients, then ask: “Use plan_change for my next feature.”");
2603
- outro2("superslate agent context is ready.");
2186
+ outro2("Agent context is ready.");
2604
2187
  }
2605
2188
 
2606
2189
  // src/deployment-cli.ts
@@ -2735,7 +2318,8 @@ Create a GitHub environment named \`${config.environment}\` and configure:
2735
2318
  - a \`BACKEND_HCL\` secret containing the selected remote-state backend configuration;
2736
2319
  - a \`TFVARS_JSON\` secret containing only:
2737
2320
  - ${providerInputs};
2738
- - \`VITE_TERMS_URL\` and \`VITE_PRIVACY_URL\`.
2321
+ - \`VITE_TERMS_URL\` and \`VITE_PRIVACY_URL\`, plus \`VITE_MARKETING_URL\` when the product has a
2322
+ public marketing site.
2739
2323
 
2740
2324
  ## Cloud preparation
2741
2325
 
@@ -2978,25 +2562,25 @@ function runCaptured2(command, options) {
2978
2562
  const [file, ...args] = command;
2979
2563
  if (!file)
2980
2564
  throw new Error("runCaptured requires a command");
2981
- return new Promise((resolve3, reject) => {
2565
+ return new Promise((resolve, reject) => {
2982
2566
  const child = spawn2(file, args, {
2983
2567
  cwd: options.cwd,
2984
2568
  env: options.env ?? process.env,
2985
2569
  stdio: ["ignore", "pipe", "pipe"]
2986
2570
  });
2987
- let stdout2 = "";
2571
+ let stdout = "";
2988
2572
  let stderr = "";
2989
2573
  child.stdout.setEncoding("utf8");
2990
2574
  child.stderr.setEncoding("utf8");
2991
2575
  child.stdout.on("data", (chunk) => {
2992
- stdout2 += chunk;
2576
+ stdout += chunk;
2993
2577
  });
2994
2578
  child.stderr.on("data", (chunk) => {
2995
2579
  stderr += chunk;
2996
2580
  });
2997
2581
  child.on("error", reject);
2998
2582
  child.on("close", (code, signal) => {
2999
- resolve3({ exitCode: code ?? (signal ? 1 : 0), stdout: stdout2, stderr });
2583
+ resolve({ exitCode: code ?? (signal ? 1 : 0), stdout, stderr });
3000
2584
  });
3001
2585
  });
3002
2586
  }
@@ -3004,7 +2588,7 @@ function runInherited(command, options) {
3004
2588
  const [file, ...args] = command;
3005
2589
  if (!file)
3006
2590
  throw new Error("runInherited requires a command");
3007
- return new Promise((resolve3, reject) => {
2591
+ return new Promise((resolve, reject) => {
3008
2592
  const child = spawn2(file, args, {
3009
2593
  cwd: options.cwd,
3010
2594
  env: options.env ?? process.env,
@@ -3012,7 +2596,7 @@ function runInherited(command, options) {
3012
2596
  });
3013
2597
  child.on("error", reject);
3014
2598
  child.on("close", (code, signal) => {
3015
- resolve3(code ?? (signal === "SIGINT" ? 130 : 1));
2599
+ resolve(code ?? (signal === "SIGINT" ? 130 : 1));
3016
2600
  });
3017
2601
  });
3018
2602
  }
@@ -3244,7 +2828,8 @@ Create a GitHub environment named \`${config.environment}\` and configure:
3244
2828
  - a \`BACKEND_HCL\` secret containing the selected remote-state backend configuration;
3245
2829
  - a \`TFVARS_JSON\` secret containing only:
3246
2830
  - ${providerInputs};
3247
- - \`VITE_TERMS_URL\` and \`VITE_PRIVACY_URL\`.
2831
+ - \`VITE_TERMS_URL\` and \`VITE_PRIVACY_URL\`, plus \`VITE_MARKETING_URL\` when the product has a
2832
+ public marketing site.
3248
2833
 
3249
2834
  ## Cloud preparation
3250
2835
 
@@ -3331,7 +2916,7 @@ import { execFile } from "node:child_process";
3331
2916
  import { createHash } from "node:crypto";
3332
2917
  import { cp, lstat, mkdir as mkdir4, mkdtemp, readFile as readFile5, readdir, rm as rm4, stat as stat4, writeFile as writeFile4 } from "node:fs/promises";
3333
2918
  import { tmpdir } from "node:os";
3334
- import { basename, join as join7, relative, resolve as resolve3 } from "node:path";
2919
+ import { basename, dirname as dirname2, join as join7, relative, resolve as resolve3 } from "node:path";
3335
2920
  import { promisify } from "node:util";
3336
2921
 
3337
2922
  // src/delivery.ts
@@ -3446,6 +3031,9 @@ var BRAND_MANIFEST = [
3446
3031
  { path: "apps/web/public/favicon/site.webmanifest", occurrences: 2 },
3447
3032
  { path: "apps/web/public/offline.html", occurrences: 6 },
3448
3033
  { path: "apps/docs/lib/shared.ts", occurrences: 1 },
3034
+ { path: "apps/docs/README.md", occurrences: 1 },
3035
+ { path: "README.md", occurrences: 1 },
3036
+ { path: "docs/meta.json", occurrences: 1 },
3449
3037
  { path: "apps/server/.env.example", occurrences: 1 },
3450
3038
  { path: "apps/server/src/config/env.ts", occurrences: 2 },
3451
3039
  { path: "apps/server/src/config/env.test.ts", occurrences: 1 },
@@ -3469,6 +3057,7 @@ var BRAND_MANIFEST = [
3469
3057
  { path: "apps/server/email-templates/security-alert.html", occurrences: 4 },
3470
3058
  { path: "apps/server/email-templates/verify-email.html", occurrences: 5 },
3471
3059
  { path: "apps/server/email-templates/reset-password.html", occurrences: 5 },
3060
+ { path: "apps/server/email-templates/organization-invitation.html", occurrences: 3 },
3472
3061
  { path: "apps/server/email-templates/welcome-email.html", occurrences: 8 }
3473
3062
  ];
3474
3063
  function validateAppName2(value) {
@@ -3517,7 +3106,7 @@ function rewriteBrandContent(content, brandName) {
3517
3106
  if (error)
3518
3107
  throw new Error(error);
3519
3108
  const escapedSourceBrand = SOURCE_BRAND_NAME.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3520
- const sourceBrandPattern = new RegExp(`\\b${escapedSourceBrand}\\b`, "g");
3109
+ const sourceBrandPattern = new RegExp(`\\b${escapedSourceBrand}\\b`, "gi");
3521
3110
  const matches = content.match(sourceBrandPattern);
3522
3111
  if (brandName === SOURCE_BRAND_NAME || !matches)
3523
3112
  return { content, replacements: 0 };
@@ -3567,8 +3156,8 @@ function wrapBrandedJsxText(content, brandName, width = 100) {
3567
3156
  const output = [];
3568
3157
  for (let index = 0;index < lines.length; ) {
3569
3158
  const line = lines[index] ?? "";
3570
- const text3 = line.trim();
3571
- if (!text3 || text3.startsWith("<") || text3.startsWith("{") || text3.startsWith("//") || text3.includes("<") || text3.includes(">")) {
3159
+ const text = line.trim();
3160
+ if (!text || text.startsWith("<") || text.startsWith("{") || text.startsWith("//") || text.includes("<") || text.includes(">")) {
3572
3161
  output.push(line);
3573
3162
  index += 1;
3574
3163
  continue;
@@ -3615,6 +3204,20 @@ function rewriteRootPackageName(content, appName) {
3615
3204
  return { content: `${JSON.stringify(parsed, null, 2)}
3616
3205
  `, replacements: 1 };
3617
3206
  }
3207
+ var WORKER_NAME_DECLARATION = /^name = "[^"]*"$/m;
3208
+ function rewriteWorkerName(content, appName) {
3209
+ const error = validateAppName2(appName);
3210
+ if (error)
3211
+ throw new Error(error);
3212
+ const declaration = content.match(WORKER_NAME_DECLARATION)?.[0];
3213
+ if (!declaration) {
3214
+ throw new Error("Cloudflare Worker configuration is missing a name declaration.");
3215
+ }
3216
+ const replacement = `name = "${appName}"`;
3217
+ if (declaration === replacement)
3218
+ return { content, replacements: 0 };
3219
+ return { content: content.replace(WORKER_NAME_DECLARATION, replacement), replacements: 1 };
3220
+ }
3618
3221
  function replaceMarkdownSection(content, heading, replacement) {
3619
3222
  const marker = `## ${heading}
3620
3223
  `;
@@ -3667,6 +3270,12 @@ into this repository.
3667
3270
  }
3668
3271
  return rewritten;
3669
3272
  }
3273
+ var BUYER_README_HEADING = "## Create your product";
3274
+ function stripDistributionReadmeBootstrap(content) {
3275
+ if (!content.includes(BUYER_README_HEADING))
3276
+ return content;
3277
+ return replaceMarkdownSection(content, "Create your product", "");
3278
+ }
3670
3279
  var REQUIRED_BUYER_CLI_CONSTANTS = ["CLI_NAME", "CLI_PACKAGE_NAME", "DEFAULT_SCOPE"];
3671
3280
  function rewriteBuyerCliConstants(content, scope, brandName) {
3672
3281
  const buyerVariablePrefix = BUYER_CLI_NAME.toUpperCase().replaceAll("-", "_");
@@ -3677,6 +3286,7 @@ function rewriteBuyerCliConstants(content, scope, brandName) {
3677
3286
  ["SOURCE_BRAND_NAME", brandName],
3678
3287
  ["TEMPLATE_REPOSITORY", "OWNER/REPOSITORY"],
3679
3288
  ["DELIVERY_BASE_URL", "https://releases.example.com"],
3289
+ ["DOCS_BASE_URL", "https://docs.example.com"],
3680
3290
  ["DELIVERY_URL_VARIABLE", `${buyerVariablePrefix}_DELIVERY_URL`],
3681
3291
  ["LICENSE_KEY_VARIABLE", `${buyerVariablePrefix}_LICENSE_KEY`],
3682
3292
  ["LICENSE_KEY_PREFIX", "LICENSE-"]
@@ -3696,6 +3306,7 @@ function rewriteBuyerCliConstants(content, scope, brandName) {
3696
3306
  CLI_PACKAGE_NAME,
3697
3307
  SOURCE_BRAND_NAME,
3698
3308
  DELIVERY_BASE_URL,
3309
+ DOCS_BASE_URL,
3699
3310
  DELIVERY_URL_VARIABLE,
3700
3311
  LICENSE_KEY_VARIABLE2,
3701
3312
  LICENSE_KEY_PREFIX
@@ -3779,6 +3390,8 @@ function isTemplatePathExcluded(relativePath) {
3779
3390
  return true;
3780
3391
  if (normalized === "internal" || normalized.startsWith("internal/"))
3781
3392
  return true;
3393
+ if (normalized === "marketing" || normalized.startsWith("marketing/"))
3394
+ return true;
3782
3395
  if (normalized === ".github/workflows/internal-commercial.yml")
3783
3396
  return true;
3784
3397
  if (normalized === "apps/worker" || normalized.startsWith("apps/worker/"))
@@ -3799,6 +3412,8 @@ function isTemplatePathExcluded(relativePath) {
3799
3412
  return true;
3800
3413
  if (normalized === "packages/create-app/src/cli-brand-contract.test.ts")
3801
3414
  return true;
3415
+ if (normalized === "packages/create-app/src/commercial-contract.test.ts")
3416
+ return true;
3802
3417
  if (normalized === "packages/create-app/LICENSE")
3803
3418
  return true;
3804
3419
  if (normalized === "packages/create-app/README.md")
@@ -3827,6 +3442,29 @@ async function assertEmptyTarget(targetDirectory) {
3827
3442
  throw error;
3828
3443
  }
3829
3444
  }
3445
+ async function trackedTemplatePaths(sourceDirectory) {
3446
+ const topLevel = await execFileAsync("git", ["rev-parse", "--show-toplevel"], {
3447
+ cwd: sourceDirectory
3448
+ }).then((result) => resolve3(result.stdout.trim())).catch(() => {
3449
+ return;
3450
+ });
3451
+ if (topLevel !== sourceDirectory)
3452
+ return;
3453
+ const { stdout } = await execFileAsync("git", ["ls-files", "-z"], {
3454
+ cwd: sourceDirectory,
3455
+ maxBuffer: 64 * 1024 * 1024
3456
+ });
3457
+ const tracked = new Set;
3458
+ for (const path of stdout.split("\x00")) {
3459
+ if (!path)
3460
+ continue;
3461
+ tracked.add(path);
3462
+ for (let parent = dirname2(path);parent !== "."; parent = dirname2(parent)) {
3463
+ tracked.add(parent);
3464
+ }
3465
+ }
3466
+ return tracked;
3467
+ }
3830
3468
  async function copyLocalTemplate(source, target) {
3831
3469
  const sourceDirectory = resolve3(source);
3832
3470
  const sourceStat = await lstat(sourceDirectory).catch(() => {
@@ -3834,29 +3472,28 @@ async function copyLocalTemplate(source, target) {
3834
3472
  });
3835
3473
  if (!sourceStat?.isDirectory())
3836
3474
  throw new Error(`Template path is not a directory: ${sourceDirectory}`);
3837
- await assertNoSymbolicLinks(sourceDirectory, sourceDirectory, true);
3475
+ const tracked = await trackedTemplatePaths(sourceDirectory);
3476
+ const isTemplatePathIncluded = (relativePath) => relativePath === "" || !isTemplatePathExcluded(relativePath) && (!tracked || tracked.has(relativePath));
3477
+ await assertNoSymbolicLinks(sourceDirectory, sourceDirectory, isTemplatePathIncluded);
3838
3478
  await mkdir4(target, { recursive: true });
3839
3479
  await cp(sourceDirectory, target, {
3840
3480
  recursive: true,
3841
- filter: (path) => {
3842
- const relativePath = relative(sourceDirectory, path);
3843
- return relativePath === "" || !isTemplatePathExcluded(relativePath);
3844
- }
3481
+ filter: (path) => isTemplatePathIncluded(relative(sourceDirectory, path).replaceAll("\\", "/"))
3845
3482
  });
3846
3483
  await assertNoSymbolicLinks(target);
3847
3484
  }
3848
- async function assertNoSymbolicLinks(directory, root = directory, skipExcludedPaths = false) {
3485
+ async function assertNoSymbolicLinks(directory, root = directory, isIncluded) {
3849
3486
  const entries = await readdir(directory, { withFileTypes: true });
3850
3487
  for (const entry of entries) {
3851
3488
  const path = join7(directory, entry.name);
3852
- const relativePath = relative(root, path);
3853
- if (skipExcludedPaths && isTemplatePathExcluded(relativePath))
3489
+ const relativePath = relative(root, path).replaceAll("\\", "/");
3490
+ if (isIncluded && !isIncluded(relativePath))
3854
3491
  continue;
3855
3492
  if (entry.isSymbolicLink()) {
3856
3493
  throw new Error(`Template contains a symbolic link, which is not supported: ${path}`);
3857
3494
  }
3858
3495
  if (entry.isDirectory())
3859
- await assertNoSymbolicLinks(path, root, skipExcludedPaths);
3496
+ await assertNoSymbolicLinks(path, root, isIncluded);
3860
3497
  }
3861
3498
  }
3862
3499
  function verifyReleaseMetadata(checksum, manifest, artifactName, digest, templateRef) {
@@ -3953,6 +3590,14 @@ async function applyBrandRewrite(target, brandName) {
3953
3590
  }
3954
3591
  return report;
3955
3592
  }
3593
+ async function renameFrontendWorker(target, appName) {
3594
+ const workerPath = join7(target, "apps/web/wrangler.toml");
3595
+ if (!await stat4(workerPath).catch(() => {
3596
+ return;
3597
+ }))
3598
+ return;
3599
+ await rewriteFile(workerPath, (content) => rewriteWorkerName(content, appName));
3600
+ }
3956
3601
  async function generateEnvironmentFiles(target, databasePort = 5432) {
3957
3602
  const serverExample = await readFile5(join7(target, "apps/server/.env.example"), "utf8");
3958
3603
  await writeFile4(join7(target, "apps/server/.env"), generateServerEnv(serverExample, undefined, databasePort));
@@ -3966,8 +3611,10 @@ async function generateEnvironmentFiles(target, databasePort = 5432) {
3966
3611
  async function neutralizeAgentInstructions(target) {
3967
3612
  const agentPath = join7(target, "AGENTS.md");
3968
3613
  const claudePath = join7(target, "CLAUDE.md");
3614
+ const readmePath = join7(target, "README.md");
3969
3615
  await writeFile4(agentPath, rewriteBuyerAgentInstructions(await readFile5(agentPath, "utf8")));
3970
3616
  await writeFile4(claudePath, rewriteBuyerClaudeInstructions(await readFile5(claudePath, "utf8")));
3617
+ await writeFile4(readmePath, stripDistributionReadmeBootstrap(await readFile5(readmePath, "utf8")));
3971
3618
  const rootPackagePath = join7(target, "package.json");
3972
3619
  await writeFile4(rootPackagePath, stripSellerOnlyRootScripts(await readFile5(rootPackagePath, "utf8")));
3973
3620
  }
@@ -4036,6 +3683,7 @@ async function scaffold(options) {
4036
3683
  }
4037
3684
  const packagePath = join7(target, "package.json");
4038
3685
  const packageReplacements = await rewriteFile(packagePath, (content) => rewriteRootPackageName(content, options.appName));
3686
+ await renameFrontendWorker(target, options.appName);
4039
3687
  const scope = await applyScopeRewrite(target, options.scope);
4040
3688
  await neutralizeAgentInstructions(target);
4041
3689
  await neutralizeSourceCli(target, options.scope, options.brandName);
@@ -4074,7 +3722,7 @@ Create a buyer-owned SaaS application from your licensed ${suggestBrandName(CLI_
4074
3722
  Options:
4075
3723
  --license-key <key> Licence key from your purchase (or set ${LICENSE_KEY_VARIABLE})
4076
3724
  --source-version <version> Pin an immutable release (default: the latest you are entitled to)
4077
- --from <path> Use a local source checkout (maintainer/testing)
3725
+ --from <path> Use a local Git checkout, tracked files only (maintainer/testing)
4078
3726
  --scope <namespace> Advanced workspace namespace override (default: derived from brand)
4079
3727
  --brand <name> Display name (default: derived from app name)
4080
3728
  --yes Accept recommended defaults for omitted options
@@ -4287,7 +3935,7 @@ async function collectOptions(parsed) {
4287
3935
  };
4288
3936
  }
4289
3937
  async function readCliVersion() {
4290
- const packageJson = JSON.parse(await readFile6(resolve4(dirname2(fileURLToPath2(import.meta.url)), "../package.json"), "utf8"));
3938
+ const packageJson = JSON.parse(await readFile6(resolve4(dirname3(fileURLToPath2(import.meta.url)), "../package.json"), "utf8"));
4291
3939
  if (!packageJson.version)
4292
3940
  throw new Error(`${CLI_NAME} package version is missing.`);
4293
3941
  return packageJson.version;
@@ -4353,8 +4001,8 @@ function assertSiblingTarget(source, target) {
4353
4001
  throw new Error(`Create the new app beside the ${CLI_NAME} source checkout, not inside it.`);
4354
4002
  }
4355
4003
  }
4356
- function commandFailureOutput(stdout2, stderr) {
4357
- const output = (stderr.trim() || stdout2.trim()).split(`
4004
+ function commandFailureOutput(stdout, stderr) {
4005
+ const output = (stderr.trim() || stdout.trim()).split(`
4358
4006
  `).slice(-12).join(`
4359
4007
  `);
4360
4008
  return output ? `
@@ -4362,12 +4010,12 @@ function commandFailureOutput(stdout2, stderr) {
4362
4010
  ${output}` : "";
4363
4011
  }
4364
4012
  async function installDependencies(target) {
4365
- const { stdout: stdout2, stderr, exitCode } = await runCaptured2(["pnpm", "install", "--frozen-lockfile"], {
4013
+ const { stdout, stderr, exitCode } = await runCaptured2(["pnpm", "install", "--frozen-lockfile"], {
4366
4014
  cwd: target,
4367
4015
  env: { ...process.env, CI: "1" }
4368
4016
  });
4369
4017
  if (exitCode !== 0) {
4370
- throw new Error(`Dependency installation failed.${commandFailureOutput(stdout2, stderr)}`);
4018
+ throw new Error(`Dependency installation failed.${commandFailureOutput(stdout, stderr)}`);
4371
4019
  }
4372
4020
  }
4373
4021
  async function occupiedDevelopmentPorts() {
@@ -4443,8 +4091,8 @@ async function createApplication(options) {
4443
4091
  await assertTargetAvailable(target);
4444
4092
  assertSiblingTarget(options.from, target);
4445
4093
  const databasePort = await findAvailablePort();
4446
- await mkdir5(dirname2(target), { recursive: true });
4447
- const staging = await mkdtemp2(join8(dirname2(target), `.${options.appName}-${CLI_NAME}-`));
4094
+ await mkdir5(dirname3(target), { recursive: true });
4095
+ const staging = await mkdtemp2(join8(dirname3(target), `.${options.appName}-${CLI_NAME}-`));
4448
4096
  const preparing = "Preparing your application";
4449
4097
  const reporter = createScaffoldReporter(preparing, Boolean(options.licenseKey));
4450
4098
  try {
@@ -4563,14 +4211,14 @@ if (isEntrypoint(import.meta.url)) {
4563
4211
  });
4564
4212
  }
4565
4213
  export {
4566
- usage,
4567
- suggestScope,
4568
- suggestBrandName,
4569
- printRunnableCommands,
4570
- parseArguments,
4571
- occupiedDevelopmentPorts,
4572
- formatBytes,
4573
- findAvailablePort,
4214
+ collectLicenseKey,
4574
4215
  describeTargetConflict,
4575
- collectLicenseKey
4216
+ findAvailablePort,
4217
+ formatBytes,
4218
+ occupiedDevelopmentPorts,
4219
+ parseArguments,
4220
+ printRunnableCommands,
4221
+ suggestBrandName,
4222
+ suggestScope,
4223
+ usage
4576
4224
  };