@nsshunt/stsutils 1.19.90 → 1.19.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,1979 +1,2516 @@
1
1
  import Ajv from "ajv/dist/jtd.js";
2
- function getDefaultExportFromCjs(x) {
3
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
4
- }
5
- var ansiStyles = { exports: {} };
6
- var colorName;
7
- var hasRequiredColorName;
8
- function requireColorName() {
9
- if (hasRequiredColorName) return colorName;
10
- hasRequiredColorName = 1;
11
- colorName = {
12
- "aliceblue": [240, 248, 255],
13
- "antiquewhite": [250, 235, 215],
14
- "aqua": [0, 255, 255],
15
- "aquamarine": [127, 255, 212],
16
- "azure": [240, 255, 255],
17
- "beige": [245, 245, 220],
18
- "bisque": [255, 228, 196],
19
- "black": [0, 0, 0],
20
- "blanchedalmond": [255, 235, 205],
21
- "blue": [0, 0, 255],
22
- "blueviolet": [138, 43, 226],
23
- "brown": [165, 42, 42],
24
- "burlywood": [222, 184, 135],
25
- "cadetblue": [95, 158, 160],
26
- "chartreuse": [127, 255, 0],
27
- "chocolate": [210, 105, 30],
28
- "coral": [255, 127, 80],
29
- "cornflowerblue": [100, 149, 237],
30
- "cornsilk": [255, 248, 220],
31
- "crimson": [220, 20, 60],
32
- "cyan": [0, 255, 255],
33
- "darkblue": [0, 0, 139],
34
- "darkcyan": [0, 139, 139],
35
- "darkgoldenrod": [184, 134, 11],
36
- "darkgray": [169, 169, 169],
37
- "darkgreen": [0, 100, 0],
38
- "darkgrey": [169, 169, 169],
39
- "darkkhaki": [189, 183, 107],
40
- "darkmagenta": [139, 0, 139],
41
- "darkolivegreen": [85, 107, 47],
42
- "darkorange": [255, 140, 0],
43
- "darkorchid": [153, 50, 204],
44
- "darkred": [139, 0, 0],
45
- "darksalmon": [233, 150, 122],
46
- "darkseagreen": [143, 188, 143],
47
- "darkslateblue": [72, 61, 139],
48
- "darkslategray": [47, 79, 79],
49
- "darkslategrey": [47, 79, 79],
50
- "darkturquoise": [0, 206, 209],
51
- "darkviolet": [148, 0, 211],
52
- "deeppink": [255, 20, 147],
53
- "deepskyblue": [0, 191, 255],
54
- "dimgray": [105, 105, 105],
55
- "dimgrey": [105, 105, 105],
56
- "dodgerblue": [30, 144, 255],
57
- "firebrick": [178, 34, 34],
58
- "floralwhite": [255, 250, 240],
59
- "forestgreen": [34, 139, 34],
60
- "fuchsia": [255, 0, 255],
61
- "gainsboro": [220, 220, 220],
62
- "ghostwhite": [248, 248, 255],
63
- "gold": [255, 215, 0],
64
- "goldenrod": [218, 165, 32],
65
- "gray": [128, 128, 128],
66
- "green": [0, 128, 0],
67
- "greenyellow": [173, 255, 47],
68
- "grey": [128, 128, 128],
69
- "honeydew": [240, 255, 240],
70
- "hotpink": [255, 105, 180],
71
- "indianred": [205, 92, 92],
72
- "indigo": [75, 0, 130],
73
- "ivory": [255, 255, 240],
74
- "khaki": [240, 230, 140],
75
- "lavender": [230, 230, 250],
76
- "lavenderblush": [255, 240, 245],
77
- "lawngreen": [124, 252, 0],
78
- "lemonchiffon": [255, 250, 205],
79
- "lightblue": [173, 216, 230],
80
- "lightcoral": [240, 128, 128],
81
- "lightcyan": [224, 255, 255],
82
- "lightgoldenrodyellow": [250, 250, 210],
83
- "lightgray": [211, 211, 211],
84
- "lightgreen": [144, 238, 144],
85
- "lightgrey": [211, 211, 211],
86
- "lightpink": [255, 182, 193],
87
- "lightsalmon": [255, 160, 122],
88
- "lightseagreen": [32, 178, 170],
89
- "lightskyblue": [135, 206, 250],
90
- "lightslategray": [119, 136, 153],
91
- "lightslategrey": [119, 136, 153],
92
- "lightsteelblue": [176, 196, 222],
93
- "lightyellow": [255, 255, 224],
94
- "lime": [0, 255, 0],
95
- "limegreen": [50, 205, 50],
96
- "linen": [250, 240, 230],
97
- "magenta": [255, 0, 255],
98
- "maroon": [128, 0, 0],
99
- "mediumaquamarine": [102, 205, 170],
100
- "mediumblue": [0, 0, 205],
101
- "mediumorchid": [186, 85, 211],
102
- "mediumpurple": [147, 112, 219],
103
- "mediumseagreen": [60, 179, 113],
104
- "mediumslateblue": [123, 104, 238],
105
- "mediumspringgreen": [0, 250, 154],
106
- "mediumturquoise": [72, 209, 204],
107
- "mediumvioletred": [199, 21, 133],
108
- "midnightblue": [25, 25, 112],
109
- "mintcream": [245, 255, 250],
110
- "mistyrose": [255, 228, 225],
111
- "moccasin": [255, 228, 181],
112
- "navajowhite": [255, 222, 173],
113
- "navy": [0, 0, 128],
114
- "oldlace": [253, 245, 230],
115
- "olive": [128, 128, 0],
116
- "olivedrab": [107, 142, 35],
117
- "orange": [255, 165, 0],
118
- "orangered": [255, 69, 0],
119
- "orchid": [218, 112, 214],
120
- "palegoldenrod": [238, 232, 170],
121
- "palegreen": [152, 251, 152],
122
- "paleturquoise": [175, 238, 238],
123
- "palevioletred": [219, 112, 147],
124
- "papayawhip": [255, 239, 213],
125
- "peachpuff": [255, 218, 185],
126
- "peru": [205, 133, 63],
127
- "pink": [255, 192, 203],
128
- "plum": [221, 160, 221],
129
- "powderblue": [176, 224, 230],
130
- "purple": [128, 0, 128],
131
- "rebeccapurple": [102, 51, 153],
132
- "red": [255, 0, 0],
133
- "rosybrown": [188, 143, 143],
134
- "royalblue": [65, 105, 225],
135
- "saddlebrown": [139, 69, 19],
136
- "salmon": [250, 128, 114],
137
- "sandybrown": [244, 164, 96],
138
- "seagreen": [46, 139, 87],
139
- "seashell": [255, 245, 238],
140
- "sienna": [160, 82, 45],
141
- "silver": [192, 192, 192],
142
- "skyblue": [135, 206, 235],
143
- "slateblue": [106, 90, 205],
144
- "slategray": [112, 128, 144],
145
- "slategrey": [112, 128, 144],
146
- "snow": [255, 250, 250],
147
- "springgreen": [0, 255, 127],
148
- "steelblue": [70, 130, 180],
149
- "tan": [210, 180, 140],
150
- "teal": [0, 128, 128],
151
- "thistle": [216, 191, 216],
152
- "tomato": [255, 99, 71],
153
- "turquoise": [64, 224, 208],
154
- "violet": [238, 130, 238],
155
- "wheat": [245, 222, 179],
156
- "white": [255, 255, 255],
157
- "whitesmoke": [245, 245, 245],
158
- "yellow": [255, 255, 0],
159
- "yellowgreen": [154, 205, 50]
160
- };
161
- return colorName;
162
- }
163
- var conversions;
164
- var hasRequiredConversions;
165
- function requireConversions() {
166
- if (hasRequiredConversions) return conversions;
167
- hasRequiredConversions = 1;
168
- const cssKeywords = requireColorName();
169
- const reverseKeywords = {};
170
- for (const key of Object.keys(cssKeywords)) {
171
- reverseKeywords[cssKeywords[key]] = key;
172
- }
173
- const convert = {
174
- rgb: { channels: 3, labels: "rgb" },
175
- hsl: { channels: 3, labels: "hsl" },
176
- hsv: { channels: 3, labels: "hsv" },
177
- hwb: { channels: 3, labels: "hwb" },
178
- cmyk: { channels: 4, labels: "cmyk" },
179
- xyz: { channels: 3, labels: "xyz" },
180
- lab: { channels: 3, labels: "lab" },
181
- lch: { channels: 3, labels: "lch" },
182
- hex: { channels: 1, labels: ["hex"] },
183
- keyword: { channels: 1, labels: ["keyword"] },
184
- ansi16: { channels: 1, labels: ["ansi16"] },
185
- ansi256: { channels: 1, labels: ["ansi256"] },
186
- hcg: { channels: 3, labels: ["h", "c", "g"] },
187
- apple: { channels: 3, labels: ["r16", "g16", "b16"] },
188
- gray: { channels: 1, labels: ["gray"] }
189
- };
190
- conversions = convert;
191
- for (const model of Object.keys(convert)) {
192
- if (!("channels" in convert[model])) {
193
- throw new Error("missing channels property: " + model);
194
- }
195
- if (!("labels" in convert[model])) {
196
- throw new Error("missing channel labels property: " + model);
197
- }
198
- if (convert[model].labels.length !== convert[model].channels) {
199
- throw new Error("channel and label counts mismatch: " + model);
200
- }
201
- const { channels, labels } = convert[model];
202
- delete convert[model].channels;
203
- delete convert[model].labels;
204
- Object.defineProperty(convert[model], "channels", { value: channels });
205
- Object.defineProperty(convert[model], "labels", { value: labels });
206
- }
207
- convert.rgb.hsl = function(rgb) {
208
- const r = rgb[0] / 255;
209
- const g = rgb[1] / 255;
210
- const b = rgb[2] / 255;
211
- const min = Math.min(r, g, b);
212
- const max = Math.max(r, g, b);
213
- const delta = max - min;
214
- let h;
215
- let s;
216
- if (max === min) {
217
- h = 0;
218
- } else if (r === max) {
219
- h = (g - b) / delta;
220
- } else if (g === max) {
221
- h = 2 + (b - r) / delta;
222
- } else if (b === max) {
223
- h = 4 + (r - g) / delta;
224
- }
225
- h = Math.min(h * 60, 360);
226
- if (h < 0) {
227
- h += 360;
228
- }
229
- const l = (min + max) / 2;
230
- if (max === min) {
231
- s = 0;
232
- } else if (l <= 0.5) {
233
- s = delta / (max + min);
234
- } else {
235
- s = delta / (2 - max - min);
236
- }
237
- return [h, s * 100, l * 100];
238
- };
239
- convert.rgb.hsv = function(rgb) {
240
- let rdif;
241
- let gdif;
242
- let bdif;
243
- let h;
244
- let s;
245
- const r = rgb[0] / 255;
246
- const g = rgb[1] / 255;
247
- const b = rgb[2] / 255;
248
- const v = Math.max(r, g, b);
249
- const diff = v - Math.min(r, g, b);
250
- const diffc = function(c) {
251
- return (v - c) / 6 / diff + 1 / 2;
252
- };
253
- if (diff === 0) {
254
- h = 0;
255
- s = 0;
256
- } else {
257
- s = diff / v;
258
- rdif = diffc(r);
259
- gdif = diffc(g);
260
- bdif = diffc(b);
261
- if (r === v) {
262
- h = bdif - gdif;
263
- } else if (g === v) {
264
- h = 1 / 3 + rdif - bdif;
265
- } else if (b === v) {
266
- h = 2 / 3 + gdif - rdif;
267
- }
268
- if (h < 0) {
269
- h += 1;
270
- } else if (h > 1) {
271
- h -= 1;
272
- }
273
- }
274
- return [
275
- h * 360,
276
- s * 100,
277
- v * 100
278
- ];
279
- };
280
- convert.rgb.hwb = function(rgb) {
281
- const r = rgb[0];
282
- const g = rgb[1];
283
- let b = rgb[2];
284
- const h = convert.rgb.hsl(rgb)[0];
285
- const w = 1 / 255 * Math.min(r, Math.min(g, b));
286
- b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
287
- return [h, w * 100, b * 100];
288
- };
289
- convert.rgb.cmyk = function(rgb) {
290
- const r = rgb[0] / 255;
291
- const g = rgb[1] / 255;
292
- const b = rgb[2] / 255;
293
- const k = Math.min(1 - r, 1 - g, 1 - b);
294
- const c = (1 - r - k) / (1 - k) || 0;
295
- const m = (1 - g - k) / (1 - k) || 0;
296
- const y = (1 - b - k) / (1 - k) || 0;
297
- return [c * 100, m * 100, y * 100, k * 100];
298
- };
299
- function comparativeDistance(x, y) {
300
- return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
301
- }
302
- convert.rgb.keyword = function(rgb) {
303
- const reversed = reverseKeywords[rgb];
304
- if (reversed) {
305
- return reversed;
306
- }
307
- let currentClosestDistance = Infinity;
308
- let currentClosestKeyword;
309
- for (const keyword of Object.keys(cssKeywords)) {
310
- const value = cssKeywords[keyword];
311
- const distance = comparativeDistance(rgb, value);
312
- if (distance < currentClosestDistance) {
313
- currentClosestDistance = distance;
314
- currentClosestKeyword = keyword;
315
- }
316
- }
317
- return currentClosestKeyword;
318
- };
319
- convert.keyword.rgb = function(keyword) {
320
- return cssKeywords[keyword];
321
- };
322
- convert.rgb.xyz = function(rgb) {
323
- let r = rgb[0] / 255;
324
- let g = rgb[1] / 255;
325
- let b = rgb[2] / 255;
326
- r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
327
- g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92;
328
- b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92;
329
- const x = r * 0.4124 + g * 0.3576 + b * 0.1805;
330
- const y = r * 0.2126 + g * 0.7152 + b * 0.0722;
331
- const z = r * 0.0193 + g * 0.1192 + b * 0.9505;
332
- return [x * 100, y * 100, z * 100];
333
- };
334
- convert.rgb.lab = function(rgb) {
335
- const xyz = convert.rgb.xyz(rgb);
336
- let x = xyz[0];
337
- let y = xyz[1];
338
- let z = xyz[2];
339
- x /= 95.047;
340
- y /= 100;
341
- z /= 108.883;
342
- x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
343
- y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
344
- z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
345
- const l = 116 * y - 16;
346
- const a = 500 * (x - y);
347
- const b = 200 * (y - z);
348
- return [l, a, b];
349
- };
350
- convert.hsl.rgb = function(hsl) {
351
- const h = hsl[0] / 360;
352
- const s = hsl[1] / 100;
353
- const l = hsl[2] / 100;
354
- let t2;
355
- let t3;
356
- let val;
357
- if (s === 0) {
358
- val = l * 255;
359
- return [val, val, val];
360
- }
361
- if (l < 0.5) {
362
- t2 = l * (1 + s);
363
- } else {
364
- t2 = l + s - l * s;
365
- }
366
- const t1 = 2 * l - t2;
367
- const rgb = [0, 0, 0];
368
- for (let i = 0; i < 3; i++) {
369
- t3 = h + 1 / 3 * -(i - 1);
370
- if (t3 < 0) {
371
- t3++;
372
- }
373
- if (t3 > 1) {
374
- t3--;
375
- }
376
- if (6 * t3 < 1) {
377
- val = t1 + (t2 - t1) * 6 * t3;
378
- } else if (2 * t3 < 1) {
379
- val = t2;
380
- } else if (3 * t3 < 2) {
381
- val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
382
- } else {
383
- val = t1;
384
- }
385
- rgb[i] = val * 255;
386
- }
387
- return rgb;
388
- };
389
- convert.hsl.hsv = function(hsl) {
390
- const h = hsl[0];
391
- let s = hsl[1] / 100;
392
- let l = hsl[2] / 100;
393
- let smin = s;
394
- const lmin = Math.max(l, 0.01);
395
- l *= 2;
396
- s *= l <= 1 ? l : 2 - l;
397
- smin *= lmin <= 1 ? lmin : 2 - lmin;
398
- const v = (l + s) / 2;
399
- const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
400
- return [h, sv * 100, v * 100];
401
- };
402
- convert.hsv.rgb = function(hsv) {
403
- const h = hsv[0] / 60;
404
- const s = hsv[1] / 100;
405
- let v = hsv[2] / 100;
406
- const hi = Math.floor(h) % 6;
407
- const f = h - Math.floor(h);
408
- const p = 255 * v * (1 - s);
409
- const q = 255 * v * (1 - s * f);
410
- const t = 255 * v * (1 - s * (1 - f));
411
- v *= 255;
412
- switch (hi) {
413
- case 0:
414
- return [v, t, p];
415
- case 1:
416
- return [q, v, p];
417
- case 2:
418
- return [p, v, t];
419
- case 3:
420
- return [p, q, v];
421
- case 4:
422
- return [t, p, v];
423
- case 5:
424
- return [v, p, q];
425
- }
426
- };
427
- convert.hsv.hsl = function(hsv) {
428
- const h = hsv[0];
429
- const s = hsv[1] / 100;
430
- const v = hsv[2] / 100;
431
- const vmin = Math.max(v, 0.01);
432
- let sl;
433
- let l;
434
- l = (2 - s) * v;
435
- const lmin = (2 - s) * vmin;
436
- sl = s * vmin;
437
- sl /= lmin <= 1 ? lmin : 2 - lmin;
438
- sl = sl || 0;
439
- l /= 2;
440
- return [h, sl * 100, l * 100];
441
- };
442
- convert.hwb.rgb = function(hwb) {
443
- const h = hwb[0] / 360;
444
- let wh = hwb[1] / 100;
445
- let bl = hwb[2] / 100;
446
- const ratio = wh + bl;
447
- let f;
448
- if (ratio > 1) {
449
- wh /= ratio;
450
- bl /= ratio;
451
- }
452
- const i = Math.floor(6 * h);
453
- const v = 1 - bl;
454
- f = 6 * h - i;
455
- if ((i & 1) !== 0) {
456
- f = 1 - f;
457
- }
458
- const n = wh + f * (v - wh);
459
- let r;
460
- let g;
461
- let b;
462
- switch (i) {
463
- default:
464
- case 6:
465
- case 0:
466
- r = v;
467
- g = n;
468
- b = wh;
469
- break;
470
- case 1:
471
- r = n;
472
- g = v;
473
- b = wh;
474
- break;
475
- case 2:
476
- r = wh;
477
- g = v;
478
- b = n;
479
- break;
480
- case 3:
481
- r = wh;
482
- g = n;
483
- b = v;
484
- break;
485
- case 4:
486
- r = n;
487
- g = wh;
488
- b = v;
489
- break;
490
- case 5:
491
- r = v;
492
- g = wh;
493
- b = n;
494
- break;
495
- }
496
- return [r * 255, g * 255, b * 255];
497
- };
498
- convert.cmyk.rgb = function(cmyk) {
499
- const c = cmyk[0] / 100;
500
- const m = cmyk[1] / 100;
501
- const y = cmyk[2] / 100;
502
- const k = cmyk[3] / 100;
503
- const r = 1 - Math.min(1, c * (1 - k) + k);
504
- const g = 1 - Math.min(1, m * (1 - k) + k);
505
- const b = 1 - Math.min(1, y * (1 - k) + k);
506
- return [r * 255, g * 255, b * 255];
507
- };
508
- convert.xyz.rgb = function(xyz) {
509
- const x = xyz[0] / 100;
510
- const y = xyz[1] / 100;
511
- const z = xyz[2] / 100;
512
- let r;
513
- let g;
514
- let b;
515
- r = x * 3.2406 + y * -1.5372 + z * -0.4986;
516
- g = x * -0.9689 + y * 1.8758 + z * 0.0415;
517
- b = x * 0.0557 + y * -0.204 + z * 1.057;
518
- r = r > 31308e-7 ? 1.055 * r ** (1 / 2.4) - 0.055 : r * 12.92;
519
- g = g > 31308e-7 ? 1.055 * g ** (1 / 2.4) - 0.055 : g * 12.92;
520
- b = b > 31308e-7 ? 1.055 * b ** (1 / 2.4) - 0.055 : b * 12.92;
521
- r = Math.min(Math.max(0, r), 1);
522
- g = Math.min(Math.max(0, g), 1);
523
- b = Math.min(Math.max(0, b), 1);
524
- return [r * 255, g * 255, b * 255];
525
- };
526
- convert.xyz.lab = function(xyz) {
527
- let x = xyz[0];
528
- let y = xyz[1];
529
- let z = xyz[2];
530
- x /= 95.047;
531
- y /= 100;
532
- z /= 108.883;
533
- x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
534
- y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
535
- z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
536
- const l = 116 * y - 16;
537
- const a = 500 * (x - y);
538
- const b = 200 * (y - z);
539
- return [l, a, b];
540
- };
541
- convert.lab.xyz = function(lab) {
542
- const l = lab[0];
543
- const a = lab[1];
544
- const b = lab[2];
545
- let x;
546
- let y;
547
- let z;
548
- y = (l + 16) / 116;
549
- x = a / 500 + y;
550
- z = y - b / 200;
551
- const y2 = y ** 3;
552
- const x2 = x ** 3;
553
- const z2 = z ** 3;
554
- y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
555
- x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
556
- z = z2 > 8856e-6 ? z2 : (z - 16 / 116) / 7.787;
557
- x *= 95.047;
558
- y *= 100;
559
- z *= 108.883;
560
- return [x, y, z];
561
- };
562
- convert.lab.lch = function(lab) {
563
- const l = lab[0];
564
- const a = lab[1];
565
- const b = lab[2];
566
- let h;
567
- const hr = Math.atan2(b, a);
568
- h = hr * 360 / 2 / Math.PI;
569
- if (h < 0) {
570
- h += 360;
571
- }
572
- const c = Math.sqrt(a * a + b * b);
573
- return [l, c, h];
574
- };
575
- convert.lch.lab = function(lch) {
576
- const l = lch[0];
577
- const c = lch[1];
578
- const h = lch[2];
579
- const hr = h / 360 * 2 * Math.PI;
580
- const a = c * Math.cos(hr);
581
- const b = c * Math.sin(hr);
582
- return [l, a, b];
583
- };
584
- convert.rgb.ansi16 = function(args, saturation = null) {
585
- const [r, g, b] = args;
586
- let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation;
587
- value = Math.round(value / 50);
588
- if (value === 0) {
589
- return 30;
590
- }
591
- let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
592
- if (value === 2) {
593
- ansi += 60;
594
- }
595
- return ansi;
596
- };
597
- convert.hsv.ansi16 = function(args) {
598
- return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
599
- };
600
- convert.rgb.ansi256 = function(args) {
601
- const r = args[0];
602
- const g = args[1];
603
- const b = args[2];
604
- if (r === g && g === b) {
605
- if (r < 8) {
606
- return 16;
607
- }
608
- if (r > 248) {
609
- return 231;
610
- }
611
- return Math.round((r - 8) / 247 * 24) + 232;
612
- }
613
- const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
614
- return ansi;
615
- };
616
- convert.ansi16.rgb = function(args) {
617
- let color = args % 10;
618
- if (color === 0 || color === 7) {
619
- if (args > 50) {
620
- color += 3.5;
621
- }
622
- color = color / 10.5 * 255;
623
- return [color, color, color];
624
- }
625
- const mult = (~~(args > 50) + 1) * 0.5;
626
- const r = (color & 1) * mult * 255;
627
- const g = (color >> 1 & 1) * mult * 255;
628
- const b = (color >> 2 & 1) * mult * 255;
629
- return [r, g, b];
630
- };
631
- convert.ansi256.rgb = function(args) {
632
- if (args >= 232) {
633
- const c = (args - 232) * 10 + 8;
634
- return [c, c, c];
635
- }
636
- args -= 16;
637
- let rem;
638
- const r = Math.floor(args / 36) / 5 * 255;
639
- const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
640
- const b = rem % 6 / 5 * 255;
641
- return [r, g, b];
642
- };
643
- convert.rgb.hex = function(args) {
644
- const integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
645
- const string = integer.toString(16).toUpperCase();
646
- return "000000".substring(string.length) + string;
647
- };
648
- convert.hex.rgb = function(args) {
649
- const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
650
- if (!match) {
651
- return [0, 0, 0];
652
- }
653
- let colorString = match[0];
654
- if (match[0].length === 3) {
655
- colorString = colorString.split("").map((char) => {
656
- return char + char;
657
- }).join("");
658
- }
659
- const integer = parseInt(colorString, 16);
660
- const r = integer >> 16 & 255;
661
- const g = integer >> 8 & 255;
662
- const b = integer & 255;
663
- return [r, g, b];
664
- };
665
- convert.rgb.hcg = function(rgb) {
666
- const r = rgb[0] / 255;
667
- const g = rgb[1] / 255;
668
- const b = rgb[2] / 255;
669
- const max = Math.max(Math.max(r, g), b);
670
- const min = Math.min(Math.min(r, g), b);
671
- const chroma = max - min;
672
- let grayscale;
673
- let hue;
674
- if (chroma < 1) {
675
- grayscale = min / (1 - chroma);
676
- } else {
677
- grayscale = 0;
678
- }
679
- if (chroma <= 0) {
680
- hue = 0;
681
- } else if (max === r) {
682
- hue = (g - b) / chroma % 6;
683
- } else if (max === g) {
684
- hue = 2 + (b - r) / chroma;
685
- } else {
686
- hue = 4 + (r - g) / chroma;
687
- }
688
- hue /= 6;
689
- hue %= 1;
690
- return [hue * 360, chroma * 100, grayscale * 100];
691
- };
692
- convert.hsl.hcg = function(hsl) {
693
- const s = hsl[1] / 100;
694
- const l = hsl[2] / 100;
695
- const c = l < 0.5 ? 2 * s * l : 2 * s * (1 - l);
696
- let f = 0;
697
- if (c < 1) {
698
- f = (l - 0.5 * c) / (1 - c);
699
- }
700
- return [hsl[0], c * 100, f * 100];
701
- };
702
- convert.hsv.hcg = function(hsv) {
703
- const s = hsv[1] / 100;
704
- const v = hsv[2] / 100;
705
- const c = s * v;
706
- let f = 0;
707
- if (c < 1) {
708
- f = (v - c) / (1 - c);
709
- }
710
- return [hsv[0], c * 100, f * 100];
711
- };
712
- convert.hcg.rgb = function(hcg) {
713
- const h = hcg[0] / 360;
714
- const c = hcg[1] / 100;
715
- const g = hcg[2] / 100;
716
- if (c === 0) {
717
- return [g * 255, g * 255, g * 255];
718
- }
719
- const pure = [0, 0, 0];
720
- const hi = h % 1 * 6;
721
- const v = hi % 1;
722
- const w = 1 - v;
723
- let mg = 0;
724
- switch (Math.floor(hi)) {
725
- case 0:
726
- pure[0] = 1;
727
- pure[1] = v;
728
- pure[2] = 0;
729
- break;
730
- case 1:
731
- pure[0] = w;
732
- pure[1] = 1;
733
- pure[2] = 0;
734
- break;
735
- case 2:
736
- pure[0] = 0;
737
- pure[1] = 1;
738
- pure[2] = v;
739
- break;
740
- case 3:
741
- pure[0] = 0;
742
- pure[1] = w;
743
- pure[2] = 1;
744
- break;
745
- case 4:
746
- pure[0] = v;
747
- pure[1] = 0;
748
- pure[2] = 1;
749
- break;
750
- default:
751
- pure[0] = 1;
752
- pure[1] = 0;
753
- pure[2] = w;
754
- }
755
- mg = (1 - c) * g;
756
- return [
757
- (c * pure[0] + mg) * 255,
758
- (c * pure[1] + mg) * 255,
759
- (c * pure[2] + mg) * 255
760
- ];
761
- };
762
- convert.hcg.hsv = function(hcg) {
763
- const c = hcg[1] / 100;
764
- const g = hcg[2] / 100;
765
- const v = c + g * (1 - c);
766
- let f = 0;
767
- if (v > 0) {
768
- f = c / v;
769
- }
770
- return [hcg[0], f * 100, v * 100];
771
- };
772
- convert.hcg.hsl = function(hcg) {
773
- const c = hcg[1] / 100;
774
- const g = hcg[2] / 100;
775
- const l = g * (1 - c) + 0.5 * c;
776
- let s = 0;
777
- if (l > 0 && l < 0.5) {
778
- s = c / (2 * l);
779
- } else if (l >= 0.5 && l < 1) {
780
- s = c / (2 * (1 - l));
781
- }
782
- return [hcg[0], s * 100, l * 100];
783
- };
784
- convert.hcg.hwb = function(hcg) {
785
- const c = hcg[1] / 100;
786
- const g = hcg[2] / 100;
787
- const v = c + g * (1 - c);
788
- return [hcg[0], (v - c) * 100, (1 - v) * 100];
789
- };
790
- convert.hwb.hcg = function(hwb) {
791
- const w = hwb[1] / 100;
792
- const b = hwb[2] / 100;
793
- const v = 1 - b;
794
- const c = v - w;
795
- let g = 0;
796
- if (c < 1) {
797
- g = (v - c) / (1 - c);
798
- }
799
- return [hwb[0], c * 100, g * 100];
800
- };
801
- convert.apple.rgb = function(apple) {
802
- return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
803
- };
804
- convert.rgb.apple = function(rgb) {
805
- return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
806
- };
807
- convert.gray.rgb = function(args) {
808
- return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
809
- };
810
- convert.gray.hsl = function(args) {
811
- return [0, 0, args[0]];
812
- };
813
- convert.gray.hsv = convert.gray.hsl;
814
- convert.gray.hwb = function(gray) {
815
- return [0, 100, gray[0]];
816
- };
817
- convert.gray.cmyk = function(gray) {
818
- return [0, 0, 0, gray[0]];
819
- };
820
- convert.gray.lab = function(gray) {
821
- return [gray[0], 0, 0];
822
- };
823
- convert.gray.hex = function(gray) {
824
- const val = Math.round(gray[0] / 100 * 255) & 255;
825
- const integer = (val << 16) + (val << 8) + val;
826
- const string = integer.toString(16).toUpperCase();
827
- return "000000".substring(string.length) + string;
828
- };
829
- convert.rgb.gray = function(rgb) {
830
- const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
831
- return [val / 255 * 100];
832
- };
833
- return conversions;
834
- }
835
- var route;
836
- var hasRequiredRoute;
837
- function requireRoute() {
838
- if (hasRequiredRoute) return route;
839
- hasRequiredRoute = 1;
840
- const conversions2 = requireConversions();
841
- function buildGraph() {
842
- const graph = {};
843
- const models = Object.keys(conversions2);
844
- for (let len = models.length, i = 0; i < len; i++) {
845
- graph[models[i]] = {
846
- // http://jsperf.com/1-vs-infinity
847
- // micro-opt, but this is simple.
848
- distance: -1,
849
- parent: null
850
- };
851
- }
852
- return graph;
853
- }
854
- function deriveBFS(fromModel) {
855
- const graph = buildGraph();
856
- const queue = [fromModel];
857
- graph[fromModel].distance = 0;
858
- while (queue.length) {
859
- const current = queue.pop();
860
- const adjacents = Object.keys(conversions2[current]);
861
- for (let len = adjacents.length, i = 0; i < len; i++) {
862
- const adjacent = adjacents[i];
863
- const node = graph[adjacent];
864
- if (node.distance === -1) {
865
- node.distance = graph[current].distance + 1;
866
- node.parent = current;
867
- queue.unshift(adjacent);
868
- }
869
- }
870
- }
871
- return graph;
872
- }
873
- function link(from, to) {
874
- return function(args) {
875
- return to(from(args));
876
- };
877
- }
878
- function wrapConversion(toModel, graph) {
879
- const path = [graph[toModel].parent, toModel];
880
- let fn = conversions2[graph[toModel].parent][toModel];
881
- let cur = graph[toModel].parent;
882
- while (graph[cur].parent) {
883
- path.unshift(graph[cur].parent);
884
- fn = link(conversions2[graph[cur].parent][cur], fn);
885
- cur = graph[cur].parent;
886
- }
887
- fn.conversion = path;
888
- return fn;
889
- }
890
- route = function(fromModel) {
891
- const graph = deriveBFS(fromModel);
892
- const conversion = {};
893
- const models = Object.keys(graph);
894
- for (let len = models.length, i = 0; i < len; i++) {
895
- const toModel = models[i];
896
- const node = graph[toModel];
897
- if (node.parent === null) {
898
- continue;
899
- }
900
- conversion[toModel] = wrapConversion(toModel, graph);
901
- }
902
- return conversion;
903
- };
904
- return route;
905
- }
906
- var colorConvert;
907
- var hasRequiredColorConvert;
908
- function requireColorConvert() {
909
- if (hasRequiredColorConvert) return colorConvert;
910
- hasRequiredColorConvert = 1;
911
- const conversions2 = requireConversions();
912
- const route2 = requireRoute();
913
- const convert = {};
914
- const models = Object.keys(conversions2);
915
- function wrapRaw(fn) {
916
- const wrappedFn = function(...args) {
917
- const arg0 = args[0];
918
- if (arg0 === void 0 || arg0 === null) {
919
- return arg0;
920
- }
921
- if (arg0.length > 1) {
922
- args = arg0;
923
- }
924
- return fn(args);
925
- };
926
- if ("conversion" in fn) {
927
- wrappedFn.conversion = fn.conversion;
928
- }
929
- return wrappedFn;
930
- }
931
- function wrapRounded(fn) {
932
- const wrappedFn = function(...args) {
933
- const arg0 = args[0];
934
- if (arg0 === void 0 || arg0 === null) {
935
- return arg0;
936
- }
937
- if (arg0.length > 1) {
938
- args = arg0;
939
- }
940
- const result = fn(args);
941
- if (typeof result === "object") {
942
- for (let len = result.length, i = 0; i < len; i++) {
943
- result[i] = Math.round(result[i]);
944
- }
945
- }
946
- return result;
947
- };
948
- if ("conversion" in fn) {
949
- wrappedFn.conversion = fn.conversion;
950
- }
951
- return wrappedFn;
952
- }
953
- models.forEach((fromModel) => {
954
- convert[fromModel] = {};
955
- Object.defineProperty(convert[fromModel], "channels", { value: conversions2[fromModel].channels });
956
- Object.defineProperty(convert[fromModel], "labels", { value: conversions2[fromModel].labels });
957
- const routes = route2(fromModel);
958
- const routeModels = Object.keys(routes);
959
- routeModels.forEach((toModel) => {
960
- const fn = routes[toModel];
961
- convert[fromModel][toModel] = wrapRounded(fn);
962
- convert[fromModel][toModel].raw = wrapRaw(fn);
963
- });
964
- });
965
- colorConvert = convert;
966
- return colorConvert;
967
- }
968
- ansiStyles.exports;
969
- var hasRequiredAnsiStyles;
970
- function requireAnsiStyles() {
971
- if (hasRequiredAnsiStyles) return ansiStyles.exports;
972
- hasRequiredAnsiStyles = 1;
973
- (function(module) {
974
- const wrapAnsi16 = (fn, offset) => (...args) => {
975
- const code = fn(...args);
976
- return `\x1B[${code + offset}m`;
977
- };
978
- const wrapAnsi256 = (fn, offset) => (...args) => {
979
- const code = fn(...args);
980
- return `\x1B[${38 + offset};5;${code}m`;
981
- };
982
- const wrapAnsi16m = (fn, offset) => (...args) => {
983
- const rgb = fn(...args);
984
- return `\x1B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
985
- };
986
- const ansi2ansi = (n) => n;
987
- const rgb2rgb = (r, g, b) => [r, g, b];
988
- const setLazyProperty = (object, property, get) => {
989
- Object.defineProperty(object, property, {
990
- get: () => {
991
- const value = get();
992
- Object.defineProperty(object, property, {
993
- value,
994
- enumerable: true,
995
- configurable: true
996
- });
997
- return value;
998
- },
999
- enumerable: true,
1000
- configurable: true
1001
- });
1002
- };
1003
- let colorConvert2;
1004
- const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
1005
- if (colorConvert2 === void 0) {
1006
- colorConvert2 = requireColorConvert();
1007
- }
1008
- const offset = isBackground ? 10 : 0;
1009
- const styles = {};
1010
- for (const [sourceSpace, suite] of Object.entries(colorConvert2)) {
1011
- const name = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
1012
- if (sourceSpace === targetSpace) {
1013
- styles[name] = wrap(identity, offset);
1014
- } else if (typeof suite === "object") {
1015
- styles[name] = wrap(suite[targetSpace], offset);
1016
- }
1017
- }
1018
- return styles;
1019
- };
1020
- function assembleStyles() {
1021
- const codes = /* @__PURE__ */ new Map();
1022
- const styles = {
1023
- modifier: {
1024
- reset: [0, 0],
1025
- // 21 isn't widely supported and 22 does the same thing
1026
- bold: [1, 22],
1027
- dim: [2, 22],
1028
- italic: [3, 23],
1029
- underline: [4, 24],
1030
- inverse: [7, 27],
1031
- hidden: [8, 28],
1032
- strikethrough: [9, 29]
1033
- },
1034
- color: {
1035
- black: [30, 39],
1036
- red: [31, 39],
1037
- green: [32, 39],
1038
- yellow: [33, 39],
1039
- blue: [34, 39],
1040
- magenta: [35, 39],
1041
- cyan: [36, 39],
1042
- white: [37, 39],
1043
- // Bright color
1044
- blackBright: [90, 39],
1045
- redBright: [91, 39],
1046
- greenBright: [92, 39],
1047
- yellowBright: [93, 39],
1048
- blueBright: [94, 39],
1049
- magentaBright: [95, 39],
1050
- cyanBright: [96, 39],
1051
- whiteBright: [97, 39]
1052
- },
1053
- bgColor: {
1054
- bgBlack: [40, 49],
1055
- bgRed: [41, 49],
1056
- bgGreen: [42, 49],
1057
- bgYellow: [43, 49],
1058
- bgBlue: [44, 49],
1059
- bgMagenta: [45, 49],
1060
- bgCyan: [46, 49],
1061
- bgWhite: [47, 49],
1062
- // Bright color
1063
- bgBlackBright: [100, 49],
1064
- bgRedBright: [101, 49],
1065
- bgGreenBright: [102, 49],
1066
- bgYellowBright: [103, 49],
1067
- bgBlueBright: [104, 49],
1068
- bgMagentaBright: [105, 49],
1069
- bgCyanBright: [106, 49],
1070
- bgWhiteBright: [107, 49]
1071
- }
1072
- };
1073
- styles.color.gray = styles.color.blackBright;
1074
- styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
1075
- styles.color.grey = styles.color.blackBright;
1076
- styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
1077
- for (const [groupName, group] of Object.entries(styles)) {
1078
- for (const [styleName, style] of Object.entries(group)) {
1079
- styles[styleName] = {
1080
- open: `\x1B[${style[0]}m`,
1081
- close: `\x1B[${style[1]}m`
1082
- };
1083
- group[styleName] = styles[styleName];
1084
- codes.set(style[0], style[1]);
1085
- }
1086
- Object.defineProperty(styles, groupName, {
1087
- value: group,
1088
- enumerable: false
1089
- });
1090
- }
1091
- Object.defineProperty(styles, "codes", {
1092
- value: codes,
1093
- enumerable: false
1094
- });
1095
- styles.color.close = "\x1B[39m";
1096
- styles.bgColor.close = "\x1B[49m";
1097
- setLazyProperty(styles.color, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, false));
1098
- setLazyProperty(styles.color, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, false));
1099
- setLazyProperty(styles.color, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, false));
1100
- setLazyProperty(styles.bgColor, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, true));
1101
- setLazyProperty(styles.bgColor, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, true));
1102
- setLazyProperty(styles.bgColor, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, true));
1103
- return styles;
1104
- }
1105
- Object.defineProperty(module, "exports", {
1106
- enumerable: true,
1107
- get: assembleStyles
1108
- });
1109
- })(ansiStyles);
1110
- return ansiStyles.exports;
1111
- }
1112
- var browser;
1113
- var hasRequiredBrowser;
1114
- function requireBrowser() {
1115
- if (hasRequiredBrowser) return browser;
1116
- hasRequiredBrowser = 1;
1117
- browser = {
1118
- stdout: false,
1119
- stderr: false
1120
- };
1121
- return browser;
1122
- }
1123
- var util;
1124
- var hasRequiredUtil;
1125
- function requireUtil() {
1126
- if (hasRequiredUtil) return util;
1127
- hasRequiredUtil = 1;
1128
- const stringReplaceAll = (string, substring, replacer) => {
1129
- let index = string.indexOf(substring);
1130
- if (index === -1) {
1131
- return string;
1132
- }
1133
- const substringLength = substring.length;
1134
- let endIndex = 0;
1135
- let returnValue = "";
1136
- do {
1137
- returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
1138
- endIndex = index + substringLength;
1139
- index = string.indexOf(substring, endIndex);
1140
- } while (index !== -1);
1141
- returnValue += string.substr(endIndex);
1142
- return returnValue;
1143
- };
1144
- const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => {
1145
- let endIndex = 0;
1146
- let returnValue = "";
1147
- do {
1148
- const gotCR = string[index - 1] === "\r";
1149
- returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
1150
- endIndex = index + 1;
1151
- index = string.indexOf("\n", endIndex);
1152
- } while (index !== -1);
1153
- returnValue += string.substr(endIndex);
1154
- return returnValue;
1155
- };
1156
- util = {
1157
- stringReplaceAll,
1158
- stringEncaseCRLFWithFirstIndex
1159
- };
1160
- return util;
1161
- }
1162
- var templates;
1163
- var hasRequiredTemplates;
1164
- function requireTemplates() {
1165
- if (hasRequiredTemplates) return templates;
1166
- hasRequiredTemplates = 1;
1167
- 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;
1168
- const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
1169
- const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
1170
- const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
1171
- const ESCAPES = /* @__PURE__ */ new Map([
1172
- ["n", "\n"],
1173
- ["r", "\r"],
1174
- ["t", " "],
1175
- ["b", "\b"],
1176
- ["f", "\f"],
1177
- ["v", "\v"],
1178
- ["0", "\0"],
1179
- ["\\", "\\"],
1180
- ["e", "\x1B"],
1181
- ["a", "\x07"]
1182
- ]);
1183
- function unescape(c) {
1184
- const u = c[0] === "u";
1185
- const bracket = c[1] === "{";
1186
- if (u && !bracket && c.length === 5 || c[0] === "x" && c.length === 3) {
1187
- return String.fromCharCode(parseInt(c.slice(1), 16));
1188
- }
1189
- if (u && bracket) {
1190
- return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
1191
- }
1192
- return ESCAPES.get(c) || c;
1193
- }
1194
- function parseArguments(name, arguments_) {
1195
- const results = [];
1196
- const chunks = arguments_.trim().split(/\s*,\s*/g);
1197
- let matches;
1198
- for (const chunk of chunks) {
1199
- const number = Number(chunk);
1200
- if (!Number.isNaN(number)) {
1201
- results.push(number);
1202
- } else if (matches = chunk.match(STRING_REGEX)) {
1203
- results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
1204
- } else {
1205
- throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
1206
- }
1207
- }
1208
- return results;
1209
- }
1210
- function parseStyle(style) {
1211
- STYLE_REGEX.lastIndex = 0;
1212
- const results = [];
1213
- let matches;
1214
- while ((matches = STYLE_REGEX.exec(style)) !== null) {
1215
- const name = matches[1];
1216
- if (matches[2]) {
1217
- const args = parseArguments(name, matches[2]);
1218
- results.push([name].concat(args));
1219
- } else {
1220
- results.push([name]);
1221
- }
1222
- }
1223
- return results;
1224
- }
1225
- function buildStyle(chalk2, styles) {
1226
- const enabled = {};
1227
- for (const layer of styles) {
1228
- for (const style of layer.styles) {
1229
- enabled[style[0]] = layer.inverse ? null : style.slice(1);
1230
- }
1231
- }
1232
- let current = chalk2;
1233
- for (const [styleName, styles2] of Object.entries(enabled)) {
1234
- if (!Array.isArray(styles2)) {
1235
- continue;
1236
- }
1237
- if (!(styleName in current)) {
1238
- throw new Error(`Unknown Chalk style: ${styleName}`);
1239
- }
1240
- current = styles2.length > 0 ? current[styleName](...styles2) : current[styleName];
1241
- }
1242
- return current;
1243
- }
1244
- templates = (chalk2, temporary) => {
1245
- const styles = [];
1246
- const chunks = [];
1247
- let chunk = [];
1248
- temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
1249
- if (escapeCharacter) {
1250
- chunk.push(unescape(escapeCharacter));
1251
- } else if (style) {
1252
- const string = chunk.join("");
1253
- chunk = [];
1254
- chunks.push(styles.length === 0 ? string : buildStyle(chalk2, styles)(string));
1255
- styles.push({ inverse, styles: parseStyle(style) });
1256
- } else if (close) {
1257
- if (styles.length === 0) {
1258
- throw new Error("Found extraneous } in Chalk template literal");
1259
- }
1260
- chunks.push(buildStyle(chalk2, styles)(chunk.join("")));
1261
- chunk = [];
1262
- styles.pop();
1263
- } else {
1264
- chunk.push(character);
1265
- }
1266
- });
1267
- chunks.push(chunk.join(""));
1268
- if (styles.length > 0) {
1269
- const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? "" : "s"} (\`}\`)`;
1270
- throw new Error(errMessage);
1271
- }
1272
- return chunks.join("");
1273
- };
1274
- return templates;
1275
- }
1276
- var source;
1277
- var hasRequiredSource;
1278
- function requireSource() {
1279
- if (hasRequiredSource) return source;
1280
- hasRequiredSource = 1;
1281
- const ansiStyles2 = requireAnsiStyles();
1282
- const { stdout: stdoutColor, stderr: stderrColor } = requireBrowser();
1283
- const {
1284
- stringReplaceAll,
1285
- stringEncaseCRLFWithFirstIndex
1286
- } = requireUtil();
1287
- const { isArray } = Array;
1288
- const levelMapping = [
1289
- "ansi",
1290
- "ansi",
1291
- "ansi256",
1292
- "ansi16m"
1293
- ];
1294
- const styles = /* @__PURE__ */ Object.create(null);
1295
- const applyOptions = (object, options = {}) => {
1296
- if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
1297
- throw new Error("The `level` option should be an integer from 0 to 3");
1298
- }
1299
- const colorLevel = stdoutColor ? stdoutColor.level : 0;
1300
- object.level = options.level === void 0 ? colorLevel : options.level;
1301
- };
1302
- class ChalkClass {
1303
- constructor(options) {
1304
- return chalkFactory(options);
1305
- }
1306
- }
1307
- const chalkFactory = (options) => {
1308
- const chalk3 = {};
1309
- applyOptions(chalk3, options);
1310
- chalk3.template = (...arguments_) => chalkTag(chalk3.template, ...arguments_);
1311
- Object.setPrototypeOf(chalk3, Chalk.prototype);
1312
- Object.setPrototypeOf(chalk3.template, chalk3);
1313
- chalk3.template.constructor = () => {
1314
- throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
1315
- };
1316
- chalk3.template.Instance = ChalkClass;
1317
- return chalk3.template;
1318
- };
1319
- function Chalk(options) {
1320
- return chalkFactory(options);
1321
- }
1322
- for (const [styleName, style] of Object.entries(ansiStyles2)) {
1323
- styles[styleName] = {
1324
- get() {
1325
- const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
1326
- Object.defineProperty(this, styleName, { value: builder });
1327
- return builder;
1328
- }
1329
- };
1330
- }
1331
- styles.visible = {
1332
- get() {
1333
- const builder = createBuilder(this, this._styler, true);
1334
- Object.defineProperty(this, "visible", { value: builder });
1335
- return builder;
1336
- }
1337
- };
1338
- const usedModels = ["rgb", "hex", "keyword", "hsl", "hsv", "hwb", "ansi", "ansi256"];
1339
- for (const model of usedModels) {
1340
- styles[model] = {
1341
- get() {
1342
- const { level } = this;
1343
- return function(...arguments_) {
1344
- const styler = createStyler(ansiStyles2.color[levelMapping[level]][model](...arguments_), ansiStyles2.color.close, this._styler);
1345
- return createBuilder(this, styler, this._isEmpty);
1346
- };
1347
- }
1348
- };
1349
- }
1350
- for (const model of usedModels) {
1351
- const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
1352
- styles[bgModel] = {
1353
- get() {
1354
- const { level } = this;
1355
- return function(...arguments_) {
1356
- const styler = createStyler(ansiStyles2.bgColor[levelMapping[level]][model](...arguments_), ansiStyles2.bgColor.close, this._styler);
1357
- return createBuilder(this, styler, this._isEmpty);
1358
- };
1359
- }
1360
- };
1361
- }
1362
- const proto = Object.defineProperties(() => {
1363
- }, {
1364
- ...styles,
1365
- level: {
1366
- enumerable: true,
1367
- get() {
1368
- return this._generator.level;
1369
- },
1370
- set(level) {
1371
- this._generator.level = level;
1372
- }
1373
- }
1374
- });
1375
- const createStyler = (open, close, parent) => {
1376
- let openAll;
1377
- let closeAll;
1378
- if (parent === void 0) {
1379
- openAll = open;
1380
- closeAll = close;
1381
- } else {
1382
- openAll = parent.openAll + open;
1383
- closeAll = close + parent.closeAll;
1384
- }
1385
- return {
1386
- open,
1387
- close,
1388
- openAll,
1389
- closeAll,
1390
- parent
1391
- };
1392
- };
1393
- const createBuilder = (self, _styler, _isEmpty) => {
1394
- const builder = (...arguments_) => {
1395
- if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
1396
- return applyStyle(builder, chalkTag(builder, ...arguments_));
1397
- }
1398
- return applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
1399
- };
1400
- Object.setPrototypeOf(builder, proto);
1401
- builder._generator = self;
1402
- builder._styler = _styler;
1403
- builder._isEmpty = _isEmpty;
1404
- return builder;
1405
- };
1406
- const applyStyle = (self, string) => {
1407
- if (self.level <= 0 || !string) {
1408
- return self._isEmpty ? "" : string;
1409
- }
1410
- let styler = self._styler;
1411
- if (styler === void 0) {
1412
- return string;
1413
- }
1414
- const { openAll, closeAll } = styler;
1415
- if (string.indexOf("\x1B") !== -1) {
1416
- while (styler !== void 0) {
1417
- string = stringReplaceAll(string, styler.close, styler.open);
1418
- styler = styler.parent;
1419
- }
1420
- }
1421
- const lfIndex = string.indexOf("\n");
1422
- if (lfIndex !== -1) {
1423
- string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
1424
- }
1425
- return openAll + string + closeAll;
1426
- };
1427
- let template;
1428
- const chalkTag = (chalk3, ...strings) => {
1429
- const [firstString] = strings;
1430
- if (!isArray(firstString) || !isArray(firstString.raw)) {
1431
- return strings.join(" ");
1432
- }
1433
- const arguments_ = strings.slice(1);
1434
- const parts = [firstString.raw[0]];
1435
- for (let i = 1; i < firstString.length; i++) {
1436
- parts.push(
1437
- String(arguments_[i - 1]).replace(/[{}\\]/g, "\\$&"),
1438
- String(firstString.raw[i])
1439
- );
1440
- }
1441
- if (template === void 0) {
1442
- template = requireTemplates();
1443
- }
1444
- return template(chalk3, parts.join(""));
1445
- };
1446
- Object.defineProperties(Chalk.prototype, styles);
1447
- const chalk2 = Chalk();
1448
- chalk2.supportsColor = stdoutColor;
1449
- chalk2.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
1450
- chalk2.stderr.supportsColor = stderrColor;
1451
- source = chalk2;
1452
- return source;
1453
- }
1454
- var sourceExports = requireSource();
1455
- const chalk = /* @__PURE__ */ getDefaultExportFromCjs(sourceExports);
1456
- var ModelDelimeter = /* @__PURE__ */ ((ModelDelimeter2) => {
1457
- ModelDelimeter2["ROOT"] = "_";
1458
- ModelDelimeter2["SEPERATOR"] = "|";
1459
- ModelDelimeter2["COMPONENT_SEPERATOR"] = "@";
1460
- ModelDelimeter2["NID_SEPERATOR"] = "^";
1461
- return ModelDelimeter2;
1462
- })(ModelDelimeter || {});
1463
- const CheckValidChar = (checkParams) => {
1464
- const invalidChars = [
1465
- "_",
1466
- "|",
1467
- "@",
1468
- "^"
1469
- /* NID_SEPERATOR */
1470
- ];
1471
- checkParams.forEach((param) => {
1472
- invalidChars.forEach((char) => {
1473
- if (param[1].includes(char)) {
1474
- throw new Error(`Invalid character inside [${param[0]}:${param[1]}], no [${char}] allowed`);
1475
- }
1476
- });
1477
- });
2
+ //#region \0rolldown/runtime.js
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
+ key = keys[i];
13
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
21
+ value: mod,
22
+ enumerable: true
23
+ }) : target, mod));
24
+ //#endregion
25
+ //#region node_modules/color-name/index.js
26
+ var require_color_name = /* @__PURE__ */ __commonJSMin(((exports, module) => {
27
+ module.exports = {
28
+ "aliceblue": [
29
+ 240,
30
+ 248,
31
+ 255
32
+ ],
33
+ "antiquewhite": [
34
+ 250,
35
+ 235,
36
+ 215
37
+ ],
38
+ "aqua": [
39
+ 0,
40
+ 255,
41
+ 255
42
+ ],
43
+ "aquamarine": [
44
+ 127,
45
+ 255,
46
+ 212
47
+ ],
48
+ "azure": [
49
+ 240,
50
+ 255,
51
+ 255
52
+ ],
53
+ "beige": [
54
+ 245,
55
+ 245,
56
+ 220
57
+ ],
58
+ "bisque": [
59
+ 255,
60
+ 228,
61
+ 196
62
+ ],
63
+ "black": [
64
+ 0,
65
+ 0,
66
+ 0
67
+ ],
68
+ "blanchedalmond": [
69
+ 255,
70
+ 235,
71
+ 205
72
+ ],
73
+ "blue": [
74
+ 0,
75
+ 0,
76
+ 255
77
+ ],
78
+ "blueviolet": [
79
+ 138,
80
+ 43,
81
+ 226
82
+ ],
83
+ "brown": [
84
+ 165,
85
+ 42,
86
+ 42
87
+ ],
88
+ "burlywood": [
89
+ 222,
90
+ 184,
91
+ 135
92
+ ],
93
+ "cadetblue": [
94
+ 95,
95
+ 158,
96
+ 160
97
+ ],
98
+ "chartreuse": [
99
+ 127,
100
+ 255,
101
+ 0
102
+ ],
103
+ "chocolate": [
104
+ 210,
105
+ 105,
106
+ 30
107
+ ],
108
+ "coral": [
109
+ 255,
110
+ 127,
111
+ 80
112
+ ],
113
+ "cornflowerblue": [
114
+ 100,
115
+ 149,
116
+ 237
117
+ ],
118
+ "cornsilk": [
119
+ 255,
120
+ 248,
121
+ 220
122
+ ],
123
+ "crimson": [
124
+ 220,
125
+ 20,
126
+ 60
127
+ ],
128
+ "cyan": [
129
+ 0,
130
+ 255,
131
+ 255
132
+ ],
133
+ "darkblue": [
134
+ 0,
135
+ 0,
136
+ 139
137
+ ],
138
+ "darkcyan": [
139
+ 0,
140
+ 139,
141
+ 139
142
+ ],
143
+ "darkgoldenrod": [
144
+ 184,
145
+ 134,
146
+ 11
147
+ ],
148
+ "darkgray": [
149
+ 169,
150
+ 169,
151
+ 169
152
+ ],
153
+ "darkgreen": [
154
+ 0,
155
+ 100,
156
+ 0
157
+ ],
158
+ "darkgrey": [
159
+ 169,
160
+ 169,
161
+ 169
162
+ ],
163
+ "darkkhaki": [
164
+ 189,
165
+ 183,
166
+ 107
167
+ ],
168
+ "darkmagenta": [
169
+ 139,
170
+ 0,
171
+ 139
172
+ ],
173
+ "darkolivegreen": [
174
+ 85,
175
+ 107,
176
+ 47
177
+ ],
178
+ "darkorange": [
179
+ 255,
180
+ 140,
181
+ 0
182
+ ],
183
+ "darkorchid": [
184
+ 153,
185
+ 50,
186
+ 204
187
+ ],
188
+ "darkred": [
189
+ 139,
190
+ 0,
191
+ 0
192
+ ],
193
+ "darksalmon": [
194
+ 233,
195
+ 150,
196
+ 122
197
+ ],
198
+ "darkseagreen": [
199
+ 143,
200
+ 188,
201
+ 143
202
+ ],
203
+ "darkslateblue": [
204
+ 72,
205
+ 61,
206
+ 139
207
+ ],
208
+ "darkslategray": [
209
+ 47,
210
+ 79,
211
+ 79
212
+ ],
213
+ "darkslategrey": [
214
+ 47,
215
+ 79,
216
+ 79
217
+ ],
218
+ "darkturquoise": [
219
+ 0,
220
+ 206,
221
+ 209
222
+ ],
223
+ "darkviolet": [
224
+ 148,
225
+ 0,
226
+ 211
227
+ ],
228
+ "deeppink": [
229
+ 255,
230
+ 20,
231
+ 147
232
+ ],
233
+ "deepskyblue": [
234
+ 0,
235
+ 191,
236
+ 255
237
+ ],
238
+ "dimgray": [
239
+ 105,
240
+ 105,
241
+ 105
242
+ ],
243
+ "dimgrey": [
244
+ 105,
245
+ 105,
246
+ 105
247
+ ],
248
+ "dodgerblue": [
249
+ 30,
250
+ 144,
251
+ 255
252
+ ],
253
+ "firebrick": [
254
+ 178,
255
+ 34,
256
+ 34
257
+ ],
258
+ "floralwhite": [
259
+ 255,
260
+ 250,
261
+ 240
262
+ ],
263
+ "forestgreen": [
264
+ 34,
265
+ 139,
266
+ 34
267
+ ],
268
+ "fuchsia": [
269
+ 255,
270
+ 0,
271
+ 255
272
+ ],
273
+ "gainsboro": [
274
+ 220,
275
+ 220,
276
+ 220
277
+ ],
278
+ "ghostwhite": [
279
+ 248,
280
+ 248,
281
+ 255
282
+ ],
283
+ "gold": [
284
+ 255,
285
+ 215,
286
+ 0
287
+ ],
288
+ "goldenrod": [
289
+ 218,
290
+ 165,
291
+ 32
292
+ ],
293
+ "gray": [
294
+ 128,
295
+ 128,
296
+ 128
297
+ ],
298
+ "green": [
299
+ 0,
300
+ 128,
301
+ 0
302
+ ],
303
+ "greenyellow": [
304
+ 173,
305
+ 255,
306
+ 47
307
+ ],
308
+ "grey": [
309
+ 128,
310
+ 128,
311
+ 128
312
+ ],
313
+ "honeydew": [
314
+ 240,
315
+ 255,
316
+ 240
317
+ ],
318
+ "hotpink": [
319
+ 255,
320
+ 105,
321
+ 180
322
+ ],
323
+ "indianred": [
324
+ 205,
325
+ 92,
326
+ 92
327
+ ],
328
+ "indigo": [
329
+ 75,
330
+ 0,
331
+ 130
332
+ ],
333
+ "ivory": [
334
+ 255,
335
+ 255,
336
+ 240
337
+ ],
338
+ "khaki": [
339
+ 240,
340
+ 230,
341
+ 140
342
+ ],
343
+ "lavender": [
344
+ 230,
345
+ 230,
346
+ 250
347
+ ],
348
+ "lavenderblush": [
349
+ 255,
350
+ 240,
351
+ 245
352
+ ],
353
+ "lawngreen": [
354
+ 124,
355
+ 252,
356
+ 0
357
+ ],
358
+ "lemonchiffon": [
359
+ 255,
360
+ 250,
361
+ 205
362
+ ],
363
+ "lightblue": [
364
+ 173,
365
+ 216,
366
+ 230
367
+ ],
368
+ "lightcoral": [
369
+ 240,
370
+ 128,
371
+ 128
372
+ ],
373
+ "lightcyan": [
374
+ 224,
375
+ 255,
376
+ 255
377
+ ],
378
+ "lightgoldenrodyellow": [
379
+ 250,
380
+ 250,
381
+ 210
382
+ ],
383
+ "lightgray": [
384
+ 211,
385
+ 211,
386
+ 211
387
+ ],
388
+ "lightgreen": [
389
+ 144,
390
+ 238,
391
+ 144
392
+ ],
393
+ "lightgrey": [
394
+ 211,
395
+ 211,
396
+ 211
397
+ ],
398
+ "lightpink": [
399
+ 255,
400
+ 182,
401
+ 193
402
+ ],
403
+ "lightsalmon": [
404
+ 255,
405
+ 160,
406
+ 122
407
+ ],
408
+ "lightseagreen": [
409
+ 32,
410
+ 178,
411
+ 170
412
+ ],
413
+ "lightskyblue": [
414
+ 135,
415
+ 206,
416
+ 250
417
+ ],
418
+ "lightslategray": [
419
+ 119,
420
+ 136,
421
+ 153
422
+ ],
423
+ "lightslategrey": [
424
+ 119,
425
+ 136,
426
+ 153
427
+ ],
428
+ "lightsteelblue": [
429
+ 176,
430
+ 196,
431
+ 222
432
+ ],
433
+ "lightyellow": [
434
+ 255,
435
+ 255,
436
+ 224
437
+ ],
438
+ "lime": [
439
+ 0,
440
+ 255,
441
+ 0
442
+ ],
443
+ "limegreen": [
444
+ 50,
445
+ 205,
446
+ 50
447
+ ],
448
+ "linen": [
449
+ 250,
450
+ 240,
451
+ 230
452
+ ],
453
+ "magenta": [
454
+ 255,
455
+ 0,
456
+ 255
457
+ ],
458
+ "maroon": [
459
+ 128,
460
+ 0,
461
+ 0
462
+ ],
463
+ "mediumaquamarine": [
464
+ 102,
465
+ 205,
466
+ 170
467
+ ],
468
+ "mediumblue": [
469
+ 0,
470
+ 0,
471
+ 205
472
+ ],
473
+ "mediumorchid": [
474
+ 186,
475
+ 85,
476
+ 211
477
+ ],
478
+ "mediumpurple": [
479
+ 147,
480
+ 112,
481
+ 219
482
+ ],
483
+ "mediumseagreen": [
484
+ 60,
485
+ 179,
486
+ 113
487
+ ],
488
+ "mediumslateblue": [
489
+ 123,
490
+ 104,
491
+ 238
492
+ ],
493
+ "mediumspringgreen": [
494
+ 0,
495
+ 250,
496
+ 154
497
+ ],
498
+ "mediumturquoise": [
499
+ 72,
500
+ 209,
501
+ 204
502
+ ],
503
+ "mediumvioletred": [
504
+ 199,
505
+ 21,
506
+ 133
507
+ ],
508
+ "midnightblue": [
509
+ 25,
510
+ 25,
511
+ 112
512
+ ],
513
+ "mintcream": [
514
+ 245,
515
+ 255,
516
+ 250
517
+ ],
518
+ "mistyrose": [
519
+ 255,
520
+ 228,
521
+ 225
522
+ ],
523
+ "moccasin": [
524
+ 255,
525
+ 228,
526
+ 181
527
+ ],
528
+ "navajowhite": [
529
+ 255,
530
+ 222,
531
+ 173
532
+ ],
533
+ "navy": [
534
+ 0,
535
+ 0,
536
+ 128
537
+ ],
538
+ "oldlace": [
539
+ 253,
540
+ 245,
541
+ 230
542
+ ],
543
+ "olive": [
544
+ 128,
545
+ 128,
546
+ 0
547
+ ],
548
+ "olivedrab": [
549
+ 107,
550
+ 142,
551
+ 35
552
+ ],
553
+ "orange": [
554
+ 255,
555
+ 165,
556
+ 0
557
+ ],
558
+ "orangered": [
559
+ 255,
560
+ 69,
561
+ 0
562
+ ],
563
+ "orchid": [
564
+ 218,
565
+ 112,
566
+ 214
567
+ ],
568
+ "palegoldenrod": [
569
+ 238,
570
+ 232,
571
+ 170
572
+ ],
573
+ "palegreen": [
574
+ 152,
575
+ 251,
576
+ 152
577
+ ],
578
+ "paleturquoise": [
579
+ 175,
580
+ 238,
581
+ 238
582
+ ],
583
+ "palevioletred": [
584
+ 219,
585
+ 112,
586
+ 147
587
+ ],
588
+ "papayawhip": [
589
+ 255,
590
+ 239,
591
+ 213
592
+ ],
593
+ "peachpuff": [
594
+ 255,
595
+ 218,
596
+ 185
597
+ ],
598
+ "peru": [
599
+ 205,
600
+ 133,
601
+ 63
602
+ ],
603
+ "pink": [
604
+ 255,
605
+ 192,
606
+ 203
607
+ ],
608
+ "plum": [
609
+ 221,
610
+ 160,
611
+ 221
612
+ ],
613
+ "powderblue": [
614
+ 176,
615
+ 224,
616
+ 230
617
+ ],
618
+ "purple": [
619
+ 128,
620
+ 0,
621
+ 128
622
+ ],
623
+ "rebeccapurple": [
624
+ 102,
625
+ 51,
626
+ 153
627
+ ],
628
+ "red": [
629
+ 255,
630
+ 0,
631
+ 0
632
+ ],
633
+ "rosybrown": [
634
+ 188,
635
+ 143,
636
+ 143
637
+ ],
638
+ "royalblue": [
639
+ 65,
640
+ 105,
641
+ 225
642
+ ],
643
+ "saddlebrown": [
644
+ 139,
645
+ 69,
646
+ 19
647
+ ],
648
+ "salmon": [
649
+ 250,
650
+ 128,
651
+ 114
652
+ ],
653
+ "sandybrown": [
654
+ 244,
655
+ 164,
656
+ 96
657
+ ],
658
+ "seagreen": [
659
+ 46,
660
+ 139,
661
+ 87
662
+ ],
663
+ "seashell": [
664
+ 255,
665
+ 245,
666
+ 238
667
+ ],
668
+ "sienna": [
669
+ 160,
670
+ 82,
671
+ 45
672
+ ],
673
+ "silver": [
674
+ 192,
675
+ 192,
676
+ 192
677
+ ],
678
+ "skyblue": [
679
+ 135,
680
+ 206,
681
+ 235
682
+ ],
683
+ "slateblue": [
684
+ 106,
685
+ 90,
686
+ 205
687
+ ],
688
+ "slategray": [
689
+ 112,
690
+ 128,
691
+ 144
692
+ ],
693
+ "slategrey": [
694
+ 112,
695
+ 128,
696
+ 144
697
+ ],
698
+ "snow": [
699
+ 255,
700
+ 250,
701
+ 250
702
+ ],
703
+ "springgreen": [
704
+ 0,
705
+ 255,
706
+ 127
707
+ ],
708
+ "steelblue": [
709
+ 70,
710
+ 130,
711
+ 180
712
+ ],
713
+ "tan": [
714
+ 210,
715
+ 180,
716
+ 140
717
+ ],
718
+ "teal": [
719
+ 0,
720
+ 128,
721
+ 128
722
+ ],
723
+ "thistle": [
724
+ 216,
725
+ 191,
726
+ 216
727
+ ],
728
+ "tomato": [
729
+ 255,
730
+ 99,
731
+ 71
732
+ ],
733
+ "turquoise": [
734
+ 64,
735
+ 224,
736
+ 208
737
+ ],
738
+ "violet": [
739
+ 238,
740
+ 130,
741
+ 238
742
+ ],
743
+ "wheat": [
744
+ 245,
745
+ 222,
746
+ 179
747
+ ],
748
+ "white": [
749
+ 255,
750
+ 255,
751
+ 255
752
+ ],
753
+ "whitesmoke": [
754
+ 245,
755
+ 245,
756
+ 245
757
+ ],
758
+ "yellow": [
759
+ 255,
760
+ 255,
761
+ 0
762
+ ],
763
+ "yellowgreen": [
764
+ 154,
765
+ 205,
766
+ 50
767
+ ]
768
+ };
769
+ }));
770
+ //#endregion
771
+ //#region node_modules/color-convert/conversions.js
772
+ var require_conversions = /* @__PURE__ */ __commonJSMin(((exports, module) => {
773
+ var cssKeywords = require_color_name();
774
+ var reverseKeywords = {};
775
+ for (const key of Object.keys(cssKeywords)) reverseKeywords[cssKeywords[key]] = key;
776
+ var convert = {
777
+ rgb: {
778
+ channels: 3,
779
+ labels: "rgb"
780
+ },
781
+ hsl: {
782
+ channels: 3,
783
+ labels: "hsl"
784
+ },
785
+ hsv: {
786
+ channels: 3,
787
+ labels: "hsv"
788
+ },
789
+ hwb: {
790
+ channels: 3,
791
+ labels: "hwb"
792
+ },
793
+ cmyk: {
794
+ channels: 4,
795
+ labels: "cmyk"
796
+ },
797
+ xyz: {
798
+ channels: 3,
799
+ labels: "xyz"
800
+ },
801
+ lab: {
802
+ channels: 3,
803
+ labels: "lab"
804
+ },
805
+ lch: {
806
+ channels: 3,
807
+ labels: "lch"
808
+ },
809
+ hex: {
810
+ channels: 1,
811
+ labels: ["hex"]
812
+ },
813
+ keyword: {
814
+ channels: 1,
815
+ labels: ["keyword"]
816
+ },
817
+ ansi16: {
818
+ channels: 1,
819
+ labels: ["ansi16"]
820
+ },
821
+ ansi256: {
822
+ channels: 1,
823
+ labels: ["ansi256"]
824
+ },
825
+ hcg: {
826
+ channels: 3,
827
+ labels: [
828
+ "h",
829
+ "c",
830
+ "g"
831
+ ]
832
+ },
833
+ apple: {
834
+ channels: 3,
835
+ labels: [
836
+ "r16",
837
+ "g16",
838
+ "b16"
839
+ ]
840
+ },
841
+ gray: {
842
+ channels: 1,
843
+ labels: ["gray"]
844
+ }
845
+ };
846
+ module.exports = convert;
847
+ for (const model of Object.keys(convert)) {
848
+ if (!("channels" in convert[model])) throw new Error("missing channels property: " + model);
849
+ if (!("labels" in convert[model])) throw new Error("missing channel labels property: " + model);
850
+ if (convert[model].labels.length !== convert[model].channels) throw new Error("channel and label counts mismatch: " + model);
851
+ const { channels, labels } = convert[model];
852
+ delete convert[model].channels;
853
+ delete convert[model].labels;
854
+ Object.defineProperty(convert[model], "channels", { value: channels });
855
+ Object.defineProperty(convert[model], "labels", { value: labels });
856
+ }
857
+ convert.rgb.hsl = function(rgb) {
858
+ const r = rgb[0] / 255;
859
+ const g = rgb[1] / 255;
860
+ const b = rgb[2] / 255;
861
+ const min = Math.min(r, g, b);
862
+ const max = Math.max(r, g, b);
863
+ const delta = max - min;
864
+ let h;
865
+ let s;
866
+ if (max === min) h = 0;
867
+ else if (r === max) h = (g - b) / delta;
868
+ else if (g === max) h = 2 + (b - r) / delta;
869
+ else if (b === max) h = 4 + (r - g) / delta;
870
+ h = Math.min(h * 60, 360);
871
+ if (h < 0) h += 360;
872
+ const l = (min + max) / 2;
873
+ if (max === min) s = 0;
874
+ else if (l <= .5) s = delta / (max + min);
875
+ else s = delta / (2 - max - min);
876
+ return [
877
+ h,
878
+ s * 100,
879
+ l * 100
880
+ ];
881
+ };
882
+ convert.rgb.hsv = function(rgb) {
883
+ let rdif;
884
+ let gdif;
885
+ let bdif;
886
+ let h;
887
+ let s;
888
+ const r = rgb[0] / 255;
889
+ const g = rgb[1] / 255;
890
+ const b = rgb[2] / 255;
891
+ const v = Math.max(r, g, b);
892
+ const diff = v - Math.min(r, g, b);
893
+ const diffc = function(c) {
894
+ return (v - c) / 6 / diff + 1 / 2;
895
+ };
896
+ if (diff === 0) {
897
+ h = 0;
898
+ s = 0;
899
+ } else {
900
+ s = diff / v;
901
+ rdif = diffc(r);
902
+ gdif = diffc(g);
903
+ bdif = diffc(b);
904
+ if (r === v) h = bdif - gdif;
905
+ else if (g === v) h = 1 / 3 + rdif - bdif;
906
+ else if (b === v) h = 2 / 3 + gdif - rdif;
907
+ if (h < 0) h += 1;
908
+ else if (h > 1) h -= 1;
909
+ }
910
+ return [
911
+ h * 360,
912
+ s * 100,
913
+ v * 100
914
+ ];
915
+ };
916
+ convert.rgb.hwb = function(rgb) {
917
+ const r = rgb[0];
918
+ const g = rgb[1];
919
+ let b = rgb[2];
920
+ const h = convert.rgb.hsl(rgb)[0];
921
+ const w = 1 / 255 * Math.min(r, Math.min(g, b));
922
+ b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
923
+ return [
924
+ h,
925
+ w * 100,
926
+ b * 100
927
+ ];
928
+ };
929
+ convert.rgb.cmyk = function(rgb) {
930
+ const r = rgb[0] / 255;
931
+ const g = rgb[1] / 255;
932
+ const b = rgb[2] / 255;
933
+ const k = Math.min(1 - r, 1 - g, 1 - b);
934
+ const c = (1 - r - k) / (1 - k) || 0;
935
+ const m = (1 - g - k) / (1 - k) || 0;
936
+ const y = (1 - b - k) / (1 - k) || 0;
937
+ return [
938
+ c * 100,
939
+ m * 100,
940
+ y * 100,
941
+ k * 100
942
+ ];
943
+ };
944
+ function comparativeDistance(x, y) {
945
+ return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
946
+ }
947
+ convert.rgb.keyword = function(rgb) {
948
+ const reversed = reverseKeywords[rgb];
949
+ if (reversed) return reversed;
950
+ let currentClosestDistance = Infinity;
951
+ let currentClosestKeyword;
952
+ for (const keyword of Object.keys(cssKeywords)) {
953
+ const value = cssKeywords[keyword];
954
+ const distance = comparativeDistance(rgb, value);
955
+ if (distance < currentClosestDistance) {
956
+ currentClosestDistance = distance;
957
+ currentClosestKeyword = keyword;
958
+ }
959
+ }
960
+ return currentClosestKeyword;
961
+ };
962
+ convert.keyword.rgb = function(keyword) {
963
+ return cssKeywords[keyword];
964
+ };
965
+ convert.rgb.xyz = function(rgb) {
966
+ let r = rgb[0] / 255;
967
+ let g = rgb[1] / 255;
968
+ let b = rgb[2] / 255;
969
+ r = r > .04045 ? ((r + .055) / 1.055) ** 2.4 : r / 12.92;
970
+ g = g > .04045 ? ((g + .055) / 1.055) ** 2.4 : g / 12.92;
971
+ b = b > .04045 ? ((b + .055) / 1.055) ** 2.4 : b / 12.92;
972
+ const x = r * .4124 + g * .3576 + b * .1805;
973
+ const y = r * .2126 + g * .7152 + b * .0722;
974
+ const z = r * .0193 + g * .1192 + b * .9505;
975
+ return [
976
+ x * 100,
977
+ y * 100,
978
+ z * 100
979
+ ];
980
+ };
981
+ convert.rgb.lab = function(rgb) {
982
+ const xyz = convert.rgb.xyz(rgb);
983
+ let x = xyz[0];
984
+ let y = xyz[1];
985
+ let z = xyz[2];
986
+ x /= 95.047;
987
+ y /= 100;
988
+ z /= 108.883;
989
+ x = x > .008856 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
990
+ y = y > .008856 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
991
+ z = z > .008856 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
992
+ return [
993
+ 116 * y - 16,
994
+ 500 * (x - y),
995
+ 200 * (y - z)
996
+ ];
997
+ };
998
+ convert.hsl.rgb = function(hsl) {
999
+ const h = hsl[0] / 360;
1000
+ const s = hsl[1] / 100;
1001
+ const l = hsl[2] / 100;
1002
+ let t2;
1003
+ let t3;
1004
+ let val;
1005
+ if (s === 0) {
1006
+ val = l * 255;
1007
+ return [
1008
+ val,
1009
+ val,
1010
+ val
1011
+ ];
1012
+ }
1013
+ if (l < .5) t2 = l * (1 + s);
1014
+ else t2 = l + s - l * s;
1015
+ const t1 = 2 * l - t2;
1016
+ const rgb = [
1017
+ 0,
1018
+ 0,
1019
+ 0
1020
+ ];
1021
+ for (let i = 0; i < 3; i++) {
1022
+ t3 = h + 1 / 3 * -(i - 1);
1023
+ if (t3 < 0) t3++;
1024
+ if (t3 > 1) t3--;
1025
+ if (6 * t3 < 1) val = t1 + (t2 - t1) * 6 * t3;
1026
+ else if (2 * t3 < 1) val = t2;
1027
+ else if (3 * t3 < 2) val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
1028
+ else val = t1;
1029
+ rgb[i] = val * 255;
1030
+ }
1031
+ return rgb;
1032
+ };
1033
+ convert.hsl.hsv = function(hsl) {
1034
+ const h = hsl[0];
1035
+ let s = hsl[1] / 100;
1036
+ let l = hsl[2] / 100;
1037
+ let smin = s;
1038
+ const lmin = Math.max(l, .01);
1039
+ l *= 2;
1040
+ s *= l <= 1 ? l : 2 - l;
1041
+ smin *= lmin <= 1 ? lmin : 2 - lmin;
1042
+ const v = (l + s) / 2;
1043
+ return [
1044
+ h,
1045
+ (l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s)) * 100,
1046
+ v * 100
1047
+ ];
1048
+ };
1049
+ convert.hsv.rgb = function(hsv) {
1050
+ const h = hsv[0] / 60;
1051
+ const s = hsv[1] / 100;
1052
+ let v = hsv[2] / 100;
1053
+ const hi = Math.floor(h) % 6;
1054
+ const f = h - Math.floor(h);
1055
+ const p = 255 * v * (1 - s);
1056
+ const q = 255 * v * (1 - s * f);
1057
+ const t = 255 * v * (1 - s * (1 - f));
1058
+ v *= 255;
1059
+ switch (hi) {
1060
+ case 0: return [
1061
+ v,
1062
+ t,
1063
+ p
1064
+ ];
1065
+ case 1: return [
1066
+ q,
1067
+ v,
1068
+ p
1069
+ ];
1070
+ case 2: return [
1071
+ p,
1072
+ v,
1073
+ t
1074
+ ];
1075
+ case 3: return [
1076
+ p,
1077
+ q,
1078
+ v
1079
+ ];
1080
+ case 4: return [
1081
+ t,
1082
+ p,
1083
+ v
1084
+ ];
1085
+ case 5: return [
1086
+ v,
1087
+ p,
1088
+ q
1089
+ ];
1090
+ }
1091
+ };
1092
+ convert.hsv.hsl = function(hsv) {
1093
+ const h = hsv[0];
1094
+ const s = hsv[1] / 100;
1095
+ const v = hsv[2] / 100;
1096
+ const vmin = Math.max(v, .01);
1097
+ let sl;
1098
+ let l;
1099
+ l = (2 - s) * v;
1100
+ const lmin = (2 - s) * vmin;
1101
+ sl = s * vmin;
1102
+ sl /= lmin <= 1 ? lmin : 2 - lmin;
1103
+ sl = sl || 0;
1104
+ l /= 2;
1105
+ return [
1106
+ h,
1107
+ sl * 100,
1108
+ l * 100
1109
+ ];
1110
+ };
1111
+ convert.hwb.rgb = function(hwb) {
1112
+ const h = hwb[0] / 360;
1113
+ let wh = hwb[1] / 100;
1114
+ let bl = hwb[2] / 100;
1115
+ const ratio = wh + bl;
1116
+ let f;
1117
+ if (ratio > 1) {
1118
+ wh /= ratio;
1119
+ bl /= ratio;
1120
+ }
1121
+ const i = Math.floor(6 * h);
1122
+ const v = 1 - bl;
1123
+ f = 6 * h - i;
1124
+ if ((i & 1) !== 0) f = 1 - f;
1125
+ const n = wh + f * (v - wh);
1126
+ let r;
1127
+ let g;
1128
+ let b;
1129
+ switch (i) {
1130
+ default:
1131
+ case 6:
1132
+ case 0:
1133
+ r = v;
1134
+ g = n;
1135
+ b = wh;
1136
+ break;
1137
+ case 1:
1138
+ r = n;
1139
+ g = v;
1140
+ b = wh;
1141
+ break;
1142
+ case 2:
1143
+ r = wh;
1144
+ g = v;
1145
+ b = n;
1146
+ break;
1147
+ case 3:
1148
+ r = wh;
1149
+ g = n;
1150
+ b = v;
1151
+ break;
1152
+ case 4:
1153
+ r = n;
1154
+ g = wh;
1155
+ b = v;
1156
+ break;
1157
+ case 5:
1158
+ r = v;
1159
+ g = wh;
1160
+ b = n;
1161
+ break;
1162
+ }
1163
+ return [
1164
+ r * 255,
1165
+ g * 255,
1166
+ b * 255
1167
+ ];
1168
+ };
1169
+ convert.cmyk.rgb = function(cmyk) {
1170
+ const c = cmyk[0] / 100;
1171
+ const m = cmyk[1] / 100;
1172
+ const y = cmyk[2] / 100;
1173
+ const k = cmyk[3] / 100;
1174
+ const r = 1 - Math.min(1, c * (1 - k) + k);
1175
+ const g = 1 - Math.min(1, m * (1 - k) + k);
1176
+ const b = 1 - Math.min(1, y * (1 - k) + k);
1177
+ return [
1178
+ r * 255,
1179
+ g * 255,
1180
+ b * 255
1181
+ ];
1182
+ };
1183
+ convert.xyz.rgb = function(xyz) {
1184
+ const x = xyz[0] / 100;
1185
+ const y = xyz[1] / 100;
1186
+ const z = xyz[2] / 100;
1187
+ let r;
1188
+ let g;
1189
+ let b;
1190
+ r = x * 3.2406 + y * -1.5372 + z * -.4986;
1191
+ g = x * -.9689 + y * 1.8758 + z * .0415;
1192
+ b = x * .0557 + y * -.204 + z * 1.057;
1193
+ r = r > .0031308 ? 1.055 * r ** (1 / 2.4) - .055 : r * 12.92;
1194
+ g = g > .0031308 ? 1.055 * g ** (1 / 2.4) - .055 : g * 12.92;
1195
+ b = b > .0031308 ? 1.055 * b ** (1 / 2.4) - .055 : b * 12.92;
1196
+ r = Math.min(Math.max(0, r), 1);
1197
+ g = Math.min(Math.max(0, g), 1);
1198
+ b = Math.min(Math.max(0, b), 1);
1199
+ return [
1200
+ r * 255,
1201
+ g * 255,
1202
+ b * 255
1203
+ ];
1204
+ };
1205
+ convert.xyz.lab = function(xyz) {
1206
+ let x = xyz[0];
1207
+ let y = xyz[1];
1208
+ let z = xyz[2];
1209
+ x /= 95.047;
1210
+ y /= 100;
1211
+ z /= 108.883;
1212
+ x = x > .008856 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
1213
+ y = y > .008856 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
1214
+ z = z > .008856 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
1215
+ return [
1216
+ 116 * y - 16,
1217
+ 500 * (x - y),
1218
+ 200 * (y - z)
1219
+ ];
1220
+ };
1221
+ convert.lab.xyz = function(lab) {
1222
+ const l = lab[0];
1223
+ const a = lab[1];
1224
+ const b = lab[2];
1225
+ let x;
1226
+ let y;
1227
+ let z;
1228
+ y = (l + 16) / 116;
1229
+ x = a / 500 + y;
1230
+ z = y - b / 200;
1231
+ const y2 = y ** 3;
1232
+ const x2 = x ** 3;
1233
+ const z2 = z ** 3;
1234
+ y = y2 > .008856 ? y2 : (y - 16 / 116) / 7.787;
1235
+ x = x2 > .008856 ? x2 : (x - 16 / 116) / 7.787;
1236
+ z = z2 > .008856 ? z2 : (z - 16 / 116) / 7.787;
1237
+ x *= 95.047;
1238
+ y *= 100;
1239
+ z *= 108.883;
1240
+ return [
1241
+ x,
1242
+ y,
1243
+ z
1244
+ ];
1245
+ };
1246
+ convert.lab.lch = function(lab) {
1247
+ const l = lab[0];
1248
+ const a = lab[1];
1249
+ const b = lab[2];
1250
+ let h;
1251
+ h = Math.atan2(b, a) * 360 / 2 / Math.PI;
1252
+ if (h < 0) h += 360;
1253
+ return [
1254
+ l,
1255
+ Math.sqrt(a * a + b * b),
1256
+ h
1257
+ ];
1258
+ };
1259
+ convert.lch.lab = function(lch) {
1260
+ const l = lch[0];
1261
+ const c = lch[1];
1262
+ const hr = lch[2] / 360 * 2 * Math.PI;
1263
+ return [
1264
+ l,
1265
+ c * Math.cos(hr),
1266
+ c * Math.sin(hr)
1267
+ ];
1268
+ };
1269
+ convert.rgb.ansi16 = function(args, saturation = null) {
1270
+ const [r, g, b] = args;
1271
+ let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation;
1272
+ value = Math.round(value / 50);
1273
+ if (value === 0) return 30;
1274
+ let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
1275
+ if (value === 2) ansi += 60;
1276
+ return ansi;
1277
+ };
1278
+ convert.hsv.ansi16 = function(args) {
1279
+ return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
1280
+ };
1281
+ convert.rgb.ansi256 = function(args) {
1282
+ const r = args[0];
1283
+ const g = args[1];
1284
+ const b = args[2];
1285
+ if (r === g && g === b) {
1286
+ if (r < 8) return 16;
1287
+ if (r > 248) return 231;
1288
+ return Math.round((r - 8) / 247 * 24) + 232;
1289
+ }
1290
+ return 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
1291
+ };
1292
+ convert.ansi16.rgb = function(args) {
1293
+ let color = args % 10;
1294
+ if (color === 0 || color === 7) {
1295
+ if (args > 50) color += 3.5;
1296
+ color = color / 10.5 * 255;
1297
+ return [
1298
+ color,
1299
+ color,
1300
+ color
1301
+ ];
1302
+ }
1303
+ const mult = (~~(args > 50) + 1) * .5;
1304
+ return [
1305
+ (color & 1) * mult * 255,
1306
+ (color >> 1 & 1) * mult * 255,
1307
+ (color >> 2 & 1) * mult * 255
1308
+ ];
1309
+ };
1310
+ convert.ansi256.rgb = function(args) {
1311
+ if (args >= 232) {
1312
+ const c = (args - 232) * 10 + 8;
1313
+ return [
1314
+ c,
1315
+ c,
1316
+ c
1317
+ ];
1318
+ }
1319
+ args -= 16;
1320
+ let rem;
1321
+ return [
1322
+ Math.floor(args / 36) / 5 * 255,
1323
+ Math.floor((rem = args % 36) / 6) / 5 * 255,
1324
+ rem % 6 / 5 * 255
1325
+ ];
1326
+ };
1327
+ convert.rgb.hex = function(args) {
1328
+ const string = (((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255)).toString(16).toUpperCase();
1329
+ return "000000".substring(string.length) + string;
1330
+ };
1331
+ convert.hex.rgb = function(args) {
1332
+ const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
1333
+ if (!match) return [
1334
+ 0,
1335
+ 0,
1336
+ 0
1337
+ ];
1338
+ let colorString = match[0];
1339
+ if (match[0].length === 3) colorString = colorString.split("").map((char) => {
1340
+ return char + char;
1341
+ }).join("");
1342
+ const integer = parseInt(colorString, 16);
1343
+ return [
1344
+ integer >> 16 & 255,
1345
+ integer >> 8 & 255,
1346
+ integer & 255
1347
+ ];
1348
+ };
1349
+ convert.rgb.hcg = function(rgb) {
1350
+ const r = rgb[0] / 255;
1351
+ const g = rgb[1] / 255;
1352
+ const b = rgb[2] / 255;
1353
+ const max = Math.max(Math.max(r, g), b);
1354
+ const min = Math.min(Math.min(r, g), b);
1355
+ const chroma = max - min;
1356
+ let grayscale;
1357
+ let hue;
1358
+ if (chroma < 1) grayscale = min / (1 - chroma);
1359
+ else grayscale = 0;
1360
+ if (chroma <= 0) hue = 0;
1361
+ else if (max === r) hue = (g - b) / chroma % 6;
1362
+ else if (max === g) hue = 2 + (b - r) / chroma;
1363
+ else hue = 4 + (r - g) / chroma;
1364
+ hue /= 6;
1365
+ hue %= 1;
1366
+ return [
1367
+ hue * 360,
1368
+ chroma * 100,
1369
+ grayscale * 100
1370
+ ];
1371
+ };
1372
+ convert.hsl.hcg = function(hsl) {
1373
+ const s = hsl[1] / 100;
1374
+ const l = hsl[2] / 100;
1375
+ const c = l < .5 ? 2 * s * l : 2 * s * (1 - l);
1376
+ let f = 0;
1377
+ if (c < 1) f = (l - .5 * c) / (1 - c);
1378
+ return [
1379
+ hsl[0],
1380
+ c * 100,
1381
+ f * 100
1382
+ ];
1383
+ };
1384
+ convert.hsv.hcg = function(hsv) {
1385
+ const s = hsv[1] / 100;
1386
+ const v = hsv[2] / 100;
1387
+ const c = s * v;
1388
+ let f = 0;
1389
+ if (c < 1) f = (v - c) / (1 - c);
1390
+ return [
1391
+ hsv[0],
1392
+ c * 100,
1393
+ f * 100
1394
+ ];
1395
+ };
1396
+ convert.hcg.rgb = function(hcg) {
1397
+ const h = hcg[0] / 360;
1398
+ const c = hcg[1] / 100;
1399
+ const g = hcg[2] / 100;
1400
+ if (c === 0) return [
1401
+ g * 255,
1402
+ g * 255,
1403
+ g * 255
1404
+ ];
1405
+ const pure = [
1406
+ 0,
1407
+ 0,
1408
+ 0
1409
+ ];
1410
+ const hi = h % 1 * 6;
1411
+ const v = hi % 1;
1412
+ const w = 1 - v;
1413
+ let mg = 0;
1414
+ switch (Math.floor(hi)) {
1415
+ case 0:
1416
+ pure[0] = 1;
1417
+ pure[1] = v;
1418
+ pure[2] = 0;
1419
+ break;
1420
+ case 1:
1421
+ pure[0] = w;
1422
+ pure[1] = 1;
1423
+ pure[2] = 0;
1424
+ break;
1425
+ case 2:
1426
+ pure[0] = 0;
1427
+ pure[1] = 1;
1428
+ pure[2] = v;
1429
+ break;
1430
+ case 3:
1431
+ pure[0] = 0;
1432
+ pure[1] = w;
1433
+ pure[2] = 1;
1434
+ break;
1435
+ case 4:
1436
+ pure[0] = v;
1437
+ pure[1] = 0;
1438
+ pure[2] = 1;
1439
+ break;
1440
+ default:
1441
+ pure[0] = 1;
1442
+ pure[1] = 0;
1443
+ pure[2] = w;
1444
+ }
1445
+ mg = (1 - c) * g;
1446
+ return [
1447
+ (c * pure[0] + mg) * 255,
1448
+ (c * pure[1] + mg) * 255,
1449
+ (c * pure[2] + mg) * 255
1450
+ ];
1451
+ };
1452
+ convert.hcg.hsv = function(hcg) {
1453
+ const c = hcg[1] / 100;
1454
+ const v = c + hcg[2] / 100 * (1 - c);
1455
+ let f = 0;
1456
+ if (v > 0) f = c / v;
1457
+ return [
1458
+ hcg[0],
1459
+ f * 100,
1460
+ v * 100
1461
+ ];
1462
+ };
1463
+ convert.hcg.hsl = function(hcg) {
1464
+ const c = hcg[1] / 100;
1465
+ const l = hcg[2] / 100 * (1 - c) + .5 * c;
1466
+ let s = 0;
1467
+ if (l > 0 && l < .5) s = c / (2 * l);
1468
+ else if (l >= .5 && l < 1) s = c / (2 * (1 - l));
1469
+ return [
1470
+ hcg[0],
1471
+ s * 100,
1472
+ l * 100
1473
+ ];
1474
+ };
1475
+ convert.hcg.hwb = function(hcg) {
1476
+ const c = hcg[1] / 100;
1477
+ const v = c + hcg[2] / 100 * (1 - c);
1478
+ return [
1479
+ hcg[0],
1480
+ (v - c) * 100,
1481
+ (1 - v) * 100
1482
+ ];
1483
+ };
1484
+ convert.hwb.hcg = function(hwb) {
1485
+ const w = hwb[1] / 100;
1486
+ const v = 1 - hwb[2] / 100;
1487
+ const c = v - w;
1488
+ let g = 0;
1489
+ if (c < 1) g = (v - c) / (1 - c);
1490
+ return [
1491
+ hwb[0],
1492
+ c * 100,
1493
+ g * 100
1494
+ ];
1495
+ };
1496
+ convert.apple.rgb = function(apple) {
1497
+ return [
1498
+ apple[0] / 65535 * 255,
1499
+ apple[1] / 65535 * 255,
1500
+ apple[2] / 65535 * 255
1501
+ ];
1502
+ };
1503
+ convert.rgb.apple = function(rgb) {
1504
+ return [
1505
+ rgb[0] / 255 * 65535,
1506
+ rgb[1] / 255 * 65535,
1507
+ rgb[2] / 255 * 65535
1508
+ ];
1509
+ };
1510
+ convert.gray.rgb = function(args) {
1511
+ return [
1512
+ args[0] / 100 * 255,
1513
+ args[0] / 100 * 255,
1514
+ args[0] / 100 * 255
1515
+ ];
1516
+ };
1517
+ convert.gray.hsl = function(args) {
1518
+ return [
1519
+ 0,
1520
+ 0,
1521
+ args[0]
1522
+ ];
1523
+ };
1524
+ convert.gray.hsv = convert.gray.hsl;
1525
+ convert.gray.hwb = function(gray) {
1526
+ return [
1527
+ 0,
1528
+ 100,
1529
+ gray[0]
1530
+ ];
1531
+ };
1532
+ convert.gray.cmyk = function(gray) {
1533
+ return [
1534
+ 0,
1535
+ 0,
1536
+ 0,
1537
+ gray[0]
1538
+ ];
1539
+ };
1540
+ convert.gray.lab = function(gray) {
1541
+ return [
1542
+ gray[0],
1543
+ 0,
1544
+ 0
1545
+ ];
1546
+ };
1547
+ convert.gray.hex = function(gray) {
1548
+ const val = Math.round(gray[0] / 100 * 255) & 255;
1549
+ const string = ((val << 16) + (val << 8) + val).toString(16).toUpperCase();
1550
+ return "000000".substring(string.length) + string;
1551
+ };
1552
+ convert.rgb.gray = function(rgb) {
1553
+ return [(rgb[0] + rgb[1] + rgb[2]) / 3 / 255 * 100];
1554
+ };
1555
+ }));
1556
+ //#endregion
1557
+ //#region node_modules/color-convert/route.js
1558
+ var require_route = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1559
+ var conversions = require_conversions();
1560
+ function buildGraph() {
1561
+ const graph = {};
1562
+ const models = Object.keys(conversions);
1563
+ for (let len = models.length, i = 0; i < len; i++) graph[models[i]] = {
1564
+ distance: -1,
1565
+ parent: null
1566
+ };
1567
+ return graph;
1568
+ }
1569
+ function deriveBFS(fromModel) {
1570
+ const graph = buildGraph();
1571
+ const queue = [fromModel];
1572
+ graph[fromModel].distance = 0;
1573
+ while (queue.length) {
1574
+ const current = queue.pop();
1575
+ const adjacents = Object.keys(conversions[current]);
1576
+ for (let len = adjacents.length, i = 0; i < len; i++) {
1577
+ const adjacent = adjacents[i];
1578
+ const node = graph[adjacent];
1579
+ if (node.distance === -1) {
1580
+ node.distance = graph[current].distance + 1;
1581
+ node.parent = current;
1582
+ queue.unshift(adjacent);
1583
+ }
1584
+ }
1585
+ }
1586
+ return graph;
1587
+ }
1588
+ function link(from, to) {
1589
+ return function(args) {
1590
+ return to(from(args));
1591
+ };
1592
+ }
1593
+ function wrapConversion(toModel, graph) {
1594
+ const path = [graph[toModel].parent, toModel];
1595
+ let fn = conversions[graph[toModel].parent][toModel];
1596
+ let cur = graph[toModel].parent;
1597
+ while (graph[cur].parent) {
1598
+ path.unshift(graph[cur].parent);
1599
+ fn = link(conversions[graph[cur].parent][cur], fn);
1600
+ cur = graph[cur].parent;
1601
+ }
1602
+ fn.conversion = path;
1603
+ return fn;
1604
+ }
1605
+ module.exports = function(fromModel) {
1606
+ const graph = deriveBFS(fromModel);
1607
+ const conversion = {};
1608
+ const models = Object.keys(graph);
1609
+ for (let len = models.length, i = 0; i < len; i++) {
1610
+ const toModel = models[i];
1611
+ if (graph[toModel].parent === null) continue;
1612
+ conversion[toModel] = wrapConversion(toModel, graph);
1613
+ }
1614
+ return conversion;
1615
+ };
1616
+ }));
1617
+ //#endregion
1618
+ //#region node_modules/color-convert/index.js
1619
+ var require_color_convert = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1620
+ var conversions = require_conversions();
1621
+ var route = require_route();
1622
+ var convert = {};
1623
+ var models = Object.keys(conversions);
1624
+ function wrapRaw(fn) {
1625
+ const wrappedFn = function(...args) {
1626
+ const arg0 = args[0];
1627
+ if (arg0 === void 0 || arg0 === null) return arg0;
1628
+ if (arg0.length > 1) args = arg0;
1629
+ return fn(args);
1630
+ };
1631
+ if ("conversion" in fn) wrappedFn.conversion = fn.conversion;
1632
+ return wrappedFn;
1633
+ }
1634
+ function wrapRounded(fn) {
1635
+ const wrappedFn = function(...args) {
1636
+ const arg0 = args[0];
1637
+ if (arg0 === void 0 || arg0 === null) return arg0;
1638
+ if (arg0.length > 1) args = arg0;
1639
+ const result = fn(args);
1640
+ if (typeof result === "object") for (let len = result.length, i = 0; i < len; i++) result[i] = Math.round(result[i]);
1641
+ return result;
1642
+ };
1643
+ if ("conversion" in fn) wrappedFn.conversion = fn.conversion;
1644
+ return wrappedFn;
1645
+ }
1646
+ models.forEach((fromModel) => {
1647
+ convert[fromModel] = {};
1648
+ Object.defineProperty(convert[fromModel], "channels", { value: conversions[fromModel].channels });
1649
+ Object.defineProperty(convert[fromModel], "labels", { value: conversions[fromModel].labels });
1650
+ const routes = route(fromModel);
1651
+ Object.keys(routes).forEach((toModel) => {
1652
+ const fn = routes[toModel];
1653
+ convert[fromModel][toModel] = wrapRounded(fn);
1654
+ convert[fromModel][toModel].raw = wrapRaw(fn);
1655
+ });
1656
+ });
1657
+ module.exports = convert;
1658
+ }));
1659
+ //#endregion
1660
+ //#region node_modules/ansi-styles/index.js
1661
+ var require_ansi_styles = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1662
+ var wrapAnsi16 = (fn, offset) => (...args) => {
1663
+ return `\u001B[${fn(...args) + offset}m`;
1664
+ };
1665
+ var wrapAnsi256 = (fn, offset) => (...args) => {
1666
+ const code = fn(...args);
1667
+ return `\u001B[${38 + offset};5;${code}m`;
1668
+ };
1669
+ var wrapAnsi16m = (fn, offset) => (...args) => {
1670
+ const rgb = fn(...args);
1671
+ return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
1672
+ };
1673
+ var ansi2ansi = (n) => n;
1674
+ var rgb2rgb = (r, g, b) => [
1675
+ r,
1676
+ g,
1677
+ b
1678
+ ];
1679
+ var setLazyProperty = (object, property, get) => {
1680
+ Object.defineProperty(object, property, {
1681
+ get: () => {
1682
+ const value = get();
1683
+ Object.defineProperty(object, property, {
1684
+ value,
1685
+ enumerable: true,
1686
+ configurable: true
1687
+ });
1688
+ return value;
1689
+ },
1690
+ enumerable: true,
1691
+ configurable: true
1692
+ });
1693
+ };
1694
+ /** @type {typeof import('color-convert')} */
1695
+ var colorConvert;
1696
+ var makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
1697
+ if (colorConvert === void 0) colorConvert = require_color_convert();
1698
+ const offset = isBackground ? 10 : 0;
1699
+ const styles = {};
1700
+ for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
1701
+ const name = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
1702
+ if (sourceSpace === targetSpace) styles[name] = wrap(identity, offset);
1703
+ else if (typeof suite === "object") styles[name] = wrap(suite[targetSpace], offset);
1704
+ }
1705
+ return styles;
1706
+ };
1707
+ function assembleStyles() {
1708
+ const codes = /* @__PURE__ */ new Map();
1709
+ const styles = {
1710
+ modifier: {
1711
+ reset: [0, 0],
1712
+ bold: [1, 22],
1713
+ dim: [2, 22],
1714
+ italic: [3, 23],
1715
+ underline: [4, 24],
1716
+ inverse: [7, 27],
1717
+ hidden: [8, 28],
1718
+ strikethrough: [9, 29]
1719
+ },
1720
+ color: {
1721
+ black: [30, 39],
1722
+ red: [31, 39],
1723
+ green: [32, 39],
1724
+ yellow: [33, 39],
1725
+ blue: [34, 39],
1726
+ magenta: [35, 39],
1727
+ cyan: [36, 39],
1728
+ white: [37, 39],
1729
+ blackBright: [90, 39],
1730
+ redBright: [91, 39],
1731
+ greenBright: [92, 39],
1732
+ yellowBright: [93, 39],
1733
+ blueBright: [94, 39],
1734
+ magentaBright: [95, 39],
1735
+ cyanBright: [96, 39],
1736
+ whiteBright: [97, 39]
1737
+ },
1738
+ bgColor: {
1739
+ bgBlack: [40, 49],
1740
+ bgRed: [41, 49],
1741
+ bgGreen: [42, 49],
1742
+ bgYellow: [43, 49],
1743
+ bgBlue: [44, 49],
1744
+ bgMagenta: [45, 49],
1745
+ bgCyan: [46, 49],
1746
+ bgWhite: [47, 49],
1747
+ bgBlackBright: [100, 49],
1748
+ bgRedBright: [101, 49],
1749
+ bgGreenBright: [102, 49],
1750
+ bgYellowBright: [103, 49],
1751
+ bgBlueBright: [104, 49],
1752
+ bgMagentaBright: [105, 49],
1753
+ bgCyanBright: [106, 49],
1754
+ bgWhiteBright: [107, 49]
1755
+ }
1756
+ };
1757
+ styles.color.gray = styles.color.blackBright;
1758
+ styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
1759
+ styles.color.grey = styles.color.blackBright;
1760
+ styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
1761
+ for (const [groupName, group] of Object.entries(styles)) {
1762
+ for (const [styleName, style] of Object.entries(group)) {
1763
+ styles[styleName] = {
1764
+ open: `\u001B[${style[0]}m`,
1765
+ close: `\u001B[${style[1]}m`
1766
+ };
1767
+ group[styleName] = styles[styleName];
1768
+ codes.set(style[0], style[1]);
1769
+ }
1770
+ Object.defineProperty(styles, groupName, {
1771
+ value: group,
1772
+ enumerable: false
1773
+ });
1774
+ }
1775
+ Object.defineProperty(styles, "codes", {
1776
+ value: codes,
1777
+ enumerable: false
1778
+ });
1779
+ styles.color.close = "\x1B[39m";
1780
+ styles.bgColor.close = "\x1B[49m";
1781
+ setLazyProperty(styles.color, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, false));
1782
+ setLazyProperty(styles.color, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, false));
1783
+ setLazyProperty(styles.color, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, false));
1784
+ setLazyProperty(styles.bgColor, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, true));
1785
+ setLazyProperty(styles.bgColor, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, true));
1786
+ setLazyProperty(styles.bgColor, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, true));
1787
+ return styles;
1788
+ }
1789
+ Object.defineProperty(module, "exports", {
1790
+ enumerable: true,
1791
+ get: assembleStyles
1792
+ });
1793
+ }));
1794
+ //#endregion
1795
+ //#region node_modules/supports-color/browser.js
1796
+ var require_browser = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1797
+ module.exports = {
1798
+ stdout: false,
1799
+ stderr: false
1800
+ };
1801
+ }));
1802
+ //#endregion
1803
+ //#region node_modules/chalk/source/util.js
1804
+ var require_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1805
+ var stringReplaceAll = (string, substring, replacer) => {
1806
+ let index = string.indexOf(substring);
1807
+ if (index === -1) return string;
1808
+ const substringLength = substring.length;
1809
+ let endIndex = 0;
1810
+ let returnValue = "";
1811
+ do {
1812
+ returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
1813
+ endIndex = index + substringLength;
1814
+ index = string.indexOf(substring, endIndex);
1815
+ } while (index !== -1);
1816
+ returnValue += string.substr(endIndex);
1817
+ return returnValue;
1818
+ };
1819
+ var stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => {
1820
+ let endIndex = 0;
1821
+ let returnValue = "";
1822
+ do {
1823
+ const gotCR = string[index - 1] === "\r";
1824
+ returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
1825
+ endIndex = index + 1;
1826
+ index = string.indexOf("\n", endIndex);
1827
+ } while (index !== -1);
1828
+ returnValue += string.substr(endIndex);
1829
+ return returnValue;
1830
+ };
1831
+ module.exports = {
1832
+ stringReplaceAll,
1833
+ stringEncaseCRLFWithFirstIndex
1834
+ };
1835
+ }));
1836
+ //#endregion
1837
+ //#region node_modules/chalk/source/templates.js
1838
+ var require_templates = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1839
+ var 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;
1840
+ var STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
1841
+ var STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
1842
+ var ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
1843
+ var ESCAPES = new Map([
1844
+ ["n", "\n"],
1845
+ ["r", "\r"],
1846
+ ["t", " "],
1847
+ ["b", "\b"],
1848
+ ["f", "\f"],
1849
+ ["v", "\v"],
1850
+ ["0", "\0"],
1851
+ ["\\", "\\"],
1852
+ ["e", "\x1B"],
1853
+ ["a", "\x07"]
1854
+ ]);
1855
+ function unescape(c) {
1856
+ const u = c[0] === "u";
1857
+ const bracket = c[1] === "{";
1858
+ if (u && !bracket && c.length === 5 || c[0] === "x" && c.length === 3) return String.fromCharCode(parseInt(c.slice(1), 16));
1859
+ if (u && bracket) return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
1860
+ return ESCAPES.get(c) || c;
1861
+ }
1862
+ function parseArguments(name, arguments_) {
1863
+ const results = [];
1864
+ const chunks = arguments_.trim().split(/\s*,\s*/g);
1865
+ let matches;
1866
+ for (const chunk of chunks) {
1867
+ const number = Number(chunk);
1868
+ if (!Number.isNaN(number)) results.push(number);
1869
+ else if (matches = chunk.match(STRING_REGEX)) results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
1870
+ else throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
1871
+ }
1872
+ return results;
1873
+ }
1874
+ function parseStyle(style) {
1875
+ STYLE_REGEX.lastIndex = 0;
1876
+ const results = [];
1877
+ let matches;
1878
+ while ((matches = STYLE_REGEX.exec(style)) !== null) {
1879
+ const name = matches[1];
1880
+ if (matches[2]) {
1881
+ const args = parseArguments(name, matches[2]);
1882
+ results.push([name].concat(args));
1883
+ } else results.push([name]);
1884
+ }
1885
+ return results;
1886
+ }
1887
+ function buildStyle(chalk, styles) {
1888
+ const enabled = {};
1889
+ for (const layer of styles) for (const style of layer.styles) enabled[style[0]] = layer.inverse ? null : style.slice(1);
1890
+ let current = chalk;
1891
+ for (const [styleName, styles] of Object.entries(enabled)) {
1892
+ if (!Array.isArray(styles)) continue;
1893
+ if (!(styleName in current)) throw new Error(`Unknown Chalk style: ${styleName}`);
1894
+ current = styles.length > 0 ? current[styleName](...styles) : current[styleName];
1895
+ }
1896
+ return current;
1897
+ }
1898
+ module.exports = (chalk, temporary) => {
1899
+ const styles = [];
1900
+ const chunks = [];
1901
+ let chunk = [];
1902
+ temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
1903
+ if (escapeCharacter) chunk.push(unescape(escapeCharacter));
1904
+ else if (style) {
1905
+ const string = chunk.join("");
1906
+ chunk = [];
1907
+ chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string));
1908
+ styles.push({
1909
+ inverse,
1910
+ styles: parseStyle(style)
1911
+ });
1912
+ } else if (close) {
1913
+ if (styles.length === 0) throw new Error("Found extraneous } in Chalk template literal");
1914
+ chunks.push(buildStyle(chalk, styles)(chunk.join("")));
1915
+ chunk = [];
1916
+ styles.pop();
1917
+ } else chunk.push(character);
1918
+ });
1919
+ chunks.push(chunk.join(""));
1920
+ if (styles.length > 0) {
1921
+ const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? "" : "s"} (\`}\`)`;
1922
+ throw new Error(errMessage);
1923
+ }
1924
+ return chunks.join("");
1925
+ };
1926
+ }));
1927
+ //#endregion
1928
+ //#region src/commonTypes.ts
1929
+ var import_source = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
1930
+ var ansiStyles = require_ansi_styles();
1931
+ var { stdout: stdoutColor, stderr: stderrColor } = require_browser();
1932
+ var { stringReplaceAll, stringEncaseCRLFWithFirstIndex } = require_util();
1933
+ var { isArray } = Array;
1934
+ var levelMapping = [
1935
+ "ansi",
1936
+ "ansi",
1937
+ "ansi256",
1938
+ "ansi16m"
1939
+ ];
1940
+ var styles = Object.create(null);
1941
+ var applyOptions = (object, options = {}) => {
1942
+ if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) throw new Error("The `level` option should be an integer from 0 to 3");
1943
+ const colorLevel = stdoutColor ? stdoutColor.level : 0;
1944
+ object.level = options.level === void 0 ? colorLevel : options.level;
1945
+ };
1946
+ var ChalkClass = class {
1947
+ constructor(options) {
1948
+ return chalkFactory(options);
1949
+ }
1950
+ };
1951
+ var chalkFactory = (options) => {
1952
+ const chalk = {};
1953
+ applyOptions(chalk, options);
1954
+ chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_);
1955
+ Object.setPrototypeOf(chalk, Chalk.prototype);
1956
+ Object.setPrototypeOf(chalk.template, chalk);
1957
+ chalk.template.constructor = () => {
1958
+ throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
1959
+ };
1960
+ chalk.template.Instance = ChalkClass;
1961
+ return chalk.template;
1962
+ };
1963
+ function Chalk(options) {
1964
+ return chalkFactory(options);
1965
+ }
1966
+ for (const [styleName, style] of Object.entries(ansiStyles)) styles[styleName] = { get() {
1967
+ const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
1968
+ Object.defineProperty(this, styleName, { value: builder });
1969
+ return builder;
1970
+ } };
1971
+ styles.visible = { get() {
1972
+ const builder = createBuilder(this, this._styler, true);
1973
+ Object.defineProperty(this, "visible", { value: builder });
1974
+ return builder;
1975
+ } };
1976
+ var usedModels = [
1977
+ "rgb",
1978
+ "hex",
1979
+ "keyword",
1980
+ "hsl",
1981
+ "hsv",
1982
+ "hwb",
1983
+ "ansi",
1984
+ "ansi256"
1985
+ ];
1986
+ for (const model of usedModels) styles[model] = { get() {
1987
+ const { level } = this;
1988
+ return function(...arguments_) {
1989
+ const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
1990
+ return createBuilder(this, styler, this._isEmpty);
1991
+ };
1992
+ } };
1993
+ for (const model of usedModels) {
1994
+ const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
1995
+ styles[bgModel] = { get() {
1996
+ const { level } = this;
1997
+ return function(...arguments_) {
1998
+ const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
1999
+ return createBuilder(this, styler, this._isEmpty);
2000
+ };
2001
+ } };
2002
+ }
2003
+ var proto = Object.defineProperties(() => {}, {
2004
+ ...styles,
2005
+ level: {
2006
+ enumerable: true,
2007
+ get() {
2008
+ return this._generator.level;
2009
+ },
2010
+ set(level) {
2011
+ this._generator.level = level;
2012
+ }
2013
+ }
2014
+ });
2015
+ var createStyler = (open, close, parent) => {
2016
+ let openAll;
2017
+ let closeAll;
2018
+ if (parent === void 0) {
2019
+ openAll = open;
2020
+ closeAll = close;
2021
+ } else {
2022
+ openAll = parent.openAll + open;
2023
+ closeAll = close + parent.closeAll;
2024
+ }
2025
+ return {
2026
+ open,
2027
+ close,
2028
+ openAll,
2029
+ closeAll,
2030
+ parent
2031
+ };
2032
+ };
2033
+ var createBuilder = (self, _styler, _isEmpty) => {
2034
+ const builder = (...arguments_) => {
2035
+ if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) return applyStyle(builder, chalkTag(builder, ...arguments_));
2036
+ return applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
2037
+ };
2038
+ Object.setPrototypeOf(builder, proto);
2039
+ builder._generator = self;
2040
+ builder._styler = _styler;
2041
+ builder._isEmpty = _isEmpty;
2042
+ return builder;
2043
+ };
2044
+ var applyStyle = (self, string) => {
2045
+ if (self.level <= 0 || !string) return self._isEmpty ? "" : string;
2046
+ let styler = self._styler;
2047
+ if (styler === void 0) return string;
2048
+ const { openAll, closeAll } = styler;
2049
+ if (string.indexOf("\x1B") !== -1) while (styler !== void 0) {
2050
+ string = stringReplaceAll(string, styler.close, styler.open);
2051
+ styler = styler.parent;
2052
+ }
2053
+ const lfIndex = string.indexOf("\n");
2054
+ if (lfIndex !== -1) string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
2055
+ return openAll + string + closeAll;
2056
+ };
2057
+ var template;
2058
+ var chalkTag = (chalk, ...strings) => {
2059
+ const [firstString] = strings;
2060
+ if (!isArray(firstString) || !isArray(firstString.raw)) return strings.join(" ");
2061
+ const arguments_ = strings.slice(1);
2062
+ const parts = [firstString.raw[0]];
2063
+ for (let i = 1; i < firstString.length; i++) parts.push(String(arguments_[i - 1]).replace(/[{}\\]/g, "\\$&"), String(firstString.raw[i]));
2064
+ if (template === void 0) template = require_templates();
2065
+ return template(chalk, parts.join(""));
2066
+ };
2067
+ Object.defineProperties(Chalk.prototype, styles);
2068
+ var chalk = Chalk();
2069
+ chalk.supportsColor = stdoutColor;
2070
+ chalk.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
2071
+ chalk.stderr.supportsColor = stderrColor;
2072
+ module.exports = chalk;
2073
+ })))());
2074
+ var ModelDelimeter = /* @__PURE__ */ function(ModelDelimeter) {
2075
+ ModelDelimeter["ROOT"] = "_";
2076
+ ModelDelimeter["SEPERATOR"] = "|";
2077
+ ModelDelimeter["COMPONENT_SEPERATOR"] = "@";
2078
+ ModelDelimeter["NID_SEPERATOR"] = "^";
2079
+ return ModelDelimeter;
2080
+ }({});
2081
+ var CheckValidChar = (checkParams) => {
2082
+ const invalidChars = [
2083
+ ModelDelimeter.ROOT,
2084
+ ModelDelimeter.SEPERATOR,
2085
+ ModelDelimeter.COMPONENT_SEPERATOR,
2086
+ ModelDelimeter.NID_SEPERATOR
2087
+ ];
2088
+ checkParams.forEach((param) => {
2089
+ invalidChars.forEach((char) => {
2090
+ if (param[1].includes(char)) throw new Error(`Invalid character inside [${param[0]}:${param[1]}], no [${char}] allowed`);
2091
+ });
2092
+ });
1478
2093
  };
