@iota-uz/sdk 0.5.1 → 0.5.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 (60) 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-CBelm6bC.js +574 -0
  4. package/dist/lens/{ChartHost-Bl2lxIqU.js → ChartHost-rKcUCBNo.js} +2 -2
  5. package/dist/lens/{ChartPanel-CTIp_4YE.js → ChartPanel-BkmCcLe8.js} +88 -88
  6. package/dist/lens/{CoveragePanel-DZZWkjSv.js → CoveragePanel-DH_8AOhN.js} +6 -6
  7. package/dist/lens/{GaugePanel-BcNdd_Wj.js → GaugePanel-BaJPz_2z.js} +1 -1
  8. package/dist/lens/{MapPanel-6sI_Ei9L.js → MapPanel-v99HJkGl.js} +2 -2
  9. package/dist/lens/{MetricFlowPanel-LzqevSPs.js → MetricFlowPanel-DstlsUQW.js} +6 -6
  10. package/dist/lens/{MetricHierarchyPanel-h6tJqRPg.js → MetricHierarchyPanel-ByD8JzTQ.js} +2 -2
  11. package/dist/lens/{MetricRelationshipPanel-CgckUvvJ.js → MetricRelationshipPanel-DrfQ58jw.js} +5 -5
  12. package/dist/lens/{PrintReport-DJv4Rm_U.js → PrintReport-xi-iswMR.js} +5 -5
  13. package/dist/lens/{TablePanel-Dh6bXlwM.js → TablePanel-Daw6L4Fm.js} +102 -102
  14. package/dist/lens/{adapter-zBDC8hbZ.js → adapter-Bi3QzfzC.js} +5516 -5510
  15. package/dist/lens/breakpoints.d.ts +6 -4
  16. package/dist/lens/breakpoints.d.ts.map +1 -1
  17. package/dist/lens/charts/echarts/options.d.ts.map +1 -1
  18. package/dist/lens/contract/schemas.d.ts +1 -0
  19. package/dist/lens/contract/schemas.d.ts.map +1 -1
  20. package/dist/lens/contract/types.d.ts +2 -0
  21. package/dist/lens/contract/types.d.ts.map +1 -1
  22. package/dist/lens/controls/FacetFilterMenu.d.ts +2 -3
  23. package/dist/lens/controls/FacetFilterMenu.d.ts.map +1 -1
  24. package/dist/lens/controls/PeriodFilterControl.d.ts.map +1 -1
  25. package/dist/lens/controls/model.d.ts +11 -0
  26. package/dist/lens/controls/model.d.ts.map +1 -1
  27. package/dist/lens/icons.d.ts +9 -0
  28. package/dist/lens/icons.d.ts.map +1 -1
  29. package/dist/lens/{index-C45DAO6w.js → index-88l253R1.js} +3163 -3091
  30. package/dist/lens/{index-CspKnSQn.js → index-Dvts5yK8.js} +1 -1
  31. package/dist/lens/index.js +1 -1
  32. package/dist/lens/{install-B5oSx3pv.js → install-BEBo0o42.js} +1 -1
  33. package/dist/lens/{install-DyXK20dR.js → install-CCwiOjQ0.js} +1 -1
  34. package/dist/lens/{install-3GLgv_LN.js → install-CeT1_mBH.js} +1 -1
  35. package/dist/lens/{install-DT0AQkUj.js → install-DIpMnjeK.js} +1 -1
  36. package/dist/lens/{metricViews-QvoFHVdh.js → metricViews-CH2Cdo0x.js} +1 -1
  37. package/dist/lens/panels/CascadePanel.d.ts +46 -6
  38. package/dist/lens/panels/CascadePanel.d.ts.map +1 -1
  39. package/dist/lens/panels/ChartPanel.d.ts.map +1 -1
  40. package/dist/lens/panels/PanelFrame.d.ts.map +1 -1
  41. package/dist/lens/panels/TablePanel.d.ts.map +1 -1
  42. package/dist/lens/panels/WaterfallPlot.d.ts +7 -1
  43. package/dist/lens/panels/WaterfallPlot.d.ts.map +1 -1
  44. package/dist/lens/panels/data.d.ts +8 -4
  45. package/dist/lens/panels/data.d.ts.map +1 -1
  46. package/dist/lens/panels/panelFailure.d.ts +39 -0
  47. package/dist/lens/panels/panelFailure.d.ts.map +1 -0
  48. package/dist/lens/{prefetch-Dov5CBoH.js → prefetch-C6OyvFGh.js} +2 -2
  49. package/dist/lens/{prefetchPanels-B7bIY0bM.js → prefetchPanels-CdS2yC1c.js} +3 -3
  50. package/dist/lens/{print-CwcB0fug.js → print-30aTJUkg.js} +1 -1
  51. package/dist/lens/runtime/provider.d.ts.map +1 -1
  52. package/dist/lens/runtime/query.d.ts +16 -2
  53. package/dist/lens/runtime/query.d.ts.map +1 -1
  54. package/dist/lens/{scales-DKkoQGtJ.js → scales-DOtg8I4r.js} +1 -1
  55. package/dist/lens/style.css +1 -1
  56. package/dist/sdk-identity.cjs +3 -3
  57. package/dist/sdk-identity.js +3 -3
  58. package/dist/sdk-identity.json +2 -2
  59. package/package.json +1 -1
  60. package/dist/lens/CascadePanel-DqOZFdR-.js +0 -512
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
- const SDK_RELEASE_VERSION = "0.5.1"
3
- const SDK_SOURCE_COMMIT = "3b8b83b7c05ea67259038ce8f804bd54243ef71f"
2
+ const SDK_RELEASE_VERSION = "0.5.3"
3
+ const SDK_SOURCE_COMMIT = "db8084f4562986a56203ee5752e99e73ee22586d"
4
4
  const SDK_PROTOCOL_VERSION = "1.0.0"
