@vitejs/devtools 0.0.0-alpha.26 → 0.0.0-alpha.27

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 (30) hide show
  1. package/dist/{DockIcon-guXN-Dg1.js → DockIcon-BfVdt_M0.js} +28 -30
  2. package/dist/{ViewBuiltinLogs-CSFcoXHM.js → ViewBuiltinLogs-C8wFxIxg.js} +2 -2
  3. package/dist/{ViewBuiltinTerminals-Cojpb-fR.js → ViewBuiltinTerminals-CrBOq_Ni.js} +609 -613
  4. package/dist/cli-commands.js +65 -2
  5. package/dist/cli.js +2 -2
  6. package/dist/client/inject.js +3 -3
  7. package/dist/client/standalone/assets/ViewBuiltinLogs-CYvdMq-7.js +1 -0
  8. package/dist/client/standalone/assets/{ViewBuiltinTerminals-C2zjH4Eh.js → ViewBuiltinTerminals-B9l9XmES.js} +3 -3
  9. package/dist/client/standalone/assets/index-DWC0UjCz.js +2 -0
  10. package/dist/client/standalone/assets/index-DzhHPm4X.css +1 -0
  11. package/dist/client/standalone/index.html +2 -2
  12. package/dist/client/webcomponents.d.ts +1447 -2
  13. package/dist/client/webcomponents.js +38 -56
  14. package/dist/dirs.js +7 -1
  15. package/dist/{dist-DMSdRXqd.js → dist-BpFPAu5f.js} +5 -6
  16. package/dist/{docks-DMCIffwx.js → docks-CYaKLVhQ.js} +1 -1
  17. package/dist/index.d.ts +168 -17
  18. package/dist/index.js +1 -1
  19. package/dist/plugins-BbzqUdpu.js +3038 -0
  20. package/dist/standalone-DVh1a9tu.js +34 -0
  21. package/dist/{vue.runtime.esm-bundler-fEVOOaBD.js → vue.runtime.esm-bundler-DL0i8o0W.js} +199 -189
  22. package/package.json +14 -15
  23. package/dist/cli-commands-DTrA5QU8.js +0 -97
  24. package/dist/client/standalone/assets/ViewBuiltinLogs-C4iyfEw1.js +0 -1
  25. package/dist/client/standalone/assets/index-BlqhxxEb.js +0 -2
  26. package/dist/client/standalone/assets/index-DR7GNsjy.css +0 -1
  27. package/dist/dirs-C0s1Ghvy.js +0 -9
  28. package/dist/index-DqO60P8I.d.ts +0 -576
  29. package/dist/plugins-CJzaRd9B.js +0 -2373
  30. /package/dist/{export-helper-Dw-qygE5.js → export-helper-DjM8b2QE.js} +0 -0
