@undp/data-viz 1.5.6 → 1.5.7
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/dist/ThreeDGlobe.cjs +1 -1
- package/dist/ThreeDGlobe.cjs.map +1 -1
- package/dist/ThreeDGlobe.js +284 -349
- package/dist/ThreeDGlobe.js.map +1 -1
- package/dist/getCentroidCoordinates-Dfk6IqEG.js +70 -0
- package/dist/getCentroidCoordinates-Dfk6IqEG.js.map +1 -0
- package/dist/getCentroidCoordinates-DxTBqzp2.cjs +2 -0
- package/dist/getCentroidCoordinates-DxTBqzp2.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.js +34 -32
- package/dist/index.js.map +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.d.ts +8 -0
- package/dist/utils.js +16 -14
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
package/dist/ThreeDGlobe.js
CHANGED
|
@@ -1,263 +1,198 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { y as
|
|
4
|
-
import
|
|
5
|
-
import { i as
|
|
6
|
-
import * as
|
|
7
|
-
import { X as
|
|
8
|
-
import { u as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { o as
|
|
15
|
-
import { t as
|
|
16
|
-
import { GraphHeader as
|
|
17
|
-
import { GraphFooter as
|
|
18
|
-
import { f as
|
|
19
|
-
import { Colors as
|
|
20
|
-
import { g as
|
|
21
|
-
import { g as
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
e,
|
|
25
|
-
(t, n) => t + Ge(n),
|
|
26
|
-
0
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
function Ge(e) {
|
|
30
|
-
let t = 0, n;
|
|
31
|
-
switch (e.type) {
|
|
32
|
-
case "Polygon":
|
|
33
|
-
return xe(e.coordinates);
|
|
34
|
-
case "MultiPolygon":
|
|
35
|
-
for (n = 0; n < e.coordinates.length; n++)
|
|
36
|
-
t += xe(e.coordinates[n]);
|
|
37
|
-
return t;
|
|
38
|
-
case "Point":
|
|
39
|
-
case "MultiPoint":
|
|
40
|
-
case "LineString":
|
|
41
|
-
case "MultiLineString":
|
|
42
|
-
return 0;
|
|
43
|
-
}
|
|
44
|
-
return 0;
|
|
45
|
-
}
|
|
46
|
-
function xe(e) {
|
|
47
|
-
let t = 0;
|
|
48
|
-
if (e && e.length > 0) {
|
|
49
|
-
t += Math.abs(ve(e[0]));
|
|
50
|
-
for (let n = 1; n < e.length; n++)
|
|
51
|
-
t -= Math.abs(ve(e[n]));
|
|
52
|
-
}
|
|
53
|
-
return t;
|
|
54
|
-
}
|
|
55
|
-
var Fe = ye * ye / 2, he = Math.PI / 180;
|
|
56
|
-
function ve(e) {
|
|
57
|
-
const t = e.length - 1;
|
|
58
|
-
if (t <= 2) return 0;
|
|
59
|
-
let n = 0, c = 0;
|
|
60
|
-
for (; c < t; ) {
|
|
61
|
-
const v = e[c], y = e[c + 1 === t ? 0 : c + 1], m = e[c + 2 >= t ? (c + 2) % t : c + 2], l = v[0] * he, p = y[1] * he, T = m[0] * he;
|
|
62
|
-
n += (T - l) * Math.sin(p), c++;
|
|
63
|
-
}
|
|
64
|
-
return n * Fe;
|
|
65
|
-
}
|
|
66
|
-
var Be = _e;
|
|
67
|
-
function Ue(e) {
|
|
68
|
-
if (e.geometry.type === "Polygon")
|
|
69
|
-
return fe(e);
|
|
70
|
-
if (e.geometry.type === "MultiPolygon") {
|
|
71
|
-
let t = 0, n = null;
|
|
72
|
-
for (const c of e.geometry.coordinates) {
|
|
73
|
-
const v = {
|
|
74
|
-
type: "Feature",
|
|
75
|
-
geometry: {
|
|
76
|
-
type: "Polygon",
|
|
77
|
-
coordinates: c
|
|
78
|
-
},
|
|
79
|
-
properties: {}
|
|
80
|
-
}, y = Be(v);
|
|
81
|
-
y > t && (t = y, n = v);
|
|
82
|
-
}
|
|
83
|
-
return fe(n);
|
|
84
|
-
}
|
|
85
|
-
throw new Error("Unsupported geometry type");
|
|
86
|
-
}
|
|
87
|
-
function We(e) {
|
|
88
|
-
let t;
|
|
1
|
+
import { j as r, m as xe } from "./index-CHPV5EwG-BPSP-7Jg.js";
|
|
2
|
+
import { useState as N, useRef as ge, useEffect as D, useCallback as me } from "react";
|
|
3
|
+
import { y as ve } from "./Spinner-C85UF28E.js";
|
|
4
|
+
import we from "react-globe.gl";
|
|
5
|
+
import { i as be } from "./index-Bwrro8-q.js";
|
|
6
|
+
import * as P from "three";
|
|
7
|
+
import { X as Ce } from "./Modal-DVVwpKhP.js";
|
|
8
|
+
import { u as ue } from "./Typography-Ctgfl1J5.js";
|
|
9
|
+
import { T as je } from "./Tooltip-CVCGWyzw.js";
|
|
10
|
+
import { n as ke } from "./numberFormattingFunction-14YCbkN2.js";
|
|
11
|
+
import { X as Se } from "./index-BmCqpO1B.js";
|
|
12
|
+
import { s as De } from "./string2HTML-oFCROsus.js";
|
|
13
|
+
import { g as Ne } from "./getCentroidCoordinates-Dfk6IqEG.js";
|
|
14
|
+
import { o as Le } from "./ordinal-w9Lu4Stb.js";
|
|
15
|
+
import { t as Me } from "./threshold-DFfqcDMa.js";
|
|
16
|
+
import { GraphHeader as ze } from "./GraphHeader.js";
|
|
17
|
+
import { GraphFooter as Oe } from "./GraphFooter.js";
|
|
18
|
+
import { f as Pe } from "./fetchAndParseData-sapWbnYk.js";
|
|
19
|
+
import { Colors as A } from "./Colors.js";
|
|
20
|
+
import { g as Re } from "./getUniqValue-DiCh_MOD.js";
|
|
21
|
+
import { g as Te } from "./getJenks-BbngDoBQ.js";
|
|
22
|
+
function Ee(e) {
|
|
23
|
+
let a;
|
|
89
24
|
switch (e.type) {
|
|
90
25
|
case "ambient":
|
|
91
|
-
|
|
26
|
+
a = new P.AmbientLight(e.color, e.intensity);
|
|
92
27
|
break;
|
|
93
28
|
case "directional":
|
|
94
|
-
|
|
29
|
+
a = new P.DirectionalLight(e.color, e.intensity), e.position && (e.position === "camera" ? a.position.set(0, 0, 0) : a.position.set(e.position.x, e.position.y, e.position.z)), (e.target || e.position === "camera") && a.target.position.set(
|
|
95
30
|
e.target?.x || 0,
|
|
96
31
|
e.target?.y || 0,
|
|
97
32
|
e.target?.z === void 0 ? -1 : e.target.z
|
|
98
|
-
), e.castShadow && (
|
|
33
|
+
), e.castShadow && (a.castShadow = !0, e.shadow && (a.shadow.mapSize.width = e.shadow.mapSize.width, a.shadow.mapSize.height = e.shadow.mapSize.height, a.shadow.camera.near = e.shadow.camera.near, a.shadow.camera.far = e.shadow.camera.far));
|
|
99
34
|
break;
|
|
100
35
|
case "point":
|
|
101
|
-
|
|
36
|
+
a = new P.PointLight(
|
|
102
37
|
e.color,
|
|
103
38
|
e.intensity,
|
|
104
39
|
e.distance || 0,
|
|
105
40
|
e.decay || 2
|
|
106
|
-
), e.position && (e.position === "camera" ?
|
|
41
|
+
), e.position && (e.position === "camera" ? a.position.set(0, 0, 0) : a.position.set(e.position.x, e.position.y, e.position.z));
|
|
107
42
|
break;
|
|
108
43
|
case "spot":
|
|
109
|
-
|
|
44
|
+
a = new P.SpotLight(
|
|
110
45
|
e.color,
|
|
111
46
|
e.intensity,
|
|
112
47
|
e.distance || 0,
|
|
113
48
|
e.angle || Math.PI / 3,
|
|
114
49
|
e.penumbra || 0,
|
|
115
50
|
e.decay || 2
|
|
116
|
-
), e.position && (e.position === "camera" ?
|
|
51
|
+
), e.position && (e.position === "camera" ? a.position.set(0, 0, 0) : a.position.set(e.position.x, e.position.y, e.position.z)), (e.target || e.position === "camera") && a.target.position.set(
|
|
117
52
|
e.target?.x || 0,
|
|
118
53
|
e.target?.y || 0,
|
|
119
54
|
e.target?.z || 0
|
|
120
|
-
), e.castShadow && (
|
|
55
|
+
), e.castShadow && (a.castShadow = !0, e.shadow && (a.shadow.mapSize.width = e.shadow.mapSize.width, a.shadow.mapSize.height = e.shadow.mapSize.height, a.shadow.camera.near = e.shadow.camera.near, a.shadow.camera.far = e.shadow.camera.far));
|
|
121
56
|
break;
|
|
122
57
|
default:
|
|
123
58
|
throw new Error("Unknown light type");
|
|
124
59
|
}
|
|
125
|
-
return
|
|
60
|
+
return a;
|
|
126
61
|
}
|
|
127
|
-
function
|
|
62
|
+
function Ae(e) {
|
|
128
63
|
const {
|
|
129
|
-
width:
|
|
130
|
-
autoRotate:
|
|
131
|
-
data:
|
|
132
|
-
enableZoom:
|
|
133
|
-
categorical:
|
|
134
|
-
colorDomain:
|
|
64
|
+
width: a,
|
|
65
|
+
autoRotate: x,
|
|
66
|
+
data: v,
|
|
67
|
+
enableZoom: H,
|
|
68
|
+
categorical: R,
|
|
69
|
+
colorDomain: h,
|
|
135
70
|
colors: l,
|
|
136
|
-
globeMaterial:
|
|
137
|
-
height:
|
|
138
|
-
polygonData:
|
|
139
|
-
mapProperty:
|
|
140
|
-
mapBorderColor:
|
|
141
|
-
atmosphereColor:
|
|
142
|
-
tooltip:
|
|
143
|
-
styles:
|
|
71
|
+
globeMaterial: c,
|
|
72
|
+
height: V,
|
|
73
|
+
polygonData: $,
|
|
74
|
+
mapProperty: d,
|
|
75
|
+
mapBorderColor: F,
|
|
76
|
+
atmosphereColor: X,
|
|
77
|
+
tooltip: Z,
|
|
78
|
+
styles: C,
|
|
144
79
|
classNames: re,
|
|
145
|
-
mapNoDataColor:
|
|
80
|
+
mapNoDataColor: u,
|
|
146
81
|
colorLegendTitle: G,
|
|
147
82
|
showColorScale: oe,
|
|
148
83
|
hoverStrokeColor: ae,
|
|
149
|
-
detailsOnClick:
|
|
150
|
-
onSeriesMouseClick:
|
|
151
|
-
onSeriesMouseOver:
|
|
152
|
-
resetSelectionOnDoubleClick:
|
|
153
|
-
highlightedIds:
|
|
154
|
-
scale:
|
|
155
|
-
globeOffset:
|
|
156
|
-
polygonAltitude:
|
|
84
|
+
detailsOnClick: w,
|
|
85
|
+
onSeriesMouseClick: L,
|
|
86
|
+
onSeriesMouseOver: y,
|
|
87
|
+
resetSelectionOnDoubleClick: T,
|
|
88
|
+
highlightedIds: J,
|
|
89
|
+
scale: g,
|
|
90
|
+
globeOffset: j,
|
|
91
|
+
polygonAltitude: I,
|
|
157
92
|
centerLng: B,
|
|
158
93
|
centerLat: U,
|
|
159
|
-
atmosphereAltitude:
|
|
94
|
+
atmosphereAltitude: _,
|
|
160
95
|
globeCurvatureResolution: ie,
|
|
161
|
-
fogSettings:
|
|
162
|
-
lights:
|
|
96
|
+
fogSettings: M,
|
|
97
|
+
lights: z,
|
|
163
98
|
highlightedAltitude: Y,
|
|
164
|
-
selectedId:
|
|
165
|
-
} = e, [K, se] =
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}, [
|
|
169
|
-
|
|
170
|
-
}, [
|
|
171
|
-
if (
|
|
172
|
-
const
|
|
173
|
-
(
|
|
174
|
-
), [
|
|
175
|
-
|
|
99
|
+
selectedId: f
|
|
100
|
+
} = e, [K, se] = N(!1), n = ge(void 0), [k, E] = N(void 0), [ne, Q] = N(!(a < 680)), [ee, le] = N({ x: 0, y: 0 }), [S, de] = N(void 0), W = R ? Le().domain(h).range(l) : Me().domain(h).range(l);
|
|
101
|
+
D(() => {
|
|
102
|
+
n.current && (n.current.controls().enableZoom = H);
|
|
103
|
+
}, [H]), D(() => {
|
|
104
|
+
n.current && (S || f ? n.current.controls().autoRotate = !1 : (n.current.controls().autoRotate = x !== 0, n.current.controls().autoRotateSpeed = x));
|
|
105
|
+
}, [S, f, x]), D(() => {
|
|
106
|
+
if (n.current && f) {
|
|
107
|
+
const t = $.find(
|
|
108
|
+
(m) => m.properties[d] === f
|
|
109
|
+
), [o, s] = Ne(t);
|
|
110
|
+
n.current.pointOfView({ lat: s, lng: o, altitude: g }, 1e3);
|
|
176
111
|
}
|
|
177
|
-
}, [
|
|
178
|
-
const
|
|
179
|
-
if (!
|
|
180
|
-
const
|
|
112
|
+
}, [f, g, $, d]), D(() => {
|
|
113
|
+
const t = n.current?.renderer().domElement;
|
|
114
|
+
if (!t) return;
|
|
115
|
+
const o = (s) => {
|
|
181
116
|
le({ x: s.clientX, y: s.clientY });
|
|
182
117
|
};
|
|
183
|
-
return
|
|
184
|
-
}, []),
|
|
185
|
-
|
|
186
|
-
}, [
|
|
187
|
-
const
|
|
118
|
+
return t.addEventListener("mousemove", o), () => t.removeEventListener("mousemove", o);
|
|
119
|
+
}, []), D(() => {
|
|
120
|
+
n.current && n.current.pointOfView({ lat: U, lng: B, altitude: g }, 1e3);
|
|
121
|
+
}, [g, B, U]);
|
|
122
|
+
const q = c || new P.MeshBasicMaterial({
|
|
188
123
|
color: "#FFF"
|
|
189
|
-
}),
|
|
190
|
-
if (!
|
|
191
|
-
const
|
|
124
|
+
}), p = me(() => {
|
|
125
|
+
if (!n.current) return;
|
|
126
|
+
const t = n.current.scene(), o = n.current.camera();
|
|
192
127
|
let s = [];
|
|
193
|
-
|
|
194
|
-
i instanceof
|
|
195
|
-
}), s = [...s, ...
|
|
196
|
-
|
|
197
|
-
}),
|
|
198
|
-
}, [
|
|
199
|
-
se(!0),
|
|
200
|
-
}, [
|
|
201
|
-
return
|
|
202
|
-
K &&
|
|
203
|
-
}, [K,
|
|
204
|
-
/* @__PURE__ */
|
|
205
|
-
|
|
128
|
+
t.traverse((i) => {
|
|
129
|
+
i instanceof P.Light && s.push(i);
|
|
130
|
+
}), s = [...s, ...o.children], s.forEach((i) => i.parent?.remove(i)), z.map((i) => Ee(i)).forEach((i, b) => {
|
|
131
|
+
z[b].type !== "ambient" && z[b].position === "camera" ? (o.add(i), z[b].type !== "point" && o.add(i.target)) : t.add(i);
|
|
132
|
+
}), M && (t.fog = new P.Fog(M.color, M.near, M.far));
|
|
133
|
+
}, [z, M]), te = me(() => {
|
|
134
|
+
se(!0), p();
|
|
135
|
+
}, [p]);
|
|
136
|
+
return D(() => {
|
|
137
|
+
K && p();
|
|
138
|
+
}, [K, p]), /* @__PURE__ */ r.jsxs("div", { className: "relative", children: [
|
|
139
|
+
/* @__PURE__ */ r.jsx(
|
|
140
|
+
we,
|
|
206
141
|
{
|
|
207
|
-
ref:
|
|
208
|
-
height:
|
|
209
|
-
width:
|
|
210
|
-
globeOffset:
|
|
142
|
+
ref: n,
|
|
143
|
+
height: V,
|
|
144
|
+
width: a,
|
|
145
|
+
globeOffset: j,
|
|
211
146
|
lineHoverPrecision: 0,
|
|
212
|
-
polygonsData:
|
|
213
|
-
polygonAltitude: (
|
|
214
|
-
polygonCapColor: (
|
|
215
|
-
const
|
|
216
|
-
return s != null ? W(s) :
|
|
147
|
+
polygonsData: $,
|
|
148
|
+
polygonAltitude: (t) => J.includes(t?.properties?.[d]) || t?.properties?.[d] === f ? Y * (t?.properties?.[d] === f ? 2 : 1) : t?.properties?.[d] === S?.id || t?.properties?.[d] === k?.id ? Y : I,
|
|
149
|
+
polygonCapColor: (t) => {
|
|
150
|
+
const o = t?.properties?.[d], s = v.find((m) => m.id === o)?.x;
|
|
151
|
+
return s != null ? W(s) : u;
|
|
217
152
|
},
|
|
218
|
-
polygonSideColor: (
|
|
219
|
-
const
|
|
220
|
-
return
|
|
153
|
+
polygonSideColor: (t) => {
|
|
154
|
+
const o = t?.properties?.[d], s = v.find((i) => i.id === o)?.x, m = s != null ? W(s) : u;
|
|
155
|
+
return J.includes(t?.properties?.[d]) || t?.properties?.[d] === f ? m : "rgba(100,100,100,0)";
|
|
221
156
|
},
|
|
222
|
-
polygonStrokeColor: (
|
|
157
|
+
polygonStrokeColor: (t) => t?.properties?.[d] === S?.id ? ae : F,
|
|
223
158
|
onGlobeClick: () => {
|
|
224
|
-
|
|
159
|
+
E(void 0);
|
|
225
160
|
},
|
|
226
|
-
onPolygonClick: (
|
|
227
|
-
const
|
|
228
|
-
(
|
|
161
|
+
onPolygonClick: (t) => {
|
|
162
|
+
const o = t?.properties?.[d] ? v.find((s) => s.id === t?.properties?.[d]) : void 0;
|
|
163
|
+
(L || w) && (be(k, o) && T && o ? (E(void 0), L?.(void 0)) : (E(o), L?.(o)));
|
|
229
164
|
},
|
|
230
|
-
onPolygonHover: (
|
|
231
|
-
const
|
|
232
|
-
de(
|
|
165
|
+
onPolygonHover: (t) => {
|
|
166
|
+
const o = t?.properties?.[d] ? v.find((s) => s.id === t?.properties?.[d]) : void 0;
|
|
167
|
+
de(o), y?.(o);
|
|
233
168
|
},
|
|
234
|
-
atmosphereColor:
|
|
235
|
-
atmosphereAltitude:
|
|
169
|
+
atmosphereColor: X,
|
|
170
|
+
atmosphereAltitude: _,
|
|
236
171
|
globeCurvatureResolution: ie,
|
|
237
|
-
globeMaterial:
|
|
172
|
+
globeMaterial: q,
|
|
238
173
|
backgroundColor: "rgba(0, 0, 0, 0)",
|
|
239
174
|
polygonsTransitionDuration: 100,
|
|
240
175
|
onGlobeReady: () => {
|
|
241
|
-
if (
|
|
242
|
-
|
|
176
|
+
if (n.current) {
|
|
177
|
+
n.current.pointOfView({
|
|
243
178
|
lat: U,
|
|
244
179
|
lng: B
|
|
245
180
|
});
|
|
246
|
-
const
|
|
181
|
+
const t = n.current.scene();
|
|
247
182
|
setTimeout(() => {
|
|
248
|
-
(
|
|
249
|
-
const i =
|
|
183
|
+
(t.children[3]?.children[0]?.children[4]?.children || []).forEach((m) => {
|
|
184
|
+
const i = m.children[1];
|
|
250
185
|
i.renderOrder = 2;
|
|
251
186
|
});
|
|
252
187
|
}, 300);
|
|
253
|
-
const
|
|
254
|
-
|
|
188
|
+
const o = n.current.camera();
|
|
189
|
+
t.add(o), te();
|
|
255
190
|
}
|
|
256
191
|
}
|
|
257
192
|
}
|
|
258
193
|
),
|
|
259
|
-
oe === !1 ? null : /* @__PURE__ */
|
|
260
|
-
/* @__PURE__ */
|
|
194
|
+
oe === !1 ? null : /* @__PURE__ */ r.jsx("div", { className: "absolute left-4 bottom-4", children: ne ? /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
195
|
+
/* @__PURE__ */ r.jsx(
|
|
261
196
|
"div",
|
|
262
197
|
{
|
|
263
198
|
style: {
|
|
@@ -276,20 +211,20 @@ function Xe(e) {
|
|
|
276
211
|
onClick: () => {
|
|
277
212
|
Q(!1);
|
|
278
213
|
},
|
|
279
|
-
children: /* @__PURE__ */
|
|
214
|
+
children: /* @__PURE__ */ r.jsx(Se, {})
|
|
280
215
|
}
|
|
281
216
|
),
|
|
282
|
-
/* @__PURE__ */
|
|
217
|
+
/* @__PURE__ */ r.jsxs(
|
|
283
218
|
"div",
|
|
284
219
|
{
|
|
285
220
|
className: "p-2",
|
|
286
221
|
style: {
|
|
287
222
|
backgroundColor: "rgba(240,240,240, 0.7)",
|
|
288
|
-
width:
|
|
223
|
+
width: R ? void 0 : "340px"
|
|
289
224
|
},
|
|
290
225
|
children: [
|
|
291
|
-
G && G !== "" ? /* @__PURE__ */
|
|
292
|
-
|
|
226
|
+
G && G !== "" ? /* @__PURE__ */ r.jsx(
|
|
227
|
+
ue,
|
|
293
228
|
{
|
|
294
229
|
size: "xs",
|
|
295
230
|
marginBottom: "xs",
|
|
@@ -302,51 +237,51 @@ function Xe(e) {
|
|
|
302
237
|
children: G
|
|
303
238
|
}
|
|
304
239
|
) : null,
|
|
305
|
-
|
|
306
|
-
/* @__PURE__ */
|
|
240
|
+
R ? /* @__PURE__ */ r.jsx("div", { className: "flex flex-col gap-3", children: h.map((t, o) => /* @__PURE__ */ r.jsxs("div", { className: "flex gap-2 items-center", children: [
|
|
241
|
+
/* @__PURE__ */ r.jsx(
|
|
307
242
|
"div",
|
|
308
243
|
{
|
|
309
244
|
className: "w-2 h-2 rounded-full",
|
|
310
|
-
style: { backgroundColor: l[
|
|
245
|
+
style: { backgroundColor: l[o % l.length] }
|
|
311
246
|
}
|
|
312
247
|
),
|
|
313
|
-
/* @__PURE__ */
|
|
314
|
-
] },
|
|
315
|
-
|
|
316
|
-
/* @__PURE__ */
|
|
248
|
+
/* @__PURE__ */ r.jsx(ue, { size: "sm", marginBottom: "none", leading: "none", children: t })
|
|
249
|
+
] }, o)) }) : /* @__PURE__ */ r.jsx("svg", { width: "100%", viewBox: "0 0 320 30", direction: "ltr", children: /* @__PURE__ */ r.jsxs("g", { children: [
|
|
250
|
+
h.map((t, o) => /* @__PURE__ */ r.jsxs("g", { className: "cursor-pointer", children: [
|
|
251
|
+
/* @__PURE__ */ r.jsx(
|
|
317
252
|
"rect",
|
|
318
253
|
{
|
|
319
|
-
x:
|
|
254
|
+
x: o * 320 / l.length + 1,
|
|
320
255
|
y: 1,
|
|
321
256
|
width: 320 / l.length - 2,
|
|
322
257
|
height: 8,
|
|
323
258
|
style: {
|
|
324
|
-
fill: l[
|
|
325
|
-
stroke: l[
|
|
259
|
+
fill: l[o],
|
|
260
|
+
stroke: l[o]
|
|
326
261
|
}
|
|
327
262
|
}
|
|
328
263
|
),
|
|
329
|
-
/* @__PURE__ */
|
|
264
|
+
/* @__PURE__ */ r.jsx(
|
|
330
265
|
"text",
|
|
331
266
|
{
|
|
332
|
-
x: (
|
|
267
|
+
x: (o + 1) * 320 / l.length,
|
|
333
268
|
y: 25,
|
|
334
269
|
className: "fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",
|
|
335
270
|
style: { textAnchor: "middle" },
|
|
336
|
-
children:
|
|
271
|
+
children: ke(t, "NA")
|
|
337
272
|
}
|
|
338
273
|
)
|
|
339
|
-
] },
|
|
340
|
-
/* @__PURE__ */
|
|
274
|
+
] }, o)),
|
|
275
|
+
/* @__PURE__ */ r.jsx("g", { children: /* @__PURE__ */ r.jsx(
|
|
341
276
|
"rect",
|
|
342
277
|
{
|
|
343
|
-
x:
|
|
278
|
+
x: h.length * 320 / l.length + 1,
|
|
344
279
|
y: 1,
|
|
345
280
|
width: 320 / l.length - 2,
|
|
346
281
|
height: 8,
|
|
347
282
|
style: {
|
|
348
|
-
fill: l[
|
|
349
|
-
stroke: l[
|
|
283
|
+
fill: l[h.length],
|
|
284
|
+
stroke: l[h.length]
|
|
350
285
|
}
|
|
351
286
|
}
|
|
352
287
|
) })
|
|
@@ -354,7 +289,7 @@ function Xe(e) {
|
|
|
354
289
|
]
|
|
355
290
|
}
|
|
356
291
|
)
|
|
357
|
-
] }) : /* @__PURE__ */
|
|
292
|
+
] }) : /* @__PURE__ */ r.jsx(
|
|
358
293
|
"button",
|
|
359
294
|
{
|
|
360
295
|
type: "button",
|
|
@@ -362,87 +297,87 @@ function Xe(e) {
|
|
|
362
297
|
onClick: () => {
|
|
363
298
|
Q(!0);
|
|
364
299
|
},
|
|
365
|
-
children: /* @__PURE__ */
|
|
300
|
+
children: /* @__PURE__ */ r.jsx("div", { className: "items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500", children: "Show Legend" })
|
|
366
301
|
}
|
|
367
302
|
) }),
|
|
368
|
-
|
|
369
|
-
|
|
303
|
+
S && Z ? /* @__PURE__ */ r.jsx(
|
|
304
|
+
je,
|
|
370
305
|
{
|
|
371
|
-
data:
|
|
372
|
-
body:
|
|
306
|
+
data: S,
|
|
307
|
+
body: Z,
|
|
373
308
|
xPos: ee.x,
|
|
374
309
|
yPos: ee.y,
|
|
375
|
-
backgroundStyle:
|
|
310
|
+
backgroundStyle: C?.tooltip,
|
|
376
311
|
className: re?.tooltip
|
|
377
312
|
}
|
|
378
313
|
) : null,
|
|
379
|
-
|
|
380
|
-
|
|
314
|
+
w && k !== void 0 ? /* @__PURE__ */ r.jsx(
|
|
315
|
+
Ce,
|
|
381
316
|
{
|
|
382
|
-
open:
|
|
317
|
+
open: k !== void 0,
|
|
383
318
|
onClose: () => {
|
|
384
|
-
|
|
319
|
+
E(void 0);
|
|
385
320
|
},
|
|
386
|
-
children: /* @__PURE__ */
|
|
321
|
+
children: /* @__PURE__ */ r.jsx(
|
|
387
322
|
"div",
|
|
388
323
|
{
|
|
389
324
|
className: "graph-modal-content m-0",
|
|
390
|
-
dangerouslySetInnerHTML: typeof
|
|
391
|
-
children: typeof
|
|
325
|
+
dangerouslySetInnerHTML: typeof w == "string" ? { __html: De(w, k) } : void 0,
|
|
326
|
+
children: typeof w == "function" ? w(k) : null
|
|
392
327
|
}
|
|
393
328
|
)
|
|
394
329
|
}
|
|
395
330
|
) : null
|
|
396
331
|
] });
|
|
397
332
|
}
|
|
398
|
-
function
|
|
333
|
+
function ot(e) {
|
|
399
334
|
const {
|
|
400
|
-
data:
|
|
401
|
-
mapData:
|
|
402
|
-
graphTitle:
|
|
403
|
-
colors:
|
|
404
|
-
sources:
|
|
405
|
-
graphDescription:
|
|
335
|
+
data: a,
|
|
336
|
+
mapData: x = "https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-simplified.json",
|
|
337
|
+
graphTitle: v,
|
|
338
|
+
colors: H,
|
|
339
|
+
sources: R,
|
|
340
|
+
graphDescription: h,
|
|
406
341
|
height: l,
|
|
407
|
-
width:
|
|
408
|
-
footNote:
|
|
409
|
-
colorDomain:
|
|
410
|
-
colorLegendTitle:
|
|
411
|
-
scaleType:
|
|
412
|
-
padding:
|
|
413
|
-
mapNoDataColor:
|
|
414
|
-
backgroundColor:
|
|
415
|
-
mapBorderColor: re =
|
|
416
|
-
relativeHeight:
|
|
342
|
+
width: c,
|
|
343
|
+
footNote: V = "The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.",
|
|
344
|
+
colorDomain: $,
|
|
345
|
+
colorLegendTitle: d,
|
|
346
|
+
scaleType: F = "threshold",
|
|
347
|
+
padding: X,
|
|
348
|
+
mapNoDataColor: Z = A.light.graphNoData,
|
|
349
|
+
backgroundColor: C = !1,
|
|
350
|
+
mapBorderColor: re = A.light.grays["gray-500"],
|
|
351
|
+
relativeHeight: u,
|
|
417
352
|
tooltip: G,
|
|
418
353
|
graphID: oe,
|
|
419
354
|
mapProperty: ae = "ISO3",
|
|
420
|
-
dataDownload:
|
|
421
|
-
language:
|
|
422
|
-
minHeight:
|
|
423
|
-
theme:
|
|
424
|
-
ariaLabel:
|
|
425
|
-
styles:
|
|
426
|
-
classNames:
|
|
427
|
-
autoRotate:
|
|
355
|
+
dataDownload: w = !1,
|
|
356
|
+
language: L = "en",
|
|
357
|
+
minHeight: y = 0,
|
|
358
|
+
theme: T = "light",
|
|
359
|
+
ariaLabel: J,
|
|
360
|
+
styles: g,
|
|
361
|
+
classNames: j,
|
|
362
|
+
autoRotate: I = !0,
|
|
428
363
|
enableZoom: B = !0,
|
|
429
364
|
globeMaterial: U,
|
|
430
|
-
centerPoint:
|
|
365
|
+
centerPoint: _ = [0, 0],
|
|
431
366
|
atmosphereColor: ie = "#999",
|
|
432
|
-
showColorScale:
|
|
433
|
-
resetSelectionOnDoubleClick:
|
|
367
|
+
showColorScale: M = !0,
|
|
368
|
+
resetSelectionOnDoubleClick: z = !0,
|
|
434
369
|
detailsOnClick: Y,
|
|
435
|
-
onSeriesMouseOver:
|
|
370
|
+
onSeriesMouseOver: f,
|
|
436
371
|
onSeriesMouseClick: K,
|
|
437
372
|
highlightedIds: se = [],
|
|
438
|
-
highlightedAltitude:
|
|
439
|
-
scale:
|
|
440
|
-
globeOffset:
|
|
373
|
+
highlightedAltitude: n = 0.1,
|
|
374
|
+
scale: k = 1,
|
|
375
|
+
globeOffset: E = [0, 0],
|
|
441
376
|
polygonAltitude: ne = 0.01,
|
|
442
377
|
globeCurvatureResolution: Q = 4,
|
|
443
378
|
atmosphereAltitude: ee = 0.15,
|
|
444
379
|
fogSettings: le,
|
|
445
|
-
lights:
|
|
380
|
+
lights: S = [
|
|
446
381
|
{
|
|
447
382
|
type: "ambient",
|
|
448
383
|
color: 4210752,
|
|
@@ -456,154 +391,154 @@ function mt(e) {
|
|
|
456
391
|
}
|
|
457
392
|
],
|
|
458
393
|
selectedId: de
|
|
459
|
-
} = e, [W,
|
|
460
|
-
|
|
461
|
-
const i = new ResizeObserver((
|
|
462
|
-
te(
|
|
394
|
+
} = e, [W, q] = N(void 0), [p, te] = N(0), [t, o] = N(0), s = ge(null);
|
|
395
|
+
D(() => {
|
|
396
|
+
const i = new ResizeObserver((b) => {
|
|
397
|
+
te(c || b[0].target.clientWidth || 760), o(l || b[0].target.clientHeight || 480);
|
|
463
398
|
});
|
|
464
|
-
return s.current && (
|
|
465
|
-
}, [
|
|
466
|
-
typeof
|
|
467
|
-
if (
|
|
468
|
-
const
|
|
469
|
-
if (
|
|
470
|
-
const ce = [...
|
|
471
|
-
return { ...
|
|
399
|
+
return s.current && (o(s.current.clientHeight || 480), te(s.current.clientWidth || 760), c || i.observe(s.current)), () => i.disconnect();
|
|
400
|
+
}, [c, l]), D(() => {
|
|
401
|
+
typeof x == "string" ? Pe(x).then((b) => {
|
|
402
|
+
if (x === "https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-simplified.json") {
|
|
403
|
+
const ye = b.features.map((O) => {
|
|
404
|
+
if (O.geometry.type === "Polygon") {
|
|
405
|
+
const ce = [...O.geometry.coordinates[0]].reverse(), pe = { ...O.geometry, coordinates: [ce] };
|
|
406
|
+
return { ...O, geometry: pe };
|
|
472
407
|
}
|
|
473
|
-
const
|
|
474
|
-
|
|
408
|
+
const he = [];
|
|
409
|
+
O.geometry.coordinates.forEach((ce) => {
|
|
475
410
|
const pe = [...ce[0]].reverse();
|
|
476
|
-
|
|
411
|
+
he.push([pe]);
|
|
477
412
|
});
|
|
478
|
-
const
|
|
479
|
-
return { ...
|
|
413
|
+
const fe = { ...O.geometry, coordinates: he };
|
|
414
|
+
return { ...O, geometry: fe };
|
|
480
415
|
});
|
|
481
|
-
|
|
482
|
-
} else
|
|
483
|
-
}) :
|
|
484
|
-
}, [
|
|
485
|
-
const
|
|
486
|
-
|
|
487
|
-
|
|
416
|
+
q(ye);
|
|
417
|
+
} else q(b.features);
|
|
418
|
+
}) : q(x.features);
|
|
419
|
+
}, [x]);
|
|
420
|
+
const m = $ || (F === "categorical" ? Re(a, "x") : Te(
|
|
421
|
+
a.map((i) => i.x),
|
|
422
|
+
H?.length || 4
|
|
488
423
|
));
|
|
489
|
-
return /* @__PURE__ */
|
|
424
|
+
return /* @__PURE__ */ r.jsx(
|
|
490
425
|
"div",
|
|
491
426
|
{
|
|
492
|
-
className: `${
|
|
493
|
-
dir:
|
|
494
|
-
children: /* @__PURE__ */
|
|
427
|
+
className: `${T || "light"} flex ${c ? "w-fit grow-0" : "w-full grow"}`,
|
|
428
|
+
dir: L === "he" || L === "ar" ? "rtl" : void 0,
|
|
429
|
+
children: /* @__PURE__ */ r.jsx(
|
|
495
430
|
"div",
|
|
496
431
|
{
|
|
497
|
-
className:
|
|
498
|
-
`${
|
|
499
|
-
|
|
500
|
-
|
|
432
|
+
className: xe(
|
|
433
|
+
`${C ? C === !0 ? "bg-primary-gray-200 dark:bg-primary-gray-650 " : "" : "bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${L || "en"}`,
|
|
434
|
+
c ? "w-fit" : "w-full",
|
|
435
|
+
j?.graphContainer
|
|
501
436
|
),
|
|
502
437
|
style: {
|
|
503
|
-
...
|
|
504
|
-
...
|
|
438
|
+
...g?.graphContainer || {},
|
|
439
|
+
...C && C !== !0 ? { backgroundColor: C } : {}
|
|
505
440
|
},
|
|
506
441
|
id: oe,
|
|
507
|
-
"aria-label":
|
|
508
|
-
children: /* @__PURE__ */
|
|
442
|
+
"aria-label": J || `${v ? `The graph shows ${v}. ` : ""}This is a map.${h ? ` ${h}` : ""}`,
|
|
443
|
+
children: /* @__PURE__ */ r.jsx(
|
|
509
444
|
"div",
|
|
510
445
|
{
|
|
511
446
|
className: "flex grow",
|
|
512
|
-
style: { padding:
|
|
513
|
-
children: /* @__PURE__ */
|
|
514
|
-
|
|
515
|
-
|
|
447
|
+
style: { padding: C ? X || "1rem" : X || 0 },
|
|
448
|
+
children: /* @__PURE__ */ r.jsxs("div", { className: "flex flex-col w-full gap-4 grow justify-between", children: [
|
|
449
|
+
v || h || w ? /* @__PURE__ */ r.jsx(
|
|
450
|
+
ze,
|
|
516
451
|
{
|
|
517
452
|
styles: {
|
|
518
|
-
title:
|
|
519
|
-
description:
|
|
453
|
+
title: g?.title,
|
|
454
|
+
description: g?.description
|
|
520
455
|
},
|
|
521
456
|
classNames: {
|
|
522
|
-
title:
|
|
523
|
-
description:
|
|
457
|
+
title: j?.title,
|
|
458
|
+
description: j?.description
|
|
524
459
|
},
|
|
525
|
-
graphTitle:
|
|
526
|
-
graphDescription:
|
|
527
|
-
width:
|
|
460
|
+
graphTitle: v,
|
|
461
|
+
graphDescription: h,
|
|
462
|
+
width: c,
|
|
528
463
|
graphDownload: void 0,
|
|
529
|
-
dataDownload:
|
|
464
|
+
dataDownload: w ? a.map((i) => i.data).filter((i) => i !== void 0).length > 0 ? a.map((i) => i.data).filter((i) => i !== void 0) : a.filter((i) => i !== void 0) : null
|
|
530
465
|
}
|
|
531
466
|
) : null,
|
|
532
|
-
/* @__PURE__ */
|
|
467
|
+
/* @__PURE__ */ r.jsx(
|
|
533
468
|
"div",
|
|
534
469
|
{
|
|
535
470
|
className: "flex flex-col grow justify-center leading-0",
|
|
536
471
|
ref: s,
|
|
537
472
|
"aria-label": "Map area",
|
|
538
|
-
children: (
|
|
539
|
-
|
|
473
|
+
children: (c || p) && (l || t) && W ? /* @__PURE__ */ r.jsx(
|
|
474
|
+
Ae,
|
|
540
475
|
{
|
|
541
|
-
data:
|
|
542
|
-
globeOffset:
|
|
476
|
+
data: a,
|
|
477
|
+
globeOffset: E,
|
|
543
478
|
polygonData: W,
|
|
544
|
-
colorDomain:
|
|
545
|
-
width:
|
|
479
|
+
colorDomain: m,
|
|
480
|
+
width: c || p,
|
|
546
481
|
height: Math.max(
|
|
547
|
-
|
|
548
|
-
l || (
|
|
482
|
+
y,
|
|
483
|
+
l || (u ? y ? (c || p) * u > y ? (c || p) * u : y : (c || p) * u : t)
|
|
549
484
|
),
|
|
550
|
-
colors:
|
|
551
|
-
mapNoDataColor:
|
|
552
|
-
categorical:
|
|
485
|
+
colors: H || (F === "categorical" ? A[T].sequentialColors[`neutralColorsx0${m.length}`] : A[T].sequentialColors[`neutralColorsx0${m.length + 1}`]),
|
|
486
|
+
mapNoDataColor: Z,
|
|
487
|
+
categorical: F === "categorical",
|
|
553
488
|
mapBorderColor: re,
|
|
554
489
|
tooltip: G,
|
|
555
490
|
mapProperty: ae,
|
|
556
|
-
styles:
|
|
557
|
-
classNames:
|
|
558
|
-
autoRotate:
|
|
491
|
+
styles: g,
|
|
492
|
+
classNames: j,
|
|
493
|
+
autoRotate: I === !0 ? 1.5 : I === !1 ? 0 : I,
|
|
559
494
|
enableZoom: B,
|
|
560
495
|
globeMaterial: U,
|
|
561
496
|
atmosphereColor: ie,
|
|
562
|
-
colorLegendTitle:
|
|
563
|
-
showColorScale:
|
|
564
|
-
hoverStrokeColor:
|
|
497
|
+
colorLegendTitle: d,
|
|
498
|
+
showColorScale: M,
|
|
499
|
+
hoverStrokeColor: T === "light" ? A.light.grays["gray-700"] : A.light.grays["gray-300"],
|
|
565
500
|
highlightedIds: se,
|
|
566
|
-
resetSelectionOnDoubleClick:
|
|
501
|
+
resetSelectionOnDoubleClick: z,
|
|
567
502
|
detailsOnClick: Y,
|
|
568
|
-
onSeriesMouseOver:
|
|
503
|
+
onSeriesMouseOver: f,
|
|
569
504
|
onSeriesMouseClick: K,
|
|
570
|
-
scale:
|
|
505
|
+
scale: k,
|
|
571
506
|
polygonAltitude: ne,
|
|
572
|
-
centerLat:
|
|
573
|
-
centerLng:
|
|
507
|
+
centerLat: _[0],
|
|
508
|
+
centerLng: _[1],
|
|
574
509
|
atmosphereAltitude: ee,
|
|
575
510
|
globeCurvatureResolution: Q,
|
|
576
511
|
fogSettings: le,
|
|
577
|
-
lights:
|
|
578
|
-
highlightedAltitude:
|
|
512
|
+
lights: S,
|
|
513
|
+
highlightedAltitude: n,
|
|
579
514
|
selectedId: de
|
|
580
515
|
}
|
|
581
|
-
) : /* @__PURE__ */
|
|
516
|
+
) : /* @__PURE__ */ r.jsx(
|
|
582
517
|
"div",
|
|
583
518
|
{
|
|
584
519
|
style: {
|
|
585
520
|
height: `${Math.max(
|
|
586
|
-
|
|
587
|
-
l || (
|
|
521
|
+
y,
|
|
522
|
+
l || (u ? y ? (c || p) * u > y ? (c || p) * u : y : (c || p) * u : t)
|
|
588
523
|
)}px`
|
|
589
524
|
},
|
|
590
525
|
className: "flex items-center justify-center",
|
|
591
|
-
children: /* @__PURE__ */
|
|
526
|
+
children: /* @__PURE__ */ r.jsx(ve, { "aria-label": "Loading graph" })
|
|
592
527
|
}
|
|
593
528
|
)
|
|
594
529
|
}
|
|
595
530
|
),
|
|
596
|
-
|
|
597
|
-
|
|
531
|
+
R || V ? /* @__PURE__ */ r.jsx(
|
|
532
|
+
Oe,
|
|
598
533
|
{
|
|
599
|
-
styles: { footnote:
|
|
534
|
+
styles: { footnote: g?.footnote, source: g?.source },
|
|
600
535
|
classNames: {
|
|
601
|
-
footnote:
|
|
602
|
-
source:
|
|
536
|
+
footnote: j?.footnote,
|
|
537
|
+
source: j?.source
|
|
603
538
|
},
|
|
604
|
-
sources:
|
|
605
|
-
footNote:
|
|
606
|
-
width:
|
|
539
|
+
sources: R,
|
|
540
|
+
footNote: V,
|
|
541
|
+
width: c
|
|
607
542
|
}
|
|
608
543
|
) : null
|
|
609
544
|
] })
|
|
@@ -615,6 +550,6 @@ function mt(e) {
|
|
|
615
550
|
);
|
|
616
551
|
}
|
|
617
552
|
export {
|
|
618
|
-
|
|
553
|
+
ot as ThreeDGlobe
|
|
619
554
|
};
|
|
620
555
|
//# sourceMappingURL=ThreeDGlobe.js.map
|