@vitejs/devtools 0.0.0-alpha.21 → 0.0.0-alpha.23

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.
@@ -1,22 +1,20 @@
1
1
  import { n as dirDist, t as dirClientStandalone } from "./dirs-C0s1Ghvy.js";
2
- import Debug from "debug";
2
+ import { createDebug } from "obug";
3
3
  import { debounce } from "perfect-debounce";
4
4
  import { normalizePath, searchForWorkspaceRoot } from "vite";
5
5
  import { toDataURL } from "mlly";
6
6
  import { createEventEmitter } from "@vitejs/devtools-kit/utils/events";
7
7
  import { RpcFunctionsCollectorBase } from "birpc-x";
8
+ import { createSharedState } from "@vitejs/devtools-kit/utils/shared-state";
8
9
  import process$1, { stdin, stdout } from "node:process";
9
10
  import fs, { existsSync } from "node:fs";
10
11
  import sirv from "sirv";
11
12
  import { stripVTControlCharacters } from "node:util";
12
- import { cursor, erase } from "sisteransi";
13
13
  import * as g from "node:readline";
14
14
  import O from "node:readline";
15
15
  import { Writable } from "node:stream";
16
- import e from "picocolors";
17
16
  import { defineRpcFunction } from "@vitejs/devtools-kit";
18
17
  import { dirname, join } from "pathe";
19
- import { createSharedState } from "@vitejs/devtools-kit/utils/shared-state";
20
18
  import { join as join$1 } from "node:path";
21
19
  import { AsyncLocalStorage } from "node:async_hooks";
22
20
  import { createRpcServer } from "@vitejs/devtools-rpc";
