@resourcexjs/cli 0.5.0 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,81 +1,3291 @@
1
- #!/usr/bin/env node
2
- // src/index.ts
3
- import { createResourceX, ResourceXError } from "resourcexjs";
4
- var VERSION = "0.5.0";
5
- var HELP = `
6
- arp - Agent Resource Protocol CLI
7
-
8
- Usage:
9
- arp <url> Resolve an ARP URL and print the content
10
- arp resolve <url> Same as above
11
- arp parse <url> Parse an ARP URL and print components
12
-
13
- Options:
14
- -h, --help Show this help
15
- -v, --version Show version
16
- -j, --json Output as JSON
17
-
18
- Examples:
19
- arp "arp:text:https://example.com/file.txt"
20
- arp parse "arp:text:https://example.com/file.txt"
21
- arp resolve "arp:text:file:///path/to/file.txt" --json
22
- `.trim();
23
- async function main() {
24
- const args = process.argv.slice(2);
25
- if (args.length === 0 || args.includes("-h") || args.includes("--help")) {
26
- console.log(HELP);
27
- process.exit(0);
28
- }
29
- if (args.includes("-v") || args.includes("--version")) {
30
- console.log(VERSION);
31
- process.exit(0);
32
- }
33
- const jsonOutput = args.includes("-j") || args.includes("--json");
34
- const filteredArgs = args.filter((a) => !a.startsWith("-"));
35
- const command = filteredArgs[0];
36
- const rx = createResourceX();
37
- try {
38
- if (command === "parse") {
39
- const url = filteredArgs[1];
40
- if (!url) {
41
- console.error("Error: Missing ARP URL");
42
- process.exit(1);
1
+ #!/usr/bin/env bun
2
+ // @bun
3
+ var __defProp = Object.defineProperty;
4
+ var __export = (target, all) => {
5
+ for (var name in all)
6
+ __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true,
9
+ configurable: true,
10
+ set: (newValue) => all[name] = () => newValue
11
+ });
12
+ };
13
+ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
14
+ var __require = import.meta.require;
15
+
16
+ // ../../node_modules/.bun/consola@3.4.2/node_modules/consola/dist/chunks/prompt.mjs
17
+ var exports_prompt = {};
18
+ __export(exports_prompt, {
19
+ prompt: () => prompt,
20
+ kCancel: () => kCancel
21
+ });
22
+ import g, { stdin, stdout } from "process";
23
+ import f from "readline";
24
+ import { WriteStream } from "tty";
25
+ function getDefaultExportFromCjs(x) {
26
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
27
+ }
28
+ function requireSrc() {
29
+ if (hasRequiredSrc)
30
+ return src;
31
+ hasRequiredSrc = 1;
32
+ const ESC = "\x1B";
33
+ const CSI = `${ESC}[`;
34
+ const beep = "\x07";
35
+ const cursor = {
36
+ to(x, y) {
37
+ if (!y)
38
+ return `${CSI}${x + 1}G`;
39
+ return `${CSI}${y + 1};${x + 1}H`;
40
+ },
41
+ move(x, y) {
42
+ let ret = "";
43
+ if (x < 0)
44
+ ret += `${CSI}${-x}D`;
45
+ else if (x > 0)
46
+ ret += `${CSI}${x}C`;
47
+ if (y < 0)
48
+ ret += `${CSI}${-y}A`;
49
+ else if (y > 0)
50
+ ret += `${CSI}${y}B`;
51
+ return ret;
52
+ },
53
+ up: (count = 1) => `${CSI}${count}A`,
54
+ down: (count = 1) => `${CSI}${count}B`,
55
+ forward: (count = 1) => `${CSI}${count}C`,
56
+ backward: (count = 1) => `${CSI}${count}D`,
57
+ nextLine: (count = 1) => `${CSI}E`.repeat(count),
58
+ prevLine: (count = 1) => `${CSI}F`.repeat(count),
59
+ left: `${CSI}G`,
60
+ hide: `${CSI}?25l`,
61
+ show: `${CSI}?25h`,
62
+ save: `${ESC}7`,
63
+ restore: `${ESC}8`
64
+ };
65
+ const scroll = {
66
+ up: (count = 1) => `${CSI}S`.repeat(count),
67
+ down: (count = 1) => `${CSI}T`.repeat(count)
68
+ };
69
+ const erase = {
70
+ screen: `${CSI}2J`,
71
+ up: (count = 1) => `${CSI}1J`.repeat(count),
72
+ down: (count = 1) => `${CSI}J`.repeat(count),
73
+ line: `${CSI}2K`,
74
+ lineEnd: `${CSI}K`,
75
+ lineStart: `${CSI}1K`,
76
+ lines(count) {
77
+ let clear = "";
78
+ for (let i = 0;i < count; i++)
79
+ clear += this.line + (i < count - 1 ? cursor.up() : "");
80
+ if (count)
81
+ clear += cursor.left;
82
+ return clear;
83
+ }
84
+ };
85
+ src = { cursor, scroll, erase, beep };
86
+ return src;
87
+ }
88
+ function requirePicocolors() {
89
+ if (hasRequiredPicocolors)
90
+ return picocolors.exports;
91
+ hasRequiredPicocolors = 1;
92
+ let p = process || {}, argv2 = p.argv || [], env2 = p.env || {};
93
+ let isColorSupported2 = !(!!env2.NO_COLOR || argv2.includes("--no-color")) && (!!env2.FORCE_COLOR || argv2.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env2.TERM !== "dumb" || !!env2.CI);
94
+ let formatter = (open, close, replace = open) => (input) => {
95
+ let string = "" + input, index = string.indexOf(close, open.length);
96
+ return ~index ? open + replaceClose2(string, close, replace, index) + close : open + string + close;
97
+ };
98
+ let replaceClose2 = (string, close, replace, index) => {
99
+ let result = "", cursor = 0;
100
+ do {
101
+ result += string.substring(cursor, index) + replace;
102
+ cursor = index + close.length;
103
+ index = string.indexOf(close, cursor);
104
+ } while (~index);
105
+ return result + string.substring(cursor);
106
+ };
107
+ let createColors2 = (enabled = isColorSupported2) => {
108
+ let f2 = enabled ? formatter : () => String;
109
+ return {
110
+ isColorSupported: enabled,
111
+ reset: f2("\x1B[0m", "\x1B[0m"),
112
+ bold: f2("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
113
+ dim: f2("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
114
+ italic: f2("\x1B[3m", "\x1B[23m"),
115
+ underline: f2("\x1B[4m", "\x1B[24m"),
116
+ inverse: f2("\x1B[7m", "\x1B[27m"),
117
+ hidden: f2("\x1B[8m", "\x1B[28m"),
118
+ strikethrough: f2("\x1B[9m", "\x1B[29m"),
119
+ black: f2("\x1B[30m", "\x1B[39m"),
120
+ red: f2("\x1B[31m", "\x1B[39m"),
121
+ green: f2("\x1B[32m", "\x1B[39m"),
122
+ yellow: f2("\x1B[33m", "\x1B[39m"),
123
+ blue: f2("\x1B[34m", "\x1B[39m"),
124
+ magenta: f2("\x1B[35m", "\x1B[39m"),
125
+ cyan: f2("\x1B[36m", "\x1B[39m"),
126
+ white: f2("\x1B[37m", "\x1B[39m"),
127
+ gray: f2("\x1B[90m", "\x1B[39m"),
128
+ bgBlack: f2("\x1B[40m", "\x1B[49m"),
129
+ bgRed: f2("\x1B[41m", "\x1B[49m"),
130
+ bgGreen: f2("\x1B[42m", "\x1B[49m"),
131
+ bgYellow: f2("\x1B[43m", "\x1B[49m"),
132
+ bgBlue: f2("\x1B[44m", "\x1B[49m"),
133
+ bgMagenta: f2("\x1B[45m", "\x1B[49m"),
134
+ bgCyan: f2("\x1B[46m", "\x1B[49m"),
135
+ bgWhite: f2("\x1B[47m", "\x1B[49m"),
136
+ blackBright: f2("\x1B[90m", "\x1B[39m"),
137
+ redBright: f2("\x1B[91m", "\x1B[39m"),
138
+ greenBright: f2("\x1B[92m", "\x1B[39m"),
139
+ yellowBright: f2("\x1B[93m", "\x1B[39m"),
140
+ blueBright: f2("\x1B[94m", "\x1B[39m"),
141
+ magentaBright: f2("\x1B[95m", "\x1B[39m"),
142
+ cyanBright: f2("\x1B[96m", "\x1B[39m"),
143
+ whiteBright: f2("\x1B[97m", "\x1B[39m"),
144
+ bgBlackBright: f2("\x1B[100m", "\x1B[49m"),
145
+ bgRedBright: f2("\x1B[101m", "\x1B[49m"),
146
+ bgGreenBright: f2("\x1B[102m", "\x1B[49m"),
147
+ bgYellowBright: f2("\x1B[103m", "\x1B[49m"),
148
+ bgBlueBright: f2("\x1B[104m", "\x1B[49m"),
149
+ bgMagentaBright: f2("\x1B[105m", "\x1B[49m"),
150
+ bgCyanBright: f2("\x1B[106m", "\x1B[49m"),
151
+ bgWhiteBright: f2("\x1B[107m", "\x1B[49m")
152
+ };
153
+ };
154
+ picocolors.exports = createColors2();
155
+ picocolors.exports.createColors = createColors2;
156
+ return picocolors.exports;
157
+ }
158
+ function J({ onlyFirst: t = false } = {}) {
159
+ const F = ["[\\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("|");
160
+ return new RegExp(F, t ? undefined : "g");
161
+ }
162
+ function T$1(t) {
163
+ if (typeof t != "string")
164
+ throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);
165
+ return t.replace(Q, "");
166
+ }
167
+ function O(t) {
168
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
169
+ }
170
+ function A$1(t, u = {}) {
171
+ if (typeof t != "string" || t.length === 0 || (u = { ambiguousIsNarrow: true, ...u }, t = T$1(t), t.length === 0))
172
+ return 0;
173
+ t = t.replace(FD(), " ");
174
+ const F = u.ambiguousIsNarrow ? 1 : 2;
175
+ let e2 = 0;
176
+ for (const s of t) {
177
+ const i = s.codePointAt(0);
178
+ if (i <= 31 || i >= 127 && i <= 159 || i >= 768 && i <= 879)
179
+ continue;
180
+ switch (DD.eastAsianWidth(s)) {
181
+ case "F":
182
+ case "W":
183
+ e2 += 2;
184
+ break;
185
+ case "A":
186
+ e2 += F;
187
+ break;
188
+ default:
189
+ e2 += 1;
190
+ }
191
+ }
192
+ return e2;
193
+ }
194
+ function sD() {
195
+ const t = new Map;
196
+ for (const [u, F] of Object.entries(r)) {
197
+ for (const [e2, s] of Object.entries(F))
198
+ r[e2] = { open: `\x1B[${s[0]}m`, close: `\x1B[${s[1]}m` }, F[e2] = r[e2], t.set(s[0], s[1]);
199
+ Object.defineProperty(r, u, { value: F, enumerable: false });
200
+ }
201
+ return Object.defineProperty(r, "codes", { value: t, enumerable: false }), r.color.close = "\x1B[39m", r.bgColor.close = "\x1B[49m", r.color.ansi = L$1(), r.color.ansi256 = N(), r.color.ansi16m = I(), r.bgColor.ansi = L$1(m), r.bgColor.ansi256 = N(m), r.bgColor.ansi16m = I(m), Object.defineProperties(r, { rgbToAnsi256: { value: (u, F, e2) => u === F && F === e2 ? u < 8 ? 16 : u > 248 ? 231 : Math.round((u - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u / 255 * 5) + 6 * Math.round(F / 255 * 5) + Math.round(e2 / 255 * 5), enumerable: false }, hexToRgb: { value: (u) => {
202
+ const F = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));
203
+ if (!F)
204
+ return [0, 0, 0];
205
+ let [e2] = F;
206
+ e2.length === 3 && (e2 = [...e2].map((i) => i + i).join(""));
207
+ const s = Number.parseInt(e2, 16);
208
+ return [s >> 16 & 255, s >> 8 & 255, s & 255];
209
+ }, enumerable: false }, hexToAnsi256: { value: (u) => r.rgbToAnsi256(...r.hexToRgb(u)), enumerable: false }, ansi256ToAnsi: { value: (u) => {
210
+ if (u < 8)
211
+ return 30 + u;
212
+ if (u < 16)
213
+ return 90 + (u - 8);
214
+ let F, e2, s;
215
+ if (u >= 232)
216
+ F = ((u - 232) * 10 + 8) / 255, e2 = F, s = F;
217
+ else {
218
+ u -= 16;
219
+ const C = u % 36;
220
+ F = Math.floor(u / 36) / 5, e2 = Math.floor(C / 6) / 5, s = C % 6 / 5;
221
+ }
222
+ const i = Math.max(F, e2, s) * 2;
223
+ if (i === 0)
224
+ return 30;
225
+ let D = 30 + (Math.round(s) << 2 | Math.round(e2) << 1 | Math.round(F));
226
+ return i === 2 && (D += 60), D;
227
+ }, enumerable: false }, rgbToAnsi: { value: (u, F, e2) => r.ansi256ToAnsi(r.rgbToAnsi256(u, F, e2)), enumerable: false }, hexToAnsi: { value: (u) => r.ansi256ToAnsi(r.hexToAnsi256(u)), enumerable: false } }), r;
228
+ }
229
+ function G(t, u, F) {
230
+ return String(t).normalize().replace(/\r\n/g, `
231
+ `).split(`
232
+ `).map((e2) => oD(e2, u, F)).join(`
233
+ `);
234
+ }
235
+ function k$1(t, u) {
236
+ if (typeof t == "string")
237
+ return c.aliases.get(t) === u;
238
+ for (const F of t)
239
+ if (F !== undefined && k$1(F, u))
240
+ return true;
241
+ return false;
242
+ }
243
+ function lD(t, u) {
244
+ if (t === u)
245
+ return;
246
+ const F = t.split(`
247
+ `), e2 = u.split(`
248
+ `), s = [];
249
+ for (let i = 0;i < Math.max(F.length, e2.length); i++)
250
+ F[i] !== e2[i] && s.push(i);
251
+ return s;
252
+ }
253
+ function d$1(t, u) {
254
+ const F = t;
255
+ F.isTTY && F.setRawMode(u);
256
+ }
257
+
258
+ class x {
259
+ constructor(u, F = true) {
260
+ h(this, "input"), h(this, "output"), h(this, "_abortSignal"), h(this, "rl"), h(this, "opts"), h(this, "_render"), h(this, "_track", false), h(this, "_prevFrame", ""), h(this, "_subscribers", new Map), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
261
+ const { input: e2 = stdin, output: s = stdout, render: i, signal: D, ...C } = u;
262
+ this.opts = C, 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 = F, this._abortSignal = D, this.input = e2, this.output = s;
263
+ }
264
+ unsubscribe() {
265
+ this._subscribers.clear();
266
+ }
267
+ setSubscriber(u, F) {
268
+ const e2 = this._subscribers.get(u) ?? [];
269
+ e2.push(F), this._subscribers.set(u, e2);
270
+ }
271
+ on(u, F) {
272
+ this.setSubscriber(u, { cb: F });
273
+ }
274
+ once(u, F) {
275
+ this.setSubscriber(u, { cb: F, once: true });
276
+ }
277
+ emit(u, ...F) {
278
+ const e2 = this._subscribers.get(u) ?? [], s = [];
279
+ for (const i of e2)
280
+ i.cb(...F), i.once && s.push(() => e2.splice(e2.indexOf(i), 1));
281
+ for (const i of s)
282
+ i();
283
+ }
284
+ prompt() {
285
+ return new Promise((u, F) => {
286
+ if (this._abortSignal) {
287
+ if (this._abortSignal.aborted)
288
+ return this.state = "cancel", this.close(), u(S);
289
+ this._abortSignal.addEventListener("abort", () => {
290
+ this.state = "cancel", this.close();
291
+ }, { once: true });
292
+ }
293
+ const e2 = new WriteStream(0);
294
+ e2._write = (s, i, D) => {
295
+ this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D();
296
+ }, this.input.pipe(e2), this.rl = f.createInterface({ input: this.input, output: e2, tabSize: 2, prompt: "", escapeCodeTimeout: 50 }), f.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== undefined && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), d$1(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
297
+ this.output.write(srcExports.cursor.show), this.output.off("resize", this.render), d$1(this.input, false), u(this.value);
298
+ }), this.once("cancel", () => {
299
+ this.output.write(srcExports.cursor.show), this.output.off("resize", this.render), d$1(this.input, false), u(S);
300
+ });
301
+ });
302
+ }
303
+ onKeypress(u, F) {
304
+ if (this.state === "error" && (this.state = "active"), F?.name && (!this._track && c.aliases.has(F.name) && this.emit("cursor", c.aliases.get(F.name)), c.actions.has(F.name) && this.emit("cursor", F.name)), u && (u.toLowerCase() === "y" || u.toLowerCase() === "n") && this.emit("confirm", u.toLowerCase() === "y"), u === "\t" && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u && this.emit("key", u.toLowerCase()), F?.name === "return") {
305
+ if (this.opts.validate) {
306
+ const e2 = this.opts.validate(this.value);
307
+ e2 && (this.error = e2 instanceof Error ? e2.message : e2, this.state = "error", this.rl?.write(this.value));
308
+ }
309
+ this.state !== "error" && (this.state = "submit");
310
+ }
311
+ k$1([u, F?.name, F?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
312
+ }
313
+ close() {
314
+ this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
315
+ `), d$1(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
316
+ }
317
+ restoreCursor() {
318
+ const u = G(this._prevFrame, process.stdout.columns, { hard: true }).split(`
319
+ `).length - 1;
320
+ this.output.write(srcExports.cursor.move(-999, u * -1));
321
+ }
322
+ render() {
323
+ const u = G(this._render(this) ?? "", process.stdout.columns, { hard: true });
324
+ if (u !== this._prevFrame) {
325
+ if (this.state === "initial")
326
+ this.output.write(srcExports.cursor.hide);
327
+ else {
328
+ const F = lD(this._prevFrame, u);
329
+ if (this.restoreCursor(), F && F?.length === 1) {
330
+ const e2 = F[0];
331
+ this.output.write(srcExports.cursor.move(0, e2)), this.output.write(srcExports.erase.lines(1));
332
+ const s = u.split(`
333
+ `);
334
+ this.output.write(s[e2]), this._prevFrame = u, this.output.write(srcExports.cursor.move(0, s.length - e2 - 1));
335
+ return;
336
+ }
337
+ if (F && F?.length > 1) {
338
+ const e2 = F[0];
339
+ this.output.write(srcExports.cursor.move(0, e2)), this.output.write(srcExports.erase.down());
340
+ const s = u.split(`
341
+ `).slice(e2);
342
+ this.output.write(s.join(`
343
+ `)), this._prevFrame = u;
344
+ return;
345
+ }
346
+ this.output.write(srcExports.erase.down());
347
+ }
348
+ this.output.write(u), this.state === "initial" && (this.state = "active"), this._prevFrame = u;
349
+ }
350
+ }
351
+ }
352
+ function ce() {
353
+ return g.platform !== "win32" ? g.env.TERM !== "linux" : !!g.env.CI || !!g.env.WT_SESSION || !!g.env.TERMINUS_SUBLIME || g.env.ConEmuTask === "{cmd::Cmder}" || g.env.TERM_PROGRAM === "Terminus-Sublime" || g.env.TERM_PROGRAM === "vscode" || g.env.TERM === "xterm-256color" || g.env.TERM === "alacritty" || g.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
354
+ }
355
+ async function prompt(message, opts = {}) {
356
+ const handleCancel = (value) => {
357
+ if (typeof value !== "symbol" || value.toString() !== "Symbol(clack:cancel)") {
358
+ return value;
359
+ }
360
+ switch (opts.cancel) {
361
+ case "reject": {
362
+ const error = new Error("Prompt cancelled.");
363
+ error.name = "ConsolaPromptCancelledError";
364
+ if (Error.captureStackTrace) {
365
+ Error.captureStackTrace(error, prompt);
366
+ }
367
+ throw error;
368
+ }
369
+ case "undefined": {
370
+ return;
371
+ }
372
+ case "null": {
373
+ return null;
374
+ }
375
+ case "symbol": {
376
+ return kCancel;
377
+ }
378
+ default:
379
+ case "default": {
380
+ return opts.default ?? opts.initial;
381
+ }
382
+ }
383
+ };
384
+ if (!opts.type || opts.type === "text") {
385
+ return await he({
386
+ message,
387
+ defaultValue: opts.default,
388
+ placeholder: opts.placeholder,
389
+ initialValue: opts.initial
390
+ }).then(handleCancel);
391
+ }
392
+ if (opts.type === "confirm") {
393
+ return await ye({
394
+ message,
395
+ initialValue: opts.initial
396
+ }).then(handleCancel);
397
+ }
398
+ if (opts.type === "select") {
399
+ return await ve({
400
+ message,
401
+ options: opts.options.map((o2) => typeof o2 === "string" ? { value: o2, label: o2 } : o2),
402
+ initialValue: opts.initial
403
+ }).then(handleCancel);
404
+ }
405
+ if (opts.type === "multiselect") {
406
+ return await fe({
407
+ message,
408
+ options: opts.options.map((o2) => typeof o2 === "string" ? { value: o2, label: o2 } : o2),
409
+ required: opts.required,
410
+ initialValues: opts.initial
411
+ }).then(handleCancel);
412
+ }
413
+ throw new Error(`Unknown prompt type: ${opts.type}`);
414
+ }
415
+ var src, hasRequiredSrc, srcExports, picocolors, hasRequiredPicocolors, picocolorsExports, e, Q, P$1, X, DD, uD = function() {
416
+ 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;
417
+ }, FD, m = 10, L$1 = (t = 0) => (u) => `\x1B[${u + t}m`, N = (t = 0) => (u) => `\x1B[${38 + t};5;${u}m`, I = (t = 0) => (u, F, e2) => `\x1B[${38 + t};2;${u};${F};${e2}m`, r, tD, eD, iD, v, CD = 39, w$1 = "\x07", W$1 = "[", rD = "]", R = "m", y, V$1 = (t) => `${v.values().next().value}${W$1}${t}${R}`, z = (t) => `${v.values().next().value}${y}${t}${w$1}`, ED = (t) => t.split(" ").map((u) => A$1(u)), _ = (t, u, F) => {
418
+ const e2 = [...u];
419
+ let s = false, i = false, D = A$1(T$1(t[t.length - 1]));
420
+ for (const [C, o] of e2.entries()) {
421
+ const E = A$1(o);
422
+ if (D + E <= F ? t[t.length - 1] += o : (t.push(o), D = 0), v.has(o) && (s = true, i = e2.slice(C + 1).join("").startsWith(y)), s) {
423
+ i ? o === w$1 && (s = false, i = false) : o === R && (s = false);
424
+ continue;
425
+ }
426
+ D += E, D === F && C < e2.length - 1 && (t.push(""), D = 0);
427
+ }
428
+ !D && t[t.length - 1].length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
429
+ }, nD = (t) => {
430
+ const u = t.split(" ");
431
+ let F = u.length;
432
+ for (;F > 0 && !(A$1(u[F - 1]) > 0); )
433
+ F--;
434
+ return F === u.length ? t : u.slice(0, F).join(" ") + u.slice(F).join("");
435
+ }, oD = (t, u, F = {}) => {
436
+ if (F.trim !== false && t.trim() === "")
437
+ return "";
438
+ let e2 = "", s, i;
439
+ const D = ED(t);
440
+ let C = [""];
441
+ for (const [E, a] of t.split(" ").entries()) {
442
+ F.trim !== false && (C[C.length - 1] = C[C.length - 1].trimStart());
443
+ let n = A$1(C[C.length - 1]);
444
+ if (E !== 0 && (n >= u && (F.wordWrap === false || F.trim === false) && (C.push(""), n = 0), (n > 0 || F.trim === false) && (C[C.length - 1] += " ", n++)), F.hard && D[E] > u) {
445
+ const B = u - n, p = 1 + Math.floor((D[E] - B - 1) / u);
446
+ Math.floor((D[E] - 1) / u) < p && C.push(""), _(C, a, u);
447
+ continue;
448
+ }
449
+ if (n + D[E] > u && n > 0 && D[E] > 0) {
450
+ if (F.wordWrap === false && n < u) {
451
+ _(C, a, u);
452
+ continue;
453
+ }
454
+ C.push("");
455
+ }
456
+ if (n + D[E] > u && F.wordWrap === false) {
457
+ _(C, a, u);
458
+ continue;
459
+ }
460
+ C[C.length - 1] += a;
461
+ }
462
+ F.trim !== false && (C = C.map((E) => nD(E)));
463
+ const o = [...C.join(`
464
+ `)];
465
+ for (const [E, a] of o.entries()) {
466
+ if (e2 += a, v.has(a)) {
467
+ const { groups: B } = new RegExp(`(?:\\${W$1}(?<code>\\d+)m|\\${y}(?<uri>.*)${w$1})`).exec(o.slice(E).join("")) || { groups: {} };
468
+ if (B.code !== undefined) {
469
+ const p = Number.parseFloat(B.code);
470
+ s = p === CD ? undefined : p;
471
+ } else
472
+ B.uri !== undefined && (i = B.uri.length === 0 ? undefined : B.uri);
473
+ }
474
+ const n = iD.codes.get(Number(s));
475
+ o[E + 1] === `
476
+ ` ? (i && (e2 += z("")), s && n && (e2 += V$1(n))) : a === `
477
+ ` && (s && n && (e2 += V$1(s)), i && (e2 += z(i)));
478
+ }
479
+ return e2;
480
+ }, aD, c, S, AD, pD = (t, u, F) => (u in t) ? AD(t, u, { enumerable: true, configurable: true, writable: true, value: F }) : t[u] = F, h = (t, u, F) => (pD(t, typeof u != "symbol" ? u + "" : u, F), F), fD, bD, mD = (t, u, F) => (u in t) ? bD(t, u, { enumerable: true, configurable: true, writable: true, value: F }) : t[u] = F, Y = (t, u, F) => (mD(t, typeof u != "symbol" ? u + "" : u, F), F), wD, SD, $D = (t, u, F) => (u in t) ? SD(t, u, { enumerable: true, configurable: true, writable: true, value: F }) : t[u] = F, q = (t, u, F) => ($D(t, typeof u != "symbol" ? u + "" : u, F), F), jD, PD, V, u = (t, n) => V ? t : n, le, L, W, C, o, d, k, P, A, T, F, w = (t) => {
481
+ switch (t) {
482
+ case "initial":
483
+ case "active":
484
+ return e.cyan(le);
485
+ case "cancel":
486
+ return e.red(L);
487
+ case "error":
488
+ return e.yellow(W);
489
+ case "submit":
490
+ return e.green(C);
491
+ }
492
+ }, B = (t) => {
493
+ const { cursor: n, options: s, style: r2 } = t, i = t.maxItems ?? Number.POSITIVE_INFINITY, a = Math.max(process.stdout.rows - 4, 0), c2 = Math.min(a, Math.max(i, 5));
494
+ let l = 0;
495
+ n >= l + c2 - 3 ? l = Math.max(Math.min(n - c2 + 3, s.length - c2), 0) : n < l + 2 && (l = Math.max(n - 2, 0));
496
+ const $ = c2 < s.length && l > 0, p = c2 < s.length && l + c2 < s.length;
497
+ return s.slice(l, l + c2).map((M, v2, x2) => {
498
+ const j = v2 === 0 && $, E = v2 === x2.length - 1 && p;
499
+ return j || E ? e.dim("...") : r2(M, v2 + l === n);
500
+ });
501
+ }, he = (t) => new PD({ validate: t.validate, placeholder: t.placeholder, defaultValue: t.defaultValue, initialValue: t.initialValue, render() {
502
+ const n = `${e.gray(o)}
503
+ ${w(this.state)} ${t.message}
504
+ `, s = t.placeholder ? e.inverse(t.placeholder[0]) + e.dim(t.placeholder.slice(1)) : e.inverse(e.hidden("_")), r2 = this.value ? this.valueWithCursor : s;
505
+ switch (this.state) {
506
+ case "error":
507
+ return `${n.trim()}
508
+ ${e.yellow(o)} ${r2}
509
+ ${e.yellow(d)} ${e.yellow(this.error)}
510
+ `;
511
+ case "submit":
512
+ return `${n}${e.gray(o)} ${e.dim(this.value || t.placeholder)}`;
513
+ case "cancel":
514
+ return `${n}${e.gray(o)} ${e.strikethrough(e.dim(this.value ?? ""))}${this.value?.trim() ? `
515
+ ${e.gray(o)}` : ""}`;
516
+ default:
517
+ return `${n}${e.cyan(o)} ${r2}
518
+ ${e.cyan(d)}
519
+ `;
520
+ }
521
+ } }).prompt(), ye = (t) => {
522
+ const n = t.active ?? "Yes", s = t.inactive ?? "No";
523
+ return new fD({ active: n, inactive: s, initialValue: t.initialValue ?? true, render() {
524
+ const r2 = `${e.gray(o)}
525
+ ${w(this.state)} ${t.message}
526
+ `, i = this.value ? n : s;
527
+ switch (this.state) {
528
+ case "submit":
529
+ return `${r2}${e.gray(o)} ${e.dim(i)}`;
530
+ case "cancel":
531
+ return `${r2}${e.gray(o)} ${e.strikethrough(e.dim(i))}
532
+ ${e.gray(o)}`;
533
+ default:
534
+ return `${r2}${e.cyan(o)} ${this.value ? `${e.green(k)} ${n}` : `${e.dim(P)} ${e.dim(n)}`} ${e.dim("/")} ${this.value ? `${e.dim(P)} ${e.dim(s)}` : `${e.green(k)} ${s}`}
535
+ ${e.cyan(d)}
536
+ `;
537
+ }
538
+ } }).prompt();
539
+ }, ve = (t) => {
540
+ const n = (s, r2) => {
541
+ const i = s.label ?? String(s.value);
542
+ switch (r2) {
543
+ case "selected":
544
+ return `${e.dim(i)}`;
545
+ case "active":
546
+ return `${e.green(k)} ${i} ${s.hint ? e.dim(`(${s.hint})`) : ""}`;
547
+ case "cancelled":
548
+ return `${e.strikethrough(e.dim(i))}`;
549
+ default:
550
+ return `${e.dim(P)} ${e.dim(i)}`;
551
+ }
552
+ };
553
+ return new jD({ options: t.options, initialValue: t.initialValue, render() {
554
+ const s = `${e.gray(o)}
555
+ ${w(this.state)} ${t.message}
556
+ `;
557
+ switch (this.state) {
558
+ case "submit":
559
+ return `${s}${e.gray(o)} ${n(this.options[this.cursor], "selected")}`;
560
+ case "cancel":
561
+ return `${s}${e.gray(o)} ${n(this.options[this.cursor], "cancelled")}
562
+ ${e.gray(o)}`;
563
+ default:
564
+ return `${s}${e.cyan(o)} ${B({ cursor: this.cursor, options: this.options, maxItems: t.maxItems, style: (r2, i) => n(r2, i ? "active" : "inactive") }).join(`
565
+ ${e.cyan(o)} `)}
566
+ ${e.cyan(d)}
567
+ `;
568
+ }
569
+ } }).prompt();
570
+ }, fe = (t) => {
571
+ const n = (s, r2) => {
572
+ const i = s.label ?? String(s.value);
573
+ return r2 === "active" ? `${e.cyan(A)} ${i} ${s.hint ? e.dim(`(${s.hint})`) : ""}` : r2 === "selected" ? `${e.green(T)} ${e.dim(i)}` : r2 === "cancelled" ? `${e.strikethrough(e.dim(i))}` : r2 === "active-selected" ? `${e.green(T)} ${i} ${s.hint ? e.dim(`(${s.hint})`) : ""}` : r2 === "submitted" ? `${e.dim(i)}` : `${e.dim(F)} ${e.dim(i)}`;
574
+ };
575
+ return new wD({ options: t.options, initialValues: t.initialValues, required: t.required ?? true, cursorAt: t.cursorAt, validate(s) {
576
+ if (this.required && s.length === 0)
577
+ return `Please select at least one option.
578
+ ${e.reset(e.dim(`Press ${e.gray(e.bgWhite(e.inverse(" space ")))} to select, ${e.gray(e.bgWhite(e.inverse(" enter ")))} to submit`))}`;
579
+ }, render() {
580
+ const s = `${e.gray(o)}
581
+ ${w(this.state)} ${t.message}
582
+ `, r2 = (i, a) => {
583
+ const c2 = this.value.includes(i.value);
584
+ return a && c2 ? n(i, "active-selected") : c2 ? n(i, "selected") : n(i, a ? "active" : "inactive");
585
+ };
586
+ switch (this.state) {
587
+ case "submit":
588
+ return `${s}${e.gray(o)} ${this.options.filter(({ value: i }) => this.value.includes(i)).map((i) => n(i, "submitted")).join(e.dim(", ")) || e.dim("none")}`;
589
+ case "cancel": {
590
+ const i = this.options.filter(({ value: a }) => this.value.includes(a)).map((a) => n(a, "cancelled")).join(e.dim(", "));
591
+ return `${s}${e.gray(o)} ${i.trim() ? `${i}
592
+ ${e.gray(o)}` : ""}`;
593
+ }
594
+ case "error": {
595
+ const i = this.error.split(`
596
+ `).map((a, c2) => c2 === 0 ? `${e.yellow(d)} ${e.yellow(a)}` : ` ${a}`).join(`
597
+ `);
598
+ return `${s + e.yellow(o)} ${B({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: r2 }).join(`
599
+ ${e.yellow(o)} `)}
600
+ ${i}
601
+ `;
602
+ }
603
+ default:
604
+ return `${s}${e.cyan(o)} ${B({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: r2 }).join(`
605
+ ${e.cyan(o)} `)}
606
+ ${e.cyan(d)}
607
+ `;
608
+ }
609
+ } }).prompt();
610
+ }, kCancel;
611
+ var init_prompt = __esm(() => {
612
+ srcExports = requireSrc();
613
+ picocolors = { exports: {} };
614
+ picocolorsExports = /* @__PURE__ */ requirePicocolors();
615
+ e = /* @__PURE__ */ getDefaultExportFromCjs(picocolorsExports);
616
+ Q = J();
617
+ P$1 = { exports: {} };
618
+ (function(t) {
619
+ var u = {};
620
+ t.exports = u, u.eastAsianWidth = function(e2) {
621
+ var s = e2.charCodeAt(0), i = e2.length == 2 ? e2.charCodeAt(1) : 0, D = s;
622
+ return 55296 <= s && s <= 56319 && 56320 <= i && i <= 57343 && (s &= 1023, i &= 1023, D = s << 10 | i, D += 65536), D == 12288 || 65281 <= D && D <= 65376 || 65504 <= D && D <= 65510 ? "F" : D == 8361 || 65377 <= D && D <= 65470 || 65474 <= D && D <= 65479 || 65482 <= D && D <= 65487 || 65490 <= D && D <= 65495 || 65498 <= D && D <= 65500 || 65512 <= D && D <= 65518 ? "H" : 4352 <= D && D <= 4447 || 4515 <= D && D <= 4519 || 4602 <= D && D <= 4607 || 9001 <= D && D <= 9002 || 11904 <= D && D <= 11929 || 11931 <= D && D <= 12019 || 12032 <= D && D <= 12245 || 12272 <= D && D <= 12283 || 12289 <= D && D <= 12350 || 12353 <= D && D <= 12438 || 12441 <= D && D <= 12543 || 12549 <= D && D <= 12589 || 12593 <= D && D <= 12686 || 12688 <= D && D <= 12730 || 12736 <= D && D <= 12771 || 12784 <= D && D <= 12830 || 12832 <= D && D <= 12871 || 12880 <= D && D <= 13054 || 13056 <= D && D <= 19903 || 19968 <= D && D <= 42124 || 42128 <= D && D <= 42182 || 43360 <= D && D <= 43388 || 44032 <= D && D <= 55203 || 55216 <= D && D <= 55238 || 55243 <= D && D <= 55291 || 63744 <= D && D <= 64255 || 65040 <= D && D <= 65049 || 65072 <= D && D <= 65106 || 65108 <= D && D <= 65126 || 65128 <= D && D <= 65131 || 110592 <= D && D <= 110593 || 127488 <= D && D <= 127490 || 127504 <= D && D <= 127546 || 127552 <= D && D <= 127560 || 127568 <= D && D <= 127569 || 131072 <= D && D <= 194367 || 177984 <= D && D <= 196605 || 196608 <= D && D <= 262141 ? "W" : 32 <= D && D <= 126 || 162 <= D && D <= 163 || 165 <= D && D <= 166 || D == 172 || D == 175 || 10214 <= D && D <= 10221 || 10629 <= D && D <= 10630 ? "Na" : D == 161 || D == 164 || 167 <= D && D <= 168 || D == 170 || 173 <= D && D <= 174 || 176 <= D && D <= 180 || 182 <= D && D <= 186 || 188 <= D && D <= 191 || D == 198 || D == 208 || 215 <= D && D <= 216 || 222 <= D && D <= 225 || D == 230 || 232 <= D && D <= 234 || 236 <= D && D <= 237 || D == 240 || 242 <= D && D <= 243 || 247 <= D && D <= 250 || D == 252 || D == 254 || D == 257 || D == 273 || D == 275 || D == 283 || 294 <= D && D <= 295 || D == 299 || 305 <= D && D <= 307 || D == 312 || 319 <= D && D <= 322 || D == 324 || 328 <= D && D <= 331 || D == 333 || 338 <= D && D <= 339 || 358 <= D && D <= 359 || D == 363 || D == 462 || D == 464 || D == 466 || D == 468 || D == 470 || D == 472 || D == 474 || D == 476 || D == 593 || D == 609 || D == 708 || D == 711 || 713 <= D && D <= 715 || D == 717 || D == 720 || 728 <= D && D <= 731 || D == 733 || D == 735 || 768 <= D && D <= 879 || 913 <= D && D <= 929 || 931 <= D && D <= 937 || 945 <= D && D <= 961 || 963 <= D && D <= 969 || D == 1025 || 1040 <= D && D <= 1103 || D == 1105 || D == 8208 || 8211 <= D && D <= 8214 || 8216 <= D && D <= 8217 || 8220 <= D && D <= 8221 || 8224 <= D && D <= 8226 || 8228 <= D && D <= 8231 || D == 8240 || 8242 <= D && D <= 8243 || D == 8245 || D == 8251 || D == 8254 || D == 8308 || D == 8319 || 8321 <= D && D <= 8324 || D == 8364 || D == 8451 || D == 8453 || D == 8457 || D == 8467 || D == 8470 || 8481 <= D && D <= 8482 || D == 8486 || D == 8491 || 8531 <= D && D <= 8532 || 8539 <= D && D <= 8542 || 8544 <= D && D <= 8555 || 8560 <= D && D <= 8569 || D == 8585 || 8592 <= D && D <= 8601 || 8632 <= D && D <= 8633 || D == 8658 || D == 8660 || D == 8679 || D == 8704 || 8706 <= D && D <= 8707 || 8711 <= D && D <= 8712 || D == 8715 || D == 8719 || D == 8721 || D == 8725 || D == 8730 || 8733 <= D && D <= 8736 || D == 8739 || D == 8741 || 8743 <= D && D <= 8748 || D == 8750 || 8756 <= D && D <= 8759 || 8764 <= D && D <= 8765 || D == 8776 || D == 8780 || D == 8786 || 8800 <= D && D <= 8801 || 8804 <= D && D <= 8807 || 8810 <= D && D <= 8811 || 8814 <= D && D <= 8815 || 8834 <= D && D <= 8835 || 8838 <= D && D <= 8839 || D == 8853 || D == 8857 || D == 8869 || D == 8895 || D == 8978 || 9312 <= D && D <= 9449 || 9451 <= D && D <= 9547 || 9552 <= D && D <= 9587 || 9600 <= D && D <= 9615 || 9618 <= D && D <= 9621 || 9632 <= D && D <= 9633 || 9635 <= D && D <= 9641 || 9650 <= D && D <= 9651 || 9654 <= D && D <= 9655 || 9660 <= D && D <= 9661 || 9664 <= D && D <= 9665 || 9670 <= D && D <= 9672 || D == 9675 || 9678 <= D && D <= 9681 || 9698 <= D && D <= 9701 || D == 9711 || 9733 <= D && D <= 9734 || D == 9737 || 9742 <= D && D <= 9743 || 9748 <= D && D <= 9749 || D == 9756 || D == 9758 || D == 9792 || D == 9794 || 9824 <= D && D <= 9825 || 9827 <= D && D <= 9829 || 9831 <= D && D <= 9834 || 9836 <= D && D <= 9837 || D == 9839 || 9886 <= D && D <= 9887 || 9918 <= D && D <= 9919 || 9924 <= D && D <= 9933 || 9935 <= D && D <= 9953 || D == 9955 || 9960 <= D && D <= 9983 || D == 10045 || D == 10071 || 10102 <= D && D <= 10111 || 11093 <= D && D <= 11097 || 12872 <= D && D <= 12879 || 57344 <= D && D <= 63743 || 65024 <= D && D <= 65039 || D == 65533 || 127232 <= D && D <= 127242 || 127248 <= D && D <= 127277 || 127280 <= D && D <= 127337 || 127344 <= D && D <= 127386 || 917760 <= D && D <= 917999 || 983040 <= D && D <= 1048573 || 1048576 <= D && D <= 1114109 ? "A" : "N";
623
+ }, u.characterLength = function(e2) {
624
+ var s = this.eastAsianWidth(e2);
625
+ return s == "F" || s == "W" || s == "A" ? 2 : 1;
626
+ };
627
+ function F(e2) {
628
+ return e2.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
629
+ }
630
+ u.length = function(e2) {
631
+ for (var s = F(e2), i = 0, D = 0;D < s.length; D++)
632
+ i = i + this.characterLength(s[D]);
633
+ return i;
634
+ }, u.slice = function(e2, s, i) {
635
+ textLen = u.length(e2), s = s || 0, i = i || 1, s < 0 && (s = textLen + s), i < 0 && (i = textLen + i);
636
+ for (var D = "", C = 0, o = F(e2), E = 0;E < o.length; E++) {
637
+ var a = o[E], n = u.length(a);
638
+ if (C >= s - (n == 2 ? 1 : 0))
639
+ if (C + n <= i)
640
+ D += a;
641
+ else
642
+ break;
643
+ C += n;
644
+ }
645
+ return D;
646
+ };
647
+ })(P$1);
648
+ X = P$1.exports;
649
+ DD = O(X);
650
+ FD = O(uD);
651
+ r = { modifier: { reset: [0, 0], bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], overline: [53, 55], inverse: [7, 27], hidden: [8, 28], strikethrough: [9, 29] }, color: { black: [30, 39], red: [31, 39], green: [32, 39], yellow: [33, 39], blue: [34, 39], magenta: [35, 39], cyan: [36, 39], white: [37, 39], blackBright: [90, 39], gray: [90, 39], grey: [90, 39], redBright: [91, 39], greenBright: [92, 39], yellowBright: [93, 39], blueBright: [94, 39], magentaBright: [95, 39], cyanBright: [96, 39], whiteBright: [97, 39] }, bgColor: { bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], bgYellow: [43, 49], bgBlue: [44, 49], bgMagenta: [45, 49], bgCyan: [46, 49], bgWhite: [47, 49], bgBlackBright: [100, 49], bgGray: [100, 49], bgGrey: [100, 49], bgRedBright: [101, 49], bgGreenBright: [102, 49], bgYellowBright: [103, 49], bgBlueBright: [104, 49], bgMagentaBright: [105, 49], bgCyanBright: [106, 49], bgWhiteBright: [107, 49] } };
652
+ Object.keys(r.modifier);
653
+ tD = Object.keys(r.color);
654
+ eD = Object.keys(r.bgColor);
655
+ [...tD, ...eD];
656
+ iD = sD();
657
+ v = new Set(["\x1B", "\x9B"]);
658
+ y = `${rD}8;;`;
659
+ aD = ["up", "down", "left", "right", "space", "enter", "cancel"];
660
+ c = { actions: new Set(aD), aliases: new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["\x03", "cancel"], ["escape", "cancel"]]) };
661
+ globalThis.process.platform.startsWith("win");
662
+ S = Symbol("clack:cancel");
663
+ AD = Object.defineProperty;
664
+ fD = class fD extends x {
665
+ get cursor() {
666
+ return this.value ? 0 : 1;
667
+ }
668
+ get _value() {
669
+ return this.cursor === 0;
670
+ }
671
+ constructor(u) {
672
+ super(u, false), this.value = !!u.initialValue, this.on("value", () => {
673
+ this.value = this._value;
674
+ }), this.on("confirm", (F) => {
675
+ this.output.write(srcExports.cursor.move(0, -1)), this.value = F, this.state = "submit", this.close();
676
+ }), this.on("cursor", () => {
677
+ this.value = !this.value;
678
+ });
679
+ }
680
+ };
681
+ bD = Object.defineProperty;
682
+ wD = class extends x {
683
+ constructor(u) {
684
+ super(u, false), Y(this, "options"), Y(this, "cursor", 0), this.options = u.options, this.value = [...u.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: F }) => F === u.cursorAt), 0), this.on("key", (F) => {
685
+ F === "a" && this.toggleAll();
686
+ }), this.on("cursor", (F) => {
687
+ switch (F) {
688
+ case "left":
689
+ case "up":
690
+ this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
691
+ break;
692
+ case "down":
693
+ case "right":
694
+ this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
695
+ break;
696
+ case "space":
697
+ this.toggleValue();
698
+ break;
699
+ }
700
+ });
701
+ }
702
+ get _value() {
703
+ return this.options[this.cursor].value;
704
+ }
705
+ toggleAll() {
706
+ const u = this.value.length === this.options.length;
707
+ this.value = u ? [] : this.options.map((F) => F.value);
708
+ }
709
+ toggleValue() {
710
+ const u = this.value.includes(this._value);
711
+ this.value = u ? this.value.filter((F) => F !== this._value) : [...this.value, this._value];
712
+ }
713
+ };
714
+ SD = Object.defineProperty;
715
+ jD = class jD extends x {
716
+ constructor(u) {
717
+ super(u, false), q(this, "options"), q(this, "cursor", 0), this.options = u.options, this.cursor = this.options.findIndex(({ value: F }) => F === u.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (F) => {
718
+ switch (F) {
719
+ case "left":
720
+ case "up":
721
+ this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
722
+ break;
723
+ case "down":
724
+ case "right":
725
+ this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
726
+ break;
727
+ }
728
+ this.changeValue();
729
+ });
730
+ }
731
+ get _value() {
732
+ return this.options[this.cursor];
733
+ }
734
+ changeValue() {
735
+ this.value = this._value.value;
736
+ }
737
+ };
738
+ PD = class PD extends x {
739
+ get valueWithCursor() {
740
+ if (this.state === "submit")
741
+ return this.value;
742
+ if (this.cursor >= this.value.length)
743
+ return `${this.value}\u2588`;
744
+ const u = this.value.slice(0, this.cursor), [F, ...e$1] = this.value.slice(this.cursor);
745
+ return `${u}${e.inverse(F)}${e$1.join("")}`;
746
+ }
747
+ get cursor() {
748
+ return this._cursor;
749
+ }
750
+ constructor(u) {
751
+ super(u), this.on("finalize", () => {
752
+ this.value || (this.value = u.defaultValue);
753
+ });
754
+ }
755
+ };
756
+ V = ce();
757
+ le = u("\u276F", ">");
758
+ L = u("\u25A0", "x");
759
+ W = u("\u25B2", "x");
760
+ C = u("\u2714", "\u221A");
761
+ o = u("");
762
+ d = u("");
763
+ k = u("\u25CF", ">");
764
+ P = u("\u25CB", " ");
765
+ A = u("\u25FB", "[\u2022]");
766
+ T = u("\u25FC", "[+]");
767
+ F = u("\u25FB", "[ ]");
768
+ `${e.gray(o)} `;
769
+ kCancel = Symbol.for("cancel");
770
+ });
771
+
772
+ // ../../node_modules/.bun/@hono+node-server@1.19.9+115df24086ffac64/node_modules/@hono/node-server/dist/index.mjs
773
+ var exports_dist = {};
774
+ __export(exports_dist, {
775
+ serve: () => serve,
776
+ getRequestListener: () => getRequestListener,
777
+ createAdaptorServer: () => createAdaptorServer,
778
+ RequestError: () => RequestError
779
+ });
780
+ import { createServer as createServerHTTP } from "http";
781
+ import { Http2ServerRequest as Http2ServerRequest2 } from "http2";
782
+ import { Http2ServerRequest } from "http2";
783
+ import { Readable } from "stream";
784
+ import crypto from "crypto";
785
+ async function readWithoutBlocking(readPromise) {
786
+ return Promise.race([readPromise, Promise.resolve().then(() => Promise.resolve(undefined))]);
787
+ }
788
+ function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromise) {
789
+ const cancel = (error) => {
790
+ reader.cancel(error).catch(() => {});
791
+ };
792
+ writable.on("close", cancel);
793
+ writable.on("error", cancel);
794
+ (currentReadPromise ?? reader.read()).then(flow, handleStreamError);
795
+ return reader.closed.finally(() => {
796
+ writable.off("close", cancel);
797
+ writable.off("error", cancel);
798
+ });
799
+ function handleStreamError(error) {
800
+ if (error) {
801
+ writable.destroy(error);
802
+ }
803
+ }
804
+ function onDrain() {
805
+ reader.read().then(flow, handleStreamError);
806
+ }
807
+ function flow({ done, value }) {
808
+ try {
809
+ if (done) {
810
+ writable.end();
811
+ } else if (!writable.write(value)) {
812
+ writable.once("drain", onDrain);
813
+ } else {
814
+ return reader.read().then(flow, handleStreamError);
815
+ }
816
+ } catch (e2) {
817
+ handleStreamError(e2);
818
+ }
819
+ }
820
+ }
821
+ function writeFromReadableStream(stream, writable) {
822
+ if (stream.locked) {
823
+ throw new TypeError("ReadableStream is locked.");
824
+ } else if (writable.destroyed) {
825
+ return;
826
+ }
827
+ return writeFromReadableStreamDefaultReader(stream.getReader(), writable);
828
+ }
829
+ var RequestError, toRequestError = (e2) => {
830
+ if (e2 instanceof RequestError) {
831
+ return e2;
832
+ }
833
+ return new RequestError(e2.message, { cause: e2 });
834
+ }, GlobalRequest, Request, newHeadersFromIncoming = (incoming) => {
835
+ const headerRecord = [];
836
+ const rawHeaders = incoming.rawHeaders;
837
+ for (let i2 = 0;i2 < rawHeaders.length; i2 += 2) {
838
+ const { [i2]: key, [i2 + 1]: value } = rawHeaders;
839
+ if (key.charCodeAt(0) !== 58) {
840
+ headerRecord.push([key, value]);
841
+ }
842
+ }
843
+ return new Headers(headerRecord);
844
+ }, wrapBodyStream, newRequestFromIncoming = (method, url, headers, incoming, abortController) => {
845
+ const init2 = {
846
+ method,
847
+ headers,
848
+ signal: abortController.signal
849
+ };
850
+ if (method === "TRACE") {
851
+ init2.method = "GET";
852
+ const req = new Request(url, init2);
853
+ Object.defineProperty(req, "method", {
854
+ get() {
855
+ return "TRACE";
856
+ }
857
+ });
858
+ return req;
859
+ }
860
+ if (!(method === "GET" || method === "HEAD")) {
861
+ if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) {
862
+ init2.body = new ReadableStream({
863
+ start(controller) {
864
+ controller.enqueue(incoming.rawBody);
865
+ controller.close();
866
+ }
867
+ });
868
+ } else if (incoming[wrapBodyStream]) {
869
+ let reader;
870
+ init2.body = new ReadableStream({
871
+ async pull(controller) {
872
+ try {
873
+ reader ||= Readable.toWeb(incoming).getReader();
874
+ const { done, value } = await reader.read();
875
+ if (done) {
876
+ controller.close();
877
+ } else {
878
+ controller.enqueue(value);
879
+ }
880
+ } catch (error) {
881
+ controller.error(error);
882
+ }
883
+ }
884
+ });
885
+ } else {
886
+ init2.body = Readable.toWeb(incoming);
887
+ }
888
+ }
889
+ return new Request(url, init2);
890
+ }, getRequestCache, requestCache, incomingKey, urlKey, headersKey, abortControllerKey, getAbortController, requestPrototype, newRequest = (incoming, defaultHostname) => {
891
+ const req = Object.create(requestPrototype);
892
+ req[incomingKey] = incoming;
893
+ const incomingUrl = incoming.url || "";
894
+ if (incomingUrl[0] !== "/" && (incomingUrl.startsWith("http://") || incomingUrl.startsWith("https://"))) {
895
+ if (incoming instanceof Http2ServerRequest) {
896
+ throw new RequestError("Absolute URL for :path is not allowed in HTTP/2");
897
+ }
898
+ try {
899
+ const url2 = new URL(incomingUrl);
900
+ req[urlKey] = url2.href;
901
+ } catch (e2) {
902
+ throw new RequestError("Invalid absolute URL", { cause: e2 });
903
+ }
904
+ return req;
905
+ }
906
+ const host = (incoming instanceof Http2ServerRequest ? incoming.authority : incoming.headers.host) || defaultHostname;
907
+ if (!host) {
908
+ throw new RequestError("Missing host header");
909
+ }
910
+ let scheme;
911
+ if (incoming instanceof Http2ServerRequest) {
912
+ scheme = incoming.scheme;
913
+ if (!(scheme === "http" || scheme === "https")) {
914
+ throw new RequestError("Unsupported scheme");
915
+ }
916
+ } else {
917
+ scheme = incoming.socket && incoming.socket.encrypted ? "https" : "http";
918
+ }
919
+ const url = new URL(`${scheme}://${host}${incomingUrl}`);
920
+ if (url.hostname.length !== host.length && url.hostname !== host.replace(/:\d+$/, "")) {
921
+ throw new RequestError("Invalid host header");
922
+ }
923
+ req[urlKey] = url.href;
924
+ return req;
925
+ }, responseCache, getResponseCache, cacheKey, GlobalResponse, Response2, buildOutgoingHttpHeaders = (headers) => {
926
+ const res = {};
927
+ if (!(headers instanceof Headers)) {
928
+ headers = new Headers(headers ?? undefined);
929
+ }
930
+ const cookies = [];
931
+ for (const [k2, v2] of headers) {
932
+ if (k2 === "set-cookie") {
933
+ cookies.push(v2);
934
+ } else {
935
+ res[k2] = v2;
936
+ }
937
+ }
938
+ if (cookies.length > 0) {
939
+ res["set-cookie"] = cookies;
940
+ }
941
+ res["content-type"] ??= "text/plain; charset=UTF-8";
942
+ return res;
943
+ }, X_ALREADY_SENT = "x-hono-already-sent", outgoingEnded, handleRequestError = () => new Response(null, {
944
+ status: 400
945
+ }), handleFetchError = (e2) => new Response(null, {
946
+ status: e2 instanceof Error && (e2.name === "TimeoutError" || e2.constructor.name === "TimeoutError") ? 504 : 500
947
+ }), handleResponseError = (e2, outgoing) => {
948
+ const err = e2 instanceof Error ? e2 : new Error("unknown error", { cause: e2 });
949
+ if (err.code === "ERR_STREAM_PREMATURE_CLOSE") {
950
+ console.info("The user aborted a request.");
951
+ } else {
952
+ console.error(e2);
953
+ if (!outgoing.headersSent) {
954
+ outgoing.writeHead(500, { "Content-Type": "text/plain" });
955
+ }
956
+ outgoing.end(`Error: ${err.message}`);
957
+ outgoing.destroy(err);
958
+ }
959
+ }, flushHeaders = (outgoing) => {
960
+ if ("flushHeaders" in outgoing && outgoing.writable) {
961
+ outgoing.flushHeaders();
962
+ }
963
+ }, responseViaCache = async (res, outgoing) => {
964
+ let [status, body, header] = res[cacheKey];
965
+ if (header instanceof Headers) {
966
+ header = buildOutgoingHttpHeaders(header);
967
+ }
968
+ if (typeof body === "string") {
969
+ header["Content-Length"] = Buffer.byteLength(body);
970
+ } else if (body instanceof Uint8Array) {
971
+ header["Content-Length"] = body.byteLength;
972
+ } else if (body instanceof Blob) {
973
+ header["Content-Length"] = body.size;
974
+ }
975
+ outgoing.writeHead(status, header);
976
+ if (typeof body === "string" || body instanceof Uint8Array) {
977
+ outgoing.end(body);
978
+ } else if (body instanceof Blob) {
979
+ outgoing.end(new Uint8Array(await body.arrayBuffer()));
980
+ } else {
981
+ flushHeaders(outgoing);
982
+ await writeFromReadableStream(body, outgoing)?.catch((e2) => handleResponseError(e2, outgoing));
983
+ }
984
+ outgoing[outgoingEnded]?.();
985
+ }, isPromise = (res) => typeof res.then === "function", responseViaResponseObject = async (res, outgoing, options = {}) => {
986
+ if (isPromise(res)) {
987
+ if (options.errorHandler) {
988
+ try {
989
+ res = await res;
990
+ } catch (err) {
991
+ const errRes = await options.errorHandler(err);
992
+ if (!errRes) {
993
+ return;
994
+ }
995
+ res = errRes;
996
+ }
997
+ } else {
998
+ res = await res.catch(handleFetchError);
999
+ }
1000
+ }
1001
+ if (cacheKey in res) {
1002
+ return responseViaCache(res, outgoing);
1003
+ }
1004
+ const resHeaderRecord = buildOutgoingHttpHeaders(res.headers);
1005
+ if (res.body) {
1006
+ const reader = res.body.getReader();
1007
+ const values = [];
1008
+ let done = false;
1009
+ let currentReadPromise = undefined;
1010
+ if (resHeaderRecord["transfer-encoding"] !== "chunked") {
1011
+ let maxReadCount = 2;
1012
+ for (let i2 = 0;i2 < maxReadCount; i2++) {
1013
+ currentReadPromise ||= reader.read();
1014
+ const chunk = await readWithoutBlocking(currentReadPromise).catch((e2) => {
1015
+ console.error(e2);
1016
+ done = true;
1017
+ });
1018
+ if (!chunk) {
1019
+ if (i2 === 1) {
1020
+ await new Promise((resolve) => setTimeout(resolve));
1021
+ maxReadCount = 3;
1022
+ continue;
1023
+ }
1024
+ break;
1025
+ }
1026
+ currentReadPromise = undefined;
1027
+ if (chunk.value) {
1028
+ values.push(chunk.value);
1029
+ }
1030
+ if (chunk.done) {
1031
+ done = true;
1032
+ break;
1033
+ }
1034
+ }
1035
+ if (done && !("content-length" in resHeaderRecord)) {
1036
+ resHeaderRecord["content-length"] = values.reduce((acc, value) => acc + value.length, 0);
1037
+ }
1038
+ }
1039
+ outgoing.writeHead(res.status, resHeaderRecord);
1040
+ values.forEach((value) => {
1041
+ outgoing.write(value);
1042
+ });
1043
+ if (done) {
1044
+ outgoing.end();
1045
+ } else {
1046
+ if (values.length === 0) {
1047
+ flushHeaders(outgoing);
1048
+ }
1049
+ await writeFromReadableStreamDefaultReader(reader, outgoing, currentReadPromise);
1050
+ }
1051
+ } else if (resHeaderRecord[X_ALREADY_SENT]) {} else {
1052
+ outgoing.writeHead(res.status, resHeaderRecord);
1053
+ outgoing.end();
1054
+ }
1055
+ outgoing[outgoingEnded]?.();
1056
+ }, getRequestListener = (fetchCallback, options = {}) => {
1057
+ const autoCleanupIncoming = options.autoCleanupIncoming ?? true;
1058
+ if (options.overrideGlobalObjects !== false && global.Request !== Request) {
1059
+ Object.defineProperty(global, "Request", {
1060
+ value: Request
1061
+ });
1062
+ Object.defineProperty(global, "Response", {
1063
+ value: Response2
1064
+ });
1065
+ }
1066
+ return async (incoming, outgoing) => {
1067
+ let res, req;
1068
+ try {
1069
+ req = newRequest(incoming, options.hostname);
1070
+ let incomingEnded = !autoCleanupIncoming || incoming.method === "GET" || incoming.method === "HEAD";
1071
+ if (!incomingEnded) {
1072
+ incoming[wrapBodyStream] = true;
1073
+ incoming.on("end", () => {
1074
+ incomingEnded = true;
1075
+ });
1076
+ if (incoming instanceof Http2ServerRequest2) {
1077
+ outgoing[outgoingEnded] = () => {
1078
+ if (!incomingEnded) {
1079
+ setTimeout(() => {
1080
+ if (!incomingEnded) {
1081
+ setTimeout(() => {
1082
+ incoming.destroy();
1083
+ outgoing.destroy();
1084
+ });
1085
+ }
1086
+ });
1087
+ }
1088
+ };
1089
+ }
1090
+ }
1091
+ outgoing.on("close", () => {
1092
+ const abortController = req[abortControllerKey];
1093
+ if (abortController) {
1094
+ if (incoming.errored) {
1095
+ req[abortControllerKey].abort(incoming.errored.toString());
1096
+ } else if (!outgoing.writableFinished) {
1097
+ req[abortControllerKey].abort("Client connection prematurely closed.");
1098
+ }
1099
+ }
1100
+ if (!incomingEnded) {
1101
+ setTimeout(() => {
1102
+ if (!incomingEnded) {
1103
+ setTimeout(() => {
1104
+ incoming.destroy();
1105
+ });
1106
+ }
1107
+ });
1108
+ }
1109
+ });
1110
+ res = fetchCallback(req, { incoming, outgoing });
1111
+ if (cacheKey in res) {
1112
+ return responseViaCache(res, outgoing);
1113
+ }
1114
+ } catch (e2) {
1115
+ if (!res) {
1116
+ if (options.errorHandler) {
1117
+ res = await options.errorHandler(req ? e2 : toRequestError(e2));
1118
+ if (!res) {
1119
+ return;
1120
+ }
1121
+ } else if (!req) {
1122
+ res = handleRequestError();
1123
+ } else {
1124
+ res = handleFetchError(e2);
1125
+ }
1126
+ } else {
1127
+ return handleResponseError(e2, outgoing);
1128
+ }
1129
+ }
1130
+ try {
1131
+ return await responseViaResponseObject(res, outgoing, options);
1132
+ } catch (e2) {
1133
+ return handleResponseError(e2, outgoing);
1134
+ }
1135
+ };
1136
+ }, createAdaptorServer = (options) => {
1137
+ const fetchCallback = options.fetch;
1138
+ const requestListener = getRequestListener(fetchCallback, {
1139
+ hostname: options.hostname,
1140
+ overrideGlobalObjects: options.overrideGlobalObjects,
1141
+ autoCleanupIncoming: options.autoCleanupIncoming
1142
+ });
1143
+ const createServer = options.createServer || createServerHTTP;
1144
+ const server = createServer(options.serverOptions || {}, requestListener);
1145
+ return server;
1146
+ }, serve = (options, listeningListener) => {
1147
+ const server = createAdaptorServer(options);
1148
+ server.listen(options?.port ?? 3000, options.hostname, () => {
1149
+ const serverInfo = server.address();
1150
+ listeningListener && listeningListener(serverInfo);
1151
+ });
1152
+ return server;
1153
+ };
1154
+ var init_dist = __esm(() => {
1155
+ RequestError = class extends Error {
1156
+ constructor(message, options) {
1157
+ super(message, options);
1158
+ this.name = "RequestError";
1159
+ }
1160
+ };
1161
+ GlobalRequest = global.Request;
1162
+ Request = class extends GlobalRequest {
1163
+ constructor(input, options) {
1164
+ if (typeof input === "object" && getRequestCache in input) {
1165
+ input = input[getRequestCache]();
1166
+ }
1167
+ if (typeof options?.body?.getReader !== "undefined") {
1168
+ options.duplex ??= "half";
1169
+ }
1170
+ super(input, options);
1171
+ }
1172
+ };
1173
+ wrapBodyStream = Symbol("wrapBodyStream");
1174
+ getRequestCache = Symbol("getRequestCache");
1175
+ requestCache = Symbol("requestCache");
1176
+ incomingKey = Symbol("incomingKey");
1177
+ urlKey = Symbol("urlKey");
1178
+ headersKey = Symbol("headersKey");
1179
+ abortControllerKey = Symbol("abortControllerKey");
1180
+ getAbortController = Symbol("getAbortController");
1181
+ requestPrototype = {
1182
+ get method() {
1183
+ return this[incomingKey].method || "GET";
1184
+ },
1185
+ get url() {
1186
+ return this[urlKey];
1187
+ },
1188
+ get headers() {
1189
+ return this[headersKey] ||= newHeadersFromIncoming(this[incomingKey]);
1190
+ },
1191
+ [getAbortController]() {
1192
+ this[getRequestCache]();
1193
+ return this[abortControllerKey];
1194
+ },
1195
+ [getRequestCache]() {
1196
+ this[abortControllerKey] ||= new AbortController;
1197
+ return this[requestCache] ||= newRequestFromIncoming(this.method, this[urlKey], this.headers, this[incomingKey], this[abortControllerKey]);
1198
+ }
1199
+ };
1200
+ [
1201
+ "body",
1202
+ "bodyUsed",
1203
+ "cache",
1204
+ "credentials",
1205
+ "destination",
1206
+ "integrity",
1207
+ "mode",
1208
+ "redirect",
1209
+ "referrer",
1210
+ "referrerPolicy",
1211
+ "signal",
1212
+ "keepalive"
1213
+ ].forEach((k2) => {
1214
+ Object.defineProperty(requestPrototype, k2, {
1215
+ get() {
1216
+ return this[getRequestCache]()[k2];
1217
+ }
1218
+ });
1219
+ });
1220
+ ["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k2) => {
1221
+ Object.defineProperty(requestPrototype, k2, {
1222
+ value: function() {
1223
+ return this[getRequestCache]()[k2]();
1224
+ }
1225
+ });
1226
+ });
1227
+ Object.setPrototypeOf(requestPrototype, Request.prototype);
1228
+ responseCache = Symbol("responseCache");
1229
+ getResponseCache = Symbol("getResponseCache");
1230
+ cacheKey = Symbol("cache");
1231
+ GlobalResponse = global.Response;
1232
+ Response2 = class _Response {
1233
+ #body;
1234
+ #init;
1235
+ [getResponseCache]() {
1236
+ delete this[cacheKey];
1237
+ return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
1238
+ }
1239
+ constructor(body, init2) {
1240
+ let headers;
1241
+ this.#body = body;
1242
+ if (init2 instanceof _Response) {
1243
+ const cachedGlobalResponse = init2[responseCache];
1244
+ if (cachedGlobalResponse) {
1245
+ this.#init = cachedGlobalResponse;
1246
+ this[getResponseCache]();
1247
+ return;
1248
+ } else {
1249
+ this.#init = init2.#init;
1250
+ headers = new Headers(init2.#init.headers);
1251
+ }
1252
+ } else {
1253
+ this.#init = init2;
1254
+ }
1255
+ if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) {
1256
+ headers ||= init2?.headers || { "content-type": "text/plain; charset=UTF-8" };
1257
+ this[cacheKey] = [init2?.status || 200, body, headers];
1258
+ }
1259
+ }
1260
+ get headers() {
1261
+ const cache = this[cacheKey];
1262
+ if (cache) {
1263
+ if (!(cache[2] instanceof Headers)) {
1264
+ cache[2] = new Headers(cache[2]);
1265
+ }
1266
+ return cache[2];
1267
+ }
1268
+ return this[getResponseCache]().headers;
1269
+ }
1270
+ get status() {
1271
+ return this[cacheKey]?.[0] ?? this[getResponseCache]().status;
1272
+ }
1273
+ get ok() {
1274
+ const status = this.status;
1275
+ return status >= 200 && status < 300;
1276
+ }
1277
+ };
1278
+ ["body", "bodyUsed", "redirected", "statusText", "trailers", "type", "url"].forEach((k2) => {
1279
+ Object.defineProperty(Response2.prototype, k2, {
1280
+ get() {
1281
+ return this[getResponseCache]()[k2];
1282
+ }
1283
+ });
1284
+ });
1285
+ ["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k2) => {
1286
+ Object.defineProperty(Response2.prototype, k2, {
1287
+ value: function() {
1288
+ return this[getResponseCache]()[k2]();
1289
+ }
1290
+ });
1291
+ });
1292
+ Object.setPrototypeOf(Response2, GlobalResponse);
1293
+ Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype);
1294
+ if (typeof global.crypto === "undefined") {
1295
+ global.crypto = crypto;
1296
+ }
1297
+ outgoingEnded = Symbol("outgoingEnded");
1298
+ });
1299
+
1300
+ // ../../node_modules/.bun/consola@3.4.2/node_modules/consola/dist/core.mjs
1301
+ var LogLevels = {
1302
+ silent: Number.NEGATIVE_INFINITY,
1303
+ fatal: 0,
1304
+ error: 0,
1305
+ warn: 1,
1306
+ log: 2,
1307
+ info: 3,
1308
+ success: 3,
1309
+ fail: 3,
1310
+ ready: 3,
1311
+ start: 3,
1312
+ box: 3,
1313
+ debug: 4,
1314
+ trace: 5,
1315
+ verbose: Number.POSITIVE_INFINITY
1316
+ };
1317
+ var LogTypes = {
1318
+ silent: {
1319
+ level: -1
1320
+ },
1321
+ fatal: {
1322
+ level: LogLevels.fatal
1323
+ },
1324
+ error: {
1325
+ level: LogLevels.error
1326
+ },
1327
+ warn: {
1328
+ level: LogLevels.warn
1329
+ },
1330
+ log: {
1331
+ level: LogLevels.log
1332
+ },
1333
+ info: {
1334
+ level: LogLevels.info
1335
+ },
1336
+ success: {
1337
+ level: LogLevels.success
1338
+ },
1339
+ fail: {
1340
+ level: LogLevels.fail
1341
+ },
1342
+ ready: {
1343
+ level: LogLevels.info
1344
+ },
1345
+ start: {
1346
+ level: LogLevels.info
1347
+ },
1348
+ box: {
1349
+ level: LogLevels.info
1350
+ },
1351
+ debug: {
1352
+ level: LogLevels.debug
1353
+ },
1354
+ trace: {
1355
+ level: LogLevels.trace
1356
+ },
1357
+ verbose: {
1358
+ level: LogLevels.verbose
1359
+ }
1360
+ };
1361
+ function isPlainObject$1(value) {
1362
+ if (value === null || typeof value !== "object") {
1363
+ return false;
1364
+ }
1365
+ const prototype = Object.getPrototypeOf(value);
1366
+ if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
1367
+ return false;
1368
+ }
1369
+ if (Symbol.iterator in value) {
1370
+ return false;
1371
+ }
1372
+ if (Symbol.toStringTag in value) {
1373
+ return Object.prototype.toString.call(value) === "[object Module]";
1374
+ }
1375
+ return true;
1376
+ }
1377
+ function _defu(baseObject, defaults, namespace = ".", merger) {
1378
+ if (!isPlainObject$1(defaults)) {
1379
+ return _defu(baseObject, {}, namespace, merger);
1380
+ }
1381
+ const object = Object.assign({}, defaults);
1382
+ for (const key in baseObject) {
1383
+ if (key === "__proto__" || key === "constructor") {
1384
+ continue;
1385
+ }
1386
+ const value = baseObject[key];
1387
+ if (value === null || value === undefined) {
1388
+ continue;
1389
+ }
1390
+ if (merger && merger(object, key, value, namespace)) {
1391
+ continue;
1392
+ }
1393
+ if (Array.isArray(value) && Array.isArray(object[key])) {
1394
+ object[key] = [...value, ...object[key]];
1395
+ } else if (isPlainObject$1(value) && isPlainObject$1(object[key])) {
1396
+ object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
1397
+ } else {
1398
+ object[key] = value;
1399
+ }
1400
+ }
1401
+ return object;
1402
+ }
1403
+ function createDefu(merger) {
1404
+ return (...arguments_) => arguments_.reduce((p, c) => _defu(p, c, "", merger), {});
1405
+ }
1406
+ var defu = createDefu();
1407
+ function isPlainObject(obj) {
1408
+ return Object.prototype.toString.call(obj) === "[object Object]";
1409
+ }
1410
+ function isLogObj(arg) {
1411
+ if (!isPlainObject(arg)) {
1412
+ return false;
1413
+ }
1414
+ if (!arg.message && !arg.args) {
1415
+ return false;
1416
+ }
1417
+ if (arg.stack) {
1418
+ return false;
1419
+ }
1420
+ return true;
1421
+ }
1422
+ var paused = false;
1423
+ var queue = [];
1424
+
1425
+ class Consola {
1426
+ options;
1427
+ _lastLog;
1428
+ _mockFn;
1429
+ constructor(options = {}) {
1430
+ const types = options.types || LogTypes;
1431
+ this.options = defu({
1432
+ ...options,
1433
+ defaults: { ...options.defaults },
1434
+ level: _normalizeLogLevel(options.level, types),
1435
+ reporters: [...options.reporters || []]
1436
+ }, {
1437
+ types: LogTypes,
1438
+ throttle: 1000,
1439
+ throttleMin: 5,
1440
+ formatOptions: {
1441
+ date: true,
1442
+ colors: false,
1443
+ compact: true
1444
+ }
1445
+ });
1446
+ for (const type in types) {
1447
+ const defaults = {
1448
+ type,
1449
+ ...this.options.defaults,
1450
+ ...types[type]
1451
+ };
1452
+ this[type] = this._wrapLogFn(defaults);
1453
+ this[type].raw = this._wrapLogFn(defaults, true);
1454
+ }
1455
+ if (this.options.mockFn) {
1456
+ this.mockTypes();
1457
+ }
1458
+ this._lastLog = {};
1459
+ }
1460
+ get level() {
1461
+ return this.options.level;
1462
+ }
1463
+ set level(level) {
1464
+ this.options.level = _normalizeLogLevel(level, this.options.types, this.options.level);
1465
+ }
1466
+ prompt(message, opts) {
1467
+ if (!this.options.prompt) {
1468
+ throw new Error("prompt is not supported!");
1469
+ }
1470
+ return this.options.prompt(message, opts);
1471
+ }
1472
+ create(options) {
1473
+ const instance = new Consola({
1474
+ ...this.options,
1475
+ ...options
1476
+ });
1477
+ if (this._mockFn) {
1478
+ instance.mockTypes(this._mockFn);
1479
+ }
1480
+ return instance;
1481
+ }
1482
+ withDefaults(defaults) {
1483
+ return this.create({
1484
+ ...this.options,
1485
+ defaults: {
1486
+ ...this.options.defaults,
1487
+ ...defaults
1488
+ }
1489
+ });
1490
+ }
1491
+ withTag(tag) {
1492
+ return this.withDefaults({
1493
+ tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag
1494
+ });
1495
+ }
1496
+ addReporter(reporter) {
1497
+ this.options.reporters.push(reporter);
1498
+ return this;
1499
+ }
1500
+ removeReporter(reporter) {
1501
+ if (reporter) {
1502
+ const i = this.options.reporters.indexOf(reporter);
1503
+ if (i !== -1) {
1504
+ return this.options.reporters.splice(i, 1);
1505
+ }
1506
+ } else {
1507
+ this.options.reporters.splice(0);
1508
+ }
1509
+ return this;
1510
+ }
1511
+ setReporters(reporters) {
1512
+ this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
1513
+ return this;
1514
+ }
1515
+ wrapAll() {
1516
+ this.wrapConsole();
1517
+ this.wrapStd();
1518
+ }
1519
+ restoreAll() {
1520
+ this.restoreConsole();
1521
+ this.restoreStd();
1522
+ }
1523
+ wrapConsole() {
1524
+ for (const type in this.options.types) {
1525
+ if (!console["__" + type]) {
1526
+ console["__" + type] = console[type];
1527
+ }
1528
+ console[type] = this[type].raw;
1529
+ }
1530
+ }
1531
+ restoreConsole() {
1532
+ for (const type in this.options.types) {
1533
+ if (console["__" + type]) {
1534
+ console[type] = console["__" + type];
1535
+ delete console["__" + type];
1536
+ }
1537
+ }
1538
+ }
1539
+ wrapStd() {
1540
+ this._wrapStream(this.options.stdout, "log");
1541
+ this._wrapStream(this.options.stderr, "log");
1542
+ }
1543
+ _wrapStream(stream, type) {
1544
+ if (!stream) {
1545
+ return;
1546
+ }
1547
+ if (!stream.__write) {
1548
+ stream.__write = stream.write;
1549
+ }
1550
+ stream.write = (data) => {
1551
+ this[type].raw(String(data).trim());
1552
+ };
1553
+ }
1554
+ restoreStd() {
1555
+ this._restoreStream(this.options.stdout);
1556
+ this._restoreStream(this.options.stderr);
1557
+ }
1558
+ _restoreStream(stream) {
1559
+ if (!stream) {
1560
+ return;
1561
+ }
1562
+ if (stream.__write) {
1563
+ stream.write = stream.__write;
1564
+ delete stream.__write;
1565
+ }
1566
+ }
1567
+ pauseLogs() {
1568
+ paused = true;
1569
+ }
1570
+ resumeLogs() {
1571
+ paused = false;
1572
+ const _queue = queue.splice(0);
1573
+ for (const item of _queue) {
1574
+ item[0]._logFn(item[1], item[2]);
1575
+ }
1576
+ }
1577
+ mockTypes(mockFn) {
1578
+ const _mockFn = mockFn || this.options.mockFn;
1579
+ this._mockFn = _mockFn;
1580
+ if (typeof _mockFn !== "function") {
1581
+ return;
1582
+ }
1583
+ for (const type in this.options.types) {
1584
+ this[type] = _mockFn(type, this.options.types[type]) || this[type];
1585
+ this[type].raw = this[type];
1586
+ }
1587
+ }
1588
+ _wrapLogFn(defaults, isRaw) {
1589
+ return (...args) => {
1590
+ if (paused) {
1591
+ queue.push([this, defaults, args, isRaw]);
1592
+ return;
1593
+ }
1594
+ return this._logFn(defaults, args, isRaw);
1595
+ };
1596
+ }
1597
+ _logFn(defaults, args, isRaw) {
1598
+ if ((defaults.level || 0) > this.level) {
1599
+ return false;
1600
+ }
1601
+ const logObj = {
1602
+ date: /* @__PURE__ */ new Date,
1603
+ args: [],
1604
+ ...defaults,
1605
+ level: _normalizeLogLevel(defaults.level, this.options.types)
1606
+ };
1607
+ if (!isRaw && args.length === 1 && isLogObj(args[0])) {
1608
+ Object.assign(logObj, args[0]);
1609
+ } else {
1610
+ logObj.args = [...args];
1611
+ }
1612
+ if (logObj.message) {
1613
+ logObj.args.unshift(logObj.message);
1614
+ delete logObj.message;
1615
+ }
1616
+ if (logObj.additional) {
1617
+ if (!Array.isArray(logObj.additional)) {
1618
+ logObj.additional = logObj.additional.split(`
1619
+ `);
1620
+ }
1621
+ logObj.args.push(`
1622
+ ` + logObj.additional.join(`
1623
+ `));
1624
+ delete logObj.additional;
1625
+ }
1626
+ logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
1627
+ logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
1628
+ const resolveLog = (newLog = false) => {
1629
+ const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
1630
+ if (this._lastLog.object && repeated > 0) {
1631
+ const args2 = [...this._lastLog.object.args];
1632
+ if (repeated > 1) {
1633
+ args2.push(`(repeated ${repeated} times)`);
1634
+ }
1635
+ this._log({ ...this._lastLog.object, args: args2 });
1636
+ this._lastLog.count = 1;
1637
+ }
1638
+ if (newLog) {
1639
+ this._lastLog.object = logObj;
1640
+ this._log(logObj);
1641
+ }
1642
+ };
1643
+ clearTimeout(this._lastLog.timeout);
1644
+ const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
1645
+ this._lastLog.time = logObj.date;
1646
+ if (diffTime < this.options.throttle) {
1647
+ try {
1648
+ const serializedLog = JSON.stringify([
1649
+ logObj.type,
1650
+ logObj.tag,
1651
+ logObj.args
1652
+ ]);
1653
+ const isSameLog = this._lastLog.serialized === serializedLog;
1654
+ this._lastLog.serialized = serializedLog;
1655
+ if (isSameLog) {
1656
+ this._lastLog.count = (this._lastLog.count || 0) + 1;
1657
+ if (this._lastLog.count > this.options.throttleMin) {
1658
+ this._lastLog.timeout = setTimeout(resolveLog, this.options.throttle);
1659
+ return;
1660
+ }
1661
+ }
1662
+ } catch {}
1663
+ }
1664
+ resolveLog(true);
1665
+ }
1666
+ _log(logObj) {
1667
+ for (const reporter of this.options.reporters) {
1668
+ reporter.log(logObj, {
1669
+ options: this.options
1670
+ });
1671
+ }
1672
+ }
1673
+ }
1674
+ function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
1675
+ if (input === undefined) {
1676
+ return defaultLevel;
1677
+ }
1678
+ if (typeof input === "number") {
1679
+ return input;
1680
+ }
1681
+ if (types[input] && types[input].level !== undefined) {
1682
+ return types[input].level;
1683
+ }
1684
+ return defaultLevel;
1685
+ }
1686
+ Consola.prototype.add = Consola.prototype.addReporter;
1687
+ Consola.prototype.remove = Consola.prototype.removeReporter;
1688
+ Consola.prototype.clear = Consola.prototype.removeReporter;
1689
+ Consola.prototype.withScope = Consola.prototype.withTag;
1690
+ Consola.prototype.mock = Consola.prototype.mockTypes;
1691
+ Consola.prototype.pause = Consola.prototype.pauseLogs;
1692
+ Consola.prototype.resume = Consola.prototype.resumeLogs;
1693
+ function createConsola(options = {}) {
1694
+ return new Consola(options);
1695
+ }
1696
+ // ../../node_modules/.bun/consola@3.4.2/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs
1697
+ import { formatWithOptions } from "util";
1698
+ import { sep } from "path";
1699
+ function parseStack(stack, message) {
1700
+ const cwd = process.cwd() + sep;
1701
+ const lines = stack.split(`
1702
+ `).splice(message.split(`
1703
+ `).length).map((l) => l.trim().replace("file://", "").replace(cwd, ""));
1704
+ return lines;
1705
+ }
1706
+ function writeStream(data, stream) {
1707
+ const write = stream.__write || stream.write;
1708
+ return write.call(stream, data);
1709
+ }
1710
+ var bracket = (x) => x ? `[${x}]` : "";
1711
+
1712
+ class BasicReporter {
1713
+ formatStack(stack, message, opts) {
1714
+ const indent = " ".repeat((opts?.errorLevel || 0) + 1);
1715
+ return indent + parseStack(stack, message).join(`
1716
+ ${indent}`);
1717
+ }
1718
+ formatError(err, opts) {
1719
+ const message = err.message ?? formatWithOptions(opts, err);
1720
+ const stack = err.stack ? this.formatStack(err.stack, message, opts) : "";
1721
+ const level = opts?.errorLevel || 0;
1722
+ const causedPrefix = level > 0 ? `${" ".repeat(level)}[cause]: ` : "";
1723
+ const causedError = err.cause ? `
1724
+
1725
+ ` + this.formatError(err.cause, { ...opts, errorLevel: level + 1 }) : "";
1726
+ return causedPrefix + message + `
1727
+ ` + stack + causedError;
1728
+ }
1729
+ formatArgs(args, opts) {
1730
+ const _args = args.map((arg) => {
1731
+ if (arg && typeof arg.stack === "string") {
1732
+ return this.formatError(arg, opts);
1733
+ }
1734
+ return arg;
1735
+ });
1736
+ return formatWithOptions(opts, ..._args);
1737
+ }
1738
+ formatDate(date, opts) {
1739
+ return opts.date ? date.toLocaleTimeString() : "";
1740
+ }
1741
+ filterAndJoin(arr) {
1742
+ return arr.filter(Boolean).join(" ");
1743
+ }
1744
+ formatLogObj(logObj, opts) {
1745
+ const message = this.formatArgs(logObj.args, opts);
1746
+ if (logObj.type === "box") {
1747
+ return `
1748
+ ` + [
1749
+ bracket(logObj.tag),
1750
+ logObj.title && logObj.title,
1751
+ ...message.split(`
1752
+ `)
1753
+ ].filter(Boolean).map((l) => " > " + l).join(`
1754
+ `) + `
1755
+ `;
1756
+ }
1757
+ return this.filterAndJoin([
1758
+ bracket(logObj.type),
1759
+ bracket(logObj.tag),
1760
+ message
1761
+ ]);
1762
+ }
1763
+ log(logObj, ctx) {
1764
+ const line = this.formatLogObj(logObj, {
1765
+ columns: ctx.options.stdout.columns || 0,
1766
+ ...ctx.options.formatOptions
1767
+ });
1768
+ return writeStream(line + `
1769
+ `, logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout);
1770
+ }
1771
+ }
1772
+
1773
+ // ../../node_modules/.bun/consola@3.4.2/node_modules/consola/dist/index.mjs
1774
+ import g$1 from "process";
1775
+
1776
+ // ../../node_modules/.bun/consola@3.4.2/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs
1777
+ import * as tty from "tty";
1778
+ var {
1779
+ env = {},
1780
+ argv = [],
1781
+ platform = ""
1782
+ } = typeof process === "undefined" ? {} : process;
1783
+ var isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
1784
+ var isForced = "FORCE_COLOR" in env || argv.includes("--color");
1785
+ var isWindows = platform === "win32";
1786
+ var isDumbTerminal = env.TERM === "dumb";
1787
+ var isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
1788
+ var isCI = "CI" in env && (("GITHUB_ACTIONS" in env) || ("GITLAB_CI" in env) || ("CIRCLECI" in env));
1789
+ var isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
1790
+ function replaceClose(index, string, close, replace, head = string.slice(0, Math.max(0, index)) + replace, tail = string.slice(Math.max(0, index + close.length)), next = tail.indexOf(close)) {
1791
+ return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
1792
+ }
1793
+ function clearBleed(index, string, open, close, replace) {
1794
+ return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
1795
+ }
1796
+ function filterEmpty(open, close, replace = open, at = open.length + 1) {
1797
+ return (string) => string || !(string === "" || string === undefined) ? clearBleed(("" + string).indexOf(close, at), string, open, close, replace) : "";
1798
+ }
1799
+ function init(open, close, replace) {
1800
+ return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
1801
+ }
1802
+ var colorDefs = {
1803
+ reset: init(0, 0),
1804
+ bold: init(1, 22, "\x1B[22m\x1B[1m"),
1805
+ dim: init(2, 22, "\x1B[22m\x1B[2m"),
1806
+ italic: init(3, 23),
1807
+ underline: init(4, 24),
1808
+ inverse: init(7, 27),
1809
+ hidden: init(8, 28),
1810
+ strikethrough: init(9, 29),
1811
+ black: init(30, 39),
1812
+ red: init(31, 39),
1813
+ green: init(32, 39),
1814
+ yellow: init(33, 39),
1815
+ blue: init(34, 39),
1816
+ magenta: init(35, 39),
1817
+ cyan: init(36, 39),
1818
+ white: init(37, 39),
1819
+ gray: init(90, 39),
1820
+ bgBlack: init(40, 49),
1821
+ bgRed: init(41, 49),
1822
+ bgGreen: init(42, 49),
1823
+ bgYellow: init(43, 49),
1824
+ bgBlue: init(44, 49),
1825
+ bgMagenta: init(45, 49),
1826
+ bgCyan: init(46, 49),
1827
+ bgWhite: init(47, 49),
1828
+ blackBright: init(90, 39),
1829
+ redBright: init(91, 39),
1830
+ greenBright: init(92, 39),
1831
+ yellowBright: init(93, 39),
1832
+ blueBright: init(94, 39),
1833
+ magentaBright: init(95, 39),
1834
+ cyanBright: init(96, 39),
1835
+ whiteBright: init(97, 39),
1836
+ bgBlackBright: init(100, 49),
1837
+ bgRedBright: init(101, 49),
1838
+ bgGreenBright: init(102, 49),
1839
+ bgYellowBright: init(103, 49),
1840
+ bgBlueBright: init(104, 49),
1841
+ bgMagentaBright: init(105, 49),
1842
+ bgCyanBright: init(106, 49),
1843
+ bgWhiteBright: init(107, 49)
1844
+ };
1845
+ function createColors(useColor = isColorSupported) {
1846
+ return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
1847
+ }
1848
+ var colors = createColors();
1849
+ function getColor(color, fallback = "reset") {
1850
+ return colors[color] || colors[fallback];
1851
+ }
1852
+ var ansiRegex = [
1853
+ String.raw`[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)`,
1854
+ String.raw`(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))`
1855
+ ].join("|");
1856
+ function stripAnsi(text) {
1857
+ return text.replace(new RegExp(ansiRegex, "g"), "");
1858
+ }
1859
+ var boxStylePresets = {
1860
+ solid: {
1861
+ tl: "\u250C",
1862
+ tr: "\u2510",
1863
+ bl: "\u2514",
1864
+ br: "\u2518",
1865
+ h: "\u2500",
1866
+ v: "\u2502"
1867
+ },
1868
+ double: {
1869
+ tl: "\u2554",
1870
+ tr: "\u2557",
1871
+ bl: "\u255A",
1872
+ br: "\u255D",
1873
+ h: "\u2550",
1874
+ v: "\u2551"
1875
+ },
1876
+ doubleSingle: {
1877
+ tl: "\u2553",
1878
+ tr: "\u2556",
1879
+ bl: "\u2559",
1880
+ br: "\u255C",
1881
+ h: "\u2500",
1882
+ v: "\u2551"
1883
+ },
1884
+ doubleSingleRounded: {
1885
+ tl: "\u256D",
1886
+ tr: "\u256E",
1887
+ bl: "\u2570",
1888
+ br: "\u256F",
1889
+ h: "\u2500",
1890
+ v: "\u2551"
1891
+ },
1892
+ singleThick: {
1893
+ tl: "\u250F",
1894
+ tr: "\u2513",
1895
+ bl: "\u2517",
1896
+ br: "\u251B",
1897
+ h: "\u2501",
1898
+ v: "\u2503"
1899
+ },
1900
+ singleDouble: {
1901
+ tl: "\u2552",
1902
+ tr: "\u2555",
1903
+ bl: "\u2558",
1904
+ br: "\u255B",
1905
+ h: "\u2550",
1906
+ v: "\u2502"
1907
+ },
1908
+ singleDoubleRounded: {
1909
+ tl: "\u256D",
1910
+ tr: "\u256E",
1911
+ bl: "\u2570",
1912
+ br: "\u256F",
1913
+ h: "\u2550",
1914
+ v: "\u2502"
1915
+ },
1916
+ rounded: {
1917
+ tl: "\u256D",
1918
+ tr: "\u256E",
1919
+ bl: "\u2570",
1920
+ br: "\u256F",
1921
+ h: "\u2500",
1922
+ v: "\u2502"
1923
+ }
1924
+ };
1925
+ var defaultStyle = {
1926
+ borderColor: "white",
1927
+ borderStyle: "rounded",
1928
+ valign: "center",
1929
+ padding: 2,
1930
+ marginLeft: 1,
1931
+ marginTop: 1,
1932
+ marginBottom: 1
1933
+ };
1934
+ function box(text, _opts = {}) {
1935
+ const opts = {
1936
+ ..._opts,
1937
+ style: {
1938
+ ...defaultStyle,
1939
+ ..._opts.style
1940
+ }
1941
+ };
1942
+ const textLines = text.split(`
1943
+ `);
1944
+ const boxLines = [];
1945
+ const _color = getColor(opts.style.borderColor);
1946
+ const borderStyle = {
1947
+ ...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle
1948
+ };
1949
+ if (_color) {
1950
+ for (const key in borderStyle) {
1951
+ borderStyle[key] = _color(borderStyle[key]);
1952
+ }
1953
+ }
1954
+ const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
1955
+ const height = textLines.length + paddingOffset;
1956
+ const width = Math.max(...textLines.map((line) => stripAnsi(line).length), opts.title ? stripAnsi(opts.title).length : 0) + paddingOffset;
1957
+ const widthOffset = width + paddingOffset;
1958
+ const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
1959
+ if (opts.style.marginTop > 0) {
1960
+ boxLines.push("".repeat(opts.style.marginTop));
1961
+ }
1962
+ if (opts.title) {
1963
+ const title = _color ? _color(opts.title) : opts.title;
1964
+ const left = borderStyle.h.repeat(Math.floor((width - stripAnsi(opts.title).length) / 2));
1965
+ const right = borderStyle.h.repeat(width - stripAnsi(opts.title).length - stripAnsi(left).length + paddingOffset);
1966
+ boxLines.push(`${leftSpace}${borderStyle.tl}${left}${title}${right}${borderStyle.tr}`);
1967
+ } else {
1968
+ boxLines.push(`${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`);
1969
+ }
1970
+ const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
1971
+ for (let i = 0;i < height; i++) {
1972
+ if (i < valignOffset || i >= valignOffset + textLines.length) {
1973
+ boxLines.push(`${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`);
1974
+ } else {
1975
+ const line = textLines[i - valignOffset];
1976
+ const left = " ".repeat(paddingOffset);
1977
+ const right = " ".repeat(width - stripAnsi(line).length);
1978
+ boxLines.push(`${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`);
1979
+ }
1980
+ }
1981
+ boxLines.push(`${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`);
1982
+ if (opts.style.marginBottom > 0) {
1983
+ boxLines.push("".repeat(opts.style.marginBottom));
1984
+ }
1985
+ return boxLines.join(`
1986
+ `);
1987
+ }
1988
+
1989
+ // ../../node_modules/.bun/consola@3.4.2/node_modules/consola/dist/index.mjs
1990
+ var r2 = Object.create(null);
1991
+ var i = (e2) => globalThis.process?.env || import.meta.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (e2 ? r2 : globalThis);
1992
+ var o2 = new Proxy(r2, { get(e2, s) {
1993
+ return i()[s] ?? r2[s];
1994
+ }, has(e2, s) {
1995
+ const E = i();
1996
+ return s in E || s in r2;
1997
+ }, set(e2, s, E) {
1998
+ const B2 = i(true);
1999
+ return B2[s] = E, true;
2000
+ }, deleteProperty(e2, s) {
2001
+ if (!s)
2002
+ return false;
2003
+ const E = i(true);
2004
+ return delete E[s], true;
2005
+ }, ownKeys() {
2006
+ const e2 = i(true);
2007
+ return Object.keys(e2);
2008
+ } });
2009
+ var t = typeof process < "u" && process.env && "development" || "";
2010
+ var f2 = [["APPVEYOR"], ["AWS_AMPLIFY", "AWS_APP_ID", { ci: true }], ["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"], ["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"], ["APPCIRCLE", "AC_APPCIRCLE"], ["BAMBOO", "bamboo_planKey"], ["BITBUCKET", "BITBUCKET_COMMIT"], ["BITRISE", "BITRISE_IO"], ["BUDDY", "BUDDY_WORKSPACE_ID"], ["BUILDKITE"], ["CIRCLE", "CIRCLECI"], ["CIRRUS", "CIRRUS_CI"], ["CLOUDFLARE_PAGES", "CF_PAGES", { ci: true }], ["CODEBUILD", "CODEBUILD_BUILD_ARN"], ["CODEFRESH", "CF_BUILD_ID"], ["DRONE"], ["DRONE", "DRONE_BUILD_EVENT"], ["DSARI"], ["GITHUB_ACTIONS"], ["GITLAB", "GITLAB_CI"], ["GITLAB", "CI_MERGE_REQUEST_ID"], ["GOCD", "GO_PIPELINE_LABEL"], ["LAYERCI"], ["HUDSON", "HUDSON_URL"], ["JENKINS", "JENKINS_URL"], ["MAGNUM"], ["NETLIFY"], ["NETLIFY", "NETLIFY_LOCAL", { ci: false }], ["NEVERCODE"], ["RENDER"], ["SAIL", "SAILCI"], ["SEMAPHORE"], ["SCREWDRIVER"], ["SHIPPABLE"], ["SOLANO", "TDDIUM"], ["STRIDER"], ["TEAMCITY", "TEAMCITY_VERSION"], ["TRAVIS"], ["VERCEL", "NOW_BUILDER"], ["VERCEL", "VERCEL", { ci: false }], ["VERCEL", "VERCEL_ENV", { ci: false }], ["APPCENTER", "APPCENTER_BUILD_ID"], ["CODESANDBOX", "CODESANDBOX_SSE", { ci: false }], ["CODESANDBOX", "CODESANDBOX_HOST", { ci: false }], ["STACKBLITZ"], ["STORMKIT"], ["CLEAVR"], ["ZEABUR"], ["CODESPHERE", "CODESPHERE_APP_ID", { ci: true }], ["RAILWAY", "RAILWAY_PROJECT_ID"], ["RAILWAY", "RAILWAY_SERVICE_ID"], ["DENO-DEPLOY", "DENO_DEPLOYMENT_ID"], ["FIREBASE_APP_HOSTING", "FIREBASE_APP_HOSTING", { ci: true }]];
2011
+ function b() {
2012
+ if (globalThis.process?.env)
2013
+ for (const e2 of f2) {
2014
+ const s = e2[1] || e2[0];
2015
+ if (globalThis.process?.env[s])
2016
+ return { name: e2[0].toLowerCase(), ...e2[2] };
2017
+ }
2018
+ return globalThis.process?.env?.SHELL === "/bin/jsh" && globalThis.process?.versions?.webcontainer ? { name: "stackblitz", ci: false } : { name: "", ci: false };
2019
+ }
2020
+ var l = b();
2021
+ l.name;
2022
+ function n(e2) {
2023
+ return e2 ? e2 !== "false" : false;
2024
+ }
2025
+ var I2 = globalThis.process?.platform || "";
2026
+ var T2 = n(o2.CI) || l.ci !== false;
2027
+ var a = n(globalThis.process?.stdout && globalThis.process?.stdout.isTTY);
2028
+ var g2 = n(o2.DEBUG);
2029
+ var R2 = t === "test" || n(o2.TEST);
2030
+ n(o2.MINIMAL);
2031
+ var A2 = /^win/i.test(I2);
2032
+ !n(o2.NO_COLOR) && (n(o2.FORCE_COLOR) || (a || A2) && o2.TERM);
2033
+ var C2 = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
2034
+ Number(C2?.split(".")[0]);
2035
+ var y2 = globalThis.process || Object.create(null);
2036
+ var _2 = { versions: {} };
2037
+ new Proxy(y2, { get(e2, s) {
2038
+ if (s === "env")
2039
+ return o2;
2040
+ if (s in e2)
2041
+ return e2[s];
2042
+ if (s in _2)
2043
+ return _2[s];
2044
+ } });
2045
+ var c2 = globalThis.process?.release?.name === "node";
2046
+ var O2 = !!globalThis.Bun || !!globalThis.process?.versions?.bun;
2047
+ var D = !!globalThis.Deno;
2048
+ var L2 = !!globalThis.fastly;
2049
+ var S2 = !!globalThis.Netlify;
2050
+ var u2 = !!globalThis.EdgeRuntime;
2051
+ var N2 = globalThis.navigator?.userAgent === "Cloudflare-Workers";
2052
+ var F2 = [[S2, "netlify"], [u2, "edge-light"], [N2, "workerd"], [L2, "fastly"], [D, "deno"], [O2, "bun"], [c2, "node"]];
2053
+ function G2() {
2054
+ const e2 = F2.find((s) => s[0]);
2055
+ if (e2)
2056
+ return { name: e2[1] };
2057
+ }
2058
+ var P2 = G2();
2059
+ P2?.name;
2060
+ function ansiRegex2({ onlyFirst = false } = {}) {
2061
+ const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
2062
+ const pattern = [
2063
+ `[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
2064
+ "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"
2065
+ ].join("|");
2066
+ return new RegExp(pattern, onlyFirst ? undefined : "g");
2067
+ }
2068
+ var regex = ansiRegex2();
2069
+ function stripAnsi2(string) {
2070
+ if (typeof string !== "string") {
2071
+ throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
2072
+ }
2073
+ return string.replace(regex, "");
2074
+ }
2075
+ function isAmbiguous(x2) {
2076
+ return x2 === 161 || x2 === 164 || x2 === 167 || x2 === 168 || x2 === 170 || x2 === 173 || x2 === 174 || x2 >= 176 && x2 <= 180 || x2 >= 182 && x2 <= 186 || x2 >= 188 && x2 <= 191 || x2 === 198 || x2 === 208 || x2 === 215 || x2 === 216 || x2 >= 222 && x2 <= 225 || x2 === 230 || x2 >= 232 && x2 <= 234 || x2 === 236 || x2 === 237 || x2 === 240 || x2 === 242 || x2 === 243 || x2 >= 247 && x2 <= 250 || x2 === 252 || x2 === 254 || x2 === 257 || x2 === 273 || x2 === 275 || x2 === 283 || x2 === 294 || x2 === 295 || x2 === 299 || x2 >= 305 && x2 <= 307 || x2 === 312 || x2 >= 319 && x2 <= 322 || x2 === 324 || x2 >= 328 && x2 <= 331 || x2 === 333 || x2 === 338 || x2 === 339 || x2 === 358 || x2 === 359 || x2 === 363 || x2 === 462 || x2 === 464 || x2 === 466 || x2 === 468 || x2 === 470 || x2 === 472 || x2 === 474 || x2 === 476 || x2 === 593 || x2 === 609 || x2 === 708 || x2 === 711 || x2 >= 713 && x2 <= 715 || x2 === 717 || x2 === 720 || x2 >= 728 && x2 <= 731 || x2 === 733 || x2 === 735 || x2 >= 768 && x2 <= 879 || x2 >= 913 && x2 <= 929 || x2 >= 931 && x2 <= 937 || x2 >= 945 && x2 <= 961 || x2 >= 963 && x2 <= 969 || x2 === 1025 || x2 >= 1040 && x2 <= 1103 || x2 === 1105 || x2 === 8208 || x2 >= 8211 && x2 <= 8214 || x2 === 8216 || x2 === 8217 || x2 === 8220 || x2 === 8221 || x2 >= 8224 && x2 <= 8226 || x2 >= 8228 && x2 <= 8231 || x2 === 8240 || x2 === 8242 || x2 === 8243 || x2 === 8245 || x2 === 8251 || x2 === 8254 || x2 === 8308 || x2 === 8319 || x2 >= 8321 && x2 <= 8324 || x2 === 8364 || x2 === 8451 || x2 === 8453 || x2 === 8457 || x2 === 8467 || x2 === 8470 || x2 === 8481 || x2 === 8482 || x2 === 8486 || x2 === 8491 || x2 === 8531 || x2 === 8532 || x2 >= 8539 && x2 <= 8542 || x2 >= 8544 && x2 <= 8555 || x2 >= 8560 && x2 <= 8569 || x2 === 8585 || x2 >= 8592 && x2 <= 8601 || x2 === 8632 || x2 === 8633 || x2 === 8658 || x2 === 8660 || x2 === 8679 || x2 === 8704 || x2 === 8706 || x2 === 8707 || x2 === 8711 || x2 === 8712 || x2 === 8715 || x2 === 8719 || x2 === 8721 || x2 === 8725 || x2 === 8730 || x2 >= 8733 && x2 <= 8736 || x2 === 8739 || x2 === 8741 || x2 >= 8743 && x2 <= 8748 || x2 === 8750 || x2 >= 8756 && x2 <= 8759 || x2 === 8764 || x2 === 8765 || x2 === 8776 || x2 === 8780 || x2 === 8786 || x2 === 8800 || x2 === 8801 || x2 >= 8804 && x2 <= 8807 || x2 === 8810 || x2 === 8811 || x2 === 8814 || x2 === 8815 || x2 === 8834 || x2 === 8835 || x2 === 8838 || x2 === 8839 || x2 === 8853 || x2 === 8857 || x2 === 8869 || x2 === 8895 || x2 === 8978 || x2 >= 9312 && x2 <= 9449 || x2 >= 9451 && x2 <= 9547 || x2 >= 9552 && x2 <= 9587 || x2 >= 9600 && x2 <= 9615 || x2 >= 9618 && x2 <= 9621 || x2 === 9632 || x2 === 9633 || x2 >= 9635 && x2 <= 9641 || x2 === 9650 || x2 === 9651 || x2 === 9654 || x2 === 9655 || x2 === 9660 || x2 === 9661 || x2 === 9664 || x2 === 9665 || x2 >= 9670 && x2 <= 9672 || x2 === 9675 || x2 >= 9678 && x2 <= 9681 || x2 >= 9698 && x2 <= 9701 || x2 === 9711 || x2 === 9733 || x2 === 9734 || x2 === 9737 || x2 === 9742 || x2 === 9743 || x2 === 9756 || x2 === 9758 || x2 === 9792 || x2 === 9794 || x2 === 9824 || x2 === 9825 || x2 >= 9827 && x2 <= 9829 || x2 >= 9831 && x2 <= 9834 || x2 === 9836 || x2 === 9837 || x2 === 9839 || x2 === 9886 || x2 === 9887 || x2 === 9919 || x2 >= 9926 && x2 <= 9933 || x2 >= 9935 && x2 <= 9939 || x2 >= 9941 && x2 <= 9953 || x2 === 9955 || x2 === 9960 || x2 === 9961 || x2 >= 9963 && x2 <= 9969 || x2 === 9972 || x2 >= 9974 && x2 <= 9977 || x2 === 9979 || x2 === 9980 || x2 === 9982 || x2 === 9983 || x2 === 10045 || x2 >= 10102 && x2 <= 10111 || x2 >= 11094 && x2 <= 11097 || x2 >= 12872 && x2 <= 12879 || x2 >= 57344 && x2 <= 63743 || x2 >= 65024 && x2 <= 65039 || x2 === 65533 || x2 >= 127232 && x2 <= 127242 || x2 >= 127248 && x2 <= 127277 || x2 >= 127280 && x2 <= 127337 || x2 >= 127344 && x2 <= 127373 || x2 === 127375 || x2 === 127376 || x2 >= 127387 && x2 <= 127404 || x2 >= 917760 && x2 <= 917999 || x2 >= 983040 && x2 <= 1048573 || x2 >= 1048576 && x2 <= 1114109;
2077
+ }
2078
+ function isFullWidth(x2) {
2079
+ return x2 === 12288 || x2 >= 65281 && x2 <= 65376 || x2 >= 65504 && x2 <= 65510;
2080
+ }
2081
+ function isWide(x2) {
2082
+ return x2 >= 4352 && x2 <= 4447 || x2 === 8986 || x2 === 8987 || x2 === 9001 || x2 === 9002 || x2 >= 9193 && x2 <= 9196 || x2 === 9200 || x2 === 9203 || x2 === 9725 || x2 === 9726 || x2 === 9748 || x2 === 9749 || x2 >= 9776 && x2 <= 9783 || x2 >= 9800 && x2 <= 9811 || x2 === 9855 || x2 >= 9866 && x2 <= 9871 || x2 === 9875 || x2 === 9889 || x2 === 9898 || x2 === 9899 || x2 === 9917 || x2 === 9918 || x2 === 9924 || x2 === 9925 || x2 === 9934 || x2 === 9940 || x2 === 9962 || x2 === 9970 || x2 === 9971 || x2 === 9973 || x2 === 9978 || x2 === 9981 || x2 === 9989 || x2 === 9994 || x2 === 9995 || x2 === 10024 || x2 === 10060 || x2 === 10062 || x2 >= 10067 && x2 <= 10069 || x2 === 10071 || x2 >= 10133 && x2 <= 10135 || x2 === 10160 || x2 === 10175 || x2 === 11035 || x2 === 11036 || x2 === 11088 || x2 === 11093 || x2 >= 11904 && x2 <= 11929 || x2 >= 11931 && x2 <= 12019 || x2 >= 12032 && x2 <= 12245 || x2 >= 12272 && x2 <= 12287 || x2 >= 12289 && x2 <= 12350 || x2 >= 12353 && x2 <= 12438 || x2 >= 12441 && x2 <= 12543 || x2 >= 12549 && x2 <= 12591 || x2 >= 12593 && x2 <= 12686 || x2 >= 12688 && x2 <= 12773 || x2 >= 12783 && x2 <= 12830 || x2 >= 12832 && x2 <= 12871 || x2 >= 12880 && x2 <= 42124 || x2 >= 42128 && x2 <= 42182 || x2 >= 43360 && x2 <= 43388 || x2 >= 44032 && x2 <= 55203 || x2 >= 63744 && x2 <= 64255 || x2 >= 65040 && x2 <= 65049 || x2 >= 65072 && x2 <= 65106 || x2 >= 65108 && x2 <= 65126 || x2 >= 65128 && x2 <= 65131 || x2 >= 94176 && x2 <= 94180 || x2 === 94192 || x2 === 94193 || x2 >= 94208 && x2 <= 100343 || x2 >= 100352 && x2 <= 101589 || x2 >= 101631 && x2 <= 101640 || x2 >= 110576 && x2 <= 110579 || x2 >= 110581 && x2 <= 110587 || x2 === 110589 || x2 === 110590 || x2 >= 110592 && x2 <= 110882 || x2 === 110898 || x2 >= 110928 && x2 <= 110930 || x2 === 110933 || x2 >= 110948 && x2 <= 110951 || x2 >= 110960 && x2 <= 111355 || x2 >= 119552 && x2 <= 119638 || x2 >= 119648 && x2 <= 119670 || x2 === 126980 || x2 === 127183 || x2 === 127374 || x2 >= 127377 && x2 <= 127386 || x2 >= 127488 && x2 <= 127490 || x2 >= 127504 && x2 <= 127547 || x2 >= 127552 && x2 <= 127560 || x2 === 127568 || x2 === 127569 || x2 >= 127584 && x2 <= 127589 || x2 >= 127744 && x2 <= 127776 || x2 >= 127789 && x2 <= 127797 || x2 >= 127799 && x2 <= 127868 || x2 >= 127870 && x2 <= 127891 || x2 >= 127904 && x2 <= 127946 || x2 >= 127951 && x2 <= 127955 || x2 >= 127968 && x2 <= 127984 || x2 === 127988 || x2 >= 127992 && x2 <= 128062 || x2 === 128064 || x2 >= 128066 && x2 <= 128252 || x2 >= 128255 && x2 <= 128317 || x2 >= 128331 && x2 <= 128334 || x2 >= 128336 && x2 <= 128359 || x2 === 128378 || x2 === 128405 || x2 === 128406 || x2 === 128420 || x2 >= 128507 && x2 <= 128591 || x2 >= 128640 && x2 <= 128709 || x2 === 128716 || x2 >= 128720 && x2 <= 128722 || x2 >= 128725 && x2 <= 128727 || x2 >= 128732 && x2 <= 128735 || x2 === 128747 || x2 === 128748 || x2 >= 128756 && x2 <= 128764 || x2 >= 128992 && x2 <= 129003 || x2 === 129008 || x2 >= 129292 && x2 <= 129338 || x2 >= 129340 && x2 <= 129349 || x2 >= 129351 && x2 <= 129535 || x2 >= 129648 && x2 <= 129660 || x2 >= 129664 && x2 <= 129673 || x2 >= 129679 && x2 <= 129734 || x2 >= 129742 && x2 <= 129756 || x2 >= 129759 && x2 <= 129769 || x2 >= 129776 && x2 <= 129784 || x2 >= 131072 && x2 <= 196605 || x2 >= 196608 && x2 <= 262141;
2083
+ }
2084
+ function validate(codePoint) {
2085
+ if (!Number.isSafeInteger(codePoint)) {
2086
+ throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
2087
+ }
2088
+ }
2089
+ function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
2090
+ validate(codePoint);
2091
+ if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) {
2092
+ return 2;
2093
+ }
2094
+ return 1;
2095
+ }
2096
+ var emojiRegex = () => {
2097
+ return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\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?|[\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](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\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-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
2098
+ };
2099
+ var segmenter = globalThis.Intl?.Segmenter ? new Intl.Segmenter : { segment: (str) => str.split("") };
2100
+ var defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
2101
+ function stringWidth$1(string, options = {}) {
2102
+ if (typeof string !== "string" || string.length === 0) {
2103
+ return 0;
2104
+ }
2105
+ const {
2106
+ ambiguousIsNarrow = true,
2107
+ countAnsiEscapeCodes = false
2108
+ } = options;
2109
+ if (!countAnsiEscapeCodes) {
2110
+ string = stripAnsi2(string);
2111
+ }
2112
+ if (string.length === 0) {
2113
+ return 0;
2114
+ }
2115
+ let width = 0;
2116
+ const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
2117
+ for (const { segment: character } of segmenter.segment(string)) {
2118
+ const codePoint = character.codePointAt(0);
2119
+ if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
2120
+ continue;
2121
+ }
2122
+ if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
2123
+ continue;
2124
+ }
2125
+ if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
2126
+ continue;
2127
+ }
2128
+ if (codePoint >= 55296 && codePoint <= 57343) {
2129
+ continue;
2130
+ }
2131
+ if (codePoint >= 65024 && codePoint <= 65039) {
2132
+ continue;
2133
+ }
2134
+ if (defaultIgnorableCodePointRegex.test(character)) {
2135
+ continue;
2136
+ }
2137
+ if (emojiRegex().test(character)) {
2138
+ width += 2;
2139
+ continue;
2140
+ }
2141
+ width += eastAsianWidth(codePoint, eastAsianWidthOptions);
2142
+ }
2143
+ return width;
2144
+ }
2145
+ function isUnicodeSupported() {
2146
+ const { env: env2 } = g$1;
2147
+ const { TERM, TERM_PROGRAM } = env2;
2148
+ if (g$1.platform !== "win32") {
2149
+ return TERM !== "linux";
2150
+ }
2151
+ return Boolean(env2.WT_SESSION) || Boolean(env2.TERMINUS_SUBLIME) || env2.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env2.TERMINAL_EMULATOR === "JetBrains-JediTerm";
2152
+ }
2153
+ var TYPE_COLOR_MAP = {
2154
+ info: "cyan",
2155
+ fail: "red",
2156
+ success: "green",
2157
+ ready: "green",
2158
+ start: "magenta"
2159
+ };
2160
+ var LEVEL_COLOR_MAP = {
2161
+ 0: "red",
2162
+ 1: "yellow"
2163
+ };
2164
+ var unicode = isUnicodeSupported();
2165
+ var s = (c3, fallback) => unicode ? c3 : fallback;
2166
+ var TYPE_ICONS = {
2167
+ error: s("\u2716", "\xD7"),
2168
+ fatal: s("\u2716", "\xD7"),
2169
+ ready: s("\u2714", "\u221A"),
2170
+ warn: s("\u26A0", "\u203C"),
2171
+ info: s("\u2139", "i"),
2172
+ success: s("\u2714", "\u221A"),
2173
+ debug: s("\u2699", "D"),
2174
+ trace: s("\u2192", "\u2192"),
2175
+ fail: s("\u2716", "\xD7"),
2176
+ start: s("\u25D0", "o"),
2177
+ log: ""
2178
+ };
2179
+ function stringWidth(str) {
2180
+ const hasICU = typeof Intl === "object";
2181
+ if (!hasICU || !Intl.Segmenter) {
2182
+ return stripAnsi(str).length;
2183
+ }
2184
+ return stringWidth$1(str);
2185
+ }
2186
+
2187
+ class FancyReporter extends BasicReporter {
2188
+ formatStack(stack, message, opts) {
2189
+ const indent = " ".repeat((opts?.errorLevel || 0) + 1);
2190
+ return `
2191
+ ${indent}` + parseStack(stack, message).map((line) => " " + line.replace(/^at +/, (m2) => colors.gray(m2)).replace(/\((.+)\)/, (_3, m2) => `(${colors.cyan(m2)})`)).join(`
2192
+ ${indent}`);
2193
+ }
2194
+ formatType(logObj, isBadge, opts) {
2195
+ const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
2196
+ if (isBadge) {
2197
+ return getBgColor(typeColor)(colors.black(` ${logObj.type.toUpperCase()} `));
2198
+ }
2199
+ const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
2200
+ return _type ? getColor2(typeColor)(_type) : "";
2201
+ }
2202
+ formatLogObj(logObj, opts) {
2203
+ const [message, ...additional] = this.formatArgs(logObj.args, opts).split(`
2204
+ `);
2205
+ if (logObj.type === "box") {
2206
+ return box(characterFormat(message + (additional.length > 0 ? `
2207
+ ` + additional.join(`
2208
+ `) : "")), {
2209
+ title: logObj.title ? characterFormat(logObj.title) : undefined,
2210
+ style: logObj.style
2211
+ });
2212
+ }
2213
+ const date = this.formatDate(logObj.date, opts);
2214
+ const coloredDate = date && colors.gray(date);
2215
+ const isBadge = logObj.badge ?? logObj.level < 2;
2216
+ const type = this.formatType(logObj, isBadge, opts);
2217
+ const tag = logObj.tag ? colors.gray(logObj.tag) : "";
2218
+ let line;
2219
+ const left = this.filterAndJoin([type, characterFormat(message)]);
2220
+ const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
2221
+ const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
2222
+ line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
2223
+ line += characterFormat(additional.length > 0 ? `
2224
+ ` + additional.join(`
2225
+ `) : "");
2226
+ if (logObj.type === "trace") {
2227
+ const _err = new Error("Trace: " + logObj.message);
2228
+ line += this.formatStack(_err.stack || "", _err.message);
2229
+ }
2230
+ return isBadge ? `
2231
+ ` + line + `
2232
+ ` : line;
2233
+ }
2234
+ }
2235
+ function characterFormat(str) {
2236
+ return str.replace(/`([^`]+)`/gm, (_3, m2) => colors.cyan(m2)).replace(/\s+_([^_]+)_\s+/gm, (_3, m2) => ` ${colors.underline(m2)} `);
2237
+ }
2238
+ function getColor2(color = "white") {
2239
+ return colors[color] || colors.white;
2240
+ }
2241
+ function getBgColor(color = "bgWhite") {
2242
+ return colors[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors.bgWhite;
2243
+ }
2244
+ function createConsola2(options = {}) {
2245
+ let level = _getDefaultLogLevel();
2246
+ if (process.env.CONSOLA_LEVEL) {
2247
+ level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
2248
+ }
2249
+ const consola2 = createConsola({
2250
+ level,
2251
+ defaults: { level },
2252
+ stdout: process.stdout,
2253
+ stderr: process.stderr,
2254
+ prompt: (...args) => Promise.resolve().then(() => (init_prompt(), exports_prompt)).then((m2) => m2.prompt(...args)),
2255
+ reporters: options.reporters || [
2256
+ options.fancy ?? !(T2 || R2) ? new FancyReporter : new BasicReporter
2257
+ ],
2258
+ ...options
2259
+ });
2260
+ return consola2;
2261
+ }
2262
+ function _getDefaultLogLevel() {
2263
+ if (g2) {
2264
+ return LogLevels.debug;
2265
+ }
2266
+ if (R2) {
2267
+ return LogLevels.warn;
2268
+ }
2269
+ return LogLevels.info;
2270
+ }
2271
+ var consola = createConsola2();
2272
+ // ../../node_modules/.bun/citty@0.1.6/node_modules/citty/dist/index.mjs
2273
+ function toArray(val) {
2274
+ if (Array.isArray(val)) {
2275
+ return val;
2276
+ }
2277
+ return val === undefined ? [] : [val];
2278
+ }
2279
+ function formatLineColumns(lines, linePrefix = "") {
2280
+ const maxLengh = [];
2281
+ for (const line of lines) {
2282
+ for (const [i2, element] of line.entries()) {
2283
+ maxLengh[i2] = Math.max(maxLengh[i2] || 0, element.length);
2284
+ }
2285
+ }
2286
+ return lines.map((l2) => l2.map((c3, i2) => linePrefix + c3[i2 === 0 ? "padStart" : "padEnd"](maxLengh[i2])).join(" ")).join(`
2287
+ `);
2288
+ }
2289
+ function resolveValue(input) {
2290
+ return typeof input === "function" ? input() : input;
2291
+ }
2292
+
2293
+ class CLIError extends Error {
2294
+ constructor(message, code) {
2295
+ super(message);
2296
+ this.code = code;
2297
+ this.name = "CLIError";
2298
+ }
2299
+ }
2300
+ var NUMBER_CHAR_RE = /\d/;
2301
+ var STR_SPLITTERS = ["-", "_", "/", "."];
2302
+ function isUppercase(char = "") {
2303
+ if (NUMBER_CHAR_RE.test(char)) {
2304
+ return;
2305
+ }
2306
+ return char !== char.toLowerCase();
2307
+ }
2308
+ function splitByCase(str, separators) {
2309
+ const splitters = separators ?? STR_SPLITTERS;
2310
+ const parts = [];
2311
+ if (!str || typeof str !== "string") {
2312
+ return parts;
2313
+ }
2314
+ let buff = "";
2315
+ let previousUpper;
2316
+ let previousSplitter;
2317
+ for (const char of str) {
2318
+ const isSplitter = splitters.includes(char);
2319
+ if (isSplitter === true) {
2320
+ parts.push(buff);
2321
+ buff = "";
2322
+ previousUpper = undefined;
2323
+ continue;
2324
+ }
2325
+ const isUpper = isUppercase(char);
2326
+ if (previousSplitter === false) {
2327
+ if (previousUpper === false && isUpper === true) {
2328
+ parts.push(buff);
2329
+ buff = char;
2330
+ previousUpper = isUpper;
2331
+ continue;
43
2332
  }
44
- const parsed = rx.parse(url);
45
- if (jsonOutput) {
46
- console.log(JSON.stringify(parsed, null, 2));
47
- } else {
48
- console.log(`semantic: ${parsed.semantic}`);
49
- console.log(`transport: ${parsed.transport}`);
50
- console.log(`location: ${parsed.location}`);
51
- }
52
- } else if (command === "resolve") {
53
- const url = filteredArgs[1];
54
- if (!url) {
55
- console.error("Error: Missing ARP URL");
56
- process.exit(1);
2333
+ if (previousUpper === true && isUpper === false && buff.length > 1) {
2334
+ const lastChar = buff.at(-1);
2335
+ parts.push(buff.slice(0, Math.max(0, buff.length - 1)));
2336
+ buff = lastChar + char;
2337
+ previousUpper = isUpper;
2338
+ continue;
2339
+ }
2340
+ }
2341
+ buff += char;
2342
+ previousUpper = isUpper;
2343
+ previousSplitter = isSplitter;
2344
+ }
2345
+ parts.push(buff);
2346
+ return parts;
2347
+ }
2348
+ function upperFirst(str) {
2349
+ return str ? str[0].toUpperCase() + str.slice(1) : "";
2350
+ }
2351
+ function lowerFirst(str) {
2352
+ return str ? str[0].toLowerCase() + str.slice(1) : "";
2353
+ }
2354
+ function pascalCase(str, opts) {
2355
+ return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => upperFirst(opts?.normalize ? p.toLowerCase() : p)).join("") : "";
2356
+ }
2357
+ function camelCase(str, opts) {
2358
+ return lowerFirst(pascalCase(str || "", opts));
2359
+ }
2360
+ function kebabCase(str, joiner) {
2361
+ return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => p.toLowerCase()).join(joiner ?? "-") : "";
2362
+ }
2363
+ function toArr(any) {
2364
+ return any == undefined ? [] : Array.isArray(any) ? any : [any];
2365
+ }
2366
+ function toVal(out, key, val, opts) {
2367
+ let x2;
2368
+ const old = out[key];
2369
+ const nxt = ~opts.string.indexOf(key) ? val == undefined || val === true ? "" : String(val) : typeof val === "boolean" ? val : ~opts.boolean.indexOf(key) ? val === "false" ? false : val === "true" || (out._.push((x2 = +val, x2 * 0 === 0) ? x2 : val), !!val) : (x2 = +val, x2 * 0 === 0) ? x2 : val;
2370
+ out[key] = old == undefined ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];
2371
+ }
2372
+ function parseRawArgs(args = [], opts = {}) {
2373
+ let k2;
2374
+ let arr;
2375
+ let arg;
2376
+ let name;
2377
+ let val;
2378
+ const out = { _: [] };
2379
+ let i2 = 0;
2380
+ let j = 0;
2381
+ let idx = 0;
2382
+ const len = args.length;
2383
+ const alibi = opts.alias !== undefined;
2384
+ const strict = opts.unknown !== undefined;
2385
+ const defaults = opts.default !== undefined;
2386
+ opts.alias = opts.alias || {};
2387
+ opts.string = toArr(opts.string);
2388
+ opts.boolean = toArr(opts.boolean);
2389
+ if (alibi) {
2390
+ for (k2 in opts.alias) {
2391
+ arr = opts.alias[k2] = toArr(opts.alias[k2]);
2392
+ for (i2 = 0;i2 < arr.length; i2++) {
2393
+ (opts.alias[arr[i2]] = arr.concat(k2)).splice(i2, 1);
2394
+ }
2395
+ }
2396
+ }
2397
+ for (i2 = opts.boolean.length;i2-- > 0; ) {
2398
+ arr = opts.alias[opts.boolean[i2]] || [];
2399
+ for (j = arr.length;j-- > 0; ) {
2400
+ opts.boolean.push(arr[j]);
2401
+ }
2402
+ }
2403
+ for (i2 = opts.string.length;i2-- > 0; ) {
2404
+ arr = opts.alias[opts.string[i2]] || [];
2405
+ for (j = arr.length;j-- > 0; ) {
2406
+ opts.string.push(arr[j]);
2407
+ }
2408
+ }
2409
+ if (defaults) {
2410
+ for (k2 in opts.default) {
2411
+ name = typeof opts.default[k2];
2412
+ arr = opts.alias[k2] = opts.alias[k2] || [];
2413
+ if (opts[name] !== undefined) {
2414
+ opts[name].push(k2);
2415
+ for (i2 = 0;i2 < arr.length; i2++) {
2416
+ opts[name].push(arr[i2]);
2417
+ }
2418
+ }
2419
+ }
2420
+ }
2421
+ const keys = strict ? Object.keys(opts.alias) : [];
2422
+ for (i2 = 0;i2 < len; i2++) {
2423
+ arg = args[i2];
2424
+ if (arg === "--") {
2425
+ out._ = out._.concat(args.slice(++i2));
2426
+ break;
2427
+ }
2428
+ for (j = 0;j < arg.length; j++) {
2429
+ if (arg.charCodeAt(j) !== 45) {
2430
+ break;
2431
+ }
2432
+ }
2433
+ if (j === 0) {
2434
+ out._.push(arg);
2435
+ } else if (arg.substring(j, j + 3) === "no-") {
2436
+ name = arg.slice(Math.max(0, j + 3));
2437
+ if (strict && !~keys.indexOf(name)) {
2438
+ return opts.unknown(arg);
57
2439
  }
58
- await resolve(rx, url, jsonOutput);
2440
+ out[name] = false;
59
2441
  } else {
60
- await resolve(rx, command, jsonOutput);
2442
+ for (idx = j + 1;idx < arg.length; idx++) {
2443
+ if (arg.charCodeAt(idx) === 61) {
2444
+ break;
2445
+ }
2446
+ }
2447
+ name = arg.substring(j, idx);
2448
+ val = arg.slice(Math.max(0, ++idx)) || i2 + 1 === len || ("" + args[i2 + 1]).charCodeAt(0) === 45 || args[++i2];
2449
+ arr = j === 2 ? [name] : name;
2450
+ for (idx = 0;idx < arr.length; idx++) {
2451
+ name = arr[idx];
2452
+ if (strict && !~keys.indexOf(name)) {
2453
+ return opts.unknown("-".repeat(j) + name);
2454
+ }
2455
+ toVal(out, name, idx + 1 < arr.length || val, opts);
2456
+ }
2457
+ }
2458
+ }
2459
+ if (defaults) {
2460
+ for (k2 in opts.default) {
2461
+ if (out[k2] === undefined) {
2462
+ out[k2] = opts.default[k2];
2463
+ }
2464
+ }
2465
+ }
2466
+ if (alibi) {
2467
+ for (k2 in out) {
2468
+ arr = opts.alias[k2] || [];
2469
+ while (arr.length > 0) {
2470
+ out[arr.shift()] = out[k2];
2471
+ }
2472
+ }
2473
+ }
2474
+ return out;
2475
+ }
2476
+ function parseArgs(rawArgs, argsDef) {
2477
+ const parseOptions = {
2478
+ boolean: [],
2479
+ string: [],
2480
+ mixed: [],
2481
+ alias: {},
2482
+ default: {}
2483
+ };
2484
+ const args = resolveArgs(argsDef);
2485
+ for (const arg of args) {
2486
+ if (arg.type === "positional") {
2487
+ continue;
2488
+ }
2489
+ if (arg.type === "string") {
2490
+ parseOptions.string.push(arg.name);
2491
+ } else if (arg.type === "boolean") {
2492
+ parseOptions.boolean.push(arg.name);
2493
+ }
2494
+ if (arg.default !== undefined) {
2495
+ parseOptions.default[arg.name] = arg.default;
2496
+ }
2497
+ if (arg.alias) {
2498
+ parseOptions.alias[arg.name] = arg.alias;
2499
+ }
2500
+ }
2501
+ const parsed = parseRawArgs(rawArgs, parseOptions);
2502
+ const [...positionalArguments] = parsed._;
2503
+ const parsedArgsProxy = new Proxy(parsed, {
2504
+ get(target, prop) {
2505
+ return target[prop] ?? target[camelCase(prop)] ?? target[kebabCase(prop)];
2506
+ }
2507
+ });
2508
+ for (const [, arg] of args.entries()) {
2509
+ if (arg.type === "positional") {
2510
+ const nextPositionalArgument = positionalArguments.shift();
2511
+ if (nextPositionalArgument !== undefined) {
2512
+ parsedArgsProxy[arg.name] = nextPositionalArgument;
2513
+ } else if (arg.default === undefined && arg.required !== false) {
2514
+ throw new CLIError(`Missing required positional argument: ${arg.name.toUpperCase()}`, "EARG");
2515
+ } else {
2516
+ parsedArgsProxy[arg.name] = arg.default;
2517
+ }
2518
+ } else if (arg.required && parsedArgsProxy[arg.name] === undefined) {
2519
+ throw new CLIError(`Missing required argument: --${arg.name}`, "EARG");
2520
+ }
2521
+ }
2522
+ return parsedArgsProxy;
2523
+ }
2524
+ function resolveArgs(argsDef) {
2525
+ const args = [];
2526
+ for (const [name, argDef] of Object.entries(argsDef || {})) {
2527
+ args.push({
2528
+ ...argDef,
2529
+ name,
2530
+ alias: toArray(argDef.alias)
2531
+ });
2532
+ }
2533
+ return args;
2534
+ }
2535
+ function defineCommand(def) {
2536
+ return def;
2537
+ }
2538
+ async function runCommand(cmd, opts) {
2539
+ const cmdArgs = await resolveValue(cmd.args || {});
2540
+ const parsedArgs = parseArgs(opts.rawArgs, cmdArgs);
2541
+ const context = {
2542
+ rawArgs: opts.rawArgs,
2543
+ args: parsedArgs,
2544
+ data: opts.data,
2545
+ cmd
2546
+ };
2547
+ if (typeof cmd.setup === "function") {
2548
+ await cmd.setup(context);
2549
+ }
2550
+ let result;
2551
+ try {
2552
+ const subCommands = await resolveValue(cmd.subCommands);
2553
+ if (subCommands && Object.keys(subCommands).length > 0) {
2554
+ const subCommandArgIndex = opts.rawArgs.findIndex((arg) => !arg.startsWith("-"));
2555
+ const subCommandName = opts.rawArgs[subCommandArgIndex];
2556
+ if (subCommandName) {
2557
+ if (!subCommands[subCommandName]) {
2558
+ throw new CLIError(`Unknown command \`${subCommandName}\``, "E_UNKNOWN_COMMAND");
2559
+ }
2560
+ const subCommand = await resolveValue(subCommands[subCommandName]);
2561
+ if (subCommand) {
2562
+ await runCommand(subCommand, {
2563
+ rawArgs: opts.rawArgs.slice(subCommandArgIndex + 1)
2564
+ });
2565
+ }
2566
+ } else if (!cmd.run) {
2567
+ throw new CLIError(`No command specified.`, "E_NO_COMMAND");
2568
+ }
61
2569
  }
2570
+ if (typeof cmd.run === "function") {
2571
+ result = await cmd.run(context);
2572
+ }
2573
+ } finally {
2574
+ if (typeof cmd.cleanup === "function") {
2575
+ await cmd.cleanup(context);
2576
+ }
2577
+ }
2578
+ return { result };
2579
+ }
2580
+ async function resolveSubCommand(cmd, rawArgs, parent) {
2581
+ const subCommands = await resolveValue(cmd.subCommands);
2582
+ if (subCommands && Object.keys(subCommands).length > 0) {
2583
+ const subCommandArgIndex = rawArgs.findIndex((arg) => !arg.startsWith("-"));
2584
+ const subCommandName = rawArgs[subCommandArgIndex];
2585
+ const subCommand = await resolveValue(subCommands[subCommandName]);
2586
+ if (subCommand) {
2587
+ return resolveSubCommand(subCommand, rawArgs.slice(subCommandArgIndex + 1), cmd);
2588
+ }
2589
+ }
2590
+ return [cmd, parent];
2591
+ }
2592
+ async function showUsage(cmd, parent) {
2593
+ try {
2594
+ consola.log(await renderUsage(cmd, parent) + `
2595
+ `);
62
2596
  } catch (error) {
63
- if (error instanceof ResourceXError) {
64
- console.error(`Error: ${error.message}`);
2597
+ consola.error(error);
2598
+ }
2599
+ }
2600
+ async function renderUsage(cmd, parent) {
2601
+ const cmdMeta = await resolveValue(cmd.meta || {});
2602
+ const cmdArgs = resolveArgs(await resolveValue(cmd.args || {}));
2603
+ const parentMeta = await resolveValue(parent?.meta || {});
2604
+ const commandName = `${parentMeta.name ? `${parentMeta.name} ` : ""}` + (cmdMeta.name || process.argv[1]);
2605
+ const argLines = [];
2606
+ const posLines = [];
2607
+ const commandsLines = [];
2608
+ const usageLine = [];
2609
+ for (const arg of cmdArgs) {
2610
+ if (arg.type === "positional") {
2611
+ const name = arg.name.toUpperCase();
2612
+ const isRequired = arg.required !== false && arg.default === undefined;
2613
+ const defaultHint = arg.default ? `="${arg.default}"` : "";
2614
+ posLines.push([
2615
+ "`" + name + defaultHint + "`",
2616
+ arg.description || "",
2617
+ arg.valueHint ? `<${arg.valueHint}>` : ""
2618
+ ]);
2619
+ usageLine.push(isRequired ? `<${name}>` : `[${name}]`);
2620
+ } else {
2621
+ const isRequired = arg.required === true && arg.default === undefined;
2622
+ const argStr = (arg.type === "boolean" && arg.default === true ? [
2623
+ ...(arg.alias || []).map((a2) => `--no-${a2}`),
2624
+ `--no-${arg.name}`
2625
+ ].join(", ") : [...(arg.alias || []).map((a2) => `-${a2}`), `--${arg.name}`].join(", ")) + (arg.type === "string" && (arg.valueHint || arg.default) ? `=${arg.valueHint ? `<${arg.valueHint}>` : `"${arg.default || ""}"`}` : "");
2626
+ argLines.push([
2627
+ "`" + argStr + (isRequired ? " (required)" : "") + "`",
2628
+ arg.description || ""
2629
+ ]);
2630
+ if (isRequired) {
2631
+ usageLine.push(argStr);
2632
+ }
2633
+ }
2634
+ }
2635
+ if (cmd.subCommands) {
2636
+ const commandNames = [];
2637
+ const subCommands = await resolveValue(cmd.subCommands);
2638
+ for (const [name, sub] of Object.entries(subCommands)) {
2639
+ const subCmd = await resolveValue(sub);
2640
+ const meta = await resolveValue(subCmd?.meta);
2641
+ commandsLines.push([`\`${name}\``, meta?.description || ""]);
2642
+ commandNames.push(name);
2643
+ }
2644
+ usageLine.push(commandNames.join("|"));
2645
+ }
2646
+ const usageLines = [];
2647
+ const version = cmdMeta.version || parentMeta.version;
2648
+ usageLines.push(colors.gray(`${cmdMeta.description} (${commandName + (version ? ` v${version}` : "")})`), "");
2649
+ const hasOptions = argLines.length > 0 || posLines.length > 0;
2650
+ usageLines.push(`${colors.underline(colors.bold("USAGE"))} \`${commandName}${hasOptions ? " [OPTIONS]" : ""} ${usageLine.join(" ")}\``, "");
2651
+ if (posLines.length > 0) {
2652
+ usageLines.push(colors.underline(colors.bold("ARGUMENTS")), "");
2653
+ usageLines.push(formatLineColumns(posLines, " "));
2654
+ usageLines.push("");
2655
+ }
2656
+ if (argLines.length > 0) {
2657
+ usageLines.push(colors.underline(colors.bold("OPTIONS")), "");
2658
+ usageLines.push(formatLineColumns(argLines, " "));
2659
+ usageLines.push("");
2660
+ }
2661
+ if (commandsLines.length > 0) {
2662
+ usageLines.push(colors.underline(colors.bold("COMMANDS")), "");
2663
+ usageLines.push(formatLineColumns(commandsLines, " "));
2664
+ usageLines.push("", `Use \`${commandName} <command> --help\` for more information about a command.`);
2665
+ }
2666
+ return usageLines.filter((l2) => typeof l2 === "string").join(`
2667
+ `);
2668
+ }
2669
+ async function runMain(cmd, opts = {}) {
2670
+ const rawArgs = opts.rawArgs || process.argv.slice(2);
2671
+ const showUsage$1 = opts.showUsage || showUsage;
2672
+ try {
2673
+ if (rawArgs.includes("--help") || rawArgs.includes("-h")) {
2674
+ await showUsage$1(...await resolveSubCommand(cmd, rawArgs));
2675
+ process.exit(0);
2676
+ } else if (rawArgs.length === 1 && rawArgs[0] === "--version") {
2677
+ const meta = typeof cmd.meta === "function" ? await cmd.meta() : await cmd.meta;
2678
+ if (!meta?.version) {
2679
+ throw new CLIError("No version specified", "E_NO_VERSION");
2680
+ }
2681
+ consola.log(meta.version);
65
2682
  } else {
66
- console.error(`Error: ${error.message}`);
2683
+ await runCommand(cmd, { rawArgs });
2684
+ }
2685
+ } catch (error) {
2686
+ const isCLIError = error instanceof CLIError;
2687
+ if (!isCLIError) {
2688
+ consola.error(error, `
2689
+ `);
67
2690
  }
2691
+ if (isCLIError) {
2692
+ await showUsage$1(...await resolveSubCommand(cmd, rawArgs));
2693
+ }
2694
+ consola.error(error.message);
68
2695
  process.exit(1);
69
2696
  }
70
2697
  }
71
- async function resolve(rx, url, jsonOutput) {
72
- const resource = await rx.resolve(url);
73
- if (jsonOutput) {
74
- console.log(JSON.stringify(resource, null, 2));
75
- } else {
76
- console.log(resource.content);
2698
+
2699
+ // src/lib/client.ts
2700
+ import { createResourceX } from "resourcexjs";
2701
+
2702
+ // src/lib/paths.ts
2703
+ import { homedir } from "os";
2704
+ import { join } from "path";
2705
+ var RX_HOME = process.env.RX_HOME || join(homedir(), ".resourcex");
2706
+ var PATHS = {
2707
+ root: RX_HOME,
2708
+ config: join(RX_HOME, "config.json"),
2709
+ local: join(RX_HOME, "local"),
2710
+ cache: join(RX_HOME, "cache"),
2711
+ linked: join(RX_HOME, "linked")
2712
+ };
2713
+
2714
+ // src/lib/config.ts
2715
+ async function getConfig() {
2716
+ let fileConfig = {};
2717
+ try {
2718
+ const file = Bun.file(PATHS.config);
2719
+ if (await file.exists()) {
2720
+ fileConfig = await file.json();
2721
+ }
2722
+ } catch {}
2723
+ const envRegistry = process.env.RX_REGISTRY;
2724
+ const registry = envRegistry !== undefined ? envRegistry || undefined : fileConfig.registry;
2725
+ return {
2726
+ path: process.env.RX_HOME || fileConfig.path || RX_HOME,
2727
+ registry
2728
+ };
2729
+ }
2730
+ async function setConfig(key, value) {
2731
+ const config = await getConfig();
2732
+ config[key] = value;
2733
+ await Bun.$`mkdir -p ${RX_HOME}`.quiet();
2734
+ await Bun.write(PATHS.config, JSON.stringify(config, null, 2));
2735
+ }
2736
+
2737
+ // src/lib/client.ts
2738
+ async function getClient(options) {
2739
+ const cfg = await getConfig();
2740
+ return createResourceX({
2741
+ path: cfg.path,
2742
+ registry: options?.registry ?? cfg.registry
2743
+ });
2744
+ }
2745
+
2746
+ // src/commands/add.ts
2747
+ var add = defineCommand({
2748
+ meta: {
2749
+ name: "add",
2750
+ description: "Add resource from directory to local storage"
2751
+ },
2752
+ args: {
2753
+ path: {
2754
+ type: "positional",
2755
+ description: "Path to resource directory",
2756
+ required: true
2757
+ }
2758
+ },
2759
+ async run({ args }) {
2760
+ try {
2761
+ const rx = await getClient();
2762
+ const resource = await rx.add(args.path);
2763
+ consola.success(`Added resource:
2764
+ `);
2765
+ console.log(` Locator: ${resource.locator}`);
2766
+ console.log(` Name: ${resource.name}`);
2767
+ console.log(` Type: ${resource.type}`);
2768
+ console.log(` Tag: ${resource.tag}`);
2769
+ if (resource.files?.length) {
2770
+ console.log(` Files: ${resource.files.join(", ")}`);
2771
+ }
2772
+ } catch (error) {
2773
+ consola.error(error instanceof Error ? error.message : "Failed to add resource");
2774
+ process.exit(1);
2775
+ }
2776
+ }
2777
+ });
2778
+
2779
+ // src/commands/link.ts
2780
+ var link = defineCommand({
2781
+ meta: {
2782
+ name: "link",
2783
+ description: "Link resource directory for development"
2784
+ },
2785
+ args: {
2786
+ path: {
2787
+ type: "positional",
2788
+ description: "Path to resource directory",
2789
+ required: true
2790
+ }
2791
+ },
2792
+ async run({ args }) {
2793
+ try {
2794
+ const rx = await getClient();
2795
+ await rx.link(args.path);
2796
+ consola.success(`Linked: ${args.path}`);
2797
+ } catch (error) {
2798
+ consola.error(error instanceof Error ? error.message : "Failed to link resource");
2799
+ process.exit(1);
2800
+ }
2801
+ }
2802
+ });
2803
+
2804
+ // src/commands/unlink.ts
2805
+ var unlink = defineCommand({
2806
+ meta: {
2807
+ name: "unlink",
2808
+ description: "Unlink development directory"
2809
+ },
2810
+ args: {
2811
+ locator: {
2812
+ type: "positional",
2813
+ description: "Resource locator (e.g., hello:1.0.0)",
2814
+ required: true
2815
+ }
2816
+ },
2817
+ async run({ args }) {
2818
+ try {
2819
+ const rx = await getClient();
2820
+ await rx.unlink(args.locator);
2821
+ consola.success(`Unlinked: ${args.locator}`);
2822
+ } catch (error) {
2823
+ consola.error(error instanceof Error ? error.message : "Failed to unlink resource");
2824
+ process.exit(1);
2825
+ }
2826
+ }
2827
+ });
2828
+
2829
+ // src/commands/list.ts
2830
+ var list = defineCommand({
2831
+ meta: {
2832
+ name: "list",
2833
+ description: "List local resources"
2834
+ },
2835
+ args: {
2836
+ query: {
2837
+ type: "positional",
2838
+ description: "Optional search query",
2839
+ required: false
2840
+ }
2841
+ },
2842
+ async run({ args }) {
2843
+ try {
2844
+ const rx = await getClient();
2845
+ const results = await rx.search(args.query);
2846
+ if (results.length === 0) {
2847
+ consola.info("No resources found");
2848
+ return;
2849
+ }
2850
+ consola.info(`Found ${results.length} resource(s):
2851
+ `);
2852
+ for (const locator of results) {
2853
+ console.log(` ${locator}`);
2854
+ }
2855
+ } catch (error) {
2856
+ consola.error(error instanceof Error ? error.message : "Failed to list resources");
2857
+ process.exit(1);
2858
+ }
2859
+ }
2860
+ });
2861
+
2862
+ // src/commands/info.ts
2863
+ var info = defineCommand({
2864
+ meta: {
2865
+ name: "info",
2866
+ description: "Show detailed resource information"
2867
+ },
2868
+ args: {
2869
+ locator: {
2870
+ type: "positional",
2871
+ description: "Resource locator (e.g., hello:1.0.0)",
2872
+ required: true
2873
+ }
2874
+ },
2875
+ async run({ args }) {
2876
+ try {
2877
+ const rx = await getClient();
2878
+ const resource = await rx.info(args.locator);
2879
+ console.log();
2880
+ console.log(` ${resource.name}:${resource.tag}`);
2881
+ console.log(` ${"\u2500".repeat(40)}`);
2882
+ console.log();
2883
+ console.log(` Locator: ${resource.locator}`);
2884
+ if (resource.registry) {
2885
+ console.log(` Registry: ${resource.registry}`);
2886
+ }
2887
+ if (resource.path) {
2888
+ console.log(` Path: ${resource.path}`);
2889
+ }
2890
+ console.log(` Name: ${resource.name}`);
2891
+ console.log(` Type: ${resource.type}`);
2892
+ console.log(` Tag: ${resource.tag}`);
2893
+ console.log();
2894
+ if (resource.files?.length) {
2895
+ console.log(` Files:`);
2896
+ printFileTree(resource.files);
2897
+ }
2898
+ console.log();
2899
+ } catch (error) {
2900
+ consola.error(error instanceof Error ? error.message : "Resource not found");
2901
+ process.exit(1);
2902
+ }
2903
+ }
2904
+ });
2905
+ function printFileTree(files) {
2906
+ const sorted = [...files].sort();
2907
+ const tree = {};
2908
+ const rootFiles = [];
2909
+ for (const file of sorted) {
2910
+ const parts = file.split("/");
2911
+ if (parts.length === 1) {
2912
+ rootFiles.push(file);
2913
+ } else {
2914
+ const dir = parts[0];
2915
+ const rest = parts.slice(1).join("/");
2916
+ if (!tree[dir]) {
2917
+ tree[dir] = [];
2918
+ }
2919
+ tree[dir].push(rest);
2920
+ }
2921
+ }
2922
+ const dirs = Object.keys(tree).sort();
2923
+ const allItems = [...dirs, ...rootFiles];
2924
+ for (let i2 = 0;i2 < allItems.length; i2++) {
2925
+ const item = allItems[i2];
2926
+ const isLast = i2 === allItems.length - 1;
2927
+ const prefix = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
2928
+ if (tree[item]) {
2929
+ console.log(` ${prefix}${item}/`);
2930
+ printSubTree(tree[item], isLast ? " " : "\u2502 ");
2931
+ } else {
2932
+ console.log(` ${prefix}${item}`);
2933
+ }
2934
+ }
2935
+ }
2936
+ function printSubTree(files, indent) {
2937
+ for (let i2 = 0;i2 < files.length; i2++) {
2938
+ const file = files[i2];
2939
+ const isLast = i2 === files.length - 1;
2940
+ const prefix = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
2941
+ console.log(` ${indent}${prefix}${file}`);
77
2942
  }
78
2943
  }
79
- main();
80
2944
 
81
- //# debugId=D3EBA67A06C0D3BB64756E2164756E21
2945
+ // src/commands/remove.ts
2946
+ var remove = defineCommand({
2947
+ meta: {
2948
+ name: "remove",
2949
+ description: "Remove resource from local storage"
2950
+ },
2951
+ args: {
2952
+ locator: {
2953
+ type: "positional",
2954
+ description: "Resource locator (e.g., hello.text@1.0.0)",
2955
+ required: true
2956
+ }
2957
+ },
2958
+ async run({ args }) {
2959
+ try {
2960
+ const rx = await getClient();
2961
+ const exists = await rx.has(args.locator);
2962
+ if (!exists) {
2963
+ consola.warn(`Resource not found: ${args.locator}`);
2964
+ return;
2965
+ }
2966
+ await rx.remove(args.locator);
2967
+ consola.success(`Removed: ${args.locator}`);
2968
+ } catch (error) {
2969
+ consola.error(error instanceof Error ? error.message : "Failed to remove resource");
2970
+ process.exit(1);
2971
+ }
2972
+ }
2973
+ });
2974
+
2975
+ // src/commands/push.ts
2976
+ var push = defineCommand({
2977
+ meta: {
2978
+ name: "push",
2979
+ description: "Push local resource to remote registry"
2980
+ },
2981
+ args: {
2982
+ locator: {
2983
+ type: "positional",
2984
+ description: "Resource locator (e.g., hello.text@1.0.0)",
2985
+ required: true
2986
+ },
2987
+ registry: {
2988
+ type: "string",
2989
+ alias: "r",
2990
+ description: "Registry URL (overrides config)"
2991
+ }
2992
+ },
2993
+ async run({ args }) {
2994
+ try {
2995
+ const config = await getConfig();
2996
+ const registryUrl = args.registry ?? config.registry;
2997
+ if (!registryUrl) {
2998
+ consola.error("No registry configured. Use: rx config set registry <url> or --registry <url>");
2999
+ process.exit(1);
3000
+ }
3001
+ const rx = await getClient({ registry: registryUrl });
3002
+ await rx.push(args.locator);
3003
+ consola.success(`Pushed: ${args.locator}`);
3004
+ } catch (error) {
3005
+ consola.error(error instanceof Error ? error.message : "Failed to push resource");
3006
+ process.exit(1);
3007
+ }
3008
+ }
3009
+ });
3010
+
3011
+ // src/commands/pull.ts
3012
+ var pull = defineCommand({
3013
+ meta: {
3014
+ name: "pull",
3015
+ description: "Pull resource from remote registry to local cache"
3016
+ },
3017
+ args: {
3018
+ locator: {
3019
+ type: "positional",
3020
+ description: "Resource locator (e.g., hello.text@1.0.0)",
3021
+ required: true
3022
+ },
3023
+ registry: {
3024
+ type: "string",
3025
+ alias: "r",
3026
+ description: "Registry URL (overrides config)"
3027
+ }
3028
+ },
3029
+ async run({ args }) {
3030
+ try {
3031
+ const config = await getConfig();
3032
+ const registryUrl = args.registry ?? config.registry;
3033
+ if (!registryUrl) {
3034
+ consola.error("No registry configured. Use: rx config set registry <url> or --registry <url>");
3035
+ process.exit(1);
3036
+ }
3037
+ const rx = await getClient({ registry: registryUrl });
3038
+ await rx.pull(args.locator);
3039
+ consola.success(`Pulled: ${args.locator}`);
3040
+ } catch (error) {
3041
+ consola.error(error instanceof Error ? error.message : "Failed to pull resource");
3042
+ process.exit(1);
3043
+ }
3044
+ }
3045
+ });
3046
+
3047
+ // src/commands/search.ts
3048
+ import { buildSearchUrl } from "@resourcexjs/server";
3049
+ var search = defineCommand({
3050
+ meta: {
3051
+ name: "search",
3052
+ description: "Search remote registry"
3053
+ },
3054
+ args: {
3055
+ query: {
3056
+ type: "positional",
3057
+ description: "Search query",
3058
+ required: true
3059
+ },
3060
+ limit: {
3061
+ type: "string",
3062
+ description: "Maximum results",
3063
+ default: "20"
3064
+ }
3065
+ },
3066
+ async run({ args }) {
3067
+ try {
3068
+ const config = await getConfig();
3069
+ if (!config.registry) {
3070
+ consola.error("No registry configured. Use: rx config set registry <url>");
3071
+ process.exit(1);
3072
+ }
3073
+ const url = buildSearchUrl(config.registry, {
3074
+ q: args.query,
3075
+ limit: Number(args.limit)
3076
+ });
3077
+ const response = await fetch(url);
3078
+ if (!response.ok) {
3079
+ throw new Error(`Search failed: ${response.statusText}`);
3080
+ }
3081
+ const data = await response.json();
3082
+ if (data.results.length === 0) {
3083
+ consola.info("No resources found");
3084
+ return;
3085
+ }
3086
+ consola.info(`Found ${data.total} resource(s):
3087
+ `);
3088
+ for (const item of data.results) {
3089
+ console.log(` ${item.locator}`);
3090
+ if (item.type) {
3091
+ console.log(` type: ${item.type}`);
3092
+ }
3093
+ }
3094
+ } catch (error) {
3095
+ consola.error(error instanceof Error ? error.message : "Search failed");
3096
+ process.exit(1);
3097
+ }
3098
+ }
3099
+ });
3100
+
3101
+ // src/commands/use.ts
3102
+ var use = defineCommand({
3103
+ meta: {
3104
+ name: "use",
3105
+ description: "Use and execute resource"
3106
+ },
3107
+ args: {
3108
+ locator: {
3109
+ type: "positional",
3110
+ description: "Resource locator (e.g., hello.text@1.0.0)",
3111
+ required: true
3112
+ }
3113
+ },
3114
+ async run({ args }) {
3115
+ try {
3116
+ const rx = await getClient();
3117
+ const executable = await rx.use(args.locator);
3118
+ const result = await executable.execute();
3119
+ if (typeof result === "string") {
3120
+ console.log(result);
3121
+ } else if (result instanceof Uint8Array) {
3122
+ process.stdout.write(result);
3123
+ } else {
3124
+ console.log(JSON.stringify(result, null, 2));
3125
+ }
3126
+ } catch (error) {
3127
+ consola.error(error instanceof Error ? error.message : "Failed to use resource");
3128
+ process.exit(1);
3129
+ }
3130
+ }
3131
+ });
3132
+
3133
+ // src/commands/config.ts
3134
+ var set = defineCommand({
3135
+ meta: {
3136
+ name: "set",
3137
+ description: "Set configuration value"
3138
+ },
3139
+ args: {
3140
+ key: {
3141
+ type: "positional",
3142
+ description: "Configuration key (path, registry)",
3143
+ required: true
3144
+ },
3145
+ value: {
3146
+ type: "positional",
3147
+ description: "Configuration value",
3148
+ required: true
3149
+ }
3150
+ },
3151
+ async run({ args }) {
3152
+ const validKeys = ["path", "registry"];
3153
+ if (!validKeys.includes(args.key)) {
3154
+ consola.error(`Invalid key: ${args.key}. Valid keys: ${validKeys.join(", ")}`);
3155
+ process.exit(1);
3156
+ }
3157
+ await setConfig(args.key, args.value);
3158
+ consola.success(`Set ${args.key} = ${args.value}`);
3159
+ }
3160
+ });
3161
+ var list2 = defineCommand({
3162
+ meta: {
3163
+ name: "list",
3164
+ description: "List configuration"
3165
+ },
3166
+ async run() {
3167
+ const config = await getConfig();
3168
+ consola.info(`Configuration:
3169
+ `);
3170
+ console.log(` path: ${config.path}`);
3171
+ console.log(` registry: ${config.registry || "(not set)"}`);
3172
+ }
3173
+ });
3174
+ var config = defineCommand({
3175
+ meta: {
3176
+ name: "config",
3177
+ description: "Manage CLI configuration"
3178
+ },
3179
+ subCommands: {
3180
+ set,
3181
+ list: list2
3182
+ }
3183
+ });
3184
+
3185
+ // src/commands/server.ts
3186
+ var server = defineCommand({
3187
+ meta: {
3188
+ name: "server",
3189
+ description: "Start registry API server"
3190
+ },
3191
+ args: {
3192
+ port: {
3193
+ type: "string",
3194
+ description: "Port to listen on",
3195
+ default: "3000"
3196
+ },
3197
+ storage: {
3198
+ type: "string",
3199
+ description: "Storage path for resources"
3200
+ }
3201
+ },
3202
+ async run({ args }) {
3203
+ const port = parseInt(args.port, 10);
3204
+ const storagePath = args.storage || "./data";
3205
+ const { createRegistryServer } = await import("@resourcexjs/server");
3206
+ const { serve: serve2 } = await Promise.resolve().then(() => (init_dist(), exports_dist));
3207
+ const app = createRegistryServer({ storagePath });
3208
+ consola.info(`Starting registry server...`);
3209
+ console.log();
3210
+ console.log(` Port: ${port}`);
3211
+ console.log(` Storage: ${storagePath}`);
3212
+ console.log();
3213
+ serve2({ fetch: app.fetch, port }, () => {
3214
+ consola.success(`Registry running at http://localhost:${port}`);
3215
+ console.log();
3216
+ console.log(" Endpoints:");
3217
+ console.log(" GET /health Health check");
3218
+ console.log(" POST /publish Publish resource");
3219
+ console.log(" GET /resource/:loc Get manifest");
3220
+ console.log(" GET /content/:loc Get content");
3221
+ console.log(" GET /search Search resources");
3222
+ console.log();
3223
+ });
3224
+ await new Promise(() => {});
3225
+ }
3226
+ });
3227
+
3228
+ // src/commands/cache.ts
3229
+ var clear = defineCommand({
3230
+ meta: {
3231
+ name: "clear",
3232
+ description: "Clear all cached resources"
3233
+ },
3234
+ args: {
3235
+ registry: {
3236
+ type: "string",
3237
+ alias: "r",
3238
+ description: "Only clear resources from this registry"
3239
+ }
3240
+ },
3241
+ async run({ args }) {
3242
+ try {
3243
+ const rx = await getClient();
3244
+ await rx.clearCache(args.registry);
3245
+ if (args.registry) {
3246
+ consola.success(`Cleared cache for registry: ${args.registry}`);
3247
+ } else {
3248
+ consola.success("Cleared all cached resources");
3249
+ }
3250
+ } catch (error) {
3251
+ consola.error(error instanceof Error ? error.message : "Failed to clear cache");
3252
+ process.exit(1);
3253
+ }
3254
+ }
3255
+ });
3256
+ var cache = defineCommand({
3257
+ meta: {
3258
+ name: "cache",
3259
+ description: "Manage cached resources"
3260
+ },
3261
+ subCommands: {
3262
+ clear
3263
+ }
3264
+ });
3265
+
3266
+ // src/index.ts
3267
+ var main = defineCommand({
3268
+ meta: {
3269
+ name: "rx",
3270
+ version: "0.1.0",
3271
+ description: "ResourceX CLI - Manage AI Agent resources"
3272
+ },
3273
+ subCommands: {
3274
+ add,
3275
+ link,
3276
+ unlink,
3277
+ list,
3278
+ info,
3279
+ remove,
3280
+ push,
3281
+ pull,
3282
+ search,
3283
+ use,
3284
+ config,
3285
+ cache,
3286
+ server
3287
+ }
3288
+ });
3289
+ runMain(main);
3290
+
3291
+ //# debugId=425C78D84A4EC9F064756E2164756E21