nekos 1.2.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs DELETED
@@ -1,1992 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __commonJS = (cb, mod) => function __require() {
8
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
- };
10
- var __export = (target, all) => {
11
- for (var name in all)
12
- __defProp(target, name, { get: all[name], enumerable: true });
13
- };
14
- var __copyProps = (to, from, except, desc) => {
15
- if (from && typeof from === "object" || typeof from === "function") {
16
- for (let key of __getOwnPropNames(from))
17
- if (!__hasOwnProp.call(to, key) && key !== except)
18
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
- // If the importer is in node compatibility mode or this is not an ESM
24
- // file that has been converted to a CommonJS file using a Babel-
25
- // compatible transform (i.e. "__esModule" has not been set), then set
26
- // "default" to the CommonJS "module.exports" for node compatibility.
27
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
- mod
29
- ));
30
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
-
32
- // node_modules/tinycolor2/cjs/tinycolor.js
33
- var require_tinycolor = __commonJS({
34
- "node_modules/tinycolor2/cjs/tinycolor.js"(exports2, module2) {
35
- (function(global, factory) {
36
- typeof exports2 === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, global.tinycolor = factory());
37
- })(exports2, (function() {
38
- "use strict";
39
- function _typeof(obj) {
40
- "@babel/helpers - typeof";
41
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
42
- return typeof obj2;
43
- } : function(obj2) {
44
- return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
45
- }, _typeof(obj);
46
- }
47
- var trimLeft = /^\s+/;
48
- var trimRight = /\s+$/;
49
- function tinycolor(color, opts) {
50
- color = color ? color : "";
51
- opts = opts || {};
52
- if (color instanceof tinycolor) {
53
- return color;
54
- }
55
- if (!(this instanceof tinycolor)) {
56
- return new tinycolor(color, opts);
57
- }
58
- var rgb = inputToRGB(color);
59
- this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts.format || rgb.format;
60
- this._gradientType = opts.gradientType;
61
- if (this._r < 1) this._r = Math.round(this._r);
62
- if (this._g < 1) this._g = Math.round(this._g);
63
- if (this._b < 1) this._b = Math.round(this._b);
64
- this._ok = rgb.ok;
65
- }
66
- tinycolor.prototype = {
67
- isDark: function isDark() {
68
- return this.getBrightness() < 128;
69
- },
70
- isLight: function isLight() {
71
- return !this.isDark();
72
- },
73
- isValid: function isValid() {
74
- return this._ok;
75
- },
76
- getOriginalInput: function getOriginalInput() {
77
- return this._originalInput;
78
- },
79
- getFormat: function getFormat() {
80
- return this._format;
81
- },
82
- getAlpha: function getAlpha() {
83
- return this._a;
84
- },
85
- getBrightness: function getBrightness() {
86
- var rgb = this.toRgb();
87
- return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
88
- },
89
- getLuminance: function getLuminance() {
90
- var rgb = this.toRgb();
91
- var RsRGB, GsRGB, BsRGB, R, G, B;
92
- RsRGB = rgb.r / 255;
93
- GsRGB = rgb.g / 255;
94
- BsRGB = rgb.b / 255;
95
- if (RsRGB <= 0.03928) R = RsRGB / 12.92;
96
- else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
97
- if (GsRGB <= 0.03928) G = GsRGB / 12.92;
98
- else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
99
- if (BsRGB <= 0.03928) B = BsRGB / 12.92;
100
- else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
101
- return 0.2126 * R + 0.7152 * G + 0.0722 * B;
102
- },
103
- setAlpha: function setAlpha(value) {
104
- this._a = boundAlpha(value);
105
- this._roundA = Math.round(100 * this._a) / 100;
106
- return this;
107
- },
108
- toHsv: function toHsv() {
109
- var hsv = rgbToHsv(this._r, this._g, this._b);
110
- return {
111
- h: hsv.h * 360,
112
- s: hsv.s,
113
- v: hsv.v,
114
- a: this._a
115
- };
116
- },
117
- toHsvString: function toHsvString() {
118
- var hsv = rgbToHsv(this._r, this._g, this._b);
119
- var h = Math.round(hsv.h * 360), s = Math.round(hsv.s * 100), v = Math.round(hsv.v * 100);
120
- return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
121
- },
122
- toHsl: function toHsl() {
123
- var hsl = rgbToHsl(this._r, this._g, this._b);
124
- return {
125
- h: hsl.h * 360,
126
- s: hsl.s,
127
- l: hsl.l,
128
- a: this._a
129
- };
130
- },
131
- toHslString: function toHslString() {
132
- var hsl = rgbToHsl(this._r, this._g, this._b);
133
- var h = Math.round(hsl.h * 360), s = Math.round(hsl.s * 100), l = Math.round(hsl.l * 100);
134
- return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
135
- },
136
- toHex: function toHex(allow3Char) {
137
- return rgbToHex(this._r, this._g, this._b, allow3Char);
138
- },
139
- toHexString: function toHexString(allow3Char) {
140
- return "#" + this.toHex(allow3Char);
141
- },
142
- toHex8: function toHex8(allow4Char) {
143
- return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
144
- },
145
- toHex8String: function toHex8String(allow4Char) {
146
- return "#" + this.toHex8(allow4Char);
147
- },
148
- toRgb: function toRgb() {
149
- return {
150
- r: Math.round(this._r),
151
- g: Math.round(this._g),
152
- b: Math.round(this._b),
153
- a: this._a
154
- };
155
- },
156
- toRgbString: function toRgbString() {
157
- return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")";
158
- },
159
- toPercentageRgb: function toPercentageRgb() {
160
- return {
161
- r: Math.round(bound01(this._r, 255) * 100) + "%",
162
- g: Math.round(bound01(this._g, 255) * 100) + "%",
163
- b: Math.round(bound01(this._b, 255) * 100) + "%",
164
- a: this._a
165
- };
166
- },
167
- toPercentageRgbString: function toPercentageRgbString() {
168
- return this._a == 1 ? "rgb(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
169
- },
170
- toName: function toName() {
171
- if (this._a === 0) {
172
- return "transparent";
173
- }
174
- if (this._a < 1) {
175
- return false;
176
- }
177
- return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
178
- },
179
- toFilter: function toFilter(secondColor) {
180
- var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a);
181
- var secondHex8String = hex8String;
182
- var gradientType = this._gradientType ? "GradientType = 1, " : "";
183
- if (secondColor) {
184
- var s = tinycolor(secondColor);
185
- secondHex8String = "#" + rgbaToArgbHex(s._r, s._g, s._b, s._a);
186
- }
187
- return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")";
188
- },
189
- toString: function toString(format) {
190
- var formatSet = !!format;
191
- format = format || this._format;
192
- var formattedString = false;
193
- var hasAlpha = this._a < 1 && this._a >= 0;
194
- var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
195
- if (needsAlphaFormat) {
196
- if (format === "name" && this._a === 0) {
197
- return this.toName();
198
- }
199
- return this.toRgbString();
200
- }
201
- if (format === "rgb") {
202
- formattedString = this.toRgbString();
203
- }
204
- if (format === "prgb") {
205
- formattedString = this.toPercentageRgbString();
206
- }
207
- if (format === "hex" || format === "hex6") {
208
- formattedString = this.toHexString();
209
- }
210
- if (format === "hex3") {
211
- formattedString = this.toHexString(true);
212
- }
213
- if (format === "hex4") {
214
- formattedString = this.toHex8String(true);
215
- }
216
- if (format === "hex8") {
217
- formattedString = this.toHex8String();
218
- }
219
- if (format === "name") {
220
- formattedString = this.toName();
221
- }
222
- if (format === "hsl") {
223
- formattedString = this.toHslString();
224
- }
225
- if (format === "hsv") {
226
- formattedString = this.toHsvString();
227
- }
228
- return formattedString || this.toHexString();
229
- },
230
- clone: function clone() {
231
- return tinycolor(this.toString());
232
- },
233
- _applyModification: function _applyModification(fn, args) {
234
- var color = fn.apply(null, [this].concat([].slice.call(args)));
235
- this._r = color._r;
236
- this._g = color._g;
237
- this._b = color._b;
238
- this.setAlpha(color._a);
239
- return this;
240
- },
241
- lighten: function lighten() {
242
- return this._applyModification(_lighten, arguments);
243
- },
244
- brighten: function brighten() {
245
- return this._applyModification(_brighten, arguments);
246
- },
247
- darken: function darken() {
248
- return this._applyModification(_darken, arguments);
249
- },
250
- desaturate: function desaturate() {
251
- return this._applyModification(_desaturate, arguments);
252
- },
253
- saturate: function saturate() {
254
- return this._applyModification(_saturate, arguments);
255
- },
256
- greyscale: function greyscale() {
257
- return this._applyModification(_greyscale, arguments);
258
- },
259
- spin: function spin() {
260
- return this._applyModification(_spin, arguments);
261
- },
262
- _applyCombination: function _applyCombination(fn, args) {
263
- return fn.apply(null, [this].concat([].slice.call(args)));
264
- },
265
- analogous: function analogous() {
266
- return this._applyCombination(_analogous, arguments);
267
- },
268
- complement: function complement() {
269
- return this._applyCombination(_complement, arguments);
270
- },
271
- monochromatic: function monochromatic() {
272
- return this._applyCombination(_monochromatic, arguments);
273
- },
274
- splitcomplement: function splitcomplement() {
275
- return this._applyCombination(_splitcomplement, arguments);
276
- },
277
- // Disabled until https://github.com/bgrins/TinyColor/issues/254
278
- // polyad: function (number) {
279
- // return this._applyCombination(polyad, [number]);
280
- // },
281
- triad: function triad() {
282
- return this._applyCombination(polyad, [3]);
283
- },
284
- tetrad: function tetrad() {
285
- return this._applyCombination(polyad, [4]);
286
- }
287
- };
288
- tinycolor.fromRatio = function(color, opts) {
289
- if (_typeof(color) == "object") {
290
- var newColor = {};
291
- for (var i in color) {
292
- if (color.hasOwnProperty(i)) {
293
- if (i === "a") {
294
- newColor[i] = color[i];
295
- } else {
296
- newColor[i] = convertToPercentage(color[i]);
297
- }
298
- }
299
- }
300
- color = newColor;
301
- }
302
- return tinycolor(color, opts);
303
- };
304
- function inputToRGB(color) {
305
- var rgb = {
306
- r: 0,
307
- g: 0,
308
- b: 0
309
- };
310
- var a = 1;
311
- var s = null;
312
- var v = null;
313
- var l = null;
314
- var ok = false;
315
- var format = false;
316
- if (typeof color == "string") {
317
- color = stringInputToObject(color);
318
- }
319
- if (_typeof(color) == "object") {
320
- if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
321
- rgb = rgbToRgb(color.r, color.g, color.b);
322
- ok = true;
323
- format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
324
- } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
325
- s = convertToPercentage(color.s);
326
- v = convertToPercentage(color.v);
327
- rgb = hsvToRgb(color.h, s, v);
328
- ok = true;
329
- format = "hsv";
330
- } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
331
- s = convertToPercentage(color.s);
332
- l = convertToPercentage(color.l);
333
- rgb = hslToRgb(color.h, s, l);
334
- ok = true;
335
- format = "hsl";
336
- }
337
- if (color.hasOwnProperty("a")) {
338
- a = color.a;
339
- }
340
- }
341
- a = boundAlpha(a);
342
- return {
343
- ok,
344
- format: color.format || format,
345
- r: Math.min(255, Math.max(rgb.r, 0)),
346
- g: Math.min(255, Math.max(rgb.g, 0)),
347
- b: Math.min(255, Math.max(rgb.b, 0)),
348
- a
349
- };
350
- }
351
- function rgbToRgb(r, g, b) {
352
- return {
353
- r: bound01(r, 255) * 255,
354
- g: bound01(g, 255) * 255,
355
- b: bound01(b, 255) * 255
356
- };
357
- }
358
- function rgbToHsl(r, g, b) {
359
- r = bound01(r, 255);
360
- g = bound01(g, 255);
361
- b = bound01(b, 255);
362
- var max = Math.max(r, g, b), min = Math.min(r, g, b);
363
- var h, s, l = (max + min) / 2;
364
- if (max == min) {
365
- h = s = 0;
366
- } else {
367
- var d = max - min;
368
- s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
369
- switch (max) {
370
- case r:
371
- h = (g - b) / d + (g < b ? 6 : 0);
372
- break;
373
- case g:
374
- h = (b - r) / d + 2;
375
- break;
376
- case b:
377
- h = (r - g) / d + 4;
378
- break;
379
- }
380
- h /= 6;
381
- }
382
- return {
383
- h,
384
- s,
385
- l
386
- };
387
- }
388
- function hslToRgb(h, s, l) {
389
- var r, g, b;
390
- h = bound01(h, 360);
391
- s = bound01(s, 100);
392
- l = bound01(l, 100);
393
- function hue2rgb(p2, q2, t) {
394
- if (t < 0) t += 1;
395
- if (t > 1) t -= 1;
396
- if (t < 1 / 6) return p2 + (q2 - p2) * 6 * t;
397
- if (t < 1 / 2) return q2;
398
- if (t < 2 / 3) return p2 + (q2 - p2) * (2 / 3 - t) * 6;
399
- return p2;
400
- }
401
- if (s === 0) {
402
- r = g = b = l;
403
- } else {
404
- var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
405
- var p = 2 * l - q;
406
- r = hue2rgb(p, q, h + 1 / 3);
407
- g = hue2rgb(p, q, h);
408
- b = hue2rgb(p, q, h - 1 / 3);
409
- }
410
- return {
411
- r: r * 255,
412
- g: g * 255,
413
- b: b * 255
414
- };
415
- }
416
- function rgbToHsv(r, g, b) {
417
- r = bound01(r, 255);
418
- g = bound01(g, 255);
419
- b = bound01(b, 255);
420
- var max = Math.max(r, g, b), min = Math.min(r, g, b);
421
- var h, s, v = max;
422
- var d = max - min;
423
- s = max === 0 ? 0 : d / max;
424
- if (max == min) {
425
- h = 0;
426
- } else {
427
- switch (max) {
428
- case r:
429
- h = (g - b) / d + (g < b ? 6 : 0);
430
- break;
431
- case g:
432
- h = (b - r) / d + 2;
433
- break;
434
- case b:
435
- h = (r - g) / d + 4;
436
- break;
437
- }
438
- h /= 6;
439
- }
440
- return {
441
- h,
442
- s,
443
- v
444
- };
445
- }
446
- function hsvToRgb(h, s, v) {
447
- h = bound01(h, 360) * 6;
448
- s = bound01(s, 100);
449
- v = bound01(v, 100);
450
- var i = Math.floor(h), f = h - i, p = v * (1 - s), q = v * (1 - f * s), t = v * (1 - (1 - f) * s), mod = i % 6, r = [v, q, p, p, t, v][mod], g = [t, v, v, q, p, p][mod], b = [p, p, t, v, v, q][mod];
451
- return {
452
- r: r * 255,
453
- g: g * 255,
454
- b: b * 255
455
- };
456
- }
457
- function rgbToHex(r, g, b, allow3Char) {
458
- var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
459
- if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
460
- return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
461
- }
462
- return hex.join("");
463
- }
464
- function rgbaToHex(r, g, b, a, allow4Char) {
465
- var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))];
466
- if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) {
467
- return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
468
- }
469
- return hex.join("");
470
- }
471
- function rgbaToArgbHex(r, g, b, a) {
472
- var hex = [pad2(convertDecimalToHex(a)), pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
473
- return hex.join("");
474
- }
475
- tinycolor.equals = function(color1, color2) {
476
- if (!color1 || !color2) return false;
477
- return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
478
- };
479
- tinycolor.random = function() {
480
- return tinycolor.fromRatio({
481
- r: Math.random(),
482
- g: Math.random(),
483
- b: Math.random()
484
- });
485
- };
486
- function _desaturate(color, amount) {
487
- amount = amount === 0 ? 0 : amount || 10;
488
- var hsl = tinycolor(color).toHsl();
489
- hsl.s -= amount / 100;
490
- hsl.s = clamp01(hsl.s);
491
- return tinycolor(hsl);
492
- }
493
- function _saturate(color, amount) {
494
- amount = amount === 0 ? 0 : amount || 10;
495
- var hsl = tinycolor(color).toHsl();
496
- hsl.s += amount / 100;
497
- hsl.s = clamp01(hsl.s);
498
- return tinycolor(hsl);
499
- }
500
- function _greyscale(color) {
501
- return tinycolor(color).desaturate(100);
502
- }
503
- function _lighten(color, amount) {
504
- amount = amount === 0 ? 0 : amount || 10;
505
- var hsl = tinycolor(color).toHsl();
506
- hsl.l += amount / 100;
507
- hsl.l = clamp01(hsl.l);
508
- return tinycolor(hsl);
509
- }
510
- function _brighten(color, amount) {
511
- amount = amount === 0 ? 0 : amount || 10;
512
- var rgb = tinycolor(color).toRgb();
513
- rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
514
- rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
515
- rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
516
- return tinycolor(rgb);
517
- }
518
- function _darken(color, amount) {
519
- amount = amount === 0 ? 0 : amount || 10;
520
- var hsl = tinycolor(color).toHsl();
521
- hsl.l -= amount / 100;
522
- hsl.l = clamp01(hsl.l);
523
- return tinycolor(hsl);
524
- }
525
- function _spin(color, amount) {
526
- var hsl = tinycolor(color).toHsl();
527
- var hue = (hsl.h + amount) % 360;
528
- hsl.h = hue < 0 ? 360 + hue : hue;
529
- return tinycolor(hsl);
530
- }
531
- function _complement(color) {
532
- var hsl = tinycolor(color).toHsl();
533
- hsl.h = (hsl.h + 180) % 360;
534
- return tinycolor(hsl);
535
- }
536
- function polyad(color, number) {
537
- if (isNaN(number) || number <= 0) {
538
- throw new Error("Argument to polyad must be a positive number");
539
- }
540
- var hsl = tinycolor(color).toHsl();
541
- var result = [tinycolor(color)];
542
- var step = 360 / number;
543
- for (var i = 1; i < number; i++) {
544
- result.push(tinycolor({
545
- h: (hsl.h + i * step) % 360,
546
- s: hsl.s,
547
- l: hsl.l
548
- }));
549
- }
550
- return result;
551
- }
552
- function _splitcomplement(color) {
553
- var hsl = tinycolor(color).toHsl();
554
- var h = hsl.h;
555
- return [tinycolor(color), tinycolor({
556
- h: (h + 72) % 360,
557
- s: hsl.s,
558
- l: hsl.l
559
- }), tinycolor({
560
- h: (h + 216) % 360,
561
- s: hsl.s,
562
- l: hsl.l
563
- })];
564
- }
565
- function _analogous(color, results, slices) {
566
- results = results || 6;
567
- slices = slices || 30;
568
- var hsl = tinycolor(color).toHsl();
569
- var part = 360 / slices;
570
- var ret = [tinycolor(color)];
571
- for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
572
- hsl.h = (hsl.h + part) % 360;
573
- ret.push(tinycolor(hsl));
574
- }
575
- return ret;
576
- }
577
- function _monochromatic(color, results) {
578
- results = results || 6;
579
- var hsv = tinycolor(color).toHsv();
580
- var h = hsv.h, s = hsv.s, v = hsv.v;
581
- var ret = [];
582
- var modification = 1 / results;
583
- while (results--) {
584
- ret.push(tinycolor({
585
- h,
586
- s,
587
- v
588
- }));
589
- v = (v + modification) % 1;
590
- }
591
- return ret;
592
- }
593
- tinycolor.mix = function(color1, color2, amount) {
594
- amount = amount === 0 ? 0 : amount || 50;
595
- var rgb1 = tinycolor(color1).toRgb();
596
- var rgb2 = tinycolor(color2).toRgb();
597
- var p = amount / 100;
598
- var rgba = {
599
- r: (rgb2.r - rgb1.r) * p + rgb1.r,
600
- g: (rgb2.g - rgb1.g) * p + rgb1.g,
601
- b: (rgb2.b - rgb1.b) * p + rgb1.b,
602
- a: (rgb2.a - rgb1.a) * p + rgb1.a
603
- };
604
- return tinycolor(rgba);
605
- };
606
- tinycolor.readability = function(color1, color2) {
607
- var c1 = tinycolor(color1);
608
- var c2 = tinycolor(color2);
609
- return (Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) / (Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05);
610
- };
611
- tinycolor.isReadable = function(color1, color2, wcag2) {
612
- var readability = tinycolor.readability(color1, color2);
613
- var wcag2Parms, out;
614
- out = false;
615
- wcag2Parms = validateWCAG2Parms(wcag2);
616
- switch (wcag2Parms.level + wcag2Parms.size) {
617
- case "AAsmall":
618
- case "AAAlarge":
619
- out = readability >= 4.5;
620
- break;
621
- case "AAlarge":
622
- out = readability >= 3;
623
- break;
624
- case "AAAsmall":
625
- out = readability >= 7;
626
- break;
627
- }
628
- return out;
629
- };
630
- tinycolor.mostReadable = function(baseColor, colorList, args) {
631
- var bestColor = null;
632
- var bestScore = 0;
633
- var readability;
634
- var includeFallbackColors, level, size;
635
- args = args || {};
636
- includeFallbackColors = args.includeFallbackColors;
637
- level = args.level;
638
- size = args.size;
639
- for (var i = 0; i < colorList.length; i++) {
640
- readability = tinycolor.readability(baseColor, colorList[i]);
641
- if (readability > bestScore) {
642
- bestScore = readability;
643
- bestColor = tinycolor(colorList[i]);
644
- }
645
- }
646
- if (tinycolor.isReadable(baseColor, bestColor, {
647
- level,
648
- size
649
- }) || !includeFallbackColors) {
650
- return bestColor;
651
- } else {
652
- args.includeFallbackColors = false;
653
- return tinycolor.mostReadable(baseColor, ["#fff", "#000"], args);
654
- }
655
- };
656
- var names = tinycolor.names = {
657
- aliceblue: "f0f8ff",
658
- antiquewhite: "faebd7",
659
- aqua: "0ff",
660
- aquamarine: "7fffd4",
661
- azure: "f0ffff",
662
- beige: "f5f5dc",
663
- bisque: "ffe4c4",
664
- black: "000",
665
- blanchedalmond: "ffebcd",
666
- blue: "00f",
667
- blueviolet: "8a2be2",
668
- brown: "a52a2a",
669
- burlywood: "deb887",
670
- burntsienna: "ea7e5d",
671
- cadetblue: "5f9ea0",
672
- chartreuse: "7fff00",
673
- chocolate: "d2691e",
674
- coral: "ff7f50",
675
- cornflowerblue: "6495ed",
676
- cornsilk: "fff8dc",
677
- crimson: "dc143c",
678
- cyan: "0ff",
679
- darkblue: "00008b",
680
- darkcyan: "008b8b",
681
- darkgoldenrod: "b8860b",
682
- darkgray: "a9a9a9",
683
- darkgreen: "006400",
684
- darkgrey: "a9a9a9",
685
- darkkhaki: "bdb76b",
686
- darkmagenta: "8b008b",
687
- darkolivegreen: "556b2f",
688
- darkorange: "ff8c00",
689
- darkorchid: "9932cc",
690
- darkred: "8b0000",
691
- darksalmon: "e9967a",
692
- darkseagreen: "8fbc8f",
693
- darkslateblue: "483d8b",
694
- darkslategray: "2f4f4f",
695
- darkslategrey: "2f4f4f",
696
- darkturquoise: "00ced1",
697
- darkviolet: "9400d3",
698
- deeppink: "ff1493",
699
- deepskyblue: "00bfff",
700
- dimgray: "696969",
701
- dimgrey: "696969",
702
- dodgerblue: "1e90ff",
703
- firebrick: "b22222",
704
- floralwhite: "fffaf0",
705
- forestgreen: "228b22",
706
- fuchsia: "f0f",
707
- gainsboro: "dcdcdc",
708
- ghostwhite: "f8f8ff",
709
- gold: "ffd700",
710
- goldenrod: "daa520",
711
- gray: "808080",
712
- green: "008000",
713
- greenyellow: "adff2f",
714
- grey: "808080",
715
- honeydew: "f0fff0",
716
- hotpink: "ff69b4",
717
- indianred: "cd5c5c",
718
- indigo: "4b0082",
719
- ivory: "fffff0",
720
- khaki: "f0e68c",
721
- lavender: "e6e6fa",
722
- lavenderblush: "fff0f5",
723
- lawngreen: "7cfc00",
724
- lemonchiffon: "fffacd",
725
- lightblue: "add8e6",
726
- lightcoral: "f08080",
727
- lightcyan: "e0ffff",
728
- lightgoldenrodyellow: "fafad2",
729
- lightgray: "d3d3d3",
730
- lightgreen: "90ee90",
731
- lightgrey: "d3d3d3",
732
- lightpink: "ffb6c1",
733
- lightsalmon: "ffa07a",
734
- lightseagreen: "20b2aa",
735
- lightskyblue: "87cefa",
736
- lightslategray: "789",
737
- lightslategrey: "789",
738
- lightsteelblue: "b0c4de",
739
- lightyellow: "ffffe0",
740
- lime: "0f0",
741
- limegreen: "32cd32",
742
- linen: "faf0e6",
743
- magenta: "f0f",
744
- maroon: "800000",
745
- mediumaquamarine: "66cdaa",
746
- mediumblue: "0000cd",
747
- mediumorchid: "ba55d3",
748
- mediumpurple: "9370db",
749
- mediumseagreen: "3cb371",
750
- mediumslateblue: "7b68ee",
751
- mediumspringgreen: "00fa9a",
752
- mediumturquoise: "48d1cc",
753
- mediumvioletred: "c71585",
754
- midnightblue: "191970",
755
- mintcream: "f5fffa",
756
- mistyrose: "ffe4e1",
757
- moccasin: "ffe4b5",
758
- navajowhite: "ffdead",
759
- navy: "000080",
760
- oldlace: "fdf5e6",
761
- olive: "808000",
762
- olivedrab: "6b8e23",
763
- orange: "ffa500",
764
- orangered: "ff4500",
765
- orchid: "da70d6",
766
- palegoldenrod: "eee8aa",
767
- palegreen: "98fb98",
768
- paleturquoise: "afeeee",
769
- palevioletred: "db7093",
770
- papayawhip: "ffefd5",
771
- peachpuff: "ffdab9",
772
- peru: "cd853f",
773
- pink: "ffc0cb",
774
- plum: "dda0dd",
775
- powderblue: "b0e0e6",
776
- purple: "800080",
777
- rebeccapurple: "663399",
778
- red: "f00",
779
- rosybrown: "bc8f8f",
780
- royalblue: "4169e1",
781
- saddlebrown: "8b4513",
782
- salmon: "fa8072",
783
- sandybrown: "f4a460",
784
- seagreen: "2e8b57",
785
- seashell: "fff5ee",
786
- sienna: "a0522d",
787
- silver: "c0c0c0",
788
- skyblue: "87ceeb",
789
- slateblue: "6a5acd",
790
- slategray: "708090",
791
- slategrey: "708090",
792
- snow: "fffafa",
793
- springgreen: "00ff7f",
794
- steelblue: "4682b4",
795
- tan: "d2b48c",
796
- teal: "008080",
797
- thistle: "d8bfd8",
798
- tomato: "ff6347",
799
- turquoise: "40e0d0",
800
- violet: "ee82ee",
801
- wheat: "f5deb3",
802
- white: "fff",
803
- whitesmoke: "f5f5f5",
804
- yellow: "ff0",
805
- yellowgreen: "9acd32"
806
- };
807
- var hexNames = tinycolor.hexNames = flip(names);
808
- function flip(o) {
809
- var flipped = {};
810
- for (var i in o) {
811
- if (o.hasOwnProperty(i)) {
812
- flipped[o[i]] = i;
813
- }
814
- }
815
- return flipped;
816
- }
817
- function boundAlpha(a) {
818
- a = parseFloat(a);
819
- if (isNaN(a) || a < 0 || a > 1) {
820
- a = 1;
821
- }
822
- return a;
823
- }
824
- function bound01(n, max) {
825
- if (isOnePointZero(n)) n = "100%";
826
- var processPercent = isPercentage(n);
827
- n = Math.min(max, Math.max(0, parseFloat(n)));
828
- if (processPercent) {
829
- n = parseInt(n * max, 10) / 100;
830
- }
831
- if (Math.abs(n - max) < 1e-6) {
832
- return 1;
833
- }
834
- return n % max / parseFloat(max);
835
- }
836
- function clamp01(val) {
837
- return Math.min(1, Math.max(0, val));
838
- }
839
- function parseIntFromHex(val) {
840
- return parseInt(val, 16);
841
- }
842
- function isOnePointZero(n) {
843
- return typeof n == "string" && n.indexOf(".") != -1 && parseFloat(n) === 1;
844
- }
845
- function isPercentage(n) {
846
- return typeof n === "string" && n.indexOf("%") != -1;
847
- }
848
- function pad2(c) {
849
- return c.length == 1 ? "0" + c : "" + c;
850
- }
851
- function convertToPercentage(n) {
852
- if (n <= 1) {
853
- n = n * 100 + "%";
854
- }
855
- return n;
856
- }
857
- function convertDecimalToHex(d) {
858
- return Math.round(parseFloat(d) * 255).toString(16);
859
- }
860
- function convertHexToDecimal(h) {
861
- return parseIntFromHex(h) / 255;
862
- }
863
- var matchers = (function() {
864
- var CSS_INTEGER = "[-\\+]?\\d+%?";
865
- var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
866
- var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
867
- var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
868
- var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
869
- return {
870
- CSS_UNIT: new RegExp(CSS_UNIT),
871
- rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
872
- rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
873
- hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
874
- hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
875
- hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
876
- hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
877
- hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
878
- hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
879
- hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
880
- hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
881
- };
882
- })();
883
- function isValidCSSUnit(color) {
884
- return !!matchers.CSS_UNIT.exec(color);
885
- }
886
- function stringInputToObject(color) {
887
- color = color.replace(trimLeft, "").replace(trimRight, "").toLowerCase();
888
- var named = false;
889
- if (names[color]) {
890
- color = names[color];
891
- named = true;
892
- } else if (color == "transparent") {
893
- return {
894
- r: 0,
895
- g: 0,
896
- b: 0,
897
- a: 0,
898
- format: "name"
899
- };
900
- }
901
- var match;
902
- if (match = matchers.rgb.exec(color)) {
903
- return {
904
- r: match[1],
905
- g: match[2],
906
- b: match[3]
907
- };
908
- }
909
- if (match = matchers.rgba.exec(color)) {
910
- return {
911
- r: match[1],
912
- g: match[2],
913
- b: match[3],
914
- a: match[4]
915
- };
916
- }
917
- if (match = matchers.hsl.exec(color)) {
918
- return {
919
- h: match[1],
920
- s: match[2],
921
- l: match[3]
922
- };
923
- }
924
- if (match = matchers.hsla.exec(color)) {
925
- return {
926
- h: match[1],
927
- s: match[2],
928
- l: match[3],
929
- a: match[4]
930
- };
931
- }
932
- if (match = matchers.hsv.exec(color)) {
933
- return {
934
- h: match[1],
935
- s: match[2],
936
- v: match[3]
937
- };
938
- }
939
- if (match = matchers.hsva.exec(color)) {
940
- return {
941
- h: match[1],
942
- s: match[2],
943
- v: match[3],
944
- a: match[4]
945
- };
946
- }
947
- if (match = matchers.hex8.exec(color)) {
948
- return {
949
- r: parseIntFromHex(match[1]),
950
- g: parseIntFromHex(match[2]),
951
- b: parseIntFromHex(match[3]),
952
- a: convertHexToDecimal(match[4]),
953
- format: named ? "name" : "hex8"
954
- };
955
- }
956
- if (match = matchers.hex6.exec(color)) {
957
- return {
958
- r: parseIntFromHex(match[1]),
959
- g: parseIntFromHex(match[2]),
960
- b: parseIntFromHex(match[3]),
961
- format: named ? "name" : "hex"
962
- };
963
- }
964
- if (match = matchers.hex4.exec(color)) {
965
- return {
966
- r: parseIntFromHex(match[1] + "" + match[1]),
967
- g: parseIntFromHex(match[2] + "" + match[2]),
968
- b: parseIntFromHex(match[3] + "" + match[3]),
969
- a: convertHexToDecimal(match[4] + "" + match[4]),
970
- format: named ? "name" : "hex8"
971
- };
972
- }
973
- if (match = matchers.hex3.exec(color)) {
974
- return {
975
- r: parseIntFromHex(match[1] + "" + match[1]),
976
- g: parseIntFromHex(match[2] + "" + match[2]),
977
- b: parseIntFromHex(match[3] + "" + match[3]),
978
- format: named ? "name" : "hex"
979
- };
980
- }
981
- return false;
982
- }
983
- function validateWCAG2Parms(parms) {
984
- var level, size;
985
- parms = parms || {
986
- level: "AA",
987
- size: "small"
988
- };
989
- level = (parms.level || "AA").toUpperCase();
990
- size = (parms.size || "small").toLowerCase();
991
- if (level !== "AA" && level !== "AAA") {
992
- level = "AA";
993
- }
994
- if (size !== "small" && size !== "large") {
995
- size = "small";
996
- }
997
- return {
998
- level,
999
- size
1000
- };
1001
- }
1002
- return tinycolor;
1003
- }));
1004
- }
1005
- });
1006
-
1007
- // node_modules/tinygradient/index.js
1008
- var require_tinygradient = __commonJS({
1009
- "node_modules/tinygradient/index.js"(exports2, module2) {
1010
- var tinycolor = require_tinycolor();
1011
- var RGBA_MAX = { r: 256, g: 256, b: 256, a: 1 };
1012
- var HSVA_MAX = { h: 360, s: 1, v: 1, a: 1 };
1013
- function stepize(start, end, steps) {
1014
- let step = {};
1015
- for (let k in start) {
1016
- if (start.hasOwnProperty(k)) {
1017
- step[k] = steps === 0 ? 0 : (end[k] - start[k]) / steps;
1018
- }
1019
- }
1020
- return step;
1021
- }
1022
- function interpolate(step, start, i, max) {
1023
- let color = {};
1024
- for (let k in start) {
1025
- if (start.hasOwnProperty(k)) {
1026
- color[k] = step[k] * i + start[k];
1027
- color[k] = color[k] < 0 ? color[k] + max[k] : max[k] !== 1 ? color[k] % max[k] : color[k];
1028
- }
1029
- }
1030
- return color;
1031
- }
1032
- function interpolateRgb(stop1, stop2, steps) {
1033
- const start = stop1.color.toRgb();
1034
- const end = stop2.color.toRgb();
1035
- const step = stepize(start, end, steps);
1036
- let gradient2 = [stop1.color];
1037
- for (let i = 1; i < steps; i++) {
1038
- const color = interpolate(step, start, i, RGBA_MAX);
1039
- gradient2.push(tinycolor(color));
1040
- }
1041
- return gradient2;
1042
- }
1043
- function interpolateHsv(stop1, stop2, steps, mode) {
1044
- const start = stop1.color.toHsv();
1045
- const end = stop2.color.toHsv();
1046
- if (start.s === 0 || end.s === 0) {
1047
- return interpolateRgb(stop1, stop2, steps);
1048
- }
1049
- let trigonometric;
1050
- if (typeof mode === "boolean") {
1051
- trigonometric = mode;
1052
- } else {
1053
- const trigShortest = start.h < end.h && end.h - start.h < 180 || start.h > end.h && start.h - end.h > 180;
1054
- trigonometric = mode === "long" && trigShortest || mode === "short" && !trigShortest;
1055
- }
1056
- const step = stepize(start, end, steps);
1057
- let gradient2 = [stop1.color];
1058
- let diff;
1059
- if (start.h <= end.h && !trigonometric || start.h >= end.h && trigonometric) {
1060
- diff = end.h - start.h;
1061
- } else if (trigonometric) {
1062
- diff = 360 - end.h + start.h;
1063
- } else {
1064
- diff = 360 - start.h + end.h;
1065
- }
1066
- step.h = Math.pow(-1, trigonometric ? 1 : 0) * Math.abs(diff) / steps;
1067
- for (let i = 1; i < steps; i++) {
1068
- const color = interpolate(step, start, i, HSVA_MAX);
1069
- gradient2.push(tinycolor(color));
1070
- }
1071
- return gradient2;
1072
- }
1073
- function computeSubsteps(stops, steps) {
1074
- const l = stops.length;
1075
- steps = parseInt(steps, 10);
1076
- if (isNaN(steps) || steps < 2) {
1077
- throw new Error("Invalid number of steps (< 2)");
1078
- }
1079
- if (steps < l) {
1080
- throw new Error("Number of steps cannot be inferior to number of stops");
1081
- }
1082
- let substeps = [];
1083
- for (let i = 1; i < l; i++) {
1084
- const step = (steps - 1) * (stops[i].pos - stops[i - 1].pos);
1085
- substeps.push(Math.max(1, Math.round(step)));
1086
- }
1087
- let totalSubsteps = 1;
1088
- for (let n = l - 1; n--; ) totalSubsteps += substeps[n];
1089
- while (totalSubsteps !== steps) {
1090
- if (totalSubsteps < steps) {
1091
- const min = Math.min.apply(null, substeps);
1092
- substeps[substeps.indexOf(min)]++;
1093
- totalSubsteps++;
1094
- } else {
1095
- const max = Math.max.apply(null, substeps);
1096
- substeps[substeps.indexOf(max)]--;
1097
- totalSubsteps--;
1098
- }
1099
- }
1100
- return substeps;
1101
- }
1102
- function computeAt(stops, pos, method, max) {
1103
- if (pos < 0 || pos > 1) {
1104
- throw new Error("Position must be between 0 and 1");
1105
- }
1106
- let start, end;
1107
- for (let i = 0, l = stops.length; i < l - 1; i++) {
1108
- if (pos >= stops[i].pos && pos < stops[i + 1].pos) {
1109
- start = stops[i];
1110
- end = stops[i + 1];
1111
- break;
1112
- }
1113
- }
1114
- if (!start) {
1115
- start = end = stops[stops.length - 1];
1116
- }
1117
- const step = stepize(start.color[method](), end.color[method](), (end.pos - start.pos) * 100);
1118
- const color = interpolate(step, start.color[method](), (pos - start.pos) * 100, max);
1119
- return tinycolor(color);
1120
- }
1121
- var TinyGradient = class _TinyGradient {
1122
- /**
1123
- * @param {StopInput[]|ColorInput[]} stops
1124
- * @returns {TinyGradient}
1125
- */
1126
- constructor(stops) {
1127
- if (stops.length < 2) {
1128
- throw new Error("Invalid number of stops (< 2)");
1129
- }
1130
- const havingPositions = stops[0].pos !== void 0;
1131
- let l = stops.length;
1132
- let p = -1;
1133
- let lastColorLess = false;
1134
- this.stops = stops.map((stop, i) => {
1135
- const hasPosition = stop.pos !== void 0;
1136
- if (havingPositions ^ hasPosition) {
1137
- throw new Error("Cannot mix positionned and not posionned color stops");
1138
- }
1139
- if (hasPosition) {
1140
- const hasColor = stop.color !== void 0;
1141
- if (!hasColor && (lastColorLess || i === 0 || i === l - 1)) {
1142
- throw new Error("Cannot define two consecutive position-only stops");
1143
- }
1144
- lastColorLess = !hasColor;
1145
- stop = {
1146
- color: hasColor ? tinycolor(stop.color) : null,
1147
- colorLess: !hasColor,
1148
- pos: stop.pos
1149
- };
1150
- if (stop.pos < 0 || stop.pos > 1) {
1151
- throw new Error("Color stops positions must be between 0 and 1");
1152
- } else if (stop.pos < p) {
1153
- throw new Error("Color stops positions are not ordered");
1154
- }
1155
- p = stop.pos;
1156
- } else {
1157
- stop = {
1158
- color: tinycolor(stop.color !== void 0 ? stop.color : stop),
1159
- pos: i / (l - 1)
1160
- };
1161
- }
1162
- return stop;
1163
- });
1164
- if (this.stops[0].pos !== 0) {
1165
- this.stops.unshift({
1166
- color: this.stops[0].color,
1167
- pos: 0
1168
- });
1169
- l++;
1170
- }
1171
- if (this.stops[l - 1].pos !== 1) {
1172
- this.stops.push({
1173
- color: this.stops[l - 1].color,
1174
- pos: 1
1175
- });
1176
- }
1177
- }
1178
- /**
1179
- * Return new instance with reversed stops
1180
- * @return {TinyGradient}
1181
- */
1182
- reverse() {
1183
- let stops = [];
1184
- this.stops.forEach(function(stop) {
1185
- stops.push({
1186
- color: stop.color,
1187
- pos: 1 - stop.pos
1188
- });
1189
- });
1190
- return new _TinyGradient(stops.reverse());
1191
- }
1192
- /**
1193
- * Return new instance with looped stops
1194
- * @return {TinyGradient}
1195
- */
1196
- loop() {
1197
- let stops1 = [];
1198
- let stops2 = [];
1199
- this.stops.forEach((stop) => {
1200
- stops1.push({
1201
- color: stop.color,
1202
- pos: stop.pos / 2
1203
- });
1204
- });
1205
- this.stops.slice(0, -1).forEach((stop) => {
1206
- stops2.push({
1207
- color: stop.color,
1208
- pos: 1 - stop.pos / 2
1209
- });
1210
- });
1211
- return new _TinyGradient(stops1.concat(stops2.reverse()));
1212
- }
1213
- /**
1214
- * Generate gradient with RGBa interpolation
1215
- * @param {number} steps
1216
- * @return {tinycolor[]}
1217
- */
1218
- rgb(steps) {
1219
- const substeps = computeSubsteps(this.stops, steps);
1220
- let gradient2 = [];
1221
- this.stops.forEach((stop, i) => {
1222
- if (stop.colorLess) {
1223
- stop.color = interpolateRgb(this.stops[i - 1], this.stops[i + 1], 2)[1];
1224
- }
1225
- });
1226
- for (let i = 0, l = this.stops.length; i < l - 1; i++) {
1227
- const rgb = interpolateRgb(this.stops[i], this.stops[i + 1], substeps[i]);
1228
- gradient2.splice(gradient2.length, 0, ...rgb);
1229
- }
1230
- gradient2.push(this.stops[this.stops.length - 1].color);
1231
- return gradient2;
1232
- }
1233
- /**
1234
- * Generate gradient with HSVa interpolation
1235
- * @param {number} steps
1236
- * @param {boolean|'long'|'short'} [mode=false]
1237
- * - false to step in clockwise
1238
- * - true to step in trigonometric order
1239
- * - 'short' to use the shortest way
1240
- * - 'long' to use the longest way
1241
- * @return {tinycolor[]}
1242
- */
1243
- hsv(steps, mode) {
1244
- const substeps = computeSubsteps(this.stops, steps);
1245
- let gradient2 = [];
1246
- this.stops.forEach((stop, i) => {
1247
- if (stop.colorLess) {
1248
- stop.color = interpolateHsv(this.stops[i - 1], this.stops[i + 1], 2, mode)[1];
1249
- }
1250
- });
1251
- for (let i = 0, l = this.stops.length; i < l - 1; i++) {
1252
- const hsv = interpolateHsv(this.stops[i], this.stops[i + 1], substeps[i], mode);
1253
- gradient2.splice(gradient2.length, 0, ...hsv);
1254
- }
1255
- gradient2.push(this.stops[this.stops.length - 1].color);
1256
- return gradient2;
1257
- }
1258
- /**
1259
- * Generate CSS3 command (no prefix) for this gradient
1260
- * @param {String} [mode=linear] - 'linear' or 'radial'
1261
- * @param {String} [direction] - default is 'to right' or 'ellipse at center'
1262
- * @return {String}
1263
- */
1264
- css(mode, direction) {
1265
- mode = mode || "linear";
1266
- direction = direction || (mode === "linear" ? "to right" : "ellipse at center");
1267
- let css = mode + "-gradient(" + direction;
1268
- this.stops.forEach(function(stop) {
1269
- css += ", " + (stop.colorLess ? "" : stop.color.toRgbString() + " ") + stop.pos * 100 + "%";
1270
- });
1271
- css += ")";
1272
- return css;
1273
- }
1274
- /**
1275
- * Returns the color at specific position with RGBa interpolation
1276
- * @param {number} pos, between 0 and 1
1277
- * @return {tinycolor}
1278
- */
1279
- rgbAt(pos) {
1280
- return computeAt(this.stops, pos, "toRgb", RGBA_MAX);
1281
- }
1282
- /**
1283
- * Returns the color at specific position with HSVa interpolation
1284
- * @param {number} pos, between 0 and 1
1285
- * @return {tinycolor}
1286
- */
1287
- hsvAt(pos) {
1288
- return computeAt(this.stops, pos, "toHsv", HSVA_MAX);
1289
- }
1290
- };
1291
- module2.exports = function(stops) {
1292
- if (arguments.length === 1) {
1293
- if (!Array.isArray(arguments[0])) {
1294
- throw new Error('"stops" is not an array');
1295
- }
1296
- stops = arguments[0];
1297
- } else {
1298
- stops = Array.prototype.slice.call(arguments);
1299
- }
1300
- return new TinyGradient(stops);
1301
- };
1302
- }
1303
- });
1304
-
1305
- // index.js
1306
- var index_exports = {};
1307
- __export(index_exports, {
1308
- default: () => index_default
1309
- });
1310
- module.exports = __toCommonJS(index_exports);
1311
- var import_fs = __toESM(require("fs"), 1);
1312
- var import_path = __toESM(require("path"), 1);
1313
-
1314
- // node_modules/chalk/source/vendor/ansi-styles/index.js
1315
- var ANSI_BACKGROUND_OFFSET = 10;
1316
- var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
1317
- var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
1318
- var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
1319
- var styles = {
1320
- modifier: {
1321
- reset: [0, 0],
1322
- // 21 isn't widely supported and 22 does the same thing
1323
- bold: [1, 22],
1324
- dim: [2, 22],
1325
- italic: [3, 23],
1326
- underline: [4, 24],
1327
- overline: [53, 55],
1328
- inverse: [7, 27],
1329
- hidden: [8, 28],
1330
- strikethrough: [9, 29]
1331
- },
1332
- color: {
1333
- black: [30, 39],
1334
- red: [31, 39],
1335
- green: [32, 39],
1336
- yellow: [33, 39],
1337
- blue: [34, 39],
1338
- magenta: [35, 39],
1339
- cyan: [36, 39],
1340
- white: [37, 39],
1341
- // Bright color
1342
- blackBright: [90, 39],
1343
- gray: [90, 39],
1344
- // Alias of `blackBright`
1345
- grey: [90, 39],
1346
- // Alias of `blackBright`
1347
- redBright: [91, 39],
1348
- greenBright: [92, 39],
1349
- yellowBright: [93, 39],
1350
- blueBright: [94, 39],
1351
- magentaBright: [95, 39],
1352
- cyanBright: [96, 39],
1353
- whiteBright: [97, 39]
1354
- },
1355
- bgColor: {
1356
- bgBlack: [40, 49],
1357
- bgRed: [41, 49],
1358
- bgGreen: [42, 49],
1359
- bgYellow: [43, 49],
1360
- bgBlue: [44, 49],
1361
- bgMagenta: [45, 49],
1362
- bgCyan: [46, 49],
1363
- bgWhite: [47, 49],
1364
- // Bright color
1365
- bgBlackBright: [100, 49],
1366
- bgGray: [100, 49],
1367
- // Alias of `bgBlackBright`
1368
- bgGrey: [100, 49],
1369
- // Alias of `bgBlackBright`
1370
- bgRedBright: [101, 49],
1371
- bgGreenBright: [102, 49],
1372
- bgYellowBright: [103, 49],
1373
- bgBlueBright: [104, 49],
1374
- bgMagentaBright: [105, 49],
1375
- bgCyanBright: [106, 49],
1376
- bgWhiteBright: [107, 49]
1377
- }
1378
- };
1379
- var modifierNames = Object.keys(styles.modifier);
1380
- var foregroundColorNames = Object.keys(styles.color);
1381
- var backgroundColorNames = Object.keys(styles.bgColor);
1382
- var colorNames = [...foregroundColorNames, ...backgroundColorNames];
1383
- function assembleStyles() {
1384
- const codes = /* @__PURE__ */ new Map();
1385
- for (const [groupName, group] of Object.entries(styles)) {
1386
- for (const [styleName, style] of Object.entries(group)) {
1387
- styles[styleName] = {
1388
- open: `\x1B[${style[0]}m`,
1389
- close: `\x1B[${style[1]}m`
1390
- };
1391
- group[styleName] = styles[styleName];
1392
- codes.set(style[0], style[1]);
1393
- }
1394
- Object.defineProperty(styles, groupName, {
1395
- value: group,
1396
- enumerable: false
1397
- });
1398
- }
1399
- Object.defineProperty(styles, "codes", {
1400
- value: codes,
1401
- enumerable: false
1402
- });
1403
- styles.color.close = "\x1B[39m";
1404
- styles.bgColor.close = "\x1B[49m";
1405
- styles.color.ansi = wrapAnsi16();
1406
- styles.color.ansi256 = wrapAnsi256();
1407
- styles.color.ansi16m = wrapAnsi16m();
1408
- styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
1409
- styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
1410
- styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
1411
- Object.defineProperties(styles, {
1412
- rgbToAnsi256: {
1413
- value(red, green, blue) {
1414
- if (red === green && green === blue) {
1415
- if (red < 8) {
1416
- return 16;
1417
- }
1418
- if (red > 248) {
1419
- return 231;
1420
- }
1421
- return Math.round((red - 8) / 247 * 24) + 232;
1422
- }
1423
- return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
1424
- },
1425
- enumerable: false
1426
- },
1427
- hexToRgb: {
1428
- value(hex) {
1429
- const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
1430
- if (!matches) {
1431
- return [0, 0, 0];
1432
- }
1433
- let [colorString] = matches;
1434
- if (colorString.length === 3) {
1435
- colorString = [...colorString].map((character) => character + character).join("");
1436
- }
1437
- const integer = Number.parseInt(colorString, 16);
1438
- return [
1439
- /* eslint-disable no-bitwise */
1440
- integer >> 16 & 255,
1441
- integer >> 8 & 255,
1442
- integer & 255
1443
- /* eslint-enable no-bitwise */
1444
- ];
1445
- },
1446
- enumerable: false
1447
- },
1448
- hexToAnsi256: {
1449
- value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
1450
- enumerable: false
1451
- },
1452
- ansi256ToAnsi: {
1453
- value(code) {
1454
- if (code < 8) {
1455
- return 30 + code;
1456
- }
1457
- if (code < 16) {
1458
- return 90 + (code - 8);
1459
- }
1460
- let red;
1461
- let green;
1462
- let blue;
1463
- if (code >= 232) {
1464
- red = ((code - 232) * 10 + 8) / 255;
1465
- green = red;
1466
- blue = red;
1467
- } else {
1468
- code -= 16;
1469
- const remainder = code % 36;
1470
- red = Math.floor(code / 36) / 5;
1471
- green = Math.floor(remainder / 6) / 5;
1472
- blue = remainder % 6 / 5;
1473
- }
1474
- const value = Math.max(red, green, blue) * 2;
1475
- if (value === 0) {
1476
- return 30;
1477
- }
1478
- let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
1479
- if (value === 2) {
1480
- result += 60;
1481
- }
1482
- return result;
1483
- },
1484
- enumerable: false
1485
- },
1486
- rgbToAnsi: {
1487
- value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
1488
- enumerable: false
1489
- },
1490
- hexToAnsi: {
1491
- value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
1492
- enumerable: false
1493
- }
1494
- });
1495
- return styles;
1496
- }
1497
- var ansiStyles = assembleStyles();
1498
- var ansi_styles_default = ansiStyles;
1499
-
1500
- // node_modules/chalk/source/vendor/supports-color/index.js
1501
- var import_node_process = __toESM(require("node:process"), 1);
1502
- var import_node_os = __toESM(require("node:os"), 1);
1503
- var import_node_tty = __toESM(require("node:tty"), 1);
1504
- function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : import_node_process.default.argv) {
1505
- const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
1506
- const position = argv.indexOf(prefix + flag);
1507
- const terminatorPosition = argv.indexOf("--");
1508
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
1509
- }
1510
- var { env } = import_node_process.default;
1511
- var flagForceColor;
1512
- if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
1513
- flagForceColor = 0;
1514
- } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
1515
- flagForceColor = 1;
1516
- }
1517
- function envForceColor() {
1518
- if ("FORCE_COLOR" in env) {
1519
- if (env.FORCE_COLOR === "true") {
1520
- return 1;
1521
- }
1522
- if (env.FORCE_COLOR === "false") {
1523
- return 0;
1524
- }
1525
- return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
1526
- }
1527
- }
1528
- function translateLevel(level) {
1529
- if (level === 0) {
1530
- return false;
1531
- }
1532
- return {
1533
- level,
1534
- hasBasic: true,
1535
- has256: level >= 2,
1536
- has16m: level >= 3
1537
- };
1538
- }
1539
- function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
1540
- const noFlagForceColor = envForceColor();
1541
- if (noFlagForceColor !== void 0) {
1542
- flagForceColor = noFlagForceColor;
1543
- }
1544
- const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
1545
- if (forceColor === 0) {
1546
- return 0;
1547
- }
1548
- if (sniffFlags) {
1549
- if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
1550
- return 3;
1551
- }
1552
- if (hasFlag("color=256")) {
1553
- return 2;
1554
- }
1555
- }
1556
- if ("TF_BUILD" in env && "AGENT_NAME" in env) {
1557
- return 1;
1558
- }
1559
- if (haveStream && !streamIsTTY && forceColor === void 0) {
1560
- return 0;
1561
- }
1562
- const min = forceColor || 0;
1563
- if (env.TERM === "dumb") {
1564
- return min;
1565
- }
1566
- if (import_node_process.default.platform === "win32") {
1567
- const osRelease = import_node_os.default.release().split(".");
1568
- if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
1569
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
1570
- }
1571
- return 1;
1572
- }
1573
- if ("CI" in env) {
1574
- if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env)) {
1575
- return 3;
1576
- }
1577
- if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
1578
- return 1;
1579
- }
1580
- return min;
1581
- }
1582
- if ("TEAMCITY_VERSION" in env) {
1583
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
1584
- }
1585
- if (env.COLORTERM === "truecolor") {
1586
- return 3;
1587
- }
1588
- if (env.TERM === "xterm-kitty") {
1589
- return 3;
1590
- }
1591
- if (env.TERM === "xterm-ghostty") {
1592
- return 3;
1593
- }
1594
- if (env.TERM === "wezterm") {
1595
- return 3;
1596
- }
1597
- if ("TERM_PROGRAM" in env) {
1598
- const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
1599
- switch (env.TERM_PROGRAM) {
1600
- case "iTerm.app": {
1601
- return version >= 3 ? 3 : 2;
1602
- }
1603
- case "Apple_Terminal": {
1604
- return 2;
1605
- }
1606
- }
1607
- }
1608
- if (/-256(color)?$/i.test(env.TERM)) {
1609
- return 2;
1610
- }
1611
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
1612
- return 1;
1613
- }
1614
- if ("COLORTERM" in env) {
1615
- return 1;
1616
- }
1617
- return min;
1618
- }
1619
- function createSupportsColor(stream, options = {}) {
1620
- const level = _supportsColor(stream, {
1621
- streamIsTTY: stream && stream.isTTY,
1622
- ...options
1623
- });
1624
- return translateLevel(level);
1625
- }
1626
- var supportsColor = {
1627
- stdout: createSupportsColor({ isTTY: import_node_tty.default.isatty(1) }),
1628
- stderr: createSupportsColor({ isTTY: import_node_tty.default.isatty(2) })
1629
- };
1630
- var supports_color_default = supportsColor;
1631
-
1632
- // node_modules/chalk/source/utilities.js
1633
- function stringReplaceAll(string, substring, replacer) {
1634
- let index = string.indexOf(substring);
1635
- if (index === -1) {
1636
- return string;
1637
- }
1638
- const substringLength = substring.length;
1639
- let endIndex = 0;
1640
- let returnValue = "";
1641
- do {
1642
- returnValue += string.slice(endIndex, index) + substring + replacer;
1643
- endIndex = index + substringLength;
1644
- index = string.indexOf(substring, endIndex);
1645
- } while (index !== -1);
1646
- returnValue += string.slice(endIndex);
1647
- return returnValue;
1648
- }
1649
- function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
1650
- let endIndex = 0;
1651
- let returnValue = "";
1652
- do {
1653
- const gotCR = string[index - 1] === "\r";
1654
- returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
1655
- endIndex = index + 1;
1656
- index = string.indexOf("\n", endIndex);
1657
- } while (index !== -1);
1658
- returnValue += string.slice(endIndex);
1659
- return returnValue;
1660
- }
1661
-
1662
- // node_modules/chalk/source/index.js
1663
- var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
1664
- var GENERATOR = Symbol("GENERATOR");
1665
- var STYLER = Symbol("STYLER");
1666
- var IS_EMPTY = Symbol("IS_EMPTY");
1667
- var levelMapping = [
1668
- "ansi",
1669
- "ansi",
1670
- "ansi256",
1671
- "ansi16m"
1672
- ];
1673
- var styles2 = /* @__PURE__ */ Object.create(null);
1674
- var applyOptions = (object, options = {}) => {
1675
- if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
1676
- throw new Error("The `level` option should be an integer from 0 to 3");
1677
- }
1678
- const colorLevel = stdoutColor ? stdoutColor.level : 0;
1679
- object.level = options.level === void 0 ? colorLevel : options.level;
1680
- };
1681
- var chalkFactory = (options) => {
1682
- const chalk2 = (...strings) => strings.join(" ");
1683
- applyOptions(chalk2, options);
1684
- Object.setPrototypeOf(chalk2, createChalk.prototype);
1685
- return chalk2;
1686
- };
1687
- function createChalk(options) {
1688
- return chalkFactory(options);
1689
- }
1690
- Object.setPrototypeOf(createChalk.prototype, Function.prototype);
1691
- for (const [styleName, style] of Object.entries(ansi_styles_default)) {
1692
- styles2[styleName] = {
1693
- get() {
1694
- const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
1695
- Object.defineProperty(this, styleName, { value: builder });
1696
- return builder;
1697
- }
1698
- };
1699
- }
1700
- styles2.visible = {
1701
- get() {
1702
- const builder = createBuilder(this, this[STYLER], true);
1703
- Object.defineProperty(this, "visible", { value: builder });
1704
- return builder;
1705
- }
1706
- };
1707
- var getModelAnsi = (model, level, type, ...arguments_) => {
1708
- if (model === "rgb") {
1709
- if (level === "ansi16m") {
1710
- return ansi_styles_default[type].ansi16m(...arguments_);
1711
- }
1712
- if (level === "ansi256") {
1713
- return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
1714
- }
1715
- return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
1716
- }
1717
- if (model === "hex") {
1718
- return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
1719
- }
1720
- return ansi_styles_default[type][model](...arguments_);
1721
- };
1722
- var usedModels = ["rgb", "hex", "ansi256"];
1723
- for (const model of usedModels) {
1724
- styles2[model] = {
1725
- get() {
1726
- const { level } = this;
1727
- return function(...arguments_) {
1728
- const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
1729
- return createBuilder(this, styler, this[IS_EMPTY]);
1730
- };
1731
- }
1732
- };
1733
- const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
1734
- styles2[bgModel] = {
1735
- get() {
1736
- const { level } = this;
1737
- return function(...arguments_) {
1738
- const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
1739
- return createBuilder(this, styler, this[IS_EMPTY]);
1740
- };
1741
- }
1742
- };
1743
- }
1744
- var proto = Object.defineProperties(() => {
1745
- }, {
1746
- ...styles2,
1747
- level: {
1748
- enumerable: true,
1749
- get() {
1750
- return this[GENERATOR].level;
1751
- },
1752
- set(level) {
1753
- this[GENERATOR].level = level;
1754
- }
1755
- }
1756
- });
1757
- var createStyler = (open, close, parent) => {
1758
- let openAll;
1759
- let closeAll;
1760
- if (parent === void 0) {
1761
- openAll = open;
1762
- closeAll = close;
1763
- } else {
1764
- openAll = parent.openAll + open;
1765
- closeAll = close + parent.closeAll;
1766
- }
1767
- return {
1768
- open,
1769
- close,
1770
- openAll,
1771
- closeAll,
1772
- parent
1773
- };
1774
- };
1775
- var createBuilder = (self2, _styler, _isEmpty) => {
1776
- const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
1777
- Object.setPrototypeOf(builder, proto);
1778
- builder[GENERATOR] = self2;
1779
- builder[STYLER] = _styler;
1780
- builder[IS_EMPTY] = _isEmpty;
1781
- return builder;
1782
- };
1783
- var applyStyle = (self2, string) => {
1784
- if (self2.level <= 0 || !string) {
1785
- return self2[IS_EMPTY] ? "" : string;
1786
- }
1787
- let styler = self2[STYLER];
1788
- if (styler === void 0) {
1789
- return string;
1790
- }
1791
- const { openAll, closeAll } = styler;
1792
- if (string.includes("\x1B")) {
1793
- while (styler !== void 0) {
1794
- string = stringReplaceAll(string, styler.close, styler.open);
1795
- styler = styler.parent;
1796
- }
1797
- }
1798
- const lfIndex = string.indexOf("\n");
1799
- if (lfIndex !== -1) {
1800
- string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
1801
- }
1802
- return openAll + string + closeAll;
1803
- };
1804
- Object.defineProperties(createChalk.prototype, styles2);
1805
- var chalk = createChalk();
1806
- var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
1807
- var source_default = chalk;
1808
-
1809
- // node_modules/gradient-string/dist/index.js
1810
- var import_tinygradient = __toESM(require_tinygradient(), 1);
1811
- var gradient = (...colors) => {
1812
- let gradient2;
1813
- let options;
1814
- if (colors.length === 0) {
1815
- throw new Error("Missing gradient colors");
1816
- }
1817
- if (!Array.isArray(colors[0])) {
1818
- if (colors.length === 1) {
1819
- throw new Error(`Expected an array of colors, received ${JSON.stringify(colors[0])}`);
1820
- }
1821
- gradient2 = (0, import_tinygradient.default)(...colors);
1822
- } else {
1823
- gradient2 = (0, import_tinygradient.default)(colors[0]);
1824
- options = validateOptions(colors[1]);
1825
- }
1826
- const fn = (str, deprecatedOptions) => {
1827
- return applyGradient(str ? str.toString() : "", gradient2, deprecatedOptions ?? options);
1828
- };
1829
- fn.multiline = (str, deprecatedOptions) => multiline(str ? str.toString() : "", gradient2, deprecatedOptions ?? options);
1830
- return fn;
1831
- };
1832
- var getColors = (gradient2, options, count) => {
1833
- return options.interpolation?.toLowerCase() === "hsv" ? gradient2.hsv(count, options.hsvSpin?.toLowerCase() || false) : gradient2.rgb(count);
1834
- };
1835
- function applyGradient(str, gradient2, opts) {
1836
- const options = validateOptions(opts);
1837
- const colorsCount = Math.max(str.replace(/\s/g, "").length, gradient2.stops.length);
1838
- const colors = getColors(gradient2, options, colorsCount);
1839
- let result = "";
1840
- for (const s of str) {
1841
- result += s.match(/\s/g) ? s : source_default.hex(colors.shift()?.toHex() || "#000")(s);
1842
- }
1843
- return result;
1844
- }
1845
- function multiline(str, gradient2, opts) {
1846
- const options = validateOptions(opts);
1847
- const lines = str.split("\n");
1848
- const maxLength = Math.max(...lines.map((l) => l.length), gradient2.stops.length);
1849
- const colors = getColors(gradient2, options, maxLength);
1850
- const results = [];
1851
- for (const line of lines) {
1852
- const lineColors = colors.slice(0);
1853
- let lineResult = "";
1854
- for (const l of line) {
1855
- lineResult += source_default.hex(lineColors.shift()?.toHex() || "#000")(l);
1856
- }
1857
- results.push(lineResult);
1858
- }
1859
- return results.join("\n");
1860
- }
1861
- function validateOptions(opts) {
1862
- const options = { interpolation: "rgb", hsvSpin: "short", ...opts };
1863
- if (opts !== void 0 && typeof opts !== "object") {
1864
- throw new TypeError(`Expected \`options\` to be an \`object\`, got \`${typeof opts}\``);
1865
- }
1866
- if (typeof options.interpolation !== "string") {
1867
- throw new TypeError(`Expected \`options.interpolation\` to be \`rgb\` or \`hsv\`, got \`${typeof options.interpolation}\``);
1868
- }
1869
- if (options.interpolation.toLowerCase() === "hsv" && typeof options.hsvSpin !== "string") {
1870
- throw new TypeError(`Expected \`options.hsvSpin\` to be a \`short\` or \`long\`, got \`${typeof options.hsvSpin}\``);
1871
- }
1872
- return options;
1873
- }
1874
- var aliases = {
1875
- atlas: { colors: ["#feac5e", "#c779d0", "#4bc0c8"], options: {} },
1876
- cristal: { colors: ["#bdfff3", "#4ac29a"], options: {} },
1877
- teen: { colors: ["#77a1d3", "#79cbca", "#e684ae"], options: {} },
1878
- mind: { colors: ["#473b7b", "#3584a7", "#30d2be"], options: {} },
1879
- morning: { colors: ["#ff5f6d", "#ffc371"], options: { interpolation: "hsv" } },
1880
- vice: { colors: ["#5ee7df", "#b490ca"], options: { interpolation: "hsv" } },
1881
- passion: { colors: ["#f43b47", "#453a94"], options: {} },
1882
- fruit: { colors: ["#ff4e50", "#f9d423"], options: {} },
1883
- instagram: { colors: ["#833ab4", "#fd1d1d", "#fcb045"], options: {} },
1884
- retro: {
1885
- colors: ["#3f51b1", "#5a55ae", "#7b5fac", "#8f6aae", "#a86aa4", "#cc6b8e", "#f18271", "#f3a469", "#f7c978"],
1886
- options: {}
1887
- },
1888
- summer: { colors: ["#fdbb2d", "#22c1c3"], options: {} },
1889
- rainbow: { colors: ["#ff0000", "#ff0100"], options: { interpolation: "hsv", hsvSpin: "long" } },
1890
- pastel: { colors: ["#74ebd5", "#74ecd5"], options: { interpolation: "hsv", hsvSpin: "long" } }
1891
- };
1892
- function gradientAlias(alias) {
1893
- const result = (str) => gradient(...alias.colors)(str, alias.options);
1894
- result.multiline = (str = "") => gradient(...alias.colors).multiline(str, alias.options);
1895
- return result;
1896
- }
1897
- var dist_default = gradient;
1898
- var atlas = gradientAlias(aliases.atlas);
1899
- var cristal = gradientAlias(aliases.cristal);
1900
- var teen = gradientAlias(aliases.teen);
1901
- var mind = gradientAlias(aliases.mind);
1902
- var morning = gradientAlias(aliases.morning);
1903
- var vice = gradientAlias(aliases.vice);
1904
- var passion = gradientAlias(aliases.passion);
1905
- var fruit = gradientAlias(aliases.fruit);
1906
- var instagram = gradientAlias(aliases.instagram);
1907
- var retro = gradientAlias(aliases.retro);
1908
- var summer = gradientAlias(aliases.summer);
1909
- var rainbow = gradientAlias(aliases.rainbow);
1910
- var pastel = gradientAlias(aliases.pastel);
1911
- gradient.atlas = atlas;
1912
- gradient.cristal = cristal;
1913
- gradient.teen = teen;
1914
- gradient.mind = mind;
1915
- gradient.morning = morning;
1916
- gradient.vice = vice;
1917
- gradient.passion = passion;
1918
- gradient.fruit = fruit;
1919
- gradient.instagram = instagram;
1920
- gradient.retro = retro;
1921
- gradient.summer = summer;
1922
- gradient.rainbow = rainbow;
1923
- gradient.pastel = pastel;
1924
-
1925
- // index.js
1926
- function getRandomHexColor() {
1927
- const randomColor = Math.floor(Math.random() * 16777216).toString(16);
1928
- return `#${randomColor.padStart(6, "0")}`;
1929
- }
1930
- var aaDir = import_path.default.join(__dirname, "aa");
1931
- function nekos(options = {}) {
1932
- const { id } = options;
1933
- let { colors } = options;
1934
- let catAscii = "";
1935
- try {
1936
- const files = import_fs.default.readdirSync(aaDir);
1937
- if (files.length === 0) {
1938
- console.error("Error: 'aa' directory is empty or does not exist.");
1939
- return;
1940
- }
1941
- let targetFile;
1942
- if (id && files.includes(`${id}.txt`)) {
1943
- targetFile = `${id}.txt`;
1944
- } else {
1945
- const randomIndex = Math.floor(Math.random() * files.length);
1946
- targetFile = files[randomIndex];
1947
- }
1948
- const filePath = import_path.default.join(aaDir, targetFile);
1949
- catAscii = import_fs.default.readFileSync(filePath, "utf-8");
1950
- } catch (error) {
1951
- console.error("Error reading ascii art file:", error);
1952
- return;
1953
- }
1954
- if (colors) {
1955
- let processedColors;
1956
- const rainbowColors = [
1957
- "red",
1958
- "orange",
1959
- "yellow",
1960
- "green",
1961
- "blue",
1962
- "violet"
1963
- ];
1964
- if (typeof colors === "string") {
1965
- const upperCaseColor = colors.toUpperCase();
1966
- if (upperCaseColor === "RAINBOW") {
1967
- processedColors = rainbowColors;
1968
- } else if (upperCaseColor === "RANDOM") {
1969
- processedColors = [getRandomHexColor()];
1970
- } else {
1971
- processedColors = [colors];
1972
- }
1973
- } else if (Array.isArray(colors)) {
1974
- processedColors = colors.map(
1975
- (color) => typeof color === "string" && color.toUpperCase() === "RANDOM" ? getRandomHexColor() : color
1976
- );
1977
- } else {
1978
- processedColors = colors;
1979
- }
1980
- if (Array.isArray(processedColors) && processedColors.length === 1) {
1981
- processedColors.push(processedColors[0]);
1982
- }
1983
- if (processedColors && processedColors.length > 0) {
1984
- console.log(dist_default(processedColors)(catAscii));
1985
- } else {
1986
- console.log(catAscii);
1987
- }
1988
- } else {
1989
- console.log(catAscii);
1990
- }
1991
- }
1992
- var index_default = nekos;