ethiopia-map 0.1.6 → 0.1.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/ethiopia-map.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as mM, useRef as $, useCallback as GM, useEffect as q, useMemo as
|
|
1
|
+
import { jsx as g, jsxs as R } from "react/jsx-runtime";
|
|
2
|
+
import { useState as mM, useRef as $, useCallback as GM, useEffect as q, useMemo as XM, useContext as ZL, createContext as aL, forwardRef as EL, useImperativeHandle as GL } from "react";
|
|
3
3
|
const bL = [
|
|
4
4
|
"afar",
|
|
5
5
|
"tigray",
|
|
@@ -38,101 +38,101 @@ function sL({
|
|
|
38
38
|
data: N,
|
|
39
39
|
serviceStats: L = {},
|
|
40
40
|
locations: j = [],
|
|
41
|
-
selectedRegionId:
|
|
41
|
+
selectedRegionId: u,
|
|
42
42
|
defaultSelectedRegionId: I = null,
|
|
43
|
-
onRegionSelect:
|
|
44
|
-
theme:
|
|
43
|
+
onRegionSelect: S,
|
|
44
|
+
theme: z = "light",
|
|
45
45
|
era: D,
|
|
46
46
|
year: Q,
|
|
47
47
|
layer: t,
|
|
48
|
-
defaultLayer:
|
|
49
|
-
onLayerChange:
|
|
50
|
-
viewMode:
|
|
51
|
-
selectionAnimation:
|
|
48
|
+
defaultLayer: T = "regions",
|
|
49
|
+
onLayerChange: c,
|
|
50
|
+
viewMode: G = "map",
|
|
51
|
+
selectionAnimation: y = "pulse",
|
|
52
52
|
showLabels: e = !0,
|
|
53
53
|
showMarkers: H = !1,
|
|
54
|
-
showInMapStats:
|
|
55
|
-
autoTour:
|
|
56
|
-
autoTourSequence:
|
|
57
|
-
autoTourIntervalMs:
|
|
58
|
-
regionColors:
|
|
54
|
+
showInMapStats: DM = !0,
|
|
55
|
+
autoTour: J = !1,
|
|
56
|
+
autoTourSequence: l = bL,
|
|
57
|
+
autoTourIntervalMs: o = 3200,
|
|
58
|
+
regionColors: i = {}
|
|
59
59
|
}) {
|
|
60
|
-
const [
|
|
61
|
-
(
|
|
62
|
-
|
|
63
|
-
regionId:
|
|
64
|
-
region:
|
|
60
|
+
const [h, wM] = mM(I), [b, B] = mM(T), m = $(0), zM = u !== void 0, a = t !== void 0, MM = zM ? u : h, LM = a ? t : b, gM = MM ? N[MM] : null, f = GM(
|
|
61
|
+
(V) => {
|
|
62
|
+
zM || wM(V), S == null || S({
|
|
63
|
+
regionId: V,
|
|
64
|
+
region: V ? N[V] : null
|
|
65
65
|
});
|
|
66
66
|
},
|
|
67
|
-
[
|
|
68
|
-
),
|
|
69
|
-
(
|
|
70
|
-
|
|
67
|
+
[zM, N, S]
|
|
68
|
+
), CM = GM(
|
|
69
|
+
(V) => {
|
|
70
|
+
a || B(V), c == null || c(V);
|
|
71
71
|
},
|
|
72
|
-
[
|
|
72
|
+
[a, c]
|
|
73
73
|
);
|
|
74
74
|
q(() => {
|
|
75
|
-
if (!
|
|
75
|
+
if (!J || l.length === 0) {
|
|
76
76
|
m.current = 0;
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
|
-
const
|
|
80
|
-
const Y =
|
|
81
|
-
m.current = (m.current + 1) %
|
|
79
|
+
const V = () => {
|
|
80
|
+
const Y = l[m.current] ?? null;
|
|
81
|
+
m.current = (m.current + 1) % l.length, f(Y);
|
|
82
82
|
};
|
|
83
|
-
m.current = 0,
|
|
84
|
-
const
|
|
83
|
+
m.current = 0, V();
|
|
84
|
+
const TM = window.setInterval(V, o);
|
|
85
85
|
return () => {
|
|
86
|
-
window.clearInterval(
|
|
86
|
+
window.clearInterval(TM);
|
|
87
87
|
};
|
|
88
|
-
}, [
|
|
89
|
-
const F =
|
|
88
|
+
}, [J, o, l, f]);
|
|
89
|
+
const F = XM(
|
|
90
90
|
() => ({
|
|
91
91
|
data: N,
|
|
92
92
|
serviceStats: L,
|
|
93
93
|
locations: j,
|
|
94
|
-
regionColors:
|
|
95
|
-
selectedRegionId:
|
|
94
|
+
regionColors: i,
|
|
95
|
+
selectedRegionId: MM ?? null,
|
|
96
96
|
selectedRegion: gM,
|
|
97
97
|
selectRegion: f,
|
|
98
|
-
setLayer:
|
|
99
|
-
theme:
|
|
98
|
+
setLayer: CM,
|
|
99
|
+
theme: z,
|
|
100
100
|
era: D,
|
|
101
101
|
year: Q,
|
|
102
|
-
layer:
|
|
103
|
-
viewMode:
|
|
104
|
-
selectionAnimation:
|
|
102
|
+
layer: LM,
|
|
103
|
+
viewMode: G,
|
|
104
|
+
selectionAnimation: y,
|
|
105
105
|
showLabels: e,
|
|
106
106
|
showMarkers: H,
|
|
107
|
-
showInMapStats:
|
|
108
|
-
autoTour:
|
|
109
|
-
autoTourSequence:
|
|
110
|
-
autoTourIntervalMs:
|
|
107
|
+
showInMapStats: DM,
|
|
108
|
+
autoTour: J,
|
|
109
|
+
autoTourSequence: l,
|
|
110
|
+
autoTourIntervalMs: o
|
|
111
111
|
}),
|
|
112
112
|
[
|
|
113
113
|
N,
|
|
114
114
|
L,
|
|
115
115
|
j,
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
i,
|
|
117
|
+
MM,
|
|
118
118
|
gM,
|
|
119
119
|
f,
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
CM,
|
|
121
|
+
z,
|
|
122
122
|
D,
|
|
123
123
|
Q,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
LM,
|
|
125
|
+
G,
|
|
126
|
+
y,
|
|
127
127
|
e,
|
|
128
128
|
H,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
DM,
|
|
130
|
+
J,
|
|
131
|
+
l,
|
|
132
|
+
o
|
|
133
133
|
]
|
|
134
134
|
);
|
|
135
|
-
return /* @__PURE__ */
|
|
135
|
+
return /* @__PURE__ */ g(xL.Provider, { value: F, children: M });
|
|
136
136
|
}
|
|
137
137
|
function bM() {
|
|
138
138
|
const M = ZL(xL);
|
|
@@ -144,7 +144,7 @@ function yN({
|
|
|
144
144
|
children: M,
|
|
145
145
|
...N
|
|
146
146
|
}) {
|
|
147
|
-
return /* @__PURE__ */
|
|
147
|
+
return /* @__PURE__ */ g(sL, { ...N, children: M });
|
|
148
148
|
}
|
|
149
149
|
const LL = [
|
|
150
150
|
{ id: "addis-ababa", svgId: "path331", altSvgId: "ET-AA" },
|
|
@@ -166,16 +166,16 @@ const LL = [
|
|
|
166
166
|
function AL(M) {
|
|
167
167
|
return Math.max(...Object.values(M).map((N) => N.value), 1);
|
|
168
168
|
}
|
|
169
|
-
function
|
|
169
|
+
function pM(M, N, L) {
|
|
170
170
|
const j = L[M] || N[M].color;
|
|
171
171
|
if (j) return j;
|
|
172
|
-
const
|
|
173
|
-
return `hsl(158 ${24 +
|
|
172
|
+
const u = N[M].value / AL(N), I = 84 - u * 36;
|
|
173
|
+
return `hsl(158 ${24 + u * 20}% ${I}%)`;
|
|
174
174
|
}
|
|
175
175
|
function pL(M, N) {
|
|
176
|
-
return N === "percent" ? `${M}%` : Math.abs(M) >= 1e4 ?
|
|
176
|
+
return N === "percent" ? `${M}%` : Math.abs(M) >= 1e4 ? vM(M) : new Intl.NumberFormat().format(M);
|
|
177
177
|
}
|
|
178
|
-
function
|
|
178
|
+
function vM(M) {
|
|
179
179
|
return M == null || M === "" ? "--" : typeof M != "number" ? String(M) : new Intl.NumberFormat("en", {
|
|
180
180
|
notation: Math.abs(M) >= 1e4 ? "compact" : "standard",
|
|
181
181
|
maximumFractionDigits: (Math.abs(M) >= 1e4, 1)
|
|
@@ -213,116 +213,133 @@ function tL({
|
|
|
213
213
|
style: N,
|
|
214
214
|
listClassName: L,
|
|
215
215
|
listStyle: j,
|
|
216
|
-
title:
|
|
216
|
+
title: u = "Select a region",
|
|
217
217
|
kicker: I = "Regional services",
|
|
218
|
-
regionName:
|
|
219
|
-
regionValue:
|
|
218
|
+
regionName: S,
|
|
219
|
+
regionValue: z,
|
|
220
220
|
services: D = _L,
|
|
221
221
|
emptyText: Q = "No regional indicators were found for this region.",
|
|
222
222
|
variant: t = "card",
|
|
223
|
-
incrementalRows:
|
|
224
|
-
getBarPercent:
|
|
223
|
+
incrementalRows: T,
|
|
224
|
+
getBarPercent: c,
|
|
225
|
+
onClose: G
|
|
225
226
|
}) {
|
|
226
|
-
const
|
|
227
|
-
() => MN(
|
|
227
|
+
const y = XM(
|
|
228
|
+
() => MN(T, t),
|
|
228
229
|
[
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
230
|
+
T == null ? void 0 : T.enabled,
|
|
231
|
+
T == null ? void 0 : T.initialCount,
|
|
232
|
+
T == null ? void 0 : T.step,
|
|
233
|
+
T == null ? void 0 : T.thresholdPx,
|
|
234
|
+
T == null ? void 0 : T.showMoreFallback,
|
|
235
|
+
T == null ? void 0 : T.animateNewRows,
|
|
236
|
+
T == null ? void 0 : T.rowAnimationDelayMs,
|
|
237
|
+
T == null ? void 0 : T.rowAnimationDurationMs,
|
|
238
|
+
T == null ? void 0 : T.sentinelVisible,
|
|
238
239
|
t
|
|
239
240
|
]
|
|
240
|
-
),
|
|
241
|
+
), e = XM(
|
|
241
242
|
() => Math.max(...D.map((Y) => Y.value), 1),
|
|
242
243
|
[D]
|
|
243
|
-
),
|
|
244
|
-
() =>
|
|
244
|
+
), H = $(null), DM = $(null), J = $(0), [l, o] = mM(
|
|
245
|
+
() => y.enabled ? Math.min(y.initialCount, D.length) : D.length
|
|
245
246
|
);
|
|
246
247
|
q(() => {
|
|
247
|
-
|
|
248
|
-
|
|
248
|
+
o(
|
|
249
|
+
y.enabled ? Math.min(y.initialCount, D.length) : D.length
|
|
249
250
|
);
|
|
250
|
-
}, [
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
251
|
+
}, [
|
|
252
|
+
y.enabled,
|
|
253
|
+
y.initialCount,
|
|
254
|
+
D,
|
|
255
|
+
D.length,
|
|
256
|
+
S
|
|
257
|
+
]);
|
|
258
|
+
const i = GM(() => {
|
|
259
|
+
y.enabled && o(
|
|
260
|
+
(Y) => Math.min(D.length, Y + y.step)
|
|
254
261
|
);
|
|
255
|
-
}, [
|
|
262
|
+
}, [y.enabled, y.step, D.length]), h = GM(
|
|
256
263
|
(Y) => {
|
|
257
|
-
const
|
|
258
|
-
return (
|
|
264
|
+
const NM = DM.current;
|
|
265
|
+
return (NM ? NM.offsetTop - Y.scrollTop - Y.clientHeight : Y.scrollHeight - Y.scrollTop - Y.clientHeight) <= y.thresholdPx;
|
|
259
266
|
},
|
|
260
|
-
[
|
|
261
|
-
),
|
|
267
|
+
[y.thresholdPx]
|
|
268
|
+
), wM = GM(
|
|
262
269
|
(Y) => {
|
|
263
|
-
!
|
|
270
|
+
!y.enabled || l >= D.length || h(Y.currentTarget) && i();
|
|
264
271
|
},
|
|
265
272
|
[
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
273
|
+
i,
|
|
274
|
+
y.enabled,
|
|
275
|
+
h,
|
|
269
276
|
D.length,
|
|
270
|
-
|
|
277
|
+
l
|
|
271
278
|
]
|
|
272
|
-
),
|
|
279
|
+
), b = GM(
|
|
273
280
|
(Y) => {
|
|
274
|
-
const
|
|
275
|
-
if (!
|
|
281
|
+
const NM = H.current;
|
|
282
|
+
if (!y.enabled || Y.deltaY <= 0 || l >= D.length || !NM || !h(NM))
|
|
276
283
|
return;
|
|
277
284
|
const yM = Date.now();
|
|
278
|
-
yM -
|
|
285
|
+
yM - J.current < $L || (J.current = yM, i());
|
|
279
286
|
},
|
|
280
287
|
[
|
|
281
|
-
|
|
282
|
-
|
|
288
|
+
i,
|
|
289
|
+
y.enabled,
|
|
283
290
|
D.length,
|
|
284
|
-
|
|
285
|
-
|
|
291
|
+
h,
|
|
292
|
+
l
|
|
286
293
|
]
|
|
287
|
-
),
|
|
288
|
-
return /* @__PURE__ */
|
|
294
|
+
), B = y.enabled ? D.slice(0, l) : D, m = y.enabled && l < D.length, zM = S || u, a = t === "overlay", MM = t === "overlay" ? ZM("map-stat-overlay", "visible", M) : ZM("ethiopia-map-panel", "ethiopia-region-services", M), LM = t === "overlay" ? "map-stat-heading" : "ethiopia-map-panel-heading", gM = t === "overlay" ? "map-stat-list" : "ethiopia-service-list", f = t === "overlay" ? "map-stat-row" : "ethiopia-service-row", CM = t === "overlay" ? "map-stat-copy" : "ethiopia-service-copy", F = t === "overlay" ? "map-stat-comparison" : "ethiopia-service-comparison", V = t === "overlay" ? "map-stat-empty" : "ethiopia-empty-state", TM = t === "overlay" ? "map-stat-show-more" : "ethiopia-service-show-more";
|
|
295
|
+
return /* @__PURE__ */ R(
|
|
289
296
|
"section",
|
|
290
297
|
{
|
|
291
|
-
className:
|
|
298
|
+
className: MM,
|
|
292
299
|
style: N,
|
|
293
|
-
onWheel:
|
|
300
|
+
onWheel: y.enabled ? b : void 0,
|
|
294
301
|
children: [
|
|
295
|
-
/* @__PURE__ */
|
|
296
|
-
/* @__PURE__ */
|
|
297
|
-
/* @__PURE__ */
|
|
298
|
-
/* @__PURE__ */
|
|
302
|
+
/* @__PURE__ */ R("div", { className: LM, children: [
|
|
303
|
+
/* @__PURE__ */ R("div", { children: [
|
|
304
|
+
/* @__PURE__ */ g("p", { className: "ethiopia-map-kicker", children: I }),
|
|
305
|
+
/* @__PURE__ */ g("h2", { children: zM })
|
|
299
306
|
] }),
|
|
300
|
-
/* @__PURE__ */
|
|
307
|
+
/* @__PURE__ */ g("div", { className: "ethiopia-panel-heading-actions", children: G ? /* @__PURE__ */ g(
|
|
308
|
+
"button",
|
|
309
|
+
{
|
|
310
|
+
type: "button",
|
|
311
|
+
className: "ethiopia-panel-close-btn",
|
|
312
|
+
onClick: G,
|
|
313
|
+
"aria-label": "Close panel",
|
|
314
|
+
title: "Close selection",
|
|
315
|
+
children: "✕"
|
|
316
|
+
}
|
|
317
|
+
) : null })
|
|
301
318
|
] }),
|
|
302
|
-
D.length === 0 ? /* @__PURE__ */
|
|
319
|
+
D.length === 0 ? /* @__PURE__ */ g("div", { className: V, children: Q }) : /* @__PURE__ */ R(
|
|
303
320
|
"div",
|
|
304
321
|
{
|
|
305
|
-
ref:
|
|
322
|
+
ref: H,
|
|
306
323
|
className: ZM(gM, L),
|
|
307
324
|
style: j,
|
|
308
|
-
tabIndex:
|
|
309
|
-
onScroll:
|
|
325
|
+
tabIndex: y.enabled ? 0 : void 0,
|
|
326
|
+
onScroll: y.enabled ? wM : void 0,
|
|
310
327
|
children: [
|
|
311
|
-
|
|
328
|
+
B.map((Y, NM) => {
|
|
312
329
|
var eM;
|
|
313
|
-
const yM =
|
|
314
|
-
"--delay":
|
|
315
|
-
"--row-animation-duration": `${
|
|
330
|
+
const yM = y.enabled ? NM % y.step : NM, HM = (c == null ? void 0 : c(Y)) ?? Math.max(5, Math.round(Y.value / e * 100)), QM = a ? {
|
|
331
|
+
"--delay": y.animateNewRows ? `${Math.min(yM, 18) * y.rowAnimationDelayMs}ms` : "0ms",
|
|
332
|
+
"--row-animation-duration": `${y.rowAnimationDurationMs}ms`
|
|
316
333
|
} : void 0;
|
|
317
|
-
return /* @__PURE__ */
|
|
318
|
-
/* @__PURE__ */
|
|
319
|
-
/* @__PURE__ */
|
|
320
|
-
/* @__PURE__ */
|
|
334
|
+
return /* @__PURE__ */ R("div", { className: f, style: QM, children: [
|
|
335
|
+
/* @__PURE__ */ R("div", { className: CM, children: [
|
|
336
|
+
/* @__PURE__ */ g("span", { children: Y.label }),
|
|
337
|
+
/* @__PURE__ */ R("strong", { children: [
|
|
321
338
|
pL(Y.value, Y.valueKind),
|
|
322
339
|
Y.unit ? ` ${Y.unit}` : ""
|
|
323
340
|
] })
|
|
324
341
|
] }),
|
|
325
|
-
(eM = Y.comparison) != null && eM.enabled ? /* @__PURE__ */
|
|
342
|
+
(eM = Y.comparison) != null && eM.enabled ? /* @__PURE__ */ R(
|
|
326
343
|
"div",
|
|
327
344
|
{
|
|
328
345
|
className: ZM(
|
|
@@ -330,8 +347,8 @@ function tL({
|
|
|
330
347
|
Y.comparison.outcome
|
|
331
348
|
),
|
|
332
349
|
children: [
|
|
333
|
-
/* @__PURE__ */
|
|
334
|
-
/* @__PURE__ */
|
|
350
|
+
/* @__PURE__ */ g("span", { children: Y.comparison.outcome }),
|
|
351
|
+
/* @__PURE__ */ R("strong", { children: [
|
|
335
352
|
Y.comparison.direction === "decrease" ? "-" : "+",
|
|
336
353
|
Y.comparison.percent,
|
|
337
354
|
"% vs ",
|
|
@@ -340,26 +357,26 @@ function tL({
|
|
|
340
357
|
]
|
|
341
358
|
}
|
|
342
359
|
) : null,
|
|
343
|
-
|
|
360
|
+
a ? /* @__PURE__ */ g("div", { className: "map-stat-bar", "aria-hidden": "true", children: /* @__PURE__ */ g("i", { style: { width: `${HM}%` } }) }) : null
|
|
344
361
|
] }, Y.label);
|
|
345
362
|
}),
|
|
346
|
-
|
|
363
|
+
m ? /* @__PURE__ */ g(
|
|
347
364
|
"div",
|
|
348
365
|
{
|
|
349
|
-
ref:
|
|
366
|
+
ref: DM,
|
|
350
367
|
className: ZM(
|
|
351
368
|
t === "overlay" ? "map-stat-scroll-sentinel" : "ethiopia-service-scroll-sentinel",
|
|
352
|
-
|
|
369
|
+
y.sentinelVisible ? "visible" : "hidden"
|
|
353
370
|
),
|
|
354
|
-
children:
|
|
371
|
+
children: y.sentinelVisible ? /* @__PURE__ */ g("span", { children: "More indicators" }) : null
|
|
355
372
|
}
|
|
356
373
|
) : null,
|
|
357
|
-
|
|
374
|
+
m && y.showMoreFallback ? /* @__PURE__ */ g(
|
|
358
375
|
"button",
|
|
359
376
|
{
|
|
360
|
-
className:
|
|
377
|
+
className: TM,
|
|
361
378
|
type: "button",
|
|
362
|
-
onClick:
|
|
379
|
+
onClick: i,
|
|
363
380
|
children: "Show more"
|
|
364
381
|
}
|
|
365
382
|
) : null
|
|
@@ -385,14 +402,14 @@ function wL(M, N) {
|
|
|
385
402
|
const L = cL(M, N);
|
|
386
403
|
return L === "11-region" ? XL : L === "12-region" ? VL : L === "13-region" ? hL : jL;
|
|
387
404
|
}
|
|
388
|
-
const CL = [],
|
|
405
|
+
const CL = [], FM = {
|
|
389
406
|
scale: 1.095,
|
|
390
407
|
offsetX: 28,
|
|
391
408
|
offsetY: 24
|
|
392
409
|
};
|
|
393
410
|
function _(M) {
|
|
394
|
-
const [N, L, j,
|
|
395
|
-
return { x: N, y: L, width: j, height:
|
|
411
|
+
const [N, L, j, u] = M.split(/\s+/).map(Number);
|
|
412
|
+
return { x: N, y: L, width: j, height: u };
|
|
396
413
|
}
|
|
397
414
|
function YM(M) {
|
|
398
415
|
return `${M.x} ${M.y} ${M.width} ${M.height}`;
|
|
@@ -407,23 +424,23 @@ function TL(M) {
|
|
|
407
424
|
};
|
|
408
425
|
}
|
|
409
426
|
function YL(M, N) {
|
|
410
|
-
const L = _(p), j = TL(M),
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
),
|
|
427
|
+
const L = _(p), j = TL(M), u = TL(N), I = Math.hypot(
|
|
428
|
+
u.x - j.x,
|
|
429
|
+
u.y - j.y
|
|
430
|
+
), S = Math.hypot(L.width, L.height), z = S ? I / S : 0, D = Math.max(
|
|
414
431
|
M.width / N.width,
|
|
415
432
|
N.width / M.width
|
|
416
433
|
), Q = Math.max(
|
|
417
434
|
M.height / N.height,
|
|
418
435
|
N.height / M.height
|
|
419
436
|
), t = Math.log2(Math.max(D, Q, 1));
|
|
420
|
-
return
|
|
437
|
+
return z * 1.15 + t * 0.42;
|
|
421
438
|
}
|
|
422
439
|
function uL() {
|
|
423
|
-
const M = _(p), N = M.width *
|
|
440
|
+
const M = _(p), N = M.width * FM.scale, L = M.height * FM.scale;
|
|
424
441
|
return {
|
|
425
|
-
x: M.x - (N - M.width) / 2 +
|
|
426
|
-
y: M.y - (L - M.height) / 2 +
|
|
442
|
+
x: M.x - (N - M.width) / 2 + FM.offsetX,
|
|
443
|
+
y: M.y - (L - M.height) / 2 + FM.offsetY,
|
|
427
444
|
width: N,
|
|
428
445
|
height: L
|
|
429
446
|
};
|
|
@@ -438,7 +455,7 @@ function LN(M) {
|
|
|
438
455
|
function SL(M) {
|
|
439
456
|
return M.toLowerCase().replace(/[^a-z0-9]+/g, "");
|
|
440
457
|
}
|
|
441
|
-
function
|
|
458
|
+
function rM(M) {
|
|
442
459
|
return M < 0.5 ? 4 * M * M * M : 1 - Math.pow(-2 * M + 2, 3) / 2;
|
|
443
460
|
}
|
|
444
461
|
function $M(M) {
|
|
@@ -449,47 +466,47 @@ function NL(M, N) {
|
|
|
449
466
|
return !L || !j ? new DOMMatrix() : L.inverse().multiply(j);
|
|
450
467
|
}
|
|
451
468
|
function NN(M, N) {
|
|
452
|
-
const L = N.getBBox(), j = NL(M, N),
|
|
469
|
+
const L = N.getBBox(), j = NL(M, N), u = [
|
|
453
470
|
new DOMPoint(L.x, L.y),
|
|
454
471
|
new DOMPoint(L.x + L.width, L.y),
|
|
455
472
|
new DOMPoint(L.x + L.width, L.y + L.height),
|
|
456
473
|
new DOMPoint(L.x, L.y + L.height)
|
|
457
|
-
].map((
|
|
474
|
+
].map((z) => z.matrixTransform(j)), I = u.map((z) => z.x), S = u.map((z) => z.y);
|
|
458
475
|
return {
|
|
459
476
|
x: Math.min(...I),
|
|
460
|
-
y: Math.min(...
|
|
477
|
+
y: Math.min(...S),
|
|
461
478
|
width: Math.max(...I) - Math.min(...I),
|
|
462
|
-
height: Math.max(...
|
|
479
|
+
height: Math.max(...S) - Math.min(...S)
|
|
463
480
|
};
|
|
464
481
|
}
|
|
465
482
|
function zL(M, N) {
|
|
466
|
-
const L = NN(M, N), j = _(p),
|
|
483
|
+
const L = NN(M, N), j = _(p), u = Math.max(L.width, L.height) * 0.18, I = u, S = Math.max(j.width * 0.4, L.width * 0.84, 680), z = L.width + I + S, D = j.width * 0.54, Q = j.height * 0.38, t = Math.min(
|
|
467
484
|
j.width,
|
|
468
|
-
Math.max(
|
|
469
|
-
),
|
|
485
|
+
Math.max(z, D)
|
|
486
|
+
), T = Math.min(
|
|
470
487
|
j.height,
|
|
471
|
-
Math.max(L.height +
|
|
472
|
-
),
|
|
488
|
+
Math.max(L.height + u * 2, Q)
|
|
489
|
+
), c = j.y + j.height - T;
|
|
473
490
|
return {
|
|
474
|
-
x: Math.max(j.x, L.x + L.width +
|
|
475
|
-
y: Math.max(j.y, Math.min(L.y + L.height / 2 -
|
|
491
|
+
x: Math.max(j.x, L.x + L.width + S - t),
|
|
492
|
+
y: Math.max(j.y, Math.min(L.y + L.height / 2 - T / 2, c)),
|
|
476
493
|
width: t,
|
|
477
|
-
height:
|
|
494
|
+
height: T
|
|
478
495
|
};
|
|
479
496
|
}
|
|
480
|
-
function _M(M, N, L, j,
|
|
497
|
+
function _M(M, N, L, j, u = 850) {
|
|
481
498
|
L.current && (window.cancelAnimationFrame(L.current), L.current = null);
|
|
482
|
-
const I = _(M.getAttribute("viewBox") || p),
|
|
499
|
+
const I = _(M.getAttribute("viewBox") || p), S = performance.now(), z = ++j.current, D = M.closest(".ethiopia-map-surface");
|
|
483
500
|
D == null || D.classList.add("zooming");
|
|
484
501
|
const Q = (t) => {
|
|
485
|
-
if (
|
|
486
|
-
const
|
|
487
|
-
x: I.x + (N.x - I.x) *
|
|
488
|
-
y: I.y + (N.y - I.y) *
|
|
489
|
-
width: I.width + (N.width - I.width) *
|
|
490
|
-
height: I.height + (N.height - I.height) *
|
|
502
|
+
if (z !== j.current) return;
|
|
503
|
+
const T = Math.min(1, (t - S) / u), c = rM(T), G = {
|
|
504
|
+
x: I.x + (N.x - I.x) * c,
|
|
505
|
+
y: I.y + (N.y - I.y) * c,
|
|
506
|
+
width: I.width + (N.width - I.width) * c,
|
|
507
|
+
height: I.height + (N.height - I.height) * c
|
|
491
508
|
};
|
|
492
|
-
M.setAttribute("viewBox", YM(
|
|
509
|
+
M.setAttribute("viewBox", YM(G)), T < 1 ? L.current = window.requestAnimationFrame(Q) : (L.current = null, M.setAttribute("viewBox", YM(N)), D == null || D.classList.remove("zooming"));
|
|
493
510
|
};
|
|
494
511
|
L.current = window.requestAnimationFrame(Q);
|
|
495
512
|
}
|
|
@@ -502,13 +519,13 @@ function gL(M) {
|
|
|
502
519
|
return iL(760 + j * 680, 850, 1900);
|
|
503
520
|
}
|
|
504
521
|
function AN(M, N, L) {
|
|
505
|
-
const j = M.getBBox(),
|
|
522
|
+
const j = M.getBBox(), u = L / Math.max(1, j.width), I = 30 / Math.max(1, j.height);
|
|
506
523
|
return {
|
|
507
|
-
a:
|
|
524
|
+
a: u,
|
|
508
525
|
b: 0,
|
|
509
526
|
c: 0,
|
|
510
527
|
d: I,
|
|
511
|
-
e: 420 - j.x *
|
|
528
|
+
e: 420 - j.x * u,
|
|
512
529
|
f: N - j.y * I
|
|
513
530
|
};
|
|
514
531
|
}
|
|
@@ -537,19 +554,19 @@ const QL = [
|
|
|
537
554
|
];
|
|
538
555
|
function IN(M) {
|
|
539
556
|
const N = M.cloneNode(!0), L = M.querySelectorAll("*");
|
|
540
|
-
return N.querySelectorAll("*").forEach((
|
|
541
|
-
const
|
|
542
|
-
if (!
|
|
543
|
-
const
|
|
557
|
+
return N.querySelectorAll("*").forEach((u, I) => {
|
|
558
|
+
const S = L[I];
|
|
559
|
+
if (!S) return;
|
|
560
|
+
const z = getComputedStyle(S);
|
|
544
561
|
for (const D of QL) {
|
|
545
|
-
const Q =
|
|
546
|
-
Q && Q !== "none" && !Q.startsWith("0px") &&
|
|
562
|
+
const Q = z.getPropertyValue(D);
|
|
563
|
+
Q && Q !== "none" && !Q.startsWith("0px") && u.style.setProperty(D, Q);
|
|
547
564
|
}
|
|
548
|
-
}), N.querySelectorAll("[href]").forEach((
|
|
549
|
-
const I =
|
|
565
|
+
}), N.querySelectorAll("[href]").forEach((u) => {
|
|
566
|
+
const I = u.getAttribute("href");
|
|
550
567
|
if (I && !I.startsWith("http") && !I.startsWith("data:"))
|
|
551
568
|
try {
|
|
552
|
-
|
|
569
|
+
u.setAttribute("href", new URL(I, document.baseURI).href);
|
|
553
570
|
} catch {
|
|
554
571
|
}
|
|
555
572
|
}), N;
|
|
@@ -557,9 +574,9 @@ function IN(M) {
|
|
|
557
574
|
function DN(M) {
|
|
558
575
|
M.querySelectorAll("*").forEach((L) => {
|
|
559
576
|
const j = getComputedStyle(L);
|
|
560
|
-
for (const
|
|
561
|
-
const I = j.getPropertyValue(
|
|
562
|
-
I && I !== "none" && !I.startsWith("0px") && L.style.setProperty(
|
|
577
|
+
for (const u of QL) {
|
|
578
|
+
const I = j.getPropertyValue(u);
|
|
579
|
+
I && I !== "none" && !I.startsWith("0px") && L.style.setProperty(u, I);
|
|
563
580
|
}
|
|
564
581
|
}), M.querySelectorAll("[href]").forEach((L) => {
|
|
565
582
|
const j = L.getAttribute("href");
|
|
@@ -571,22 +588,22 @@ function DN(M) {
|
|
|
571
588
|
});
|
|
572
589
|
}
|
|
573
590
|
function yL(M, N = !1) {
|
|
574
|
-
const L = M.getAttribute("viewBox") || p, j = _(L),
|
|
575
|
-
|
|
576
|
-
const D =
|
|
591
|
+
const L = M.getAttribute("viewBox") || p, j = _(L), u = j.width / j.height, I = 2400, S = Math.round(I / u), z = document.createElement("canvas");
|
|
592
|
+
z.width = I, z.height = S;
|
|
593
|
+
const D = z.getContext("2d");
|
|
577
594
|
if (!D) return Promise.reject(new Error("Could not get canvas context"));
|
|
578
595
|
const Q = IN(M);
|
|
579
|
-
Q.setAttribute("width", String(I)), Q.setAttribute("height", String(
|
|
580
|
-
const t = new XMLSerializer().serializeToString(Q),
|
|
596
|
+
Q.setAttribute("width", String(I)), Q.setAttribute("height", String(S)), Q.setAttribute("viewBox", L);
|
|
597
|
+
const t = new XMLSerializer().serializeToString(Q), T = new Blob([t], {
|
|
581
598
|
type: "image/svg+xml;charset=utf-8"
|
|
582
|
-
}),
|
|
583
|
-
return new Promise((
|
|
599
|
+
}), c = URL.createObjectURL(T);
|
|
600
|
+
return new Promise((G, y) => {
|
|
584
601
|
const e = new Image();
|
|
585
602
|
e.onload = () => {
|
|
586
|
-
N && (D.fillStyle = "#ffffff", D.fillRect(0, 0, I,
|
|
603
|
+
N && (D.fillStyle = "#ffffff", D.fillRect(0, 0, I, S)), D.drawImage(e, 0, 0, I, S), URL.revokeObjectURL(c), kL(D, I, S), G(z);
|
|
587
604
|
}, e.onerror = () => {
|
|
588
|
-
URL.revokeObjectURL(
|
|
589
|
-
}, e.src =
|
|
605
|
+
URL.revokeObjectURL(c), y(new Error("Failed to render SVG to canvas"));
|
|
606
|
+
}, e.src = c;
|
|
590
607
|
});
|
|
591
608
|
}
|
|
592
609
|
let aM = null;
|
|
@@ -598,8 +615,8 @@ let aM = null;
|
|
|
598
615
|
})();
|
|
599
616
|
function kL(M, N, L) {
|
|
600
617
|
if (!aM || !aM.naturalWidth) return;
|
|
601
|
-
const j = Math.round(L * 0.1),
|
|
602
|
-
M.drawImage(aM, N -
|
|
618
|
+
const j = Math.round(L * 0.1), u = Math.round(j * (aM.naturalWidth / aM.naturalHeight)), I = Math.round(N * 0.025);
|
|
619
|
+
M.drawImage(aM, N - u - I, L - j - I, u, j);
|
|
603
620
|
}
|
|
604
621
|
function ML(M, N) {
|
|
605
622
|
const L = document.createElement("a");
|
|
@@ -609,82 +626,82 @@ const wN = EL(function({
|
|
|
609
626
|
className: N,
|
|
610
627
|
style: L,
|
|
611
628
|
svgText: j,
|
|
612
|
-
svgUrl:
|
|
629
|
+
svgUrl: u,
|
|
613
630
|
terrainImageUrl: I = eL,
|
|
614
|
-
inMapStatsClassName:
|
|
615
|
-
inMapStatsStyle:
|
|
631
|
+
inMapStatsClassName: S,
|
|
632
|
+
inMapStatsStyle: z,
|
|
616
633
|
inMapStatsListClassName: D,
|
|
617
634
|
inMapStatsListStyle: Q,
|
|
618
635
|
inMapStatsEmptyText: t = "No regional indicators were found for this region.",
|
|
619
|
-
incrementalRows:
|
|
620
|
-
showLayerControl:
|
|
621
|
-
layerControlClassName:
|
|
622
|
-
layerControlLabels:
|
|
636
|
+
incrementalRows: T,
|
|
637
|
+
showLayerControl: c = !1,
|
|
638
|
+
layerControlClassName: G,
|
|
639
|
+
layerControlLabels: y,
|
|
623
640
|
alignX: e = 37,
|
|
624
641
|
alignY: H = 55,
|
|
625
|
-
alignScale:
|
|
626
|
-
showGhostReference:
|
|
627
|
-
},
|
|
628
|
-
const
|
|
642
|
+
alignScale: DM = 2.212,
|
|
643
|
+
showGhostReference: J = !1
|
|
644
|
+
}, l) {
|
|
645
|
+
const o = $(null), i = $(null), h = $(0), wM = $(null), [b, B] = mM(null), {
|
|
629
646
|
data: m,
|
|
630
|
-
regionColors:
|
|
631
|
-
selectedRegionId:
|
|
632
|
-
selectRegion:
|
|
633
|
-
layer:
|
|
647
|
+
regionColors: zM,
|
|
648
|
+
selectedRegionId: a,
|
|
649
|
+
selectRegion: MM,
|
|
650
|
+
layer: LM,
|
|
634
651
|
theme: gM,
|
|
635
652
|
era: f,
|
|
636
|
-
year:
|
|
653
|
+
year: CM,
|
|
637
654
|
viewMode: F,
|
|
638
|
-
showLabels:
|
|
639
|
-
selectionAnimation:
|
|
655
|
+
showLabels: V,
|
|
656
|
+
selectionAnimation: TM,
|
|
640
657
|
showInMapStats: Y,
|
|
641
|
-
serviceStats:
|
|
658
|
+
serviceStats: NM,
|
|
642
659
|
selectedRegion: yM,
|
|
643
660
|
setLayer: HM
|
|
644
|
-
} = bM(), QM = $(
|
|
645
|
-
() => j ?? wL(f,
|
|
661
|
+
} = bM(), QM = $(MM), eM = $(/* @__PURE__ */ new Map()), IL = $(F), [JM, nM] = mM(
|
|
662
|
+
() => j ?? wL(f, CM)
|
|
646
663
|
);
|
|
647
664
|
q(() => {
|
|
648
|
-
|
|
649
|
-
}, [
|
|
665
|
+
wM.current = a;
|
|
666
|
+
}, [a]), q(() => {
|
|
650
667
|
LN(I);
|
|
651
668
|
}, [I]), q(() => {
|
|
652
|
-
QM.current =
|
|
653
|
-
}, [
|
|
654
|
-
const
|
|
669
|
+
QM.current = MM;
|
|
670
|
+
}, [MM]), q(() => {
|
|
671
|
+
const U = new Map(
|
|
655
672
|
Object.entries(m).map(([A, w]) => [SL(w.name), A])
|
|
656
673
|
);
|
|
657
|
-
|
|
674
|
+
U.set("oromiya", "oromia"), U.set("southern nations", "snnpr"), U.set("southern nations snnpr", "snnpr"), U.set("snnpr", "snnpr"), eM.current = U;
|
|
658
675
|
}, [m]), q(() => {
|
|
659
676
|
if (j !== void 0) {
|
|
660
|
-
|
|
677
|
+
nM(j);
|
|
661
678
|
return;
|
|
662
679
|
}
|
|
663
|
-
if (!
|
|
664
|
-
|
|
680
|
+
if (!u) {
|
|
681
|
+
nM(wL(f, CM));
|
|
665
682
|
return;
|
|
666
683
|
}
|
|
667
|
-
let
|
|
668
|
-
return fetch(
|
|
684
|
+
let U = !0;
|
|
685
|
+
return fetch(u).then((A) => {
|
|
669
686
|
if (!A.ok)
|
|
670
687
|
throw new Error(`Could not load SVG: ${A.status}`);
|
|
671
688
|
return A.text();
|
|
672
689
|
}).then((A) => {
|
|
673
|
-
|
|
690
|
+
U && nM(A);
|
|
674
691
|
}).catch(() => {
|
|
675
|
-
|
|
692
|
+
U && nM("");
|
|
676
693
|
}), () => {
|
|
677
|
-
|
|
694
|
+
U = !1;
|
|
678
695
|
};
|
|
679
|
-
}, [j,
|
|
680
|
-
const
|
|
681
|
-
if (!
|
|
682
|
-
|
|
683
|
-
const A =
|
|
696
|
+
}, [j, u, f, CM]), q(() => {
|
|
697
|
+
const U = o.current;
|
|
698
|
+
if (!U || !JM) return;
|
|
699
|
+
U.innerHTML = JM;
|
|
700
|
+
const A = U.querySelector("svg");
|
|
684
701
|
A && (A.classList.add("ethiopia-map"), A.querySelectorAll("title").forEach((w) => w.remove()), LL.forEach(({ id: w, svgId: s, altSvgId: E }) => {
|
|
685
702
|
const O = A.querySelector(`#${CSS.escape(s)}`) || (E ? A.querySelector(`#${CSS.escape(E)}`) : null);
|
|
686
703
|
O && (O.removeAttribute("style"), O.setAttribute("fill-rule", "evenodd"), O.setAttribute("stroke", "none"), O.dataset.region = w, O.classList.add("map-region"), O.style.cursor = "pointer", O.addEventListener("click", () => {
|
|
687
|
-
B(null), QM.current(
|
|
704
|
+
B(null), QM.current(wM.current === w ? null : w);
|
|
688
705
|
}), O.addEventListener("mouseenter", () => B(w)), O.addEventListener("mouseleave", () => B(null)), O.addEventListener("pointerover", () => B(w)), O.addEventListener("pointerout", () => B(null)));
|
|
689
706
|
}), A.querySelectorAll("path, polygon").forEach((w) => {
|
|
690
707
|
w.classList.contains("map-region") || (w.style.display = "none");
|
|
@@ -706,29 +723,29 @@ const wN = EL(function({
|
|
|
706
723
|
);
|
|
707
724
|
s && (w.dataset.regionLabel = s, w.style.cursor = "pointer", w.addEventListener("click", (E) => {
|
|
708
725
|
E.stopPropagation(), B(null), QM.current(
|
|
709
|
-
|
|
726
|
+
wM.current === s ? null : s
|
|
710
727
|
);
|
|
711
728
|
}), w.addEventListener("mouseenter", () => B(s)), w.addEventListener("mouseleave", () => B(null)), w.addEventListener("pointerover", () => B(s)), w.addEventListener("pointerout", () => B(null)));
|
|
712
729
|
}));
|
|
713
730
|
}, [JM]), q(() => {
|
|
714
|
-
const
|
|
731
|
+
const U = o.current, A = U == null ? void 0 : U.querySelector("svg");
|
|
715
732
|
if (!A) return;
|
|
716
|
-
if (cL(f,
|
|
733
|
+
if (cL(f, CM) === "11-region") {
|
|
717
734
|
A.setAttribute("viewBox", p);
|
|
718
735
|
let s = A.querySelector("#ethiopia-11-alignment-group");
|
|
719
736
|
if (!s) {
|
|
720
737
|
s = document.createElementNS("http://www.w3.org/2000/svg", "g"), s.id = "ethiopia-11-alignment-group";
|
|
721
738
|
const O = [];
|
|
722
|
-
Array.from(A.children).forEach((
|
|
723
|
-
!
|
|
724
|
-
}), O.forEach((
|
|
739
|
+
Array.from(A.children).forEach((d) => {
|
|
740
|
+
!d.classList.contains("terrain-image-layer") && !d.classList.contains("bar-morph-layer") && !d.classList.contains("heat-layer") && d.id !== "ghost-reference-14-layer" && O.push(d);
|
|
741
|
+
}), O.forEach((d) => s.appendChild(d)), A.appendChild(s);
|
|
725
742
|
}
|
|
726
743
|
s.setAttribute(
|
|
727
744
|
"transform",
|
|
728
|
-
`translate(${e}, ${H}) scale(${
|
|
745
|
+
`translate(${e}, ${H}) scale(${DM})`
|
|
729
746
|
);
|
|
730
747
|
let E = A.querySelector("#ghost-reference-14-layer");
|
|
731
|
-
|
|
748
|
+
J ? (E || (E = document.createElementNS("http://www.w3.org/2000/svg", "g"), E.id = "ghost-reference-14-layer", E.style.pointerEvents = "none", new DOMParser().parseFromString(jL, "image/svg+xml").querySelectorAll("path").forEach((x) => {
|
|
732
749
|
const k = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
733
750
|
k.setAttribute("d", x.getAttribute("d") || ""), k.setAttribute("fill", "rgba(225, 29, 72, 0.06)"), k.setAttribute("stroke", "#e11d48"), k.setAttribute("stroke-width", "2.5"), k.setAttribute("stroke-dasharray", "5 5"), k.setAttribute("opacity", "0.65"), E.appendChild(k);
|
|
734
751
|
}), A.insertBefore(E, A.firstChild)), E.style.display = "block") : E && (E.style.display = "none");
|
|
@@ -742,39 +759,39 @@ const wN = EL(function({
|
|
|
742
759
|
const E = A.querySelector("#ghost-reference-14-layer");
|
|
743
760
|
E && E.remove();
|
|
744
761
|
}
|
|
745
|
-
}, [JM, f,
|
|
746
|
-
const
|
|
762
|
+
}, [JM, f, CM, e, H, DM, J]), q(() => {
|
|
763
|
+
const U = o.current, A = U == null ? void 0 : U.querySelector("svg");
|
|
747
764
|
if (!A) return;
|
|
748
|
-
const w =
|
|
749
|
-
|
|
765
|
+
const w = LM === "terrain", s = F === "bars", E = s && IL.current !== "bars";
|
|
766
|
+
U == null || U.classList.toggle("terrain-mode", w), U == null || U.classList.toggle("light-mode", gM === "light"), U == null || U.classList.toggle("dark-mode", gM === "dark"), U == null || U.classList.toggle("bars-mode", s);
|
|
750
767
|
let O = A.querySelector(".terrain-image-layer");
|
|
751
768
|
if (!O) {
|
|
752
|
-
const
|
|
769
|
+
const C = uL();
|
|
753
770
|
O = document.createElementNS("http://www.w3.org/2000/svg", "g"), O.classList.add("terrain-image-layer"), O.style.pointerEvents = "none", O.style.display = "none";
|
|
754
771
|
const x = document.createElementNS("http://www.w3.org/2000/svg", "image");
|
|
755
|
-
x.setAttribute("href", I), x.setAttribute("x", String(
|
|
772
|
+
x.setAttribute("href", I), x.setAttribute("x", String(C.x)), x.setAttribute("y", String(C.y)), x.setAttribute("width", String(C.width)), x.setAttribute("height", String(C.height)), x.setAttribute("preserveAspectRatio", "none"), x.setAttribute("decoding", "async"), x.setAttribute("fetchpriority", "high"), x.style.pointerEvents = "none", O.appendChild(x), A.insertBefore(O, A.firstChild);
|
|
756
773
|
}
|
|
757
774
|
if (O) {
|
|
758
|
-
const
|
|
759
|
-
x && (x.setAttribute("href", I), x.setAttribute("x", String(
|
|
775
|
+
const C = uL(), x = O.querySelector("image");
|
|
776
|
+
x && (x.setAttribute("href", I), x.setAttribute("x", String(C.x)), x.setAttribute("y", String(C.y)), x.setAttribute("width", String(C.width)), x.setAttribute("height", String(C.height))), O.style.display = w && !s ? "block" : "none";
|
|
760
777
|
}
|
|
761
|
-
A.querySelectorAll("path:not(.map-region)").forEach((
|
|
762
|
-
|
|
763
|
-
}), A.querySelectorAll("#Dry_lakes").forEach((
|
|
764
|
-
|
|
778
|
+
A.querySelectorAll("path:not(.map-region)").forEach((C) => {
|
|
779
|
+
C.style.display = s ? "none" : "", C.style.fill = w ? "rgba(255, 255, 255, 0.02)" : "", C.style.opacity = w ? "0.34" : "", C.style.stroke = w ? "rgba(27, 35, 31, 0.26)" : "", C.style.vectorEffect = "non-scaling-stroke";
|
|
780
|
+
}), A.querySelectorAll("#Dry_lakes").forEach((C) => {
|
|
781
|
+
C.style.display = s ? "none" : "";
|
|
765
782
|
});
|
|
766
|
-
let
|
|
767
|
-
if (
|
|
768
|
-
|
|
769
|
-
const
|
|
770
|
-
k.classList.add("bar-flight-layer"),
|
|
771
|
-
const xM = 120 + kM * 86, lM = Math.max(24, r.value /
|
|
783
|
+
let d = A.querySelector(".bar-morph-layer");
|
|
784
|
+
if (d && d.remove(), s) {
|
|
785
|
+
d = document.createElementNS("http://www.w3.org/2000/svg", "g"), d.classList.add("bar-morph-layer");
|
|
786
|
+
const C = AL(m), x = Object.entries(m).sort(([, Z], [, r]) => r.value - Z.value), k = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
787
|
+
k.classList.add("bar-flight-layer"), d.appendChild(k), x.forEach(([Z, r], kM) => {
|
|
788
|
+
const xM = 120 + kM * 86, lM = Math.max(24, r.value / C * 880), oM = pM(Z, m, zM), tM = A.querySelector(`[data-region="${Z}"]`);
|
|
772
789
|
if (E && tM) {
|
|
773
|
-
const
|
|
774
|
-
|
|
775
|
-
const
|
|
776
|
-
if (!
|
|
777
|
-
const RM = Math.min(1, (iM -
|
|
790
|
+
const n = tM.cloneNode(!1), W = NL(A, tM), UM = AN(tM, xM, lM), PM = 70 + kM * 38;
|
|
791
|
+
n.removeAttribute("id"), n.removeAttribute("class"), n.classList.add("bar-region-ghost"), n.setAttribute("transform", $M(W)), n.style.fill = oM, n.style.stroke = "#ffffff", n.style.strokeWidth = "4px", n.style.vectorEffect = "non-scaling-stroke", n.style.pointerEvents = "none", k.appendChild(n), window.setTimeout(() => {
|
|
792
|
+
const SM = performance.now(), X = (iM) => {
|
|
793
|
+
if (!n.isConnected) return;
|
|
794
|
+
const RM = Math.min(1, (iM - SM) / 920), sM = rM(RM), KM = {
|
|
778
795
|
a: W.a + (UM.a - W.a) * sM,
|
|
779
796
|
b: W.b + (UM.b - W.b) * sM,
|
|
780
797
|
c: W.c + (UM.c - W.c) * sM,
|
|
@@ -782,7 +799,7 @@ const wN = EL(function({
|
|
|
782
799
|
e: W.e + (UM.e - W.e) * sM,
|
|
783
800
|
f: W.f + (UM.f - W.f) * sM
|
|
784
801
|
};
|
|
785
|
-
|
|
802
|
+
n.setAttribute("transform", $M(KM)), n.style.opacity = String(0.96 - sM * 0.62), RM < 1 ? window.requestAnimationFrame(X) : n.style.opacity = "0";
|
|
786
803
|
};
|
|
787
804
|
window.requestAnimationFrame(X);
|
|
788
805
|
}, PM);
|
|
@@ -790,58 +807,58 @@ const wN = EL(function({
|
|
|
790
807
|
const cM = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
791
808
|
cM.setAttribute("x", "82"), cM.setAttribute("y", String(xM + 22)), cM.classList.add("bar-morph-label"), cM.textContent = r.name;
|
|
792
809
|
const P = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
793
|
-
P.setAttribute("x", String(420 + lM + 12)), P.setAttribute("y", String(xM + 22)), P.style.textAnchor = "start", P.classList.add("bar-morph-value"), P.textContent =
|
|
794
|
-
const
|
|
795
|
-
|
|
810
|
+
P.setAttribute("x", String(420 + lM + 12)), P.setAttribute("y", String(xM + 22)), P.style.textAnchor = "start", P.classList.add("bar-morph-value"), P.textContent = vM(r.value);
|
|
811
|
+
const jM = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
812
|
+
jM.setAttribute("x", "420"), jM.setAttribute("y", String(xM)), jM.setAttribute("width", "880"), jM.setAttribute("height", "30"), jM.classList.add("bar-morph-track");
|
|
796
813
|
const v = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
797
814
|
v.setAttribute("x", "420"), v.setAttribute("y", String(xM)), v.setAttribute("width", String(lM)), v.setAttribute("height", "30"), v.setAttribute("rx", "4"), v.setAttribute("fill", oM), v.classList.add("bar-morph-bar");
|
|
798
|
-
const
|
|
799
|
-
|
|
800
|
-
|
|
815
|
+
const uM = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
816
|
+
uM.classList.add("bar-row"), uM.style.opacity = E ? "0" : "1", uM.append(cM, jM, v, P), d == null || d.appendChild(uM), E && window.setTimeout(() => {
|
|
817
|
+
uM.classList.add("visible");
|
|
801
818
|
}, 560 + kM * 38);
|
|
802
|
-
}), A.appendChild(
|
|
819
|
+
}), A.appendChild(d), E && window.setTimeout(() => {
|
|
803
820
|
k.isConnected && k.remove();
|
|
804
821
|
}, 1500);
|
|
805
822
|
}
|
|
806
|
-
if (LL.forEach(({ id:
|
|
807
|
-
const
|
|
808
|
-
|
|
823
|
+
if (LL.forEach(({ id: C, svgId: x, altSvgId: k }) => {
|
|
824
|
+
const Z = A.querySelector(`#${CSS.escape(x)}`) || (k ? A.querySelector(`#${CSS.escape(k)}`) : null);
|
|
825
|
+
Z && (Z.style.display = s ? "none" : "inline", Z.style.fill = w ? "rgba(255, 255, 255, 0.04)" : pM(C, m, zM), Z.style.stroke = w ? "rgba(27, 35, 31, 0.72)" : "rgba(54, 86, 75, 0.72)", Z.style.strokeWidth = w ? "1.5px" : "3.8px", Z.style.vectorEffect = "non-scaling-stroke", Z.setAttribute("fill-rule", "evenodd"), Z.classList.toggle("selected", a === C), Z.classList.toggle(
|
|
809
826
|
"pulse",
|
|
810
|
-
|
|
811
|
-
),
|
|
827
|
+
a === C && TM === "pulse"
|
|
828
|
+
), Z.classList.toggle(
|
|
812
829
|
"lifted",
|
|
813
|
-
|
|
814
|
-
),
|
|
830
|
+
a === C && TM === "static"
|
|
831
|
+
), Z.classList.toggle(
|
|
815
832
|
"outline-only",
|
|
816
|
-
|
|
833
|
+
a === C && TM === "outline"
|
|
817
834
|
));
|
|
818
|
-
}), A.querySelectorAll("text, tspan").forEach((
|
|
835
|
+
}), A.querySelectorAll("text, tspan").forEach((C) => {
|
|
819
836
|
var k;
|
|
820
|
-
if (
|
|
821
|
-
|
|
837
|
+
if (C.closest(".bar-morph-layer")) {
|
|
838
|
+
C.style.pointerEvents = "none", C.style.opacity = "1";
|
|
822
839
|
return;
|
|
823
840
|
}
|
|
824
|
-
const x =
|
|
825
|
-
|
|
841
|
+
const x = C.dataset.regionLabel || ((k = C.closest("text")) == null ? void 0 : k.dataset.regionLabel);
|
|
842
|
+
C.style.pointerEvents = x ? "auto" : "none", C.style.opacity = V && !s ? "1" : "0";
|
|
826
843
|
}), s)
|
|
827
844
|
_M(
|
|
828
845
|
A,
|
|
829
846
|
_(p),
|
|
830
|
-
|
|
831
|
-
|
|
847
|
+
i,
|
|
848
|
+
h,
|
|
832
849
|
gL(A)
|
|
833
850
|
);
|
|
834
|
-
else if (
|
|
835
|
-
const
|
|
836
|
-
`.map-region[data-region="${
|
|
851
|
+
else if (a) {
|
|
852
|
+
const C = A.querySelector(
|
|
853
|
+
`.map-region[data-region="${a}"]`
|
|
837
854
|
);
|
|
838
|
-
if (
|
|
839
|
-
const x = zL(A,
|
|
855
|
+
if (C) {
|
|
856
|
+
const x = zL(A, C);
|
|
840
857
|
_M(
|
|
841
858
|
A,
|
|
842
859
|
x,
|
|
843
|
-
|
|
844
|
-
|
|
860
|
+
i,
|
|
861
|
+
h,
|
|
845
862
|
jN(A, x)
|
|
846
863
|
);
|
|
847
864
|
}
|
|
@@ -849,103 +866,103 @@ const wN = EL(function({
|
|
|
849
866
|
_M(
|
|
850
867
|
A,
|
|
851
868
|
_(p),
|
|
852
|
-
|
|
853
|
-
|
|
869
|
+
i,
|
|
870
|
+
h,
|
|
854
871
|
gL(A)
|
|
855
872
|
);
|
|
856
873
|
IL.current = F;
|
|
857
874
|
}, [
|
|
858
875
|
m,
|
|
859
|
-
|
|
876
|
+
LM,
|
|
860
877
|
JM,
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
878
|
+
zM,
|
|
879
|
+
a,
|
|
880
|
+
TM,
|
|
881
|
+
V,
|
|
865
882
|
I,
|
|
866
883
|
gM,
|
|
867
884
|
F
|
|
868
885
|
]), q(() => {
|
|
869
|
-
const
|
|
886
|
+
const U = o.current, A = U == null ? void 0 : U.querySelector("svg");
|
|
870
887
|
if (!A) return;
|
|
871
888
|
let w = A.querySelector(".region-outline-layer");
|
|
872
889
|
w || (w = document.createElementNS("http://www.w3.org/2000/svg", "g"), w.classList.add("region-outline-layer")), w.innerHTML = "", [
|
|
873
|
-
|
|
874
|
-
|
|
890
|
+
TM === "outline" ? a : null,
|
|
891
|
+
b
|
|
875
892
|
].forEach((E, O) => {
|
|
876
|
-
if (!E || F === "bars" || O === 1 && E ===
|
|
893
|
+
if (!E || F === "bars" || O === 1 && E === a)
|
|
877
894
|
return;
|
|
878
|
-
const
|
|
895
|
+
const d = A.querySelector(
|
|
879
896
|
`.map-region[data-region="${E}"]`
|
|
880
897
|
);
|
|
881
|
-
if (!
|
|
882
|
-
const
|
|
883
|
-
|
|
898
|
+
if (!d) return;
|
|
899
|
+
const C = d.cloneNode(!1), x = NL(A, d);
|
|
900
|
+
C.removeAttribute("id"), C.removeAttribute("class"), C.removeAttribute("data-region"), C.removeAttribute("data-svg-id"), C.classList.add(
|
|
884
901
|
O === 0 ? "selected-region-outline" : "hover-region-outline"
|
|
885
|
-
),
|
|
902
|
+
), C.style.fill = "none", C.style.stroke = "#ffffff", C.style.strokeWidth = O === 0 ? "4px" : "2px", C.style.strokeLinecap = "round", C.style.strokeLinejoin = "round", C.style.vectorEffect = "non-scaling-stroke", C.style.pointerEvents = "none", C.setAttribute("transform", $M(x)), w.appendChild(C);
|
|
886
903
|
}), A.appendChild(w);
|
|
887
|
-
}, [
|
|
888
|
-
const lL =
|
|
889
|
-
...Object.values(
|
|
890
|
-
(A) => (A || []).filter((w) => w.label ===
|
|
904
|
+
}, [b, a, TM, F]);
|
|
905
|
+
const lL = a && NM[a] || CL, fM = LM === "terrain" ? "regions" : "terrain", DL = (y == null ? void 0 : y[fM]) ?? (fM === "terrain" ? "Terrain" : "Normal"), RL = (U) => Math.max(
|
|
906
|
+
...Object.values(NM).flatMap(
|
|
907
|
+
(A) => (A || []).filter((w) => w.label === U.label).map((w) => w.value)
|
|
891
908
|
),
|
|
892
|
-
|
|
909
|
+
U.value,
|
|
893
910
|
1
|
|
894
911
|
);
|
|
895
|
-
return GL(
|
|
896
|
-
async exportPNG(
|
|
912
|
+
return GL(l, () => ({
|
|
913
|
+
async exportPNG(U = "ethiopia-map") {
|
|
897
914
|
var A;
|
|
898
915
|
try {
|
|
899
|
-
const w = (A =
|
|
916
|
+
const w = (A = o.current) == null ? void 0 : A.querySelector("svg");
|
|
900
917
|
if (!w) return;
|
|
901
918
|
(await yL(w)).toBlob((E) => {
|
|
902
|
-
E && ML(E, `${
|
|
919
|
+
E && ML(E, `${U}.png`);
|
|
903
920
|
}, "image/png");
|
|
904
921
|
} catch (w) {
|
|
905
922
|
console.error("exportPNG failed:", w);
|
|
906
923
|
}
|
|
907
924
|
},
|
|
908
|
-
async exportJPG(
|
|
925
|
+
async exportJPG(U = "ethiopia-map") {
|
|
909
926
|
var A;
|
|
910
927
|
try {
|
|
911
|
-
const w = (A =
|
|
928
|
+
const w = (A = o.current) == null ? void 0 : A.querySelector("svg");
|
|
912
929
|
if (!w) return;
|
|
913
930
|
(await yL(w, !0)).toBlob((E) => {
|
|
914
|
-
E && ML(E, `${
|
|
931
|
+
E && ML(E, `${U}.jpg`);
|
|
915
932
|
}, "image/jpeg", 0.92);
|
|
916
933
|
} catch (w) {
|
|
917
934
|
console.error("exportJPG failed:", w);
|
|
918
935
|
}
|
|
919
936
|
},
|
|
920
|
-
async exportVideo(
|
|
937
|
+
async exportVideo(U = "ethiopia-map", A) {
|
|
921
938
|
var w, s;
|
|
922
939
|
try {
|
|
923
|
-
const E = (w =
|
|
940
|
+
const E = (w = o.current) == null ? void 0 : w.closest(".ethiopia-map-surface"), O = (s = o.current) == null ? void 0 : s.querySelector("svg");
|
|
924
941
|
if (!E || !O) return;
|
|
925
|
-
const
|
|
926
|
-
|
|
927
|
-
const x =
|
|
942
|
+
const d = E.getBoundingClientRect(), C = E.cloneNode(!0);
|
|
943
|
+
C.style.cssText = `position:fixed;left:-9999px;top:0;width:${d.width}px;height:${d.height}px;overflow:hidden`, document.body.appendChild(C);
|
|
944
|
+
const x = C.querySelector("svg");
|
|
928
945
|
DN(x), x.setAttribute("viewBox", p);
|
|
929
946
|
const k = _(p);
|
|
930
|
-
let
|
|
947
|
+
let Z = { ...k }, r = null, kM = "", xM = "", lM = "", oM = "";
|
|
931
948
|
if (A != null && A.regionId) {
|
|
932
|
-
const
|
|
933
|
-
if (
|
|
934
|
-
const X = getComputedStyle(
|
|
935
|
-
kM = X.getPropertyValue("--region-shadow-wall").trim() || "rgba(0,0,0,0.6)", xM = X.getPropertyValue("--region-shadow-mid").trim() || "rgba(0,0,0,0.42)", lM = X.getPropertyValue("--region-shadow-ambient").trim() || "rgba(0,0,0,0.3)", oM = X.getPropertyValue("--region-shadow-glow").trim() || "rgba(23,107,84,0.45)",
|
|
949
|
+
const SM = x.querySelector(`[data-region="${A.regionId}"]`);
|
|
950
|
+
if (SM) {
|
|
951
|
+
const X = getComputedStyle(C);
|
|
952
|
+
kM = X.getPropertyValue("--region-shadow-wall").trim() || "rgba(0,0,0,0.6)", xM = X.getPropertyValue("--region-shadow-mid").trim() || "rgba(0,0,0,0.42)", lM = X.getPropertyValue("--region-shadow-ambient").trim() || "rgba(0,0,0,0.3)", oM = X.getPropertyValue("--region-shadow-glow").trim() || "rgba(23,107,84,0.45)", SM.style.stroke = "#ffffff", r = SM, Z = zL(x, SM);
|
|
936
953
|
}
|
|
937
954
|
}
|
|
938
|
-
const tM = _(p), cM = tM.width / tM.height, P = 1920,
|
|
939
|
-
v.width = P, v.height =
|
|
940
|
-
const
|
|
941
|
-
W.ondataavailable = (
|
|
942
|
-
W.onstop = () =>
|
|
955
|
+
const tM = _(p), cM = tM.width / tM.height, P = 1920, jM = Math.round(P / cM), v = document.createElement("canvas");
|
|
956
|
+
v.width = P, v.height = jM;
|
|
957
|
+
const uM = v.getContext("2d"), n = v.captureStream(30), W = new MediaRecorder(n, { mimeType: "video/webm" }), UM = [];
|
|
958
|
+
W.ondataavailable = (SM) => UM.push(SM.data), await new Promise((SM) => {
|
|
959
|
+
W.onstop = () => SM(), W.start();
|
|
943
960
|
const X = 600, iM = 1400, RM = 620, KM = X + iM + RM + 600, dL = performance.now();
|
|
944
961
|
function BM(K) {
|
|
945
|
-
const EM = new XMLSerializer().serializeToString(x), OM = new Blob([EM], { type: "image/svg+xml;charset=utf-8" }),
|
|
962
|
+
const EM = new XMLSerializer().serializeToString(x), OM = new Blob([EM], { type: "image/svg+xml;charset=utf-8" }), VM = URL.createObjectURL(OM), dM = new Image();
|
|
946
963
|
dM.onload = () => {
|
|
947
|
-
|
|
948
|
-
}, dM.onerror = () => K(), dM.src =
|
|
964
|
+
uM.fillStyle = "#ffffff", uM.fillRect(0, 0, P, jM), uM.drawImage(dM, 0, 0, P, jM), URL.revokeObjectURL(VM), kL(uM, P, jM), K();
|
|
965
|
+
}, dM.onerror = () => K(), dM.src = VM;
|
|
949
966
|
}
|
|
950
967
|
function WM(K) {
|
|
951
968
|
if (!r) return;
|
|
@@ -953,42 +970,42 @@ const wN = EL(function({
|
|
|
953
970
|
r.style.removeProperty("transform"), r.style.removeProperty("filter");
|
|
954
971
|
return;
|
|
955
972
|
}
|
|
956
|
-
const EM =
|
|
957
|
-
r.style.transform = `translate3d(${dM}px, ${OM}px, 0) scaleY(${
|
|
973
|
+
const EM = rM(Math.min(1, K)), OM = -22 * EM, VM = 1 + 0.022 * EM, dM = -4 * EM;
|
|
974
|
+
r.style.transform = `translate3d(${dM}px, ${OM}px, 0) scaleY(${VM})`, r.style.transformBox = "fill-box", r.style.transformOrigin = "center bottom", r.style.filter = `drop-shadow(5px 26px 0 ${kM}) drop-shadow(4px 20px 3px ${xM}) drop-shadow(2px 10px 14px ${lM}) drop-shadow(0 0 18px ${oM})`;
|
|
958
975
|
}
|
|
959
976
|
function hM() {
|
|
960
977
|
const K = performance.now() - dL;
|
|
961
978
|
if (K < X)
|
|
962
979
|
WM(0), x.setAttribute("viewBox", YM(k)), BM(() => requestAnimationFrame(hM));
|
|
963
980
|
else if (K < X + iM) {
|
|
964
|
-
const EM = Math.min(1, (K - X) / iM), OM =
|
|
981
|
+
const EM = Math.min(1, (K - X) / iM), OM = rM(EM);
|
|
965
982
|
WM(0), x.setAttribute("viewBox", YM({
|
|
966
|
-
x: k.x + (
|
|
967
|
-
y: k.y + (
|
|
968
|
-
width: k.width + (
|
|
969
|
-
height: k.height + (
|
|
983
|
+
x: k.x + (Z.x - k.x) * OM,
|
|
984
|
+
y: k.y + (Z.y - k.y) * OM,
|
|
985
|
+
width: k.width + (Z.width - k.width) * OM,
|
|
986
|
+
height: k.height + (Z.height - k.height) * OM
|
|
970
987
|
})), BM(() => requestAnimationFrame(hM));
|
|
971
988
|
} else if (K < X + iM + RM) {
|
|
972
989
|
const EM = (K - X - iM) / RM;
|
|
973
|
-
WM(EM), x.setAttribute("viewBox", YM(
|
|
974
|
-
} else K < KM ? (WM(1), x.setAttribute("viewBox", YM(
|
|
990
|
+
WM(EM), x.setAttribute("viewBox", YM(Z)), BM(() => requestAnimationFrame(hM));
|
|
991
|
+
} else K < KM ? (WM(1), x.setAttribute("viewBox", YM(Z)), BM(() => requestAnimationFrame(hM))) : (WM(1), x.setAttribute("viewBox", YM(Z)), BM(() => W.stop()));
|
|
975
992
|
}
|
|
976
993
|
requestAnimationFrame(hM);
|
|
977
994
|
});
|
|
978
995
|
const PM = new Blob(UM, { type: "video/webm" });
|
|
979
|
-
ML(PM, `${
|
|
996
|
+
ML(PM, `${U}.webm`), document.body.removeChild(C);
|
|
980
997
|
} catch (E) {
|
|
981
998
|
console.error("exportVideo failed:", E);
|
|
982
999
|
}
|
|
983
1000
|
}
|
|
984
|
-
}), []), /* @__PURE__ */
|
|
1001
|
+
}), []), /* @__PURE__ */ R(
|
|
985
1002
|
"div",
|
|
986
1003
|
{
|
|
987
1004
|
className: [
|
|
988
1005
|
"ethiopia-map-surface",
|
|
989
|
-
CN(
|
|
1006
|
+
CN(LM),
|
|
990
1007
|
gM === "dark" ? "dark-mode" : "light-mode",
|
|
991
|
-
|
|
1008
|
+
a && F !== "bars" ? "focus-mode" : "",
|
|
992
1009
|
F === "bars" ? "bars-mode" : "",
|
|
993
1010
|
N
|
|
994
1011
|
].filter(Boolean).join(" "),
|
|
@@ -996,24 +1013,25 @@ const wN = EL(function({
|
|
|
996
1013
|
"aria-label": "Interactive map of Ethiopia",
|
|
997
1014
|
style: L,
|
|
998
1015
|
children: [
|
|
999
|
-
/* @__PURE__ */
|
|
1000
|
-
Y &&
|
|
1016
|
+
/* @__PURE__ */ g("div", { className: "ethiopia-map-svg-host", ref: o }),
|
|
1017
|
+
Y && a && yM && F !== "bars" ? /* @__PURE__ */ g(
|
|
1001
1018
|
tL,
|
|
1002
1019
|
{
|
|
1003
1020
|
variant: "overlay",
|
|
1004
|
-
className:
|
|
1005
|
-
style:
|
|
1021
|
+
className: S,
|
|
1022
|
+
style: z,
|
|
1006
1023
|
listClassName: D,
|
|
1007
1024
|
listStyle: Q,
|
|
1008
1025
|
regionName: yM.name,
|
|
1009
1026
|
regionValue: yM.value,
|
|
1010
1027
|
services: lL,
|
|
1011
1028
|
emptyText: t,
|
|
1012
|
-
incrementalRows:
|
|
1013
|
-
|
|
1029
|
+
incrementalRows: T,
|
|
1030
|
+
onClose: () => MM(null),
|
|
1031
|
+
getBarPercent: (U) => Math.max(5, Math.round(U.value / RL(U) * 100))
|
|
1014
1032
|
}
|
|
1015
1033
|
) : null,
|
|
1016
|
-
/* @__PURE__ */
|
|
1034
|
+
/* @__PURE__ */ g(
|
|
1017
1035
|
"img",
|
|
1018
1036
|
{
|
|
1019
1037
|
src: OL,
|
|
@@ -1022,21 +1040,21 @@ const wN = EL(function({
|
|
|
1022
1040
|
"aria-hidden": "true"
|
|
1023
1041
|
}
|
|
1024
1042
|
),
|
|
1025
|
-
|
|
1043
|
+
c && F !== "bars" ? /* @__PURE__ */ R(
|
|
1026
1044
|
"button",
|
|
1027
1045
|
{
|
|
1028
1046
|
type: "button",
|
|
1029
1047
|
className: [
|
|
1030
1048
|
"ethiopia-map-layer-toggle",
|
|
1031
|
-
|
|
1032
|
-
|
|
1049
|
+
LM === "terrain" ? "is-terrain" : "is-regions",
|
|
1050
|
+
G
|
|
1033
1051
|
].filter(Boolean).join(" "),
|
|
1034
1052
|
"aria-label": `Switch to ${DL} map mode`,
|
|
1035
|
-
"aria-pressed":
|
|
1053
|
+
"aria-pressed": LM === "terrain",
|
|
1036
1054
|
onClick: () => HM(fM),
|
|
1037
1055
|
children: [
|
|
1038
|
-
/* @__PURE__ */
|
|
1039
|
-
/* @__PURE__ */
|
|
1056
|
+
/* @__PURE__ */ g("span", { className: "ethiopia-map-layer-toggle__icon", "aria-hidden": "true" }),
|
|
1057
|
+
/* @__PURE__ */ g("span", { children: DL })
|
|
1040
1058
|
]
|
|
1041
1059
|
}
|
|
1042
1060
|
) : null
|
|
@@ -1051,37 +1069,37 @@ const UN = EL(function({
|
|
|
1051
1069
|
className: N,
|
|
1052
1070
|
style: L,
|
|
1053
1071
|
svgText: j,
|
|
1054
|
-
svgUrl:
|
|
1072
|
+
svgUrl: u,
|
|
1055
1073
|
terrainImageUrl: I,
|
|
1056
|
-
inMapStatsClassName:
|
|
1057
|
-
inMapStatsStyle:
|
|
1074
|
+
inMapStatsClassName: S,
|
|
1075
|
+
inMapStatsStyle: z,
|
|
1058
1076
|
inMapStatsListClassName: D,
|
|
1059
1077
|
inMapStatsListStyle: Q,
|
|
1060
1078
|
inMapStatsEmptyText: t,
|
|
1061
|
-
incrementalRows:
|
|
1062
|
-
showLayerControl:
|
|
1063
|
-
layerControlClassName:
|
|
1064
|
-
layerControlLabels:
|
|
1079
|
+
incrementalRows: T,
|
|
1080
|
+
showLayerControl: c,
|
|
1081
|
+
layerControlClassName: G,
|
|
1082
|
+
layerControlLabels: y,
|
|
1065
1083
|
...e
|
|
1066
1084
|
}, H) {
|
|
1067
|
-
return /* @__PURE__ */
|
|
1085
|
+
return /* @__PURE__ */ g(sL, { ...e, children: /* @__PURE__ */ g(
|
|
1068
1086
|
wN,
|
|
1069
1087
|
{
|
|
1070
1088
|
ref: H,
|
|
1071
1089
|
className: N,
|
|
1072
1090
|
style: L,
|
|
1073
1091
|
svgText: j,
|
|
1074
|
-
svgUrl:
|
|
1092
|
+
svgUrl: u,
|
|
1075
1093
|
terrainImageUrl: I,
|
|
1076
|
-
inMapStatsClassName:
|
|
1077
|
-
inMapStatsStyle:
|
|
1094
|
+
inMapStatsClassName: S,
|
|
1095
|
+
inMapStatsStyle: z,
|
|
1078
1096
|
inMapStatsListClassName: D,
|
|
1079
1097
|
inMapStatsListStyle: Q,
|
|
1080
1098
|
inMapStatsEmptyText: t,
|
|
1081
|
-
incrementalRows:
|
|
1082
|
-
showLayerControl:
|
|
1083
|
-
layerControlClassName:
|
|
1084
|
-
layerControlLabels:
|
|
1099
|
+
incrementalRows: T,
|
|
1100
|
+
showLayerControl: c,
|
|
1101
|
+
layerControlClassName: G,
|
|
1102
|
+
layerControlLabels: y
|
|
1085
1103
|
}
|
|
1086
1104
|
) });
|
|
1087
1105
|
});
|
|
@@ -1093,53 +1111,53 @@ function xN({
|
|
|
1093
1111
|
title: N = "Region index",
|
|
1094
1112
|
kicker: L = "Legend",
|
|
1095
1113
|
maxItems: j,
|
|
1096
|
-
onRegionClick:
|
|
1114
|
+
onRegionClick: u
|
|
1097
1115
|
}) {
|
|
1098
|
-
const { data: I, regionColors:
|
|
1099
|
-
const
|
|
1100
|
-
return
|
|
1116
|
+
const { data: I, regionColors: S, selectedRegionId: z, selectRegion: D } = bM(), Q = AL(I), t = XM(() => {
|
|
1117
|
+
const T = Object.entries(I);
|
|
1118
|
+
return T.sort(([, c], [, G]) => G.value - c.value).slice(0, j ?? T.length);
|
|
1101
1119
|
}, [I, j]);
|
|
1102
|
-
return /* @__PURE__ */
|
|
1103
|
-
/* @__PURE__ */
|
|
1104
|
-
/* @__PURE__ */
|
|
1105
|
-
/* @__PURE__ */
|
|
1106
|
-
/* @__PURE__ */
|
|
1120
|
+
return /* @__PURE__ */ R("section", { className: ["ethiopia-map-panel", "ethiopia-map-legend", M].filter(Boolean).join(" "), children: [
|
|
1121
|
+
/* @__PURE__ */ R("div", { className: "ethiopia-map-panel-heading", children: [
|
|
1122
|
+
/* @__PURE__ */ R("div", { children: [
|
|
1123
|
+
/* @__PURE__ */ g("p", { className: "ethiopia-map-kicker", children: L }),
|
|
1124
|
+
/* @__PURE__ */ g("h2", { children: N })
|
|
1107
1125
|
] }),
|
|
1108
|
-
/* @__PURE__ */
|
|
1109
|
-
/* @__PURE__ */
|
|
1110
|
-
/* @__PURE__ */
|
|
1111
|
-
/* @__PURE__ */
|
|
1126
|
+
/* @__PURE__ */ R("div", { className: "ethiopia-map-legend-range", children: [
|
|
1127
|
+
/* @__PURE__ */ g("span", { children: "Low" }),
|
|
1128
|
+
/* @__PURE__ */ g("i", { "aria-hidden": "true" }),
|
|
1129
|
+
/* @__PURE__ */ g("span", { children: "High" })
|
|
1112
1130
|
] })
|
|
1113
1131
|
] }),
|
|
1114
|
-
/* @__PURE__ */
|
|
1115
|
-
const
|
|
1116
|
-
return /* @__PURE__ */
|
|
1132
|
+
/* @__PURE__ */ g("div", { className: "ethiopia-map-legend-list", children: t.map(([T, c]) => {
|
|
1133
|
+
const G = pM(T, I, S), y = Math.max(4, Math.round(c.value / Q * 100)), e = z === T;
|
|
1134
|
+
return /* @__PURE__ */ R(
|
|
1117
1135
|
"button",
|
|
1118
1136
|
{
|
|
1119
1137
|
className: `ethiopia-map-legend-row${e ? " active" : ""}`,
|
|
1120
1138
|
type: "button",
|
|
1121
1139
|
onClick: () => {
|
|
1122
|
-
D(e ? null :
|
|
1140
|
+
D(e ? null : T), e || u == null || u(T);
|
|
1123
1141
|
},
|
|
1124
1142
|
children: [
|
|
1125
|
-
/* @__PURE__ */
|
|
1126
|
-
/* @__PURE__ */
|
|
1127
|
-
/* @__PURE__ */
|
|
1128
|
-
/* @__PURE__ */
|
|
1129
|
-
/* @__PURE__ */
|
|
1143
|
+
/* @__PURE__ */ g("span", { className: "ethiopia-map-swatch", style: { background: G } }),
|
|
1144
|
+
/* @__PURE__ */ R("span", { className: "ethiopia-map-legend-main", children: [
|
|
1145
|
+
/* @__PURE__ */ R("span", { className: "ethiopia-map-legend-title-line", children: [
|
|
1146
|
+
/* @__PURE__ */ g("strong", { children: c.name }),
|
|
1147
|
+
/* @__PURE__ */ g("span", { children: c.trend })
|
|
1130
1148
|
] }),
|
|
1131
|
-
/* @__PURE__ */
|
|
1149
|
+
/* @__PURE__ */ g("span", { className: "ethiopia-map-legend-bar", children: /* @__PURE__ */ g(
|
|
1132
1150
|
"span",
|
|
1133
1151
|
{
|
|
1134
1152
|
className: "ethiopia-map-legend-bar-fill",
|
|
1135
|
-
style: { width: `${
|
|
1153
|
+
style: { width: `${y}%`, background: G }
|
|
1136
1154
|
}
|
|
1137
1155
|
) })
|
|
1138
1156
|
] }),
|
|
1139
|
-
/* @__PURE__ */
|
|
1157
|
+
/* @__PURE__ */ g("span", { className: "ethiopia-map-legend-value", children: vM(c.value) })
|
|
1140
1158
|
]
|
|
1141
1159
|
},
|
|
1142
|
-
|
|
1160
|
+
T
|
|
1143
1161
|
);
|
|
1144
1162
|
}) })
|
|
1145
1163
|
] });
|
|
@@ -1150,28 +1168,28 @@ function sN({
|
|
|
1150
1168
|
kicker: L = "Lat/lng overlay",
|
|
1151
1169
|
showMarkerToggle: j = !0
|
|
1152
1170
|
}) {
|
|
1153
|
-
const { locations:
|
|
1154
|
-
return /* @__PURE__ */
|
|
1155
|
-
/* @__PURE__ */
|
|
1156
|
-
/* @__PURE__ */
|
|
1157
|
-
/* @__PURE__ */
|
|
1158
|
-
/* @__PURE__ */
|
|
1171
|
+
const { locations: u, showMarkers: I } = bM();
|
|
1172
|
+
return /* @__PURE__ */ R("section", { className: ["ethiopia-map-panel", "ethiopia-locations-panel", M].filter(Boolean).join(" "), children: [
|
|
1173
|
+
/* @__PURE__ */ R("div", { className: "ethiopia-map-panel-heading", children: [
|
|
1174
|
+
/* @__PURE__ */ R("div", { children: [
|
|
1175
|
+
/* @__PURE__ */ g("p", { className: "ethiopia-map-kicker", children: L }),
|
|
1176
|
+
/* @__PURE__ */ g("h2", { children: N })
|
|
1159
1177
|
] }),
|
|
1160
|
-
j ? /* @__PURE__ */
|
|
1178
|
+
j ? /* @__PURE__ */ g("span", { className: "ethiopia-location-toggle", children: I ? "Markers on" : "Markers off" }) : null
|
|
1161
1179
|
] }),
|
|
1162
|
-
/* @__PURE__ */
|
|
1163
|
-
/* @__PURE__ */
|
|
1164
|
-
/* @__PURE__ */
|
|
1165
|
-
/* @__PURE__ */
|
|
1166
|
-
|
|
1180
|
+
/* @__PURE__ */ g("div", { className: "ethiopia-location-list", children: u.length === 0 ? /* @__PURE__ */ g("div", { className: "ethiopia-empty-state", children: "No locations provided." }) : u.map((S, z) => /* @__PURE__ */ R("div", { className: "ethiopia-location-item", children: [
|
|
1181
|
+
/* @__PURE__ */ R("div", { children: [
|
|
1182
|
+
/* @__PURE__ */ g("strong", { children: S.name ?? `Location ${z + 1}` }),
|
|
1183
|
+
/* @__PURE__ */ R("span", { children: [
|
|
1184
|
+
S.region ?? "GPS",
|
|
1167
1185
|
" - ",
|
|
1168
|
-
|
|
1186
|
+
S.lat.toFixed(2),
|
|
1169
1187
|
", ",
|
|
1170
|
-
|
|
1188
|
+
S.lng.toFixed(2)
|
|
1171
1189
|
] })
|
|
1172
1190
|
] }),
|
|
1173
|
-
|
|
1174
|
-
] },
|
|
1191
|
+
S.intensity !== void 0 ? /* @__PURE__ */ g("em", { children: S.intensity }) : null
|
|
1192
|
+
] }, S.id ?? `${S.lat}-${S.lng}-${z}`)) })
|
|
1175
1193
|
] });
|
|
1176
1194
|
}
|
|
1177
1195
|
const UL = [];
|
|
@@ -1180,22 +1198,24 @@ function ON({
|
|
|
1180
1198
|
style: N,
|
|
1181
1199
|
listClassName: L,
|
|
1182
1200
|
listStyle: j,
|
|
1183
|
-
emptyText:
|
|
1184
|
-
incrementalRows: I
|
|
1201
|
+
emptyText: u = "Select a region to inspect service statistics.",
|
|
1202
|
+
incrementalRows: I,
|
|
1203
|
+
onClose: S
|
|
1185
1204
|
}) {
|
|
1186
|
-
const { selectedRegionId:
|
|
1187
|
-
return /* @__PURE__ */
|
|
1205
|
+
const { selectedRegionId: z, selectedRegion: D, serviceStats: Q, selectRegion: t } = bM(), T = z && Q[z] || UL, c = S ?? (z ? () => t(null) : void 0);
|
|
1206
|
+
return /* @__PURE__ */ g(
|
|
1188
1207
|
tL,
|
|
1189
1208
|
{
|
|
1190
1209
|
className: M,
|
|
1191
1210
|
style: N,
|
|
1192
1211
|
listClassName: L,
|
|
1193
1212
|
listStyle: j,
|
|
1194
|
-
regionName:
|
|
1195
|
-
regionValue:
|
|
1196
|
-
services:
|
|
1197
|
-
emptyText:
|
|
1198
|
-
incrementalRows: I
|
|
1213
|
+
regionName: D == null ? void 0 : D.name,
|
|
1214
|
+
regionValue: D == null ? void 0 : D.value,
|
|
1215
|
+
services: T,
|
|
1216
|
+
emptyText: u,
|
|
1217
|
+
incrementalRows: I,
|
|
1218
|
+
onClose: c
|
|
1199
1219
|
}
|
|
1200
1220
|
);
|
|
1201
1221
|
}
|
|
@@ -1204,17 +1224,17 @@ function TN(M, N) {
|
|
|
1204
1224
|
return !L || !j ? new DOMMatrix() : L.inverse().multiply(j);
|
|
1205
1225
|
}
|
|
1206
1226
|
function uN(M, N) {
|
|
1207
|
-
const L = N.getBBox(), j = TN(M, N),
|
|
1227
|
+
const L = N.getBBox(), j = TN(M, N), u = [
|
|
1208
1228
|
new DOMPoint(L.x, L.y),
|
|
1209
1229
|
new DOMPoint(L.x + L.width, L.y),
|
|
1210
1230
|
new DOMPoint(L.x + L.width, L.y + L.height),
|
|
1211
1231
|
new DOMPoint(L.x, L.y + L.height)
|
|
1212
|
-
].map((
|
|
1232
|
+
].map((z) => z.matrixTransform(j)), I = u.map((z) => z.x), S = u.map((z) => z.y);
|
|
1213
1233
|
return {
|
|
1214
1234
|
x: Math.min(...I),
|
|
1215
|
-
y: Math.min(...
|
|
1235
|
+
y: Math.min(...S),
|
|
1216
1236
|
width: Math.max(...I) - Math.min(...I),
|
|
1217
|
-
height: Math.max(...
|
|
1237
|
+
height: Math.max(...S) - Math.min(...S)
|
|
1218
1238
|
};
|
|
1219
1239
|
}
|
|
1220
1240
|
function tN({
|
|
@@ -1222,56 +1242,56 @@ function tN({
|
|
|
1222
1242
|
emptyTitle: N = "Click a region",
|
|
1223
1243
|
emptyCopy: L = "Use the map to inspect regional values, nearby sample locations, and a focused outline view.",
|
|
1224
1244
|
showStats: j = !0,
|
|
1225
|
-
previewSelectionAnimation:
|
|
1245
|
+
previewSelectionAnimation: u,
|
|
1226
1246
|
summaryStats: I,
|
|
1227
|
-
renderPreview:
|
|
1247
|
+
renderPreview: S
|
|
1228
1248
|
}) {
|
|
1229
1249
|
const {
|
|
1230
|
-
selectedRegionId:
|
|
1250
|
+
selectedRegionId: z,
|
|
1231
1251
|
selectedRegion: D,
|
|
1232
1252
|
locations: Q,
|
|
1233
1253
|
data: t,
|
|
1234
|
-
regionColors:
|
|
1235
|
-
selectionAnimation:
|
|
1236
|
-
} = bM(),
|
|
1254
|
+
regionColors: T,
|
|
1255
|
+
selectionAnimation: c
|
|
1256
|
+
} = bM(), G = $(null), y = u ?? c, e = z ? Q.filter((J) => J.region === z) : [], H = { regionId: z, region: D }, DM = (I == null ? void 0 : I(H)) ?? (D == null ? void 0 : D.summaryStats) ?? [
|
|
1237
1257
|
{ label: "Index", value: (D == null ? void 0 : D.value) ?? null },
|
|
1238
|
-
{ label: "Locations", value:
|
|
1258
|
+
{ label: "Locations", value: z ? e.length : null },
|
|
1239
1259
|
{ label: "Trend", value: (D == null ? void 0 : D.trend) ?? null }
|
|
1240
1260
|
];
|
|
1241
1261
|
return q(() => {
|
|
1242
|
-
const
|
|
1243
|
-
if (!
|
|
1244
|
-
|
|
1245
|
-
const
|
|
1246
|
-
if (!
|
|
1247
|
-
|
|
1248
|
-
const
|
|
1249
|
-
|
|
1250
|
-
}),
|
|
1251
|
-
|
|
1262
|
+
const J = G.current;
|
|
1263
|
+
if (!J || S || !z) return;
|
|
1264
|
+
J.innerHTML = jL;
|
|
1265
|
+
const l = J.querySelector("svg");
|
|
1266
|
+
if (!l) return;
|
|
1267
|
+
l.removeAttribute("id"), l.setAttribute("aria-hidden", "true"), l.querySelectorAll("title").forEach((i) => i.remove()), l.querySelectorAll(".marker-layer, .heat-layer, .region-outline-layer, .bar-morph-layer").forEach((i) => i.remove()), LL.forEach(({ id: i, svgId: h, altSvgId: wM }) => {
|
|
1268
|
+
const b = l.querySelector(`#${CSS.escape(h)}`) || (wM ? l.querySelector(`#${CSS.escape(wM)}`) : null);
|
|
1269
|
+
b && (b.dataset.region = i, b.removeAttribute("style"), b.classList.add("map-region"), b.style.pointerEvents = "none", b.style.fill = i === z ? y === "outline" ? "rgba(255, 255, 255, 0.05)" : pM(i, t, T) : "var(--ethiopia-preview-base, #f7faf6)", b.style.opacity = i === z ? "1" : "0.16", b.style.stroke = i === z ? "#ffffff" : "var(--ethiopia-preview-stroke, rgba(42, 73, 63, 0.16))", b.style.strokeWidth = i === z ? "4px" : "2px", b.style.vectorEffect = "non-scaling-stroke", i === z && (b.classList.add("selected"), b.classList.toggle("pulse", y === "pulse"), b.classList.toggle("lifted", y === "static"), b.classList.toggle("outline-only", y === "outline")));
|
|
1270
|
+
}), l.querySelectorAll("text, tspan").forEach((i) => {
|
|
1271
|
+
i.style.opacity = "0", i.style.pointerEvents = "none";
|
|
1252
1272
|
});
|
|
1253
|
-
const
|
|
1254
|
-
`[data-region="${
|
|
1273
|
+
const o = l.querySelector(
|
|
1274
|
+
`[data-region="${z}"]`
|
|
1255
1275
|
);
|
|
1256
|
-
if (
|
|
1257
|
-
const
|
|
1258
|
-
|
|
1276
|
+
if (o) {
|
|
1277
|
+
const i = uN(l, o), h = Math.max(i.width, i.height) * 0.18;
|
|
1278
|
+
l.setAttribute(
|
|
1259
1279
|
"viewBox",
|
|
1260
|
-
`${
|
|
1280
|
+
`${i.x - h} ${i.y - h} ${i.width + h * 2} ${i.height + h * 2}`
|
|
1261
1281
|
);
|
|
1262
1282
|
}
|
|
1263
|
-
}, [t,
|
|
1264
|
-
/* @__PURE__ */
|
|
1265
|
-
/* @__PURE__ */
|
|
1266
|
-
/* @__PURE__ */
|
|
1267
|
-
/* @__PURE__ */
|
|
1268
|
-
j ? /* @__PURE__ */
|
|
1269
|
-
/* @__PURE__ */
|
|
1270
|
-
/* @__PURE__ */
|
|
1271
|
-
] },
|
|
1283
|
+
}, [t, y, T, S, z]), /* @__PURE__ */ R("section", { className: ["ethiopia-map-panel", "ethiopia-selected-region", M].filter(Boolean).join(" "), children: [
|
|
1284
|
+
/* @__PURE__ */ g("p", { className: "ethiopia-map-kicker", children: "Selected region" }),
|
|
1285
|
+
/* @__PURE__ */ g("h2", { children: (D == null ? void 0 : D.name) ?? N }),
|
|
1286
|
+
/* @__PURE__ */ g("p", { children: (D == null ? void 0 : D.copy) ?? L }),
|
|
1287
|
+
/* @__PURE__ */ g("div", { className: "ethiopia-selected-region-preview", children: S ? S({ regionId: z, region: D }) : z ? /* @__PURE__ */ g("div", { className: "ethiopia-selected-region-preview-canvas", ref: G }) : /* @__PURE__ */ g("div", { className: "ethiopia-empty-state", children: "No region selected" }) }),
|
|
1288
|
+
j ? /* @__PURE__ */ g("div", { className: "ethiopia-selected-region-stats", children: DM.slice(0, 3).map((J) => /* @__PURE__ */ R("div", { children: [
|
|
1289
|
+
/* @__PURE__ */ g("span", { children: J.label }),
|
|
1290
|
+
/* @__PURE__ */ g("strong", { children: vM(J.value) })
|
|
1291
|
+
] }, J.label)) }) : null
|
|
1272
1292
|
] });
|
|
1273
1293
|
}
|
|
1274
|
-
const
|
|
1294
|
+
const AM = (M, N, L, j) => ({
|
|
1275
1295
|
enabled: !0,
|
|
1276
1296
|
percent: M,
|
|
1277
1297
|
direction: N,
|
|
@@ -1368,28 +1388,28 @@ const jM = (M, N, L, j) => ({
|
|
|
1368
1388
|
trend: "+6%",
|
|
1369
1389
|
copy: "Historical Southern Nations, Nationalities, and Peoples' Region administrative area."
|
|
1370
1390
|
}
|
|
1371
|
-
},
|
|
1391
|
+
}, IM = (M, N, L, j) => ({
|
|
1372
1392
|
label: M,
|
|
1373
1393
|
valueKind: N,
|
|
1374
1394
|
value: L,
|
|
1375
1395
|
comparison: j ?? null
|
|
1376
1396
|
}), iN = {
|
|
1377
1397
|
amhara: [
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1398
|
+
IM("Maternal death rate", "percent", 67, AM(12, "increase", "last month", "negative")),
|
|
1399
|
+
IM("Schools", "number", 6420, AM(7, "increase", "last year", "positive")),
|
|
1400
|
+
IM("Hospitals", "number", 86, AM(5, "increase", "last year", "positive")),
|
|
1401
|
+
IM("Universities", "number", 10, AM(1, "increase", "last year", "positive")),
|
|
1402
|
+
IM("Health centers", "number", 721, AM(8, "increase", "last year", "positive"))
|
|
1383
1403
|
],
|
|
1384
1404
|
afar: [
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1405
|
+
IM("Maternal death rate", "percent", 82, AM(6, "increase", "last month", "negative")),
|
|
1406
|
+
IM("Schools", "number", 620, AM(2, "increase", "last year", "positive")),
|
|
1407
|
+
IM("Hospitals", "number", 12, AM(1, "decrease", "last year", "negative"))
|
|
1388
1408
|
],
|
|
1389
1409
|
tigray: [
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1410
|
+
IM("Maternal death rate", "percent", 64, AM(9, "decrease", "last month", "positive")),
|
|
1411
|
+
IM("Schools", "number", 1840, AM(4, "increase", "last year", "positive")),
|
|
1412
|
+
IM("Hospitals", "number", 31, AM(3, "increase", "last year", "positive"))
|
|
1393
1413
|
]
|
|
1394
1414
|
}, YN = [
|
|
1395
1415
|
{ name: "Addis Ababa", region: "addis-ababa", lat: 9.03, lng: 38.74, intensity: 96 },
|