@guardian/interactive-component-library 0.1.0-alpha.10
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/LICENSE +39 -0
- package/README.md +103 -0
- package/dist/interactive-component-library.js +2979 -0
- package/dist/interactive-component-library.js.map +1 -0
- package/dist/interactive-component-library.umd.cjs +2977 -0
- package/dist/interactive-component-library.umd.cjs.map +1 -0
- package/dist/style.css +2054 -0
- package/package.json +51 -0
|
@@ -0,0 +1,2979 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "preact/jsx-runtime";
|
|
2
|
+
import { useRef, useState, useLayoutEffect, useId, useMemo, useEffect, useContext, useImperativeHandle } from "preact/hooks";
|
|
3
|
+
import { createPortal, forwardRef } from "preact/compat";
|
|
4
|
+
import { createElement, cloneElement, createContext, toChildArray } from "preact";
|
|
5
|
+
import { scaleLinear as scaleLinear$1 } from "d3-scale";
|
|
6
|
+
import { geoStream, geoAlbers, geoPath, geoMercator, geoContains } from "d3-geo";
|
|
7
|
+
const main = "";
|
|
8
|
+
const group = "_group_nq9z3_1";
|
|
9
|
+
const rotated = "_rotated_nq9z3_6";
|
|
10
|
+
const path$4 = "_path_nq9z3_10";
|
|
11
|
+
const active = "_active_nq9z3_14";
|
|
12
|
+
const defaultStyles$q = {
|
|
13
|
+
group,
|
|
14
|
+
rotated,
|
|
15
|
+
path: path$4,
|
|
16
|
+
active
|
|
17
|
+
};
|
|
18
|
+
function mergeStyles(firstStyle, secondStyle) {
|
|
19
|
+
if (!secondStyle)
|
|
20
|
+
return firstStyle;
|
|
21
|
+
if (typeof firstStyle === "string") {
|
|
22
|
+
if (typeof secondStyle !== "string") {
|
|
23
|
+
throw new Error("Styles to merge must be of the same type");
|
|
24
|
+
}
|
|
25
|
+
return firstStyle.concat(" ", secondStyle);
|
|
26
|
+
}
|
|
27
|
+
const allKeys = /* @__PURE__ */ new Set([...Object.keys(firstStyle), ...Object.keys(secondStyle)]);
|
|
28
|
+
const merged = Array.from(allKeys).reduce((result, key) => {
|
|
29
|
+
const classNames = [];
|
|
30
|
+
if (firstStyle && key in firstStyle) {
|
|
31
|
+
classNames.push(firstStyle[key]);
|
|
32
|
+
}
|
|
33
|
+
if (secondStyle && key in secondStyle) {
|
|
34
|
+
classNames.push(secondStyle[key]);
|
|
35
|
+
}
|
|
36
|
+
result[key] = classNames.join(" ");
|
|
37
|
+
return result;
|
|
38
|
+
}, {});
|
|
39
|
+
return merged;
|
|
40
|
+
}
|
|
41
|
+
const DIRECTION = {
|
|
42
|
+
up: "up",
|
|
43
|
+
down: "down"
|
|
44
|
+
};
|
|
45
|
+
function Chevron({
|
|
46
|
+
active: active2 = false,
|
|
47
|
+
direction = DIRECTION.down,
|
|
48
|
+
styles: styles2
|
|
49
|
+
}) {
|
|
50
|
+
const defaultStylesCopy = {
|
|
51
|
+
...defaultStyles$q
|
|
52
|
+
};
|
|
53
|
+
if (active2) {
|
|
54
|
+
defaultStylesCopy.path = mergeStyles(defaultStyles$q.path, defaultStyles$q.active);
|
|
55
|
+
}
|
|
56
|
+
if (direction === DIRECTION.up) {
|
|
57
|
+
defaultStylesCopy.group = mergeStyles(defaultStyles$q.group, defaultStyles$q.rotated);
|
|
58
|
+
}
|
|
59
|
+
styles2 = mergeStyles(defaultStylesCopy, styles2);
|
|
60
|
+
return jsx("svg", {
|
|
61
|
+
width: "16",
|
|
62
|
+
height: "24",
|
|
63
|
+
viewBox: "0 0 16 24",
|
|
64
|
+
fill: "none",
|
|
65
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
66
|
+
children: jsx("g", {
|
|
67
|
+
className: styles2.group,
|
|
68
|
+
style: "transform-box: fill-box;",
|
|
69
|
+
children: jsx("path", {
|
|
70
|
+
"fill-rule": "evenodd",
|
|
71
|
+
"clip-rule": "evenodd",
|
|
72
|
+
d: "M7.80569 10.7123L11.6344 15H12.365L16.1938 10.7123L15.4997 10L11.9997 13L8.49976 10L7.80569 10.7123Z",
|
|
73
|
+
className: styles2.path
|
|
74
|
+
})
|
|
75
|
+
})
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
const container$4 = "_container_jzalm_1";
|
|
79
|
+
const dot = "_dot_jzalm_6";
|
|
80
|
+
const circle$1 = "_circle_jzalm_13";
|
|
81
|
+
const text$4 = "_text_jzalm_17";
|
|
82
|
+
const defaultStyles$p = {
|
|
83
|
+
container: container$4,
|
|
84
|
+
dot,
|
|
85
|
+
circle: circle$1,
|
|
86
|
+
text: text$4
|
|
87
|
+
};
|
|
88
|
+
const DOT_TYPE = {
|
|
89
|
+
round: "round",
|
|
90
|
+
square: "square"
|
|
91
|
+
};
|
|
92
|
+
const LegendItem = ({
|
|
93
|
+
dotType = DOT_TYPE.round,
|
|
94
|
+
text: text2,
|
|
95
|
+
styles: styles2,
|
|
96
|
+
abbreviation
|
|
97
|
+
}) => {
|
|
98
|
+
const defaultStylesCopy = {
|
|
99
|
+
...defaultStyles$p
|
|
100
|
+
};
|
|
101
|
+
if (dotType === DOT_TYPE.round) {
|
|
102
|
+
defaultStylesCopy.dot = mergeStyles(defaultStyles$p.dot, defaultStyles$p.circle);
|
|
103
|
+
}
|
|
104
|
+
styles2 = mergeStyles(defaultStylesCopy, styles2);
|
|
105
|
+
return jsxs("div", {
|
|
106
|
+
className: styles2.container,
|
|
107
|
+
children: [jsx("span", {
|
|
108
|
+
className: `${styles2.dot} bg-color--${abbreviation}`
|
|
109
|
+
}), jsx("p", {
|
|
110
|
+
className: styles2.text,
|
|
111
|
+
children: text2
|
|
112
|
+
})]
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
function isDarkColor(color) {
|
|
116
|
+
let r, g, b;
|
|
117
|
+
if (color.match(/^rgb/)) {
|
|
118
|
+
color = color.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);
|
|
119
|
+
r = color[1];
|
|
120
|
+
g = color[2];
|
|
121
|
+
b = color[3];
|
|
122
|
+
} else {
|
|
123
|
+
color = +`0x${color.slice(1).replace(color.length < 5 && /./g, "$&$&")}`;
|
|
124
|
+
r = color >> 16;
|
|
125
|
+
g = color >> 8 & 255;
|
|
126
|
+
b = color & 255;
|
|
127
|
+
}
|
|
128
|
+
const hsp = Math.sqrt(0.299 * (r * r) + 0.587 * (g * g) + 0.114 * (b * b));
|
|
129
|
+
if (hsp > 140) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
const bar$2 = "_bar_wmb0k_1";
|
|
135
|
+
const label$1 = "_label_wmb0k_5";
|
|
136
|
+
const backgroundRect = "_backgroundRect_wmb0k_11";
|
|
137
|
+
const defaultStyles$o = {
|
|
138
|
+
bar: bar$2,
|
|
139
|
+
label: label$1,
|
|
140
|
+
backgroundRect
|
|
141
|
+
};
|
|
142
|
+
function StackedBar({
|
|
143
|
+
stack,
|
|
144
|
+
width,
|
|
145
|
+
height,
|
|
146
|
+
showBackgroundRect = false,
|
|
147
|
+
createSVG = true,
|
|
148
|
+
styles: styles2
|
|
149
|
+
}) {
|
|
150
|
+
const rectElements = useRef([]);
|
|
151
|
+
const textElements = useRef([]);
|
|
152
|
+
const [hideLabels, setHideLabels] = useState(true);
|
|
153
|
+
useLayoutEffect(() => {
|
|
154
|
+
for (let index2 = 0; index2 < stack.length; index2++) {
|
|
155
|
+
const rectElement = rectElements.current[index2];
|
|
156
|
+
const textElement = textElements.current[index2];
|
|
157
|
+
const paddingX = 8;
|
|
158
|
+
const hideText = textElement.getBBox().width + paddingX > rectElement.getBBox().width;
|
|
159
|
+
const rectStyle = window.getComputedStyle(rectElement);
|
|
160
|
+
const rectColor = rectStyle.getPropertyValue("fill");
|
|
161
|
+
const textColor = isDarkColor(rectColor) ? "#FFF" : "#121212";
|
|
162
|
+
textElement.style.fill = textColor;
|
|
163
|
+
if (hideText) {
|
|
164
|
+
setHideLabels(true);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
setHideLabels(false);
|
|
169
|
+
}, [stack, width, height]);
|
|
170
|
+
styles2 = mergeStyles({
|
|
171
|
+
...defaultStyles$o
|
|
172
|
+
}, styles2);
|
|
173
|
+
let totalWidth = 0;
|
|
174
|
+
const content2 = stack.map((d2, index2) => {
|
|
175
|
+
const itemWidth = d2.fraction * width;
|
|
176
|
+
const value = jsxs("g", {
|
|
177
|
+
transform: `translate(${totalWidth}, 0)`,
|
|
178
|
+
children: [jsx("rect", {
|
|
179
|
+
ref: (element) => rectElements.current[index2] = element,
|
|
180
|
+
width: itemWidth,
|
|
181
|
+
height,
|
|
182
|
+
className: `${styles2.bar} fill-color--${d2.abbreviation}`,
|
|
183
|
+
style: {
|
|
184
|
+
fill: d2.fill
|
|
185
|
+
},
|
|
186
|
+
"shape-rendering": "crispEdges"
|
|
187
|
+
}), jsx("text", {
|
|
188
|
+
ref: (element) => textElements.current[index2] = element,
|
|
189
|
+
x: itemWidth - 4,
|
|
190
|
+
y: height / 2,
|
|
191
|
+
"text-anchor": "end",
|
|
192
|
+
"alignment-baseline": "central",
|
|
193
|
+
"text-rendering": "optimizeLegibility",
|
|
194
|
+
className: styles2.label,
|
|
195
|
+
style: {
|
|
196
|
+
visibility: hideLabels ? "hidden" : "visible"
|
|
197
|
+
},
|
|
198
|
+
children: d2.label
|
|
199
|
+
})]
|
|
200
|
+
}, index2);
|
|
201
|
+
totalWidth += itemWidth;
|
|
202
|
+
return value;
|
|
203
|
+
});
|
|
204
|
+
const backgroundRect2 = jsx("g", {
|
|
205
|
+
children: jsx("rect", {
|
|
206
|
+
x: "0",
|
|
207
|
+
y: "0",
|
|
208
|
+
height,
|
|
209
|
+
width,
|
|
210
|
+
className: styles2.backgroundRect
|
|
211
|
+
})
|
|
212
|
+
});
|
|
213
|
+
if (createSVG) {
|
|
214
|
+
return jsxs("svg", {
|
|
215
|
+
overflow: "hidden",
|
|
216
|
+
width,
|
|
217
|
+
height,
|
|
218
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
219
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
220
|
+
children: [showBackgroundRect && backgroundRect2, content2]
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
return jsx(Fragment, {
|
|
224
|
+
children: content2
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
const svg$7 = "_svg_un4gp_1";
|
|
228
|
+
const previous = "_previous_un4gp_7";
|
|
229
|
+
const next = "_next_un4gp_11";
|
|
230
|
+
const defaultStyles$n = {
|
|
231
|
+
svg: svg$7,
|
|
232
|
+
previous,
|
|
233
|
+
next
|
|
234
|
+
};
|
|
235
|
+
const GradientIcon = ({
|
|
236
|
+
previous: previous2,
|
|
237
|
+
next: next2,
|
|
238
|
+
styles: styles2
|
|
239
|
+
}) => {
|
|
240
|
+
styles2 = mergeStyles({
|
|
241
|
+
...defaultStyles$n
|
|
242
|
+
}, styles2);
|
|
243
|
+
const gradientId = useId();
|
|
244
|
+
return jsxs("svg", {
|
|
245
|
+
class: styles2.svg,
|
|
246
|
+
width: "24",
|
|
247
|
+
height: "11",
|
|
248
|
+
viewBox: "0 0 24 11",
|
|
249
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
250
|
+
children: [jsx("path", {
|
|
251
|
+
d: "M0 5.434C0 2.43288 2.43288 0 5.434 0H5.69626C6.85818 0 7.9797 0.426401 8.84813 1.19834C10.6456 2.79612 13.3544 2.79612 15.1519 1.19834C16.0203 0.426401 17.1418 0 18.3037 0L18.566 0C21.5671 0 24 2.43288 24 5.434V5.566C24 8.56712 21.5671 11 18.566 11H18.3037C17.1418 11 16.0203 10.5736 15.1519 9.80166C13.3544 8.20388 10.6456 8.20388 8.84813 9.80166C7.9797 10.5736 6.85818 11 5.69626 11H5.434C2.43288 11 0 8.56712 0 5.566V5.434Z",
|
|
252
|
+
fill: `url(#${gradientId})`
|
|
253
|
+
}), jsx("defs", {
|
|
254
|
+
children: jsxs("linearGradient", {
|
|
255
|
+
id: gradientId,
|
|
256
|
+
x1: "5.5",
|
|
257
|
+
y1: "5.5",
|
|
258
|
+
x2: "12",
|
|
259
|
+
y2: "5.5",
|
|
260
|
+
gradientUnits: "userSpaceOnUse",
|
|
261
|
+
children: [jsx("stop", {
|
|
262
|
+
class: `${styles2.previous} stop-color--${previous2}`
|
|
263
|
+
}), jsx("stop", {
|
|
264
|
+
class: `${styles2.next} stop-color--${next2}`,
|
|
265
|
+
offset: "1"
|
|
266
|
+
})]
|
|
267
|
+
})
|
|
268
|
+
})]
|
|
269
|
+
});
|
|
270
|
+
};
|
|
271
|
+
const button$4 = "_button_kpmyt_1";
|
|
272
|
+
const svg$6 = "_svg_kpmyt_14";
|
|
273
|
+
const defaultStyles$m = {
|
|
274
|
+
button: button$4,
|
|
275
|
+
svg: svg$6
|
|
276
|
+
};
|
|
277
|
+
const InfoButton = ({
|
|
278
|
+
onClick,
|
|
279
|
+
styles: styles2
|
|
280
|
+
}) => {
|
|
281
|
+
styles2 = mergeStyles({
|
|
282
|
+
...defaultStyles$m
|
|
283
|
+
}, styles2);
|
|
284
|
+
return jsx("button", {
|
|
285
|
+
class: styles2.button,
|
|
286
|
+
onClick,
|
|
287
|
+
children: jsx("svg", {
|
|
288
|
+
class: styles2.svg,
|
|
289
|
+
viewBox: "0 0 5 13",
|
|
290
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
291
|
+
children: jsx("path", {
|
|
292
|
+
d: "m3.72905 10.8229v.5256c-.11944.0955-.28666.1672-.45388.2628-.16723.0716-.35834.1433-.54945.215-.19111.0716-.38222.1194-.57333.1433s-.38222.0478-.54945.0478c-.38222 0-.621109-.0717-.764442-.215-.167222-.1434-.238889-.3106-.238889-.4778 0-.1911.023889-.3822.047778-.5733s.071667-.3823.119445-.6211l1.003328-4.56282-.931662-.215v-.50167c.143333-.04777.334442-.11944.597222-.19111.23889-.07166.50167-.11944.78833-.16722.28667-.04778.54945-.09556.81223-.11944.26277-.02389.50166-.04778.71666-.04778l.26278.16722-1.33778 6.33052zm.45389-8.02663c-.215.19111-.52555.28667-.88389.28667-.33444 0-.62111-.09556-.86-.28667-.215-.19111-.33444-.43-.33444-.74056 0-.33444.11944-.59722.33444-.78833s.50167-.286667.86-.286667c.38223 0 .66889.095557.88389.286667s.33445.45389.33445.78833c-.02389.31056-.11945.54945-.33445.74056z"
|
|
293
|
+
})
|
|
294
|
+
})
|
|
295
|
+
});
|
|
296
|
+
};
|
|
297
|
+
const circleicon = "_circleicon_1ge2m_1";
|
|
298
|
+
const rect = "_rect_1ge2m_7";
|
|
299
|
+
const defaultStyles$l = {
|
|
300
|
+
circleicon,
|
|
301
|
+
rect
|
|
302
|
+
};
|
|
303
|
+
const CircleIcon = ({
|
|
304
|
+
abbreviation,
|
|
305
|
+
styles: styles2
|
|
306
|
+
}) => {
|
|
307
|
+
styles2 = mergeStyles({
|
|
308
|
+
...defaultStyles$l
|
|
309
|
+
}, styles2);
|
|
310
|
+
return jsx("svg", {
|
|
311
|
+
style: styles2.circleicon,
|
|
312
|
+
fill: "none",
|
|
313
|
+
height: "11",
|
|
314
|
+
viewBox: "0 0 11 11",
|
|
315
|
+
width: "11",
|
|
316
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
317
|
+
children: jsx("rect", {
|
|
318
|
+
class: `${styles2.rect} fill-color--${abbreviation}`,
|
|
319
|
+
height: "11",
|
|
320
|
+
rx: "5.5",
|
|
321
|
+
width: "11"
|
|
322
|
+
})
|
|
323
|
+
});
|
|
324
|
+
};
|
|
325
|
+
const text$3 = "_text_1okyv_1";
|
|
326
|
+
const defaultStyles$k = {
|
|
327
|
+
text: text$3
|
|
328
|
+
};
|
|
329
|
+
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
330
|
+
function getDefaultExportFromCjs(x) {
|
|
331
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
332
|
+
}
|
|
333
|
+
var dayjs_min = { exports: {} };
|
|
334
|
+
(function(module, exports) {
|
|
335
|
+
!function(t, e) {
|
|
336
|
+
module.exports = e();
|
|
337
|
+
}(commonjsGlobal, function() {
|
|
338
|
+
var t = 1e3, e = 6e4, n2 = 36e5, r = "millisecond", i = "second", s2 = "minute", u2 = "hour", a = "day", o = "week", c2 = "month", f = "quarter", h = "year", d2 = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
|
|
339
|
+
var e2 = ["th", "st", "nd", "rd"], n3 = t2 % 100;
|
|
340
|
+
return "[" + t2 + (e2[(n3 - 20) % 10] || e2[n3] || e2[0]) + "]";
|
|
341
|
+
} }, m = function(t2, e2, n3) {
|
|
342
|
+
var r2 = String(t2);
|
|
343
|
+
return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n3) + t2;
|
|
344
|
+
}, v = { s: m, z: function(t2) {
|
|
345
|
+
var e2 = -t2.utcOffset(), n3 = Math.abs(e2), r2 = Math.floor(n3 / 60), i2 = n3 % 60;
|
|
346
|
+
return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
|
|
347
|
+
}, m: function t2(e2, n3) {
|
|
348
|
+
if (e2.date() < n3.date())
|
|
349
|
+
return -t2(n3, e2);
|
|
350
|
+
var r2 = 12 * (n3.year() - e2.year()) + (n3.month() - e2.month()), i2 = e2.clone().add(r2, c2), s3 = n3 - i2 < 0, u3 = e2.clone().add(r2 + (s3 ? -1 : 1), c2);
|
|
351
|
+
return +(-(r2 + (n3 - i2) / (s3 ? i2 - u3 : u3 - i2)) || 0);
|
|
352
|
+
}, a: function(t2) {
|
|
353
|
+
return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
|
|
354
|
+
}, p: function(t2) {
|
|
355
|
+
return { M: c2, y: h, w: o, d: a, D: d2, h: u2, m: s2, s: i, ms: r, Q: f }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
|
|
356
|
+
}, u: function(t2) {
|
|
357
|
+
return void 0 === t2;
|
|
358
|
+
} }, g = "en", D = {};
|
|
359
|
+
D[g] = M;
|
|
360
|
+
var p2 = "$isDayjsObject", S = function(t2) {
|
|
361
|
+
return t2 instanceof _2 || !(!t2 || !t2[p2]);
|
|
362
|
+
}, w = function t2(e2, n3, r2) {
|
|
363
|
+
var i2;
|
|
364
|
+
if (!e2)
|
|
365
|
+
return g;
|
|
366
|
+
if ("string" == typeof e2) {
|
|
367
|
+
var s3 = e2.toLowerCase();
|
|
368
|
+
D[s3] && (i2 = s3), n3 && (D[s3] = n3, i2 = s3);
|
|
369
|
+
var u3 = e2.split("-");
|
|
370
|
+
if (!i2 && u3.length > 1)
|
|
371
|
+
return t2(u3[0]);
|
|
372
|
+
} else {
|
|
373
|
+
var a2 = e2.name;
|
|
374
|
+
D[a2] = e2, i2 = a2;
|
|
375
|
+
}
|
|
376
|
+
return !r2 && i2 && (g = i2), i2 || !r2 && g;
|
|
377
|
+
}, O = function(t2, e2) {
|
|
378
|
+
if (S(t2))
|
|
379
|
+
return t2.clone();
|
|
380
|
+
var n3 = "object" == typeof e2 ? e2 : {};
|
|
381
|
+
return n3.date = t2, n3.args = arguments, new _2(n3);
|
|
382
|
+
}, b = v;
|
|
383
|
+
b.l = w, b.i = S, b.w = function(t2, e2) {
|
|
384
|
+
return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
|
|
385
|
+
};
|
|
386
|
+
var _2 = function() {
|
|
387
|
+
function M2(t2) {
|
|
388
|
+
this.$L = w(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p2] = true;
|
|
389
|
+
}
|
|
390
|
+
var m2 = M2.prototype;
|
|
391
|
+
return m2.parse = function(t2) {
|
|
392
|
+
this.$d = function(t3) {
|
|
393
|
+
var e2 = t3.date, n3 = t3.utc;
|
|
394
|
+
if (null === e2)
|
|
395
|
+
return /* @__PURE__ */ new Date(NaN);
|
|
396
|
+
if (b.u(e2))
|
|
397
|
+
return /* @__PURE__ */ new Date();
|
|
398
|
+
if (e2 instanceof Date)
|
|
399
|
+
return new Date(e2);
|
|
400
|
+
if ("string" == typeof e2 && !/Z$/i.test(e2)) {
|
|
401
|
+
var r2 = e2.match($);
|
|
402
|
+
if (r2) {
|
|
403
|
+
var i2 = r2[2] - 1 || 0, s3 = (r2[7] || "0").substring(0, 3);
|
|
404
|
+
return n3 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s3)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s3);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
return new Date(e2);
|
|
408
|
+
}(t2), this.init();
|
|
409
|
+
}, m2.init = function() {
|
|
410
|
+
var t2 = this.$d;
|
|
411
|
+
this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
|
|
412
|
+
}, m2.$utils = function() {
|
|
413
|
+
return b;
|
|
414
|
+
}, m2.isValid = function() {
|
|
415
|
+
return !(this.$d.toString() === l);
|
|
416
|
+
}, m2.isSame = function(t2, e2) {
|
|
417
|
+
var n3 = O(t2);
|
|
418
|
+
return this.startOf(e2) <= n3 && n3 <= this.endOf(e2);
|
|
419
|
+
}, m2.isAfter = function(t2, e2) {
|
|
420
|
+
return O(t2) < this.startOf(e2);
|
|
421
|
+
}, m2.isBefore = function(t2, e2) {
|
|
422
|
+
return this.endOf(e2) < O(t2);
|
|
423
|
+
}, m2.$g = function(t2, e2, n3) {
|
|
424
|
+
return b.u(t2) ? this[e2] : this.set(n3, t2);
|
|
425
|
+
}, m2.unix = function() {
|
|
426
|
+
return Math.floor(this.valueOf() / 1e3);
|
|
427
|
+
}, m2.valueOf = function() {
|
|
428
|
+
return this.$d.getTime();
|
|
429
|
+
}, m2.startOf = function(t2, e2) {
|
|
430
|
+
var n3 = this, r2 = !!b.u(e2) || e2, f2 = b.p(t2), l2 = function(t3, e3) {
|
|
431
|
+
var i2 = b.w(n3.$u ? Date.UTC(n3.$y, e3, t3) : new Date(n3.$y, e3, t3), n3);
|
|
432
|
+
return r2 ? i2 : i2.endOf(a);
|
|
433
|
+
}, $2 = function(t3, e3) {
|
|
434
|
+
return b.w(n3.toDate()[t3].apply(n3.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n3);
|
|
435
|
+
}, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
|
|
436
|
+
switch (f2) {
|
|
437
|
+
case h:
|
|
438
|
+
return r2 ? l2(1, 0) : l2(31, 11);
|
|
439
|
+
case c2:
|
|
440
|
+
return r2 ? l2(1, M3) : l2(0, M3 + 1);
|
|
441
|
+
case o:
|
|
442
|
+
var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
|
|
443
|
+
return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
|
|
444
|
+
case a:
|
|
445
|
+
case d2:
|
|
446
|
+
return $2(v2 + "Hours", 0);
|
|
447
|
+
case u2:
|
|
448
|
+
return $2(v2 + "Minutes", 1);
|
|
449
|
+
case s2:
|
|
450
|
+
return $2(v2 + "Seconds", 2);
|
|
451
|
+
case i:
|
|
452
|
+
return $2(v2 + "Milliseconds", 3);
|
|
453
|
+
default:
|
|
454
|
+
return this.clone();
|
|
455
|
+
}
|
|
456
|
+
}, m2.endOf = function(t2) {
|
|
457
|
+
return this.startOf(t2, false);
|
|
458
|
+
}, m2.$set = function(t2, e2) {
|
|
459
|
+
var n3, o2 = b.p(t2), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n3 = {}, n3[a] = f2 + "Date", n3[d2] = f2 + "Date", n3[c2] = f2 + "Month", n3[h] = f2 + "FullYear", n3[u2] = f2 + "Hours", n3[s2] = f2 + "Minutes", n3[i] = f2 + "Seconds", n3[r] = f2 + "Milliseconds", n3)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
|
|
460
|
+
if (o2 === c2 || o2 === h) {
|
|
461
|
+
var y2 = this.clone().set(d2, 1);
|
|
462
|
+
y2.$d[l2]($2), y2.init(), this.$d = y2.set(d2, Math.min(this.$D, y2.daysInMonth())).$d;
|
|
463
|
+
} else
|
|
464
|
+
l2 && this.$d[l2]($2);
|
|
465
|
+
return this.init(), this;
|
|
466
|
+
}, m2.set = function(t2, e2) {
|
|
467
|
+
return this.clone().$set(t2, e2);
|
|
468
|
+
}, m2.get = function(t2) {
|
|
469
|
+
return this[b.p(t2)]();
|
|
470
|
+
}, m2.add = function(r2, f2) {
|
|
471
|
+
var d3, l2 = this;
|
|
472
|
+
r2 = Number(r2);
|
|
473
|
+
var $2 = b.p(f2), y2 = function(t2) {
|
|
474
|
+
var e2 = O(l2);
|
|
475
|
+
return b.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
|
|
476
|
+
};
|
|
477
|
+
if ($2 === c2)
|
|
478
|
+
return this.set(c2, this.$M + r2);
|
|
479
|
+
if ($2 === h)
|
|
480
|
+
return this.set(h, this.$y + r2);
|
|
481
|
+
if ($2 === a)
|
|
482
|
+
return y2(1);
|
|
483
|
+
if ($2 === o)
|
|
484
|
+
return y2(7);
|
|
485
|
+
var M3 = (d3 = {}, d3[s2] = e, d3[u2] = n2, d3[i] = t, d3)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
|
|
486
|
+
return b.w(m3, this);
|
|
487
|
+
}, m2.subtract = function(t2, e2) {
|
|
488
|
+
return this.add(-1 * t2, e2);
|
|
489
|
+
}, m2.format = function(t2) {
|
|
490
|
+
var e2 = this, n3 = this.$locale();
|
|
491
|
+
if (!this.isValid())
|
|
492
|
+
return n3.invalidDate || l;
|
|
493
|
+
var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b.z(this), s3 = this.$H, u3 = this.$m, a2 = this.$M, o2 = n3.weekdays, c3 = n3.months, f2 = n3.meridiem, h2 = function(t3, n4, i3, s4) {
|
|
494
|
+
return t3 && (t3[n4] || t3(e2, r2)) || i3[n4].slice(0, s4);
|
|
495
|
+
}, d3 = function(t3) {
|
|
496
|
+
return b.s(s3 % 12 || 12, t3, "0");
|
|
497
|
+
}, $2 = f2 || function(t3, e3, n4) {
|
|
498
|
+
var r3 = t3 < 12 ? "AM" : "PM";
|
|
499
|
+
return n4 ? r3.toLowerCase() : r3;
|
|
500
|
+
};
|
|
501
|
+
return r2.replace(y, function(t3, r3) {
|
|
502
|
+
return r3 || function(t4) {
|
|
503
|
+
switch (t4) {
|
|
504
|
+
case "YY":
|
|
505
|
+
return String(e2.$y).slice(-2);
|
|
506
|
+
case "YYYY":
|
|
507
|
+
return b.s(e2.$y, 4, "0");
|
|
508
|
+
case "M":
|
|
509
|
+
return a2 + 1;
|
|
510
|
+
case "MM":
|
|
511
|
+
return b.s(a2 + 1, 2, "0");
|
|
512
|
+
case "MMM":
|
|
513
|
+
return h2(n3.monthsShort, a2, c3, 3);
|
|
514
|
+
case "MMMM":
|
|
515
|
+
return h2(c3, a2);
|
|
516
|
+
case "D":
|
|
517
|
+
return e2.$D;
|
|
518
|
+
case "DD":
|
|
519
|
+
return b.s(e2.$D, 2, "0");
|
|
520
|
+
case "d":
|
|
521
|
+
return String(e2.$W);
|
|
522
|
+
case "dd":
|
|
523
|
+
return h2(n3.weekdaysMin, e2.$W, o2, 2);
|
|
524
|
+
case "ddd":
|
|
525
|
+
return h2(n3.weekdaysShort, e2.$W, o2, 3);
|
|
526
|
+
case "dddd":
|
|
527
|
+
return o2[e2.$W];
|
|
528
|
+
case "H":
|
|
529
|
+
return String(s3);
|
|
530
|
+
case "HH":
|
|
531
|
+
return b.s(s3, 2, "0");
|
|
532
|
+
case "h":
|
|
533
|
+
return d3(1);
|
|
534
|
+
case "hh":
|
|
535
|
+
return d3(2);
|
|
536
|
+
case "a":
|
|
537
|
+
return $2(s3, u3, true);
|
|
538
|
+
case "A":
|
|
539
|
+
return $2(s3, u3, false);
|
|
540
|
+
case "m":
|
|
541
|
+
return String(u3);
|
|
542
|
+
case "mm":
|
|
543
|
+
return b.s(u3, 2, "0");
|
|
544
|
+
case "s":
|
|
545
|
+
return String(e2.$s);
|
|
546
|
+
case "ss":
|
|
547
|
+
return b.s(e2.$s, 2, "0");
|
|
548
|
+
case "SSS":
|
|
549
|
+
return b.s(e2.$ms, 3, "0");
|
|
550
|
+
case "Z":
|
|
551
|
+
return i2;
|
|
552
|
+
}
|
|
553
|
+
return null;
|
|
554
|
+
}(t3) || i2.replace(":", "");
|
|
555
|
+
});
|
|
556
|
+
}, m2.utcOffset = function() {
|
|
557
|
+
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
558
|
+
}, m2.diff = function(r2, d3, l2) {
|
|
559
|
+
var $2, y2 = this, M3 = b.p(d3), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() {
|
|
560
|
+
return b.m(y2, m3);
|
|
561
|
+
};
|
|
562
|
+
switch (M3) {
|
|
563
|
+
case h:
|
|
564
|
+
$2 = D2() / 12;
|
|
565
|
+
break;
|
|
566
|
+
case c2:
|
|
567
|
+
$2 = D2();
|
|
568
|
+
break;
|
|
569
|
+
case f:
|
|
570
|
+
$2 = D2() / 3;
|
|
571
|
+
break;
|
|
572
|
+
case o:
|
|
573
|
+
$2 = (g2 - v2) / 6048e5;
|
|
574
|
+
break;
|
|
575
|
+
case a:
|
|
576
|
+
$2 = (g2 - v2) / 864e5;
|
|
577
|
+
break;
|
|
578
|
+
case u2:
|
|
579
|
+
$2 = g2 / n2;
|
|
580
|
+
break;
|
|
581
|
+
case s2:
|
|
582
|
+
$2 = g2 / e;
|
|
583
|
+
break;
|
|
584
|
+
case i:
|
|
585
|
+
$2 = g2 / t;
|
|
586
|
+
break;
|
|
587
|
+
default:
|
|
588
|
+
$2 = g2;
|
|
589
|
+
}
|
|
590
|
+
return l2 ? $2 : b.a($2);
|
|
591
|
+
}, m2.daysInMonth = function() {
|
|
592
|
+
return this.endOf(c2).$D;
|
|
593
|
+
}, m2.$locale = function() {
|
|
594
|
+
return D[this.$L];
|
|
595
|
+
}, m2.locale = function(t2, e2) {
|
|
596
|
+
if (!t2)
|
|
597
|
+
return this.$L;
|
|
598
|
+
var n3 = this.clone(), r2 = w(t2, e2, true);
|
|
599
|
+
return r2 && (n3.$L = r2), n3;
|
|
600
|
+
}, m2.clone = function() {
|
|
601
|
+
return b.w(this.$d, this);
|
|
602
|
+
}, m2.toDate = function() {
|
|
603
|
+
return new Date(this.valueOf());
|
|
604
|
+
}, m2.toJSON = function() {
|
|
605
|
+
return this.isValid() ? this.toISOString() : null;
|
|
606
|
+
}, m2.toISOString = function() {
|
|
607
|
+
return this.$d.toISOString();
|
|
608
|
+
}, m2.toString = function() {
|
|
609
|
+
return this.$d.toUTCString();
|
|
610
|
+
}, M2;
|
|
611
|
+
}(), k = _2.prototype;
|
|
612
|
+
return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s2], ["$H", u2], ["$W", a], ["$M", c2], ["$y", h], ["$D", d2]].forEach(function(t2) {
|
|
613
|
+
k[t2[1]] = function(e2) {
|
|
614
|
+
return this.$g(e2, t2[0], t2[1]);
|
|
615
|
+
};
|
|
616
|
+
}), O.extend = function(t2, e2) {
|
|
617
|
+
return t2.$i || (t2(e2, _2, O), t2.$i = true), O;
|
|
618
|
+
}, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
|
|
619
|
+
return O(1e3 * t2);
|
|
620
|
+
}, O.en = D[g], O.Ls = D, O.p = {}, O;
|
|
621
|
+
});
|
|
622
|
+
})(dayjs_min);
|
|
623
|
+
var dayjs_minExports = dayjs_min.exports;
|
|
624
|
+
const dayjs = /* @__PURE__ */ getDefaultExportFromCjs(dayjs_minExports);
|
|
625
|
+
var relativeTime$1 = { exports: {} };
|
|
626
|
+
(function(module, exports) {
|
|
627
|
+
!function(r, e) {
|
|
628
|
+
module.exports = e();
|
|
629
|
+
}(commonjsGlobal, function() {
|
|
630
|
+
return function(r, e, t) {
|
|
631
|
+
r = r || {};
|
|
632
|
+
var n2 = e.prototype, o = { future: "in %s", past: "%s ago", s: "a few seconds", m: "a minute", mm: "%d minutes", h: "an hour", hh: "%d hours", d: "a day", dd: "%d days", M: "a month", MM: "%d months", y: "a year", yy: "%d years" };
|
|
633
|
+
function i(r2, e2, t2, o2) {
|
|
634
|
+
return n2.fromToBase(r2, e2, t2, o2);
|
|
635
|
+
}
|
|
636
|
+
t.en.relativeTime = o, n2.fromToBase = function(e2, n3, i2, d3, u2) {
|
|
637
|
+
for (var f, a, s2, l = i2.$locale().relativeTime || o, h = r.thresholds || [{ l: "s", r: 44, d: "second" }, { l: "m", r: 89 }, { l: "mm", r: 44, d: "minute" }, { l: "h", r: 89 }, { l: "hh", r: 21, d: "hour" }, { l: "d", r: 35 }, { l: "dd", r: 25, d: "day" }, { l: "M", r: 45 }, { l: "MM", r: 10, d: "month" }, { l: "y", r: 17 }, { l: "yy", d: "year" }], m = h.length, c2 = 0; c2 < m; c2 += 1) {
|
|
638
|
+
var y = h[c2];
|
|
639
|
+
y.d && (f = d3 ? t(e2).diff(i2, y.d, true) : i2.diff(e2, y.d, true));
|
|
640
|
+
var p2 = (r.rounding || Math.round)(Math.abs(f));
|
|
641
|
+
if (s2 = f > 0, p2 <= y.r || !y.r) {
|
|
642
|
+
p2 <= 1 && c2 > 0 && (y = h[c2 - 1]);
|
|
643
|
+
var v = l[y.l];
|
|
644
|
+
u2 && (p2 = u2("" + p2)), a = "string" == typeof v ? v.replace("%d", p2) : v(p2, n3, y.l, s2);
|
|
645
|
+
break;
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
if (n3)
|
|
649
|
+
return a;
|
|
650
|
+
var M = s2 ? l.future : l.past;
|
|
651
|
+
return "function" == typeof M ? M(a) : M.replace("%s", a);
|
|
652
|
+
}, n2.to = function(r2, e2) {
|
|
653
|
+
return i(r2, e2, this, true);
|
|
654
|
+
}, n2.from = function(r2, e2) {
|
|
655
|
+
return i(r2, e2, this);
|
|
656
|
+
};
|
|
657
|
+
var d2 = function(r2) {
|
|
658
|
+
return r2.$u ? t.utc() : t();
|
|
659
|
+
};
|
|
660
|
+
n2.toNow = function(r2) {
|
|
661
|
+
return this.to(d2(this), r2);
|
|
662
|
+
}, n2.fromNow = function(r2) {
|
|
663
|
+
return this.from(d2(this), r2);
|
|
664
|
+
};
|
|
665
|
+
};
|
|
666
|
+
});
|
|
667
|
+
})(relativeTime$1);
|
|
668
|
+
var relativeTimeExports = relativeTime$1.exports;
|
|
669
|
+
const relativeTime = /* @__PURE__ */ getDefaultExportFromCjs(relativeTimeExports);
|
|
670
|
+
dayjs.extend(relativeTime);
|
|
671
|
+
const RelativeTimeSentence = ({
|
|
672
|
+
timeStamp,
|
|
673
|
+
styles: styles2
|
|
674
|
+
}) => {
|
|
675
|
+
styles2 = mergeStyles({
|
|
676
|
+
...defaultStyles$k
|
|
677
|
+
}, styles2);
|
|
678
|
+
let timeSince = dayjs(timeStamp).fromNow();
|
|
679
|
+
return jsx("span", {
|
|
680
|
+
className: styles2.text,
|
|
681
|
+
children: timeSince
|
|
682
|
+
});
|
|
683
|
+
};
|
|
684
|
+
const pageContainer = "_pageContainer_1s0yq_9";
|
|
685
|
+
const sideBorders = "_sideBorders_1s0yq_42";
|
|
686
|
+
const defaultStyles$j = {
|
|
687
|
+
pageContainer,
|
|
688
|
+
sideBorders
|
|
689
|
+
};
|
|
690
|
+
function Container({
|
|
691
|
+
children,
|
|
692
|
+
sideBorders: sideBorders2 = false,
|
|
693
|
+
styles: styles2
|
|
694
|
+
}) {
|
|
695
|
+
const {
|
|
696
|
+
pageContainer: pageContainer2,
|
|
697
|
+
sideBorders: sideBordersStyle
|
|
698
|
+
} = mergeStyles(defaultStyles$j, styles2);
|
|
699
|
+
return jsx("div", {
|
|
700
|
+
className: [pageContainer2, sideBorders2 && sideBordersStyle].join(" "),
|
|
701
|
+
children
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
const bar$1 = "_bar_17pyf_9";
|
|
705
|
+
const defaultStyles$i = {
|
|
706
|
+
bar: bar$1
|
|
707
|
+
};
|
|
708
|
+
function ChangeBar({
|
|
709
|
+
fraction,
|
|
710
|
+
positive,
|
|
711
|
+
party,
|
|
712
|
+
width,
|
|
713
|
+
height,
|
|
714
|
+
styles: styles2
|
|
715
|
+
}) {
|
|
716
|
+
let centre = parseFloat(width) / 2;
|
|
717
|
+
let barwidth = parseFloat(fraction) * (parseFloat(width) / 2);
|
|
718
|
+
let negleft = `${centre - barwidth}px`;
|
|
719
|
+
let posleft = `${centre}px`;
|
|
720
|
+
let thisStyles = ` height: ${height}; width: ${barwidth}px; ${positive ? `left: ${posleft}` : `left: ${negleft}`}`;
|
|
721
|
+
let thisColor = ` bg-color--${party}`;
|
|
722
|
+
styles2 = mergeStyles({
|
|
723
|
+
...defaultStyles$i
|
|
724
|
+
}, styles2);
|
|
725
|
+
return jsx("div", {
|
|
726
|
+
className: styles2.wrapper,
|
|
727
|
+
style: `width: ${width}px`,
|
|
728
|
+
children: jsx("div", {
|
|
729
|
+
className: styles2.bar.concat(thisColor),
|
|
730
|
+
style: thisStyles
|
|
731
|
+
})
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
const svg$5 = "_svg_886i1_9";
|
|
735
|
+
const dividingLineColor = "_dividingLineColor_886i1_16";
|
|
736
|
+
const square = "_square_886i1_20";
|
|
737
|
+
const corner = "_corner_886i1_24";
|
|
738
|
+
const defaultStyles$h = {
|
|
739
|
+
svg: svg$5,
|
|
740
|
+
dividingLineColor,
|
|
741
|
+
square,
|
|
742
|
+
corner
|
|
743
|
+
};
|
|
744
|
+
const SquareCutCornerIcon = ({
|
|
745
|
+
cornerColor,
|
|
746
|
+
squareColor,
|
|
747
|
+
squareSize,
|
|
748
|
+
styles: styles2
|
|
749
|
+
}) => {
|
|
750
|
+
styles2 = mergeStyles({
|
|
751
|
+
...defaultStyles$h
|
|
752
|
+
}, styles2);
|
|
753
|
+
let cornerSize = squareSize * 0.625;
|
|
754
|
+
let cornerMargin = squareSize < 100 ? squareSize / 6 : 10;
|
|
755
|
+
return jsx("svg", {
|
|
756
|
+
width: squareSize,
|
|
757
|
+
height: squareSize,
|
|
758
|
+
className: styles2.svg,
|
|
759
|
+
viewBox: `0 0 ${squareSize} ${squareSize}`,
|
|
760
|
+
children: jsxs("g", {
|
|
761
|
+
id: "square-cutoff-corner-icon",
|
|
762
|
+
children: [jsx("rect", {
|
|
763
|
+
id: "square",
|
|
764
|
+
fill: squareColor,
|
|
765
|
+
className: styles2.square,
|
|
766
|
+
width: squareSize,
|
|
767
|
+
height: squareSize
|
|
768
|
+
}), jsxs("g", {
|
|
769
|
+
id: "corner",
|
|
770
|
+
children: [jsx("polygon", {
|
|
771
|
+
id: "cornerTriangleBg",
|
|
772
|
+
className: styles2.dividingLineColor,
|
|
773
|
+
points: `0,0 0,${cornerSize} ${cornerSize},0`
|
|
774
|
+
}), jsx("polygon", {
|
|
775
|
+
id: "cornerTriangle",
|
|
776
|
+
fill: cornerColor,
|
|
777
|
+
className: styles2.corner,
|
|
778
|
+
points: `0,0 0,${cornerSize - cornerMargin} ${cornerSize - cornerMargin},0`
|
|
779
|
+
})]
|
|
780
|
+
})]
|
|
781
|
+
})
|
|
782
|
+
});
|
|
783
|
+
};
|
|
784
|
+
const stackedGridContainer = "_stackedGridContainer_1e05o_1";
|
|
785
|
+
const stackedGridRotateItems0 = "_stackedGridRotateItems0_1e05o_13";
|
|
786
|
+
const stackedGridRotateItems90 = "_stackedGridRotateItems90_1e05o_19";
|
|
787
|
+
const stackedGridRotateItems180 = "_stackedGridRotateItems180_1e05o_25";
|
|
788
|
+
const stackedGridRotateItems270 = "_stackedGridRotateItems270_1e05o_31";
|
|
789
|
+
const defaultStyles$g = {
|
|
790
|
+
stackedGridContainer,
|
|
791
|
+
stackedGridRotateItems0,
|
|
792
|
+
stackedGridRotateItems90,
|
|
793
|
+
stackedGridRotateItems180,
|
|
794
|
+
stackedGridRotateItems270
|
|
795
|
+
};
|
|
796
|
+
const getItemRotate = (fromBottom, fromLeft) => {
|
|
797
|
+
if (fromBottom && fromLeft) {
|
|
798
|
+
return "stackedGridRotateItems270";
|
|
799
|
+
} else if (fromBottom && !fromLeft) {
|
|
800
|
+
return "stackedGridRotateItems180";
|
|
801
|
+
} else if (!fromBottom && !fromLeft) {
|
|
802
|
+
return "stackedGridRotateItems90";
|
|
803
|
+
} else if (!fromBottom && fromLeft) {
|
|
804
|
+
return "stackedGridRotateItems0";
|
|
805
|
+
}
|
|
806
|
+
};
|
|
807
|
+
const getContainerFlip = (fromBottom, fromLeft) => {
|
|
808
|
+
let scaleX = fromLeft ? 1 : -1;
|
|
809
|
+
let scaleY = fromBottom ? -1 : 1;
|
|
810
|
+
return `scale(${scaleX}, ${scaleY})`;
|
|
811
|
+
};
|
|
812
|
+
const StackedGrid = ({
|
|
813
|
+
fromLeft,
|
|
814
|
+
fromBottom,
|
|
815
|
+
containerWidth,
|
|
816
|
+
children,
|
|
817
|
+
styles: styles2
|
|
818
|
+
}) => {
|
|
819
|
+
let containerFlip = getContainerFlip(fromBottom, fromLeft);
|
|
820
|
+
let itemRotateClass = getItemRotate(fromBottom, fromLeft);
|
|
821
|
+
let flexStyles = {
|
|
822
|
+
display: "flex",
|
|
823
|
+
flexDirection: "row",
|
|
824
|
+
flexWrap: "wrap",
|
|
825
|
+
width: containerWidth,
|
|
826
|
+
transform: containerFlip
|
|
827
|
+
};
|
|
828
|
+
styles2 = mergeStyles(defaultStyles$g, styles2);
|
|
829
|
+
return jsx("div", {
|
|
830
|
+
style: flexStyles,
|
|
831
|
+
className: `${styles2.stackedGridContainer} ${styles2[itemRotateClass]}`,
|
|
832
|
+
children
|
|
833
|
+
});
|
|
834
|
+
};
|
|
835
|
+
const svg$4 = "_svg_l2fsl_9";
|
|
836
|
+
const squareFill = "_squareFill_l2fsl_16";
|
|
837
|
+
const defaultStyles$f = {
|
|
838
|
+
svg: svg$4,
|
|
839
|
+
squareFill
|
|
840
|
+
};
|
|
841
|
+
const SquareIcon = ({
|
|
842
|
+
color,
|
|
843
|
+
size,
|
|
844
|
+
styles: styles2
|
|
845
|
+
}) => {
|
|
846
|
+
styles2 = mergeStyles({
|
|
847
|
+
...defaultStyles$f
|
|
848
|
+
}, styles2);
|
|
849
|
+
return jsx("svg", {
|
|
850
|
+
width: size,
|
|
851
|
+
height: size,
|
|
852
|
+
className: styles2.svg,
|
|
853
|
+
viewBox: `0 0 ${size} ${size}`,
|
|
854
|
+
children: jsx("rect", {
|
|
855
|
+
id: "square",
|
|
856
|
+
fill: color,
|
|
857
|
+
className: styles2.squareFill,
|
|
858
|
+
width: size,
|
|
859
|
+
height: size
|
|
860
|
+
})
|
|
861
|
+
});
|
|
862
|
+
};
|
|
863
|
+
const button$3 = "_button_1fees_1";
|
|
864
|
+
const icon = "_icon_1fees_6";
|
|
865
|
+
const defaultStyles$e = {
|
|
866
|
+
button: button$3,
|
|
867
|
+
icon
|
|
868
|
+
};
|
|
869
|
+
function ArrowButton({
|
|
870
|
+
direction = "right",
|
|
871
|
+
disabled = false,
|
|
872
|
+
styles: styles2,
|
|
873
|
+
onClick
|
|
874
|
+
}) {
|
|
875
|
+
styles2 = mergeStyles(defaultStyles$e, styles2);
|
|
876
|
+
return jsx("button", {
|
|
877
|
+
className: styles2.button,
|
|
878
|
+
disabled,
|
|
879
|
+
onClick,
|
|
880
|
+
children: jsxs("svg", {
|
|
881
|
+
className: [styles2.icon, direction].join(" "),
|
|
882
|
+
viewBox: "0 0 28 28",
|
|
883
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
884
|
+
children: [jsx("circle", {
|
|
885
|
+
cx: 14,
|
|
886
|
+
cy: 14,
|
|
887
|
+
r: "13",
|
|
888
|
+
"fill-rule": "nonzero"
|
|
889
|
+
}), jsx("g", {
|
|
890
|
+
transform: "translate(6 7)",
|
|
891
|
+
children: jsx("path", {
|
|
892
|
+
d: "M0.667319 7.63692L12.8497 7.63692L8.07231 13.3539L8.69338 13.975L15.334 7.31842L15.334 6.68143L8.69338 0.0249018L8.07231 0.645966L12.8497 6.36294L0.667319 6.36294L0.667319 7.63692Z",
|
|
893
|
+
fill: "#121212"
|
|
894
|
+
})
|
|
895
|
+
})]
|
|
896
|
+
})
|
|
897
|
+
});
|
|
898
|
+
}
|
|
899
|
+
const button$2 = "_button_19t7j_1";
|
|
900
|
+
const buttonInner$1 = "_buttonInner_19t7j_6";
|
|
901
|
+
const defaultStyles$d = {
|
|
902
|
+
button: button$2,
|
|
903
|
+
buttonInner: buttonInner$1
|
|
904
|
+
};
|
|
905
|
+
function Button({
|
|
906
|
+
type = "regular",
|
|
907
|
+
onClick,
|
|
908
|
+
styles: styles2,
|
|
909
|
+
children
|
|
910
|
+
}) {
|
|
911
|
+
styles2 = mergeStyles(defaultStyles$d, styles2);
|
|
912
|
+
return jsx("button", {
|
|
913
|
+
className: styles2.button,
|
|
914
|
+
"data-type": type,
|
|
915
|
+
onClick,
|
|
916
|
+
children: jsx("div", {
|
|
917
|
+
className: styles2.buttonInner,
|
|
918
|
+
children
|
|
919
|
+
})
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
const button$1 = "_button_6w12u_1";
|
|
923
|
+
const buttonBorder = "_buttonBorder_6w12u_10";
|
|
924
|
+
const svg$3 = "_svg_6w12u_18";
|
|
925
|
+
const path$3 = "_path_6w12u_24";
|
|
926
|
+
const defaultStyles$c = {
|
|
927
|
+
button: button$1,
|
|
928
|
+
buttonBorder,
|
|
929
|
+
svg: svg$3,
|
|
930
|
+
path: path$3
|
|
931
|
+
};
|
|
932
|
+
function CloseButton({
|
|
933
|
+
border = true,
|
|
934
|
+
onClick,
|
|
935
|
+
styles: styles2
|
|
936
|
+
}) {
|
|
937
|
+
styles2 = mergeStyles(defaultStyles$c, styles2);
|
|
938
|
+
return jsx("button", {
|
|
939
|
+
className: [styles2.button, border && styles2.buttonBorder].join(" "),
|
|
940
|
+
onClick,
|
|
941
|
+
children: jsx("svg", {
|
|
942
|
+
className: styles2.svg,
|
|
943
|
+
viewBox: "0 0 17 17",
|
|
944
|
+
fill: "none",
|
|
945
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
946
|
+
children: jsx("path", {
|
|
947
|
+
className: styles2.path,
|
|
948
|
+
"fill-rule": "evenodd",
|
|
949
|
+
"clip-rule": "evenodd",
|
|
950
|
+
d: "M8.32497 10.025L15.5499 16.6499L16.6249 15.5749L10.025 8.32497L16.6249 1.075L15.5499 0L8.32497 6.62498L1.075 0.0249999L0 1.1L6.62498 8.32497L0 15.5499L1.075 16.6249L8.32497 10.025Z"
|
|
951
|
+
})
|
|
952
|
+
})
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
const sortAscending = (accessor) => {
|
|
956
|
+
return (a, b) => {
|
|
957
|
+
const valueA = a[accessor];
|
|
958
|
+
const valueB = b[accessor];
|
|
959
|
+
if (valueA < valueB)
|
|
960
|
+
return -1;
|
|
961
|
+
if (valueA > valueB)
|
|
962
|
+
return 1;
|
|
963
|
+
return 0;
|
|
964
|
+
};
|
|
965
|
+
};
|
|
966
|
+
const sortDescending = (accessor) => {
|
|
967
|
+
return (a, b) => {
|
|
968
|
+
const valueA = a[accessor];
|
|
969
|
+
const valueB = b[accessor];
|
|
970
|
+
if (valueA > valueB)
|
|
971
|
+
return -1;
|
|
972
|
+
if (valueA < valueB)
|
|
973
|
+
return 1;
|
|
974
|
+
return 0;
|
|
975
|
+
};
|
|
976
|
+
};
|
|
977
|
+
function useTable({
|
|
978
|
+
columns,
|
|
979
|
+
data,
|
|
980
|
+
sortState
|
|
981
|
+
}) {
|
|
982
|
+
const sortedData = useMemo(() => {
|
|
983
|
+
if (sortState.columnIndex < 0) {
|
|
984
|
+
return data;
|
|
985
|
+
}
|
|
986
|
+
const column = columns[sortState.columnIndex];
|
|
987
|
+
const sortFunction = sortState.ascending ? sortAscending(column.accessor) : sortDescending(column.accessor);
|
|
988
|
+
return data.toSorted(sortFunction);
|
|
989
|
+
}, [columns, data, sortState]);
|
|
990
|
+
const columnModels = useMemo(() => {
|
|
991
|
+
return columns.map((column, columnIndex) => {
|
|
992
|
+
const isSorted = sortState.columnIndex === columnIndex && sortState;
|
|
993
|
+
return new ColumnModel(columnIndex, column, isSorted);
|
|
994
|
+
});
|
|
995
|
+
}, [columns, sortState]);
|
|
996
|
+
const rowModels = useMemo(() => {
|
|
997
|
+
return sortedData.map((d2, rowIndex) => {
|
|
998
|
+
const cells = columnModels.map((column, columnIndex) => {
|
|
999
|
+
return new CellModel(column, columnIndex, d2, column.cell);
|
|
1000
|
+
});
|
|
1001
|
+
return new RowModel(rowIndex, cells);
|
|
1002
|
+
});
|
|
1003
|
+
}, [columnModels, sortedData]);
|
|
1004
|
+
return {
|
|
1005
|
+
columns: columnModels,
|
|
1006
|
+
rows: rowModels
|
|
1007
|
+
};
|
|
1008
|
+
}
|
|
1009
|
+
class ColumnModel {
|
|
1010
|
+
constructor(index2, definition, isSorted) {
|
|
1011
|
+
this.index = index2;
|
|
1012
|
+
this.definition = definition;
|
|
1013
|
+
this.isSorted = isSorted;
|
|
1014
|
+
this.defaultValue = definition.defaultValue;
|
|
1015
|
+
}
|
|
1016
|
+
get id() {
|
|
1017
|
+
return this.definition.id || this.header;
|
|
1018
|
+
}
|
|
1019
|
+
get accessor() {
|
|
1020
|
+
return this.definition.accessor;
|
|
1021
|
+
}
|
|
1022
|
+
get header() {
|
|
1023
|
+
return this.definition.header;
|
|
1024
|
+
}
|
|
1025
|
+
get headerProps() {
|
|
1026
|
+
return {
|
|
1027
|
+
text: this.header,
|
|
1028
|
+
sortable: this.definition.sortable,
|
|
1029
|
+
isSorted: this.isSorted,
|
|
1030
|
+
...this.headerCellStyle
|
|
1031
|
+
};
|
|
1032
|
+
}
|
|
1033
|
+
get cell() {
|
|
1034
|
+
return this.definition.cell;
|
|
1035
|
+
}
|
|
1036
|
+
get styles() {
|
|
1037
|
+
return this.definition.styles;
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
class RowModel {
|
|
1041
|
+
constructor(index2, cells) {
|
|
1042
|
+
this.index = index2;
|
|
1043
|
+
this.cells = cells;
|
|
1044
|
+
}
|
|
1045
|
+
get id() {
|
|
1046
|
+
return this.index;
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
class CellModel {
|
|
1050
|
+
constructor(column, columnIndex, row, cell) {
|
|
1051
|
+
this.column = column;
|
|
1052
|
+
this.columnIndex = columnIndex;
|
|
1053
|
+
this.row = row;
|
|
1054
|
+
this.cell = cell;
|
|
1055
|
+
}
|
|
1056
|
+
get id() {
|
|
1057
|
+
return this.columnIndex;
|
|
1058
|
+
}
|
|
1059
|
+
get displayValue() {
|
|
1060
|
+
if (this.cell) {
|
|
1061
|
+
return this.cell(this.row);
|
|
1062
|
+
}
|
|
1063
|
+
if (!Object.prototype.hasOwnProperty.call(this.row, this.column.accessor)) {
|
|
1064
|
+
if (this.column.defaultValue) {
|
|
1065
|
+
return this.column.defaultValue.toString();
|
|
1066
|
+
}
|
|
1067
|
+
const rowData = JSON.stringify(this.row, null, 2);
|
|
1068
|
+
throw new Error(`Missing value for key ${this.column.accessor} in ${rowData}`);
|
|
1069
|
+
}
|
|
1070
|
+
return this.row[this.column.accessor].toString();
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
const table = "_table_1b75c_9";
|
|
1074
|
+
const hideHeader = "_hideHeader_1b75c_18";
|
|
1075
|
+
const hideHeaderNoBorder = "_hideHeaderNoBorder_1b75c_27";
|
|
1076
|
+
const headerCell = "_headerCell_1b75c_31";
|
|
1077
|
+
const headerCellButton = "_headerCellButton_1b75c_39";
|
|
1078
|
+
const bodyRow = "_bodyRow_1b75c_48";
|
|
1079
|
+
const bodyCell = "_bodyCell_1b75c_53";
|
|
1080
|
+
const defaultStyles$b = {
|
|
1081
|
+
table,
|
|
1082
|
+
hideHeader,
|
|
1083
|
+
hideHeaderNoBorder,
|
|
1084
|
+
headerCell,
|
|
1085
|
+
headerCellButton,
|
|
1086
|
+
bodyRow,
|
|
1087
|
+
bodyCell
|
|
1088
|
+
};
|
|
1089
|
+
function Table({
|
|
1090
|
+
columns,
|
|
1091
|
+
data,
|
|
1092
|
+
hideHeader: hideHeader2 = false,
|
|
1093
|
+
styles: styles2
|
|
1094
|
+
}) {
|
|
1095
|
+
const [sortState, setSortState] = useState(() => {
|
|
1096
|
+
const columnIndex = columns.findIndex((column) => {
|
|
1097
|
+
if ("sort" in column) {
|
|
1098
|
+
return true;
|
|
1099
|
+
}
|
|
1100
|
+
return false;
|
|
1101
|
+
});
|
|
1102
|
+
const ascending = columnIndex >= 0 ? columns[columnIndex].sort.ascending : false;
|
|
1103
|
+
return {
|
|
1104
|
+
columnIndex,
|
|
1105
|
+
ascending
|
|
1106
|
+
};
|
|
1107
|
+
});
|
|
1108
|
+
const table2 = useTable({
|
|
1109
|
+
columns,
|
|
1110
|
+
data,
|
|
1111
|
+
sortState
|
|
1112
|
+
});
|
|
1113
|
+
const sortByColumn = (index2) => {
|
|
1114
|
+
setSortState((currentState) => {
|
|
1115
|
+
return {
|
|
1116
|
+
columnIndex: index2,
|
|
1117
|
+
ascending: index2 === currentState.columnIndex ? !currentState.ascending : false
|
|
1118
|
+
};
|
|
1119
|
+
});
|
|
1120
|
+
};
|
|
1121
|
+
styles2 = mergeStyles(defaultStyles$b, styles2);
|
|
1122
|
+
return jsxs("table", {
|
|
1123
|
+
className: styles2.table,
|
|
1124
|
+
children: [jsx("thead", {
|
|
1125
|
+
className: hideHeader2 && styles2.hideHeader,
|
|
1126
|
+
children: jsx("tr", {
|
|
1127
|
+
children: table2.columns.map((column, index2) => {
|
|
1128
|
+
var _a;
|
|
1129
|
+
return jsx("th", {
|
|
1130
|
+
className: mergeStyles(styles2.headerCell, (_a = column.styles) == null ? void 0 : _a.headerCell),
|
|
1131
|
+
children: jsx(HeaderCell, {
|
|
1132
|
+
styles: mergeStyles(styles2, column.styles),
|
|
1133
|
+
onClick: () => sortByColumn(index2),
|
|
1134
|
+
...column.headerProps
|
|
1135
|
+
}, index2)
|
|
1136
|
+
}, column.id);
|
|
1137
|
+
})
|
|
1138
|
+
})
|
|
1139
|
+
}), jsx("tbody", {
|
|
1140
|
+
className: hideHeader2 && styles2.hideHeaderNoBorder,
|
|
1141
|
+
children: table2.rows.map((row) => {
|
|
1142
|
+
return jsx("tr", {
|
|
1143
|
+
className: styles2.bodyRow,
|
|
1144
|
+
children: row.cells.map((cell) => {
|
|
1145
|
+
var _a;
|
|
1146
|
+
return jsx("td", {
|
|
1147
|
+
className: mergeStyles(styles2.bodyCell, (_a = cell.column.styles) == null ? void 0 : _a.bodyCell),
|
|
1148
|
+
children: cell.displayValue
|
|
1149
|
+
}, cell.id);
|
|
1150
|
+
})
|
|
1151
|
+
}, row.id);
|
|
1152
|
+
})
|
|
1153
|
+
})]
|
|
1154
|
+
});
|
|
1155
|
+
}
|
|
1156
|
+
function HeaderCell({
|
|
1157
|
+
text: text2,
|
|
1158
|
+
sortable,
|
|
1159
|
+
isSorted,
|
|
1160
|
+
styles: styles2,
|
|
1161
|
+
onClick
|
|
1162
|
+
}) {
|
|
1163
|
+
if (!sortable) {
|
|
1164
|
+
return text2;
|
|
1165
|
+
}
|
|
1166
|
+
let direction = "down";
|
|
1167
|
+
if ((isSorted == null ? void 0 : isSorted.ascending) === false) {
|
|
1168
|
+
direction = "up";
|
|
1169
|
+
}
|
|
1170
|
+
return jsxs("button", {
|
|
1171
|
+
onClick,
|
|
1172
|
+
className: styles2.headerCellButton,
|
|
1173
|
+
children: [jsx("span", {
|
|
1174
|
+
children: text2
|
|
1175
|
+
}), jsx(Chevron, {
|
|
1176
|
+
active: !!isSorted,
|
|
1177
|
+
direction
|
|
1178
|
+
})]
|
|
1179
|
+
});
|
|
1180
|
+
}
|
|
1181
|
+
function preventOverlap(labelPositions, iteration = 0, labelHeight = 12) {
|
|
1182
|
+
const maxIterations = 10;
|
|
1183
|
+
let totalOverlap = 0;
|
|
1184
|
+
for (let index2 = 1; index2 < labelPositions.length; index2++) {
|
|
1185
|
+
const previousElement = labelPositions[index2 - 1];
|
|
1186
|
+
const element = labelPositions[index2];
|
|
1187
|
+
const overlap = previousElement.y - (element.y - labelHeight);
|
|
1188
|
+
if (overlap < 0) {
|
|
1189
|
+
continue;
|
|
1190
|
+
}
|
|
1191
|
+
previousElement.y -= overlap / 2;
|
|
1192
|
+
element.y += overlap / 2;
|
|
1193
|
+
totalOverlap += overlap;
|
|
1194
|
+
}
|
|
1195
|
+
if (totalOverlap > 0 && iteration < maxIterations) {
|
|
1196
|
+
return preventOverlap(labelPositions, iteration + 1);
|
|
1197
|
+
}
|
|
1198
|
+
return labelPositions;
|
|
1199
|
+
}
|
|
1200
|
+
function uniqueBy(array, key) {
|
|
1201
|
+
return [...array.reduce((map, d2) => map.set(d2[key], d2), /* @__PURE__ */ new Map()).values()];
|
|
1202
|
+
}
|
|
1203
|
+
function positionLabels(labels) {
|
|
1204
|
+
labels = uniqueBy(labels, "value");
|
|
1205
|
+
labels.sort((a, b) => a.y - b.y);
|
|
1206
|
+
return preventOverlap(labels);
|
|
1207
|
+
}
|
|
1208
|
+
function scaleLinear(domain, range) {
|
|
1209
|
+
const [domainMin, domainMax] = domain;
|
|
1210
|
+
const [rangeMin, rangeMax] = range;
|
|
1211
|
+
const slope = (rangeMax - rangeMin) / (domainMax - domainMin);
|
|
1212
|
+
const intercept = rangeMin - slope * domainMin;
|
|
1213
|
+
return function(x) {
|
|
1214
|
+
return slope * x + intercept;
|
|
1215
|
+
};
|
|
1216
|
+
}
|
|
1217
|
+
function useWindowSize() {
|
|
1218
|
+
const [windowSize, setWindowSize] = useState(() => {
|
|
1219
|
+
if (typeof window === "undefined")
|
|
1220
|
+
return {
|
|
1221
|
+
width: 0,
|
|
1222
|
+
height: 0
|
|
1223
|
+
};
|
|
1224
|
+
return {
|
|
1225
|
+
width: window.innerWidth,
|
|
1226
|
+
height: window.innerHeight
|
|
1227
|
+
};
|
|
1228
|
+
});
|
|
1229
|
+
useEffect(() => {
|
|
1230
|
+
if (typeof window === "undefined")
|
|
1231
|
+
return;
|
|
1232
|
+
function handleResize() {
|
|
1233
|
+
setWindowSize({
|
|
1234
|
+
width: window.innerWidth,
|
|
1235
|
+
height: window.innerHeight
|
|
1236
|
+
});
|
|
1237
|
+
}
|
|
1238
|
+
window.addEventListener("resize", handleResize);
|
|
1239
|
+
return () => {
|
|
1240
|
+
window.removeEventListener("resize", handleResize);
|
|
1241
|
+
};
|
|
1242
|
+
}, []);
|
|
1243
|
+
return windowSize;
|
|
1244
|
+
}
|
|
1245
|
+
const slopeChartContainer = "_slopeChartContainer_gj7pr_1";
|
|
1246
|
+
const svg$2 = "_svg_gj7pr_5";
|
|
1247
|
+
const line = "_line_gj7pr_9";
|
|
1248
|
+
const circle = "_circle_gj7pr_14";
|
|
1249
|
+
const label = "_label_gj7pr_18";
|
|
1250
|
+
const y1Label = "_y1Label_gj7pr_24";
|
|
1251
|
+
const y2Label = "_y2Label_gj7pr_28";
|
|
1252
|
+
const axis$1 = "_axis_gj7pr_32";
|
|
1253
|
+
const axisLabel = "_axisLabel_gj7pr_37";
|
|
1254
|
+
const defaultStyles$a = {
|
|
1255
|
+
slopeChartContainer,
|
|
1256
|
+
svg: svg$2,
|
|
1257
|
+
line,
|
|
1258
|
+
circle,
|
|
1259
|
+
label,
|
|
1260
|
+
y1Label,
|
|
1261
|
+
y2Label,
|
|
1262
|
+
axis: axis$1,
|
|
1263
|
+
axisLabel
|
|
1264
|
+
};
|
|
1265
|
+
const SlopeChart = ({
|
|
1266
|
+
domain,
|
|
1267
|
+
lines,
|
|
1268
|
+
y1Label: y1Label2 = (d2) => d2.y1,
|
|
1269
|
+
y2Label: y2Label2 = (d2) => d2.y2,
|
|
1270
|
+
axis: axis2,
|
|
1271
|
+
styles: styles2,
|
|
1272
|
+
padding = {
|
|
1273
|
+
left: 24,
|
|
1274
|
+
right: 24,
|
|
1275
|
+
top: 20,
|
|
1276
|
+
bottom: 20
|
|
1277
|
+
}
|
|
1278
|
+
}) => {
|
|
1279
|
+
const wrapperRef = useRef(null);
|
|
1280
|
+
const windowSize = useWindowSize();
|
|
1281
|
+
const [width, setWidth] = useState(0);
|
|
1282
|
+
const contentWidth = Math.floor(width - padding.left - padding.right);
|
|
1283
|
+
const contentHeight = contentWidth;
|
|
1284
|
+
const height = contentHeight + padding.top + padding.bottom;
|
|
1285
|
+
const yScale = scaleLinear(domain, [contentHeight, 0]);
|
|
1286
|
+
const show = width > 0;
|
|
1287
|
+
useLayoutEffect(() => {
|
|
1288
|
+
const newWidth = wrapperRef.current.getBoundingClientRect().width;
|
|
1289
|
+
setWidth(newWidth);
|
|
1290
|
+
}, [windowSize]);
|
|
1291
|
+
const y1Labels = useMemo(() => {
|
|
1292
|
+
let labels = lines.map((d2) => ({
|
|
1293
|
+
y: yScale(d2.y1),
|
|
1294
|
+
value: y1Label2(d2)
|
|
1295
|
+
}));
|
|
1296
|
+
return positionLabels(labels);
|
|
1297
|
+
}, [lines, y1Label2, yScale]);
|
|
1298
|
+
const y2Labels = useMemo(() => {
|
|
1299
|
+
let labels = lines.map((d2) => ({
|
|
1300
|
+
y: yScale(d2.y2),
|
|
1301
|
+
value: y2Label2(d2)
|
|
1302
|
+
}));
|
|
1303
|
+
return positionLabels(labels);
|
|
1304
|
+
}, [lines, y2Label2, yScale]);
|
|
1305
|
+
styles2 = mergeStyles({
|
|
1306
|
+
...defaultStyles$a
|
|
1307
|
+
}, styles2);
|
|
1308
|
+
const chart = jsx("svg", {
|
|
1309
|
+
class: styles2.svg,
|
|
1310
|
+
width,
|
|
1311
|
+
height,
|
|
1312
|
+
children: jsxs("g", {
|
|
1313
|
+
transform: `translate(${padding.left} ${padding.top})`,
|
|
1314
|
+
children: [jsxs("g", {
|
|
1315
|
+
transform: `translate(0 ${contentHeight})`,
|
|
1316
|
+
children: [jsx("line", {
|
|
1317
|
+
x1: 0,
|
|
1318
|
+
x2: contentWidth,
|
|
1319
|
+
className: styles2.axis,
|
|
1320
|
+
"shape-rendering": "crispEdges"
|
|
1321
|
+
}), jsx("text", {
|
|
1322
|
+
"dominant-baseline": "hanging",
|
|
1323
|
+
className: [styles2.label, styles2.axisLabel].join(" "),
|
|
1324
|
+
children: axis2.startLabel
|
|
1325
|
+
}), jsx("text", {
|
|
1326
|
+
x: contentWidth,
|
|
1327
|
+
"dominant-baseline": "hanging",
|
|
1328
|
+
"text-anchor": "end",
|
|
1329
|
+
className: [styles2.label, styles2.axisLabel].join(" "),
|
|
1330
|
+
children: axis2.endLabel
|
|
1331
|
+
})]
|
|
1332
|
+
}), lines.map((line2, index2) => {
|
|
1333
|
+
const itemStyles = mergeStyles({
|
|
1334
|
+
...styles2
|
|
1335
|
+
}, line2.styles);
|
|
1336
|
+
return jsxs("g", {
|
|
1337
|
+
children: [jsx("line", {
|
|
1338
|
+
x1: 0,
|
|
1339
|
+
y1: yScale(line2.y1),
|
|
1340
|
+
x2: contentWidth,
|
|
1341
|
+
y2: yScale(line2.y2),
|
|
1342
|
+
className: `${itemStyles.line} stroke-color--${line2.abbreviation}`
|
|
1343
|
+
}), jsx("circle", {
|
|
1344
|
+
cx: 0,
|
|
1345
|
+
cy: yScale(line2.y1),
|
|
1346
|
+
r: 4,
|
|
1347
|
+
className: `${itemStyles.circle} fill-color--${line2.abbreviation}`
|
|
1348
|
+
}), jsx("circle", {
|
|
1349
|
+
cx: contentWidth,
|
|
1350
|
+
cy: yScale(line2.y2),
|
|
1351
|
+
r: 4,
|
|
1352
|
+
className: `${itemStyles.circle} fill-color--${line2.abbreviation}`
|
|
1353
|
+
})]
|
|
1354
|
+
}, index2);
|
|
1355
|
+
}), y1Labels.map((label2, index2) => {
|
|
1356
|
+
return jsx("g", {
|
|
1357
|
+
children: jsx("text", {
|
|
1358
|
+
x: 0,
|
|
1359
|
+
y: label2.y,
|
|
1360
|
+
className: [styles2.label, styles2.y1Label].join(" "),
|
|
1361
|
+
"text-anchor": "end",
|
|
1362
|
+
"dominant-baseline": "middle",
|
|
1363
|
+
children: label2.value
|
|
1364
|
+
})
|
|
1365
|
+
}, index2);
|
|
1366
|
+
}), y2Labels.map((label2, index2) => {
|
|
1367
|
+
return jsx("g", {
|
|
1368
|
+
children: jsx("text", {
|
|
1369
|
+
x: contentWidth,
|
|
1370
|
+
y: label2.y,
|
|
1371
|
+
className: [styles2.label, styles2.y2Label].join(" "),
|
|
1372
|
+
"text-anchor": "start",
|
|
1373
|
+
"dominant-baseline": "middle",
|
|
1374
|
+
children: label2.value
|
|
1375
|
+
})
|
|
1376
|
+
}, index2);
|
|
1377
|
+
})]
|
|
1378
|
+
})
|
|
1379
|
+
});
|
|
1380
|
+
return jsx("div", {
|
|
1381
|
+
class: styles2.slopeChartContainer,
|
|
1382
|
+
ref: wrapperRef,
|
|
1383
|
+
children: show && chart
|
|
1384
|
+
});
|
|
1385
|
+
};
|
|
1386
|
+
const useTooltipTarget = (targetElement, trackPosition) => {
|
|
1387
|
+
const [targetRect, setTargetRect] = useState();
|
|
1388
|
+
const [position, setPosition] = useState(null);
|
|
1389
|
+
const [hoverActive, setHoverActive] = useState(false);
|
|
1390
|
+
const onMouseMove = ({
|
|
1391
|
+
clientX,
|
|
1392
|
+
clientY,
|
|
1393
|
+
currentTarget
|
|
1394
|
+
}) => {
|
|
1395
|
+
const rect2 = currentTarget.getBoundingClientRect();
|
|
1396
|
+
const x = clientX - rect2.left;
|
|
1397
|
+
const y = clientY - rect2.top;
|
|
1398
|
+
requestAnimationFrame(() => {
|
|
1399
|
+
setPosition({
|
|
1400
|
+
x,
|
|
1401
|
+
y
|
|
1402
|
+
});
|
|
1403
|
+
setHoverActive(true);
|
|
1404
|
+
});
|
|
1405
|
+
};
|
|
1406
|
+
const onMouseOut = () => {
|
|
1407
|
+
requestAnimationFrame(() => {
|
|
1408
|
+
setHoverActive(false);
|
|
1409
|
+
});
|
|
1410
|
+
};
|
|
1411
|
+
useEffect(() => {
|
|
1412
|
+
setTargetRect(targetElement.getBoundingClientRect());
|
|
1413
|
+
if (trackPosition) {
|
|
1414
|
+
targetElement.addEventListener("mousemove", onMouseMove);
|
|
1415
|
+
targetElement.addEventListener("mouseout", onMouseOut);
|
|
1416
|
+
}
|
|
1417
|
+
return () => {
|
|
1418
|
+
if (trackPosition) {
|
|
1419
|
+
targetElement.removeEventListener("mousemove", onMouseMove);
|
|
1420
|
+
targetElement.removeEventListener("mouseout", onMouseOut);
|
|
1421
|
+
}
|
|
1422
|
+
};
|
|
1423
|
+
}, [targetElement, trackPosition]);
|
|
1424
|
+
return {
|
|
1425
|
+
targetRect,
|
|
1426
|
+
positionInTarget: position,
|
|
1427
|
+
hoverActive
|
|
1428
|
+
};
|
|
1429
|
+
};
|
|
1430
|
+
function n(n2) {
|
|
1431
|
+
return (r) => {
|
|
1432
|
+
n2.forEach((n3) => {
|
|
1433
|
+
"function" == typeof n3 ? n3(r) : null != n3 && (n3.current = r);
|
|
1434
|
+
});
|
|
1435
|
+
};
|
|
1436
|
+
}
|
|
1437
|
+
var T, c;
|
|
1438
|
+
!function(e) {
|
|
1439
|
+
e.APPEAR = "appear", e.APPEAR_ACTIVE = "appearActive", e.APPEAR_DONE = "appearDone", e.ENTER = "enter", e.ENTER_ACTIVE = "enterActive", e.ENTER_DONE = "enterDone", e.EXIT = "exit", e.EXIT_ACTIVE = "exitActive", e.EXIT_DONE = "exitDone";
|
|
1440
|
+
}(T || (T = {})), function(e) {
|
|
1441
|
+
e.ENTER = "onEnter", e.ENTERING = "onEntering", e.ENTERED = "onEntered", e.EXIT = "onExit", e.EXITING = "onExiting", e.EXITED = "onExited";
|
|
1442
|
+
}(c || (c = {}));
|
|
1443
|
+
const s = { [T.APPEAR]: [c.ENTER, T.APPEAR_ACTIVE], [T.APPEAR_ACTIVE]: [c.ENTERING, T.APPEAR_DONE, true], [T.APPEAR_DONE]: [c.ENTERED], [T.ENTER]: [c.ENTER, T.ENTER_ACTIVE], [T.ENTER_ACTIVE]: [c.ENTERING, T.ENTER_DONE, true], [T.ENTER_DONE]: [c.ENTERED], [T.EXIT]: [c.EXIT, T.EXIT_ACTIVE], [T.EXIT_ACTIVE]: [c.EXITING, T.EXIT_DONE, true], [T.EXIT_DONE]: [c.EXITED] };
|
|
1444
|
+
var u = (r) => {
|
|
1445
|
+
const { children: c2, in: u2 = false, appear: A = false, enter: N2 = true, exit: l = true, duration: I = 500, alwaysMounted: p2 = false, addEndListener: R2 } = r, P2 = useRef(), _2 = useRef();
|
|
1446
|
+
let d2 = false;
|
|
1447
|
+
const [f, D] = useState(() => (d2 = true, u2 ? A ? T.APPEAR : T.APPEAR_DONE : T.EXIT_DONE));
|
|
1448
|
+
useEffect(() => {
|
|
1449
|
+
var e;
|
|
1450
|
+
const { setTimeout: E, clearTimeout: t } = window, [n2, o, i] = s[f];
|
|
1451
|
+
return null == (e = r[n2]) || e.call(r, P2.current), o && (i ? R2 ? R2(P2.current, () => D(o)) : _2.current = E(D, I, o) : D(o)), () => {
|
|
1452
|
+
t(_2.current);
|
|
1453
|
+
};
|
|
1454
|
+
}, [f, I]), useLayoutEffect(() => {
|
|
1455
|
+
d2 || D(u2 ? N2 ? T.ENTER : T.ENTER_DONE : l ? T.EXIT : T.EXIT_DONE);
|
|
1456
|
+
}, [u2]);
|
|
1457
|
+
const X = useMemo(() => {
|
|
1458
|
+
const e = {};
|
|
1459
|
+
return Object.values(T).forEach((r2) => {
|
|
1460
|
+
e[r2] = f === r2;
|
|
1461
|
+
}), e;
|
|
1462
|
+
}, [f]);
|
|
1463
|
+
if (!p2 && f === T.EXIT_DONE)
|
|
1464
|
+
return null;
|
|
1465
|
+
const O = c2(X, f);
|
|
1466
|
+
return cloneElement(O, { ref: n([P2, O.ref]) });
|
|
1467
|
+
};
|
|
1468
|
+
function N(e, r) {
|
|
1469
|
+
if (null == e)
|
|
1470
|
+
return {};
|
|
1471
|
+
var E, t, n2 = {}, o = Object.keys(e);
|
|
1472
|
+
for (t = 0; t < o.length; t++)
|
|
1473
|
+
r.indexOf(E = o[t]) >= 0 || (n2[E] = e[E]);
|
|
1474
|
+
return n2;
|
|
1475
|
+
}
|
|
1476
|
+
const p = ["children", "classNames"], R = { [T.APPEAR]: "-appear", [T.APPEAR_ACTIVE]: "-appear-active", [T.APPEAR_DONE]: "-appear-done", [T.ENTER]: "-enter", [T.ENTER_ACTIVE]: "-enter-active", [T.ENTER_DONE]: "-enter-done", [T.EXIT]: "-exit", [T.EXIT_ACTIVE]: "-exit-active", [T.EXIT_DONE]: "-exit-done" }, P = (...e) => e.filter((e2) => !!e2).join(" "), _ = (e, r) => "string" == typeof r ? `${r}${R[e]}` : r[e];
|
|
1477
|
+
var d = (E) => {
|
|
1478
|
+
const { children: t, classNames: n2 } = E, o = N(E, p);
|
|
1479
|
+
return createElement(u, o, (r, E2) => {
|
|
1480
|
+
const { className: o2 } = t.props, i = useMemo(() => P(o2, ((e, r2) => {
|
|
1481
|
+
const E3 = _(e, r2);
|
|
1482
|
+
switch (e) {
|
|
1483
|
+
case T.APPEAR_ACTIVE:
|
|
1484
|
+
return P(_(T.APPEAR, r2), E3);
|
|
1485
|
+
case T.ENTER_ACTIVE:
|
|
1486
|
+
return P(_(T.ENTER, r2), E3);
|
|
1487
|
+
case T.EXIT_ACTIVE:
|
|
1488
|
+
return P(_(T.EXIT, r2), E3);
|
|
1489
|
+
default:
|
|
1490
|
+
return E3;
|
|
1491
|
+
}
|
|
1492
|
+
})(E2, n2)), [o2, n2, E2]);
|
|
1493
|
+
return cloneElement(t, { className: i });
|
|
1494
|
+
});
|
|
1495
|
+
};
|
|
1496
|
+
const transitionContainer = "_transitionContainer_1gzlr_1";
|
|
1497
|
+
const modalBox = "_modalBox_1gzlr_13";
|
|
1498
|
+
const enter = "_enter_1gzlr_21";
|
|
1499
|
+
const exitDone = "_exitDone_1gzlr_22";
|
|
1500
|
+
const enterActive = "_enterActive_1gzlr_31";
|
|
1501
|
+
const exit = "_exit_1gzlr_22";
|
|
1502
|
+
const styles$4 = {
|
|
1503
|
+
transitionContainer,
|
|
1504
|
+
modalBox,
|
|
1505
|
+
enter,
|
|
1506
|
+
exitDone,
|
|
1507
|
+
enterActive,
|
|
1508
|
+
exit
|
|
1509
|
+
};
|
|
1510
|
+
function Modal({
|
|
1511
|
+
visible = false,
|
|
1512
|
+
children
|
|
1513
|
+
}) {
|
|
1514
|
+
return jsx(d, {
|
|
1515
|
+
in: visible,
|
|
1516
|
+
duration: 300,
|
|
1517
|
+
classNames: styles$4,
|
|
1518
|
+
alwaysMounted: true,
|
|
1519
|
+
children: jsx("div", {
|
|
1520
|
+
class: styles$4.transitionContainer,
|
|
1521
|
+
children: jsx("div", {
|
|
1522
|
+
class: styles$4.modalBox,
|
|
1523
|
+
children
|
|
1524
|
+
})
|
|
1525
|
+
})
|
|
1526
|
+
});
|
|
1527
|
+
}
|
|
1528
|
+
const tooltip = "_tooltip_11t5d_1";
|
|
1529
|
+
const defaultStyles$9 = {
|
|
1530
|
+
tooltip
|
|
1531
|
+
};
|
|
1532
|
+
const TooltipType = {
|
|
1533
|
+
float: "float",
|
|
1534
|
+
modal: "modal"
|
|
1535
|
+
};
|
|
1536
|
+
function Tooltip({
|
|
1537
|
+
for: targetElement,
|
|
1538
|
+
renderIn: refOrSelector,
|
|
1539
|
+
type = TooltipType.float,
|
|
1540
|
+
styles: styles2,
|
|
1541
|
+
children
|
|
1542
|
+
}) {
|
|
1543
|
+
if (!targetElement)
|
|
1544
|
+
throw new Error("Target for tooltip cannot be undefined");
|
|
1545
|
+
const [tooltipPosition, setTooltipPosition] = useState({
|
|
1546
|
+
x: 0,
|
|
1547
|
+
y: 0
|
|
1548
|
+
});
|
|
1549
|
+
const [displayElement, setDisplayElement] = useState(null);
|
|
1550
|
+
const trackPosition = typeof children === "function";
|
|
1551
|
+
const {
|
|
1552
|
+
targetRect,
|
|
1553
|
+
positionInTarget,
|
|
1554
|
+
hoverActive
|
|
1555
|
+
} = useTooltipTarget(targetElement, trackPosition);
|
|
1556
|
+
const tooltipRef = useRef(null);
|
|
1557
|
+
styles2 = mergeStyles(defaultStyles$9, styles2);
|
|
1558
|
+
useEffect(() => {
|
|
1559
|
+
let element = null;
|
|
1560
|
+
if (typeof refOrSelector === "string") {
|
|
1561
|
+
element = document.querySelector(refOrSelector);
|
|
1562
|
+
} else if ("current" in refOrSelector) {
|
|
1563
|
+
element = refOrSelector.current;
|
|
1564
|
+
} else {
|
|
1565
|
+
throw new Error("renderIn prop needs to be a selector or ref (from useRef)");
|
|
1566
|
+
}
|
|
1567
|
+
setDisplayElement(element);
|
|
1568
|
+
}, [refOrSelector]);
|
|
1569
|
+
useLayoutEffect(() => {
|
|
1570
|
+
if (!tooltipRef.current)
|
|
1571
|
+
return;
|
|
1572
|
+
if (trackPosition && positionInTarget) {
|
|
1573
|
+
const newPosition = tooltipPositionForPoint({
|
|
1574
|
+
targetRect,
|
|
1575
|
+
positionInTarget,
|
|
1576
|
+
tooltip: tooltipRef.current,
|
|
1577
|
+
displayElement
|
|
1578
|
+
});
|
|
1579
|
+
setTooltipPosition(newPosition);
|
|
1580
|
+
} else if (!trackPosition) {
|
|
1581
|
+
const newPosition = tooltipPositionForRect({
|
|
1582
|
+
targetRect,
|
|
1583
|
+
tooltip: tooltipRef.current,
|
|
1584
|
+
displayElement
|
|
1585
|
+
});
|
|
1586
|
+
setTooltipPosition(newPosition);
|
|
1587
|
+
}
|
|
1588
|
+
}, [trackPosition, targetRect, positionInTarget, displayElement, tooltipRef]);
|
|
1589
|
+
if (!displayElement)
|
|
1590
|
+
return;
|
|
1591
|
+
const displayTooltip = hoverActive || !trackPosition;
|
|
1592
|
+
const fixedStyle = type === TooltipType.modal ? {} : {
|
|
1593
|
+
display: displayTooltip ? "block" : "none",
|
|
1594
|
+
position: "fixed",
|
|
1595
|
+
left: tooltipPosition.x,
|
|
1596
|
+
top: tooltipPosition.y,
|
|
1597
|
+
zIndex: 100
|
|
1598
|
+
};
|
|
1599
|
+
const tooltip2 = jsxs("div", {
|
|
1600
|
+
ref: tooltipRef,
|
|
1601
|
+
className: styles2.tooltip,
|
|
1602
|
+
style: fixedStyle,
|
|
1603
|
+
children: [positionInTarget && children(positionInTarget), !trackPosition && children]
|
|
1604
|
+
});
|
|
1605
|
+
return createPortal(type === TooltipType.modal ? jsx(Modal, {
|
|
1606
|
+
visible: hoverActive,
|
|
1607
|
+
children: tooltip2
|
|
1608
|
+
}) : tooltip2, displayElement);
|
|
1609
|
+
}
|
|
1610
|
+
function tooltipPositionForPoint({
|
|
1611
|
+
targetRect,
|
|
1612
|
+
positionInTarget,
|
|
1613
|
+
tooltip: tooltip2,
|
|
1614
|
+
displayElement
|
|
1615
|
+
}) {
|
|
1616
|
+
const newPosition = {
|
|
1617
|
+
x: positionInTarget.x + targetRect.x,
|
|
1618
|
+
y: positionInTarget.y + targetRect.y
|
|
1619
|
+
};
|
|
1620
|
+
const tooltipWidth = tooltip2.offsetWidth;
|
|
1621
|
+
const tooltipHeight = tooltip2.offsetHeight;
|
|
1622
|
+
const displayElementRect = displayElement.getBoundingClientRect();
|
|
1623
|
+
if (newPosition.x + tooltipWidth > displayElementRect.right) {
|
|
1624
|
+
newPosition.x -= tooltipWidth;
|
|
1625
|
+
}
|
|
1626
|
+
if (newPosition.y + tooltipHeight > displayElementRect.bottom) {
|
|
1627
|
+
newPosition.y -= tooltipHeight;
|
|
1628
|
+
}
|
|
1629
|
+
return newPosition;
|
|
1630
|
+
}
|
|
1631
|
+
function tooltipPositionForRect({
|
|
1632
|
+
targetRect,
|
|
1633
|
+
tooltip: tooltip2,
|
|
1634
|
+
displayElement
|
|
1635
|
+
}) {
|
|
1636
|
+
const newPosition = {
|
|
1637
|
+
x: targetRect.right,
|
|
1638
|
+
y: targetRect.top
|
|
1639
|
+
};
|
|
1640
|
+
const tooltipWidth = tooltip2.offsetWidth;
|
|
1641
|
+
const tooltipHeight = tooltip2.offsetHeight;
|
|
1642
|
+
const displayElementRect = displayElement.getBoundingClientRect();
|
|
1643
|
+
if (newPosition.x + tooltipWidth > displayElementRect.right) {
|
|
1644
|
+
newPosition.x = targetRect.left - tooltipWidth;
|
|
1645
|
+
}
|
|
1646
|
+
if (newPosition.y - tooltipHeight < displayElementRect.top) {
|
|
1647
|
+
newPosition.y = targetRect.bottom;
|
|
1648
|
+
}
|
|
1649
|
+
return newPosition;
|
|
1650
|
+
}
|
|
1651
|
+
const text$2 = "_text_1b8t2_1";
|
|
1652
|
+
const container$3 = "_container_1b8t2_10";
|
|
1653
|
+
const defaultStyles$8 = {
|
|
1654
|
+
text: text$2,
|
|
1655
|
+
container: container$3
|
|
1656
|
+
};
|
|
1657
|
+
const ControlChange = ({
|
|
1658
|
+
previous: previous2,
|
|
1659
|
+
next: next2,
|
|
1660
|
+
text: text2,
|
|
1661
|
+
styles: styles2
|
|
1662
|
+
}) => {
|
|
1663
|
+
styles2 = mergeStyles({
|
|
1664
|
+
...defaultStyles$8
|
|
1665
|
+
}, styles2);
|
|
1666
|
+
let hasChanged = next2 !== previous2;
|
|
1667
|
+
return jsx("div", {
|
|
1668
|
+
class: styles2.container,
|
|
1669
|
+
children: jsxs(Fragment, {
|
|
1670
|
+
children: [hasChanged ? jsx(GradientIcon, {
|
|
1671
|
+
previous: previous2,
|
|
1672
|
+
next: next2,
|
|
1673
|
+
styles: {
|
|
1674
|
+
previous: styles2.previous,
|
|
1675
|
+
next: styles2.next
|
|
1676
|
+
}
|
|
1677
|
+
}) : jsx(CircleIcon, {
|
|
1678
|
+
abbreviation: next2,
|
|
1679
|
+
styles: {
|
|
1680
|
+
rect: styles2.next
|
|
1681
|
+
}
|
|
1682
|
+
}), jsx("strong", {
|
|
1683
|
+
className: styles2.text,
|
|
1684
|
+
children: text2
|
|
1685
|
+
})]
|
|
1686
|
+
})
|
|
1687
|
+
});
|
|
1688
|
+
};
|
|
1689
|
+
const toplineResult = "_toplineResult_lvw57_9";
|
|
1690
|
+
const name = "_name_lvw57_12";
|
|
1691
|
+
const displayNumbers = "_displayNumbers_lvw57_25";
|
|
1692
|
+
const mainNumber = "_mainNumber_lvw57_34";
|
|
1693
|
+
const secondaryNumber = "_secondaryNumber_lvw57_38";
|
|
1694
|
+
const displayRow = "_displayRow_lvw57_45";
|
|
1695
|
+
const displayColumn = "_displayColumn_lvw57_51";
|
|
1696
|
+
const topRow = "_topRow_lvw57_55";
|
|
1697
|
+
const defaultStyles$7 = {
|
|
1698
|
+
toplineResult,
|
|
1699
|
+
name,
|
|
1700
|
+
displayNumbers,
|
|
1701
|
+
mainNumber,
|
|
1702
|
+
secondaryNumber,
|
|
1703
|
+
displayRow,
|
|
1704
|
+
displayColumn,
|
|
1705
|
+
topRow
|
|
1706
|
+
};
|
|
1707
|
+
const ToplineResult = ({
|
|
1708
|
+
name: name2,
|
|
1709
|
+
mainNumber: mainNumber2,
|
|
1710
|
+
secondaryNumber: secondaryNumber2,
|
|
1711
|
+
styles: styles2,
|
|
1712
|
+
displayRow: displayRow2 = false,
|
|
1713
|
+
abbreviation,
|
|
1714
|
+
onMouseOver,
|
|
1715
|
+
onInfoPress,
|
|
1716
|
+
showInfoButton = false
|
|
1717
|
+
}) => {
|
|
1718
|
+
styles2 = mergeStyles({
|
|
1719
|
+
...defaultStyles$7
|
|
1720
|
+
}, styles2);
|
|
1721
|
+
const displayStyle = displayRow2 ? styles2.displayRow : styles2.displayColumn;
|
|
1722
|
+
return jsxs("div", {
|
|
1723
|
+
class: styles2.toplineResult,
|
|
1724
|
+
onMouseOver,
|
|
1725
|
+
children: [jsxs("div", {
|
|
1726
|
+
class: styles2.topRow,
|
|
1727
|
+
children: [jsx("span", {
|
|
1728
|
+
class: `${styles2.name} before-color--${abbreviation}`,
|
|
1729
|
+
children: name2
|
|
1730
|
+
}), " ", showInfoButton && jsx("span", {
|
|
1731
|
+
class: styles2.infoButton,
|
|
1732
|
+
children: jsx(InfoButton, {
|
|
1733
|
+
onClick: onInfoPress
|
|
1734
|
+
})
|
|
1735
|
+
})]
|
|
1736
|
+
}), jsxs("div", {
|
|
1737
|
+
class: `${styles2.displayNumbers} ${displayStyle}`,
|
|
1738
|
+
children: [jsx("div", {
|
|
1739
|
+
class: styles2.mainNumber,
|
|
1740
|
+
children: mainNumber2
|
|
1741
|
+
}), jsx("div", {
|
|
1742
|
+
class: styles2.secondaryNumber,
|
|
1743
|
+
children: secondaryNumber2
|
|
1744
|
+
})]
|
|
1745
|
+
})]
|
|
1746
|
+
});
|
|
1747
|
+
};
|
|
1748
|
+
const section = "_section_te61d_9";
|
|
1749
|
+
const borderTop = "_borderTop_te61d_13";
|
|
1750
|
+
const header = "_header_te61d_45";
|
|
1751
|
+
const content = "_content_te61d_65";
|
|
1752
|
+
const defaultStyles$6 = {
|
|
1753
|
+
section,
|
|
1754
|
+
borderTop,
|
|
1755
|
+
header,
|
|
1756
|
+
content
|
|
1757
|
+
};
|
|
1758
|
+
const PageSection = forwardRef(({
|
|
1759
|
+
children,
|
|
1760
|
+
styles: styles2,
|
|
1761
|
+
borderTop: borderTop2 = false
|
|
1762
|
+
}, ref) => {
|
|
1763
|
+
styles2 = mergeStyles({
|
|
1764
|
+
...defaultStyles$6
|
|
1765
|
+
}, styles2);
|
|
1766
|
+
return jsxs("section", {
|
|
1767
|
+
ref,
|
|
1768
|
+
className: [styles2.section, borderTop2 && styles2.borderTop].join(" "),
|
|
1769
|
+
children: [jsx("div", {
|
|
1770
|
+
className: styles2.header,
|
|
1771
|
+
children: children.header
|
|
1772
|
+
}), jsx("div", {
|
|
1773
|
+
className: styles2.content,
|
|
1774
|
+
children: children.content
|
|
1775
|
+
})]
|
|
1776
|
+
});
|
|
1777
|
+
});
|
|
1778
|
+
const text$1 = "_text_lo5h3_1";
|
|
1779
|
+
const axis = "_axis_lo5h3_6";
|
|
1780
|
+
const bar = "_bar_lo5h3_10";
|
|
1781
|
+
const defaultStyles$5 = {
|
|
1782
|
+
text: text$1,
|
|
1783
|
+
axis,
|
|
1784
|
+
bar
|
|
1785
|
+
};
|
|
1786
|
+
const ColumnChart = ({
|
|
1787
|
+
columns,
|
|
1788
|
+
maxValue,
|
|
1789
|
+
minValue,
|
|
1790
|
+
chartHeight,
|
|
1791
|
+
chartWidth,
|
|
1792
|
+
columnWidth,
|
|
1793
|
+
columnPadding,
|
|
1794
|
+
styles: styles2
|
|
1795
|
+
}) => {
|
|
1796
|
+
styles2 = mergeStyles(defaultStyles$5, styles2);
|
|
1797
|
+
const yScale = scaleLinear$1([maxValue, minValue], [0, chartHeight]);
|
|
1798
|
+
return jsxs("svg", {
|
|
1799
|
+
width: chartWidth,
|
|
1800
|
+
height: chartHeight,
|
|
1801
|
+
style: "",
|
|
1802
|
+
children: [columns.map((column, index2) => {
|
|
1803
|
+
const getHeight = (input2) => {
|
|
1804
|
+
return yScale(0) - yScale(input2);
|
|
1805
|
+
};
|
|
1806
|
+
let totalColumnWidth = Number(columnWidth) + Number(columnPadding.left) + Number(columnPadding.right);
|
|
1807
|
+
return jsxs("g", {
|
|
1808
|
+
children: [jsx("rect", {
|
|
1809
|
+
x: index2 * totalColumnWidth,
|
|
1810
|
+
height: getHeight(Math.abs(column.value)),
|
|
1811
|
+
width: columnWidth,
|
|
1812
|
+
y: column.value > 0 ? yScale(column.value) : yScale(0),
|
|
1813
|
+
fill: column.color,
|
|
1814
|
+
className: `${styles2.bar} fill-color--${column.id}`,
|
|
1815
|
+
id: column.id
|
|
1816
|
+
}, index2), jsx("text", {
|
|
1817
|
+
className: styles2.text,
|
|
1818
|
+
x: index2 * totalColumnWidth + 2,
|
|
1819
|
+
y: column.value < 0 ? yScale(0) - 6 : yScale(0) + 20,
|
|
1820
|
+
children: column.label
|
|
1821
|
+
})]
|
|
1822
|
+
}, index2);
|
|
1823
|
+
}), jsx("rect", {
|
|
1824
|
+
className: styles2.axis,
|
|
1825
|
+
x: 0,
|
|
1826
|
+
y: yScale(0),
|
|
1827
|
+
width: chartWidth,
|
|
1828
|
+
height: 1
|
|
1829
|
+
})]
|
|
1830
|
+
});
|
|
1831
|
+
};
|
|
1832
|
+
const text = "_text_vd5ly_1";
|
|
1833
|
+
const container$2 = "_container_vd5ly_9";
|
|
1834
|
+
const title$1 = "_title_vd5ly_16";
|
|
1835
|
+
const subtitle = "_subtitle_vd5ly_33";
|
|
1836
|
+
const blurb = "_blurb_vd5ly_44";
|
|
1837
|
+
const leftCell = "_leftCell_vd5ly_55";
|
|
1838
|
+
const rightCell = "_rightCell_vd5ly_55";
|
|
1839
|
+
const mugshot = "_mugshot_vd5ly_71";
|
|
1840
|
+
const defaultStyles$4 = {
|
|
1841
|
+
text,
|
|
1842
|
+
container: container$2,
|
|
1843
|
+
title: title$1,
|
|
1844
|
+
subtitle,
|
|
1845
|
+
blurb,
|
|
1846
|
+
leftCell,
|
|
1847
|
+
rightCell,
|
|
1848
|
+
mugshot
|
|
1849
|
+
};
|
|
1850
|
+
const PartyProfile = ({
|
|
1851
|
+
styles: styles2,
|
|
1852
|
+
title: title2,
|
|
1853
|
+
subtitle: subtitle2,
|
|
1854
|
+
blurb: blurb2,
|
|
1855
|
+
imgSrc,
|
|
1856
|
+
abbreviation
|
|
1857
|
+
}) => {
|
|
1858
|
+
styles2 = mergeStyles({
|
|
1859
|
+
...defaultStyles$4
|
|
1860
|
+
}, styles2);
|
|
1861
|
+
return jsx("div", {
|
|
1862
|
+
class: styles2.container,
|
|
1863
|
+
children: jsxs(Fragment, {
|
|
1864
|
+
children: [jsxs("div", {
|
|
1865
|
+
className: styles2.leftCell,
|
|
1866
|
+
children: [jsx("h3", {
|
|
1867
|
+
className: `${styles2.title}`,
|
|
1868
|
+
children: title2
|
|
1869
|
+
}), jsx("div", {
|
|
1870
|
+
className: styles2.subtitle,
|
|
1871
|
+
children: subtitle2
|
|
1872
|
+
}), jsx("div", {
|
|
1873
|
+
className: styles2.blurb,
|
|
1874
|
+
children: blurb2
|
|
1875
|
+
})]
|
|
1876
|
+
}), jsx("div", {
|
|
1877
|
+
className: styles2.rightCell,
|
|
1878
|
+
children: jsx("img", {
|
|
1879
|
+
src: imgSrc,
|
|
1880
|
+
className: `${styles2.mugshot} bg-color--${abbreviation}`
|
|
1881
|
+
})
|
|
1882
|
+
})]
|
|
1883
|
+
})
|
|
1884
|
+
});
|
|
1885
|
+
};
|
|
1886
|
+
var epsilon$1 = 1e-6;
|
|
1887
|
+
function noop() {
|
|
1888
|
+
}
|
|
1889
|
+
var x0 = Infinity, y0 = x0, x1 = -x0, y1 = x1;
|
|
1890
|
+
var boundsStream = {
|
|
1891
|
+
point: boundsPoint,
|
|
1892
|
+
lineStart: noop,
|
|
1893
|
+
lineEnd: noop,
|
|
1894
|
+
polygonStart: noop,
|
|
1895
|
+
polygonEnd: noop,
|
|
1896
|
+
result: function() {
|
|
1897
|
+
var bounds = [[x0, y0], [x1, y1]];
|
|
1898
|
+
x1 = y1 = -(y0 = x0 = Infinity);
|
|
1899
|
+
return bounds;
|
|
1900
|
+
}
|
|
1901
|
+
};
|
|
1902
|
+
function boundsPoint(x, y) {
|
|
1903
|
+
if (x < x0)
|
|
1904
|
+
x0 = x;
|
|
1905
|
+
if (x > x1)
|
|
1906
|
+
x1 = x;
|
|
1907
|
+
if (y < y0)
|
|
1908
|
+
y0 = y;
|
|
1909
|
+
if (y > y1)
|
|
1910
|
+
y1 = y;
|
|
1911
|
+
}
|
|
1912
|
+
function fitExtent(projection, extent, object) {
|
|
1913
|
+
var w = extent[1][0] - extent[0][0], h = extent[1][1] - extent[0][1], clip = projection.clipExtent && projection.clipExtent();
|
|
1914
|
+
projection.scale(150).translate([0, 0]);
|
|
1915
|
+
if (clip != null)
|
|
1916
|
+
projection.clipExtent(null);
|
|
1917
|
+
geoStream(object, projection.stream(boundsStream));
|
|
1918
|
+
var b = boundsStream.result(), k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])), x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2, y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2;
|
|
1919
|
+
if (clip != null)
|
|
1920
|
+
projection.clipExtent(clip);
|
|
1921
|
+
return projection.scale(k * 150).translate([x, y]);
|
|
1922
|
+
}
|
|
1923
|
+
function fitSize(projection, size, object) {
|
|
1924
|
+
return fitExtent(projection, [[0, 0], size], object);
|
|
1925
|
+
}
|
|
1926
|
+
const pi = Math.PI, tau = 2 * pi, epsilon = 1e-6, tauEpsilon = tau - epsilon;
|
|
1927
|
+
function Path() {
|
|
1928
|
+
this._x0 = this._y0 = // start of current subpath
|
|
1929
|
+
this._x1 = this._y1 = null;
|
|
1930
|
+
this._ = "";
|
|
1931
|
+
}
|
|
1932
|
+
function path$2() {
|
|
1933
|
+
return new Path();
|
|
1934
|
+
}
|
|
1935
|
+
Path.prototype = path$2.prototype = {
|
|
1936
|
+
constructor: Path,
|
|
1937
|
+
moveTo: function(x, y) {
|
|
1938
|
+
this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y);
|
|
1939
|
+
},
|
|
1940
|
+
closePath: function() {
|
|
1941
|
+
if (this._x1 !== null) {
|
|
1942
|
+
this._x1 = this._x0, this._y1 = this._y0;
|
|
1943
|
+
this._ += "Z";
|
|
1944
|
+
}
|
|
1945
|
+
},
|
|
1946
|
+
lineTo: function(x, y) {
|
|
1947
|
+
this._ += "L" + (this._x1 = +x) + "," + (this._y1 = +y);
|
|
1948
|
+
},
|
|
1949
|
+
quadraticCurveTo: function(x12, y12, x, y) {
|
|
1950
|
+
this._ += "Q" + +x12 + "," + +y12 + "," + (this._x1 = +x) + "," + (this._y1 = +y);
|
|
1951
|
+
},
|
|
1952
|
+
bezierCurveTo: function(x12, y12, x2, y2, x, y) {
|
|
1953
|
+
this._ += "C" + +x12 + "," + +y12 + "," + +x2 + "," + +y2 + "," + (this._x1 = +x) + "," + (this._y1 = +y);
|
|
1954
|
+
},
|
|
1955
|
+
arcTo: function(x12, y12, x2, y2, r) {
|
|
1956
|
+
x12 = +x12, y12 = +y12, x2 = +x2, y2 = +y2, r = +r;
|
|
1957
|
+
var x02 = this._x1, y02 = this._y1, x21 = x2 - x12, y21 = y2 - y12, x01 = x02 - x12, y01 = y02 - y12, l01_2 = x01 * x01 + y01 * y01;
|
|
1958
|
+
if (r < 0)
|
|
1959
|
+
throw new Error("negative radius: " + r);
|
|
1960
|
+
if (this._x1 === null) {
|
|
1961
|
+
this._ += "M" + (this._x1 = x12) + "," + (this._y1 = y12);
|
|
1962
|
+
} else if (!(l01_2 > epsilon))
|
|
1963
|
+
;
|
|
1964
|
+
else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) {
|
|
1965
|
+
this._ += "L" + (this._x1 = x12) + "," + (this._y1 = y12);
|
|
1966
|
+
} else {
|
|
1967
|
+
var x20 = x2 - x02, y20 = y2 - y02, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l / l01, t21 = l / l21;
|
|
1968
|
+
if (Math.abs(t01 - 1) > epsilon) {
|
|
1969
|
+
this._ += "L" + (x12 + t01 * x01) + "," + (y12 + t01 * y01);
|
|
1970
|
+
}
|
|
1971
|
+
this._ += "A" + r + "," + r + ",0,0," + +(y01 * x20 > x01 * y20) + "," + (this._x1 = x12 + t21 * x21) + "," + (this._y1 = y12 + t21 * y21);
|
|
1972
|
+
}
|
|
1973
|
+
},
|
|
1974
|
+
arc: function(x, y, r, a0, a1, ccw) {
|
|
1975
|
+
x = +x, y = +y, r = +r, ccw = !!ccw;
|
|
1976
|
+
var dx = r * Math.cos(a0), dy = r * Math.sin(a0), x02 = x + dx, y02 = y + dy, cw = 1 ^ ccw, da = ccw ? a0 - a1 : a1 - a0;
|
|
1977
|
+
if (r < 0)
|
|
1978
|
+
throw new Error("negative radius: " + r);
|
|
1979
|
+
if (this._x1 === null) {
|
|
1980
|
+
this._ += "M" + x02 + "," + y02;
|
|
1981
|
+
} else if (Math.abs(this._x1 - x02) > epsilon || Math.abs(this._y1 - y02) > epsilon) {
|
|
1982
|
+
this._ += "L" + x02 + "," + y02;
|
|
1983
|
+
}
|
|
1984
|
+
if (!r)
|
|
1985
|
+
return;
|
|
1986
|
+
if (da < 0)
|
|
1987
|
+
da = da % tau + tau;
|
|
1988
|
+
if (da > tauEpsilon) {
|
|
1989
|
+
this._ += "A" + r + "," + r + ",0,1," + cw + "," + (x - dx) + "," + (y - dy) + "A" + r + "," + r + ",0,1," + cw + "," + (this._x1 = x02) + "," + (this._y1 = y02);
|
|
1990
|
+
} else if (da > epsilon) {
|
|
1991
|
+
this._ += "A" + r + "," + r + ",0," + +(da >= pi) + "," + cw + "," + (this._x1 = x + r * Math.cos(a1)) + "," + (this._y1 = y + r * Math.sin(a1));
|
|
1992
|
+
}
|
|
1993
|
+
},
|
|
1994
|
+
rect: function(x, y, w, h) {
|
|
1995
|
+
this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y) + "h" + +w + "v" + +h + "h" + -w + "Z";
|
|
1996
|
+
},
|
|
1997
|
+
toString: function() {
|
|
1998
|
+
return this._;
|
|
1999
|
+
}
|
|
2000
|
+
};
|
|
2001
|
+
function multiplex(streams) {
|
|
2002
|
+
var n2 = streams.length;
|
|
2003
|
+
return {
|
|
2004
|
+
point: function(x, y) {
|
|
2005
|
+
var i = -1;
|
|
2006
|
+
while (++i < n2)
|
|
2007
|
+
streams[i].point(x, y);
|
|
2008
|
+
},
|
|
2009
|
+
sphere: function() {
|
|
2010
|
+
var i = -1;
|
|
2011
|
+
while (++i < n2)
|
|
2012
|
+
streams[i].sphere();
|
|
2013
|
+
},
|
|
2014
|
+
lineStart: function() {
|
|
2015
|
+
var i = -1;
|
|
2016
|
+
while (++i < n2)
|
|
2017
|
+
streams[i].lineStart();
|
|
2018
|
+
},
|
|
2019
|
+
lineEnd: function() {
|
|
2020
|
+
var i = -1;
|
|
2021
|
+
while (++i < n2)
|
|
2022
|
+
streams[i].lineEnd();
|
|
2023
|
+
},
|
|
2024
|
+
polygonStart: function() {
|
|
2025
|
+
var i = -1;
|
|
2026
|
+
while (++i < n2)
|
|
2027
|
+
streams[i].polygonStart();
|
|
2028
|
+
},
|
|
2029
|
+
polygonEnd: function() {
|
|
2030
|
+
var i = -1;
|
|
2031
|
+
while (++i < n2)
|
|
2032
|
+
streams[i].polygonEnd();
|
|
2033
|
+
}
|
|
2034
|
+
};
|
|
2035
|
+
}
|
|
2036
|
+
function geoAlbersUk() {
|
|
2037
|
+
var cache, cacheStream, main2 = geoAlbers().rotate([4.4, 0.8]).center([0, 55.4]).parallels([50, 60]), mainPoint, shetland = geoAlbers().rotate([4.4, 0.8]).center([0, 55.4]).parallels([50, 60]), shetlandPoint, point, pointStream = {
|
|
2038
|
+
point: function(x, y) {
|
|
2039
|
+
point = [x, y];
|
|
2040
|
+
}
|
|
2041
|
+
};
|
|
2042
|
+
function albersUk(coordinates) {
|
|
2043
|
+
var x = coordinates[0], y = coordinates[1];
|
|
2044
|
+
return point = null, (mainPoint.point(x, y), point) || (shetlandPoint.point(x, y), point);
|
|
2045
|
+
}
|
|
2046
|
+
albersUk.invert = function(coordinates) {
|
|
2047
|
+
var k = main2.scale(), t = main2.translate(), x = (coordinates[0] - t[0]) / k, y = (coordinates[1] - t[1]) / k;
|
|
2048
|
+
return (y >= -0.089 && y < 0.06 && x >= 0.029 && x < 0.046 ? shetland : main2).invert(coordinates);
|
|
2049
|
+
};
|
|
2050
|
+
albersUk.stream = function(stream) {
|
|
2051
|
+
return cache && cacheStream === stream ? cache : cache = multiplex([
|
|
2052
|
+
main2.stream(cacheStream = stream),
|
|
2053
|
+
shetland.stream(stream)
|
|
2054
|
+
]);
|
|
2055
|
+
};
|
|
2056
|
+
albersUk.precision = function(_2) {
|
|
2057
|
+
if (!arguments.length)
|
|
2058
|
+
return main2.precision();
|
|
2059
|
+
main2.precision(_2), shetland.precision(_2);
|
|
2060
|
+
return reset();
|
|
2061
|
+
};
|
|
2062
|
+
albersUk.scale = function(_2) {
|
|
2063
|
+
if (!arguments.length)
|
|
2064
|
+
return main2.scale();
|
|
2065
|
+
main2.scale(_2), shetland.scale(_2);
|
|
2066
|
+
return albersUk.translate(main2.translate());
|
|
2067
|
+
};
|
|
2068
|
+
albersUk.translate = function(_2) {
|
|
2069
|
+
if (!arguments.length)
|
|
2070
|
+
return main2.translate();
|
|
2071
|
+
var k = main2.scale(), x = +_2[0], y = +_2[1];
|
|
2072
|
+
mainPoint = main2.translate(_2).clipExtent([
|
|
2073
|
+
[x - 0.065 * k, y - 0.089 * k],
|
|
2074
|
+
[x + 0.075 * k, y + 0.089 * k]
|
|
2075
|
+
]).stream(pointStream);
|
|
2076
|
+
shetlandPoint = shetland.translate([x + 0.01 * k, y + 0.025 * k]).clipExtent([
|
|
2077
|
+
[x + 0.029 * k + epsilon$1, y - 0.089 * k + epsilon$1],
|
|
2078
|
+
[x + 0.046 * k - epsilon$1, y - 0.06 * k - epsilon$1]
|
|
2079
|
+
]).stream(pointStream);
|
|
2080
|
+
return reset();
|
|
2081
|
+
};
|
|
2082
|
+
albersUk.fitExtent = function(extent, object) {
|
|
2083
|
+
return fitExtent(albersUk, extent, object);
|
|
2084
|
+
};
|
|
2085
|
+
albersUk.fitSize = function(size, object) {
|
|
2086
|
+
return fitSize(albersUk, size, object);
|
|
2087
|
+
};
|
|
2088
|
+
function reset() {
|
|
2089
|
+
cache = cacheStream = null;
|
|
2090
|
+
return albersUk;
|
|
2091
|
+
}
|
|
2092
|
+
albersUk.drawCompositionBorders = function(context) {
|
|
2093
|
+
var ul, ur, ld, ll;
|
|
2094
|
+
ul = main2([-1.113205870242365, 59.64920050773357]);
|
|
2095
|
+
ur = main2([0.807899092399606, 59.59085836472269]);
|
|
2096
|
+
ld = main2([0.5778611961420386, 57.93467822832577]);
|
|
2097
|
+
ll = main2([-1.25867782078448, 57.99029450085142]);
|
|
2098
|
+
context.moveTo(ul[0], ul[1]);
|
|
2099
|
+
context.lineTo(ur[0], ur[1]);
|
|
2100
|
+
context.lineTo(ld[0], ld[1]);
|
|
2101
|
+
context.lineTo(ll[0], ll[1]);
|
|
2102
|
+
context.closePath();
|
|
2103
|
+
};
|
|
2104
|
+
albersUk.getCompositionBorders = function() {
|
|
2105
|
+
var context = path$2();
|
|
2106
|
+
this.drawCompositionBorders(context);
|
|
2107
|
+
return context.toString();
|
|
2108
|
+
};
|
|
2109
|
+
return albersUk.scale(2800);
|
|
2110
|
+
}
|
|
2111
|
+
function bboxFeature(bounds) {
|
|
2112
|
+
const minLon = bounds[0][0];
|
|
2113
|
+
const minLat = bounds[0][1];
|
|
2114
|
+
const maxLon = bounds[1][0];
|
|
2115
|
+
const maxLat = bounds[1][1];
|
|
2116
|
+
const feature = {
|
|
2117
|
+
type: "Feature",
|
|
2118
|
+
properties: {},
|
|
2119
|
+
geometry: {
|
|
2120
|
+
coordinates: [[[minLon, maxLat], [maxLon, maxLat], [maxLon, minLat], [minLon, minLat], [minLon, maxLat]]],
|
|
2121
|
+
type: "Polygon"
|
|
2122
|
+
}
|
|
2123
|
+
};
|
|
2124
|
+
return feature;
|
|
2125
|
+
}
|
|
2126
|
+
const MapContext = createContext();
|
|
2127
|
+
function SVGMapProvider({
|
|
2128
|
+
id,
|
|
2129
|
+
mapRef,
|
|
2130
|
+
width,
|
|
2131
|
+
height,
|
|
2132
|
+
padding,
|
|
2133
|
+
config,
|
|
2134
|
+
zoom,
|
|
2135
|
+
selectedFeature,
|
|
2136
|
+
children
|
|
2137
|
+
}) {
|
|
2138
|
+
const contentSize = useMemo(() => ({
|
|
2139
|
+
width: width - padding.left - padding.right,
|
|
2140
|
+
height: height - padding.top - padding.bottom
|
|
2141
|
+
}), [width, height, padding]);
|
|
2142
|
+
const projection = useMemo(() => {
|
|
2143
|
+
return config.projection.fitSize([contentSize.width, contentSize.height], bboxFeature(config.bounds));
|
|
2144
|
+
}, [contentSize, config]);
|
|
2145
|
+
const path2 = geoPath().projection(projection);
|
|
2146
|
+
const context = {
|
|
2147
|
+
id,
|
|
2148
|
+
mapRef,
|
|
2149
|
+
projection,
|
|
2150
|
+
config,
|
|
2151
|
+
path: path2,
|
|
2152
|
+
size: {
|
|
2153
|
+
width,
|
|
2154
|
+
height
|
|
2155
|
+
},
|
|
2156
|
+
contentSize,
|
|
2157
|
+
padding,
|
|
2158
|
+
zoom,
|
|
2159
|
+
extent: [[0, 0], [width, height]],
|
|
2160
|
+
selectedFeature
|
|
2161
|
+
};
|
|
2162
|
+
return jsx(MapContext.Provider, {
|
|
2163
|
+
value: context,
|
|
2164
|
+
children
|
|
2165
|
+
});
|
|
2166
|
+
}
|
|
2167
|
+
const path$1 = "_path_1cwd5_9";
|
|
2168
|
+
const defaultStyles$3 = {
|
|
2169
|
+
path: path$1
|
|
2170
|
+
};
|
|
2171
|
+
function CompositionBorders({
|
|
2172
|
+
styles: styles2
|
|
2173
|
+
}) {
|
|
2174
|
+
const {
|
|
2175
|
+
projection
|
|
2176
|
+
} = useContext(MapContext);
|
|
2177
|
+
styles2 = mergeStyles(defaultStyles$3, styles2);
|
|
2178
|
+
return jsx("path", {
|
|
2179
|
+
className: styles2.path,
|
|
2180
|
+
d: projection.getCompositionBorders()
|
|
2181
|
+
});
|
|
2182
|
+
}
|
|
2183
|
+
function SVGRenderer({
|
|
2184
|
+
children
|
|
2185
|
+
}) {
|
|
2186
|
+
const {
|
|
2187
|
+
id,
|
|
2188
|
+
mapRef,
|
|
2189
|
+
config,
|
|
2190
|
+
size,
|
|
2191
|
+
selectedFeature,
|
|
2192
|
+
padding
|
|
2193
|
+
} = useContext(MapContext);
|
|
2194
|
+
return jsx("svg", {
|
|
2195
|
+
id,
|
|
2196
|
+
ref: mapRef,
|
|
2197
|
+
width: size.width,
|
|
2198
|
+
height: size.height,
|
|
2199
|
+
viewBox: `0 0 ${size.width} ${size.height}`,
|
|
2200
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2201
|
+
onClick: () => {
|
|
2202
|
+
if (selectedFeature) {
|
|
2203
|
+
selectedFeature.value = null;
|
|
2204
|
+
}
|
|
2205
|
+
},
|
|
2206
|
+
children: jsxs("g", {
|
|
2207
|
+
transform: `translate(${padding.left} ${padding.top})`,
|
|
2208
|
+
children: [jsx("g", {
|
|
2209
|
+
children
|
|
2210
|
+
}), config.drawCompositionBorders && Object.prototype.hasOwnProperty.call(config.projection, "getCompositionBorders") && jsx(CompositionBorders, {})]
|
|
2211
|
+
})
|
|
2212
|
+
});
|
|
2213
|
+
}
|
|
2214
|
+
function useContainerSize(containerRef) {
|
|
2215
|
+
const windowSize = useWindowSize();
|
|
2216
|
+
const [containerSize, setContainerSize] = useState();
|
|
2217
|
+
useLayoutEffect(() => {
|
|
2218
|
+
const container2 = containerRef.current;
|
|
2219
|
+
if (!container2)
|
|
2220
|
+
return;
|
|
2221
|
+
setContainerSize({
|
|
2222
|
+
width: container2.clientWidth,
|
|
2223
|
+
height: container2.clientHeight
|
|
2224
|
+
});
|
|
2225
|
+
}, [containerRef, windowSize]);
|
|
2226
|
+
return containerSize;
|
|
2227
|
+
}
|
|
2228
|
+
const container$1 = "_container_cyrny_1";
|
|
2229
|
+
const svg$1 = "_svg_cyrny_6";
|
|
2230
|
+
const styles$3 = {
|
|
2231
|
+
container: container$1,
|
|
2232
|
+
svg: svg$1
|
|
2233
|
+
};
|
|
2234
|
+
function dynamicPropValue(prop, d2, index2) {
|
|
2235
|
+
if (typeof prop === "function") {
|
|
2236
|
+
return prop(d2, index2);
|
|
2237
|
+
}
|
|
2238
|
+
return prop;
|
|
2239
|
+
}
|
|
2240
|
+
function Polygon({
|
|
2241
|
+
id,
|
|
2242
|
+
features,
|
|
2243
|
+
fill = null,
|
|
2244
|
+
stroke = null,
|
|
2245
|
+
strokeWidth = 1,
|
|
2246
|
+
styles: styles2
|
|
2247
|
+
}) {
|
|
2248
|
+
const context = useContext(MapContext);
|
|
2249
|
+
return jsx(Fragment, {
|
|
2250
|
+
children: features.map((d2, index2) => {
|
|
2251
|
+
return jsx("path", {
|
|
2252
|
+
id: dynamicPropValue(id, d2, index2),
|
|
2253
|
+
className: dynamicPropValue(styles2, d2, index2),
|
|
2254
|
+
fill: dynamicPropValue(fill, d2, index2),
|
|
2255
|
+
stroke: dynamicPropValue(stroke, d2, index2),
|
|
2256
|
+
"stroke-width": dynamicPropValue(strokeWidth, d2, index2),
|
|
2257
|
+
d: context.path(d2)
|
|
2258
|
+
}, index2);
|
|
2259
|
+
})
|
|
2260
|
+
});
|
|
2261
|
+
}
|
|
2262
|
+
function Line({
|
|
2263
|
+
id,
|
|
2264
|
+
features,
|
|
2265
|
+
stroke = null,
|
|
2266
|
+
strokeWidth = 1,
|
|
2267
|
+
styles: styles2
|
|
2268
|
+
}) {
|
|
2269
|
+
const context = useContext(MapContext);
|
|
2270
|
+
const draw = (ctx, path2) => {
|
|
2271
|
+
for (const feature of features) {
|
|
2272
|
+
ctx.beginPath();
|
|
2273
|
+
ctx.lineWidth = strokeWidth / context.pixelRatio;
|
|
2274
|
+
ctx.strokeStyle = stroke;
|
|
2275
|
+
path2(feature);
|
|
2276
|
+
ctx.stroke();
|
|
2277
|
+
}
|
|
2278
|
+
};
|
|
2279
|
+
useEffect(() => {
|
|
2280
|
+
if (context.config.drawToCanvas) {
|
|
2281
|
+
context.register(draw);
|
|
2282
|
+
}
|
|
2283
|
+
return () => {
|
|
2284
|
+
if (context.config.drawToCanvas) {
|
|
2285
|
+
context.unregister(draw);
|
|
2286
|
+
}
|
|
2287
|
+
};
|
|
2288
|
+
}, []);
|
|
2289
|
+
if (context.config.drawToCanvas) {
|
|
2290
|
+
return "<!--Line layer-->";
|
|
2291
|
+
}
|
|
2292
|
+
return jsx(Fragment, {
|
|
2293
|
+
children: features.map((d2, index2) => {
|
|
2294
|
+
const initialStrokeWidth = dynamicPropValue(strokeWidth, d2, index2);
|
|
2295
|
+
const scaledStrokeWidth = initialStrokeWidth / context.zoomScale;
|
|
2296
|
+
return jsx("path", {
|
|
2297
|
+
id: dynamicPropValue(id, d2, index2),
|
|
2298
|
+
stroke: dynamicPropValue(stroke, d2, index2),
|
|
2299
|
+
"stroke-line-join": "round",
|
|
2300
|
+
"stroke-width": scaledStrokeWidth,
|
|
2301
|
+
fill: "none",
|
|
2302
|
+
className: dynamicPropValue(styles2, d2, index2),
|
|
2303
|
+
d: context.path(d2)
|
|
2304
|
+
}, index2);
|
|
2305
|
+
})
|
|
2306
|
+
});
|
|
2307
|
+
}
|
|
2308
|
+
function Prerendered({
|
|
2309
|
+
url
|
|
2310
|
+
}) {
|
|
2311
|
+
const context = useContext(MapContext);
|
|
2312
|
+
const {
|
|
2313
|
+
width,
|
|
2314
|
+
height
|
|
2315
|
+
} = context.contentSize;
|
|
2316
|
+
return jsx("image", {
|
|
2317
|
+
width,
|
|
2318
|
+
height,
|
|
2319
|
+
href: url
|
|
2320
|
+
});
|
|
2321
|
+
}
|
|
2322
|
+
function Point({
|
|
2323
|
+
id,
|
|
2324
|
+
features,
|
|
2325
|
+
radius = 4,
|
|
2326
|
+
fill = null,
|
|
2327
|
+
stroke = null,
|
|
2328
|
+
strokeWidth = 1,
|
|
2329
|
+
styles: styles2
|
|
2330
|
+
}) {
|
|
2331
|
+
const context = useContext(MapContext);
|
|
2332
|
+
return jsx(Fragment, {
|
|
2333
|
+
children: features.map((d2, index2) => {
|
|
2334
|
+
const [cx, cy] = context.projection(d2.geometry.coordinates);
|
|
2335
|
+
return jsx("circle", {
|
|
2336
|
+
id: dynamicPropValue(id, d2, index2),
|
|
2337
|
+
cx,
|
|
2338
|
+
cy,
|
|
2339
|
+
r: dynamicPropValue(radius, d2, index2),
|
|
2340
|
+
className: dynamicPropValue(styles2, d2, index2),
|
|
2341
|
+
fill: dynamicPropValue(fill, d2, index2),
|
|
2342
|
+
stroke: dynamicPropValue(stroke, d2, index2),
|
|
2343
|
+
strokeWidth: dynamicPropValue(strokeWidth, d2, index2)
|
|
2344
|
+
}, index2);
|
|
2345
|
+
})
|
|
2346
|
+
});
|
|
2347
|
+
}
|
|
2348
|
+
const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2349
|
+
__proto__: null,
|
|
2350
|
+
CompositionBorders,
|
|
2351
|
+
Line,
|
|
2352
|
+
Point,
|
|
2353
|
+
Polygon,
|
|
2354
|
+
Prerendered
|
|
2355
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2356
|
+
const Projection = {
|
|
2357
|
+
geoAlbersUKComposite: geoAlbersUk(),
|
|
2358
|
+
geoAlbersEngland: geoAlbers().center([0, 52.7]).rotate([1.1743, 0]).parallels([50, 54]),
|
|
2359
|
+
geoMercator: geoMercator()
|
|
2360
|
+
};
|
|
2361
|
+
const MapConfiguration = {
|
|
2362
|
+
UKComposite: {
|
|
2363
|
+
projection: Projection.geoAlbersUKComposite,
|
|
2364
|
+
bounds: [[-8.642194417322951, 49.88234469492934], [1.7683086664999994, 60.8456995072]],
|
|
2365
|
+
drawCompositionBorders: true,
|
|
2366
|
+
drawToCanvas: false
|
|
2367
|
+
},
|
|
2368
|
+
England: {
|
|
2369
|
+
projection: Projection.geoAlbersEngland,
|
|
2370
|
+
bounds: [[-6.41866730264044, 49.8647926027119], [1.76370537625026, 55.8111151140706]],
|
|
2371
|
+
drawCompositionBorders: false,
|
|
2372
|
+
drawToCanvas: false
|
|
2373
|
+
},
|
|
2374
|
+
London: {
|
|
2375
|
+
projection: geoMercator(),
|
|
2376
|
+
bounds: [[-0.510356073504132, 51.2867586289553], [0.334043866981608, 51.6918768002741]],
|
|
2377
|
+
drawCompositionBorders: false,
|
|
2378
|
+
drawToCanvas: false
|
|
2379
|
+
}
|
|
2380
|
+
};
|
|
2381
|
+
const ZERO_PADDING = {
|
|
2382
|
+
top: 0,
|
|
2383
|
+
right: 0,
|
|
2384
|
+
bottom: 0,
|
|
2385
|
+
left: 0
|
|
2386
|
+
};
|
|
2387
|
+
const DEFAULT_ZOOM = {
|
|
2388
|
+
enabled: false,
|
|
2389
|
+
minZoom: 1,
|
|
2390
|
+
maxZoom: 8
|
|
2391
|
+
};
|
|
2392
|
+
const Map$1 = forwardRef(({
|
|
2393
|
+
id,
|
|
2394
|
+
width,
|
|
2395
|
+
height,
|
|
2396
|
+
config,
|
|
2397
|
+
children,
|
|
2398
|
+
padding = {
|
|
2399
|
+
top: 20,
|
|
2400
|
+
right: 20,
|
|
2401
|
+
bottom: 20,
|
|
2402
|
+
left: 20
|
|
2403
|
+
},
|
|
2404
|
+
zoom,
|
|
2405
|
+
selectedFeature
|
|
2406
|
+
}, ref) => {
|
|
2407
|
+
padding = padding || ZERO_PADDING;
|
|
2408
|
+
zoom = Object.assign(DEFAULT_ZOOM, zoom);
|
|
2409
|
+
const containerRef = useRef();
|
|
2410
|
+
const [isReady, setIsReady] = useState(false);
|
|
2411
|
+
useLayoutEffect(() => {
|
|
2412
|
+
if (!isReady) {
|
|
2413
|
+
setIsReady(true);
|
|
2414
|
+
}
|
|
2415
|
+
}, [isReady]);
|
|
2416
|
+
useImperativeHandle(
|
|
2417
|
+
ref,
|
|
2418
|
+
() => ({
|
|
2419
|
+
isReady,
|
|
2420
|
+
getContainer: () => containerRef.current,
|
|
2421
|
+
findFeatureAtPoint
|
|
2422
|
+
}),
|
|
2423
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2424
|
+
[isReady]
|
|
2425
|
+
);
|
|
2426
|
+
function findFeatureAtPoint({
|
|
2427
|
+
x,
|
|
2428
|
+
y
|
|
2429
|
+
}) {
|
|
2430
|
+
const adjustedPoint = [x - padding.left, y - padding.top];
|
|
2431
|
+
const coordinates = config.projection.invert(adjustedPoint);
|
|
2432
|
+
for (const child of toChildArray(children)) {
|
|
2433
|
+
if (Object.prototype.hasOwnProperty.call(child.props, "features")) {
|
|
2434
|
+
const features = child.props.features;
|
|
2435
|
+
for (const feature of features) {
|
|
2436
|
+
if (geoContains(feature, coordinates)) {
|
|
2437
|
+
return feature;
|
|
2438
|
+
}
|
|
2439
|
+
}
|
|
2440
|
+
}
|
|
2441
|
+
}
|
|
2442
|
+
return null;
|
|
2443
|
+
}
|
|
2444
|
+
const containerSize = useContainerSize(containerRef);
|
|
2445
|
+
const containerStyle = useMemo(() => {
|
|
2446
|
+
const style = {};
|
|
2447
|
+
if (width > 0)
|
|
2448
|
+
style["width"] = width;
|
|
2449
|
+
if (height > 0)
|
|
2450
|
+
style["height"] = height;
|
|
2451
|
+
return style;
|
|
2452
|
+
}, [width, height]);
|
|
2453
|
+
const mapRef = useRef();
|
|
2454
|
+
const renderSVG = containerSize && !config.drawToCanvas;
|
|
2455
|
+
return jsx("div", {
|
|
2456
|
+
ref: containerRef,
|
|
2457
|
+
className: styles$3.container,
|
|
2458
|
+
style: containerStyle,
|
|
2459
|
+
children: renderSVG && jsx(SVGMapProvider, {
|
|
2460
|
+
id,
|
|
2461
|
+
width: containerSize.width,
|
|
2462
|
+
height: containerSize.height,
|
|
2463
|
+
padding,
|
|
2464
|
+
config,
|
|
2465
|
+
mapRef,
|
|
2466
|
+
selectedFeature,
|
|
2467
|
+
zoom,
|
|
2468
|
+
children: jsx(SVGRenderer, {
|
|
2469
|
+
children
|
|
2470
|
+
})
|
|
2471
|
+
})
|
|
2472
|
+
});
|
|
2473
|
+
});
|
|
2474
|
+
const container = "_container_azu4a_1";
|
|
2475
|
+
const paragraph = "_paragraph_azu4a_12";
|
|
2476
|
+
const defaultStyles$2 = {
|
|
2477
|
+
container,
|
|
2478
|
+
paragraph
|
|
2479
|
+
};
|
|
2480
|
+
function ResultSummary({
|
|
2481
|
+
previous: previous2,
|
|
2482
|
+
next: next2,
|
|
2483
|
+
title: title2,
|
|
2484
|
+
text: text2,
|
|
2485
|
+
timestamp,
|
|
2486
|
+
styles: styles2
|
|
2487
|
+
}) {
|
|
2488
|
+
styles2 = mergeStyles({
|
|
2489
|
+
...defaultStyles$2
|
|
2490
|
+
}, styles2);
|
|
2491
|
+
return jsxs("div", {
|
|
2492
|
+
class: styles2.container,
|
|
2493
|
+
children: [jsx(ControlChange, {
|
|
2494
|
+
previous: previous2,
|
|
2495
|
+
next: next2,
|
|
2496
|
+
text: title2
|
|
2497
|
+
}), jsx("p", {
|
|
2498
|
+
className: styles2.paragraph,
|
|
2499
|
+
children: text2
|
|
2500
|
+
}), jsx(RelativeTimeSentence, {
|
|
2501
|
+
timeStamp: timestamp
|
|
2502
|
+
})]
|
|
2503
|
+
});
|
|
2504
|
+
}
|
|
2505
|
+
const svg = "_svg_1dms8_1";
|
|
2506
|
+
const path = "_path_1dms8_8";
|
|
2507
|
+
const styles$2 = {
|
|
2508
|
+
svg,
|
|
2509
|
+
path
|
|
2510
|
+
};
|
|
2511
|
+
function SearchIcon() {
|
|
2512
|
+
return jsx("svg", {
|
|
2513
|
+
viewBox: "0 0 20 20",
|
|
2514
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2515
|
+
className: styles$2.svg,
|
|
2516
|
+
children: jsx("path", {
|
|
2517
|
+
className: styles$2.path,
|
|
2518
|
+
"fill-rule": "evenodd",
|
|
2519
|
+
"clip-rule": "evenodd",
|
|
2520
|
+
d: "M7.273 0c4.022 0 7.25 3.295 7.25 7.273a7.226 7.226 0 01-7.25 7.25C3.25 14.523 0 11.295 0 7.273 0 3.295 3.25 0 7.273 0zm0 1.84A5.403 5.403 0 001.84 7.274c0 3 2.409 5.454 5.432 5.454 3 0 5.454-2.454 5.454-5.454 0-3.023-2.454-5.432-5.454-5.432zM20 18.16l-5.432-5.432h-.932l-.909.91v.931L18.16 20 20 18.159z"
|
|
2521
|
+
})
|
|
2522
|
+
});
|
|
2523
|
+
}
|
|
2524
|
+
const searchContainer = "_searchContainer_g5w44_1";
|
|
2525
|
+
const input = "_input_g5w44_5";
|
|
2526
|
+
const searchIcon = "_searchIcon_g5w44_21";
|
|
2527
|
+
const clearButton = "_clearButton_g5w44_30";
|
|
2528
|
+
const suggestions = "_suggestions_g5w44_36";
|
|
2529
|
+
const suggestion = "_suggestion_g5w44_36";
|
|
2530
|
+
const selected = "_selected_g5w44_59";
|
|
2531
|
+
const highlighted = "_highlighted_g5w44_63";
|
|
2532
|
+
const defaultStyles$1 = {
|
|
2533
|
+
searchContainer,
|
|
2534
|
+
input,
|
|
2535
|
+
searchIcon,
|
|
2536
|
+
clearButton,
|
|
2537
|
+
suggestions,
|
|
2538
|
+
suggestion,
|
|
2539
|
+
selected,
|
|
2540
|
+
highlighted
|
|
2541
|
+
};
|
|
2542
|
+
function SearchInput({
|
|
2543
|
+
placeholder,
|
|
2544
|
+
inputValue,
|
|
2545
|
+
maxSuggestions = 5,
|
|
2546
|
+
onInputChange,
|
|
2547
|
+
onSubmit,
|
|
2548
|
+
onSelect,
|
|
2549
|
+
onClear,
|
|
2550
|
+
styles: styles2
|
|
2551
|
+
}) {
|
|
2552
|
+
var _a, _b, _c;
|
|
2553
|
+
styles2 = mergeStyles(defaultStyles$1, styles2);
|
|
2554
|
+
const inputRef = useRef(null);
|
|
2555
|
+
const [selectedIndex, setSelectedIndex] = useState(-1);
|
|
2556
|
+
const [suggestions2, setSuggestions] = useState();
|
|
2557
|
+
const [showSuggestions, setShowSuggestions] = useState(true);
|
|
2558
|
+
function onKeyDown(event) {
|
|
2559
|
+
if (event.key === "ArrowDown") {
|
|
2560
|
+
event.preventDefault();
|
|
2561
|
+
setSelectedIndex((currentIndex) => Math.min(currentIndex + 1, suggestions2.length - 1));
|
|
2562
|
+
} else if (event.key === "ArrowUp") {
|
|
2563
|
+
event.preventDefault();
|
|
2564
|
+
setSelectedIndex((currentIndex) => Math.max(currentIndex - 1, -1));
|
|
2565
|
+
} else if (event.key === "Enter" && selectedIndex >= 0) {
|
|
2566
|
+
event.preventDefault();
|
|
2567
|
+
onSelectSuggestion(suggestions2[selectedIndex]);
|
|
2568
|
+
} else if (event.key === "Enter") {
|
|
2569
|
+
onSubmit(inputRef.current.value);
|
|
2570
|
+
}
|
|
2571
|
+
}
|
|
2572
|
+
async function inputChanged(input2) {
|
|
2573
|
+
let suggestions22 = await onInputChange(input2);
|
|
2574
|
+
if (suggestions22) {
|
|
2575
|
+
suggestions22 = suggestions22.slice(0, maxSuggestions);
|
|
2576
|
+
}
|
|
2577
|
+
setSuggestions(suggestions22);
|
|
2578
|
+
setSelectedIndex(-1);
|
|
2579
|
+
}
|
|
2580
|
+
function onSelectSuggestion(suggestion2) {
|
|
2581
|
+
onSelect(suggestion2);
|
|
2582
|
+
inputRef.current.value = suggestion2.text;
|
|
2583
|
+
inputRef.current.blur();
|
|
2584
|
+
}
|
|
2585
|
+
const showClearButton = ((_a = inputRef.current) == null ? void 0 : _a.value) && ((_b = inputRef.current) == null ? void 0 : _b.value) !== "";
|
|
2586
|
+
return jsxs("div", {
|
|
2587
|
+
className: styles2.searchContainer,
|
|
2588
|
+
children: [jsx("input", {
|
|
2589
|
+
name: "search",
|
|
2590
|
+
placeholder,
|
|
2591
|
+
ref: inputRef,
|
|
2592
|
+
type: "text",
|
|
2593
|
+
"aria-label": "Search input",
|
|
2594
|
+
value: inputValue,
|
|
2595
|
+
onKeyDown,
|
|
2596
|
+
onInput: (e) => {
|
|
2597
|
+
inputChanged(e.target.value);
|
|
2598
|
+
},
|
|
2599
|
+
onBlur: () => {
|
|
2600
|
+
setShowSuggestions(false);
|
|
2601
|
+
},
|
|
2602
|
+
onFocus: (e) => {
|
|
2603
|
+
e.target.select();
|
|
2604
|
+
setShowSuggestions(true);
|
|
2605
|
+
},
|
|
2606
|
+
className: styles2.input
|
|
2607
|
+
}), jsx("div", {
|
|
2608
|
+
className: styles2.searchIcon,
|
|
2609
|
+
children: jsx(SearchIcon, {})
|
|
2610
|
+
}), showClearButton && jsx("div", {
|
|
2611
|
+
className: styles2.clearButton,
|
|
2612
|
+
children: jsx(CloseButton, {
|
|
2613
|
+
border: false,
|
|
2614
|
+
onClick: () => {
|
|
2615
|
+
const emptyValue = "";
|
|
2616
|
+
inputRef.current.value = emptyValue;
|
|
2617
|
+
inputChanged(emptyValue);
|
|
2618
|
+
inputRef.current.focus();
|
|
2619
|
+
onClear();
|
|
2620
|
+
}
|
|
2621
|
+
})
|
|
2622
|
+
}), showSuggestions && jsx(SuggestionList, {
|
|
2623
|
+
suggestions: suggestions2,
|
|
2624
|
+
highlightText: (_c = inputRef.current) == null ? void 0 : _c.value,
|
|
2625
|
+
selectedIndex,
|
|
2626
|
+
styles: styles2,
|
|
2627
|
+
onMouseOver: (_2, index2) => setSelectedIndex(index2),
|
|
2628
|
+
onSelect: onSelectSuggestion
|
|
2629
|
+
})]
|
|
2630
|
+
});
|
|
2631
|
+
}
|
|
2632
|
+
function SuggestionList({
|
|
2633
|
+
suggestions: suggestions2,
|
|
2634
|
+
highlightText,
|
|
2635
|
+
selectedIndex,
|
|
2636
|
+
styles: styles2,
|
|
2637
|
+
onMouseOver,
|
|
2638
|
+
onSelect
|
|
2639
|
+
}) {
|
|
2640
|
+
if (!suggestions2 || suggestions2.length === 0)
|
|
2641
|
+
return;
|
|
2642
|
+
return jsx("ul", {
|
|
2643
|
+
className: styles2.suggestions,
|
|
2644
|
+
"aria-label": "Search suggestions",
|
|
2645
|
+
children: suggestions2.map((d2, index2) => {
|
|
2646
|
+
return jsx("li", {
|
|
2647
|
+
"aria-label": d2.text,
|
|
2648
|
+
className: [styles2.suggestion, index2 === selectedIndex && styles2.selected].join(" "),
|
|
2649
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
2650
|
+
onMouseOver: () => onMouseOver(d2, index2),
|
|
2651
|
+
onClick: () => {
|
|
2652
|
+
onSelect(d2);
|
|
2653
|
+
},
|
|
2654
|
+
children: d2.text.split(new RegExp(`(${highlightText})`, "ig")).map((part, i) => i % 2 === 1 ? jsx("span", {
|
|
2655
|
+
className: styles2.highlighted,
|
|
2656
|
+
children: part
|
|
2657
|
+
}, i) : part)
|
|
2658
|
+
}, index2);
|
|
2659
|
+
})
|
|
2660
|
+
});
|
|
2661
|
+
}
|
|
2662
|
+
const coalitionsWrapper = "_coalitionsWrapper_1ahqy_9";
|
|
2663
|
+
const coalitionsContainer = "_coalitionsContainer_1ahqy_14";
|
|
2664
|
+
const coalition = "_coalition_1ahqy_9";
|
|
2665
|
+
const title = "_title_1ahqy_27";
|
|
2666
|
+
const description = "_description_1ahqy_28";
|
|
2667
|
+
const thresholdText = "_thresholdText_1ahqy_43";
|
|
2668
|
+
const thresholdTextBold = "_thresholdTextBold_1ahqy_54";
|
|
2669
|
+
const thresholdDot = "_thresholdDot_1ahqy_61";
|
|
2670
|
+
const thresholdLine = "_thresholdLine_1ahqy_61";
|
|
2671
|
+
const defaultStyles = {
|
|
2672
|
+
coalitionsWrapper,
|
|
2673
|
+
coalitionsContainer,
|
|
2674
|
+
coalition,
|
|
2675
|
+
title,
|
|
2676
|
+
description,
|
|
2677
|
+
thresholdText,
|
|
2678
|
+
thresholdTextBold,
|
|
2679
|
+
thresholdDot,
|
|
2680
|
+
thresholdLine
|
|
2681
|
+
};
|
|
2682
|
+
function CoalitionsTracker({
|
|
2683
|
+
coalitions,
|
|
2684
|
+
threshold,
|
|
2685
|
+
barChartHeight = 32,
|
|
2686
|
+
listMembersAccessor = "parties",
|
|
2687
|
+
listMemberTotalAccessor = "totalSeats",
|
|
2688
|
+
listDescriptionAccessor = "description",
|
|
2689
|
+
abbreviationAccessor = "abbreviation",
|
|
2690
|
+
thresholdTextBold: thresholdTextBold2,
|
|
2691
|
+
thresholdText: thresholdText2,
|
|
2692
|
+
styles: styles2
|
|
2693
|
+
}) {
|
|
2694
|
+
const wrapperRef = useRef(null);
|
|
2695
|
+
const thresholdTextRef = useRef(null);
|
|
2696
|
+
const [width, setWidth] = useState(0);
|
|
2697
|
+
const biggestListTotal = Math.max(...coalitions.map((l) => l[listMembersAccessor].reduce((acc, cur) => acc + cur[listMemberTotalAccessor], 0)));
|
|
2698
|
+
const windowSize = useWindowSize();
|
|
2699
|
+
const thresholdTextMinWidth = windowSize.width < 740 ? 66 : 150;
|
|
2700
|
+
const thresholdDotWidth = 11;
|
|
2701
|
+
const thresholdTextPaddingLeft = 5;
|
|
2702
|
+
const maxBarWidth = width - thresholdTextMinWidth - (thresholdDotWidth - 1) / 2 - thresholdTextPaddingLeft;
|
|
2703
|
+
const thresholdLeft = threshold / biggestListTotal * maxBarWidth;
|
|
2704
|
+
const parsedLists = coalitions.map((coalition2) => {
|
|
2705
|
+
const listTotal = coalition2[listMembersAccessor].reduce((acc, cur) => acc + cur[listMemberTotalAccessor], 0);
|
|
2706
|
+
return {
|
|
2707
|
+
title: coalition2["name"],
|
|
2708
|
+
description: coalition2[listDescriptionAccessor],
|
|
2709
|
+
height: barChartHeight,
|
|
2710
|
+
width: listTotal / biggestListTotal * maxBarWidth,
|
|
2711
|
+
stack: coalition2[listMembersAccessor].map((m) => {
|
|
2712
|
+
const listTotal2 = coalition2[listMembersAccessor].reduce((acc, cur) => acc + cur[listMemberTotalAccessor], 0);
|
|
2713
|
+
return {
|
|
2714
|
+
label: m[listMemberTotalAccessor],
|
|
2715
|
+
fraction: m[listMemberTotalAccessor] / listTotal2,
|
|
2716
|
+
abbreviation: m[abbreviationAccessor]
|
|
2717
|
+
};
|
|
2718
|
+
}).sort((a, b) => b.fraction - a.fraction)
|
|
2719
|
+
};
|
|
2720
|
+
});
|
|
2721
|
+
styles2 = mergeStyles(defaultStyles, styles2);
|
|
2722
|
+
useLayoutEffect(() => {
|
|
2723
|
+
const newWidth = wrapperRef.current.getBoundingClientRect().width;
|
|
2724
|
+
setWidth(newWidth);
|
|
2725
|
+
}, [windowSize]);
|
|
2726
|
+
const renderCoalition = (list, index2) => {
|
|
2727
|
+
if (list.width <= 0) {
|
|
2728
|
+
return;
|
|
2729
|
+
}
|
|
2730
|
+
return jsxs("div", {
|
|
2731
|
+
className: styles2.coalition,
|
|
2732
|
+
style: {
|
|
2733
|
+
position: "relative",
|
|
2734
|
+
zIndex: 2
|
|
2735
|
+
},
|
|
2736
|
+
children: [jsx("h4", {
|
|
2737
|
+
className: styles2.title,
|
|
2738
|
+
children: list.title
|
|
2739
|
+
}), jsx("p", {
|
|
2740
|
+
className: styles2.description,
|
|
2741
|
+
style: {
|
|
2742
|
+
maxWidth: thresholdLeft <= 620 ? thresholdLeft - 8 : 620
|
|
2743
|
+
},
|
|
2744
|
+
children: list.description
|
|
2745
|
+
}), jsx(StackedBar, {
|
|
2746
|
+
stack: list.stack,
|
|
2747
|
+
width: list.width,
|
|
2748
|
+
height: barChartHeight,
|
|
2749
|
+
createSVG: true
|
|
2750
|
+
})]
|
|
2751
|
+
}, index2);
|
|
2752
|
+
};
|
|
2753
|
+
return jsxs("div", {
|
|
2754
|
+
ref: wrapperRef,
|
|
2755
|
+
className: styles2.coalitionsWrapper,
|
|
2756
|
+
children: [jsx("div", {
|
|
2757
|
+
className: styles2.coalitionsContainer,
|
|
2758
|
+
children: parsedLists.map(renderCoalition)
|
|
2759
|
+
}), jsx("div", {
|
|
2760
|
+
className: styles2.thresholdDot,
|
|
2761
|
+
style: {
|
|
2762
|
+
position: "absolute",
|
|
2763
|
+
height: thresholdDotWidth,
|
|
2764
|
+
width: thresholdDotWidth,
|
|
2765
|
+
top: 0,
|
|
2766
|
+
left: 0.5 + thresholdLeft - thresholdDotWidth / 2
|
|
2767
|
+
}
|
|
2768
|
+
}), jsx("div", {
|
|
2769
|
+
className: styles2.thresholdLine,
|
|
2770
|
+
style: {
|
|
2771
|
+
position: "absolute",
|
|
2772
|
+
height: "100%",
|
|
2773
|
+
width: 1,
|
|
2774
|
+
top: 0,
|
|
2775
|
+
left: thresholdLeft
|
|
2776
|
+
}
|
|
2777
|
+
}), jsxs("div", {
|
|
2778
|
+
ref: thresholdTextRef,
|
|
2779
|
+
className: styles2.thresholdText,
|
|
2780
|
+
style: {
|
|
2781
|
+
position: "absolute",
|
|
2782
|
+
minWidth: thresholdTextMinWidth,
|
|
2783
|
+
width: "auto",
|
|
2784
|
+
top: -(thresholdDotWidth + 1) / 2,
|
|
2785
|
+
left: thresholdLeft + (thresholdDotWidth - 1) / 2 + thresholdTextPaddingLeft
|
|
2786
|
+
},
|
|
2787
|
+
children: [thresholdTextBold2 && jsx("span", {
|
|
2788
|
+
className: styles2.thresholdTextBold,
|
|
2789
|
+
children: thresholdTextBold2
|
|
2790
|
+
}), thresholdText2 && jsx("span", {
|
|
2791
|
+
children: thresholdText2
|
|
2792
|
+
})]
|
|
2793
|
+
})]
|
|
2794
|
+
});
|
|
2795
|
+
}
|
|
2796
|
+
const gradient$1 = "_gradient_plpaq_9";
|
|
2797
|
+
const firstStop = "_firstStop_plpaq_24";
|
|
2798
|
+
const lastStop = "_lastStop_plpaq_29";
|
|
2799
|
+
const styles$1 = {
|
|
2800
|
+
gradient: gradient$1,
|
|
2801
|
+
firstStop,
|
|
2802
|
+
lastStop
|
|
2803
|
+
};
|
|
2804
|
+
function Gradient() {
|
|
2805
|
+
return jsxs("svg", {
|
|
2806
|
+
width: "100%",
|
|
2807
|
+
height: "100%",
|
|
2808
|
+
viewBox: "0 0 10 10",
|
|
2809
|
+
fill: "none",
|
|
2810
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2811
|
+
preserveAspectRatio: "none",
|
|
2812
|
+
children: [jsx("g", {
|
|
2813
|
+
className: styles$1.gradient,
|
|
2814
|
+
children: jsx("rect", {
|
|
2815
|
+
fill: "url(#paint0_linear_3798_6653)"
|
|
2816
|
+
})
|
|
2817
|
+
}), jsx("defs", {
|
|
2818
|
+
children: jsxs("linearGradient", {
|
|
2819
|
+
id: "paint0_linear_3798_6653",
|
|
2820
|
+
x1: "0%",
|
|
2821
|
+
y1: "0%",
|
|
2822
|
+
x2: "100%",
|
|
2823
|
+
y2: "0%",
|
|
2824
|
+
children: [jsx("stop", {
|
|
2825
|
+
className: styles$1.firstStop
|
|
2826
|
+
}), jsx("stop", {
|
|
2827
|
+
className: styles$1.lastStop,
|
|
2828
|
+
offset: "1"
|
|
2829
|
+
})]
|
|
2830
|
+
})
|
|
2831
|
+
})]
|
|
2832
|
+
});
|
|
2833
|
+
}
|
|
2834
|
+
const ticker = "_ticker_1tpek_9";
|
|
2835
|
+
const tickerItems = "_tickerItems_1tpek_19";
|
|
2836
|
+
const tickerItem = "_tickerItem_1tpek_19";
|
|
2837
|
+
const controls = "_controls_1tpek_41";
|
|
2838
|
+
const gradient = "_gradient_1tpek_56";
|
|
2839
|
+
const buttons = "_buttons_1tpek_70";
|
|
2840
|
+
const button = "_button_1tpek_70";
|
|
2841
|
+
const buttonInner = "_buttonInner_1tpek_96";
|
|
2842
|
+
const styles = {
|
|
2843
|
+
ticker,
|
|
2844
|
+
tickerItems,
|
|
2845
|
+
tickerItem,
|
|
2846
|
+
controls,
|
|
2847
|
+
gradient,
|
|
2848
|
+
buttons,
|
|
2849
|
+
button,
|
|
2850
|
+
buttonInner
|
|
2851
|
+
};
|
|
2852
|
+
function totalSizeForElements(elements) {
|
|
2853
|
+
return Array.from(elements).reduce((totalSize, element) => {
|
|
2854
|
+
totalSize.width += element.clientWidth;
|
|
2855
|
+
totalSize.height += element.clientHeight;
|
|
2856
|
+
return totalSize;
|
|
2857
|
+
}, {
|
|
2858
|
+
width: 0,
|
|
2859
|
+
height: 0
|
|
2860
|
+
});
|
|
2861
|
+
}
|
|
2862
|
+
function Ticker({
|
|
2863
|
+
maxItems = 20,
|
|
2864
|
+
onStateChange,
|
|
2865
|
+
children
|
|
2866
|
+
}) {
|
|
2867
|
+
const [offset, setOffset] = useState(0);
|
|
2868
|
+
const windowSize = useWindowSize();
|
|
2869
|
+
const tickerRef = useRef();
|
|
2870
|
+
const tickerItemsRef = useRef();
|
|
2871
|
+
const [hideButtons, setHideButtons] = useState(false);
|
|
2872
|
+
const [nextButtonDisabled, setNextButtonDisabled] = useState(false);
|
|
2873
|
+
const [expanded, setExpanded] = useState(false);
|
|
2874
|
+
const childArray = toChildArray(children);
|
|
2875
|
+
useLayoutEffect(() => {
|
|
2876
|
+
const tickerItemsContainer = tickerItemsRef.current;
|
|
2877
|
+
if (tickerItemsContainer) {
|
|
2878
|
+
const {
|
|
2879
|
+
width,
|
|
2880
|
+
height
|
|
2881
|
+
} = totalSizeForElements(tickerItemsContainer.children);
|
|
2882
|
+
const hideButtons2 = windowSize.width >= 480 ? width <= tickerItemsContainer.clientWidth : height <= tickerItemsContainer.clientHeight;
|
|
2883
|
+
setHideButtons(hideButtons2);
|
|
2884
|
+
if (tickerItemsContainer.children.length > 0) {
|
|
2885
|
+
const itemWidth = tickerItemsContainer.children[0].clientWidth;
|
|
2886
|
+
const nextButtonDisabled2 = offset * itemWidth > width - tickerItemsContainer.clientWidth;
|
|
2887
|
+
setNextButtonDisabled(nextButtonDisabled2);
|
|
2888
|
+
}
|
|
2889
|
+
}
|
|
2890
|
+
}, [offset, windowSize, childArray, setHideButtons, setNextButtonDisabled]);
|
|
2891
|
+
function toggleExpandedState() {
|
|
2892
|
+
setExpanded((expanded2) => {
|
|
2893
|
+
const newState = !expanded2;
|
|
2894
|
+
if (onStateChange)
|
|
2895
|
+
onStateChange({
|
|
2896
|
+
expanded: newState
|
|
2897
|
+
});
|
|
2898
|
+
return newState;
|
|
2899
|
+
});
|
|
2900
|
+
}
|
|
2901
|
+
return jsxs("div", {
|
|
2902
|
+
ref: tickerRef,
|
|
2903
|
+
className: styles.ticker,
|
|
2904
|
+
style: `--ticker-offset: ${offset}`,
|
|
2905
|
+
"data-expanded": expanded,
|
|
2906
|
+
children: [jsx("div", {
|
|
2907
|
+
ref: tickerItemsRef,
|
|
2908
|
+
className: styles.tickerItems,
|
|
2909
|
+
children: childArray.map((child, index2) => jsx("div", {
|
|
2910
|
+
className: styles.tickerItem,
|
|
2911
|
+
children: child
|
|
2912
|
+
}, index2))
|
|
2913
|
+
}), jsxs("div", {
|
|
2914
|
+
className: styles.controls,
|
|
2915
|
+
style: hideButtons && {
|
|
2916
|
+
display: "none"
|
|
2917
|
+
},
|
|
2918
|
+
children: [jsx("div", {
|
|
2919
|
+
className: styles.gradient,
|
|
2920
|
+
children: jsx(Gradient, {})
|
|
2921
|
+
}), jsxs("div", {
|
|
2922
|
+
className: styles.buttons,
|
|
2923
|
+
children: [jsx(ArrowButton, {
|
|
2924
|
+
onClick: () => setOffset((d2) => d2 + 1),
|
|
2925
|
+
disabled: nextButtonDisabled
|
|
2926
|
+
}), jsx(ArrowButton, {
|
|
2927
|
+
direction: "left",
|
|
2928
|
+
onClick: () => setOffset((d2) => d2 - 1),
|
|
2929
|
+
disabled: offset <= 0
|
|
2930
|
+
})]
|
|
2931
|
+
}), jsx("div", {
|
|
2932
|
+
className: styles.button,
|
|
2933
|
+
children: jsx(Button, {
|
|
2934
|
+
type: "small",
|
|
2935
|
+
styles: {
|
|
2936
|
+
buttonInner: styles.buttonInner
|
|
2937
|
+
},
|
|
2938
|
+
onClick: toggleExpandedState,
|
|
2939
|
+
children: expanded ? "Show less" : `Show ${maxItems} most recent`
|
|
2940
|
+
})
|
|
2941
|
+
})]
|
|
2942
|
+
})]
|
|
2943
|
+
});
|
|
2944
|
+
}
|
|
2945
|
+
export {
|
|
2946
|
+
ArrowButton,
|
|
2947
|
+
Button,
|
|
2948
|
+
ChangeBar,
|
|
2949
|
+
Chevron,
|
|
2950
|
+
CircleIcon,
|
|
2951
|
+
CloseButton,
|
|
2952
|
+
CoalitionsTracker,
|
|
2953
|
+
ColumnChart,
|
|
2954
|
+
Container,
|
|
2955
|
+
ControlChange,
|
|
2956
|
+
GradientIcon,
|
|
2957
|
+
InfoButton,
|
|
2958
|
+
LegendItem,
|
|
2959
|
+
Map$1 as Map,
|
|
2960
|
+
MapConfiguration,
|
|
2961
|
+
index as MapLayers,
|
|
2962
|
+
PageSection,
|
|
2963
|
+
PartyProfile,
|
|
2964
|
+
Projection,
|
|
2965
|
+
RelativeTimeSentence,
|
|
2966
|
+
ResultSummary,
|
|
2967
|
+
SearchInput,
|
|
2968
|
+
SlopeChart,
|
|
2969
|
+
SquareCutCornerIcon,
|
|
2970
|
+
SquareIcon,
|
|
2971
|
+
StackedBar,
|
|
2972
|
+
StackedGrid,
|
|
2973
|
+
Table,
|
|
2974
|
+
Ticker,
|
|
2975
|
+
Tooltip,
|
|
2976
|
+
TooltipType,
|
|
2977
|
+
ToplineResult
|
|
2978
|
+
};
|
|
2979
|
+
//# sourceMappingURL=interactive-component-library.js.map
|