@automattic/charts 4.12.0 → 4.14.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 (47) hide show
  1. package/CHANGELOG.md +35 -29
  2. package/TOKENS.md +3 -0
  3. package/dist/index.cjs +733 -2203
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.css +42 -13
  6. package/dist/index.d.cts +41 -125
  7. package/dist/index.d.ts +41 -125
  8. package/dist/index.js +756 -1881
  9. package/dist/index.js.map +1 -1
  10. package/package.json +9 -9
  11. package/src/charts/area-chart/area-chart.tsx +16 -6
  12. package/src/charts/area-chart/test/area-chart.test.tsx +42 -9
  13. package/src/charts/bar-chart/bar-chart.tsx +17 -12
  14. package/src/charts/bar-chart/private/index.ts +1 -1
  15. package/src/charts/bar-chart/private/slot-tooltip-members.tsx +4 -5
  16. package/src/charts/bar-chart/private/use-bar-stops.ts +1 -3
  17. package/src/charts/bar-chart/private/use-overlap-slots.ts +35 -16
  18. package/src/charts/bar-chart/test/bar-chart.test.tsx +115 -0
  19. package/src/charts/conversion-funnel-chart/conversion-funnel-chart.module.scss +24 -11
  20. package/src/charts/conversion-funnel-chart/conversion-funnel-chart.tsx +235 -182
  21. package/src/charts/conversion-funnel-chart/index.ts +2 -0
  22. package/src/charts/conversion-funnel-chart/private/index.ts +1 -0
  23. package/src/charts/conversion-funnel-chart/private/use-funnel-selection.ts +9 -47
  24. package/src/charts/conversion-funnel-chart/private/use-roving-step-focus.ts +83 -0
  25. package/src/charts/conversion-funnel-chart/test/conversion-funnel-chart.test.tsx +312 -92
  26. package/src/charts/conversion-funnel-chart/test/use-funnel-selection.test.ts +23 -188
  27. package/src/charts/conversion-funnel-chart/types.ts +22 -0
  28. package/src/charts/leaderboard-chart/leaderboard-chart.module.scss +42 -2
  29. package/src/charts/leaderboard-chart/leaderboard-chart.tsx +124 -36
  30. package/src/charts/leaderboard-chart/private/resolve-leaderboard-entries.ts +53 -0
  31. package/src/charts/leaderboard-chart/test/leaderboard-chart.test.tsx +88 -0
  32. package/src/charts/leaderboard-chart/test/resolve-leaderboard-entries.test.ts +146 -0
  33. package/src/charts/leaderboard-chart/types.ts +6 -0
  34. package/src/charts/line-chart/line-chart.tsx +10 -8
  35. package/src/charts/line-chart/test/line-chart.test.tsx +75 -0
  36. package/src/components/legend/private/base-legend.tsx +13 -8
  37. package/src/components/legend/test/legend.test.tsx +125 -0
  38. package/src/components/legend/types.ts +9 -1
  39. package/src/components/tooltip/private/at-nearest-date.ts +49 -0
  40. package/src/components/tooltip/private/keyboard-stops.ts +67 -0
  41. package/src/components/tooltip/private/xy-chart-tooltip-overlay.tsx +10 -2
  42. package/src/components/tooltip/test/keyboard-stops.test.ts +36 -0
  43. package/src/components/tooltip/test/xy-chart-tooltip.test.tsx +135 -1
  44. package/src/components/tooltip/xy-chart-tooltip.tsx +8 -12
  45. package/src/index.ts +2 -0
  46. package/src/styles/chart-scope.scss +1 -0
  47. package/src/types.ts +5 -6
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- //#region \0rolldown/runtime.js
2
+ // \0rolldown/runtime.js
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -21,14 +21,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
21
21
  value: mod,
22
22
  enumerable: true
23
23
  }) : target, mod));
24
- //#endregion
25
24
  let _automattic_number_formatters = require("@automattic/number-formatters");
26
25
  let _visx_xychart = require("@visx/xychart");
27
26
  let _wordpress_i18n = require("@wordpress/i18n");
28
27
  let clsx = require("clsx");
29
28
  clsx = __toESM(clsx, 1);
30
29
  let react = require("react");
31
- react = __toESM(react);
32
30
  let date_fns = require("date-fns");
33
31
  let _date_fns_tz = require("@date-fns/tz");
34
32
  let _visx_text = require("@visx/text");
@@ -52,28 +50,24 @@ let _visx_pattern = require("@visx/pattern");
52
50
  let react_google_charts = require("react-google-charts");
53
51
  let dompurify = require("dompurify");
54
52
  dompurify = __toESM(dompurify, 1);
55
- require("@babel/runtime/helpers/esm/extends");
56
53
  let _wordpress_icons = require("@wordpress/icons");
57
54
  let _visx_shape = require("@visx/shape");
58
- //#region src/charts/private/chart-instance-context/chart-instance-context.ts
55
+ // src/charts/private/chart-instance-context/chart-instance-context.ts
59
56
  const ChartInstanceContext = (0, react.createContext)(null);
60
- //#endregion
61
- //#region src/charts/private/chart-instance-context/use-chart-instance-context.ts
57
+ // src/charts/private/chart-instance-context/use-chart-instance-context.ts
62
58
  const useChartInstanceContext = () => {
63
59
  const context = (0, react.useContext)(ChartInstanceContext);
64
60
  if (!context) throw new Error("useChartInstanceContext must be used within a Chart component");
65
61
  return context;
66
62
  };
67
- //#endregion
68
- //#region src/styles/chart-scope-class.ts
63
+ // src/styles/chart-scope-class.ts
69
64
  /**
70
65
  * Stable class that carries the `--a8c-charts-*` catalog. Applied to the `GlobalChartsProvider` wrapper, to portal-rendered surfaces (which sit outside the provider tree), and to standalone components when no provider is above them.
71
66
  *
72
67
  * Deliberately unhashed: consumers are documented as being able to target it to override a token on the provider element.
73
68
  */
74
69
  const CHART_SCOPE_CLASS = "a8c-charts-scope";
75
- //#endregion
76
- //#region src/utils/create-composition.ts
70
+ // src/utils/create-composition.ts
77
71
  /**
78
72
  * Utility function to create chart components with composition API.
79
73
  *
@@ -87,8 +81,7 @@ const CHART_SCOPE_CLASS = "a8c-charts-scope";
87
81
  function attachSubComponents(Chart, subComponents) {
88
82
  return Object.assign(Chart, subComponents);
89
83
  }
90
- //#endregion
91
- //#region src/utils/warn-once.ts
84
+ // src/utils/warn-once.ts
92
85
  const warned = /* @__PURE__ */ new Set();
93
86
  /**
94
87
  * Warns about a host-supplied value once per process, and never in production.
@@ -101,8 +94,7 @@ const warnOnce = (key, message) => {
101
94
  warned.add(key);
102
95
  console.warn(`[Charts] ${message}`);
103
96
  };
104
- //#endregion
105
- //#region src/utils/date-parsing.ts
97
+ // src/utils/date-parsing.ts
106
98
  /**
107
99
  * @file Date parsing: a naive string is dated in a supplied IANA zone, or the runtime's own
108
100
  *
@@ -197,8 +189,7 @@ const parseAsLocalDate = (dateString, timeZone) => {
197
189
  }
198
190
  return /* @__PURE__ */ new Date(NaN);
199
191
  };
200
- //#endregion
201
- //#region src/utils/bucket-info.ts
192
+ // src/utils/bucket-info.ts
202
193
  const getInstant = (point) => {
203
194
  if (!point) return;
204
195
  if ("date" in point && point.date) return point.date.getTime();
@@ -230,8 +221,7 @@ const getBucketInfo = (data, tickResolution) => ({
230
221
  bucket: tickResolution ?? getBucketResolution(data),
231
222
  displayResolution: getBucketResolution(data, tickResolution)
232
223
  });
233
- //#endregion
234
- //#region src/utils/format-metric-value.ts
224
+ // src/utils/format-metric-value.ts
235
225
  /**
236
226
  * Format a numeric metric value based on type, precision and scale.
237
227
  * Supports currency, number and percentage, using `@automattic/number-formatters`.
@@ -280,8 +270,7 @@ const formatMetricValue = (value, type = "number", { decimals, useMultipliers =
280
270
  });
281
271
  }
282
272
  };
283
- //#endregion
284
- //#region src/utils/format-percentage.ts
273
+ // src/utils/format-percentage.ts
285
274
  /**
286
275
  * Format a percentage value with smart decimal handling.
287
276
  * Uses `@automattic/number-formatters` for consistent formatting.
@@ -297,8 +286,7 @@ const formatPercentage = (value) => {
297
286
  maximumFractionDigits: 2
298
287
  } });
299
288
  };
300
- //#endregion
301
- //#region src/utils/get-edge-tick-widths.ts
289
+ // src/utils/get-edge-tick-widths.ts
302
290
  /**
303
291
  * Rendered widths of the first and last tick labels on an axis.
304
292
  *
@@ -322,8 +310,7 @@ const getEdgeTickWidths = (ticks, formatTick, labelStyle) => {
322
310
  last: (0, _visx_text.getStringWidth)(label(ticks[lastIndex], lastIndex), labelStyle) ?? 0
323
311
  };
324
312
  };
325
- //#endregion
326
- //#region src/utils/get-longest-tick-width.ts
313
+ // src/utils/get-longest-tick-width.ts
327
314
  /**
328
315
  * Returns the width of the longest tick.
329
316
  *
@@ -337,8 +324,7 @@ const getLongestTickWidth = (ticks, formatTick, labelStyle) => {
337
324
  const longestTick = formattedTicks.reduce((longest, current) => longest.length >= current.length ? longest : current, formattedTicks[0]);
338
325
  return (0, _visx_text.getStringWidth)(longestTick, labelStyle);
339
326
  };
340
- //#endregion
341
- //#region src/utils/get-styles.ts
327
+ // src/utils/get-styles.ts
342
328
  /**
343
329
  * Utility function to get consolidated line styles for a series
344
330
  * This consolidates the logic used by both LineChart and Legend components
@@ -391,19 +377,16 @@ function getItemShapeStyles(series, index, theme, legendShape) {
391
377
  ...barShapeStyles
392
378
  };
393
379
  }
394
- //#endregion
395
- //#region src/utils/is-safari.ts
380
+ // src/utils/is-safari.ts
396
381
  const isSafari = () => {
397
382
  if (typeof navigator !== "undefined" && navigator.userAgent) return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
398
383
  return false;
399
384
  };
400
- //#endregion
401
- //#region src/utils/merge-themes.ts
385
+ // src/utils/merge-themes.ts
402
386
  function mergeThemes(baseTheme, overrideTheme) {
403
387
  return (0, deepmerge.default)(baseTheme, overrideTheme, { arrayMerge: (_destinationArray, sourceArray) => sourceArray });
404
388
  }
405
- //#endregion
406
- //#region src/utils/color-utils.ts
389
+ // src/utils/color-utils.ts
407
390
  /**
408
391
  * Check if a value is a valid 6-digit hex color
409
392
  * @param hex - The value to check
@@ -570,8 +553,7 @@ const prefersLightText = (backgroundHex) => {
570
553
  if (!isValidHexColor(backgroundHex)) return false;
571
554
  return relativeLuminance(backgroundHex) <= .179;
572
555
  };
573
- //#endregion
574
- //#region src/utils/resolve-css-var.ts
556
+ // src/utils/resolve-css-var.ts
575
557
  /**
576
558
  * Pattern for valid CSS custom property names (e.g., '--my-color', '--jp-gray-10')
577
559
  */
@@ -668,8 +650,7 @@ function readCustomProperty(varName, styles) {
668
650
  return null;
669
651
  }
670
652
  }
671
- //#endregion
672
- //#region src/utils/resolve-font-size.ts
653
+ // src/utils/resolve-font-size.ts
673
654
  const toFontSize = (size) => Number.isFinite(size) && size >= 0 ? size : void 0;
674
655
  /**
675
656
  * Resolve a theme `fontSize` value into a plain number suitable for
@@ -696,8 +677,7 @@ const resolveFontSize = (val) => {
696
677
  return match ? toFontSize(parseFloat(match[1])) : void 0;
697
678
  }
698
679
  };
699
- //#endregion
700
- //#region src/utils/date-formatting.ts
680
+ // src/utils/date-formatting.ts
701
681
  const formatters = /* @__PURE__ */ new Map();
702
682
  const getFormatter$1 = (options, { locale, timeZone }) => {
703
683
  const key = `${locale ?? ""}|${timeZone ?? ""}|${JSON.stringify(options)}`;
@@ -796,8 +776,7 @@ const createZonedClock = (timeZone) => {
796
776
  };
797
777
  };
798
778
  };
799
- //#endregion
800
- //#region src/providers/chart-scope/chart-scope-context.ts
779
+ // src/providers/chart-scope/chart-scope-context.ts
801
780
  /**
802
781
  * The nearest chart element, published so JS token resolution reads the same CSS cascade that paints the chart's own colours.
803
782
  *
@@ -814,8 +793,7 @@ const seriesRole = (slot) => `--a8c-charts-color-series-${slot}`;
814
793
  const SERIES_SLOT_1_FALLBACK = "#3858e9";
815
794
  /** The catalog pointer for every slot, in slot order. */
816
795
  const SERIES_PALETTE_POINTERS = Array.from({ length: 5 }, (_, index) => index === 0 ? `var(${seriesRole(1)}, ${SERIES_SLOT_1_FALLBACK})` : `var(${seriesRole(index + 1)})`);
817
- //#endregion
818
- //#region src/providers/chart-context/private/catalog-pointers.ts
796
+ // src/providers/chart-context/private/catalog-pointers.ts
819
797
  /** Terminal literals the provider also generates from before its first read, so SSR and the first client render agree. */
820
798
  const BACKGROUND_FALLBACK = "#ffffff";
821
799
  const LABEL_FALLBACK = "#1e1e1e";
@@ -855,8 +833,7 @@ const ANNOTATION_POINTERS = {
855
833
  radius: 5
856
834
  }
857
835
  };
858
- //#endregion
859
- //#region src/providers/chart-context/private/perceptual-color.ts
836
+ // src/providers/chart-context/private/perceptual-color.ts
860
837
  const DEUTERANOPIA = [
861
838
  .367322,
862
839
  .860646,
@@ -1262,16 +1239,14 @@ const buildPaletteGenerator = (normalizedSeeds, background, labelColors) => {
1262
1239
  return palette[index].hex;
1263
1240
  };
1264
1241
  };
1265
- //#endregion
1266
- //#region src/providers/chart-context/private/resolve-opaque-hex.ts
1242
+ // src/providers/chart-context/private/resolve-opaque-hex.ts
1267
1243
  const resolveOpaqueHex = (pointer, resolve) => {
1268
1244
  const raw = resolve(pointer);
1269
1245
  if (!raw || (0, _visx_vendor_d3_color.color)(raw)?.opacity !== 1) return null;
1270
1246
  const hex = normalizeColorToHex(raw);
1271
1247
  return isValidHexColor(hex) ? hex : null;
1272
1248
  };
1273
- //#endregion
1274
- //#region src/providers/chart-context/themes.ts
1249
+ // src/providers/chart-context/themes.ts
1275
1250
  /**
1276
1251
  * Default theme configuration: the shape and spacing a consumer can override.
1277
1252
  *
@@ -1314,8 +1289,7 @@ const defaultTheme = {
1314
1289
  groupGap: 24
1315
1290
  }
1316
1291
  };
1317
- //#endregion
1318
- //#region src/providers/chart-context/global-charts-provider.tsx
1292
+ // src/providers/chart-context/global-charts-provider.tsx
1319
1293
  const PLACEHOLDER_LABEL_COLORS = [LABEL_FALLBACK, LABEL_INVERSE_FALLBACK];
1320
1294
  const GlobalChartsContext = (0, react.createContext)(null);
1321
1295
  const GlobalChartsProvider = ({ children, theme, locale, timeZone }) => {
@@ -1496,21 +1470,18 @@ const GlobalChartsProvider = ({ children, theme, locale, timeZone }) => {
1496
1470
  })
1497
1471
  });
1498
1472
  };
1499
- //#endregion
1500
- //#region src/providers/chart-context/hooks/use-global-charts-context.ts
1473
+ // src/providers/chart-context/hooks/use-global-charts-context.ts
1501
1474
  const useGlobalChartsContext = () => {
1502
1475
  const context = (0, react.useContext)(GlobalChartsContext);
1503
1476
  if (!context) throw new Error("useGlobalChartsContext must be used within a GlobalChartsProvider");
1504
1477
  return context;
1505
1478
  };
1506
- //#endregion
1507
- //#region src/providers/chart-context/hooks/use-chart-id.ts
1479
+ // src/providers/chart-context/hooks/use-chart-id.ts
1508
1480
  const useChartId = (providedId) => {
1509
1481
  const generatedId = (0, react.useId)();
1510
1482
  return providedId || generatedId;
1511
1483
  };
1512
- //#endregion
1513
- //#region src/hooks/use-deep-memo.ts
1484
+ // src/hooks/use-deep-memo.ts
1514
1485
  var import_fast_deep_equal = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
1515
1486
  module.exports = function equal(a, b) {
1516
1487
  if (a === b) return true;
@@ -1551,16 +1522,14 @@ const useDeepMemo = (value) => {
1551
1522
  if (!(0, import_fast_deep_equal.default)(ref.current, value)) ref.current = value;
1552
1523
  return ref.current;
1553
1524
  };
1554
- //#endregion
1555
- //#region src/providers/chart-scope/use-chart-scope-element.ts
1525
+ // src/providers/chart-scope/use-chart-scope-element.ts
1556
1526
  /**
1557
1527
  * Returns the nearest chart scope element, or `null` when rendered outside any scope (and during SSR, before the ref is attached).
1558
1528
  *
1559
1529
  * @return {HTMLElement | null} The nearest chart scope element, or `null`.
1560
1530
  */
1561
1531
  const useChartScopeElement = () => (0, react.useContext)(ChartScopeContext);
1562
- //#endregion
1563
- //#region src/providers/chart-scope/use-standalone-scope-class.ts
1532
+ // src/providers/chart-scope/use-standalone-scope-class.ts
1564
1533
  /**
1565
1534
  * Returns the catalog class when there is no `GlobalChartsProvider` above this component, and `undefined` when there is.
1566
1535
  *
@@ -1569,8 +1538,7 @@ const useChartScopeElement = () => (0, react.useContext)(ChartScopeContext);
1569
1538
  * @return The scope class name, or undefined when a provider is present.
1570
1539
  */
1571
1540
  const useStandaloneScopeClass = () => (0, react.useContext)(GlobalChartsContext) ? void 0 : CHART_SCOPE_CLASS;
1572
- //#endregion
1573
- //#region src/hooks/use-xychart-theme.ts
1541
+ // src/hooks/use-xychart-theme.ts
1574
1542
  const STARTS_LIKE_A_NUMBER = /^[+-]?[\d.]/;
1575
1543
  const NON_NEGATIVE_CSS_NUMBER = /^\+?(?:\d*\.)?\d+(?:e[+-]?\d+)?(?:[a-z]+|%)?$/i;
1576
1544
  const isRenderableFontSize = (fontSize) => {
@@ -1626,8 +1594,7 @@ const useXYChartTheme = (data) => {
1626
1594
  scopeElement
1627
1595
  ]);
1628
1596
  };
1629
- //#endregion
1630
- //#region src/providers/chart-context/hooks/use-chart-formatting.ts
1597
+ // src/providers/chart-context/hooks/use-chart-formatting.ts
1631
1598
  const RUNTIME_FORMATTING = {};
1632
1599
  /**
1633
1600
  * The locale and time zone dates are rendered in, as set on `GlobalChartsProvider`.
@@ -1641,8 +1608,7 @@ const RUNTIME_FORMATTING = {};
1641
1608
  const useChartFormatting = () => {
1642
1609
  return (0, react.useContext)(GlobalChartsContext)?.formatting ?? RUNTIME_FORMATTING;
1643
1610
  };
1644
- //#endregion
1645
- //#region src/hooks/use-chart-data-transform.ts
1611
+ // src/hooks/use-chart-data-transform.ts
1646
1612
  /**
1647
1613
  * Hook that transforms and sorts chart data, handling date parsing and sorting
1648
1614
  *
@@ -1677,8 +1643,7 @@ const useChartDataTransform = (data) => {
1677
1643
  }));
1678
1644
  }, [data, timeZone]);
1679
1645
  };
1680
- //#endregion
1681
- //#region src/hooks/use-chart-margin.tsx
1646
+ // src/hooks/use-chart-margin.tsx
1682
1647
  /**
1683
1648
  * Base top margin used when no dynamic adjustments are necessary.
1684
1649
  */
@@ -1800,8 +1765,7 @@ const useChartMargin = (height, options, data, theme, horizontal = false) => {
1800
1765
  yTicks
1801
1766
  ]);
1802
1767
  };
1803
- //#endregion
1804
- //#region src/hooks/use-element-size.ts
1768
+ // src/hooks/use-element-size.ts
1805
1769
  /**
1806
1770
  * Hook to measure the width and height of a DOM element.
1807
1771
  * Returns a ref callback to attach to the element and the current dimensions in pixels.
@@ -1838,8 +1802,7 @@ function useElementSize({ initialWidth = 0, initialHeight = 0 } = {}) {
1838
1802
  height
1839
1803
  ];
1840
1804
  }
1841
- //#endregion
1842
- //#region src/hooks/use-text-truncation.ts
1805
+ // src/hooks/use-text-truncation.ts
1843
1806
  /**
1844
1807
  * Hook to detect if text content is truncated within its container.
1845
1808
  * Uses ResizeObserver to dynamically track changes in element size.
@@ -1880,8 +1843,7 @@ function useTextTruncation(enabled = true) {
1880
1843
  } else setIsTruncated(false);
1881
1844
  }, [enabled]), isTruncated];
1882
1845
  }
1883
- //#endregion
1884
- //#region src/hooks/use-zero-value-display.ts
1846
+ // src/hooks/use-zero-value-display.ts
1885
1847
  /**
1886
1848
  * Minimum pixel size for near-zero bars (non-zero values that would render too small).
1887
1849
  * Using 3px to be visible but not misleading - larger values might look like actual data.
@@ -1921,8 +1883,7 @@ const useZeroValueDisplay = (data, options = { enabled: false }) => {
1921
1883
  valueAxisLength
1922
1884
  ]);
1923
1885
  };
1924
- //#endregion
1925
- //#region src/hooks/use-data-with-percentages.ts
1886
+ // src/hooks/use-data-with-percentages.ts
1926
1887
  /**
1927
1888
  * Hook to calculate percentages from values for chart data.
1928
1889
  * Ensures percentages are always derived from values (single source of truth).
@@ -1939,8 +1900,7 @@ const useDataWithPercentages = (data) => {
1939
1900
  }));
1940
1901
  }, [data]);
1941
1902
  };
1942
- //#endregion
1943
- //#region src/hooks/use-legend-visibility-data.ts
1903
+ // src/hooks/use-legend-visibility-data.ts
1944
1904
  /**
1945
1905
  * Custom hook to filter and recalculate chart data based on series visibility.
1946
1906
  *
@@ -2012,8 +1972,7 @@ const useLegendVisibilityData = ({ data, chartId, isSeriesVisible }) => {
2012
1972
  ])
2013
1973
  };
2014
1974
  };
2015
- //#endregion
2016
- //#region src/hooks/use-prefers-reduced-motion.ts
1975
+ // src/hooks/use-prefers-reduced-motion.ts
2017
1976
  const QUERY = "(prefers-reduced-motion: no-preference)";
2018
1977
  const getInitialState = () => !window.matchMedia(QUERY).matches;
2019
1978
  /**
@@ -2034,11 +1993,9 @@ function usePrefersReducedMotion() {
2034
1993
  }, []);
2035
1994
  return prefersReducedMotion;
2036
1995
  }
2037
- //#endregion
2038
- //#region src/hooks/use-isomorphic-layout-effect.ts
1996
+ // src/hooks/use-isomorphic-layout-effect.ts
2039
1997
  const useIsomorphicLayoutEffect = typeof window !== "undefined" ? react.useLayoutEffect : react.useEffect;
2040
- //#endregion
2041
- //#region src/providers/chart-context/hooks/use-chart-registration.ts
1998
+ // src/providers/chart-context/hooks/use-chart-registration.ts
2042
1999
  const useChartRegistration = ({ chartId, legendItems, chartType, isDataValid, metadata }) => {
2043
2000
  const { registerChart, unregisterChart } = useGlobalChartsContext();
2044
2001
  const stableLegendItems = useDeepMemo(legendItems);
@@ -2060,8 +2017,7 @@ const useChartRegistration = ({ chartId, legendItems, chartType, isDataValid, me
2060
2017
  isDataValid
2061
2018
  ]);
2062
2019
  };
2063
- //#endregion
2064
- //#region src/providers/chart-context/hooks/use-global-charts-theme.ts
2020
+ // src/providers/chart-context/hooks/use-global-charts-theme.ts
2065
2021
  /**
2066
2022
  * Hook to get the global chart theme from GlobalChartsProvider
2067
2023
  *
@@ -2070,8 +2026,7 @@ const useChartRegistration = ({ chartId, legendItems, chartType, isDataValid, me
2070
2026
  const useGlobalChartsTheme = () => {
2071
2027
  return (0, react.useContext)(GlobalChartsContext)?.theme ?? defaultTheme;
2072
2028
  };
2073
- //#endregion
2074
- //#region src/components/legend/utils/value-or-identity.ts
2029
+ // src/components/legend/utils/value-or-identity.ts
2075
2030
  /**
2076
2031
  * Returns an object's value if defined, or the object.
2077
2032
  * @param _ - The object to return the value of.
@@ -2089,8 +2044,7 @@ function valueOrIdentity(_) {
2089
2044
  function valueOrIdentityString(_) {
2090
2045
  return String(valueOrIdentity(_));
2091
2046
  }
2092
- //#endregion
2093
- //#region src/components/legend/private/base-legend.module.scss
2047
+ // src/components/legend/private/base-legend.module.scss
2094
2048
  var base_legend_module_default = {
2095
2049
  "legend": "a8ccharts-04TogW-legend",
2096
2050
  "legend--horizontal": "a8ccharts-04TogW-legend--horizontal",
@@ -2102,8 +2056,7 @@ var base_legend_module_default = {
2102
2056
  "legend-item-text--wrap": "a8ccharts-04TogW-legend-item-text--wrap",
2103
2057
  "legend-item-value": "a8ccharts-04TogW-legend-item-value"
2104
2058
  };
2105
- //#endregion
2106
- //#region src/components/legend/private/base-legend.tsx
2059
+ // src/components/legend/private/base-legend.tsx
2107
2060
  const ALIGNMENT_TO_FLEX = {
2108
2061
  start: "flex-start",
2109
2062
  center: "center",
@@ -2172,16 +2125,17 @@ const BaseLegend = (0, react.forwardRef)(({ items: allItems, className, orientat
2172
2125
  chartId,
2173
2126
  context
2174
2127
  ]);
2175
- const createClickHandler = (0, react.useCallback)((seriesLabels, itemInteractive) => {
2128
+ const createClickHandler = (0, react.useCallback)((seriesLabels, itemInteractive, onToggle) => {
2176
2129
  if (!itemInteractive) return;
2177
- return () => handleLegendClick(seriesLabels);
2130
+ return onToggle ? () => onToggle() : () => handleLegendClick(seriesLabels);
2178
2131
  }, [handleLegendClick]);
2179
- const createKeyDownHandler = (0, react.useCallback)((seriesLabels, itemInteractive) => {
2132
+ const createKeyDownHandler = (0, react.useCallback)((seriesLabels, itemInteractive, onToggle) => {
2180
2133
  if (!itemInteractive) return;
2134
+ const toggle = onToggle ?? (() => handleLegendClick(seriesLabels));
2181
2135
  return (event) => {
2182
2136
  if (event.key === "Enter" || event.key === " ") {
2183
2137
  event.preventDefault();
2184
- handleLegendClick(seriesLabels);
2138
+ if (!event.repeat) toggle();
2185
2139
  }
2186
2140
  };
2187
2141
  }, [handleLegendClick]);
@@ -2205,10 +2159,11 @@ const BaseLegend = (0, react.forwardRef)(({ items: allItems, className, orientat
2205
2159
  children: labels.map((label, i) => {
2206
2160
  const matchedItem = items[i];
2207
2161
  const seriesLabels = matchedItem?.seriesLabels?.length ? matchedItem.seriesLabels : [label.text];
2208
- const visible = matchedItem?.interactive === false || isSeriesVisible(seriesLabels[0]);
2209
2162
  const itemInteractive = interactive && matchedItem?.interactive !== false;
2210
- const handleClick = createClickHandler(seriesLabels, itemInteractive);
2211
- const handleKeyDown = createKeyDownHandler(seriesLabels, itemInteractive);
2163
+ const onToggle = itemInteractive ? matchedItem?.onToggle : void 0;
2164
+ const visible = matchedItem?.onToggle ? matchedItem.pressed : matchedItem?.interactive === false || isSeriesVisible(seriesLabels[0]);
2165
+ const handleClick = createClickHandler(seriesLabels, itemInteractive, onToggle);
2166
+ const handleKeyDown = createKeyDownHandler(seriesLabels, itemInteractive, onToggle);
2212
2167
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_visx_legend.LegendItem, {
2213
2168
  className: (0, clsx.default)("visx-legend-item", base_legend_module_default["legend-item"], itemInteractive && base_legend_module_default["legend-item--interactive"], !visible && base_legend_module_default["legend-item--inactive"], itemClassName),
2214
2169
  margin: itemMargin,
@@ -2268,8 +2223,7 @@ const BaseLegend = (0, react.forwardRef)(({ items: allItems, className, orientat
2268
2223
  })
2269
2224
  });
2270
2225
  });
2271
- //#endregion
2272
- //#region src/components/legend/legend.tsx
2226
+ // src/components/legend/legend.tsx
2273
2227
  const defaultShapeByChartType = {
2274
2228
  area: "rect",
2275
2229
  line: "line",
@@ -2295,8 +2249,7 @@ const Legend = (0, react.forwardRef)(({ chartId, items, shape, ...props }, ref)
2295
2249
  chartId: contextChartId
2296
2250
  });
2297
2251
  });
2298
- //#endregion
2299
- //#region src/components/legend/hooks/use-chart-legend-items.ts
2252
+ // src/components/legend/hooks/use-chart-legend-items.ts
2300
2253
  /**
2301
2254
  * Wraps `getElementStyles` so a swatch takes the color given for its series.
2302
2255
  * @param getElementStyles - Function to get element styles
@@ -2552,15 +2505,13 @@ function useChartLegendItems(data, options = {}, legendShape) {
2552
2505
  legendShape
2553
2506
  ]);
2554
2507
  }
2555
- //#endregion
2556
- //#region src/components/tooltip/private/label-value-content.tsx
2508
+ // src/components/tooltip/private/label-value-content.tsx
2557
2509
  const LabelValueContent = ({ data }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
2558
2510
  data.label,
2559
2511
  ": ",
2560
2512
  data.valueDisplay || (0, _automattic_number_formatters.formatNumber)(data.value)
2561
2513
  ] });
2562
- //#endregion
2563
- //#region src/components/tooltip/private/tooltip-theme.tsx
2514
+ // src/components/tooltip/private/tooltip-theme.tsx
2564
2515
  const DEFAULT_SURFACE = "#1e1e1e";
2565
2516
  const TOOLTIP_SURFACE = `var(--a8c-charts-color-tooltip-surface, ${DEFAULT_SURFACE})`;
2566
2517
  const toSeed = (value) => {
@@ -2583,11 +2534,9 @@ const TooltipTheme = ({ children }) => {
2583
2534
  children
2584
2535
  });
2585
2536
  };
2586
- //#endregion
2587
- //#region src/components/tooltip/tooltip-box.module.scss
2537
+ // src/components/tooltip/tooltip-box.module.scss
2588
2538
  var tooltip_box_module_default = { "surface": "a8ccharts-ddpU1W-surface" };
2589
- //#endregion
2590
- //#region src/components/tooltip/tooltip-box.tsx
2539
+ // src/components/tooltip/tooltip-box.tsx
2591
2540
  /**
2592
2541
  * The chart tooltip box: the dark surface every chart tooltip draws. It does not position itself; place it with `style` or a wrapper.
2593
2542
  *
@@ -2607,8 +2556,7 @@ const TooltipBox = (0, react.forwardRef)(({ unstyled = false, role = "tooltip",
2607
2556
  return unstyled ? box : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipTheme, { children: box });
2608
2557
  });
2609
2558
  TooltipBox.displayName = "TooltipBox";
2610
- //#endregion
2611
- //#region src/components/tooltip/base-tooltip.tsx
2559
+ // src/components/tooltip/base-tooltip.tsx
2612
2560
  /**
2613
2561
  * A tooltip box with children or `label: value` content. Prefer `TooltipBox`.
2614
2562
  *
@@ -2642,6 +2590,80 @@ const BaseTooltip = ({ data, top, left, component: Component = LabelValueContent
2642
2590
  children: content
2643
2591
  });
2644
2592
  };
2593
+ // src/components/tooltip/private/keyboard-stops.ts
2594
+ const timeOf$1 = (point) => point?.date?.getTime();
2595
+ const getXPositions = (series) => {
2596
+ const positions = /* @__PURE__ */ new Set();
2597
+ for (const { data } of series) for (const point of data) {
2598
+ const time = timeOf$1(point);
2599
+ if (time !== void 0) positions.add(time);
2600
+ }
2601
+ return [...positions].sort((a, b) => a - b);
2602
+ };
2603
+ /**
2604
+ * Keyboard stops over the series: the sorted union of their dates, or array indexes when no point has a date.
2605
+ *
2606
+ * Once any point has a date, a series of undated points has no stop.
2607
+ *
2608
+ * @param series - The series to step through.
2609
+ * @return The stop count, and each series' point at a stop.
2610
+ */
2611
+ const getKeyboardStops = (series) => {
2612
+ const positions = getXPositions(series);
2613
+ if (positions.length === 0) return {
2614
+ count: Math.max(0, ...series.map(({ data }) => data.length)),
2615
+ membersAt: (stop) => series.flatMap((s) => stop < s.data.length ? [{
2616
+ series: s,
2617
+ datum: s.data[stop],
2618
+ index: stop
2619
+ }] : [])
2620
+ };
2621
+ return {
2622
+ count: positions.length,
2623
+ membersAt: (stop) => {
2624
+ const time = positions[stop];
2625
+ if (time === void 0) return [];
2626
+ return series.flatMap((s) => {
2627
+ const index = s.data.findIndex((point) => timeOf$1(point) === time);
2628
+ return index === -1 ? [] : [{
2629
+ series: s,
2630
+ datum: s.data[index],
2631
+ index
2632
+ }];
2633
+ });
2634
+ }
2635
+ };
2636
+ };
2637
+ // src/components/tooltip/private/at-nearest-date.ts
2638
+ const timeOf = (datum) => datum.date?.getTime();
2639
+ /**
2640
+ * Lists every registered series at the nearest datum's date, each with its own point there.
2641
+ *
2642
+ * The pointer hands each series its own nearest point, which for a series that skips that date, or that the pointer sits nearer another date of, is a neighbor's.
2643
+ *
2644
+ * @param tooltipData - The tooltip data visx collected.
2645
+ * @param registry - The chart's data registry.
2646
+ * @return The tooltip data, unchanged when the nearest datum has no date.
2647
+ */
2648
+ const atNearestDate = (tooltipData, registry) => {
2649
+ const nearest = tooltipData?.nearestDatum?.datum;
2650
+ const time = nearest ? timeOf(nearest) : void 0;
2651
+ if (!tooltipData || time === void 0) return tooltipData;
2652
+ const datumByKey = {};
2653
+ for (const { key, data } of registry?.entries() ?? []) {
2654
+ const index = data.findIndex((datum) => timeOf(datum) === time);
2655
+ if (index !== -1) datumByKey[key] = {
2656
+ key,
2657
+ index,
2658
+ datum: data[index]
2659
+ };
2660
+ }
2661
+ for (const [key, entry] of Object.entries(tooltipData.datumByKey)) if (!datumByKey[key] && timeOf(entry.datum) === time) datumByKey[key] = entry;
2662
+ return {
2663
+ ...tooltipData,
2664
+ datumByKey
2665
+ };
2666
+ };
2645
2667
  const POINTER_HEIGHT = 6;
