@likec4/log 1.17.1 → 1.19.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.
@@ -1,1346 +0,0 @@
1
- import { formatWithOptions } from 'node:util';
2
- import { sep } from 'node:path';
3
- import process$1 from 'node:process';
4
- import * as tty from 'node:tty';
5
-
6
- const LogLevels = {
7
- silent: Number.NEGATIVE_INFINITY,
8
- fatal: 0,
9
- error: 0,
10
- warn: 1,
11
- log: 2,
12
- info: 3,
13
- success: 3,
14
- fail: 3,
15
- ready: 3,
16
- start: 3,
17
- box: 3,
18
- debug: 4,
19
- trace: 5,
20
- verbose: Number.POSITIVE_INFINITY
21
- };
22
- const LogTypes = {
23
- // Silent
24
- silent: {
25
- level: -1
26
- },
27
- // Level 0
28
- fatal: {
29
- level: LogLevels.fatal
30
- },
31
- error: {
32
- level: LogLevels.error
33
- },
34
- // Level 1
35
- warn: {
36
- level: LogLevels.warn
37
- },
38
- // Level 2
39
- log: {
40
- level: LogLevels.log
41
- },
42
- // Level 3
43
- info: {
44
- level: LogLevels.info
45
- },
46
- success: {
47
- level: LogLevels.success
48
- },
49
- fail: {
50
- level: LogLevels.fail
51
- },
52
- ready: {
53
- level: LogLevels.info
54
- },
55
- start: {
56
- level: LogLevels.info
57
- },
58
- box: {
59
- level: LogLevels.info
60
- },
61
- // Level 4
62
- debug: {
63
- level: LogLevels.debug
64
- },
65
- // Level 5
66
- trace: {
67
- level: LogLevels.trace
68
- },
69
- // Verbose
70
- verbose: {
71
- level: LogLevels.verbose
72
- }
73
- };
74
-
75
- function isObject(value) {
76
- return value !== null && typeof value === "object";
77
- }
78
- function _defu(baseObject, defaults, namespace = ".", merger) {
79
- if (!isObject(defaults)) {
80
- return _defu(baseObject, {}, namespace);
81
- }
82
- const object = Object.assign({}, defaults);
83
- for (const key in baseObject) {
84
- if (key === "__proto__" || key === "constructor") {
85
- continue;
86
- }
87
- const value = baseObject[key];
88
- if (value === null || value === void 0) {
89
- continue;
90
- }
91
- if (Array.isArray(value) && Array.isArray(object[key])) {
92
- object[key] = [...value, ...object[key]];
93
- } else if (isObject(value) && isObject(object[key])) {
94
- object[key] = _defu(
95
- value,
96
- object[key],
97
- (namespace ? `${namespace}.` : "") + key.toString());
98
- } else {
99
- object[key] = value;
100
- }
101
- }
102
- return object;
103
- }
104
- function createDefu(merger) {
105
- return (...arguments_) => (
106
- // eslint-disable-next-line unicorn/no-array-reduce
107
- arguments_.reduce((p, c) => _defu(p, c, ""), {})
108
- );
109
- }
110
- const defu = createDefu();
111
-
112
- function isPlainObject(obj) {
113
- return Object.prototype.toString.call(obj) === "[object Object]";
114
- }
115
- function isLogObj(arg) {
116
- if (!isPlainObject(arg)) {
117
- return false;
118
- }
119
- if (!arg.message && !arg.args) {
120
- return false;
121
- }
122
- if (arg.stack) {
123
- return false;
124
- }
125
- return true;
126
- }
127
-
128
- let paused = false;
129
- const queue = [];
130
- class Consola {
131
- constructor(options = {}) {
132
- const types = options.types || LogTypes;
133
- this.options = defu(
134
- {
135
- ...options,
136
- defaults: { ...options.defaults },
137
- level: _normalizeLogLevel(options.level, types),
138
- reporters: [...options.reporters || []]
139
- },
140
- {
141
- types: LogTypes,
142
- throttle: 1e3,
143
- throttleMin: 5,
144
- formatOptions: {
145
- date: true,
146
- colors: false,
147
- compact: true
148
- }
149
- }
150
- );
151
- for (const type in types) {
152
- const defaults = {
153
- type,
154
- ...this.options.defaults,
155
- ...types[type]
156
- };
157
- this[type] = this._wrapLogFn(defaults);
158
- this[type].raw = this._wrapLogFn(
159
- defaults,
160
- true
161
- );
162
- }
163
- if (this.options.mockFn) {
164
- this.mockTypes();
165
- }
166
- this._lastLog = {};
167
- }
168
- get level() {
169
- return this.options.level;
170
- }
171
- set level(level) {
172
- this.options.level = _normalizeLogLevel(
173
- level,
174
- this.options.types,
175
- this.options.level
176
- );
177
- }
178
- prompt(message, opts) {
179
- if (!this.options.prompt) {
180
- throw new Error("prompt is not supported!");
181
- }
182
- return this.options.prompt(message, opts);
183
- }
184
- create(options) {
185
- const instance = new Consola({
186
- ...this.options,
187
- ...options
188
- });
189
- if (this._mockFn) {
190
- instance.mockTypes(this._mockFn);
191
- }
192
- return instance;
193
- }
194
- withDefaults(defaults) {
195
- return this.create({
196
- ...this.options,
197
- defaults: {
198
- ...this.options.defaults,
199
- ...defaults
200
- }
201
- });
202
- }
203
- withTag(tag) {
204
- return this.withDefaults({
205
- tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag
206
- });
207
- }
208
- addReporter(reporter) {
209
- this.options.reporters.push(reporter);
210
- return this;
211
- }
212
- removeReporter(reporter) {
213
- if (reporter) {
214
- const i = this.options.reporters.indexOf(reporter);
215
- if (i >= 0) {
216
- return this.options.reporters.splice(i, 1);
217
- }
218
- } else {
219
- this.options.reporters.splice(0);
220
- }
221
- return this;
222
- }
223
- setReporters(reporters) {
224
- this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
225
- return this;
226
- }
227
- wrapAll() {
228
- this.wrapConsole();
229
- this.wrapStd();
230
- }
231
- restoreAll() {
232
- this.restoreConsole();
233
- this.restoreStd();
234
- }
235
- wrapConsole() {
236
- for (const type in this.options.types) {
237
- if (!console["__" + type]) {
238
- console["__" + type] = console[type];
239
- }
240
- console[type] = this[type].raw;
241
- }
242
- }
243
- restoreConsole() {
244
- for (const type in this.options.types) {
245
- if (console["__" + type]) {
246
- console[type] = console["__" + type];
247
- delete console["__" + type];
248
- }
249
- }
250
- }
251
- wrapStd() {
252
- this._wrapStream(this.options.stdout, "log");
253
- this._wrapStream(this.options.stderr, "log");
254
- }
255
- _wrapStream(stream, type) {
256
- if (!stream) {
257
- return;
258
- }
259
- if (!stream.__write) {
260
- stream.__write = stream.write;
261
- }
262
- stream.write = (data) => {
263
- this[type].raw(String(data).trim());
264
- };
265
- }
266
- restoreStd() {
267
- this._restoreStream(this.options.stdout);
268
- this._restoreStream(this.options.stderr);
269
- }
270
- _restoreStream(stream) {
271
- if (!stream) {
272
- return;
273
- }
274
- if (stream.__write) {
275
- stream.write = stream.__write;
276
- delete stream.__write;
277
- }
278
- }
279
- pauseLogs() {
280
- paused = true;
281
- }
282
- resumeLogs() {
283
- paused = false;
284
- const _queue = queue.splice(0);
285
- for (const item of _queue) {
286
- item[0]._logFn(item[1], item[2]);
287
- }
288
- }
289
- mockTypes(mockFn) {
290
- const _mockFn = mockFn || this.options.mockFn;
291
- this._mockFn = _mockFn;
292
- if (typeof _mockFn !== "function") {
293
- return;
294
- }
295
- for (const type in this.options.types) {
296
- this[type] = _mockFn(type, this.options.types[type]) || this[type];
297
- this[type].raw = this[type];
298
- }
299
- }
300
- _wrapLogFn(defaults, isRaw) {
301
- return (...args) => {
302
- if (paused) {
303
- queue.push([this, defaults, args, isRaw]);
304
- return;
305
- }
306
- return this._logFn(defaults, args, isRaw);
307
- };
308
- }
309
- _logFn(defaults, args, isRaw) {
310
- if ((defaults.level || 0) > this.level) {
311
- return false;
312
- }
313
- const logObj = {
314
- date: /* @__PURE__ */ new Date(),
315
- args: [],
316
- ...defaults,
317
- level: _normalizeLogLevel(defaults.level, this.options.types)
318
- };
319
- if (!isRaw && args.length === 1 && isLogObj(args[0])) {
320
- Object.assign(logObj, args[0]);
321
- } else {
322
- logObj.args = [...args];
323
- }
324
- if (logObj.message) {
325
- logObj.args.unshift(logObj.message);
326
- delete logObj.message;
327
- }
328
- if (logObj.additional) {
329
- if (!Array.isArray(logObj.additional)) {
330
- logObj.additional = logObj.additional.split("\n");
331
- }
332
- logObj.args.push("\n" + logObj.additional.join("\n"));
333
- delete logObj.additional;
334
- }
335
- logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
336
- logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
337
- const resolveLog = (newLog = false) => {
338
- const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
339
- if (this._lastLog.object && repeated > 0) {
340
- const args2 = [...this._lastLog.object.args];
341
- if (repeated > 1) {
342
- args2.push(`(repeated ${repeated} times)`);
343
- }
344
- this._log({ ...this._lastLog.object, args: args2 });
345
- this._lastLog.count = 1;
346
- }
347
- if (newLog) {
348
- this._lastLog.object = logObj;
349
- this._log(logObj);
350
- }
351
- };
352
- clearTimeout(this._lastLog.timeout);
353
- const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
354
- this._lastLog.time = logObj.date;
355
- if (diffTime < this.options.throttle) {
356
- try {
357
- const serializedLog = JSON.stringify([
358
- logObj.type,
359
- logObj.tag,
360
- logObj.args
361
- ]);
362
- const isSameLog = this._lastLog.serialized === serializedLog;
363
- this._lastLog.serialized = serializedLog;
364
- if (isSameLog) {
365
- this._lastLog.count = (this._lastLog.count || 0) + 1;
366
- if (this._lastLog.count > this.options.throttleMin) {
367
- this._lastLog.timeout = setTimeout(
368
- resolveLog,
369
- this.options.throttle
370
- );
371
- return;
372
- }
373
- }
374
- } catch {
375
- }
376
- }
377
- resolveLog(true);
378
- }
379
- _log(logObj) {
380
- for (const reporter of this.options.reporters) {
381
- reporter.log(logObj, {
382
- options: this.options
383
- });
384
- }
385
- }
386
- }
387
- function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
388
- if (input === void 0) {
389
- return defaultLevel;
390
- }
391
- if (typeof input === "number") {
392
- return input;
393
- }
394
- if (types[input] && types[input].level !== void 0) {
395
- return types[input].level;
396
- }
397
- return defaultLevel;
398
- }
399
- Consola.prototype.add = Consola.prototype.addReporter;
400
- Consola.prototype.remove = Consola.prototype.removeReporter;
401
- Consola.prototype.clear = Consola.prototype.removeReporter;
402
- Consola.prototype.withScope = Consola.prototype.withTag;
403
- Consola.prototype.mock = Consola.prototype.mockTypes;
404
- Consola.prototype.pause = Consola.prototype.pauseLogs;
405
- Consola.prototype.resume = Consola.prototype.resumeLogs;
406
- function createConsola$1(options = {}) {
407
- return new Consola(options);
408
- }
409
-
410
- function parseStack(stack) {
411
- const cwd = process.cwd() + sep;
412
- const lines = stack.split("\n").splice(1).map((l) => l.trim().replace("file://", "").replace(cwd, ""));
413
- return lines;
414
- }
415
-
416
- function writeStream(data, stream) {
417
- const write = stream.__write || stream.write;
418
- return write.call(stream, data);
419
- }
420
-
421
- const bracket = (x) => x ? `[${x}]` : "";
422
- class BasicReporter {
423
- formatStack(stack, opts) {
424
- return " " + parseStack(stack).join("\n ");
425
- }
426
- formatArgs(args, opts) {
427
- const _args = args.map((arg) => {
428
- if (arg && typeof arg.stack === "string") {
429
- return arg.message + "\n" + this.formatStack(arg.stack, opts);
430
- }
431
- return arg;
432
- });
433
- return formatWithOptions(opts, ..._args);
434
- }
435
- formatDate(date, opts) {
436
- return opts.date ? date.toLocaleTimeString() : "";
437
- }
438
- filterAndJoin(arr) {
439
- return arr.filter(Boolean).join(" ");
440
- }
441
- formatLogObj(logObj, opts) {
442
- const message = this.formatArgs(logObj.args, opts);
443
- if (logObj.type === "box") {
444
- return "\n" + [
445
- bracket(logObj.tag),
446
- logObj.title && logObj.title,
447
- ...message.split("\n")
448
- ].filter(Boolean).map((l) => " > " + l).join("\n") + "\n";
449
- }
450
- return this.filterAndJoin([
451
- bracket(logObj.type),
452
- bracket(logObj.tag),
453
- message
454
- ]);
455
- }
456
- log(logObj, ctx) {
457
- const line = this.formatLogObj(logObj, {
458
- columns: ctx.options.stdout.columns || 0,
459
- ...ctx.options.formatOptions
460
- });
461
- return writeStream(
462
- line + "\n",
463
- logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout
464
- );
465
- }
466
- }
467
-
468
- const {
469
- env = {},
470
- argv = [],
471
- platform = ""
472
- } = typeof process === "undefined" ? {} : process;
473
- const isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
474
- const isForced = "FORCE_COLOR" in env || argv.includes("--color");
475
- const isWindows = platform === "win32";
476
- const isDumbTerminal = env.TERM === "dumb";
477
- const isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
478
- const isCI$1 = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
479
- const isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI$1);
480
- function replaceClose(index, string, close, replace, head = string.slice(0, Math.max(0, index)) + replace, tail = string.slice(Math.max(0, index + close.length)), next = tail.indexOf(close)) {
481
- return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
482
- }
483
- function clearBleed(index, string, open, close, replace) {
484
- return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
485
- }
486
- function filterEmpty(open, close, replace = open, at = open.length + 1) {
487
- return (string) => string || !(string === "" || string === void 0) ? clearBleed(
488
- ("" + string).indexOf(close, at),
489
- string,
490
- open,
491
- close,
492
- replace
493
- ) : "";
494
- }
495
- function init(open, close, replace) {
496
- return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
497
- }
498
- const colorDefs = {
499
- reset: init(0, 0),
500
- bold: init(1, 22, "\x1B[22m\x1B[1m"),
501
- dim: init(2, 22, "\x1B[22m\x1B[2m"),
502
- italic: init(3, 23),
503
- underline: init(4, 24),
504
- inverse: init(7, 27),
505
- hidden: init(8, 28),
506
- strikethrough: init(9, 29),
507
- black: init(30, 39),
508
- red: init(31, 39),
509
- green: init(32, 39),
510
- yellow: init(33, 39),
511
- blue: init(34, 39),
512
- magenta: init(35, 39),
513
- cyan: init(36, 39),
514
- white: init(37, 39),
515
- gray: init(90, 39),
516
- bgBlack: init(40, 49),
517
- bgRed: init(41, 49),
518
- bgGreen: init(42, 49),
519
- bgYellow: init(43, 49),
520
- bgBlue: init(44, 49),
521
- bgMagenta: init(45, 49),
522
- bgCyan: init(46, 49),
523
- bgWhite: init(47, 49),
524
- blackBright: init(90, 39),
525
- redBright: init(91, 39),
526
- greenBright: init(92, 39),
527
- yellowBright: init(93, 39),
528
- blueBright: init(94, 39),
529
- magentaBright: init(95, 39),
530
- cyanBright: init(96, 39),
531
- whiteBright: init(97, 39),
532
- bgBlackBright: init(100, 49),
533
- bgRedBright: init(101, 49),
534
- bgGreenBright: init(102, 49),
535
- bgYellowBright: init(103, 49),
536
- bgBlueBright: init(104, 49),
537
- bgMagentaBright: init(105, 49),
538
- bgCyanBright: init(106, 49),
539
- bgWhiteBright: init(107, 49)
540
- };
541
- function createColors(useColor = isColorSupported) {
542
- return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
543
- }
544
- const colors = createColors();
545
- function getColor$1(color, fallback = "reset") {
546
- return colors[color] || colors[fallback];
547
- }
548
-
549
- const ansiRegex$1 = [
550
- "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
551
- "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"
552
- ].join("|");
553
- function stripAnsi$1(text) {
554
- return text.replace(new RegExp(ansiRegex$1, "g"), "");
555
- }
556
-
557
- const boxStylePresets = {
558
- solid: {
559
- tl: "\u250C",
560
- tr: "\u2510",
561
- bl: "\u2514",
562
- br: "\u2518",
563
- h: "\u2500",
564
- v: "\u2502"
565
- },
566
- double: {
567
- tl: "\u2554",
568
- tr: "\u2557",
569
- bl: "\u255A",
570
- br: "\u255D",
571
- h: "\u2550",
572
- v: "\u2551"
573
- },
574
- doubleSingle: {
575
- tl: "\u2553",
576
- tr: "\u2556",
577
- bl: "\u2559",
578
- br: "\u255C",
579
- h: "\u2500",
580
- v: "\u2551"
581
- },
582
- doubleSingleRounded: {
583
- tl: "\u256D",
584
- tr: "\u256E",
585
- bl: "\u2570",
586
- br: "\u256F",
587
- h: "\u2500",
588
- v: "\u2551"
589
- },
590
- singleThick: {
591
- tl: "\u250F",
592
- tr: "\u2513",
593
- bl: "\u2517",
594
- br: "\u251B",
595
- h: "\u2501",
596
- v: "\u2503"
597
- },
598
- singleDouble: {
599
- tl: "\u2552",
600
- tr: "\u2555",
601
- bl: "\u2558",
602
- br: "\u255B",
603
- h: "\u2550",
604
- v: "\u2502"
605
- },
606
- singleDoubleRounded: {
607
- tl: "\u256D",
608
- tr: "\u256E",
609
- bl: "\u2570",
610
- br: "\u256F",
611
- h: "\u2550",
612
- v: "\u2502"
613
- },
614
- rounded: {
615
- tl: "\u256D",
616
- tr: "\u256E",
617
- bl: "\u2570",
618
- br: "\u256F",
619
- h: "\u2500",
620
- v: "\u2502"
621
- }
622
- };
623
- const defaultStyle = {
624
- borderColor: "white",
625
- borderStyle: "rounded",
626
- valign: "center",
627
- padding: 2,
628
- marginLeft: 1,
629
- marginTop: 1,
630
- marginBottom: 1
631
- };
632
- function box(text, _opts = {}) {
633
- const opts = {
634
- ..._opts,
635
- style: {
636
- ...defaultStyle,
637
- ..._opts.style
638
- }
639
- };
640
- const textLines = text.split("\n");
641
- const boxLines = [];
642
- const _color = getColor$1(opts.style.borderColor);
643
- const borderStyle = {
644
- ...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle
645
- };
646
- if (_color) {
647
- for (const key in borderStyle) {
648
- borderStyle[key] = _color(
649
- borderStyle[key]
650
- );
651
- }
652
- }
653
- const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
654
- const height = textLines.length + paddingOffset;
655
- const width = Math.max(...textLines.map((line) => line.length)) + paddingOffset;
656
- const widthOffset = width + paddingOffset;
657
- const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
658
- if (opts.style.marginTop > 0) {
659
- boxLines.push("".repeat(opts.style.marginTop));
660
- }
661
- if (opts.title) {
662
- const left = borderStyle.h.repeat(
663
- Math.floor((width - stripAnsi$1(opts.title).length) / 2)
664
- );
665
- const right = borderStyle.h.repeat(
666
- width - stripAnsi$1(opts.title).length - stripAnsi$1(left).length + paddingOffset
667
- );
668
- boxLines.push(
669
- `${leftSpace}${borderStyle.tl}${left}${opts.title}${right}${borderStyle.tr}`
670
- );
671
- } else {
672
- boxLines.push(
673
- `${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`
674
- );
675
- }
676
- const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
677
- for (let i = 0; i < height; i++) {
678
- if (i < valignOffset || i >= valignOffset + textLines.length) {
679
- boxLines.push(
680
- `${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`
681
- );
682
- } else {
683
- const line = textLines[i - valignOffset];
684
- const left = " ".repeat(paddingOffset);
685
- const right = " ".repeat(width - stripAnsi$1(line).length);
686
- boxLines.push(
687
- `${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`
688
- );
689
- }
690
- }
691
- boxLines.push(
692
- `${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`
693
- );
694
- if (opts.style.marginBottom > 0) {
695
- boxLines.push("".repeat(opts.style.marginBottom));
696
- }
697
- return boxLines.join("\n");
698
- }
699
-
700
- const providers = [
701
- ["APPVEYOR"],
702
- ["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],
703
- ["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],
704
- ["APPCIRCLE", "AC_APPCIRCLE"],
705
- ["BAMBOO", "bamboo_planKey"],
706
- ["BITBUCKET", "BITBUCKET_COMMIT"],
707
- ["BITRISE", "BITRISE_IO"],
708
- ["BUDDY", "BUDDY_WORKSPACE_ID"],
709
- ["BUILDKITE"],
710
- ["CIRCLE", "CIRCLECI"],
711
- ["CIRRUS", "CIRRUS_CI"],
712
- ["CLOUDFLARE_PAGES", "CF_PAGES", { ci: true }],
713
- ["CODEBUILD", "CODEBUILD_BUILD_ARN"],
714
- ["CODEFRESH", "CF_BUILD_ID"],
715
- ["DRONE"],
716
- ["DRONE", "DRONE_BUILD_EVENT"],
717
- ["DSARI"],
718
- ["GITHUB_ACTIONS"],
719
- ["GITLAB", "GITLAB_CI"],
720
- ["GITLAB", "CI_MERGE_REQUEST_ID"],
721
- ["GOCD", "GO_PIPELINE_LABEL"],
722
- ["LAYERCI"],
723
- ["HUDSON", "HUDSON_URL"],
724
- ["JENKINS", "JENKINS_URL"],
725
- ["MAGNUM"],
726
- ["NETLIFY"],
727
- ["NETLIFY", "NETLIFY_LOCAL", { ci: false }],
728
- ["NEVERCODE"],
729
- ["RENDER"],
730
- ["SAIL", "SAILCI"],
731
- ["SEMAPHORE"],
732
- ["SCREWDRIVER"],
733
- ["SHIPPABLE"],
734
- ["SOLANO", "TDDIUM"],
735
- ["STRIDER"],
736
- ["TEAMCITY", "TEAMCITY_VERSION"],
737
- ["TRAVIS"],
738
- ["VERCEL", "NOW_BUILDER"],
739
- ["APPCENTER", "APPCENTER_BUILD_ID"],
740
- ["CODESANDBOX", "CODESANDBOX_SSE", { ci: false }],
741
- ["STACKBLITZ"],
742
- ["STORMKIT"],
743
- ["CLEAVR"]
744
- ];
745
- function detectProvider(env) {
746
- for (const provider of providers) {
747
- const envName = provider[1] || provider[0];
748
- if (env[envName]) {
749
- return {
750
- name: provider[0].toLowerCase(),
751
- ...provider[2]
752
- };
753
- }
754
- }
755
- if (env.SHELL && env.SHELL === "/bin/jsh") {
756
- return {
757
- name: "stackblitz",
758
- ci: false
759
- };
760
- }
761
- return {
762
- name: "",
763
- ci: false
764
- };
765
- }
766
-
767
- const processShim = typeof process !== "undefined" ? process : {};
768
- const envShim = processShim.env || {};
769
- const providerInfo = detectProvider(envShim);
770
- const nodeENV = typeof process !== "undefined" && process.env && process.env.NODE_ENV || "";
771
- processShim.platform;
772
- providerInfo.name;
773
- const isCI = toBoolean(envShim.CI) || providerInfo.ci !== false;
774
- const hasTTY = toBoolean(processShim.stdout && processShim.stdout.isTTY);
775
- const isDebug = toBoolean(envShim.DEBUG);
776
- const isTest = nodeENV === "test" || toBoolean(envShim.TEST);
777
- toBoolean(envShim.MINIMAL) || isCI || isTest || !hasTTY;
778
- function toBoolean(val) {
779
- return val ? val !== "false" : false;
780
- }
781
-
782
- function ansiRegex({onlyFirst = false} = {}) {
783
- const pattern = [
784
- '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
785
- '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
786
- ].join('|');
787
-
788
- return new RegExp(pattern, onlyFirst ? undefined : 'g');
789
- }
790
-
791
- const regex = ansiRegex();
792
-
793
- function stripAnsi(string) {
794
- if (typeof string !== 'string') {
795
- throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
796
- }
797
-
798
- // Even though the regex is global, we don't need to reset the `.lastIndex`
799
- // because unlike `.exec()` and `.test()`, `.replace()` does it automatically
800
- // and doing it manually has a performance penalty.
801
- return string.replace(regex, '');
802
- }
803
-
804
- function getDefaultExportFromCjs (x) {
805
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
806
- }
807
-
808
- var eastasianwidth = {exports: {}};
809
-
810
- (function (module) {
811
- var eaw = {};
812
-
813
- {
814
- module.exports = eaw;
815
- }
816
-
817
- eaw.eastAsianWidth = function(character) {
818
- var x = character.charCodeAt(0);
819
- var y = (character.length == 2) ? character.charCodeAt(1) : 0;
820
- var codePoint = x;
821
- if ((0xD800 <= x && x <= 0xDBFF) && (0xDC00 <= y && y <= 0xDFFF)) {
822
- x &= 0x3FF;
823
- y &= 0x3FF;
824
- codePoint = (x << 10) | y;
825
- codePoint += 0x10000;
826
- }
827
-
828
- if ((0x3000 == codePoint) ||
829
- (0xFF01 <= codePoint && codePoint <= 0xFF60) ||
830
- (0xFFE0 <= codePoint && codePoint <= 0xFFE6)) {
831
- return 'F';
832
- }
833
- if ((0x20A9 == codePoint) ||
834
- (0xFF61 <= codePoint && codePoint <= 0xFFBE) ||
835
- (0xFFC2 <= codePoint && codePoint <= 0xFFC7) ||
836
- (0xFFCA <= codePoint && codePoint <= 0xFFCF) ||
837
- (0xFFD2 <= codePoint && codePoint <= 0xFFD7) ||
838
- (0xFFDA <= codePoint && codePoint <= 0xFFDC) ||
839
- (0xFFE8 <= codePoint && codePoint <= 0xFFEE)) {
840
- return 'H';
841
- }
842
- if ((0x1100 <= codePoint && codePoint <= 0x115F) ||
843
- (0x11A3 <= codePoint && codePoint <= 0x11A7) ||
844
- (0x11FA <= codePoint && codePoint <= 0x11FF) ||
845
- (0x2329 <= codePoint && codePoint <= 0x232A) ||
846
- (0x2E80 <= codePoint && codePoint <= 0x2E99) ||
847
- (0x2E9B <= codePoint && codePoint <= 0x2EF3) ||
848
- (0x2F00 <= codePoint && codePoint <= 0x2FD5) ||
849
- (0x2FF0 <= codePoint && codePoint <= 0x2FFB) ||
850
- (0x3001 <= codePoint && codePoint <= 0x303E) ||
851
- (0x3041 <= codePoint && codePoint <= 0x3096) ||
852
- (0x3099 <= codePoint && codePoint <= 0x30FF) ||
853
- (0x3105 <= codePoint && codePoint <= 0x312D) ||
854
- (0x3131 <= codePoint && codePoint <= 0x318E) ||
855
- (0x3190 <= codePoint && codePoint <= 0x31BA) ||
856
- (0x31C0 <= codePoint && codePoint <= 0x31E3) ||
857
- (0x31F0 <= codePoint && codePoint <= 0x321E) ||
858
- (0x3220 <= codePoint && codePoint <= 0x3247) ||
859
- (0x3250 <= codePoint && codePoint <= 0x32FE) ||
860
- (0x3300 <= codePoint && codePoint <= 0x4DBF) ||
861
- (0x4E00 <= codePoint && codePoint <= 0xA48C) ||
862
- (0xA490 <= codePoint && codePoint <= 0xA4C6) ||
863
- (0xA960 <= codePoint && codePoint <= 0xA97C) ||
864
- (0xAC00 <= codePoint && codePoint <= 0xD7A3) ||
865
- (0xD7B0 <= codePoint && codePoint <= 0xD7C6) ||
866
- (0xD7CB <= codePoint && codePoint <= 0xD7FB) ||
867
- (0xF900 <= codePoint && codePoint <= 0xFAFF) ||
868
- (0xFE10 <= codePoint && codePoint <= 0xFE19) ||
869
- (0xFE30 <= codePoint && codePoint <= 0xFE52) ||
870
- (0xFE54 <= codePoint && codePoint <= 0xFE66) ||
871
- (0xFE68 <= codePoint && codePoint <= 0xFE6B) ||
872
- (0x1B000 <= codePoint && codePoint <= 0x1B001) ||
873
- (0x1F200 <= codePoint && codePoint <= 0x1F202) ||
874
- (0x1F210 <= codePoint && codePoint <= 0x1F23A) ||
875
- (0x1F240 <= codePoint && codePoint <= 0x1F248) ||
876
- (0x1F250 <= codePoint && codePoint <= 0x1F251) ||
877
- (0x20000 <= codePoint && codePoint <= 0x2F73F) ||
878
- (0x2B740 <= codePoint && codePoint <= 0x2FFFD) ||
879
- (0x30000 <= codePoint && codePoint <= 0x3FFFD)) {
880
- return 'W';
881
- }
882
- if ((0x0020 <= codePoint && codePoint <= 0x007E) ||
883
- (0x00A2 <= codePoint && codePoint <= 0x00A3) ||
884
- (0x00A5 <= codePoint && codePoint <= 0x00A6) ||
885
- (0x00AC == codePoint) ||
886
- (0x00AF == codePoint) ||
887
- (0x27E6 <= codePoint && codePoint <= 0x27ED) ||
888
- (0x2985 <= codePoint && codePoint <= 0x2986)) {
889
- return 'Na';
890
- }
891
- if ((0x00A1 == codePoint) ||
892
- (0x00A4 == codePoint) ||
893
- (0x00A7 <= codePoint && codePoint <= 0x00A8) ||
894
- (0x00AA == codePoint) ||
895
- (0x00AD <= codePoint && codePoint <= 0x00AE) ||
896
- (0x00B0 <= codePoint && codePoint <= 0x00B4) ||
897
- (0x00B6 <= codePoint && codePoint <= 0x00BA) ||
898
- (0x00BC <= codePoint && codePoint <= 0x00BF) ||
899
- (0x00C6 == codePoint) ||
900
- (0x00D0 == codePoint) ||
901
- (0x00D7 <= codePoint && codePoint <= 0x00D8) ||
902
- (0x00DE <= codePoint && codePoint <= 0x00E1) ||
903
- (0x00E6 == codePoint) ||
904
- (0x00E8 <= codePoint && codePoint <= 0x00EA) ||
905
- (0x00EC <= codePoint && codePoint <= 0x00ED) ||
906
- (0x00F0 == codePoint) ||
907
- (0x00F2 <= codePoint && codePoint <= 0x00F3) ||
908
- (0x00F7 <= codePoint && codePoint <= 0x00FA) ||
909
- (0x00FC == codePoint) ||
910
- (0x00FE == codePoint) ||
911
- (0x0101 == codePoint) ||
912
- (0x0111 == codePoint) ||
913
- (0x0113 == codePoint) ||
914
- (0x011B == codePoint) ||
915
- (0x0126 <= codePoint && codePoint <= 0x0127) ||
916
- (0x012B == codePoint) ||
917
- (0x0131 <= codePoint && codePoint <= 0x0133) ||
918
- (0x0138 == codePoint) ||
919
- (0x013F <= codePoint && codePoint <= 0x0142) ||
920
- (0x0144 == codePoint) ||
921
- (0x0148 <= codePoint && codePoint <= 0x014B) ||
922
- (0x014D == codePoint) ||
923
- (0x0152 <= codePoint && codePoint <= 0x0153) ||
924
- (0x0166 <= codePoint && codePoint <= 0x0167) ||
925
- (0x016B == codePoint) ||
926
- (0x01CE == codePoint) ||
927
- (0x01D0 == codePoint) ||
928
- (0x01D2 == codePoint) ||
929
- (0x01D4 == codePoint) ||
930
- (0x01D6 == codePoint) ||
931
- (0x01D8 == codePoint) ||
932
- (0x01DA == codePoint) ||
933
- (0x01DC == codePoint) ||
934
- (0x0251 == codePoint) ||
935
- (0x0261 == codePoint) ||
936
- (0x02C4 == codePoint) ||
937
- (0x02C7 == codePoint) ||
938
- (0x02C9 <= codePoint && codePoint <= 0x02CB) ||
939
- (0x02CD == codePoint) ||
940
- (0x02D0 == codePoint) ||
941
- (0x02D8 <= codePoint && codePoint <= 0x02DB) ||
942
- (0x02DD == codePoint) ||
943
- (0x02DF == codePoint) ||
944
- (0x0300 <= codePoint && codePoint <= 0x036F) ||
945
- (0x0391 <= codePoint && codePoint <= 0x03A1) ||
946
- (0x03A3 <= codePoint && codePoint <= 0x03A9) ||
947
- (0x03B1 <= codePoint && codePoint <= 0x03C1) ||
948
- (0x03C3 <= codePoint && codePoint <= 0x03C9) ||
949
- (0x0401 == codePoint) ||
950
- (0x0410 <= codePoint && codePoint <= 0x044F) ||
951
- (0x0451 == codePoint) ||
952
- (0x2010 == codePoint) ||
953
- (0x2013 <= codePoint && codePoint <= 0x2016) ||
954
- (0x2018 <= codePoint && codePoint <= 0x2019) ||
955
- (0x201C <= codePoint && codePoint <= 0x201D) ||
956
- (0x2020 <= codePoint && codePoint <= 0x2022) ||
957
- (0x2024 <= codePoint && codePoint <= 0x2027) ||
958
- (0x2030 == codePoint) ||
959
- (0x2032 <= codePoint && codePoint <= 0x2033) ||
960
- (0x2035 == codePoint) ||
961
- (0x203B == codePoint) ||
962
- (0x203E == codePoint) ||
963
- (0x2074 == codePoint) ||
964
- (0x207F == codePoint) ||
965
- (0x2081 <= codePoint && codePoint <= 0x2084) ||
966
- (0x20AC == codePoint) ||
967
- (0x2103 == codePoint) ||
968
- (0x2105 == codePoint) ||
969
- (0x2109 == codePoint) ||
970
- (0x2113 == codePoint) ||
971
- (0x2116 == codePoint) ||
972
- (0x2121 <= codePoint && codePoint <= 0x2122) ||
973
- (0x2126 == codePoint) ||
974
- (0x212B == codePoint) ||
975
- (0x2153 <= codePoint && codePoint <= 0x2154) ||
976
- (0x215B <= codePoint && codePoint <= 0x215E) ||
977
- (0x2160 <= codePoint && codePoint <= 0x216B) ||
978
- (0x2170 <= codePoint && codePoint <= 0x2179) ||
979
- (0x2189 == codePoint) ||
980
- (0x2190 <= codePoint && codePoint <= 0x2199) ||
981
- (0x21B8 <= codePoint && codePoint <= 0x21B9) ||
982
- (0x21D2 == codePoint) ||
983
- (0x21D4 == codePoint) ||
984
- (0x21E7 == codePoint) ||
985
- (0x2200 == codePoint) ||
986
- (0x2202 <= codePoint && codePoint <= 0x2203) ||
987
- (0x2207 <= codePoint && codePoint <= 0x2208) ||
988
- (0x220B == codePoint) ||
989
- (0x220F == codePoint) ||
990
- (0x2211 == codePoint) ||
991
- (0x2215 == codePoint) ||
992
- (0x221A == codePoint) ||
993
- (0x221D <= codePoint && codePoint <= 0x2220) ||
994
- (0x2223 == codePoint) ||
995
- (0x2225 == codePoint) ||
996
- (0x2227 <= codePoint && codePoint <= 0x222C) ||
997
- (0x222E == codePoint) ||
998
- (0x2234 <= codePoint && codePoint <= 0x2237) ||
999
- (0x223C <= codePoint && codePoint <= 0x223D) ||
1000
- (0x2248 == codePoint) ||
1001
- (0x224C == codePoint) ||
1002
- (0x2252 == codePoint) ||
1003
- (0x2260 <= codePoint && codePoint <= 0x2261) ||
1004
- (0x2264 <= codePoint && codePoint <= 0x2267) ||
1005
- (0x226A <= codePoint && codePoint <= 0x226B) ||
1006
- (0x226E <= codePoint && codePoint <= 0x226F) ||
1007
- (0x2282 <= codePoint && codePoint <= 0x2283) ||
1008
- (0x2286 <= codePoint && codePoint <= 0x2287) ||
1009
- (0x2295 == codePoint) ||
1010
- (0x2299 == codePoint) ||
1011
- (0x22A5 == codePoint) ||
1012
- (0x22BF == codePoint) ||
1013
- (0x2312 == codePoint) ||
1014
- (0x2460 <= codePoint && codePoint <= 0x24E9) ||
1015
- (0x24EB <= codePoint && codePoint <= 0x254B) ||
1016
- (0x2550 <= codePoint && codePoint <= 0x2573) ||
1017
- (0x2580 <= codePoint && codePoint <= 0x258F) ||
1018
- (0x2592 <= codePoint && codePoint <= 0x2595) ||
1019
- (0x25A0 <= codePoint && codePoint <= 0x25A1) ||
1020
- (0x25A3 <= codePoint && codePoint <= 0x25A9) ||
1021
- (0x25B2 <= codePoint && codePoint <= 0x25B3) ||
1022
- (0x25B6 <= codePoint && codePoint <= 0x25B7) ||
1023
- (0x25BC <= codePoint && codePoint <= 0x25BD) ||
1024
- (0x25C0 <= codePoint && codePoint <= 0x25C1) ||
1025
- (0x25C6 <= codePoint && codePoint <= 0x25C8) ||
1026
- (0x25CB == codePoint) ||
1027
- (0x25CE <= codePoint && codePoint <= 0x25D1) ||
1028
- (0x25E2 <= codePoint && codePoint <= 0x25E5) ||
1029
- (0x25EF == codePoint) ||
1030
- (0x2605 <= codePoint && codePoint <= 0x2606) ||
1031
- (0x2609 == codePoint) ||
1032
- (0x260E <= codePoint && codePoint <= 0x260F) ||
1033
- (0x2614 <= codePoint && codePoint <= 0x2615) ||
1034
- (0x261C == codePoint) ||
1035
- (0x261E == codePoint) ||
1036
- (0x2640 == codePoint) ||
1037
- (0x2642 == codePoint) ||
1038
- (0x2660 <= codePoint && codePoint <= 0x2661) ||
1039
- (0x2663 <= codePoint && codePoint <= 0x2665) ||
1040
- (0x2667 <= codePoint && codePoint <= 0x266A) ||
1041
- (0x266C <= codePoint && codePoint <= 0x266D) ||
1042
- (0x266F == codePoint) ||
1043
- (0x269E <= codePoint && codePoint <= 0x269F) ||
1044
- (0x26BE <= codePoint && codePoint <= 0x26BF) ||
1045
- (0x26C4 <= codePoint && codePoint <= 0x26CD) ||
1046
- (0x26CF <= codePoint && codePoint <= 0x26E1) ||
1047
- (0x26E3 == codePoint) ||
1048
- (0x26E8 <= codePoint && codePoint <= 0x26FF) ||
1049
- (0x273D == codePoint) ||
1050
- (0x2757 == codePoint) ||
1051
- (0x2776 <= codePoint && codePoint <= 0x277F) ||
1052
- (0x2B55 <= codePoint && codePoint <= 0x2B59) ||
1053
- (0x3248 <= codePoint && codePoint <= 0x324F) ||
1054
- (0xE000 <= codePoint && codePoint <= 0xF8FF) ||
1055
- (0xFE00 <= codePoint && codePoint <= 0xFE0F) ||
1056
- (0xFFFD == codePoint) ||
1057
- (0x1F100 <= codePoint && codePoint <= 0x1F10A) ||
1058
- (0x1F110 <= codePoint && codePoint <= 0x1F12D) ||
1059
- (0x1F130 <= codePoint && codePoint <= 0x1F169) ||
1060
- (0x1F170 <= codePoint && codePoint <= 0x1F19A) ||
1061
- (0xE0100 <= codePoint && codePoint <= 0xE01EF) ||
1062
- (0xF0000 <= codePoint && codePoint <= 0xFFFFD) ||
1063
- (0x100000 <= codePoint && codePoint <= 0x10FFFD)) {
1064
- return 'A';
1065
- }
1066
-
1067
- return 'N';
1068
- };
1069
-
1070
- eaw.characterLength = function(character) {
1071
- var code = this.eastAsianWidth(character);
1072
- if (code == 'F' || code == 'W' || code == 'A') {
1073
- return 2;
1074
- } else {
1075
- return 1;
1076
- }
1077
- };
1078
-
1079
- // Split a string considering surrogate-pairs.
1080
- function stringToArray(string) {
1081
- return string.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
1082
- }
1083
-
1084
- eaw.length = function(string) {
1085
- var characters = stringToArray(string);
1086
- var len = 0;
1087
- for (var i = 0; i < characters.length; i++) {
1088
- len = len + this.characterLength(characters[i]);
1089
- }
1090
- return len;
1091
- };
1092
-
1093
- eaw.slice = function(text, start, end) {
1094
- textLen = eaw.length(text);
1095
- start = start ? start : 0;
1096
- end = end ? end : 1;
1097
- if (start < 0) {
1098
- start = textLen + start;
1099
- }
1100
- if (end < 0) {
1101
- end = textLen + end;
1102
- }
1103
- var result = '';
1104
- var eawLen = 0;
1105
- var chars = stringToArray(text);
1106
- for (var i = 0; i < chars.length; i++) {
1107
- var char = chars[i];
1108
- var charLen = eaw.length(char);
1109
- if (eawLen >= start - (charLen == 2 ? 1 : 0)) {
1110
- if (eawLen + charLen <= end) {
1111
- result += char;
1112
- } else {
1113
- break;
1114
- }
1115
- }
1116
- eawLen += charLen;
1117
- }
1118
- return result;
1119
- };
1120
- } (eastasianwidth));
1121
-
1122
- var eastasianwidthExports = eastasianwidth.exports;
1123
- const eastAsianWidth = /*@__PURE__*/getDefaultExportFromCjs(eastasianwidthExports);
1124
-
1125
- const emojiRegex = () => {
1126
- // https://mths.be/emoji
1127
- return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26F9(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC3\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\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]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC08\uDC26](?:\u200D\u2B1B)?|[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC2\uDECE-\uDEDB\uDEE0-\uDEE8]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
1128
- };
1129
-
1130
- function stringWidth$1(string, options) {
1131
- if (typeof string !== 'string' || string.length === 0) {
1132
- return 0;
1133
- }
1134
-
1135
- options = {
1136
- ambiguousIsNarrow: true,
1137
- countAnsiEscapeCodes: false,
1138
- ...options,
1139
- };
1140
-
1141
- if (!options.countAnsiEscapeCodes) {
1142
- string = stripAnsi(string);
1143
- }
1144
-
1145
- if (string.length === 0) {
1146
- return 0;
1147
- }
1148
-
1149
- const ambiguousCharacterWidth = options.ambiguousIsNarrow ? 1 : 2;
1150
- let width = 0;
1151
-
1152
- for (const {segment: character} of new Intl.Segmenter().segment(string)) {
1153
- const codePoint = character.codePointAt(0);
1154
-
1155
- // Ignore control characters
1156
- if (codePoint <= 0x1F || (codePoint >= 0x7F && codePoint <= 0x9F)) {
1157
- continue;
1158
- }
1159
-
1160
- // Ignore combining characters
1161
- if (codePoint >= 0x3_00 && codePoint <= 0x3_6F) {
1162
- continue;
1163
- }
1164
-
1165
- if (emojiRegex().test(character)) {
1166
- width += 2;
1167
- continue;
1168
- }
1169
-
1170
- const code = eastAsianWidth.eastAsianWidth(character);
1171
- switch (code) {
1172
- case 'F':
1173
- case 'W': {
1174
- width += 2;
1175
- break;
1176
- }
1177
-
1178
- case 'A': {
1179
- width += ambiguousCharacterWidth;
1180
- break;
1181
- }
1182
-
1183
- default: {
1184
- width += 1;
1185
- }
1186
- }
1187
- }
1188
-
1189
- return width;
1190
- }
1191
-
1192
- function isUnicodeSupported() {
1193
- if (process$1.platform !== 'win32') {
1194
- return process$1.env.TERM !== 'linux'; // Linux console (kernel)
1195
- }
1196
-
1197
- return Boolean(process$1.env.CI)
1198
- || Boolean(process$1.env.WT_SESSION) // Windows Terminal
1199
- || Boolean(process$1.env.TERMINUS_SUBLIME) // Terminus (<0.2.27)
1200
- || process$1.env.ConEmuTask === '{cmd::Cmder}' // ConEmu and cmder
1201
- || process$1.env.TERM_PROGRAM === 'Terminus-Sublime'
1202
- || process$1.env.TERM_PROGRAM === 'vscode'
1203
- || process$1.env.TERM === 'xterm-256color'
1204
- || process$1.env.TERM === 'alacritty'
1205
- || process$1.env.TERMINAL_EMULATOR === 'JetBrains-JediTerm';
1206
- }
1207
-
1208
- const TYPE_COLOR_MAP = {
1209
- info: "cyan",
1210
- fail: "red",
1211
- success: "green",
1212
- ready: "green",
1213
- start: "magenta"
1214
- };
1215
- const LEVEL_COLOR_MAP = {
1216
- 0: "red",
1217
- 1: "yellow"
1218
- };
1219
- const unicode = isUnicodeSupported();
1220
- const s = (c, fallback) => unicode ? c : fallback;
1221
- const TYPE_ICONS = {
1222
- error: s("\u2716", "\xD7"),
1223
- fatal: s("\u2716", "\xD7"),
1224
- ready: s("\u2714", "\u221A"),
1225
- warn: s("\u26A0", "\u203C"),
1226
- info: s("\u2139", "i"),
1227
- success: s("\u2714", "\u221A"),
1228
- debug: s("\u2699", "D"),
1229
- trace: s("\u2192", "\u2192"),
1230
- fail: s("\u2716", "\xD7"),
1231
- start: s("\u25D0", "o"),
1232
- log: ""
1233
- };
1234
- function stringWidth(str) {
1235
- if (!Intl.Segmenter) {
1236
- return stripAnsi$1(str).length;
1237
- }
1238
- return stringWidth$1(str);
1239
- }
1240
- class FancyReporter extends BasicReporter {
1241
- formatStack(stack) {
1242
- return "\n" + parseStack(stack).map(
1243
- (line) => " " + line.replace(/^at +/, (m) => colors.gray(m)).replace(/\((.+)\)/, (_, m) => `(${colors.cyan(m)})`)
1244
- ).join("\n");
1245
- }
1246
- formatType(logObj, isBadge, opts) {
1247
- const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
1248
- if (isBadge) {
1249
- return getBgColor(typeColor)(
1250
- colors.black(` ${logObj.type.toUpperCase()} `)
1251
- );
1252
- }
1253
- const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
1254
- return _type ? getColor(typeColor)(_type) : "";
1255
- }
1256
- formatLogObj(logObj, opts) {
1257
- const [message, ...additional] = this.formatArgs(logObj.args, opts).split(
1258
- "\n"
1259
- );
1260
- if (logObj.type === "box") {
1261
- return box(
1262
- characterFormat(
1263
- message + (additional.length > 0 ? "\n" + additional.join("\n") : "")
1264
- ),
1265
- {
1266
- title: logObj.title ? characterFormat(logObj.title) : void 0,
1267
- style: logObj.style
1268
- }
1269
- );
1270
- }
1271
- const date = this.formatDate(logObj.date, opts);
1272
- const coloredDate = date && colors.gray(date);
1273
- const isBadge = logObj.badge ?? logObj.level < 2;
1274
- const type = this.formatType(logObj, isBadge, opts);
1275
- const tag = logObj.tag ? colors.gray(logObj.tag) : "";
1276
- let line;
1277
- const left = this.filterAndJoin([type, characterFormat(message)]);
1278
- const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
1279
- const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
1280
- line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
1281
- line += characterFormat(
1282
- additional.length > 0 ? "\n" + additional.join("\n") : ""
1283
- );
1284
- if (logObj.type === "trace") {
1285
- const _err = new Error("Trace: " + logObj.message);
1286
- line += this.formatStack(_err.stack || "");
1287
- }
1288
- return isBadge ? "\n" + line + "\n" : line;
1289
- }
1290
- }
1291
- function characterFormat(str) {
1292
- return str.replace(/`([^`]+)`/gm, (_, m) => colors.cyan(m)).replace(/\s+_([^_]+)_\s+/gm, (_, m) => ` ${colors.underline(m)} `);
1293
- }
1294
- function getColor(color = "white") {
1295
- return colors[color] || colors.white;
1296
- }
1297
- function getBgColor(color = "bgWhite") {
1298
- return colors[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors.bgWhite;
1299
- }
1300
-
1301
- function createConsola(options = {}) {
1302
- let level = _getDefaultLogLevel$1();
1303
- if (process.env.CONSOLA_LEVEL) {
1304
- level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
1305
- }
1306
- const consola2 = createConsola$1({
1307
- level,
1308
- defaults: { level },
1309
- stdout: process.stdout,
1310
- stderr: process.stderr,
1311
- prompt: (...args) => import('../chunks/prompt.mjs').then((m) => m.prompt(...args)),
1312
- reporters: options.reporters || [
1313
- options.fancy ?? !(isCI || isTest) ? new FancyReporter() : new BasicReporter()
1314
- ],
1315
- ...options
1316
- });
1317
- return consola2;
1318
- }
1319
- function _getDefaultLogLevel$1() {
1320
- if (isDebug) {
1321
- return LogLevels.debug;
1322
- }
1323
- if (isTest) {
1324
- return LogLevels.warn;
1325
- }
1326
- return LogLevels.info;
1327
- }
1328
- createConsola();
1329
-
1330
- function _getDefaultLogLevel() {
1331
- return LogLevels.debug;
1332
- }
1333
- const level = _getDefaultLogLevel();
1334
- const consola = createConsola({
1335
- level,
1336
- defaults: {
1337
- level
1338
- },
1339
- formatOptions: {
1340
- colors: true,
1341
- compact: false,
1342
- date: false
1343
- }
1344
- });
1345
-
1346
- export { LogLevels as L, consola as a, colors as c, getDefaultExportFromCjs as g, isUnicodeSupported as i };