drizzle-cube 0.2.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/dist/client/charts.js +15 -15
  2. package/dist/client/chunks/chart-activitygridchart-BzL97Vnm.js +2510 -0
  3. package/dist/client/chunks/chart-activitygridchart-BzL97Vnm.js.map +1 -0
  4. package/dist/client/chunks/chart-activitygridchart-config-48WqIofo.js +230 -0
  5. package/dist/client/chunks/chart-activitygridchart-config-48WqIofo.js.map +1 -0
  6. package/dist/client/chunks/{chart-areachart-CTzUpR0_.js → chart-areachart-BtH3SvAM.js} +3 -3
  7. package/dist/client/chunks/{chart-areachart-CTzUpR0_.js.map → chart-areachart-BtH3SvAM.js.map} +1 -1
  8. package/dist/client/chunks/{chart-areachart-config-InZgxubz.js → chart-areachart-config-D8taXdn1.js} +5 -6
  9. package/dist/client/chunks/chart-areachart-config-D8taXdn1.js.map +1 -0
  10. package/dist/client/chunks/{chart-barchart-CKF8FnMs.js → chart-barchart-DX6DIoIp.js} +4 -4
  11. package/dist/client/chunks/{chart-barchart-CKF8FnMs.js.map → chart-barchart-DX6DIoIp.js.map} +1 -1
  12. package/dist/client/chunks/{chart-barchart-config-DxatOnVV.js → chart-barchart-config-DjRZBtLb.js} +5 -6
  13. package/dist/client/chunks/chart-barchart-config-DjRZBtLb.js.map +1 -0
  14. package/dist/client/chunks/{chart-bubblechart-5Z0hPYwn.js → chart-bubblechart-Lj_PnppP.js} +2 -2
  15. package/dist/client/chunks/{chart-bubblechart-5Z0hPYwn.js.map → chart-bubblechart-Lj_PnppP.js.map} +1 -1
  16. package/dist/client/chunks/{chart-bubblechart-config-CcZTMTCx.js → chart-bubblechart-config-C6ck2qmg.js} +5 -6
  17. package/dist/client/chunks/chart-bubblechart-config-C6ck2qmg.js.map +1 -0
  18. package/dist/client/chunks/{chart-charttooltip-CqtjUW2V.js → chart-charttooltip-D9BKscsw.js} +2 -2
  19. package/dist/client/chunks/{chart-charttooltip-CqtjUW2V.js.map → chart-charttooltip-D9BKscsw.js.map} +1 -1
  20. package/dist/client/chunks/{chart-datatable-uFzkh18f.js → chart-datatable-BaECYDn2.js} +2 -2
  21. package/dist/client/chunks/{chart-datatable-uFzkh18f.js.map → chart-datatable-BaECYDn2.js.map} +1 -1
  22. package/dist/client/chunks/{chart-datatable-config-D7mojhYA.js → chart-datatable-config-B5z0SlOJ.js} +5 -6
  23. package/dist/client/chunks/chart-datatable-config-B5z0SlOJ.js.map +1 -0
  24. package/dist/client/chunks/{chart-kpidelta-B1zg2dTx.js → chart-kpidelta-Bx-stIIk.js} +23 -23
  25. package/dist/client/chunks/{chart-kpidelta-B1zg2dTx.js.map → chart-kpidelta-Bx-stIIk.js.map} +1 -1
  26. package/dist/client/chunks/{chart-kpidelta-config-icJXuFxe.js → chart-kpidelta-config-CnZfi_P2.js} +5 -6
  27. package/dist/client/chunks/chart-kpidelta-config-CnZfi_P2.js.map +1 -0
  28. package/dist/client/chunks/{chart-kpinumber-CHcSqthc.js → chart-kpinumber-BrXgyKGP.js} +23 -23
  29. package/dist/client/chunks/{chart-kpinumber-CHcSqthc.js.map → chart-kpinumber-BrXgyKGP.js.map} +1 -1
  30. package/dist/client/chunks/{chart-kpinumber-config-T39g03ud.js → chart-kpinumber-config-CVikHojM.js} +5 -6
  31. package/dist/client/chunks/chart-kpinumber-config-CVikHojM.js.map +1 -0
  32. package/dist/client/chunks/{chart-kpitext-BrapZkRe.js → chart-kpitext-_2tnYN_z.js} +3 -3
  33. package/dist/client/chunks/{chart-kpitext-BrapZkRe.js.map → chart-kpitext-_2tnYN_z.js.map} +1 -1
  34. package/dist/client/chunks/{chart-kpitext-config-BbJGXAVk.js → chart-kpitext-config-B2MovXSw.js} +5 -6
  35. package/dist/client/chunks/chart-kpitext-config-B2MovXSw.js.map +1 -0
  36. package/dist/client/chunks/{chart-linechart-DqZU4vH8.js → chart-linechart-DBdIULsM.js} +4 -4
  37. package/dist/client/chunks/{chart-linechart-DqZU4vH8.js.map → chart-linechart-DBdIULsM.js.map} +1 -1
  38. package/dist/client/chunks/{chart-linechart-config-BS1qVC8K.js → chart-linechart-config-CVBVB7nS.js} +5 -6
  39. package/dist/client/chunks/chart-linechart-config-CVBVB7nS.js.map +1 -0
  40. package/dist/client/chunks/{chart-markdownchart-config-DMCD8phf.js → chart-markdownchart-config-Cq5Sxrgq.js} +5 -6
  41. package/dist/client/chunks/chart-markdownchart-config-Cq5Sxrgq.js.map +1 -0
  42. package/dist/client/chunks/{chart-piechart-Dsxs70px.js → chart-piechart-CzesCpZ_.js} +3 -3
  43. package/dist/client/chunks/{chart-piechart-Dsxs70px.js.map → chart-piechart-CzesCpZ_.js.map} +1 -1
  44. package/dist/client/chunks/{chart-piechart-config-6ZK8XaSX.js → chart-piechart-config-Bdd31Gdi.js} +5 -6
  45. package/dist/client/chunks/chart-piechart-config-Bdd31Gdi.js.map +1 -0
  46. package/dist/client/chunks/{chart-radarchart-2qnrlYCv.js → chart-radarchart-B3WUEiTh.js} +3 -3
  47. package/dist/client/chunks/{chart-radarchart-2qnrlYCv.js.map → chart-radarchart-B3WUEiTh.js.map} +1 -1
  48. package/dist/client/chunks/{chart-radarchart-config-CCWOkkwO.js → chart-radarchart-config-BWyfn0ij.js} +5 -6
  49. package/dist/client/chunks/chart-radarchart-config-BWyfn0ij.js.map +1 -0
  50. package/dist/client/chunks/{chart-radialbarchart-DPi9fYc7.js → chart-radialbarchart-DBiRcLd9.js} +3 -3
  51. package/dist/client/chunks/{chart-radialbarchart-DPi9fYc7.js.map → chart-radialbarchart-DBiRcLd9.js.map} +1 -1
  52. package/dist/client/chunks/{chart-radialbarchart-config-DicXYrMW.js → chart-radialbarchart-config-lU2_NQCD.js} +5 -6
  53. package/dist/client/chunks/chart-radialbarchart-config-lU2_NQCD.js.map +1 -0
  54. package/dist/client/chunks/{chart-scatterchart-DNleJCr4.js → chart-scatterchart-C_D9OqA1.js} +2 -2
  55. package/dist/client/chunks/{chart-scatterchart-DNleJCr4.js.map → chart-scatterchart-C_D9OqA1.js.map} +1 -1
  56. package/dist/client/chunks/{chart-scatterchart-config-DgYa-5vm.js → chart-scatterchart-config-DtLnut1M.js} +5 -6
  57. package/dist/client/chunks/chart-scatterchart-config-DtLnut1M.js.map +1 -0
  58. package/dist/client/chunks/{chart-treemapchart-B2-Qr28e.js → chart-treemapchart-DJqy3Sy7.js} +3 -3
  59. package/dist/client/chunks/{chart-treemapchart-B2-Qr28e.js.map → chart-treemapchart-DJqy3Sy7.js.map} +1 -1
  60. package/dist/client/chunks/{chart-treemapchart-config-DGhteyBe.js → chart-treemapchart-config-BEiIWQnR.js} +5 -6
  61. package/dist/client/chunks/chart-treemapchart-config-BEiIWQnR.js.map +1 -0
  62. package/dist/client/chunks/{charts-BmpuCBGG.js → charts-DFbr7EGW.js} +47 -47
  63. package/dist/client/chunks/{charts-BmpuCBGG.js.map → charts-DFbr7EGW.js.map} +1 -1
  64. package/dist/client/chunks/icons-D6z-_9sa.js +1400 -0
  65. package/dist/client/chunks/icons-D6z-_9sa.js.map +1 -0
  66. package/dist/client/chunks/index-_pVwmFVW.js +551 -0
  67. package/dist/client/chunks/index-_pVwmFVW.js.map +1 -0
  68. package/dist/client/components.js +9134 -16
  69. package/dist/client/components.js.map +1 -1
  70. package/dist/client/hooks.js +10 -10
  71. package/dist/client/icons/defaultIcons.d.ts +5 -0
  72. package/dist/client/icons/index.d.ts +22 -0
  73. package/dist/client/icons/registry.d.ts +58 -0
  74. package/dist/client/icons/types.d.ts +111 -0
  75. package/dist/client/icons.d.ts +2 -0
  76. package/dist/client/icons.js +15 -0
  77. package/dist/client/icons.js.map +1 -0
  78. package/dist/client/index.d.ts +2 -16
  79. package/dist/client/index.js +49 -9135
  80. package/dist/client/index.js.map +1 -1
  81. package/dist/client/providers/CubeProvider.d.ts +1 -1
  82. package/dist/client/providers.js +3 -3
  83. package/dist/client/styles.css +1 -1
  84. package/dist/client/types.d.ts +1 -0
  85. package/dist/client-bundle-stats.html +1 -1
  86. package/package.json +21 -9
  87. package/dist/client/chunks/chart-activitygridchart-B5OqLgbD.js +0 -3713
  88. package/dist/client/chunks/chart-activitygridchart-B5OqLgbD.js.map +0 -1
  89. package/dist/client/chunks/chart-activitygridchart-config-D9CgNH02.js +0 -51
  90. package/dist/client/chunks/chart-activitygridchart-config-D9CgNH02.js.map +0 -1
  91. package/dist/client/chunks/chart-areachart-config-InZgxubz.js.map +0 -1
  92. package/dist/client/chunks/chart-barchart-config-DxatOnVV.js.map +0 -1
  93. package/dist/client/chunks/chart-bubblechart-config-CcZTMTCx.js.map +0 -1
  94. package/dist/client/chunks/chart-datatable-config-D7mojhYA.js.map +0 -1
  95. package/dist/client/chunks/chart-kpidelta-config-icJXuFxe.js.map +0 -1
  96. package/dist/client/chunks/chart-kpinumber-config-T39g03ud.js.map +0 -1
  97. package/dist/client/chunks/chart-kpitext-config-BbJGXAVk.js.map +0 -1
  98. package/dist/client/chunks/chart-linechart-config-BS1qVC8K.js.map +0 -1
  99. package/dist/client/chunks/chart-markdownchart-config-DMCD8phf.js.map +0 -1
  100. package/dist/client/chunks/chart-piechart-config-6ZK8XaSX.js.map +0 -1
  101. package/dist/client/chunks/chart-radarchart-config-CCWOkkwO.js.map +0 -1
  102. package/dist/client/chunks/chart-radialbarchart-config-DicXYrMW.js.map +0 -1
  103. package/dist/client/chunks/chart-scatterchart-config-DgYa-5vm.js.map +0 -1
  104. package/dist/client/chunks/chart-treemapchart-config-DGhteyBe.js.map +0 -1
  105. package/dist/client/chunks/icons-D-n_woAP.js +0 -2386
  106. package/dist/client/chunks/icons-D-n_woAP.js.map +0 -1
  107. package/dist/client/chunks/index-EfJ-vN-5.js +0 -8707
  108. package/dist/client/chunks/index-EfJ-vN-5.js.map +0 -1
