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