2646
2668
  const clamp = (position, min, max, size) => Math.min(Math.max(position, min), Math.max(min, max - size));
2647
2669
  const isClipping = (element) => {
@@ -2820,8 +2842,7 @@ const BoundedTooltip = ({ left = 0, top = 0, offsetLeft = 10, offsetTop = 10, st
2820
2842
  }), children]
2821
2843
  });
2822
2844
  };
2823
- //#endregion
2824
- //#region src/components/tooltip/private/xy-chart-tooltip-overlay.tsx
2845
+ // src/components/tooltip/private/xy-chart-tooltip-overlay.tsx
2825
2846
  const CROSSHAIR_STROKE_WIDTH = 1.5;
2826
2847
  const CROSSHAIR_PAINT_PROPERTIES = /* @__PURE__ */ new Set([
2827
2848
  "stroke",
@@ -3006,18 +3027,21 @@ const XyChartTooltipContent = ({ tooltipContext, container, renderTooltip, rende
3006
3027
  */
3007
3028
  const XyChartTooltipOverlay = (props) => {
3008
3029
  const tooltipContext = (0, react.useContext)(_visx_xychart.TooltipContext);
3030
+ const dataRegistry = (0, react.useContext)(_visx_xychart.DataContext)?.dataRegistry;
3009
3031
  const [container, setContainer] = (0, react.useState)(null);
3010
3032
  const anchorRef = (0, react.useCallback)((node) => {
3011
3033
  setContainer(node?.ownerSVGElement?.parentElement ?? null);
3012
3034
  }, []);
3013
3035
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("g", { ref: anchorRef }), tooltipContext?.tooltipOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(XyChartTooltipContent, {
3014
3036
  ...props,
3015
- tooltipContext,
3037
+ tooltipContext: {
3038
+ ...tooltipContext,
3039
+ tooltipData: atNearestDate(tooltipContext.tooltipData, dataRegistry)
3040
+ },
3016
3041
  container
3017
3042
  })] });
3018
3043
  };
3019
- //#endregion
3020
- //#region src/components/tooltip/xy-chart-tooltip.tsx
3044
+ // src/components/tooltip/xy-chart-tooltip.tsx
3021
3045
  const XYChartTooltip = ({ renderTooltip, selectedIndex, tooltipRef, keyboardFocusedClassName, series = [], mode = "group", verticalCrosshairStyle, horizontalCrosshairStyle, ...props }) => {
3022
3046
  const tooltipContext = (0, react.useContext)(_visx_xychart.TooltipContext);
3023
3047
  const scopeElement = useChartScopeElement();
@@ -3042,6 +3066,7 @@ const XYChartTooltip = ({ renderTooltip, selectedIndex, tooltipRef, keyboardFocu
3042
3066
  }
3043
3067
  return flattened;
3044
3068
  }, [series, mode]);
3069
+ const stops = (0, react.useMemo)(() => getKeyboardStops(series), [series]);
3045
3070
  const hasKeyboardSelection = (0, react.useRef)(false);
3046
3071
  const closeTooltipNow = (0, react.useCallback)(() => {
3047
3072
  tooltipContext?.updateTooltip({
@@ -3075,19 +3100,20 @@ const XYChartTooltip = ({ renderTooltip, selectedIndex, tooltipRef, keyboardFocu
3075
3100
  hasKeyboardSelection.current = true;
3076
3101
  if (mode === "group") {
3077
3102
  closeTooltipNow();
3078
- series.forEach((s, index) => {
3079
- if (selectedIndex < s.data.length) {
3080
- const datum = s.data[selectedIndex];
3081
- tooltipContext?.showTooltip({
3082
- datum,
3083
- key: s.label,
3084
- index
3085
- });
3086
- }
3103
+ stops.membersAt(selectedIndex).forEach(({ series: member, datum, index }) => {
3104
+ tooltipContext?.showTooltip({
3105
+ datum,
3106
+ key: member.label,
3107
+ index
3108
+ });
3087
3109
  });
3088
3110
  } else if (mode === "individual") {
3089
3111
  if (selectedIndex < tooltipData.length) {
3090
3112
  const tooltipItem = tooltipData[selectedIndex];
3113
+ tooltipContext?.updateTooltip((state) => ({
3114
+ ...state,
3115
+ tooltipData: void 0
3116
+ }));
3091
3117
  tooltipContext?.showTooltip({
3092
3118
  datum: tooltipItem.datum,
3093
3119
  key: tooltipItem.seriesLabel,
@@ -3098,7 +3124,7 @@ const XYChartTooltip = ({ renderTooltip, selectedIndex, tooltipRef, keyboardFocu
3098
3124
  }, [
3099
3125
  selectedIndex,
3100
3126
  tooltipData,
3101
- series
3127
+ stops
3102
3128
  ]);
3103
3129
  const focusableRenderTooltip = (0, react.useMemo)(() => {
3104
3130
  if (!renderTooltip) return void 0;
@@ -3248,8 +3274,7 @@ const useKeyboardNavigation = ({ selectedIndex, setSelectedIndex, isNavigating,
3248
3274
  onChartPointerMove
3249
3275
  };
3250
3276
  };
3251
- //#endregion
3252
- //#region src/providers/chart-context/hooks/use-default-hidden-series.ts
3277
+ // src/providers/chart-context/hooks/use-default-hidden-series.ts
3253
3278
  /**
3254
3279
  * Seeds a chart's hidden series once per chart ID, the first time the provider
3255
3280
  * sees that ID.
@@ -3284,8 +3309,7 @@ const useDefaultHiddenSeries = (chartId, seriesLabels) => {
3284
3309
  chartId
3285
3310
  ]);
3286
3311
  };
3287
- //#endregion
3288
- //#region src/charts/private/chart-composition/chart-svg.tsx
3312
+ // src/charts/private/chart-composition/chart-svg.tsx
3289
3313
  /**
3290
3314
  * Compound component for SVG children in charts.
3291
3315
  * This component serves as a marker for SVG content that should be rendered
@@ -3299,8 +3323,7 @@ const ChartSVG = ({ children }) => {
3299
3323
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children });
3300
3324
  };
3301
3325
  ChartSVG.displayName = "Chart.SVG";
3302
- //#endregion
3303
- //#region src/charts/private/chart-composition/chart-html.tsx
3326
+ // src/charts/private/chart-composition/chart-html.tsx
3304
3327
  /**
3305
3328
  * Compound component for HTML children in charts.
3306
3329
  * This component serves as a marker for HTML content that should be rendered
@@ -3314,8 +3337,7 @@ const ChartHTML = ({ children }) => {
3314
3337
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children });
3315
3338
  };
3316
3339
  ChartHTML.displayName = "Chart.HTML";
3317
- //#endregion
3318
- //#region src/charts/private/chart-composition/render-legend-slot.ts
3340
+ // src/charts/private/chart-composition/render-legend-slot.ts
3319
3341
  /**
3320
3342
  * Renders legend children filtered by position slot.
3321
3343
  *
@@ -3326,8 +3348,7 @@ ChartHTML.displayName = "Chart.HTML";
3326
3348
  function renderLegendSlot(legendChildren, position) {
3327
3349
  return legendChildren.filter((l) => l.position === position).map((l, i) => (0, react.createElement)(react.Fragment, { key: `legend-${position}-${i}` }, l.element));
3328
3350
  }
3329
- //#endregion
3330
- //#region src/charts/private/chart-composition/use-chart-children.ts
3351
+ // src/charts/private/chart-composition/use-chart-children.ts
3331
3352
  /**
3332
3353
  * Custom hook to process and categorize chart children for composition API.
3333
3354
  * Extracts children from compound components (Chart.SVG, Chart.HTML) and
@@ -3380,11 +3401,9 @@ function useChartChildren(children, chartType) {
3380
3401
  };
3381
3402
  }, [children, chartType]);
3382
3403
  }
3383
- //#endregion
3384
- //#region src/charts/private/chart-layout/chart-layout.module.scss
3404
+ // src/charts/private/chart-layout/chart-layout.module.scss
3385
3405
  var chart_layout_module_default = { "chart-layout__content": "a8ccharts-fpNVAq-chart-layout__content" };
3386
- //#endregion
3387
- //#region src/charts/private/chart-layout/chart-layout.tsx
3406
+ // src/charts/private/chart-layout/chart-layout.tsx
3388
3407
  const ChartLayout = ({ legendPosition, legendElement, legendChildren, children, trailingContent, onContentHeightChange, gap, className, rootRef, style, "data-testid": dataTestId, "data-chart-id": dataChartId }) => {
3389
3408
  const [contentRef, contentWidth, contentHeight] = useElementSize();
3390
3409
  const isRenderProp = typeof children === "function";
@@ -3427,8 +3446,7 @@ const ChartLayout = ({ legendPosition, legendElement, legendChildren, children,
3427
3446
  ]
3428
3447
  });
3429
3448
  };
3430
- //#endregion
3431
- //#region src/charts/private/default-glyph/default-glyph.tsx
3449
+ // src/charts/private/default-glyph/default-glyph.tsx
3432
3450
  const DefaultGlyph = (props) => {
3433
3451
  const { theme } = (0, react.useContext)(_visx_xychart.DataContext) || {};
3434
3452
  props.position;
@@ -3443,8 +3461,7 @@ const DefaultGlyph = (props) => {
3443
3461
  ...props.glyphStyle
3444
3462
  });
3445
3463
  };
3446
- //#endregion
3447
- //#region src/charts/private/readings.ts
3464
+ // src/charts/private/readings.ts
3448
3465
  /**
3449
3466
  * Whether a value is a reading a scale can place.
3450
3467
  *
@@ -3468,11 +3485,9 @@ const isInvalidReading = (value, { allowMissing }) => value === null ? !allowMis
3468
3485
  * @return The formatted value.
3469
3486
  */
3470
3487
  const formatReading = (value) => value == null ? (0, _wordpress_i18n.__)("No data", "jetpack-charts") : (0, _automattic_number_formatters.formatNumber)(value);
3471
- //#endregion
3472
- //#region src/charts/private/center/center.module.scss
3488
+ // src/charts/private/center/center.module.scss
3473
3489
  var center_module_default = { "center": "a8ccharts-w3qxlG-center" };
3474
- //#endregion
3475
- //#region src/charts/private/center/center.tsx
3490
+ // src/charts/private/center/center.tsx
3476
3491
  /**
3477
3492
  * Centers its children on both axes and fills its parent.
3478
3493
  *
@@ -3494,11 +3509,9 @@ const Center = (0, react.forwardRef)(({ align = "center", justify = "center", cl
3494
3509
  ...props
3495
3510
  }));
3496
3511
  Center.displayName = "Center";
3497
- //#endregion
3498
- //#region src/charts/private/svg-empty-state/svg-empty-state.module.scss
3512
+ // src/charts/private/svg-empty-state/svg-empty-state.module.scss
3499
3513
  var svg_empty_state_module_default = { "svg-empty-state": "a8ccharts-udGPVq-svg-empty-state" };
3500
- //#endregion
3501
- //#region src/charts/private/svg-empty-state/svg-empty-state.tsx
3514
+ // src/charts/private/svg-empty-state/svg-empty-state.tsx
3502
3515
  /**
3503
3516
  * Renders empty-state text inside an SVG using foreignObject so that the
3504
3517
  * message wraps onto multiple lines instead of being clipped.
@@ -3525,8 +3538,7 @@ const SvgEmptyState = ({ x, y, width, height, children }) => {
3525
3538
  })
3526
3539
  });
3527
3540
  };
3528
- //#endregion
3529
- //#region src/charts/private/svg-empty-state/get-all-hidden-message.ts
3541
+ // src/charts/private/svg-empty-state/get-all-hidden-message.ts
3530
3542
  /**
3531
3543
  * Return the empty-state message for a chart whose items are all hidden.
3532
3544
  *
@@ -3546,8 +3558,7 @@ const getAllHiddenMessage = (interactive, itemType) => {
3546
3558
  if (interactive) return (0, _wordpress_i18n._x)("All series are hidden. Click legend items to show data.", "chart empty state: interactive series", "jetpack-charts");
3547
3559
  return (0, _wordpress_i18n._x)("All series are hidden.", "chart empty state: series", "jetpack-charts");
3548
3560
  };
3549
- //#endregion
3550
- //#region src/charts/private/time-axis.ts
3561
+ // src/charts/private/time-axis.ts
3551
3562
  const X_TICK_WIDTH = 60;
3552
3563
  const getCurveType = (type, smoothing) => {
3553
3564
  if (!type) return smoothing ? _visx_curve.curveCatmullRom : _visx_curve.curveLinear;
@@ -3804,8 +3815,7 @@ const guessOptimalNumTicks = (data, chartWidth, tickFormatter) => {
3804
3815
  }
3805
3816
  return Math.max(1, secondBestGuess);
3806
3817
  };
3807
- //#endregion
3808
- //#region src/charts/private/time-axis-options.ts
3818
+ // src/charts/private/time-axis-options.ts
3809
3819
  const toDateDomain = (domain) => domain ? [new Date(domain[0]), new Date(domain[1])] : void 0;
3810
3820
  /**
3811
3821
  * The x-axis options for a continuous time chart, shared by LineChart and AreaChart.
@@ -3840,8 +3850,7 @@ const buildTimeAxisOptions = ({ dataSorted, width, axisOptions, scaleDomain, zoo
3840
3850
  ...numTicks === void 0 ? {} : { numTicks }
3841
3851
  };
3842
3852
  };
3843
- //#endregion
3844
- //#region src/charts/private/whole-number-ticks.tsx
3853
+ // src/charts/private/whole-number-ticks.tsx
3845
3854
  /**
3846
3855
  * Whether every reading in the series is a whole number.
3847
3856
  *
@@ -3888,15 +3897,13 @@ const WholeNumberTicks = ({ axis, numTicks, enabled, children }) => {
3888
3897
  const tickValues = enabled ? getWholeNumberTickValues(axis === "x" ? xScale : yScale, numTicks) : void 0;
3889
3898
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: children(tickValues) });
3890
3899
  };
3891
- //#endregion
3892
- //#region src/charts/private/with-responsive/with-responsive.module.scss
3900
+ // src/charts/private/with-responsive/with-responsive.module.scss
3893
3901
  var with_responsive_module_default = {
3894
3902
  "container": "a8ccharts-sP1gHa-container",
3895
3903
  "content": "a8ccharts-sP1gHa-content",
3896
3904
  "isContained": "a8ccharts-sP1gHa-isContained"
3897
3905
  };
3898
- //#endregion
3899
- //#region src/charts/private/with-responsive/with-responsive.tsx
3906
+ // src/charts/private/with-responsive/with-responsive.tsx
3900
3907
  /**
3901
3908
  * A higher-order component that provides responsive dimensions
3902
3909
  * to the wrapped chart component using useParentSize from `@visx/responsive`.
@@ -3975,14 +3982,12 @@ function withResponsive(WrappedComponent) {
3975
3982
  });
3976
3983
  };
3977
3984
  }
3978
- //#endregion
3979
- //#region src/charts/private/x-zoom/x-zoom.module.scss
3985
+ // src/charts/private/x-zoom/x-zoom.module.scss
3980
3986
  var x_zoom_module_default = {
3981
3987
  "x-zoom__reset": "a8ccharts-ur9dWW-x-zoom__reset",
3982
3988
  "x-zoom__selection": "a8ccharts-ur9dWW-x-zoom__selection"
3983
3989
  };
3984
- //#endregion
3985
- //#region src/charts/private/x-zoom/x-zoom.tsx
3990
+ // src/charts/private/x-zoom/x-zoom.tsx
3986
3991
  const MIN_DRAG_PIXELS = 6;
3987
3992
  /**
3988
3993
  * Drag-to-zoom state + pointer handlers for an XY chart. Designed to be
@@ -4165,11 +4170,9 @@ function ZoomResetButton({ onClick }) {
4165
4170
  })
4166
4171
  });
4167
4172
  }
4168
- //#endregion
4169
- //#region src/charts/private/xy-plot/xy-plot.module.scss
4173
+ // src/charts/private/xy-plot/xy-plot.module.scss
4170
4174
  var xy_plot_module_default = { "xy-plot": "a8ccharts-bIyhgG-xy-plot" };
4171
- //#endregion
4172
- //#region src/charts/line-chart/line-chart.module.scss
4175
+ // src/charts/line-chart/line-chart.module.scss
4173
4176
  var line_chart_module_default = {
4174
4177
  "line-chart": "a8ccharts-inuQka-line-chart",
4175
4178
  "line-chart__annotation-label": "a8ccharts-inuQka-line-chart__annotation-label",
@@ -4271,8 +4274,7 @@ const LineChartAnnotationLabelWithPopover = ({ title, subtitle, renderLabel, ren
4271
4274
  })]
4272
4275
  });
4273
4276
  };
4274
- //#endregion
4275
- //#region src/charts/line-chart/private/line-chart-annotations-overlay.tsx
4277
+ // src/charts/line-chart/private/line-chart-annotations-overlay.tsx
4276
4278
  const LineChartAnnotationsOverlay = ({ children }) => {
4277
4279
  const { chartRef, chartWidth, chartHeight } = useChartInstanceContext();
4278
4280
  const [scales, setScales] = (0, react.useState)(null);
@@ -4355,8 +4357,7 @@ const LineChartAnnotationsOverlay = ({ children }) => {
4355
4357
  })
4356
4358
  });
4357
4359
  };
4358
- //#endregion
4359
- //#region src/charts/line-chart/private/line-chart-annotation.tsx
4360
+ // src/charts/line-chart/private/line-chart-annotation.tsx
4360
4361
  const ANNOTATION_MAX_WIDTH = 125;
4361
4362
  const ANNOTATION_INIT_HEIGHT = 100;
4362
4363
  const getLabelPosition = ({ subjectType, x, xMax, y, yMin, yMax, maxWidth, height }) => {
@@ -4549,8 +4550,7 @@ const LineChartAnnotation = ({ datum, title, subtitle, subjectType = "circle", s
4549
4550
  ]
4550
4551
  }) });
4551
4552
  };
4552
- //#endregion
4553
- //#region src/charts/line-chart/private/line-chart-glyph.tsx
4553
+ // src/charts/line-chart/private/line-chart-glyph.tsx
4554
4554
  const toNumber$1 = (val) => {
4555
4555
  const num = typeof val === "number" ? val : parseFloat(val);
4556
4556
  return isNaN(num) ? void 0 : num;
@@ -4580,8 +4580,7 @@ const LineChartGlyph = ({ data, index, color, glyphStyle, renderGlyph, accessors
4580
4580
  position
4581
4581
  });
4582
4582
  };
4583
- //#endregion
4584
- //#region src/charts/line-chart/private/nearest-pointer-events.tsx
4583
+ // src/charts/line-chart/private/nearest-pointer-events.tsx
4585
4584
  /**
4586
4585
  * Find the datum nearest a pointer along x, in one series sorted by x.
4587
4586
  *
@@ -4680,8 +4679,7 @@ function NearestPointerEvents({ onPointerDown, onPointerMove, onPointerUp }) {
4680
4679
  (0, _visx_xychart.useEventEmitter)("pointerup", handlers.pointerup);
4681
4680
  return null;
4682
4681
  }
4683
- //#endregion
4684
- //#region src/charts/line-chart/line-chart.tsx
4682
+ // src/charts/line-chart/line-chart.tsx
4685
4683
  const defaultRenderGlyph = (props) => {
4686
4684
  return /* @__PURE__ */ (0, react.createElement)(DefaultGlyph, {
4687
4685
  ...props,
@@ -4863,21 +4861,22 @@ const LineChartInternal = (0, react.forwardRef)(({ data, ariaLabel, chartId: pro
4863
4861
  isSeriesVisible,
4864
4862
  options?.yScale
4865
4863
  ]);
4866
- const activateSelectedPoint = (0, react.useCallback)((index) => {
4867
- const series = visibleSeries.find((candidate) => candidate.data[index]);
4868
- if (series) onDatumActivate?.({
4869
- datum: series.data[index],
4870
- index,
4871
- key: series.label
4864
+ const stops = (0, react.useMemo)(() => getKeyboardStops(visibleSeries), [visibleSeries]);
4865
+ const activateSelectedPoint = (0, react.useCallback)((stop) => {
4866
+ const match = stops.membersAt(stop)[0];
4867
+ if (match) onDatumActivate?.({
4868
+ datum: match.datum,
4869
+ index: match.index,
4870
+ key: match.series.label
4872
4871
  });
4873
- }, [visibleSeries, onDatumActivate]);
4872
+ }, [stops, onDatumActivate]);
4874
4873
  const { tooltipRef, onChartFocus, onChartBlur, onChartKeyDown } = useKeyboardNavigation({
4875
4874
  selectedIndex,
4876
4875
  setSelectedIndex,
4877
4876
  isNavigating,
4878
4877
  setIsNavigating,
4879
4878
  chartRef,
4880
- totalPoints: Math.max(0, ...visibleSeries.map((series) => series.data.length)),
4879
+ totalPoints: stops.count,
4881
4880
  visibleSeriesKey,
4882
4881
  onActivate: activateSelectedPoint,
4883
4882
  preventTooltipScroll: tooltipPlacement === "below-axis"
@@ -5211,15 +5210,13 @@ const LineChartResponsive = attachSubComponents(withResponsive(LineChartWithProv
5211
5210
  AnnotationsOverlay: LineChartAnnotationsOverlay,
5212
5211
  Annotation: LineChartAnnotation
5213
5212
  });
5214
- //#endregion
5215
- //#region src/charts/area-chart/area-chart.module.scss
5213
+ // src/charts/area-chart/area-chart.module.scss
5216
5214
  var area_chart_module_default = {
5217
5215
  "area-chart": "a8ccharts-jlynaq-area-chart",
5218
5216
  "area-chart--animated": "a8ccharts-jlynaq-area-chart--animated",
5219
5217
  "rise": "a8ccharts-jlynaq-rise"
5220
5218
  };
5221
- //#endregion
5222
- //#region src/charts/area-chart/private/validate-data.ts
5219
+ // src/charts/area-chart/private/validate-data.ts
5223
5220
  /**
5224
5221
  * Up-front data validation. Returns a localised error message when the chart
5225
5222
  * cannot safely render, otherwise `null`. Catches the cases that would
@@ -5235,8 +5232,7 @@ const validateData$3 = (data) => {
5235
5232
  if (data.some((series) => series.data.some((point) => isInvalidReading(point.value, { allowMissing: false }) || "date" in point && point.date && isNaN(point.date.getTime())))) return (0, _wordpress_i18n.__)("Invalid data", "jetpack-charts");
5236
5233
  return null;
5237
5234
  };
5238
- //#endregion
5239
- //#region src/charts/area-chart/private/overlays.tsx
5235
+ // src/charts/area-chart/private/overlays.tsx
5240
5236
  const AreaChartScalesRef = ({ chartRef, width, height, margin }) => {
5241
5237
  const context = (0, react.useContext)(_visx_xychart.DataContext);
5242
5238
  (0, react.useImperativeHandle)(chartRef, () => ({
@@ -5301,8 +5297,7 @@ const HoverGlyphs = ({ visibleSeries, stacked, stackOffset, getElementStyles, st
5301
5297
  children: circles
5302
5298
  });
5303
5299
  };
5304
- //#endregion
5305
- //#region src/charts/area-chart/area-chart.tsx
5300
+ // src/charts/area-chart/area-chart.tsx
5306
5301
  const AreaChartInternal = (0, react.forwardRef)(({ data, ariaLabel, chartId: providedChartId, width, height, className, margin, withTooltips = true, withTooltipCrosshairs, showLegend = false, legend = {}, stacked = true, stackOffset = "none", smoothing = true, curveType, fillOpacity, withStroke, renderTooltip = renderDefaultTooltip, animation, options = {}, onPointerDown, onPointerUp, onPointerMove, onPointerOut, zoomable = false, rescaleYOnVisibilityChange = true, defaultHiddenSeries, children, gridVisibility, gap = "md" }, ref) => {
5307
5302
  const legendInteractive = legend.interactive ?? false;
5308
5303
  const legendShape = legend.shape ?? "rect";
@@ -5348,19 +5343,22 @@ const AreaChartInternal = (0, react.forwardRef)(({ data, ariaLabel, chartId: pro
5348
5343
  }));
5349
5344
  }, [dataSorted, hiddenSeries]);
5350
5345
  const allSeriesHidden = (0, react.useMemo)(() => seriesWithVisibility.every(({ isVisible }) => !isVisible), [seriesWithVisibility]);
5351
- const hasWholeNumberValues = (0, react.useMemo)(() => (!stacked || stackOffset === "none") && hasOnlyWholeNumbers(dataSorted.filter((series) => isSeriesVisible(series.label))), [
5352
- dataSorted,
5353
- isSeriesVisible,
5346
+ const visibleDataSeries = (0, react.useMemo)(() => dataSorted.filter((series) => isSeriesVisible(series.label)), [dataSorted, isSeriesVisible]);
5347
+ const hasWholeNumberValues = (0, react.useMemo)(() => (!stacked || stackOffset === "none") && hasOnlyWholeNumbers(visibleDataSeries), [
5348
+ visibleDataSeries,
5354
5349
  stacked,
5355
5350
  stackOffset
5356
5351
  ]);
5352
+ const visibleSeriesKey = (0, react.useMemo)(() => JSON.stringify(visibleDataSeries.map((series) => series.label)), [visibleDataSeries]);
5353
+ const stops = (0, react.useMemo)(() => getKeyboardStops(visibleDataSeries), [visibleDataSeries]);
5357
5354
  const { tooltipRef, onChartFocus, onChartBlur, onChartKeyDown } = useKeyboardNavigation({
5358
5355
  selectedIndex,
5359
5356
  setSelectedIndex,
5360
5357
  isNavigating,
5361
5358
  setIsNavigating,
5362
5359
  chartRef,
5363
- totalPoints: dataSorted[0]?.data.length || 0
5360
+ totalPoints: stops.count,
5361
+ visibleSeriesKey
5364
5362
  });
5365
5363
  const fixedYDomain = (0, react.useMemo)(() => {
5366
5364
  if (rescaleYOnVisibilityChange || !dataSorted.length || !dataSorted[0].data.length || stacked && stackOffset !== "none") return;
@@ -5648,7 +5646,7 @@ const AreaChartInternal = (0, react.forwardRef)(({ data, ariaLabel, chartId: pro
5648
5646
  selectedIndex,
5649
5647
  tooltipRef,
5650
5648
  keyboardFocusedClassName: area_chart_module_default["area-chart__tooltip--keyboard-focused"],
5651
- series: dataSorted
5649
+ series: visibleDataSeries
5652
5650
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HoverGlyphs, {
5653
5651
  visibleSeries,
5654
5652
  stacked,
@@ -5684,8 +5682,7 @@ const AreaChartWithProvider = (0, react.forwardRef)((props, ref) => {
5684
5682
  AreaChartWithProvider.displayName = "AreaChart";
5685
5683
  const AreaChart = attachSubComponents(AreaChartWithProvider, { Legend });
5686
5684
  const AreaChartResponsive = attachSubComponents(withResponsive(AreaChartWithProvider), { Legend });
5687
- //#endregion
5688
- //#region src/charts/bar-chart/bar-chart.module.scss
5685
+ // src/charts/bar-chart/bar-chart.module.scss
5689
5686
  var bar_chart_module_default = {
5690
5687
  "bar-chart": "a8ccharts-97yN9W-bar-chart",
5691
5688
  "bar-chart--animated": "a8ccharts-97yN9W-bar-chart--animated",
@@ -5693,8 +5690,7 @@ var bar_chart_module_default = {
5693
5690
  "rise": "a8ccharts-97yN9W-rise",
5694
5691
  "stretch": "a8ccharts-97yN9W-stretch"
5695
5692
  };
5696
- //#endregion
5697
- //#region src/charts/bar-chart/private/truncated-tick-component.tsx
5693
+ // src/charts/bar-chart/private/truncated-tick-component.tsx
5698
5694
  /**
5699
5695
  * Get the bandwidth of a scale
5700
5696
  *
@@ -5808,8 +5804,7 @@ const createTruncatedTickComponent = (axis) => (props) => {
5808
5804
  */
5809
5805
  const TruncatedXTickComponent = createTruncatedTickComponent("x");
5810
5806
  const TruncatedYTickComponent = createTruncatedTickComponent("y");
5811
- //#endregion
5812
- //#region src/charts/bar-chart/private/value-domain.ts
5807
+ // src/charts/bar-chart/private/value-domain.ts
5813
5808
  /** Domain for a value axis that has nothing to scale, so its ticks still read 0 to 1. */
5814
5809
  const EMPTY_DOMAIN = [0, 1];
5815
5810
  /**
@@ -5860,8 +5855,7 @@ const getValueScaleDomain = (data, includeZero, isSeriesRendered) => {
5860
5855
  if (includeZero) return [Math.min(0, min), Math.max(0, max)];
5861
5856
  return null;
5862
5857
  };
5863
- //#endregion
5864
- //#region src/charts/bar-chart/private/use-bar-chart-options.ts
5858
+ // src/charts/bar-chart/private/use-bar-chart-options.ts
5865
5859
  /** Outer padding of the category band scale (space at the chart edges). */
5866
5860
  const BASE_BAND_PADDING = .2;
5867
5861
  /** Inner padding of the category band scale (the base gap between ticks). */
@@ -6077,8 +6071,7 @@ function useBarChartOptions(data, horizontal, options = {}, isSeriesRendered = A
6077
6071
  isSeriesRendered
6078
6072
  ]);
6079
6073
  }
6080
- //#endregion
6081
- //#region src/charts/bar-chart/private/band-scale.ts
6074
+ // src/charts/bar-chart/private/band-scale.ts
6082
6075
  /**
6083
6076
  * Match the inner slot scale used by visx BarGroup.
6084
6077
  * @param keys - Visible primary series keys.
@@ -6091,8 +6084,7 @@ const createGroupScale = (keys, bandwidth, padding) => (0, _visx_scale.scaleBand
6091
6084
  range: [0, bandwidth],
6092
6085
  padding
6093
6086
  });
6094
- //#endregion
6095
- //#region src/charts/bar-chart/private/comparison-bars-geometry.ts
6087
+ // src/charts/bar-chart/private/comparison-bars-geometry.ts
6096
6088
  /**
6097
6089
  * Mirrors visx's getScaleBaseline so bars drawn outside visx share the baseline of its bars, including out-of-domain zero values.
6098
6090
  *
@@ -6138,8 +6130,7 @@ function computeSlotRect(params) {
6138
6130
  height: valueLength
6139
6131
  };
6140
6132
  }
6141
- //#endregion
6142
- //#region src/charts/bar-chart/private/classified-bar-series.tsx
6133
+ // src/charts/bar-chart/private/classified-bar-series.tsx
6143
6134
  const ClassifiedBarSeries = ({ barClassName, primaryKeys, groupPadding, ...props }) => {
6144
6135
  const { xScale, yScale, horizontal } = (0, react.useContext)(_visx_xychart.DataContext);
6145
6136
  const bandScale = horizontal ? yScale : xScale;
@@ -6183,8 +6174,7 @@ const ClassifiedBarSeries = ({ barClassName, primaryKeys, groupPadding, ...props
6183
6174
  renderGlyph
6184
6175
  });
6185
6176
  };
6186
- //#endregion
6187
- //#region src/charts/bar-chart/private/slotted-bar-series.tsx
6177
+ // src/charts/bar-chart/private/slotted-bar-series.tsx
6188
6178
  const SlottedBarSeries = ({ barClassName, slotKeys, slotKey, thickness, groupPadding, ...props }) => {
6189
6179
  const { xScale, yScale, horizontal } = (0, react.useContext)(_visx_xychart.DataContext);
6190
6180
  const bandScale = horizontal ? yScale : xScale;
@@ -6227,16 +6217,14 @@ const SlottedBarSeries = ({ barClassName, slotKeys, slotKey, thickness, groupPad
6227
6217
  renderGlyph
6228
6218
  });
6229
6219
  };
6230
- //#endregion
6231
- //#region src/charts/private/selected-ring/selected-ring.module.scss
6220
+ // src/charts/private/selected-ring/selected-ring.module.scss
6232
6221
  var selected_ring_module_default = {
6233
6222
  "selected-ring__contrast": "a8ccharts-gx1_AW-selected-ring__contrast",
6234
6223
  "selected-ring__edge": "a8ccharts-gx1_AW-selected-ring__edge",
6235
6224
  "selected-ring__far": "a8ccharts-gx1_AW-selected-ring__far",
6236
6225
  "selected-ring__focus": "a8ccharts-gx1_AW-selected-ring__focus"
6237
6226
  };
6238
- //#endregion
6239
- //#region src/charts/private/selected-ring/selected-ring.tsx
6227
+ // src/charts/private/selected-ring/selected-ring.tsx
6240
6228
  const TONES = {
6241
6229
  inside: ["contrast", "focus"],
6242
6230
  outside: ["focus", "contrast"]
@@ -6283,8 +6271,7 @@ const SelectedRing = ({ chartId, d, side, testId }) => {
6283
6271
  ]
6284
6272
  });
6285
6273
  };
6286
- //#endregion
6287
- //#region src/charts/bar-chart/private/selected-bar-ring.tsx
6274
+ // src/charts/bar-chart/private/selected-bar-ring.tsx
6288
6275
  /**
6289
6276
  * Marks the keyboard-selected slot with a two-tone ring outside its edge, so the ring reads against any bar color.
6290
6277
  *
@@ -6325,8 +6312,7 @@ const SelectedBarRing = ({ chartId, selected, slotKeys, groupPadding, horizontal
6325
6312
  testId: "bar-chart-selected-ring"
6326
6313
  });
6327
6314
  };
6328
- //#endregion
6329
- //#region src/charts/bar-chart/private/bar-layer.tsx
6315
+ // src/charts/bar-chart/private/bar-layer.tsx
6330
6316
  /**
6331
6317
  * Draws the bars in front of any comparison shadows, slotted for an overlap layout and grouped by visx otherwise, then the selected bar's ring.
6332
6318
  *
@@ -6394,8 +6380,7 @@ const BarLayer = ({ chartId, overlapSlots, selectedBar, primaryEntries, primaryK
6394
6380
  yAccessor
6395
6381
  })] });
6396
6382
  };
6397
- //#endregion
6398
- //#region src/charts/bar-chart/private/slot-tooltip-members.tsx
6383
+ // src/charts/bar-chart/private/slot-tooltip-members.tsx
6399
6384
  /**
6400
6385
  * Fills the tooltip with every bar of the keyboard-selected category, and only those.
6401
6386
  *
@@ -6403,26 +6388,20 @@ const BarLayer = ({ chartId, overlapSlots, selectedBar, primaryEntries, primaryK
6403
6388
  *
6404
6389
  * @param props - Component props.
6405
6390
  * @param props.members - The category's bars, the keyboard stop last.
6406
- * @param props.index - The selected data point.
6407
6391
  * @return No visual content.
6408
6392
  */
6409
- function SlotTooltipMembers({ members, index }) {
6393
+ function SlotTooltipMembers({ members }) {
6410
6394
  const { showTooltip, updateTooltip } = (0, react.useContext)(_visx_xychart.TooltipContext) ?? {};
6411
6395
  (0, react.useEffect)(() => {
6412
6396
  updateTooltip?.((state) => ({
6413
6397
  ...state,
6414
6398
  tooltipData: void 0
6415
6399
  }));
6416
- members.forEach(({ key, datum }) => showTooltip?.({
6417
- key,
6418
- datum,
6419
- index
6420
- }));
6421
- }, [members, index]);
6400
+ members.forEach((member) => showTooltip?.(member));
6401
+ }, [members]);
6422
6402
  return null;
6423
6403
  }
6424
- //#endregion
6425
- //#region src/charts/bar-chart/private/overlap-bars.ts
6404
+ // src/charts/bar-chart/private/overlap-bars.ts
6426
6405
  const PRIMARY_SLOT = "primary";
6427
6406
  const COMPARISON_SLOT = "comparison";
6428
6407
  const OVERLAP_SLOTS = [PRIMARY_SLOT, COMPARISON_SLOT];
@@ -6530,8 +6509,7 @@ function getOverlapBarColors(series, colors, slotColors, background) {
6530
6509
  });
6531
6510
  return barColors;
6532
6511
  }
6533
- //#endregion
6534
- //#region src/charts/bar-chart/private/use-overlap-slots.ts
6512
+ // src/charts/bar-chart/private/use-overlap-slots.ts
6535
6513
  /**
6536
6514
  * Whether two data points sit at the same category: the same label, or the same date.
6537
6515
  *
@@ -6540,7 +6518,7 @@ function getOverlapBarColors(series, colors, slotColors, background) {
6540
6518
  * @return Whether `point` is at `category`.
6541
6519
  */
6542
6520
  function isSameCategory(point, category) {
6543
- return category.label != null ? point.label === category.label : !!category.date && !!point.date && point.date.getTime() === category.date.getTime();
6521
+ return category.label ? point.label === category.label : !!category.date && !!point.date && point.date.getTime() === category.date.getTime();
6544
6522
  }
6545
6523
  /**
6546
6524
  * Lays out the visible series of an overlap layout in slots and layers.
@@ -6585,7 +6563,7 @@ function useOverlapSlots(enabled, seriesWithVisibility) {
6585
6563
  * @return The category key.
6586
6564
  */
6587
6565
  function categoryKey(point) {
6588
- return point.label != null ? `label:${point.label}` : `date:${point.date?.getTime()}`;
6566
+ return point.label ? `label:${point.label}` : `date:${point.date?.getTime()}`;
6589
6567
  }
6590
6568
  /**
6591
6569
  * Lists a stop for every slot at every category that slot draws a bar at, category by category.
@@ -6623,6 +6601,25 @@ function getStopPositions(entries, slotKeys, slotOf) {
6623
6601
  }));
6624
6602
  }
6625
6603
  /**
6604
+ * Every bar at a category, each with its own data point index, the keyboard stop last.
6605
+ *
6606
+ * @param entries - The visible series.
6607
+ * @param category - The data point naming the category.
6608
+ * @param stopKey - The series the keyboard stop is on.
6609
+ * @return The category's bars; the last one shown becomes the tooltip's nearest datum.
6610
+ */
6611
+ function membersAt(entries, category, stopKey) {
6612
+ const members = entries.flatMap(({ series }) => {
6613
+ const index = series.data.findIndex((point) => isSameCategory(point, category));
6614
+ return index === -1 ? [] : [{
6615
+ key: series.label,
6616
+ datum: series.data[index],
6617
+ index
6618
+ }];
6619
+ });
6620
+ return [...members.filter(({ key }) => key !== stopKey), ...members.filter(({ key }) => key === stopKey)];
6621
+ }
6622
+ /**
6626
6623
  * The slot a keyboard index selects, and every bar at its category.
6627
6624
  *
6628
6625
  * @param slots - The overlap layout.
@@ -6632,25 +6629,17 @@ function getStopPositions(entries, slotKeys, slotOf) {
6632
6629
  function getSelectedSlot(slots, selectedIndex) {
6633
6630
  const position = selectedIndex === void 0 ? void 0 : slots?.positions[selectedIndex];
6634
6631
  if (!slots || !position) return;
6635
- const { slotKey, key: stopKey, datum: category, dataPointIndex } = position;
6636
- const members = slots.entries.flatMap(({ series }) => {
6637
- const datum = series.data.find((point) => isSameCategory(point, category));
6638
- return datum ? [{
6639
- key: series.label,
6640
- datum
6641
- }] : [];
6642
- });
6632
+ const { slotKey, key: stopKey, datum: category } = position;
6633
+ const members = membersAt(slots.entries, category, stopKey);
6643
6634
  const slotBars = members.filter(({ key, datum }) => isBarRendered(datum) && slots.slotOf(key) === slotKey);
6644
6635
  return {
6645
6636
  data: slotBars.map(({ datum }) => datum),
6646
6637
  slotKey,
6647
6638
  thickness: Math.max(...slotBars.map(({ key }) => slots.thicknessOf(key))),
6648
- index: dataPointIndex,
6649
- members: [...members.filter(({ key }) => key !== stopKey), ...members.filter(({ key }) => key === stopKey)]
6639
+ members
6650
6640
  };
6651
6641
  }
6652
- //#endregion
6653
- //#region src/charts/bar-chart/private/use-bar-stops.ts
6642
+ // src/charts/bar-chart/private/use-bar-stops.ts
6654
6643
  /**
6655
6644
  * Lays out the keyboard stops: one per slot and category in an overlap layout, else one per primary bar, series-major within each category.
6656
6645
  *
@@ -6662,7 +6651,6 @@ function useBarStops(overlapSlots, primaryEntries) {
6662
6651
  const series = (0, react.useMemo)(() => overlapSlots ? [] : primaryEntries.map((entry) => entry.series), [overlapSlots, primaryEntries]);
6663
6652
  return {
6664
6653
  count: overlapSlots?.positions.length ?? Math.max(0, ...series.map((item) => item.data.length)) * series.length,
6665
- series,
6666
6654
  key: (0, react.useMemo)(() => JSON.stringify(overlapSlots?.keys ?? series.map((item) => item.label)), [overlapSlots, series]),
6667
6655
  barAt: (0, react.useCallback)((stop) => {
6668
6656
  if (overlapSlots) {
@@ -6705,8 +6693,7 @@ const MAX_GROUP_PADDING = .9;
6705
6693
  * gap between ticks. `0.75` = a 25% reduction of the tick-gap padding.
6706
6694
  */
6707
6695
  const COMPARISON_TICK_GAP_FACTOR = .75;
6708
- //#endregion
6709
- //#region src/charts/bar-chart/private/comparison-bars.tsx
6696
+ // src/charts/bar-chart/private/comparison-bars.tsx
6710
6697
  const ComparisonBars = ({ comparisonEntries, primaryKeys, groupPadding, horizontal, xAccessor, yAccessor, getElementStyles, resolveFill }) => {
6711
6698
  const context = (0, react.useContext)(_visx_xychart.DataContext);
6712
6699
  const xScale = context?.xScale;
@@ -6765,8 +6752,7 @@ const ComparisonBars = ({ comparisonEntries, primaryKeys, groupPadding, horizont
6765
6752
  children: rects
6766
6753
  });
6767
6754
  };
6768
- //#endregion
6769
- //#region src/charts/bar-chart/private/band-highlight.tsx
6755
+ // src/charts/bar-chart/private/band-highlight.tsx
6770
6756
  /**
6771
6757
  * Render and report the active band using the chart’s registered scales.
6772
6758
  * @param root0 - Highlight options.
@@ -6825,8 +6811,7 @@ function BandHighlight({ visible, horizontal, onChange }) {
6825
6811
  fill: CATALOG_POINTERS.surfaceSecondary
6826
6812
  });
6827
6813
  }
6828
- //#endregion
6829
- //#region src/charts/bar-chart/private/band-tooltip.tsx
6814
+ // src/charts/bar-chart/private/band-tooltip.tsx
6830
6815
  /**
6831
6816
  * Find a category by its painted center, including outer padding and reversed ranges.
6832
6817
  * @param data - Registered series points.
@@ -6945,8 +6930,7 @@ function BandTooltip({ keys, slots, groupPadding, withTooltips, onPointerDown, o
6945
6930
  (0, _visx_xychart.useEventEmitter)("pointerup", onPointerUp ? handlePointer : void 0);
6946
6931
  return null;
6947
6932
  }
6948
- //#endregion
6949
- //#region src/charts/bar-chart/private/grouped-bars.ts
6933
+ // src/charts/bar-chart/private/grouped-bars.ts
6950
6934
  /**
6951
6935
  * Pairs each comparison series with the primary of its `group`, or with the only primary.
6952
6936
  *
@@ -6986,8 +6970,7 @@ function getGroupedBarColors(series, colors, background) {
6986
6970
  });
6987
6971
  return barColors;
6988
6972
  }
6989
- //#endregion
6990
- //#region src/charts/bar-chart/use-bar-colors.ts
6973
+ // src/charts/bar-chart/use-bar-colors.ts
6991
6974
  /**
6992
6975
  * Reads the colors `BarChart` fills series with, so a custom tooltip or legend can match the bars.
6993
6976
  *
@@ -7009,8 +6992,7 @@ function useBarColors() {
7009
6992
  comparisonOpacity
7010
6993
  ]);
7011
6994
  }
7012
- //#endregion
7013
- //#region src/charts/bar-chart/use-bar-legend-items.ts
6995
+ // src/charts/bar-chart/use-bar-legend-items.ts
7014
6996
  const isComparison = (data, label) => data.some((series) => series.label === label && series.options?.type === "comparison");
7015
6997
  /**
7016
6998
  * Applies what a bar layout changes about a legend: overlap lists every primary before every comparison, as it draws their slots, with every swatch opaque like its bar; a collapsed grouped item takes its comparison's tint, the wider bar that frames the group.
@@ -7074,8 +7056,7 @@ function useBarLegendItems(data, options = {}, legendShape) {
7074
7056
  seriesColors
7075
7057
  ]);
7076
7058
  }
7077
- //#endregion
7078
- //#region src/charts/bar-chart/bar-chart.tsx
7059
+ // src/charts/bar-chart/bar-chart.tsx
7079
7060
  const validateData$2 = (data) => {
7080
7061
  if (!data?.length) return (0, _wordpress_i18n.__)("No data available", "jetpack-charts");
7081
7062
  if (data.some((series) => series.data.some((point) => isInvalidReading(point.value, { allowMissing: true }) || !point.label && (!("date" in point && point.date) || isNaN(point.date.getTime()))))) return (0, _wordpress_i18n.__)("Invalid data", "jetpack-charts");
@@ -7266,10 +7247,7 @@ const BarChartInternal = ({ data, ariaLabel, chartId: providedChartId, width, he
7266
7247
  const primaryKey = tooltipData?.nearestDatum?.key;
7267
7248
  const categoryLabel = chartOptions.tooltip.labelFormatter(nearestDatum.label || (nearestDatum.date ? nearestDatum.date.getTime() : 0), 0, []);
7268
7249
  const comparisonEntry = comparisonEntries.find((entry) => entry.primaryKey === primaryKey);
7269
- const comparisonDatum = comparisonEntry?.series.data.find((point) => {
7270
- const p = point;
7271
- return nearestDatum.label != null ? p.label === nearestDatum.label : !!nearestDatum.date && !!p.date && p.date.getTime() === nearestDatum.date.getTime();
7272
- });
7250
+ const comparisonDatum = comparisonEntry?.series.data.find((point) => isSameCategory(point, nearestDatum));
7273
7251
  if (comparisonEntry && comparisonDatum) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7274
7252
  className: bar_chart_module_default["bar-chart__tooltip"],
7275
7253
  children: [
@@ -7339,6 +7317,17 @@ const BarChartInternal = ({ data, ariaLabel, chartId: providedChartId, width, he
7339
7317
  slotOf: overlapSlots.slotOf
7340
7318
  }, [overlapSlots]);
7341
7319
  const selectedSlot = (0, react.useMemo)(() => getSelectedSlot(overlapSlots, selectedIndex), [overlapSlots, selectedIndex]);
7320
+ const selectedGroup = (0, react.useMemo)(() => {
7321
+ const stop = overlapSlots || selectedIndex === void 0 ? void 0 : barAt(selectedIndex);
7322
+ if (!stop) return;
7323
+ return membersAt(primaryEntries, stop.datum, stop.key);
7324
+ }, [
7325
+ overlapSlots,
7326
+ selectedIndex,
7327
+ barAt,
7328
+ primaryEntries
7329
+ ]);
7330
+ const selectedMembers = selectedSlot?.members ?? selectedGroup;
7342
7331
  const selectedBar = (0, react.useMemo)(() => {
7343
7332
  if (overlapSlots) return selectedSlot;
7344
7333
  const bar = selectedIndex === void 0 ? void 0 : barAt(selectedIndex);
@@ -7501,10 +7490,7 @@ const BarChartInternal = ({ data, ariaLabel, chartId: providedChartId, width, he
7501
7490
  ...!horizontal && valueTicks ? { tickValues: valueTicks } : {}
7502
7491
  })] })
7503
7492
  }),
7504
- withTooltips && selectedSlot && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SlotTooltipMembers, {
7505
- members: selectedSlot.members,
7506
- index: selectedSlot.index
7507
- }),
7493
+ withTooltips && selectedMembers && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SlotTooltipMembers, { members: selectedMembers }),
7508
7494
  withTooltips && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(XYChartTooltip, {
7509
7495
  tooltipPlacement,
7510
7496
  tooltipAnchorTop,
@@ -7516,7 +7502,6 @@ const BarChartInternal = ({ data, ariaLabel, chartId: providedChartId, width, he
7516
7502
  selectedIndex,
7517
7503
  tooltipRef,
7518
7504
  keyboardFocusedClassName: bar_chart_module_default["bar-chart__tooltip--keyboard-focused"],
7519
- series: stops.series,
7520
7505
  mode: "individual"
7521
7506
  })
7522
7507
  ]
@@ -7534,8 +7519,7 @@ const BarChartWithProvider = (props) => {
7534
7519
  BarChartWithProvider.displayName = "BarChart";
7535
7520
  const BarChart = attachSubComponents(BarChartWithProvider, { Legend });
7536
7521
  const BarChartResponsive = attachSubComponents(withResponsive(BarChartWithProvider), { Legend });
7537
- //#endregion
7538
- //#region src/charts/bar-list-chart/bar-list-chart.tsx
7522
+ // src/charts/bar-list-chart/bar-list-chart.tsx
7539
7523
  /**
7540
7524
  * Get the bandwidth of a scale
7541
7525
  * @param scale - The scale to get the bandwidth of
@@ -7704,8 +7688,7 @@ const BarListChart = (props) => {
7704
7688
  };
7705
7689
  BarListChart.displayName = "BarListChart";
7706
7690
  const BarListChartResponsive = withResponsive(BarListChart);
7707
- //#endregion
7708
- //#region src/charts/conversion-funnel-chart/conversion-funnel-chart.module.scss
7691
+ // src/charts/conversion-funnel-chart/conversion-funnel-chart.module.scss
7709
7692
  var conversion_funnel_chart_module_default = {
7710
7693
  "bar-container": "a8ccharts-mGEVca-bar-container",
7711
7694
  "change-indicator": "a8ccharts-mGEVca-change-indicator",
@@ -7724,83 +7707,131 @@ var conversion_funnel_chart_module_default = {
7724
7707
  "main-rate": "a8ccharts-mGEVca-main-rate",
7725
7708
  "step-label": "a8ccharts-mGEVca-step-label",
7726
7709
  "step-rate": "a8ccharts-mGEVca-step-rate",
7710
+ "step-text": "a8ccharts-mGEVca-step-text",
7727
7711
  "stretch": "a8ccharts-mGEVca-stretch",
7728
- "tooltip-content": "a8ccharts-mGEVca-tooltip-content",
7729
- "tooltip-title": "a8ccharts-mGEVca-tooltip-title"
7712
+ "tooltip-label": "a8ccharts-mGEVca-tooltip-label",
7713
+ "tooltip-title": "a8ccharts-mGEVca-tooltip-title",
7714
+ "tooltip-value": "a8ccharts-mGEVca-tooltip-value"
7730
7715
  };
7731
- //#endregion
7732
- //#region src/charts/conversion-funnel-chart/private/use-funnel-selection.ts
7716
+ // src/charts/conversion-funnel-chart/private/use-funnel-selection.ts
7733
7717
  /**
7734
- * Custom hook to manage funnel bar selection state and interactions
7718
+ * Custom hook to manage funnel step selection state
7735
7719
  * @param hideTooltip - Function to hide tooltip when selection is cleared
7736
- * @return Object containing selection state and event handlers
7720
+ * @return Object containing selection state and its setters
7737
7721
  */
7738
7722
  const useFunnelSelection = (hideTooltip) => {
7739
- const [clickedStep, setClickedStep] = (0, react.useState)(null);
7723
+ const [selectedStepId, setSelectedStepId] = (0, react.useState)(null);
7740
7724
  return {
7741
- clickedStep,
7742
- handleBarClick: (0, react.useCallback)((stepId) => {
7743
- if (clickedStep === stepId) {
7744
- setClickedStep(null);
7745
- hideTooltip?.();
7746
- } else setClickedStep(stepId);
7747
- }, [clickedStep, hideTooltip]),
7748
- handleBarKeyDown: (0, react.useCallback)((stepId, event) => {
7749
- if (event.key === "Enter" || event.key === " ") {
7750
- event.preventDefault();
7751
- if (clickedStep === stepId) {
7752
- setClickedStep(null);
7753
- hideTooltip?.();
7754
- } else setClickedStep(stepId);
7755
- } else if (event.key === "Escape") {
7756
- event.preventDefault();
7757
- setClickedStep(null);
7758
- hideTooltip?.();
7759
- }
7760
- }, [clickedStep, hideTooltip]),
7725
+ selectedStepId,
7726
+ selectStep: setSelectedStepId,
7761
7727
  clearSelection: (0, react.useCallback)(() => {
7762
- setClickedStep(null);
7728
+ setSelectedStepId(null);
7763
7729
  hideTooltip?.();
7764
7730
  }, [hideTooltip]),
7765
7731
  getStepState: (0, react.useCallback)((stepId) => ({
7766
- isClicked: clickedStep === stepId,
7767
- isBlurred: clickedStep !== null && clickedStep !== stepId
7768
- }), [clickedStep])
7732
+ isSelected: selectedStepId === stepId,
7733
+ isBlurred: selectedStepId !== null && selectedStepId !== stepId
7734
+ }), [selectedStepId])
7735
+ };
7736
+ };
7737
+ // src/charts/conversion-funnel-chart/private/use-roving-step-focus.ts
7738
+ const getTargetIndex = (key, index, count, isRtl) => {
7739
+ const nextKey = isRtl ? "ArrowLeft" : "ArrowRight";
7740
+ const previousKey = isRtl ? "ArrowRight" : "ArrowLeft";
7741
+ switch (key) {
7742
+ case nextKey: return Math.min(index + 1, count - 1);
7743
+ case previousKey: return Math.max(index - 1, 0);
7744
+ case "Home": return 0;
7745
+ case "End": return count - 1;
7746
+ default: return;
7747
+ }
7748
+ };
7749
+ /**
7750
+ * Roving tabindex for the funnel steps: one Tab stop, and arrow keys, Home and End move focus between steps.
7751
+ *
7752
+ * @param stepIds - Step ids in visual order.
7753
+ * @param selectedStepId - The selected step, which holds the Tab stop until any step has taken focus.
7754
+ * @return Tab index, element registration, focus and key handlers for each step.
7755
+ */
7756
+ const useRovingStepFocus = (stepIds, selectedStepId) => {
7757
+ const [focusedStepId, setFocusedStepId] = (0, react.useState)(null);
7758
+ const stepElements = (0, react.useRef)(/* @__PURE__ */ new Map());
7759
+ const tabStopId = [focusedStepId, selectedStepId].find((id) => id !== null && stepIds.includes(id)) ?? stepIds[0];
7760
+ return {
7761
+ getTabIndex: (0, react.useCallback)((stepId) => stepId === tabStopId ? 0 : -1, [tabStopId]),
7762
+ setStepElement: (0, react.useCallback)((stepId, element) => {
7763
+ if (element) stepElements.current.set(stepId, element);
7764
+ else stepElements.current.delete(stepId);
7765
+ }, []),
7766
+ handleStepFocus: (0, react.useCallback)((stepId) => {
7767
+ setFocusedStepId(stepId);
7768
+ }, []),
7769
+ handleNavigationKey: (0, react.useCallback)((stepId, event) => {
7770
+ if (event.altKey || event.ctrlKey || event.metaKey) return false;
7771
+ const isRtl = getComputedStyle(event.currentTarget).direction === "rtl";
7772
+ const targetIndex = getTargetIndex(event.key, stepIds.indexOf(stepId), stepIds.length, isRtl);
7773
+ if (targetIndex === void 0) return false;
7774
+ event.preventDefault();
7775
+ stepElements.current.get(stepIds[targetIndex])?.focus();
7776
+ return true;
7777
+ }, [stepIds])
7769
7778
  };
7770
7779
  };
7771
- //#endregion
7772
- //#region src/charts/conversion-funnel-chart/conversion-funnel-chart.tsx
7780
+ // src/charts/conversion-funnel-chart/conversion-funnel-chart.tsx
7773
7781
  /** Chart height (px) below which the funnel tightens its gaps so the bars keep their room. */
7774
7782
  const SHORT_CHART_HEIGHT = 180;
7783
+ const formatStepCount = (count) => (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n._n)("%s item", "%s items", count, "jetpack-charts"), formatMetricValue(count));
7784
+ const getDefaultTooltipContent = (step) => ({
7785
+ value: step.count === void 0 ? void 0 : formatStepCount(step.count),
7786
+ rows: [{
7787
+ label: (0, _wordpress_i18n.__)("Conversion rate", "jetpack-charts"),
7788
+ value: formatPercentage(step.rate)
7789
+ }]
7790
+ });
7791
+ const getDefaultTooltipIds = (tooltipId, { rows = [] }) => ({
7792
+ value: `${tooltipId}-value`,
7793
+ rows: rows.map((_, index) => ({
7794
+ label: `${tooltipId}-row-${index}-label`,
7795
+ value: `${tooltipId}-row-${index}-value`
7796
+ }))
7797
+ });
7798
+ const getDefaultTooltipDescriptionIds = (tooltipId, content) => {
7799
+ const ids = getDefaultTooltipIds(tooltipId, content);
7800
+ return [...content.value ? [ids.value] : [], ...ids.rows.flatMap((row) => [row.label, row.value])].join(" ");
7801
+ };
7775
7802
  /**
7776
7803
  * Internal ConversionFunnelChart component with chart registration
7777
7804
  *
7778
- * @param props - Component props
7779
- * @param props.chartId - Optional unique identifier for the chart
7780
- * @param props.mainRate - Main conversion rate to highlight
7781
- * @param props.changeIndicator - Change indicator (e.g., +2%, -1.5%)
7782
- * @param props.steps - Array of funnel steps
7783
- * @param props.loading - Whether the chart is in loading state
7784
- * @param props.animation - Whether to show chart animation on initial render or not
7785
- * @param props.className - Additional CSS class name
7786
- * @param props.ariaLabel - Accessible name for the chart group
7787
- * @param props.height - Height of the chart container. Falls back to style.height if set, otherwise defaults to "100%".
7788
- * @param props.style - Custom styling
7789
- * @param props.renderStepLabel - Custom render function for step labels
7790
- * @param props.renderStepRate - Custom render function for step rates
7791
- * @param props.renderMainMetric - Custom render function for the entire main metric section
7792
- * @param props.renderTooltip - Custom render function for tooltip content
7793
- * @param props.tooltipStyle - Inline styles merged over the tooltip box defaults
7805
+ * @param props - Component props
7806
+ * @param props.chartId - Optional unique identifier for the chart
7807
+ * @param props.mainRate - Main conversion rate to highlight
7808
+ * @param props.changeIndicator - Change indicator (e.g., +2%, -1.5%)
7809
+ * @param props.steps - Array of funnel steps
7810
+ * @param props.loading - Whether the chart is in loading state
7811
+ * @param props.animation - Whether to show chart animation on initial render or not
7812
+ * @param props.className - Additional CSS class name
7813
+ * @param props.ariaLabel - Accessible name for the chart group
7814
+ * @param props.height - Height of the chart container. Falls back to style.height if set, otherwise defaults to "100%".
7815
+ * @param props.style - Custom styling
7816
+ * @param props.renderStepLabel - Custom render function for step labels
7817
+ * @param props.renderStepRate - Custom render function for step rates
7818
+ * @param props.renderMainMetric - Custom render function for the entire main metric section
7819
+ * @param props.renderTooltip - Custom render function for tooltip content
7820
+ * @param props.tooltipStyle - Inline styles merged over the tooltip box defaults
7821
+ * @param props.getTooltipContent - What each step's tooltip shows, which screen readers also read
7794
7822
  * @return JSX element representing the conversion funnel chart
7795
7823
  */
7796
- const ConversionFunnelChartInternal = ({ mainRate, changeIndicator, steps, loading = false, animation, className, ariaLabel, chartId: providedChartId, height, style, renderStepLabel, renderStepRate, renderMainMetric, renderTooltip, tooltipStyle }) => {
7824
+ const ConversionFunnelChartInternal = ({ mainRate, changeIndicator, steps, loading = false, animation, className, ariaLabel, chartId: providedChartId, height, style, renderStepLabel, renderStepRate, renderMainMetric, renderTooltip, tooltipStyle, getTooltipContent = getDefaultTooltipContent }) => {
7797
7825
  const chartId = useChartId(providedChartId);
7798
7826
  const { getElementStyles, isColorPaletteResolved } = useGlobalChartsContext();
7799
7827
  const chartRef = (0, react.useRef)(null);
7800
- const selectedBarRef = (0, react.useRef)(null);
7828
+ const isPointerFocusRef = (0, react.useRef)(false);
7801
7829
  const [scopeNode, setScopeNode] = (0, react.useState)(null);
7830
+ const tooltipId = (0, react.useId)();
7802
7831
  const { tooltipData, tooltipLeft, tooltipTop, tooltipOpen, showTooltip, hideTooltip } = (0, _visx_tooltip.useTooltip)();
7803
- const { handleBarClick, handleBarKeyDown, clearSelection, getStepState } = useFunnelSelection(hideTooltip);
7832
+ const { selectedStepId, selectStep, clearSelection, getStepState } = useFunnelSelection(hideTooltip);
7833
+ const stepIds = (0, react.useMemo)(() => steps?.map((step) => step.id) ?? [], [steps]);
7834
+ const { getTabIndex, setStepElement, handleStepFocus, handleNavigationKey } = useRovingStepFocus(stepIds, selectedStepId);
7804
7835
  const standaloneScopeClass = useStandaloneScopeClass();
7805
7836
  const [measureChartRef, , chartHeight] = useElementSize();
7806
7837
  const gap = chartHeight > 0 && chartHeight < SHORT_CHART_HEIGHT ? "sm" : "xl";
@@ -7809,94 +7840,71 @@ const ConversionFunnelChartInternal = ({ mainRate, changeIndicator, steps, loadi
7809
7840
  setScopeNode(node);
7810
7841
  measureChartRef(node);
7811
7842
  }, [measureChartRef]);
7812
- const clearSelectionAndRef = (0, react.useCallback)(() => {
7813
- clearSelection();
7814
- selectedBarRef.current = null;
7815
- hideTooltip();
7816
- }, [clearSelection, hideTooltip]);
7817
- const showTooltipAt = (0, react.useCallback)((step, x, y) => {
7818
- showTooltip({
7843
+ const selectStepAt = (0, react.useCallback)((step, x, y) => {
7844
+ selectStep(step.id);
7845
+ const bounds = chartRef.current?.getBoundingClientRect();
7846
+ if (bounds) showTooltip({
7819
7847
  tooltipData: step,
7820
- tooltipLeft: x,
7821
- tooltipTop: y - 10
7848
+ tooltipLeft: x - bounds.left,
7849
+ tooltipTop: y - bounds.top - 10
7822
7850
  });
7823
- }, [showTooltip]);
7824
- const getMouseTooltipCoords = (0, react.useCallback)((event) => {
7825
- const bounds = chartRef.current?.getBoundingClientRect();
7826
- if (!bounds) return null;
7827
- return {
7828
- x: event.clientX - bounds.left,
7829
- y: event.clientY - bounds.top
7830
- };
7831
- }, []);
7832
- const getKeyboardTooltipCoords = (0, react.useCallback)((event) => {
7833
- const bounds = chartRef.current?.getBoundingClientRect();
7834
- if (!bounds) return null;
7835
- const rect = event.currentTarget.getBoundingClientRect();
7836
- return {
7837
- x: rect.left + rect.width / 2 - bounds.left,
7838
- y: rect.top - bounds.top
7839
- };
7840
- }, []);
7841
- const handleStepInteraction = (0, react.useCallback)((step, event, interactionType) => {
7842
- selectedBarRef.current = event.currentTarget;
7843
- const { isClicked } = getStepState(step.id);
7844
- if (isClicked) {
7845
- if (interactionType === "click") handleBarClick(step.id);
7846
- else handleBarKeyDown(step.id, event);
7847
- return;
7848
- }
7849
- if (interactionType === "click") {
7850
- handleBarClick(step.id);
7851
- const coords = getMouseTooltipCoords(event);
7852
- if (coords) showTooltipAt(step, coords.x, coords.y);
7853
- } else {
7854
- handleBarKeyDown(step.id, event);
7855
- const coords = getKeyboardTooltipCoords(event);
7856
- if (coords) showTooltipAt(step, coords.x, coords.y);
7857
- }
7858
- }, [
7859
- getStepState,
7860
- handleBarClick,
7861
- handleBarKeyDown,
7862
- showTooltipAt,
7863
- getMouseTooltipCoords,
7864
- getKeyboardTooltipCoords
7865
- ]);
7851
+ }, [selectStep, showTooltip]);
7852
+ const selectStepAtElement = (0, react.useCallback)((step, element) => {
7853
+ const rect = element.getBoundingClientRect();
7854
+ selectStepAt(step, rect.left + rect.width / 2, rect.top);
7855
+ }, [selectStepAt]);
7866
7856
  const stepHandlers = (0, react.useMemo)(() => {
7867
7857
  const handlers = /* @__PURE__ */ new Map();
7868
7858
  steps.forEach((step) => {
7859
+ const onPointerDown = () => {
7860
+ isPointerFocusRef.current = true;
7861
+ };
7869
7862
  const onClick = (event) => {
7870
- event.stopPropagation();
7871
- handleStepInteraction(step, event, "click");
7863
+ isPointerFocusRef.current = false;
7864
+ selectStepAt(step, event.clientX, event.clientY);
7865
+ };
7866
+ const onFocus = (event) => {
7867
+ handleStepFocus(step.id);
7868
+ if (isPointerFocusRef.current) isPointerFocusRef.current = false;
7869
+ else if (step.id !== selectedStepId) selectStepAtElement(step, event.currentTarget);
7872
7870
  };
7873
7871
  const onKeyDown = (event) => {
7874
- if (event.key === "Enter" || event.key === " ") handleStepInteraction(step, event, "keyboard");
7875
- else {
7876
- selectedBarRef.current = event.currentTarget;
7877
- handleBarKeyDown(step.id, event);
7872
+ isPointerFocusRef.current = false;
7873
+ if (handleNavigationKey(step.id, event)) return;
7874
+ if (event.key === "Enter" || event.key === " ") {
7875
+ event.preventDefault();
7876
+ selectStepAtElement(step, event.currentTarget);
7877
+ } else if (event.key === "Escape" && selectedStepId !== null) {
7878
+ event.preventDefault();
7879
+ clearSelection();
7878
7880
  }
7879
7881
  };
7882
+ const ref = (element) => setStepElement(step.id, element);
7880
7883
  handlers.set(step.id, {
7884
+ onPointerDown,
7881
7885
  onClick,
7882
- onKeyDown
7886
+ onKeyDown,
7887
+ onFocus,
7888
+ ref
7883
7889
  });
7884
7890
  });
7885
7891
  return handlers;
7886
7892
  }, [
7887
7893
  steps,
7888
- handleStepInteraction,
7889
- handleBarKeyDown
7894
+ selectedStepId,
7895
+ selectStepAt,
7896
+ selectStepAtElement,
7897
+ clearSelection,
7898
+ handleNavigationKey,
7899
+ handleStepFocus,
7900
+ setStepElement
7890
7901
  ]);
7891
- (0, react.useEffect)(() => {
7892
- const handleDocumentClick = (event) => {
7893
- if (selectedBarRef.current && !selectedBarRef.current.contains(event.target)) clearSelectionAndRef();
7894
- };
7895
- document.addEventListener("mousedown", handleDocumentClick);
7896
- return () => {
7897
- document.removeEventListener("mousedown", handleDocumentClick);
7898
- };
7899
- }, [clearSelectionAndRef]);
7902
+ const handleStepsBlur = (0, react.useCallback)((event) => {
7903
+ if (!event.currentTarget.contains(event.relatedTarget) && document.hasFocus()) {
7904
+ isPointerFocusRef.current = false;
7905
+ clearSelection();
7906
+ }
7907
+ }, [clearSelection]);
7900
7908
  const resolvedHeight = height ?? style?.height ?? "100%";
7901
7909
  const { color: barColor } = getElementStyles ? getElementStyles({ index: 0 }) : { color: "#000000" };
7902
7910
  const isPositiveChange = changeIndicator?.startsWith("+");
@@ -7908,18 +7916,41 @@ const ConversionFunnelChartInternal = ({ mainRate, changeIndicator, steps, loadi
7908
7916
  className: (0, clsx.default)(conversion_funnel_chart_module_default["change-indicator"], conversion_funnel_chart_module_default[isPositiveChange ? "change-indicator--positive" : "change-indicator--negative"]),
7909
7917
  children: changeIndicator
7910
7918
  })] });
7911
- const renderDefaultTooltip = (step) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_wordpress_ui.Stack, {
7912
- direction: "column",
7913
- align: "flex-start",
7914
- gap: "xs",
7915
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
7916
- className: conversion_funnel_chart_module_default["tooltip-title"],
7917
- children: step.label
7918
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7919
- className: conversion_funnel_chart_module_default["tooltip-content"],
7920
- children: [formatPercentage(step.rate), ` • ${step.count ?? "no"} items`]
7921
- })]
7922
- });
7919
+ const renderDefaultTooltip = (step, content) => {
7920
+ const ids = getDefaultTooltipIds(tooltipId, content);
7921
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_wordpress_ui.Stack, {
7922
+ direction: "column",
7923
+ gap: "xs",
7924
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_wordpress_ui.Stack, {
7925
+ direction: "row",
7926
+ justify: "space-between",
7927
+ align: "baseline",
7928
+ gap: "sm",
7929
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
7930
+ className: conversion_funnel_chart_module_default["tooltip-title"],
7931
+ children: step.label
7932
+ }), content.value && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
7933
+ id: ids.value,
7934
+ className: conversion_funnel_chart_module_default["tooltip-value"],
7935
+ children: content.value
7936
+ })]
7937
+ }), content.rows?.map((row, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_wordpress_ui.Stack, {
7938
+ direction: "row",
7939
+ justify: "space-between",
7940
+ align: "baseline",
7941
+ gap: "sm",
7942
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
7943
+ id: ids.rows[index].label,
7944
+ className: conversion_funnel_chart_module_default["tooltip-label"],
7945
+ children: row.label
7946
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
7947
+ id: ids.rows[index].value,
7948
+ className: conversion_funnel_chart_module_default["tooltip-value"],
7949
+ children: row.value
7950
+ })]
7951
+ }, row.label))]
7952
+ });
7953
+ };
7923
7954
  const isDataValid = Boolean(steps && steps.length > 0);