5
- const SDK_IDENTITY = Object.freeze({"releaseVersion":"0.5.1","sourceCommit":"3b8b83b7c05ea67259038ce8f804bd54243ef71f","protocolVersion":"1.0.0"})
5
+ const SDK_IDENTITY = Object.freeze({"releaseVersion":"0.5.3","sourceCommit":"db8084f4562986a56203ee5752e99e73ee22586d","protocolVersion":"1.0.0"})
6
6
  module.exports = { SDK_RELEASE_VERSION, SDK_SOURCE_COMMIT, SDK_PROTOCOL_VERSION, SDK_IDENTITY }
@@ -1,4 +1,4 @@
1
- export const SDK_RELEASE_VERSION = "0.5.1"
2
- export const SDK_SOURCE_COMMIT = "3b8b83b7c05ea67259038ce8f804bd54243ef71f"
1
+ export const SDK_RELEASE_VERSION = "0.5.3"
2
+ export const SDK_SOURCE_COMMIT = "db8084f4562986a56203ee5752e99e73ee22586d"
3
3
  export const SDK_PROTOCOL_VERSION = "1.0.0"
4
- export const SDK_IDENTITY = Object.freeze({"releaseVersion":"0.5.1","sourceCommit":"3b8b83b7c05ea67259038ce8f804bd54243ef71f","protocolVersion":"1.0.0"})
4
+ export const SDK_IDENTITY = Object.freeze({"releaseVersion":"0.5.3","sourceCommit":"db8084f4562986a56203ee5752e99e73ee22586d","protocolVersion":"1.0.0"})
@@ -1,5 +1,5 @@
1
1
  {
2
- "releaseVersion": "0.5.1",
3
- "sourceCommit": "3b8b83b7c05ea67259038ce8f804bd54243ef71f",
2
+ "releaseVersion": "0.5.3",
3
+ "sourceCommit": "db8084f4562986a56203ee5752e99e73ee22586d",
4
4
  "protocolVersion": "1.0.0"
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iota-uz/sdk",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "description": "Canonical JavaScript distribution for iota-sdk.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,512 +0,0 @@
1
- import { jsx as o, jsxs as w, Fragment as Y } from "react/jsx-runtime";
2
- import { useState as B, useRef as P, useEffect as W, useCallback as A, useLayoutEffect as q } from "react";
3
- import { u as j, U as K, V as X, X as Z, Y as J, Z as Q, _ as tt, o as et, $ as L, L as R, M as at, a0 as nt, I as lt, H as ot, z as st, P as rt, a1 as S, a2 as V } from "./index-C45DAO6w.js";
4
- import "@iota-uz/sdk/client-host";
5
- import { createPortal as it } from "react-dom";
6
- function _({ raw: t }) {
7
- const a = j(), [n, i] = B(!1), u = P();
8
- W(() => () => {
9
- u.current && clearTimeout(u.current);
10
- }, []);
11
- const c = n ? a("explore.copied", "Copied") : a("explore.copyValue", "Copy value");
12
- return /* @__PURE__ */ o(
13
- "button",
14
- {
15
- "aria-label": c,
16
- className: "lens-icon-button lens-tooltip-copy",
17
- "data-copied": n ? "true" : void 0,
18
- onClick: (s) => {
19
- s.stopPropagation(), Z(t), i(!0), u.current && clearTimeout(u.current), u.current = setTimeout(() => i(!1), 1500);
20
- },
21
- title: c,
22
- type: "button",
23
- children: n ? /* @__PURE__ */ o(K, {}) : /* @__PURE__ */ o(X, {})
24
- }
25
- );
26
- }
27
- const O = 8, z = 8;
28
- function ct(t, a, n) {
29
- const i = Math.max(z, n.width - a.width - z), u = Math.min(Math.max(t.left + t.width / 2 - a.width / 2, z), i), c = t.top - a.height - O, s = c >= z;
30
- return {
31
- left: Math.round(u),
32
- top: Math.round(s ? c : t.bottom + O),
33
- side: s ? "above" : "below"
34
- };
35
- }
36
- function dt({ anchor: t, open: a, item: n, actionHint: i, onMouseEnter: u, onMouseLeave: c }) {
37
- const s = tt(a, t, "lens-waterfall-tip-overlay-root"), M = P(null), [l, f] = B(), p = A(() => {
38
- var N, k, e, x;
39
- const m = (N = t.current) == null ? void 0 : N.getBoundingClientRect(), y = (k = M.current) == null ? void 0 : k.getBoundingClientRect();
40
- if (!m || !y) return;
41
- const v = (x = (e = t.current) == null ? void 0 : e.closest(".lens-waterfall-bar")) == null ? void 0 : x.querySelector("strong"), T = Math.min(m.top, (v == null ? void 0 : v.getBoundingClientRect().top) ?? m.top), I = ct(
42
- { left: m.left, width: m.width, top: T, bottom: m.bottom },
43
- y,
44
- { width: globalThis.innerWidth || 1024 }
45
- );
46
- f((r) => (r == null ? void 0 : r.left) === I.left && r.top === I.top && r.side === I.side ? r : I);
47
- }, [t]);
48
- if (q(() => {
49
- s && p();
50
- }, [s, p]), W(() => {
51
- a || f(void 0);
52
- }, [a]), W(() => {
53
- if (s)
54
- return globalThis.addEventListener("resize", p), globalThis.addEventListener("scroll", p, !0), () => {
55
- globalThis.removeEventListener("resize", p), globalThis.removeEventListener("scroll", p, !0);
56
- };
57
- }, [s, p]), !a || !s) return null;
58
- const d = n.exactValue ?? n.formattedValue, b = n.exactSplit ?? n.formattedSplit;
59
- return it(
60
- /* @__PURE__ */ w(
61
- "span",
62
- {
63
- className: "lens-waterfall-tip",
64
- "data-side": (l == null ? void 0 : l.side) ?? "above",
65
- onMouseEnter: u,
66
- onMouseLeave: c,
67
- ref: M,
68
- role: "tooltip",
69
- style: {
70
- left: (l == null ? void 0 : l.left) ?? 0,
71
- top: (l == null ? void 0 : l.top) ?? 0,
72
- visibility: l ? "visible" : "hidden"
73
- },
74
- children: [
75
- /* @__PURE__ */ o("span", { "aria-hidden": "true", className: "lens-waterfall-tip-tail" }),
76
- /* @__PURE__ */ o("span", { className: "lens-waterfall-tip-head", children: n.label }),
77
- /* @__PURE__ */ w("span", { className: "lens-waterfall-tip-amount", children: [
78
- /* @__PURE__ */ o("strong", { children: d }),
79
- n.rawValue !== void 0 && /* @__PURE__ */ o(_, { raw: n.rawValue })
80
- ] }),
81
- b !== void 0 && /* @__PURE__ */ w(Y, { children: [
82
- n.splitLabel && /* @__PURE__ */ o("span", { className: "lens-waterfall-tip-label", children: n.splitLabel }),
83
- /* @__PURE__ */ w("span", { className: "lens-waterfall-tip-amount", "data-split": "true", children: [
84
- /* @__PURE__ */ o("strong", { children: b }),
85
- n.rawSplit !== void 0 && /* @__PURE__ */ o(_, { raw: n.rawSplit })
86
- ] })
87
- ] }),
88
- i && /* @__PURE__ */ o("span", { className: "lens-waterfall-tip-foot", children: i })
89
- ]
90
- }
91
- ),
92
- s
93
- );
94
- }
95
- function ut({ item: t, index: a, count: n, chrome: i, splitCallout: u, actionHint: c }) {
96
- const [s, M] = B(!1), l = P(null), f = P(null), p = J(f), d = P(), b = () => {
97
- d.current && clearTimeout(d.current), M(!0);
98
- }, m = () => {
99
- d.current && clearTimeout(d.current), d.current = setTimeout(() => M(!1), Q);
100
- };
101
- W(() => () => {
102
- d.current && clearTimeout(d.current);
103
- }, []);
104
- const y = a * 2 >= n ? "start" : "end", v = `${t.splitLabel ? `${t.splitLabel} ` : ""}${t.formattedSplit ?? ""}`;
105
- return /* @__PURE__ */ w(
106
- "div",
107
- {
108
- className: "lens-waterfall-column",
109
- onBlur: m,
110
- onFocus: b,
111
- onMouseEnter: b,
112
- onMouseLeave: m,
113
- ...i,
114
- children: [
115
- /* @__PURE__ */ w("div", { className: "lens-waterfall-column-plot", children: [
116
- t.underlayHeight !== void 0 && /* @__PURE__ */ o(
117
- "span",
118
- {
119
- "aria-hidden": "true",
120
- className: "lens-waterfall-underlay",
121
- style: {
122
- top: `${t.top + t.height}%`,
123
- height: `${t.underlayHeight}%`
124
- }
125
- }
126
- ),
127
- a < n - 1 && /* @__PURE__ */ o(
128
- "span",
129
- {
130
- className: "lens-waterfall-connector",
131
- style: { top: `${t.connectorTop}%` }
132
- }
133
- ),
134
- /* @__PURE__ */ w(
135
- "div",
136
- {
137
- className: "lens-waterfall-bar",
138
- ref: l,
139
- "data-checkpoint": t.checkpoint,
140
- "data-kind": t.kind,
141
- "data-label-row": a % 2,
142
- "data-no-movement": t.noMovement,
143
- "data-terminal": !i || void 0,
144
- "data-tone": t.tone,
145
- style: {
146
- top: `${t.top}%`,
147
- height: `${t.height}%`
148
- },
149
- children: [
150
- /* @__PURE__ */ o("strong", { children: t.formattedValue }),
151
- t.splitHeight !== void 0 && /* @__PURE__ */ o(
152
- "span",
153
- {
154
- className: "lens-waterfall-bar-split",
155
- style: { height: `${t.splitHeight}%` },
156
- children: u === "hover" ? /* @__PURE__ */ o("span", { className: "lens-sr-only", children: v }) : /* @__PURE__ */ o(
157
- "span",
158
- {
159
- className: "lens-waterfall-split-callout",
160
- "data-reveal": "always",
161
- "data-side": y,
162
- children: v
163
- }
164
- )
165
- }
166
- )
167
- ]
168
- }
169
- ),
170
- u === "hover" && /* @__PURE__ */ o(
171
- dt,
172
- {
173
- actionHint: i ? c : void 0,
174
- anchor: l,
175
- item: t,
176
- onMouseEnter: b,
177
- onMouseLeave: m,
178
- open: s
179
- }
180
- )
181
- ] }),
182
- /* @__PURE__ */ w("span", { className: "lens-waterfall-label", children: [
183
- /* @__PURE__ */ o("span", { ref: f, title: p ? t.label : void 0, children: t.label }),
184
- t.annotation && /* @__PURE__ */ o("small", { className: "lens-waterfall-annotation", children: t.annotation })
185
- ] })
186
- ]
187
- }
188
- );
189
- }
190
- function ft({
191
- model: t,
192
- label: a,
193
- interaction: n,
194
- role: i = "img",
195
- splitCallout: u = "hover",
196
- axisUnit: c,
197
- actionHint: s,
198
- children: M
199
- }) {
200
- return /* @__PURE__ */ w(
201
- "div",
202
- {
203
- "aria-label": a,
204
- className: "lens-waterfall",
205
- "data-lens-waterfall": !0,
206
- role: i,
207
- style: {
208
- "--lens-waterfall-count": t.items.length,
209
- "--lens-waterfall-zero": `${t.zero}%`
210
- },
211
- children: [
212
- /* @__PURE__ */ w("div", { className: "lens-waterfall-chart", children: [
213
- /* @__PURE__ */ w("div", { className: "lens-waterfall-axis", "aria-hidden": "true", children: [
214
- c && /* @__PURE__ */ o("span", { className: "lens-waterfall-axis-unit", children: c }),
215
- t.ticks.map((l) => /* @__PURE__ */ o("span", { style: { top: `${l.top}%` }, children: l.label }, l.value))
216
- ] }),
217
- /* @__PURE__ */ w("div", { "aria-hidden": "true", className: "lens-waterfall-rules", children: [
218
- t.ticks.map((l) => /* @__PURE__ */ o(
219
- "span",
220
- {
221
- className: "lens-waterfall-gridline",
222
- style: { top: `${l.top}%` }
223
- },
224
- `grid-${l.value}`
225
- )),
226
- /* @__PURE__ */ o("div", { className: "lens-waterfall-zero" })
227
- ] }),
228
- /* @__PURE__ */ o("div", { className: "lens-waterfall-plot", children: t.items.map((l, f) => /* @__PURE__ */ o(
229
- ut,
230
- {
231
- actionHint: s,
232
- chrome: n == null ? void 0 : n(l, f),
233
- count: t.items.length,
234
- index: f,
235
- item: l,
236
- splitCallout: u
237
- },
238
- `${l.label}-${f}`
239
- )) })
240
- ] }),
241
- M
242
- ]
243
- }
244
- );
245
- }
246
- const pt = 2;
247
- function H(t) {
248
- if (typeof t == "number" && Number.isFinite(t)) return t;
249
- if (typeof t == "string" && t.trim()) {
250
- const a = Number(t);
251
- if (Number.isFinite(a)) return a;
252
- }
253
- return 0;
254
- }
255
- function ht(t) {
256
- return typeof t == "boolean" ? t : typeof t == "number" ? t !== 0 : typeof t == "string" && t.trim().toLowerCase() === "true";
257
- }
258
- const bt = /* @__PURE__ */ new Set([
259
- "neutral",
260
- "positive",
261
- "negative",
262
- "inflow"
263
- ]);
264
- function mt(t) {
265
- return typeof t == "string" && bt.has(t) ? t : void 0;
266
- }
267
- function vt(t, a) {
268
- return t > 0 ? `−${a(t)}` : t < 0 ? `+${a(-t)}` : a(0);
269
- }
270
- function wt(t, a) {
271
- return t > 0 ? `+${a(t)}` : t < 0 ? `−${a(-t)}` : a(0);
272
- }
273
- function gt(t, a) {
274
- const n = a(Math.abs(t));
275
- if (n !== void 0)
276
- return t === 0 ? n : `${t > 0 ? "+" : "−"}${n}`;
277
- }
278
- function D(t, a, n, i) {
279
- const u = L(t, "label") ?? "label", c = L(t, "value") ?? "value", s = L(t, "cut") ?? "cut", M = L(t, "cutLabel") ?? "cutLabel", l = L(t, "final") ?? "final", f = L(t, "annotation"), p = L(t, "tone"), d = L(t, "split"), b = L(t, "splitLabel"), m = S(a, u), y = S(a, c), v = S(a, s), T = S(a, M), I = S(a, l), N = S(a, f), k = S(a, p), e = S(a, d), x = S(a, b), r = Math.max(1, ...a.rows.map((h) => Math.max(0, H(h[y]))));
280
- return a.rows.map((h, g) => {
281
- const C = H(h[y]), $ = H(h[v]), F = C > 0 ? Math.min(100, C / r * 100) : 0;
282
- return {
283
- label: V(h[m], `Stage ${g + 1}`),
284
- value: C,
285
- formattedValue: n(C),
286
- cut: $,
287
- formattedCut: vt($, i),
288
- cutLabel: V(h[T], ""),
289
- final: ht(h[I]),
290
- annotation: N >= 0 ? V(h[N], "") : "",
291
- tone: k >= 0 ? mt(h[k]) : void 0,
292
- split: e >= 0 ? H(h[e]) : 0,
293
- splitLabel: x >= 0 ? V(h[x], "") : "",
294
- width: F > 0 ? Math.max(pt, F) : 0,
295
- rowIndex: g
296
- };
297
- });
298
- }
299
- function xt(t) {
300
- if (!Number.isFinite(t) || t <= 0) return 1;
301
- const a = 10 ** Math.floor(Math.log10(t)), n = t / a;
302
- return n <= 1 ? a : n <= 2 ? 2 * a : n <= 5 ? 5 * a : 10 * a;
303
- }
304
- const Mt = [1, 1.5, 2, 2.5, 3, 4, 5, 7.5];
305
- function U(t, a) {
306
- const n = Math.max(1, a - t), i = xt(n / 3);
307
- let u, c = Number.POSITIVE_INFINITY;
308
- for (let s = 10 ** Math.floor(Math.log10(n / 7)); s <= n; s *= 10)
309
- for (const M of Mt) {
310
- const l = M * s;
311
- if (!Number.isFinite(l) || l <= 0) continue;
312
- const f = a > 0 ? Math.ceil(a / l) * l : 0, p = t < 0 ? Math.floor(t / l) * l : 0, d = Math.round((f - p) / l);
313
- if (d < 2 || d > 7) continue;
314
- const b = f - p;
315
- (b < c || b === c && l > (u ?? 0)) && (c = b, u = l);
316
- }
317
- return u ?? i;
318
- }
319
- function G(t, a, n = a, { formatExact: i = () => {
320
- }, rawValue: u = () => {
321
- } } = {}) {
322
- var k;
323
- const c = t[0];
324
- if (!c) return { items: [], ticks: [], zero: 100 };
325
- const s = [{
326
- label: c.label,
327
- from: 0,
328
- to: c.value,
329
- value: c.value,
330
- kind: "start",
331
- tone: c.tone,
332
- annotation: c.annotation,
333
- // An opening total is not a movement, so it has no part-of-a-movement to
334
- // band off. Only the deduction/addition bars carry a split.
335
- split: 0,
336
- splitLabel: "",
337
- rowIndex: c.rowIndex
338
- }], l = Math.max(...t.map((e) => Math.abs(e.value)), 1) * 1e-6;
339
- for (let e = 1; e < t.length; e += 1) {
340
- const x = t[e - 1], r = t[e];
341
- if (!x || !r) continue;
342
- const h = x.value, g = r.value, C = g - h;
343
- if (r.final && Math.abs(C) < l) {
344
- s.push({
345
- label: r.label,
346
- from: 0,
347
- to: g,
348
- value: g,
349
- kind: "end",
350
- tone: r.tone,
351
- annotation: r.annotation,
352
- split: 0,
353
- splitLabel: "",
354
- rowIndex: r.rowIndex
355
- });
356
- continue;
357
- }
358
- s.push({
359
- label: r.cutLabel || r.label,
360
- from: h,
361
- to: g,
362
- value: C,
363
- kind: C < 0 ? "decrease" : "increase",
364
- tone: r.tone,
365
- annotation: r.annotation,
366
- split: r.split,
367
- splitLabel: r.splitLabel,
368
- rowIndex: r.rowIndex
369
- });
370
- }
371
- if (t.length > 1 && ((k = s.at(-1)) == null ? void 0 : k.kind) !== "end") {
372
- const e = t.at(-1);
373
- e && s.push({
374
- label: e.label,
375
- from: 0,
376
- to: e.value,
377
- value: e.value,
378
- kind: "end",
379
- tone: e.tone,
380
- annotation: e.annotation,
381
- split: 0,
382
- splitLabel: ""
383
- });
384
- }
385
- let f = 0, p = 0;
386
- s.forEach((e) => {
387
- f = Math.min(f, e.from, e.to), p = Math.max(p, e.from, e.to);
388
- });
389
- const d = U(f, p), b = f < 0 ? Math.floor(f / d) * d : 0, m = Math.max(d, Math.ceil(p / d) * d), y = Math.max(1, m - b), v = (e) => Math.max(0, Math.min(100, (m - e) / y * 100)), T = v(0), I = s.map((e, x) => {
390
- const r = v(Math.max(e.from, e.to)), h = v(Math.min(e.from, e.to)), g = e.kind !== "start" && e.kind !== "end" && e.value === 0, C = g ? 0 : Math.max(1.5, h - r), $ = Math.abs(e.split), F = Math.abs(e.value), E = $ > l && $ < F - l;
391
- return {
392
- label: e.label,
393
- value: e.value,
394
- formattedValue: e.kind === "start" || e.kind === "end" ? a(e.value) : wt(e.value, a),
395
- exactValue: e.kind === "start" || e.kind === "end" ? i(e.value) : gt(e.value, i),
396
- rawValue: u(e.value),
397
- top: r,
398
- height: C,
399
- // Share of the bar, not of the plot: the band is painted inside the bar,
400
- // so its percentage resolves against the bar's own box. Scaling by the
401
- // bar's plot height too shrank every band by that height again — a 24.5%
402
- // share of a bar 18% tall drew as 4.5% of it.
403
- splitHeight: E ? 100 * ($ / F) : void 0,
404
- formattedSplit: E ? a($) : void 0,
405
- exactSplit: E ? i($) : void 0,
406
- rawSplit: E ? u($) : void 0,
407
- splitLabel: E ? e.splitLabel : void 0,
408
- // Only a floating bar leaves a balance under it; the totals stand on zero
409
- // already. A bar dipping below zero leaves nothing, hence the clamp.
410
- underlayHeight: e.kind === "start" || e.kind === "end" ? void 0 : Math.max(0, T - h) || void 0,
411
- connectorTop: v(e.to),
412
- zero: T,
413
- kind: e.kind,
414
- checkpoint: e.kind === "end" && x < s.length - 1 ? !0 : void 0,
415
- noMovement: g || void 0,
416
- tone: e.tone,
417
- annotation: e.annotation,
418
- rowIndex: e.rowIndex
419
- };
420
- }), N = [];
421
- for (let e = b; e <= m + d / 10; e += d)
422
- N.push({ value: e, label: n(e), top: v(e) });
423
- return { items: I, ticks: N, zero: v(0) };
424
- }
425
- function yt({ panel: t }) {
426
- var N, k;
427
- const a = et(t.id), n = j(), i = L(t, "value") ?? "value", u = L(t, "cut") ?? "cut", c = R(t.format[i]), s = R(t.format[u] ?? t.format[i]), M = at(t.format[i]), l = nt(t.format[i]), f = A(
428
- (e) => lt(e, t.format[i]),
429
- [t.format, i]
430
- ), p = ot(t.format[i]), d = a.data ? D(t, a.data, c, s) : [], b = ((N = t.presentation) == null ? void 0 : N.bridgeLayout) === "waterfall" ? G(d, c, M, { formatExact: l, rawValue: f }) : { items: [], ticks: [], zero: 100 }, m = b.items.some((e) => e.checkpoint), y = st(t), v = (e) => {
431
- if (!(e === void 0 || !y.action || !a.data))
432
- return y.urlForRow(a.data, a.data.rows[e]);
433
- }, T = (e, x) => {
434
- const r = v(e);
435
- if (!r) return;
436
- const h = (g) => {
437
- y.activate(r, g.currentTarget);
438
- };
439
- return {
440
- role: "button",
441
- tabIndex: 0,
442
- "aria-label": n("cascade.openStage", "Open {name}", { name: x }),
443
- onClick: h,
444
- onKeyDown: (g) => {
445
- g.key !== "Enter" && g.key !== " " || (g.preventDefault(), h(g));
446
- }
447
- };
448
- }, I = !!y.action && d.some((e) => v(e.rowIndex) !== void 0);
449
- return /* @__PURE__ */ o(rt, { panel: t, frame: a, children: ((k = t.presentation) == null ? void 0 : k.bridgeLayout) === "waterfall" ? /* @__PURE__ */ o(
450
- ft,
451
- {
452
- actionHint: n("chart.drillHint", "Select to explore"),
453
- axisUnit: p,
454
- interaction: (e) => T(e.rowIndex, e.label),
455
- label: n("cascade.stages", "{name} stages", { name: t.title }),
456
- model: b,
457
- role: I ? "group" : "img",
458
- children: m && /* @__PURE__ */ w("p", { className: "lens-waterfall-key", children: [
459
- /* @__PURE__ */ o("span", { className: "lens-waterfall-key-item", "data-mark": "checkpoint", children: n("cascade.checkpoint", "Interim total") }),
460
- /* @__PURE__ */ o("span", { className: "lens-waterfall-key-item", "data-mark": "result", children: n("cascade.result", "Closing total") })
461
- ] })
462
- }
463
- ) : /* @__PURE__ */ o(
464
- "div",
465
- {
466
- "aria-label": n("cascade.stages", "{name} stages", { name: t.title }),
467
- className: "lens-cascade",
468
- role: "list",
469
- children: d.map((e, x) => {
470
- const r = T(e.rowIndex, e.label);
471
- return /* @__PURE__ */ w("div", { className: "lens-cascade-step", role: "listitem", children: [
472
- x > 0 && e.cutLabel && /* @__PURE__ */ w("div", { className: "lens-cascade-connector", children: [
473
- /* @__PURE__ */ o("span", { children: e.cutLabel }),
474
- /* @__PURE__ */ o("strong", { "data-direction": e.cut > 0 ? "down" : e.cut < 0 ? "up" : "flat", children: e.formattedCut })
475
- ] }),
476
- /* @__PURE__ */ w(
477
- "div",
478
- {
479
- className: `lens-cascade-stage${e.final ? " lens-cascade-stage-final" : ""}`,
480
- "data-final": e.final || void 0,
481
- "data-tone": e.tone,
482
- ...r,
483
- children: [
484
- /* @__PURE__ */ w("div", { className: "lens-cascade-stage-label", children: [
485
- /* @__PURE__ */ w("span", { className: "lens-cascade-stage-title", children: [
486
- /* @__PURE__ */ o("span", { children: e.label }),
487
- e.annotation && /* @__PURE__ */ o("small", { className: "lens-cascade-stage-annotation", children: e.annotation })
488
- ] }),
489
- /* @__PURE__ */ o("strong", { "data-negative": e.value < 0 || void 0, children: e.formattedValue })
490
- ] }),
491
- /* @__PURE__ */ o("div", { className: "lens-cascade-track", "aria-hidden": "true", children: /* @__PURE__ */ o("span", { style: { width: `${e.width}%` } }) })
492
- ]
493
- }
494
- )
495
- ] }, `${e.label}-${x}`);
496
- })
497
- }
498
- ) });
499
- }
500
- const Tt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
501
- __proto__: null,
502
- CascadePanel: yt,
503
- buildCascadeStages: D,
504
- buildWaterfallModel: G,
505
- waterfallAxisStep: U
506
- }, Symbol.toStringTag, { value: "Module" }));
507
- export {
508
- Tt as C,
509
- ft as W,
510
- D as a,
511
- G as b
512
- };