1479
- const defaultLogger = {
1480
- debug(message) {
1481
- console.log(chalk.grey(`debug: ${message}`));
1482
- },
1483
- error(message) {
1484
- console.log(chalk.red(`error: ${message}`));
1485
- },
1486
- http(message) {
1487
- console.log(chalk.cyan(`http: ${message}`));
1488
- },
1489
- info(message) {
1490
- console.log(chalk.white(`info: ${message}`));
1491
- },
1492
- silly(message) {
1493
- console.log(chalk.yellow(`silly: ${message}`));
1494
- },
1495
- verbose(message) {
1496
- console.log(chalk.green(`verbose: ${message}`));
1497
- },
1498
- warn(message) {
1499
- console.log(chalk.magenta(`warn: ${message}`));
1500
- }
2094
+ var defaultLogger = {
2095
+ debug(message) {
2096
+ console.log(import_source.default.grey(`debug: ${message}`));
2097
+ },
2098
+ error(message) {
2099
+ console.log(import_source.default.red(`error: ${message}`));
2100
+ },
2101
+ http(message) {
2102
+ console.log(import_source.default.cyan(`http: ${message}`));
2103
+ },
2104
+ info(message) {
2105
+ console.log(import_source.default.white(`info: ${message}`));
2106
+ },
2107
+ silly(message) {
2108
+ console.log(import_source.default.yellow(`silly: ${message}`));
2109
+ },
2110
+ verbose(message) {
2111
+ console.log(import_source.default.green(`verbose: ${message}`));
2112
+ },
2113
+ warn(message) {
2114
+ console.log(import_source.default.magenta(`warn: ${message}`));
2115
+ }
1501
2116
  };
1502
- const emptyLogger = {
1503
- debug(message) {
1504
- },
1505
- error(message) {
1506
- },
1507
- http(message) {
1508
- },
1509
- info(message) {
1510
- },
1511
- silly(message) {
1512
- },
1513
- verbose(message) {
1514
- },
1515
- warn(message) {
1516
- }
2117
+ var emptyLogger = {
2118
+ debug(message) {},
2119
+ error(message) {},
2120
+ http(message) {},
2121
+ info(message) {},
2122
+ silly(message) {},
2123
+ verbose(message) {},
2124
+ warn(message) {}
1517
2125
  };
1518
- var edbaction = /* @__PURE__ */ ((edbaction2) => {
1519
- edbaction2[edbaction2["created"] = 1] = "created";
1520
- edbaction2[edbaction2["updated"] = 2] = "updated";
1521
- edbaction2[edbaction2["deleted"] = 3] = "deleted";
1522
- return edbaction2;
1523
- })(edbaction || {});
2126
+ //#endregion
2127
+ //#region src/dataAccessTypes.ts
2128
+ var edbaction = /* @__PURE__ */ function(edbaction) {
2129
+ edbaction[edbaction["created"] = 1] = "created";
2130
+ edbaction[edbaction["updated"] = 2] = "updated";
2131
+ edbaction[edbaction["deleted"] = 3] = "deleted";
2132
+ return edbaction;
2133
+ }({});
2134
+ //#endregion
2135
+ //#region src/errorhandling.ts
1524
2136
  function GetErrorPayload(errorCode, details = null) {
1525
- return {
1526
- error: errorCode.code,
1527
- error_description: errorCode.description,
1528
- timestamp: Date.now(),
1529
- //trace_id: "255d1aef-8c98-452f-ac51-23d051240864", //@@
1530
- //correlation_id: "fb3d2015-bc17-4bb9-bb85-30c5cf1aaaa7", //@@
1531
- details
1532
- };
2137
+ return {
2138
+ error: errorCode.code,
2139
+ error_description: errorCode.description,
2140
+ timestamp: Date.now(),
2141
+ details
2142
+ };
1533
2143
  }
1534
- const ajv = new Ajv();
1535
- const _Validate = (validator, payload) => {
1536
- const valid = validator(payload);
1537
- if (!valid) {
1538
- return validator.errors;
1539
- } else {
1540
- return null;
1541
- }
2144
+ //#endregion
2145
+ //#region src/validate.ts
2146
+ var ajv = new Ajv();
2147
+ var _Validate = (validator, payload) => {
2148
+ if (!validator(payload)) return validator.errors;
2149
+ else return null;
1542
2150
  };
1543
2151
  function AddSchema(name, schema) {
1544
- ajv.addSchema(schema, name);
2152
+ ajv.addSchema(schema, name);
1545
2153
  }
1546
2154
  function Validate(name, payload) {
1547
- const validator = ajv.getSchema(name);
1548
- if (validator) {
1549
- return _Validate(validator, payload);
1550
- }
1551
- }
1552
- class STSOptionsBase {
1553
- #options;
1554
- constructor(options = null) {
1555
- this.#options = options;
1556
- if (options !== null) {
1557
- if (typeof options.validator === "undefined") ;
1558
- else {
1559
- Validate(options.validator, options);
1560
- }
1561
- }
1562
- }
1563
- get options() {
1564
- return this.#options;
1565
- }
2155
+ const validator = ajv.getSchema(name);
2156
+ if (validator) return _Validate(validator, payload);
1566
2157
  }
2158
+ //#endregion
2159
+ //#region src/stsoptionsbase.ts
2160
+ var STSOptionsBase = class {
2161
+ #options;
2162
+ constructor(options = null) {
2163
+ this.#options = options;
2164
+ if (options !== null) if (typeof options.validator === "undefined") {} else Validate(options.validator, options);
2165
+ }
2166
+ get options() {
2167
+ return this.#options;
2168
+ }
2169
+ };
2170
+ //#endregion
2171
+ //#region src/sleep.ts
1567
2172
  async function Sleep(milliseconds = 1e3) {
1568
- return new Promise((resolve) => setTimeout(resolve, milliseconds));
2173
+ return new Promise((resolve) => setTimeout(resolve, milliseconds));
1569
2174
  }
1570
2175
  async function JestSleep() {
1571
- return Sleep(100);
1572
- }
1573
- var OAuth2ParameterType = /* @__PURE__ */ ((OAuth2ParameterType2) => {
1574
- OAuth2ParameterType2["AUDIENCE"] = "AUDIENCE";
1575
- OAuth2ParameterType2["CLIENT_ID"] = "client_id";
1576
- OAuth2ParameterType2["CLIENT_SECRET"] = "client_secret";
1577
- OAuth2ParameterType2["RESPONSE_TYPE"] = "response_type";
1578
- OAuth2ParameterType2["SCOPE"] = "scope";
1579
- OAuth2ParameterType2["STATE"] = "state";
1580
- OAuth2ParameterType2["REDIRECT_URI"] = "redirect_uri";
1581
- OAuth2ParameterType2["ERROR"] = "error";
1582
- OAuth2ParameterType2["ERROR_DESCRIPTION"] = "error_description";
1583
- OAuth2ParameterType2["ERROR_CODES"] = "error_codes";
1584
- OAuth2ParameterType2["ERROR_URI"] = "error_uri";
1585
- OAuth2ParameterType2["GRANT_TYPE"] = "grant_type";
1586
- OAuth2ParameterType2["CODE"] = "code";
1587
- OAuth2ParameterType2["ACCESS_TOKEN"] = "access_token";
1588
- OAuth2ParameterType2["TOKEN_TYPE"] = "token_type";
1589
- OAuth2ParameterType2["EXPIRES_IN"] = "expires_in";
1590
- OAuth2ParameterType2["USERNAME"] = "username";
1591
- OAuth2ParameterType2["PASSWORD"] = "password";
1592
- OAuth2ParameterType2["REFRESH_TOKEN"] = "refresh_token";
1593
- OAuth2ParameterType2["RESPONSE_MODE"] = "response_mode";
1594
- OAuth2ParameterType2["TIMESTAMP"] = "timestamp";
1595
- OAuth2ParameterType2["TRACE_ID"] = "trace_id";
1596
- OAuth2ParameterType2["CORRELATION_ID"] = "correlation_id";
1597
- return OAuth2ParameterType2;
1598
- })(OAuth2ParameterType || {});
1599
- var OIDCStandardClaim = /* @__PURE__ */ ((OIDCStandardClaim2) => {
1600
- OIDCStandardClaim2["SUB"] = "sub";
1601
- OIDCStandardClaim2["NAME"] = "name";
1602
- OIDCStandardClaim2["GIVEN_NAME"] = "given_name";
1603
- OIDCStandardClaim2["FAMILY_NAME"] = "family_name";
1604
- OIDCStandardClaim2["MIDDLE_NAME"] = "middle_name";
1605
- OIDCStandardClaim2["NICKNAME"] = "nickname";
1606
- OIDCStandardClaim2["PREFERRED_USERNAME"] = "preferred_username";
1607
- OIDCStandardClaim2["PROFILE"] = "profile";
1608
- OIDCStandardClaim2["PICTURE"] = "picture";
1609
- OIDCStandardClaim2["WEBSITE"] = "website";
1610
- OIDCStandardClaim2["EMAIL"] = "email";
1611
- OIDCStandardClaim2["EMAIL_VERIFIED"] = "email_verified";
1612
- OIDCStandardClaim2["GENDER"] = "gender";
1613
- OIDCStandardClaim2["BIRTHDATE"] = "birthdate";
1614
- OIDCStandardClaim2["ZONEINFO"] = "zoneinfo";
1615
- OIDCStandardClaim2["LOCALE"] = "locale";
1616
- OIDCStandardClaim2["PHONE_NUMBER"] = "phone_number";
1617
- OIDCStandardClaim2["PHONE_NUMBER_VERIFIED"] = "phone_number_verified";
1618
- OIDCStandardClaim2["ADDRESS"] = "address";
1619
- OIDCStandardClaim2["CLIENT_SECRET"] = "client_secret";
1620
- OIDCStandardClaim2["NONCE"] = "nonce";
1621
- return OIDCStandardClaim2;
1622
- })(OIDCStandardClaim || {});
1623
- var OIDCAddressClaim = /* @__PURE__ */ ((OIDCAddressClaim2) => {
1624
- OIDCAddressClaim2["FORMATTED"] = "formatted";
1625
- OIDCAddressClaim2["STREET_ADDRESS"] = "street_address";
1626
- OIDCAddressClaim2["LOCALITY"] = "locality";
1627
- OIDCAddressClaim2["REGION"] = "region";
1628
- OIDCAddressClaim2["COUNTRY"] = "country";
1629
- return OIDCAddressClaim2;
1630
- })(OIDCAddressClaim || {});
1631
- class OAuth2ParameterErrorType {
1632
- static NOT_EQUAL = {
1633
- code: "STS_OAUTH2_ERR_0001",
1634
- description: "Parameter values not equal."
1635
- };
1636
- static NOT_PRESENT = {
1637
- code: "STS_OAUTH2_ERR_0002",
1638
- description: "Parameter not provided."
1639
- };
1640
- static INVALID_FORMAT = {
1641
- code: "STS_OAUTH2_ERR_0003",
1642
- description: "Parameter value format invalid."
1643
- };
1644
- static EXPIRED = {
1645
- code: "STS_OAUTH2_ERR_0004",
1646
- description: "Parameter value expired."
1647
- };
2176
+ return Sleep(100);
1648
2177
  }
2178
+ //#endregion
2179
+ //#region src/oauth2terms.ts
2180
+ var OAuth2ParameterType = /* @__PURE__ */ function(OAuth2ParameterType) {
2181
+ OAuth2ParameterType["AUDIENCE"] = "AUDIENCE";
2182
+ OAuth2ParameterType["CLIENT_ID"] = "client_id";
2183
+ OAuth2ParameterType["CLIENT_SECRET"] = "client_secret";
2184
+ OAuth2ParameterType["RESPONSE_TYPE"] = "response_type";
2185
+ OAuth2ParameterType["SCOPE"] = "scope";
2186
+ OAuth2ParameterType["STATE"] = "state";
2187
+ OAuth2ParameterType["REDIRECT_URI"] = "redirect_uri";
2188
+ OAuth2ParameterType["ERROR"] = "error";
2189
+ OAuth2ParameterType["ERROR_DESCRIPTION"] = "error_description";
2190
+ OAuth2ParameterType["ERROR_CODES"] = "error_codes";
2191
+ OAuth2ParameterType["ERROR_URI"] = "error_uri";
2192
+ OAuth2ParameterType["GRANT_TYPE"] = "grant_type";
2193
+ OAuth2ParameterType["CODE"] = "code";
2194
+ OAuth2ParameterType["ACCESS_TOKEN"] = "access_token";
2195
+ OAuth2ParameterType["TOKEN_TYPE"] = "token_type";
2196
+ OAuth2ParameterType["EXPIRES_IN"] = "expires_in";
2197
+ OAuth2ParameterType["USERNAME"] = "username";
2198
+ OAuth2ParameterType["PASSWORD"] = "password";
2199
+ OAuth2ParameterType["REFRESH_TOKEN"] = "refresh_token";
2200
+ OAuth2ParameterType["RESPONSE_MODE"] = "response_mode";
2201
+ OAuth2ParameterType["TIMESTAMP"] = "timestamp";
2202
+ OAuth2ParameterType["TRACE_ID"] = "trace_id";
2203
+ OAuth2ParameterType["CORRELATION_ID"] = "correlation_id";
2204
+ return OAuth2ParameterType;
2205
+ }({});
2206
+ var OIDCStandardClaim = /* @__PURE__ */ function(OIDCStandardClaim) {
2207
+ OIDCStandardClaim["SUB"] = "sub";
2208
+ OIDCStandardClaim["NAME"] = "name";
2209
+ OIDCStandardClaim["GIVEN_NAME"] = "given_name";
2210
+ OIDCStandardClaim["FAMILY_NAME"] = "family_name";
2211
+ OIDCStandardClaim["MIDDLE_NAME"] = "middle_name";
2212
+ OIDCStandardClaim["NICKNAME"] = "nickname";
2213
+ OIDCStandardClaim["PREFERRED_USERNAME"] = "preferred_username";
2214
+ OIDCStandardClaim["PROFILE"] = "profile";
2215
+ OIDCStandardClaim["PICTURE"] = "picture";
2216
+ OIDCStandardClaim["WEBSITE"] = "website";
2217
+ OIDCStandardClaim["EMAIL"] = "email";
2218
+ OIDCStandardClaim["EMAIL_VERIFIED"] = "email_verified";
2219
+ OIDCStandardClaim["GENDER"] = "gender";
2220
+ OIDCStandardClaim["BIRTHDATE"] = "birthdate";
2221
+ OIDCStandardClaim["ZONEINFO"] = "zoneinfo";
2222
+ OIDCStandardClaim["LOCALE"] = "locale";
2223
+ OIDCStandardClaim["PHONE_NUMBER"] = "phone_number";
2224
+ OIDCStandardClaim["PHONE_NUMBER_VERIFIED"] = "phone_number_verified";
2225
+ OIDCStandardClaim["ADDRESS"] = "address";
2226
+ OIDCStandardClaim["CLIENT_SECRET"] = "client_secret";
2227
+ OIDCStandardClaim["NONCE"] = "nonce";
2228
+ return OIDCStandardClaim;
2229
+ }({});
2230
+ var OIDCAddressClaim = /* @__PURE__ */ function(OIDCAddressClaim) {
2231
+ OIDCAddressClaim["FORMATTED"] = "formatted";
2232
+ OIDCAddressClaim["STREET_ADDRESS"] = "street_address";
2233
+ OIDCAddressClaim["LOCALITY"] = "locality";
2234
+ OIDCAddressClaim["REGION"] = "region";
2235
+ OIDCAddressClaim["COUNTRY"] = "country";
2236
+ return OIDCAddressClaim;
2237
+ }({});
2238
+ var OAuth2ParameterErrorType = class {
2239
+ static NOT_EQUAL = {
2240
+ code: "STS_OAUTH2_ERR_0001",
2241
+ description: "Parameter values not equal."
2242
+ };
2243
+ static NOT_PRESENT = {
2244
+ code: "STS_OAUTH2_ERR_0002",
2245
+ description: "Parameter not provided."
2246
+ };
2247
+ static INVALID_FORMAT = {
2248
+ code: "STS_OAUTH2_ERR_0003",
2249
+ description: "Parameter value format invalid."
2250
+ };
2251
+ static EXPIRED = {
2252
+ code: "STS_OAUTH2_ERR_0004",
2253
+ description: "Parameter value expired."
2254
+ };
2255
+ };
1649
2256
  function compareParameterTypes(source1, source2, authParameterTypes) {
1650
- const errors = [];
1651
- for (let i = 0; i < authParameterTypes.length; i++) {
1652
- const authParameterType = authParameterTypes[i];
1653
- if (source1[i].localeCompare(source2[i]) !== 0) {
1654
- const error = {
1655
- error: OAuth2ParameterErrorType.NOT_EQUAL.code,
1656
- error_description: OAuth2ParameterErrorType.NOT_EQUAL.description,
1657
- timestamp: Date.now(),
1658
- details: `${OAuth2ParameterErrorType.NOT_EQUAL.description}: Parameter: [${authParameterType}]`
1659
- };
1660
- errors.push(error);
1661
- }
1662
- }
1663
- return errors;
1664
- }
1665
- class STSAxiosConfig {
1666
- #url;
1667
- #method;
1668
- #headers;
1669
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1670
- #data;
1671
- #agentManager;
1672
- #timeout;
1673
- #withCredentials;
1674
- constructor(url, method, headers, timeout) {
1675
- this.#url = url;
1676
- this.#method = method;
1677
- if (headers !== void 0) {
1678
- this.#headers = headers;
1679
- }
1680
- if (timeout !== void 0) {
1681
- this.#timeout = timeout;
1682
- }
1683
- }
1684
- /**
1685
- *
1686
- * @param cookies this.#headers['Cookie'] = cookies.join('; ')
1687
- * @returns
1688
- */
1689
- withCookies(cookies) {
1690
- if (!this.#headers) {
1691
- this.#headers = {};
1692
- }
1693
- this.#headers["Cookie"] = cookies.join("; ");
1694
- return this;
1695
- }
1696
- /**
1697
- *
1698
- * @param data Add data to the body
1699
- * @returns
1700
- */
1701
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1702
- withData(data) {
1703
- this.#data = data;
1704
- return this;
1705
- }
1706
- // 'Content-Type': 'application/json'
1707
- /**
1708
- *
1709
- * @param accesssToken
1710
- * @param stsUserId
1711
- * @returns this.#headers['Authorization'] = 'Bearer ' + accesssToken; and this.#headers['x-sts_user_id'] = stsUserId;
1712
- */
1713
- withAuthHeaders(accesssToken, stsUserId) {
1714
- if (!this.#headers) {
1715
- this.#headers = {};
1716
- }
1717
- this.#headers["Authorization"] = "Bearer " + accesssToken;
1718
- if (stsUserId) {
1719
- this.#headers["x-sts_user_id"] = stsUserId;
1720
- }
1721
- return this;
1722
- }
1723
- /**
1724
- *
1725
- * @param headers Add headers to the existing header
1726
- * @returns
1727
- */
1728
- withHeaders(headers) {
1729
- this.#headers = {
1730
- ...this.#headers ?? {},
1731
- ...headers
1732
- };
1733
- return this;
1734
- }
1735
- /**
1736
- *
1737
- * @returns this.#headers['Content-Type'] = 'application/fhir+json';
1738
- */
1739
- withApplicationFhirAndJsonContentTypeHeaders() {
1740
- if (!this.#headers) {
1741
- this.#headers = {};
1742
- }
1743
- this.#headers["Content-Type"] = "application/fhir+json";
1744
- return this;
1745
- }
1746
- /**
1747
- *
1748
- * @returns this.#headers['Content-Type'] = 'application/merge-patch+json';
1749
- */
1750
- withApplicationMergePatchAndJsonContentTypeHeaders() {
1751
- if (!this.#headers) {
1752
- this.#headers = {};
1753
- }
1754
- this.#headers["Content-Type"] = "application/merge-patch+json";
1755
- return this;
1756
- }
1757
- /**
1758
- *
1759
- * @returns this.#headers['Content-Type'] = 'application/json-patch+json';
1760
- */
1761
- withApplicationJsonPatchAndJsonContentTypeHeaders() {
1762
- if (!this.#headers) {
1763
- this.#headers = {};
1764
- }
1765
- this.#headers["Content-Type"] = "application/json-patch+json";
1766
- return this;
1767
- }
1768
- /**
1769
- *
1770
- * @returns this.#headers['Content-Type'] = 'application/json';
1771
- */
1772
- withApplicationJsonContentTypeHeaders() {
1773
- if (!this.#headers) {
1774
- this.#headers = {};
1775
- }
1776
- this.#headers["Content-Type"] = "application/json";
1777
- return this;
1778
- }
1779
- /**
1780
- *
1781
- * @returns this.#headers['Content-Type'] = 'application/json';
1782
- */
1783
- withDefaultHeaders() {
1784
- if (!this.#headers) {
1785
- this.#headers = {};
1786
- }
1787
- this.#headers["Content-Type"] = "application/json";
1788
- return this;
1789
- }
1790
- /**
1791
- *
1792
- * @returns
1793
- */
1794
- withCredentials() {
1795
- this.#withCredentials = true;
1796
- return this;
1797
- }
1798
- /**
1799
- *
1800
- * @param timeout Add a connection timeout
1801
- * @returns
1802
- */
1803
- withTimeout(timeout) {
1804
- this.#timeout = timeout;
1805
- return this;
1806
- }
1807
- /**
1808
- *
1809
- * @param agentManager Add the agent manager for each rest call. Only for nodejs not browser.
1810
- * @returns
1811
- */
1812
- withAgentManager(agentManager) {
1813
- this.#agentManager = agentManager;
1814
- return this;
1815
- }
1816
- /**
1817
- * @returns Returns axios config object
1818
- */
1819
- get config() {
1820
- const retVal = {
1821
- url: this.#url,
1822
- method: this.#method
1823
- };
1824
- if (this.#headers) {
1825
- retVal.headers = this.#headers;
1826
- }
1827
- if (this.#agentManager !== void 0) {
1828
- if (this.#agentManager.IsHttps(this.#url)) {
1829
- retVal.httpsAgent = this.#agentManager.GetAgent(this.#url);
1830
- } else {
1831
- retVal.httpAgent = this.#agentManager.GetAgent(this.#url);
1832
- }
1833
- }
1834
- if (this.#data !== void 0) {
1835
- retVal.data = this.#data;
1836
- }
1837
- if (this.#timeout !== void 0) {
1838
- retVal.timeout = this.#timeout;
1839
- }
1840
- if (this.#withCredentials !== void 0 && this.#withCredentials === true) {
1841
- retVal.withCredentials = true;
1842
- }
1843
- return retVal;
1844
- }
2257
+ const errors = [];
2258
+ for (let i = 0; i < authParameterTypes.length; i++) {
2259
+ const authParameterType = authParameterTypes[i];
2260
+ if (source1[i].localeCompare(source2[i]) !== 0) {
2261
+ const error = {
2262
+ error: OAuth2ParameterErrorType.NOT_EQUAL.code,
2263
+ error_description: OAuth2ParameterErrorType.NOT_EQUAL.description,
2264
+ timestamp: Date.now(),
2265
+ details: `${OAuth2ParameterErrorType.NOT_EQUAL.description}: Parameter: [${authParameterType}]`
2266
+ };
2267
+ errors.push(error);
2268
+ }
2269
+ }
2270
+ return errors;
1845
2271
  }
2272
+ //#endregion
2273
+ //#region src/stsAxiosConfig.ts
2274
+ var STSAxiosConfig = class {
2275
+ #url;
2276
+ #method;
2277
+ #headers;
2278
+ #data;
2279
+ #agentManager;
2280
+ #timeout;
2281
+ #withCredentials;
2282
+ constructor(url, method, headers, timeout) {
2283
+ this.#url = url;
2284
+ this.#method = method;
2285
+ if (headers !== void 0) this.#headers = headers;
2286
+ if (timeout !== void 0) this.#timeout = timeout;
2287
+ }
2288
+ /**
2289
+ *
2290
+ * @param cookies this.#headers['Cookie'] = cookies.join('; ')
2291
+ * @returns
2292
+ */
2293
+ withCookies(cookies) {
2294
+ if (!this.#headers) this.#headers = {};
2295
+ this.#headers["Cookie"] = cookies.join("; ");
2296
+ return this;
2297
+ }
2298
+ /**
2299
+ *
2300
+ * @param data Add data to the body
2301
+ * @returns
2302
+ */
2303
+ withData(data) {
2304
+ this.#data = data;
2305
+ return this;
2306
+ }
2307
+ /**
2308
+ *
2309
+ * @param accesssToken
2310
+ * @param stsUserId
2311
+ * @returns this.#headers['Authorization'] = 'Bearer ' + accesssToken; and this.#headers['x-sts_user_id'] = stsUserId;
2312
+ */
2313
+ withAuthHeaders(accesssToken, stsUserId) {
2314
+ if (!this.#headers) this.#headers = {};
2315
+ this.#headers["Authorization"] = "Bearer " + accesssToken;
2316
+ if (stsUserId) this.#headers["x-sts_user_id"] = stsUserId;
2317
+ return this;
2318
+ }
2319
+ /**
2320
+ *
2321
+ * @param headers Add headers to the existing header
2322
+ * @returns
2323
+ */
2324
+ withHeaders(headers) {
2325
+ this.#headers = {
2326
+ ...this.#headers ?? {},
2327
+ ...headers
2328
+ };
2329
+ return this;
2330
+ }
2331
+ /**
2332
+ *
2333
+ * @returns this.#headers['Content-Type'] = 'application/fhir+json';
2334
+ */
2335
+ withApplicationFhirAndJsonContentTypeHeaders() {
2336
+ if (!this.#headers) this.#headers = {};
2337
+ this.#headers["Content-Type"] = "application/fhir+json";
2338
+ return this;
2339
+ }
2340
+ /**
2341
+ *
2342
+ * @returns this.#headers['Content-Type'] = 'application/merge-patch+json';
2343
+ */
2344
+ withApplicationMergePatchAndJsonContentTypeHeaders() {
2345
+ if (!this.#headers) this.#headers = {};
2346
+ this.#headers["Content-Type"] = "application/merge-patch+json";
2347
+ return this;
2348
+ }
2349
+ /**
2350
+ *
2351
+ * @returns this.#headers['Content-Type'] = 'application/json-patch+json';
2352
+ */
2353
+ withApplicationJsonPatchAndJsonContentTypeHeaders() {
2354
+ if (!this.#headers) this.#headers = {};
2355
+ this.#headers["Content-Type"] = "application/json-patch+json";
2356
+ return this;
2357
+ }
2358
+ /**
2359
+ *
2360
+ * @returns this.#headers['Content-Type'] = 'application/json';
2361
+ */
2362
+ withApplicationJsonContentTypeHeaders() {
2363
+ if (!this.#headers) this.#headers = {};
2364
+ this.#headers["Content-Type"] = "application/json";
2365
+ return this;
2366
+ }
2367
+ /**
2368
+ *
2369
+ * @returns this.#headers['Content-Type'] = 'application/json';
2370
+ */
2371
+ withDefaultHeaders() {
2372
+ if (!this.#headers) this.#headers = {};
2373
+ this.#headers["Content-Type"] = "application/json";
2374
+ return this;
2375
+ }
2376
+ /**
2377
+ *
2378
+ * @returns
2379
+ */
2380
+ withCredentials() {
2381
+ this.#withCredentials = true;
2382
+ return this;
2383
+ }
2384
+ /**
2385
+ *
2386
+ * @param timeout Add a connection timeout
2387
+ * @returns
2388
+ */
2389
+ withTimeout(timeout) {
2390
+ this.#timeout = timeout;
2391
+ return this;
2392
+ }
2393
+ /**
2394
+ *
2395
+ * @param agentManager Add the agent manager for each rest call. Only for nodejs not browser.
2396
+ * @returns
2397
+ */
2398
+ withAgentManager(agentManager) {
2399
+ this.#agentManager = agentManager;
2400
+ return this;
2401
+ }
2402
+ /**
2403
+ * @returns Returns axios config object
2404
+ */
2405
+ get config() {
2406
+ const retVal = {
2407
+ url: this.#url,
2408
+ method: this.#method
2409
+ };
2410
+ if (this.#headers) retVal.headers = this.#headers;
2411
+ if (this.#agentManager !== void 0) if (this.#agentManager.IsHttps(this.#url)) retVal.httpsAgent = this.#agentManager.GetAgent(this.#url);
2412
+ else retVal.httpAgent = this.#agentManager.GetAgent(this.#url);
2413
+ if (this.#data !== void 0) retVal.data = this.#data;
2414
+ if (this.#timeout !== void 0) retVal.timeout = this.#timeout;
2415
+ if (this.#withCredentials !== void 0 && this.#withCredentials === true) retVal.withCredentials = true;
2416
+ return retVal;
2417
+ }
2418
+ };
2419
+ //#endregion
2420
+ //#region src/agentManager.ts
1846
2421
  function createAgentManager(agentManagerOptions) {
1847
- return new AgentManager(agentManagerOptions);
1848
- }
1849
- class AgentManager {
1850
- #options;
1851
- #agentResetInterval = null;
1852
- #requestCount = 0;
1853
- #httpAgent = void 0;
1854
- #httpsAgent = void 0;
1855
- constructor(agentManagerOptions) {
1856
- this.#options = agentManagerOptions;
1857
- if (this.#options.agentResetInterval) {
1858
- this.#SetupResetInterval();
1859
- }
1860
- }
1861
- get agentResetInterval() {
1862
- return this.#options.agentResetInterval;
1863
- }
1864
- UpdateAgentResetInterval(val) {
1865
- if (this.#agentResetInterval) {
1866
- clearTimeout(this.#agentResetInterval);
1867
- }
1868
- this.#options.agentResetInterval = val;
1869
- this.#SetupResetInterval();
1870
- }
1871
- get agentResetCount() {
1872
- return this.#options.agentResetCount;
1873
- }
1874
- UpdateAgentResetCount(val) {
1875
- this.#options.agentResetCount = val;
1876
- }
1877
- #SetupResetInterval = () => {
1878
- if (this.#options.agentResetInterval && this.#options.agentResetInterval > 0) {
1879
- this.#agentResetInterval = setTimeout(() => {
1880
- this.ResetAgent();
1881
- this.#SetupResetInterval();
1882
- }, this.#options.agentResetInterval).unref();
1883
- }
1884
- };
1885
- IncRequestCount() {
1886
- this.#requestCount++;
1887
- if (this.#options.agentResetCount) {
1888
- if (this.#requestCount % this.#options.agentResetCount === 0) {
1889
- this.ResetAgent();
1890
- }
1891
- }
1892
- }
1893
- IsHttps(protocol) {
1894
- if (protocol.toLowerCase().startsWith("https:")) {
1895
- return true;
1896
- }
1897
- return false;
1898
- }
1899
- #GetAgentOptions = (https) => {
1900
- let options;
1901
- if (this.#options.agentOptions) {
1902
- options = {
1903
- keepAlive: this.#options.agentOptions.keepAlive,
1904
- maxSockets: this.#options.agentOptions.maxSockets,
1905
- maxTotalSockets: this.#options.agentOptions.maxTotalSockets,
1906
- maxFreeSockets: this.#options.agentOptions.maxFreeSockets,
1907
- timeout: this.#options.agentOptions.timeout
1908
- };
1909
- if (https === true) {
1910
- options.rejectUnauthorized = this.#options.agentOptions.rejectUnauthorized;
1911
- }
1912
- } else {
1913
- options = {
1914
- keepAlive: true,
1915
- maxSockets: 10,
1916
- maxTotalSockets: 20,
1917
- maxFreeSockets: 256,
1918
- timeout: 3e4,
1919
- rejectUnauthorized: false
1920
- };
1921
- }
1922
- return options;
1923
- };
1924
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1925
- GetAgent(protocol) {
1926
- if (protocol.toLowerCase().startsWith("https:")) {
1927
- if (!this.#httpsAgent) {
1928
- this.#httpsAgent = this.#options.httpsAgentFactory(this.#GetAgentOptions(true));
1929
- }
1930
- return this.#httpsAgent;
1931
- } else if (protocol.toLowerCase().startsWith("http:")) {
1932
- if (!this.#httpAgent) {
1933
- this.#httpAgent = this.#options.httpAgentFactory(this.#GetAgentOptions(false));
1934
- }
1935
- return this.#httpAgent;
1936
- } else {
1937
- return null;
1938
- }
1939
- }
1940
- ResetAgent() {
1941
- this.#httpAgent = null;
1942
- this.#httpsAgent = null;
1943
- }
1944
- Terminate() {
1945
- if (this.#agentResetInterval) {
1946
- clearTimeout(this.#agentResetInterval);
1947
- this.#agentResetInterval = null;
1948
- }
1949
- if (this.#httpAgent) {
1950
- this.#httpAgent.destroy();
1951
- this.#httpAgent = null;
1952
- }
1953
- if (this.#httpsAgent) {
1954
- this.#httpsAgent.destroy();
1955
- this.#httpsAgent = null;
1956
- }
1957
- }
2422
+ return new AgentManager(agentManagerOptions);
1958
2423
  }
1959
- export {
1960
- AddSchema,
1961
- CheckValidChar,
1962
- GetErrorPayload,
1963
- JestSleep,
1964
- ModelDelimeter,
1965
- OAuth2ParameterErrorType,
1966
- OAuth2ParameterType,
1967
- OIDCAddressClaim,
1968
- OIDCStandardClaim,
1969
- STSAxiosConfig,
1970
- STSOptionsBase,
1971
- Sleep,
1972
- Validate,
1973
- compareParameterTypes,
1974
- createAgentManager,
1975
- defaultLogger,
1976
- edbaction,
1977
- emptyLogger
2424
+ var AgentManager = class {
2425
+ #options;
2426
+ #agentResetInterval = null;
2427
+ #requestCount = 0;
2428
+ #httpAgent = void 0;
2429
+ #httpsAgent = void 0;
2430
+ constructor(agentManagerOptions) {
2431
+ this.#options = agentManagerOptions;
2432
+ if (this.#options.agentResetInterval) this.#SetupResetInterval();
2433
+ }
2434
+ get agentResetInterval() {
2435
+ return this.#options.agentResetInterval;
2436
+ }
2437
+ UpdateAgentResetInterval(val) {
2438
+ if (this.#agentResetInterval) clearTimeout(this.#agentResetInterval);
2439
+ this.#options.agentResetInterval = val;
2440
+ this.#SetupResetInterval();
2441
+ }
2442
+ get agentResetCount() {
2443
+ return this.#options.agentResetCount;
2444
+ }
2445
+ UpdateAgentResetCount(val) {
2446
+ this.#options.agentResetCount = val;
2447
+ }
2448
+ #SetupResetInterval = () => {
2449
+ if (this.#options.agentResetInterval && this.#options.agentResetInterval > 0) this.#agentResetInterval = setTimeout(() => {
2450
+ this.ResetAgent();
2451
+ this.#SetupResetInterval();
2452
+ }, this.#options.agentResetInterval).unref();
2453
+ };
2454
+ IncRequestCount() {
2455
+ this.#requestCount++;
2456
+ if (this.#options.agentResetCount) {
2457
+ if (this.#requestCount % this.#options.agentResetCount === 0) this.ResetAgent();
2458
+ }
2459
+ }
2460
+ IsHttps(protocol) {
2461
+ if (protocol.toLowerCase().startsWith("https:")) return true;
2462
+ return false;
2463
+ }
2464
+ #GetAgentOptions = (https) => {
2465
+ let options;
2466
+ if (this.#options.agentOptions) {
2467
+ options = {
2468
+ keepAlive: this.#options.agentOptions.keepAlive,
2469
+ maxSockets: this.#options.agentOptions.maxSockets,
2470
+ maxTotalSockets: this.#options.agentOptions.maxTotalSockets,
2471
+ maxFreeSockets: this.#options.agentOptions.maxFreeSockets,
2472
+ timeout: this.#options.agentOptions.timeout
2473
+ };
2474
+ if (https === true) options.rejectUnauthorized = this.#options.agentOptions.rejectUnauthorized;
2475
+ } else options = {
2476
+ keepAlive: true,
2477
+ maxSockets: 10,
2478
+ maxTotalSockets: 20,
2479
+ maxFreeSockets: 256,
2480
+ timeout: 3e4,
2481
+ rejectUnauthorized: false
2482
+ };
2483
+ return options;
2484
+ };
2485
+ GetAgent(protocol) {
2486
+ if (protocol.toLowerCase().startsWith("https:")) {
2487
+ if (!this.#httpsAgent) this.#httpsAgent = this.#options.httpsAgentFactory(this.#GetAgentOptions(true));
2488
+ return this.#httpsAgent;
2489
+ } else if (protocol.toLowerCase().startsWith("http:")) {
2490
+ if (!this.#httpAgent) this.#httpAgent = this.#options.httpAgentFactory(this.#GetAgentOptions(false));
2491
+ return this.#httpAgent;
2492
+ } else return null;
2493
+ }
2494
+ ResetAgent() {
2495
+ this.#httpAgent = null;
2496
+ this.#httpsAgent = null;
2497
+ }
2498
+ Terminate() {
2499
+ if (this.#agentResetInterval) {
2500
+ clearTimeout(this.#agentResetInterval);
2501
+ this.#agentResetInterval = null;
2502
+ }
2503
+ if (this.#httpAgent) {
2504
+ this.#httpAgent.destroy();
2505
+ this.#httpAgent = null;
2506
+ }
2507
+ if (this.#httpsAgent) {
2508
+ this.#httpsAgent.destroy();
2509
+ this.#httpsAgent = null;
2510
+ }
2511
+ }
1978
2512
  };
1979
- //# sourceMappingURL=index.mjs.map
2513
+ //#endregion
2514
+ export { AddSchema, CheckValidChar, GetErrorPayload, JestSleep, ModelDelimeter, OAuth2ParameterErrorType, OAuth2ParameterType, OIDCAddressClaim, OIDCStandardClaim, STSAxiosConfig, STSOptionsBase, Sleep, Validate, compareParameterTypes, createAgentManager, defaultLogger, edbaction, emptyLogger };
2515
+
2516
+ //# sourceMappingURL=index.mjs.map