@devgateway/dvz-ui-react 1.9.11 → 1.9.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/cjs/embeddable/d3Map/DataLayer.js +1 -1
  2. package/dist/cjs/embeddable/d3Map/FlowLayer.js +1 -1
  3. package/dist/cjs/embeddable/d3Map/LatLongLayer.js +1 -1
  4. package/dist/cjs/embeddable/d3Map/Legends.js +1 -1
  5. package/dist/cjs/embeddable/d3Map/Tooltip.js +1 -1
  6. package/dist/cjs/embeddable/d3Map/Utils.js +1 -1
  7. package/dist/cjs/embeddable/data/D3MapDataProvider.js +1 -1
  8. package/dist/cjs/embeddable/filter/index.js +1 -1
  9. package/dist/cjs/embeddable/map/index.js +2 -2
  10. package/dist/cjs/embeddable/map/map.js +4 -4
  11. package/dist/cjs/embeddable/map/mapHelpers.js +1 -1
  12. package/dist/cjs/embeddable/tabbedposts/index.js +1 -1
  13. package/dist/cjs/styles.css +1 -1
  14. package/dist/esm/embeddable/d3Map/DataLayer.js +322 -311
  15. package/dist/esm/embeddable/d3Map/FlowLayer.js +105 -99
  16. package/dist/esm/embeddable/d3Map/LatLongLayer.js +106 -100
  17. package/dist/esm/embeddable/d3Map/Legends.js +151 -147
  18. package/dist/esm/embeddable/d3Map/Tooltip.js +64 -20
  19. package/dist/esm/embeddable/d3Map/Utils.js +26 -12
  20. package/dist/esm/embeddable/data/D3MapDataProvider.js +31 -30
  21. package/dist/esm/embeddable/filter/index.js +123 -123
  22. package/dist/esm/embeddable/map/index.js +77 -77
  23. package/dist/esm/embeddable/map/map.js +436 -453
  24. package/dist/esm/embeddable/map/mapHelpers.js +88 -104
  25. package/dist/esm/embeddable/tabbedposts/index.js +12 -12
  26. package/dist/esm/styles.css +1 -1
  27. package/dist/types/embeddable/d3Map/Utils.d.ts +4 -0
  28. package/dist/types/embeddable/map/mapHelpers.d.ts +0 -2
  29. package/package.json +1 -1
