movementkit-cli 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,4129 @@
1
+ #!/usr/bin/env bun
2
+ // @bun
3
+ import { createRequire } from "node:module";
4
+ var __create = Object.create;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __defProp = Object.defineProperty;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __toESM = (mod, isNodeMode, target) => {
10
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
11
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
12
+ for (let key of __getOwnPropNames(mod))
13
+ if (!__hasOwnProp.call(to, key))
14
+ __defProp(to, key, {
15
+ get: () => mod[key],
16
+ enumerable: true
17
+ });
18
+ return to;
19
+ };
20
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
21
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
22
+
23
+ // node_modules/picocolors/picocolors.js
24
+ var require_picocolors = __commonJS((exports, module) => {
25
+ var p = process || {};
26
+ var argv = p.argv || [];
27
+ var env = p.env || {};
28
+ var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
29
+ var formatter = (open, close, replace = open) => (input) => {
30
+ let string = "" + input, index = string.indexOf(close, open.length);
31
+ return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
32
+ };
33
+ var replaceClose = (string, close, replace, index) => {
34
+ let result = "", cursor = 0;
35
+ do {
36
+ result += string.substring(cursor, index) + replace;
37
+ cursor = index + close.length;
38
+ index = string.indexOf(close, cursor);
39
+ } while (~index);
40
+ return result + string.substring(cursor);
41
+ };
42
+ var createColors = (enabled = isColorSupported) => {
43
+ let f = enabled ? formatter : () => String;
44
+ return {
45
+ isColorSupported: enabled,
46
+ reset: f("\x1B[0m", "\x1B[0m"),
47
+ bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
48
+ dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
49
+ italic: f("\x1B[3m", "\x1B[23m"),
50
+ underline: f("\x1B[4m", "\x1B[24m"),
51
+ inverse: f("\x1B[7m", "\x1B[27m"),
52
+ hidden: f("\x1B[8m", "\x1B[28m"),
53
+ strikethrough: f("\x1B[9m", "\x1B[29m"),
54
+ black: f("\x1B[30m", "\x1B[39m"),
55
+ red: f("\x1B[31m", "\x1B[39m"),
56
+ green: f("\x1B[32m", "\x1B[39m"),
57
+ yellow: f("\x1B[33m", "\x1B[39m"),
58
+ blue: f("\x1B[34m", "\x1B[39m"),
59
+ magenta: f("\x1B[35m", "\x1B[39m"),
60
+ cyan: f("\x1B[36m", "\x1B[39m"),
61
+ white: f("\x1B[37m", "\x1B[39m"),
62
+ gray: f("\x1B[90m", "\x1B[39m"),
63
+ bgBlack: f("\x1B[40m", "\x1B[49m"),
64
+ bgRed: f("\x1B[41m", "\x1B[49m"),
65
+ bgGreen: f("\x1B[42m", "\x1B[49m"),
66
+ bgYellow: f("\x1B[43m", "\x1B[49m"),
67
+ bgBlue: f("\x1B[44m", "\x1B[49m"),
68
+ bgMagenta: f("\x1B[45m", "\x1B[49m"),
69
+ bgCyan: f("\x1B[46m", "\x1B[49m"),
70
+ bgWhite: f("\x1B[47m", "\x1B[49m"),
71
+ blackBright: f("\x1B[90m", "\x1B[39m"),
72
+ redBright: f("\x1B[91m", "\x1B[39m"),
73
+ greenBright: f("\x1B[92m", "\x1B[39m"),
74
+ yellowBright: f("\x1B[93m", "\x1B[39m"),
75
+ blueBright: f("\x1B[94m", "\x1B[39m"),
76
+ magentaBright: f("\x1B[95m", "\x1B[39m"),
77
+ cyanBright: f("\x1B[96m", "\x1B[39m"),
78
+ whiteBright: f("\x1B[97m", "\x1B[39m"),
79
+ bgBlackBright: f("\x1B[100m", "\x1B[49m"),
80
+ bgRedBright: f("\x1B[101m", "\x1B[49m"),
81
+ bgGreenBright: f("\x1B[102m", "\x1B[49m"),
82
+ bgYellowBright: f("\x1B[103m", "\x1B[49m"),
83
+ bgBlueBright: f("\x1B[104m", "\x1B[49m"),
84
+ bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
85
+ bgCyanBright: f("\x1B[106m", "\x1B[49m"),
86
+ bgWhiteBright: f("\x1B[107m", "\x1B[49m")
87
+ };
88
+ };
89
+ module.exports = createColors();
90
+ module.exports.createColors = createColors;
91
+ });
92
+
93
+ // node_modules/sisteransi/src/index.js
94
+ var require_src = __commonJS((exports, module) => {
95
+ var ESC = "\x1B";
96
+ var CSI = `${ESC}[`;
97
+ var beep = "\x07";
98
+ var cursor = {
99
+ to(x, y) {
100
+ if (!y)
101
+ return `${CSI}${x + 1}G`;
102
+ return `${CSI}${y + 1};${x + 1}H`;
103
+ },
104
+ move(x, y) {
105
+ let ret = "";
106
+ if (x < 0)
107
+ ret += `${CSI}${-x}D`;
108
+ else if (x > 0)
109
+ ret += `${CSI}${x}C`;
110
+ if (y < 0)
111
+ ret += `${CSI}${-y}A`;
112
+ else if (y > 0)
113
+ ret += `${CSI}${y}B`;
114
+ return ret;
115
+ },
116
+ up: (count = 1) => `${CSI}${count}A`,
117
+ down: (count = 1) => `${CSI}${count}B`,
118
+ forward: (count = 1) => `${CSI}${count}C`,
119
+ backward: (count = 1) => `${CSI}${count}D`,
120
+ nextLine: (count = 1) => `${CSI}E`.repeat(count),
121
+ prevLine: (count = 1) => `${CSI}F`.repeat(count),
122
+ left: `${CSI}G`,
123
+ hide: `${CSI}?25l`,
124
+ show: `${CSI}?25h`,
125
+ save: `${ESC}7`,
126
+ restore: `${ESC}8`
127
+ };
128
+ var scroll = {
129
+ up: (count = 1) => `${CSI}S`.repeat(count),
130
+ down: (count = 1) => `${CSI}T`.repeat(count)
131
+ };
132
+ var erase = {
133
+ screen: `${CSI}2J`,
134
+ up: (count = 1) => `${CSI}1J`.repeat(count),
135
+ down: (count = 1) => `${CSI}J`.repeat(count),
136
+ line: `${CSI}2K`,
137
+ lineEnd: `${CSI}K`,
138
+ lineStart: `${CSI}1K`,
139
+ lines(count) {
140
+ let clear = "";
141
+ for (let i = 0;i < count; i++)
142
+ clear += this.line + (i < count - 1 ? cursor.up() : "");
143
+ if (count)
144
+ clear += cursor.left;
145
+ return clear;
146
+ }
147
+ };
148
+ module.exports = { cursor, scroll, erase, beep };
149
+ });
150
+
151
+ // node_modules/picocolors/picocolors.js
152
+ var require_picocolors2 = __commonJS((exports, module) => {
153
+ var p = process || {};
154
+ var argv = p.argv || [];
155
+ var env = p.env || {};
156
+ var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
157
+ var formatter = (open, close, replace = open) => (input) => {
158
+ let string = "" + input, index = string.indexOf(close, open.length);
159
+ return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
160
+ };
161
+ var replaceClose = (string, close, replace, index) => {
162
+ let result = "", cursor = 0;
163
+ do {
164
+ result += string.substring(cursor, index) + replace;
165
+ cursor = index + close.length;
166
+ index = string.indexOf(close, cursor);
167
+ } while (~index);
168
+ return result + string.substring(cursor);
169
+ };
170
+ var createColors = (enabled = isColorSupported) => {
171
+ let f = enabled ? formatter : () => String;
172
+ return {
173
+ isColorSupported: enabled,
174
+ reset: f("\x1B[0m", "\x1B[0m"),
175
+ bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
176
+ dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
177
+ italic: f("\x1B[3m", "\x1B[23m"),
178
+ underline: f("\x1B[4m", "\x1B[24m"),
179
+ inverse: f("\x1B[7m", "\x1B[27m"),
180
+ hidden: f("\x1B[8m", "\x1B[28m"),
181
+ strikethrough: f("\x1B[9m", "\x1B[29m"),
182
+ black: f("\x1B[30m", "\x1B[39m"),
183
+ red: f("\x1B[31m", "\x1B[39m"),
184
+ green: f("\x1B[32m", "\x1B[39m"),
185
+ yellow: f("\x1B[33m", "\x1B[39m"),
186
+ blue: f("\x1B[34m", "\x1B[39m"),
187
+ magenta: f("\x1B[35m", "\x1B[39m"),
188
+ cyan: f("\x1B[36m", "\x1B[39m"),
189
+ white: f("\x1B[37m", "\x1B[39m"),
190
+ gray: f("\x1B[90m", "\x1B[39m"),
191
+ bgBlack: f("\x1B[40m", "\x1B[49m"),
192
+ bgRed: f("\x1B[41m", "\x1B[49m"),
193
+ bgGreen: f("\x1B[42m", "\x1B[49m"),
194
+ bgYellow: f("\x1B[43m", "\x1B[49m"),
195
+ bgBlue: f("\x1B[44m", "\x1B[49m"),
196
+ bgMagenta: f("\x1B[45m", "\x1B[49m"),
197
+ bgCyan: f("\x1B[46m", "\x1B[49m"),
198
+ bgWhite: f("\x1B[47m", "\x1B[49m"),
199
+ blackBright: f("\x1B[90m", "\x1B[39m"),
200
+ redBright: f("\x1B[91m", "\x1B[39m"),
201
+ greenBright: f("\x1B[92m", "\x1B[39m"),
202
+ yellowBright: f("\x1B[93m", "\x1B[39m"),
203
+ blueBright: f("\x1B[94m", "\x1B[39m"),
204
+ magentaBright: f("\x1B[95m", "\x1B[39m"),
205
+ cyanBright: f("\x1B[96m", "\x1B[39m"),
206
+ whiteBright: f("\x1B[97m", "\x1B[39m"),
207
+ bgBlackBright: f("\x1B[100m", "\x1B[49m"),
208
+ bgRedBright: f("\x1B[101m", "\x1B[49m"),
209
+ bgGreenBright: f("\x1B[102m", "\x1B[49m"),
210
+ bgYellowBright: f("\x1B[103m", "\x1B[49m"),
211
+ bgBlueBright: f("\x1B[104m", "\x1B[49m"),
212
+ bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
213
+ bgCyanBright: f("\x1B[106m", "\x1B[49m"),
214
+ bgWhiteBright: f("\x1B[107m", "\x1B[49m")
215
+ };
216
+ };
217
+ module.exports = createColors();
218
+ module.exports.createColors = createColors;
219
+ });
220
+
221
+ // node_modules/universalify/index.js
222
+ var require_universalify = __commonJS((exports) => {
223
+ exports.fromCallback = function(fn) {
224
+ return Object.defineProperty(function(...args) {
225
+ if (typeof args[args.length - 1] === "function")
226
+ fn.apply(this, args);
227
+ else {
228
+ return new Promise((resolve, reject) => {
229
+ args.push((err, res) => err != null ? reject(err) : resolve(res));
230
+ fn.apply(this, args);
231
+ });
232
+ }
233
+ }, "name", { value: fn.name });
234
+ };
235
+ exports.fromPromise = function(fn) {
236
+ return Object.defineProperty(function(...args) {
237
+ const cb = args[args.length - 1];
238
+ if (typeof cb !== "function")
239
+ return fn.apply(this, args);
240
+ else {
241
+ args.pop();
242
+ fn.apply(this, args).then((r2) => cb(null, r2), cb);
243
+ }
244
+ }, "name", { value: fn.name });
245
+ };
246
+ });
247
+
248
+ // node_modules/graceful-fs/polyfills.js
249
+ var require_polyfills = __commonJS((exports, module) => {
250
+ var constants = __require("constants");
251
+ var origCwd = process.cwd;
252
+ var cwd = null;
253
+ var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
254
+ process.cwd = function() {
255
+ if (!cwd)
256
+ cwd = origCwd.call(process);
257
+ return cwd;
258
+ };
259
+ try {
260
+ process.cwd();
261
+ } catch (er) {}
262
+ if (typeof process.chdir === "function") {
263
+ chdir = process.chdir;
264
+ process.chdir = function(d3) {
265
+ cwd = null;
266
+ chdir.call(process, d3);
267
+ };
268
+ if (Object.setPrototypeOf)
269
+ Object.setPrototypeOf(process.chdir, chdir);
270
+ }
271
+ var chdir;
272
+ module.exports = patch;
273
+ function patch(fs) {
274
+ if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
275
+ patchLchmod(fs);
276
+ }
277
+ if (!fs.lutimes) {
278
+ patchLutimes(fs);
279
+ }
280
+ fs.chown = chownFix(fs.chown);
281
+ fs.fchown = chownFix(fs.fchown);
282
+ fs.lchown = chownFix(fs.lchown);
283
+ fs.chmod = chmodFix(fs.chmod);
284
+ fs.fchmod = chmodFix(fs.fchmod);
285
+ fs.lchmod = chmodFix(fs.lchmod);
286
+ fs.chownSync = chownFixSync(fs.chownSync);
287
+ fs.fchownSync = chownFixSync(fs.fchownSync);
288
+ fs.lchownSync = chownFixSync(fs.lchownSync);
289
+ fs.chmodSync = chmodFixSync(fs.chmodSync);
290
+ fs.fchmodSync = chmodFixSync(fs.fchmodSync);
291
+ fs.lchmodSync = chmodFixSync(fs.lchmodSync);
292
+ fs.stat = statFix(fs.stat);
293
+ fs.fstat = statFix(fs.fstat);
294
+ fs.lstat = statFix(fs.lstat);
295
+ fs.statSync = statFixSync(fs.statSync);
296
+ fs.fstatSync = statFixSync(fs.fstatSync);
297
+ fs.lstatSync = statFixSync(fs.lstatSync);
298
+ if (fs.chmod && !fs.lchmod) {
299
+ fs.lchmod = function(path, mode, cb) {
300
+ if (cb)
301
+ process.nextTick(cb);
302
+ };
303
+ fs.lchmodSync = function() {};
304
+ }
305
+ if (fs.chown && !fs.lchown) {
306
+ fs.lchown = function(path, uid, gid, cb) {
307
+ if (cb)
308
+ process.nextTick(cb);
309
+ };
310
+ fs.lchownSync = function() {};
311
+ }
312
+ if (platform === "win32") {
313
+ fs.rename = typeof fs.rename !== "function" ? fs.rename : function(fs$rename) {
314
+ function rename(from, to, cb) {
315
+ var start = Date.now();
316
+ var backoff = 0;
317
+ fs$rename(from, to, function CB(er) {
318
+ if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 60000) {
319
+ setTimeout(function() {
320
+ fs.stat(to, function(stater, st) {
321
+ if (stater && stater.code === "ENOENT")
322
+ fs$rename(from, to, CB);
323
+ else
324
+ cb(er);
325
+ });
326
+ }, backoff);
327
+ if (backoff < 100)
328
+ backoff += 10;
329
+ return;
330
+ }
331
+ if (cb)
332
+ cb(er);
333
+ });
334
+ }
335
+ if (Object.setPrototypeOf)
336
+ Object.setPrototypeOf(rename, fs$rename);
337
+ return rename;
338
+ }(fs.rename);
339
+ }
340
+ fs.read = typeof fs.read !== "function" ? fs.read : function(fs$read) {
341
+ function read(fd, buffer, offset, length, position, callback_) {
342
+ var callback;
343
+ if (callback_ && typeof callback_ === "function") {
344
+ var eagCounter = 0;
345
+ callback = function(er, _3, __) {
346
+ if (er && er.code === "EAGAIN" && eagCounter < 10) {
347
+ eagCounter++;
348
+ return fs$read.call(fs, fd, buffer, offset, length, position, callback);
349
+ }
350
+ callback_.apply(this, arguments);
351
+ };
352
+ }
353
+ return fs$read.call(fs, fd, buffer, offset, length, position, callback);
354
+ }
355
+ if (Object.setPrototypeOf)
356
+ Object.setPrototypeOf(read, fs$read);
357
+ return read;
358
+ }(fs.read);
359
+ fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) {
360
+ return function(fd, buffer, offset, length, position) {
361
+ var eagCounter = 0;
362
+ while (true) {
363
+ try {
364
+ return fs$readSync.call(fs, fd, buffer, offset, length, position);
365
+ } catch (er) {
366
+ if (er.code === "EAGAIN" && eagCounter < 10) {
367
+ eagCounter++;
368
+ continue;
369
+ }
370
+ throw er;
371
+ }
372
+ }
373
+ };
374
+ }(fs.readSync);
375
+ function patchLchmod(fs2) {
376
+ fs2.lchmod = function(path, mode, callback) {
377
+ fs2.open(path, constants.O_WRONLY | constants.O_SYMLINK, mode, function(err, fd) {
378
+ if (err) {
379
+ if (callback)
380
+ callback(err);
381
+ return;
382
+ }
383
+ fs2.fchmod(fd, mode, function(err2) {
384
+ fs2.close(fd, function(err22) {
385
+ if (callback)
386
+ callback(err2 || err22);
387
+ });
388
+ });
389
+ });
390
+ };
391
+ fs2.lchmodSync = function(path, mode) {
392
+ var fd = fs2.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode);
393
+ var threw = true;
394
+ var ret;
395
+ try {
396
+ ret = fs2.fchmodSync(fd, mode);
397
+ threw = false;
398
+ } finally {
399
+ if (threw) {
400
+ try {
401
+ fs2.closeSync(fd);
402
+ } catch (er) {}
403
+ } else {
404
+ fs2.closeSync(fd);
405
+ }
406
+ }
407
+ return ret;
408
+ };
409
+ }
410
+ function patchLutimes(fs2) {
411
+ if (constants.hasOwnProperty("O_SYMLINK") && fs2.futimes) {
412
+ fs2.lutimes = function(path, at, mt, cb) {
413
+ fs2.open(path, constants.O_SYMLINK, function(er, fd) {
414
+ if (er) {
415
+ if (cb)
416
+ cb(er);
417
+ return;
418
+ }
419
+ fs2.futimes(fd, at, mt, function(er2) {
420
+ fs2.close(fd, function(er22) {
421
+ if (cb)
422
+ cb(er2 || er22);
423
+ });
424
+ });
425
+ });
426
+ };
427
+ fs2.lutimesSync = function(path, at, mt) {
428
+ var fd = fs2.openSync(path, constants.O_SYMLINK);
429
+ var ret;
430
+ var threw = true;
431
+ try {
432
+ ret = fs2.futimesSync(fd, at, mt);
433
+ threw = false;
434
+ } finally {
435
+ if (threw) {
436
+ try {
437
+ fs2.closeSync(fd);
438
+ } catch (er) {}
439
+ } else {
440
+ fs2.closeSync(fd);
441
+ }
442
+ }
443
+ return ret;
444
+ };
445
+ } else if (fs2.futimes) {
446
+ fs2.lutimes = function(_a, _b, _c, cb) {
447
+ if (cb)
448
+ process.nextTick(cb);
449
+ };
450
+ fs2.lutimesSync = function() {};
451
+ }
452
+ }
453
+ function chmodFix(orig) {
454
+ if (!orig)
455
+ return orig;
456
+ return function(target, mode, cb) {
457
+ return orig.call(fs, target, mode, function(er) {
458
+ if (chownErOk(er))
459
+ er = null;
460
+ if (cb)
461
+ cb.apply(this, arguments);
462
+ });
463
+ };
464
+ }
465
+ function chmodFixSync(orig) {
466
+ if (!orig)
467
+ return orig;
468
+ return function(target, mode) {
469
+ try {
470
+ return orig.call(fs, target, mode);
471
+ } catch (er) {
472
+ if (!chownErOk(er))
473
+ throw er;
474
+ }
475
+ };
476
+ }
477
+ function chownFix(orig) {
478
+ if (!orig)
479
+ return orig;
480
+ return function(target, uid, gid, cb) {
481
+ return orig.call(fs, target, uid, gid, function(er) {
482
+ if (chownErOk(er))
483
+ er = null;
484
+ if (cb)
485
+ cb.apply(this, arguments);
486
+ });
487
+ };
488
+ }
489
+ function chownFixSync(orig) {
490
+ if (!orig)
491
+ return orig;
492
+ return function(target, uid, gid) {
493
+ try {
494
+ return orig.call(fs, target, uid, gid);
495
+ } catch (er) {
496
+ if (!chownErOk(er))
497
+ throw er;
498
+ }
499
+ };
500
+ }
501
+ function statFix(orig) {
502
+ if (!orig)
503
+ return orig;
504
+ return function(target, options, cb) {
505
+ if (typeof options === "function") {
506
+ cb = options;
507
+ options = null;
508
+ }
509
+ function callback(er, stats) {
510
+ if (stats) {
511
+ if (stats.uid < 0)
512
+ stats.uid += 4294967296;
513
+ if (stats.gid < 0)
514
+ stats.gid += 4294967296;
515
+ }
516
+ if (cb)
517
+ cb.apply(this, arguments);
518
+ }
519
+ return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback);
520
+ };
521
+ }
522
+ function statFixSync(orig) {
523
+ if (!orig)
524
+ return orig;
525
+ return function(target, options) {
526
+ var stats = options ? orig.call(fs, target, options) : orig.call(fs, target);
527
+ if (stats) {
528
+ if (stats.uid < 0)
529
+ stats.uid += 4294967296;
530
+ if (stats.gid < 0)
531
+ stats.gid += 4294967296;
532
+ }
533
+ return stats;
534
+ };
535
+ }
536
+ function chownErOk(er) {
537
+ if (!er)
538
+ return true;
539
+ if (er.code === "ENOSYS")
540
+ return true;
541
+ var nonroot = !process.getuid || process.getuid() !== 0;
542
+ if (nonroot) {
543
+ if (er.code === "EINVAL" || er.code === "EPERM")
544
+ return true;
545
+ }
546
+ return false;
547
+ }
548
+ }
549
+ });
550
+
551
+ // node_modules/graceful-fs/legacy-streams.js
552
+ var require_legacy_streams = __commonJS((exports, module) => {
553
+ var Stream = __require("stream").Stream;
554
+ module.exports = legacy;
555
+ function legacy(fs) {
556
+ return {
557
+ ReadStream,
558
+ WriteStream
559
+ };
560
+ function ReadStream(path, options) {
561
+ if (!(this instanceof ReadStream))
562
+ return new ReadStream(path, options);
563
+ Stream.call(this);
564
+ var self = this;
565
+ this.path = path;
566
+ this.fd = null;
567
+ this.readable = true;
568
+ this.paused = false;
569
+ this.flags = "r";
570
+ this.mode = 438;
571
+ this.bufferSize = 64 * 1024;
572
+ options = options || {};
573
+ var keys = Object.keys(options);
574
+ for (var index = 0, length = keys.length;index < length; index++) {
575
+ var key = keys[index];
576
+ this[key] = options[key];
577
+ }
578
+ if (this.encoding)
579
+ this.setEncoding(this.encoding);
580
+ if (this.start !== undefined) {
581
+ if (typeof this.start !== "number") {
582
+ throw TypeError("start must be a Number");
583
+ }
584
+ if (this.end === undefined) {
585
+ this.end = Infinity;
586
+ } else if (typeof this.end !== "number") {
587
+ throw TypeError("end must be a Number");
588
+ }
589
+ if (this.start > this.end) {
590
+ throw new Error("start must be <= end");
591
+ }
592
+ this.pos = this.start;
593
+ }
594
+ if (this.fd !== null) {
595
+ process.nextTick(function() {
596
+ self._read();
597
+ });
598
+ return;
599
+ }
600
+ fs.open(this.path, this.flags, this.mode, function(err, fd) {
601
+ if (err) {
602
+ self.emit("error", err);
603
+ self.readable = false;
604
+ return;
605
+ }
606
+ self.fd = fd;
607
+ self.emit("open", fd);
608
+ self._read();
609
+ });
610
+ }
611
+ function WriteStream(path, options) {
612
+ if (!(this instanceof WriteStream))
613
+ return new WriteStream(path, options);
614
+ Stream.call(this);
615
+ this.path = path;
616
+ this.fd = null;
617
+ this.writable = true;
618
+ this.flags = "w";
619
+ this.encoding = "binary";
620
+ this.mode = 438;
621
+ this.bytesWritten = 0;
622
+ options = options || {};
623
+ var keys = Object.keys(options);
624
+ for (var index = 0, length = keys.length;index < length; index++) {
625
+ var key = keys[index];
626
+ this[key] = options[key];
627
+ }
628
+ if (this.start !== undefined) {
629
+ if (typeof this.start !== "number") {
630
+ throw TypeError("start must be a Number");
631
+ }
632
+ if (this.start < 0) {
633
+ throw new Error("start must be >= zero");
634
+ }
635
+ this.pos = this.start;
636
+ }
637
+ this.busy = false;
638
+ this._queue = [];
639
+ if (this.fd === null) {
640
+ this._open = fs.open;
641
+ this._queue.push([this._open, this.path, this.flags, this.mode, undefined]);
642
+ this.flush();
643
+ }
644
+ }
645
+ }
646
+ });
647
+
648
+ // node_modules/graceful-fs/clone.js
649
+ var require_clone = __commonJS((exports, module) => {
650
+ module.exports = clone;
651
+ var getPrototypeOf = Object.getPrototypeOf || function(obj) {
652
+ return obj.__proto__;
653
+ };
654
+ function clone(obj) {
655
+ if (obj === null || typeof obj !== "object")
656
+ return obj;
657
+ if (obj instanceof Object)
658
+ var copy = { __proto__: getPrototypeOf(obj) };
659
+ else
660
+ var copy = Object.create(null);
661
+ Object.getOwnPropertyNames(obj).forEach(function(key) {
662
+ Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
663
+ });
664
+ return copy;
665
+ }
666
+ });
667
+
668
+ // node_modules/graceful-fs/graceful-fs.js
669
+ var require_graceful_fs = __commonJS((exports, module) => {
670
+ var fs = __require("fs");
671
+ var polyfills = require_polyfills();
672
+ var legacy = require_legacy_streams();
673
+ var clone = require_clone();
674
+ var util = __require("util");
675
+ var gracefulQueue;
676
+ var previousSymbol;
677
+ if (typeof Symbol === "function" && typeof Symbol.for === "function") {
678
+ gracefulQueue = Symbol.for("graceful-fs.queue");
679
+ previousSymbol = Symbol.for("graceful-fs.previous");
680
+ } else {
681
+ gracefulQueue = "___graceful-fs.queue";
682
+ previousSymbol = "___graceful-fs.previous";
683
+ }
684
+ function noop() {}
685
+ function publishQueue(context, queue2) {
686
+ Object.defineProperty(context, gracefulQueue, {
687
+ get: function() {
688
+ return queue2;
689
+ }
690
+ });
691
+ }
692
+ var debug = noop;
693
+ if (util.debuglog)
694
+ debug = util.debuglog("gfs4");
695
+ else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
696
+ debug = function() {
697
+ var m2 = util.format.apply(util, arguments);
698
+ m2 = "GFS4: " + m2.split(/\n/).join(`
699
+ GFS4: `);
700
+ console.error(m2);
701
+ };
702
+ if (!fs[gracefulQueue]) {
703
+ queue = global[gracefulQueue] || [];
704
+ publishQueue(fs, queue);
705
+ fs.close = function(fs$close) {
706
+ function close(fd, cb) {
707
+ return fs$close.call(fs, fd, function(err) {
708
+ if (!err) {
709
+ resetQueue();
710
+ }
711
+ if (typeof cb === "function")
712
+ cb.apply(this, arguments);
713
+ });
714
+ }
715
+ Object.defineProperty(close, previousSymbol, {
716
+ value: fs$close
717
+ });
718
+ return close;
719
+ }(fs.close);
720
+ fs.closeSync = function(fs$closeSync) {
721
+ function closeSync(fd) {
722
+ fs$closeSync.apply(fs, arguments);
723
+ resetQueue();
724
+ }
725
+ Object.defineProperty(closeSync, previousSymbol, {
726
+ value: fs$closeSync
727
+ });
728
+ return closeSync;
729
+ }(fs.closeSync);
730
+ if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
731
+ process.on("exit", function() {
732
+ debug(fs[gracefulQueue]);
733
+ __require("assert").equal(fs[gracefulQueue].length, 0);
734
+ });
735
+ }
736
+ }
737
+ var queue;
738
+ if (!global[gracefulQueue]) {
739
+ publishQueue(global, fs[gracefulQueue]);
740
+ }
741
+ module.exports = patch(clone(fs));
742
+ if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
743
+ module.exports = patch(fs);
744
+ fs.__patched = true;
745
+ }
746
+ function patch(fs2) {
747
+ polyfills(fs2);
748
+ fs2.gracefulify = patch;
749
+ fs2.createReadStream = createReadStream;
750
+ fs2.createWriteStream = createWriteStream;
751
+ var fs$readFile = fs2.readFile;
752
+ fs2.readFile = readFile;
753
+ function readFile(path, options, cb) {
754
+ if (typeof options === "function")
755
+ cb = options, options = null;
756
+ return go$readFile(path, options, cb);
757
+ function go$readFile(path2, options2, cb2, startTime) {
758
+ return fs$readFile(path2, options2, function(err) {
759
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
760
+ enqueue([go$readFile, [path2, options2, cb2], err, startTime || Date.now(), Date.now()]);
761
+ else {
762
+ if (typeof cb2 === "function")
763
+ cb2.apply(this, arguments);
764
+ }
765
+ });
766
+ }
767
+ }
768
+ var fs$writeFile = fs2.writeFile;
769
+ fs2.writeFile = writeFile;
770
+ function writeFile(path, data, options, cb) {
771
+ if (typeof options === "function")
772
+ cb = options, options = null;
773
+ return go$writeFile(path, data, options, cb);
774
+ function go$writeFile(path2, data2, options2, cb2, startTime) {
775
+ return fs$writeFile(path2, data2, options2, function(err) {
776
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
777
+ enqueue([go$writeFile, [path2, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
778
+ else {
779
+ if (typeof cb2 === "function")
780
+ cb2.apply(this, arguments);
781
+ }
782
+ });
783
+ }
784
+ }
785
+ var fs$appendFile = fs2.appendFile;
786
+ if (fs$appendFile)
787
+ fs2.appendFile = appendFile;
788
+ function appendFile(path, data, options, cb) {
789
+ if (typeof options === "function")
790
+ cb = options, options = null;
791
+ return go$appendFile(path, data, options, cb);
792
+ function go$appendFile(path2, data2, options2, cb2, startTime) {
793
+ return fs$appendFile(path2, data2, options2, function(err) {
794
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
795
+ enqueue([go$appendFile, [path2, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
796
+ else {
797
+ if (typeof cb2 === "function")
798
+ cb2.apply(this, arguments);
799
+ }
800
+ });
801
+ }
802
+ }
803
+ var fs$copyFile = fs2.copyFile;
804
+ if (fs$copyFile)
805
+ fs2.copyFile = copyFile;
806
+ function copyFile(src, dest, flags, cb) {
807
+ if (typeof flags === "function") {
808
+ cb = flags;
809
+ flags = 0;
810
+ }
811
+ return go$copyFile(src, dest, flags, cb);
812
+ function go$copyFile(src2, dest2, flags2, cb2, startTime) {
813
+ return fs$copyFile(src2, dest2, flags2, function(err) {
814
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
815
+ enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]);
816
+ else {
817
+ if (typeof cb2 === "function")
818
+ cb2.apply(this, arguments);
819
+ }
820
+ });
821
+ }
822
+ }
823
+ var fs$readdir = fs2.readdir;
824
+ fs2.readdir = readdir;
825
+ var noReaddirOptionVersions = /^v[0-5]\./;
826
+ function readdir(path, options, cb) {
827
+ if (typeof options === "function")
828
+ cb = options, options = null;
829
+ var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir(path2, options2, cb2, startTime) {
830
+ return fs$readdir(path2, fs$readdirCallback(path2, options2, cb2, startTime));
831
+ } : function go$readdir(path2, options2, cb2, startTime) {
832
+ return fs$readdir(path2, options2, fs$readdirCallback(path2, options2, cb2, startTime));
833
+ };
834
+ return go$readdir(path, options, cb);
835
+ function fs$readdirCallback(path2, options2, cb2, startTime) {
836
+ return function(err, files) {
837
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
838
+ enqueue([
839
+ go$readdir,
840
+ [path2, options2, cb2],
841
+ err,
842
+ startTime || Date.now(),
843
+ Date.now()
844
+ ]);
845
+ else {
846
+ if (files && files.sort)
847
+ files.sort();
848
+ if (typeof cb2 === "function")
849
+ cb2.call(this, err, files);
850
+ }
851
+ };
852
+ }
853
+ }
854
+ if (process.version.substr(0, 4) === "v0.8") {
855
+ var legStreams = legacy(fs2);
856
+ ReadStream = legStreams.ReadStream;
857
+ WriteStream = legStreams.WriteStream;
858
+ }
859
+ var fs$ReadStream = fs2.ReadStream;
860
+ if (fs$ReadStream) {
861
+ ReadStream.prototype = Object.create(fs$ReadStream.prototype);
862
+ ReadStream.prototype.open = ReadStream$open;
863
+ }
864
+ var fs$WriteStream = fs2.WriteStream;
865
+ if (fs$WriteStream) {
866
+ WriteStream.prototype = Object.create(fs$WriteStream.prototype);
867
+ WriteStream.prototype.open = WriteStream$open;
868
+ }
869
+ Object.defineProperty(fs2, "ReadStream", {
870
+ get: function() {
871
+ return ReadStream;
872
+ },
873
+ set: function(val) {
874
+ ReadStream = val;
875
+ },
876
+ enumerable: true,
877
+ configurable: true
878
+ });
879
+ Object.defineProperty(fs2, "WriteStream", {
880
+ get: function() {
881
+ return WriteStream;
882
+ },
883
+ set: function(val) {
884
+ WriteStream = val;
885
+ },
886
+ enumerable: true,
887
+ configurable: true
888
+ });
889
+ var FileReadStream = ReadStream;
890
+ Object.defineProperty(fs2, "FileReadStream", {
891
+ get: function() {
892
+ return FileReadStream;
893
+ },
894
+ set: function(val) {
895
+ FileReadStream = val;
896
+ },
897
+ enumerable: true,
898
+ configurable: true
899
+ });
900
+ var FileWriteStream = WriteStream;
901
+ Object.defineProperty(fs2, "FileWriteStream", {
902
+ get: function() {
903
+ return FileWriteStream;
904
+ },
905
+ set: function(val) {
906
+ FileWriteStream = val;
907
+ },
908
+ enumerable: true,
909
+ configurable: true
910
+ });
911
+ function ReadStream(path, options) {
912
+ if (this instanceof ReadStream)
913
+ return fs$ReadStream.apply(this, arguments), this;
914
+ else
915
+ return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
916
+ }
917
+ function ReadStream$open() {
918
+ var that = this;
919
+ open(that.path, that.flags, that.mode, function(err, fd) {
920
+ if (err) {
921
+ if (that.autoClose)
922
+ that.destroy();
923
+ that.emit("error", err);
924
+ } else {
925
+ that.fd = fd;
926
+ that.emit("open", fd);
927
+ that.read();
928
+ }
929
+ });
930
+ }
931
+ function WriteStream(path, options) {
932
+ if (this instanceof WriteStream)
933
+ return fs$WriteStream.apply(this, arguments), this;
934
+ else
935
+ return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
936
+ }
937
+ function WriteStream$open() {
938
+ var that = this;
939
+ open(that.path, that.flags, that.mode, function(err, fd) {
940
+ if (err) {
941
+ that.destroy();
942
+ that.emit("error", err);
943
+ } else {
944
+ that.fd = fd;
945
+ that.emit("open", fd);
946
+ }
947
+ });
948
+ }
949
+ function createReadStream(path, options) {
950
+ return new fs2.ReadStream(path, options);
951
+ }
952
+ function createWriteStream(path, options) {
953
+ return new fs2.WriteStream(path, options);
954
+ }
955
+ var fs$open = fs2.open;
956
+ fs2.open = open;
957
+ function open(path, flags, mode, cb) {
958
+ if (typeof mode === "function")
959
+ cb = mode, mode = null;
960
+ return go$open(path, flags, mode, cb);
961
+ function go$open(path2, flags2, mode2, cb2, startTime) {
962
+ return fs$open(path2, flags2, mode2, function(err, fd) {
963
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
964
+ enqueue([go$open, [path2, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
965
+ else {
966
+ if (typeof cb2 === "function")
967
+ cb2.apply(this, arguments);
968
+ }
969
+ });
970
+ }
971
+ }
972
+ return fs2;
973
+ }
974
+ function enqueue(elem) {
975
+ debug("ENQUEUE", elem[0].name, elem[1]);
976
+ fs[gracefulQueue].push(elem);
977
+ retry();
978
+ }
979
+ var retryTimer;
980
+ function resetQueue() {
981
+ var now = Date.now();
982
+ for (var i = 0;i < fs[gracefulQueue].length; ++i) {
983
+ if (fs[gracefulQueue][i].length > 2) {
984
+ fs[gracefulQueue][i][3] = now;
985
+ fs[gracefulQueue][i][4] = now;
986
+ }
987
+ }
988
+ retry();
989
+ }
990
+ function retry() {
991
+ clearTimeout(retryTimer);
992
+ retryTimer = undefined;
993
+ if (fs[gracefulQueue].length === 0)
994
+ return;
995
+ var elem = fs[gracefulQueue].shift();
996
+ var fn = elem[0];
997
+ var args = elem[1];
998
+ var err = elem[2];
999
+ var startTime = elem[3];
1000
+ var lastTime = elem[4];
1001
+ if (startTime === undefined) {
1002
+ debug("RETRY", fn.name, args);
1003
+ fn.apply(null, args);
1004
+ } else if (Date.now() - startTime >= 60000) {
1005
+ debug("TIMEOUT", fn.name, args);
1006
+ var cb = args.pop();
1007
+ if (typeof cb === "function")
1008
+ cb.call(null, err);
1009
+ } else {
1010
+ var sinceAttempt = Date.now() - lastTime;
1011
+ var sinceStart = Math.max(lastTime - startTime, 1);
1012
+ var desiredDelay = Math.min(sinceStart * 1.2, 100);
1013
+ if (sinceAttempt >= desiredDelay) {
1014
+ debug("RETRY", fn.name, args);
1015
+ fn.apply(null, args.concat([startTime]));
1016
+ } else {
1017
+ fs[gracefulQueue].push(elem);
1018
+ }
1019
+ }
1020
+ if (retryTimer === undefined) {
1021
+ retryTimer = setTimeout(retry, 0);
1022
+ }
1023
+ }
1024
+ });
1025
+
1026
+ // node_modules/fs-extra/lib/fs/index.js
1027
+ var require_fs = __commonJS((exports) => {
1028
+ var u = require_universalify().fromCallback;
1029
+ var fs = require_graceful_fs();
1030
+ var api = [
1031
+ "access",
1032
+ "appendFile",
1033
+ "chmod",
1034
+ "chown",
1035
+ "close",
1036
+ "copyFile",
1037
+ "cp",
1038
+ "fchmod",
1039
+ "fchown",
1040
+ "fdatasync",
1041
+ "fstat",
1042
+ "fsync",
1043
+ "ftruncate",
1044
+ "futimes",
1045
+ "glob",
1046
+ "lchmod",
1047
+ "lchown",
1048
+ "lutimes",
1049
+ "link",
1050
+ "lstat",
1051
+ "mkdir",
1052
+ "mkdtemp",
1053
+ "open",
1054
+ "opendir",
1055
+ "readdir",
1056
+ "readFile",
1057
+ "readlink",
1058
+ "realpath",
1059
+ "rename",
1060
+ "rm",
1061
+ "rmdir",
1062
+ "stat",
1063
+ "statfs",
1064
+ "symlink",
1065
+ "truncate",
1066
+ "unlink",
1067
+ "utimes",
1068
+ "writeFile"
1069
+ ].filter((key) => {
1070
+ return typeof fs[key] === "function";
1071
+ });
1072
+ Object.assign(exports, fs);
1073
+ api.forEach((method) => {
1074
+ exports[method] = u(fs[method]);
1075
+ });
1076
+ exports.exists = function(filename, callback) {
1077
+ if (typeof callback === "function") {
1078
+ return fs.exists(filename, callback);
1079
+ }
1080
+ return new Promise((resolve) => {
1081
+ return fs.exists(filename, resolve);
1082
+ });
1083
+ };
1084
+ exports.read = function(fd, buffer, offset, length, position, callback) {
1085
+ if (typeof callback === "function") {
1086
+ return fs.read(fd, buffer, offset, length, position, callback);
1087
+ }
1088
+ return new Promise((resolve, reject) => {
1089
+ fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => {
1090
+ if (err)
1091
+ return reject(err);
1092
+ resolve({ bytesRead, buffer: buffer2 });
1093
+ });
1094
+ });
1095
+ };
1096
+ exports.write = function(fd, buffer, ...args) {
1097
+ if (typeof args[args.length - 1] === "function") {
1098
+ return fs.write(fd, buffer, ...args);
1099
+ }
1100
+ return new Promise((resolve, reject) => {
1101
+ fs.write(fd, buffer, ...args, (err, bytesWritten, buffer2) => {
1102
+ if (err)
1103
+ return reject(err);
1104
+ resolve({ bytesWritten, buffer: buffer2 });
1105
+ });
1106
+ });
1107
+ };
1108
+ exports.readv = function(fd, buffers, ...args) {
1109
+ if (typeof args[args.length - 1] === "function") {
1110
+ return fs.readv(fd, buffers, ...args);
1111
+ }
1112
+ return new Promise((resolve, reject) => {
1113
+ fs.readv(fd, buffers, ...args, (err, bytesRead, buffers2) => {
1114
+ if (err)
1115
+ return reject(err);
1116
+ resolve({ bytesRead, buffers: buffers2 });
1117
+ });
1118
+ });
1119
+ };
1120
+ exports.writev = function(fd, buffers, ...args) {
1121
+ if (typeof args[args.length - 1] === "function") {
1122
+ return fs.writev(fd, buffers, ...args);
1123
+ }
1124
+ return new Promise((resolve, reject) => {
1125
+ fs.writev(fd, buffers, ...args, (err, bytesWritten, buffers2) => {
1126
+ if (err)
1127
+ return reject(err);
1128
+ resolve({ bytesWritten, buffers: buffers2 });
1129
+ });
1130
+ });
1131
+ };
1132
+ if (typeof fs.realpath.native === "function") {
1133
+ exports.realpath.native = u(fs.realpath.native);
1134
+ } else {
1135
+ process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?", "Warning", "fs-extra-WARN0003");
1136
+ }
1137
+ });
1138
+
1139
+ // node_modules/fs-extra/lib/mkdirs/utils.js
1140
+ var require_utils = __commonJS((exports, module) => {
1141
+ var path = __require("path");
1142
+ exports.checkPath = function checkPath(pth) {
1143
+ if (process.platform === "win32") {
1144
+ const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, ""));
1145
+ if (pathHasInvalidWinCharacters) {
1146
+ const error = new Error(`Path contains invalid characters: ${pth}`);
1147
+ error.code = "EINVAL";
1148
+ throw error;
1149
+ }
1150
+ }
1151
+ };
1152
+ });
1153
+
1154
+ // node_modules/fs-extra/lib/mkdirs/make-dir.js
1155
+ var require_make_dir = __commonJS((exports, module) => {
1156
+ var fs = require_fs();
1157
+ var { checkPath } = require_utils();
1158
+ var getMode = (options) => {
1159
+ const defaults = { mode: 511 };
1160
+ if (typeof options === "number")
1161
+ return options;
1162
+ return { ...defaults, ...options }.mode;
1163
+ };
1164
+ exports.makeDir = async (dir, options) => {
1165
+ checkPath(dir);
1166
+ return fs.mkdir(dir, {
1167
+ mode: getMode(options),
1168
+ recursive: true
1169
+ });
1170
+ };
1171
+ exports.makeDirSync = (dir, options) => {
1172
+ checkPath(dir);
1173
+ return fs.mkdirSync(dir, {
1174
+ mode: getMode(options),
1175
+ recursive: true
1176
+ });
1177
+ };
1178
+ });
1179
+
1180
+ // node_modules/fs-extra/lib/mkdirs/index.js
1181
+ var require_mkdirs = __commonJS((exports, module) => {
1182
+ var u = require_universalify().fromPromise;
1183
+ var { makeDir: _makeDir, makeDirSync } = require_make_dir();
1184
+ var makeDir = u(_makeDir);
1185
+ module.exports = {
1186
+ mkdirs: makeDir,
1187
+ mkdirsSync: makeDirSync,
1188
+ mkdirp: makeDir,
1189
+ mkdirpSync: makeDirSync,
1190
+ ensureDir: makeDir,
1191
+ ensureDirSync: makeDirSync
1192
+ };
1193
+ });
1194
+
1195
+ // node_modules/fs-extra/lib/path-exists/index.js
1196
+ var require_path_exists = __commonJS((exports, module) => {
1197
+ var u = require_universalify().fromPromise;
1198
+ var fs = require_fs();
1199
+ function pathExists(path) {
1200
+ return fs.access(path).then(() => true).catch(() => false);
1201
+ }
1202
+ module.exports = {
1203
+ pathExists: u(pathExists),
1204
+ pathExistsSync: fs.existsSync
1205
+ };
1206
+ });
1207
+
1208
+ // node_modules/fs-extra/lib/util/utimes.js
1209
+ var require_utimes = __commonJS((exports, module) => {
1210
+ var fs = require_fs();
1211
+ var u = require_universalify().fromPromise;
1212
+ async function utimesMillis(path, atime, mtime) {
1213
+ const fd = await fs.open(path, "r+");
1214
+ let closeErr = null;
1215
+ try {
1216
+ await fs.futimes(fd, atime, mtime);
1217
+ } finally {
1218
+ try {
1219
+ await fs.close(fd);
1220
+ } catch (e2) {
1221
+ closeErr = e2;
1222
+ }
1223
+ }
1224
+ if (closeErr) {
1225
+ throw closeErr;
1226
+ }
1227
+ }
1228
+ function utimesMillisSync(path, atime, mtime) {
1229
+ const fd = fs.openSync(path, "r+");
1230
+ fs.futimesSync(fd, atime, mtime);
1231
+ return fs.closeSync(fd);
1232
+ }
1233
+ module.exports = {
1234
+ utimesMillis: u(utimesMillis),
1235
+ utimesMillisSync
1236
+ };
1237
+ });
1238
+
1239
+ // node_modules/fs-extra/lib/util/stat.js
1240
+ var require_stat = __commonJS((exports, module) => {
1241
+ var fs = require_fs();
1242
+ var path = __require("path");
1243
+ var u = require_universalify().fromPromise;
1244
+ function getStats(src, dest, opts) {
1245
+ const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true });
1246
+ return Promise.all([
1247
+ statFunc(src),
1248
+ statFunc(dest).catch((err) => {
1249
+ if (err.code === "ENOENT")
1250
+ return null;
1251
+ throw err;
1252
+ })
1253
+ ]).then(([srcStat, destStat]) => ({ srcStat, destStat }));
1254
+ }
1255
+ function getStatsSync(src, dest, opts) {
1256
+ let destStat;
1257
+ const statFunc = opts.dereference ? (file) => fs.statSync(file, { bigint: true }) : (file) => fs.lstatSync(file, { bigint: true });
1258
+ const srcStat = statFunc(src);
1259
+ try {
1260
+ destStat = statFunc(dest);
1261
+ } catch (err) {
1262
+ if (err.code === "ENOENT")
1263
+ return { srcStat, destStat: null };
1264
+ throw err;
1265
+ }
1266
+ return { srcStat, destStat };
1267
+ }
1268
+ async function checkPaths(src, dest, funcName, opts) {
1269
+ const { srcStat, destStat } = await getStats(src, dest, opts);
1270
+ if (destStat) {
1271
+ if (areIdentical(srcStat, destStat)) {
1272
+ const srcBaseName = path.basename(src);
1273
+ const destBaseName = path.basename(dest);
1274
+ if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
1275
+ return { srcStat, destStat, isChangingCase: true };
1276
+ }
1277
+ throw new Error("Source and destination must not be the same.");
1278
+ }
1279
+ if (srcStat.isDirectory() && !destStat.isDirectory()) {
1280
+ throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
1281
+ }
1282
+ if (!srcStat.isDirectory() && destStat.isDirectory()) {
1283
+ throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
1284
+ }
1285
+ }
1286
+ if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
1287
+ throw new Error(errMsg(src, dest, funcName));
1288
+ }
1289
+ return { srcStat, destStat };
1290
+ }
1291
+ function checkPathsSync(src, dest, funcName, opts) {
1292
+ const { srcStat, destStat } = getStatsSync(src, dest, opts);
1293
+ if (destStat) {
1294
+ if (areIdentical(srcStat, destStat)) {
1295
+ const srcBaseName = path.basename(src);
1296
+ const destBaseName = path.basename(dest);
1297
+ if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
1298
+ return { srcStat, destStat, isChangingCase: true };
1299
+ }
1300
+ throw new Error("Source and destination must not be the same.");
1301
+ }
1302
+ if (srcStat.isDirectory() && !destStat.isDirectory()) {
1303
+ throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
1304
+ }
1305
+ if (!srcStat.isDirectory() && destStat.isDirectory()) {
1306
+ throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
1307
+ }
1308
+ }
1309
+ if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
1310
+ throw new Error(errMsg(src, dest, funcName));
1311
+ }
1312
+ return { srcStat, destStat };
1313
+ }
1314
+ async function checkParentPaths(src, srcStat, dest, funcName) {
1315
+ const srcParent = path.resolve(path.dirname(src));
1316
+ const destParent = path.resolve(path.dirname(dest));
1317
+ if (destParent === srcParent || destParent === path.parse(destParent).root)
1318
+ return;
1319
+ let destStat;
1320
+ try {
1321
+ destStat = await fs.stat(destParent, { bigint: true });
1322
+ } catch (err) {
1323
+ if (err.code === "ENOENT")
1324
+ return;
1325
+ throw err;
1326
+ }
1327
+ if (areIdentical(srcStat, destStat)) {
1328
+ throw new Error(errMsg(src, dest, funcName));
1329
+ }
1330
+ return checkParentPaths(src, srcStat, destParent, funcName);
1331
+ }
1332
+ function checkParentPathsSync(src, srcStat, dest, funcName) {
1333
+ const srcParent = path.resolve(path.dirname(src));
1334
+ const destParent = path.resolve(path.dirname(dest));
1335
+ if (destParent === srcParent || destParent === path.parse(destParent).root)
1336
+ return;
1337
+ let destStat;
1338
+ try {
1339
+ destStat = fs.statSync(destParent, { bigint: true });
1340
+ } catch (err) {
1341
+ if (err.code === "ENOENT")
1342
+ return;
1343
+ throw err;
1344
+ }
1345
+ if (areIdentical(srcStat, destStat)) {
1346
+ throw new Error(errMsg(src, dest, funcName));
1347
+ }
1348
+ return checkParentPathsSync(src, srcStat, destParent, funcName);
1349
+ }
1350
+ function areIdentical(srcStat, destStat) {
1351
+ return destStat.ino !== undefined && destStat.dev !== undefined && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;
1352
+ }
1353
+ function isSrcSubdir(src, dest) {
1354
+ const srcArr = path.resolve(src).split(path.sep).filter((i) => i);
1355
+ const destArr = path.resolve(dest).split(path.sep).filter((i) => i);
1356
+ return srcArr.every((cur, i) => destArr[i] === cur);
1357
+ }
1358
+ function errMsg(src, dest, funcName) {
1359
+ return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`;
1360
+ }
1361
+ module.exports = {
1362
+ checkPaths: u(checkPaths),
1363
+ checkPathsSync,
1364
+ checkParentPaths: u(checkParentPaths),
1365
+ checkParentPathsSync,
1366
+ isSrcSubdir,
1367
+ areIdentical
1368
+ };
1369
+ });
1370
+
1371
+ // node_modules/fs-extra/lib/util/async.js
1372
+ var require_async = __commonJS((exports, module) => {
1373
+ async function asyncIteratorConcurrentProcess(iterator, fn) {
1374
+ const promises = [];
1375
+ for await (const item of iterator) {
1376
+ promises.push(fn(item).then(() => null, (err) => err ?? new Error("unknown error")));
1377
+ }
1378
+ await Promise.all(promises.map((promise) => promise.then((possibleErr) => {
1379
+ if (possibleErr !== null)
1380
+ throw possibleErr;
1381
+ })));
1382
+ }
1383
+ module.exports = {
1384
+ asyncIteratorConcurrentProcess
1385
+ };
1386
+ });
1387
+
1388
+ // node_modules/fs-extra/lib/copy/copy.js
1389
+ var require_copy = __commonJS((exports, module) => {
1390
+ var fs = require_fs();
1391
+ var path = __require("path");
1392
+ var { mkdirs } = require_mkdirs();
1393
+ var { pathExists } = require_path_exists();
1394
+ var { utimesMillis } = require_utimes();
1395
+ var stat = require_stat();
1396
+ var { asyncIteratorConcurrentProcess } = require_async();
1397
+ async function copy(src, dest, opts = {}) {
1398
+ if (typeof opts === "function") {
1399
+ opts = { filter: opts };
1400
+ }
1401
+ opts.clobber = "clobber" in opts ? !!opts.clobber : true;
1402
+ opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
1403
+ if (opts.preserveTimestamps && process.arch === "ia32") {
1404
+ process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
1405
+
1406
+ ` + "\tsee https://github.com/jprichardson/node-fs-extra/issues/269", "Warning", "fs-extra-WARN0001");
1407
+ }
1408
+ const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts);
1409
+ await stat.checkParentPaths(src, srcStat, dest, "copy");
1410
+ const include = await runFilter(src, dest, opts);
1411
+ if (!include)
1412
+ return;
1413
+ const destParent = path.dirname(dest);
1414
+ const dirExists = await pathExists(destParent);
1415
+ if (!dirExists) {
1416
+ await mkdirs(destParent);
1417
+ }
1418
+ await getStatsAndPerformCopy(destStat, src, dest, opts);
1419
+ }
1420
+ async function runFilter(src, dest, opts) {
1421
+ if (!opts.filter)
1422
+ return true;
1423
+ return opts.filter(src, dest);
1424
+ }
1425
+ async function getStatsAndPerformCopy(destStat, src, dest, opts) {
1426
+ const statFn = opts.dereference ? fs.stat : fs.lstat;
1427
+ const srcStat = await statFn(src);
1428
+ if (srcStat.isDirectory())
1429
+ return onDir(srcStat, destStat, src, dest, opts);
1430
+ if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice())
1431
+ return onFile(srcStat, destStat, src, dest, opts);
1432
+ if (srcStat.isSymbolicLink())
1433
+ return onLink(destStat, src, dest, opts);
1434
+ if (srcStat.isSocket())
1435
+ throw new Error(`Cannot copy a socket file: ${src}`);
1436
+ if (srcStat.isFIFO())
1437
+ throw new Error(`Cannot copy a FIFO pipe: ${src}`);
1438
+ throw new Error(`Unknown file: ${src}`);
1439
+ }
1440
+ async function onFile(srcStat, destStat, src, dest, opts) {
1441
+ if (!destStat)
1442
+ return copyFile(srcStat, src, dest, opts);
1443
+ if (opts.overwrite) {
1444
+ await fs.unlink(dest);
1445
+ return copyFile(srcStat, src, dest, opts);
1446
+ }
1447
+ if (opts.errorOnExist) {
1448
+ throw new Error(`'${dest}' already exists`);
1449
+ }
1450
+ }
1451
+ async function copyFile(srcStat, src, dest, opts) {
1452
+ await fs.copyFile(src, dest);
1453
+ if (opts.preserveTimestamps) {
1454
+ if (fileIsNotWritable(srcStat.mode)) {
1455
+ await makeFileWritable(dest, srcStat.mode);
1456
+ }
1457
+ const updatedSrcStat = await fs.stat(src);
1458
+ await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
1459
+ }
1460
+ return fs.chmod(dest, srcStat.mode);
1461
+ }
1462
+ function fileIsNotWritable(srcMode) {
1463
+ return (srcMode & 128) === 0;
1464
+ }
1465
+ function makeFileWritable(dest, srcMode) {
1466
+ return fs.chmod(dest, srcMode | 128);
1467
+ }
1468
+ async function onDir(srcStat, destStat, src, dest, opts) {
1469
+ if (!destStat) {
1470
+ await fs.mkdir(dest);
1471
+ }
1472
+ await asyncIteratorConcurrentProcess(await fs.opendir(src), async (item) => {
1473
+ const srcItem = path.join(src, item.name);
1474
+ const destItem = path.join(dest, item.name);
1475
+ const include = await runFilter(srcItem, destItem, opts);
1476
+ if (include) {
1477
+ const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts);
1478
+ await getStatsAndPerformCopy(destStat2, srcItem, destItem, opts);
1479
+ }
1480
+ });
1481
+ if (!destStat) {
1482
+ await fs.chmod(dest, srcStat.mode);
1483
+ }
1484
+ }
1485
+ async function onLink(destStat, src, dest, opts) {
1486
+ let resolvedSrc = await fs.readlink(src);
1487
+ if (opts.dereference) {
1488
+ resolvedSrc = path.resolve(process.cwd(), resolvedSrc);
1489
+ }
1490
+ if (!destStat) {
1491
+ return fs.symlink(resolvedSrc, dest);
1492
+ }
1493
+ let resolvedDest = null;
1494
+ try {
1495
+ resolvedDest = await fs.readlink(dest);
1496
+ } catch (e2) {
1497
+ if (e2.code === "EINVAL" || e2.code === "UNKNOWN")
1498
+ return fs.symlink(resolvedSrc, dest);
1499
+ throw e2;
1500
+ }
1501
+ if (opts.dereference) {
1502
+ resolvedDest = path.resolve(process.cwd(), resolvedDest);
1503
+ }
1504
+ if (resolvedSrc !== resolvedDest) {
1505
+ if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
1506
+ throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
1507
+ }
1508
+ if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
1509
+ throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
1510
+ }
1511
+ }
1512
+ await fs.unlink(dest);
1513
+ return fs.symlink(resolvedSrc, dest);
1514
+ }
1515
+ module.exports = copy;
1516
+ });
1517
+
1518
+ // node_modules/fs-extra/lib/copy/copy-sync.js
1519
+ var require_copy_sync = __commonJS((exports, module) => {
1520
+ var fs = require_graceful_fs();
1521
+ var path = __require("path");
1522
+ var mkdirsSync = require_mkdirs().mkdirsSync;
1523
+ var utimesMillisSync = require_utimes().utimesMillisSync;
1524
+ var stat = require_stat();
1525
+ function copySync(src, dest, opts) {
1526
+ if (typeof opts === "function") {
1527
+ opts = { filter: opts };
1528
+ }
1529
+ opts = opts || {};
1530
+ opts.clobber = "clobber" in opts ? !!opts.clobber : true;
1531
+ opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
1532
+ if (opts.preserveTimestamps && process.arch === "ia32") {
1533
+ process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
1534
+
1535
+ ` + "\tsee https://github.com/jprichardson/node-fs-extra/issues/269", "Warning", "fs-extra-WARN0002");
1536
+ }
1537
+ const { srcStat, destStat } = stat.checkPathsSync(src, dest, "copy", opts);
1538
+ stat.checkParentPathsSync(src, srcStat, dest, "copy");
1539
+ if (opts.filter && !opts.filter(src, dest))
1540
+ return;
1541
+ const destParent = path.dirname(dest);
1542
+ if (!fs.existsSync(destParent))
1543
+ mkdirsSync(destParent);
1544
+ return getStats(destStat, src, dest, opts);
1545
+ }
1546
+ function getStats(destStat, src, dest, opts) {
1547
+ const statSync = opts.dereference ? fs.statSync : fs.lstatSync;
1548
+ const srcStat = statSync(src);
1549
+ if (srcStat.isDirectory())
1550
+ return onDir(srcStat, destStat, src, dest, opts);
1551
+ else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice())
1552
+ return onFile(srcStat, destStat, src, dest, opts);
1553
+ else if (srcStat.isSymbolicLink())
1554
+ return onLink(destStat, src, dest, opts);
1555
+ else if (srcStat.isSocket())
1556
+ throw new Error(`Cannot copy a socket file: ${src}`);
1557
+ else if (srcStat.isFIFO())
1558
+ throw new Error(`Cannot copy a FIFO pipe: ${src}`);
1559
+ throw new Error(`Unknown file: ${src}`);
1560
+ }
1561
+ function onFile(srcStat, destStat, src, dest, opts) {
1562
+ if (!destStat)
1563
+ return copyFile(srcStat, src, dest, opts);
1564
+ return mayCopyFile(srcStat, src, dest, opts);
1565
+ }
1566
+ function mayCopyFile(srcStat, src, dest, opts) {
1567
+ if (opts.overwrite) {
1568
+ fs.unlinkSync(dest);
1569
+ return copyFile(srcStat, src, dest, opts);
1570
+ } else if (opts.errorOnExist) {
1571
+ throw new Error(`'${dest}' already exists`);
1572
+ }
1573
+ }
1574
+ function copyFile(srcStat, src, dest, opts) {
1575
+ fs.copyFileSync(src, dest);
1576
+ if (opts.preserveTimestamps)
1577
+ handleTimestamps(srcStat.mode, src, dest);
1578
+ return setDestMode(dest, srcStat.mode);
1579
+ }
1580
+ function handleTimestamps(srcMode, src, dest) {
1581
+ if (fileIsNotWritable(srcMode))
1582
+ makeFileWritable(dest, srcMode);
1583
+ return setDestTimestamps(src, dest);
1584
+ }
1585
+ function fileIsNotWritable(srcMode) {
1586
+ return (srcMode & 128) === 0;
1587
+ }
1588
+ function makeFileWritable(dest, srcMode) {
1589
+ return setDestMode(dest, srcMode | 128);
1590
+ }
1591
+ function setDestMode(dest, srcMode) {
1592
+ return fs.chmodSync(dest, srcMode);
1593
+ }
1594
+ function setDestTimestamps(src, dest) {
1595
+ const updatedSrcStat = fs.statSync(src);
1596
+ return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
1597
+ }
1598
+ function onDir(srcStat, destStat, src, dest, opts) {
1599
+ if (!destStat)
1600
+ return mkDirAndCopy(srcStat.mode, src, dest, opts);
1601
+ return copyDir(src, dest, opts);
1602
+ }
1603
+ function mkDirAndCopy(srcMode, src, dest, opts) {
1604
+ fs.mkdirSync(dest);
1605
+ copyDir(src, dest, opts);
1606
+ return setDestMode(dest, srcMode);
1607
+ }
1608
+ function copyDir(src, dest, opts) {
1609
+ const dir = fs.opendirSync(src);
1610
+ try {
1611
+ let dirent;
1612
+ while ((dirent = dir.readSync()) !== null) {
1613
+ copyDirItem(dirent.name, src, dest, opts);
1614
+ }
1615
+ } finally {
1616
+ dir.closeSync();
1617
+ }
1618
+ }
1619
+ function copyDirItem(item, src, dest, opts) {
1620
+ const srcItem = path.join(src, item);
1621
+ const destItem = path.join(dest, item);
1622
+ if (opts.filter && !opts.filter(srcItem, destItem))
1623
+ return;
1624
+ const { destStat } = stat.checkPathsSync(srcItem, destItem, "copy", opts);
1625
+ return getStats(destStat, srcItem, destItem, opts);
1626
+ }
1627
+ function onLink(destStat, src, dest, opts) {
1628
+ let resolvedSrc = fs.readlinkSync(src);
1629
+ if (opts.dereference) {
1630
+ resolvedSrc = path.resolve(process.cwd(), resolvedSrc);
1631
+ }
1632
+ if (!destStat) {
1633
+ return fs.symlinkSync(resolvedSrc, dest);
1634
+ } else {
1635
+ let resolvedDest;
1636
+ try {
1637
+ resolvedDest = fs.readlinkSync(dest);
1638
+ } catch (err) {
1639
+ if (err.code === "EINVAL" || err.code === "UNKNOWN")
1640
+ return fs.symlinkSync(resolvedSrc, dest);
1641
+ throw err;
1642
+ }
1643
+ if (opts.dereference) {
1644
+ resolvedDest = path.resolve(process.cwd(), resolvedDest);
1645
+ }
1646
+ if (resolvedSrc !== resolvedDest) {
1647
+ if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
1648
+ throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
1649
+ }
1650
+ if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
1651
+ throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
1652
+ }
1653
+ }
1654
+ return copyLink(resolvedSrc, dest);
1655
+ }
1656
+ }
1657
+ function copyLink(resolvedSrc, dest) {
1658
+ fs.unlinkSync(dest);
1659
+ return fs.symlinkSync(resolvedSrc, dest);
1660
+ }
1661
+ module.exports = copySync;
1662
+ });
1663
+
1664
+ // node_modules/fs-extra/lib/copy/index.js
1665
+ var require_copy2 = __commonJS((exports, module) => {
1666
+ var u = require_universalify().fromPromise;
1667
+ module.exports = {
1668
+ copy: u(require_copy()),
1669
+ copySync: require_copy_sync()
1670
+ };
1671
+ });
1672
+
1673
+ // node_modules/fs-extra/lib/remove/index.js
1674
+ var require_remove = __commonJS((exports, module) => {
1675
+ var fs = require_graceful_fs();
1676
+ var u = require_universalify().fromCallback;
1677
+ function remove(path, callback) {
1678
+ fs.rm(path, { recursive: true, force: true }, callback);
1679
+ }
1680
+ function removeSync(path) {
1681
+ fs.rmSync(path, { recursive: true, force: true });
1682
+ }
1683
+ module.exports = {
1684
+ remove: u(remove),
1685
+ removeSync
1686
+ };
1687
+ });
1688
+
1689
+ // node_modules/fs-extra/lib/empty/index.js
1690
+ var require_empty = __commonJS((exports, module) => {
1691
+ var u = require_universalify().fromPromise;
1692
+ var fs = require_fs();
1693
+ var path = __require("path");
1694
+ var mkdir = require_mkdirs();
1695
+ var remove = require_remove();
1696
+ var emptyDir = u(async function emptyDir(dir) {
1697
+ let items;
1698
+ try {
1699
+ items = await fs.readdir(dir);
1700
+ } catch {
1701
+ return mkdir.mkdirs(dir);
1702
+ }
1703
+ return Promise.all(items.map((item) => remove.remove(path.join(dir, item))));
1704
+ });
1705
+ function emptyDirSync(dir) {
1706
+ let items;
1707
+ try {
1708
+ items = fs.readdirSync(dir);
1709
+ } catch {
1710
+ return mkdir.mkdirsSync(dir);
1711
+ }
1712
+ items.forEach((item) => {
1713
+ item = path.join(dir, item);
1714
+ remove.removeSync(item);
1715
+ });
1716
+ }
1717
+ module.exports = {
1718
+ emptyDirSync,
1719
+ emptydirSync: emptyDirSync,
1720
+ emptyDir,
1721
+ emptydir: emptyDir
1722
+ };
1723
+ });
1724
+
1725
+ // node_modules/fs-extra/lib/ensure/file.js
1726
+ var require_file = __commonJS((exports, module) => {
1727
+ var u = require_universalify().fromPromise;
1728
+ var path = __require("path");
1729
+ var fs = require_fs();
1730
+ var mkdir = require_mkdirs();
1731
+ async function createFile(file) {
1732
+ let stats;
1733
+ try {
1734
+ stats = await fs.stat(file);
1735
+ } catch {}
1736
+ if (stats && stats.isFile())
1737
+ return;
1738
+ const dir = path.dirname(file);
1739
+ let dirStats = null;
1740
+ try {
1741
+ dirStats = await fs.stat(dir);
1742
+ } catch (err) {
1743
+ if (err.code === "ENOENT") {
1744
+ await mkdir.mkdirs(dir);
1745
+ await fs.writeFile(file, "");
1746
+ return;
1747
+ } else {
1748
+ throw err;
1749
+ }
1750
+ }
1751
+ if (dirStats.isDirectory()) {
1752
+ await fs.writeFile(file, "");
1753
+ } else {
1754
+ await fs.readdir(dir);
1755
+ }
1756
+ }
1757
+ function createFileSync(file) {
1758
+ let stats;
1759
+ try {
1760
+ stats = fs.statSync(file);
1761
+ } catch {}
1762
+ if (stats && stats.isFile())
1763
+ return;
1764
+ const dir = path.dirname(file);
1765
+ try {
1766
+ if (!fs.statSync(dir).isDirectory()) {
1767
+ fs.readdirSync(dir);
1768
+ }
1769
+ } catch (err) {
1770
+ if (err && err.code === "ENOENT")
1771
+ mkdir.mkdirsSync(dir);
1772
+ else
1773
+ throw err;
1774
+ }
1775
+ fs.writeFileSync(file, "");
1776
+ }
1777
+ module.exports = {
1778
+ createFile: u(createFile),
1779
+ createFileSync
1780
+ };
1781
+ });
1782
+
1783
+ // node_modules/fs-extra/lib/ensure/link.js
1784
+ var require_link = __commonJS((exports, module) => {
1785
+ var u = require_universalify().fromPromise;
1786
+ var path = __require("path");
1787
+ var fs = require_fs();
1788
+ var mkdir = require_mkdirs();
1789
+ var { pathExists } = require_path_exists();
1790
+ var { areIdentical } = require_stat();
1791
+ async function createLink(srcpath, dstpath) {
1792
+ let dstStat;
1793
+ try {
1794
+ dstStat = await fs.lstat(dstpath);
1795
+ } catch {}
1796
+ let srcStat;
1797
+ try {
1798
+ srcStat = await fs.lstat(srcpath);
1799
+ } catch (err) {
1800
+ err.message = err.message.replace("lstat", "ensureLink");
1801
+ throw err;
1802
+ }
1803
+ if (dstStat && areIdentical(srcStat, dstStat))
1804
+ return;
1805
+ const dir = path.dirname(dstpath);
1806
+ const dirExists = await pathExists(dir);
1807
+ if (!dirExists) {
1808
+ await mkdir.mkdirs(dir);
1809
+ }
1810
+ await fs.link(srcpath, dstpath);
1811
+ }
1812
+ function createLinkSync(srcpath, dstpath) {
1813
+ let dstStat;
1814
+ try {
1815
+ dstStat = fs.lstatSync(dstpath);
1816
+ } catch {}
1817
+ try {
1818
+ const srcStat = fs.lstatSync(srcpath);
1819
+ if (dstStat && areIdentical(srcStat, dstStat))
1820
+ return;
1821
+ } catch (err) {
1822
+ err.message = err.message.replace("lstat", "ensureLink");
1823
+ throw err;
1824
+ }
1825
+ const dir = path.dirname(dstpath);
1826
+ const dirExists = fs.existsSync(dir);
1827
+ if (dirExists)
1828
+ return fs.linkSync(srcpath, dstpath);
1829
+ mkdir.mkdirsSync(dir);
1830
+ return fs.linkSync(srcpath, dstpath);
1831
+ }
1832
+ module.exports = {
1833
+ createLink: u(createLink),
1834
+ createLinkSync
1835
+ };
1836
+ });
1837
+
1838
+ // node_modules/fs-extra/lib/ensure/symlink-paths.js
1839
+ var require_symlink_paths = __commonJS((exports, module) => {
1840
+ var path = __require("path");
1841
+ var fs = require_fs();
1842
+ var { pathExists } = require_path_exists();
1843
+ var u = require_universalify().fromPromise;
1844
+ async function symlinkPaths(srcpath, dstpath) {
1845
+ if (path.isAbsolute(srcpath)) {
1846
+ try {
1847
+ await fs.lstat(srcpath);
1848
+ } catch (err) {
1849
+ err.message = err.message.replace("lstat", "ensureSymlink");
1850
+ throw err;
1851
+ }
1852
+ return {
1853
+ toCwd: srcpath,
1854
+ toDst: srcpath
1855
+ };
1856
+ }
1857
+ const dstdir = path.dirname(dstpath);
1858
+ const relativeToDst = path.join(dstdir, srcpath);
1859
+ const exists = await pathExists(relativeToDst);
1860
+ if (exists) {
1861
+ return {
1862
+ toCwd: relativeToDst,
1863
+ toDst: srcpath
1864
+ };
1865
+ }
1866
+ try {
1867
+ await fs.lstat(srcpath);
1868
+ } catch (err) {
1869
+ err.message = err.message.replace("lstat", "ensureSymlink");
1870
+ throw err;
1871
+ }
1872
+ return {
1873
+ toCwd: srcpath,
1874
+ toDst: path.relative(dstdir, srcpath)
1875
+ };
1876
+ }
1877
+ function symlinkPathsSync(srcpath, dstpath) {
1878
+ if (path.isAbsolute(srcpath)) {
1879
+ const exists2 = fs.existsSync(srcpath);
1880
+ if (!exists2)
1881
+ throw new Error("absolute srcpath does not exist");
1882
+ return {
1883
+ toCwd: srcpath,
1884
+ toDst: srcpath
1885
+ };
1886
+ }
1887
+ const dstdir = path.dirname(dstpath);
1888
+ const relativeToDst = path.join(dstdir, srcpath);
1889
+ const exists = fs.existsSync(relativeToDst);
1890
+ if (exists) {
1891
+ return {
1892
+ toCwd: relativeToDst,
1893
+ toDst: srcpath
1894
+ };
1895
+ }
1896
+ const srcExists = fs.existsSync(srcpath);
1897
+ if (!srcExists)
1898
+ throw new Error("relative srcpath does not exist");
1899
+ return {
1900
+ toCwd: srcpath,
1901
+ toDst: path.relative(dstdir, srcpath)
1902
+ };
1903
+ }
1904
+ module.exports = {
1905
+ symlinkPaths: u(symlinkPaths),
1906
+ symlinkPathsSync
1907
+ };
1908
+ });
1909
+
1910
+ // node_modules/fs-extra/lib/ensure/symlink-type.js
1911
+ var require_symlink_type = __commonJS((exports, module) => {
1912
+ var fs = require_fs();
1913
+ var u = require_universalify().fromPromise;
1914
+ async function symlinkType(srcpath, type) {
1915
+ if (type)
1916
+ return type;
1917
+ let stats;
1918
+ try {
1919
+ stats = await fs.lstat(srcpath);
1920
+ } catch {
1921
+ return "file";
1922
+ }
1923
+ return stats && stats.isDirectory() ? "dir" : "file";
1924
+ }
1925
+ function symlinkTypeSync(srcpath, type) {
1926
+ if (type)
1927
+ return type;
1928
+ let stats;
1929
+ try {
1930
+ stats = fs.lstatSync(srcpath);
1931
+ } catch {
1932
+ return "file";
1933
+ }
1934
+ return stats && stats.isDirectory() ? "dir" : "file";
1935
+ }
1936
+ module.exports = {
1937
+ symlinkType: u(symlinkType),
1938
+ symlinkTypeSync
1939
+ };
1940
+ });
1941
+
1942
+ // node_modules/fs-extra/lib/ensure/symlink.js
1943
+ var require_symlink = __commonJS((exports, module) => {
1944
+ var u = require_universalify().fromPromise;
1945
+ var path = __require("path");
1946
+ var fs = require_fs();
1947
+ var { mkdirs, mkdirsSync } = require_mkdirs();
1948
+ var { symlinkPaths, symlinkPathsSync } = require_symlink_paths();
1949
+ var { symlinkType, symlinkTypeSync } = require_symlink_type();
1950
+ var { pathExists } = require_path_exists();
1951
+ var { areIdentical } = require_stat();
1952
+ async function createSymlink(srcpath, dstpath, type) {
1953
+ let stats;
1954
+ try {
1955
+ stats = await fs.lstat(dstpath);
1956
+ } catch {}
1957
+ if (stats && stats.isSymbolicLink()) {
1958
+ const [srcStat, dstStat] = await Promise.all([
1959
+ fs.stat(srcpath),
1960
+ fs.stat(dstpath)
1961
+ ]);
1962
+ if (areIdentical(srcStat, dstStat))
1963
+ return;
1964
+ }
1965
+ const relative = await symlinkPaths(srcpath, dstpath);
1966
+ srcpath = relative.toDst;
1967
+ const toType = await symlinkType(relative.toCwd, type);
1968
+ const dir = path.dirname(dstpath);
1969
+ if (!await pathExists(dir)) {
1970
+ await mkdirs(dir);
1971
+ }
1972
+ return fs.symlink(srcpath, dstpath, toType);
1973
+ }
1974
+ function createSymlinkSync(srcpath, dstpath, type) {
1975
+ let stats;
1976
+ try {
1977
+ stats = fs.lstatSync(dstpath);
1978
+ } catch {}
1979
+ if (stats && stats.isSymbolicLink()) {
1980
+ const srcStat = fs.statSync(srcpath);
1981
+ const dstStat = fs.statSync(dstpath);
1982
+ if (areIdentical(srcStat, dstStat))
1983
+ return;
1984
+ }
1985
+ const relative = symlinkPathsSync(srcpath, dstpath);
1986
+ srcpath = relative.toDst;
1987
+ type = symlinkTypeSync(relative.toCwd, type);
1988
+ const dir = path.dirname(dstpath);
1989
+ const exists = fs.existsSync(dir);
1990
+ if (exists)
1991
+ return fs.symlinkSync(srcpath, dstpath, type);
1992
+ mkdirsSync(dir);
1993
+ return fs.symlinkSync(srcpath, dstpath, type);
1994
+ }
1995
+ module.exports = {
1996
+ createSymlink: u(createSymlink),
1997
+ createSymlinkSync
1998
+ };
1999
+ });
2000
+
2001
+ // node_modules/fs-extra/lib/ensure/index.js
2002
+ var require_ensure = __commonJS((exports, module) => {
2003
+ var { createFile, createFileSync } = require_file();
2004
+ var { createLink, createLinkSync } = require_link();
2005
+ var { createSymlink, createSymlinkSync } = require_symlink();
2006
+ module.exports = {
2007
+ createFile,
2008
+ createFileSync,
2009
+ ensureFile: createFile,
2010
+ ensureFileSync: createFileSync,
2011
+ createLink,
2012
+ createLinkSync,
2013
+ ensureLink: createLink,
2014
+ ensureLinkSync: createLinkSync,
2015
+ createSymlink,
2016
+ createSymlinkSync,
2017
+ ensureSymlink: createSymlink,
2018
+ ensureSymlinkSync: createSymlinkSync
2019
+ };
2020
+ });
2021
+
2022
+ // node_modules/jsonfile/utils.js
2023
+ var require_utils2 = __commonJS((exports, module) => {
2024
+ function stringify(obj, { EOL = `
2025
+ `, finalEOL = true, replacer = null, spaces } = {}) {
2026
+ const EOF = finalEOL ? EOL : "";
2027
+ const str = JSON.stringify(obj, replacer, spaces);
2028
+ return str.replace(/\n/g, EOL) + EOF;
2029
+ }
2030
+ function stripBom(content) {
2031
+ if (Buffer.isBuffer(content))
2032
+ content = content.toString("utf8");
2033
+ return content.replace(/^\uFEFF/, "");
2034
+ }
2035
+ module.exports = { stringify, stripBom };
2036
+ });
2037
+
2038
+ // node_modules/jsonfile/index.js
2039
+ var require_jsonfile = __commonJS((exports, module) => {
2040
+ var _fs;
2041
+ try {
2042
+ _fs = require_graceful_fs();
2043
+ } catch (_3) {
2044
+ _fs = __require("fs");
2045
+ }
2046
+ var universalify = require_universalify();
2047
+ var { stringify, stripBom } = require_utils2();
2048
+ async function _readFile(file, options = {}) {
2049
+ if (typeof options === "string") {
2050
+ options = { encoding: options };
2051
+ }
2052
+ const fs = options.fs || _fs;
2053
+ const shouldThrow = "throws" in options ? options.throws : true;
2054
+ let data = await universalify.fromCallback(fs.readFile)(file, options);
2055
+ data = stripBom(data);
2056
+ let obj;
2057
+ try {
2058
+ obj = JSON.parse(data, options ? options.reviver : null);
2059
+ } catch (err) {
2060
+ if (shouldThrow) {
2061
+ err.message = `${file}: ${err.message}`;
2062
+ throw err;
2063
+ } else {
2064
+ return null;
2065
+ }
2066
+ }
2067
+ return obj;
2068
+ }
2069
+ var readFile = universalify.fromPromise(_readFile);
2070
+ function readFileSync(file, options = {}) {
2071
+ if (typeof options === "string") {
2072
+ options = { encoding: options };
2073
+ }
2074
+ const fs = options.fs || _fs;
2075
+ const shouldThrow = "throws" in options ? options.throws : true;
2076
+ try {
2077
+ let content = fs.readFileSync(file, options);
2078
+ content = stripBom(content);
2079
+ return JSON.parse(content, options.reviver);
2080
+ } catch (err) {
2081
+ if (shouldThrow) {
2082
+ err.message = `${file}: ${err.message}`;
2083
+ throw err;
2084
+ } else {
2085
+ return null;
2086
+ }
2087
+ }
2088
+ }
2089
+ async function _writeFile(file, obj, options = {}) {
2090
+ const fs = options.fs || _fs;
2091
+ const str = stringify(obj, options);
2092
+ await universalify.fromCallback(fs.writeFile)(file, str, options);
2093
+ }
2094
+ var writeFile = universalify.fromPromise(_writeFile);
2095
+ function writeFileSync(file, obj, options = {}) {
2096
+ const fs = options.fs || _fs;
2097
+ const str = stringify(obj, options);
2098
+ return fs.writeFileSync(file, str, options);
2099
+ }
2100
+ module.exports = {
2101
+ readFile,
2102
+ readFileSync,
2103
+ writeFile,
2104
+ writeFileSync
2105
+ };
2106
+ });
2107
+
2108
+ // node_modules/fs-extra/lib/json/jsonfile.js
2109
+ var require_jsonfile2 = __commonJS((exports, module) => {
2110
+ var jsonFile = require_jsonfile();
2111
+ module.exports = {
2112
+ readJson: jsonFile.readFile,
2113
+ readJsonSync: jsonFile.readFileSync,
2114
+ writeJson: jsonFile.writeFile,
2115
+ writeJsonSync: jsonFile.writeFileSync
2116
+ };
2117
+ });
2118
+
2119
+ // node_modules/fs-extra/lib/output-file/index.js
2120
+ var require_output_file = __commonJS((exports, module) => {
2121
+ var u = require_universalify().fromPromise;
2122
+ var fs = require_fs();
2123
+ var path = __require("path");
2124
+ var mkdir = require_mkdirs();
2125
+ var pathExists = require_path_exists().pathExists;
2126
+ async function outputFile(file, data, encoding = "utf-8") {
2127
+ const dir = path.dirname(file);
2128
+ if (!await pathExists(dir)) {
2129
+ await mkdir.mkdirs(dir);
2130
+ }
2131
+ return fs.writeFile(file, data, encoding);
2132
+ }
2133
+ function outputFileSync(file, ...args) {
2134
+ const dir = path.dirname(file);
2135
+ if (!fs.existsSync(dir)) {
2136
+ mkdir.mkdirsSync(dir);
2137
+ }
2138
+ fs.writeFileSync(file, ...args);
2139
+ }
2140
+ module.exports = {
2141
+ outputFile: u(outputFile),
2142
+ outputFileSync
2143
+ };
2144
+ });
2145
+
2146
+ // node_modules/fs-extra/lib/json/output-json.js
2147
+ var require_output_json = __commonJS((exports, module) => {
2148
+ var { stringify } = require_utils2();
2149
+ var { outputFile } = require_output_file();
2150
+ async function outputJson(file, data, options = {}) {
2151
+ const str = stringify(data, options);
2152
+ await outputFile(file, str, options);
2153
+ }
2154
+ module.exports = outputJson;
2155
+ });
2156
+
2157
+ // node_modules/fs-extra/lib/json/output-json-sync.js
2158
+ var require_output_json_sync = __commonJS((exports, module) => {
2159
+ var { stringify } = require_utils2();
2160
+ var { outputFileSync } = require_output_file();
2161
+ function outputJsonSync(file, data, options) {
2162
+ const str = stringify(data, options);
2163
+ outputFileSync(file, str, options);
2164
+ }
2165
+ module.exports = outputJsonSync;
2166
+ });
2167
+
2168
+ // node_modules/fs-extra/lib/json/index.js
2169
+ var require_json = __commonJS((exports, module) => {
2170
+ var u = require_universalify().fromPromise;
2171
+ var jsonFile = require_jsonfile2();
2172
+ jsonFile.outputJson = u(require_output_json());
2173
+ jsonFile.outputJsonSync = require_output_json_sync();
2174
+ jsonFile.outputJSON = jsonFile.outputJson;
2175
+ jsonFile.outputJSONSync = jsonFile.outputJsonSync;
2176
+ jsonFile.writeJSON = jsonFile.writeJson;
2177
+ jsonFile.writeJSONSync = jsonFile.writeJsonSync;
2178
+ jsonFile.readJSON = jsonFile.readJson;
2179
+ jsonFile.readJSONSync = jsonFile.readJsonSync;
2180
+ module.exports = jsonFile;
2181
+ });
2182
+
2183
+ // node_modules/fs-extra/lib/move/move.js
2184
+ var require_move = __commonJS((exports, module) => {
2185
+ var fs = require_fs();
2186
+ var path = __require("path");
2187
+ var { copy } = require_copy2();
2188
+ var { remove } = require_remove();
2189
+ var { mkdirp } = require_mkdirs();
2190
+ var { pathExists } = require_path_exists();
2191
+ var stat = require_stat();
2192
+ async function move(src, dest, opts = {}) {
2193
+ const overwrite = opts.overwrite || opts.clobber || false;
2194
+ const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts);
2195
+ await stat.checkParentPaths(src, srcStat, dest, "move");
2196
+ const destParent = path.dirname(dest);
2197
+ const parsedParentPath = path.parse(destParent);
2198
+ if (parsedParentPath.root !== destParent) {
2199
+ await mkdirp(destParent);
2200
+ }
2201
+ return doRename(src, dest, overwrite, isChangingCase);
2202
+ }
2203
+ async function doRename(src, dest, overwrite, isChangingCase) {
2204
+ if (!isChangingCase) {
2205
+ if (overwrite) {
2206
+ await remove(dest);
2207
+ } else if (await pathExists(dest)) {
2208
+ throw new Error("dest already exists.");
2209
+ }
2210
+ }
2211
+ try {
2212
+ await fs.rename(src, dest);
2213
+ } catch (err) {
2214
+ if (err.code !== "EXDEV") {
2215
+ throw err;
2216
+ }
2217
+ await moveAcrossDevice(src, dest, overwrite);
2218
+ }
2219
+ }
2220
+ async function moveAcrossDevice(src, dest, overwrite) {
2221
+ const opts = {
2222
+ overwrite,
2223
+ errorOnExist: true,
2224
+ preserveTimestamps: true
2225
+ };
2226
+ await copy(src, dest, opts);
2227
+ return remove(src);
2228
+ }
2229
+ module.exports = move;
2230
+ });
2231
+
2232
+ // node_modules/fs-extra/lib/move/move-sync.js
2233
+ var require_move_sync = __commonJS((exports, module) => {
2234
+ var fs = require_graceful_fs();
2235
+ var path = __require("path");
2236
+ var copySync = require_copy2().copySync;
2237
+ var removeSync = require_remove().removeSync;
2238
+ var mkdirpSync = require_mkdirs().mkdirpSync;
2239
+ var stat = require_stat();
2240
+ function moveSync(src, dest, opts) {
2241
+ opts = opts || {};
2242
+ const overwrite = opts.overwrite || opts.clobber || false;
2243
+ const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, "move", opts);
2244
+ stat.checkParentPathsSync(src, srcStat, dest, "move");
2245
+ if (!isParentRoot(dest))
2246
+ mkdirpSync(path.dirname(dest));
2247
+ return doRename(src, dest, overwrite, isChangingCase);
2248
+ }
2249
+ function isParentRoot(dest) {
2250
+ const parent = path.dirname(dest);
2251
+ const parsedPath = path.parse(parent);
2252
+ return parsedPath.root === parent;
2253
+ }
2254
+ function doRename(src, dest, overwrite, isChangingCase) {
2255
+ if (isChangingCase)
2256
+ return rename(src, dest, overwrite);
2257
+ if (overwrite) {
2258
+ removeSync(dest);
2259
+ return rename(src, dest, overwrite);
2260
+ }
2261
+ if (fs.existsSync(dest))
2262
+ throw new Error("dest already exists.");
2263
+ return rename(src, dest, overwrite);
2264
+ }
2265
+ function rename(src, dest, overwrite) {
2266
+ try {
2267
+ fs.renameSync(src, dest);
2268
+ } catch (err) {
2269
+ if (err.code !== "EXDEV")
2270
+ throw err;
2271
+ return moveAcrossDevice(src, dest, overwrite);
2272
+ }
2273
+ }
2274
+ function moveAcrossDevice(src, dest, overwrite) {
2275
+ const opts = {
2276
+ overwrite,
2277
+ errorOnExist: true,
2278
+ preserveTimestamps: true
2279
+ };
2280
+ copySync(src, dest, opts);
2281
+ return removeSync(src);
2282
+ }
2283
+ module.exports = moveSync;
2284
+ });
2285
+
2286
+ // node_modules/fs-extra/lib/move/index.js
2287
+ var require_move2 = __commonJS((exports, module) => {
2288
+ var u = require_universalify().fromPromise;
2289
+ module.exports = {
2290
+ move: u(require_move()),
2291
+ moveSync: require_move_sync()
2292
+ };
2293
+ });
2294
+
2295
+ // node_modules/fs-extra/lib/index.js
2296
+ var require_lib = __commonJS((exports, module) => {
2297
+ module.exports = {
2298
+ ...require_fs(),
2299
+ ...require_copy2(),
2300
+ ...require_empty(),
2301
+ ...require_ensure(),
2302
+ ...require_json(),
2303
+ ...require_mkdirs(),
2304
+ ...require_move2(),
2305
+ ...require_output_file(),
2306
+ ...require_path_exists(),
2307
+ ...require_remove()
2308
+ };
2309
+ });
2310
+
2311
+ // node_modules/cac/dist/index.mjs
2312
+ import { EventEmitter } from "events";
2313
+ function toArr(any) {
2314
+ return any == null ? [] : Array.isArray(any) ? any : [any];
2315
+ }
2316
+ function toVal(out, key, val, opts) {
2317
+ var x, old = out[key], nxt = ~opts.string.indexOf(key) ? val == null || val === true ? "" : String(val) : typeof val === "boolean" ? val : ~opts.boolean.indexOf(key) ? val === "false" ? false : val === "true" || (out._.push((x = +val, x * 0 === 0) ? x : val), !!val) : (x = +val, x * 0 === 0) ? x : val;
2318
+ out[key] = old == null ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];
2319
+ }
2320
+ function mri2(args, opts) {
2321
+ args = args || [];
2322
+ opts = opts || {};
2323
+ var k, arr, arg, name, val, out = { _: [] };
2324
+ var i = 0, j = 0, idx = 0, len = args.length;
2325
+ const alibi = opts.alias !== undefined;
2326
+ const strict = opts.unknown !== undefined;
2327
+ const defaults = opts.default !== undefined;
2328
+ opts.alias = opts.alias || {};
2329
+ opts.string = toArr(opts.string);
2330
+ opts.boolean = toArr(opts.boolean);
2331
+ if (alibi) {
2332
+ for (k in opts.alias) {
2333
+ arr = opts.alias[k] = toArr(opts.alias[k]);
2334
+ for (i = 0;i < arr.length; i++) {
2335
+ (opts.alias[arr[i]] = arr.concat(k)).splice(i, 1);
2336
+ }
2337
+ }
2338
+ }
2339
+ for (i = opts.boolean.length;i-- > 0; ) {
2340
+ arr = opts.alias[opts.boolean[i]] || [];
2341
+ for (j = arr.length;j-- > 0; )
2342
+ opts.boolean.push(arr[j]);
2343
+ }
2344
+ for (i = opts.string.length;i-- > 0; ) {
2345
+ arr = opts.alias[opts.string[i]] || [];
2346
+ for (j = arr.length;j-- > 0; )
2347
+ opts.string.push(arr[j]);
2348
+ }
2349
+ if (defaults) {
2350
+ for (k in opts.default) {
2351
+ name = typeof opts.default[k];
2352
+ arr = opts.alias[k] = opts.alias[k] || [];
2353
+ if (opts[name] !== undefined) {
2354
+ opts[name].push(k);
2355
+ for (i = 0;i < arr.length; i++) {
2356
+ opts[name].push(arr[i]);
2357
+ }
2358
+ }
2359
+ }
2360
+ }
2361
+ const keys = strict ? Object.keys(opts.alias) : [];
2362
+ for (i = 0;i < len; i++) {
2363
+ arg = args[i];
2364
+ if (arg === "--") {
2365
+ out._ = out._.concat(args.slice(++i));
2366
+ break;
2367
+ }
2368
+ for (j = 0;j < arg.length; j++) {
2369
+ if (arg.charCodeAt(j) !== 45)
2370
+ break;
2371
+ }
2372
+ if (j === 0) {
2373
+ out._.push(arg);
2374
+ } else if (arg.substring(j, j + 3) === "no-") {
2375
+ name = arg.substring(j + 3);
2376
+ if (strict && !~keys.indexOf(name)) {
2377
+ return opts.unknown(arg);
2378
+ }
2379
+ out[name] = false;
2380
+ } else {
2381
+ for (idx = j + 1;idx < arg.length; idx++) {
2382
+ if (arg.charCodeAt(idx) === 61)
2383
+ break;
2384
+ }
2385
+ name = arg.substring(j, idx);
2386
+ val = arg.substring(++idx) || (i + 1 === len || ("" + args[i + 1]).charCodeAt(0) === 45 || args[++i]);
2387
+ arr = j === 2 ? [name] : name;
2388
+ for (idx = 0;idx < arr.length; idx++) {
2389
+ name = arr[idx];
2390
+ if (strict && !~keys.indexOf(name))
2391
+ return opts.unknown("-".repeat(j) + name);
2392
+ toVal(out, name, idx + 1 < arr.length || val, opts);
2393
+ }
2394
+ }
2395
+ }
2396
+ if (defaults) {
2397
+ for (k in opts.default) {
2398
+ if (out[k] === undefined) {
2399
+ out[k] = opts.default[k];
2400
+ }
2401
+ }
2402
+ }
2403
+ if (alibi) {
2404
+ for (k in out) {
2405
+ arr = opts.alias[k] || [];
2406
+ while (arr.length > 0) {
2407
+ out[arr.shift()] = out[k];
2408
+ }
2409
+ }
2410
+ }
2411
+ return out;
2412
+ }
2413
+ var removeBrackets = (v) => v.replace(/[<[].+/, "").trim();
2414
+ var findAllBrackets = (v) => {
2415
+ const ANGLED_BRACKET_RE_GLOBAL = /<([^>]+)>/g;
2416
+ const SQUARE_BRACKET_RE_GLOBAL = /\[([^\]]+)\]/g;
2417
+ const res = [];
2418
+ const parse = (match) => {
2419
+ let variadic = false;
2420
+ let value = match[1];
2421
+ if (value.startsWith("...")) {
2422
+ value = value.slice(3);
2423
+ variadic = true;
2424
+ }
2425
+ return {
2426
+ required: match[0].startsWith("<"),
2427
+ value,
2428
+ variadic
2429
+ };
2430
+ };
2431
+ let angledMatch;
2432
+ while (angledMatch = ANGLED_BRACKET_RE_GLOBAL.exec(v)) {
2433
+ res.push(parse(angledMatch));
2434
+ }
2435
+ let squareMatch;
2436
+ while (squareMatch = SQUARE_BRACKET_RE_GLOBAL.exec(v)) {
2437
+ res.push(parse(squareMatch));
2438
+ }
2439
+ return res;
2440
+ };
2441
+ var getMriOptions = (options) => {
2442
+ const result = { alias: {}, boolean: [] };
2443
+ for (const [index, option] of options.entries()) {
2444
+ if (option.names.length > 1) {
2445
+ result.alias[option.names[0]] = option.names.slice(1);
2446
+ }
2447
+ if (option.isBoolean) {
2448
+ if (option.negated) {
2449
+ const hasStringTypeOption = options.some((o, i) => {
2450
+ return i !== index && o.names.some((name) => option.names.includes(name)) && typeof o.required === "boolean";
2451
+ });
2452
+ if (!hasStringTypeOption) {
2453
+ result.boolean.push(option.names[0]);
2454
+ }
2455
+ } else {
2456
+ result.boolean.push(option.names[0]);
2457
+ }
2458
+ }
2459
+ }
2460
+ return result;
2461
+ };
2462
+ var findLongest = (arr) => {
2463
+ return arr.sort((a, b) => {
2464
+ return a.length > b.length ? -1 : 1;
2465
+ })[0];
2466
+ };
2467
+ var padRight = (str, length) => {
2468
+ return str.length >= length ? str : `${str}${" ".repeat(length - str.length)}`;
2469
+ };
2470
+ var camelcase = (input) => {
2471
+ return input.replace(/([a-z])-([a-z])/g, (_, p1, p2) => {
2472
+ return p1 + p2.toUpperCase();
2473
+ });
2474
+ };
2475
+ var setDotProp = (obj, keys, val) => {
2476
+ let i = 0;
2477
+ let length = keys.length;
2478
+ let t = obj;
2479
+ let x;
2480
+ for (;i < length; ++i) {
2481
+ x = t[keys[i]];
2482
+ t = t[keys[i]] = i === length - 1 ? val : x != null ? x : !!~keys[i + 1].indexOf(".") || !(+keys[i + 1] > -1) ? {} : [];
2483
+ }
2484
+ };
2485
+ var setByType = (obj, transforms) => {
2486
+ for (const key of Object.keys(transforms)) {
2487
+ const transform = transforms[key];
2488
+ if (transform.shouldTransform) {
2489
+ obj[key] = Array.prototype.concat.call([], obj[key]);
2490
+ if (typeof transform.transformFunction === "function") {
2491
+ obj[key] = obj[key].map(transform.transformFunction);
2492
+ }
2493
+ }
2494
+ }
2495
+ };
2496
+ var getFileName = (input) => {
2497
+ const m = /([^\\\/]+)$/.exec(input);
2498
+ return m ? m[1] : "";
2499
+ };
2500
+ var camelcaseOptionName = (name) => {
2501
+ return name.split(".").map((v, i) => {
2502
+ return i === 0 ? camelcase(v) : v;
2503
+ }).join(".");
2504
+ };
2505
+
2506
+ class CACError extends Error {
2507
+ constructor(message) {
2508
+ super(message);
2509
+ this.name = this.constructor.name;
2510
+ if (typeof Error.captureStackTrace === "function") {
2511
+ Error.captureStackTrace(this, this.constructor);
2512
+ } else {
2513
+ this.stack = new Error(message).stack;
2514
+ }
2515
+ }
2516
+ }
2517
+
2518
+ class Option {
2519
+ constructor(rawName, description, config) {
2520
+ this.rawName = rawName;
2521
+ this.description = description;
2522
+ this.config = Object.assign({}, config);
2523
+ rawName = rawName.replace(/\.\*/g, "");
2524
+ this.negated = false;
2525
+ this.names = removeBrackets(rawName).split(",").map((v) => {
2526
+ let name = v.trim().replace(/^-{1,2}/, "");
2527
+ if (name.startsWith("no-")) {
2528
+ this.negated = true;
2529
+ name = name.replace(/^no-/, "");
2530
+ }
2531
+ return camelcaseOptionName(name);
2532
+ }).sort((a, b) => a.length > b.length ? 1 : -1);
2533
+ this.name = this.names[this.names.length - 1];
2534
+ if (this.negated && this.config.default == null) {
2535
+ this.config.default = true;
2536
+ }
2537
+ if (rawName.includes("<")) {
2538
+ this.required = true;
2539
+ } else if (rawName.includes("[")) {
2540
+ this.required = false;
2541
+ } else {
2542
+ this.isBoolean = true;
2543
+ }
2544
+ }
2545
+ }
2546
+ var processArgs = process.argv;
2547
+ var platformInfo = `${process.platform}-${process.arch} node-${process.version}`;
2548
+
2549
+ class Command {
2550
+ constructor(rawName, description, config = {}, cli) {
2551
+ this.rawName = rawName;
2552
+ this.description = description;
2553
+ this.config = config;
2554
+ this.cli = cli;
2555
+ this.options = [];
2556
+ this.aliasNames = [];
2557
+ this.name = removeBrackets(rawName);
2558
+ this.args = findAllBrackets(rawName);
2559
+ this.examples = [];
2560
+ }
2561
+ usage(text) {
2562
+ this.usageText = text;
2563
+ return this;
2564
+ }
2565
+ allowUnknownOptions() {
2566
+ this.config.allowUnknownOptions = true;
2567
+ return this;
2568
+ }
2569
+ ignoreOptionDefaultValue() {
2570
+ this.config.ignoreOptionDefaultValue = true;
2571
+ return this;
2572
+ }
2573
+ version(version, customFlags = "-v, --version") {
2574
+ this.versionNumber = version;
2575
+ this.option(customFlags, "Display version number");
2576
+ return this;
2577
+ }
2578
+ example(example) {
2579
+ this.examples.push(example);
2580
+ return this;
2581
+ }
2582
+ option(rawName, description, config) {
2583
+ const option = new Option(rawName, description, config);
2584
+ this.options.push(option);
2585
+ return this;
2586
+ }
2587
+ alias(name) {
2588
+ this.aliasNames.push(name);
2589
+ return this;
2590
+ }
2591
+ action(callback) {
2592
+ this.commandAction = callback;
2593
+ return this;
2594
+ }
2595
+ isMatched(name) {
2596
+ return this.name === name || this.aliasNames.includes(name);
2597
+ }
2598
+ get isDefaultCommand() {
2599
+ return this.name === "" || this.aliasNames.includes("!");
2600
+ }
2601
+ get isGlobalCommand() {
2602
+ return this instanceof GlobalCommand;
2603
+ }
2604
+ hasOption(name) {
2605
+ name = name.split(".")[0];
2606
+ return this.options.find((option) => {
2607
+ return option.names.includes(name);
2608
+ });
2609
+ }
2610
+ outputHelp() {
2611
+ const { name, commands } = this.cli;
2612
+ const {
2613
+ versionNumber,
2614
+ options: globalOptions,
2615
+ helpCallback
2616
+ } = this.cli.globalCommand;
2617
+ let sections = [
2618
+ {
2619
+ body: `${name}${versionNumber ? `/${versionNumber}` : ""}`
2620
+ }
2621
+ ];
2622
+ sections.push({
2623
+ title: "Usage",
2624
+ body: ` $ ${name} ${this.usageText || this.rawName}`
2625
+ });
2626
+ const showCommands = (this.isGlobalCommand || this.isDefaultCommand) && commands.length > 0;
2627
+ if (showCommands) {
2628
+ const longestCommandName = findLongest(commands.map((command) => command.rawName));
2629
+ sections.push({
2630
+ title: "Commands",
2631
+ body: commands.map((command) => {
2632
+ return ` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`;
2633
+ }).join(`
2634
+ `)
2635
+ });
2636
+ sections.push({
2637
+ title: `For more info, run any command with the \`--help\` flag`,
2638
+ body: commands.map((command) => ` $ ${name}${command.name === "" ? "" : ` ${command.name}`} --help`).join(`
2639
+ `)
2640
+ });
2641
+ }
2642
+ let options = this.isGlobalCommand ? globalOptions : [...this.options, ...globalOptions || []];
2643
+ if (!this.isGlobalCommand && !this.isDefaultCommand) {
2644
+ options = options.filter((option) => option.name !== "version");
2645
+ }
2646
+ if (options.length > 0) {
2647
+ const longestOptionName = findLongest(options.map((option) => option.rawName));
2648
+ sections.push({
2649
+ title: "Options",
2650
+ body: options.map((option) => {
2651
+ return ` ${padRight(option.rawName, longestOptionName.length)} ${option.description} ${option.config.default === undefined ? "" : `(default: ${option.config.default})`}`;
2652
+ }).join(`
2653
+ `)
2654
+ });
2655
+ }
2656
+ if (this.examples.length > 0) {
2657
+ sections.push({
2658
+ title: "Examples",
2659
+ body: this.examples.map((example) => {
2660
+ if (typeof example === "function") {
2661
+ return example(name);
2662
+ }
2663
+ return example;
2664
+ }).join(`
2665
+ `)
2666
+ });
2667
+ }
2668
+ if (helpCallback) {
2669
+ sections = helpCallback(sections) || sections;
2670
+ }
2671
+ console.log(sections.map((section) => {
2672
+ return section.title ? `${section.title}:
2673
+ ${section.body}` : section.body;
2674
+ }).join(`
2675
+
2676
+ `));
2677
+ }
2678
+ outputVersion() {
2679
+ const { name } = this.cli;
2680
+ const { versionNumber } = this.cli.globalCommand;
2681
+ if (versionNumber) {
2682
+ console.log(`${name}/${versionNumber} ${platformInfo}`);
2683
+ }
2684
+ }
2685
+ checkRequiredArgs() {
2686
+ const minimalArgsCount = this.args.filter((arg) => arg.required).length;
2687
+ if (this.cli.args.length < minimalArgsCount) {
2688
+ throw new CACError(`missing required args for command \`${this.rawName}\``);
2689
+ }
2690
+ }
2691
+ checkUnknownOptions() {
2692
+ const { options, globalCommand } = this.cli;
2693
+ if (!this.config.allowUnknownOptions) {
2694
+ for (const name of Object.keys(options)) {
2695
+ if (name !== "--" && !this.hasOption(name) && !globalCommand.hasOption(name)) {
2696
+ throw new CACError(`Unknown option \`${name.length > 1 ? `--${name}` : `-${name}`}\``);
2697
+ }
2698
+ }
2699
+ }
2700
+ }
2701
+ checkOptionValue() {
2702
+ const { options: parsedOptions, globalCommand } = this.cli;
2703
+ const options = [...globalCommand.options, ...this.options];
2704
+ for (const option of options) {
2705
+ const value = parsedOptions[option.name.split(".")[0]];
2706
+ if (option.required) {
2707
+ const hasNegated = options.some((o) => o.negated && o.names.includes(option.name));
2708
+ if (value === true || value === false && !hasNegated) {
2709
+ throw new CACError(`option \`${option.rawName}\` value is missing`);
2710
+ }
2711
+ }
2712
+ }
2713
+ }
2714
+ }
2715
+
2716
+ class GlobalCommand extends Command {
2717
+ constructor(cli) {
2718
+ super("@@global@@", "", {}, cli);
2719
+ }
2720
+ }
2721
+ var __assign = Object.assign;
2722
+
2723
+ class CAC extends EventEmitter {
2724
+ constructor(name = "") {
2725
+ super();
2726
+ this.name = name;
2727
+ this.commands = [];
2728
+ this.rawArgs = [];
2729
+ this.args = [];
2730
+ this.options = {};
2731
+ this.globalCommand = new GlobalCommand(this);
2732
+ this.globalCommand.usage("<command> [options]");
2733
+ }
2734
+ usage(text) {
2735
+ this.globalCommand.usage(text);
2736
+ return this;
2737
+ }
2738
+ command(rawName, description, config) {
2739
+ const command = new Command(rawName, description || "", config, this);
2740
+ command.globalCommand = this.globalCommand;
2741
+ this.commands.push(command);
2742
+ return command;
2743
+ }
2744
+ option(rawName, description, config) {
2745
+ this.globalCommand.option(rawName, description, config);
2746
+ return this;
2747
+ }
2748
+ help(callback) {
2749
+ this.globalCommand.option("-h, --help", "Display this message");
2750
+ this.globalCommand.helpCallback = callback;
2751
+ this.showHelpOnExit = true;
2752
+ return this;
2753
+ }
2754
+ version(version, customFlags = "-v, --version") {
2755
+ this.globalCommand.version(version, customFlags);
2756
+ this.showVersionOnExit = true;
2757
+ return this;
2758
+ }
2759
+ example(example) {
2760
+ this.globalCommand.example(example);
2761
+ return this;
2762
+ }
2763
+ outputHelp() {
2764
+ if (this.matchedCommand) {
2765
+ this.matchedCommand.outputHelp();
2766
+ } else {
2767
+ this.globalCommand.outputHelp();
2768
+ }
2769
+ }
2770
+ outputVersion() {
2771
+ this.globalCommand.outputVersion();
2772
+ }
2773
+ setParsedInfo({ args, options }, matchedCommand, matchedCommandName) {
2774
+ this.args = args;
2775
+ this.options = options;
2776
+ if (matchedCommand) {
2777
+ this.matchedCommand = matchedCommand;
2778
+ }
2779
+ if (matchedCommandName) {
2780
+ this.matchedCommandName = matchedCommandName;
2781
+ }
2782
+ return this;
2783
+ }
2784
+ unsetMatchedCommand() {
2785
+ this.matchedCommand = undefined;
2786
+ this.matchedCommandName = undefined;
2787
+ }
2788
+ parse(argv = processArgs, {
2789
+ run = true
2790
+ } = {}) {
2791
+ this.rawArgs = argv;
2792
+ if (!this.name) {
2793
+ this.name = argv[1] ? getFileName(argv[1]) : "cli";
2794
+ }
2795
+ let shouldParse = true;
2796
+ for (const command of this.commands) {
2797
+ const parsed = this.mri(argv.slice(2), command);
2798
+ const commandName = parsed.args[0];
2799
+ if (command.isMatched(commandName)) {
2800
+ shouldParse = false;
2801
+ const parsedInfo = __assign(__assign({}, parsed), {
2802
+ args: parsed.args.slice(1)
2803
+ });
2804
+ this.setParsedInfo(parsedInfo, command, commandName);
2805
+ this.emit(`command:${commandName}`, command);
2806
+ }
2807
+ }
2808
+ if (shouldParse) {
2809
+ for (const command of this.commands) {
2810
+ if (command.name === "") {
2811
+ shouldParse = false;
2812
+ const parsed = this.mri(argv.slice(2), command);
2813
+ this.setParsedInfo(parsed, command);
2814
+ this.emit(`command:!`, command);
2815
+ }
2816
+ }
2817
+ }
2818
+ if (shouldParse) {
2819
+ const parsed = this.mri(argv.slice(2));
2820
+ this.setParsedInfo(parsed);
2821
+ }
2822
+ if (this.options.help && this.showHelpOnExit) {
2823
+ this.outputHelp();
2824
+ run = false;
2825
+ this.unsetMatchedCommand();
2826
+ }
2827
+ if (this.options.version && this.showVersionOnExit && this.matchedCommandName == null) {
2828
+ this.outputVersion();
2829
+ run = false;
2830
+ this.unsetMatchedCommand();
2831
+ }
2832
+ const parsedArgv = { args: this.args, options: this.options };
2833
+ if (run) {
2834
+ this.runMatchedCommand();
2835
+ }
2836
+ if (!this.matchedCommand && this.args[0]) {
2837
+ this.emit("command:*");
2838
+ }
2839
+ return parsedArgv;
2840
+ }
2841
+ mri(argv, command) {
2842
+ const cliOptions = [
2843
+ ...this.globalCommand.options,
2844
+ ...command ? command.options : []
2845
+ ];
2846
+ const mriOptions = getMriOptions(cliOptions);
2847
+ let argsAfterDoubleDashes = [];
2848
+ const doubleDashesIndex = argv.indexOf("--");
2849
+ if (doubleDashesIndex > -1) {
2850
+ argsAfterDoubleDashes = argv.slice(doubleDashesIndex + 1);
2851
+ argv = argv.slice(0, doubleDashesIndex);
2852
+ }
2853
+ let parsed = mri2(argv, mriOptions);
2854
+ parsed = Object.keys(parsed).reduce((res, name) => {
2855
+ return __assign(__assign({}, res), {
2856
+ [camelcaseOptionName(name)]: parsed[name]
2857
+ });
2858
+ }, { _: [] });
2859
+ const args = parsed._;
2860
+ const options = {
2861
+ "--": argsAfterDoubleDashes
2862
+ };
2863
+ const ignoreDefault = command && command.config.ignoreOptionDefaultValue ? command.config.ignoreOptionDefaultValue : this.globalCommand.config.ignoreOptionDefaultValue;
2864
+ let transforms = Object.create(null);
2865
+ for (const cliOption of cliOptions) {
2866
+ if (!ignoreDefault && cliOption.config.default !== undefined) {
2867
+ for (const name of cliOption.names) {
2868
+ options[name] = cliOption.config.default;
2869
+ }
2870
+ }
2871
+ if (Array.isArray(cliOption.config.type)) {
2872
+ if (transforms[cliOption.name] === undefined) {
2873
+ transforms[cliOption.name] = Object.create(null);
2874
+ transforms[cliOption.name]["shouldTransform"] = true;
2875
+ transforms[cliOption.name]["transformFunction"] = cliOption.config.type[0];
2876
+ }
2877
+ }
2878
+ }
2879
+ for (const key of Object.keys(parsed)) {
2880
+ if (key !== "_") {
2881
+ const keys = key.split(".");
2882
+ setDotProp(options, keys, parsed[key]);
2883
+ setByType(options, transforms);
2884
+ }
2885
+ }
2886
+ return {
2887
+ args,
2888
+ options
2889
+ };
2890
+ }
2891
+ runMatchedCommand() {
2892
+ const { args, options, matchedCommand: command } = this;
2893
+ if (!command || !command.commandAction)
2894
+ return;
2895
+ command.checkUnknownOptions();
2896
+ command.checkOptionValue();
2897
+ command.checkRequiredArgs();
2898
+ const actionArgs = [];
2899
+ command.args.forEach((arg, index) => {
2900
+ if (arg.variadic) {
2901
+ actionArgs.push(args.slice(index));
2902
+ } else {
2903
+ actionArgs.push(args[index]);
2904
+ }
2905
+ });
2906
+ actionArgs.push(options);
2907
+ return command.commandAction.apply(this, actionArgs);
2908
+ }
2909
+ }
2910
+ var cac = (name = "") => new CAC(name);
2911
+
2912
+ // src/index.ts
2913
+ var import_picocolors9 = __toESM(require_picocolors(), 1);
2914
+ // package.json
2915
+ var version = "1.0.0";
2916
+
2917
+ // node_modules/@clack/core/dist/index.mjs
2918
+ var import_sisteransi = __toESM(require_src(), 1);
2919
+ var import_picocolors = __toESM(require_picocolors2(), 1);
2920
+ import { stdin as $, stdout as k } from "node:process";
2921
+ import * as f from "node:readline";
2922
+ import _ from "node:readline";
2923
+ import { WriteStream as U } from "node:tty";
2924
+ function q({ onlyFirst: e = false } = {}) {
2925
+ 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("|");
2926
+ return new RegExp(F, e ? undefined : "g");
2927
+ }
2928
+ var J = q();
2929
+ function S(e) {
2930
+ if (typeof e != "string")
2931
+ throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);
2932
+ return e.replace(J, "");
2933
+ }
2934
+ function T(e) {
2935
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
2936
+ }
2937
+ var j = { exports: {} };
2938
+ (function(e) {
2939
+ var u = {};
2940
+ e.exports = u, u.eastAsianWidth = function(t) {
2941
+ var s = t.charCodeAt(0), C = t.length == 2 ? t.charCodeAt(1) : 0, D = s;
2942
+ return 55296 <= s && s <= 56319 && 56320 <= C && C <= 57343 && (s &= 1023, C &= 1023, D = s << 10 | C, 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";
2943
+ }, u.characterLength = function(t) {
2944
+ var s = this.eastAsianWidth(t);
2945
+ return s == "F" || s == "W" || s == "A" ? 2 : 1;
2946
+ };
2947
+ function F(t) {
2948
+ return t.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
2949
+ }
2950
+ u.length = function(t) {
2951
+ for (var s = F(t), C = 0, D = 0;D < s.length; D++)
2952
+ C = C + this.characterLength(s[D]);
2953
+ return C;
2954
+ }, u.slice = function(t, s, C) {
2955
+ textLen = u.length(t), s = s || 0, C = C || 1, s < 0 && (s = textLen + s), C < 0 && (C = textLen + C);
2956
+ for (var D = "", i = 0, n = F(t), E = 0;E < n.length; E++) {
2957
+ var h = n[E], o = u.length(h);
2958
+ if (i >= s - (o == 2 ? 1 : 0))
2959
+ if (i + o <= C)
2960
+ D += h;
2961
+ else
2962
+ break;
2963
+ i += o;
2964
+ }
2965
+ return D;
2966
+ };
2967
+ })(j);
2968
+ var Q = j.exports;
2969
+ var X = T(Q);
2970
+ var DD = function() {
2971
+ 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;
2972
+ };
2973
+ var uD = T(DD);
2974
+ function A(e, u = {}) {
2975
+ if (typeof e != "string" || e.length === 0 || (u = { ambiguousIsNarrow: true, ...u }, e = S(e), e.length === 0))
2976
+ return 0;
2977
+ e = e.replace(uD(), " ");
2978
+ const F = u.ambiguousIsNarrow ? 1 : 2;
2979
+ let t = 0;
2980
+ for (const s of e) {
2981
+ const C = s.codePointAt(0);
2982
+ if (C <= 31 || C >= 127 && C <= 159 || C >= 768 && C <= 879)
2983
+ continue;
2984
+ switch (X.eastAsianWidth(s)) {
2985
+ case "F":
2986
+ case "W":
2987
+ t += 2;
2988
+ break;
2989
+ case "A":
2990
+ t += F;
2991
+ break;
2992
+ default:
2993
+ t += 1;
2994
+ }
2995
+ }
2996
+ return t;
2997
+ }
2998
+ var d = 10;
2999
+ var M = (e = 0) => (u) => `\x1B[${u + e}m`;
3000
+ var P = (e = 0) => (u) => `\x1B[${38 + e};5;${u}m`;
3001
+ var W = (e = 0) => (u, F, t) => `\x1B[${38 + e};2;${u};${F};${t}m`;
3002
+ var 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] } };
3003
+ Object.keys(r.modifier);
3004
+ var FD = Object.keys(r.color);
3005
+ var eD = Object.keys(r.bgColor);
3006
+ [...FD];
3007
+ function tD() {
3008
+ const e = new Map;
3009
+ for (const [u, F] of Object.entries(r)) {
3010
+ for (const [t, s] of Object.entries(F))
3011
+ r[t] = { open: `\x1B[${s[0]}m`, close: `\x1B[${s[1]}m` }, F[t] = r[t], e.set(s[0], s[1]);
3012
+ Object.defineProperty(r, u, { value: F, enumerable: false });
3013
+ }
3014
+ return Object.defineProperty(r, "codes", { value: e, enumerable: false }), r.color.close = "\x1B[39m", r.bgColor.close = "\x1B[49m", r.color.ansi = M(), r.color.ansi256 = P(), r.color.ansi16m = W(), r.bgColor.ansi = M(d), r.bgColor.ansi256 = P(d), r.bgColor.ansi16m = W(d), Object.defineProperties(r, { rgbToAnsi256: { value: (u, F, t) => u === F && F === t ? 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(t / 255 * 5), enumerable: false }, hexToRgb: { value: (u) => {
3015
+ const F = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));
3016
+ if (!F)
3017
+ return [0, 0, 0];
3018
+ let [t] = F;
3019
+ t.length === 3 && (t = [...t].map((C) => C + C).join(""));
3020
+ const s = Number.parseInt(t, 16);
3021
+ return [s >> 16 & 255, s >> 8 & 255, s & 255];
3022
+ }, enumerable: false }, hexToAnsi256: { value: (u) => r.rgbToAnsi256(...r.hexToRgb(u)), enumerable: false }, ansi256ToAnsi: { value: (u) => {
3023
+ if (u < 8)
3024
+ return 30 + u;
3025
+ if (u < 16)
3026
+ return 90 + (u - 8);
3027
+ let F, t, s;
3028
+ if (u >= 232)
3029
+ F = ((u - 232) * 10 + 8) / 255, t = F, s = F;
3030
+ else {
3031
+ u -= 16;
3032
+ const i = u % 36;
3033
+ F = Math.floor(u / 36) / 5, t = Math.floor(i / 6) / 5, s = i % 6 / 5;
3034
+ }
3035
+ const C = Math.max(F, t, s) * 2;
3036
+ if (C === 0)
3037
+ return 30;
3038
+ let D = 30 + (Math.round(s) << 2 | Math.round(t) << 1 | Math.round(F));
3039
+ return C === 2 && (D += 60), D;
3040
+ }, enumerable: false }, rgbToAnsi: { value: (u, F, t) => r.ansi256ToAnsi(r.rgbToAnsi256(u, F, t)), enumerable: false }, hexToAnsi: { value: (u) => r.ansi256ToAnsi(r.hexToAnsi256(u)), enumerable: false } }), r;
3041
+ }
3042
+ var sD = tD();
3043
+ var g = new Set(["\x1B", "›"]);
3044
+ var CD = 39;
3045
+ var b = "\x07";
3046
+ var O = "[";
3047
+ var iD = "]";
3048
+ var I = "m";
3049
+ var w = `${iD}8;;`;
3050
+ var N = (e) => `${g.values().next().value}${O}${e}${I}`;
3051
+ var L = (e) => `${g.values().next().value}${w}${e}${b}`;
3052
+ var rD = (e) => e.split(" ").map((u) => A(u));
3053
+ var y = (e, u, F) => {
3054
+ const t = [...u];
3055
+ let s = false, C = false, D = A(S(e[e.length - 1]));
3056
+ for (const [i, n] of t.entries()) {
3057
+ const E = A(n);
3058
+ if (D + E <= F ? e[e.length - 1] += n : (e.push(n), D = 0), g.has(n) && (s = true, C = t.slice(i + 1).join("").startsWith(w)), s) {
3059
+ C ? n === b && (s = false, C = false) : n === I && (s = false);
3060
+ continue;
3061
+ }
3062
+ D += E, D === F && i < t.length - 1 && (e.push(""), D = 0);
3063
+ }
3064
+ !D && e[e.length - 1].length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
3065
+ };
3066
+ var ED = (e) => {
3067
+ const u = e.split(" ");
3068
+ let F = u.length;
3069
+ for (;F > 0 && !(A(u[F - 1]) > 0); )
3070
+ F--;
3071
+ return F === u.length ? e : u.slice(0, F).join(" ") + u.slice(F).join("");
3072
+ };
3073
+ var oD = (e, u, F = {}) => {
3074
+ if (F.trim !== false && e.trim() === "")
3075
+ return "";
3076
+ let t = "", s, C;
3077
+ const D = rD(e);
3078
+ let i = [""];
3079
+ for (const [E, h] of e.split(" ").entries()) {
3080
+ F.trim !== false && (i[i.length - 1] = i[i.length - 1].trimStart());
3081
+ let o = A(i[i.length - 1]);
3082
+ if (E !== 0 && (o >= u && (F.wordWrap === false || F.trim === false) && (i.push(""), o = 0), (o > 0 || F.trim === false) && (i[i.length - 1] += " ", o++)), F.hard && D[E] > u) {
3083
+ const B = u - o, p = 1 + Math.floor((D[E] - B - 1) / u);
3084
+ Math.floor((D[E] - 1) / u) < p && i.push(""), y(i, h, u);
3085
+ continue;
3086
+ }
3087
+ if (o + D[E] > u && o > 0 && D[E] > 0) {
3088
+ if (F.wordWrap === false && o < u) {
3089
+ y(i, h, u);
3090
+ continue;
3091
+ }
3092
+ i.push("");
3093
+ }
3094
+ if (o + D[E] > u && F.wordWrap === false) {
3095
+ y(i, h, u);
3096
+ continue;
3097
+ }
3098
+ i[i.length - 1] += h;
3099
+ }
3100
+ F.trim !== false && (i = i.map((E) => ED(E)));
3101
+ const n = [...i.join(`
3102
+ `)];
3103
+ for (const [E, h] of n.entries()) {
3104
+ if (t += h, g.has(h)) {
3105
+ const { groups: B } = new RegExp(`(?:\\${O}(?<code>\\d+)m|\\${w}(?<uri>.*)${b})`).exec(n.slice(E).join("")) || { groups: {} };
3106
+ if (B.code !== undefined) {
3107
+ const p = Number.parseFloat(B.code);
3108
+ s = p === CD ? undefined : p;
3109
+ } else
3110
+ B.uri !== undefined && (C = B.uri.length === 0 ? undefined : B.uri);
3111
+ }
3112
+ const o = sD.codes.get(Number(s));
3113
+ n[E + 1] === `
3114
+ ` ? (C && (t += L("")), s && o && (t += N(o))) : h === `
3115
+ ` && (s && o && (t += N(s)), C && (t += L(C)));
3116
+ }
3117
+ return t;
3118
+ };
3119
+ function R(e, u, F) {
3120
+ return String(e).normalize().replace(/\r\n/g, `
3121
+ `).split(`
3122
+ `).map((t) => oD(t, u, F)).join(`
3123
+ `);
3124
+ }
3125
+ var nD = Object.defineProperty;
3126
+ var aD = (e, u, F) => (u in e) ? nD(e, u, { enumerable: true, configurable: true, writable: true, value: F }) : e[u] = F;
3127
+ var a = (e, u, F) => (aD(e, typeof u != "symbol" ? u + "" : u, F), F);
3128
+ function hD(e, u) {
3129
+ if (e === u)
3130
+ return;
3131
+ const F = e.split(`
3132
+ `), t = u.split(`
3133
+ `), s = [];
3134
+ for (let C = 0;C < Math.max(F.length, t.length); C++)
3135
+ F[C] !== t[C] && s.push(C);
3136
+ return s;
3137
+ }
3138
+ var V = Symbol("clack:cancel");
3139
+ function lD(e) {
3140
+ return e === V;
3141
+ }
3142
+ function v(e, u) {
3143
+ e.isTTY && e.setRawMode(u);
3144
+ }
3145
+ var z = new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"]]);
3146
+ var xD = new Set(["up", "down", "left", "right", "space", "enter"]);
3147
+
3148
+ class x {
3149
+ constructor({ render: u, input: F = $, output: t = k, ...s }, C = true) {
3150
+ a(this, "input"), a(this, "output"), a(this, "rl"), a(this, "opts"), a(this, "_track", false), a(this, "_render"), a(this, "_cursor", 0), a(this, "state", "initial"), a(this, "value"), a(this, "error", ""), a(this, "subscribers", new Map), a(this, "_prevFrame", ""), this.opts = s, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = u.bind(this), this._track = C, this.input = F, this.output = t;
3151
+ }
3152
+ prompt() {
3153
+ const u = new U(0);
3154
+ return u._write = (F, t, s) => {
3155
+ this._track && (this.value = this.rl.line.replace(/\t/g, ""), this._cursor = this.rl.cursor, this.emit("value", this.value)), s();
3156
+ }, this.input.pipe(u), this.rl = _.createInterface({ input: this.input, output: u, tabSize: 2, prompt: "", escapeCodeTimeout: 50 }), _.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), v(this.input, true), this.output.on("resize", this.render), this.render(), new Promise((F, t) => {
3157
+ this.once("submit", () => {
3158
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), v(this.input, false), F(this.value);
3159
+ }), this.once("cancel", () => {
3160
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), v(this.input, false), F(V);
3161
+ });
3162
+ });
3163
+ }
3164
+ on(u, F) {
3165
+ const t = this.subscribers.get(u) ?? [];
3166
+ t.push({ cb: F }), this.subscribers.set(u, t);
3167
+ }
3168
+ once(u, F) {
3169
+ const t = this.subscribers.get(u) ?? [];
3170
+ t.push({ cb: F, once: true }), this.subscribers.set(u, t);
3171
+ }
3172
+ emit(u, ...F) {
3173
+ const t = this.subscribers.get(u) ?? [], s = [];
3174
+ for (const C of t)
3175
+ C.cb(...F), C.once && s.push(() => t.splice(t.indexOf(C), 1));
3176
+ for (const C of s)
3177
+ C();
3178
+ }
3179
+ unsubscribe() {
3180
+ this.subscribers.clear();
3181
+ }
3182
+ onKeypress(u, F) {
3183
+ if (this.state === "error" && (this.state = "active"), F?.name && !this._track && z.has(F.name) && this.emit("cursor", z.get(F.name)), F?.name && xD.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") {
3184
+ if (this.opts.validate) {
3185
+ const t = this.opts.validate(this.value);
3186
+ t && (this.error = t, this.state = "error", this.rl.write(this.value));
3187
+ }
3188
+ this.state !== "error" && (this.state = "submit");
3189
+ }
3190
+ u === "\x03" && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
3191
+ }
3192
+ close() {
3193
+ this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
3194
+ `), v(this.input, false), this.rl.close(), this.emit(`${this.state}`, this.value), this.unsubscribe();
3195
+ }
3196
+ restoreCursor() {
3197
+ const u = R(this._prevFrame, process.stdout.columns, { hard: true }).split(`
3198
+ `).length - 1;
3199
+ this.output.write(import_sisteransi.cursor.move(-999, u * -1));
3200
+ }
3201
+ render() {
3202
+ const u = R(this._render(this) ?? "", process.stdout.columns, { hard: true });
3203
+ if (u !== this._prevFrame) {
3204
+ if (this.state === "initial")
3205
+ this.output.write(import_sisteransi.cursor.hide);
3206
+ else {
3207
+ const F = hD(this._prevFrame, u);
3208
+ if (this.restoreCursor(), F && F?.length === 1) {
3209
+ const t = F[0];
3210
+ this.output.write(import_sisteransi.cursor.move(0, t)), this.output.write(import_sisteransi.erase.lines(1));
3211
+ const s = u.split(`
3212
+ `);
3213
+ this.output.write(s[t]), this._prevFrame = u, this.output.write(import_sisteransi.cursor.move(0, s.length - t - 1));
3214
+ return;
3215
+ } else if (F && F?.length > 1) {
3216
+ const t = F[0];
3217
+ this.output.write(import_sisteransi.cursor.move(0, t)), this.output.write(import_sisteransi.erase.down());
3218
+ const s = u.split(`
3219
+ `).slice(t);
3220
+ this.output.write(s.join(`
3221
+ `)), this._prevFrame = u;
3222
+ return;
3223
+ }
3224
+ this.output.write(import_sisteransi.erase.down());
3225
+ }
3226
+ this.output.write(u), this.state === "initial" && (this.state = "active"), this._prevFrame = u;
3227
+ }
3228
+ }
3229
+ }
3230
+
3231
+ class BD extends x {
3232
+ get cursor() {
3233
+ return this.value ? 0 : 1;
3234
+ }
3235
+ get _value() {
3236
+ return this.cursor === 0;
3237
+ }
3238
+ constructor(u) {
3239
+ super(u, false), this.value = !!u.initialValue, this.on("value", () => {
3240
+ this.value = this._value;
3241
+ }), this.on("confirm", (F) => {
3242
+ this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = F, this.state = "submit", this.close();
3243
+ }), this.on("cursor", () => {
3244
+ this.value = !this.value;
3245
+ });
3246
+ }
3247
+ }
3248
+ var wD = Object.defineProperty;
3249
+ var yD = (e, u, F) => (u in e) ? wD(e, u, { enumerable: true, configurable: true, writable: true, value: F }) : e[u] = F;
3250
+ var Z = (e, u, F) => (yD(e, typeof u != "symbol" ? u + "" : u, F), F);
3251
+ var $D = class extends x {
3252
+ constructor(u) {
3253
+ super(u, false), Z(this, "options"), Z(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) => {
3254
+ switch (F) {
3255
+ case "left":
3256
+ case "up":
3257
+ this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
3258
+ break;
3259
+ case "down":
3260
+ case "right":
3261
+ this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
3262
+ break;
3263
+ }
3264
+ this.changeValue();
3265
+ });
3266
+ }
3267
+ get _value() {
3268
+ return this.options[this.cursor];
3269
+ }
3270
+ changeValue() {
3271
+ this.value = this._value.value;
3272
+ }
3273
+ };
3274
+ var TD = Object.defineProperty;
3275
+ var jD = (e, u, F) => (u in e) ? TD(e, u, { enumerable: true, configurable: true, writable: true, value: F }) : e[u] = F;
3276
+ var MD = (e, u, F) => (jD(e, typeof u != "symbol" ? u + "" : u, F), F);
3277
+
3278
+ class PD extends x {
3279
+ constructor(u) {
3280
+ super(u), MD(this, "valueWithCursor", ""), this.on("finalize", () => {
3281
+ this.value || (this.value = u.defaultValue), this.valueWithCursor = this.value;
3282
+ }), this.on("value", () => {
3283
+ if (this.cursor >= this.value.length)
3284
+ this.valueWithCursor = `${this.value}${import_picocolors.default.inverse(import_picocolors.default.hidden("_"))}`;
3285
+ else {
3286
+ const F = this.value.slice(0, this.cursor), t = this.value.slice(this.cursor);
3287
+ this.valueWithCursor = `${F}${import_picocolors.default.inverse(t[0])}${t.slice(1)}`;
3288
+ }
3289
+ });
3290
+ }
3291
+ get cursor() {
3292
+ return this._cursor;
3293
+ }
3294
+ }
3295
+ var WD = globalThis.process.platform.startsWith("win");
3296
+ function OD({ input: e = $, output: u = k, overwrite: F = true, hideCursor: t = true } = {}) {
3297
+ const s = f.createInterface({ input: e, output: u, prompt: "", tabSize: 1 });
3298
+ f.emitKeypressEvents(e, s), e.isTTY && e.setRawMode(true);
3299
+ const C = (D, { name: i }) => {
3300
+ if (String(D) === "\x03") {
3301
+ t && u.write(import_sisteransi.cursor.show), process.exit(0);
3302
+ return;
3303
+ }
3304
+ if (!F)
3305
+ return;
3306
+ let n = i === "return" ? 0 : -1, E = i === "return" ? -1 : 0;
3307
+ f.moveCursor(u, n, E, () => {
3308
+ f.clearLine(u, 1, () => {
3309
+ e.once("keypress", C);
3310
+ });
3311
+ });
3312
+ };
3313
+ return t && u.write(import_sisteransi.cursor.hide), e.once("keypress", C), () => {
3314
+ e.off("keypress", C), t && u.write(import_sisteransi.cursor.show), e.isTTY && !WD && e.setRawMode(false), s.terminal = false, s.close();
3315
+ };
3316
+ }
3317
+
3318
+ // node_modules/@clack/prompts/dist/index.mjs
3319
+ var import_picocolors2 = __toESM(require_picocolors2(), 1);
3320
+ var import_sisteransi2 = __toESM(require_src(), 1);
3321
+ import h from "node:process";
3322
+ function q2() {
3323
+ return h.platform !== "win32" ? h.env.TERM !== "linux" : Boolean(h.env.CI) || Boolean(h.env.WT_SESSION) || Boolean(h.env.TERMINUS_SUBLIME) || h.env.ConEmuTask === "{cmd::Cmder}" || h.env.TERM_PROGRAM === "Terminus-Sublime" || h.env.TERM_PROGRAM === "vscode" || h.env.TERM === "xterm-256color" || h.env.TERM === "alacritty" || h.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
3324
+ }
3325
+ var _2 = q2();
3326
+ var o = (r2, n) => _2 ? r2 : n;
3327
+ var H = o("◆", "*");
3328
+ var I2 = o("■", "x");
3329
+ var x2 = o("▲", "x");
3330
+ var S2 = o("◇", "o");
3331
+ var K = o("┌", "T");
3332
+ var a2 = o("│", "|");
3333
+ var d2 = o("└", "—");
3334
+ var b2 = o("●", ">");
3335
+ var E = o("○", " ");
3336
+ var C = o("◻", "[•]");
3337
+ var w2 = o("◼", "[+]");
3338
+ var M2 = o("◻", "[ ]");
3339
+ var U2 = o("▪", "•");
3340
+ var B = o("─", "-");
3341
+ var Z2 = o("╮", "+");
3342
+ var z2 = o("├", "+");
3343
+ var X2 = o("╯", "+");
3344
+ var J2 = o("●", "•");
3345
+ var Y = o("◆", "*");
3346
+ var Q2 = o("▲", "!");
3347
+ var ee = o("■", "x");
3348
+ var y2 = (r2) => {
3349
+ switch (r2) {
3350
+ case "initial":
3351
+ case "active":
3352
+ return import_picocolors2.default.cyan(H);
3353
+ case "cancel":
3354
+ return import_picocolors2.default.red(I2);
3355
+ case "error":
3356
+ return import_picocolors2.default.yellow(x2);
3357
+ case "submit":
3358
+ return import_picocolors2.default.green(S2);
3359
+ }
3360
+ };
3361
+ var te = (r2) => new PD({ validate: r2.validate, placeholder: r2.placeholder, defaultValue: r2.defaultValue, initialValue: r2.initialValue, render() {
3362
+ const n = `${import_picocolors2.default.gray(a2)}
3363
+ ${y2(this.state)} ${r2.message}
3364
+ `, i = r2.placeholder ? import_picocolors2.default.inverse(r2.placeholder[0]) + import_picocolors2.default.dim(r2.placeholder.slice(1)) : import_picocolors2.default.inverse(import_picocolors2.default.hidden("_")), t = this.value ? this.valueWithCursor : i;
3365
+ switch (this.state) {
3366
+ case "error":
3367
+ return `${n.trim()}
3368
+ ${import_picocolors2.default.yellow(a2)} ${t}
3369
+ ${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(this.error)}
3370
+ `;
3371
+ case "submit":
3372
+ return `${n}${import_picocolors2.default.gray(a2)} ${import_picocolors2.default.dim(this.value || r2.placeholder)}`;
3373
+ case "cancel":
3374
+ return `${n}${import_picocolors2.default.gray(a2)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(this.value ?? ""))}${this.value?.trim() ? `
3375
+ ` + import_picocolors2.default.gray(a2) : ""}`;
3376
+ default:
3377
+ return `${n}${import_picocolors2.default.cyan(a2)} ${t}
3378
+ ${import_picocolors2.default.cyan(d2)}
3379
+ `;
3380
+ }
3381
+ } }).prompt();
3382
+ var se = (r2) => {
3383
+ const n = r2.active ?? "Yes", i = r2.inactive ?? "No";
3384
+ return new BD({ active: n, inactive: i, initialValue: r2.initialValue ?? true, render() {
3385
+ const t = `${import_picocolors2.default.gray(a2)}
3386
+ ${y2(this.state)} ${r2.message}
3387
+ `, s = this.value ? n : i;
3388
+ switch (this.state) {
3389
+ case "submit":
3390
+ return `${t}${import_picocolors2.default.gray(a2)} ${import_picocolors2.default.dim(s)}`;
3391
+ case "cancel":
3392
+ return `${t}${import_picocolors2.default.gray(a2)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}
3393
+ ${import_picocolors2.default.gray(a2)}`;
3394
+ default:
3395
+ return `${t}${import_picocolors2.default.cyan(a2)} ${this.value ? `${import_picocolors2.default.green(b2)} ${n}` : `${import_picocolors2.default.dim(E)} ${import_picocolors2.default.dim(n)}`} ${import_picocolors2.default.dim("/")} ${this.value ? `${import_picocolors2.default.dim(E)} ${import_picocolors2.default.dim(i)}` : `${import_picocolors2.default.green(b2)} ${i}`}
3396
+ ${import_picocolors2.default.cyan(d2)}
3397
+ `;
3398
+ }
3399
+ } }).prompt();
3400
+ };
3401
+ var ie = (r2) => {
3402
+ const n = (t, s) => {
3403
+ const c2 = t.label ?? String(t.value);
3404
+ return s === "active" ? `${import_picocolors2.default.green(b2)} ${c2} ${t.hint ? import_picocolors2.default.dim(`(${t.hint})`) : ""}` : s === "selected" ? `${import_picocolors2.default.dim(c2)}` : s === "cancelled" ? `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(c2))}` : `${import_picocolors2.default.dim(E)} ${import_picocolors2.default.dim(c2)}`;
3405
+ };
3406
+ let i = 0;
3407
+ return new $D({ options: r2.options, initialValue: r2.initialValue, render() {
3408
+ const t = `${import_picocolors2.default.gray(a2)}
3409
+ ${y2(this.state)} ${r2.message}
3410
+ `;
3411
+ switch (this.state) {
3412
+ case "submit":
3413
+ return `${t}${import_picocolors2.default.gray(a2)} ${n(this.options[this.cursor], "selected")}`;
3414
+ case "cancel":
3415
+ return `${t}${import_picocolors2.default.gray(a2)} ${n(this.options[this.cursor], "cancelled")}
3416
+ ${import_picocolors2.default.gray(a2)}`;
3417
+ default: {
3418
+ const s = r2.maxItems === undefined ? 1 / 0 : Math.max(r2.maxItems, 5);
3419
+ this.cursor >= i + s - 3 ? i = Math.max(Math.min(this.cursor - s + 3, this.options.length - s), 0) : this.cursor < i + 2 && (i = Math.max(this.cursor - 2, 0));
3420
+ const c2 = s < this.options.length && i > 0, l2 = s < this.options.length && i + s < this.options.length;
3421
+ return `${t}${import_picocolors2.default.cyan(a2)} ${this.options.slice(i, i + s).map((u, m2, $2) => m2 === 0 && c2 ? import_picocolors2.default.dim("...") : m2 === $2.length - 1 && l2 ? import_picocolors2.default.dim("...") : n(u, m2 + i === this.cursor ? "active" : "inactive")).join(`
3422
+ ${import_picocolors2.default.cyan(a2)} `)}
3423
+ ${import_picocolors2.default.cyan(d2)}
3424
+ `;
3425
+ }
3426
+ }
3427
+ } }).prompt();
3428
+ };
3429
+ var R2 = (r2) => r2.replace(me(), "");
3430
+ var le = (r2 = "", n = "") => {
3431
+ const i = `
3432
+ ${r2}
3433
+ `.split(`
3434
+ `), t = R2(n).length, s = Math.max(i.reduce((l2, u) => (u = R2(u), u.length > l2 ? u.length : l2), 0), t) + 2, c2 = i.map((l2) => `${import_picocolors2.default.gray(a2)} ${import_picocolors2.default.dim(l2)}${" ".repeat(s - R2(l2).length)}${import_picocolors2.default.gray(a2)}`).join(`
3435
+ `);
3436
+ process.stdout.write(`${import_picocolors2.default.gray(a2)}
3437
+ ${import_picocolors2.default.green(S2)} ${import_picocolors2.default.reset(n)} ${import_picocolors2.default.gray(B.repeat(Math.max(s - t - 1, 1)) + Z2)}
3438
+ ${c2}
3439
+ ${import_picocolors2.default.gray(z2 + B.repeat(s + 2) + X2)}
3440
+ `);
3441
+ };
3442
+ var ue = (r2 = "") => {
3443
+ process.stdout.write(`${import_picocolors2.default.gray(d2)} ${import_picocolors2.default.red(r2)}
3444
+
3445
+ `);
3446
+ };
3447
+ var oe = (r2 = "") => {
3448
+ process.stdout.write(`${import_picocolors2.default.gray(K)} ${r2}
3449
+ `);
3450
+ };
3451
+ var $e = (r2 = "") => {
3452
+ process.stdout.write(`${import_picocolors2.default.gray(a2)}
3453
+ ${import_picocolors2.default.gray(d2)} ${r2}
3454
+
3455
+ `);
3456
+ };
3457
+ var de = () => {
3458
+ const r2 = _2 ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"], n = _2 ? 80 : 120;
3459
+ let i, t, s = false, c2 = "";
3460
+ const l2 = (v2 = "") => {
3461
+ s = true, i = OD(), c2 = v2.replace(/\.+$/, ""), process.stdout.write(`${import_picocolors2.default.gray(a2)}
3462
+ `);
3463
+ let g2 = 0, p = 0;
3464
+ t = setInterval(() => {
3465
+ const O2 = import_picocolors2.default.magenta(r2[g2]), P2 = ".".repeat(Math.floor(p)).slice(0, 3);
3466
+ process.stdout.write(import_sisteransi2.cursor.move(-999, 0)), process.stdout.write(import_sisteransi2.erase.down(1)), process.stdout.write(`${O2} ${c2}${P2}`), g2 = g2 + 1 < r2.length ? g2 + 1 : 0, p = p < r2.length ? p + 0.125 : 0;
3467
+ }, n);
3468
+ }, u = (v2 = "", g2 = 0) => {
3469
+ c2 = v2 ?? c2, s = false, clearInterval(t);
3470
+ const p = g2 === 0 ? import_picocolors2.default.green(S2) : g2 === 1 ? import_picocolors2.default.red(I2) : import_picocolors2.default.red(x2);
3471
+ process.stdout.write(import_sisteransi2.cursor.move(-999, 0)), process.stdout.write(import_sisteransi2.erase.down(1)), process.stdout.write(`${p} ${c2}
3472
+ `), i();
3473
+ }, m2 = (v2 = "") => {
3474
+ c2 = v2 ?? c2;
3475
+ }, $2 = (v2) => {
3476
+ const g2 = v2 > 1 ? "Something went wrong" : "Canceled";
3477
+ s && u(g2, v2);
3478
+ };
3479
+ return process.on("uncaughtExceptionMonitor", () => $2(2)), process.on("unhandledRejection", () => $2(2)), process.on("SIGINT", () => $2(1)), process.on("SIGTERM", () => $2(1)), process.on("exit", $2), { start: l2, stop: u, message: m2 };
3480
+ };
3481
+ function me() {
3482
+ const r2 = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
3483
+ return new RegExp(r2, "g");
3484
+ }
3485
+ var he = async (r2, n) => {
3486
+ const i = {}, t = Object.keys(r2);
3487
+ for (const s of t) {
3488
+ const c2 = r2[s], l2 = await c2({ results: i })?.catch((u) => {
3489
+ throw u;
3490
+ });
3491
+ if (typeof n?.onCancel == "function" && lD(l2)) {
3492
+ i[s] = "canceled", n.onCancel({ results: i });
3493
+ continue;
3494
+ }
3495
+ i[s] = l2;
3496
+ }
3497
+ return i;
3498
+ };
3499
+
3500
+ // src/commands/new.ts
3501
+ var import_picocolors4 = __toESM(require_picocolors2(), 1);
3502
+ import path3 from "path";
3503
+
3504
+ // src/shared/logger.ts
3505
+ var import_picocolors3 = __toESM(require_picocolors2(), 1);
3506
+
3507
+ class Logger {
3508
+ verbose = false;
3509
+ setVerbose(enabled) {
3510
+ this.verbose = enabled;
3511
+ }
3512
+ isVerbose() {
3513
+ return this.verbose;
3514
+ }
3515
+ info(message) {
3516
+ console.log(import_picocolors3.default.blue("ℹ"), message);
3517
+ }
3518
+ success(message) {
3519
+ console.log(import_picocolors3.default.green("✓"), message);
3520
+ }
3521
+ warn(message) {
3522
+ console.log(import_picocolors3.default.yellow("⚠"), message);
3523
+ }
3524
+ error(message) {
3525
+ console.error(import_picocolors3.default.red("✗"), message);
3526
+ }
3527
+ debug(message, data) {
3528
+ if (this.verbose) {
3529
+ console.log(import_picocolors3.default.dim(`[DEBUG] ${message}`));
3530
+ if (data) {
3531
+ console.log(import_picocolors3.default.dim(JSON.stringify(data, null, 2)));
3532
+ }
3533
+ }
3534
+ }
3535
+ verbose(message, data) {
3536
+ if (this.verbose) {
3537
+ console.log(import_picocolors3.default.cyan(`[VERBOSE] ${message}`));
3538
+ if (data) {
3539
+ console.log(import_picocolors3.default.dim(JSON.stringify(data, null, 2)));
3540
+ }
3541
+ }
3542
+ }
3543
+ step(step, total, message) {
3544
+ console.log(import_picocolors3.default.dim(`[${step}/${total}]`), message);
3545
+ }
3546
+ header(title) {
3547
+ console.log();
3548
+ console.log(import_picocolors3.default.bold(import_picocolors3.default.cyan(`━━━ ${title} ━━━`)));
3549
+ console.log();
3550
+ }
3551
+ table(rows) {
3552
+ const maxKey = Math.max(...rows.map(([k2]) => k2.length));
3553
+ for (const [key, value] of rows) {
3554
+ console.log(` ${import_picocolors3.default.dim(key.padEnd(maxKey))} ${value}`);
3555
+ }
3556
+ }
3557
+ }
3558
+ var logger = new Logger;
3559
+
3560
+ // src/shared/constants.ts
3561
+ var MOVEMENTKIT_CONFIG = {
3562
+ github: {
3563
+ owner: "phatdev-hehe",
3564
+ repo: "movementkit-engineer",
3565
+ branch: "main"
3566
+ },
3567
+ kits: ["engineer"],
3568
+ defaultKit: "engineer",
3569
+ configDir: ".movementkit",
3570
+ configFile: "config.json",
3571
+ cacheTTL: 3600,
3572
+ protectedPatterns: [
3573
+ ".env",
3574
+ ".env.local",
3575
+ ".env.*.local",
3576
+ "*.key",
3577
+ "*.pem",
3578
+ "node_modules/**",
3579
+ ".git/**",
3580
+ "dist/**",
3581
+ "build/**"
3582
+ ],
3583
+ movement: {
3584
+ mainnet: {
3585
+ fullnode: "https://full.mainnet.movementinfra.xyz/v1",
3586
+ chainId: 126
3587
+ },
3588
+ testnet: {
3589
+ fullnode: "https://full.testnet.movementinfra.xyz/v1",
3590
+ chainId: 250
3591
+ },
3592
+ faucet: "https://faucet.movementnetwork.xyz/",
3593
+ explorer: "https://explorer.movementnetwork.xyz/"
3594
+ }
3595
+ };
3596
+
3597
+ // src/shared/fs-utils.ts
3598
+ var import_fs_extra = __toESM(require_lib(), 1);
3599
+ import path from "path";
3600
+ async function ensureDir(dirPath) {
3601
+ await import_fs_extra.default.ensureDir(dirPath);
3602
+ }
3603
+ async function pathExists(filePath) {
3604
+ return import_fs_extra.default.pathExists(filePath);
3605
+ }
3606
+ async function remove(filePath) {
3607
+ await import_fs_extra.default.remove(filePath);
3608
+ }
3609
+ async function isMovementKitProject(dir) {
3610
+ const claudeMdPath = path.join(dir, "CLAUDE.md");
3611
+ const contractsPath = path.join(dir, "contracts");
3612
+ const hasClaudeMd = await pathExists(claudeMdPath);
3613
+ const hasContracts = await pathExists(contractsPath);
3614
+ return hasClaudeMd && hasContracts;
3615
+ }
3616
+
3617
+ // src/domains/download/download-kit.ts
3618
+ var import_fs_extra2 = __toESM(require_lib(), 1);
3619
+ import path2 from "path";
3620
+ var __dirname = "/Users/henrypham/Desktop/movement-kit/movementkit-cli/src/domains/download";
3621
+ async function downloadKit(kit, targetPath, options = {}) {
3622
+ logger.debug(`Downloading kit: ${kit} to ${targetPath}`);
3623
+ if (options.fresh) {
3624
+ const claudeDir = path2.join(targetPath, ".claude");
3625
+ if (await pathExists(claudeDir)) {
3626
+ await remove(claudeDir);
3627
+ logger.debug("Removed existing .claude directory");
3628
+ }
3629
+ }
3630
+ await ensureDir(targetPath);
3631
+ const sourceDir = getKitSourcePath(kit);
3632
+ if (!await pathExists(sourceDir)) {
3633
+ throw new Error(`Kit source not found: ${sourceDir}. Run from the movement-kit repository.`);
3634
+ }
3635
+ await copyKitFiles(sourceDir, targetPath);
3636
+ logger.debug("Kit installation complete");
3637
+ }
3638
+ function getKitSourcePath(kit) {
3639
+ const devPath = path2.resolve(__dirname, "../../../../movementkit-engineer");
3640
+ const cwdPath = path2.resolve(process.cwd(), "../movementkit-engineer");
3641
+ if (import_fs_extra2.default.existsSync(devPath)) {
3642
+ return devPath;
3643
+ }
3644
+ if (import_fs_extra2.default.existsSync(cwdPath)) {
3645
+ return cwdPath;
3646
+ }
3647
+ return path2.join(process.env.HOME || "", ".movementkit", "kits", kit);
3648
+ }
3649
+ async function copyKitFiles(sourceDir, targetPath) {
3650
+ const items = ["CLAUDE.md", "backend", "contracts", "docs", "frontend", "plans", "templates"];
3651
+ for (const item of items) {
3652
+ const sourcePath = path2.join(sourceDir, item);
3653
+ const destPath = path2.join(targetPath, item);
3654
+ if (await pathExists(sourcePath)) {
3655
+ await import_fs_extra2.default.copy(sourcePath, destPath, {
3656
+ overwrite: true,
3657
+ filter: (src) => {
3658
+ const basename = path2.basename(src);
3659
+ return basename !== "node_modules" && basename !== ".git";
3660
+ }
3661
+ });
3662
+ logger.debug(`Copied: ${item}`);
3663
+ }
3664
+ }
3665
+ }
3666
+
3667
+ // src/commands/new.ts
3668
+ function newCommand(cli) {
3669
+ cli.command("new", "Create a new Movement Kit project").option("--dir <dir>", "Target directory for the new project").option("--kit <kit>", "Kit to use (engineer)", { default: "engineer" }).option("-y, --yes", "Skip prompts and use defaults").action(async (options) => {
3670
+ await runNew(options);
3671
+ });
3672
+ }
3673
+ async function runNew(options) {
3674
+ console.log();
3675
+ oe(import_picocolors4.default.cyan(import_picocolors4.default.bold("\uD83D\uDE80 Create New Movement Kit Project")));
3676
+ let projectDir = options.dir;
3677
+ let kit = options.kit || MOVEMENTKIT_CONFIG.defaultKit;
3678
+ if (!options.yes) {
3679
+ const answers = await he({
3680
+ projectName: () => te({
3681
+ message: "Project name:",
3682
+ placeholder: "my-movement-dapp",
3683
+ defaultValue: "my-movement-dapp",
3684
+ validate: (value) => {
3685
+ if (!value)
3686
+ return "Project name is required";
3687
+ if (!/^[a-z0-9-_]+$/i.test(value)) {
3688
+ return "Project name can only contain letters, numbers, hyphens, and underscores";
3689
+ }
3690
+ }
3691
+ }),
3692
+ kit: () => ie({
3693
+ message: "Select kit:",
3694
+ options: MOVEMENTKIT_CONFIG.kits.map((k2) => ({
3695
+ value: k2,
3696
+ label: k2 === "engineer" ? "Engineer Kit - Full dApp development" : k2
3697
+ })),
3698
+ initialValue: kit
3699
+ })
3700
+ }, {
3701
+ onCancel: () => {
3702
+ ue("Operation cancelled");
3703
+ process.exit(0);
3704
+ }
3705
+ });
3706
+ projectDir = answers.projectName;
3707
+ kit = answers.kit;
3708
+ }
3709
+ if (!projectDir) {
3710
+ projectDir = "my-movement-dapp";
3711
+ }
3712
+ const targetPath = path3.resolve(process.cwd(), projectDir);
3713
+ if (await pathExists(targetPath)) {
3714
+ const overwrite = await se({
3715
+ message: `Directory ${projectDir} already exists. Overwrite?`,
3716
+ initialValue: false
3717
+ });
3718
+ if (!overwrite || lD(overwrite)) {
3719
+ ue("Operation cancelled");
3720
+ process.exit(0);
3721
+ }
3722
+ }
3723
+ const spinner = de();
3724
+ try {
3725
+ spinner.start("Creating project directory...");
3726
+ await ensureDir(targetPath);
3727
+ spinner.stop("Project directory created");
3728
+ spinner.start(`Downloading Movement Kit (${kit})...`);
3729
+ await downloadKit(kit, targetPath);
3730
+ spinner.stop("Kit downloaded successfully");
3731
+ console.log();
3732
+ le(`${import_picocolors4.default.green("Project created successfully!")}
3733
+
3734
+ ` + `Next steps:
3735
+ ` + ` ${import_picocolors4.default.cyan(`cd ${projectDir}`)}
3736
+ ` + ` ${import_picocolors4.default.cyan("# Install backend dependencies")}
3737
+ ` + ` ${import_picocolors4.default.cyan("cd backend && npm install")}
3738
+ ` + ` ${import_picocolors4.default.cyan("# Install frontend dependencies")}
3739
+ ` + ` ${import_picocolors4.default.cyan("cd ../frontend && npm install")}
3740
+
3741
+ ` + `Start building:
3742
+ ` + ` ${import_picocolors4.default.cyan("/plan")} - Create architecture plan
3743
+ ` + ` ${import_picocolors4.default.cyan("/cook")} - Generate dApp code
3744
+ ` + ` ${import_picocolors4.default.cyan("/test")} - Run tests
3745
+ ` + ` ${import_picocolors4.default.cyan("/deploy-full")} - Deploy to Movement`, "\uD83C\uDF89 Success!");
3746
+ $e(import_picocolors4.default.green("Happy building on Movement! \uD83D\uDE80"));
3747
+ } catch (error) {
3748
+ spinner.stop("Failed");
3749
+ if (error instanceof Error) {
3750
+ logger.error(error.message);
3751
+ }
3752
+ process.exit(1);
3753
+ }
3754
+ }
3755
+
3756
+ // src/commands/init.ts
3757
+ var import_picocolors5 = __toESM(require_picocolors2(), 1);
3758
+ import path4 from "path";
3759
+ function initCommand(cli) {
3760
+ cli.command("init", "Initialize or update Movement Kit in current project").option("--kit <kit>", "Kit to use (engineer)", { default: "engineer" }).option("-y, --yes", "Skip prompts and use defaults").option("-g, --global", "Install globally to ~/.claude").option("--fresh", "Fresh install (removes existing .claude directory)").action(async (options) => {
3761
+ await runInit(options);
3762
+ });
3763
+ }
3764
+ async function runInit(options) {
3765
+ console.log();
3766
+ oe(import_picocolors5.default.cyan(import_picocolors5.default.bold("\uD83D\uDD27 Initialize Movement Kit")));
3767
+ const targetPath = options.global ? path4.join(process.env.HOME || "", ".claude") : process.cwd();
3768
+ let kit = options.kit || MOVEMENTKIT_CONFIG.defaultKit;
3769
+ const isExisting = await isMovementKitProject(targetPath);
3770
+ if (isExisting && !options.fresh) {
3771
+ logger.info("Existing Movement Kit project detected. Updating...");
3772
+ }
3773
+ if (!options.yes) {
3774
+ const answers = await he({
3775
+ kit: () => ie({
3776
+ message: "Select kit to install:",
3777
+ options: MOVEMENTKIT_CONFIG.kits.map((k2) => ({
3778
+ value: k2,
3779
+ label: k2 === "engineer" ? "Engineer Kit - Full dApp development" : k2
3780
+ })),
3781
+ initialValue: kit
3782
+ }),
3783
+ confirm: () => se({
3784
+ message: options.global ? `Install globally to ${targetPath}?` : `Initialize in ${targetPath}?`,
3785
+ initialValue: true
3786
+ })
3787
+ }, {
3788
+ onCancel: () => {
3789
+ ue("Operation cancelled");
3790
+ process.exit(0);
3791
+ }
3792
+ });
3793
+ if (!answers.confirm) {
3794
+ ue("Operation cancelled");
3795
+ process.exit(0);
3796
+ }
3797
+ kit = answers.kit;
3798
+ }
3799
+ if (options.fresh && isExisting) {
3800
+ const confirmFresh = await se({
3801
+ message: import_picocolors5.default.yellow("⚠️ Fresh install will remove ALL customizations. Continue?"),
3802
+ initialValue: false
3803
+ });
3804
+ if (!confirmFresh || lD(confirmFresh)) {
3805
+ ue("Operation cancelled");
3806
+ process.exit(0);
3807
+ }
3808
+ }
3809
+ const spinner = de();
3810
+ try {
3811
+ spinner.start(`Installing Movement Kit (${kit})...`);
3812
+ await downloadKit(kit, targetPath, { fresh: options.fresh });
3813
+ spinner.stop("Movement Kit installed successfully");
3814
+ console.log();
3815
+ le(`${import_picocolors5.default.green("Movement Kit initialized!")}
3816
+
3817
+ ` + `Available commands:
3818
+ ` + ` ${import_picocolors5.default.cyan("/plan")} - Create architecture plan
3819
+ ` + ` ${import_picocolors5.default.cyan("/cook")} - Generate dApp code
3820
+ ` + ` ${import_picocolors5.default.cyan("/cook:contracts")} - Generate Move contracts
3821
+ ` + ` ${import_picocolors5.default.cyan("/cook:backend")} - Generate backend
3822
+ ` + ` ${import_picocolors5.default.cyan("/cook:frontend")} - Generate frontend
3823
+ ` + ` ${import_picocolors5.default.cyan("/test")} - Run tests
3824
+ ` + ` ${import_picocolors5.default.cyan("/review")} - Security audit
3825
+ ` + ` ${import_picocolors5.default.cyan("/deploy-full")} - Deploy to Movement
3826
+ ` + ` ${import_picocolors5.default.cyan("/watzup")} - Check project status`, "\uD83C\uDF89 Ready!");
3827
+ $e(import_picocolors5.default.green("Start building with Claude Code! \uD83D\uDE80"));
3828
+ } catch (error) {
3829
+ spinner.stop("Failed");
3830
+ if (error instanceof Error) {
3831
+ logger.error(error.message);
3832
+ }
3833
+ process.exit(1);
3834
+ }
3835
+ }
3836
+
3837
+ // src/commands/versions.ts
3838
+ var import_picocolors6 = __toESM(require_picocolors2(), 1);
3839
+
3840
+ // src/domains/download/version-fetcher.ts
3841
+ async function getAvailableVersions(options = {}) {
3842
+ const { limit = 10, includePrerelease = false } = options;
3843
+ logger.debug("Fetching available versions", options);
3844
+ const versions = [
3845
+ "1.0.0",
3846
+ "0.9.0-beta.1",
3847
+ "0.8.0",
3848
+ "0.7.0"
3849
+ ];
3850
+ const filtered = includePrerelease ? versions : versions.filter((v2) => !v2.includes("-"));
3851
+ return filtered.slice(0, limit);
3852
+ }
3853
+
3854
+ // src/commands/versions.ts
3855
+ function versionsCommand(cli) {
3856
+ cli.command("versions", "List available Movement Kit versions").option("--kit <kit>", "Filter by kit (engineer)").option("--limit <limit>", "Number of versions to show", { default: 10 }).option("--all", "Show all versions including prereleases").action(async (options) => {
3857
+ await runVersions(options);
3858
+ });
3859
+ }
3860
+ async function runVersions(options) {
3861
+ console.log();
3862
+ oe(import_picocolors6.default.cyan(import_picocolors6.default.bold("\uD83D\uDCE6 Available Versions")));
3863
+ const spinner = de();
3864
+ try {
3865
+ spinner.start("Fetching versions...");
3866
+ const versions = await getAvailableVersions({
3867
+ kit: options.kit,
3868
+ limit: options.limit || 10,
3869
+ includePrerelease: options.all
3870
+ });
3871
+ spinner.stop("Versions fetched");
3872
+ if (versions.length === 0) {
3873
+ logger.warn("No versions found");
3874
+ return;
3875
+ }
3876
+ console.log();
3877
+ console.log(import_picocolors6.default.bold("Movement Kit Versions:"));
3878
+ console.log();
3879
+ for (const version2 of versions) {
3880
+ const isLatest = version2 === versions[0];
3881
+ const tag = isLatest ? import_picocolors6.default.green(" (latest)") : "";
3882
+ const prerelease = version2.includes("-") ? import_picocolors6.default.yellow(" [prerelease]") : "";
3883
+ console.log(` ${import_picocolors6.default.cyan("•")} ${version2}${tag}${prerelease}`);
3884
+ }
3885
+ console.log();
3886
+ console.log(import_picocolors6.default.dim(`Showing ${versions.length} version(s)`));
3887
+ console.log();
3888
+ $e(import_picocolors6.default.dim("Use 'mk new' or 'mk init' to install a specific version"));
3889
+ } catch (error) {
3890
+ spinner.stop("Failed");
3891
+ if (error instanceof Error) {
3892
+ logger.error(error.message);
3893
+ }
3894
+ process.exit(1);
3895
+ }
3896
+ }
3897
+
3898
+ // src/commands/doctor.ts
3899
+ var import_picocolors7 = __toESM(require_picocolors2(), 1);
3900
+ import { exec } from "child_process";
3901
+ import { promisify } from "util";
3902
+ import path5 from "path";
3903
+ var execAsync = promisify(exec);
3904
+ function doctorCommand(cli) {
3905
+ cli.command("doctor", "Run diagnostics and health checks").option("--fix", "Auto-fix issues where possible").option("--check-only", "Exit with code 1 if issues found (for CI)").action(async (options) => {
3906
+ await runDoctor(options);
3907
+ });
3908
+ }
3909
+ async function runDoctor(options) {
3910
+ console.log();
3911
+ oe(import_picocolors7.default.cyan(import_picocolors7.default.bold("\uD83E\uDE7A Movement Kit Doctor")));
3912
+ const results = [];
3913
+ const spinner = de();
3914
+ spinner.start("Running diagnostics...");
3915
+ results.push(await checkNode());
3916
+ results.push(await checkMovementCli());
3917
+ results.push(await checkGit());
3918
+ results.push(await checkGhCli());
3919
+ results.push(await checkProjectStructure());
3920
+ results.push(await checkMoveToml());
3921
+ results.push(await checkDependencies());
3922
+ spinner.stop("Diagnostics complete");
3923
+ console.log();
3924
+ console.log(import_picocolors7.default.bold("Results:"));
3925
+ console.log();
3926
+ let hasFailures = false;
3927
+ let hasWarnings = false;
3928
+ for (const result of results) {
3929
+ const icon = result.status === "pass" ? import_picocolors7.default.green("✓") : result.status === "warn" ? import_picocolors7.default.yellow("⚠") : import_picocolors7.default.red("✗");
3930
+ const status = result.status === "pass" ? import_picocolors7.default.green("PASS") : result.status === "warn" ? import_picocolors7.default.yellow("WARN") : import_picocolors7.default.red("FAIL");
3931
+ console.log(` ${icon} ${import_picocolors7.default.bold(result.name)}: ${status}`);
3932
+ console.log(` ${import_picocolors7.default.dim(result.message)}`);
3933
+ if (result.status === "fail")
3934
+ hasFailures = true;
3935
+ if (result.status === "warn")
3936
+ hasWarnings = true;
3937
+ }
3938
+ console.log();
3939
+ const passCount = results.filter((r2) => r2.status === "pass").length;
3940
+ const warnCount = results.filter((r2) => r2.status === "warn").length;
3941
+ const failCount = results.filter((r2) => r2.status === "fail").length;
3942
+ console.log(`${import_picocolors7.default.bold("Summary:")} ${import_picocolors7.default.green(`${passCount} passed`)}, ${import_picocolors7.default.yellow(`${warnCount} warnings`)}, ${import_picocolors7.default.red(`${failCount} failed`)}`);
3943
+ if (hasFailures && options.checkOnly) {
3944
+ process.exit(1);
3945
+ }
3946
+ if (!hasFailures && !hasWarnings) {
3947
+ $e(import_picocolors7.default.green("All checks passed! \uD83C\uDF89"));
3948
+ } else {
3949
+ $e(import_picocolors7.default.yellow("Some issues found. Run 'mk doctor --fix' to auto-fix."));
3950
+ }
3951
+ }
3952
+ async function checkNode() {
3953
+ try {
3954
+ const { stdout } = await execAsync("node --version");
3955
+ const version2 = stdout.trim();
3956
+ const major = parseInt(version2.replace("v", "").split(".")[0]);
3957
+ if (major >= 18) {
3958
+ return { name: "Node.js", status: "pass", message: `${version2} installed` };
3959
+ }
3960
+ return { name: "Node.js", status: "warn", message: `${version2} (v18+ recommended)` };
3961
+ } catch {
3962
+ return { name: "Node.js", status: "fail", message: "Not installed", fixable: true };
3963
+ }
3964
+ }
3965
+ async function checkMovementCli() {
3966
+ try {
3967
+ const { stdout } = await execAsync("movement --version");
3968
+ return { name: "Movement CLI", status: "pass", message: stdout.trim() };
3969
+ } catch {
3970
+ return {
3971
+ name: "Movement CLI",
3972
+ status: "warn",
3973
+ message: "Not installed (optional, needed for deployment)",
3974
+ fixable: true
3975
+ };
3976
+ }
3977
+ }
3978
+ async function checkGit() {
3979
+ try {
3980
+ const { stdout } = await execAsync("git --version");
3981
+ return { name: "Git", status: "pass", message: stdout.trim() };
3982
+ } catch {
3983
+ return { name: "Git", status: "fail", message: "Not installed", fixable: true };
3984
+ }
3985
+ }
3986
+ async function checkGhCli() {
3987
+ try {
3988
+ const { stdout } = await execAsync("gh --version");
3989
+ const version2 = stdout.split(`
3990
+ `)[0];
3991
+ return { name: "GitHub CLI", status: "pass", message: version2 };
3992
+ } catch {
3993
+ return { name: "GitHub CLI", status: "warn", message: "Not installed (optional)" };
3994
+ }
3995
+ }
3996
+ async function checkProjectStructure() {
3997
+ const cwd = process.cwd();
3998
+ const isProject = await isMovementKitProject(cwd);
3999
+ if (isProject) {
4000
+ return { name: "Project Structure", status: "pass", message: "Valid Movement Kit project" };
4001
+ }
4002
+ return {
4003
+ name: "Project Structure",
4004
+ status: "warn",
4005
+ message: "Not in a Movement Kit project directory"
4006
+ };
4007
+ }
4008
+ async function checkMoveToml() {
4009
+ const moveTomlPath = path5.join(process.cwd(), "contracts", "Move.toml");
4010
+ if (await pathExists(moveTomlPath)) {
4011
+ return { name: "Move.toml", status: "pass", message: "Found in contracts/" };
4012
+ }
4013
+ return { name: "Move.toml", status: "warn", message: "Not found (run /cook:contracts to create)" };
4014
+ }
4015
+ async function checkDependencies() {
4016
+ const backendPkg = path5.join(process.cwd(), "backend", "package.json");
4017
+ const frontendPkg = path5.join(process.cwd(), "frontend", "package.json");
4018
+ const hasBackend = await pathExists(backendPkg);
4019
+ const hasFrontend = await pathExists(frontendPkg);
4020
+ if (hasBackend && hasFrontend) {
4021
+ return { name: "Dependencies", status: "pass", message: "Backend and frontend configured" };
4022
+ }
4023
+ if (hasBackend || hasFrontend) {
4024
+ return { name: "Dependencies", status: "warn", message: "Partial setup detected" };
4025
+ }
4026
+ return { name: "Dependencies", status: "warn", message: "No package.json found" };
4027
+ }
4028
+
4029
+ // src/shared/logger.ts
4030
+ var import_picocolors8 = __toESM(require_picocolors2(), 1);
4031
+
4032
+ class Logger2 {
4033
+ verbose = false;
4034
+ setVerbose(enabled) {
4035
+ this.verbose = enabled;
4036
+ }
4037
+ isVerbose() {
4038
+ return this.verbose;
4039
+ }
4040
+ info(message) {
4041
+ console.log(import_picocolors8.default.blue("ℹ"), message);
4042
+ }
4043
+ success(message) {
4044
+ console.log(import_picocolors8.default.green("✓"), message);
4045
+ }
4046
+ warn(message) {
4047
+ console.log(import_picocolors8.default.yellow("⚠"), message);
4048
+ }
4049
+ error(message) {
4050
+ console.error(import_picocolors8.default.red("✗"), message);
4051
+ }
4052
+ debug(message, data) {
4053
+ if (this.verbose) {
4054
+ console.log(import_picocolors8.default.dim(`[DEBUG] ${message}`));
4055
+ if (data) {
4056
+ console.log(import_picocolors8.default.dim(JSON.stringify(data, null, 2)));
4057
+ }
4058
+ }
4059
+ }
4060
+ verbose(message, data) {
4061
+ if (this.verbose) {
4062
+ console.log(import_picocolors8.default.cyan(`[VERBOSE] ${message}`));
4063
+ if (data) {
4064
+ console.log(import_picocolors8.default.dim(JSON.stringify(data, null, 2)));
4065
+ }
4066
+ }
4067
+ }
4068
+ step(step, total, message) {
4069
+ console.log(import_picocolors8.default.dim(`[${step}/${total}]`), message);
4070
+ }
4071
+ header(title) {
4072
+ console.log();
4073
+ console.log(import_picocolors8.default.bold(import_picocolors8.default.cyan(`━━━ ${title} ━━━`)));
4074
+ console.log();
4075
+ }
4076
+ table(rows) {
4077
+ const maxKey = Math.max(...rows.map(([k2]) => k2.length));
4078
+ for (const [key, value] of rows) {
4079
+ console.log(` ${import_picocolors8.default.dim(key.padEnd(maxKey))} ${value}`);
4080
+ }
4081
+ }
4082
+ }
4083
+ var logger2 = new Logger2;
4084
+
4085
+ // src/index.ts
4086
+ var cli = cac("mk");
4087
+ cli.option("--verbose", "Enable verbose logging");
4088
+ cli.option("--version, -v", "Show version");
4089
+ newCommand(cli);
4090
+ initCommand(cli);
4091
+ versionsCommand(cli);
4092
+ doctorCommand(cli);
4093
+ cli.help((sections) => {
4094
+ sections.unshift({
4095
+ body: `${import_picocolors9.default.cyan(import_picocolors9.default.bold("Movement Kit CLI"))} ${import_picocolors9.default.dim(`v${version}`)}
4096
+ ${import_picocolors9.default.dim("Build dApps on Movement blockchain 10x faster with Claude")}
4097
+ `
4098
+ });
4099
+ });
4100
+ cli.version(version);
4101
+ var parsed = cli.parse(process.argv, { run: false });
4102
+ async function main() {
4103
+ try {
4104
+ if (parsed.options.verbose) {
4105
+ logger2.setVerbose(true);
4106
+ logger2.verbose("Movement Kit CLI starting", {
4107
+ version,
4108
+ command: parsed.args[0] || "none",
4109
+ cwd: process.cwd()
4110
+ });
4111
+ }
4112
+ if (!cli.matchedCommand && parsed.args.length === 0) {
4113
+ cli.outputHelp();
4114
+ return;
4115
+ }
4116
+ await cli.runMatchedCommand();
4117
+ } catch (error) {
4118
+ if (error instanceof Error) {
4119
+ console.error(import_picocolors9.default.red(`Error: ${error.message}`));
4120
+ if (parsed.options.verbose) {
4121
+ console.error(error.stack);
4122
+ }
4123
+ } else {
4124
+ console.error(import_picocolors9.default.red("An unexpected error occurred"));
4125
+ }
4126
+ process.exit(1);
4127
+ }
4128
+ }
4129
+ main();