7924
7955
  const chartMetadata = (0, react.useMemo)(() => ({
7925
7956
  mainRate,
@@ -7954,6 +7985,26 @@ const ConversionFunnelChartInternal = ({ mainRate, changeIndicator, steps, loadi
7954
7985
  })
7955
7986
  });
7956
7987
  const maxRate = Math.max(...steps.map((step) => step.rate));
7988
+ const tooltipStep = tooltipOpen ? tooltipData : void 0;
7989
+ let tooltipContent = null;
7990
+ let tooltipDescriptionIds = "";
7991
+ if (tooltipStep) {
7992
+ const index = steps.findIndex((s) => s.id === tooltipStep.id);
7993
+ const content = getTooltipContent(tooltipStep, index);
7994
+ if (renderTooltip) {
7995
+ tooltipContent = renderTooltip({
7996
+ step: tooltipStep,
7997
+ index,
7998
+ content,
7999
+ top: tooltipTop,
8000
+ left: tooltipLeft
8001
+ });
8002
+ tooltipDescriptionIds = tooltipId;
8003
+ } else {
8004
+ tooltipContent = renderDefaultTooltip(tooltipStep, content);
8005
+ tooltipDescriptionIds = getDefaultTooltipDescriptionIds(tooltipId, content);
8006
+ }
8007
+ }
7957
8008
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_wordpress_ui.Stack, {
7958
8009
  direction: "column",
7959
8010
  gap,
@@ -7982,10 +8033,16 @@ const ConversionFunnelChartInternal = ({ mainRate, changeIndicator, steps, loadi
7982
8033
  direction: "row",
7983
8034
  align: "flex-end",
7984
8035
  gap: "lg",
8036
+ role: "listbox",
8037
+ "aria-label": (0, _wordpress_i18n.__)("Funnel steps", "jetpack-charts"),
8038
+ "aria-orientation": "horizontal",
8039
+ onBlur: handleStepsBlur,
7985
8040
  className: conversion_funnel_chart_module_default["funnel-container"],
7986
8041
  children: steps.map((step, index) => {
7987
8042
  const barHeight = step.rate / maxRate * 100;
7988
- const { isBlurred } = getStepState(step.id);
8043
+ const { isSelected, isBlurred } = getStepState(step.id);
8044
+ const handlers = stepHandlers.get(step.id);
8045
+ const isDescribedByTooltip = Boolean(tooltipContent && tooltipDescriptionIds) && tooltipStep?.id === step.id;
7989
8046
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_wordpress_ui.Stack, {
7990
8047
  direction: "column",
7991
8048
  className: (0, clsx.default)(conversion_funnel_chart_module_default["funnel-step"], isColorPaletteResolved && conversion_funnel_chart_module_default["funnel-step--animated"], isBlurred && conversion_funnel_chart_module_default["funnel-step--blurred"]),
@@ -7993,6 +8050,8 @@ const ConversionFunnelChartInternal = ({ mainRate, changeIndicator, steps, loadi
7993
8050
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_wordpress_ui.Stack, {
7994
8051
  direction: "column",
7995
8052
  gap: "xs",
8053
+ className: conversion_funnel_chart_module_default["step-text"],
8054
+ "aria-hidden": "true",
7996
8055
  children: [renderStepLabel ? renderStepLabel({
7997
8056
  step,
7998
8057
  index,
@@ -8012,11 +8071,16 @@ const ConversionFunnelChartInternal = ({ mainRate, changeIndicator, steps, loadi
8012
8071
  direction: "column",
8013
8072
  justify: "flex-end",
8014
8073
  className: conversion_funnel_chart_module_default["bar-container"],
8015
- onClick: stepHandlers.get(step.id)?.onClick,
8016
- onKeyDown: stepHandlers.get(step.id)?.onKeyDown,
8017
- role: "button",
8018
- tabIndex: isBlurred ? -1 : 0,
8019
- "aria-label": step.label,
8074
+ ref: handlers?.ref,
8075
+ onPointerDown: handlers?.onPointerDown,
8076
+ onClick: handlers?.onClick,
8077
+ onKeyDown: handlers?.onKeyDown,
8078
+ onFocus: handlers?.onFocus,
8079
+ role: "option",
8080
+ tabIndex: getTabIndex(step.id),
8081
+ "aria-label": (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n.__)("%1$s, %2$s", "jetpack-charts"), step.label, formatPercentage(step.rate)),
8082
+ "aria-selected": isSelected,
8083
+ "aria-describedby": isDescribedByTooltip ? tooltipDescriptionIds : void 0,
8020
8084
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8021
8085
  className: (0, clsx.default)(conversion_funnel_chart_module_default["funnel-bar"], { [conversion_funnel_chart_module_default["funnel-bar--animated"]]: animation && !loading && !prefersReducedMotion }),
8022
8086
  style: {
@@ -8028,25 +8092,17 @@ const ConversionFunnelChartInternal = ({ mainRate, changeIndicator, steps, loadi
8028
8092
  }, step.id);
8029
8093
  })
8030
8094
  })]
8031
- }), tooltipOpen && tooltipData && (() => {
8032
- const tooltipContent = renderTooltip ? renderTooltip({
8033
- step: tooltipData,
8034
- index: steps.findIndex((s) => s.id === tooltipData.id),
8035
- top: tooltipTop,
8036
- left: tooltipLeft
8037
- }) : renderDefaultTooltip(tooltipData);
8038
- if (!tooltipContent) return null;
8039
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BoundedTooltip, {
8040
- top: tooltipTop,
8041
- left: tooltipLeft,
8042
- className: standaloneScopeClass,
8043
- style: tooltipStyle,
8044
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8045
- role: "tooltip",
8046
- children: tooltipContent
8047
- })
8048
- });
8049
- })()]
8095
+ }), tooltipContent && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BoundedTooltip, {
8096
+ top: tooltipTop,
8097
+ left: tooltipLeft,
8098
+ className: standaloneScopeClass,
8099
+ style: tooltipStyle,
8100
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8101
+ id: tooltipId,
8102
+ "aria-hidden": "true",
8103
+ children: tooltipContent
8104
+ })
8105
+ })]
8050
8106
  });
