@graphysdk/react-renderer 0.0.1-plugins.2 → 0.0.1-plugins.4

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.
@@ -1,1527 +0,0 @@
1
- import { jsx as s, jsxs as S, Fragment as z } from "react/jsx-runtime";
2
- import { useEffect as W, memo as $, useMemo as y, useId as he, useState as j, useContext as ft, createContext as pt, useRef as N, useCallback as ue } from "react";
3
- import { useShallow as zt } from "zustand/react/shallow";
4
- import { useStore as fe } from "zustand";
5
- import { getColor as A, getAlpha as E, getSize as vt, getStrokeWidth as Ot, getIdentityKey as Dt, getX as k, getY as T, getXMin as Ft, getXMax as mt, getYMin as Gt, getYMax as yt, GROUP_VARIABLES as nt, getLineType as ot, isDefined as pe, getGroup as Nt, buildFontString as ve, CachedTextMeasurer as kt, HeuristicTextMeasurer as me, buildAverageLineSymbols as ye, formatRuleValue as Se, getAngleExtent as Xt, getRadiusExtent as $t, isGraphConfig as xe, createCompiler as be, convertSpecToInput as Le, RESTING_HOVER_STATE as Te, HoverEngine as ke } from "@graphysdk/viz-engine";
6
- import { createStore as St } from "zustand/vanilla";
7
- import { useMotionValue as Ut, animate as He, motion as B, useSpring as Ht } from "motion/react";
8
- import { curveCatmullRom as Ce, curveLinear as Me, area as Ae, line as Yt, arc as Vt } from "d3-shape";
9
- import { interpolatePath as Ee } from "d3-interpolate-path";
10
- import { getContrast as Ct } from "color2k";
11
- import Ie from "clsx";
12
- const Pe = (e = []) => {
13
- const t = /* @__PURE__ */ new Map();
14
- for (const n of e) t.set(n.type, n);
15
- return (n) => t.get(n) ?? null;
16
- }, Be = 5, _e = (e) => {
17
- if (process.env.NODE_ENV === "production")
18
- return {
19
- emit: () => {
20
- },
21
- subscribe: () => we,
22
- getLastTrigger: () => null,
23
- getLastCompile: () => null,
24
- getCacheStats: () => e.getCacheStats()
25
- };
26
- const t = /* @__PURE__ */ new Set();
27
- let n = null;
28
- return {
29
- emit: (r) => {
30
- const i = e.getLastCompile();
31
- if (i) {
32
- n = r;
33
- for (const a of t) a(r, i);
34
- }
35
- },
36
- subscribe: (r) => (t.add(r), () => {
37
- t.delete(r);
38
- }),
39
- getLastTrigger: () => n,
40
- getLastCompile: () => e.getLastCompile(),
41
- getCacheStats: () => e.getCacheStats()
42
- };
43
- }, Co = () => St((e) => ({
44
- lastCompile: null,
45
- history: [],
46
- nextId: 1,
47
- lastSnapshot: null,
48
- recordCompile: (t, n) => e((r) => {
49
- if (r.lastSnapshot === n) return r;
50
- const i = {
51
- id: r.nextId,
52
- label: Re(t),
53
- stages: n.stages,
54
- durationMs: n.durationMs
55
- };
56
- return {
57
- lastCompile: i,
58
- history: We(r.history, i, Be),
59
- nextId: r.nextId + 1,
60
- lastSnapshot: n
61
- };
62
- })
63
- })), we = () => {
64
- }, Re = (e) => {
65
- switch (e.kind) {
66
- case "init":
67
- return "init";
68
- case "input":
69
- return "input change";
70
- case "data":
71
- return "data change";
72
- case "command":
73
- return e.command.metadata.description;
74
- }
75
- }, We = (e, t, n) => {
76
- const r = e.length >= n ? e.length - (n - 1) : 0;
77
- return [...e.slice(r), t];
78
- };
79
- function Mo(e) {
80
- return e;
81
- }
82
- function Ao(e, t) {
83
- return {
84
- ...t,
85
- geom: e.type,
86
- highlightStrategy: e.highlightStrategy
87
- };
88
- }
89
- var Eo = ["canvasDefault", "canvasBlue", "canvasCyan", "canvasGreen", "canvasYellow", "canvasOrange", "canvasRed", "canvasPink", "canvasPurple", "canvasGray", "canvasInverse"], o = { white: "var(--graphy-white)", black: "var(--graphy-black)", transparent: "var(--graphy-transparent)", grey100: "var(--graphy-grey-100)", grey95: "var(--graphy-grey-95)", grey90: "var(--graphy-grey-90)", grey85: "var(--graphy-grey-85)", grey80: "var(--graphy-grey-80)", grey75: "var(--graphy-grey-75)", grey70: "var(--graphy-grey-70)", grey60: "var(--graphy-grey-60)", grey50: "var(--graphy-grey-50)", grey0: "var(--graphy-grey-0)", greyGradient80: "var(--graphy-grey-gradient-80)", green60: "var(--graphy-green-60)", green50: "var(--graphy-green-50)", red60: "var(--graphy-red-60)", red50: "var(--graphy-red-50)", amber70: "var(--graphy-amber-70)", amber50: "var(--graphy-amber-50)", amber40: "var(--graphy-amber-40)", amber30: "var(--graphy-amber-30)", blue80: "var(--graphy-blue-80)", blue60: "var(--graphy-blue-60)", purple50: "var(--graphy-purple-50)", purple30: "var(--graphy-purple-30)", brand: "var(--graphy-brand)", success: "var(--graphy-success)", warning: "var(--graphy-warning)", alert: "var(--graphy-alert)", textPrimary: "var(--graphy-text-primary)", textSecondary: "var(--graphy-text-secondary)", textDisabled: "var(--graphy-text-disabled)", iconPrimary: "var(--graphy-icon-primary)", iconSecondary: "var(--graphy-icon-secondary)", iconStickerBackground: "var(--graphy-icon-sticker-background)", border100: "var(--graphy-border-100)", border50: "var(--graphy-border-50)", border10: "var(--graphy-border-10)", sunkenBackground: "var(--graphy-sunken-background)", defaultBackground: "var(--graphy-default-background)", raisedBackground: "var(--graphy-raised-background)", overlayBackground: "var(--graphy-overlay-background)", overlayBorderGradient: "var(--graphy-overlay-border-gradient)", graphBackground: "var(--graphy-graph-background)", gridLineColor: "var(--graphy-grid-line-color)", originLineColor: "var(--graphy-origin-line-color)", targetLineColor: "var(--graphy-target-line-color)", targetLineMarkerColor: "var(--graphy-target-line-marker-color)", targetLineLabelTextColor: "var(--graphy-target-line-label-text-color)", legendBackground: "var(--graphy-legend-background)", legendBorderColor: "var(--graphy-legend-border-color)", legendFocusOutlineColor: "var(--graphy-legend-focus-outline-color)", legendTextColor: "var(--graphy-legend-text-color)", dimmedSeriesLabelTextColor: "var(--graphy-dimmed-series-label-text-color)", dimmedSeriesLabelLineColor: "var(--graphy-dimmed-series-label-line-color)", trendNegativeColor: "var(--graphy-trend-negative-color)", trendPositiveColor: "var(--graphy-trend-positive-color)", trendNeutralColor: "var(--graphy-trend-neutral-color)", defaultAnnotationArrowStroke: "var(--graphy-default-annotation-arrow-stroke)", defaultAnnotationShapeStroke: "var(--graphy-default-annotation-shape-stroke)", defaultAnnotationShapeFill: "var(--graphy-default-annotation-shape-fill)", arrowAnnotationStickerOutlineColor: "var(--graphy-arrow-annotation-sticker-outline-color)", arrowAnnotationStickerOutlineColorInverse: "var(--graphy-arrow-annotation-sticker-outline-color-inverse)", annotationFrameBorderColor: "var(--graphy-annotation-frame-border-color)", annotationMenuTriggerIconColor: "var(--graphy-annotation-menu-trigger-icon-color)", heatmapEmptyTileBackground: "var(--graphy-heatmap-empty-tile-background)", dataLabelOutsideBackground: "var(--graphy-data-label-outside-background)", canvasDefault: "var(--graphy-canvas-default)", canvasBlue: "var(--graphy-canvas-blue)", canvasCyan: "var(--graphy-canvas-cyan)", canvasGreen: "var(--graphy-canvas-green)", canvasYellow: "var(--graphy-canvas-yellow)", canvasOrange: "var(--graphy-canvas-orange)", canvasRed: "var(--graphy-canvas-red)", canvasPink: "var(--graphy-canvas-pink)", canvasPurple: "var(--graphy-canvas-purple)", canvasGray: "var(--graphy-canvas-gray)", canvasInverse: "var(--graphy-canvas-inverse)", elevationXs: "var(--graphy-elevation-xs)", elevationSm: "var(--graphy-elevation-sm)", elevationMd: "var(--graphy-elevation-md)", elevationLg: "var(--graphy-elevation-lg)", radiiXs: "var(--graphy-radii-xs)", radiiSm: "var(--graphy-radii-sm)", radiiMd: "var(--graphy-radii-md)", radiiLg: "var(--graphy-radii-lg)", spaceXxs: "var(--graphy-space-xxs)", spaceXs: "var(--graphy-space-xs)", spaceSm: "var(--graphy-space-sm)", spaceMd: "var(--graphy-space-md)", spaceLg: "var(--graphy-space-lg)", spaceXl: "var(--graphy-space-xl)", zIndexToolbar: "var(--graphy-z-index-toolbar)", zIndexToolbarTooltip: "var(--graphy-z-index-toolbar-tooltip)", zIndexToolbarPopover: "var(--graphy-z-index-toolbar-popover)", toolbarBackgroundColor: "var(--graphy-toolbar-background-color)", toolbarButtonBackgroundColor: "var(--graphy-toolbar-button-background-color)", toolbarButtonBackgroundColorHovered: "var(--graphy-toolbar-button-background-color-hovered)", toolbarButtonBackgroundColorSelected: "var(--graphy-toolbar-button-background-color-selected)", toolbarSeparatorColor: "var(--graphy-toolbar-separator-color)", tooltipBackground: "var(--graphy-tooltip-background)", tooltipBorderColor: "var(--graphy-tooltip-border-color)", tooltipHeadingTextColor: "var(--graphy-tooltip-heading-text-color)", tooltipLabelTextColor: "var(--graphy-tooltip-label-text-color)", tooltipValueTextColor: "var(--graphy-tooltip-value-text-color)", tooltipPrimaryRowColor: "var(--graphy-tooltip-primary-row-color)", hoverGuideLineColor: "var(--graphy-hover-guide-line-color)", hoverGuideFillColor: "var(--graphy-hover-guide-fill-color)", hoveredBarBorderColor: "var(--graphy-hovered-bar-border-color)", hoveredPointRingColor: "var(--graphy-hovered-point-ring-color)", pointStrokeColor: "var(--graphy-point-stroke-color)", stackedBarHoverBorderColor: "var(--graphy-stacked-bar-hover-border-color)", fontFamilyDefault: "var(--graphy-font-family-default)", fontFamilyHeading: "var(--graphy-font-family-heading)", fontWeightRegular: "var(--graphy-font-weight-regular)", fontWeightMedium: "var(--graphy-font-weight-medium)", fontWeightSemibold: "var(--graphy-font-weight-semibold)", fontWeightBold: "var(--graphy-font-weight-bold)", fontWeightExtraBold: "var(--graphy-font-weight-extra-bold)", fontWeightBlack: "var(--graphy-font-weight-black)", textScale: "var(--graphy-text-scale)", fontSizeXxs: "var(--graphy-font-size-xxs)", fontSizeXs: "var(--graphy-font-size-xs)", fontSizeSm: "var(--graphy-font-size-sm)", fontSizeMd: "var(--graphy-font-size-md)", fontSizeLg: "var(--graphy-font-size-lg)", fontSizeXl: "var(--graphy-font-size-xl)", fontLineHeightXxs: "var(--graphy-font-line-height-xxs)", fontLineHeightXs: "var(--graphy-font-line-height-xs)", fontLineHeightSm: "var(--graphy-font-line-height-sm)", fontLineHeightMd: "var(--graphy-font-line-height-md)", fontLineHeightLg: "var(--graphy-font-line-height-lg)", fontLineHeightXl: "var(--graphy-font-line-height-xl)", fontSizeEditorBody: "var(--graphy-font-size-editor-body)", fontSizeHeadingSm: "var(--graphy-font-size-heading-sm)", fontSizeHeadingMd: "var(--graphy-font-size-heading-md)", fontSizeHeadingLg: "var(--graphy-font-size-heading-lg)", fontLineHeightEditorBody: "var(--graphy-font-line-height-editor-body)", fontLineHeightHeadingSm: "var(--graphy-font-line-height-heading-sm)", fontLineHeightHeadingMd: "var(--graphy-font-line-height-heading-md)", fontLineHeightHeadingLg: "var(--graphy-font-line-height-heading-lg)", fontTickLabel: "var(--graphy-font-tick-label)", fontAxisLabel: "var(--graphy-font-axis-label)", fontDataLabel: "var(--graphy-font-data-label)", fontStackTotal: "var(--graphy-font-stack-total)", fontLegendLabel: "var(--graphy-font-legend-label)", fontSeriesLabel: "var(--graphy-font-series-label)", fontTooltipLabel: "var(--graphy-font-tooltip-label)", fontTooltipHeading: "var(--graphy-font-tooltip-heading)", fontTooltipFooter: "var(--graphy-font-tooltip-footer)", fontJumboTooltipLabel: "var(--graphy-font-jumbo-tooltip-label)", fontJumboTooltip: "var(--graphy-font-jumbo-tooltip)", fontMiniTooltipLabel: "var(--graphy-font-mini-tooltip-label)", fontMiniTooltipFooter: "var(--graphy-font-mini-tooltip-footer)", fontTooltipCaption: "var(--graphy-font-tooltip-caption)", fontTooltipCaptionSmall: "var(--graphy-font-tooltip-caption-small)", fontTrendTag: "var(--graphy-font-trend-tag)", fontTrendTagSmall: "var(--graphy-font-trend-tag-small)", fontGoalLineLabel: "var(--graphy-font-goal-line-label)", fontPieLabel: "var(--graphy-font-pie-label)", fontPieChartTotal: "var(--graphy-font-pie-chart-total)", fontDifferenceArrowSmall: "var(--graphy-font-difference-arrow-small)", fontDifferenceArrowMedium: "var(--graphy-font-difference-arrow-medium)", fontDifferenceArrowLarge: "var(--graphy-font-difference-arrow-large)", fontButton: "var(--graphy-font-button)", fontInput: "var(--graphy-font-input)", fontInputLabel: "var(--graphy-font-input-label)", fontSelectLabel: "var(--graphy-font-select-label)", fontSelectDescription: "var(--graphy-font-select-description)", fontColorSelectLabel: "var(--graphy-font-color-select-label)", fontMenuTitle: "var(--graphy-font-menu-title)", fontMenuGroupTitle: "var(--graphy-font-menu-group-title)", fontMenuItemLabel: "var(--graphy-font-menu-item-label)", fontMenuItemLabelSecondary: "var(--graphy-font-menu-item-label-secondary)", fontUITooltip: "var(--graphy-font-uitooltip)", fontUITooltipSecondary: "var(--graphy-font-uitooltip-secondary)", fontErrorBoundaryTitle: "var(--graphy-font-error-boundary-title)", fontErrorBoundaryMessage: "var(--graphy-font-error-boundary-message)", fontTableCell: "var(--graphy-font-table-cell)", fontTableHeaderCell: "var(--graphy-font-table-header-cell)", fontSourceLabel: "var(--graphy-font-source-label)", fontSourceLink: "var(--graphy-font-source-link)", fontTextEditorH1: "var(--graphy-font-text-editor-h1)", fontTextEditorH2: "var(--graphy-font-text-editor-h2)", fontTextEditorH3: "var(--graphy-font-text-editor-h3)", fontTextEditorH6: "var(--graphy-font-text-editor-h6)", fontTextEditorBody: "var(--graphy-font-text-editor-body)", fontTextEditorLink: "var(--graphy-font-text-editor-link)", fontHighlightModeTitle: "var(--graphy-font-highlight-mode-title)", fontHighlightModeSubtitle: "var(--graphy-font-highlight-mode-subtitle)" };
90
- const xt = 1, ze = 8, Oe = 12;
91
- o.pointStrokeColor;
92
- const De = 1;
93
- function Io(e) {
94
- return e;
95
- }
96
- function D(e) {
97
- return 1 - e;
98
- }
99
- const m = (e) => `${Number.parseFloat((e * 100).toFixed(4))}%`, Fe = 2, Ge = 0.7, X = ({ hit: e }) => {
100
- const t = A(e.observation), n = (E(e.observation) ?? xt) * Ge, r = (vt(e.observation) ?? ze) / 2;
101
- return /* @__PURE__ */ s(
102
- "circle",
103
- {
104
- cx: m(e.x),
105
- cy: m(D(e.y)),
106
- r,
107
- fill: t,
108
- opacity: n,
109
- stroke: o.hoveredPointRingColor,
110
- strokeWidth: Fe,
111
- "data-testid": "companion-point"
112
- }
113
- );
114
- }, jt = 0.3, Kt = 1, H = {
115
- type: "spring",
116
- stiffness: 500,
117
- damping: 60,
118
- mass: 1
119
- }, Jt = 1, Ne = 2, Zt = (e) => e === "catmull-rom" ? Ce : Me, rt = (e) => {
120
- switch (e) {
121
- case "dashed":
122
- return "8 4";
123
- case "dotted":
124
- return "2 2";
125
- case "solid":
126
- return;
127
- }
128
- }, at = (e, t) => t.lineWidth !== "auto" ? t.lineWidth : Ot(e) ?? Ne, it = (e) => (t) => `${e}:${Dt(t)}`, ht = (e, t) => {
129
- const n = Ut(e);
130
- return W(() => {
131
- const r = Ee(n.get(), e);
132
- He(0, 1, {
133
- ...t,
134
- onUpdate: (i) => {
135
- const a = r(i);
136
- return n.set(a);
137
- }
138
- });
139
- }, [t, e, n]), n;
140
- };
141
- var U = "_1d8mpa10";
142
- const qt = (e, t) => {
143
- const n = Zt(t.interpolate), r = Ae().curve(n), i = Yt().curve(n);
144
- if (e.mainAxis === "y") {
145
- const a = (d) => D(T(d) ?? 0), c = (d) => Ft(d) ?? 0, l = (d) => mt(d) ?? k(d) ?? 0;
146
- r.y(a).x0(c).x1(l), i.y(a).x(l);
147
- } else {
148
- const a = (d) => k(d) ?? 0, c = (d) => D(Gt(d) ?? 0), l = (d) => D(yt(d) ?? T(d) ?? 0);
149
- r.x(a).y0(c).y1(l), i.x(a).y(l);
150
- }
151
- if (t.missingValues === "gap") {
152
- const a = (c) => k(c) !== null && T(c) !== null;
153
- r.defined(a), i.defined(a);
154
- }
155
- return { lineGenerator: i, areaGenerator: r };
156
- }, Qt = (e, t) => t !== "connect" ? e : e.filter((n) => k(n) !== null && T(n) !== null), Xe = $(function({
157
- layer: t,
158
- coordSystem: n,
159
- isAnimated: r
160
- }) {
161
- const { lineGenerator: i, areaGenerator: a } = y(
162
- () => qt(n, t.params),
163
- [t.params, n]
164
- ), c = y(() => {
165
- const l = it(t.id), d = [];
166
- return t.data.groupBy(nt.group).forEach((h) => {
167
- const g = Qt([...h], t.params.missingValues), f = a(g), p = i(g);
168
- if (!f || !p) return;
169
- const v = g[0];
170
- if (!v) return;
171
- const x = A(v), R = E(v), L = at(v, t.params), C = rt(ot(v));
172
- d.push({
173
- key: l(v),
174
- areaPath: f,
175
- linePath: p,
176
- color: x,
177
- fillOpacity: R ?? jt,
178
- strokeWidth: L,
179
- strokeOpacity: Kt,
180
- strokeDasharray: C
181
- });
182
- }), d;
183
- }, [a, i, t.data, t.id, t.params]);
184
- return /* @__PURE__ */ s(
185
- "svg",
186
- {
187
- viewBox: "0 0 1 1",
188
- preserveAspectRatio: "none",
189
- width: "100%",
190
- height: "100%",
191
- "data-geom": "area",
192
- className: U,
193
- children: c.map((l) => /* @__PURE__ */ s(
194
- $e,
195
- {
196
- areaPath: l.areaPath,
197
- linePath: l.linePath,
198
- color: l.color,
199
- fillOpacity: l.fillOpacity,
200
- strokeWidth: l.strokeWidth,
201
- strokeOpacity: l.strokeOpacity,
202
- strokeDasharray: l.strokeDasharray,
203
- isAnimated: r
204
- },
205
- l.key
206
- ))
207
- }
208
- );
209
- }), $e = ({
210
- areaPath: e,
211
- linePath: t,
212
- color: n,
213
- fillOpacity: r,
214
- strokeWidth: i,
215
- strokeOpacity: a,
216
- strokeDasharray: c,
217
- isAnimated: l
218
- }) => l ? /* @__PURE__ */ s(
219
- Ue,
220
- {
221
- areaPath: e,
222
- linePath: t,
223
- color: n,
224
- fillOpacity: r,
225
- strokeWidth: i,
226
- strokeOpacity: a,
227
- strokeDasharray: c
228
- }
229
- ) : /* @__PURE__ */ S("g", { children: [
230
- /* @__PURE__ */ s("path", { d: e, fill: n, fillOpacity: r, stroke: "none" }),
231
- /* @__PURE__ */ s(
232
- "path",
233
- {
234
- d: t,
235
- fill: "none",
236
- stroke: n,
237
- strokeWidth: i,
238
- strokeOpacity: a,
239
- strokeDasharray: c,
240
- vectorEffect: "non-scaling-stroke"
241
- }
242
- )
243
- ] }), Ue = ({
244
- areaPath: e,
245
- linePath: t,
246
- color: n,
247
- fillOpacity: r,
248
- strokeWidth: i,
249
- strokeOpacity: a,
250
- strokeDasharray: c
251
- }) => {
252
- const l = ht(e, H), d = ht(t, H);
253
- return /* @__PURE__ */ S("g", { children: [
254
- /* @__PURE__ */ s(B.path, { d: l, fill: n, fillOpacity: r, stroke: "none" }),
255
- /* @__PURE__ */ s(
256
- B.path,
257
- {
258
- d,
259
- fill: "none",
260
- stroke: n,
261
- strokeWidth: i,
262
- strokeOpacity: a,
263
- strokeDasharray: c,
264
- vectorEffect: "non-scaling-stroke"
265
- }
266
- )
267
- ] });
268
- };
269
- var Ye = "_46ebsf0";
270
- const lt = 1, Ve = 2, je = 1, Ke = Oe / 2, Je = 2.25, bt = ({ hit: e, ...t }) => {
271
- const n = Ze(e.observation), r = A(e.observation), i = E(e.observation) ?? xt, a = m(e.x), c = m(D(e.y)), d = n + lt / 2 + je + lt / 2;
272
- return /* @__PURE__ */ S("g", { ...t, className: Ye, children: [
273
- /* @__PURE__ */ s(
274
- "circle",
275
- {
276
- cx: a,
277
- cy: c,
278
- r: d,
279
- fill: "none",
280
- stroke: o.hoveredPointRingColor,
281
- strokeWidth: Ve
282
- }
283
- ),
284
- /* @__PURE__ */ s(
285
- "circle",
286
- {
287
- cx: a,
288
- cy: c,
289
- r: n,
290
- fill: r,
291
- opacity: i,
292
- stroke: o.hoveredPointRingColor,
293
- strokeWidth: lt
294
- }
295
- )
296
- ] });
297
- }, Ze = (e) => {
298
- const t = vt(e);
299
- return pe(t) ? t / Je : Ke;
300
- }, qe = ({ layer: e, coordSystem: t, primary: n, companions: r }) => {
301
- const i = Nt(n.observation), a = y(() => {
302
- const p = e.data.filter(nt.group, "eq", i);
303
- return Qt([...p], e.params.missingValues);
304
- }, [e.data, e.params.missingValues, i]), { areaPath: c, linePath: l } = y(() => {
305
- const { lineGenerator: p, areaGenerator: v } = qt(t, e.params);
306
- return {
307
- areaPath: v(a) ?? "",
308
- linePath: p(a) ?? ""
309
- };
310
- }, [t, e.params, a]);
311
- if (!c || !l) return null;
312
- const d = A(n.observation), h = E(n.observation) ?? jt, g = at(n.observation, e.params), f = rt(ot(n.observation));
313
- return /* @__PURE__ */ S("g", { "data-testid": "hovered-area", children: [
314
- /* @__PURE__ */ S(
315
- "svg",
316
- {
317
- viewBox: "0 0 1 1",
318
- preserveAspectRatio: "none",
319
- width: "100%",
320
- height: "100%",
321
- "data-geom": "area",
322
- className: U,
323
- children: [
324
- /* @__PURE__ */ s("path", { d: c, fill: d, fillOpacity: h, stroke: "none", "data-testid": "hovered-area-fill" }),
325
- /* @__PURE__ */ s(
326
- "path",
327
- {
328
- d: l,
329
- fill: "none",
330
- stroke: d,
331
- strokeWidth: g,
332
- strokeOpacity: Kt,
333
- strokeDasharray: f,
334
- vectorEffect: "non-scaling-stroke",
335
- "data-testid": "hovered-area-edge"
336
- }
337
- )
338
- ]
339
- }
340
- ),
341
- r.map((p) => /* @__PURE__ */ s(X, { hit: p }, `companion-${p.layerId}-${p.pointIndex}`)),
342
- /* @__PURE__ */ s(bt, { hit: n, "data-testid": "hovered-area-point" })
343
- ] });
344
- }, Qe = {
345
- geom: "area",
346
- coord: "cartesian",
347
- highlightStrategy: "overlay-anchor",
348
- guideMode: "continuous",
349
- render: ({ layer: e, coordSystem: t, isAnimated: n }) => /* @__PURE__ */ s(Xe, { layer: e, coordSystem: t, isAnimated: n }),
350
- renderHover: ({ layer: e, coordSystem: t, primary: n, group: r, related: i }) => /* @__PURE__ */ s(qe, { layer: e, coordSystem: t, primary: n, companions: [...r, ...i] }),
351
- renderHoverCompanions: ({ related: e }) => /* @__PURE__ */ s(z, { children: e.map((t) => /* @__PURE__ */ s(X, { hit: t }, `companion-${t.layerId}-${t.pointIndex}`)) }),
352
- getOverlayAnchor: ({ observation: e, coordSystem: t }) => {
353
- if (t.mainAxis === "x") {
354
- const i = k(e), a = yt(e) ?? T(e);
355
- return i === null || a === null ? null : { x: i, y: a };
356
- }
357
- const n = T(e), r = mt(e) ?? k(e);
358
- return n === null || r === null ? null : { x: r, y: n };
359
- }
360
- }, te = 1, J = 4, ee = (e, t) => {
361
- const n = Ft(t), r = mt(t), i = Gt(t), a = yt(t) ?? T(t);
362
- if (n === null || r === null || i === null || a === null) return null;
363
- if (e === "x") {
364
- let d = 1 - a, h = a - i;
365
- return h < 0 && (d += h, h = -h), { x: n, y: d, width: r - n, height: h };
366
- }
367
- let c = n, l = r - n;
368
- return l < 0 && (c += l, l = -l), { x: c, y: 1 - a, width: l, height: a - i };
369
- }, tn = $(function({
370
- layer: t,
371
- coordSystem: n,
372
- isAnimated: r
373
- }) {
374
- const i = he(), a = y(() => {
375
- const l = it(t.id), d = /* @__PURE__ */ new Map();
376
- for (const h of t.data) {
377
- const g = ee(n.mainAxis, h);
378
- if (!g) continue;
379
- const f = nn(n.mainAxis, g), p = d.get(f), v = {
380
- key: l(h),
381
- ...g,
382
- fill: A(h),
383
- opacity: E(h) ?? te
384
- };
385
- p ? p.push(v) : d.set(f, [v]);
386
- }
387
- return [...d.entries()].map(([h, g]) => ({
388
- id: `${i}${h}`,
389
- bars: g,
390
- ...on(g)
391
- }));
392
- }, [i, n.mainAxis, t]), c = a.filter((l) => l.bars.length > 1);
393
- return /* @__PURE__ */ S(z, { children: [
394
- c.length > 0 && /* @__PURE__ */ s("defs", { children: c.map((l) => /* @__PURE__ */ s("clipPath", { id: l.id, children: /* @__PURE__ */ s(en, { column: l, isAnimated: r }) }, l.id)) }),
395
- a.map((l) => {
396
- const [d] = l.bars;
397
- if (l.bars.length === 1 && d !== void 0) {
398
- const { key: h, ...g } = d;
399
- return /* @__PURE__ */ s(Mt, { ...g, rx: J, isAnimated: r }, h);
400
- }
401
- return /* @__PURE__ */ s("g", { clipPath: `url(#${l.id})`, children: l.bars.map((h) => {
402
- const { key: g, ...f } = h;
403
- return /* @__PURE__ */ s(Mt, { ...f, isAnimated: r }, g);
404
- }) }, l.id);
405
- })
406
- ] });
407
- }), Mt = ({ isAnimated: e, rx: t, ...n }) => e ? /* @__PURE__ */ s(
408
- B.rect,
409
- {
410
- initial: !1,
411
- style: { transformBox: "view-box" },
412
- transition: H,
413
- fill: n.fill,
414
- opacity: n.opacity,
415
- rx: t,
416
- animate: {
417
- x: m(n.x),
418
- y: m(n.y),
419
- width: m(n.width),
420
- height: m(n.height),
421
- opacity: n.opacity
422
- }
423
- }
424
- ) : /* @__PURE__ */ s(
425
- "rect",
426
- {
427
- style: { transformBox: "view-box" },
428
- x: m(n.x),
429
- y: m(n.y),
430
- width: m(n.width),
431
- height: m(n.height),
432
- fill: n.fill,
433
- opacity: n.opacity,
434
- rx: t
435
- }
436
- ), en = ({ column: e, isAnimated: t }) => t ? /* @__PURE__ */ s(
437
- B.rect,
438
- {
439
- initial: !1,
440
- style: { transformBox: "view-box" },
441
- transition: H,
442
- rx: J,
443
- animate: {
444
- x: m(e.x),
445
- y: m(e.y),
446
- width: m(e.width),
447
- height: m(e.height)
448
- }
449
- }
450
- ) : /* @__PURE__ */ s(
451
- "rect",
452
- {
453
- x: m(e.x),
454
- y: m(e.y),
455
- width: m(e.width),
456
- height: m(e.height),
457
- rx: J
458
- }
459
- ), nn = (e, t) => e === "x" ? `${t.x}-${t.width}` : `${t.y}-${t.height}`, on = (e) => {
460
- let t = 1 / 0, n = 1 / 0, r = -1 / 0, i = -1 / 0;
461
- for (const a of e)
462
- a.x < t && (t = a.x), a.y < n && (n = a.y), a.x + a.width > r && (r = a.x + a.width), a.y + a.height > i && (i = a.y + a.height);
463
- return { x: t, y: n, width: r - t, height: i - n };
464
- };
465
- var rn = "_1i6dtb60";
466
- const V = 3, an = ({ coordSystem: e, primary: t, panelRect: n }) => {
467
- const r = ee(e.mainAxis, t.observation);
468
- if (!r) return null;
469
- const i = r.x * n.width, a = r.y * n.height, c = r.width * n.width, l = r.height * n.height, d = i - V, h = a - V, g = c + V * 2, f = l + V * 2, p = J + V, v = A(t.observation), x = E(t.observation) ?? te;
470
- return /* @__PURE__ */ S("g", { "data-testid": "hovered-bar", children: [
471
- /* @__PURE__ */ s(
472
- "rect",
473
- {
474
- x: d,
475
- y: h,
476
- width: g,
477
- height: f,
478
- rx: p,
479
- fill: o.hoveredBarBorderColor,
480
- className: rn,
481
- "data-testid": "hovered-bar-border"
482
- }
483
- ),
484
- /* @__PURE__ */ s(
485
- "rect",
486
- {
487
- x: m(r.x),
488
- y: m(r.y),
489
- width: m(r.width),
490
- height: m(r.height),
491
- fill: v,
492
- opacity: x,
493
- rx: J,
494
- "data-testid": "hovered-bar-fill"
495
- }
496
- )
497
- ] });
498
- }, sn = {
499
- geom: "bar",
500
- coord: "cartesian",
501
- highlightStrategy: "observation-rerender",
502
- guideMode: "bar",
503
- render: ({ layer: e, coordSystem: t, isAnimated: n }) => /* @__PURE__ */ s(tn, { layer: e, coordSystem: t, isAnimated: n }),
504
- renderHover: ({ coordSystem: e, primary: t, panelRect: n }) => /* @__PURE__ */ s(an, { coordSystem: e, primary: t, panelRect: n }),
505
- renderHoverCompanions: () => null
506
- }, ne = (e) => {
507
- const t = Yt().x((n) => k(n) ?? 0).y((n) => D(T(n) ?? 0)).curve(Zt(e.interpolate));
508
- return e.missingValues === "gap" && t.defined((n) => k(n) !== null && T(n) !== null), t;
509
- }, oe = (e, t) => t !== "connect" ? e : e.filter((n) => k(n) !== null && T(n) !== null), ln = $(function({ layer: t, isAnimated: n }) {
510
- const r = y(() => ne(t.params), [t.params]), i = y(() => {
511
- const a = it(t.id), c = [];
512
- return t.data.groupBy(nt.group).forEach((l) => {
513
- const d = oe([...l], t.params.missingValues), h = r(d);
514
- if (!h) return;
515
- const g = d[0];
516
- if (!g) return;
517
- const f = A(g), p = E(g), v = at(g, t.params), x = rt(ot(g));
518
- c.push({
519
- key: a(g),
520
- pathData: h,
521
- color: f,
522
- opacity: p ?? Jt,
523
- strokeWidth: v,
524
- strokeDasharray: x
525
- });
526
- }), c;
527
- }, [r, t.data, t.id, t.params]);
528
- return /* @__PURE__ */ s(
529
- "svg",
530
- {
531
- viewBox: "0 0 1 1",
532
- preserveAspectRatio: "none",
533
- width: "100%",
534
- height: "100%",
535
- "data-geom": "line",
536
- className: U,
537
- children: i.map((a) => /* @__PURE__ */ s(
538
- cn,
539
- {
540
- pathData: a.pathData,
541
- color: a.color,
542
- strokeWidth: a.strokeWidth,
543
- opacity: a.opacity,
544
- strokeDasharray: a.strokeDasharray,
545
- isAnimated: n
546
- },
547
- a.key
548
- ))
549
- }
550
- );
551
- }), cn = ({ pathData: e, color: t, strokeWidth: n, opacity: r, strokeDasharray: i, isAnimated: a }) => a ? /* @__PURE__ */ s(
552
- dn,
553
- {
554
- pathData: e,
555
- color: t,
556
- strokeWidth: n,
557
- opacity: r,
558
- strokeDasharray: i
559
- }
560
- ) : /* @__PURE__ */ s(
561
- "path",
562
- {
563
- d: e,
564
- fill: "none",
565
- stroke: t,
566
- strokeWidth: n,
567
- opacity: r,
568
- strokeDasharray: i,
569
- vectorEffect: "non-scaling-stroke"
570
- }
571
- ), dn = ({
572
- pathData: e,
573
- color: t,
574
- strokeWidth: n,
575
- opacity: r,
576
- strokeDasharray: i
577
- }) => {
578
- const a = ht(e, H);
579
- return /* @__PURE__ */ s(
580
- B.path,
581
- {
582
- d: a,
583
- fill: "none",
584
- stroke: t,
585
- strokeWidth: n,
586
- opacity: r,
587
- strokeDasharray: i,
588
- vectorEffect: "non-scaling-stroke"
589
- }
590
- );
591
- }, gn = ({ layer: e, primary: t, companions: n }) => {
592
- const r = Nt(t.observation), i = y(() => {
593
- const g = e.data.filter(nt.group, "eq", r);
594
- return oe([...g], e.params.missingValues);
595
- }, [e.data, e.params.missingValues, r]), a = y(() => ne(e.params)(i), [e.params, i]);
596
- if (!a) return null;
597
- const c = A(t.observation), l = E(t.observation) ?? Jt, d = at(t.observation, e.params), h = rt(ot(t.observation));
598
- return /* @__PURE__ */ S("g", { "data-testid": "hovered-line", children: [
599
- /* @__PURE__ */ s(
600
- "svg",
601
- {
602
- viewBox: "0 0 1 1",
603
- preserveAspectRatio: "none",
604
- width: "100%",
605
- height: "100%",
606
- "data-geom": "line",
607
- className: U,
608
- children: /* @__PURE__ */ s(
609
- "path",
610
- {
611
- d: a,
612
- fill: "none",
613
- stroke: c,
614
- strokeWidth: d,
615
- opacity: l,
616
- strokeDasharray: h,
617
- vectorEffect: "non-scaling-stroke",
618
- "data-testid": "hovered-line-path"
619
- }
620
- )
621
- }
622
- ),
623
- n.map((g) => /* @__PURE__ */ s(X, { hit: g }, `companion-${g.layerId}-${g.pointIndex}`)),
624
- /* @__PURE__ */ s(bt, { hit: t, "data-testid": "hovered-line-point" })
625
- ] });
626
- }, hn = {
627
- geom: "line",
628
- coord: "cartesian",
629
- highlightStrategy: "overlay-anchor",
630
- guideMode: "continuous",
631
- render: ({ layer: e, isAnimated: t }) => /* @__PURE__ */ s(ln, { layer: e, isAnimated: t }),
632
- renderHover: ({ layer: e, primary: t, group: n, related: r }) => /* @__PURE__ */ s(gn, { layer: e, primary: t, companions: [...n, ...r] }),
633
- renderHoverCompanions: ({ related: e }) => /* @__PURE__ */ s(z, { children: e.map((t) => /* @__PURE__ */ s(X, { hit: t }, `companion-${t.layerId}-${t.pointIndex}`)) }),
634
- getOverlayAnchor: ({ observation: e }) => {
635
- const t = k(e), n = T(e);
636
- return t === null || n === null ? null : { x: t, y: n };
637
- }
638
- }, un = $(function({ layer: t, isAnimated: n }) {
639
- const r = y(() => {
640
- const i = [];
641
- for (const a of t.data) {
642
- const c = k(a), l = T(a);
643
- if (c === null || l === null)
644
- continue;
645
- const d = A(a), h = E(a), g = vt(a), f = Ot(a);
646
- i.push({
647
- key: Dt(a),
648
- // points declare index-based identity in the compiler for smoother transitions
649
- cx: c,
650
- cy: D(l),
651
- radius: (g ?? t.params.size) / 2,
652
- fill: d,
653
- stroke: o.pointStrokeColor,
654
- opacity: h ?? xt,
655
- strokeWidth: f ?? De
656
- });
657
- }
658
- return i;
659
- }, [t.data, t.params.size]);
660
- return /* @__PURE__ */ s(z, { children: r.map((i) => n ? /* @__PURE__ */ s(
661
- B.circle,
662
- {
663
- initial: !1,
664
- transition: H,
665
- fill: i.fill,
666
- stroke: i.stroke,
667
- strokeWidth: i.strokeWidth,
668
- animate: {
669
- cx: m(i.cx),
670
- cy: m(i.cy),
671
- r: i.radius,
672
- opacity: i.opacity
673
- }
674
- },
675
- i.key
676
- ) : /* @__PURE__ */ s(
677
- "circle",
678
- {
679
- cx: m(i.cx),
680
- cy: m(i.cy),
681
- r: i.radius,
682
- fill: i.fill,
683
- opacity: i.opacity,
684
- stroke: i.stroke,
685
- strokeWidth: i.strokeWidth
686
- },
687
- i.key
688
- )) });
689
- }), fn = {
690
- geom: "point",
691
- coord: "cartesian",
692
- highlightStrategy: "overlay-anchor",
693
- guideMode: null,
694
- render: ({ layer: e, isAnimated: t }) => /* @__PURE__ */ s(un, { layer: e, isAnimated: t }),
695
- renderHover: ({ primary: e, group: t, related: n }) => /* @__PURE__ */ S("g", { "data-testid": "hovered-point", children: [
696
- [...t, ...n].map((r) => /* @__PURE__ */ s(X, { hit: r }, `companion-${r.layerId}-${r.pointIndex}`)),
697
- /* @__PURE__ */ s(bt, { hit: e })
698
- ] }),
699
- renderHoverCompanions: ({ related: e }) => /* @__PURE__ */ s(z, { children: e.map((t) => /* @__PURE__ */ s(X, { hit: t }, `companion-${t.layerId}-${t.pointIndex}`)) }),
700
- getOverlayAnchor: ({ observation: e }) => {
701
- const t = k(e), n = T(e);
702
- return t === null || n === null ? null : { x: t, y: n };
703
- }
704
- }, pn = 10, vn = (e, t) => e * pn * t, mn = /\p{Emoji_Presentation}|\p{Emoji}\uFE0F/gu, re = "😀";
705
- class Lt {
706
- constructor() {
707
- this.emojiCorrections = /* @__PURE__ */ new Map(), this.currentFont = "";
708
- const n = new OffscreenCanvas(1, 1).getContext("2d");
709
- if (!n)
710
- throw new Error("Failed to create OffscreenCanvas 2D context");
711
- this.ctx = n;
712
- }
713
- /**
714
- * Creates a CanvasTextMeasurer after all declared `@font-face` fonts
715
- * have finished loading. This ensures measurements use the correct font
716
- * glyphs from the first call, avoiding stale cache entries.
717
- *
718
- * Falls back to immediate construction if `document.fonts` is unavailable
719
- * (e.g. non-browser environment).
720
- *
721
- * Note: document.fonts.ready still resolves even if some fonts fail to load.
722
- */
723
- static async create() {
724
- return typeof document < "u" && "fonts" in document && await document.fonts.ready, new Lt();
725
- }
726
- measureText(t, n) {
727
- const r = ve(n);
728
- this.setFont(r);
729
- const { width: i, fontBoundingBoxAscent: a, fontBoundingBoxDescent: c } = this.ctx.measureText(t);
730
- let l = i;
731
- const d = yn(t);
732
- if (d > 0) {
733
- const h = this.getEmojiCorrection(r);
734
- l -= h * d;
735
- }
736
- return {
737
- width: l,
738
- height: a + c,
739
- ascent: a,
740
- descent: c
741
- };
742
- }
743
- /**
744
- * Skip redundant `ctx.font` assignments
745
- * Setting the property triggers CSS font string parsing and font resolution.
746
- */
747
- setFont(t) {
748
- this.currentFont !== t && (this.ctx.font = t, this.currentFont = t);
749
- }
750
- /**
751
- * Computes the per-emoji width correction for a given font.
752
- * Measures the reference emoji in both Canvas and DOM, caches the difference.
753
- * Returns 0 if DOM is unavailable or the difference is negligible (< 0.5px).
754
- */
755
- getEmojiCorrection(t) {
756
- const n = this.emojiCorrections.get(t);
757
- if (n !== void 0) return n;
758
- this.setFont(t);
759
- const r = this.ctx.measureText(re).width, i = Sn(t);
760
- let a = 0;
761
- if (i !== null) {
762
- const c = r - i;
763
- a = c > 0.5 ? c : 0;
764
- }
765
- return this.emojiCorrections.set(t, a), a;
766
- }
767
- }
768
- let w = null;
769
- const yn = (e) => {
770
- const t = e.match(mn);
771
- return t ? t.length : 0;
772
- }, Sn = (e) => {
773
- const t = xn();
774
- return t ? (t.style.font = e, t.getBoundingClientRect().width) : null;
775
- }, xn = () => typeof document > "u" ? null : (w || (w = document.createElement("span"), w.style.position = "absolute", w.style.visibility = "hidden", w.style.whiteSpace = "nowrap", w.style.left = "-9999px", w.textContent = re, document.body.appendChild(w)), w), ae = pt(null), Po = ({ children: e, measurer: t }) => {
776
- const [n, r] = j(null);
777
- W(() => {
778
- if (t !== void 0) return;
779
- let a = !1;
780
- const c = () => {
781
- a || r(Ln());
782
- };
783
- return (async () => {
784
- typeof document < "u" && "fonts" in document && await document.fonts.ready, c();
785
- })(), typeof document < "u" && "fonts" in document && document.fonts.addEventListener("loadingdone", c), () => {
786
- a = !0, typeof document < "u" && "fonts" in document && document.fonts.removeEventListener("loadingdone", c);
787
- };
788
- }, [t]);
789
- const i = t ?? n;
790
- return i === null ? null : /* @__PURE__ */ s(ae.Provider, { value: i, children: e });
791
- }, bn = () => {
792
- const e = ft(ae);
793
- if (e === null)
794
- throw new Error("useTextMeasurer must be used inside a <TextMeasurerProvider>.");
795
- return e;
796
- }, Ln = () => {
797
- try {
798
- return new kt(new Lt());
799
- } catch {
800
- return new kt(new me());
801
- }
802
- }, Tt = `'Inter', -apple-system, BlinkMacSystemFont, 'Open Sans', 'Segoe UI', 'Roboto', 'Oxygen-Sans', 'Ubuntu',
803
- 'Cantarell', 'Helvetica Neue', 'NotoSansArabic', 'NotoSansJP', 'NotoSansSC', 'NotoSansKR', 'NotoSerifKR', sans-serif, 'Apple Color Emoji', 'NotoColorEmoji'`, Tn = Tt, O = {
804
- regular: 400,
805
- medium: 500,
806
- semibold: 600,
807
- bold: 700,
808
- extraBold: 800,
809
- black: 900
810
- }, M = {
811
- xxs: 1,
812
- xs: 1.1,
813
- sm: 1.2,
814
- md: 1.4,
815
- lg: 1.6,
816
- xl: 2,
817
- editorBody: 1.5,
818
- headingSm: 1.8,
819
- headingMd: 2.2,
820
- headingLg: 2.8
821
- }, I = {
822
- xxs: 1,
823
- xs: 1,
824
- sm: 1.3,
825
- md: 1.43,
826
- lg: 1,
827
- xl: 1,
828
- editorBody: 1.47,
829
- headingSm: 1.25,
830
- headingMd: 1.41,
831
- headingLg: 1.29
832
- }, kn = `var(--typography-chart-font-family, ${o.fontFamilyDefault})`, ct = `var(--typography-chart-heading-font-family, ${o.fontFamilyHeading})`, P = (e) => `${e}em`, Bo = {
833
- textScale: "1",
834
- fontFamilyDefault: Tt,
835
- fontFamilyHeading: Tn,
836
- fontWeightRegular: O.regular.toString(),
837
- fontWeightMedium: O.medium.toString(),
838
- fontWeightSemibold: O.semibold.toString(),
839
- fontWeightBold: O.bold.toString(),
840
- fontWeightExtraBold: O.extraBold.toString(),
841
- fontWeightBlack: O.black.toString(),
842
- fontSizeXxs: P(M.xxs),
843
- fontSizeXs: P(M.xs),
844
- fontSizeSm: P(M.sm),
845
- fontSizeMd: P(M.md),
846
- fontSizeLg: P(M.lg),
847
- fontSizeXl: P(M.xl),
848
- fontLineHeightXxs: I.xxs.toString(),
849
- fontLineHeightXs: I.xs.toString(),
850
- fontLineHeightSm: I.sm.toString(),
851
- fontLineHeightMd: I.md.toString(),
852
- fontLineHeightLg: I.lg.toString(),
853
- fontLineHeightXl: I.xl.toString()
854
- }, _o = {
855
- fontSizeEditorBody: P(M.editorBody),
856
- fontSizeHeadingSm: P(M.headingSm),
857
- fontSizeHeadingMd: P(M.headingMd),
858
- fontSizeHeadingLg: P(M.headingLg),
859
- fontLineHeightEditorBody: I.editorBody.toString(),
860
- fontLineHeightHeadingSm: I.headingSm.toString(),
861
- fontLineHeightHeadingMd: I.headingMd.toString(),
862
- fontLineHeightHeadingLg: I.headingLg.toString()
863
- }, u = (e, t, n, r = kn) => `${e} ${t}/${n} ${r}`, wo = {
864
- // Axes
865
- fontTickLabel: u(o.fontWeightMedium, o.fontSizeSm, o.fontLineHeightSm),
866
- fontAxisLabel: u(o.fontWeightMedium, o.fontSizeSm, o.fontLineHeightSm),
867
- // Data labels
868
- fontDataLabel: u(o.fontWeightMedium, o.fontSizeXs, o.fontLineHeightXs),
869
- fontStackTotal: u(o.fontWeightSemibold, o.fontSizeXs, o.fontLineHeightXs),
870
- // Legend
871
- fontLegendLabel: u(o.fontWeightMedium, o.fontSizeSm, o.fontLineHeightSm),
872
- fontSeriesLabel: u(o.fontWeightSemibold, o.fontSizeSm, o.fontLineHeightSm),
873
- // Chart tooltips
874
- fontTooltipLabel: u(o.fontWeightMedium, o.fontSizeMd, o.fontLineHeightMd),
875
- fontTooltipHeading: u(o.fontWeightMedium, o.fontSizeSm, o.fontLineHeightSm),
876
- fontTooltipFooter: u(o.fontWeightRegular, o.fontSizeSm, o.fontLineHeightSm),
877
- fontJumboTooltipLabel: u(o.fontWeightRegular, o.fontSizeSm, o.fontLineHeightSm),
878
- fontJumboTooltip: u(o.fontWeightMedium, o.fontSizeHeadingMd, o.fontLineHeightHeadingMd),
879
- fontMiniTooltipLabel: u(o.fontWeightMedium, o.fontSizeSm, o.fontLineHeightSm),
880
- fontMiniTooltipFooter: u(o.fontWeightRegular, o.fontSizeSm, o.fontLineHeightSm),
881
- fontTooltipCaption: u(o.fontWeightMedium, o.fontSizeSm, o.fontLineHeightSm),
882
- fontTooltipCaptionSmall: u(o.fontWeightMedium, o.fontSizeXxs, o.fontLineHeightXxs),
883
- // UI tooltips
884
- fontUITooltip: u(o.fontWeightMedium, o.fontSizeMd, o.fontLineHeightMd),
885
- fontUITooltipSecondary: u(o.fontWeightMedium, o.fontSizeSm, o.fontLineHeightSm),
886
- // Trends
887
- fontTrendTag: u(o.fontWeightMedium, o.fontSizeMd, o.fontLineHeightMd),
888
- fontTrendTagSmall: u(o.fontWeightMedium, o.fontSizeXs, o.fontLineHeightXs),
889
- // Goal lines
890
- fontGoalLineLabel: u(o.fontWeightMedium, o.fontSizeXs, o.fontLineHeightXs),
891
- // Pie charts
892
- fontPieLabel: u(o.fontWeightMedium, o.fontSizeXs, o.fontLineHeightXs),
893
- fontPieChartTotal: u(o.fontWeightBold, o.fontSizeHeadingLg, o.fontLineHeightHeadingLg),
894
- // Difference arrows
895
- fontDifferenceArrowSmall: u(o.fontWeightMedium, o.fontSizeSm, o.fontLineHeightSm),
896
- fontDifferenceArrowMedium: u(o.fontWeightMedium, o.fontSizeLg, o.fontLineHeightLg),
897
- fontDifferenceArrowLarge: u(o.fontWeightSemibold, o.fontSizeXl, o.fontLineHeightXl),
898
- // Button
899
- fontButton: u(o.fontWeightMedium, o.fontSizeMd, o.fontLineHeightMd),
900
- // Forms
901
- fontInput: u(o.fontWeightMedium, o.fontSizeMd, o.fontLineHeightMd),
902
- fontInputLabel: u(o.fontWeightMedium, o.fontSizeXxs, o.fontLineHeightXxs),
903
- fontSelectLabel: u(o.fontWeightMedium, o.fontSizeMd, o.fontLineHeightMd),
904
- fontSelectDescription: u(o.fontWeightMedium, o.fontSizeSm, o.fontLineHeightSm),
905
- fontColorSelectLabel: u(o.fontWeightMedium, o.fontSizeSm, o.fontLineHeightSm),
906
- // Menus
907
- fontMenuTitle: u(o.fontWeightSemibold, o.fontSizeMd, o.fontLineHeightMd),
908
- fontMenuGroupTitle: u(o.fontWeightMedium, o.fontSizeSm, o.fontLineHeightSm),
909
- fontMenuItemLabel: u(o.fontWeightMedium, o.fontSizeMd, o.fontLineHeightMd),
910
- fontMenuItemLabelSecondary: u(o.fontWeightMedium, o.fontSizeSm, o.fontLineHeightSm),
911
- // Error boundary
912
- fontErrorBoundaryTitle: u(o.fontWeightSemibold, o.fontSizeHeadingSm, o.fontLineHeightHeadingSm),
913
- fontErrorBoundaryMessage: u(o.fontWeightMedium, o.fontSizeMd, o.fontLineHeightMd),
914
- // Tables
915
- fontTableCell: u(o.fontWeightMedium, o.fontSizeMd, o.fontLineHeightMd),
916
- fontTableHeaderCell: u(o.fontWeightSemibold, o.fontSizeSm, o.fontLineHeightSm),
917
- // Footer
918
- fontSourceLabel: u(o.fontWeightMedium, o.fontSizeSm, o.fontLineHeightSm),
919
- fontSourceLink: u(o.fontWeightRegular, o.fontSizeSm, o.fontLineHeightSm),
920
- // Text editor
921
- fontTextEditorH1: u(o.fontWeightBold, o.fontSizeHeadingLg, o.fontLineHeightHeadingLg, ct),
922
- fontTextEditorH2: u(o.fontWeightBold, o.fontSizeHeadingMd, o.fontLineHeightHeadingMd, ct),
923
- fontTextEditorH3: u(
924
- o.fontWeightSemibold,
925
- o.fontSizeHeadingSm,
926
- o.fontLineHeightHeadingSm,
927
- ct
928
- ),
929
- fontTextEditorH6: u(o.fontWeightMedium, o.fontSizeSm, o.fontLineHeightSm),
930
- fontTextEditorBody: u(o.fontWeightMedium, o.fontSizeEditorBody, o.fontLineHeightEditorBody),
931
- fontTextEditorLink: u(o.fontWeightRegular, o.fontSizeMd, o.fontLineHeightMd),
932
- // Highlight mode
933
- fontHighlightModeTitle: u(o.fontWeightBold, o.fontSizeMd, o.fontLineHeightMd),
934
- fontHighlightModeSubtitle: u(o.fontWeightMedium, o.fontSizeSm, o.fontLineHeightSm)
935
- }, Hn = 11.7, Cn = M.xs, Mn = Tt, An = O.medium, K = 5, En = 5, At = 10, Et = 10, In = 4, et = 13, ie = 6, dt = 12, It = 21.6, Pn = "0 0 10 18", Bn = "M2.48935 16.9323L9.07098 9.82964C9.51595 9.34944 9.51504 8.60728 9.0689 8.12818L2.48866 1.06172C1.85811 0.384586 0.974477 0 0.049217 0H0V18H0.0443689C0.972463 18 1.85854 17.6131 2.48935 16.9323Z", Pt = "#FFFFFF", gt = "#1A1A1A";
936
- var _n = "_16vokpr0";
937
- const wn = (e, t) => {
938
- const n = e.mapping.y !== void 0, r = t.mainAxis === "y";
939
- return n !== r;
940
- }, Rn = (e, t) => {
941
- const n = m(e ? 1 - t : t);
942
- return e ? { x1: "0%", y1: n, x2: "100%", y2: n } : { x1: n, y1: "0%", x2: n, y2: "100%" };
943
- }, Wn = (e, t) => e === "solid" ? {} : e === "dotted" ? { strokeDasharray: `0 ${t * 2}`, strokeLinecap: "round" } : {
944
- strokeDasharray: `${t * 2} ${t * 3}`,
945
- strokeLinecap: "round",
946
- strokeMiterlimit: 16
947
- }, zn = (e) => {
948
- const t = e.params.color, n = t ?? o.targetLineColor;
949
- let r = o.targetLineLabelTextColor;
950
- if (t !== void 0)
951
- try {
952
- r = Ct(t, Pt) > Ct(t, gt) ? Pt : gt;
953
- } catch {
954
- r = gt;
955
- }
956
- return { lineColor: n, labelTextColor: r };
957
- }, On = (e, t) => tt(e) && tt(t) ? `${e}: ${t}` : tt(e) ? e : tt(t) ? t : null, tt = (e) => e != null && e.trim() !== "";
958
- var Dn = "_2qyyu60";
959
- const Bt = 2, Fn = 12, Gn = 12, _t = 1, wt = 2, Nn = 4, se = ({
960
- shape: e,
961
- color: t,
962
- lineType: n = "solid",
963
- width: r = Fn,
964
- height: i = Gn
965
- }) => /* @__PURE__ */ s(
966
- "svg",
967
- {
968
- className: Dn,
969
- width: r,
970
- height: i,
971
- viewBox: `0 0 ${r} ${i}`,
972
- "aria-hidden": !0,
973
- "data-testid": "chart-swatch",
974
- "data-shape": e,
975
- children: Xn({ shape: e, color: t, lineType: n, width: r, height: i })
976
- }
977
- ), Xn = ({ shape: e, color: t, lineType: n, width: r, height: i }) => {
978
- const a = $n(n, r);
979
- switch (e) {
980
- case "square":
981
- return /* @__PURE__ */ s("rect", { x: 1, y: 1, width: r - 2, height: i - 2, rx: 2, fill: t });
982
- case "line":
983
- return /* @__PURE__ */ s(
984
- "line",
985
- {
986
- x1: a.x1,
987
- y1: i / 2,
988
- x2: a.x2,
989
- y2: i / 2,
990
- stroke: t,
991
- strokeWidth: Bt,
992
- strokeLinecap: a.linecap,
993
- strokeDasharray: a.dashArray
994
- }
995
- );
996
- case "circle": {
997
- const c = (Math.min(r, i) - 2) / 2;
998
- return /* @__PURE__ */ s("circle", { cx: r / 2, cy: i / 2, r: c, fill: t });
999
- }
1000
- case "area": {
1001
- const c = i / 2 - 1;
1002
- return /* @__PURE__ */ S(z, { children: [
1003
- /* @__PURE__ */ s("rect", { x: 1, y: c, width: r - 2, height: i - c - 1, fill: t, opacity: 0.45 }),
1004
- /* @__PURE__ */ s(
1005
- "line",
1006
- {
1007
- x1: a.x1,
1008
- y1: c,
1009
- x2: a.x2,
1010
- y2: c,
1011
- stroke: t,
1012
- strokeWidth: Bt,
1013
- strokeLinecap: a.linecap,
1014
- strokeDasharray: a.dashArray
1015
- }
1016
- )
1017
- ] });
1018
- }
1019
- case "slice":
1020
- return /* @__PURE__ */ s("path", { d: `M 0 ${i} L ${r} ${i} A ${r} ${i} 0 0 0 0 0 Z`, fill: t });
1021
- }
1022
- }, $n = (e, t) => {
1023
- if (e === "solid")
1024
- return { x1: 0, x2: t, dashArray: void 0, linecap: "round" };
1025
- if (e === "dashed") {
1026
- const r = (t - _t * (wt - 1)) / wt;
1027
- return { x1: 0, x2: t, dashArray: `${r} ${_t}`, linecap: "butt" };
1028
- }
1029
- const n = t / (Nn - 1);
1030
- return { x1: 0, x2: t, dashArray: `1 ${n}`, linecap: "round" };
1031
- }, Un = ({
1032
- labelPosition: e,
1033
- linePosition: t,
1034
- color: n,
1035
- pillWidth: r,
1036
- pillHeight: i,
1037
- text: a,
1038
- isAnimated: c
1039
- }) => {
1040
- const l = e === "start", d = l ? -et : -(r - et), h = l ? d + r - K : d + K - dt, g = l ? void 0 : `rotate(180 ${h + dt / 2} ${i / 2})`, f = l ? "0%" : "100%", p = m(1 - t), v = /* @__PURE__ */ S("g", { transform: `translate(0, ${-i / 2})`, pointerEvents: "none", children: [
1041
- /* @__PURE__ */ s("rect", { x: d, y: 0, width: r, height: i, rx: ie, fill: n }),
1042
- /* @__PURE__ */ s("g", { transform: g, children: /* @__PURE__ */ s(
1043
- "svg",
1044
- {
1045
- x: h,
1046
- y: (i - It) / 2,
1047
- width: dt,
1048
- height: It,
1049
- viewBox: Pn,
1050
- overflow: "visible",
1051
- children: /* @__PURE__ */ s("path", { d: Bn, fill: n })
1052
- }
1053
- ) }),
1054
- /* @__PURE__ */ s("g", { transform: `translate(${d + K}, ${i / 2})`, children: a })
1055
- ] });
1056
- return c ? /* @__PURE__ */ s(
1057
- B.svg,
1058
- {
1059
- initial: !1,
1060
- transition: H,
1061
- x: f,
1062
- animate: { y: p },
1063
- overflow: "visible",
1064
- children: v
1065
- }
1066
- ) : /* @__PURE__ */ s("svg", { x: f, y: p, overflow: "visible", children: v });
1067
- }, Yn = ({
1068
- labelPosition: e,
1069
- linePosition: t,
1070
- color: n,
1071
- pillWidth: r,
1072
- pillHeight: i,
1073
- text: a,
1074
- isAnimated: c
1075
- }) => {
1076
- const l = e === "start", d = l ? -et : -(i - et), h = m(t), g = l ? "100%" : "0%", f = /* @__PURE__ */ S("g", { transform: `translate(${-r / 2}, 0)`, pointerEvents: "none", children: [
1077
- /* @__PURE__ */ s("rect", { x: 0, y: d, width: r, height: i, rx: ie, fill: n }),
1078
- /* @__PURE__ */ s("g", { transform: `translate(${K}, ${d + i / 2})`, children: a })
1079
- ] });
1080
- return c ? /* @__PURE__ */ s(
1081
- B.svg,
1082
- {
1083
- initial: !1,
1084
- transition: H,
1085
- y: g,
1086
- animate: { x: h },
1087
- overflow: "visible",
1088
- children: f
1089
- }
1090
- ) : /* @__PURE__ */ s("svg", { x: h, y: g, overflow: "visible", children: f });
1091
- }, Vn = ({
1092
- label: e,
1093
- textWidth: t,
1094
- labelPosition: n,
1095
- isHorizontalLine: r,
1096
- position: i,
1097
- color: a,
1098
- textColor: c,
1099
- symbolShape: l,
1100
- symbolColor: d,
1101
- isAnimated: h
1102
- }) => {
1103
- const g = l === null ? 0 : At + In, f = t + g + K * 2, p = Hn + En * 2, v = /* @__PURE__ */ S(z, { children: [
1104
- l !== null && d !== null && /* @__PURE__ */ s("g", { transform: `translate(0, ${-Et / 2})`, children: /* @__PURE__ */ s(se, { shape: l, color: d, width: At, height: Et }) }),
1105
- /* @__PURE__ */ s(
1106
- "text",
1107
- {
1108
- x: g,
1109
- textAnchor: "start",
1110
- dominantBaseline: "central",
1111
- fill: c,
1112
- style: { font: o.fontGoalLineLabel },
1113
- children: e
1114
- }
1115
- )
1116
- ] });
1117
- return r ? /* @__PURE__ */ s(
1118
- Un,
1119
- {
1120
- labelPosition: n,
1121
- linePosition: i,
1122
- color: a,
1123
- pillWidth: f,
1124
- pillHeight: p,
1125
- text: v,
1126
- isAnimated: h
1127
- }
1128
- ) : /* @__PURE__ */ s(
1129
- Yn,
1130
- {
1131
- labelPosition: n,
1132
- linePosition: i,
1133
- color: a,
1134
- pillWidth: f,
1135
- pillHeight: p,
1136
- text: v,
1137
- isAnimated: h
1138
- }
1139
- );
1140
- }, jn = ({ layer: e, isHorizontalLine: t, position: n, lineColor: r, isAnimated: i }) => {
1141
- const a = Rn(t, n), c = Wn(e.params.lineType, e.params.strokeWidth);
1142
- return i ? /* @__PURE__ */ s(
1143
- B.line,
1144
- {
1145
- initial: !1,
1146
- transition: H,
1147
- animate: { x1: a.x1, y1: a.y1, x2: a.x2, y2: a.y2 },
1148
- ...c,
1149
- stroke: r,
1150
- strokeWidth: e.params.strokeWidth,
1151
- vectorEffect: "non-scaling-stroke"
1152
- }
1153
- ) : /* @__PURE__ */ s(
1154
- "line",
1155
- {
1156
- ...a,
1157
- ...c,
1158
- stroke: r,
1159
- strokeWidth: e.params.strokeWidth,
1160
- vectorEffect: "non-scaling-stroke"
1161
- }
1162
- );
1163
- }, Kn = $(function({
1164
- layer: t,
1165
- coordSystem: n,
1166
- formattingLocale: r,
1167
- isAnimated: i
1168
- }) {
1169
- const a = bn(), { guides: c, numberFormat: l, textScale: d, layers: h, compiledLayers: g, colorScale: f } = de(
1170
- zt((b) => ({
1171
- guides: b.guides,
1172
- numberFormat: b.config.numberFormat,
1173
- textScale: b.config.appearance.textScale,
1174
- layers: b.spec.layers,
1175
- compiledLayers: b.layers,
1176
- colorScale: b.scales.color
1177
- }))
1178
- ), p = y(
1179
- () => ye(h, g, f, n).get(t.id) ?? null,
1180
- [h, g, f, n, t.id]
1181
- ), v = y(
1182
- () => On(t.params.label, Se({ guides: c, numberFormat: l, layer: t, locale: r })),
1183
- [c, l, r, t]
1184
- ), x = y(
1185
- () => ({
1186
- family: Mn,
1187
- size: vn(Cn, d),
1188
- weight: An
1189
- }),
1190
- [d]
1191
- ), R = y(
1192
- () => v === null ? 0 : a.measureText(v, x).width,
1193
- [v, x, a]
1194
- ), L = t.data.getFirst();
1195
- if (!L) return null;
1196
- const { lineColor: C, labelTextColor: _ } = zn(t), F = wn(t, n), Y = F ? T(L) : k(L);
1197
- return Y === null ? null : /* @__PURE__ */ S("g", { "data-geom": "rule", className: _n, children: [
1198
- /* @__PURE__ */ s(
1199
- jn,
1200
- {
1201
- layer: t,
1202
- isHorizontalLine: F,
1203
- position: Y,
1204
- lineColor: C,
1205
- isAnimated: i
1206
- }
1207
- ),
1208
- v !== null && /* @__PURE__ */ s(
1209
- Vn,
1210
- {
1211
- label: v,
1212
- textWidth: R,
1213
- labelPosition: t.params.labelPosition,
1214
- isHorizontalLine: F,
1215
- position: Y,
1216
- color: C,
1217
- textColor: _,
1218
- symbolShape: p?.shape ?? null,
1219
- symbolColor: p?.color ?? null,
1220
- isAnimated: i
1221
- }
1222
- )
1223
- ] });
1224
- }), Jn = {
1225
- geom: "rule",
1226
- coord: "cartesian",
1227
- highlightStrategy: null,
1228
- guideMode: null,
1229
- render: ({ layer: e, coordSystem: t, formattingLocale: n, isAnimated: r }) => /* @__PURE__ */ s(
1230
- Kn,
1231
- {
1232
- layer: e,
1233
- coordSystem: t,
1234
- formattingLocale: n,
1235
- isAnimated: r
1236
- }
1237
- ),
1238
- renderHover: () => null,
1239
- renderHoverCompanions: () => null
1240
- }, le = 1, ut = Vt(), Rt = Math.PI * 2, Zn = $(function({ layer: t, isAnimated: n }) {
1241
- const r = N(!1);
1242
- W(() => {
1243
- r.current = !0;
1244
- }, []);
1245
- const i = y(() => {
1246
- const a = it(t.id), c = [];
1247
- for (const l of t.data) {
1248
- const d = a(l), { startAngle: h, endAngle: g } = Xt(l), { innerRadius: f, outerRadius: p } = $t(l);
1249
- h === null || g === null || f === null || p === null || c.push({
1250
- key: d,
1251
- startAngle: h,
1252
- endAngle: g,
1253
- innerRadius: f,
1254
- outerRadius: p,
1255
- fill: A(l),
1256
- opacity: E(l) ?? le
1257
- });
1258
- }
1259
- return c;
1260
- }, [t]);
1261
- return /* @__PURE__ */ s(
1262
- "svg",
1263
- {
1264
- viewBox: "-1 -1 2 2",
1265
- preserveAspectRatio: "xMidYMid meet",
1266
- width: "100%",
1267
- height: "100%",
1268
- "data-geom": "bar",
1269
- className: U,
1270
- children: i.map((a) => {
1271
- if (n) {
1272
- const { key: c, ...l } = a;
1273
- return /* @__PURE__ */ s(qn, { isInitialRender: !r.current, ...l }, c);
1274
- }
1275
- return /* @__PURE__ */ s(
1276
- "path",
1277
- {
1278
- d: ut({
1279
- startAngle: a.startAngle,
1280
- endAngle: a.endAngle,
1281
- innerRadius: a.innerRadius,
1282
- outerRadius: a.outerRadius
1283
- }) ?? void 0,
1284
- fill: a.fill,
1285
- opacity: a.opacity
1286
- },
1287
- a.key
1288
- );
1289
- })
1290
- }
1291
- );
1292
- }), qn = ({
1293
- startAngle: e,
1294
- endAngle: t,
1295
- innerRadius: n,
1296
- outerRadius: r,
1297
- fill: i,
1298
- opacity: a,
1299
- isInitialRender: c
1300
- }) => {
1301
- const l = c ? e : Rt, d = c ? t : Rt, h = Ht(l, H), g = Ht(d, H), f = Ut(
1302
- ut({ startAngle: l, endAngle: d, innerRadius: n, outerRadius: r }) ?? ""
1303
- );
1304
- return W(() => {
1305
- h.set(e), g.set(t);
1306
- }, [h, g, e, t]), W(() => {
1307
- const p = () => {
1308
- const R = h.get(), L = g.get();
1309
- f.set(
1310
- ut({ startAngle: R, endAngle: L, innerRadius: n, outerRadius: r }) ?? ""
1311
- );
1312
- }, v = h.on("change", p), x = g.on("change", p);
1313
- return () => {
1314
- v(), x();
1315
- };
1316
- }, [h, g, n, r, f]), /* @__PURE__ */ s(B.path, { d: f, fill: i, opacity: a, transition: H });
1317
- }, Qn = Vt(), to = ({ primary: e }) => {
1318
- const { startAngle: t, endAngle: n } = Xt(e.observation), { innerRadius: r, outerRadius: i } = $t(e.observation);
1319
- if (t === null || n === null || r === null || i === null)
1320
- return null;
1321
- const a = Qn({ startAngle: t, endAngle: n, innerRadius: r, outerRadius: i });
1322
- if (!a) return null;
1323
- const c = A(e.observation), l = E(e.observation) ?? le;
1324
- return /* @__PURE__ */ s(
1325
- "svg",
1326
- {
1327
- viewBox: "-1 -1 2 2",
1328
- preserveAspectRatio: "xMidYMid meet",
1329
- width: "100%",
1330
- height: "100%",
1331
- "data-geom": "arc",
1332
- "data-testid": "hovered-arc",
1333
- className: U,
1334
- children: /* @__PURE__ */ s("path", { d: a, fill: c, opacity: l })
1335
- }
1336
- );
1337
- }, eo = {
1338
- geom: "bar",
1339
- coord: "polar",
1340
- highlightStrategy: "observation-rerender",
1341
- guideMode: null,
1342
- render: ({ layer: e, isAnimated: t }) => /* @__PURE__ */ s(Zn, { layer: e, isAnimated: t }),
1343
- renderHover: ({ primary: e }) => /* @__PURE__ */ s(to, { primary: e }),
1344
- renderHoverCompanions: () => null
1345
- }, Wt = {
1346
- bar: {
1347
- cartesian: sn,
1348
- polar: eo
1349
- },
1350
- line: {
1351
- cartesian: hn
1352
- },
1353
- area: {
1354
- cartesian: Qe
1355
- },
1356
- point: {
1357
- cartesian: fn
1358
- },
1359
- rule: {
1360
- cartesian: Jn
1361
- }
1362
- }, no = (e = []) => {
1363
- const t = {};
1364
- for (const n of Object.keys(Wt))
1365
- t[n] = { ...Wt[n] };
1366
- for (const n of e) {
1367
- const r = t[n.geom] ?? {};
1368
- r[n.coord] = n, t[n.geom] = r;
1369
- }
1370
- return (n, r) => t[n.geom]?.[r.type] ?? null;
1371
- }, oo = (e) => St((t) => ({
1372
- compiled: e,
1373
- setCompiled: (n) => t((r) => r.compiled === n ? r : { compiled: n })
1374
- }));
1375
- function ro(e, t) {
1376
- const n = xe(e) ? e.themeOverrides : void 0;
1377
- return y(() => ({ ...t, ...n }), [t, n]);
1378
- }
1379
- const ce = pt(null), Ro = ({
1380
- data: e,
1381
- input: t,
1382
- formattingLocale: n,
1383
- onChange: r,
1384
- customPalettes: i,
1385
- theme: a = "light",
1386
- themeOverrides: c,
1387
- geoms: l,
1388
- plugins: d,
1389
- annotationPlugins: h,
1390
- children: g
1391
- }) => {
1392
- const [f] = j(() => be({ geoms: l })), [p] = j(() => _e(f)), v = y(() => no(d), [d]), x = y(() => Pe(h), [h]), R = ro(t, c), L = y(() => ({ customPalettes: i, theme: a }), [i, a]), [C] = j(() => {
1393
- const b = f.compile({ input: t, data: e, ctx: L });
1394
- return p.emit({ kind: "init" }), oo(b);
1395
- }), _ = N({ input: t, data: e, ctx: L });
1396
- W(() => {
1397
- const b = t !== _.current.input, Z = e !== _.current.data, G = L !== _.current.ctx;
1398
- if (!b && !Z && !G) return;
1399
- const q = C.getState(), Q = b || G ? f.compile({ input: t, data: e, ctx: L }) : f.recompile({ spec: q.compiled.spec, data: e });
1400
- _.current = { input: t, data: e, ctx: L }, q.setCompiled(Q), p.emit({ kind: b ? "input" : "data" });
1401
- }, [t, e, L, f, C, p]);
1402
- const F = ue(
1403
- (b) => {
1404
- const Z = C.getState(), G = b.apply(Z.compiled.spec);
1405
- if (!G) return;
1406
- const q = f.recompile({ spec: G.spec });
1407
- if (Z.setCompiled(q), p.emit({ kind: "command", command: b }), !r) return;
1408
- const Q = Le(G.spec);
1409
- _.current = { input: Q, data: _.current.data, ctx: _.current.ctx }, r(Q);
1410
- },
1411
- [r, f, p, C]
1412
- ), Y = y(
1413
- () => ({
1414
- store: C,
1415
- dispatch: F,
1416
- formattingLocale: n,
1417
- compileBus: p,
1418
- theme: a,
1419
- themeOverrides: R,
1420
- resolvePlugin: v,
1421
- resolveAnnotationPlugin: x
1422
- }),
1423
- [C, F, n, p, a, R, v, x]
1424
- );
1425
- return /* @__PURE__ */ s(ce.Provider, { value: Y, children: g });
1426
- }, st = () => {
1427
- const e = ft(ce);
1428
- if (!e) throw new Error("useGraph* hooks must be used inside a <GraphProvider>");
1429
- return e;
1430
- }, de = (e) => {
1431
- const { store: t } = st();
1432
- return fe(t, (n) => e(n.compiled));
1433
- }, Wo = () => {
1434
- const { dispatch: e } = st();
1435
- return e;
1436
- }, zo = () => {
1437
- const { resolvePlugin: e } = st();
1438
- return e;
1439
- }, Oo = () => {
1440
- const { resolveAnnotationPlugin: e } = st();
1441
- return e;
1442
- }, ao = () => St((e) => ({
1443
- hover: Te,
1444
- isPointerInside: !1,
1445
- setHoverState: (t) => e((n) => n.hover === t ? n : { hover: t }),
1446
- setPointerInside: (t) => e((n) => n.isPointerInside === t ? n : { isPointerInside: t })
1447
- })), io = (e, t) => {
1448
- const n = y(() => ({ layers: e, coordSystem: t }), [e, t]), r = N(null);
1449
- r.current === null && (r.current = new ke(n));
1450
- const i = r.current, a = N(!1);
1451
- return W(() => {
1452
- if (!a.current) {
1453
- a.current = !0;
1454
- return;
1455
- }
1456
- i.update(n);
1457
- }, [i, n]), i;
1458
- }, ge = pt(null), Do = ({ children: e }) => {
1459
- const { layers: t, coordSystem: n } = de(
1460
- zt((d) => ({ layers: d.layers, coordSystem: d.coordSystem }))
1461
- ), r = io(t, n), [i] = j(() => ao()), a = N(null), c = N(null);
1462
- if (c.current === null) {
1463
- const d = /* @__PURE__ */ new Map(), h = { current: null }, g = /* @__PURE__ */ new Set(), f = (v) => {
1464
- if (h.current = v, i.getState().setPointerInside(v !== null), v !== null)
1465
- for (const x of g) x();
1466
- }, p = (v) => (g.add(v), () => {
1467
- g.delete(v);
1468
- });
1469
- c.current = { engine: r, store: i, overlayRef: a, hitTesterRegistry: d, cursorRef: h, setCursor: f, subscribeCursorMove: p };
1470
- }
1471
- const { hitTesterRegistry: l } = c.current;
1472
- return W(() => {
1473
- r.setHitTesters(l);
1474
- }, [r, l]), /* @__PURE__ */ s(ge.Provider, { value: c.current, children: e });
1475
- }, Fo = () => {
1476
- const e = ft(ge);
1477
- if (e === null)
1478
- throw new Error("useHoverContext must be used inside a <HoverProvider>.");
1479
- return e;
1480
- };
1481
- var so = "_19519k80", lo = "_19519k81", co = "_19519k82", go = "_19519k83", ho = "_19519k86", uo = "_19519k87", Go = "_19519k88";
1482
- const No = ({ content: e }) => /* @__PURE__ */ S(z, { children: [
1483
- e.header !== null && /* @__PURE__ */ s("div", { className: so, children: e.header }),
1484
- /* @__PURE__ */ s("div", { className: lo, children: e.rows.map((t) => /* @__PURE__ */ s(fo, { row: t, shouldHighlight: t.isPrimary && e.rows.length > 1 }, t.key)) })
1485
- ] }), fo = ({ row: e, shouldHighlight: t }) => /* @__PURE__ */ S("div", { className: Ie(co, { [go]: t }), "data-testid": "chart-tooltip-row", children: [
1486
- e.swatchColor !== null ? /* @__PURE__ */ s(se, { shape: e.swatchShape, color: e.swatchColor, lineType: e.swatchLineType }) : null,
1487
- /* @__PURE__ */ s("span", { className: ho, children: e.label }),
1488
- /* @__PURE__ */ s("span", { className: uo, children: e.value })
1489
- ] });
1490
- export {
1491
- ht as A,
1492
- Eo as C,
1493
- Tt as D,
1494
- I as F,
1495
- Ro as G,
1496
- Do as H,
1497
- bt as P,
1498
- pn as R,
1499
- se as S,
1500
- No as T,
1501
- Fo as a,
1502
- de as b,
1503
- Co as c,
1504
- zo as d,
1505
- M as e,
1506
- vn as f,
1507
- wo as g,
1508
- Bo as h,
1509
- Wo as i,
1510
- bn as j,
1511
- D as k,
1512
- Io as l,
1513
- Oo as m,
1514
- O as n,
1515
- ze as o,
1516
- Po as p,
1517
- Lt as q,
1518
- Go as r,
1519
- _o as s,
1520
- m as t,
1521
- st as u,
1522
- o as v,
1523
- X as w,
1524
- fo as x,
1525
- Mo as y,
1526
- Ao as z
1527
- };