cool-globe 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -4
- package/dist/cool-globe.cjs +16 -4
- package/dist/cool-globe.js +717 -1791
- package/dist/lib/dashboardGlobe.utils.d.ts +7 -0
- package/package.json +21 -3
package/dist/cool-globe.js
CHANGED
|
@@ -1,1224 +1,99 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { jsx as Fe } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as B, useState as T, useEffect as P, useMemo as se } from "react";
|
|
3
|
+
import un from "react-globe.gl";
|
|
4
|
+
import { Color as we } from "three";
|
|
5
|
+
function ln(e) {
|
|
6
|
+
return e;
|
|
7
|
+
}
|
|
8
|
+
function dn(e) {
|
|
9
|
+
if (e == null) return ln;
|
|
10
|
+
var n, t, r = e.scale[0], i = e.scale[1], a = e.translate[0], o = e.translate[1];
|
|
11
|
+
return function(s, l) {
|
|
12
|
+
l || (n = t = 0);
|
|
13
|
+
var f = 2, h = s.length, u = new Array(h);
|
|
14
|
+
for (u[0] = (n += s[0]) * r + a, u[1] = (t += s[1]) * i + o; f < h; ) u[f] = s[f], ++f;
|
|
15
|
+
return u;
|
|
15
16
|
};
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
-
for (var
|
|
19
|
-
}
|
|
20
|
-
function
|
|
21
|
-
return typeof
|
|
22
|
-
return
|
|
23
|
-
}) } :
|
|
24
|
-
}
|
|
25
|
-
function
|
|
26
|
-
var
|
|
27
|
-
return
|
|
28
|
-
}
|
|
29
|
-
function
|
|
30
|
-
var
|
|
31
|
-
function i(
|
|
32
|
-
|
|
33
|
-
for (var
|
|
34
|
-
|
|
35
|
-
|
|
18
|
+
function hn(e, n) {
|
|
19
|
+
for (var t, r = e.length, i = r - n; i < --r; ) t = e[i], e[i++] = e[r], e[r] = t;
|
|
20
|
+
}
|
|
21
|
+
function mn(e, n) {
|
|
22
|
+
return typeof n == "string" && (n = e.objects[n]), n.type === "GeometryCollection" ? { type: "FeatureCollection", features: n.geometries.map(function(t) {
|
|
23
|
+
return Pe(e, t);
|
|
24
|
+
}) } : Pe(e, n);
|
|
25
|
+
}
|
|
26
|
+
function Pe(e, n) {
|
|
27
|
+
var t = n.id, r = n.bbox, i = n.properties == null ? {} : n.properties, a = gn(e, n);
|
|
28
|
+
return t == null && r == null ? { type: "Feature", properties: i, geometry: a } : r == null ? { type: "Feature", id: t, properties: i, geometry: a } : { type: "Feature", id: t, bbox: r, properties: i, geometry: a };
|
|
29
|
+
}
|
|
30
|
+
function gn(e, n) {
|
|
31
|
+
var t = dn(e.transform), r = e.arcs;
|
|
32
|
+
function i(h, u) {
|
|
33
|
+
u.length && u.pop();
|
|
34
|
+
for (var d = r[h < 0 ? ~h : h], w = 0, v = d.length; w < v; ++w)
|
|
35
|
+
u.push(t(d[w], w));
|
|
36
|
+
h < 0 && hn(u, v);
|
|
36
37
|
}
|
|
37
|
-
function
|
|
38
|
-
return
|
|
38
|
+
function a(h) {
|
|
39
|
+
return t(h);
|
|
39
40
|
}
|
|
40
|
-
function
|
|
41
|
-
for (var
|
|
42
|
-
return
|
|
41
|
+
function o(h) {
|
|
42
|
+
for (var u = [], d = 0, w = h.length; d < w; ++d) i(h[d], u);
|
|
43
|
+
return u.length < 2 && u.push(u[0]), u;
|
|
43
44
|
}
|
|
44
|
-
function
|
|
45
|
-
for (var
|
|
46
|
-
return
|
|
45
|
+
function s(h) {
|
|
46
|
+
for (var u = o(h); u.length < 4; ) u.push(u[0]);
|
|
47
|
+
return u;
|
|
47
48
|
}
|
|
48
|
-
function
|
|
49
|
-
return
|
|
49
|
+
function l(h) {
|
|
50
|
+
return h.map(s);
|
|
50
51
|
}
|
|
51
|
-
function
|
|
52
|
-
var
|
|
53
|
-
switch (
|
|
52
|
+
function f(h) {
|
|
53
|
+
var u = h.type, d;
|
|
54
|
+
switch (u) {
|
|
54
55
|
case "GeometryCollection":
|
|
55
|
-
return { type:
|
|
56
|
+
return { type: u, geometries: h.geometries.map(f) };
|
|
56
57
|
case "Point":
|
|
57
|
-
|
|
58
|
+
d = a(h.coordinates);
|
|
58
59
|
break;
|
|
59
60
|
case "MultiPoint":
|
|
60
|
-
|
|
61
|
+
d = h.coordinates.map(a);
|
|
61
62
|
break;
|
|
62
63
|
case "LineString":
|
|
63
|
-
|
|
64
|
+
d = o(h.arcs);
|
|
64
65
|
break;
|
|
65
66
|
case "MultiLineString":
|
|
66
|
-
|
|
67
|
+
d = h.arcs.map(o);
|
|
67
68
|
break;
|
|
68
69
|
case "Polygon":
|
|
69
|
-
|
|
70
|
+
d = l(h.arcs);
|
|
70
71
|
break;
|
|
71
72
|
case "MultiPolygon":
|
|
72
|
-
|
|
73
|
+
d = h.arcs.map(l);
|
|
73
74
|
break;
|
|
74
75
|
default:
|
|
75
76
|
return null;
|
|
76
77
|
}
|
|
77
|
-
return { type:
|
|
78
|
-
}
|
|
79
|
-
return u(e);
|
|
80
|
-
}
|
|
81
|
-
const xt = "180", $t = "", B = "srgb", Xe = "srgb-linear", We = "linear", _e = "srgb";
|
|
82
|
-
function ie(t, e, n) {
|
|
83
|
-
return Math.max(e, Math.min(n, t));
|
|
84
|
-
}
|
|
85
|
-
function Dt(t, e) {
|
|
86
|
-
return (t % e + e) % e;
|
|
87
|
-
}
|
|
88
|
-
function Se(t, e, n) {
|
|
89
|
-
return (1 - n) * t + n * e;
|
|
90
|
-
}
|
|
91
|
-
class ce {
|
|
92
|
-
/**
|
|
93
|
-
* Constructs a new 3x3 matrix. The arguments are supposed to be
|
|
94
|
-
* in row-major order. If no arguments are provided, the constructor
|
|
95
|
-
* initializes the matrix as an identity matrix.
|
|
96
|
-
*
|
|
97
|
-
* @param {number} [n11] - 1-1 matrix element.
|
|
98
|
-
* @param {number} [n12] - 1-2 matrix element.
|
|
99
|
-
* @param {number} [n13] - 1-3 matrix element.
|
|
100
|
-
* @param {number} [n21] - 2-1 matrix element.
|
|
101
|
-
* @param {number} [n22] - 2-2 matrix element.
|
|
102
|
-
* @param {number} [n23] - 2-3 matrix element.
|
|
103
|
-
* @param {number} [n31] - 3-1 matrix element.
|
|
104
|
-
* @param {number} [n32] - 3-2 matrix element.
|
|
105
|
-
* @param {number} [n33] - 3-3 matrix element.
|
|
106
|
-
*/
|
|
107
|
-
constructor(e, n, r, i, o, s, a, c, u) {
|
|
108
|
-
ce.prototype.isMatrix3 = !0, this.elements = [
|
|
109
|
-
1,
|
|
110
|
-
0,
|
|
111
|
-
0,
|
|
112
|
-
0,
|
|
113
|
-
1,
|
|
114
|
-
0,
|
|
115
|
-
0,
|
|
116
|
-
0,
|
|
117
|
-
1
|
|
118
|
-
], e !== void 0 && this.set(e, n, r, i, o, s, a, c, u);
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Sets the elements of the matrix.The arguments are supposed to be
|
|
122
|
-
* in row-major order.
|
|
123
|
-
*
|
|
124
|
-
* @param {number} [n11] - 1-1 matrix element.
|
|
125
|
-
* @param {number} [n12] - 1-2 matrix element.
|
|
126
|
-
* @param {number} [n13] - 1-3 matrix element.
|
|
127
|
-
* @param {number} [n21] - 2-1 matrix element.
|
|
128
|
-
* @param {number} [n22] - 2-2 matrix element.
|
|
129
|
-
* @param {number} [n23] - 2-3 matrix element.
|
|
130
|
-
* @param {number} [n31] - 3-1 matrix element.
|
|
131
|
-
* @param {number} [n32] - 3-2 matrix element.
|
|
132
|
-
* @param {number} [n33] - 3-3 matrix element.
|
|
133
|
-
* @return {Matrix3} A reference to this matrix.
|
|
134
|
-
*/
|
|
135
|
-
set(e, n, r, i, o, s, a, c, u) {
|
|
136
|
-
const f = this.elements;
|
|
137
|
-
return f[0] = e, f[1] = i, f[2] = a, f[3] = n, f[4] = o, f[5] = c, f[6] = r, f[7] = s, f[8] = u, this;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Sets this matrix to the 3x3 identity matrix.
|
|
141
|
-
*
|
|
142
|
-
* @return {Matrix3} A reference to this matrix.
|
|
143
|
-
*/
|
|
144
|
-
identity() {
|
|
145
|
-
return this.set(
|
|
146
|
-
1,
|
|
147
|
-
0,
|
|
148
|
-
0,
|
|
149
|
-
0,
|
|
150
|
-
1,
|
|
151
|
-
0,
|
|
152
|
-
0,
|
|
153
|
-
0,
|
|
154
|
-
1
|
|
155
|
-
), this;
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Copies the values of the given matrix to this instance.
|
|
159
|
-
*
|
|
160
|
-
* @param {Matrix3} m - The matrix to copy.
|
|
161
|
-
* @return {Matrix3} A reference to this matrix.
|
|
162
|
-
*/
|
|
163
|
-
copy(e) {
|
|
164
|
-
const n = this.elements, r = e.elements;
|
|
165
|
-
return n[0] = r[0], n[1] = r[1], n[2] = r[2], n[3] = r[3], n[4] = r[4], n[5] = r[5], n[6] = r[6], n[7] = r[7], n[8] = r[8], this;
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Extracts the basis of this matrix into the three axis vectors provided.
|
|
169
|
-
*
|
|
170
|
-
* @param {Vector3} xAxis - The basis's x axis.
|
|
171
|
-
* @param {Vector3} yAxis - The basis's y axis.
|
|
172
|
-
* @param {Vector3} zAxis - The basis's z axis.
|
|
173
|
-
* @return {Matrix3} A reference to this matrix.
|
|
174
|
-
*/
|
|
175
|
-
extractBasis(e, n, r) {
|
|
176
|
-
return e.setFromMatrix3Column(this, 0), n.setFromMatrix3Column(this, 1), r.setFromMatrix3Column(this, 2), this;
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Set this matrix to the upper 3x3 matrix of the given 4x4 matrix.
|
|
180
|
-
*
|
|
181
|
-
* @param {Matrix4} m - The 4x4 matrix.
|
|
182
|
-
* @return {Matrix3} A reference to this matrix.
|
|
183
|
-
*/
|
|
184
|
-
setFromMatrix4(e) {
|
|
185
|
-
const n = e.elements;
|
|
186
|
-
return this.set(
|
|
187
|
-
n[0],
|
|
188
|
-
n[4],
|
|
189
|
-
n[8],
|
|
190
|
-
n[1],
|
|
191
|
-
n[5],
|
|
192
|
-
n[9],
|
|
193
|
-
n[2],
|
|
194
|
-
n[6],
|
|
195
|
-
n[10]
|
|
196
|
-
), this;
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Post-multiplies this matrix by the given 3x3 matrix.
|
|
200
|
-
*
|
|
201
|
-
* @param {Matrix3} m - The matrix to multiply with.
|
|
202
|
-
* @return {Matrix3} A reference to this matrix.
|
|
203
|
-
*/
|
|
204
|
-
multiply(e) {
|
|
205
|
-
return this.multiplyMatrices(this, e);
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Pre-multiplies this matrix by the given 3x3 matrix.
|
|
209
|
-
*
|
|
210
|
-
* @param {Matrix3} m - The matrix to multiply with.
|
|
211
|
-
* @return {Matrix3} A reference to this matrix.
|
|
212
|
-
*/
|
|
213
|
-
premultiply(e) {
|
|
214
|
-
return this.multiplyMatrices(e, this);
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Multiples the given 3x3 matrices and stores the result
|
|
218
|
-
* in this matrix.
|
|
219
|
-
*
|
|
220
|
-
* @param {Matrix3} a - The first matrix.
|
|
221
|
-
* @param {Matrix3} b - The second matrix.
|
|
222
|
-
* @return {Matrix3} A reference to this matrix.
|
|
223
|
-
*/
|
|
224
|
-
multiplyMatrices(e, n) {
|
|
225
|
-
const r = e.elements, i = n.elements, o = this.elements, s = r[0], a = r[3], c = r[6], u = r[1], f = r[4], l = r[7], g = r[2], w = r[5], y = r[8], F = i[0], S = i[3], _ = i[6], O = i[1], D = i[4], v = i[7], j = i[2], M = i[5], T = i[8];
|
|
226
|
-
return o[0] = s * F + a * O + c * j, o[3] = s * S + a * D + c * M, o[6] = s * _ + a * v + c * T, o[1] = u * F + f * O + l * j, o[4] = u * S + f * D + l * M, o[7] = u * _ + f * v + l * T, o[2] = g * F + w * O + y * j, o[5] = g * S + w * D + y * M, o[8] = g * _ + w * v + y * T, this;
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* Multiplies every component of the matrix by the given scalar.
|
|
230
|
-
*
|
|
231
|
-
* @param {number} s - The scalar.
|
|
232
|
-
* @return {Matrix3} A reference to this matrix.
|
|
233
|
-
*/
|
|
234
|
-
multiplyScalar(e) {
|
|
235
|
-
const n = this.elements;
|
|
236
|
-
return n[0] *= e, n[3] *= e, n[6] *= e, n[1] *= e, n[4] *= e, n[7] *= e, n[2] *= e, n[5] *= e, n[8] *= e, this;
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Computes and returns the determinant of this matrix.
|
|
240
|
-
*
|
|
241
|
-
* @return {number} The determinant.
|
|
242
|
-
*/
|
|
243
|
-
determinant() {
|
|
244
|
-
const e = this.elements, n = e[0], r = e[1], i = e[2], o = e[3], s = e[4], a = e[5], c = e[6], u = e[7], f = e[8];
|
|
245
|
-
return n * s * f - n * a * u - r * o * f + r * a * c + i * o * u - i * s * c;
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Inverts this matrix, using the [analytic method]{@link https://en.wikipedia.org/wiki/Invertible_matrix#Analytic_solution}.
|
|
249
|
-
* You can not invert with a determinant of zero. If you attempt this, the method produces
|
|
250
|
-
* a zero matrix instead.
|
|
251
|
-
*
|
|
252
|
-
* @return {Matrix3} A reference to this matrix.
|
|
253
|
-
*/
|
|
254
|
-
invert() {
|
|
255
|
-
const e = this.elements, n = e[0], r = e[1], i = e[2], o = e[3], s = e[4], a = e[5], c = e[6], u = e[7], f = e[8], l = f * s - a * u, g = a * c - f * o, w = u * o - s * c, y = n * l + r * g + i * w;
|
|
256
|
-
if (y === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
257
|
-
const F = 1 / y;
|
|
258
|
-
return e[0] = l * F, e[1] = (i * u - f * r) * F, e[2] = (a * r - i * s) * F, e[3] = g * F, e[4] = (f * n - i * c) * F, e[5] = (i * o - a * n) * F, e[6] = w * F, e[7] = (r * c - u * n) * F, e[8] = (s * n - r * o) * F, this;
|
|
259
|
-
}
|
|
260
|
-
/**
|
|
261
|
-
* Transposes this matrix in place.
|
|
262
|
-
*
|
|
263
|
-
* @return {Matrix3} A reference to this matrix.
|
|
264
|
-
*/
|
|
265
|
-
transpose() {
|
|
266
|
-
let e;
|
|
267
|
-
const n = this.elements;
|
|
268
|
-
return e = n[1], n[1] = n[3], n[3] = e, e = n[2], n[2] = n[6], n[6] = e, e = n[5], n[5] = n[7], n[7] = e, this;
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Computes the normal matrix which is the inverse transpose of the upper
|
|
272
|
-
* left 3x3 portion of the given 4x4 matrix.
|
|
273
|
-
*
|
|
274
|
-
* @param {Matrix4} matrix4 - The 4x4 matrix.
|
|
275
|
-
* @return {Matrix3} A reference to this matrix.
|
|
276
|
-
*/
|
|
277
|
-
getNormalMatrix(e) {
|
|
278
|
-
return this.setFromMatrix4(e).invert().transpose();
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
* Transposes this matrix into the supplied array, and returns itself unchanged.
|
|
282
|
-
*
|
|
283
|
-
* @param {Array<number>} r - An array to store the transposed matrix elements.
|
|
284
|
-
* @return {Matrix3} A reference to this matrix.
|
|
285
|
-
*/
|
|
286
|
-
transposeIntoArray(e) {
|
|
287
|
-
const n = this.elements;
|
|
288
|
-
return e[0] = n[0], e[1] = n[3], e[2] = n[6], e[3] = n[1], e[4] = n[4], e[5] = n[7], e[6] = n[2], e[7] = n[5], e[8] = n[8], this;
|
|
289
|
-
}
|
|
290
|
-
/**
|
|
291
|
-
* Sets the UV transform matrix from offset, repeat, rotation, and center.
|
|
292
|
-
*
|
|
293
|
-
* @param {number} tx - Offset x.
|
|
294
|
-
* @param {number} ty - Offset y.
|
|
295
|
-
* @param {number} sx - Repeat x.
|
|
296
|
-
* @param {number} sy - Repeat y.
|
|
297
|
-
* @param {number} rotation - Rotation, in radians. Positive values rotate counterclockwise.
|
|
298
|
-
* @param {number} cx - Center x of rotation.
|
|
299
|
-
* @param {number} cy - Center y of rotation
|
|
300
|
-
* @return {Matrix3} A reference to this matrix.
|
|
301
|
-
*/
|
|
302
|
-
setUvTransform(e, n, r, i, o, s, a) {
|
|
303
|
-
const c = Math.cos(o), u = Math.sin(o);
|
|
304
|
-
return this.set(
|
|
305
|
-
r * c,
|
|
306
|
-
r * u,
|
|
307
|
-
-r * (c * s + u * a) + s + e,
|
|
308
|
-
-i * u,
|
|
309
|
-
i * c,
|
|
310
|
-
-i * (-u * s + c * a) + a + n,
|
|
311
|
-
0,
|
|
312
|
-
0,
|
|
313
|
-
1
|
|
314
|
-
), this;
|
|
315
|
-
}
|
|
316
|
-
/**
|
|
317
|
-
* Scales this matrix with the given scalar values.
|
|
318
|
-
*
|
|
319
|
-
* @param {number} sx - The amount to scale in the X axis.
|
|
320
|
-
* @param {number} sy - The amount to scale in the Y axis.
|
|
321
|
-
* @return {Matrix3} A reference to this matrix.
|
|
322
|
-
*/
|
|
323
|
-
scale(e, n) {
|
|
324
|
-
return this.premultiply(Re.makeScale(e, n)), this;
|
|
325
|
-
}
|
|
326
|
-
/**
|
|
327
|
-
* Rotates this matrix by the given angle.
|
|
328
|
-
*
|
|
329
|
-
* @param {number} theta - The rotation in radians.
|
|
330
|
-
* @return {Matrix3} A reference to this matrix.
|
|
331
|
-
*/
|
|
332
|
-
rotate(e) {
|
|
333
|
-
return this.premultiply(Re.makeRotation(-e)), this;
|
|
334
|
-
}
|
|
335
|
-
/**
|
|
336
|
-
* Translates this matrix by the given scalar values.
|
|
337
|
-
*
|
|
338
|
-
* @param {number} tx - The amount to translate in the X axis.
|
|
339
|
-
* @param {number} ty - The amount to translate in the Y axis.
|
|
340
|
-
* @return {Matrix3} A reference to this matrix.
|
|
341
|
-
*/
|
|
342
|
-
translate(e, n) {
|
|
343
|
-
return this.premultiply(Re.makeTranslation(e, n)), this;
|
|
344
|
-
}
|
|
345
|
-
// for 2D Transforms
|
|
346
|
-
/**
|
|
347
|
-
* Sets this matrix as a 2D translation transform.
|
|
348
|
-
*
|
|
349
|
-
* @param {number|Vector2} x - The amount to translate in the X axis or alternatively a translation vector.
|
|
350
|
-
* @param {number} y - The amount to translate in the Y axis.
|
|
351
|
-
* @return {Matrix3} A reference to this matrix.
|
|
352
|
-
*/
|
|
353
|
-
makeTranslation(e, n) {
|
|
354
|
-
return e.isVector2 ? this.set(
|
|
355
|
-
1,
|
|
356
|
-
0,
|
|
357
|
-
e.x,
|
|
358
|
-
0,
|
|
359
|
-
1,
|
|
360
|
-
e.y,
|
|
361
|
-
0,
|
|
362
|
-
0,
|
|
363
|
-
1
|
|
364
|
-
) : this.set(
|
|
365
|
-
1,
|
|
366
|
-
0,
|
|
367
|
-
e,
|
|
368
|
-
0,
|
|
369
|
-
1,
|
|
370
|
-
n,
|
|
371
|
-
0,
|
|
372
|
-
0,
|
|
373
|
-
1
|
|
374
|
-
), this;
|
|
375
|
-
}
|
|
376
|
-
/**
|
|
377
|
-
* Sets this matrix as a 2D rotational transformation.
|
|
378
|
-
*
|
|
379
|
-
* @param {number} theta - The rotation in radians.
|
|
380
|
-
* @return {Matrix3} A reference to this matrix.
|
|
381
|
-
*/
|
|
382
|
-
makeRotation(e) {
|
|
383
|
-
const n = Math.cos(e), r = Math.sin(e);
|
|
384
|
-
return this.set(
|
|
385
|
-
n,
|
|
386
|
-
-r,
|
|
387
|
-
0,
|
|
388
|
-
r,
|
|
389
|
-
n,
|
|
390
|
-
0,
|
|
391
|
-
0,
|
|
392
|
-
0,
|
|
393
|
-
1
|
|
394
|
-
), this;
|
|
395
|
-
}
|
|
396
|
-
/**
|
|
397
|
-
* Sets this matrix as a 2D scale transform.
|
|
398
|
-
*
|
|
399
|
-
* @param {number} x - The amount to scale in the X axis.
|
|
400
|
-
* @param {number} y - The amount to scale in the Y axis.
|
|
401
|
-
* @return {Matrix3} A reference to this matrix.
|
|
402
|
-
*/
|
|
403
|
-
makeScale(e, n) {
|
|
404
|
-
return this.set(
|
|
405
|
-
e,
|
|
406
|
-
0,
|
|
407
|
-
0,
|
|
408
|
-
0,
|
|
409
|
-
n,
|
|
410
|
-
0,
|
|
411
|
-
0,
|
|
412
|
-
0,
|
|
413
|
-
1
|
|
414
|
-
), this;
|
|
415
|
-
}
|
|
416
|
-
/**
|
|
417
|
-
* Returns `true` if this matrix is equal with the given one.
|
|
418
|
-
*
|
|
419
|
-
* @param {Matrix3} matrix - The matrix to test for equality.
|
|
420
|
-
* @return {boolean} Whether this matrix is equal with the given one.
|
|
421
|
-
*/
|
|
422
|
-
equals(e) {
|
|
423
|
-
const n = this.elements, r = e.elements;
|
|
424
|
-
for (let i = 0; i < 9; i++)
|
|
425
|
-
if (n[i] !== r[i]) return !1;
|
|
426
|
-
return !0;
|
|
427
|
-
}
|
|
428
|
-
/**
|
|
429
|
-
* Sets the elements of the matrix from the given array.
|
|
430
|
-
*
|
|
431
|
-
* @param {Array<number>} array - The matrix elements in column-major order.
|
|
432
|
-
* @param {number} [offset=0] - Index of the first element in the array.
|
|
433
|
-
* @return {Matrix3} A reference to this matrix.
|
|
434
|
-
*/
|
|
435
|
-
fromArray(e, n = 0) {
|
|
436
|
-
for (let r = 0; r < 9; r++)
|
|
437
|
-
this.elements[r] = e[r + n];
|
|
438
|
-
return this;
|
|
78
|
+
return { type: u, coordinates: d };
|
|
439
79
|
}
|
|
440
|
-
|
|
441
|
-
* Writes the elements of this matrix to the given array. If no array is provided,
|
|
442
|
-
* the method returns a new instance.
|
|
443
|
-
*
|
|
444
|
-
* @param {Array<number>} [array=[]] - The target array holding the matrix elements in column-major order.
|
|
445
|
-
* @param {number} [offset=0] - Index of the first element in the array.
|
|
446
|
-
* @return {Array<number>} The matrix elements in column-major order.
|
|
447
|
-
*/
|
|
448
|
-
toArray(e = [], n = 0) {
|
|
449
|
-
const r = this.elements;
|
|
450
|
-
return e[n] = r[0], e[n + 1] = r[1], e[n + 2] = r[2], e[n + 3] = r[3], e[n + 4] = r[4], e[n + 5] = r[5], e[n + 6] = r[6], e[n + 7] = r[7], e[n + 8] = r[8], e;
|
|
451
|
-
}
|
|
452
|
-
/**
|
|
453
|
-
* Returns a matrix with copied values from this instance.
|
|
454
|
-
*
|
|
455
|
-
* @return {Matrix3} A clone of this instance.
|
|
456
|
-
*/
|
|
457
|
-
clone() {
|
|
458
|
-
return new this.constructor().fromArray(this.elements);
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
const Re = /* @__PURE__ */ new ce(), Je = {};
|
|
462
|
-
function Qe(t) {
|
|
463
|
-
t in Je || (Je[t] = !0, console.warn(t));
|
|
464
|
-
}
|
|
465
|
-
const Ke = /* @__PURE__ */ new ce().set(
|
|
466
|
-
0.4123908,
|
|
467
|
-
0.3575843,
|
|
468
|
-
0.1804808,
|
|
469
|
-
0.212639,
|
|
470
|
-
0.7151687,
|
|
471
|
-
0.0721923,
|
|
472
|
-
0.0193308,
|
|
473
|
-
0.1191948,
|
|
474
|
-
0.9505322
|
|
475
|
-
), et = /* @__PURE__ */ new ce().set(
|
|
476
|
-
3.2409699,
|
|
477
|
-
-1.5373832,
|
|
478
|
-
-0.4986108,
|
|
479
|
-
-0.9692436,
|
|
480
|
-
1.8759675,
|
|
481
|
-
0.0415551,
|
|
482
|
-
0.0556301,
|
|
483
|
-
-0.203977,
|
|
484
|
-
1.0569715
|
|
485
|
-
);
|
|
486
|
-
function Tt() {
|
|
487
|
-
const t = {
|
|
488
|
-
enabled: !0,
|
|
489
|
-
workingColorSpace: Xe,
|
|
490
|
-
/**
|
|
491
|
-
* Implementations of supported color spaces.
|
|
492
|
-
*
|
|
493
|
-
* Required:
|
|
494
|
-
* - primaries: chromaticity coordinates [ rx ry gx gy bx by ]
|
|
495
|
-
* - whitePoint: reference white [ x y ]
|
|
496
|
-
* - transfer: transfer function (pre-defined)
|
|
497
|
-
* - toXYZ: Matrix3 RGB to XYZ transform
|
|
498
|
-
* - fromXYZ: Matrix3 XYZ to RGB transform
|
|
499
|
-
* - luminanceCoefficients: RGB luminance coefficients
|
|
500
|
-
*
|
|
501
|
-
* Optional:
|
|
502
|
-
* - outputColorSpaceConfig: { drawingBufferColorSpace: ColorSpace, toneMappingMode: 'extended' | 'standard' }
|
|
503
|
-
* - workingColorSpaceConfig: { unpackColorSpace: ColorSpace }
|
|
504
|
-
*
|
|
505
|
-
* Reference:
|
|
506
|
-
* - https://www.russellcottrell.com/photo/matrixCalculator.htm
|
|
507
|
-
*/
|
|
508
|
-
spaces: {},
|
|
509
|
-
convert: function(i, o, s) {
|
|
510
|
-
return this.enabled === !1 || o === s || !o || !s || (this.spaces[o].transfer === _e && (i.r = Q(i.r), i.g = Q(i.g), i.b = Q(i.b)), this.spaces[o].primaries !== this.spaces[s].primaries && (i.applyMatrix3(this.spaces[o].toXYZ), i.applyMatrix3(this.spaces[s].fromXYZ)), this.spaces[s].transfer === _e && (i.r = K(i.r), i.g = K(i.g), i.b = K(i.b))), i;
|
|
511
|
-
},
|
|
512
|
-
workingToColorSpace: function(i, o) {
|
|
513
|
-
return this.convert(i, this.workingColorSpace, o);
|
|
514
|
-
},
|
|
515
|
-
colorSpaceToWorking: function(i, o) {
|
|
516
|
-
return this.convert(i, o, this.workingColorSpace);
|
|
517
|
-
},
|
|
518
|
-
getPrimaries: function(i) {
|
|
519
|
-
return this.spaces[i].primaries;
|
|
520
|
-
},
|
|
521
|
-
getTransfer: function(i) {
|
|
522
|
-
return i === $t ? We : this.spaces[i].transfer;
|
|
523
|
-
},
|
|
524
|
-
getToneMappingMode: function(i) {
|
|
525
|
-
return this.spaces[i].outputColorSpaceConfig.toneMappingMode || "standard";
|
|
526
|
-
},
|
|
527
|
-
getLuminanceCoefficients: function(i, o = this.workingColorSpace) {
|
|
528
|
-
return i.fromArray(this.spaces[o].luminanceCoefficients);
|
|
529
|
-
},
|
|
530
|
-
define: function(i) {
|
|
531
|
-
Object.assign(this.spaces, i);
|
|
532
|
-
},
|
|
533
|
-
// Internal APIs
|
|
534
|
-
_getMatrix: function(i, o, s) {
|
|
535
|
-
return i.copy(this.spaces[o].toXYZ).multiply(this.spaces[s].fromXYZ);
|
|
536
|
-
},
|
|
537
|
-
_getDrawingBufferColorSpace: function(i) {
|
|
538
|
-
return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace;
|
|
539
|
-
},
|
|
540
|
-
_getUnpackColorSpace: function(i = this.workingColorSpace) {
|
|
541
|
-
return this.spaces[i].workingColorSpaceConfig.unpackColorSpace;
|
|
542
|
-
},
|
|
543
|
-
// Deprecated
|
|
544
|
-
fromWorkingColorSpace: function(i, o) {
|
|
545
|
-
return Qe("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."), t.workingToColorSpace(i, o);
|
|
546
|
-
},
|
|
547
|
-
toWorkingColorSpace: function(i, o) {
|
|
548
|
-
return Qe("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."), t.colorSpaceToWorking(i, o);
|
|
549
|
-
}
|
|
550
|
-
}, e = [0.64, 0.33, 0.3, 0.6, 0.15, 0.06], n = [0.2126, 0.7152, 0.0722], r = [0.3127, 0.329];
|
|
551
|
-
return t.define({
|
|
552
|
-
[Xe]: {
|
|
553
|
-
primaries: e,
|
|
554
|
-
whitePoint: r,
|
|
555
|
-
transfer: We,
|
|
556
|
-
toXYZ: Ke,
|
|
557
|
-
fromXYZ: et,
|
|
558
|
-
luminanceCoefficients: n,
|
|
559
|
-
workingColorSpaceConfig: { unpackColorSpace: B },
|
|
560
|
-
outputColorSpaceConfig: { drawingBufferColorSpace: B }
|
|
561
|
-
},
|
|
562
|
-
[B]: {
|
|
563
|
-
primaries: e,
|
|
564
|
-
whitePoint: r,
|
|
565
|
-
transfer: _e,
|
|
566
|
-
toXYZ: Ke,
|
|
567
|
-
fromXYZ: et,
|
|
568
|
-
luminanceCoefficients: n,
|
|
569
|
-
outputColorSpaceConfig: { drawingBufferColorSpace: B }
|
|
570
|
-
}
|
|
571
|
-
}), t;
|
|
80
|
+
return f(n);
|
|
572
81
|
}
|
|
573
|
-
const
|
|
574
|
-
function Q(t) {
|
|
575
|
-
return t < 0.04045 ? t * 0.0773993808 : Math.pow(t * 0.9478672986 + 0.0521327014, 2.4);
|
|
576
|
-
}
|
|
577
|
-
function K(t) {
|
|
578
|
-
return t < 31308e-7 ? t * 12.92 : 1.055 * Math.pow(t, 0.41666) - 0.055;
|
|
579
|
-
}
|
|
580
|
-
const pt = {
|
|
581
|
-
aliceblue: 15792383,
|
|
582
|
-
antiquewhite: 16444375,
|
|
583
|
-
aqua: 65535,
|
|
584
|
-
aquamarine: 8388564,
|
|
585
|
-
azure: 15794175,
|
|
586
|
-
beige: 16119260,
|
|
587
|
-
bisque: 16770244,
|
|
588
|
-
black: 0,
|
|
589
|
-
blanchedalmond: 16772045,
|
|
590
|
-
blue: 255,
|
|
591
|
-
blueviolet: 9055202,
|
|
592
|
-
brown: 10824234,
|
|
593
|
-
burlywood: 14596231,
|
|
594
|
-
cadetblue: 6266528,
|
|
595
|
-
chartreuse: 8388352,
|
|
596
|
-
chocolate: 13789470,
|
|
597
|
-
coral: 16744272,
|
|
598
|
-
cornflowerblue: 6591981,
|
|
599
|
-
cornsilk: 16775388,
|
|
600
|
-
crimson: 14423100,
|
|
601
|
-
cyan: 65535,
|
|
602
|
-
darkblue: 139,
|
|
603
|
-
darkcyan: 35723,
|
|
604
|
-
darkgoldenrod: 12092939,
|
|
605
|
-
darkgray: 11119017,
|
|
606
|
-
darkgreen: 25600,
|
|
607
|
-
darkgrey: 11119017,
|
|
608
|
-
darkkhaki: 12433259,
|
|
609
|
-
darkmagenta: 9109643,
|
|
610
|
-
darkolivegreen: 5597999,
|
|
611
|
-
darkorange: 16747520,
|
|
612
|
-
darkorchid: 10040012,
|
|
613
|
-
darkred: 9109504,
|
|
614
|
-
darksalmon: 15308410,
|
|
615
|
-
darkseagreen: 9419919,
|
|
616
|
-
darkslateblue: 4734347,
|
|
617
|
-
darkslategray: 3100495,
|
|
618
|
-
darkslategrey: 3100495,
|
|
619
|
-
darkturquoise: 52945,
|
|
620
|
-
darkviolet: 9699539,
|
|
621
|
-
deeppink: 16716947,
|
|
622
|
-
deepskyblue: 49151,
|
|
623
|
-
dimgray: 6908265,
|
|
624
|
-
dimgrey: 6908265,
|
|
625
|
-
dodgerblue: 2003199,
|
|
626
|
-
firebrick: 11674146,
|
|
627
|
-
floralwhite: 16775920,
|
|
628
|
-
forestgreen: 2263842,
|
|
629
|
-
fuchsia: 16711935,
|
|
630
|
-
gainsboro: 14474460,
|
|
631
|
-
ghostwhite: 16316671,
|
|
632
|
-
gold: 16766720,
|
|
633
|
-
goldenrod: 14329120,
|
|
634
|
-
gray: 8421504,
|
|
635
|
-
green: 32768,
|
|
636
|
-
greenyellow: 11403055,
|
|
637
|
-
grey: 8421504,
|
|
638
|
-
honeydew: 15794160,
|
|
639
|
-
hotpink: 16738740,
|
|
640
|
-
indianred: 13458524,
|
|
641
|
-
indigo: 4915330,
|
|
642
|
-
ivory: 16777200,
|
|
643
|
-
khaki: 15787660,
|
|
644
|
-
lavender: 15132410,
|
|
645
|
-
lavenderblush: 16773365,
|
|
646
|
-
lawngreen: 8190976,
|
|
647
|
-
lemonchiffon: 16775885,
|
|
648
|
-
lightblue: 11393254,
|
|
649
|
-
lightcoral: 15761536,
|
|
650
|
-
lightcyan: 14745599,
|
|
651
|
-
lightgoldenrodyellow: 16448210,
|
|
652
|
-
lightgray: 13882323,
|
|
653
|
-
lightgreen: 9498256,
|
|
654
|
-
lightgrey: 13882323,
|
|
655
|
-
lightpink: 16758465,
|
|
656
|
-
lightsalmon: 16752762,
|
|
657
|
-
lightseagreen: 2142890,
|
|
658
|
-
lightskyblue: 8900346,
|
|
659
|
-
lightslategray: 7833753,
|
|
660
|
-
lightslategrey: 7833753,
|
|
661
|
-
lightsteelblue: 11584734,
|
|
662
|
-
lightyellow: 16777184,
|
|
663
|
-
lime: 65280,
|
|
664
|
-
limegreen: 3329330,
|
|
665
|
-
linen: 16445670,
|
|
666
|
-
magenta: 16711935,
|
|
667
|
-
maroon: 8388608,
|
|
668
|
-
mediumaquamarine: 6737322,
|
|
669
|
-
mediumblue: 205,
|
|
670
|
-
mediumorchid: 12211667,
|
|
671
|
-
mediumpurple: 9662683,
|
|
672
|
-
mediumseagreen: 3978097,
|
|
673
|
-
mediumslateblue: 8087790,
|
|
674
|
-
mediumspringgreen: 64154,
|
|
675
|
-
mediumturquoise: 4772300,
|
|
676
|
-
mediumvioletred: 13047173,
|
|
677
|
-
midnightblue: 1644912,
|
|
678
|
-
mintcream: 16121850,
|
|
679
|
-
mistyrose: 16770273,
|
|
680
|
-
moccasin: 16770229,
|
|
681
|
-
navajowhite: 16768685,
|
|
682
|
-
navy: 128,
|
|
683
|
-
oldlace: 16643558,
|
|
684
|
-
olive: 8421376,
|
|
685
|
-
olivedrab: 7048739,
|
|
686
|
-
orange: 16753920,
|
|
687
|
-
orangered: 16729344,
|
|
688
|
-
orchid: 14315734,
|
|
689
|
-
palegoldenrod: 15657130,
|
|
690
|
-
palegreen: 10025880,
|
|
691
|
-
paleturquoise: 11529966,
|
|
692
|
-
palevioletred: 14381203,
|
|
693
|
-
papayawhip: 16773077,
|
|
694
|
-
peachpuff: 16767673,
|
|
695
|
-
peru: 13468991,
|
|
696
|
-
pink: 16761035,
|
|
697
|
-
plum: 14524637,
|
|
698
|
-
powderblue: 11591910,
|
|
699
|
-
purple: 8388736,
|
|
700
|
-
rebeccapurple: 6697881,
|
|
701
|
-
red: 16711680,
|
|
702
|
-
rosybrown: 12357519,
|
|
703
|
-
royalblue: 4286945,
|
|
704
|
-
saddlebrown: 9127187,
|
|
705
|
-
salmon: 16416882,
|
|
706
|
-
sandybrown: 16032864,
|
|
707
|
-
seagreen: 3050327,
|
|
708
|
-
seashell: 16774638,
|
|
709
|
-
sienna: 10506797,
|
|
710
|
-
silver: 12632256,
|
|
711
|
-
skyblue: 8900331,
|
|
712
|
-
slateblue: 6970061,
|
|
713
|
-
slategray: 7372944,
|
|
714
|
-
slategrey: 7372944,
|
|
715
|
-
snow: 16775930,
|
|
716
|
-
springgreen: 65407,
|
|
717
|
-
steelblue: 4620980,
|
|
718
|
-
tan: 13808780,
|
|
719
|
-
teal: 32896,
|
|
720
|
-
thistle: 14204888,
|
|
721
|
-
tomato: 16737095,
|
|
722
|
-
turquoise: 4251856,
|
|
723
|
-
violet: 15631086,
|
|
724
|
-
wheat: 16113331,
|
|
725
|
-
white: 16777215,
|
|
726
|
-
whitesmoke: 16119285,
|
|
727
|
-
yellow: 16776960,
|
|
728
|
-
yellowgreen: 10145074
|
|
729
|
-
}, G = { h: 0, s: 0, l: 0 }, xe = { h: 0, s: 0, l: 0 };
|
|
730
|
-
function Le(t, e, n) {
|
|
731
|
-
return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? t + (e - t) * 6 * n : n < 1 / 2 ? e : n < 2 / 3 ? t + (e - t) * 6 * (2 / 3 - n) : t;
|
|
732
|
-
}
|
|
733
|
-
let oe = class {
|
|
734
|
-
/**
|
|
735
|
-
* Constructs a new color.
|
|
736
|
-
*
|
|
737
|
-
* Note that standard method of specifying color in three.js is with a hexadecimal triplet,
|
|
738
|
-
* and that method is used throughout the rest of the documentation.
|
|
739
|
-
*
|
|
740
|
-
* @param {(number|string|Color)} [r] - The red component of the color. If `g` and `b` are
|
|
741
|
-
* not provided, it can be hexadecimal triplet, a CSS-style string or another `Color` instance.
|
|
742
|
-
* @param {number} [g] - The green component.
|
|
743
|
-
* @param {number} [b] - The blue component.
|
|
744
|
-
*/
|
|
745
|
-
constructor(e, n, r) {
|
|
746
|
-
return this.isColor = !0, this.r = 1, this.g = 1, this.b = 1, this.set(e, n, r);
|
|
747
|
-
}
|
|
748
|
-
/**
|
|
749
|
-
* Sets the colors's components from the given values.
|
|
750
|
-
*
|
|
751
|
-
* @param {(number|string|Color)} [r] - The red component of the color. If `g` and `b` are
|
|
752
|
-
* not provided, it can be hexadecimal triplet, a CSS-style string or another `Color` instance.
|
|
753
|
-
* @param {number} [g] - The green component.
|
|
754
|
-
* @param {number} [b] - The blue component.
|
|
755
|
-
* @return {Color} A reference to this color.
|
|
756
|
-
*/
|
|
757
|
-
set(e, n, r) {
|
|
758
|
-
if (n === void 0 && r === void 0) {
|
|
759
|
-
const i = e;
|
|
760
|
-
i && i.isColor ? this.copy(i) : typeof i == "number" ? this.setHex(i) : typeof i == "string" && this.setStyle(i);
|
|
761
|
-
} else
|
|
762
|
-
this.setRGB(e, n, r);
|
|
763
|
-
return this;
|
|
764
|
-
}
|
|
765
|
-
/**
|
|
766
|
-
* Sets the colors's components to the given scalar value.
|
|
767
|
-
*
|
|
768
|
-
* @param {number} scalar - The scalar value.
|
|
769
|
-
* @return {Color} A reference to this color.
|
|
770
|
-
*/
|
|
771
|
-
setScalar(e) {
|
|
772
|
-
return this.r = e, this.g = e, this.b = e, this;
|
|
773
|
-
}
|
|
774
|
-
/**
|
|
775
|
-
* Sets this color from a hexadecimal value.
|
|
776
|
-
*
|
|
777
|
-
* @param {number} hex - The hexadecimal value.
|
|
778
|
-
* @param {string} [colorSpace=SRGBColorSpace] - The color space.
|
|
779
|
-
* @return {Color} A reference to this color.
|
|
780
|
-
*/
|
|
781
|
-
setHex(e, n = B) {
|
|
782
|
-
return e = Math.floor(e), this.r = (e >> 16 & 255) / 255, this.g = (e >> 8 & 255) / 255, this.b = (e & 255) / 255, L.colorSpaceToWorking(this, n), this;
|
|
783
|
-
}
|
|
784
|
-
/**
|
|
785
|
-
* Sets this color from RGB values.
|
|
786
|
-
*
|
|
787
|
-
* @param {number} r - Red channel value between `0.0` and `1.0`.
|
|
788
|
-
* @param {number} g - Green channel value between `0.0` and `1.0`.
|
|
789
|
-
* @param {number} b - Blue channel value between `0.0` and `1.0`.
|
|
790
|
-
* @param {string} [colorSpace=ColorManagement.workingColorSpace] - The color space.
|
|
791
|
-
* @return {Color} A reference to this color.
|
|
792
|
-
*/
|
|
793
|
-
setRGB(e, n, r, i = L.workingColorSpace) {
|
|
794
|
-
return this.r = e, this.g = n, this.b = r, L.colorSpaceToWorking(this, i), this;
|
|
795
|
-
}
|
|
796
|
-
/**
|
|
797
|
-
* Sets this color from RGB values.
|
|
798
|
-
*
|
|
799
|
-
* @param {number} h - Hue value between `0.0` and `1.0`.
|
|
800
|
-
* @param {number} s - Saturation value between `0.0` and `1.0`.
|
|
801
|
-
* @param {number} l - Lightness value between `0.0` and `1.0`.
|
|
802
|
-
* @param {string} [colorSpace=ColorManagement.workingColorSpace] - The color space.
|
|
803
|
-
* @return {Color} A reference to this color.
|
|
804
|
-
*/
|
|
805
|
-
setHSL(e, n, r, i = L.workingColorSpace) {
|
|
806
|
-
if (e = Dt(e, 1), n = ie(n, 0, 1), r = ie(r, 0, 1), n === 0)
|
|
807
|
-
this.r = this.g = this.b = r;
|
|
808
|
-
else {
|
|
809
|
-
const o = r <= 0.5 ? r * (1 + n) : r + n - r * n, s = 2 * r - o;
|
|
810
|
-
this.r = Le(s, o, e + 1 / 3), this.g = Le(s, o, e), this.b = Le(s, o, e - 1 / 3);
|
|
811
|
-
}
|
|
812
|
-
return L.colorSpaceToWorking(this, i), this;
|
|
813
|
-
}
|
|
814
|
-
/**
|
|
815
|
-
* Sets this color from a CSS-style string. For example, `rgb(250, 0,0)`,
|
|
816
|
-
* `rgb(100%, 0%, 0%)`, `hsl(0, 100%, 50%)`, `#ff0000`, `#f00`, or `red` ( or
|
|
817
|
-
* any [X11 color name]{@link https://en.wikipedia.org/wiki/X11_color_names#Color_name_chart} -
|
|
818
|
-
* all 140 color names are supported).
|
|
819
|
-
*
|
|
820
|
-
* @param {string} style - Color as a CSS-style string.
|
|
821
|
-
* @param {string} [colorSpace=SRGBColorSpace] - The color space.
|
|
822
|
-
* @return {Color} A reference to this color.
|
|
823
|
-
*/
|
|
824
|
-
setStyle(e, n = B) {
|
|
825
|
-
function r(o) {
|
|
826
|
-
o !== void 0 && parseFloat(o) < 1 && console.warn("THREE.Color: Alpha component of " + e + " will be ignored.");
|
|
827
|
-
}
|
|
828
|
-
let i;
|
|
829
|
-
if (i = /^(\w+)\(([^\)]*)\)/.exec(e)) {
|
|
830
|
-
let o;
|
|
831
|
-
const s = i[1], a = i[2];
|
|
832
|
-
switch (s) {
|
|
833
|
-
case "rgb":
|
|
834
|
-
case "rgba":
|
|
835
|
-
if (o = /^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))
|
|
836
|
-
return r(o[4]), this.setRGB(
|
|
837
|
-
Math.min(255, parseInt(o[1], 10)) / 255,
|
|
838
|
-
Math.min(255, parseInt(o[2], 10)) / 255,
|
|
839
|
-
Math.min(255, parseInt(o[3], 10)) / 255,
|
|
840
|
-
n
|
|
841
|
-
);
|
|
842
|
-
if (o = /^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))
|
|
843
|
-
return r(o[4]), this.setRGB(
|
|
844
|
-
Math.min(100, parseInt(o[1], 10)) / 100,
|
|
845
|
-
Math.min(100, parseInt(o[2], 10)) / 100,
|
|
846
|
-
Math.min(100, parseInt(o[3], 10)) / 100,
|
|
847
|
-
n
|
|
848
|
-
);
|
|
849
|
-
break;
|
|
850
|
-
case "hsl":
|
|
851
|
-
case "hsla":
|
|
852
|
-
if (o = /^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))
|
|
853
|
-
return r(o[4]), this.setHSL(
|
|
854
|
-
parseFloat(o[1]) / 360,
|
|
855
|
-
parseFloat(o[2]) / 100,
|
|
856
|
-
parseFloat(o[3]) / 100,
|
|
857
|
-
n
|
|
858
|
-
);
|
|
859
|
-
break;
|
|
860
|
-
default:
|
|
861
|
-
console.warn("THREE.Color: Unknown color model " + e);
|
|
862
|
-
}
|
|
863
|
-
} else if (i = /^\#([A-Fa-f\d]+)$/.exec(e)) {
|
|
864
|
-
const o = i[1], s = o.length;
|
|
865
|
-
if (s === 3)
|
|
866
|
-
return this.setRGB(
|
|
867
|
-
parseInt(o.charAt(0), 16) / 15,
|
|
868
|
-
parseInt(o.charAt(1), 16) / 15,
|
|
869
|
-
parseInt(o.charAt(2), 16) / 15,
|
|
870
|
-
n
|
|
871
|
-
);
|
|
872
|
-
if (s === 6)
|
|
873
|
-
return this.setHex(parseInt(o, 16), n);
|
|
874
|
-
console.warn("THREE.Color: Invalid hex color " + e);
|
|
875
|
-
} else if (e && e.length > 0)
|
|
876
|
-
return this.setColorName(e, n);
|
|
877
|
-
return this;
|
|
878
|
-
}
|
|
879
|
-
/**
|
|
880
|
-
* Sets this color from a color name. Faster than {@link Color#setStyle} if
|
|
881
|
-
* you don't need the other CSS-style formats.
|
|
882
|
-
*
|
|
883
|
-
* For convenience, the list of names is exposed in `Color.NAMES` as a hash.
|
|
884
|
-
* ```js
|
|
885
|
-
* Color.NAMES.aliceblue // returns 0xF0F8FF
|
|
886
|
-
* ```
|
|
887
|
-
*
|
|
888
|
-
* @param {string} style - The color name.
|
|
889
|
-
* @param {string} [colorSpace=SRGBColorSpace] - The color space.
|
|
890
|
-
* @return {Color} A reference to this color.
|
|
891
|
-
*/
|
|
892
|
-
setColorName(e, n = B) {
|
|
893
|
-
const r = pt[e.toLowerCase()];
|
|
894
|
-
return r !== void 0 ? this.setHex(r, n) : console.warn("THREE.Color: Unknown color " + e), this;
|
|
895
|
-
}
|
|
896
|
-
/**
|
|
897
|
-
* Returns a new color with copied values from this instance.
|
|
898
|
-
*
|
|
899
|
-
* @return {Color} A clone of this instance.
|
|
900
|
-
*/
|
|
901
|
-
clone() {
|
|
902
|
-
return new this.constructor(this.r, this.g, this.b);
|
|
903
|
-
}
|
|
904
|
-
/**
|
|
905
|
-
* Copies the values of the given color to this instance.
|
|
906
|
-
*
|
|
907
|
-
* @param {Color} color - The color to copy.
|
|
908
|
-
* @return {Color} A reference to this color.
|
|
909
|
-
*/
|
|
910
|
-
copy(e) {
|
|
911
|
-
return this.r = e.r, this.g = e.g, this.b = e.b, this;
|
|
912
|
-
}
|
|
913
|
-
/**
|
|
914
|
-
* Copies the given color into this color, and then converts this color from
|
|
915
|
-
* `SRGBColorSpace` to `LinearSRGBColorSpace`.
|
|
916
|
-
*
|
|
917
|
-
* @param {Color} color - The color to copy/convert.
|
|
918
|
-
* @return {Color} A reference to this color.
|
|
919
|
-
*/
|
|
920
|
-
copySRGBToLinear(e) {
|
|
921
|
-
return this.r = Q(e.r), this.g = Q(e.g), this.b = Q(e.b), this;
|
|
922
|
-
}
|
|
923
|
-
/**
|
|
924
|
-
* Copies the given color into this color, and then converts this color from
|
|
925
|
-
* `LinearSRGBColorSpace` to `SRGBColorSpace`.
|
|
926
|
-
*
|
|
927
|
-
* @param {Color} color - The color to copy/convert.
|
|
928
|
-
* @return {Color} A reference to this color.
|
|
929
|
-
*/
|
|
930
|
-
copyLinearToSRGB(e) {
|
|
931
|
-
return this.r = K(e.r), this.g = K(e.g), this.b = K(e.b), this;
|
|
932
|
-
}
|
|
933
|
-
/**
|
|
934
|
-
* Converts this color from `SRGBColorSpace` to `LinearSRGBColorSpace`.
|
|
935
|
-
*
|
|
936
|
-
* @return {Color} A reference to this color.
|
|
937
|
-
*/
|
|
938
|
-
convertSRGBToLinear() {
|
|
939
|
-
return this.copySRGBToLinear(this), this;
|
|
940
|
-
}
|
|
941
|
-
/**
|
|
942
|
-
* Converts this color from `LinearSRGBColorSpace` to `SRGBColorSpace`.
|
|
943
|
-
*
|
|
944
|
-
* @return {Color} A reference to this color.
|
|
945
|
-
*/
|
|
946
|
-
convertLinearToSRGB() {
|
|
947
|
-
return this.copyLinearToSRGB(this), this;
|
|
948
|
-
}
|
|
949
|
-
/**
|
|
950
|
-
* Returns the hexadecimal value of this color.
|
|
951
|
-
*
|
|
952
|
-
* @param {string} [colorSpace=SRGBColorSpace] - The color space.
|
|
953
|
-
* @return {number} The hexadecimal value.
|
|
954
|
-
*/
|
|
955
|
-
getHex(e = B) {
|
|
956
|
-
return L.workingToColorSpace(k.copy(this), e), Math.round(ie(k.r * 255, 0, 255)) * 65536 + Math.round(ie(k.g * 255, 0, 255)) * 256 + Math.round(ie(k.b * 255, 0, 255));
|
|
957
|
-
}
|
|
958
|
-
/**
|
|
959
|
-
* Returns the hexadecimal value of this color as a string (for example, 'FFFFFF').
|
|
960
|
-
*
|
|
961
|
-
* @param {string} [colorSpace=SRGBColorSpace] - The color space.
|
|
962
|
-
* @return {string} The hexadecimal value as a string.
|
|
963
|
-
*/
|
|
964
|
-
getHexString(e = B) {
|
|
965
|
-
return ("000000" + this.getHex(e).toString(16)).slice(-6);
|
|
966
|
-
}
|
|
967
|
-
/**
|
|
968
|
-
* Converts the colors RGB values into the HSL format and stores them into the
|
|
969
|
-
* given target object.
|
|
970
|
-
*
|
|
971
|
-
* @param {{h:number,s:number,l:number}} target - The target object that is used to store the method's result.
|
|
972
|
-
* @param {string} [colorSpace=ColorManagement.workingColorSpace] - The color space.
|
|
973
|
-
* @return {{h:number,s:number,l:number}} The HSL representation of this color.
|
|
974
|
-
*/
|
|
975
|
-
getHSL(e, n = L.workingColorSpace) {
|
|
976
|
-
L.workingToColorSpace(k.copy(this), n);
|
|
977
|
-
const r = k.r, i = k.g, o = k.b, s = Math.max(r, i, o), a = Math.min(r, i, o);
|
|
978
|
-
let c, u;
|
|
979
|
-
const f = (a + s) / 2;
|
|
980
|
-
if (a === s)
|
|
981
|
-
c = 0, u = 0;
|
|
982
|
-
else {
|
|
983
|
-
const l = s - a;
|
|
984
|
-
switch (u = f <= 0.5 ? l / (s + a) : l / (2 - s - a), s) {
|
|
985
|
-
case r:
|
|
986
|
-
c = (i - o) / l + (i < o ? 6 : 0);
|
|
987
|
-
break;
|
|
988
|
-
case i:
|
|
989
|
-
c = (o - r) / l + 2;
|
|
990
|
-
break;
|
|
991
|
-
case o:
|
|
992
|
-
c = (r - i) / l + 4;
|
|
993
|
-
break;
|
|
994
|
-
}
|
|
995
|
-
c /= 6;
|
|
996
|
-
}
|
|
997
|
-
return e.h = c, e.s = u, e.l = f, e;
|
|
998
|
-
}
|
|
999
|
-
/**
|
|
1000
|
-
* Returns the RGB values of this color and stores them into the given target object.
|
|
1001
|
-
*
|
|
1002
|
-
* @param {Color} target - The target color that is used to store the method's result.
|
|
1003
|
-
* @param {string} [colorSpace=ColorManagement.workingColorSpace] - The color space.
|
|
1004
|
-
* @return {Color} The RGB representation of this color.
|
|
1005
|
-
*/
|
|
1006
|
-
getRGB(e, n = L.workingColorSpace) {
|
|
1007
|
-
return L.workingToColorSpace(k.copy(this), n), e.r = k.r, e.g = k.g, e.b = k.b, e;
|
|
1008
|
-
}
|
|
1009
|
-
/**
|
|
1010
|
-
* Returns the value of this color as a CSS style string. Example: `rgb(255,0,0)`.
|
|
1011
|
-
*
|
|
1012
|
-
* @param {string} [colorSpace=SRGBColorSpace] - The color space.
|
|
1013
|
-
* @return {string} The CSS representation of this color.
|
|
1014
|
-
*/
|
|
1015
|
-
getStyle(e = B) {
|
|
1016
|
-
L.workingToColorSpace(k.copy(this), e);
|
|
1017
|
-
const n = k.r, r = k.g, i = k.b;
|
|
1018
|
-
return e !== B ? `color(${e} ${n.toFixed(3)} ${r.toFixed(3)} ${i.toFixed(3)})` : `rgb(${Math.round(n * 255)},${Math.round(r * 255)},${Math.round(i * 255)})`;
|
|
1019
|
-
}
|
|
1020
|
-
/**
|
|
1021
|
-
* Adds the given HSL values to this color's values.
|
|
1022
|
-
* Internally, this converts the color's RGB values to HSL, adds HSL
|
|
1023
|
-
* and then converts the color back to RGB.
|
|
1024
|
-
*
|
|
1025
|
-
* @param {number} h - Hue value between `0.0` and `1.0`.
|
|
1026
|
-
* @param {number} s - Saturation value between `0.0` and `1.0`.
|
|
1027
|
-
* @param {number} l - Lightness value between `0.0` and `1.0`.
|
|
1028
|
-
* @return {Color} A reference to this color.
|
|
1029
|
-
*/
|
|
1030
|
-
offsetHSL(e, n, r) {
|
|
1031
|
-
return this.getHSL(G), this.setHSL(G.h + e, G.s + n, G.l + r);
|
|
1032
|
-
}
|
|
1033
|
-
/**
|
|
1034
|
-
* Adds the RGB values of the given color to the RGB values of this color.
|
|
1035
|
-
*
|
|
1036
|
-
* @param {Color} color - The color to add.
|
|
1037
|
-
* @return {Color} A reference to this color.
|
|
1038
|
-
*/
|
|
1039
|
-
add(e) {
|
|
1040
|
-
return this.r += e.r, this.g += e.g, this.b += e.b, this;
|
|
1041
|
-
}
|
|
1042
|
-
/**
|
|
1043
|
-
* Adds the RGB values of the given colors and stores the result in this instance.
|
|
1044
|
-
*
|
|
1045
|
-
* @param {Color} color1 - The first color.
|
|
1046
|
-
* @param {Color} color2 - The second color.
|
|
1047
|
-
* @return {Color} A reference to this color.
|
|
1048
|
-
*/
|
|
1049
|
-
addColors(e, n) {
|
|
1050
|
-
return this.r = e.r + n.r, this.g = e.g + n.g, this.b = e.b + n.b, this;
|
|
1051
|
-
}
|
|
1052
|
-
/**
|
|
1053
|
-
* Adds the given scalar value to the RGB values of this color.
|
|
1054
|
-
*
|
|
1055
|
-
* @param {number} s - The scalar to add.
|
|
1056
|
-
* @return {Color} A reference to this color.
|
|
1057
|
-
*/
|
|
1058
|
-
addScalar(e) {
|
|
1059
|
-
return this.r += e, this.g += e, this.b += e, this;
|
|
1060
|
-
}
|
|
1061
|
-
/**
|
|
1062
|
-
* Subtracts the RGB values of the given color from the RGB values of this color.
|
|
1063
|
-
*
|
|
1064
|
-
* @param {Color} color - The color to subtract.
|
|
1065
|
-
* @return {Color} A reference to this color.
|
|
1066
|
-
*/
|
|
1067
|
-
sub(e) {
|
|
1068
|
-
return this.r = Math.max(0, this.r - e.r), this.g = Math.max(0, this.g - e.g), this.b = Math.max(0, this.b - e.b), this;
|
|
1069
|
-
}
|
|
1070
|
-
/**
|
|
1071
|
-
* Multiplies the RGB values of the given color with the RGB values of this color.
|
|
1072
|
-
*
|
|
1073
|
-
* @param {Color} color - The color to multiply.
|
|
1074
|
-
* @return {Color} A reference to this color.
|
|
1075
|
-
*/
|
|
1076
|
-
multiply(e) {
|
|
1077
|
-
return this.r *= e.r, this.g *= e.g, this.b *= e.b, this;
|
|
1078
|
-
}
|
|
1079
|
-
/**
|
|
1080
|
-
* Multiplies the given scalar value with the RGB values of this color.
|
|
1081
|
-
*
|
|
1082
|
-
* @param {number} s - The scalar to multiply.
|
|
1083
|
-
* @return {Color} A reference to this color.
|
|
1084
|
-
*/
|
|
1085
|
-
multiplyScalar(e) {
|
|
1086
|
-
return this.r *= e, this.g *= e, this.b *= e, this;
|
|
1087
|
-
}
|
|
1088
|
-
/**
|
|
1089
|
-
* Linearly interpolates this color's RGB values toward the RGB values of the
|
|
1090
|
-
* given color. The alpha argument can be thought of as the ratio between
|
|
1091
|
-
* the two colors, where `0.0` is this color and `1.0` is the first argument.
|
|
1092
|
-
*
|
|
1093
|
-
* @param {Color} color - The color to converge on.
|
|
1094
|
-
* @param {number} alpha - The interpolation factor in the closed interval `[0,1]`.
|
|
1095
|
-
* @return {Color} A reference to this color.
|
|
1096
|
-
*/
|
|
1097
|
-
lerp(e, n) {
|
|
1098
|
-
return this.r += (e.r - this.r) * n, this.g += (e.g - this.g) * n, this.b += (e.b - this.b) * n, this;
|
|
1099
|
-
}
|
|
1100
|
-
/**
|
|
1101
|
-
* Linearly interpolates between the given colors and stores the result in this instance.
|
|
1102
|
-
* The alpha argument can be thought of as the ratio between the two colors, where `0.0`
|
|
1103
|
-
* is the first and `1.0` is the second color.
|
|
1104
|
-
*
|
|
1105
|
-
* @param {Color} color1 - The first color.
|
|
1106
|
-
* @param {Color} color2 - The second color.
|
|
1107
|
-
* @param {number} alpha - The interpolation factor in the closed interval `[0,1]`.
|
|
1108
|
-
* @return {Color} A reference to this color.
|
|
1109
|
-
*/
|
|
1110
|
-
lerpColors(e, n, r) {
|
|
1111
|
-
return this.r = e.r + (n.r - e.r) * r, this.g = e.g + (n.g - e.g) * r, this.b = e.b + (n.b - e.b) * r, this;
|
|
1112
|
-
}
|
|
1113
|
-
/**
|
|
1114
|
-
* Linearly interpolates this color's HSL values toward the HSL values of the
|
|
1115
|
-
* given color. It differs from {@link Color#lerp} by not interpolating straight
|
|
1116
|
-
* from one color to the other, but instead going through all the hues in between
|
|
1117
|
-
* those two colors. The alpha argument can be thought of as the ratio between
|
|
1118
|
-
* the two colors, where 0.0 is this color and 1.0 is the first argument.
|
|
1119
|
-
*
|
|
1120
|
-
* @param {Color} color - The color to converge on.
|
|
1121
|
-
* @param {number} alpha - The interpolation factor in the closed interval `[0,1]`.
|
|
1122
|
-
* @return {Color} A reference to this color.
|
|
1123
|
-
*/
|
|
1124
|
-
lerpHSL(e, n) {
|
|
1125
|
-
this.getHSL(G), e.getHSL(xe);
|
|
1126
|
-
const r = Se(G.h, xe.h, n), i = Se(G.s, xe.s, n), o = Se(G.l, xe.l, n);
|
|
1127
|
-
return this.setHSL(r, i, o), this;
|
|
1128
|
-
}
|
|
1129
|
-
/**
|
|
1130
|
-
* Sets the color's RGB components from the given 3D vector.
|
|
1131
|
-
*
|
|
1132
|
-
* @param {Vector3} v - The vector to set.
|
|
1133
|
-
* @return {Color} A reference to this color.
|
|
1134
|
-
*/
|
|
1135
|
-
setFromVector3(e) {
|
|
1136
|
-
return this.r = e.x, this.g = e.y, this.b = e.z, this;
|
|
1137
|
-
}
|
|
1138
|
-
/**
|
|
1139
|
-
* Transforms this color with the given 3x3 matrix.
|
|
1140
|
-
*
|
|
1141
|
-
* @param {Matrix3} m - The matrix.
|
|
1142
|
-
* @return {Color} A reference to this color.
|
|
1143
|
-
*/
|
|
1144
|
-
applyMatrix3(e) {
|
|
1145
|
-
const n = this.r, r = this.g, i = this.b, o = e.elements;
|
|
1146
|
-
return this.r = o[0] * n + o[3] * r + o[6] * i, this.g = o[1] * n + o[4] * r + o[7] * i, this.b = o[2] * n + o[5] * r + o[8] * i, this;
|
|
1147
|
-
}
|
|
1148
|
-
/**
|
|
1149
|
-
* Returns `true` if this color is equal with the given one.
|
|
1150
|
-
*
|
|
1151
|
-
* @param {Color} c - The color to test for equality.
|
|
1152
|
-
* @return {boolean} Whether this bounding color is equal with the given one.
|
|
1153
|
-
*/
|
|
1154
|
-
equals(e) {
|
|
1155
|
-
return e.r === this.r && e.g === this.g && e.b === this.b;
|
|
1156
|
-
}
|
|
1157
|
-
/**
|
|
1158
|
-
* Sets this color's RGB components from the given array.
|
|
1159
|
-
*
|
|
1160
|
-
* @param {Array<number>} array - An array holding the RGB values.
|
|
1161
|
-
* @param {number} [offset=0] - The offset into the array.
|
|
1162
|
-
* @return {Color} A reference to this color.
|
|
1163
|
-
*/
|
|
1164
|
-
fromArray(e, n = 0) {
|
|
1165
|
-
return this.r = e[n], this.g = e[n + 1], this.b = e[n + 2], this;
|
|
1166
|
-
}
|
|
1167
|
-
/**
|
|
1168
|
-
* Writes the RGB components of this color to the given array. If no array is provided,
|
|
1169
|
-
* the method returns a new instance.
|
|
1170
|
-
*
|
|
1171
|
-
* @param {Array<number>} [array=[]] - The target array holding the color components.
|
|
1172
|
-
* @param {number} [offset=0] - Index of the first element in the array.
|
|
1173
|
-
* @return {Array<number>} The color components.
|
|
1174
|
-
*/
|
|
1175
|
-
toArray(e = [], n = 0) {
|
|
1176
|
-
return e[n] = this.r, e[n + 1] = this.g, e[n + 2] = this.b, e;
|
|
1177
|
-
}
|
|
1178
|
-
/**
|
|
1179
|
-
* Sets the components of this color from the given buffer attribute.
|
|
1180
|
-
*
|
|
1181
|
-
* @param {BufferAttribute} attribute - The buffer attribute holding color data.
|
|
1182
|
-
* @param {number} index - The index into the attribute.
|
|
1183
|
-
* @return {Color} A reference to this color.
|
|
1184
|
-
*/
|
|
1185
|
-
fromBufferAttribute(e, n) {
|
|
1186
|
-
return this.r = e.getX(n), this.g = e.getY(n), this.b = e.getZ(n), this;
|
|
1187
|
-
}
|
|
1188
|
-
/**
|
|
1189
|
-
* This methods defines the serialization result of this class. Returns the color
|
|
1190
|
-
* as a hexadecimal value.
|
|
1191
|
-
*
|
|
1192
|
-
* @return {number} The hexadecimal value.
|
|
1193
|
-
*/
|
|
1194
|
-
toJSON() {
|
|
1195
|
-
return this.getHex();
|
|
1196
|
-
}
|
|
1197
|
-
*[Symbol.iterator]() {
|
|
1198
|
-
yield this.r, yield this.g, yield this.b;
|
|
1199
|
-
}
|
|
1200
|
-
};
|
|
1201
|
-
const k = /* @__PURE__ */ new oe();
|
|
1202
|
-
oe.NAMES = pt;
|
|
1203
|
-
typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register", { detail: {
|
|
1204
|
-
revision: xt
|
|
1205
|
-
} }));
|
|
1206
|
-
typeof window < "u" && (window.__THREE__ ? console.warn("WARNING: Multiple instances of Three.js being imported.") : window.__THREE__ = xt);
|
|
1207
|
-
const It = "https://raw.githubusercontent.com/nvkelso/natural-earth-vector/master/geojson/ne_110m_admin_0_countries.geojson", Ht = "https://cdn.jsdelivr.net/npm/world-atlas@2/countries-110m.json", Ot = "https://raw.githubusercontent.com/nvkelso/natural-earth-vector/master/geojson/ne_10m_admin_1_states_provinces.geojson", Pt = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='4' height='4'><rect width='4' height='4' fill='%23f5f5f5'/></svg>", jt = {
|
|
82
|
+
const pn = "https://raw.githubusercontent.com/nvkelso/natural-earth-vector/master/geojson/ne_110m_admin_0_countries.geojson", xn = "https://cdn.jsdelivr.net/npm/world-atlas@2/countries-110m.json", bn = "https://raw.githubusercontent.com/nvkelso/natural-earth-vector/master/geojson/ne_10m_admin_1_states_provinces.geojson", yn = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='4' height='4'><rect width='4' height='4' fill='%23f5f5f5'/></svg>", wn = {
|
|
1208
83
|
minColor: "#f8fafc",
|
|
1209
84
|
maxColor: "#e5e7eb"
|
|
1210
85
|
};
|
|
1211
|
-
function
|
|
1212
|
-
|
|
86
|
+
function Ae(e, n, t) {
|
|
87
|
+
e.prototype = n.prototype = t, t.constructor = e;
|
|
1213
88
|
}
|
|
1214
|
-
function
|
|
1215
|
-
var
|
|
1216
|
-
for (var r in
|
|
1217
|
-
return
|
|
89
|
+
function Qe(e, n) {
|
|
90
|
+
var t = Object.create(e.prototype);
|
|
91
|
+
for (var r in n) t[r] = n[r];
|
|
92
|
+
return t;
|
|
1218
93
|
}
|
|
1219
|
-
function
|
|
94
|
+
function te() {
|
|
1220
95
|
}
|
|
1221
|
-
var
|
|
96
|
+
var Q = 0.7, de = 1 / Q, J = "\\s*([+-]?\\d+)\\s*", ee = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", S = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", vn = /^#([0-9a-f]{3,8})$/, Nn = new RegExp(`^rgb\\(${J},${J},${J}\\)$`), Mn = new RegExp(`^rgb\\(${S},${S},${S}\\)$`), _n = new RegExp(`^rgba\\(${J},${J},${J},${ee}\\)$`), $n = new RegExp(`^rgba\\(${S},${S},${S},${ee}\\)$`), Rn = new RegExp(`^hsl\\(${ee},${S},${S}\\)$`), kn = new RegExp(`^hsla\\(${ee},${S},${S},${ee}\\)$`), Oe = {
|
|
1222
97
|
aliceblue: 15792383,
|
|
1223
98
|
antiquewhite: 16444375,
|
|
1224
99
|
aqua: 65535,
|
|
@@ -1368,781 +243,818 @@ var se = 0.7, Fe = 1 / se, ee = "\\s*([+-]?\\d+)\\s*", ae = "\\s*([+-]?(?:\\d*\\
|
|
|
1368
243
|
yellow: 16776960,
|
|
1369
244
|
yellowgreen: 10145074
|
|
1370
245
|
};
|
|
1371
|
-
|
|
1372
|
-
copy(
|
|
1373
|
-
return Object.assign(new this.constructor(), this,
|
|
246
|
+
Ae(te, ne, {
|
|
247
|
+
copy(e) {
|
|
248
|
+
return Object.assign(new this.constructor(), this, e);
|
|
1374
249
|
},
|
|
1375
250
|
displayable() {
|
|
1376
251
|
return this.rgb().displayable();
|
|
1377
252
|
},
|
|
1378
|
-
hex:
|
|
253
|
+
hex: ze,
|
|
1379
254
|
// Deprecated! Use color.formatHex.
|
|
1380
|
-
formatHex:
|
|
1381
|
-
formatHex8:
|
|
1382
|
-
formatHsl:
|
|
1383
|
-
formatRgb:
|
|
1384
|
-
toString:
|
|
255
|
+
formatHex: ze,
|
|
256
|
+
formatHex8: Cn,
|
|
257
|
+
formatHsl: Ln,
|
|
258
|
+
formatRgb: He,
|
|
259
|
+
toString: He
|
|
1385
260
|
});
|
|
1386
|
-
function
|
|
261
|
+
function ze() {
|
|
1387
262
|
return this.rgb().formatHex();
|
|
1388
263
|
}
|
|
1389
|
-
function
|
|
264
|
+
function Cn() {
|
|
1390
265
|
return this.rgb().formatHex8();
|
|
1391
266
|
}
|
|
1392
|
-
function
|
|
1393
|
-
return
|
|
267
|
+
function Ln() {
|
|
268
|
+
return en(this).formatHsl();
|
|
1394
269
|
}
|
|
1395
|
-
function
|
|
270
|
+
function He() {
|
|
1396
271
|
return this.rgb().formatRgb();
|
|
1397
272
|
}
|
|
1398
|
-
function
|
|
1399
|
-
var
|
|
1400
|
-
return
|
|
273
|
+
function ne(e) {
|
|
274
|
+
var n, t;
|
|
275
|
+
return e = (e + "").trim().toLowerCase(), (n = vn.exec(e)) ? (t = n[1].length, n = parseInt(n[1], 16), t === 6 ? Te(n) : t === 3 ? new $(n >> 8 & 15 | n >> 4 & 240, n >> 4 & 15 | n & 240, (n & 15) << 4 | n & 15, 1) : t === 8 ? fe(n >> 24 & 255, n >> 16 & 255, n >> 8 & 255, (n & 255) / 255) : t === 4 ? fe(n >> 12 & 15 | n >> 8 & 240, n >> 8 & 15 | n >> 4 & 240, n >> 4 & 15 | n & 240, ((n & 15) << 4 | n & 15) / 255) : null) : (n = Nn.exec(e)) ? new $(n[1], n[2], n[3], 1) : (n = Mn.exec(e)) ? new $(n[1] * 255 / 100, n[2] * 255 / 100, n[3] * 255 / 100, 1) : (n = _n.exec(e)) ? fe(n[1], n[2], n[3], n[4]) : (n = $n.exec(e)) ? fe(n[1] * 255 / 100, n[2] * 255 / 100, n[3] * 255 / 100, n[4]) : (n = Rn.exec(e)) ? De(n[1], n[2] / 100, n[3] / 100, 1) : (n = kn.exec(e)) ? De(n[1], n[2] / 100, n[3] / 100, n[4]) : Oe.hasOwnProperty(e) ? Te(Oe[e]) : e === "transparent" ? new $(NaN, NaN, NaN, 0) : null;
|
|
1401
276
|
}
|
|
1402
|
-
function
|
|
1403
|
-
return new
|
|
277
|
+
function Te(e) {
|
|
278
|
+
return new $(e >> 16 & 255, e >> 8 & 255, e & 255, 1);
|
|
1404
279
|
}
|
|
1405
|
-
function
|
|
1406
|
-
return r <= 0 && (
|
|
280
|
+
function fe(e, n, t, r) {
|
|
281
|
+
return r <= 0 && (e = n = t = NaN), new $(e, n, t, r);
|
|
1407
282
|
}
|
|
1408
|
-
function
|
|
1409
|
-
return
|
|
283
|
+
function An(e) {
|
|
284
|
+
return e instanceof te || (e = ne(e)), e ? (e = e.rgb(), new $(e.r, e.g, e.b, e.opacity)) : new $();
|
|
1410
285
|
}
|
|
1411
|
-
function
|
|
1412
|
-
return arguments.length === 1 ?
|
|
286
|
+
function $e(e, n, t, r) {
|
|
287
|
+
return arguments.length === 1 ? An(e) : new $(e, n, t, r ?? 1);
|
|
1413
288
|
}
|
|
1414
|
-
function
|
|
1415
|
-
this.r = +
|
|
289
|
+
function $(e, n, t, r) {
|
|
290
|
+
this.r = +e, this.g = +n, this.b = +t, this.opacity = +r;
|
|
1416
291
|
}
|
|
1417
|
-
|
|
1418
|
-
brighter(
|
|
1419
|
-
return
|
|
292
|
+
Ae($, $e, Qe(te, {
|
|
293
|
+
brighter(e) {
|
|
294
|
+
return e = e == null ? de : Math.pow(de, e), new $(this.r * e, this.g * e, this.b * e, this.opacity);
|
|
1420
295
|
},
|
|
1421
|
-
darker(
|
|
1422
|
-
return
|
|
296
|
+
darker(e) {
|
|
297
|
+
return e = e == null ? Q : Math.pow(Q, e), new $(this.r * e, this.g * e, this.b * e, this.opacity);
|
|
1423
298
|
},
|
|
1424
299
|
rgb() {
|
|
1425
300
|
return this;
|
|
1426
301
|
},
|
|
1427
302
|
clamp() {
|
|
1428
|
-
return new
|
|
303
|
+
return new $(U(this.r), U(this.g), U(this.b), he(this.opacity));
|
|
1429
304
|
},
|
|
1430
305
|
displayable() {
|
|
1431
306
|
return -0.5 <= this.r && this.r < 255.5 && -0.5 <= this.g && this.g < 255.5 && -0.5 <= this.b && this.b < 255.5 && 0 <= this.opacity && this.opacity <= 1;
|
|
1432
307
|
},
|
|
1433
|
-
hex:
|
|
308
|
+
hex: Ge,
|
|
1434
309
|
// Deprecated! Use color.formatHex.
|
|
1435
|
-
formatHex:
|
|
1436
|
-
formatHex8:
|
|
1437
|
-
formatRgb:
|
|
1438
|
-
toString:
|
|
310
|
+
formatHex: Ge,
|
|
311
|
+
formatHex8: Sn,
|
|
312
|
+
formatRgb: Ue,
|
|
313
|
+
toString: Ue
|
|
1439
314
|
}));
|
|
1440
|
-
function
|
|
1441
|
-
return `#${
|
|
315
|
+
function Ge() {
|
|
316
|
+
return `#${G(this.r)}${G(this.g)}${G(this.b)}`;
|
|
1442
317
|
}
|
|
1443
|
-
function
|
|
1444
|
-
return `#${
|
|
318
|
+
function Sn() {
|
|
319
|
+
return `#${G(this.r)}${G(this.g)}${G(this.b)}${G((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
|
|
1445
320
|
}
|
|
1446
|
-
function
|
|
1447
|
-
const
|
|
1448
|
-
return `${
|
|
321
|
+
function Ue() {
|
|
322
|
+
const e = he(this.opacity);
|
|
323
|
+
return `${e === 1 ? "rgb(" : "rgba("}${U(this.r)}, ${U(this.g)}, ${U(this.b)}${e === 1 ? ")" : `, ${e})`}`;
|
|
1449
324
|
}
|
|
1450
|
-
function
|
|
1451
|
-
return isNaN(
|
|
325
|
+
function he(e) {
|
|
326
|
+
return isNaN(e) ? 1 : Math.max(0, Math.min(1, e));
|
|
1452
327
|
}
|
|
1453
|
-
function
|
|
1454
|
-
return Math.max(0, Math.min(255, Math.round(
|
|
328
|
+
function U(e) {
|
|
329
|
+
return Math.max(0, Math.min(255, Math.round(e) || 0));
|
|
1455
330
|
}
|
|
1456
|
-
function
|
|
1457
|
-
return
|
|
331
|
+
function G(e) {
|
|
332
|
+
return e = U(e), (e < 16 ? "0" : "") + e.toString(16);
|
|
1458
333
|
}
|
|
1459
|
-
function
|
|
1460
|
-
return r <= 0 ?
|
|
334
|
+
function De(e, n, t, r) {
|
|
335
|
+
return r <= 0 ? e = n = t = NaN : t <= 0 || t >= 1 ? e = n = NaN : n <= 0 && (e = NaN), new L(e, n, t, r);
|
|
1461
336
|
}
|
|
1462
|
-
function
|
|
1463
|
-
if (
|
|
1464
|
-
if (
|
|
1465
|
-
if (
|
|
1466
|
-
|
|
1467
|
-
var
|
|
1468
|
-
return
|
|
337
|
+
function en(e) {
|
|
338
|
+
if (e instanceof L) return new L(e.h, e.s, e.l, e.opacity);
|
|
339
|
+
if (e instanceof te || (e = ne(e)), !e) return new L();
|
|
340
|
+
if (e instanceof L) return e;
|
|
341
|
+
e = e.rgb();
|
|
342
|
+
var n = e.r / 255, t = e.g / 255, r = e.b / 255, i = Math.min(n, t, r), a = Math.max(n, t, r), o = NaN, s = a - i, l = (a + i) / 2;
|
|
343
|
+
return s ? (n === a ? o = (t - r) / s + (t < r) * 6 : t === a ? o = (r - n) / s + 2 : o = (n - t) / s + 4, s /= l < 0.5 ? a + i : 2 - a - i, o *= 60) : s = l > 0 && l < 1 ? 0 : o, new L(o, s, l, e.opacity);
|
|
1469
344
|
}
|
|
1470
|
-
function
|
|
1471
|
-
return arguments.length === 1 ?
|
|
345
|
+
function En(e, n, t, r) {
|
|
346
|
+
return arguments.length === 1 ? en(e) : new L(e, n, t, r ?? 1);
|
|
1472
347
|
}
|
|
1473
|
-
function
|
|
1474
|
-
this.h = +
|
|
348
|
+
function L(e, n, t, r) {
|
|
349
|
+
this.h = +e, this.s = +n, this.l = +t, this.opacity = +r;
|
|
1475
350
|
}
|
|
1476
|
-
|
|
1477
|
-
brighter(
|
|
1478
|
-
return
|
|
351
|
+
Ae(L, En, Qe(te, {
|
|
352
|
+
brighter(e) {
|
|
353
|
+
return e = e == null ? de : Math.pow(de, e), new L(this.h, this.s, this.l * e, this.opacity);
|
|
1479
354
|
},
|
|
1480
|
-
darker(
|
|
1481
|
-
return
|
|
355
|
+
darker(e) {
|
|
356
|
+
return e = e == null ? Q : Math.pow(Q, e), new L(this.h, this.s, this.l * e, this.opacity);
|
|
1482
357
|
},
|
|
1483
358
|
rgb() {
|
|
1484
|
-
var
|
|
1485
|
-
return new
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
359
|
+
var e = this.h % 360 + (this.h < 0) * 360, n = isNaN(e) || isNaN(this.s) ? 0 : this.s, t = this.l, r = t + (t < 0.5 ? t : 1 - t) * n, i = 2 * t - r;
|
|
360
|
+
return new $(
|
|
361
|
+
ve(e >= 240 ? e - 240 : e + 120, i, r),
|
|
362
|
+
ve(e, i, r),
|
|
363
|
+
ve(e < 120 ? e + 240 : e - 120, i, r),
|
|
1489
364
|
this.opacity
|
|
1490
365
|
);
|
|
1491
366
|
},
|
|
1492
367
|
clamp() {
|
|
1493
|
-
return new
|
|
368
|
+
return new L(Ve(this.h), ce(this.s), ce(this.l), he(this.opacity));
|
|
1494
369
|
},
|
|
1495
370
|
displayable() {
|
|
1496
371
|
return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1;
|
|
1497
372
|
},
|
|
1498
373
|
formatHsl() {
|
|
1499
|
-
const
|
|
1500
|
-
return `${
|
|
374
|
+
const e = he(this.opacity);
|
|
375
|
+
return `${e === 1 ? "hsl(" : "hsla("}${Ve(this.h)}, ${ce(this.s) * 100}%, ${ce(this.l) * 100}%${e === 1 ? ")" : `, ${e})`}`;
|
|
1501
376
|
}
|
|
1502
377
|
}));
|
|
1503
|
-
function
|
|
1504
|
-
return
|
|
378
|
+
function Ve(e) {
|
|
379
|
+
return e = (e || 0) % 360, e < 0 ? e + 360 : e;
|
|
1505
380
|
}
|
|
1506
|
-
function
|
|
1507
|
-
return Math.max(0, Math.min(1,
|
|
381
|
+
function ce(e) {
|
|
382
|
+
return Math.max(0, Math.min(1, e || 0));
|
|
1508
383
|
}
|
|
1509
|
-
function
|
|
1510
|
-
return (
|
|
384
|
+
function ve(e, n, t) {
|
|
385
|
+
return (e < 60 ? n + (t - n) * e / 60 : e < 180 ? t : e < 240 ? n + (t - n) * (240 - e) / 60 : n) * 255;
|
|
1511
386
|
}
|
|
1512
|
-
const
|
|
1513
|
-
function
|
|
1514
|
-
return function(
|
|
1515
|
-
return
|
|
387
|
+
const Se = (e) => () => e;
|
|
388
|
+
function In(e, n) {
|
|
389
|
+
return function(t) {
|
|
390
|
+
return e + t * n;
|
|
1516
391
|
};
|
|
1517
392
|
}
|
|
1518
|
-
function
|
|
1519
|
-
return
|
|
1520
|
-
return Math.pow(
|
|
393
|
+
function jn(e, n, t) {
|
|
394
|
+
return e = Math.pow(e, t), n = Math.pow(n, t) - e, t = 1 / t, function(r) {
|
|
395
|
+
return Math.pow(e + r * n, t);
|
|
1521
396
|
};
|
|
1522
397
|
}
|
|
1523
|
-
function
|
|
1524
|
-
return (
|
|
1525
|
-
return
|
|
398
|
+
function Fn(e) {
|
|
399
|
+
return (e = +e) == 1 ? nn : function(n, t) {
|
|
400
|
+
return t - n ? jn(n, t, e) : Se(isNaN(n) ? t : n);
|
|
1526
401
|
};
|
|
1527
402
|
}
|
|
1528
|
-
function
|
|
1529
|
-
var
|
|
1530
|
-
return
|
|
403
|
+
function nn(e, n) {
|
|
404
|
+
var t = n - e;
|
|
405
|
+
return t ? In(e, t) : Se(isNaN(e) ? n : e);
|
|
1531
406
|
}
|
|
1532
|
-
const
|
|
1533
|
-
var
|
|
1534
|
-
function r(i,
|
|
1535
|
-
var
|
|
1536
|
-
return function(
|
|
1537
|
-
return i.r =
|
|
407
|
+
const Re = (function e(n) {
|
|
408
|
+
var t = Fn(n);
|
|
409
|
+
function r(i, a) {
|
|
410
|
+
var o = t((i = $e(i)).r, (a = $e(a)).r), s = t(i.g, a.g), l = t(i.b, a.b), f = nn(i.opacity, a.opacity);
|
|
411
|
+
return function(h) {
|
|
412
|
+
return i.r = o(h), i.g = s(h), i.b = l(h), i.opacity = f(h), i + "";
|
|
1538
413
|
};
|
|
1539
414
|
}
|
|
1540
|
-
return r.gamma =
|
|
415
|
+
return r.gamma = e, r;
|
|
1541
416
|
})(1);
|
|
1542
|
-
function
|
|
1543
|
-
|
|
1544
|
-
var
|
|
1545
|
-
return function(
|
|
1546
|
-
for (i = 0; i <
|
|
417
|
+
function Pn(e, n) {
|
|
418
|
+
n || (n = []);
|
|
419
|
+
var t = e ? Math.min(n.length, e.length) : 0, r = n.slice(), i;
|
|
420
|
+
return function(a) {
|
|
421
|
+
for (i = 0; i < t; ++i) r[i] = e[i] * (1 - a) + n[i] * a;
|
|
1547
422
|
return r;
|
|
1548
423
|
};
|
|
1549
424
|
}
|
|
1550
|
-
function
|
|
1551
|
-
return ArrayBuffer.isView(
|
|
425
|
+
function On(e) {
|
|
426
|
+
return ArrayBuffer.isView(e) && !(e instanceof DataView);
|
|
1552
427
|
}
|
|
1553
|
-
function
|
|
1554
|
-
var
|
|
1555
|
-
for (
|
|
1556
|
-
for (;
|
|
1557
|
-
return function(
|
|
1558
|
-
for (
|
|
1559
|
-
return
|
|
428
|
+
function zn(e, n) {
|
|
429
|
+
var t = n ? n.length : 0, r = e ? Math.min(t, e.length) : 0, i = new Array(r), a = new Array(t), o;
|
|
430
|
+
for (o = 0; o < r; ++o) i[o] = Ee(e[o], n[o]);
|
|
431
|
+
for (; o < t; ++o) a[o] = n[o];
|
|
432
|
+
return function(s) {
|
|
433
|
+
for (o = 0; o < r; ++o) a[o] = i[o](s);
|
|
434
|
+
return a;
|
|
1560
435
|
};
|
|
1561
436
|
}
|
|
1562
|
-
function
|
|
1563
|
-
var
|
|
1564
|
-
return
|
|
1565
|
-
return
|
|
437
|
+
function Hn(e, n) {
|
|
438
|
+
var t = /* @__PURE__ */ new Date();
|
|
439
|
+
return e = +e, n = +n, function(r) {
|
|
440
|
+
return t.setTime(e * (1 - r) + n * r), t;
|
|
1566
441
|
};
|
|
1567
442
|
}
|
|
1568
|
-
function
|
|
1569
|
-
return
|
|
1570
|
-
return
|
|
443
|
+
function me(e, n) {
|
|
444
|
+
return e = +e, n = +n, function(t) {
|
|
445
|
+
return e * (1 - t) + n * t;
|
|
1571
446
|
};
|
|
1572
447
|
}
|
|
1573
|
-
function
|
|
1574
|
-
var
|
|
1575
|
-
(
|
|
1576
|
-
for (i in
|
|
1577
|
-
i in
|
|
1578
|
-
return function(
|
|
1579
|
-
for (i in
|
|
448
|
+
function Tn(e, n) {
|
|
449
|
+
var t = {}, r = {}, i;
|
|
450
|
+
(e === null || typeof e != "object") && (e = {}), (n === null || typeof n != "object") && (n = {});
|
|
451
|
+
for (i in n)
|
|
452
|
+
i in e ? t[i] = Ee(e[i], n[i]) : r[i] = n[i];
|
|
453
|
+
return function(a) {
|
|
454
|
+
for (i in t) r[i] = t[i](a);
|
|
1580
455
|
return r;
|
|
1581
456
|
};
|
|
1582
457
|
}
|
|
1583
|
-
var
|
|
1584
|
-
function
|
|
458
|
+
var ke = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, Ne = new RegExp(ke.source, "g");
|
|
459
|
+
function Gn(e) {
|
|
1585
460
|
return function() {
|
|
1586
|
-
return
|
|
461
|
+
return e;
|
|
1587
462
|
};
|
|
1588
463
|
}
|
|
1589
|
-
function
|
|
1590
|
-
return function(
|
|
1591
|
-
return
|
|
464
|
+
function Un(e) {
|
|
465
|
+
return function(n) {
|
|
466
|
+
return e(n) + "";
|
|
1592
467
|
};
|
|
1593
468
|
}
|
|
1594
|
-
function
|
|
1595
|
-
var
|
|
1596
|
-
for (
|
|
1597
|
-
(
|
|
1598
|
-
return
|
|
1599
|
-
for (var
|
|
1600
|
-
return
|
|
469
|
+
function Dn(e, n) {
|
|
470
|
+
var t = ke.lastIndex = Ne.lastIndex = 0, r, i, a, o = -1, s = [], l = [];
|
|
471
|
+
for (e = e + "", n = n + ""; (r = ke.exec(e)) && (i = Ne.exec(n)); )
|
|
472
|
+
(a = i.index) > t && (a = n.slice(t, a), s[o] ? s[o] += a : s[++o] = a), (r = r[0]) === (i = i[0]) ? s[o] ? s[o] += i : s[++o] = i : (s[++o] = null, l.push({ i: o, x: me(r, i) })), t = Ne.lastIndex;
|
|
473
|
+
return t < n.length && (a = n.slice(t), s[o] ? s[o] += a : s[++o] = a), s.length < 2 ? l[0] ? Un(l[0].x) : Gn(n) : (n = l.length, function(f) {
|
|
474
|
+
for (var h = 0, u; h < n; ++h) s[(u = l[h]).i] = u.x(f);
|
|
475
|
+
return s.join("");
|
|
1601
476
|
});
|
|
1602
477
|
}
|
|
1603
|
-
function
|
|
1604
|
-
var
|
|
1605
|
-
return
|
|
478
|
+
function Ee(e, n) {
|
|
479
|
+
var t = typeof n, r;
|
|
480
|
+
return n == null || t === "boolean" ? Se(n) : (t === "number" ? me : t === "string" ? (r = ne(n)) ? (n = r, Re) : Dn : n instanceof ne ? Re : n instanceof Date ? Hn : On(n) ? Pn : Array.isArray(n) ? zn : typeof n.valueOf != "function" && typeof n.toString != "function" || isNaN(n) ? Tn : me)(e, n);
|
|
1606
481
|
}
|
|
1607
|
-
function
|
|
1608
|
-
return
|
|
1609
|
-
return Math.round(
|
|
482
|
+
function Vn(e, n) {
|
|
483
|
+
return e = +e, n = +n, function(t) {
|
|
484
|
+
return Math.round(e * (1 - t) + n * t);
|
|
1610
485
|
};
|
|
1611
486
|
}
|
|
1612
|
-
function
|
|
1613
|
-
return
|
|
487
|
+
function le(e, n) {
|
|
488
|
+
return e == null || n == null ? NaN : e < n ? -1 : e > n ? 1 : e >= n ? 0 : NaN;
|
|
1614
489
|
}
|
|
1615
|
-
function
|
|
1616
|
-
return
|
|
490
|
+
function qn(e, n) {
|
|
491
|
+
return e == null || n == null ? NaN : n < e ? -1 : n > e ? 1 : n >= e ? 0 : NaN;
|
|
1617
492
|
}
|
|
1618
|
-
function
|
|
1619
|
-
let
|
|
1620
|
-
|
|
1621
|
-
function i(
|
|
1622
|
-
if (
|
|
1623
|
-
if (
|
|
493
|
+
function tn(e) {
|
|
494
|
+
let n, t, r;
|
|
495
|
+
e.length !== 2 ? (n = le, t = (s, l) => le(e(s), l), r = (s, l) => e(s) - l) : (n = e === le || e === qn ? e : Bn, t = e, r = e);
|
|
496
|
+
function i(s, l, f = 0, h = s.length) {
|
|
497
|
+
if (f < h) {
|
|
498
|
+
if (n(l, l) !== 0) return h;
|
|
1624
499
|
do {
|
|
1625
|
-
const
|
|
1626
|
-
|
|
1627
|
-
} while (
|
|
500
|
+
const u = f + h >>> 1;
|
|
501
|
+
t(s[u], l) < 0 ? f = u + 1 : h = u;
|
|
502
|
+
} while (f < h);
|
|
1628
503
|
}
|
|
1629
|
-
return
|
|
504
|
+
return f;
|
|
1630
505
|
}
|
|
1631
|
-
function
|
|
1632
|
-
if (
|
|
1633
|
-
if (
|
|
506
|
+
function a(s, l, f = 0, h = s.length) {
|
|
507
|
+
if (f < h) {
|
|
508
|
+
if (n(l, l) !== 0) return h;
|
|
1634
509
|
do {
|
|
1635
|
-
const
|
|
1636
|
-
|
|
1637
|
-
} while (
|
|
510
|
+
const u = f + h >>> 1;
|
|
511
|
+
t(s[u], l) <= 0 ? f = u + 1 : h = u;
|
|
512
|
+
} while (f < h);
|
|
1638
513
|
}
|
|
1639
|
-
return
|
|
514
|
+
return f;
|
|
1640
515
|
}
|
|
1641
|
-
function s
|
|
1642
|
-
const
|
|
1643
|
-
return
|
|
516
|
+
function o(s, l, f = 0, h = s.length) {
|
|
517
|
+
const u = i(s, l, f, h - 1);
|
|
518
|
+
return u > f && r(s[u - 1], l) > -r(s[u], l) ? u - 1 : u;
|
|
1644
519
|
}
|
|
1645
|
-
return { left: i, center:
|
|
520
|
+
return { left: i, center: o, right: a };
|
|
1646
521
|
}
|
|
1647
|
-
function
|
|
522
|
+
function Bn() {
|
|
1648
523
|
return 0;
|
|
1649
524
|
}
|
|
1650
|
-
function
|
|
1651
|
-
return
|
|
1652
|
-
}
|
|
1653
|
-
const
|
|
1654
|
-
|
|
1655
|
-
const
|
|
1656
|
-
function
|
|
1657
|
-
const r = (
|
|
1658
|
-
let
|
|
1659
|
-
return i < 0 ? (
|
|
1660
|
-
}
|
|
1661
|
-
function
|
|
1662
|
-
if (
|
|
1663
|
-
if (
|
|
1664
|
-
const r =
|
|
1665
|
-
if (!(
|
|
1666
|
-
const
|
|
525
|
+
function Zn(e) {
|
|
526
|
+
return e === null ? NaN : +e;
|
|
527
|
+
}
|
|
528
|
+
const Jn = tn(le), Yn = Jn.right;
|
|
529
|
+
tn(Zn).center;
|
|
530
|
+
const Kn = Math.sqrt(50), Xn = Math.sqrt(10), Wn = Math.sqrt(2);
|
|
531
|
+
function ge(e, n, t) {
|
|
532
|
+
const r = (n - e) / Math.max(0, t), i = Math.floor(Math.log10(r)), a = r / Math.pow(10, i), o = a >= Kn ? 10 : a >= Xn ? 5 : a >= Wn ? 2 : 1;
|
|
533
|
+
let s, l, f;
|
|
534
|
+
return i < 0 ? (f = Math.pow(10, -i) / o, s = Math.round(e * f), l = Math.round(n * f), s / f < e && ++s, l / f > n && --l, f = -f) : (f = Math.pow(10, i) * o, s = Math.round(e / f), l = Math.round(n / f), s * f < e && ++s, l * f > n && --l), l < s && 0.5 <= t && t < 2 ? ge(e, n, t * 2) : [s, l, f];
|
|
535
|
+
}
|
|
536
|
+
function Qn(e, n, t) {
|
|
537
|
+
if (n = +n, e = +e, t = +t, !(t > 0)) return [];
|
|
538
|
+
if (e === n) return [e];
|
|
539
|
+
const r = n < e, [i, a, o] = r ? ge(n, e, t) : ge(e, n, t);
|
|
540
|
+
if (!(a >= i)) return [];
|
|
541
|
+
const s = a - i + 1, l = new Array(s);
|
|
1667
542
|
if (r)
|
|
1668
|
-
if (
|
|
1669
|
-
else for (let
|
|
1670
|
-
else if (
|
|
1671
|
-
else for (let
|
|
1672
|
-
return
|
|
1673
|
-
}
|
|
1674
|
-
function
|
|
1675
|
-
return
|
|
1676
|
-
}
|
|
1677
|
-
function
|
|
1678
|
-
|
|
1679
|
-
const r =
|
|
543
|
+
if (o < 0) for (let f = 0; f < s; ++f) l[f] = (a - f) / -o;
|
|
544
|
+
else for (let f = 0; f < s; ++f) l[f] = (a - f) * o;
|
|
545
|
+
else if (o < 0) for (let f = 0; f < s; ++f) l[f] = (i + f) / -o;
|
|
546
|
+
else for (let f = 0; f < s; ++f) l[f] = (i + f) * o;
|
|
547
|
+
return l;
|
|
548
|
+
}
|
|
549
|
+
function Ce(e, n, t) {
|
|
550
|
+
return n = +n, e = +e, t = +t, ge(e, n, t)[2];
|
|
551
|
+
}
|
|
552
|
+
function et(e, n, t) {
|
|
553
|
+
n = +n, e = +e, t = +t;
|
|
554
|
+
const r = n < e, i = r ? Ce(n, e, t) : Ce(e, n, t);
|
|
1680
555
|
return (r ? -1 : 1) * (i < 0 ? 1 / -i : i);
|
|
1681
556
|
}
|
|
1682
|
-
function
|
|
557
|
+
function nt(e, n) {
|
|
1683
558
|
switch (arguments.length) {
|
|
1684
559
|
case 0:
|
|
1685
560
|
break;
|
|
1686
561
|
case 1:
|
|
1687
|
-
this.range(
|
|
562
|
+
this.range(e);
|
|
1688
563
|
break;
|
|
1689
564
|
default:
|
|
1690
|
-
this.range(
|
|
565
|
+
this.range(n).domain(e);
|
|
1691
566
|
break;
|
|
1692
567
|
}
|
|
1693
568
|
return this;
|
|
1694
569
|
}
|
|
1695
|
-
function
|
|
570
|
+
function tt(e) {
|
|
1696
571
|
return function() {
|
|
1697
|
-
return
|
|
572
|
+
return e;
|
|
1698
573
|
};
|
|
1699
574
|
}
|
|
1700
|
-
function
|
|
1701
|
-
return +
|
|
575
|
+
function rt(e) {
|
|
576
|
+
return +e;
|
|
1702
577
|
}
|
|
1703
|
-
var
|
|
1704
|
-
function
|
|
1705
|
-
return
|
|
578
|
+
var qe = [0, 1];
|
|
579
|
+
function Z(e) {
|
|
580
|
+
return e;
|
|
1706
581
|
}
|
|
1707
|
-
function
|
|
1708
|
-
return (
|
|
1709
|
-
return (
|
|
1710
|
-
} :
|
|
582
|
+
function Le(e, n) {
|
|
583
|
+
return (n -= e = +e) ? function(t) {
|
|
584
|
+
return (t - e) / n;
|
|
585
|
+
} : tt(isNaN(n) ? NaN : 0.5);
|
|
1711
586
|
}
|
|
1712
|
-
function
|
|
1713
|
-
var
|
|
1714
|
-
return
|
|
1715
|
-
return Math.max(
|
|
587
|
+
function it(e, n) {
|
|
588
|
+
var t;
|
|
589
|
+
return e > n && (t = e, e = n, n = t), function(r) {
|
|
590
|
+
return Math.max(e, Math.min(n, r));
|
|
1716
591
|
};
|
|
1717
592
|
}
|
|
1718
|
-
function
|
|
1719
|
-
var r =
|
|
1720
|
-
return i < r ? (r =
|
|
1721
|
-
return
|
|
593
|
+
function ot(e, n, t) {
|
|
594
|
+
var r = e[0], i = e[1], a = n[0], o = n[1];
|
|
595
|
+
return i < r ? (r = Le(i, r), a = t(o, a)) : (r = Le(r, i), a = t(a, o)), function(s) {
|
|
596
|
+
return a(r(s));
|
|
1722
597
|
};
|
|
1723
598
|
}
|
|
1724
|
-
function
|
|
1725
|
-
var r = Math.min(
|
|
1726
|
-
for (
|
|
1727
|
-
i[
|
|
1728
|
-
return function(
|
|
1729
|
-
var
|
|
1730
|
-
return
|
|
599
|
+
function at(e, n, t) {
|
|
600
|
+
var r = Math.min(e.length, n.length) - 1, i = new Array(r), a = new Array(r), o = -1;
|
|
601
|
+
for (e[r] < e[0] && (e = e.slice().reverse(), n = n.slice().reverse()); ++o < r; )
|
|
602
|
+
i[o] = Le(e[o], e[o + 1]), a[o] = t(n[o], n[o + 1]);
|
|
603
|
+
return function(s) {
|
|
604
|
+
var l = Yn(e, s, 1, r) - 1;
|
|
605
|
+
return a[l](i[l](s));
|
|
1731
606
|
};
|
|
1732
607
|
}
|
|
1733
|
-
function
|
|
1734
|
-
return
|
|
1735
|
-
}
|
|
1736
|
-
function
|
|
1737
|
-
var
|
|
1738
|
-
function
|
|
1739
|
-
var
|
|
1740
|
-
return
|
|
1741
|
-
}
|
|
1742
|
-
function
|
|
1743
|
-
return
|
|
1744
|
-
}
|
|
1745
|
-
return
|
|
1746
|
-
return
|
|
1747
|
-
},
|
|
1748
|
-
return arguments.length ? (
|
|
1749
|
-
},
|
|
1750
|
-
return arguments.length ? (
|
|
1751
|
-
},
|
|
1752
|
-
return
|
|
1753
|
-
},
|
|
1754
|
-
return arguments.length ? (
|
|
1755
|
-
},
|
|
1756
|
-
return arguments.length ? (
|
|
1757
|
-
},
|
|
1758
|
-
return arguments.length ? (
|
|
1759
|
-
}, function(
|
|
1760
|
-
return r =
|
|
608
|
+
function st(e, n) {
|
|
609
|
+
return n.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown());
|
|
610
|
+
}
|
|
611
|
+
function ft() {
|
|
612
|
+
var e = qe, n = qe, t = Ee, r, i, a, o = Z, s, l, f;
|
|
613
|
+
function h() {
|
|
614
|
+
var d = Math.min(e.length, n.length);
|
|
615
|
+
return o !== Z && (o = it(e[0], e[d - 1])), s = d > 2 ? at : ot, l = f = null, u;
|
|
616
|
+
}
|
|
617
|
+
function u(d) {
|
|
618
|
+
return d == null || isNaN(d = +d) ? a : (l || (l = s(e.map(r), n, t)))(r(o(d)));
|
|
619
|
+
}
|
|
620
|
+
return u.invert = function(d) {
|
|
621
|
+
return o(i((f || (f = s(n, e.map(r), me)))(d)));
|
|
622
|
+
}, u.domain = function(d) {
|
|
623
|
+
return arguments.length ? (e = Array.from(d, rt), h()) : e.slice();
|
|
624
|
+
}, u.range = function(d) {
|
|
625
|
+
return arguments.length ? (n = Array.from(d), h()) : n.slice();
|
|
626
|
+
}, u.rangeRound = function(d) {
|
|
627
|
+
return n = Array.from(d), t = Vn, h();
|
|
628
|
+
}, u.clamp = function(d) {
|
|
629
|
+
return arguments.length ? (o = d ? !0 : Z, h()) : o !== Z;
|
|
630
|
+
}, u.interpolate = function(d) {
|
|
631
|
+
return arguments.length ? (t = d, h()) : t;
|
|
632
|
+
}, u.unknown = function(d) {
|
|
633
|
+
return arguments.length ? (a = d, u) : a;
|
|
634
|
+
}, function(d, w) {
|
|
635
|
+
return r = d, i = w, h();
|
|
1761
636
|
};
|
|
1762
637
|
}
|
|
1763
|
-
function
|
|
1764
|
-
return
|
|
638
|
+
function ct() {
|
|
639
|
+
return ft()(Z, Z);
|
|
1765
640
|
}
|
|
1766
|
-
function
|
|
1767
|
-
return Math.abs(
|
|
641
|
+
function ut(e) {
|
|
642
|
+
return Math.abs(e = Math.round(e)) >= 1e21 ? e.toLocaleString("en").replace(/,/g, "") : e.toString(10);
|
|
1768
643
|
}
|
|
1769
|
-
function
|
|
1770
|
-
if (!isFinite(
|
|
1771
|
-
var
|
|
644
|
+
function pe(e, n) {
|
|
645
|
+
if (!isFinite(e) || e === 0) return null;
|
|
646
|
+
var t = (e = n ? e.toExponential(n - 1) : e.toExponential()).indexOf("e"), r = e.slice(0, t);
|
|
1772
647
|
return [
|
|
1773
648
|
r.length > 1 ? r[0] + r.slice(2) : r,
|
|
1774
|
-
+
|
|
649
|
+
+e.slice(t + 1)
|
|
1775
650
|
];
|
|
1776
651
|
}
|
|
1777
|
-
function
|
|
1778
|
-
return
|
|
652
|
+
function Y(e) {
|
|
653
|
+
return e = pe(Math.abs(e)), e ? e[1] : NaN;
|
|
1779
654
|
}
|
|
1780
|
-
function
|
|
1781
|
-
return function(
|
|
1782
|
-
for (var i =
|
|
1783
|
-
|
|
1784
|
-
return
|
|
655
|
+
function lt(e, n) {
|
|
656
|
+
return function(t, r) {
|
|
657
|
+
for (var i = t.length, a = [], o = 0, s = e[0], l = 0; i > 0 && s > 0 && (l + s + 1 > r && (s = Math.max(1, r - l)), a.push(t.substring(i -= s, i + s)), !((l += s + 1) > r)); )
|
|
658
|
+
s = e[o = (o + 1) % e.length];
|
|
659
|
+
return a.reverse().join(n);
|
|
1785
660
|
};
|
|
1786
661
|
}
|
|
1787
|
-
function
|
|
1788
|
-
return function(
|
|
1789
|
-
return
|
|
1790
|
-
return
|
|
662
|
+
function dt(e) {
|
|
663
|
+
return function(n) {
|
|
664
|
+
return n.replace(/[0-9]/g, function(t) {
|
|
665
|
+
return e[+t];
|
|
1791
666
|
});
|
|
1792
667
|
};
|
|
1793
668
|
}
|
|
1794
|
-
var
|
|
1795
|
-
function
|
|
1796
|
-
if (!(
|
|
1797
|
-
var
|
|
1798
|
-
return new
|
|
1799
|
-
fill:
|
|
1800
|
-
align:
|
|
1801
|
-
sign:
|
|
1802
|
-
symbol:
|
|
1803
|
-
zero:
|
|
1804
|
-
width:
|
|
1805
|
-
comma:
|
|
1806
|
-
precision:
|
|
1807
|
-
trim:
|
|
1808
|
-
type:
|
|
669
|
+
var ht = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
|
|
670
|
+
function xe(e) {
|
|
671
|
+
if (!(n = ht.exec(e))) throw new Error("invalid format: " + e);
|
|
672
|
+
var n;
|
|
673
|
+
return new Ie({
|
|
674
|
+
fill: n[1],
|
|
675
|
+
align: n[2],
|
|
676
|
+
sign: n[3],
|
|
677
|
+
symbol: n[4],
|
|
678
|
+
zero: n[5],
|
|
679
|
+
width: n[6],
|
|
680
|
+
comma: n[7],
|
|
681
|
+
precision: n[8] && n[8].slice(1),
|
|
682
|
+
trim: n[9],
|
|
683
|
+
type: n[10]
|
|
1809
684
|
});
|
|
1810
685
|
}
|
|
1811
|
-
|
|
1812
|
-
function
|
|
1813
|
-
this.fill =
|
|
686
|
+
xe.prototype = Ie.prototype;
|
|
687
|
+
function Ie(e) {
|
|
688
|
+
this.fill = e.fill === void 0 ? " " : e.fill + "", this.align = e.align === void 0 ? ">" : e.align + "", this.sign = e.sign === void 0 ? "-" : e.sign + "", this.symbol = e.symbol === void 0 ? "" : e.symbol + "", this.zero = !!e.zero, this.width = e.width === void 0 ? void 0 : +e.width, this.comma = !!e.comma, this.precision = e.precision === void 0 ? void 0 : +e.precision, this.trim = !!e.trim, this.type = e.type === void 0 ? "" : e.type + "";
|
|
1814
689
|
}
|
|
1815
|
-
|
|
690
|
+
Ie.prototype.toString = function() {
|
|
1816
691
|
return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
|
|
1817
692
|
};
|
|
1818
|
-
function
|
|
1819
|
-
e: for (var
|
|
1820
|
-
switch (t
|
|
693
|
+
function mt(e) {
|
|
694
|
+
e: for (var n = e.length, t = 1, r = -1, i; t < n; ++t)
|
|
695
|
+
switch (e[t]) {
|
|
1821
696
|
case ".":
|
|
1822
|
-
r = i =
|
|
697
|
+
r = i = t;
|
|
1823
698
|
break;
|
|
1824
699
|
case "0":
|
|
1825
|
-
r === 0 && (r =
|
|
700
|
+
r === 0 && (r = t), i = t;
|
|
1826
701
|
break;
|
|
1827
702
|
default:
|
|
1828
|
-
if (!+t
|
|
703
|
+
if (!+e[t]) break e;
|
|
1829
704
|
r > 0 && (r = 0);
|
|
1830
705
|
break;
|
|
1831
706
|
}
|
|
1832
|
-
return r > 0 ?
|
|
1833
|
-
}
|
|
1834
|
-
var
|
|
1835
|
-
function
|
|
1836
|
-
var
|
|
1837
|
-
if (!
|
|
1838
|
-
var r =
|
|
1839
|
-
return
|
|
1840
|
-
}
|
|
1841
|
-
function
|
|
1842
|
-
var
|
|
1843
|
-
if (!
|
|
1844
|
-
var r =
|
|
707
|
+
return r > 0 ? e.slice(0, r) + e.slice(i + 1) : e;
|
|
708
|
+
}
|
|
709
|
+
var be;
|
|
710
|
+
function gt(e, n) {
|
|
711
|
+
var t = pe(e, n);
|
|
712
|
+
if (!t) return be = void 0, e.toPrecision(n);
|
|
713
|
+
var r = t[0], i = t[1], a = i - (be = Math.max(-8, Math.min(8, Math.floor(i / 3))) * 3) + 1, o = r.length;
|
|
714
|
+
return a === o ? r : a > o ? r + new Array(a - o + 1).join("0") : a > 0 ? r.slice(0, a) + "." + r.slice(a) : "0." + new Array(1 - a).join("0") + pe(e, Math.max(0, n + a - 1))[0];
|
|
715
|
+
}
|
|
716
|
+
function Be(e, n) {
|
|
717
|
+
var t = pe(e, n);
|
|
718
|
+
if (!t) return e + "";
|
|
719
|
+
var r = t[0], i = t[1];
|
|
1845
720
|
return i < 0 ? "0." + new Array(-i).join("0") + r : r.length > i + 1 ? r.slice(0, i + 1) + "." + r.slice(i + 1) : r + new Array(i - r.length + 2).join("0");
|
|
1846
721
|
}
|
|
1847
|
-
const
|
|
1848
|
-
"%": (
|
|
1849
|
-
b: (
|
|
1850
|
-
c: (
|
|
1851
|
-
d:
|
|
1852
|
-
e: (
|
|
1853
|
-
f: (
|
|
1854
|
-
g: (
|
|
1855
|
-
o: (
|
|
1856
|
-
p: (
|
|
1857
|
-
r:
|
|
1858
|
-
s:
|
|
1859
|
-
X: (
|
|
1860
|
-
x: (
|
|
722
|
+
const Ze = {
|
|
723
|
+
"%": (e, n) => (e * 100).toFixed(n),
|
|
724
|
+
b: (e) => Math.round(e).toString(2),
|
|
725
|
+
c: (e) => e + "",
|
|
726
|
+
d: ut,
|
|
727
|
+
e: (e, n) => e.toExponential(n),
|
|
728
|
+
f: (e, n) => e.toFixed(n),
|
|
729
|
+
g: (e, n) => e.toPrecision(n),
|
|
730
|
+
o: (e) => Math.round(e).toString(8),
|
|
731
|
+
p: (e, n) => Be(e * 100, n),
|
|
732
|
+
r: Be,
|
|
733
|
+
s: gt,
|
|
734
|
+
X: (e) => Math.round(e).toString(16).toUpperCase(),
|
|
735
|
+
x: (e) => Math.round(e).toString(16)
|
|
1861
736
|
};
|
|
1862
|
-
function
|
|
1863
|
-
return
|
|
1864
|
-
}
|
|
1865
|
-
var
|
|
1866
|
-
function
|
|
1867
|
-
var
|
|
1868
|
-
function u
|
|
1869
|
-
|
|
1870
|
-
var w =
|
|
1871
|
-
M === "n" ? (D = !0, M = "g") :
|
|
1872
|
-
var
|
|
1873
|
-
|
|
1874
|
-
function
|
|
1875
|
-
var
|
|
737
|
+
function Je(e) {
|
|
738
|
+
return e;
|
|
739
|
+
}
|
|
740
|
+
var Ye = Array.prototype.map, Ke = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
|
|
741
|
+
function pt(e) {
|
|
742
|
+
var n = e.grouping === void 0 || e.thousands === void 0 ? Je : lt(Ye.call(e.grouping, Number), e.thousands + ""), t = e.currency === void 0 ? "" : e.currency[0] + "", r = e.currency === void 0 ? "" : e.currency[1] + "", i = e.decimal === void 0 ? "." : e.decimal + "", a = e.numerals === void 0 ? Je : dt(Ye.call(e.numerals, String)), o = e.percent === void 0 ? "%" : e.percent + "", s = e.minus === void 0 ? "−" : e.minus + "", l = e.nan === void 0 ? "NaN" : e.nan + "";
|
|
743
|
+
function f(u, d) {
|
|
744
|
+
u = xe(u);
|
|
745
|
+
var w = u.fill, v = u.align, R = u.sign, j = u.symbol, E = u.zero, K = u.width, D = u.comma, k = u.precision, re = u.trim, M = u.type;
|
|
746
|
+
M === "n" ? (D = !0, M = "g") : Ze[M] || (k === void 0 && (k = 12), re = !0, M = "g"), (E || w === "0" && v === "=") && (E = !0, w = "0", v = "=");
|
|
747
|
+
var V = (d && d.prefix !== void 0 ? d.prefix : "") + (j === "$" ? t : j === "#" && /[boxX]/.test(M) ? "0" + M.toLowerCase() : ""), ie = (j === "$" ? r : /[%p]/.test(M) ? o : "") + (d && d.suffix !== void 0 ? d.suffix : ""), oe = Ze[M], ae = /[defgprs%]/.test(M);
|
|
748
|
+
k = k === void 0 ? 6 : /[gprs]/.test(M) ? Math.max(1, Math.min(21, k)) : Math.max(0, Math.min(20, k));
|
|
749
|
+
function X(p) {
|
|
750
|
+
var I = V, _ = ie, A, W, q;
|
|
1876
751
|
if (M === "c")
|
|
1877
|
-
|
|
752
|
+
_ = oe(p) + _, p = "";
|
|
1878
753
|
else {
|
|
1879
754
|
p = +p;
|
|
1880
|
-
var
|
|
1881
|
-
if (p = isNaN(p) ?
|
|
1882
|
-
for (
|
|
1883
|
-
if (
|
|
1884
|
-
|
|
755
|
+
var O = p < 0 || 1 / p < 0;
|
|
756
|
+
if (p = isNaN(p) ? l : oe(Math.abs(p), k), re && (p = mt(p)), O && +p == 0 && R !== "+" && (O = !1), I = (O ? R === "(" ? R : s : R === "-" || R === "(" ? "" : R) + I, _ = (M === "s" && !isNaN(p) && be !== void 0 ? Ke[8 + be / 3] : "") + _ + (O && R === "(" ? ")" : ""), ae) {
|
|
757
|
+
for (A = -1, W = p.length; ++A < W; )
|
|
758
|
+
if (q = p.charCodeAt(A), 48 > q || q > 57) {
|
|
759
|
+
_ = (q === 46 ? i + p.slice(A + 1) : p.slice(A)) + _, p = p.slice(0, A);
|
|
1885
760
|
break;
|
|
1886
761
|
}
|
|
1887
762
|
}
|
|
1888
763
|
}
|
|
1889
|
-
D && !
|
|
1890
|
-
var z =
|
|
1891
|
-
switch (D &&
|
|
764
|
+
D && !E && (p = n(p, 1 / 0));
|
|
765
|
+
var z = I.length + p.length + _.length, C = z < K ? new Array(K - z + 1).join(w) : "";
|
|
766
|
+
switch (D && E && (p = n(C + p, C.length ? K - _.length : 1 / 0), C = ""), v) {
|
|
1892
767
|
case "<":
|
|
1893
|
-
p =
|
|
768
|
+
p = I + p + _ + C;
|
|
1894
769
|
break;
|
|
1895
770
|
case "=":
|
|
1896
|
-
p =
|
|
771
|
+
p = I + C + p + _;
|
|
1897
772
|
break;
|
|
1898
773
|
case "^":
|
|
1899
|
-
p =
|
|
774
|
+
p = C.slice(0, z = C.length >> 1) + I + p + _ + C.slice(z);
|
|
1900
775
|
break;
|
|
1901
776
|
default:
|
|
1902
|
-
p =
|
|
777
|
+
p = C + I + p + _;
|
|
1903
778
|
break;
|
|
1904
779
|
}
|
|
1905
|
-
return
|
|
780
|
+
return a(p);
|
|
1906
781
|
}
|
|
1907
|
-
return
|
|
1908
|
-
return
|
|
1909
|
-
},
|
|
1910
|
-
}
|
|
1911
|
-
function
|
|
1912
|
-
var w = Math.max(-8, Math.min(8, Math.floor(
|
|
1913
|
-
return function(
|
|
1914
|
-
return
|
|
782
|
+
return X.toString = function() {
|
|
783
|
+
return u + "";
|
|
784
|
+
}, X;
|
|
785
|
+
}
|
|
786
|
+
function h(u, d) {
|
|
787
|
+
var w = Math.max(-8, Math.min(8, Math.floor(Y(d) / 3))) * 3, v = Math.pow(10, -w), R = f((u = xe(u), u.type = "f", u), { suffix: Ke[8 + w / 3] });
|
|
788
|
+
return function(j) {
|
|
789
|
+
return R(v * j);
|
|
1915
790
|
};
|
|
1916
791
|
}
|
|
1917
792
|
return {
|
|
1918
|
-
format:
|
|
1919
|
-
formatPrefix:
|
|
793
|
+
format: f,
|
|
794
|
+
formatPrefix: h
|
|
1920
795
|
};
|
|
1921
796
|
}
|
|
1922
|
-
var
|
|
1923
|
-
|
|
797
|
+
var ue, rn, on;
|
|
798
|
+
xt({
|
|
1924
799
|
thousands: ",",
|
|
1925
800
|
grouping: [3],
|
|
1926
801
|
currency: ["$", ""]
|
|
1927
802
|
});
|
|
1928
|
-
function
|
|
1929
|
-
return
|
|
803
|
+
function xt(e) {
|
|
804
|
+
return ue = pt(e), rn = ue.format, on = ue.formatPrefix, ue;
|
|
1930
805
|
}
|
|
1931
|
-
function
|
|
1932
|
-
return Math.max(0, -
|
|
806
|
+
function bt(e) {
|
|
807
|
+
return Math.max(0, -Y(Math.abs(e)));
|
|
1933
808
|
}
|
|
1934
|
-
function
|
|
1935
|
-
return Math.max(0, Math.max(-8, Math.min(8, Math.floor(
|
|
809
|
+
function yt(e, n) {
|
|
810
|
+
return Math.max(0, Math.max(-8, Math.min(8, Math.floor(Y(n) / 3))) * 3 - Y(Math.abs(e)));
|
|
1936
811
|
}
|
|
1937
|
-
function
|
|
1938
|
-
return
|
|
812
|
+
function wt(e, n) {
|
|
813
|
+
return e = Math.abs(e), n = Math.abs(n) - e, Math.max(0, Y(n) - Y(e)) + 1;
|
|
1939
814
|
}
|
|
1940
|
-
function
|
|
1941
|
-
var i =
|
|
1942
|
-
switch (r =
|
|
815
|
+
function vt(e, n, t, r) {
|
|
816
|
+
var i = et(e, n, t), a;
|
|
817
|
+
switch (r = xe(r ?? ",f"), r.type) {
|
|
1943
818
|
case "s": {
|
|
1944
|
-
var
|
|
1945
|
-
return r.precision == null && !isNaN(
|
|
819
|
+
var o = Math.max(Math.abs(e), Math.abs(n));
|
|
820
|
+
return r.precision == null && !isNaN(a = yt(i, o)) && (r.precision = a), on(r, o);
|
|
1946
821
|
}
|
|
1947
822
|
case "":
|
|
1948
823
|
case "e":
|
|
1949
824
|
case "g":
|
|
1950
825
|
case "p":
|
|
1951
826
|
case "r": {
|
|
1952
|
-
r.precision == null && !isNaN(
|
|
827
|
+
r.precision == null && !isNaN(a = wt(i, Math.max(Math.abs(e), Math.abs(n)))) && (r.precision = a - (r.type === "e"));
|
|
1953
828
|
break;
|
|
1954
829
|
}
|
|
1955
830
|
case "f":
|
|
1956
831
|
case "%": {
|
|
1957
|
-
r.precision == null && !isNaN(
|
|
832
|
+
r.precision == null && !isNaN(a = bt(i)) && (r.precision = a - (r.type === "%") * 2);
|
|
1958
833
|
break;
|
|
1959
834
|
}
|
|
1960
835
|
}
|
|
1961
|
-
return
|
|
1962
|
-
}
|
|
1963
|
-
function
|
|
1964
|
-
var
|
|
1965
|
-
return
|
|
1966
|
-
var r =
|
|
1967
|
-
return
|
|
1968
|
-
},
|
|
1969
|
-
var i =
|
|
1970
|
-
return
|
|
1971
|
-
},
|
|
1972
|
-
|
|
1973
|
-
var r =
|
|
1974
|
-
for (
|
|
1975
|
-
if (
|
|
1976
|
-
return r[i] =
|
|
1977
|
-
if (
|
|
1978
|
-
|
|
1979
|
-
else if (
|
|
1980
|
-
|
|
836
|
+
return rn(r);
|
|
837
|
+
}
|
|
838
|
+
function Nt(e) {
|
|
839
|
+
var n = e.domain;
|
|
840
|
+
return e.ticks = function(t) {
|
|
841
|
+
var r = n();
|
|
842
|
+
return Qn(r[0], r[r.length - 1], t ?? 10);
|
|
843
|
+
}, e.tickFormat = function(t, r) {
|
|
844
|
+
var i = n();
|
|
845
|
+
return vt(i[0], i[i.length - 1], t ?? 10, r);
|
|
846
|
+
}, e.nice = function(t) {
|
|
847
|
+
t == null && (t = 10);
|
|
848
|
+
var r = n(), i = 0, a = r.length - 1, o = r[i], s = r[a], l, f, h = 10;
|
|
849
|
+
for (s < o && (f = o, o = s, s = f, f = i, i = a, a = f); h-- > 0; ) {
|
|
850
|
+
if (f = Ce(o, s, t), f === l)
|
|
851
|
+
return r[i] = o, r[a] = s, n(r);
|
|
852
|
+
if (f > 0)
|
|
853
|
+
o = Math.floor(o / f) * f, s = Math.ceil(s / f) * f;
|
|
854
|
+
else if (f < 0)
|
|
855
|
+
o = Math.ceil(o * f) / f, s = Math.floor(s * f) / f;
|
|
1981
856
|
else
|
|
1982
857
|
break;
|
|
1983
|
-
|
|
858
|
+
l = f;
|
|
1984
859
|
}
|
|
1985
|
-
return
|
|
1986
|
-
},
|
|
1987
|
-
}
|
|
1988
|
-
function
|
|
1989
|
-
var
|
|
1990
|
-
return
|
|
1991
|
-
return
|
|
1992
|
-
},
|
|
1993
|
-
}
|
|
1994
|
-
const
|
|
1995
|
-
const
|
|
1996
|
-
return typeof
|
|
1997
|
-
},
|
|
1998
|
-
if (!
|
|
1999
|
-
const
|
|
2000
|
-
if (
|
|
2001
|
-
const i =
|
|
2002
|
-
return (
|
|
2003
|
-
},
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
860
|
+
return e;
|
|
861
|
+
}, e;
|
|
862
|
+
}
|
|
863
|
+
function an() {
|
|
864
|
+
var e = ct();
|
|
865
|
+
return e.copy = function() {
|
|
866
|
+
return st(e, an());
|
|
867
|
+
}, nt.apply(e, arguments), Nt(e);
|
|
868
|
+
}
|
|
869
|
+
const Me = (e, n) => {
|
|
870
|
+
const t = e?.[n];
|
|
871
|
+
return typeof t == "number" ? t : 0;
|
|
872
|
+
}, Xe = (e, n) => {
|
|
873
|
+
if (!e.length) return () => n.minColor;
|
|
874
|
+
const t = Math.min(...e), r = Math.max(...e);
|
|
875
|
+
if (t === r) return () => n.maxColor;
|
|
876
|
+
const i = an().domain([t, r]).range([0, 1]), a = Re(n.minColor, n.maxColor);
|
|
877
|
+
return (o) => a(i(o));
|
|
878
|
+
}, Mt = (e) => e <= 1.35 ? 2 : e <= 2.1 ? 1 : 0, _t = (e) => new Intl.NumberFormat("en-US", { maximumFractionDigits: 0 }).format(e), _e = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"), $t = (e, n) => {
|
|
879
|
+
let t = e.trim();
|
|
880
|
+
if (!t) return t;
|
|
881
|
+
const r = n?.trim().toUpperCase();
|
|
882
|
+
return r && /^[A-Z]{2}$/.test(r) && (t = t.replace(new RegExp(`\\s*\\(${r}\\)`, "gi"), "").replace(new RegExp(`\\s*\\[${r}\\]`, "gi"), "").replace(new RegExp(`\\s*[-–—]\\s*${r}\\s*$`, "i"), "").replace(new RegExp(`\\s+${r}\\s*$`, "i"), "")), t.trim() || e.trim();
|
|
883
|
+
}, Rt = (e) => e.replace(/_/g, " ").replace(/\b\w/g, (t) => t.toUpperCase()), kt = /* @__PURE__ */ new Set([
|
|
884
|
+
"countrycode",
|
|
885
|
+
"country_code",
|
|
886
|
+
"iso_a2",
|
|
887
|
+
"iso",
|
|
888
|
+
"adm0_a3",
|
|
889
|
+
"iso_3166_1"
|
|
890
|
+
]), Ct = (e) => kt.has(e.toLowerCase()), Lt = (e, n) => e.toLowerCase() === "revenue" ? new Intl.NumberFormat("en-US", {
|
|
891
|
+
style: "currency",
|
|
892
|
+
currency: "USD",
|
|
893
|
+
notation: "compact",
|
|
894
|
+
maximumFractionDigits: 1
|
|
895
|
+
}).format(n) : _t(n), We = "cool-globe-float-tooltip-override", At = () => {
|
|
896
|
+
if (typeof document > "u" || document.getElementById(We)) return;
|
|
897
|
+
const e = document.createElement("style");
|
|
898
|
+
e.id = We, e.textContent = `
|
|
899
|
+
.cool-globe-host .float-tooltip-kap {
|
|
900
|
+
background: transparent !important;
|
|
901
|
+
background-color: transparent !important;
|
|
902
|
+
padding: 0 !important;
|
|
903
|
+
border-radius: 0 !important;
|
|
904
|
+
box-shadow: none !important;
|
|
905
|
+
max-width: none !important;
|
|
906
|
+
font-size: inherit !important;
|
|
907
|
+
font-family: inherit !important;
|
|
908
|
+
color: transparent !important;
|
|
909
|
+
}
|
|
910
|
+
`, document.head.appendChild(e);
|
|
911
|
+
}, Ft = ({
|
|
912
|
+
statisticsData: e,
|
|
913
|
+
resetSignal: n,
|
|
914
|
+
countryNumericToIsoMap: t = {},
|
|
2007
915
|
countryNameToIsoMap: r = {},
|
|
2008
916
|
primaryMetric: i = "visits",
|
|
2009
|
-
colorScale:
|
|
917
|
+
colorScale: a = wn
|
|
2010
918
|
}) => {
|
|
2011
|
-
const
|
|
919
|
+
const o = B(null), s = B(null), l = B(void 0), f = B({}), h = B(null), u = B(n), [d, w] = T(0), [v, R] = T(), [j, E] = T(), [K, D] = T(null), [k, re] = T([]), [M, V] = T([]), [ie, oe] = T({
|
|
2012
920
|
width: 900,
|
|
2013
921
|
height: 760
|
|
2014
|
-
})
|
|
2015
|
-
|
|
2016
|
-
|
|
922
|
+
});
|
|
923
|
+
P(() => {
|
|
924
|
+
At();
|
|
925
|
+
}, []);
|
|
926
|
+
const ae = se(
|
|
927
|
+
() => Object.values(e.countries).map(
|
|
928
|
+
(c) => Me(c, i)
|
|
2017
929
|
),
|
|
2018
|
-
[i,
|
|
2019
|
-
),
|
|
2020
|
-
(
|
|
2021
|
-
) : [], [
|
|
2022
|
-
() =>
|
|
2023
|
-
[
|
|
2024
|
-
),
|
|
2025
|
-
() =>
|
|
2026
|
-
[
|
|
930
|
+
[i, e.countries]
|
|
931
|
+
), X = se(() => v ? Object.values(e.regions[v] ?? {}).map(
|
|
932
|
+
(c) => Me(c, i)
|
|
933
|
+
) : [], [v, i, e.regions]), p = se(
|
|
934
|
+
() => Xe(ae, a),
|
|
935
|
+
[ae, a]
|
|
936
|
+
), I = se(
|
|
937
|
+
() => Xe(X, a),
|
|
938
|
+
[X, a]
|
|
2027
939
|
);
|
|
2028
|
-
|
|
940
|
+
P(() => {
|
|
2029
941
|
(async () => {
|
|
2030
|
-
let
|
|
942
|
+
let m = [];
|
|
2031
943
|
try {
|
|
2032
|
-
|
|
944
|
+
m = (await (await fetch(pn)).json()).features;
|
|
2033
945
|
} catch {
|
|
2034
|
-
const
|
|
2035
|
-
|
|
2036
|
-
|
|
946
|
+
const g = await (await fetch(xn)).json(), b = g.objects.countries, N = mn(
|
|
947
|
+
g,
|
|
948
|
+
b
|
|
2037
949
|
);
|
|
2038
|
-
|
|
950
|
+
m = N.type === "FeatureCollection" ? N.features : [N];
|
|
2039
951
|
}
|
|
2040
|
-
const
|
|
2041
|
-
const
|
|
2042
|
-
|
|
2043
|
-
).trim() || `Country ${
|
|
2044
|
-
|
|
2045
|
-
).trim().toUpperCase(),
|
|
952
|
+
const y = m.map((x) => {
|
|
953
|
+
const g = String(x.id ?? ""), b = x.properties ?? {}, N = String(
|
|
954
|
+
b.name ?? b.NAME ?? b.name_en ?? b.ADMIN ?? ""
|
|
955
|
+
).trim() || `Country ${g}`, H = N.toLowerCase(), F = String(
|
|
956
|
+
b.iso_a2 ?? b.ISO_A2 ?? b.iso_a2_eh ?? ""
|
|
957
|
+
).trim().toUpperCase(), ye = t[g] ?? r[H] ?? (F && F !== "-99" ? F : void 0) ?? (g.length === 2 ? g.toUpperCase() : g);
|
|
2046
958
|
return {
|
|
2047
959
|
...x,
|
|
2048
960
|
properties: {
|
|
2049
|
-
...
|
|
2050
|
-
__isoA2:
|
|
2051
|
-
name: N ||
|
|
961
|
+
...b,
|
|
962
|
+
__isoA2: ye,
|
|
963
|
+
name: N || ye || `Country ${g}`
|
|
2052
964
|
}
|
|
2053
965
|
};
|
|
2054
966
|
});
|
|
2055
|
-
|
|
967
|
+
re(y);
|
|
2056
968
|
})();
|
|
2057
|
-
}, []),
|
|
2058
|
-
if (!
|
|
2059
|
-
const
|
|
2060
|
-
const
|
|
2061
|
-
|
|
2062
|
-
width: Math.max(360, Math.floor(
|
|
2063
|
-
height: Math.max(520, Math.floor(
|
|
969
|
+
}, []), P(() => {
|
|
970
|
+
if (!s.current) return;
|
|
971
|
+
const c = new ResizeObserver((m) => {
|
|
972
|
+
const y = m[0];
|
|
973
|
+
y && oe({
|
|
974
|
+
width: Math.max(360, Math.floor(y.contentRect.width)),
|
|
975
|
+
height: Math.max(520, Math.floor(y.contentRect.height))
|
|
2064
976
|
});
|
|
2065
977
|
});
|
|
2066
|
-
return
|
|
2067
|
-
}, []),
|
|
2068
|
-
if (!
|
|
2069
|
-
|
|
978
|
+
return c.observe(s.current), () => c.disconnect();
|
|
979
|
+
}, []), P(() => {
|
|
980
|
+
if (!v) {
|
|
981
|
+
V([]);
|
|
2070
982
|
return;
|
|
2071
983
|
}
|
|
2072
|
-
const
|
|
2073
|
-
if (
|
|
2074
|
-
|
|
984
|
+
const c = f.current[v];
|
|
985
|
+
if (c) {
|
|
986
|
+
V(c);
|
|
2075
987
|
return;
|
|
2076
988
|
}
|
|
2077
989
|
(async () => {
|
|
2078
|
-
if (!
|
|
2079
|
-
const
|
|
2080
|
-
|
|
990
|
+
if (!h.current) {
|
|
991
|
+
const b = await (await fetch(bn)).json();
|
|
992
|
+
h.current = b.features;
|
|
2081
993
|
}
|
|
2082
|
-
const x = (
|
|
2083
|
-
(
|
|
2084
|
-
).map((
|
|
2085
|
-
const
|
|
994
|
+
const x = (h.current ?? []).filter(
|
|
995
|
+
(g) => (g.properties ?? {}).iso_a2 === v
|
|
996
|
+
).map((g) => {
|
|
997
|
+
const b = g.properties ?? {}, N = String(b.name ?? "").trim();
|
|
2086
998
|
return {
|
|
2087
|
-
...
|
|
999
|
+
...g,
|
|
2088
1000
|
properties: {
|
|
2089
|
-
...
|
|
2090
|
-
__countryCode:
|
|
1001
|
+
...b,
|
|
1002
|
+
__countryCode: v,
|
|
2091
1003
|
__regionName: N,
|
|
2092
1004
|
name: N
|
|
2093
1005
|
}
|
|
2094
1006
|
};
|
|
2095
1007
|
});
|
|
2096
|
-
|
|
1008
|
+
f.current[v] = x, V(x);
|
|
2097
1009
|
})();
|
|
2098
|
-
}, [
|
|
2099
|
-
if (
|
|
2100
|
-
|
|
2101
|
-
}, [
|
|
2102
|
-
const
|
|
2103
|
-
if (!
|
|
2104
|
-
|
|
2105
|
-
const
|
|
2106
|
-
|
|
2107
|
-
}, []),
|
|
2108
|
-
const
|
|
2109
|
-
|
|
2110
|
-
}, [
|
|
2111
|
-
if (
|
|
2112
|
-
|
|
2113
|
-
const
|
|
2114
|
-
|
|
2115
|
-
}, [
|
|
2116
|
-
const
|
|
2117
|
-
const
|
|
2118
|
-
|
|
2119
|
-
},
|
|
2120
|
-
|
|
2121
|
-
},
|
|
2122
|
-
const
|
|
2123
|
-
|
|
2124
|
-
},
|
|
2125
|
-
if (typeof
|
|
1010
|
+
}, [v]), P(() => {
|
|
1011
|
+
if (j && d < 2) return void w(2);
|
|
1012
|
+
v && d < 1 && w(1);
|
|
1013
|
+
}, [v, j, d]), P(() => {
|
|
1014
|
+
const c = o.current?.controls?.();
|
|
1015
|
+
if (!c) return;
|
|
1016
|
+
c.autoRotate = !0, c.autoRotateSpeed = 0.45, c.enablePan = !1, c.enableZoom = !0;
|
|
1017
|
+
const m = o.current?.renderer?.();
|
|
1018
|
+
m && m.setPixelRatio(Math.min(window.devicePixelRatio, 1.5));
|
|
1019
|
+
}, []), P(() => {
|
|
1020
|
+
const c = o.current?.controls?.();
|
|
1021
|
+
c && (c.autoRotate = !v && d === 0);
|
|
1022
|
+
}, [v, d]), P(() => {
|
|
1023
|
+
if (n === u.current) return;
|
|
1024
|
+
u.current = n, w(0), R(void 0), E(void 0), D(null), V([]);
|
|
1025
|
+
const c = o.current?.controls?.();
|
|
1026
|
+
c && (c.autoRotate = !0), o.current?.pointOfView({ lat: 20, lng: 15, altitude: 2.6 }, 650);
|
|
1027
|
+
}, [n]);
|
|
1028
|
+
const _ = () => {
|
|
1029
|
+
const c = o.current?.globeMaterial?.();
|
|
1030
|
+
c && (c.map = null, c.color = new we("#f5f5f5"), c.emissive = new we("#ffffff"), c.emissiveIntensity = 0.35, c.specular = new we("#d4d4d8"), c.shininess = 3, c.needsUpdate = !0);
|
|
1031
|
+
}, A = (c, m, y) => {
|
|
1032
|
+
o.current?.pointOfView({ lat: c, lng: m, altitude: y }, 650);
|
|
1033
|
+
}, W = () => {
|
|
1034
|
+
const c = o.current?.controls?.();
|
|
1035
|
+
c && (c.autoRotate = !1);
|
|
1036
|
+
}, q = (c) => {
|
|
1037
|
+
if (typeof c != "object" || c === null || !("coordinates" in c))
|
|
2126
1038
|
return [];
|
|
2127
|
-
const
|
|
2128
|
-
if (Array.isArray(
|
|
2129
|
-
if (
|
|
2130
|
-
|
|
1039
|
+
const m = c.coordinates, y = [], x = (g) => {
|
|
1040
|
+
if (Array.isArray(g)) {
|
|
1041
|
+
if (g.length >= 2 && typeof g[0] == "number" && typeof g[1] == "number") {
|
|
1042
|
+
y.push([g[0], g[1]]);
|
|
2131
1043
|
return;
|
|
2132
1044
|
}
|
|
2133
|
-
|
|
1045
|
+
g.forEach(x);
|
|
2134
1046
|
}
|
|
2135
1047
|
};
|
|
2136
|
-
return x(
|
|
2137
|
-
},
|
|
2138
|
-
const
|
|
2139
|
-
if (!
|
|
2140
|
-
const
|
|
2141
|
-
(x, [
|
|
2142
|
-
minLat: Math.min(x.minLat,
|
|
2143
|
-
maxLat: Math.max(x.maxLat,
|
|
2144
|
-
minLng: Math.min(x.minLng,
|
|
2145
|
-
maxLng: Math.max(x.maxLng,
|
|
1048
|
+
return x(m), y;
|
|
1049
|
+
}, O = (c) => {
|
|
1050
|
+
const m = q(c.geometry);
|
|
1051
|
+
if (!m.length) return;
|
|
1052
|
+
const y = m.reduce(
|
|
1053
|
+
(x, [g, b]) => ({
|
|
1054
|
+
minLat: Math.min(x.minLat, b),
|
|
1055
|
+
maxLat: Math.max(x.maxLat, b),
|
|
1056
|
+
minLng: Math.min(x.minLng, g),
|
|
1057
|
+
maxLng: Math.max(x.maxLng, g)
|
|
2146
1058
|
}),
|
|
2147
1059
|
{
|
|
2148
1060
|
minLat: Number.POSITIVE_INFINITY,
|
|
@@ -2151,40 +1063,40 @@ const De = (t, e) => {
|
|
|
2151
1063
|
maxLng: Number.NEGATIVE_INFINITY
|
|
2152
1064
|
}
|
|
2153
1065
|
);
|
|
2154
|
-
if (!(!Number.isFinite(
|
|
2155
|
-
return
|
|
2156
|
-
}, z = (
|
|
2157
|
-
const
|
|
2158
|
-
return Math.min(0.9, Math.max(0.14,
|
|
2159
|
-
},
|
|
2160
|
-
|
|
2161
|
-
const
|
|
2162
|
-
w(
|
|
1066
|
+
if (!(!Number.isFinite(y.minLat) || !Number.isFinite(y.minLng)))
|
|
1067
|
+
return y;
|
|
1068
|
+
}, z = (c) => {
|
|
1069
|
+
const m = Math.max(0.1, c.maxLat - c.minLat), y = Math.max(0.1, c.maxLng - c.minLng), g = Math.max(m, y) / 112;
|
|
1070
|
+
return Math.min(0.9, Math.max(0.14, g));
|
|
1071
|
+
}, C = () => {
|
|
1072
|
+
l.current && window.clearTimeout(l.current), l.current = window.setTimeout(() => {
|
|
1073
|
+
const c = o.current?.pointOfView?.().altitude ?? 2.4, m = Mt(c);
|
|
1074
|
+
w(m), m <= 0 && E(void 0);
|
|
2163
1075
|
}, 120);
|
|
2164
|
-
},
|
|
2165
|
-
const
|
|
2166
|
-
if (
|
|
2167
|
-
const
|
|
1076
|
+
}, sn = (c) => {
|
|
1077
|
+
const m = c.properties ?? {};
|
|
1078
|
+
if (d === 0) {
|
|
1079
|
+
const y = r[String(m.name ?? "").toLowerCase()], x = m.__isoA2 ?? (typeof m.iso_a2 == "string" ? m.iso_a2.toUpperCase() : void 0) ?? y;
|
|
2168
1080
|
if (!x) return;
|
|
2169
|
-
|
|
2170
|
-
const
|
|
2171
|
-
if (
|
|
2172
|
-
|
|
2173
|
-
(
|
|
2174
|
-
(
|
|
2175
|
-
z(
|
|
1081
|
+
W(), w(1), R(x), E(void 0);
|
|
1082
|
+
const g = O(c);
|
|
1083
|
+
if (g) {
|
|
1084
|
+
A(
|
|
1085
|
+
(g.minLat + g.maxLat) / 2,
|
|
1086
|
+
(g.minLng + g.maxLng) / 2,
|
|
1087
|
+
z(g)
|
|
2176
1088
|
);
|
|
2177
1089
|
return;
|
|
2178
1090
|
}
|
|
2179
1091
|
return;
|
|
2180
1092
|
}
|
|
2181
|
-
if (
|
|
2182
|
-
const
|
|
2183
|
-
if (!
|
|
2184
|
-
|
|
2185
|
-
const x =
|
|
1093
|
+
if (d >= 1) {
|
|
1094
|
+
const y = m.__regionName;
|
|
1095
|
+
if (!y) return;
|
|
1096
|
+
W(), w(2), E(y);
|
|
1097
|
+
const x = O(c);
|
|
2186
1098
|
if (x) {
|
|
2187
|
-
|
|
1099
|
+
A(
|
|
2188
1100
|
(x.minLat + x.maxLat) / 2,
|
|
2189
1101
|
(x.minLng + x.maxLng) / 2,
|
|
2190
1102
|
Math.max(0.2, z(x) * 0.52)
|
|
@@ -2192,76 +1104,90 @@ const De = (t, e) => {
|
|
|
2192
1104
|
return;
|
|
2193
1105
|
}
|
|
2194
1106
|
}
|
|
2195
|
-
},
|
|
2196
|
-
if (
|
|
2197
|
-
return
|
|
2198
|
-
if (
|
|
2199
|
-
},
|
|
2200
|
-
if (!
|
|
2201
|
-
return
|
|
2202
|
-
const
|
|
2203
|
-
([,
|
|
1107
|
+
}, fn = d === 0 ? k : M.length ? [...k, ...M] : k, je = (c, m) => {
|
|
1108
|
+
if (m && c)
|
|
1109
|
+
return e.regions[c]?.[m];
|
|
1110
|
+
if (c) return e.countries[c];
|
|
1111
|
+
}, cn = (c) => {
|
|
1112
|
+
if (!c)
|
|
1113
|
+
return '<div style="color:#697386;font-weight:500;font-size:15px;">No data available</div>';
|
|
1114
|
+
const m = Object.entries(c).filter(
|
|
1115
|
+
([b, N]) => !Ct(b) && typeof N == "number" && Number.isFinite(N)
|
|
2204
1116
|
);
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
1117
|
+
if (!m.length)
|
|
1118
|
+
return '<div style="color:#697386;font-weight:500;font-size:15px;">No data available</div>';
|
|
1119
|
+
m.sort(([b], [N]) => b === i ? -1 : N === i ? 1 : b.localeCompare(N));
|
|
1120
|
+
const y = "display:flex;justify-content:space-between;align-items:center;gap:24px;padding:6px 0;", x = "font-weight:500;color:#697386;font-size:15px;", g = "font-weight:600;color:#1A1F36;font-size:15px;font-variant-numeric:tabular-nums;white-space:nowrap;";
|
|
1121
|
+
return m.map(([b, N]) => {
|
|
1122
|
+
const H = _e(Rt(b)), F = _e(
|
|
1123
|
+
Lt(b, N)
|
|
1124
|
+
);
|
|
1125
|
+
return `<div style="${y}"><span style="${x}">${H}</span><span style="${g}">${F}</span></div>`;
|
|
1126
|
+
}).join("");
|
|
2208
1127
|
};
|
|
2209
|
-
return /* @__PURE__ */
|
|
1128
|
+
return /* @__PURE__ */ Fe(
|
|
2210
1129
|
"div",
|
|
2211
1130
|
{
|
|
2212
|
-
ref:
|
|
1131
|
+
ref: s,
|
|
1132
|
+
className: "cool-globe-host",
|
|
2213
1133
|
style: {
|
|
2214
1134
|
position: "relative",
|
|
2215
1135
|
height: "100%",
|
|
2216
1136
|
overflow: "hidden",
|
|
2217
1137
|
background: "white"
|
|
2218
1138
|
},
|
|
2219
|
-
children: /* @__PURE__ */
|
|
2220
|
-
|
|
1139
|
+
children: /* @__PURE__ */ Fe(
|
|
1140
|
+
un,
|
|
2221
1141
|
{
|
|
2222
|
-
ref:
|
|
2223
|
-
globeImageUrl:
|
|
1142
|
+
ref: o,
|
|
1143
|
+
globeImageUrl: yn,
|
|
2224
1144
|
backgroundColor: "#ffffff",
|
|
2225
|
-
polygonsData:
|
|
1145
|
+
polygonsData: fn,
|
|
2226
1146
|
polygonAltitude: 0.01,
|
|
2227
1147
|
polygonsTransitionDuration: 180,
|
|
2228
|
-
polygonCapColor: (
|
|
2229
|
-
const
|
|
2230
|
-
if (
|
|
1148
|
+
polygonCapColor: (c) => {
|
|
1149
|
+
const m = c.properties ?? {}, y = !!m.__regionName;
|
|
1150
|
+
if (d > 0 && !y)
|
|
2231
1151
|
return "rgba(148,163,184,0.027)";
|
|
2232
|
-
const x =
|
|
2233
|
-
return
|
|
1152
|
+
const x = d === 0 ? m.__isoA2 : m.__countryCode, g = m.__regionName, b = je(x, g), N = Me(b, i), H = d === 0 ? p(N) : I(N);
|
|
1153
|
+
return K === c ? "#60a5fa" : H;
|
|
2234
1154
|
},
|
|
2235
|
-
polygonSideColor: (
|
|
2236
|
-
const
|
|
2237
|
-
return
|
|
1155
|
+
polygonSideColor: (c) => {
|
|
1156
|
+
const m = c.properties ?? {};
|
|
1157
|
+
return d > 0 && !m.__regionName ? "rgba(148,163,184,0.027)" : m.__regionName ? "rgba(148,163,184,0.22)" : "rgba(226,232,240,0.45)";
|
|
2238
1158
|
},
|
|
2239
|
-
polygonStrokeColor: (
|
|
2240
|
-
const
|
|
2241
|
-
return
|
|
1159
|
+
polygonStrokeColor: (c) => {
|
|
1160
|
+
const m = c.properties ?? {};
|
|
1161
|
+
return d > 0 && !m.__regionName ? "rgba(100,116,139,0.067)" : m.__regionName ? "rgba(51,65,85,0.98)" : "rgba(156,163,175,0.95)";
|
|
2242
1162
|
},
|
|
2243
|
-
polygonLabel: (
|
|
2244
|
-
const
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
$
|
|
1163
|
+
polygonLabel: (c) => {
|
|
1164
|
+
const m = c.properties ?? {};
|
|
1165
|
+
if (d > 0 && !m.__regionName)
|
|
1166
|
+
return "";
|
|
1167
|
+
const y = d === 0 ? m.__isoA2 : m.__countryCode, x = m.__regionName, g = x ?? m.name ?? "Unknown", b = d === 0 ? m.__isoA2 : m.__countryCode ?? m.__isoA2, N = $t(
|
|
1168
|
+
String(g),
|
|
1169
|
+
b
|
|
1170
|
+
), H = je(y, x), F = cn(H);
|
|
1171
|
+
return `<div style="font-family:system-ui,-apple-system,'Segoe UI',Roboto,Inter,sans-serif;min-width:272px;max-width:320px;padding:20px;background:#ffffff;color:#1A1F36;border-radius:14px;box-shadow:0 8px 24px rgba(15,23,42,0.12);">
|
|
1172
|
+
<div style="font-size:17px;font-weight:600;color:#1A1F36;line-height:1.25;margin-bottom:4px;">${_e(N)}</div>
|
|
1173
|
+
<div style="margin-top:8px;">${F}</div>
|
|
2248
1174
|
</div>`;
|
|
2249
1175
|
},
|
|
2250
|
-
onPolygonHover: (
|
|
2251
|
-
D(
|
|
1176
|
+
onPolygonHover: (c) => {
|
|
1177
|
+
D(c ?? null);
|
|
2252
1178
|
},
|
|
2253
|
-
onPolygonClick: (
|
|
2254
|
-
onZoom:
|
|
1179
|
+
onPolygonClick: (c) => sn(c),
|
|
1180
|
+
onZoom: C,
|
|
2255
1181
|
onGlobeReady: () => {
|
|
2256
|
-
|
|
1182
|
+
_(), A(20, 15, 2.6);
|
|
2257
1183
|
},
|
|
2258
1184
|
onGlobeClick: () => {
|
|
2259
|
-
const
|
|
2260
|
-
|
|
1185
|
+
const c = o.current?.controls?.();
|
|
1186
|
+
c && (c.autoRotate = !1);
|
|
2261
1187
|
},
|
|
2262
1188
|
lineHoverPrecision: 0,
|
|
2263
|
-
width:
|
|
2264
|
-
height:
|
|
1189
|
+
width: ie.width,
|
|
1190
|
+
height: ie.height,
|
|
2265
1191
|
showAtmosphere: !1
|
|
2266
1192
|
}
|
|
2267
1193
|
)
|
|
@@ -2269,5 +1195,5 @@ const De = (t, e) => {
|
|
|
2269
1195
|
);
|
|
2270
1196
|
};
|
|
2271
1197
|
export {
|
|
2272
|
-
|
|
1198
|
+
Ft as CoolGlobe
|
|
2273
1199
|
};
|