@nsshunt/stsutils 1.16.46 → 1.16.48

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/stsutils.mjs CHANGED
@@ -24,6 +24,1438 @@ var __privateSet = (obj, member, value, setter) => {
24
24
  };
25
25
  var _options;
26
26
  import Ajv from "ajv/dist/jtd.js";
27
+ function getDefaultExportFromCjs(x) {
28
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
29
+ }
30
+ var ansiStyles$1 = { exports: {} };
31
+ var colorName;
32
+ var hasRequiredColorName;
33
+ function requireColorName() {
34
+ if (hasRequiredColorName)
35
+ return colorName;
36
+ hasRequiredColorName = 1;
37
+ colorName = {
38
+ "aliceblue": [240, 248, 255],
39
+ "antiquewhite": [250, 235, 215],
40
+ "aqua": [0, 255, 255],
41
+ "aquamarine": [127, 255, 212],
42
+ "azure": [240, 255, 255],
43
+ "beige": [245, 245, 220],
44
+ "bisque": [255, 228, 196],
45
+ "black": [0, 0, 0],
46
+ "blanchedalmond": [255, 235, 205],
47
+ "blue": [0, 0, 255],
48
+ "blueviolet": [138, 43, 226],
49
+ "brown": [165, 42, 42],
50
+ "burlywood": [222, 184, 135],
51
+ "cadetblue": [95, 158, 160],
52
+ "chartreuse": [127, 255, 0],
53
+ "chocolate": [210, 105, 30],
54
+ "coral": [255, 127, 80],
55
+ "cornflowerblue": [100, 149, 237],
56
+ "cornsilk": [255, 248, 220],
57
+ "crimson": [220, 20, 60],
58
+ "cyan": [0, 255, 255],
59
+ "darkblue": [0, 0, 139],
60
+ "darkcyan": [0, 139, 139],
61
+ "darkgoldenrod": [184, 134, 11],
62
+ "darkgray": [169, 169, 169],
63
+ "darkgreen": [0, 100, 0],
64
+ "darkgrey": [169, 169, 169],
65
+ "darkkhaki": [189, 183, 107],
66
+ "darkmagenta": [139, 0, 139],
67
+ "darkolivegreen": [85, 107, 47],
68
+ "darkorange": [255, 140, 0],
69
+ "darkorchid": [153, 50, 204],
70
+ "darkred": [139, 0, 0],
71
+ "darksalmon": [233, 150, 122],
72
+ "darkseagreen": [143, 188, 143],
73
+ "darkslateblue": [72, 61, 139],
74
+ "darkslategray": [47, 79, 79],
75
+ "darkslategrey": [47, 79, 79],
76
+ "darkturquoise": [0, 206, 209],
77
+ "darkviolet": [148, 0, 211],
78
+ "deeppink": [255, 20, 147],
79
+ "deepskyblue": [0, 191, 255],
80
+ "dimgray": [105, 105, 105],
81
+ "dimgrey": [105, 105, 105],
82
+ "dodgerblue": [30, 144, 255],
83
+ "firebrick": [178, 34, 34],
84
+ "floralwhite": [255, 250, 240],
85
+ "forestgreen": [34, 139, 34],
86
+ "fuchsia": [255, 0, 255],
87
+ "gainsboro": [220, 220, 220],
88
+ "ghostwhite": [248, 248, 255],
89
+ "gold": [255, 215, 0],
90
+ "goldenrod": [218, 165, 32],
91
+ "gray": [128, 128, 128],
92
+ "green": [0, 128, 0],
93
+ "greenyellow": [173, 255, 47],
94
+ "grey": [128, 128, 128],
95
+ "honeydew": [240, 255, 240],
96
+ "hotpink": [255, 105, 180],
97
+ "indianred": [205, 92, 92],
98
+ "indigo": [75, 0, 130],
99
+ "ivory": [255, 255, 240],
100
+ "khaki": [240, 230, 140],
101
+ "lavender": [230, 230, 250],
102
+ "lavenderblush": [255, 240, 245],
103
+ "lawngreen": [124, 252, 0],
104
+ "lemonchiffon": [255, 250, 205],
105
+ "lightblue": [173, 216, 230],
106
+ "lightcoral": [240, 128, 128],
107
+ "lightcyan": [224, 255, 255],
108
+ "lightgoldenrodyellow": [250, 250, 210],
109
+ "lightgray": [211, 211, 211],
110
+ "lightgreen": [144, 238, 144],
111
+ "lightgrey": [211, 211, 211],
112
+ "lightpink": [255, 182, 193],
113
+ "lightsalmon": [255, 160, 122],
114
+ "lightseagreen": [32, 178, 170],
115
+ "lightskyblue": [135, 206, 250],
116
+ "lightslategray": [119, 136, 153],
117
+ "lightslategrey": [119, 136, 153],
118
+ "lightsteelblue": [176, 196, 222],
119
+ "lightyellow": [255, 255, 224],
120
+ "lime": [0, 255, 0],
121
+ "limegreen": [50, 205, 50],
122
+ "linen": [250, 240, 230],
123
+ "magenta": [255, 0, 255],
124
+ "maroon": [128, 0, 0],
125
+ "mediumaquamarine": [102, 205, 170],
126
+ "mediumblue": [0, 0, 205],
127
+ "mediumorchid": [186, 85, 211],
128
+ "mediumpurple": [147, 112, 219],
129
+ "mediumseagreen": [60, 179, 113],
130
+ "mediumslateblue": [123, 104, 238],
131
+ "mediumspringgreen": [0, 250, 154],
132
+ "mediumturquoise": [72, 209, 204],
133
+ "mediumvioletred": [199, 21, 133],
134
+ "midnightblue": [25, 25, 112],
135
+ "mintcream": [245, 255, 250],
136
+ "mistyrose": [255, 228, 225],
137
+ "moccasin": [255, 228, 181],
138
+ "navajowhite": [255, 222, 173],
139
+ "navy": [0, 0, 128],
140
+ "oldlace": [253, 245, 230],
141
+ "olive": [128, 128, 0],
142
+ "olivedrab": [107, 142, 35],
143
+ "orange": [255, 165, 0],
144
+ "orangered": [255, 69, 0],
145
+ "orchid": [218, 112, 214],
146
+ "palegoldenrod": [238, 232, 170],
147
+ "palegreen": [152, 251, 152],
148
+ "paleturquoise": [175, 238, 238],
149
+ "palevioletred": [219, 112, 147],
150
+ "papayawhip": [255, 239, 213],
151
+ "peachpuff": [255, 218, 185],
152
+ "peru": [205, 133, 63],
153
+ "pink": [255, 192, 203],
154
+ "plum": [221, 160, 221],
155
+ "powderblue": [176, 224, 230],
156
+ "purple": [128, 0, 128],
157
+ "rebeccapurple": [102, 51, 153],
158
+ "red": [255, 0, 0],
159
+ "rosybrown": [188, 143, 143],
160
+ "royalblue": [65, 105, 225],
161
+ "saddlebrown": [139, 69, 19],
162
+ "salmon": [250, 128, 114],
163
+ "sandybrown": [244, 164, 96],
164
+ "seagreen": [46, 139, 87],
165
+ "seashell": [255, 245, 238],
166
+ "sienna": [160, 82, 45],
167
+ "silver": [192, 192, 192],
168
+ "skyblue": [135, 206, 235],
169
+ "slateblue": [106, 90, 205],
170
+ "slategray": [112, 128, 144],
171
+ "slategrey": [112, 128, 144],
172
+ "snow": [255, 250, 250],
173
+ "springgreen": [0, 255, 127],
174
+ "steelblue": [70, 130, 180],
175
+ "tan": [210, 180, 140],
176
+ "teal": [0, 128, 128],
177
+ "thistle": [216, 191, 216],
178
+ "tomato": [255, 99, 71],
179
+ "turquoise": [64, 224, 208],
180
+ "violet": [238, 130, 238],
181
+ "wheat": [245, 222, 179],
182
+ "white": [255, 255, 255],
183
+ "whitesmoke": [245, 245, 245],
184
+ "yellow": [255, 255, 0],
185
+ "yellowgreen": [154, 205, 50]
186
+ };
187
+ return colorName;
188
+ }
189
+ var conversions;
190
+ var hasRequiredConversions;
191
+ function requireConversions() {
192
+ if (hasRequiredConversions)
193
+ return conversions;
194
+ hasRequiredConversions = 1;
195
+ const cssKeywords = requireColorName();
196
+ const reverseKeywords = {};
197
+ for (const key of Object.keys(cssKeywords)) {
198
+ reverseKeywords[cssKeywords[key]] = key;
199
+ }
200
+ const convert = {
201
+ rgb: { channels: 3, labels: "rgb" },
202
+ hsl: { channels: 3, labels: "hsl" },
203
+ hsv: { channels: 3, labels: "hsv" },
204
+ hwb: { channels: 3, labels: "hwb" },
205
+ cmyk: { channels: 4, labels: "cmyk" },
206
+ xyz: { channels: 3, labels: "xyz" },
207
+ lab: { channels: 3, labels: "lab" },
208
+ lch: { channels: 3, labels: "lch" },
209
+ hex: { channels: 1, labels: ["hex"] },
210
+ keyword: { channels: 1, labels: ["keyword"] },
211
+ ansi16: { channels: 1, labels: ["ansi16"] },
212
+ ansi256: { channels: 1, labels: ["ansi256"] },
213
+ hcg: { channels: 3, labels: ["h", "c", "g"] },
214
+ apple: { channels: 3, labels: ["r16", "g16", "b16"] },
215
+ gray: { channels: 1, labels: ["gray"] }
216
+ };
217
+ conversions = convert;
218
+ for (const model of Object.keys(convert)) {
219
+ if (!("channels" in convert[model])) {
220
+ throw new Error("missing channels property: " + model);
221
+ }
222
+ if (!("labels" in convert[model])) {
223
+ throw new Error("missing channel labels property: " + model);
224
+ }
225
+ if (convert[model].labels.length !== convert[model].channels) {
226
+ throw new Error("channel and label counts mismatch: " + model);
227
+ }
228
+ const { channels, labels } = convert[model];
229
+ delete convert[model].channels;
230
+ delete convert[model].labels;
231
+ Object.defineProperty(convert[model], "channels", { value: channels });
232
+ Object.defineProperty(convert[model], "labels", { value: labels });
233
+ }
234
+ convert.rgb.hsl = function(rgb) {
235
+ const r = rgb[0] / 255;
236
+ const g = rgb[1] / 255;
237
+ const b = rgb[2] / 255;
238
+ const min = Math.min(r, g, b);
239
+ const max = Math.max(r, g, b);
240
+ const delta = max - min;
241
+ let h;
242
+ let s;
243
+ if (max === min) {
244
+ h = 0;
245
+ } else if (r === max) {
246
+ h = (g - b) / delta;
247
+ } else if (g === max) {
248
+ h = 2 + (b - r) / delta;
249
+ } else if (b === max) {
250
+ h = 4 + (r - g) / delta;
251
+ }
252
+ h = Math.min(h * 60, 360);
253
+ if (h < 0) {
254
+ h += 360;
255
+ }
256
+ const l = (min + max) / 2;
257
+ if (max === min) {
258
+ s = 0;
259
+ } else if (l <= 0.5) {
260
+ s = delta / (max + min);
261
+ } else {
262
+ s = delta / (2 - max - min);
263
+ }
264
+ return [h, s * 100, l * 100];
265
+ };
266
+ convert.rgb.hsv = function(rgb) {
267
+ let rdif;
268
+ let gdif;
269
+ let bdif;
270
+ let h;
271
+ let s;
272
+ const r = rgb[0] / 255;
273
+ const g = rgb[1] / 255;
274
+ const b = rgb[2] / 255;
275
+ const v = Math.max(r, g, b);
276
+ const diff = v - Math.min(r, g, b);
277
+ const diffc = function(c) {
278
+ return (v - c) / 6 / diff + 1 / 2;
279
+ };
280
+ if (diff === 0) {
281
+ h = 0;
282
+ s = 0;
283
+ } else {
284
+ s = diff / v;
285
+ rdif = diffc(r);
286
+ gdif = diffc(g);
287
+ bdif = diffc(b);
288
+ if (r === v) {
289
+ h = bdif - gdif;
290
+ } else if (g === v) {
291
+ h = 1 / 3 + rdif - bdif;
292
+ } else if (b === v) {
293
+ h = 2 / 3 + gdif - rdif;
294
+ }
295
+ if (h < 0) {
296
+ h += 1;
297
+ } else if (h > 1) {
298
+ h -= 1;
299
+ }
300
+ }
301
+ return [
302
+ h * 360,
303
+ s * 100,
304
+ v * 100
305
+ ];
306
+ };
307
+ convert.rgb.hwb = function(rgb) {
308
+ const r = rgb[0];
309
+ const g = rgb[1];
310
+ let b = rgb[2];
311
+ const h = convert.rgb.hsl(rgb)[0];
312
+ const w = 1 / 255 * Math.min(r, Math.min(g, b));
313
+ b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
314
+ return [h, w * 100, b * 100];
315
+ };
316
+ convert.rgb.cmyk = function(rgb) {
317
+ const r = rgb[0] / 255;
318
+ const g = rgb[1] / 255;
319
+ const b = rgb[2] / 255;
320
+ const k = Math.min(1 - r, 1 - g, 1 - b);
321
+ const c = (1 - r - k) / (1 - k) || 0;
322
+ const m = (1 - g - k) / (1 - k) || 0;
323
+ const y = (1 - b - k) / (1 - k) || 0;
324
+ return [c * 100, m * 100, y * 100, k * 100];
325
+ };
326
+ function comparativeDistance(x, y) {
327
+ return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
328
+ }
329
+ convert.rgb.keyword = function(rgb) {
330
+ const reversed = reverseKeywords[rgb];
331
+ if (reversed) {
332
+ return reversed;
333
+ }
334
+ let currentClosestDistance = Infinity;
335
+ let currentClosestKeyword;
336
+ for (const keyword of Object.keys(cssKeywords)) {
337
+ const value = cssKeywords[keyword];
338
+ const distance = comparativeDistance(rgb, value);
339
+ if (distance < currentClosestDistance) {
340
+ currentClosestDistance = distance;
341
+ currentClosestKeyword = keyword;
342
+ }
343
+ }
344
+ return currentClosestKeyword;
345
+ };
346
+ convert.keyword.rgb = function(keyword) {
347
+ return cssKeywords[keyword];
348
+ };
349
+ convert.rgb.xyz = function(rgb) {
350
+ let r = rgb[0] / 255;
351
+ let g = rgb[1] / 255;
352
+ let b = rgb[2] / 255;
353
+ r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
354
+ g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92;
355
+ b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92;
356
+ const x = r * 0.4124 + g * 0.3576 + b * 0.1805;
357
+ const y = r * 0.2126 + g * 0.7152 + b * 0.0722;
358
+ const z = r * 0.0193 + g * 0.1192 + b * 0.9505;
359
+ return [x * 100, y * 100, z * 100];
360
+ };
361
+ convert.rgb.lab = function(rgb) {
362
+ const xyz = convert.rgb.xyz(rgb);
363
+ let x = xyz[0];
364
+ let y = xyz[1];
365
+ let z = xyz[2];
366
+ x /= 95.047;
367
+ y /= 100;
368
+ z /= 108.883;
369
+ x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
370
+ y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
371
+ z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
372
+ const l = 116 * y - 16;
373
+ const a = 500 * (x - y);
374
+ const b = 200 * (y - z);
375
+ return [l, a, b];
376
+ };
377
+ convert.hsl.rgb = function(hsl) {
378
+ const h = hsl[0] / 360;
379
+ const s = hsl[1] / 100;
380
+ const l = hsl[2] / 100;
381
+ let t2;
382
+ let t3;
383
+ let val;
384
+ if (s === 0) {
385
+ val = l * 255;
386
+ return [val, val, val];
387
+ }
388
+ if (l < 0.5) {
389
+ t2 = l * (1 + s);
390
+ } else {
391
+ t2 = l + s - l * s;
392
+ }
393
+ const t1 = 2 * l - t2;
394
+ const rgb = [0, 0, 0];
395
+ for (let i = 0; i < 3; i++) {
396
+ t3 = h + 1 / 3 * -(i - 1);
397
+ if (t3 < 0) {
398
+ t3++;
399
+ }
400
+ if (t3 > 1) {
401
+ t3--;
402
+ }
403
+ if (6 * t3 < 1) {
404
+ val = t1 + (t2 - t1) * 6 * t3;
405
+ } else if (2 * t3 < 1) {
406
+ val = t2;
407
+ } else if (3 * t3 < 2) {
408
+ val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
409
+ } else {
410
+ val = t1;
411
+ }
412
+ rgb[i] = val * 255;
413
+ }
414
+ return rgb;
415
+ };
416
+ convert.hsl.hsv = function(hsl) {
417
+ const h = hsl[0];
418
+ let s = hsl[1] / 100;
419
+ let l = hsl[2] / 100;
420
+ let smin = s;
421
+ const lmin = Math.max(l, 0.01);
422
+ l *= 2;
423
+ s *= l <= 1 ? l : 2 - l;
424
+ smin *= lmin <= 1 ? lmin : 2 - lmin;
425
+ const v = (l + s) / 2;
426
+ const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
427
+ return [h, sv * 100, v * 100];
428
+ };
429
+ convert.hsv.rgb = function(hsv) {
430
+ const h = hsv[0] / 60;
431
+ const s = hsv[1] / 100;
432
+ let v = hsv[2] / 100;
433
+ const hi = Math.floor(h) % 6;
434
+ const f = h - Math.floor(h);
435
+ const p = 255 * v * (1 - s);
436
+ const q = 255 * v * (1 - s * f);
437
+ const t = 255 * v * (1 - s * (1 - f));
438
+ v *= 255;
439
+ switch (hi) {
440
+ case 0:
441
+ return [v, t, p];
442
+ case 1:
443
+ return [q, v, p];
444
+ case 2:
445
+ return [p, v, t];
446
+ case 3:
447
+ return [p, q, v];
448
+ case 4:
449
+ return [t, p, v];
450
+ case 5:
451
+ return [v, p, q];
452
+ }
453
+ };
454
+ convert.hsv.hsl = function(hsv) {
455
+ const h = hsv[0];
456
+ const s = hsv[1] / 100;
457
+ const v = hsv[2] / 100;
458
+ const vmin = Math.max(v, 0.01);
459
+ let sl;
460
+ let l;
461
+ l = (2 - s) * v;
462
+ const lmin = (2 - s) * vmin;
463
+ sl = s * vmin;
464
+ sl /= lmin <= 1 ? lmin : 2 - lmin;
465
+ sl = sl || 0;
466
+ l /= 2;
467
+ return [h, sl * 100, l * 100];
468
+ };
469
+ convert.hwb.rgb = function(hwb) {
470
+ const h = hwb[0] / 360;
471
+ let wh = hwb[1] / 100;
472
+ let bl = hwb[2] / 100;
473
+ const ratio = wh + bl;
474
+ let f;
475
+ if (ratio > 1) {
476
+ wh /= ratio;
477
+ bl /= ratio;
478
+ }
479
+ const i = Math.floor(6 * h);
480
+ const v = 1 - bl;
481
+ f = 6 * h - i;
482
+ if ((i & 1) !== 0) {
483
+ f = 1 - f;
484
+ }
485
+ const n = wh + f * (v - wh);
486
+ let r;
487
+ let g;
488
+ let b;
489
+ switch (i) {
490
+ default:
491
+ case 6:
492
+ case 0:
493
+ r = v;
494
+ g = n;
495
+ b = wh;
496
+ break;
497
+ case 1:
498
+ r = n;
499
+ g = v;
500
+ b = wh;
501
+ break;
502
+ case 2:
503
+ r = wh;
504
+ g = v;
505
+ b = n;
506
+ break;
507
+ case 3:
508
+ r = wh;
509
+ g = n;
510
+ b = v;
511
+ break;
512
+ case 4:
513
+ r = n;
514
+ g = wh;
515
+ b = v;
516
+ break;
517
+ case 5:
518
+ r = v;
519
+ g = wh;
520
+ b = n;
521
+ break;
522
+ }
523
+ return [r * 255, g * 255, b * 255];
524
+ };
525
+ convert.cmyk.rgb = function(cmyk) {
526
+ const c = cmyk[0] / 100;
527
+ const m = cmyk[1] / 100;
528
+ const y = cmyk[2] / 100;
529
+ const k = cmyk[3] / 100;
530
+ const r = 1 - Math.min(1, c * (1 - k) + k);
531
+ const g = 1 - Math.min(1, m * (1 - k) + k);
532
+ const b = 1 - Math.min(1, y * (1 - k) + k);
533
+ return [r * 255, g * 255, b * 255];
534
+ };
535
+ convert.xyz.rgb = function(xyz) {
536
+ const x = xyz[0] / 100;
537
+ const y = xyz[1] / 100;
538
+ const z = xyz[2] / 100;
539
+ let r;
540
+ let g;
541
+ let b;
542
+ r = x * 3.2406 + y * -1.5372 + z * -0.4986;
543
+ g = x * -0.9689 + y * 1.8758 + z * 0.0415;
544
+ b = x * 0.0557 + y * -0.204 + z * 1.057;
545
+ r = r > 31308e-7 ? 1.055 * r ** (1 / 2.4) - 0.055 : r * 12.92;
546
+ g = g > 31308e-7 ? 1.055 * g ** (1 / 2.4) - 0.055 : g * 12.92;
547
+ b = b > 31308e-7 ? 1.055 * b ** (1 / 2.4) - 0.055 : b * 12.92;
548
+ r = Math.min(Math.max(0, r), 1);
549
+ g = Math.min(Math.max(0, g), 1);
550
+ b = Math.min(Math.max(0, b), 1);
551
+ return [r * 255, g * 255, b * 255];
552
+ };
553
+ convert.xyz.lab = function(xyz) {
554
+ let x = xyz[0];
555
+ let y = xyz[1];
556
+ let z = xyz[2];
557
+ x /= 95.047;
558
+ y /= 100;
559
+ z /= 108.883;
560
+ x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
561
+ y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
562
+ z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
563
+ const l = 116 * y - 16;
564
+ const a = 500 * (x - y);
565
+ const b = 200 * (y - z);
566
+ return [l, a, b];
567
+ };
568
+ convert.lab.xyz = function(lab) {
569
+ const l = lab[0];
570
+ const a = lab[1];
571
+ const b = lab[2];
572
+ let x;
573
+ let y;
574
+ let z;
575
+ y = (l + 16) / 116;
576
+ x = a / 500 + y;
577
+ z = y - b / 200;
578
+ const y2 = y ** 3;
579
+ const x2 = x ** 3;
580
+ const z2 = z ** 3;
581
+ y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
582
+ x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
583
+ z = z2 > 8856e-6 ? z2 : (z - 16 / 116) / 7.787;
584
+ x *= 95.047;
585
+ y *= 100;
586
+ z *= 108.883;
587
+ return [x, y, z];
588
+ };
589
+ convert.lab.lch = function(lab) {
590
+ const l = lab[0];
591
+ const a = lab[1];
592
+ const b = lab[2];
593
+ let h;
594
+ const hr = Math.atan2(b, a);
595
+ h = hr * 360 / 2 / Math.PI;
596
+ if (h < 0) {
597
+ h += 360;
598
+ }
599
+ const c = Math.sqrt(a * a + b * b);
600
+ return [l, c, h];
601
+ };
602
+ convert.lch.lab = function(lch) {
603
+ const l = lch[0];
604
+ const c = lch[1];
605
+ const h = lch[2];
606
+ const hr = h / 360 * 2 * Math.PI;
607
+ const a = c * Math.cos(hr);
608
+ const b = c * Math.sin(hr);
609
+ return [l, a, b];
610
+ };
611
+ convert.rgb.ansi16 = function(args, saturation = null) {
612
+ const [r, g, b] = args;
613
+ let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation;
614
+ value = Math.round(value / 50);
615
+ if (value === 0) {
616
+ return 30;
617
+ }
618
+ let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
619
+ if (value === 2) {
620
+ ansi += 60;
621
+ }
622
+ return ansi;
623
+ };
624
+ convert.hsv.ansi16 = function(args) {
625
+ return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
626
+ };
627
+ convert.rgb.ansi256 = function(args) {
628
+ const r = args[0];
629
+ const g = args[1];
630
+ const b = args[2];
631
+ if (r === g && g === b) {
632
+ if (r < 8) {
633
+ return 16;
634
+ }
635
+ if (r > 248) {
636
+ return 231;
637
+ }
638
+ return Math.round((r - 8) / 247 * 24) + 232;
639
+ }
640
+ const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
641
+ return ansi;
642
+ };
643
+ convert.ansi16.rgb = function(args) {
644
+ let color = args % 10;
645
+ if (color === 0 || color === 7) {
646
+ if (args > 50) {
647
+ color += 3.5;
648
+ }
649
+ color = color / 10.5 * 255;
650
+ return [color, color, color];
651
+ }
652
+ const mult = (~~(args > 50) + 1) * 0.5;
653
+ const r = (color & 1) * mult * 255;
654
+ const g = (color >> 1 & 1) * mult * 255;
655
+ const b = (color >> 2 & 1) * mult * 255;
656
+ return [r, g, b];
657
+ };
658
+ convert.ansi256.rgb = function(args) {
659
+ if (args >= 232) {
660
+ const c = (args - 232) * 10 + 8;
661
+ return [c, c, c];
662
+ }
663
+ args -= 16;
664
+ let rem;
665
+ const r = Math.floor(args / 36) / 5 * 255;
666
+ const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
667
+ const b = rem % 6 / 5 * 255;
668
+ return [r, g, b];
669
+ };
670
+ convert.rgb.hex = function(args) {
671
+ const integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
672
+ const string = integer.toString(16).toUpperCase();
673
+ return "000000".substring(string.length) + string;
674
+ };
675
+ convert.hex.rgb = function(args) {
676
+ const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
677
+ if (!match) {
678
+ return [0, 0, 0];
679
+ }
680
+ let colorString = match[0];
681
+ if (match[0].length === 3) {
682
+ colorString = colorString.split("").map((char) => {
683
+ return char + char;
684
+ }).join("");
685
+ }
686
+ const integer = parseInt(colorString, 16);
687
+ const r = integer >> 16 & 255;
688
+ const g = integer >> 8 & 255;
689
+ const b = integer & 255;
690
+ return [r, g, b];
691
+ };
692
+ convert.rgb.hcg = function(rgb) {
693
+ const r = rgb[0] / 255;
694
+ const g = rgb[1] / 255;
695
+ const b = rgb[2] / 255;
696
+ const max = Math.max(Math.max(r, g), b);
697
+ const min = Math.min(Math.min(r, g), b);
698
+ const chroma = max - min;
699
+ let grayscale;
700
+ let hue;
701
+ if (chroma < 1) {
702
+ grayscale = min / (1 - chroma);
703
+ } else {
704
+ grayscale = 0;
705
+ }
706
+ if (chroma <= 0) {
707
+ hue = 0;
708
+ } else if (max === r) {
709
+ hue = (g - b) / chroma % 6;
710
+ } else if (max === g) {
711
+ hue = 2 + (b - r) / chroma;
712
+ } else {
713
+ hue = 4 + (r - g) / chroma;
714
+ }
715
+ hue /= 6;
716
+ hue %= 1;
717
+ return [hue * 360, chroma * 100, grayscale * 100];
718
+ };
719
+ convert.hsl.hcg = function(hsl) {
720
+ const s = hsl[1] / 100;
721
+ const l = hsl[2] / 100;
722
+ const c = l < 0.5 ? 2 * s * l : 2 * s * (1 - l);
723
+ let f = 0;
724
+ if (c < 1) {
725
+ f = (l - 0.5 * c) / (1 - c);
726
+ }
727
+ return [hsl[0], c * 100, f * 100];
728
+ };
729
+ convert.hsv.hcg = function(hsv) {
730
+ const s = hsv[1] / 100;
731
+ const v = hsv[2] / 100;
732
+ const c = s * v;
733
+ let f = 0;
734
+ if (c < 1) {
735
+ f = (v - c) / (1 - c);
736
+ }
737
+ return [hsv[0], c * 100, f * 100];
738
+ };
739
+ convert.hcg.rgb = function(hcg) {
740
+ const h = hcg[0] / 360;
741
+ const c = hcg[1] / 100;
742
+ const g = hcg[2] / 100;
743
+ if (c === 0) {
744
+ return [g * 255, g * 255, g * 255];
745
+ }
746
+ const pure = [0, 0, 0];
747
+ const hi = h % 1 * 6;
748
+ const v = hi % 1;
749
+ const w = 1 - v;
750
+ let mg = 0;
751
+ switch (Math.floor(hi)) {
752
+ case 0:
753
+ pure[0] = 1;
754
+ pure[1] = v;
755
+ pure[2] = 0;
756
+ break;
757
+ case 1:
758
+ pure[0] = w;
759
+ pure[1] = 1;
760
+ pure[2] = 0;
761
+ break;
762
+ case 2:
763
+ pure[0] = 0;
764
+ pure[1] = 1;
765
+ pure[2] = v;
766
+ break;
767
+ case 3:
768
+ pure[0] = 0;
769
+ pure[1] = w;
770
+ pure[2] = 1;
771
+ break;
772
+ case 4:
773
+ pure[0] = v;
774
+ pure[1] = 0;
775
+ pure[2] = 1;
776
+ break;
777
+ default:
778
+ pure[0] = 1;
779
+ pure[1] = 0;
780
+ pure[2] = w;
781
+ }
782
+ mg = (1 - c) * g;
783
+ return [
784
+ (c * pure[0] + mg) * 255,
785
+ (c * pure[1] + mg) * 255,
786
+ (c * pure[2] + mg) * 255
787
+ ];
788
+ };
789
+ convert.hcg.hsv = function(hcg) {
790
+ const c = hcg[1] / 100;
791
+ const g = hcg[2] / 100;
792
+ const v = c + g * (1 - c);
793
+ let f = 0;
794
+ if (v > 0) {
795
+ f = c / v;
796
+ }
797
+ return [hcg[0], f * 100, v * 100];
798
+ };
799
+ convert.hcg.hsl = function(hcg) {
800
+ const c = hcg[1] / 100;
801
+ const g = hcg[2] / 100;
802
+ const l = g * (1 - c) + 0.5 * c;
803
+ let s = 0;
804
+ if (l > 0 && l < 0.5) {
805
+ s = c / (2 * l);
806
+ } else if (l >= 0.5 && l < 1) {
807
+ s = c / (2 * (1 - l));
808
+ }
809
+ return [hcg[0], s * 100, l * 100];
810
+ };
811
+ convert.hcg.hwb = function(hcg) {
812
+ const c = hcg[1] / 100;
813
+ const g = hcg[2] / 100;
814
+ const v = c + g * (1 - c);
815
+ return [hcg[0], (v - c) * 100, (1 - v) * 100];
816
+ };
817
+ convert.hwb.hcg = function(hwb) {
818
+ const w = hwb[1] / 100;
819
+ const b = hwb[2] / 100;
820
+ const v = 1 - b;
821
+ const c = v - w;
822
+ let g = 0;
823
+ if (c < 1) {
824
+ g = (v - c) / (1 - c);
825
+ }
826
+ return [hwb[0], c * 100, g * 100];
827
+ };
828
+ convert.apple.rgb = function(apple) {
829
+ return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
830
+ };
831
+ convert.rgb.apple = function(rgb) {
832
+ return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
833
+ };
834
+ convert.gray.rgb = function(args) {
835
+ return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
836
+ };
837
+ convert.gray.hsl = function(args) {
838
+ return [0, 0, args[0]];
839
+ };
840
+ convert.gray.hsv = convert.gray.hsl;
841
+ convert.gray.hwb = function(gray) {
842
+ return [0, 100, gray[0]];
843
+ };
844
+ convert.gray.cmyk = function(gray) {
845
+ return [0, 0, 0, gray[0]];
846
+ };
847
+ convert.gray.lab = function(gray) {
848
+ return [gray[0], 0, 0];
849
+ };
850
+ convert.gray.hex = function(gray) {
851
+ const val = Math.round(gray[0] / 100 * 255) & 255;
852
+ const integer = (val << 16) + (val << 8) + val;
853
+ const string = integer.toString(16).toUpperCase();
854
+ return "000000".substring(string.length) + string;
855
+ };
856
+ convert.rgb.gray = function(rgb) {
857
+ const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
858
+ return [val / 255 * 100];
859
+ };
860
+ return conversions;
861
+ }
862
+ var route;
863
+ var hasRequiredRoute;
864
+ function requireRoute() {
865
+ if (hasRequiredRoute)
866
+ return route;
867
+ hasRequiredRoute = 1;
868
+ const conversions2 = requireConversions();
869
+ function buildGraph() {
870
+ const graph = {};
871
+ const models = Object.keys(conversions2);
872
+ for (let len = models.length, i = 0; i < len; i++) {
873
+ graph[models[i]] = {
874
+ // http://jsperf.com/1-vs-infinity
875
+ // micro-opt, but this is simple.
876
+ distance: -1,
877
+ parent: null
878
+ };
879
+ }
880
+ return graph;
881
+ }
882
+ function deriveBFS(fromModel) {
883
+ const graph = buildGraph();
884
+ const queue = [fromModel];
885
+ graph[fromModel].distance = 0;
886
+ while (queue.length) {
887
+ const current = queue.pop();
888
+ const adjacents = Object.keys(conversions2[current]);
889
+ for (let len = adjacents.length, i = 0; i < len; i++) {
890
+ const adjacent = adjacents[i];
891
+ const node = graph[adjacent];
892
+ if (node.distance === -1) {
893
+ node.distance = graph[current].distance + 1;
894
+ node.parent = current;
895
+ queue.unshift(adjacent);
896
+ }
897
+ }
898
+ }
899
+ return graph;
900
+ }
901
+ function link(from, to) {
902
+ return function(args) {
903
+ return to(from(args));
904
+ };
905
+ }
906
+ function wrapConversion(toModel, graph) {
907
+ const path = [graph[toModel].parent, toModel];
908
+ let fn = conversions2[graph[toModel].parent][toModel];
909
+ let cur = graph[toModel].parent;
910
+ while (graph[cur].parent) {
911
+ path.unshift(graph[cur].parent);
912
+ fn = link(conversions2[graph[cur].parent][cur], fn);
913
+ cur = graph[cur].parent;
914
+ }
915
+ fn.conversion = path;
916
+ return fn;
917
+ }
918
+ route = function(fromModel) {
919
+ const graph = deriveBFS(fromModel);
920
+ const conversion = {};
921
+ const models = Object.keys(graph);
922
+ for (let len = models.length, i = 0; i < len; i++) {
923
+ const toModel = models[i];
924
+ const node = graph[toModel];
925
+ if (node.parent === null) {
926
+ continue;
927
+ }
928
+ conversion[toModel] = wrapConversion(toModel, graph);
929
+ }
930
+ return conversion;
931
+ };
932
+ return route;
933
+ }
934
+ var colorConvert;
935
+ var hasRequiredColorConvert;
936
+ function requireColorConvert() {
937
+ if (hasRequiredColorConvert)
938
+ return colorConvert;
939
+ hasRequiredColorConvert = 1;
940
+ const conversions2 = requireConversions();
941
+ const route2 = requireRoute();
942
+ const convert = {};
943
+ const models = Object.keys(conversions2);
944
+ function wrapRaw(fn) {
945
+ const wrappedFn = function(...args) {
946
+ const arg0 = args[0];
947
+ if (arg0 === void 0 || arg0 === null) {
948
+ return arg0;
949
+ }
950
+ if (arg0.length > 1) {
951
+ args = arg0;
952
+ }
953
+ return fn(args);
954
+ };
955
+ if ("conversion" in fn) {
956
+ wrappedFn.conversion = fn.conversion;
957
+ }
958
+ return wrappedFn;
959
+ }
960
+ function wrapRounded(fn) {
961
+ const wrappedFn = function(...args) {
962
+ const arg0 = args[0];
963
+ if (arg0 === void 0 || arg0 === null) {
964
+ return arg0;
965
+ }
966
+ if (arg0.length > 1) {
967
+ args = arg0;
968
+ }
969
+ const result = fn(args);
970
+ if (typeof result === "object") {
971
+ for (let len = result.length, i = 0; i < len; i++) {
972
+ result[i] = Math.round(result[i]);
973
+ }
974
+ }
975
+ return result;
976
+ };
977
+ if ("conversion" in fn) {
978
+ wrappedFn.conversion = fn.conversion;
979
+ }
980
+ return wrappedFn;
981
+ }
982
+ models.forEach((fromModel) => {
983
+ convert[fromModel] = {};
984
+ Object.defineProperty(convert[fromModel], "channels", { value: conversions2[fromModel].channels });
985
+ Object.defineProperty(convert[fromModel], "labels", { value: conversions2[fromModel].labels });
986
+ const routes = route2(fromModel);
987
+ const routeModels = Object.keys(routes);
988
+ routeModels.forEach((toModel) => {
989
+ const fn = routes[toModel];
990
+ convert[fromModel][toModel] = wrapRounded(fn);
991
+ convert[fromModel][toModel].raw = wrapRaw(fn);
992
+ });
993
+ });
994
+ colorConvert = convert;
995
+ return colorConvert;
996
+ }
997
+ ansiStyles$1.exports;
998
+ (function(module) {
999
+ const wrapAnsi16 = (fn, offset) => (...args) => {
1000
+ const code = fn(...args);
1001
+ return `\x1B[${code + offset}m`;
1002
+ };
1003
+ const wrapAnsi256 = (fn, offset) => (...args) => {
1004
+ const code = fn(...args);
1005
+ return `\x1B[${38 + offset};5;${code}m`;
1006
+ };
1007
+ const wrapAnsi16m = (fn, offset) => (...args) => {
1008
+ const rgb = fn(...args);
1009
+ return `\x1B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
1010
+ };
1011
+ const ansi2ansi = (n) => n;
1012
+ const rgb2rgb = (r, g, b) => [r, g, b];
1013
+ const setLazyProperty = (object, property, get) => {
1014
+ Object.defineProperty(object, property, {
1015
+ get: () => {
1016
+ const value = get();
1017
+ Object.defineProperty(object, property, {
1018
+ value,
1019
+ enumerable: true,
1020
+ configurable: true
1021
+ });
1022
+ return value;
1023
+ },
1024
+ enumerable: true,
1025
+ configurable: true
1026
+ });
1027
+ };
1028
+ let colorConvert2;
1029
+ const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
1030
+ if (colorConvert2 === void 0) {
1031
+ colorConvert2 = requireColorConvert();
1032
+ }
1033
+ const offset = isBackground ? 10 : 0;
1034
+ const styles2 = {};
1035
+ for (const [sourceSpace, suite] of Object.entries(colorConvert2)) {
1036
+ const name = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
1037
+ if (sourceSpace === targetSpace) {
1038
+ styles2[name] = wrap(identity, offset);
1039
+ } else if (typeof suite === "object") {
1040
+ styles2[name] = wrap(suite[targetSpace], offset);
1041
+ }
1042
+ }
1043
+ return styles2;
1044
+ };
1045
+ function assembleStyles() {
1046
+ const codes = /* @__PURE__ */ new Map();
1047
+ const styles2 = {
1048
+ modifier: {
1049
+ reset: [0, 0],
1050
+ // 21 isn't widely supported and 22 does the same thing
1051
+ bold: [1, 22],
1052
+ dim: [2, 22],
1053
+ italic: [3, 23],
1054
+ underline: [4, 24],
1055
+ inverse: [7, 27],
1056
+ hidden: [8, 28],
1057
+ strikethrough: [9, 29]
1058
+ },
1059
+ color: {
1060
+ black: [30, 39],
1061
+ red: [31, 39],
1062
+ green: [32, 39],
1063
+ yellow: [33, 39],
1064
+ blue: [34, 39],
1065
+ magenta: [35, 39],
1066
+ cyan: [36, 39],
1067
+ white: [37, 39],
1068
+ // Bright color
1069
+ blackBright: [90, 39],
1070
+ redBright: [91, 39],
1071
+ greenBright: [92, 39],
1072
+ yellowBright: [93, 39],
1073
+ blueBright: [94, 39],
1074
+ magentaBright: [95, 39],
1075
+ cyanBright: [96, 39],
1076
+ whiteBright: [97, 39]
1077
+ },
1078
+ bgColor: {
1079
+ bgBlack: [40, 49],
1080
+ bgRed: [41, 49],
1081
+ bgGreen: [42, 49],
1082
+ bgYellow: [43, 49],
1083
+ bgBlue: [44, 49],
1084
+ bgMagenta: [45, 49],
1085
+ bgCyan: [46, 49],
1086
+ bgWhite: [47, 49],
1087
+ // Bright color
1088
+ bgBlackBright: [100, 49],
1089
+ bgRedBright: [101, 49],
1090
+ bgGreenBright: [102, 49],
1091
+ bgYellowBright: [103, 49],
1092
+ bgBlueBright: [104, 49],
1093
+ bgMagentaBright: [105, 49],
1094
+ bgCyanBright: [106, 49],
1095
+ bgWhiteBright: [107, 49]
1096
+ }
1097
+ };
1098
+ styles2.color.gray = styles2.color.blackBright;
1099
+ styles2.bgColor.bgGray = styles2.bgColor.bgBlackBright;
1100
+ styles2.color.grey = styles2.color.blackBright;
1101
+ styles2.bgColor.bgGrey = styles2.bgColor.bgBlackBright;
1102
+ for (const [groupName, group] of Object.entries(styles2)) {
1103
+ for (const [styleName, style] of Object.entries(group)) {
1104
+ styles2[styleName] = {
1105
+ open: `\x1B[${style[0]}m`,
1106
+ close: `\x1B[${style[1]}m`
1107
+ };
1108
+ group[styleName] = styles2[styleName];
1109
+ codes.set(style[0], style[1]);
1110
+ }
1111
+ Object.defineProperty(styles2, groupName, {
1112
+ value: group,
1113
+ enumerable: false
1114
+ });
1115
+ }
1116
+ Object.defineProperty(styles2, "codes", {
1117
+ value: codes,
1118
+ enumerable: false
1119
+ });
1120
+ styles2.color.close = "\x1B[39m";
1121
+ styles2.bgColor.close = "\x1B[49m";
1122
+ setLazyProperty(styles2.color, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, false));
1123
+ setLazyProperty(styles2.color, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, false));
1124
+ setLazyProperty(styles2.color, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, false));
1125
+ setLazyProperty(styles2.bgColor, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, true));
1126
+ setLazyProperty(styles2.bgColor, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, true));
1127
+ setLazyProperty(styles2.bgColor, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, true));
1128
+ return styles2;
1129
+ }
1130
+ Object.defineProperty(module, "exports", {
1131
+ enumerable: true,
1132
+ get: assembleStyles
1133
+ });
1134
+ })(ansiStyles$1);
1135
+ var ansiStylesExports = ansiStyles$1.exports;
1136
+ var browser = {
1137
+ stdout: false,
1138
+ stderr: false
1139
+ };
1140
+ const stringReplaceAll$1 = (string, substring, replacer) => {
1141
+ let index = string.indexOf(substring);
1142
+ if (index === -1) {
1143
+ return string;
1144
+ }
1145
+ const substringLength = substring.length;
1146
+ let endIndex = 0;
1147
+ let returnValue = "";
1148
+ do {
1149
+ returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
1150
+ endIndex = index + substringLength;
1151
+ index = string.indexOf(substring, endIndex);
1152
+ } while (index !== -1);
1153
+ returnValue += string.substr(endIndex);
1154
+ return returnValue;
1155
+ };
1156
+ const stringEncaseCRLFWithFirstIndex$1 = (string, prefix, postfix, index) => {
1157
+ let endIndex = 0;
1158
+ let returnValue = "";
1159
+ do {
1160
+ const gotCR = string[index - 1] === "\r";
1161
+ returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
1162
+ endIndex = index + 1;
1163
+ index = string.indexOf("\n", endIndex);
1164
+ } while (index !== -1);
1165
+ returnValue += string.substr(endIndex);
1166
+ return returnValue;
1167
+ };
1168
+ var util = {
1169
+ stringReplaceAll: stringReplaceAll$1,
1170
+ stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$1
1171
+ };
1172
+ var templates;
1173
+ var hasRequiredTemplates;
1174
+ function requireTemplates() {
1175
+ if (hasRequiredTemplates)
1176
+ return templates;
1177
+ hasRequiredTemplates = 1;
1178
+ const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
1179
+ const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
1180
+ const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
1181
+ const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
1182
+ const ESCAPES = /* @__PURE__ */ new Map([
1183
+ ["n", "\n"],
1184
+ ["r", "\r"],
1185
+ ["t", " "],
1186
+ ["b", "\b"],
1187
+ ["f", "\f"],
1188
+ ["v", "\v"],
1189
+ ["0", "\0"],
1190
+ ["\\", "\\"],
1191
+ ["e", "\x1B"],
1192
+ ["a", "\x07"]
1193
+ ]);
1194
+ function unescape(c) {
1195
+ const u = c[0] === "u";
1196
+ const bracket = c[1] === "{";
1197
+ if (u && !bracket && c.length === 5 || c[0] === "x" && c.length === 3) {
1198
+ return String.fromCharCode(parseInt(c.slice(1), 16));
1199
+ }
1200
+ if (u && bracket) {
1201
+ return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
1202
+ }
1203
+ return ESCAPES.get(c) || c;
1204
+ }
1205
+ function parseArguments(name, arguments_) {
1206
+ const results = [];
1207
+ const chunks = arguments_.trim().split(/\s*,\s*/g);
1208
+ let matches;
1209
+ for (const chunk of chunks) {
1210
+ const number = Number(chunk);
1211
+ if (!Number.isNaN(number)) {
1212
+ results.push(number);
1213
+ } else if (matches = chunk.match(STRING_REGEX)) {
1214
+ results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
1215
+ } else {
1216
+ throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
1217
+ }
1218
+ }
1219
+ return results;
1220
+ }
1221
+ function parseStyle(style) {
1222
+ STYLE_REGEX.lastIndex = 0;
1223
+ const results = [];
1224
+ let matches;
1225
+ while ((matches = STYLE_REGEX.exec(style)) !== null) {
1226
+ const name = matches[1];
1227
+ if (matches[2]) {
1228
+ const args = parseArguments(name, matches[2]);
1229
+ results.push([name].concat(args));
1230
+ } else {
1231
+ results.push([name]);
1232
+ }
1233
+ }
1234
+ return results;
1235
+ }
1236
+ function buildStyle(chalk2, styles2) {
1237
+ const enabled = {};
1238
+ for (const layer of styles2) {
1239
+ for (const style of layer.styles) {
1240
+ enabled[style[0]] = layer.inverse ? null : style.slice(1);
1241
+ }
1242
+ }
1243
+ let current = chalk2;
1244
+ for (const [styleName, styles3] of Object.entries(enabled)) {
1245
+ if (!Array.isArray(styles3)) {
1246
+ continue;
1247
+ }
1248
+ if (!(styleName in current)) {
1249
+ throw new Error(`Unknown Chalk style: ${styleName}`);
1250
+ }
1251
+ current = styles3.length > 0 ? current[styleName](...styles3) : current[styleName];
1252
+ }
1253
+ return current;
1254
+ }
1255
+ templates = (chalk2, temporary) => {
1256
+ const styles2 = [];
1257
+ const chunks = [];
1258
+ let chunk = [];
1259
+ temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
1260
+ if (escapeCharacter) {
1261
+ chunk.push(unescape(escapeCharacter));
1262
+ } else if (style) {
1263
+ const string = chunk.join("");
1264
+ chunk = [];
1265
+ chunks.push(styles2.length === 0 ? string : buildStyle(chalk2, styles2)(string));
1266
+ styles2.push({ inverse, styles: parseStyle(style) });
1267
+ } else if (close) {
1268
+ if (styles2.length === 0) {
1269
+ throw new Error("Found extraneous } in Chalk template literal");
1270
+ }
1271
+ chunks.push(buildStyle(chalk2, styles2)(chunk.join("")));
1272
+ chunk = [];
1273
+ styles2.pop();
1274
+ } else {
1275
+ chunk.push(character);
1276
+ }
1277
+ });
1278
+ chunks.push(chunk.join(""));
1279
+ if (styles2.length > 0) {
1280
+ const errMessage = `Chalk template literal is missing ${styles2.length} closing bracket${styles2.length === 1 ? "" : "s"} (\`}\`)`;
1281
+ throw new Error(errMessage);
1282
+ }
1283
+ return chunks.join("");
1284
+ };
1285
+ return templates;
1286
+ }
1287
+ const ansiStyles = ansiStylesExports;
1288
+ const { stdout: stdoutColor, stderr: stderrColor } = browser;
1289
+ const {
1290
+ stringReplaceAll,
1291
+ stringEncaseCRLFWithFirstIndex
1292
+ } = util;
1293
+ const { isArray } = Array;
1294
+ const levelMapping = [
1295
+ "ansi",
1296
+ "ansi",
1297
+ "ansi256",
1298
+ "ansi16m"
1299
+ ];
1300
+ const styles = /* @__PURE__ */ Object.create(null);
1301
+ const applyOptions = (object, options = {}) => {
1302
+ if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
1303
+ throw new Error("The `level` option should be an integer from 0 to 3");
1304
+ }
1305
+ const colorLevel = stdoutColor ? stdoutColor.level : 0;
1306
+ object.level = options.level === void 0 ? colorLevel : options.level;
1307
+ };
1308
+ class ChalkClass {
1309
+ constructor(options) {
1310
+ return chalkFactory(options);
1311
+ }
1312
+ }
1313
+ const chalkFactory = (options) => {
1314
+ const chalk2 = {};
1315
+ applyOptions(chalk2, options);
1316
+ chalk2.template = (...arguments_) => chalkTag(chalk2.template, ...arguments_);
1317
+ Object.setPrototypeOf(chalk2, Chalk.prototype);
1318
+ Object.setPrototypeOf(chalk2.template, chalk2);
1319
+ chalk2.template.constructor = () => {
1320
+ throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
1321
+ };
1322
+ chalk2.template.Instance = ChalkClass;
1323
+ return chalk2.template;
1324
+ };
1325
+ function Chalk(options) {
1326
+ return chalkFactory(options);
1327
+ }
1328
+ for (const [styleName, style] of Object.entries(ansiStyles)) {
1329
+ styles[styleName] = {
1330
+ get() {
1331
+ const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
1332
+ Object.defineProperty(this, styleName, { value: builder });
1333
+ return builder;
1334
+ }
1335
+ };
1336
+ }
1337
+ styles.visible = {
1338
+ get() {
1339
+ const builder = createBuilder(this, this._styler, true);
1340
+ Object.defineProperty(this, "visible", { value: builder });
1341
+ return builder;
1342
+ }
1343
+ };
1344
+ const usedModels = ["rgb", "hex", "keyword", "hsl", "hsv", "hwb", "ansi", "ansi256"];
1345
+ for (const model of usedModels) {
1346
+ styles[model] = {
1347
+ get() {
1348
+ const { level } = this;
1349
+ return function(...arguments_) {
1350
+ const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
1351
+ return createBuilder(this, styler, this._isEmpty);
1352
+ };
1353
+ }
1354
+ };
1355
+ }
1356
+ for (const model of usedModels) {
1357
+ const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
1358
+ styles[bgModel] = {
1359
+ get() {
1360
+ const { level } = this;
1361
+ return function(...arguments_) {
1362
+ const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
1363
+ return createBuilder(this, styler, this._isEmpty);
1364
+ };
1365
+ }
1366
+ };
1367
+ }
1368
+ const proto = Object.defineProperties(() => {
1369
+ }, {
1370
+ ...styles,
1371
+ level: {
1372
+ enumerable: true,
1373
+ get() {
1374
+ return this._generator.level;
1375
+ },
1376
+ set(level) {
1377
+ this._generator.level = level;
1378
+ }
1379
+ }
1380
+ });
1381
+ const createStyler = (open, close, parent) => {
1382
+ let openAll;
1383
+ let closeAll;
1384
+ if (parent === void 0) {
1385
+ openAll = open;
1386
+ closeAll = close;
1387
+ } else {
1388
+ openAll = parent.openAll + open;
1389
+ closeAll = close + parent.closeAll;
1390
+ }
1391
+ return {
1392
+ open,
1393
+ close,
1394
+ openAll,
1395
+ closeAll,
1396
+ parent
1397
+ };
1398
+ };
1399
+ const createBuilder = (self, _styler, _isEmpty) => {
1400
+ const builder = (...arguments_) => {
1401
+ if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
1402
+ return applyStyle(builder, chalkTag(builder, ...arguments_));
1403
+ }
1404
+ return applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
1405
+ };
1406
+ Object.setPrototypeOf(builder, proto);
1407
+ builder._generator = self;
1408
+ builder._styler = _styler;
1409
+ builder._isEmpty = _isEmpty;
1410
+ return builder;
1411
+ };
1412
+ const applyStyle = (self, string) => {
1413
+ if (self.level <= 0 || !string) {
1414
+ return self._isEmpty ? "" : string;
1415
+ }
1416
+ let styler = self._styler;
1417
+ if (styler === void 0) {
1418
+ return string;
1419
+ }
1420
+ const { openAll, closeAll } = styler;
1421
+ if (string.indexOf("\x1B") !== -1) {
1422
+ while (styler !== void 0) {
1423
+ string = stringReplaceAll(string, styler.close, styler.open);
1424
+ styler = styler.parent;
1425
+ }
1426
+ }
1427
+ const lfIndex = string.indexOf("\n");
1428
+ if (lfIndex !== -1) {
1429
+ string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
1430
+ }
1431
+ return openAll + string + closeAll;
1432
+ };
1433
+ let template;
1434
+ const chalkTag = (chalk2, ...strings) => {
1435
+ const [firstString] = strings;
1436
+ if (!isArray(firstString) || !isArray(firstString.raw)) {
1437
+ return strings.join(" ");
1438
+ }
1439
+ const arguments_ = strings.slice(1);
1440
+ const parts = [firstString.raw[0]];
1441
+ for (let i = 1; i < firstString.length; i++) {
1442
+ parts.push(
1443
+ String(arguments_[i - 1]).replace(/[{}\\]/g, "\\$&"),
1444
+ String(firstString.raw[i])
1445
+ );
1446
+ }
1447
+ if (template === void 0) {
1448
+ template = requireTemplates();
1449
+ }
1450
+ return template(chalk2, parts.join(""));
1451
+ };
1452
+ Object.defineProperties(Chalk.prototype, styles);
1453
+ const chalk = Chalk();
1454
+ chalk.supportsColor = stdoutColor;
1455
+ chalk.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
1456
+ chalk.stderr.supportsColor = stderrColor;
1457
+ var source = chalk;
1458
+ const chalk$1 = /* @__PURE__ */ getDefaultExportFromCjs(source);
27
1459
  function GetErrorPayload(errorCode, details = null) {
28
1460
  return {
29
1461
  error: errorCode.code,
@@ -192,25 +1624,25 @@ const CheckValidChar = (checkParams) => {
192
1624
  };
193
1625
  const defaultLogger = {
194
1626
  debug(message) {
195
- console.log(message);
1627
+ console.log(chalk$1.grey(message));
196
1628
  },
197
1629
  error(message) {
198
- console.log(message);
1630
+ console.log(chalk$1.red(message));
199
1631
  },
200
1632
  http(message) {
201
- console.log(message);
1633
+ console.log(chalk$1.cyan(message));
202
1634
  },
203
1635
  info(message) {
204
- console.log(message);
1636
+ console.log(chalk$1.white(message));
205
1637
  },
206
1638
  silly(message) {
207
- console.log(message);
1639
+ console.log(chalk$1.yellow(message));
208
1640
  },
209
1641
  verbose(message) {
210
- console.log(message);
1642
+ console.log(chalk$1.green(message));
211
1643
  },
212
1644
  warn(message) {
213
- console.log(message);
1645
+ console.log(chalk$1.magenta(message));
214
1646
  }
215
1647
  };
216
1648
  export {