shaders 2.2.23 → 2.2.25

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 (213) hide show
  1. package/dist/core/AngularBlur-Dl2gwk68.js +64 -0
  2. package/dist/core/Ascii-Dha_QpT3.js +286 -0
  3. package/dist/core/Beam-CTN9Ni43.js +139 -0
  4. package/dist/core/Blob-CxFDZovO.js +218 -0
  5. package/dist/core/Blur-Y2FsmFk_.js +77 -0
  6. package/dist/core/Bulge-Cb-t0xqI.js +132 -0
  7. package/dist/core/CRTScreen-CtERsenz.js +112 -0
  8. package/dist/core/ChannelBlur-CvM6GJgZ.js +118 -0
  9. package/dist/core/Checkerboard-CgB-egNY.js +83 -0
  10. package/dist/core/ChromaFlow-vRCwhQpN.js +222 -0
  11. package/dist/core/ChromaticAberration-FTquTQIL.js +88 -0
  12. package/dist/core/Circle-Daziv5d7.js +67 -0
  13. package/dist/core/CursorTrail-Bsz9e6Fn.js +145 -0
  14. package/dist/core/DiffuseBlur-Cj2PtRNd.js +83 -0
  15. package/dist/core/Dither-D2Nf4p3w.js +66 -0
  16. package/dist/core/DotGrid-CzOwquo4.js +75 -0
  17. package/dist/core/Duotone-XuTN9tI7.js +65 -0
  18. package/dist/core/FilmGrain-D3-nbi12.js +28 -0
  19. package/dist/core/FloatingParticles-D9Nnu1qg.js +217 -0
  20. package/dist/core/GlassTiles-CnjCvajI.js +69 -0
  21. package/dist/core/Glow-BluFc9be.js +75 -0
  22. package/dist/core/Godrays-ChLh_vGl.js +144 -0
  23. package/dist/core/Grayscale-DRny75A9.js +20 -0
  24. package/dist/core/Grid-DgyDa4H1.js +58 -0
  25. package/dist/core/GridDistortion-BAspCYvp.js +188 -0
  26. package/dist/core/Group-Dul7PUBl.js +14 -0
  27. package/dist/core/Halftone-Ifv5F_FT.js +65 -0
  28. package/dist/core/HueShift-De8ukMWs.js +31 -0
  29. package/dist/core/ImageTexture-DvYcQgJB.js +143 -0
  30. package/dist/core/Invert-Fz0NtIJc.js +21 -0
  31. package/dist/core/LinearBlur-LmhnQoA4.js +62 -0
  32. package/dist/core/LinearGradient-xbloQjzt.js +133 -0
  33. package/dist/core/Liquify-DMe1V5-O.js +175 -0
  34. package/dist/core/Pixelate-Cv8537Pj.js +37 -0
  35. package/dist/core/PolarCoordinates-DDvDhBE-.js +112 -0
  36. package/dist/core/Posterize-3m3xkWOz.js +29 -0
  37. package/dist/core/ProgressiveBlur-EGkevObV.js +121 -0
  38. package/dist/core/RadialGradient-B7ZZB_VJ.js +71 -0
  39. package/dist/core/RectangularCoordinates-muWR8mZS.js +101 -0
  40. package/dist/core/Ripples-8XaZaXQF.js +117 -0
  41. package/dist/core/Saturation-CYFI1jzN.js +30 -0
  42. package/dist/core/SimplexNoise-DJUe0wz_.js +99 -0
  43. package/dist/core/SineWave-Dl3nFO1W.js +120 -0
  44. package/dist/core/SolidColor-CWGq_Bjq.js +21 -0
  45. package/dist/core/Spherize-C-jZEUsN.js +128 -0
  46. package/dist/core/Spiral-BSB_R39p.js +132 -0
  47. package/dist/core/Strands-0stO5BMy.js +161 -0
  48. package/dist/core/Stretch-B645paha.js +133 -0
  49. package/dist/core/Swirl-CVnbawit.js +173 -0
  50. package/dist/core/TiltShift-0CxNRI6L.js +134 -0
  51. package/dist/core/Tritone-Daa-I5UD.js +76 -0
  52. package/dist/core/Twirl-2CJVZEtk.js +96 -0
  53. package/dist/core/Vibrance-DRtecEvb.js +30 -0
  54. package/dist/core/WaveDistortion-BscXN2rs.js +173 -0
  55. package/dist/core/ZoomBlur-CAqK0Kju.js +62 -0
  56. package/dist/core/colorMixing-BXiTAqJU.js +69 -0
  57. package/dist/core/edges-Bn_OIa_h.js +26 -0
  58. package/dist/core/index.js +2257 -1604
  59. package/dist/core/shaderRegistry.d.ts.map +1 -1
  60. package/dist/core/shaders/AngularBlur/index.js +3 -7
  61. package/dist/core/shaders/Ascii/index.js +2 -6
  62. package/dist/core/shaders/Beam/index.d.ts +71 -0
  63. package/dist/core/shaders/Beam/index.d.ts.map +1 -0
  64. package/dist/core/shaders/Beam/index.js +4 -0
  65. package/dist/core/shaders/Blob/index.js +5 -9
  66. package/dist/core/shaders/Blur/index.js +2 -6
  67. package/dist/core/shaders/Bulge/index.js +4 -8
  68. package/dist/core/shaders/CRTScreen/index.js +2 -6
  69. package/dist/core/shaders/ChannelBlur/index.js +2 -6
  70. package/dist/core/shaders/Checkerboard/index.js +4 -8
  71. package/dist/core/shaders/ChromaFlow/index.js +3 -7
  72. package/dist/core/shaders/ChromaticAberration/index.js +3 -7
  73. package/dist/core/shaders/Circle/index.js +3 -7
  74. package/dist/core/shaders/CursorTrail/index.js +4 -8
  75. package/dist/core/shaders/DiffuseBlur/index.js +4 -8
  76. package/dist/core/shaders/Dither/index.js +3 -7
  77. package/dist/core/shaders/DotGrid/index.js +3 -7
  78. package/dist/core/shaders/Duotone/index.js +4 -8
  79. package/dist/core/shaders/FilmGrain/index.js +2 -6
  80. package/dist/core/shaders/FloatingParticles/index.js +3 -7
  81. package/dist/core/shaders/GlassTiles/index.js +2 -6
  82. package/dist/core/shaders/Glow/index.js +2 -6
  83. package/dist/core/shaders/Godrays/index.js +3 -7
  84. package/dist/core/shaders/Grayscale/index.js +2 -8
  85. package/dist/core/shaders/Grid/index.js +3 -7
  86. package/dist/core/shaders/GridDistortion/index.js +4 -8
  87. package/dist/core/shaders/Group/index.js +2 -6
  88. package/dist/core/shaders/Halftone/index.js +3 -7
  89. package/dist/core/shaders/HueShift/index.js +2 -8
  90. package/dist/core/shaders/ImageTexture/index.js +2 -6
  91. package/dist/core/shaders/Invert/index.js +2 -6
  92. package/dist/core/shaders/LinearBlur/index.js +3 -7
  93. package/dist/core/shaders/LinearGradient/index.js +4 -8
  94. package/dist/core/shaders/Liquify/index.js +4 -8
  95. package/dist/core/shaders/Pixelate/index.js +2 -6
  96. package/dist/core/shaders/PolarCoordinates/index.js +4 -8
  97. package/dist/core/shaders/Posterize/index.js +2 -7
  98. package/dist/core/shaders/ProgressiveBlur/index.js +3 -7
  99. package/dist/core/shaders/RadialGradient/index.js +4 -8
  100. package/dist/core/shaders/RectangularCoordinates/index.js +4 -8
  101. package/dist/core/shaders/Ripples/index.js +5 -9
  102. package/dist/core/shaders/Saturation/index.js +2 -8
  103. package/dist/core/shaders/SimplexNoise/index.js +5 -9
  104. package/dist/core/shaders/SineWave/index.js +3 -7
  105. package/dist/core/shaders/SolidColor/index.js +3 -7
  106. package/dist/core/shaders/Spherize/index.js +3 -7
  107. package/dist/core/shaders/Spiral/index.js +4 -8
  108. package/dist/core/shaders/Strands/index.js +4 -8
  109. package/dist/core/shaders/Stretch/index.js +4 -8
  110. package/dist/core/shaders/Swirl/index.js +5 -9
  111. package/dist/core/shaders/TiltShift/index.js +3 -7
  112. package/dist/core/shaders/Tritone/index.js +4 -8
  113. package/dist/core/shaders/Twirl/index.js +4 -8
  114. package/dist/core/shaders/Vibrance/index.js +2 -8
  115. package/dist/core/shaders/WaveDistortion/index.js +4 -8
  116. package/dist/core/shaders/ZoomBlur/index.js +3 -7
  117. package/dist/core/telemetry/index.js +189 -157
  118. package/dist/core/time-CTJvRUZ4.js +10 -0
  119. package/dist/core/transformations-DxfQXZWi.js +4715 -0
  120. package/dist/react/components/Beam.d.ts +31 -0
  121. package/dist/react/components/Beam.d.ts.map +1 -0
  122. package/dist/react/generatePresetCode-CCibXbtZ.js +645 -0
  123. package/dist/react/index.d.ts +1 -0
  124. package/dist/react/index.d.ts.map +1 -1
  125. package/dist/react/index.js +7649 -104600
  126. package/dist/react/utils/generatePresetCode.d.ts.map +1 -1
  127. package/dist/react/utils/generatePresetCode.js +2 -5
  128. package/dist/registry.js +224 -0
  129. package/dist/solid/components/Beam.d.ts +28 -0
  130. package/dist/solid/components/Beam.d.ts.map +1 -0
  131. package/dist/solid/index.d.ts +1 -0
  132. package/dist/solid/index.d.ts.map +1 -1
  133. package/dist/solid/index.js +6691 -102524
  134. package/dist/solid/utils/generatePresetCode.d.ts.map +1 -1
  135. package/dist/solid/utils/generatePresetCode.js +586 -537
  136. package/dist/svelte/components/Beam.svelte.d.ts +19 -0
  137. package/dist/svelte/generatePresetCode-CymgoDq_.js +645 -0
  138. package/dist/svelte/index.d.ts +1 -0
  139. package/dist/svelte/index.js +6175 -102455
  140. package/dist/svelte/utils/generatePresetCode.js +2 -5
  141. package/dist/vue/components/Beam.vue.d.ts +57 -0
  142. package/dist/vue/components/Beam.vue.d.ts.map +1 -0
  143. package/dist/vue/generatePresetCode-CRJmU8iF.js +649 -0
  144. package/dist/vue/index.d.ts +1 -0
  145. package/dist/vue/index.d.ts.map +1 -1
  146. package/dist/vue/index.js +6929 -103492
  147. package/dist/vue/utils/generatePresetCode.d.ts.map +1 -1
  148. package/dist/vue/utils/generatePresetCode.js +2 -5
  149. package/package.json +12 -1
  150. package/dist/core/AngularBlur-ClvtyURQ.js +0 -56
  151. package/dist/core/Ascii-BT0-K_vw.js +0 -196
  152. package/dist/core/Blob-BlQ_1T_8.js +0 -169
  153. package/dist/core/Blur-421AjWLH.js +0 -64
  154. package/dist/core/Bulge-CZRVoR6C.js +0 -103
  155. package/dist/core/CRTScreen-C_U9g_IR.js +0 -91
  156. package/dist/core/ChannelBlur-5pzcB6Zv.js +0 -89
  157. package/dist/core/Checkerboard-CrQkqXhD.js +0 -75
  158. package/dist/core/ChromaFlow-CNrQdL8f.js +0 -134
  159. package/dist/core/ChromaticAberration-D9H7O17Y.js +0 -82
  160. package/dist/core/Circle-DnLaDn8V.js +0 -62
  161. package/dist/core/ColorAdjustment-CKwpE_4M.js +0 -14
  162. package/dist/core/CursorTrail-NY6n97VG.js +0 -105
  163. package/dist/core/DiffuseBlur-C_n01ABk.js +0 -69
  164. package/dist/core/Dither-4s-c4zh4.js +0 -61
  165. package/dist/core/DotGrid-BYl8XdMi.js +0 -61
  166. package/dist/core/Duotone-DbewOoB4.js +0 -66
  167. package/dist/core/FilmGrain-zA_-knOw.js +0 -28
  168. package/dist/core/FloatingParticles-BhVnqMsE.js +0 -160
  169. package/dist/core/GlassTiles-CFI57glh.js +0 -52
  170. package/dist/core/Glow-CQgl3IoS.js +0 -66
  171. package/dist/core/Godrays-BHMix_Bh.js +0 -105
  172. package/dist/core/Grayscale-CAEFLteL.js +0 -21
  173. package/dist/core/Grid-DlM-rVbZ.js +0 -50
  174. package/dist/core/GridDistortion-ZOZphSAT.js +0 -147
  175. package/dist/core/Group-BQAs3RiH.js +0 -17
  176. package/dist/core/Halftone-ci4ga-_J.js +0 -55
  177. package/dist/core/HueShift-CyxzPcJV.js +0 -32
  178. package/dist/core/ImageTexture-CdAGsPuH.js +0 -105
  179. package/dist/core/Invert-iPsiIqNZ.js +0 -20
  180. package/dist/core/LinearBlur-BEaaoIk-.js +0 -56
  181. package/dist/core/LinearGradient-DR_7RxLX.js +0 -111
  182. package/dist/core/Liquify-Bi02_ugh.js +0 -139
  183. package/dist/core/Pixelate-CSsdT1rr.js +0 -38
  184. package/dist/core/PolarCoordinates-D626ml58.js +0 -103
  185. package/dist/core/Posterize-DhZkMaC7.js +0 -46
  186. package/dist/core/ProgressiveBlur-CGtCfLF8.js +0 -102
  187. package/dist/core/RadialGradient-C0_WzmbH.js +0 -71
  188. package/dist/core/RectangularCoordinates-DfXw7fhI.js +0 -92
  189. package/dist/core/Ripples-DkemN3eh.js +0 -106
  190. package/dist/core/Saturation-Dup81Pnq.js +0 -31
  191. package/dist/core/SimplexNoise-BYEiCjDj.js +0 -94
  192. package/dist/core/SineWave-C6MRPtsy.js +0 -107
  193. package/dist/core/SolidColor-BZHRczgb.js +0 -22
  194. package/dist/core/Spherize-DOAnDx2l.js +0 -103
  195. package/dist/core/Spiral-BMjnWXh1.js +0 -115
  196. package/dist/core/Strands-BOVsuJLe.js +0 -125
  197. package/dist/core/Stretch-D6bHc6yp.js +0 -103
  198. package/dist/core/Swirl-BFoc0ImG.js +0 -148
  199. package/dist/core/TSLBase-BFMvTOak.js +0 -8053
  200. package/dist/core/TiltShift-BiNvvhzj.js +0 -114
  201. package/dist/core/Tritone-gdx2AA0m.js +0 -75
  202. package/dist/core/Twirl-BsV8YbqC.js +0 -82
  203. package/dist/core/Vibrance-C182fbSw.js +0 -31
  204. package/dist/core/WaveDistortion-CmaS2zDB.js +0 -132
  205. package/dist/core/ZoomBlur-DLf5xQ16.js +0 -56
  206. package/dist/core/colorMixing--dhzx0ch.js +0 -21
  207. package/dist/core/edges-CDzKsauJ.js +0 -15
  208. package/dist/core/three.tsl-Btj1hLsf.js +0 -43845
  209. package/dist/core/time-DbRMw6Jm.js +0 -10
  210. package/dist/core/transformations-CsrIJXh-.js +0 -3992
  211. package/dist/react/generatePresetCode-DaS7jkcT.js +0 -626
  212. package/dist/svelte/generatePresetCode-DaS7jkcT.js +0 -626
  213. package/dist/vue/generatePresetCode-Cd1B-Y9j.js +0 -632
