@makoojs/cli 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DevTerminal-BtHO2wRA.js +2396 -0
- package/dist/DevTerminal-DNh8U_O4.cjs +30 -0
- package/dist/bin.js +29 -580
- package/dist/bridge/protocol.d.ts +64 -0
- package/dist/bridge/runtime.cjs +1 -0
- package/dist/bridge/runtime.d.ts +38 -0
- package/dist/bridge/runtime.js +168 -0
- package/dist/bridge/server.d.ts +15 -0
- package/dist/bridge/store.d.ts +17 -0
- package/dist/commands/version.d.ts +1 -0
- package/dist/config/resolve.d.ts +1 -5
- package/dist/config/types.d.ts +40 -9
- package/dist/errors.d.ts +766 -0
- package/dist/index.cjs +2 -149
- package/dist/index.d.ts +1 -1
- package/dist/index.js +216 -2934
- package/dist/monkey/clipboard.d.ts +2 -0
- package/dist/monkey/download.d.ts +2 -0
- package/dist/monkey/index.d.ts +1 -0
- package/dist/monkey/info.d.ts +3 -0
- package/dist/monkey/menu.d.ts +3 -0
- package/dist/monkey/notification.d.ts +2 -0
- package/dist/monkey/request.d.ts +8 -0
- package/dist/monkey/resource.d.ts +3 -0
- package/dist/monkey/storage.d.ts +10 -0
- package/dist/monkey/style.d.ts +3 -0
- package/dist/monkey/tab.d.ts +5 -0
- package/dist/protocol-D8uLFi4g.cjs +1 -0
- package/dist/protocol-ZRHs80xs.js +4 -0
- package/dist/{cli/commands/dev → tui}/DevTerminal.d.ts +12 -6
- package/dist/{cli/injections → tui}/renderInjections.d.ts +1 -1
- package/dist/version-DiRsgSMp.js +19 -0
- package/dist/version-ENbM57wf.cjs +1 -0
- package/dist/vite/makoo.d.ts +3 -0
- package/dist/vite/makooDev.d.ts +28 -6
- package/package.json +5 -6
- package/dist/cli/version.d.ts +0 -1
- package/dist/config/defaults.d.ts +0 -5
- package/dist/config/errors.d.ts +0 -3
- package/dist/config/validation.d.ts +0 -11
- package/dist/session/DevSession.d.ts +0 -14
- package/dist/session/types.d.ts +0 -47
- /package/dist/{cli → commands}/bin.d.ts +0 -0
- /package/dist/{cli/commands → commands}/build.d.ts +0 -0
- /package/dist/{cli/commands/dev → commands}/dev.d.ts +0 -0
- /package/dist/{cli/commands → commands}/preview.d.ts +0 -0
- /package/dist/{cli → tui}/terminalColor.d.ts +0 -0
|
@@ -0,0 +1,2396 @@
|
|
|
1
|
+
import { t as e } from "./version-DiRsgSMp.js";
|
|
2
|
+
import t from "node:process";
|
|
3
|
+
import { isMakooError as n } from "@makoojs/core";
|
|
4
|
+
import { emitKeypressEvents as r } from "node:readline";
|
|
5
|
+
import i from "node:os";
|
|
6
|
+
import { stripVTControlCharacters as a } from "node:util";
|
|
7
|
+
//#region node_modules/.pnpm/environment@1.1.0/node_modules/environment/index.js
|
|
8
|
+
var o = globalThis.window?.document !== void 0;
|
|
9
|
+
globalThis.process?.versions?.node, globalThis.process?.versions?.bun, globalThis.Deno?.version?.deno, globalThis.process?.versions?.electron, globalThis.navigator?.userAgent?.includes("jsdom"), typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope, typeof DedicatedWorkerGlobalScope < "u" && globalThis instanceof DedicatedWorkerGlobalScope, typeof SharedWorkerGlobalScope < "u" && globalThis instanceof SharedWorkerGlobalScope, typeof ServiceWorkerGlobalScope < "u" && globalThis instanceof ServiceWorkerGlobalScope;
|
|
10
|
+
var s = globalThis.navigator?.userAgentData?.platform;
|
|
11
|
+
s === "macOS" || globalThis.navigator?.platform === "MacIntel" || globalThis.navigator?.userAgent?.includes(" Mac ") === !0 || globalThis.process?.platform, s === "Windows" || globalThis.navigator?.platform === "Win32" || globalThis.process?.platform, s === "Linux" || globalThis.navigator?.platform?.startsWith("Linux") === !0 || globalThis.navigator?.userAgent?.includes(" Linux ") === !0 || globalThis.process?.platform, s === "iOS" || globalThis.navigator?.platform === "MacIntel" && globalThis.navigator?.maxTouchPoints > 1 || /iPad|iPhone|iPod/.test(globalThis.navigator?.platform), s === "Android" || globalThis.navigator?.platform === "Android" || globalThis.navigator?.userAgent?.includes(" Android ") === !0 || globalThis.process?.platform;
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region node_modules/.pnpm/ansi-escapes@7.3.0/node_modules/ansi-escapes/base.js
|
|
14
|
+
var c = "\x1B[";
|
|
15
|
+
!o && t.env.TERM_PROGRAM;
|
|
16
|
+
var l = !o && t.platform === "win32";
|
|
17
|
+
!o && (t.env.TERM?.startsWith("screen") || t.env.TERM?.startsWith("tmux") || t.env.TMUX), o || t.cwd;
|
|
18
|
+
var u = (e = 1) => c + e + "A", d = (e = 1) => c + e + "B", f = (e) => {
|
|
19
|
+
let t = "";
|
|
20
|
+
for (let n = 0; n < e; n++) t += p + (n < e - 1 ? u() : "");
|
|
21
|
+
return e && (t += "\x1B[G"), t;
|
|
22
|
+
}, p = "\x1B[2K", m = "\x1B[2J";
|
|
23
|
+
`${m}${c}`, (() => {
|
|
24
|
+
if (o || !l) return !1;
|
|
25
|
+
let e = i.release().split("."), t = Number(e[0]), n = Number(e[2] ?? 0);
|
|
26
|
+
return t < 10 || t === 10 && n < 10586;
|
|
27
|
+
})() ? `${m}${c}` : `${m}${c}${c}`;
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region node_modules/.pnpm/mimic-function@5.0.1/node_modules/mimic-function/index.js
|
|
30
|
+
var ee = (e, t, n, r) => {
|
|
31
|
+
if (n === "length" || n === "prototype" || n === "arguments" || n === "caller") return;
|
|
32
|
+
let i = Object.getOwnPropertyDescriptor(e, n), a = Object.getOwnPropertyDescriptor(t, n);
|
|
33
|
+
!te(i, a) && r || Object.defineProperty(e, n, a);
|
|
34
|
+
}, te = function(e, t) {
|
|
35
|
+
return e === void 0 || e.configurable || e.writable === t.writable && e.enumerable === t.enumerable && e.configurable === t.configurable && (e.writable || e.value === t.value);
|
|
36
|
+
}, ne = (e, t) => {
|
|
37
|
+
let n = Object.getPrototypeOf(t);
|
|
38
|
+
n !== Object.getPrototypeOf(e) && Object.setPrototypeOf(e, n);
|
|
39
|
+
}, re = (e, t) => `/* Wrapped ${e}*/\n${t}`, ie = Object.getOwnPropertyDescriptor(Function.prototype, "toString"), ae = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name"), oe = (e, t, n) => {
|
|
40
|
+
let r = n === "" ? "" : `with ${n.trim()}() `, i = re.bind(null, r, t.toString());
|
|
41
|
+
Object.defineProperty(i, "name", ae);
|
|
42
|
+
let { writable: a, enumerable: o, configurable: s } = ie;
|
|
43
|
+
Object.defineProperty(e, "toString", {
|
|
44
|
+
value: i,
|
|
45
|
+
writable: a,
|
|
46
|
+
enumerable: o,
|
|
47
|
+
configurable: s
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
function se(e, t, { ignoreNonConfigurable: n = !1 } = {}) {
|
|
51
|
+
let { name: r } = e;
|
|
52
|
+
for (let r of Reflect.ownKeys(t)) ee(e, t, r, n);
|
|
53
|
+
return ne(e, t), oe(e, t, r), e;
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region node_modules/.pnpm/onetime@7.0.0/node_modules/onetime/index.js
|
|
57
|
+
var h = /* @__PURE__ */ new WeakMap(), ce = (e, t = {}) => {
|
|
58
|
+
if (typeof e != "function") throw TypeError("Expected a function");
|
|
59
|
+
let n, r = 0, i = e.displayName || e.name || "<anonymous>", a = function(...o) {
|
|
60
|
+
if (h.set(a, ++r), r === 1) n = e.apply(this, o), e = void 0;
|
|
61
|
+
else if (t.throw === !0) throw Error(`Function \`${i}\` can only be called once`);
|
|
62
|
+
return n;
|
|
63
|
+
};
|
|
64
|
+
return se(a, e), h.set(a, r), a;
|
|
65
|
+
};
|
|
66
|
+
ce.callCount = (e) => {
|
|
67
|
+
if (!h.has(e)) throw Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);
|
|
68
|
+
return h.get(e);
|
|
69
|
+
};
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
|
|
72
|
+
var g = [];
|
|
73
|
+
g.push("SIGHUP", "SIGINT", "SIGTERM"), process.platform !== "win32" && g.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT"), process.platform === "linux" && g.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
|
|
76
|
+
var _ = (e) => !!e && typeof e == "object" && typeof e.removeListener == "function" && typeof e.emit == "function" && typeof e.reallyExit == "function" && typeof e.listeners == "function" && typeof e.kill == "function" && typeof e.pid == "number" && typeof e.on == "function", le = Symbol.for("signal-exit emitter"), v = globalThis, ue = Object.defineProperty.bind(Object), de = class {
|
|
77
|
+
emitted = {
|
|
78
|
+
afterExit: !1,
|
|
79
|
+
exit: !1
|
|
80
|
+
};
|
|
81
|
+
listeners = {
|
|
82
|
+
afterExit: [],
|
|
83
|
+
exit: []
|
|
84
|
+
};
|
|
85
|
+
count = 0;
|
|
86
|
+
id = Math.random();
|
|
87
|
+
constructor() {
|
|
88
|
+
if (v[le]) return v[le];
|
|
89
|
+
ue(v, le, {
|
|
90
|
+
value: this,
|
|
91
|
+
writable: !1,
|
|
92
|
+
enumerable: !1,
|
|
93
|
+
configurable: !1
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
on(e, t) {
|
|
97
|
+
this.listeners[e].push(t);
|
|
98
|
+
}
|
|
99
|
+
removeListener(e, t) {
|
|
100
|
+
let n = this.listeners[e], r = n.indexOf(t);
|
|
101
|
+
r !== -1 &&
|
|
102
|
+
/* c8 ignore stop */
|
|
103
|
+
(r === 0 && n.length === 1 ? n.length = 0 : n.splice(r, 1));
|
|
104
|
+
}
|
|
105
|
+
emit(e, t, n) {
|
|
106
|
+
if (this.emitted[e]) return !1;
|
|
107
|
+
this.emitted[e] = !0;
|
|
108
|
+
let r = !1;
|
|
109
|
+
for (let i of this.listeners[e]) r = i(t, n) === !0 || r;
|
|
110
|
+
return e === "exit" && (r = this.emit("afterExit", t, n) || r), r;
|
|
111
|
+
}
|
|
112
|
+
}, fe = class {}, pe = (e) => ({
|
|
113
|
+
onExit(t, n) {
|
|
114
|
+
return e.onExit(t, n);
|
|
115
|
+
},
|
|
116
|
+
load() {
|
|
117
|
+
return e.load();
|
|
118
|
+
},
|
|
119
|
+
unload() {
|
|
120
|
+
return e.unload();
|
|
121
|
+
}
|
|
122
|
+
}), me = class extends fe {
|
|
123
|
+
onExit() {
|
|
124
|
+
return () => {};
|
|
125
|
+
}
|
|
126
|
+
load() {}
|
|
127
|
+
unload() {}
|
|
128
|
+
}, he = class extends fe {
|
|
129
|
+
/* c8 ignore start */
|
|
130
|
+
#e = y.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
131
|
+
/* c8 ignore stop */
|
|
132
|
+
#t = new de();
|
|
133
|
+
#n;
|
|
134
|
+
#r;
|
|
135
|
+
#i;
|
|
136
|
+
#a = {};
|
|
137
|
+
#o = !1;
|
|
138
|
+
constructor(e) {
|
|
139
|
+
super(), this.#n = e, this.#a = {};
|
|
140
|
+
for (let t of g) this.#a[t] = () => {
|
|
141
|
+
let n = this.#n.listeners(t), { count: r } = this.#t, i = e;
|
|
142
|
+
/* c8 ignore stop */
|
|
143
|
+
if (typeof i.__signal_exit_emitter__ == "object" && typeof i.__signal_exit_emitter__.count == "number" && (r += i.__signal_exit_emitter__.count), n.length === r) {
|
|
144
|
+
this.unload();
|
|
145
|
+
let n = this.#t.emit("exit", null, t), r = t === "SIGHUP" ? this.#e : t;
|
|
146
|
+
n || e.kill(e.pid, r);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
this.#i = e.reallyExit, this.#r = e.emit;
|
|
150
|
+
}
|
|
151
|
+
onExit(e, t) {
|
|
152
|
+
/* c8 ignore start */
|
|
153
|
+
if (!_(this.#n)) return () => {};
|
|
154
|
+
/* c8 ignore stop */
|
|
155
|
+
this.#o === !1 && this.load();
|
|
156
|
+
let n = t?.alwaysLast ? "afterExit" : "exit";
|
|
157
|
+
return this.#t.on(n, e), () => {
|
|
158
|
+
this.#t.removeListener(n, e), this.#t.listeners.exit.length === 0 && this.#t.listeners.afterExit.length === 0 && this.unload();
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
load() {
|
|
162
|
+
if (!this.#o) {
|
|
163
|
+
this.#o = !0, this.#t.count += 1;
|
|
164
|
+
for (let e of g) try {
|
|
165
|
+
let t = this.#a[e];
|
|
166
|
+
t && this.#n.on(e, t);
|
|
167
|
+
} catch {}
|
|
168
|
+
this.#n.emit = (e, ...t) => this.#c(e, ...t), this.#n.reallyExit = (e) => this.#s(e);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
unload() {
|
|
172
|
+
this.#o && (this.#o = !1, g.forEach((e) => {
|
|
173
|
+
let t = this.#a[e];
|
|
174
|
+
/* c8 ignore start */
|
|
175
|
+
if (!t) throw Error("Listener not defined for signal: " + e);
|
|
176
|
+
/* c8 ignore stop */
|
|
177
|
+
try {
|
|
178
|
+
this.#n.removeListener(e, t);
|
|
179
|
+
} catch {}
|
|
180
|
+
/* c8 ignore stop */
|
|
181
|
+
}), this.#n.emit = this.#r, this.#n.reallyExit = this.#i, --this.#t.count);
|
|
182
|
+
}
|
|
183
|
+
#s(e) {
|
|
184
|
+
return _(this.#n) ? (this.#n.exitCode = e || 0, this.#t.emit("exit", this.#n.exitCode, null), this.#i.call(this.#n, this.#n.exitCode)) : 0;
|
|
185
|
+
}
|
|
186
|
+
#c(e, ...t) {
|
|
187
|
+
let n = this.#r;
|
|
188
|
+
if (e === "exit" && _(this.#n)) {
|
|
189
|
+
typeof t[0] == "number" && (this.#n.exitCode = t[0]);
|
|
190
|
+
/* c8 ignore start */
|
|
191
|
+
let r = n.call(this.#n, e, ...t);
|
|
192
|
+
/* c8 ignore stop */
|
|
193
|
+
return this.#t.emit("exit", this.#n.exitCode, null), r;
|
|
194
|
+
}
|
|
195
|
+
return n.call(this.#n, e, ...t);
|
|
196
|
+
}
|
|
197
|
+
}, y = globalThis.process, { onExit: ge, load: _e, unload: ve } = pe(_(y) ? new he(y) : new me()), ye = t.stderr.isTTY ? t.stderr : t.stdout.isTTY ? t.stdout : void 0, be = ye ? ce(() => {
|
|
198
|
+
ge(() => {
|
|
199
|
+
ye.write("\x1B[?25h");
|
|
200
|
+
}, { alwaysLast: !0 });
|
|
201
|
+
}) : () => {}, b = !1, x = {};
|
|
202
|
+
x.show = (e = t.stderr) => {
|
|
203
|
+
e.isTTY && (b = !1, e.write("\x1B[?25h"));
|
|
204
|
+
}, x.hide = (e = t.stderr) => {
|
|
205
|
+
e.isTTY && (be(), b = !0, e.write("\x1B[?25l"));
|
|
206
|
+
}, x.toggle = (e, t) => {
|
|
207
|
+
e !== void 0 && (b = e), b ? x.show(t) : x.hide(t);
|
|
208
|
+
};
|
|
209
|
+
//#endregion
|
|
210
|
+
//#region node_modules/.pnpm/ansi-regex@6.3.0/node_modules/ansi-regex/index.js
|
|
211
|
+
function xe({ onlyFirst: e = !1 } = {}) {
|
|
212
|
+
return RegExp("(?:\\u001B\\][^\\u0007\\u001B\\u009C]*(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]", e ? void 0 : "g");
|
|
213
|
+
}
|
|
214
|
+
//#endregion
|
|
215
|
+
//#region node_modules/.pnpm/strip-ansi@7.2.0/node_modules/strip-ansi/index.js
|
|
216
|
+
var Se = xe();
|
|
217
|
+
function Ce(e) {
|
|
218
|
+
if (typeof e != "string") throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);
|
|
219
|
+
return !e.includes("\x1B") && !e.includes("") ? e : e.replace(Se, "");
|
|
220
|
+
}
|
|
221
|
+
var we = [
|
|
222
|
+
161,
|
|
223
|
+
161,
|
|
224
|
+
164,
|
|
225
|
+
164,
|
|
226
|
+
167,
|
|
227
|
+
168,
|
|
228
|
+
170,
|
|
229
|
+
170,
|
|
230
|
+
173,
|
|
231
|
+
174,
|
|
232
|
+
176,
|
|
233
|
+
180,
|
|
234
|
+
182,
|
|
235
|
+
186,
|
|
236
|
+
188,
|
|
237
|
+
191,
|
|
238
|
+
198,
|
|
239
|
+
198,
|
|
240
|
+
208,
|
|
241
|
+
208,
|
|
242
|
+
215,
|
|
243
|
+
216,
|
|
244
|
+
222,
|
|
245
|
+
225,
|
|
246
|
+
230,
|
|
247
|
+
230,
|
|
248
|
+
232,
|
|
249
|
+
234,
|
|
250
|
+
236,
|
|
251
|
+
237,
|
|
252
|
+
240,
|
|
253
|
+
240,
|
|
254
|
+
242,
|
|
255
|
+
243,
|
|
256
|
+
247,
|
|
257
|
+
250,
|
|
258
|
+
252,
|
|
259
|
+
252,
|
|
260
|
+
254,
|
|
261
|
+
254,
|
|
262
|
+
257,
|
|
263
|
+
257,
|
|
264
|
+
273,
|
|
265
|
+
273,
|
|
266
|
+
275,
|
|
267
|
+
275,
|
|
268
|
+
283,
|
|
269
|
+
283,
|
|
270
|
+
294,
|
|
271
|
+
295,
|
|
272
|
+
299,
|
|
273
|
+
299,
|
|
274
|
+
305,
|
|
275
|
+
307,
|
|
276
|
+
312,
|
|
277
|
+
312,
|
|
278
|
+
319,
|
|
279
|
+
322,
|
|
280
|
+
324,
|
|
281
|
+
324,
|
|
282
|
+
328,
|
|
283
|
+
331,
|
|
284
|
+
333,
|
|
285
|
+
333,
|
|
286
|
+
338,
|
|
287
|
+
339,
|
|
288
|
+
358,
|
|
289
|
+
359,
|
|
290
|
+
363,
|
|
291
|
+
363,
|
|
292
|
+
462,
|
|
293
|
+
462,
|
|
294
|
+
464,
|
|
295
|
+
464,
|
|
296
|
+
466,
|
|
297
|
+
466,
|
|
298
|
+
468,
|
|
299
|
+
468,
|
|
300
|
+
470,
|
|
301
|
+
470,
|
|
302
|
+
472,
|
|
303
|
+
472,
|
|
304
|
+
474,
|
|
305
|
+
474,
|
|
306
|
+
476,
|
|
307
|
+
476,
|
|
308
|
+
593,
|
|
309
|
+
593,
|
|
310
|
+
609,
|
|
311
|
+
609,
|
|
312
|
+
708,
|
|
313
|
+
708,
|
|
314
|
+
711,
|
|
315
|
+
711,
|
|
316
|
+
713,
|
|
317
|
+
715,
|
|
318
|
+
717,
|
|
319
|
+
717,
|
|
320
|
+
720,
|
|
321
|
+
720,
|
|
322
|
+
728,
|
|
323
|
+
731,
|
|
324
|
+
733,
|
|
325
|
+
733,
|
|
326
|
+
735,
|
|
327
|
+
735,
|
|
328
|
+
768,
|
|
329
|
+
879,
|
|
330
|
+
913,
|
|
331
|
+
929,
|
|
332
|
+
931,
|
|
333
|
+
937,
|
|
334
|
+
945,
|
|
335
|
+
961,
|
|
336
|
+
963,
|
|
337
|
+
969,
|
|
338
|
+
1025,
|
|
339
|
+
1025,
|
|
340
|
+
1040,
|
|
341
|
+
1103,
|
|
342
|
+
1105,
|
|
343
|
+
1105,
|
|
344
|
+
8208,
|
|
345
|
+
8208,
|
|
346
|
+
8211,
|
|
347
|
+
8214,
|
|
348
|
+
8216,
|
|
349
|
+
8217,
|
|
350
|
+
8220,
|
|
351
|
+
8221,
|
|
352
|
+
8224,
|
|
353
|
+
8226,
|
|
354
|
+
8228,
|
|
355
|
+
8231,
|
|
356
|
+
8240,
|
|
357
|
+
8240,
|
|
358
|
+
8242,
|
|
359
|
+
8243,
|
|
360
|
+
8245,
|
|
361
|
+
8245,
|
|
362
|
+
8251,
|
|
363
|
+
8251,
|
|
364
|
+
8254,
|
|
365
|
+
8254,
|
|
366
|
+
8308,
|
|
367
|
+
8308,
|
|
368
|
+
8319,
|
|
369
|
+
8319,
|
|
370
|
+
8321,
|
|
371
|
+
8324,
|
|
372
|
+
8364,
|
|
373
|
+
8364,
|
|
374
|
+
8451,
|
|
375
|
+
8451,
|
|
376
|
+
8453,
|
|
377
|
+
8453,
|
|
378
|
+
8457,
|
|
379
|
+
8457,
|
|
380
|
+
8467,
|
|
381
|
+
8467,
|
|
382
|
+
8470,
|
|
383
|
+
8470,
|
|
384
|
+
8481,
|
|
385
|
+
8482,
|
|
386
|
+
8486,
|
|
387
|
+
8486,
|
|
388
|
+
8491,
|
|
389
|
+
8491,
|
|
390
|
+
8531,
|
|
391
|
+
8532,
|
|
392
|
+
8539,
|
|
393
|
+
8542,
|
|
394
|
+
8544,
|
|
395
|
+
8555,
|
|
396
|
+
8560,
|
|
397
|
+
8569,
|
|
398
|
+
8585,
|
|
399
|
+
8585,
|
|
400
|
+
8592,
|
|
401
|
+
8601,
|
|
402
|
+
8632,
|
|
403
|
+
8633,
|
|
404
|
+
8658,
|
|
405
|
+
8658,
|
|
406
|
+
8660,
|
|
407
|
+
8660,
|
|
408
|
+
8679,
|
|
409
|
+
8679,
|
|
410
|
+
8704,
|
|
411
|
+
8704,
|
|
412
|
+
8706,
|
|
413
|
+
8707,
|
|
414
|
+
8711,
|
|
415
|
+
8712,
|
|
416
|
+
8715,
|
|
417
|
+
8715,
|
|
418
|
+
8719,
|
|
419
|
+
8719,
|
|
420
|
+
8721,
|
|
421
|
+
8721,
|
|
422
|
+
8725,
|
|
423
|
+
8725,
|
|
424
|
+
8730,
|
|
425
|
+
8730,
|
|
426
|
+
8733,
|
|
427
|
+
8736,
|
|
428
|
+
8739,
|
|
429
|
+
8739,
|
|
430
|
+
8741,
|
|
431
|
+
8741,
|
|
432
|
+
8743,
|
|
433
|
+
8748,
|
|
434
|
+
8750,
|
|
435
|
+
8750,
|
|
436
|
+
8756,
|
|
437
|
+
8759,
|
|
438
|
+
8764,
|
|
439
|
+
8765,
|
|
440
|
+
8776,
|
|
441
|
+
8776,
|
|
442
|
+
8780,
|
|
443
|
+
8780,
|
|
444
|
+
8786,
|
|
445
|
+
8786,
|
|
446
|
+
8800,
|
|
447
|
+
8801,
|
|
448
|
+
8804,
|
|
449
|
+
8807,
|
|
450
|
+
8810,
|
|
451
|
+
8811,
|
|
452
|
+
8814,
|
|
453
|
+
8815,
|
|
454
|
+
8834,
|
|
455
|
+
8835,
|
|
456
|
+
8838,
|
|
457
|
+
8839,
|
|
458
|
+
8853,
|
|
459
|
+
8853,
|
|
460
|
+
8857,
|
|
461
|
+
8857,
|
|
462
|
+
8869,
|
|
463
|
+
8869,
|
|
464
|
+
8895,
|
|
465
|
+
8895,
|
|
466
|
+
8978,
|
|
467
|
+
8978,
|
|
468
|
+
9312,
|
|
469
|
+
9449,
|
|
470
|
+
9451,
|
|
471
|
+
9547,
|
|
472
|
+
9552,
|
|
473
|
+
9587,
|
|
474
|
+
9600,
|
|
475
|
+
9615,
|
|
476
|
+
9618,
|
|
477
|
+
9621,
|
|
478
|
+
9632,
|
|
479
|
+
9633,
|
|
480
|
+
9635,
|
|
481
|
+
9641,
|
|
482
|
+
9650,
|
|
483
|
+
9651,
|
|
484
|
+
9654,
|
|
485
|
+
9655,
|
|
486
|
+
9660,
|
|
487
|
+
9661,
|
|
488
|
+
9664,
|
|
489
|
+
9665,
|
|
490
|
+
9670,
|
|
491
|
+
9672,
|
|
492
|
+
9675,
|
|
493
|
+
9675,
|
|
494
|
+
9678,
|
|
495
|
+
9681,
|
|
496
|
+
9698,
|
|
497
|
+
9701,
|
|
498
|
+
9711,
|
|
499
|
+
9711,
|
|
500
|
+
9733,
|
|
501
|
+
9734,
|
|
502
|
+
9737,
|
|
503
|
+
9737,
|
|
504
|
+
9742,
|
|
505
|
+
9743,
|
|
506
|
+
9756,
|
|
507
|
+
9756,
|
|
508
|
+
9758,
|
|
509
|
+
9758,
|
|
510
|
+
9792,
|
|
511
|
+
9792,
|
|
512
|
+
9794,
|
|
513
|
+
9794,
|
|
514
|
+
9824,
|
|
515
|
+
9825,
|
|
516
|
+
9827,
|
|
517
|
+
9829,
|
|
518
|
+
9831,
|
|
519
|
+
9834,
|
|
520
|
+
9836,
|
|
521
|
+
9837,
|
|
522
|
+
9839,
|
|
523
|
+
9839,
|
|
524
|
+
9886,
|
|
525
|
+
9887,
|
|
526
|
+
9919,
|
|
527
|
+
9919,
|
|
528
|
+
9926,
|
|
529
|
+
9933,
|
|
530
|
+
9935,
|
|
531
|
+
9939,
|
|
532
|
+
9941,
|
|
533
|
+
9953,
|
|
534
|
+
9955,
|
|
535
|
+
9955,
|
|
536
|
+
9960,
|
|
537
|
+
9961,
|
|
538
|
+
9963,
|
|
539
|
+
9969,
|
|
540
|
+
9972,
|
|
541
|
+
9972,
|
|
542
|
+
9974,
|
|
543
|
+
9977,
|
|
544
|
+
9979,
|
|
545
|
+
9980,
|
|
546
|
+
9982,
|
|
547
|
+
9983,
|
|
548
|
+
10045,
|
|
549
|
+
10045,
|
|
550
|
+
10102,
|
|
551
|
+
10111,
|
|
552
|
+
11094,
|
|
553
|
+
11097,
|
|
554
|
+
12872,
|
|
555
|
+
12879,
|
|
556
|
+
57344,
|
|
557
|
+
63743,
|
|
558
|
+
65024,
|
|
559
|
+
65039,
|
|
560
|
+
65533,
|
|
561
|
+
65533,
|
|
562
|
+
127232,
|
|
563
|
+
127242,
|
|
564
|
+
127248,
|
|
565
|
+
127277,
|
|
566
|
+
127280,
|
|
567
|
+
127337,
|
|
568
|
+
127344,
|
|
569
|
+
127373,
|
|
570
|
+
127375,
|
|
571
|
+
127376,
|
|
572
|
+
127387,
|
|
573
|
+
127404,
|
|
574
|
+
917760,
|
|
575
|
+
917999,
|
|
576
|
+
983040,
|
|
577
|
+
1048573,
|
|
578
|
+
1048576,
|
|
579
|
+
1114109
|
|
580
|
+
], Te = [
|
|
581
|
+
12288,
|
|
582
|
+
12288,
|
|
583
|
+
65281,
|
|
584
|
+
65376,
|
|
585
|
+
65504,
|
|
586
|
+
65510
|
|
587
|
+
], Ee = [
|
|
588
|
+
4352,
|
|
589
|
+
4447,
|
|
590
|
+
8986,
|
|
591
|
+
8987,
|
|
592
|
+
9001,
|
|
593
|
+
9002,
|
|
594
|
+
9193,
|
|
595
|
+
9196,
|
|
596
|
+
9200,
|
|
597
|
+
9200,
|
|
598
|
+
9203,
|
|
599
|
+
9203,
|
|
600
|
+
9725,
|
|
601
|
+
9726,
|
|
602
|
+
9748,
|
|
603
|
+
9749,
|
|
604
|
+
9776,
|
|
605
|
+
9783,
|
|
606
|
+
9800,
|
|
607
|
+
9811,
|
|
608
|
+
9855,
|
|
609
|
+
9855,
|
|
610
|
+
9866,
|
|
611
|
+
9871,
|
|
612
|
+
9875,
|
|
613
|
+
9875,
|
|
614
|
+
9889,
|
|
615
|
+
9889,
|
|
616
|
+
9898,
|
|
617
|
+
9899,
|
|
618
|
+
9917,
|
|
619
|
+
9918,
|
|
620
|
+
9924,
|
|
621
|
+
9925,
|
|
622
|
+
9934,
|
|
623
|
+
9934,
|
|
624
|
+
9940,
|
|
625
|
+
9940,
|
|
626
|
+
9962,
|
|
627
|
+
9962,
|
|
628
|
+
9970,
|
|
629
|
+
9971,
|
|
630
|
+
9973,
|
|
631
|
+
9973,
|
|
632
|
+
9978,
|
|
633
|
+
9978,
|
|
634
|
+
9981,
|
|
635
|
+
9981,
|
|
636
|
+
9989,
|
|
637
|
+
9989,
|
|
638
|
+
9994,
|
|
639
|
+
9995,
|
|
640
|
+
10024,
|
|
641
|
+
10024,
|
|
642
|
+
10060,
|
|
643
|
+
10060,
|
|
644
|
+
10062,
|
|
645
|
+
10062,
|
|
646
|
+
10067,
|
|
647
|
+
10069,
|
|
648
|
+
10071,
|
|
649
|
+
10071,
|
|
650
|
+
10133,
|
|
651
|
+
10135,
|
|
652
|
+
10160,
|
|
653
|
+
10160,
|
|
654
|
+
10175,
|
|
655
|
+
10175,
|
|
656
|
+
11035,
|
|
657
|
+
11036,
|
|
658
|
+
11088,
|
|
659
|
+
11088,
|
|
660
|
+
11093,
|
|
661
|
+
11093,
|
|
662
|
+
11904,
|
|
663
|
+
11929,
|
|
664
|
+
11931,
|
|
665
|
+
12019,
|
|
666
|
+
12032,
|
|
667
|
+
12245,
|
|
668
|
+
12272,
|
|
669
|
+
12287,
|
|
670
|
+
12289,
|
|
671
|
+
12350,
|
|
672
|
+
12353,
|
|
673
|
+
12438,
|
|
674
|
+
12441,
|
|
675
|
+
12543,
|
|
676
|
+
12549,
|
|
677
|
+
12591,
|
|
678
|
+
12593,
|
|
679
|
+
12686,
|
|
680
|
+
12688,
|
|
681
|
+
12773,
|
|
682
|
+
12783,
|
|
683
|
+
12830,
|
|
684
|
+
12832,
|
|
685
|
+
12871,
|
|
686
|
+
12880,
|
|
687
|
+
42124,
|
|
688
|
+
42128,
|
|
689
|
+
42182,
|
|
690
|
+
43360,
|
|
691
|
+
43388,
|
|
692
|
+
44032,
|
|
693
|
+
55203,
|
|
694
|
+
63744,
|
|
695
|
+
64255,
|
|
696
|
+
65040,
|
|
697
|
+
65049,
|
|
698
|
+
65072,
|
|
699
|
+
65106,
|
|
700
|
+
65108,
|
|
701
|
+
65126,
|
|
702
|
+
65128,
|
|
703
|
+
65131,
|
|
704
|
+
94176,
|
|
705
|
+
94180,
|
|
706
|
+
94192,
|
|
707
|
+
94198,
|
|
708
|
+
94208,
|
|
709
|
+
101589,
|
|
710
|
+
101631,
|
|
711
|
+
101662,
|
|
712
|
+
101760,
|
|
713
|
+
101874,
|
|
714
|
+
110576,
|
|
715
|
+
110579,
|
|
716
|
+
110581,
|
|
717
|
+
110587,
|
|
718
|
+
110589,
|
|
719
|
+
110590,
|
|
720
|
+
110592,
|
|
721
|
+
110882,
|
|
722
|
+
110898,
|
|
723
|
+
110898,
|
|
724
|
+
110928,
|
|
725
|
+
110930,
|
|
726
|
+
110933,
|
|
727
|
+
110933,
|
|
728
|
+
110948,
|
|
729
|
+
110951,
|
|
730
|
+
110960,
|
|
731
|
+
111355,
|
|
732
|
+
119552,
|
|
733
|
+
119638,
|
|
734
|
+
119648,
|
|
735
|
+
119670,
|
|
736
|
+
126980,
|
|
737
|
+
126980,
|
|
738
|
+
127183,
|
|
739
|
+
127183,
|
|
740
|
+
127374,
|
|
741
|
+
127374,
|
|
742
|
+
127377,
|
|
743
|
+
127386,
|
|
744
|
+
127488,
|
|
745
|
+
127490,
|
|
746
|
+
127504,
|
|
747
|
+
127547,
|
|
748
|
+
127552,
|
|
749
|
+
127560,
|
|
750
|
+
127568,
|
|
751
|
+
127569,
|
|
752
|
+
127584,
|
|
753
|
+
127589,
|
|
754
|
+
127744,
|
|
755
|
+
127776,
|
|
756
|
+
127789,
|
|
757
|
+
127797,
|
|
758
|
+
127799,
|
|
759
|
+
127868,
|
|
760
|
+
127870,
|
|
761
|
+
127891,
|
|
762
|
+
127904,
|
|
763
|
+
127946,
|
|
764
|
+
127951,
|
|
765
|
+
127955,
|
|
766
|
+
127968,
|
|
767
|
+
127984,
|
|
768
|
+
127988,
|
|
769
|
+
127988,
|
|
770
|
+
127992,
|
|
771
|
+
128062,
|
|
772
|
+
128064,
|
|
773
|
+
128064,
|
|
774
|
+
128066,
|
|
775
|
+
128252,
|
|
776
|
+
128255,
|
|
777
|
+
128317,
|
|
778
|
+
128331,
|
|
779
|
+
128334,
|
|
780
|
+
128336,
|
|
781
|
+
128359,
|
|
782
|
+
128378,
|
|
783
|
+
128378,
|
|
784
|
+
128405,
|
|
785
|
+
128406,
|
|
786
|
+
128420,
|
|
787
|
+
128420,
|
|
788
|
+
128507,
|
|
789
|
+
128591,
|
|
790
|
+
128640,
|
|
791
|
+
128709,
|
|
792
|
+
128716,
|
|
793
|
+
128716,
|
|
794
|
+
128720,
|
|
795
|
+
128722,
|
|
796
|
+
128725,
|
|
797
|
+
128728,
|
|
798
|
+
128732,
|
|
799
|
+
128735,
|
|
800
|
+
128747,
|
|
801
|
+
128748,
|
|
802
|
+
128756,
|
|
803
|
+
128764,
|
|
804
|
+
128992,
|
|
805
|
+
129003,
|
|
806
|
+
129008,
|
|
807
|
+
129008,
|
|
808
|
+
129292,
|
|
809
|
+
129338,
|
|
810
|
+
129340,
|
|
811
|
+
129349,
|
|
812
|
+
129351,
|
|
813
|
+
129535,
|
|
814
|
+
129648,
|
|
815
|
+
129660,
|
|
816
|
+
129664,
|
|
817
|
+
129674,
|
|
818
|
+
129678,
|
|
819
|
+
129734,
|
|
820
|
+
129736,
|
|
821
|
+
129736,
|
|
822
|
+
129741,
|
|
823
|
+
129756,
|
|
824
|
+
129759,
|
|
825
|
+
129770,
|
|
826
|
+
129775,
|
|
827
|
+
129784,
|
|
828
|
+
131072,
|
|
829
|
+
196605,
|
|
830
|
+
196608,
|
|
831
|
+
262141
|
|
832
|
+
], De = (e, t) => {
|
|
833
|
+
let n = 0, r = Math.floor(e.length / 2) - 1;
|
|
834
|
+
for (; n <= r;) {
|
|
835
|
+
let i = Math.floor((n + r) / 2), a = i * 2;
|
|
836
|
+
if (t < e[a]) r = i - 1;
|
|
837
|
+
else if (t > e[a + 1]) n = i + 1;
|
|
838
|
+
else return !0;
|
|
839
|
+
}
|
|
840
|
+
return !1;
|
|
841
|
+
}, Oe = 19968, [ke, Ae] = /* #__PURE__ */ je(Ee);
|
|
842
|
+
function je(e) {
|
|
843
|
+
let t = e[0], n = e[1];
|
|
844
|
+
for (let r = 0; r < e.length; r += 2) {
|
|
845
|
+
let i = e[r], a = e[r + 1];
|
|
846
|
+
if (Oe >= i && Oe <= a) return [i, a];
|
|
847
|
+
a - i > n - t && (t = i, n = a);
|
|
848
|
+
}
|
|
849
|
+
return [t, n];
|
|
850
|
+
}
|
|
851
|
+
var Me = (e) => e < 161 || e > 1114109 ? !1 : De(we, e), Ne = (e) => e < 12288 || e > 65510 ? !1 : De(Te, e), Pe = (e) => e >= ke && e <= Ae ? !0 : e < 4352 || e > 262141 ? !1 : De(Ee, e);
|
|
852
|
+
//#endregion
|
|
853
|
+
//#region node_modules/.pnpm/get-east-asian-width@1.6.0/node_modules/get-east-asian-width/index.js
|
|
854
|
+
function Fe(e) {
|
|
855
|
+
if (!Number.isSafeInteger(e)) throw TypeError(`Expected a code point, got \`${typeof e}\`.`);
|
|
856
|
+
}
|
|
857
|
+
function S(e, { ambiguousAsWide: t = !1 } = {}) {
|
|
858
|
+
return Fe(e), Ne(e) || Pe(e) || t && Me(e) ? 2 : 1;
|
|
859
|
+
}
|
|
860
|
+
//#endregion
|
|
861
|
+
//#region node_modules/.pnpm/string-width@8.2.2/node_modules/string-width/index.js
|
|
862
|
+
var Ie = new Intl.Segmenter(), Le = RegExp("^(?:\\p{Default_Ignorable_Code_Point}|\\p{Control}|\\p{Format}|\\p{Nonspacing_Mark}|\\p{Enclosing_Mark}|\\p{Surrogate})+$", "v"), Re = RegExp("^[\\p{Default_Ignorable_Code_Point}\\p{Control}\\p{Format}\\p{Nonspacing_Mark}\\p{Enclosing_Mark}\\p{Surrogate}]+", "v"), ze = RegExp("\\p{Spacing_Mark}", "v"), Be = RegExp("^\\p{RGI_Emoji}$", "v"), Ve = /^[\d#*]\u20E3$/, He = /\p{Extended_Pictographic}/gu;
|
|
863
|
+
function Ue(e) {
|
|
864
|
+
if (e.length > 50) return !1;
|
|
865
|
+
if (Ve.test(e)) return !0;
|
|
866
|
+
if (e.includes("")) {
|
|
867
|
+
let t = e.match(He);
|
|
868
|
+
return t !== null && t.length >= 2;
|
|
869
|
+
}
|
|
870
|
+
return !1;
|
|
871
|
+
}
|
|
872
|
+
function We(e) {
|
|
873
|
+
return e.replace(Re, "");
|
|
874
|
+
}
|
|
875
|
+
function Ge(e) {
|
|
876
|
+
return Le.test(e);
|
|
877
|
+
}
|
|
878
|
+
function Ke(e) {
|
|
879
|
+
return e >= 4352 && e <= 4447 || e >= 43360 && e <= 43388;
|
|
880
|
+
}
|
|
881
|
+
function qe(e) {
|
|
882
|
+
return e >= 4448 && e <= 4519 || e >= 55216 && e <= 55238;
|
|
883
|
+
}
|
|
884
|
+
function Je(e) {
|
|
885
|
+
return e >= 4520 && e <= 4607 || e >= 55243 && e <= 55291;
|
|
886
|
+
}
|
|
887
|
+
function Ye(e) {
|
|
888
|
+
return Ke(e) || qe(e) || Je(e);
|
|
889
|
+
}
|
|
890
|
+
function Xe(e, t) {
|
|
891
|
+
let n = [];
|
|
892
|
+
for (let t of e) Le.test(t) || n.push(t.codePointAt(0));
|
|
893
|
+
if (n.length === 0) return;
|
|
894
|
+
let r = 0;
|
|
895
|
+
for (let e = 0; e < n.length; e++) {
|
|
896
|
+
let i = n[e];
|
|
897
|
+
if (!Ye(i)) {
|
|
898
|
+
if (r === 0) return;
|
|
899
|
+
for (let i = e; i < n.length; i++) r += S(n[i], t);
|
|
900
|
+
return r;
|
|
901
|
+
}
|
|
902
|
+
if (Ke(i) && qe(n[e + 1])) {
|
|
903
|
+
r += 2, e += Je(n[e + 2]) ? 2 : 1;
|
|
904
|
+
continue;
|
|
905
|
+
}
|
|
906
|
+
r += S(i, t);
|
|
907
|
+
}
|
|
908
|
+
return r;
|
|
909
|
+
}
|
|
910
|
+
function Ze(e, t) {
|
|
911
|
+
let n = 0, r = !0;
|
|
912
|
+
for (let i of e) {
|
|
913
|
+
if (r) {
|
|
914
|
+
r = !1;
|
|
915
|
+
continue;
|
|
916
|
+
}
|
|
917
|
+
(ze.test(i) || i >= "" && i <= "") && (n += S(i.codePointAt(0), t));
|
|
918
|
+
}
|
|
919
|
+
return n;
|
|
920
|
+
}
|
|
921
|
+
function Qe(e, t = {}) {
|
|
922
|
+
if (typeof e != "string" || e.length === 0) return 0;
|
|
923
|
+
let { ambiguousIsNarrow: n = !0, countAnsiEscapeCodes: r = !1 } = t, i = e;
|
|
924
|
+
if (!r && (i.includes("\x1B") || i.includes("")) && (i = Ce(i)), i.length === 0) return 0;
|
|
925
|
+
if (/^[\u0020-\u007E]*$/.test(i)) return i.length;
|
|
926
|
+
let a = 0, o = { ambiguousAsWide: !n };
|
|
927
|
+
for (let { segment: e } of Ie.segment(i)) {
|
|
928
|
+
if (Ge(e)) continue;
|
|
929
|
+
if (Be.test(e) || Ue(e)) {
|
|
930
|
+
a += 2;
|
|
931
|
+
continue;
|
|
932
|
+
}
|
|
933
|
+
let t = We(e), n = Xe(t, o);
|
|
934
|
+
if (n !== void 0) {
|
|
935
|
+
a += n;
|
|
936
|
+
continue;
|
|
937
|
+
}
|
|
938
|
+
let r = t.codePointAt(0);
|
|
939
|
+
a += S(r, o), a += Ze(t, o);
|
|
940
|
+
}
|
|
941
|
+
return a;
|
|
942
|
+
}
|
|
943
|
+
//#endregion
|
|
944
|
+
//#region node_modules/.pnpm/ansi-styles@6.2.3/node_modules/ansi-styles/index.js
|
|
945
|
+
var $e = 10, et = (e = 0) => (t) => `\u001B[${t + e}m`, tt = (e = 0) => (t) => `\u001B[${38 + e};5;${t}m`, nt = (e = 0) => (t, n, r) => `\u001B[${38 + e};2;${t};${n};${r}m`, C = {
|
|
946
|
+
modifier: {
|
|
947
|
+
reset: [0, 0],
|
|
948
|
+
bold: [1, 22],
|
|
949
|
+
dim: [2, 22],
|
|
950
|
+
italic: [3, 23],
|
|
951
|
+
underline: [4, 24],
|
|
952
|
+
overline: [53, 55],
|
|
953
|
+
inverse: [7, 27],
|
|
954
|
+
hidden: [8, 28],
|
|
955
|
+
strikethrough: [9, 29]
|
|
956
|
+
},
|
|
957
|
+
color: {
|
|
958
|
+
black: [30, 39],
|
|
959
|
+
red: [31, 39],
|
|
960
|
+
green: [32, 39],
|
|
961
|
+
yellow: [33, 39],
|
|
962
|
+
blue: [34, 39],
|
|
963
|
+
magenta: [35, 39],
|
|
964
|
+
cyan: [36, 39],
|
|
965
|
+
white: [37, 39],
|
|
966
|
+
blackBright: [90, 39],
|
|
967
|
+
gray: [90, 39],
|
|
968
|
+
grey: [90, 39],
|
|
969
|
+
redBright: [91, 39],
|
|
970
|
+
greenBright: [92, 39],
|
|
971
|
+
yellowBright: [93, 39],
|
|
972
|
+
blueBright: [94, 39],
|
|
973
|
+
magentaBright: [95, 39],
|
|
974
|
+
cyanBright: [96, 39],
|
|
975
|
+
whiteBright: [97, 39]
|
|
976
|
+
},
|
|
977
|
+
bgColor: {
|
|
978
|
+
bgBlack: [40, 49],
|
|
979
|
+
bgRed: [41, 49],
|
|
980
|
+
bgGreen: [42, 49],
|
|
981
|
+
bgYellow: [43, 49],
|
|
982
|
+
bgBlue: [44, 49],
|
|
983
|
+
bgMagenta: [45, 49],
|
|
984
|
+
bgCyan: [46, 49],
|
|
985
|
+
bgWhite: [47, 49],
|
|
986
|
+
bgBlackBright: [100, 49],
|
|
987
|
+
bgGray: [100, 49],
|
|
988
|
+
bgGrey: [100, 49],
|
|
989
|
+
bgRedBright: [101, 49],
|
|
990
|
+
bgGreenBright: [102, 49],
|
|
991
|
+
bgYellowBright: [103, 49],
|
|
992
|
+
bgBlueBright: [104, 49],
|
|
993
|
+
bgMagentaBright: [105, 49],
|
|
994
|
+
bgCyanBright: [106, 49],
|
|
995
|
+
bgWhiteBright: [107, 49]
|
|
996
|
+
}
|
|
997
|
+
};
|
|
998
|
+
Object.keys(C.modifier);
|
|
999
|
+
var rt = Object.keys(C.color), it = Object.keys(C.bgColor);
|
|
1000
|
+
[...rt, ...it];
|
|
1001
|
+
function at() {
|
|
1002
|
+
let e = /* @__PURE__ */ new Map();
|
|
1003
|
+
for (let [t, n] of Object.entries(C)) {
|
|
1004
|
+
for (let [t, r] of Object.entries(n)) C[t] = {
|
|
1005
|
+
open: `\u001B[${r[0]}m`,
|
|
1006
|
+
close: `\u001B[${r[1]}m`
|
|
1007
|
+
}, n[t] = C[t], e.set(r[0], r[1]);
|
|
1008
|
+
Object.defineProperty(C, t, {
|
|
1009
|
+
value: n,
|
|
1010
|
+
enumerable: !1
|
|
1011
|
+
});
|
|
1012
|
+
}
|
|
1013
|
+
return Object.defineProperty(C, "codes", {
|
|
1014
|
+
value: e,
|
|
1015
|
+
enumerable: !1
|
|
1016
|
+
}), C.color.close = "\x1B[39m", C.bgColor.close = "\x1B[49m", C.color.ansi = et(), C.color.ansi256 = tt(), C.color.ansi16m = nt(), C.bgColor.ansi = et($e), C.bgColor.ansi256 = tt($e), C.bgColor.ansi16m = nt($e), Object.defineProperties(C, {
|
|
1017
|
+
rgbToAnsi256: {
|
|
1018
|
+
value(e, t, n) {
|
|
1019
|
+
return e === t && t === n ? e < 8 ? 16 : e > 248 ? 231 : Math.round((e - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(e / 255 * 5) + 6 * Math.round(t / 255 * 5) + Math.round(n / 255 * 5);
|
|
1020
|
+
},
|
|
1021
|
+
enumerable: !1
|
|
1022
|
+
},
|
|
1023
|
+
hexToRgb: {
|
|
1024
|
+
value(e) {
|
|
1025
|
+
let t = /[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));
|
|
1026
|
+
if (!t) return [
|
|
1027
|
+
0,
|
|
1028
|
+
0,
|
|
1029
|
+
0
|
|
1030
|
+
];
|
|
1031
|
+
let [n] = t;
|
|
1032
|
+
n.length === 3 && (n = [...n].map((e) => e + e).join(""));
|
|
1033
|
+
let r = Number.parseInt(n, 16);
|
|
1034
|
+
return [
|
|
1035
|
+
r >> 16 & 255,
|
|
1036
|
+
r >> 8 & 255,
|
|
1037
|
+
r & 255
|
|
1038
|
+
];
|
|
1039
|
+
},
|
|
1040
|
+
enumerable: !1
|
|
1041
|
+
},
|
|
1042
|
+
hexToAnsi256: {
|
|
1043
|
+
value: (e) => C.rgbToAnsi256(...C.hexToRgb(e)),
|
|
1044
|
+
enumerable: !1
|
|
1045
|
+
},
|
|
1046
|
+
ansi256ToAnsi: {
|
|
1047
|
+
value(e) {
|
|
1048
|
+
if (e < 8) return 30 + e;
|
|
1049
|
+
if (e < 16) return 90 + (e - 8);
|
|
1050
|
+
let t, n, r;
|
|
1051
|
+
if (e >= 232) t = ((e - 232) * 10 + 8) / 255, n = t, r = t;
|
|
1052
|
+
else {
|
|
1053
|
+
e -= 16;
|
|
1054
|
+
let i = e % 36;
|
|
1055
|
+
t = Math.floor(e / 36) / 5, n = Math.floor(i / 6) / 5, r = i % 6 / 5;
|
|
1056
|
+
}
|
|
1057
|
+
let i = Math.max(t, n, r) * 2;
|
|
1058
|
+
if (i === 0) return 30;
|
|
1059
|
+
let a = 30 + (Math.round(r) << 2 | Math.round(n) << 1 | Math.round(t));
|
|
1060
|
+
return i === 2 && (a += 60), a;
|
|
1061
|
+
},
|
|
1062
|
+
enumerable: !1
|
|
1063
|
+
},
|
|
1064
|
+
rgbToAnsi: {
|
|
1065
|
+
value: (e, t, n) => C.ansi256ToAnsi(C.rgbToAnsi256(e, t, n)),
|
|
1066
|
+
enumerable: !1
|
|
1067
|
+
},
|
|
1068
|
+
hexToAnsi: {
|
|
1069
|
+
value: (e) => C.ansi256ToAnsi(C.hexToAnsi256(e)),
|
|
1070
|
+
enumerable: !1
|
|
1071
|
+
}
|
|
1072
|
+
}), C;
|
|
1073
|
+
}
|
|
1074
|
+
var w = at(), T = "\x1B", ot = "\x07", st = "", ct = "[", lt = "]", ut = "m", E = 0, dt = 39, ft = 49, pt = 59, D = 38, O = 48, k = 58, mt = 2, ht = 5, gt = `${lt}8;`, _t = /* @__PURE__ */ new Set([T, st]), vt = [..._t].join(""), yt = `(?:${T}\\${ct}|${st})`, bt = "[0-?]*[ -/]*[@-~]", xt = `(?<sgr>[0-9;:]*)${ut}`, St = `(?:${ot}|${T}\\\\)`, Ct = String.raw`[^\u0000-\u001F\u007F-\u009F]*`, wt = String.raw`8;(?<parameters>[^;\u0000-\u001F\u007F-\u009F]*);(?<uri>${Ct})${St}`, Tt = `${Ct}${St}`, Et = RegExp(`${yt}(?:${xt}|${bt})|${T}\\${lt}(?:${wt}|${Tt})`, "y"), Dt = new Set(w.codes.values());
|
|
1075
|
+
Dt.delete(E);
|
|
1076
|
+
var Ot = new Intl.Segmenter(), A = (e) => Qe(e, { countAnsiEscapeCodes: !0 }), kt = 8, At = RegExp(`[${vt}]`, "g"), jt = RegExp(`[\\n${vt}]`, "g"), Mt = /^[ -~]*$/, Nt = (e) => `${T}${ct}${e}${ut}`, Pt = (e, t = "") => `${T}${gt}${t};${e}${ot}`, j = (e, t) => {
|
|
1077
|
+
if (_t.has(e[t])) return Et.lastIndex = t, Et.exec(e) ?? void 0;
|
|
1078
|
+
}, M = (e, t, n = () => {}) => {
|
|
1079
|
+
let r = 0, i = 0;
|
|
1080
|
+
for (; i < e.length;) {
|
|
1081
|
+
At.lastIndex = i;
|
|
1082
|
+
let a = At.exec(e);
|
|
1083
|
+
if (!a) break;
|
|
1084
|
+
let o = j(e, a.index);
|
|
1085
|
+
if (!o) {
|
|
1086
|
+
i = a.index + 1;
|
|
1087
|
+
continue;
|
|
1088
|
+
}
|
|
1089
|
+
a.index > r && t(e.slice(r, a.index)), n(o[0]), i = a.index + o[0].length, r = i;
|
|
1090
|
+
}
|
|
1091
|
+
r < e.length && t(e.slice(r));
|
|
1092
|
+
}, Ft = (e) => {
|
|
1093
|
+
let t = "";
|
|
1094
|
+
return M(e, (e) => {
|
|
1095
|
+
t += e;
|
|
1096
|
+
}), A(t);
|
|
1097
|
+
}, It = (e) => {
|
|
1098
|
+
let t = [];
|
|
1099
|
+
return M(e, (e) => {
|
|
1100
|
+
if (Mt.test(e)) {
|
|
1101
|
+
for (let n of e) t.push({
|
|
1102
|
+
value: n,
|
|
1103
|
+
width: 1
|
|
1104
|
+
});
|
|
1105
|
+
return;
|
|
1106
|
+
}
|
|
1107
|
+
for (let { segment: n } of Ot.segment(e)) t.push({
|
|
1108
|
+
value: n,
|
|
1109
|
+
width: A(n)
|
|
1110
|
+
});
|
|
1111
|
+
}, (e) => {
|
|
1112
|
+
t.push({
|
|
1113
|
+
value: e,
|
|
1114
|
+
width: 0
|
|
1115
|
+
});
|
|
1116
|
+
}), t;
|
|
1117
|
+
}, Lt = (e) => {
|
|
1118
|
+
let t = {
|
|
1119
|
+
value: "",
|
|
1120
|
+
plainText: ""
|
|
1121
|
+
}, n = [t];
|
|
1122
|
+
M(e, (e) => {
|
|
1123
|
+
let r = e.split(" ");
|
|
1124
|
+
t.value += r[0], t.plainText += r[0];
|
|
1125
|
+
for (let e = 1; e < r.length; e++) t = {
|
|
1126
|
+
value: r[e],
|
|
1127
|
+
plainText: r[e]
|
|
1128
|
+
}, n.push(t);
|
|
1129
|
+
}, (e) => {
|
|
1130
|
+
t.value += e;
|
|
1131
|
+
});
|
|
1132
|
+
for (let e of n) e.width = A(e.plainText);
|
|
1133
|
+
return n;
|
|
1134
|
+
}, Rt = (e) => {
|
|
1135
|
+
let t = e.split(":"), n = Number.parseInt(t[0], 10), r = Number.parseInt(t[1], 10);
|
|
1136
|
+
if (![
|
|
1137
|
+
D,
|
|
1138
|
+
O,
|
|
1139
|
+
k
|
|
1140
|
+
].includes(n)) return;
|
|
1141
|
+
if (r === ht && t.length === 3 && /^\d+$/.test(t[2])) return {
|
|
1142
|
+
code: n,
|
|
1143
|
+
open: e,
|
|
1144
|
+
hasArguments: !0
|
|
1145
|
+
};
|
|
1146
|
+
if (r !== mt) return;
|
|
1147
|
+
let i = t.length === 6 ? t.slice(3) : t.slice(2), a = t.length === 6 ? t[2] : void 0;
|
|
1148
|
+
if (i.length === 3 && i.every((e) => /^\d+$/.test(e)) && (a === void 0 || /^\d*$/.test(a))) return {
|
|
1149
|
+
code: n,
|
|
1150
|
+
open: e,
|
|
1151
|
+
hasArguments: !0
|
|
1152
|
+
};
|
|
1153
|
+
}, zt = (e) => {
|
|
1154
|
+
let t = e.split(";"), n = [];
|
|
1155
|
+
for (let e = 0; e < t.length; e++) {
|
|
1156
|
+
let r = t[e];
|
|
1157
|
+
if (r.includes(":")) {
|
|
1158
|
+
let e = Rt(r);
|
|
1159
|
+
e && n.push(e);
|
|
1160
|
+
continue;
|
|
1161
|
+
}
|
|
1162
|
+
let i = r === "" ? E : Number.parseInt(r, 10);
|
|
1163
|
+
if (Number.isFinite(i)) {
|
|
1164
|
+
if (i === D || i === O || i === k) {
|
|
1165
|
+
if (e + 1 >= t.length) break;
|
|
1166
|
+
let r = Number.parseInt(t[e + 1], 10), a = Number.parseInt(t[e + 2], 10);
|
|
1167
|
+
if (r === ht && Number.isFinite(a)) {
|
|
1168
|
+
n.push({
|
|
1169
|
+
code: i,
|
|
1170
|
+
open: [
|
|
1171
|
+
i,
|
|
1172
|
+
r,
|
|
1173
|
+
a
|
|
1174
|
+
].join(";"),
|
|
1175
|
+
hasArguments: !0
|
|
1176
|
+
}), e += 2;
|
|
1177
|
+
continue;
|
|
1178
|
+
}
|
|
1179
|
+
let o = Number.parseInt(t[e + 2], 10), s = Number.parseInt(t[e + 3], 10), c = Number.parseInt(t[e + 4], 10);
|
|
1180
|
+
if (r === mt && Number.isFinite(o) && Number.isFinite(s) && Number.isFinite(c)) {
|
|
1181
|
+
n.push({
|
|
1182
|
+
code: i,
|
|
1183
|
+
open: [
|
|
1184
|
+
i,
|
|
1185
|
+
r,
|
|
1186
|
+
o,
|
|
1187
|
+
s,
|
|
1188
|
+
c
|
|
1189
|
+
].join(";"),
|
|
1190
|
+
hasArguments: !0
|
|
1191
|
+
}), e += 4;
|
|
1192
|
+
continue;
|
|
1193
|
+
}
|
|
1194
|
+
break;
|
|
1195
|
+
}
|
|
1196
|
+
n.push({
|
|
1197
|
+
code: i,
|
|
1198
|
+
open: String(i),
|
|
1199
|
+
hasArguments: !1
|
|
1200
|
+
});
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
return n;
|
|
1204
|
+
}, N = (e, t) => {
|
|
1205
|
+
let n = e.findIndex((e) => e.family === t);
|
|
1206
|
+
n !== -1 && e.splice(n, 1);
|
|
1207
|
+
}, Bt = (e, t) => {
|
|
1208
|
+
N(e, t.family), e.push(t);
|
|
1209
|
+
}, Vt = (e, t) => {
|
|
1210
|
+
for (let n = e.length - 1; n >= 0; n--) {
|
|
1211
|
+
let r = e[n];
|
|
1212
|
+
r.family.startsWith("modifier-") && r.close === t && e.splice(n, 1);
|
|
1213
|
+
}
|
|
1214
|
+
}, Ht = (e) => {
|
|
1215
|
+
let { code: t, open: n, hasArguments: r } = e;
|
|
1216
|
+
if (t >= 30 && t <= 37 || t >= 90 && t <= 97 || t === D && r) return {
|
|
1217
|
+
family: "foreground",
|
|
1218
|
+
open: n,
|
|
1219
|
+
close: dt
|
|
1220
|
+
};
|
|
1221
|
+
if (t >= 40 && t <= 47 || t >= 100 && t <= 107 || t === O && r) return {
|
|
1222
|
+
family: "background",
|
|
1223
|
+
open: n,
|
|
1224
|
+
close: ft
|
|
1225
|
+
};
|
|
1226
|
+
if (t === k && r) return {
|
|
1227
|
+
family: "underlineColor",
|
|
1228
|
+
open: n,
|
|
1229
|
+
close: pt
|
|
1230
|
+
};
|
|
1231
|
+
}, Ut = (e, t) => e === E ? (t.length = 0, !0) : e === dt ? (N(t, "foreground"), !0) : e === ft ? (N(t, "background"), !0) : e === pt ? (N(t, "underlineColor"), !0) : Dt.has(e) ? (Vt(t, e), !0) : !1, Wt = (e, t) => {
|
|
1232
|
+
let { code: n } = e;
|
|
1233
|
+
if (Ut(n, t)) return;
|
|
1234
|
+
let r = Ht(e);
|
|
1235
|
+
if (r) {
|
|
1236
|
+
Bt(t, r);
|
|
1237
|
+
return;
|
|
1238
|
+
}
|
|
1239
|
+
let i = w.codes.get(n);
|
|
1240
|
+
i !== void 0 && i !== E && Bt(t, {
|
|
1241
|
+
family: `modifier-${n}`,
|
|
1242
|
+
open: e.open,
|
|
1243
|
+
close: i
|
|
1244
|
+
});
|
|
1245
|
+
}, Gt = (e, t) => {
|
|
1246
|
+
for (let n of zt(e)) Wt(n, t);
|
|
1247
|
+
}, Kt = (e, t) => {
|
|
1248
|
+
for (let { code: n } of zt(e)) Ut(n, t);
|
|
1249
|
+
}, qt = (e, t, n) => {
|
|
1250
|
+
let r = t;
|
|
1251
|
+
for (; r < e.length;) {
|
|
1252
|
+
let t = j(e, r);
|
|
1253
|
+
if (!t) break;
|
|
1254
|
+
t.groups.sgr !== void 0 && Kt(t.groups.sgr, n), r += t[0].length;
|
|
1255
|
+
}
|
|
1256
|
+
}, Jt = (e) => [...e].reverse().map((e) => Nt(e.close)).join(""), Yt = (e) => e.map((e) => Nt(e.open)).join(""), P = (e, t, n, r) => {
|
|
1257
|
+
let i = It(t), a = r;
|
|
1258
|
+
for (let t = 0; t < i.length; t++) {
|
|
1259
|
+
let r = i[t];
|
|
1260
|
+
r.width > 0 && a > 0 && a + r.width > n && (e.push(""), a = 0), e[e.length - 1] += r.value, a += r.width, a === n && t < i.length - 1 && (e.push(""), a = 0);
|
|
1261
|
+
}
|
|
1262
|
+
return !a && e.at(-1).length > 0 && e.length > 1 && (e[e.length - 2] += e.pop()), Ft(e.at(-1));
|
|
1263
|
+
}, Xt = (e) => {
|
|
1264
|
+
if (!e.includes(" ")) return e;
|
|
1265
|
+
let t = [];
|
|
1266
|
+
M(e, (e) => {
|
|
1267
|
+
t.push({
|
|
1268
|
+
value: e,
|
|
1269
|
+
isEscape: !1
|
|
1270
|
+
});
|
|
1271
|
+
}, (e) => {
|
|
1272
|
+
t.push({
|
|
1273
|
+
value: e,
|
|
1274
|
+
isEscape: !0
|
|
1275
|
+
});
|
|
1276
|
+
});
|
|
1277
|
+
for (let e = t.length - 1; e >= 0; e--) {
|
|
1278
|
+
let n = t[e];
|
|
1279
|
+
if (n.isEscape) continue;
|
|
1280
|
+
let r = n.value.length;
|
|
1281
|
+
for (; r > 0 && n.value[r - 1] === " ";) r--;
|
|
1282
|
+
if (n.value = n.value.slice(0, r), A(n.value) > 0) break;
|
|
1283
|
+
}
|
|
1284
|
+
return t.map((e) => e.value).join("");
|
|
1285
|
+
}, Zt = (e) => {
|
|
1286
|
+
if (!e.includes(" ")) return e;
|
|
1287
|
+
let t = 0, n = "", r = "";
|
|
1288
|
+
return M(e, (e) => {
|
|
1289
|
+
let i = e.split(" ");
|
|
1290
|
+
for (let [e, a] of i.entries()) if (n += a, r += a, e < i.length - 1) {
|
|
1291
|
+
t += A(r), r = "";
|
|
1292
|
+
let e = kt - t % kt;
|
|
1293
|
+
n += " ".repeat(e), t += e;
|
|
1294
|
+
}
|
|
1295
|
+
}, (e) => {
|
|
1296
|
+
n += e;
|
|
1297
|
+
}), n;
|
|
1298
|
+
}, Qt = (e) => {
|
|
1299
|
+
let t = "", n, r = [], i = 0, a = 0;
|
|
1300
|
+
for (; i < e.length;) {
|
|
1301
|
+
jt.lastIndex = i;
|
|
1302
|
+
let o = jt.exec(e);
|
|
1303
|
+
if (!o) break;
|
|
1304
|
+
if (i = o.index, o[0] !== "\n") {
|
|
1305
|
+
let t = j(e, i);
|
|
1306
|
+
if (!t) {
|
|
1307
|
+
i++;
|
|
1308
|
+
continue;
|
|
1309
|
+
}
|
|
1310
|
+
let { groups: a } = t;
|
|
1311
|
+
a.sgr === void 0 ? a.uri !== void 0 && (n = a.uri.length === 0 ? void 0 : {
|
|
1312
|
+
parameters: a.parameters,
|
|
1313
|
+
uri: a.uri
|
|
1314
|
+
}) : Gt(a.sgr, r), i += t[0].length;
|
|
1315
|
+
continue;
|
|
1316
|
+
}
|
|
1317
|
+
if (t += e.slice(a, i), i > a && (n && (t += Pt("")), t += Jt(r)), t += "\n", i++, a = i, i < e.length && e[i] !== "\n") {
|
|
1318
|
+
let a = [...r];
|
|
1319
|
+
qt(e, i, a), t += Yt(a), n && (t += Pt(n.uri, n.parameters));
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
return t + e.slice(a);
|
|
1323
|
+
}, $t = (e, t, n = {}) => {
|
|
1324
|
+
if (n.trim !== !1 && e.trim() === "") return "";
|
|
1325
|
+
let r = Lt(e), i = [""], a = 0, o = -1, s = !0;
|
|
1326
|
+
for (let e of r) {
|
|
1327
|
+
let r = i.length - 1;
|
|
1328
|
+
if (n.trim !== !1 && o !== r) {
|
|
1329
|
+
let e = i[r], t = e.trimStart();
|
|
1330
|
+
t.length !== e.length && (i[r] = t, a = Ft(t)), t.length > 0 && (o = r);
|
|
1331
|
+
}
|
|
1332
|
+
if (s ? s = !1 : (a >= t && (n.wordWrap === !1 || n.trim === !1) && (i.push(""), a = 0), (a > 0 || n.trim === !1) && (i[i.length - 1] += " ", a++)), n.hard && n.wordWrap !== !1 && e.width > t) {
|
|
1333
|
+
let n = t - a, r = 1 + Math.floor((e.width - n - 1) / t);
|
|
1334
|
+
Math.floor((e.width - 1) / t) < r && (i.push(""), a = 0), a = P(i, e.value, t, a);
|
|
1335
|
+
continue;
|
|
1336
|
+
}
|
|
1337
|
+
if (a + e.width > t && a > 0 && e.width > 0) {
|
|
1338
|
+
if (n.wordWrap === !1 && a < t) {
|
|
1339
|
+
a = P(i, e.value, t, a);
|
|
1340
|
+
continue;
|
|
1341
|
+
}
|
|
1342
|
+
i.push(""), a = 0;
|
|
1343
|
+
}
|
|
1344
|
+
if (a + e.width > t && n.wordWrap === !1) {
|
|
1345
|
+
a = P(i, e.value, t, a);
|
|
1346
|
+
continue;
|
|
1347
|
+
}
|
|
1348
|
+
i[i.length - 1] += e.value, a += e.width;
|
|
1349
|
+
}
|
|
1350
|
+
return n.trim !== !1 && (i = i.map((e) => Xt(e))), Qt(i.join("\n"));
|
|
1351
|
+
};
|
|
1352
|
+
function en(e, t, n) {
|
|
1353
|
+
return String(e).normalize().replaceAll("\r\n", "\n").split("\n").map((e) => $t(Zt(e), t, n)).join("\n");
|
|
1354
|
+
}
|
|
1355
|
+
//#endregion
|
|
1356
|
+
//#region node_modules/.pnpm/is-fullwidth-code-point@5.1.0/node_modules/is-fullwidth-code-point/index.js
|
|
1357
|
+
function tn(e) {
|
|
1358
|
+
return Number.isInteger(e) ? Ne(e) || Pe(e) : !1;
|
|
1359
|
+
}
|
|
1360
|
+
//#endregion
|
|
1361
|
+
//#region node_modules/.pnpm/slice-ansi@8.0.0/node_modules/slice-ansi/tokenize-ansi.js
|
|
1362
|
+
var F = 27, nn = 144, rn = 152, an = 155, on = 156, I = 157, sn = 158, cn = 159, L = /* @__PURE__ */ new Set([
|
|
1363
|
+
F,
|
|
1364
|
+
nn,
|
|
1365
|
+
rn,
|
|
1366
|
+
an,
|
|
1367
|
+
on,
|
|
1368
|
+
I,
|
|
1369
|
+
sn,
|
|
1370
|
+
cn
|
|
1371
|
+
]), R = "\x1B", ln = "\x07", un = "[", dn = "]", fn = "P", pn = "X", mn = "^", hn = "_", gn = "m", z = "\\", _n = `${R}${z}`, vn = "", B = "", yn = `${R}${dn}8;`, bn = `${vn}8;`, xn = `${yn};`, Sn = `${bn};`, Cn = "0".codePointAt(0), wn = "9".codePointAt(0), Tn = ";".codePointAt(0), En = ":".codePointAt(0), Dn = "0".codePointAt(0), On = "?".codePointAt(0), kn = " ".codePointAt(0), An = "/".codePointAt(0), jn = "@".codePointAt(0), Mn = "~".codePointAt(0), Nn = 127462, Pn = 127487, Fn = 0, V = 38, In = 39, Ln = 48, Rn = 49, zn = 5, Bn = 2, Vn = 3, Hn = 5, Un = 2, Wn = 4, Gn = 65039, Kn = 8419, qn = /\p{Emoji_Presentation}/u, Jn = new Intl.Segmenter(void 0, { granularity: "grapheme" }), Yn = /* @__PURE__ */ new Set();
|
|
1372
|
+
for (let [, e] of w.codes) Yn.add(e);
|
|
1373
|
+
function Xn(e) {
|
|
1374
|
+
return e >= Cn && e <= wn || e === Tn || e === En;
|
|
1375
|
+
}
|
|
1376
|
+
function Zn(e) {
|
|
1377
|
+
return e >= Dn && e <= On;
|
|
1378
|
+
}
|
|
1379
|
+
function Qn(e) {
|
|
1380
|
+
return e >= kn && e <= An;
|
|
1381
|
+
}
|
|
1382
|
+
function $n(e) {
|
|
1383
|
+
return e >= jn && e <= Mn;
|
|
1384
|
+
}
|
|
1385
|
+
function er(e) {
|
|
1386
|
+
return e >= Nn && e <= Pn;
|
|
1387
|
+
}
|
|
1388
|
+
function H(e, t) {
|
|
1389
|
+
return {
|
|
1390
|
+
token: {
|
|
1391
|
+
type: "control",
|
|
1392
|
+
code: e
|
|
1393
|
+
},
|
|
1394
|
+
endIndex: t
|
|
1395
|
+
};
|
|
1396
|
+
}
|
|
1397
|
+
function tr(e) {
|
|
1398
|
+
if (qn.test(e)) return !0;
|
|
1399
|
+
for (let t of e) {
|
|
1400
|
+
let e = t.codePointAt(0);
|
|
1401
|
+
if (e === Gn || e === Kn) return !0;
|
|
1402
|
+
}
|
|
1403
|
+
return !1;
|
|
1404
|
+
}
|
|
1405
|
+
function nr(e) {
|
|
1406
|
+
let t = 0;
|
|
1407
|
+
for (let n of e) {
|
|
1408
|
+
let e = n.codePointAt(0);
|
|
1409
|
+
if (tn(e)) return 2;
|
|
1410
|
+
er(e) && t++;
|
|
1411
|
+
}
|
|
1412
|
+
return t >= 1 || tr(e) ? 2 : 1;
|
|
1413
|
+
}
|
|
1414
|
+
function rr(e) {
|
|
1415
|
+
return e.startsWith("") ? "" : `${R}${un}`;
|
|
1416
|
+
}
|
|
1417
|
+
function U(e, t) {
|
|
1418
|
+
return `${e}${t.join(";")}${gn}`;
|
|
1419
|
+
}
|
|
1420
|
+
function ir(e) {
|
|
1421
|
+
let t = [], n = rr(e), r;
|
|
1422
|
+
if (e.startsWith(`${R}${un}`)) r = e.slice(2, -1);
|
|
1423
|
+
else if (e.startsWith("")) r = e.slice(1, -1);
|
|
1424
|
+
else return t;
|
|
1425
|
+
let i = r.length === 0 ? [String(Fn)] : r.split(";"), a = 0;
|
|
1426
|
+
for (; a < i.length;) {
|
|
1427
|
+
let e = Number.parseInt(i[a], 10);
|
|
1428
|
+
if (Number.isNaN(e)) {
|
|
1429
|
+
a++;
|
|
1430
|
+
continue;
|
|
1431
|
+
}
|
|
1432
|
+
if (e === Fn) {
|
|
1433
|
+
t.push({ type: "reset" }), a++;
|
|
1434
|
+
continue;
|
|
1435
|
+
}
|
|
1436
|
+
if (e === V || e === Ln) {
|
|
1437
|
+
let r = Number.parseInt(i[a + 1], 10);
|
|
1438
|
+
if (r === zn && a + Un < i.length) {
|
|
1439
|
+
let r = U(n, i.slice(a, a + Vn));
|
|
1440
|
+
t.push({
|
|
1441
|
+
type: "start",
|
|
1442
|
+
code: r,
|
|
1443
|
+
endCode: w.color.ansi(e === V ? In : Rn)
|
|
1444
|
+
}), a += Vn;
|
|
1445
|
+
continue;
|
|
1446
|
+
}
|
|
1447
|
+
if (r === Bn && a + Wn < i.length) {
|
|
1448
|
+
let r = U(n, i.slice(a, a + Hn));
|
|
1449
|
+
t.push({
|
|
1450
|
+
type: "start",
|
|
1451
|
+
code: r,
|
|
1452
|
+
endCode: w.color.ansi(e === V ? In : Rn)
|
|
1453
|
+
}), a += Hn;
|
|
1454
|
+
continue;
|
|
1455
|
+
}
|
|
1456
|
+
let o = U(n, [i[a]]);
|
|
1457
|
+
t.push({
|
|
1458
|
+
type: "start",
|
|
1459
|
+
code: o,
|
|
1460
|
+
endCode: w.color.ansi(e === V ? In : Rn)
|
|
1461
|
+
}), a++;
|
|
1462
|
+
continue;
|
|
1463
|
+
}
|
|
1464
|
+
if (Yn.has(e)) {
|
|
1465
|
+
t.push({
|
|
1466
|
+
type: "end",
|
|
1467
|
+
endCode: w.color.ansi(e)
|
|
1468
|
+
}), a++;
|
|
1469
|
+
continue;
|
|
1470
|
+
}
|
|
1471
|
+
let r = w.codes.get(e);
|
|
1472
|
+
if (r !== void 0) {
|
|
1473
|
+
let e = U(n, [i[a]]);
|
|
1474
|
+
t.push({
|
|
1475
|
+
type: "start",
|
|
1476
|
+
code: e,
|
|
1477
|
+
endCode: w.color.ansi(r)
|
|
1478
|
+
}), a++;
|
|
1479
|
+
continue;
|
|
1480
|
+
}
|
|
1481
|
+
let o = U(n, [i[a]]);
|
|
1482
|
+
t.push({
|
|
1483
|
+
type: "start",
|
|
1484
|
+
code: o,
|
|
1485
|
+
endCode: w.reset.open
|
|
1486
|
+
}), a++;
|
|
1487
|
+
}
|
|
1488
|
+
return t.length === 0 && t.push({ type: "reset" }), t;
|
|
1489
|
+
}
|
|
1490
|
+
function ar(e, t) {
|
|
1491
|
+
let n = e.codePointAt(t), r;
|
|
1492
|
+
if (n === F) {
|
|
1493
|
+
if (e[t + 1] !== un) return;
|
|
1494
|
+
r = t + 2;
|
|
1495
|
+
} else if (n === an) r = t + 1;
|
|
1496
|
+
else return;
|
|
1497
|
+
let i = !0;
|
|
1498
|
+
for (let n = r; n < e.length; n++) {
|
|
1499
|
+
let r = e.codePointAt(n);
|
|
1500
|
+
if ($n(r)) {
|
|
1501
|
+
let r = e.slice(t, n + 1);
|
|
1502
|
+
return e[n] !== gn || !i ? H(r, n + 1) : {
|
|
1503
|
+
token: {
|
|
1504
|
+
type: "sgr",
|
|
1505
|
+
code: r,
|
|
1506
|
+
fragments: ir(r)
|
|
1507
|
+
},
|
|
1508
|
+
endIndex: n + 1
|
|
1509
|
+
};
|
|
1510
|
+
}
|
|
1511
|
+
if (Zn(r)) {
|
|
1512
|
+
Xn(r) || (i = !1);
|
|
1513
|
+
continue;
|
|
1514
|
+
}
|
|
1515
|
+
if (Qn(r)) {
|
|
1516
|
+
i = !1;
|
|
1517
|
+
continue;
|
|
1518
|
+
}
|
|
1519
|
+
let a = n;
|
|
1520
|
+
return H(e.slice(t, a), a);
|
|
1521
|
+
}
|
|
1522
|
+
return H(e.slice(t), e.length);
|
|
1523
|
+
}
|
|
1524
|
+
function or(e, t) {
|
|
1525
|
+
let n, r, i = e.codePointAt(t);
|
|
1526
|
+
if (i === F && e.startsWith(yn, t)) n = yn, r = xn;
|
|
1527
|
+
else if (i === I && e.startsWith(bn, t)) n = bn, r = Sn;
|
|
1528
|
+
else return;
|
|
1529
|
+
let a = e.indexOf(";", t + n.length);
|
|
1530
|
+
if (a === -1) return H(e.slice(t), e.length);
|
|
1531
|
+
for (let n = a + 1; n < e.length; n++) {
|
|
1532
|
+
let i = e[n];
|
|
1533
|
+
if (i === ln) return {
|
|
1534
|
+
token: {
|
|
1535
|
+
type: "hyperlink",
|
|
1536
|
+
code: e.slice(t, n + 1),
|
|
1537
|
+
action: n === a + 1 ? "close" : "open",
|
|
1538
|
+
closePrefix: r,
|
|
1539
|
+
terminator: ln
|
|
1540
|
+
},
|
|
1541
|
+
endIndex: n + 1
|
|
1542
|
+
};
|
|
1543
|
+
if (i === R && e[n + 1] === z) return {
|
|
1544
|
+
token: {
|
|
1545
|
+
type: "hyperlink",
|
|
1546
|
+
code: e.slice(t, n + 2),
|
|
1547
|
+
action: n === a + 1 ? "close" : "open",
|
|
1548
|
+
closePrefix: r,
|
|
1549
|
+
terminator: _n
|
|
1550
|
+
},
|
|
1551
|
+
endIndex: n + 2
|
|
1552
|
+
};
|
|
1553
|
+
if (i === B) return {
|
|
1554
|
+
token: {
|
|
1555
|
+
type: "hyperlink",
|
|
1556
|
+
code: e.slice(t, n + 1),
|
|
1557
|
+
action: n === a + 1 ? "close" : "open",
|
|
1558
|
+
closePrefix: r,
|
|
1559
|
+
terminator: B
|
|
1560
|
+
},
|
|
1561
|
+
endIndex: n + 1
|
|
1562
|
+
};
|
|
1563
|
+
}
|
|
1564
|
+
return H(e.slice(t), e.length);
|
|
1565
|
+
}
|
|
1566
|
+
function sr(e, t) {
|
|
1567
|
+
let n = e.codePointAt(t), r, i = !1;
|
|
1568
|
+
switch (n) {
|
|
1569
|
+
case F:
|
|
1570
|
+
switch (e[t + 1]) {
|
|
1571
|
+
case dn:
|
|
1572
|
+
r = t + 2, i = !0;
|
|
1573
|
+
break;
|
|
1574
|
+
case fn:
|
|
1575
|
+
case pn:
|
|
1576
|
+
case mn:
|
|
1577
|
+
case hn:
|
|
1578
|
+
r = t + 2;
|
|
1579
|
+
break;
|
|
1580
|
+
case z: return H(_n, t + 2);
|
|
1581
|
+
default: return;
|
|
1582
|
+
}
|
|
1583
|
+
break;
|
|
1584
|
+
case I:
|
|
1585
|
+
r = t + 1, i = !0;
|
|
1586
|
+
break;
|
|
1587
|
+
case nn:
|
|
1588
|
+
case rn:
|
|
1589
|
+
case sn:
|
|
1590
|
+
case cn:
|
|
1591
|
+
r = t + 1;
|
|
1592
|
+
break;
|
|
1593
|
+
case on: return H(B, t + 1);
|
|
1594
|
+
default: return;
|
|
1595
|
+
}
|
|
1596
|
+
for (let n = r; n < e.length; n++) {
|
|
1597
|
+
if (i && e[n] === ln) return H(e.slice(t, n + 1), n + 1);
|
|
1598
|
+
if (e[n] === R && e[n + 1] === z) return H(e.slice(t, n + 2), n + 2);
|
|
1599
|
+
if (e[n] === B) return H(e.slice(t, n + 1), n + 1);
|
|
1600
|
+
}
|
|
1601
|
+
return H(e.slice(t), e.length);
|
|
1602
|
+
}
|
|
1603
|
+
function W(e, t) {
|
|
1604
|
+
let n = e.codePointAt(t);
|
|
1605
|
+
if (n === F || n === I) {
|
|
1606
|
+
let n = or(e, t);
|
|
1607
|
+
if (n) return n;
|
|
1608
|
+
}
|
|
1609
|
+
return sr(e, t) || ar(e, t);
|
|
1610
|
+
}
|
|
1611
|
+
function cr(e, t, n) {
|
|
1612
|
+
for (; t < e.length;) {
|
|
1613
|
+
let r = e.codePointAt(t);
|
|
1614
|
+
if (!L.has(r)) break;
|
|
1615
|
+
let i = W(e, t);
|
|
1616
|
+
if (!i) break;
|
|
1617
|
+
n.push(i.token), t = i.endIndex;
|
|
1618
|
+
}
|
|
1619
|
+
return t;
|
|
1620
|
+
}
|
|
1621
|
+
function lr(e, t, n) {
|
|
1622
|
+
let r = n.containing(t);
|
|
1623
|
+
if (!(!r || r.index !== t)) return {
|
|
1624
|
+
token: {
|
|
1625
|
+
type: "character",
|
|
1626
|
+
value: r.segment,
|
|
1627
|
+
visibleWidth: nr(r.segment),
|
|
1628
|
+
isGraphemeContinuation: !1
|
|
1629
|
+
},
|
|
1630
|
+
endIndex: t + r.segment.length
|
|
1631
|
+
};
|
|
1632
|
+
}
|
|
1633
|
+
function ur(e) {
|
|
1634
|
+
let t = [], n = 0;
|
|
1635
|
+
for (; n < e.length;) {
|
|
1636
|
+
let r = e.codePointAt(n);
|
|
1637
|
+
if (L.has(r)) {
|
|
1638
|
+
let t = W(e, n);
|
|
1639
|
+
if (t) {
|
|
1640
|
+
n = t.endIndex;
|
|
1641
|
+
continue;
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
let i = String.fromCodePoint(r);
|
|
1645
|
+
t.push({
|
|
1646
|
+
value: i,
|
|
1647
|
+
visibleWidth: 1,
|
|
1648
|
+
isGraphemeContinuation: !1
|
|
1649
|
+
}), n += i.length;
|
|
1650
|
+
}
|
|
1651
|
+
return t;
|
|
1652
|
+
}
|
|
1653
|
+
function dr(e) {
|
|
1654
|
+
if (e.length === 0) return;
|
|
1655
|
+
let t = e.map(({ value: e }) => e).join(""), n = [], r = 0;
|
|
1656
|
+
for (let t of e) n.push(r), r += t.value.length;
|
|
1657
|
+
let i = 0;
|
|
1658
|
+
for (let r of Jn.segment(t)) {
|
|
1659
|
+
for (; i < e.length && n[i] < r.index;) i++;
|
|
1660
|
+
let t = i, a = !0;
|
|
1661
|
+
for (; t < e.length && n[t] < r.index + r.segment.length;) e[t].visibleWidth = a ? nr(r.segment) : 0, e[t].isGraphemeContinuation = !a, a = !1, t++;
|
|
1662
|
+
i = t;
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
function fr(e, { endCharacter: t = Infinity } = {}) {
|
|
1666
|
+
let n = [], r = ur(e);
|
|
1667
|
+
dr(r);
|
|
1668
|
+
let i = 0, a = 0, o = 0;
|
|
1669
|
+
for (; i < e.length;) {
|
|
1670
|
+
let s = e.codePointAt(i);
|
|
1671
|
+
if (L.has(s)) {
|
|
1672
|
+
let t = W(e, i);
|
|
1673
|
+
if (t) {
|
|
1674
|
+
n.push(t.token), i = t.endIndex;
|
|
1675
|
+
continue;
|
|
1676
|
+
}
|
|
1677
|
+
}
|
|
1678
|
+
let c = String.fromCodePoint(s), l = r[a], u = tn(s) ? 2 : c.length;
|
|
1679
|
+
l && (u = l.visibleWidth);
|
|
1680
|
+
let d = {
|
|
1681
|
+
type: "character",
|
|
1682
|
+
value: c,
|
|
1683
|
+
visibleWidth: u,
|
|
1684
|
+
isGraphemeContinuation: l ? l.isGraphemeContinuation : !1
|
|
1685
|
+
};
|
|
1686
|
+
if (n.push(d), i += c.length, a++, o += d.visibleWidth, o >= t) {
|
|
1687
|
+
let t = r[a];
|
|
1688
|
+
if (!t || !t.isGraphemeContinuation) {
|
|
1689
|
+
i = cr(e, i, n);
|
|
1690
|
+
break;
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1694
|
+
return n;
|
|
1695
|
+
}
|
|
1696
|
+
function pr(e, t) {
|
|
1697
|
+
let n = `${e}${t}`, r = e.length;
|
|
1698
|
+
for (let e of Jn.segment(n)) {
|
|
1699
|
+
if (e.index === r) return !1;
|
|
1700
|
+
if (e.index > r) return !0;
|
|
1701
|
+
}
|
|
1702
|
+
return !0;
|
|
1703
|
+
}
|
|
1704
|
+
function mr(e, t, n, r) {
|
|
1705
|
+
if (!n) return !1;
|
|
1706
|
+
let i = t, a = !1;
|
|
1707
|
+
for (; i < e.length;) {
|
|
1708
|
+
let t = e.codePointAt(i);
|
|
1709
|
+
if (L.has(t)) {
|
|
1710
|
+
let t = W(e, i);
|
|
1711
|
+
if (t) {
|
|
1712
|
+
a = !0, i = t.endIndex;
|
|
1713
|
+
continue;
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
if (!a) return !1;
|
|
1717
|
+
let o = lr(e, i, r);
|
|
1718
|
+
return !o || pr(n, o.token.value);
|
|
1719
|
+
}
|
|
1720
|
+
return !1;
|
|
1721
|
+
}
|
|
1722
|
+
function hr(e, { endCharacter: t = Infinity } = {}) {
|
|
1723
|
+
let n = [], r = Jn.segment(e), i = 0, a = 0, o, s = !1;
|
|
1724
|
+
for (; i < e.length;) {
|
|
1725
|
+
let c = e.codePointAt(i);
|
|
1726
|
+
if (L.has(c)) {
|
|
1727
|
+
let t = W(e, i);
|
|
1728
|
+
if (t) {
|
|
1729
|
+
n.push(t.token), i = t.endIndex, s = !0;
|
|
1730
|
+
continue;
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
let l = lr(e, i, r);
|
|
1734
|
+
if (!l || s && o && pr(o, l.token.value)) return fr(e, { endCharacter: t });
|
|
1735
|
+
if (n.push(l.token), i = l.endIndex, a += l.token.visibleWidth, s = !1, o = l.token.value, a >= t) {
|
|
1736
|
+
if (mr(e, i, o, r)) return fr(e, { endCharacter: t });
|
|
1737
|
+
i = cr(e, i, n);
|
|
1738
|
+
break;
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
return n;
|
|
1742
|
+
}
|
|
1743
|
+
//#endregion
|
|
1744
|
+
//#region node_modules/.pnpm/slice-ansi@8.0.0/node_modules/slice-ansi/index.js
|
|
1745
|
+
function gr(e, t) {
|
|
1746
|
+
for (let n of t) switch (n.type) {
|
|
1747
|
+
case "reset":
|
|
1748
|
+
e.clear();
|
|
1749
|
+
break;
|
|
1750
|
+
case "end":
|
|
1751
|
+
e.delete(n.endCode);
|
|
1752
|
+
break;
|
|
1753
|
+
case "start": e.delete(n.endCode), e.set(n.endCode, n.code);
|
|
1754
|
+
}
|
|
1755
|
+
return e;
|
|
1756
|
+
}
|
|
1757
|
+
function _r(e) {
|
|
1758
|
+
return [...e.keys()].reverse().join("");
|
|
1759
|
+
}
|
|
1760
|
+
function vr(e) {
|
|
1761
|
+
return `${e.closePrefix}${e.terminator}`;
|
|
1762
|
+
}
|
|
1763
|
+
function yr(e, t) {
|
|
1764
|
+
let n = !1, r = !1;
|
|
1765
|
+
for (let i of e.fragments) {
|
|
1766
|
+
if (i.type === "start") {
|
|
1767
|
+
n = !0;
|
|
1768
|
+
continue;
|
|
1769
|
+
}
|
|
1770
|
+
if (i.type === "reset" && t.size > 0) {
|
|
1771
|
+
r = !0;
|
|
1772
|
+
continue;
|
|
1773
|
+
}
|
|
1774
|
+
i.type === "end" && t.has(i.endCode) && (r = !0);
|
|
1775
|
+
}
|
|
1776
|
+
return r && !n;
|
|
1777
|
+
}
|
|
1778
|
+
function br({ token: e, isPastEnd: t, activeStyles: n, returnValue: r, include: i, activeHyperlink: a, position: o }) {
|
|
1779
|
+
return t && !yr(e, n) ? {
|
|
1780
|
+
activeStyles: n,
|
|
1781
|
+
activeHyperlink: a,
|
|
1782
|
+
position: o,
|
|
1783
|
+
returnValue: r,
|
|
1784
|
+
include: i
|
|
1785
|
+
} : (n = gr(n, e.fragments), i && (r += e.code), {
|
|
1786
|
+
activeStyles: n,
|
|
1787
|
+
activeHyperlink: a,
|
|
1788
|
+
position: o,
|
|
1789
|
+
returnValue: r,
|
|
1790
|
+
include: i
|
|
1791
|
+
});
|
|
1792
|
+
}
|
|
1793
|
+
function xr({ token: e, isPastEnd: t, activeStyles: n, activeHyperlink: r, position: i, returnValue: a, include: o }) {
|
|
1794
|
+
return t && (e.action !== "close" || !r) ? {
|
|
1795
|
+
activeStyles: n,
|
|
1796
|
+
activeHyperlink: r,
|
|
1797
|
+
position: i,
|
|
1798
|
+
returnValue: a,
|
|
1799
|
+
include: o
|
|
1800
|
+
} : (e.action === "open" ? r = e : e.action === "close" && (r = void 0), o && (a += e.code), {
|
|
1801
|
+
activeStyles: n,
|
|
1802
|
+
activeHyperlink: r,
|
|
1803
|
+
position: i,
|
|
1804
|
+
returnValue: a,
|
|
1805
|
+
include: o
|
|
1806
|
+
});
|
|
1807
|
+
}
|
|
1808
|
+
function Sr({ token: e, isPastEnd: t, activeStyles: n, activeHyperlink: r, position: i, returnValue: a, include: o }) {
|
|
1809
|
+
return !t && o && (a += e.code), {
|
|
1810
|
+
activeStyles: n,
|
|
1811
|
+
activeHyperlink: r,
|
|
1812
|
+
position: i,
|
|
1813
|
+
returnValue: a,
|
|
1814
|
+
include: o
|
|
1815
|
+
};
|
|
1816
|
+
}
|
|
1817
|
+
function Cr({ token: e, start: t, activeStyles: n, activeHyperlink: r, position: i, returnValue: a, include: o }) {
|
|
1818
|
+
return !o && i >= t && !e.isGraphemeContinuation && (o = !0, a = [...n.values()].join(""), r && (a += r.code)), o && (a += e.value), i += e.visibleWidth, {
|
|
1819
|
+
activeStyles: n,
|
|
1820
|
+
activeHyperlink: r,
|
|
1821
|
+
position: i,
|
|
1822
|
+
returnValue: a,
|
|
1823
|
+
include: o
|
|
1824
|
+
};
|
|
1825
|
+
}
|
|
1826
|
+
var wr = {
|
|
1827
|
+
sgr: br,
|
|
1828
|
+
hyperlink: xr,
|
|
1829
|
+
control: Sr,
|
|
1830
|
+
character: Cr
|
|
1831
|
+
};
|
|
1832
|
+
function Tr(e) {
|
|
1833
|
+
let t = wr[e.token.type];
|
|
1834
|
+
if (!t) {
|
|
1835
|
+
let { activeStyles: t, activeHyperlink: n, position: r, returnValue: i, include: a } = e;
|
|
1836
|
+
return {
|
|
1837
|
+
activeStyles: t,
|
|
1838
|
+
activeHyperlink: n,
|
|
1839
|
+
position: r,
|
|
1840
|
+
returnValue: i,
|
|
1841
|
+
include: a
|
|
1842
|
+
};
|
|
1843
|
+
}
|
|
1844
|
+
return t(e);
|
|
1845
|
+
}
|
|
1846
|
+
function Er(e) {
|
|
1847
|
+
let t = Array.from({ length: e.length }, () => !1), n = !1;
|
|
1848
|
+
for (let r = e.length - 1; r >= 0; r--) {
|
|
1849
|
+
let i = e[r];
|
|
1850
|
+
t[r] = n, i.type === "character" && (n = !!i.isGraphemeContinuation);
|
|
1851
|
+
}
|
|
1852
|
+
return t;
|
|
1853
|
+
}
|
|
1854
|
+
function Dr(e, t, n) {
|
|
1855
|
+
let r = hr(e, { endCharacter: n }), i = Er(r), a = /* @__PURE__ */ new Map(), o, s = 0, c = "", l = !1;
|
|
1856
|
+
for (let [e, u] of r.entries()) {
|
|
1857
|
+
let r = n !== void 0 && s >= n;
|
|
1858
|
+
if (r && u.type !== "character" && i[e] && (r = !1), r && u.type === "character" && !u.isGraphemeContinuation) break;
|
|
1859
|
+
({activeStyles: a, activeHyperlink: o, position: s, returnValue: c, include: l} = Tr({
|
|
1860
|
+
token: u,
|
|
1861
|
+
isPastEnd: r,
|
|
1862
|
+
start: t,
|
|
1863
|
+
activeStyles: a,
|
|
1864
|
+
activeHyperlink: o,
|
|
1865
|
+
position: s,
|
|
1866
|
+
returnValue: c,
|
|
1867
|
+
include: l
|
|
1868
|
+
}));
|
|
1869
|
+
}
|
|
1870
|
+
return l ? (o && (c += vr(o)), c += _r(a), c) : "";
|
|
1871
|
+
}
|
|
1872
|
+
//#endregion
|
|
1873
|
+
//#region node_modules/.pnpm/log-update@7.2.0/node_modules/log-update/index.js
|
|
1874
|
+
var G = (e, t) => e.columns ?? t ?? 80, Or = "\x1B[?2026h", kr = "\x1B[?2026l", Ar = (e, t, n) => {
|
|
1875
|
+
let r = e.rows ?? n ?? 24;
|
|
1876
|
+
if (r === void 0) return {
|
|
1877
|
+
text: t,
|
|
1878
|
+
wasClipped: !1
|
|
1879
|
+
};
|
|
1880
|
+
if (r === 0) return {
|
|
1881
|
+
text: "",
|
|
1882
|
+
wasClipped: t !== ""
|
|
1883
|
+
};
|
|
1884
|
+
let i = Ce(t), a = [...i].filter((e) => e === "\n").length + 1, o = Math.max(0, a - r);
|
|
1885
|
+
if (o === 0) return {
|
|
1886
|
+
text: t,
|
|
1887
|
+
wasClipped: !1
|
|
1888
|
+
};
|
|
1889
|
+
let s = 0, c = 0;
|
|
1890
|
+
for (let [e, t] of [...i].entries()) if (t === "\n" && (s++, s === o)) {
|
|
1891
|
+
c = e + 1;
|
|
1892
|
+
break;
|
|
1893
|
+
}
|
|
1894
|
+
return {
|
|
1895
|
+
text: Dr(t, c),
|
|
1896
|
+
wasClipped: !0
|
|
1897
|
+
};
|
|
1898
|
+
}, jr = (e, t) => {
|
|
1899
|
+
let n = 0;
|
|
1900
|
+
for (; n < e.length && n < t.length && e[n] === t[n]; n++);
|
|
1901
|
+
let r = e.length - 1, i = t.length - 1;
|
|
1902
|
+
for (; r >= n && i >= n && e[r] === t[i];) r--, i--;
|
|
1903
|
+
return {
|
|
1904
|
+
start: n,
|
|
1905
|
+
endPrevious: r,
|
|
1906
|
+
endNext: i
|
|
1907
|
+
};
|
|
1908
|
+
}, Mr = ({ prevCount: e, start: t, endPrevious: n, endNext: r, nextLines: i, nextWrappedEndsWithNewline: a }) => {
|
|
1909
|
+
let o = "", s = Math.max(0, e - 1 - t);
|
|
1910
|
+
s > 0 && (o += u(s)), o += "\x1B[G";
|
|
1911
|
+
let c = Math.max(0, n - t + 1);
|
|
1912
|
+
for (let e = 0; e < c; e++) o += p, e < c - 1 && (o += d());
|
|
1913
|
+
c > 1 && (o += u(c - 1)), o += "\x1B[G";
|
|
1914
|
+
let l = i.slice(t, r + 1);
|
|
1915
|
+
if (l.length > 0) {
|
|
1916
|
+
let e = l.join("\n");
|
|
1917
|
+
o += e, o += "\x1B[K", a && !e.endsWith("\n") && (o += "\n");
|
|
1918
|
+
}
|
|
1919
|
+
let f = t + l.length, m = i.length - 1 - f;
|
|
1920
|
+
return m > 0 && (o += d(m)), o;
|
|
1921
|
+
};
|
|
1922
|
+
function Nr(e, { showCursor: t = !1, defaultWidth: n, defaultHeight: r } = {}) {
|
|
1923
|
+
let i = 0, a = G(e, n), o = "", s = e.isTTY === !0, c = (t) => {
|
|
1924
|
+
if (t !== "") {
|
|
1925
|
+
if (s) {
|
|
1926
|
+
e.write(Or + t + kr);
|
|
1927
|
+
return;
|
|
1928
|
+
}
|
|
1929
|
+
e.write(t);
|
|
1930
|
+
}
|
|
1931
|
+
}, l = (t, n) => {
|
|
1932
|
+
let i = String(t), { text: a, wasClipped: o } = Ar(e, en(i.endsWith("\n") ? i : `${i}\n`, n, {
|
|
1933
|
+
trim: !1,
|
|
1934
|
+
hard: !0,
|
|
1935
|
+
wordWrap: !1
|
|
1936
|
+
}), r);
|
|
1937
|
+
return {
|
|
1938
|
+
wrapped: a,
|
|
1939
|
+
lines: a === "" ? [] : a.split("\n"),
|
|
1940
|
+
wasClipped: o
|
|
1941
|
+
};
|
|
1942
|
+
}, u = () => {
|
|
1943
|
+
o = "", a = G(e, n), i = 0;
|
|
1944
|
+
}, d = (...r) => {
|
|
1945
|
+
t || x.hide();
|
|
1946
|
+
let s = G(e, n), { wrapped: u, lines: d, wasClipped: p } = l(r.join(" "), s);
|
|
1947
|
+
if (d.length === 0) {
|
|
1948
|
+
o = u, a = s, i = 0;
|
|
1949
|
+
return;
|
|
1950
|
+
}
|
|
1951
|
+
if (u === o && a === s) return;
|
|
1952
|
+
if (i === 0) {
|
|
1953
|
+
c(u), o = u, a = s, i = d.length;
|
|
1954
|
+
return;
|
|
1955
|
+
}
|
|
1956
|
+
if (a !== s || p) {
|
|
1957
|
+
c(f(i) + u), o = u, a = s, i = d.length;
|
|
1958
|
+
return;
|
|
1959
|
+
}
|
|
1960
|
+
let { start: m, endPrevious: ee, endNext: te } = jr(o === "" ? [] : o.split("\n"), d);
|
|
1961
|
+
if (m === d.length && i === d.length) return;
|
|
1962
|
+
if (m === 0) {
|
|
1963
|
+
c(f(i) + u), o = u, a = s, i = d.length;
|
|
1964
|
+
return;
|
|
1965
|
+
}
|
|
1966
|
+
let ne = Mr({
|
|
1967
|
+
prevCount: i,
|
|
1968
|
+
start: m,
|
|
1969
|
+
endPrevious: ee,
|
|
1970
|
+
endNext: te,
|
|
1971
|
+
nextLines: d,
|
|
1972
|
+
nextWrappedEndsWithNewline: u.endsWith("\n")
|
|
1973
|
+
});
|
|
1974
|
+
c(ne), o = u, a = s, i = d.length;
|
|
1975
|
+
};
|
|
1976
|
+
return d.clear = () => {
|
|
1977
|
+
c(f(i)), u();
|
|
1978
|
+
}, d.done = () => {
|
|
1979
|
+
u(), t || x.show();
|
|
1980
|
+
}, d.persist = (...t) => {
|
|
1981
|
+
let r = i > 0 ? f(i) : "";
|
|
1982
|
+
i > 0 && (i = 0);
|
|
1983
|
+
let a = `${t.join(" ")}`, o = G(e, n), { wrapped: s } = l(a, o);
|
|
1984
|
+
c(r + s), u();
|
|
1985
|
+
}, d;
|
|
1986
|
+
}
|
|
1987
|
+
Nr(t.stdout), Nr(t.stderr);
|
|
1988
|
+
//#endregion
|
|
1989
|
+
//#region packages/cli/src/tui/terminalColor.ts
|
|
1990
|
+
var K = {
|
|
1991
|
+
reset: "\x1B[0m",
|
|
1992
|
+
bold: "\x1B[1m",
|
|
1993
|
+
cyan: "\x1B[36m",
|
|
1994
|
+
deepPink: "\x1B[38;5;162m",
|
|
1995
|
+
green: "\x1B[32m",
|
|
1996
|
+
red: "\x1B[31m",
|
|
1997
|
+
yellow: "\x1B[33m",
|
|
1998
|
+
dim: "\x1B[2m"
|
|
1999
|
+
}, q = (e, ...t) => `${t.join("")}${e}${K.reset}`, Pr = 120, Fr = 40, J = 2, Y = " ", Ir = `${Y}${Y}`, Lr = [
|
|
2000
|
+
"mounted",
|
|
2001
|
+
"bound",
|
|
2002
|
+
"waiting",
|
|
2003
|
+
"collecting",
|
|
2004
|
+
"failed",
|
|
2005
|
+
"idle"
|
|
2006
|
+
], Rr = {
|
|
2007
|
+
mounted: K.green,
|
|
2008
|
+
bound: K.green,
|
|
2009
|
+
waiting: K.yellow,
|
|
2010
|
+
collecting: K.yellow,
|
|
2011
|
+
failed: K.red,
|
|
2012
|
+
idle: K.dim
|
|
2013
|
+
};
|
|
2014
|
+
function X(e) {
|
|
2015
|
+
return a(e).length;
|
|
2016
|
+
}
|
|
2017
|
+
function Z(e, t) {
|
|
2018
|
+
let n = t - X(e);
|
|
2019
|
+
return n > 0 ? `${e}${" ".repeat(n)}` : e;
|
|
2020
|
+
}
|
|
2021
|
+
function zr(e) {
|
|
2022
|
+
return e.length <= Fr ? e : `${e.slice(0, 39)}…`;
|
|
2023
|
+
}
|
|
2024
|
+
function Br(e) {
|
|
2025
|
+
return `└ ${zr(e)}`;
|
|
2026
|
+
}
|
|
2027
|
+
function Q(e) {
|
|
2028
|
+
return q(`● ${e}`, Rr[e]);
|
|
2029
|
+
}
|
|
2030
|
+
function Vr(e) {
|
|
2031
|
+
let t = [], n = e.cause;
|
|
2032
|
+
for (; n !== void 0;) t.push(n.code ? `${n.code}: ${n.message}` : n.message), n = n.cause;
|
|
2033
|
+
return t.join(" <- ");
|
|
2034
|
+
}
|
|
2035
|
+
function $(e) {
|
|
2036
|
+
let t = `${e.code}: ${e.message}`;
|
|
2037
|
+
return e.cause !== void 0 && (t += ` (cause: ${Vr(e)})`), t = t.replaceAll("\n", " · "), t.length > Pr && (t = `${t.slice(0, 119)}…`), t;
|
|
2038
|
+
}
|
|
2039
|
+
function Hr(e) {
|
|
2040
|
+
return e.kind === "component" ? "component" : e.kind === "component-each" ? "component each" : "standalone listener";
|
|
2041
|
+
}
|
|
2042
|
+
function Ur(e) {
|
|
2043
|
+
return `└ child #${e + 1}`;
|
|
2044
|
+
}
|
|
2045
|
+
function Wr(e) {
|
|
2046
|
+
let t = X("STATUS"), n = X("NAME"), r = 0;
|
|
2047
|
+
for (let i of e) {
|
|
2048
|
+
if (t = Math.max(t, X(Q(i.status))), n = Math.max(n, X(zr(i.name))), i.kind === "component") for (let e of i.attachedListeners) t = Math.max(t, X(Q(e.status))), r = Math.max(r, X(Br(e.name)));
|
|
2049
|
+
if (i.kind === "component-each") for (let [e, n] of i.children.entries()) t = Math.max(t, X(Q(n.status))), r = Math.max(r, X(Ur(e)));
|
|
2050
|
+
}
|
|
2051
|
+
return {
|
|
2052
|
+
status: t,
|
|
2053
|
+
name: n,
|
|
2054
|
+
indentedName: r
|
|
2055
|
+
};
|
|
2056
|
+
}
|
|
2057
|
+
function Gr(e, t) {
|
|
2058
|
+
let n = Z(Q(e.status), t.status), r = Z(q(zr(e.name), K.bold, K.cyan), t.name), i = q(Hr(e), K.deepPink), a = " ".repeat(J);
|
|
2059
|
+
return `${n}${a}${r}${a}${i}`;
|
|
2060
|
+
}
|
|
2061
|
+
function Kr(e, t) {
|
|
2062
|
+
let n = Z(Q(e.status), t.status), r = Z(e.name, t.indentedName), i = q(e.kind, K.dim), a = " ".repeat(J);
|
|
2063
|
+
return `${Y}${n}${a}${r}${a}${i}`;
|
|
2064
|
+
}
|
|
2065
|
+
function qr(e, t) {
|
|
2066
|
+
let n = [Gr(e, t)];
|
|
2067
|
+
if (e.status === "failed" && e.lastError && n.push(q(`${Y}${$(e.lastError)}`, K.red)), e.kind === "component") for (let r of e.attachedListeners) n.push(Kr({
|
|
2068
|
+
name: Br(r.name),
|
|
2069
|
+
status: r.status,
|
|
2070
|
+
kind: "attached listener"
|
|
2071
|
+
}, t));
|
|
2072
|
+
if (e.kind === "component-each") for (let [r, i] of e.children.entries()) n.push(Kr({
|
|
2073
|
+
name: Ur(r),
|
|
2074
|
+
status: i.status,
|
|
2075
|
+
kind: "child"
|
|
2076
|
+
}, t)), i.status === "failed" && i.lastError && n.push(q(`${Ir}${$(i.lastError)}`, K.red));
|
|
2077
|
+
return n;
|
|
2078
|
+
}
|
|
2079
|
+
function Jr(e) {
|
|
2080
|
+
let t = " ".repeat(J);
|
|
2081
|
+
return [
|
|
2082
|
+
Z(q("STATUS", K.bold), e.status),
|
|
2083
|
+
Z(q("NAME", K.bold), e.name),
|
|
2084
|
+
q("KIND", K.bold)
|
|
2085
|
+
].join(t);
|
|
2086
|
+
}
|
|
2087
|
+
function Yr(e) {
|
|
2088
|
+
let t = q($(e.error), K.red);
|
|
2089
|
+
return e.name === void 0 ? ` ${t}` : ` ${q(e.name, K.bold, K.cyan)} ${t}`;
|
|
2090
|
+
}
|
|
2091
|
+
function Xr(e) {
|
|
2092
|
+
let t = e.flatMap((e) => [e.status, ...e.kind === "component-each" ? e.children.map((e) => e.status) : []]);
|
|
2093
|
+
return [t.length === 1 ? "1 injection" : `${t.length} injections`, ...Lr.flatMap((e) => {
|
|
2094
|
+
let n = t.filter((t) => t === e).length;
|
|
2095
|
+
return n === 0 ? [] : [q(`${n} ${e}`, Rr[e])];
|
|
2096
|
+
})].join(" · ");
|
|
2097
|
+
}
|
|
2098
|
+
function Zr(e) {
|
|
2099
|
+
let t = [q("Makoo Injections", K.bold, K.deepPink), ""];
|
|
2100
|
+
if (e.length === 0) return t.push(q("● Runtime Session disconnected.", K.yellow), "", q("Waiting for reconnection.", K.dim)), t.join("\n");
|
|
2101
|
+
let n = e.filter((e) => e.injections.length > 0 || e.diagnostics.length > 0);
|
|
2102
|
+
if (n.length === 0) return t.push("No injections registered."), t.join("\n");
|
|
2103
|
+
let r = e.length > 1, i = new Set(e.map((e) => e.clientId)).size > 1;
|
|
2104
|
+
for (let [e, a] of n.entries()) {
|
|
2105
|
+
if (r) {
|
|
2106
|
+
let e = `Makoo${a.runtimeId}`;
|
|
2107
|
+
i && (e = `Client ${a.clientId} · ${e}`), t.push(q(e, K.bold), "");
|
|
2108
|
+
}
|
|
2109
|
+
if (a.injections.length > 0) {
|
|
2110
|
+
let e = Wr(a.injections);
|
|
2111
|
+
t.push(Jr(e));
|
|
2112
|
+
for (let n of a.injections) t.push(...qr(n, e));
|
|
2113
|
+
}
|
|
2114
|
+
a.diagnostics.length > 0 && (a.injections.length > 0 && t.push(""), t.push(q("Diagnostics", K.bold), ...a.diagnostics.map(Yr))), e < n.length - 1 && t.push("");
|
|
2115
|
+
}
|
|
2116
|
+
let a = n.flatMap((e) => e.injections);
|
|
2117
|
+
return a.length > 0 && t.push("", Xr(a)), t.join("\n");
|
|
2118
|
+
}
|
|
2119
|
+
//#endregion
|
|
2120
|
+
//#region packages/cli/src/tui/DevTerminal.ts
|
|
2121
|
+
var Qr = "\x1B[?1049h", $r = "\x1B[?1049l", ei = 1e3, ti = class {
|
|
2122
|
+
server;
|
|
2123
|
+
store;
|
|
2124
|
+
interactive = !!(process.stdin.isTTY && process.stdout.isTTY && !process.env.CI);
|
|
2125
|
+
unsubscribe;
|
|
2126
|
+
currentView = "logs";
|
|
2127
|
+
previousView = "home";
|
|
2128
|
+
selectedRuntime = 0;
|
|
2129
|
+
runtimeCount = -1;
|
|
2130
|
+
ready = !1;
|
|
2131
|
+
restarting = !1;
|
|
2132
|
+
actionRunning = !1;
|
|
2133
|
+
closed = !1;
|
|
2134
|
+
stopInput;
|
|
2135
|
+
bufferedLogs = [];
|
|
2136
|
+
omittedLogs = 0;
|
|
2137
|
+
unreadErrors = 0;
|
|
2138
|
+
screenOutput = Nr(process.stdout, { showCursor: !0 });
|
|
2139
|
+
logger;
|
|
2140
|
+
originalInfo;
|
|
2141
|
+
originalWarn;
|
|
2142
|
+
originalWarnOnce;
|
|
2143
|
+
originalError;
|
|
2144
|
+
originalClearScreen;
|
|
2145
|
+
cliVersion = "";
|
|
2146
|
+
cliVersionReady = e().then((e) => {
|
|
2147
|
+
this.cliVersion = e;
|
|
2148
|
+
}, () => {
|
|
2149
|
+
this.cliVersion = "0.0.0";
|
|
2150
|
+
});
|
|
2151
|
+
constructor(e, t) {
|
|
2152
|
+
this.server = e, this.store = t, this.logger = e.config.logger, this.originalInfo = this.logger.info, this.originalWarn = this.logger.warn, this.originalWarnOnce = this.logger.warnOnce, this.originalError = this.logger.error, this.originalClearScreen = this.logger.clearScreen, this.logger.info = (e, t) => this.writeLog({
|
|
2153
|
+
type: "info",
|
|
2154
|
+
message: e,
|
|
2155
|
+
options: t
|
|
2156
|
+
}), this.logger.warn = (e, t) => this.writeLog({
|
|
2157
|
+
type: "warn",
|
|
2158
|
+
message: e,
|
|
2159
|
+
options: t
|
|
2160
|
+
}), this.logger.warnOnce = (e, t) => this.writeLog({
|
|
2161
|
+
type: "warnOnce",
|
|
2162
|
+
message: e,
|
|
2163
|
+
options: t
|
|
2164
|
+
}), this.logger.error = (e, t) => this.writeLog({
|
|
2165
|
+
type: "error",
|
|
2166
|
+
message: e,
|
|
2167
|
+
options: t
|
|
2168
|
+
}), this.logger.clearScreen = (e) => {
|
|
2169
|
+
this.currentView === "logs" && this.originalClearScreen.call(this.logger, e);
|
|
2170
|
+
}, process.once("exit", this.close), process.once("SIGINT", this.shutdown), this.unsubscribe = t.subscribe(this.refresh);
|
|
2171
|
+
}
|
|
2172
|
+
async showHome() {
|
|
2173
|
+
if (await this.cliVersionReady, this.ready = !0, this.interactive) this.show("home");
|
|
2174
|
+
else {
|
|
2175
|
+
let e = this.store.getRuntimeSnapshots();
|
|
2176
|
+
this.runtimeCount = e.length, this.logger.info(this.renderHome(e));
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
2179
|
+
activate() {
|
|
2180
|
+
this.interactive && this.bindShortcuts();
|
|
2181
|
+
}
|
|
2182
|
+
refresh = () => {
|
|
2183
|
+
if (!this.ready || this.closed) return;
|
|
2184
|
+
let e = this.store.getRuntimeSnapshots();
|
|
2185
|
+
if (this.selectedRuntime = e.length === 0 ? 0 : this.selectedRuntime % e.length, !this.interactive) {
|
|
2186
|
+
this.runtimeCount !== e.length && (this.runtimeCount = e.length, this.logger.info(` Runtime ${this.renderRuntimeStatus(e.length)}`));
|
|
2187
|
+
return;
|
|
2188
|
+
}
|
|
2189
|
+
switch (this.currentView) {
|
|
2190
|
+
case "home":
|
|
2191
|
+
this.draw(this.renderHome(e), "Press a key to select an action. Press Ctrl+C to stop.");
|
|
2192
|
+
break;
|
|
2193
|
+
case "injections":
|
|
2194
|
+
this.draw(this.renderInjections(e), "Press t or Esc to return home. Press Ctrl+C to stop.");
|
|
2195
|
+
break;
|
|
2196
|
+
case "help": this.draw(this.renderHelp(), "Press h or Esc to return. Press Ctrl+C to stop.");
|
|
2197
|
+
}
|
|
2198
|
+
};
|
|
2199
|
+
show(e) {
|
|
2200
|
+
if (this.closed || !this.interactive) return;
|
|
2201
|
+
let t = this.currentView;
|
|
2202
|
+
this.currentView = e, t === "logs" && e !== "logs" && process.stdout.write(Qr), t !== "logs" && e === "logs" && (this.screenOutput.clear(), process.stdout.write($r), this.flushLogs(), this.originalInfo.call(this.logger, q("Press l or Esc to return home. Press Ctrl+C to stop.", K.dim))), this.refresh();
|
|
2203
|
+
}
|
|
2204
|
+
renderBanner() {
|
|
2205
|
+
let e = this.server.resolvedUrls;
|
|
2206
|
+
return [
|
|
2207
|
+
`\n ${q("◆", K.deepPink)} ${q(`Makoo v${this.cliVersion}`, K.bold, K.cyan)} ${q("dev", K.dim)}\n`,
|
|
2208
|
+
` ${q("Local", K.dim)} ${q(e?.local[0] ?? "unavailable", K.cyan)}`,
|
|
2209
|
+
` ${q("Network", K.dim)} ${e?.network[0] ?? q("use --host to expose", K.dim)}`
|
|
2210
|
+
].join("\n");
|
|
2211
|
+
}
|
|
2212
|
+
renderRuntimeStatus(e) {
|
|
2213
|
+
return this.restarting ? "Restarting…" : e === 0 ? "Waiting for a browser runtime" : `${e} browser runtime${e === 1 ? "" : "s"} connected`;
|
|
2214
|
+
}
|
|
2215
|
+
renderHome(e) {
|
|
2216
|
+
let t = this.restarting || e.length === 0, n = `${this.bufferedLogs.length + this.omittedLogs} new${this.unreadErrors ? ` · ${this.unreadErrors} error${this.unreadErrors === 1 ? "" : "s"}` : ""}`;
|
|
2217
|
+
return [
|
|
2218
|
+
this.renderBanner(),
|
|
2219
|
+
` ${q("Runtime", K.dim)} ${q(t ? "○" : "●", t ? K.yellow : K.green)} ${this.renderRuntimeStatus(e.length)}`,
|
|
2220
|
+
` ${q("Logs", K.dim)} ${q(n, this.unreadErrors ? K.red : K.dim)}`,
|
|
2221
|
+
`\n ${q("Actions", K.bold)}`,
|
|
2222
|
+
...this.hasInstallationPage() ? [` ${q("i", K.bold, K.cyan)} Open installation page`] : [],
|
|
2223
|
+
` ${q("t", K.bold, K.cyan)} View runtime injections`,
|
|
2224
|
+
` ${q("l", K.bold, K.cyan)} View logs`,
|
|
2225
|
+
` ${q("r", K.bold, K.cyan)} Restart server`,
|
|
2226
|
+
` ${q("h", K.bold, K.cyan)} Show help`
|
|
2227
|
+
].join("\n");
|
|
2228
|
+
}
|
|
2229
|
+
renderInjections(e) {
|
|
2230
|
+
if (e.length === 0) return "Makoo Injections\n\nWaiting for a browser runtime";
|
|
2231
|
+
let t = e[this.selectedRuntime];
|
|
2232
|
+
return [
|
|
2233
|
+
`Runtime ${this.selectedRuntime + 1}/${e.length} · Client ${t.clientId} · Makoo${t.runtimeId}`,
|
|
2234
|
+
Zr([t]),
|
|
2235
|
+
...e.length > 1 ? ["Press n to view the next runtime."] : []
|
|
2236
|
+
].join("\n\n");
|
|
2237
|
+
}
|
|
2238
|
+
renderHelp() {
|
|
2239
|
+
return [
|
|
2240
|
+
q("Shortcuts", K.bold),
|
|
2241
|
+
"",
|
|
2242
|
+
...this.hasInstallationPage() ? [` ${q("i", K.bold, K.cyan)} open development script installation page`] : [],
|
|
2243
|
+
...[
|
|
2244
|
+
["t", "toggle runtime injections"],
|
|
2245
|
+
["n", "view next runtime injections"],
|
|
2246
|
+
["l", "view logs / return home"],
|
|
2247
|
+
["r", "restart the server"],
|
|
2248
|
+
["u", "show server URLs"],
|
|
2249
|
+
["o", "open in browser"],
|
|
2250
|
+
["c", "clear console"],
|
|
2251
|
+
["q", "quit"],
|
|
2252
|
+
["h", "show help"]
|
|
2253
|
+
].map(([e, t]) => ` ${q(e, K.bold, K.cyan)} ${t}`)
|
|
2254
|
+
].join("\n");
|
|
2255
|
+
}
|
|
2256
|
+
draw(e, t) {
|
|
2257
|
+
let n = [e, ""], r = this.bufferedLogs.length + this.omittedLogs;
|
|
2258
|
+
if (r > 0 && this.currentView !== "home") {
|
|
2259
|
+
let e = `${r} new dev log${r === 1 ? "" : "s"}`, t = this.unreadErrors > 0 ? ` · ${this.unreadErrors} error${this.unreadErrors === 1 ? "" : "s"}` : "";
|
|
2260
|
+
n.push(q(e + t, this.unreadErrors ? K.red : K.dim));
|
|
2261
|
+
}
|
|
2262
|
+
n.push(q(t, K.dim)), this.screenOutput(n.join("\n"));
|
|
2263
|
+
}
|
|
2264
|
+
hasInstallationPage() {
|
|
2265
|
+
return this.server.config.plugins.some((e) => e.name === "monkey:virtualHtml");
|
|
2266
|
+
}
|
|
2267
|
+
bindShortcuts() {
|
|
2268
|
+
let e = process.stdin.isRaw, t = process.stdin.readableFlowing;
|
|
2269
|
+
r(process.stdin), process.stdin.setRawMode(!0), process.stdin.on("keypress", this.onKey), process.stdin.resume(), this.stopInput = () => {
|
|
2270
|
+
process.stdin.off("keypress", this.onKey), process.stdin.setRawMode(e), t || process.stdin.pause();
|
|
2271
|
+
};
|
|
2272
|
+
}
|
|
2273
|
+
onKey = async (e, t) => {
|
|
2274
|
+
if (t.ctrl && t.name === "c") {
|
|
2275
|
+
await this.shutdown();
|
|
2276
|
+
return;
|
|
2277
|
+
}
|
|
2278
|
+
if (!(this.actionRunning || t.ctrl)) {
|
|
2279
|
+
if (t.name === "escape") {
|
|
2280
|
+
this.show(this.currentView === "help" ? this.previousView : "home");
|
|
2281
|
+
return;
|
|
2282
|
+
}
|
|
2283
|
+
if (!(t.meta || t.sequence?.length !== 1)) {
|
|
2284
|
+
if (t.name === "h") {
|
|
2285
|
+
this.currentView === "help" ? this.show(this.previousView) : (this.previousView = this.currentView, this.show("help"));
|
|
2286
|
+
return;
|
|
2287
|
+
}
|
|
2288
|
+
if ([
|
|
2289
|
+
"i",
|
|
2290
|
+
"t",
|
|
2291
|
+
"n",
|
|
2292
|
+
"l",
|
|
2293
|
+
"r",
|
|
2294
|
+
"u",
|
|
2295
|
+
"o",
|
|
2296
|
+
"c",
|
|
2297
|
+
"q"
|
|
2298
|
+
].includes(t.name ?? "") && !(t.name === "i" && !this.hasInstallationPage())) {
|
|
2299
|
+
this.currentView === "help" && this.show(this.previousView), this.actionRunning = !0;
|
|
2300
|
+
try {
|
|
2301
|
+
switch (t.name) {
|
|
2302
|
+
case "t":
|
|
2303
|
+
this.show(this.currentView === "injections" ? "home" : "injections");
|
|
2304
|
+
break;
|
|
2305
|
+
case "n":
|
|
2306
|
+
this.selectedRuntime += 1, this.show("injections");
|
|
2307
|
+
break;
|
|
2308
|
+
case "l":
|
|
2309
|
+
this.show(this.currentView === "logs" ? "home" : "logs");
|
|
2310
|
+
break;
|
|
2311
|
+
case "r":
|
|
2312
|
+
await this.restart();
|
|
2313
|
+
break;
|
|
2314
|
+
case "u":
|
|
2315
|
+
this.show("home");
|
|
2316
|
+
break;
|
|
2317
|
+
case "o":
|
|
2318
|
+
this.server.openBrowser();
|
|
2319
|
+
break;
|
|
2320
|
+
case "i":
|
|
2321
|
+
this.openInstallationPage();
|
|
2322
|
+
break;
|
|
2323
|
+
case "c":
|
|
2324
|
+
this.show("logs"), this.logger.clearScreen("error");
|
|
2325
|
+
break;
|
|
2326
|
+
case "q": await this.shutdown();
|
|
2327
|
+
}
|
|
2328
|
+
} catch (e) {
|
|
2329
|
+
let t = n(e) ? `${e.code}: ${e.message}` : e instanceof Error ? e.message : String(e);
|
|
2330
|
+
this.logger.error(`[makoo] ${t}`);
|
|
2331
|
+
} finally {
|
|
2332
|
+
this.actionRunning = !1;
|
|
2333
|
+
}
|
|
2334
|
+
}
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2337
|
+
};
|
|
2338
|
+
openInstallationPage() {
|
|
2339
|
+
let e = this.server.config.server.open;
|
|
2340
|
+
try {
|
|
2341
|
+
this.server.config.server.open = this.server.config.base, this.server.openBrowser();
|
|
2342
|
+
} finally {
|
|
2343
|
+
this.server.config.server.open = e;
|
|
2344
|
+
}
|
|
2345
|
+
}
|
|
2346
|
+
async restart() {
|
|
2347
|
+
this.restarting = !0, this.show("home");
|
|
2348
|
+
try {
|
|
2349
|
+
await this.server.restart();
|
|
2350
|
+
} finally {
|
|
2351
|
+
this.restarting = !1, this.refresh();
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
shutdown = async () => {
|
|
2355
|
+
this.close();
|
|
2356
|
+
try {
|
|
2357
|
+
await this.server.close();
|
|
2358
|
+
} finally {
|
|
2359
|
+
process.exit(0);
|
|
2360
|
+
}
|
|
2361
|
+
};
|
|
2362
|
+
close = () => {
|
|
2363
|
+
this.closed || (this.closed = !0, this.unsubscribe(), this.stopInput?.(), process.off("exit", this.close), process.off("SIGINT", this.shutdown), this.currentView !== "logs" && (this.screenOutput.clear(), process.stdout.write($r), this.currentView = "logs", this.flushLogs()), this.logger.info = this.originalInfo, this.logger.warn = this.originalWarn, this.logger.warnOnce = this.originalWarnOnce, this.logger.error = this.originalError, this.logger.clearScreen = this.originalClearScreen);
|
|
2364
|
+
};
|
|
2365
|
+
writeLog(e) {
|
|
2366
|
+
if (this.currentView === "logs") {
|
|
2367
|
+
this.printLog(e);
|
|
2368
|
+
return;
|
|
2369
|
+
}
|
|
2370
|
+
e.type === "error" && (this.unreadErrors += 1), e.options &&= {
|
|
2371
|
+
...e.options,
|
|
2372
|
+
clear: !1
|
|
2373
|
+
}, this.bufferedLogs.push(e), this.bufferedLogs.length > ei && (this.bufferedLogs.shift(), this.omittedLogs += 1), this.refresh();
|
|
2374
|
+
}
|
|
2375
|
+
printLog(e) {
|
|
2376
|
+
switch (e.type) {
|
|
2377
|
+
case "info":
|
|
2378
|
+
this.originalInfo.call(this.logger, e.message, e.options);
|
|
2379
|
+
break;
|
|
2380
|
+
case "warn":
|
|
2381
|
+
this.originalWarn.call(this.logger, e.message, e.options);
|
|
2382
|
+
break;
|
|
2383
|
+
case "warnOnce":
|
|
2384
|
+
this.originalWarnOnce.call(this.logger, e.message, e.options);
|
|
2385
|
+
break;
|
|
2386
|
+
case "error": this.originalError.call(this.logger, e.message, e.options);
|
|
2387
|
+
}
|
|
2388
|
+
}
|
|
2389
|
+
flushLogs() {
|
|
2390
|
+
this.omittedLogs > 0 && this.originalWarn.call(this.logger, `[makoo] ${this.omittedLogs} earlier dev logs omitted.`);
|
|
2391
|
+
for (let e of this.bufferedLogs) this.printLog(e);
|
|
2392
|
+
this.bufferedLogs = [], this.omittedLogs = 0, this.unreadErrors = 0;
|
|
2393
|
+
}
|
|
2394
|
+
};
|
|
2395
|
+
//#endregion
|
|
2396
|
+
export { ti as DevTerminal };
|