8051
8107
  };
8052
8108
  /**
@@ -8060,8 +8116,7 @@ const ConversionFunnelChartWithProvider = (props) => {
8060
8116
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GlobalChartsProvider, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ConversionFunnelChartInternal, { ...props }) });
8061
8117
  };
8062
8118
  ConversionFunnelChartWithProvider.displayName = "ConversionFunnelChart";
8063
- //#endregion
8064
- //#region src/utils/sanitize-html.ts
8119
+ // src/utils/sanitize-html.ts
8065
8120
  /**
8066
8121
  * External dependencies
8067
8122
  */
@@ -8109,11 +8164,9 @@ function sanitizeHtml(html) {
8109
8164
  ]
8110
8165
  });
8111
8166
  }
8112
- //#endregion
8113
- //#region src/charts/geo-chart/geo-chart.module.scss
8167
+ // src/charts/geo-chart/geo-chart.module.scss
8114
8168
  var geo_chart_module_default = { "container": "a8ccharts-8hS2IW-container" };
8115
- //#endregion
8116
- //#region src/charts/geo-chart/private/use-tooltip-position.ts
8169
+ // src/charts/geo-chart/private/use-tooltip-position.ts
8117
8170
  const TOOLTIP_CLASS = "google-visualization-tooltip";
8118
8171
  const isTooltip = (node) => node instanceof HTMLElement && node.classList.contains(TOOLTIP_CLASS);
8119
8172
  /**
@@ -8197,8 +8250,7 @@ function useTooltipPosition(containerRef) {
8197
8250
  };
8198
8251
  }, [containerRef]);
8199
8252
  }
8200
- //#endregion
8201
- //#region src/charts/geo-chart/geo-chart.tsx
8253
+ // src/charts/geo-chart/geo-chart.tsx
8202
8254
  /**
8203
8255
  * External dependencies
8204
8256
  */
@@ -8418,8 +8470,7 @@ const GeoChartWithProvider = (props) => {
8418
8470
  };
8419
8471
  GeoChartWithProvider.displayName = "GeoChart";
8420
8472
  const GeoChartResponsive = withResponsive(GeoChartWithProvider);