@@ -1,2373 +0,0 @@
1
- import { n as dirDist, t as dirClientStandalone } from "./dirs-C0s1Ghvy.js";
2
- import { createDebug } from "obug";
3
- import { debounce } from "perfect-debounce";
4
- import { normalizePath, searchForWorkspaceRoot } from "vite";
5
- import { toDataURL } from "mlly";
6
- import { DEFAULT_STATE_USER_SETTINGS } from "@vitejs/devtools-kit/constants";
7
- import { createEventEmitter } from "@vitejs/devtools-kit/utils/events";
8
- import { dirname, join } from "pathe";
9
- import fs, { existsSync } from "node:fs";
10
- import { createSharedState } from "@vitejs/devtools-kit/utils/shared-state";
11
- import { RpcFunctionsCollectorBase } from "birpc-x";
12
- import process$1, { stdin, stdout } from "node:process";
13
- import sirv from "sirv";
14
- import { stripVTControlCharacters } from "node:util";
15
- import * as g from "node:readline";
16
- import O from "node:readline";
17
- import { Writable } from "node:stream";
18
- import { defineRpcFunction } from "@vitejs/devtools-kit";
19
- import { join as join$1 } from "node:path";
20
- import { createApp, eventHandler, fromNodeMiddleware, toNodeListener } from "h3";
21
- import { AsyncLocalStorage } from "node:async_hooks";
22
- import { createRpcServer } from "@vitejs/devtools-rpc";
23
- import { createWsRpcPreset } from "@vitejs/devtools-rpc/presets/ws/server";
24
- import { createServer } from "node:net";
25
- import { networkInterfaces } from "node:os";
26
- import "node:fs/promises";
27
-
28
- //#region rolldown:runtime
29
- var __create = Object.create;
30
- var __defProp = Object.defineProperty;
31
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
32
- var __getOwnPropNames = Object.getOwnPropertyNames;
33
- var __getProtoOf = Object.getPrototypeOf;
34
- var __hasOwnProp = Object.prototype.hasOwnProperty;
35
- var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
36
- var __copyProps = (to, from, except, desc) => {
37
- if (from && typeof from === "object" || typeof from === "function") {
38
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
39
- key = keys[i];
40
- if (!__hasOwnProp.call(to, key) && key !== except) {
41
- __defProp(to, key, {
42
- get: ((k$2) => from[k$2]).bind(null, key),
43
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
44
- });
45
- }
46
- }
47
- }
48
- return to;
49
- };
50
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
51
- value: mod,
52
- enumerable: true
53
- }) : target, mod));
54
-
55
- //#endregion
56
- //#region src/node/context-utils.ts
57
- const ContextUtils = { createSimpleClientScript(fn) {
58
- return {
59
- importFrom: toDataURL(`const fn = ${fn.toString()}; export default fn`),
60
- importName: "default"
61
- };
62
- } };
63
-
64
- //#endregion
65
- //#region src/node/storage.ts
66
- function createStorage(options) {
67
- const { mergeInitialValue = (initialValue$1, savedValue) => ({
68
- ...initialValue$1,
69
- ...savedValue
70
- }), debounce: debounceTime = 100 } = options;
71
- let initialValue;
72
- if (fs.existsSync(options.filepath)) {
73
- const savedValue = JSON.parse(fs.readFileSync(options.filepath, "utf-8"));
74
- initialValue = mergeInitialValue ? mergeInitialValue(options.initialValue, savedValue) : savedValue;
75
- } else initialValue = options.initialValue;
76
- const state = createSharedState({
77
- initialValue,
78
- enablePatches: false
79
- });
80
- state.on("updated", debounce((newState) => {
81
- fs.mkdirSync(dirname(options.filepath), { recursive: true });
82
- fs.writeFileSync(options.filepath, `${JSON.stringify(newState, null, 2)}\n`);
83
- }, debounceTime));
84
- return state;
85
- }
86
-
87
- //#endregion
88
- //#region src/node/host-docks.ts
89
- var DevToolsDockHost = class {
90
- views = /* @__PURE__ */ new Map();
91
- events = createEventEmitter();
92
- userSettings = void 0;
93
- constructor(context) {
94
- this.context = context;
95
- }
96
- async init() {
97
- this.userSettings = await this.context.rpc.sharedState.get("devtoolskit:internal:user-settings", { sharedState: createStorage({
98
- filepath: join(this.context.workspaceRoot, "node_modules/.vite/devtools/settings.json"),
99
- initialValue: DEFAULT_STATE_USER_SETTINGS()
100
- }) });
101
- }
102
- values({ includeBuiltin = true } = {}) {
103
- const context = this.context;
104
- const builtinDocksEntries = [
105
- {
106
- type: "~builtin",
107
- id: "~terminals",
108
- title: "Terminals",
109
- icon: "ph:terminal-duotone",
110
- category: "~builtin",
111
- get isHidden() {
112
- return context.terminals.sessions.size === 0;
113
- }
114
- },
115
- {
116
- type: "~builtin",
117
- id: "~logs",
118
- title: "Logs",
119
- icon: "ph:notification-duotone",
120
- category: "~builtin",
121
- isHidden: true
122
- },
123
- {
124
- type: "~builtin",
125
- id: "~settings",
126
- title: "Settings",
127
- category: "~builtin",
128
- icon: "ph:gear-duotone"
129
- }
130
- ];
131
- return [...Array.from(this.views.values()), ...includeBuiltin ? builtinDocksEntries : []];
132
- }
133
- register(view, force) {
134
- if (this.views.has(view.id) && !force) throw new Error(`Dock with id "${view.id}" is already registered`);
135
- this.views.set(view.id, view);
136
- this.events.emit("dock:entry:updated", view);
137
- return { update: (patch) => {
138
- if (patch.id && patch.id !== view.id) throw new Error(`Cannot change the id of a dock. Use register() to add new docks.`);
139
- this.update(Object.assign(this.views.get(view.id), patch));
140
- } };
141
- }
142
- update(view) {
143
- if (!this.views.has(view.id)) throw new Error(`Dock with id "${view.id}" is not registered. Use register() to add new docks.`);
144
- this.views.set(view.id, view);
145
- this.events.emit("dock:entry:updated", view);
146
- }
147
- };
148
-
149
- //#endregion
150
- //#region src/node/rpc-shared-state.ts
151
- const debug$1 = createDebug("vite:devtools:rpc:state:changed");
152
- function createRpcSharedStateServerHost(rpc) {
153
- const sharedState = /* @__PURE__ */ new Map();
154
- function registerSharedState(key, state) {
155
- const offs = [];
156
- offs.push(state.on("updated", (fullState, patches, syncId) => {
157
- if (patches) {
158
- debug$1("patch", {
159
- key,
160
- syncId
161
- });
162
- rpc.broadcast({
163
- method: "devtoolskit:internal:rpc:client-state:patch",
164
- args: [
165
- key,
166
- patches,
167
- syncId
168
- ],
169
- filter: (client) => client.$meta.subscribedStates.has(key)
170
- });
171
- } else {
172
- debug$1("updated", {
173
- key,
174
- syncId
175
- });
176
- rpc.broadcast({
177
- method: "devtoolskit:internal:rpc:client-state:updated",
178
- args: [
179
- key,
180
- fullState,
181
- syncId
182
- ],
183
- filter: (client) => client.$meta.subscribedStates.has(key)
184
- });
185
- }
186
- }));
187
- return () => {
188
- for (const off of offs) off();
189
- };
190
- }
191
- return { get: async (key, options) => {
192
- if (sharedState.has(key)) return sharedState.get(key);
193
- if (options?.initialValue === void 0 && options?.sharedState === void 0) throw new Error(`Shared state of "${key}" is not found, please provide an initial value for the first time`);
194
- debug$1("new-state", key);
195
- const state = options.sharedState ?? createSharedState({
196
- initialValue: options.initialValue,
197
- enablePatches: false
198
- });
199
- registerSharedState(key, state);
200
- sharedState.set(key, state);
201
- return state;
202
- } };
203
- }
204
-
205
- //#endregion
206
- //#region src/node/host-functions.ts
207
- const debugBroadcast = createDebug("vite:devtools:rpc:broadcast");
208
- var RpcFunctionsHost = class extends RpcFunctionsCollectorBase {
209
- /**
210
- * @internal
211
- */
212
- _rpcGroup = void 0;
213
- _asyncStorage = void 0;
214
- constructor(context) {
215
- super(context);
216
- this.sharedState = createRpcSharedStateServerHost(this);
217
- }
218
- sharedState;
219
- async broadcast(options) {
220
- if (!this._rpcGroup) throw new Error("RpcFunctionsHost] RpcGroup is not set, it likely to be an internal bug of Vite DevTools");
221
- debugBroadcast(JSON.stringify(options.method));
222
- await Promise.all(this._rpcGroup.clients.map((client) => {
223
- if (options.filter?.(client) === false) return void 0;
224
- return client.$callRaw({
225
- optional: true,
226
- event: true,
227
- ...options
228
- });
229
- }));
230
- }
231
- getCurrentRpcSession() {
232
- if (!this._asyncStorage) throw new Error("RpcFunctionsHost] AsyncLocalStorage is not set, it likely to be an internal bug of Vite DevTools");
233
- return this._asyncStorage.getStore();
234
- }
235
- };
236
-
237
- //#endregion
238
- //#region src/node/host-terminals.ts
239
- var DevToolsTerminalHost = class {
240
- sessions = /* @__PURE__ */ new Map();
241
- events = createEventEmitter();
242
- _boundStreams = /* @__PURE__ */ new Map();
243
- constructor(context) {
244
- this.context = context;
245
- }
246
- register(session) {
247
- if (this.sessions.has(session.id)) throw new Error(`Terminal session with id "${session.id}" already registered`);
248
- this.sessions.set(session.id, session);
249
- this.bindStream(session);
250
- this.events.emit("terminal:session:updated", session);
251
- return session;
252
- }
253
- update(patch) {
254
- if (!this.sessions.has(patch.id)) throw new Error(`Terminal session with id "${patch.id}" not registered`);
255
- const session = this.sessions.get(patch.id);
256
- Object.assign(session, patch);
257
- this.sessions.set(patch.id, session);
258
- this.bindStream(session);
259
- this.events.emit("terminal:session:updated", session);
260
- }
261
- remove(session) {
262
- this.sessions.delete(session.id);
263
- this.events.emit("terminal:session:updated", session);
264
- this._boundStreams.delete(session.id);
265
- }
266
- bindStream(session) {
267
- if (this._boundStreams.has(session.id) && this._boundStreams.get(session.id)?.stream === session.stream) return;
268
- this._boundStreams.get(session.id)?.dispose();
269
- this._boundStreams.delete(session.id);
270
- if (!session.stream) return;
271
- session.buffer ||= [];
272
- const events = this.events;
273
- const writer = new WritableStream({ write(chunk) {
274
- session.buffer.push(chunk);
275
- events.emit("terminal:session:stream-chunk", {
276
- id: session.id,
277
- chunks: [chunk],
278
- ts: Date.now()
279
- });
280
- } });
281
- session.stream.pipeTo(writer);
282
- this._boundStreams.set(session.id, {
283
- dispose: () => {
284
- writer.close();
285
- },
286
- stream: session.stream
287
- });
288
- }
289
- async startChildProcess(executeOptions, terminal) {
290
- if (this.sessions.has(terminal.id)) throw new Error(`Terminal session with id "${terminal.id}" already registered`);
291
- const { exec } = await import("tinyexec");
292
- let controller;
293
- const stream = new ReadableStream({ start(_controller) {
294
- controller = _controller;
295
- } });
296
- function createChildProcess() {
297
- const cp$1 = exec(executeOptions.command, executeOptions.args || [], { nodeOptions: {
298
- env: {
299
- COLORS: "true",
300
- FORCE_COLOR: "true",
301
- ...executeOptions.env || {}
302
- },
303
- cwd: executeOptions.cwd ?? process$1.cwd(),
304
- stdio: "pipe"
305
- } });
306
- (async () => {
307
- for await (const chunk of cp$1) controller?.enqueue(chunk);
308
- })();
309
- return cp$1;
310
- }
311
- let cp = createChildProcess();
312
- const restart = async () => {
313
- cp?.kill();
314
- cp = createChildProcess();
315
- };
316
- const terminate = async () => {
317
- cp?.kill();
318
- cp = void 0;
319
- };
320
- const session = {
321
- ...terminal,
322
- status: "running",
323
- stream,
324
- type: "child-process",
325
- executeOptions,
326
- getChildProcess: () => cp?.process,
327
- terminate,
328
- restart
329
- };
330
- this.register(session);
331
- return Promise.resolve(session);
332
- }
333
- };
334
-
335
- //#endregion
336
- //#region src/node/host-views.ts
337
- var DevToolsViewHost = class {
338
- /**
339
- * @internal
340
- */
341
- buildStaticDirs = [];
342
- constructor(context) {
343
- this.context = context;
344
- }
345
- hostStatic(baseUrl, distDir) {
346
- if (!existsSync(distDir)) throw new Error(`[Vite DevTools] distDir ${distDir} does not exist`);
347
- this.buildStaticDirs.push({
348
- baseUrl,
349
- distDir
350
- });
351
- if (this.context.viteConfig.command === "serve") {
352
- if (!this.context.viteServer) throw new Error("[Vite DevTools] viteServer is required in dev mode");
353
- this.context.viteServer.middlewares.use(baseUrl, sirv(distDir, {
354
- dev: true,
355
- single: true
356
- }));
357
- }
358
- }
359
- };
360
-
361
- //#endregion
362
- //#region ../../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
363
- var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
364
- const ESC = "\x1B";
365
- const CSI = `${ESC}[`;
366
- const beep = "\x07";
367
- const cursor = {
368
- to(x$2, y$1) {
369
- if (!y$1) return `${CSI}${x$2 + 1}G`;
370
- return `${CSI}${y$1 + 1};${x$2 + 1}H`;
371
- },
372
- move(x$2, y$1) {
373
- let ret = "";
374
- if (x$2 < 0) ret += `${CSI}${-x$2}D`;
375
- else if (x$2 > 0) ret += `${CSI}${x$2}C`;
376
- if (y$1 < 0) ret += `${CSI}${-y$1}A`;
377
- else if (y$1 > 0) ret += `${CSI}${y$1}B`;
378
- return ret;
379
- },
380
- up: (count = 1) => `${CSI}${count}A`,
381
- down: (count = 1) => `${CSI}${count}B`,
382
- forward: (count = 1) => `${CSI}${count}C`,
383
- backward: (count = 1) => `${CSI}${count}D`,
384
- nextLine: (count = 1) => `${CSI}E`.repeat(count),
385
- prevLine: (count = 1) => `${CSI}F`.repeat(count),
386
- left: `${CSI}G`,
387
- hide: `${CSI}?25l`,
388
- show: `${CSI}?25h`,
389
- save: `${ESC}7`,
390
- restore: `${ESC}8`
391
- };
392
- const scroll = {
393
- up: (count = 1) => `${CSI}S`.repeat(count),
394
- down: (count = 1) => `${CSI}T`.repeat(count)
395
- };
396
- const erase = {
397
- screen: `${CSI}2J`,
398
- up: (count = 1) => `${CSI}1J`.repeat(count),
399
- down: (count = 1) => `${CSI}J`.repeat(count),
400
- line: `${CSI}2K`,
401
- lineEnd: `${CSI}K`,
402
- lineStart: `${CSI}1K`,
403
- lines(count) {
404
- let clear = "";
405
- for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : "");
406
- if (count) clear += cursor.left;
407
- return clear;
408
- }
409
- };
410
- module.exports = {
411
- cursor,
412
- scroll,
413
- erase,
414
- beep
415
- };
416
- }));
417
-
418
- //#endregion
419
- //#region ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
420
- var require_picocolors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
421
- let p = process || {}, argv = p.argv || [], env = p.env || {};
422
- 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);
423
- let formatter = (open, close, replace = open) => (input) => {
424
- let string = "" + input, index = string.indexOf(close, open.length);
425
- return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
426
- };
427
- let replaceClose = (string, close, replace, index) => {
428
- let result = "", cursor = 0;
429
- do {
430
- result += string.substring(cursor, index) + replace;
431
- cursor = index + close.length;
432
- index = string.indexOf(close, cursor);
433
- } while (~index);
434
- return result + string.substring(cursor);
435
- };
436
- let createColors = (enabled = isColorSupported) => {
437
- let f = enabled ? formatter : () => String;
438
- return {
439
- isColorSupported: enabled,
440
- reset: f("\x1B[0m", "\x1B[0m"),
441
- bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
442
- dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
443
- italic: f("\x1B[3m", "\x1B[23m"),
444
- underline: f("\x1B[4m", "\x1B[24m"),
445
- inverse: f("\x1B[7m", "\x1B[27m"),
446
- hidden: f("\x1B[8m", "\x1B[28m"),
447
- strikethrough: f("\x1B[9m", "\x1B[29m"),
448
- black: f("\x1B[30m", "\x1B[39m"),
449
- red: f("\x1B[31m", "\x1B[39m"),
450
- green: f("\x1B[32m", "\x1B[39m"),
451
- yellow: f("\x1B[33m", "\x1B[39m"),
452
- blue: f("\x1B[34m", "\x1B[39m"),
453
- magenta: f("\x1B[35m", "\x1B[39m"),
454
- cyan: f("\x1B[36m", "\x1B[39m"),
455
- white: f("\x1B[37m", "\x1B[39m"),
456
- gray: f("\x1B[90m", "\x1B[39m"),
457
- bgBlack: f("\x1B[40m", "\x1B[49m"),
458
- bgRed: f("\x1B[41m", "\x1B[49m"),
459
- bgGreen: f("\x1B[42m", "\x1B[49m"),
460
- bgYellow: f("\x1B[43m", "\x1B[49m"),
461
- bgBlue: f("\x1B[44m", "\x1B[49m"),
462
- bgMagenta: f("\x1B[45m", "\x1B[49m"),
463
- bgCyan: f("\x1B[46m", "\x1B[49m"),
464
- bgWhite: f("\x1B[47m", "\x1B[49m"),
465
- blackBright: f("\x1B[90m", "\x1B[39m"),
466
- redBright: f("\x1B[91m", "\x1B[39m"),
467
- greenBright: f("\x1B[92m", "\x1B[39m"),
468
- yellowBright: f("\x1B[93m", "\x1B[39m"),
469
- blueBright: f("\x1B[94m", "\x1B[39m"),
470
- magentaBright: f("\x1B[95m", "\x1B[39m"),
471
- cyanBright: f("\x1B[96m", "\x1B[39m"),
472
- whiteBright: f("\x1B[97m", "\x1B[39m"),
473
- bgBlackBright: f("\x1B[100m", "\x1B[49m"),
474
- bgRedBright: f("\x1B[101m", "\x1B[49m"),
475
- bgGreenBright: f("\x1B[102m", "\x1B[49m"),
476
- bgYellowBright: f("\x1B[103m", "\x1B[49m"),
477
- bgBlueBright: f("\x1B[104m", "\x1B[49m"),
478
- bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
479
- bgCyanBright: f("\x1B[106m", "\x1B[49m"),
480
- bgWhiteBright: f("\x1B[107m", "\x1B[49m")
481
- };
482
- };
483
- module.exports = createColors();
484
- module.exports.createColors = createColors;
485
- }));
486
-
487
- //#endregion
488
- //#region ../../node_modules/.pnpm/@clack+core@0.5.0/node_modules/@clack/core/dist/index.mjs
489
- var import_src = require_src();
490
- var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
491
- function DD({ onlyFirst: e$1 = !1 } = {}) {
492
- 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("|");
493
- return new RegExp(t, e$1 ? void 0 : "g");
494
- }
495
- const uD = DD();
496
- function P$1(e$1) {
497
- if (typeof e$1 != "string") throw new TypeError(`Expected a \`string\`, got \`${typeof e$1}\``);
498
- return e$1.replace(uD, "");
499
- }
500
- function L$1(e$1) {
501
- return e$1 && e$1.__esModule && Object.prototype.hasOwnProperty.call(e$1, "default") ? e$1.default : e$1;
502
- }
503
- var W$1 = { exports: {} };
504
- (function(e$1) {
505
- var u$1 = {};
506
- e$1.exports = u$1, u$1.eastAsianWidth = function(F$1) {
507
- var s = F$1.charCodeAt(0), i = F$1.length == 2 ? F$1.charCodeAt(1) : 0, D$1 = s;
508
- return 55296 <= s && s <= 56319 && 56320 <= i && i <= 57343 && (s &= 1023, i &= 1023, D$1 = s << 10 | i, D$1 += 65536), D$1 == 12288 || 65281 <= D$1 && D$1 <= 65376 || 65504 <= D$1 && D$1 <= 65510 ? "F" : D$1 == 8361 || 65377 <= D$1 && D$1 <= 65470 || 65474 <= D$1 && D$1 <= 65479 || 65482 <= D$1 && D$1 <= 65487 || 65490 <= D$1 && D$1 <= 65495 || 65498 <= D$1 && D$1 <= 65500 || 65512 <= D$1 && D$1 <= 65518 ? "H" : 4352 <= D$1 && D$1 <= 4447 || 4515 <= D$1 && D$1 <= 4519 || 4602 <= D$1 && D$1 <= 4607 || 9001 <= D$1 && D$1 <= 9002 || 11904 <= D$1 && D$1 <= 11929 || 11931 <= D$1 && D$1 <= 12019 || 12032 <= D$1 && D$1 <= 12245 || 12272 <= D$1 && D$1 <= 12283 || 12289 <= D$1 && D$1 <= 12350 || 12353 <= D$1 && D$1 <= 12438 || 12441 <= D$1 && D$1 <= 12543 || 12549 <= D$1 && D$1 <= 12589 || 12593 <= D$1 && D$1 <= 12686 || 12688 <= D$1 && D$1 <= 12730 || 12736 <= D$1 && D$1 <= 12771 || 12784 <= D$1 && D$1 <= 12830 || 12832 <= D$1 && D$1 <= 12871 || 12880 <= D$1 && D$1 <= 13054 || 13056 <= D$1 && D$1 <= 19903 || 19968 <= D$1 && D$1 <= 42124 || 42128 <= D$1 && D$1 <= 42182 || 43360 <= D$1 && D$1 <= 43388 || 44032 <= D$1 && D$1 <= 55203 || 55216 <= D$1 && D$1 <= 55238 || 55243 <= D$1 && D$1 <= 55291 || 63744 <= D$1 && D$1 <= 64255 || 65040 <= D$1 && D$1 <= 65049 || 65072 <= D$1 && D$1 <= 65106 || 65108 <= D$1 && D$1 <= 65126 || 65128 <= D$1 && D$1 <= 65131 || 110592 <= D$1 && D$1 <= 110593 || 127488 <= D$1 && D$1 <= 127490 || 127504 <= D$1 && D$1 <= 127546 || 127552 <= D$1 && D$1 <= 127560 || 127568 <= D$1 && D$1 <= 127569 || 131072 <= D$1 && D$1 <= 194367 || 177984 <= D$1 && D$1 <= 196605 || 196608 <= D$1 && D$1 <= 262141 ? "W" : 32 <= D$1 && D$1 <= 126 || 162 <= D$1 && D$1 <= 163 || 165 <= D$1 && D$1 <= 166 || D$1 == 172 || D$1 == 175 || 10214 <= D$1 && D$1 <= 10221 || 10629 <= D$1 && D$1 <= 10630 ? "Na" : D$1 == 161 || D$1 == 164 || 167 <= D$1 && D$1 <= 168 || D$1 == 170 || 173 <= D$1 && D$1 <= 174 || 176 <= D$1 && D$1 <= 180 || 182 <= D$1 && D$1 <= 186 || 188 <= D$1 && D$1 <= 191 || D$1 == 198 || D$1 == 208 || 215 <= D$1 && D$1 <= 216 || 222 <= D$1 && D$1 <= 225 || D$1 == 230 || 232 <= D$1 && D$1 <= 234 || 236 <= D$1 && D$1 <= 237 || D$1 == 240 || 242 <= D$1 && D$1 <= 243 || 247 <= D$1 && D$1 <= 250 || D$1 == 252 || D$1 == 254 || D$1 == 257 || D$1 == 273 || D$1 == 275 || D$1 == 283 || 294 <= D$1 && D$1 <= 295 || D$1 == 299 || 305 <= D$1 && D$1 <= 307 || D$1 == 312 || 319 <= D$1 && D$1 <= 322 || D$1 == 324 || 328 <= D$1 && D$1 <= 331 || D$1 == 333 || 338 <= D$1 && D$1 <= 339 || 358 <= D$1 && D$1 <= 359 || D$1 == 363 || D$1 == 462 || D$1 == 464 || D$1 == 466 || D$1 == 468 || D$1 == 470 || D$1 == 472 || D$1 == 474 || D$1 == 476 || D$1 == 593 || D$1 == 609 || D$1 == 708 || D$1 == 711 || 713 <= D$1 && D$1 <= 715 || D$1 == 717 || D$1 == 720 || 728 <= D$1 && D$1 <= 731 || D$1 == 733 || D$1 == 735 || 768 <= D$1 && D$1 <= 879 || 913 <= D$1 && D$1 <= 929 || 931 <= D$1 && D$1 <= 937 || 945 <= D$1 && D$1 <= 961 || 963 <= D$1 && D$1 <= 969 || D$1 == 1025 || 1040 <= D$1 && D$1 <= 1103 || D$1 == 1105 || D$1 == 8208 || 8211 <= D$1 && D$1 <= 8214 || 8216 <= D$1 && D$1 <= 8217 || 8220 <= D$1 && D$1 <= 8221 || 8224 <= D$1 && D$1 <= 8226 || 8228 <= D$1 && D$1 <= 8231 || D$1 == 8240 || 8242 <= D$1 && D$1 <= 8243 || D$1 == 8245 || D$1 == 8251 || D$1 == 8254 || D$1 == 8308 || D$1 == 8319 || 8321 <= D$1 && D$1 <= 8324 || D$1 == 8364 || D$1 == 8451 || D$1 == 8453 || D$1 == 8457 || D$1 == 8467 || D$1 == 8470 || 8481 <= D$1 && D$1 <= 8482 || D$1 == 8486 || D$1 == 8491 || 8531 <= D$1 && D$1 <= 8532 || 8539 <= D$1 && D$1 <= 8542 || 8544 <= D$1 && D$1 <= 8555 || 8560 <= D$1 && D$1 <= 8569 || D$1 == 8585 || 8592 <= D$1 && D$1 <= 8601 || 8632 <= D$1 && D$1 <= 8633 || D$1 == 8658 || D$1 == 8660 || D$1 == 8679 || D$1 == 8704 || 8706 <= D$1 && D$1 <= 8707 || 8711 <= D$1 && D$1 <= 8712 || D$1 == 8715 || D$1 == 8719 || D$1 == 8721 || D$1 == 8725 || D$1 == 8730 || 8733 <= D$1 && D$1 <= 8736 || D$1 == 8739 || D$1 == 8741 || 8743 <= D$1 && D$1 <= 8748 || D$1 == 8750 || 8756 <= D$1 && D$1 <= 8759 || 8764 <= D$1 && D$1 <= 8765 || D$1 == 8776 || D$1 == 8780 || D$1 == 8786 || 8800 <= D$1 && D$1 <= 8801 || 8804 <= D$1 && D$1 <= 8807 || 8810 <= D$1 && D$1 <= 8811 || 8814 <= D$1 && D$1 <= 8815 || 8834 <= D$1 && D$1 <= 8835 || 8838 <= D$1 && D$1 <= 8839 || D$1 == 8853 || D$1 == 8857 || D$1 == 8869 || D$1 == 8895 || D$1 == 8978 || 9312 <= D$1 && D$1 <= 9449 || 9451 <= D$1 && D$1 <= 9547 || 9552 <= D$1 && D$1 <= 9587 || 9600 <= D$1 && D$1 <= 9615 || 9618 <= D$1 && D$1 <= 9621 || 9632 <= D$1 && D$1 <= 9633 || 9635 <= D$1 && D$1 <= 9641 || 9650 <= D$1 && D$1 <= 9651 || 9654 <= D$1 && D$1 <= 9655 || 9660 <= D$1 && D$1 <= 9661 || 9664 <= D$1 && D$1 <= 9665 || 9670 <= D$1 && D$1 <= 9672 || D$1 == 9675 || 9678 <= D$1 && D$1 <= 9681 || 9698 <= D$1 && D$1 <= 9701 || D$1 == 9711 || 9733 <= D$1 && D$1 <= 9734 || D$1 == 9737 || 9742 <= D$1 && D$1 <= 9743 || 9748 <= D$1 && D$1 <= 9749 || D$1 == 9756 || D$1 == 9758 || D$1 == 9792 || D$1 == 9794 || 9824 <= D$1 && D$1 <= 9825 || 9827 <= D$1 && D$1 <= 9829 || 9831 <= D$1 && D$1 <= 9834 || 9836 <= D$1 && D$1 <= 9837 || D$1 == 9839 || 9886 <= D$1 && D$1 <= 9887 || 9918 <= D$1 && D$1 <= 9919 || 9924 <= D$1 && D$1 <= 9933 || 9935 <= D$1 && D$1 <= 9953 || D$1 == 9955 || 9960 <= D$1 && D$1 <= 9983 || D$1 == 10045 || D$1 == 10071 || 10102 <= D$1 && D$1 <= 10111 || 11093 <= D$1 && D$1 <= 11097 || 12872 <= D$1 && D$1 <= 12879 || 57344 <= D$1 && D$1 <= 63743 || 65024 <= D$1 && D$1 <= 65039 || D$1 == 65533 || 127232 <= D$1 && D$1 <= 127242 || 127248 <= D$1 && D$1 <= 127277 || 127280 <= D$1 && D$1 <= 127337 || 127344 <= D$1 && D$1 <= 127386 || 917760 <= D$1 && D$1 <= 917999 || 983040 <= D$1 && D$1 <= 1048573 || 1048576 <= D$1 && D$1 <= 1114109 ? "A" : "N";
509
- }, u$1.characterLength = function(F$1) {
510
- var s = this.eastAsianWidth(F$1);
511
- return s == "F" || s == "W" || s == "A" ? 2 : 1;
512
- };
513
- function t(F$1) {
514
- return F$1.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
515
- }
516
- u$1.length = function(F$1) {
517
- for (var s = t(F$1), i = 0, D$1 = 0; D$1 < s.length; D$1++) i = i + this.characterLength(s[D$1]);
518
- return i;
519
- }, u$1.slice = function(F$1, s, i) {
520
- textLen = u$1.length(F$1), s = s || 0, i = i || 1, s < 0 && (s = textLen + s), i < 0 && (i = textLen + i);
521
- for (var D$1 = "", C$1 = 0, n = t(F$1), E = 0; E < n.length; E++) {
522
- var a$1 = n[E], o$1 = u$1.length(a$1);
523
- if (C$1 >= s - (o$1 == 2 ? 1 : 0)) if (C$1 + o$1 <= i) D$1 += a$1;
524
- else break;
525
- C$1 += o$1;
526
- }
527
- return D$1;
528
- };
529
- })(W$1);
530
- var tD = W$1.exports;
531
- const eD = L$1(tD);
532
- var FD = function() {
533
- return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
534
- };
535
- const sD = L$1(FD);
536
- function p(e$1, u$1 = {}) {
537
- if (typeof e$1 != "string" || e$1.length === 0 || (u$1 = {
538
- ambiguousIsNarrow: !0,
539
- ...u$1
540
- }, e$1 = P$1(e$1), e$1.length === 0)) return 0;
541
- e$1 = e$1.replace(sD(), " ");
542
- const t = u$1.ambiguousIsNarrow ? 1 : 2;
543
- let F$1 = 0;
544
- for (const s of e$1) {
545
- const i = s.codePointAt(0);
546
- if (i <= 31 || i >= 127 && i <= 159 || i >= 768 && i <= 879) continue;
547
- switch (eD.eastAsianWidth(s)) {
548
- case "F":
549
- case "W":
550
- F$1 += 2;
551
- break;
552
- case "A":
553
- F$1 += t;
554
- break;
555
- default: F$1 += 1;
556
- }
557
- }
558
- return F$1;
559
- }
560
- const w = 10, N = (e$1 = 0) => (u$1) => `\x1B[${u$1 + e$1}m`, I = (e$1 = 0) => (u$1) => `\x1B[${38 + e$1};5;${u$1}m`, R = (e$1 = 0) => (u$1, t, F$1) => `\x1B[${38 + e$1};2;${u$1};${t};${F$1}m`, r = {
561
- modifier: {
562
- reset: [0, 0],
563
- bold: [1, 22],
564
- dim: [2, 22],
565
- italic: [3, 23],
566
- underline: [4, 24],
567
- overline: [53, 55],
568
- inverse: [7, 27],
569
- hidden: [8, 28],
570
- strikethrough: [9, 29]
571
- },
572
- color: {
573
- black: [30, 39],
574
- red: [31, 39],
575
- green: [32, 39],
576
- yellow: [33, 39],
577
- blue: [34, 39],
578
- magenta: [35, 39],
579
- cyan: [36, 39],
580
- white: [37, 39],
581
- blackBright: [90, 39],
582
- gray: [90, 39],
583
- grey: [90, 39],
584
- redBright: [91, 39],
585
- greenBright: [92, 39],
586
- yellowBright: [93, 39],
587
- blueBright: [94, 39],
588
- magentaBright: [95, 39],
589
- cyanBright: [96, 39],
590
- whiteBright: [97, 39]
591
- },
592
- bgColor: {
593
- bgBlack: [40, 49],
594
- bgRed: [41, 49],
595
- bgGreen: [42, 49],
596
- bgYellow: [43, 49],
597
- bgBlue: [44, 49],
598
- bgMagenta: [45, 49],
599
- bgCyan: [46, 49],
600
- bgWhite: [47, 49],
601
- bgBlackBright: [100, 49],
602
- bgGray: [100, 49],
603
- bgGrey: [100, 49],
604
- bgRedBright: [101, 49],
605
- bgGreenBright: [102, 49],
606
- bgYellowBright: [103, 49],
607
- bgBlueBright: [104, 49],
608
- bgMagentaBright: [105, 49],
609
- bgCyanBright: [106, 49],
610
- bgWhiteBright: [107, 49]
611
- }
612
- };
613
- Object.keys(r.modifier);
614
- const iD = Object.keys(r.color), CD = Object.keys(r.bgColor);
615
- [...iD, ...CD];
616
- function rD() {
617
- const e$1 = /* @__PURE__ */ new Map();
618
- for (const [u$1, t] of Object.entries(r)) {
619
- for (const [F$1, s] of Object.entries(t)) r[F$1] = {
620
- open: `\x1B[${s[0]}m`,
621
- close: `\x1B[${s[1]}m`
622
- }, t[F$1] = r[F$1], e$1.set(s[0], s[1]);
623
- Object.defineProperty(r, u$1, {
624
- value: t,
625
- enumerable: !1
626
- });
627
- }
628
- return Object.defineProperty(r, "codes", {
629
- value: e$1,
630
- enumerable: !1
631
- }), r.color.close = "\x1B[39m", r.bgColor.close = "\x1B[49m", r.color.ansi = N(), r.color.ansi256 = I(), r.color.ansi16m = R(), r.bgColor.ansi = N(w), r.bgColor.ansi256 = I(w), r.bgColor.ansi16m = R(w), Object.defineProperties(r, {
632
- rgbToAnsi256: {
633
- value: (u$1, t, F$1) => u$1 === t && t === F$1 ? u$1 < 8 ? 16 : u$1 > 248 ? 231 : Math.round((u$1 - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u$1 / 255 * 5) + 6 * Math.round(t / 255 * 5) + Math.round(F$1 / 255 * 5),
634
- enumerable: !1
635
- },
636
- hexToRgb: {
637
- value: (u$1) => {
638
- const t = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u$1.toString(16));
639
- if (!t) return [
640
- 0,
641
- 0,
642
- 0
643
- ];
644
- let [F$1] = t;
645
- F$1.length === 3 && (F$1 = [...F$1].map((i) => i + i).join(""));
646
- const s = Number.parseInt(F$1, 16);
647
- return [
648
- s >> 16 & 255,
649
- s >> 8 & 255,
650
- s & 255
651
- ];
652
- },
653
- enumerable: !1
654
- },
655
- hexToAnsi256: {
656
- value: (u$1) => r.rgbToAnsi256(...r.hexToRgb(u$1)),
657
- enumerable: !1
658
- },
659
- ansi256ToAnsi: {
660
- value: (u$1) => {
661
- if (u$1 < 8) return 30 + u$1;
662
- if (u$1 < 16) return 90 + (u$1 - 8);
663
- let t, F$1, s;
664
- if (u$1 >= 232) t = ((u$1 - 232) * 10 + 8) / 255, F$1 = t, s = t;
665
- else {
666
- u$1 -= 16;
667
- const C$1 = u$1 % 36;
668
- t = Math.floor(u$1 / 36) / 5, F$1 = Math.floor(C$1 / 6) / 5, s = C$1 % 6 / 5;
669
- }
670
- const i = Math.max(t, F$1, s) * 2;
671
- if (i === 0) return 30;
672
- let D$1 = 30 + (Math.round(s) << 2 | Math.round(F$1) << 1 | Math.round(t));
673
- return i === 2 && (D$1 += 60), D$1;
674
- },
675
- enumerable: !1
676
- },
677
- rgbToAnsi: {
678
- value: (u$1, t, F$1) => r.ansi256ToAnsi(r.rgbToAnsi256(u$1, t, F$1)),
679
- enumerable: !1
680
- },
681
- hexToAnsi: {
682
- value: (u$1) => r.ansi256ToAnsi(r.hexToAnsi256(u$1)),
683
- enumerable: !1
684
- }
685
- }), r;
686
- }
687
- const ED = rD(), d$1 = new Set(["\x1B", "›"]), oD = 39, y = "\x07", V$1 = "[", nD = "]", G$1 = "m", _$1 = `${nD}8;;`, z = (e$1) => `${d$1.values().next().value}${V$1}${e$1}${G$1}`, K$1 = (e$1) => `${d$1.values().next().value}${_$1}${e$1}${y}`, aD = (e$1) => e$1.split(" ").map((u$1) => p(u$1)), k$1 = (e$1, u$1, t) => {
688
- const F$1 = [...u$1];
689
- let s = !1, i = !1, D$1 = p(P$1(e$1[e$1.length - 1]));
690
- for (const [C$1, n] of F$1.entries()) {
691
- const E = p(n);
692
- if (D$1 + E <= t ? e$1[e$1.length - 1] += n : (e$1.push(n), D$1 = 0), d$1.has(n) && (s = !0, i = F$1.slice(C$1 + 1).join("").startsWith(_$1)), s) {
693
- i ? n === y && (s = !1, i = !1) : n === G$1 && (s = !1);
694
- continue;
695
- }
696
- D$1 += E, D$1 === t && C$1 < F$1.length - 1 && (e$1.push(""), D$1 = 0);
697
- }
698
- !D$1 && e$1[e$1.length - 1].length > 0 && e$1.length > 1 && (e$1[e$1.length - 2] += e$1.pop());
699
- }, hD = (e$1) => {
700
- const u$1 = e$1.split(" ");
701
- let t = u$1.length;
702
- for (; t > 0 && !(p(u$1[t - 1]) > 0);) t--;
703
- return t === u$1.length ? e$1 : u$1.slice(0, t).join(" ") + u$1.slice(t).join("");
704
- }, lD = (e$1, u$1, t = {}) => {
705
- if (t.trim !== !1 && e$1.trim() === "") return "";
706
- let F$1 = "", s, i;
707
- const D$1 = aD(e$1);
708
- let C$1 = [""];
709
- for (const [E, a$1] of e$1.split(" ").entries()) {
710
- t.trim !== !1 && (C$1[C$1.length - 1] = C$1[C$1.length - 1].trimStart());
711
- let o$1 = p(C$1[C$1.length - 1]);
712
- if (E !== 0 && (o$1 >= u$1 && (t.wordWrap === !1 || t.trim === !1) && (C$1.push(""), o$1 = 0), (o$1 > 0 || t.trim === !1) && (C$1[C$1.length - 1] += " ", o$1++)), t.hard && D$1[E] > u$1) {
713
- const c = u$1 - o$1, f = 1 + Math.floor((D$1[E] - c - 1) / u$1);
714
- Math.floor((D$1[E] - 1) / u$1) < f && C$1.push(""), k$1(C$1, a$1, u$1);
715
- continue;
716
- }
717
- if (o$1 + D$1[E] > u$1 && o$1 > 0 && D$1[E] > 0) {
718
- if (t.wordWrap === !1 && o$1 < u$1) {
719
- k$1(C$1, a$1, u$1);
720
- continue;
721
- }
722
- C$1.push("");
723
- }
724
- if (o$1 + D$1[E] > u$1 && t.wordWrap === !1) {
725
- k$1(C$1, a$1, u$1);
726
- continue;
727
- }
728
- C$1[C$1.length - 1] += a$1;
729
- }
730
- t.trim !== !1 && (C$1 = C$1.map((E) => hD(E)));
731
- const n = [...C$1.join(`
732
- `)];
733
- for (const [E, a$1] of n.entries()) {
734
- if (F$1 += a$1, d$1.has(a$1)) {
735
- const { groups: c } = (/* @__PURE__ */ new RegExp(`(?:\\${V$1}(?<code>\\d+)m|\\${_$1}(?<uri>.*)${y})`)).exec(n.slice(E).join("")) || { groups: {} };
736
- if (c.code !== void 0) {
737
- const f = Number.parseFloat(c.code);
738
- s = f === oD ? void 0 : f;
739
- } else c.uri !== void 0 && (i = c.uri.length === 0 ? void 0 : c.uri);
740
- }
741
- const o$1 = ED.codes.get(Number(s));
742
- n[E + 1] === `
743
- ` ? (i && (F$1 += K$1("")), s && o$1 && (F$1 += z(o$1))) : a$1 === `
744
- ` && (s && o$1 && (F$1 += z(s)), i && (F$1 += K$1(i)));
745
- }
746
- return F$1;
747
- };
748
- function Y$1(e$1, u$1, t) {
749
- return String(e$1).normalize().replace(/\r\n/g, `
750
- `).split(`
751
- `).map((F$1) => lD(F$1, u$1, t)).join(`
752
- `);
753
- }
754
- const B = {
755
- actions: new Set([
756
- "up",
757
- "down",
758
- "left",
759
- "right",
760
- "space",
761
- "enter",
762
- "cancel"
763
- ]),
764
- aliases: new Map([
765
- ["k", "up"],
766
- ["j", "down"],
767
- ["h", "left"],
768
- ["l", "right"],
769
- ["", "cancel"],
770
- ["escape", "cancel"]
771
- ])
772
- };
773
- function $(e$1, u$1) {
774
- if (typeof e$1 == "string") return B.aliases.get(e$1) === u$1;
775
- for (const t of e$1) if (t !== void 0 && $(t, u$1)) return !0;
776
- return !1;
777
- }
778
- function BD(e$1, u$1) {
779
- if (e$1 === u$1) return;
780
- const t = e$1.split(`
781
- `), F$1 = u$1.split(`
782
- `), s = [];
783
- for (let i = 0; i < Math.max(t.length, F$1.length); i++) t[i] !== F$1[i] && s.push(i);
784
- return s;
785
- }
786
- const AD = globalThis.process.platform.startsWith("win"), S = Symbol("clack:cancel");
787
- function pD(e$1) {
788
- return e$1 === S;
789
- }
790
- function m(e$1, u$1) {
791
- const t = e$1;
792
- t.isTTY && t.setRawMode(u$1);
793
- }
794
- function fD({ input: e$1 = stdin, output: u$1 = stdout, overwrite: t = !0, hideCursor: F$1 = !0 } = {}) {
795
- const s = g.createInterface({
796
- input: e$1,
797
- output: u$1,
798
- prompt: "",
799
- tabSize: 1
800
- });
801
- g.emitKeypressEvents(e$1, s), e$1.isTTY && e$1.setRawMode(!0);
802
- const i = (D$1, { name: C$1, sequence: n }) => {
803
- if ($([
804
- String(D$1),
805
- C$1,
806
- n
807
- ], "cancel")) {
808
- F$1 && u$1.write(import_src.cursor.show), process.exit(0);
809
- return;
810
- }
811
- if (!t) return;
812
- const a$1 = C$1 === "return" ? 0 : -1, o$1 = C$1 === "return" ? -1 : 0;
813
- g.moveCursor(u$1, a$1, o$1, () => {
814
- g.clearLine(u$1, 1, () => {
815
- e$1.once("keypress", i);
816
- });
817
- });
818
- };
819
- return F$1 && u$1.write(import_src.cursor.hide), e$1.once("keypress", i), () => {
820
- 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();
821
- };
822
- }
823
- var gD = Object.defineProperty, vD = (e$1, u$1, t) => u$1 in e$1 ? gD(e$1, u$1, {
824
- enumerable: !0,
825
- configurable: !0,
826
- writable: !0,
827
- value: t
828
- }) : e$1[u$1] = t, h = (e$1, u$1, t) => (vD(e$1, typeof u$1 != "symbol" ? u$1 + "" : u$1, t), t);
829
- var x$1 = class {
830
- constructor(u$1, t = !0) {
831
- h(this, "input"), h(this, "output"), h(this, "_abortSignal"), h(this, "rl"), h(this, "opts"), h(this, "_render"), h(this, "_track", !1), h(this, "_prevFrame", ""), h(this, "_subscribers", /* @__PURE__ */ new Map()), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
832
- const { input: F$1 = stdin, output: s = stdout, render: i, signal: D$1, ...C$1 } = u$1;
833
- this.opts = C$1, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i.bind(this), this._track = t, this._abortSignal = D$1, this.input = F$1, this.output = s;
834
- }
835
- unsubscribe() {
836
- this._subscribers.clear();
837
- }
838
- setSubscriber(u$1, t) {
839
- const F$1 = this._subscribers.get(u$1) ?? [];
840
- F$1.push(t), this._subscribers.set(u$1, F$1);
841
- }
842
- on(u$1, t) {
843
- this.setSubscriber(u$1, { cb: t });
844
- }
845
- once(u$1, t) {
846
- this.setSubscriber(u$1, {
847
- cb: t,
848
- once: !0
849
- });
850
- }
851
- emit(u$1, ...t) {
852
- const F$1 = this._subscribers.get(u$1) ?? [], s = [];
853
- for (const i of F$1) i.cb(...t), i.once && s.push(() => F$1.splice(F$1.indexOf(i), 1));
854
- for (const i of s) i();
855
- }
856
- prompt() {
857
- return new Promise((u$1, t) => {
858
- if (this._abortSignal) {
859
- if (this._abortSignal.aborted) return this.state = "cancel", this.close(), u$1(S);
860
- this._abortSignal.addEventListener("abort", () => {
861
- this.state = "cancel", this.close();
862
- }, { once: !0 });
863
- }
864
- const F$1 = new Writable();
865
- F$1._write = (s, i, D$1) => {
866
- this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D$1();
867
- }, this.input.pipe(F$1), this.rl = O.createInterface({
868
- input: this.input,
869
- output: F$1,
870
- tabSize: 2,
871
- prompt: "",
872
- escapeCodeTimeout: 50,
873
- terminal: !0
874
- }), 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", () => {
875
- this.output.write(import_src.cursor.show), this.output.off("resize", this.render), m(this.input, !1), u$1(this.value);
876
- }), this.once("cancel", () => {
877
- this.output.write(import_src.cursor.show), this.output.off("resize", this.render), m(this.input, !1), u$1(S);
878
- });
879
- });
880
- }
881
- onKeypress(u$1, t) {
882
- if (this.state === "error" && (this.state = "active"), t?.name && (!this._track && B.aliases.has(t.name) && this.emit("cursor", B.aliases.get(t.name)), B.actions.has(t.name) && this.emit("cursor", t.name)), u$1 && (u$1.toLowerCase() === "y" || u$1.toLowerCase() === "n") && this.emit("confirm", u$1.toLowerCase() === "y"), u$1 === " " && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u$1 && this.emit("key", u$1.toLowerCase()), t?.name === "return") {
883
- if (this.opts.validate) {
884
- const F$1 = this.opts.validate(this.value);
885
- F$1 && (this.error = F$1 instanceof Error ? F$1.message : F$1, this.state = "error", this.rl?.write(this.value));
886
- }
887
- this.state !== "error" && (this.state = "submit");
888
- }
889
- $([
890
- u$1,
891
- t?.name,
892
- t?.sequence
893
- ], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
894
- }
895
- close() {
896
- this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
897
- `), m(this.input, !1), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
898
- }
899
- restoreCursor() {
900
- const u$1 = Y$1(this._prevFrame, process.stdout.columns, { hard: !0 }).split(`
901
- `).length - 1;
902
- this.output.write(import_src.cursor.move(-999, u$1 * -1));
903
- }
904
- render() {
905
- const u$1 = Y$1(this._render(this) ?? "", process.stdout.columns, { hard: !0 });
906
- if (u$1 !== this._prevFrame) {
907
- if (this.state === "initial") this.output.write(import_src.cursor.hide);
908
- else {
909
- const t = BD(this._prevFrame, u$1);
910
- if (this.restoreCursor(), t && t?.length === 1) {
911
- const F$1 = t[0];
912
- this.output.write(import_src.cursor.move(0, F$1)), this.output.write(import_src.erase.lines(1));
913
- const s = u$1.split(`
914
- `);
915
- this.output.write(s[F$1]), this._prevFrame = u$1, this.output.write(import_src.cursor.move(0, s.length - F$1 - 1));
916
- return;
917
- }
918
- if (t && t?.length > 1) {
919
- const F$1 = t[0];
920
- this.output.write(import_src.cursor.move(0, F$1)), this.output.write(import_src.erase.down());
921
- const s = u$1.split(`
922
- `).slice(F$1);
923
- this.output.write(s.join(`
924
- `)), this._prevFrame = u$1;
925
- return;
926
- }
927
- this.output.write(import_src.erase.down());
928
- }
929
- this.output.write(u$1), this.state === "initial" && (this.state = "active"), this._prevFrame = u$1;
930
- }
931
- }
932
- };
933
- var dD = class extends x$1 {
934
- get cursor() {
935
- return this.value ? 0 : 1;
936
- }
937
- get _value() {
938
- return this.cursor === 0;
939
- }
940
- constructor(u$1) {
941
- super(u$1, !1), this.value = !!u$1.initialValue, this.on("value", () => {
942
- this.value = this._value;
943
- }), this.on("confirm", (t) => {
944
- this.output.write(import_src.cursor.move(0, -1)), this.value = t, this.state = "submit", this.close();
945
- }), this.on("cursor", () => {
946
- this.value = !this.value;
947
- });
948
- }
949
- };
950
- var mD = Object.defineProperty, bD = (e$1, u$1, t) => u$1 in e$1 ? mD(e$1, u$1, {
951
- enumerable: !0,
952
- configurable: !0,
953
- writable: !0,
954
- value: t
955
- }) : e$1[u$1] = t, Z = (e$1, u$1, t) => (bD(e$1, typeof u$1 != "symbol" ? u$1 + "" : u$1, t), t), q$1 = (e$1, u$1, t) => {
956
- if (!u$1.has(e$1)) throw TypeError("Cannot " + t);
957
- }, T$1 = (e$1, u$1, t) => (q$1(e$1, u$1, "read from private field"), t ? t.call(e$1) : u$1.get(e$1)), wD = (e$1, u$1, t) => {
958
- if (u$1.has(e$1)) throw TypeError("Cannot add the same private member more than once");
959
- u$1 instanceof WeakSet ? u$1.add(e$1) : u$1.set(e$1, t);
960
- }, yD = (e$1, u$1, t, F$1) => (q$1(e$1, u$1, "write to private field"), F$1 ? F$1.call(e$1, t) : u$1.set(e$1, t), t), A$1;
961
- let _D = class extends x$1 {
962
- constructor(u$1) {
963
- super(u$1, !1), Z(this, "options"), Z(this, "cursor", 0), wD(this, A$1, void 0);
964
- const { options: t } = u$1;
965
- yD(this, A$1, u$1.selectableGroups !== !1), this.options = Object.entries(t).flatMap(([F$1, s]) => [{
966
- value: F$1,
967
- group: !0,
968
- label: F$1
969
- }, ...s.map((i) => ({
970
- ...i,
971
- group: F$1
972
- }))]), this.value = [...u$1.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: F$1 }) => F$1 === u$1.cursorAt), T$1(this, A$1) ? 0 : 1), this.on("cursor", (F$1) => {
973
- switch (F$1) {
974
- case "left":
975
- case "up": {
976
- this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
977
- const s = this.options[this.cursor]?.group === !0;
978
- !T$1(this, A$1) && s && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
979
- break;
980
- }
981
- case "down":
982
- case "right": {
983
- this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
984
- const s = this.options[this.cursor]?.group === !0;
985
- !T$1(this, A$1) && s && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
986
- break;
987
- }
988
- case "space":
989
- this.toggleValue();
990
- break;
991
- }
992
- });
993
- }
994
- getGroupItems(u$1) {
995
- return this.options.filter((t) => t.group === u$1);
996
- }
997
- isGroupSelected(u$1) {
998
- return this.getGroupItems(u$1).every((t) => this.value.includes(t.value));
999
- }
1000
- toggleValue() {
1001
- const u$1 = this.options[this.cursor];
1002
- if (u$1.group === !0) {
1003
- const t = u$1.value, F$1 = this.getGroupItems(t);
1004
- this.isGroupSelected(t) ? this.value = this.value.filter((s) => F$1.findIndex((i) => i.value === s) === -1) : this.value = [...this.value, ...F$1.map((s) => s.value)], this.value = Array.from(new Set(this.value));
1005
- } else this.value = this.value.includes(u$1.value) ? this.value.filter((F$1) => F$1 !== u$1.value) : [...this.value, u$1.value];
1006
- }
1007
- };
1008
- A$1 = /* @__PURE__ */ new WeakMap();
1009
- var kD = Object.defineProperty, $D = (e$1, u$1, t) => u$1 in e$1 ? kD(e$1, u$1, {
1010
- enumerable: !0,
1011
- configurable: !0,
1012
- writable: !0,
1013
- value: t
1014
- }) : e$1[u$1] = t, H = (e$1, u$1, t) => ($D(e$1, typeof u$1 != "symbol" ? u$1 + "" : u$1, t), t);
1015
- let SD = class extends x$1 {
1016
- constructor(u$1) {
1017
- super(u$1, !1), H(this, "options"), H(this, "cursor", 0), this.options = u$1.options, this.value = [...u$1.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: t }) => t === u$1.cursorAt), 0), this.on("key", (t) => {
1018
- t === "a" && this.toggleAll();
1019
- }), this.on("cursor", (t) => {
1020
- switch (t) {
1021
- case "left":
1022
- case "up":
1023
- this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
1024
- break;
1025
- case "down":
1026
- case "right":
1027
- this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
1028
- break;
1029
- case "space":
1030
- this.toggleValue();
1031
- break;
1032
- }
1033
- });
1034
- }
1035
- get _value() {
1036
- return this.options[this.cursor].value;
1037
- }
1038
- toggleAll() {
1039
- this.value = this.value.length === this.options.length ? [] : this.options.map((t) => t.value);
1040
- }
1041
- toggleValue() {
1042
- this.value = this.value.includes(this._value) ? this.value.filter((t) => t !== this._value) : [...this.value, this._value];
1043
- }
1044
- };
1045
- var TD = Object.defineProperty, jD = (e$1, u$1, t) => u$1 in e$1 ? TD(e$1, u$1, {
1046
- enumerable: !0,
1047
- configurable: !0,
1048
- writable: !0,
1049
- value: t
1050
- }) : e$1[u$1] = t, U$1 = (e$1, u$1, t) => (jD(e$1, typeof u$1 != "symbol" ? u$1 + "" : u$1, t), t);
1051
- var MD = class extends x$1 {
1052
- constructor({ mask: u$1, ...t }) {
1053
- super(t), U$1(this, "valueWithCursor", ""), U$1(this, "_mask", "•"), this._mask = u$1 ?? "•", this.on("finalize", () => {
1054
- this.valueWithCursor = this.masked;
1055
- }), this.on("value", () => {
1056
- if (this.cursor >= this.value.length) this.valueWithCursor = `${this.masked}${import_picocolors.default.inverse(import_picocolors.default.hidden("_"))}`;
1057
- else {
1058
- const F$1 = this.masked.slice(0, this.cursor), s = this.masked.slice(this.cursor);
1059
- this.valueWithCursor = `${F$1}${import_picocolors.default.inverse(s[0])}${s.slice(1)}`;
1060
- }
1061
- });
1062
- }
1063
- get cursor() {
1064
- return this._cursor;
1065
- }
1066
- get masked() {
1067
- return this.value.replaceAll(/./g, this._mask);
1068
- }
1069
- };
1070
- var OD = Object.defineProperty, PD = (e$1, u$1, t) => u$1 in e$1 ? OD(e$1, u$1, {
1071
- enumerable: !0,
1072
- configurable: !0,
1073
- writable: !0,
1074
- value: t
1075
- }) : e$1[u$1] = t, J$1 = (e$1, u$1, t) => (PD(e$1, typeof u$1 != "symbol" ? u$1 + "" : u$1, t), t);
1076
- var LD = class extends x$1 {
1077
- constructor(u$1) {
1078
- super(u$1, !1), J$1(this, "options"), J$1(this, "cursor", 0), this.options = u$1.options, this.cursor = this.options.findIndex(({ value: t }) => t === u$1.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (t) => {
1079
- switch (t) {
1080
- case "left":
1081
- case "up":
1082
- this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
1083
- break;
1084
- case "down":
1085
- case "right":
1086
- this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
1087
- break;
1088
- }
1089
- this.changeValue();
1090
- });
1091
- }
1092
- get _value() {
1093
- return this.options[this.cursor];
1094
- }
1095
- changeValue() {
1096
- this.value = this._value.value;
1097
- }
1098
- };
1099
- var WD = Object.defineProperty, ND = (e$1, u$1, t) => u$1 in e$1 ? WD(e$1, u$1, {
1100
- enumerable: !0,
1101
- configurable: !0,
1102
- writable: !0,
1103
- value: t
1104
- }) : e$1[u$1] = t, Q = (e$1, u$1, t) => (ND(e$1, typeof u$1 != "symbol" ? u$1 + "" : u$1, t), t);
1105
- var ID = class extends x$1 {
1106
- constructor(u$1) {
1107
- super(u$1, !1), Q(this, "options"), Q(this, "cursor", 0), this.options = u$1.options;
1108
- const t = this.options.map(({ value: [F$1] }) => F$1?.toLowerCase());
1109
- this.cursor = Math.max(t.indexOf(u$1.initialValue), 0), this.on("key", (F$1) => {
1110
- if (!t.includes(F$1)) return;
1111
- const s = this.options.find(({ value: [i] }) => i?.toLowerCase() === F$1);
1112
- s && (this.value = s.value, this.state = "submit", this.emit("submit"));
1113
- });
1114
- }
1115
- };
1116
- var RD = class extends x$1 {
1117
- get valueWithCursor() {
1118
- if (this.state === "submit") return this.value;
1119
- if (this.cursor >= this.value.length) return `${this.value}\u2588`;
1120
- const u$1 = this.value.slice(0, this.cursor), [t, ...F$1] = this.value.slice(this.cursor);
1121
- return `${u$1}${import_picocolors.default.inverse(t)}${F$1.join("")}`;
1122
- }
1123
- get cursor() {
1124
- return this._cursor;
1125
- }
1126
- constructor(u$1) {
1127
- super(u$1), this.on("finalize", () => {
1128
- this.value || (this.value = u$1.defaultValue);
1129
- });
1130
- }
1131
- };
1132
-
1133
- //#endregion
1134
- //#region ../../node_modules/.pnpm/@clack+prompts@0.11.0/node_modules/@clack/prompts/dist/index.mjs
1135
- function ce() {
1136
- return process$1.platform !== "win32" ? process$1.env.TERM !== "linux" : !!process$1.env.CI || !!process$1.env.WT_SESSION || !!process$1.env.TERMINUS_SUBLIME || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
1137
- }
1138
- 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) => {
1139
- switch (t) {
1140
- case "initial":
1141
- case "active": return import_picocolors.default.cyan(le);
1142
- case "cancel": return import_picocolors.default.red(L);
1143
- case "error": return import_picocolors.default.yellow(W);
1144
- case "submit": return import_picocolors.default.green(C);
1145
- }
1146
- }, G = (t) => {
1147
- const { cursor: n, options: r$1, 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));
1148
- let l$1 = 0;
1149
- n >= l$1 + a$1 - 3 ? l$1 = Math.max(Math.min(n - a$1 + 3, r$1.length - a$1), 0) : n < l$1 + 2 && (l$1 = Math.max(n - 2, 0));
1150
- const $$1 = a$1 < r$1.length && l$1 > 0, g$1 = a$1 < r$1.length && l$1 + a$1 < r$1.length;
1151
- return r$1.slice(l$1, l$1 + a$1).map((p$1, v$1, f) => {
1152
- const j = v$1 === 0 && $$1, E = v$1 === f.length - 1 && g$1;
1153
- return j || E ? import_picocolors.default.dim("...") : i(p$1, v$1 + l$1 === n);
1154
- });
1155
- }, he = (t) => new RD({
1156
- validate: t.validate,
1157
- placeholder: t.placeholder,
1158
- defaultValue: t.defaultValue,
1159
- initialValue: t.initialValue,
1160
- render() {
1161
- const n = `${import_picocolors.default.gray(o)}
1162
- ${b(this.state)} ${t.message}
1163
- `, r$1 = 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$1;
1164
- switch (this.state) {
1165
- case "error": return `${n.trim()}
1166
- ${import_picocolors.default.yellow(o)} ${i}
1167
- ${import_picocolors.default.yellow(d)} ${import_picocolors.default.yellow(this.error)}
1168
- `;
1169
- case "submit": return `${n}${import_picocolors.default.gray(o)} ${import_picocolors.default.dim(this.value || t.placeholder)}`;
1170
- case "cancel": return `${n}${import_picocolors.default.gray(o)} ${import_picocolors.default.strikethrough(import_picocolors.default.dim(this.value ?? ""))}${this.value?.trim() ? `
1171
- ${import_picocolors.default.gray(o)}` : ""}`;
1172
- default: return `${n}${import_picocolors.default.cyan(o)} ${i}
1173
- ${import_picocolors.default.cyan(d)}
1174
- `;
1175
- }
1176
- }
1177
- }).prompt(), ge = (t) => new MD({
1178
- validate: t.validate,
1179
- mask: t.mask ?? $e,
1180
- render() {
1181
- const n = `${import_picocolors.default.gray(o)}
1182
- ${b(this.state)} ${t.message}
1183
- `, r$1 = this.valueWithCursor, i = this.masked;
1184
- switch (this.state) {
1185
- case "error": return `${n.trim()}
1186
- ${import_picocolors.default.yellow(o)} ${i}
1187
- ${import_picocolors.default.yellow(d)} ${import_picocolors.default.yellow(this.error)}
1188
- `;
1189
- case "submit": return `${n}${import_picocolors.default.gray(o)} ${import_picocolors.default.dim(i)}`;
1190
- case "cancel": return `${n}${import_picocolors.default.gray(o)} ${import_picocolors.default.strikethrough(import_picocolors.default.dim(i ?? ""))}${i ? `
1191
- ${import_picocolors.default.gray(o)}` : ""}`;
1192
- default: return `${n}${import_picocolors.default.cyan(o)} ${r$1}
1193
- ${import_picocolors.default.cyan(d)}
1194
- `;
1195
- }
1196
- }
1197
- }).prompt(), ye = (t) => {
1198
- const n = t.active ?? "Yes", r$1 = t.inactive ?? "No";
1199
- return new dD({
1200
- active: n,
1201
- inactive: r$1,
1202
- initialValue: t.initialValue ?? !0,
1203
- render() {
1204
- const i = `${import_picocolors.default.gray(o)}
1205
- ${b(this.state)} ${t.message}
1206
- `, s = this.value ? n : r$1;
1207
- switch (this.state) {
1208
- case "submit": return `${i}${import_picocolors.default.gray(o)} ${import_picocolors.default.dim(s)}`;
1209
- case "cancel": return `${i}${import_picocolors.default.gray(o)} ${import_picocolors.default.strikethrough(import_picocolors.default.dim(s))}
1210
- ${import_picocolors.default.gray(o)}`;
1211
- 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$1)}` : `${import_picocolors.default.green(k)} ${r$1}`}
1212
- ${import_picocolors.default.cyan(d)}
1213
- `;
1214
- }
1215
- }
1216
- }).prompt();
1217
- }, ve = (t) => {
1218
- const n = (r$1, i) => {
1219
- const s = r$1.label ?? String(r$1.value);
1220
- switch (i) {
1221
- case "selected": return `${import_picocolors.default.dim(s)}`;
1222
- case "active": return `${import_picocolors.default.green(k)} ${s} ${r$1.hint ? import_picocolors.default.dim(`(${r$1.hint})`) : ""}`;
1223
- case "cancelled": return `${import_picocolors.default.strikethrough(import_picocolors.default.dim(s))}`;
1224
- default: return `${import_picocolors.default.dim(P)} ${import_picocolors.default.dim(s)}`;
1225
- }
1226
- };
1227
- return new LD({
1228
- options: t.options,
1229
- initialValue: t.initialValue,
1230
- render() {
1231
- const r$1 = `${import_picocolors.default.gray(o)}
1232
- ${b(this.state)} ${t.message}
1233
- `;
1234
- switch (this.state) {
1235
- case "submit": return `${r$1}${import_picocolors.default.gray(o)} ${n(this.options[this.cursor], "selected")}`;
1236
- case "cancel": return `${r$1}${import_picocolors.default.gray(o)} ${n(this.options[this.cursor], "cancelled")}
1237
- ${import_picocolors.default.gray(o)}`;
1238
- default: return `${r$1}${import_picocolors.default.cyan(o)} ${G({
1239
- cursor: this.cursor,
1240
- options: this.options,
1241
- maxItems: t.maxItems,
1242
- style: (i, s) => n(i, s ? "active" : "inactive")
1243
- }).join(`
1244
- ${import_picocolors.default.cyan(o)} `)}
1245
- ${import_picocolors.default.cyan(d)}
1246
- `;
1247
- }
1248
- }
1249
- }).prompt();
1250
- }, we = (t) => {
1251
- const n = (r$1, i = "inactive") => {
1252
- const s = r$1.label ?? String(r$1.value);
1253
- 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$1.value} `))} ${s} ${r$1.hint ? import_picocolors.default.dim(`(${r$1.hint})`) : ""}` : `${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(` ${r$1.value} `)))} ${s} ${r$1.hint ? import_picocolors.default.dim(`(${r$1.hint})`) : ""}`;
1254
- };
1255
- return new ID({
1256
- options: t.options,
1257
- initialValue: t.initialValue,
1258
- render() {
1259
- const r$1 = `${import_picocolors.default.gray(o)}
1260
- ${b(this.state)} ${t.message}
1261
- `;
1262
- switch (this.state) {
1263
- case "submit": return `${r$1}${import_picocolors.default.gray(o)} ${n(this.options.find((i) => i.value === this.value) ?? t.options[0], "selected")}`;
1264
- case "cancel": return `${r$1}${import_picocolors.default.gray(o)} ${n(this.options[0], "cancelled")}
1265
- ${import_picocolors.default.gray(o)}`;
1266
- default: return `${r$1}${import_picocolors.default.cyan(o)} ${this.options.map((i, s) => n(i, s === this.cursor ? "active" : "inactive")).join(`
1267
- ${import_picocolors.default.cyan(o)} `)}
1268
- ${import_picocolors.default.cyan(d)}
1269
- `;
1270
- }
1271
- }
1272
- }).prompt();
1273
- }, fe = (t) => {
1274
- const n = (r$1, i) => {
1275
- const s = r$1.label ?? String(r$1.value);
1276
- return i === "active" ? `${import_picocolors.default.cyan(A)} ${s} ${r$1.hint ? import_picocolors.default.dim(`(${r$1.hint})`) : ""}` : i === "selected" ? `${import_picocolors.default.green(T)} ${import_picocolors.default.dim(s)} ${r$1.hint ? import_picocolors.default.dim(`(${r$1.hint})`) : ""}` : i === "cancelled" ? `${import_picocolors.default.strikethrough(import_picocolors.default.dim(s))}` : i === "active-selected" ? `${import_picocolors.default.green(T)} ${s} ${r$1.hint ? import_picocolors.default.dim(`(${r$1.hint})`) : ""}` : i === "submitted" ? `${import_picocolors.default.dim(s)}` : `${import_picocolors.default.dim(F)} ${import_picocolors.default.dim(s)}`;
1277
- };
1278
- return new SD({
1279
- options: t.options,
1280
- initialValues: t.initialValues,
1281
- required: t.required ?? !0,
1282
- cursorAt: t.cursorAt,
1283
- validate(r$1) {
1284
- if (this.required && r$1.length === 0) return `Please select at least one option.
1285
- ${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`))}`;
1286
- },
1287
- render() {
1288
- const r$1 = `${import_picocolors.default.gray(o)}
1289
- ${b(this.state)} ${t.message}
1290
- `, i = (s, c) => {
1291
- const a$1 = this.value.includes(s.value);
1292
- return c && a$1 ? n(s, "active-selected") : a$1 ? n(s, "selected") : n(s, c ? "active" : "inactive");
1293
- };
1294
- switch (this.state) {
1295
- case "submit": return `${r$1}${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")}`;
1296
- case "cancel": {
1297
- const s = this.options.filter(({ value: c }) => this.value.includes(c)).map((c) => n(c, "cancelled")).join(import_picocolors.default.dim(", "));
1298
- return `${r$1}${import_picocolors.default.gray(o)} ${s.trim() ? `${s}
1299
- ${import_picocolors.default.gray(o)}` : ""}`;
1300
- }
1301
- case "error": {
1302
- const s = this.error.split(`
1303
- `).map((c, a$1) => a$1 === 0 ? `${import_picocolors.default.yellow(d)} ${import_picocolors.default.yellow(c)}` : ` ${c}`).join(`
1304
- `);
1305
- return `${r$1 + import_picocolors.default.yellow(o)} ${G({
1306
- options: this.options,
1307
- cursor: this.cursor,
1308
- maxItems: t.maxItems,
1309
- style: i
1310
- }).join(`
1311
- ${import_picocolors.default.yellow(o)} `)}
1312
- ${s}
1313
- `;
1314
- }
1315
- default: return `${r$1}${import_picocolors.default.cyan(o)} ${G({
1316
- options: this.options,
1317
- cursor: this.cursor,
1318
- maxItems: t.maxItems,
1319
- style: i
1320
- }).join(`
1321
- ${import_picocolors.default.cyan(o)} `)}
1322
- ${import_picocolors.default.cyan(d)}
1323
- `;
1324
- }
1325
- }
1326
- }).prompt();
1327
- }, be = (t) => {
1328
- const { selectableGroups: n = !0 } = t, r$1 = (i, s, c = []) => {
1329
- 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} ` : " " : "";
1330
- 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})`) : ""}`;
1331
- if (s === "group-active") return `${p$1}${import_picocolors.default.cyan(A)} ${import_picocolors.default.dim(a$1)}`;
1332
- if (s === "group-active-selected") return `${p$1}${import_picocolors.default.green(T)} ${import_picocolors.default.dim(a$1)}`;
1333
- if (s === "selected") {
1334
- const f = l$1 || n ? import_picocolors.default.green(T) : "";
1335
- return `${import_picocolors.default.dim(p$1)}${f} ${import_picocolors.default.dim(a$1)} ${i.hint ? import_picocolors.default.dim(`(${i.hint})`) : ""}`;
1336
- }
1337
- if (s === "cancelled") return `${import_picocolors.default.strikethrough(import_picocolors.default.dim(a$1))}`;
1338
- 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})`) : ""}`;
1339
- if (s === "submitted") return `${import_picocolors.default.dim(a$1)}`;
1340
- const v$1 = l$1 || n ? import_picocolors.default.dim(F) : "";
1341
- return `${import_picocolors.default.dim(p$1)}${v$1} ${import_picocolors.default.dim(a$1)}`;
1342
- };
1343
- return new _D({
1344
- options: t.options,
1345
- initialValues: t.initialValues,
1346
- required: t.required ?? !0,
1347
- cursorAt: t.cursorAt,
1348
- selectableGroups: n,
1349
- validate(i) {
1350
- if (this.required && i.length === 0) return `Please select at least one option.
1351
- ${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`))}`;
1352
- },
1353
- render() {
1354
- const i = `${import_picocolors.default.gray(o)}
1355
- ${b(this.state)} ${t.message}
1356
- `;
1357
- switch (this.state) {
1358
- case "submit": return `${i}${import_picocolors.default.gray(o)} ${this.options.filter(({ value: s }) => this.value.includes(s)).map((s) => r$1(s, "submitted")).join(import_picocolors.default.dim(", "))}`;
1359
- case "cancel": {
1360
- const s = this.options.filter(({ value: c }) => this.value.includes(c)).map((c) => r$1(c, "cancelled")).join(import_picocolors.default.dim(", "));
1361
- return `${i}${import_picocolors.default.gray(o)} ${s.trim() ? `${s}
1362
- ${import_picocolors.default.gray(o)}` : ""}`;
1363
- }
1364
- case "error": {
1365
- const s = this.error.split(`
1366
- `).map((c, a$1) => a$1 === 0 ? `${import_picocolors.default.yellow(d)} ${import_picocolors.default.yellow(c)}` : ` ${c}`).join(`
1367
- `);
1368
- return `${i}${import_picocolors.default.yellow(o)} ${this.options.map((c, a$1, l$1) => {
1369
- const $$1 = this.value.includes(c.value) || c.group === !0 && this.isGroupSelected(`${c.value}`), g$1 = a$1 === this.cursor;
1370
- return !g$1 && typeof c.group == "string" && this.options[this.cursor].value === c.group ? r$1(c, $$1 ? "group-active-selected" : "group-active", l$1) : g$1 && $$1 ? r$1(c, "active-selected", l$1) : $$1 ? r$1(c, "selected", l$1) : r$1(c, g$1 ? "active" : "inactive", l$1);
1371
- }).join(`
1372
- ${import_picocolors.default.yellow(o)} `)}
1373
- ${s}
1374
- `;
1375
- }
1376
- default: return `${i}${import_picocolors.default.cyan(o)} ${this.options.map((s, c, a$1) => {
1377
- const l$1 = this.value.includes(s.value) || s.group === !0 && this.isGroupSelected(`${s.value}`), $$1 = c === this.cursor;
1378
- return !$$1 && typeof s.group == "string" && this.options[this.cursor].value === s.group ? r$1(s, l$1 ? "group-active-selected" : "group-active", a$1) : $$1 && l$1 ? r$1(s, "active-selected", a$1) : l$1 ? r$1(s, "selected", a$1) : r$1(s, $$1 ? "active" : "inactive", a$1);
1379
- }).join(`
1380
- ${import_picocolors.default.cyan(o)} `)}
1381
- ${import_picocolors.default.cyan(d)}
1382
- `;
1383
- }
1384
- }
1385
- }).prompt();
1386
- }, Me = (t = "", n = "") => {
1387
- const r$1 = `
1388
- ${t}
1389
- `.split(`
1390
- `), i = stripVTControlCharacters(n).length, s = Math.max(r$1.reduce((a$1, l$1) => {
1391
- const $$1 = stripVTControlCharacters(l$1);
1392
- return $$1.length > a$1 ? $$1.length : a$1;
1393
- }, 0), i) + 2, c = r$1.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(`
1394
- `);
1395
- process.stdout.write(`${import_picocolors.default.gray(o)}
1396
- ${import_picocolors.default.green(C)} ${import_picocolors.default.reset(n)} ${import_picocolors.default.gray(_.repeat(Math.max(s - i - 1, 1)) + me)}
1397
- ${c}
1398
- ${import_picocolors.default.gray(de + _.repeat(s + 2) + pe)}
1399
- `);
1400
- }, xe = (t = "") => {
1401
- process.stdout.write(`${import_picocolors.default.gray(d)} ${import_picocolors.default.red(t)}
1402
-
1403
- `);
1404
- }, Ie = (t = "") => {
1405
- process.stdout.write(`${import_picocolors.default.gray(ue)} ${t}
1406
- `);
1407
- }, Se = (t = "") => {
1408
- process.stdout.write(`${import_picocolors.default.gray(o)}
1409
- ${import_picocolors.default.gray(d)} ${t}
1410
-
1411
- `);
1412
- }, M = {
1413
- message: (t = "", { symbol: n = import_picocolors.default.gray(o) } = {}) => {
1414
- const r$1 = [`${import_picocolors.default.gray(o)}`];
1415
- if (t) {
1416
- const [i, ...s] = t.split(`
1417
- `);
1418
- r$1.push(`${n} ${i}`, ...s.map((c) => `${import_picocolors.default.gray(o)} ${c}`));
1419
- }
1420
- process.stdout.write(`${r$1.join(`
1421
- `)}
1422
- `);
1423
- },
1424
- info: (t) => {
1425
- M.message(t, { symbol: import_picocolors.default.blue(q) });
1426
- },
1427
- success: (t) => {
1428
- M.message(t, { symbol: import_picocolors.default.green(D) });
1429
- },
1430
- step: (t) => {
1431
- M.message(t, { symbol: import_picocolors.default.green(C) });
1432
- },
1433
- warn: (t) => {
1434
- M.message(t, { symbol: import_picocolors.default.yellow(U) });
1435
- },
1436
- warning: (t) => {
1437
- M.warn(t);
1438
- },
1439
- error: (t) => {
1440
- M.message(t, { symbol: import_picocolors.default.red(K) });
1441
- }
1442
- }, J = `${import_picocolors.default.gray(o)} `, x = {
1443
- message: async (t, { symbol: n = import_picocolors.default.gray(o) } = {}) => {
1444
- process.stdout.write(`${import_picocolors.default.gray(o)}
1445
- ${n} `);
1446
- let r$1 = 3;
1447
- for await (let i of t) {
1448
- i = i.replace(/\n/g, `
1449
- ${J}`), i.includes(`
1450
- `) && (r$1 = 3 + stripVTControlCharacters(i.slice(i.lastIndexOf(`
1451
- `))).length);
1452
- const s = stripVTControlCharacters(i).length;
1453
- r$1 + s < process.stdout.columns ? (r$1 += s, process.stdout.write(i)) : (process.stdout.write(`
1454
- ${J}${i.trimStart()}`), r$1 = 3 + stripVTControlCharacters(i.trimStart()).length);
1455
- }
1456
- process.stdout.write(`
1457
- `);
1458
- },
1459
- info: (t) => x.message(t, { symbol: import_picocolors.default.blue(q) }),
1460
- success: (t) => x.message(t, { symbol: import_picocolors.default.green(D) }),
1461
- step: (t) => x.message(t, { symbol: import_picocolors.default.green(C) }),
1462
- warn: (t) => x.message(t, { symbol: import_picocolors.default.yellow(U) }),
1463
- warning: (t) => x.warn(t),
1464
- error: (t) => x.message(t, { symbol: import_picocolors.default.red(K) })
1465
- }, Y = ({ indicator: t = "dots" } = {}) => {
1466
- const n = V ? [
1467
- "◒",
1468
- "◐",
1469
- "◓",
1470
- "◑"
1471
- ] : [
1472
- "•",
1473
- "o",
1474
- "O",
1475
- "0"
1476
- ], r$1 = V ? 80 : 120, i = process.env.CI === "true";
1477
- let s, c, a$1 = !1, l$1 = "", $$1, g$1 = performance.now();
1478
- const p$1 = (m$1) => {
1479
- a$1 && N$1(m$1 > 1 ? "Something went wrong" : "Canceled", m$1);
1480
- }, v$1 = () => p$1(2), f = () => p$1(1), j = () => {
1481
- process.on("uncaughtExceptionMonitor", v$1), process.on("unhandledRejection", v$1), process.on("SIGINT", f), process.on("SIGTERM", f), process.on("exit", p$1);
1482
- }, E = () => {
1483
- process.removeListener("uncaughtExceptionMonitor", v$1), process.removeListener("unhandledRejection", v$1), process.removeListener("SIGINT", f), process.removeListener("SIGTERM", f), process.removeListener("exit", p$1);
1484
- }, B$1 = () => {
1485
- if ($$1 === void 0) return;
1486
- i && process.stdout.write(`
1487
- `);
1488
- const m$1 = $$1.split(`
1489
- `);
1490
- process.stdout.write(import_src.cursor.move(-999, m$1.length - 1)), process.stdout.write(import_src.erase.down(m$1.length));
1491
- }, R$1 = (m$1) => m$1.replace(/\.+$/, ""), O$1 = (m$1) => {
1492
- const h$1 = (performance.now() - m$1) / 1e3, w$1 = Math.floor(h$1 / 60), I$1 = Math.floor(h$1 % 60);
1493
- return w$1 > 0 ? `[${w$1}m ${I$1}s]` : `[${I$1}s]`;
1494
- }, H$1 = (m$1 = "") => {
1495
- a$1 = !0, s = fD(), l$1 = R$1(m$1), g$1 = performance.now(), process.stdout.write(`${import_picocolors.default.gray(o)}
1496
- `);
1497
- let h$1 = 0, w$1 = 0;
1498
- j(), c = setInterval(() => {
1499
- if (i && l$1 === $$1) return;
1500
- B$1(), $$1 = l$1;
1501
- const I$1 = import_picocolors.default.magenta(n[h$1]);
1502
- if (i) process.stdout.write(`${I$1} ${l$1}...`);
1503
- else if (t === "timer") process.stdout.write(`${I$1} ${l$1} ${O$1(g$1)}`);
1504
- else {
1505
- const z$1 = ".".repeat(Math.floor(w$1)).slice(0, 3);
1506
- process.stdout.write(`${I$1} ${l$1}${z$1}`);
1507
- }
1508
- h$1 = h$1 + 1 < n.length ? h$1 + 1 : 0, w$1 = w$1 < n.length ? w$1 + .125 : 0;
1509
- }, r$1);
1510
- }, N$1 = (m$1 = "", h$1 = 0) => {
1511
- a$1 = !1, clearInterval(c), B$1();
1512
- const w$1 = h$1 === 0 ? import_picocolors.default.green(C) : h$1 === 1 ? import_picocolors.default.red(L) : import_picocolors.default.red(W);
1513
- l$1 = R$1(m$1 ?? l$1), t === "timer" ? process.stdout.write(`${w$1} ${l$1} ${O$1(g$1)}
1514
- `) : process.stdout.write(`${w$1} ${l$1}
1515
- `), E(), s();
1516
- };
1517
- return {
1518
- start: H$1,
1519
- stop: N$1,
1520
- message: (m$1 = "") => {
1521
- l$1 = R$1(m$1 ?? l$1);
1522
- }
1523
- };
1524
- }, Ce = async (t, n) => {
1525
- const r$1 = {}, i = Object.keys(t);
1526
- for (const s of i) {
1527
- const c = t[s], a$1 = await c({ results: r$1 })?.catch((l$1) => {
1528
- throw l$1;
1529
- });
1530
- if (typeof n?.onCancel == "function" && pD(a$1)) {
1531
- r$1[s] = "canceled", n.onCancel({ results: r$1 });
1532
- continue;
1533
- }
1534
- r$1[s] = a$1;
1535
- }
1536
- return r$1;
1537
- }, Te = async (t) => {
1538
- for (const n of t) {
1539
- if (n.enabled === !1) continue;
1540
- const r$1 = Y();
1541
- r$1.start(n.title);
1542
- const i = await n.task(r$1.message);
1543
- r$1.stop(i || n.title);
1544
- }
1545
- };
1546
-
1547
- //#endregion
1548
- //#region ../../node_modules/.pnpm/ansis@4.2.0/node_modules/ansis/index.cjs
1549
- var require_ansis = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1550
- let e, t, r, { defineProperty: l, setPrototypeOf: n, create: o, keys: s } = Object, i = "", { round: c, max: a } = Math, p = (e$1) => {
1551
- let t = /([a-f\d]{3,6})/i.exec(e$1)?.[1], r$1 = t?.length, l$1 = parseInt(6 ^ r$1 ? 3 ^ r$1 ? "0" : t[0] + t[0] + t[1] + t[1] + t[2] + t[2] : t, 16);
1552
- return [
1553
- l$1 >> 16 & 255,
1554
- l$1 >> 8 & 255,
1555
- 255 & l$1
1556
- ];
1557
- }, u = (e$1, t, r$1) => e$1 ^ t || t ^ r$1 ? 16 + 36 * c(e$1 / 51) + 6 * c(t / 51) + c(r$1 / 51) : 8 > e$1 ? 16 : e$1 > 248 ? 231 : c(24 * (e$1 - 8) / 247) + 232, d = (e$1) => {
1558
- let t, r$1, l$1, n, o$1;
1559
- 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$1 = (o$1 / 6 | 0) / 5, l$1 = o$1 % 6 / 5) : t = r$1 = l$1 = (10 * (e$1 - 232) + 8) / 255, n = 2 * a(t, r$1, l$1), n ? 30 + (c(l$1) << 2 | c(r$1) << 1 | c(t)) + (2 ^ n ? 0 : 60) : 30);
1560
- }, f = (() => {
1561
- let r$1 = (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;
1562
- try {
1563
- e = "," + s(i).join(",");
1564
- } catch (e$1) {
1565
- i = {}, c = 0;
1566
- }
1567
- let a$1 = "FORCE_COLOR", p$1 = {
1568
- false: 0,
1569
- 0: 0,
1570
- 1: 1,
1571
- 2: 2,
1572
- 3: 3
1573
- }[i[a$1]] ?? -1, u$1 = a$1 in i && p$1 || r$1(/^--color=?(true|always)?$/);
1574
- return u$1 && (c = p$1), ~c || (c = ((r$2, l$2, n$1) => (t = r$2.TERM, {
1575
- "24bit": 3,
1576
- truecolor: 3,
1577
- ansi256: 2,
1578
- ansi: 1
1579
- }[r$2.COLORTERM] || (r$2.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$1(/^--(no-color|color=(false|never))$/) ? 0 : l$1.window?.chrome || u$1 && !c ? 3 : c;
1580
- })(), g = {
1581
- open: i,
1582
- close: i
1583
- }, h = 39, b = 49, O = {}, m = ({ p: e$1 }, { open: t, close: l$1 }) => {
1584
- let o$1 = (e$2, ...r$1) => {
1585
- if (!e$2) {
1586
- if (t && t === l$1) return t;
1587
- if ((e$2 ?? i) === i) return i;
1588
- }
1589
- let n, s$1 = e$2.raw ? String.raw({ raw: e$2 }, ...r$1) : i + e$2, c$1 = o$1.p, a$1 = c$1.o, p$1 = c$1.c;
1590
- if (s$1.includes("\x1B")) for (; c$1; c$1 = c$1.p) {
1591
- let { open: e$3, close: t$1 } = c$1, r$2 = t$1.length, l$2 = i, o$2 = 0;
1592
- if (r$2) for (; ~(n = s$1.indexOf(t$1, o$2)); o$2 = n + r$2) l$2 += s$1.slice(o$2, n) + e$3;
1593
- s$1 = l$2 + s$1.slice(o$2);
1594
- }
1595
- return a$1 + (s$1.includes("\n") ? s$1.replace(/(\r?\n)/g, p$1 + "$1" + a$1) : s$1) + p$1;
1596
- }, s = t, c = l$1;
1597
- return e$1 && (s = e$1.o + t, c = l$1 + e$1.c), n(o$1, r), o$1.p = {
1598
- open: t,
1599
- close: l$1,
1600
- o: s,
1601
- c,
1602
- p: e$1
1603
- }, o$1.open = s, o$1.close = c, o$1;
1604
- };
1605
- const w = new function e$1(t = f) {
1606
- let s = {
1607
- Ansis: e$1,
1608
- level: t,
1609
- isSupported: () => a$1,
1610
- strip: (e$2) => e$2.replace(/[›][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, i),
1611
- extend(e$2) {
1612
- for (let t$1 in e$2) {
1613
- let r$1 = e$2[t$1], l$1 = (typeof r$1)[0];
1614
- "s" === l$1 ? (c(t$1, T$2(...p(r$1))), c(_$2(t$1), v$1(...p(r$1)))) : c(t$1, r$1, "f" === l$1);
1615
- }
1616
- return r = o({}, O), n(s, r), s;
1617
- }
1618
- }, c = (e$2, t$1, r$1) => {
1619
- O[e$2] = { get() {
1620
- let n = r$1 ? (...e$3) => m(this, t$1(...e$3)) : m(this, t$1);
1621
- return l(this, e$2, { value: n }), n;
1622
- } };
1623
- }, a$1 = t > 0, w$1 = (e$2, t$1) => a$1 ? {
1624
- open: `[${e$2}m`,
1625
- close: `[${t$1}m`
1626
- } : g, y$1 = (e$2) => (t$1) => e$2(...p(t$1)), R$1 = (e$2, t$1) => (r$1, l$1, n) => w$1(`${e$2}8;2;${r$1};${l$1};${n}`, t$1), $$1 = (e$2, t$1) => (r$1, l$1, n) => w$1(((e$3, t$2, r$2) => d(u(e$3, t$2, r$2)))(r$1, l$1, n) + e$2, t$1), x$2 = (e$2) => (t$1, r$1, l$1) => e$2(u(t$1, r$1, 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);
1627
- 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));
1628
- let M$1, I$1 = {
1629
- fg: C$1,
1630
- bg: E,
1631
- rgb: T$2,
1632
- bgRgb: v$1,
1633
- hex: y$1(T$2),
1634
- bgHex: y$1(v$1),
1635
- visible: g,
1636
- reset: w$1(0, 0),
1637
- bold: w$1(1, 22),
1638
- dim: w$1(2, 22),
1639
- italic: w$1(3, 23),
1640
- underline: w$1(4, 24),
1641
- inverse: w$1(7, 27),
1642
- hidden: w$1(8, 28),
1643
- strikethrough: w$1(9, 29)
1644
- }, _$2 = (e$2) => "bg" + e$2[0].toUpperCase() + e$2.slice(1), k$2 = "Bright";
1645
- return "black,red,green,yellow,blue,magenta,cyan,white,gray".split(",").map(((e$2, t$1) => {
1646
- M$1 = _$2(e$2), 8 > t$1 ? (I$1[e$2 + k$2] = w$1(90 + t$1, h), I$1[M$1 + k$2] = w$1(100 + t$1, b)) : t$1 = 60, I$1[e$2] = w$1(30 + t$1, h), I$1[M$1] = w$1(40 + t$1, b);
1647
- })), s.extend(I$1);
1648
- }();
1649
- module.exports = w, w.default = w;
1650
- }));
1651
-
1652
- //#endregion
1653
- //#region ../../node_modules/.pnpm/ansis@4.2.0/node_modules/ansis/index.mjs
1654
- var import_ansis = /* @__PURE__ */ __toESM(require_ansis(), 1);
1655
- var ansis_default = import_ansis.default;
1656
- const { Ansis, fg, bg, rgb, bgRgb, hex, bgHex, reset, inverse, hidden, visible, bold, dim, italic, underline, strikethrough, black, red, green, yellow, blue, magenta, cyan, white, gray, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright } = import_ansis.default;
1657
-
1658
- //#endregion
1659
- //#region src/node/context-internal.ts
1660
- const internalContextMap = /* @__PURE__ */ new WeakMap();
1661
- function getInternalContext(context) {
1662
- if (!internalContextMap.has(context)) {
1663
- const internalContext = { storage: { auth: createStorage({
1664
- filepath: join(context.workspaceRoot, "node_modules/.vite/devtools/auth.json"),
1665
- initialValue: { trusted: {} }
1666
- }) } };
1667
- internalContextMap.set(context, internalContext);
1668
- }
1669
- return internalContextMap.get(context);
1670
- }
1671
-
1672
- //#endregion
1673
- //#region src/node/rpc/anonymous/auth.ts
1674
- const anonymousAuth = defineRpcFunction({
1675
- name: "vite:anonymous:auth",
1676
- type: "action",
1677
- setup: (context) => {
1678
- const storage = getInternalContext(context).storage.auth;
1679
- return { handler: async (query) => {
1680
- const session = context.rpc.getCurrentRpcSession();
1681
- if (!session) throw new Error("Failed to retrieve the current RPC session");
1682
- if (session.meta.isTrusted || storage.value().trusted[query.authId]) {
1683
- session.meta.clientAuthId = query.authId;
1684
- session.meta.isTrusted = true;
1685
- return { isTrusted: true };
1686
- }
1687
- const message = [
1688
- `A browser is requesting permissions to connect to the Vite DevTools.`,
1689
- "",
1690
- `User Agent: ${ansis_default.yellow(ansis_default.bold(query.ua || "Unknown"))}`,
1691
- `Origin : ${ansis_default.cyan(ansis_default.bold(query.origin || "Unknown"))}`,
1692
- `Identifier: ${ansis_default.green(ansis_default.bold(query.authId))}`,
1693
- "",
1694
- "This will allow the browser to interact with the server, make file changes and run commands.",
1695
- ansis_default.red(ansis_default.bold("You should only trust your local development browsers."))
1696
- ];
1697
- Me(ansis_default.reset(message.join("\n")), ansis_default.bold(ansis_default.yellow(" Vite DevTools Permission Request ")));
1698
- if (await ye({
1699
- message: ansis_default.bold(`Do you trust this client (${ansis_default.green(ansis_default.bold(query.authId))})?`),
1700
- initialValue: false
1701
- })) {
1702
- storage.mutate((state) => {
1703
- state.trusted[query.authId] = {
1704
- authId: query.authId,
1705
- ua: query.ua,
1706
- origin: query.origin,
1707
- timestamp: Date.now()
1708
- };
1709
- });
1710
- session.meta.clientAuthId = query.authId;
1711
- session.meta.isTrusted = true;
1712
- Se(ansis_default.green(ansis_default.bold(`You have granted permissions to ${ansis_default.bold(query.authId)}`)));
1713
- return { isTrusted: true };
1714
- }
1715
- Se(ansis_default.red(ansis_default.bold(`You have denied permissions to ${ansis_default.bold(query.authId)}`)));
1716
- return { isTrusted: false };
1717
- } };
1718
- }
1719
- });
1720
-
1721
- //#endregion
1722
- //#region src/node/rpc/internal/docks-on-launch.ts
1723
- const docksOnLaunch = defineRpcFunction({
1724
- name: "devtoolskit:internal:docks:on-launch",
1725
- type: "action",
1726
- setup: (context) => {
1727
- const launchMap = /* @__PURE__ */ new Map();
1728
- return { handler: async (entryId) => {
1729
- if (launchMap.has(entryId)) return launchMap.get(entryId);
1730
- const entry = context.docks.values().find((entry$1) => entry$1.id === entryId);
1731
- if (!entry) throw new Error(`Dock entry with id "${entryId}" not found`);
1732
- if (entry.type !== "launcher") throw new Error(`Dock entry with id "${entryId}" is not a launcher`);
1733
- try {
1734
- context.docks.update({
1735
- ...entry,
1736
- launcher: {
1737
- ...entry.launcher,
1738
- status: "loading"
1739
- }
1740
- });
1741
- const promise = entry.launcher.onLaunch();
1742
- launchMap.set(entryId, promise);
1743
- const result = await promise;
1744
- const newEntry = context.docks.values().find((entry$1) => entry$1.id === entryId) || entry;
1745
- if (newEntry.type === "launcher") context.docks.update({
1746
- ...newEntry,
1747
- launcher: {
1748
- ...newEntry.launcher,
1749
- status: "success"
1750
- }
1751
- });
1752
- return result;
1753
- } catch (error) {
1754
- console.error(`[VITE DEVTOOLS] Error launching dock entry "${entryId}"`, error);
1755
- context.docks.update({
1756
- ...entry,
1757
- launcher: {
1758
- ...entry.launcher,
1759
- status: "error",
1760
- error: error instanceof Error ? error.message : String(error)
1761
- }
1762
- });
1763
- }
1764
- } };
1765
- }
1766
- });
1767
-
1768
- //#endregion
1769
- //#region src/node/rpc/internal/rpc-server-list.ts
1770
- const rpcServerList = defineRpcFunction({
1771
- name: "devtoolskit:internal:rpc:server:list",
1772
- type: "static",
1773
- setup: (context) => {
1774
- return { async handler() {
1775
- return Object.fromEntries(Array.from(context.rpc.definitions.entries()).map(([name, fn]) => [name, { type: fn.type }]));
1776
- } };
1777
- }
1778
- });
1779
-
1780
- //#endregion
1781
- //#region src/node/rpc/internal/state/get.ts
1782
- const sharedStateGet = defineRpcFunction({
1783
- name: "devtoolskit:internal:rpc:server-state:get",
1784
- type: "query",
1785
- setup: (context) => {
1786
- return { handler: async (key) => {
1787
- return (await context.rpc.sharedState.get(key)).value();
1788
- } };
1789
- }
1790
- });
1791
-
1792
- //#endregion
1793
- //#region src/node/rpc/internal/state/patch.ts
1794
- const sharedStatePatch = defineRpcFunction({
1795
- name: "devtoolskit:internal:rpc:server-state:patch",
1796
- type: "query",
1797
- setup: (context) => {
1798
- return { handler: async (key, patches, syncId) => {
1799
- (await context.rpc.sharedState.get(key)).patch(patches, syncId);
1800
- } };
1801
- }
1802
- });
1803
-
1804
- //#endregion
1805
- //#region src/node/rpc/internal/state/set.ts
1806
- const sharedStateSet = defineRpcFunction({
1807
- name: "devtoolskit:internal:rpc:server-state:set",
1808
- type: "query",
1809
- setup: (context) => {
1810
- return { handler: async (key, value, syncId) => {
1811
- (await context.rpc.sharedState.get(key)).mutate(() => value, syncId);
1812
- } };
1813
- }
1814
- });
1815
-
1816
- //#endregion
1817
- //#region src/node/rpc/internal/state/subscribe.ts
1818
- const debug = createDebug("vite:devtools:rpc:state:subscribe");
1819
- const sharedStateSubscribe = defineRpcFunction({
1820
- name: "devtoolskit:internal:rpc:server-state:subscribe",
1821
- type: "event",
1822
- setup: (context) => {
1823
- return { handler: async (key) => {
1824
- const session = context.rpc.getCurrentRpcSession();
1825
- if (!session) return;
1826
- debug("subscribe", {
1827
- key,
1828
- session: session.meta.id
1829
- });
1830
- session.meta.subscribedStates.add(key);
1831
- } };
1832
- }
1833
- });
1834
-
1835
- //#endregion
1836
- //#region src/node/rpc/internal/terminals-list.ts
1837
- const terminalsList = defineRpcFunction({
1838
- name: "devtoolskit:internal:terminals:list",
1839
- type: "static",
1840
- setup: (context) => {
1841
- return { async handler() {
1842
- return Array.from(context.terminals.sessions.values()).map((i) => {
1843
- return {
1844
- id: i.id,
1845
- title: i.title,
1846
- description: i.description,
1847
- status: i.status
1848
- };
1849
- });
1850
- } };
1851
- }
1852
- });
1853
-
1854
- //#endregion
1855
- //#region src/node/rpc/internal/terminals-read.ts
1856
- const terminalsRead = defineRpcFunction({
1857
- name: "devtoolskit:internal:terminals:read",
1858
- type: "query",
1859
- setup: (context) => {
1860
- return { async handler(id) {
1861
- const session = context.terminals.sessions.get(id);
1862
- if (!session) throw new Error(`Terminal session with id "${id}" not found`);
1863
- return {
1864
- buffer: session.buffer ?? [],
1865
- ts: Date.now()
1866
- };
1867
- } };
1868
- }
1869
- });
1870
-
1871
- //#endregion
1872
- //#region src/node/rpc/public/open-in-editor.ts
1873
- const openInEditor = defineRpcFunction({
1874
- name: "vite:core:open-in-editor",
1875
- type: "action",
1876
- setup: () => {
1877
- return { handler: async (path) => {
1878
- await import("launch-editor").then((r$1) => r$1.default(path));
1879
- } };
1880
- }
1881
- });
1882
-
1883
- //#endregion
1884
- //#region src/node/rpc/public/open-in-finder.ts
1885
- const openInFinder = defineRpcFunction({
1886
- name: "vite:core:open-in-finder",
1887
- type: "action",
1888
- setup: () => {
1889
- return { handler: async (path) => {
1890
- await import("open").then((r$1) => r$1.default(path));
1891
- } };
1892
- }
1893
- });
1894
-
1895
- //#endregion
1896
- //#region src/node/rpc/index.ts
1897
- const builtinPublicRpcDeclarations = [openInEditor, openInFinder];
1898
- const builtinAnonymousRpcDeclarations = [anonymousAuth];
1899
- const builtinInternalRpcDeclarations = [
1900
- docksOnLaunch,
1901
- rpcServerList,
1902
- sharedStateGet,
1903
- sharedStatePatch,
1904
- sharedStateSet,
1905
- sharedStateSubscribe,
1906
- terminalsList,
1907
- terminalsRead
1908
- ];
1909
- const builtinRpcDeclarations = [
1910
- ...builtinPublicRpcDeclarations,
1911
- ...builtinAnonymousRpcDeclarations,
1912
- ...builtinInternalRpcDeclarations
1913
- ];
1914
-
1915
- //#endregion
1916
- //#region src/node/context.ts
1917
- const debugSetup = createDebug("vite:devtools:context:setup");
1918
- async function createDevToolsContext(viteConfig, viteServer) {
1919
- const cwd = viteConfig.root;
1920
- const context = {
1921
- cwd,
1922
- workspaceRoot: searchForWorkspaceRoot(cwd) ?? cwd,
1923
- viteConfig,
1924
- viteServer,
1925
- mode: viteConfig.command === "serve" ? "dev" : "build",
1926
- rpc: void 0,
1927
- docks: void 0,
1928
- views: void 0,
1929
- utils: ContextUtils,
1930
- terminals: void 0
1931
- };
1932
- const rpcHost = new RpcFunctionsHost(context);
1933
- const docksHost = new DevToolsDockHost(context);
1934
- const viewsHost = new DevToolsViewHost(context);
1935
- const terminalsHost = new DevToolsTerminalHost(context);
1936
- context.rpc = rpcHost;
1937
- context.docks = docksHost;
1938
- context.views = viewsHost;
1939
- context.terminals = terminalsHost;
1940
- for (const fn of builtinRpcDeclarations) rpcHost.register(fn);
1941
- await docksHost.init();
1942
- const docksSharedState = await rpcHost.sharedState.get("devtoolskit:internal:docks", { initialValue: [] });
1943
- docksHost.events.on("dock:entry:updated", debounce(() => {
1944
- docksSharedState.mutate(() => context.docks.values());
1945
- }, 10));
1946
- terminalsHost.events.on("terminal:session:updated", debounce(() => {
1947
- rpcHost.broadcast({
1948
- method: "devtoolskit:internal:terminals:updated",
1949
- args: []
1950
- });
1951
- docksSharedState.mutate(() => context.docks.values());
1952
- }, 10));
1953
- terminalsHost.events.on("terminal:session:stream-chunk", (data) => {
1954
- rpcHost.broadcast({
1955
- method: "devtoolskit:internal:terminals:stream-chunk",
1956
- args: [data]
1957
- });
1958
- });
1959
- const plugins = viteConfig.plugins.filter((plugin) => "devtools" in plugin);
1960
- for (const plugin of plugins) {
1961
- if (!plugin.devtools?.setup) continue;
1962
- try {
1963
- debugSetup(`setting up plugin ${JSON.stringify(plugin.name)}`);
1964
- await plugin.devtools?.setup?.(context);
1965
- } catch (error) {
1966
- console.error(`[Vite DevTools] Error setting up plugin ${plugin.name}:`, error);
1967
- throw error;
1968
- }
1969
- }
1970
- return context;
1971
- }
1972
-
1973
- //#endregion
1974
- //#region src/node/plugins/injection.ts
1975
- function DevToolsInjection() {
1976
- return {
1977
- name: "vite:devtools:injection",
1978
- enforce: "post",
1979
- transformIndexHtml() {
1980
- return [{
1981
- tag: "script",
1982
- attrs: {
1983
- src: `/@fs/${process$1.env.VITE_DEVTOOLS_LOCAL_DEV ? normalizePath(join$1(dirDist, "..", "src/client/inject/index.ts")) : normalizePath(join$1(dirDist, "client/inject.js"))}`,
1984
- type: "module"
1985
- },
1986
- injectTo: "body"
1987
- }];
1988
- }
1989
- };
1990
- }
1991
-
1992
- //#endregion
1993
- //#region ../../node_modules/.pnpm/get-port-please@3.2.0/node_modules/get-port-please/dist/index.mjs
1994
- const unsafePorts = /* @__PURE__ */ new Set([
1995
- 1,
1996
- 7,
1997
- 9,
1998
- 11,
1999
- 13,
2000
- 15,
2001
- 17,
2002
- 19,
2003
- 20,
2004
- 21,
2005
- 22,
2006
- 23,
2007
- 25,
2008
- 37,
2009
- 42,
2010
- 43,
2011
- 53,
2012
- 69,
2013
- 77,
2014
- 79,
2015
- 87,
2016
- 95,
2017
- 101,
2018
- 102,
2019
- 103,
2020
- 104,
2021
- 109,
2022
- 110,
2023
- 111,
2024
- 113,
2025
- 115,
2026
- 117,
2027
- 119,
2028
- 123,
2029
- 135,
2030
- 137,
2031
- 139,
2032
- 143,
2033
- 161,
2034
- 179,
2035
- 389,
2036
- 427,
2037
- 465,
2038
- 512,
2039
- 513,
2040
- 514,
2041
- 515,
2042
- 526,
2043
- 530,
2044
- 531,
2045
- 532,
2046
- 540,
2047
- 548,
2048
- 554,
2049
- 556,
2050
- 563,
2051
- 587,
2052
- 601,
2053
- 636,
2054
- 989,
2055
- 990,
2056
- 993,
2057
- 995,
2058
- 1719,
2059
- 1720,
2060
- 1723,
2061
- 2049,
2062
- 3659,
2063
- 4045,
2064
- 5060,
2065
- 5061,
2066
- 6e3,
2067
- 6566,
2068
- 6665,
2069
- 6666,
2070
- 6667,
2071
- 6668,
2072
- 6669,
2073
- 6697,
2074
- 10080
2075
- ]);
2076
- function isUnsafePort(port) {
2077
- return unsafePorts.has(port);
2078
- }
2079
- function isSafePort(port) {
2080
- return !isUnsafePort(port);
2081
- }
2082
- var GetPortError = class extends Error {
2083
- constructor(message, opts) {
2084
- super(message, opts);
2085
- this.message = message;
2086
- }
2087
- name = "GetPortError";
2088
- };
2089
- function _log(verbose, message) {
2090
- if (verbose) console.log(`[get-port] ${message}`);
2091
- }
2092
- function _generateRange(from, to) {
2093
- if (to < from) return [];
2094
- const r$1 = [];
2095
- for (let index = from; index <= to; index++) r$1.push(index);
2096
- return r$1;
2097
- }
2098
- function _tryPort(port, host) {
2099
- return new Promise((resolve$1) => {
2100
- const server = createServer();
2101
- server.unref();
2102
- server.on("error", () => {
2103
- resolve$1(false);
2104
- });
2105
- server.listen({
2106
- port,
2107
- host
2108
- }, () => {
2109
- const { port: port2 } = server.address();
2110
- server.close(() => {
2111
- resolve$1(isSafePort(port2) && port2);
2112
- });
2113
- });
2114
- });
2115
- }
2116
- function _getLocalHosts(additional) {
2117
- const hosts = new Set(additional);
2118
- for (const _interface of Object.values(networkInterfaces())) for (const config of _interface || []) if (config.address && !config.internal && !config.address.startsWith("fe80::") && !config.address.startsWith("169.254")) hosts.add(config.address);
2119
- return [...hosts];
2120
- }
2121
- async function _findPort(ports, host) {
2122
- for (const port of ports) {
2123
- const r$1 = await _tryPort(port, host);
2124
- if (r$1) return r$1;
2125
- }
2126
- }
2127
- function _fmtOnHost(hostname) {
2128
- return hostname ? `on host ${JSON.stringify(hostname)}` : "on any host";
2129
- }
2130
- const HOSTNAME_RE = /^(?!-)[\d.:A-Za-z-]{1,63}(?<!-)$/;
2131
- function _validateHostname(hostname, _public, verbose) {
2132
- if (hostname && !HOSTNAME_RE.test(hostname)) {
2133
- const fallbackHost = _public ? "0.0.0.0" : "127.0.0.1";
2134
- _log(verbose, `Invalid hostname: ${JSON.stringify(hostname)}. Using ${JSON.stringify(fallbackHost)} as fallback.`);
2135
- return fallbackHost;
2136
- }
2137
- return hostname;
2138
- }
2139
- async function getPort(_userOptions = {}) {
2140
- if (typeof _userOptions === "number" || typeof _userOptions === "string") _userOptions = { port: Number.parseInt(_userOptions + "") || 0 };
2141
- const _port = Number(_userOptions.port ?? process.env.PORT);
2142
- const _userSpecifiedAnyPort = Boolean(_userOptions.port || _userOptions.ports?.length || _userOptions.portRange?.length);
2143
- const options = {
2144
- random: _port === 0,
2145
- ports: [],
2146
- portRange: [],
2147
- alternativePortRange: _userSpecifiedAnyPort ? [] : [3e3, 3100],
2148
- verbose: false,
2149
- ..._userOptions,
2150
- port: _port,
2151
- host: _validateHostname(_userOptions.host ?? process.env.HOST, _userOptions.public, _userOptions.verbose)
2152
- };
2153
- if (options.random && !_userSpecifiedAnyPort) return getRandomPort(options.host);
2154
- const portsToCheck = [
2155
- options.port,
2156
- ...options.ports,
2157
- ..._generateRange(...options.portRange)
2158
- ].filter((port) => {
2159
- if (!port) return false;
2160
- if (!isSafePort(port)) {
2161
- _log(options.verbose, `Ignoring unsafe port: ${port}`);
2162
- return false;
2163
- }
2164
- return true;
2165
- });
2166
- if (portsToCheck.length === 0) portsToCheck.push(3e3);
2167
- let availablePort = await _findPort(portsToCheck, options.host);
2168
- if (!availablePort && options.alternativePortRange.length > 0) {
2169
- availablePort = await _findPort(_generateRange(...options.alternativePortRange), options.host);
2170
- if (portsToCheck.length > 0) {
2171
- let message = `Unable to find an available port (tried ${portsToCheck.join("-")} ${_fmtOnHost(options.host)}).`;
2172
- if (availablePort) message += ` Using alternative port ${availablePort}.`;
2173
- _log(options.verbose, message);
2174
- }
2175
- }
2176
- if (!availablePort && _userOptions.random !== false) {
2177
- availablePort = await getRandomPort(options.host);
2178
- if (availablePort) _log(options.verbose, `Using random port ${availablePort}`);
2179
- }
2180
- if (!availablePort) {
2181
- const triedRanges = [
2182
- options.port,
2183
- options.portRange.join("-"),
2184
- options.alternativePortRange.join("-")
2185
- ].filter(Boolean).join(", ");
2186
- throw new GetPortError(`Unable to find an available port ${_fmtOnHost(options.host)} (tried ${triedRanges})`);
2187
- }
2188
- return availablePort;
2189
- }
2190
- async function getRandomPort(host) {
2191
- const port = await checkPort(0, host);
2192
- if (port === false) throw new GetPortError(`Unable to find a random port ${_fmtOnHost(host)}`);
2193
- return port;
2194
- }
2195
- async function checkPort(port, host = process.env.HOST, verbose) {
2196
- if (!host) host = _getLocalHosts([void 0, "0.0.0.0"]);
2197
- if (!Array.isArray(host)) return _tryPort(port, host);
2198
- for (const _host of host) {
2199
- const _port = await _tryPort(port, _host);
2200
- if (_port === false) {
2201
- if (port < 1024 && verbose) _log(verbose, `Unable to listen to the privileged port ${port} ${_fmtOnHost(_host)}`);
2202
- return false;
2203
- }
2204
- if (port === 0 && _port !== 0) port = _port;
2205
- }
2206
- return port;
2207
- }
2208
-
2209
- //#endregion
2210
- //#region src/node/constants.ts
2211
- const MARK_CHECK = ansis_default.green("✔");
2212
- const MARK_INFO = ansis_default.blue("ℹ");
2213
- const MARK_ERROR = ansis_default.red("✖");
2214
- const MARK_NODE = "⬢";
2215
-
2216
- //#endregion
2217
- //#region src/node/ws.ts
2218
- const debugInvoked = createDebug("vite:devtools:rpc:invoked");
2219
- const ANONYMOUS_SCOPE = "vite:anonymous:";
2220
- async function createWsServer(options) {
2221
- const rpcHost = options.context.rpc;
2222
- const port = options.portWebSocket ?? await getPort({
2223
- port: 7812,
2224
- random: true
2225
- });
2226
- const host = options.hostWebSocket ?? "localhost";
2227
- const wsClients = /* @__PURE__ */ new Set();
2228
- const context = options.context;
2229
- const contextInternal = getInternalContext(context);
2230
- const isClientAuthDisabled = context.mode === "build" || context.viteConfig.devtools?.clientAuth === false || process$1.env.VITE_DEVTOOLS_DISABLE_CLIENT_AUTH === "true";
2231
- if (isClientAuthDisabled) console.warn("[Vite DevTools] Client authentication is disabled. Any browser can connect to the devtools and access to your server and filesystem.");
2232
- const preset = createWsRpcPreset({
2233
- port,
2234
- host,
2235
- onConnected: (ws, req, meta) => {
2236
- const authId = new URL(req.url ?? "", "http://localhost").searchParams.get("vite_devtools_auth_id") ?? void 0;
2237
- if (isClientAuthDisabled) meta.isTrusted = true;
2238
- else if (authId && contextInternal.storage.auth.value().trusted[authId]) {
2239
- meta.isTrusted = true;
2240
- meta.clientAuthId = authId;
2241
- }
2242
- wsClients.add(ws);
2243
- const color = meta.isTrusted ? ansis_default.green : ansis_default.yellow;
2244
- console.log(color`${MARK_INFO} Websocket client connected. [${meta.id}] [${meta.clientAuthId}] (${meta.isTrusted ? "trusted" : "untrusted"})`);
2245
- },
2246
- onDisconnected: (ws, meta) => {
2247
- wsClients.delete(ws);
2248
- console.log(ansis_default.red`${MARK_INFO} Websocket client disconnected. [${meta.id}]`);
2249
- }
2250
- });
2251
- const asyncStorage = new AsyncLocalStorage();
2252
- const rpcGroup = createRpcServer(rpcHost.functions, {
2253
- preset,
2254
- rpcOptions: {
2255
- onFunctionError(error, name) {
2256
- console.error(ansis_default.red`⬢ RPC error on executing "${ansis_default.bold(name)}":`);
2257
- console.error(error);
2258
- },
2259
- onGeneralError(error) {
2260
- console.error(ansis_default.red`⬢ RPC error on executing rpc`);
2261
- console.error(error);
2262
- },
2263
- resolver(name, fn) {
2264
- const rpc = this;
2265
- if (!name.startsWith(ANONYMOUS_SCOPE) && !rpc.$meta.isTrusted) return () => {
2266
- throw new Error(`Unauthorized access to method ${JSON.stringify(name)} from client [${rpc.$meta.id}]`);
2267
- };
2268
- if (!fn) return void 0;
2269
- return async function(...args) {
2270
- debugInvoked(`${JSON.stringify(name)} from #${rpc.$meta.id}`);
2271
- return await asyncStorage.run({
2272
- rpc,
2273
- meta: rpc.$meta
2274
- }, async () => {
2275
- return (await fn).apply(this, args);
2276
- });
2277
- };
2278
- }
2279
- }
2280
- });
2281
- rpcHost._rpcGroup = rpcGroup;
2282
- rpcHost._asyncStorage = asyncStorage;
2283
- const getConnectionMeta = async () => {
2284
- return {
2285
- backend: "websocket",
2286
- websocket: port
2287
- };
2288
- };
2289
- return {
2290
- port,
2291
- rpc: rpcGroup,
2292
- rpcHost,
2293
- getConnectionMeta
2294
- };
2295
- }
2296
-
2297
- //#endregion
2298
- //#region src/node/server.ts
2299
- async function createDevToolsMiddleware(options) {
2300
- const h3 = createApp();
2301
- const { rpc, getConnectionMeta } = await createWsServer(options);
2302
- h3.use("/.vdt-connection.json", eventHandler(async (event) => {
2303
- event.node.res.setHeader("Content-Type", "application/json");
2304
- return event.node.res.end(JSON.stringify(await getConnectionMeta()));
2305
- }));
2306
- h3.use(fromNodeMiddleware(sirv(dirClientStandalone, {
2307
- dev: true,
2308
- single: true
2309
- })));
2310
- return {
2311
- h3,
2312
- rpc,
2313
- middleware: toNodeListener(h3),
2314
- getConnectionMeta
2315
- };
2316
- }
2317
-
2318
- //#endregion
2319
- //#region src/node/plugins/server.ts
2320
- /**
2321
- * Core plugin for enabling Vite DevTools
2322
- */
2323
- function DevToolsServer() {
2324
- let context;
2325
- return {
2326
- name: "vite:devtools:server",
2327
- enforce: "post",
2328
- apply: "serve",
2329
- async configureServer(viteDevServer) {
2330
- context = await createDevToolsContext(viteDevServer.config, viteDevServer);
2331
- const host = viteDevServer.config.server.host === true ? "0.0.0.0" : viteDevServer.config.server.host || "localhost";
2332
- const { middleware } = await createDevToolsMiddleware({
2333
- cwd: viteDevServer.config.root,
2334
- hostWebSocket: host,
2335
- context
2336
- });
2337
- viteDevServer.middlewares.use("/.devtools/", middleware);
2338
- },
2339
- resolveId(id) {
2340
- if (id === "/.devtools-imports") return id;
2341
- },
2342
- load(id) {
2343
- if (id === "/.devtools-imports") {
2344
- if (!context) throw new Error("DevTools context is not initialized");
2345
- const docks = Array.from(context.docks.values());
2346
- const map = /* @__PURE__ */ new Map();
2347
- for (const dock of docks) {
2348
- const id$1 = `${dock.type}:${dock.id}`;
2349
- if (dock.type === "action") map.set(id$1, dock.action);
2350
- else if (dock.type === "custom-render") map.set(id$1, dock.renderer);
2351
- else if (dock.type === "iframe" && dock.clientScript) map.set(id$1, dock.clientScript);
2352
- }
2353
- return [
2354
- `export const importsMap = {`,
2355
- ...[...map.entries()].filter(([, entry]) => entry != null).map(([id$1, { importFrom, importName }]) => ` [${JSON.stringify(id$1)}]: () => import(${JSON.stringify(importFrom)}).then(r => r[${JSON.stringify(importName)}]),`),
2356
- "}"
2357
- ].join("\n");
2358
- }
2359
- }
2360
- };
2361
- }
2362
-
2363
- //#endregion
2364
- //#region src/node/plugins/index.ts
2365
- async function DevTools(options = {}) {
2366
- const { builtinDevTools = true } = options;
2367
- const plugins = [DevToolsInjection(), DevToolsServer()];
2368
- if (builtinDevTools) plugins.push(await import("@vitejs/devtools-vite").then((m$1) => m$1.DevToolsViteUI()));
2369
- return plugins;
2370
- }
2371
-
2372
- //#endregion
2373
- export { createDevToolsContext as a, getPort as i, createDevToolsMiddleware as n, ansis_default as o, MARK_NODE as r, DevTools as t };