@nsshunt/stsutils 1.19.90 → 1.19.92

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