8421
- //#endregion
8422
- //#region src/types.ts
8473
+ // src/types.ts
8423
8474
  let GoogleDataTableColumnRoleType = /* @__PURE__ */ function(GoogleDataTableColumnRoleType) {
8424
8475
  GoogleDataTableColumnRoleType["annotation"] = "annotation";
8425
8476
  GoogleDataTableColumnRoleType["annotationText"] = "annotationText";
@@ -8499,8 +8550,7 @@ const pickLabelTextColor = (fill, roles, defaultRole) => {
8499
8550
  if (!isValidHexColor(fillHex)) return defaultRole;
8500
8551
  return pickLabelTextColorForFill(hexToRgb(fillHex), roles, defaultRole);
8501
8552
  };
8502
- //#endregion
8503
- //#region src/charts/heatmap-chart/heatmap-chart.module.scss
8553
+ // src/charts/heatmap-chart/heatmap-chart.module.scss
8504
8554
  var heatmap_chart_module_default = {
8505
8555
  "heatmap-chart": "a8ccharts-O3YMOW-heatmap-chart",
8506
8556
  "heatmap-chart__cell": "a8ccharts-O3YMOW-heatmap-chart__cell",
@@ -8531,8 +8581,7 @@ var heatmap_chart_module_default = {
8531
8581
  "heatmap-chart__row-label": "a8ccharts-O3YMOW-heatmap-chart__row-label",
8532
8582
  "heatmap-chart--height-capped": "a8ccharts-O3YMOW-heatmap-chart--height-capped"
8533
8583
  };
8534
- //#endregion
8535
- //#region src/charts/heatmap-chart/private/use-heatmap-colors.ts
8584
+ // src/charts/heatmap-chart/private/use-heatmap-colors.ts
8536
8585
  const isPresent = (value) => value !== null && value !== void 0 && !isNaN(value);
8537
8586
  /**
8538
8587
  * Get the min and max values from heatmap data, ignoring null/NaN and the zeros
@@ -8611,12 +8660,10 @@ const getHeatmapScale = (primary, background, emptyCell) => {
8611
8660
  high
8612
8661
  };
8613
8662
  };
8614
- //#endregion
8615
- //#region src/charts/heatmap-chart/private/heatmap-context.ts
8663
+ // src/charts/heatmap-chart/private/heatmap-context.ts
8616
8664
  /** Shared by the chart and legend without importing back from `heatmap-chart.tsx`. */
8617
8665
  const HeatmapContext = (0, react.createContext)(null);
8618
- //#endregion
8619
- //#region src/charts/heatmap-chart/private/heatmap-legend.tsx
8666
+ // src/charts/heatmap-chart/private/heatmap-legend.tsx
8620
8667
  const HeatmapLegend = ({ steps = 5, variant = "swatches", lessLabel, moreLabel }) => {
8621
8668
  const context = (0, react.useContext)(HeatmapContext);
8622
8669
  const { legend } = useGlobalChartsTheme();
@@ -8660,8 +8707,7 @@ const HeatmapLegend = ({ steps = 5, variant = "swatches", lessLabel, moreLabel }
8660
8707
  ]
8661
8708
  });
8662
8709
  };
8663
- //#endregion
8664
- //#region src/charts/heatmap-chart/private/column-groups.ts
8710
+ // src/charts/heatmap-chart/private/column-groups.ts
8665
8711
  const isSpan = (span) => Number.isInteger(span) && span > 0;
8666
8712
  /**
8667
8713
  * Validates column groups and lays them over the columns.
@@ -8767,8 +8813,7 @@ const wrapColumnGroups = (layout, bands) => {
8767
8813
  slotSpans
8768
8814
  };
8769
8815
  };
8770
- //#endregion
8771
- //#region src/charts/heatmap-chart/private/fit-compact-cells.ts
8816
+ // src/charts/heatmap-chart/private/fit-compact-cells.ts
8772
8817
  /**
8773
8818
  * Largest whole-pixel square cell, and the band count giving it, for a compact grid in a box.
8774
8819
  *
@@ -8806,8 +8851,7 @@ const fitCompactCells = (input) => {
8806
8851
  cellSize: minCellSize
8807
8852
  };
8808
8853
  };
8809
- //#endregion
8810
- //#region src/charts/heatmap-chart/private/keyboard-navigation.ts
8854
+ // src/charts/heatmap-chart/private/keyboard-navigation.ts
8811
8855
  const ARROW_KEYS = [
8812
8856
  "ArrowLeft",
8813
8857
  "ArrowRight",
@@ -8937,8 +8981,7 @@ const stepCalendarCell = (grid, blocks, from, key) => {
8937
8981
  const before = page.slice(0, at === -1 ? page.length : at).reverse();
8938
8982
  return firstSelectable(grid, after) ?? firstSelectable(grid, before);
8939
8983
  };
8940
- //#endregion
8941
- //#region src/charts/heatmap-chart/heatmap-chart.tsx
8984
+ // src/charts/heatmap-chart/heatmap-chart.tsx
8942
8985
  const CELL_VALUE_MODIFIER = {
8943
8986
  label: void 0,
8944
8987
  "label-inverse": heatmap_chart_module_default["heatmap-chart__cell-value--inverse"],
@@ -9393,8 +9436,7 @@ const HeatmapChartResponsiveInner = (props) => /* @__PURE__ */ (0, react_jsx_run
9393
9436
  });
9394
9437
  HeatmapChartResponsiveInner.displayName = "HeatmapChart";
9395
9438
  const HeatmapChartResponsive = attachSubComponents(withResponsive(HeatmapChartResponsiveInner), { Legend: HeatmapLegend });
9396
- //#endregion
9397
- //#region src/charts/heatmap-chart/private/civil-day.ts
9439
+ // src/charts/heatmap-chart/private/civil-day.ts
9398
9440
  const DAY_MS = 864e5;
9399
9441
  const KEY_OPTIONS = {
9400
9442
  calendar: "gregory",
@@ -9543,8 +9585,7 @@ const startOfCivilWeek = (date, weekStartsOn) => {
9543
9585
  * @return Columns needed to cover the span, inclusive.
9544
9586
  */
9545
9587
  const civilWeekSpan = (from, to, weekStartsOn) => Math.floor((startOfCivilWeek(to, weekStartsOn).getTime() - startOfCivilWeek(from, weekStartsOn).getTime()) / (7 * DAY_MS)) + 1;
9546
- //#endregion
9547
- //#region src/charts/heatmap-chart/build-calendar-data.ts
9588
+ // src/charts/heatmap-chart/build-calendar-data.ts
9548
9589
  /** Rows that get a weekday label (Mon, Wed, Fri with a Monday week start). */
9549
9590
  const LABELLED_ROWS = [
9550
9591
  0,
@@ -9646,8 +9687,7 @@ const buildCalendarHeatmapData = (series, options = {}) => {
9646
9687
  rowLabels
9647
9688
  };
9648
9689
  };
9649
- //#endregion
9650
- //#region src/charts/heatmap-chart/build-month-calendar-data.ts
9690
+ // src/charts/heatmap-chart/build-month-calendar-data.ts
9651
9691
  /** Week rows per month, fixed so every month block is the same height. */
9652
9692
  const MONTH_ROWS = 6;
9653
9693
  const DAYS_PER_WEEK = 7;
@@ -9729,8 +9769,7 @@ const buildMonthCalendarHeatmapData = (valueByDay, range, options = {}) => {
9729
9769
  columnGroups
9730
9770
  };
9731
9771
  };
9732
- //#endregion
9733
- //#region src/charts/heatmap-chart/use-calendar-heatmap-data.ts
9772
+ // src/charts/heatmap-chart/use-calendar-heatmap-data.ts
9734
9773
  /**
9735
9774
  * `buildCalendarHeatmapData` with the locale and zone taken from
9736
9775
  * `GlobalChartsProvider` where the caller names neither.
@@ -9765,8 +9804,7 @@ const useCalendarHeatmapData = (series, options = {}) => {
9765
9804
  gridEnd
9766
9805
  ]);
9767
9806
  };
9768
- //#endregion
9769
- //#region src/charts/heatmap-chart/use-month-calendar-heatmap-data.ts
9807
+ // src/charts/heatmap-chart/use-month-calendar-heatmap-data.ts
9770
9808
  /**
9771
9809
  * `buildMonthCalendarHeatmapData` with the locale taken from `GlobalChartsProvider`
9772
9810
  * where the caller names none.
@@ -9795,8 +9833,7 @@ const useMonthCalendarHeatmapData = (valueByDay, range, options = {}) => {
9795
9833
  weekStartsOn
9796
9834
  ]);
9797
9835
  };
9798
- //#endregion
9799
- //#region ../../../node_modules/.pnpm/is-plain-object@5.1.0/node_modules/is-plain-object/dist/is-plain-object.mjs
9836
+ // ../../../node_modules/.pnpm/is-plain-object@5.1.0/node_modules/is-plain-object/dist/is-plain-object.mjs
9800
9837
  /*!
9801
9838
  * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
9802
9839
  *
@@ -9816,353 +9853,9 @@ function isPlainObject(o) {
9816
9853
  if (prot.hasOwnProperty("isPrototypeOf") === false) return false;
9817
9854
  return true;
9818
9855
  }
9819
- //#endregion
9820
- //#region ../../../node_modules/.pnpm/lower-case@2.0.2/node_modules/lower-case/dist/index.js
9821
- var require_dist$14 = /* @__PURE__ */ __commonJSMin(((exports) => {
9822
- Object.defineProperty(exports, "__esModule", { value: true });
9823
- exports.lowerCase = exports.localeLowerCase = void 0;
9824
- /**
9825
- * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
9826
- */
9827
- var SUPPORTED_LOCALE = {
9828
- tr: {
9829
- regexp: /\u0130|\u0049|\u0049\u0307/g,
9830
- map: {
9831
- İ: "i",
9832
- I: "ı",
9833
- İ: "i"
9834
- }
9835
- },
9836
- az: {
9837
- regexp: /\u0130/g,
9838
- map: {
9839
- İ: "i",
9840
- I: "ı",
9841
- İ: "i"
9842
- }
9843
- },
9844
- lt: {
9845
- regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g,
9846
- map: {
9847
- I: "i̇",
9848
- J: "j̇",
9849
- Į: "į̇",
9850
- Ì: "i̇̀",
9851
- Í: "i̇́",
9852
- Ĩ: "i̇̃"
9853
- }
9854
- }
9855
- };
9856
- /**
9857
- * Localized lower case.
9858
- */
9859
- function localeLowerCase(str, locale) {
9860
- var lang = SUPPORTED_LOCALE[locale.toLowerCase()];
9861
- if (lang) return lowerCase(str.replace(lang.regexp, function(m) {
9862
- return lang.map[m];
9863
- }));
9864
- return lowerCase(str);
9865
- }
9866
- exports.localeLowerCase = localeLowerCase;
9867
- /**
9868
- * Lower case as a function.
9869
- */
9870
- function lowerCase(str) {
9871
- return str.toLowerCase();
9872
- }
9873
- exports.lowerCase = lowerCase;
9874
- }));
9875
- //#endregion
9876
- //#region ../../../node_modules/.pnpm/no-case@3.0.4/node_modules/no-case/dist/index.js
9877
- var require_dist$13 = /* @__PURE__ */ __commonJSMin(((exports) => {
9878
- Object.defineProperty(exports, "__esModule", { value: true });
9879
- exports.noCase = void 0;
9880
- var lower_case_1 = require_dist$14();
9881
- var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
9882
- var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
9883
- /**
9884
- * Normalize the string into something other libraries can manipulate easier.
9885
- */
9886
- function noCase(input, options) {
9887
- if (options === void 0) options = {};
9888
- var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lower_case_1.lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d;
9889
- var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
9890
- var start = 0;
9891
- var end = result.length;
9892
- while (result.charAt(start) === "\0") start++;
9893
- while (result.charAt(end - 1) === "\0") end--;
9894
- return result.slice(start, end).split("\0").map(transform).join(delimiter);
9895
- }
9896
- exports.noCase = noCase;
9897
- /**
9898
- * Replace `re` in the input string with the replacement value.
9899
- */
9900
- function replace(input, re, value) {
9901
- if (re instanceof RegExp) return input.replace(re, value);
9902
- return re.reduce(function(input, re) {
9903
- return input.replace(re, value);
9904
- }, input);
9905
- }
9906
- }));
9907
- //#endregion
9908
- //#region ../../../node_modules/.pnpm/pascal-case@3.1.2/node_modules/pascal-case/dist/index.js
9909
- var require_dist$12 = /* @__PURE__ */ __commonJSMin(((exports) => {
9910
- Object.defineProperty(exports, "__esModule", { value: true });
9911
- exports.pascalCase = exports.pascalCaseTransformMerge = exports.pascalCaseTransform = void 0;
9912
- var tslib_1 = require("tslib");
9913
- var no_case_1 = require_dist$13();
9914
- function pascalCaseTransform(input, index) {
9915
- var firstChar = input.charAt(0);
9916
- var lowerChars = input.substr(1).toLowerCase();
9917
- if (index > 0 && firstChar >= "0" && firstChar <= "9") return "_" + firstChar + lowerChars;
9918
- return "" + firstChar.toUpperCase() + lowerChars;
9919
- }
9920
- exports.pascalCaseTransform = pascalCaseTransform;
9921
- function pascalCaseTransformMerge(input) {
9922
- return input.charAt(0).toUpperCase() + input.slice(1).toLowerCase();
9923
- }
9924
- exports.pascalCaseTransformMerge = pascalCaseTransformMerge;
9925
- function pascalCase(input, options) {
9926
- if (options === void 0) options = {};
9927
- return no_case_1.noCase(input, tslib_1.__assign({
9928
- delimiter: "",
9929
- transform: pascalCaseTransform
9930
- }, options));
9931
- }
9932
- exports.pascalCase = pascalCase;
9933
- }));
9934
- //#endregion
9935
- //#region ../../../node_modules/.pnpm/camel-case@4.1.2/node_modules/camel-case/dist/index.js
9936
- var require_dist$11 = /* @__PURE__ */ __commonJSMin(((exports) => {
9937
- Object.defineProperty(exports, "__esModule", { value: true });
9938
- exports.camelCase = exports.camelCaseTransformMerge = exports.camelCaseTransform = void 0;
9939
- var tslib_1 = require("tslib");
9940
- var pascal_case_1 = require_dist$12();
9941
- function camelCaseTransform(input, index) {
9942
- if (index === 0) return input.toLowerCase();
9943
- return pascal_case_1.pascalCaseTransform(input, index);
9944
- }
9945
- exports.camelCaseTransform = camelCaseTransform;
9946
- function camelCaseTransformMerge(input, index) {
9947
- if (index === 0) return input.toLowerCase();
9948
- return pascal_case_1.pascalCaseTransformMerge(input);
9949
- }
9950
- exports.camelCaseTransformMerge = camelCaseTransformMerge;
9951
- function camelCase(input, options) {
9952
- if (options === void 0) options = {};
9953
- return pascal_case_1.pascalCase(input, tslib_1.__assign({ transform: camelCaseTransform }, options));
9954
- }
9955
- exports.camelCase = camelCase;
9956
- }));
9957
- //#endregion
9958
- //#region ../../../node_modules/.pnpm/upper-case-first@2.0.2/node_modules/upper-case-first/dist/index.js
9959
- var require_dist$10 = /* @__PURE__ */ __commonJSMin(((exports) => {
9960
- Object.defineProperty(exports, "__esModule", { value: true });
9961
- exports.upperCaseFirst = void 0;
9962
- /**
9963
- * Upper case the first character of an input string.
9964
- */
9965
- function upperCaseFirst(input) {
9966
- return input.charAt(0).toUpperCase() + input.substr(1);
9967
- }
9968
- exports.upperCaseFirst = upperCaseFirst;
9969
- }));
9970
- //#endregion
9971
- //#region ../../../node_modules/.pnpm/capital-case@1.0.4/node_modules/capital-case/dist/index.js
9972
- var require_dist$9 = /* @__PURE__ */ __commonJSMin(((exports) => {
9973
- Object.defineProperty(exports, "__esModule", { value: true });
9974
- exports.capitalCase = exports.capitalCaseTransform = void 0;
9975
- var tslib_1 = require("tslib");
9976
- var no_case_1 = require_dist$13();
9977
- var upper_case_first_1 = require_dist$10();
9978
- function capitalCaseTransform(input) {
9979
- return upper_case_first_1.upperCaseFirst(input.toLowerCase());
9980
- }
9981
- exports.capitalCaseTransform = capitalCaseTransform;
9982
- function capitalCase(input, options) {
9983
- if (options === void 0) options = {};
9984
- return no_case_1.noCase(input, tslib_1.__assign({
9985
- delimiter: " ",
9986
- transform: capitalCaseTransform
9987
- }, options));
9988
- }
9989
- exports.capitalCase = capitalCase;
9990
- }));
9991
- //#endregion
9992
- //#region ../../../node_modules/.pnpm/upper-case@2.0.2/node_modules/upper-case/dist/index.js
9993
- var require_dist$8 = /* @__PURE__ */ __commonJSMin(((exports) => {
9994
- Object.defineProperty(exports, "__esModule", { value: true });
9995
- exports.upperCase = exports.localeUpperCase = void 0;
9996
- /**
9997
- * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
9998
- */
9999
- var SUPPORTED_LOCALE = {
10000
- tr: {
10001
- regexp: /[\u0069]/g,
10002
- map: { i: "İ" }
10003
- },
10004
- az: {
10005
- regexp: /[\u0069]/g,
10006
- map: { i: "İ" }
10007
- },
10008
- lt: {
10009
- regexp: /[\u0069\u006A\u012F]\u0307|\u0069\u0307[\u0300\u0301\u0303]/g,
10010
- map: {
10011
- i̇: "I",
10012
- j̇: "J",
10013
- į̇: "Į",
10014
- i̇̀: "Ì",
10015
- i̇́: "Í",
10016
- i̇̃: "Ĩ"
10017
- }
10018
- }
10019
- };
10020
- /**
10021
- * Localized upper case.
10022
- */
10023
- function localeUpperCase(str, locale) {
10024
- var lang = SUPPORTED_LOCALE[locale.toLowerCase()];
10025
- if (lang) return upperCase(str.replace(lang.regexp, function(m) {
10026
- return lang.map[m];
10027
- }));
10028
- return upperCase(str);
10029
- }
10030
- exports.localeUpperCase = localeUpperCase;
10031
- /**
10032
- * Upper case as a function.
10033
- */
10034
- function upperCase(str) {
10035
- return str.toUpperCase();
10036
- }
10037
- exports.upperCase = upperCase;
10038
- }));
10039
- //#endregion
10040
- //#region ../../../node_modules/.pnpm/constant-case@3.0.4/node_modules/constant-case/dist/index.js
10041
- var require_dist$7 = /* @__PURE__ */ __commonJSMin(((exports) => {
10042
- Object.defineProperty(exports, "__esModule", { value: true });
10043
- exports.constantCase = void 0;
10044
- var tslib_1 = require("tslib");
10045
- var no_case_1 = require_dist$13();
10046
- var upper_case_1 = require_dist$8();
10047
- function constantCase(input, options) {
10048
- if (options === void 0) options = {};
10049
- return no_case_1.noCase(input, tslib_1.__assign({
10050
- delimiter: "_",
10051
- transform: upper_case_1.upperCase
10052
- }, options));
10053
- }
10054
- exports.constantCase = constantCase;
10055
- }));
10056
- //#endregion
10057
- //#region ../../../node_modules/.pnpm/dot-case@3.0.4/node_modules/dot-case/dist/index.js
10058
- var require_dist$6 = /* @__PURE__ */ __commonJSMin(((exports) => {
10059
- Object.defineProperty(exports, "__esModule", { value: true });
10060
- exports.dotCase = void 0;
10061
- var tslib_1 = require("tslib");
10062
- var no_case_1 = require_dist$13();
10063
- function dotCase(input, options) {
10064
- if (options === void 0) options = {};
10065
- return no_case_1.noCase(input, tslib_1.__assign({ delimiter: "." }, options));
10066
- }
10067
- exports.dotCase = dotCase;
10068
- }));
10069
- //#endregion
10070
- //#region ../../../node_modules/.pnpm/header-case@2.0.4/node_modules/header-case/dist/index.js
10071
- var require_dist$5 = /* @__PURE__ */ __commonJSMin(((exports) => {
10072
- Object.defineProperty(exports, "__esModule", { value: true });
10073
- exports.headerCase = void 0;
10074
- var tslib_1 = require("tslib");
10075
- var capital_case_1 = require_dist$9();
10076
- function headerCase(input, options) {
10077
- if (options === void 0) options = {};
10078
- return capital_case_1.capitalCase(input, tslib_1.__assign({ delimiter: "-" }, options));
10079
- }
10080
- exports.headerCase = headerCase;
10081
- }));
10082
- //#endregion
10083
- //#region ../../../node_modules/.pnpm/param-case@3.0.4/node_modules/param-case/dist/index.js
10084
- var require_dist$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
10085
- Object.defineProperty(exports, "__esModule", { value: true });
10086
- exports.paramCase = void 0;
10087
- var tslib_1 = require("tslib");
10088
- var dot_case_1 = require_dist$6();
10089
- function paramCase(input, options) {
10090
- if (options === void 0) options = {};
10091
- return dot_case_1.dotCase(input, tslib_1.__assign({ delimiter: "-" }, options));
10092
- }
10093
- exports.paramCase = paramCase;
10094
- }));
10095
- //#endregion
10096
- //#region ../../../node_modules/.pnpm/path-case@3.0.4/node_modules/path-case/dist/index.js
10097
- var require_dist$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
10098
- Object.defineProperty(exports, "__esModule", { value: true });
10099
- exports.pathCase = void 0;
10100
- var tslib_1 = require("tslib");
10101
- var dot_case_1 = require_dist$6();
10102
- function pathCase(input, options) {
10103
- if (options === void 0) options = {};
10104
- return dot_case_1.dotCase(input, tslib_1.__assign({ delimiter: "/" }, options));
10105
- }
10106
- exports.pathCase = pathCase;
10107
- }));
10108
- //#endregion
10109
- //#region ../../../node_modules/.pnpm/sentence-case@3.0.4/node_modules/sentence-case/dist/index.js
10110
- var require_dist$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
10111
- Object.defineProperty(exports, "__esModule", { value: true });
10112
- exports.sentenceCase = exports.sentenceCaseTransform = void 0;
10113
- var tslib_1 = require("tslib");
10114
- var no_case_1 = require_dist$13();
10115
- var upper_case_first_1 = require_dist$10();
10116
- function sentenceCaseTransform(input, index) {
10117
- var result = input.toLowerCase();
10118
- if (index === 0) return upper_case_first_1.upperCaseFirst(result);
10119
- return result;
10120
- }
10121
- exports.sentenceCaseTransform = sentenceCaseTransform;
10122
- function sentenceCase(input, options) {
10123
- if (options === void 0) options = {};
10124
- return no_case_1.noCase(input, tslib_1.__assign({
10125
- delimiter: " ",
10126
- transform: sentenceCaseTransform
10127
- }, options));
10128
- }
10129
- exports.sentenceCase = sentenceCase;
10130
- }));
10131
- //#endregion
10132
- //#region ../../../node_modules/.pnpm/snake-case@3.0.4/node_modules/snake-case/dist/index.js
10133
- var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
10134
- Object.defineProperty(exports, "__esModule", { value: true });
10135
- exports.snakeCase = void 0;
10136
- var tslib_1 = require("tslib");
10137
- var dot_case_1 = require_dist$6();
10138
- function snakeCase(input, options) {
10139
- if (options === void 0) options = {};
10140
- return dot_case_1.dotCase(input, tslib_1.__assign({ delimiter: "_" }, options));
10141
- }
10142
- exports.snakeCase = snakeCase;
10143
- }));
10144
- //#endregion
10145
- //#region ../../../node_modules/.pnpm/change-case@4.1.2/node_modules/change-case/dist/index.js
10146
- var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
10147
- Object.defineProperty(exports, "__esModule", { value: true });
10148
- var tslib_1 = require("tslib");
10149
- tslib_1.__exportStar(require_dist$11(), exports);
10150
- tslib_1.__exportStar(require_dist$9(), exports);
10151
- tslib_1.__exportStar(require_dist$7(), exports);
10152
- tslib_1.__exportStar(require_dist$6(), exports);
10153
- tslib_1.__exportStar(require_dist$5(), exports);
10154
- tslib_1.__exportStar(require_dist$13(), exports);
10155
- tslib_1.__exportStar(require_dist$4(), exports);
10156
- tslib_1.__exportStar(require_dist$12(), exports);
10157
- tslib_1.__exportStar(require_dist$3(), exports);
10158
- tslib_1.__exportStar(require_dist$2(), exports);
10159
- tslib_1.__exportStar(require_dist$1(), exports);
10160
- }));
10161
- //#endregion
10162
- //#region ../../../node_modules/.pnpm/@wordpress+warning@3.57.0/node_modules/@wordpress/warning/build-module/utils.mjs
9856
+ // ../../../node_modules/.pnpm/@wordpress+warning@4.0.0/node_modules/@wordpress/warning/build-module/utils.mjs
10163
9857
  var logged = /* @__PURE__ */ new Set();
10164
- //#endregion
10165
- //#region ../../../node_modules/.pnpm/@wordpress+warning@3.57.0/node_modules/@wordpress/warning/build-module/index.mjs
9858
+ // ../../../node_modules/.pnpm/@wordpress+warning@4.0.0/node_modules/@wordpress/warning/build-module/index.mjs
10166
9859
  function isDev() {
10167
9860
  return globalThis.SCRIPT_DEBUG === true;
10168
9861
  }
@@ -10175,8 +9868,53 @@ function warning(message) {
10175
9868
  } catch {}
10176
9869
  logged.add(message);
10177
9870
  }