@@ -1,163 +1,161 @@
1
- import { jsxs as b, Fragment as Ke, jsx as p } from "react/jsx-runtime";
2
- import { injectIntl as nr, FormattedMessage as ar } from "react-intl";
3
- import * as c from "d3";
4
- import { Icon as te, Popup as or, Message as xe, Container as Qe, Segment as sr, Dimmer as ir, Loader as cr, Grid as Fe } from "semantic-ui-react";
5
- import { useState as re, useRef as L, useEffect as et } from "react";
6
- import ur from "./legend.js";
7
- import { formatContent as k } from "../common/MapTooltip.js";
8
- import N from "../../utils/deviceType.js";
9
- import { deviceTranslateMap as pr, getFilters as we, deviceMapHeight as dr, deviceMapWidth as tt, getHighlightedLocationColor as mr, getTranslatedItemLabel as fr, SHOW_ALL as rt, SHOW_IF_HAS_DATA as lt, LOCATION as nt, generateBreaks as gr, fillColor as hr, classColor as yr, getTranslatedLocationName as Ae, getLabelBoxWidth as vr, getLabelBoxHeight as br, createLabel as Lr, extractFeatures as xr } from "./mapHelpers.js";
10
- import { Config as Fr } from "../../conf/index.js";
11
- const wr = ["mobile", "tablet", "midTablet"].includes(
12
- N()
13
- ), at = ["mobile", "tablet"].includes(N());
14
- function Ar(O) {
1
+ import { jsxs as b, Fragment as qe, jsx as p } from "react/jsx-runtime";
2
+ import { injectIntl as rr, FormattedMessage as lr } from "react-intl";
3
+ import * as u from "d3";
4
+ import { Icon as te, Popup as or, Message as Le, Container as Ke, Segment as nr, Dimmer as ar, Loader as sr, Grid as xe } from "semantic-ui-react";
5
+ import { useState as re, useRef as M, useEffect as Qe } from "react";
6
+ import ir from "./legend.js";
7
+ import { formatContent as T } from "../common/MapTooltip.js";
8
+ import O from "../../utils/deviceType.js";
9
+ import { getFilters as Fe, deviceMapHeight as cr, getHighlightedLocationColor as ur, getTranslatedItemLabel as pr, SHOW_ALL as et, SHOW_IF_HAS_DATA as tt, LOCATION as rt, generateBreaks as dr, fillColor as mr, classColor as fr, getTranslatedLocationName as we, getLabelBoxWidth as gr, getLabelBoxHeight as hr, createLabel as yr, extractFeatures as br } from "./mapHelpers.js";
10
+ import { Config as vr } from "../../conf/index.js";
11
+ const Lr = ["mobile", "tablet", "midTablet"].includes(
12
+ O()
13
+ ), lt = ["mobile", "tablet"].includes(O());
14
+ function xr(_) {
15
15
  const {
16
- unique: Me,
16
+ unique: Ae,
17
17
  editing: j,
18
- source: Te,
18
+ source: Me,
19
19
  center: le,
20
- scale: ke,
21
- height: Ne,
20
+ scale: Te,
21
+ height: ke,
22
22
  width: ot,
23
- topoJSONField: st,
24
- mappingField: y,
25
- transformedData: u,
23
+ topoJSONField: nt,
24
+ mappingField: h,
25
+ transformedData: c,
26
26
  legendBreaks: Ee,
27
- mapLabelField: x,
28
- mapLabelShowValue: ne,
29
- showOverallValue: ze,
30
- measureSelectorLabel: Ie,
31
- valueFormat: Ce,
32
- autoGenerateBreaks: De,
33
- showNoDataLabel: Pe,
34
- numberOfBreaks: it,
35
- colorScheme: ct,
27
+ mapLabelField: v,
28
+ mapLabelShowValue: oe,
29
+ showOverallValue: Ne,
30
+ measureSelectorLabel: ze,
31
+ valueFormat: De,
32
+ autoGenerateBreaks: Ie,
33
+ showNoDataLabel: Ce,
34
+ numberOfBreaks: at,
35
+ colorScheme: st,
36
36
  symbols: Se,
37
- tooltipTheme: ut,
38
- labelFontSize: K,
37
+ tooltipTheme: it,
38
+ labelFontSize: J,
39
39
  labelFontColor: Oe,
40
- labelFontWeight: pt,
41
- legendFontSize: dt,
42
- customTooltips: mt,
43
- tooltipFontSize: ft,
44
- showAdminUnitLabel: ae,
45
- mapNoDataColor: We,
46
- mapBoundaryColor: gt,
47
- mapFocusBoundaryColor: ht,
48
- highlightedLocation: C,
40
+ labelFontWeight: ct,
41
+ legendFontSize: ut,
42
+ customTooltips: pt,
43
+ tooltipFontSize: dt,
44
+ showAdminUnitLabel: ne,
45
+ mapNoDataColor: Pe,
46
+ mapBoundaryColor: mt,
47
+ mapFocusBoundaryColor: ft,
48
+ highlightedLocation: D,
49
49
  tooltipFormat: Re,
50
- showNoDataTooltip: yt,
51
- fields: vt,
52
- mapContainerBgColor: bt,
53
- mapPosition: h,
54
- mainLayerId: W,
55
- enabledLayers: D,
56
- pointLabelColor: Lt,
57
- pointLabelFormat: xt,
58
- highlightedLocLabelFormat: Ft,
59
- mapType: H,
60
- defaultPointColor: Be,
61
- zoomOnFilter: wt,
62
- zoomOnFilterField: P,
63
- noDataText: At,
64
- labelsExclusionList: oe,
65
- showShadingLayerLabels: _e,
50
+ showNoDataTooltip: gt,
51
+ fields: ht,
52
+ mapContainerBgColor: yt,
53
+ mapPosition: L,
54
+ mainLayerId: P,
55
+ enabledLayers: I,
56
+ pointLabelColor: bt,
57
+ pointLabelFormat: vt,
58
+ highlightedLocLabelFormat: Lt,
59
+ mapType: X,
60
+ defaultPointColor: We,
61
+ zoomOnFilter: xt,
62
+ zoomOnFilterField: C,
63
+ noDataText: Ft,
64
+ labelsExclusionList: ae,
65
+ showShadingLayerLabels: Be,
66
66
  appliedFilters: m,
67
- intl: F,
68
- legendTitle: Mt,
69
- nationalAverageLabel: Tt,
67
+ intl: x,
68
+ legendTitle: wt,
69
+ nationalAverageLabel: At,
70
70
  zoomEnabled: se,
71
71
  showTooltip: ie
72
- } = O;
73
- console.log("Map props:", O);
74
- const [R, kt] = re(
75
- () => u && u.measures && u.measures.length > 1 ? u.measures[0] : null
76
- ), [$, Nt] = re(null), [je, ce] = re(!1), [B, ue] = re(null), pe = L(null), w = L(null), v = L(null), U = L(null), A = L(null), He = L(null), E = L(null), $e = L(!1), de = L(null), me = L(null), M = L({}), fe = L(null), J = (u == null ? void 0 : u.types) || [];
77
- function ge() {
78
- return pe.current ? pe.current.offsetWidth : ot;
72
+ } = _, [R, Mt] = re(
73
+ () => c && c.measures && c.measures.length > 1 ? c.measures[0] : null
74
+ ), [H, Tt] = re(null), [_e, ce] = re(!1), [W, ue] = re(null), F = M(null), y = M(null), $ = M(null), k = M(null), E = M(null), je = M(!1), pe = M(null), de = M(null), w = M({}), me = M(null), Z = (c == null ? void 0 : c.types) || [];
75
+ function fe() {
76
+ return ot;
79
77
  }
80
- function he() {
81
- return Ne;
78
+ function ge() {
79
+ return ke - 100;
82
80
  }
83
- A.current === null && (A.current = c.zoom().scaleExtent([1, 16]).on("zoom", (e) => M.current.zoomed(e)).on("end", (e) => M.current.zoomEnd(e))), v.current === null && (He.current = pr[N()], v.current = c.geoMercator().scale(ke).center(le).translate([ge() / He.current, he() / 2]), U.current = c.geoPath().projection(v.current));
84
- function g() {
85
- return ".map.wrapper." + Me;
81
+ k.current === null && (k.current = u.zoom().scaleExtent([1, 16]).on("zoom", (e) => w.current.zoomed(e)).on("end", (e) => w.current.zoomEnd(e))), y.current === null && (y.current = u.geoMercator().scale(Te).center(le).translate([fe() / 2, ge() / 2]), $.current = u.geoPath().projection(y.current));
82
+ function f() {
83
+ return ".map.wrapper." + Ae;
86
84
  }
87
- function z() {
85
+ function N() {
88
86
  let e = R;
89
- return !e && u && u.measures && u.measures.length > 1 && (e = u.measures[0]), e;
87
+ return !e && c && c.measures && c.measures.length > 1 && (e = c.measures[0]), e;
90
88
  }
91
- function Ue() {
92
- return B && B.length > 0 ? B.map((t) => {
93
- const o = D.find((n) => n.id == t.id);
94
- return t.index = o ? o.index : 0, t;
95
- }).sort((t, o) => parseInt(t.index) < parseInt(o.index) ? 1 : parseInt(t.index) > parseInt(o.index) ? -1 : 0) : [];
89
+ function He() {
90
+ return W && W.length > 0 ? W.map((t) => {
91
+ const a = I.find((l) => l.id == t.id);
92
+ return t.index = a ? a.index : 0, t;
93
+ }).sort((t, a) => parseInt(t.index) < parseInt(a.index) ? 1 : parseInt(t.index) > parseInt(a.index) ? -1 : 0) : [];
96
94
  }
97
- function Et() {
98
- const e = Ue();
95
+ function kt() {
96
+ const e = He();
99
97
  let t;
100
- return e && (t = e.filter((o) => o.id == W || o.id == null)[0] || e[0]), t ? t.data : null;
98
+ return e && (t = e.filter((a) => a.id == P || a.id == null)[0] || e[0]), t ? t.data : null;
101
99
  }
102
- function Ve(e) {
103
- return xr(e, st);
100
+ function $e(e) {
101
+ return br(e, nt);
104
102
  }
105
- function X() {
106
- const e = Et(), t = Ue();
103
+ function Y() {
104
+ const e = kt(), t = He();
107
105
  if (e) {
108
- let o = [];
106
+ let a = [];
109
107
  try {
110
- o = Ve(e), o.map((l) => {
111
- l.properties.layerId = W;
108
+ a = $e(e), a.map((o) => {
109
+ o.properties.layerId = P;
112
110
  const r = t.find(
113
- (a) => String(a.id) === String(W)
111
+ (n) => String(n.id) === String(P)
114
112
  );
115
- return r && (l.properties.layerMappingField = r.layerMappingField, l.properties.layerDatasource = r.layerDatasource, l.properties.layerApiField = r.layerApiField, l.properties.layerLocale = r.layerLocale, l.properties.displayLayerLabels = r.displayLayerLabels), D.forEach((a) => {
116
- String(a.id) == W && Object.keys(a || {}).forEach((s) => {
117
- l.properties[s] = a[s];
113
+ return r && (o.properties.layerMappingField = r.layerMappingField, o.properties.layerDatasource = r.layerDatasource, o.properties.layerApiField = r.layerApiField, o.properties.layerLocale = r.layerLocale, o.properties.displayLayerLabels = r.displayLayerLabels), I.forEach((n) => {
114
+ String(n.id) == P && Object.keys(n || {}).forEach((s) => {
115
+ o.properties[s] = n[s];
118
116
  });
119
- }), l;
120
- }), t && t.forEach((l) => {
121
- if (l.id != W) {
122
- let r = Ve(l.data);
123
- r = r.map((a) => (a.properties.layerId = l.id, a.properties.layerMappingField = l.layerMappingField, a.properties.layerDatasource = l.layerDatasource, a.properties.layerApiField = l.layerApiField, a.properties.layerLocale = l.layerLocale, a.properties.displayLayerLabels = l.displayLayerLabels, a)), o = [...r, ...o];
117
+ }), o;
118
+ }), t && t.forEach((o) => {
119
+ if (o.id != P) {
120
+ let r = $e(o.data);
121
+ r = r.map((n) => (n.properties.layerId = o.id, n.properties.layerMappingField = o.layerMappingField, n.properties.layerDatasource = o.layerDatasource, n.properties.layerApiField = o.layerApiField, n.properties.layerLocale = o.layerLocale, n.properties.displayLayerLabels = o.displayLayerLabels, n)), a = [...r, ...a];
124
122
  }
125
123
  });
126
- } catch (l) {
127
- console.log("error updating features .." + l);
124
+ } catch (o) {
125
+ console.log("error updating features .." + o);
128
126
  }
129
- const n = o.filter((l) => l.properties != null);
130
- let i = u.locationsData;
131
- return u.measures && u.measures.length > 1 && (i = u.locationsData.filter(
132
- (l) => l.measure === z()
133
- )), n.map((l) => {
127
+ const l = a.filter((o) => o.properties != null);
128
+ let i = c.locationsData;
129
+ return c.measures && c.measures.length > 1 && (i = c.locationsData.filter(
130
+ (o) => o.measure === N()
131
+ )), l.map((o) => {
134
132
  if (i) {
135
- const r = i.find((a) => {
136
- const s = a.label ? ("" + a.label).toLowerCase() : "", d = l.properties[y] ? l.properties[y].toLowerCase() : "";
133
+ const r = i.find((n) => {
134
+ const s = n.label ? ("" + n.label).toLowerCase() : "", d = o.properties[h] ? o.properties[h].toLowerCase() : "";
137
135
  return s === d;
138
136
  });
139
137
  if (r) {
140
- let a = r.measure;
141
- u.measureLabelMap && r.measure && u.measureLabelMap[r.measure] && (a = u.measureLabelMap[r.measure]), l.properties.value = r.value, l.properties.measure = r.measure, l.properties.measureLabel = a, l.properties.children = r.children, l.properties.variables = r.variables, l.properties.hasDataRow = !0, Object.keys(r).forEach((s) => {
142
- l.properties[s] = r[s];
138
+ let n = r.measure;
139
+ c.measureLabelMap && r.measure && c.measureLabelMap[r.measure] && (n = c.measureLabelMap[r.measure]), o.properties.value = r.value, o.properties.measure = r.measure, o.properties.measureLabel = n, o.properties.children = r.children, o.properties.variables = r.variables, o.properties.hasDataRow = !0, Object.keys(r).forEach((s) => {
140
+ o.properties[s] = r[s];
143
141
  });
144
142
  } else
145
- l.properties.value = null, l.properties.measure = null, l.properties.children = null, l.properties.measureLabel = null, l.properties.hasDataRow = !1;
143
+ o.properties.value = null, o.properties.measure = null, o.properties.children = null, o.properties.measureLabel = null, o.properties.hasDataRow = !1;
146
144
  }
147
- }), n;
145
+ }), l;
148
146
  }
149
147
  return [];
150
148
  }
151
- function Ge() {
152
- if (ue([]), ce(!0), D && D.length > 0) {
149
+ function Ue() {
150
+ if (ue([]), ce(!0), I && I.length > 0) {
153
151
  const e = [];
154
- D.forEach((t) => {
152
+ I.forEach((t) => {
155
153
  e.push(
156
- new Promise((o) => {
157
- c.json(Fr.REACT_APP_WP_API + "/wp/v2/media/" + t.id).then((n) => {
158
- o({
154
+ new Promise((a) => {
155
+ u.json(vr.REACT_APP_WP_API + "/wp/v2/media/" + t.id).then((l) => {
156
+ a({
159
157
  id: t.id,
160
- url: n.source_url,
158
+ url: l.source_url,
161
159
  index: t.index,
162
160
  layerMappingField: t.layerMappingField,
163
161
  layerDatasource: t.datasource,
@@ -166,7 +164,7 @@ function Ar(O) {
166
164
  displayLayerLabels: t.displayLayerLabels
167
165
  });
168
166
  }).catch(function() {
169
- o({
167
+ a({
170
168
  id: t.id,
171
169
  url: null,
172
170
  index: t.index,
@@ -180,34 +178,34 @@ function Ar(O) {
180
178
  })
181
179
  );
182
180
  }), Promise.all(e).then((t) => {
183
- const o = [];
184
- t.forEach((n) => {
185
- n.url && o.push(
181
+ const a = [];
182
+ t.forEach((l) => {
183
+ l.url && a.push(
186
184
  new Promise((i) => {
187
- c.json(n.url).then((l) => {
185
+ u.json(l.url).then((o) => {
188
186
  i({
189
- id: n.id,
190
- data: l,
191
- index: n.index,
192
- layerMappingField: n.layerMappingField,
193
- layerDatasource: n.layerDatasource,
194
- layerApiField: n.layerApiField,
195
- layerLocale: n.layerLocale,
196
- displayLayerLabels: n.displayLayerLabels
187
+ id: l.id,
188
+ data: o,
189
+ index: l.index,
190
+ layerMappingField: l.layerMappingField,
191
+ layerDatasource: l.layerDatasource,
192
+ layerApiField: l.layerApiField,
193
+ layerLocale: l.layerLocale,
194
+ displayLayerLabels: l.displayLayerLabels
197
195
  });
198
196
  });
199
197
  })
200
198
  );
201
- }), Promise.all(o).then((n) => {
202
- ue(n), ce(!1);
199
+ }), Promise.all(a).then((l) => {
200
+ ue(l), ce(!1);
203
201
  });
204
202
  });
205
203
  } else
206
- c.json(Te).then((e) => {
204
+ u.json(Me).then((e) => {
207
205
  ue([
208
206
  {
209
207
  id: null,
210
- url: Te,
208
+ url: Me,
211
209
  data: e,
212
210
  index: 0,
213
211
  layerMappingField: null,
@@ -219,86 +217,86 @@ function Ar(O) {
219
217
  ]), ce(!1);
220
218
  });
221
219
  }
222
- function zt(e) {
223
- c.select(g()).select("svg").selectAll("circle").attr("r", e.k > 1 ? 6 / e.k : 6);
220
+ function Et(e) {
221
+ u.select(f()).select("svg").selectAll("circle").attr("r", e.k > 1 ? 6 / e.k : 6);
224
222
  }
225
- function _(e) {
226
- return vr(e, x);
223
+ function B(e) {
224
+ return gr(e, v);
227
225
  }
228
- function Q() {
229
- return br(ne);
226
+ function ee() {
227
+ return hr(oe);
230
228
  }
231
- function ye(e) {
232
- return e.properties.LABEL_LATITUDE && e.properties.LABEL_LONGITUDE ? v.current([
229
+ function he(e) {
230
+ return e.properties.LABEL_LATITUDE && e.properties.LABEL_LONGITUDE ? y.current([
233
231
  e.properties.LABEL_LONGITUDE,
234
232
  e.properties.LABEL_LATITUDE
235
- ]) : U.current.centroid(e);
236
- }
237
- function It(e) {
238
- c.select(g()).selectAll(".map-labels-container").each((t, o, n) => {
239
- const i = c.select(n[o]), l = i.select("div"), r = e.k > 1 ? e.k : 1, a = K / r;
240
- l.style("font-size", `${a}px`);
241
- const s = ye(t), d = _(t) / r, f = s[0] - d / 2, T = e.k > 1 ? 10 / e.k : 10, S = s[1] - T;
242
- i.attr("x", f).attr("y", S).attr("width", _(t) / r).attr("height", Q() / r);
233
+ ]) : $.current.centroid(e);
234
+ }
235
+ function Nt(e) {
236
+ u.select(f()).selectAll(".map-labels-container").each((t, a, l) => {
237
+ const i = u.select(l[a]), o = i.select("div"), r = O() === "mobile" || O() === "tablet", n = e.k > 1 ? e.k : 1, s = r ? J * 0.6 : J / n, d = r ? 1 : n;
238
+ o.style("font-size", `${s}px`);
239
+ const g = he(t), A = B(t) / d, S = g[0] - A / 2, V = r ? 10 : e.k > 1 ? 10 / e.k : 10, Ye = g[1] - V;
240
+ i.attr("x", S).attr("y", Ye).attr("width", B(t) / d).attr("height", ee() / d);
243
241
  });
244
242
  }
245
- function Ct(e) {
246
- c.select(g()).selectAll(".point-labels-container").each((t, o, n) => {
247
- const i = c.select(n[o]), l = i.select("div"), r = e.k > 1 ? e.k : 1, a = K / r;
248
- l.style("font-size", `${a}px`);
249
- const s = v.current([
243
+ function zt(e) {
244
+ u.select(f()).selectAll(".point-labels-container").each((t, a, l) => {
245
+ const i = u.select(l[a]), o = i.select("div"), r = e.k > 1 ? e.k : 1, n = J / r;
246
+ o.style("font-size", `${n}px`);
247
+ const s = y.current([
250
248
  t.geometry.coordinates[1],
251
249
  t.geometry.coordinates[0]
252
- ]), d = (_(t) + 20) / r, f = Q() / r, T = s[0] - d / 2, S = s[1] - f / 2;
253
- i.attr("x", T).attr("y", S).attr("width", d).attr("height", f);
250
+ ]), d = (B(t) + 20) / r, g = ee() / r, A = s[0] - d / 2, S = s[1] - g / 2;
251
+ i.attr("x", A).attr("y", S).attr("width", d).attr("height", g);
254
252
  });
255
253
  }
256
254
  function Dt(e) {
257
- w.current.style("visibility", "hidden");
255
+ F.current.style("visibility", "hidden");
258
256
  const t = e.transform;
259
- c.select(g()).select("svg").select("g").attr("transform", t), zt(t), It(t), Ct(t);
257
+ u.select(f()).select("svg").select("g").attr("transform", t), Et(t), Nt(t), zt(t);
260
258
  }
261
- function Pt(e) {
259
+ function It(e) {
262
260
  const t = e.transform;
263
261
  E.current = { k: t.k, x: t.x, y: t.y }, j && window.parent.postMessage(
264
262
  { type: "map", value: JSON.stringify(E.current) },
265
263
  "*"
266
264
  );
267
265
  }
268
- function St() {
269
- const e = c.select(g()).select("svg");
266
+ function Ct() {
267
+ const e = u.select(f()).select("svg");
270
268
  e.select("g").selectAll(".active").attr("class", function() {
271
- return c.select(this).attr("class").replace(/background/gi, "");
269
+ return u.select(this).attr("class").replace(/background/gi, "");
272
270
  });
273
- let o = c.zoomIdentity;
274
- h && !j ? o = o.translate(h.x, h.y).scale(h.k) : o = o.translate(0, 0).scale(1), e.transition().duration(300).call(A.current.transform, o);
271
+ let a = u.zoomIdentity;
272
+ L && !j ? a = a.translate(L.x, L.y).scale(L.k) : a = a.translate(0, 0).scale(1), e.transition().duration(300).call(k.current.transform, a);
275
273
  }
276
- function Je() {
277
- E.current = null, w.current.style("visibility", "hidden"), St();
274
+ function Ge() {
275
+ E.current = null, F.current.style("visibility", "hidden"), Ct();
276
+ }
277
+ function St() {
278
+ u.select(f()).select("svg").transition().call(k.current.scaleBy, 1.5);
278
279
  }
279
280
  function Ot() {
280
- c.select(g()).select("svg").transition().call(A.current.scaleBy, 1.5);
281
- }
282
- function Wt() {
283
- c.select(g()).select("svg").transition().call(A.current.scaleBy, 0.6667);
284
- }
285
- function Z() {
286
- if (De) {
287
- const e = X();
288
- return gr(e, {
289
- autoGenerateBreaks: De,
290
- numberOfBreaks: it,
291
- colorScheme: ct
281
+ u.select(f()).select("svg").transition().call(k.current.scaleBy, 0.6667);
282
+ }
283
+ function q() {
284
+ if (Ie) {
285
+ const e = Y();
286
+ return dr(e, {
287
+ autoGenerateBreaks: Ie,
288
+ numberOfBreaks: at,
289
+ colorScheme: st
292
290
  });
293
291
  } else {
294
292
  let e = Ee;
295
- return z() && (e = Ee.filter((t) => t.measure === z()).filter((t) => {
293
+ return N() && (e = Ee.filter((t) => t.measure === N()).filter((t) => {
296
294
  if (t.filters && t.filters.length > 0 && m && JSON.stringify(m) !== "{}") {
297
- const n = Object.keys(m);
298
- return t.filters.filter((l) => {
299
- if (n.indexOf(l.field) != -1) {
300
- const r = m[l.field], a = l.values;
301
- return r.join(",").indexOf(a) != -1;
295
+ const l = Object.keys(m);
296
+ return t.filters.filter((o) => {
297
+ if (l.indexOf(o.field) != -1) {
298
+ const r = m[o.field], n = o.values;
299
+ return r.join(",").indexOf(n) != -1;
302
300
  }
303
301
  return !1;
304
302
  }).length > 0;
@@ -307,431 +305,416 @@ function Ar(O) {
307
305
  })), e;
308
306
  }
309
307
  }
310
- function ve(e, t) {
311
- return hr(e, t, {
312
- mapNoDataColor: We,
313
- mainLayerId: W,
314
- enabledLayers: D,
308
+ function ye(e, t) {
309
+ return mr(e, t, {
310
+ mapNoDataColor: Pe,
311
+ mainLayerId: P,
312
+ enabledLayers: I,
315
313
  selectedMeasure: R
316
314
  });
317
315
  }
318
- function Rt(e) {
319
- return Lr(
316
+ function Pt(e) {
317
+ return yr(
320
318
  e,
321
319
  {
322
- mapLabelField: x,
323
- mapLabelShowValue: ne,
324
- intl: F,
325
- valueFormat: Ce,
326
- showNoDataLabel: Pe,
327
- showAdminUnitLabel: ae,
328
- noDataText: At,
329
- selectedMeasure: z()
320
+ mapLabelField: v,
321
+ mapLabelShowValue: oe,
322
+ intl: x,
323
+ valueFormat: De,
324
+ showNoDataLabel: Ce,
325
+ showAdminUnitLabel: ne,
326
+ noDataText: Ft,
327
+ selectedMeasure: N()
330
328
  },
331
- J,
332
- k
329
+ Z,
330
+ T
333
331
  );
334
332
  }
335
- function Xe(e, t) {
336
- const o = [
337
- ...e.filter((n) => C != n.properties[x]),
338
- ...e.filter((n) => C == n.properties[x])
333
+ function Ve(e, t) {
334
+ const a = [
335
+ ...e.filter((l) => D != l.properties[v]),
336
+ ...e.filter((l) => D == l.properties[v])
339
337
  ];
340
- _t(o), Bt(o), jt(o, t), Se.length > 0 && Ht(Se, o);
338
+ Wt(a), Rt(a), Bt(a, t), Se.length > 0 && _t(Se, a);
341
339
  }
342
- function Bt(e) {
343
- const t = c.select(g()).select("svg").select("g");
340
+ function Rt(e) {
341
+ const t = u.select(f()).select("svg").select("g");
344
342
  if (t.selectAll(".map-labels-container").size() > 0) {
345
343
  console.log("Labels already exist, skipping redraw...");
346
344
  return;
347
345
  }
348
346
  t.selectAll(".map-labels").data(
349
- e.filter((n) => oe && oe.length > 0 ? !oe.includes(n.properties[x]) : !0)
350
- ).enter().append("foreignObject").attr("class", "map-labels-container").attr("x", (n) => {
351
- const i = ye(n);
352
- if (n.properties[x]) {
353
- const l = _(n);
354
- return i[0] - l / 2;
347
+ e.filter((l) => ae && ae.length > 0 ? !ae.includes(l.properties[v]) : !0)
348
+ ).enter().append("foreignObject").attr("class", "map-labels-container").attr("x", (l) => {
349
+ const i = he(l);
350
+ if (l.properties[v]) {
351
+ const o = B(l);
352
+ return i[0] - o / 2;
355
353
  }
356
354
  return i[0];
357
- }).attr("y", (n) => ye(n)[1] - 10).attr("width", (n) => _(n)).attr("height", (n) => Q()).attr("font-size", () => `${K}px`).attr("overflow", "visible").attr("opacity", 1).style("display", (n) => ae === rt || ae === lt && n.properties.hasDataRow || n.properties.displayLayerLabels ? "block" : "none").attr("pointer-events", H == "POINTS_MAP" ? "none" : "all").on("mouseover", V).on("mousemove", Y).on("mouseout", G).append("xhtml:div").style("font-size", () => `${K}px`).style("color", () => Oe).style("font-weight", () => pt).style("background-color", (n) => n.properties.hasDataRow && ne && (n.properties.value != null || n.properties.value == null && Pe) ? "#fff6e1" : "none").style("border-radius", () => "4px").style("line-height", "95%").style("text-align", "center").html((n) => Rt(n));
355
+ }).attr("y", (l) => he(l)[1] - 10).attr("width", (l) => B(l)).attr("height", (l) => ee()).attr("font-size", () => `${J}px`).attr("overflow", "visible").attr("opacity", 1).style("display", (l) => ne === et || ne === tt && l.properties.hasDataRow || l.properties.displayLayerLabels ? "block" : "none").attr("pointer-events", X == "POINTS_MAP" ? "none" : "all").on("mouseover", U).on("mousemove", K).on("mouseout", G).append("xhtml:div").style("font-size", () => `${J}px`).style("color", () => Oe).style("font-weight", () => ct).style("background-color", (l) => l.properties.hasDataRow && oe && (l.properties.value != null || l.properties.value == null && Ce) ? "#fff6e1" : "none").style("border-radius", () => "4px").style("line-height", "95%").style("text-align", "center").html((l) => Pt(l));
358
356
  }
359
- function _t(e) {
360
- const t = Z(), o = c.select(g()).select("svg").select("g"), n = e.filter(
357
+ function Wt(e) {
358
+ const t = q(), a = u.select(f()).select("svg").select("g"), l = e.filter(
361
359
  (i) => i.geometry && i.geometry && (i.geometry.type == "Polygon" || i.geometry.type == "MultiPolygon")
362
360
  );
363
- n.length > 0 && o.selectAll("path").data(n).join("path").attr("d", U.current).attr("fill", (i) => ve(i, t)).attr("stroke-width", (i) => C == i.properties[x] ? 1.2 : 0.4).attr("stroke", (i) => C == i.properties[x] ? ht : gt).on("click", Ut);
364
- }
365
- function jt(e, t) {
366
- const o = c.select(g()).select("svg").select("g");
367
- let n = [];
368
- if (u.pointsData) {
369
- let r = $;
370
- t && m && m[P] && (r = m[P]), n = u.pointsData.filter((a) => a.lat && a.lng && a.label == r).map((a) => ({
361
+ l.length > 0 && a.selectAll("path").data(l).join("path").attr("d", $.current).attr("fill", (i) => ye(i, t)).attr("stroke-width", (i) => D == i.properties[v] ? 1.2 : 0.4).attr("stroke", (i) => D == i.properties[v] ? ft : mt).on("click", Ht);
362
+ }
363
+ function Bt(e, t) {
364
+ const a = u.select(f()).select("svg").select("g");
365
+ let l = [];
366
+ if (c.pointsData) {
367
+ let r = H;
368
+ t && m && m[C] && (r = m[C]), l = c.pointsData.filter((n) => n.lat && n.lng && n.label == r).map((n) => ({
371
369
  properties: {
372
- label: a.label,
373
- lat: a.lat,
374
- lng: a.lng,
375
- value: a.value,
376
- variables: a.variables
370
+ label: n.label,
371
+ lat: n.lat,
372
+ lng: n.lng,
373
+ value: n.value,
374
+ variables: n.variables
377
375
  }
378
- })), o.selectAll(".circle").data(n).enter().append("circle").attr("id", (a, s) => "circle" + s).attr("cx", (a) => v.current([a.properties.lng, a.properties.lat])[0]).attr("cy", (a) => v.current([a.properties.lng, a.properties.lat])[1]).attr("r", () => 2).style("stroke-width", 0.5).style("fill", () => Be).on("mouseover", (a, s) => $t(a, s)).on("mouseout", G);
376
+ })), a.selectAll(".circle").data(l).enter().append("circle").attr("id", (n, s) => "circle" + s).attr("cx", (n) => y.current([n.properties.lng, n.properties.lat])[0]).attr("cy", (n) => y.current([n.properties.lng, n.properties.lat])[1]).attr("r", () => 2).style("stroke-width", 0.5).style("fill", () => We).on("mouseover", (n, s) => jt(n, s)).on("mouseout", G);
379
377
  }
380
- const i = Z();
381
- let l = [];
382
- _e == rt ? l = e.filter((r) => r.geometry && r.geometry.type == "Point") : _e == lt && (l = e.filter(
378
+ const i = q();
379
+ let o = [];
380
+ Be == et ? o = e.filter((r) => r.geometry && r.geometry.type == "Point") : Be == tt && (o = e.filter(
383
381
  (r) => r.geometry && r.geometry.type == "Point" && r.properties.hasDataRow
384
- )), l.length > 0 && o.selectAll(".point-labels").data(l).enter().append("foreignObject").attr("id", (r, a) => "point-label" + a).attr("class", "point-labels-container").attr("x", (r) => {
385
- const a = _(r) + 20;
386
- return v.current([
382
+ )), o.length > 0 && a.selectAll(".point-labels").data(o).enter().append("foreignObject").attr("id", (r, n) => "point-label" + n).attr("class", "point-labels-container").attr("x", (r) => {
383
+ const n = B(r) + 20;
384
+ return y.current([
387
385
  r.geometry.coordinates[1],
388
386
  r.geometry.coordinates[0]
389
- ])[0] - a / 2;
390
- }).attr("y", (r) => v.current([
387
+ ])[0] - n / 2;
388
+ }).attr("y", (r) => y.current([
391
389
  r.geometry.coordinates[1],
392
390
  r.geometry.coordinates[0]
393
- ])[1] - Q() / 2).attr("width", (r) => _(r) + 20).attr("height", () => "1px").attr("overflow", "visible").attr("font-size", "12px").style("opacity", 1).append("xhtml:div").style("color", () => Lt).style("font-weight", () => "bold").style("background-color", (r) => ve(r, i)).style("padding", () => "5px 3px 5px 3px").style("border-radius", () => "4px").style("line-height", "100%").style("text-align", "center").html(
394
- (r) => k(
395
- xt,
391
+ ])[1] - ee() / 2).attr("width", (r) => B(r) + 20).attr("height", () => "1px").attr("overflow", "visible").attr("font-size", "12px").style("opacity", 1).append("xhtml:div").style("color", () => bt).style("font-weight", () => "bold").style("background-color", (r) => ye(r, i)).style("padding", () => "5px 3px 5px 3px").style("border-radius", () => "4px").style("line-height", "100%").style("text-align", "center").html(
392
+ (r) => T(
393
+ vt,
396
394
  {
397
395
  value: r.properties.value,
398
- locationName: r.properties[x]
396
+ locationName: r.properties[v]
399
397
  },
400
- F
398
+ x
401
399
  )
402
- ).on("mouseover", (r, a, s) => {
403
- c.select(g()).select("svg").select("g").select("#point-label" + s).raise(), V(r, a);
404
- }).on("mousemove", Y).on("mouseout", G);
405
- }
406
- function Ht(e, t) {
407
- const o = c.select(g()).select("svg").select("g");
408
- e.forEach((n) => {
409
- if (n.field && n.image && n.values) {
400
+ ).on("mouseover", (r, n, s) => {
401
+ u.select(f()).select("svg").select("g").select("#point-label" + s).raise(), U(r, n);
402
+ }).on("mousemove", K).on("mouseout", G);
403
+ }
404
+ function _t(e, t) {
405
+ const a = u.select(f()).select("svg").select("g");
406
+ e.forEach((l) => {
407
+ if (l.field && l.image && l.values) {
410
408
  const i = t.filter((r) => {
411
- const a = nt == n.field ? y : "value", s = (r.properties[a] || (r.properties.variables ? r.properties.variables[a] : "")) + "", f = (n.values + "").split(",");
412
- return r.properties.LATITUDE && r.properties.LONGITUDE && f.filter(
413
- (T) => T.trim().toLowerCase() == s.trim().toLowerCase()
409
+ const n = rt == l.field ? h : "value", s = (r.properties[n] || (r.properties.variables ? r.properties.variables[n] : "")) + "", g = (l.values + "").split(",");
410
+ return r.properties.LATITUDE && r.properties.LONGITUDE && g.filter(
411
+ (A) => A.trim().toLowerCase() == s.trim().toLowerCase()
414
412
  ).length > 0;
415
- }), l = t.filter((r) => {
416
- const a = nt == n.field ? y : "value", s = (r.properties[a] || (r.properties.variables ? r.properties.variables[a] : "")) + "", f = (n.values + "").split(",");
417
- return !r.properties.LATITUDE && !r.properties.LONGITUDE && f.filter(
418
- (T) => T.trim().toLowerCase() == s.trim().toLowerCase()
413
+ }), o = t.filter((r) => {
414
+ const n = rt == l.field ? h : "value", s = (r.properties[n] || (r.properties.variables ? r.properties.variables[n] : "")) + "", g = (l.values + "").split(",");
415
+ return !r.properties.LATITUDE && !r.properties.LONGITUDE && g.filter(
416
+ (A) => A.trim().toLowerCase() == s.trim().toLowerCase()
419
417
  ).length > 0;
420
418
  });
421
- o.selectAll("image").data(i).enter().append("image").attr("width", 40).attr("height", 40).attr("class", "map-symbol").attr("xlink:href", "/" + n.image).attr(
419
+ a.selectAll("image").data(i).enter().append("image").attr("width", 40).attr("height", 40).attr("class", "map-symbol").attr("xlink:href", "/" + l.image).attr(
422
420
  "transform",
423
- (r) => "translate(" + v.current([r.properties.LONGITUDE, r.properties.LATITUDE]) + ")"
424
- ).on("mouseover", V).on("mousemove", Y).on("mouseout", G), o.selectAll("image").data(l).enter().append("image").attr("width", 40).attr("height", 40).attr("class", "map-symbol").attr("xlink:href", "/" + n.image).attr("x", (r) => U.current.centroid(r)[0] - 20).attr("y", (r) => U.current.centroid(r)[1]).on("mouseover", V).on("mousemove", Y).on("mouseout", G);
421
+ (r) => "translate(" + y.current([r.properties.LONGITUDE, r.properties.LATITUDE]) + ")"
422
+ ).on("mouseover", U).on("mousemove", K).on("mouseout", G), a.selectAll("image").data(o).enter().append("image").attr("width", 40).attr("height", 40).attr("class", "map-symbol").attr("xlink:href", "/" + l.image).attr("x", (r) => $.current.centroid(r)[0] - 20).attr("y", (r) => $.current.centroid(r)[1]).on("mouseover", U).on("mousemove", K).on("mouseout", G);
425
423
  }
426
424
  });
427
425
  }
428
- function V(e, t) {
426
+ function U(e, t) {
429
427
  console.log("Showing tooltip for data:", t);
430
- const o = ["mobile", "tablet", "midTablet"].includes(
431
- N()
428
+ const a = ["mobile", "tablet", "midTablet"].includes(
429
+ O()
432
430
  );
433
- if (ie && t.properties.value !== null || ie && yt) {
434
- c.select(g()).select("svg").select("g").selectAll(".active").attr("class", (s) => s.properties[y] === t.properties[y] ? "focus" + (o ? " zoom-enabled" : "") : "active" + (o ? " zoom-enabled" : ""));
435
- const l = Re || `{locationName} %({value},2)
436
- {label}: %({value},2)`, r = t.properties.variables || {}, a = {
431
+ if (ie && t.properties.value !== null || ie && gt) {
432
+ u.select(f()).select("svg").select("g").selectAll(".active").attr("class", (s) => s.properties[h] === t.properties[h] ? "focus" + (a ? " zoom-enabled" : "") : "active" + (a ? " zoom-enabled" : ""));
433
+ const o = Re || `{locationName} %({value},2)
434
+ {label}: %({value},2)`, r = t.properties.variables || {}, n = {
437
435
  ...t.properties,
438
436
  value: t.properties.value,
439
- measure: z(),
437
+ measure: N(),
440
438
  measureLabel: t.properties.measureLabel,
441
- locationName: Ae(t, y, J),
442
- label: Ae(t, y, J),
439
+ locationName: we(t, h, Z),
440
+ label: we(t, h, Z),
443
441
  ...r,
444
- ...we(m)
442
+ ...Fe(m)
445
443
  // expose applied filter params (e.g. {year}) to the tooltip
446
444
  };
447
- w.current.attr("class", ut).style("position", "absolute").style("visibility", "hidden").style("visibility", "visible").html(() => {
448
- let s = `<div style='font-size:${ft}px;' class='tooltip-content' >`;
445
+ F.current.attr("class", it).style("position", "absolute").style("visibility", "hidden").style("visibility", "visible").html(() => {
446
+ let s = `<div style='font-size:${dt}px;' class='tooltip-content' >`;
449
447
  if (t.properties.value != null) {
450
- const d = l.split(`
451
- `), f = d[0], T = d.length > 1 ? d[1] : null;
452
- let S = 1, ee;
453
- vt.length > 1 && H != "POINTS_MAP" ? (S = d.length > 2 ? 2 : 1, ee = d[S]) : ee = null, f && (s += k(f, a, F)), T && (s.endsWith("<hr>") || (s += "<hr>"), s += k(T, a, F)), ee && t.properties.children && t.properties.children.forEach((I) => {
454
- const Le = {
455
- value: I.value,
456
- label: I.label,
457
- measure: z(),
448
+ const d = o.split(`
449
+ `), g = d[0], A = d.length > 1 ? d[1] : null;
450
+ let S = 1, V;
451
+ ht.length > 1 && X != "POINTS_MAP" ? (S = d.length > 2 ? 2 : 1, V = d[S]) : V = null, g && (s += T(g, n, x)), A && (s.endsWith("<hr>") || (s += "<hr>"), s += T(A, n, x)), V && t.properties.children && t.properties.children.forEach((z) => {
452
+ const ve = {
453
+ value: z.value,
454
+ label: z.label,
455
+ measure: N(),
458
456
  measureLabel: t.properties.measureLabel,
459
457
  ...r,
460
- ...I.variables,
461
- ...we(m)
458
+ ...z.variables,
459
+ ...Fe(m)
462
460
  };
463
- s.endsWith("<hr>") || (s += "<hr>"), s += k(ee, Le, F);
464
- }), d.length > S + 1 && (s.endsWith("<hr>") || (s += "<hr>"), d.forEach((I, Le) => {
465
- Le > S && (s.endsWith("<hr>") || (s += "<hr>"), s += k(I, a, F));
466
- })), mt.filter(
467
- (I) => I.location === t.properties[y]
468
- ).forEach((I) => {
469
- s.endsWith("<hr>") || (s += "<hr>"), s += I.tooltip;
461
+ s.endsWith("<hr>") || (s += "<hr>"), s += T(V, ve, x);
462
+ }), d.length > S + 1 && (s.endsWith("<hr>") || (s += "<hr>"), d.forEach((z, ve) => {
463
+ ve > S && (s.endsWith("<hr>") || (s += "<hr>"), s += T(z, n, x));
464
+ })), pt.filter(
465
+ (z) => z.location === t.properties[h]
466
+ ).forEach((z) => {
467
+ s.endsWith("<hr>") || (s += "<hr>"), s += z.tooltip;
470
468
  });
471
469
  } else {
472
470
  const d = Re || `{locationName} %({value},2)
473
- {label}: %({value},2)`, f = {
471
+ {label}: %({value},2)`, g = {
474
472
  value: null,
475
- measure: z(),
473
+ measure: N(),
476
474
  measureLabel: t.properties.measureLabel,
477
- locationName: Ae(t, y, J),
475
+ locationName: we(t, h, Z),
478
476
  ...r
479
477
  };
480
- s += k(d, f, F), s += "</div>";
478
+ s += T(d, g, x), s += "</div>";
481
479
  }
482
480
  return s;
483
481
  });
484
482
  }
485
483
  }
486
- function Ze(e) {
487
- const o = w.current.node(), n = o ? o.offsetWidth : 0, i = window.scrollX + document.documentElement.clientWidth;
488
- let l = e.pageX;
489
- n && l + n > i && (l = e.pageX - n, l < window.scrollX && (l = window.scrollX)), w.current.style("top", e.pageY + "px").style("left", l + "px").style("margin-left", "8px");
484
+ function Je(e) {
485
+ const a = F.current.node(), l = a ? a.offsetWidth : 0, i = window.scrollX + document.documentElement.clientWidth;
486
+ let o = e.pageX;
487
+ l && o + l > i && (o = e.pageX - l, o < window.scrollX && (o = window.scrollX)), F.current.style("top", e.pageY + "px").style("left", o + "px").style("margin-left", "8px");
490
488
  }
491
- function Y(e) {
492
- Ze(e);
489
+ function K(e) {
490
+ Je(e);
493
491
  }
494
492
  function G() {
495
- ie && (c.select(g()).select("svg").select("g").selectAll(".focus").attr("class", "active"), w.current.style("visibility", "hidden"));
493
+ ie && (u.select(f()).select("svg").select("g").selectAll(".focus").attr("class", "active"), F.current.style("visibility", "hidden"));
496
494
  }
497
- function $t(e, t, o) {
498
- V(e, t), w.current.style("visibility", "visible"), Ze(e);
499
- const n = c.select(g()).select("svg").select("g");
500
- n.selectAll("circle").style("fill", Be).style("stroke", "none"), n.select("#circle" + o).raise().style("fill", "#fff");
495
+ function jt(e, t, a) {
496
+ U(e, t), F.current.style("visibility", "visible"), Je(e);
497
+ const l = u.select(f()).select("svg").select("g");
498
+ l.selectAll("circle").style("fill", We).style("stroke", "none"), l.select("#circle" + a).raise().style("fill", "#fff");
501
499
  }
502
- function Ut(e, t) {
503
- $ !== t.properties[y] && t.properties.value !== null && Nt(t.properties[y]);
500
+ function Ht(e, t) {
501
+ H !== t.properties[h] && t.properties.value !== null && Tt(t.properties[h]);
504
502
  }
505
- function Vt(e) {
506
- const t = e && e.appliedFilters || {}, o = m || {};
507
- return t[P] != o[P];
503
+ function $t(e) {
504
+ const t = e && e.appliedFilters || {}, a = m || {};
505
+ return t[C] != a[C];
508
506
  }
509
- function Gt(e, t) {
510
- let o = null;
511
- if (wt && P) {
512
- let n = $;
513
- t && m && m[P] && (n = m[P]);
507
+ function Ut(e, t) {
508
+ let a = null;
509
+ if (xt && C) {
510
+ let l = H;
511
+ t && m && m[C] && (l = m[C]);
514
512
  const i = e.filter(
515
- (l) => l.properties != null && l.properties[y] == n
513
+ (o) => o.properties != null && o.properties[h] == l
516
514
  )[0];
517
- i && i.properties != null && i.properties.value && (o = i);
515
+ i && i.properties != null && i.properties.value && (a = i);
518
516
  }
519
- return o;
520
- }
521
- function Jt() {
522
- return yr(se);
523
- }
524
- function Xt(e, t) {
525
- let o = se;
526
- o || (o = ["mobile", "tablet"].includes(N()));
527
- const n = Z(), i = c.select(g());
528
- let l = i.select("svg"), r = ge();
529
- r === 0 ? r = window.innerWidth + tt[N()] : r += tt[N()];
530
- const a = he() - 100;
531
- if (l.empty() ? l = i.append("svg") : l.selectAll("*").remove(), l.attr("style", `background-color:${bt};`).attr("viewBox", `0 0 ${r} ${a}`).attr("preserveAspectRatio", "xMidYMid meet"), l.append("g").selectAll("path").data(e).enter().append("path").attr("fill", (d) => ve(d, n)).attr("d", c.geoPath().projection(v.current)).attr("class", () => Jt()).on("mouseover", H !== "POINTS_MAP" ? V : null).on("mousemove", H !== "POINTS_MAP" ? Y : null).on("mouseout", H !== "POINTS_MAP" ? G : null), E.current && l.transition().duration(300).call(
532
- A.current.transform,
533
- c.zoomIdentity.translate(E.current.x, E.current.y).scale(E.current.k)
534
- ), !E.current && h && h.x && h.y && h.k && (l.transition().duration(300).call(
535
- A.current.transform,
536
- c.zoomIdentity.translate(h.x, h.y).scale(h.k)
537
- ), H === "POINTS_MAP")) {
538
- const f = {
539
- mobile: 100,
540
- tablet: 0,
541
- midTablet: 0,
542
- desktop: 0,
543
- laptop: 0,
544
- wide: 0
545
- }[N()];
546
- l.transition().duration(300).call(
547
- A.current.transform,
548
- c.zoomIdentity.translate(h.x + f, h.y).scale(h.k)
549
- );
550
- }
551
- o || j ? l.call(A.current) : l.on("dblclick.zoom", null);
552
- const s = Gt(e, t);
517
+ return a;
518
+ }
519
+ function Gt() {
520
+ return fr(se);
521
+ }
522
+ function Vt(e, t) {
523
+ let a = se;
524
+ a || (a = ["mobile", "tablet"].includes(O()));
525
+ const l = q(), i = u.select(f());
526
+ let o = i.select("svg");
527
+ const r = fe(), n = ge();
528
+ o.empty() ? o = i.append("svg") : o.selectAll("*").remove(), o.attr("style", `background-color:${yt};`).attr("viewBox", `0 0 ${r} ${n}`).attr("preserveAspectRatio", "xMidYMid meet"), o.append("g").selectAll("path").data(e).enter().append("path").attr("fill", (d) => ye(d, l)).attr("d", u.geoPath().projection(y.current)).attr("class", () => Gt()).on("mouseover", X !== "POINTS_MAP" ? U : null).on("mousemove", X !== "POINTS_MAP" ? K : null).on("mouseout", X !== "POINTS_MAP" ? G : null), E.current && o.transition().duration(300).call(
529
+ k.current.transform,
530
+ u.zoomIdentity.translate(E.current.x, E.current.y).scale(E.current.k)
531
+ ), !E.current && L && L.x && L.y && L.k && o.transition().duration(300).call(
532
+ k.current.transform,
533
+ u.zoomIdentity.translate(L.x, L.y).scale(L.k)
534
+ ), a || j ? o.call(k.current) : o.on("dblclick.zoom", null);
535
+ const s = Ut(e, t);
553
536
  if (s) {
554
- const d = U.current.bounds(s), f = [
537
+ const d = $.current.bounds(s), g = [
555
538
  (d[0][0] + d[1][0]) / 2,
556
539
  (d[0][1] + d[1][1]) / 2
557
540
  ];
558
- l.transition().duration(750).call(
559
- A.current.transform,
560
- c.zoomIdentity.translate(r / 2, a / 2).scale(12).translate(-f[0], -f[1])
541
+ o.transition().duration(750).call(
542
+ k.current.transform,
543
+ u.zoomIdentity.translate(r / 2, n / 2).scale(12).translate(-g[0], -g[1])
561
544
  );
562
545
  }
563
546
  }
564
- function Zt() {
565
- return u.nationalData.value;
547
+ function Jt() {
548
+ return c.nationalData.value;
566
549
  }
567
- function Yt(e) {
568
- R != e && kt(e);
550
+ function Xt(e) {
551
+ R != e && Mt(e);
569
552
  }
570
- function qt() {
571
- let e = u.locationsData;
572
- return u.measures && u.measures.length > 1 && (e = u.locationsData.filter(
573
- (t) => t.measure === z()
574
- )), e.find((t) => t.label === C);
553
+ function Zt() {
554
+ let e = c.locationsData;
555
+ return c.measures && c.measures.length > 1 && (e = c.locationsData.filter(
556
+ (t) => t.measure === N()
557
+ )), e.find((t) => t.label === D);
575
558
  }
576
- function Kt() {
577
- if (!C)
559
+ function Yt() {
560
+ if (!D)
578
561
  return null;
579
- const t = X().find(
580
- (o) => o.properties[x] === C
562
+ const t = Y().find(
563
+ (a) => a.properties[v] === D
581
564
  );
582
565
  if (t && t.properties.displayLayerLabels && t.properties.layerLocale) {
583
- const o = t.properties.layerMappingField || x, n = t.properties[o];
584
- return fr(
585
- J,
586
- n,
566
+ const a = t.properties.layerMappingField || v, l = t.properties[a];
567
+ return pr(
568
+ Z,
569
+ l,
587
570
  t.properties.layerLocale
588
571
  );
589
572
  }
590
- return C;
573
+ return D;
591
574
  }
592
- function Qt(e) {
593
- return mr(e, Z(), We);
575
+ function qt(e) {
576
+ return ur(e, q(), Pe);
594
577
  }
595
- function er() {
596
- return /* @__PURE__ */ p(Qe, { className: "loading", children: /* @__PURE__ */ p(sr, { basic: !0, padded: !0, textAlign: "center", style: { margin: "30px" }, children: /* @__PURE__ */ p(ir, { active: !0, inverted: !0, children: /* @__PURE__ */ p(cr, { size: "medium" }) }) }) });
578
+ function Kt() {
579
+ return /* @__PURE__ */ p(Ke, { className: "loading", children: /* @__PURE__ */ p(nr, { basic: !0, padded: !0, textAlign: "center", style: { margin: "30px" }, children: /* @__PURE__ */ p(ar, { active: !0, inverted: !0, children: /* @__PURE__ */ p(sr, { size: "medium" }) }) }) });
597
580
  }
598
- function tr() {
599
- return /* @__PURE__ */ b(xe, { icon: !0, warning: !0, children: [
581
+ function Qt() {
582
+ return /* @__PURE__ */ b(Le, { icon: !0, warning: !0, children: [
600
583
  /* @__PURE__ */ p(te, { name: "map outline" }),
601
- /* @__PURE__ */ b(xe.Content, { children: [
602
- /* @__PURE__ */ p(xe.Header, { children: "No map selected" }),
584
+ /* @__PURE__ */ b(Le.Content, { children: [
585
+ /* @__PURE__ */ p(Le.Header, { children: "No map selected" }),
603
586
  "Pick one from the list in the ",
604
587
  /* @__PURE__ */ p("strong", { children: "Map Layers" }),
605
588
  " section."
606
589
  ] })
607
590
  ] });
608
591
  }
609
- M.current.zoomed = Dt, M.current.zoomEnd = Pt, M.current.getFeatures = X, M.current.updateFeatures = Xe, M.current.getMapId = g, fe.current || (fe.current = () => {
592
+ w.current.zoomed = Dt, w.current.zoomEnd = It, w.current.getFeatures = Y, w.current.updateFeatures = Ve, w.current.getMapId = f, me.current || (me.current = () => {
610
593
  let e = null;
611
594
  clearTimeout(e), e = setTimeout(() => {
612
- c.select(M.current.getMapId()).selectAll(".map-labels-container").size() > 0 || M.current.updateFeatures(M.current.getFeatures(), !1);
595
+ u.select(w.current.getMapId()).selectAll(".map-labels-container").size() > 0 || w.current.updateFeatures(w.current.getFeatures(), !1);
613
596
  }, 300);
614
- }), et(() => {
615
- const e = fe.current;
616
- return window.addEventListener("scroll", e, { passive: !0 }), window.addEventListener("touchmove", e, { passive: !0 }), Ge(), w.current = c.select("body").append("div").style("position", "absolute").style("visibility", "hidden").style("pointer-events", "none"), () => {
597
+ }), Qe(() => {
598
+ const e = me.current;
599
+ return window.addEventListener("scroll", e, { passive: !0 }), window.addEventListener("touchmove", e, { passive: !0 }), Ue(), F.current = u.select("body").append("div").style("position", "absolute").style("visibility", "hidden").style("pointer-events", "none"), () => {
617
600
  var t;
618
- window.removeEventListener("scroll", e), window.removeEventListener("touchmove", e), (t = w.current) == null || t.remove();
601
+ window.removeEventListener("scroll", e), window.removeEventListener("touchmove", e), (t = F.current) == null || t.remove();
619
602
  };
620
- }, []), et(() => {
621
- if (!$e.current) {
622
- $e.current = !0, de.current = O, me.current = { selectedMeasure: R, layers: B, selectedPolygon: $ };
603
+ }, []), Qe(() => {
604
+ if (!je.current) {
605
+ je.current = !0, pe.current = _, de.current = { selectedMeasure: R, layers: W, selectedPolygon: H };
623
606
  return;
624
607
  }
625
- const e = de.current, t = me.current;
626
- if (P) {
627
- const i = [], l = [], r = e.appliedFilters;
628
- r && Object.keys(r).forEach((a) => {
629
- r[a] != null && r[a] instanceof Array && i.push(
630
- ...r[a].filter((s) => s != Number.MIN_SAFE_INTEGER)
608
+ const e = pe.current, t = de.current;
609
+ if (C) {
610
+ const i = [], o = [], r = e.appliedFilters;
611
+ r && Object.keys(r).forEach((n) => {
612
+ r[n] != null && r[n] instanceof Array && i.push(
613
+ ...r[n].filter((s) => s != Number.MIN_SAFE_INTEGER)
631
614
  );
632
- }), m && Object.keys(m).forEach((a) => {
633
- m[a] != null && m[a] instanceof Array && l.push(
634
- ...m[a].filter((s) => s != Number.MIN_SAFE_INTEGER)
615
+ }), m && Object.keys(m).forEach((n) => {
616
+ m[n] != null && m[n] instanceof Array && o.push(
617
+ ...m[n].filter((s) => s != Number.MIN_SAFE_INTEGER)
635
618
  );
636
- }), i.length > 0 && l.length == 0 && Je();
619
+ }), i.length > 0 && o.length == 0 && Ge();
637
620
  }
638
- w.current.style("visibility", "hidden"), e.enabledLayers.length != D.length && Ge();
639
- const o = X();
640
- e.center !== le && (E.current = null, v.current.scale(ke).center(le).translate([ge() / 2, he() / 2]));
641
- const n = Vt(e);
642
- Xt(o, n), B && u && (u != e.transformedData || B != t.layers || R != t.selectedMeasure || $ != t.selectedPolygon || e.mainLayerId !== W || JSON.stringify(e.enabledLayers) != JSON.stringify(D)) && Xe(X(), n), de.current = O, me.current = { selectedMeasure: R, layers: B, selectedPolygon: $ };
621
+ F.current.style("visibility", "hidden"), e.enabledLayers.length != I.length && Ue();
622
+ const a = Y();
623
+ e.center !== le && (E.current = null, y.current.scale(Te).center(le).translate([fe() / 2, ge() / 2]));
624
+ const l = $t(e);
625
+ Vt(a, l), W && c && (c != e.transformedData || W != t.layers || R != t.selectedMeasure || H != t.selectedPolygon || e.mainLayerId !== P || JSON.stringify(e.enabledLayers) != JSON.stringify(I)) && Ve(Y(), l), pe.current = _, de.current = { selectedMeasure: R, layers: W, selectedPolygon: H };
643
626
  });
644
627
  let be = se;
645
628
  be || (be = !!["mobile", "tablet", "midTablet"].includes(
646
- N()
629
+ O()
647
630
  ));
648
- const rr = Zt(), lr = we(m), q = qt(), Ye = {
649
- backgroundColor: Qt(q),
631
+ const er = Jt(), tr = Fe(m), Q = Zt(), Xe = {
632
+ backgroundColor: qt(Q),
650
633
  color: Oe,
651
- fontSize: dt + "px"
634
+ fontSize: ut + "px"
652
635
  };
653
- j && (Ye.marginTop = "25px");
654
- const qe = () => /* @__PURE__ */ b(Qe, { fluid: !0, className: "footnote ", children: [
655
- /* @__PURE__ */ b(Fe, { columns: 2, children: [
656
- O.app !== "csv" && ze && /* @__PURE__ */ p(Fe.Column, { textAlign: "left", width: 4, children: /* @__PURE__ */ b("div", { className: "national-average-div", children: [
657
- /* @__PURE__ */ p("span", { className: "national-avg-label", children: Tt }),
658
- /* @__PURE__ */ p("span", { className: "national-avg-value", children: k(Ce, { value: rr }, F) })
636
+ j && (Xe.marginTop = "25px");
637
+ const Ze = () => /* @__PURE__ */ b(Ke, { fluid: !0, className: "footnote ", children: [
638
+ /* @__PURE__ */ b(xe, { columns: 2, children: [
639
+ _.app !== "csv" && Ne && /* @__PURE__ */ p(xe.Column, { textAlign: "left", width: 4, children: /* @__PURE__ */ b("div", { className: "national-average-div", children: [
640
+ /* @__PURE__ */ p("span", { className: "national-avg-label", children: At }),
641
+ /* @__PURE__ */ p("span", { className: "national-avg-value", children: T(De, { value: er }, x) })
659
642
  ] }) }),
660
643
  /* @__PURE__ */ p(
661
- Fe.Column,
644
+ xe.Column,
662
645
  {
663
646
  textAlign: "right",
664
- width: O.app !== "csv" && ze ? 12 : 16,
647
+ width: _.app !== "csv" && Ne ? 12 : 16,
665
648
  children: /* @__PURE__ */ p(
666
- ur,
649
+ ir,
667
650
  {
668
- filteredBreaks: Z(),
669
- formattedLegendTitle: k(Mt, { ...lr }, F),
651
+ filteredBreaks: q(),
652
+ formattedLegendTitle: T(wt, { ...tr }, x),
670
653
  selectedMeasure: R,
671
- ...O
654
+ ..._
672
655
  }
673
656
  )
674
657
  }
675
658
  )
676
659
  ] }),
677
660
  /* @__PURE__ */ p("div", { className: "measure-selector", children: /* @__PURE__ */ b("ul", { children: [
678
- Ie && /* @__PURE__ */ p("li", { children: /* @__PURE__ */ p("span", { className: "label", children: Ie }) }),
679
- u && u.measures && u.measures.length > 1 && u.measures.map((e) => /* @__PURE__ */ b("li", { onClick: () => Yt(e), children: [
661
+ ze && /* @__PURE__ */ p("li", { children: /* @__PURE__ */ p("span", { className: "label", children: ze }) }),
662
+ c && c.measures && c.measures.length > 1 && c.measures.map((e) => /* @__PURE__ */ b("li", { onClick: () => Xt(e), children: [
680
663
  /* @__PURE__ */ p(
681
664
  "input",
682
665
  {
683
- checked: z() === e,
666
+ checked: N() === e,
684
667
  type: "radio",
685
668
  value: e,
686
669
  readOnly: !0
687
670
  }
688
671
  ),
689
- /* @__PURE__ */ p("label", { children: u.measureLabelMap[e] || e })
672
+ /* @__PURE__ */ p("label", { children: c.measureLabelMap[e] || e })
690
673
  ] }, e))
691
674
  ] }) })
692
675
  ] });
693
- return /* @__PURE__ */ b("div", { className: "map component wp-data-viz-map", ref: pe, children: [
694
- je && (j ? tr() : er()),
695
- !je && /* @__PURE__ */ b(Ke, { children: [
696
- !at && /* @__PURE__ */ p(qe, {}),
676
+ return /* @__PURE__ */ b("div", { className: "map component wp-data-viz-map", children: [
677
+ _e && (j ? Qt() : Kt()),
678
+ !_e && /* @__PURE__ */ b(qe, { children: [
679
+ !lt && /* @__PURE__ */ p(Ze, {}),
697
680
  /* @__PURE__ */ b(
698
681
  "div",
699
682
  {
700
- className: "map wrapper scaling-svg-container " + Me,
701
- style: { height: Ne - dr[N()] + "px" },
683
+ className: "map wrapper scaling-svg-container " + Ae,
684
+ style: { height: ke - cr[O()] + "px" },
702
685
  children: [
703
- q ? /* @__PURE__ */ p("div", { className: "highlighted-loc-info", style: Ye, children: /* @__PURE__ */ b("span", { children: [
686
+ Q ? /* @__PURE__ */ p("div", { className: "highlighted-loc-info", style: Xe, children: /* @__PURE__ */ b("span", { children: [
704
687
  " ",
705
- k(
706
- Ft,
688
+ T(
689
+ Lt,
707
690
  {
708
- value: q.value,
709
- locationName: Kt() || q.label,
710
- measureName: q.measure
691
+ value: Q.value,
692
+ locationName: Yt() || Q.label,
693
+ measureName: Q.measure
711
694
  },
712
- F
695
+ x
713
696
  )
714
- ] }) }) : /* @__PURE__ */ p(Ke, { children: " " }),
715
- (j || be) && !wr && /* @__PURE__ */ b("div", { className: "control panel ignore", children: [
716
- /* @__PURE__ */ p("div", { className: "zoom plus", onClick: Ot, children: /* @__PURE__ */ p(te, { name: "plus", size: "large" }) }),
717
- /* @__PURE__ */ p("div", { className: "zoom minus", onClick: Wt, children: /* @__PURE__ */ p(te, { name: "minus", size: "large" }) }),
697
+ ] }) }) : /* @__PURE__ */ p(qe, { children: " " }),
698
+ (j || be) && !Lr && /* @__PURE__ */ b("div", { className: "control panel ignore", children: [
699
+ /* @__PURE__ */ p("div", { className: "zoom plus", onClick: St, children: /* @__PURE__ */ p(te, { name: "plus", size: "large" }) }),
700
+ /* @__PURE__ */ p("div", { className: "zoom minus", onClick: Ot, children: /* @__PURE__ */ p(te, { name: "minus", size: "large" }) }),
718
701
  /* @__PURE__ */ p(
719
702
  or,
720
703
  {
721
- content: /* @__PURE__ */ p(ar, { id: "map.reset.tooltip", defaultMessage: "Reset zoom" }),
722
- trigger: /* @__PURE__ */ p("div", { className: "reset", onClick: Je, children: /* @__PURE__ */ p(te, { name: "repeat", size: "large" }) })
704
+ content: /* @__PURE__ */ p(lr, { id: "map.reset.tooltip", defaultMessage: "Reset zoom" }),
705
+ trigger: /* @__PURE__ */ p("div", { className: "reset", onClick: Ge, children: /* @__PURE__ */ p(te, { name: "repeat", size: "large" }) })
723
706
  }
724
707
  )
725
708
  ] })
726
709
  ]
727
710
  }
728
711
  ),
729
- at && /* @__PURE__ */ p(qe, {})
712
+ lt && /* @__PURE__ */ p(Ze, {})
730
713
  ] })
731
714
  ] });
732
715
  }
733
- const Sr = nr(Ar);
716
+ const Dr = rr(xr);
734
717
  export {
735
- Sr as default,
736
- fr as getTranslatedItemLabel
718
+ Dr as default,
719
+ pr as getTranslatedItemLabel
737
720
  };