sim-setup 1.0.64-preview.357.1 → 1.0.64-preview.358.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/index.js +170 -135
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -8463,6 +8463,14 @@ function findCursor(s, o, l) {
8463
8463
  const t = s + o, n = Math.max(l.length - 1, 0), e = t < 0 ? n : t > n ? 0 : t;
8464
8464
  return l[e]?.disabled ? findCursor(e, o < 0 ? -1 : 1, l) : e;
8465
8465
  }
8466
+ function isAccessible(n) {
8467
+ if (n !== undefined)
8468
+ return n;
8469
+ if (settings.accessible !== undefined)
8470
+ return settings.accessible;
8471
+ const e = process.env.ACCESSIBLE;
8472
+ return e !== undefined && e !== "" && e !== "0" && e !== "false";
8473
+ }
8466
8474
  function isActionKey(n, e) {
8467
8475
  if (typeof n == "string")
8468
8476
  return settings.aliases.get(n) === e;
@@ -8497,7 +8505,7 @@ function block({
8497
8505
  input: e = stdin,
8498
8506
  output: r = stdout,
8499
8507
  overwrite: o = true,
8500
- hideCursor: t = true
8508
+ hideCursor: n = true
8501
8509
  } = {}) {
8502
8510
  const s = l.createInterface({
8503
8511
  input: e,
@@ -8506,10 +8514,10 @@ function block({
8506
8514
  tabSize: 1
8507
8515
  });
8508
8516
  l.emitKeypressEvents(e, s), e instanceof ReadStream && e.isTTY && e.setRawMode(true);
8509
- const n = (f, { name: a, sequence: p }) => {
8517
+ const t = (f, { name: a, sequence: w }) => {
8510
8518
  const c = String(f);
8511
- if (isActionKey([c, a, p], "cancel")) {
8512
- t && r.write(import_sisteransi.cursor.show), process.exit(0);
8519
+ if (isActionKey([c, a, w], "cancel")) {
8520
+ n && r.write(import_sisteransi.cursor.show), process.exit(0);
8513
8521
  return;
8514
8522
  }
8515
8523
  if (!o)
@@ -8517,37 +8525,35 @@ function block({
8517
8525
  const i = a === "return" ? 0 : -1, m = a === "return" ? -1 : 0;
8518
8526
  l.moveCursor(r, i, m, () => {
8519
8527
  l.clearLine(r, 1, () => {
8520
- e.once("keypress", n);
8528
+ e.once("keypress", t);
8521
8529
  });
8522
8530
  });
8523
8531
  };
8524
- return t && r.write(import_sisteransi.cursor.hide), e.once("keypress", n), () => {
8525
- e.off("keypress", n), t && r.write(import_sisteransi.cursor.show), e instanceof ReadStream && e.isTTY && !R && e.setRawMode(false), s.terminal = false, s.close();
8532
+ return n && r.write(import_sisteransi.cursor.hide), e.once("keypress", t), () => {
8533
+ 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();
8526
8534
  };
8527
8535
  }
8528
- function wrapTextWithPrefix(e, r, o, t = o, s = o, n) {
8536
+ function wrapTextWithPrefix(e, r, o, n = o, s = o, t) {
8529
8537
  const f = getColumns(e ?? stdout);
8530
8538
  return wrapAnsi(r, f - o.length, {
8531
8539
  hard: true,
8532
8540
  trim: false
8533
8541
  }).split(`
8534
8542
  `).map((c, i, m) => {
8535
- const d = n ? n(c, i) : c;
8536
- return i === 0 ? `${t}${d}` : i === m.length - 1 ? `${s}${d}` : `${o}${d}`;
8543
+ const d = t ? t(c, i) : c;
8544
+ return i === 0 ? `${n}${d}` : i === m.length - 1 ? `${s}${d}` : `${o}${d}`;
8537
8545
  }).join(`
8538
8546
  `);
8539
8547
  }
8540
- function runValidation(e, n) {
8548
+ function runValidation(e, a) {
8541
8549
  if ("~standard" in e) {
8542
- const a = e["~standard"].validate(n);
8543
- if (a instanceof Promise)
8544
- throw new TypeError("Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic.");
8545
- return a.issues?.at(0)?.message;
8550
+ const n = e["~standard"].validate(a);
8551
+ return n instanceof Promise ? n.then((r) => r.issues?.at(0)?.message) : n.issues?.at(0)?.message;
8546
8552
  }
8547
- return e(n);
8553
+ return e(a);
8548
8554
  }
8549
8555
 
8550
- class V {
8556
+ class y {
8551
8557
  input;
8552
8558
  output;
8553
8559
  _abortSignal;
@@ -8562,9 +8568,12 @@ class V {
8562
8568
  error = "";
8563
8569
  value;
8564
8570
  userInput = "";
8571
+ get accessible() {
8572
+ return isAccessible(this.opts.accessible);
8573
+ }
8565
8574
  constructor(t, e = true) {
8566
- const { input: i = stdin, output: n = stdout, render: s, signal: r, ...o } = t;
8567
- 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;
8575
+ const { input: i = stdin, output: s = stdout, render: r, signal: n, ...o } = t;
8576
+ 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;
8568
8577
  }
8569
8578
  unsubscribe() {
8570
8579
  this._subscribers.clear();
@@ -8580,11 +8589,11 @@ class V {
8580
8589
  this.setSubscriber(t, { cb: e, once: true });
8581
8590
  }
8582
8591
  emit(t, ...e) {
8583
- const i = this._subscribers.get(t) ?? [], n = [];
8584
- for (const s of i)
8585
- s.cb(...e), s.once && n.push(() => i.splice(i.indexOf(s), 1));
8586
- for (const s of n)
8587
- s();
8592
+ const i = this._subscribers.get(t) ?? [], s = [];
8593
+ for (const r of i)
8594
+ r.cb(...e), r.once && s.push(() => i.splice(i.indexOf(r), 1));
8595
+ for (const r of s)
8596
+ r();
8588
8597
  }
8589
8598
  prompt() {
8590
8599
  return new Promise((t) => {
@@ -8623,15 +8632,18 @@ class V {
8623
8632
  _clearUserInput() {
8624
8633
  this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
8625
8634
  }
8626
- onKeypress(t, e) {
8627
- 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)) {
8628
- if (this.opts.validate) {
8629
- const i = runValidation(this.opts.validate, this.value);
8630
- i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput));
8635
+ async onKeypress(t, e) {
8636
+ if (this.state !== "validating") {
8637
+ 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)) {
8638
+ if (this.opts.validate) {
8639
+ const i = runValidation(this.opts.validate, this.value);
8640
+ let s;
8641
+ 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));
8642
+ }
8643
+ this.state !== "error" && (this.state = "submit");
8631
8644
  }
8632
- this.state !== "error" && (this.state = "submit");
8645
+ 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();
8633
8646
  }
8634
- 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();
8635
8647
  }
8636
8648
  close() {
8637
8649
  this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
@@ -8653,28 +8665,28 @@ class V {
8653
8665
  else {
8654
8666
  const e = diffLines(this._prevFrame, t), i = getRows(this.output);
8655
8667
  if (this.restoreCursor(), e) {
8656
- const n = Math.max(0, e.numLinesAfter - i), s = Math.max(0, e.numLinesBefore - i);
8657
- let r = e.lines.find((o) => o >= n);
8658
- if (r === undefined) {
8668
+ const s = Math.max(0, e.numLinesAfter - i), r = Math.max(0, e.numLinesBefore - i);
8669
+ let n = e.lines.find((o) => o >= s);
8670
+ if (n === undefined) {
8659
8671
  this._prevFrame = t;
8660
8672
  return;
8661
8673
  }
8662
8674
  if (e.lines.length === 1) {
8663
- this.output.write(import_sisteransi.cursor.move(0, r - s)), this.output.write(import_sisteransi.erase.lines(1));
8675
+ this.output.write(import_sisteransi.cursor.move(0, n - r)), this.output.write(import_sisteransi.erase.lines(1));
8664
8676
  const o = t.split(`
8665
8677
  `);
8666
- this.output.write(o[r]), this._prevFrame = t, this.output.write(import_sisteransi.cursor.move(0, o.length - r - 1));
8678
+ this.output.write(o[n]), this._prevFrame = t, this.output.write(import_sisteransi.cursor.move(0, o.length - n - 1));
8667
8679
  return;
8668
8680
  } else if (e.lines.length > 1) {
8669
- if (n < s)
8670
- r = n;
8681
+ if (s < r)
8682
+ n = s;
8671
8683
  else {
8672
- const h = r - s;
8684
+ const h = n - r;
8673
8685
  h > 0 && this.output.write(import_sisteransi.cursor.move(0, h));
8674
8686
  }
8675
8687
  this.output.write(import_sisteransi.erase.down());
8676
8688
  const f = t.split(`
8677
- `).slice(r);
8689
+ `).slice(n);
8678
8690
  this.output.write(f.join(`
8679
8691
  `)), this._prevFrame = t;
8680
8692
  return;
@@ -8720,6 +8732,7 @@ var init_dist3 = __esm(() => {
8720
8732
  error: "Something went wrong"
8721
8733
  },
8722
8734
  withGuide: true,
8735
+ accessible: undefined,
8723
8736
  date: {
8724
8737
  monthNames: [...t],
8725
8738
  messages: {
@@ -8733,7 +8746,7 @@ var init_dist3 = __esm(() => {
8733
8746
  };
8734
8747
  R = globalThis.process.platform.startsWith("win");
8735
8748
  CANCEL_SYMBOL = Symbol("clack:cancel");
8736
- r = class r extends V {
8749
+ r = class r extends y {
8737
8750
  get cursor() {
8738
8751
  return this.value ? 0 : 1;
8739
8752
  }
@@ -8750,7 +8763,7 @@ var init_dist3 = __esm(() => {
8750
8763
  });
8751
8764
  }
8752
8765
  };
8753
- a = class a extends V {
8766
+ a = class a extends y {
8754
8767
  options;
8755
8768
  cursor = 0;
8756
8769
  get _value() {
@@ -8797,7 +8810,7 @@ var init_dist3 = __esm(() => {
8797
8810
  });
8798
8811
  }
8799
8812
  };
8800
- u$1 = class u extends V {
8813
+ u$1 = class u extends y {
8801
8814
  _mask = "•";
8802
8815
  get cursor() {
8803
8816
  return this._cursor;
@@ -8825,7 +8838,7 @@ var init_dist3 = __esm(() => {
8825
8838
  });
8826
8839
  }
8827
8840
  };
8828
- n$1 = class n extends V {
8841
+ n$1 = class n extends y {
8829
8842
  options;
8830
8843
  cursor = 0;
8831
8844
  get _selectedValue() {
@@ -8853,7 +8866,7 @@ var init_dist3 = __esm(() => {
8853
8866
  });
8854
8867
  }
8855
8868
  };
8856
- n = class n extends V {
8869
+ n = class n extends y {
8857
8870
  get userInputWithCursor() {
8858
8871
  if (this.state === "submit")
8859
8872
  return this.userInput;
@@ -8903,6 +8916,8 @@ var import_sisteransi2, unicode, isCI = () => process.env.CI === "true", unicode
8903
8916
  return styleText2("yellow", S_STEP_ERROR);
8904
8917
  case "submit":
8905
8918
  return styleText2("green", S_STEP_SUBMIT);
8919
+ case "validating":
8920
+ return styleText2("dim", S_STEP_ACTIVE);
8906
8921
  }
8907
8922
  }, symbolBar = (o) => {
8908
8923
  switch (o) {
@@ -8969,34 +8984,34 @@ var import_sisteransi2, unicode, isCI = () => process.env.CI === "true", unicode
8969
8984
  for (const n of t)
8970
8985
  x.push(n);
8971
8986
  return c && x.push(M), x;
8972
- }, confirm = (i) => {
8973
- const a = i.active ?? "Yes", s = i.inactive ?? "No";
8987
+ }, confirm = (e) => {
8988
+ const a = e.active ?? "Yes", o = e.inactive ?? "No";
8974
8989
  return new r({
8975
8990
  active: a,
8976
- inactive: s,
8977
- signal: i.signal,
8978
- input: i.input,
8979
- output: i.output,
8980
- initialValue: i.initialValue ?? true,
8991
+ inactive: o,
8992
+ signal: e.signal,
8993
+ input: e.input,
8994
+ output: e.output,
8995
+ initialValue: e.initialValue ?? true,
8981
8996
  render() {
8982
- const e = i.withGuide ?? settings.withGuide, u = `${symbol(this.state)} `, l = e ? `${styleText2("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(i.output, i.message, l, u), o = `${e ? `${styleText2("gray", S_BAR)}
8997
+ 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)}
8983
8998
  ` : ""}${f}
8984
- `, c = this.value ? a : s;
8999
+ `, c = this.value ? a : o;
8985
9000
  switch (this.state) {
8986
9001
  case "submit": {
8987
- const r = e ? `${styleText2("gray", S_BAR)} ` : "";
8988
- return `${o}${r}${styleText2("dim", c)}`;
9002
+ const r = i ? `${styleText2("gray", S_BAR)} ` : "";
9003
+ return `${s}${r}${styleText2("dim", c)}`;
8989
9004
  }
8990
9005
  case "cancel": {
8991
- const r = e ? `${styleText2("gray", S_BAR)} ` : "";
8992
- return `${o}${r}${styleText2(["strikethrough", "dim"], c)}${e ? `
9006
+ const r = i ? `${styleText2("gray", S_BAR)} ` : "";
9007
+ return `${s}${r}${styleText2(["strikethrough", "dim"], c)}${i ? `
8993
9008
  ${styleText2("gray", S_BAR)}` : ""}`;
8994
9009
  }
8995
9010
  default: {
8996
- const r = e ? `${styleText2("cyan", S_BAR)} ` : "", g = e ? styleText2("cyan", S_BAR_END) : "";
8997
- return `${o}${r}${this.value ? `${styleText2("green", S_RADIO_ACTIVE)} ${a}` : `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a)}`}${i.vertical ? e ? `
9011
+ const r = i ? `${styleText2("cyan", S_BAR)} ` : "", g = i ? styleText2("cyan", S_BAR_END) : "";
9012
+ return `${s}${r}${this.value ? `${styleText2("green", S_RADIO_ACTIVE)} ${a}` : `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a)}`}${e.vertical ? i ? `
8998
9013
  ${styleText2("cyan", S_BAR)} ` : `
8999
- ` : ` ${styleText2("dim", "/")} `}${this.value ? `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", s)}` : `${styleText2("green", S_RADIO_ACTIVE)} ${s}`}
9014
+ ` : ` ${styleText2("dim", "/")} `}${this.value ? `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", o)}` : `${styleText2("green", S_RADIO_ACTIVE)} ${o}`}
9000
9015
  ${g}
9001
9016
  `;
9002
9017
  }
@@ -9009,7 +9024,7 @@ ${g}
9009
9024
  const u = (t, a) => {
9010
9025
  const r = t.label ?? String(t.value);
9011
9026
  return a === "disabled" ? `${styleText2("gray", S_CHECKBOX_INACTIVE)} ${m(r, (o) => styleText2(["strikethrough", "gray"], o))}${t.hint ? ` ${styleText2("dim", `(${t.hint ?? "disabled"})`)}` : ""}` : a === "active" ? `${styleText2("cyan", S_CHECKBOX_ACTIVE)} ${r}${t.hint ? ` ${styleText2("dim", `(${t.hint})`)}` : ""}` : a === "selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${m(r, (o) => styleText2("dim", o))}${t.hint ? ` ${styleText2("dim", `(${t.hint})`)}` : ""}` : a === "cancelled" ? `${m(r, (o) => styleText2(["strikethrough", "dim"], o))}` : a === "active-selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${r}${t.hint ? ` ${styleText2("dim", `(${t.hint})`)}` : ""}` : a === "submitted" ? `${m(r, (o) => styleText2("dim", o))}` : `${styleText2("dim", S_CHECKBOX_INACTIVE)} ${m(r, (o) => styleText2("dim", o))}`;
9012
- }, d = i.required ?? true, v = i.showInstructions ?? true;
9027
+ }, d = i.required ?? true, x = i.showInstructions ?? true;
9013
9028
  return new a({
9014
9029
  options: i.options,
9015
9030
  signal: i.signal,
@@ -9026,7 +9041,7 @@ ${styleText2("reset", styleText2("dim", `Press ${styleText2(["gray", "bgWhite",
9026
9041
  render() {
9027
9042
  const t = i.withGuide ?? settings.withGuide, a = wrapTextWithPrefix(i.output, i.message, t ? `${symbolBar(this.state)} ` : "", `${symbol(this.state)} `), r = `${t ? `${styleText2("gray", S_BAR)}
9028
9043
  ` : ""}${a}
9029
- `, o = this.value ?? [], p = (n, l) => {
9044
+ `, o = this.value ?? [], g = (n, l) => {
9030
9045
  if (n.disabled)
9031
9046
  return u(n, "disabled");
9032
9047
  const s = o.includes(n.value);
@@ -9047,7 +9062,7 @@ ${styleText2("gray", S_BAR)}` : ""}`;
9047
9062
  }
9048
9063
  case "error": {
9049
9064
  const n = t ? `${styleText2("yellow", S_BAR)} ` : "", l = this.error.split(`
9050
- `).map(($, C) => C === 0 ? `${t ? `${styleText2("yellow", S_BAR_END)} ` : ""}${styleText2("yellow", $)}` : ` ${$}`).join(`
9065
+ `).map(($, v) => v === 0 ? `${t ? `${styleText2("yellow", S_BAR_END)} ` : ""}${styleText2("yellow", $)}` : ` ${$}`).join(`
9051
9066
  `), s = r.split(`
9052
9067
  `).length, h = l.split(`
9053
9068
  `).length + 1;
@@ -9058,7 +9073,7 @@ ${styleText2("gray", S_BAR)}` : ""}`;
9058
9073
  maxItems: i.maxItems,
9059
9074
  columnPadding: n.length,
9060
9075
  rowPadding: s + h,
9061
- style: p
9076
+ style: g
9062
9077
  }).join(`
9063
9078
  ${n}`)}
9064
9079
  ${l}
@@ -9066,7 +9081,7 @@ ${l}
9066
9081
  }
9067
9082
  default: {
9068
9083
  const n = t ? `${styleText2("cyan", S_BAR)} ` : "", l = r.split(`
9069
- `).length, s = v ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, t) : t ? [styleText2("cyan", S_BAR_END)] : [], h = s.join(`
9084
+ `).length, s = x ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, t) : t ? [styleText2("cyan", S_BAR_END)] : [], h = s.join(`
9070
9085
  `), $ = s.length + 1;
9071
9086
  return `${r}${n}${limitOptions({
9072
9087
  output: i.output,
@@ -9075,7 +9090,7 @@ ${l}
9075
9090
  maxItems: i.maxItems,
9076
9091
  columnPadding: n.length,
9077
9092
  rowPadding: l + $,
9078
- style: p
9093
+ style: g
9079
9094
  }).join(`
9080
9095
  ${n}`)}
9081
9096
  ${h}
@@ -9114,36 +9129,36 @@ ${styleText2("gray", S_BAR_END)} ` : "";
9114
9129
  ${h}
9115
9130
  ${styleText2("gray", l$1 + S_BAR_H.repeat(t + 2) + S_CORNER_BOTTOM_RIGHT)}
9116
9131
  `);
9117
- }, password = (r) => new u$1({
9118
- validate: r.validate,
9119
- mask: r.mask ?? S_PASSWORD_MASK,
9120
- signal: r.signal,
9121
- input: r.input,
9122
- output: r.output,
9132
+ }, password = (e) => new u$1({
9133
+ validate: e.validate,
9134
+ mask: e.mask ?? S_PASSWORD_MASK,
9135
+ signal: e.signal,
9136
+ input: e.input,
9137
+ output: e.output,
9123
9138
  render() {
9124
- const e = r.withGuide ?? settings.withGuide, o = `${e ? `${styleText2("gray", S_BAR)}
9125
- ` : ""}${symbol(this.state)} ${r.message}
9126
- `, c = this.userInputWithCursor, i = this.masked;
9139
+ const r = e.withGuide ?? settings.withGuide, o = `${r ? `${styleText2("gray", S_BAR)}
9140
+ ` : ""}${symbol(this.state)} ${e.message}
9141
+ `, m = this.userInputWithCursor, i = this.masked;
9127
9142
  switch (this.state) {
9128
9143
  case "error": {
9129
- const s = e ? `${styleText2("yellow", S_BAR)} ` : "", n = e ? `${styleText2("yellow", S_BAR_END)} ` : "", l = i ?? "";
9130
- return r.clearOnError && this.clear(), `${o.trim()}
9131
- ${s}${l}
9144
+ const s = r ? `${styleText2("yellow", S_BAR)} ` : "", n = r ? `${styleText2("yellow", S_BAR_END)} ` : "", d = i ?? "";
9145
+ return e.clearOnError && this.clear(), `${o.trim()}
9146
+ ${s}${d}
9132
9147
  ${n}${styleText2("yellow", this.error)}
9133
9148
  `;
9134
9149
  }
9135
9150
  case "submit": {
9136
- const s = e ? `${styleText2("gray", S_BAR)} ` : "", n = i ? styleText2("dim", i) : "";
9151
+ const s = r ? `${styleText2("gray", S_BAR)} ` : "", n = i ? styleText2("dim", i) : "";
9137
9152
  return `${o}${s}${n}`;
9138
9153
  }
9139
9154
  case "cancel": {
9140
- const s = e ? `${styleText2("gray", S_BAR)} ` : "", n = i ? styleText2(["strikethrough", "dim"], i) : "";
9141
- return `${o}${s}${n}${i && e ? `
9155
+ const s = r ? `${styleText2("gray", S_BAR)} ` : "", n = i ? styleText2(["strikethrough", "dim"], i) : "";
9156
+ return `${o}${s}${n}${i && r ? `
9142
9157
  ${styleText2("gray", S_BAR)}` : ""}`;
9143
9158
  }
9144
9159
  default: {
9145
- const s = e ? `${styleText2("cyan", S_BAR)} ` : "", n = e ? styleText2("cyan", S_BAR_END) : "";
9146
- return `${o}${s}${c}
9160
+ const s = r ? `${styleText2("cyan", S_BAR)} ` : "", n = r ? styleText2("cyan", S_BAR_END) : "";
9161
+ return `${o}${s}${m}
9147
9162
  ${n}
9148
9163
  `;
9149
9164
  }
@@ -9272,57 +9287,63 @@ ${styleText2("gray", S_BAR)}` : ""}`;
9272
9287
  }
9273
9288
  default: {
9274
9289
  const r = n ? `${styleText2("cyan", S_BAR)} ` : "", a = u.split(`
9275
- `).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n) : n ? [styleText2("cyan", S_BAR_END)] : [], b = p.join(`
9276
- `), f = p.length + 1;
9290
+ `).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n) : n ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
9291
+ `), b = p.length + 1;
9277
9292
  return `${u}${r}${limitOptions({
9278
9293
  output: t.output,
9279
9294
  cursor: this.cursor,
9280
9295
  options: this.options,
9281
9296
  maxItems: t.maxItems,
9282
9297
  columnPadding: r.length,
9283
- rowPadding: a + f,
9298
+ rowPadding: a + b,
9284
9299
  style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
9285
9300
  }).join(`
9286
9301
  ${r}`)}
9287
- ${b}
9302
+ ${f}
9288
9303
  `;
9289
9304
  }
9290
9305
  }
9291
9306
  }
9292
9307
  }).prompt();
9293
- }, i, text = (e) => new n({
9294
- validate: e.validate,
9295
- placeholder: e.placeholder,
9296
- defaultValue: e.defaultValue,
9297
- initialValue: e.initialValue,
9298
- output: e.output,
9299
- signal: e.signal,
9300
- input: e.input,
9308
+ }, i, text = (t) => new n({
9309
+ validate: t.validate,
9310
+ placeholder: t.placeholder,
9311
+ defaultValue: t.defaultValue,
9312
+ initialValue: t.initialValue,
9313
+ output: t.output,
9314
+ signal: t.signal,
9315
+ input: t.input,
9301
9316
  render() {
9302
- const i = e?.withGuide ?? settings.withGuide, s = `${`${i ? `${styleText2("gray", S_BAR)}
9303
- ` : ""}${symbol(this.state)} `}${e.message}
9304
- `, c = e.placeholder && e.placeholder.length > 0 ? styleText2("inverse", e.placeholder[0]) + styleText2("dim", e.placeholder.slice(1)) : styleText2(["inverse", "hidden"], "_"), o = this.userInput ? this.userInputWithCursor : c, l = this.value ?? "";
9317
+ const r = t?.withGuide ?? settings.withGuide, l = `${`${r ? `${styleText2("gray", S_BAR)}
9318
+ ` : ""}${symbol(this.state)} `}${t.message}
9319
+ `, 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 ?? "";
9305
9320
  switch (this.state) {
9321
+ case "validating": {
9322
+ const n = r ? `${styleText2("cyan", S_BAR)} ` : "", i = r ? styleText2("cyan", S_BAR_END) : "", c = styleText2("dim", o), $ = styleText2("dim", "Validating...");
9323
+ return `${l}${n}${c}
9324
+ ${i} ${$}
9325
+ `;
9326
+ }
9306
9327
  case "error": {
9307
- const n = this.error ? ` ${styleText2("yellow", this.error)}` : "", r = i ? `${styleText2("yellow", S_BAR)} ` : "", d = i ? styleText2("yellow", S_BAR_END) : "";
9308
- return `${s.trim()}
9309
- ${r}${o}
9310
- ${d}${n}
9328
+ const n = this.error ? ` ${styleText2("yellow", this.error)}` : "", i = r ? `${styleText2("yellow", S_BAR)} ` : "", c = r ? styleText2("yellow", S_BAR_END) : "";
9329
+ return `${l.trim()}
9330
+ ${i}${o}
9331
+ ${c}${n}
9311
9332
  `;
9312
9333
  }
9313
9334
  case "submit": {
9314
- const n = l ? ` ${styleText2("dim", l)}` : "", r = i ? styleText2("gray", S_BAR) : "";
9315
- return `${s}${r}${n}`;
9335
+ const n = s ? `${r ? " " : ""}${styleText2("dim", s)}` : "", i = r ? styleText2("gray", S_BAR) : "";
9336
+ return `${l}${i}${n}`;
9316
9337
  }
9317
9338
  case "cancel": {
9318
- const n = l ? ` ${styleText2(["strikethrough", "dim"], l)}` : "", r = i ? styleText2("gray", S_BAR) : "";
9319
- return `${s}${r}${n}${l.trim() ? `
9320
- ${r}` : ""}`;
9339
+ const n = s ? ` ${styleText2(["strikethrough", "dim"], s)}` : "", i = r ? styleText2("gray", S_BAR) : "";
9340
+ return `${l}${i}${n}${s.trim() ? `
9341
+ ${i}` : ""}`;
9321
9342
  }
9322
9343
  default: {
9323
- const n = i ? `${styleText2("cyan", S_BAR)} ` : "", r = i ? styleText2("cyan", S_BAR_END) : "";
9324
- return `${s}${n}${o}
9325
- ${r}
9344
+ const n = r ? `${styleText2("cyan", S_BAR)} ` : "", i = r ? styleText2("cyan", S_BAR_END) : "";
9345
+ return `${l}${n}${o}
9346
+ ${i}
9326
9347
  `;
9327
9348
  }
9328
9349
  }
@@ -9898,7 +9919,7 @@ var require_ipaddr = __commonJS(function(exports, module) {
9898
9919
  if (string.substr(-2, 2) === "::") {
9899
9920
  colonCount--;
9900
9921
  }
9901
- if (colonCount > parts) {
9922
+ if (colonCount >= parts) {
9902
9923
  return null;
9903
9924
  }
9904
9925
  replacementCount = parts - colonCount;
@@ -9917,7 +9938,7 @@ var require_ipaddr = __commonJS(function(exports, module) {
9917
9938
  const ref = string.split(":");
9918
9939
  const results = [];
9919
9940
  for (let i = 0;i < ref.length; i++) {
9920
- results.push(parseInt(ref[i], 16));
9941
+ results.push(ref[i].length > 4 ? NaN : parseInt(ref[i], 16));
9921
9942
  }
9922
9943
  return results;
9923
9944
  }();
@@ -10084,7 +10105,7 @@ var require_ipaddr = __commonJS(function(exports, module) {
10084
10105
  }
10085
10106
  return new this(octets);
10086
10107
  } catch (e) {
10087
- throw new Error("ipaddr: the address does not have IPv4 CIDR format");
10108
+ throw new Error("ipaddr: the address does not have IPv4 CIDR format", { cause: e });
10088
10109
  }
10089
10110
  };
10090
10111
  ipaddr.IPv4.isIPv4 = function(string) {
@@ -10094,7 +10115,7 @@ var require_ipaddr = __commonJS(function(exports, module) {
10094
10115
  try {
10095
10116
  new this(this.parser(string));
10096
10117
  return true;
10097
- } catch (e) {
10118
+ } catch {
10098
10119
  return false;
10099
10120
  }
10100
10121
  };
@@ -10102,7 +10123,7 @@ var require_ipaddr = __commonJS(function(exports, module) {
10102
10123
  try {
10103
10124
  this.parseCIDR(string);
10104
10125
  return true;
10105
- } catch (e) {
10126
+ } catch {
10106
10127
  return false;
10107
10128
  }
10108
10129
  };
@@ -10134,7 +10155,7 @@ var require_ipaddr = __commonJS(function(exports, module) {
10134
10155
  }
10135
10156
  return new this(octets);
10136
10157
  } catch (e) {
10137
- throw new Error("ipaddr: the address does not have IPv4 CIDR format");
10158
+ throw new Error("ipaddr: the address does not have IPv4 CIDR format", { cause: e });
10138
10159
  }
10139
10160
  };
10140
10161
  ipaddr.IPv4.parse = function(string) {
@@ -10219,7 +10240,7 @@ var require_ipaddr = __commonJS(function(exports, module) {
10219
10240
  };
10220
10241
  ipaddr.IPv4.subnetMaskFromPrefixLength = function(prefix) {
10221
10242
  prefix = parseInt(prefix);
10222
- if (prefix < 0 || prefix > 32) {
10243
+ if (Number.isNaN(prefix) || prefix < 0 || prefix > 32) {
10223
10244
  throw new Error("ipaddr: invalid IPv4 prefix length");
10224
10245
  }
10225
10246
  const octets = [0, 0, 0, 0];
@@ -10264,9 +10285,13 @@ var require_ipaddr = __commonJS(function(exports, module) {
10264
10285
  loopback: [new IPv6([0, 0, 0, 0, 0, 0, 0, 1]), 128],
10265
10286
  uniqueLocal: [new IPv6([64512, 0, 0, 0, 0, 0, 0, 0]), 7],
10266
10287
  ipv4Mapped: [new IPv6([0, 0, 0, 0, 0, 65535, 0, 0]), 96],
10288
+ deprecatedSiteLocal: [new IPv6([65216, 0, 0, 0, 0, 0, 0, 0]), 10],
10267
10289
  discard: [new IPv6([256, 0, 0, 0, 0, 0, 0, 0]), 64],
10268
10290
  rfc6145: [new IPv6([0, 0, 0, 0, 65535, 0, 0, 0]), 96],
10269
- rfc6052: [new IPv6([100, 65435, 0, 0, 0, 0, 0, 0]), 96],
10291
+ rfc6052: [
10292
+ [new IPv6([100, 65435, 0, 0, 0, 0, 0, 0]), 96],
10293
+ [new IPv6([100, 65435, 1, 0, 0, 0, 0, 0]), 48]
10294
+ ],
10270
10295
  "6to4": [new IPv6([8194, 0, 0, 0, 0, 0, 0, 0]), 16],
10271
10296
  teredo: [new IPv6([8193, 0, 0, 0, 0, 0, 0, 0]), 32],
10272
10297
  benchmarking: [new IPv6([8193, 2, 0, 0, 0, 0, 0, 0]), 48],
@@ -10275,12 +10300,14 @@ var require_ipaddr = __commonJS(function(exports, module) {
10275
10300
  [new IPv6([8193, 4, 274, 0, 0, 0, 0, 0]), 48],
10276
10301
  [new IPv6([9760, 79, 32768, 0, 0, 0, 0, 0]), 48]
10277
10302
  ],
10278
- deprecated: [new IPv6([8193, 16, 0, 0, 0, 0, 0, 0]), 28],
10303
+ deprecatedOrchid: [new IPv6([8193, 16, 0, 0, 0, 0, 0, 0]), 28],
10279
10304
  orchid2: [new IPv6([8193, 32, 0, 0, 0, 0, 0, 0]), 28],
10280
10305
  droneRemoteIdProtocolEntityTags: [new IPv6([8193, 48, 0, 0, 0, 0, 0, 0]), 28],
10306
+ segmentRouting: [new IPv6([24320, 0, 0, 0, 0, 0, 0, 0]), 16],
10281
10307
  reserved: [
10282
10308
  [new IPv6([8193, 0, 0, 0, 0, 0, 0, 0]), 23],
10283
- [new IPv6([8193, 3512, 0, 0, 0, 0, 0, 0]), 32]
10309
+ [new IPv6([8193, 3512, 0, 0, 0, 0, 0, 0]), 32],
10310
+ [new IPv6([16383, 0, 0, 0, 0, 0, 0, 0]), 20]
10284
10311
  ]
10285
10312
  };
10286
10313
  IPv6.prototype.isIPv4MappedAddress = function() {
@@ -10394,20 +10421,28 @@ var require_ipaddr = __commonJS(function(exports, module) {
10394
10421
  };
10395
10422
  IPv6.prototype.toRFC5952String = function() {
10396
10423
  const regex = /((^|:)(0(:|$)){2,})/g;
10397
- const string = this.toNormalizedString();
10424
+ let suffix = "";
10425
+ if (this.zoneId) {
10426
+ suffix = `%${this.zoneId}`;
10427
+ }
10428
+ const normalized = this.toNormalizedString();
10429
+ const string = normalized.slice(0, normalized.length - suffix.length);
10398
10430
  let bestMatchIndex = 0;
10399
10431
  let bestMatchLength = -1;
10432
+ let bestMatchGroups = -1;
10400
10433
  let match;
10401
10434
  while (match = regex.exec(string)) {
10402
- if (match[0].length > bestMatchLength) {
10435
+ const groups = (match[0].match(/0/g) || []).length;
10436
+ if (groups > bestMatchGroups) {
10437
+ bestMatchGroups = groups;
10403
10438
  bestMatchIndex = match.index;
10404
10439
  bestMatchLength = match[0].length;
10405
10440
  }
10406
10441
  }
10407
10442
  if (bestMatchLength < 0) {
10408
- return string;
10443
+ return string + suffix;
10409
10444
  }
10410
- return `${string.substring(0, bestMatchIndex)}::${string.substring(bestMatchIndex + bestMatchLength)}`;
10445
+ return `${string.substring(0, bestMatchIndex)}::${string.substring(bestMatchIndex + bestMatchLength)}${suffix}`;
10411
10446
  };
10412
10447
  IPv6.prototype.toString = function() {
10413
10448
  return this.toRFC5952String();
@@ -10427,7 +10462,7 @@ var require_ipaddr = __commonJS(function(exports, module) {
10427
10462
  }
10428
10463
  return new this(octets);
10429
10464
  } catch (e) {
10430
- throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`);
10465
+ throw new Error("ipaddr: the address does not have IPv6 CIDR format", { cause: e });
10431
10466
  }
10432
10467
  };
10433
10468
  ipaddr.IPv6.isIPv6 = function(string) {
@@ -10441,7 +10476,7 @@ var require_ipaddr = __commonJS(function(exports, module) {
10441
10476
  const addr = this.parser(string);
10442
10477
  new this(addr.parts, addr.zoneId);
10443
10478
  return true;
10444
- } catch (e) {
10479
+ } catch {
10445
10480
  return false;
10446
10481
  }
10447
10482
  };
@@ -10452,7 +10487,7 @@ var require_ipaddr = __commonJS(function(exports, module) {
10452
10487
  try {
10453
10488
  this.parseCIDR(string);
10454
10489
  return true;
10455
- } catch (e) {
10490
+ } catch {
10456
10491
  return false;
10457
10492
  }
10458
10493
  };
@@ -10470,12 +10505,12 @@ var require_ipaddr = __commonJS(function(exports, module) {
10470
10505
  }
10471
10506
  return new this(octets);
10472
10507
  } catch (e) {
10473
- throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`);
10508
+ throw new Error("ipaddr: the address does not have IPv6 CIDR format", { cause: e });
10474
10509
  }
10475
10510
  };
10476
10511
  ipaddr.IPv6.parse = function(string) {
10477
10512
  const addr = this.parser(string);
10478
- if (addr.parts === null) {
10513
+ if (addr === null) {
10479
10514
  throw new Error("ipaddr: string is not formatted like an IPv6 Address");
10480
10515
  }
10481
10516
  return new this(addr.parts, addr.zoneId);
@@ -10511,7 +10546,7 @@ var require_ipaddr = __commonJS(function(exports, module) {
10511
10546
  addr = addr.slice(0, -1);
10512
10547
  }
10513
10548
  addr = expandIPv6(addr + zoneId, 6);
10514
- if (addr.parts) {
10549
+ if (addr && addr.parts) {
10515
10550
  octets = [
10516
10551
  parseInt(match[2]),
10517
10552
  parseInt(match[3]),
@@ -10536,7 +10571,7 @@ var require_ipaddr = __commonJS(function(exports, module) {
10536
10571
  };
10537
10572
  ipaddr.IPv6.subnetMaskFromPrefixLength = function(prefix) {
10538
10573
  prefix = parseInt(prefix);
10539
- if (prefix < 0 || prefix > 128) {
10574
+ if (Number.isNaN(prefix) || prefix < 0 || prefix > 128) {
10540
10575
  throw new Error("ipaddr: invalid IPv6 prefix length");
10541
10576
  }
10542
10577
  const octets = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
@@ -10579,11 +10614,11 @@ var require_ipaddr = __commonJS(function(exports, module) {
10579
10614
  ipaddr.parseCIDR = function(string) {
10580
10615
  try {
10581
10616
  return ipaddr.IPv6.parseCIDR(string);
10582
- } catch (e) {
10617
+ } catch {
10583
10618
  try {
10584
10619
  return ipaddr.IPv4.parseCIDR(string);
10585
- } catch (e2) {
10586
- throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format");
10620
+ } catch (e) {
10621
+ throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format", { cause: e });
10587
10622
  }
10588
10623
  }
10589
10624
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sim-setup",
3
- "version": "1.0.64-preview.357.1",
3
+ "version": "1.0.64-preview.358.1",
4
4
  "description": "Set up and manage a self-hosted Sim installation",
5
5
  "type": "module",
6
6
  "bin": {
@@ -48,7 +48,7 @@
48
48
  "node": ">=20"
49
49
  },
50
50
  "devDependencies": {
51
- "@clack/prompts": "1.7.0",
51
+ "@clack/prompts": "1.8.1",
52
52
  "@next/env": "16.4.5",
53
53
  "@sim/deployment-config": "0.1.0",
54
54
  "@sim/security": "0.1.0",