@@ -1,3992 +0,0 @@
1
- import { O as Ur } from "./three.tsl-Btj1hLsf.js";
2
- import { Vector2 as Kr, Vector4 as Vr } from "three";
3
- function w(e, t) {
4
- let r = e.length;
5
- Array.isArray(e[0]) || (e = [e]), Array.isArray(t[0]) || (t = t.map((i) => [i]));
6
- let a = t[0].length, n = t[0].map((i, o) => t.map((l) => l[o])), s = e.map((i) => n.map((o) => {
7
- let l = 0;
8
- if (!Array.isArray(i)) {
9
- for (let c of o) l += i * c;
10
- return l;
11
- }
12
- for (let c = 0; c < i.length; c++) l += i[c] * (o[c] || 0);
13
- return l;
14
- }));
15
- return r === 1 && (s = s[0]), a === 1 ? s.map((i) => i[0]) : s;
16
- }
17
- function ce(e) {
18
- return Y(e) === "string";
19
- }
20
- function Y(e) {
21
- return (Object.prototype.toString.call(e).match(/^\[object\s+(.*?)\]$/)[1] || "").toLowerCase();
22
- }
23
- function Se(e, { precision: t, unit: r }) {
24
- return q(e) ? "none" : ur(e, t) + (r ?? "");
25
- }
26
- function q(e) {
27
- return Number.isNaN(e) || e instanceof Number && e?.none;
28
- }
29
- function C(e) {
30
- return q(e) ? 0 : e;
31
- }
32
- function ur(e, t) {
33
- if (e === 0) return 0;
34
- let r = ~~e, a = 0;
35
- r && t && (a = ~~Math.log10(Math.abs(r)) + 1);
36
- const n = 10 ** (t - a);
37
- return Math.floor(e * n + 0.5) / n;
38
- }
39
- var ea = {
40
- deg: 1,
41
- grad: 0.9,
42
- rad: 180 / Math.PI,
43
- turn: 360
44
- };
45
- function fr(e) {
46
- if (!e) return;
47
- e = e.trim();
48
- const t = /^([a-z]+)\((.+?)\)$/i, r = /^-?[\d.]+$/, a = /%|deg|g?rad|turn$/, n = /\/?\s*(none|[-\w.]+(?:%|deg|g?rad|turn)?)/g;
49
- let s = e.match(t);
50
- if (s) {
51
- let i = [];
52
- return s[2].replace(n, (o, l) => {
53
- let c = l.match(a), u = l;
54
- if (c) {
55
- let f = c[0], h = u.slice(0, -f.length);
56
- f === "%" ? (u = /* @__PURE__ */ new Number(h / 100), u.type = "<percentage>") : (u = new Number(h * ea[f]), u.type = "<angle>", u.unit = f);
57
- } else r.test(u) ? (u = new Number(u), u.type = "<number>") : u === "none" && (u = /* @__PURE__ */ new Number(NaN), u.none = !0);
58
- o.startsWith("/") && (u = u instanceof Number ? u : new Number(u), u.alpha = !0), typeof u == "object" && u instanceof Number && (u.raw = l), i.push(u);
59
- }), {
60
- name: s[1].toLowerCase(),
61
- rawName: s[1],
62
- rawArgs: s[2],
63
- args: i
64
- };
65
- }
66
- }
67
- function cr(e) {
68
- return e[e.length - 1];
69
- }
70
- function le(e, t, r) {
71
- return isNaN(e) ? t : isNaN(t) ? e : e + (t - e) * r;
72
- }
73
- function hr(e, t, r) {
74
- return (r - e) / (t - e);
75
- }
76
- function Ke(e, t, r) {
77
- return le(t[0], t[1], hr(e[0], e[1], r));
78
- }
79
- function dr(e) {
80
- return e.map((t) => t.split("|").map((r) => {
81
- r = r.trim();
82
- let a = r.match(/^(<[a-z]+>)\[(-?[.\d]+),\s*(-?[.\d]+)\]?$/);
83
- if (a) {
84
- let n = new String(a[1]);
85
- return n.range = [+a[2], +a[3]], n;
86
- }
87
- return r;
88
- }));
89
- }
90
- function mr(e, t, r) {
91
- return Math.max(Math.min(r, t), e);
92
- }
93
- function Ne(e, t) {
94
- return Math.sign(e) === Math.sign(t) ? e : -e;
95
- }
96
- function $(e, t) {
97
- return Ne(Math.abs(e) ** t, e);
98
- }
99
- function Ve(e, t) {
100
- return t === 0 ? 0 : e / t;
101
- }
102
- function gr(e, t, r = 0, a = e.length) {
103
- for (; r < a; ) {
104
- const n = r + a >> 1;
105
- e[n] < t ? r = n + 1 : a = n;
106
- }
107
- return r;
108
- }
109
- var ta = /* @__PURE__ */ Object.freeze({
110
- __proto__: null,
111
- bisectLeft: gr,
112
- clamp: mr,
113
- copySign: Ne,
114
- interpolate: le,
115
- interpolateInv: hr,
116
- isNone: q,
117
- isString: ce,
118
- last: cr,
119
- mapRange: Ke,
120
- multiplyMatrices: w,
121
- parseCoordGrammar: dr,
122
- parseFunction: fr,
123
- serializeNumber: Se,
124
- skipNone: C,
125
- spow: $,
126
- toPrecision: ur,
127
- type: Y,
128
- zdiv: Ve
129
- }), ra = class {
130
- add(e, t, r) {
131
- if (typeof arguments[0] != "string") {
132
- for (var e in arguments[0]) this.add(e, arguments[0][e], arguments[1]);
133
- return;
134
- }
135
- (Array.isArray(e) ? e : [e]).forEach(function(a) {
136
- this[a] = this[a] || [], t && this[a][r ? "unshift" : "push"](t);
137
- }, this);
138
- }
139
- run(e, t) {
140
- this[e] = this[e] || [], this[e].forEach(function(r) {
141
- r.call(t && t.context ? t.context : t, t);
142
- });
143
- }
144
- }, G = new ra(), E = {
145
- gamut_mapping: "css",
146
- precision: 5,
147
- deltaE: "76",
148
- verbose: globalThis?.process?.env?.NODE_ENV?.toLowerCase() !== "test",
149
- warn: function(t) {
150
- this.verbose && globalThis?.console?.warn?.(t);
151
- }
152
- }, L = {
153
- D50: [
154
- 0.3457 / 0.3585,
155
- 1,
156
- 0.2958 / 0.3585
157
- ],
158
- D65: [
159
- 0.3127 / 0.329,
160
- 1,
161
- 0.3583 / 0.329
162
- ]
163
- };
164
- function Ge(e) {
165
- return Array.isArray(e) ? e : L[e];
166
- }
167
- function Le(e, t, r, a = {}) {
168
- if (e = Ge(e), t = Ge(t), !e || !t) throw new TypeError(`Missing white point to convert ${e ? "" : "from"}${!e && !t ? "/" : ""}${t ? "" : "to"}`);
169
- if (e === t) return r;
170
- let n = {
171
- W1: e,
172
- W2: t,
173
- XYZ: r,
174
- options: a
175
- };
176
- if (G.run("chromatic-adaptation-start", n), n.M || (n.W1 === L.D65 && n.W2 === L.D50 ? n.M = [
177
- [
178
- 1.0479297925449969,
179
- 0.022946870601609652,
180
- -0.05019226628920524
181
- ],
182
- [
183
- 0.02962780877005599,
184
- 0.9904344267538799,
185
- -0.017073799063418826
186
- ],
187
- [
188
- -0.009243040646204504,
189
- 0.015055191490298152,
190
- 0.7518742814281371
191
- ]
192
- ] : n.W1 === L.D50 && n.W2 === L.D65 && (n.M = [
193
- [
194
- 0.955473421488075,
195
- -0.02309845494876471,
196
- 0.06325924320057072
197
- ],
198
- [
199
- -0.0283697093338637,
200
- 1.0099953980813041,
201
- 0.021041441191917323
202
- ],
203
- [
204
- 0.012314014864481998,
205
- -0.020507649298898964,
206
- 1.330365926242124
207
- ]
208
- ])), G.run("chromatic-adaptation-end", n), n.M) return w(n.M, n.XYZ);
209
- throw new TypeError("Only Bradford CAT with white points D50 and D65 supported for now.");
210
- }
211
- var aa = /* @__PURE__ */ new Set([
212
- "<number>",
213
- "<percentage>",
214
- "<angle>"
215
- ]);
216
- function ht(e, t, r, a) {
217
- return Object.entries(e.coords).map(([n, s], i) => {
218
- let o = t.coordGrammar[i], l = a[i], c = l?.type, u;
219
- if (l.none ? u = o.find((m) => aa.has(m)) : u = o.find((m) => m == c), !u) {
220
- let m = s.name || n;
221
- throw new TypeError(`${c ?? l.raw} not allowed for ${m} in ${r}()`);
222
- }
223
- let f = u.range;
224
- c === "<percentage>" && (f ||= [0, 1]);
225
- let h = s.range || s.refRange;
226
- return f && h && (a[i] = Ke(f, h, a[i])), u;
227
- });
228
- }
229
- function pr(e, { meta: t } = {}) {
230
- let r = { str: String(e)?.trim() };
231
- if (G.run("parse-start", r), r.color) return r.color;
232
- if (r.parsed = fr(r.str), r.parsed) {
233
- let a = r.parsed.name;
234
- if (a === "color") {
235
- let n = r.parsed.args.shift(), s = n.startsWith("--") ? n.substring(2) : `--${n}`, i = [n, s], o = r.parsed.rawArgs.indexOf("/") > 0 ? r.parsed.args.pop() : 1;
236
- for (let u of d.all) {
237
- let f = u.getFormat("color");
238
- if (f && (i.includes(f.id) || f.ids?.filter((h) => i.includes(h)).length)) {
239
- const h = Object.keys(u.coords).map((p, b) => r.parsed.args[b] || 0);
240
- let m;
241
- return f.coordGrammar && (m = ht(u, f, "color", h)), t && Object.assign(t, {
242
- formatId: "color",
243
- types: m
244
- }), f.id.startsWith("--") && !n.startsWith("--") && E.warn(`${u.name} is a non-standard space and not currently supported in the CSS spec. Use prefixed color(${f.id}) instead of color(${n}).`), n.startsWith("--") && !f.id.startsWith("--") && E.warn(`${u.name} is a standard space and supported in the CSS spec. Use color(${f.id}) instead of prefixed color(${n}).`), {
245
- spaceId: u.id,
246
- coords: h,
247
- alpha: o
248
- };
249
- }
250
- }
251
- let l = "", c = n in d.registry ? n : s;
252
- if (c in d.registry) {
253
- let u = d.registry[c].formats?.color?.id;
254
- u && (l = `Did you mean color(${u})?`);
255
- }
256
- throw new TypeError(`Cannot parse color(${n}). ` + (l || "Missing a plugin?"));
257
- } else for (let n of d.all) {
258
- let s = n.getFormat(a);
259
- if (s && s.type === "function") {
260
- let i = 1;
261
- (s.lastAlpha || cr(r.parsed.args).alpha) && (i = r.parsed.args.pop());
262
- let o = r.parsed.args, l;
263
- return s.coordGrammar && (l = ht(n, s, a, o)), t && Object.assign(t, {
264
- formatId: s.name,
265
- types: l
266
- }), {
267
- spaceId: n.id,
268
- coords: o,
269
- alpha: i
270
- };
271
- }
272
- }
273
- } else for (let a of d.all) for (let n in a.formats) {
274
- let s = a.formats[n];
275
- if (s.type !== "custom" || s.test && !s.test(r.str)) continue;
276
- let i = s.parse(r.str);
277
- if (i)
278
- return i.alpha ??= 1, t && (t.formatId = n), i;
279
- }
280
- throw new TypeError(`Could not parse ${e} as a color. Missing a plugin?`);
281
- }
282
- function g(e) {
283
- if (Array.isArray(e)) return e.map(g);
284
- if (!e) throw new TypeError("Empty color reference");
285
- ce(e) && (e = pr(e));
286
- let t = e.space || e.spaceId;
287
- return t instanceof d || (e.space = d.get(t)), e.alpha === void 0 && (e.alpha = 1), e;
288
- }
289
- var na = 75e-6, d = class A {
290
- constructor(t) {
291
- this.id = t.id, this.name = t.name, this.base = t.base ? A.get(t.base) : null, this.aliases = t.aliases, this.base && (this.fromBase = t.fromBase, this.toBase = t.toBase);
292
- let r = t.coords ?? this.base.coords;
293
- for (let a in r) "name" in r[a] || (r[a].name = a);
294
- this.coords = r, this.white = Ge(t.white ?? this.base.white ?? "D65"), this.formats = t.formats ?? {};
295
- for (let a in this.formats) {
296
- let n = this.formats[a];
297
- n.type ||= "function", n.name ||= a;
298
- }
299
- this.formats.color?.id || (this.formats.color = {
300
- ...this.formats.color ?? {},
301
- id: t.cssId || this.id
302
- }), t.gamutSpace ? this.gamutSpace = t.gamutSpace === "self" ? this : A.get(t.gamutSpace) : this.isPolar ? this.gamutSpace = this.base : this.gamutSpace = this, this.gamutSpace.isUnbounded && (this.inGamut = (a, n) => !0), this.referred = t.referred, Object.defineProperty(this, "path", {
303
- value: sa(this).reverse(),
304
- writable: !1,
305
- enumerable: !0,
306
- configurable: !0
307
- }), G.run("colorspace-init-end", this);
308
- }
309
- inGamut(t, { epsilon: r = na } = {}) {
310
- if (!this.equals(this.gamutSpace))
311
- return t = this.to(this.gamutSpace, t), this.gamutSpace.inGamut(t, { epsilon: r });
312
- let a = Object.values(this.coords);
313
- return t.every((n, s) => {
314
- let i = a[s];
315
- if (i.type !== "angle" && i.range) {
316
- if (Number.isNaN(n)) return !0;
317
- let [o, l] = i.range;
318
- return (o === void 0 || n >= o - r) && (l === void 0 || n <= l + r);
319
- }
320
- return !0;
321
- });
322
- }
323
- get isUnbounded() {
324
- return Object.values(this.coords).every((t) => !("range" in t));
325
- }
326
- get cssId() {
327
- return this.formats?.color?.id || this.id;
328
- }
329
- get isPolar() {
330
- for (let t in this.coords) if (this.coords[t].type === "angle") return !0;
331
- return !1;
332
- }
333
- getFormat(t) {
334
- if (typeof t == "object")
335
- return t = dt(t, this), t;
336
- let r;
337
- return t === "default" ? r = Object.values(this.formats)[0] : r = this.formats[t], r ? (r = dt(r, this), r) : null;
338
- }
339
- /**
340
- * Check if this color space is the same as another color space reference.
341
- * Allows proxying color space objects and comparing color spaces with ids.
342
- * @param {string | ColorSpace} space ColorSpace object or id to compare to
343
- * @returns {boolean}
344
- */
345
- equals(t) {
346
- return t ? this === t || this.id === t || this.id === t.id : !1;
347
- }
348
- to(t, r) {
349
- if (arguments.length === 1) {
350
- const o = g(t);
351
- [t, r] = [o.space, o.coords];
352
- }
353
- if (t = A.get(t), this.equals(t)) return r;
354
- r = r.map((o) => Number.isNaN(o) ? 0 : o);
355
- let a = this.path, n = t.path, s, i;
356
- for (let o = 0; o < a.length && a[o].equals(n[o]); o++) s = a[o], i = o;
357
- if (!s) throw new Error(`Cannot convert between color spaces ${this} and ${t}: no connection space was found`);
358
- for (let o = a.length - 1; o > i; o--) r = a[o].toBase(r);
359
- for (let o = i + 1; o < n.length; o++) r = n[o].fromBase(r);
360
- return r;
361
- }
362
- from(t, r) {
363
- if (arguments.length === 1) {
364
- const a = g(t);
365
- [t, r] = [a.space, a.coords];
366
- }
367
- return t = A.get(t), t.to(this, r);
368
- }
369
- toString() {
370
- return `${this.name} (${this.id})`;
371
- }
372
- getMinCoords() {
373
- let t = [];
374
- for (let r in this.coords) {
375
- let a = this.coords[r], n = a.range || a.refRange;
376
- t.push(n?.min ?? 0);
377
- }
378
- return t;
379
- }
380
- static registry = {};
381
- static get all() {
382
- return [...new Set(Object.values(A.registry))];
383
- }
384
- static register(t, r) {
385
- if (arguments.length === 1 && (r = arguments[0], t = r.id), r = this.get(r), this.registry[t] && this.registry[t] !== r) throw new Error(`Duplicate color space registration: '${t}'`);
386
- if (this.registry[t] = r, arguments.length === 1 && r.aliases) for (let a of r.aliases) this.register(a, r);
387
- return r;
388
- }
389
- /**
390
- * Lookup ColorSpace object by name
391
- * @param {ColorSpace | string} name
392
- */
393
- static get(t, ...r) {
394
- if (!t || t instanceof A) return t;
395
- if (Y(t) === "string") {
396
- let a = A.registry[t.toLowerCase()];
397
- if (!a) throw new TypeError(`No color space found with id = "${t}"`);
398
- return a;
399
- }
400
- if (r.length) return A.get(...r);
401
- throw new TypeError(`${t} is not a valid color space`);
402
- }
403
- /**
404
- * Get metadata about a coordinate of a color space
405
- *
406
- * @static
407
- * @param {Array | string} ref
408
- * @param {ColorSpace | string} [workingSpace]
409
- * @return {Object}
410
- */
411
- static resolveCoord(t, r) {
412
- let a = Y(t), n, s;
413
- if (a === "string" ? t.includes(".") ? [n, s] = t.split(".") : [n, s] = [, t] : Array.isArray(t) ? [n, s] = t : (n = t.space, s = t.coordId), n = A.get(n), n || (n = r), !n) throw new TypeError(`Cannot resolve coordinate reference ${t}: No color space specified and relative references are not allowed here`);
414
- if (a = Y(s), a === "number" || a === "string" && s >= 0) {
415
- let l = Object.entries(n.coords)[s];
416
- if (l) return {
417
- space: n,
418
- id: l[0],
419
- index: s,
420
- ...l[1]
421
- };
422
- }
423
- n = A.get(n);
424
- let i = s.toLowerCase(), o = 0;
425
- for (let l in n.coords) {
426
- let c = n.coords[l];
427
- if (l.toLowerCase() === i || c.name?.toLowerCase() === i) return {
428
- space: n,
429
- id: l,
430
- index: o,
431
- ...c
432
- };
433
- o++;
434
- }
435
- throw new TypeError(`No "${s}" coordinate found in ${n.name}. Its coordinates are: ${Object.keys(n.coords).join(", ")}`);
436
- }
437
- static DEFAULT_FORMAT = {
438
- type: "functions",
439
- name: "color"
440
- };
441
- };
442
- function sa(e) {
443
- let t = [e];
444
- for (let r = e; r = r.base; ) t.push(r);
445
- return t;
446
- }
447
- function dt(e, { coords: t } = {}) {
448
- if (e.coords && !e.coordGrammar) {
449
- e.type ||= "function", e.name ||= "color", e.coordGrammar = dr(e.coords);
450
- let r = Object.entries(t).map(([a, n], s) => {
451
- let i = e.coordGrammar[s][0], o = n.range || n.refRange, l = i.range, c = "";
452
- return i == "<percentage>" ? (l = [0, 100], c = "%") : i == "<angle>" && (c = "deg"), {
453
- fromRange: o,
454
- toRange: l,
455
- suffix: c
456
- };
457
- });
458
- e.serializeCoords = (a, n) => a.map((s, i) => {
459
- let { fromRange: o, toRange: l, suffix: c } = r[i];
460
- return o && l && (s = Ke(o, l, s)), s = Se(s, {
461
- precision: n,
462
- unit: c
463
- }), s;
464
- });
465
- }
466
- return e;
467
- }
468
- var S = new d({
469
- id: "xyz-d65",
470
- name: "XYZ D65",
471
- coords: {
472
- x: { name: "X" },
473
- y: { name: "Y" },
474
- z: { name: "Z" }
475
- },
476
- white: "D65",
477
- formats: { color: { ids: ["xyz-d65", "xyz"] } },
478
- aliases: ["xyz"]
479
- }), I = class extends d {
480
- /**
481
- * Creates a new RGB ColorSpace.
482
- * If coords are not specified, they will use the default RGB coords.
483
- * Instead of `fromBase()` and `toBase()` functions,
484
- * you can specify to/from XYZ matrices and have `toBase()` and `fromBase()` automatically generated.
485
- * @param {*} options - Same options as {@link ColorSpace} plus:
486
- * @param {number[][]} options.toXYZ_M - Matrix to convert to XYZ
487
- * @param {number[][]} options.fromXYZ_M - Matrix to convert from XYZ
488
- */
489
- constructor(e) {
490
- e.coords || (e.coords = {
491
- r: {
492
- range: [0, 1],
493
- name: "Red"
494
- },
495
- g: {
496
- range: [0, 1],
497
- name: "Green"
498
- },
499
- b: {
500
- range: [0, 1],
501
- name: "Blue"
502
- }
503
- }), e.base || (e.base = S), e.toXYZ_M && e.fromXYZ_M && (e.toBase ??= (t) => {
504
- let r = w(e.toXYZ_M, t);
505
- return this.white !== this.base.white && (r = Le(this.white, this.base.white, r)), r;
506
- }, e.fromBase ??= (t) => (t = Le(this.base.white, this.white, t), w(e.fromXYZ_M, t))), e.referred ??= "display", super(e);
507
- }
508
- };
509
- function he(e, t) {
510
- return e = g(e), !t || e.space.equals(t) ? e.coords.slice() : (t = d.get(t), t.from(e));
511
- }
512
- function N(e, t) {
513
- e = g(e);
514
- let { space: r, index: a } = d.resolveCoord(t, e.space);
515
- return he(e, r)[a];
516
- }
517
- function et(e, t, r) {
518
- return e = g(e), t = d.get(t), e.coords = t.to(e.space, r), e;
519
- }
520
- et.returns = "color";
521
- function T(e, t, r) {
522
- if (e = g(e), arguments.length === 2 && Y(arguments[1]) === "object") {
523
- let a = arguments[1];
524
- for (let n in a) T(e, n, a[n]);
525
- } else {
526
- typeof r == "function" && (r = r(N(e, t)));
527
- let { space: a, index: n } = d.resolveCoord(t, e.space), s = he(e, a);
528
- s[n] = r, et(e, a, s);
529
- }
530
- return e;
531
- }
532
- T.returns = "color";
533
- var tt = new d({
534
- id: "xyz-d50",
535
- name: "XYZ D50",
536
- white: "D50",
537
- base: S,
538
- fromBase: (e) => Le(S.white, "D50", e),
539
- toBase: (e) => Le("D50", S.white, e)
540
- }), ia = 216 / 24389, mt = 24 / 116, pe = 24389 / 27, Ae = L.D50, x = new d({
541
- id: "lab",
542
- name: "Lab",
543
- coords: {
544
- l: {
545
- refRange: [0, 100],
546
- name: "Lightness"
547
- },
548
- a: { refRange: [-125, 125] },
549
- b: { refRange: [-125, 125] }
550
- },
551
- white: Ae,
552
- base: tt,
553
- fromBase(e) {
554
- let t = e.map((r, a) => r / Ae[a]).map((r) => r > ia ? Math.cbrt(r) : (pe * r + 16) / 116);
555
- return [
556
- 116 * t[1] - 16,
557
- 500 * (t[0] - t[1]),
558
- 200 * (t[1] - t[2])
559
- ];
560
- },
561
- toBase(e) {
562
- let t = [];
563
- return t[1] = (e[0] + 16) / 116, t[0] = e[1] / 500 + t[1], t[2] = t[1] - e[2] / 200, [
564
- t[0] > mt ? Math.pow(t[0], 3) : (116 * t[0] - 16) / pe,
565
- e[0] > 8 ? Math.pow((e[0] + 16) / 116, 3) : e[0] / pe,
566
- t[2] > mt ? Math.pow(t[2], 3) : (116 * t[2] - 16) / pe
567
- ].map((r, a) => r * Ae[a]);
568
- },
569
- formats: { lab: { coords: [
570
- "<number> | <percentage>",
571
- "<number> | <percentage>[-1,1]",
572
- "<number> | <percentage>[-1,1]"
573
- ] } }
574
- });
575
- function H(e) {
576
- return (e % 360 + 360) % 360;
577
- }
578
- function oa(e, t) {
579
- if (e === "raw") return t;
580
- let [r, a] = t.map(H), n = a - r;
581
- return e === "increasing" ? n < 0 && (a += 360) : e === "decreasing" ? n > 0 && (r += 360) : e === "longer" ? -180 < n && n < 180 && (n > 0 ? r += 360 : a += 360) : e === "shorter" && (n > 180 ? r += 360 : n < -180 && (a += 360)), [r, a];
582
- }
583
- var ue = new d({
584
- id: "lch",
585
- name: "LCH",
586
- coords: {
587
- l: {
588
- refRange: [0, 100],
589
- name: "Lightness"
590
- },
591
- c: {
592
- refRange: [0, 150],
593
- name: "Chroma"
594
- },
595
- h: {
596
- refRange: [0, 360],
597
- type: "angle",
598
- name: "Hue"
599
- }
600
- },
601
- base: x,
602
- fromBase(e) {
603
- let [t, r, a] = e, n;
604
- const s = 0.02;
605
- return Math.abs(r) < s && Math.abs(a) < s ? n = NaN : n = Math.atan2(a, r) * 180 / Math.PI, [
606
- t,
607
- Math.sqrt(r ** 2 + a ** 2),
608
- H(n)
609
- ];
610
- },
611
- toBase(e) {
612
- let [t, r, a] = e;
613
- return r < 0 && (r = 0), isNaN(a) && (a = 0), [
614
- t,
615
- r * Math.cos(a * Math.PI / 180),
616
- r * Math.sin(a * Math.PI / 180)
617
- ];
618
- },
619
- formats: { lch: { coords: [
620
- "<number> | <percentage>",
621
- "<number> | <percentage>",
622
- "<number> | <angle>"
623
- ] } }
624
- }), gt = 25 ** 7, Be = Math.PI, pt = 180 / Be, W = Be / 180;
625
- function bt(e) {
626
- const t = e * e;
627
- return t * t * t * e;
628
- }
629
- function br(e, t, { kL: r = 1, kC: a = 1, kH: n = 1 } = {}) {
630
- [e, t] = g([e, t]);
631
- let [s, i, o] = x.from(e), l = ue.from(x, [
632
- s,
633
- i,
634
- o
635
- ])[1], [c, u, f] = x.from(t), h = ue.from(x, [
636
- c,
637
- u,
638
- f
639
- ])[1];
640
- l < 0 && (l = 0), h < 0 && (h = 0);
641
- let m = bt((l + h) / 2), p = 0.5 * (1 - Math.sqrt(m / (m + gt))), b = (1 + p) * i, y = (1 + p) * u, v = Math.sqrt(b ** 2 + o ** 2), _ = Math.sqrt(y ** 2 + f ** 2), k = b === 0 && o === 0 ? 0 : Math.atan2(o, b), z = y === 0 && f === 0 ? 0 : Math.atan2(f, y);
642
- k < 0 && (k += 2 * Be), z < 0 && (z += 2 * Be), k *= pt, z *= pt;
643
- let me = c - s, ae = _ - v, j = z - k, O = k + z, it = Math.abs(j), ne;
644
- v * _ === 0 ? ne = 0 : it <= 180 ? ne = j : j > 180 ? ne = j - 360 : j < -180 ? ne = j + 360 : E.warn("the unthinkable has happened");
645
- let ot = 2 * Math.sqrt(_ * v) * Math.sin(ne * W / 2), Zr = (s + c) / 2, ze = (v + _) / 2, lt = bt(ze), D;
646
- v * _ === 0 ? D = O : it <= 180 ? D = O / 2 : O < 360 ? D = (O + 360) / 2 : D = (O - 360) / 2;
647
- let ut = (Zr - 50) ** 2, Fr = 1 + 0.015 * ut / Math.sqrt(20 + ut), ft = 1 + 0.045 * ze, se = 1;
648
- se -= 0.17 * Math.cos((D - 30) * W), se += 0.24 * Math.cos(2 * D * W), se += 0.32 * Math.cos((3 * D + 6) * W), se -= 0.2 * Math.cos((4 * D - 63) * W);
649
- let ct = 1 + 0.015 * ze * se, Jr = 30 * Math.exp(-1 * ((D - 275) / 25) ** 2), Wr = 2 * Math.sqrt(lt / (lt + gt)), Qr = -1 * Math.sin(2 * Jr * W) * Wr, ge = (me / (r * Fr)) ** 2;
650
- return ge += (ae / (a * ft)) ** 2, ge += (ot / (n * ct)) ** 2, ge += Qr * (ae / (a * ft)) * (ot / (n * ct)), Math.sqrt(ge);
651
- }
652
- var la = [
653
- [
654
- 0.819022437996703,
655
- 0.3619062600528904,
656
- -0.1288737815209879
657
- ],
658
- [
659
- 0.0329836539323885,
660
- 0.9292868615863434,
661
- 0.0361446663506424
662
- ],
663
- [
664
- 0.0481771893596242,
665
- 0.2642395317527308,
666
- 0.6335478284694309
667
- ]
668
- ], ua = [
669
- [
670
- 1.2268798758459243,
671
- -0.5578149944602171,
672
- 0.2813910456659647
673
- ],
674
- [
675
- -0.0405757452148008,
676
- 1.112286803280317,
677
- -0.0717110580655164
678
- ],
679
- [
680
- -0.0763729366746601,
681
- -0.4214933324022432,
682
- 1.5869240198367816
683
- ]
684
- ], fa = [
685
- [
686
- 0.210454268309314,
687
- 0.7936177747023054,
688
- -0.0040720430116193
689
- ],
690
- [
691
- 1.9779985324311684,
692
- -2.42859224204858,
693
- 0.450593709617411
694
- ],
695
- [
696
- 0.0259040424655478,
697
- 0.7827717124575296,
698
- -0.8086757549230774
699
- ]
700
- ], ca = [
701
- [
702
- 1,
703
- 0.3963377773761749,
704
- 0.2158037573099136
705
- ],
706
- [
707
- 1,
708
- -0.1055613458156586,
709
- -0.0638541728258133
710
- ],
711
- [
712
- 1,
713
- -0.0894841775298119,
714
- -1.2914855480194092
715
- ]
716
- ], V = new d({
717
- id: "oklab",
718
- name: "Oklab",
719
- coords: {
720
- l: {
721
- refRange: [0, 1],
722
- name: "Lightness"
723
- },
724
- a: { refRange: [-0.4, 0.4] },
725
- b: { refRange: [-0.4, 0.4] }
726
- },
727
- white: "D65",
728
- base: S,
729
- fromBase(e) {
730
- return w(fa, w(la, e).map((t) => Math.cbrt(t)));
731
- },
732
- toBase(e) {
733
- return w(ua, w(ca, e).map((t) => t ** 3));
734
- },
735
- formats: { oklab: { coords: [
736
- "<percentage> | <number>",
737
- "<number> | <percentage>[-1,1]",
738
- "<number> | <percentage>[-1,1]"
739
- ] } }
740
- });
741
- function Xe(e, t) {
742
- [e, t] = g([e, t]);
743
- let [r, a, n] = V.from(e), [s, i, o] = V.from(t), l = r - s, c = a - i, u = n - o;
744
- return Math.sqrt(l ** 2 + c ** 2 + u ** 2);
745
- }
746
- var ha = 75e-6;
747
- function J(e, t, { epsilon: r = ha } = {}) {
748
- e = g(e), t || (t = e.space), t = d.get(t);
749
- let a = e.coords;
750
- return t !== e.space && (a = t.from(e)), t.inGamut(a, { epsilon: r });
751
- }
752
- function ee(e) {
753
- return {
754
- space: e.space,
755
- coords: e.coords.slice(),
756
- alpha: e.alpha
757
- };
758
- }
759
- function Mr(e, t, r = "lab") {
760
- r = d.get(r);
761
- let a = r.from(e), n = r.from(t);
762
- return Math.sqrt(a.reduce((s, i, o) => {
763
- let l = n[o];
764
- return isNaN(i) || isNaN(l) ? s : s + (l - i) ** 2;
765
- }, 0));
766
- }
767
- function da(e, t) {
768
- return Mr(e, t, "lab");
769
- }
770
- var Mt = Math.PI / 180;
771
- function ma(e, t, { l: r = 2, c: a = 1 } = {}) {
772
- [e, t] = g([e, t]);
773
- let [n, s, i] = x.from(e), [, o, l] = ue.from(x, [
774
- n,
775
- s,
776
- i
777
- ]), [c, u, f] = x.from(t), h = ue.from(x, [
778
- c,
779
- u,
780
- f
781
- ])[1];
782
- o < 0 && (o = 0), h < 0 && (h = 0);
783
- let m = n - c, p = o - h, b = s - u, y = i - f, v = b ** 2 + y ** 2 - p ** 2, _ = 0.511;
784
- n >= 16 && (_ = 0.040975 * n / (1 + 0.01765 * n));
785
- let k = 0.0638 * o / (1 + 0.0131 * o) + 0.638, z;
786
- Number.isNaN(l) && (l = 0), l >= 164 && l <= 345 ? z = 0.56 + Math.abs(0.2 * Math.cos((l + 168) * Mt)) : z = 0.36 + Math.abs(0.4 * Math.cos((l + 35) * Mt));
787
- let me = Math.pow(o, 4), ae = Math.sqrt(me / (me + 1900)), j = k * (ae * z + 1 - ae), O = (m / (r * _)) ** 2;
788
- return O += (p / (a * k)) ** 2, O += v / j ** 2, Math.sqrt(O);
789
- }
790
- var wt = 203, rt = new d({
791
- id: "xyz-abs-d65",
792
- cssId: "--xyz-abs-d65",
793
- name: "Absolute XYZ D65",
794
- coords: {
795
- x: {
796
- refRange: [0, 9504.7],
797
- name: "Xa"
798
- },
799
- y: {
800
- refRange: [0, 1e4],
801
- name: "Ya"
802
- },
803
- z: {
804
- refRange: [0, 10888.3],
805
- name: "Za"
806
- }
807
- },
808
- base: S,
809
- fromBase(e) {
810
- return e.map((t) => Math.max(t * wt, 0));
811
- },
812
- toBase(e) {
813
- return e.map((t) => Math.max(t / wt, 0));
814
- }
815
- }), be = 1.15, Me = 0.66, vt = 2610 / 2 ** 14, ga = 2 ** 14 / 2610, yt = 3424 / 2 ** 12, Ct = 2413 / 2 ** 7, Rt = 2392 / 2 ** 7, pa = 1.7 * 2523 / 2 ** 5, _t = 2 ** 5 / (1.7 * 2523), we = -0.56, ke = 16295499532821565e-27, ba = [
816
- [
817
- 0.41478972,
818
- 0.579999,
819
- 0.014648
820
- ],
821
- [
822
- -0.20151,
823
- 1.120649,
824
- 0.0531008
825
- ],
826
- [
827
- -0.0166008,
828
- 0.2648,
829
- 0.6684799
830
- ]
831
- ], Ma = [
832
- [
833
- 1.9242264357876067,
834
- -1.0047923125953657,
835
- 0.037651404030618
836
- ],
837
- [
838
- 0.35031676209499907,
839
- 0.7264811939316552,
840
- -0.06538442294808501
841
- ],
842
- [
843
- -0.09098281098284752,
844
- -0.3127282905230739,
845
- 1.5227665613052603
846
- ]
847
- ], wa = [
848
- [
849
- 0.5,
850
- 0.5,
851
- 0
852
- ],
853
- [
854
- 3.524,
855
- -4.066708,
856
- 0.542708
857
- ],
858
- [
859
- 0.199076,
860
- 1.096799,
861
- -1.295875
862
- ]
863
- ], va = [
864
- [
865
- 1,
866
- 0.1386050432715393,
867
- 0.05804731615611886
868
- ],
869
- [
870
- 0.9999999999999999,
871
- -0.1386050432715393,
872
- -0.05804731615611886
873
- ],
874
- [
875
- 0.9999999999999998,
876
- -0.09601924202631895,
877
- -0.8118918960560388
878
- ]
879
- ], wr = new d({
880
- id: "jzazbz",
881
- name: "Jzazbz",
882
- coords: {
883
- jz: {
884
- refRange: [0, 1],
885
- name: "Jz"
886
- },
887
- az: { refRange: [-0.5, 0.5] },
888
- bz: { refRange: [-0.5, 0.5] }
889
- },
890
- base: rt,
891
- fromBase(e) {
892
- let [t, r, a] = e, [n, s, i] = w(wa, w(ba, [
893
- be * t - (be - 1) * a,
894
- Me * r - (Me - 1) * t,
895
- a
896
- ]).map(function(o) {
897
- return ((yt + Ct * (o / 1e4) ** vt) / (1 + Rt * (o / 1e4) ** vt)) ** pa;
898
- }));
899
- return [
900
- (1 + we) * n / (1 + we * n) - ke,
901
- s,
902
- i
903
- ];
904
- },
905
- toBase(e) {
906
- let [t, r, a] = e, [n, s, i] = w(Ma, w(va, [
907
- (t + ke) / (1 + we - we * (t + ke)),
908
- r,
909
- a
910
- ]).map(function(l) {
911
- return 1e4 * ((yt - l ** _t) / (Rt * l ** _t - Ct)) ** ga;
912
- })), o = (n + (be - 1) * i) / be;
913
- return [
914
- o,
915
- (s + (Me - 1) * o) / Me,
916
- i
917
- ];
918
- },
919
- formats: { color: { coords: [
920
- "<number> | <percentage>",
921
- "<number> | <percentage>[-1,1]",
922
- "<number> | <percentage>[-1,1]"
923
- ] } }
924
- }), Ze = new d({
925
- id: "jzczhz",
926
- name: "JzCzHz",
927
- coords: {
928
- jz: {
929
- refRange: [0, 1],
930
- name: "Jz"
931
- },
932
- cz: {
933
- refRange: [0, 1],
934
- name: "Chroma"
935
- },
936
- hz: {
937
- refRange: [0, 360],
938
- type: "angle",
939
- name: "Hue"
940
- }
941
- },
942
- base: wr,
943
- fromBase(e) {
944
- let [t, r, a] = e, n;
945
- const s = 2e-4;
946
- return Math.abs(r) < s && Math.abs(a) < s ? n = NaN : n = Math.atan2(a, r) * 180 / Math.PI, [
947
- t,
948
- Math.sqrt(r ** 2 + a ** 2),
949
- H(n)
950
- ];
951
- },
952
- toBase(e) {
953
- return [
954
- e[0],
955
- e[1] * Math.cos(e[2] * Math.PI / 180),
956
- e[1] * Math.sin(e[2] * Math.PI / 180)
957
- ];
958
- }
959
- });
960
- function ya(e, t) {
961
- [e, t] = g([e, t]);
962
- let [r, a, n] = Ze.from(e), [s, i, o] = Ze.from(t), l = r - s, c = a - i;
963
- Number.isNaN(n) && Number.isNaN(o) ? (n = 0, o = 0) : Number.isNaN(n) ? n = o : Number.isNaN(o) && (o = n);
964
- let u = n - o, f = 2 * Math.sqrt(a * i) * Math.sin(u / 2 * (Math.PI / 180));
965
- return Math.sqrt(l ** 2 + c ** 2 + f ** 2);
966
- }
967
- var vr = 3424 / 4096, yr = 2413 / 128, Cr = 2392 / 128, St = 2610 / 16384, Ca = 2523 / 32, Ra = 16384 / 2610, Lt = 32 / 2523, _a = [
968
- [
969
- 0.3592832590121217,
970
- 0.6976051147779502,
971
- -0.035891593232029
972
- ],
973
- [
974
- -0.1920808463704993,
975
- 1.100476797037432,
976
- 0.0753748658519118
977
- ],
978
- [
979
- 0.0070797844607479,
980
- 0.0748396662186362,
981
- 0.8433265453898765
982
- ]
983
- ], Sa = [
984
- [
985
- 2048 / 4096,
986
- 2048 / 4096,
987
- 0
988
- ],
989
- [
990
- 6610 / 4096,
991
- -13613 / 4096,
992
- 7003 / 4096
993
- ],
994
- [
995
- 17933 / 4096,
996
- -17390 / 4096,
997
- -543 / 4096
998
- ]
999
- ], La = [
1000
- [
1001
- 0.9999999999999998,
1002
- 0.0086090370379328,
1003
- 0.111029625003026
1004
- ],
1005
- [
1006
- 0.9999999999999998,
1007
- -0.0086090370379328,
1008
- -0.1110296250030259
1009
- ],
1010
- [
1011
- 0.9999999999999998,
1012
- 0.5600313357106791,
1013
- -0.3206271749873188
1014
- ]
1015
- ], Ba = [
1016
- [
1017
- 2.0701522183894223,
1018
- -1.3263473389671563,
1019
- 0.2066510476294053
1020
- ],
1021
- [
1022
- 0.3647385209748072,
1023
- 0.6805660249472273,
1024
- -0.0453045459220347
1025
- ],
1026
- [
1027
- -0.0497472075358123,
1028
- -0.0492609666966131,
1029
- 1.1880659249923042
1030
- ]
1031
- ], Fe = new d({
1032
- id: "ictcp",
1033
- name: "ICTCP",
1034
- coords: {
1035
- i: {
1036
- refRange: [0, 1],
1037
- name: "I"
1038
- },
1039
- ct: {
1040
- refRange: [-0.5, 0.5],
1041
- name: "CT"
1042
- },
1043
- cp: {
1044
- refRange: [-0.5, 0.5],
1045
- name: "CP"
1046
- }
1047
- },
1048
- base: rt,
1049
- fromBase(e) {
1050
- return Ia(w(_a, e));
1051
- },
1052
- toBase(e) {
1053
- return w(Ba, Na(e));
1054
- }
1055
- });
1056
- function Ia(e) {
1057
- return w(Sa, e.map(function(t) {
1058
- return ((vr + yr * (t / 1e4) ** St) / (1 + Cr * (t / 1e4) ** St)) ** Ca;
1059
- }));
1060
- }
1061
- function Na(e) {
1062
- return w(La, e).map(function(t) {
1063
- return 1e4 * (Math.max(t ** Lt - vr, 0) / (yr - Cr * t ** Lt)) ** Ra;
1064
- });
1065
- }
1066
- function xa(e, t) {
1067
- [e, t] = g([e, t]);
1068
- let [r, a, n] = Fe.from(e), [s, i, o] = Fe.from(t);
1069
- return 720 * Math.sqrt((r - s) ** 2 + 0.25 * (a - i) ** 2 + (n - o) ** 2);
1070
- }
1071
- var Ea = L.D65, Rr = 0.42, Bt = 1 / Rr, $e = 2 * Math.PI, _r = [
1072
- [
1073
- 0.401288,
1074
- 0.650173,
1075
- -0.051461
1076
- ],
1077
- [
1078
- -0.250268,
1079
- 1.204414,
1080
- 0.045854
1081
- ],
1082
- [
1083
- -2079e-6,
1084
- 0.048952,
1085
- 0.953127
1086
- ]
1087
- ], Pa = [
1088
- [
1089
- 1.8620678550872327,
1090
- -1.0112546305316843,
1091
- 0.14918677544445175
1092
- ],
1093
- [
1094
- 0.38752654323613717,
1095
- 0.6214474419314753,
1096
- -0.008973985167612518
1097
- ],
1098
- [
1099
- -0.015841498849333856,
1100
- -0.03412293802851557,
1101
- 1.0499644368778496
1102
- ]
1103
- ], za = [
1104
- [
1105
- 460,
1106
- 451,
1107
- 288
1108
- ],
1109
- [
1110
- 460,
1111
- -891,
1112
- -261
1113
- ],
1114
- [
1115
- 460,
1116
- -220,
1117
- -6300
1118
- ]
1119
- ], Aa = {
1120
- dark: [
1121
- 0.8,
1122
- 0.525,
1123
- 0.8
1124
- ],
1125
- dim: [
1126
- 0.9,
1127
- 0.59,
1128
- 0.9
1129
- ],
1130
- average: [
1131
- 1,
1132
- 0.69,
1133
- 1
1134
- ]
1135
- }, F = {
1136
- h: [
1137
- 20.14,
1138
- 90,
1139
- 164.25,
1140
- 237.53,
1141
- 380.14
1142
- ],
1143
- e: [
1144
- 0.8,
1145
- 0.7,
1146
- 1,
1147
- 1.2,
1148
- 0.8
1149
- ],
1150
- H: [
1151
- 0,
1152
- 100,
1153
- 200,
1154
- 300,
1155
- 400
1156
- ]
1157
- }, ka = 180 / Math.PI, It = Math.PI / 180;
1158
- function Sr(e, t) {
1159
- return e.map((r) => {
1160
- const a = $(t * Math.abs(r) * 0.01, Rr);
1161
- return 400 * Ne(a, r) / (a + 27.13);
1162
- });
1163
- }
1164
- function $a(e, t) {
1165
- const r = 100 / t * 27.13 ** Bt;
1166
- return e.map((a) => {
1167
- const n = Math.abs(a);
1168
- return Ne(r * $(n / (400 - n), Bt), a);
1169
- });
1170
- }
1171
- function Ha(e) {
1172
- let t = H(e);
1173
- t <= F.h[0] && (t += 360);
1174
- const r = gr(F.h, t) - 1, [a, n] = F.h.slice(r, r + 2), [s, i] = F.e.slice(r, r + 2), o = F.H[r], l = (t - a) / s;
1175
- return o + 100 * l / (l + (n - t) / i);
1176
- }
1177
- function Oa(e) {
1178
- let t = (e % 400 + 400) % 400;
1179
- const r = Math.floor(0.01 * t);
1180
- t = t % 100;
1181
- const [a, n] = F.h.slice(r, r + 2), [s, i] = F.e.slice(r, r + 2);
1182
- return H((t * (i * a - s * n) - 100 * a * i) / (t * (i - s) - 100 * i));
1183
- }
1184
- function Lr(e, t, r, a, n) {
1185
- const s = {};
1186
- s.discounting = n, s.refWhite = e, s.surround = a;
1187
- const i = e.map((m) => m * 100);
1188
- s.la = t, s.yb = r;
1189
- const o = i[1], l = w(_r, i);
1190
- a = Aa[s.surround];
1191
- const c = a[0];
1192
- s.c = a[1], s.nc = a[2];
1193
- const u = (1 / (5 * s.la + 1)) ** 4;
1194
- s.fl = u * s.la + 0.1 * (1 - u) * (1 - u) * Math.cbrt(5 * s.la), s.flRoot = s.fl ** 0.25, s.n = s.yb / o, s.z = 1.48 + Math.sqrt(s.n), s.nbb = 0.725 * s.n ** -0.2, s.ncb = s.nbb;
1195
- const f = n ? 1 : Math.max(Math.min(c * (1 - 1 / 3.6 * Math.exp((-s.la - 42) / 92)), 1), 0);
1196
- s.dRgb = l.map((m) => le(1, o / m, f)), s.dRgbInv = s.dRgb.map((m) => 1 / m);
1197
- const h = Sr(l.map((m, p) => m * s.dRgb[p]), s.fl);
1198
- return s.aW = s.nbb * (2 * h[0] + h[1] + 0.05 * h[2]), s;
1199
- }
1200
- var Nt = Lr(Ea, 64 / Math.PI * 0.2, 20, "average", !1);
1201
- function Je(e, t) {
1202
- if (!(e.J !== void 0 ^ e.Q !== void 0)) throw new Error("Conversion requires one and only one: 'J' or 'Q'");
1203
- if (!(e.C !== void 0 ^ e.M !== void 0 ^ e.s !== void 0)) throw new Error("Conversion requires one and only one: 'C', 'M' or 's'");
1204
- if (!(e.h !== void 0 ^ e.H !== void 0)) throw new Error("Conversion requires one and only one: 'h' or 'H'");
1205
- if (e.J === 0 || e.Q === 0) return [
1206
- 0,
1207
- 0,
1208
- 0
1209
- ];
1210
- let r = 0;
1211
- e.h !== void 0 ? r = H(e.h) * It : r = Oa(e.H) * It;
1212
- const a = Math.cos(r), n = Math.sin(r);
1213
- let s = 0;
1214
- e.J !== void 0 ? s = $(e.J, 1 / 2) * 0.1 : e.Q !== void 0 && (s = 0.25 * t.c * e.Q / ((t.aW + 4) * t.flRoot));
1215
- let i = 0;
1216
- e.C !== void 0 ? i = e.C / s : e.M !== void 0 ? i = e.M / t.flRoot / s : e.s !== void 0 && (i = 4e-4 * e.s ** 2 * (t.aW + 4) / t.c);
1217
- const o = $(i * Math.pow(1.64 - Math.pow(0.29, t.n), -0.73), 10 / 9), l = 0.25 * (Math.cos(r + 2) + 3.8), c = t.aW * $(s, 2 / t.c / t.z), u = 5e4 / 13 * t.nc * t.ncb * l, f = c / t.nbb, h = 23 * (f + 0.305) * Ve(o, 23 * u + o * (11 * a + 108 * n));
1218
- return w(Pa, $a(w(za, [
1219
- f,
1220
- h * a,
1221
- h * n
1222
- ]).map((m) => m * 1 / 1403), t.fl).map((m, p) => m * t.dRgbInv[p])).map((m) => m / 100);
1223
- }
1224
- function Br(e, t) {
1225
- const r = Sr(w(_r, e.map((b) => b * 100)).map((b, y) => b * t.dRgb[y]), t.fl), a = r[0] + (-12 * r[1] + r[2]) / 11, n = (r[0] + r[1] - 2 * r[2]) / 9, s = (Math.atan2(n, a) % $e + $e) % $e, i = 0.25 * (Math.cos(s + 2) + 3.8), o = $(5e4 / 13 * t.nc * t.ncb * Ve(i * Math.sqrt(a ** 2 + n ** 2), r[0] + r[1] + 1.05 * r[2] + 0.305), 0.9) * Math.pow(1.64 - Math.pow(0.29, t.n), 0.73), l = $(t.nbb * (2 * r[0] + r[1] + 0.05 * r[2]) / t.aW, 0.5 * t.c * t.z), c = 100 * $(l, 2), u = 4 / t.c * l * (t.aW + 4) * t.flRoot, f = o * l, h = f * t.flRoot, m = H(s * ka), p = Ha(m);
1226
- return {
1227
- J: c,
1228
- C: f,
1229
- h: m,
1230
- s: 50 * $(t.c * o / (t.aW + 4), 1 / 2),
1231
- Q: u,
1232
- M: h,
1233
- H: p
1234
- };
1235
- }
1236
- var Da = new d({
1237
- id: "cam16-jmh",
1238
- cssId: "--cam16-jmh",
1239
- name: "CAM16-JMh",
1240
- coords: {
1241
- j: {
1242
- refRange: [0, 100],
1243
- name: "J"
1244
- },
1245
- m: {
1246
- refRange: [0, 105],
1247
- name: "Colorfulness"
1248
- },
1249
- h: {
1250
- refRange: [0, 360],
1251
- type: "angle",
1252
- name: "Hue"
1253
- }
1254
- },
1255
- base: S,
1256
- fromBase(e) {
1257
- const t = Br(e, Nt);
1258
- return [
1259
- t.J,
1260
- t.M,
1261
- t.h
1262
- ];
1263
- },
1264
- toBase(e) {
1265
- return Je({
1266
- J: e[0],
1267
- M: e[1],
1268
- h: e[2]
1269
- }, Nt);
1270
- }
1271
- }), Ta = L.D65, ja = 216 / 24389, Ir = 24389 / 27;
1272
- function Ya(e) {
1273
- return 116 * (e > ja ? Math.cbrt(e) : (Ir * e + 16) / 116) - 16;
1274
- }
1275
- function We(e) {
1276
- return e > 8 ? Math.pow((e + 16) / 116, 3) : e / Ir;
1277
- }
1278
- function qa(e, t) {
1279
- let [r, a, n] = e, s = [], i = 0;
1280
- if (n === 0) return [
1281
- 0,
1282
- 0,
1283
- 0
1284
- ];
1285
- let o = We(n);
1286
- n > 0 ? i = 0.00379058511492914 * n ** 2 + 0.608983189401032 * n + 0.9155088574762233 : i = 9514440756550361e-21 * n ** 2 + 0.08693057439788597 * n - 21.928975842194614;
1287
- const l = 2e-12, c = 15;
1288
- let u = 0, f = 1 / 0;
1289
- for (; u <= c; ) {
1290
- s = Je({
1291
- J: i,
1292
- C: a,
1293
- h: r
1294
- }, t);
1295
- const h = Math.abs(s[1] - o);
1296
- if (h < f) {
1297
- if (h <= l) return s;
1298
- f = h;
1299
- }
1300
- i = i - (s[1] - o) * i / (2 * s[1]), u += 1;
1301
- }
1302
- return Je({
1303
- J: i,
1304
- C: a,
1305
- h: r
1306
- }, t);
1307
- }
1308
- function Ga(e, t) {
1309
- const r = Ya(e[1]);
1310
- if (r === 0) return [
1311
- 0,
1312
- 0,
1313
- 0
1314
- ];
1315
- const a = Br(e, at);
1316
- return [
1317
- H(a.h),
1318
- a.C,
1319
- r
1320
- ];
1321
- }
1322
- var at = Lr(Ta, 200 / Math.PI * We(50), We(50) * 100, "average", !1), fe = new d({
1323
- id: "hct",
1324
- name: "HCT",
1325
- coords: {
1326
- h: {
1327
- refRange: [0, 360],
1328
- type: "angle",
1329
- name: "Hue"
1330
- },
1331
- c: {
1332
- refRange: [0, 145],
1333
- name: "Colorfulness"
1334
- },
1335
- t: {
1336
- refRange: [0, 100],
1337
- name: "Tone"
1338
- }
1339
- },
1340
- base: S,
1341
- fromBase(e) {
1342
- return Ga(e);
1343
- },
1344
- toBase(e) {
1345
- return qa(e, at);
1346
- },
1347
- formats: { color: {
1348
- id: "--hct",
1349
- coords: [
1350
- "<number> | <angle>",
1351
- "<percentage> | <number>",
1352
- "<percentage> | <number>"
1353
- ]
1354
- } }
1355
- }), Xa = Math.PI / 180, xt = [
1356
- 1,
1357
- 7e-3,
1358
- 0.0228
1359
- ];
1360
- function Et(e) {
1361
- e[1] < 0 && (e = fe.fromBase(fe.toBase(e)));
1362
- const t = Math.log(Math.max(1 + xt[2] * e[1] * at.flRoot, 1)) / xt[2], r = e[0] * Xa, a = t * Math.cos(r), n = t * Math.sin(r);
1363
- return [
1364
- e[2],
1365
- a,
1366
- n
1367
- ];
1368
- }
1369
- function Za(e, t) {
1370
- [e, t] = g([e, t]);
1371
- let [r, a, n] = Et(fe.from(e)), [s, i, o] = Et(fe.from(t));
1372
- return Math.sqrt((r - s) ** 2 + (a - i) ** 2 + (n - o) ** 2);
1373
- }
1374
- var te = {
1375
- deltaE76: da,
1376
- deltaECMC: ma,
1377
- deltaE2000: br,
1378
- deltaEJz: ya,
1379
- deltaEITP: xa,
1380
- deltaEOK: Xe,
1381
- deltaEHCT: Za
1382
- };
1383
- function Fa(e) {
1384
- const t = e ? Math.floor(Math.log10(Math.abs(e))) : 0;
1385
- return Math.max(parseFloat(`1e${t - 2}`), 1e-6);
1386
- }
1387
- var Pt = {
1388
- hct: {
1389
- method: "hct.c",
1390
- jnd: 2,
1391
- deltaEMethod: "hct",
1392
- blackWhiteClamp: {}
1393
- },
1394
- "hct-tonal": {
1395
- method: "hct.c",
1396
- jnd: 0,
1397
- deltaEMethod: "hct",
1398
- blackWhiteClamp: {
1399
- channel: "hct.t",
1400
- min: 0,
1401
- max: 100
1402
- }
1403
- }
1404
- };
1405
- function X(e, { method: t = E.gamut_mapping, space: r = void 0, deltaEMethod: a = "", jnd: n = 2, blackWhiteClamp: s = {} } = {}) {
1406
- if (e = g(e), ce(arguments[1]) ? r = arguments[1] : r || (r = e.space), r = d.get(r), J(e, r, { epsilon: 0 })) return e;
1407
- let i;
1408
- if (t === "css") i = Ja(e, { space: r });
1409
- else {
1410
- if (t !== "clip" && !J(e, r)) {
1411
- Object.prototype.hasOwnProperty.call(Pt, t) && ({ method: t, jnd: n, deltaEMethod: a, blackWhiteClamp: s } = Pt[t]);
1412
- let o = br;
1413
- if (a !== "") {
1414
- for (let c in te) if ("deltae" + a.toLowerCase() === c.toLowerCase()) {
1415
- o = te[c];
1416
- break;
1417
- }
1418
- }
1419
- let l = X(M(e, r), {
1420
- method: "clip",
1421
- space: r
1422
- });
1423
- if (o(e, l) > n) {
1424
- if (Object.keys(s).length === 3) {
1425
- let v = d.resolveCoord(s.channel), _ = N(M(e, v.space), v.id);
1426
- if (q(_) && (_ = 0), _ >= s.max) return M({
1427
- space: "xyz-d65",
1428
- coords: L.D65
1429
- }, e.space);
1430
- if (_ <= s.min) return M({
1431
- space: "xyz-d65",
1432
- coords: [
1433
- 0,
1434
- 0,
1435
- 0
1436
- ]
1437
- }, e.space);
1438
- }
1439
- let c = d.resolveCoord(t), u = c.space, f = c.id, h = M(e, u);
1440
- h.coords.forEach((v, _) => {
1441
- q(v) && (h.coords[_] = 0);
1442
- });
1443
- let m = (c.range || c.refRange)[0], p = Fa(n), b = m, y = N(h, f);
1444
- for (; y - b > p; ) {
1445
- let v = ee(h);
1446
- v = X(v, {
1447
- space: r,
1448
- method: "clip"
1449
- }), o(h, v) - n < p ? b = N(h, f) : y = N(h, f), T(h, f, (b + y) / 2);
1450
- }
1451
- i = M(h, r);
1452
- } else i = l;
1453
- } else i = M(e, r);
1454
- if (t === "clip" || !J(i, r, { epsilon: 0 })) {
1455
- let o = Object.values(r.coords).map((l) => l.range || []);
1456
- i.coords = i.coords.map((l, c) => {
1457
- let [u, f] = o[c];
1458
- return u !== void 0 && (l = Math.max(u, l)), f !== void 0 && (l = Math.min(l, f)), l;
1459
- });
1460
- }
1461
- }
1462
- return r !== e.space && (i = M(i, e.space)), e.coords = i.coords, e;
1463
- }
1464
- X.returns = "color";
1465
- var zt = {
1466
- WHITE: {
1467
- space: V,
1468
- coords: [
1469
- 1,
1470
- 0,
1471
- 0
1472
- ]
1473
- },
1474
- BLACK: {
1475
- space: V,
1476
- coords: [
1477
- 0,
1478
- 0,
1479
- 0
1480
- ]
1481
- }
1482
- };
1483
- function Ja(e, { space: t } = {}) {
1484
- e = g(e), t || (t = e.space), t = d.get(t);
1485
- const n = d.get("oklch");
1486
- if (t.isUnbounded) return M(e, t);
1487
- const s = M(e, n);
1488
- let i = s.coords[0];
1489
- if (i >= 1) {
1490
- const p = M(zt.WHITE, t);
1491
- return p.alpha = e.alpha, M(p, t);
1492
- }
1493
- if (i <= 0) {
1494
- const p = M(zt.BLACK, t);
1495
- return p.alpha = e.alpha, M(p, t);
1496
- }
1497
- if (J(s, t, { epsilon: 0 })) return M(s, t);
1498
- function o(p) {
1499
- const b = M(p, t), y = Object.values(t.coords);
1500
- return b.coords = b.coords.map((v, _) => {
1501
- if ("range" in y[_]) {
1502
- const [k, z] = y[_].range;
1503
- return mr(k, v, z);
1504
- }
1505
- return v;
1506
- }), b;
1507
- }
1508
- let l = 0, c = s.coords[1], u = !0, f = ee(s), h = o(f), m = Xe(h, f);
1509
- if (m < 0.02) return h;
1510
- for (; c - l > 1e-4; ) {
1511
- const p = (l + c) / 2;
1512
- if (f.coords[1] = p, u && J(f, t, { epsilon: 0 })) l = p;
1513
- else if (h = o(f), m = Xe(h, f), m < 0.02) {
1514
- if (0.02 - m < 1e-4) break;
1515
- u = !1, l = p;
1516
- } else c = p;
1517
- }
1518
- return h;
1519
- }
1520
- function M(e, t, { inGamut: r } = {}) {
1521
- e = g(e), t = d.get(t);
1522
- let a = t.from(e), n = {
1523
- space: t,
1524
- coords: a,
1525
- alpha: e.alpha
1526
- };
1527
- return r && (n = X(n, r === !0 ? void 0 : r)), n;
1528
- }
1529
- M.returns = "color";
1530
- function oe(e, { precision: t = E.precision, format: r = "default", inGamut: a = !0, ...n } = {}) {
1531
- let s;
1532
- e = g(e);
1533
- let i = r;
1534
- r = e.space.getFormat(r) ?? e.space.getFormat("default") ?? d.DEFAULT_FORMAT;
1535
- let o = e.coords.slice();
1536
- if (a ||= r.toGamut, a && !J(e) && (o = X(ee(e), a === !0 ? void 0 : a).coords), r.type === "custom")
1537
- if (n.precision = t, r.serialize) s = r.serialize(o, e.alpha, n);
1538
- else throw new TypeError(`format ${i} can only be used to parse colors, not for serialization`);
1539
- else {
1540
- let l = r.name || "color";
1541
- r.serializeCoords ? o = r.serializeCoords(o, t) : t !== null && (o = o.map((h) => Se(h, { precision: t })));
1542
- let c = [...o];
1543
- if (l === "color") {
1544
- let h = r.id || r.ids?.[0] || e.space.id;
1545
- c.unshift(h);
1546
- }
1547
- let u = e.alpha;
1548
- t !== null && (u = Se(u, { precision: t }));
1549
- let f = e.alpha >= 1 || r.noAlpha ? "" : `${r.commas ? "," : " /"} ${u}`;
1550
- s = `${l}(${c.join(r.commas ? ", " : " ")}${f})`;
1551
- }
1552
- return s;
1553
- }
1554
- var xe = new I({
1555
- id: "rec2020-linear",
1556
- cssId: "--rec2020-linear",
1557
- name: "Linear REC.2020",
1558
- white: "D65",
1559
- toXYZ_M: [
1560
- [
1561
- 0.6369580483012914,
1562
- 0.14461690358620832,
1563
- 0.1688809751641721
1564
- ],
1565
- [
1566
- 0.2627002120112671,
1567
- 0.6779980715188708,
1568
- 0.05930171646986196
1569
- ],
1570
- [
1571
- 0,
1572
- 0.028072693049087428,
1573
- 1.060985057710791
1574
- ]
1575
- ],
1576
- fromXYZ_M: [
1577
- [
1578
- 1.716651187971268,
1579
- -0.355670783776392,
1580
- -0.25336628137366
1581
- ],
1582
- [
1583
- -0.666684351832489,
1584
- 1.616481236634939,
1585
- 0.0157685458139111
1586
- ],
1587
- [
1588
- 0.017639857445311,
1589
- -0.042770613257809,
1590
- 0.942103121235474
1591
- ]
1592
- ]
1593
- }), ve = 1.09929682680944, At = 0.018053968510807, Nr = new I({
1594
- id: "rec2020",
1595
- name: "REC.2020",
1596
- base: xe,
1597
- toBase(e) {
1598
- return e.map(function(t) {
1599
- return t < At * 4.5 ? t / 4.5 : Math.pow((t + ve - 1) / ve, 1 / 0.45);
1600
- });
1601
- },
1602
- fromBase(e) {
1603
- return e.map(function(t) {
1604
- return t >= At ? ve * Math.pow(t, 0.45) - (ve - 1) : 4.5 * t;
1605
- });
1606
- }
1607
- }), xr = new I({
1608
- id: "p3-linear",
1609
- cssId: "--display-p3-linear",
1610
- name: "Linear P3",
1611
- white: "D65",
1612
- toXYZ_M: [
1613
- [
1614
- 0.4865709486482162,
1615
- 0.26566769316909306,
1616
- 0.1982172852343625
1617
- ],
1618
- [
1619
- 0.2289745640697488,
1620
- 0.6917385218365064,
1621
- 0.079286914093745
1622
- ],
1623
- [
1624
- 0,
1625
- 0.04511338185890264,
1626
- 1.043944368900976
1627
- ]
1628
- ],
1629
- fromXYZ_M: [
1630
- [
1631
- 2.493496911941425,
1632
- -0.9313836179191239,
1633
- -0.40271078445071684
1634
- ],
1635
- [
1636
- -0.8294889695615747,
1637
- 1.7626640603183463,
1638
- 0.023624685841943577
1639
- ],
1640
- [
1641
- 0.03584583024378447,
1642
- -0.07617238926804182,
1643
- 0.9568845240076872
1644
- ]
1645
- ]
1646
- }), Wa = [
1647
- [
1648
- 0.41239079926595934,
1649
- 0.357584339383878,
1650
- 0.1804807884018343
1651
- ],
1652
- [
1653
- 0.21263900587151027,
1654
- 0.715168678767756,
1655
- 0.07219231536073371
1656
- ],
1657
- [
1658
- 0.01933081871559182,
1659
- 0.11919477979462598,
1660
- 0.9505321522496607
1661
- ]
1662
- ], R = [
1663
- [
1664
- 3.2409699419045226,
1665
- -1.537383177570094,
1666
- -0.4986107602930034
1667
- ],
1668
- [
1669
- -0.9692436362808796,
1670
- 1.8759675015077202,
1671
- 0.04155505740717559
1672
- ],
1673
- [
1674
- 0.05563007969699366,
1675
- -0.20397695888897652,
1676
- 1.0569715142428786
1677
- ]
1678
- ], Er = new I({
1679
- id: "srgb-linear",
1680
- name: "Linear sRGB",
1681
- white: "D65",
1682
- toXYZ_M: Wa,
1683
- fromXYZ_M: R
1684
- }), kt = {
1685
- aliceblue: [
1686
- 240 / 255,
1687
- 248 / 255,
1688
- 1
1689
- ],
1690
- antiquewhite: [
1691
- 250 / 255,
1692
- 235 / 255,
1693
- 215 / 255
1694
- ],
1695
- aqua: [
1696
- 0,
1697
- 1,
1698
- 1
1699
- ],
1700
- aquamarine: [
1701
- 127 / 255,
1702
- 1,
1703
- 212 / 255
1704
- ],
1705
- azure: [
1706
- 240 / 255,
1707
- 1,
1708
- 1
1709
- ],
1710
- beige: [
1711
- 245 / 255,
1712
- 245 / 255,
1713
- 220 / 255
1714
- ],
1715
- bisque: [
1716
- 1,
1717
- 228 / 255,
1718
- 196 / 255
1719
- ],
1720
- black: [
1721
- 0,
1722
- 0,
1723
- 0
1724
- ],
1725
- blanchedalmond: [
1726
- 1,
1727
- 235 / 255,
1728
- 205 / 255
1729
- ],
1730
- blue: [
1731
- 0,
1732
- 0,
1733
- 1
1734
- ],
1735
- blueviolet: [
1736
- 138 / 255,
1737
- 43 / 255,
1738
- 226 / 255
1739
- ],
1740
- brown: [
1741
- 165 / 255,
1742
- 42 / 255,
1743
- 42 / 255
1744
- ],
1745
- burlywood: [
1746
- 222 / 255,
1747
- 184 / 255,
1748
- 135 / 255
1749
- ],
1750
- cadetblue: [
1751
- 95 / 255,
1752
- 158 / 255,
1753
- 160 / 255
1754
- ],
1755
- chartreuse: [
1756
- 127 / 255,
1757
- 1,
1758
- 0
1759
- ],
1760
- chocolate: [
1761
- 210 / 255,
1762
- 105 / 255,
1763
- 30 / 255
1764
- ],
1765
- coral: [
1766
- 1,
1767
- 127 / 255,
1768
- 80 / 255
1769
- ],
1770
- cornflowerblue: [
1771
- 100 / 255,
1772
- 149 / 255,
1773
- 237 / 255
1774
- ],
1775
- cornsilk: [
1776
- 1,
1777
- 248 / 255,
1778
- 220 / 255
1779
- ],
1780
- crimson: [
1781
- 220 / 255,
1782
- 20 / 255,
1783
- 60 / 255
1784
- ],
1785
- cyan: [
1786
- 0,
1787
- 1,
1788
- 1
1789
- ],
1790
- darkblue: [
1791
- 0,
1792
- 0,
1793
- 139 / 255
1794
- ],
1795
- darkcyan: [
1796
- 0,
1797
- 139 / 255,
1798
- 139 / 255
1799
- ],
1800
- darkgoldenrod: [
1801
- 184 / 255,
1802
- 134 / 255,
1803
- 11 / 255
1804
- ],
1805
- darkgray: [
1806
- 169 / 255,
1807
- 169 / 255,
1808
- 169 / 255
1809
- ],
1810
- darkgreen: [
1811
- 0,
1812
- 100 / 255,
1813
- 0
1814
- ],
1815
- darkgrey: [
1816
- 169 / 255,
1817
- 169 / 255,
1818
- 169 / 255
1819
- ],
1820
- darkkhaki: [
1821
- 189 / 255,
1822
- 183 / 255,
1823
- 107 / 255
1824
- ],
1825
- darkmagenta: [
1826
- 139 / 255,
1827
- 0,
1828
- 139 / 255
1829
- ],
1830
- darkolivegreen: [
1831
- 85 / 255,
1832
- 107 / 255,
1833
- 47 / 255
1834
- ],
1835
- darkorange: [
1836
- 1,
1837
- 140 / 255,
1838
- 0
1839
- ],
1840
- darkorchid: [
1841
- 153 / 255,
1842
- 50 / 255,
1843
- 204 / 255
1844
- ],
1845
- darkred: [
1846
- 139 / 255,
1847
- 0,
1848
- 0
1849
- ],
1850
- darksalmon: [
1851
- 233 / 255,
1852
- 150 / 255,
1853
- 122 / 255
1854
- ],
1855
- darkseagreen: [
1856
- 143 / 255,
1857
- 188 / 255,
1858
- 143 / 255
1859
- ],
1860
- darkslateblue: [
1861
- 72 / 255,
1862
- 61 / 255,
1863
- 139 / 255
1864
- ],
1865
- darkslategray: [
1866
- 47 / 255,
1867
- 79 / 255,
1868
- 79 / 255
1869
- ],
1870
- darkslategrey: [
1871
- 47 / 255,
1872
- 79 / 255,
1873
- 79 / 255
1874
- ],
1875
- darkturquoise: [
1876
- 0,
1877
- 206 / 255,
1878
- 209 / 255
1879
- ],
1880
- darkviolet: [
1881
- 148 / 255,
1882
- 0,
1883
- 211 / 255
1884
- ],
1885
- deeppink: [
1886
- 1,
1887
- 20 / 255,
1888
- 147 / 255
1889
- ],
1890
- deepskyblue: [
1891
- 0,
1892
- 191 / 255,
1893
- 1
1894
- ],
1895
- dimgray: [
1896
- 105 / 255,
1897
- 105 / 255,
1898
- 105 / 255
1899
- ],
1900
- dimgrey: [
1901
- 105 / 255,
1902
- 105 / 255,
1903
- 105 / 255
1904
- ],
1905
- dodgerblue: [
1906
- 30 / 255,
1907
- 144 / 255,
1908
- 1
1909
- ],
1910
- firebrick: [
1911
- 178 / 255,
1912
- 34 / 255,
1913
- 34 / 255
1914
- ],
1915
- floralwhite: [
1916
- 1,
1917
- 250 / 255,
1918
- 240 / 255
1919
- ],
1920
- forestgreen: [
1921
- 34 / 255,
1922
- 139 / 255,
1923
- 34 / 255
1924
- ],
1925
- fuchsia: [
1926
- 1,
1927
- 0,
1928
- 1
1929
- ],
1930
- gainsboro: [
1931
- 220 / 255,
1932
- 220 / 255,
1933
- 220 / 255
1934
- ],
1935
- ghostwhite: [
1936
- 248 / 255,
1937
- 248 / 255,
1938
- 1
1939
- ],
1940
- gold: [
1941
- 1,
1942
- 215 / 255,
1943
- 0
1944
- ],
1945
- goldenrod: [
1946
- 218 / 255,
1947
- 165 / 255,
1948
- 32 / 255
1949
- ],
1950
- gray: [
1951
- 128 / 255,
1952
- 128 / 255,
1953
- 128 / 255
1954
- ],
1955
- green: [
1956
- 0,
1957
- 128 / 255,
1958
- 0
1959
- ],
1960
- greenyellow: [
1961
- 173 / 255,
1962
- 1,
1963
- 47 / 255
1964
- ],
1965
- grey: [
1966
- 128 / 255,
1967
- 128 / 255,
1968
- 128 / 255
1969
- ],
1970
- honeydew: [
1971
- 240 / 255,
1972
- 1,
1973
- 240 / 255
1974
- ],
1975
- hotpink: [
1976
- 1,
1977
- 105 / 255,
1978
- 180 / 255
1979
- ],
1980
- indianred: [
1981
- 205 / 255,
1982
- 92 / 255,
1983
- 92 / 255
1984
- ],
1985
- indigo: [
1986
- 75 / 255,
1987
- 0,
1988
- 130 / 255
1989
- ],
1990
- ivory: [
1991
- 1,
1992
- 1,
1993
- 240 / 255
1994
- ],
1995
- khaki: [
1996
- 240 / 255,
1997
- 230 / 255,
1998
- 140 / 255
1999
- ],
2000
- lavender: [
2001
- 230 / 255,
2002
- 230 / 255,
2003
- 250 / 255
2004
- ],
2005
- lavenderblush: [
2006
- 1,
2007
- 240 / 255,
2008
- 245 / 255
2009
- ],
2010
- lawngreen: [
2011
- 124 / 255,
2012
- 252 / 255,
2013
- 0
2014
- ],
2015
- lemonchiffon: [
2016
- 1,
2017
- 250 / 255,
2018
- 205 / 255
2019
- ],
2020
- lightblue: [
2021
- 173 / 255,
2022
- 216 / 255,
2023
- 230 / 255
2024
- ],
2025
- lightcoral: [
2026
- 240 / 255,
2027
- 128 / 255,
2028
- 128 / 255
2029
- ],
2030
- lightcyan: [
2031
- 224 / 255,
2032
- 1,
2033
- 1
2034
- ],
2035
- lightgoldenrodyellow: [
2036
- 250 / 255,
2037
- 250 / 255,
2038
- 210 / 255
2039
- ],
2040
- lightgray: [
2041
- 211 / 255,
2042
- 211 / 255,
2043
- 211 / 255
2044
- ],
2045
- lightgreen: [
2046
- 144 / 255,
2047
- 238 / 255,
2048
- 144 / 255
2049
- ],
2050
- lightgrey: [
2051
- 211 / 255,
2052
- 211 / 255,
2053
- 211 / 255
2054
- ],
2055
- lightpink: [
2056
- 1,
2057
- 182 / 255,
2058
- 193 / 255
2059
- ],
2060
- lightsalmon: [
2061
- 1,
2062
- 160 / 255,
2063
- 122 / 255
2064
- ],
2065
- lightseagreen: [
2066
- 32 / 255,
2067
- 178 / 255,
2068
- 170 / 255
2069
- ],
2070
- lightskyblue: [
2071
- 135 / 255,
2072
- 206 / 255,
2073
- 250 / 255
2074
- ],
2075
- lightslategray: [
2076
- 119 / 255,
2077
- 136 / 255,
2078
- 153 / 255
2079
- ],
2080
- lightslategrey: [
2081
- 119 / 255,
2082
- 136 / 255,
2083
- 153 / 255
2084
- ],
2085
- lightsteelblue: [
2086
- 176 / 255,
2087
- 196 / 255,
2088
- 222 / 255
2089
- ],
2090
- lightyellow: [
2091
- 1,
2092
- 1,
2093
- 224 / 255
2094
- ],
2095
- lime: [
2096
- 0,
2097
- 1,
2098
- 0
2099
- ],
2100
- limegreen: [
2101
- 50 / 255,
2102
- 205 / 255,
2103
- 50 / 255
2104
- ],
2105
- linen: [
2106
- 250 / 255,
2107
- 240 / 255,
2108
- 230 / 255
2109
- ],
2110
- magenta: [
2111
- 1,
2112
- 0,
2113
- 1
2114
- ],
2115
- maroon: [
2116
- 128 / 255,
2117
- 0,
2118
- 0
2119
- ],
2120
- mediumaquamarine: [
2121
- 102 / 255,
2122
- 205 / 255,
2123
- 170 / 255
2124
- ],
2125
- mediumblue: [
2126
- 0,
2127
- 0,
2128
- 205 / 255
2129
- ],
2130
- mediumorchid: [
2131
- 186 / 255,
2132
- 85 / 255,
2133
- 211 / 255
2134
- ],
2135
- mediumpurple: [
2136
- 147 / 255,
2137
- 112 / 255,
2138
- 219 / 255
2139
- ],
2140
- mediumseagreen: [
2141
- 60 / 255,
2142
- 179 / 255,
2143
- 113 / 255
2144
- ],
2145
- mediumslateblue: [
2146
- 123 / 255,
2147
- 104 / 255,
2148
- 238 / 255
2149
- ],
2150
- mediumspringgreen: [
2151
- 0,
2152
- 250 / 255,
2153
- 154 / 255
2154
- ],
2155
- mediumturquoise: [
2156
- 72 / 255,
2157
- 209 / 255,
2158
- 204 / 255
2159
- ],
2160
- mediumvioletred: [
2161
- 199 / 255,
2162
- 21 / 255,
2163
- 133 / 255
2164
- ],
2165
- midnightblue: [
2166
- 25 / 255,
2167
- 25 / 255,
2168
- 112 / 255
2169
- ],
2170
- mintcream: [
2171
- 245 / 255,
2172
- 1,
2173
- 250 / 255
2174
- ],
2175
- mistyrose: [
2176
- 1,
2177
- 228 / 255,
2178
- 225 / 255
2179
- ],
2180
- moccasin: [
2181
- 1,
2182
- 228 / 255,
2183
- 181 / 255
2184
- ],
2185
- navajowhite: [
2186
- 1,
2187
- 222 / 255,
2188
- 173 / 255
2189
- ],
2190
- navy: [
2191
- 0,
2192
- 0,
2193
- 128 / 255
2194
- ],
2195
- oldlace: [
2196
- 253 / 255,
2197
- 245 / 255,
2198
- 230 / 255
2199
- ],
2200
- olive: [
2201
- 128 / 255,
2202
- 128 / 255,
2203
- 0
2204
- ],
2205
- olivedrab: [
2206
- 107 / 255,
2207
- 142 / 255,
2208
- 35 / 255
2209
- ],
2210
- orange: [
2211
- 1,
2212
- 165 / 255,
2213
- 0
2214
- ],
2215
- orangered: [
2216
- 1,
2217
- 69 / 255,
2218
- 0
2219
- ],
2220
- orchid: [
2221
- 218 / 255,
2222
- 112 / 255,
2223
- 214 / 255
2224
- ],
2225
- palegoldenrod: [
2226
- 238 / 255,
2227
- 232 / 255,
2228
- 170 / 255
2229
- ],
2230
- palegreen: [
2231
- 152 / 255,
2232
- 251 / 255,
2233
- 152 / 255
2234
- ],
2235
- paleturquoise: [
2236
- 175 / 255,
2237
- 238 / 255,
2238
- 238 / 255
2239
- ],
2240
- palevioletred: [
2241
- 219 / 255,
2242
- 112 / 255,
2243
- 147 / 255
2244
- ],
2245
- papayawhip: [
2246
- 1,
2247
- 239 / 255,
2248
- 213 / 255
2249
- ],
2250
- peachpuff: [
2251
- 1,
2252
- 218 / 255,
2253
- 185 / 255
2254
- ],
2255
- peru: [
2256
- 205 / 255,
2257
- 133 / 255,
2258
- 63 / 255
2259
- ],
2260
- pink: [
2261
- 1,
2262
- 192 / 255,
2263
- 203 / 255
2264
- ],
2265
- plum: [
2266
- 221 / 255,
2267
- 160 / 255,
2268
- 221 / 255
2269
- ],
2270
- powderblue: [
2271
- 176 / 255,
2272
- 224 / 255,
2273
- 230 / 255
2274
- ],
2275
- purple: [
2276
- 128 / 255,
2277
- 0,
2278
- 128 / 255
2279
- ],
2280
- rebeccapurple: [
2281
- 102 / 255,
2282
- 51 / 255,
2283
- 153 / 255
2284
- ],
2285
- red: [
2286
- 1,
2287
- 0,
2288
- 0
2289
- ],
2290
- rosybrown: [
2291
- 188 / 255,
2292
- 143 / 255,
2293
- 143 / 255
2294
- ],
2295
- royalblue: [
2296
- 65 / 255,
2297
- 105 / 255,
2298
- 225 / 255
2299
- ],
2300
- saddlebrown: [
2301
- 139 / 255,
2302
- 69 / 255,
2303
- 19 / 255
2304
- ],
2305
- salmon: [
2306
- 250 / 255,
2307
- 128 / 255,
2308
- 114 / 255
2309
- ],
2310
- sandybrown: [
2311
- 244 / 255,
2312
- 164 / 255,
2313
- 96 / 255
2314
- ],
2315
- seagreen: [
2316
- 46 / 255,
2317
- 139 / 255,
2318
- 87 / 255
2319
- ],
2320
- seashell: [
2321
- 1,
2322
- 245 / 255,
2323
- 238 / 255
2324
- ],
2325
- sienna: [
2326
- 160 / 255,
2327
- 82 / 255,
2328
- 45 / 255
2329
- ],
2330
- silver: [
2331
- 192 / 255,
2332
- 192 / 255,
2333
- 192 / 255
2334
- ],
2335
- skyblue: [
2336
- 135 / 255,
2337
- 206 / 255,
2338
- 235 / 255
2339
- ],
2340
- slateblue: [
2341
- 106 / 255,
2342
- 90 / 255,
2343
- 205 / 255
2344
- ],
2345
- slategray: [
2346
- 112 / 255,
2347
- 128 / 255,
2348
- 144 / 255
2349
- ],
2350
- slategrey: [
2351
- 112 / 255,
2352
- 128 / 255,
2353
- 144 / 255
2354
- ],
2355
- snow: [
2356
- 1,
2357
- 250 / 255,
2358
- 250 / 255
2359
- ],
2360
- springgreen: [
2361
- 0,
2362
- 1,
2363
- 127 / 255
2364
- ],
2365
- steelblue: [
2366
- 70 / 255,
2367
- 130 / 255,
2368
- 180 / 255
2369
- ],
2370
- tan: [
2371
- 210 / 255,
2372
- 180 / 255,
2373
- 140 / 255
2374
- ],
2375
- teal: [
2376
- 0,
2377
- 128 / 255,
2378
- 128 / 255
2379
- ],
2380
- thistle: [
2381
- 216 / 255,
2382
- 191 / 255,
2383
- 216 / 255
2384
- ],
2385
- tomato: [
2386
- 1,
2387
- 99 / 255,
2388
- 71 / 255
2389
- ],
2390
- turquoise: [
2391
- 64 / 255,
2392
- 224 / 255,
2393
- 208 / 255
2394
- ],
2395
- violet: [
2396
- 238 / 255,
2397
- 130 / 255,
2398
- 238 / 255
2399
- ],
2400
- wheat: [
2401
- 245 / 255,
2402
- 222 / 255,
2403
- 179 / 255
2404
- ],
2405
- white: [
2406
- 1,
2407
- 1,
2408
- 1
2409
- ],
2410
- whitesmoke: [
2411
- 245 / 255,
2412
- 245 / 255,
2413
- 245 / 255
2414
- ],
2415
- yellow: [
2416
- 1,
2417
- 1,
2418
- 0
2419
- ],
2420
- yellowgreen: [
2421
- 154 / 255,
2422
- 205 / 255,
2423
- 50 / 255
2424
- ]
2425
- }, $t = Array(3).fill("<percentage> | <number>[0, 255]"), Ht = Array(3).fill("<number>[0, 255]"), re = new I({
2426
- id: "srgb",
2427
- name: "sRGB",
2428
- base: Er,
2429
- fromBase: (e) => e.map((t) => {
2430
- let r = t < 0 ? -1 : 1, a = t * r;
2431
- return a > 31308e-7 ? r * (1.055 * a ** (1 / 2.4) - 0.055) : 12.92 * t;
2432
- }),
2433
- toBase: (e) => e.map((t) => {
2434
- let r = t < 0 ? -1 : 1, a = t * r;
2435
- return a <= 0.04045 ? t / 12.92 : r * ((a + 0.055) / 1.055) ** 2.4;
2436
- }),
2437
- formats: {
2438
- rgb: { coords: $t },
2439
- rgb_number: {
2440
- name: "rgb",
2441
- commas: !0,
2442
- coords: Ht,
2443
- noAlpha: !0
2444
- },
2445
- color: {},
2446
- rgba: {
2447
- coords: $t,
2448
- commas: !0,
2449
- lastAlpha: !0
2450
- },
2451
- rgba_number: {
2452
- name: "rgba",
2453
- commas: !0,
2454
- coords: Ht
2455
- },
2456
- hex: {
2457
- type: "custom",
2458
- toGamut: !0,
2459
- test: (e) => /^#([a-f0-9]{3,4}){1,2}$/i.test(e),
2460
- parse(e) {
2461
- e.length <= 5 && (e = e.replace(/[a-f0-9]/gi, "$&$&"));
2462
- let t = [];
2463
- return e.replace(/[a-f0-9]{2}/gi, (r) => {
2464
- t.push(parseInt(r, 16) / 255);
2465
- }), {
2466
- spaceId: "srgb",
2467
- coords: t.slice(0, 3),
2468
- alpha: t.slice(3)[0]
2469
- };
2470
- },
2471
- serialize: (e, t, { collapse: r = !0 } = {}) => {
2472
- t < 1 && e.push(t), e = e.map((n) => Math.round(n * 255));
2473
- let a = r && e.every((n) => n % 17 === 0);
2474
- return "#" + e.map((n) => a ? (n / 17).toString(16) : n.toString(16).padStart(2, "0")).join("");
2475
- }
2476
- },
2477
- keyword: {
2478
- type: "custom",
2479
- test: (e) => /^[a-z]+$/i.test(e),
2480
- parse(e) {
2481
- e = e.toLowerCase();
2482
- let t = {
2483
- spaceId: "srgb",
2484
- coords: null,
2485
- alpha: 1
2486
- };
2487
- if (e === "transparent" ? (t.coords = kt.black, t.alpha = 0) : t.coords = kt[e], t.coords) return t;
2488
- }
2489
- }
2490
- }
2491
- }), Pr = new I({
2492
- id: "p3",
2493
- cssId: "display-p3",
2494
- name: "P3",
2495
- base: xr,
2496
- fromBase: re.fromBase,
2497
- toBase: re.toBase
2498
- });
2499
- E.display_space = re;
2500
- var Qa;
2501
- if (typeof CSS < "u" && CSS.supports) for (let e of [
2502
- x,
2503
- Nr,
2504
- Pr
2505
- ]) {
2506
- let t = oe({
2507
- space: e,
2508
- coords: e.getMinCoords(),
2509
- alpha: 1
2510
- });
2511
- if (CSS.supports("color", t)) {
2512
- E.display_space = e;
2513
- break;
2514
- }
2515
- }
2516
- function Ua(e, { space: t = E.display_space, ...r } = {}) {
2517
- let a = oe(e, r);
2518
- if (typeof CSS > "u" || CSS.supports("color", a) || !E.display_space)
2519
- a = new String(a), a.color = e;
2520
- else {
2521
- let n = e;
2522
- if ((e.coords.some(q) || q(e.alpha)) && !(Qa ??= CSS.supports("color", "hsl(none 50% 50%)")) && (n = ee(e), n.coords = n.coords.map(C), n.alpha = C(n.alpha), a = oe(n, r), CSS.supports("color", a)))
2523
- return a = new String(a), a.color = n, a;
2524
- n = M(n, t), a = new String(oe(n, r)), a.color = n;
2525
- }
2526
- return a;
2527
- }
2528
- function Ka(e, t) {
2529
- return e = g(e), t = g(t), e.space === t.space && e.alpha === t.alpha && e.coords.every((r, a) => r === t.coords[a]);
2530
- }
2531
- function Z(e) {
2532
- return N(e, [S, "y"]);
2533
- }
2534
- function zr(e, t) {
2535
- T(e, [S, "y"], t);
2536
- }
2537
- function Va(e) {
2538
- Object.defineProperty(e.prototype, "luminance", {
2539
- get() {
2540
- return Z(this);
2541
- },
2542
- set(t) {
2543
- zr(this, t);
2544
- }
2545
- });
2546
- }
2547
- var en = /* @__PURE__ */ Object.freeze({
2548
- __proto__: null,
2549
- getLuminance: Z,
2550
- register: Va,
2551
- setLuminance: zr
2552
- });
2553
- function tn(e, t) {
2554
- e = g(e), t = g(t);
2555
- let r = Math.max(Z(e), 0), a = Math.max(Z(t), 0);
2556
- return a > r && ([r, a] = [a, r]), (r + 0.05) / (a + 0.05);
2557
- }
2558
- var rn = 0.56, an = 0.57, nn = 0.62, sn = 0.65, Ot = 0.022, on = 1.414, ln = 0.1, un = 5e-4, fn = 1.14, Dt = 0.027, cn = 1.14;
2559
- function Tt(e) {
2560
- return e >= Ot ? e : e + (Ot - e) ** on;
2561
- }
2562
- function Q(e) {
2563
- let t = e < 0 ? -1 : 1, r = Math.abs(e);
2564
- return t * Math.pow(r, 2.4);
2565
- }
2566
- function hn(e, t) {
2567
- t = g(t), e = g(e);
2568
- let r, a, n, s, i, o;
2569
- t = M(t, "srgb"), [s, i, o] = t.coords;
2570
- let l = Q(s) * 0.2126729 + Q(i) * 0.7151522 + Q(o) * 0.072175;
2571
- e = M(e, "srgb"), [s, i, o] = e.coords;
2572
- let c = Q(s) * 0.2126729 + Q(i) * 0.7151522 + Q(o) * 0.072175, u = Tt(l), f = Tt(c), h = f > u;
2573
- return Math.abs(f - u) < un ? a = 0 : h ? (r = f ** rn - u ** an, a = r * fn) : (r = f ** sn - u ** nn, a = r * cn), Math.abs(a) < ln ? n = 0 : a > 0 ? n = a - Dt : n = a + Dt, n * 100;
2574
- }
2575
- function dn(e, t) {
2576
- e = g(e), t = g(t);
2577
- let r = Math.max(Z(e), 0), a = Math.max(Z(t), 0);
2578
- a > r && ([r, a] = [a, r]);
2579
- let n = r + a;
2580
- return n === 0 ? 0 : (r - a) / n;
2581
- }
2582
- var mn = 5e4;
2583
- function gn(e, t) {
2584
- e = g(e), t = g(t);
2585
- let r = Math.max(Z(e), 0), a = Math.max(Z(t), 0);
2586
- return a > r && ([r, a] = [a, r]), a === 0 ? mn : (r - a) / a;
2587
- }
2588
- function pn(e, t) {
2589
- e = g(e), t = g(t);
2590
- let r = N(e, [x, "l"]), a = N(t, [x, "l"]);
2591
- return Math.abs(r - a);
2592
- }
2593
- var bn = 216 / 24389, jt = 24 / 116, ye = 24389 / 27, He = L.D65, Qe = new d({
2594
- id: "lab-d65",
2595
- name: "Lab D65",
2596
- coords: {
2597
- l: {
2598
- refRange: [0, 100],
2599
- name: "Lightness"
2600
- },
2601
- a: { refRange: [-125, 125] },
2602
- b: { refRange: [-125, 125] }
2603
- },
2604
- white: He,
2605
- base: S,
2606
- fromBase(e) {
2607
- let t = e.map((r, a) => r / He[a]).map((r) => r > bn ? Math.cbrt(r) : (ye * r + 16) / 116);
2608
- return [
2609
- 116 * t[1] - 16,
2610
- 500 * (t[0] - t[1]),
2611
- 200 * (t[1] - t[2])
2612
- ];
2613
- },
2614
- toBase(e) {
2615
- let t = [];
2616
- return t[1] = (e[0] + 16) / 116, t[0] = e[1] / 500 + t[1], t[2] = t[1] - e[2] / 200, [
2617
- t[0] > jt ? Math.pow(t[0], 3) : (116 * t[0] - 16) / ye,
2618
- e[0] > 8 ? Math.pow((e[0] + 16) / 116, 3) : e[0] / ye,
2619
- t[2] > jt ? Math.pow(t[2], 3) : (116 * t[2] - 16) / ye
2620
- ].map((r, a) => r * He[a]);
2621
- },
2622
- formats: { "lab-d65": { coords: [
2623
- "<number> | <percentage>",
2624
- "<number> | <percentage>[-1,1]",
2625
- "<number> | <percentage>[-1,1]"
2626
- ] } }
2627
- }), Oe = Math.pow(5, 0.5) * 0.5 + 0.5;
2628
- function Mn(e, t) {
2629
- e = g(e), t = g(t);
2630
- let r = N(e, [Qe, "l"]), a = N(t, [Qe, "l"]), n = Math.abs(Math.pow(r, Oe) - Math.pow(a, Oe)), s = Math.pow(n, 1 / Oe) * Math.SQRT2 - 40;
2631
- return s < 7.5 ? 0 : s;
2632
- }
2633
- var _e = /* @__PURE__ */ Object.freeze({
2634
- __proto__: null,
2635
- contrastAPCA: hn,
2636
- contrastDeltaPhi: Mn,
2637
- contrastLstar: pn,
2638
- contrastMichelson: dn,
2639
- contrastWCAG21: tn,
2640
- contrastWeber: gn
2641
- });
2642
- function wn(e, t, r = {}) {
2643
- ce(r) && (r = { algorithm: r });
2644
- let { algorithm: a, ...n } = r;
2645
- if (!a) {
2646
- let s = Object.keys(_e).map((i) => i.replace(/^contrast/, "")).join(", ");
2647
- throw new TypeError(`contrast() function needs a contrast algorithm. Please specify one of: ${s}`);
2648
- }
2649
- e = g(e), t = g(t);
2650
- for (let s in _e) if ("contrast" + a.toLowerCase() === s.toLowerCase()) return _e[s](e, t, n);
2651
- throw new TypeError(`Unknown contrast algorithm: ${a}`);
2652
- }
2653
- function Ee(e) {
2654
- let [t, r, a] = he(e, S), n = t + 15 * r + 3 * a;
2655
- return [4 * t / n, 9 * r / n];
2656
- }
2657
- function Ar(e) {
2658
- let [t, r, a] = he(e, S), n = t + r + a;
2659
- return [t / n, r / n];
2660
- }
2661
- function vn(e) {
2662
- Object.defineProperty(e.prototype, "uv", { get() {
2663
- return Ee(this);
2664
- } }), Object.defineProperty(e.prototype, "xy", { get() {
2665
- return Ar(this);
2666
- } });
2667
- }
2668
- var yn = /* @__PURE__ */ Object.freeze({
2669
- __proto__: null,
2670
- register: vn,
2671
- uv: Ee,
2672
- xy: Ar
2673
- });
2674
- function ie(e, t, r = {}) {
2675
- ce(r) && (r = { method: r });
2676
- let { method: a = E.deltaE, ...n } = r;
2677
- for (let s in te) if ("deltae" + a.toLowerCase() === s.toLowerCase()) return te[s](e, t, n);
2678
- throw new TypeError(`Unknown deltaE method: ${a}`);
2679
- }
2680
- function Cn(e, t = 0.25) {
2681
- return T(e, [d.get("oklch", "lch"), "l"], (r) => r * (1 + t));
2682
- }
2683
- function Rn(e, t = 0.25) {
2684
- return T(e, [d.get("oklch", "lch"), "l"], (r) => r * (1 - t));
2685
- }
2686
- var _n = /* @__PURE__ */ Object.freeze({
2687
- __proto__: null,
2688
- darken: Rn,
2689
- lighten: Cn
2690
- });
2691
- function kr(e, t, r = 0.5, a = {}) {
2692
- return [e, t] = [g(e), g(t)], Y(r) === "object" && ([r, a] = [0.5, r]), de(e, t, a)(r);
2693
- }
2694
- function $r(e, t, r = {}) {
2695
- let a;
2696
- nt(e) && ([a, r] = [e, t], [e, t] = a.rangeArgs.colors);
2697
- let { maxDeltaE: n, deltaEMethod: s, steps: i = 2, maxSteps: o = 1e3, ...l } = r;
2698
- a || ([e, t] = [g(e), g(t)], a = de(e, t, l));
2699
- let c = ie(e, t), u = n > 0 ? Math.max(i, Math.ceil(c / n) + 1) : i, f = [];
2700
- if (o !== void 0 && (u = Math.min(u, o)), u === 1) f = [{
2701
- p: 0.5,
2702
- color: a(0.5)
2703
- }];
2704
- else {
2705
- let h = 1 / (u - 1);
2706
- f = Array.from({ length: u }, (m, p) => {
2707
- let b = p * h;
2708
- return {
2709
- p: b,
2710
- color: a(b)
2711
- };
2712
- });
2713
- }
2714
- if (n > 0) {
2715
- let h = f.reduce((m, p, b) => {
2716
- if (b === 0) return 0;
2717
- let y = ie(p.color, f[b - 1].color, s);
2718
- return Math.max(m, y);
2719
- }, 0);
2720
- for (; h > n; ) {
2721
- h = 0;
2722
- for (let m = 1; m < f.length && f.length < o; m++) {
2723
- let p = f[m - 1], b = f[m], y = (b.p + p.p) / 2, v = a(y);
2724
- h = Math.max(h, ie(v, p.color), ie(v, b.color)), f.splice(m, 0, {
2725
- p: y,
2726
- color: a(y)
2727
- }), m++;
2728
- }
2729
- }
2730
- }
2731
- return f = f.map((h) => h.color), f;
2732
- }
2733
- function de(e, t, r = {}) {
2734
- if (nt(e)) {
2735
- let [l, c] = [e, t];
2736
- return de(...l.rangeArgs.colors, {
2737
- ...l.rangeArgs.options,
2738
- ...c
2739
- });
2740
- }
2741
- let { space: a, outputSpace: n, progression: s, premultiplied: i } = r;
2742
- e = g(e), t = g(t), e = ee(e), t = ee(t);
2743
- let o = {
2744
- colors: [e, t],
2745
- options: r
2746
- };
2747
- if (a ? a = d.get(a) : a = d.registry[E.interpolationSpace] || e.space, n = n ? d.get(n) : a, e = M(e, a), t = M(t, a), e = X(e), t = X(t), a.coords.h && a.coords.h.type === "angle") {
2748
- let l = r.hue = r.hue || "shorter", c = [a, "h"], [u, f] = [N(e, c), N(t, c)];
2749
- isNaN(u) && !isNaN(f) ? u = f : isNaN(f) && !isNaN(u) && (f = u), [u, f] = oa(l, [u, f]), T(e, c, u), T(t, c, f);
2750
- }
2751
- return i && (e.coords = e.coords.map((l) => l * e.alpha), t.coords = t.coords.map((l) => l * t.alpha)), Object.assign((l) => {
2752
- l = s ? s(l) : l;
2753
- let c = e.coords.map((h, m) => {
2754
- let p = t.coords[m];
2755
- return le(h, p, l);
2756
- }), u = le(e.alpha, t.alpha, l), f = {
2757
- space: a,
2758
- coords: c,
2759
- alpha: u
2760
- };
2761
- return i && (f.coords = f.coords.map((h) => h / u)), n !== a && (f = M(f, n)), f;
2762
- }, { rangeArgs: o });
2763
- }
2764
- function nt(e) {
2765
- return Y(e) === "function" && !!e.rangeArgs;
2766
- }
2767
- E.interpolationSpace = "lab";
2768
- function Sn(e) {
2769
- e.defineFunction("mix", kr, { returns: "color" }), e.defineFunction("range", de, { returns: "function<color>" }), e.defineFunction("steps", $r, { returns: "array<color>" });
2770
- }
2771
- var Ln = /* @__PURE__ */ Object.freeze({
2772
- __proto__: null,
2773
- isRange: nt,
2774
- mix: kr,
2775
- range: de,
2776
- register: Sn,
2777
- steps: $r
2778
- }), Hr = new d({
2779
- id: "hsl",
2780
- name: "HSL",
2781
- coords: {
2782
- h: {
2783
- refRange: [0, 360],
2784
- type: "angle",
2785
- name: "Hue"
2786
- },
2787
- s: {
2788
- range: [0, 100],
2789
- name: "Saturation"
2790
- },
2791
- l: {
2792
- range: [0, 100],
2793
- name: "Lightness"
2794
- }
2795
- },
2796
- base: re,
2797
- fromBase: (e) => {
2798
- let t = Math.max(...e), r = Math.min(...e), [a, n, s] = e, [i, o, l] = [
2799
- NaN,
2800
- 0,
2801
- (r + t) / 2
2802
- ], c = t - r;
2803
- if (c !== 0) {
2804
- switch (o = l === 0 || l === 1 ? 0 : (t - l) / Math.min(l, 1 - l), t) {
2805
- case a:
2806
- i = (n - s) / c + (n < s ? 6 : 0);
2807
- break;
2808
- case n:
2809
- i = (s - a) / c + 2;
2810
- break;
2811
- case s:
2812
- i = (a - n) / c + 4;
2813
- }
2814
- i = i * 60;
2815
- }
2816
- return o < 0 && (i += 180, o = Math.abs(o)), i >= 360 && (i -= 360), [
2817
- i,
2818
- o * 100,
2819
- l * 100
2820
- ];
2821
- },
2822
- toBase: (e) => {
2823
- let [t, r, a] = e;
2824
- t = t % 360, t < 0 && (t += 360), r /= 100, a /= 100;
2825
- function n(s) {
2826
- let i = (s + t / 30) % 12, o = r * Math.min(a, 1 - a);
2827
- return a - o * Math.max(-1, Math.min(i - 3, 9 - i, 1));
2828
- }
2829
- return [
2830
- n(0),
2831
- n(8),
2832
- n(4)
2833
- ];
2834
- },
2835
- formats: {
2836
- hsl: { coords: [
2837
- "<number> | <angle>",
2838
- "<percentage>",
2839
- "<percentage>"
2840
- ] },
2841
- hsla: {
2842
- coords: [
2843
- "<number> | <angle>",
2844
- "<percentage>",
2845
- "<percentage>"
2846
- ],
2847
- commas: !0,
2848
- lastAlpha: !0
2849
- }
2850
- }
2851
- }), Or = new d({
2852
- id: "hsv",
2853
- name: "HSV",
2854
- coords: {
2855
- h: {
2856
- refRange: [0, 360],
2857
- type: "angle",
2858
- name: "Hue"
2859
- },
2860
- s: {
2861
- range: [0, 100],
2862
- name: "Saturation"
2863
- },
2864
- v: {
2865
- range: [0, 100],
2866
- name: "Value"
2867
- }
2868
- },
2869
- base: Hr,
2870
- fromBase(e) {
2871
- let [t, r, a] = e;
2872
- r /= 100, a /= 100;
2873
- let n = a + r * Math.min(a, 1 - a);
2874
- return [
2875
- t,
2876
- n === 0 ? 0 : 200 * (1 - a / n),
2877
- 100 * n
2878
- ];
2879
- },
2880
- toBase(e) {
2881
- let [t, r, a] = e;
2882
- r /= 100, a /= 100;
2883
- let n = a * (1 - r / 2);
2884
- return [
2885
- t,
2886
- n === 0 || n === 1 ? 0 : (a - n) / Math.min(n, 1 - n) * 100,
2887
- n * 100
2888
- ];
2889
- },
2890
- formats: { color: {
2891
- id: "--hsv",
2892
- coords: [
2893
- "<number> | <angle>",
2894
- "<percentage> | <number>",
2895
- "<percentage> | <number>"
2896
- ]
2897
- } }
2898
- }), Bn = new d({
2899
- id: "hwb",
2900
- name: "HWB",
2901
- coords: {
2902
- h: {
2903
- refRange: [0, 360],
2904
- type: "angle",
2905
- name: "Hue"
2906
- },
2907
- w: {
2908
- range: [0, 100],
2909
- name: "Whiteness"
2910
- },
2911
- b: {
2912
- range: [0, 100],
2913
- name: "Blackness"
2914
- }
2915
- },
2916
- base: Or,
2917
- fromBase(e) {
2918
- let [t, r, a] = e;
2919
- return [
2920
- t,
2921
- a * (100 - r) / 100,
2922
- 100 - a
2923
- ];
2924
- },
2925
- toBase(e) {
2926
- let [t, r, a] = e;
2927
- r /= 100, a /= 100;
2928
- let n = r + a;
2929
- if (n >= 1) return [
2930
- t,
2931
- 0,
2932
- r / n * 100
2933
- ];
2934
- let s = 1 - a;
2935
- return [
2936
- t,
2937
- (s === 0 ? 0 : 1 - r / s) * 100,
2938
- s * 100
2939
- ];
2940
- },
2941
- formats: { hwb: { coords: [
2942
- "<number> | <angle>",
2943
- "<percentage> | <number>",
2944
- "<percentage> | <number>"
2945
- ] } }
2946
- }), Dr = new I({
2947
- id: "a98rgb-linear",
2948
- cssId: "--a98-rgb-linear",
2949
- name: "Linear Adobe® 98 RGB compatible",
2950
- white: "D65",
2951
- toXYZ_M: [
2952
- [
2953
- 0.5766690429101305,
2954
- 0.1855582379065463,
2955
- 0.1882286462349947
2956
- ],
2957
- [
2958
- 0.29734497525053605,
2959
- 0.6273635662554661,
2960
- 0.07529145849399788
2961
- ],
2962
- [
2963
- 0.02703136138641234,
2964
- 0.07068885253582723,
2965
- 0.9913375368376388
2966
- ]
2967
- ],
2968
- fromXYZ_M: [
2969
- [
2970
- 2.0415879038107465,
2971
- -0.5650069742788596,
2972
- -0.34473135077832956
2973
- ],
2974
- [
2975
- -0.9692436362808795,
2976
- 1.8759675015077202,
2977
- 0.04155505740717557
2978
- ],
2979
- [
2980
- 0.013444280632031142,
2981
- -0.11836239223101838,
2982
- 1.0151749943912054
2983
- ]
2984
- ]
2985
- }), In = new I({
2986
- id: "a98rgb",
2987
- cssId: "a98-rgb",
2988
- name: "Adobe® 98 RGB compatible",
2989
- base: Dr,
2990
- toBase: (e) => e.map((t) => Math.pow(Math.abs(t), 563 / 256) * Math.sign(t)),
2991
- fromBase: (e) => e.map((t) => Math.pow(Math.abs(t), 256 / 563) * Math.sign(t))
2992
- }), Tr = new I({
2993
- id: "prophoto-linear",
2994
- cssId: "--prophoto-rgb-linear",
2995
- name: "Linear ProPhoto",
2996
- white: "D50",
2997
- base: tt,
2998
- toXYZ_M: [
2999
- [
3000
- 0.7977666449006423,
3001
- 0.13518129740053308,
3002
- 0.0313477341283922
3003
- ],
3004
- [
3005
- 0.2880748288194013,
3006
- 0.711835234241873,
3007
- 8993693872564e-17
3008
- ],
3009
- [
3010
- 0,
3011
- 0,
3012
- 0.8251046025104602
3013
- ]
3014
- ],
3015
- fromXYZ_M: [
3016
- [
3017
- 1.3457868816471583,
3018
- -0.25557208737979464,
3019
- -0.05110186497554526
3020
- ],
3021
- [
3022
- -0.5446307051249019,
3023
- 1.5082477428451468,
3024
- 0.02052744743642139
3025
- ],
3026
- [
3027
- 0,
3028
- 0,
3029
- 1.2119675456389452
3030
- ]
3031
- ]
3032
- }), Nn = 1 / 512, xn = 16 / 512, En = new I({
3033
- id: "prophoto",
3034
- cssId: "prophoto-rgb",
3035
- name: "ProPhoto",
3036
- base: Tr,
3037
- toBase(e) {
3038
- return e.map((t) => t < xn ? t / 16 : t ** 1.8);
3039
- },
3040
- fromBase(e) {
3041
- return e.map((t) => t >= Nn ? t ** (1 / 1.8) : 16 * t);
3042
- }
3043
- }), Pn = new d({
3044
- id: "oklch",
3045
- name: "Oklch",
3046
- coords: {
3047
- l: {
3048
- refRange: [0, 1],
3049
- name: "Lightness"
3050
- },
3051
- c: {
3052
- refRange: [0, 0.4],
3053
- name: "Chroma"
3054
- },
3055
- h: {
3056
- refRange: [0, 360],
3057
- type: "angle",
3058
- name: "Hue"
3059
- }
3060
- },
3061
- white: "D65",
3062
- base: V,
3063
- fromBase(e) {
3064
- let [t, r, a] = e, n;
3065
- const s = 2e-4;
3066
- return Math.abs(r) < s && Math.abs(a) < s ? n = NaN : n = Math.atan2(a, r) * 180 / Math.PI, [
3067
- t,
3068
- Math.sqrt(r ** 2 + a ** 2),
3069
- H(n)
3070
- ];
3071
- },
3072
- toBase(e) {
3073
- let [t, r, a] = e, n, s;
3074
- return isNaN(a) ? (n = 0, s = 0) : (n = r * Math.cos(a * Math.PI / 180), s = r * Math.sin(a * Math.PI / 180)), [
3075
- t,
3076
- n,
3077
- s
3078
- ];
3079
- },
3080
- formats: { oklch: { coords: [
3081
- "<percentage> | <number>",
3082
- "<number> | <percentage>[0,1]",
3083
- "<number> | <angle>"
3084
- ] } }
3085
- }), jr = L.D65, zn = 216 / 24389, Yt = 24389 / 27, [qt, Gt] = Ee({
3086
- space: S,
3087
- coords: jr
3088
- }), Yr = new d({
3089
- id: "luv",
3090
- name: "Luv",
3091
- coords: {
3092
- l: {
3093
- refRange: [0, 100],
3094
- name: "Lightness"
3095
- },
3096
- u: { refRange: [-215, 215] },
3097
- v: { refRange: [-215, 215] }
3098
- },
3099
- white: jr,
3100
- base: S,
3101
- fromBase(e) {
3102
- let t = [
3103
- C(e[0]),
3104
- C(e[1]),
3105
- C(e[2])
3106
- ], r = t[1], [a, n] = Ee({
3107
- space: S,
3108
- coords: t
3109
- });
3110
- if (!Number.isFinite(a) || !Number.isFinite(n)) return [
3111
- 0,
3112
- 0,
3113
- 0
3114
- ];
3115
- let s = r <= zn ? Yt * r : 116 * Math.cbrt(r) - 16;
3116
- return [
3117
- s,
3118
- 13 * s * (a - qt),
3119
- 13 * s * (n - Gt)
3120
- ];
3121
- },
3122
- toBase(e) {
3123
- let [t, r, a] = e;
3124
- if (t === 0 || q(t)) return [
3125
- 0,
3126
- 0,
3127
- 0
3128
- ];
3129
- r = C(r), a = C(a);
3130
- let n = r / (13 * t) + qt, s = a / (13 * t) + Gt, i = t <= 8 ? t / Yt : Math.pow((t + 16) / 116, 3);
3131
- return [
3132
- i * (9 * n / (4 * s)),
3133
- i,
3134
- i * ((12 - 3 * n - 20 * s) / (4 * s))
3135
- ];
3136
- },
3137
- formats: { color: {
3138
- id: "--luv",
3139
- coords: [
3140
- "<number> | <percentage>",
3141
- "<number> | <percentage>[-1,1]",
3142
- "<number> | <percentage>[-1,1]"
3143
- ]
3144
- } }
3145
- }), st = new d({
3146
- id: "lchuv",
3147
- name: "LChuv",
3148
- coords: {
3149
- l: {
3150
- refRange: [0, 100],
3151
- name: "Lightness"
3152
- },
3153
- c: {
3154
- refRange: [0, 220],
3155
- name: "Chroma"
3156
- },
3157
- h: {
3158
- refRange: [0, 360],
3159
- type: "angle",
3160
- name: "Hue"
3161
- }
3162
- },
3163
- base: Yr,
3164
- fromBase(e) {
3165
- let [t, r, a] = e, n;
3166
- const s = 0.02;
3167
- return Math.abs(r) < s && Math.abs(a) < s ? n = NaN : n = Math.atan2(a, r) * 180 / Math.PI, [
3168
- t,
3169
- Math.sqrt(r ** 2 + a ** 2),
3170
- H(n)
3171
- ];
3172
- },
3173
- toBase(e) {
3174
- let [t, r, a] = e;
3175
- return r < 0 && (r = 0), isNaN(a) && (a = 0), [
3176
- t,
3177
- r * Math.cos(a * Math.PI / 180),
3178
- r * Math.sin(a * Math.PI / 180)
3179
- ];
3180
- },
3181
- formats: { color: {
3182
- id: "--lchuv",
3183
- coords: [
3184
- "<number> | <percentage>",
3185
- "<number> | <percentage>",
3186
- "<number> | <angle>"
3187
- ]
3188
- } }
3189
- }), An = 216 / 24389, kn = 24389 / 27, Xt = R[0][0], Zt = R[0][1], De = R[0][2], Ft = R[1][0], Jt = R[1][1], Te = R[1][2], Wt = R[2][0], Qt = R[2][1], je = R[2][2];
3190
- function U(e, t, r) {
3191
- const a = t / (Math.sin(r) - e * Math.cos(r));
3192
- return a < 0 ? 1 / 0 : a;
3193
- }
3194
- function Ie(e) {
3195
- const t = Math.pow(e + 16, 3) / 1560896, r = t > An ? t : e / kn, a = r * (284517 * Xt - 94839 * De), n = r * (838422 * De + 769860 * Zt + 731718 * Xt), s = r * (632260 * De - 126452 * Zt), i = r * (284517 * Ft - 94839 * Te), o = r * (838422 * Te + 769860 * Jt + 731718 * Ft), l = r * (632260 * Te - 126452 * Jt), c = r * (284517 * Wt - 94839 * je), u = r * (838422 * je + 769860 * Qt + 731718 * Wt), f = r * (632260 * je - 126452 * Qt);
3196
- return {
3197
- r0s: a / s,
3198
- r0i: n * e / s,
3199
- r1s: a / (s + 126452),
3200
- r1i: (n - 769860) * e / (s + 126452),
3201
- g0s: i / l,
3202
- g0i: o * e / l,
3203
- g1s: i / (l + 126452),
3204
- g1i: (o - 769860) * e / (l + 126452),
3205
- b0s: c / f,
3206
- b0i: u * e / f,
3207
- b1s: c / (f + 126452),
3208
- b1i: (u - 769860) * e / (f + 126452)
3209
- };
3210
- }
3211
- function Ut(e, t) {
3212
- const r = t / 360 * Math.PI * 2, a = U(e.r0s, e.r0i, r), n = U(e.r1s, e.r1i, r), s = U(e.g0s, e.g0i, r), i = U(e.g1s, e.g1i, r), o = U(e.b0s, e.b0i, r), l = U(e.b1s, e.b1i, r);
3213
- return Math.min(a, n, s, i, o, l);
3214
- }
3215
- var $n = new d({
3216
- id: "hsluv",
3217
- name: "HSLuv",
3218
- coords: {
3219
- h: {
3220
- refRange: [0, 360],
3221
- type: "angle",
3222
- name: "Hue"
3223
- },
3224
- s: {
3225
- range: [0, 100],
3226
- name: "Saturation"
3227
- },
3228
- l: {
3229
- range: [0, 100],
3230
- name: "Lightness"
3231
- }
3232
- },
3233
- base: st,
3234
- gamutSpace: re,
3235
- fromBase(e) {
3236
- let [t, r, a] = [
3237
- C(e[0]),
3238
- C(e[1]),
3239
- C(e[2])
3240
- ], n;
3241
- return t > 99.9999999 ? (n = 0, t = 100) : t < 1e-8 ? (n = 0, t = 0) : n = r / Ut(Ie(t), a) * 100, [
3242
- a,
3243
- n,
3244
- t
3245
- ];
3246
- },
3247
- toBase(e) {
3248
- let [t, r, a] = [
3249
- C(e[0]),
3250
- C(e[1]),
3251
- C(e[2])
3252
- ], n;
3253
- return a > 99.9999999 ? (a = 100, n = 0) : a < 1e-8 ? (a = 0, n = 0) : n = Ut(Ie(a), t) / 100 * r, [
3254
- a,
3255
- n,
3256
- t
3257
- ];
3258
- },
3259
- formats: { color: {
3260
- id: "--hsluv",
3261
- coords: [
3262
- "<number> | <angle>",
3263
- "<percentage> | <number>",
3264
- "<percentage> | <number>"
3265
- ]
3266
- } }
3267
- });
3268
- R[0][0];
3269
- R[0][1];
3270
- R[0][2];
3271
- R[1][0];
3272
- R[1][1];
3273
- R[1][2];
3274
- R[2][0];
3275
- R[2][1];
3276
- R[2][2];
3277
- function K(e, t) {
3278
- return Math.abs(t) / Math.sqrt(Math.pow(e, 2) + 1);
3279
- }
3280
- function Kt(e) {
3281
- let t = K(e.r0s, e.r0i), r = K(e.r1s, e.r1i), a = K(e.g0s, e.g0i), n = K(e.g1s, e.g1i), s = K(e.b0s, e.b0i), i = K(e.b1s, e.b1i);
3282
- return Math.min(t, r, a, n, s, i);
3283
- }
3284
- var Hn = new d({
3285
- id: "hpluv",
3286
- name: "HPLuv",
3287
- coords: {
3288
- h: {
3289
- refRange: [0, 360],
3290
- type: "angle",
3291
- name: "Hue"
3292
- },
3293
- s: {
3294
- range: [0, 100],
3295
- name: "Saturation"
3296
- },
3297
- l: {
3298
- range: [0, 100],
3299
- name: "Lightness"
3300
- }
3301
- },
3302
- base: st,
3303
- gamutSpace: "self",
3304
- fromBase(e) {
3305
- let [t, r, a] = [
3306
- C(e[0]),
3307
- C(e[1]),
3308
- C(e[2])
3309
- ], n;
3310
- return t > 99.9999999 ? (n = 0, t = 100) : t < 1e-8 ? (n = 0, t = 0) : n = r / Kt(Ie(t)) * 100, [
3311
- a,
3312
- n,
3313
- t
3314
- ];
3315
- },
3316
- toBase(e) {
3317
- let [t, r, a] = [
3318
- C(e[0]),
3319
- C(e[1]),
3320
- C(e[2])
3321
- ], n;
3322
- return a > 99.9999999 ? (a = 100, n = 0) : a < 1e-8 ? (a = 0, n = 0) : n = Kt(Ie(a)) / 100 * r, [
3323
- a,
3324
- n,
3325
- t
3326
- ];
3327
- },
3328
- formats: { color: {
3329
- id: "--hpluv",
3330
- coords: [
3331
- "<number> | <angle>",
3332
- "<percentage> | <number>",
3333
- "<percentage> | <number>"
3334
- ]
3335
- } }
3336
- }), Vt = 203, er = 2610 / 2 ** 14, On = 2 ** 14 / 2610, Dn = 2523 / 2 ** 5, tr = 2 ** 5 / 2523, rr = 3424 / 2 ** 12, ar = 2413 / 2 ** 7, nr = 2392 / 2 ** 7, Tn = new I({
3337
- id: "rec2100pq",
3338
- cssId: "rec2100-pq",
3339
- name: "REC.2100-PQ",
3340
- base: xe,
3341
- toBase(e) {
3342
- return e.map(function(t) {
3343
- return (Math.max(t ** tr - rr, 0) / (ar - nr * t ** tr)) ** On * 1e4 / Vt;
3344
- });
3345
- },
3346
- fromBase(e) {
3347
- return e.map(function(t) {
3348
- let r = Math.max(t * Vt / 1e4, 0);
3349
- return ((rr + ar * r ** er) / (1 + nr * r ** er)) ** Dn;
3350
- });
3351
- }
3352
- }), sr = 0.17883277, ir = 0.28466892, or = 0.55991073, Ye = 3.7743, jn = new I({
3353
- id: "rec2100hlg",
3354
- cssId: "rec2100-hlg",
3355
- name: "REC.2100-HLG",
3356
- referred: "scene",
3357
- base: xe,
3358
- toBase(e) {
3359
- return e.map(function(t) {
3360
- return t <= 0.5 ? t ** 2 / 3 * Ye : (Math.exp((t - or) / sr) + ir) / 12 * Ye;
3361
- });
3362
- },
3363
- fromBase(e) {
3364
- return e.map(function(t) {
3365
- return t /= Ye, t <= 1 / 12 ? Math.sqrt(3 * t) : sr * Math.log(12 * t - ir) + or;
3366
- });
3367
- }
3368
- }), qr = {};
3369
- G.add("chromatic-adaptation-start", (e) => {
3370
- e.options.method && (e.M = Gr(e.W1, e.W2, e.options.method));
3371
- });
3372
- G.add("chromatic-adaptation-end", (e) => {
3373
- e.M || (e.M = Gr(e.W1, e.W2, e.options.method));
3374
- });
3375
- function Pe({ id: e, toCone_M: t, fromCone_M: r }) {
3376
- qr[e] = arguments[0];
3377
- }
3378
- function Gr(e, t, r = "Bradford") {
3379
- let a = qr[r], [n, s, i] = w(a.toCone_M, e), [o, l, c] = w(a.toCone_M, t), u = w([
3380
- [
3381
- o / n,
3382
- 0,
3383
- 0
3384
- ],
3385
- [
3386
- 0,
3387
- l / s,
3388
- 0
3389
- ],
3390
- [
3391
- 0,
3392
- 0,
3393
- c / i
3394
- ]
3395
- ], a.toCone_M);
3396
- return w(a.fromCone_M, u);
3397
- }
3398
- Pe({
3399
- id: "von Kries",
3400
- toCone_M: [
3401
- [
3402
- 0.40024,
3403
- 0.7076,
3404
- -0.08081
3405
- ],
3406
- [
3407
- -0.2263,
3408
- 1.16532,
3409
- 0.0457
3410
- ],
3411
- [
3412
- 0,
3413
- 0,
3414
- 0.91822
3415
- ]
3416
- ],
3417
- fromCone_M: [
3418
- [
3419
- 1.8599363874558397,
3420
- -1.1293816185800916,
3421
- 0.21989740959619328
3422
- ],
3423
- [
3424
- 0.3611914362417676,
3425
- 0.6388124632850422,
3426
- -6370596838649899e-21
3427
- ],
3428
- [
3429
- 0,
3430
- 0,
3431
- 1.0890636230968613
3432
- ]
3433
- ]
3434
- });
3435
- Pe({
3436
- id: "Bradford",
3437
- toCone_M: [
3438
- [
3439
- 0.8951,
3440
- 0.2664,
3441
- -0.1614
3442
- ],
3443
- [
3444
- -0.7502,
3445
- 1.7135,
3446
- 0.0367
3447
- ],
3448
- [
3449
- 0.0389,
3450
- -0.0685,
3451
- 1.0296
3452
- ]
3453
- ],
3454
- fromCone_M: [
3455
- [
3456
- 0.9869929054667121,
3457
- -0.14705425642099013,
3458
- 0.15996265166373122
3459
- ],
3460
- [
3461
- 0.4323052697233945,
3462
- 0.5183602715367774,
3463
- 0.049291228212855594
3464
- ],
3465
- [
3466
- -0.00852866457517732,
3467
- 0.04004282165408486,
3468
- 0.96848669578755
3469
- ]
3470
- ]
3471
- });
3472
- Pe({
3473
- id: "CAT02",
3474
- toCone_M: [
3475
- [
3476
- 0.7328,
3477
- 0.4296,
3478
- -0.1624
3479
- ],
3480
- [
3481
- -0.7036,
3482
- 1.6975,
3483
- 61e-4
3484
- ],
3485
- [
3486
- 3e-3,
3487
- 0.0136,
3488
- 0.9834
3489
- ]
3490
- ],
3491
- fromCone_M: [
3492
- [
3493
- 1.0961238208355142,
3494
- -0.27886900021828726,
3495
- 0.18274517938277307
3496
- ],
3497
- [
3498
- 0.4543690419753592,
3499
- 0.4735331543074117,
3500
- 0.07209780371722911
3501
- ],
3502
- [
3503
- -0.009627608738429355,
3504
- -0.00569803121611342,
3505
- 1.0153256399545427
3506
- ]
3507
- ]
3508
- });
3509
- Pe({
3510
- id: "CAT16",
3511
- toCone_M: [
3512
- [
3513
- 0.401288,
3514
- 0.650173,
3515
- -0.051461
3516
- ],
3517
- [
3518
- -0.250268,
3519
- 1.204414,
3520
- 0.045854
3521
- ],
3522
- [
3523
- -2079e-6,
3524
- 0.048952,
3525
- 0.953127
3526
- ]
3527
- ],
3528
- fromCone_M: [
3529
- [
3530
- 1.862067855087233,
3531
- -1.0112546305316845,
3532
- 0.14918677544445172
3533
- ],
3534
- [
3535
- 0.3875265432361372,
3536
- 0.6214474419314753,
3537
- -0.008973985167612521
3538
- ],
3539
- [
3540
- -0.01584149884933386,
3541
- -0.03412293802851557,
3542
- 1.0499644368778496
3543
- ]
3544
- ]
3545
- });
3546
- Object.assign(L, {
3547
- A: [
3548
- 1.0985,
3549
- 1,
3550
- 0.35585
3551
- ],
3552
- C: [
3553
- 0.98074,
3554
- 1,
3555
- 1.18232
3556
- ],
3557
- D55: [
3558
- 0.95682,
3559
- 1,
3560
- 0.92149
3561
- ],
3562
- D75: [
3563
- 0.94972,
3564
- 1,
3565
- 1.22638
3566
- ],
3567
- E: [
3568
- 1,
3569
- 1,
3570
- 1
3571
- ],
3572
- F2: [
3573
- 0.99186,
3574
- 1,
3575
- 0.67393
3576
- ],
3577
- F7: [
3578
- 0.95041,
3579
- 1,
3580
- 1.08747
3581
- ],
3582
- F11: [
3583
- 1.00962,
3584
- 1,
3585
- 0.6435
3586
- ]
3587
- });
3588
- L.ACES = [
3589
- 0.32168 / 0.33767,
3590
- 1,
3591
- 0.34065 / 0.33767
3592
- ];
3593
- var Xr = new I({
3594
- id: "acescg",
3595
- cssId: "--acescg",
3596
- name: "ACEScg",
3597
- coords: {
3598
- r: {
3599
- range: [0, 65504],
3600
- name: "Red"
3601
- },
3602
- g: {
3603
- range: [0, 65504],
3604
- name: "Green"
3605
- },
3606
- b: {
3607
- range: [0, 65504],
3608
- name: "Blue"
3609
- }
3610
- },
3611
- referred: "scene",
3612
- white: L.ACES,
3613
- toXYZ_M: [
3614
- [
3615
- 0.6624541811085053,
3616
- 0.13400420645643313,
3617
- 0.1561876870049078
3618
- ],
3619
- [
3620
- 0.27222871678091454,
3621
- 0.6740817658111484,
3622
- 0.05368951740793705
3623
- ],
3624
- [
3625
- -0.005574649490394108,
3626
- 0.004060733528982826,
3627
- 1.0103391003129971
3628
- ]
3629
- ],
3630
- fromXYZ_M: [
3631
- [
3632
- 1.6410233796943257,
3633
- -0.32480329418479,
3634
- -0.23642469523761225
3635
- ],
3636
- [
3637
- -0.6636628587229829,
3638
- 1.6153315916573379,
3639
- 0.016756347685530137
3640
- ],
3641
- [
3642
- 0.011721894328375376,
3643
- -0.008284441996237409,
3644
- 0.9883948585390215
3645
- ]
3646
- ]
3647
- }), Ce = 2 ** -16, qe = -0.35828683, Re = (Math.log2(65504) + 9.72) / 17.52, Yn = new I({
3648
- id: "acescc",
3649
- cssId: "--acescc",
3650
- name: "ACEScc",
3651
- coords: {
3652
- r: {
3653
- range: [qe, Re],
3654
- name: "Red"
3655
- },
3656
- g: {
3657
- range: [qe, Re],
3658
- name: "Green"
3659
- },
3660
- b: {
3661
- range: [qe, Re],
3662
- name: "Blue"
3663
- }
3664
- },
3665
- referred: "scene",
3666
- base: Xr,
3667
- toBase(e) {
3668
- const t = -0.3013698630136986;
3669
- return e.map(function(r) {
3670
- return r <= t ? (2 ** (r * 17.52 - 9.72) - Ce) * 2 : r < Re ? 2 ** (r * 17.52 - 9.72) : 65504;
3671
- });
3672
- },
3673
- fromBase(e) {
3674
- return e.map(function(t) {
3675
- return t <= 0 ? (Math.log2(Ce) + 9.72) / 17.52 : t < Ce ? (Math.log2(Ce + t * 0.5) + 9.72) / 17.52 : (Math.log2(t) + 9.72) / 17.52;
3676
- });
3677
- }
3678
- }), lr = /* @__PURE__ */ Object.freeze({
3679
- __proto__: null,
3680
- A98RGB: In,
3681
- A98RGB_Linear: Dr,
3682
- ACEScc: Yn,
3683
- ACEScg: Xr,
3684
- CAM16_JMh: Da,
3685
- HCT: fe,
3686
- HPLuv: Hn,
3687
- HSL: Hr,
3688
- HSLuv: $n,
3689
- HSV: Or,
3690
- HWB: Bn,
3691
- ICTCP: Fe,
3692
- JzCzHz: Ze,
3693
- Jzazbz: wr,
3694
- LCH: ue,
3695
- LCHuv: st,
3696
- Lab: x,
3697
- Lab_D65: Qe,
3698
- Luv: Yr,
3699
- OKLCH: Pn,
3700
- OKLab: V,
3701
- P3: Pr,
3702
- P3_Linear: xr,
3703
- ProPhoto: En,
3704
- ProPhoto_Linear: Tr,
3705
- REC_2020: Nr,
3706
- REC_2020_Linear: xe,
3707
- REC_2100_HLG: jn,
3708
- REC_2100_PQ: Tn,
3709
- XYZ_ABS_D65: rt,
3710
- XYZ_D50: tt,
3711
- XYZ_D65: S,
3712
- sRGB: re,
3713
- sRGB_Linear: Er
3714
- }), P = class B {
3715
- /**
3716
- * Creates an instance of Color.
3717
- * Signatures:
3718
- * - `new Color(stringToParse)`
3719
- * - `new Color(otherColor)`
3720
- * - `new Color({space, coords, alpha})`
3721
- * - `new Color(space, coords, alpha)`
3722
- * - `new Color(spaceId, coords, alpha)`
3723
- */
3724
- constructor(...t) {
3725
- let r;
3726
- t.length === 1 && (r = g(t[0]));
3727
- let a, n, s;
3728
- r ? (a = r.space || r.spaceId, n = r.coords, s = r.alpha) : [a, n, s] = t, Object.defineProperty(this, "space", {
3729
- value: d.get(a),
3730
- writable: !1,
3731
- enumerable: !0,
3732
- configurable: !0
3733
- }), this.coords = n ? n.slice() : [
3734
- 0,
3735
- 0,
3736
- 0
3737
- ], this.alpha = s > 1 || s === void 0 ? 1 : s < 0 ? 0 : s;
3738
- for (let i = 0; i < this.coords.length; i++) this.coords[i] === "NaN" && (this.coords[i] = NaN);
3739
- for (let i in this.space.coords) Object.defineProperty(this, i, {
3740
- get: () => this.get(i),
3741
- set: (o) => this.set(i, o)
3742
- });
3743
- }
3744
- get spaceId() {
3745
- return this.space.id;
3746
- }
3747
- clone() {
3748
- return new B(this.space, this.coords, this.alpha);
3749
- }
3750
- toJSON() {
3751
- return {
3752
- spaceId: this.spaceId,
3753
- coords: this.coords,
3754
- alpha: this.alpha
3755
- };
3756
- }
3757
- display(...t) {
3758
- let r = Ua(this, ...t);
3759
- return r.color = new B(r.color), r;
3760
- }
3761
- /**
3762
- * Get a color from the argument passed
3763
- * Basically gets us the same result as new Color(color) but doesn't clone an existing color object
3764
- */
3765
- static get(t, ...r) {
3766
- return t instanceof B ? t : new B(t, ...r);
3767
- }
3768
- static defineFunction(t, r, a = r) {
3769
- let { instance: n = !0, returns: s } = a, i = function(...o) {
3770
- let l = r(...o);
3771
- if (s === "color") l = B.get(l);
3772
- else if (s === "function<color>") {
3773
- let c = l;
3774
- l = function(...u) {
3775
- let f = c(...u);
3776
- return B.get(f);
3777
- }, Object.assign(l, c);
3778
- } else s === "array<color>" && (l = l.map((c) => B.get(c)));
3779
- return l;
3780
- };
3781
- t in B || (B[t] = i), n && (B.prototype[t] = function(...o) {
3782
- return i(this, ...o);
3783
- });
3784
- }
3785
- static defineFunctions(t) {
3786
- for (let r in t) B.defineFunction(r, t[r], t[r]);
3787
- }
3788
- static extend(t) {
3789
- if (t.register) t.register(B);
3790
- else for (let r in t) B.defineFunction(r, t[r]);
3791
- }
3792
- };
3793
- P.defineFunctions({
3794
- get: N,
3795
- getAll: he,
3796
- set: T,
3797
- setAll: et,
3798
- to: M,
3799
- equals: Ka,
3800
- inGamut: J,
3801
- toGamut: X,
3802
- distance: Mr,
3803
- toString: oe
3804
- });
3805
- Object.assign(P, {
3806
- util: ta,
3807
- hooks: G,
3808
- WHITES: L,
3809
- Space: d,
3810
- spaces: d.registry,
3811
- parse: pr,
3812
- defaults: E
3813
- });
3814
- for (let e of Object.keys(lr)) d.register(lr[e]);
3815
- for (let e in d.registry) Ue(e, d.registry[e]);
3816
- G.add("colorspace-init-end", (e) => {
3817
- Ue(e.id, e), e.aliases?.forEach((t) => {
3818
- Ue(t, e);
3819
- });
3820
- });
3821
- function Ue(e, t) {
3822
- let r = e.replace(/-/g, "_");
3823
- Object.defineProperty(P.prototype, r, {
3824
- get() {
3825
- let a = this.getAll(e);
3826
- return typeof Proxy > "u" ? a : new Proxy(a, {
3827
- has: (n, s) => {
3828
- try {
3829
- return d.resolveCoord([t, s]), !0;
3830
- } catch {
3831
- }
3832
- return Reflect.has(n, s);
3833
- },
3834
- get: (n, s, i) => {
3835
- if (s && typeof s != "symbol" && !(s in n)) {
3836
- let { index: o } = d.resolveCoord([t, s]);
3837
- if (o >= 0) return n[o];
3838
- }
3839
- return Reflect.get(n, s, i);
3840
- },
3841
- set: (n, s, i, o) => {
3842
- if (s && typeof s != "symbol" && !(s in n) || s >= 0) {
3843
- let { index: l } = d.resolveCoord([t, s]);
3844
- if (l >= 0)
3845
- return n[l] = i, this.setAll(e, n), !0;
3846
- }
3847
- return Reflect.set(n, s, i, o);
3848
- }
3849
- });
3850
- },
3851
- set(a) {
3852
- this.setAll(e, a);
3853
- },
3854
- configurable: !0,
3855
- enumerable: !0
3856
- });
3857
- }
3858
- P.extend(te);
3859
- P.extend({ deltaE: ie });
3860
- Object.assign(P, { deltaEMethods: te });
3861
- P.extend(_n);
3862
- P.extend({ contrast: wn });
3863
- P.extend(yn);
3864
- P.extend(en);
3865
- P.extend(Ln);
3866
- P.extend(_e);
3867
- var { vec2: qn, vec4: Gn } = Ur;
3868
- const Fn = (e) => {
3869
- const t = new P(e), r = t.to("p3-linear").coords, a = r[0], n = r[1], s = r[2], i = t.alpha;
3870
- return {
3871
- node: Gn(a, n, s, i),
3872
- data: new Vr(a, n, s, i)
3873
- };
3874
- }, Jn = (e) => {
3875
- let t = 0.5, r = 0.5;
3876
- const a = (s, i = !1) => {
3877
- if (typeof s == "number") return s;
3878
- const o = s.toLowerCase().trim();
3879
- if (i) {
3880
- if (o === "top") return 0;
3881
- if (o === "bottom") return 1;
3882
- if (o === "center") return 0.5;
3883
- } else {
3884
- if (o === "left") return 0;
3885
- if (o === "right") return 1;
3886
- if (o === "center") return 0.5;
3887
- }
3888
- return console.warn(`Invalid position value: ${s}. Defaulting to center.`), 0.5;
3889
- };
3890
- if (typeof e == "string") {
3891
- const s = e.toLowerCase().trim().split(/\s+/);
3892
- s.includes("left") ? t = 0 : s.includes("right") ? t = 1 : (s.includes("center") || s.length === 1 && (s[0] === "top" || s[0] === "bottom")) && (t = 0.5), s.includes("top") ? r = 0 : s.includes("bottom") ? r = 1 : (s.includes("center") || s.length === 1 && (s[0] === "left" || s[0] === "right")) && (r = 0.5), s.length === 1 && s[0] === "center" && (t = 0.5, r = 0.5);
3893
- } else typeof e == "object" && e !== null ? (t = a(e.x, !1), r = a(e.y, !0)) : console.warn(`Invalid position value provided: ${e}. Defaulting to center.`);
3894
- const n = 1 - r;
3895
- return {
3896
- node: qn(t, n),
3897
- data: new Kr(t, n)
3898
- };
3899
- }, Wn = (e) => {
3900
- if (typeof e == "number") return (e % 360 + 360) % 360;
3901
- const t = e.toLowerCase().trim();
3902
- switch (t) {
3903
- case "to right":
3904
- return 0;
3905
- case "to bottom":
3906
- return 90;
3907
- case "to left":
3908
- return 180;
3909
- case "to top":
3910
- return 270;
3911
- case "to bottom right":
3912
- case "to right bottom":
3913
- return 45;
3914
- case "to bottom left":
3915
- case "to left bottom":
3916
- return 135;
3917
- case "to top left":
3918
- case "to left top":
3919
- return 225;
3920
- case "to top right":
3921
- case "to right top":
3922
- return 315;
3923
- case "from left":
3924
- return 0;
3925
- case "from top":
3926
- return 90;
3927
- case "from right":
3928
- return 180;
3929
- case "from bottom":
3930
- return 270;
3931
- case "from top left":
3932
- return 45;
3933
- case "from top right":
3934
- return 135;
3935
- case "from bottom right":
3936
- return 225;
3937
- case "from bottom left":
3938
- return 315;
3939
- default:
3940
- const r = t.match(/^(-?\d*\.?\d+)(deg|rad|turn)?$/);
3941
- if (r) {
3942
- const [, a, n = "deg"] = r, s = parseFloat(a);
3943
- switch (n) {
3944
- case "deg":
3945
- return (s % 360 + 360) % 360;
3946
- case "rad":
3947
- return (s * 180 / Math.PI % 360 + 360) % 360;
3948
- case "turn":
3949
- return (s * 360 % 360 + 360) % 360;
3950
- default:
3951
- return (s % 360 + 360) % 360;
3952
- }
3953
- }
3954
- return console.warn(`Invalid angle value: ${e}. Defaulting to 0 degrees.`), 0;
3955
- }
3956
- }, Qn = (e) => {
3957
- const t = {
3958
- stretch: 0,
3959
- transparent: 1,
3960
- mirror: 2,
3961
- wrap: 3
3962
- }[e.toLowerCase()];
3963
- return t === void 0 ? (console.warn(`Invalid edge mode: ${e}. Defaulting to 'stretch'.`), 0) : t;
3964
- }, Un = [
3965
- {
3966
- label: "Linear RGB",
3967
- value: "linear"
3968
- },
3969
- {
3970
- label: "OKLCh",
3971
- value: "oklch"
3972
- },
3973
- {
3974
- label: "OKLAB",
3975
- value: "oklab"
3976
- }
3977
- ], Kn = (e) => {
3978
- const t = {
3979
- linear: 0,
3980
- oklch: 1,
3981
- oklab: 2
3982
- }[e.toLowerCase()];
3983
- return t === void 0 ? (console.warn(`Invalid color space mode: ${e}. Defaulting to 'linear'.`), 0) : t;
3984
- };
3985
- export {
3986
- Qn as a,
3987
- Kn as i,
3988
- Wn as n,
3989
- Jn as o,
3990
- Fn as r,
3991
- Un as t
3992
- };