10178
- //#endregion
10179
- //#region ../../../node_modules/.pnpm/@wordpress+components@42.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_6d0393a58a031b78f608040e2ecbe6e0/node_modules/@wordpress/components/build-module/utils/hooks/use-update-effect.mjs
9871
+ // ../../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/es6/index.js
9872
+ var require_es6 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9873
+ module.exports = function equal(a, b) {
9874
+ if (a === b) return true;
9875
+ if (a && b && typeof a == "object" && typeof b == "object") {
9876
+ if (a.constructor !== b.constructor) return false;
9877
+ var length, i, keys;
9878
+ if (Array.isArray(a)) {
9879
+ length = a.length;
9880
+ if (length != b.length) return false;
9881
+ for (i = length; i-- !== 0;) if (!equal(a[i], b[i])) return false;
9882
+ return true;
9883
+ }
9884
+ if (a instanceof Map && b instanceof Map) {
9885
+ if (a.size !== b.size) return false;
9886
+ for (i of a.entries()) if (!b.has(i[0])) return false;
9887
+ for (i of a.entries()) if (!equal(i[1], b.get(i[0]))) return false;
9888
+ return true;
9889
+ }
9890
+ if (a instanceof Set && b instanceof Set) {
9891
+ if (a.size !== b.size) return false;
9892
+ for (i of a.entries()) if (!b.has(i[0])) return false;
9893
+ return true;
9894
+ }
9895
+ if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
9896
+ length = a.length;
9897
+ if (length != b.length) return false;
9898
+ for (i = length; i-- !== 0;) if (a[i] !== b[i]) return false;
9899
+ return true;
9900
+ }
9901
+ if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
9902
+ if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
9903
+ if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
9904
+ keys = Object.keys(a);
9905
+ length = keys.length;
9906
+ if (length !== Object.keys(b).length) return false;
9907
+ for (i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
9908
+ for (i = length; i-- !== 0;) {
9909
+ var key = keys[i];
9910
+ if (!equal(a[key], b[key])) return false;
9911
+ }
9912
+ return true;
9913
+ }
9914
+ return a !== a && b !== b;
9915
+ };
9916
+ }));
9917
+ // ../../../node_modules/.pnpm/@wordpress+components@43.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_401cb4bad47bd1f7b56615ff574f0485/node_modules/@wordpress/components/build-module/utils/hooks/use-update-effect.mjs
10180
9918
  function useUpdateEffect(effect, deps) {
10181
9919
  const mountedRef = (0, react.useRef)(false);
10182
9920
  (0, react.useEffect)(() => {
@@ -10188,1215 +9926,34 @@ function useUpdateEffect(effect, deps) {
10188
9926
  }, []);
10189
9927
  }
10190
9928
  var use_update_effect_default = useUpdateEffect;
10191
- //#endregion
10192
- //#region ../../../node_modules/.pnpm/@emotion+sheet@1.4.0/node_modules/@emotion/sheet/dist/emotion-sheet.esm.js
10193
- function sheetForTag(tag) {
10194
- if (tag.sheet) return tag.sheet;
10195
- /* istanbul ignore next */
10196
- for (var i = 0; i < document.styleSheets.length; i++) if (document.styleSheets[i].ownerNode === tag) return document.styleSheets[i];
10197
- }
10198
- function createStyleElement(options) {
10199
- var tag = document.createElement("style");
10200
- tag.setAttribute("data-emotion", options.key);
10201
- if (options.nonce !== void 0) tag.setAttribute("nonce", options.nonce);
10202
- tag.appendChild(document.createTextNode(""));
10203
- tag.setAttribute("data-s", "");
10204
- return tag;
9929
+ // ../../../node_modules/.pnpm/@wordpress+components@43.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_401cb4bad47bd1f7b56615ff574f0485/node_modules/@wordpress/components/build-module/context/context-system-provider.mjs
9930
+ var import_es6 = /* @__PURE__ */ __toESM(require_es6(), 1);
9931
+ var ComponentsContext = (0, react.createContext)({});
9932
+ ComponentsContext.displayName = "ComponentsContext";
9933
+ var useComponentsContext = () => (0, react.useContext)(ComponentsContext);
9934
+ function useContextSystemBridge({ value }) {
9935
+ const parentContext = useComponentsContext();
9936
+ const valueRef = (0, react.useRef)(value);
9937
+ use_update_effect_default(() => {
9938
+ if ((0, import_es6.default)(valueRef.current, value) && valueRef.current !== value) warning(`Please memoize your context: ${JSON.stringify(value)}`);
9939
+ }, [value]);
9940
+ return (0, react.useMemo)(() => {
9941
+ return (0, deepmerge.default)(parentContext ?? {}, value ?? {}, { isMergeableObject: isPlainObject });
9942
+ }, [parentContext, value]);
10205
9943
  }
10206
- var StyleSheet = /*#__PURE__*/ function() {
10207
- function StyleSheet(options) {
10208
- var _this = this;
10209
- this._insertTag = function(tag) {
10210
- var before;
10211
- if (_this.tags.length === 0) {
10212
- if (_this.insertionPoint) before = _this.insertionPoint.nextSibling;
10213
- else if (_this.prepend) before = _this.container.firstChild;
10214
- else before = _this.before;
10215
- } else before = _this.tags[_this.tags.length - 1].nextSibling;
10216
- _this.container.insertBefore(tag, before);
10217
- _this.tags.push(tag);
10218
- };
10219
- this.isSpeedy = options.speedy === void 0 ? true : options.speedy;
10220
- this.tags = [];
10221
- this.ctr = 0;
10222
- this.nonce = options.nonce;
10223
- this.key = options.key;
10224
- this.container = options.container;
10225
- this.prepend = options.prepend;
10226
- this.insertionPoint = options.insertionPoint;
10227
- this.before = null;
10228
- }
10229
- var _proto = StyleSheet.prototype;
10230
- _proto.hydrate = function hydrate(nodes) {
10231
- nodes.forEach(this._insertTag);
10232
- };
10233
- _proto.insert = function insert(rule) {
10234
- if (this.ctr % (this.isSpeedy ? 65e3 : 1) === 0) this._insertTag(createStyleElement(this));
10235
- var tag = this.tags[this.tags.length - 1];
10236
- if (this.isSpeedy) {
10237
- var sheet = sheetForTag(tag);
10238
- try {
10239
- sheet.insertRule(rule, sheet.cssRules.length);
10240
- } catch (e) {}
10241
- } else tag.appendChild(document.createTextNode(rule));
10242
- this.ctr++;
10243
- };
10244
- _proto.flush = function flush() {
10245
- this.tags.forEach(function(tag) {
10246
- var _tag$parentNode;
10247
- return (_tag$parentNode = tag.parentNode) == null ? void 0 : _tag$parentNode.removeChild(tag);
10248
- });
10249
- this.tags = [];
10250
- this.ctr = 0;
10251
- };
10252
- return StyleSheet;
10253
- }();
10254
- //#endregion
10255
- //#region ../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Enum.js
10256
- var MS = "-ms-";
10257
- var MOZ = "-moz-";
10258
- var WEBKIT = "-webkit-";
10259
- var COMMENT = "comm";
10260
- var RULESET = "rule";
10261
- var DECLARATION = "decl";
10262
- var IMPORT = "@import";
10263
- var KEYFRAMES = "@keyframes";
10264
- var LAYER = "@layer";
10265
- //#endregion
10266
- //#region ../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Utility.js
10267
- /**
10268
- * @param {number}
10269
- * @return {number}
10270
- */
10271
- var abs = Math.abs;
10272
- /**
10273
- * @param {number}
10274
- * @return {string}
10275
- */
10276
- var from = String.fromCharCode;
10277
- /**
10278
- * @param {object}
10279
- * @return {object}
10280
- */
10281
- var assign = Object.assign;
10282
- /**
10283
- * @param {string} value
10284
- * @param {number} length
10285
- * @return {number}
10286
- */
10287
- function hash(value, length) {
10288
- return charat(value, 0) ^ 45 ? (((length << 2 ^ charat(value, 0)) << 2 ^ charat(value, 1)) << 2 ^ charat(value, 2)) << 2 ^ charat(value, 3) : 0;
10289
- }
10290
- /**
10291
- * @param {string} value
10292
- * @return {string}
10293
- */
10294
- function trim(value) {
10295
- return value.trim();
10296
- }
10297
- /**
10298
- * @param {string} value
10299
- * @param {RegExp} pattern
10300
- * @return {string?}
10301
- */
10302
- function match(value, pattern) {
10303
- return (value = pattern.exec(value)) ? value[0] : value;
10304
- }
10305
- /**
10306
- * @param {string} value
10307
- * @param {(string|RegExp)} pattern
10308
- * @param {string} replacement
10309
- * @return {string}
10310
- */
10311
- function replace(value, pattern, replacement) {
10312
- return value.replace(pattern, replacement);
10313
- }
10314
- /**
10315
- * @param {string} value
10316
- * @param {string} search
10317
- * @return {number}
10318
- */
10319
- function indexof(value, search) {
10320
- return value.indexOf(search);
10321
- }
10322
- /**
10323
- * @param {string} value
10324
- * @param {number} index
10325
- * @return {number}
10326
- */
10327
- function charat(value, index) {
10328
- return value.charCodeAt(index) | 0;
10329
- }
10330
- /**
10331
- * @param {string} value
10332
- * @param {number} begin
10333
- * @param {number} end
10334
- * @return {string}
10335
- */
10336
- function substr(value, begin, end) {
10337
- return value.slice(begin, end);
10338
- }
10339
- /**
10340
- * @param {string} value
10341
- * @return {number}
10342
- */
10343
- function strlen(value) {
10344
- return value.length;
10345
- }
10346
- /**
10347
- * @param {any[]} value
10348
- * @return {number}
10349
- */
10350
- function sizeof(value) {
10351
- return value.length;
10352
- }
10353
- /**
10354
- * @param {any} value
10355
- * @param {any[]} array
10356
- * @return {any}
10357
- */
10358
- function append(value, array) {
10359
- return array.push(value), value;
10360
- }
10361
- /**
10362
- * @param {string[]} array
10363
- * @param {function} callback
10364
- * @return {string}
10365
- */
10366
- function combine(array, callback) {
10367
- return array.map(callback).join("");
10368
- }
10369
- //#endregion
10370
- //#region ../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Tokenizer.js
10371
- var line = 1;
10372
- var column = 1;
10373
- var length = 0;
10374
- var position = 0;
10375
- var character = 0;
10376
- var characters = "";
10377
- /**
10378
- * @param {string} value
10379
- * @param {object | null} root
10380
- * @param {object | null} parent
10381
- * @param {string} type
10382
- * @param {string[] | string} props
10383
- * @param {object[] | string} children
10384
- * @param {number} length
10385
- */
10386
- function node(value, root, parent, type, props, children, length) {
10387
- return {
10388
- value,
10389
- root,
10390
- parent,
10391
- type,
10392
- props,
10393
- children,
10394
- line,
10395
- column,
10396
- length,
10397
- return: ""
10398
- };
10399
- }
10400
- /**
10401
- * @param {object} root
10402
- * @param {object} props
10403
- * @return {object}
10404
- */
10405
- function copy(root, props) {
10406
- return assign(node("", null, null, "", null, null, 0), root, { length: -root.length }, props);
10407
- }
10408
- /**
10409
- * @return {number}
10410
- */
10411
- function char() {
10412
- return character;
10413
- }
10414
- /**
10415
- * @return {number}
10416
- */
10417
- function prev() {
10418
- character = position > 0 ? charat(characters, --position) : 0;
10419
- if (column--, character === 10) column = 1, line--;
10420
- return character;
10421
- }
10422
- /**
10423
- * @return {number}
10424
- */
10425
- function next() {
10426
- character = position < length ? charat(characters, position++) : 0;
10427
- if (column++, character === 10) column = 1, line++;
10428
- return character;
10429
- }
10430
- /**
10431
- * @return {number}
10432
- */
10433
- function peek() {
10434
- return charat(characters, position);
10435
- }
10436
- /**
10437
- * @return {number}
10438
- */
10439
- function caret() {
10440
- return position;
10441
- }
10442
- /**
10443
- * @param {number} begin
10444
- * @param {number} end
10445
- * @return {string}
10446
- */
10447
- function slice(begin, end) {
10448
- return substr(characters, begin, end);
10449
- }
10450
- /**
10451
- * @param {number} type
10452
- * @return {number}
10453
- */
10454
- function token(type) {
10455
- switch (type) {
10456
- case 0:
10457
- case 9:
10458
- case 10:
10459
- case 13:
10460
- case 32: return 5;
10461
- case 33:
10462
- case 43:
10463
- case 44:
10464
- case 47:
10465
- case 62:
10466
- case 64:
10467
- case 126:
10468
- case 59:
10469
- case 123:
10470
- case 125: return 4;
10471
- case 58: return 3;
10472
- case 34:
10473
- case 39:
10474
- case 40:
10475
- case 91: return 2;
10476
- case 41:
10477
- case 93: return 1;
10478
- }
10479
- return 0;
10480
- }
10481
- /**
10482
- * @param {string} value
10483
- * @return {any[]}
10484
- */
10485
- function alloc(value) {
10486
- return line = column = 1, length = strlen(characters = value), position = 0, [];
10487
- }
10488
- /**
10489
- * @param {any} value
10490
- * @return {any}
10491
- */
10492
- function dealloc(value) {
10493
- return characters = "", value;
10494
- }
10495
- /**
10496
- * @param {number} type
10497
- * @return {string}
10498
- */
10499
- function delimit(type) {
10500
- return trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)));
10501
- }
10502
- /**
10503
- * @param {number} type
10504
- * @return {string}
10505
- */
10506
- function whitespace(type) {
10507
- while (character = peek()) if (character < 33) next();
10508
- else break;
10509
- return token(type) > 2 || token(character) > 3 ? "" : " ";
10510
- }
10511
- /**
10512
- * @param {number} index
10513
- * @param {number} count
10514
- * @return {string}
10515
- */
10516
- function escaping(index, count) {
10517
- while (--count && next()) if (character < 48 || character > 102 || character > 57 && character < 65 || character > 70 && character < 97) break;
10518
- return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32));
10519
- }
10520
- /**
10521
- * @param {number} type
10522
- * @return {number}
10523
- */
10524
- function delimiter(type) {
10525
- while (next()) switch (character) {
10526
- case type: return position;
10527
- case 34:
10528
- case 39:
10529
- if (type !== 34 && type !== 39) delimiter(character);
10530
- break;
10531
- case 40:
10532
- if (type === 41) delimiter(type);
10533
- break;
10534
- case 92: next();
10535
- }
10536
- return position;
10537
- }
10538
- /**
10539
- * @param {number} type
10540
- * @param {number} index
10541
- * @return {number}
10542
- */
10543
- function commenter(type, index) {
10544
- while (next()) if (type + character === 57) break;
10545
- else if (type + character === 84 && peek() === 47) break;
10546
- return "/*" + slice(index, position - 1) + "*" + from(type === 47 ? type : next());
10547
- }
10548
- /**
10549
- * @param {number} index
10550
- * @return {string}
10551
- */
10552
- function identifier(index) {
10553
- while (!token(peek())) next();
10554
- return slice(index, position);
10555
- }
10556
- //#endregion
10557
- //#region ../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Parser.js
10558
- /**
10559
- * @param {string} value
10560
- * @return {object[]}
10561
- */
10562
- function compile(value) {
10563
- return dealloc(parse("", null, null, null, [""], value = alloc(value), 0, [0], value));
10564
- }
10565
- /**
10566
- * @param {string} value
10567
- * @param {object} root
10568
- * @param {object?} parent
10569
- * @param {string[]} rule
10570
- * @param {string[]} rules
10571
- * @param {string[]} rulesets
10572
- * @param {number[]} pseudo
10573
- * @param {number[]} points
10574
- * @param {string[]} declarations
10575
- * @return {object}
10576
- */
10577
- function parse(value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {
10578
- var index = 0;
10579
- var offset = 0;
10580
- var length = pseudo;
10581
- var atrule = 0;
10582
- var property = 0;
10583
- var previous = 0;
10584
- var variable = 1;
10585
- var scanning = 1;
10586
- var ampersand = 1;
10587
- var character = 0;
10588
- var type = "";
10589
- var props = rules;
10590
- var children = rulesets;
10591
- var reference = rule;
10592
- var characters = type;
10593
- while (scanning) switch (previous = character, character = next()) {
10594
- case 40: if (previous != 108 && charat(characters, length - 1) == 58) {
10595
- if (indexof(characters += replace(delimit(character), "&", "&\f"), "&\f") != -1) ampersand = -1;
10596
- break;
10597
- }
10598
- case 34:
10599
- case 39:
10600
- case 91:
10601
- characters += delimit(character);
10602
- break;
10603
- case 9:
10604
- case 10:
10605
- case 13:
10606
- case 32:
10607
- characters += whitespace(previous);
10608
- break;
10609
- case 92:
10610
- characters += escaping(caret() - 1, 7);
10611
- continue;
10612
- case 47:
10613
- switch (peek()) {
10614
- case 42:
10615
- case 47:
10616
- append(comment(commenter(next(), caret()), root, parent), declarations);
10617
- break;
10618
- default: characters += "/";
10619
- }
10620
- break;
10621
- case 123 * variable: points[index++] = strlen(characters) * ampersand;
10622
- case 125 * variable:
10623
- case 59:
10624
- case 0:
10625
- switch (character) {
10626
- case 0:
10627
- case 125: scanning = 0;
10628
- case 59 + offset:
10629
- if (ampersand == -1) characters = replace(characters, /\f/g, "");
10630
- if (property > 0 && strlen(characters) - length) append(property > 32 ? declaration(characters + ";", rule, parent, length - 1) : declaration(replace(characters, " ", "") + ";", rule, parent, length - 2), declarations);
10631
- break;
10632
- case 59: characters += ";";
10633
- default:
10634
- append(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets);
10635
- if (character === 123) if (offset === 0) parse(characters, root, reference, reference, props, rulesets, length, points, children);
10636
- else switch (atrule === 99 && charat(characters, 3) === 110 ? 100 : atrule) {
10637
- case 100:
10638
- case 108:
10639
- case 109:
10640
- case 115:
10641
- parse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children);
10642
- break;
10643
- default: parse(characters, reference, reference, reference, [""], children, 0, points, children);
10644
- }
10645
- }
10646
- index = offset = property = 0, variable = ampersand = 1, type = characters = "", length = pseudo;
10647
- break;
10648
- case 58: length = 1 + strlen(characters), property = previous;
10649
- default:
10650
- if (variable < 1) {
10651
- if (character == 123) --variable;
10652
- else if (character == 125 && variable++ == 0 && prev() == 125) continue;
10653
- }
10654
- switch (characters += from(character), character * variable) {
10655
- case 38:
10656
- ampersand = offset > 0 ? 1 : (characters += "\f", -1);
10657
- break;
10658
- case 44:
10659
- points[index++] = (strlen(characters) - 1) * ampersand, ampersand = 1;
10660
- break;
10661
- case 64:
10662
- if (peek() === 45) characters += delimit(next());
10663
- atrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++;
10664
- break;
10665
- case 45: if (previous === 45 && strlen(characters) == 2) variable = 0;
10666
- }
10667
- }
10668
- return rulesets;
10669
- }
10670
- /**
10671
- * @param {string} value
10672
- * @param {object} root
10673
- * @param {object?} parent
10674
- * @param {number} index
10675
- * @param {number} offset
10676
- * @param {string[]} rules
10677
- * @param {number[]} points
10678
- * @param {string} type
10679
- * @param {string[]} props
10680
- * @param {string[]} children
10681
- * @param {number} length
10682
- * @return {object}
10683
- */
10684
- function ruleset(value, root, parent, index, offset, rules, points, type, props, children, length) {
10685
- var post = offset - 1;
10686
- var rule = offset === 0 ? rules : [""];
10687
- var size = sizeof(rule);
10688
- for (var i = 0, j = 0, k = 0; i < index; ++i) for (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x) if (z = trim(j > 0 ? rule[x] + " " + y : replace(y, /&\f/g, rule[x]))) props[k++] = z;
10689
- return node(value, root, parent, offset === 0 ? RULESET : type, props, children, length);
10690
- }
10691
- /**
10692
- * @param {number} value
10693
- * @param {object} root
10694
- * @param {object?} parent
10695
- * @return {object}
10696
- */
10697
- function comment(value, root, parent) {
10698
- return node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0);
10699
- }
10700
- /**
10701
- * @param {string} value
10702
- * @param {object} root
10703
- * @param {object?} parent
10704
- * @param {number} length
10705
- * @return {object}
10706
- */
10707
- function declaration(value, root, parent, length) {
10708
- return node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length);
10709
- }
10710
- //#endregion
10711
- //#region ../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Serializer.js
10712
- /**
10713
- * @param {object[]} children
10714
- * @param {function} callback
10715
- * @return {string}
10716
- */
10717
- function serialize(children, callback) {
10718
- var output = "";
10719
- var length = sizeof(children);
10720
- for (var i = 0; i < length; i++) output += callback(children[i], i, children, callback) || "";
10721
- return output;
10722
- }
10723
- /**
10724
- * @param {object} element
10725
- * @param {number} index
10726
- * @param {object[]} children
10727
- * @param {function} callback
10728
- * @return {string}
10729
- */
10730
- function stringify(element, index, children, callback) {
10731
- switch (element.type) {
10732
- case LAYER: if (element.children.length) break;
10733
- case IMPORT:
10734
- case DECLARATION: return element.return = element.return || element.value;
10735
- case COMMENT: return "";
10736
- case KEYFRAMES: return element.return = element.value + "{" + serialize(element.children, callback) + "}";
10737
- case RULESET: element.value = element.props.join(",");
10738
- }
10739
- return strlen(children = serialize(element.children, callback)) ? element.return = element.value + "{" + children + "}" : "";
10740
- }
10741
- //#endregion
10742
- //#region ../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Middleware.js
10743
- /**
10744
- * @param {function[]} collection
10745
- * @return {function}
10746
- */
10747
- function middleware(collection) {
10748
- var length = sizeof(collection);
10749
- return function(element, index, children, callback) {
10750
- var output = "";
10751
- for (var i = 0; i < length; i++) output += collection[i](element, index, children, callback) || "";
10752
- return output;
10753
- };
10754
- }
10755
- /**
10756
- * @param {function} callback
10757
- * @return {function}
10758
- */
10759
- function rulesheet(callback) {
10760
- return function(element) {
10761
- if (!element.root) {
10762
- if (element = element.return) callback(element);
10763
- }
10764
- };
10765
- }
10766
- //#endregion
10767
- //#region ../../../node_modules/.pnpm/@emotion+weak-memoize@0.4.0/node_modules/@emotion/weak-memoize/dist/emotion-weak-memoize.esm.js
10768
- var weakMemoize = function weakMemoize(func) {
10769
- var cache = /* @__PURE__ */ new WeakMap();
10770
- return function(arg) {
10771
- if (cache.has(arg)) return cache.get(arg);
10772
- var ret = func(arg);
10773
- cache.set(arg, ret);
10774
- return ret;
10775
- };
10776
- };
10777
- //#endregion
10778
- //#region ../../../node_modules/.pnpm/@emotion+memoize@0.9.0/node_modules/@emotion/memoize/dist/emotion-memoize.esm.js
10779
- function memoize(fn) {
10780
- var cache = Object.create(null);
10781
- return function(arg) {
10782
- if (cache[arg] === void 0) cache[arg] = fn(arg);
10783
- return cache[arg];
10784
- };
10785
- }
10786
- //#endregion
10787
- //#region ../../../node_modules/.pnpm/@emotion+cache@11.14.0/node_modules/@emotion/cache/dist/emotion-cache.esm.js
10788
- var isBrowser$2 = typeof document !== "undefined";
10789
- var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
10790
- var previous = 0;
10791
- var character = 0;
10792
- while (true) {
10793
- previous = character;
10794
- character = peek();
10795
- if (previous === 38 && character === 12) points[index] = 1;
10796
- if (token(character)) break;
10797
- next();
10798
- }
10799
- return slice(begin, position);
10800
- };
10801
- var toRules = function toRules(parsed, points) {
10802
- var index = -1;
10803
- var character = 44;
10804
- do
10805
- switch (token(character)) {
10806
- case 0:
10807
- if (character === 38 && peek() === 12) points[index] = 1;
10808
- parsed[index] += identifierWithPointTracking(position - 1, points, index);
10809
- break;
10810
- case 2:
10811
- parsed[index] += delimit(character);
10812
- break;
10813
- case 4: if (character === 44) {
10814
- parsed[++index] = peek() === 58 ? "&\f" : "";
10815
- points[index] = parsed[index].length;
10816
- break;
10817
- }
10818
- default: parsed[index] += from(character);
10819
- }
10820
- while (character = next());
10821
- return parsed;
10822
- };
10823
- var getRules = function getRules(value, points) {
10824
- return dealloc(toRules(alloc(value), points));
10825
- };
10826
- var fixedElements = /* #__PURE__ */ new WeakMap();
10827
- var compat = function compat(element) {
10828
- if (element.type !== "rule" || !element.parent || element.length < 1) return;
10829
- var value = element.value;
10830
- var parent = element.parent;
10831
- var isImplicitRule = element.column === parent.column && element.line === parent.line;
10832
- while (parent.type !== "rule") {
10833
- parent = parent.parent;
10834
- if (!parent) return;
10835
- }
10836
- if (element.props.length === 1 && value.charCodeAt(0) !== 58 && !fixedElements.get(parent)) return;
10837
- if (isImplicitRule) return;
10838
- fixedElements.set(element, true);
10839
- var points = [];
10840
- var rules = getRules(value, points);
10841
- var parentRules = parent.props;
10842
- for (var i = 0, k = 0; i < rules.length; i++) for (var j = 0; j < parentRules.length; j++, k++) element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
10843
- };
10844
- var removeLabel = function removeLabel(element) {
10845
- if (element.type === "decl") {
10846
- var value = element.value;
10847
- if (value.charCodeAt(0) === 108 && value.charCodeAt(2) === 98) {
10848
- element["return"] = "";
10849
- element.value = "";
10850
- }
10851
- }
10852
- };
10853
- function prefix(value, length) {
10854
- switch (hash(value, length)) {
10855
- case 5103: return WEBKIT + "print-" + value + value;
10856
- case 5737:
10857
- case 4201:
10858
- case 3177:
10859
- case 3433:
10860
- case 1641:
10861
- case 4457:
10862
- case 2921:
10863
- case 5572:
10864
- case 6356:
10865
- case 5844:
10866
- case 3191:
10867
- case 6645:
10868
- case 3005:
10869
- case 6391:
10870
- case 5879:
10871
- case 5623:
10872
- case 6135:
10873
- case 4599:
10874
- case 4855:
10875
- case 4215:
10876
- case 6389:
10877
- case 5109:
10878
- case 5365:
10879
- case 5621:
10880
- case 3829: return WEBKIT + value + value;
10881
- case 5349:
10882
- case 4246:
10883
- case 4810:
10884
- case 6968:
10885
- case 2756: return WEBKIT + value + MOZ + value + MS + value + value;
10886
- case 6828:
10887
- case 4268: return WEBKIT + value + MS + value + value;
10888
- case 6165: return WEBKIT + value + MS + "flex-" + value + value;
10889
- case 5187: return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + "box-$1$2" + MS + "flex-$1$2") + value;
10890
- case 5443: return WEBKIT + value + MS + "flex-item-" + replace(value, /flex-|-self/, "") + value;
10891
- case 4675: return WEBKIT + value + MS + "flex-line-pack" + replace(value, /align-content|flex-|-self/, "") + value;
10892
- case 5548: return WEBKIT + value + MS + replace(value, "shrink", "negative") + value;
10893
- case 5292: return WEBKIT + value + MS + replace(value, "basis", "preferred-size") + value;
10894
- case 6060: return WEBKIT + "box-" + replace(value, "-grow", "") + WEBKIT + value + MS + replace(value, "grow", "positive") + value;
10895
- case 4554: return WEBKIT + replace(value, /([^-])(transform)/g, "$1" + WEBKIT + "$2") + value;
10896
- case 6187: return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + "$1"), /(image-set)/, WEBKIT + "$1"), value, "") + value;
10897
- case 5495:
10898
- case 3959: return replace(value, /(image-set\([^]*)/, WEBKIT + "$1$`$1");
10899
- case 4968: return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + "box-pack:$3" + MS + "flex-pack:$3"), /s.+-b[^;]+/, "justify") + WEBKIT + value + value;
10900
- case 4095:
10901
- case 3583:
10902
- case 4068:
10903
- case 2532: return replace(value, /(.+)-inline(.+)/, WEBKIT + "$1$2") + value;
10904
- case 8116:
10905
- case 7059:
10906
- case 5753:
10907
- case 5535:
10908
- case 5445:
10909
- case 5701:
10910
- case 4933:
10911
- case 4677:
10912
- case 5533:
10913
- case 5789:
10914
- case 5021:
10915
- case 4765:
10916
- if (strlen(value) - 1 - length > 6) switch (charat(value, length + 1)) {
10917
- case 109: if (charat(value, length + 4) !== 45) break;
10918
- case 102: return replace(value, /(.+:)(.+)-([^]+)/, "$1" + WEBKIT + "$2-$3$1" + MOZ + (charat(value, length + 3) == 108 ? "$3" : "$2-$3")) + value;
10919
- case 115: return ~indexof(value, "stretch") ? prefix(replace(value, "stretch", "fill-available"), length) + value : value;
10920
- }
10921
- break;
10922
- case 4949: if (charat(value, length + 1) !== 115) break;
10923
- case 6444:
10924
- switch (charat(value, strlen(value) - 3 - (~indexof(value, "!important") && 10))) {
10925
- case 107: return replace(value, ":", ":" + WEBKIT) + value;
10926
- case 101: return replace(value, /(.+:)([^;!]+)(;|!.+)?/, "$1" + WEBKIT + (charat(value, 14) === 45 ? "inline-" : "") + "box$3$1" + WEBKIT + "$2$3$1" + MS + "$2box$3") + value;
10927
- }
10928
- break;
10929
- case 5936:
10930
- switch (charat(value, length + 11)) {
10931
- case 114: return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, "tb") + value;
10932
- case 108: return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, "tb-rl") + value;
10933
- case 45: return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, "lr") + value;
10934
- }
10935
- return WEBKIT + value + MS + value + value;
10936
- }
10937
- return value;
10938
- }
10939
- var prefixer = function prefixer(element, index, children, callback) {
10940
- if (element.length > -1) {
10941
- if (!element["return"]) switch (element.type) {
10942
- case DECLARATION:
10943
- element["return"] = prefix(element.value, element.length);
10944
- break;
10945
- case KEYFRAMES: return serialize([copy(element, { value: replace(element.value, "@", "@" + WEBKIT) })], callback);
10946
- case RULESET: if (element.length) return combine(element.props, function(value) {
10947
- switch (match(value, /(::plac\w+|:read-\w+)/)) {
10948
- case ":read-only":
10949
- case ":read-write": return serialize([copy(element, { props: [replace(value, /:(read-\w+)/, ":" + MOZ + "$1")] })], callback);
10950
- case "::placeholder": return serialize([
10951
- copy(element, { props: [replace(value, /:(plac\w+)/, ":" + WEBKIT + "input-$1")] }),
10952
- copy(element, { props: [replace(value, /:(plac\w+)/, ":" + MOZ + "$1")] }),
10953
- copy(element, { props: [replace(value, /:(plac\w+)/, MS + "input-$1")] })
10954
- ], callback);
10955
- }
10956
- return "";
10957
- });
10958
- }
10959
- }
10960
- };
10961
- var getServerStylisCache = isBrowser$2 ? void 0 : weakMemoize(function() {
10962
- return memoize(function() {
10963
- return {};
9944
+ var BaseContextSystemProvider = ({ children, value }) => {
9945
+ const contextValue = useContextSystemBridge({ value });
9946
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentsContext.Provider, {
9947
+ value: contextValue,
9948
+ children
10964
9949
  });
10965
- });
10966
- var defaultStylisPlugins = [prefixer];
10967
- var createCache = function createCache(options) {
10968
- var key = options.key;
10969
- if (isBrowser$2 && key === "css") {
10970
- var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])");
10971
- Array.prototype.forEach.call(ssrStyles, function(node) {
10972
- if (node.getAttribute("data-emotion").indexOf(" ") === -1) return;
10973
- document.head.appendChild(node);
10974
- node.setAttribute("data-s", "");
10975
- });
10976
- }
10977
- var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
10978
- var inserted = {};
10979
- var container;
10980
- var nodesToHydrate = [];
10981
- if (isBrowser$2) {
10982
- container = options.container || document.head;
10983
- Array.prototype.forEach.call(document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function(node) {
10984
- var attrib = node.getAttribute("data-emotion").split(" ");
10985
- for (var i = 1; i < attrib.length; i++) inserted[attrib[i]] = true;
10986
- nodesToHydrate.push(node);
10987
- });
10988
- }
10989
- var _insert;
10990
- var omnipresentPlugins = [compat, removeLabel];
10991
- if (!getServerStylisCache) {
10992
- var currentSheet;
10993
- var finalizingPlugins = [stringify, rulesheet(function(rule) {
10994
- currentSheet.insert(rule);
10995
- })];
10996
- var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
10997
- var stylis = function stylis(styles) {
10998
- return serialize(compile(styles), serializer);
10999
- };
11000
- _insert = function insert(selector, serialized, sheet, shouldCache) {
11001
- currentSheet = sheet;
11002
- stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
11003
- if (shouldCache) cache.inserted[serialized.name] = true;
11004
- };
11005
- } else {
11006
- var _finalizingPlugins = [stringify];
11007
- var _serializer = middleware(omnipresentPlugins.concat(stylisPlugins, _finalizingPlugins));
11008
- var _stylis = function _stylis(styles) {
11009
- return serialize(compile(styles), _serializer);
11010
- };
11011
- var serverStylisCache = getServerStylisCache(stylisPlugins)(key);
11012
- var getRules = function getRules(selector, serialized) {
11013
- var name = serialized.name;
11014
- if (serverStylisCache[name] === void 0) serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
11015
- return serverStylisCache[name];
11016
- };
11017
- _insert = function _insert(selector, serialized, sheet, shouldCache) {
11018
- var name = serialized.name;
11019
- var rules = getRules(selector, serialized);
11020
- if (cache.compat === void 0) {
11021
- if (shouldCache) cache.inserted[name] = true;
11022
- return rules;
11023
- } else if (shouldCache) cache.inserted[name] = rules;
11024
- else return rules;
11025
- };
11026
- }
11027
- var cache = {
11028
- key,
11029
- sheet: new StyleSheet({
11030
- key,
11031
- container,
11032
- nonce: options.nonce,
11033
- speedy: options.speedy,
11034
- prepend: options.prepend,
11035
- insertionPoint: options.insertionPoint
11036
- }),
11037
- nonce: options.nonce,
11038
- inserted,
11039
- registered: {},
11040
- insert: _insert
11041
- };
11042
- cache.sheet.hydrate(nodesToHydrate);
11043
- return cache;
11044
- };
11045
- //#endregion
11046
- //#region ../../../node_modules/.pnpm/@emotion+utils@1.4.2/node_modules/@emotion/utils/dist/emotion-utils.esm.js
11047
- var isBrowser$1 = typeof document !== "undefined";
11048
- function getRegisteredStyles$1(registered, registeredStyles, classNames) {
11049
- var rawClassName = "";
11050
- classNames.split(" ").forEach(function(className) {
11051
- if (registered[className] !== void 0) registeredStyles.push(registered[className] + ";");
11052
- else if (className) rawClassName += className + " ";
11053
- });
11054
- return rawClassName;
11055
- }
11056
- var registerStyles = function registerStyles(cache, serialized, isStringTag) {
11057
- var className = cache.key + "-" + serialized.name;
11058
- if ((isStringTag === false || isBrowser$1 === false && cache.compat !== void 0) && cache.registered[className] === void 0) cache.registered[className] = serialized.styles;
11059
- };
11060
- var insertStyles = function insertStyles(cache, serialized, isStringTag) {
11061
- registerStyles(cache, serialized, isStringTag);
11062
- var className = cache.key + "-" + serialized.name;
11063
- if (cache.inserted[serialized.name] === void 0) {
11064
- var stylesForSSR = "";
11065
- var current = serialized;
11066
- do {
11067
- var maybeStyles = cache.insert(serialized === current ? "." + className : "", current, cache.sheet, true);
11068
- if (!isBrowser$1 && maybeStyles !== void 0) stylesForSSR += maybeStyles;
11069
- current = current.next;
11070
- } while (current !== void 0);
11071
- if (!isBrowser$1 && stylesForSSR.length !== 0) return stylesForSSR;
11072
- }
11073
- };
11074
- //#endregion
11075
- //#region ../../../node_modules/.pnpm/@emotion+hash@0.9.2/node_modules/@emotion/hash/dist/emotion-hash.esm.js
11076
- function murmur2(str) {
11077
- var h = 0;
11078
- var k, i = 0, len = str.length;
11079
- for (; len >= 4; ++i, len -= 4) {
11080
- k = str.charCodeAt(i) & 255 | (str.charCodeAt(++i) & 255) << 8 | (str.charCodeAt(++i) & 255) << 16 | (str.charCodeAt(++i) & 255) << 24;
11081
- k = (k & 65535) * 1540483477 + ((k >>> 16) * 59797 << 16);
11082
- k ^= k >>> 24;
11083
- h = (k & 65535) * 1540483477 + ((k >>> 16) * 59797 << 16) ^ (h & 65535) * 1540483477 + ((h >>> 16) * 59797 << 16);
11084
- }
11085
- switch (len) {
11086
- case 3: h ^= (str.charCodeAt(i + 2) & 255) << 16;
11087
- case 2: h ^= (str.charCodeAt(i + 1) & 255) << 8;
11088
- case 1:
11089
- h ^= str.charCodeAt(i) & 255;
11090
- h = (h & 65535) * 1540483477 + ((h >>> 16) * 59797 << 16);
11091
- }
11092
- h ^= h >>> 13;
11093
- h = (h & 65535) * 1540483477 + ((h >>> 16) * 59797 << 16);
11094
- return ((h ^ h >>> 15) >>> 0).toString(36);
11095
- }
11096
- //#endregion
11097
- //#region ../../../node_modules/.pnpm/@emotion+unitless@0.10.0/node_modules/@emotion/unitless/dist/emotion-unitless.esm.js
11098
- var unitlessKeys = {
11099
- animationIterationCount: 1,
11100
- aspectRatio: 1,
11101
- borderImageOutset: 1,
11102
- borderImageSlice: 1,
11103
- borderImageWidth: 1,
11104
- boxFlex: 1,
11105
- boxFlexGroup: 1,
11106
- boxOrdinalGroup: 1,
11107
- columnCount: 1,
11108
- columns: 1,
11109
- flex: 1,
11110
- flexGrow: 1,
11111
- flexPositive: 1,
11112
- flexShrink: 1,
11113
- flexNegative: 1,
11114
- flexOrder: 1,
11115
- gridRow: 1,
11116
- gridRowEnd: 1,
11117
- gridRowSpan: 1,
11118
- gridRowStart: 1,
11119
- gridColumn: 1,
11120
- gridColumnEnd: 1,
11121
- gridColumnSpan: 1,
11122
- gridColumnStart: 1,
11123
- msGridRow: 1,
11124
- msGridRowSpan: 1,
11125
- msGridColumn: 1,
11126
- msGridColumnSpan: 1,
11127
- fontWeight: 1,
11128
- lineHeight: 1,
11129
- opacity: 1,
11130
- order: 1,
11131
- orphans: 1,
11132
- scale: 1,
11133
- tabSize: 1,
11134
- widows: 1,
11135
- zIndex: 1,
11136
- zoom: 1,
11137
- WebkitLineClamp: 1,
11138
- fillOpacity: 1,
11139
- floodOpacity: 1,
11140
- stopOpacity: 1,
11141
- strokeDasharray: 1,
11142
- strokeDashoffset: 1,
11143
- strokeMiterlimit: 1,
11144
- strokeOpacity: 1,
11145
- strokeWidth: 1
11146
- };
11147
- //#endregion
11148
- //#region ../../../node_modules/.pnpm/@emotion+serialize@1.3.3/node_modules/@emotion/serialize/dist/emotion-serialize.esm.js
11149
- var isDevelopment = false;
11150
- var hyphenateRegex = /[A-Z]|^ms/g;
11151
- var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g;
11152
- var isCustomProperty = function isCustomProperty(property) {
11153
- return property.charCodeAt(1) === 45;
11154
- };
11155
- var isProcessableValue = function isProcessableValue(value) {
11156
- return value != null && typeof value !== "boolean";
11157
- };
11158
- var processStyleName = /* #__PURE__ */ memoize(function(styleName) {
11159
- return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, "-$&").toLowerCase();
11160
- });
11161
- var processStyleValue = function processStyleValue(key, value) {
11162
- switch (key) {
11163
- case "animation":
11164
- case "animationName": if (typeof value === "string") return value.replace(animationRegex, function(match, p1, p2) {
11165
- cursor = {
11166
- name: p1,
11167
- styles: p2,
11168
- next: cursor
11169
- };
11170
- return p1;
11171
- });
11172
- }
11173
- if (unitlessKeys[key] !== 1 && !isCustomProperty(key) && typeof value === "number" && value !== 0) return value + "px";
11174
- return value;
11175
9950
  };
