cool-globe 0.1.2 → 0.1.4
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 +16 -6
- package/dist/cool-globe.cjs +16 -4
- package/dist/cool-globe.js +768 -1800
- package/dist/lib/CoolGlobe.d.ts +1 -1
- package/dist/lib/dashboardGlobe.utils.d.ts +14 -0
- package/dist/lib/types.d.ts +2 -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 Oe } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as V, useState as G, useEffect as z, useMemo as se, useCallback as ve } from "react";
|
|
3
|
+
import xn from "react-globe.gl";
|
|
4
|
+
import { Color as Ne } from "three";
|
|
5
|
+
function bn(e) {
|
|
6
|
+
return e;
|
|
7
|
+
}
|
|
8
|
+
function yn(e) {
|
|
9
|
+
if (e == null) return bn;
|
|
10
|
+
var n, t, r = e.scale[0], i = e.scale[1], o = e.translate[0], s = e.translate[1];
|
|
11
|
+
return function(a, l) {
|
|
12
|
+
l || (n = t = 0);
|
|
13
|
+
var f = 2, d = a.length, c = new Array(d);
|
|
14
|
+
for (c[0] = (n += a[0]) * r + o, c[1] = (t += a[1]) * i + s; f < d; ) c[f] = a[f], ++f;
|
|
15
|
+
return c;
|
|
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 wn(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 vn(e, n) {
|
|
22
|
+
return typeof n == "string" && (n = e.objects[n]), n.type === "GeometryCollection" ? { type: "FeatureCollection", features: n.geometries.map(function(t) {
|
|
23
|
+
return ze(e, t);
|
|
24
|
+
}) } : ze(e, n);
|
|
25
|
+
}
|
|
26
|
+
function ze(e, n) {
|
|
27
|
+
var t = n.id, r = n.bbox, i = n.properties == null ? {} : n.properties, o = Nn(e, n);
|
|
28
|
+
return t == null && r == null ? { type: "Feature", properties: i, geometry: o } : r == null ? { type: "Feature", id: t, properties: i, geometry: o } : { type: "Feature", id: t, bbox: r, properties: i, geometry: o };
|
|
29
|
+
}
|
|
30
|
+
function Nn(e, n) {
|
|
31
|
+
var t = yn(e.transform), r = e.arcs;
|
|
32
|
+
function i(d, c) {
|
|
33
|
+
c.length && c.pop();
|
|
34
|
+
for (var h = r[d < 0 ? ~d : d], N = 0, k = h.length; N < k; ++N)
|
|
35
|
+
c.push(t(h[N], N));
|
|
36
|
+
d < 0 && wn(c, k);
|
|
36
37
|
}
|
|
37
|
-
function o(
|
|
38
|
-
return
|
|
38
|
+
function o(d) {
|
|
39
|
+
return t(d);
|
|
39
40
|
}
|
|
40
|
-
function s(
|
|
41
|
-
for (var
|
|
42
|
-
return
|
|
41
|
+
function s(d) {
|
|
42
|
+
for (var c = [], h = 0, N = d.length; h < N; ++h) i(d[h], c);
|
|
43
|
+
return c.length < 2 && c.push(c[0]), c;
|
|
43
44
|
}
|
|
44
|
-
function a(
|
|
45
|
-
for (var
|
|
46
|
-
return
|
|
45
|
+
function a(d) {
|
|
46
|
+
for (var c = s(d); c.length < 4; ) c.push(c[0]);
|
|
47
|
+
return c;
|
|
47
48
|
}
|
|
48
|
-
function
|
|
49
|
-
return
|
|
49
|
+
function l(d) {
|
|
50
|
+
return d.map(a);
|
|
50
51
|
}
|
|
51
|
-
function
|
|
52
|
-
var
|
|
53
|
-
switch (
|
|
52
|
+
function f(d) {
|
|
53
|
+
var c = d.type, h;
|
|
54
|
+
switch (c) {
|
|
54
55
|
case "GeometryCollection":
|
|
55
|
-
return { type:
|
|
56
|
+
return { type: c, geometries: d.geometries.map(f) };
|
|
56
57
|
case "Point":
|
|
57
|
-
|
|
58
|
+
h = o(d.coordinates);
|
|
58
59
|
break;
|
|
59
60
|
case "MultiPoint":
|
|
60
|
-
|
|
61
|
+
h = d.coordinates.map(o);
|
|
61
62
|
break;
|
|
62
63
|
case "LineString":
|
|
63
|
-
|
|
64
|
+
h = s(d.arcs);
|
|
64
65
|
break;
|
|
65
66
|
case "MultiLineString":
|
|
66
|
-
|
|
67
|
+
h = d.arcs.map(s);
|
|
67
68
|
break;
|
|
68
69
|
case "Polygon":
|
|
69
|
-
|
|
70
|
+
h = l(d.arcs);
|
|
70
71
|
break;
|
|
71
72
|
case "MultiPolygon":
|
|
72
|
-
|
|
73
|
+
h = d.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;
|
|
78
|
+
return { type: c, coordinates: h };
|
|
259
79
|
}
|
|
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;
|
|
439
|
-
}
|
|
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;
|
|
572
|
-
}
|
|
573
|
-
const L = /* @__PURE__ */ Tt();
|
|
574
|
-
function Q(t) {
|
|
575
|
-
return t < 0.04045 ? t * 0.0773993808 : Math.pow(t * 0.9478672986 + 0.0521327014, 2.4);
|
|
80
|
+
return f(n);
|
|
576
81
|
}
|
|
577
|
-
|
|
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 Mn = "https://raw.githubusercontent.com/nvkelso/natural-earth-vector/master/geojson/ne_110m_admin_0_countries.geojson", _n = "https://cdn.jsdelivr.net/npm/world-atlas@2/countries-110m.json", $n = "https://raw.githubusercontent.com/nvkelso/natural-earth-vector/master/geojson/ne_10m_admin_1_states_provinces.geojson", Rn = "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>", Cn = {
|
|
1208
83
|
minColor: "#f8fafc",
|
|
1209
84
|
maxColor: "#e5e7eb"
|
|
1210
85
|
};
|
|
1211
|
-
function
|
|
1212
|
-
|
|
86
|
+
function Ee(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 on(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, me = 1 / Q, X = "\\s*([+-]?\\d+)\\s*", ee = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", j = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", kn = /^#([0-9a-f]{3,8})$/, Ln = new RegExp(`^rgb\\(${X},${X},${X}\\)$`), An = new RegExp(`^rgb\\(${j},${j},${j}\\)$`), Sn = new RegExp(`^rgba\\(${X},${X},${X},${ee}\\)$`), En = new RegExp(`^rgba\\(${j},${j},${j},${ee}\\)$`), In = new RegExp(`^hsl\\(${ee},${j},${j}\\)$`), Fn = new RegExp(`^hsla\\(${ee},${j},${j},${ee}\\)$`), He = {
|
|
1222
97
|
aliceblue: 15792383,
|
|
1223
98
|
antiquewhite: 16444375,
|
|
1224
99
|
aqua: 65535,
|
|
@@ -1368,900 +243,993 @@ 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
|
+
Ee(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: Te,
|
|
1379
254
|
// Deprecated! Use color.formatHex.
|
|
1380
|
-
formatHex:
|
|
1381
|
-
formatHex8:
|
|
1382
|
-
formatHsl:
|
|
1383
|
-
formatRgb:
|
|
1384
|
-
toString:
|
|
255
|
+
formatHex: Te,
|
|
256
|
+
formatHex8: jn,
|
|
257
|
+
formatHsl: Pn,
|
|
258
|
+
formatRgb: Ge,
|
|
259
|
+
toString: Ge
|
|
1385
260
|
});
|
|
1386
|
-
function
|
|
261
|
+
function Te() {
|
|
1387
262
|
return this.rgb().formatHex();
|
|
1388
263
|
}
|
|
1389
|
-
function
|
|
264
|
+
function jn() {
|
|
1390
265
|
return this.rgb().formatHex8();
|
|
1391
266
|
}
|
|
1392
|
-
function
|
|
1393
|
-
return
|
|
267
|
+
function Pn() {
|
|
268
|
+
return an(this).formatHsl();
|
|
1394
269
|
}
|
|
1395
|
-
function
|
|
270
|
+
function Ge() {
|
|
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 = kn.exec(e)) ? (t = n[1].length, n = parseInt(n[1], 16), t === 6 ? Ue(n) : t === 3 ? new C(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 = Ln.exec(e)) ? new C(n[1], n[2], n[3], 1) : (n = An.exec(e)) ? new C(n[1] * 255 / 100, n[2] * 255 / 100, n[3] * 255 / 100, 1) : (n = Sn.exec(e)) ? fe(n[1], n[2], n[3], n[4]) : (n = En.exec(e)) ? fe(n[1] * 255 / 100, n[2] * 255 / 100, n[3] * 255 / 100, n[4]) : (n = In.exec(e)) ? Ve(n[1], n[2] / 100, n[3] / 100, 1) : (n = Fn.exec(e)) ? Ve(n[1], n[2] / 100, n[3] / 100, n[4]) : He.hasOwnProperty(e) ? Ue(He[e]) : e === "transparent" ? new C(NaN, NaN, NaN, 0) : null;
|
|
1401
276
|
}
|
|
1402
|
-
function
|
|
1403
|
-
return new
|
|
277
|
+
function Ue(e) {
|
|
278
|
+
return new C(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 C(e, n, t, r);
|
|
1407
282
|
}
|
|
1408
|
-
function
|
|
1409
|
-
return
|
|
283
|
+
function On(e) {
|
|
284
|
+
return e instanceof te || (e = ne(e)), e ? (e = e.rgb(), new C(e.r, e.g, e.b, e.opacity)) : new C();
|
|
1410
285
|
}
|
|
1411
|
-
function
|
|
1412
|
-
return arguments.length === 1 ?
|
|
286
|
+
function Ce(e, n, t, r) {
|
|
287
|
+
return arguments.length === 1 ? On(e) : new C(e, n, t, r ?? 1);
|
|
1413
288
|
}
|
|
1414
|
-
function
|
|
1415
|
-
this.r = +
|
|
289
|
+
function C(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
|
+
Ee(C, Ce, on(te, {
|
|
293
|
+
brighter(e) {
|
|
294
|
+
return e = e == null ? me : Math.pow(me, e), new C(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 C(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 C(Z(this.r), Z(this.g), Z(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: De,
|
|
1434
309
|
// Deprecated! Use color.formatHex.
|
|
1435
|
-
formatHex:
|
|
1436
|
-
formatHex8:
|
|
1437
|
-
formatRgb:
|
|
1438
|
-
toString:
|
|
310
|
+
formatHex: De,
|
|
311
|
+
formatHex8: zn,
|
|
312
|
+
formatRgb: qe,
|
|
313
|
+
toString: qe
|
|
1439
314
|
}));
|
|
1440
|
-
function
|
|
1441
|
-
return `#${
|
|
315
|
+
function De() {
|
|
316
|
+
return `#${B(this.r)}${B(this.g)}${B(this.b)}`;
|
|
1442
317
|
}
|
|
1443
|
-
function
|
|
1444
|
-
return `#${
|
|
318
|
+
function zn() {
|
|
319
|
+
return `#${B(this.r)}${B(this.g)}${B(this.b)}${B((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
|
|
1445
320
|
}
|
|
1446
|
-
function
|
|
1447
|
-
const
|
|
1448
|
-
return `${
|
|
321
|
+
function qe() {
|
|
322
|
+
const e = he(this.opacity);
|
|
323
|
+
return `${e === 1 ? "rgb(" : "rgba("}${Z(this.r)}, ${Z(this.g)}, ${Z(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 Z(e) {
|
|
329
|
+
return Math.max(0, Math.min(255, Math.round(e) || 0));
|
|
1455
330
|
}
|
|
1456
|
-
function
|
|
1457
|
-
return
|
|
331
|
+
function B(e) {
|
|
332
|
+
return e = Z(e), (e < 16 ? "0" : "") + e.toString(16);
|
|
1458
333
|
}
|
|
1459
|
-
function
|
|
1460
|
-
return r <= 0 ?
|
|
334
|
+
function Ve(e, n, t, r) {
|
|
335
|
+
return r <= 0 ? e = n = t = NaN : t <= 0 || t >= 1 ? e = n = NaN : n <= 0 && (e = NaN), new E(e, n, t, r);
|
|
1461
336
|
}
|
|
1462
|
-
function
|
|
1463
|
-
if (
|
|
1464
|
-
if (
|
|
1465
|
-
if (
|
|
1466
|
-
|
|
1467
|
-
var
|
|
1468
|
-
return a ? (
|
|
337
|
+
function an(e) {
|
|
338
|
+
if (e instanceof E) return new E(e.h, e.s, e.l, e.opacity);
|
|
339
|
+
if (e instanceof te || (e = ne(e)), !e) return new E();
|
|
340
|
+
if (e instanceof E) 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), o = Math.max(n, t, r), s = NaN, a = o - i, l = (o + i) / 2;
|
|
343
|
+
return a ? (n === o ? s = (t - r) / a + (t < r) * 6 : t === o ? s = (r - n) / a + 2 : s = (n - t) / a + 4, a /= l < 0.5 ? o + i : 2 - o - i, s *= 60) : a = l > 0 && l < 1 ? 0 : s, new E(s, a, l, e.opacity);
|
|
1469
344
|
}
|
|
1470
|
-
function
|
|
1471
|
-
return arguments.length === 1 ?
|
|
345
|
+
function Hn(e, n, t, r) {
|
|
346
|
+
return arguments.length === 1 ? an(e) : new E(e, n, t, r ?? 1);
|
|
1472
347
|
}
|
|
1473
|
-
function
|
|
1474
|
-
this.h = +
|
|
348
|
+
function E(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
|
+
Ee(E, Hn, on(te, {
|
|
352
|
+
brighter(e) {
|
|
353
|
+
return e = e == null ? me : Math.pow(me, e), new E(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 E(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 C(
|
|
361
|
+
Me(e >= 240 ? e - 240 : e + 120, i, r),
|
|
362
|
+
Me(e, i, r),
|
|
363
|
+
Me(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 E(Be(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("}${Be(this.h)}, ${ce(this.s) * 100}%, ${ce(this.l) * 100}%${e === 1 ? ")" : `, ${e})`}`;
|
|
1501
376
|
}
|
|
1502
377
|
}));
|
|
1503
|
-
function
|
|
1504
|
-
return
|
|
378
|
+
function Be(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 Me(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 Ie = (e) => () => e;
|
|
388
|
+
function Tn(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 Gn(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 Un(e) {
|
|
399
|
+
return (e = +e) == 1 ? sn : function(n, t) {
|
|
400
|
+
return t - n ? Gn(n, t, e) : Ie(isNaN(n) ? t : n);
|
|
1526
401
|
};
|
|
1527
402
|
}
|
|
1528
|
-
function
|
|
1529
|
-
var
|
|
1530
|
-
return
|
|
403
|
+
function sn(e, n) {
|
|
404
|
+
var t = n - e;
|
|
405
|
+
return t ? Tn(e, t) : Ie(isNaN(e) ? n : e);
|
|
1531
406
|
}
|
|
1532
|
-
const
|
|
1533
|
-
var
|
|
407
|
+
const ke = (function e(n) {
|
|
408
|
+
var t = Un(n);
|
|
1534
409
|
function r(i, o) {
|
|
1535
|
-
var s =
|
|
1536
|
-
return function(
|
|
1537
|
-
return i.r = s(
|
|
410
|
+
var s = t((i = Ce(i)).r, (o = Ce(o)).r), a = t(i.g, o.g), l = t(i.b, o.b), f = sn(i.opacity, o.opacity);
|
|
411
|
+
return function(d) {
|
|
412
|
+
return i.r = s(d), i.g = a(d), i.b = l(d), i.opacity = f(d), i + "";
|
|
1538
413
|
};
|
|
1539
414
|
}
|
|
1540
|
-
return r.gamma =
|
|
415
|
+
return r.gamma = e, r;
|
|
1541
416
|
})(1);
|
|
1542
|
-
function
|
|
1543
|
-
|
|
1544
|
-
var
|
|
417
|
+
function Dn(e, n) {
|
|
418
|
+
n || (n = []);
|
|
419
|
+
var t = e ? Math.min(n.length, e.length) : 0, r = n.slice(), i;
|
|
1545
420
|
return function(o) {
|
|
1546
|
-
for (i = 0; i <
|
|
421
|
+
for (i = 0; i < t; ++i) r[i] = e[i] * (1 - o) + n[i] * o;
|
|
1547
422
|
return r;
|
|
1548
423
|
};
|
|
1549
424
|
}
|
|
1550
|
-
function
|
|
1551
|
-
return ArrayBuffer.isView(
|
|
425
|
+
function qn(e) {
|
|
426
|
+
return ArrayBuffer.isView(e) && !(e instanceof DataView);
|
|
1552
427
|
}
|
|
1553
|
-
function
|
|
1554
|
-
var
|
|
1555
|
-
for (s = 0; s < r; ++s) i[s] =
|
|
1556
|
-
for (; s <
|
|
428
|
+
function Vn(e, n) {
|
|
429
|
+
var t = n ? n.length : 0, r = e ? Math.min(t, e.length) : 0, i = new Array(r), o = new Array(t), s;
|
|
430
|
+
for (s = 0; s < r; ++s) i[s] = Fe(e[s], n[s]);
|
|
431
|
+
for (; s < t; ++s) o[s] = n[s];
|
|
1557
432
|
return function(a) {
|
|
1558
433
|
for (s = 0; s < r; ++s) o[s] = i[s](a);
|
|
1559
434
|
return o;
|
|
1560
435
|
};
|
|
1561
436
|
}
|
|
1562
|
-
function
|
|
1563
|
-
var
|
|
1564
|
-
return
|
|
1565
|
-
return
|
|
437
|
+
function Bn(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 ge(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
|
|
448
|
+
function Zn(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] = Fe(e[i], n[i]) : r[i] = n[i];
|
|
1578
453
|
return function(o) {
|
|
1579
|
-
for (i in
|
|
454
|
+
for (i in t) r[i] = t[i](o);
|
|
1580
455
|
return r;
|
|
1581
456
|
};
|
|
1582
457
|
}
|
|
1583
|
-
var
|
|
1584
|
-
function
|
|
458
|
+
var Le = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, _e = new RegExp(Le.source, "g");
|
|
459
|
+
function Jn(e) {
|
|
1585
460
|
return function() {
|
|
1586
|
-
return
|
|
461
|
+
return e;
|
|
1587
462
|
};
|
|
1588
463
|
}
|
|
1589
|
-
function
|
|
1590
|
-
return function(
|
|
1591
|
-
return
|
|
464
|
+
function Kn(e) {
|
|
465
|
+
return function(n) {
|
|
466
|
+
return e(n) + "";
|
|
1592
467
|
};
|
|
1593
468
|
}
|
|
1594
|
-
function
|
|
1595
|
-
var
|
|
1596
|
-
for (
|
|
1597
|
-
(o = i.index) >
|
|
1598
|
-
return
|
|
1599
|
-
for (var
|
|
469
|
+
function Yn(e, n) {
|
|
470
|
+
var t = Le.lastIndex = _e.lastIndex = 0, r, i, o, s = -1, a = [], l = [];
|
|
471
|
+
for (e = e + "", n = n + ""; (r = Le.exec(e)) && (i = _e.exec(n)); )
|
|
472
|
+
(o = i.index) > t && (o = n.slice(t, o), a[s] ? a[s] += o : a[++s] = o), (r = r[0]) === (i = i[0]) ? a[s] ? a[s] += i : a[++s] = i : (a[++s] = null, l.push({ i: s, x: ge(r, i) })), t = _e.lastIndex;
|
|
473
|
+
return t < n.length && (o = n.slice(t), a[s] ? a[s] += o : a[++s] = o), a.length < 2 ? l[0] ? Kn(l[0].x) : Jn(n) : (n = l.length, function(f) {
|
|
474
|
+
for (var d = 0, c; d < n; ++d) a[(c = l[d]).i] = c.x(f);
|
|
1600
475
|
return a.join("");
|
|
1601
476
|
});
|
|
1602
477
|
}
|
|
1603
|
-
function
|
|
1604
|
-
var
|
|
1605
|
-
return
|
|
478
|
+
function Fe(e, n) {
|
|
479
|
+
var t = typeof n, r;
|
|
480
|
+
return n == null || t === "boolean" ? Ie(n) : (t === "number" ? ge : t === "string" ? (r = ne(n)) ? (n = r, ke) : Yn : n instanceof ne ? ke : n instanceof Date ? Bn : qn(n) ? Dn : Array.isArray(n) ? Vn : typeof n.valueOf != "function" && typeof n.toString != "function" || isNaN(n) ? Zn : ge)(e, n);
|
|
1606
481
|
}
|
|
1607
|
-
function
|
|
1608
|
-
return
|
|
1609
|
-
return Math.round(
|
|
482
|
+
function Xn(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 Wn(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(a,
|
|
1622
|
-
if (
|
|
1623
|
-
if (
|
|
493
|
+
function fn(e) {
|
|
494
|
+
let n, t, r;
|
|
495
|
+
e.length !== 2 ? (n = le, t = (a, l) => le(e(a), l), r = (a, l) => e(a) - l) : (n = e === le || e === Wn ? e : Qn, t = e, r = e);
|
|
496
|
+
function i(a, l, f = 0, d = a.length) {
|
|
497
|
+
if (f < d) {
|
|
498
|
+
if (n(l, l) !== 0) return d;
|
|
1624
499
|
do {
|
|
1625
|
-
const
|
|
1626
|
-
|
|
1627
|
-
} while (
|
|
500
|
+
const c = f + d >>> 1;
|
|
501
|
+
t(a[c], l) < 0 ? f = c + 1 : d = c;
|
|
502
|
+
} while (f < d);
|
|
1628
503
|
}
|
|
1629
|
-
return
|
|
504
|
+
return f;
|
|
1630
505
|
}
|
|
1631
|
-
function o(a,
|
|
1632
|
-
if (
|
|
1633
|
-
if (
|
|
506
|
+
function o(a, l, f = 0, d = a.length) {
|
|
507
|
+
if (f < d) {
|
|
508
|
+
if (n(l, l) !== 0) return d;
|
|
1634
509
|
do {
|
|
1635
|
-
const
|
|
1636
|
-
|
|
1637
|
-
} while (
|
|
510
|
+
const c = f + d >>> 1;
|
|
511
|
+
t(a[c], l) <= 0 ? f = c + 1 : d = c;
|
|
512
|
+
} while (f < d);
|
|
1638
513
|
}
|
|
1639
|
-
return
|
|
514
|
+
return f;
|
|
1640
515
|
}
|
|
1641
|
-
function s(a,
|
|
1642
|
-
const
|
|
1643
|
-
return
|
|
516
|
+
function s(a, l, f = 0, d = a.length) {
|
|
517
|
+
const c = i(a, l, f, d - 1);
|
|
518
|
+
return c > f && r(a[c - 1], l) > -r(a[c], l) ? c - 1 : c;
|
|
1644
519
|
}
|
|
1645
520
|
return { left: i, center: s, right: o };
|
|
1646
521
|
}
|
|
1647
|
-
function
|
|
522
|
+
function Qn() {
|
|
1648
523
|
return 0;
|
|
1649
524
|
}
|
|
1650
|
-
function
|
|
1651
|
-
return
|
|
1652
|
-
}
|
|
1653
|
-
const
|
|
1654
|
-
|
|
1655
|
-
const
|
|
1656
|
-
function
|
|
1657
|
-
const r = (
|
|
1658
|
-
let a,
|
|
1659
|
-
return i < 0 ? (
|
|
1660
|
-
}
|
|
1661
|
-
function
|
|
1662
|
-
if (
|
|
1663
|
-
if (
|
|
1664
|
-
const r =
|
|
525
|
+
function et(e) {
|
|
526
|
+
return e === null ? NaN : +e;
|
|
527
|
+
}
|
|
528
|
+
const nt = fn(le), tt = nt.right;
|
|
529
|
+
fn(et).center;
|
|
530
|
+
const rt = Math.sqrt(50), it = Math.sqrt(10), ot = Math.sqrt(2);
|
|
531
|
+
function pe(e, n, t) {
|
|
532
|
+
const r = (n - e) / Math.max(0, t), i = Math.floor(Math.log10(r)), o = r / Math.pow(10, i), s = o >= rt ? 10 : o >= it ? 5 : o >= ot ? 2 : 1;
|
|
533
|
+
let a, l, f;
|
|
534
|
+
return i < 0 ? (f = Math.pow(10, -i) / s, a = Math.round(e * f), l = Math.round(n * f), a / f < e && ++a, l / f > n && --l, f = -f) : (f = Math.pow(10, i) * s, a = Math.round(e / f), l = Math.round(n / f), a * f < e && ++a, l * f > n && --l), l < a && 0.5 <= t && t < 2 ? pe(e, n, t * 2) : [a, l, f];
|
|
535
|
+
}
|
|
536
|
+
function at(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, o, s] = r ? pe(n, e, t) : pe(e, n, t);
|
|
1665
540
|
if (!(o >= i)) return [];
|
|
1666
|
-
const a = o - i + 1,
|
|
541
|
+
const a = o - i + 1, l = new Array(a);
|
|
1667
542
|
if (r)
|
|
1668
|
-
if (s < 0) for (let
|
|
1669
|
-
else for (let
|
|
1670
|
-
else if (s < 0) for (let
|
|
1671
|
-
else for (let
|
|
1672
|
-
return
|
|
1673
|
-
}
|
|
1674
|
-
function
|
|
1675
|
-
return
|
|
1676
|
-
}
|
|
1677
|
-
function
|
|
1678
|
-
|
|
1679
|
-
const r =
|
|
543
|
+
if (s < 0) for (let f = 0; f < a; ++f) l[f] = (o - f) / -s;
|
|
544
|
+
else for (let f = 0; f < a; ++f) l[f] = (o - f) * s;
|
|
545
|
+
else if (s < 0) for (let f = 0; f < a; ++f) l[f] = (i + f) / -s;
|
|
546
|
+
else for (let f = 0; f < a; ++f) l[f] = (i + f) * s;
|
|
547
|
+
return l;
|
|
548
|
+
}
|
|
549
|
+
function Ae(e, n, t) {
|
|
550
|
+
return n = +n, e = +e, t = +t, pe(e, n, t)[2];
|
|
551
|
+
}
|
|
552
|
+
function st(e, n, t) {
|
|
553
|
+
n = +n, e = +e, t = +t;
|
|
554
|
+
const r = n < e, i = r ? Ae(n, e, t) : Ae(e, n, t);
|
|
1680
555
|
return (r ? -1 : 1) * (i < 0 ? 1 / -i : i);
|
|
1681
556
|
}
|
|
1682
|
-
function
|
|
557
|
+
function ft(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 ct(e) {
|
|
1696
571
|
return function() {
|
|
1697
|
-
return
|
|
572
|
+
return e;
|
|
1698
573
|
};
|
|
1699
574
|
}
|
|
1700
|
-
function
|
|
1701
|
-
return +
|
|
575
|
+
function ut(e) {
|
|
576
|
+
return +e;
|
|
1702
577
|
}
|
|
1703
|
-
var
|
|
1704
|
-
function
|
|
1705
|
-
return
|
|
578
|
+
var Ze = [0, 1];
|
|
579
|
+
function Y(e) {
|
|
580
|
+
return e;
|
|
1706
581
|
}
|
|
1707
|
-
function
|
|
1708
|
-
return (
|
|
1709
|
-
return (
|
|
1710
|
-
} :
|
|
582
|
+
function Se(e, n) {
|
|
583
|
+
return (n -= e = +e) ? function(t) {
|
|
584
|
+
return (t - e) / n;
|
|
585
|
+
} : ct(isNaN(n) ? NaN : 0.5);
|
|
1711
586
|
}
|
|
1712
|
-
function
|
|
1713
|
-
var
|
|
1714
|
-
return
|
|
1715
|
-
return Math.max(
|
|
587
|
+
function lt(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 =
|
|
593
|
+
function dt(e, n, t) {
|
|
594
|
+
var r = e[0], i = e[1], o = n[0], s = n[1];
|
|
595
|
+
return i < r ? (r = Se(i, r), o = t(s, o)) : (r = Se(r, i), o = t(o, s)), function(a) {
|
|
1721
596
|
return o(r(a));
|
|
1722
597
|
};
|
|
1723
598
|
}
|
|
1724
|
-
function
|
|
1725
|
-
var r = Math.min(
|
|
1726
|
-
for (
|
|
1727
|
-
i[s] =
|
|
599
|
+
function mt(e, n, t) {
|
|
600
|
+
var r = Math.min(e.length, n.length) - 1, i = new Array(r), o = new Array(r), s = -1;
|
|
601
|
+
for (e[r] < e[0] && (e = e.slice().reverse(), n = n.slice().reverse()); ++s < r; )
|
|
602
|
+
i[s] = Se(e[s], e[s + 1]), o[s] = t(n[s], n[s + 1]);
|
|
1728
603
|
return function(a) {
|
|
1729
|
-
var
|
|
1730
|
-
return o[
|
|
604
|
+
var l = tt(e, a, 1, r) - 1;
|
|
605
|
+
return o[l](i[l](a));
|
|
1731
606
|
};
|
|
1732
607
|
}
|
|
1733
|
-
function
|
|
1734
|
-
return
|
|
1735
|
-
}
|
|
1736
|
-
function
|
|
1737
|
-
var
|
|
1738
|
-
function
|
|
1739
|
-
var
|
|
1740
|
-
return s !==
|
|
1741
|
-
}
|
|
1742
|
-
function
|
|
1743
|
-
return
|
|
1744
|
-
}
|
|
1745
|
-
return
|
|
1746
|
-
return s(i((
|
|
1747
|
-
},
|
|
1748
|
-
return arguments.length ? (
|
|
1749
|
-
},
|
|
1750
|
-
return arguments.length ? (
|
|
1751
|
-
},
|
|
1752
|
-
return
|
|
1753
|
-
},
|
|
1754
|
-
return arguments.length ? (s =
|
|
1755
|
-
},
|
|
1756
|
-
return arguments.length ? (
|
|
1757
|
-
},
|
|
1758
|
-
return arguments.length ? (o =
|
|
1759
|
-
}, function(
|
|
1760
|
-
return r =
|
|
608
|
+
function ht(e, n) {
|
|
609
|
+
return n.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown());
|
|
610
|
+
}
|
|
611
|
+
function gt() {
|
|
612
|
+
var e = Ze, n = Ze, t = Fe, r, i, o, s = Y, a, l, f;
|
|
613
|
+
function d() {
|
|
614
|
+
var h = Math.min(e.length, n.length);
|
|
615
|
+
return s !== Y && (s = lt(e[0], e[h - 1])), a = h > 2 ? mt : dt, l = f = null, c;
|
|
616
|
+
}
|
|
617
|
+
function c(h) {
|
|
618
|
+
return h == null || isNaN(h = +h) ? o : (l || (l = a(e.map(r), n, t)))(r(s(h)));
|
|
619
|
+
}
|
|
620
|
+
return c.invert = function(h) {
|
|
621
|
+
return s(i((f || (f = a(n, e.map(r), ge)))(h)));
|
|
622
|
+
}, c.domain = function(h) {
|
|
623
|
+
return arguments.length ? (e = Array.from(h, ut), d()) : e.slice();
|
|
624
|
+
}, c.range = function(h) {
|
|
625
|
+
return arguments.length ? (n = Array.from(h), d()) : n.slice();
|
|
626
|
+
}, c.rangeRound = function(h) {
|
|
627
|
+
return n = Array.from(h), t = Xn, d();
|
|
628
|
+
}, c.clamp = function(h) {
|
|
629
|
+
return arguments.length ? (s = h ? !0 : Y, d()) : s !== Y;
|
|
630
|
+
}, c.interpolate = function(h) {
|
|
631
|
+
return arguments.length ? (t = h, d()) : t;
|
|
632
|
+
}, c.unknown = function(h) {
|
|
633
|
+
return arguments.length ? (o = h, c) : o;
|
|
634
|
+
}, function(h, N) {
|
|
635
|
+
return r = h, i = N, d();
|
|
1761
636
|
};
|
|
1762
637
|
}
|
|
1763
|
-
function
|
|
1764
|
-
return
|
|
638
|
+
function pt() {
|
|
639
|
+
return gt()(Y, Y);
|
|
1765
640
|
}
|
|
1766
|
-
function
|
|
1767
|
-
return Math.abs(
|
|
641
|
+
function xt(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 xe(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 W(e) {
|
|
653
|
+
return e = xe(Math.abs(e)), e ? e[1] : NaN;
|
|
1779
654
|
}
|
|
1780
|
-
function
|
|
1781
|
-
return function(
|
|
1782
|
-
for (var i =
|
|
1783
|
-
a =
|
|
1784
|
-
return o.reverse().join(
|
|
655
|
+
function bt(e, n) {
|
|
656
|
+
return function(t, r) {
|
|
657
|
+
for (var i = t.length, o = [], s = 0, a = e[0], l = 0; i > 0 && a > 0 && (l + a + 1 > r && (a = Math.max(1, r - l)), o.push(t.substring(i -= a, i + a)), !((l += a + 1) > r)); )
|
|
658
|
+
a = e[s = (s + 1) % e.length];
|
|
659
|
+
return o.reverse().join(n);
|
|
1785
660
|
};
|
|
1786
661
|
}
|
|
1787
|
-
function
|
|
1788
|
-
return function(
|
|
1789
|
-
return
|
|
1790
|
-
return
|
|
662
|
+
function yt(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 wt = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
|
|
670
|
+
function be(e) {
|
|
671
|
+
if (!(n = wt.exec(e))) throw new Error("invalid format: " + e);
|
|
672
|
+
var n;
|
|
673
|
+
return new je({
|
|
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
|
+
be.prototype = je.prototype;
|
|
687
|
+
function je(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
|
+
je.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 vt(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 o === s ? r : o > s ? r + new Array(o - s + 1).join("0") : o > 0 ? r.slice(0, o) + "." + r.slice(o) : "0." + new Array(1 - o).join("0") +
|
|
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 ye;
|
|
710
|
+
function Nt(e, n) {
|
|
711
|
+
var t = xe(e, n);
|
|
712
|
+
if (!t) return ye = void 0, e.toPrecision(n);
|
|
713
|
+
var r = t[0], i = t[1], o = i - (ye = Math.max(-8, Math.min(8, Math.floor(i / 3))) * 3) + 1, s = r.length;
|
|
714
|
+
return o === s ? r : o > s ? r + new Array(o - s + 1).join("0") : o > 0 ? r.slice(0, o) + "." + r.slice(o) : "0." + new Array(1 - o).join("0") + xe(e, Math.max(0, n + o - 1))[0];
|
|
715
|
+
}
|
|
716
|
+
function Je(e, n) {
|
|
717
|
+
var t = xe(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 Ke = {
|
|
723
|
+
"%": (e, n) => (e * 100).toFixed(n),
|
|
724
|
+
b: (e) => Math.round(e).toString(2),
|
|
725
|
+
c: (e) => e + "",
|
|
726
|
+
d: xt,
|
|
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) => Je(e * 100, n),
|
|
732
|
+
r: Je,
|
|
733
|
+
s: Nt,
|
|
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
|
|
1869
|
-
|
|
1870
|
-
var
|
|
1871
|
-
|
|
1872
|
-
var
|
|
1873
|
-
|
|
1874
|
-
function
|
|
1875
|
-
var P =
|
|
1876
|
-
if (
|
|
1877
|
-
|
|
737
|
+
function Ye(e) {
|
|
738
|
+
return e;
|
|
739
|
+
}
|
|
740
|
+
var Xe = Array.prototype.map, We = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
|
|
741
|
+
function Mt(e) {
|
|
742
|
+
var n = e.grouping === void 0 || e.thousands === void 0 ? Ye : bt(Xe.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 + "", o = e.numerals === void 0 ? Ye : yt(Xe.call(e.numerals, String)), s = e.percent === void 0 ? "%" : e.percent + "", a = e.minus === void 0 ? "−" : e.minus + "", l = e.nan === void 0 ? "NaN" : e.nan + "";
|
|
743
|
+
function f(c, h) {
|
|
744
|
+
c = be(c);
|
|
745
|
+
var N = c.fill, k = c.align, L = c.sign, w = c.symbol, A = c.zero, M = c.width, J = c.comma, I = c.precision, U = c.trim, R = c.type;
|
|
746
|
+
R === "n" ? (J = !0, R = "g") : Ke[R] || (I === void 0 && (I = 12), U = !0, R = "g"), (A || N === "0" && k === "=") && (A = !0, N = "0", k = "=");
|
|
747
|
+
var re = (h && h.prefix !== void 0 ? h.prefix : "") + (w === "$" ? t : w === "#" && /[boxX]/.test(R) ? "0" + R.toLowerCase() : ""), F = (w === "$" ? r : /[%p]/.test(R) ? s : "") + (h && h.suffix !== void 0 ? h.suffix : ""), ie = Ke[R], oe = /[defgprs%]/.test(R);
|
|
748
|
+
I = I === void 0 ? 6 : /[gprs]/.test(R) ? Math.max(1, Math.min(21, I)) : Math.max(0, Math.min(20, I));
|
|
749
|
+
function D(g) {
|
|
750
|
+
var P = re, _ = F, O, ae, K;
|
|
751
|
+
if (R === "c")
|
|
752
|
+
_ = ie(g) + _, g = "";
|
|
1878
753
|
else {
|
|
1879
|
-
|
|
1880
|
-
var
|
|
1881
|
-
if (
|
|
1882
|
-
for (
|
|
1883
|
-
if (
|
|
1884
|
-
|
|
754
|
+
g = +g;
|
|
755
|
+
var S = g < 0 || 1 / g < 0;
|
|
756
|
+
if (g = isNaN(g) ? l : ie(Math.abs(g), I), U && (g = vt(g)), S && +g == 0 && L !== "+" && (S = !1), P = (S ? L === "(" ? L : a : L === "-" || L === "(" ? "" : L) + P, _ = (R === "s" && !isNaN(g) && ye !== void 0 ? We[8 + ye / 3] : "") + _ + (S && L === "(" ? ")" : ""), oe) {
|
|
757
|
+
for (O = -1, ae = g.length; ++O < ae; )
|
|
758
|
+
if (K = g.charCodeAt(O), 48 > K || K > 57) {
|
|
759
|
+
_ = (K === 46 ? i + g.slice(O + 1) : g.slice(O)) + _, g = g.slice(0, O);
|
|
1885
760
|
break;
|
|
1886
761
|
}
|
|
1887
762
|
}
|
|
1888
763
|
}
|
|
1889
|
-
|
|
1890
|
-
var
|
|
1891
|
-
switch (
|
|
764
|
+
J && !A && (g = n(g, 1 / 0));
|
|
765
|
+
var H = P.length + g.length + _.length, $ = H < M ? new Array(M - H + 1).join(N) : "";
|
|
766
|
+
switch (J && A && (g = n($ + g, $.length ? M - _.length : 1 / 0), $ = ""), k) {
|
|
1892
767
|
case "<":
|
|
1893
|
-
|
|
768
|
+
g = P + g + _ + $;
|
|
1894
769
|
break;
|
|
1895
770
|
case "=":
|
|
1896
|
-
|
|
771
|
+
g = P + $ + g + _;
|
|
1897
772
|
break;
|
|
1898
773
|
case "^":
|
|
1899
|
-
|
|
774
|
+
g = $.slice(0, H = $.length >> 1) + P + g + _ + $.slice(H);
|
|
1900
775
|
break;
|
|
1901
776
|
default:
|
|
1902
|
-
|
|
777
|
+
g = $ + P + g + _;
|
|
1903
778
|
break;
|
|
1904
779
|
}
|
|
1905
|
-
return o(
|
|
780
|
+
return o(g);
|
|
1906
781
|
}
|
|
1907
|
-
return
|
|
1908
|
-
return
|
|
1909
|
-
},
|
|
1910
|
-
}
|
|
1911
|
-
function
|
|
1912
|
-
var
|
|
1913
|
-
return function(
|
|
1914
|
-
return
|
|
782
|
+
return D.toString = function() {
|
|
783
|
+
return c + "";
|
|
784
|
+
}, D;
|
|
785
|
+
}
|
|
786
|
+
function d(c, h) {
|
|
787
|
+
var N = Math.max(-8, Math.min(8, Math.floor(W(h) / 3))) * 3, k = Math.pow(10, -N), L = f((c = be(c), c.type = "f", c), { suffix: We[8 + N / 3] });
|
|
788
|
+
return function(w) {
|
|
789
|
+
return L(k * w);
|
|
1915
790
|
};
|
|
1916
791
|
}
|
|
1917
792
|
return {
|
|
1918
|
-
format:
|
|
1919
|
-
formatPrefix:
|
|
793
|
+
format: f,
|
|
794
|
+
formatPrefix: d
|
|
1920
795
|
};
|
|
1921
796
|
}
|
|
1922
|
-
var
|
|
1923
|
-
|
|
797
|
+
var ue, cn, un;
|
|
798
|
+
_t({
|
|
1924
799
|
thousands: ",",
|
|
1925
800
|
grouping: [3],
|
|
1926
801
|
currency: ["$", ""]
|
|
1927
802
|
});
|
|
1928
|
-
function
|
|
1929
|
-
return
|
|
803
|
+
function _t(e) {
|
|
804
|
+
return ue = Mt(e), cn = ue.format, un = ue.formatPrefix, ue;
|
|
1930
805
|
}
|
|
1931
|
-
function
|
|
1932
|
-
return Math.max(0, -
|
|
806
|
+
function $t(e) {
|
|
807
|
+
return Math.max(0, -W(Math.abs(e)));
|
|
1933
808
|
}
|
|
1934
|
-
function
|
|
1935
|
-
return Math.max(0, Math.max(-8, Math.min(8, Math.floor(
|
|
809
|
+
function Rt(e, n) {
|
|
810
|
+
return Math.max(0, Math.max(-8, Math.min(8, Math.floor(W(n) / 3))) * 3 - W(Math.abs(e)));
|
|
1936
811
|
}
|
|
1937
|
-
function
|
|
1938
|
-
return
|
|
812
|
+
function Ct(e, n) {
|
|
813
|
+
return e = Math.abs(e), n = Math.abs(n) - e, Math.max(0, W(n) - W(e)) + 1;
|
|
1939
814
|
}
|
|
1940
|
-
function
|
|
1941
|
-
var i =
|
|
1942
|
-
switch (r =
|
|
815
|
+
function kt(e, n, t, r) {
|
|
816
|
+
var i = st(e, n, t), o;
|
|
817
|
+
switch (r = be(r ?? ",f"), r.type) {
|
|
1943
818
|
case "s": {
|
|
1944
|
-
var s = Math.max(Math.abs(
|
|
1945
|
-
return r.precision == null && !isNaN(o =
|
|
819
|
+
var s = Math.max(Math.abs(e), Math.abs(n));
|
|
820
|
+
return r.precision == null && !isNaN(o = Rt(i, s)) && (r.precision = o), un(r, s);
|
|
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(o =
|
|
827
|
+
r.precision == null && !isNaN(o = Ct(i, Math.max(Math.abs(e), Math.abs(n)))) && (r.precision = o - (r.type === "e"));
|
|
1953
828
|
break;
|
|
1954
829
|
}
|
|
1955
830
|
case "f":
|
|
1956
831
|
case "%": {
|
|
1957
|
-
r.precision == null && !isNaN(o =
|
|
832
|
+
r.precision == null && !isNaN(o = $t(i)) && (r.precision = o - (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 (a < s && (
|
|
1975
|
-
if (
|
|
1976
|
-
return r[i] = s, r[o] = a,
|
|
1977
|
-
if (
|
|
1978
|
-
s = Math.floor(s /
|
|
1979
|
-
else if (
|
|
1980
|
-
s = Math.ceil(s *
|
|
836
|
+
return cn(r);
|
|
837
|
+
}
|
|
838
|
+
function Lt(e) {
|
|
839
|
+
var n = e.domain;
|
|
840
|
+
return e.ticks = function(t) {
|
|
841
|
+
var r = n();
|
|
842
|
+
return at(r[0], r[r.length - 1], t ?? 10);
|
|
843
|
+
}, e.tickFormat = function(t, r) {
|
|
844
|
+
var i = n();
|
|
845
|
+
return kt(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, o = r.length - 1, s = r[i], a = r[o], l, f, d = 10;
|
|
849
|
+
for (a < s && (f = s, s = a, a = f, f = i, i = o, o = f); d-- > 0; ) {
|
|
850
|
+
if (f = Ae(s, a, t), f === l)
|
|
851
|
+
return r[i] = s, r[o] = a, n(r);
|
|
852
|
+
if (f > 0)
|
|
853
|
+
s = Math.floor(s / f) * f, a = Math.ceil(a / f) * f;
|
|
854
|
+
else if (f < 0)
|
|
855
|
+
s = Math.ceil(s * f) / f, a = Math.floor(a * f) / f;
|
|
1981
856
|
else
|
|
1982
857
|
break;
|
|
1983
|
-
|
|
858
|
+
l = f;
|
|
859
|
+
}
|
|
860
|
+
return e;
|
|
861
|
+
}, e;
|
|
862
|
+
}
|
|
863
|
+
function ln() {
|
|
864
|
+
var e = pt();
|
|
865
|
+
return e.copy = function() {
|
|
866
|
+
return ht(e, ln());
|
|
867
|
+
}, ft.apply(e, arguments), Lt(e);
|
|
868
|
+
}
|
|
869
|
+
const de = (e) => e.trim().toUpperCase(), Qe = (e, n, t = {}) => {
|
|
870
|
+
const r = de(n);
|
|
871
|
+
return e.find((i) => {
|
|
872
|
+
const o = i.properties ?? {};
|
|
873
|
+
if ((o.__isoA2 ?? (typeof o.iso_a2 == "string" ? o.iso_a2.toUpperCase() : void 0)) === r) return !0;
|
|
874
|
+
const a = String(o.name ?? "").toLowerCase();
|
|
875
|
+
return t[a] === r;
|
|
876
|
+
});
|
|
877
|
+
}, At = (e) => {
|
|
878
|
+
if (typeof e != "object" || e === null || !("coordinates" in e))
|
|
879
|
+
return [];
|
|
880
|
+
const n = e.coordinates, t = [], r = (i) => {
|
|
881
|
+
if (Array.isArray(i)) {
|
|
882
|
+
if (i.length >= 2 && typeof i[0] == "number" && typeof i[1] == "number") {
|
|
883
|
+
t.push([i[0], i[1]]);
|
|
884
|
+
return;
|
|
885
|
+
}
|
|
886
|
+
i.forEach(r);
|
|
887
|
+
}
|
|
888
|
+
};
|
|
889
|
+
return r(n), t;
|
|
890
|
+
}, en = (e) => {
|
|
891
|
+
const n = At(e.geometry);
|
|
892
|
+
if (!n.length) return;
|
|
893
|
+
const t = n.reduce(
|
|
894
|
+
(r, [i, o]) => ({
|
|
895
|
+
minLat: Math.min(r.minLat, o),
|
|
896
|
+
maxLat: Math.max(r.maxLat, o),
|
|
897
|
+
minLng: Math.min(r.minLng, i),
|
|
898
|
+
maxLng: Math.max(r.maxLng, i)
|
|
899
|
+
}),
|
|
900
|
+
{
|
|
901
|
+
minLat: Number.POSITIVE_INFINITY,
|
|
902
|
+
maxLat: Number.NEGATIVE_INFINITY,
|
|
903
|
+
minLng: Number.POSITIVE_INFINITY,
|
|
904
|
+
maxLng: Number.NEGATIVE_INFINITY
|
|
1984
905
|
}
|
|
906
|
+
);
|
|
907
|
+
if (!(!Number.isFinite(t.minLat) || !Number.isFinite(t.minLng)))
|
|
1985
908
|
return t;
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
const
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
}, mt = (t, e) => {
|
|
1998
|
-
if (!t.length) return () => e.minColor;
|
|
1999
|
-
const n = Math.min(...t), r = Math.max(...t);
|
|
2000
|
-
if (n === r) return () => e.maxColor;
|
|
2001
|
-
const i = kt().domain([n, r]).range([0, 1]), o = Ie(e.minColor, e.maxColor);
|
|
909
|
+
}, nn = (e) => {
|
|
910
|
+
const n = Math.max(0.1, e.maxLat - e.minLat), t = Math.max(0.1, e.maxLng - e.minLng), i = Math.max(n, t) / 112;
|
|
911
|
+
return Math.min(0.9, Math.max(0.14, i));
|
|
912
|
+
}, $e = (e, n) => {
|
|
913
|
+
const t = e?.[n];
|
|
914
|
+
return typeof t == "number" ? t : 0;
|
|
915
|
+
}, tn = (e, n) => {
|
|
916
|
+
if (!e.length) return () => n.minColor;
|
|
917
|
+
const t = Math.min(...e), r = Math.max(...e);
|
|
918
|
+
if (t === r) return () => n.maxColor;
|
|
919
|
+
const i = ln().domain([t, r]).range([0, 1]), o = ke(n.minColor, n.maxColor);
|
|
2002
920
|
return (s) => o(i(s));
|
|
2003
|
-
},
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
921
|
+
}, St = (e) => e <= 1.35 ? 2 : e <= 2.1 ? 1 : 0, Et = (e) => new Intl.NumberFormat("en-US", { maximumFractionDigits: 0 }).format(e), Re = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"), It = (e, n) => {
|
|
922
|
+
let t = e.trim();
|
|
923
|
+
if (!t) return t;
|
|
924
|
+
const r = n?.trim().toUpperCase();
|
|
925
|
+
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();
|
|
926
|
+
}, Ft = (e) => e.replace(/_/g, " ").replace(/\b\w/g, (t) => t.toUpperCase()), jt = /* @__PURE__ */ new Set([
|
|
927
|
+
"countrycode",
|
|
928
|
+
"country_code",
|
|
929
|
+
"iso_a2",
|
|
930
|
+
"iso",
|
|
931
|
+
"adm0_a3",
|
|
932
|
+
"iso_3166_1"
|
|
933
|
+
]), Pt = (e) => jt.has(e.toLowerCase()), Ot = (e, n) => e.toLowerCase() === "revenue" ? new Intl.NumberFormat("en-US", {
|
|
934
|
+
style: "currency",
|
|
935
|
+
currency: "USD",
|
|
936
|
+
notation: "compact",
|
|
937
|
+
maximumFractionDigits: 1
|
|
938
|
+
}).format(n) : Et(n), rn = "cool-globe-float-tooltip-override", zt = () => {
|
|
939
|
+
if (typeof document > "u" || document.getElementById(rn)) return;
|
|
940
|
+
const e = document.createElement("style");
|
|
941
|
+
e.id = rn, e.textContent = `
|
|
942
|
+
.cool-globe-host .float-tooltip-kap {
|
|
943
|
+
background: transparent !important;
|
|
944
|
+
background-color: transparent !important;
|
|
945
|
+
padding: 0 !important;
|
|
946
|
+
border-radius: 0 !important;
|
|
947
|
+
box-shadow: none !important;
|
|
948
|
+
max-width: none !important;
|
|
949
|
+
font-size: inherit !important;
|
|
950
|
+
font-family: inherit !important;
|
|
951
|
+
color: transparent !important;
|
|
952
|
+
}
|
|
953
|
+
`, document.head.appendChild(e);
|
|
954
|
+
}, Dt = ({
|
|
955
|
+
statisticsData: e,
|
|
956
|
+
resetSignal: n,
|
|
957
|
+
preselectedCountry: t,
|
|
958
|
+
countryNumericToIsoMap: r = {},
|
|
959
|
+
countryNameToIsoMap: i = {},
|
|
960
|
+
primaryMetric: o = "visits",
|
|
961
|
+
colorScale: s = Cn
|
|
2010
962
|
}) => {
|
|
2011
|
-
const
|
|
963
|
+
const a = V(null), l = V(null), f = V(void 0), d = V({}), c = V(null), h = V(n), N = V(void 0), [k, L] = G(!1), [w, A] = G(0), [M, J] = G(), [I, U] = G(), [R, re] = G(null), [F, ie] = G([]), [oe, D] = G([]), [g, P] = G({
|
|
2012
964
|
width: 900,
|
|
2013
965
|
height: 760
|
|
2014
|
-
})
|
|
2015
|
-
|
|
2016
|
-
|
|
966
|
+
});
|
|
967
|
+
z(() => {
|
|
968
|
+
zt();
|
|
969
|
+
}, []);
|
|
970
|
+
const _ = se(
|
|
971
|
+
() => Object.values(e.countries).map(
|
|
972
|
+
(u) => $e(u, o)
|
|
2017
973
|
),
|
|
2018
|
-
[
|
|
2019
|
-
),
|
|
2020
|
-
(
|
|
2021
|
-
) : [], [
|
|
2022
|
-
() =>
|
|
2023
|
-
[
|
|
2024
|
-
),
|
|
2025
|
-
() =>
|
|
2026
|
-
[
|
|
974
|
+
[o, e.countries]
|
|
975
|
+
), O = se(() => M ? Object.values(e.regions[M] ?? {}).map(
|
|
976
|
+
(u) => $e(u, o)
|
|
977
|
+
) : [], [M, o, e.regions]), ae = se(
|
|
978
|
+
() => tn(_, s),
|
|
979
|
+
[_, s]
|
|
980
|
+
), K = se(
|
|
981
|
+
() => tn(O, s),
|
|
982
|
+
[O, s]
|
|
2027
983
|
);
|
|
2028
|
-
|
|
984
|
+
z(() => {
|
|
2029
985
|
(async () => {
|
|
2030
|
-
let
|
|
986
|
+
let m = [];
|
|
2031
987
|
try {
|
|
2032
|
-
|
|
988
|
+
m = (await (await fetch(Mn)).json()).features;
|
|
2033
989
|
} catch {
|
|
2034
|
-
const
|
|
2035
|
-
|
|
2036
|
-
|
|
990
|
+
const b = await (await fetch(_n)).json(), p = b.objects.countries, v = vn(
|
|
991
|
+
b,
|
|
992
|
+
p
|
|
2037
993
|
);
|
|
2038
|
-
|
|
994
|
+
m = v.type === "FeatureCollection" ? v.features : [v];
|
|
2039
995
|
}
|
|
2040
|
-
const
|
|
2041
|
-
const
|
|
2042
|
-
|
|
2043
|
-
).trim() || `Country ${
|
|
2044
|
-
|
|
2045
|
-
).trim().toUpperCase(),
|
|
996
|
+
const y = m.map((x) => {
|
|
997
|
+
const b = String(x.id ?? ""), p = x.properties ?? {}, v = String(
|
|
998
|
+
p.name ?? p.NAME ?? p.name_en ?? p.ADMIN ?? ""
|
|
999
|
+
).trim() || `Country ${b}`, q = v.toLowerCase(), T = String(
|
|
1000
|
+
p.iso_a2 ?? p.ISO_A2 ?? p.iso_a2_eh ?? ""
|
|
1001
|
+
).trim().toUpperCase(), we = r[b] ?? i[q] ?? (T && T !== "-99" ? T : void 0) ?? (b.length === 2 ? b.toUpperCase() : b);
|
|
2046
1002
|
return {
|
|
2047
1003
|
...x,
|
|
2048
1004
|
properties: {
|
|
2049
|
-
...
|
|
2050
|
-
__isoA2:
|
|
2051
|
-
name:
|
|
1005
|
+
...p,
|
|
1006
|
+
__isoA2: we,
|
|
1007
|
+
name: v || we || `Country ${b}`
|
|
2052
1008
|
}
|
|
2053
1009
|
};
|
|
2054
1010
|
});
|
|
2055
|
-
|
|
1011
|
+
ie(y);
|
|
2056
1012
|
})();
|
|
2057
|
-
}, []),
|
|
2058
|
-
if (!
|
|
2059
|
-
const
|
|
2060
|
-
const
|
|
2061
|
-
|
|
2062
|
-
width: Math.max(360, Math.floor(
|
|
2063
|
-
height: Math.max(520, Math.floor(
|
|
1013
|
+
}, []), z(() => {
|
|
1014
|
+
if (!l.current) return;
|
|
1015
|
+
const u = new ResizeObserver((m) => {
|
|
1016
|
+
const y = m[0];
|
|
1017
|
+
y && P({
|
|
1018
|
+
width: Math.max(360, Math.floor(y.contentRect.width)),
|
|
1019
|
+
height: Math.max(520, Math.floor(y.contentRect.height))
|
|
2064
1020
|
});
|
|
2065
1021
|
});
|
|
2066
|
-
return
|
|
2067
|
-
}, []),
|
|
2068
|
-
if (!
|
|
2069
|
-
|
|
1022
|
+
return u.observe(l.current), () => u.disconnect();
|
|
1023
|
+
}, []), z(() => {
|
|
1024
|
+
if (!M) {
|
|
1025
|
+
D([]);
|
|
2070
1026
|
return;
|
|
2071
1027
|
}
|
|
2072
|
-
const
|
|
2073
|
-
if (
|
|
2074
|
-
|
|
1028
|
+
const u = d.current[M];
|
|
1029
|
+
if (u) {
|
|
1030
|
+
D(u);
|
|
2075
1031
|
return;
|
|
2076
1032
|
}
|
|
2077
1033
|
(async () => {
|
|
2078
|
-
if (!
|
|
2079
|
-
const
|
|
2080
|
-
|
|
1034
|
+
if (!c.current) {
|
|
1035
|
+
const p = await (await fetch($n)).json();
|
|
1036
|
+
c.current = p.features;
|
|
2081
1037
|
}
|
|
2082
|
-
const x = (
|
|
2083
|
-
(
|
|
2084
|
-
).map((
|
|
2085
|
-
const
|
|
1038
|
+
const x = (c.current ?? []).filter(
|
|
1039
|
+
(b) => (b.properties ?? {}).iso_a2 === M
|
|
1040
|
+
).map((b) => {
|
|
1041
|
+
const p = b.properties ?? {}, v = String(p.name ?? "").trim();
|
|
2086
1042
|
return {
|
|
2087
|
-
...
|
|
1043
|
+
...b,
|
|
2088
1044
|
properties: {
|
|
2089
|
-
...
|
|
2090
|
-
__countryCode:
|
|
2091
|
-
__regionName:
|
|
2092
|
-
name:
|
|
1045
|
+
...p,
|
|
1046
|
+
__countryCode: M,
|
|
1047
|
+
__regionName: v,
|
|
1048
|
+
name: v
|
|
2093
1049
|
}
|
|
2094
1050
|
};
|
|
2095
1051
|
});
|
|
2096
|
-
|
|
1052
|
+
d.current[M] = x, D(x);
|
|
2097
1053
|
})();
|
|
2098
|
-
}, [
|
|
2099
|
-
if (
|
|
2100
|
-
|
|
2101
|
-
}, [
|
|
2102
|
-
const
|
|
2103
|
-
if (!
|
|
2104
|
-
|
|
2105
|
-
const
|
|
2106
|
-
|
|
2107
|
-
}, []),
|
|
2108
|
-
const
|
|
2109
|
-
|
|
2110
|
-
}, [
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
1054
|
+
}, [M]), z(() => {
|
|
1055
|
+
if (I && w < 2) return void A(2);
|
|
1056
|
+
M && w < 1 && A(1);
|
|
1057
|
+
}, [M, I, w]), z(() => {
|
|
1058
|
+
const u = a.current?.controls?.();
|
|
1059
|
+
if (!u) return;
|
|
1060
|
+
u.autoRotate = !0, u.autoRotateSpeed = 0.45, u.enablePan = !1, u.enableZoom = !0;
|
|
1061
|
+
const m = a.current?.renderer?.();
|
|
1062
|
+
m && m.setPixelRatio(Math.min(window.devicePixelRatio, 1.5));
|
|
1063
|
+
}, []), z(() => {
|
|
1064
|
+
const u = a.current?.controls?.();
|
|
1065
|
+
u && (u.autoRotate = !M && w === 0);
|
|
1066
|
+
}, [M, w]);
|
|
1067
|
+
const S = ve((u, m, y) => {
|
|
1068
|
+
a.current?.pointOfView({ lat: u, lng: m, altitude: y }, 650);
|
|
1069
|
+
}, []), H = ve(() => {
|
|
1070
|
+
const u = a.current?.controls?.();
|
|
1071
|
+
u && (u.autoRotate = !1);
|
|
1072
|
+
}, []), $ = ve(
|
|
1073
|
+
(u, m, y) => {
|
|
1074
|
+
const x = de(u);
|
|
1075
|
+
if (!x || (H(), A(1), J(x), U(void 0), y?.focusCamera === !1)) return;
|
|
1076
|
+
const b = m ?? Qe(
|
|
1077
|
+
F,
|
|
1078
|
+
x,
|
|
1079
|
+
i
|
|
1080
|
+
), p = b ? en(b) : void 0;
|
|
1081
|
+
p && S(
|
|
1082
|
+
(p.minLat + p.maxLat) / 2,
|
|
1083
|
+
(p.minLng + p.maxLng) / 2,
|
|
1084
|
+
nn(p)
|
|
1085
|
+
);
|
|
1086
|
+
},
|
|
1087
|
+
[F, i, S, H]
|
|
1088
|
+
);
|
|
1089
|
+
z(() => {
|
|
1090
|
+
if (n === h.current) return;
|
|
1091
|
+
h.current = n, U(void 0), re(null), N.current = void 0;
|
|
1092
|
+
const u = t?.trim() ? de(t) : void 0;
|
|
1093
|
+
if (u) {
|
|
1094
|
+
$(u);
|
|
1095
|
+
return;
|
|
1096
|
+
}
|
|
1097
|
+
A(0), J(void 0), D([]);
|
|
1098
|
+
const m = a.current?.controls?.();
|
|
1099
|
+
m && (m.autoRotate = !0), S(20, 15, 2.6);
|
|
1100
|
+
}, [S, t, n, $]), z(() => {
|
|
1101
|
+
const u = t?.trim() ? de(t) : void 0;
|
|
1102
|
+
if (!u || !k || !F.length) return;
|
|
1103
|
+
const m = `${u}:${String(n ?? "")}`;
|
|
1104
|
+
if (N.current === m) return;
|
|
1105
|
+
const y = Qe(
|
|
1106
|
+
F,
|
|
1107
|
+
u,
|
|
1108
|
+
i
|
|
2153
1109
|
);
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
1110
|
+
$(u, y), N.current = m;
|
|
1111
|
+
}, [
|
|
1112
|
+
F,
|
|
1113
|
+
i,
|
|
1114
|
+
k,
|
|
1115
|
+
t,
|
|
1116
|
+
n,
|
|
1117
|
+
$
|
|
1118
|
+
]);
|
|
1119
|
+
const dn = () => {
|
|
1120
|
+
const u = a.current?.globeMaterial?.();
|
|
1121
|
+
u && (u.map = null, u.color = new Ne("#f5f5f5"), u.emissive = new Ne("#ffffff"), u.emissiveIntensity = 0.35, u.specular = new Ne("#d4d4d8"), u.shininess = 3, u.needsUpdate = !0);
|
|
1122
|
+
}, mn = () => {
|
|
1123
|
+
f.current && window.clearTimeout(f.current), f.current = window.setTimeout(() => {
|
|
1124
|
+
const u = a.current?.pointOfView?.().altitude ?? 2.4, m = St(u);
|
|
1125
|
+
A(m), m <= 0 && U(void 0);
|
|
2163
1126
|
}, 120);
|
|
2164
|
-
},
|
|
2165
|
-
const
|
|
2166
|
-
if (
|
|
2167
|
-
const
|
|
1127
|
+
}, hn = (u) => {
|
|
1128
|
+
const m = u.properties ?? {};
|
|
1129
|
+
if (w === 0) {
|
|
1130
|
+
const y = i[String(m.name ?? "").toLowerCase()], x = m.__isoA2 ?? (typeof m.iso_a2 == "string" ? m.iso_a2.toUpperCase() : void 0) ?? y;
|
|
2168
1131
|
if (!x) return;
|
|
2169
|
-
|
|
2170
|
-
const m = q(h);
|
|
2171
|
-
if (m) {
|
|
2172
|
-
I(
|
|
2173
|
-
(m.minLat + m.maxLat) / 2,
|
|
2174
|
-
(m.minLng + m.maxLng) / 2,
|
|
2175
|
-
z(m)
|
|
2176
|
-
);
|
|
2177
|
-
return;
|
|
2178
|
-
}
|
|
1132
|
+
$(x, u);
|
|
2179
1133
|
return;
|
|
2180
1134
|
}
|
|
2181
|
-
if (
|
|
2182
|
-
const
|
|
2183
|
-
if (!
|
|
2184
|
-
|
|
2185
|
-
const x =
|
|
1135
|
+
if (w >= 1) {
|
|
1136
|
+
const y = m.__regionName;
|
|
1137
|
+
if (!y) return;
|
|
1138
|
+
H(), A(2), U(y);
|
|
1139
|
+
const x = en(u);
|
|
2186
1140
|
if (x) {
|
|
2187
|
-
|
|
1141
|
+
S(
|
|
2188
1142
|
(x.minLat + x.maxLat) / 2,
|
|
2189
1143
|
(x.minLng + x.maxLng) / 2,
|
|
2190
|
-
Math.max(0.2,
|
|
1144
|
+
Math.max(0.2, nn(x) * 0.52)
|
|
2191
1145
|
);
|
|
2192
1146
|
return;
|
|
2193
1147
|
}
|
|
2194
1148
|
}
|
|
2195
|
-
},
|
|
2196
|
-
if (
|
|
2197
|
-
return
|
|
2198
|
-
if (
|
|
2199
|
-
},
|
|
2200
|
-
if (!
|
|
2201
|
-
return
|
|
2202
|
-
const
|
|
2203
|
-
([,
|
|
1149
|
+
}, gn = w === 0 ? F : oe.length ? [...F, ...oe] : F, Pe = (u, m) => {
|
|
1150
|
+
if (m && u)
|
|
1151
|
+
return e.regions[u]?.[m];
|
|
1152
|
+
if (u) return e.countries[u];
|
|
1153
|
+
}, pn = (u) => {
|
|
1154
|
+
if (!u)
|
|
1155
|
+
return '<div style="color:#697386;font-weight:500;font-size:15px;">No data available</div>';
|
|
1156
|
+
const m = Object.entries(u).filter(
|
|
1157
|
+
([p, v]) => !Pt(p) && typeof v == "number" && Number.isFinite(v)
|
|
2204
1158
|
);
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
1159
|
+
if (!m.length)
|
|
1160
|
+
return '<div style="color:#697386;font-weight:500;font-size:15px;">No data available</div>';
|
|
1161
|
+
m.sort(([p], [v]) => p === o ? -1 : v === o ? 1 : p.localeCompare(v));
|
|
1162
|
+
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;", b = "font-weight:600;color:#1A1F36;font-size:15px;font-variant-numeric:tabular-nums;white-space:nowrap;";
|
|
1163
|
+
return m.map(([p, v]) => {
|
|
1164
|
+
const q = Re(Ft(p)), T = Re(
|
|
1165
|
+
Ot(p, v)
|
|
1166
|
+
);
|
|
1167
|
+
return `<div style="${y}"><span style="${x}">${q}</span><span style="${b}">${T}</span></div>`;
|
|
1168
|
+
}).join("");
|
|
2208
1169
|
};
|
|
2209
|
-
return /* @__PURE__ */
|
|
1170
|
+
return /* @__PURE__ */ Oe(
|
|
2210
1171
|
"div",
|
|
2211
1172
|
{
|
|
2212
|
-
ref:
|
|
1173
|
+
ref: l,
|
|
1174
|
+
className: "cool-globe-host",
|
|
2213
1175
|
style: {
|
|
2214
1176
|
position: "relative",
|
|
2215
1177
|
height: "100%",
|
|
2216
1178
|
overflow: "hidden",
|
|
2217
1179
|
background: "white"
|
|
2218
1180
|
},
|
|
2219
|
-
children: /* @__PURE__ */
|
|
2220
|
-
|
|
1181
|
+
children: /* @__PURE__ */ Oe(
|
|
1182
|
+
xn,
|
|
2221
1183
|
{
|
|
2222
|
-
ref:
|
|
2223
|
-
globeImageUrl:
|
|
1184
|
+
ref: a,
|
|
1185
|
+
globeImageUrl: Rn,
|
|
2224
1186
|
backgroundColor: "#ffffff",
|
|
2225
|
-
polygonsData:
|
|
1187
|
+
polygonsData: gn,
|
|
2226
1188
|
polygonAltitude: 0.01,
|
|
2227
1189
|
polygonsTransitionDuration: 180,
|
|
2228
|
-
polygonCapColor: (
|
|
2229
|
-
const
|
|
2230
|
-
if (
|
|
1190
|
+
polygonCapColor: (u) => {
|
|
1191
|
+
const m = u.properties ?? {}, y = !!m.__regionName;
|
|
1192
|
+
if (w > 0 && !y)
|
|
2231
1193
|
return "rgba(148,163,184,0.027)";
|
|
2232
|
-
const x =
|
|
2233
|
-
return
|
|
1194
|
+
const x = w === 0 ? m.__isoA2 : m.__countryCode, b = m.__regionName, p = Pe(x, b), v = $e(p, o), q = w === 0 ? ae(v) : K(v);
|
|
1195
|
+
return R === u ? "#60a5fa" : q;
|
|
2234
1196
|
},
|
|
2235
|
-
polygonSideColor: (
|
|
2236
|
-
const
|
|
2237
|
-
return
|
|
1197
|
+
polygonSideColor: (u) => {
|
|
1198
|
+
const m = u.properties ?? {};
|
|
1199
|
+
return w > 0 && !m.__regionName ? "rgba(148,163,184,0.027)" : m.__regionName ? "rgba(148,163,184,0.22)" : "rgba(226,232,240,0.45)";
|
|
2238
1200
|
},
|
|
2239
|
-
polygonStrokeColor: (
|
|
2240
|
-
const
|
|
2241
|
-
return
|
|
1201
|
+
polygonStrokeColor: (u) => {
|
|
1202
|
+
const m = u.properties ?? {};
|
|
1203
|
+
return w > 0 && !m.__regionName ? "rgba(100,116,139,0.067)" : m.__regionName ? "rgba(51,65,85,0.98)" : "rgba(156,163,175,0.95)";
|
|
2242
1204
|
},
|
|
2243
|
-
polygonLabel: (
|
|
2244
|
-
const
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
1205
|
+
polygonLabel: (u) => {
|
|
1206
|
+
const m = u.properties ?? {};
|
|
1207
|
+
if (w > 0 && !m.__regionName)
|
|
1208
|
+
return "";
|
|
1209
|
+
const y = w === 0 ? m.__isoA2 : m.__countryCode, x = m.__regionName, b = x ?? m.name ?? "Unknown", p = w === 0 ? m.__isoA2 : m.__countryCode ?? m.__isoA2, v = It(
|
|
1210
|
+
String(b),
|
|
1211
|
+
p
|
|
1212
|
+
), q = Pe(y, x), T = pn(q);
|
|
1213
|
+
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);">
|
|
1214
|
+
<div style="font-size:17px;font-weight:600;color:#1A1F36;line-height:1.25;margin-bottom:4px;">${Re(v)}</div>
|
|
1215
|
+
<div style="margin-top:8px;">${T}</div>
|
|
2248
1216
|
</div>`;
|
|
2249
1217
|
},
|
|
2250
|
-
onPolygonHover: (
|
|
2251
|
-
|
|
1218
|
+
onPolygonHover: (u) => {
|
|
1219
|
+
re(u ?? null);
|
|
2252
1220
|
},
|
|
2253
|
-
onPolygonClick: (
|
|
2254
|
-
onZoom:
|
|
1221
|
+
onPolygonClick: (u) => hn(u),
|
|
1222
|
+
onZoom: mn,
|
|
2255
1223
|
onGlobeReady: () => {
|
|
2256
|
-
|
|
1224
|
+
dn(), L(!0), t?.trim() || S(20, 15, 2.6);
|
|
2257
1225
|
},
|
|
2258
1226
|
onGlobeClick: () => {
|
|
2259
|
-
const
|
|
2260
|
-
|
|
1227
|
+
const u = a.current?.controls?.();
|
|
1228
|
+
u && (u.autoRotate = !1);
|
|
2261
1229
|
},
|
|
2262
1230
|
lineHoverPrecision: 0,
|
|
2263
|
-
width:
|
|
2264
|
-
height:
|
|
1231
|
+
width: g.width,
|
|
1232
|
+
height: g.height,
|
|
2265
1233
|
showAtmosphere: !1
|
|
2266
1234
|
}
|
|
2267
1235
|
)
|
|
@@ -2269,5 +1237,5 @@ const De = (t, e) => {
|
|
|
2269
1237
|
);
|
|
2270
1238
|
};
|
|
2271
1239
|
export {
|
|
2272
|
-
|
|
1240
|
+
Dt as CoolGlobe
|
|
2273
1241
|
};
|