@eggjs/mock 6.1.0-beta.3 → 6.1.0-beta.5

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.
Files changed (104) hide show
  1. package/dist/_virtual/rolldown_runtime.js +24 -1
  2. package/dist/bootstrap.d.ts +1 -1
  3. package/dist/bootstrap.js +1 -1
  4. package/dist/index.js +0 -1
  5. package/dist/inject_mocha.d.ts +1 -0
  6. package/dist/inject_mocha.js +35 -0
  7. package/dist/node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js +142 -0
  8. package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/index.js +157 -0
  9. package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/templates.js +97 -0
  10. package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/util.js +40 -0
  11. package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/conversions.js +812 -0
  12. package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/index.js +50 -0
  13. package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/route.js +68 -0
  14. package/dist/node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js +752 -0
  15. package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/browser.js +203 -0
  16. package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js +209 -0
  17. package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/index.js +18 -0
  18. package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/node.js +215 -0
  19. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/convert/dmp.js +24 -0
  20. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/convert/xml.js +33 -0
  21. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/array.js +29 -0
  22. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/base.js +185 -0
  23. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/character.js +23 -0
  24. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/css.js +26 -0
  25. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/json.js +83 -0
  26. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/line.js +51 -0
  27. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/sentence.js +26 -0
  28. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/word.js +151 -0
  29. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/index.js +178 -0
  30. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/apply.js +168 -0
  31. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/create.js +301 -0
  32. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/line-endings.js +137 -0
  33. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/merge.js +367 -0
  34. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/parse.js +91 -0
  35. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/reverse.js +99 -0
  36. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/array.js +23 -0
  37. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/distance-iterator.js +30 -0
  38. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/params.js +22 -0
  39. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/string.js +97 -0
  40. package/dist/node_modules/.pnpm/escape-string-regexp@4.0.0/node_modules/escape-string-regexp/index.js +14 -0
  41. package/dist/node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js +16 -0
  42. package/dist/node_modules/.pnpm/he@1.2.0/node_modules/he/he.js +4093 -0
  43. package/dist/node_modules/.pnpm/is-unicode-supported@0.1.0/node_modules/is-unicode-supported/index.js +14 -0
  44. package/dist/node_modules/.pnpm/log-symbols@4.1.0/node_modules/log-symbols/index.js +27 -0
  45. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/index.js +12 -0
  46. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/context.js +83 -0
  47. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/error-constants.js +35 -0
  48. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/errors.js +392 -0
  49. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/hook.js +86 -0
  50. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/bdd.js +104 -0
  51. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/common.js +99 -0
  52. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/exports.js +65 -0
  53. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/index.js +18 -0
  54. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/qunit.js +95 -0
  55. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/tdd.js +105 -0
  56. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/mocha.js +1037 -0
  57. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/mocharc.js +24 -0
  58. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/buffered-worker-pool.js +152 -0
  59. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/esm-utils.js +74 -0
  60. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/file-unloader.js +22 -0
  61. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/parallel-buffered-runner.js +329 -0
  62. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/serializer.js +314 -0
  63. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/pending.js +22 -0
  64. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/base.js +417 -0
  65. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/doc.js +79 -0
  66. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/dot.js +75 -0
  67. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/html.js +283 -0
  68. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/index.js +40 -0
  69. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/json-stream.js +90 -0
  70. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/json.js +145 -0
  71. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/landing.js +107 -0
  72. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/list.js +77 -0
  73. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/markdown.js +106 -0
  74. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/min.js +57 -0
  75. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/nyan.js +233 -0
  76. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/progress.js +92 -0
  77. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/spec.js +91 -0
  78. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/tap.js +261 -0
  79. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/xunit.js +166 -0
  80. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/runnable.js +346 -0
  81. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/runner.js +922 -0
  82. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/stats-collector.js +72 -0
  83. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/suite.js +517 -0
  84. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/test.js +105 -0
  85. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/utils.js +505 -0
  86. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/package.js +225 -0
  87. package/dist/node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js +124 -0
  88. package/dist/node_modules/.pnpm/randombytes@2.1.0/node_modules/randombytes/index.js +11 -0
  89. package/dist/node_modules/.pnpm/serialize-javascript@6.0.2/node_modules/serialize-javascript/index.js +114 -0
  90. package/dist/node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js +76 -0
  91. package/dist/node_modules/.pnpm/supports-color@8.1.1/node_modules/supports-color/index.js +89 -0
  92. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/Pool.js +366 -0
  93. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/Promise.js +248 -0
  94. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/WorkerHandler.js +419 -0
  95. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/debug-port-allocator.js +27 -0
  96. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/environment.js +18 -0
  97. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/generated/embeddedWorker.js +16 -0
  98. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/index.js +63 -0
  99. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/transfer.js +21 -0
  100. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/validateOptions.js +9 -0
  101. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/worker.js +277 -0
  102. package/dist/register.d.ts +0 -2
  103. package/dist/register.js +1 -26
  104. package/package.json +10 -8