11176
- var noComponentSelectorMessage = "Component selectors can only be used in conjunction with @emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware compiler transform.";
11177
- function handleInterpolation(mergedProps, registered, interpolation) {
11178
- if (interpolation == null) return "";
11179
- var componentSelector = interpolation;
11180
- if (componentSelector.__emotion_styles !== void 0) return componentSelector;
11181
- switch (typeof interpolation) {
11182
- case "boolean": return "";
11183
- case "object":
11184
- var keyframes = interpolation;
11185
- if (keyframes.anim === 1) {
11186
- cursor = {
11187
- name: keyframes.name,
11188
- styles: keyframes.styles,
11189
- next: cursor
11190
- };
11191
- return keyframes.name;
11192
- }
11193
- var serializedStyles = interpolation;
11194
- if (serializedStyles.styles !== void 0) {
11195
- var next = serializedStyles.next;
11196
- if (next !== void 0) while (next !== void 0) {
11197
- cursor = {
11198
- name: next.name,
11199
- styles: next.styles,
11200
- next: cursor
11201
- };
11202
- next = next.next;
11203
- }
11204
- return serializedStyles.styles + ";";
11205
- }
11206
- return createStringFromObject(mergedProps, registered, interpolation);
11207
- case "function": if (mergedProps !== void 0) {
11208
- var previousCursor = cursor;
11209
- var result = interpolation(mergedProps);
11210
- cursor = previousCursor;
11211
- return handleInterpolation(mergedProps, registered, result);
11212
- }
11213
- }
11214
- var asString = interpolation;
11215
- if (registered == null) return asString;
11216
- var cached = registered[asString];
11217
- return cached !== void 0 ? cached : asString;
11218
- }
11219
- function createStringFromObject(mergedProps, registered, obj) {
11220
- var string = "";
11221
- if (Array.isArray(obj)) for (var i = 0; i < obj.length; i++) string += handleInterpolation(mergedProps, registered, obj[i]) + ";";
11222
- else for (var key in obj) {
11223
- var value = obj[key];
11224
- if (typeof value !== "object") {
11225
- var asString = value;
11226
- if (registered != null && registered[asString] !== void 0) string += key + "{" + registered[asString] + "}";
11227
- else if (isProcessableValue(asString)) string += processStyleName(key) + ":" + processStyleValue(key, asString) + ";";
11228
- } else {
11229
- if (key === "NO_COMPONENT_SELECTOR" && isDevelopment) throw new Error(noComponentSelectorMessage);
11230
- if (Array.isArray(value) && typeof value[0] === "string" && (registered == null || registered[value[0]] === void 0)) {
11231
- for (var _i = 0; _i < value.length; _i++) if (isProcessableValue(value[_i])) string += processStyleName(key) + ":" + processStyleValue(key, value[_i]) + ";";
11232
- } else {
11233
- var interpolated = handleInterpolation(mergedProps, registered, value);
11234
- switch (key) {
11235
- case "animation":
11236
- case "animationName":
11237
- string += processStyleName(key) + ":" + interpolated + ";";
11238
- break;
11239
- default: string += key + "{" + interpolated + "}";
11240
- }
11241
- }
11242
- }
11243
- }
11244
- return string;
11245
- }
11246
- var labelPattern = /label:\s*([^\s;{]+)\s*(;|$)/g;
11247
- var cursor;
11248
- function serializeStyles(args, registered, mergedProps) {
11249
- if (args.length === 1 && typeof args[0] === "object" && args[0] !== null && args[0].styles !== void 0) return args[0];
11250
- var stringMode = true;
11251
- var styles = "";
11252
- cursor = void 0;
11253
- var strings = args[0];
11254
- if (strings == null || strings.raw === void 0) {
11255
- stringMode = false;
11256
- styles += handleInterpolation(mergedProps, registered, strings);
11257
- } else styles += strings[0];
11258
- for (var i = 1; i < args.length; i++) {
11259
- styles += handleInterpolation(mergedProps, registered, args[i]);
11260
- if (stringMode) styles += strings[i];
11261
- }
11262
- labelPattern.lastIndex = 0;
11263
- var identifierName = "";
11264
- var match;
11265
- while ((match = labelPattern.exec(styles)) !== null) identifierName += "-" + match[1];
11266
- return {
11267
- name: murmur2(styles) + identifierName,
11268
- styles,
11269
- next: cursor
11270
- };
11271
- }
11272
- react["useInsertionEffect"] && react["useInsertionEffect"] || react.useLayoutEffect;
11273
- //#endregion
11274
- //#region ../../../node_modules/.pnpm/@emotion+react@11.14.0_@types+react@19.3.0_react@19.3.0/node_modules/@emotion/react/dist/emotion-element-d59e098f.esm.js
11275
- var isBrowser = typeof document !== "undefined";
11276
- var EmotionCacheContext = /* #__PURE__ */ react.createContext(typeof HTMLElement !== "undefined" ? /* #__PURE__ */ createCache({ key: "css" }) : null);
11277
- EmotionCacheContext.Provider;
11278
- var __unsafe_useEmotionCache = function useEmotionCache() {
11279
- return (0, react.useContext)(EmotionCacheContext);
11280
- };
11281
- if (!isBrowser);
11282
- ({}).hasOwnProperty;
11283
- //#endregion
11284
- //#region ../../../node_modules/.pnpm/@emotion+css@11.13.5/node_modules/@emotion/css/create-instance/dist/emotion-css-create-instance.esm.js
11285
- function insertWithoutScoping(cache, serialized) {
11286
- if (cache.inserted[serialized.name] === void 0) return cache.insert("", serialized, cache.sheet, true);
11287
- }
11288
- function merge$1(registered, css, className) {
11289
- var registeredStyles = [];
11290
- var rawClassName = getRegisteredStyles$1(registered, registeredStyles, className);
11291
- if (registeredStyles.length < 2) return className;
11292
- return rawClassName + css(registeredStyles);
11293
- }
11294
- var createEmotion = function createEmotion(options) {
11295
- var cache = createCache(options);
11296
- cache.sheet.speedy = function(value) {
11297
- this.isSpeedy = value;
11298
- };
11299
- cache.compat = true;
11300
- var css = function css() {
11301
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
11302
- var serialized = serializeStyles(args, cache.registered, void 0);
11303
- insertStyles(cache, serialized, false);
11304
- return cache.key + "-" + serialized.name;
11305
- };
11306
- return {
11307
- css,
11308
- cx: function cx() {
11309
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) args[_key4] = arguments[_key4];
11310
- return merge$1(cache.registered, css, classnames(args));
11311
- },
11312
- injectGlobal: function injectGlobal() {
11313
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) args[_key3] = arguments[_key3];
11314
- insertWithoutScoping(cache, serializeStyles(args, cache.registered));
11315
- },
11316
- keyframes: function keyframes() {
11317
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) args[_key2] = arguments[_key2];
11318
- var serialized = serializeStyles(args, cache.registered);
11319
- var animation = "animation-" + serialized.name;
11320
- insertWithoutScoping(cache, {
11321
- name: serialized.name,
11322
- styles: "@keyframes " + animation + "{" + serialized.styles + "}"
11323
- });
11324
- return animation;
11325
- },
11326
- hydrate: function hydrate(ids) {
11327
- ids.forEach(function(key) {
11328
- cache.inserted[key] = true;
11329
- });
11330
- },
11331
- flush: function flush() {
11332
- cache.registered = {};
11333
- cache.inserted = {};
11334
- cache.sheet.flush();
11335
- },
11336
- sheet: cache.sheet,
11337
- cache,
11338
- getRegisteredStyles: getRegisteredStyles$1.bind(null, cache.registered),
11339
- merge: merge$1.bind(null, cache.registered, css)
11340
- };
11341
- };
11342
- var classnames = function classnames(args) {
11343
- var cls = "";
11344
- for (var i = 0; i < args.length; i++) {
11345
- var arg = args[i];
11346
- if (arg == null) continue;
11347
- var toAdd = void 0;
11348
- switch (typeof arg) {
11349
- case "boolean": break;
11350
- case "object":
11351
- if (Array.isArray(arg)) toAdd = classnames(arg);
11352
- else {
11353
- toAdd = "";
11354
- for (var k in arg) if (arg[k] && k) {
11355
- toAdd && (toAdd += " ");
11356
- toAdd += k;
11357
- }
11358
- }
11359
- break;
11360
- default: toAdd = arg;
11361
- }
11362
- if (toAdd) {
11363
- cls && (cls += " ");
11364
- cls += toAdd;
11365
- }
11366
- }
11367
- return cls;
11368
- };
11369
- //#endregion
11370
- //#region ../../../node_modules/.pnpm/@emotion+css@11.13.5/node_modules/@emotion/css/dist/emotion-css.esm.js
11371
- var _createEmotion = createEmotion({ key: "css" });
11372
- _createEmotion.flush;
11373
- _createEmotion.hydrate;
11374
- var cx = _createEmotion.cx;
11375
- _createEmotion.merge;
11376
- _createEmotion.getRegisteredStyles;
11377
- _createEmotion.injectGlobal;
11378
- _createEmotion.keyframes;
11379
- _createEmotion.css;
11380
- _createEmotion.sheet;
11381
- _createEmotion.cache;
11382
- //#endregion
11383
- //#region ../../../node_modules/.pnpm/@wordpress+components@42.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_6d0393a58a031b78f608040e2ecbe6e0/node_modules/@wordpress/components/build-module/utils/hooks/use-cx.mjs
11384
- var isSerializedStyles = (o) => typeof o !== "undefined" && o !== null && ["name", "styles"].every((p) => typeof o[p] !== "undefined");
11385
- var useCx = () => {
11386
- const cache = __unsafe_useEmotionCache();
11387
- return (0, react.useCallback)((...classNames) => {
11388
- if (cache === null) throw new Error("The `useCx` hook should be only used within a valid Emotion Cache Context");
11389
- return cx(...classNames.map((arg) => {
11390
- if (isSerializedStyles(arg)) {
11391
- insertStyles(cache, arg, false);
11392
- return `${cache.key}-${arg.name}`;
11393
- }
11394
- return arg;
11395
- }));
11396
- }, [cache]);
11397
- };
11398
- //#endregion
11399
- //#region ../../../node_modules/.pnpm/memize@2.1.1/node_modules/memize/dist/index.js
9951
+ (0, react.memo)(BaseContextSystemProvider);
9952
+ // ../../../node_modules/.pnpm/@wordpress+components@43.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_401cb4bad47bd1f7b56615ff574f0485/node_modules/@wordpress/components/build-module/context/constants.mjs
9953
+ var COMPONENT_NAMESPACE = "data-wp-component";
9954
+ var CONNECTED_NAMESPACE = "data-wp-c16t";
9955
+ var CONNECT_STATIC_NAMESPACE = "__contextSystemKey__";
9956
+ // ../../../node_modules/.pnpm/memize@2.1.1/node_modules/memize/dist/index.js
11400
9957
  /**
11401
9958
  * Memize options object.
11402
9959
  *
@@ -11486,94 +10043,18 @@ function memize(fn, options) {
11486
10043
  };
11487
10044
  return memoized;
11488
10045
  }
11489
- //#endregion
11490
- //#region ../../../node_modules/.pnpm/@wordpress+components@42.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_6d0393a58a031b78f608040e2ecbe6e0/node_modules/@wordpress/components/build-module/context/context-system-provider.mjs
11491
- var import_es6 = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
11492
- module.exports = function equal(a, b) {
11493
- if (a === b) return true;
11494
- if (a && b && typeof a == "object" && typeof b == "object") {
11495
- if (a.constructor !== b.constructor) return false;
11496
- var length, i, keys;
11497
- if (Array.isArray(a)) {
11498
- length = a.length;
11499
- if (length != b.length) return false;
11500
- for (i = length; i-- !== 0;) if (!equal(a[i], b[i])) return false;
11501
- return true;
11502
- }
11503
- if (a instanceof Map && b instanceof Map) {
11504
- if (a.size !== b.size) return false;
11505
- for (i of a.entries()) if (!b.has(i[0])) return false;
11506
- for (i of a.entries()) if (!equal(i[1], b.get(i[0]))) return false;
11507
- return true;
11508
- }
11509
- if (a instanceof Set && b instanceof Set) {
11510
- if (a.size !== b.size) return false;
11511
- for (i of a.entries()) if (!b.has(i[0])) return false;
11512
- return true;
11513
- }
11514
- if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
11515
- length = a.length;
11516
- if (length != b.length) return false;
11517
- for (i = length; i-- !== 0;) if (a[i] !== b[i]) return false;
11518
- return true;
11519
- }
11520
- if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
11521
- if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
11522
- if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
11523
- keys = Object.keys(a);
11524
- length = keys.length;
11525
- if (length !== Object.keys(b).length) return false;
11526
- for (i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
11527
- for (i = length; i-- !== 0;) {
11528
- var key = keys[i];
11529
- if (!equal(a[key], b[key])) return false;
11530
- }
11531
- return true;
11532
- }
11533
- return a !== a && b !== b;
11534
- };
11535
- })))(), 1);
11536
- var ComponentsContext = (0, react.createContext)({});
11537
- ComponentsContext.displayName = "ComponentsContext";
11538
- var useComponentsContext = () => (0, react.useContext)(ComponentsContext);
11539
- function useContextSystemBridge({ value }) {
11540
- const parentContext = useComponentsContext();
11541
- const valueRef = (0, react.useRef)(value);
11542
- use_update_effect_default(() => {
11543
- if ((0, import_es6.default)(valueRef.current, value) && valueRef.current !== value) globalThis.SCRIPT_DEBUG === true && warning(`Please memoize your context: ${JSON.stringify(value)}`);
11544
- }, [value]);
11545
- return (0, react.useMemo)(() => {
11546
- return (0, deepmerge.default)(parentContext ?? {}, value ?? {}, { isMergeableObject: isPlainObject });
11547
- }, [parentContext, value]);
11548
- }
11549
- var BaseContextSystemProvider = ({ children, value }) => {
11550
- const contextValue = useContextSystemBridge({ value });
11551
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentsContext.Provider, {
11552
- value: contextValue,
11553
- children
11554
- });
11555
- };
11556
- (0, react.memo)(BaseContextSystemProvider);
11557
- //#endregion
11558
- //#region ../../../node_modules/.pnpm/@wordpress+components@42.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_6d0393a58a031b78f608040e2ecbe6e0/node_modules/@wordpress/components/build-module/context/constants.mjs
11559
- var COMPONENT_NAMESPACE = "data-wp-component";
11560
- var CONNECTED_NAMESPACE = "data-wp-c16t";
11561
- var CONNECT_STATIC_NAMESPACE = "__contextSystemKey__";
11562
- //#endregion
11563
- //#region ../../../node_modules/.pnpm/@wordpress+components@42.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_6d0393a58a031b78f608040e2ecbe6e0/node_modules/@wordpress/components/build-module/context/get-styled-class-name-from-key.mjs
11564
- var import_dist = require_dist();
10046
+ // ../../../node_modules/.pnpm/@wordpress+components@43.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_401cb4bad47bd1f7b56615ff574f0485/node_modules/@wordpress/components/build-module/context/get-styled-class-name-from-key.mjs
11565
10047
  function getStyledClassName(namespace) {
11566
- return `components-${(0, import_dist.paramCase)(namespace)}`;
10048
+ return `components-${namespace.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/([A-Z])([A-Z][a-z])/g, "$1-$2").replace(/[^A-Z0-9]+/gi, "-").replace(/^-|-$/g, "").toLowerCase()}`;
11567
10049
  }
11568
10050
  var getStyledClassNameFromKey = memize(getStyledClassName);
11569
- //#endregion
11570
- //#region ../../../node_modules/.pnpm/@wordpress+components@42.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_6d0393a58a031b78f608040e2ecbe6e0/node_modules/@wordpress/components/build-module/context/context-connect.mjs
10051
+ // ../../../node_modules/.pnpm/@wordpress+components@43.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_401cb4bad47bd1f7b56615ff574f0485/node_modules/@wordpress/components/build-module/context/context-connect.mjs
11571
10052
  function contextConnect(Component, namespace) {
11572
10053
  return _contextConnect(Component, namespace, { forwardsRef: true });
11573
10054
  }
11574
10055
  function _contextConnect(Component, namespace, options) {
11575
10056
  const WrappedComponent = options?.forwardsRef ? (0, react.forwardRef)(Component) : Component;
11576
- if (typeof namespace === "undefined") globalThis.SCRIPT_DEBUG === true && warning("contextConnect: Please provide a namespace");
10057
+ if (typeof namespace === "undefined") warning("contextConnect: Please provide a namespace");
11577
10058
  let mergedNamespace = WrappedComponent["__contextSystemKey__"] || [namespace];
11578
10059
  if (Array.isArray(namespace)) mergedNamespace = [...mergedNamespace, ...namespace];
11579
10060
  if (typeof namespace === "string") mergedNamespace = [...mergedNamespace, namespace];
@@ -11583,19 +10064,17 @@ function _contextConnect(Component, namespace, options) {
11583
10064
  selector: `.${getStyledClassNameFromKey(namespace)}`
11584
10065
  });
11585
10066
  }
11586
- //#endregion
11587
- //#region ../../../node_modules/.pnpm/@wordpress+components@42.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_6d0393a58a031b78f608040e2ecbe6e0/node_modules/@wordpress/components/build-module/context/utils.mjs
10067
+ // ../../../node_modules/.pnpm/@wordpress+components@43.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_401cb4bad47bd1f7b56615ff574f0485/node_modules/@wordpress/components/build-module/context/utils.mjs
11588
10068
  function getNamespace(componentName) {
11589
10069
  return { [COMPONENT_NAMESPACE]: componentName };
11590
10070
  }
11591
10071
  function getConnectedNamespace() {
11592
10072
  return { [CONNECTED_NAMESPACE]: true };
11593
10073
  }
11594
- //#endregion
11595
- //#region ../../../node_modules/.pnpm/@wordpress+components@42.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_6d0393a58a031b78f608040e2ecbe6e0/node_modules/@wordpress/components/build-module/context/use-context-system.mjs
10074
+ // ../../../node_modules/.pnpm/@wordpress+components@43.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_401cb4bad47bd1f7b56615ff574f0485/node_modules/@wordpress/components/build-module/context/use-context-system.mjs
11596
10075
  function useContextSystem(props, namespace) {
11597
10076
  const contextSystemProps = useComponentsContext();
11598
- if (typeof namespace === "undefined") globalThis.SCRIPT_DEBUG === true && warning("useContextSystem: Please provide a namespace");
10077
+ if (typeof namespace === "undefined") warning("useContextSystem: Please provide a namespace");
11599
10078
  const contextProps = contextSystemProps?.[namespace] || {};
11600
10079
  const finalComponentProps = {
11601
10080
  ...getConnectedNamespace(),
@@ -11605,7 +10084,7 @@ function useContextSystem(props, namespace) {
11605
10084
  const overrideProps = _overrides;
11606
10085
  const initialMergedProps = Object.entries(otherContextProps).length ? Object.assign({}, otherContextProps, props) : props;
11607
10086
  const propsWithChildren = initialMergedProps;
11608
- const classes = useCx()(getStyledClassNameFromKey(namespace), props.className);
10087
+ const classes = (0, clsx.default)(getStyledClassNameFromKey(namespace), props.className);
11609
10088
  const rendered = typeof propsWithChildren.renderChildren === "function" ? propsWithChildren.renderChildren(initialMergedProps) : propsWithChildren.children;
11610
10089
  for (const key in initialMergedProps) finalComponentProps[key] = initialMergedProps[key];
11611
10090
  for (const key in overrideProps) finalComponentProps[key] = overrideProps[key];
@@ -11613,8 +10092,7 @@ function useContextSystem(props, namespace) {
11613
10092
  finalComponentProps.className = classes;
11614
10093
  return finalComponentProps;
11615
10094
  }
11616
- //#endregion
11617
- //#region ../../../node_modules/.pnpm/@wordpress+components@42.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_6d0393a58a031b78f608040e2ecbe6e0/node_modules/@wordpress/components/build-module/visually-hidden/styles.mjs
10095
+ // ../../../node_modules/.pnpm/@wordpress+components@43.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_401cb4bad47bd1f7b56615ff574f0485/node_modules/@wordpress/components/build-module/visually-hidden/styles.mjs
11618
10096
  var visuallyHidden = {
11619
10097
  border: 0,
11620
10098
  clip: "rect(1px, 1px, 1px, 1px)",
@@ -11629,8 +10107,7 @@ var visuallyHidden = {
11629
10107
  wordWrap: "normal",
11630
10108
  wordBreak: "normal"
11631
10109
  };
11632
- //#endregion
11633
- //#region ../../../node_modules/.pnpm/@wordpress+components@42.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_6d0393a58a031b78f608040e2ecbe6e0/node_modules/@wordpress/components/build-module/utils/polymorphic-element.mjs
10110
+ // ../../../node_modules/.pnpm/@wordpress+components@43.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_401cb4bad47bd1f7b56615ff574f0485/node_modules/@wordpress/components/build-module/utils/polymorphic-element.mjs
11634
10111
  var customAttributeRegExp = /^(data|aria|x)-/i;
11635
10112
  var eventHandlerRegExp = /^on[A-Z]/;
11636
10113
  var svgElementNames = new Set(`animate animateMotion animateTransform circle clipPath defs desc ellipse
@@ -11719,8 +10196,7 @@ function UnforwardedPolymorphicElement({ as, ...props }, ref) {
11719
10196
  });
11720
10197
  }
11721
10198
  var PolymorphicElement = (0, react.forwardRef)(UnforwardedPolymorphicElement);
11722
- //#endregion
11723
- //#region ../../../node_modules/.pnpm/@wordpress+components@42.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_6d0393a58a031b78f608040e2ecbe6e0/node_modules/@wordpress/components/build-module/view/component.mjs
10199
+ // ../../../node_modules/.pnpm/@wordpress+components@43.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_401cb4bad47bd1f7b56615ff574f0485/node_modules/@wordpress/components/build-module/view/component.mjs
11724
10200
  function UnforwardedView({ css, ...restProps }, ref) {
11725
10201
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PolymorphicElement, {
11726
10202
  ref,
@@ -11728,8 +10204,7 @@ function UnforwardedView({ css, ...restProps }, ref) {
11728
10204
  });
11729
10205
  }
11730
10206
  var component_default$2 = Object.assign((0, react.forwardRef)(UnforwardedView), { selector: ".components-view" });
11731
- //#endregion
11732
- //#region ../../../node_modules/.pnpm/@wordpress+components@42.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_6d0393a58a031b78f608040e2ecbe6e0/node_modules/@wordpress/components/build-module/visually-hidden/component.mjs
10207
+ // ../../../node_modules/.pnpm/@wordpress+components@43.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_401cb4bad47bd1f7b56615ff574f0485/node_modules/@wordpress/components/build-module/visually-hidden/component.mjs
11733
10208
  function UnconnectedVisuallyHidden(props, forwardedRef) {
11734
10209
  const { style: styleProp, ...contextProps } = useContextSystem(props, "VisuallyHidden");
11735
10210
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(component_default$2, {
@@ -11743,8 +10218,7 @@ function UnconnectedVisuallyHidden(props, forwardedRef) {
11743
10218
  });
11744
10219
  }
11745
10220
  var component_default$1 = contextConnect(UnconnectedVisuallyHidden, "VisuallyHidden");
11746
- //#endregion
11747
- //#region ../../../node_modules/.pnpm/@wordpress+components@42.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_6d0393a58a031b78f608040e2ecbe6e0/node_modules/@wordpress/components/build-module/utils/use-responsive-value.mjs
10221
+ // ../../../node_modules/.pnpm/@wordpress+components@43.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_401cb4bad47bd1f7b56615ff574f0485/node_modules/@wordpress/components/build-module/utils/use-responsive-value.mjs
11748
10222
  var breakpoints = [
11749
10223
  "40em",
11750
10224
  "52em",
@@ -11782,16 +10256,15 @@ function useResponsiveValue(values, options = {}) {
11782
10256
  const array = values || [];
11783
10257
  return array[index >= array.length ? array.length - 1 : index];
11784
10258
  }
11785
- //#endregion
11786
- //#region ../../../node_modules/.pnpm/@wordpress+components@42.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_6d0393a58a031b78f608040e2ecbe6e0/node_modules/@wordpress/components/build-module/grid/utils.mjs
10259
+ // ../../../node_modules/.pnpm/@wordpress+components@43.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_401cb4bad47bd1f7b56615ff574f0485/node_modules/@wordpress/components/build-module/grid/utils.mjs
11787
10260
  var ALIGNMENTS = {
11788
10261
  bottom: {
11789
10262
  alignItems: "flex-end",
11790
10263
  justifyContent: "center"
11791
10264
  },
11792
10265
  bottomLeft: {
11793
- alignItems: "flex-start",
11794
- justifyContent: "flex-end"
10266
+ alignItems: "flex-end",
10267
+ justifyContent: "flex-start"
11795
10268
  },
11796
10269
  bottomRight: {
11797
10270
  alignItems: "flex-end",
@@ -11830,8 +10303,7 @@ var ALIGNMENTS = {
11830
10303
  function getAlignmentProps(alignment) {
11831
10304
  return alignment ? ALIGNMENTS[alignment] ?? {} : {};
11832
10305
  }
11833
- //#endregion
11834
- //#region ../../../node_modules/.pnpm/@wordpress+components@42.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_6d0393a58a031b78f608040e2ecbe6e0/node_modules/@wordpress/components/build-module/grid/hook.mjs
10306
+ // ../../../node_modules/.pnpm/@wordpress+components@43.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_401cb4bad47bd1f7b56615ff574f0485/node_modules/@wordpress/components/build-module/grid/hook.mjs
11835
10307
  var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
11836
10308
  function getRuntime() {
11837
10309
  const globalScope = globalThis;
@@ -11975,8 +10447,7 @@ function useGrid(props) {
11975
10447
  }
11976
10448
  };
11977
10449
  }
11978
- //#endregion
11979
- //#region ../../../node_modules/.pnpm/@wordpress+components@42.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_6d0393a58a031b78f608040e2ecbe6e0/node_modules/@wordpress/components/build-module/grid/component.mjs
10450
+ // ../../../node_modules/.pnpm/@wordpress+components@43.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_401cb4bad47bd1f7b56615ff574f0485/node_modules/@wordpress/components/build-module/grid/component.mjs
11980
10451
  function UnconnectedGrid(props, forwardedRef) {
11981
10452
  const gridProps = useGrid(props);
11982
10453
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(component_default$2, {
@@ -11985,8 +10456,7 @@ function UnconnectedGrid(props, forwardedRef) {
11985
10456
  });
11986
10457
  }
11987
10458
  var component_default = contextConnect(UnconnectedGrid, "Grid");
11988
- //#endregion
11989
- //#region src/charts/leaderboard-chart/hooks/use-fitted-row-count.ts
10459
+ // src/charts/leaderboard-chart/hooks/use-fitted-row-count.ts
11990
10460
  /**
11991
10461
  * Fractional layout rounding can put a row's bottom a hair past the container's
11992
10462
  * without any visible clipping. Allow that much slack before hiding a row.
@@ -12069,8 +10539,7 @@ function useFittedRowCount(enabled, rowCount, data) {
12069
10539
  isMeasurable
12070
10540
  };
12071
10541
  }
12072
- //#endregion
12073
- //#region src/charts/leaderboard-chart/hooks/use-leaderboard-legend-items.ts
10542
+ // src/charts/leaderboard-chart/hooks/use-leaderboard-legend-items.ts
12074
10543
  /**
12075
10544
  * Hook to create legend items from leaderboard data
12076
10545
  * @param root0 - Configuration object
@@ -12118,11 +10587,12 @@ function useLeaderboardLegendItems({ data, primaryColor, secondaryColor, withCom
12118
10587
  withOverlayLabel
12119
10588
  ]);
12120
10589
  }
12121
- //#endregion
12122
- //#region src/charts/leaderboard-chart/leaderboard-chart.module.scss
10590
+ // src/charts/leaderboard-chart/leaderboard-chart.module.scss
12123
10591
  var leaderboard_chart_module_default = {
12124
10592
  "bar": "a8ccharts-GovfoW-bar",
12125
10593
  "bar--animated": "a8ccharts-GovfoW-bar--animated",
10594
+ "bar--negative": "a8ccharts-GovfoW-bar--negative",
10595
+ "barTrack": "a8ccharts-GovfoW-barTrack",
12126
10596
  "barWithLabelContainer": "a8ccharts-GovfoW-barWithLabelContainer",
12127
10597
  "chevron": "a8ccharts-GovfoW-chevron",
12128
10598
  "deltaPlaceholder": "a8ccharts-GovfoW-deltaPlaceholder",
@@ -12149,8 +10619,42 @@ var leaderboard_chart_module_default = {
12149
10619
  "stretch": "a8ccharts-GovfoW-stretch",
12150
10620
  "valueContainer": "a8ccharts-GovfoW-valueContainer"
12151
10621
  };
12152
- //#endregion
12153
- //#region src/charts/leaderboard-chart/leaderboard-chart.tsx
10622
+ // src/charts/leaderboard-chart/private/resolve-leaderboard-entries.ts
10623
+ const toShare = (value, max) => max === 0 ? 0 : value / max * 100;
10624
+ const toDelta = (currentValue, previousValue) => {
10625
+ if (previousValue == null) return;
10626
+ if (previousValue === 0) return currentValue === 0 ? 0 : void 0;
10627
+ return (currentValue - previousValue) / Math.abs(previousValue) * 100;
10628
+ };
10629
+ /**
10630
+ * Fills in the shares and delta an entry omits, derived from its values.
10631
+ *
10632
+ * @param data - Leaderboard entries; passed shares and delta win over derived ones.
10633
+ * @param options - Resolver options.
10634
+ * @param options.includePrevious - Whether previous values count toward the shared max.
10635
+ * @param options.clampNegative - Whether a negative share draws as an empty bar instead of below zero.
10636
+ * @return Entries with `currentShare` always set.
10637
+ */
10638
+ function resolveLeaderboardEntries(data, { includePrevious, clampNegative = false }) {
10639
+ const magnitude = clampNegative ? (value) => Math.max(value, 0) : Math.abs;
10640
+ const clamp = (share) => clampNegative ? Math.max(share, 0) : share;
10641
+ const max = data.reduce((largest, { currentValue, previousValue }) => {
10642
+ const previous = includePrevious && previousValue != null ? magnitude(previousValue) : 0;
10643
+ return Math.max(largest, magnitude(currentValue), previous);
10644
+ }, 0);
10645
+ return data.map((entry) => {
10646
+ const passedOrDerivedPrevious = entry.previousShare ?? (entry.previousValue != null ? toShare(entry.previousValue, max) : void 0);
10647
+ const previousShare = passedOrDerivedPrevious !== void 0 ? clamp(passedOrDerivedPrevious) : void 0;
10648
+ const delta = entry.delta ?? toDelta(entry.currentValue, entry.previousValue);
10649
+ return {
10650
+ ...entry,
10651
+ currentShare: clamp(entry.currentShare ?? toShare(entry.currentValue, max)),
10652
+ ...previousShare !== void 0 && { previousShare },
10653
+ ...delta !== void 0 && { delta }
10654
+ };
10655
+ });
10656
+ }
10657
+ // src/charts/leaderboard-chart/leaderboard-chart.tsx
12154
10658
  const ROW_GAP = "var(--a8c-charts-dimension-leaderboard-row-gap, 12px)";
