@iota-uz/sdk 0.15.0 → 0.17.0

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 (55) hide show
  1. package/dist/client-host/identity.d.ts +4 -4
  2. package/dist/client-host/identity.js +2 -2
  3. package/dist/lens/{CascadePanel-jtC2EUUS.js → CascadePanel-Sd2OKQx-.js} +15 -15
  4. package/dist/lens/{ChartDataEquivalent-BFDdHoQn.js → ChartDataEquivalent-DgCAb4Ov.js} +14 -13
  5. package/dist/lens/ChartPanel-CiAahY9O.js +709 -0
  6. package/dist/lens/{CoveragePanel-5LWQwFMZ.js → CoveragePanel-DeeKg8gF.js} +10 -10
  7. package/dist/lens/{GaugePanel-eVYvp3Hk.js → GaugePanel-8rsf_XHS.js} +8 -8
  8. package/dist/lens/{MapPanel-CzpZKz1Y.js → MapPanel-Bq0mfVCB.js} +14 -14
  9. package/dist/lens/{MetricFlowPanel-CG2Bj7s6.js → MetricFlowPanel-ZBJqPFpc.js} +2 -2
  10. package/dist/lens/{MetricHierarchyPanel-Difdcafn.js → MetricHierarchyPanel-DStGwvVU.js} +2 -2
  11. package/dist/lens/{MetricRelationshipPanel-Cq1dFTeY.js → MetricRelationshipPanel-D6ItmGCS.js} +2 -2
  12. package/dist/lens/{PrintReport-BiUdo8XG.js → PrintReport-Dr-6xXVr.js} +413 -397
  13. package/dist/lens/{TablePanel-_6j7epQg.js → TablePanel-CzLP8gG0.js} +1 -1
  14. package/dist/lens/{adapter-DRShqW45.js → adapter-BwEwcw2W.js} +4960 -4956
  15. package/dist/lens/adapter-CgoRd_uP.js +6 -0
  16. package/dist/lens/charts/adapter.d.ts +1 -0
  17. package/dist/lens/charts/adapter.d.ts.map +1 -1
  18. package/dist/lens/charts/echarts/options.d.ts.map +1 -1
  19. package/dist/lens/charts/keys.d.ts +2 -0
  20. package/dist/lens/charts/keys.d.ts.map +1 -1
  21. package/dist/lens/contract/schemas.d.ts.map +1 -1
  22. package/dist/lens/contract/types.d.ts +1 -0
  23. package/dist/lens/contract/types.d.ts.map +1 -1
  24. package/dist/lens/{index-CmXDbBaF.js → index-B6anZ5Pr.js} +1 -1
  25. package/dist/lens/{index-BBtBPnTb.js → index-R9mnOHaj.js} +684 -667
  26. package/dist/lens/index.js +1 -1
  27. package/dist/lens/{install-ByIx15ES.js → install-CsNOaFxV.js} +1 -1
  28. package/dist/lens/{install-DKwCLbtk.js → install-CumkiUJn.js} +1 -1
  29. package/dist/lens/{install-ByEamXef.js → install-D5OiGDnd.js} +1 -1
  30. package/dist/lens/{install-DIbrzh5h.js → install-VEXJv-Wi.js} +1 -1
  31. package/dist/lens/keys-6_gqLhcv.js +78 -0
  32. package/dist/lens/{metricViews-IoSavtwn.js → metricViews-De-9pff-.js} +1 -1
  33. package/dist/lens/panels/ChartPanel.d.ts.map +1 -1
  34. package/dist/lens/panels/data.d.ts +2 -0
  35. package/dist/lens/panels/data.d.ts.map +1 -1
  36. package/dist/lens/{prefetch-CrMQhAEy.js → prefetch-C_qYKOTU.js} +2 -2
  37. package/dist/lens/{prefetchPanels-BbWAAYrz.js → prefetchPanels-CD4C-A5q.js} +1 -1
  38. package/dist/lens/print/PrintReport.d.ts.map +1 -1
  39. package/dist/lens/{print-CLo-mTEP.js → print-Iu804kRb.js} +18 -18
  40. package/dist/lens/{scales-CChHRiVq.js → scales-CWTA0tSQ.js} +53 -53
  41. package/dist/sdk-identity.cjs +3 -3
  42. package/dist/sdk-identity.js +3 -3
  43. package/dist/sdk-identity.json +2 -2
  44. package/dist/testing/driver.d.ts +19 -0
  45. package/dist/testing/driver.js +103 -30
  46. package/dist/testing/fixtures.d.ts +27 -0
  47. package/dist/testing/fixtures.js +19 -4
  48. package/dist/testing/index.d.ts +3 -2
  49. package/dist/testing/index.js +6 -30
  50. package/dist/testing/lease.d.ts +11 -0
  51. package/dist/testing/lease.js +44 -0
  52. package/package.json +1 -1
  53. package/dist/lens/ChartHost-DTnhnwkn.js +0 -68
  54. package/dist/lens/ChartPanel-_S4IVYdJ.js +0 -730
  55. package/dist/lens/keys-DenV5HsJ.js +0 -12