@@ -0,0 +1,2510 @@
1
+ import { jsx as O, jsxs as pt } from "react/jsx-runtime";
2
+ import { useState as B, useCallback as Rt, useEffect as bt, useContext as ln, createContext as fn, useMemo as ae, useRef as oe, useLayoutEffect as hn } from "react";
3
+ class dn {
4
+ apiUrl;
5
+ headers;
6
+ credentials;
7
+ constructor(e, n = {}) {
8
+ this.apiUrl = n.apiUrl || "/cubejs-api/v1", this.headers = {
9
+ "Content-Type": "application/json",
10
+ ...n.headers
11
+ }, this.credentials = n.credentials ?? "include", e && (this.headers.Authorization = e);
12
+ }
13
+ async load(e) {
14
+ const n = JSON.stringify(e), r = encodeURIComponent(n), i = `${this.apiUrl}/load?query=${r}`, a = await fetch(i, {
15
+ method: "GET",
16
+ headers: {
17
+ // Remove Content-Type for GET request
18
+ ...Object.fromEntries(
19
+ Object.entries(this.headers).filter(([s]) => s !== "Content-Type")
20
+ )
21
+ },
22
+ credentials: this.credentials
23
+ });
24
+ if (!a.ok) {
25
+ let s = `Cube query failed: ${a.status}`;
26
+ try {
27
+ const c = await a.text();
28
+ try {
29
+ const u = JSON.parse(c);
30
+ u.error ? s = u.error : s += ` ${c}`;
31
+ } catch {
32
+ s += ` ${c}`;
33
+ }
34
+ } catch {
35
+ }
36
+ throw new Error(s);
37
+ }
38
+ const o = await a.json();
39
+ return new Lt(o);
40
+ }
41
+ async meta() {
42
+ const e = `${this.apiUrl}/meta`, n = await fetch(e, {
43
+ method: "GET",
44
+ headers: this.headers,
45
+ credentials: this.credentials
46
+ });
47
+ if (!n.ok)
48
+ throw new Error(`Failed to fetch meta: ${n.status}`);
49
+ return n.json();
50
+ }
51
+ async sql(e) {
52
+ const n = encodeURIComponent(JSON.stringify(e)), r = `${this.apiUrl}/sql?query=${n}`, i = await fetch(r, {
53
+ method: "GET",
54
+ headers: {
55
+ // Remove Content-Type for GET request
56
+ ...Object.fromEntries(
57
+ Object.entries(this.headers).filter(([a]) => a !== "Content-Type")
58
+ )
59
+ },
60
+ credentials: this.credentials
61
+ });
62
+ if (!i.ok)
63
+ throw new Error(`SQL generation failed: ${i.status}`);
64
+ return i.json();
65
+ }
66
+ async dryRun(e) {
67
+ const n = `${this.apiUrl}/dry-run`, r = await fetch(n, {
68
+ method: "POST",
69
+ headers: this.headers,
70
+ credentials: this.credentials,
71
+ body: JSON.stringify({ query: e })
72
+ });
73
+ if (!r.ok) {
74
+ let i = `Dry run failed: ${r.status}`;
75
+ try {
76
+ const a = await r.text();
77
+ try {
78
+ const o = JSON.parse(a);
79
+ o.error ? i = o.error : i += ` ${a}`;
80
+ } catch {
81
+ i += ` ${a}`;
82
+ }
83
+ } catch {
84
+ }
85
+ throw new Error(i);
86
+ }
87
+ return r.json();
88
+ }
89
+ /**
90
+ * Execute multiple queries in a single batch request
91
+ * Used by BatchCoordinator to optimize network requests
92
+ */
93
+ async batchLoad(e) {
94
+ const n = `${this.apiUrl}/batch`, r = await fetch(n, {
95
+ method: "POST",
96
+ headers: this.headers,
97
+ credentials: this.credentials,
98
+ body: JSON.stringify({ queries: e })
99
+ });
100
+ if (!r.ok) {
101
+ let a = `Batch query failed: ${r.status}`;
102
+ try {
103
+ const o = await r.text();
104
+ try {
105
+ const s = JSON.parse(o);
106
+ s.error ? a = s.error : a += ` ${o}`;
107
+ } catch {
108
+ a += ` ${o}`;
109
+ }
110
+ } catch {
111
+ }
112
+ throw new Error(a);
113
+ }
114
+ return (await r.json()).results.map((a) => !a.success && a.error ? {
115
+ ...new Lt({ data: [], annotation: {} }),
116
+ error: a.error
117
+ } : new Lt(a));
118
+ }
119
+ }
120
+ class Lt {
121
+ loadResponse;
122
+ constructor(e) {
123
+ this.loadResponse = e;
124
+ }
125
+ rawData() {
126
+ return this.loadResponse.results && this.loadResponse.results[0] ? this.loadResponse.results[0].data || [] : this.loadResponse.data || [];
127
+ }
128
+ tablePivot() {
129
+ return this.rawData();
130
+ }
131
+ series() {
132
+ return this.rawData();
133
+ }
134
+ annotation() {
135
+ return this.loadResponse.results && this.loadResponse.results[0] ? this.loadResponse.results[0].annotation || {} : this.loadResponse.annotation || {};
136
+ }
137
+ }
138
+ function mn(t, e = {}) {
139
+ return new dn(t, e);
140
+ }
141
+ const gn = 900 * 1e3;
142
+ let j = null;
143
+ function pn(t) {
144
+ const e = {};
145
+ return t.cubes.forEach((n) => {
146
+ n.measures.forEach((r) => {
147
+ e[r.name] = r.title || r.shortTitle || r.name;
148
+ }), n.dimensions.forEach((r) => {
149
+ e[r.name] = r.title || r.shortTitle || r.name;
150
+ }), n.segments.forEach((r) => {
151
+ e[r.name] = r.title || r.shortTitle || r.name;
152
+ });
153
+ }), e;
154
+ }
155
+ function yn() {
156
+ return j ? Date.now() - j.timestamp < gn : !1;
157
+ }
158
+ function xn(t) {
159
+ const [e, n] = B(null), [r, i] = B({}), [a, o] = B(!0), [s, c] = B(null), u = Rt(async () => {
160
+ if (yn() && j) {
161
+ n(j.data), i(j.labelMap), o(!1), c(null);
162
+ return;
163
+ }
164
+ try {
165
+ o(!0), c(null);
166
+ const f = await t.meta(), d = pn(f);
167
+ j = {
168
+ data: f,
169
+ labelMap: d,
170
+ timestamp: Date.now()
171
+ }, n(f), i(d);
172
+ } catch (f) {
173
+ const d = f instanceof Error ? f.message : "Failed to fetch metadata";
174
+ c(d), console.error("Failed to fetch cube metadata:", f);
175
+ } finally {
176
+ o(!1);
177
+ }
178
+ }, [t]);
179
+ bt(() => {
180
+ u();
181
+ }, [u]);
182
+ const l = Rt((f) => r[f] || f, [r]), m = Rt(() => {
183
+ j = null, u();
184
+ }, [u]);
185
+ return {
186
+ meta: e,
187
+ labelMap: r,
188
+ loading: a,
189
+ error: s,
190
+ refetch: m,
191
+ getFieldLabel: l
192
+ };
193
+ }
194
+ class wn {
195
+ queue = [];
196
+ flushScheduled = !1;
197
+ batchExecutor;
198
+ delayMs;
199
+ constructor(e, n = 100) {
200
+ this.batchExecutor = e, this.delayMs = n;
201
+ }
202
+ /**
203
+ * Register a query to be batched. Returns a promise that resolves
204
+ * when the batch is executed and this specific query's result is available.
205
+ */
206
+ register(e) {
207
+ return new Promise((n, r) => {
208
+ this.queue.push({ query: e, resolve: n, reject: r }), this.flushScheduled || this.scheduleFlush();
209
+ });
210
+ }
211
+ /**
212
+ * Schedule a flush after a short delay to collect multiple queries.
213
+ * The delay allows queries from lazy-loaded portlets that become visible
214
+ * during the same scroll action to be batched together.
215
+ */
216
+ scheduleFlush() {
217
+ this.flushScheduled = !0, setTimeout(() => {
218
+ this.flush();
219
+ }, this.delayMs);
220
+ }
221
+ /**
222
+ * Execute all queued queries as a batch and resolve individual promises
223
+ */
224
+ async flush() {
225
+ this.flushScheduled = !1;
226
+ const e = this.queue.slice();
227
+ if (this.queue = [], e.length !== 0)
228
+ try {
229
+ const n = e.map((i) => i.query), r = await this.batchExecutor(n);
230
+ e.forEach((i, a) => {
231
+ const o = r[a];
232
+ o && "error" in o && o.error ? i.reject(new Error(o.error)) : i.resolve(o);
233
+ });
234
+ } catch (n) {
235
+ e.forEach((r) => {
236
+ r.reject(n instanceof Error ? n : new Error(String(n)));
237
+ });
238
+ }
239
+ }
240
+ /**
241
+ * Get current queue size (useful for debugging)
242
+ */
243
+ getQueueSize() {
244
+ return this.queue.length;
245
+ }
246
+ /**
247
+ * Clear the queue (useful for testing/cleanup)
248
+ */
249
+ clear() {
250
+ this.queue = [], this.flushScheduled = !1;
251
+ }
252
+ }
253
+ const Ee = fn(null);
254
+ function ka({
255
+ cubeApi: t,
256
+ apiOptions: e,
257
+ token: n,
258
+ options: r = {},
259
+ features: i = { enableAI: !0, aiEndpoint: "/api/ai/generate", showSchemaDiagram: !1 },
260
+ // Default to AI enabled, schema diagram disabled
261
+ enableBatching: a = !0,
262
+ // Default to batching enabled
263
+ batchDelayMs: o = 100,
264
+ // Default 100ms batch window
265
+ children: s
266
+ }) {
267
+ const [c, u] = B(null), l = c || {
268
+ apiOptions: e || { apiUrl: "/cubejs-api/v1" },
269
+ token: n
270
+ }, m = ae(() => t && !e && !n ? t : mn(l.token, l.apiOptions), [t, e, n, l.apiOptions, l.token]), f = ae(() => {
271
+ if (!a)
272
+ return null;
273
+ const b = (C) => m.batchLoad(C);
274
+ return new wn(b, o);
275
+ }, [a, m, o]), { meta: d, labelMap: M, loading: T, error: S, getFieldLabel: E, refetch: v } = xn(m), A = {
276
+ cubeApi: m,
277
+ options: r,
278
+ meta: d,
279
+ labelMap: M,
280
+ metaLoading: T,
281
+ metaError: S,
282
+ getFieldLabel: E,
283
+ refetchMeta: v,
284
+ updateApiConfig: (b, C) => {
285
+ u({
286
+ apiOptions: b,
287
+ token: C
288
+ });
289
+ },
290
+ features: i,
291
+ batchCoordinator: f,
292
+ enableBatching: a
293
+ };
294
+ return /* @__PURE__ */ O(Ee.Provider, { value: A, children: s });
295
+ }
296
+ function bn() {
297
+ const t = ln(Ee);
298
+ if (!t)
299
+ throw new Error("useCubeContext must be used within a CubeProvider");
300
+ return t;
301
+ }
302
+ function Na(t) {
303
+ return t != null && !isNaN(Number(t));
304
+ }
305
+ function Pt(t) {
306
+ if (t == null) return null;
307
+ const e = typeof t == "string" ? parseFloat(t) : Number(t);
308
+ return isNaN(e) ? null : e;
309
+ }
310
+ function Sa(t) {
311
+ if (t == null) return "No data";
312
+ const e = typeof t == "number" ? t : parseFloat(t);
313
+ return isNaN(e) ? String(t) : Number.isInteger(e) ? e.toLocaleString() : parseFloat(e.toFixed(2)).toLocaleString();
314
+ }
315
+ function Vt(t, e) {
316
+ return e[t] || t;
317
+ }
318
+ function Qt(t, e) {
319
+ if (!t) return String(t || "Unknown");
320
+ const n = String(t);
321
+ if (n.match(/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}/)) {
322
+ let r = n;
323
+ n.includes(" ") && (r = n.replace(" ", "T").replace("+00", "Z").replace(/\+\d{2}:\d{2}$/, "Z")), !r.endsWith("Z") && !r.includes("+") && (r = r + "Z");
324
+ const i = new Date(r);
325
+ if (isNaN(i.getTime()))
326
+ return n;
327
+ const a = i.getUTCFullYear(), o = String(i.getUTCMonth() + 1).padStart(2, "0"), s = String(i.getUTCDate()).padStart(2, "0"), c = i.getUTCHours(), u = i.getUTCMinutes();
328
+ if (e)
329
+ switch (e.toLowerCase()) {
330
+ case "year":
331
+ return `${a}`;
332
+ case "quarter":
333
+ const f = Math.floor(i.getUTCMonth() / 3) + 1;
334
+ return `${a}-Q${f}`;
335
+ case "month":
336
+ return `${a}-${o}`;
337
+ case "week":
338
+ return `${a}-${o}-${s}`;
339
+ case "day":
340
+ return `${a}-${o}-${s}`;
341
+ case "hour":
342
+ return `${a}-${o}-${s} ${String(c).padStart(2, "0")}:00`;
343
+ case "minute":
344
+ return `${a}-${o}-${s} ${String(c).padStart(2, "0")}:${String(u).padStart(2, "0")}`;
345
+ }
346
+ const l = i.getUTCSeconds(), m = i.getUTCMilliseconds();
347
+ if (s === "01" && c === 0 && u === 0 && l === 0 && m === 0) {
348
+ if (o === "01" || o === "04" || o === "07" || o === "10") {
349
+ const f = Math.floor(i.getUTCMonth() / 3) + 1;
350
+ return `${a}-Q${f}`;
351
+ }
352
+ return `${a}-${o}`;
353
+ }
354
+ return c === 0 && u === 0 && l === 0 && m === 0 ? `${a}-${o}-${s}` : u === 0 && l === 0 && m === 0 ? `${a}-${o}-${s} ${String(c).padStart(2, "0")}:00` : `${a}-${o}-${s} ${String(c).padStart(2, "0")}:${String(u).padStart(2, "0")}`;
355
+ }
356
+ return n;
357
+ }
358
+ function Te(t, e) {
359
+ try {
360
+ if (t?.timeDimensions) {
361
+ const r = t.timeDimensions.find((i) => e === i.dimension || e.startsWith(i.dimension.replace(".", "_")) || e === `${i.dimension}_${i.granularity}`);
362
+ if (r?.granularity)
363
+ return r.granularity;
364
+ }
365
+ const n = e.match(/_([a-z]+)$/);
366
+ if (n) {
367
+ const r = n[1];
368
+ if (["year", "quarter", "month", "week", "day", "hour", "minute", "second"].includes(r))
369
+ return r;
370
+ }
371
+ return;
372
+ } catch {
373
+ return;
374
+ }
375
+ }
376
+ function vn(t, e, n, r, i = {}) {
377
+ if (!t || t.length === 0) return [];
378
+ const a = Te(r, e);
379
+ return t.map((o) => {
380
+ const s = {
381
+ name: Qt(o[e], a) || o[e] || "Unknown"
382
+ };
383
+ return n.forEach((c) => {
384
+ const u = Vt(c, i);
385
+ s[u] = Pt(o[c]);
386
+ }), s;
387
+ });
388
+ }
389
+ function $a(t, e, n, r, i, a = {}) {
390
+ if (!t || t.length === 0)
391
+ return { data: [], seriesKeys: [], hasDimensions: !1 };
392
+ const o = r || {}, s = [
393
+ ...o.dimensions || [],
394
+ ...o.timeDimensions?.map((d) => d.dimension) || []
395
+ ], c = o.measures || [], u = n.filter((d) => c.includes(d)), l = (i || []).filter((d) => s.includes(d));
396
+ if (l.length > 0) {
397
+ const d = {};
398
+ t.forEach((S) => {
399
+ const E = Te(r, e), v = Qt(S[e], E) || S[e] || "Unknown";
400
+ d[v] || (d[v] = { name: String(v) }), u.forEach(($) => {
401
+ const A = Vt($, a), b = Pt(S[$]);
402
+ if (b !== null) {
403
+ const C = d[v][A];
404
+ d[v][A] = C == null ? b : C + b;
405
+ } else A in d[v] || (d[v][A] = null);
406
+ }), l.forEach(($) => {
407
+ const A = S[$];
408
+ if (A != null) {
409
+ const b = String(A), C = u[0] || c.find(
410
+ (F) => F.includes("totalCost") || F.includes("count") || F.includes("sum")
411
+ ) || c[0];
412
+ if (C) {
413
+ const F = Pt(S[C]);
414
+ if (F !== null) {
415
+ const x = d[v][b];
416
+ d[v][b] = x == null ? F : x + F;
417
+ } else b in d[v] || (d[v][b] = null);
418
+ }
419
+ }
420
+ });
421
+ });
422
+ const M = Object.values(d), T = Array.from(new Set(
423
+ t.flatMap(
424
+ (S) => l.map((E) => {
425
+ const v = S[E];
426
+ return v != null ? String(v) : null;
427
+ }).filter((E) => E !== null)
428
+ )
429
+ ));
430
+ return {
431
+ data: M,
432
+ seriesKeys: T,
433
+ hasDimensions: !0
434
+ };
435
+ }
436
+ const m = vn(t, e, n, r, a), f = n.map((d) => Vt(d, a));
437
+ return {
438
+ data: m,
439
+ seriesKeys: f,
440
+ hasDimensions: !1
441
+ };
442
+ }
443
+ const Aa = [
444
+ "#3b82f6",
445
+ // blue
446
+ "#10b981",
447
+ // green
448
+ "#f59e0b",
449
+ // yellow
450
+ "#ef4444",
451
+ // red
452
+ "#8b5cf6",
453
+ // purple
454
+ "#f97316",
455
+ // orange
456
+ "#06b6d4",
457
+ // cyan
458
+ "#84cc16"
459
+ // lime
460
+ ], _n = [
461
+ "#440154",
462
+ // dark purple
463
+ "#414487",
464
+ // purple-blue
465
+ "#2a788e",
466
+ // teal
467
+ "#22a884",
468
+ // green-teal
469
+ "#7ad151",
470
+ // green
471
+ "#fde725"
472
+ // yellow
473
+ ], Ca = "#10b981", Ea = "#ef4444", Ta = {
474
+ top: 5,
475
+ right: 30,
476
+ left: 20,
477
+ bottom: 5
478
+ };
479
+ function Fa(t) {
480
+ return typeof window > "u" ? "" : getComputedStyle(document.documentElement).getPropertyValue(`--dc-${t}`).trim();
481
+ }
482
+ function Mn(t, e) {
483
+ typeof window > "u" || document.documentElement.style.setProperty(`--dc-${t}`, e);
484
+ }
485
+ function Ra(t) {
486
+ typeof window > "u" || Object.entries(t.colors).forEach(([e, n]) => {
487
+ if (n) {
488
+ const r = e.replace(/[A-Z]/g, (i) => `-${i.toLowerCase()}`);
489
+ Mn(r, n);
490
+ }
491
+ });
492
+ }
493
+ function La() {
494
+ if (typeof window > "u") return;
495
+ const t = document.documentElement.style;
496
+ Array.from(t).forEach((n) => {
497
+ n.startsWith("--dc-") && t.removeProperty(n);
498
+ });
499
+ }
500
+ function _t() {
501
+ if (typeof window > "u") return "light";
502
+ const t = localStorage.getItem("theme");
503
+ if (t === "dark" || t === "neon" || t === "light")
504
+ return t;
505
+ const e = document.documentElement.getAttribute("data-theme");
506
+ return e === "dark" || e === "neon" ? e : document.documentElement.classList.contains("dark") || document.body.classList.contains("dark") ? "dark" : document.documentElement.classList.contains("neon") || document.body.classList.contains("neon") ? "neon" : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
507
+ }
508
+ function Da(t) {
509
+ typeof window > "u" || (document.documentElement.classList.remove("dark", "neon"), document.documentElement.setAttribute("data-theme", t), (t === "dark" || t === "neon") && document.documentElement.classList.add(t), localStorage.setItem("theme", t));
510
+ }
511
+ function Ha() {
512
+ const t = _t();
513
+ return t === "dark" || t === "neon";
514
+ }
515
+ function kn(t) {
516
+ if (typeof window > "u") return () => {
517
+ };
518
+ const e = new MutationObserver(() => {
519
+ t(_t());
520
+ });
521
+ e.observe(document.documentElement, {
522
+ attributes: !0,
523
+ attributeFilter: ["class", "data-theme"]
524
+ });
525
+ const n = window.matchMedia("(prefers-color-scheme: dark)"), r = () => t(_t());
526
+ return n.addEventListener("change", r), () => {
527
+ e.disconnect(), n.removeEventListener("change", r);
528
+ };
529
+ }
530
+ const qa = {
531
+ light: {
532
+ name: "light",
533
+ colors: {
534
+ surface: "#ffffff",
535
+ surfaceSecondary: "#f9fafb",
536
+ text: "#111827",
537
+ textSecondary: "#374151",
538
+ textMuted: "#6b7280",
539
+ border: "#e5e7eb",
540
+ primary: "#3b82f6",
541
+ primaryHover: "#2563eb"
542
+ }
543
+ },
544
+ dark: {
545
+ name: "dark",
546
+ colors: {
547
+ surface: "#1e293b",
548
+ surfaceSecondary: "#334155",
549
+ text: "#f1f5f9",
550
+ textSecondary: "#e2e8f0",
551
+ textMuted: "#cbd5e1",
552
+ border: "#475569",
553
+ primary: "#60a5fa",
554
+ primaryHover: "#3b82f6"
555
+ }
556
+ },
557
+ neon: {
558
+ name: "neon",
559
+ colors: {
560
+ surface: "#0a0118",
561
+ surfaceSecondary: "#1a0f2e",
562
+ surfaceTertiary: "#2a1f3e",
563
+ text: "#ffffff",
564
+ textSecondary: "#e0e0ff",
565
+ textMuted: "#b0b0d0",
566
+ border: "#ff00ff",
567
+ borderSecondary: "#00ffff",
568
+ primary: "#00ffff",
569
+ primaryHover: "#00cccc",
570
+ primaryContent: "#000000",
571
+ success: "#00ff00",
572
+ warning: "#ffff00",
573
+ error: "#ff0066",
574
+ info: "#00ffff",
575
+ danger: "#ff1493"
576
+ }
577
+ }
578
+ };
579
+ function vt(t, e) {
580
+ return t == null || e == null ? NaN : t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN;
581
+ }
582
+ function Nn(t, e) {
583
+ return t == null || e == null ? NaN : e < t ? -1 : e > t ? 1 : e >= t ? 0 : NaN;
584
+ }
585
+ function Fe(t) {
586
+ let e, n, r;
587
+ t.length !== 2 ? (e = vt, n = (s, c) => vt(t(s), c), r = (s, c) => t(s) - c) : (e = t === vt || t === Nn ? t : Sn, n = t, r = t);
588
+ function i(s, c, u = 0, l = s.length) {
589
+ if (u < l) {
590
+ if (e(c, c) !== 0) return l;
591
+ do {
592
+ const m = u + l >>> 1;
593
+ n(s[m], c) < 0 ? u = m + 1 : l = m;
594
+ } while (u < l);
595
+ }
596
+ return u;
597
+ }
598
+ function a(s, c, u = 0, l = s.length) {
599
+ if (u < l) {
600
+ if (e(c, c) !== 0) return l;
601
+ do {
602
+ const m = u + l >>> 1;
603
+ n(s[m], c) <= 0 ? u = m + 1 : l = m;
604
+ } while (u < l);
605
+ }
606
+ return u;
607
+ }
608
+ function o(s, c, u = 0, l = s.length) {
609
+ const m = i(s, c, u, l - 1);
610
+ return m > u && r(s[m - 1], c) > -r(s[m], c) ? m - 1 : m;
611
+ }
612
+ return { left: i, center: o, right: a };
613
+ }
614
+ function Sn() {
615
+ return 0;
616
+ }
617
+ function $n(t) {
618
+ return t === null ? NaN : +t;
619
+ }
620
+ const An = Fe(vt), Re = An.right;
621
+ Fe($n).center;
622
+ function Oa(t, e) {
623
+ let n, r;
624
+ if (e === void 0)
625
+ for (const i of t)
626
+ i != null && (n === void 0 ? i >= i && (n = r = i) : (n > i && (n = i), r < i && (r = i)));
627
+ else {
628
+ let i = -1;
629
+ for (let a of t)
630
+ (a = e(a, ++i, t)) != null && (n === void 0 ? a >= a && (n = r = a) : (n > a && (n = a), r < a && (r = a)));
631
+ }
632
+ return [n, r];
633
+ }
634
+ class se extends Map {
635
+ constructor(e, n = Tn) {
636
+ if (super(), Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: n } }), e != null) for (const [r, i] of e) this.set(r, i);
637
+ }
638
+ get(e) {
639
+ return super.get(ce(this, e));
640
+ }
641
+ has(e) {
642
+ return super.has(ce(this, e));
643
+ }
644
+ set(e, n) {
645
+ return super.set(Cn(this, e), n);
646
+ }
647
+ delete(e) {
648
+ return super.delete(En(this, e));
649
+ }
650
+ }
651
+ function ce({ _intern: t, _key: e }, n) {
652
+ const r = e(n);
653
+ return t.has(r) ? t.get(r) : n;
654
+ }
655
+ function Cn({ _intern: t, _key: e }, n) {
656
+ const r = e(n);
657
+ return t.has(r) ? t.get(r) : (t.set(r, n), n);
658
+ }
659
+ function En({ _intern: t, _key: e }, n) {
660
+ const r = e(n);
661
+ return t.has(r) && (n = t.get(r), t.delete(r)), n;
662
+ }
663
+ function Tn(t) {
664
+ return t !== null && typeof t == "object" ? t.valueOf() : t;
665
+ }
666
+ const Fn = Math.sqrt(50), Rn = Math.sqrt(10), Ln = Math.sqrt(2);
667
+ function Mt(t, e, n) {
668
+ const r = (e - t) / Math.max(0, n), i = Math.floor(Math.log10(r)), a = r / Math.pow(10, i), o = a >= Fn ? 10 : a >= Rn ? 5 : a >= Ln ? 2 : 1;
669
+ let s, c, u;
670
+ return i < 0 ? (u = Math.pow(10, -i) / o, s = Math.round(t * u), c = Math.round(e * u), s / u < t && ++s, c / u > e && --c, u = -u) : (u = Math.pow(10, i) * o, s = Math.round(t / u), c = Math.round(e / u), s * u < t && ++s, c * u > e && --c), c < s && 0.5 <= n && n < 2 ? Mt(t, e, n * 2) : [s, c, u];
671
+ }
672
+ function Dn(t, e, n) {
673
+ if (e = +e, t = +t, n = +n, !(n > 0)) return [];
674
+ if (t === e) return [t];
675
+ const r = e < t, [i, a, o] = r ? Mt(e, t, n) : Mt(t, e, n);
676
+ if (!(a >= i)) return [];
677
+ const s = a - i + 1, c = new Array(s);
678
+ if (r)
679
+ if (o < 0) for (let u = 0; u < s; ++u) c[u] = (a - u) / -o;
680
+ else for (let u = 0; u < s; ++u) c[u] = (a - u) * o;
681
+ else if (o < 0) for (let u = 0; u < s; ++u) c[u] = (i + u) / -o;
682
+ else for (let u = 0; u < s; ++u) c[u] = (i + u) * o;
683
+ return c;
684
+ }
685
+ function zt(t, e, n) {
686
+ return e = +e, t = +t, n = +n, Mt(t, e, n)[2];
687
+ }
688
+ function Hn(t, e, n) {
689
+ e = +e, t = +t, n = +n;
690
+ const r = e < t, i = r ? zt(e, t, n) : zt(t, e, n);
691
+ return (r ? -1 : 1) * (i < 0 ? 1 / -i : i);
692
+ }
693
+ function ue(t, e) {
694
+ let n;
695
+ if (e === void 0)
696
+ for (const r of t)
697
+ r != null && (n < r || n === void 0 && r >= r) && (n = r);
698
+ else {
699
+ let r = -1;
700
+ for (let i of t)
701
+ (i = e(i, ++r, t)) != null && (n < i || n === void 0 && i >= i) && (n = i);
702
+ }
703
+ return n;
704
+ }
705
+ function le(t, e) {
706
+ let n;
707
+ if (e === void 0)
708
+ for (const r of t)
709
+ r != null && (n > r || n === void 0 && r >= r) && (n = r);
710
+ else {
711
+ let r = -1;
712
+ for (let i of t)
713
+ (i = e(i, ++r, t)) != null && (n > i || n === void 0 && i >= i) && (n = i);
714
+ }
715
+ return n;
716
+ }
717
+ function qn(t) {
718
+ return t;
719
+ }
720
+ var Dt = 1, Ht = 2, It = 3, ut = 4, fe = 1e-6;
721
+ function On(t) {
722
+ return "translate(" + t + ",0)";
723
+ }
724
+ function Pn(t) {
725
+ return "translate(0," + t + ")";
726
+ }
727
+ function Vn(t) {
728
+ return (e) => +t(e);
729
+ }
730
+ function zn(t, e) {
731
+ return e = Math.max(0, t.bandwidth() - e * 2) / 2, t.round() && (e = Math.round(e)), (n) => +t(n) + e;
732
+ }
733
+ function In() {
734
+ return !this.__axis;
735
+ }
736
+ function Le(t, e) {
737
+ var n = [], r = null, i = null, a = 6, o = 6, s = 3, c = typeof window < "u" && window.devicePixelRatio > 1 ? 0 : 0.5, u = t === Dt || t === ut ? -1 : 1, l = t === ut || t === Ht ? "x" : "y", m = t === Dt || t === It ? On : Pn;
738
+ function f(d) {
739
+ var M = r ?? (e.ticks ? e.ticks.apply(e, n) : e.domain()), T = i ?? (e.tickFormat ? e.tickFormat.apply(e, n) : qn), S = Math.max(a, 0) + s, E = e.range(), v = +E[0] + c, $ = +E[E.length - 1] + c, A = (e.bandwidth ? zn : Vn)(e.copy(), c), b = d.selection ? d.selection() : d, C = b.selectAll(".domain").data([null]), F = b.selectAll(".tick").data(M, e).order(), x = F.exit(), h = F.enter().append("g").attr("class", "tick"), _ = F.select("line"), g = F.select("text");
740
+ C = C.merge(C.enter().insert("path", ".tick").attr("class", "domain").attr("stroke", "currentColor")), F = F.merge(h), _ = _.merge(h.append("line").attr("stroke", "currentColor").attr(l + "2", u * a)), g = g.merge(h.append("text").attr("fill", "currentColor").attr(l, u * S).attr("dy", t === Dt ? "0em" : t === It ? "0.71em" : "0.32em")), d !== b && (C = C.transition(d), F = F.transition(d), _ = _.transition(d), g = g.transition(d), x = x.transition(d).attr("opacity", fe).attr("transform", function(w) {
741
+ return isFinite(w = A(w)) ? m(w + c) : this.getAttribute("transform");
742
+ }), h.attr("opacity", fe).attr("transform", function(w) {
743
+ var k = this.parentNode.__axis;
744
+ return m((k && isFinite(k = k(w)) ? k : A(w)) + c);
745
+ })), x.remove(), C.attr("d", t === ut || t === Ht ? o ? "M" + u * o + "," + v + "H" + c + "V" + $ + "H" + u * o : "M" + c + "," + v + "V" + $ : o ? "M" + v + "," + u * o + "V" + c + "H" + $ + "V" + u * o : "M" + v + "," + c + "H" + $), F.attr("opacity", 1).attr("transform", function(w) {
746
+ return m(A(w) + c);
747
+ }), _.attr(l + "2", u * a), g.attr(l, u * S).text(T), b.filter(In).attr("fill", "none").attr("font-size", 10).attr("font-family", "sans-serif").attr("text-anchor", t === Ht ? "start" : t === ut ? "end" : "middle"), b.each(function() {
748
+ this.__axis = A;
749
+ });
750
+ }
751
+ return f.scale = function(d) {
752
+ return arguments.length ? (e = d, f) : e;
753
+ }, f.ticks = function() {
754
+ return n = Array.from(arguments), f;
755
+ }, f.tickArguments = function(d) {
756
+ return arguments.length ? (n = d == null ? [] : Array.from(d), f) : n.slice();
757
+ }, f.tickValues = function(d) {
758
+ return arguments.length ? (r = d == null ? null : Array.from(d), f) : r && r.slice();
759
+ }, f.tickFormat = function(d) {
760
+ return arguments.length ? (i = d, f) : i;
761
+ }, f.tickSize = function(d) {
762
+ return arguments.length ? (a = o = +d, f) : a;
763
+ }, f.tickSizeInner = function(d) {
764
+ return arguments.length ? (a = +d, f) : a;
765
+ }, f.tickSizeOuter = function(d) {
766
+ return arguments.length ? (o = +d, f) : o;
767
+ }, f.tickPadding = function(d) {
768
+ return arguments.length ? (s = +d, f) : s;
769
+ }, f.offset = function(d) {
770
+ return arguments.length ? (c = +d, f) : c;
771
+ }, f;
772
+ }
773
+ function Pa(t) {
774
+ return Le(It, t);
775
+ }
776
+ function Va(t) {
777
+ return Le(ut, t);
778
+ }
779
+ var Wt = "http://www.w3.org/1999/xhtml";
780
+ const he = {
781
+ svg: "http://www.w3.org/2000/svg",
782
+ xhtml: Wt,
783
+ xlink: "http://www.w3.org/1999/xlink",
784
+ xml: "http://www.w3.org/XML/1998/namespace",
785
+ xmlns: "http://www.w3.org/2000/xmlns/"
786
+ };
787
+ function De(t) {
788
+ var e = t += "", n = e.indexOf(":");
789
+ return n >= 0 && (e = t.slice(0, n)) !== "xmlns" && (t = t.slice(n + 1)), he.hasOwnProperty(e) ? { space: he[e], local: t } : t;
790
+ }
791
+ function Wn(t) {
792
+ return function() {
793
+ var e = this.ownerDocument, n = this.namespaceURI;
794
+ return n === Wt && e.documentElement.namespaceURI === Wt ? e.createElement(t) : e.createElementNS(n, t);
795
+ };
796
+ }
797
+ function Un(t) {
798
+ return function() {
799
+ return this.ownerDocument.createElementNS(t.space, t.local);
800
+ };
801
+ }
802
+ function He(t) {
803
+ var e = De(t);
804
+ return (e.local ? Un : Wn)(e);
805
+ }
806
+ function Yn() {
807
+ }
808
+ function qe(t) {
809
+ return t == null ? Yn : function() {
810
+ return this.querySelector(t);
811
+ };
812
+ }
813
+ function Xn(t) {
814
+ typeof t != "function" && (t = qe(t));
815
+ for (var e = this._groups, n = e.length, r = new Array(n), i = 0; i < n; ++i)
816
+ for (var a = e[i], o = a.length, s = r[i] = new Array(o), c, u, l = 0; l < o; ++l)
817
+ (c = a[l]) && (u = t.call(c, c.__data__, l, a)) && ("__data__" in c && (u.__data__ = c.__data__), s[l] = u);
818
+ return new I(r, this._parents);
819
+ }
820
+ function Qn(t) {
821
+ return t == null ? [] : Array.isArray(t) ? t : Array.from(t);
822
+ }
823
+ function Gn() {
824
+ return [];
825
+ }
826
+ function Bn(t) {
827
+ return t == null ? Gn : function() {
828
+ return this.querySelectorAll(t);
829
+ };
830
+ }
831
+ function Jn(t) {
832
+ return function() {
833
+ return Qn(t.apply(this, arguments));
834
+ };
835
+ }
836
+ function Zn(t) {
837
+ typeof t == "function" ? t = Jn(t) : t = Bn(t);
838
+ for (var e = this._groups, n = e.length, r = [], i = [], a = 0; a < n; ++a)
839
+ for (var o = e[a], s = o.length, c, u = 0; u < s; ++u)
840
+ (c = o[u]) && (r.push(t.call(c, c.__data__, u, o)), i.push(c));
841
+ return new I(r, i);
842
+ }
843
+ function Kn(t) {
844
+ return function() {
845
+ return this.matches(t);
846
+ };
847
+ }
848
+ function Oe(t) {
849
+ return function(e) {
850
+ return e.matches(t);
851
+ };
852
+ }
853
+ var jn = Array.prototype.find;
854
+ function tr(t) {
855
+ return function() {
856
+ return jn.call(this.children, t);
857
+ };
858
+ }
859
+ function er() {
860
+ return this.firstElementChild;
861
+ }
862
+ function nr(t) {
863
+ return this.select(t == null ? er : tr(typeof t == "function" ? t : Oe(t)));
864
+ }
865
+ var rr = Array.prototype.filter;
866
+ function ir() {
867
+ return Array.from(this.children);
868
+ }
869
+ function ar(t) {
870
+ return function() {
871
+ return rr.call(this.children, t);
872
+ };
873
+ }
874
+ function or(t) {
875
+ return this.selectAll(t == null ? ir : ar(typeof t == "function" ? t : Oe(t)));
876
+ }
877
+ function sr(t) {
878
+ typeof t != "function" && (t = Kn(t));
879
+ for (var e = this._groups, n = e.length, r = new Array(n), i = 0; i < n; ++i)
880
+ for (var a = e[i], o = a.length, s = r[i] = [], c, u = 0; u < o; ++u)
881
+ (c = a[u]) && t.call(c, c.__data__, u, a) && s.push(c);
882
+ return new I(r, this._parents);
883
+ }
884
+ function Pe(t) {
885
+ return new Array(t.length);
886
+ }
887
+ function cr() {
888
+ return new I(this._enter || this._groups.map(Pe), this._parents);
889
+ }
890
+ function kt(t, e) {
891
+ this.ownerDocument = t.ownerDocument, this.namespaceURI = t.namespaceURI, this._next = null, this._parent = t, this.__data__ = e;
892
+ }
893
+ kt.prototype = {
894
+ constructor: kt,
895
+ appendChild: function(t) {
896
+ return this._parent.insertBefore(t, this._next);
897
+ },
898
+ insertBefore: function(t, e) {
899
+ return this._parent.insertBefore(t, e);
900
+ },
901
+ querySelector: function(t) {
902
+ return this._parent.querySelector(t);
903
+ },
904
+ querySelectorAll: function(t) {
905
+ return this._parent.querySelectorAll(t);
906
+ }
907
+ };
908
+ function ur(t) {
909
+ return function() {
910
+ return t;
911
+ };
912
+ }
913
+ function lr(t, e, n, r, i, a) {
914
+ for (var o = 0, s, c = e.length, u = a.length; o < u; ++o)
915
+ (s = e[o]) ? (s.__data__ = a[o], r[o] = s) : n[o] = new kt(t, a[o]);
916
+ for (; o < c; ++o)
917
+ (s = e[o]) && (i[o] = s);
918
+ }
919
+ function fr(t, e, n, r, i, a, o) {
920
+ var s, c, u = /* @__PURE__ */ new Map(), l = e.length, m = a.length, f = new Array(l), d;
921
+ for (s = 0; s < l; ++s)
922
+ (c = e[s]) && (f[s] = d = o.call(c, c.__data__, s, e) + "", u.has(d) ? i[s] = c : u.set(d, c));
923
+ for (s = 0; s < m; ++s)
924
+ d = o.call(t, a[s], s, a) + "", (c = u.get(d)) ? (r[s] = c, c.__data__ = a[s], u.delete(d)) : n[s] = new kt(t, a[s]);
925
+ for (s = 0; s < l; ++s)
926
+ (c = e[s]) && u.get(f[s]) === c && (i[s] = c);
927
+ }
928
+ function hr(t) {
929
+ return t.__data__;
930
+ }
931
+ function dr(t, e) {
932
+ if (!arguments.length) return Array.from(this, hr);
933
+ var n = e ? fr : lr, r = this._parents, i = this._groups;
934
+ typeof t != "function" && (t = ur(t));
935
+ for (var a = i.length, o = new Array(a), s = new Array(a), c = new Array(a), u = 0; u < a; ++u) {
936
+ var l = r[u], m = i[u], f = m.length, d = mr(t.call(l, l && l.__data__, u, r)), M = d.length, T = s[u] = new Array(M), S = o[u] = new Array(M), E = c[u] = new Array(f);
937
+ n(l, m, T, S, E, d, e);
938
+ for (var v = 0, $ = 0, A, b; v < M; ++v)
939
+ if (A = T[v]) {
940
+ for (v >= $ && ($ = v + 1); !(b = S[$]) && ++$ < M; ) ;
941
+ A._next = b || null;
942
+ }
943
+ }
944
+ return o = new I(o, r), o._enter = s, o._exit = c, o;
945
+ }
946
+ function mr(t) {
947
+ return typeof t == "object" && "length" in t ? t : Array.from(t);
948
+ }
949
+ function gr() {
950
+ return new I(this._exit || this._groups.map(Pe), this._parents);
951
+ }
952
+ function pr(t, e, n) {
953
+ var r = this.enter(), i = this, a = this.exit();
954
+ return typeof t == "function" ? (r = t(r), r && (r = r.selection())) : r = r.append(t + ""), e != null && (i = e(i), i && (i = i.selection())), n == null ? a.remove() : n(a), r && i ? r.merge(i).order() : i;
955
+ }
956
+ function yr(t) {
957
+ for (var e = t.selection ? t.selection() : t, n = this._groups, r = e._groups, i = n.length, a = r.length, o = Math.min(i, a), s = new Array(i), c = 0; c < o; ++c)
958
+ for (var u = n[c], l = r[c], m = u.length, f = s[c] = new Array(m), d, M = 0; M < m; ++M)
959
+ (d = u[M] || l[M]) && (f[M] = d);
960
+ for (; c < i; ++c)
961
+ s[c] = n[c];
962
+ return new I(s, this._parents);
963
+ }
964
+ function xr() {
965
+ for (var t = this._groups, e = -1, n = t.length; ++e < n; )
966
+ for (var r = t[e], i = r.length - 1, a = r[i], o; --i >= 0; )
967
+ (o = r[i]) && (a && o.compareDocumentPosition(a) ^ 4 && a.parentNode.insertBefore(o, a), a = o);
968
+ return this;
969
+ }
970
+ function wr(t) {
971
+ t || (t = br);
972
+ function e(m, f) {
973
+ return m && f ? t(m.__data__, f.__data__) : !m - !f;
974
+ }
975
+ for (var n = this._groups, r = n.length, i = new Array(r), a = 0; a < r; ++a) {
976
+ for (var o = n[a], s = o.length, c = i[a] = new Array(s), u, l = 0; l < s; ++l)
977
+ (u = o[l]) && (c[l] = u);
978
+ c.sort(e);
979
+ }
980
+ return new I(i, this._parents).order();
981
+ }
982
+ function br(t, e) {
983
+ return t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN;
984
+ }
985
+ function vr() {
986
+ var t = arguments[0];
987
+ return arguments[0] = this, t.apply(null, arguments), this;
988
+ }
989
+ function _r() {
990
+ return Array.from(this);
991
+ }
992
+ function Mr() {
993
+ for (var t = this._groups, e = 0, n = t.length; e < n; ++e)
994
+ for (var r = t[e], i = 0, a = r.length; i < a; ++i) {
995
+ var o = r[i];
996
+ if (o) return o;
997
+ }
998
+ return null;
999
+ }
1000
+ function kr() {
1001
+ let t = 0;
1002
+ for (const e of this) ++t;
1003
+ return t;
1004
+ }
1005
+ function Nr() {
1006
+ return !this.node();
1007
+ }
1008
+ function Sr(t) {
1009
+ for (var e = this._groups, n = 0, r = e.length; n < r; ++n)
1010
+ for (var i = e[n], a = 0, o = i.length, s; a < o; ++a)
1011
+ (s = i[a]) && t.call(s, s.__data__, a, i);
1012
+ return this;
1013
+ }
1014
+ function $r(t) {
1015
+ return function() {
1016
+ this.removeAttribute(t);
1017
+ };
1018
+ }
1019
+ function Ar(t) {
1020
+ return function() {
1021
+ this.removeAttributeNS(t.space, t.local);
1022
+ };
1023
+ }
1024
+ function Cr(t, e) {
1025
+ return function() {
1026
+ this.setAttribute(t, e);
1027
+ };
1028
+ }
1029
+ function Er(t, e) {
1030
+ return function() {
1031
+ this.setAttributeNS(t.space, t.local, e);
1032
+ };
1033
+ }
1034
+ function Tr(t, e) {
1035
+ return function() {
1036
+ var n = e.apply(this, arguments);
1037
+ n == null ? this.removeAttribute(t) : this.setAttribute(t, n);
1038
+ };
1039
+ }
1040
+ function Fr(t, e) {
1041
+ return function() {
1042
+ var n = e.apply(this, arguments);
1043
+ n == null ? this.removeAttributeNS(t.space, t.local) : this.setAttributeNS(t.space, t.local, n);
1044
+ };
1045
+ }
1046
+ function Rr(t, e) {
1047
+ var n = De(t);
1048
+ if (arguments.length < 2) {
1049
+ var r = this.node();
1050
+ return n.local ? r.getAttributeNS(n.space, n.local) : r.getAttribute(n);
1051
+ }
1052
+ return this.each((e == null ? n.local ? Ar : $r : typeof e == "function" ? n.local ? Fr : Tr : n.local ? Er : Cr)(n, e));
1053
+ }
1054
+ function Ve(t) {
1055
+ return t.ownerDocument && t.ownerDocument.defaultView || t.document && t || t.defaultView;
1056
+ }
1057
+ function Lr(t) {
1058
+ return function() {
1059
+ this.style.removeProperty(t);
1060
+ };
1061
+ }
1062
+ function Dr(t, e, n) {
1063
+ return function() {
1064
+ this.style.setProperty(t, e, n);
1065
+ };
1066
+ }
1067
+ function Hr(t, e, n) {
1068
+ return function() {
1069
+ var r = e.apply(this, arguments);
1070
+ r == null ? this.style.removeProperty(t) : this.style.setProperty(t, r, n);
1071
+ };
1072
+ }
1073
+ function qr(t, e, n) {
1074
+ return arguments.length > 1 ? this.each((e == null ? Lr : typeof e == "function" ? Hr : Dr)(t, e, n ?? "")) : Or(this.node(), t);
1075
+ }
1076
+ function Or(t, e) {
1077
+ return t.style.getPropertyValue(e) || Ve(t).getComputedStyle(t, null).getPropertyValue(e);
1078
+ }
1079
+ function Pr(t) {
1080
+ return function() {
1081
+ delete this[t];
1082
+ };
1083
+ }
1084
+ function Vr(t, e) {
1085
+ return function() {
1086
+ this[t] = e;
1087
+ };
1088
+ }
1089
+ function zr(t, e) {
1090
+ return function() {
1091
+ var n = e.apply(this, arguments);
1092
+ n == null ? delete this[t] : this[t] = n;
1093
+ };
1094
+ }
1095
+ function Ir(t, e) {
1096
+ return arguments.length > 1 ? this.each((e == null ? Pr : typeof e == "function" ? zr : Vr)(t, e)) : this.node()[t];
1097
+ }
1098
+ function ze(t) {
1099
+ return t.trim().split(/^|\s+/);
1100
+ }
1101
+ function Gt(t) {
1102
+ return t.classList || new Ie(t);
1103
+ }
1104
+ function Ie(t) {
1105
+ this._node = t, this._names = ze(t.getAttribute("class") || "");
1106
+ }
1107
+ Ie.prototype = {
1108
+ add: function(t) {
1109
+ var e = this._names.indexOf(t);
1110
+ e < 0 && (this._names.push(t), this._node.setAttribute("class", this._names.join(" ")));
1111
+ },
1112
+ remove: function(t) {
1113
+ var e = this._names.indexOf(t);
1114
+ e >= 0 && (this._names.splice(e, 1), this._node.setAttribute("class", this._names.join(" ")));
1115
+ },
1116
+ contains: function(t) {
1117
+ return this._names.indexOf(t) >= 0;
1118
+ }
1119
+ };
1120
+ function We(t, e) {
1121
+ for (var n = Gt(t), r = -1, i = e.length; ++r < i; ) n.add(e[r]);
1122
+ }
1123
+ function Ue(t, e) {
1124
+ for (var n = Gt(t), r = -1, i = e.length; ++r < i; ) n.remove(e[r]);
1125
+ }
1126
+ function Wr(t) {
1127
+ return function() {
1128
+ We(this, t);
1129
+ };
1130
+ }
1131
+ function Ur(t) {
1132
+ return function() {
1133
+ Ue(this, t);
1134
+ };
1135
+ }
1136
+ function Yr(t, e) {
1137
+ return function() {
1138
+ (e.apply(this, arguments) ? We : Ue)(this, t);
1139
+ };
1140
+ }
1141
+ function Xr(t, e) {
1142
+ var n = ze(t + "");
1143
+ if (arguments.length < 2) {
1144
+ for (var r = Gt(this.node()), i = -1, a = n.length; ++i < a; ) if (!r.contains(n[i])) return !1;
1145
+ return !0;
1146
+ }
1147
+ return this.each((typeof e == "function" ? Yr : e ? Wr : Ur)(n, e));
1148
+ }
1149
+ function Qr() {
1150
+ this.textContent = "";
1151
+ }
1152
+ function Gr(t) {
1153
+ return function() {
1154
+ this.textContent = t;
1155
+ };
1156
+ }
1157
+ function Br(t) {
1158
+ return function() {
1159
+ var e = t.apply(this, arguments);
1160
+ this.textContent = e ?? "";
1161
+ };
1162
+ }
1163
+ function Jr(t) {
1164
+ return arguments.length ? this.each(t == null ? Qr : (typeof t == "function" ? Br : Gr)(t)) : this.node().textContent;
1165
+ }
1166
+ function Zr() {
1167
+ this.innerHTML = "";
1168
+ }
1169
+ function Kr(t) {
1170
+ return function() {
1171
+ this.innerHTML = t;
1172
+ };
1173
+ }
1174
+ function jr(t) {
1175
+ return function() {
1176
+ var e = t.apply(this, arguments);
1177
+ this.innerHTML = e ?? "";
1178
+ };
1179
+ }
1180
+ function ti(t) {
1181
+ return arguments.length ? this.each(t == null ? Zr : (typeof t == "function" ? jr : Kr)(t)) : this.node().innerHTML;
1182
+ }
1183
+ function ei() {
1184
+ this.nextSibling && this.parentNode.appendChild(this);
1185
+ }
1186
+ function ni() {
1187
+ return this.each(ei);
1188
+ }
1189
+ function ri() {
1190
+ this.previousSibling && this.parentNode.insertBefore(this, this.parentNode.firstChild);
1191
+ }
1192
+ function ii() {
1193
+ return this.each(ri);
1194
+ }
1195
+ function ai(t) {
1196
+ var e = typeof t == "function" ? t : He(t);
1197
+ return this.select(function() {
1198
+ return this.appendChild(e.apply(this, arguments));
1199
+ });
1200
+ }
1201
+ function oi() {
1202
+ return null;
1203
+ }
1204
+ function si(t, e) {
1205
+ var n = typeof t == "function" ? t : He(t), r = e == null ? oi : typeof e == "function" ? e : qe(e);
1206
+ return this.select(function() {
1207
+ return this.insertBefore(n.apply(this, arguments), r.apply(this, arguments) || null);
1208
+ });
1209
+ }
1210
+ function ci() {
1211
+ var t = this.parentNode;
1212
+ t && t.removeChild(this);
1213
+ }
1214
+ function ui() {
1215
+ return this.each(ci);
1216
+ }
1217
+ function li() {
1218
+ var t = this.cloneNode(!1), e = this.parentNode;
1219
+ return e ? e.insertBefore(t, this.nextSibling) : t;
1220
+ }
1221
+ function fi() {
1222
+ var t = this.cloneNode(!0), e = this.parentNode;
1223
+ return e ? e.insertBefore(t, this.nextSibling) : t;
1224
+ }
1225
+ function hi(t) {
1226
+ return this.select(t ? fi : li);
1227
+ }
1228
+ function di(t) {
1229
+ return arguments.length ? this.property("__data__", t) : this.node().__data__;
1230
+ }
1231
+ function mi(t) {
1232
+ return function(e) {
1233
+ t.call(this, e, this.__data__);
1234
+ };
1235
+ }
1236
+ function gi(t) {
1237
+ return t.trim().split(/^|\s+/).map(function(e) {
1238
+ var n = "", r = e.indexOf(".");
1239
+ return r >= 0 && (n = e.slice(r + 1), e = e.slice(0, r)), { type: e, name: n };
1240
+ });
1241
+ }
1242
+ function pi(t) {
1243
+ return function() {
1244
+ var e = this.__on;
1245
+ if (e) {
1246
+ for (var n = 0, r = -1, i = e.length, a; n < i; ++n)
1247
+ a = e[n], (!t.type || a.type === t.type) && a.name === t.name ? this.removeEventListener(a.type, a.listener, a.options) : e[++r] = a;
1248
+ ++r ? e.length = r : delete this.__on;
1249
+ }
1250
+ };
1251
+ }
1252
+ function yi(t, e, n) {
1253
+ return function() {
1254
+ var r = this.__on, i, a = mi(e);
1255
+ if (r) {
1256
+ for (var o = 0, s = r.length; o < s; ++o)
1257
+ if ((i = r[o]).type === t.type && i.name === t.name) {
1258
+ this.removeEventListener(i.type, i.listener, i.options), this.addEventListener(i.type, i.listener = a, i.options = n), i.value = e;
1259
+ return;
1260
+ }
1261
+ }
1262
+ this.addEventListener(t.type, a, n), i = { type: t.type, name: t.name, value: e, listener: a, options: n }, r ? r.push(i) : this.__on = [i];
1263
+ };
1264
+ }
1265
+ function xi(t, e, n) {
1266
+ var r = gi(t + ""), i, a = r.length, o;
1267
+ if (arguments.length < 2) {
1268
+ var s = this.node().__on;
1269
+ if (s) {
1270
+ for (var c = 0, u = s.length, l; c < u; ++c)
1271
+ for (i = 0, l = s[c]; i < a; ++i)
1272
+ if ((o = r[i]).type === l.type && o.name === l.name)
1273
+ return l.value;
1274
+ }
1275
+ return;
1276
+ }
1277
+ for (s = e ? yi : pi, i = 0; i < a; ++i) this.each(s(r[i], e, n));
1278
+ return this;
1279
+ }
1280
+ function Ye(t, e, n) {
1281
+ var r = Ve(t), i = r.CustomEvent;
1282
+ typeof i == "function" ? i = new i(e, n) : (i = r.document.createEvent("Event"), n ? (i.initEvent(e, n.bubbles, n.cancelable), i.detail = n.detail) : i.initEvent(e, !1, !1)), t.dispatchEvent(i);
1283
+ }
1284
+ function wi(t, e) {
1285
+ return function() {
1286
+ return Ye(this, t, e);
1287
+ };
1288
+ }
1289
+ function bi(t, e) {
1290
+ return function() {
1291
+ return Ye(this, t, e.apply(this, arguments));
1292
+ };
1293
+ }
1294
+ function vi(t, e) {
1295
+ return this.each((typeof e == "function" ? bi : wi)(t, e));
1296
+ }
1297
+ function* _i() {
1298
+ for (var t = this._groups, e = 0, n = t.length; e < n; ++e)
1299
+ for (var r = t[e], i = 0, a = r.length, o; i < a; ++i)
1300
+ (o = r[i]) && (yield o);
1301
+ }
1302
+ var Mi = [null];
1303
+ function I(t, e) {
1304
+ this._groups = t, this._parents = e;
1305
+ }
1306
+ function ki() {
1307
+ return this;
1308
+ }
1309
+ I.prototype = {
1310
+ constructor: I,
1311
+ select: Xn,
1312
+ selectAll: Zn,
1313
+ selectChild: nr,
1314
+ selectChildren: or,
1315
+ filter: sr,
1316
+ data: dr,
1317
+ enter: cr,
1318
+ exit: gr,
1319
+ join: pr,
1320
+ merge: yr,
1321
+ selection: ki,
1322
+ order: xr,
1323
+ sort: wr,
1324
+ call: vr,
1325
+ nodes: _r,
1326
+ node: Mr,
1327
+ size: kr,
1328
+ empty: Nr,
1329
+ each: Sr,
1330
+ attr: Rr,
1331
+ style: qr,
1332
+ property: Ir,
1333
+ classed: Xr,
1334
+ text: Jr,
1335
+ html: ti,
1336
+ raise: ni,
1337
+ lower: ii,
1338
+ append: ai,
1339
+ insert: si,
1340
+ remove: ui,
1341
+ clone: hi,
1342
+ datum: di,
1343
+ on: xi,
1344
+ dispatch: vi,
1345
+ [Symbol.iterator]: _i
1346
+ };
1347
+ function ct(t) {
1348
+ return typeof t == "string" ? new I([[document.querySelector(t)]], [document.documentElement]) : new I([[t]], Mi);
1349
+ }
1350
+ function Bt(t, e, n) {
1351
+ t.prototype = e.prototype = n, n.constructor = t;
1352
+ }
1353
+ function Xe(t, e) {
1354
+ var n = Object.create(t.prototype);
1355
+ for (var r in e) n[r] = e[r];
1356
+ return n;
1357
+ }
1358
+ function dt() {
1359
+ }
1360
+ var lt = 0.7, Nt = 1 / lt, it = "\\s*([+-]?\\d+)\\s*", ft = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", Y = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", Ni = /^#([0-9a-f]{3,8})$/, Si = new RegExp(`^rgb\\(${it},${it},${it}\\)$`), $i = new RegExp(`^rgb\\(${Y},${Y},${Y}\\)$`), Ai = new RegExp(`^rgba\\(${it},${it},${it},${ft}\\)$`), Ci = new RegExp(`^rgba\\(${Y},${Y},${Y},${ft}\\)$`), Ei = new RegExp(`^hsl\\(${ft},${Y},${Y}\\)$`), Ti = new RegExp(`^hsla\\(${ft},${Y},${Y},${ft}\\)$`), de = {
1361
+ aliceblue: 15792383,
1362
+ antiquewhite: 16444375,
1363
+ aqua: 65535,
1364
+ aquamarine: 8388564,
1365
+ azure: 15794175,
1366
+ beige: 16119260,
1367
+ bisque: 16770244,
1368
+ black: 0,
1369
+ blanchedalmond: 16772045,
1370
+ blue: 255,
1371
+ blueviolet: 9055202,
1372
+ brown: 10824234,
1373
+ burlywood: 14596231,
1374
+ cadetblue: 6266528,
1375
+ chartreuse: 8388352,
1376
+ chocolate: 13789470,
1377
+ coral: 16744272,
1378
+ cornflowerblue: 6591981,
1379
+ cornsilk: 16775388,
1380
+ crimson: 14423100,
1381
+ cyan: 65535,
1382
+ darkblue: 139,
1383
+ darkcyan: 35723,
1384
+ darkgoldenrod: 12092939,
1385
+ darkgray: 11119017,
1386
+ darkgreen: 25600,
1387
+ darkgrey: 11119017,
1388
+ darkkhaki: 12433259,
1389
+ darkmagenta: 9109643,
1390
+ darkolivegreen: 5597999,
1391
+ darkorange: 16747520,
1392
+ darkorchid: 10040012,
1393
+ darkred: 9109504,
1394
+ darksalmon: 15308410,
1395
+ darkseagreen: 9419919,
1396
+ darkslateblue: 4734347,
1397
+ darkslategray: 3100495,
1398
+ darkslategrey: 3100495,
1399
+ darkturquoise: 52945,
1400
+ darkviolet: 9699539,
1401
+ deeppink: 16716947,
1402
+ deepskyblue: 49151,
1403
+ dimgray: 6908265,
1404
+ dimgrey: 6908265,
1405
+ dodgerblue: 2003199,
1406
+ firebrick: 11674146,
1407
+ floralwhite: 16775920,
1408
+ forestgreen: 2263842,
1409
+ fuchsia: 16711935,
1410
+ gainsboro: 14474460,
1411
+ ghostwhite: 16316671,
1412
+ gold: 16766720,
1413
+ goldenrod: 14329120,
1414
+ gray: 8421504,
1415
+ green: 32768,
1416
+ greenyellow: 11403055,
1417
+ grey: 8421504,
1418
+ honeydew: 15794160,
1419
+ hotpink: 16738740,
1420
+ indianred: 13458524,
1421
+ indigo: 4915330,
1422
+ ivory: 16777200,
1423
+ khaki: 15787660,
1424
+ lavender: 15132410,
1425
+ lavenderblush: 16773365,
1426
+ lawngreen: 8190976,
1427
+ lemonchiffon: 16775885,
1428
+ lightblue: 11393254,
1429
+ lightcoral: 15761536,
1430
+ lightcyan: 14745599,
1431
+ lightgoldenrodyellow: 16448210,
1432
+ lightgray: 13882323,
1433
+ lightgreen: 9498256,
1434
+ lightgrey: 13882323,
1435
+ lightpink: 16758465,
1436
+ lightsalmon: 16752762,
1437
+ lightseagreen: 2142890,
1438
+ lightskyblue: 8900346,
1439
+ lightslategray: 7833753,
1440
+ lightslategrey: 7833753,
1441
+ lightsteelblue: 11584734,
1442
+ lightyellow: 16777184,
1443
+ lime: 65280,
1444
+ limegreen: 3329330,
1445
+ linen: 16445670,
1446
+ magenta: 16711935,
1447
+ maroon: 8388608,
1448
+ mediumaquamarine: 6737322,
1449
+ mediumblue: 205,
1450
+ mediumorchid: 12211667,
1451
+ mediumpurple: 9662683,
1452
+ mediumseagreen: 3978097,
1453
+ mediumslateblue: 8087790,
1454
+ mediumspringgreen: 64154,
1455
+ mediumturquoise: 4772300,
1456
+ mediumvioletred: 13047173,
1457
+ midnightblue: 1644912,
1458
+ mintcream: 16121850,
1459
+ mistyrose: 16770273,
1460
+ moccasin: 16770229,
1461
+ navajowhite: 16768685,
1462
+ navy: 128,
1463
+ oldlace: 16643558,
1464
+ olive: 8421376,
1465
+ olivedrab: 7048739,
1466
+ orange: 16753920,
1467
+ orangered: 16729344,
1468
+ orchid: 14315734,
1469
+ palegoldenrod: 15657130,
1470
+ palegreen: 10025880,
1471
+ paleturquoise: 11529966,
1472
+ palevioletred: 14381203,
1473
+ papayawhip: 16773077,
1474
+ peachpuff: 16767673,
1475
+ peru: 13468991,
1476
+ pink: 16761035,
1477
+ plum: 14524637,
1478
+ powderblue: 11591910,
1479
+ purple: 8388736,
1480
+ rebeccapurple: 6697881,
1481
+ red: 16711680,
1482
+ rosybrown: 12357519,
1483
+ royalblue: 4286945,
1484
+ saddlebrown: 9127187,
1485
+ salmon: 16416882,
1486
+ sandybrown: 16032864,
1487
+ seagreen: 3050327,
1488
+ seashell: 16774638,
1489
+ sienna: 10506797,
1490
+ silver: 12632256,
1491
+ skyblue: 8900331,
1492
+ slateblue: 6970061,
1493
+ slategray: 7372944,
1494
+ slategrey: 7372944,
1495
+ snow: 16775930,
1496
+ springgreen: 65407,
1497
+ steelblue: 4620980,
1498
+ tan: 13808780,
1499
+ teal: 32896,
1500
+ thistle: 14204888,
1501
+ tomato: 16737095,
1502
+ turquoise: 4251856,
1503
+ violet: 15631086,
1504
+ wheat: 16113331,
1505
+ white: 16777215,
1506
+ whitesmoke: 16119285,
1507
+ yellow: 16776960,
1508
+ yellowgreen: 10145074
1509
+ };
1510
+ Bt(dt, ht, {
1511
+ copy(t) {
1512
+ return Object.assign(new this.constructor(), this, t);
1513
+ },
1514
+ displayable() {
1515
+ return this.rgb().displayable();
1516
+ },
1517
+ hex: me,
1518
+ // Deprecated! Use color.formatHex.
1519
+ formatHex: me,
1520
+ formatHex8: Fi,
1521
+ formatHsl: Ri,
1522
+ formatRgb: ge,
1523
+ toString: ge
1524
+ });
1525
+ function me() {
1526
+ return this.rgb().formatHex();
1527
+ }
1528
+ function Fi() {
1529
+ return this.rgb().formatHex8();
1530
+ }
1531
+ function Ri() {
1532
+ return Qe(this).formatHsl();
1533
+ }
1534
+ function ge() {
1535
+ return this.rgb().formatRgb();
1536
+ }
1537
+ function ht(t) {
1538
+ var e, n;
1539
+ return t = (t + "").trim().toLowerCase(), (e = Ni.exec(t)) ? (n = e[1].length, e = parseInt(e[1], 16), n === 6 ? pe(e) : n === 3 ? new P(e >> 8 & 15 | e >> 4 & 240, e >> 4 & 15 | e & 240, (e & 15) << 4 | e & 15, 1) : n === 8 ? yt(e >> 24 & 255, e >> 16 & 255, e >> 8 & 255, (e & 255) / 255) : n === 4 ? yt(e >> 12 & 15 | e >> 8 & 240, e >> 8 & 15 | e >> 4 & 240, e >> 4 & 15 | e & 240, ((e & 15) << 4 | e & 15) / 255) : null) : (e = Si.exec(t)) ? new P(e[1], e[2], e[3], 1) : (e = $i.exec(t)) ? new P(e[1] * 255 / 100, e[2] * 255 / 100, e[3] * 255 / 100, 1) : (e = Ai.exec(t)) ? yt(e[1], e[2], e[3], e[4]) : (e = Ci.exec(t)) ? yt(e[1] * 255 / 100, e[2] * 255 / 100, e[3] * 255 / 100, e[4]) : (e = Ei.exec(t)) ? we(e[1], e[2] / 100, e[3] / 100, 1) : (e = Ti.exec(t)) ? we(e[1], e[2] / 100, e[3] / 100, e[4]) : de.hasOwnProperty(t) ? pe(de[t]) : t === "transparent" ? new P(NaN, NaN, NaN, 0) : null;
1540
+ }
1541
+ function pe(t) {
1542
+ return new P(t >> 16 & 255, t >> 8 & 255, t & 255, 1);
1543
+ }
1544
+ function yt(t, e, n, r) {
1545
+ return r <= 0 && (t = e = n = NaN), new P(t, e, n, r);
1546
+ }
1547
+ function Li(t) {
1548
+ return t instanceof dt || (t = ht(t)), t ? (t = t.rgb(), new P(t.r, t.g, t.b, t.opacity)) : new P();
1549
+ }
1550
+ function Ut(t, e, n, r) {
1551
+ return arguments.length === 1 ? Li(t) : new P(t, e, n, r ?? 1);
1552
+ }
1553
+ function P(t, e, n, r) {
1554
+ this.r = +t, this.g = +e, this.b = +n, this.opacity = +r;
1555
+ }
1556
+ Bt(P, Ut, Xe(dt, {
1557
+ brighter(t) {
1558
+ return t = t == null ? Nt : Math.pow(Nt, t), new P(this.r * t, this.g * t, this.b * t, this.opacity);
1559
+ },
1560
+ darker(t) {
1561
+ return t = t == null ? lt : Math.pow(lt, t), new P(this.r * t, this.g * t, this.b * t, this.opacity);
1562
+ },
1563
+ rgb() {
1564
+ return this;
1565
+ },
1566
+ clamp() {
1567
+ return new P(et(this.r), et(this.g), et(this.b), St(this.opacity));
1568
+ },
1569
+ displayable() {
1570
+ return -0.5 <= this.r && this.r < 255.5 && -0.5 <= this.g && this.g < 255.5 && -0.5 <= this.b && this.b < 255.5 && 0 <= this.opacity && this.opacity <= 1;
1571
+ },
1572
+ hex: ye,
1573
+ // Deprecated! Use color.formatHex.
1574
+ formatHex: ye,
1575
+ formatHex8: Di,
1576
+ formatRgb: xe,
1577
+ toString: xe
1578
+ }));
1579
+ function ye() {
1580
+ return `#${tt(this.r)}${tt(this.g)}${tt(this.b)}`;
1581
+ }
1582
+ function Di() {
1583
+ return `#${tt(this.r)}${tt(this.g)}${tt(this.b)}${tt((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
1584
+ }
1585
+ function xe() {
1586
+ const t = St(this.opacity);
1587
+ return `${t === 1 ? "rgb(" : "rgba("}${et(this.r)}, ${et(this.g)}, ${et(this.b)}${t === 1 ? ")" : `, ${t})`}`;
1588
+ }
1589
+ function St(t) {
1590
+ return isNaN(t) ? 1 : Math.max(0, Math.min(1, t));
1591
+ }
1592
+ function et(t) {
1593
+ return Math.max(0, Math.min(255, Math.round(t) || 0));
1594
+ }
1595
+ function tt(t) {
1596
+ return t = et(t), (t < 16 ? "0" : "") + t.toString(16);
1597
+ }
1598
+ function we(t, e, n, r) {
1599
+ return r <= 0 ? t = e = n = NaN : n <= 0 || n >= 1 ? t = e = NaN : e <= 0 && (t = NaN), new W(t, e, n, r);
1600
+ }
1601
+ function Qe(t) {
1602
+ if (t instanceof W) return new W(t.h, t.s, t.l, t.opacity);
1603
+ if (t instanceof dt || (t = ht(t)), !t) return new W();
1604
+ if (t instanceof W) return t;
1605
+ t = t.rgb();
1606
+ var e = t.r / 255, n = t.g / 255, r = t.b / 255, i = Math.min(e, n, r), a = Math.max(e, n, r), o = NaN, s = a - i, c = (a + i) / 2;
1607
+ return s ? (e === a ? o = (n - r) / s + (n < r) * 6 : n === a ? o = (r - e) / s + 2 : o = (e - n) / s + 4, s /= c < 0.5 ? a + i : 2 - a - i, o *= 60) : s = c > 0 && c < 1 ? 0 : o, new W(o, s, c, t.opacity);
1608
+ }
1609
+ function Hi(t, e, n, r) {
1610
+ return arguments.length === 1 ? Qe(t) : new W(t, e, n, r ?? 1);
1611
+ }
1612
+ function W(t, e, n, r) {
1613
+ this.h = +t, this.s = +e, this.l = +n, this.opacity = +r;
1614
+ }
1615
+ Bt(W, Hi, Xe(dt, {
1616
+ brighter(t) {
1617
+ return t = t == null ? Nt : Math.pow(Nt, t), new W(this.h, this.s, this.l * t, this.opacity);
1618
+ },
1619
+ darker(t) {
1620
+ return t = t == null ? lt : Math.pow(lt, t), new W(this.h, this.s, this.l * t, this.opacity);
1621
+ },
1622
+ rgb() {
1623
+ var t = this.h % 360 + (this.h < 0) * 360, e = isNaN(t) || isNaN(this.s) ? 0 : this.s, n = this.l, r = n + (n < 0.5 ? n : 1 - n) * e, i = 2 * n - r;
1624
+ return new P(
1625
+ qt(t >= 240 ? t - 240 : t + 120, i, r),
1626
+ qt(t, i, r),
1627
+ qt(t < 120 ? t + 240 : t - 120, i, r),
1628
+ this.opacity
1629
+ );
1630
+ },
1631
+ clamp() {
1632
+ return new W(be(this.h), xt(this.s), xt(this.l), St(this.opacity));
1633
+ },
1634
+ displayable() {
1635
+ return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1;
1636
+ },
1637
+ formatHsl() {
1638
+ const t = St(this.opacity);
1639
+ return `${t === 1 ? "hsl(" : "hsla("}${be(this.h)}, ${xt(this.s) * 100}%, ${xt(this.l) * 100}%${t === 1 ? ")" : `, ${t})`}`;
1640
+ }
1641
+ }));
1642
+ function be(t) {
1643
+ return t = (t || 0) % 360, t < 0 ? t + 360 : t;
1644
+ }
1645
+ function xt(t) {
1646
+ return Math.max(0, Math.min(1, t || 0));
1647
+ }
1648
+ function qt(t, e, n) {
1649
+ return (t < 60 ? e + (n - e) * t / 60 : t < 180 ? n : t < 240 ? e + (n - e) * (240 - t) / 60 : e) * 255;
1650
+ }
1651
+ const Jt = (t) => () => t;
1652
+ function qi(t, e) {
1653
+ return function(n) {
1654
+ return t + n * e;
1655
+ };
1656
+ }
1657
+ function Oi(t, e, n) {
1658
+ return t = Math.pow(t, n), e = Math.pow(e, n) - t, n = 1 / n, function(r) {
1659
+ return Math.pow(t + r * e, n);
1660
+ };
1661
+ }
1662
+ function Pi(t) {
1663
+ return (t = +t) == 1 ? Ge : function(e, n) {
1664
+ return n - e ? Oi(e, n, t) : Jt(isNaN(e) ? n : e);
1665
+ };
1666
+ }
1667
+ function Ge(t, e) {
1668
+ var n = e - t;
1669
+ return n ? qi(t, n) : Jt(isNaN(t) ? e : t);
1670
+ }
1671
+ const ve = (function t(e) {
1672
+ var n = Pi(e);
1673
+ function r(i, a) {
1674
+ var o = n((i = Ut(i)).r, (a = Ut(a)).r), s = n(i.g, a.g), c = n(i.b, a.b), u = Ge(i.opacity, a.opacity);
1675
+ return function(l) {
1676
+ return i.r = o(l), i.g = s(l), i.b = c(l), i.opacity = u(l), i + "";
1677
+ };
1678
+ }
1679
+ return r.gamma = t, r;
1680
+ })(1);
1681
+ function Vi(t, e) {
1682
+ e || (e = []);
1683
+ var n = t ? Math.min(e.length, t.length) : 0, r = e.slice(), i;
1684
+ return function(a) {
1685
+ for (i = 0; i < n; ++i) r[i] = t[i] * (1 - a) + e[i] * a;
1686
+ return r;
1687
+ };
1688
+ }
1689
+ function zi(t) {
1690
+ return ArrayBuffer.isView(t) && !(t instanceof DataView);
1691
+ }
1692
+ function Ii(t, e) {
1693
+ var n = e ? e.length : 0, r = t ? Math.min(n, t.length) : 0, i = new Array(r), a = new Array(n), o;
1694
+ for (o = 0; o < r; ++o) i[o] = Zt(t[o], e[o]);
1695
+ for (; o < n; ++o) a[o] = e[o];
1696
+ return function(s) {
1697
+ for (o = 0; o < r; ++o) a[o] = i[o](s);
1698
+ return a;
1699
+ };
1700
+ }
1701
+ function Wi(t, e) {
1702
+ var n = /* @__PURE__ */ new Date();
1703
+ return t = +t, e = +e, function(r) {
1704
+ return n.setTime(t * (1 - r) + e * r), n;
1705
+ };
1706
+ }
1707
+ function $t(t, e) {
1708
+ return t = +t, e = +e, function(n) {
1709
+ return t * (1 - n) + e * n;
1710
+ };
1711
+ }
1712
+ function Ui(t, e) {
1713
+ var n = {}, r = {}, i;
1714
+ (t === null || typeof t != "object") && (t = {}), (e === null || typeof e != "object") && (e = {});
1715
+ for (i in e)
1716
+ i in t ? n[i] = Zt(t[i], e[i]) : r[i] = e[i];
1717
+ return function(a) {
1718
+ for (i in n) r[i] = n[i](a);
1719
+ return r;
1720
+ };
1721
+ }
1722
+ var Yt = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, Ot = new RegExp(Yt.source, "g");
1723
+ function Yi(t) {
1724
+ return function() {
1725
+ return t;
1726
+ };
1727
+ }
1728
+ function Xi(t) {
1729
+ return function(e) {
1730
+ return t(e) + "";
1731
+ };
1732
+ }
1733
+ function Qi(t, e) {
1734
+ var n = Yt.lastIndex = Ot.lastIndex = 0, r, i, a, o = -1, s = [], c = [];
1735
+ for (t = t + "", e = e + ""; (r = Yt.exec(t)) && (i = Ot.exec(e)); )
1736
+ (a = i.index) > n && (a = e.slice(n, a), s[o] ? s[o] += a : s[++o] = a), (r = r[0]) === (i = i[0]) ? s[o] ? s[o] += i : s[++o] = i : (s[++o] = null, c.push({ i: o, x: $t(r, i) })), n = Ot.lastIndex;
1737
+ return n < e.length && (a = e.slice(n), s[o] ? s[o] += a : s[++o] = a), s.length < 2 ? c[0] ? Xi(c[0].x) : Yi(e) : (e = c.length, function(u) {
1738
+ for (var l = 0, m; l < e; ++l) s[(m = c[l]).i] = m.x(u);
1739
+ return s.join("");
1740
+ });
1741
+ }
1742
+ function Zt(t, e) {
1743
+ var n = typeof e, r;
1744
+ return e == null || n === "boolean" ? Jt(e) : (n === "number" ? $t : n === "string" ? (r = ht(e)) ? (e = r, ve) : Qi : e instanceof ht ? ve : e instanceof Date ? Wi : zi(e) ? Vi : Array.isArray(e) ? Ii : typeof e.valueOf != "function" && typeof e.toString != "function" || isNaN(e) ? Ui : $t)(t, e);
1745
+ }
1746
+ function Gi(t, e) {
1747
+ return t = +t, e = +e, function(n) {
1748
+ return Math.round(t * (1 - n) + e * n);
1749
+ };
1750
+ }
1751
+ function Bi(t) {
1752
+ return Math.abs(t = Math.round(t)) >= 1e21 ? t.toLocaleString("en").replace(/,/g, "") : t.toString(10);
1753
+ }
1754
+ function At(t, e) {
1755
+ if ((n = (t = e ? t.toExponential(e - 1) : t.toExponential()).indexOf("e")) < 0) return null;
1756
+ var n, r = t.slice(0, n);
1757
+ return [
1758
+ r.length > 1 ? r[0] + r.slice(2) : r,
1759
+ +t.slice(n + 1)
1760
+ ];
1761
+ }
1762
+ function at(t) {
1763
+ return t = At(Math.abs(t)), t ? t[1] : NaN;
1764
+ }
1765
+ function Ji(t, e) {
1766
+ return function(n, r) {
1767
+ for (var i = n.length, a = [], o = 0, s = t[0], c = 0; i > 0 && s > 0 && (c + s + 1 > r && (s = Math.max(1, r - c)), a.push(n.substring(i -= s, i + s)), !((c += s + 1) > r)); )
1768
+ s = t[o = (o + 1) % t.length];
1769
+ return a.reverse().join(e);
1770
+ };
1771
+ }
1772
+ function Zi(t) {
1773
+ return function(e) {
1774
+ return e.replace(/[0-9]/g, function(n) {
1775
+ return t[+n];
1776
+ });
1777
+ };
1778
+ }
1779
+ var Ki = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
1780
+ function Ct(t) {
1781
+ if (!(e = Ki.exec(t))) throw new Error("invalid format: " + t);
1782
+ var e;
1783
+ return new Kt({
1784
+ fill: e[1],
1785
+ align: e[2],
1786
+ sign: e[3],
1787
+ symbol: e[4],
1788
+ zero: e[5],
1789
+ width: e[6],
1790
+ comma: e[7],
1791
+ precision: e[8] && e[8].slice(1),
1792
+ trim: e[9],
1793
+ type: e[10]
1794
+ });
1795
+ }
1796
+ Ct.prototype = Kt.prototype;
1797
+ function Kt(t) {
1798
+ this.fill = t.fill === void 0 ? " " : t.fill + "", this.align = t.align === void 0 ? ">" : t.align + "", this.sign = t.sign === void 0 ? "-" : t.sign + "", this.symbol = t.symbol === void 0 ? "" : t.symbol + "", this.zero = !!t.zero, this.width = t.width === void 0 ? void 0 : +t.width, this.comma = !!t.comma, this.precision = t.precision === void 0 ? void 0 : +t.precision, this.trim = !!t.trim, this.type = t.type === void 0 ? "" : t.type + "";
1799
+ }
1800
+ Kt.prototype.toString = function() {
1801
+ return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
1802
+ };
1803
+ function ji(t) {
1804
+ t: for (var e = t.length, n = 1, r = -1, i; n < e; ++n)
1805
+ switch (t[n]) {
1806
+ case ".":
1807
+ r = i = n;
1808
+ break;
1809
+ case "0":
1810
+ r === 0 && (r = n), i = n;
1811
+ break;
1812
+ default:
1813
+ if (!+t[n]) break t;
1814
+ r > 0 && (r = 0);
1815
+ break;
1816
+ }
1817
+ return r > 0 ? t.slice(0, r) + t.slice(i + 1) : t;
1818
+ }
1819
+ var Be;
1820
+ function ta(t, e) {
1821
+ var n = At(t, e);
1822
+ if (!n) return t + "";
1823
+ var r = n[0], i = n[1], a = i - (Be = Math.max(-8, Math.min(8, Math.floor(i / 3))) * 3) + 1, o = r.length;
1824
+ return a === o ? r : a > o ? r + new Array(a - o + 1).join("0") : a > 0 ? r.slice(0, a) + "." + r.slice(a) : "0." + new Array(1 - a).join("0") + At(t, Math.max(0, e + a - 1))[0];
1825
+ }
1826
+ function _e(t, e) {
1827
+ var n = At(t, e);
1828
+ if (!n) return t + "";
1829
+ var r = n[0], i = n[1];
1830
+ return i < 0 ? "0." + new Array(-i).join("0") + r : r.length > i + 1 ? r.slice(0, i + 1) + "." + r.slice(i + 1) : r + new Array(i - r.length + 2).join("0");
1831
+ }
1832
+ const Me = {
1833
+ "%": (t, e) => (t * 100).toFixed(e),
1834
+ b: (t) => Math.round(t).toString(2),
1835
+ c: (t) => t + "",
1836
+ d: Bi,
1837
+ e: (t, e) => t.toExponential(e),
1838
+ f: (t, e) => t.toFixed(e),
1839
+ g: (t, e) => t.toPrecision(e),
1840
+ o: (t) => Math.round(t).toString(8),
1841
+ p: (t, e) => _e(t * 100, e),
1842
+ r: _e,
1843
+ s: ta,
1844
+ X: (t) => Math.round(t).toString(16).toUpperCase(),
1845
+ x: (t) => Math.round(t).toString(16)
1846
+ };
1847
+ function ke(t) {
1848
+ return t;
1849
+ }
1850
+ var Ne = Array.prototype.map, Se = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
1851
+ function ea(t) {
1852
+ var e = t.grouping === void 0 || t.thousands === void 0 ? ke : Ji(Ne.call(t.grouping, Number), t.thousands + ""), n = t.currency === void 0 ? "" : t.currency[0] + "", r = t.currency === void 0 ? "" : t.currency[1] + "", i = t.decimal === void 0 ? "." : t.decimal + "", a = t.numerals === void 0 ? ke : Zi(Ne.call(t.numerals, String)), o = t.percent === void 0 ? "%" : t.percent + "", s = t.minus === void 0 ? "−" : t.minus + "", c = t.nan === void 0 ? "NaN" : t.nan + "";
1853
+ function u(m) {
1854
+ m = Ct(m);
1855
+ var f = m.fill, d = m.align, M = m.sign, T = m.symbol, S = m.zero, E = m.width, v = m.comma, $ = m.precision, A = m.trim, b = m.type;
1856
+ b === "n" ? (v = !0, b = "g") : Me[b] || ($ === void 0 && ($ = 12), A = !0, b = "g"), (S || f === "0" && d === "=") && (S = !0, f = "0", d = "=");
1857
+ var C = T === "$" ? n : T === "#" && /[boxX]/.test(b) ? "0" + b.toLowerCase() : "", F = T === "$" ? r : /[%p]/.test(b) ? o : "", x = Me[b], h = /[defgprs%]/.test(b);
1858
+ $ = $ === void 0 ? 6 : /[gprs]/.test(b) ? Math.max(1, Math.min(21, $)) : Math.max(0, Math.min(20, $));
1859
+ function _(g) {
1860
+ var w = C, k = F, R, V, ot;
1861
+ if (b === "c")
1862
+ k = x(g) + k, g = "";
1863
+ else {
1864
+ g = +g;
1865
+ var D = g < 0 || 1 / g < 0;
1866
+ if (g = isNaN(g) ? c : x(Math.abs(g), $), A && (g = ji(g)), D && +g == 0 && M !== "+" && (D = !1), w = (D ? M === "(" ? M : s : M === "-" || M === "(" ? "" : M) + w, k = (b === "s" ? Se[8 + Be / 3] : "") + k + (D && M === "(" ? ")" : ""), h) {
1867
+ for (R = -1, V = g.length; ++R < V; )
1868
+ if (ot = g.charCodeAt(R), 48 > ot || ot > 57) {
1869
+ k = (ot === 46 ? i + g.slice(R + 1) : g.slice(R)) + k, g = g.slice(0, R);
1870
+ break;
1871
+ }
1872
+ }
1873
+ }
1874
+ v && !S && (g = e(g, 1 / 0));
1875
+ var J = w.length + g.length + k.length, z = J < E ? new Array(E - J + 1).join(f) : "";
1876
+ switch (v && S && (g = e(z + g, z.length ? E - k.length : 1 / 0), z = ""), d) {
1877
+ case "<":
1878
+ g = w + g + k + z;
1879
+ break;
1880
+ case "=":
1881
+ g = w + z + g + k;
1882
+ break;
1883
+ case "^":
1884
+ g = z.slice(0, J = z.length >> 1) + w + g + k + z.slice(J);
1885
+ break;
1886
+ default:
1887
+ g = z + w + g + k;
1888
+ break;
1889
+ }
1890
+ return a(g);
1891
+ }
1892
+ return _.toString = function() {
1893
+ return m + "";
1894
+ }, _;
1895
+ }
1896
+ function l(m, f) {
1897
+ var d = u((m = Ct(m), m.type = "f", m)), M = Math.max(-8, Math.min(8, Math.floor(at(f) / 3))) * 3, T = Math.pow(10, -M), S = Se[8 + M / 3];
1898
+ return function(E) {
1899
+ return d(T * E) + S;
1900
+ };
1901
+ }
1902
+ return {
1903
+ format: u,
1904
+ formatPrefix: l
1905
+ };
1906
+ }
1907
+ var wt, Je, Ze;
1908
+ na({
1909
+ thousands: ",",
1910
+ grouping: [3],
1911
+ currency: ["$", ""]
1912
+ });
1913
+ function na(t) {
1914
+ return wt = ea(t), Je = wt.format, Ze = wt.formatPrefix, wt;
1915
+ }
1916
+ function ra(t) {
1917
+ return Math.max(0, -at(Math.abs(t)));
1918
+ }
1919
+ function ia(t, e) {
1920
+ return Math.max(0, Math.max(-8, Math.min(8, Math.floor(at(e) / 3))) * 3 - at(Math.abs(t)));
1921
+ }
1922
+ function aa(t, e) {
1923
+ return t = Math.abs(t), e = Math.abs(e) - t, Math.max(0, at(e) - at(t)) + 1;
1924
+ }
1925
+ function Et(t, e) {
1926
+ switch (arguments.length) {
1927
+ case 0:
1928
+ break;
1929
+ case 1:
1930
+ this.range(t);
1931
+ break;
1932
+ default:
1933
+ this.range(e).domain(t);
1934
+ break;
1935
+ }
1936
+ return this;
1937
+ }
1938
+ const $e = /* @__PURE__ */ Symbol("implicit");
1939
+ function oa() {
1940
+ var t = new se(), e = [], n = [], r = $e;
1941
+ function i(a) {
1942
+ let o = t.get(a);
1943
+ if (o === void 0) {
1944
+ if (r !== $e) return r;
1945
+ t.set(a, o = e.push(a) - 1);
1946
+ }
1947
+ return n[o % n.length];
1948
+ }
1949
+ return i.domain = function(a) {
1950
+ if (!arguments.length) return e.slice();
1951
+ e = [], t = new se();
1952
+ for (const o of a)
1953
+ t.has(o) || t.set(o, e.push(o) - 1);
1954
+ return i;
1955
+ }, i.range = function(a) {
1956
+ return arguments.length ? (n = Array.from(a), i) : n.slice();
1957
+ }, i.unknown = function(a) {
1958
+ return arguments.length ? (r = a, i) : r;
1959
+ }, i.copy = function() {
1960
+ return oa(e, n).unknown(r);
1961
+ }, Et.apply(i, arguments), i;
1962
+ }
1963
+ function sa(t) {
1964
+ return function() {
1965
+ return t;
1966
+ };
1967
+ }
1968
+ function ca(t) {
1969
+ return +t;
1970
+ }
1971
+ var Ae = [0, 1];
1972
+ function U(t) {
1973
+ return t;
1974
+ }
1975
+ function Xt(t, e) {
1976
+ return (e -= t = +t) ? function(n) {
1977
+ return (n - t) / e;
1978
+ } : sa(isNaN(e) ? NaN : 0.5);
1979
+ }
1980
+ function ua(t, e) {
1981
+ var n;
1982
+ return t > e && (n = t, t = e, e = n), function(r) {
1983
+ return Math.max(t, Math.min(e, r));
1984
+ };
1985
+ }
1986
+ function la(t, e, n) {
1987
+ var r = t[0], i = t[1], a = e[0], o = e[1];
1988
+ return i < r ? (r = Xt(i, r), a = n(o, a)) : (r = Xt(r, i), a = n(a, o)), function(s) {
1989
+ return a(r(s));
1990
+ };
1991
+ }
1992
+ function fa(t, e, n) {
1993
+ var r = Math.min(t.length, e.length) - 1, i = new Array(r), a = new Array(r), o = -1;
1994
+ for (t[r] < t[0] && (t = t.slice().reverse(), e = e.slice().reverse()); ++o < r; )
1995
+ i[o] = Xt(t[o], t[o + 1]), a[o] = n(e[o], e[o + 1]);
1996
+ return function(s) {
1997
+ var c = Re(t, s, 1, r) - 1;
1998
+ return a[c](i[c](s));
1999
+ };
2000
+ }
2001
+ function Ke(t, e) {
2002
+ return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown());
2003
+ }
2004
+ function je() {
2005
+ var t = Ae, e = Ae, n = Zt, r, i, a, o = U, s, c, u;
2006
+ function l() {
2007
+ var f = Math.min(t.length, e.length);
2008
+ return o !== U && (o = ua(t[0], t[f - 1])), s = f > 2 ? fa : la, c = u = null, m;
2009
+ }
2010
+ function m(f) {
2011
+ return f == null || isNaN(f = +f) ? a : (c || (c = s(t.map(r), e, n)))(r(o(f)));
2012
+ }
2013
+ return m.invert = function(f) {
2014
+ return o(i((u || (u = s(e, t.map(r), $t)))(f)));
2015
+ }, m.domain = function(f) {
2016
+ return arguments.length ? (t = Array.from(f, ca), l()) : t.slice();
2017
+ }, m.range = function(f) {
2018
+ return arguments.length ? (e = Array.from(f), l()) : e.slice();
2019
+ }, m.rangeRound = function(f) {
2020
+ return e = Array.from(f), n = Gi, l();
2021
+ }, m.clamp = function(f) {
2022
+ return arguments.length ? (o = f ? !0 : U, l()) : o !== U;
2023
+ }, m.interpolate = function(f) {
2024
+ return arguments.length ? (n = f, l()) : n;
2025
+ }, m.unknown = function(f) {
2026
+ return arguments.length ? (a = f, m) : a;
2027
+ }, function(f, d) {
2028
+ return r = f, i = d, l();
2029
+ };
2030
+ }
2031
+ function ha() {
2032
+ return je()(U, U);
2033
+ }
2034
+ function da(t, e, n, r) {
2035
+ var i = Hn(t, e, n), a;
2036
+ switch (r = Ct(r ?? ",f"), r.type) {
2037
+ case "s": {
2038
+ var o = Math.max(Math.abs(t), Math.abs(e));
2039
+ return r.precision == null && !isNaN(a = ia(i, o)) && (r.precision = a), Ze(r, o);
2040
+ }
2041
+ case "":
2042
+ case "e":
2043
+ case "g":
2044
+ case "p":
2045
+ case "r": {
2046
+ r.precision == null && !isNaN(a = aa(i, Math.max(Math.abs(t), Math.abs(e)))) && (r.precision = a - (r.type === "e"));
2047
+ break;
2048
+ }
2049
+ case "f":
2050
+ case "%": {
2051
+ r.precision == null && !isNaN(a = ra(i)) && (r.precision = a - (r.type === "%") * 2);
2052
+ break;
2053
+ }
2054
+ }
2055
+ return Je(r);
2056
+ }
2057
+ function jt(t) {
2058
+ var e = t.domain;
2059
+ return t.ticks = function(n) {
2060
+ var r = e();
2061
+ return Dn(r[0], r[r.length - 1], n ?? 10);
2062
+ }, t.tickFormat = function(n, r) {
2063
+ var i = e();
2064
+ return da(i[0], i[i.length - 1], n ?? 10, r);
2065
+ }, t.nice = function(n) {
2066
+ n == null && (n = 10);
2067
+ var r = e(), i = 0, a = r.length - 1, o = r[i], s = r[a], c, u, l = 10;
2068
+ for (s < o && (u = o, o = s, s = u, u = i, i = a, a = u); l-- > 0; ) {
2069
+ if (u = zt(o, s, n), u === c)
2070
+ return r[i] = o, r[a] = s, e(r);
2071
+ if (u > 0)
2072
+ o = Math.floor(o / u) * u, s = Math.ceil(s / u) * u;
2073
+ else if (u < 0)
2074
+ o = Math.ceil(o * u) / u, s = Math.floor(s * u) / u;
2075
+ else
2076
+ break;
2077
+ c = u;
2078
+ }
2079
+ return t;
2080
+ }, t;
2081
+ }
2082
+ function ma() {
2083
+ var t = ha();
2084
+ return t.copy = function() {
2085
+ return Ke(t, ma());
2086
+ }, Et.apply(t, arguments), jt(t);
2087
+ }
2088
+ function Ce(t) {
2089
+ return function(e) {
2090
+ return e < 0 ? -Math.pow(-e, t) : Math.pow(e, t);
2091
+ };
2092
+ }
2093
+ function ga(t) {
2094
+ return t < 0 ? -Math.sqrt(-t) : Math.sqrt(t);
2095
+ }
2096
+ function pa(t) {
2097
+ return t < 0 ? -t * t : t * t;
2098
+ }
2099
+ function ya(t) {
2100
+ var e = t(U, U), n = 1;
2101
+ function r() {
2102
+ return n === 1 ? t(U, U) : n === 0.5 ? t(ga, pa) : t(Ce(n), Ce(1 / n));
2103
+ }
2104
+ return e.exponent = function(i) {
2105
+ return arguments.length ? (n = +i, r()) : n;
2106
+ }, jt(e);
2107
+ }
2108
+ function tn() {
2109
+ var t = ya(je());
2110
+ return t.copy = function() {
2111
+ return Ke(t, tn()).exponent(t.exponent());
2112
+ }, Et.apply(t, arguments), t;
2113
+ }
2114
+ function za() {
2115
+ return tn.apply(null, arguments).exponent(0.5);
2116
+ }
2117
+ function en() {
2118
+ var t = 0, e = 1, n = 1, r = [0.5], i = [0, 1], a;
2119
+ function o(c) {
2120
+ return c != null && c <= c ? i[Re(r, c, 0, n)] : a;
2121
+ }
2122
+ function s() {
2123
+ var c = -1;
2124
+ for (r = new Array(n); ++c < n; ) r[c] = ((c + 1) * e - (c - n) * t) / (n + 1);
2125
+ return o;
2126
+ }
2127
+ return o.domain = function(c) {
2128
+ return arguments.length ? ([t, e] = c, t = +t, e = +e, s()) : [t, e];
2129
+ }, o.range = function(c) {
2130
+ return arguments.length ? (n = (i = Array.from(c)).length - 1, s()) : i.slice();
2131
+ }, o.invertExtent = function(c) {
2132
+ var u = i.indexOf(c);
2133
+ return u < 0 ? [NaN, NaN] : u < 1 ? [t, r[0]] : u >= n ? [r[n - 1], e] : [r[u - 1], r[u]];
2134
+ }, o.unknown = function(c) {
2135
+ return arguments.length && (a = c), o;
2136
+ }, o.thresholds = function() {
2137
+ return r.slice();
2138
+ }, o.copy = function() {
2139
+ return en().domain([t, e]).range(i).unknown(a);
2140
+ }, Et.apply(jt(o), arguments);
2141
+ }
2142
+ function xa({
2143
+ data: t,
2144
+ chartConfig: e,
2145
+ displayConfig: n = {},
2146
+ queryObject: r,
2147
+ height: i = "100%",
2148
+ colorPalette: a
2149
+ }) {
2150
+ const o = oe(null), s = oe(null), [c, u] = B({ width: 0, height: 0 }), [l, m] = B(!1), [f, d] = B("light"), { getFieldLabel: M } = bn();
2151
+ bt(() => (d(_t()), kn((h) => {
2152
+ d(h);
2153
+ })), []);
2154
+ const T = {
2155
+ showTooltip: n?.showTooltip ?? !0,
2156
+ showLabels: n?.showLabels ?? !0,
2157
+ fitToWidth: n?.fitToWidth ?? !1
2158
+ };
2159
+ hn(() => {
2160
+ let x = 0;
2161
+ const h = 10;
2162
+ let _, g;
2163
+ const w = () => {
2164
+ if (s.current) {
2165
+ const { width: R, height: V } = s.current.getBoundingClientRect();
2166
+ if (R > 0 && V > 0)
2167
+ return u({ width: R, height: V }), m(!0), !0;
2168
+ }
2169
+ return !1;
2170
+ };
2171
+ if (!w() && x < h) {
2172
+ const R = () => {
2173
+ !w() && x < h && (x++, g = setTimeout(() => {
2174
+ _ = requestAnimationFrame(R);
2175
+ }, 50 * x));
2176
+ };
2177
+ _ = requestAnimationFrame(R);
2178
+ }
2179
+ return () => {
2180
+ _ && cancelAnimationFrame(_), g && clearTimeout(g);
2181
+ };
2182
+ }, []), bt(() => {
2183
+ let x = null;
2184
+ const h = () => {
2185
+ if (s.current) {
2186
+ const { width: _, height: g } = s.current.getBoundingClientRect();
2187
+ _ > 0 && g > 0 && (u({ width: _, height: g }), l || m(!0));
2188
+ }
2189
+ };
2190
+ return s.current && (x = new ResizeObserver(() => h()), x.observe(s.current), h()), window.addEventListener("resize", h), () => {
2191
+ x && x.disconnect(), window.removeEventListener("resize", h);
2192
+ };
2193
+ }, [l]);
2194
+ const S = (x) => Math.floor(x.getMonth() / 3) + 1, E = (x) => x.getMonth() % 3 + 1, v = (x) => {
2195
+ const h = x.getDate();
2196
+ return Math.floor((h - 1) / 7) + 1;
2197
+ }, $ = (x) => {
2198
+ switch (x?.toLowerCase()) {
2199
+ case "year":
2200
+ return null;
2201
+ case "quarter":
2202
+ return {
2203
+ extractX: (h) => h.getFullYear(),
2204
+ extractY: (h) => S(h) - 1,
2205
+ // 0-3 for indexing
2206
+ xLabels: [],
2207
+ // Will be determined from data
2208
+ yLabels: ["Q1", "Q2", "Q3", "Q4"],
2209
+ xFormat: (h) => `'${h.toString().slice(-2)}`,
2210
+ // '24 instead of 2024
2211
+ yFormat: (h) => ["Q1", "Q2", "Q3", "Q4"][h] || "",
2212
+ cellWidth: 16,
2213
+ cellHeight: 16
2214
+ };
2215
+ case "month":
2216
+ return {
2217
+ extractX: (h) => {
2218
+ const _ = h.getFullYear(), g = S(h);
2219
+ return _ * 10 + g;
2220
+ },
2221
+ extractY: (h) => E(h) - 1,
2222
+ // 0-2 for indexing
2223
+ xLabels: [],
2224
+ // Will be determined from data
2225
+ yLabels: ["Month 1", "Month 2", "Month 3"],
2226
+ xFormat: (h) => `Q${h % 10}`,
2227
+ yFormat: (h) => ["Month 1", "Month 2", "Month 3"][h] || "",
2228
+ cellWidth: 16,
2229
+ cellHeight: 16,
2230
+ hasHierarchicalLabels: !0,
2231
+ // Flag to indicate we need special handling
2232
+ getYearFromX: (h) => Math.floor(h / 10)
2233
+ // Helper to get year for grouping
2234
+ };
2235
+ case "week":
2236
+ return {
2237
+ extractX: (h) => {
2238
+ const _ = h.getFullYear(), g = h.getMonth() + 1;
2239
+ return _ * 100 + g;
2240
+ },
2241
+ extractY: (h) => v(h) - 1,
2242
+ // 0-5 for indexing
2243
+ xLabels: [],
2244
+ // Will be determined from data
2245
+ yLabels: ["Week 1", "Week 2", "Week 3", "Week 4", "Week 5"],
2246
+ xFormat: (h) => {
2247
+ const _ = h % 100;
2248
+ return ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"][_ - 1] || "";
2249
+ },
2250
+ yFormat: (h) => ["Week 1", "Week 2", "Week 3", "Week 4", "Week 5"][h] || "",
2251
+ cellWidth: 16,
2252
+ cellHeight: 16,
2253
+ hasHierarchicalLabels: !0,
2254
+ // Add hierarchical labels like month view
2255
+ getYearFromX: (h) => Math.floor(h / 100)
2256
+ // Helper to get year for grouping
2257
+ };
2258
+ case "day":
2259
+ return {
2260
+ extractX: (h) => {
2261
+ const { year: _, week: g } = A(h);
2262
+ return _ * 100 + g;
2263
+ },
2264
+ extractY: (h) => h.getDay(),
2265
+ // 0-6 (Sun-Sat)
2266
+ xLabels: [],
2267
+ // Will be determined from data
2268
+ yLabels: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
2269
+ xFormat: (h) => `${h % 100}`,
2270
+ yFormat: (h) => ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"][h] || "",
2271
+ cellWidth: 16,
2272
+ cellHeight: 16,
2273
+ hasHierarchicalLabels: !0,
2274
+ // Add hierarchical labels
2275
+ getYearFromX: (h) => Math.floor(h / 100)
2276
+ // Helper to get year for grouping
2277
+ };
2278
+ case "hour":
2279
+ return {
2280
+ extractX: (h) => {
2281
+ const _ = h.getFullYear(), g = h.getMonth() + 1, w = h.getDate();
2282
+ return _ * 1e4 + g * 100 + w;
2283
+ },
2284
+ extractY: (h) => Math.floor(h.getHours() / 3),
2285
+ // 0-7 for 8 three-hour blocks
2286
+ xLabels: [],
2287
+ // Will be determined from data
2288
+ yLabels: ["00-03", "03-06", "06-09", "09-12", "12-15", "15-18", "18-21", "21-00"],
2289
+ xFormat: (h) => `${h % 100}`,
2290
+ yFormat: (h) => ["00-03", "03-06", "06-09", "09-12", "12-15", "15-18", "18-21", "21-00"][h] || "",
2291
+ cellWidth: 16,
2292
+ cellHeight: 16,
2293
+ hasHierarchicalLabels: !0,
2294
+ // Show year/month grouping above
2295
+ getYearFromX: (h) => Math.floor(h / 100)
2296
+ // Extract YYYYMM for month grouping
2297
+ };
2298
+ default:
2299
+ return null;
2300
+ }
2301
+ }, A = (x) => {
2302
+ const h = new Date(Date.UTC(x.getFullYear(), x.getMonth(), x.getDate())), _ = h.getUTCDay() || 7;
2303
+ h.setUTCDate(h.getUTCDate() + 4 - _);
2304
+ const g = h.getUTCFullYear(), w = new Date(Date.UTC(g, 0, 1)), k = Math.ceil(((h.getTime() - w.getTime()) / 864e5 + 1) / 7);
2305
+ return { year: g, week: k };
2306
+ };
2307
+ if (bt(() => {
2308
+ if (!t || t.length === 0 || !o.current || !l || c.width === 0 || (ct(o.current).selectAll("*").remove(), !e?.dateField || !e?.valueField))
2309
+ return;
2310
+ const x = Array.isArray(e.dateField) ? e.dateField[0] : e.dateField, h = Array.isArray(e.valueField) ? e.valueField[0] : e.valueField;
2311
+ if (!x || !h)
2312
+ return;
2313
+ const g = (() => {
2314
+ if (!r?.timeDimensions || r.timeDimensions.length === 0)
2315
+ return "day";
2316
+ const p = r.timeDimensions.find(
2317
+ (N) => N.dimension === x || N.dimension.includes(x)
2318
+ );
2319
+ if (p && p.granularity)
2320
+ return p.granularity;
2321
+ const y = r.timeDimensions[0];
2322
+ return y && y.granularity ? y.granularity : "day";
2323
+ })(), w = $(g);
2324
+ if (!w)
2325
+ return;
2326
+ const k = t.map((p) => {
2327
+ const y = p[x], N = typeof p[h] == "string" ? parseFloat(p[h]) : p[h] || 0;
2328
+ let L;
2329
+ if (typeof y == "string") {
2330
+ let q = y;
2331
+ y.includes(" ") && (q = y.replace(" ", "T").replace("+00", "Z").replace(/\+\d{2}:\d{2}$/, "Z")), !q.endsWith("Z") && !q.includes("+") && (q = q + "Z"), L = new Date(q);
2332
+ } else
2333
+ L = new Date(y);
2334
+ if (isNaN(L.getTime()))
2335
+ return null;
2336
+ const Q = w.extractX(L), G = w.extractY(L);
2337
+ return {
2338
+ x: Q,
2339
+ y: G,
2340
+ value: N,
2341
+ date: L,
2342
+ label: Qt(y, g)
2343
+ };
2344
+ }).filter((p) => p !== null);
2345
+ if (k.length === 0) return;
2346
+ const R = ue(k, (p) => p.y) || 0, V = le(k, (p) => p.y) || 0, D = (() => {
2347
+ const p = [...new Set(k.map((y) => y.x))].sort();
2348
+ return p;
2349
+ })(), J = D.length * w.cellWidth + (D.length - 1) * 4, z = (R - V + 1) * w.cellHeight + (R - V) * 4, X = {
2350
+ left: 60,
2351
+ // Space for Y-axis labels
2352
+ bottom: 10,
2353
+ // Reduced since labels are at top
2354
+ top: w.hasHierarchicalLabels ? 40 : 25,
2355
+ // Extra space for hierarchical labels
2356
+ right: 10
2357
+ }, Tt = c.width - X.left - X.right, te = c.height - X.top - X.bottom;
2358
+ let H, nt;
2359
+ if (T.fitToWidth) {
2360
+ const p = Tt / J, y = te / z, N = Math.min(p, y);
2361
+ H = w.cellWidth * N, nt = w.cellHeight * N;
2362
+ } else {
2363
+ const y = { width: 16, height: 16 }, N = 24, L = Tt / J, Q = te / z, G = Math.min(L, Q);
2364
+ H = Math.max(y.width, Math.min(N, w.cellWidth * G)), nt = Math.max(y.height, Math.min(N, w.cellHeight * G)), g === "week" && H < y.width && (H = y.width);
2365
+ }
2366
+ const ee = D.length * H + (D.length - 1) * 4, nn = ee > Tt ? ee + X.left + X.right : c.width, rt = ct(o.current).attr("width", nn).attr("height", c.height).append("g").attr("transform", `translate(${X.left},${X.top})`), ne = k.map((p) => p.value), rn = le(ne) || 0, an = ue(ne) || 1, on = en().domain([rn, an]).range(a?.gradient || _n), re = /* @__PURE__ */ new Map();
2367
+ k.forEach((p) => {
2368
+ const y = `${p.x}-${p.y}`;
2369
+ re.set(y, p);
2370
+ });
2371
+ const Z = (p, y) => getComputedStyle(document.documentElement).getPropertyValue(p).trim() || y, Ft = f !== "light", mt = Ft ? Z("--dc-text-muted", "#cbd5e1") : Z("--dc-text-secondary", "#374151"), sn = Z("--dc-border", "#e5e7eb"), cn = Ft ? Z("--dc-bg-secondary", "#1e293b") : Z("--dc-bg-secondary", "#f3f4f6"), ie = Ft ? Z("--dc-border", "#334155") : Z("--dc-bg", "#ffffff"), gt = ct("body").append("div").attr("class", "activity-grid-tooltip").style("position", "absolute").style("padding", "8px").style("background", "rgba(0, 0, 0, 0.8)").style("color", "white").style("border-radius", "4px").style("font-size", "12px").style("pointer-events", "none").style("opacity", 0).style("z-index", 1e3), st = /* @__PURE__ */ new Map();
2372
+ D.forEach((p, y) => {
2373
+ st.set(p, y);
2374
+ });
2375
+ for (const p of D)
2376
+ for (let y = V; y <= R; y++) {
2377
+ const N = `${p}-${y}`, L = re.get(N), Q = st.get(p) || 0, G = rt.append("rect").attr("x", Q * (H + 4)).attr("y", (y - V) * (nt + 4)).attr("width", H).attr("height", nt).attr("rx", 2).attr("ry", 2).style("fill", L ? on(L.value) : cn).style("stroke", ie).style("stroke-width", 1);
2378
+ T.showTooltip && G.style("cursor", "pointer").on("mouseover", function(q) {
2379
+ if (ct(this).style("stroke", "#000").style("stroke-width", 2), L) {
2380
+ const K = [
2381
+ `<strong>${L.label}</strong>`,
2382
+ `${M(h)}: ${L.value}`
2383
+ ].join("<br>");
2384
+ gt.html(K).style("left", q.pageX + 10 + "px").style("top", q.pageY - 10 + "px").transition().duration(200).style("opacity", 1);
2385
+ }
2386
+ }).on("mousemove", function(q) {
2387
+ gt.style("left", q.pageX + 10 + "px").style("top", q.pageY - 10 + "px");
2388
+ }).on("mouseout", function() {
2389
+ ct(this).style("stroke", ie).style("stroke-width", 1), gt.transition().duration(200).style("opacity", 0);
2390
+ });
2391
+ }
2392
+ if (T.showLabels) {
2393
+ if (w.hasHierarchicalLabels && w.getYearFromX) {
2394
+ const p = /* @__PURE__ */ new Map();
2395
+ for (const y of D) {
2396
+ const N = w.getYearFromX(y);
2397
+ p.has(N) || p.set(N, []), p.get(N).push(y);
2398
+ }
2399
+ for (const y of D) {
2400
+ const N = st.get(y) || 0;
2401
+ rt.append("text").attr("x", N * (H + 4) + H / 2).attr("y", -8).attr("text-anchor", "middle").style("font-size", "10px").style("fill", mt).text(w.xFormat(y));
2402
+ }
2403
+ for (const [y, N] of p)
2404
+ if (N.length > 0) {
2405
+ const L = Math.min(...N.map((K) => st.get(K) || 0)), Q = Math.max(...N.map((K) => st.get(K) || 0)), G = (L + Q) / 2;
2406
+ let q = "";
2407
+ if (y > 9999) {
2408
+ const K = Math.floor(y / 100), un = y % 100;
2409
+ q = `${["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"][un - 1]} '${K.toString().slice(-2)}`;
2410
+ } else
2411
+ q = `'${y.toString().slice(-2)}`;
2412
+ rt.append("text").attr("x", G * (H + 4) + H / 2).attr("y", -25).attr("text-anchor", "middle").style("font-size", "12px").style("font-weight", "bold").style("fill", mt).text(q), N.length > 1 && rt.append("line").attr("x1", L * (H + 4)).attr("x2", Q * (H + 4) + H).attr("y1", -20).attr("y2", -20).style("stroke", sn).style("stroke-width", 1).style("opacity", 0.3);
2413
+ }
2414
+ } else {
2415
+ const p = Math.max(1, Math.floor(D.length / 10));
2416
+ for (let y = 0; y < D.length; y += p) {
2417
+ const N = D[y];
2418
+ rt.append("text").attr("x", y * (H + 4) + H / 2).attr("y", -8).attr("text-anchor", "middle").style("font-size", "10px").style("fill", mt).text(w.xFormat(N));
2419
+ }
2420
+ }
2421
+ for (let p = V; p <= R; p++)
2422
+ rt.append("text").attr("x", -8).attr("y", (p - V) * (nt + 4) + nt / 2).attr("text-anchor", "end").attr("dy", ".35em").style("font-size", "10px").style("fill", mt).text(w.yFormat(p));
2423
+ }
2424
+ return () => {
2425
+ gt.remove();
2426
+ };
2427
+ }, [t, e, n, r, c, l, T.showTooltip, T.showLabels, a, f]), !t || t.length === 0)
2428
+ return /* @__PURE__ */ O(
2429
+ "div",
2430
+ {
2431
+ className: "flex items-center justify-center w-full",
2432
+ style: { height: i },
2433
+ children: /* @__PURE__ */ pt("div", { className: "text-center text-dc-text-muted", children: [
2434
+ /* @__PURE__ */ O("div", { className: "text-sm font-semibold mb-1", children: "No data available" }),
2435
+ /* @__PURE__ */ O("div", { className: "text-xs text-dc-text-secondary", children: "No data points to display in activity grid" })
2436
+ ] })
2437
+ }
2438
+ );
2439
+ if (!(e?.dateField && e?.valueField))
2440
+ return /* @__PURE__ */ O(
2441
+ "div",
2442
+ {
2443
+ className: "flex items-center justify-center w-full",
2444
+ style: { height: i },
2445
+ children: /* @__PURE__ */ pt("div", { className: "text-center text-dc-text-muted", children: [
2446
+ /* @__PURE__ */ O("div", { className: "text-sm font-semibold mb-1", children: "Configuration Required" }),
2447
+ /* @__PURE__ */ O("div", { className: "text-xs text-dc-text-secondary", children: "Activity grid requires a time dimension and a measure" })
2448
+ ] })
2449
+ }
2450
+ );
2451
+ const C = Array.isArray(e.dateField) ? e.dateField[0] : e.dateField;
2452
+ return (r?.timeDimensions?.find(
2453
+ (x) => x.dimension === C || x.dimension.includes(C)
2454
+ )?.granularity || "day")?.toLowerCase() === "year" ? /* @__PURE__ */ O(
2455
+ "div",
2456
+ {
2457
+ className: "flex items-center justify-center w-full",
2458
+ style: { height: i },
2459
+ children: /* @__PURE__ */ pt("div", { className: "text-center text-dc-text-muted", children: [
2460
+ /* @__PURE__ */ O("div", { className: "text-sm font-semibold mb-1", children: "Granularity Too High" }),
2461
+ /* @__PURE__ */ O("div", { className: "text-xs text-dc-text-secondary", children: "Activity grids work best with hour, day, week, month, or quarter granularity" }),
2462
+ /* @__PURE__ */ O("div", { className: "text-xs text-dc-text-secondary mt-1", children: "Please choose a lower granularity for your time dimension" })
2463
+ ] })
2464
+ }
2465
+ ) : /* @__PURE__ */ O("div", { className: "w-full flex flex-col relative", style: { height: i, minHeight: "250px", overflow: "hidden", width: "100%" }, children: /* @__PURE__ */ pt("div", { ref: s, className: "w-full h-full relative overflow-x-auto", style: { width: "100%" }, children: [
2466
+ /* @__PURE__ */ O("svg", { ref: o, className: "h-full" }),
2467
+ !l && /* @__PURE__ */ O("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ O("div", { className: "text-dc-text-muted text-sm", children: "Measuring chart dimensions..." }) })
2468
+ ] }) });
2469
+ }
2470
+ const Ia = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2471
+ __proto__: null,
2472
+ default: xa
2473
+ }, Symbol.toStringTag, { value: "Module" }));
2474
+ export {
2475
+ Da as A,
2476
+ Ha as B,
2477
+ Ta as C,
2478
+ xn as D,
2479
+ Ia as E,
2480
+ Ea as N,
2481
+ Ca as P,
2482
+ qa as T,
2483
+ Aa as a,
2484
+ Te as b,
2485
+ Qt as c,
2486
+ za as d,
2487
+ Oa as e,
2488
+ Sa as f,
2489
+ _t as g,
2490
+ _n as h,
2491
+ Na as i,
2492
+ Pa as j,
2493
+ Va as k,
2494
+ ma as l,
2495
+ ue as m,
2496
+ ka as n,
2497
+ oa as o,
2498
+ Pt as p,
2499
+ en as q,
2500
+ mn as r,
2501
+ ct as s,
2502
+ $a as t,
2503
+ bn as u,
2504
+ Fa as v,
2505
+ kn as w,
2506
+ Mn as x,
2507
+ Ra as y,
2508
+ La as z
2509
+ };
2510
+ //# sourceMappingURL=chart-activitygridchart-BzL97Vnm.js.map