12155
10659
  const COLUMN_GAP = "var(--a8c-charts-dimension-leaderboard-column-gap, 4px)";
12156
10660
  /** Indexed by `Math.sign( delta ) + 1`, so [negative, neutral, positive]. */
@@ -12210,27 +10714,43 @@ const BarLabel = ({ label }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react
12210
10714
  className: leaderboard_chart_module_default.label,
12211
10715
  children: label
12212
10716
  }) : label });
12213
- const BarWithLabel = ({ entry, withComparison, withOverlayLabel, primaryColor, secondaryColor, animation, isPrimaryVisible = true, isComparisonVisible = true }) => {
10717
+ const Bar = ({ share, color, animation, divergingScale }) => {
10718
+ const isNegative = share < 0;
10719
+ const sideMax = divergingScale?.[isNegative ? "negative" : "positive"];
10720
+ const width = sideMax ? Math.abs(share) / sideMax * 100 : Math.abs(share);
10721
+ const bar = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
10722
+ className: (0, clsx.default)(leaderboard_chart_module_default.bar, {
10723
+ [leaderboard_chart_module_default["bar--animated"]]: animation,
10724
+ [leaderboard_chart_module_default["bar--negative"]]: divergingScale && isNegative
10725
+ }),
10726
+ style: {
10727
+ width: getBarWidth(width),
10728
+ backgroundColor: color
10729
+ }
10730
+ });
10731
+ if (!divergingScale) return bar;
10732
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
10733
+ className: leaderboard_chart_module_default.barTrack,
10734
+ style: { gridTemplateColumns: `${divergingScale.negative}fr ${divergingScale.positive}fr` },
10735
+ children: bar
10736
+ });
10737
+ };
10738
+ const BarWithLabel = ({ entry, withComparison, withOverlayLabel, primaryColor, secondaryColor, animation, divergingScale, isPrimaryVisible = true, isComparisonVisible = true }) => {
12214
10739
  const showComparisonBar = withComparison && !withOverlayLabel && isComparisonVisible;
10740
+ const bars = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [isPrimaryVisible && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Bar, {
10741
+ share: entry.currentShare,
10742
+ color: primaryColor,
10743
+ animation,
10744
+ divergingScale
10745
+ }), showComparisonBar && hasPreviousValue(entry) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Bar, {
10746
+ share: entry.previousShare,
10747
+ color: secondaryColor,
10748
+ animation,
10749
+ divergingScale
10750
+ })] });
12215
10751
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
12216
10752
  className: (0, clsx.default)(leaderboard_chart_module_default.barWithLabelContainer, { [leaderboard_chart_module_default["is-overlay"]]: withOverlayLabel }),
12217
- children: [
12218
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BarLabel, { label: entry.label }),
12219
- isPrimaryVisible && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
12220
- className: (0, clsx.default)(leaderboard_chart_module_default.bar, { [leaderboard_chart_module_default["bar--animated"]]: animation }),
12221
- style: {
12222
- width: getBarWidth(entry.currentShare),
12223
- backgroundColor: primaryColor
12224
- }
12225
- }),
12226
- showComparisonBar && hasPreviousValue(entry) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
12227
- className: (0, clsx.default)(leaderboard_chart_module_default.bar, { [leaderboard_chart_module_default["bar--animated"]]: animation }),
12228
- style: {
12229
- width: getBarWidth(entry.previousShare),
12230
- backgroundColor: secondaryColor
12231
- }
12232
- })
12233
- ]
10753
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(BarLabel, { label: entry.label }), bars]
12234
10754
  });
12235
10755
  };
12236
10756
  /**
@@ -12244,6 +10764,7 @@ const BarWithLabel = ({ entry, withComparison, withOverlayLabel, primaryColor, s
12244
10764
  * @param props.height - Optional height of the chart container in pixels
12245
10765
  * @param props.withComparison - Whether to show comparison data
12246
10766
  * @param props.withOverlayLabel - Whether to overlay the label on top of the bar
10767
+ * @param props.negativeBars - How a negative value draws: from a shared zero point, or as an empty bar
12247
10768
  * @param props.primaryColor - Primary color for current period bars
12248
10769
  * @param props.secondaryColor - Secondary color for comparison period bars
12249
10770
  * @param props.valueFormatter - Custom formatter for values
@@ -12261,7 +10782,7 @@ const BarWithLabel = ({ entry, withComparison, withOverlayLabel, primaryColor, s
12261
10782
  * @param props.ariaLabel - Accessible name for the list, defaulting to "Leaderboard chart"
12262
10783
  * @return JSX element representing the leaderboard chart
12263
10784
  */
12264
- const LeaderboardChartInternal = ({ data, chartId: providedChartId, width: propWidth, height: propHeight, withComparison = false, withOverlayLabel = false, primaryColor, secondaryColor, valueFormatter = defaultValueFormatter, deltaFormatter = defaultDeltaFormatter, animation, loading = false, fitRows = false, showLegend = false, legend = {}, legendLabels, gap = "md", ariaLabel, className, style, children }) => {
10785
+ const LeaderboardChartInternal = ({ data, chartId: providedChartId, width: propWidth, height: propHeight, withComparison = false, withOverlayLabel = false, negativeBars = "diverge", primaryColor, secondaryColor, valueFormatter = defaultValueFormatter, deltaFormatter = defaultDeltaFormatter, animation, loading = false, fitRows = false, showLegend = false, legend = {}, legendLabels, gap = "md", ariaLabel, className, style, children }) => {
12265
10786
  const legendInteractive = legend.interactive ?? false;
12266
10787
  const legendPosition = legend.position ?? "bottom";
12267
10788
  const chartId = useChartId(providedChartId);
@@ -12315,6 +10836,30 @@ const LeaderboardChartInternal = ({ data, chartId: providedChartId, width: propW
12315
10836
  withComparison,
12316
10837
  withOverlayLabel
12317
10838
  ]);
10839
+ const withComparisonBars = withComparison && !withOverlayLabel;
10840
+ const resolvedData = (0, react.useMemo)(() => resolveLeaderboardEntries(data ?? [], {
10841
+ includePrevious: withComparisonBars,
10842
+ clampNegative: negativeBars === "clamp"
10843
+ }), [
10844
+ data,
10845
+ withComparisonBars,
10846
+ negativeBars
10847
+ ]);
10848
+ const divergingScale = (0, react.useMemo)(() => {
10849
+ const scale = {
10850
+ negative: 0,
10851
+ positive: 0
10852
+ };
10853
+ for (const entry of resolvedData) {
10854
+ const shares = [entry.currentShare];
10855
+ if (withComparisonBars && hasPreviousValue(entry)) shares.push(entry.previousShare);
10856
+ for (const share of shares) {
10857
+ const side = share < 0 ? "negative" : "positive";
10858
+ scale[side] = Math.max(scale[side], Math.abs(share));
10859
+ }
10860
+ }
10861
+ return scale.negative > 0 ? scale : void 0;
10862
+ }, [resolvedData, withComparisonBars]);
12318
10863
  const isDataValid = Boolean(data && data.length > 0);
12319
10864
  const chartMetadata = (0, react.useMemo)(() => ({
12320
10865
  withComparison,
@@ -12330,6 +10875,8 @@ const LeaderboardChartInternal = ({ data, chartId: providedChartId, width: propW
12330
10875
  const prefersReducedMotion = usePrefersReducedMotion();
12331
10876
  const { contentRef, fittedCount, isMeasurable } = useFittedRowCount(fitRows && !allSeriesHidden, data?.length ?? 0, data);
12332
10877
  const shouldFitRows = fitRows && isMeasurable;
10878
+ const showComparisonColumn = withComparison && isComparisonVisible;
10879
+ const templateColumns = showComparisonColumn && isPrimaryVisible ? "minmax(0, 1fr) auto auto" : "minmax(0, 1fr) auto";
12333
10880
  if (!data || data.length === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChartInstanceContext.Provider, {
12334
10881
  value: { chartId },
12335
10882
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChartLayout, {
@@ -12394,13 +10941,12 @@ const LeaderboardChartInternal = ({ data, chartId: providedChartId, width: propW
12394
10941
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(component_default, {
12395
10942
  role: "list",
12396
10943
  "aria-label": ariaLabel ?? (0, _wordpress_i18n.__)("Leaderboard chart", "jetpack-charts"),
12397
- templateColumns: "minmax(0, 1fr) auto",
10944
+ templateColumns,
12398
10945
  rowGap: ROW_GAP,
12399
10946
  columnGap: COLUMN_GAP,
12400
10947
  "data-leaderboard-grid": true,
12401
- children: data.map((entry, rowIndex) => {
10948
+ children: resolvedData.map((entry, rowIndex) => {
12402
10949
  const rowStyle = shouldFitRows && rowIndex >= fittedCount ? { visibility: "hidden" } : void 0;
12403
- const showComparisonColumn = withComparison && isComparisonVisible;
12404
10950
  const hasPreviousPeriodValue = hasPreviousValue(entry);
12405
10951
  const hasDelta = hasDeltaValue(entry);
12406
10952
  const showComparisonValue = showComparisonColumn && hasDelta;
@@ -12415,13 +10961,12 @@ const LeaderboardChartInternal = ({ data, chartId: providedChartId, width: propW
12415
10961
  withOverlayLabel,
12416
10962
  primaryColor: resolvedPrimaryColor,
12417
10963
  secondaryColor: resolvedSecondaryColor,
10964
+ divergingScale,
12418
10965
  isPrimaryVisible,
12419
10966
  isComparisonVisible,
12420
10967
  animation: animation && !loading && !prefersReducedMotion
12421
10968
  })
12422
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_wordpress_ui.Stack, {
12423
- direction: "row",
12424
- gap: "xs",
10969
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
12425
10970
  className: (0, clsx.default)(leaderboard_chart_module_default.valueContainer, { [leaderboard_chart_module_default.overlayLabel]: withOverlayLabel }),
12426
10971
  children: [
12427
10972
  isPrimaryVisible && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_ui.Text, { children: valueFormatter(entry.currentValue) }),
@@ -12502,8 +11047,7 @@ const LeaderboardChartWithProvider = (props) => {
12502
11047
  LeaderboardChartWithProvider.displayName = "LeaderboardChart";
12503
11048
  const LeaderboardChart = attachSubComponents(LeaderboardChartWithProvider, { Legend });
12504
11049
  const LeaderboardChartResponsive = attachSubComponents(withResponsive(LeaderboardChartWithProvider), { Legend });
12505
- //#endregion
12506
- //#region src/charts/private/pie-keyboard-navigation/order-arcs-for-navigation.ts
11050
+ // src/charts/private/pie-keyboard-navigation/order-arcs-for-navigation.ts
12507
11051
  /**
12508
11052
  * Orders arcs the way they appear: clockwise from 12 o'clock, which for a semi-circle is left to right.
12509
11053
  *
@@ -12511,15 +11055,13 @@ const LeaderboardChartResponsive = attachSubComponents(withResponsive(Leaderboar
12511
11055
  * @return A copy of `arcs` sorted by angular midpoint.
12512
11056
  */
12513
11057
  const orderArcsForNavigation = (arcs) => [...arcs].sort((a, b) => a.startAngle + a.endAngle - (b.startAngle + b.endAngle));
12514
- //#endregion
12515
- //#region src/charts/private/pie-keyboard-navigation/pie-selection-announcement.tsx
11058
+ // src/charts/private/pie-keyboard-navigation/pie-selection-announcement.tsx
12516
11059
  const PieSelectionAnnouncement = ({ data }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_ui.VisuallyHidden, {
12517
11060
  role: "status",
12518
11061
  "aria-atomic": "true",
12519
11062
  children: data && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LabelValueContent, { data })
12520
11063
  });
12521
- //#endregion
12522
- //#region src/charts/private/pie-keyboard-navigation/pie-tooltip.tsx
11064
+ // src/charts/private/pie-keyboard-navigation/pie-tooltip.tsx
12523
11065
  const TOOLTIP_BOX_STYLE = { zIndex: 3 };
12524
11066
  const PieTooltip = ({ top, left, selectedIndex, tooltipRef, children }) => {
12525
11067
  const standaloneScopeClass = useStandaloneScopeClass();
@@ -12541,8 +11083,7 @@ const PieTooltip = ({ top, left, selectedIndex, tooltipRef, children }) => {
12541
11083
  }, `chart-tooltip-${selectedIndex}`)
12542
11084
  });
12543
11085
  };
12544
- //#endregion
12545
- //#region src/charts/private/pie-keyboard-navigation/pie-selection-output.tsx
11086
+ // src/charts/private/pie-keyboard-navigation/pie-selection-output.tsx
12546
11087
  /**
12547
11088
  * Reports the selected segment: a focused tooltip for a keyboard selection, a pointer tooltip on hover, or a screen reader announcement without tooltips.
12548
11089
  *
@@ -12582,8 +11123,7 @@ const PieSelectionOutput = ({ withTooltips, selectedIndex, selectedData, keyboar
12582
11123
  })
12583
11124
  ] });
12584
11125
  };
12585
- //#endregion
12586
- //#region src/charts/private/pie-keyboard-navigation/use-pie-keyboard-navigation.ts
11126
+ // src/charts/private/pie-keyboard-navigation/use-pie-keyboard-navigation.ts
12587
11127
  const usePieKeyboardNavigation = ({ navigationArcs, withTooltips, tooltipOffsetX, tooltipOffsetY }) => {
12588
11128
  const chartRef = (0, react.useRef)(null);
12589
11129
  const svgRef = (0, react.useRef)(null);
@@ -12663,8 +11203,7 @@ const usePieKeyboardNavigation = ({ navigationArcs, withTooltips, tooltipOffsetX
12663
11203
  }
12664
11204
  };
12665
11205
  };
12666
- //#endregion
12667
- //#region src/charts/private/radial-wipe-animation/radial-wipe-animation.tsx
11206
+ // src/charts/private/radial-wipe-animation/radial-wipe-animation.tsx
12668
11207
  /**
12669
11208
  * Renders a SVG mask that creates a radial wipe animation effect.
12670
11209
  *
@@ -12701,8 +11240,7 @@ function RadialWipeAnimation({ id, radius, innerRadius = 0, durationMs = 1e3, wi
12701
11240
  })
12702
11241
  });
12703
11242
  }
12704
- //#endregion
12705
- //#region src/charts/pie-chart/pie-chart.module.scss
11243
+ // src/charts/pie-chart/pie-chart.module.scss
12706
11244
  var pie_chart_module_default = {
12707
11245
  "pie-chart": "a8ccharts-gnszbG-pie-chart",
12708
11246
  "pie-chart__label-plate": "a8ccharts-gnszbG-pie-chart__label-plate",
@@ -12713,8 +11251,7 @@ var pie_chart_module_default = {
12713
11251
  "pie-chart__plot": "a8ccharts-gnszbG-pie-chart__plot",
12714
11252
  "pie-chart--responsive": "a8ccharts-gnszbG-pie-chart--responsive"
12715
11253
  };
12716
- //#endregion
12717
- //#region src/charts/pie-chart/pie-chart.tsx
11254
+ // src/charts/pie-chart/pie-chart.tsx
12718
11255
  /**
12719
11256
  * Default tooltip renderer for pie charts.
12720
11257
  * Renders the default `label: value` tooltip content for the hovered segment.
@@ -12997,8 +11534,7 @@ const PieChartResponsive = attachSubComponents(withResponsive(PieChartWithProvid
12997
11534
  SVG: ChartSVG,
12998
11535
  HTML: ChartHTML
12999
11536
  });
13000
- //#endregion
13001
- //#region src/charts/pie-semi-circle-chart/pie-semi-circle-chart.module.scss
11537
+ // src/charts/pie-semi-circle-chart/pie-semi-circle-chart.module.scss
13002
11538
  var pie_semi_circle_chart_module_default = {
13003
11539
  "label": "a8ccharts-YtTOxW-label",
13004
11540
  "note": "a8ccharts-YtTOxW-note",
@@ -13006,8 +11542,7 @@ var pie_semi_circle_chart_module_default = {
13006
11542
  "pie-semi-circle-chart__plot": "a8ccharts-YtTOxW-pie-semi-circle-chart__plot",
13007
11543
  "pie-semi-circle-chart--responsive": "a8ccharts-YtTOxW-pie-semi-circle-chart--responsive"
13008
11544
  };
13009
- //#endregion
13010
- //#region src/charts/pie-semi-circle-chart/pie-semi-circle-chart.tsx
11545
+ // src/charts/pie-semi-circle-chart/pie-semi-circle-chart.tsx
13011
11546
  /**
13012
11547
  * Default tooltip renderer for semi-circle pie charts.
13013
11548
  * Renders the default `label: value` tooltip content for the hovered segment.
@@ -13250,14 +11785,12 @@ const PieSemiCircleChartResponsive = attachSubComponents(withResponsive(PieSemiC
13250
11785
  SVG: ChartSVG,
13251
11786
  HTML: ChartHTML
13252
11787
  });
13253
- //#endregion
13254
- //#region src/charts/sparkline/sparkline.module.scss
11788
+ // src/charts/sparkline/sparkline.module.scss
13255
11789
  var sparkline_module_default = {
13256
11790
  "sparkline": "a8ccharts-GtgAVa-sparkline",
13257
11791
  "sparkline--empty": "a8ccharts-GtgAVa-sparkline--empty"
13258
11792
  };
13259
- //#endregion
13260
- //#region src/charts/sparkline/sparkline.tsx
11793
+ // src/charts/sparkline/sparkline.tsx
13261
11794
  const DEFAULT_WIDTH = 100;
13262
11795
  const DEFAULT_HEIGHT = 40;
13263
11796
  /**
@@ -13399,8 +11932,7 @@ SparklineUnresponsive.displayName = "SparklineUnresponsive";
13399
11932
  * Responsive Sparkline chart component
13400
11933
  */
13401
11934
  const Sparkline = withResponsive(SparklineUnresponsive);
13402
- //#endregion
13403
- //#region src/components/trend-indicator/trend-indicator.module.scss
11935
+ // src/components/trend-indicator/trend-indicator.module.scss
13404
11936
  var trend_indicator_module_default = {
13405
11937
  "trend-indicator": "a8ccharts-zR7F7G-trend-indicator",
13406
11938
  "trend-indicator__icon": "a8ccharts-zR7F7G-trend-indicator__icon",
@@ -13409,8 +11941,7 @@ var trend_indicator_module_default = {
13409
11941
  "trend-indicator--neutral": "a8ccharts-zR7F7G-trend-indicator--neutral",
13410
11942
  "trend-indicator--up": "a8ccharts-zR7F7G-trend-indicator--up"
13411
11943
  };
13412
- //#endregion
13413
- //#region src/components/trend-indicator/trend-indicator.tsx
11944
+ // src/components/trend-indicator/trend-indicator.tsx
13414
11945
  const DIRECTION_LABELS = {
13415
11946
  up: "Increase",
13416
11947
  down: "Decrease",
@@ -13453,7 +11984,6 @@ function TrendIndicator({ direction, value, className, style, showIcon = true })
13453
11984
  })]
13454
11985
  });
13455
11986
  }
13456
- //#endregion
13457
11987
  exports.AccessibleTooltip = AccessibleTooltip;
13458
11988
  exports.AreaChart = AreaChartResponsive;
13459
11989
  exports.AreaChartUnresponsive = AreaChart;