@@ -1,730 +0,0 @@
1
- import { jsxs as R, jsx as l, Fragment as Ee } from "react/jsx-runtime";
2
- import { useState as ae, useRef as Pe, useCallback as Ae, useEffect as xe, useMemo as T, memo as bt, useLayoutEffect as kt, Fragment as Rt } from "react";
3
- import { r as Kt, f as Tt } from "./keys-DenV5HsJ.js";
4
- import { s as Ft, o as ze, c as Et, a as Mt, b as Bt, d as Ht, f as _t } from "./scales-CChHRiVq.js";
5
- import { o as zt, u as Re, a as pt, t as Ot, x as ut, y as mt, l as $t, z as Ut, A as Vt, B as Dt, C as Pt, k as qt, D as jt, E as Wt, F as ht, h as xt, s as St, G as It, H as Qt, I as Zt, g as Gt, J as Jt, K as Yt, P as Xt, W as eo, L as H, M as ft, N as to, O as Oe, Q as oo, R as no, S as ro, T as so } from "./index-BBtBPnTb.js";
6
- import "@iota-uz/sdk/client-host";
7
- import { c as io, C as ao } from "./ChartDataEquivalent-BFDdHoQn.js";
8
- import { C as co } from "./ChartHost-DTnhnwkn.js";
9
- const lo = 0.02, go = so, uo = 4;
10
- function mo(e) {
11
- const n = H(), t = H(e.encoding.label ? e.format[e.encoding.label] : void 0), r = H(e.encoding.value ? e.format[e.encoding.value] : void 0), c = H(e.encoding.previous ? e.format[e.encoding.previous] : void 0), a = H(e.encoding.lower ? e.format[e.encoding.lower] : void 0), m = H(e.encoding.q1 ? e.format[e.encoding.q1] : void 0), y = H(e.encoding.median ? e.format[e.encoding.median] : void 0), f = H(e.encoding.q3 ? e.format[e.encoding.q3] : void 0), b = H(e.encoding.upper ? e.format[e.encoding.upper] : void 0), v = H(e.encoding.id ? e.format[e.encoding.id] : void 0), F = H(e.encoding.series ? e.format[e.encoding.series] : void 0), h = H(e.encoding.category ? e.format[e.encoding.category] : void 0), u = H(e.encoding.cut ? e.format[e.encoding.cut] : void 0), N = H(e.encoding.cutLabel ? e.format[e.encoding.cutLabel] : void 0), ce = H(e.encoding.final ? e.format[e.encoding.final] : void 0), V = ft(e.encoding.value ? e.format[e.encoding.value] : void 0), te = ft(e.encoding.median ? e.format[e.encoding.median] : void 0), _ = T(() => {
12
- const B = { label: t, value: r, previous: c, lower: a, q1: m, median: y, q3: f, upper: b, id: v, series: F, category: h, cut: u, cutLabel: N, final: ce }, A = /* @__PURE__ */ new Map();
13
- for (const C of to) {
14
- const oe = e.encoding[C], K = B[C];
15
- oe && K && A.set(oe, K);
16
- }
17
- return (C, oe) => (A.get(C) ?? n)(oe);
18
- }, [h, u, N, n, ce, v, t, a, y, e.encoding, c, m, f, F, b, r]), se = T(() => {
19
- const B = e.encoding.value, A = e.encoding.median;
20
- return (C, oe) => B && C === B ? V(oe) : A && C === A ? te(oe) : _(C, oe);
21
- }, [te, _, e.encoding.median, e.encoding.value, V]);
22
- return T(() => ({ format: _, formatAxis: se }), [_, se]);
23
- }
24
- function $e(e, n, t) {
25
- var y, f;
26
- const r = n.encoding.id ? e.columns.findIndex((b) => b.name === n.encoding.id) : -1, c = [n.encoding.category, n.encoding.label].find((b) => !!b && e.columns.some((v) => v.name === b)), a = e.columns.findIndex((b) => b.name === c), m = r >= 0 ? (y = e.rows[t]) == null ? void 0 : y[r] : (f = e.rows[t]) == null ? void 0 : f[a];
27
- return String(typeof m == "string" || typeof m == "number" || typeof m == "bigint" ? m : t);
28
- }
29
- function vt(e, n, t) {
30
- var y;
31
- if (((y = n.radial) == null ? void 0 : y.mode) === "partition" && n.encoding.series) {
32
- const f = e.columns.findIndex((b) => b.name === n.encoding.series);
33
- if (f >= 0) {
34
- const b = e.rows.findIndex((v, F) => {
35
- const h = v[f], u = typeof h == "string" || typeof h == "number" || typeof h == "bigint" ? String(h) : "";
36
- return Kt(u, $e(e, n, F)) === t;
37
- });
38
- if (b >= 0) return b;
39
- }
40
- }
41
- const r = e.rows.findIndex((f, b) => $e(e, n, b) === t);
42
- if (r >= 0) return r;
43
- const c = n.encoding.category ?? n.encoding.label, a = e.columns.findIndex((f) => f.name === c), m = e.columns.findIndex((f) => f.name === n.encoding.series);
44
- return a < 0 ? -1 : e.rows.findIndex((f) => Tt(
45
- ke(f[a]),
46
- m >= 0 ? ke(f[m]) : ""
47
- ) === t);
48
- }
49
- function Nt(e, n) {
50
- return n.semantics !== "series" || !n.encoding.series ? -1 : e.columns.findIndex((t) => t.name === n.encoding.series);
51
- }
52
- function ho(e, n) {
53
- const t = /* @__PURE__ */ new Map();
54
- if (!e) return t;
55
- const r = e.columns.findIndex((c) => c.name === n.encoding.series);
56
- if (r < 0) return t;
57
- for (const c of e.rows) {
58
- const a = c[r];
59
- if (typeof a != "string" && typeof a != "number" && typeof a != "bigint") continue;
60
- const m = String(a);
61
- t.has(m) || t.set(m, t.size);
62
- }
63
- return t;
64
- }
65
- function fo(e, n, t) {
66
- var a;
67
- const r = Nt(e, n);
68
- if (r < 0) return $e(e, n, t);
69
- const c = (a = e.rows[t]) == null ? void 0 : a[r];
70
- return String(typeof c == "string" || typeof c == "number" || typeof c == "bigint" ? c : t);
71
- }
72
- function he(e) {
73
- if (typeof e == "number" && Number.isFinite(e)) return e;
74
- if (typeof e == "string" && e.trim() !== "") {
75
- const n = Number(e);
76
- if (Number.isFinite(n)) return n;
77
- }
78
- }
79
- function ke(e) {
80
- return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" ? String(e) : "";
81
- }
82
- function vo(e, n) {
83
- const c = (n.kind === "pie" || n.kind === "donut" || n.kind === "radial" ? [n.encoding.label, n.encoding.category] : [n.encoding.category, n.encoding.label]).reduce((a, m) => a >= 0 || !m ? a : e.columns.findIndex((y) => y.name === m), -1);
84
- return c < 0 ? 0 : new Set(e.rows.map((a) => a[c]).filter((a) => a != null).map(String)).size;
85
- }
86
- function wo(e, n) {
87
- const t = e.columns.findIndex((r) => r.name === n.encoding.series);
88
- return t < 0 ? 1 : new Set(e.rows.map((r) => r[t]).filter((r) => r != null).map(String)).size;
89
- }
90
- const Ct = "__lens_other__", yo = "__lens_topn_group";
91
- function wt(e, n) {
92
- var v, F;
93
- const t = e.columns.findIndex((h) => h.name === yo), r = e.columns.findIndex((h) => h.name === (n.encoding.label ?? n.encoding.category)), c = e.columns.findIndex((h) => h.name === n.encoding.id), a = e.columns.findIndex((h) => h.name === n.encoding.value);
94
- if (t < 0 || r < 0 || a < 0) return { frame: e, collapsed: !1 };
95
- const m = e.rows.filter((h) => typeof h[t] == "string" && String(h[t]).trim() !== "");
96
- if (m.length === 0) return { frame: e, collapsed: !1 };
97
- const y = e.rows.filter((h) => !m.includes(h)).map((h) => [...h]), f = new Array(e.columns.length).fill(null);
98
- f[t] = (v = m[0]) == null ? void 0 : v[t], f[r] = (F = m[0]) == null ? void 0 : F[t], c >= 0 && (f[c] = Ct), f[a] = m.reduce((h, u) => h + (he(u[a]) ?? 0), 0), y.push(f);
99
- const b = e.colors ? [...e.colors.filter((h, u) => !m.includes(e.rows[u])), Oe()] : [...y.slice(0, -1).map(() => ""), Oe()];
100
- return { frame: { ...e, rows: y, colors: b }, collapsed: !0 };
101
- }
102
- function yt(e, n, t) {
103
- if (n.kind !== "donut" || e.rows.length < 2) return { frame: e, collapsed: !1 };
104
- const r = e.columns.findIndex((u) => u.name === (n.encoding.label ?? n.encoding.category)), c = e.columns.findIndex((u) => u.name === n.encoding.id), a = e.columns.findIndex((u) => u.name === n.encoding.value);
105
- if (r < 0 || a < 0) return { frame: e, collapsed: !1 };
106
- const m = e.total ?? e.rows.reduce((u, N) => u + (he(N[a]) ?? 0), 0);
107
- if (!Number.isFinite(m) || m <= 0) return { frame: e, collapsed: !1 };
108
- const y = e.rows.map((u, N) => ({ index: N, value: he(u[a]) ?? 0 })).filter(({ value: u }) => u / m < lo);
109
- if (y.length === 0) return { frame: e, collapsed: !1 };
110
- const f = new Set(y.map(({ index: u }) => u)), b = e.rows.filter((u, N) => !f.has(N)).map((u) => [...u]), v = new Array(e.columns.length).fill(null);
111
- v[r] = t, c >= 0 && (v[c] = Ct), v[a] = y.reduce((u, N) => u + N.value, 0), b.push(v);
112
- const F = e.rows.map((u, N) => N).filter((u) => !f.has(u)), h = e.colors ? [...e.colors.filter((u, N) => !f.has(N)), Oe()] : [...F.map(() => ""), Oe()];
113
- return { frame: { ...e, rows: b, colors: h }, collapsed: !0 };
114
- }
115
- function Fo({ panel: e, adapter: n }) {
116
- var Ze, Ge, Je, Ye, Xe, et, tt, ot, nt, rt, st, it, at, ct, lt;
117
- const t = zt(e.id), r = Re(), { document: c, navigation: a } = pt(), { drillInto: m } = Ot(), { format: y, formatAxis: f } = mo(e), [b, v] = ae(), [F, h] = ae(!1), [u, N] = ae(0), ce = typeof window > "u" ? { regression: !1 } : ut(new URL(window.location.href), e.id), [V, te] = ae(ce.regression), [_, se] = ae(ce.movingAverage), [B, A] = ae(() => /* @__PURE__ */ new Set()), [C, oe] = ae(() => typeof window > "u" ? /* @__PURE__ */ new Set() : mt(new URL(window.location.href), e.id)), K = C, ne = a.panelId === e.id && a.path.length > 0, W = ne ? $t(c, a.path) : e.drillRoot ? c.drill.edges[e.drillRoot] : void 0, Me = W ? W.children.some(({ target: o }) => o) : !!e.drillRoot, re = !!e.drillRoot || !!W, z = Ut(e), le = Pe(), de = Ae((o) => {
118
- if (re || !z.action || !t.data) return;
119
- const i = vt(t.data, e, o);
120
- return z.urlForRow(t.data, i >= 0 ? t.data.rows[i] : void 0);
121
- }, [t.data, re, z, e]), fe = Ae((o) => {
122
- var i;
123
- (i = le.current) == null || i.call(le), le.current = void 0, !(o === null || re) && (le.current = z.prefetch(de(o)));
124
- }, [re, de, z]);
125
- xe(() => () => {
126
- var o;
127
- return (o = le.current) == null ? void 0 : o.call(le);
128
- }, []);
129
- const J = T(() => {
130
- var o;
131
- return re || ((o = z.action) == null ? void 0 : o.kind) !== "open_drawer" || !t.data ? [] : t.data.rows.length === 0 || t.data.rows.length > 4 ? [] : [...new Set(t.data.rows.flatMap((i) => {
132
- const d = z.urlForRow(t.data, i);
133
- return d ? [d] : [];
134
- }))];
135
- }, [t.data, re, z]);
136
- xe(() => {
137
- if (J.length !== 0)
138
- return z.prefetchIdle(J);
139
- }, [J, z]);
140
- const I = Vt(), Y = ((Ze = z.action) == null ? void 0 : Ze.kind) === "cross_filter" || ((Ge = z.action) == null ? void 0 : Ge.kind) === "cube_drill" ? z.action.filter : void 0, be = T(() => {
141
- if (!(Y != null && Y.dimension)) return;
142
- const o = I.values[Dt], i = Array.isArray(o) ? o : o ? [o] : [], d = `${Y.dimension}:`, w = new Set(i.filter((k) => k.startsWith(d)).map((k) => k.slice(d.length)));
143
- return w.size > 0 ? w : void 0;
144
- }, [Y == null ? void 0 : Y.dimension, I.values]), Ke = T(() => {
145
- if (!be || !Y || !t.data) return;
146
- new URL(globalThis.location.href);
147
- const o = t.data;
148
- for (let i = 0; i < o.rows.length; i += 1) {
149
- const d = Pt(Y.value, {
150
- fields: qt(o, o.rows[i]),
151
- variables: {}
152
- }), w = ke(d);
153
- if (w !== "" && be.has(w)) return $e(o, e, i);
154
- }
155
- }, [be, Y, t.data, e]), X = e.kind, Te = t.data ? vo(t.data, e) <= 1 && wo(t.data, e) <= 1 : !1, Se = `${a.panelId === e.id ? a.path.join("|") : ""}:${a.perspectiveId ?? ""}`, Ie = Pe(Se);
156
- xe(() => {
157
- Ie.current !== Se && (Ie.current = Se, v(void 0));
158
- }, [Se]);
159
- const ve = Ae((o) => oe(new Set(o)), []);
160
- xe(() => {
161
- if (typeof window > "u") return;
162
- const o = () => ve(mt(new URL(window.location.href), e.id));
163
- return window.addEventListener("popstate", o), () => window.removeEventListener("popstate", o);
164
- }, [e.id, ve]), xe(() => {
165
- if (typeof window > "u") return;
166
- const o = new URL(window.location.href), i = jt(o, e.id, K);
167
- i.search !== o.search && window.history.replaceState(window.history.state, "", i);
168
- }, [K, e.id]), xe(() => {
169
- if (typeof window > "u") return;
170
- const o = () => {
171
- const i = ut(new URL(window.location.href), e.id);
172
- te(i.regression), se(i.movingAverage);
173
- };
174
- return window.addEventListener("popstate", o), () => window.removeEventListener("popstate", o);
175
- }, [e.id]), xe(() => {
176
- if (typeof window > "u") return;
177
- const o = new URL(window.location.href), i = Wt(o, e.id, { regression: V, movingAverage: _ });
178
- i.search !== o.search && window.history.replaceState(window.history.state, "", i);
179
- }, [_, e.id, V]);
180
- const D = T(() => {
181
- var O, me;
182
- if (!t.data || K.size === 0) return t.data;
183
- const o = t.data.rows.map((G, ie) => !K.has(fo(t.data, e, ie))), i = t.data.rows.filter((G, ie) => o[ie]), d = (O = t.data.colors) == null ? void 0 : O.filter((G, ie) => o[ie]), w = t.data.columns.findIndex((G) => G.name === e.encoding.value), k = ((me = e.radial) == null ? void 0 : me.mode) === "partition" || w < 0 ? t.data.total : i.reduce((G, ie) => G + (he(ie[w]) ?? 0), 0);
184
- return { ...t.data, rows: i, total: k, ...d ? { colors: d } : {} };
185
- }, [t.data, K, e]), E = T(() => D ? (() => {
186
- const o = wt(D, e);
187
- return o.collapsed ? o : yt(D, e, r("chart.other", "Other"));
188
- })() : { frame: D, collapsed: !1 }, [e, r, D]), Fe = E.collapsed && E.frame ? io(E.frame, e, E.frame.rows.length - 1) : void 0, $ = F || !E.collapsed ? D : E.frame, s = $ ? Ft($, e.encoding, e.valueAxis, (Je = e.presentation) == null ? void 0 : Je.valueSpreadThreshold) : !1, L = T(() => {
189
- if (!t.data || F) return t.data;
190
- const o = wt(t.data, e);
191
- return o.collapsed ? o.frame : yt(t.data, e, r("chart.other", "Other")).frame;
192
- }, [t.data, e, F, r]), S = T(() => {
193
- var i;
194
- if (!t.data || K.size === 0 || !e.encoding.value || ((i = e.radial) == null ? void 0 : i.mode) === "partition") return;
195
- const o = t.data.columns.findIndex((d) => d.name === e.encoding.value);
196
- if (!(o < 0))
197
- return ((D == null ? void 0 : D.rows) ?? []).reduce((d, w) => d + (he(w[o]) ?? 0), 0);
198
- }, [t.data, K.size, e.encoding.value, (Ye = e.radial) == null ? void 0 : Ye.mode, D]), ee = T(() => {
199
- var i;
200
- if (!t.data || !e.encoding.value || ((i = e.radial) == null ? void 0 : i.mode) === "partition") return;
201
- const o = t.data.columns.findIndex((d) => d.name === e.encoding.value);
202
- if (!(o < 0))
203
- return t.data.rows.reduce((d, w) => d + (he(w[o]) ?? 0), 0);
204
- }, [t.data, e.encoding.value, (Xe = e.radial) == null ? void 0 : Xe.mode]), Q = K.size > 0 && ((D == null ? void 0 : D.rows.length) ?? 0) === 0, P = t.data && t.data.rows.length > 0 ? t.data.total ?? (ne || e.kind === "pie" || e.kind === "donut" || e.kind === "radial" ? ee : void 0) ?? e.total : void 0, U = P === void 0 || Q ? null : K.size > 0 ? S ?? null : P, M = ((et = t.data) == null ? void 0 : et.presentation) ?? e.presentation, Z = $ == null ? void 0 : $.colors, pe = Ae((o) => {
205
- const i = new Set(K);
206
- i.has(o) ? i.delete(o) : i.add(o), ve(i);
207
- }, [K, ve]), ue = T(() => {
208
- if (W)
209
- return (o) => {
210
- var i;
211
- return !!((i = ht(W, o)) != null && i.target);
212
- };
213
- }, [W]), ge = T(() => xt(t.data, e), [t.data, e]), we = T(() => {
214
- var k, O, me;
215
- const o = St(c.theme, e, { positional: !ne, labels: ge }), i = ho(t.data, e), d = /* @__PURE__ */ new Map(), w = ((k = t.data) == null ? void 0 : k.columns.findIndex((G) => G.name === e.encoding.series)) ?? -1;
216
- if (w >= 0)
217
- for (const [G, ie] of (((O = t.data) == null ? void 0 : O.rows) ?? []).entries()) {
218
- const _e = ie[w], dt = (me = Z == null ? void 0 : Z[G]) == null ? void 0 : me.trim();
219
- if ((typeof _e == "string" || typeof _e == "number" || typeof _e == "bigint") && dt) {
220
- const gt = String(_e);
221
- d.has(gt) || d.set(gt, dt);
222
- }
223
- }
224
- return i.size === 0 && d.size === 0 ? o : (G, ie) => d.get(G) ?? o(G, i.get(G) ?? ie);
225
- }, [ne, c.theme, t.data, Z, ge, e]), ye = T(
226
- () => It(c.theme, e, { colors: Z, positional: !ne, labels: ge }),
227
- [ne, c.theme, Z, ge, e]
228
- ), g = T(() => {
229
- var i;
230
- const o = new Set(B);
231
- V || o.add(ze.trend);
232
- for (const { window: d } of ((i = e.temporal) == null ? void 0 : i.movingAverages) ?? [])
233
- d !== _ && o.add(ze.average(d));
234
- return o;
235
- }, [B, _, (tt = e.temporal) == null ? void 0 : tt.movingAverages, V]), p = Ae((o) => {
236
- var d, w;
237
- if (o === ze.trend) {
238
- te((k) => !k);
239
- return;
240
- }
241
- const i = (w = (d = e.temporal) == null ? void 0 : d.movingAverages) == null ? void 0 : w.find(({ window: k }) => ze.average(k) === o);
242
- if (i) {
243
- se((k) => k === i.window ? void 0 : i.window);
244
- return;
245
- }
246
- A((k) => {
247
- const O = new Set(k);
248
- return O.has(o) ? O.delete(o) : O.add(o), O;
249
- });
250
- }, [(ot = e.temporal) == null ? void 0 : ot.movingAverages]), x = (X === "line" || X === "area") && e.temporal && (e.temporal.regression || (nt = e.temporal.movingAverages) != null && nt.length) ? /* @__PURE__ */ R("div", { className: "lens-temporal-controls", children: [
251
- e.temporal.regression && /* @__PURE__ */ l(
252
- "button",
253
- {
254
- "aria-pressed": V,
255
- className: "lens-temporal-toggle",
256
- onClick: () => te((o) => !o),
257
- type: "button",
258
- children: r("chart.regression", "Trend")
259
- }
260
- ),
261
- !!((rt = e.temporal.movingAverages) != null && rt.length) && /* @__PURE__ */ R(
262
- "select",
263
- {
264
- "aria-label": r("chart.movingAverage", "Moving average"),
265
- className: "lens-temporal-select",
266
- onChange: (o) => se(o.target.value ? Number(o.target.value) : void 0),
267
- value: _ ?? "",
268
- children: [
269
- /* @__PURE__ */ l("option", { value: "", children: r("chart.movingAverage", "Moving average") }),
270
- (st = e.temporal.movingAverages) == null ? void 0 : st.map(({ window: o, label: i }) => /* @__PURE__ */ l("option", { value: o, children: i || `SMA ${o}` }, o))
271
- ]
272
- }
273
- )
274
- ] }) : void 0, q = T(() => ({
275
- previous: r("chart.series.previous", "Previous"),
276
- trend: r("chart.series.trend", "Trend"),
277
- movingAverage: (o) => r("chart.series.movingAverage", "SMA {window}", { window: String(o) }),
278
- estimate: r("chart.series.estimate", "Estimate"),
279
- ytd: r("chart.series.ytd", "YTD"),
280
- forecast: r("chart.series.forecast", "Forecast"),
281
- forecastLower: (o) => r("chart.series.forecastLower", "{forecast} lower", { forecast: o }),
282
- forecastConfidence: (o) => r("chart.series.forecastConfidence", "{forecast} confidence", { forecast: o }),
283
- boxplot: [
284
- r("chart.boxplot.min", "Min"),
285
- r("chart.boxplot.q1", "Q1"),
286
- r("chart.boxplot.median", "Median"),
287
- r("chart.boxplot.q3", "Q3"),
288
- r("chart.boxplot.max", "Max")
289
- ],
290
- noData: r("panel.empty", "No data"),
291
- copyValue: r("explore.copyValue", "Copy value"),
292
- copied: r("explore.copied", "Copied")
293
- }), [r]), j = T(() => {
294
- var o, i;
295
- return $ ? {
296
- kind: X,
297
- frame: $,
298
- encoding: e.encoding,
299
- format: y,
300
- formatAxis: f,
301
- formatTooltip: (d, w, k) => Jt(w, k, e.format[d], c.meta.locale),
302
- // The plot abbreviates because a label has to fit beside a mark; the
303
- // tooltip is where a reader who stopped to point gets the whole number, and
304
- // the clipboard gets the machine value behind it.
305
- formatExact: (d, w) => {
306
- var k;
307
- return Gt(w, e.format[d], ((k = c.meta) == null ? void 0 : k.locale) ?? "en");
308
- },
309
- rawValue: (d, w) => Zt(w, e.format[d]),
310
- categoryFormatDefined: !!(e.encoding.category && e.format[e.encoding.category]),
311
- locale: (o = c.meta) == null ? void 0 : o.locale,
312
- shareDecimalSeparator: e.encoding.value ? (i = e.format[e.encoding.value]) == null ? void 0 : i.decimalSeparator : void 0,
313
- tooltipTotalLabel: r("panel.total", "Total"),
314
- labels: q,
315
- theme: c.theme,
316
- // An explicit pick wins; otherwise the mark the page is currently filtered
317
- // by carries the same outline, so the source panel states its own selection
318
- // across a reload or a shared URL, not only in the click that made it.
319
- selectedKey: b ?? Ke,
320
- presentation: M,
321
- seriesColor: we,
322
- rowColor: ye,
323
- radial: e.radial,
324
- temporal: e.temporal,
325
- hiddenOverlays: g,
326
- valueAxis: e.valueAxis,
327
- valueUnit: Qt(e.encoding.value ? e.format[e.encoding.value] : void 0),
328
- expandable: ue
329
- } : void 0;
330
- }, [q, (it = c.meta) == null ? void 0 : it.locale, c.theme, ue, y, f, Ke, g, X, e.encoding, e.format, e.radial, e.temporal, e.valueAxis, M, $, ye, b, we, r]), Ne = T(() => {
331
- var i, d;
332
- if (!e.temporal && !e.encoding.previous) return [];
333
- const o = e.encoding.category ?? e.encoding.label;
334
- return Et({
335
- temporal: e.temporal,
336
- hasComparison: !!e.encoding.previous,
337
- labels: q,
338
- formatValue: (w) => y(e.encoding.value ?? "", w),
339
- formatCategory: Mt({
340
- format: (w) => y(o ?? "", w),
341
- isTime: ((i = t.data) == null ? void 0 : i.columns.some((w) => w.name === o && w.type === "time")) === !0,
342
- hasDeclaredFormat: !!(o && e.format[o]),
343
- locale: (d = c.meta) == null ? void 0 : d.locale
344
- }),
345
- hidden: g
346
- });
347
- }, [q, (at = c.meta) == null ? void 0 : at.locale, y, (ct = t.data) == null ? void 0 : ct.columns, g, e.encoding, e.format, e.temporal]), Be = Yt(), Ue = re ? Be ? !!((W == null ? void 0 : W.children.length) ?? e.drillRoot) : Me : !!z.action, qe = X === "histogram" || X === "boxplot" || X === "heatmap", Ve = Te && !qe, De = Ae((o, i, d) => {
348
- const w = E.frame ? E.frame.rows.length - 1 : -1;
349
- if (E.collapsed && !!(o === Fe || E.frame && vt(E.frame, e, o) === w)) {
350
- h((me) => !me);
351
- return;
352
- }
353
- if (!re) {
354
- const me = de(o);
355
- z.activate(me, void 0, { newTab: d == null ? void 0 : d.newTab });
356
- return;
357
- }
358
- if (Be) {
359
- v(o), Be(o, i);
360
- return;
361
- }
362
- const O = ht(W, o);
363
- W && !(O != null && O.target) || (v(o), m((O == null ? void 0 : O.key) ?? o, e.id));
364
- }, [E.collapsed, E.frame, Fe, m, re, W, de, Be, e, z]), je = !Ve && (M == null ? void 0 : M.legend) === "below" && !!$, Lt = !Ve && Ne.length > 0 && !!$, Ce = Ue || E.collapsed, At = e.encoding.category ?? e.encoding.label, We = (X === "line" || X === "area") && ($ == null ? void 0 : $.columns.some((o) => o.name === At && o.type === "time")) === !0, He = Ne.find((o) => o.kind === "incomplete" && o.active), Qe = Y ? r("chart.filterHint", "Select to filter the page") : r("chart.drillHint", "Select to explore"), Le = T(
365
- () => j && Ue ? { ...j, actionHint: Qe } : j,
366
- [Qe, j, Ue]
367
- );
368
- return /* @__PURE__ */ l(Xt, { allowEmptyContent: !qe, panel: e, frame: t, headerActions: x, total: U, children: /* @__PURE__ */ R("div", { className: `lens-chart-layout${je ? " lens-chart-layout-legend" : ""}`, children: [
369
- /* @__PURE__ */ R("div", { className: "lens-chart-area", children: [
370
- (M == null ? void 0 : M.totalBadge) === "plot" && X !== "donut" && ((lt = e.radial) == null ? void 0 : lt.mode) !== "partition" && U !== null && /* @__PURE__ */ l(xo, { panel: e, total: U }),
371
- (s || He || We || be || F && E.collapsed) && /* @__PURE__ */ R("div", { className: "lens-chart-notes", children: [
372
- be && /* @__PURE__ */ l("span", { className: "lens-chart-source-note", role: "note", children: r("chart.crossFilterSource", "All categories shown — the filter applies to the other panels") }),
373
- s && /* @__PURE__ */ R(
374
- "span",
375
- {
376
- className: "lens-chart-log-scale",
377
- role: "note",
378
- title: r("chart.logScaleHint", "Values are shown on a logarithmic scale"),
379
- children: [
380
- /* @__PURE__ */ l(eo, { "aria-hidden": "true" }),
381
- /* @__PURE__ */ l("span", { children: r("chart.logScale", "Logarithmic scale") })
382
- ]
383
- }
384
- ),
385
- He && /* @__PURE__ */ l("span", { className: "lens-chart-period-note", role: "note", children: [He.detail, He.label].filter(Boolean).join(" · ") }),
386
- /* @__PURE__ */ R("span", { className: "lens-chart-notes-actions", children: [
387
- F && E.collapsed && /* @__PURE__ */ l("button", { className: "lens-chart-collapse-other", onClick: () => h(!1), type: "button", children: r("chart.collapseOther", "Collapse Other") }),
388
- We && /* @__PURE__ */ l("button", { className: "lens-chart-reset-zoom", onClick: () => N((o) => o + 1), type: "button", children: r("chart.resetZoom", "Reset zoom") })
389
- ] })
390
- ] }),
391
- Q ? /* @__PURE__ */ l(bo, { onShowAll: () => ve(/* @__PURE__ */ new Set()) }) : Le && Ve ? /* @__PURE__ */ l(
392
- po,
393
- {
394
- actionable: Ce,
395
- frame: Le.frame,
396
- onSelect: Ce ? De : void 0,
397
- panel: e
398
- }
399
- ) : Le && /* @__PURE__ */ R(Ee, { children: [
400
- /* @__PURE__ */ l(
401
- ao,
402
- {
403
- actionable: Ce,
404
- format: Le.format,
405
- frame: Le.frame,
406
- label: r("chart.data", "Chart data for {name}", { name: e.title }),
407
- onHover: fe,
408
- onSelect: De,
409
- panel: e,
410
- translate: r
411
- }
412
- ),
413
- /* @__PURE__ */ l(
414
- co,
415
- {
416
- input: Le,
417
- panelId: e.id,
418
- adapter: n,
419
- label: r("chart.label", "{name} chart", { name: e.title }),
420
- drillable: Ce,
421
- onHover: Ce ? fe : void 0,
422
- onSelect: Ce ? De : void 0,
423
- resetZoomKey: u
424
- }
425
- )
426
- ] }),
427
- Lt && /* @__PURE__ */ l(Io, { onToggle: p, overlays: Ne })
428
- ] }),
429
- je && L && /* @__PURE__ */ l(
430
- So,
431
- {
432
- frame: L,
433
- hidden: K,
434
- onSetHidden: ve,
435
- onToggle: pe,
436
- panel: e,
437
- presentation: M,
438
- total: U ?? void 0
439
- }
440
- )
441
- ] }) });
442
- }
443
- function bo({ onShowAll: e }) {
444
- const n = Re();
445
- return /* @__PURE__ */ R("div", { className: "lens-chart-empty", role: "status", children: [
446
- /* @__PURE__ */ l("span", { className: "lens-chart-empty-note", children: n("chart.allSeriesHidden", "All series are hidden") }),
447
- /* @__PURE__ */ l("button", { className: "lens-chart-empty-action", onClick: e, type: "button", children: n("chart.showAllSeries", "Show all series") })
448
- ] });
449
- }
450
- function po({ actionable: e, frame: n, onSelect: t, panel: r }) {
451
- var se, B;
452
- const c = Re(), a = [r.encoding.category, r.encoding.label].find((A) => A !== void 0 && n.columns.some((C) => C.name === A)), m = r.encoding.value, y = n.columns.findIndex((A) => A.name === a), f = n.columns.findIndex((A) => A.name === m), b = H(m ? r.format[m] : void 0), v = f < 0 ? void 0 : n.rows.reduce((A, C) => A + (he(C[f]) ?? 0), 0), F = y < 0 || (se = n.rows[0]) == null ? void 0 : se[y], h = ke(F), u = b(v), N = r.encoding.id ?? a, ce = n.columns.findIndex((A) => A.name === N), V = ke(ce < 0 || (B = n.rows[0]) == null ? void 0 : B[ce]), te = /* @__PURE__ */ l(Ee, { children: n.rows.length === 0 ? /* @__PURE__ */ l("span", { className: "lens-chart-compact-empty", children: c("panel.empty", "No data") }) : /* @__PURE__ */ R(Ee, { children: [
453
- h && /* @__PURE__ */ l("span", { className: "lens-chart-compact-label", title: h, children: h }),
454
- /* @__PURE__ */ l("strong", { className: "lens-chart-compact-value", children: u })
455
- ] }) }), _ = n.rows.length === 0 ? c("panel.empty", "No data") : [h, u].filter(Boolean).join(" / ");
456
- return e && V && n.rows.length > 0 ? /* @__PURE__ */ l(
457
- "button",
458
- {
459
- "aria-label": `${_}. ${c("chart.openMark", "Open {name}", { name: h ?? V })}`,
460
- className: "lens-chart-compact lens-chart-compact-action",
461
- onClick: () => t == null ? void 0 : t(V),
462
- type: "button",
463
- children: te
464
- }
465
- ) : /* @__PURE__ */ l("div", { "aria-label": _, className: "lens-chart-compact", role: "img", children: te });
466
- }
467
- function xo({ panel: e, total: n }) {
468
- const t = Re(), r = H(e.encoding.value ? e.format[e.encoding.value] : void 0);
469
- return /* @__PURE__ */ R("span", { className: "lens-plot-total", children: [
470
- /* @__PURE__ */ R("span", { className: "lens-panel-total-label", children: [
471
- t("panel.total", "Total"),
472
- ":"
473
- ] }),
474
- " ",
475
- r(n)
476
- ] });
477
- }
478
- const So = bt(function({
479
- panel: n,
480
- frame: t,
481
- hidden: r,
482
- onSetHidden: c,
483
- onToggle: a,
484
- total: m,
485
- presentation: y
486
- }) {
487
- var Fe, $;
488
- const { document: f, navigation: b } = pt(), v = Re(), [F, h] = ae(""), u = Pe(null), [N, ce] = ae({ top: !1, bottom: !1 }), [V, te] = ae(0), [_, se] = ae(!1), B = Nt(t, n), A = B >= 0 ? n.encoding.series : n.encoding.label ?? n.encoding.category, C = n.encoding.value, oe = H(C ? n.format[C] : void 0), K = t.columns.findIndex((s) => s.name === A), ne = t.columns.findIndex((s) => s.name === C), W = H(A ? n.format[A] : void 0), Me = b.panelId === n.id && b.path.length > 0, re = xt(t, n), z = St(f.theme, n, { positional: !Me, labels: re }), le = It(f.theme, n, {
489
- colors: t.colors,
490
- positional: !Me,
491
- labels: re
492
- }), de = n.encoding.id ? t.columns.findIndex((s) => s.name === n.encoding.id) : -1, fe = n.encoding.series ? t.columns.findIndex((s) => s.name === n.encoding.series) : -1, J = ((Fe = n.radial) == null ? void 0 : Fe.mode) === "partition", I = T(() => {
493
- var we, ye;
494
- const s = t.rows.map((g, p) => {
495
- const x = de >= 0 ? g[de] : g[K];
496
- return String(typeof x == "string" || typeof x == "number" || typeof x == "bigint" ? x : p);
497
- }), L = t.rows.map((g, p) => {
498
- if (B < 0) return s[p];
499
- const x = g[B];
500
- return String(typeof x == "string" || typeof x == "number" || typeof x == "bigint" ? x : p);
501
- });
502
- let S = t.rows.map((g, p) => p);
503
- if (B >= 0 || J) {
504
- const g = /* @__PURE__ */ new Set();
505
- S = [];
506
- for (let p = 0; p < t.rows.length; p += 1) {
507
- const x = L[p];
508
- g.has(x) || (g.add(x), S.push(p));
509
- }
510
- }
511
- const ee = S.map((g) => L[g]), Q = new Map(S.map((g, p) => [g, p])), P = /* @__PURE__ */ new Map();
512
- J && s.forEach((g) => {
513
- P.has(g) || P.set(g, P.size);
514
- });
515
- const U = new Map((((we = n.radial) == null ? void 0 : we.rings) ?? []).map((g) => [g.key, g.total])), M = /* @__PURE__ */ new Map();
516
- for (let g = 0; g < t.rows.length; g += 1) {
517
- const p = fe >= 0 ? (ye = t.rows[g]) == null ? void 0 : ye[fe] : void 0, x = J && typeof p == "string" ? p : "", q = J ? U.get(x) ?? m : m, j = J ? x : String(q), Ne = M.get(j) ?? { denominator: q, indices: [] };
518
- Ne.indices.push(g), M.set(j, Ne);
519
- }
520
- const Z = /* @__PURE__ */ new Map();
521
- for (const { denominator: g, indices: p } of M.values()) {
522
- const x = p.map((q) => {
523
- var j;
524
- return ne >= 0 ? he((j = t.rows[q]) == null ? void 0 : j[ne]) : void 0;
525
- });
526
- Ht(x, g).forEach((q, j) => Z.set(p[j], q));
527
- }
528
- const pe = /* @__PURE__ */ new Map();
529
- J && s.forEach((g) => pe.set(g, (pe.get(g) ?? 0) + 1));
530
- const ue = /* @__PURE__ */ new Map();
531
- ne >= 0 && t.rows.forEach((g, p) => {
532
- var j;
533
- const x = he(g[ne]);
534
- if (x === void 0) return;
535
- const q = L[p];
536
- B >= 0 && C && ((j = n.format[C]) == null ? void 0 : j.kind) !== "percent" ? ue.set(q, (ue.get(q) ?? 0) + x) : ue.set(q, x);
537
- });
538
- const ge = /* @__PURE__ */ new Map();
539
- return J && fe >= 0 && S.forEach((g) => {
540
- var x;
541
- const p = (x = t.rows[g]) == null ? void 0 : x[fe];
542
- typeof p == "string" && ge.set(g, p);
543
- }), { allKeys: ee, categoryOrder: P, entries: S, entryKeys: L, entryPositions: Q, ringByIndex: ge, rowKeys: s, rowsPerKey: pe, shares: Z, valueByKey: ue };
544
- }, [t, de, K, n.format, ($ = n.radial) == null ? void 0 : $.rings, J, fe, B, m, C, ne]), Y = (s, L, S) => {
545
- var P;
546
- if (B >= 0) return z(s, S);
547
- const ee = de >= 0 ? (P = t.rows[L]) == null ? void 0 : P[de] : void 0, Q = typeof ee == "string" && ee.trim() !== "" ? ee : void 0;
548
- return le(s, I.categoryOrder.get(I.rowKeys[L]) ?? L, Q);
549
- }, be = (y == null ? void 0 : y.legendValue) === "percent", Ke = (s) => B >= 0 ? "value" : be ? "percent" : J ? I.rowsPerKey.get(I.rowKeys[s]) === 1 ? "percent" : "none" : "value", X = F.trim().toLocaleLowerCase(), Te = X === "" ? I.entries : I.entries.filter((s) => {
550
- var S;
551
- const L = (S = t.rows[s]) == null ? void 0 : S[K];
552
- return ke(L).toLocaleLowerCase().includes(X);
553
- });
554
- if (kt(() => {
555
- const s = u.current;
556
- if (!s) return;
557
- const L = () => {
558
- const ee = s.scrollTop + s.clientHeight, Q = s.scrollHeight > s.clientHeight + 1;
559
- if (ce({
560
- top: Q && s.scrollTop > 1,
561
- bottom: Q && ee < s.scrollHeight - 1
562
- }), !Q) {
563
- te(0);
564
- return;
565
- }
566
- const P = s.querySelectorAll(".lens-chart-legend-item");
567
- let U = 0;
568
- for (const M of P) M.offsetTop + M.offsetHeight > ee + 1 && (U += 1);
569
- te(U);
570
- };
571
- L(), s.addEventListener("scroll", L, { passive: !0 });
572
- const S = typeof ResizeObserver > "u" ? void 0 : new ResizeObserver(L);
573
- return S == null || S.observe(s), () => {
574
- s.removeEventListener("scroll", L), S == null || S.disconnect();
575
- };
576
- }, [_, Te.length]), K < 0) return null;
577
- const Se = (s) => {
578
- const L = !r.has(s) && I.allKeys.every((S) => S === s || r.has(S));
579
- c(L ? /* @__PURE__ */ new Set() : new Set(I.allKeys.filter((S) => S !== s)));
580
- }, Ie = I.allKeys.length > 0 && I.allKeys.every((s) => r.has(s)), ve = I.allKeys.every((s) => !r.has(s)), D = I.allKeys.length > uo, E = I.entries.length >= go;
581
- return /* @__PURE__ */ R("div", { className: "lens-chart-legend-shell", style: _ ? { "--lens-chart-legend-max": "none" } : void 0, children: [
582
- D && /* @__PURE__ */ R("div", { className: "lens-chart-legend-controls", children: [
583
- /* @__PURE__ */ l(
584
- "div",
585
- {
586
- "aria-label": v("chart.legendControls", "Legend controls"),
587
- className: "lens-chart-legend-tools",
588
- "data-members": E ? "many" : "one",
589
- role: "group",
590
- children: E ? /* @__PURE__ */ R(Ee, { children: [
591
- /* @__PURE__ */ l(
592
- "button",
593
- {
594
- "aria-pressed": Ie,
595
- onClick: () => c(new Set(I.allKeys)),
596
- type: "button",
597
- children: v("chart.legendHideAll", "Hide all")
598
- }
599
- ),
600
- /* @__PURE__ */ l(
601
- "button",
602
- {
603
- "aria-pressed": ve,
604
- onClick: () => c(/* @__PURE__ */ new Set()),
605
- type: "button",
606
- children: v("chart.legendShowAll", "Show all")
607
- }
608
- ),
609
- /* @__PURE__ */ l(
610
- "button",
611
- {
612
- "aria-label": v("chart.legendInvert", "Invert"),
613
- className: "lens-chart-legend-invert",
614
- onClick: () => c(new Set(I.allKeys.filter((s) => !r.has(s)))),
615
- title: v("chart.legendInvert", "Invert"),
616
- type: "button",
617
- children: /* @__PURE__ */ l(oo, {})
618
- }
619
- )
620
- ] }) : /* @__PURE__ */ l(
621
- "button",
622
- {
623
- onClick: () => c(Ie ? /* @__PURE__ */ new Set() : new Set(I.allKeys)),
624
- type: "button",
625
- children: Ie ? v("chart.legendShowAll", "Show all") : v("chart.legendHideAll", "Hide all")
626
- }
627
- )
628
- }
629
- ),
630
- E && /* @__PURE__ */ R("label", { className: "lens-chart-legend-search", children: [
631
- /* @__PURE__ */ l("span", { className: "lens-sr-only", children: v("chart.legendSearch", "Search legend") }),
632
- /* @__PURE__ */ l(
633
- "input",
634
- {
635
- className: "lens-facet-search",
636
- onChange: (s) => h(s.currentTarget.value),
637
- placeholder: v("chart.legendSearch", "Search legend"),
638
- type: "search",
639
- value: F
640
- }
641
- )
642
- ] })
643
- ] }),
644
- /* @__PURE__ */ R(
645
- "div",
646
- {
647
- className: "lens-chart-legend-scroll-frame",
648
- "data-overflow-bottom": N.bottom || void 0,
649
- "data-overflow-top": N.top || void 0,
650
- children: [
651
- /* @__PURE__ */ l("ul", { "aria-label": v("chart.legendControls", "Legend controls"), className: "lens-chart-legend", "data-testid": `lens-panel-${n.id}-legend`, ref: u, role: "region", tabIndex: N.top || N.bottom ? 0 : void 0, children: Te.map((s, L) => {
652
- var ge, we, ye, g, p;
653
- const S = t.rows[s], ee = I.entryPositions.get(s) ?? s, Q = S[K], P = Q == null ? "" : W(Q), U = I.entryKeys[s], M = r.has(U), Z = I.ringByIndex.get(s), pe = L > 0 ? I.ringByIndex.get(Te[L - 1]) : void 0, ue = ((ye = (we = (ge = n.radial) == null ? void 0 : ge.rings) == null ? void 0 : we.find((x) => x.key === Z)) == null ? void 0 : ye.label) ?? Z;
654
- return /* @__PURE__ */ R(Rt, { children: [
655
- Z && Z !== pe && /* @__PURE__ */ l("li", { className: "lens-chart-legend-heading", children: ue }),
656
- /* @__PURE__ */ l("li", { className: "lens-chart-legend-item", children: /* @__PURE__ */ R(
657
- "button",
658
- {
659
- "aria-pressed": !M,
660
- className: `lens-chart-legend-toggle${M ? " lens-chart-legend-hidden" : ""}`,
661
- "data-testid": `lens-panel-${n.id}-legend-series-${ee}`,
662
- onClick: () => a(U),
663
- onDoubleClick: () => Se(U),
664
- title: v("chart.legendToggleHint", "Click to toggle · double-click to isolate"),
665
- type: "button",
666
- children: [
667
- /* @__PURE__ */ l(
668
- "span",
669
- {
670
- "aria-hidden": "true",
671
- className: "lens-chart-legend-mark",
672
- style: { background: Y(P, s, ee) }
673
- }
674
- ),
675
- /* @__PURE__ */ l("span", { className: "lens-chart-legend-label", children: P }),
676
- Ke(s) !== "none" && /* @__PURE__ */ l("span", { className: "lens-chart-legend-value", children: Ke(s) === "percent" ? _t(I.shares.get(s), (g = f.meta) == null ? void 0 : g.locale, C ? (p = n.format[C]) == null ? void 0 : p.decimalSeparator : void 0) : oe(I.valueByKey.get(U)) }),
677
- /* @__PURE__ */ l("span", { "aria-hidden": "true", className: "lens-chart-legend-visibility", children: M ? /* @__PURE__ */ l(no, {}) : /* @__PURE__ */ l(ro, {}) })
678
- ]
679
- }
680
- ) }, `${U}-${s}`)
681
- ] }, `${U}-${s}`);
682
- }) }),
683
- /* @__PURE__ */ l("span", { "aria-hidden": "true", className: "lens-chart-legend-edge lens-chart-legend-edge-top" }),
684
- /* @__PURE__ */ l("span", { "aria-hidden": "true", className: "lens-chart-legend-edge lens-chart-legend-edge-bottom" })
685
- ]
686
- }
687
- ),
688
- (V > 0 || _) && /* @__PURE__ */ l("button", { className: "lens-chart-legend-overflow", onClick: () => se((s) => !s), type: "button", children: _ ? v("chart.legendCollapse", "Show fewer") : v("chart.legendMore", "{count} more", { count: String(V) }) })
689
- ] });
690
- }), Io = bt(function({ overlays: n, onToggle: t }) {
691
- const r = Re(), c = r("chart.legendOverlays", "Chart marks");
692
- return /* @__PURE__ */ R("ul", { "aria-label": c, className: "lens-chart-legend lens-chart-overlay-legend", children: [
693
- /* @__PURE__ */ l("li", { className: "lens-chart-legend-heading", children: c }),
694
- n.map((a) => /* @__PURE__ */ l("li", { className: "lens-chart-legend-item", children: /* @__PURE__ */ R(
695
- "button",
696
- {
697
- "aria-pressed": a.active,
698
- className: `lens-chart-legend-toggle${a.active ? "" : " lens-chart-legend-hidden"}`,
699
- onClick: () => t(a.id),
700
- title: r("chart.legendToggleOverlay", "Show or hide this mark"),
701
- type: "button",
702
- children: [
703
- /* @__PURE__ */ l(
704
- "span",
705
- {
706
- "aria-hidden": "true",
707
- className: "lens-chart-overlay-mark",
708
- "data-stroke": a.stroke,
709
- style: { "--lens-overlay-ink": `var(${Bt(a.tone)})` }
710
- }
711
- ),
712
- /* @__PURE__ */ l("span", { className: "lens-chart-legend-label", children: a.label }),
713
- a.detail && /* @__PURE__ */ R(Ee, { children: [
714
- /* @__PURE__ */ l("span", { "aria-hidden": "true", className: "lens-chart-legend-separator", children: "·" }),
715
- /* @__PURE__ */ l("span", { className: "lens-chart-legend-value", children: a.detail })
716
- ] })
717
- ]
718
- }
719
- ) }, a.id))
720
- ] });
721
- });
722
- export {
723
- Fo as ChartPanel,
724
- wt as collapseExpandableTopN,
725
- yt as collapseMinorDonutSlices,
726
- Ct as donutRemainderKey,
727
- $e as legendKey,
728
- vt as rowIndexForKey,
729
- yo as topNGroupField
730
- };