@@ -0,0 +1,812 @@
1
+ import { __commonJS } from "../../../../../_virtual/rolldown_runtime.js";
2
+ import { require_color_name } from "../../../color-name@1.1.4/node_modules/color-name/index.js";
3
+
4
+ //#region ../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/conversions.js
5
+ var require_conversions = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/conversions.js": ((exports, module) => {
6
+ const cssKeywords = require_color_name();
7
+ const reverseKeywords = {};
8
+ for (const key of Object.keys(cssKeywords)) reverseKeywords[cssKeywords[key]] = key;
9
+ const convert = {
10
+ rgb: {
11
+ channels: 3,
12
+ labels: "rgb"
13
+ },
14
+ hsl: {
15
+ channels: 3,
16
+ labels: "hsl"
17
+ },
18
+ hsv: {
19
+ channels: 3,
20
+ labels: "hsv"
21
+ },
22
+ hwb: {
23
+ channels: 3,
24
+ labels: "hwb"
25
+ },
26
+ cmyk: {
27
+ channels: 4,
28
+ labels: "cmyk"
29
+ },
30
+ xyz: {
31
+ channels: 3,
32
+ labels: "xyz"
33
+ },
34
+ lab: {
35
+ channels: 3,
36
+ labels: "lab"
37
+ },
38
+ lch: {
39
+ channels: 3,
40
+ labels: "lch"
41
+ },
42
+ hex: {
43
+ channels: 1,
44
+ labels: ["hex"]
45
+ },
46
+ keyword: {
47
+ channels: 1,
48
+ labels: ["keyword"]
49
+ },
50
+ ansi16: {
51
+ channels: 1,
52
+ labels: ["ansi16"]
53
+ },
54
+ ansi256: {
55
+ channels: 1,
56
+ labels: ["ansi256"]
57
+ },
58
+ hcg: {
59
+ channels: 3,
60
+ labels: [
61
+ "h",
62
+ "c",
63
+ "g"
64
+ ]
65
+ },
66
+ apple: {
67
+ channels: 3,
68
+ labels: [
69
+ "r16",
70
+ "g16",
71
+ "b16"
72
+ ]
73
+ },
74
+ gray: {
75
+ channels: 1,
76
+ labels: ["gray"]
77
+ }
78
+ };
79
+ module.exports = convert;
80
+ for (const model of Object.keys(convert)) {
81
+ if (!("channels" in convert[model])) throw new Error("missing channels property: " + model);
82
+ if (!("labels" in convert[model])) throw new Error("missing channel labels property: " + model);
83
+ if (convert[model].labels.length !== convert[model].channels) throw new Error("channel and label counts mismatch: " + model);
84
+ const { channels, labels } = convert[model];
85
+ delete convert[model].channels;
86
+ delete convert[model].labels;
87
+ Object.defineProperty(convert[model], "channels", { value: channels });
88
+ Object.defineProperty(convert[model], "labels", { value: labels });
89
+ }
90
+ convert.rgb.hsl = function(rgb) {
91
+ const r = rgb[0] / 255;
92
+ const g = rgb[1] / 255;
93
+ const b = rgb[2] / 255;
94
+ const min = Math.min(r, g, b);
95
+ const max = Math.max(r, g, b);
96
+ const delta = max - min;
97
+ let h;
98
+ let s;
99
+ if (max === min) h = 0;
100
+ else if (r === max) h = (g - b) / delta;
101
+ else if (g === max) h = 2 + (b - r) / delta;
102
+ else if (b === max) h = 4 + (r - g) / delta;
103
+ h = Math.min(h * 60, 360);
104
+ if (h < 0) h += 360;
105
+ const l = (min + max) / 2;
106
+ if (max === min) s = 0;
107
+ else if (l <= .5) s = delta / (max + min);
108
+ else s = delta / (2 - max - min);
109
+ return [
110
+ h,
111
+ s * 100,
112
+ l * 100
113
+ ];
114
+ };
115
+ convert.rgb.hsv = function(rgb) {
116
+ let rdif;
117
+ let gdif;
118
+ let bdif;
119
+ let h;
120
+ let s;
121
+ const r = rgb[0] / 255;
122
+ const g = rgb[1] / 255;
123
+ const b = rgb[2] / 255;
124
+ const v = Math.max(r, g, b);
125
+ const diff = v - Math.min(r, g, b);
126
+ const diffc = function(c) {
127
+ return (v - c) / 6 / diff + 1 / 2;
128
+ };
129
+ if (diff === 0) {
130
+ h = 0;
131
+ s = 0;
132
+ } else {
133
+ s = diff / v;
134
+ rdif = diffc(r);
135
+ gdif = diffc(g);
136
+ bdif = diffc(b);
137
+ if (r === v) h = bdif - gdif;
138
+ else if (g === v) h = 1 / 3 + rdif - bdif;
139
+ else if (b === v) h = 2 / 3 + gdif - rdif;
140
+ if (h < 0) h += 1;
141
+ else if (h > 1) h -= 1;
142
+ }
143
+ return [
144
+ h * 360,
145
+ s * 100,
146
+ v * 100
147
+ ];
148
+ };
149
+ convert.rgb.hwb = function(rgb) {
150
+ const r = rgb[0];
151
+ const g = rgb[1];
152
+ let b = rgb[2];
153
+ const h = convert.rgb.hsl(rgb)[0];
154
+ const w = 1 / 255 * Math.min(r, Math.min(g, b));
155
+ b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
156
+ return [
157
+ h,
158
+ w * 100,
159
+ b * 100
160
+ ];
161
+ };
162
+ convert.rgb.cmyk = function(rgb) {
163
+ const r = rgb[0] / 255;
164
+ const g = rgb[1] / 255;
165
+ const b = rgb[2] / 255;
166
+ const k = Math.min(1 - r, 1 - g, 1 - b);
167
+ const c = (1 - r - k) / (1 - k) || 0;
168
+ const m = (1 - g - k) / (1 - k) || 0;
169
+ const y = (1 - b - k) / (1 - k) || 0;
170
+ return [
171
+ c * 100,
172
+ m * 100,
173
+ y * 100,
174
+ k * 100
175
+ ];
176
+ };
177
+ function comparativeDistance(x, y) {
178
+ return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
179
+ }
180
+ convert.rgb.keyword = function(rgb) {
181
+ const reversed = reverseKeywords[rgb];
182
+ if (reversed) return reversed;
183
+ let currentClosestDistance = Infinity;
184
+ let currentClosestKeyword;
185
+ for (const keyword of Object.keys(cssKeywords)) {
186
+ const value = cssKeywords[keyword];
187
+ const distance = comparativeDistance(rgb, value);
188
+ if (distance < currentClosestDistance) {
189
+ currentClosestDistance = distance;
190
+ currentClosestKeyword = keyword;
191
+ }
192
+ }
193
+ return currentClosestKeyword;
194
+ };
195
+ convert.keyword.rgb = function(keyword) {
196
+ return cssKeywords[keyword];
197
+ };
198
+ convert.rgb.xyz = function(rgb) {
199
+ let r = rgb[0] / 255;
200
+ let g = rgb[1] / 255;
201
+ let b = rgb[2] / 255;
202
+ r = r > .04045 ? ((r + .055) / 1.055) ** 2.4 : r / 12.92;
203
+ g = g > .04045 ? ((g + .055) / 1.055) ** 2.4 : g / 12.92;
204
+ b = b > .04045 ? ((b + .055) / 1.055) ** 2.4 : b / 12.92;
205
+ const x = r * .4124 + g * .3576 + b * .1805;
206
+ const y = r * .2126 + g * .7152 + b * .0722;
207
+ const z = r * .0193 + g * .1192 + b * .9505;
208
+ return [
209
+ x * 100,
210
+ y * 100,
211
+ z * 100
212
+ ];
213
+ };
214
+ convert.rgb.lab = function(rgb) {
215
+ const xyz = convert.rgb.xyz(rgb);
216
+ let x = xyz[0];
217
+ let y = xyz[1];
218
+ let z = xyz[2];
219
+ x /= 95.047;
220
+ y /= 100;
221
+ z /= 108.883;
222
+ x = x > .008856 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
223
+ y = y > .008856 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
224
+ z = z > .008856 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
225
+ const l = 116 * y - 16;
226
+ const a = 500 * (x - y);
227
+ const b = 200 * (y - z);
228
+ return [
229
+ l,
230
+ a,
231
+ b
232
+ ];
233
+ };
234
+ convert.hsl.rgb = function(hsl) {
235
+ const h = hsl[0] / 360;
236
+ const s = hsl[1] / 100;
237
+ const l = hsl[2] / 100;
238
+ let t2;
239
+ let t3;
240
+ let val;
241
+ if (s === 0) {
242
+ val = l * 255;
243
+ return [
244
+ val,
245
+ val,
246
+ val
247
+ ];
248
+ }
249
+ if (l < .5) t2 = l * (1 + s);
250
+ else t2 = l + s - l * s;
251
+ const t1 = 2 * l - t2;
252
+ const rgb = [
253
+ 0,
254
+ 0,
255
+ 0
256
+ ];
257
+ for (let i = 0; i < 3; i++) {
258
+ t3 = h + 1 / 3 * -(i - 1);
259
+ if (t3 < 0) t3++;
260
+ if (t3 > 1) t3--;
261
+ if (6 * t3 < 1) val = t1 + (t2 - t1) * 6 * t3;
262
+ else if (2 * t3 < 1) val = t2;
263
+ else if (3 * t3 < 2) val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
264
+ else val = t1;
265
+ rgb[i] = val * 255;
266
+ }
267
+ return rgb;
268
+ };
269
+ convert.hsl.hsv = function(hsl) {
270
+ const h = hsl[0];
271
+ let s = hsl[1] / 100;
272
+ let l = hsl[2] / 100;
273
+ let smin = s;
274
+ const lmin = Math.max(l, .01);
275
+ l *= 2;
276
+ s *= l <= 1 ? l : 2 - l;
277
+ smin *= lmin <= 1 ? lmin : 2 - lmin;
278
+ const v = (l + s) / 2;
279
+ const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
280
+ return [
281
+ h,
282
+ sv * 100,
283
+ v * 100
284
+ ];
285
+ };
286
+ convert.hsv.rgb = function(hsv) {
287
+ const h = hsv[0] / 60;
288
+ const s = hsv[1] / 100;
289
+ let v = hsv[2] / 100;
290
+ const hi = Math.floor(h) % 6;
291
+ const f = h - Math.floor(h);
292
+ const p = 255 * v * (1 - s);
293
+ const q = 255 * v * (1 - s * f);
294
+ const t = 255 * v * (1 - s * (1 - f));
295
+ v *= 255;
296
+ switch (hi) {
297
+ case 0: return [
298
+ v,
299
+ t,
300
+ p
301
+ ];
302
+ case 1: return [
303
+ q,
304
+ v,
305
+ p
306
+ ];
307
+ case 2: return [
308
+ p,
309
+ v,
310
+ t
311
+ ];
312
+ case 3: return [
313
+ p,
314
+ q,
315
+ v
316
+ ];
317
+ case 4: return [
318
+ t,
319
+ p,
320
+ v
321
+ ];
322
+ case 5: return [
323
+ v,
324
+ p,
325
+ q
326
+ ];
327
+ }
328
+ };
329
+ convert.hsv.hsl = function(hsv) {
330
+ const h = hsv[0];
331
+ const s = hsv[1] / 100;
332
+ const v = hsv[2] / 100;
333
+ const vmin = Math.max(v, .01);
334
+ let sl;
335
+ let l = (2 - s) * v;
336
+ const lmin = (2 - s) * vmin;
337
+ sl = s * vmin;
338
+ sl /= lmin <= 1 ? lmin : 2 - lmin;
339
+ sl = sl || 0;
340
+ l /= 2;
341
+ return [
342
+ h,
343
+ sl * 100,
344
+ l * 100
345
+ ];
346
+ };
347
+ convert.hwb.rgb = function(hwb) {
348
+ const h = hwb[0] / 360;
349
+ let wh = hwb[1] / 100;
350
+ let bl = hwb[2] / 100;
351
+ const ratio = wh + bl;
352
+ let f;
353
+ if (ratio > 1) {
354
+ wh /= ratio;
355
+ bl /= ratio;
356
+ }
357
+ const i = Math.floor(6 * h);
358
+ const v = 1 - bl;
359
+ f = 6 * h - i;
360
+ if ((i & 1) !== 0) f = 1 - f;
361
+ const n = wh + f * (v - wh);
362
+ let r;
363
+ let g;
364
+ let b;
365
+ switch (i) {
366
+ default:
367
+ case 6:
368
+ case 0:
369
+ r = v;
370
+ g = n;
371
+ b = wh;
372
+ break;
373
+ case 1:
374
+ r = n;
375
+ g = v;
376
+ b = wh;
377
+ break;
378
+ case 2:
379
+ r = wh;
380
+ g = v;
381
+ b = n;
382
+ break;
383
+ case 3:
384
+ r = wh;
385
+ g = n;
386
+ b = v;
387
+ break;
388
+ case 4:
389
+ r = n;
390
+ g = wh;
391
+ b = v;
392
+ break;
393
+ case 5:
394
+ r = v;
395
+ g = wh;
396
+ b = n;
397
+ break;
398
+ }
399
+ return [
400
+ r * 255,
401
+ g * 255,
402
+ b * 255
403
+ ];
404
+ };
405
+ convert.cmyk.rgb = function(cmyk) {
406
+ const c = cmyk[0] / 100;
407
+ const m = cmyk[1] / 100;
408
+ const y = cmyk[2] / 100;
409
+ const k = cmyk[3] / 100;
410
+ const r = 1 - Math.min(1, c * (1 - k) + k);
411
+ const g = 1 - Math.min(1, m * (1 - k) + k);
412
+ const b = 1 - Math.min(1, y * (1 - k) + k);
413
+ return [
414
+ r * 255,
415
+ g * 255,
416
+ b * 255
417
+ ];
418
+ };
419
+ convert.xyz.rgb = function(xyz) {
420
+ const x = xyz[0] / 100;
421
+ const y = xyz[1] / 100;
422
+ const z = xyz[2] / 100;
423
+ let r;
424
+ let g;
425
+ let b;
426
+ r = x * 3.2406 + y * -1.5372 + z * -.4986;
427
+ g = x * -.9689 + y * 1.8758 + z * .0415;
428
+ b = x * .0557 + y * -.204 + z * 1.057;
429
+ r = r > .0031308 ? 1.055 * r ** (1 / 2.4) - .055 : r * 12.92;
430
+ g = g > .0031308 ? 1.055 * g ** (1 / 2.4) - .055 : g * 12.92;
431
+ b = b > .0031308 ? 1.055 * b ** (1 / 2.4) - .055 : b * 12.92;
432
+ r = Math.min(Math.max(0, r), 1);
433
+ g = Math.min(Math.max(0, g), 1);
434
+ b = Math.min(Math.max(0, b), 1);
435
+ return [
436
+ r * 255,
437
+ g * 255,
438
+ b * 255
439
+ ];
440
+ };
441
+ convert.xyz.lab = function(xyz) {
442
+ let x = xyz[0];
443
+ let y = xyz[1];
444
+ let z = xyz[2];
445
+ x /= 95.047;
446
+ y /= 100;
447
+ z /= 108.883;
448
+ x = x > .008856 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
449
+ y = y > .008856 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
450
+ z = z > .008856 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
451
+ const l = 116 * y - 16;
452
+ const a = 500 * (x - y);
453
+ const b = 200 * (y - z);
454
+ return [
455
+ l,
456
+ a,
457
+ b
458
+ ];
459
+ };
460
+ convert.lab.xyz = function(lab) {
461
+ const l = lab[0];
462
+ const a = lab[1];
463
+ const b = lab[2];
464
+ let x;
465
+ let y;
466
+ let z;
467
+ y = (l + 16) / 116;
468
+ x = a / 500 + y;
469
+ z = y - b / 200;
470
+ const y2 = y ** 3;
471
+ const x2 = x ** 3;
472
+ const z2 = z ** 3;
473
+ y = y2 > .008856 ? y2 : (y - 16 / 116) / 7.787;
474
+ x = x2 > .008856 ? x2 : (x - 16 / 116) / 7.787;
475
+ z = z2 > .008856 ? z2 : (z - 16 / 116) / 7.787;
476
+ x *= 95.047;
477
+ y *= 100;
478
+ z *= 108.883;
479
+ return [
480
+ x,
481
+ y,
482
+ z
483
+ ];
484
+ };
485
+ convert.lab.lch = function(lab) {
486
+ const l = lab[0];
487
+ const a = lab[1];
488
+ const b = lab[2];
489
+ let h = Math.atan2(b, a) * 360 / 2 / Math.PI;
490
+ if (h < 0) h += 360;
491
+ const c = Math.sqrt(a * a + b * b);
492
+ return [
493
+ l,
494
+ c,
495
+ h
496
+ ];
497
+ };
498
+ convert.lch.lab = function(lch) {
499
+ const l = lch[0];
500
+ const c = lch[1];
501
+ const hr = lch[2] / 360 * 2 * Math.PI;
502
+ const a = c * Math.cos(hr);
503
+ const b = c * Math.sin(hr);
504
+ return [
505
+ l,
506
+ a,
507
+ b
508
+ ];
509
+ };
510
+ convert.rgb.ansi16 = function(args, saturation = null) {
511
+ const [r, g, b] = args;
512
+ let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation;
513
+ value = Math.round(value / 50);
514
+ if (value === 0) return 30;
515
+ let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
516
+ if (value === 2) ansi += 60;
517
+ return ansi;
518
+ };
519
+ convert.hsv.ansi16 = function(args) {
520
+ return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
521
+ };
522
+ convert.rgb.ansi256 = function(args) {
523
+ const r = args[0];
524
+ const g = args[1];
525
+ const b = args[2];
526
+ if (r === g && g === b) {
527
+ if (r < 8) return 16;
528
+ if (r > 248) return 231;
529
+ return Math.round((r - 8) / 247 * 24) + 232;
530
+ }
531
+ return 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
532
+ };
533
+ convert.ansi16.rgb = function(args) {
534
+ let color = args % 10;
535
+ if (color === 0 || color === 7) {
536
+ if (args > 50) color += 3.5;
537
+ color = color / 10.5 * 255;
538
+ return [
539
+ color,
540
+ color,
541
+ color
542
+ ];
543
+ }
544
+ const mult = (~~(args > 50) + 1) * .5;
545
+ const r = (color & 1) * mult * 255;
546
+ const g = (color >> 1 & 1) * mult * 255;
547
+ const b = (color >> 2 & 1) * mult * 255;
548
+ return [
549
+ r,
550
+ g,
551
+ b
552
+ ];
553
+ };
554
+ convert.ansi256.rgb = function(args) {
555
+ if (args >= 232) {
556
+ const c = (args - 232) * 10 + 8;
557
+ return [
558
+ c,
559
+ c,
560
+ c
561
+ ];
562
+ }
563
+ args -= 16;
564
+ let rem;
565
+ const r = Math.floor(args / 36) / 5 * 255;
566
+ const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
567
+ const b = rem % 6 / 5 * 255;
568
+ return [
569
+ r,
570
+ g,
571
+ b
572
+ ];
573
+ };
574
+ convert.rgb.hex = function(args) {
575
+ const string = (((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255)).toString(16).toUpperCase();
576
+ return "000000".substring(string.length) + string;
577
+ };
578
+ convert.hex.rgb = function(args) {
579
+ const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
580
+ if (!match) return [
581
+ 0,
582
+ 0,
583
+ 0
584
+ ];
585
+ let colorString = match[0];
586
+ if (match[0].length === 3) colorString = colorString.split("").map((char) => {
587
+ return char + char;
588
+ }).join("");
589
+ const integer = parseInt(colorString, 16);
590
+ const r = integer >> 16 & 255;
591
+ const g = integer >> 8 & 255;
592
+ const b = integer & 255;
593
+ return [
594
+ r,
595
+ g,
596
+ b
597
+ ];
598
+ };
599
+ convert.rgb.hcg = function(rgb) {
600
+ const r = rgb[0] / 255;
601
+ const g = rgb[1] / 255;
602
+ const b = rgb[2] / 255;
603
+ const max = Math.max(Math.max(r, g), b);
604
+ const min = Math.min(Math.min(r, g), b);
605
+ const chroma = max - min;
606
+ let grayscale;
607
+ let hue;
608
+ if (chroma < 1) grayscale = min / (1 - chroma);
609
+ else grayscale = 0;
610
+ if (chroma <= 0) hue = 0;
611
+ else if (max === r) hue = (g - b) / chroma % 6;
612
+ else if (max === g) hue = 2 + (b - r) / chroma;
613
+ else hue = 4 + (r - g) / chroma;
614
+ hue /= 6;
615
+ hue %= 1;
616
+ return [
617
+ hue * 360,
618
+ chroma * 100,
619
+ grayscale * 100
620
+ ];
621
+ };
622
+ convert.hsl.hcg = function(hsl) {
623
+ const s = hsl[1] / 100;
624
+ const l = hsl[2] / 100;
625
+ const c = l < .5 ? 2 * s * l : 2 * s * (1 - l);
626
+ let f = 0;
627
+ if (c < 1) f = (l - .5 * c) / (1 - c);
628
+ return [
629
+ hsl[0],
630
+ c * 100,
631
+ f * 100
632
+ ];
633
+ };
634
+ convert.hsv.hcg = function(hsv) {
635
+ const s = hsv[1] / 100;
636
+ const v = hsv[2] / 100;
637
+ const c = s * v;
638
+ let f = 0;
639
+ if (c < 1) f = (v - c) / (1 - c);
640
+ return [
641
+ hsv[0],
642
+ c * 100,
643
+ f * 100
644
+ ];
645
+ };
646
+ convert.hcg.rgb = function(hcg) {
647
+ const h = hcg[0] / 360;
648
+ const c = hcg[1] / 100;
649
+ const g = hcg[2] / 100;
650
+ if (c === 0) return [
651
+ g * 255,
652
+ g * 255,
653
+ g * 255
654
+ ];
655
+ const pure = [
656
+ 0,
657
+ 0,
658
+ 0
659
+ ];
660
+ const hi = h % 1 * 6;
661
+ const v = hi % 1;
662
+ const w = 1 - v;
663
+ let mg = 0;
664
+ switch (Math.floor(hi)) {
665
+ case 0:
666
+ pure[0] = 1;
667
+ pure[1] = v;
668
+ pure[2] = 0;
669
+ break;
670
+ case 1:
671
+ pure[0] = w;
672
+ pure[1] = 1;
673
+ pure[2] = 0;
674
+ break;
675
+ case 2:
676
+ pure[0] = 0;
677
+ pure[1] = 1;
678
+ pure[2] = v;
679
+ break;
680
+ case 3:
681
+ pure[0] = 0;
682
+ pure[1] = w;
683
+ pure[2] = 1;
684
+ break;
685
+ case 4:
686
+ pure[0] = v;
687
+ pure[1] = 0;
688
+ pure[2] = 1;
689
+ break;
690
+ default:
691
+ pure[0] = 1;
692
+ pure[1] = 0;
693
+ pure[2] = w;
694
+ }
695
+ mg = (1 - c) * g;
696
+ return [
697
+ (c * pure[0] + mg) * 255,
698
+ (c * pure[1] + mg) * 255,
699
+ (c * pure[2] + mg) * 255
700
+ ];
701
+ };
702
+ convert.hcg.hsv = function(hcg) {
703
+ const c = hcg[1] / 100;
704
+ const g = hcg[2] / 100;
705
+ const v = c + g * (1 - c);
706
+ let f = 0;
707
+ if (v > 0) f = c / v;
708
+ return [
709
+ hcg[0],
710
+ f * 100,
711
+ v * 100
712
+ ];
713
+ };
714
+ convert.hcg.hsl = function(hcg) {
715
+ const c = hcg[1] / 100;
716
+ const l = hcg[2] / 100 * (1 - c) + .5 * c;
717
+ let s = 0;
718
+ if (l > 0 && l < .5) s = c / (2 * l);
719
+ else if (l >= .5 && l < 1) s = c / (2 * (1 - l));
720
+ return [
721
+ hcg[0],
722
+ s * 100,
723
+ l * 100
724
+ ];
725
+ };
726
+ convert.hcg.hwb = function(hcg) {
727
+ const c = hcg[1] / 100;
728
+ const g = hcg[2] / 100;
729
+ const v = c + g * (1 - c);
730
+ return [
731
+ hcg[0],
732
+ (v - c) * 100,
733
+ (1 - v) * 100
734
+ ];
735
+ };
736
+ convert.hwb.hcg = function(hwb) {
737
+ const w = hwb[1] / 100;
738
+ const v = 1 - hwb[2] / 100;
739
+ const c = v - w;
740
+ let g = 0;
741
+ if (c < 1) g = (v - c) / (1 - c);
742
+ return [
743
+ hwb[0],
744
+ c * 100,
745
+ g * 100
746
+ ];
747
+ };
748
+ convert.apple.rgb = function(apple) {
749
+ return [
750
+ apple[0] / 65535 * 255,
751
+ apple[1] / 65535 * 255,
752
+ apple[2] / 65535 * 255
753
+ ];
754
+ };
755
+ convert.rgb.apple = function(rgb) {
756
+ return [
757
+ rgb[0] / 255 * 65535,
758
+ rgb[1] / 255 * 65535,
759
+ rgb[2] / 255 * 65535
760
+ ];
761
+ };
762
+ convert.gray.rgb = function(args) {
763
+ return [
764
+ args[0] / 100 * 255,
765
+ args[0] / 100 * 255,
766
+ args[0] / 100 * 255
767
+ ];
768
+ };
769
+ convert.gray.hsl = function(args) {
770
+ return [
771
+ 0,
772
+ 0,
773
+ args[0]
774
+ ];
775
+ };
776
+ convert.gray.hsv = convert.gray.hsl;
777
+ convert.gray.hwb = function(gray) {
778
+ return [
779
+ 0,
780
+ 100,
781
+ gray[0]
782
+ ];
783
+ };
784
+ convert.gray.cmyk = function(gray) {
785
+ return [
786
+ 0,
787
+ 0,
788
+ 0,
789
+ gray[0]
790
+ ];
791
+ };
792
+ convert.gray.lab = function(gray) {
793
+ return [
794
+ gray[0],
795
+ 0,
796
+ 0
797
+ ];
798
+ };
799
+ convert.gray.hex = function(gray) {
800
+ const val = Math.round(gray[0] / 100 * 255) & 255;
801
+ const string = ((val << 16) + (val << 8) + val).toString(16).toUpperCase();
802
+ return "000000".substring(string.length) + string;
803
+ };
804
+ convert.rgb.gray = function(rgb) {
805
+ return [(rgb[0] + rgb[1] + rgb[2]) / 3 / 255 * 100];
806
+ };
807
+ }) });
808
+
809
+ //#endregion
810
+ export default require_conversions();
811
+
812
+ export { require_conversions };