@@ -69,8 +67,36 @@ var DevToolsDockHost = class {
69
67
  constructor(context) {
70
68
  this.context = context;
71
69
  }
72
- values() {
73
- return Array.from(this.views.values());
70
+ values({ includeBuiltin = true } = {}) {
71
+ const context = this.context;
72
+ const builtinDocksEntries = [
73
+ {
74
+ type: "~builtin",
75
+ id: "~terminals",
76
+ title: "Terminals",
77
+ icon: "ph:terminal-duotone",
78
+ category: "builtin",
79
+ get isHidden() {
80
+ return context.terminals.sessions.size === 0;
81
+ }
82
+ },
83
+ {
84
+ type: "~builtin",
85
+ id: "~logs",
86
+ title: "Logs",
87
+ icon: "ph:notification-duotone",
88
+ category: "builtin",
89
+ isHidden: true
90
+ },
91
+ {
92
+ type: "~builtin",
93
+ id: "~settings",
94
+ title: "Settings",
95
+ category: "builtin",
96
+ icon: "ph:gear-duotone"
97
+ }
98
+ ];
99
+ return [...Array.from(this.views.values()), ...includeBuiltin ? builtinDocksEntries : []];
74
100
  }
75
101
  register(view, force) {
76
102
  if (this.views.has(view.id) && !force) throw new Error(`Dock with id "${view.id}" is already registered`);
@@ -88,8 +114,65 @@ var DevToolsDockHost = class {
88
114
  }
89
115
  };
90
116
 
117
+ //#endregion
118
+ //#region src/node/rpc-shared-state.ts
119
+ const debug$1 = createDebug("vite:devtools:rpc:state:changed");
120
+ function createRpcSharedStateServerHost(rpc) {
121
+ const sharedState = /* @__PURE__ */ new Map();
122
+ function registerSharedState(key, state) {
123
+ const offs = [];
124
+ offs.push(state.on("updated", (fullState, patches, syncId) => {
125
+ if (patches) {
126
+ debug$1("patch", {
127
+ key,
128
+ syncId
129
+ });
130
+ rpc.broadcast({
131
+ method: "vite:internal:rpc:client-state:patch",
132
+ args: [
133
+ key,
134
+ patches,
135
+ syncId
136
+ ],
137
+ filter: (client) => client.$meta.subscribedStates.has(key)
138
+ });
139
+ } else {
140
+ debug$1("updated", {
141
+ key,
142
+ syncId
143
+ });
144
+ rpc.broadcast({
145
+ method: "vite:internal:rpc:client-state:updated",
146
+ args: [
147
+ key,
148
+ fullState,
149
+ syncId
150
+ ],
151
+ filter: (client) => client.$meta.subscribedStates.has(key)
152
+ });
153
+ }
154
+ }));
155
+ return () => {
156
+ for (const off of offs) off();
157
+ };
158
+ }
159
+ return { get: async (key, options) => {
160
+ if (sharedState.has(key)) return sharedState.get(key);
161
+ if (options?.initialValue === void 0) throw new Error(`Shared state of "${key}" is not found, please provide an initial value for the first time`);
162
+ debug$1("new-state", key);
163
+ const state = createSharedState({
164
+ initialValue: options.initialValue,
165
+ enablePatches: false
166
+ });
167
+ registerSharedState(key, state);
168
+ sharedState.set(key, state);
169
+ return state;
170
+ } };
171
+ }
172
+
91
173
  //#endregion
92
174
  //#region src/node/host-functions.ts
175
+ const debugBroadcast = createDebug("vite:devtools:rpc:broadcast");
93
176
  var RpcFunctionsHost = class extends RpcFunctionsCollectorBase {
94
177
  /**
95
178
  * @internal
@@ -98,10 +181,20 @@ var RpcFunctionsHost = class extends RpcFunctionsCollectorBase {
98
181
  _asyncStorage = void 0;
99
182
  constructor(context) {
100
183
  super(context);
184
+ this.sharedState = createRpcSharedStateServerHost(this);
101
185
  }
102
- broadcast(name, ...args) {
186
+ sharedState;
187
+ async broadcast(options) {
103
188
  if (!this._rpcGroup) throw new Error("RpcFunctionsHost] RpcGroup is not set, it likely to be an internal bug of Vite DevTools");
104
- return this._rpcGroup.broadcast.$callOptional(name, ...args);
189
+ debugBroadcast(JSON.stringify(options.method));
190
+ await Promise.all(this._rpcGroup.clients.map((client) => {
191
+ if (options.filter?.(client) === false) return void 0;
192
+ return client.$callRaw({
193
+ optional: true,
194
+ event: true,
195
+ ...options
196
+ });
197
+ }));
105
198
  }
106
199
  getCurrentRpcSession() {
107
200
  if (!this._asyncStorage) throw new Error("RpcFunctionsHost] AsyncLocalStorage is not set, it likely to be an internal bug of Vite DevTools");
@@ -233,8 +326,136 @@ var DevToolsViewHost = class {
233
326
  }
234
327
  };
235
328
 
329
+ //#endregion
330
+ //#region ../../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
331
+ var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
332
+ const ESC = "\x1B";
333
+ const CSI = `${ESC}[`;
334
+ const beep = "\x07";
335
+ const cursor = {
336
+ to(x$2, y$1) {
337
+ if (!y$1) return `${CSI}${x$2 + 1}G`;
338
+ return `${CSI}${y$1 + 1};${x$2 + 1}H`;
339
+ },
340
+ move(x$2, y$1) {
341
+ let ret = "";
342
+ if (x$2 < 0) ret += `${CSI}${-x$2}D`;
343
+ else if (x$2 > 0) ret += `${CSI}${x$2}C`;
344
+ if (y$1 < 0) ret += `${CSI}${-y$1}A`;
345
+ else if (y$1 > 0) ret += `${CSI}${y$1}B`;
346
+ return ret;
347
+ },
348
+ up: (count = 1) => `${CSI}${count}A`,
349
+ down: (count = 1) => `${CSI}${count}B`,
350
+ forward: (count = 1) => `${CSI}${count}C`,
351
+ backward: (count = 1) => `${CSI}${count}D`,
352
+ nextLine: (count = 1) => `${CSI}E`.repeat(count),
353
+ prevLine: (count = 1) => `${CSI}F`.repeat(count),
354
+ left: `${CSI}G`,
355
+ hide: `${CSI}?25l`,
356
+ show: `${CSI}?25h`,
357
+ save: `${ESC}7`,
358
+ restore: `${ESC}8`
359
+ };
360
+ const scroll = {
361
+ up: (count = 1) => `${CSI}S`.repeat(count),
362
+ down: (count = 1) => `${CSI}T`.repeat(count)
363
+ };
364
+ const erase = {
365
+ screen: `${CSI}2J`,
366
+ up: (count = 1) => `${CSI}1J`.repeat(count),
367
+ down: (count = 1) => `${CSI}J`.repeat(count),
368
+ line: `${CSI}2K`,
369
+ lineEnd: `${CSI}K`,
370
+ lineStart: `${CSI}1K`,
371
+ lines(count) {
372
+ let clear = "";
373
+ for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : "");
374
+ if (count) clear += cursor.left;
375
+ return clear;
376
+ }
377
+ };
378
+ module.exports = {
379
+ cursor,
380
+ scroll,
381
+ erase,
382
+ beep
383
+ };
384
+ }));
385
+
386
+ //#endregion
387
+ //#region ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
388
+ var require_picocolors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
389
+ let p = process || {}, argv = p.argv || [], env = p.env || {};
390
+ let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
391
+ let formatter = (open, close, replace = open) => (input) => {
392
+ let string = "" + input, index = string.indexOf(close, open.length);
393
+ return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
394
+ };
395
+ let replaceClose = (string, close, replace, index) => {
396
+ let result = "", cursor = 0;
397
+ do {
398
+ result += string.substring(cursor, index) + replace;
399
+ cursor = index + close.length;
400
+ index = string.indexOf(close, cursor);
401
+ } while (~index);
402
+ return result + string.substring(cursor);
403
+ };
404
+ let createColors = (enabled = isColorSupported) => {
405
+ let f = enabled ? formatter : () => String;
406
+ return {
407
+ isColorSupported: enabled,
408
+ reset: f("\x1B[0m", "\x1B[0m"),
409
+ bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
410
+ dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
411
+ italic: f("\x1B[3m", "\x1B[23m"),
412
+ underline: f("\x1B[4m", "\x1B[24m"),
413
+ inverse: f("\x1B[7m", "\x1B[27m"),
414
+ hidden: f("\x1B[8m", "\x1B[28m"),
415
+ strikethrough: f("\x1B[9m", "\x1B[29m"),
416
+ black: f("\x1B[30m", "\x1B[39m"),
417
+ red: f("\x1B[31m", "\x1B[39m"),
418
+ green: f("\x1B[32m", "\x1B[39m"),
419
+ yellow: f("\x1B[33m", "\x1B[39m"),
420
+ blue: f("\x1B[34m", "\x1B[39m"),
421
+ magenta: f("\x1B[35m", "\x1B[39m"),
422
+ cyan: f("\x1B[36m", "\x1B[39m"),
423
+ white: f("\x1B[37m", "\x1B[39m"),
424
+ gray: f("\x1B[90m", "\x1B[39m"),
425
+ bgBlack: f("\x1B[40m", "\x1B[49m"),
426
+ bgRed: f("\x1B[41m", "\x1B[49m"),
427
+ bgGreen: f("\x1B[42m", "\x1B[49m"),
428
+ bgYellow: f("\x1B[43m", "\x1B[49m"),
429
+ bgBlue: f("\x1B[44m", "\x1B[49m"),
430
+ bgMagenta: f("\x1B[45m", "\x1B[49m"),
431
+ bgCyan: f("\x1B[46m", "\x1B[49m"),
432
+ bgWhite: f("\x1B[47m", "\x1B[49m"),
433
+ blackBright: f("\x1B[90m", "\x1B[39m"),
434
+ redBright: f("\x1B[91m", "\x1B[39m"),
435
+ greenBright: f("\x1B[92m", "\x1B[39m"),
436
+ yellowBright: f("\x1B[93m", "\x1B[39m"),
437
+ blueBright: f("\x1B[94m", "\x1B[39m"),
438
+ magentaBright: f("\x1B[95m", "\x1B[39m"),
439
+ cyanBright: f("\x1B[96m", "\x1B[39m"),
440
+ whiteBright: f("\x1B[97m", "\x1B[39m"),
441
+ bgBlackBright: f("\x1B[100m", "\x1B[49m"),
442
+ bgRedBright: f("\x1B[101m", "\x1B[49m"),
443
+ bgGreenBright: f("\x1B[102m", "\x1B[49m"),
444
+ bgYellowBright: f("\x1B[103m", "\x1B[49m"),
445
+ bgBlueBright: f("\x1B[104m", "\x1B[49m"),
446
+ bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
447
+ bgCyanBright: f("\x1B[106m", "\x1B[49m"),
448
+ bgWhiteBright: f("\x1B[107m", "\x1B[49m")
449
+ };
450
+ };
451
+ module.exports = createColors();
452
+ module.exports.createColors = createColors;
453
+ }));
454
+
236
455
  //#endregion
237
456
  //#region ../../node_modules/.pnpm/@clack+core@0.5.0/node_modules/@clack/core/dist/index.mjs
457
+ var import_src = require_src();
458
+ var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
238
459
  function DD({ onlyFirst: e$1 = !1 } = {}) {
239
460
  const t = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
240
461
  return new RegExp(t, e$1 ? void 0 : "g");
@@ -552,7 +773,7 @@ function fD({ input: e$1 = stdin, output: u$1 = stdout, overwrite: t = !0, hideC
552
773
  C$1,
553
774
  n
554
775
  ], "cancel")) {
555
- F$1 && u$1.write(cursor.show), process.exit(0);
776
+ F$1 && u$1.write(import_src.cursor.show), process.exit(0);
556
777
  return;
557
778
  }
558
779
  if (!t) return;
@@ -563,8 +784,8 @@ function fD({ input: e$1 = stdin, output: u$1 = stdout, overwrite: t = !0, hideC
563
784
  });
564
785
  });
565
786
  };
566
- return F$1 && u$1.write(cursor.hide), e$1.once("keypress", i), () => {
567
- e$1.off("keypress", i), F$1 && u$1.write(cursor.show), e$1.isTTY && !AD && e$1.setRawMode(!1), s.terminal = !1, s.close();
787
+ return F$1 && u$1.write(import_src.cursor.hide), e$1.once("keypress", i), () => {
788
+ e$1.off("keypress", i), F$1 && u$1.write(import_src.cursor.show), e$1.isTTY && !AD && e$1.setRawMode(!1), s.terminal = !1, s.close();
568
789
  };
569
790
  }
570
791
  var gD = Object.defineProperty, vD = (e$1, u$1, t) => u$1 in e$1 ? gD(e$1, u$1, {
@@ -619,9 +840,9 @@ var x$1 = class {
619
840
  escapeCodeTimeout: 50,
620
841
  terminal: !0
621
842
  }), O.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== void 0 && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), m(this.input, !0), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
622
- this.output.write(cursor.show), this.output.off("resize", this.render), m(this.input, !1), u$1(this.value);
843
+ this.output.write(import_src.cursor.show), this.output.off("resize", this.render), m(this.input, !1), u$1(this.value);
623
844
  }), this.once("cancel", () => {
624
- this.output.write(cursor.show), this.output.off("resize", this.render), m(this.input, !1), u$1(S);
845
+ this.output.write(import_src.cursor.show), this.output.off("resize", this.render), m(this.input, !1), u$1(S);
625
846
  });
626
847
  });
627
848
  }
@@ -646,32 +867,32 @@ var x$1 = class {
646
867
  restoreCursor() {
647
868
  const u$1 = Y$1(this._prevFrame, process.stdout.columns, { hard: !0 }).split(`
648
869
  `).length - 1;
649
- this.output.write(cursor.move(-999, u$1 * -1));
870
+ this.output.write(import_src.cursor.move(-999, u$1 * -1));
650
871
  }
651
872
  render() {
652
873
  const u$1 = Y$1(this._render(this) ?? "", process.stdout.columns, { hard: !0 });
653
874
  if (u$1 !== this._prevFrame) {
654
- if (this.state === "initial") this.output.write(cursor.hide);
875
+ if (this.state === "initial") this.output.write(import_src.cursor.hide);
655
876
  else {
656
877
  const t = BD(this._prevFrame, u$1);
657
878
  if (this.restoreCursor(), t && t?.length === 1) {
658
879
  const F$1 = t[0];
659
- this.output.write(cursor.move(0, F$1)), this.output.write(erase.lines(1));
880
+ this.output.write(import_src.cursor.move(0, F$1)), this.output.write(import_src.erase.lines(1));
660
881
  const s = u$1.split(`
661
882
  `);
662
- this.output.write(s[F$1]), this._prevFrame = u$1, this.output.write(cursor.move(0, s.length - F$1 - 1));
883
+ this.output.write(s[F$1]), this._prevFrame = u$1, this.output.write(import_src.cursor.move(0, s.length - F$1 - 1));
663
884
  return;
664
885
  }
665
886
  if (t && t?.length > 1) {
666
887
  const F$1 = t[0];
667
- this.output.write(cursor.move(0, F$1)), this.output.write(erase.down());
888
+ this.output.write(import_src.cursor.move(0, F$1)), this.output.write(import_src.erase.down());
668
889
  const s = u$1.split(`
669
890
  `).slice(F$1);
670
891
  this.output.write(s.join(`
671
892
  `)), this._prevFrame = u$1;
672
893
  return;
673
894
  }
674
- this.output.write(erase.down());
895
+ this.output.write(import_src.erase.down());
675
896
  }
676
897
  this.output.write(u$1), this.state === "initial" && (this.state = "active"), this._prevFrame = u$1;
677
898
  }
@@ -688,7 +909,7 @@ var dD = class extends x$1 {
688
909
  super(u$1, !1), this.value = !!u$1.initialValue, this.on("value", () => {
689
910
  this.value = this._value;
690
911
  }), this.on("confirm", (t) => {
691
- this.output.write(cursor.move(0, -1)), this.value = t, this.state = "submit", this.close();
912
+ this.output.write(import_src.cursor.move(0, -1)), this.value = t, this.state = "submit", this.close();
692
913
  }), this.on("cursor", () => {
693
914
  this.value = !this.value;
694
915
  });
@@ -800,10 +1021,10 @@ var MD = class extends x$1 {
800
1021
  super(t), U$1(this, "valueWithCursor", ""), U$1(this, "_mask", "•"), this._mask = u$1 ?? "•", this.on("finalize", () => {
801
1022
  this.valueWithCursor = this.masked;
802
1023
  }), this.on("value", () => {
803
- if (this.cursor >= this.value.length) this.valueWithCursor = `${this.masked}${e.inverse(e.hidden("_"))}`;
1024
+ if (this.cursor >= this.value.length) this.valueWithCursor = `${this.masked}${import_picocolors.default.inverse(import_picocolors.default.hidden("_"))}`;
804
1025
  else {
805
1026
  const F$1 = this.masked.slice(0, this.cursor), s = this.masked.slice(this.cursor);
806
- this.valueWithCursor = `${F$1}${e.inverse(s[0])}${s.slice(1)}`;
1027
+ this.valueWithCursor = `${F$1}${import_picocolors.default.inverse(s[0])}${s.slice(1)}`;
807
1028
  }
808
1029
  });
809
1030
  }
@@ -865,7 +1086,7 @@ var RD = class extends x$1 {
865
1086
  if (this.state === "submit") return this.value;
866
1087
  if (this.cursor >= this.value.length) return `${this.value}\u2588`;
867
1088
  const u$1 = this.value.slice(0, this.cursor), [t, ...F$1] = this.value.slice(this.cursor);
868
- return `${u$1}${e.inverse(t)}${F$1.join("")}`;
1089
+ return `${u$1}${import_picocolors.default.inverse(t)}${F$1.join("")}`;
869
1090
  }
870
1091
  get cursor() {
871
1092
  return this._cursor;
@@ -885,19 +1106,19 @@ function ce() {
885
1106
  const V = ce(), u = (t, n) => V ? t : n, le = u("◆", "*"), L = u("■", "x"), W = u("▲", "x"), C = u("◇", "o"), ue = u("┌", "T"), o = u("│", "|"), d = u("└", "—"), k = u("●", ">"), P = u("○", " "), A = u("◻", "[•]"), T = u("◼", "[+]"), F = u("◻", "[ ]"), $e = u("▪", "•"), _ = u("─", "-"), me = u("╮", "+"), de = u("├", "+"), pe = u("╯", "+"), q = u("●", "•"), D = u("◆", "*"), U = u("▲", "!"), K = u("■", "x"), b = (t) => {
886
1107
  switch (t) {
887
1108
  case "initial":
888
- case "active": return e.cyan(le);
889
- case "cancel": return e.red(L);
890
- case "error": return e.yellow(W);
891
- case "submit": return e.green(C);
1109
+ case "active": return import_picocolors.default.cyan(le);
1110
+ case "cancel": return import_picocolors.default.red(L);
1111
+ case "error": return import_picocolors.default.yellow(W);
1112
+ case "submit": return import_picocolors.default.green(C);
892
1113
  }
893
1114
  }, G = (t) => {
894
1115
  const { cursor: n, options: r$2, style: i } = t, s = t.maxItems ?? Number.POSITIVE_INFINITY, c = Math.max(process.stdout.rows - 4, 0), a$1 = Math.min(c, Math.max(s, 5));
895
- let l = 0;
896
- n >= l + a$1 - 3 ? l = Math.max(Math.min(n - a$1 + 3, r$2.length - a$1), 0) : n < l + 2 && (l = Math.max(n - 2, 0));
897
- const $$1 = a$1 < r$2.length && l > 0, g$1 = a$1 < r$2.length && l + a$1 < r$2.length;
898
- return r$2.slice(l, l + a$1).map((p$1, v, f) => {
899
- const j = v === 0 && $$1, E = v === f.length - 1 && g$1;
900
- return j || E ? e.dim("...") : i(p$1, v + l === n);
1116
+ let l$1 = 0;
1117
+ n >= l$1 + a$1 - 3 ? l$1 = Math.max(Math.min(n - a$1 + 3, r$2.length - a$1), 0) : n < l$1 + 2 && (l$1 = Math.max(n - 2, 0));
1118
+ const $$1 = a$1 < r$2.length && l$1 > 0, g$1 = a$1 < r$2.length && l$1 + a$1 < r$2.length;
1119
+ return r$2.slice(l$1, l$1 + a$1).map((p$1, v$1, f) => {
1120
+ const j = v$1 === 0 && $$1, E = v$1 === f.length - 1 && g$1;
1121
+ return j || E ? import_picocolors.default.dim("...") : i(p$1, v$1 + l$1 === n);
901
1122
  });
902
1123
  }, he = (t) => new RD({
903
1124
  validate: t.validate,
@@ -905,19 +1126,19 @@ const V = ce(), u = (t, n) => V ? t : n, le = u("◆", "*"), L = u("■", "x"),
905
1126
  defaultValue: t.defaultValue,
906
1127
  initialValue: t.initialValue,
907
1128
  render() {
908
- const n = `${e.gray(o)}
1129
+ const n = `${import_picocolors.default.gray(o)}
909
1130
  ${b(this.state)} ${t.message}
910
- `, r$2 = t.placeholder ? e.inverse(t.placeholder[0]) + e.dim(t.placeholder.slice(1)) : e.inverse(e.hidden("_")), i = this.value ? this.valueWithCursor : r$2;
1131
+ `, r$2 = t.placeholder ? import_picocolors.default.inverse(t.placeholder[0]) + import_picocolors.default.dim(t.placeholder.slice(1)) : import_picocolors.default.inverse(import_picocolors.default.hidden("_")), i = this.value ? this.valueWithCursor : r$2;
911
1132
  switch (this.state) {
912
1133
  case "error": return `${n.trim()}
913
- ${e.yellow(o)} ${i}
914
- ${e.yellow(d)} ${e.yellow(this.error)}
1134
+ ${import_picocolors.default.yellow(o)} ${i}
1135
+ ${import_picocolors.default.yellow(d)} ${import_picocolors.default.yellow(this.error)}
915
1136
  `;
916
- case "submit": return `${n}${e.gray(o)} ${e.dim(this.value || t.placeholder)}`;
917
- case "cancel": return `${n}${e.gray(o)} ${e.strikethrough(e.dim(this.value ?? ""))}${this.value?.trim() ? `
918
- ${e.gray(o)}` : ""}`;
919
- default: return `${n}${e.cyan(o)} ${i}
920
- ${e.cyan(d)}
1137
+ case "submit": return `${n}${import_picocolors.default.gray(o)} ${import_picocolors.default.dim(this.value || t.placeholder)}`;
1138
+ case "cancel": return `${n}${import_picocolors.default.gray(o)} ${import_picocolors.default.strikethrough(import_picocolors.default.dim(this.value ?? ""))}${this.value?.trim() ? `
1139
+ ${import_picocolors.default.gray(o)}` : ""}`;
1140
+ default: return `${n}${import_picocolors.default.cyan(o)} ${i}
1141
+ ${import_picocolors.default.cyan(d)}
921
1142
  `;
922
1143
  }
923
1144
  }
@@ -925,19 +1146,19 @@ ${e.cyan(d)}
925
1146
  validate: t.validate,
926
1147
  mask: t.mask ?? $e,
927
1148
  render() {
928
- const n = `${e.gray(o)}
1149
+ const n = `${import_picocolors.default.gray(o)}
929
1150
  ${b(this.state)} ${t.message}
930
1151
  `, r$2 = this.valueWithCursor, i = this.masked;
931
1152
  switch (this.state) {
932
1153
  case "error": return `${n.trim()}
933
- ${e.yellow(o)} ${i}
934
- ${e.yellow(d)} ${e.yellow(this.error)}
1154
+ ${import_picocolors.default.yellow(o)} ${i}
1155
+ ${import_picocolors.default.yellow(d)} ${import_picocolors.default.yellow(this.error)}
935
1156
  `;
936
- case "submit": return `${n}${e.gray(o)} ${e.dim(i)}`;
937
- case "cancel": return `${n}${e.gray(o)} ${e.strikethrough(e.dim(i ?? ""))}${i ? `
938
- ${e.gray(o)}` : ""}`;
939
- default: return `${n}${e.cyan(o)} ${r$2}
940
- ${e.cyan(d)}
1157
+ case "submit": return `${n}${import_picocolors.default.gray(o)} ${import_picocolors.default.dim(i)}`;
1158
+ case "cancel": return `${n}${import_picocolors.default.gray(o)} ${import_picocolors.default.strikethrough(import_picocolors.default.dim(i ?? ""))}${i ? `
1159
+ ${import_picocolors.default.gray(o)}` : ""}`;
1160
+ default: return `${n}${import_picocolors.default.cyan(o)} ${r$2}
1161
+ ${import_picocolors.default.cyan(d)}
941
1162
  `;
942
1163
  }
943
1164
  }
@@ -948,15 +1169,15 @@ ${e.cyan(d)}
948
1169
  inactive: r$2,
949
1170
  initialValue: t.initialValue ?? !0,
950
1171
  render() {
951
- const i = `${e.gray(o)}
1172
+ const i = `${import_picocolors.default.gray(o)}
952
1173
  ${b(this.state)} ${t.message}
953
1174
  `, s = this.value ? n : r$2;
954
1175
  switch (this.state) {
955
- case "submit": return `${i}${e.gray(o)} ${e.dim(s)}`;
956
- case "cancel": return `${i}${e.gray(o)} ${e.strikethrough(e.dim(s))}
957
- ${e.gray(o)}`;
958
- default: return `${i}${e.cyan(o)} ${this.value ? `${e.green(k)} ${n}` : `${e.dim(P)} ${e.dim(n)}`} ${e.dim("/")} ${this.value ? `${e.dim(P)} ${e.dim(r$2)}` : `${e.green(k)} ${r$2}`}
959
- ${e.cyan(d)}
1176
+ case "submit": return `${i}${import_picocolors.default.gray(o)} ${import_picocolors.default.dim(s)}`;
1177
+ case "cancel": return `${i}${import_picocolors.default.gray(o)} ${import_picocolors.default.strikethrough(import_picocolors.default.dim(s))}
1178
+ ${import_picocolors.default.gray(o)}`;
1179
+ default: return `${i}${import_picocolors.default.cyan(o)} ${this.value ? `${import_picocolors.default.green(k)} ${n}` : `${import_picocolors.default.dim(P)} ${import_picocolors.default.dim(n)}`} ${import_picocolors.default.dim("/")} ${this.value ? `${import_picocolors.default.dim(P)} ${import_picocolors.default.dim(r$2)}` : `${import_picocolors.default.green(k)} ${r$2}`}
1180
+ ${import_picocolors.default.cyan(d)}
960
1181
  `;
961
1182
  }
962
1183
  }
@@ -965,31 +1186,31 @@ ${e.cyan(d)}
965
1186
  const n = (r$2, i) => {
966
1187
  const s = r$2.label ?? String(r$2.value);
967
1188
  switch (i) {
968
- case "selected": return `${e.dim(s)}`;
969
- case "active": return `${e.green(k)} ${s} ${r$2.hint ? e.dim(`(${r$2.hint})`) : ""}`;
970
- case "cancelled": return `${e.strikethrough(e.dim(s))}`;
971
- default: return `${e.dim(P)} ${e.dim(s)}`;
1189
+ case "selected": return `${import_picocolors.default.dim(s)}`;
1190
+ case "active": return `${import_picocolors.default.green(k)} ${s} ${r$2.hint ? import_picocolors.default.dim(`(${r$2.hint})`) : ""}`;
1191
+ case "cancelled": return `${import_picocolors.default.strikethrough(import_picocolors.default.dim(s))}`;
1192
+ default: return `${import_picocolors.default.dim(P)} ${import_picocolors.default.dim(s)}`;
972
1193
  }
973
1194
  };
974
1195
  return new LD({
975
1196
  options: t.options,
976
1197
  initialValue: t.initialValue,
977
1198
  render() {
978
- const r$2 = `${e.gray(o)}
1199
+ const r$2 = `${import_picocolors.default.gray(o)}
979
1200
  ${b(this.state)} ${t.message}
980
1201
  `;
981
1202
  switch (this.state) {
982
- case "submit": return `${r$2}${e.gray(o)} ${n(this.options[this.cursor], "selected")}`;
983
- case "cancel": return `${r$2}${e.gray(o)} ${n(this.options[this.cursor], "cancelled")}
984
- ${e.gray(o)}`;
985
- default: return `${r$2}${e.cyan(o)} ${G({
1203
+ case "submit": return `${r$2}${import_picocolors.default.gray(o)} ${n(this.options[this.cursor], "selected")}`;
1204
+ case "cancel": return `${r$2}${import_picocolors.default.gray(o)} ${n(this.options[this.cursor], "cancelled")}
1205
+ ${import_picocolors.default.gray(o)}`;
1206
+ default: return `${r$2}${import_picocolors.default.cyan(o)} ${G({
986
1207
  cursor: this.cursor,
987
1208
  options: this.options,
988
1209
  maxItems: t.maxItems,
989
1210
  style: (i, s) => n(i, s ? "active" : "inactive")
990
1211
  }).join(`
991
- ${e.cyan(o)} `)}
992
- ${e.cyan(d)}
1212
+ ${import_picocolors.default.cyan(o)} `)}
1213
+ ${import_picocolors.default.cyan(d)}
993
1214
  `;
994
1215
  }
995
1216
  }
@@ -997,22 +1218,22 @@ ${e.cyan(d)}
997
1218
  }, we = (t) => {
998
1219
  const n = (r$2, i = "inactive") => {
999
1220
  const s = r$2.label ?? String(r$2.value);
1000
- return i === "selected" ? `${e.dim(s)}` : i === "cancelled" ? `${e.strikethrough(e.dim(s))}` : i === "active" ? `${e.bgCyan(e.gray(` ${r$2.value} `))} ${s} ${r$2.hint ? e.dim(`(${r$2.hint})`) : ""}` : `${e.gray(e.bgWhite(e.inverse(` ${r$2.value} `)))} ${s} ${r$2.hint ? e.dim(`(${r$2.hint})`) : ""}`;
1221
+ return i === "selected" ? `${import_picocolors.default.dim(s)}` : i === "cancelled" ? `${import_picocolors.default.strikethrough(import_picocolors.default.dim(s))}` : i === "active" ? `${import_picocolors.default.bgCyan(import_picocolors.default.gray(` ${r$2.value} `))} ${s} ${r$2.hint ? import_picocolors.default.dim(`(${r$2.hint})`) : ""}` : `${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(` ${r$2.value} `)))} ${s} ${r$2.hint ? import_picocolors.default.dim(`(${r$2.hint})`) : ""}`;
1001
1222
  };
1002
1223
  return new ID({
1003
1224
  options: t.options,
1004
1225
  initialValue: t.initialValue,
1005
1226
  render() {
1006
- const r$2 = `${e.gray(o)}
1227
+ const r$2 = `${import_picocolors.default.gray(o)}
1007
1228
  ${b(this.state)} ${t.message}
1008
1229
  `;
1009
1230
  switch (this.state) {
1010
- case "submit": return `${r$2}${e.gray(o)} ${n(this.options.find((i) => i.value === this.value) ?? t.options[0], "selected")}`;
1011
- case "cancel": return `${r$2}${e.gray(o)} ${n(this.options[0], "cancelled")}
1012
- ${e.gray(o)}`;
1013
- default: return `${r$2}${e.cyan(o)} ${this.options.map((i, s) => n(i, s === this.cursor ? "active" : "inactive")).join(`
1014
- ${e.cyan(o)} `)}
1015
- ${e.cyan(d)}
1231
+ case "submit": return `${r$2}${import_picocolors.default.gray(o)} ${n(this.options.find((i) => i.value === this.value) ?? t.options[0], "selected")}`;
1232
+ case "cancel": return `${r$2}${import_picocolors.default.gray(o)} ${n(this.options[0], "cancelled")}
1233
+ ${import_picocolors.default.gray(o)}`;
1234
+ default: return `${r$2}${import_picocolors.default.cyan(o)} ${this.options.map((i, s) => n(i, s === this.cursor ? "active" : "inactive")).join(`
1235
+ ${import_picocolors.default.cyan(o)} `)}
1236
+ ${import_picocolors.default.cyan(d)}
1016
1237
  `;
1017
1238
  }
1018
1239
  }
@@ -1020,7 +1241,7 @@ ${e.cyan(d)}
1020
1241
  }, fe = (t) => {
1021
1242
  const n = (r$2, i) => {
1022
1243
  const s = r$2.label ?? String(r$2.value);
1023
- return i === "active" ? `${e.cyan(A)} ${s} ${r$2.hint ? e.dim(`(${r$2.hint})`) : ""}` : i === "selected" ? `${e.green(T)} ${e.dim(s)} ${r$2.hint ? e.dim(`(${r$2.hint})`) : ""}` : i === "cancelled" ? `${e.strikethrough(e.dim(s))}` : i === "active-selected" ? `${e.green(T)} ${s} ${r$2.hint ? e.dim(`(${r$2.hint})`) : ""}` : i === "submitted" ? `${e.dim(s)}` : `${e.dim(F)} ${e.dim(s)}`;
1244
+ return i === "active" ? `${import_picocolors.default.cyan(A)} ${s} ${r$2.hint ? import_picocolors.default.dim(`(${r$2.hint})`) : ""}` : i === "selected" ? `${import_picocolors.default.green(T)} ${import_picocolors.default.dim(s)} ${r$2.hint ? import_picocolors.default.dim(`(${r$2.hint})`) : ""}` : i === "cancelled" ? `${import_picocolors.default.strikethrough(import_picocolors.default.dim(s))}` : i === "active-selected" ? `${import_picocolors.default.green(T)} ${s} ${r$2.hint ? import_picocolors.default.dim(`(${r$2.hint})`) : ""}` : i === "submitted" ? `${import_picocolors.default.dim(s)}` : `${import_picocolors.default.dim(F)} ${import_picocolors.default.dim(s)}`;
1024
1245
  };
1025
1246
  return new SD({
1026
1247
  options: t.options,
@@ -1029,63 +1250,63 @@ ${e.cyan(d)}
1029
1250
  cursorAt: t.cursorAt,
1030
1251
  validate(r$2) {
1031
1252
  if (this.required && r$2.length === 0) return `Please select at least one option.
1032
- ${e.reset(e.dim(`Press ${e.gray(e.bgWhite(e.inverse(" space ")))} to select, ${e.gray(e.bgWhite(e.inverse(" enter ")))} to submit`))}`;
1253
+ ${import_picocolors.default.reset(import_picocolors.default.dim(`Press ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" space ")))} to select, ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" enter ")))} to submit`))}`;
1033
1254
  },
1034
1255
  render() {
1035
- const r$2 = `${e.gray(o)}
1256
+ const r$2 = `${import_picocolors.default.gray(o)}
1036
1257
  ${b(this.state)} ${t.message}
1037
1258
  `, i = (s, c) => {
1038
1259
  const a$1 = this.value.includes(s.value);
1039
1260
  return c && a$1 ? n(s, "active-selected") : a$1 ? n(s, "selected") : n(s, c ? "active" : "inactive");
1040
1261
  };
1041
1262
  switch (this.state) {
1042
- case "submit": return `${r$2}${e.gray(o)} ${this.options.filter(({ value: s }) => this.value.includes(s)).map((s) => n(s, "submitted")).join(e.dim(", ")) || e.dim("none")}`;
1263
+ case "submit": return `${r$2}${import_picocolors.default.gray(o)} ${this.options.filter(({ value: s }) => this.value.includes(s)).map((s) => n(s, "submitted")).join(import_picocolors.default.dim(", ")) || import_picocolors.default.dim("none")}`;
1043
1264
  case "cancel": {
1044
- const s = this.options.filter(({ value: c }) => this.value.includes(c)).map((c) => n(c, "cancelled")).join(e.dim(", "));
1045
- return `${r$2}${e.gray(o)} ${s.trim() ? `${s}
1046
- ${e.gray(o)}` : ""}`;
1265
+ const s = this.options.filter(({ value: c }) => this.value.includes(c)).map((c) => n(c, "cancelled")).join(import_picocolors.default.dim(", "));
1266
+ return `${r$2}${import_picocolors.default.gray(o)} ${s.trim() ? `${s}
1267
+ ${import_picocolors.default.gray(o)}` : ""}`;
1047
1268
  }
1048
1269
  case "error": {
1049
1270
  const s = this.error.split(`
1050
- `).map((c, a$1) => a$1 === 0 ? `${e.yellow(d)} ${e.yellow(c)}` : ` ${c}`).join(`
1271
+ `).map((c, a$1) => a$1 === 0 ? `${import_picocolors.default.yellow(d)} ${import_picocolors.default.yellow(c)}` : ` ${c}`).join(`
1051
1272
  `);
1052
- return `${r$2 + e.yellow(o)} ${G({
1273
+ return `${r$2 + import_picocolors.default.yellow(o)} ${G({
1053
1274
  options: this.options,
1054
1275
  cursor: this.cursor,
1055
1276
  maxItems: t.maxItems,
1056
1277
  style: i
1057
1278
  }).join(`
1058
- ${e.yellow(o)} `)}
1279
+ ${import_picocolors.default.yellow(o)} `)}
1059
1280
  ${s}
1060
1281
  `;
1061
1282
  }
1062
- default: return `${r$2}${e.cyan(o)} ${G({
1283
+ default: return `${r$2}${import_picocolors.default.cyan(o)} ${G({
1063
1284
  options: this.options,
1064
1285
  cursor: this.cursor,
1065
1286
  maxItems: t.maxItems,
1066
1287
  style: i
1067
1288
  }).join(`
1068
- ${e.cyan(o)} `)}
1069
- ${e.cyan(d)}
1289
+ ${import_picocolors.default.cyan(o)} `)}
1290
+ ${import_picocolors.default.cyan(d)}
1070
1291
  `;
1071
1292
  }
1072
1293
  }
1073
1294
  }).prompt();
1074
1295
  }, be = (t) => {
1075
1296
  const { selectableGroups: n = !0 } = t, r$2 = (i, s, c = []) => {
1076
- const a$1 = i.label ?? String(i.value), l = typeof i.group == "string", $$1 = l && (c[c.indexOf(i) + 1] ?? { group: !0 }), g$1 = l && $$1.group === !0, p$1 = l ? n ? `${g$1 ? d : o} ` : " " : "";
1077
- if (s === "active") return `${e.dim(p$1)}${e.cyan(A)} ${a$1} ${i.hint ? e.dim(`(${i.hint})`) : ""}`;
1078
- if (s === "group-active") return `${p$1}${e.cyan(A)} ${e.dim(a$1)}`;
1079
- if (s === "group-active-selected") return `${p$1}${e.green(T)} ${e.dim(a$1)}`;
1297
+ const a$1 = i.label ?? String(i.value), l$1 = typeof i.group == "string", $$1 = l$1 && (c[c.indexOf(i) + 1] ?? { group: !0 }), g$1 = l$1 && $$1.group === !0, p$1 = l$1 ? n ? `${g$1 ? d : o} ` : " " : "";
1298
+ if (s === "active") return `${import_picocolors.default.dim(p$1)}${import_picocolors.default.cyan(A)} ${a$1} ${i.hint ? import_picocolors.default.dim(`(${i.hint})`) : ""}`;
1299
+ if (s === "group-active") return `${p$1}${import_picocolors.default.cyan(A)} ${import_picocolors.default.dim(a$1)}`;
1300
+ if (s === "group-active-selected") return `${p$1}${import_picocolors.default.green(T)} ${import_picocolors.default.dim(a$1)}`;
1080
1301
  if (s === "selected") {
1081
- const f = l || n ? e.green(T) : "";
1082
- return `${e.dim(p$1)}${f} ${e.dim(a$1)} ${i.hint ? e.dim(`(${i.hint})`) : ""}`;
1302
+ const f = l$1 || n ? import_picocolors.default.green(T) : "";
1303
+ return `${import_picocolors.default.dim(p$1)}${f} ${import_picocolors.default.dim(a$1)} ${i.hint ? import_picocolors.default.dim(`(${i.hint})`) : ""}`;
1083
1304
  }
1084
- if (s === "cancelled") return `${e.strikethrough(e.dim(a$1))}`;
1085
- if (s === "active-selected") return `${e.dim(p$1)}${e.green(T)} ${a$1} ${i.hint ? e.dim(`(${i.hint})`) : ""}`;
1086
- if (s === "submitted") return `${e.dim(a$1)}`;
1087
- const v = l || n ? e.dim(F) : "";
1088
- return `${e.dim(p$1)}${v} ${e.dim(a$1)}`;
1305
+ if (s === "cancelled") return `${import_picocolors.default.strikethrough(import_picocolors.default.dim(a$1))}`;
1306
+ if (s === "active-selected") return `${import_picocolors.default.dim(p$1)}${import_picocolors.default.green(T)} ${a$1} ${i.hint ? import_picocolors.default.dim(`(${i.hint})`) : ""}`;
1307
+ if (s === "submitted") return `${import_picocolors.default.dim(a$1)}`;
1308
+ const v$1 = l$1 || n ? import_picocolors.default.dim(F) : "";
1309
+ return `${import_picocolors.default.dim(p$1)}${v$1} ${import_picocolors.default.dim(a$1)}`;
1089
1310
  };
1090
1311
  return new _D({
1091
1312
  options: t.options,
@@ -1095,37 +1316,37 @@ ${e.cyan(d)}
1095
1316
  selectableGroups: n,
1096
1317
  validate(i) {
1097
1318
  if (this.required && i.length === 0) return `Please select at least one option.
1098
- ${e.reset(e.dim(`Press ${e.gray(e.bgWhite(e.inverse(" space ")))} to select, ${e.gray(e.bgWhite(e.inverse(" enter ")))} to submit`))}`;
1319
+ ${import_picocolors.default.reset(import_picocolors.default.dim(`Press ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" space ")))} to select, ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" enter ")))} to submit`))}`;
1099
1320
  },
1100
1321
  render() {
1101
- const i = `${e.gray(o)}
1322
+ const i = `${import_picocolors.default.gray(o)}
1102
1323
  ${b(this.state)} ${t.message}
1103
1324
  `;
1104
1325
  switch (this.state) {
1105
- case "submit": return `${i}${e.gray(o)} ${this.options.filter(({ value: s }) => this.value.includes(s)).map((s) => r$2(s, "submitted")).join(e.dim(", "))}`;
1326
+ case "submit": return `${i}${import_picocolors.default.gray(o)} ${this.options.filter(({ value: s }) => this.value.includes(s)).map((s) => r$2(s, "submitted")).join(import_picocolors.default.dim(", "))}`;
1106
1327
  case "cancel": {
1107
- const s = this.options.filter(({ value: c }) => this.value.includes(c)).map((c) => r$2(c, "cancelled")).join(e.dim(", "));
1108
- return `${i}${e.gray(o)} ${s.trim() ? `${s}
1109
- ${e.gray(o)}` : ""}`;
1328
+ const s = this.options.filter(({ value: c }) => this.value.includes(c)).map((c) => r$2(c, "cancelled")).join(import_picocolors.default.dim(", "));
1329
+ return `${i}${import_picocolors.default.gray(o)} ${s.trim() ? `${s}
1330
+ ${import_picocolors.default.gray(o)}` : ""}`;
1110
1331
  }
1111
1332
  case "error": {
1112
1333
  const s = this.error.split(`
1113
- `).map((c, a$1) => a$1 === 0 ? `${e.yellow(d)} ${e.yellow(c)}` : ` ${c}`).join(`
1334
+ `).map((c, a$1) => a$1 === 0 ? `${import_picocolors.default.yellow(d)} ${import_picocolors.default.yellow(c)}` : ` ${c}`).join(`
1114
1335
  `);
1115
- return `${i}${e.yellow(o)} ${this.options.map((c, a$1, l) => {
1336
+ return `${i}${import_picocolors.default.yellow(o)} ${this.options.map((c, a$1, l$1) => {
1116
1337
  const $$1 = this.value.includes(c.value) || c.group === !0 && this.isGroupSelected(`${c.value}`), g$1 = a$1 === this.cursor;
1117
- return !g$1 && typeof c.group == "string" && this.options[this.cursor].value === c.group ? r$2(c, $$1 ? "group-active-selected" : "group-active", l) : g$1 && $$1 ? r$2(c, "active-selected", l) : $$1 ? r$2(c, "selected", l) : r$2(c, g$1 ? "active" : "inactive", l);
1338
+ return !g$1 && typeof c.group == "string" && this.options[this.cursor].value === c.group ? r$2(c, $$1 ? "group-active-selected" : "group-active", l$1) : g$1 && $$1 ? r$2(c, "active-selected", l$1) : $$1 ? r$2(c, "selected", l$1) : r$2(c, g$1 ? "active" : "inactive", l$1);
1118
1339
  }).join(`
1119
- ${e.yellow(o)} `)}
1340
+ ${import_picocolors.default.yellow(o)} `)}
1120
1341
  ${s}
1121
1342
  `;
1122
1343
  }
1123
- default: return `${i}${e.cyan(o)} ${this.options.map((s, c, a$1) => {
1124
- const l = this.value.includes(s.value) || s.group === !0 && this.isGroupSelected(`${s.value}`), $$1 = c === this.cursor;
1125
- return !$$1 && typeof s.group == "string" && this.options[this.cursor].value === s.group ? r$2(s, l ? "group-active-selected" : "group-active", a$1) : $$1 && l ? r$2(s, "active-selected", a$1) : l ? r$2(s, "selected", a$1) : r$2(s, $$1 ? "active" : "inactive", a$1);
1344
+ default: return `${i}${import_picocolors.default.cyan(o)} ${this.options.map((s, c, a$1) => {
1345
+ const l$1 = this.value.includes(s.value) || s.group === !0 && this.isGroupSelected(`${s.value}`), $$1 = c === this.cursor;
1346
+ return !$$1 && typeof s.group == "string" && this.options[this.cursor].value === s.group ? r$2(s, l$1 ? "group-active-selected" : "group-active", a$1) : $$1 && l$1 ? r$2(s, "active-selected", a$1) : l$1 ? r$2(s, "selected", a$1) : r$2(s, $$1 ? "active" : "inactive", a$1);
1126
1347
  }).join(`
1127
- ${e.cyan(o)} `)}
1128
- ${e.cyan(d)}
1348
+ ${import_picocolors.default.cyan(o)} `)}
1349
+ ${import_picocolors.default.cyan(d)}
1129
1350
  `;
1130
1351
  }
1131
1352
  }
@@ -1134,61 +1355,61 @@ ${e.cyan(d)}
1134
1355
  const r$2 = `
1135
1356
  ${t}
1136
1357
  `.split(`
1137
- `), i = stripVTControlCharacters(n).length, s = Math.max(r$2.reduce((a$1, l) => {
1138
- const $$1 = stripVTControlCharacters(l);
1358
+ `), i = stripVTControlCharacters(n).length, s = Math.max(r$2.reduce((a$1, l$1) => {
1359
+ const $$1 = stripVTControlCharacters(l$1);
1139
1360
  return $$1.length > a$1 ? $$1.length : a$1;
1140
- }, 0), i) + 2, c = r$2.map((a$1) => `${e.gray(o)} ${e.dim(a$1)}${" ".repeat(s - stripVTControlCharacters(a$1).length)}${e.gray(o)}`).join(`
1361
+ }, 0), i) + 2, c = r$2.map((a$1) => `${import_picocolors.default.gray(o)} ${import_picocolors.default.dim(a$1)}${" ".repeat(s - stripVTControlCharacters(a$1).length)}${import_picocolors.default.gray(o)}`).join(`
1141
1362
  `);
1142
- process.stdout.write(`${e.gray(o)}
1143
- ${e.green(C)} ${e.reset(n)} ${e.gray(_.repeat(Math.max(s - i - 1, 1)) + me)}
1363
+ process.stdout.write(`${import_picocolors.default.gray(o)}
1364
+ ${import_picocolors.default.green(C)} ${import_picocolors.default.reset(n)} ${import_picocolors.default.gray(_.repeat(Math.max(s - i - 1, 1)) + me)}
1144
1365
  ${c}
1145
- ${e.gray(de + _.repeat(s + 2) + pe)}
1366
+ ${import_picocolors.default.gray(de + _.repeat(s + 2) + pe)}
1146
1367
  `);
1147
1368
  }, xe = (t = "") => {
1148
- process.stdout.write(`${e.gray(d)} ${e.red(t)}
1369
+ process.stdout.write(`${import_picocolors.default.gray(d)} ${import_picocolors.default.red(t)}
1149
1370
 
1150
1371
  `);
1151
1372
  }, Ie = (t = "") => {
1152
- process.stdout.write(`${e.gray(ue)} ${t}
1373
+ process.stdout.write(`${import_picocolors.default.gray(ue)} ${t}
1153
1374
  `);
1154
1375
  }, Se = (t = "") => {
1155
- process.stdout.write(`${e.gray(o)}
1156
- ${e.gray(d)} ${t}
1376
+ process.stdout.write(`${import_picocolors.default.gray(o)}
1377
+ ${import_picocolors.default.gray(d)} ${t}
1157
1378
 
1158
1379
  `);
1159
1380
  }, M = {
1160
- message: (t = "", { symbol: n = e.gray(o) } = {}) => {
1161
- const r$2 = [`${e.gray(o)}`];
1381
+ message: (t = "", { symbol: n = import_picocolors.default.gray(o) } = {}) => {
1382
+ const r$2 = [`${import_picocolors.default.gray(o)}`];
1162
1383
  if (t) {
1163
1384
  const [i, ...s] = t.split(`
1164
1385
  `);
1165
- r$2.push(`${n} ${i}`, ...s.map((c) => `${e.gray(o)} ${c}`));
1386
+ r$2.push(`${n} ${i}`, ...s.map((c) => `${import_picocolors.default.gray(o)} ${c}`));
1166
1387
  }
1167
1388
  process.stdout.write(`${r$2.join(`
1168
1389
  `)}
1169
1390
  `);
1170
1391
  },
1171
1392
  info: (t) => {
1172
- M.message(t, { symbol: e.blue(q) });
1393
+ M.message(t, { symbol: import_picocolors.default.blue(q) });
1173
1394
  },
1174
1395
  success: (t) => {
1175
- M.message(t, { symbol: e.green(D) });
1396
+ M.message(t, { symbol: import_picocolors.default.green(D) });
1176
1397
  },
1177
1398
  step: (t) => {
1178
- M.message(t, { symbol: e.green(C) });
1399
+ M.message(t, { symbol: import_picocolors.default.green(C) });
1179
1400
  },
1180
1401
  warn: (t) => {
1181
- M.message(t, { symbol: e.yellow(U) });
1402
+ M.message(t, { symbol: import_picocolors.default.yellow(U) });
1182
1403
  },
1183
1404
  warning: (t) => {
1184
1405
  M.warn(t);
1185
1406
  },
1186
1407
  error: (t) => {
1187
- M.message(t, { symbol: e.red(K) });
1408
+ M.message(t, { symbol: import_picocolors.default.red(K) });
1188
1409
  }
1189
- }, J = `${e.gray(o)} `, x = {
1190
- message: async (t, { symbol: n = e.gray(o) } = {}) => {
1191
- process.stdout.write(`${e.gray(o)}
1410
+ }, J = `${import_picocolors.default.gray(o)} `, x = {
1411
+ message: async (t, { symbol: n = import_picocolors.default.gray(o) } = {}) => {
1412
+ process.stdout.write(`${import_picocolors.default.gray(o)}
1192
1413
  ${n} `);
1193
1414
  let r$2 = 3;
1194
1415
  for await (let i of t) {
@@ -1203,12 +1424,12 @@ ${J}${i.trimStart()}`), r$2 = 3 + stripVTControlCharacters(i.trimStart()).length
1203
1424
  process.stdout.write(`
1204
1425
  `);
1205
1426
  },
1206
- info: (t) => x.message(t, { symbol: e.blue(q) }),
1207
- success: (t) => x.message(t, { symbol: e.green(D) }),
1208
- step: (t) => x.message(t, { symbol: e.green(C) }),
1209
- warn: (t) => x.message(t, { symbol: e.yellow(U) }),
1427
+ info: (t) => x.message(t, { symbol: import_picocolors.default.blue(q) }),
1428
+ success: (t) => x.message(t, { symbol: import_picocolors.default.green(D) }),
1429
+ step: (t) => x.message(t, { symbol: import_picocolors.default.green(C) }),
1430
+ warn: (t) => x.message(t, { symbol: import_picocolors.default.yellow(U) }),
1210
1431
  warning: (t) => x.warn(t),
1211
- error: (t) => x.message(t, { symbol: e.red(K) })
1432
+ error: (t) => x.message(t, { symbol: import_picocolors.default.red(K) })
1212
1433
  }, Y = ({ indicator: t = "dots" } = {}) => {
1213
1434
  const n = V ? [
1214
1435
  "◒",
@@ -1221,58 +1442,58 @@ ${J}${i.trimStart()}`), r$2 = 3 + stripVTControlCharacters(i.trimStart()).length
1221
1442
  "O",
1222
1443
  "0"
1223
1444
  ], r$2 = V ? 80 : 120, i = process.env.CI === "true";
1224
- let s, c, a$1 = !1, l = "", $$1, g$1 = performance.now();
1445
+ let s, c, a$1 = !1, l$1 = "", $$1, g$1 = performance.now();
1225
1446
  const p$1 = (m$1) => {
1226
1447
  a$1 && N$1(m$1 > 1 ? "Something went wrong" : "Canceled", m$1);
1227
- }, v = () => p$1(2), f = () => p$1(1), j = () => {
1228
- process.on("uncaughtExceptionMonitor", v), process.on("unhandledRejection", v), process.on("SIGINT", f), process.on("SIGTERM", f), process.on("exit", p$1);
1448
+ }, v$1 = () => p$1(2), f = () => p$1(1), j = () => {
1449
+ process.on("uncaughtExceptionMonitor", v$1), process.on("unhandledRejection", v$1), process.on("SIGINT", f), process.on("SIGTERM", f), process.on("exit", p$1);
1229
1450
  }, E = () => {
1230
- process.removeListener("uncaughtExceptionMonitor", v), process.removeListener("unhandledRejection", v), process.removeListener("SIGINT", f), process.removeListener("SIGTERM", f), process.removeListener("exit", p$1);
1451
+ process.removeListener("uncaughtExceptionMonitor", v$1), process.removeListener("unhandledRejection", v$1), process.removeListener("SIGINT", f), process.removeListener("SIGTERM", f), process.removeListener("exit", p$1);
1231
1452
  }, B$1 = () => {
1232
1453
  if ($$1 === void 0) return;
1233
1454
  i && process.stdout.write(`
1234
1455
  `);
1235
1456
  const m$1 = $$1.split(`
1236
1457
  `);
1237
- process.stdout.write(cursor.move(-999, m$1.length - 1)), process.stdout.write(erase.down(m$1.length));
1458
+ process.stdout.write(import_src.cursor.move(-999, m$1.length - 1)), process.stdout.write(import_src.erase.down(m$1.length));
1238
1459
  }, R$1 = (m$1) => m$1.replace(/\.+$/, ""), O$1 = (m$1) => {
1239
1460
  const h$1 = (performance.now() - m$1) / 1e3, w$1 = Math.floor(h$1 / 60), I$1 = Math.floor(h$1 % 60);
1240
1461
  return w$1 > 0 ? `[${w$1}m ${I$1}s]` : `[${I$1}s]`;
1241
1462
  }, H$1 = (m$1 = "") => {
1242
- a$1 = !0, s = fD(), l = R$1(m$1), g$1 = performance.now(), process.stdout.write(`${e.gray(o)}
1463
+ a$1 = !0, s = fD(), l$1 = R$1(m$1), g$1 = performance.now(), process.stdout.write(`${import_picocolors.default.gray(o)}
1243
1464
  `);
1244
1465
  let h$1 = 0, w$1 = 0;
1245
1466
  j(), c = setInterval(() => {
1246
- if (i && l === $$1) return;
1247
- B$1(), $$1 = l;
1248
- const I$1 = e.magenta(n[h$1]);
1249
- if (i) process.stdout.write(`${I$1} ${l}...`);
1250
- else if (t === "timer") process.stdout.write(`${I$1} ${l} ${O$1(g$1)}`);
1467
+ if (i && l$1 === $$1) return;
1468
+ B$1(), $$1 = l$1;
1469
+ const I$1 = import_picocolors.default.magenta(n[h$1]);
1470
+ if (i) process.stdout.write(`${I$1} ${l$1}...`);
1471
+ else if (t === "timer") process.stdout.write(`${I$1} ${l$1} ${O$1(g$1)}`);
1251
1472
  else {
1252
1473
  const z$1 = ".".repeat(Math.floor(w$1)).slice(0, 3);
1253
- process.stdout.write(`${I$1} ${l}${z$1}`);
1474
+ process.stdout.write(`${I$1} ${l$1}${z$1}`);
1254
1475
  }
1255
1476
  h$1 = h$1 + 1 < n.length ? h$1 + 1 : 0, w$1 = w$1 < n.length ? w$1 + .125 : 0;
1256
1477
  }, r$2);
1257
1478
  }, N$1 = (m$1 = "", h$1 = 0) => {
1258
1479
  a$1 = !1, clearInterval(c), B$1();
1259
- const w$1 = h$1 === 0 ? e.green(C) : h$1 === 1 ? e.red(L) : e.red(W);
1260
- l = R$1(m$1 ?? l), t === "timer" ? process.stdout.write(`${w$1} ${l} ${O$1(g$1)}
1261
- `) : process.stdout.write(`${w$1} ${l}
1480
+ const w$1 = h$1 === 0 ? import_picocolors.default.green(C) : h$1 === 1 ? import_picocolors.default.red(L) : import_picocolors.default.red(W);
1481
+ l$1 = R$1(m$1 ?? l$1), t === "timer" ? process.stdout.write(`${w$1} ${l$1} ${O$1(g$1)}
1482
+ `) : process.stdout.write(`${w$1} ${l$1}
1262
1483
  `), E(), s();
1263
1484
  };
1264
1485
  return {
1265
1486
  start: H$1,
1266
1487
  stop: N$1,
1267
1488
  message: (m$1 = "") => {
1268
- l = R$1(m$1 ?? l);
1489
+ l$1 = R$1(m$1 ?? l$1);
1269
1490
  }
1270
1491
  };
1271
1492
  }, Ce = async (t, n) => {
1272
1493
  const r$2 = {}, i = Object.keys(t);
1273
1494
  for (const s of i) {
1274
- const c = t[s], a$1 = await c({ results: r$2 })?.catch((l) => {
1275
- throw l;
1495
+ const c = t[s], a$1 = await c({ results: r$2 })?.catch((l$1) => {
1496
+ throw l$1;
1276
1497
  });
1277
1498
  if (typeof n?.onCancel == "function" && pD(a$1)) {
1278
1499
  r$2[s] = "canceled", n.onCancel({ results: r$2 });
@@ -1295,17 +1516,17 @@ ${J}${i.trimStart()}`), r$2 = 3 + stripVTControlCharacters(i.trimStart()).length
1295
1516
  //#region ../../node_modules/.pnpm/ansis@4.2.0/node_modules/ansis/index.cjs
1296
1517
  var require_ansis = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1297
1518
  let e, t, r, { defineProperty: l, setPrototypeOf: n, create: o, keys: s } = Object, i = "", { round: c, max: a } = Math, p = (e$1) => {
1298
- let t = /([a-f\d]{3,6})/i.exec(e$1)?.[1], r$2 = t?.length, l = parseInt(6 ^ r$2 ? 3 ^ r$2 ? "0" : t[0] + t[0] + t[1] + t[1] + t[2] + t[2] : t, 16);
1519
+ let t = /([a-f\d]{3,6})/i.exec(e$1)?.[1], r$2 = t?.length, l$1 = parseInt(6 ^ r$2 ? 3 ^ r$2 ? "0" : t[0] + t[0] + t[1] + t[1] + t[2] + t[2] : t, 16);
1299
1520
  return [
1300
- l >> 16 & 255,
1301
- l >> 8 & 255,
1302
- 255 & l
1521
+ l$1 >> 16 & 255,
1522
+ l$1 >> 8 & 255,
1523
+ 255 & l$1
1303
1524
  ];
1304
1525
  }, u = (e$1, t, r$2) => e$1 ^ t || t ^ r$2 ? 16 + 36 * c(e$1 / 51) + 6 * c(t / 51) + c(r$2 / 51) : 8 > e$1 ? 16 : e$1 > 248 ? 231 : c(24 * (e$1 - 8) / 247) + 232, d = (e$1) => {
1305
- let t, r$2, l, n, o$1;
1306
- return 8 > e$1 ? 30 + e$1 : 16 > e$1 ? e$1 - 8 + 90 : (232 > e$1 ? (o$1 = (e$1 -= 16) % 36, t = (e$1 / 36 | 0) / 5, r$2 = (o$1 / 6 | 0) / 5, l = o$1 % 6 / 5) : t = r$2 = l = (10 * (e$1 - 232) + 8) / 255, n = 2 * a(t, r$2, l), n ? 30 + (c(l) << 2 | c(r$2) << 1 | c(t)) + (2 ^ n ? 0 : 60) : 30);
1526
+ let t, r$2, l$1, n, o$1;
1527
+ return 8 > e$1 ? 30 + e$1 : 16 > e$1 ? e$1 - 8 + 90 : (232 > e$1 ? (o$1 = (e$1 -= 16) % 36, t = (e$1 / 36 | 0) / 5, r$2 = (o$1 / 6 | 0) / 5, l$1 = o$1 % 6 / 5) : t = r$2 = l$1 = (10 * (e$1 - 232) + 8) / 255, n = 2 * a(t, r$2, l$1), n ? 30 + (c(l$1) << 2 | c(r$2) << 1 | c(t)) + (2 ^ n ? 0 : 60) : 30);
1307
1528
  }, f = (() => {
1308
- let r$2 = (e$1) => o$1.some(((t) => e$1.test(t))), l = globalThis, n = l.process ?? {}, o$1 = n.argv ?? [], i = n.env ?? {}, c = -1;
1529
+ let r$2 = (e$1) => o$1.some(((t) => e$1.test(t))), l$1 = globalThis, n = l$1.process ?? {}, o$1 = n.argv ?? [], i = n.env ?? {}, c = -1;
1309
1530
  try {
1310
1531
  e = "," + s(i).join(",");
1311
1532
  } catch (e$1) {
@@ -1318,32 +1539,32 @@ var require_ansis = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1318
1539
  2: 2,
1319
1540
  3: 3
1320
1541
  }[i[a$1]] ?? -1, u$1 = a$1 in i && p$1 || r$2(/^--color=?(true|always)?$/);
1321
- return u$1 && (c = p$1), ~c || (c = ((r$3, l$1, n$1) => (t = r$3.TERM, {
1542
+ return u$1 && (c = p$1), ~c || (c = ((r$3, l$2, n$1) => (t = r$3.TERM, {
1322
1543
  "24bit": 3,
1323
1544
  truecolor: 3,
1324
1545
  ansi256: 2,
1325
1546
  ansi: 1
1326
- }[r$3.COLORTERM] || (r$3.CI ? /,GITHUB/.test(e) ? 3 : 1 : l$1 && "dumb" !== t ? n$1 ? 3 : /-256/.test(t) ? 2 : 1 : 0)))(i, !!i.PM2_HOME || i.NEXT_RUNTIME?.includes("edge") || !!n.stdout?.isTTY, "win32" === n.platform)), !p$1 || i.NO_COLOR || r$2(/^--(no-color|color=(false|never))$/) ? 0 : l.window?.chrome || u$1 && !c ? 3 : c;
1547
+ }[r$3.COLORTERM] || (r$3.CI ? /,GITHUB/.test(e) ? 3 : 1 : l$2 && "dumb" !== t ? n$1 ? 3 : /-256/.test(t) ? 2 : 1 : 0)))(i, !!i.PM2_HOME || i.NEXT_RUNTIME?.includes("edge") || !!n.stdout?.isTTY, "win32" === n.platform)), !p$1 || i.NO_COLOR || r$2(/^--(no-color|color=(false|never))$/) ? 0 : l$1.window?.chrome || u$1 && !c ? 3 : c;
1327
1548
  })(), g = {
1328
1549
  open: i,
1329
1550
  close: i
1330
- }, h = 39, b = 49, O = {}, m = ({ p: e$1 }, { open: t, close: l }) => {
1551
+ }, h = 39, b = 49, O = {}, m = ({ p: e$1 }, { open: t, close: l$1 }) => {
1331
1552
  let o$1 = (e$2, ...r$2) => {
1332
1553
  if (!e$2) {
1333
- if (t && t === l) return t;
1554
+ if (t && t === l$1) return t;
1334
1555
  if ((e$2 ?? i) === i) return i;
1335
1556
  }
1336
1557
  let n, s$1 = e$2.raw ? String.raw({ raw: e$2 }, ...r$2) : i + e$2, c$1 = o$1.p, a$1 = c$1.o, p$1 = c$1.c;
1337
1558
  if (s$1.includes("\x1B")) for (; c$1; c$1 = c$1.p) {
1338
- let { open: e$3, close: t$1 } = c$1, r$3 = t$1.length, l$1 = i, o$2 = 0;
1339
- if (r$3) for (; ~(n = s$1.indexOf(t$1, o$2)); o$2 = n + r$3) l$1 += s$1.slice(o$2, n) + e$3;
1340
- s$1 = l$1 + s$1.slice(o$2);
1559
+ let { open: e$3, close: t$1 } = c$1, r$3 = t$1.length, l$2 = i, o$2 = 0;
1560
+ if (r$3) for (; ~(n = s$1.indexOf(t$1, o$2)); o$2 = n + r$3) l$2 += s$1.slice(o$2, n) + e$3;
1561
+ s$1 = l$2 + s$1.slice(o$2);
1341
1562
  }
1342
1563
  return a$1 + (s$1.includes("\n") ? s$1.replace(/(\r?\n)/g, p$1 + "$1" + a$1) : s$1) + p$1;
1343
- }, s = t, c = l;
1344
- return e$1 && (s = e$1.o + t, c = l + e$1.c), n(o$1, r), o$1.p = {
1564
+ }, s = t, c = l$1;
1565
+ return e$1 && (s = e$1.o + t, c = l$1 + e$1.c), n(o$1, r), o$1.p = {
1345
1566
  open: t,
1346
- close: l,
1567
+ close: l$1,
1347
1568
  o: s,
1348
1569
  c,
1349
1570
  p: e$1
@@ -1357,8 +1578,8 @@ var require_ansis = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1357
1578
  strip: (e$2) => e$2.replace(/[›][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, i),
1358
1579
  extend(e$2) {
1359
1580
  for (let t$1 in e$2) {
1360
- let r$2 = e$2[t$1], l = (typeof r$2)[0];
1361
- "s" === l ? (c(t$1, T$2(...p(r$2))), c(_$2(t$1), v(...p(r$2)))) : c(t$1, r$2, "f" === l);
1581
+ let r$2 = e$2[t$1], l$1 = (typeof r$2)[0];
1582
+ "s" === l$1 ? (c(t$1, T$2(...p(r$2))), c(_$2(t$1), v$1(...p(r$2)))) : c(t$1, r$2, "f" === l$1);
1362
1583
  }
1363
1584
  return r = o({}, O), n(s, r), s;
1364
1585
  }
@@ -1370,15 +1591,15 @@ var require_ansis = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1370
1591
  }, a$1 = t > 0, w$1 = (e$2, t$1) => a$1 ? {
1371
1592
  open: `[${e$2}m`,
1372
1593
  close: `[${t$1}m`
1373
- } : g, y$1 = (e$2) => (t$1) => e$2(...p(t$1)), R$1 = (e$2, t$1) => (r$2, l, n) => w$1(`${e$2}8;2;${r$2};${l};${n}`, t$1), $$1 = (e$2, t$1) => (r$2, l, n) => w$1(((e$3, t$2, r$3) => d(u(e$3, t$2, r$3)))(r$2, l, n) + e$2, t$1), x$2 = (e$2) => (t$1, r$2, l) => e$2(u(t$1, r$2, l)), T$2 = R$1(3, h), v = R$1(4, b), C$1 = (e$2) => w$1("38;5;" + e$2, h), E = (e$2) => w$1("48;5;" + e$2, b);
1374
- 2 === t ? (T$2 = x$2(C$1), v = x$2(E)) : 1 === t && (T$2 = $$1(0, h), v = $$1(10, b), C$1 = (e$2) => w$1(d(e$2), h), E = (e$2) => w$1(d(e$2) + 10, b));
1594
+ } : g, y$1 = (e$2) => (t$1) => e$2(...p(t$1)), R$1 = (e$2, t$1) => (r$2, l$1, n) => w$1(`${e$2}8;2;${r$2};${l$1};${n}`, t$1), $$1 = (e$2, t$1) => (r$2, l$1, n) => w$1(((e$3, t$2, r$3) => d(u(e$3, t$2, r$3)))(r$2, l$1, n) + e$2, t$1), x$2 = (e$2) => (t$1, r$2, l$1) => e$2(u(t$1, r$2, l$1)), T$2 = R$1(3, h), v$1 = R$1(4, b), C$1 = (e$2) => w$1("38;5;" + e$2, h), E = (e$2) => w$1("48;5;" + e$2, b);
1595
+ 2 === t ? (T$2 = x$2(C$1), v$1 = x$2(E)) : 1 === t && (T$2 = $$1(0, h), v$1 = $$1(10, b), C$1 = (e$2) => w$1(d(e$2), h), E = (e$2) => w$1(d(e$2) + 10, b));
1375
1596
  let M$1, I$1 = {
1376
1597
  fg: C$1,
1377
1598
  bg: E,
1378
1599
  rgb: T$2,
1379
- bgRgb: v,
1600
+ bgRgb: v$1,
1380
1601
  hex: y$1(T$2),
1381
- bgHex: y$1(v),
1602
+ bgHex: y$1(v$1),
1382
1603
  visible: g,
1383
1604
  reset: w$1(0, 0),
1384
1605
  bold: w$1(1, 22),
@@ -1405,11 +1626,11 @@ const { Ansis, fg, bg, rgb, bgRgb, hex, bgHex, reset, inverse, hidden, visible,
1405
1626
  //#endregion
1406
1627
  //#region src/node/storage.ts
1407
1628
  function createStorage(options) {
1408
- let initialState;
1409
- if (fs.existsSync(options.filepath)) initialState = JSON.parse(fs.readFileSync(options.filepath, "utf-8"));
1410
- else initialState = options.initialValue;
1629
+ let initialValue;
1630
+ if (fs.existsSync(options.filepath)) initialValue = JSON.parse(fs.readFileSync(options.filepath, "utf-8"));
1631
+ else initialValue = options.initialValue;
1411
1632
  const state = createSharedState({
1412
- initialState,
1633
+ initialValue,
1413
1634
  enablePatches: false
1414
1635
  });
1415
1636
  state.on("updated", (newState) => {
@@ -1440,12 +1661,10 @@ const anonymousAuth = defineRpcFunction({
1440
1661
  type: "action",
1441
1662
  setup: (context) => {
1442
1663
  const storage = getInternalContext(context).storage.auth;
1443
- const isClientAuthDisabled = context.mode === "build" || context.viteConfig.devtools?.clientAuth === false || process$1.env.VITE_DEVTOOLS_DISABLE_CLIENT_AUTH === "true";
1444
- if (isClientAuthDisabled) console.warn("[Vite DevTools] Client authentication is disabled. Any browser can connect to the devtools and access to your server and filesystem.");
1445
1664
  return { handler: async (query) => {
1446
1665
  const session = context.rpc.getCurrentRpcSession();
1447
1666
  if (!session) throw new Error("Failed to retrieve the current RPC session");
1448
- if (isClientAuthDisabled || storage.get().trusted[query.authId]) {
1667
+ if (session.meta.isTrusted || storage.value().trusted[query.authId]) {
1449
1668
  session.meta.clientAuthId = query.authId;
1450
1669
  session.meta.isTrusted = true;
1451
1670
  return { isTrusted: true };
@@ -1484,27 +1703,6 @@ const anonymousAuth = defineRpcFunction({
1484
1703
  }
1485
1704
  });
1486
1705
 
1487
- //#endregion
1488
- //#region src/node/rpc/internal/docks-list.ts
1489
- const docksList = defineRpcFunction({
1490
- name: "vite:internal:docks:list",
1491
- type: "static",
1492
- setup: (context) => {
1493
- const builtinDocksEntries = [{
1494
- type: "~builtin",
1495
- id: "~terminals",
1496
- title: "Terminals",
1497
- icon: "ph:terminal-duotone",
1498
- get isHidden() {
1499
- return context.terminals.sessions.size === 0;
1500
- }
1501
- }];
1502
- return { handler() {
1503
- return [...Array.from(context.docks.values()), ...builtinDocksEntries];
1504
- } };
1505
- }
1506
- });
1507
-
1508
1706
  //#endregion
1509
1707
  //#region src/node/rpc/internal/docks-on-launch.ts
1510
1708
  const docksOnLaunch = defineRpcFunction({
@@ -1564,6 +1762,61 @@ const rpcServerList = defineRpcFunction({
1564
1762
  }
1565
1763
  });
1566
1764
 
1765
+ //#endregion
1766
+ //#region src/node/rpc/internal/state/get.ts
1767
+ const sharedStateGet = defineRpcFunction({
1768
+ name: "vite:internal:rpc:server-state:get",
1769
+ type: "query",
1770
+ setup: (context) => {
1771
+ return { handler: async (key) => {
1772
+ return (await context.rpc.sharedState.get(key)).value();
1773
+ } };
1774
+ }
1775
+ });
1776
+
1777
+ //#endregion
1778
+ //#region src/node/rpc/internal/state/patch.ts
1779
+ const sharedStatePatch = defineRpcFunction({
1780
+ name: "vite:internal:rpc:server-state:patch",
1781
+ type: "query",
1782
+ setup: (context) => {
1783
+ return { handler: async (key, patches, syncId) => {
1784
+ (await context.rpc.sharedState.get(key)).patch(patches, syncId);
1785
+ } };
1786
+ }
1787
+ });
1788
+
1789
+ //#endregion
1790
+ //#region src/node/rpc/internal/state/set.ts
1791
+ const sharedStateSet = defineRpcFunction({
1792
+ name: "vite:internal:rpc:server-state:set",
1793
+ type: "query",
1794
+ setup: (context) => {
1795
+ return { handler: async (key, value, syncId) => {
1796
+ (await context.rpc.sharedState.get(key)).mutate(() => value, syncId);
1797
+ } };
1798
+ }
1799
+ });
1800
+
1801
+ //#endregion
1802
+ //#region src/node/rpc/internal/state/subscribe.ts
1803
+ const debug = createDebug("vite:devtools:rpc:state:subscribe");
1804
+ const sharedStateSubscribe = defineRpcFunction({
1805
+ name: "vite:internal:rpc:server-state:subscribe",
1806
+ type: "event",
1807
+ setup: (context) => {
1808
+ return { handler: async (key) => {
1809
+ const session = context.rpc.getCurrentRpcSession();
1810
+ if (!session) return;
1811
+ debug("subscribe", {
1812
+ key,
1813
+ session: session.meta.id
1814
+ });
1815
+ session.meta.subscribedStates.add(key);
1816
+ } };
1817
+ }
1818
+ });
1819
+
1567
1820
  //#endregion
1568
1821
  //#region src/node/rpc/internal/terminals-list.ts
1569
1822
  const terminalsList = defineRpcFunction({
@@ -1590,10 +1843,10 @@ const terminalsRead = defineRpcFunction({
1590
1843
  type: "query",
1591
1844
  setup: (context) => {
1592
1845
  return { async handler(id) {
1593
- const seesion = context.terminals.sessions.get(id);
1594
- if (!seesion) throw new Error(`Terminal session with id "${id}" not found`);
1846
+ const session = context.terminals.sessions.get(id);
1847
+ if (!session) throw new Error(`Terminal session with id "${id}" not found`);
1595
1848
  return {
1596
- buffer: seesion.buffer ?? [],
1849
+ buffer: session.buffer ?? [],
1597
1850
  ts: Date.now()
1598
1851
  };
1599
1852
  } };
@@ -1626,24 +1879,27 @@ const openInFinder = defineRpcFunction({
1626
1879
 
1627
1880
  //#endregion
1628
1881
  //#region src/node/rpc/index.ts
1629
- const builtinPublicRpcDecalrations = [openInEditor, openInFinder];
1630
- const builtinAnonymousRpcDecalrations = [anonymousAuth];
1631
- const builtinInternalRpcDecalrations = [
1632
- docksList,
1882
+ const builtinPublicRpcDeclarations = [openInEditor, openInFinder];
1883
+ const builtinAnonymousRpcDeclarations = [anonymousAuth];
1884
+ const builtinInternalRpcDeclarations = [
1633
1885
  docksOnLaunch,
1634
1886
  rpcServerList,
1887
+ sharedStateGet,
1888
+ sharedStatePatch,
1889
+ sharedStateSet,
1890
+ sharedStateSubscribe,
1635
1891
  terminalsList,
1636
1892
  terminalsRead
1637
1893
  ];
1638
- const builtinRpcDecalrations = [
1639
- ...builtinPublicRpcDecalrations,
1640
- ...builtinAnonymousRpcDecalrations,
1641
- ...builtinInternalRpcDecalrations
1894
+ const builtinRpcDeclarations = [
1895
+ ...builtinPublicRpcDeclarations,
1896
+ ...builtinAnonymousRpcDeclarations,
1897
+ ...builtinInternalRpcDeclarations
1642
1898
  ];
1643
1899
 
1644
1900
  //#endregion
1645
1901
  //#region src/node/context.ts
1646
- const debug = Debug("vite:devtools:context");
1902
+ const debugSetup = createDebug("vite:devtools:context:setup");
1647
1903
  async function createDevToolsContext(viteConfig, viteServer) {
1648
1904
  const cwd = viteConfig.root;
1649
1905
  const context = {
@@ -1666,22 +1922,29 @@ async function createDevToolsContext(viteConfig, viteServer) {
1666
1922
  context.docks = docksHost;
1667
1923
  context.views = viewsHost;
1668
1924
  context.terminals = terminalsHost;
1669
- for (const fn of builtinRpcDecalrations) rpcHost.register(fn);
1925
+ for (const fn of builtinRpcDeclarations) rpcHost.register(fn);
1926
+ const docksSharedState = await rpcHost.sharedState.get("vite:internal:docks", { initialValue: [] });
1670
1927
  docksHost.events.on("dock:entry:updated", debounce(() => {
1671
- rpcHost.broadcast("vite:internal:docks:updated");
1928
+ docksSharedState.mutate(() => context.docks.values());
1672
1929
  }, 10));
1673
1930
  terminalsHost.events.on("terminal:session:updated", debounce(() => {
1674
- rpcHost.broadcast("vite:internal:terminals:updated");
1675
- rpcHost.broadcast("vite:internal:docks:updated");
1931
+ rpcHost.broadcast({
1932
+ method: "vite:internal:terminals:updated",
1933
+ args: []
1934
+ });
1935
+ docksSharedState.mutate(() => context.docks.values());
1676
1936
  }, 10));
1677
1937
  terminalsHost.events.on("terminal:session:stream-chunk", (data) => {
1678
- rpcHost.broadcast("vite:internal:terminals:stream-chunk", data);
1938
+ rpcHost.broadcast({
1939
+ method: "vite:internal:terminals:stream-chunk",
1940
+ args: [data]
1941
+ });
1679
1942
  });
1680
1943
  const plugins = viteConfig.plugins.filter((plugin) => "devtools" in plugin);
1681
1944
  for (const plugin of plugins) {
1682
1945
  if (!plugin.devtools?.setup) continue;
1683
1946
  try {
1684
- debug(`Setting up plugin ${plugin.name}`);
1947
+ debugSetup(`setting up plugin ${JSON.stringify(plugin.name)}`);
1685
1948
  await plugin.devtools?.setup?.(context);
1686
1949
  } catch (error) {
1687
1950
  console.error(`[Vite DevTools] Error setting up plugin ${plugin.name}:`, error);
@@ -1902,7 +2165,7 @@ function createError(input) {
1902
2165
  if (input.unhandled !== void 0) err.unhandled = input.unhandled;
1903
2166
  return err;
1904
2167
  }
1905
- function sendError(event, error, debug$1) {
2168
+ function sendError(event, error, debug$2) {
1906
2169
  if (event.handled) return;
1907
2170
  const h3Error = isError(error) ? error : createError(error);
1908
2171
  const responseBody = {
@@ -1911,7 +2174,7 @@ function sendError(event, error, debug$1) {
1911
2174
  stack: [],
1912
2175
  data: h3Error.data
1913
2176
  };
1914
- if (debug$1) responseBody.stack = (h3Error.stack || "").split("\n").map((l) => l.trim());
2177
+ if (debug$2) responseBody.stack = (h3Error.stack || "").split("\n").map((l$1) => l$1.trim());
1915
2178
  if (event.handled) return;
1916
2179
  setResponseStatus(event, Number.parseInt(h3Error.statusCode), h3Error.statusMessage);
1917
2180
  event.node.res.setHeader("content-type", MIMES.json);
@@ -2610,6 +2873,7 @@ const MARK_NODE = "⬢";
2610
2873
 
2611
2874
  //#endregion
2612
2875
  //#region src/node/ws.ts
2876
+ const debugInvoked = createDebug("vite:devtools:rpc:invoked");
2613
2877
  const ANONYMOUS_SCOPE = "vite:anonymous:";
2614
2878
  async function createWsServer(options) {
2615
2879
  const rpcHost = options.context.rpc;
@@ -2619,20 +2883,30 @@ async function createWsServer(options) {
2619
2883
  });
2620
2884
  const host = options.hostWebSocket ?? "localhost";
2621
2885
  const wsClients = /* @__PURE__ */ new Set();
2886
+ const context = options.context;
2887
+ const contextInternal = getInternalContext(context);
2888
+ const isClientAuthDisabled = context.mode === "build" || context.viteConfig.devtools?.clientAuth === false || process$1.env.VITE_DEVTOOLS_DISABLE_CLIENT_AUTH === "true";
2889
+ if (isClientAuthDisabled) console.warn("[Vite DevTools] Client authentication is disabled. Any browser can connect to the devtools and access to your server and filesystem.");
2622
2890
  const preset = createWsRpcPreset({
2623
2891
  port,
2624
2892
  host,
2625
- onConnected: (ws, meta) => {
2893
+ onConnected: (ws, req, meta) => {
2894
+ const authId = new URL(req.url ?? "", "http://localhost").searchParams.get("vite_devtools_auth_id") ?? void 0;
2895
+ if (isClientAuthDisabled) meta.isTrusted = true;
2896
+ else if (authId && contextInternal.storage.auth.value().trusted[authId]) {
2897
+ meta.isTrusted = true;
2898
+ meta.clientAuthId = authId;
2899
+ }
2626
2900
  wsClients.add(ws);
2627
- console.log(ansis_default.green`${MARK_CHECK} Websocket client [${meta.id}] connected`);
2901
+ const color = meta.isTrusted ? ansis_default.green : ansis_default.yellow;
2902
+ console.log(color`${MARK_INFO} Websocket client connected. [${meta.id}] [${meta.clientAuthId}] (${meta.isTrusted ? "trusted" : "untrusted"})`);
2628
2903
  },
2629
2904
  onDisconnected: (ws, meta) => {
2630
2905
  wsClients.delete(ws);
2631
- console.log(ansis_default.red`${MARK_CHECK} Websocket client [${meta.id}] disconnected`);
2906
+ console.log(ansis_default.red`${MARK_INFO} Websocket client disconnected. [${meta.id}]`);
2632
2907
  }
2633
2908
  });
2634
2909
  const asyncStorage = new AsyncLocalStorage();
2635
- const isClientAuthDisabled = options.context.mode === "build" || options.context.viteConfig.devtools?.clientAuth === false || process$1.env.VITE_DEVTOOLS_DISABLE_CLIENT_AUTH === "true";
2636
2910
  const rpcGroup = createRpcServer(rpcHost.functions, {
2637
2911
  preset,
2638
2912
  rpcOptions: {
@@ -2646,11 +2920,12 @@ async function createWsServer(options) {
2646
2920
  },
2647
2921
  resolver(name, fn) {
2648
2922
  const rpc = this;
2649
- if (!name.startsWith(ANONYMOUS_SCOPE) && !rpc.$meta.isTrusted && !isClientAuthDisabled) return () => {
2923
+ if (!name.startsWith(ANONYMOUS_SCOPE) && !rpc.$meta.isTrusted) return () => {
2650
2924
  throw new Error(`Unauthorized access to method ${JSON.stringify(name)} from client [${rpc.$meta.id}]`);
2651
2925
  };
2652
2926
  if (!fn) return void 0;
2653
2927
  return async function(...args) {
2928
+ debugInvoked(`${JSON.stringify(name)} from #${rpc.$meta.id}`);
2654
2929
  return await asyncStorage.run({
2655
2930
  rpc,
2656
2931
  meta: rpc.$meta