@automattic/charts 3.1.0 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["styles","useIsomorphicLayoutEffect","useLayoutEffect","useEffect","Fragment","Group","Stack","styles","styles","curveCatmullRom","curveLinear","curveMonotoneX","toNumber","DataContext","validateData","getScaleBandwidth","DataContext","formatNumberCompact","Text","Group","BarChartUnresponsive","DOMPurify","Stack","Text","styles","tslib_1","tslib_1","tslib_1","tslib_1","tslib_1","tslib_1","tslib_1","tslib_1","tslib_1","tslib_1","isBrowser","isBrowser","getRegisteredStyles","isDevelopment","unitless","asTemplateStringsArr","templateStringsArr","hashString","isBrowser","React","getRegisteredStyles","React","React","Emotion","css","merge","getRegisteredStyles","useEmotionCache","innerCx","warn","memoize","warn","warn","component_default","View","component_default","CONFIG","View","validateData","styles","Group","Pie","styles"],"sources":["../src/charts/private/chart-instance-context/chart-instance-context.ts","../src/charts/private/chart-instance-context/use-chart-instance-context.ts","../src/styles/chart-scope-class.ts","../src/utils/create-composition.ts","../src/utils/date-parsing.ts","../src/utils/format-metric-value.ts","../src/utils/format-percentage.ts","../src/utils/get-longest-tick-width.ts","../src/utils/get-styles.ts","../src/utils/is-safari.ts","../src/utils/merge-themes.ts","../src/utils/color-utils.ts","../src/utils/resolve-css-var.ts","../src/utils/resolve-font-size.ts","../src/providers/chart-scope/chart-scope-context.ts","../src/providers/chart-context/private/get-chart-color.ts","../src/providers/chart-context/private/theme-override-vars.ts","../src/providers/chart-context/themes.ts","../src/providers/chart-context/private/with-catalog-pointers.ts","../src/providers/chart-context/global-charts-provider.tsx","../src/providers/chart-context/hooks/use-global-charts-context.ts","../src/providers/chart-context/hooks/use-chart-id.ts","../../../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js","../src/hooks/use-deep-memo.ts","../src/providers/chart-scope/use-chart-scope-element.ts","../src/providers/chart-scope/use-standalone-scope-class.ts","../src/hooks/use-xychart-theme.ts","../src/hooks/use-chart-data-transform.ts","../src/hooks/use-chart-margin.tsx","../src/hooks/use-element-size.ts","../src/hooks/use-text-truncation.ts","../src/hooks/use-zero-value-display.ts","../src/hooks/use-data-with-percentages.ts","../src/hooks/use-legend-visibility-data.ts","../src/hooks/use-prefers-reduced-motion.ts","../src/providers/chart-context/hooks/use-chart-registration.ts","../src/providers/chart-context/hooks/use-global-charts-theme.ts","../src/components/legend/utils/value-or-identity.ts","../src/components/legend/utils/label-transform-factory.ts","../src/components/legend/private/base-legend.tsx","../src/components/legend/legend.tsx","../src/components/legend/hooks/use-chart-legend-items.ts","../src/components/tooltip/base-tooltip.tsx","../src/components/tooltip/accessible-tooltip.tsx","../src/providers/chart-context/hooks/use-default-hidden-series.ts","../src/charts/private/chart-composition/chart-svg.tsx","../src/charts/private/chart-composition/chart-html.tsx","../src/charts/private/chart-composition/render-legend-slot.ts","../src/charts/private/chart-composition/use-chart-children.ts","../src/charts/private/chart-layout/chart-layout.tsx","../src/charts/private/default-glyph/default-glyph.tsx","../src/charts/private/center/center.tsx","../src/charts/private/svg-empty-state/svg-empty-state.tsx","../src/charts/private/svg-empty-state/get-all-hidden-message.ts","../src/charts/private/time-axis.ts","../src/charts/private/with-responsive/with-responsive.tsx","../src/charts/private/x-zoom/x-zoom.tsx","../src/charts/line-chart/private/line-chart-annotation-label-popover.tsx","../src/charts/line-chart/private/line-chart-annotations-overlay.tsx","../src/charts/line-chart/private/line-chart-annotation.tsx","../src/charts/line-chart/private/line-chart-glyph.tsx","../src/charts/line-chart/line-chart.tsx","../src/charts/area-chart/private/validate-data.ts","../src/charts/area-chart/private/overlays.tsx","../src/charts/area-chart/area-chart.tsx","../src/charts/bar-chart/private/truncated-tick-component.tsx","../src/charts/bar-chart/private/use-bar-chart-options.ts","../src/charts/bar-chart/private/comparison-bars-geometry.ts","../src/charts/bar-chart/private/comparison-constants.ts","../src/charts/bar-chart/private/comparison-bars.tsx","../src/charts/bar-chart/bar-chart.tsx","../src/charts/bar-list-chart/bar-list-chart.tsx","../src/charts/conversion-funnel-chart/private/use-funnel-selection.ts","../src/charts/conversion-funnel-chart/conversion-funnel-chart.tsx","../src/utils/sanitize-html.ts","../src/charts/geo-chart/geo-chart.tsx","../src/types.ts","../src/charts/heatmap-chart/private/use-heatmap-colors.ts","../src/charts/heatmap-chart/private/build-calendar-data.ts","../src/charts/heatmap-chart/private/heatmap-context.ts","../src/charts/heatmap-chart/private/heatmap-legend.tsx","../src/charts/heatmap-chart/heatmap-chart.tsx","../../../../node_modules/.pnpm/is-plain-object@5.0.0/node_modules/is-plain-object/dist/is-plain-object.mjs","../../../../node_modules/.pnpm/lower-case@2.0.2/node_modules/lower-case/dist/index.js","../../../../node_modules/.pnpm/no-case@3.0.4/node_modules/no-case/dist/index.js","../../../../node_modules/.pnpm/pascal-case@3.1.2/node_modules/pascal-case/dist/index.js","../../../../node_modules/.pnpm/camel-case@4.1.2/node_modules/camel-case/dist/index.js","../../../../node_modules/.pnpm/upper-case-first@2.0.2/node_modules/upper-case-first/dist/index.js","../../../../node_modules/.pnpm/capital-case@1.0.4/node_modules/capital-case/dist/index.js","../../../../node_modules/.pnpm/upper-case@2.0.2/node_modules/upper-case/dist/index.js","../../../../node_modules/.pnpm/constant-case@3.0.4/node_modules/constant-case/dist/index.js","../../../../node_modules/.pnpm/dot-case@3.0.4/node_modules/dot-case/dist/index.js","../../../../node_modules/.pnpm/header-case@2.0.4/node_modules/header-case/dist/index.js","../../../../node_modules/.pnpm/param-case@3.0.4/node_modules/param-case/dist/index.js","../../../../node_modules/.pnpm/path-case@3.0.4/node_modules/path-case/dist/index.js","../../../../node_modules/.pnpm/sentence-case@3.0.4/node_modules/sentence-case/dist/index.js","../../../../node_modules/.pnpm/snake-case@3.0.4/node_modules/snake-case/dist/index.js","../../../../node_modules/.pnpm/change-case@4.1.2/node_modules/change-case/dist/index.js","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/hooks/use-update-effect.mjs","../../../../node_modules/.pnpm/@emotion+sheet@1.4.0/node_modules/@emotion/sheet/dist/emotion-sheet.esm.js","../../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Enum.js","../../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Utility.js","../../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Tokenizer.js","../../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Parser.js","../../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Serializer.js","../../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Middleware.js","../../../../node_modules/.pnpm/@emotion+weak-memoize@0.4.0/node_modules/@emotion/weak-memoize/dist/emotion-weak-memoize.esm.js","../../../../node_modules/.pnpm/@emotion+memoize@0.9.0/node_modules/@emotion/memoize/dist/emotion-memoize.esm.js","../../../../node_modules/.pnpm/@emotion+cache@11.14.0/node_modules/@emotion/cache/dist/emotion-cache.esm.js","../../../../node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.production.min.js","../../../../node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.development.js","../../../../node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.js","../../../../node_modules/.pnpm/hoist-non-react-statics@3.3.2/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js","../../../../node_modules/.pnpm/@emotion+utils@1.4.2/node_modules/@emotion/utils/dist/emotion-utils.esm.js","../../../../node_modules/.pnpm/@emotion+hash@0.9.2/node_modules/@emotion/hash/dist/emotion-hash.esm.js","../../../../node_modules/.pnpm/@emotion+unitless@0.10.0/node_modules/@emotion/unitless/dist/emotion-unitless.esm.js","../../../../node_modules/.pnpm/@emotion+serialize@1.3.3/node_modules/@emotion/serialize/dist/emotion-serialize.esm.js","../../../../node_modules/.pnpm/@emotion+use-insertion-effect-with-fallbacks@1.2.0_react@18.3.1/node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.esm.js","../../../../node_modules/.pnpm/@emotion+react@11.14.0_@types+react@18.3.28_react@18.3.1/node_modules/@emotion/react/dist/emotion-element-d59e098f.esm.js","../../../../node_modules/.pnpm/@emotion+react@11.14.0_@types+react@18.3.28_react@18.3.1/node_modules/@emotion/react/dist/emotion-react.esm.js","../../../../node_modules/.pnpm/@emotion+css@11.13.5/node_modules/@emotion/css/create-instance/dist/emotion-css-create-instance.esm.js","../../../../node_modules/.pnpm/@emotion+css@11.13.5/node_modules/@emotion/css/dist/emotion-css.esm.js","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/hooks/use-cx.mjs","../../../../node_modules/.pnpm/memize@2.1.1/node_modules/memize/dist/index.js","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/colors-values.mjs","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/config-values.mjs","../../../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/es6/index.js","../../../../node_modules/.pnpm/@wordpress+warning@3.52.0/node_modules/@wordpress/warning/build-module/utils.mjs","../../../../node_modules/.pnpm/@wordpress+warning@3.52.0/node_modules/@wordpress/warning/build-module/index.mjs","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/context-system-provider.mjs","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/constants.mjs","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/get-styled-class-name-from-key.mjs","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/context-connect.mjs","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/utils.mjs","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/use-context-system.mjs","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/visually-hidden/styles.mjs","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/polymorphic-element.mjs","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/view/component.mjs","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/visually-hidden/component.mjs","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/use-responsive-value.mjs","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/grid/utils.mjs","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/grid/hook.mjs","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/grid/component.mjs","../src/charts/leaderboard-chart/hooks/use-fitted-row-count.ts","../src/charts/leaderboard-chart/hooks/use-leaderboard-legend-items.ts","../src/charts/leaderboard-chart/leaderboard-chart.tsx","../src/charts/private/radial-wipe-animation/radial-wipe-animation.tsx","../src/charts/pie-chart/pie-chart.tsx","../src/charts/pie-semi-circle-chart/pie-semi-circle-chart.tsx","../src/charts/sparkline/sparkline.tsx","../src/components/trend-indicator/trend-indicator.tsx"],"sourcesContent":["import { createContext } from 'react';\n\nexport interface ChartInstanceRef {\n\tgetScales: () => { xScale: unknown; yScale: unknown } | null;\n\tgetChartDimensions: () => {\n\t\twidth: number;\n\t\theight: number;\n\t\tmargin: { top?: number; right?: number; bottom?: number; left?: number };\n\t};\n}\n\n// Local context for chart implicit state sharing\nexport interface ChartInstanceContextValue {\n\tchartId: string;\n\tchartRef?: React.RefObject< ChartInstanceRef >;\n\tchartWidth?: number;\n\tchartHeight?: number;\n\tisSeriesVisible?: ( seriesLabel: string ) => boolean;\n}\n\nexport const ChartInstanceContext = createContext< ChartInstanceContextValue | null >( null );\n","import { useContext } from 'react';\nimport { ChartInstanceContext, type ChartInstanceContextValue } from './chart-instance-context';\n\nexport const useChartInstanceContext = (): ChartInstanceContextValue => {\n\tconst context = useContext( ChartInstanceContext );\n\tif ( ! context ) {\n\t\tthrow new Error( 'useChartInstanceContext must be used within a Chart component' );\n\t}\n\treturn context;\n};\n","/**\n * 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.\n *\n * Deliberately unhashed: consumers are documented as being able to target it to override a token on the provider element.\n */\nexport const CHART_SCOPE_CLASS = 'a8c-charts-scope';\n","/**\n * Utility function to create chart components with composition API.\n *\n * This function attaches subcomponents to a chart component to enable\n * dot notation access like <Chart.Legend />, <Chart.Tooltip />, etc.\n *\n * @param Chart - The main chart component\n * @param subComponents - Object containing subcomponents to attach\n * @return Chart component with attached subcomponents\n */\nexport function attachSubComponents< TChart, TSubComponents extends Record< string, unknown > >(\n\tChart: TChart,\n\tsubComponents: TSubComponents\n): TChart & TSubComponents {\n\treturn Object.assign( Chart, subComponents );\n}\n","/**\n * @file Date parsing utilities using date-fns for local timezone handling\n *\n * This module provides utilities for parsing various date string formats and converting\n * them to local timezone dates using the battle-tested date-fns library. For formats\n * without timezone info, they're treated as local. For formats with timezone info,\n * they're converted to the equivalent local time.\n *\n * Note: And specifically it prevents format `YYYY-MM-DD` being parsed as UTC date.\n *\n * Key Features:\n * - All parsed dates are in local timezone\n * - Converts timezone-aware strings to local equivalent\n * - Robust input validation and error handling using date-fns\n * - TypeScript type safety\n * - Much smaller codebase than custom parsing\n *\n * Supported Formats:\n * - YYYY-MM-DD (treated as local)\n * - YYYY-MM-DD HH:mm:ss (treated as local)\n * - YYYY-MM-DD HH:mm (treated as local)\n * - YYYY-MM-DDTHH:mm:ss (treated as local)\n * - YYYY-MM-DDTHH:mm:ss.SSS (treated as local)\n * - YYYY-MM-DDTHH:mm (treated as local)\n * - YYYY-MM-DDTHH:mm:ssZ (converted to local)\n * - YYYY-MM-DDTHH:mm:ss±HH:mm (converted to local)\n *\n * @example\n * ```typescript\n * parseAsLocalDate(\"2025-01-01\"); // Local timezone\n * parseAsLocalDate(\"2025-01-01 14:30:00\"); // Local timezone\n * parseAsLocalDate(\"2025-01-01 14:30\"); // Local timezone\n * parseAsLocalDate(\"2025-01-01T14:30:45.123\"); // Local timezone\n * parseAsLocalDate(\"2025-01-01T14:30:00Z\"); // UTC 14:30 → Local equivalent\n * parseAsLocalDate(\"2025-01-01T14:30:00+05:00\"); // +05:00 14:30 → Local equivalent\n * ```\n */\n\nimport { parse, parseISO, isValid } from 'date-fns';\n\n/**\n * Checks if a date string contains timezone information\n * @param {string} dateString - The date string to check for timezone information\n * @return {boolean} True if the date string contains timezone information, false otherwise\n */\nconst hasTimezone = ( dateString: string ): boolean => {\n\tconst tIndex = dateString.indexOf( 'T' );\n\tif ( tIndex === -1 ) {\n\t\treturn false;\n\t}\n\n\tif ( dateString.endsWith( 'Z' ) ) {\n\t\treturn true;\n\t}\n\n\treturn /[+-]\\d{2}:?\\d{2}$/.test( dateString.slice( tIndex + 1 ) );\n};\n\n/**\n * Parses any supported date string format and returns a local timezone date\n *\n * Uses date-fns for robust parsing and validation. For strings without timezone\n * info, treats as local timezone. For strings with timezone info, converts to\n * local timezone equivalent.\n *\n * Supports:\n * - YYYY-MM-DD (local)\n * - YYYY-MM-DD HH:mm:ss (local)\n * - YYYY-MM-DD HH:mm (local)\n * - YYYY-MM-DDTHH:mm:ss (local)\n * - YYYY-MM-DDTHH:mm:ss.SSS (local)\n * - YYYY-MM-DDTHH:mm (local)\n * - YYYY-MM-DDTHH:mm:ssZ (UTC → local)\n * - YYYY-MM-DDTHH:mm:ss±HH:mm (offset → local)\n * @param {string} dateString - The date string to parse into a local timezone date\n * @return {Date} A Date object representing the parsed date in local timezone, or an invalid Date if parsing fails\n */\nexport const parseAsLocalDate = ( dateString: string ): Date => {\n\tconst trimmedString = dateString.trim();\n\n\t// If it has timezone information, parse as ISO and convert to local\n\tif ( hasTimezone( trimmedString ) ) {\n\t\tconst isoDate = parseISO( trimmedString );\n\n\t\tif ( ! isValid( isoDate ) ) {\n\t\t\treturn new Date( NaN );\n\t\t}\n\n\t\t// parseISO automatically converts to local timezone\n\t\treturn isoDate;\n\t}\n\n\t// For naive strings, try different local formats\n\tconst formats = [\n\t\t'yyyy-MM-dd', // 2025-01-01\n\t\t'yyyy-MM-dd HH:mm:ss', // 2025-01-01 14:30:45\n\t\t'yyyy-MM-dd HH:mm', // 2025-01-01 14:30\n\t\t\"yyyy-MM-dd'T'HH:mm:ss\", // 2025-01-01T14:30:45\n\t\t\"yyyy-MM-dd'T'HH:mm:ss.SSS\", // 2025-01-01T14:30:45.123\n\t\t\"yyyy-MM-dd'T'HH:mm\", // 2025-01-01T14:30\n\t];\n\n\tfor ( const format of formats ) {\n\t\tconst result = parse( trimmedString, format, new Date() );\n\t\tif ( isValid( result ) ) {\n\t\t\treturn result;\n\t\t}\n\t}\n\n\t// If no format matched, return invalid date\n\treturn new Date( NaN );\n};\n","import { formatNumberCompact, formatNumber } from '@automattic/number-formatters';\n\n/**\n * Types for formatMetricValue\n */\nexport type MetricValueType = 'number' | 'average' | 'currency';\n\ntype FormatMetricValueOptions = {\n\tdecimals?: number;\n\tuseMultipliers?: boolean;\n\tsignDisplay?: Intl.NumberFormatOptions[ 'signDisplay' ];\n};\n\n/**\n * Format a numeric metric value based on type, precision and scale.\n * Supports currency, number and percentage, using `@automattic/number-formatters`.\n *\n * @param value - The value to format\n * @param type - The type of formatting to apply\n * @param options - Formatting options\n * @param options.decimals - Number of decimal places to show\n * @param options.useMultipliers - Whether to use K, M, B suffixes for large numbers\n * @param options.signDisplay - Controls when to display the sign (auto, always, never, exceptZero)\n * @return Formatted string\n */\nexport const formatMetricValue = (\n\tvalue: string | number,\n\ttype: MetricValueType = 'number',\n\t{ decimals, useMultipliers = false, signDisplay }: FormatMetricValueOptions = {}\n): string => {\n\tif ( value === null || value === undefined ) {\n\t\treturn '';\n\t}\n\n\tconst numericValue = Number( value );\n\tif ( isNaN( numericValue ) ) {\n\t\treturn '';\n\t}\n\n\tswitch ( type ) {\n\t\tcase 'currency': {\n\t\t\t// Basic currency formatting - can be enhanced with full currency support\n\t\t\tconst formatted = useMultipliers\n\t\t\t\t? formatNumberCompact( numericValue, {\n\t\t\t\t\t\tdecimals: decimals ?? 2,\n\t\t\t\t\t\tnumberFormatOptions: {\n\t\t\t\t\t\t\tmaximumFractionDigits: decimals ?? 2,\n\t\t\t\t\t\t\tsignDisplay,\n\t\t\t\t\t\t},\n\t\t\t\t } )\n\t\t\t\t: formatNumber( numericValue, {\n\t\t\t\t\t\tdecimals: decimals ?? 2,\n\t\t\t\t\t\tnumberFormatOptions: {\n\t\t\t\t\t\t\tsignDisplay,\n\t\t\t\t\t\t},\n\t\t\t\t } );\n\t\t\treturn `$${ formatted }`;\n\t\t}\n\n\t\tcase 'average': {\n\t\t\tif ( ! Number.isFinite( numericValue ) ) {\n\t\t\t\treturn '—';\n\t\t\t}\n\n\t\t\treturn formatNumber( numericValue, {\n\t\t\t\tdecimals: decimals ?? 0,\n\t\t\t\tnumberFormatOptions: {\n\t\t\t\t\tstyle: 'percent',\n\t\t\t\t\tsignDisplay: signDisplay ?? 'exceptZero',\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\tcase 'number':\n\t\tdefault: {\n\t\t\treturn useMultipliers\n\t\t\t\t? formatNumberCompact( numericValue, {\n\t\t\t\t\t\tdecimals: decimals ?? 0,\n\t\t\t\t\t\tnumberFormatOptions: {\n\t\t\t\t\t\t\tmaximumFractionDigits: decimals ?? 0,\n\t\t\t\t\t\t\tsignDisplay,\n\t\t\t\t\t\t},\n\t\t\t\t } )\n\t\t\t\t: formatNumber( numericValue, {\n\t\t\t\t\t\tdecimals: decimals ?? 0,\n\t\t\t\t\t\tnumberFormatOptions: {\n\t\t\t\t\t\t\tsignDisplay,\n\t\t\t\t\t\t},\n\t\t\t\t } );\n\t\t}\n\t}\n};\n","import { formatNumber } from '@automattic/number-formatters';\n\n/**\n * Format a percentage value with smart decimal handling.\n * Uses `@automattic/number-formatters` for consistent formatting.\n * Removes unnecessary trailing zeros and caps at 2 decimal places.\n *\n * @param value - The percentage value (0-100 range)\n * @return Formatted percentage string (e.g., \"30%\", \"30.1%\", \"30.25%\")\n */\nexport const formatPercentage = ( value: number ): string => {\n\t// Use formatNumber with percentage style, but convert from 0-100 range to 0-1 range\n\treturn formatNumber( value / 100, {\n\t\tnumberFormatOptions: {\n\t\t\tstyle: 'percent',\n\t\t\tminimumFractionDigits: 0,\n\t\t\tmaximumFractionDigits: 2,\n\t\t},\n\t} );\n};\n","import { getStringWidth } from '@visx/text';\nimport type { TickFormatter } from '@visx/axis';\nimport type { AnyD3Scale, ScaleInput } from '@visx/scale';\n\n/**\n * Returns the width of the longest tick.\n *\n * @param ticks - Ticks to get the width of.\n * @param formatTick - Function to format the tick.\n * @param {object} labelStyle - Style object for the label.\n * @return {number} - Width of the longest tick.\n */\nexport const getLongestTickWidth = < T extends AnyD3Scale >(\n\tticks: ScaleInput< T >[],\n\tformatTick: TickFormatter< ScaleInput< T > >,\n\tlabelStyle?: object\n) => {\n\tconst formattedTicks = ticks.map( tick => formatTick( tick, 0, [] ) );\n\tconst longestTick = formattedTicks.reduce(\n\t\t( longest, current ) => ( longest.length >= current.length ? longest : current ),\n\t\tformattedTicks[ 0 ]\n\t);\n\n\treturn getStringWidth( longestTick, labelStyle );\n};\n","import type { BarStyles, ChartTheme, LegendShape, SeriesData } from '../types';\nimport type { LineStyles } from '@visx/xychart';\n\n/**\n * Utility function to get consolidated line styles for a series\n * This consolidates the logic used by both LineChart and Legend components\n *\n * @param {SeriesData} seriesData - The series data containing styling options\n * @param {number} index - The index of the series in the data array\n * @param {ChartTheme} providerTheme - The chart theme configuration\n * @return {LineStyles} The consolidated line styles for the series\n */\nexport function getSeriesLineStyles(\n\tseriesData: SeriesData,\n\tindex: number,\n\tproviderTheme: ChartTheme\n): LineStyles {\n\t// Get theme-based line styles for line type\n\tconst themeSemanticLineStyle = providerTheme?.lineChart?.lineStyles?.[ seriesData.options?.type ];\n\n\t// Get theme-based line styles for index of series data\n\tconst themeSeriesLineStyle =\n\t\tproviderTheme?.seriesLineStyles?.[ index % providerTheme.seriesLineStyles.length ];\n\n\t// Priority order: custom series style > theme line type style > default theme series style\n\treturn (\n\t\tseriesData.options?.seriesLineStyle ?? themeSemanticLineStyle ?? themeSeriesLineStyle ?? {}\n\t);\n}\n\n/**\n * Utility to get consolidated bar styles for a series by semantic type.\n * Mirrors getSeriesLineStyles: a series with `options.type` (e.g. 'comparison')\n * resolves to `theme.barChart.barStyles[ type ]`.\n *\n * @param {SeriesData} seriesData - The series data containing styling options\n * @param {number} index - The index of the series in the data array\n * @param {ChartTheme} providerTheme - The chart theme configuration\n * @return {BarStyles} The consolidated bar styles for the series\n */\nexport function getSeriesBarStyles(\n\tseriesData: SeriesData,\n\tindex: number,\n\tproviderTheme: ChartTheme\n): BarStyles {\n\tconst type = seriesData.options?.type;\n\treturn ( type && providerTheme?.barChart?.barStyles?.[ type ] ) ?? {};\n}\n\n/**\n * Utility function to get stroke color for a series\n *\n * @param {SeriesData} seriesData - The series data containing styling options\n * @param {number} index - The index of the series in the data array\n * @param {string[]} themeColors - Array of theme colors\n * @return {string} The stroke color for the series\n */\nexport function getSeriesStroke(\n\tseriesData: SeriesData,\n\tindex: number,\n\tthemeColors: string[]\n): string {\n\treturn seriesData.options?.stroke ?? themeColors[ index % themeColors.length ];\n}\n\n/**\n * Utility function to get shape styles for a legend item\n *\n * @param {SeriesData} series - The series data containing styling options\n * @param {number} index - The index of the series in the data array\n * @param {ChartTheme} theme - The chart theme configuration\n * @param {LegendShape} legendShape - The shape to use for the item (optional)\n * @return {Record< string, unknown >} The shape styles for the item\n */\nexport function getItemShapeStyles(\n\tseries: SeriesData,\n\tindex: number,\n\ttheme: ChartTheme,\n\tlegendShape?: LegendShape< SeriesData[], number >\n): Record< string, unknown > {\n\tconst seriesShapeStyles = series.options?.legendShapeStyle ?? {};\n\tconst lineStyles = legendShape === 'line' ? getSeriesLineStyles( series, index, theme ) : {};\n\t// For non-line legends (e.g. bar 'rect'), reflect the comparison bar's opacity on the\n\t// swatch so the legend marker matches the translucent comparison bar. Line-type legends\n\t// convey comparison via the dashed stroke (lineStyles) instead.\n\tconst barOpacity =\n\t\tlegendShape !== 'line' ? getSeriesBarStyles( series, index, theme ).opacity : undefined;\n\tconst barShapeStyles = barOpacity !== undefined ? { opacity: barOpacity } : {};\n\tconst themeShapeStyles = theme.legend?.shapeStyles?.[ index ];\n\n\t// Series-level styles (custom shape style + line styles) take precedence; otherwise fall\n\t// back to the per-index theme shape styles.\n\tconst explicitStyles = {\n\t\t...seriesShapeStyles,\n\t\t...lineStyles,\n\t};\n\tconst hasExplicitStyles = Object.values( explicitStyles ).some(\n\t\tvalue => value !== undefined && value !== null && value !== ''\n\t);\n\tconst baseShapeStyles = hasExplicitStyles ? explicitStyles : themeShapeStyles ?? {};\n\n\t// Layer the comparison bar opacity on top so the swatch matches the translucent bar\n\t// without discarding the base (custom or theme) shape styles.\n\treturn { ...baseShapeStyles, ...barShapeStyles };\n}\n","export const isSafari = () => {\n\tif ( typeof navigator !== 'undefined' && navigator.userAgent ) {\n\t\treturn /^((?!chrome|android).)*safari/i.test( navigator.userAgent );\n\t}\n\treturn false;\n};\n","import deepmerge from 'deepmerge';\nimport type { ChartTheme, CompleteChartTheme } from '../types';\n\n/**\n * Merges chart themes with proper precedence.\n * The second theme (override) takes precedence over the first theme (base).\n *\n * @param baseTheme - Base theme object\n * @param overrideTheme - Theme to override base with (takes precedence)\n * @return Merged theme with overrideTheme values taking precedence\n */\nexport function mergeThemes(\n\tbaseTheme: CompleteChartTheme,\n\toverrideTheme: Partial< ChartTheme >\n): CompleteChartTheme;\nexport function mergeThemes(\n\tbaseTheme: ChartTheme,\n\toverrideTheme: Partial< ChartTheme >\n): ChartTheme;\nexport function mergeThemes(\n\tbaseTheme: ChartTheme,\n\toverrideTheme: Partial< ChartTheme >\n): ChartTheme {\n\t// Use deepmerge to properly merge nested objects, with overrideTheme taking precedence\n\treturn deepmerge( baseTheme, overrideTheme, {\n\t\t// Ensure arrays are replaced rather than concatenated\n\t\tarrayMerge: ( _destinationArray, sourceArray ) => sourceArray,\n\t} ) as ChartTheme;\n}\n","import { color as d3Color, hsl as d3Hsl } from '@visx/vendor/d3-color';\n\n/**\n * Check if a value is a valid 6-digit hex color\n * @param hex - The value to check\n * @return true if valid hex color format (e.g., '#ff0000')\n */\nexport const isValidHexColor = ( hex: unknown ): hex is string => {\n\treturn typeof hex === 'string' && /^#[0-9a-fA-F]{6}$/.test( hex );\n};\n\n/**\n * Validate hex color format, throwing descriptive errors if invalid\n * @param hex - The hex color string to validate\n * @throws {Error} if hex string is malformed\n */\nexport const validateHexColor = ( hex: unknown ): void => {\n\tif ( isValidHexColor( hex ) ) {\n\t\treturn;\n\t}\n\n\t// Provide specific error messages for common issues\n\tif ( typeof hex !== 'string' ) {\n\t\tthrow new Error( 'Hex color must be a string' );\n\t}\n\tif ( ! hex.startsWith( '#' ) ) {\n\t\tthrow new Error( 'Hex color must start with #' );\n\t}\n\tif ( hex.length !== 7 ) {\n\t\tthrow new Error( 'Hex color must be 7 characters long (e.g., #ff0000)' );\n\t}\n\tthrow new Error( 'Hex color contains invalid characters. Only 0-9, a-f, A-F are allowed' );\n};\n\n/**\n * Convert hex color to rgba with specified opacity.\n * This is genuinely reusable across chart components.\n * @param hex - The hex color string (e.g., '#ff0000')\n * @param alpha - The opacity value. Values outside the [0, 1] range will be clamped by the underlying d3 color library.\n * @return The rgba color string (e.g., 'rgba(255, 0, 0, 0.5)')\n * @throws {Error} if hex string is malformed or alpha is not a valid number\n */\nexport const hexToRgba = ( hex: string, alpha: number ): string => {\n\tvalidateHexColor( hex );\n\n\tif ( typeof alpha !== 'number' || isNaN( alpha ) ) {\n\t\tthrow new Error( 'Alpha must be a number' );\n\t}\n\n\t// Safe to use non-null assertion since validateHexColor ensures valid hex\n\treturn d3Color( hex )!.copy( { opacity: alpha } ).formatRgb();\n};\n\n/**\n * Calculate the perceptual distance between two HSL colors\n * @param hsl1 - first color in HSL format [h, s, l]\n * @param hsl2 - second color in HSL format [h, s, l]\n * @return distance value (0-100+, lower means more similar)\n */\nexport const getColorDistance = (\n\thsl1: [ number, number, number ],\n\thsl2: [ number, number, number ]\n): number => {\n\tconst [ h1, s1, l1 ] = hsl1;\n\tconst [ h2, s2, l2 ] = hsl2;\n\n\t// Calculate hue difference, accounting for circular nature (0° = 360°)\n\tlet hueDiff = Math.abs( h1 - h2 );\n\thueDiff = Math.min( hueDiff, 360 - hueDiff );\n\n\t// Weight the differences: hue is most important, then lightness, then saturation\n\tconst hueWeight = 2;\n\tconst lightnessWeight = 1;\n\tconst saturationWeight = 0.5;\n\n\treturn Math.sqrt(\n\t\tMath.pow( hueDiff * hueWeight, 2 ) +\n\t\t\tMath.pow( ( l1 - l2 ) * lightnessWeight, 2 ) +\n\t\t\tMath.pow( ( s1 - s2 ) * saturationWeight, 2 )\n\t);\n};\n\n/**\n * Parse an HSL string like 'hsl(120, 50%, 50%)' into an HSL tuple.\n *\n * @param hslString - HSL color string\n * @return HSL tuple [h, s, l] or null if invalid\n */\nexport const parseHslString = ( hslString: string ): [ number, number, number ] | null => {\n\tconst lower = hslString.toLowerCase().trim();\n\n\t// Check prefix - d3-color handles the parsing\n\tif ( ! lower.startsWith( 'hsl(' ) ) {\n\t\treturn null;\n\t}\n\n\tconst parsed = d3Hsl( lower );\n\n\t// d3Hsl returns NaN values for invalid colors\n\tif ( isNaN( parsed.h ) && isNaN( parsed.s ) && isNaN( parsed.l ) ) {\n\t\treturn null;\n\t}\n\n\t// Normalize hue to 0-360 range (d3 may return NaN for achromatic colors)\n\tconst h = isNaN( parsed.h ) ? 0 : ( ( parsed.h % 360 ) + 360 ) % 360;\n\n\t// d3-color uses 0-1 scale, convert to 0-100\n\treturn [ h, parsed.s * 100, parsed.l * 100 ];\n};\n\n/**\n * Parse an RGB string like 'rgb(255, 0, 0)' into a hex color.\n *\n * @deprecated Use normalizeColorToHex() instead, which handles all color formats including rgb() and rgba().\n * @param rgbString - RGB color string (not RGBA)\n * @return hex color string or null if invalid\n */\nexport const parseRgbString = ( rgbString: string ): string | null => {\n\tconst lower = rgbString.toLowerCase().trim();\n\n\t// Check prefix - only handle rgb(), not rgba()\n\t// This is intentional - use normalizeColorToHex for rgba() support\n\tif ( ! lower.startsWith( 'rgb(' ) || lower.startsWith( 'rgba(' ) ) {\n\t\treturn null;\n\t}\n\n\tconst parsed = d3Color( lower );\n\n\t// d3Color returns null for invalid colors\n\tif ( ! parsed ) {\n\t\treturn null;\n\t}\n\n\t// d3-color clamps values automatically\n\treturn parsed.formatHex();\n};\n\n/**\n * Normalize any CSS color value to a hex color string.\n * Handles hex, HSL, HSLA, RGB, RGBA, named CSS colors, and CSS variables.\n *\n * @param color - Any CSS color value\n * @param element - Optional DOM element for resolving CSS variables\n * @param resolveCss - Function to resolve CSS variables (injected for testability)\n * @param _depth - Internal recursion depth counter to prevent infinite loops\n * @return hex color string, or the original value if conversion fails\n */\nexport const normalizeColorToHex = (\n\tcolor: string,\n\telement?: HTMLElement | null,\n\tresolveCss?: ( value: string, el?: HTMLElement | null ) => string | null,\n\t_depth = 0\n): string => {\n\tif ( ! color || typeof color !== 'string' ) {\n\t\treturn '';\n\t}\n\n\t// Already a valid hex color (6-digit format)\n\tif ( /^#[0-9a-fA-F]{6}$/.test( color ) ) {\n\t\treturn color;\n\t}\n\n\tconst trimmed = color.trim().toLowerCase();\n\n\t// Handle 3-digit hex colors - expand to 6-digit\n\tif ( /^#[0-9a-f]{3}$/i.test( trimmed ) ) {\n\t\tconst r = trimmed[ 1 ];\n\t\tconst g = trimmed[ 2 ];\n\t\tconst b = trimmed[ 3 ];\n\t\treturn `#${ r }${ r }${ g }${ g }${ b }${ b }`;\n\t}\n\n\t// Handle CSS variables - must be resolved before d3-color can parse\n\tif ( trimmed.startsWith( '--' ) || trimmed.startsWith( 'var(' ) ) {\n\t\tif ( resolveCss ) {\n\t\t\tconst resolved = resolveCss( color, element );\n\t\t\tif ( resolved && resolved !== color && _depth < 10 ) {\n\t\t\t\t// Recursively normalize the resolved value\n\t\t\t\treturn normalizeColorToHex( resolved, element, resolveCss, _depth + 1 );\n\t\t\t}\n\t\t}\n\t\t// Can't resolve CSS variable, return original\n\t\treturn color;\n\t}\n\n\t// Handle HSL, HSLA, RGB, and RGBA strings using d3-color\n\tif (\n\t\ttrimmed.startsWith( 'hsl(' ) ||\n\t\ttrimmed.startsWith( 'hsla(' ) ||\n\t\ttrimmed.startsWith( 'rgb(' ) ||\n\t\ttrimmed.startsWith( 'rgba(' )\n\t) {\n\t\tconst parsed = d3Color( trimmed );\n\t\tif ( parsed ) {\n\t\t\treturn parsed.formatHex();\n\t\t}\n\t\treturn color;\n\t}\n\n\t// Attempt d3-color for any remaining format (e.g. named CSS colors like \"steelblue\")\n\tconst parsed = d3Color( trimmed );\n\tif ( parsed ) {\n\t\treturn parsed.formatHex();\n\t}\n\n\t// Unknown format, return as-is\n\treturn color;\n};\n\n/**\n * Lighten a hex color by blending it with white.\n * Useful for creating color gradients or lighter variants.\n *\n * @param hex - Hex color string (e.g., '#98C8DF')\n * @param blend - Blend amount with white (0 = original color, 1 = white)\n * @return Lightened hex color string (e.g., '#cce4ef')\n * @throws {Error} if hex string is malformed\n */\nexport const lightenHexColor = ( hex: string, blend: number ): string => {\n\tvalidateHexColor( hex );\n\n\tconst r = parseInt( hex.slice( 1, 3 ), 16 );\n\tconst g = parseInt( hex.slice( 3, 5 ), 16 );\n\tconst b = parseInt( hex.slice( 5, 7 ), 16 );\n\n\t// Blend with white (255, 255, 255)\n\tconst newR = Math.round( r + ( 255 - r ) * blend );\n\tconst newG = Math.round( g + ( 255 - g ) * blend );\n\tconst newB = Math.round( b + ( 255 - b ) * blend );\n\n\treturn `#${ newR.toString( 16 ).padStart( 2, '0' ) }${ newG\n\t\t.toString( 16 )\n\t\t.padStart( 2, '0' ) }${ newB.toString( 16 ).padStart( 2, '0' ) }`;\n};\n\n/**\n * Blend one hex color toward another, per-channel in sRGB.\n *\n * @param fromHex - Starting hex color, returned when blend is 0\n * @param toHex - Target hex color, returned when blend is 1\n * @param blend - Amount toward toHex, clamped to [0, 1]\n * @return Blended hex color string\n * @throws {Error} if either hex string is malformed\n */\nexport const mixHexColors = ( fromHex: string, toHex: string, blend: number ): string => {\n\tvalidateHexColor( fromHex );\n\tvalidateHexColor( toHex );\n\n\tconst amount = Math.min( 1, Math.max( 0, blend ) );\n\tconst channel = ( start: number, end: number ): string =>\n\t\tMath.round( start + ( end - start ) * amount )\n\t\t\t.toString( 16 )\n\t\t\t.padStart( 2, '0' );\n\n\treturn `#${ channel(\n\t\tparseInt( fromHex.slice( 1, 3 ), 16 ),\n\t\tparseInt( toHex.slice( 1, 3 ), 16 )\n\t) }${ channel(\n\t\tparseInt( fromHex.slice( 3, 5 ), 16 ),\n\t\tparseInt( toHex.slice( 3, 5 ), 16 )\n\t) }${ channel( parseInt( fromHex.slice( 5, 7 ), 16 ), parseInt( toHex.slice( 5, 7 ), 16 ) ) }`;\n};\n\n/**\n * WCAG relative luminance of a hex color (0 = black, 1 = white).\n *\n * @param hex - Hex color string (e.g., '#98C8DF')\n * @return Relative luminance in the range [0, 1]\n * @throws {Error} if hex string is malformed\n */\nexport const relativeLuminance = ( hex: string ): number => {\n\tvalidateHexColor( hex );\n\n\tconst toLinear = ( value: number ): number => {\n\t\tconst channel = value / 255;\n\t\treturn channel <= 0.03928 ? channel / 12.92 : Math.pow( ( channel + 0.055 ) / 1.055, 2.4 );\n\t};\n\n\tconst r = toLinear( parseInt( hex.slice( 1, 3 ), 16 ) );\n\tconst g = toLinear( parseInt( hex.slice( 3, 5 ), 16 ) );\n\tconst b = toLinear( parseInt( hex.slice( 5, 7 ), 16 ) );\n\n\treturn 0.2126 * r + 0.7152 * g + 0.0722 * b;\n};\n\n/**\n * Whether light text reads better than dark text on the given background, using the W3C\n * luminance threshold (0.179) that maximizes contrast against black vs white.\n *\n * @param backgroundHex - Hex background color\n * @return true if light text should be used; false (dark text) for malformed colors\n */\nexport const prefersLightText = ( backgroundHex: string ): boolean => {\n\tif ( ! isValidHexColor( backgroundHex ) ) {\n\t\treturn false;\n\t}\n\treturn relativeLuminance( backgroundHex ) <= 0.179;\n};\n","/**\n * Pattern for valid CSS custom property names (e.g., '--my-color', '--jp-gray-10')\n */\nconst CSS_VAR_NAME_PATTERN = /^--[\\w-]+$/;\n\n/**\n * Resolves a CSS custom property (variable) to its computed value.\n * Handles multiple formats:\n * - Plain variable names: '--my-color'\n * - CSS var() syntax: 'var(--my-color)'\n * - CSS var() with fallback: 'var(--my-color, #ffffff)'\n * - Regular values (returned as-is): '#ffffff', 'red'\n *\n * @param value - A CSS variable name, var() expression, or regular value\n * @param element - Optional DOM element to resolve the variable from (defaults to document.documentElement)\n * @return The resolved value, fallback value, or null if unresolvable\n */\nexport const resolveCssVariable = ( value: string, element?: HTMLElement | null ): string | null =>\n\tcreateCssVariableResolver( element )( value );\n\n/**\n * Builds a resolver that reads every value from one `getComputedStyle` snapshot.\n *\n * `getComputedStyle` is the expensive half of resolving a token: each call can force the browser to flush pending style, and a chart theme resolves five roles at once. Taking the snapshot once per build turns that into a single query. The reads that share a snapshot happen synchronously inside one memo body, so no style change can land between them — the resolver is single-pass by design and is not meant to be held across renders.\n *\n * @param element - The element to resolve against, or null/undefined for the document root.\n * @return A resolver that resolves each value exactly as `resolveCssVariable` does.\n */\nexport function createCssVariableResolver(\n\telement?: HTMLElement | null\n): ( value: string ) => string | null {\n\tlet styles: CSSStyleDeclaration | null = null;\n\n\t// Deferred so a resolver for a theme that turns out to hold only literals costs nothing. Only a successful read is kept: caching the null would leave a resolver built before its element is in the document dead for the rest of its life.\n\tconst getStyles = () => {\n\t\tif ( ! styles ) {\n\t\t\tstyles = computedStyleFor( element );\n\t\t}\n\n\t\treturn styles;\n\t};\n\n\treturn ( value: string ): string | null => {\n\t\tif ( ! value ) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// Check if it's a var() expression: var(--name) or var(--name, fallback)\n\t\t// Parse manually to avoid regex backtracking vulnerabilities\n\t\tif ( value.startsWith( 'var(' ) && value.endsWith( ')' ) ) {\n\t\t\tconst parsed = parseVarExpression( value );\n\n\t\t\tif ( parsed ) {\n\t\t\t\tconst resolved = readCustomProperty( parsed.varName, getStyles() );\n\n\t\t\t\treturn resolved || parsed.fallback;\n\t\t\t}\n\t\t}\n\n\t\t// Check if it's a plain variable name (starts with --)\n\t\tif ( value.startsWith( '--' ) ) {\n\t\t\treturn readCustomProperty( value, getStyles() );\n\t\t}\n\n\t\t// Return regular values as-is (e.g., '#ffffff', 'red')\n\t\treturn value;\n\t};\n}\n\n/**\n * Parses a var() expression into its variable name and optional fallback.\n * Uses string manipulation instead of complex regex to avoid ReDoS.\n *\n * @param expr - A var() expression like 'var(--name)' or 'var(--name, fallback)'\n * @return Parsed result or null if invalid\n */\nfunction parseVarExpression( expr: string ): { varName: string; fallback: string | null } | null {\n\t// Remove 'var(' prefix and ')' suffix\n\tconst inner = expr.slice( 4, -1 ).trim();\n\n\tif ( ! inner.startsWith( '--' ) ) {\n\t\treturn null;\n\t}\n\n\t// Find the comma separator (if any)\n\tconst commaIndex = inner.indexOf( ',' );\n\n\tif ( commaIndex === -1 ) {\n\t\t// No fallback: var(--name)\n\t\tconst varName = inner.trim();\n\t\t// Validate variable name format\n\t\tif ( ! CSS_VAR_NAME_PATTERN.test( varName ) ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn { varName, fallback: null };\n\t}\n\n\t// Has fallback: var(--name, fallback)\n\tconst varName = inner.slice( 0, commaIndex ).trim();\n\n\t// Validate variable name format\n\tif ( ! CSS_VAR_NAME_PATTERN.test( varName ) ) {\n\t\treturn null;\n\t}\n\n\tconst fallback = inner.slice( commaIndex + 1 ).trim();\n\n\treturn { varName, fallback: fallback || null };\n}\n\n/**\n * Takes one computed-style snapshot, or null where there is nothing to read (SSR, or a detached element).\n *\n * @param element - The element to read from, or null/undefined for the document root.\n * @return The computed styles, or null.\n */\nfunction computedStyleFor( element?: HTMLElement | null ): CSSStyleDeclaration | null {\n\tif ( typeof window === 'undefined' || typeof document === 'undefined' ) {\n\t\treturn null;\n\t}\n\n\ttry {\n\t\treturn getComputedStyle( element || document.documentElement );\n\t} catch {\n\t\t// getComputedStyle throws on a detached element.\n\t\treturn null;\n\t}\n}\n\n/**\n * Reads one custom property from a computed-style snapshot.\n *\n * @param varName - A CSS variable name like '--my-color'\n * @param styles - The snapshot to read from, or null\n * @return The computed value or null\n */\nfunction readCustomProperty( varName: string, styles: CSSStyleDeclaration | null ): string | null {\n\tif ( ! styles ) {\n\t\treturn null;\n\t}\n\n\ttry {\n\t\tconst computedValue = styles.getPropertyValue( varName ).trim();\n\n\t\treturn computedValue || null;\n\t} catch {\n\t\t// Belt and braces — no engine is known to throw here. Kept because a caller may hand in a stand-in for CSSStyleDeclaration; `resolve-css-var.test.ts` covers exactly that.\n\t\treturn null;\n\t}\n}\n","/**\n * Resolve a theme `fontSize` value into a plain number suitable for\n * canvas-based measurement (e.g. `getStringWidth`).\n *\n * Accepts:\n * - A number — returned as-is\n * - A pixel string like `\"12px\"` — parsed and returned as a number\n *\n * Returns `undefined` for any other input (missing value, NaN, or\n * relative units like `rem`/`em`/`%`/`vh`) so callers can fall back to\n * their own default. Relative units are intentionally rejected because\n * we cannot resolve them to absolute pixels here without a parent\n * computed style, and silently returning the unitless prefix\n * (`parseFloat(\"0.875rem\") === 0.875`) would produce nearly-zero\n * widths in measurement code.\n * @param val - Raw font size value from a theme, axis style, or props\n * @return Parsed numeric font size in pixels, or `undefined` when unresolvable\n */\nexport const resolveFontSize = ( val?: number | string ): number | undefined => {\n\tif ( typeof val === 'number' ) {\n\t\treturn isNaN( val ) ? undefined : val;\n\t}\n\n\tif ( typeof val === 'string' ) {\n\t\t// Only accept plain numeric strings or pixel values.\n\t\t// Reject rem, em, %, vh, vw, etc. — they cannot be resolved to\n\t\t// absolute pixels without a computed style context.\n\t\tconst match = val.trim().match( /^(-?\\d+\\.?\\d*|-?\\.\\d+)(px)?$/ );\n\t\tif ( ! match ) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst parsed = parseFloat( match[ 1 ] );\n\t\treturn isNaN( parsed ) ? undefined : parsed;\n\t}\n\n\treturn undefined;\n};\n","import { createContext } from 'react';\n\n/**\n * The nearest chart element, published so JS token resolution reads the same CSS cascade that paints the chart's own colours.\n *\n * All JS token resolution reads this element rather than `document.documentElement`, so a `getComputedStyle` call sees the same `--a8c-charts-*` values — including any override set inside the provider tree — that a CSS-painted sibling element does.\n */\nexport const ChartScopeContext = createContext< HTMLElement | null >( null );\n","import { hsl as d3Hsl } from '@visx/vendor/d3-color';\nimport { getColorDistance } from '../../../utils';\n\nexport interface ColorCache {\n\tcolors: string[];\n\thues: number[];\n\texistingHslColors: Array< [ number, number, number ] >;\n\tminHue: number;\n\tmaxHue: number;\n}\n\n/**\n * Golden ratio for mathematically pleasing color distribution\n * Used to generate evenly spaced hues that are visually distinct\n */\nconst GOLDEN_RATIO = 0.618033988749;\n\n/**\n * Minimum perceptual distance between colors to ensure visual distinction\n * Based on weighted HSL distance calculation optimized for chart readability\n */\nconst MIN_COLOR_DISTANCE = 25;\n\n/**\n * Maximum attempts to find a sufficiently different color\n * Prevents infinite loops while allowing reasonable search space\n */\nconst MAX_COLOR_GENERATION_ATTEMPTS = 50;\n\n/**\n * Color variation attempt offset\n * Small increment to explore slightly different color variations per attempt\n */\nconst VARIATION_ATTEMPT_OFFSET = 0.1;\n\n// Saturation configuration for generated colors\n\n/**\n * Base saturation percentage for generated colors\n * 45% provides muted, professional colors without being washed out\n */\nconst BASE_SATURATION = 45;\n\n/**\n * Number of saturation variation steps\n * Creates 3 different saturation levels for variety\n */\nconst SATURATION_VARIATION_STEPS = 3;\n\n/**\n * Saturation increment per variation step\n * 10% increments provide subtle variation while keeping colors muted\n * Results in saturation levels: 45%, 55%, 65%\n */\nconst SATURATION_INCREMENT = 10;\n\n// Lightness configuration for WCAG AA accessibility compliance\n\n/**\n * Base lightness percentage for generated colors\n * 35% ensures sufficient contrast against white backgrounds for WCAG AA compliance\n * WCAG AA requires 4.5:1 contrast ratio for normal text\n */\nconst BASE_LIGHTNESS = 35;\n\n/**\n * Number of lightness variation steps\n * Creates 4 different lightness levels for variety\n */\nconst LIGHTNESS_VARIATION_STEPS = 4;\n\n/**\n * Lightness increment per variation step\n * 8% increments provide subtle lightness variation while maintaining accessibility\n * Results in lightness levels: 35%, 43%, 51%, 59%\n * All levels maintain WCAG AA compliance against white backgrounds\n */\nconst LIGHTNESS_INCREMENT = 8;\n\n// Hue range expansion and constraints\n\n/**\n * Minimum hue range in degrees to ensure sufficient color variety\n * 60 degrees provides reasonable color spread even for narrow palettes\n */\nconst MIN_HUE_RANGE_DEGREES = 60;\n\n/**\n * Hue range expansion factor\n * 1.3x expansion provides slightly more variety than the original palette\n */\nconst HUE_RANGE_EXPANSION_FACTOR = 1.3;\n\n/**\n * Threshold for detecting hue wrap-around (color wheel boundary crossing)\n * 180 degrees indicates the colors span more than half the color wheel\n */\nconst HUE_WRAP_THRESHOLD_DEGREES = 180;\n\n/**\n * Full color wheel rotation in degrees\n */\nconst FULL_HUE_ROTATION_DEGREES = 360;\n\n/**\n * Factor for single color hue range\n */\nconst SINGLE_COLOR_HUE_RANGE_FACTOR = 0.33;\n\n/**\n * Get a color from the colors array or generate a new color using the golden ratio\n *\n * @param index - the index of the color to get\n * @param colorCache - pre-computed color data for performance\n * @return a color from the colors array or a new color using the golden ratio\n */\nexport const getChartColor = ( index: number, colorCache: ColorCache ): string => {\n\tconst {\n\t\tcolors,\n\t\thues,\n\t\texistingHslColors,\n\t\tminHue: cachedMinHue,\n\t\tmaxHue: cachedMaxHue,\n\t} = colorCache;\n\n\tif ( index < colors.length ) {\n\t\treturn colors[ index ];\n\t}\n\n\tlet minHue = cachedMinHue;\n\tlet maxHue = cachedMaxHue;\n\n\t// Generate additional colors using golden ratio, avoiding similar colors\n\tfor ( let attempt = 0; attempt < MAX_COLOR_GENERATION_ATTEMPTS; attempt++ ) {\n\t\t// Calculate hue using golden ratio distribution with variation per attempt\n\t\t// Formula: ((base_index + attempt_variation) * golden_ratio * 360°) mod 360°\n\t\t// This ensures mathematically pleasing spacing while allowing slight shifts per attempt\n\t\tlet hue =\n\t\t\t( ( index - colors.length + attempt * VARIATION_ATTEMPT_OFFSET ) *\n\t\t\t\tGOLDEN_RATIO *\n\t\t\t\tFULL_HUE_ROTATION_DEGREES ) %\n\t\t\tFULL_HUE_ROTATION_DEGREES;\n\n\t\t// If we have existing colors, constrain new colors to their hue range\n\t\tif ( hues.length > 0 ) {\n\t\t\t// Handle hue wrap-around (e.g., if colors span across 0 degrees)\n\t\t\tlet hueRange = maxHue - minHue;\n\n\t\t\t// If there's only one color, use a set hue range for limited variety\n\t\t\tif ( hues.length === 1 ) {\n\t\t\t\thueRange = FULL_HUE_ROTATION_DEGREES * SINGLE_COLOR_HUE_RANGE_FACTOR;\n\t\t\t} else if ( hueRange > HUE_WRAP_THRESHOLD_DEGREES ) {\n\t\t\t\t// If the range is very large, it might be wrapping around the color wheel\n\t\t\t\t// Check if a smaller range exists when considering wrap-around\n\t\t\t\tconst altMinHue = Math.min( ...hues.filter( h => h > HUE_WRAP_THRESHOLD_DEGREES ) );\n\t\t\t\tconst altMaxHue =\n\t\t\t\t\tMath.max( ...hues.filter( h => h < HUE_WRAP_THRESHOLD_DEGREES ) ) +\n\t\t\t\t\tFULL_HUE_ROTATION_DEGREES;\n\t\t\t\tconst altRange = altMaxHue - altMinHue;\n\n\t\t\t\tif ( altRange < hueRange ) {\n\t\t\t\t\tminHue = altMinHue;\n\t\t\t\t\tmaxHue = altMaxHue;\n\t\t\t\t\thueRange = altRange;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Expand the range slightly to provide some variation\n\t\t\tconst expandedRange = Math.max(\n\t\t\t\thueRange * HUE_RANGE_EXPANSION_FACTOR,\n\t\t\t\tMIN_HUE_RANGE_DEGREES\n\t\t\t);\n\t\t\tconst rangeCenter = ( minHue + maxHue ) / 2;\n\t\t\tconst expandedMin = rangeCenter - expandedRange / 2;\n\n\t\t\t// Map the generated hue to the expanded range\n\t\t\thue = expandedMin + ( hue / FULL_HUE_ROTATION_DEGREES ) * expandedRange;\n\n\t\t\t// Normalize to 0-360 range\n\t\t\thue =\n\t\t\t\t( ( hue % FULL_HUE_ROTATION_DEGREES ) + FULL_HUE_ROTATION_DEGREES ) %\n\t\t\t\tFULL_HUE_ROTATION_DEGREES;\n\t\t}\n\n\t\tconst saturation =\n\t\t\tBASE_SATURATION + ( ( index + attempt ) % SATURATION_VARIATION_STEPS ) * SATURATION_INCREMENT;\n\t\tconst lightness =\n\t\t\tBASE_LIGHTNESS + ( ( index + attempt ) % LIGHTNESS_VARIATION_STEPS ) * LIGHTNESS_INCREMENT;\n\n\t\tconst candidateHsl: [ number, number, number ] = [ hue, saturation, lightness ];\n\n\t\t// Check if this color is sufficiently different from existing colors\n\t\tlet isSufficientlyDifferent = true;\n\t\tfor ( const existingHsl of existingHslColors ) {\n\t\t\tif ( getColorDistance( candidateHsl, existingHsl ) < MIN_COLOR_DISTANCE ) {\n\t\t\t\tisSufficientlyDifferent = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif ( isSufficientlyDifferent ) {\n\t\t\t// d3-color uses 0-1 scale for saturation and lightness\n\t\t\treturn d3Hsl( Math.round( hue ), saturation / 100, lightness / 100 ).formatHex();\n\t\t}\n\t}\n\n\t// Fallback if we couldn't find a sufficiently different color\n\t// Formula: ((base_index) * golden_ratio * 360°) mod 360°\n\t// This ensures mathematically pleasing spacing while maintaining consistency\n\tconst fallbackHue =\n\t\t( ( index - colors.length ) * GOLDEN_RATIO * FULL_HUE_ROTATION_DEGREES ) %\n\t\tFULL_HUE_ROTATION_DEGREES;\n\tconst fallbackSaturation =\n\t\tBASE_SATURATION + ( index % SATURATION_VARIATION_STEPS ) * SATURATION_INCREMENT;\n\tconst fallbackLightness =\n\t\tBASE_LIGHTNESS + ( index % LIGHTNESS_VARIATION_STEPS ) * LIGHTNESS_INCREMENT;\n\t// d3-color uses 0-1 scale for saturation and lightness\n\treturn d3Hsl(\n\t\tMath.round( fallbackHue ),\n\t\tfallbackSaturation / 100,\n\t\tfallbackLightness / 100\n\t).formatHex();\n};\n","import type { ChartTheme } from '../../../types';\n\n// The consumer theme fields that correspond to an emitted catalog role, and the role each one overrides. Each role must be read by exactly the elements its field controlled before the role existed: `svgLabelSmall.fill` maps to the narrow `--a8c-charts-color-label-axis` rather than `--a8c-charts-color-label`, because the broad role is also read by legend labels, heatmap cell values, funnel labels and the line-chart tooltip, which that field never moved.\nconst ROLE_FOR_FIELD: Array< [ string, ( theme: Partial< ChartTheme > ) => string | undefined ] > =\n\t[\n\t\t[ '--a8c-charts-color-background', theme => theme.backgroundColor ],\n\t\t[ '--a8c-charts-color-grid', theme => theme.gridStyles?.stroke ],\n\t\t[ '--a8c-charts-color-axis', theme => theme.xAxisLineStyles?.stroke ],\n\t\t[ '--a8c-charts-color-tick', theme => theme.xTickLineStyles?.stroke ],\n\t\t[ '--a8c-charts-color-label-axis', theme => theme.svgLabelSmall?.fill ],\n\t];\n\n/**\n * The variable a `theme` prop override is published as, one layer outside the role itself.\n *\n * `chart-scope.scss` declares each of these roles as `var(<role>-theme, <catalog default>)`, so an override that is invalid at computed-value time — a fallback-less `var()` naming a token the host never set — only invalidates this variable, and the role still resolves its mapped `--wpds-*` token. Published as the role directly, such a value took the role and every bare `var(<role>)` read site down with it.\n *\n * @param role - The catalog role being overridden.\n * @return The custom property carrying the consumer's value.\n */\nexport const themeLayerVar = ( role: string ): string => `${ role }-theme`;\n\n/** Every role whose catalog entry must read a theme layer. `src/styles/test/chart-scope.test.ts` checks the stylesheet against this. */\nexport const THEME_LAYERED_ROLES: readonly string[] = ROLE_FOR_FIELD.map( ( [ role ] ) => role );\n\n/**\n * Whether a value reads the role it is being published for, which would make the catalog entry depend on itself.\n *\n * The dependency runs `<role>: var(<role>-theme, …)`, so a value naming `<role>` closes a cycle through the catalog entry. CSS marks every custom property in a cycle invalid at computed-value time — the role's own fallback is *not* used, so the token resolves to nothing and every chart loses that colour. Verified in Chrome: `--role-theme: var(--role, blue); --role: var(--role-theme, green)` leaves `--role` empty, not `green`.\n *\n * Three things this has to get right, none of which a plain substring test gets:\n *\n * `var()` permits whitespace after the opening paren, so testing for `var(<role>` misses `var( --a8c-charts-color-grid, … )`.\n *\n * Several roles are prefixes of others (`--a8c-charts-color-label` of `--a8c-charts-color-label-secondary`), and every role is a prefix of its own theme layer. A prefix match would read a legitimate cross-role pointer as a self-reference and silently drop the override, so the role must be followed by something that cannot continue an identifier — `-` included. A value naming `<role>-theme` is therefore not treated as a self-reference: that cycle is confined to the theme layer, which leaves the role free to fall back to the catalog default.\n *\n * `resolveCssVariable` also accepts a bare custom-property name with no `var()` wrapper (`--a8c-charts-color-grid`), so that is legal `theme` input too. It forms no cycle — custom properties accept arbitrary token streams — so it survives as a literal string and drops silently at the use site instead of falling back to the catalog default.\n *\n * @param value - The consumer's value for the field.\n * @param role - The catalog role this value would override.\n * @return True when the value reads `role`, so it must not be published.\n */\nconst readsOwnRole = ( value: string, role: string ): boolean =>\n\tvalue.trim() === role ||\n\tnew RegExp( `var\\\\(\\\\s*${ role.replace( /[.*+?^${}()|[\\]\\\\]/g, '\\\\$&' ) }(?![\\\\w-])` ).test(\n\t\tvalue\n\t);\n\nexport type ThemeOverrides = {\n\t/** The custom properties to write on the provider wrapper. */\n\tvars: Record< string, string >;\n\t/** Every mapped role the consumer set a value for, whether or not it was published. */\n\troles: readonly string[];\n};\n\n/**\n * Maps a sparse consumer theme onto the theme-layer variables its overridden catalog roles read, so CSS-painted and JS-resolved colours read one source.\n *\n * A value that reads the role it would override is left unpublished — that is the default theme's own pointer surviving `mergeThemes`, and publishing it would invalidate the role. The role is still reported in `roles`: `withCatalogPointers` restores its theme field to the catalog pointer either way, so CSS and visx agree on the catalog default rather than visx painting a literal CSS never sees.\n *\n * @param theme - The consumer's `theme` prop, before merging with the default theme.\n * @return The wrapper's custom properties, and the roles the consumer overrode.\n */\nexport const themeOverrideVars = ( theme?: Partial< ChartTheme > ): ThemeOverrides => {\n\tif ( ! theme ) {\n\t\treturn { vars: {}, roles: [] };\n\t}\n\n\tconst vars: Record< string, string > = {};\n\tconst roles: string[] = [];\n\n\tfor ( const [ role, read ] of ROLE_FOR_FIELD ) {\n\t\tconst value = read( theme );\n\n\t\tif ( typeof value !== 'string' || value === '' ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\troles.push( role );\n\n\t\tif ( ! readsOwnRole( value, role ) ) {\n\t\t\tvars[ themeLayerVar( role ) ] = value;\n\t\t}\n\t}\n\n\treturn { vars, roles };\n};\n","import type { CompleteChartTheme } from '../../types';\n\n/**\n * Default theme configuration\n */\nconst defaultTheme: CompleteChartTheme = {\n\tbackgroundColor: 'var(--a8c-charts-color-background, #fff)',\n\tlabelBackgroundColor: 'transparent', // label background color (transparent by default)\n\t// White label text sits on top of arbitrary series colors, so it has no WPDS content-foreground equivalent. Every other colour here is a bare pointer at the catalog emitted by `chart-scope.scss`; the terminal literal is the last resort for the SSR and jsdom paths, where getComputedStyle resolves nothing.\n\tlabelTextColor: 'var(--a8c-charts-color-label-on-fill, #FFFFFF)',\n\tcolors: [ '#98C8DF', '#006DAB', '#A6DC80', '#1F9828', '#FF8C8F' ],\n\tgridStyles: {\n\t\tstroke: 'var(--a8c-charts-color-grid, #dbdbdb)',\n\t\tstrokeWidth: 1,\n\t},\n\ttickLength: 4,\n\tgridColor: '',\n\tgridColorDark: '',\n\txTickLineStyles: {\n\t\tstroke: 'var(--a8c-charts-color-tick, #dbdbdb)',\n\t\tstrokeWidth: 1,\n\t},\n\txAxisLineStyles: {\n\t\tstroke: 'var(--a8c-charts-color-axis, #dbdbdb)',\n\t\tstrokeWidth: 1,\n\t},\n\tlegend: {\n\t\tlabelStyles: {\n\t\t\tcolor: 'var(--a8c-charts-color-label, #1e1e1e)',\n\t\t},\n\t\tcontainerStyles: {},\n\t\tshapeStyles: [],\n\t},\n\tseriesLineStyles: [],\n\tglyphs: [],\n\t// `fontFamily: 'inherit'` overrides visx's hardcoded default font stack\n\t// (`-apple-system,BlinkMacSystemFont,Roboto,Helvetica Neue,sans-serif`)\n\t// that `buildChartTheme` injects as an inline style on SVG `<text>`\n\t// elements for axis labels and ticks. Setting `inherit` lets SVG text\n\t// pick up the host application's font-family via normal CSS inheritance.\n\tsvgLabelSmall: {\n\t\tfill: 'var(--a8c-charts-color-label-axis, #1e1e1e)',\n\t\tfontFamily: 'inherit',\n\t},\n\tsvgLabelBig: { fontFamily: 'inherit' },\n\tannotationStyles: {\n\t\tlabel: {\n\t\t\tanchorLineStroke: 'var(--a8c-charts-color-annotation, #1e1e1e)',\n\t\t\tbackgroundFill: 'var(--a8c-charts-color-surface, #fff)',\n\t\t},\n\t\tconnector: {\n\t\t\tstroke: 'var(--a8c-charts-color-annotation, #1e1e1e)',\n\t\t},\n\t\tcircleSubject: {\n\t\t\tstroke: 'transparent',\n\t\t\tfill: 'var(--a8c-charts-color-annotation, #1e1e1e)',\n\t\t\tradius: 5,\n\t\t},\n\t},\n\tgeoChart: {\n\t\tfeatureFillColor: 'var(--a8c-charts-color-surface-secondary, #f4f4f4)',\n\t},\n\tleaderboardChart: {\n\t\trowGap: 12,\n\t\tcolumnGap: 4,\n\t\tlabelSpacing: 'xs',\n\t\t// [negative, neutral, positive]\n\t\tdeltaColors: [\n\t\t\t'var(--a8c-charts-color-trend-down, #cc1818)',\n\t\t\t'var(--a8c-charts-color-trend-neutral, #707070)',\n\t\t\t'var(--a8c-charts-color-trend-up, #008030)',\n\t\t],\n\t},\n\tconversionFunnelChart: {\n\t\tbackgroundColor: 'var(--a8c-charts-color-surface-secondary, #f4f4f4)',\n\t\tpositiveChangeColor: 'var(--a8c-charts-color-trend-up, #008030)',\n\t\tnegativeChangeColor: 'var(--a8c-charts-color-trend-down, #cc1818)',\n\t},\n\tlineChart: {\n\t\tlineStyles: {\n\t\t\tcomparison: {\n\t\t\t\tstrokeDasharray: '4 4',\n\t\t\t\tstrokeLinecap: 'square',\n\t\t\t},\n\t\t},\n\t},\n\tbarChart: {\n\t\tbarStyles: {\n\t\t\tcomparison: {\n\t\t\t\twidthFactor: 1.5,\n\t\t\t\topacity: 0.5,\n\t\t\t},\n\t\t},\n\t},\n\tsparkline: {\n\t\tmargin: { top: 2, right: 2, bottom: 2, left: 2 },\n\t\tstrokeWidth: 1.5,\n\t},\n\t// `primaryColor` is left unset so it falls back to the palette's `colors[0]`. The compact\n\t// 11px square / 2px gap is the contribution-graph rhythm, which has no WPDS dimension.\n\theatmapChart: {\n\t\tcompactCellGap: 2,\n\t\tcompactCellSize: 11,\n\t},\n};\n\nexport { defaultTheme };\n","import { defaultTheme } from '../themes';\nimport type { CompleteChartTheme } from '../../../types';\n\n// Restores each overridden role's mapped theme field to the catalog pointer `defaultTheme` already carries for it, so the value comes from `themes.ts` itself rather than a second, hand-copied literal.\nconst CATALOG_RESTORE_FOR_ROLE: Record<\n\tstring,\n\t( theme: CompleteChartTheme ) => Partial< CompleteChartTheme >\n> = {\n\t'--a8c-charts-color-background': () => ( { backgroundColor: defaultTheme.backgroundColor } ),\n\t'--a8c-charts-color-grid': theme => ( {\n\t\tgridStyles: { ...theme.gridStyles, stroke: defaultTheme.gridStyles.stroke },\n\t} ),\n\t'--a8c-charts-color-axis': theme => ( {\n\t\txAxisLineStyles: { ...theme.xAxisLineStyles, stroke: defaultTheme.xAxisLineStyles.stroke },\n\t} ),\n\t'--a8c-charts-color-tick': theme => ( {\n\t\txTickLineStyles: { ...theme.xTickLineStyles, stroke: defaultTheme.xTickLineStyles.stroke },\n\t} ),\n\t'--a8c-charts-color-label-axis': theme => ( {\n\t\tsvgLabelSmall: { ...theme.svgLabelSmall, fill: defaultTheme.svgLabelSmall.fill },\n\t} ),\n};\n\n/**\n * Restores the mapped theme fields of `overriddenRoles` to their catalog pointer, so the theme-layer variable `themeOverrideVars` writes on the provider wrapper is the only carrier for an overridden role — CSS and the JS bridge (`useXYChartTheme`) then resolve it through the same cascade instead of visx reading a baked literal that can disagree with a closer CSS override.\n *\n * This covers roles `themeOverrideVars` deliberately left unpublished as well as the ones it published. A value that reads its own role is not publishable, but leaving visx the consumer's literal is what the whole mechanism exists to prevent: `theme={ { gridStyles: { stroke: 'var(--brand, var(--a8c-charts-color-grid, red))' } } }` would have CSS paint the catalog default while visx painted `--brand`.\n *\n * Every field outside the five mapped roles is left exactly as `merged` provided it: those aren't published as theme-layer vars, so rewriting them would erase a consumer's override with no replacement carrier.\n *\n * @param merged - The consumer theme merged onto `defaultTheme` (`mergeThemes` output).\n * @param overriddenRoles - The catalog roles the consumer overrode, from `themeOverrideVars`.\n * @return A new theme object; `merged` is not mutated.\n */\nexport const withCatalogPointers = (\n\tmerged: CompleteChartTheme,\n\toverriddenRoles: readonly string[]\n): CompleteChartTheme => {\n\tlet result = merged;\n\n\tfor ( const role of overriddenRoles ) {\n\t\tconst restore = CATALOG_RESTORE_FOR_ROLE[ role ];\n\n\t\tif ( restore ) {\n\t\t\tresult = { ...result, ...restore( result ) };\n\t\t}\n\t}\n\n\treturn result;\n};\n","import { hsl as d3Hsl } from '@visx/vendor/d3-color';\nimport {\n\tcreateContext,\n\tuseCallback,\n\tuseMemo,\n\tuseState,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseRef,\n} from 'react';\n// Side-effect import: emits the `--a8c-charts-*` catalog, scoped to the `a8c-charts-scope` class applied to this component's wrapper below. Every chart either sits under a `GlobalChartsProvider` or auto-mounts its own, so importing it here guarantees the catalog always reaches the bundle.\n//\n// This must be a direct import of the stylesheet, not through a re-export barrel: a barrel `.ts` file doesn't match this package's `sideEffects` glob (only `*.css`/`*.scss` do), so tsdown/Rolldown treats an unused barrel import as side-effect-free and drops it — taking the nested stylesheet import with it. The file also can't be named `*.module.scss`: it declares zero CSS-module class names (only a `:where()`-wrapped selector), and `@tsdown/css` marks a `.module.*` file's generated JS proxy `moduleSideEffects: false` (tree-shakeable unless a class name is read); a plain stylesheet gets `moduleSideEffects: \"no-treeshake\"` instead, so it always ships. `tools/assert-charts-scope-emitted.ts` fails `pnpm run build` if this regresses — a passing test suite alone does not catch a dropped stylesheet.\nimport '../../styles/chart-scope.scss';\nimport { CHART_SCOPE_CLASS } from '../../styles/chart-scope-class';\nimport {\n\tgetItemShapeStyles,\n\tgetSeriesBarStyles,\n\tgetSeriesLineStyles,\n\tmergeThemes,\n\tresolveCssVariable,\n\tnormalizeColorToHex,\n} from '../../utils';\n// Imported from the module rather than the `chart-scope` barrel: the barrel also pulls `use-standalone-scope-class`, which imports `GlobalChartsContext` back from this file. That cycle resolves today only because the binding is read lazily inside the hook body.\nimport { ChartScopeContext } from '../chart-scope/chart-scope-context';\nimport { getChartColor, type ColorCache } from './private/get-chart-color';\nimport { themeOverrideVars } from './private/theme-override-vars';\nimport { withCatalogPointers } from './private/with-catalog-pointers';\nimport { defaultTheme } from './themes';\nimport type { GlobalChartsContextValue, ChartRegistration } from './types';\nimport type { ChartTheme, CompleteChartTheme } from '../../types';\nimport type { CSSProperties, FC, ReactNode } from 'react';\n\nexport const GlobalChartsContext = createContext< GlobalChartsContextValue | null >( null );\n\nexport interface GlobalChartsProviderProps {\n\tchildren: ReactNode;\n\ttheme?: Partial< ChartTheme >;\n}\n\nexport const GlobalChartsProvider: FC< GlobalChartsProviderProps > = ( { children, theme } ) => {\n\tconst [ charts, setCharts ] = useState< Map< string, ChartRegistration > >( () => new Map() );\n\t// Track hidden series per chart: chartId -> Set<seriesLabel>\n\tconst [ hiddenSeries, setHiddenSeries ] = useState< Map< string, Set< string > > >(\n\t\t() => new Map()\n\t);\n\t// Which charts have had their defaults seeded. Kept apart from `hiddenSeries`\n\t// because that map drops a chart's entry once its hidden set empties, so an\n\t// absent entry cannot tell \"never seeded\" from \"the reader revealed the lot\".\n\tconst seededCharts = useRef< Set< string > >( new Set() );\n\n\t// Ref to the wrapper element for resolving scoped CSS variables\n\tconst wrapperRef = useRef< HTMLDivElement >( null );\n\tconst [ scopeNode, setScopeNode ] = useState< HTMLElement | null >( null );\n\n\tconst setWrapperNode = useCallback( ( node: HTMLDivElement | null ) => {\n\t\twrapperRef.current = node;\n\t\tsetScopeNode( node );\n\t}, [] );\n\n\t// themeOverrideVars reads the raw `theme` prop, never `providerTheme` — feeding it the restored theme below would make an overridden role's pointer look like a self-reference and drop the var (see themeOverrideVars' own doc comment).\n\tconst { vars: overrideVars, roles: overriddenRoles } = useMemo(\n\t\t() => themeOverrideVars( theme ),\n\t\t[ theme ]\n\t);\n\n\tconst providerTheme: CompleteChartTheme = useMemo( () => {\n\t\tif ( ! theme ) {\n\t\t\treturn defaultTheme;\n\t\t}\n\n\t\treturn withCatalogPointers( mergeThemes( defaultTheme, theme ), overriddenRoles );\n\t}, [ theme, overriddenRoles ] );\n\n\t// Cache expensive color computations that only change when theme colors change\n\t// Using useState + useLayoutEffect instead of useMemo to ensure CSS variables\n\t// in <style> tags are applied to the DOM before we try to resolve them\n\tconst [ colorCache, setColorCache ] = useState< ColorCache >( () => ( {\n\t\tcolors: [],\n\t\thues: [],\n\t\texistingHslColors: [],\n\t\tminHue: 360,\n\t\tmaxHue: 0,\n\t} ) );\n\n\t// Track if the color palette has been resolved from the DOM\n\t// Useful for animations that should only run after the color palette is resolved\n\tconst [ isColorPaletteResolved, setIsColorPaletteResolved ] = useState( false );\n\n\t// Compute color cache after DOM is updated (so CSS variables are available)\n\t// Resolves CSS variables from the wrapper element's scope to handle scoped variables\n\t// Note: Only re-runs when providerTheme changes, not when wrapper element changes.\n\t// This is intentional, as wrapperRef is expected to be stable for the lifetime of the provider.\n\tuseLayoutEffect( () => {\n\t\tsetIsColorPaletteResolved( false );\n\t\tconst { colors } = providerTheme;\n\t\tconst resolvedColors: string[] = [];\n\t\tconst hues: number[] = [];\n\t\tconst existingHslColors: Array< [ number, number, number ] > = [];\n\t\tlet minHue = 360;\n\t\tlet maxHue = 0;\n\n\t\t// Process all colors once and cache the results\n\t\tif ( Array.isArray( colors ) ) {\n\t\t\tfor ( const color of colors ) {\n\t\t\t\tif ( color && typeof color === 'string' ) {\n\t\t\t\t\t// Normalize color to hex format, handling CSS variables, RGB, HSL, etc.\n\t\t\t\t\t// This uses normalizeColorToHex which resolves CSS variables and converts\n\t\t\t\t\t// rgb(), rgba(), hsl() formats to hex\n\t\t\t\t\tconst normalizedColor = normalizeColorToHex(\n\t\t\t\t\t\tcolor,\n\t\t\t\t\t\twrapperRef.current,\n\t\t\t\t\t\tresolveCssVariable\n\t\t\t\t\t);\n\n\t\t\t\t\t// Only process valid hex colors\n\t\t\t\t\tif ( normalizedColor.startsWith( '#' ) ) {\n\t\t\t\t\t\tresolvedColors.push( normalizedColor );\n\t\t\t\t\t\tconst hslColor = d3Hsl( normalizedColor );\n\t\t\t\t\t\t// d3Hsl returns NaN values for invalid colors\n\t\t\t\t\t\tif ( ! isNaN( hslColor.h ) ) {\n\t\t\t\t\t\t\tconst hslTuple: [ number, number, number ] = [\n\t\t\t\t\t\t\t\thslColor.h,\n\t\t\t\t\t\t\t\thslColor.s * 100,\n\t\t\t\t\t\t\t\thslColor.l * 100,\n\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\thues.push( hslTuple[ 0 ] );\n\t\t\t\t\t\t\texistingHslColors.push( hslTuple );\n\t\t\t\t\t\t\tminHue = Math.min( minHue, hslTuple[ 0 ] );\n\t\t\t\t\t\t\tmaxHue = Math.max( maxHue, hslTuple[ 0 ] );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tsetColorCache( {\n\t\t\tcolors: resolvedColors,\n\t\t\thues,\n\t\t\texistingHslColors,\n\t\t\tminHue,\n\t\t\tmaxHue,\n\t\t} );\n\t}, [ providerTheme ] );\n\n\tuseEffect( () => {\n\t\tif ( colorCache.colors.length > 0 ) {\n\t\t\tsetIsColorPaletteResolved( true );\n\t\t}\n\t}, [ colorCache ] );\n\n\tconst [ groupToColorMap, setGroupToColorMap ] = useState< Map< string, string > >(\n\t\t() => new Map()\n\t);\n\n\t// Reset group color mappings when theme colors change\n\tuseEffect( () => {\n\t\t// Create a completely new Map instance to trigger dependencies, e.g. useChartLegendItems\n\t\tsetGroupToColorMap( new Map() );\n\t}, [ providerTheme.colors ] );\n\n\tconst registerChart = useCallback( ( id: string, data: ChartRegistration ) => {\n\t\tsetCharts( prev => new Map( prev ).set( id, data ) );\n\t}, [] );\n\n\tconst unregisterChart = useCallback( ( id: string ) => {\n\t\tsetCharts( prev => {\n\t\t\tconst newMap = new Map( prev );\n\t\t\tnewMap.delete( id );\n\t\t\treturn newMap;\n\t\t} );\n\t}, [] );\n\n\tconst getChartData = useCallback(\n\t\t( id: string ) => {\n\t\t\treturn charts.get( id );\n\t\t},\n\t\t[ charts ]\n\t);\n\n\tconst resolveColor = useCallback(\n\t\t( {\n\t\t\tgroup,\n\t\t\tindex,\n\t\t\toverrideColor,\n\t\t}: {\n\t\t\tgroup?: string;\n\t\t\tindex: number;\n\t\t\toverrideColor?: string;\n\t\t} ): string => {\n\t\t\t// Highest precedence: eg. explicit series stroke or chart color prop\n\t\t\tif ( overrideColor ) {\n\t\t\t\treturn normalizeColorToHex( overrideColor, wrapperRef.current, resolveCssVariable );\n\t\t\t}\n\n\t\t\t// If group provided, maintain a stable assignment\n\t\t\tif ( group ) {\n\t\t\t\tconst existing = groupToColorMap.get( group );\n\n\t\t\t\tif ( existing ) {\n\t\t\t\t\treturn existing;\n\t\t\t\t}\n\n\t\t\t\t// Use map size as index to assign colors sequentially (0, 1, 2...)\n\t\t\t\t// ensuring each new group gets the next available palette color\n\t\t\t\tconst assignedCount = groupToColorMap.size;\n\t\t\t\tconst color = getChartColor( assignedCount, colorCache );\n\t\t\t\tgroupToColorMap.set( group, color );\n\n\t\t\t\treturn color;\n\t\t\t}\n\n\t\t\treturn getChartColor( index, colorCache );\n\t\t},\n\t\t[ colorCache, groupToColorMap ]\n\t);\n\n\tconst getElementStyles = useCallback< GlobalChartsContextValue[ 'getElementStyles' ] >(\n\t\t( { data, index, overrideColor, legendShape } ) => {\n\t\t\tconst isSeriesData = data && typeof data === 'object' && 'data' in data && 'options' in data;\n\t\t\t// DataPointPercentage has a numeric 'value' directly, unlike SeriesData which has 'data' array\n\t\t\tconst isPointPercentageData =\n\t\t\t\tdata &&\n\t\t\t\ttypeof data === 'object' &&\n\t\t\t\t'value' in data &&\n\t\t\t\ttypeof data.value === 'number' &&\n\t\t\t\t! ( 'data' in data );\n\n\t\t\treturn {\n\t\t\t\tcolor: resolveColor( {\n\t\t\t\t\tgroup: data?.group,\n\t\t\t\t\tindex,\n\t\t\t\t\toverrideColor:\n\t\t\t\t\t\toverrideColor ||\n\t\t\t\t\t\t( isSeriesData && data?.options?.stroke ) ||\n\t\t\t\t\t\t( isPointPercentageData && data?.color ),\n\t\t\t\t} ),\n\t\t\t\tlineStyles: isSeriesData ? getSeriesLineStyles( data, index, providerTheme ) : {},\n\t\t\t\tbarStyles: isSeriesData ? getSeriesBarStyles( data, index, providerTheme ) : {},\n\t\t\t\tglyph: providerTheme.glyphs?.[ index ],\n\t\t\t\tshapeStyles: isSeriesData\n\t\t\t\t\t? getItemShapeStyles( data, index, providerTheme, legendShape )\n\t\t\t\t\t: {},\n\t\t\t};\n\t\t},\n\t\t[ providerTheme, resolveColor ]\n\t);\n\n\t// Keep hidden-series updates and no-op detection consistent across setters.\n\tconst updateHiddenSeries = useCallback(\n\t\t( chartId: string, update: ( current: Set< string > ) => Set< string > ) => {\n\t\t\tsetHiddenSeries( prev => {\n\t\t\t\tconst current = prev.get( chartId );\n\t\t\t\tconst next = update( new Set( current ?? [] ) );\n\n\t\t\t\tif ( ! current && next.size === 0 ) {\n\t\t\t\t\treturn prev;\n\t\t\t\t}\n\n\t\t\t\t// Preserve identity for no-op updates.\n\t\t\t\tif (\n\t\t\t\t\tcurrent &&\n\t\t\t\t\tcurrent.size === next.size &&\n\t\t\t\t\t[ ...next ].every( label => current.has( label ) )\n\t\t\t\t) {\n\t\t\t\t\treturn prev;\n\t\t\t\t}\n\n\t\t\t\tconst newMap = new Map( prev );\n\t\t\t\tif ( next.size === 0 ) {\n\t\t\t\t\tnewMap.delete( chartId );\n\t\t\t\t} else {\n\t\t\t\t\tnewMap.set( chartId, next );\n\t\t\t\t}\n\n\t\t\t\treturn newMap;\n\t\t\t} );\n\t\t},\n\t\t[]\n\t);\n\n\tconst toggleSeriesVisibility = useCallback(\n\t\t( chartId: string, seriesLabel: string ) => {\n\t\t\tupdateHiddenSeries( chartId, current => {\n\t\t\t\tif ( current.has( seriesLabel ) ) {\n\t\t\t\t\tcurrent.delete( seriesLabel );\n\t\t\t\t} else {\n\t\t\t\t\tcurrent.add( seriesLabel );\n\t\t\t\t}\n\t\t\t\treturn current;\n\t\t\t} );\n\t\t},\n\t\t[ updateHiddenSeries ]\n\t);\n\n\tconst setSeriesVisibility = useCallback(\n\t\t( chartId: string, seriesLabel: string, visible: boolean ) => {\n\t\t\tupdateHiddenSeries( chartId, current => {\n\t\t\t\tif ( visible ) {\n\t\t\t\t\tcurrent.delete( seriesLabel );\n\t\t\t\t} else {\n\t\t\t\t\tcurrent.add( seriesLabel );\n\t\t\t\t}\n\t\t\t\treturn current;\n\t\t\t} );\n\t\t},\n\t\t[ updateHiddenSeries ]\n\t);\n\n\tconst setChartHiddenSeries = useCallback(\n\t\t( chartId: string, seriesLabels: readonly string[] ) => {\n\t\t\tupdateHiddenSeries( chartId, () => new Set( seriesLabels ) );\n\t\t},\n\t\t[ updateHiddenSeries ]\n\t);\n\n\tconst hasSeededChart = useCallback(\n\t\t( chartId: string ) => seededCharts.current.has( chartId ),\n\t\t[]\n\t);\n\n\tconst seedChartHiddenSeries = useCallback(\n\t\t( chartId: string, seriesLabels: readonly string[] ) => {\n\t\t\tif ( seededCharts.current.has( chartId ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tseededCharts.current.add( chartId );\n\t\t\tsetChartHiddenSeries( chartId, seriesLabels );\n\t\t},\n\t\t[ setChartHiddenSeries ]\n\t);\n\n\tconst isSeriesVisible = useCallback(\n\t\t( chartId: string, seriesLabel: string ) => {\n\t\t\tconst chartHidden = hiddenSeries.get( chartId );\n\t\t\treturn ! chartHidden || ! chartHidden.has( seriesLabel );\n\t\t},\n\t\t[ hiddenSeries ]\n\t);\n\n\tconst getHiddenSeries = useCallback(\n\t\t( chartId: string ): Set< string > => {\n\t\t\tconst set = hiddenSeries.get( chartId );\n\t\t\treturn set ? new Set( set ) : new Set< string >();\n\t\t},\n\t\t[ hiddenSeries ]\n\t);\n\n\tconst value: GlobalChartsContextValue = useMemo(\n\t\t() => ( {\n\t\t\tcharts,\n\t\t\tregisterChart,\n\t\t\tunregisterChart,\n\t\t\tgetChartData,\n\t\t\ttheme: providerTheme,\n\t\t\tgetElementStyles,\n\t\t\ttoggleSeriesVisibility,\n\t\t\tsetSeriesVisibility,\n\t\t\tsetChartHiddenSeries,\n\t\t\tseedChartHiddenSeries,\n\t\t\thasSeededChart,\n\t\t\tisSeriesVisible,\n\t\t\tgetHiddenSeries,\n\t\t\tisColorPaletteResolved,\n\t\t} ),\n\t\t[\n\t\t\tcharts,\n\t\t\tregisterChart,\n\t\t\tunregisterChart,\n\t\t\tgetChartData,\n\t\t\tproviderTheme,\n\t\t\tgetElementStyles,\n\t\t\ttoggleSeriesVisibility,\n\t\t\tsetSeriesVisibility,\n\t\t\tsetChartHiddenSeries,\n\t\t\tseedChartHiddenSeries,\n\t\t\thasSeededChart,\n\t\t\tisSeriesVisible,\n\t\t\tgetHiddenSeries,\n\t\t\tisColorPaletteResolved,\n\t\t]\n\t);\n\n\treturn (\n\t\t<GlobalChartsContext.Provider value={ value }>\n\t\t\t<div\n\t\t\t\tref={ setWrapperNode }\n\t\t\t\tclassName={ CHART_SCOPE_CLASS }\n\t\t\t\tdata-testid=\"charts-scope\"\n\t\t\t\tstyle={ { display: 'contents', ...overrideVars } as CSSProperties }\n\t\t\t>\n\t\t\t\t<ChartScopeContext.Provider value={ scopeNode }>{ children }</ChartScopeContext.Provider>\n\t\t\t</div>\n\t\t</GlobalChartsContext.Provider>\n\t);\n};\n","import { useContext } from 'react';\nimport { GlobalChartsContext } from '../global-charts-provider';\nimport type { GlobalChartsContextValue } from '../types';\n\nexport const useGlobalChartsContext = (): GlobalChartsContextValue => {\n\tconst context = useContext( GlobalChartsContext );\n\tif ( ! context ) {\n\t\tthrow new Error( 'useGlobalChartsContext must be used within a GlobalChartsProvider' );\n\t}\n\treturn context;\n};\n","import { useId } from 'react';\n\nexport const useChartId = ( providedId?: string ): string => {\n\tconst generatedId = useId();\n\treturn providedId || generatedId;\n};\n","'use strict';\n\n// do not edit .js files directly - edit src/index.jst\n\n\n\nmodule.exports = function equal(a, b) {\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n\n for (i = length; i-- !== 0;) {\n var key = keys[i];\n\n if (!equal(a[key], b[key])) return false;\n }\n\n return true;\n }\n\n // true if both NaN, false otherwise\n return a!==a && b!==b;\n};\n","import isEqual from 'fast-deep-equal';\nimport { useRef } from 'react';\n\n/**\n * Custom hook to memoize a value using deep equality comparison.\n * Prevents unnecessary re-renders when objects have the same content but different references.\n *\n * @param value - The value to memoize with deep equality comparison\n * @return The memoized value that only changes when deeply different\n */\nexport const useDeepMemo = < T >( value: T ): T => {\n\tconst ref = useRef< T >( value );\n\n\tif ( ! isEqual( ref.current, value ) ) {\n\t\tref.current = value;\n\t}\n\n\treturn ref.current;\n};\n","import { useContext } from 'react';\nimport { ChartScopeContext } from './chart-scope-context';\n\n/**\n * Returns the nearest chart scope element, or `null` when rendered outside any scope (and during SSR, before the ref is attached).\n *\n * @return {HTMLElement | null} The nearest chart scope element, or `null`.\n */\nexport const useChartScopeElement = (): HTMLElement | null => useContext( ChartScopeContext );\n","import { useContext } from 'react';\nimport { CHART_SCOPE_CLASS } from '../../styles/chart-scope-class';\nimport { GlobalChartsContext } from '../chart-context/global-charts-provider';\n\n/**\n * Returns the catalog class when there is no `GlobalChartsProvider` above this component, and `undefined` when there is.\n *\n * Standalone components need the catalog to resolve at all, but inside a provider the tokens already inherit — re-declaring them there would shadow a consumer override set anywhere in the tree.\n *\n * @return The scope class name, or undefined when a provider is present.\n */\nexport const useStandaloneScopeClass = (): string | undefined =>\n\tuseContext( GlobalChartsContext ) ? undefined : CHART_SCOPE_CLASS;\n","import { buildChartTheme } from '@visx/xychart';\nimport { useMemo } from 'react';\nimport { useGlobalChartsTheme } from '../providers';\nimport { useChartScopeElement } from '../providers/chart-scope';\nimport { createCssVariableResolver } from '../utils';\nimport type { SeriesData } from '../types';\n\nexport const useXYChartTheme = ( data: SeriesData[] ) => {\n\tconst theme = useGlobalChartsTheme();\n\tconst scopeElement = useChartScopeElement();\n\n\t// The only thing the theme takes from `data` is the series strokes, so key the memo on those rather than on the array's identity. A caller passing an inline literal — `<LineChart data={ [ … ] } />`, which the stories and several consumers do — otherwise rebuilds the whole theme on every render. Serialised rather than joined: a stroke can be `rgba(0, 0, 0, 0.5)` or `var(--brand, #fff)`, and any separator that reads naturally inside a colour cannot round-trip.\n\tconst seriesColorKey = JSON.stringify(\n\t\t( data ?? [] )\n\t\t\t.map( series => series.options?.stroke )\n\t\t\t.filter( ( color ): color is string => Boolean( color ) )\n\t);\n\n\treturn useMemo( () => {\n\t\t// visx applies grid, axis, and tick-label colours as SVG presentation attributes, where CSS var() cannot resolve. Resolve the catalog token against the chart's own scope element — never :root — so this reads any override set inside the provider tree, the same one a CSS-painted element would inherit.\n\t\t//\n\t\t// One resolver per theme build, so the five roles below share a single getComputedStyle call rather than taking one each: this memo re-runs only when the scope element attaches or a series colour changes, which for a dashboard of charts is the difference between two style queries per chart and ten.\n\t\tconst resolve = createCssVariableResolver( scopeElement );\n\t\tconst resolveColor = ( value?: string ): string | undefined =>\n\t\t\tvalue ? resolve( value ) ?? value : value;\n\n\t\tconst seriesColors: string[] = JSON.parse( seriesColorKey );\n\n\t\treturn buildChartTheme( {\n\t\t\t...theme,\n\t\t\tcolors: [ ...seriesColors, ...( theme.colors ?? [] ) ],\n\t\t\tbackgroundColor: resolveColor( theme.backgroundColor ),\n\t\t\tgridStyles: theme.gridStyles && {\n\t\t\t\t...theme.gridStyles,\n\t\t\t\tstroke: resolveColor( theme.gridStyles.stroke ),\n\t\t\t},\n\t\t\txAxisLineStyles: theme.xAxisLineStyles && {\n\t\t\t\t...theme.xAxisLineStyles,\n\t\t\t\tstroke: resolveColor( theme.xAxisLineStyles.stroke ),\n\t\t\t},\n\t\t\txTickLineStyles: theme.xTickLineStyles && {\n\t\t\t\t...theme.xTickLineStyles,\n\t\t\t\tstroke: resolveColor( theme.xTickLineStyles.stroke ),\n\t\t\t},\n\t\t\tsvgLabelSmall: theme.svgLabelSmall && {\n\t\t\t\t...theme.svgLabelSmall,\n\t\t\t\tfill: resolveColor( theme.svgLabelSmall.fill ),\n\t\t\t},\n\t\t} );\n\t}, [ theme, seriesColorKey, scopeElement ] );\n};\n","import { useMemo } from 'react';\nimport { parseAsLocalDate } from '../utils';\nimport type { SeriesData } from '../types';\n\n/**\n * Hook that transforms and sorts chart data, handling date parsing and sorting\n *\n * This hook extracts the common data transformation logic used in both line-chart\n * and bar-chart components. It:\n * 1. Parses date strings into Date objects using parseAsLocalDate\n * 2. Sorts data points by date when date properties are present\n * 3. Returns the original data unchanged when no date properties are found\n *\n * @param {SeriesData[]} data - The raw chart data to transform\n * @return {SeriesData[]} The transformed and sorted data\n */\nexport const useChartDataTransform = ( data: SeriesData[] ) => {\n\treturn useMemo( () => {\n\t\t// Check if the first data point has date or dateString properties\n\t\tconst firstPoint = data?.[ 0 ]?.data?.[ 0 ];\n\t\tconst hasDateProperties = firstPoint && ( 'date' in firstPoint || 'dateString' in firstPoint );\n\n\t\t// If no date properties found, return data unchanged\n\t\tif ( ! hasDateProperties ) {\n\t\t\treturn data;\n\t\t}\n\n\t\t// Transform and sort data with date properties\n\t\treturn data.map( series => ( {\n\t\t\t...series,\n\t\t\tdata: series.data\n\t\t\t\t.map( point => {\n\t\t\t\t\tlet date: Date | undefined;\n\n\t\t\t\t\tif ( 'date' in point && point.date ) {\n\t\t\t\t\t\tdate = point.date;\n\t\t\t\t\t} else if ( 'dateString' in point && point.dateString ) {\n\t\t\t\t\t\tdate = parseAsLocalDate( point.dateString );\n\t\t\t\t\t}\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...point,\n\t\t\t\t\t\tdate,\n\t\t\t\t\t};\n\t\t\t\t} )\n\t\t\t\t.sort( ( a, b ) => {\n\t\t\t\t\tif ( ! a.date || ! b.date ) return 0;\n\t\t\t\t\treturn a.date.getTime() - b.date.getTime();\n\t\t\t\t} ),\n\t\t} ) );\n\t}, [ data ] );\n};\n","import { createScale, getTicks } from '@visx/scale';\nimport { useMemo } from 'react';\nimport { getLongestTickWidth, resolveFontSize } from '../utils';\nimport type { BaseChartProps, DataPointDate, SeriesData } from '../types';\nimport type { XYChartTheme } from '@visx/xychart';\n\n/**\n * Base top margin used when no dynamic adjustments are necessary.\n */\nconst DEFAULT_MARGIN_TOP = 10;\n\n/**\n * Base right margin used when no dynamic adjustments are necessary.\n */\nconst DEFAULT_MARGIN_RIGHT = 20;\n\n/**\n * Base bottom margin used for charts with a bottom X-axis.\n * This is large enough for typical font sizes and will be increased\n * dynamically when tick labels require more space.\n */\nconst DEFAULT_MARGIN_BOTTOM = 20;\n\n/**\n * Base left margin used when no dynamic adjustments are necessary.\n */\nconst DEFAULT_MARGIN_LEFT = 20;\n\n/**\n * Bottom margin to use when the X-axis is rendered at the top.\n * We only need a small buffer below the chart in that case.\n */\nconst DEFAULT_BOTTOM_FOR_TOP_AXIS = 10;\n\n/**\n * Fallback font size used when we cannot derive a font size\n * from the theme or axis styles for X-axis tick labels.\n */\nconst DEFAULT_FONT_SIZE = 12;\n\n/**\n * Fallback tick length used when tickLength is not provided\n * by the theme for either axis.\n */\nconst DEFAULT_TICK_LENGTH = 8;\n\n/**\n * Fallback width used for Y-axis tick labels when we cannot\n * measure them via getLongestTickWidth.\n */\nconst DEFAULT_Y_TICK_WIDTH = 40;\n\nconst getXAxisLabelMetrics = ( theme: XYChartTheme, orientation: 'top' | 'bottom' ) => {\n\tconst xAxisStyles =\n\t\torientation === 'top' ? theme.axisStyles?.x?.top : theme.axisStyles?.x?.bottom;\n\n\tconst fontSize =\n\t\tresolveFontSize( xAxisStyles?.axisLabel?.fontSize ) ||\n\t\tresolveFontSize( theme.svgLabelSmall?.fontSize ) ||\n\t\tDEFAULT_FONT_SIZE;\n\n\tconst tickLength = xAxisStyles?.tickLength ?? DEFAULT_TICK_LENGTH;\n\n\treturn { fontSize, tickLength };\n};\n\nexport const useChartMargin = (\n\theight: number,\n\toptions: BaseChartProps[ 'options' ],\n\tdata: SeriesData[],\n\ttheme: XYChartTheme,\n\thorizontal: boolean = false\n) => {\n\tconst yTicks = useMemo( () => {\n\t\tconst allDataPoints = data.flatMap( series => series.data as DataPointDate[] );\n\n\t\tif ( horizontal ) {\n\t\t\t// When horizontal, y ticks render the category values; leave them raw so\n\t\t\t// the axis tick formatter is applied exactly once, when measuring below.\n\t\t\treturn allDataPoints.map( d => d.label || d.date?.getTime() );\n\t\t}\n\n\t\tif ( options.axis?.y?.tickValues?.length ) {\n\t\t\treturn options.axis.y.tickValues;\n\t\t}\n\n\t\tconst minY = Math.min( ...allDataPoints.map( d => d.value ) );\n\t\tconst maxY = Math.max( ...allDataPoints.map( d => d.value ) );\n\t\tconst yScale = createScale( {\n\t\t\t...options.yScale,\n\t\t\tdomain: [ minY, maxY ],\n\t\t\trange: [ height, 0 ],\n\t\t} );\n\n\t\treturn getTicks( yScale, options.axis?.y?.numTicks );\n\t}, [ options, data, height, horizontal ] );\n\n\treturn useMemo( () => {\n\t\t// Default margin is for bottom axis labels.\n\t\tconst defaultMargin = {\n\t\t\ttop: DEFAULT_MARGIN_TOP,\n\t\t\tright: DEFAULT_MARGIN_RIGHT,\n\t\t\tbottom: DEFAULT_MARGIN_BOTTOM,\n\t\t\tleft: DEFAULT_MARGIN_LEFT,\n\t\t};\n\n\t\t// Auto-calculate margin for y axis labels based on orientation and tick width.\n\t\tconst yAxisOrientation = options.axis?.y?.orientation;\n\t\tconst yAxisStyles =\n\t\t\tyAxisOrientation === 'right' ? theme.axisStyles.y.right : theme.axisStyles.y.left;\n\t\tconst yTickWidth = getLongestTickWidth(\n\t\t\tyTicks,\n\t\t\toptions.axis?.y?.tickFormat,\n\t\t\tyAxisStyles.axisLabel\n\t\t);\n\t\t// visx's default axis theme pushes y-axis tick labels a further 0.25em\n\t\t// away from the axis (dx of -0.25em on the left, 0.25em on the right), so\n\t\t// reserve that on top of the measured label width — without it the widest\n\t\t// label clips at the SVG edge. The em resolves against the tick label's own\n\t\t// font size (theme tickLabel), not the axis-title font size (axisLabel).\n\t\tconst yTickLabelFontSize =\n\t\t\tresolveFontSize( yAxisStyles?.tickLabel?.fontSize ) || DEFAULT_FONT_SIZE;\n\t\tconst yMarginValue =\n\t\t\t( yTickWidth ?? DEFAULT_Y_TICK_WIDTH ) +\n\t\t\t( yAxisStyles?.tickLength ?? 0 ) +\n\t\t\tMath.ceil( yTickLabelFontSize * 0.25 );\n\n\t\tif ( yAxisOrientation === 'right' ) {\n\t\t\tdefaultMargin.right = yMarginValue;\n\t\t} else {\n\t\t\tdefaultMargin.left = yMarginValue;\n\t\t}\n\n\t\t// Dynamically compute X-axis margin (bottom by default, or top if orientation is 'top').\n\t\t// This mirrors Y-axis behavior where margin is based on label size and tick length,\n\t\t// but keeps the padding minimal so consumers can control container spacing themselves.\n\t\tconst xOrientation = options.axis?.x?.orientation === 'top' ? 'top' : 'bottom';\n\t\tconst { fontSize, tickLength } = getXAxisLabelMetrics( theme, xOrientation );\n\t\tconst computedXMargin = fontSize + tickLength;\n\n\t\tif ( xOrientation === 'top' ) {\n\t\t\tdefaultMargin.top = Math.max( defaultMargin.top, computedXMargin );\n\t\t\tdefaultMargin.bottom = DEFAULT_BOTTOM_FOR_TOP_AXIS;\n\t\t} else {\n\t\t\tdefaultMargin.bottom = Math.max( defaultMargin.bottom, computedXMargin );\n\t\t}\n\n\t\treturn defaultMargin;\n\t}, [ options, theme, yTicks ] );\n};\n","import { useState, useCallback, useRef } from 'react';\n\n/**\n * Hook to measure the width and height of a DOM element.\n * Returns a ref callback to attach to the element and the current dimensions in pixels.\n *\n * @param {object} props - Optional props.\n * @param {number} props.initialWidth - The initial width to use.\n * @param {number} props.initialHeight - The initial height to use.\n *\n * @return {[Function, number, number]} A tuple containing a ref callback, width, and height in pixels\n */\nexport function useElementSize< T extends HTMLElement = HTMLDivElement >( {\n\tinitialWidth = 0,\n\tinitialHeight = 0,\n}: {\n\tinitialWidth?: number;\n\tinitialHeight?: number;\n} = {} ): [ ( node: T | null ) => void, number, number ] {\n\tconst [ width, setWidth ] = useState( initialWidth );\n\tconst [ height, setHeight ] = useState( initialHeight );\n\tconst observerRef = useRef< ResizeObserver | null >( null );\n\n\tconst refCallback = useCallback( ( node: T | null ) => {\n\t\tif ( observerRef.current ) {\n\t\t\tobserverRef.current.disconnect();\n\t\t\tobserverRef.current = null;\n\t\t}\n\t\tif ( node ) {\n\t\t\tconst handleResize = () => {\n\t\t\t\tconst rect = node.getBoundingClientRect();\n\t\t\t\tsetWidth( rect.width || 0 );\n\t\t\t\tsetHeight( rect.height || 0 );\n\t\t\t};\n\t\t\thandleResize();\n\t\t\tconst resizeObserver = new ResizeObserver( handleResize );\n\t\t\tresizeObserver.observe( node );\n\t\t\tobserverRef.current = resizeObserver;\n\t\t}\n\t}, [] );\n\n\treturn [ refCallback, width, height ];\n}\n","import { useCallback, useRef, useState } from 'react';\n\n/**\n * Hook to detect if text content is truncated within its container.\n * Uses ResizeObserver to dynamically track changes in element size.\n *\n * @param enabled - Whether truncation detection should be active. Defaults to true.\n * @return A tuple containing:\n * - [0] refCallback: Function to attach to the text element as a ref\n * - [1] isTruncated: Boolean indicating if the text is currently truncated\n *\n * @example\n * ```tsx\n * const [textRef, isTruncated] = useTextTruncation(true);\n *\n * return (\n * <span ref={textRef} title={isTruncated ? fullText : undefined}>\n * {text}\n * </span>\n * );\n * ```\n */\nexport function useTextTruncation(\n\tenabled: boolean = true\n): [ ( node: HTMLElement | null ) => void, boolean ] {\n\tconst [ isTruncated, setIsTruncated ] = useState( false );\n\tconst observerRef = useRef< ResizeObserver | null >( null );\n\n\tconst refCallback = useCallback(\n\t\t( node: HTMLElement | null ) => {\n\t\t\t// Cleanup existing observer\n\t\t\tif ( observerRef.current ) {\n\t\t\t\tobserverRef.current.disconnect();\n\t\t\t\tobserverRef.current = null;\n\t\t\t}\n\n\t\t\tif ( node && enabled ) {\n\t\t\t\tconst checkTruncation = () => {\n\t\t\t\t\t// Check if content width exceeds container width (indicates truncation)\n\t\t\t\t\tconst truncated = node.scrollWidth > node.clientWidth;\n\t\t\t\t\tsetIsTruncated( truncated );\n\t\t\t\t};\n\n\t\t\t\t// Initial check\n\t\t\t\tcheckTruncation();\n\n\t\t\t\t// Watch for size changes\n\t\t\t\tconst resizeObserver = new ResizeObserver( checkTruncation );\n\t\t\t\tresizeObserver.observe( node );\n\t\t\t\tobserverRef.current = resizeObserver;\n\t\t\t} else {\n\t\t\t\tsetIsTruncated( false );\n\t\t\t}\n\t\t},\n\t\t[ enabled ]\n\t);\n\n\treturn [ refCallback, isTruncated ];\n}\n","import { useMemo } from 'react';\nimport type { SeriesData, DataPointDate } from '../types';\n\nexport type EnhancedDataPoint = DataPointDate & {\n\tvisualValue?: number;\n};\n\nexport interface EnhancedSeriesData extends Omit< SeriesData, 'data' > {\n\tdata: EnhancedDataPoint[];\n}\n\nexport interface UseZeroValueDisplayOptions {\n\tenabled: boolean;\n\t/**\n\t * The pixel length of the value axis (height for vertical charts, width for\n\t * horizontal charts). Used to calculate a minimum visible value that ensures\n\t * zero-value bars are at least MIN_PIXEL_HEIGHT pixels tall along that axis.\n\t */\n\tvalueAxisLength?: number;\n}\n\n/**\n * Minimum pixel size for near-zero bars (non-zero values that would render too small).\n * Using 3px to be visible but not misleading - larger values might look like actual data.\n */\nconst MIN_PIXEL_SIZE = 3;\n\n/**\n * Pixel size for zero-value bars (1px less than near-zero to be visually distinguishable).\n */\nconst ZERO_PIXEL_SIZE = MIN_PIXEL_SIZE - 1;\n\nexport const useZeroValueDisplay = (\n\tdata: SeriesData[],\n\toptions: UseZeroValueDisplayOptions = { enabled: false }\n): SeriesData[] | EnhancedSeriesData[] => {\n\tconst { enabled, valueAxisLength } = options;\n\n\treturn useMemo( () => {\n\t\tif ( ! enabled || ! valueAxisLength || valueAxisLength <= 0 ) return data;\n\n\t\t// Find max absolute value\n\t\tlet maxAbsoluteValue = 0;\n\t\tfor ( const series of data ) {\n\t\t\tfor ( const point of series.data ) {\n\t\t\t\tif ( point.value !== null && point.value !== 0 ) {\n\t\t\t\t\tmaxAbsoluteValue = Math.max( maxAbsoluteValue, Math.abs( point.value ) );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( maxAbsoluteValue === 0 ) return data;\n\n\t\t// Calculate values that render as specific pixel sizes, clamped to maxAbsoluteValue\n\t\t// to prevent visual distortion when valueAxisLength is very small\n\t\tconst minNonZeroValue = Math.min(\n\t\t\t( MIN_PIXEL_SIZE / valueAxisLength ) * maxAbsoluteValue,\n\t\t\tmaxAbsoluteValue\n\t\t);\n\t\tconst zeroVisualValue = Math.min(\n\t\t\t( ZERO_PIXEL_SIZE / valueAxisLength ) * maxAbsoluteValue,\n\t\t\tmaxAbsoluteValue\n\t\t);\n\n\t\treturn data.map( series => ( {\n\t\t\t...series,\n\t\t\tdata: series.data.map( ( point: DataPointDate ): EnhancedDataPoint => {\n\t\t\t\t// Zero values get a smaller visual representation (2px)\n\t\t\t\tif ( point.value === 0 ) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...point,\n\t\t\t\t\t\tvisualValue: zeroVisualValue,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\t// Null values should remain untouched\n\t\t\t\tif ( point.value === null ) {\n\t\t\t\t\treturn point;\n\t\t\t\t}\n\n\t\t\t\tconst absValue = Math.abs( point.value );\n\n\t\t\t\t// Near-zero values that would render below MIN_PIXEL_SIZE get boosted to 3px\n\t\t\t\t// Preserve the sign for negative values\n\t\t\t\tif ( absValue < minNonZeroValue ) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...point,\n\t\t\t\t\t\tvisualValue: Math.sign( point.value ) * minNonZeroValue,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\treturn point;\n\t\t\t} ),\n\t\t} ) );\n\t}, [ data, enabled, valueAxisLength ] );\n};\n","import { useMemo } from 'react';\n\ninterface DataPointWithValue {\n\tvalue: number;\n}\n\n/**\n * Hook to calculate percentages from values for chart data.\n * Ensures percentages are always derived from values (single source of truth).\n *\n * @param data - Array of data points with values\n * @return Data with calculated percentages\n */\nexport const useDataWithPercentages = < T extends DataPointWithValue >(\n\tdata: T[]\n): ( T & { percentage: number } )[] => {\n\treturn useMemo( () => {\n\t\tconst totalValue = data.reduce( ( sum, segment ) => sum + segment.value, 0 );\n\t\treturn data.map( segment => ( {\n\t\t\t...segment,\n\t\t\tpercentage: totalValue > 0 ? ( segment.value / totalValue ) * 100 : 0,\n\t\t} ) );\n\t}, [ data ] );\n};\n","import { useMemo } from 'react';\n\n/**\n * Data point interface for charts with visibility-aware legends.\n * Requires label for series identification, value for calculations,\n * and percentage (should be pre-calculated by the chart component).\n */\ninterface DataPointWithPercentage {\n\tlabel: string;\n\tvalue: number;\n\tpercentage: number;\n}\n\n/**\n * Parameters for the useLegendVisibilityData hook.\n */\ninterface UseLegendVisibilityDataParams< T extends DataPointWithPercentage > {\n\t/** The chart data with pre-calculated percentages */\n\tdata: T[];\n\t/** Unique chart identifier, required for filtering */\n\tchartId: string | undefined;\n\t/** Function to check if a series is visible in the legend */\n\tisSeriesVisible: ( chartId: string, label: string ) => boolean;\n}\n\n/**\n * Return value from the useLegendVisibilityData hook.\n */\ninterface UseLegendVisibilityDataResult< T extends DataPointWithPercentage > {\n\t/** Filtered data array containing only visible segments with recalculated percentages */\n\tvisibleData: T[];\n\t/** Boolean indicating if all segments are hidden */\n\tallSegmentsHidden: boolean;\n\t/**\n\t * Legend data with stable percentage formatting.\n\t * Hidden items keep their original percentage.\n\t * Visible items show recalculated percentages that total 100%.\n\t */\n\tlegendData: T[];\n}\n\n/**\n * Custom hook to filter and recalculate chart data based on series visibility.\n *\n * Regardless of whether the legend is interactive (clickable), this hook:\n * 1. Filters data to show only visible series (visibility can also be set programmatically)\n * 2. Recalculates percentages so visible segments total 100%\n * 3. Tracks whether all segments are hidden to show empty state\n *\n * This is particularly useful for pie charts, donut charts, and semi-circle charts\n * where segment visibility and percentages need to be dynamically adjusted.\n *\n * @example\n * ```tsx\n * const { visibleData, allSegmentsHidden, legendData } = useLegendVisibilityData({\n * data: chartData,\n * chartId: 'my-pie-chart',\n * isSeriesVisible: (id, label) => context.isSeriesVisible(id, label),\n * });\n *\n * // Use legendData for creating legend items (shows recalculated percentages)\n * const legendItems = useChartLegendItems(legendData, legendOptions);\n *\n * if (allSegmentsHidden) {\n * return <EmptyState />;\n * }\n *\n * // Use visibleData for rendering the chart (only visible segments)\n * return <PieChart data={visibleData} />;\n * ```\n *\n * @param params - Configuration object for the hook\n * @param params.data - The chart data to filter\n * @param params.chartId - Unique identifier for the chart (required for filtering)\n * @param params.isSeriesVisible - Function to check series visibility\n * @return Object containing visibleData, allSegmentsHidden flag, and legendData with recalculated percentages\n */\nexport const useLegendVisibilityData = < T extends DataPointWithPercentage >( {\n\tdata,\n\tchartId,\n\tisSeriesVisible,\n}: UseLegendVisibilityDataParams< T > ): UseLegendVisibilityDataResult< T > => {\n\t// Filter and recalculate data based on shared legend visibility state.\n\t// Note: data should already have percentages calculated by the chart component\n\tconst visibleData = useMemo( () => {\n\t\t// Visibility filtering applies regardless of whether the legend is\n\t\t// interactive: interactivity only controls whether clicking the legend\n\t\t// can change visibility, not whether the chart honors it.\n\t\tif ( ! chartId ) {\n\t\t\treturn data;\n\t\t}\n\n\t\t// Filter to only visible segments based on legend state\n\t\tconst filtered = data.filter( segment => isSeriesVisible( chartId, segment.label ) );\n\n\t\t// If no segments are visible, return empty array\n\t\tif ( filtered.length === 0 ) {\n\t\t\treturn [];\n\t\t}\n\n\t\t// Recalculate percentages from values so visible segments total 100%\n\t\tconst totalValue = filtered.reduce( ( sum, segment ) => sum + segment.value, 0 );\n\t\treturn filtered.map( segment => ( {\n\t\t\t...segment,\n\t\t\tpercentage: totalValue > 0 ? ( segment.value / totalValue ) * 100 : 0,\n\t\t} ) );\n\t}, [ data, chartId, isSeriesVisible ] );\n\n\t// Check if all segments are hidden. Guard on the source data being non-empty:\n\t// unlike line/area's `.every()`, an empty `visibleData` alone can't distinguish\n\t// \"everything was hidden\" from \"there was nothing to show\" for an empty dataset.\n\tconst allSegmentsHidden = useMemo( () => {\n\t\treturn visibleData.length === 0 && data.length > 0;\n\t}, [ visibleData, data ] );\n\n\t// Prepare legend data with percentages\n\t// Hidden items keep their original percentage (calculated from all values)\n\t// Visible items show recalculated percentages (totaling 100%)\n\tconst legendData = useMemo( () => {\n\t\tif ( ! chartId ) {\n\t\t\treturn data;\n\t\t}\n\n\t\t// Build a Map for O(1) lookups instead of O(n) find() calls\n\t\tconst visibleDataMap = new Map( visibleData.map( d => [ d.label, d ] ) );\n\n\t\treturn data.map( segment => {\n\t\t\tconst isVisible = isSeriesVisible( chartId, segment.label );\n\t\t\tif ( ! isVisible ) {\n\t\t\t\t// Hidden items keep original percentage\n\t\t\t\treturn segment;\n\t\t\t}\n\n\t\t\t// For visible items, get the recalculated percentage from visibleData\n\t\t\treturn visibleDataMap.get( segment.label ) || segment;\n\t\t} );\n\t}, [ data, visibleData, chartId, isSeriesVisible ] );\n\n\treturn { visibleData, allSegmentsHidden, legendData };\n};\n","import { useState, useEffect } from 'react';\n\n// 'no-preference' returns false in unsupported browsers,\n// causing a safe fallback to reduced motion instead of animating.\nconst QUERY = '(prefers-reduced-motion: no-preference)';\n\nconst getInitialState = () => ! window.matchMedia( QUERY ).matches;\n\n/**\n * Custom hook to determine if the user prefers reduced motion.\n * @return {boolean} A boolean indicating the user's preference for reduced motion.\n */\nexport function usePrefersReducedMotion() {\n\tconst [ prefersReducedMotion, setPrefersReducedMotion ] = useState( getInitialState );\n\n\tuseEffect( () => {\n\t\tconst mediaQueryList = window.matchMedia( QUERY );\n\n\t\tconst listener = event => {\n\t\t\tsetPrefersReducedMotion( ! event.matches );\n\t\t};\n\n\t\tmediaQueryList.addEventListener( 'change', listener );\n\n\t\treturn () => {\n\t\t\tmediaQueryList.removeEventListener( 'change', listener );\n\t\t};\n\t}, [] );\n\n\treturn prefersReducedMotion;\n}\n","import { useEffect, useMemo } from 'react';\nimport { useDeepMemo } from '../../../hooks';\nimport { useGlobalChartsContext } from './use-global-charts-context';\nimport type { BaseLegendItem } from '../../../components/legend';\nimport type { ChartType } from '../../../types';\n\nexport const useChartRegistration = ( {\n\tchartId,\n\tlegendItems,\n\tchartType,\n\tisDataValid,\n\tmetadata,\n}: {\n\tchartId: string;\n\tlegendItems: BaseLegendItem[];\n\tchartType: ChartType;\n\tisDataValid: boolean;\n\tmetadata?: Record< string, unknown >;\n} ): void => {\n\tconst { registerChart, unregisterChart } = useGlobalChartsContext();\n\n\t// Memoize legendItems with deep comparison to prevent infinite loops\n\tconst stableLegendItems = useDeepMemo( legendItems );\n\n\t// Memoize metadata to prevent unnecessary re-renders\n\tconst memoizedMetadata = useMemo( () => metadata, [ metadata ] );\n\n\tuseEffect( () => {\n\t\t// Only register if data is valid\n\t\tif ( isDataValid ) {\n\t\t\tregisterChart( chartId, {\n\t\t\t\tlegendItems: stableLegendItems,\n\t\t\t\tchartType,\n\t\t\t\tmetadata: memoizedMetadata,\n\t\t\t} );\n\t\t}\n\n\t\treturn () => {\n\t\t\tunregisterChart( chartId );\n\t\t};\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [\n\t\tchartId,\n\t\tstableLegendItems,\n\t\tchartType,\n\t\tmemoizedMetadata,\n\t\tisDataValid,\n\t\t// Removed registerChart and unregisterChart from dependencies\n\t\t// They are stable functions created with useCallback and empty deps\n\t] );\n};\n","import { useContext } from 'react';\nimport { GlobalChartsContext } from '../global-charts-provider';\nimport { defaultTheme } from '../themes';\nimport type { CompleteChartTheme } from '../../../types';\n\n/**\n * Hook to get the global chart theme from GlobalChartsProvider\n *\n * @return The global chart theme\n */\nexport const useGlobalChartsTheme = (): CompleteChartTheme => {\n\t// Get context but don't throw if it doesn't exist (for testing or standalone usage)\n\tconst context = useContext( GlobalChartsContext );\n\tconst globalTheme = context?.theme;\n\n\treturn globalTheme ?? defaultTheme;\n};\n","export type ValueOrIdentity< T > = T | { value?: T };\n\n/**\n * Returns an object's value if defined, or the object.\n * @param _ - The object to return the value of.\n * @return The value of the object, or the object itself.\n */\nexport function valueOrIdentity< T >( _: ValueOrIdentity< T > ): T {\n\tif ( _ && typeof _ === 'object' && 'value' in _ && typeof _.value !== 'undefined' )\n\t\treturn _.value;\n\treturn _ as T;\n}\n\n/**\n * Returns an object's value if defined, or the object, coerced to a string.\n * @param _ - The object to return the value of.\n * @return The value of the object, or the object itself.\n */\nexport function valueOrIdentityString< T >( _: ValueOrIdentity< T > ): string {\n\treturn String( valueOrIdentity( _ ) );\n}\n","import type { ItemTransformer, LabelFormatter } from '@visx/legend';\nimport type { AnyD3Scale, ScaleInput } from '@visx/scale';\n\n/**\n * Returns a function which takes a Datum and index as input, and returns a formatted label object.\n * @param {object} root0 - The object to return the value of.\n * @param {AnyD3Scale} root0.scale - The scale to use.\n * @param {LabelFormatter<ScaleInput<Scale>>} root0.labelFormat - The label format to use.\n * @return {ItemTransformer<ScaleInput<Scale>, ReturnType<Scale>>} The label transform factory.\n */\nexport function labelTransformFactory< Scale extends AnyD3Scale >( {\n\tscale,\n\tlabelFormat,\n}: {\n\tscale: Scale;\n\tlabelFormat: LabelFormatter< ScaleInput< Scale > >;\n} ): ItemTransformer< ScaleInput< Scale >, ReturnType< Scale > > {\n\treturn ( d, i ) => ( {\n\t\tdatum: d,\n\t\tindex: i,\n\t\ttext: `${ labelFormat( d, i ) }`,\n\t\tvalue: scale( d ),\n\t} );\n}\n","import { Group } from '@visx/group';\nimport { LegendItem, LegendLabel, LegendOrdinal, LegendShape } from '@visx/legend';\nimport { scaleOrdinal } from '@visx/scale';\nimport { _x, sprintf } from '@wordpress/i18n';\nimport { Stack } from '@wordpress/ui';\nimport clsx from 'clsx';\nimport {\n\ttype RefAttributes,\n\ttype ForwardRefExoticComponent,\n\ttype KeyboardEvent,\n\tforwardRef,\n\tuseCallback,\n\tuseContext,\n} from 'react';\nimport { ChartInstanceContext } from '../../../charts/private/chart-instance-context';\nimport { useTextTruncation } from '../../../hooks';\nimport { GlobalChartsContext, useGlobalChartsTheme } from '../../../providers';\nimport { useStandaloneScopeClass } from '../../../providers/chart-scope';\nimport { valueOrIdentity, valueOrIdentityString, labelTransformFactory } from '../utils';\nimport styles from './base-legend.module.scss';\nimport type { BaseLegendItem, BaseLegendProps } from '../types';\n\nconst ALIGNMENT_TO_FLEX = {\n\tstart: 'flex-start',\n\tcenter: 'center',\n\tend: 'flex-end',\n} as const;\n\n// Component for legend text with truncation detection\n// Moved outside BaseLegend to prevent recreation on every render\nconst LegendText = ( {\n\ttext,\n\ttextOverflow,\n\tmaxWidth,\n}: {\n\ttext: string;\n\ttextOverflow: 'ellipsis' | 'wrap';\n\tmaxWidth?: string;\n} ) => {\n\tconst isEllipsis = maxWidth != null && textOverflow === 'ellipsis';\n\tconst [ textRef, isTruncated ] = useTextTruncation( Boolean( isEllipsis ) );\n\n\treturn (\n\t\t<span\n\t\t\tref={ textRef }\n\t\t\tclassName={ clsx(\n\t\t\t\tstyles[ 'legend-item-text' ],\n\t\t\t\tmaxWidth != null && styles[ `legend-item-text--${ textOverflow }` ]\n\t\t\t) }\n\t\t\tstyle={ {\n\t\t\t\t...( maxWidth != null && {\n\t\t\t\t\tmaxWidth,\n\t\t\t\t\tminWidth: 0,\n\t\t\t\t} ),\n\t\t\t} }\n\t\t\ttitle={ isEllipsis && isTruncated ? text : undefined }\n\t\t>\n\t\t\t{ text }\n\t\t</span>\n\t);\n};\n\n// Interactive items get a toggle affordance; non-interactive items only need a label\n// when hidden, since a visible item's own text already serves as its accessible name.\nconst getLegendItemAriaLabel = (\n\ttext: string,\n\tvalue: BaseLegendItem[ 'value' ],\n\tvisible: boolean,\n\tinteractive: boolean\n) => {\n\tconst accessibleText =\n\t\tvalue != null && value !== ''\n\t\t\t? sprintf(\n\t\t\t\t\t/* translators: 1: legend item label; 2: legend item value. */\n\t\t\t\t\t_x( '%1$s, %2$s', 'legend item label and value', 'jetpack-charts' ),\n\t\t\t\t\ttext,\n\t\t\t\t\tString( value )\n\t\t\t )\n\t\t\t: text;\n\n\tif ( interactive ) {\n\t\tif ( visible ) {\n\t\t\treturn sprintf(\n\t\t\t\t/* translators: %s: legend item label (e.g. a series or segment name) */\n\t\t\t\t_x(\n\t\t\t\t\t'%s: visible. Toggle visibility.',\n\t\t\t\t\t'visible interactive legend item',\n\t\t\t\t\t'jetpack-charts'\n\t\t\t\t),\n\t\t\t\taccessibleText\n\t\t\t);\n\t\t}\n\t\treturn sprintf(\n\t\t\t/* translators: %s: legend item label (e.g. a series or segment name) */\n\t\t\t_x( '%s: hidden. Toggle visibility.', 'hidden interactive legend item', 'jetpack-charts' ),\n\t\t\taccessibleText\n\t\t);\n\t}\n\tif ( visible ) {\n\t\treturn undefined;\n\t}\n\treturn sprintf(\n\t\t/* translators: %s: legend item label (e.g. a series or segment name) */\n\t\t_x( '%s: hidden', 'hidden non-interactive legend item', 'jetpack-charts' ),\n\t\taccessibleText\n\t);\n};\n\n/*\n * Base legend component that displays color-coded items with labels based on visx LegendOrdinal.\n * We avoid using LegendOrdinal directly to enable support for advanced features such as interactivity.\n */\nexport const BaseLegend: ForwardRefExoticComponent<\n\tBaseLegendProps & RefAttributes< HTMLDivElement >\n> = forwardRef< HTMLDivElement, BaseLegendProps >(\n\t(\n\t\t{\n\t\t\titems,\n\t\t\tclassName,\n\t\t\torientation = 'horizontal',\n\t\t\talignment = 'center',\n\t\t\tshape = 'rect',\n\t\t\tfill = valueOrIdentityString,\n\t\t\tsize = valueOrIdentityString,\n\t\t\tlabelFormat = valueOrIdentity,\n\t\t\tlabelTransform = labelTransformFactory,\n\t\t\titemStyles,\n\t\t\titemClassName,\n\t\t\tlabelStyles,\n\t\t\tlabelClassName,\n\t\t\tshapeStyles,\n\t\t\trender,\n\t\t\tinteractive = false,\n\t\t\tchartId,\n\t\t},\n\t\tref\n\t) => {\n\t\tconst { margin: itemMargin = '0', flexDirection: itemDirection = 'row' } = itemStyles ?? {};\n\t\tconst {\n\t\t\tjustifyContent: labelJustifyContent = 'flex-start',\n\t\t\tflex: labelFlex = '0 0 auto',\n\t\t\tmargin: labelMargin = '0 4px',\n\t\t\tmaxWidth,\n\t\t\ttextOverflow = 'wrap',\n\t\t} = labelStyles ?? {};\n\t\tconst {\n\t\t\twidth: shapeWidth = 16,\n\t\t\theight: shapeHeight = 16,\n\t\t\tmargin: shapeMargin = '2px 4px 2px 0',\n\t\t} = shapeStyles ?? {};\n\n\t\tconst theme = useGlobalChartsTheme();\n\t\tconst context = useContext( GlobalChartsContext );\n\t\tconst chartInstanceContext = useContext( ChartInstanceContext );\n\t\tconst standaloneScopeClass = useStandaloneScopeClass();\n\n\t\tconst legendScale = scaleOrdinal( {\n\t\t\tdomain: items.map( item => item.label ),\n\t\t\trange: items.map( item => item.color ),\n\t\t} );\n\t\tconst domain = legendScale.domain();\n\n\t\tconst getShapeStyle = useCallback(\n\t\t\t( { index }: { index: number } ) => items[ index ]?.shapeStyle,\n\t\t\t[ items ]\n\t\t);\n\n\t\t// Handle legend item clicks for interactive mode\n\t\tconst handleLegendClick = useCallback(\n\t\t\t( seriesLabels: string[] ) => {\n\t\t\t\tif ( interactive && chartId && context ) {\n\t\t\t\t\tconst representativeVisible = context.isSeriesVisible( chartId, seriesLabels[ 0 ] );\n\t\t\t\t\tseriesLabels.forEach( label =>\n\t\t\t\t\t\tcontext.setSeriesVisibility( chartId, label, ! representativeVisible )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[ interactive, chartId, context ]\n\t\t);\n\n\t\t// Visibility is display state, not interaction state: a series hidden\n\t\t// programmatically must read as hidden even when the legend cannot be clicked.\n\t\tconst isSeriesVisible = useCallback(\n\t\t\t( seriesLabel: string ) => {\n\t\t\t\tif ( chartInstanceContext?.isSeriesVisible ) {\n\t\t\t\t\treturn chartInstanceContext.isSeriesVisible( seriesLabel );\n\t\t\t\t}\n\t\t\t\tif ( ! chartId || ! context ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn context.isSeriesVisible( chartId, seriesLabel );\n\t\t\t},\n\t\t\t[ chartId, chartInstanceContext, context ]\n\t\t);\n\n\t\t// Create event handlers to avoid inline arrow functions\n\t\tconst createClickHandler = useCallback(\n\t\t\t( seriesLabels: string[] ) => {\n\t\t\t\tif ( ! interactive ) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\treturn () => handleLegendClick( seriesLabels );\n\t\t\t},\n\t\t\t[ interactive, handleLegendClick ]\n\t\t);\n\n\t\tconst createKeyDownHandler = useCallback(\n\t\t\t( seriesLabels: string[] ) => {\n\t\t\t\tif ( ! interactive ) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\treturn ( event: KeyboardEvent ) => {\n\t\t\t\t\tif ( event.key === 'Enter' || event.key === ' ' ) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\thandleLegendClick( seriesLabels );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ interactive, handleLegendClick ]\n\t\t);\n\n\t\tconst flexAlignment = ALIGNMENT_TO_FLEX[ alignment ] ?? 'center';\n\n\t\treturn render ? (\n\t\t\trender( items )\n\t\t) : (\n\t\t\t<LegendOrdinal\n\t\t\t\tscale={ legendScale }\n\t\t\t\tlabelFormat={ labelFormat }\n\t\t\t\tlabelTransform={ labelTransform }\n\t\t\t>\n\t\t\t\t{ labels => (\n\t\t\t\t\t<Stack\n\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\tdirection={ orientation === 'vertical' ? 'column' : 'row' }\n\t\t\t\t\t\tgap={ orientation === 'vertical' ? 'sm' : 'lg' }\n\t\t\t\t\t\talign={ orientation === 'vertical' ? flexAlignment : undefined }\n\t\t\t\t\t\tjustify={ orientation === 'horizontal' ? flexAlignment : undefined }\n\t\t\t\t\t\twrap={ orientation === 'horizontal' ? 'wrap' : undefined }\n\t\t\t\t\t\trole={ interactive ? undefined : 'list' }\n\t\t\t\t\t\tdata-testid={ `legend-${ orientation }` }\n\t\t\t\t\t\tclassName={ clsx( standaloneScopeClass, styles.legend, className ) }\n\t\t\t\t\t\tstyle={ theme.legend?.containerStyles }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ labels.map( ( label, i ) => {\n\t\t\t\t\t\t\tconst matchedItem = items[ i ];\n\t\t\t\t\t\t\t// A grouped item toggles/reads every series it controls; a plain item just its own.\n\t\t\t\t\t\t\tconst seriesLabels = matchedItem?.seriesLabels?.length\n\t\t\t\t\t\t\t\t? matchedItem.seriesLabels\n\t\t\t\t\t\t\t\t: [ label.text ];\n\t\t\t\t\t\t\tconst visible = isSeriesVisible( seriesLabels[ 0 ] );\n\t\t\t\t\t\t\tconst handleClick = createClickHandler( seriesLabels );\n\t\t\t\t\t\t\tconst handleKeyDown = createKeyDownHandler( seriesLabels );\n\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<LegendItem\n\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t'visx-legend-item',\n\t\t\t\t\t\t\t\t\t\tstyles[ 'legend-item' ],\n\t\t\t\t\t\t\t\t\t\tinteractive && styles[ 'legend-item--interactive' ],\n\t\t\t\t\t\t\t\t\t\t! visible && styles[ 'legend-item--inactive' ],\n\t\t\t\t\t\t\t\t\t\titemClassName\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tdata-testid=\"legend-item\"\n\t\t\t\t\t\t\t\t\tkey={ `legend-${ label.text }-${ i }` }\n\t\t\t\t\t\t\t\t\tmargin={ itemMargin }\n\t\t\t\t\t\t\t\t\tflexDirection={\n\t\t\t\t\t\t\t\t\t\torientation === 'vertical' && alignment === 'end'\n\t\t\t\t\t\t\t\t\t\t\t? 'row-reverse'\n\t\t\t\t\t\t\t\t\t\t\t: itemDirection\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonClick={ handleClick }\n\t\t\t\t\t\t\t\t\tonKeyDown={ handleKeyDown }\n\t\t\t\t\t\t\t\t\trole={ interactive ? 'button' : 'listitem' }\n\t\t\t\t\t\t\t\t\ttabIndex={ interactive ? 0 : undefined }\n\t\t\t\t\t\t\t\t\taria-pressed={ interactive ? visible : undefined }\n\t\t\t\t\t\t\t\t\taria-label={ getLegendItemAriaLabel(\n\t\t\t\t\t\t\t\t\t\tlabel.text,\n\t\t\t\t\t\t\t\t\t\tmatchedItem?.value,\n\t\t\t\t\t\t\t\t\t\tvisible,\n\t\t\t\t\t\t\t\t\t\tinteractive\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ items[ i ]?.renderGlyph ? (\n\t\t\t\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\t\t\t\twidth={ items[ i ]?.glyphSize * 2 }\n\t\t\t\t\t\t\t\t\t\t\theight={ items[ i ]?.glyphSize * 2 }\n\t\t\t\t\t\t\t\t\t\t\tdata-testid=\"legend-glyph\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<Group>\n\t\t\t\t\t\t\t\t\t\t\t\t{ items[ i ]?.renderGlyph( {\n\t\t\t\t\t\t\t\t\t\t\t\t\tkey: `legend-glyph-${ label.text }`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tdatum: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex: i,\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolor: fill( label ),\n\t\t\t\t\t\t\t\t\t\t\t\t\tsize: items[ i ]?.glyphSize,\n\t\t\t\t\t\t\t\t\t\t\t\t\tx: items[ i ]?.glyphSize,\n\t\t\t\t\t\t\t\t\t\t\t\t\ty: items[ i ]?.glyphSize,\n\t\t\t\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t\t\t\t</Group>\n\t\t\t\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<LegendShape\n\t\t\t\t\t\t\t\t\t\t\tshape={ shape }\n\t\t\t\t\t\t\t\t\t\t\theight={ shapeHeight }\n\t\t\t\t\t\t\t\t\t\t\twidth={ shapeWidth }\n\t\t\t\t\t\t\t\t\t\t\tmargin={ shapeMargin }\n\t\t\t\t\t\t\t\t\t\t\titem={ domain[ i ] }\n\t\t\t\t\t\t\t\t\t\t\titemIndex={ i }\n\t\t\t\t\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\t\t\t\t\tfill={ fill }\n\t\t\t\t\t\t\t\t\t\t\tsize={ size }\n\t\t\t\t\t\t\t\t\t\t\tshapeStyle={ getShapeStyle }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t<LegendLabel\n\t\t\t\t\t\t\t\t\t\tdata-testid=\"legend-label\"\n\t\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t\t'visx-legend-label',\n\t\t\t\t\t\t\t\t\t\t\tstyles[ 'legend-item-label' ],\n\t\t\t\t\t\t\t\t\t\t\tlabelClassName\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\t\tflex: labelFlex,\n\t\t\t\t\t\t\t\t\t\t\tmargin: labelMargin,\n\t\t\t\t\t\t\t\t\t\t\t...theme.legend?.labelStyles,\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Stack align=\"center\" gap=\"sm\" justify={ labelJustifyContent }>\n\t\t\t\t\t\t\t\t\t\t\t<LegendText\n\t\t\t\t\t\t\t\t\t\t\t\ttext={ label.text }\n\t\t\t\t\t\t\t\t\t\t\t\ttextOverflow={ textOverflow }\n\t\t\t\t\t\t\t\t\t\t\t\tmaxWidth={ maxWidth }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t{ matchedItem?.value != null && matchedItem.value !== '' && (\n\t\t\t\t\t\t\t\t\t\t\t\t<span className={ styles[ 'legend-item-value' ] }>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ '\\u00A0' }\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ matchedItem.value }\n\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t\t\t</LegendLabel>\n\t\t\t\t\t\t\t\t</LegendItem>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t</Stack>\n\t\t\t\t) }\n\t\t\t</LegendOrdinal>\n\t\t);\n\t}\n);\n","import { useContext, useMemo, forwardRef } from 'react';\nimport { ChartInstanceContext } from '../../charts/private/chart-instance-context';\nimport { GlobalChartsContext } from '../../providers';\nimport { BaseLegend } from './private';\nimport type { LegendProps } from './types';\nimport type { ChartType, LegendShape } from '../../types';\n\nconst defaultShapeByChartType: Partial<\n\tRecord< ChartType, Extract< LegendShape< unknown, unknown >, string > >\n> = {\n\tarea: 'rect',\n\tline: 'line',\n\tbar: 'rect',\n\tpie: 'circle',\n\t'pie-semi-circle': 'circle',\n\tleaderboard: 'circle',\n};\n\nexport const Legend = forwardRef< HTMLDivElement, LegendProps >(\n\t( { chartId, items, shape, ...props }, ref ) => {\n\t\t// Get context but don't throw if it doesn't exist\n\t\tconst context = useContext( GlobalChartsContext );\n\t\tconst chartInstanceContext = useContext( ChartInstanceContext );\n\n\t\t// When chartId is used, it is standalone mode\n\t\t// When chartId is not provided, we use the context's chartId, meaning it is inside a chart instance\n\t\tconst contextChartId = chartId ?? chartInstanceContext?.chartId;\n\n\t\tconst chartData = useMemo(\n\t\t\t() => ( contextChartId && context ? context.getChartData( contextChartId ) : undefined ),\n\t\t\t[ contextChartId, context ]\n\t\t);\n\n\t\tconst contextItems = chartData?.legendItems;\n\n\t\t// Derive the default legend shape from the chart type when no explicit shape is provided\n\t\tconst resolvedShape =\n\t\t\tshape ??\n\t\t\t( chartData?.chartType ? defaultShapeByChartType[ chartData.chartType ] : undefined );\n\n\t\t// Provided items take precedence over context items\n\t\tconst legendItems = ( items || contextItems ) as typeof items;\n\n\t\tif ( ! legendItems ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<BaseLegend\n\t\t\t\tref={ ref }\n\t\t\t\titems={ legendItems }\n\t\t\t\tshape={ resolvedShape }\n\t\t\t\t{ ...props }\n\t\t\t\tchartId={ contextChartId }\n\t\t\t/>\n\t\t);\n\t}\n);\n","import { formatNumber } from '@automattic/number-formatters';\nimport { useMemo } from 'react';\nimport {\n\tuseGlobalChartsContext,\n\ttype GetElementStylesParams,\n\ttype ElementStyles,\n} from '../../../providers';\nimport { formatPercentage } from '../../../utils';\nimport type {\n\tSeriesData,\n\tDataPointDate,\n\tDataPointPercentageCalculated,\n\tLegendShape,\n} from '../../../types';\nimport type { BaseLegendItem } from '../types';\nimport type { GlyphProps } from '@visx/xychart';\nimport type { ReactNode } from 'react';\n\nexport type LegendValueDisplay = 'percentage' | 'value' | 'valueDisplay' | 'none';\n\nexport interface ChartLegendOptions {\n\twithGlyph?: boolean;\n\tglyphSize?: number;\n\trenderGlyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode;\n\tshowValues?: boolean;\n\tlegendValueDisplay?: LegendValueDisplay;\n\tlegendShape?: LegendShape< SeriesData[], number >;\n\t/**\n\t * Collapse series that share a `group` into a single legend item, labelled by the group's\n\t * primary series. Off by default, so every series gets its own item.\n\t */\n\tcollapseGroups?: boolean;\n}\n\n/**\n * Formats the value for a data point based on its type and display preference\n * @param point - The data point to format\n * @param showValues - Whether to show values or return empty string\n * @param legendValueDisplay - What type of value to display\n * @return Formatted value string\n */\nfunction formatPointValue(\n\tpoint: DataPointDate | DataPointPercentageCalculated,\n\tshowValues: boolean,\n\tlegendValueDisplay: LegendValueDisplay = 'percentage'\n): string {\n\tif ( ! showValues || legendValueDisplay === 'none' ) {\n\t\treturn '';\n\t}\n\n\t// Handle DataPointPercentageCalculated (pie chart data with calculated percentage)\n\tif ( 'percentage' in point ) {\n\t\tswitch ( legendValueDisplay ) {\n\t\t\tcase 'percentage':\n\t\t\t\treturn formatPercentage( point.percentage );\n\t\t\tcase 'value':\n\t\t\t\treturn formatNumber( point.value );\n\t\t\tcase 'valueDisplay':\n\t\t\t\treturn point.valueDisplay || formatNumber( point.value );\n\t\t\tdefault:\n\t\t\t\treturn '';\n\t\t}\n\t}\n\n\t// Handle DataPointDate (time series data)\n\tif ( 'value' in point ) {\n\t\treturn point.value !== null ? formatNumber( point.value ) : '';\n\t}\n\n\treturn '';\n}\n\n/**\n * Applies glyph configuration to a legend item if needed\n * @param baseItem - The base legend item\n * @param withGlyph - Whether to include glyph rendering\n * @param glyph - Glyph component from theme\n * @param renderGlyph - Custom glyph render function\n * @param glyphSize - Size of the glyph\n * @return The legend item with glyph configuration applied if applicable\n */\nfunction applyGlyphToLegendItem(\n\tbaseItem: BaseLegendItem,\n\twithGlyph: boolean,\n\tglyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode,\n\trenderGlyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode,\n\tglyphSize?: number\n): BaseLegendItem {\n\tif ( withGlyph ) {\n\t\tconst glyphToUse = glyph || renderGlyph;\n\t\tif ( glyphToUse ) {\n\t\t\treturn {\n\t\t\t\t...baseItem,\n\t\t\t\tglyphSize,\n\t\t\t\trenderGlyph: glyphToUse,\n\t\t\t};\n\t\t}\n\t}\n\n\treturn baseItem;\n}\n\ntype SeriesGroupMember = { series: SeriesData; index: number };\n\n/**\n * Buckets series by their `group`, preserving first-appearance order. Series with no group — or a\n * group value unique to them — end up in a bucket of their own. Whether a multi-series bucket then\n * collapses to a single legend item is decided by the caller: with `collapseGroups` on, every\n * multi-member bucket collapses, and the comparison pattern only decides which member represents it.\n * @param seriesData - The series data to group\n * @return Ordered groups, each holding its member series with their original indices\n */\nfunction groupSeriesForLegend( seriesData: SeriesData[] ): SeriesGroupMember[][] {\n\tconst groups: SeriesGroupMember[][] = [];\n\tconst groupIndexByKey = new Map< string, number >();\n\n\tseriesData.forEach( ( series, index ) => {\n\t\tconst member: SeriesGroupMember = { series, index };\n\t\tconst key = series.group;\n\n\t\tif ( key === undefined ) {\n\t\t\tgroups.push( [ member ] );\n\t\t\treturn;\n\t\t}\n\n\t\tconst existing = groupIndexByKey.get( key );\n\t\tif ( existing === undefined ) {\n\t\t\tgroupIndexByKey.set( key, groups.length );\n\t\t\tgroups.push( [ member ] );\n\t\t} else {\n\t\t\tgroups[ existing ].push( member );\n\t\t}\n\t} );\n\n\treturn groups;\n}\n\n/**\n * Builds a single legend item from a representative series, tagging it with the series it controls\n * @param member - The series (with its original index) that provides the label/colour\n * @param seriesLabels - Every series label this item toggles (grouped) or just its own\n * @param getElementStyles - Function to get element styles\n * @param showValues - Whether to show values in legend\n * @param withGlyph - Whether to include glyph rendering\n * @param glyphSize - Size of the glyph\n * @param renderGlyph - Component to render the glyph\n * @param legendShape - The shape type for legend items (string literal or React component)\n * @return The processed legend item\n */\nfunction buildSeriesLegendItem(\n\tmember: SeriesGroupMember,\n\tseriesLabels: string[],\n\tgetElementStyles: ( params: GetElementStylesParams ) => ElementStyles,\n\tshowValues: boolean,\n\twithGlyph: boolean,\n\tglyphSize: number,\n\trenderGlyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode,\n\tlegendShape?: LegendShape< SeriesData[], number >\n): BaseLegendItem {\n\tconst { color, glyph, shapeStyles } = getElementStyles( {\n\t\tdata: member.series,\n\t\tindex: member.index,\n\t\tlegendShape,\n\t} );\n\n\tconst baseItem: BaseLegendItem = {\n\t\tlabel: member.series.label,\n\t\tvalue: showValues ? member.series.data?.length?.toString() || '0' : '',\n\t\tcolor,\n\t\tshapeStyle: shapeStyles,\n\t\tseriesLabels,\n\t};\n\n\treturn applyGlyphToLegendItem( baseItem, withGlyph, glyph, renderGlyph, glyphSize );\n}\n\n/**\n * Processes SeriesData into legend items. Every series keeps its own legend entry unless\n * `collapseGroups` is set, in which case series sharing a `group` collapse to one item labelled by\n * the group's primary (its first non-comparison member).\n * @param seriesData - The series data to process\n * @param getElementStyles - Function to get element styles\n * @param showValues - Whether to show values in legend\n * @param withGlyph - Whether to include glyph rendering\n * @param glyphSize - Size of the glyph\n * @param collapseGroups - Whether series sharing a group collapse to a single item\n * @param renderGlyph - Component to render the glyph\n * @param legendShape - The shape type for legend items (string literal or React component)\n * @return Array of processed legend items\n */\nfunction processSeriesData(\n\tseriesData: SeriesData[],\n\tgetElementStyles: ( params: GetElementStylesParams ) => ElementStyles,\n\tshowValues: boolean,\n\twithGlyph: boolean,\n\tglyphSize: number,\n\tcollapseGroups: boolean,\n\trenderGlyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode,\n\tlegendShape?: LegendShape< SeriesData[], number >\n): BaseLegendItem[] {\n\tconst buildItem = ( member: SeriesGroupMember, seriesLabels: string[] ) =>\n\t\tbuildSeriesLegendItem(\n\t\t\tmember,\n\t\t\tseriesLabels,\n\t\t\tgetElementStyles,\n\t\t\tshowValues,\n\t\t\twithGlyph,\n\t\t\tglyphSize,\n\t\t\trenderGlyph,\n\t\t\tlegendShape\n\t\t);\n\n\t// Without collapsing there is no reason to bucket by group — mapping series directly keeps the\n\t// original order, which matters for charts that already interleave grouped series for colour.\n\tif ( ! collapseGroups ) {\n\t\treturn seriesData.map( ( series, index ) => buildItem( { series, index }, [ series.label ] ) );\n\t}\n\n\treturn groupSeriesForLegend( seriesData ).flatMap( members => {\n\t\tif ( members.length > 1 ) {\n\t\t\tconst primary =\n\t\t\t\tmembers.find( ( { series } ) => series.options?.type !== 'comparison' ) ?? members[ 0 ];\n\n\t\t\t// Primary first so the interactive visibility check reads the series that owns the swatch.\n\t\t\tconst seriesLabels = [\n\t\t\t\tprimary.series.label,\n\t\t\t\t...members.filter( member => member !== primary ).map( ( { series } ) => series.label ),\n\t\t\t];\n\n\t\t\treturn [ buildItem( primary, seriesLabels ) ];\n\t\t}\n\n\t\treturn members.map( member => buildItem( member, [ member.series.label ] ) );\n\t} );\n}\n\n/**\n * Processes point data into legend items\n * @param pointData - The point data to process\n * @param getElementStyles - Function to get element styles\n * @param showValues - Whether to show values in legend\n * @param legendValueDisplay - What type of value to display\n * @param withGlyph - Whether to include glyph rendering\n * @param glyphSize - Size of the glyph\n * @param renderGlyph - Component to render the glyph\n * @param legendShape - The shape type for legend items (string literal or React component)\n * @return Array of processed legend items\n */\nfunction processPointData(\n\tpointData: ( DataPointDate | DataPointPercentageCalculated )[],\n\tgetElementStyles: ( params: GetElementStylesParams ) => ElementStyles,\n\tshowValues: boolean,\n\tlegendValueDisplay: LegendValueDisplay,\n\twithGlyph: boolean,\n\tglyphSize: number,\n\trenderGlyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode,\n\tlegendShape?: LegendShape< SeriesData[], number >\n): BaseLegendItem[] {\n\tconst mapper = ( point: DataPointDate | DataPointPercentageCalculated, index: number ) => {\n\t\tconst { color, glyph, shapeStyles } = getElementStyles( {\n\t\t\tdata: point as DataPointPercentageCalculated,\n\t\t\tindex,\n\t\t\tlegendShape,\n\t\t} );\n\n\t\tconst baseItem: BaseLegendItem = {\n\t\t\tlabel: point.label,\n\t\t\tvalue: formatPointValue( point, showValues, legendValueDisplay ),\n\t\t\tcolor,\n\t\t\tshapeStyle: shapeStyles,\n\t\t};\n\n\t\treturn applyGlyphToLegendItem( baseItem, withGlyph, glyph, renderGlyph, glyphSize );\n\t};\n\n\treturn pointData.map( mapper );\n}\n\n/**\n * Hook to transform chart data into legend items\n * @param data - The chart data to transform\n * @param options - Configuration options for legend generation\n * @param legendShape - The shape type for legend items (string literal or React component)\n * @return Array of legend items ready for display\n */\nexport function useChartLegendItems<\n\tT extends SeriesData[] | DataPointDate[] | DataPointPercentageCalculated[],\n>(\n\tdata: T,\n\toptions: ChartLegendOptions = {},\n\tlegendShape?: LegendShape< SeriesData[], number >\n): BaseLegendItem[] {\n\tconst {\n\t\tshowValues = false,\n\t\tlegendValueDisplay = 'percentage',\n\t\twithGlyph = false,\n\t\tglyphSize = 8,\n\t\tcollapseGroups = false,\n\t\trenderGlyph,\n\t} = options;\n\tconst { getElementStyles } = useGlobalChartsContext();\n\n\treturn useMemo( () => {\n\t\tif ( ! data || ! Array.isArray( data ) || data.length === 0 ) {\n\t\t\treturn [];\n\t\t}\n\n\t\t// Handle SeriesData (multiple series with data points)\n\t\tif ( 'data' in data[ 0 ] ) {\n\t\t\treturn processSeriesData(\n\t\t\t\tdata as SeriesData[],\n\t\t\t\tgetElementStyles,\n\t\t\t\tshowValues,\n\t\t\t\twithGlyph,\n\t\t\t\tglyphSize,\n\t\t\t\tcollapseGroups,\n\t\t\t\trenderGlyph,\n\t\t\t\tlegendShape\n\t\t\t);\n\t\t}\n\n\t\t// Handle DataPointDate or DataPointPercentageCalculated (single data points)\n\t\treturn processPointData(\n\t\t\tdata as ( DataPointDate | DataPointPercentageCalculated )[],\n\t\t\tgetElementStyles,\n\t\t\tshowValues,\n\t\t\tlegendValueDisplay,\n\t\t\twithGlyph,\n\t\t\tglyphSize,\n\t\t\trenderGlyph,\n\t\t\tlegendShape\n\t\t);\n\t}, [\n\t\tdata,\n\t\tgetElementStyles,\n\t\tshowValues,\n\t\tlegendValueDisplay,\n\t\twithGlyph,\n\t\tglyphSize,\n\t\tcollapseGroups,\n\t\trenderGlyph,\n\t\tlegendShape,\n\t] );\n}\n","import { formatNumber } from '@automattic/number-formatters';\nimport clsx from 'clsx';\nimport { useStandaloneScopeClass } from '../../providers/chart-scope';\nimport styles from './base-tooltip.module.scss';\nimport type { CSSProperties, ComponentType, ReactNode } from 'react';\n\ntype TooltipData = {\n\tlabel: string;\n\tvalue: number;\n\tvalueDisplay?: string;\n};\n\ntype TooltipComponentProps = {\n\tdata: TooltipData;\n\tclassName?: string;\n};\n\ntype TooltipCommonProps = {\n\ttop: number;\n\tleft: number;\n\tstyle?: CSSProperties;\n\tclassName?: string;\n\t/**\n\t * Whether to render the tooltip container div. When false, only renders the content.\n\t * Useful when the tooltip is rendered inside a portal or custom container.\n\t * @default true\n\t */\n\trenderContainer?: boolean;\n};\n\ntype DefaultDataTooltip = {\n\tdata: TooltipData;\n\tcomponent?: ComponentType< TooltipComponentProps >;\n\tchildren?: never;\n};\n\ntype CustomTooltip = {\n\tchildren: ReactNode;\n\tdata?: never;\n\tcomponent?: never;\n};\n\ntype BaseTooltipProps = TooltipCommonProps & ( DefaultDataTooltip | CustomTooltip );\n\nconst DefaultTooltipContent = ( { data }: TooltipComponentProps ) => (\n\t<>\n\t\t{ data?.label }: { data?.valueDisplay || formatNumber( data?.value ) }\n\t</>\n);\n\nexport const BaseTooltip = ( {\n\tdata,\n\ttop,\n\tleft,\n\tcomponent: Component = DefaultTooltipContent,\n\tchildren,\n\tclassName,\n\tstyle,\n\trenderContainer = true,\n}: BaseTooltipProps ) => {\n\tconst content = children || ( data && <Component data={ data } className={ className } /> );\n\tconst standaloneScopeClass = useStandaloneScopeClass();\n\n\tif ( ! renderContainer ) {\n\t\treturn content;\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx( standaloneScopeClass, styles.tooltip ) }\n\t\t\tstyle={ { top, left, ...style } }\n\t\t\trole=\"tooltip\"\n\t\t>\n\t\t\t{ content }\n\t\t</div>\n\t);\n};\n\nexport type { BaseTooltipProps, TooltipData };\n","import { Tooltip, TooltipContext } from '@visx/xychart';\nimport clsx from 'clsx';\nimport { useContext, useEffect, useCallback, useMemo, useRef } from 'react';\nimport { CHART_SCOPE_CLASS } from '../../styles/chart-scope-class';\nimport type { SeriesData, DataPointDate } from '../../types';\nimport type { RenderTooltipParams, XyChartTooltipProps } from '../../visx/types';\nimport type { ReactNode } from 'react';\n\n// Type for flattened tooltip data used in individual mode\nexport type FlattenedTooltipData = {\n\tdatum: DataPointDate;\n\tseriesLabel: string;\n\tseriesIndex: number;\n\tdataPointIndex: number;\n};\n\n// Enhanced tooltip with keyboard navigation and accessibility\ninterface AccessibleTooltipProps\n\textends Omit< XyChartTooltipProps< DataPointDate >, 'renderTooltip' > {\n\trenderTooltip?: ( params: RenderTooltipParams< DataPointDate > ) => ReactNode;\n\tselectedIndex?: number | undefined;\n\ttooltipRef?: ( element: HTMLDivElement | null ) => void;\n\tkeyboardFocusedClassName?: string;\n\t/**\n\t * Flattened tooltip data prepared by parent component\n\t * Each index corresponds to one tooltip to show\n\t */\n\ttooltipData?: FlattenedTooltipData[];\n\t/**\n\t * For line charts: series data to show all series at selected data point\n\t * When provided, shows all series instead of individual tooltips\n\t */\n\tseries?: SeriesData[];\n\t/**\n\t * Whether to combine tooltip information from multiple series into a single tooltip. This is useful for line charts.\n\t * Or to show individual tooltips for each series. This is useful for bar charts.\n\t */\n\tmode?: 'individual' | 'group';\n}\n\nexport const AccessibleTooltip: React.FC< AccessibleTooltipProps > = ( {\n\trenderTooltip,\n\tselectedIndex,\n\ttooltipRef,\n\tkeyboardFocusedClassName,\n\tseries = [],\n\tmode = 'group',\n\t...props\n} ) => {\n\tconst tooltipContext = useContext( TooltipContext );\n\n\tconst tooltipData = useMemo( () => {\n\t\tif ( mode !== 'individual' ) return [];\n\t\tif ( series.length === 0 ) return [];\n\n\t\tconst maxDataPoints = Math.max( ...series.map( s => s.data.length ) );\n\t\tconst flattened: Array< {\n\t\t\tdatum: DataPointDate;\n\t\t\tseriesLabel: string;\n\t\t\tseriesIndex: number;\n\t\t\tdataPointIndex: number;\n\t\t} > = [];\n\n\t\t// Pattern: [series1[0], series2[0], series3[0], series1[1], series2[1], series3[1], ...]\n\t\tfor ( let dataPointIndex = 0; dataPointIndex < maxDataPoints; dataPointIndex++ ) {\n\t\t\tfor ( let seriesIndex = 0; seriesIndex < series.length; seriesIndex++ ) {\n\t\t\t\tconst seriesData = series[ seriesIndex ];\n\t\t\t\tif ( dataPointIndex < seriesData.data.length ) {\n\t\t\t\t\tflattened.push( {\n\t\t\t\t\t\tdatum: seriesData.data[ dataPointIndex ] as DataPointDate,\n\t\t\t\t\t\tseriesLabel: seriesData.label,\n\t\t\t\t\t\tseriesIndex,\n\t\t\t\t\t\tdataPointIndex,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn flattened;\n\t}, [ series, mode ] );\n\n\t// Tracks whether this effect opened a tooltip, so it only closes its own.\n\tconst hasKeyboardSelection = useRef( false );\n\n\t// Handle tooltip highlighting for keyboard navigation\n\tuseEffect( () => {\n\t\tif ( selectedIndex === undefined ) {\n\t\t\t// visx debounces the hide and cancels only the most recently scheduled one,\n\t\t\t// so hiding on every run leaves earlier hides pending. One of those lands\n\t\t\t// mid-navigation and closes the tooltip the user is reading.\n\t\t\tif ( hasKeyboardSelection.current ) {\n\t\t\t\thasKeyboardSelection.current = false;\n\t\t\t\ttooltipContext?.hideTooltip();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\thasKeyboardSelection.current = true;\n\n\t\tif ( mode === 'group' ) {\n\t\t\t// Show all series at the selected data point index in single tooltip.\n\t\t\tseries.forEach( ( s, index ) => {\n\t\t\t\tif ( selectedIndex < s.data.length ) {\n\t\t\t\t\tconst datum = s.data[ selectedIndex ];\n\n\t\t\t\t\ttooltipContext?.showTooltip( {\n\t\t\t\t\t\tdatum,\n\t\t\t\t\t\tkey: s.label,\n\t\t\t\t\t\tindex,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t} else if ( mode === 'individual' ) {\n\t\t\t// Show individual tooltips for each datapoint from each series.\n\t\t\tif ( selectedIndex < tooltipData.length ) {\n\t\t\t\tconst tooltipItem = tooltipData[ selectedIndex ];\n\n\t\t\t\ttooltipContext?.showTooltip( {\n\t\t\t\t\tdatum: tooltipItem.datum,\n\t\t\t\t\tkey: tooltipItem.seriesLabel,\n\t\t\t\t\tindex: tooltipItem.seriesIndex,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\n\t\t// Don't include tooltipContext in the dependency array to avoid loop.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ selectedIndex, tooltipData, series ] );\n\n\t// Create a focusable renderTooltip that includes accessibility features\n\tconst focusableRenderTooltip = useMemo( () => {\n\t\tif ( ! renderTooltip ) return undefined;\n\n\t\treturn ( params: RenderTooltipParams< DataPointDate > ) => {\n\t\t\tconst tooltipContent = renderTooltip( params );\n\n\t\t\tif ( selectedIndex !== undefined ) {\n\t\t\t\treturn (\n\t\t\t\t\t<div\n\t\t\t\t\t\tref={ tooltipRef }\n\t\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t\t\trole=\"tooltip\"\n\t\t\t\t\t\taria-atomic=\"true\"\n\t\t\t\t\t\tclassName={ clsx( CHART_SCOPE_CLASS, keyboardFocusedClassName ) }\n\t\t\t\t\t\tdata-testid={ `chart-tooltip-${ selectedIndex }` }\n\t\t\t\t\t\tkey={ `chart-tooltip-${ selectedIndex }` }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ tooltipContent }\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<div className={ CHART_SCOPE_CLASS } role=\"tooltip\" aria-live=\"polite\">\n\t\t\t\t\t{ tooltipContent }\n\t\t\t\t</div>\n\t\t\t);\n\t\t};\n\t}, [ renderTooltip, selectedIndex, tooltipRef, keyboardFocusedClassName ] );\n\n\treturn <Tooltip { ...props } renderTooltip={ focusableRenderTooltip } />;\n};\n\n// Keyboard navigation hook for charts\ninterface UseKeyboardNavigationProps {\n\tselectedIndex: number | undefined;\n\tsetSelectedIndex: ( index: number | undefined ) => void;\n\tisNavigating: boolean;\n\tsetIsNavigating: ( navigating: boolean ) => void;\n\tchartRef: React.RefObject< HTMLDivElement >;\n\t/**\n\t * Total number of navigation points (length of tooltip data array)\n\t */\n\ttotalPoints: number;\n}\n\nexport const useKeyboardNavigation = ( {\n\tselectedIndex,\n\tsetSelectedIndex,\n\tisNavigating,\n\tsetIsNavigating,\n\tchartRef,\n\ttotalPoints,\n}: UseKeyboardNavigationProps ) => {\n\t// Focus the tooltip as soon as it is rendered\n\tconst tooltipRef = useCallback(\n\t\t( element: HTMLDivElement | null ) => {\n\t\t\tif ( element && selectedIndex !== undefined ) {\n\t\t\t\telement.focus();\n\t\t\t}\n\t\t},\n\t\t[ selectedIndex ]\n\t);\n\n\t// On each focus of chart, reset the selectedIndex to 0, if keyboard navigation is not already active\n\tconst onChartFocus = useCallback( () => {\n\t\tif ( ! isNavigating && selectedIndex !== undefined ) {\n\t\t\tsetSelectedIndex( 0 );\n\t\t}\n\t}, [ isNavigating, selectedIndex, setSelectedIndex ] );\n\n\t// On each blur of chart, keyboard navigation should restart from first tooltip\n\tconst onChartBlur = useCallback( () => {\n\t\tsetIsNavigating( false );\n\t}, [ setIsNavigating ] );\n\n\tconst onChartKeyDown = useCallback(\n\t\t( event: React.KeyboardEvent< HTMLDivElement > ) => {\n\t\t\tif ( totalPoints === 0 ) return;\n\n\t\t\t// Keep focus on the chart if tab is pressed\n\t\t\tif ( event.key === 'Tab' ) {\n\t\t\t\tchartRef.current?.focus();\n\t\t\t\tsetSelectedIndex( undefined );\n\t\t\t\tsetIsNavigating( false );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst currentSelectedIndex = selectedIndex === undefined ? -1 : selectedIndex;\n\n\t\t\tif ( currentSelectedIndex + 1 >= totalPoints && [ 'ArrowRight' ].includes( event.key ) ) {\n\t\t\t\tchartRef.current?.focus();\n\t\t\t\tsetSelectedIndex( undefined );\n\t\t\t\tsetIsNavigating( false );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tevent.preventDefault();\n\n\t\t\tif ( [ 'ArrowRight' ].includes( event.key ) ) {\n\t\t\t\tsetIsNavigating( true );\n\t\t\t\tsetSelectedIndex( ( currentSelectedIndex + 1 ) % totalPoints );\n\t\t\t} else if ( [ 'ArrowLeft' ].includes( event.key ) ) {\n\t\t\t\tsetIsNavigating( true );\n\t\t\t\tsetSelectedIndex( ( currentSelectedIndex - 1 + totalPoints ) % totalPoints );\n\t\t\t} else if ( event.key === 'Escape' ) {\n\t\t\t\tsetSelectedIndex( undefined );\n\t\t\t\tsetIsNavigating( false );\n\t\t\t\tchartRef.current?.focus();\n\t\t\t}\n\t\t},\n\t\t[ totalPoints, selectedIndex, setSelectedIndex, setIsNavigating, chartRef ]\n\t);\n\n\treturn {\n\t\ttooltipRef,\n\t\tonChartFocus,\n\t\tonChartBlur,\n\t\tonChartKeyDown,\n\t};\n};\n\n// Re-export the base Tooltip for backwards compatibility\nexport { Tooltip };\n","import { useEffect, useLayoutEffect, useMemo, useRef } from 'react';\nimport { useGlobalChartsContext } from './use-global-charts-context';\n\n// Hide seeded series before paint without triggering React's SSR warning.\nconst useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;\n\n/**\n * Seeds a chart's hidden series once per chart ID, the first time the provider\n * sees that ID.\n *\n * The provider owns the record of what has been seeded, not this hook: a\n * mount-scoped one would re-apply the defaults on every remount, and a chart\n * remounts for reasons the reader never thinks of as a new chart — switching\n * between line and bar, tabbing away and back, a resize flipping tabs into a\n * dropdown. Each of those would throw away the series they had just revealed.\n *\n * @param chartId - The chart ID passed to the provider's visibility methods.\n * @param seriesLabels - Labels to hide when this chart ID is first seen. Later values are ignored.\n * @return The resolved hidden-series set.\n */\nexport const useDefaultHiddenSeries = (\n\tchartId: string,\n\tseriesLabels?: readonly string[]\n): Set< string > => {\n\tconst { getHiddenSeries, seedChartHiddenSeries, hasSeededChart } = useGlobalChartsContext();\n\t// Read through a ref so the effect never depends on a new array identity.\n\tconst labelsRef = useRef( seriesLabels );\n\tlabelsRef.current = seriesLabels;\n\tconst hasSeriesLabels = seriesLabels !== undefined;\n\tconst shouldUseDefaults = hasSeriesLabels && ! hasSeededChart( chartId );\n\n\tuseIsomorphicLayoutEffect( () => {\n\t\tif ( labelsRef.current === undefined ) {\n\t\t\treturn;\n\t\t}\n\t\tseedChartHiddenSeries( chartId, labelsRef.current );\n\t}, [ chartId, hasSeriesLabels, seedChartHiddenSeries ] );\n\n\t// getHiddenSeries hands out a fresh copy per call, so hold the set still between\n\t// visibility changes. Charts derive their rendered series from it, and a new\n\t// identity every render invalidates every memo downstream — including the one\n\t// the accessible tooltip watches, which closes a tooltip mid-navigation.\n\treturn useMemo(\n\t\t() => ( shouldUseDefaults ? new Set( labelsRef.current ) : getHiddenSeries( chartId ) ),\n\t\t[ shouldUseDefaults, getHiddenSeries, chartId ]\n\t);\n};\n","import type { FC, PropsWithChildren } from 'react';\n\n/**\n * Compound component for SVG children in charts.\n * This component serves as a marker for SVG content that should be rendered\n * inside the chart's SVG element. The actual rendering is handled by the parent chart.\n *\n * @param {PropsWithChildren} props - Component props\n * @param {ReactNode} props.children - Child elements to render inside the SVG\n * @return {JSX.Element} The children wrapped in a fragment\n */\nexport const ChartSVG: FC< PropsWithChildren > = ( { children } ) => {\n\t// This component doesn't render directly - its children are extracted by the parent chart\n\t// We just return the children as-is\n\treturn <>{ children }</>;\n};\n\n// Set displayName for better debugging and type checking\nChartSVG.displayName = 'Chart.SVG';\n","import type { FC, PropsWithChildren } from 'react';\n\n/**\n * Compound component for HTML children in charts.\n * This component serves as a marker for HTML content that should be rendered\n * outside the chart's SVG element. The actual rendering is handled by the parent chart.\n *\n * @param {PropsWithChildren} props - Component props\n * @param {ReactNode} props.children - Child elements to render outside the SVG\n * @return {JSX.Element} The children wrapped in a fragment\n */\nexport const ChartHTML: FC< PropsWithChildren > = ( { children } ) => {\n\t// This component doesn't render directly - its children are extracted by the parent chart\n\t// We just return the children as-is\n\treturn <>{ children }</>;\n};\n\n// Set displayName for better debugging and type checking\nChartHTML.displayName = 'Chart.HTML';\n","import { createElement, Fragment } from 'react';\nimport type { LegendChild } from './use-chart-children';\nimport type { LegendPosition } from '../../../types';\nimport type { ReactNode } from 'react';\n\n/**\n * Renders legend children filtered by position slot.\n *\n * @param {LegendChild[]} legendChildren - The legend children to filter and render\n * @param {LegendPosition} position - The position slot to render\n * @return {ReactNode[]} Array of legend elements for the given position\n */\nexport function renderLegendSlot(\n\tlegendChildren: LegendChild[],\n\tposition: LegendPosition\n): ReactNode[] {\n\treturn legendChildren\n\t\t.filter( l => l.position === position )\n\t\t.map( ( l, i ) =>\n\t\t\tcreateElement( Fragment, { key: `legend-${ position }-${ i }` }, l.element )\n\t\t);\n}\n","import { Group } from '@visx/group';\nimport { useMemo, Children, isValidElement } from 'react';\nimport { Legend } from '../../../components/legend';\nimport type { LegendPosition } from '../../../types';\nimport type { ReactElement, ReactNode } from 'react';\n\nexport type LegendChild = {\n\telement: ReactElement;\n\tposition: LegendPosition;\n};\n\ninterface ChartChildren {\n\tsvgChildren: ReactNode[];\n\thtmlChildren: ReactNode[];\n\tlegendChildren: LegendChild[];\n\totherChildren: ReactNode[];\n\t/** All children except Legend, in original order. */\n\tnonLegendChildren: ReactNode[];\n}\n\n/**\n * Custom hook to process and categorize chart children for composition API.\n * Extracts children from compound components (Chart.SVG, Chart.HTML) and\n * maintains backward compatibility with legacy Group components.\n *\n * @param {ReactNode} children - The children prop from the chart component\n * @param {string} chartType - The type of chart (e.g., 'PieChart', 'BarChart')\n * @return {ChartChildren} Categorized children for rendering\n */\nexport function useChartChildren( children: ReactNode, chartType: string ): ChartChildren {\n\treturn useMemo( () => {\n\t\tconst svg: ReactNode[] = [];\n\t\tconst html: ReactNode[] = [];\n\t\tconst legend: LegendChild[] = [];\n\t\tconst other: ReactNode[] = [];\n\t\tconst nonLegend: ReactNode[] = [];\n\n\t\tChildren.forEach( children, child => {\n\t\t\tif ( isValidElement( child ) ) {\n\t\t\t\t// Extract Legend children for position-based slot rendering\n\t\t\t\tif ( child.type === Legend ) {\n\t\t\t\t\tconst rawPosition = child.props?.position;\n\t\t\t\t\tconst position =\n\t\t\t\t\t\trawPosition === 'top' || rawPosition === 'bottom' ? rawPosition : 'bottom';\n\n\t\t\t\t\tlegend.push( { element: child as ReactElement, position } );\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Check displayName for compound components\n\t\t\t\tconst childType = child.type as { displayName?: string };\n\t\t\t\tconst displayName = childType?.displayName;\n\n\t\t\t\t// Handle chart-specific compound components (e.g., PieChart.SVG)\n\t\t\t\tif ( displayName === `${ chartType }.SVG` || displayName === 'Chart.SVG' ) {\n\t\t\t\t\t// Extract children from Chart.SVG with safety checks\n\t\t\t\t\tif ( child.props?.children ) {\n\t\t\t\t\t\tChildren.forEach( child.props.children, svgChild => {\n\t\t\t\t\t\t\tsvg.push( svgChild );\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t} else if ( displayName === `${ chartType }.HTML` || displayName === 'Chart.HTML' ) {\n\t\t\t\t\t// Extract children from Chart.HTML with safety checks\n\t\t\t\t\tif ( child.props?.children ) {\n\t\t\t\t\t\tChildren.forEach( child.props.children, htmlChild => {\n\t\t\t\t\t\t\thtml.push( htmlChild );\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t} else if ( child.type === Group ) {\n\t\t\t\t\t// Legacy support: still check for Group type for backward compatibility\n\t\t\t\t\tsvg.push( child );\n\t\t\t\t} else {\n\t\t\t\t\tother.push( child );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Preserve original order of all non-Legend children\n\t\t\tnonLegend.push( child );\n\t\t} );\n\n\t\treturn {\n\t\t\tsvgChildren: svg,\n\t\t\thtmlChildren: html,\n\t\t\tlegendChildren: legend,\n\t\t\totherChildren: other,\n\t\t\tnonLegendChildren: nonLegend,\n\t\t};\n\t}, [ children, chartType ] );\n}\n","import { Stack } from '@wordpress/ui';\nimport { useEffect } from 'react';\nimport { useElementSize } from '../../../hooks';\nimport { renderLegendSlot } from '../chart-composition';\nimport styles from './chart-layout.module.scss';\nimport type { GapSize, LegendPosition } from '../../../types';\nimport type { LegendChild } from '../chart-composition/use-chart-children';\nimport type { CSSProperties, ReactNode } from 'react';\n\n/**\n * Measurements provided to the render prop when ChartLayout handles resize listening.\n */\nexport interface ContentMeasurements {\n\t/** Measured width of the content area in pixels */\n\tcontentWidth: number;\n\t/** Measured height of the content area in pixels */\n\tcontentHeight: number;\n\t/** True when a non-zero contentHeight measurement is available */\n\tisMeasured: boolean;\n}\n\nexport interface ChartLayoutProps {\n\t/** Position for the prop-based legend element */\n\tlegendPosition: LegendPosition;\n\t/** The legend element rendered via the showLegend prop (false when hidden) */\n\tlegendElement?: ReactNode;\n\t/** Legend children from the composition API */\n\tlegendChildren: LegendChild[];\n\t/** Chart content — either a ReactNode or a render prop receiving content measurements */\n\tchildren: ReactNode | ( ( measurements: ContentMeasurements ) => ReactNode );\n\t/** Content rendered after the bottom legend (e.g., nonLegendChildren, htmlChildren, tooltips) */\n\ttrailingContent?: ReactNode;\n\t/** Called when the measured content height changes (for render-prop mode) */\n\tonContentHeightChange?: ( height: number ) => void;\n\t/** Gap between Stack items */\n\tgap?: GapSize;\n\t/** Additional class names */\n\tclassName?: string;\n\t/** Inline styles (width, height, etc.) */\n\tstyle?: CSSProperties;\n\t/** Test ID for the container */\n\t'data-testid'?: string;\n\t/** Chart ID attribute */\n\t'data-chart-id'?: string;\n}\n\nexport const ChartLayout = ( {\n\tlegendPosition,\n\tlegendElement,\n\tlegendChildren,\n\tchildren,\n\ttrailingContent,\n\tonContentHeightChange,\n\tgap,\n\tclassName,\n\tstyle,\n\t'data-testid': dataTestId,\n\t'data-chart-id': dataChartId,\n}: ChartLayoutProps ) => {\n\tconst [ contentRef, contentWidth, contentHeight ] = useElementSize< HTMLDivElement >();\n\tconst isRenderProp = typeof children === 'function';\n\tconst isMeasured = contentHeight > 0;\n\n\t// When using render-prop children, hide the layout until measurement is available\n\t// to prevent layout shift. Plain ReactNode children don't need this since they\n\t// don't depend on measured dimensions.\n\tconst visibilityStyle: { visibility?: 'hidden' | 'visible' } =\n\t\tisRenderProp && ! isMeasured ? { visibility: 'hidden' } : {};\n\n\tuseEffect( () => {\n\t\tif ( isRenderProp && onContentHeightChange && isMeasured ) {\n\t\t\tonContentHeightChange( contentHeight );\n\t\t}\n\t}, [ isRenderProp, contentHeight, isMeasured, onContentHeightChange ] );\n\tconst renderedChildren = isRenderProp\n\t\t? children( { contentWidth, contentHeight, isMeasured } )\n\t\t: children;\n\n\treturn (\n\t\t<Stack\n\t\t\tdirection=\"column\"\n\t\t\tgap={ gap }\n\t\t\tclassName={ className }\n\t\t\tstyle={ { ...style, ...visibilityStyle } }\n\t\t\tdata-testid={ dataTestId }\n\t\t\tdata-chart-id={ dataChartId }\n\t\t>\n\t\t\t{ legendPosition === 'top' && legendElement }\n\t\t\t{ renderLegendSlot( legendChildren, 'top' ) }\n\n\t\t\t{ isRenderProp ? (\n\t\t\t\t<div ref={ contentRef } className={ styles[ 'chart-layout__content' ] }>\n\t\t\t\t\t{ renderedChildren }\n\t\t\t\t</div>\n\t\t\t) : (\n\t\t\t\trenderedChildren\n\t\t\t) }\n\n\t\t\t{ legendPosition === 'bottom' && legendElement }\n\t\t\t{ renderLegendSlot( legendChildren, 'bottom' ) }\n\n\t\t\t{ trailingContent }\n\t\t</Stack>\n\t);\n};\n","import { DataContext } from '@visx/xychart';\nimport { useContext } from 'react';\nimport type { RenderLineGlyphProps } from '../../line-chart';\n\nexport const DefaultGlyph = < Datum extends object >( props: RenderLineGlyphProps< Datum > ) => {\n\tconst { theme } = useContext( DataContext ) || {};\n\tconst position = props.position || 'start';\n\n\treturn (\n\t\t<circle\n\t\t\tcx={ props.x }\n\t\t\tcy={ props.y }\n\t\t\tr={ props.size }\n\t\t\tfill={ props.color }\n\t\t\tstroke={ theme?.backgroundColor }\n\t\t\tstrokeWidth={ 1.5 }\n\t\t\tpaintOrder=\"fill\"\n\t\t\tdata-testid={ `${ position }-glyph-${ props.index }` }\n\t\t\t{ ...props.glyphStyle }\n\t\t/>\n\t);\n};\n","import { Stack } from '@wordpress/ui';\nimport clsx from 'clsx';\nimport { forwardRef, type ComponentPropsWithoutRef } from 'react';\nimport styles from './center.module.scss';\n\nexport type CenterProps = ComponentPropsWithoutRef< typeof Stack >;\n\n/**\n * Centers its children on both axes and fills its parent.\n *\n * A thin wrapper around `Stack` with `align=\"center\"` and `justify=\"center\"`\n * defaults (both overridable) plus `width: 100%; height: 100%`. Reads more\n * honestly than a `Stack` with both axes centered, and lets call sites drop\n * ad-hoc `*__centering` classes. Forwards its ref and spreads remaining props\n * onto the underlying `Stack`.\n *\n * @param props - Stack props; `align`/`justify` default to `\"center\"`.\n * @param ref - Forwarded to the underlying element.\n * @return The centered layout element.\n */\nexport const Center = forwardRef< HTMLDivElement, CenterProps >(\n\t( { align = 'center', justify = 'center', className, ...props }, ref ) => (\n\t\t<Stack\n\t\t\tref={ ref }\n\t\t\talign={ align }\n\t\t\tjustify={ justify }\n\t\t\tclassName={ clsx( styles.center, className ) }\n\t\t\t{ ...props }\n\t\t/>\n\t)\n);\n\nCenter.displayName = 'Center';\n","import { Center } from '../center';\nimport styles from './svg-empty-state.module.scss';\nimport type { FC, ReactNode } from 'react';\n\ninterface SvgEmptyStateProps {\n\t/** X coordinate of the center point */\n\tx: number;\n\t/** Y coordinate of the center point */\n\ty: number;\n\t/** Available width for the text area */\n\twidth: number;\n\t/** Available height for the text area */\n\theight: number;\n\t/** Text content */\n\tchildren: ReactNode;\n}\n\n/**\n * Renders empty-state text inside an SVG using foreignObject so that the\n * message wraps onto multiple lines instead of being clipped.\n *\n * The component centers the text within the specified area.\n *\n * @param root0 - Component props\n * @param root0.x - X coordinate of the center point\n * @param root0.y - Y coordinate of the center point\n * @param root0.width - Available width for the text area\n * @param root0.height - Available height for the text area\n * @param root0.children - Text content\n * @return {JSX.Element} A foreignObject element containing the centered text.\n */\nexport const SvgEmptyState: FC< SvgEmptyStateProps > = ( { x, y, width, height, children } ) => {\n\treturn (\n\t\t<foreignObject x={ x - width / 2 } y={ y - height / 2 } width={ width } height={ height }>\n\t\t\t<Center className={ styles[ 'svg-empty-state' ] }>{ children }</Center>\n\t\t</foreignObject>\n\t);\n};\n","import { _x } from '@wordpress/i18n';\n\nexport type HiddenChartItemType = 'series' | 'segments';\n\n/**\n * Return the empty-state message for a chart whose items are all hidden.\n *\n * Each translation call has a distinct gettext context. This prevents Terser\n * from folding conditional calls into one call with a conditional msgid, which\n * would make the strings unavailable to static translation extraction.\n *\n * @param interactive - Whether the legend can be used to show hidden items.\n * @param itemType - The chart-specific name for its data items.\n * @return The translated empty-state message.\n */\nexport const getAllHiddenMessage = (\n\tinteractive: boolean,\n\titemType: HiddenChartItemType\n): string => {\n\tif ( itemType === 'segments' ) {\n\t\tif ( interactive ) {\n\t\t\treturn _x(\n\t\t\t\t'All segments are hidden. Click legend items to show data.',\n\t\t\t\t'chart empty state: interactive segments',\n\t\t\t\t'jetpack-charts'\n\t\t\t);\n\t\t}\n\n\t\treturn _x( 'All segments are hidden.', 'chart empty state: segments', 'jetpack-charts' );\n\t}\n\n\tif ( interactive ) {\n\t\treturn _x(\n\t\t\t'All series are hidden. Click legend items to show data.',\n\t\t\t'chart empty state: interactive series',\n\t\t\t'jetpack-charts'\n\t\t);\n\t}\n\n\treturn _x( 'All series are hidden.', 'chart empty state: series', 'jetpack-charts' );\n};\n","import { curveCatmullRom, curveLinear, curveMonotoneX } from '@visx/curve';\nimport { scaleTime } from '@visx/scale';\nimport { differenceInHours, differenceInYears } from 'date-fns';\nimport type { useChartDataTransform } from '../../hooks';\nimport type { TickResolution } from '../../types';\nimport type { CurveType } from '../line-chart/types';\n\n// Approximate min pixel width for an x-axis tick label.\nconst X_TICK_WIDTH = 60;\n\n// Resolve the visx curve generator for a given `curveType` / `smoothing`\n// combination. Shared by LineChart and AreaChart so the two render\n// identically when given the same props.\n//\n// Explicit return type avoids a TS2742 portable-name error in the .d.ts\n// build: the inferred type traces back to `@types/d3-shape` (a transitive\n// dep), but `typeof curveLinear` resolves through `@visx/curve` which we\n// own directly.\nexport const getCurveType = ( type?: CurveType, smoothing?: boolean ): typeof curveLinear => {\n\tif ( ! type ) {\n\t\treturn smoothing ? curveCatmullRom : curveLinear;\n\t}\n\n\tswitch ( type ) {\n\t\tcase 'smooth':\n\t\t\treturn curveCatmullRom;\n\t\tcase 'monotone':\n\t\t\treturn curveMonotoneX;\n\t\tcase 'linear':\n\t\t\treturn curveLinear;\n\t\tdefault:\n\t\t\treturn curveLinear;\n\t}\n};\n\n// Built once and reused: these run per bucket over the whole band domain when\n// the axis picks its tick values, and `toLocaleDateString` rebuilds its\n// formatter on every call once an options object is passed.\nconst dateTimeFormat = ( options: Intl.DateTimeFormatOptions ) => {\n\tlet formatter: Intl.DateTimeFormat;\n\treturn ( timestamp: number ) => {\n\t\t// `Intl.DateTimeFormat` throws on an invalid date where the `Date`\n\t\t// methods it replaces return \"Invalid Date\", and charts are expected to\n\t\t// render past a bad point rather than fail.\n\t\t// visx hands its tick formatter a `Date`, so coerce before the check.\n\t\tif ( ! Number.isFinite( Number( timestamp ) ) ) {\n\t\t\treturn new Date( timestamp ).toLocaleDateString();\n\t\t}\n\t\tformatter = formatter ?? new Intl.DateTimeFormat( undefined, options );\n\t\treturn formatter.format( timestamp );\n\t};\n};\n\nconst formatYearTick = dateTimeFormat( { year: 'numeric' } );\n\nconst formatDateTick = dateTimeFormat( { month: 'short', day: 'numeric' } );\n\nconst formatHourTick = dateTimeFormat( { hour: 'numeric', hour12: true } );\n\nconst formatMonthTick = dateTimeFormat( { month: 'short' } );\n\n/**\n * A tick format, carrying the boundary test that decides its coarser label.\n *\n * A band scale samples by index, so `getBandTickValues` has to steer ticks onto\n * the boundaries a format prints the date or the year at. Hanging the test off\n * the format that branches on it keeps the two from drifting apart.\n */\nexport type TickFormat = ( ( timestamp: number ) => string ) & {\n\tisAnchor?: ( date: Date ) => boolean;\n};\n\nconst boundaryFormat = (\n\tisAnchor: ( date: Date ) => boolean,\n\tatBoundary: ( timestamp: number ) => string,\n\tbetween: ( timestamp: number ) => string\n): TickFormat => {\n\tconst format: TickFormat = ( timestamp: number ) =>\n\t\tisAnchor( new Date( timestamp ) ) ? atBoundary( timestamp ) : between( timestamp );\n\tformat.isAnchor = isAnchor;\n\treturn format;\n};\n\n// Hour ticks with the date at midnight boundaries, so multi-day spans of\n// sub-daily data keep their days identifiable.\nconst formatDateOrHourTick = boundaryFormat(\n\tdate => date.getHours() === 0 && date.getMinutes() === 0,\n\tformatDateTick,\n\tformatHourTick\n);\n\n// Month ticks with the year at January boundaries, for month-or-coarser\n// buckets where a full \"Sep 1\" date would misread as a daily point.\nconst formatMonthOrYearTick = boundaryFormat(\n\tdate => date.getMonth() === 0,\n\tformatYearTick,\n\tformatMonthTick\n);\n\n// Overall time span of the data. Series with no dated points are dropped rather\n// than folded in: an empty comparison series is legitimate, and one undefined\n// bound would turn the whole span into NaN. Null when nothing is dated.\nconst getSpan = ( sortedData: ReturnType< typeof useChartDataTransform > ) => {\n\tconst bounds = sortedData\n\t\t.map( datom => [ datom.data.at( 0 )?.date, datom.data.at( -1 )?.date ] )\n\t\t.filter( ( [ first, last ] ) => first !== undefined && last !== undefined );\n\n\tif ( ! bounds.length ) {\n\t\treturn null;\n\t}\n\n\treturn {\n\t\tminX: Math.min( ...bounds.map( ( [ first ] ) => Number( first ) ) ),\n\t\tmaxX: Math.max( ...bounds.map( ( [ , last ] ) => Number( last ) ) ),\n\t};\n};\n\n// Smallest interval between consecutive points across all series, in hours.\n// Infinity when no series has two points.\nconst getPointSpacingInHours = ( sortedData: ReturnType< typeof useChartDataTransform > ) => {\n\treturn sortedData.reduce(\n\t\t( spacing, datom ) =>\n\t\t\tdatom.data.reduce( ( seriesSpacing, point, index ) => {\n\t\t\t\tconst previous = datom.data[ index - 1 ];\n\t\t\t\tif ( previous?.date === undefined || point?.date === undefined ) {\n\t\t\t\t\treturn seriesSpacing;\n\t\t\t\t}\n\t\t\t\treturn Math.min(\n\t\t\t\t\tseriesSpacing,\n\t\t\t\t\tMath.abs( differenceInHours( point.date, previous.date ) )\n\t\t\t\t);\n\t\t\t}, spacing ),\n\t\tNumber.POSITIVE_INFINITY\n\t);\n};\n\n// 23, not 24: a daily gap shrinks to 23 wall-clock hours across a\n// spring-forward DST transition.\nconst SUB_DAILY_SPACING_HOURS = 23;\n\n// The shortest month, so monthly buckets clear it but weekly ones don't.\nconst MONTHLY_SPACING_HOURS = 28 * 24;\n\n// The bucket size behind the data, as the resolution label the tick formats are\n// keyed on. Exported so consumers that label a single point — bar chart\n// tooltips — read the same classification the axis does instead of inferring\n// the resolution a second way. Weeks report as 'day': both are calendar-date\n// buckets as far as labelling goes.\nexport const getBucketResolution = (\n\tsortedData: ReturnType< typeof useChartDataTransform >,\n\ttickResolution?: TickResolution\n): Exclude< TickResolution, 'week' > => {\n\tif ( tickResolution ) {\n\t\treturn tickResolution === 'week' ? 'day' : tickResolution;\n\t}\n\n\tconst spacingInHours = getPointSpacingInHours( sortedData );\n\tif ( spacingInHours < SUB_DAILY_SPACING_HOURS ) {\n\t\treturn 'hour';\n\t}\n\t// Fewer than two points leaves the spacing unknowable, so fall back to\n\t// calendar dates rather than reading Infinity as a very coarse bucket.\n\tif ( ! Number.isFinite( spacingInHours ) || spacingInHours < MONTHLY_SPACING_HOURS ) {\n\t\treturn 'day';\n\t}\n\t// Twelve shortest months: above any monthly gap (31 days at most) and below\n\t// any yearly one (365 days at least).\n\treturn spacingInHours < 12 * MONTHLY_SPACING_HOURS ? 'month' : 'year';\n};\n\n// Pick the most informative tick formatter for the data's bucket resolution and\n// time span. Month-or-coarser buckets are formatted from the resolution alone —\n// they carry no day to print at any span — while finer buckets narrow with the\n// span: hours within a day, hours with day boundaries for sub-daily data\n// spanning up to a week, calendar dates within a year, otherwise years.\nexport const getFormatter = (\n\tsortedData: ReturnType< typeof useChartDataTransform >,\n\ttickResolution?: TickResolution\n): TickFormat => {\n\tconst resolution = getBucketResolution( sortedData, tickResolution );\n\n\t// The month regime only prints the year at January boundaries, so yearly\n\t// buckets starting mid-year would render as bare month names.\n\tif ( resolution === 'year' ) {\n\t\treturn formatYearTick;\n\t}\n\n\tif ( resolution === 'month' ) {\n\t\treturn formatMonthOrYearTick;\n\t}\n\n\tconst span = getSpan( sortedData );\n\tif ( ! span ) {\n\t\treturn formatDateTick;\n\t}\n\n\tconst diffInHours = Math.abs( differenceInHours( span.maxX, span.minX ) );\n\tif ( resolution === 'hour' ) {\n\t\tif ( diffInHours <= 24 ) {\n\t\t\treturn formatHourTick;\n\t\t}\n\t\tif ( diffInHours <= 24 * 7 ) {\n\t\t\treturn formatDateOrHourTick;\n\t\t}\n\t}\n\n\t// Beyond a year, dates repeat often enough under tick sampling that the year\n\t// is the only part worth printing.\n\treturn Math.abs( differenceInYears( span.maxX, span.minX ) ) <= 1\n\t\t? formatDateTick\n\t\t: formatYearTick;\n};\n\n// Indices of the buckets whose label carries the coarser unit.\nconst getAnchorIndices = ( domain: Date[], isAnchor: ( date: Date ) => boolean ) =>\n\tdomain.reduce< number[] >( ( indices, date, index ) => {\n\t\tif ( isAnchor( date ) ) {\n\t\t\tindices.push( index );\n\t\t}\n\t\treturn indices;\n\t}, [] );\n\n// Index strides worth sampling the domain at. Both roundings of each tick count\n// are needed: flooring alone skips the stride that fits a mid-series anchor on\n// short domains. Anchors add the strides that can land on more than one of them\n// — those dividing their spacing, and the smallest whole multiple that still\n// fits, which carries spans too long for any divisor to reach.\nconst getCandidateSteps = ( length: number, maxTicks: number, anchorSpacing: number | null ) => {\n\tconst steps = new Set< number >();\n\tfor ( let count = maxTicks; count > 1; count-- ) {\n\t\tsteps.add( Math.max( 1, Math.floor( ( length - 1 ) / ( count - 1 ) ) ) );\n\t\tsteps.add( Math.max( 1, Math.ceil( ( length - 1 ) / ( count - 1 ) ) ) );\n\t}\n\n\tif ( anchorSpacing ) {\n\t\tfor ( let divisor = 1; divisor <= anchorSpacing; divisor++ ) {\n\t\t\tif ( anchorSpacing % divisor === 0 ) {\n\t\t\t\tsteps.add( anchorSpacing / divisor );\n\t\t\t}\n\t\t}\n\t\tconst minStep = Math.floor( ( length - 1 ) / Math.max( 1, maxTicks ) ) + 1;\n\t\tsteps.add( Math.ceil( minStep / anchorSpacing ) * anchorSpacing );\n\t}\n\n\treturn steps;\n};\n\n/**\n * Tick values for a band time axis.\n *\n * visx samples a band domain by index from offset zero, blind to which labels\n * carry a boundary and without collapsing repeats — so the tick that prints the\n * year or the date often isn't sampled at all, and a long series can show the\n * same label twice. Choose the values instead: sweep the evenly spaced\n * candidates, including those that step from anchor to anchor, and keep the one\n * that reaches the most anchors without thinning the axis or putting two\n * identical labels side by side.\n *\n * @param domain - Band domain, in axis order.\n * @param tickFormatter - Formatter the axis will render these values with.\n * @param maxTicks - Most ticks the axis should carry.\n * @return Values to hand the axis as `tickValues`.\n */\nexport const getBandTickValues = (\n\tdomain: Date[],\n\ttickFormatter: TickFormat,\n\tmaxTicks: number\n): Date[] => {\n\tif ( ! domain.length ) {\n\t\treturn [];\n\t}\n\n\tconst { isAnchor } = tickFormatter;\n\tconst anchorIndices = isAnchor ? getAnchorIndices( domain, isAnchor ) : [];\n\n\t// Once per bucket rather than once per bucket per candidate: the sweep reads\n\t// the same labels back for every step and offset.\n\tconst domainLabels = domain.map( date => tickFormatter( date.getTime() ) );\n\n\tconst candidates: number[][] = [];\n\tconst consider = ( indices: number[] ) => {\n\t\tif ( ! indices.length || indices.length > maxTicks ) {\n\t\t\treturn;\n\t\t}\n\t\tconst repeats = indices.some(\n\t\t\t( index, position ) =>\n\t\t\t\tposition > 0 && domainLabels[ index ] === domainLabels[ indices[ position - 1 ] ]\n\t\t);\n\t\tif ( ! repeats ) {\n\t\t\tcandidates.push( indices );\n\t\t}\n\t};\n\n\tconst anchorSpacing = anchorIndices.length > 1 ? anchorIndices[ 1 ] - anchorIndices[ 0 ] : null;\n\tfor ( const step of getCandidateSteps( domain.length, maxTicks, anchorSpacing ) ) {\n\t\tfor ( let offset = 0; offset < step; offset++ ) {\n\t\t\tconst indices: number[] = [];\n\t\t\tfor ( let index = offset; index < domain.length; index += step ) {\n\t\t\t\tindices.push( index );\n\t\t\t}\n\t\t\tconsider( indices );\n\t\t}\n\t}\n\n\t// Stepping the anchors themselves rather than the domain, so that anchors an\n\t// uneven number of buckets apart are still all reachable — a wall-clock day\n\t// is 23 buckets of hourly data across a spring-forward DST transition, and a\n\t// fixed stride drifts off midnight for the rest of the span.\n\tfor ( let stride = 1; stride <= anchorIndices.length; stride++ ) {\n\t\tconsider( anchorIndices.filter( ( _, position ) => position % stride === 0 ) );\n\t}\n\n\tif ( ! candidates.length ) {\n\t\treturn [ domain[ 0 ] ];\n\t}\n\n\t// An anchor is worth at most one tick. Ranking anchors above density outright\n\t// collapsed ordinary monthly axes to two ticks — worse than sampling by index,\n\t// which at least stayed dense — while ignoring anchors leaves the year unnamed.\n\tconst densest = candidates.reduce( ( most, indices ) => Math.max( most, indices.length ), 0 );\n\tconst anchorsIn = ( indices: number[] ) =>\n\t\tisAnchor ? indices.filter( index => isAnchor( domain[ index ] ) ).length : 0;\n\n\tconst best = candidates\n\t\t.filter( indices => indices.length >= densest - 1 )\n\t\t.reduce( ( chosen, indices ) => {\n\t\t\tconst gain = anchorsIn( indices ) - anchorsIn( chosen );\n\t\t\treturn gain > 0 || ( gain === 0 && indices.length > chosen.length ) ? indices : chosen;\n\t\t} );\n\n\treturn best.map( index => domain[ index ] );\n};\n\n// Estimate the largest number of x-axis ticks that fit without producing\n// consecutive duplicate labels under the given formatter. Used so the axis\n// adapts to the data's resolution rather than picking a fixed count.\nexport const guessOptimalNumTicks = (\n\tdata: ReturnType< typeof useChartDataTransform >,\n\tchartWidth: number,\n\ttickFormatter: ( timestamp: number, index?: number, values?: unknown ) => string\n) => {\n\tconst span = getSpan( data );\n\tif ( ! span ) {\n\t\treturn 1;\n\t}\n\n\tconst xScale = scaleTime( { domain: [ span.minX, span.maxX ] } );\n\n\tconst upperBound = Math.min(\n\t\tdata[ 0 ]?.data.length || 3,\n\t\tMath.ceil( chartWidth / X_TICK_WIDTH )\n\t);\n\tlet secondBestGuess = 1;\n\n\tfor ( let numTicks = upperBound; numTicks > 1; --numTicks ) {\n\t\tconst ticks = xScale.ticks( numTicks ).map( d => tickFormatter( d.getTime() ) );\n\n\t\tif ( ticks.length > upperBound ) continue;\n\n\t\tsecondBestGuess = Math.max( secondBestGuess, ticks.length );\n\n\t\tconst uniqueTicks = Array.from( new Set( ticks ) );\n\t\tif ( uniqueTicks.length === 1 ) return 1;\n\n\t\tconst hasConsecutiveDuplicate = ticks.some(\n\t\t\t( tick, idx ) => idx > 0 && tick === ticks[ idx - 1 ]\n\t\t);\n\t\tif ( hasConsecutiveDuplicate ) continue;\n\n\t\treturn ticks.length;\n\t}\n\n\treturn secondBestGuess;\n};\n","import { useParentSize } from '@visx/responsive';\nimport clsx from 'clsx';\nimport { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport { ChartScopeContext } from '../../../providers/chart-scope';\nimport styles from './with-responsive.module.scss';\nimport type { BaseChartProps } from '../../../types';\nimport type { ComponentType } from 'react';\n\ntype DimensionProps = {\n\twidth?: number;\n\theight?: number;\n\tsize?: number;\n};\n\nexport type ResponsiveConfig = {\n\t/**\n\t * The maximum width of the chart. Defaults to 1200.\n\t */\n\tmaxWidth?: number;\n\t/**\n\t * The aspect ratio of the chart (height = width * aspectRatio).\n\t * When provided, the chart keeps this ratio and is contained within the\n\t * parent on both axes: it fills the available width and derives its height,\n\t * but if the parent is shorter than that derived height it shrinks both axes\n\t * to fit rather than overflowing. When it is narrower than the parent (the\n\t * height-constrained case) it is centered horizontally.\n\t * When omitted, the chart fills the parent container's height.\n\t */\n\taspectRatio?: number;\n\t/**\n\t * Child render updates upon resize are delayed until debounceTime milliseconds after the last resize event is observed.\n\t */\n\tresizeDebounceTime?: number;\n};\n\n// useLayoutEffect on the client (so containment is resolved before paint, no flash),\n// useEffect on the server to avoid React's SSR warning.\nconst useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;\n\n/**\n * A higher-order component that provides responsive dimensions\n * to the wrapped chart component using useParentSize from `@visx/responsive`.\n *\n * @param WrappedComponent - The chart component to be wrapped.\n * @return A functional component that renders the wrapped component with responsive dimensions.\n */\nexport function withResponsive< T extends Exclude< BaseChartProps< unknown >, 'options' > >( // 'options' is excluded so that each chart can define its own options type\n\tWrappedComponent: ComponentType< T >\n) {\n\treturn function ResponsiveChart( {\n\t\tresizeDebounceTime = 300,\n\t\tmaxWidth = 1200,\n\t\taspectRatio,\n\t\tsize,\n\t\twidth,\n\t\theight,\n\t\t...chartProps\n\t}: Omit< T, 'width' | 'height' | 'size' > & DimensionProps & ResponsiveConfig ) {\n\t\tconst {\n\t\t\tparentRef,\n\t\t\twidth: parentWidth,\n\t\t\theight: parentHeight,\n\t\t} = useParentSize( {\n\t\t\tdebounceTime: resizeDebounceTime,\n\t\t\tenableDebounceLeadingCall: true,\n\t\t} );\n\n\t\tconst hasAspectRatio = aspectRatio !== undefined && aspectRatio > 0;\n\n\t\t// The context needs a re-render when the node attaches; wrapperRef alone cannot provide that, so mirror the node into state from the same callback ref.\n\t\tconst [ scopeNode, setScopeNode ] = useState< HTMLDivElement | null >( null );\n\n\t\t// Keep our own handle on the wrapper so we can read its live height below, and\n\t\t// still hand the node to useParentSize's ref (a callback ref in practice; guard\n\t\t// the object-ref shape too).\n\t\tconst wrapperRef = useRef< HTMLDivElement | null >( null );\n\t\tconst setWrapperRef = useCallback(\n\t\t\t( node: HTMLDivElement | null ) => {\n\t\t\t\twrapperRef.current = node;\n\t\t\t\tsetScopeNode( node );\n\t\t\t\tif ( typeof parentRef === 'function' ) {\n\t\t\t\t\tparentRef( node );\n\t\t\t\t} else if ( parentRef ) {\n\t\t\t\t\t( parentRef as { current: HTMLDivElement | null } ).current = node;\n\t\t\t\t}\n\t\t\t},\n\t\t\t[ parentRef ]\n\t\t);\n\n\t\t// The parent's available height when it actually constrains the chart, else\n\t\t// null (the chart derives its height from width and grows freely).\n\t\tconst [ containedHeight, setContainedHeight ] = useState< number | null >( null );\n\n\t\t// Cap the available width at maxWidth unless an explicit width pins it. Before\n\t\t// measurement resolves, fall back to the explicit width.\n\t\tconst cap = width === undefined ? maxWidth : Infinity;\n\t\tconst availableWidth = parentWidth > 0 ? Math.min( parentWidth, cap ) : width ?? 0;\n\n\t\tlet boxWidth = availableWidth;\n\t\tlet boxHeight: number;\n\t\tif ( hasAspectRatio ) {\n\t\t\tconst derivedHeight = availableWidth * aspectRatio;\n\t\t\tif ( containedHeight !== null && derivedHeight > containedHeight ) {\n\t\t\t\tboxHeight = containedHeight;\n\t\t\t\tboxWidth = boxHeight / aspectRatio;\n\t\t\t} else {\n\t\t\t\tboxHeight = derivedHeight;\n\t\t\t}\n\t\t} else {\n\t\t\tboxHeight = parentHeight > 0 ? parentHeight : height ?? 0;\n\t\t}\n\n\t\t// Decide containment from the wrapper's real height, measured after layout.\n\t\t// useParentSize's height is no good here: with height:100% and no definite\n\t\t// parent height it just echoes our own content back, so clamping against it\n\t\t// would freeze the chart at its current width when the container widens.\n\t\t// Compare the post-layout clientHeight to the height we drew: shorter means the\n\t\t// parent really constrains us → contain to it; equal means it is only our own\n\t\t// content → let it grow. Once contained, stay contained until the parent is tall\n\t\t// enough for the full derived height, so a now-fitting chart doesn't oscillate.\n\t\t// (parentHeight is in the deps only to re-run this; the value used is clientHeight.)\n\t\tuseIsomorphicLayoutEffect( () => {\n\t\t\tif ( ! hasAspectRatio ) {\n\t\t\t\tif ( containedHeight !== null ) {\n\t\t\t\t\tsetContainedHeight( null );\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst available = wrapperRef.current?.clientHeight ?? 0;\n\t\t\tconst derivedHeight = availableWidth * aspectRatio;\n\t\t\tif ( containedHeight === null ) {\n\t\t\t\tif ( available > 0 && derivedHeight > available + 1 ) {\n\t\t\t\t\tsetContainedHeight( available );\n\t\t\t\t}\n\t\t\t} else if ( available >= derivedHeight - 1 ) {\n\t\t\t\tsetContainedHeight( null );\n\t\t\t} else if ( Math.abs( available - containedHeight ) > 1 ) {\n\t\t\t\tsetContainedHeight( available );\n\t\t\t}\n\t\t}, [ hasAspectRatio, availableWidth, aspectRatio, containedHeight, parentHeight ] );\n\n\t\tconst wrappedComponent = (\n\t\t\t<WrappedComponent\n\t\t\t\twidth={ boxWidth }\n\t\t\t\theight={ boxHeight }\n\t\t\t\tsize={ size }\n\t\t\t\t{ ...( chartProps as T ) }\n\t\t\t/>\n\t\t);\n\n\t\t// The outer element fills the parent (via CSS) so its live height reflects the\n\t\t// real available space; JS sets width/height only when they are passed\n\t\t// explicitly. Static layout (fill, flex centering) lives in the stylesheet. With\n\t\t// an aspectRatio the chart is placed in an inner box sized to the contained\n\t\t// dimensions (centered by CSS) so it keeps its proportions and fits within the\n\t\t// parent on both axes. Charts that fill their container via CSS (e.g. the heatmap\n\t\t// grid) then track that box. Without an aspectRatio the chart fills the parent.\n\t\treturn (\n\t\t\t<div\n\t\t\t\tref={ setWrapperRef }\n\t\t\t\tdata-testid=\"responsive-wrapper\"\n\t\t\t\tclassName={ clsx( styles.container, hasAspectRatio && styles.isContained ) }\n\t\t\t\tstyle={ {\n\t\t\t\t\t...( width !== undefined ? { width } : null ),\n\t\t\t\t\t...( height !== undefined ? { height } : null ),\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<ChartScopeContext.Provider value={ scopeNode }>\n\t\t\t\t\t{ hasAspectRatio ? (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tdata-testid=\"responsive-content\"\n\t\t\t\t\t\t\tclassName={ styles.content }\n\t\t\t\t\t\t\tstyle={ { width: boxWidth, height: boxHeight } }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ wrappedComponent }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\twrappedComponent\n\t\t\t\t\t) }\n\t\t\t\t</ChartScopeContext.Provider>\n\t\t\t</div>\n\t\t);\n\t};\n}\n","import { DataContext } from '@visx/xychart';\nimport { __ } from '@wordpress/i18n';\nimport { IconButton } from '@wordpress/ui';\nimport { useCallback, useContext, useMemo, useState } from 'react';\nimport styles from './x-zoom.module.scss';\nimport type { ChartInstanceRef } from '../chart-instance-context';\nimport type { AxisScale } from '@visx/axis';\nimport type { EventHandlerParams } from '@visx/xychart';\nimport type { KeyboardEvent, ReactNode, RefObject } from 'react';\n\nconst MIN_DRAG_PIXELS = 6;\n\ntype Drag = { a: number; b: number };\ntype PointerHandler = ( params: EventHandlerParams< object > ) => void;\n\n/**\n * Drag-to-zoom state + pointer handlers for an XY chart. Designed to be\n * embedded in a chart parent: the parent owns the result, spreads the\n * `domain` into its `xScale.domain` config, and renders the selection\n * rect and reset button this returns.\n *\n * The X scale `.invert()` is read lazily from the chart's existing\n * `internalChartRef.getScales()` at commit time, so no DataContext access\n * is required from the parent.\n *\n * @param params - Hook params.\n * @param params.enabled - When false, the hook becomes a passthrough.\n * @param params.chartRef - Chart's internal scales ref.\n * @param params.userHandlers - User-supplied pointer handlers to chain.\n * @param params.userHandlers.onPointerDown - Forwarded user pointerdown handler.\n * @param params.userHandlers.onPointerMove - Forwarded user pointermove handler.\n * @param params.userHandlers.onPointerUp - Forwarded user pointerup handler.\n * @return An object with `domain`, `drag`, `reset`, and chained `handlers`.\n */\nexport function useXZoom< T extends Date | number = Date >( {\n\tenabled,\n\tchartRef,\n\tuserHandlers,\n}: {\n\tenabled: boolean;\n\tchartRef: RefObject< ChartInstanceRef | null >;\n\tuserHandlers?: {\n\t\tonPointerDown?: PointerHandler;\n\t\tonPointerMove?: PointerHandler;\n\t\tonPointerUp?: PointerHandler;\n\t};\n} ) {\n\tconst [ domain, setDomain ] = useState< [ T, T ] | null >( null );\n\tconst [ drag, setDrag ] = useState< Drag | null >( null );\n\n\tconst reset = useCallback( () => setDomain( null ), [] );\n\n\tconst onPointerDown = useCallback< PointerHandler >(\n\t\tparams => {\n\t\t\tuserHandlers?.onPointerDown?.( params );\n\t\t\tif ( ! enabled || ! params.svgPoint ) return;\n\t\t\tsetDrag( { a: params.svgPoint.x, b: params.svgPoint.x } );\n\t\t},\n\t\t[ enabled, userHandlers ]\n\t);\n\n\tconst onPointerMove = useCallback< PointerHandler >(\n\t\tparams => {\n\t\t\tuserHandlers?.onPointerMove?.( params );\n\t\t\tif ( ! enabled || ! params.svgPoint ) return;\n\t\t\tsetDrag( current => ( current ? { a: current.a, b: params.svgPoint!.x } : current ) );\n\t\t},\n\t\t[ enabled, userHandlers ]\n\t);\n\n\tconst onPointerUp = useCallback< PointerHandler >(\n\t\tparams => {\n\t\t\tuserHandlers?.onPointerUp?.( params );\n\t\t\tif ( ! enabled ) return;\n\t\t\tconst finalDrag = drag;\n\t\t\tsetDrag( null );\n\t\t\tif ( ! finalDrag ) return;\n\t\t\tconst lo = Math.min( finalDrag.a, finalDrag.b );\n\t\t\tconst hi = Math.max( finalDrag.a, finalDrag.b );\n\t\t\tif ( hi - lo < MIN_DRAG_PIXELS ) return;\n\t\t\tconst xScale = chartRef.current?.getScales()?.xScale as\n\t\t\t\t| ( AxisScale & { invert?: ( v: number ) => T } )\n\t\t\t\t| undefined;\n\t\t\tif ( ! xScale || typeof xScale.invert !== 'function' ) return;\n\t\t\tsetDomain( [ xScale.invert( lo ), xScale.invert( hi ) ] );\n\t\t},\n\t\t[ enabled, drag, chartRef, userHandlers ]\n\t);\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tdomain,\n\t\t\tdrag,\n\t\t\treset,\n\t\t\thandlers: { onPointerDown, onPointerMove, onPointerUp },\n\t\t} ),\n\t\t[ domain, drag, reset, onPointerDown, onPointerMove, onPointerUp ]\n\t);\n}\n\n/**\n * Live selection rectangle drawn inside `<XYChart>` while the user is\n * dragging. Reads plot dimensions from visx's `DataContext`.\n *\n * @param props - Props.\n * @param props.drag - Current drag, or null when idle.\n * @return JSX or null.\n */\nexport function ZoomSelectionRect( { drag }: { drag: Drag | null } ) {\n\tconst { margin, innerHeight } = useContext( DataContext );\n\tif ( ! drag || drag.a === drag.b ) return null;\n\tconst x = Math.min( drag.a, drag.b );\n\tconst w = Math.abs( drag.b - drag.a );\n\treturn (\n\t\t<rect\n\t\t\tclassName={ styles[ 'x-zoom__selection' ] }\n\t\t\tx={ x }\n\t\t\ty={ margin?.top ?? 0 }\n\t\t\twidth={ w }\n\t\t\theight={ innerHeight ?? 0 }\n\t\t\tdata-testid=\"chart-zoom-selection\"\n\t\t/>\n\t);\n}\n\n/**\n * Wraps a chart's series in a group that is clipped to the inner plot rectangle\n * while `active`. Reads the plot geometry from visx's `DataContext` (the same\n * source as `ZoomSelectionRect`), so the host charts don't compute any margins.\n * The group is always rendered (only its `clip-path` toggles) so toggling zoom\n * never remounts or re-animates the series.\n *\n * @param props - Props.\n * @param props.active - Whether to clip (e.g. `zoomable`, or `zoomable && zoomed`).\n * @param props.chartId - Chart id; used to build a unique clip-path id.\n * @param props.children - The series to clip.\n * @return JSX element.\n */\nexport function ZoomClip( {\n\tactive,\n\tchartId,\n\tchildren,\n}: {\n\tactive: boolean;\n\tchartId?: string;\n\tchildren: ReactNode;\n} ) {\n\tconst { margin, innerWidth, innerHeight } = useContext( DataContext );\n\t// Sanitise the chart id to a valid SVG/CSS id, and keep it unique per chart.\n\tconst id = `chart-zoom-clip-${ String( chartId ?? '' ).replace( /[^A-Za-z0-9_-]/g, '' ) }`;\n\tconst clip = active && ( innerWidth ?? 0 ) > 0 && ( innerHeight ?? 0 ) > 0;\n\treturn (\n\t\t<>\n\t\t\t{ clip && (\n\t\t\t\t<defs>\n\t\t\t\t\t<clipPath id={ id } data-testid=\"chart-zoom-clip\">\n\t\t\t\t\t\t<rect\n\t\t\t\t\t\t\tx={ margin?.left ?? 0 }\n\t\t\t\t\t\t\ty={ margin?.top ?? 0 }\n\t\t\t\t\t\t\twidth={ innerWidth }\n\t\t\t\t\t\t\theight={ innerHeight }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</clipPath>\n\t\t\t\t</defs>\n\t\t\t) }\n\t\t\t<g clipPath={ clip ? `url(#${ id })` : undefined } data-testid=\"chart-series-clip-group\">\n\t\t\t\t{ children }\n\t\t\t</g>\n\t\t</>\n\t);\n}\n\n/**\n * Visible icon-only reset control rendered as an HTML overlay on top of the\n * chart container, using the WPDS `IconButton`. The host should wrap its SVG in\n * a `position: relative` container so the button anchors correctly.\n *\n * @param props - Props.\n * @param props.onClick - Click handler. Typically the `reset` from `useXZoom`.\n * @return JSX element.\n */\nexport function ZoomResetButton( { onClick }: { onClick: () => void } ) {\n\t// The chart's keyboard-navigation wrapper calls preventDefault() on\n\t// bubbled keydowns, which would cancel the native Enter/Space button\n\t// activation. Keep activation keys out of its reach.\n\tconst stopActivationKeys = useCallback( ( event: KeyboardEvent< HTMLButtonElement > ) => {\n\t\tif ( event.key === 'Enter' || event.key === ' ' ) {\n\t\t\tevent.stopPropagation();\n\t\t}\n\t}, [] );\n\treturn (\n\t\t<IconButton\n\t\t\tclassName={ styles[ 'x-zoom__reset' ] }\n\t\t\tonKeyDown={ stopActivationKeys }\n\t\t\tlabel={ __( 'Reset zoom', 'jetpack-charts' ) }\n\t\t\tvariant=\"outline\"\n\t\t\ttone=\"neutral\"\n\t\t\tsize=\"small\"\n\t\t\tonClick={ onClick }\n\t\t\tdata-testid=\"chart-zoom-reset\"\n\t\t\ticon={\n\t\t\t\t<svg\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\tfocusable=\"false\"\n\t\t\t\t>\n\t\t\t\t\t{ /*\n\t\t\t\t\t\tIcons render edge-to-edge at 24px, so inset the glyph the\n\t\t\t\t\t\tway @wordpress/icons glyphs do (drawn within roughly 4-20\n\t\t\t\t\t\tof the viewBox, ~1.5px effective stroke).\n\t\t\t\t\t*/ }\n\t\t\t\t\t<g transform=\"translate(2.4 2.4) scale(0.8)\">\n\t\t\t\t\t\t<circle cx=\"10\" cy=\"10\" r=\"6\" />\n\t\t\t\t\t\t<line x1=\"15\" y1=\"15\" x2=\"20\" y2=\"20\" />\n\t\t\t\t\t\t<line x1=\"7\" y1=\"10\" x2=\"13\" y2=\"10\" />\n\t\t\t\t\t</g>\n\t\t\t\t</svg>\n\t\t\t}\n\t\t/>\n\t);\n}\n","import { __ } from '@wordpress/i18n';\nimport { Stack } from '@wordpress/ui';\nimport clsx from 'clsx';\nimport { useEffect, useId, useRef, useState } from 'react';\nimport { isSafari } from '../../../utils';\nimport styles from '../line-chart.module.scss';\nimport type { ButtonWithPopover, PopoverElement, ToggleEvent } from '../../../types';\nimport type { FC } from 'react';\n\nexport const POPOVER_BUTTON_SIZE = 44;\n\nconst CloseIcon = () => (\n\t<svg\n\t\twidth=\"16\"\n\t\theight=\"16\"\n\t\tviewBox=\"0 0 24 24\"\n\t\tfill=\"none\"\n\t\tstroke=\"currentColor\"\n\t\tstrokeWidth=\"2\"\n\t\tstrokeLinecap=\"round\"\n\t\tstrokeLinejoin=\"round\"\n\t\taria-hidden=\"true\"\n\t\tfocusable=\"false\"\n\t>\n\t\t<path d=\"M6 6l12 12M18 6L6 18\" />\n\t</svg>\n);\n\ninterface LineChartAnnotationLabelWithPopoverProps {\n\ttitle: string;\n\tsubtitle?: string;\n\trenderLabel: FC< { title: string; subtitle?: string } >;\n\trenderLabelPopover: FC< { title: string; subtitle?: string } >;\n}\n\nconst LineChartAnnotationLabelWithPopover: FC< LineChartAnnotationLabelWithPopoverProps > = ( {\n\ttitle,\n\tsubtitle,\n\trenderLabel,\n\trenderLabelPopover,\n} ) => {\n\tconst popoverId = useId();\n\tconst buttonRef = useRef< HTMLButtonElement >( null );\n\tconst popoverRef = useRef< HTMLDivElement >( null );\n\tconst [ isPositioned, setIsPositioned ] = useState( false );\n\tconst isBrowserSafari = isSafari();\n\n\tuseEffect( () => {\n\t\tconst button = buttonRef.current;\n\t\tconst popover = popoverRef.current;\n\n\t\tif ( ! button || ! popover ) return;\n\n\t\tconst positionPopover = () => {\n\t\t\t// Popover positioning in Safari is complicated due to issues with SVG foreign objects (https://bugs.webkit.org/show_bug.cgi?id=23113), so let it be positioned in the centre of the viewport.\n\t\t\tif ( ! isBrowserSafari ) {\n\t\t\t\tconst buttonRect = button.getBoundingClientRect();\n\t\t\t\tpopover.style.left = `${ buttonRect.right }px`;\n\t\t\t\tpopover.style.top = `${ buttonRect.top }px`;\n\t\t\t}\n\n\t\t\tsetIsPositioned( true );\n\t\t};\n\n\t\t// Position when popover shows\n\t\tpopover.addEventListener( 'toggle', ( e: ToggleEvent ) => {\n\t\t\tif ( e.newState === 'open' ) {\n\t\t\t\tpositionPopover();\n\t\t\t}\n\t\t} );\n\n\t\t// Initial positioning if already open\n\t\ttry {\n\t\t\tif ( popover.matches( ':popover-open' ) ) {\n\t\t\t\tpositionPopover();\n\t\t\t}\n\t\t} catch {\n\t\t\t// Ignore errors in test environments (e.g., JSDOM does not support :popover-open)\n\t\t}\n\t}, [ isBrowserSafari ] );\n\n\treturn (\n\t\t<div className={ styles[ 'line-chart__annotation-label' ] }>\n\t\t\t<button\n\t\t\t\tref={ buttonRef }\n\t\t\t\t{ ...( { popovertarget: popoverId } as ButtonWithPopover ) }\n\t\t\t\tclassName={ styles[ 'line-chart__annotation-label-trigger-button' ] }\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth: `${ POPOVER_BUTTON_SIZE }px`,\n\t\t\t\t\theight: `${ POPOVER_BUTTON_SIZE }px`,\n\t\t\t\t\ttransform: `translate(${ POPOVER_BUTTON_SIZE / 2 }px, 0)`,\n\t\t\t\t} }\n\t\t\t\taria-label={ title || __( 'View details', 'jetpack-charts' ) }\n\t\t\t>\n\t\t\t\t{ renderLabel( { title, subtitle } ) }\n\t\t\t</button>\n\t\t\t<div\n\t\t\t\tref={ popoverRef }\n\t\t\t\tid={ popoverId }\n\t\t\t\t{ ...( { popover: 'auto' } as PopoverElement ) }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\tstyles[ 'line-chart__annotation-label-popover' ],\n\t\t\t\t\tisPositioned && styles[ 'line-chart__annotation-label-popover--visible' ],\n\t\t\t\t\tisBrowserSafari && styles[ 'line-chart__annotation-label-popover--safari' ]\n\t\t\t\t) }\n\t\t\t\tdata-testid=\"line-chart-annotation-label-popover\"\n\t\t\t>\n\t\t\t\t<Stack direction=\"row\" align=\"flex-start\" justify=\"space-between\">\n\t\t\t\t\t<div className={ styles[ 'line-chart__annotation-label-popover-content' ] }>\n\t\t\t\t\t\t{ renderLabelPopover( { title, subtitle } ) }\n\t\t\t\t\t</div>\n\t\t\t\t\t<button\n\t\t\t\t\t\t{ ...( {\n\t\t\t\t\t\t\tpopovertarget: popoverId,\n\t\t\t\t\t\t\tpopovertargetaction: 'hide',\n\t\t\t\t\t\t} as ButtonWithPopover ) }\n\t\t\t\t\t\tclassName={ styles[ 'line-chart__annotation-label-popover-close-button' ] }\n\t\t\t\t\t\taria-label={ __( 'Close', 'jetpack-charts' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<CloseIcon />\n\t\t\t\t\t</button>\n\t\t\t\t</Stack>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport default LineChartAnnotationLabelWithPopover;\n","import { DataContext } from '@visx/xychart';\nimport { useEffect, useState, useCallback } from 'react';\nimport { useChartInstanceContext } from '../../private/chart-instance-context';\nimport styles from '../line-chart.module.scss';\nimport type { AxisScale } from '@visx/axis';\nimport type { FC, ReactNode } from 'react';\n\nexport interface LineChartAnnotationsProps {\n\tchildren?: ReactNode;\n}\n\ninterface ScaleData {\n\txScale: AxisScale< Date >;\n\tyScale: AxisScale< number >;\n}\n\nconst LineChartAnnotationsOverlay: FC< LineChartAnnotationsProps > = ( { children } ) => {\n\tconst { chartRef, chartWidth, chartHeight } = useChartInstanceContext();\n\n\tconst [ scales, setScales ] = useState< ScaleData | null >( null );\n\tconst [ scalesStable, setScalesStable ] = useState< boolean >( false );\n\n\t// Create a signature for scale data to enable easy comparison\n\tconst createScaleSignature = useCallback( ( scaleData: ScaleData ) => {\n\t\tconst xDomain = scaleData.xScale.domain();\n\t\tconst yDomain = scaleData.yScale.domain();\n\t\tconst xRange = scaleData.xScale.range();\n\t\tconst yRange = scaleData.yScale.range();\n\n\t\treturn `${ xDomain.join( ',' ) }-${ yDomain.join( ',' ) }-${ xRange.join(\n\t\t\t','\n\t\t) }-${ yRange.join( ',' ) }`;\n\t}, [] );\n\n\t// Get scales from chart ref and return them with signature for comparison\n\tconst getScalesData = useCallback( () => {\n\t\tif ( chartRef?.current ) {\n\t\t\tconst scaleData = chartRef.current.getScales();\n\n\t\t\tif ( scaleData ) {\n\t\t\t\tconst scaleInfo = {\n\t\t\t\t\txScale: scaleData.xScale as AxisScale< Date >,\n\t\t\t\t\tyScale: scaleData.yScale as AxisScale< number >,\n\t\t\t\t};\n\n\t\t\t\treturn {\n\t\t\t\t\tscales: scaleInfo,\n\t\t\t\t\tsignature: createScaleSignature( scaleInfo ),\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}, [ chartRef, createScaleSignature ] );\n\n\t// The chart resizes on render so we need to monitor the scales until they stabilize\n\tuseEffect( () => {\n\t\tlet timeoutId: number | null = null;\n\t\tlet lastSignature: string | null = null;\n\t\tlet retryCount = 0;\n\t\tconst maxRetries = 20; // 20 * 50ms = 1 second max\n\t\tconst checkInterval = 50; // Check every 50ms\n\n\t\t// Reset stability state when monitoring starts\n\t\tsetScalesStable( false );\n\n\t\tconst monitorScales = () => {\n\t\t\tconst currentScaleData = getScalesData();\n\n\t\t\t// If we got scales, compare signatures\n\t\t\tif ( currentScaleData ) {\n\t\t\t\t// Check if scales have settled by comparing signatures\n\t\t\t\tconst scalesSettled = lastSignature && currentScaleData.signature === lastSignature;\n\n\t\t\t\tif ( scalesSettled ) {\n\t\t\t\t\t// Scales have stabilized, mark as stable\n\t\t\t\t\tsetScalesStable( true );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Update scales and remember signature for next comparison\n\t\t\t\tsetScales( currentScaleData.scales );\n\t\t\t\tlastSignature = currentScaleData.signature;\n\t\t\t}\n\n\t\t\t// Continue monitoring if we haven't exceeded max retries\n\t\t\tif ( retryCount < maxRetries ) {\n\t\t\t\tretryCount++;\n\t\t\t\ttimeoutId = setTimeout( monitorScales, checkInterval ) as unknown as number;\n\t\t\t}\n\t\t};\n\n\t\tmonitorScales();\n\n\t\treturn () => {\n\t\t\tif ( timeoutId ) {\n\t\t\t\tclearTimeout( timeoutId );\n\t\t\t}\n\t\t};\n\t}, [ getScalesData, chartWidth, chartHeight ] );\n\n\tif ( ! chartRef || ! children || ! chartWidth || ! chartHeight ) {\n\t\treturn null;\n\t}\n\n\tif ( ! scales || ! scalesStable ) {\n\t\treturn null;\n\t}\n\n\t// Create a DataContext value that mimics what visx provides\n\t// We're intentionally providing minimal context for annotations to work\n\tconst dataContextValue = {\n\t\txScale: scales.xScale,\n\t\tyScale: scales.yScale,\n\t\tmargin: { top: 0, right: 0, bottom: 0, left: 0 },\n\t\twidth: chartWidth,\n\t\theight: chartHeight,\n\t} as unknown as Parameters< typeof DataContext.Provider >[ 0 ][ 'value' ];\n\n\treturn (\n\t\t<DataContext.Provider value={ dataContextValue }>\n\t\t\t<svg\n\t\t\t\twidth={ chartWidth }\n\t\t\t\theight={ chartHeight }\n\t\t\t\tclassName={ styles[ 'line-chart__annotations-overlay' ] }\n\t\t\t\tdata-testid=\"line-chart-annotations-overlay\"\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</svg>\n\t\t</DataContext.Provider>\n\t);\n};\n\nexport default LineChartAnnotationsOverlay;\n","import {\n\tAnnotation,\n\tCircleSubject,\n\tConnector,\n\tHtmlLabel,\n\tLabel,\n\tLineSubject,\n} from '@visx/annotation';\nimport { DataContext } from '@visx/xychart';\nimport merge from 'deepmerge';\nimport { useContext, useRef, useEffect, useState, useMemo } from 'react';\nimport { useChartScopeElement, useGlobalChartsTheme } from '../../../providers';\nimport { isSafari, resolveCssVariable } from '../../../utils';\nimport LineChartAnnotationLabelWithPopover, {\n\tPOPOVER_BUTTON_SIZE,\n} from './line-chart-annotation-label-popover';\nimport type { LineChartAnnotationProps } from '../types';\nimport type { LabelProps } from '@visx/annotation';\nimport type { TextProps } from '@visx/text';\nimport type { FC } from 'react';\n\ntype SubjectType = 'circle' | 'line-vertical' | 'line-horizontal';\n\nconst ANNOTATION_MAX_WIDTH = 125; // visx default\nconst ANNOTATION_INIT_HEIGHT = 100;\n\nexport const getLabelPosition = ( {\n\tsubjectType,\n\tx,\n\txMax,\n\ty,\n\tyMin,\n\tyMax,\n\tmaxWidth,\n\theight,\n}: {\n\tsubjectType: SubjectType;\n\tx: number;\n\txMax: number;\n\ty: number;\n\tyMin: number;\n\tyMax: number;\n\tmaxWidth?: number;\n\theight?: number | null;\n} ): {\n\tdx: number;\n\tdy: number;\n\tisFlippedHorizontally: boolean;\n\tisFlippedVertically: boolean;\n} => {\n\tconst annotationMaxWidth = maxWidth ?? ANNOTATION_MAX_WIDTH;\n\tconst annotationHeight = height ?? ANNOTATION_INIT_HEIGHT;\n\tlet dx = 15;\n\tlet dy = 15;\n\tlet isFlippedHorizontally = false;\n\tlet isFlippedVertically = false;\n\n\tif ( subjectType === 'line-horizontal' ) {\n\t\tdx = 0;\n\t\tdy = 20;\n\t}\n\n\tif ( subjectType === 'line-vertical' ) {\n\t\tdx = 20;\n\t\tdy = 0;\n\t}\n\n\t// Smart horizontal positioning: if annotation would extend beyond right edge, position it to the left\n\t// Account for the connector offset (dx) in boundary calculations\n\tconst effectiveX = x + dx;\n\n\tif ( effectiveX + annotationMaxWidth > xMax ) {\n\t\tisFlippedHorizontally = true;\n\n\t\tif ( subjectType === 'circle' ) {\n\t\t\tdx = -dx; // Just flip to the left side with same offset\n\t\t} else if ( subjectType === 'line-vertical' ) {\n\t\t\tdx = -20; // Position to the left of the line\n\t\t}\n\t}\n\n\t// Smart vertical positioning: check both top and bottom edges\n\t// For circle annotations, they are positioned below by default (dy > 0)\n\t// Only flip when close to bottom edge to position above\n\tif ( subjectType === 'circle' ) {\n\t\t// Check if positioning below would extend beyond bottom edge\n\t\tif ( y + dy + annotationHeight > yMin ) {\n\t\t\t// Too close to bottom edge, position above\n\t\t\tisFlippedVertically = true;\n\t\t\tdy = -Math.abs( dy ); // Ensure negative value to position above the point\n\t\t}\n\t\t// When close to top edge, keep default below positioning (no flip needed)\n\t} else if ( y - annotationHeight < yMax ) {\n\t\t// Too close to top edge, position below\n\t\tif ( subjectType === 'line-horizontal' ) {\n\t\t\tisFlippedVertically = true;\n\t\t\tdy = Math.abs( dy ); // Ensure positive value to position below the point\n\t\t} else if ( subjectType === 'line-vertical' ) {\n\t\t\tisFlippedVertically = true; // For anchor adjustment only\n\t\t}\n\t} else if ( y + annotationHeight > yMin ) {\n\t\t// Too close to bottom edge, position above\n\t\tif ( subjectType === 'line-horizontal' ) {\n\t\t\tisFlippedVertically = true;\n\t\t\tdy = -Math.abs( dy ); // Ensure negative value to position above the point\n\t\t} else if ( subjectType === 'line-vertical' ) {\n\t\t\tisFlippedVertically = true; // For anchor adjustment only\n\t\t}\n\t}\n\n\treturn { dx, dy, isFlippedHorizontally, isFlippedVertically };\n};\n\nconst getHorizontalAnchor = (\n\tsubjectType: SubjectType,\n\tisFlippedHorizontally: boolean\n): LabelProps[ 'horizontalAnchor' ] => {\n\tif ( subjectType === 'line-horizontal' ) {\n\t\treturn isFlippedHorizontally ? 'end' : 'start';\n\t}\n\n\treturn undefined;\n};\n\nconst getVerticalAnchor = (\n\tsubjectType: SubjectType,\n\tisFlippedVertically: boolean,\n\ty: number,\n\tyMax: number,\n\theight: number\n): TextProps[ 'verticalAnchor' ] => {\n\tif ( subjectType === 'line-vertical' ) {\n\t\tif ( isFlippedVertically ) {\n\t\t\t// If flipped due to top edge, anchor to top; if flipped due to bottom edge, anchor to bottom\n\t\t\treturn y - height < yMax ? 'start' : 'end';\n\t\t}\n\n\t\treturn 'start';\n\t}\n\n\treturn undefined;\n};\n\nconst LineChartAnnotation: FC< LineChartAnnotationProps > = ( {\n\tdatum,\n\ttitle,\n\tsubtitle,\n\tsubjectType = 'circle',\n\tstyles: datumStyles,\n\ttestId,\n\trenderLabel,\n\trenderLabelPopover,\n} ) => {\n\tconst providerTheme = useGlobalChartsTheme();\n\tconst scopeElement = useChartScopeElement();\n\tconst { xScale, yScale } = useContext( DataContext ) || {};\n\tconst labelRef = useRef< SVGGElement >( null );\n\tconst [ height, setHeight ] = useState< number | null >( null );\n\n\t// Deep merge styles to preserve nested object properties\n\tconst styles = merge( providerTheme.annotationStyles ?? {}, datumStyles ?? {} );\n\n\t// visx annotation parts apply these colours as SVG presentation attributes, where CSS var() cannot resolve. Resolve against the chart's scope element, never :root.\n\tconst resolveColor = ( value?: string ): string | undefined =>\n\t\tvalue ? resolveCssVariable( value, scopeElement ) ?? value : value;\n\n\t// Measure the label height once after initial render\n\tuseEffect( () => {\n\t\tif ( labelRef.current?.getBBox ) {\n\t\t\tconst bbox = labelRef.current.getBBox();\n\t\t\tsetHeight( bbox.height );\n\t\t}\n\t}, [] );\n\n\tconst positionData = useMemo( () => {\n\t\tif ( ! datum || ! datum.date || datum.value == null || ! xScale || ! yScale ) return null;\n\n\t\tconst x = xScale( datum.date );\n\t\tconst y = yScale( datum.value );\n\n\t\tif ( typeof x !== 'number' || typeof y !== 'number' ) return null;\n\n\t\tconst [ yMin, yMax ] = yScale.range().map( Number );\n\t\tconst [ xMin, xMax ] = xScale.range().map( Number );\n\n\t\t// If a custom label is provided, use the provided position\n\t\tif ( renderLabel ) {\n\t\t\treturn {\n\t\t\t\tx,\n\t\t\t\tdx: 0,\n\t\t\t\ty,\n\t\t\t\tdy: 0,\n\t\t\t\tyMin,\n\t\t\t\tyMax,\n\t\t\t\txMin,\n\t\t\t\txMax,\n\t\t\t\tisFlippedHorizontally: false,\n\t\t\t\tisFlippedVertically: false,\n\t\t\t};\n\t\t}\n\n\t\tconst position = getLabelPosition( {\n\t\t\tsubjectType,\n\t\t\tx,\n\t\t\txMax,\n\t\t\ty,\n\t\t\tyMin,\n\t\t\tyMax,\n\t\t\tmaxWidth: styles?.label?.maxWidth,\n\t\t\theight,\n\t\t} );\n\n\t\treturn { x, y, yMin, yMax, xMin, xMax, ...position };\n\t}, [ datum, xScale, yScale, subjectType, styles?.label?.maxWidth, height, renderLabel ] );\n\n\tif ( ! positionData ) return null;\n\n\tconst { x, y, yMin, yMax, xMin, xMax, dx, dy, isFlippedHorizontally, isFlippedVertically } =\n\t\tpositionData;\n\n\tconst getLabelY = () => {\n\t\tconst labelY = styles?.label?.y;\n\n\t\tif ( labelY === 'start' ) return yMax;\n\t\tif ( labelY === 'end' ) return yMin;\n\n\t\treturn labelY;\n\t};\n\n\tconst getLabelX = () => {\n\t\tconst labelX = styles?.label?.x;\n\n\t\tif ( labelX === 'start' ) return xMin;\n\t\tif ( labelX === 'end' ) return xMax;\n\n\t\treturn labelX;\n\t};\n\n\tconst labelPosition = {\n\t\tx: getLabelX(),\n\t\ty: getLabelY(),\n\t};\n\n\t// Safari has a bug where children of an SVG foreignObject are not positioned correctly https://bugs.webkit.org/show_bug.cgi?id=23113\n\t// This is a workaround to position the label correctly\n\tconst getSafariHTMLLabelPosition = () => {\n\t\tconst labelWidth = POPOVER_BUTTON_SIZE;\n\t\tconst labelHeight = POPOVER_BUTTON_SIZE;\n\n\t\treturn isSafari()\n\t\t\t? {\n\t\t\t\t\ttransform: `translate(${\n\t\t\t\t\t\tx +\n\t\t\t\t\t\t( dx || 0 ) +\n\t\t\t\t\t\t( typeof labelPosition.x === 'number' ? labelPosition.x - x : 0 ) -\n\t\t\t\t\t\tlabelWidth\n\t\t\t\t\t}px, ${\n\t\t\t\t\t\ty +\n\t\t\t\t\t\t( dy || 0 ) +\n\t\t\t\t\t\t( typeof labelPosition.y === 'number' ? labelPosition.y - y : 0 ) -\n\t\t\t\t\t\tlabelHeight\n\t\t\t\t\t}px)`,\n\t\t\t\t\twidth: labelWidth,\n\t\t\t\t\theight: labelHeight,\n\t\t\t }\n\t\t\t: undefined;\n\t};\n\n\treturn (\n\t\t<g data-testid={ testId }>\n\t\t\t<Annotation x={ x } y={ y } dx={ dx } dy={ dy }>\n\t\t\t\t<Connector { ...styles?.connector } stroke={ resolveColor( styles?.connector?.stroke ) } />\n\t\t\t\t{ subjectType === 'circle' && (\n\t\t\t\t\t<CircleSubject\n\t\t\t\t\t\t{ ...styles?.circleSubject }\n\t\t\t\t\t\tfill={ resolveColor( styles?.circleSubject?.fill ) }\n\t\t\t\t\t\tstroke={ resolveColor( styles?.circleSubject?.stroke ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ subjectType === 'line-vertical' && (\n\t\t\t\t\t<LineSubject\n\t\t\t\t\t\tmin={ yMax }\n\t\t\t\t\t\tmax={ yMin }\n\t\t\t\t\t\t{ ...{ ...styles?.lineSubject, orientation: 'vertical' } }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ subjectType === 'line-horizontal' && (\n\t\t\t\t\t<LineSubject\n\t\t\t\t\t\tmin={ xMin }\n\t\t\t\t\t\tmax={ xMax }\n\t\t\t\t\t\t{ ...{ ...styles?.lineSubject, orientation: 'horizontal' } }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ renderLabel ? (\n\t\t\t\t\t<HtmlLabel { ...styles?.label } { ...labelPosition }>\n\t\t\t\t\t\t<div style={ getSafariHTMLLabelPosition() }>\n\t\t\t\t\t\t\t{ renderLabelPopover ? (\n\t\t\t\t\t\t\t\t<LineChartAnnotationLabelWithPopover\n\t\t\t\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\t\t\t\tsubtitle={ subtitle }\n\t\t\t\t\t\t\t\t\trenderLabel={ renderLabel }\n\t\t\t\t\t\t\t\t\trenderLabelPopover={ renderLabelPopover }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\trenderLabel( { title, subtitle } )\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</HtmlLabel>\n\t\t\t\t) : (\n\t\t\t\t\t<g ref={ labelRef }>\n\t\t\t\t\t\t<Label\n\t\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\t\tsubtitle={ subtitle }\n\t\t\t\t\t\t\t{ ...styles?.label }\n\t\t\t\t\t\t\tanchorLineStroke={ resolveColor( styles?.label?.anchorLineStroke ) }\n\t\t\t\t\t\t\tbackgroundFill={ resolveColor( styles?.label?.backgroundFill ) }\n\t\t\t\t\t\t\t{ ...labelPosition }\n\t\t\t\t\t\t\thorizontalAnchor={ getHorizontalAnchor( subjectType, isFlippedHorizontally ) }\n\t\t\t\t\t\t\tverticalAnchor={ getVerticalAnchor(\n\t\t\t\t\t\t\t\tsubjectType,\n\t\t\t\t\t\t\t\tisFlippedVertically,\n\t\t\t\t\t\t\t\ty,\n\t\t\t\t\t\t\t\tyMax,\n\t\t\t\t\t\t\t\theight ?? ANNOTATION_INIT_HEIGHT\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</g>\n\t\t\t\t) }\n\t\t\t</Annotation>\n\t\t</g>\n\t);\n};\n\nexport default LineChartAnnotation;\n","import { DataContext } from '@visx/xychart';\nimport { useContext } from 'react';\nimport type { LineChartGlyphProps } from '../types';\nimport type { FC } from 'react';\n\nconst toNumber = ( val?: number | string | null ): number | undefined => {\n\tconst num = typeof val === 'number' ? val : parseFloat( val );\n\treturn isNaN( num ) ? undefined : num;\n};\n\nconst LineChartGlyph: FC< LineChartGlyphProps > = ( {\n\tdata,\n\tindex,\n\tcolor,\n\tglyphStyle,\n\trenderGlyph,\n\taccessors,\n\tposition,\n} ) => {\n\tconst { xScale, yScale } = useContext( DataContext ) || {};\n\tif ( ! xScale || ! yScale ) return null;\n\n\tif ( data.data.length === 0 ) return null;\n\n\tconst point = position === 'start' ? data.data[ 0 ] : data.data[ data.data.length - 1 ];\n\n\tconst x = xScale( accessors.xAccessor( point ) );\n\tconst y = yScale( accessors.yAccessor( point ) );\n\n\tif ( typeof x !== 'number' || typeof y !== 'number' ) return null;\n\n\tconst size = Math.max( 0, toNumber( glyphStyle?.radius ) ?? 4 );\n\n\treturn renderGlyph( {\n\t\tkey: `${ position }-glyph-${ data.label }`,\n\t\tindex,\n\t\tdatum: point,\n\t\tcolor,\n\t\tsize,\n\t\tx,\n\t\ty,\n\t\tglyphStyle,\n\t\tposition,\n\t} );\n};\n\nexport default LineChartGlyph;\n","import { formatNumberCompact, formatNumber } from '@automattic/number-formatters';\nimport { LinearGradient } from '@visx/gradient';\nimport { XYChart, AreaSeries, Grid, Axis, DataContext } from '@visx/xychart';\nimport { __ } from '@wordpress/i18n';\nimport { Stack } from '@wordpress/ui';\nimport clsx from 'clsx';\nimport {\n\tuseMemo,\n\tuseContext,\n\tforwardRef,\n\tuseImperativeHandle,\n\tuseState,\n\tuseRef,\n\tuseCallback,\n} from 'react';\nimport { Legend, useChartLegendItems } from '../../components/legend';\nimport { AccessibleTooltip, useKeyboardNavigation } from '../../components/tooltip';\nimport {\n\tuseXYChartTheme,\n\tuseChartDataTransform,\n\tuseChartMargin,\n\tusePrefersReducedMotion,\n} from '../../hooks';\nimport {\n\tGlobalChartsProvider,\n\tGlobalChartsContext,\n\tuseChartId,\n\tuseChartRegistration,\n\tuseGlobalChartsContext,\n\tuseGlobalChartsTheme,\n} from '../../providers';\nimport { useDefaultHiddenSeries } from '../../providers/chart-context/hooks/use-default-hidden-series';\nimport { attachSubComponents } from '../../utils';\nimport { useChartChildren } from '../private/chart-composition';\nimport { ChartInstanceContext, type ChartInstanceRef } from '../private/chart-instance-context';\nimport { ChartLayout } from '../private/chart-layout';\nimport { DefaultGlyph } from '../private/default-glyph';\nimport { getAllHiddenMessage, SvgEmptyState } from '../private/svg-empty-state';\nimport { getCurveType, getFormatter, guessOptimalNumTicks } from '../private/time-axis';\nimport { withResponsive } from '../private/with-responsive';\nimport { useXZoom, ZoomResetButton, ZoomSelectionRect, ZoomClip } from '../private/x-zoom';\nimport styles from './line-chart.module.scss';\nimport { LineChartAnnotation, LineChartAnnotationsOverlay, LineChartGlyph } from './private';\nimport type { RenderLineGlyphProps, LineChartProps, TooltipDatum } from './types';\nimport type { DataPoint, DataPointDate, SeriesData, Optional } from '../../types';\nimport type { RenderTooltipParams } from '../../visx/types';\nimport type { ResponsiveConfig } from '../private/with-responsive';\nimport type { TickFormatter } from '@visx/axis';\nimport type { GlyphProps } from '@visx/xychart';\nimport type { FC, Ref } from 'react';\n\nconst defaultRenderGlyph = < Datum extends object >( props: RenderLineGlyphProps< Datum > ) => {\n\treturn <DefaultGlyph { ...props } key={ props.key } />;\n};\n\nconst toNumber = ( val?: number | string | null ): number | undefined => {\n\tconst num = typeof val === 'number' ? val : parseFloat( val );\n\treturn isNaN( num ) ? undefined : num;\n};\n\n/**\n * Default visx-tooltip render that prints the hovered date as a heading and\n * one row per visible series (label + formatted value), sorted descending by\n * value. Reused by AreaChart, which has the same multi-series shape.\n *\n * @param params - visx `RenderTooltipParams< DataPointDate >`.\n * @return Tooltip JSX, or `null` when no datum is hovered.\n */\nexport const renderDefaultTooltip = ( params: RenderTooltipParams< DataPointDate > ) => {\n\tconst { tooltipData } = params;\n\tconst nearestDatum = tooltipData?.nearestDatum?.datum;\n\tif ( ! nearestDatum ) return null;\n\n\tconst tooltipPoints: TooltipDatum[] = Object.entries( tooltipData?.datumByKey || {} )\n\t\t.map( ( [ key, { datum } ] ) => ( {\n\t\t\tkey,\n\t\t\tvalue: datum.value as number,\n\t\t} ) )\n\t\t.sort( ( a, b ) => b.value - a.value );\n\n\treturn (\n\t\t<div className={ styles[ 'line-chart__tooltip' ] }>\n\t\t\t<div className={ styles[ 'line-chart__tooltip-date' ] }>\n\t\t\t\t{ nearestDatum.date?.toLocaleDateString() }\n\t\t\t</div>\n\t\t\t{ tooltipPoints.map( point => (\n\t\t\t\t<Stack\n\t\t\t\t\tkey={ point.key }\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\talign=\"center\"\n\t\t\t\t\tjustify=\"space-between\"\n\t\t\t\t\tclassName={ styles[ 'line-chart__tooltip-row' ] }\n\t\t\t\t>\n\t\t\t\t\t<span className={ styles[ 'line-chart__tooltip-label' ] }>{ point.key }:</span>\n\t\t\t\t\t<span className={ styles[ 'line-chart__tooltip-value' ] }>\n\t\t\t\t\t\t{ formatNumber( point.value ) }\n\t\t\t\t\t</span>\n\t\t\t\t</Stack>\n\t\t\t) ) }\n\t\t</div>\n\t);\n};\n\nconst validateData = ( data: SeriesData[] ) => {\n\tif ( ! data?.length ) return 'No data available';\n\n\tconst hasInvalidData = data.some( series =>\n\t\tseries.data.some(\n\t\t\t( point: DataPointDate | DataPoint ) =>\n\t\t\t\tisNaN( point.value as number ) ||\n\t\t\t\tpoint.value === null ||\n\t\t\t\tpoint.value === undefined ||\n\t\t\t\t( 'date' in point && point.date && isNaN( point.date.getTime() ) )\n\t\t)\n\t);\n\n\tif ( hasInvalidData ) return 'Invalid data';\n\treturn null;\n};\n\n// Inner component to access DataContext and provide scale data to ref\nconst LineChartScalesRef: FC< {\n\tchartRef?: Ref< ChartInstanceRef >;\n\twidth: number;\n\theight: number;\n\tmargin?: { top?: number; right?: number; bottom?: number; left?: number };\n} > = ( { chartRef, width, height, margin } ) => {\n\tconst context = useContext( DataContext );\n\n\tuseImperativeHandle(\n\t\tchartRef,\n\t\t() => ( {\n\t\t\tgetScales: () => {\n\t\t\t\tif ( ! context?.xScale || ! context?.yScale ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\txScale: context.xScale,\n\t\t\t\t\tyScale: context.yScale,\n\t\t\t\t};\n\t\t\t},\n\t\t\tgetChartDimensions: () => ( {\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\tmargin: margin || {},\n\t\t\t} ),\n\t\t} ),\n\t\t[ context, width, height, margin ]\n\t);\n\n\treturn null; // This component only provides the ref interface\n};\n\nconst LineChartInternal = forwardRef< ChartInstanceRef, LineChartProps >(\n\t(\n\t\t{\n\t\t\tdata,\n\t\t\tchartId: providedChartId,\n\t\t\twidth,\n\t\t\theight,\n\t\t\tclassName,\n\t\t\tmargin,\n\t\t\twithTooltips = true,\n\t\t\twithTooltipCrosshairs,\n\t\t\tshowLegend = false,\n\t\t\tlegend = {},\n\t\t\trenderGlyph = defaultRenderGlyph,\n\t\t\tglyphStyle = {},\n\t\t\twithLegendGlyph = false,\n\t\t\twithGradientFill = false,\n\t\t\tsmoothing = true,\n\t\t\tcurveType,\n\t\t\trenderTooltip = renderDefaultTooltip,\n\t\t\twithStartGlyphs = false,\n\t\t\twithEndGlyphs = false,\n\t\t\tanimation,\n\t\t\toptions = {},\n\t\t\tonPointerDown = undefined,\n\t\t\tonPointerUp = undefined,\n\t\t\tonPointerMove = undefined,\n\t\t\tonPointerOut = undefined,\n\t\t\tzoomable = false,\n\t\t\trescaleYOnVisibilityChange = true,\n\t\t\tdefaultHiddenSeries,\n\t\t\tchildren,\n\t\t\tgridVisibility,\n\t\t\tgap = 'md',\n\t\t},\n\t\tref\n\t) => {\n\t\tconst legendInteractive = legend.interactive ?? false;\n\t\tconst legendCollapseGroups = legend.collapseGroups ?? false;\n\t\tconst legendShape = legend.shape ?? 'line';\n\t\tconst legendPosition = legend.position ?? 'bottom';\n\n\t\tconst providerTheme = useGlobalChartsTheme();\n\t\tconst theme = useXYChartTheme( data );\n\t\t// Gradient stops apply this as an SVG attribute, where CSS var() cannot resolve. useXYChartTheme has already resolved the same role inside its memo, against the chart's scope element, so read it back rather than paying another getComputedStyle on every render.\n\t\tconst resolvedBackgroundColor = theme.backgroundColor ?? providerTheme.backgroundColor;\n\t\tconst chartId = useChartId( providedChartId );\n\t\tconst hiddenSeries = useDefaultHiddenSeries( chartId, defaultHiddenSeries );\n\t\tconst isSeriesVisible = useCallback(\n\t\t\t( seriesLabel: string ) => ! hiddenSeries.has( seriesLabel ),\n\t\t\t[ hiddenSeries ]\n\t\t);\n\t\tconst chartRef = useRef< HTMLDivElement >( null );\n\t\tconst [ selectedIndex, setSelectedIndex ] = useState< number | undefined >( undefined );\n\t\tconst [ isNavigating, setIsNavigating ] = useState( false );\n\t\tconst internalChartRef = useRef< ChartInstanceRef >( null );\n\n\t\tconst zoom = useXZoom< Date >( {\n\t\t\tenabled: zoomable,\n\t\t\tchartRef: internalChartRef,\n\t\t\tuserHandlers: { onPointerDown, onPointerMove, onPointerUp },\n\t\t} );\n\n\t\t// Process children for composition API (Legend, etc.)\n\t\tconst { legendChildren, nonLegendChildren } = useChartChildren( children, 'LineChart' );\n\t\tconst [ measuredChartHeight, setMeasuredChartHeight ] = useState< number | undefined >();\n\n\t\t// Callback for ChartLayout to notify us when the measured content height changes.\n\t\t// We compute chartHeight the same way the render prop does so the context stays in sync.\n\t\tconst handleContentHeightChange = useCallback(\n\t\t\t( contentHeight: number ) => {\n\t\t\t\tconst chartHeight = contentHeight > 0 ? contentHeight : height;\n\t\t\t\tsetMeasuredChartHeight( chartHeight );\n\t\t\t},\n\t\t\t[ height ]\n\t\t);\n\n\t\t// Forward the external ref to the internal ref\n\t\tuseImperativeHandle(\n\t\t\tref,\n\t\t\t() => ( {\n\t\t\t\tgetScales: () => internalChartRef.current?.getScales() || null,\n\t\t\t\tgetChartDimensions: () =>\n\t\t\t\t\tinternalChartRef.current?.getChartDimensions() || { width: 0, height: 0, margin: {} },\n\t\t\t} ),\n\t\t\t[ internalChartRef ]\n\t\t);\n\n\t\tconst dataSorted = useChartDataTransform( data );\n\t\tconst { getElementStyles } = useGlobalChartsContext();\n\n\t\t// Series visibility is owned by the provider, so it applies whether it changed\n\t\t// through the interactive legend or programmatically.\n\t\tconst seriesWithVisibility = useMemo( () => {\n\t\t\treturn dataSorted.map( ( series, index ) => ( {\n\t\t\t\tseries,\n\t\t\t\tindex,\n\t\t\t\tisVisible: ! hiddenSeries.has( series.label ),\n\t\t\t} ) );\n\t\t}, [ dataSorted, hiddenSeries ] );\n\n\t\t// Check if all series are hidden\n\t\tconst allSeriesHidden = useMemo( () => {\n\t\t\treturn seriesWithVisibility.every( ( { isVisible } ) => ! isVisible );\n\t\t}, [ seriesWithVisibility ] );\n\n\t\t// When series visibility changes — via the interactive legend or programmatically —\n\t\t// and rescaling is opted out, pin the value axis to the full data range so it stays\n\t\t// put instead of visx rescaling the domain to whatever is currently visible and\n\t\t// making the axis jump. Default is to rescale, matching the pre-existing behaviour\n\t\t// and AreaChart's `rescaleYOnVisibilityChange`.\n\t\tconst stableYDomain = useMemo< [ number, number ] | undefined >( () => {\n\t\t\tif ( rescaleYOnVisibilityChange ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tlet min = Infinity;\n\t\t\tlet max = -Infinity;\n\t\t\tfor ( const series of dataSorted ) {\n\t\t\t\tfor ( const point of series.data ?? [] ) {\n\t\t\t\t\tconst value = point?.value;\n\t\t\t\t\tif ( typeof value === 'number' && Number.isFinite( value ) ) {\n\t\t\t\t\t\tmin = Math.min( min, value );\n\t\t\t\t\t\tmax = Math.max( max, value );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn min < max ? [ min, max ] : undefined;\n\t\t}, [ rescaleYOnVisibilityChange, dataSorted ] );\n\n\t\t// Use the keyboard navigation hook\n\t\tconst { tooltipRef, onChartFocus, onChartBlur, onChartKeyDown } = useKeyboardNavigation( {\n\t\t\tselectedIndex,\n\t\t\tsetSelectedIndex,\n\t\t\tisNavigating,\n\t\t\tsetIsNavigating,\n\t\t\tchartRef,\n\t\t\ttotalPoints: dataSorted[ 0 ]?.data.length || 0,\n\t\t} );\n\n\t\tconst chartOptions = useMemo( () => {\n\t\t\tconst { tickResolution, ...xAxisOptions } = options?.axis?.x ?? {};\n\t\t\tconst formatter = xAxisOptions.tickFormat || getFormatter( dataSorted, tickResolution );\n\n\t\t\treturn {\n\t\t\t\taxis: {\n\t\t\t\t\tx: {\n\t\t\t\t\t\torientation: 'bottom' as const,\n\t\t\t\t\t\tnumTicks: guessOptimalNumTicks( dataSorted, width, formatter ),\n\t\t\t\t\t\ttickFormat: formatter,\n\t\t\t\t\t\tdisplay: true,\n\t\t\t\t\t\t...xAxisOptions,\n\t\t\t\t\t},\n\t\t\t\t\ty: {\n\t\t\t\t\t\torientation: 'left' as const,\n\t\t\t\t\t\tnumTicks: 4,\n\t\t\t\t\t\ttickFormat: formatNumberCompact as TickFormatter< number >,\n\t\t\t\t\t\tdisplay: true,\n\t\t\t\t\t\t...options?.axis?.y,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\txScale: {\n\t\t\t\t\ttype: 'time' as const,\n\t\t\t\t\t...options?.xScale,\n\t\t\t\t\t...( zoom.domain ? { domain: zoom.domain } : {} ),\n\t\t\t\t},\n\t\t\t\tyScale: {\n\t\t\t\t\ttype: 'linear' as const,\n\t\t\t\t\tnice: true,\n\t\t\t\t\tzero: false,\n\t\t\t\t\t...( stableYDomain ? { domain: stableYDomain } : {} ),\n\t\t\t\t\t...options?.yScale,\n\t\t\t\t},\n\t\t\t};\n\t\t}, [ options, dataSorted, width, zoom.domain, stableYDomain ] );\n\n\t\tconst tooltipRenderGlyph = useMemo( () => {\n\t\t\treturn ( props: GlyphProps< DataPointDate > ) => {\n\t\t\t\tconst seriesIndex = dataSorted.findIndex(\n\t\t\t\t\tseries =>\n\t\t\t\t\t\tseries.label === props.key || series.data.includes( props.datum as DataPointDate )\n\t\t\t\t);\n\n\t\t\t\tconst seriesData = dataSorted[ seriesIndex ];\n\n\t\t\t\tconst { color, glyph: themeGlyph } = getElementStyles( {\n\t\t\t\t\tdata: seriesData,\n\t\t\t\t\tindex: seriesIndex,\n\t\t\t\t} );\n\n\t\t\t\tconst propsWithResolvedColor = { ...props, color };\n\n\t\t\t\treturn themeGlyph\n\t\t\t\t\t? themeGlyph( propsWithResolvedColor )\n\t\t\t\t\t: renderGlyph( propsWithResolvedColor );\n\t\t\t};\n\t\t}, [ dataSorted, renderGlyph, getElementStyles ] );\n\n\t\tconst defaultMargin = useChartMargin( height, chartOptions, dataSorted, theme );\n\n\t\tconst error = validateData( dataSorted );\n\t\tconst isDataValid = ! error;\n\n\t\t// Memoize legend options to prevent unnecessary re-calculations\n\t\tconst legendOptions = useMemo(\n\t\t\t() => ( {\n\t\t\t\twithGlyph: withLegendGlyph,\n\t\t\t\tglyphSize: Math.max( 0, toNumber( glyphStyle?.radius ) ?? 4 ),\n\t\t\t\tcollapseGroups: legendCollapseGroups,\n\t\t\t\trenderGlyph,\n\t\t\t} ),\n\t\t\t[ withLegendGlyph, glyphStyle?.radius, legendCollapseGroups, renderGlyph ]\n\t\t);\n\n\t\t// Create legend items using the reusable hook\n\t\tconst legendItems = useChartLegendItems( dataSorted, legendOptions, legendShape );\n\n\t\t// Memoize metadata to prevent unnecessary re-registration\n\t\tconst chartMetadata = useMemo(\n\t\t\t() => ( {\n\t\t\t\twithGradientFill,\n\t\t\t\tsmoothing,\n\t\t\t\tcurveType,\n\t\t\t\twithStartGlyphs,\n\t\t\t\twithEndGlyphs,\n\t\t\t\twithLegendGlyph,\n\t\t\t} ),\n\t\t\t[ withGradientFill, smoothing, curveType, withStartGlyphs, withEndGlyphs, withLegendGlyph ]\n\t\t);\n\n\t\t// Register chart with context only if data is valid\n\t\tuseChartRegistration( {\n\t\t\tchartId,\n\t\t\tlegendItems,\n\t\t\tchartType: 'line',\n\t\t\tisDataValid,\n\t\t\tmetadata: chartMetadata,\n\t\t} );\n\n\t\tconst prefersReducedMotion = usePrefersReducedMotion();\n\n\t\tconst accessors = {\n\t\t\txAccessor: ( d: DataPointDate ) => d?.date,\n\t\t\tyAccessor: ( d: DataPointDate ) => d?.value,\n\t\t};\n\n\t\t// Create a custom renderTooltip that includes focus capability\n\t\tif ( error ) {\n\t\t\treturn <div className={ clsx( 'line-chart', styles[ 'line-chart' ] ) }>{ error }</div>;\n\t\t}\n\n\t\tconst legendElement = showLegend && (\n\t\t\t<Legend\n\t\t\t\torientation={ legend.orientation ?? 'horizontal' }\n\t\t\t\talignment={ legend.alignment ?? 'center' }\n\t\t\t\tposition={ legendPosition }\n\t\t\t\tlabelStyles={ legend.labelStyles }\n\t\t\t\titemClassName={ legend.itemClassName }\n\t\t\t\titemStyles={ legend.itemStyles }\n\t\t\t\tshapeStyles={ legend.shapeStyles }\n\t\t\t\tclassName={ styles[ 'line-chart__legend' ] }\n\t\t\t\tshape={ legendShape }\n\t\t\t\tchartId={ chartId }\n\t\t\t\tinteractive={ legendInteractive }\n\t\t\t/>\n\t\t);\n\n\t\treturn (\n\t\t\t<ChartInstanceContext.Provider\n\t\t\t\tvalue={ {\n\t\t\t\t\tchartId,\n\t\t\t\t\tchartRef: internalChartRef,\n\t\t\t\t\tisSeriesVisible,\n\t\t\t\t\tchartWidth: width,\n\t\t\t\t\tchartHeight: measuredChartHeight || 0,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<ChartLayout\n\t\t\t\t\tlegendPosition={ legendPosition }\n\t\t\t\t\tlegendElement={ legendElement }\n\t\t\t\t\tlegendChildren={ legendChildren }\n\t\t\t\t\tgap={ gap }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'line-chart',\n\t\t\t\t\t\tstyles[ 'line-chart' ],\n\t\t\t\t\t\t{ [ styles[ 'line-chart--animated' ] ]: animation && ! prefersReducedMotion },\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ { width, height } }\n\t\t\t\t\tdata-testid=\"line-chart\"\n\t\t\t\t\ttrailingContent={ nonLegendChildren }\n\t\t\t\t\tonContentHeightChange={ handleContentHeightChange }\n\t\t\t\t>\n\t\t\t\t\t{ ( { contentHeight } ) => {\n\t\t\t\t\t\t// Use the measured height, falling back to the passed height if provided.\n\t\t\t\t\t\tconst chartHeight = contentHeight > 0 ? contentHeight : height;\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\trole=\"grid\"\n\t\t\t\t\t\t\t\taria-label={ __( 'Line chart', 'jetpack-charts' ) }\n\t\t\t\t\t\t\t\ttabIndex={ 0 }\n\t\t\t\t\t\t\t\tonKeyDown={ onChartKeyDown }\n\t\t\t\t\t\t\t\tonFocus={ onChartFocus }\n\t\t\t\t\t\t\t\tonBlur={ onChartBlur }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ chartHeight > 0 && (\n\t\t\t\t\t\t\t\t\t<div ref={ chartRef } style={ { position: 'relative' } }>\n\t\t\t\t\t\t\t\t\t\t{ zoomable && zoom.domain && <ZoomResetButton onClick={ zoom.reset } /> }\n\t\t\t\t\t\t\t\t\t\t<XYChart\n\t\t\t\t\t\t\t\t\t\t\ttheme={ theme }\n\t\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\t\theight={ chartHeight }\n\t\t\t\t\t\t\t\t\t\t\tmargin={ {\n\t\t\t\t\t\t\t\t\t\t\t\t...defaultMargin,\n\t\t\t\t\t\t\t\t\t\t\t\t...margin,\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t// xScale and yScale could be set in Axis as well, but they are `scale` props there.\n\t\t\t\t\t\t\t\t\t\t\txScale={ chartOptions.xScale }\n\t\t\t\t\t\t\t\t\t\t\tyScale={ chartOptions.yScale }\n\t\t\t\t\t\t\t\t\t\t\tonPointerDown={ zoom.handlers.onPointerDown }\n\t\t\t\t\t\t\t\t\t\t\tonPointerUp={ zoom.handlers.onPointerUp }\n\t\t\t\t\t\t\t\t\t\t\tonPointerMove={ zoom.handlers.onPointerMove }\n\t\t\t\t\t\t\t\t\t\t\tonPointerOut={ onPointerOut }\n\t\t\t\t\t\t\t\t\t\t\tpointerEventsDataKey=\"nearest\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ /* With every series hidden there is no data to scale against, so the grid and\n\t\t\t\t\t\t\t\t\t\t\t axes are dropped while the empty state stands in — otherwise they render\n\t\t\t\t\t\t\t\t\t\t\t squished at the top. */ }\n\t\t\t\t\t\t\t\t\t\t\t{ ! allSeriesHidden && gridVisibility !== 'none' && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Grid columns={ false } numTicks={ 4 } />\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t{ ! allSeriesHidden && chartOptions.axis.x.display && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Axis { ...chartOptions.axis.x } />\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t{ ! allSeriesHidden && chartOptions.axis.y.display && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Axis { ...chartOptions.axis.y } />\n\t\t\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t\t\t{ allSeriesHidden ? (\n\t\t\t\t\t\t\t\t\t\t\t\t<SvgEmptyState\n\t\t\t\t\t\t\t\t\t\t\t\t\tx={ width / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\t\ty={ chartHeight / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\t\t\t\theight={ chartHeight }\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ getAllHiddenMessage( legendInteractive, 'series' ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</SvgEmptyState>\n\t\t\t\t\t\t\t\t\t\t\t) : null }\n\n\t\t\t\t\t\t\t\t\t\t\t{ /* Line is not animated, so clip only while zoomed; its edge glyphs sit on the plot border and must not be clipped. */ }\n\t\t\t\t\t\t\t\t\t\t\t<ZoomClip active={ zoomable && !! zoom.domain } chartId={ chartId }>\n\t\t\t\t\t\t\t\t\t\t\t\t{ seriesWithVisibility.map(\n\t\t\t\t\t\t\t\t\t\t\t\t\t( { series: seriesData, index, isVisible } ) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Skip rendering invisible series\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif ( ! isVisible ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst { color, lineStyles, glyph } = getElementStyles( {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata: seriesData,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst lineProps = {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstroke: color,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t...lineStyles,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<g key={ seriesData?.label || index }>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ withGradientFill && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<LinearGradient\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tid={ `area-gradient-${ chartId }-${ index + 1 }` }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfrom={ color }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfromOpacity={ 0.4 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttoOpacity={ 0.1 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tto={ resolvedBackgroundColor }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ ...seriesData.options?.gradient }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata-testid=\"line-gradient\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ seriesData.options?.gradient?.stops?.map(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t( stop, stopIndex ) => (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<stop\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={ `${ stop.offset }-${ stop.color || color }` }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toffset={ stop.offset }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstopColor={ stop.color || color }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstopOpacity={ stop.opacity ?? 1 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata-testid={ `line-gradient-stop-${ chartId }-${ index }-${ stopIndex }` }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</LinearGradient>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<AreaSeries\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={ seriesData?.label }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdataKey={ seriesData?.label }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata={ seriesData.data as DataPointDate[] }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ ...accessors }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfill={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twithGradientFill\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? `url(#area-gradient-${ chartId }-${ index + 1 })`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 'transparent'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\trenderLine={ true }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcurve={ getCurveType( curveType, smoothing ) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlineProps={ lineProps }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ withStartGlyphs && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<LineChartGlyph\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex={ index }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata={ seriesData }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcolor={ color }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\trenderGlyph={ glyph ?? renderGlyph }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\taccessors={ accessors }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tglyphStyle={ glyphStyle }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tposition=\"start\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ withEndGlyphs && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<LineChartGlyph\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex={ index }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata={ seriesData }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcolor={ color }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\trenderGlyph={ glyph ?? renderGlyph }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\taccessors={ accessors }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tglyphStyle={ glyphStyle }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tposition=\"end\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</g>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t</ZoomClip>\n\n\t\t\t\t\t\t\t\t\t\t\t{ withTooltips && (\n\t\t\t\t\t\t\t\t\t\t\t\t<AccessibleTooltip\n\t\t\t\t\t\t\t\t\t\t\t\t\tdetectBounds\n\t\t\t\t\t\t\t\t\t\t\t\t\tsnapTooltipToDatumX\n\t\t\t\t\t\t\t\t\t\t\t\t\tsnapTooltipToDatumY\n\t\t\t\t\t\t\t\t\t\t\t\t\tshowSeriesGlyphs\n\t\t\t\t\t\t\t\t\t\t\t\t\trenderTooltip={ renderTooltip }\n\t\t\t\t\t\t\t\t\t\t\t\t\trenderGlyph={ tooltipRenderGlyph }\n\t\t\t\t\t\t\t\t\t\t\t\t\tglyphStyle={ glyphStyle }\n\t\t\t\t\t\t\t\t\t\t\t\t\tshowVerticalCrosshair={ withTooltipCrosshairs?.showVertical }\n\t\t\t\t\t\t\t\t\t\t\t\t\tshowHorizontalCrosshair={ withTooltipCrosshairs?.showHorizontal }\n\t\t\t\t\t\t\t\t\t\t\t\t\tselectedIndex={ selectedIndex }\n\t\t\t\t\t\t\t\t\t\t\t\t\ttooltipRef={ tooltipRef }\n\t\t\t\t\t\t\t\t\t\t\t\t\tkeyboardFocusedClassName={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstyles[ 'line-chart__tooltip--keyboard-focused' ]\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tseries={ dataSorted }\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t\t\t{ /* Component to expose scale data via ref */ }\n\t\t\t\t\t\t\t\t\t\t\t<LineChartScalesRef\n\t\t\t\t\t\t\t\t\t\t\t\tchartRef={ internalChartRef }\n\t\t\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\t\t\theight={ height }\n\t\t\t\t\t\t\t\t\t\t\t\tmargin={ margin }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t{ zoomable && <ZoomSelectionRect drag={ zoom.drag } /> }\n\t\t\t\t\t\t\t\t\t\t</XYChart>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t</ChartLayout>\n\t\t\t</ChartInstanceContext.Provider>\n\t\t);\n\t}\n);\n\n// Component type definitions for composition API\ntype LineChartAnnotationComponents = {\n\tAnnotationsOverlay: typeof LineChartAnnotationsOverlay;\n\tAnnotation: typeof LineChartAnnotation;\n\tLegend: typeof Legend;\n};\n\ntype LineChartBaseProps = Optional< LineChartProps, 'width' | 'height' | 'size' >;\n\ntype LineChartComponent = React.ForwardRefExoticComponent<\n\tLineChartBaseProps & React.RefAttributes< ChartInstanceRef >\n> &\n\tLineChartAnnotationComponents;\n\ntype LineChartResponsiveComponent = React.ForwardRefExoticComponent<\n\tLineChartBaseProps & ResponsiveConfig & React.RefAttributes< ChartInstanceRef >\n> &\n\tLineChartAnnotationComponents;\n\nconst LineChartWithProvider = forwardRef< ChartInstanceRef, LineChartProps >( ( props, ref ) => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, render the core component directly\n\tif ( existingContext ) {\n\t\treturn <LineChartInternal { ...props } ref={ ref } />;\n\t}\n\n\t// Otherwise, wrap with our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<LineChartInternal { ...props } ref={ ref } />\n\t\t</GlobalChartsProvider>\n\t);\n} );\n\nLineChartWithProvider.displayName = 'LineChart';\n\nconst LineChart = attachSubComponents( LineChartWithProvider, {\n\tLegend: Legend,\n\tAnnotationsOverlay: LineChartAnnotationsOverlay,\n\tAnnotation: LineChartAnnotation,\n} ) as LineChartComponent;\n\nconst LineChartResponsive = attachSubComponents(\n\twithResponsive< LineChartProps >( LineChartWithProvider ),\n\t{\n\t\tLegend: Legend,\n\t\tAnnotationsOverlay: LineChartAnnotationsOverlay,\n\t\tAnnotation: LineChartAnnotation,\n\t}\n) as LineChartResponsiveComponent;\n\nexport { LineChartResponsive as default, LineChart as LineChartUnresponsive };\n","import { __ } from '@wordpress/i18n';\nimport type { DataPoint, DataPointDate, SeriesData } from '../../../types';\n\n/**\n * Up-front data validation. Returns a localised error message when the chart\n * cannot safely render, otherwise `null`. Catches the cases that would\n * NaN-cascade through the tick formatter and stack layout: empty top-level\n * array, empty per-series data, null/NaN values, invalid dates.\n *\n * @param data - Series data passed to AreaChart.\n * @return Error message, or `null` if the data is renderable.\n */\nexport const validateData = ( data: SeriesData[] ) => {\n\tif ( ! data?.length ) return __( 'No data available', 'jetpack-charts' );\n\n\tconst hasEmptySeries = data.some( series => ! series.data?.length );\n\tif ( hasEmptySeries ) return __( 'No data available', 'jetpack-charts' );\n\n\tconst hasInvalidData = data.some( series =>\n\t\tseries.data.some(\n\t\t\t( point: DataPointDate | DataPoint ) =>\n\t\t\t\tisNaN( point.value as number ) ||\n\t\t\t\tpoint.value === null ||\n\t\t\t\tpoint.value === undefined ||\n\t\t\t\t( 'date' in point && point.date && isNaN( point.date.getTime() ) )\n\t\t)\n\t);\n\n\tif ( hasInvalidData ) return __( 'Invalid data', 'jetpack-charts' );\n\treturn null;\n};\n","import { DataContext, TooltipContext } from '@visx/xychart';\nimport { useContext, useImperativeHandle } from 'react';\nimport type { ElementStyles, GetElementStylesParams } from '../../../providers';\nimport type { DataPointDate, SeriesData } from '../../../types';\nimport type { ChartInstanceRef } from '../../private/chart-instance-context';\nimport type { FC, ReactNode, Ref } from 'react';\n\nexport type VisibleSeriesEntry = { series: SeriesData; index: number; isVisible: boolean };\n\n// AreaChart only configures time + linear scales; cast to a callable shape\n// instead of spreading `any`. `Number(...)` + `isFinite` guards every call.\ntype ScaleFn = ( input: Date | number ) => number;\n\n// Bridges visx's `DataContext` to the chart's `ChartInstanceRef` so consumers\n// can read scales and dimensions imperatively. Must be inside `<XYChart>`.\nexport const AreaChartScalesRef: FC< {\n\tchartRef?: Ref< ChartInstanceRef >;\n\twidth: number;\n\theight: number;\n\tmargin?: { top?: number; right?: number; bottom?: number; left?: number };\n} > = ( { chartRef, width, height, margin } ) => {\n\tconst context = useContext( DataContext );\n\n\tuseImperativeHandle(\n\t\tchartRef,\n\t\t() => ( {\n\t\t\tgetScales: () => {\n\t\t\t\tif ( ! context?.xScale || ! context?.yScale ) return null;\n\t\t\t\treturn { xScale: context.xScale, yScale: context.yScale };\n\t\t\t},\n\t\t\tgetChartDimensions: () => ( { width, height, margin: margin || {} } ),\n\t\t} ),\n\t\t[ context, width, height, margin ]\n\t);\n\n\treturn null;\n};\n\n// Hover indicators for each visible series. visx's `showSeriesGlyphs`\n// mispositions on AreaStack (its registered yAccessor expects a stack-bar\n// but receives the unwrapped datum, yielding NaN), so we compute positions\n// from the chart's scales: cumulative top edge for stacked + offset='none'\n// (matches d3-stack — missing values count as 0); raw y for unstacked.\n// Skipped for `expand`/`wiggle`/`silhouette` — exact positions there would\n// need re-running the d3-stack layout.\nexport const HoverGlyphs: FC< {\n\tvisibleSeries: VisibleSeriesEntry[];\n\tstacked: boolean;\n\tstackOffset: 'none' | 'expand' | 'wiggle' | 'silhouette';\n\tgetElementStyles: ( params: GetElementStylesParams ) => ElementStyles;\n\tstrokeColor: string;\n} > = ( { visibleSeries, stacked, stackOffset, getElementStyles, strokeColor } ) => {\n\tconst dataContext = useContext( DataContext );\n\tconst tooltipContext = useContext( TooltipContext );\n\n\tconst xScale = dataContext?.xScale as ScaleFn | undefined;\n\tconst yScale = dataContext?.yScale as ScaleFn | undefined;\n\tconst tooltipOpen = tooltipContext?.tooltipOpen;\n\tconst nearestDatum = tooltipContext?.tooltipData?.nearestDatum?.datum as\n\t\t| DataPointDate\n\t\t| undefined;\n\n\tif (\n\t\t! tooltipOpen ||\n\t\t! xScale ||\n\t\t! yScale ||\n\t\t! nearestDatum ||\n\t\t! nearestDatum.date ||\n\t\t( stacked && stackOffset !== 'none' )\n\t) {\n\t\treturn null;\n\t}\n\n\tconst xPx = Number( xScale( nearestDatum.date ) );\n\tif ( ! Number.isFinite( xPx ) ) return null;\n\n\tconst hoveredTime = nearestDatum.date.getTime();\n\tlet cumulative = 0;\n\tconst circles: ReactNode[] = [];\n\n\t// Always advance `cumulative` (d3-stack treats missing/null as 0), but\n\t// only render a glyph when the series has a real value at this x.\n\tfor ( const { series, index } of visibleSeries ) {\n\t\tconst datum = series.data.find(\n\t\t\td => ( d as DataPointDate ).date?.getTime() === hoveredTime\n\t\t) as DataPointDate | undefined;\n\n\t\tconst value = datum?.value ?? 0;\n\t\tif ( stacked ) {\n\t\t\tcumulative += value;\n\t\t}\n\n\t\tif ( ! datum || datum.value == null ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst yPx = Number( yScale( stacked ? cumulative : value ) );\n\t\tif ( ! Number.isFinite( yPx ) ) continue;\n\n\t\tconst { color } = getElementStyles( { data: series, index } );\n\t\tcircles.push(\n\t\t\t<circle\n\t\t\t\tkey={ series.label || index }\n\t\t\t\tcx={ xPx }\n\t\t\t\tcy={ yPx }\n\t\t\t\tr={ 4 }\n\t\t\t\tfill={ color }\n\t\t\t\tstroke={ strokeColor }\n\t\t\t\tstrokeWidth={ 1.5 }\n\t\t\t\tpaintOrder=\"fill\"\n\t\t\t\tdata-testid={ `area-chart-hover-glyph-${ index }` }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( circles.length === 0 ) return null;\n\n\treturn (\n\t\t<g pointerEvents=\"none\" className=\"area-chart__hover-glyphs\">\n\t\t\t{ circles }\n\t\t</g>\n\t);\n};\n","import { formatNumberCompact } from '@automattic/number-formatters';\nimport { XYChart, AnimatedAreaSeries, AnimatedAreaStack, Grid, Axis } from '@visx/xychart';\nimport { __ } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport {\n\tuseMemo,\n\tuseContext,\n\tforwardRef,\n\tuseImperativeHandle,\n\tuseState,\n\tuseRef,\n\tuseCallback,\n} from 'react';\nimport { Legend, useChartLegendItems } from '../../components/legend';\nimport { AccessibleTooltip, useKeyboardNavigation } from '../../components/tooltip';\nimport {\n\tuseXYChartTheme,\n\tuseChartDataTransform,\n\tuseChartMargin,\n\tusePrefersReducedMotion,\n} from '../../hooks';\nimport {\n\tGlobalChartsProvider,\n\tGlobalChartsContext,\n\tuseChartId,\n\tuseChartRegistration,\n\tuseGlobalChartsContext,\n\tuseGlobalChartsTheme,\n} from '../../providers';\nimport { useDefaultHiddenSeries } from '../../providers/chart-context/hooks/use-default-hidden-series';\nimport { attachSubComponents } from '../../utils';\nimport { renderDefaultTooltip } from '../line-chart';\nimport { useChartChildren } from '../private/chart-composition';\nimport { ChartInstanceContext, type ChartInstanceRef } from '../private/chart-instance-context';\nimport { ChartLayout } from '../private/chart-layout';\nimport { getAllHiddenMessage, SvgEmptyState } from '../private/svg-empty-state';\nimport { getCurveType, getFormatter, guessOptimalNumTicks } from '../private/time-axis';\nimport { withResponsive } from '../private/with-responsive';\nimport { useXZoom, ZoomResetButton, ZoomSelectionRect, ZoomClip } from '../private/x-zoom';\nimport styles from './area-chart.module.scss';\nimport { AreaChartScalesRef, HoverGlyphs, validateData } from './private';\nimport type { AreaChartProps } from './types';\nimport type { DataPointDate, Optional } from '../../types';\nimport type { ResponsiveConfig } from '../private/with-responsive';\nimport type { TickFormatter } from '@visx/axis';\n\nconst AreaChartInternal = forwardRef< ChartInstanceRef, AreaChartProps >(\n\t(\n\t\t{\n\t\t\tdata,\n\t\t\tchartId: providedChartId,\n\t\t\twidth,\n\t\t\theight,\n\t\t\tclassName,\n\t\t\tmargin,\n\t\t\twithTooltips = true,\n\t\t\twithTooltipCrosshairs,\n\t\t\tshowLegend = false,\n\t\t\tlegend = {},\n\t\t\tstacked = true,\n\t\t\tstackOffset = 'none',\n\t\t\tsmoothing = true,\n\t\t\tcurveType,\n\t\t\tfillOpacity,\n\t\t\twithStroke,\n\t\t\trenderTooltip = renderDefaultTooltip,\n\t\t\tanimation,\n\t\t\toptions = {},\n\t\t\tonPointerDown,\n\t\t\tonPointerUp,\n\t\t\tonPointerMove,\n\t\t\tonPointerOut,\n\t\t\tzoomable = false,\n\t\t\trescaleYOnVisibilityChange,\n\t\t\trescaleYOnLegendToggle,\n\t\t\tdefaultHiddenSeries,\n\t\t\tchildren,\n\t\t\tgridVisibility,\n\t\t\tgap = 'md',\n\t\t},\n\t\tref\n\t) => {\n\t\tconst legendInteractive = legend.interactive ?? false;\n\t\tconst legendShape = legend.shape ?? 'rect';\n\t\tconst legendPosition = legend.position ?? 'bottom';\n\n\t\t// New prop wins; fall back to the deprecated `rescaleYOnLegendToggle`; default to rescaling.\n\t\tconst rescaleYOnVisibility = rescaleYOnVisibilityChange ?? rescaleYOnLegendToggle ?? true;\n\n\t\tconst providerTheme = useGlobalChartsTheme();\n\t\tconst theme = useXYChartTheme( data );\n\t\tconst chartId = useChartId( providedChartId );\n\t\tconst hiddenSeries = useDefaultHiddenSeries( chartId, defaultHiddenSeries );\n\t\tconst isSeriesVisible = useCallback(\n\t\t\t( seriesLabel: string ) => ! hiddenSeries.has( seriesLabel ),\n\t\t\t[ hiddenSeries ]\n\t\t);\n\t\tconst chartRef = useRef< HTMLDivElement >( null );\n\t\tconst [ selectedIndex, setSelectedIndex ] = useState< number | undefined >( undefined );\n\t\tconst [ isNavigating, setIsNavigating ] = useState( false );\n\t\tconst internalChartRef = useRef< ChartInstanceRef >( null );\n\n\t\tconst zoom = useXZoom< Date >( {\n\t\t\tenabled: zoomable,\n\t\t\tchartRef: internalChartRef,\n\t\t\tuserHandlers: { onPointerDown, onPointerMove, onPointerUp },\n\t\t} );\n\n\t\tconst { legendChildren, nonLegendChildren } = useChartChildren( children, 'AreaChart' );\n\t\tconst [ measuredChartHeight, setMeasuredChartHeight ] = useState< number | undefined >();\n\n\t\tconst handleContentHeightChange = useCallback(\n\t\t\t( contentHeight: number ) => {\n\t\t\t\tconst chartHeight = contentHeight > 0 ? contentHeight : height;\n\t\t\t\tsetMeasuredChartHeight( chartHeight );\n\t\t\t},\n\t\t\t[ height ]\n\t\t);\n\n\t\tuseImperativeHandle(\n\t\t\tref,\n\t\t\t() => ( {\n\t\t\t\tgetScales: () => internalChartRef.current?.getScales() || null,\n\t\t\t\tgetChartDimensions: () =>\n\t\t\t\t\tinternalChartRef.current?.getChartDimensions() || { width: 0, height: 0, margin: {} },\n\t\t\t} ),\n\t\t\t[ internalChartRef ]\n\t\t);\n\n\t\tconst dataSorted = useChartDataTransform( data );\n\t\tconst { getElementStyles } = useGlobalChartsContext();\n\n\t\tconst seriesWithVisibility = useMemo( () => {\n\t\t\treturn dataSorted.map( ( series, index ) => ( {\n\t\t\t\tseries,\n\t\t\t\tindex,\n\t\t\t\tisVisible: ! hiddenSeries.has( series.label ),\n\t\t\t} ) );\n\t\t}, [ dataSorted, hiddenSeries ] );\n\n\t\tconst allSeriesHidden = useMemo(\n\t\t\t() => seriesWithVisibility.every( ( { isVisible } ) => ! isVisible ),\n\t\t\t[ seriesWithVisibility ]\n\t\t);\n\n\t\tconst { tooltipRef, onChartFocus, onChartBlur, onChartKeyDown } = useKeyboardNavigation( {\n\t\t\tselectedIndex,\n\t\t\tsetSelectedIndex,\n\t\t\tisNavigating,\n\t\t\tsetIsNavigating,\n\t\t\tchartRef,\n\t\t\ttotalPoints: dataSorted[ 0 ]?.data.length || 0,\n\t\t} );\n\n\t\t// Computed from the full data set (ignoring legend visibility) so the y-axis stays\n\t\t// fixed when series are toggled off - otherwise visx auto-fits to the remaining\n\t\t// data and the chart's baseline appears to move. Opt-in via\n\t\t// `rescaleYOnVisibilityChange={ false }`. Skipped for non-default stack offsets,\n\t\t// which reshape the y-extent (`expand` -> [0,1], `wiggle`/`silhouette` -> centred\n\t\t// around zero); letting visx derive the domain is correct there.\n\t\tconst fixedYDomain = useMemo< [ number, number ] | undefined >( () => {\n\t\t\tif (\n\t\t\t\trescaleYOnVisibility ||\n\t\t\t\t! dataSorted.length ||\n\t\t\t\t! dataSorted[ 0 ].data.length ||\n\t\t\t\t( stacked && stackOffset !== 'none' )\n\t\t\t) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tif ( stacked ) {\n\t\t\t\t// d3-stack with `offset: 'none'` stacks positives upward from 0 and\n\t\t\t\t// negatives downward from 0, so we need both extremes.\n\t\t\t\tconst numPoints = Math.max( ...dataSorted.map( s => s.data.length ) );\n\t\t\t\tlet posMax = 0;\n\t\t\t\tlet negMin = 0;\n\t\t\t\tfor ( let i = 0; i < numPoints; i++ ) {\n\t\t\t\t\tlet posSum = 0;\n\t\t\t\t\tlet negSum = 0;\n\t\t\t\t\tfor ( const series of dataSorted ) {\n\t\t\t\t\t\tconst v = Number( series.data[ i ]?.value );\n\t\t\t\t\t\tif ( Number.isNaN( v ) ) continue;\n\t\t\t\t\t\tif ( v >= 0 ) posSum += v;\n\t\t\t\t\t\telse negSum += v;\n\t\t\t\t\t}\n\t\t\t\t\tif ( posSum > posMax ) posMax = posSum;\n\t\t\t\t\tif ( negSum < negMin ) negMin = negSum;\n\t\t\t\t}\n\t\t\t\treturn [ negMin, posMax ];\n\t\t\t}\n\n\t\t\tlet max = -Infinity;\n\t\t\tlet min = Infinity;\n\t\t\tfor ( const series of dataSorted ) {\n\t\t\t\tfor ( const point of series.data ) {\n\t\t\t\t\tconst v = Number( point?.value );\n\t\t\t\t\tif ( ! Number.isNaN( v ) ) {\n\t\t\t\t\t\tif ( v > max ) max = v;\n\t\t\t\t\t\tif ( v < min ) min = v;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( max === -Infinity ) return undefined;\n\t\t\treturn [ Math.min( 0, min ), max ];\n\t\t}, [ dataSorted, stacked, stackOffset, rescaleYOnVisibility ] );\n\n\t\tconst chartOptions = useMemo( () => {\n\t\t\tconst { tickResolution, ...xAxisOptions } = options?.axis?.x ?? {};\n\t\t\tconst formatter = xAxisOptions.tickFormat || getFormatter( dataSorted, tickResolution );\n\n\t\t\treturn {\n\t\t\t\taxis: {\n\t\t\t\t\tx: {\n\t\t\t\t\t\torientation: 'bottom' as const,\n\t\t\t\t\t\tnumTicks: guessOptimalNumTicks( dataSorted, width, formatter ),\n\t\t\t\t\t\ttickFormat: formatter,\n\t\t\t\t\t\tdisplay: true,\n\t\t\t\t\t\t...xAxisOptions,\n\t\t\t\t\t},\n\t\t\t\t\ty: {\n\t\t\t\t\t\torientation: 'left' as const,\n\t\t\t\t\t\tnumTicks: 4,\n\t\t\t\t\t\ttickFormat: formatNumberCompact as TickFormatter< number >,\n\t\t\t\t\t\tdisplay: true,\n\t\t\t\t\t\t...options?.axis?.y,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\txScale: {\n\t\t\t\t\ttype: 'time' as const,\n\t\t\t\t\t...options?.xScale,\n\t\t\t\t\t...( zoom.domain ? { domain: zoom.domain } : {} ),\n\t\t\t\t},\n\t\t\t\tyScale: {\n\t\t\t\t\ttype: 'linear' as const,\n\t\t\t\t\tnice: true,\n\t\t\t\t\t// Stacked areas should always include zero so the baseline is meaningful.\n\t\t\t\t\tzero: stacked,\n\t\t\t\t\t...( fixedYDomain ? { domain: fixedYDomain } : {} ),\n\t\t\t\t\t...options?.yScale,\n\t\t\t\t},\n\t\t\t};\n\t\t}, [ options, dataSorted, width, stacked, fixedYDomain, zoom.domain ] );\n\n\t\tconst defaultMargin = useChartMargin( height, chartOptions, dataSorted, theme );\n\n\t\tconst error = validateData( dataSorted );\n\t\tconst isDataValid = ! error;\n\n\t\tconst legendOptions = useMemo(\n\t\t\t() => ( {\n\t\t\t\twithGlyph: false,\n\t\t\t\tglyphSize: 0,\n\t\t\t\tcollapseGroups: legend.collapseGroups ?? false,\n\t\t\t} ),\n\t\t\t[ legend.collapseGroups ]\n\t\t);\n\t\tconst legendItems = useChartLegendItems( dataSorted, legendOptions, legendShape );\n\n\t\tconst chartMetadata = useMemo(\n\t\t\t() => ( { stacked, stackOffset, smoothing, curveType } ),\n\t\t\t[ stacked, stackOffset, smoothing, curveType ]\n\t\t);\n\n\t\tuseChartRegistration( {\n\t\t\tchartId,\n\t\t\tlegendItems,\n\t\t\tchartType: 'area',\n\t\t\tisDataValid,\n\t\t\tmetadata: chartMetadata,\n\t\t} );\n\n\t\tconst prefersReducedMotion = usePrefersReducedMotion();\n\t\tconst animationEnabled = !! animation && ! prefersReducedMotion;\n\n\t\tconst accessors = {\n\t\t\txAccessor: ( d: DataPointDate ) => d?.date,\n\t\t\tyAccessor: ( d: DataPointDate ) => d?.value,\n\t\t};\n\t\tconst zeroYAccessor = useCallback( () => 0, [] );\n\n\t\t// Hidden series are still registered with visx (so paths can interpolate), but their\n\t\t// data points should not appear in the tooltip.\n\t\tconst visibleLabels = useMemo(\n\t\t\t() => new Set( seriesWithVisibility.filter( s => s.isVisible ).map( s => s.series.label ) ),\n\t\t\t[ seriesWithVisibility ]\n\t\t);\n\t\tconst filteredRenderTooltip = useCallback(\n\t\t\t( params: Parameters< typeof renderTooltip >[ 0 ] ) => {\n\t\t\t\tconst datumByKey = params?.tooltipData?.datumByKey;\n\t\t\t\tif ( ! datumByKey ) return renderTooltip( params );\n\t\t\t\tconst filtered = Object.fromEntries(\n\t\t\t\t\tObject.entries( datumByKey ).filter( ( [ key ] ) => visibleLabels.has( key ) )\n\t\t\t\t);\n\t\t\t\tif ( Object.keys( filtered ).length === 0 ) return null;\n\t\t\t\t// `nearestDatum` may still point at a hidden series; re-point it at the first\n\t\t\t\t// visible entry so consumers that read it (e.g. for the tooltip heading) don't\n\t\t\t\t// surface hidden-series state.\n\t\t\t\tconst nearestDatum = params?.tooltipData?.nearestDatum;\n\t\t\t\tconst nextNearest =\n\t\t\t\t\tnearestDatum && visibleLabels.has( nearestDatum.key )\n\t\t\t\t\t\t? nearestDatum\n\t\t\t\t\t\t: { ...Object.values( filtered )[ 0 ], distance: nearestDatum?.distance ?? 0 };\n\t\t\t\treturn renderTooltip( {\n\t\t\t\t\t...params,\n\t\t\t\t\ttooltipData: {\n\t\t\t\t\t\t...params.tooltipData,\n\t\t\t\t\t\tdatumByKey: filtered,\n\t\t\t\t\t\tnearestDatum: nextNearest,\n\t\t\t\t\t} as typeof params.tooltipData,\n\t\t\t\t} );\n\t\t\t},\n\t\t\t[ renderTooltip, visibleLabels ]\n\t\t);\n\n\t\t// Defaults that depend on stacked vs overlapping mode.\n\t\tconst resolvedFillOpacity = fillOpacity ?? ( stacked ? 0.85 : 0.4 );\n\t\tconst resolvedWithStroke = withStroke ?? ! stacked;\n\n\t\tif ( error ) {\n\t\t\treturn <div className={ clsx( 'area-chart', styles[ 'area-chart' ] ) }>{ error }</div>;\n\t\t}\n\n\t\tconst legendElement = showLegend && (\n\t\t\t<Legend\n\t\t\t\torientation={ legend.orientation ?? 'horizontal' }\n\t\t\t\talignment={ legend.alignment ?? 'center' }\n\t\t\t\tposition={ legendPosition }\n\t\t\t\tlabelStyles={ legend.labelStyles }\n\t\t\t\titemClassName={ legend.itemClassName }\n\t\t\t\titemStyles={ legend.itemStyles }\n\t\t\t\tshapeStyles={ legend.shapeStyles }\n\t\t\t\tclassName={ styles[ 'area-chart__legend' ] }\n\t\t\t\tshape={ legendShape }\n\t\t\t\tchartId={ chartId }\n\t\t\t\tinteractive={ legendInteractive }\n\t\t\t/>\n\t\t);\n\n\t\tconst visibleSeries = seriesWithVisibility.filter( ( { isVisible } ) => isVisible );\n\t\tconst curve = getCurveType( curveType, smoothing );\n\n\t\t// Visx's `<AreaStack>` keys each `<Area>` by `stackIndex-dataKey`, so filtering out\n\t\t// a hidden series would shift indexes and remount every path. Instead we keep every\n\t\t// series mounted and zero out hidden ones via `yAccessor` — react-spring then\n\t\t// interpolates the `d` attribute, giving a smooth \"going down\" effect for the\n\t\t// hidden area and a smooth re-flow for the rest.\n\t\tconst renderSeries = ( {\n\t\t\tseries: seriesData,\n\t\t\tindex,\n\t\t\tisVisible,\n\t\t}: ( typeof seriesWithVisibility )[ number ] ) => {\n\t\t\tconst { color, lineStyles } = getElementStyles( { data: seriesData, index } );\n\t\t\treturn (\n\t\t\t\t<AnimatedAreaSeries\n\t\t\t\t\tkey={ seriesData?.label || index }\n\t\t\t\t\tdataKey={ seriesData?.label }\n\t\t\t\t\tdata={ seriesData.data as DataPointDate[] }\n\t\t\t\t\txAccessor={ accessors.xAccessor }\n\t\t\t\t\tyAccessor={ isVisible ? accessors.yAccessor : zeroYAccessor }\n\t\t\t\t\tfill={ color }\n\t\t\t\t\tfillOpacity={ resolvedFillOpacity }\n\t\t\t\t\t{ ...( stacked ? {} : { renderLine: resolvedWithStroke, curve } ) }\n\t\t\t\t\tlineProps={ { stroke: color, ...lineStyles } }\n\t\t\t\t\tdata-testid={ `area-chart-series-${ index }` }\n\t\t\t\t/>\n\t\t\t);\n\t\t};\n\n\t\treturn (\n\t\t\t<ChartInstanceContext.Provider\n\t\t\t\tvalue={ {\n\t\t\t\t\tchartId,\n\t\t\t\t\tchartRef: internalChartRef,\n\t\t\t\t\tisSeriesVisible,\n\t\t\t\t\tchartWidth: width,\n\t\t\t\t\tchartHeight: measuredChartHeight || 0,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<ChartLayout\n\t\t\t\t\tlegendPosition={ legendPosition }\n\t\t\t\t\tlegendElement={ legendElement }\n\t\t\t\t\tlegendChildren={ legendChildren }\n\t\t\t\t\tgap={ gap }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'area-chart',\n\t\t\t\t\t\tstyles[ 'area-chart' ],\n\t\t\t\t\t\t{ [ styles[ 'area-chart--animated' ] ]: animationEnabled },\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ { width, height } }\n\t\t\t\t\tdata-testid=\"area-chart\"\n\t\t\t\t\ttrailingContent={ nonLegendChildren }\n\t\t\t\t\tonContentHeightChange={ handleContentHeightChange }\n\t\t\t\t>\n\t\t\t\t\t{ ( { contentHeight } ) => {\n\t\t\t\t\t\tconst chartHeight = contentHeight > 0 ? contentHeight : height;\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\trole=\"grid\"\n\t\t\t\t\t\t\t\taria-label={ __( 'Area chart', 'jetpack-charts' ) }\n\t\t\t\t\t\t\t\ttabIndex={ 0 }\n\t\t\t\t\t\t\t\tonKeyDown={ onChartKeyDown }\n\t\t\t\t\t\t\t\tonFocus={ onChartFocus }\n\t\t\t\t\t\t\t\tonBlur={ onChartBlur }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ chartHeight > 0 && (\n\t\t\t\t\t\t\t\t\t<div ref={ chartRef } style={ { position: 'relative' } }>\n\t\t\t\t\t\t\t\t\t\t{ zoomable && zoom.domain && <ZoomResetButton onClick={ zoom.reset } /> }\n\t\t\t\t\t\t\t\t\t\t<XYChart\n\t\t\t\t\t\t\t\t\t\t\ttheme={ theme }\n\t\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\t\theight={ chartHeight }\n\t\t\t\t\t\t\t\t\t\t\tmargin={ { ...defaultMargin, ...margin } }\n\t\t\t\t\t\t\t\t\t\t\txScale={ chartOptions.xScale }\n\t\t\t\t\t\t\t\t\t\t\tyScale={ chartOptions.yScale }\n\t\t\t\t\t\t\t\t\t\t\tonPointerDown={ zoom.handlers.onPointerDown }\n\t\t\t\t\t\t\t\t\t\t\tonPointerUp={ zoom.handlers.onPointerUp }\n\t\t\t\t\t\t\t\t\t\t\tonPointerMove={ zoom.handlers.onPointerMove }\n\t\t\t\t\t\t\t\t\t\t\tonPointerOut={ onPointerOut }\n\t\t\t\t\t\t\t\t\t\t\tpointerEventsDataKey=\"nearest\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ /* With every series hidden the value scale collapses, so the grid and axes\n\t\t\t\t\t\t\t\t\t\t\t are dropped while the empty state stands in — otherwise they render\n\t\t\t\t\t\t\t\t\t\t\t squished at the top. */ }\n\t\t\t\t\t\t\t\t\t\t\t{ ! allSeriesHidden && gridVisibility !== 'none' && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Grid columns={ false } numTicks={ 4 } />\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t{ ! allSeriesHidden && chartOptions.axis.x.display && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Axis { ...chartOptions.axis.x } />\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t{ ! allSeriesHidden && chartOptions.axis.y.display && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Axis { ...chartOptions.axis.y } />\n\t\t\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t\t\t{ allSeriesHidden ? (\n\t\t\t\t\t\t\t\t\t\t\t\t<SvgEmptyState\n\t\t\t\t\t\t\t\t\t\t\t\t\tx={ width / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\t\ty={ chartHeight / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\t\t\t\theight={ chartHeight }\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ getAllHiddenMessage( legendInteractive, 'series' ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</SvgEmptyState>\n\t\t\t\t\t\t\t\t\t\t\t) : null }\n\n\t\t\t\t\t\t\t\t\t\t\t{ /* Area is animated, so clip the whole time it is zoomable to keep the zoom-out animation in bounds. */ }\n\t\t\t\t\t\t\t\t\t\t\t<ZoomClip active={ zoomable } chartId={ chartId }>\n\t\t\t\t\t\t\t\t\t\t\t\t{ ! allSeriesHidden && stacked && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<AnimatedAreaStack\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcurve={ curve }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\toffset={ stackOffset }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trenderLine={ resolvedWithStroke }\n\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ seriesWithVisibility.map( renderSeries ) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t</AnimatedAreaStack>\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t{ ! allSeriesHidden &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t! stacked &&\n\t\t\t\t\t\t\t\t\t\t\t\t\tseriesWithVisibility.map( renderSeries ) }\n\t\t\t\t\t\t\t\t\t\t\t</ZoomClip>\n\n\t\t\t\t\t\t\t\t\t\t\t{ withTooltips && (\n\t\t\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<AccessibleTooltip\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdetectBounds\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsnapTooltipToDatumX\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Stacked mode: yAccessor returns raw value, not stacked y — snapping mispositions.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsnapTooltipToDatumY={ ! stacked }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trenderTooltip={ filteredRenderTooltip }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tshowVerticalCrosshair={ withTooltipCrosshairs?.showVertical }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tshowHorizontalCrosshair={ withTooltipCrosshairs?.showHorizontal }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tselectedIndex={ selectedIndex }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttooltipRef={ tooltipRef }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tkeyboardFocusedClassName={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstyles[ 'area-chart__tooltip--keyboard-focused' ]\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tseries={ dataSorted }\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<HoverGlyphs\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvisibleSeries={ visibleSeries }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstacked={ stacked }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstackOffset={ stackOffset }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tgetElementStyles={ getElementStyles }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// useXYChartTheme resolved this role inside its memo, against the chart's scope element; reading it back avoids a getComputedStyle on every render.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstrokeColor={ theme.backgroundColor ?? providerTheme.backgroundColor }\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t\t\t<AreaChartScalesRef\n\t\t\t\t\t\t\t\t\t\t\t\tchartRef={ internalChartRef }\n\t\t\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\t\t\t// `||` — responsive HOC may pass `height = 0` before measurement.\n\t\t\t\t\t\t\t\t\t\t\t\theight={ height || chartHeight }\n\t\t\t\t\t\t\t\t\t\t\t\tmargin={ margin }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t{ zoomable && <ZoomSelectionRect drag={ zoom.drag } /> }\n\t\t\t\t\t\t\t\t\t\t</XYChart>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t</ChartLayout>\n\t\t\t</ChartInstanceContext.Provider>\n\t\t);\n\t}\n);\n\ntype AreaChartSubComponents = {\n\tLegend: typeof Legend;\n};\n\ntype AreaChartBaseProps = Optional< AreaChartProps, 'width' | 'height' | 'size' >;\n\ntype AreaChartComponent = React.ForwardRefExoticComponent<\n\tAreaChartBaseProps & React.RefAttributes< ChartInstanceRef >\n> &\n\tAreaChartSubComponents;\n\ntype AreaChartResponsiveComponent = React.ForwardRefExoticComponent<\n\tAreaChartBaseProps & ResponsiveConfig & React.RefAttributes< ChartInstanceRef >\n> &\n\tAreaChartSubComponents;\n\nconst AreaChartWithProvider = forwardRef< ChartInstanceRef, AreaChartProps >( ( props, ref ) => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\tif ( existingContext ) {\n\t\treturn <AreaChartInternal { ...props } ref={ ref } />;\n\t}\n\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<AreaChartInternal { ...props } ref={ ref } />\n\t\t</GlobalChartsProvider>\n\t);\n} );\n\nAreaChartWithProvider.displayName = 'AreaChart';\n\nconst AreaChart = attachSubComponents( AreaChartWithProvider, {\n\tLegend: Legend,\n} ) as AreaChartComponent;\n\nconst AreaChartResponsive = attachSubComponents(\n\twithResponsive< AreaChartProps >( AreaChartWithProvider ),\n\t{\n\t\tLegend: Legend,\n\t}\n) as AreaChartResponsiveComponent;\n\nexport { AreaChartResponsive as default, AreaChart as AreaChartUnresponsive };\n","import { DataContext } from '@visx/xychart';\nimport { useContext } from 'react';\nimport { isSafari } from '../../../utils';\nimport type { AxisScale, TickRendererProps } from '@visx/axis';\nimport type { FC, CSSProperties } from 'react';\n\n/**\n * Get the bandwidth of a scale\n *\n * @param scale - The scale to get the bandwidth of\n * @return The bandwidth of the scale\n */\nconst getScaleBandwidth = < Scale extends AxisScale >( scale?: Scale ) => {\n\treturn scale && 'bandwidth' in scale ? scale.bandwidth() ?? 0 : 0;\n};\ninterface TruncatedTickComponentProps extends TickRendererProps {\n\t/** Which axis this tick belongs to */\n\taxis: 'x' | 'y';\n}\n\n/**\n * Minimum width in pixels for tick labels when scale bandwidth is very small.\n * Prevents labels from collapsing to unreadable widths on dense charts.\n *\n * Trade-off: When bandwidth is less than this minimum (e.g., many bars in a narrow chart),\n * adjacent labels may overlap since each label uses this minimum width regardless of\n * available space. This prioritizes label readability over preventing overlap.\n *\n * For very dense charts where overlap occurs, consider:\n * - Using `numTicks` option to reduce the number of displayed labels\n * - Using `tickFormat` to abbreviate label text\n * - Increasing chart width or reducing data points\n */\nconst MIN_TICK_LABEL_WIDTH = 20;\n\n/**\n * A tick component that renders labels with text truncation (ellipsis) when they exceed\n * the available bandwidth. Shows the full text on hover via native title attribute.\n *\n * Uses foreignObject to embed HTML within SVG, enabling CSS text-overflow: ellipsis.\n * Inherits text styles from tickLabelProps passed by visx Axis component.\n *\n * Note: A minimum label width (MIN_TICK_LABEL_WIDTH) is enforced to keep labels readable.\n * On very dense charts where bandwidth < 20px, this may cause label overlap.\n * See MIN_TICK_LABEL_WIDTH documentation for mitigation strategies.\n *\n * @param props - The props for the truncated tick component\n * @param props.x - The x position of the tick\n * @param props.y - The y position of the tick\n * @param props.formattedValue - The formatted value of the tick\n * @param props.axis - The axis this tick belongs to\n * @param props.textAnchor - The text anchor of the tick\n * @param props.fill - The fill color of the tick\n * @param props.dy - The dy offset of the tick\n *\n * @return The truncated tick component\n */\nexport const TruncatedTickComponent: FC< TruncatedTickComponentProps > = ( {\n\tx,\n\ty,\n\tformattedValue,\n\taxis,\n\ttextAnchor,\n\tfill,\n\tdy,\n\t...textProps\n} ) => {\n\t// Get max width of the tick label\n\tconst { xScale, yScale } = useContext( DataContext ) || {};\n\tconst scale = axis === 'x' ? xScale : yScale;\n\tconst bandwidth = getScaleBandwidth( scale );\n\tconst maxWidth = Math.max( bandwidth, MIN_TICK_LABEL_WIDTH );\n\n\t// Map SVG textAnchor to CSS textAlign\n\tlet textAlign: 'left' | 'right' | 'center' = 'center';\n\tif ( textAnchor === 'start' ) {\n\t\ttextAlign = 'left';\n\t} else if ( textAnchor === 'end' ) {\n\t\ttextAlign = 'right';\n\t} else if ( textAnchor === 'middle' ) {\n\t\ttextAlign = 'center';\n\t}\n\n\t// Calculate x offset based on text alignment\n\tlet xOffset = 0;\n\tif ( textAlign === 'center' ) {\n\t\txOffset = -maxWidth / 2;\n\t} else if ( textAlign === 'right' ) {\n\t\txOffset = -maxWidth;\n\t}\n\n\t// Extract compatible style properties from SVG text props\n\tconst { fontSize, fontFamily, fontWeight, fontStyle, letterSpacing, opacity } = textProps as {\n\t\tfontSize?: CSSProperties[ 'fontSize' ];\n\t\tfontFamily?: CSSProperties[ 'fontFamily' ];\n\t\tfontWeight?: CSSProperties[ 'fontWeight' ];\n\t\tfontStyle?: CSSProperties[ 'fontStyle' ];\n\t\tletterSpacing?: CSSProperties[ 'letterSpacing' ];\n\t\topacity?: CSSProperties[ 'opacity' ];\n\t};\n\n\tconst textStyles: CSSProperties = {\n\t\t/**\n\t\t * SVG <text> elements are vertically aligned to the baseline by default, but HTML <div> elements inside <foreignObject>\n\t\t * are positioned relative to the top-left corner. To visually align the tick label like SVG text,\n\t\t * we shift the div up by 100% of its height and adjust by twice the SVG dy value (from visx) to approximate original placement.\n\t\t */\n\t\ttransform: `translateY(calc(-100% + ${ dy ?? '0' } * 2))`,\n\t\t// Safari doesn't work well with foreignObject positioning. Use position: fixed as a workaround.\n\t\t...( isSafari() ? { position: 'fixed' as const } : {} ),\n\t\t// Apply compatible SVG text styles\n\t\tfontSize,\n\t\tfontFamily,\n\t\tfontWeight,\n\t\tfontStyle,\n\t\tletterSpacing,\n\t\topacity,\n\t\t// Convert svg text styles to CSS styles for the div\n\t\tcolor: fill ?? 'inherit',\n\t\ttextAlign,\n\t\t// Ensure text is truncated with ellipsis, remains on one line, and shows the full value in a tooltip on hover.\n\t\t// The surrounding div uses CSS to handle overflow, and the 'title' attribute is set for accessibility.\n\t\twidth: maxWidth,\n\t\toverflow: 'hidden',\n\t\ttextOverflow: 'ellipsis',\n\t\twhiteSpace: 'nowrap',\n\t\tcursor: 'default',\n\t\tpointerEvents: 'auto',\n\t};\n\n\treturn (\n\t\t<foreignObject x={ x + xOffset } y={ y } width={ maxWidth } height={ 0 } overflow=\"visible\">\n\t\t\t<div style={ textStyles } title={ formattedValue }>\n\t\t\t\t{ formattedValue }\n\t\t\t</div>\n\t\t</foreignObject>\n\t);\n};\n\n/**\n * Factory function to create a truncated tick component for a specific axis.\n * Returns a component that can be passed to visx's tickComponent prop.\n *\n * @param axis - The axis this tick component is for ('x' or 'y')\n * @return A tick component function compatible with visx's TickRendererProps\n */\nconst createTruncatedTickComponent = ( axis: 'x' | 'y' ) => ( props: TickRendererProps ) => {\n\treturn <TruncatedTickComponent { ...props } axis={ axis } />;\n};\n\n/**\n * Pre-created tick components for x and y axes.\n * These functions are created once at module initialization and reused,\n * avoiding repeated factory calls when configuring axes.\n */\nexport const TruncatedXTickComponent = createTruncatedTickComponent( 'x' );\nexport const TruncatedYTickComponent = createTruncatedTickComponent( 'y' );\n","import { formatNumberCompact } from '@automattic/number-formatters';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useMemo } from 'react';\nimport { useDeepMemo } from '../../../hooks';\nimport { getBandTickValues, getBucketResolution, getFormatter } from '../../private/time-axis';\nimport { TruncatedXTickComponent, TruncatedYTickComponent } from './truncated-tick-component';\nimport type { EnhancedDataPoint } from '../../../hooks/use-zero-value-display';\nimport type { DataPointDate, BaseChartProps, SeriesData, TickResolution } from '../../../types';\nimport type { TickFormatter } from '@visx/axis';\n\n/** Outer padding of the category band scale (space at the chart edges). */\nexport const BASE_BAND_PADDING = 0.2;\n/** Inner padding of the category band scale (the base gap between ticks). */\nexport const BASE_BAND_PADDING_INNER = 0.1;\n/** Ticks each axis carries unless the caller asks for a different count. */\nconst DEFAULT_NUM_TICKS = 4;\n\n// A stable reference for callers that hide no series, so the memos below hold.\nconst ALL_RENDERED = () => true;\n\n// The axis abbreviates to fit a tick; a tooltip has room to spell the same\n// bucket out in full.\nconst TOOLTIP_FORMAT_BY_RESOLUTION: Record<\n\tExclude< TickResolution, 'week' >,\n\tIntl.DateTimeFormatOptions\n> = {\n\thour: { year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', hour12: true },\n\tday: { year: 'numeric', month: 'long', day: 'numeric' },\n\tmonth: { year: 'numeric', month: 'long' },\n\tyear: { year: 'numeric' },\n};\n\n/**\n * Labels one bar's bucket, at the bucket's own granularity — finer than the\n * ticks whenever the overall time span coarsens the axis.\n *\n * @param data - Date-based series, already parsed and sorted by `useChartDataTransform`.\n * @param tickResolution - Caller-declared bucket resolution, when known.\n * @return Tooltip label formatter.\n */\nconst getTooltipFormatter = ( data: SeriesData[], tickResolution?: TickResolution ) => {\n\t// Only a declared 'week' reaches this branch: seven-day spacing is\n\t// indistinguishable from sparse daily data, so inference reports 'day'.\n\tif ( tickResolution === 'week' ) {\n\t\treturn ( timestamp: number ) =>\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s is the first day of the week the bar covers. */\n\t\t\t\t__( 'Week of %s', 'jetpack-charts' ),\n\t\t\t\tnew Date( timestamp ).toLocaleDateString( undefined, {\n\t\t\t\t\tyear: 'numeric',\n\t\t\t\t\tmonth: 'long',\n\t\t\t\t\tday: 'numeric',\n\t\t\t\t} )\n\t\t\t);\n\t}\n\n\t// Fall back to the day format rather than `undefined` options, which would\n\t// print a full locale date-time for an unrecognised `tickResolution`.\n\tconst format =\n\t\tTOOLTIP_FORMAT_BY_RESOLUTION[ getBucketResolution( data, tickResolution ) ] ??\n\t\tTOOLTIP_FORMAT_BY_RESOLUTION.day;\n\n\treturn ( timestamp: number ) => new Date( timestamp ).toLocaleString( undefined, format );\n};\n\nconst identity = ( label: string ) => label;\n\n// `hasLabels` only samples the first point of the first series, so a labelled\n// bucket can still reach a formatter that was chosen for timestamps. It arrives\n// as its own string; only a dated bucket has a timestamp to format.\nconst byBucket =\n\t( format: ( timestamp: number ) => string ) => ( bucket: Date | string | number ) =>\n\t\ttypeof bucket === 'string' ? bucket : format( Number( bucket ) );\n\n// Shared with the domain below so both read a bucket the same way.\nconst bucketAccessor = ( d: DataPointDate ) => d?.label || d?.date;\n\n/**\n * The buckets the band axis can put a tick on.\n *\n * Built from the accessor visx is given, over the same series in the same order,\n * so that a tick value is a key the scale actually holds; `scaleBand` returns\n * `undefined` for one it does not, which parks the tick at the origin. Null\n * rather than a partial list when any bucket is labelled instead of dated.\n *\n * @param data - Every series handed to the chart.\n * @param isSeriesRendered - Whether visx mounts a series, i.e. the legend shows it.\n * @return Bucket dates in axis order, or null if the axis cannot be ticked by date.\n */\nconst getBandDomain = (\n\tdata: SeriesData[],\n\tisSeriesRendered: ( series: SeriesData ) => boolean\n): Date[] | null => {\n\t// visx keys its data registry on the series label and reads it back with\n\t// `Object.keys`, so a plain object reproduces both of the things that follow\n\t// from that: two series sharing a label collapse to the later one, and an\n\t// integer-like label sorts ahead of the rest whatever order it arrived in.\n\tconst registry: Record< string, SeriesData > = {};\n\n\tfor ( const series of data ) {\n\t\t// Comparison series register nothing with visx — `comparison-bars.tsx` draws\n\t\t// onto the scales the primary series established — and a hidden series is\n\t\t// unmounted, so neither contributes a key to the band scale.\n\t\tif ( series.options?.type === 'comparison' || ! isSeriesRendered( series ) ) {\n\t\t\tcontinue;\n\t\t}\n\t\tregistry[ series.label ] = series;\n\t}\n\n\tconst byTimestamp = new Map< number, Date >();\n\n\tfor ( const key of Object.keys( registry ) ) {\n\t\tfor ( const point of registry[ key ].data ) {\n\t\t\tconst bucket = bucketAccessor( point as DataPointDate );\n\t\t\tif ( ! ( bucket instanceof Date ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tif ( ! byTimestamp.has( bucket.getTime() ) ) {\n\t\t\t\tbyTimestamp.set( bucket.getTime(), bucket );\n\t\t\t}\n\t\t}\n\t}\n\n\treturn byTimestamp.size ? [ ...byTimestamp.values() ] : null;\n};\n\n/**\n * Get the group padding of a scale.\n *\n * @param scale - The scale to get the group padding of.\n * @return The group padding of the scale.\n */\nconst getGroupPadding = ( scale: Record< string, unknown > ): number => {\n\treturn typeof scale.paddingInner === 'number' ? ( scale.paddingInner as number ) : 0;\n};\n\n/**\n * Returns the merged options for the bar chart, including axis and scale configuration based on the orientation.\n *\n * @param data - The data to be displayed in the chart.\n * @param horizontal - Whether the chart is horizontal or vertical.\n * @param options - The options for the chart.\n * @param isSeriesRendered - Whether visx mounts a series, i.e. the legend shows it.\n * @return The merged options for the chart.\n */\nexport function useBarChartOptions(\n\tdata: SeriesData[],\n\thorizontal: boolean,\n\toptions: BaseChartProps[ 'options' ] = {},\n\tisSeriesRendered: ( series: SeriesData ) => boolean = ALL_RENDERED\n) {\n\t// Callers reasonably pass an object literal, which is a fresh reference every\n\t// render and would defeat every memo below.\n\tconst stableOptions = useDeepMemo( options );\n\n\t// `labelOverflow` and `tickResolution` are consumed by this hook rather than\n\t// forwarded — visx has an axis prop for neither — so they are split off the\n\t// caller's axis options once, here, and only the rest reaches visx below.\n\tconst axisConfig = useMemo( () => {\n\t\tconst {\n\t\t\tlabelOverflow: xLabelOverflow,\n\t\t\ttickResolution: xTickResolution,\n\t\t\t...xAxisOptions\n\t\t} = stableOptions.axis?.x || {};\n\t\tconst {\n\t\t\tlabelOverflow: yLabelOverflow,\n\t\t\ttickResolution: yTickResolution,\n\t\t\t...yAxisOptions\n\t\t} = stableOptions.axis?.y || {};\n\n\t\treturn {\n\t\t\txLabelOverflow,\n\t\t\tyLabelOverflow,\n\t\t\txAxisOptions,\n\t\t\tyAxisOptions,\n\t\t\t// The dates sit on the x axis normally, and on the y axis when the\n\t\t\t// chart is horizontal, so the hint follows them.\n\t\t\ttickResolution: horizontal ? yTickResolution : xTickResolution,\n\t\t};\n\t}, [ stableOptions, horizontal ] );\n\tconst { tickResolution } = axisConfig;\n\n\tconst defaultOptions = useMemo( () => {\n\t\tconst bandScale = {\n\t\t\ttype: 'band' as const,\n\t\t\tpadding: BASE_BAND_PADDING,\n\t\t\tpaddingInner: BASE_BAND_PADDING_INNER,\n\t\t};\n\t\tconst linearScale = {\n\t\t\ttype: 'linear' as const,\n\t\t\tnice: true,\n\t\t\tzero: false,\n\t\t};\n\n\t\t// Ticks on a date-based series share the line/area charts' time-axis\n\t\t// formatter, which narrows with the overall span as well as the bucket\n\t\t// size; the tooltip stays at the bucket's own granularity.\n\t\tconst hasLabels = Boolean( data?.[ 0 ]?.data?.[ 0 ]?.label );\n\t\tconst timeTickFormatter = hasLabels ? null : getFormatter( data, tickResolution );\n\t\tconst labelFormatter = timeTickFormatter ? byBucket( timeTickFormatter ) : identity;\n\t\tconst tooltipDatumFormatter = hasLabels\n\t\t\t? labelFormatter\n\t\t\t: byBucket( getTooltipFormatter( data, tickResolution ) );\n\t\tconst valueFormatter = formatNumberCompact as TickFormatter< unknown >;\n\n\t\tconst bandDomain = timeTickFormatter ? getBandDomain( data, isSeriesRendered ) : null;\n\n\t\tconst valueAccessor = ( d: DataPointDate | EnhancedDataPoint ) => {\n\t\t\t// Use visualValue for bar rendering if available (for zero values), otherwise use value\n\t\t\tconst enhancedPoint = d as EnhancedDataPoint;\n\t\t\treturn enhancedPoint?.visualValue !== undefined ? enhancedPoint.visualValue : d?.value;\n\t\t};\n\n\t\treturn {\n\t\t\ttimeAxis: bandDomain &&\n\t\t\t\ttimeTickFormatter && {\n\t\t\t\t\tdomain: bandDomain,\n\t\t\t\t\ttickFormatter: timeTickFormatter,\n\t\t\t\t},\n\t\t\tvertical: {\n\t\t\t\txTickFormat: labelFormatter,\n\t\t\t\tyTickFormat: valueFormatter,\n\t\t\t\ttooltipLabelFormatter: tooltipDatumFormatter,\n\t\t\t\txAccessor: bucketAccessor,\n\t\t\t\tyAccessor: valueAccessor,\n\t\t\t\tgridVisibility: 'x',\n\t\t\t\txScale: bandScale,\n\t\t\t\tyScale: linearScale,\n\t\t\t},\n\t\t\thorizontal: {\n\t\t\t\txTickFormat: valueFormatter,\n\t\t\t\tyTickFormat: labelFormatter,\n\t\t\t\ttooltipLabelFormatter: tooltipDatumFormatter,\n\t\t\t\txAccessor: valueAccessor,\n\t\t\t\tyAccessor: bucketAccessor,\n\t\t\t\tgridVisibility: 'y',\n\t\t\t\txScale: linearScale,\n\t\t\t\tyScale: bandScale,\n\t\t\t},\n\t\t};\n\t}, [ data, tickResolution, isSeriesRendered ] );\n\n\treturn useMemo( () => {\n\t\tconst orientationKey = horizontal ? 'horizontal' : 'vertical';\n\t\tconst {\n\t\t\txTickFormat,\n\t\t\tyTickFormat,\n\t\t\ttooltipLabelFormatter: defaultTooltipLabelFormatter,\n\t\t\txAccessor,\n\t\t\tyAccessor,\n\t\t\tgridVisibility,\n\t\t\txScale: baseXScale,\n\t\t\tyScale: baseYScale,\n\t\t} = defaultOptions[ orientationKey ];\n\n\t\t// When comparison series are present, visx only sees primary BarSeries and computes\n\t\t// a too-narrow domain. Compute an explicit domain spanning all series so comparison\n\t\t// shadows aren't clipped. Skip when the user has already provided an explicit domain.\n\t\tlet valueScaleDomainOverride: { domain?: [ number, number ] } = {};\n\t\tconst hasComparisonSeries = data.some( s => s.options?.type === 'comparison' );\n\t\tif ( hasComparisonSeries ) {\n\t\t\tconst valueAxisIsY = ! horizontal;\n\t\t\tconst userDomain = valueAxisIsY ? stableOptions.yScale?.domain : stableOptions.xScale?.domain;\n\t\t\tif ( ! userDomain ) {\n\t\t\t\tconst allValues: number[] = [];\n\t\t\t\tdata.forEach( series => {\n\t\t\t\t\tseries.data.forEach( d => {\n\t\t\t\t\t\tconst enhanced = d as { visualValue?: number };\n\t\t\t\t\t\tconst v =\n\t\t\t\t\t\t\tenhanced.visualValue !== undefined ? enhanced.visualValue : ( d.value as number );\n\t\t\t\t\t\tif ( typeof v === 'number' && Number.isFinite( v ) ) {\n\t\t\t\t\t\t\tallValues.push( v );\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t} );\n\t\t\t\tif ( allValues.length > 0 ) {\n\t\t\t\t\t// Keep zero in the domain so bar length stays proportional to value — a\n\t\t\t\t\t// non-zero baseline would exaggerate differences between periods. Math.max\n\t\t\t\t\t// keeps zero on the far side too, so charts with negative values still span 0.\n\t\t\t\t\tvalueScaleDomainOverride = {\n\t\t\t\t\t\tdomain: [ Math.min( 0, ...allValues ), Math.max( 0, ...allValues ) ],\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst xScale = {\n\t\t\t...baseXScale,\n\t\t\t...( stableOptions.xScale || {} ),\n\t\t\t...( horizontal ? valueScaleDomainOverride : {} ),\n\t\t};\n\t\tconst yScale = {\n\t\t\t...baseYScale,\n\t\t\t...( stableOptions.yScale || {} ),\n\t\t\t...( ! horizontal ? valueScaleDomainOverride : {} ),\n\t\t};\n\t\tconst { xLabelOverflow, yLabelOverflow, xAxisOptions, yAxisOptions } = axisConfig;\n\t\tconst providedToolTipLabelFormatter = horizontal\n\t\t\t? yAxisOptions.tickFormat\n\t\t\t: xAxisOptions.tickFormat;\n\n\t\t// A band scale has no ticks of its own for visx to ask for, so it samples\n\t\t// the domain by index and can miss the tick that dates the day or names the\n\t\t// year. Pick the values here instead. Only for our own formatter — a\n\t\t// caller's `tickFormat` may not be the one these values were chosen for.\n\t\tconst { timeAxis } = defaultOptions;\n\t\tconst dateAxisOptions = horizontal ? yAxisOptions : xAxisOptions;\n\t\tconst bandTickValues =\n\t\t\ttimeAxis && ! dateAxisOptions.tickFormat\n\t\t\t\t? getBandTickValues(\n\t\t\t\t\t\ttimeAxis.domain,\n\t\t\t\t\t\ttimeAxis.tickFormatter,\n\t\t\t\t\t\tdateAxisOptions.numTicks ?? DEFAULT_NUM_TICKS\n\t\t\t\t )\n\t\t\t\t: null;\n\t\tconst dateAxisTickValues = bandTickValues ? { tickValues: bandTickValues } : {};\n\n\t\treturn {\n\t\t\tgridVisibility,\n\t\t\txScale,\n\t\t\tyScale,\n\t\t\taccessors: {\n\t\t\t\txAccessor,\n\t\t\t\tyAccessor,\n\t\t\t},\n\t\t\taxis: {\n\t\t\t\tx: {\n\t\t\t\t\torientation: 'bottom' as const,\n\t\t\t\t\tnumTicks: DEFAULT_NUM_TICKS,\n\t\t\t\t\ttickFormat: xTickFormat,\n\t\t\t\t\t...( horizontal ? {} : dateAxisTickValues ),\n\t\t\t\t\t...( xLabelOverflow === 'ellipsis' ? { tickComponent: TruncatedXTickComponent } : {} ),\n\t\t\t\t\t...xAxisOptions,\n\t\t\t\t},\n\t\t\t\ty: {\n\t\t\t\t\torientation: 'left' as const,\n\t\t\t\t\tnumTicks: DEFAULT_NUM_TICKS,\n\t\t\t\t\ttickFormat: yTickFormat,\n\t\t\t\t\t...( horizontal ? dateAxisTickValues : {} ),\n\t\t\t\t\t...( yLabelOverflow === 'ellipsis' ? { tickComponent: TruncatedYTickComponent } : {} ),\n\t\t\t\t\t...yAxisOptions,\n\t\t\t\t},\n\t\t\t},\n\t\t\tbarGroup: {\n\t\t\t\tpadding: getGroupPadding( horizontal ? yScale : xScale ),\n\t\t\t},\n\t\t\ttooltip: {\n\t\t\t\tlabelFormatter: providedToolTipLabelFormatter || defaultTooltipLabelFormatter,\n\t\t\t},\n\t\t};\n\t}, [ defaultOptions, axisConfig, stableOptions, horizontal, data ] );\n}\n","export type ComparisonRect = { x: number; y: number; width: number; height: number };\n\ntype ValueScale = ( ( v: number ) => number ) & { range: () => unknown[] };\n\n/**\n * Output position of a value scale's baseline: zero if in-domain, else the\n * nearest range edge. Mirrors visx's getScaleBaseline so comparison shadows\n * sit on the same baseline as primary bars.\n *\n * @param {ValueScale} scale - The continuous value scale.\n * @return {number} The baseline output position in pixels.\n */\nexport function getValueScaleBaseline( scale: ValueScale ): number {\n\tconst [ a, b ] = scale.range().map( r => Number( r ) || 0 );\n\tconst isDescending = b < a;\n\tconst maybeZero = scale( 0 );\n\tconst [ minOutput, maxOutput ] = isDescending ? [ b, a ] : [ a, b ];\n\tif ( isDescending ) {\n\t\treturn Number.isFinite( maybeZero )\n\t\t\t? Math.min( Math.max( minOutput, maybeZero ), maxOutput )\n\t\t\t: maxOutput;\n\t}\n\treturn Number.isFinite( maybeZero )\n\t\t? Math.min( Math.max( maybeZero, minOutput ), maxOutput )\n\t\t: minOutput;\n}\n\n/**\n * Compute the rect for a comparison \"shadow\" bar, centered on the paired\n * primary bar slot and scaled by `widthFactor`.\n *\n * @param {object} params - Geometry inputs.\n * @param {boolean} params.horizontal - True for a horizontal bar chart, false for vertical.\n * @param {number} params.bandPosition - bandScale(category): start px of the category band.\n * @param {number} params.slotOffset - groupScale(primaryKey): offset of the primary slot within the band.\n * @param {number} params.slotThickness - groupScale.bandwidth(): primary bar thickness in px.\n * @param {number} params.valuePosition - valueScale(value): output px for the bar's data value.\n * @param {number} params.baseline - getValueScaleBaseline(valueScale): zero-line output px.\n * @param {number} params.widthFactor - Shadow thickness multiplier, e.g. 1.5 for 150% width.\n * @return {ComparisonRect} The {x, y, width, height} of the shadow rect.\n */\nexport function computeComparisonRect( params: {\n\thorizontal: boolean;\n\tbandPosition: number;\n\tslotOffset: number;\n\tslotThickness: number;\n\tvaluePosition: number;\n\tbaseline: number;\n\twidthFactor: number;\n} ): ComparisonRect {\n\tconst {\n\t\thorizontal,\n\t\tbandPosition,\n\t\tslotOffset,\n\t\tslotThickness,\n\t\tvaluePosition,\n\t\tbaseline,\n\t\twidthFactor,\n\t} = params;\n\tconst slotStart = bandPosition + slotOffset;\n\tconst shadowThickness = slotThickness * widthFactor;\n\tconst shadowStart = slotStart + slotThickness / 2 - shadowThickness / 2;\n\tconst valueStart = Math.min( valuePosition, baseline );\n\tconst valueLength = Math.abs( baseline - valuePosition );\n\n\tif ( horizontal ) {\n\t\treturn { x: valueStart, y: shadowStart, width: valueLength, height: shadowThickness };\n\t}\n\treturn { x: shadowStart, y: valueStart, width: shadowThickness, height: valueLength };\n}\n","// Shared comparison-mode tuning constants. These drive the geometry of the\n// translucent \"shadow\" bars and how the primary bars are narrowed to sit in front of them.\n\n/**\n * How much wider the comparison shadow is than the primary bar. Fallback used when the\n * theme value (`barChart.barStyles.comparison.widthFactor`) is absent. Also drives the\n * primary narrowing — the primary stays `1 / widthFactor` of the shadow.\n */\nexport const DEFAULT_COMPARISON_WIDTH_FACTOR = 1.5;\n\n/**\n * Opacity of the comparison shadow. Fallback used when the theme value\n * (`barChart.barStyles.comparison.opacity`) is absent.\n */\nexport const DEFAULT_COMPARISON_OPACITY = 0.5;\n\n/**\n * Fraction of each per-series step left as a gap between bars within a single tick.\n * Larger = more space between adjacent series; the shadow spans `1 - COMPARISON_INNER_GAP` of the step.\n */\nexport const COMPARISON_INNER_GAP = 0.1;\n\n/**\n * Upper clamp on the computed group padding, so bars can never collapse to zero width\n * even at very large `widthFactor` values.\n */\nexport const MAX_GROUP_PADDING = 0.9;\n\n/**\n * Factor applied to the category band's `paddingInner` in comparison mode to tighten the\n * gap between ticks. `0.75` = a 25% reduction of the tick-gap padding.\n */\nexport const COMPARISON_TICK_GAP_FACTOR = 0.75;\n","import { scaleBand } from '@visx/scale';\nimport { DataContext } from '@visx/xychart';\nimport { useContext } from 'react';\nimport { computeComparisonRect, getValueScaleBaseline } from './comparison-bars-geometry';\nimport {\n\tDEFAULT_COMPARISON_OPACITY,\n\tDEFAULT_COMPARISON_WIDTH_FACTOR,\n} from './comparison-constants';\nimport type { ElementStyles, GetElementStylesParams } from '../../../providers';\nimport type { DataPointDate, SeriesData } from '../../../types';\nimport type { FC, ReactNode } from 'react';\n\n/*\n * `process.env.NODE_ENV` is replaced by the bundler at build time. Declare a\n * minimal `process` locally so this file type-checks as source under `jetpack:src`.\n */\ndeclare const process: { env: Record< string, string | undefined > };\n\nexport type ComparisonSeriesEntry = {\n\tseries: SeriesData;\n\tindex: number;\n\tprimaryKey: string;\n\t/** dataSorted index of the paired primary series (used to share its pattern fill). */\n\tprimaryIndex: number;\n};\n\n// Minimal shape we need from visx scales — avoids spreading `any` while\n// remaining compatible with both band and continuous scale return types.\ntype AnyScale = ( ( input: unknown ) => number ) & {\n\tbandwidth?: () => number;\n\trange: () => unknown[];\n};\n\n// Renders translucent \"shadow\" bars for comparison series behind their paired primary bars.\n// IMPORTANT: each comparison datum's category key (label or date) must exactly match a key\n// used by the primary series — if it doesn't, bandScale() returns undefined and the shadow\n// is silently skipped. Ensure comparison data reuses the same label/date values as primary.\nexport const ComparisonBars: FC< {\n\tcomparisonEntries: ComparisonSeriesEntry[];\n\tprimaryKeys: string[];\n\tgroupPadding: number;\n\thorizontal: boolean;\n\txAccessor: ( d: DataPointDate ) => string | number | Date | undefined;\n\tyAccessor: ( d: DataPointDate ) => number | undefined;\n\tgetElementStyles: ( params: GetElementStylesParams ) => ElementStyles;\n\t/** Resolves the shadow fill — the paired primary's pattern when patterns are on, else a color. */\n\tresolveFill: ( entry: ComparisonSeriesEntry ) => string;\n} > = ( {\n\tcomparisonEntries,\n\tprimaryKeys,\n\tgroupPadding,\n\thorizontal,\n\txAccessor,\n\tyAccessor,\n\tgetElementStyles,\n\tresolveFill,\n} ) => {\n\tconst context = useContext( DataContext );\n\tconst xScale = context?.xScale as AnyScale | undefined;\n\tconst yScale = context?.yScale as AnyScale | undefined;\n\n\tif ( ! xScale || ! yScale || primaryKeys.length === 0 ) {\n\t\treturn null;\n\t}\n\n\t// Vertical: band axis is x, value axis is y. Horizontal: reversed.\n\tconst bandScale = ( horizontal ? yScale : xScale ) as AnyScale;\n\tconst valueScale = ( horizontal ? xScale : yScale ) as AnyScale;\n\n\tconst bandwidth = bandScale.bandwidth ? bandScale.bandwidth() : 0;\n\tif ( ! bandwidth ) {\n\t\treturn null;\n\t}\n\n\t// Rebuild visx's inner group scale exactly as BarGroup does.\n\tconst groupScale = scaleBand( {\n\t\tdomain: primaryKeys,\n\t\trange: [ 0, bandwidth ],\n\t\tpadding: groupPadding,\n\t} );\n\tconst slotThickness = groupScale.bandwidth();\n\tconst baseline = getValueScaleBaseline( valueScale );\n\n\t// Vertical uses xAccessor for category label; horizontal uses yAccessor.\n\tconst bandAccessor = horizontal ? yAccessor : xAccessor;\n\tconst valueAccessor = horizontal ? xAccessor : yAccessor;\n\n\tconst rects: ReactNode[] = [];\n\n\tcomparisonEntries.forEach( entry => {\n\t\tconst { series, index, primaryKey } = entry;\n\t\tconst slotOffset = groupScale( primaryKey );\n\t\tif ( slotOffset == null || ! Number.isFinite( slotOffset ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { barStyles } = getElementStyles( { data: series, index } );\n\t\tconst opacity = barStyles?.opacity ?? DEFAULT_COMPARISON_OPACITY; // safety net; CompleteChartTheme guarantees this value\n\t\tconst widthFactor = barStyles?.widthFactor ?? DEFAULT_COMPARISON_WIDTH_FACTOR;\n\t\t// Fill is the paired primary's pattern (when patterns are on) or its resolved color.\n\t\tconst fill = resolveFill( entry );\n\t\t// The shadow is `widthFactor` × the (narrowed) primary slot. bar-chart.tsx narrows the\n\t\t// primary bars by widening the group padding so this ratio holds with real geometry.\n\n\t\t( series.data as DataPointDate[] ).forEach( ( datum, i ) => {\n\t\t\tconst bandPosition = Number( bandScale( bandAccessor( datum ) as never ) );\n\t\t\tconst valuePosition = Number( valueScale( Number( valueAccessor( datum ) ) as never ) );\n\n\t\t\tif ( ! Number.isFinite( bandPosition ) || ! Number.isFinite( valuePosition ) ) {\n\t\t\t\tif ( process.env.NODE_ENV !== 'production' && ! Number.isFinite( bandPosition ) ) {\n\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`[Charts] ComparisonBars: datum key \"${ String(\n\t\t\t\t\t\t\tbandAccessor( datum )\n\t\t\t\t\t\t) }\" did not match any primary category. Shadow will not be rendered. ` +\n\t\t\t\t\t\t\t'Ensure comparison series data uses the same label/date keys as the primary series.'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst rect = computeComparisonRect( {\n\t\t\t\thorizontal,\n\t\t\t\tbandPosition,\n\t\t\t\tslotOffset: slotOffset as number,\n\t\t\t\tslotThickness,\n\t\t\t\tvaluePosition,\n\t\t\t\tbaseline,\n\t\t\t\twidthFactor,\n\t\t\t} );\n\n\t\t\trects.push(\n\t\t\t\t<rect\n\t\t\t\t\tkey={ `${ index }-${ i }` }\n\t\t\t\t\tdata-testid={ `bar-chart-comparison-${ index }-${ i }` }\n\t\t\t\t\tx={ rect.x }\n\t\t\t\t\ty={ rect.y }\n\t\t\t\t\twidth={ rect.width }\n\t\t\t\t\theight={ rect.height }\n\t\t\t\t\tfill={ fill }\n\t\t\t\t\topacity={ opacity }\n\t\t\t\t/>\n\t\t\t);\n\t\t} );\n\t} );\n\n\tif ( rects.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<g\n\t\t\tclassName=\"bar-chart__comparison-bars\"\n\t\t\tpointerEvents=\"none\"\n\t\t\taria-hidden=\"true\"\n\t\t\tdata-testid=\"bar-chart-comparison-bars\"\n\t\t>\n\t\t\t{ rects }\n\t\t</g>\n\t);\n};\n","import { formatNumber } from '@automattic/number-formatters';\nimport { PatternLines, PatternCircles, PatternWaves, PatternHexagons } from '@visx/pattern';\nimport { Axis, BarSeries, BarGroup, Grid, XYChart } from '@visx/xychart';\nimport { __, sprintf } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport { useCallback, useContext, useState, useRef, useMemo } from 'react';\nimport { Legend, useChartLegendItems } from '../../components/legend';\nimport { AccessibleTooltip, useKeyboardNavigation } from '../../components/tooltip';\nimport {\n\tuseXYChartTheme,\n\tuseChartDataTransform,\n\tuseZeroValueDisplay,\n\tuseChartMargin,\n\tusePrefersReducedMotion,\n} from '../../hooks';\nimport {\n\tGlobalChartsProvider,\n\tuseChartId,\n\tuseChartRegistration,\n\tuseGlobalChartsContext,\n\tGlobalChartsContext,\n} from '../../providers';\nimport { useDefaultHiddenSeries } from '../../providers/chart-context/hooks/use-default-hidden-series';\nimport { attachSubComponents } from '../../utils';\nimport { useChartChildren } from '../private/chart-composition';\nimport { ChartInstanceContext } from '../private/chart-instance-context';\nimport { ChartLayout } from '../private/chart-layout';\nimport { getAllHiddenMessage, SvgEmptyState } from '../private/svg-empty-state';\nimport { withResponsive } from '../private/with-responsive';\nimport styles from './bar-chart.module.scss';\nimport {\n\tuseBarChartOptions,\n\tComparisonBars,\n\tDEFAULT_COMPARISON_WIDTH_FACTOR,\n\tCOMPARISON_INNER_GAP,\n\tMAX_GROUP_PADDING,\n\tCOMPARISON_TICK_GAP_FACTOR,\n\tBASE_BAND_PADDING_INNER,\n} from './private';\nimport type { ComparisonSeriesEntry } from './private';\nimport type {\n\tBaseChartProps,\n\tDataPointDate,\n\tSeriesData,\n\tSeriesChartLegendConfig,\n\tSeriesVisibilityProps,\n\tOptional,\n} from '../../types';\nimport type { RenderTooltipParams } from '../../visx/types';\nimport type { ResponsiveConfig } from '../private/with-responsive';\nimport type { FC, ReactNode, ComponentType } from 'react';\n\nexport interface BarChartProps extends BaseChartProps< SeriesData[] >, SeriesVisibilityProps {\n\t/**\n\t * Legend configuration. Supports `collapseGroups` on top of the shared options.\n\t */\n\tlegend?: SeriesChartLegendConfig;\n\trenderTooltip?: ( params: RenderTooltipParams< DataPointDate > ) => ReactNode;\n\torientation?: 'horizontal' | 'vertical';\n\twithPatterns?: boolean;\n\tshowZeroValues?: boolean;\n\tchildren?: ReactNode;\n}\n\n// Base props type with optional responsive properties\ntype BarChartBaseProps = Optional< BarChartProps, 'width' | 'height' | 'size' >;\n\n// Composition API types\ninterface BarChartSubComponents {\n\tLegend: ComponentType< React.ComponentProps< typeof Legend > >;\n}\n\ntype BarChartComponent = FC< BarChartBaseProps > & BarChartSubComponents;\ntype BarChartResponsiveComponent = FC< BarChartBaseProps & ResponsiveConfig > &\n\tBarChartSubComponents;\n\n// Validation function similar to LineChart\nconst validateData = ( data: SeriesData[] ) => {\n\tif ( ! data?.length ) return 'No data available';\n\n\tconst hasInvalidData = data.some( series =>\n\t\tseries.data.some(\n\t\t\tpoint =>\n\t\t\t\tisNaN( point.value as number ) ||\n\t\t\t\tpoint.value === null ||\n\t\t\t\tpoint.value === undefined ||\n\t\t\t\t( ! point.label &&\n\t\t\t\t\t( ! ( 'date' in point && point.date ) || isNaN( point.date.getTime() ) ) )\n\t\t)\n\t);\n\n\tif ( hasInvalidData ) return 'Invalid data';\n\treturn null;\n};\n\nconst getPatternId = ( chartId: string, index: number ) => `bar-pattern-${ chartId }-${ index }`;\n\n// A \"label: value\" tooltip row. The join is a translated format string so the\n// separator (a colon + space here) can be adapted per locale.\nconst renderTooltipRow = ( label: string | undefined, value: string ) => (\n\t<div className={ styles[ 'bar-chart__tooltip-row' ] }>\n\t\t{ sprintf(\n\t\t\t/* translators: 1: data series, period, or category label. 2: its formatted value. */\n\t\t\t__( '%1$s: %2$s', 'jetpack-charts' ),\n\t\t\tlabel,\n\t\t\tvalue\n\t\t) }\n\t</div>\n);\n\nconst BarChartInternal: FC< BarChartProps > = ( {\n\tdata,\n\tchartId: providedChartId,\n\twidth,\n\theight,\n\tclassName,\n\tmargin,\n\twithTooltips = false,\n\tshowLegend = false,\n\tlegend = {},\n\tgridVisibility: gridVisibilityProp,\n\trenderTooltip,\n\toptions = {},\n\torientation = 'vertical',\n\twithPatterns = false,\n\tshowZeroValues = false,\n\tdefaultHiddenSeries,\n\tanimation,\n\tchildren,\n\tgap = 'md',\n} ) => {\n\tconst legendInteractive = legend.interactive ?? false;\n\tconst legendCollapseGroups = legend.collapseGroups ?? false;\n\tconst horizontal = orientation === 'horizontal';\n\tconst chartId = useChartId( providedChartId );\n\tconst hiddenSeries = useDefaultHiddenSeries( chartId, defaultHiddenSeries );\n\tconst isSeriesVisible = useCallback(\n\t\t( seriesLabel: string ) => ! hiddenSeries.has( seriesLabel ),\n\t\t[ hiddenSeries ]\n\t);\n\tconst theme = useXYChartTheme( data );\n\n\tconst dataSorted = useChartDataTransform( data );\n\n\t// Transform data to add a small value for zero bars to make them visible\n\t// For vertical bars, height determines bar pixel height; for horizontal bars, width does\n\tconst dataWithVisibleZeros = useZeroValueDisplay( dataSorted, {\n\t\tenabled: showZeroValues,\n\t\tvalueAxisLength: horizontal ? width : height,\n\t} );\n\n\t// Create legend items using the reusable hook\n\tconst legendOptions = useMemo(\n\t\t() => ( { collapseGroups: legendCollapseGroups } ),\n\t\t[ legendCollapseGroups ]\n\t);\n\tconst legendItems = useChartLegendItems( dataSorted, legendOptions );\n\n\tconst { getElementStyles } = useGlobalChartsContext();\n\n\t// A hidden series is unmounted, so it is not on the band scale either — the\n\t// axis has to choose its tick values from what is left. Visibility is owned by\n\t// the provider, whether it changed through the legend or programmatically.\n\tconst isSeriesRendered = useCallback(\n\t\t( series: SeriesData ) => isSeriesVisible( series.label ),\n\t\t[ isSeriesVisible ]\n\t);\n\n\tconst chartOptions = useBarChartOptions(\n\t\tdataWithVisibleZeros,\n\t\thorizontal,\n\t\toptions,\n\t\tisSeriesRendered\n\t);\n\tconst defaultMargin = useChartMargin( height, chartOptions, dataSorted, theme, horizontal );\n\tconst chartRef = useRef< HTMLDivElement >( null );\n\n\t// Process children for composition API (Legend, etc.)\n\tconst { legendChildren, nonLegendChildren } = useChartChildren( children, 'BarChart' );\n\tconst [ measuredChartHeight, setMeasuredChartHeight ] = useState< number | undefined >();\n\n\tconst handleContentHeightChange = useCallback(\n\t\t( contentHeight: number ) => {\n\t\t\tconst chartHeight = contentHeight > 0 ? contentHeight : height;\n\t\t\tsetMeasuredChartHeight( chartHeight );\n\t\t},\n\t\t[ height ]\n\t);\n\tconst [ selectedIndex, setSelectedIndex ] = useState< number | undefined >( undefined );\n\tconst [ isNavigating, setIsNavigating ] = useState( false );\n\n\t// Comparison series have no .visx-bar elements; count only primary series so\n\t// keyboard navigation doesn't cycle phantom indices into comparison-only slots.\n\tconst primarySeriesForNav = dataWithVisibleZeros.filter( s => s.options?.type !== 'comparison' );\n\tconst totalPoints =\n\t\tMath.max( 0, ...primarySeriesForNav.map( s => s.data?.length || 0 ) ) *\n\t\tprimarySeriesForNav.length;\n\n\t// Use the keyboard navigation hook\n\tconst { tooltipRef, onChartFocus, onChartBlur, onChartKeyDown } = useKeyboardNavigation( {\n\t\tselectedIndex,\n\t\tsetSelectedIndex,\n\t\tisNavigating,\n\t\tsetIsNavigating,\n\t\tchartRef,\n\t\ttotalPoints,\n\t} );\n\n\t// Add visibility information from the shared legend state.\n\tconst seriesWithVisibility = useMemo(\n\t\t() =>\n\t\t\tdataWithVisibleZeros.map( ( series, index ) => ( {\n\t\t\t\tseries,\n\t\t\t\tindex,\n\t\t\t\tisVisible: isSeriesRendered( series ),\n\t\t\t} ) ),\n\t\t[ dataWithVisibleZeros, isSeriesRendered ]\n\t);\n\n\t// Check if all series are hidden\n\tconst allSeriesHidden = useMemo( () => {\n\t\treturn seriesWithVisibility.every( ( { isVisible } ) => ! isVisible );\n\t}, [ seriesWithVisibility ] );\n\n\t// Derive primary vs comparison entries for comparison mode support.\n\tconst primaryEntries = useMemo(\n\t\t() =>\n\t\t\tseriesWithVisibility.filter(\n\t\t\t\t( { isVisible, series } ) => isVisible && series.options?.type !== 'comparison'\n\t\t\t),\n\t\t[ seriesWithVisibility ]\n\t);\n\n\tconst primaryKeys = useMemo(\n\t\t() => primaryEntries.map( ( { series } ) => series.label ),\n\t\t[ primaryEntries ]\n\t);\n\n\t// The keyboard-navigation index space and the highlight CSS both stride over primary\n\t// bars only; the accessible tooltip must use the same list, or its datum diverges from\n\t// the highlighted bar once a comparison series shifts the indices.\n\tconst primarySeries = useMemo(\n\t\t() => primaryEntries.map( ( { series } ) => series ),\n\t\t[ primaryEntries ]\n\t);\n\n\tconst comparisonEntries = useMemo( () => {\n\t\tconst primaryByGroup = new Map< string | undefined, { label: string; index: number } >(\n\t\t\tprimaryEntries.map( ( { series, index } ) => [\n\t\t\t\tseries.group,\n\t\t\t\t{ label: series.label, index },\n\t\t\t] )\n\t\t);\n\n\t\tconst entries: ComparisonSeriesEntry[] = [];\n\t\tseriesWithVisibility.forEach( ( { series, index, isVisible } ) => {\n\t\t\tif ( ! isVisible || series.options?.type !== 'comparison' ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst primary =\n\t\t\t\tprimaryByGroup.get( series.group ) ??\n\t\t\t\t( primaryEntries.length === 1\n\t\t\t\t\t? { label: primaryEntries[ 0 ].series.label, index: primaryEntries[ 0 ].index }\n\t\t\t\t\t: undefined );\n\t\t\tif ( ! primary || ! primaryKeys.includes( primary.label ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tentries.push( { series, index, primaryKey: primary.label, primaryIndex: primary.index } );\n\t\t} );\n\t\treturn entries;\n\t}, [ seriesWithVisibility, primaryEntries, primaryKeys ] );\n\n\t// Comparison widthFactor (how much wider the shadow is than the primary) drives both the\n\t// shadow width (in ComparisonBars) and the primary narrowing.\n\tconst comparisonWidthFactor = useMemo( () => {\n\t\tif ( comparisonEntries.length === 0 ) return undefined;\n\t\treturn (\n\t\t\tgetElementStyles( {\n\t\t\t\tdata: comparisonEntries[ 0 ].series,\n\t\t\t\tindex: comparisonEntries[ 0 ].index,\n\t\t\t} ).barStyles?.widthFactor ?? DEFAULT_COMPARISON_WIDTH_FACTOR\n\t\t);\n\t}, [ comparisonEntries, getElementStyles ] );\n\n\t// Narrow the primary bars by widening the visx group padding — a real geometry change, so\n\t// pattern fills and borders are not distorted (unlike a CSS transform/scale). The padding is\n\t// set so the comparison shadow (drawn at slot × widthFactor) fills all but a small gap of each\n\t// per-series step, leaving a small gap between series within a tick (the larger gap between\n\t// ticks comes from the category band's own padding). Because shadow = step × (1 - p) ×\n\t// widthFactor, choosing p = 1 - (1 - innerGap)/widthFactor makes the shadow span (1 - innerGap)\n\t// of the step; the primary stays 1/widthFactor of the shadow.\n\tconst groupPadding = useMemo( () => {\n\t\tconst basePadding = chartOptions.barGroup.padding;\n\t\tif ( ! comparisonWidthFactor || comparisonWidthFactor <= 1 ) {\n\t\t\treturn basePadding;\n\t\t}\n\t\tconst p = 1 - ( 1 - COMPARISON_INNER_GAP ) / comparisonWidthFactor;\n\t\treturn Math.min( Math.max( p, basePadding ), MAX_GROUP_PADDING );\n\t}, [ chartOptions.barGroup.padding, comparisonWidthFactor ] );\n\n\t// In comparison mode, tighten the gap between ticks by reducing the category band's inner\n\t// padding (the value axis is left untouched). COMPARISON_TICK_GAP_FACTOR is the multiplier.\n\tconst { xScale, yScale } = useMemo( () => {\n\t\tif ( comparisonEntries.length === 0 ) {\n\t\t\treturn { xScale: chartOptions.xScale, yScale: chartOptions.yScale };\n\t\t}\n\t\tconst tighten = < T extends object >( scale: T ): T =>\n\t\t\t( {\n\t\t\t\t...scale,\n\t\t\t\tpaddingInner:\n\t\t\t\t\t( ( scale as { paddingInner?: number } ).paddingInner ?? BASE_BAND_PADDING_INNER ) *\n\t\t\t\t\tCOMPARISON_TICK_GAP_FACTOR,\n\t\t\t} ) as T;\n\t\treturn horizontal\n\t\t\t? { xScale: chartOptions.xScale, yScale: tighten( chartOptions.yScale ) }\n\t\t\t: { xScale: tighten( chartOptions.xScale ), yScale: chartOptions.yScale };\n\t}, [ comparisonEntries.length, chartOptions.xScale, chartOptions.yScale, horizontal ] );\n\n\tconst getBarBackground = useCallback(\n\t\t( index: number ) => () =>\n\t\t\twithPatterns\n\t\t\t\t? `url(#${ getPatternId( chartId, index ) })`\n\t\t\t\t: getElementStyles( { data: dataSorted[ index ], index } ).color,\n\t\t[ withPatterns, getElementStyles, dataSorted, chartId ]\n\t);\n\n\t// Comparison shadow fill: when patterns are on, reuse the paired primary's pattern so the\n\t// shadow reads as the same series; otherwise use the comparison series' resolved color.\n\tconst resolveComparisonFill = useCallback(\n\t\t( entry: ComparisonSeriesEntry ) =>\n\t\t\twithPatterns\n\t\t\t\t? `url(#${ getPatternId( chartId, entry.primaryIndex ) })`\n\t\t\t\t: getElementStyles( { data: entry.series, index: entry.index } ).color,\n\t\t[ withPatterns, chartId, getElementStyles ]\n\t);\n\n\tconst renderDefaultTooltip = useCallback(\n\t\t( { tooltipData }: RenderTooltipParams< DataPointDate > ) => {\n\t\t\tconst nearestDatum = tooltipData?.nearestDatum?.datum;\n\t\t\tif ( ! nearestDatum ) return null;\n\n\t\t\tconst primaryKey = tooltipData?.nearestDatum?.key;\n\t\t\tconst categoryLabel = chartOptions.tooltip.labelFormatter(\n\t\t\t\tnearestDatum.label || ( nearestDatum.date ? nearestDatum.date.getTime() : 0 ),\n\t\t\t\t0,\n\t\t\t\t[]\n\t\t\t);\n\n\t\t\t// Find the comparison value paired with the hovered primary series (same group)\n\t\t\t// at the same category, so the tooltip can show both periods at once.\n\t\t\tconst comparisonEntry = comparisonEntries.find( entry => entry.primaryKey === primaryKey );\n\t\t\tconst comparisonDatum = comparisonEntry?.series.data.find( point => {\n\t\t\t\tconst p = point as DataPointDate;\n\t\t\t\treturn nearestDatum.label != null\n\t\t\t\t\t? p.label === nearestDatum.label\n\t\t\t\t\t: !! nearestDatum.date && !! p.date && p.date.getTime() === nearestDatum.date.getTime();\n\t\t\t} ) as DataPointDate | undefined;\n\n\t\t\t// With a paired comparison value, show the category as the header and one row\n\t\t\t// per period (primary + comparison).\n\t\t\tif ( comparisonEntry && comparisonDatum && comparisonDatum.value != null ) {\n\t\t\t\treturn (\n\t\t\t\t\t<div className={ styles[ 'bar-chart__tooltip' ] }>\n\t\t\t\t\t\t<div className={ styles[ 'bar-chart__tooltip-header' ] }>{ categoryLabel }</div>\n\t\t\t\t\t\t{ renderTooltipRow( primaryKey, formatNumber( nearestDatum.value as number ) ) }\n\t\t\t\t\t\t{ renderTooltipRow(\n\t\t\t\t\t\t\tcomparisonEntry.series.label,\n\t\t\t\t\t\t\tformatNumber( comparisonDatum.value as number )\n\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<div className={ styles[ 'bar-chart__tooltip' ] }>\n\t\t\t\t\t<div className={ styles[ 'bar-chart__tooltip-header' ] }>{ primaryKey }</div>\n\t\t\t\t\t{ renderTooltipRow( categoryLabel, formatNumber( nearestDatum.value as number ) ) }\n\t\t\t\t</div>\n\t\t\t);\n\t\t},\n\t\t[ chartOptions.tooltip, comparisonEntries ]\n\t);\n\n\tconst renderPattern = useCallback(\n\t\t( index: number, color: string ) => {\n\t\t\tconst patternType = index % 4;\n\t\t\tconst id = getPatternId( chartId, index );\n\t\t\tconst commonProps = {\n\t\t\t\tid,\n\t\t\t\tstroke: 'white',\n\t\t\t\tstrokeWidth: 1,\n\t\t\t\tbackground: color,\n\t\t\t};\n\n\t\t\tswitch ( patternType ) {\n\t\t\t\tcase 0:\n\t\t\t\tdefault:\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<PatternLines\n\t\t\t\t\t\t\tkey={ id }\n\t\t\t\t\t\t\t{ ...commonProps }\n\t\t\t\t\t\t\twidth={ 5 }\n\t\t\t\t\t\t\theight={ 5 }\n\t\t\t\t\t\t\torientation={ [ 'diagonal' ] }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\tcase 1:\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<PatternCircles key={ id } { ...commonProps } width={ 6 } height={ 6 } fill=\"white\" />\n\t\t\t\t\t);\n\t\t\t\tcase 2:\n\t\t\t\t\treturn <PatternWaves key={ id } { ...commonProps } width={ 4 } height={ 4 } />;\n\t\t\t\tcase 3:\n\t\t\t\t\treturn <PatternHexagons key={ id } { ...commonProps } size={ 8 } height={ 3 } />;\n\t\t\t}\n\t\t},\n\t\t[ chartId ]\n\t);\n\n\tconst createPatternBorderStyle = useCallback(\n\t\t( index: number, color: string ) => {\n\t\t\tconst patternId = getPatternId( chartId, index );\n\t\t\t// Border the primary bars and any comparison shadow reusing the same pattern,\n\t\t\t// so a patterned shadow gets the same outline as its primary bar.\n\t\t\treturn `\n\t\t\t.visx-bar[fill=\"url(#${ patternId })\"],\n\t\t\t.bar-chart__comparison-bars rect[fill=\"url(#${ patternId })\"] {\n\t\t\t\tstroke: ${ color };\n\t\t\t\tstroke-width: 1;\n\t\t\t\t}\n\t\t\t`;\n\t\t},\n\t\t[ chartId ]\n\t);\n\n\tconst createKeyboardHighlightStyle = useCallback( () => {\n\t\tif ( selectedIndex === undefined ) return '';\n\n\t\t// Use only primary entries — comparison series have no .visx-bar elements so\n\t\t// their indices must not appear in the nth-child selector.\n\t\t// Pattern: [series1[0], series2[0], series3[0], series1[1], series2[1], series3[1], ...]\n\t\tconst primaryCount = primaryEntries.length;\n\t\tconst maxDataPoints = Math.max( ...primaryEntries.map( e => e.series.data.length ) );\n\t\tconst dataPointIndex = Math.floor( selectedIndex / primaryCount );\n\t\tconst seriesIndex = selectedIndex % primaryCount;\n\n\t\t// Only highlight if we're within valid bounds\n\t\tif ( dataPointIndex >= maxDataPoints || seriesIndex >= primaryCount ) {\n\t\t\treturn '';\n\t\t}\n\n\t\tconst seriesData = primaryEntries[ seriesIndex ]?.series;\n\t\tif ( ! seriesData || dataPointIndex >= seriesData.data.length ) {\n\t\t\treturn '';\n\t\t}\n\n\t\t// Based on the DOM structure analysis:\n\t\t// - All bars are in a single .visx-bar-group\n\t\t// - Bars are ordered as: [series1[0], series1[1], series2[0], series2[1], ...]\n\t\t// - So we need to calculate the actual bar index in the DOM\n\t\tconst actualBarIndex = seriesIndex * maxDataPoints + dataPointIndex;\n\n\t\t// Use a CSS class selector instead of ID since useId() generates invalid CSS ID characters\n\t\tconst generatedStyles = `\n\t\t\t.bar-chart[data-chart-id=\"bar-chart-${ chartId }\"] .visx-bar-group .visx-bar:nth-child(${\n\t\t\t\tactualBarIndex + 1\n\t\t\t}) {\n\t\t\t\tstroke: #005fcc;\n\t\t\t\tstroke-width: 2px;\n\t\t\t}\n\t\t`;\n\n\t\treturn generatedStyles;\n\t}, [ selectedIndex, primaryEntries, chartId ] );\n\n\t// Validate data first\n\tconst error = validateData( dataSorted );\n\tconst isDataValid = ! error;\n\n\t// Memoize metadata to prevent unnecessary re-registration\n\tconst chartMetadata = useMemo(\n\t\t() => ( {\n\t\t\torientation,\n\t\t\twithPatterns,\n\t\t} ),\n\t\t[ orientation, withPatterns ]\n\t);\n\n\t// Register chart with context only if data is valid\n\tuseChartRegistration( {\n\t\tchartId,\n\t\tlegendItems,\n\t\tchartType: 'bar',\n\t\tisDataValid,\n\t\tmetadata: chartMetadata,\n\t} );\n\n\tconst prefersReducedMotion = usePrefersReducedMotion();\n\n\tif ( error ) {\n\t\treturn <div className={ clsx( 'bar-chart', styles[ 'bar-chart' ] ) }>{ error }</div>;\n\t}\n\n\tconst gridVisibility = gridVisibilityProp ?? chartOptions.gridVisibility;\n\tconst highlightedBarStyle = createKeyboardHighlightStyle();\n\n\tconst legendPosition = legend.position ?? 'bottom';\n\tconst legendElement = showLegend && (\n\t\t<Legend\n\t\t\torientation={ legend.orientation ?? 'horizontal' }\n\t\t\tposition={ legendPosition }\n\t\t\talignment={ legend.alignment ?? 'center' }\n\t\t\tlabelStyles={ legend.labelStyles }\n\t\t\titemClassName={ legend.itemClassName }\n\t\t\titemStyles={ legend.itemStyles }\n\t\t\tshapeStyles={ legend.shapeStyles }\n\t\t\tclassName={ styles[ 'bar-chart__legend' ] }\n\t\t\tshape={ legend.shape ?? 'rect' }\n\t\t\tchartId={ chartId }\n\t\t\tinteractive={ legendInteractive }\n\t\t/>\n\t);\n\n\treturn (\n\t\t<ChartInstanceContext.Provider\n\t\t\tvalue={ {\n\t\t\t\tchartId,\n\t\t\t\tisSeriesVisible,\n\t\t\t\tchartWidth: width,\n\t\t\t\tchartHeight: measuredChartHeight || 0,\n\t\t\t} }\n\t\t>\n\t\t\t<ChartLayout\n\t\t\t\tlegendPosition={ legendPosition }\n\t\t\t\tlegendElement={ legendElement }\n\t\t\t\tlegendChildren={ legendChildren }\n\t\t\t\tgap={ gap }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'bar-chart',\n\t\t\t\t\tstyles[ 'bar-chart' ],\n\t\t\t\t\t{\n\t\t\t\t\t\t[ styles[ `bar-chart--animated${ horizontal ? '-horizontal' : '' }` ] ]:\n\t\t\t\t\t\t\tanimation && ! prefersReducedMotion,\n\t\t\t\t\t},\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tstyle={ { width, height } }\n\t\t\t\tdata-testid=\"bar-chart\"\n\t\t\t\tdata-chart-id={ `bar-chart-${ chartId }` }\n\t\t\t\ttrailingContent={ nonLegendChildren }\n\t\t\t\tonContentHeightChange={ handleContentHeightChange }\n\t\t\t>\n\t\t\t\t{ ( { contentHeight } ) => {\n\t\t\t\t\tconst chartHeight = contentHeight > 0 ? contentHeight : height;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\trole=\"grid\"\n\t\t\t\t\t\t\taria-label={ __( 'Bar chart', 'jetpack-charts' ) }\n\t\t\t\t\t\t\ttabIndex={ 0 }\n\t\t\t\t\t\t\tonKeyDown={ onChartKeyDown }\n\t\t\t\t\t\t\tonFocus={ onChartFocus }\n\t\t\t\t\t\t\tonBlur={ onChartBlur }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ chartHeight > 0 && (\n\t\t\t\t\t\t\t\t<div ref={ chartRef }>\n\t\t\t\t\t\t\t\t\t<XYChart\n\t\t\t\t\t\t\t\t\t\ttheme={ theme }\n\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\theight={ chartHeight }\n\t\t\t\t\t\t\t\t\t\tmargin={ {\n\t\t\t\t\t\t\t\t\t\t\t...defaultMargin,\n\t\t\t\t\t\t\t\t\t\t\t...margin,\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\txScale={ xScale }\n\t\t\t\t\t\t\t\t\t\tyScale={ yScale }\n\t\t\t\t\t\t\t\t\t\thorizontal={ horizontal }\n\t\t\t\t\t\t\t\t\t\tpointerEventsDataKey=\"nearest\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ ! allSeriesHidden && (\n\t\t\t\t\t\t\t\t\t\t\t<Grid\n\t\t\t\t\t\t\t\t\t\t\t\tcolumns={ gridVisibility.includes( 'y' ) }\n\t\t\t\t\t\t\t\t\t\t\t\trows={ gridVisibility.includes( 'x' ) }\n\t\t\t\t\t\t\t\t\t\t\t\tnumTicks={ 4 }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t\t{ withPatterns && (\n\t\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t\t<defs data-testid=\"bar-chart-patterns\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ dataSorted.map( ( seriesData, index ) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trenderPattern(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tgetElementStyles( { data: seriesData, index } ).color\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t</defs>\n\t\t\t\t\t\t\t\t\t\t\t\t<style>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ dataSorted.map( ( seriesData, index ) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcreatePatternBorderStyle(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tgetElementStyles( { data: seriesData, index } ).color\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t</style>\n\t\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t\t{ highlightedBarStyle && <style>{ highlightedBarStyle }</style> }\n\n\t\t\t\t\t\t\t\t\t\t{ allSeriesHidden ? (\n\t\t\t\t\t\t\t\t\t\t\t<SvgEmptyState\n\t\t\t\t\t\t\t\t\t\t\t\tx={ width / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\ty={ chartHeight / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\t\t\theight={ chartHeight }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ getAllHiddenMessage( legendInteractive, 'series' ) }\n\t\t\t\t\t\t\t\t\t\t\t</SvgEmptyState>\n\t\t\t\t\t\t\t\t\t\t) : null }\n\n\t\t\t\t\t\t\t\t\t\t<ComparisonBars\n\t\t\t\t\t\t\t\t\t\t\tcomparisonEntries={ comparisonEntries }\n\t\t\t\t\t\t\t\t\t\t\tprimaryKeys={ primaryKeys }\n\t\t\t\t\t\t\t\t\t\t\tgroupPadding={ groupPadding }\n\t\t\t\t\t\t\t\t\t\t\thorizontal={ horizontal }\n\t\t\t\t\t\t\t\t\t\t\txAccessor={ chartOptions.accessors.xAccessor }\n\t\t\t\t\t\t\t\t\t\t\tyAccessor={\n\t\t\t\t\t\t\t\t\t\t\t\tchartOptions.accessors.yAccessor as (\n\t\t\t\t\t\t\t\t\t\t\t\t\td: DataPointDate\n\t\t\t\t\t\t\t\t\t\t\t\t) => number | undefined\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tgetElementStyles={ getElementStyles }\n\t\t\t\t\t\t\t\t\t\t\tresolveFill={ resolveComparisonFill }\n\t\t\t\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t\t\t\t<BarGroup padding={ groupPadding }>\n\t\t\t\t\t\t\t\t\t\t\t{ primaryEntries.map( ( { series: seriesData, index } ) => (\n\t\t\t\t\t\t\t\t\t\t\t\t<BarSeries\n\t\t\t\t\t\t\t\t\t\t\t\t\tkey={ seriesData?.label }\n\t\t\t\t\t\t\t\t\t\t\t\t\tdataKey={ seriesData?.label }\n\t\t\t\t\t\t\t\t\t\t\t\t\tdata={ seriesData.data as DataPointDate[] }\n\t\t\t\t\t\t\t\t\t\t\t\t\tyAccessor={ chartOptions.accessors.yAccessor }\n\t\t\t\t\t\t\t\t\t\t\t\t\txAccessor={ chartOptions.accessors.xAccessor }\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolorAccessor={ getBarBackground( index ) }\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t\t\t\t</BarGroup>\n\n\t\t\t\t\t\t\t\t\t\t{ /* With every series hidden there is no data to build the value scale from, so\n\t\t\t\t\t\t\t\t\t\t visx collapses the domain and the axes render squished at the top. Drop them\n\t\t\t\t\t\t\t\t\t\t while the empty state stands in. */ }\n\t\t\t\t\t\t\t\t\t\t{ ! allSeriesHidden && (\n\t\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t\t<Axis { ...chartOptions.axis.x } />\n\t\t\t\t\t\t\t\t\t\t\t\t<Axis { ...chartOptions.axis.y } />\n\t\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t\t{ withTooltips && (\n\t\t\t\t\t\t\t\t\t\t\t<AccessibleTooltip\n\t\t\t\t\t\t\t\t\t\t\t\tdetectBounds\n\t\t\t\t\t\t\t\t\t\t\t\tsnapTooltipToDatumX\n\t\t\t\t\t\t\t\t\t\t\t\tsnapTooltipToDatumY\n\t\t\t\t\t\t\t\t\t\t\t\trenderTooltip={ renderTooltip || renderDefaultTooltip }\n\t\t\t\t\t\t\t\t\t\t\t\tselectedIndex={ selectedIndex }\n\t\t\t\t\t\t\t\t\t\t\t\ttooltipRef={ tooltipRef }\n\t\t\t\t\t\t\t\t\t\t\t\tkeyboardFocusedClassName={\n\t\t\t\t\t\t\t\t\t\t\t\t\tstyles[ 'bar-chart__tooltip--keyboard-focused' ]\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tseries={ primarySeries }\n\t\t\t\t\t\t\t\t\t\t\t\tmode=\"individual\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</XYChart>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t</ChartLayout>\n\t\t</ChartInstanceContext.Provider>\n\t);\n};\n\nconst BarChartWithProvider: FC< BarChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, don't create a new one\n\tif ( existingContext ) {\n\t\treturn <BarChartInternal { ...props } />;\n\t}\n\n\t// Otherwise, create our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<BarChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nBarChartWithProvider.displayName = 'BarChart';\n\n// Create BarChart with composition API\nconst BarChart = attachSubComponents( BarChartWithProvider, {\n\tLegend: Legend,\n} ) as BarChartComponent;\n\n// Create responsive BarChart with composition API\nconst BarChartResponsive = attachSubComponents(\n\twithResponsive< BarChartProps >( BarChartWithProvider ),\n\t{\n\t\tLegend: Legend,\n\t}\n) as BarChartResponsiveComponent;\n\nexport { BarChartResponsive as default, BarChart as BarChartUnresponsive };\n","import { formatNumberCompact } from '@automattic/number-formatters';\nimport { Group } from '@visx/group';\nimport { createScale, scaleBand } from '@visx/scale';\nimport { Text, type TextProps } from '@visx/text';\nimport { useContext, useMemo } from 'react';\nimport { GlobalChartsContext, GlobalChartsProvider } from '../../providers';\nimport { BarChartUnresponsive } from '../bar-chart';\nimport { withResponsive } from '../private/with-responsive';\nimport type { SeriesData } from '../..';\nimport type { ScaleOptions } from '../../types';\nimport type { BarChartProps } from '../bar-chart/bar-chart';\nimport type { AxisRendererProps, AxisScale } from '@visx/axis';\nimport type { AnyD3Scale } from '@visx/scale';\nimport type { ComponentType, FC } from 'react';\n\nexport interface BarListChartProps\n\textends Exclude< BarChartProps, 'orientation' | 'size' | 'gridVisibility' > {\n\toptions?: {\n\t\t/**\n\t\t * Scale for the y axis. Exclude the type property.\n\t\t */\n\t\tyScale: Omit< ScaleOptions, 'type' >;\n\t\t/**\n\t\t * Scale for the x axis. Exclude the type property.\n\t\t */\n\t\txScale: Omit< ScaleOptions, 'type' >;\n\t\t/**\n\t\t * Formatter for the label.\n\t\t */\n\t\tlabelFormatter?: ( value: string ) => string;\n\t\t/**\n\t\t * Formatter for the value.\n\t\t */\n\t\tvalueFormatter?: ( value: number ) => string;\n\t\t/**\n\t\t * y offset of the label and value. Default is based on the number of series, automatically computed.\n\t\t */\n\t\tyOffset?: number;\n\t\t/**\n\t\t * x position of the label.\n\t\t */\n\t\tlabelPosition?: number;\n\t\t/**\n\t\t * x position of the value.\n\t\t */\n\t\tvaluePosition?: number;\n\t\t/**\n\t\t * Custom render function for the label.\n\t\t */\n\t\tlabelComponent?: ComponentType< RenderLabelProps >;\n\t\t/**\n\t\t * Custom render function for the value.\n\t\t */\n\t\tvalueComponent?: ComponentType< RenderValueProps >;\n\t};\n}\n\nexport interface RenderLabelProps {\n\ttextProps: TextProps;\n\tx: number;\n\ty: number;\n\tlabel: string;\n\tformatter: ( value: string ) => string;\n}\n\nexport interface RenderValueProps {\n\ttextProps: TextProps;\n\tx: number;\n\ty: number;\n\tvalue: number;\n\t/**\n\t * Original data\n\t */\n\tdata: SeriesData[];\n\t/**\n\t * Index of the data point\n\t */\n\tindex: number;\n\tformatter: ( value: number ) => string;\n}\n\n/**\n * Get the bandwidth of a scale\n * @param scale - The scale to get the bandwidth of\n * @return The bandwidth of the scale\n */\nconst getScaleBandwidth = < Scale extends AxisScale >( scale?: Scale ) => {\n\t// Broaden type before using 'xxx' in s as typeguard.\n\tconst s = scale as AxisScale;\n\treturn s && 'bandwidth' in s ? s?.bandwidth() ?? 0 : 0;\n};\n\nconst DefaultLabelComponent = ( { textProps, x, y, label, formatter } ) => {\n\treturn (\n\t\t<Text { ...textProps } textAnchor=\"start\" x={ x } y={ y }>\n\t\t\t{ formatter( label ) }\n\t\t</Text>\n\t);\n};\n\nconst DefaultValueComponent = ( { textProps, x, y, value, formatter }: RenderValueProps ) => {\n\treturn (\n\t\t<Text { ...textProps } textAnchor=\"end\" x={ x } y={ y } fontWeight={ 500 }>\n\t\t\t{ formatter( value ) }\n\t\t</Text>\n\t);\n};\n\nconst AxisRenderer = ( {\n\tticks,\n\ttickLabelProps,\n\tyOffset,\n\tlabelPosition,\n\tvaluePosition,\n\tdata,\n\tlabelFormatter,\n\tvalueFormatter,\n\tLabelComponent = DefaultLabelComponent,\n\tValueComponent = DefaultValueComponent,\n}: AxisRendererProps< AnyD3Scale > & {\n\tyOffset: number;\n\tlabelPosition: number;\n\tvaluePosition: number;\n\tdata: SeriesData[];\n\tlabelFormatter?: ( value: string ) => string;\n\tvalueFormatter?: ( value: number ) => string;\n\tLabelComponent?: ComponentType< RenderLabelProps >;\n\tValueComponent?: ComponentType< RenderValueProps >;\n} ) => {\n\tif ( ticks.length === 0 ) {\n\t\treturn null;\n\t}\n\n\t// compute the max tick label size to compute label offset\n\tconst allTickLabelProps = ticks.map( ( { value, index } ) =>\n\t\ttypeof tickLabelProps === 'function' ? tickLabelProps( value, index, ticks ) : {}\n\t);\n\n\treturn ticks.map( ( { from, formattedValue }, index ) => {\n\t\tconst textProps = allTickLabelProps[ index ] ?? {};\n\t\t// No need to pass textAnchor and dx. It will be handled by the component.\n\t\tdelete textProps.textAnchor;\n\t\tdelete textProps.dx;\n\n\t\tconst sum = data.reduce(\n\t\t\t( acc, { data: seriesData } ) => acc + ( seriesData[ index ]?.value ?? 0 ),\n\t\t\t0\n\t\t);\n\t\tconst y = from.y + yOffset;\n\n\t\treturn (\n\t\t\t<Group key={ index }>\n\t\t\t\t<LabelComponent\n\t\t\t\t\ttextProps={ textProps }\n\t\t\t\t\tx={ labelPosition }\n\t\t\t\t\ty={ y }\n\t\t\t\t\tlabel={ formattedValue }\n\t\t\t\t\tformatter={ labelFormatter }\n\t\t\t\t/>\n\t\t\t\t<ValueComponent\n\t\t\t\t\ttextProps={ textProps }\n\t\t\t\t\tx={ valuePosition }\n\t\t\t\t\ty={ y }\n\t\t\t\t\tvalue={ sum }\n\t\t\t\t\tformatter={ valueFormatter }\n\t\t\t\t\tdata={ data }\n\t\t\t\t\tindex={ index }\n\t\t\t\t/>\n\t\t\t</Group>\n\t\t);\n\t} );\n};\n\n/**\n * Calculate the default y offset for the bar list chart.\n * @param data - The data to calculate the default y offset for.\n * @param yScaleConfig - The y scale configuration.\n * @param height - The height of the chart.\n * @param isMultiSeries - Whether the chart is a multi series chart.\n * @return The default y offset.\n */\nconst getDefaultYOffset = (\n\tdata: SeriesData[],\n\tyScaleConfig: Omit< ScaleOptions, 'type' >,\n\theight: number,\n\tisMultiSeries: boolean\n) => {\n\tif ( ! isMultiSeries ) {\n\t\treturn 0;\n\t}\n\n\tconst dataKeys = data.map( ( { label } ) => label );\n\n\tconst yScale = createScale< string >( {\n\t\ttype: 'band' as const,\n\t\trange: [ 0, height ],\n\t\tdomain: dataKeys,\n\t\t...yScaleConfig,\n\t} );\n\n\tconst groupScale = scaleBand< string >( {\n\t\tdomain: dataKeys,\n\t\trange: [ 0, getScaleBandwidth( yScale ) ],\n\t\tpadding: yScaleConfig.paddingInner,\n\t} );\n\n\tconst GAP_BETWEEN_BARS = 6;\n\tconst barThickness = getScaleBandwidth( groupScale );\n\n\t// Use negative value to move the label up.\n\treturn -( barThickness + GAP_BETWEEN_BARS );\n};\n\nconst BarListChartInternal: FC< BarListChartProps > = ( {\n\tdata,\n\twidth,\n\theight,\n\toptions = {},\n\tmargin = {\n\t\tleft: 0,\n\t\tright: 20,\n\t\tbottom: 0,\n\t\ttop: 0,\n\t},\n\t...rest\n} ) => {\n\tconst chartOptions = useMemo( () => {\n\t\tconst isMultiSeries = data.length > 1;\n\n\t\tconst defaultYScale = {\n\t\t\t// For multi series, set default padding larger to look better.\n\t\t\tpaddingInner: isMultiSeries ? 0.3 : 0.1,\n\t\t\tpadding: isMultiSeries ? 0.3 : 0.1,\n\t\t};\n\t\tconst defaultXScale = {\n\t\t\t// Always begin at zero since the x axis is hidden.\n\t\t\tzero: true,\n\t\t};\n\t\tconst yScale = {\n\t\t\t...defaultYScale,\n\t\t\t...( options.yScale ?? {} ),\n\t\t};\n\t\tconst xScale = {\n\t\t\t...defaultXScale,\n\t\t\t...( options.xScale ?? {} ),\n\t\t};\n\n\t\treturn {\n\t\t\tyScale,\n\t\t\txScale,\n\t\t\tlabelPosition: options.labelPosition ?? ( isMultiSeries ? 0 : 10 ),\n\t\t\tvalueFormatter: options.valueFormatter ?? ( value => formatNumberCompact( value ) ),\n\t\t\tlabelFormatter: options.labelFormatter ?? ( value => String( value ) ),\n\t\t\tvaluePosition: options.valuePosition ?? width,\n\t\t\tyOffset: options.yOffset ?? getDefaultYOffset( data, yScale, height, isMultiSeries ),\n\t\t};\n\t}, [ options, width, data, height ] );\n\n\treturn (\n\t\t<BarChartUnresponsive\n\t\t\torientation=\"horizontal\"\n\t\t\tgridVisibility={ 'none' }\n\t\t\tdata={ data }\n\t\t\twidth={ width }\n\t\t\theight={ height }\n\t\t\tmargin={ margin }\n\t\t\toptions={ {\n\t\t\t\taxis: {\n\t\t\t\t\ty: {\n\t\t\t\t\t\tchildren: ( renderProps: AxisRendererProps< AnyD3Scale > ) => (\n\t\t\t\t\t\t\t<AxisRenderer\n\t\t\t\t\t\t\t\t{ ...renderProps }\n\t\t\t\t\t\t\t\tdata={ data }\n\t\t\t\t\t\t\t\tyOffset={ chartOptions.yOffset }\n\t\t\t\t\t\t\t\tlabelPosition={ chartOptions.labelPosition }\n\t\t\t\t\t\t\t\tvaluePosition={ chartOptions.valuePosition }\n\t\t\t\t\t\t\t\tlabelFormatter={ chartOptions.labelFormatter }\n\t\t\t\t\t\t\t\tvalueFormatter={ chartOptions.valueFormatter }\n\t\t\t\t\t\t\t\tLabelComponent={ options.labelComponent }\n\t\t\t\t\t\t\t\tValueComponent={ options.valueComponent }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t\tx: {\n\t\t\t\t\t\tchildren: () => null,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\txScale: chartOptions.xScale,\n\t\t\t\tyScale: chartOptions.yScale,\n\t\t\t} }\n\t\t\t{ ...rest }\n\t\t/>\n\t);\n};\n\nconst BarListChart: FC< BarListChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, render the core component directly\n\tif ( existingContext ) {\n\t\treturn <BarListChartInternal { ...props } />;\n\t}\n\n\t// Otherwise, wrap with our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<BarListChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nBarListChart.displayName = 'BarListChart';\n\nconst BarListChartResponsive = withResponsive< BarListChartProps >( BarListChart );\n\nexport { BarListChartResponsive as default, BarListChart as BarListChartUnresponsive };\n","import { useCallback, useState } from 'react';\n\n/**\n * Custom hook to manage funnel bar selection state and interactions\n * @param hideTooltip - Function to hide tooltip when selection is cleared\n * @return Object containing selection state and event handlers\n */\nexport const useFunnelSelection = ( hideTooltip?: () => void ) => {\n\tconst [ clickedStep, setClickedStep ] = useState< string | null >( null );\n\n\t// Handle bar click\n\tconst handleBarClick = useCallback(\n\t\t( stepId: string ) => {\n\t\t\tif ( clickedStep === stepId ) {\n\t\t\t\t// If clicking the same step, deselect it\n\t\t\t\tsetClickedStep( null );\n\t\t\t\thideTooltip?.();\n\t\t\t} else {\n\t\t\t\t// Otherwise, select this step\n\t\t\t\tsetClickedStep( stepId );\n\t\t\t}\n\t\t},\n\t\t[ clickedStep, hideTooltip ]\n\t);\n\n\t// Handle bar keydown\n\tconst handleBarKeyDown = useCallback(\n\t\t( stepId: string, event: React.KeyboardEvent ) => {\n\t\t\tif ( event.key === 'Enter' || event.key === ' ' ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tif ( clickedStep === stepId ) {\n\t\t\t\t\tsetClickedStep( null );\n\t\t\t\t\thideTooltip?.();\n\t\t\t\t} else {\n\t\t\t\t\tsetClickedStep( stepId );\n\t\t\t\t}\n\t\t\t} else if ( event.key === 'Escape' ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetClickedStep( null );\n\t\t\t\thideTooltip?.();\n\t\t\t}\n\t\t},\n\t\t[ clickedStep, hideTooltip ]\n\t);\n\n\t// Clear selection (for chart-level click)\n\tconst clearSelection = useCallback( () => {\n\t\tsetClickedStep( null );\n\t\thideTooltip?.();\n\t}, [ hideTooltip ] );\n\n\t// Get step state helpers\n\tconst getStepState = useCallback(\n\t\t( stepId: string ) => ( {\n\t\t\tisClicked: clickedStep === stepId,\n\t\t\tisBlurred: clickedStep !== null && clickedStep !== stepId,\n\t\t} ),\n\t\t[ clickedStep ]\n\t);\n\n\treturn {\n\t\tclickedStep,\n\t\thandleBarClick,\n\t\thandleBarKeyDown,\n\t\tclearSelection,\n\t\tgetStepState,\n\t};\n};\n","import { useTooltip, useTooltipInPortal } from '@visx/tooltip';\nimport { Stack } from '@wordpress/ui';\nimport clsx from 'clsx';\nimport { type FC, useRef, useMemo, useEffect, useState, useCallback, useContext } from 'react';\nimport { usePrefersReducedMotion } from '../../hooks';\nimport {\n\tGlobalChartsProvider,\n\tGlobalChartsContext,\n\tChartScopeContext,\n\tuseChartId,\n\tuseChartRegistration,\n\tuseGlobalChartsTheme,\n\tuseGlobalChartsContext,\n} from '../../providers';\nimport { CHART_SCOPE_CLASS } from '../../styles/chart-scope-class';\nimport { formatPercentage, hexToRgba } from '../../utils';\nimport styles from './conversion-funnel-chart.module.scss';\nimport { useFunnelSelection } from './private';\nimport type { FunnelStep, ConversionFunnelChartProps } from './types';\n\n/**\n * Internal ConversionFunnelChart component with chart registration\n *\n * @param props - Component props\n * @param props.chartId - Optional unique identifier for the chart\n * @param props.mainRate - Main conversion rate to highlight\n * @param props.changeIndicator - Change indicator (e.g., +2%, -1.5%)\n * @param props.steps - Array of funnel steps\n * @param props.loading - Whether the chart is in loading state\n * @param props.animation - Whether to show chart animation on initial render or not\n * @param props.className - Additional CSS class name\n * @param props.height - Height of the chart container. Falls back to style.height if set, otherwise defaults to \"100%\".\n * @param props.style - Custom styling\n * @param props.renderStepLabel - Custom render function for step labels\n * @param props.renderStepRate - Custom render function for step rates\n * @param props.renderMainMetric - Custom render function for the entire main metric section\n * @param props.renderTooltip - Custom render function for tooltip content\n * @return JSX element representing the conversion funnel chart\n */\nconst ConversionFunnelChartInternal: FC< ConversionFunnelChartProps > = ( {\n\tmainRate,\n\tchangeIndicator,\n\tsteps,\n\tloading = false,\n\tanimation,\n\tclassName,\n\tchartId: providedChartId,\n\theight,\n\tstyle,\n\trenderStepLabel,\n\trenderStepRate,\n\trenderMainMetric,\n\trenderTooltip,\n} ) => {\n\tconst chartId = useChartId( providedChartId );\n\tconst { conversionFunnelChart: conversionFunnelChartSettings } = useGlobalChartsTheme();\n\tconst { getElementStyles, isColorPaletteResolved } = useGlobalChartsContext();\n\tconst chartRef = useRef< HTMLDivElement >( null );\n\tconst selectedBarRef = useRef< HTMLDivElement | null >( null );\n\tconst [ scopeNode, setScopeNode ] = useState< HTMLElement | null >( null );\n\n\t// Use @visx/tooltip hooks for tooltip positioning\n\tconst { tooltipData, tooltipLeft, tooltipTop, tooltipOpen, showTooltip, hideTooltip } =\n\t\tuseTooltip();\n\n\t// Use custom hook for selection management\n\tconst { handleBarClick, handleBarKeyDown, clearSelection, getStepState } =\n\t\tuseFunnelSelection( hideTooltip );\n\tconst {\n\t\tcontainerRef: portalContainerRef,\n\t\tTooltipInPortal,\n\t\tcontainerBounds,\n\t} = useTooltipInPortal( {\n\t\t// use TooltipWithBounds for boundary detection\n\t\tdetectBounds: true,\n\t\t// when tooltip containers are scrolled, this will correctly update the Tooltip position\n\t\tscroll: true,\n\t} );\n\n\t// `useTooltipInPortal` returns a fresh `containerRef` closure on every render, so depending on it directly would give this callback a new identity every render — React then detaches and reattaches the ref on every commit, flushing the scope context to null and back. Reading it through a ref keeps the callback's identity genuinely stable.\n\tconst portalContainerRefRef = useRef( portalContainerRef );\n\tuseEffect( () => {\n\t\tportalContainerRefRef.current = portalContainerRef;\n\t}, [ portalContainerRef ] );\n\n\t// Stable identity so React doesn't detach/reattach (and re-render the scope context) on every commit. Keep all three assignments, in the same order, and keep it firing on unmount (node === null).\n\tconst setChartRef = useCallback( ( node: HTMLDivElement | null ) => {\n\t\t// Set containerRef for @visx coordinate system\n\t\tportalContainerRefRef.current( node );\n\t\tchartRef.current = node;\n\t\tsetScopeNode( node );\n\t}, [] );\n\n\t// Wrapper to clear selectedBarRef after clearing selection\n\tconst clearSelectionAndRef = useCallback( () => {\n\t\tclearSelection();\n\t\tselectedBarRef.current = null;\n\t\thideTooltip();\n\t}, [ clearSelection, hideTooltip ] );\n\n\t// Helper function to show tooltip at specific coordinates\n\tconst showTooltipAt = useCallback(\n\t\t( step: FunnelStep, x: number, y: number ) => {\n\t\t\tshowTooltip( {\n\t\t\t\ttooltipData: step,\n\t\t\t\ttooltipLeft: x,\n\t\t\t\ttooltipTop: y - 10,\n\t\t\t} );\n\t\t},\n\t\t[ showTooltip ]\n\t);\n\n\t// Helper function to get tooltip coordinates for mouse events\n\t// Use clientX/Y and subtract containerBounds to cancel out any stale offset.\n\t// TooltipInPortal calculates: tooltipLeft + containerBounds.left + scrollX\n\t// By passing (clientX - containerBounds.left), we get correct page coordinates\n\t// regardless of whether bounds are stale (e.g., after dashboard customization).\n\tconst getMouseTooltipCoords = useCallback(\n\t\t( event: React.MouseEvent ) => {\n\t\t\t// Don't return coords until container bounds are measured\n\t\t\tif ( containerBounds.width === 0 || containerBounds.height === 0 ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tx: event.clientX - containerBounds.left,\n\t\t\t\ty: event.clientY - containerBounds.top,\n\t\t\t};\n\t\t},\n\t\t[ containerBounds.width, containerBounds.height, containerBounds.left, containerBounds.top ]\n\t);\n\n\t// Helper function to get tooltip coordinates for keyboard events\n\t// Use fresh getBoundingClientRect() and subtract containerBounds to cancel out stale offset.\n\tconst getKeyboardTooltipCoords = useCallback(\n\t\t( event: React.KeyboardEvent ) => {\n\t\t\t// Don't return coords until container bounds are measured\n\t\t\tif ( containerBounds.width === 0 || containerBounds.height === 0 ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst rect = event.currentTarget.getBoundingClientRect();\n\t\t\t// Calculate center of element in viewport coordinates, then subtract containerBounds\n\t\t\tconst x = rect.left + rect.width / 2 - containerBounds.left;\n\t\t\tconst y = rect.top - containerBounds.top;\n\t\t\treturn { x, y };\n\t\t},\n\t\t[ containerBounds.width, containerBounds.height, containerBounds.left, containerBounds.top ]\n\t);\n\n\t// Helper function to handle step interaction (both click and keyboard)\n\tconst handleStepInteraction = useCallback(\n\t\t(\n\t\t\tstep: FunnelStep,\n\t\t\tevent: React.MouseEvent | React.KeyboardEvent,\n\t\t\tinteractionType: 'click' | 'keyboard'\n\t\t) => {\n\t\t\t// Store reference to the interacted element\n\t\t\tselectedBarRef.current = event.currentTarget as HTMLDivElement;\n\n\t\t\t// Check if deselecting the same step\n\t\t\tconst { isClicked } = getStepState( step.id );\n\t\t\tif ( isClicked ) {\n\t\t\t\t// Deselecting - clear selection (tooltip will be hidden by hook)\n\t\t\t\tif ( interactionType === 'click' ) {\n\t\t\t\t\thandleBarClick( step.id );\n\t\t\t\t} else {\n\t\t\t\t\thandleBarKeyDown( step.id, event as React.KeyboardEvent );\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Selecting - handle selection and show tooltip\n\t\t\tif ( interactionType === 'click' ) {\n\t\t\t\thandleBarClick( step.id );\n\t\t\t\tconst coords = getMouseTooltipCoords( event as React.MouseEvent );\n\t\t\t\tif ( coords ) {\n\t\t\t\t\tshowTooltipAt( step, coords.x, coords.y );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thandleBarKeyDown( step.id, event as React.KeyboardEvent );\n\t\t\t\tconst coords = getKeyboardTooltipCoords( event as React.KeyboardEvent );\n\t\t\t\tif ( coords ) {\n\t\t\t\t\tshowTooltipAt( step, coords.x, coords.y );\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tgetStepState,\n\t\t\thandleBarClick,\n\t\t\thandleBarKeyDown,\n\t\t\tshowTooltipAt,\n\t\t\tgetMouseTooltipCoords,\n\t\t\tgetKeyboardTooltipCoords,\n\t\t]\n\t);\n\n\t// Create handler factories to avoid arrow functions in JSX\n\tconst stepHandlers = useMemo( () => {\n\t\tconst handlers = new Map<\n\t\t\tstring,\n\t\t\t{\n\t\t\t\tonClick: ( event: React.MouseEvent ) => void;\n\t\t\t\tonKeyDown: ( event: React.KeyboardEvent ) => void;\n\t\t\t}\n\t\t>();\n\n\t\tsteps.forEach( step => {\n\t\t\tconst onClick = ( event: React.MouseEvent ) => {\n\t\t\t\tevent.stopPropagation();\n\t\t\t\thandleStepInteraction( step, event, 'click' );\n\t\t\t};\n\n\t\t\tconst onKeyDown = ( event: React.KeyboardEvent ) => {\n\t\t\t\tif ( event.key === 'Enter' || event.key === ' ' ) {\n\t\t\t\t\thandleStepInteraction( step, event, 'keyboard' );\n\t\t\t\t} else {\n\t\t\t\t\t// For other keys (like Escape), just handle the selection\n\t\t\t\t\tselectedBarRef.current = event.currentTarget as HTMLDivElement;\n\t\t\t\t\thandleBarKeyDown( step.id, event );\n\t\t\t\t}\n\t\t\t};\n\n\t\t\thandlers.set( step.id, { onClick, onKeyDown } );\n\t\t} );\n\n\t\treturn handlers;\n\t}, [ steps, handleStepInteraction, handleBarKeyDown ] );\n\n\t// Handle document-level click to clear selection when clicking outside selected bar\n\tuseEffect( () => {\n\t\tconst handleDocumentClick = ( event: MouseEvent ) => {\n\t\t\t// Only clear selection if there's an active selection and click is outside the selected bar\n\t\t\tif ( selectedBarRef.current && ! selectedBarRef.current.contains( event.target as Node ) ) {\n\t\t\t\tclearSelectionAndRef();\n\t\t\t}\n\t\t};\n\n\t\tdocument.addEventListener( 'mousedown', handleDocumentClick );\n\n\t\treturn () => {\n\t\t\tdocument.removeEventListener( 'mousedown', handleDocumentClick );\n\t\t};\n\t}, [ clearSelectionAndRef ] );\n\n\t// Resolve height: explicit height prop > style.height > default 100%\n\tconst resolvedHeight = height ?? style?.height ?? '100%';\n\n\t// Get component settings from theme with fallbacks\n\tconst { primaryColor, backgroundColor, positiveChangeColor, negativeChangeColor } =\n\t\tconversionFunnelChartSettings;\n\n\t// Resolve bar color using getElementStyles with primaryColor as override\n\tconst { color: barColor } = getElementStyles\n\t\t? getElementStyles( {\n\t\t\t\tindex: 0,\n\t\t\t\toverrideColor: primaryColor,\n\t\t } )\n\t\t: { color: primaryColor || '#000000' };\n\n\t// Determine change indicator color\n\tconst isPositiveChange = changeIndicator?.startsWith( '+' );\n\tconst changeColor = isPositiveChange ? positiveChangeColor : negativeChangeColor;\n\n\t// Create light background version of primary color if not set\n\tconst barBackgroundColor =\n\t\tbackgroundColor || hexToRgba( barColor, 0.08 ) || 'rgba(0, 0, 0, 0.08)';\n\n\t// Default main metric rendering function\n\tconst renderDefaultMainMetric = () => (\n\t\t<>\n\t\t\t<span className={ styles[ 'main-rate' ] }>{ formatPercentage( mainRate ) }</span>\n\t\t\t{ changeIndicator && (\n\t\t\t\t<span className={ styles[ 'change-indicator' ] } style={ { color: changeColor } }>\n\t\t\t\t\t{ changeIndicator }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t</>\n\t);\n\n\t// Default tooltip rendering function\n\tconst renderDefaultTooltip = ( step: FunnelStep ) => (\n\t\t<Stack direction=\"column\" align=\"flex-start\" gap=\"xs\">\n\t\t\t<div className={ styles[ 'tooltip-title' ] }>{ step.label }</div>\n\t\t\t<div className={ styles[ 'tooltip-content' ] }>\n\t\t\t\t{ formatPercentage( step.rate ) }\n\t\t\t\t{ ` • ${ step.count ?? 'no' } items` }\n\t\t\t</div>\n\t\t</Stack>\n\t);\n\n\t// Validate data\n\tconst isDataValid = Boolean( steps && steps.length > 0 );\n\n\t// Memoize metadata to prevent unnecessary re-registration\n\tconst chartMetadata = useMemo(\n\t\t() => ( {\n\t\t\tmainRate,\n\t\t\tchangeIndicator,\n\t\t\tstepsCount: steps?.length || 0,\n\t\t} ),\n\t\t[ mainRate, changeIndicator, steps?.length ]\n\t);\n\n\tuseChartRegistration( {\n\t\tchartId,\n\t\tlegendItems: [],\n\t\tchartType: 'conversion-funnel',\n\t\tisDataValid,\n\t\tmetadata: chartMetadata,\n\t} );\n\n\tconst prefersReducedMotion = usePrefersReducedMotion();\n\n\t// Handle empty or undefined data\n\tif ( ! isDataValid ) {\n\t\treturn (\n\t\t\t<Stack\n\t\t\t\tdirection=\"column\"\n\t\t\t\talign=\"center\"\n\t\t\t\tjustify=\"center\"\n\t\t\t\tdata-testid=\"conversion-funnel-chart\"\n\t\t\t\tref={ setScopeNode }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\tstyles[ 'conversion-funnel-chart' ],\n\t\t\t\t\tloading && styles[ 'conversion-funnel-chart--loading' ],\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tstyle={ { ...style, height: resolvedHeight } }\n\t\t\t>\n\t\t\t\t<div className={ styles[ 'empty-state' ] }>\n\t\t\t\t\t{ loading ? 'Loading...' : 'No data available' }\n\t\t\t\t</div>\n\t\t\t</Stack>\n\t\t);\n\t}\n\n\t// Calculate bar heights relative to the maximum (first step)\n\tconst maxRate = Math.max( ...steps.map( step => step.rate ) );\n\n\treturn (\n\t\t<>\n\t\t\t<Stack\n\t\t\t\tdirection=\"column\"\n\t\t\t\tgap=\"xl\"\n\t\t\t\tdata-testid=\"conversion-funnel-chart\"\n\t\t\t\tref={ setChartRef }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\tstyles[ 'conversion-funnel-chart' ],\n\t\t\t\t\tloading && styles[ 'conversion-funnel-chart--loading' ],\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tstyle={ { ...style, height: resolvedHeight } }\n\t\t\t>\n\t\t\t\t<ChartScopeContext.Provider value={ scopeNode }>\n\t\t\t\t\t{ /* Main Metric */ }\n\t\t\t\t\t{ renderMainMetric ? (\n\t\t\t\t\t\trenderMainMetric( {\n\t\t\t\t\t\t\tmainRate,\n\t\t\t\t\t\t\tchangeIndicator,\n\t\t\t\t\t\t\tclassName: styles[ 'main-metric' ],\n\t\t\t\t\t\t\tchangeColor,\n\t\t\t\t\t\t} )\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<Stack direction=\"row\" align=\"baseline\" gap=\"sm\" className={ styles[ 'main-metric' ] }>\n\t\t\t\t\t\t\t{ renderDefaultMainMetric() }\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ /* Funnel Steps */ }\n\t\t\t\t\t<Stack\n\t\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\t\talign=\"flex-end\"\n\t\t\t\t\t\tgap=\"lg\"\n\t\t\t\t\t\tclassName={ styles[ 'funnel-container' ] }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ steps.map( ( step, index ) => {\n\t\t\t\t\t\t\tconst barHeight = ( step.rate / maxRate ) * 100;\n\t\t\t\t\t\t\tconst { isBlurred } = getStepState( step.id );\n\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<Stack\n\t\t\t\t\t\t\t\t\tkey={ step.id }\n\t\t\t\t\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\t\t\t\t\tdata-testid=\"funnel-step\"\n\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\tstyles[ 'funnel-step' ],\n\t\t\t\t\t\t\t\t\t\tisColorPaletteResolved && styles[ 'funnel-step--animated' ],\n\t\t\t\t\t\t\t\t\t\tisBlurred && styles[ 'funnel-step--blurred' ]\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tgap=\"xl\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ /* Step Label and Rate */ }\n\t\t\t\t\t\t\t\t\t<Stack direction=\"column\" gap=\"xs\">\n\t\t\t\t\t\t\t\t\t\t{ renderStepLabel ? (\n\t\t\t\t\t\t\t\t\t\t\trenderStepLabel( {\n\t\t\t\t\t\t\t\t\t\t\t\tstep,\n\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\tclassName: styles[ 'step-label' ],\n\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\t<span className={ styles[ 'step-label' ] }>{ step.label }</span>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t{ renderStepRate ? (\n\t\t\t\t\t\t\t\t\t\t\trenderStepRate( {\n\t\t\t\t\t\t\t\t\t\t\t\tstep,\n\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\tclassName: styles[ 'step-rate' ],\n\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\t<span className={ styles[ 'step-rate' ] }>\n\t\t\t\t\t\t\t\t\t\t\t\t{ formatPercentage( step.rate ) }\n\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</Stack>\n\n\t\t\t\t\t\t\t\t\t{ /* Funnel Bar */ }\n\t\t\t\t\t\t\t\t\t<Stack\n\t\t\t\t\t\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\t\t\t\t\t\tjustify=\"flex-end\"\n\t\t\t\t\t\t\t\t\t\tclassName={ styles[ 'bar-container' ] }\n\t\t\t\t\t\t\t\t\t\tonClick={ stepHandlers.get( step.id )?.onClick }\n\t\t\t\t\t\t\t\t\t\tonKeyDown={ stepHandlers.get( step.id )?.onKeyDown }\n\t\t\t\t\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\t\t\t\t\ttabIndex={ isBlurred ? -1 : 0 }\n\t\t\t\t\t\t\t\t\t\taria-label={ step.label }\n\t\t\t\t\t\t\t\t\t\tstyle={ { backgroundColor: barBackgroundColor } }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\tclassName={ clsx( styles[ 'funnel-bar' ], {\n\t\t\t\t\t\t\t\t\t\t\t\t[ styles[ 'funnel-bar--animated' ] ]:\n\t\t\t\t\t\t\t\t\t\t\t\t\tanimation && ! loading && ! prefersReducedMotion,\n\t\t\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\t\t\theight: `${ barHeight }%`,\n\t\t\t\t\t\t\t\t\t\t\t\tbackgroundColor: barColor,\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t</Stack>\n\t\t\t\t</ChartScopeContext.Provider>\n\t\t\t</Stack>\n\n\t\t\t{ /* Tooltip Portal */ }\n\t\t\t{ tooltipOpen &&\n\t\t\t\ttooltipData &&\n\t\t\t\t( () => {\n\t\t\t\t\tconst tooltipContent = renderTooltip\n\t\t\t\t\t\t? renderTooltip( {\n\t\t\t\t\t\t\t\tstep: tooltipData as FunnelStep,\n\t\t\t\t\t\t\t\tindex: steps.findIndex( s => s.id === ( tooltipData as FunnelStep ).id ),\n\t\t\t\t\t\t\t\ttop: tooltipTop,\n\t\t\t\t\t\t\t\tleft: tooltipLeft,\n\t\t\t\t\t\t\t\tclassName: styles[ 'tooltip-wrapper' ],\n\t\t\t\t\t\t } )\n\t\t\t\t\t\t: renderDefaultTooltip( tooltipData as FunnelStep );\n\n\t\t\t\t\t// Don't render tooltip if renderTooltip returns falsy\n\t\t\t\t\tif ( ! tooltipContent ) return null;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<TooltipInPortal\n\t\t\t\t\t\t\t// set this to random so it correctly updates with parent bounds\n\t\t\t\t\t\t\tkey={ Math.random() }\n\t\t\t\t\t\t\ttop={ tooltipTop }\n\t\t\t\t\t\t\tleft={ tooltipLeft }\n\t\t\t\t\t\t\tclassName={ clsx( CHART_SCOPE_CLASS, styles[ 'tooltip-wrapper' ] ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ tooltipContent }\n\t\t\t\t\t\t</TooltipInPortal>\n\t\t\t\t\t);\n\t\t\t\t} )() }\n\t\t</>\n\t);\n};\n\n/**\n * ConversionFunnelChart component with provider wrapper\n *\n * @param props - Component props\n * @return JSX element representing the conversion funnel chart\n */\nconst ConversionFunnelChartWithProvider: FC< ConversionFunnelChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, don't create a new one\n\tif ( existingContext ) {\n\t\treturn <ConversionFunnelChartInternal { ...props } />;\n\t}\n\n\t// Otherwise, create our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<ConversionFunnelChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nConversionFunnelChartWithProvider.displayName = 'ConversionFunnelChart';\n\nexport { ConversionFunnelChartWithProvider as default };\n","/**\n * External dependencies\n */\nimport DOMPurify from 'dompurify';\n\n// Enforce rel=\"noopener noreferrer\" on links with target=\"_blank\" to prevent tab-napping.\n// Registered once at module level since DOMPurify hooks are global state.\nDOMPurify.addHook( 'afterSanitizeAttributes', ( node: Element ) => {\n\tif ( node.tagName === 'A' && node.getAttribute( 'target' ) === '_blank' ) {\n\t\tnode.setAttribute( 'rel', 'noopener noreferrer' );\n\t}\n} );\n\n/**\n * Sanitizes an HTML string using DOMPurify, allowing only safe formatting\n * markup suitable for chart tooltip content.\n *\n * @param html - The HTML string to sanitize\n * @return Sanitized HTML string safe for rendering\n */\nexport function sanitizeHtml( html: string ): string {\n\treturn DOMPurify.sanitize( html, {\n\t\tALLOWED_TAGS: [\n\t\t\t'a',\n\t\t\t'b',\n\t\t\t'br',\n\t\t\t'div',\n\t\t\t'em',\n\t\t\t'i',\n\t\t\t'li',\n\t\t\t'ol',\n\t\t\t'p',\n\t\t\t'small',\n\t\t\t'span',\n\t\t\t'strong',\n\t\t\t'sub',\n\t\t\t'sup',\n\t\t\t'table',\n\t\t\t'tbody',\n\t\t\t'td',\n\t\t\t'th',\n\t\t\t'thead',\n\t\t\t'tr',\n\t\t\t'u',\n\t\t\t'ul',\n\t\t],\n\t\tALLOWED_ATTR: [ 'class', 'href', 'target', 'rel' ],\n\t} );\n}\n","/**\n * External dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport { FC, useContext, useEffect, useMemo, useRef } from 'react';\nimport { Chart, type GoogleChartPackages, type ReactGoogleChartEvent } from 'react-google-charts';\n/**\n * Internal dependencies\n */\nimport {\n\tGlobalChartsContext,\n\tGlobalChartsProvider,\n\tuseChartScopeElement,\n\tuseGlobalChartsContext,\n} from '../../providers';\nimport { lightenHexColor, normalizeColorToHex } from '../../utils/color-utils';\nimport { resolveCssVariable } from '../../utils/resolve-css-var';\nimport { sanitizeHtml } from '../../utils/sanitize-html';\nimport { Center } from '../private/center';\nimport { withResponsive } from '../private/with-responsive';\nimport styles from './geo-chart.module.scss';\nimport type { GeoChartError, GeoChartProps } from './types';\n\nconst DEFAULT_FEATURE_FILL_COLOR = '#ffffff';\nconst DEFAULT_BACKGROUND_COLOR = '#ffffff';\n// `chartPackages` replaces (not extends) react-google-charts' default `[ 'corechart', 'controls' ]`,\n// so we restate the defaults and add `geochart`. Without it the loader backfills the geochart package\n// late, which can clash with another Google Charts version already loaded on the page.\nconst GEO_CHART_PACKAGES: GoogleChartPackages[] = [ 'corechart', 'controls', 'geochart' ];\n\ntype GoogleChartOptions = Record< string, unknown >;\ntype GoogleChartErrorPayload = {\n\tid?: unknown;\n\tmessage?: unknown;\n\tdetailedMessage?: unknown;\n\toptions?: unknown;\n};\n\n// Google Charts renders draw errors as DOM elements injected into the chart\n// container: a wrapper `<div id=\"google-visualization-errors-all-N\">` holding\n// one `<span id=\"google-visualization-errors-N\">` per error. The span id is the\n// error id accepted by `google.visualization.errors.removeError()`.\nconst GOOGLE_CHARTS_ERROR_ID_PREFIX = 'google-visualization-errors-';\nconst GOOGLE_CHARTS_ERROR_WRAPPER_INFIX = '-all-';\n\n/**\n * Collects Google Charts error elements rendered inside a chart container.\n *\n * @param container - The chart container element to scan.\n * @return Errors found in the container, one per error span.\n */\nfunction collectRenderedGeoChartErrors(\n\tcontainer: HTMLElement\n): Required< Pick< GeoChartError, 'id' | 'message' > >[] {\n\tconst elements = container.querySelectorAll< HTMLElement >(\n\t\t`[id^=\"${ GOOGLE_CHARTS_ERROR_ID_PREFIX }\"]`\n\t);\n\n\treturn Array.from( elements )\n\t\t.filter( element => ! element.id.includes( GOOGLE_CHARTS_ERROR_WRAPPER_INFIX ) )\n\t\t.map( element => ( {\n\t\t\tid: element.id,\n\t\t\tmessage: element.textContent?.trim() ?? '',\n\t\t} ) )\n\t\t.filter( error => error.message.length > 0 );\n}\n\n/**\n * Whether a node added to the chart container is — or contains — a Google\n * Charts error element. Also matches text appended into an existing error\n * span, in case Google fills the message after inserting the element.\n *\n * @param node - The added DOM node to inspect.\n * @return Whether the node involves a Google Charts error element.\n */\nfunction involvesGeoChartErrorElement( node: Node ): boolean {\n\tif ( node.nodeType === Node.TEXT_NODE ) {\n\t\treturn !! node.parentElement?.id.startsWith( GOOGLE_CHARTS_ERROR_ID_PREFIX );\n\t}\n\n\tif ( ! ( node instanceof HTMLElement ) ) {\n\t\treturn false;\n\t}\n\n\treturn (\n\t\tnode.id.startsWith( GOOGLE_CHARTS_ERROR_ID_PREFIX ) ||\n\t\tnode.querySelector( `[id^=\"${ GOOGLE_CHARTS_ERROR_ID_PREFIX }\"]` ) !== null\n\t);\n}\n\n/**\n * Normalizes the raw Google Charts error event into the GeoChart error shape.\n *\n * @param eventArgs - Error event payload from react-google-charts.\n * @return Normalized GeoChart error.\n */\nfunction normalizeGeoChartError( eventArgs: unknown ): GeoChartError {\n\tconst payload = Array.isArray( eventArgs ) ? eventArgs[ 0 ] : eventArgs;\n\n\tif ( ! payload || typeof payload !== 'object' ) {\n\t\treturn {};\n\t}\n\n\tconst { id, message, detailedMessage, options } = payload as GoogleChartErrorPayload;\n\n\treturn {\n\t\t...( typeof id === 'string' && { id } ),\n\t\t...( typeof message === 'string' && { message } ),\n\t\t...( typeof detailedMessage === 'string' && { detailedMessage } ),\n\t\t...( options &&\n\t\t\ttypeof options === 'object' &&\n\t\t\t! Array.isArray( options ) && { options: options as Record< string, unknown > } ),\n\t};\n}\n\n/**\n * Renders a geographical chart using Google Charts GeoChart to visualize data.\n *\n * Supports the full Google Charts data format including custom tooltips, formatted values,\n * and multiple data columns for maximum flexibility.\n *\n * Locations can be identified by full name (e.g., 'United States', 'California') or codes\n * (e.g., 'US', 'US-CA'). Full names are recommended for better readability in tooltips.\n *\n * @param props - The props for the GeoChart component\n * @param props.data - Data in Google Charts format (array of arrays with headers)\n * @param props.width - Width of the chart in pixels\n * @param props.height - Height of the chart in pixels\n * @param props.region - Region to display ('world', 'US', or ISO 3166-1 alpha-2 code)\n * @param props.resolution - Resolution level ('countries', 'provinces', or 'metros')\n * @param props.onError - Optional callback for Google Charts errors\n * @param props.className - Additional CSS class name for the chart container\n * @param props.renderPlaceholder - Optional render function for the loading placeholder\n * @return A React component displaying an interactive map with data visualization\n */\nconst GeoChartInternal: FC< GeoChartProps > = ( {\n\tclassName,\n\tdata,\n\twidth,\n\theight,\n\tregion = 'world',\n\tresolution = 'countries',\n\tonError,\n\trenderPlaceholder,\n} ) => {\n\tconst {\n\t\tgetElementStyles,\n\t\ttheme: {\n\t\t\tgeoChart: { featureFillColor },\n\t\t\tbackgroundColor,\n\t\t},\n\t} = useGlobalChartsContext();\n\tconst scopeElement = useChartScopeElement();\n\tconst containerRef = useRef< HTMLDivElement >( null );\n\tconst reportedErrorIdsRef = useRef< Set< string > >( new Set() );\n\n\t// The ChartWrapper `error` event does not fire for every draw failure —\n\t// notably not when GeoChart's asynchronous map-file load fails (e.g.\n\t// `resolution: 'provinces'` for a country without a provinces map). Those\n\t// errors only surface as DOM elements Google injects into the container, so\n\t// watch the container and report them through the same `onError` callback.\n\tuseEffect( () => {\n\t\tconst container = containerRef.current;\n\n\t\tif ( ! onError || ! container || typeof MutationObserver === 'undefined' ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst reportRenderedErrors = () => {\n\t\t\tfor ( const error of collectRenderedGeoChartErrors( container ) ) {\n\t\t\t\tif ( reportedErrorIdsRef.current.has( error.id ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\treportedErrorIdsRef.current.add( error.id );\n\t\t\t\tonError( error );\n\t\t\t}\n\t\t};\n\n\t\t// GeoChart mutates the container heavily while drawing and resizing;\n\t\t// only rescan when an added node involves a Google error element.\n\t\tconst observer = new MutationObserver( records => {\n\t\t\tconst hasErrorNodes = records.some( record =>\n\t\t\t\tArray.from( record.addedNodes ).some( involvesGeoChartErrorElement )\n\t\t\t);\n\n\t\t\tif ( hasErrorNodes ) {\n\t\t\t\treportRenderedErrors();\n\t\t\t}\n\t\t} );\n\t\tobserver.observe( container, { childList: true, subtree: true } );\n\t\t// Report errors already rendered before the observer attached.\n\t\treportRenderedErrors();\n\n\t\treturn () => observer.disconnect();\n\t}, [ onError ] );\n\n\t// Render loading placeholder\n\tconst loadingPlaceholder = (\n\t\t<Center\n\t\t\tclassName={ clsx( 'geo-chart', styles.container, className ) }\n\t\t\tdata-testid=\"geo-chart-loading\"\n\t\t\tstyle={ { width, height } }\n\t\t>\n\t\t\t{ renderPlaceholder ? renderPlaceholder() : __( 'Loading map', 'jetpack-charts' ) }\n\t\t</Center>\n\t);\n\n\t// Google charts doesn't accept CSS variables, so we need to convert them to hex colors\n\tconst fullColorHex = getElementStyles( { index: 0 } ).color;\n\tconst lightColorHex = lightenHexColor( fullColorHex, 0.8 );\n\t// Use normalizeColorToHex to ensure HSL/RGB values from CSS variables are converted to hex. Google Charts takes a resolved-hex snapshot at render, so this does not live-update on a theme change without a re-render — an accepted asymmetry vs CSS-painted elements.\n\tconst backgroundColorHex =\n\t\tnormalizeColorToHex( backgroundColor, scopeElement, resolveCssVariable ) ||\n\t\tDEFAULT_BACKGROUND_COLOR;\n\tconst defaultFillColorHex =\n\t\tnormalizeColorToHex( featureFillColor, scopeElement, resolveCssVariable ) ||\n\t\tDEFAULT_FEATURE_FILL_COLOR;\n\n\t// Identify HTML tooltip column indices and sanitize their content to prevent XSS.\n\tconst sanitizedData = useMemo( () => {\n\t\tif ( data.length === 0 ) {\n\t\t\treturn { data, hasHtmlTooltips: false };\n\t\t}\n\n\t\tconst htmlTooltipIndices: number[] = [];\n\t\tfor ( let i = 0; i < data[ 0 ].length; i++ ) {\n\t\t\tconst col = data[ 0 ][ i ];\n\t\t\tif (\n\t\t\t\ttypeof col === 'object' &&\n\t\t\t\tcol !== null &&\n\t\t\t\t'role' in col &&\n\t\t\t\tcol.role === 'tooltip' &&\n\t\t\t\t'p' in col &&\n\t\t\t\ttypeof col.p === 'object' &&\n\t\t\t\tcol.p !== null &&\n\t\t\t\t'html' in col.p &&\n\t\t\t\tcol.p.html === true\n\t\t\t) {\n\t\t\t\thtmlTooltipIndices.push( i );\n\t\t\t}\n\t\t}\n\n\t\tif ( htmlTooltipIndices.length === 0 ) {\n\t\t\treturn { data, hasHtmlTooltips: false };\n\t\t}\n\n\t\t// Sanitize HTML content in tooltip columns for data rows (skip header row)\n\t\tconst sanitizedRows = data.slice( 1 ).map( row => {\n\t\t\tconst newRow = [ ...row ];\n\t\t\tfor ( const colIndex of htmlTooltipIndices ) {\n\t\t\t\tif ( typeof newRow[ colIndex ] === 'string' ) {\n\t\t\t\t\tnewRow[ colIndex ] = sanitizeHtml( newRow[ colIndex ] as string );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn newRow;\n\t\t} );\n\n\t\treturn {\n\t\t\tdata: [ data[ 0 ], ...sanitizedRows ] as typeof data,\n\t\t\thasHtmlTooltips: true,\n\t\t};\n\t}, [ data ] );\n\n\tconst options: GoogleChartOptions = useMemo(\n\t\t() => ( {\n\t\t\t...( region !== 'world' && { region } ),\n\t\t\t...( resolution !== 'countries' && { resolution } ),\n\t\t\tcolorAxis: { colors: [ lightColorHex, fullColorHex ] },\n\t\t\tbackgroundColor: backgroundColorHex,\n\t\t\tdatalessRegionColor: defaultFillColorHex,\n\t\t\tdefaultColor: defaultFillColorHex,\n\t\t\ttooltip: { trigger: 'focus', isHtml: sanitizedData.hasHtmlTooltips },\n\t\t\tlegend: 'none',\n\t\t\tkeepAspectRatio: true,\n\t\t} ),\n\t\t[\n\t\t\tregion,\n\t\t\tresolution,\n\t\t\tlightColorHex,\n\t\t\tfullColorHex,\n\t\t\tbackgroundColorHex,\n\t\t\tdefaultFillColorHex,\n\t\t\tsanitizedData.hasHtmlTooltips,\n\t\t]\n\t);\n\n\tconst chartEvents = useMemo< ReactGoogleChartEvent[] | undefined >( () => {\n\t\tif ( ! onError ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn [\n\t\t\t{\n\t\t\t\teventName: 'error',\n\t\t\t\tcallback: ( { eventArgs } ) => {\n\t\t\t\t\tonError( normalizeGeoChartError( eventArgs ) );\n\t\t\t\t},\n\t\t\t},\n\t\t];\n\t}, [ onError ] );\n\n\treturn (\n\t\t<Center\n\t\t\tref={ containerRef }\n\t\t\tclassName={ clsx( 'geo-chart', styles.container, className ) }\n\t\t\tdata-testid=\"geo-chart\"\n\t\t\tstyle={ { width, height, backgroundColor } }\n\t\t>\n\t\t\t<Chart\n\t\t\t\tchartType=\"GeoChart\"\n\t\t\t\tchartPackages={ GEO_CHART_PACKAGES }\n\t\t\t\twidth={ width }\n\t\t\t\theight={ height }\n\t\t\t\tdata={ sanitizedData.data }\n\t\t\t\toptions={ options }\n\t\t\t\tchartEvents={ chartEvents }\n\t\t\t\tloader={ loadingPlaceholder }\n\t\t\t/>\n\t\t</Center>\n\t);\n};\n\nconst GeoChartWithProvider: FC< GeoChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, don't create a new one\n\tif ( existingContext ) {\n\t\treturn <GeoChartInternal { ...props } />;\n\t}\n\n\t// Otherwise, create our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<GeoChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nGeoChartWithProvider.displayName = 'GeoChart';\n\nconst GeoChartResponsive = withResponsive< GeoChartProps >( GeoChartWithProvider );\n\nexport { GeoChartResponsive as default, GeoChartWithProvider as GeoChartUnresponsive };\n","import type {\n\tCircleSubjectProps,\n\tConnectorProps,\n\tLabelProps,\n\tLineSubjectProps,\n} from '@visx/annotation';\nimport type { AxisScale, Orientation, TickFormatter, AxisRendererProps } from '@visx/axis';\nimport type { ScaleInput, ScaleType } from '@visx/scale';\nimport type { TextProps } from '@visx/text';\nimport type { EventHandlerParams, GlyphProps, GridStyles, LineStyles } from '@visx/xychart';\nimport type {\n\tComponentClass,\n\tCSSProperties,\n\tFC,\n\tMouseEvent,\n\tPointerEvent,\n\tReactElement,\n\tReactNode,\n} from 'react';\n\ntype ValueOf< T > = T[ keyof T ];\n\nexport type Optional< T, K extends keyof T > = Pick< Partial< T >, K > & Omit< T, K >;\n\n/**\n * Mirrors the WordPress Design System gap token scale used by the WordPress UI Stack.\n */\nexport type GapSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';\n\nexport type LegendShapeLabel< Data, Output, ExtraAttributes = object > = {\n\tdatum: Data;\n\tindex: number;\n\ttext: string;\n\tvalue?: Output;\n} & ExtraAttributes;\n\nexport type LegendShapeRenderProps< Data, Output > = {\n\twidth?: string | number;\n\theight?: string | number;\n\tlabel: LegendShapeLabel< Data, Output >;\n\titem: Data;\n\titemIndex: number;\n\tfill?: string;\n\tsize?: string | number;\n\tstyle?: CSSProperties;\n};\n\nexport type LegendShape< Data, Output > =\n\t| 'rect'\n\t| 'circle'\n\t| 'line'\n\t| FC< LegendShapeRenderProps< Data, Output > >\n\t| ComponentClass< LegendShapeRenderProps< Data, Output > >;\n\nexport type GoogleDataTableColumnType =\n\t| 'string'\n\t| 'number'\n\t| 'boolean'\n\t| 'date'\n\t| 'datetime'\n\t| 'timeofday';\n\nexport enum GoogleDataTableColumnRoleType {\n\tannotation = 'annotation',\n\tannotationText = 'annotationText',\n\tcertainty = 'certainty',\n\temphasis = 'emphasis',\n\tinterval = 'interval',\n\tscope = 'scope',\n\tstyle = 'style',\n\ttooltip = 'tooltip',\n\tdomain = 'domain',\n}\n\nexport type GoogleDataTableColumn =\n\t| {\n\t\t\ttype: GoogleDataTableColumnType;\n\t\t\tlabel?: string;\n\t\t\trole?: GoogleDataTableColumnRoleType;\n\t\t\tpattern?: string;\n\t\t\tp?: Record< string, unknown >;\n\t\t\tid?: string;\n\t }\n\t| string;\n\nexport type GoogleDataTableCell =\n\t| {\n\t\t\tv?: unknown;\n\t\t\tf?: string;\n\t\t\tp?: Record< string, unknown >;\n\t }\n\t| string\n\t| number\n\t| boolean\n\t| Date\n\t| null;\n\nexport type GoogleDataTableRow = GoogleDataTableCell[];\n\nexport type ChartType =\n\t| 'area'\n\t| 'bar'\n\t| 'conversion-funnel'\n\t| 'leaderboard'\n\t| 'line'\n\t| 'pie'\n\t| 'pie-semi-circle';\n\nexport type OrientationType = ValueOf< typeof Orientation >;\n\nexport type AnnotationStyles = {\n\tcircleSubject?: Omit< CircleSubjectProps, 'x' | 'y' > & { fill?: string };\n\tlineSubject?: Omit< LineSubjectProps, 'x' | 'y' >;\n\tconnector?: Omit< ConnectorProps, 'x' | 'y' | 'dx' | 'dy' >;\n\tlabel?: Omit< LabelProps, 'title' | 'subtitle' | 'x' | 'y' > & {\n\t\tx?: number | 'start' | 'end';\n\t\ty?: number | 'start' | 'end';\n\t};\n};\n\nexport type DataPoint = {\n\tlabel: string;\n\tvalue: number;\n};\n\n/**\n * Data format for GeoChart - uses Google Charts native data format for maximum flexibility.\n * First element is the header row, subsequent elements are data rows.\n *\n * Country identifiers can be either full country names or ISO 3166-1 alpha-2 codes (e.g., 'United States' or 'US').\n * Full names are recommended for better readability in tooltips.\n *\n * @example Basic usage with country names:\n * [['Country', 'Value'], ['United States', 100], ['Canada', 50], ['United Kingdom', 75]]\n *\n * @example With custom HTML tooltips:\n * [\n * ['Country', 'Value', { type: 'string', role: 'tooltip', p: { html: true } }],\n * ['United States', 100, '<b>United States</b><br/>100 visitors'],\n * ['Canada', 50, '<b>Canada</b><br/>50 visitors']\n * ]\n *\n * @example With formatted values (v = value, f = formatted):\n * [\n * ['Country', 'Value'],\n * ['United States', { v: 100, f: '100 visitors' }],\n * ['Canada', { v: 50, f: '50 visitors' }]\n * ]\n *\n * @example With multiple columns:\n * [\n * ['Country', 'Population', 'Area'],\n * ['United States', 331000000, 9834000],\n * ['Canada', 38000000, 9985000]\n * ]\n */\nexport type GeoData = [ GoogleDataTableColumn[], ...GoogleDataTableRow[] ];\n\nexport type DataPointDate = {\n\tdate?: Date;\n\t/**\n\t * Supported Formats:\n\t * - YYYY-MM-DD (local)\n\t * - YYYY-MM-DD HH:mm:ss (local)\n\t * - YYYY-MM-DD HH:mm (local)\n\t * - YYYY-MM-DDTHH:mm:ss (local)\n\t * - YYYY-MM-DDTHH:mm:ss.SSS (local)\n\t * - YYYY-MM-DDTHH:mm (local)\n\t * - YYYY-MM-DDTHH:mm:ssZ (UTC → local)\n\t * - YYYY-MM-DDTHH:mm:ss±HH:mm (offset → local)\n\t */\n\tdateString?: string;\n\tvalue: number | null;\n\tlabel?: string;\n};\n\nexport type LeaderboardEntry = {\n\t/**\n\t * Unique internal key (e.g., 'key-direct')\n\t */\n\tid: string;\n\n\t/**\n\t * Human-readable name (e.g., 'Direct') or a JSX element (e.g., <h4>Direct</h4>)\n\t */\n\tlabel: string | ReactElement;\n\n\t/**\n\t * Value of the entry\n\t */\n\tcurrentValue: number;\n\n\t/**\n\t * Value of the entry in the previous period. Omit when this row has no\n\t * matching comparison-period value.\n\t */\n\tpreviousValue?: number;\n\n\t/**\n\t * Width of current bar, as % of the current value\n\t */\n\tcurrentShare: number;\n\n\t/**\n\t * Width of previous bar, as % of the current value. Omit when this row has\n\t * no matching comparison-period value.\n\t */\n\tpreviousShare?: number;\n\n\t/**\n\t * Delta of the entry. Omit when the percentage change is unavailable, such\n\t * as when the row has no comparison value or its previous value is zero.\n\t */\n\tdelta?: number;\n\n\t/**\n\t * Optional color for the entry's image/icon\n\t */\n\timageColor?: string;\n\n\t/**\n\t * Optional click handler. When provided, the entire row becomes an\n\t * interactive `<button>`: clickable and keyboard-focusable (Enter/Space),\n\t * with a chevron affordance revealed on hover/focus. The consumer\n\t * decides what the action does (e.g. drill-down). Rows without onClick are\n\t * inert and render unchanged.\n\t *\n\t * For links or other interactive affordances (external-link icons, info\n\t * tooltips), put them in the `label` render prop instead of using onClick —\n\t * a row is either a button (onClick) or carries interactive label content,\n\t * never both, since interactive elements cannot be nested in HTML.\n\t */\n\tonClick?: ( event: MouseEvent< HTMLButtonElement > ) => void;\n\n\t/**\n\t * Optional accessible name for the interactive row's `<button>`. Only applies\n\t * when `onClick` is set — without it the row renders as a Fragment with no\n\t * element to receive `aria-label`. By default the button derives its name from\n\t * its rendered content (label text plus the formatted value), which is the\n\t * right outcome for plain-text labels. Set this when the `label` is JSX whose\n\t * text content does not yield a clean name on its own — e.g. an image-only\n\t * label — to give assistive tech a deterministic, human-readable name.\n\t */\n\tariaLabel?: string;\n};\n\nexport type GradientStop = {\n\toffset: string;\n\tcolor?: string;\n\topacity?: number;\n};\n\nexport type SeriesDataOptions = {\n\tgradient?: {\n\t\tfrom?: string;\n\t\tto?: string;\n\t\tfromOpacity?: number;\n\t\ttoOpacity?: number;\n\t\tstops?: GradientStop[];\n\t};\n\tstroke?: string;\n\tseriesLineStyle?: LineStyles;\n\tlegendShapeStyle?: CSSProperties;\n\ttype?: 'comparison';\n};\n\nexport type SeriesData = {\n\tgroup?: string;\n\tlabel: string;\n\tdata: DataPointDate[] | DataPoint[];\n\toptions?: SeriesDataOptions;\n};\n\n/**\n * Visual styling for a bar series of a given semantic type (e.g. 'comparison').\n * `widthFactor` is the bar width relative to the primary bar slot (1.5 = 150%);\n * `opacity` sets the shadow translucency.\n */\nexport type BarStyles = {\n\twidthFactor?: number;\n\topacity?: number;\n};\n\nexport type MultipleDataPointsDate = {\n\tlabel: string;\n\tdata: DataPointDate[];\n};\n\n/**\n * Input data point for percentage-based charts (pie, donut, semi-circle).\n * Provide values; percentages will be calculated automatically.\n */\nexport type DataPointPercentage = {\n\t/**\n\t * Label for the data point\n\t */\n\tlabel: string;\n\t/**\n\t * Numerical value used for slice sizing.\n\t * Percentages are calculated automatically from values.\n\t */\n\tvalue: number;\n\t/**\n\t * Formatted value for display (e.g., \"30K\" instead of 30000)\n\t */\n\tvalueDisplay?: string;\n\t/**\n\t * Color code for the segment, by default colours are taken from the theme but this property can overrides it\n\t */\n\tcolor?: string;\n\t/**\n\t * Group for the data point, used to match color with groups on other charts\n\t */\n\tgroup?: string;\n};\n\n/**\n * Internal type with calculated percentage.\n * Used internally after percentage calculation from values.\n */\nexport type DataPointPercentageCalculated = DataPointPercentage & {\n\t/**\n\t * Calculated percentage (0-100) based on value relative to total\n\t */\n\tpercentage: number;\n};\n\n/**\n * Base theme configuration for chart components with optional properties\n */\nexport type ChartTheme = {\n\t/** Background color for chart components */\n\tbackgroundColor: string;\n\t/** Background color for labels */\n\tlabelBackgroundColor?: string;\n\t/** Text color for labels */\n\tlabelTextColor?: string;\n\t/** Array of colors used for data visualization */\n\tcolors: string[];\n\t/** Optional CSS styles for grid lines */\n\tgridStyles?: GridStyles;\n\t/** Length of axis ticks in pixels */\n\ttickLength: number;\n\t/** Color of the grid lines */\n\tgridColor: string;\n\t/** Color of the grid lines in dark mode */\n\tgridColorDark: string;\n\t/** Styles for x-axis tick lines */\n\txTickLineStyles?: LineStyles;\n\t/** Styles for x-axis line */\n\txAxisLineStyles?: LineStyles;\n\t/** Styles for series lines */\n\tseriesLineStyles?: LineStyles[];\n\t/** Array of render functions for glyphs */\n\tglyphs?: Array< < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode >;\n\t/** Legend specific settings */\n\tlegend?: {\n\t\t/** Styles for legend shapes */\n\t\tshapeStyles?: Record< string, unknown >[];\n\t\t/** Styles for legend labels */\n\t\tlabelStyles?: CSSProperties;\n\t\t/** Styles for legend container */\n\t\tcontainerStyles?: CSSProperties;\n\t};\n\t/** Styles for small SVG text (eg. axis tick labels), passed through to the XYChart theme. */\n\tsvgLabelSmall?: TextProps;\n\t/** Styles for large SVG text (eg. axis titles), passed through to the XYChart theme. */\n\tsvgLabelBig?: TextProps;\n\tannotationStyles?: AnnotationStyles;\n\t/** GeoChart specific settings */\n\tgeoChart?: {\n\t\t/** Default fill color for a geo chart feature (e.g. country) with no data */\n\t\tfeatureFillColor?: string;\n\t};\n\t/** LeaderboardChart specific settings */\n\tleaderboardChart?: {\n\t\t/** Gap between rows in the leaderboard grid */\n\t\trowGap?: number;\n\t\t/** Gap between columns in the leaderboard grid */\n\t\tcolumnGap?: number;\n\t\t/** Spacing between label and progress bars */\n\t\tlabelSpacing?: GapSize;\n\t\t/** Primary color for current period bars */\n\t\tprimaryColor?: string;\n\t\t/** Secondary color for comparison period bars */\n\t\tsecondaryColor?: string;\n\t\t/** Delta colors: [negative, neutral, positive] */\n\t\tdeltaColors?: [ string, string, string ];\n\t};\n\t/** ConversionFunnelChart specific settings */\n\tconversionFunnelChart?: {\n\t\t/** Primary color for funnel bars */\n\t\tprimaryColor?: string;\n\t\t/** Background color for chart container */\n\t\tbackgroundColor?: string;\n\t\t/** Color for positive change indicators */\n\t\tpositiveChangeColor?: string;\n\t\t/** Color for negative change indicators */\n\t\tnegativeChangeColor?: string;\n\t};\n\tlineChart?: {\n\t\tlineStyles?: Partial< Record< NonNullable< SeriesDataOptions[ 'type' ] >, LineStyles > >;\n\t};\n\tbarChart?: {\n\t\tbarStyles?: Partial< Record< NonNullable< SeriesDataOptions[ 'type' ] >, BarStyles > >;\n\t};\n\t/** Sparkline specific settings */\n\tsparkline?: {\n\t\t/** Margin around the sparkline chart */\n\t\tmargin?: {\n\t\t\ttop?: number;\n\t\t\tright?: number;\n\t\t\tbottom?: number;\n\t\t\tleft?: number;\n\t\t};\n\t\t/** Stroke width for the sparkline line */\n\t\tstrokeWidth?: number;\n\t};\n\t/**\n\t * HeatmapChart settings. Cell gap, radius, value size and the selection ring come from\n\t * WPDS tokens in CSS, so only the scale color and the compact sizing live here.\n\t */\n\theatmapChart?: {\n\t\t/**\n\t\t * Color the cell scale interpolates toward at the highest value (prop > this >\n\t\t * palette `colors[0]`), fed to CSS `color-mix`. Omit to use the palette color.\n\t\t */\n\t\tprimaryColor?: string;\n\t\t/** Gap in px between cells in compact mode */\n\t\tcompactCellGap?: number;\n\t\t/** Fixed square cell size in px for compact mode */\n\t\tcompactCellSize?: number;\n\t};\n};\n\n/**\n * Theme configuration with all properties guaranteed to be defined.\n * Useful for merged themes where defaults are provided for all optional properties.\n */\nexport type CompleteChartTheme = Required< ChartTheme > & {\n\tleaderboardChart: Omit<\n\t\tRequired< NonNullable< ChartTheme[ 'leaderboardChart' ] > >,\n\t\t'primaryColor' | 'secondaryColor'\n\t> &\n\t\tPick< NonNullable< ChartTheme[ 'leaderboardChart' ] >, 'primaryColor' | 'secondaryColor' >;\n\tconversionFunnelChart: Omit<\n\t\tRequired< NonNullable< ChartTheme[ 'conversionFunnelChart' ] > >,\n\t\t'primaryColor'\n\t> &\n\t\tPick< NonNullable< ChartTheme[ 'conversionFunnelChart' ] >, 'primaryColor' >;\n\tlineChart: {\n\t\tlineStyles: Record< NonNullable< SeriesDataOptions[ 'type' ] >, LineStyles >;\n\t};\n\tbarChart: {\n\t\tbarStyles: Record< NonNullable< SeriesDataOptions[ 'type' ] >, BarStyles >;\n\t};\n\tlegend: Required< NonNullable< ChartTheme[ 'legend' ] > >;\n\tsparkline: Required< NonNullable< ChartTheme[ 'sparkline' ] > > & {\n\t\tmargin: Required< NonNullable< ChartTheme[ 'sparkline' ] >[ 'margin' ] >;\n\t};\n\theatmapChart: Omit< Required< NonNullable< ChartTheme[ 'heatmapChart' ] > >, 'primaryColor' > &\n\t\tPick< NonNullable< ChartTheme[ 'heatmapChart' ] >, 'primaryColor' >;\n};\n\n/**\n * Bucket resolution of time-series data, as known by the caller (e.g. a\n * granularity selector), for consumers that don't need to infer it.\n */\nexport type TickResolution = 'hour' | 'day' | 'week' | 'month' | 'year';\n\nexport type AxisOptions = {\n\torientation?: OrientationType;\n\tnumTicks?: number;\n\t/**\n\t * Explicit tick values for the axis. When set, takes precedence over `numTicks`\n\t * so callers can force a specific axis (e.g. integer-only steps on a sparse chart).\n\t */\n\ttickValues?: ScaleInput< AxisScale >[];\n\taxisClassName?: string;\n\taxisLineClassName?: string;\n\tlabelClassName?: string;\n\ttickClassName?: string;\n\ttickFormat?: TickFormatter< ScaleInput< AxisScale > >;\n\t/**\n\t * Bucket resolution of the data, set on whichever axis carries the dates.\n\t * When set, the automatic tick formatter derives tick formats from it\n\t * directly instead of inferring the resolution from point spacing. For\n\t * daily-or-finer buckets the overall time span still constrains the choice —\n\t * e.g. hourly buckets spanning more than a week get date ticks, since hour\n\t * ticks would be unreadable at that span. Ignored when `tickFormat` is set.\n\t */\n\ttickResolution?: TickResolution;\n\t/**\n\t * Whether to display this axis. Defaults to true.\n\t */\n\tdisplay?: boolean;\n\t/**\n\t * For more control over rendering or to add event handlers to datum, pass a function as children.\n\t */\n\tchildren?: ( renderProps: AxisRendererProps< AxisScale > ) => ReactNode;\n\t/**\n\t * Controls tick label overflow (bar charts only):\n\t *\n\t * - 'ellipsis': Truncate with ellipsis and fit to available space. Labels show full text\n\t * on hover via native tooltip. Note: A minimum width (20px) is enforced for readability.\n\t * On very dense charts (bandwidth < 20px), adjacent labels may overlap. To mitigate, use `numTicks`\n\t * to reduce labels or `tickFormat` to abbreviate text.\n\t * - undefined: No truncation; labels may overlap.\n\t *\n\t * Default: No truncation; labels may overlap.\n\t */\n\tlabelOverflow?: 'ellipsis';\n};\n\nexport type ScaleOptions = {\n\ttype?: ScaleType;\n\tzero?: boolean;\n\t/**\n\t * Extends the scale's domain to nice round values. Pass `false` together with\n\t * an explicit `domain` to keep the tick values you set exactly.\n\t */\n\tnice?: boolean;\n\tdomain?: [ number, number ] | [ Date, Date ];\n\trange?: [ number, number ];\n\t/**\n\t * For band scale, shortcut for setting `paddingInner` and `paddingOuter` to the same value.\n\t *\n\t * For point scale, the outer padding (spacing) at the ends of the range.\n\t * This is similar to band scale's `paddingOuter`.\n\t *\n\t */\n\tpadding?: number;\n\t/**\n\t * The inner padding (spacing) within each band step of band scales, as a fraction of the step size. This value must lie in the range [0,1].\n\t *\n\t */\n\tpaddingInner?: number;\n\t/**\n\t * The outer padding (spacing) at the ends of the range of band and point scales,\n\t * as a fraction of the step size. This value must lie in the range [0,1].\n\t *\n\t */\n\tpaddingOuter?: number;\n};\n\nexport type LegendItemStyles = {\n\t/** Margin around each legend item. */\n\tmargin?: CSSProperties[ 'margin' ];\n\t/** Flex direction for items within each legend entry. */\n\tflexDirection?: 'row' | 'row-reverse' | 'column' | 'column-reverse';\n};\n\nexport type LegendLabelStyles = Pick< CSSProperties, 'justifyContent' | 'flex' | 'margin' > & {\n\t/**\n\t * Maximum width for legend label text as a CSS value (e.g. '200px', '50%', '10rem').\n\t * When set, text overflow behavior is controlled by textOverflow.\n\t */\n\tmaxWidth?: string;\n\t/**\n\t * Controls how text behaves when it exceeds maxWidth.\n\t * - 'ellipsis': Truncate with ellipsis (ideal for widgets/small devices)\n\t * - 'wrap': Wrap text to multiple lines (default, ideal for larger displays)\n\t */\n\ttextOverflow?: 'ellipsis' | 'wrap';\n};\n\nexport type LegendShapeStyles = {\n\t/** Width of the legend shape in pixels. */\n\twidth?: number;\n\t/** Height of the legend shape in pixels. */\n\theight?: number;\n\t/** Margin around the legend shape. */\n\tmargin?: CSSProperties[ 'margin' ];\n};\n\n/** Position of the legend relative to chart content. */\nexport type LegendPosition = 'top' | 'bottom';\n\n/**\n * Configuration object for chart legend appearance and behavior.\n * Consolidates all legend styling and layout props into a single structured object.\n */\nexport type ChartLegendConfig< T = DataPoint | DataPointDate | LeaderboardEntry > = {\n\t/**\n\t * Layout direction of legend items.\n\t */\n\torientation?: 'horizontal' | 'vertical';\n\t/**\n\t * Position of the legend relative to the chart.\n\t * TODO: Add 'left' | 'right' positioning support in future implementation\n\t */\n\tposition?: LegendPosition;\n\t/**\n\t * Alignment of the legend within its position.\n\t */\n\talignment?: 'start' | 'center' | 'end';\n\t/**\n\t * Shape of the legend marker icon.\n\t */\n\tshape?: LegendShape< T, number >;\n\t/**\n\t * Enable interactive legend items that can toggle series visibility.\n\t * Supported for all chart types that render series.\n\t * Requires chartId and GlobalChartsProvider.\n\t * For pie charts, percentages are recalculated so visible segments total 100%.\n\t */\n\tinteractive?: boolean;\n\t/**\n\t * Additional CSS class name for individual legend items.\n\t */\n\titemClassName?: string;\n\t/**\n\t * CSS styles for each legend item (margin, flexDirection).\n\t */\n\titemStyles?: LegendItemStyles;\n\t/**\n\t * CSS styles for legend labels (maxWidth, textOverflow, justifyContent, flex, margin).\n\t */\n\tlabelStyles?: LegendLabelStyles;\n\t/**\n\t * Styles for legend shapes (width, height, margin).\n\t */\n\tshapeStyles?: LegendShapeStyles;\n};\n\n/**\n * Legend config for charts built from `SeriesData` (line, bar, area). Adds `collapseGroups` on top\n * of the shared config. It is intentionally absent from the base `ChartLegendConfig` so point-based\n * charts (pie, semi-circle pie) — whose data points carry `group` only to coordinate colours — can't\n * set it.\n */\nexport type SeriesChartLegendConfig = ChartLegendConfig< SeriesData[] > & {\n\t/**\n\t * Collapse series that share a `group` into a single legend item, labelled by the group's\n\t * primary series (its first non-comparison member). Off by default, so every series keeps its\n\t * own item. Combines with `interactive`: a collapsed item toggles every series in its group, an\n\t * uncollapsed one toggles only its own.\n\t */\n\tcollapseGroups?: boolean;\n};\n\n/**\n * Initial visibility options for charts built from labelled series.\n */\nexport interface SeriesVisibilityProps {\n\t/**\n\t * Series labels to hide from the first defined value. User changes persist until\n\t * the chart remounts or its ID changes; later values for the same ID are ignored.\n\t * Omit to retain the provider's existing visibility for the chart ID.\n\t */\n\tdefaultHiddenSeries?: readonly string[];\n}\n\n/**\n * Base properties shared across all chart components\n */\nexport type BaseChartProps< T = DataPoint | DataPointDate | LeaderboardEntry > = {\n\t/**\n\t * Array of data points to display in the chart\n\t */\n\tdata: T extends DataPoint | DataPointDate | LeaderboardEntry ? T[] : T;\n\t/**\n\t * Optional unique identifier for the chart (auto-generated if not provided)\n\t */\n\tchartId?: string;\n\t/**\n\t * Additional CSS class name for the chart container\n\t */\n\tclassName?: string;\n\t/**\n\t * Width of the chart container in pixels. When omitted, the chart fills its parent's width.\n\t */\n\twidth?: number;\n\t/**\n\t * Height of the chart container in pixels. When omitted, the chart fills its parent's height.\n\t */\n\theight?: number;\n\t/**\n\t * Maximum diameter of the pie in pixels (pie and donut charts only).\n\t * The pie will shrink if the container is smaller than this value.\n\t * When omitted, the pie fills the available space.\n\t */\n\tsize?: number;\n\t/**\n\t * Chart margins\n\t */\n\tmargin?: {\n\t\ttop?: number;\n\t\tright?: number;\n\t\tbottom?: number;\n\t\tleft?: number;\n\t};\n\t/**\n\t * Callback function for pointer down event\n\t */\n\tonPointerDown?: ( event: EventHandlerParams< DataPoint | DataPointDate > ) => void;\n\t/**\n\t * Callback function for pointer up event\n\t */\n\tonPointerUp?: ( event: EventHandlerParams< DataPoint | DataPointDate > ) => void;\n\t/**\n\t * Callback function for pointer move event\n\t */\n\tonPointerMove?: ( event: EventHandlerParams< DataPoint | DataPointDate > ) => void;\n\t/**\n\t * Callback function for pointer out event\n\t */\n\tonPointerOut?: ( event: PointerEvent< Element > ) => void;\n\t/**\n\t * Whether to show tooltips on hover. False by default.\n\t */\n\twithTooltips?: boolean;\n\t/**\n\t * Whether to show legend\n\t */\n\tshowLegend?: boolean;\n\t/**\n\t * Legend configuration object for controlling legend appearance and behavior.\n\t * Includes orientation, position, alignment, shape, styling, and interactivity options.\n\t */\n\tlegend?: ChartLegendConfig< T >;\n\t/**\n\t * Grid visibility. x is default when orientation is vertical. y is default when orientation is horizontal.\n\t */\n\tgridVisibility?: 'x' | 'y' | 'xy' | 'none';\n\t/**\n\t * Whether to show chart animation on initial render or not\n\t */\n\tanimation?: boolean;\n\n\t/**\n\t * Gap between chart elements (SVG, legend, children).\n\t * Uses WordPress design system tokens.\n\t * @default 'md'\n\t */\n\tgap?: GapSize;\n\n\t/**\n\t * More options for the chart.\n\t */\n\toptions?: {\n\t\tyScale?: ScaleOptions;\n\t\txScale?: ScaleOptions;\n\t\taxis?: {\n\t\t\tx?: AxisOptions;\n\t\t\ty?: AxisOptions;\n\t\t};\n\t};\n};\n\n/**\n * Local type definitions for Popover API attributes and events\n * These are used to avoid extending React module types while still getting type safety\n * NOTE: These type definitions are only needed for React 18 and below.\n * React 19+ includes Popover API types in the official React type definitions, so these can be removed when upgrading.\n */\nexport interface PopoverButtonAttributes {\n\tpopovertarget?: string;\n\tpopovertargetaction?: 'hide' | 'show' | 'toggle';\n}\n\nexport interface PopoverElementAttributes {\n\tpopover?: 'auto' | 'manual' | '';\n}\n\n// Combined types for spreading into JSX elements\nexport type ButtonWithPopover = PopoverButtonAttributes;\nexport type PopoverElement = PopoverElementAttributes;\n\n// ToggleEvent for native Popover API\nexport interface ToggleEvent extends Event {\n\tnewState: 'open' | 'closed';\n\toldState: 'open' | 'closed';\n}\n","import type { HeatmapColumn } from '../types';\n\nexport const isPresent = ( value: number | null | undefined ): value is number =>\n\tvalue !== null && value !== undefined && ! isNaN( value );\n\n/**\n * Get the min and max values from heatmap data, ignoring null/NaN.\n * @param data - The heatmap columns\n * @return Tuple of [min, max] values\n */\nexport const getValueExtent = ( data: HeatmapColumn[] ): [ number, number ] => {\n\tlet min = Infinity;\n\tlet max = -Infinity;\n\tfor ( const column of data ) {\n\t\tfor ( const cell of column.data ) {\n\t\t\tif ( ! isPresent( cell.value ) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif ( cell.value < min ) {\n\t\t\t\tmin = cell.value;\n\t\t\t}\n\t\t\tif ( cell.value > max ) {\n\t\t\t\tmax = cell.value;\n\t\t\t}\n\t\t}\n\t}\n\tif ( min === Infinity ) {\n\t\treturn [ 0, 0 ];\n\t}\n\treturn [ min, max ];\n};\n\n/**\n * Normalize a value to 0–1 within the extent. A flat extent (min === max)\n * maps to 1 — every cell is equally the \"highest\" — except an all-zero\n * extent, which maps to 0 so a no-activity grid renders at the scale's\n * bottom instead of full intensity.\n *\n * @param value - The value to normalize\n * @param extent - Tuple of [min, max] values for the normalization range\n * @return Normalized value between 0 and 1\n */\nexport const getNormalizedValue = ( value: number, extent: [ number, number ] ): number => {\n\tconst [ min, max ] = extent;\n\tif ( min === max ) {\n\t\treturn max === 0 ? 0 : 1;\n\t}\n\treturn Math.min( 1, Math.max( 0, ( value - min ) / ( max - min ) ) );\n};\n","import { addDays, differenceInCalendarWeeks, format, parseISO, startOfWeek } from 'date-fns';\nimport type { DataPointDate } from '../../../types';\nimport type { HeatmapCell, HeatmapColumn } from '../types';\n\nexport type CalendarHeatmapResult = {\n\tdata: HeatmapColumn[];\n\trowLabels: string[];\n};\n\n/** Rows that get a weekday label (Mon, Wed, Fri with a Monday week start). */\nconst LABELLED_ROWS = [ 0, 2, 4 ];\n\n/**\n * Resolve one grid bound: an unparseable or narrowing value falls back to the\n * series' own bound, so the grid can only ever be widened.\n *\n * @param bound - Requested bound as `yyyy-MM-dd`, if any.\n * @param fallback - The series' own bound on this side.\n * @param direction - Which way the bound is allowed to move.\n * @return The bound to draw to.\n */\nconst widenTo = (\n\tbound: string | undefined,\n\tfallback: Date,\n\tdirection: 'earlier' | 'later'\n): Date => {\n\tif ( ! bound ) {\n\t\treturn fallback;\n\t}\n\n\tconst parsed = parseISO( bound );\n\tif ( isNaN( parsed.getTime() ) ) {\n\t\treturn fallback;\n\t}\n\n\tif ( direction === 'earlier' ) {\n\t\treturn parsed < fallback ? parsed : fallback;\n\t}\n\n\treturn parsed > fallback ? parsed : fallback;\n};\n\nconst toDate = ( point: DataPointDate ): Date | null => {\n\tif ( point.date instanceof Date && ! isNaN( point.date.getTime() ) ) {\n\t\treturn point.date;\n\t}\n\tif ( point.dateString ) {\n\t\tconst parsed = parseISO( point.dateString );\n\t\tif ( ! isNaN( parsed.getTime() ) ) {\n\t\t\treturn parsed;\n\t\t}\n\t}\n\treturn null;\n};\n\nexport const buildCalendarHeatmapData = (\n\tseries: DataPointDate[],\n\toptions: {\n\t\tweekStartsOn?: 0 | 1;\n\t\t/**\n\t\t * Mark the days completing the first/last week outside the series'\n\t\t * date span as hidden cells (empty grid slots) instead of blank\n\t\t * cells, giving the calendar ragged edges. Days inside the span stay\n\t\t * blank cells even when the series has no entry for them.\n\t\t */\n\t\thideOutOfRangeDays?: boolean;\n\t\t/**\n\t\t * Draw the grid over this span (`yyyy-MM-dd` bounds) instead of the\n\t\t * series' own. Days inside the grid but outside the series become\n\t\t * placeholder cells: painted as empty slots so a short series still\n\t\t * fills its container, but reporting nothing, since they were never\n\t\t * measured. A start bound is drawn from the beginning of its week, so\n\t\t * the grid always opens on a whole column. Bounds narrower than the\n\t\t * series are ignored — the grid never drops a day that carries data.\n\t\t */\n\t\tgridSpan?: { start?: string; end?: string };\n\t} = {}\n): CalendarHeatmapResult => {\n\tconst weekStartsOn = options.weekStartsOn ?? 1;\n\tconst hideOutOfRangeDays = options.hideOutOfRangeDays ?? true;\n\n\tconst entries = series\n\t\t.map( point => ( { date: toDate( point ), value: point.value } ) )\n\t\t.filter( ( entry ): entry is { date: Date; value: number | null } => entry.date !== null );\n\n\tif ( ! entries.length ) {\n\t\treturn { data: [], rowLabels: [] };\n\t}\n\n\tconst valueByDay = new Map< string, number | null >();\n\tlet minDate = entries[ 0 ].date;\n\tlet maxDate = entries[ 0 ].date;\n\tfor ( const { date, value } of entries ) {\n\t\tvalueByDay.set( format( date, 'yyyy-MM-dd' ), value );\n\t\tif ( date < minDate ) {\n\t\t\tminDate = date;\n\t\t}\n\t\tif ( date > maxDate ) {\n\t\t\tmaxDate = date;\n\t\t}\n\t}\n\n\t// Day-key bounds for the ragged-edge option: calendar-day comparison, so\n\t// entries carrying a time of day can't shift the span.\n\tconst minDayKey = format( minDate, 'yyyy-MM-dd' );\n\tconst maxDayKey = format( maxDate, 'yyyy-MM-dd' );\n\n\t// The grid may run wider than the series, never narrower: a bound that would\n\t// cut into the data is dropped rather than honoured.\n\tconst gridMinDate = widenTo( options.gridSpan?.start, minDate, 'earlier' );\n\tconst gridMaxDate = widenTo( options.gridSpan?.end, maxDate, 'later' );\n\n\tconst gridMaxDayKey = format( gridMaxDate, 'yyyy-MM-dd' );\n\n\tconst gridStart = startOfWeek( gridMinDate, { weekStartsOn } );\n\n\t// A start bound rarely lands on a week start, and `gridStart` rounds it down.\n\t// The days it rounds past were no more measured than the rest of the widened\n\t// span, so they are filler too; treating them as a ragged edge instead would\n\t// notch the first column by however far the bound sat into its week.\n\tconst gridMinDayKey = format( gridMinDate < minDate ? gridStart : gridMinDate, 'yyyy-MM-dd' );\n\tconst weekCount = differenceInCalendarWeeks( gridMaxDate, gridStart, { weekStartsOn } ) + 1;\n\n\tconst rowLabels = Array.from( { length: 7 }, ( _, row ) =>\n\t\tLABELLED_ROWS.includes( row ) ? format( addDays( gridStart, row ), 'EEE' ) : ''\n\t);\n\n\t// Hide short partial first-month labels when a later month follows; compact\n\t// cells make adjacent labels collide. Keep the label for single-month ranges.\n\tconst MIN_FIRST_MONTH_WEEKS = 2;\n\tconst firstMonth = gridStart.getMonth();\n\tlet firstMonthWeeks = 0;\n\twhile (\n\t\tfirstMonthWeeks < weekCount &&\n\t\taddDays( gridStart, firstMonthWeeks * 7 ).getMonth() === firstMonth\n\t) {\n\t\tfirstMonthWeeks++;\n\t}\n\tconst spansLaterMonth = firstMonthWeeks < weekCount;\n\tconst showFirstMonthLabel = ! spansLaterMonth || firstMonthWeeks >= MIN_FIRST_MONTH_WEEKS;\n\n\tconst data: HeatmapColumn[] = [];\n\tlet previousMonth = -1;\n\tfor ( let week = 0; week < weekCount; week++ ) {\n\t\tconst columnStart = addDays( gridStart, week * 7 );\n\t\tconst month = columnStart.getMonth();\n\t\tconst isNewMonth = month !== previousMonth;\n\t\tconst label =\n\t\t\tisNewMonth && ( week !== 0 || showFirstMonthLabel ) ? format( columnStart, 'MMM' ) : '';\n\t\tpreviousMonth = month;\n\n\t\tconst cells: HeatmapCell[] = [];\n\t\tfor ( let row = 0; row < 7; row++ ) {\n\t\t\tconst day = addDays( gridStart, week * 7 + row );\n\t\t\tconst key = format( day, 'yyyy-MM-dd' );\n\t\t\tconst cell: HeatmapCell = {\n\t\t\t\tlabel: format( day, 'EEE, MMM d, yyyy' ),\n\t\t\t\tvalue: valueByDay.has( key ) ? ( valueByDay.get( key ) as number | null ) : null,\n\t\t\t};\n\t\t\tif ( key < gridMinDayKey || key > gridMaxDayKey ) {\n\t\t\t\t// The days completing the grid's first/last week: the calendar's\n\t\t\t\t// ragged edge.\n\t\t\t\tif ( hideOutOfRangeDays ) {\n\t\t\t\t\tcell.hidden = true;\n\t\t\t\t}\n\t\t\t} else if ( key < minDayKey || key > maxDayKey ) {\n\t\t\t\t// Inside the grid the caller asked for, outside the series: filler.\n\t\t\t\tcell.placeholder = true;\n\t\t\t}\n\t\t\tcells.push( cell );\n\t\t}\n\t\tdata.push( { label, data: cells } );\n\t}\n\n\treturn { data, rowLabels };\n};\n","import { createContext } from 'react';\n\nexport type HeatmapContextValue = {\n\textent: [ number, number ];\n\t/** The resolved primary color (full intensity); the legend mixes toward it in CSS. */\n\tprimaryColorHex: string;\n};\n\n/** Shared by the chart and legend without importing back from `heatmap-chart.tsx`. */\nexport const HeatmapContext = createContext< HeatmapContextValue | null >( null );\n","import { __ } from '@wordpress/i18n';\nimport { Stack, Text } from '@wordpress/ui';\nimport { useContext } from 'react';\nimport { useGlobalChartsTheme } from '../../../providers';\nimport styles from '../heatmap-chart.module.scss';\nimport { HeatmapContext } from './heatmap-context';\nimport type { CSSProperties, FC } from 'react';\n\nexport interface HeatmapLegendProps {\n\t/** Number of swatches in the scale. Default 5. */\n\tsteps?: number;\n\tlessLabel?: string;\n\tmoreLabel?: string;\n}\n\nexport const HeatmapLegend: FC< HeatmapLegendProps > = ( { steps = 5, lessLabel, moreLabel } ) => {\n\tconst context = useContext( HeatmapContext );\n\tconst { legend, backgroundColor } = useGlobalChartsTheme();\n\tif ( ! context ) {\n\t\treturn null;\n\t}\n\tconst { primaryColorHex } = context;\n\tconst labelStyle = legend.labelStyles;\n\n\treturn (\n\t\t<Stack direction=\"row\" gap=\"xs\" align=\"center\">\n\t\t\t<Text variant=\"body-sm\" style={ labelStyle }>\n\t\t\t\t{ lessLabel ?? __( 'Less', 'jetpack-charts' ) }\n\t\t\t</Text>\n\t\t\t<Stack direction=\"row\" gap=\"xs\">\n\t\t\t\t{ Array.from( { length: steps }, ( _, index ) => {\n\t\t\t\t\tconst intensity = steps <= 1 ? 1 : index / ( steps - 1 );\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\tclassName={ styles[ 'heatmap-chart__legend-swatch' ] }\n\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'--a8c-charts-color-heatmap-primary': primaryColorHex,\n\t\t\t\t\t\t\t\t\t'--a8c-charts-color-heatmap-background': backgroundColor,\n\t\t\t\t\t\t\t\t\t'--a8c-charts-heatmap-cell-intensity': intensity,\n\t\t\t\t\t\t\t\t} as CSSProperties\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</Stack>\n\t\t\t<Text variant=\"body-sm\" style={ labelStyle }>\n\t\t\t\t{ moreLabel ?? __( 'More', 'jetpack-charts' ) }\n\t\t\t</Text>\n\t\t</Stack>\n\t);\n};\n","import { formatNumber, formatNumberCompact } from '@automattic/number-formatters';\nimport { useTooltip, useTooltipInPortal } from '@visx/tooltip';\nimport { __ } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';\nimport {\n\tGlobalChartsProvider,\n\tuseChartId,\n\tuseChartScopeElement,\n\tuseGlobalChartsContext,\n\tGlobalChartsContext,\n} from '../../providers';\nimport { CHART_SCOPE_CLASS } from '../../styles/chart-scope-class';\nimport { attachSubComponents } from '../../utils';\nimport {\n\tisValidHexColor,\n\tmixHexColors,\n\tnormalizeColorToHex,\n\tprefersLightText,\n} from '../../utils/color-utils';\nimport { resolveCssVariable } from '../../utils/resolve-css-var';\nimport { Center } from '../private/center';\nimport { useChartChildren } from '../private/chart-composition';\nimport { ChartInstanceContext } from '../private/chart-instance-context';\nimport { ChartLayout } from '../private/chart-layout';\nimport { withResponsive } from '../private/with-responsive';\nimport styles from './heatmap-chart.module.scss';\nimport {\n\tgetValueExtent,\n\tgetNormalizedValue,\n\tHeatmapContext,\n\tHeatmapLegend,\n\tisPresent,\n} from './private';\nimport type { HeatmapContextValue } from './private';\nimport type { HeatmapChartProps, HeatmapTooltipData } from './types';\nimport type { ResponsiveConfig } from '../private/with-responsive';\nimport type { CSSProperties, FC } from 'react';\n\n// Mirrors the color-mix floor in heatmap-chart.module.scss (.heatmap-chart__cell--filled):\n// the rendered fill is the primary mixed over the chart background at 0.15 + 0.85 * intensity.\nconst CELL_MIX_FLOOR = 0.15;\n\nconst HeatmapChartInternal: FC< HeatmapChartProps > = ( {\n\tdata,\n\tchartId: providedChartId,\n\twidth = 0,\n\theight = 0,\n\tclassName,\n\tcompact = false,\n\tshowValues,\n\tmaxCellWidth,\n\tmaxCellHeight,\n\tminCellWidth,\n\tminCellHeight,\n\trowLabels = [],\n\tprimaryColor,\n\tgap = 'md',\n\twithTooltips = false,\n\trenderTooltip,\n\tchildren,\n} ) => {\n\tconst chartId = useChartId( providedChartId );\n\tconst { getElementStyles, theme } = useGlobalChartsContext();\n\tconst scopeElement = useChartScopeElement();\n\tconst { heatmapChart: heatmapChartSettings } = theme;\n\tconst { nonLegendChildren } = useChartChildren( children, 'HeatmapChart' );\n\n\tconst [ selectedIndex, setSelectedIndex ] = useState< number | undefined >();\n\tconst { tooltipOpen, tooltipLeft, tooltipTop, tooltipData, showTooltip, hideTooltip } =\n\t\tuseTooltip< HeatmapTooltipData >();\n\tconst { containerRef, containerBounds, TooltipInPortal } = useTooltipInPortal( {\n\t\tdetectBounds: true,\n\t\tscroll: true,\n\t} );\n\t// Read from a ref so the keyboard-tooltip effect doesn't depend on containerBounds, which\n\t// is a new object each render and would loop the effect via showTooltip.\n\tconst containerBoundsRef = useRef( containerBounds );\n\tcontainerBoundsRef.current = containerBounds;\n\n\tconst { color: primaryColorHex } = getElementStyles( {\n\t\tindex: 0,\n\t\toverrideColor: primaryColor || heatmapChartSettings.primaryColor,\n\t} );\n\n\t// Resolve the background against this chart's own scope element (not the provider's), matching where `--a8c-charts-color-heatmap-background` is substituted for the cell blend below — a chart-level override otherwise disagrees with a provider-level read.\n\tconst chartBackgroundHex = normalizeColorToHex(\n\t\ttheme.backgroundColor,\n\t\tscopeElement,\n\t\tresolveCssVariable\n\t);\n\n\t// Choose text color from the blended fill, not the raw value.\n\t// If either color cannot resolve to hex, keep dark text.\n\tconst primaryHex = normalizeColorToHex( primaryColorHex );\n\tconst cellHasLightText = ( intensity: number ): boolean =>\n\t\tisValidHexColor( primaryHex ) &&\n\t\tisValidHexColor( chartBackgroundHex ) &&\n\t\tprefersLightText(\n\t\t\tmixHexColors(\n\t\t\t\tprimaryHex,\n\t\t\t\tchartBackgroundHex,\n\t\t\t\t1 - ( CELL_MIX_FLOOR + ( 1 - CELL_MIX_FLOOR ) * intensity )\n\t\t\t)\n\t\t);\n\n\tconst extent = useMemo( () => getValueExtent( data ), [ data ] );\n\tconst heatmapContext = useMemo< HeatmapContextValue >(\n\t\t() => ( { extent, primaryColorHex } ),\n\t\t[ extent, primaryColorHex ]\n\t);\n\n\tconst columns = data.length;\n\tconst rows = Math.max( 0, ...data.map( column => column.data.length ) );\n\n\tconst { compactCellGap, compactCellSize } = heatmapChartSettings;\n\tconst drawValues = showValues ?? ! compact;\n\n\tconst buildTooltipData = useCallback(\n\t\t( columnIndex: number, rowIndex: number ): HeatmapTooltipData => {\n\t\t\tconst cell = data[ columnIndex ]?.data[ rowIndex ];\n\t\t\treturn {\n\t\t\t\tvalue: cell?.value ?? null,\n\t\t\t\trowLabel: rowLabels[ rowIndex ],\n\t\t\t\tcolumnLabel: data[ columnIndex ]?.label,\n\t\t\t\tcellLabel: cell?.label,\n\t\t\t\trow: rowIndex,\n\t\t\t\tcolumn: columnIndex,\n\t\t\t};\n\t\t},\n\t\t[ data, rowLabels ]\n\t);\n\n\tconst onChartBlur = useCallback( () => {\n\t\tsetSelectedIndex( undefined );\n\t\thideTooltip();\n\t}, [ hideTooltip ] );\n\n\t// Both empty-slot kinds are skipped by navigation: `hidden` paints nothing,\n\t// `placeholder` paints an empty cell, and neither has a value to report.\n\tconst isCellInert = useCallback(\n\t\t( col: number, row: number ) => {\n\t\t\tconst cell = data[ col ]?.data[ row ];\n\t\t\treturn cell?.hidden === true || cell?.placeholder === true;\n\t\t},\n\t\t[ data ]\n\t);\n\n\tconst onChartKeyDown = useCallback(\n\t\t( event: React.KeyboardEvent< HTMLDivElement > ) => {\n\t\t\tif (\n\t\t\t\t! [ 'ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Escape', 'Tab' ].includes(\n\t\t\t\t\tevent.key\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( event.key === 'Tab' || event.key === 'Escape' ) {\n\t\t\t\tsetSelectedIndex( undefined );\n\t\t\t\thideTooltip();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tevent.preventDefault();\n\n\t\t\tif ( selectedIndex === undefined ) {\n\t\t\t\t// Start at the first navigable cell (a calendar's leading edge\n\t\t\t\t// slots may be hidden).\n\t\t\t\tfor ( let index = 0; index < columns * rows; index++ ) {\n\t\t\t\t\tif ( ! isCellInert( Math.floor( index / rows ), index % rows ) ) {\n\t\t\t\t\t\tsetSelectedIndex( index );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet stepCol = 0;\n\t\t\tlet stepRow = 0;\n\t\t\tif ( event.key === 'ArrowRight' ) {\n\t\t\t\tstepCol = 1;\n\t\t\t} else if ( event.key === 'ArrowLeft' ) {\n\t\t\t\tstepCol = -1;\n\t\t\t} else if ( event.key === 'ArrowDown' ) {\n\t\t\t\tstepRow = 1;\n\t\t\t} else if ( event.key === 'ArrowUp' ) {\n\t\t\t\tstepRow = -1;\n\t\t\t}\n\n\t\t\t// Step past hidden slots to the next navigable cell in the pressed\n\t\t\t// direction; when only hidden slots (or the edge) remain that way,\n\t\t\t// the selection stays put.\n\t\t\tlet col = Math.floor( selectedIndex / rows );\n\t\t\tlet row = selectedIndex % rows;\n\t\t\tdo {\n\t\t\t\tcol += stepCol;\n\t\t\t\trow += stepRow;\n\t\t\t} while ( col >= 0 && col < columns && row >= 0 && row < rows && isCellInert( col, row ) );\n\n\t\t\tif ( col < 0 || col >= columns || row < 0 || row >= rows ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsetSelectedIndex( col * rows + row );\n\t\t},\n\t\t[ rows, columns, selectedIndex, hideTooltip, isCellInert ]\n\t);\n\n\tconst handleCellMouseMove = useCallback(\n\t\t( event: React.MouseEvent< HTMLDivElement > ) => {\n\t\t\tif ( ! withTooltips ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst target = event.currentTarget;\n\t\t\tconst columnIndex = Number( target.dataset.column );\n\t\t\tconst rowIndex = Number( target.dataset.row );\n\t\t\t// Read bounds from the ref (like the keyboard-tooltip effect) so this\n\t\t\t// callback stays stable across renders.\n\t\t\tconst bounds = containerBoundsRef.current;\n\t\t\t// TooltipInPortal re-adds containerBounds, so subtract it to land at the cursor.\n\t\t\tshowTooltip( {\n\t\t\t\ttooltipLeft: event.clientX - bounds.left,\n\t\t\t\ttooltipTop: event.clientY - bounds.top,\n\t\t\t\ttooltipData: buildTooltipData( columnIndex, rowIndex ),\n\t\t\t} );\n\t\t},\n\t\t[ withTooltips, showTooltip, buildTooltipData ]\n\t);\n\n\tconst handleCellMouseLeave = useCallback( () => {\n\t\t// Keyboard selection owns the tooltip; don't let a mouse-out clear it.\n\t\tif ( withTooltips && selectedIndex === undefined ) {\n\t\t\thideTooltip();\n\t\t}\n\t}, [ withTooltips, selectedIndex, hideTooltip ] );\n\n\t// Anchor the tooltip at the selected cell's center on keyboard nav. Cleared on blur/Escape,\n\t// not here, so a mouse hover (no selection) isn't affected.\n\tuseEffect( () => {\n\t\tif ( ! withTooltips || selectedIndex === undefined ) {\n\t\t\treturn;\n\t\t}\n\t\tconst col = Math.floor( selectedIndex / rows );\n\t\tconst row = selectedIndex % rows;\n\t\tconst cell =\n\t\t\ttypeof document !== 'undefined'\n\t\t\t\t? document.getElementById( `${ chartId }-cell-${ col }-${ row }` )\n\t\t\t\t: null;\n\t\tconst rect = cell?.getBoundingClientRect();\n\t\tconst bounds = containerBoundsRef.current;\n\t\tshowTooltip( {\n\t\t\ttooltipLeft: rect ? rect.left + rect.width / 2 - bounds.left : 0,\n\t\t\ttooltipTop: rect ? rect.top + rect.height / 2 - bounds.top : 0,\n\t\t\ttooltipData: buildTooltipData( col, row ),\n\t\t} );\n\t}, [ selectedIndex, withTooltips, rows, chartId, buildTooltipData, showTooltip ] );\n\n\tconst defaultRenderTooltip = useCallback(\n\t\t( info: HeatmapTooltipData ) => (\n\t\t\t<div>\n\t\t\t\t<strong>\n\t\t\t\t\t{ info.cellLabel || `${ info.columnLabel ?? '' } ${ info.rowLabel ?? '' }`.trim() }\n\t\t\t\t</strong>\n\t\t\t\t<div>\n\t\t\t\t\t{ info.value === null ? __( 'No data', 'jetpack-charts' ) : formatNumber( info.value ) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t),\n\t\t[]\n\t);\n\n\tif ( ! columns || ! rows ) {\n\t\treturn (\n\t\t\t<Center\n\t\t\t\tclassName={ clsx( 'heatmap-chart', styles[ 'heatmap-chart' ], className ) }\n\t\t\t\tstyle={ { width: width || undefined, height: height || undefined } }\n\t\t\t\tdata-testid=\"heatmap-chart\"\n\t\t\t>\n\t\t\t\t<span className={ styles[ 'heatmap-chart__empty' ] }>\n\t\t\t\t\t{ __( 'No data available', 'jetpack-charts' ) }\n\t\t\t\t</span>\n\t\t\t</Center>\n\t\t);\n\t}\n\n\t// Non-compact tracks split the container by default; a max cap makes them\n\t// stop growing there instead, so sparse ranges keep sensible cell sizes,\n\t// and a min floor makes the grid overflow (for a scrollable wrapper)\n\t// rather than crushing cells on long ranges.\n\tconst columnTrack = compact\n\t\t? 'var(--a8c-charts-dimension-heatmap-cell-size)'\n\t\t: `minmax(${ minCellWidth ?? 0 }px, ${ maxCellWidth ? `${ maxCellWidth }px` : '1fr' })`;\n\tconst rowTrack = compact\n\t\t? 'var(--a8c-charts-dimension-heatmap-cell-size)'\n\t\t: `minmax(${ minCellHeight ?? 0 }px, ${ maxCellHeight ? `${ maxCellHeight }px` : '1fr' })`;\n\tconst gridStyle: Record< string, string | number > = {\n\t\t'--a8c-charts-color-heatmap-primary': primaryColorHex,\n\t\t'--a8c-charts-color-heatmap-background': theme.backgroundColor,\n\t\tgridTemplateColumns: `auto repeat(${ columns }, ${ columnTrack })`,\n\t\tgridTemplateRows: `auto repeat(${ rows }, ${ rowTrack })`,\n\t};\n\tif ( compact ) {\n\t\tgridStyle[ '--a8c-charts-dimension-heatmap-cell-gap' ] = `${ compactCellGap }px`;\n\t\tgridStyle[ '--a8c-charts-dimension-heatmap-cell-size' ] = `${ compactCellSize }px`;\n\t}\n\n\tconst activeDescendant =\n\t\tselectedIndex !== undefined\n\t\t\t? `${ chartId }-cell-${ Math.floor( selectedIndex / rows ) }-${ selectedIndex % rows }`\n\t\t\t: undefined;\n\n\t// A capped row track makes the chart content-sized vertically: neither the\n\t// wrapper nor the grid stretches, or the leftover container height would\n\t// land in the auto label row. A width-only cap must keep the normal vertical\n\t// flex sizing, so it does not opt into this class.\n\tconst heightCapped = ! compact && Boolean( maxCellHeight );\n\n\treturn (\n\t\t<HeatmapContext.Provider value={ heatmapContext }>\n\t\t\t<ChartInstanceContext.Provider value={ { chartId } }>\n\t\t\t\t<ChartLayout\n\t\t\t\t\tlegendPosition=\"bottom\"\n\t\t\t\t\t// Legend renders via trailingContent, not the legend slot.\n\t\t\t\t\tlegendChildren={ [] }\n\t\t\t\t\ttrailingContent={ nonLegendChildren }\n\t\t\t\t\tgap={ gap }\n\t\t\t\t\tclassName={ clsx( 'heatmap-chart', styles[ 'heatmap-chart' ], className, {\n\t\t\t\t\t\t[ styles[ 'heatmap-chart--height-capped' ] ]: heightCapped,\n\t\t\t\t\t} ) }\n\t\t\t\t\t// Explicit dimensions (the unresponsive export) pin the size; otherwise\n\t\t\t\t\t// width/height are unset and the grid fills its container via CSS. The\n\t\t\t\t\t// responsive export drops the measured pixels so reflow stays fluid.\n\t\t\t\t\tstyle={ { width: width || undefined, height: height || undefined } }\n\t\t\t\t\tdata-testid=\"heatmap-chart\"\n\t\t\t\t\tdata-chart-id={ `heatmap-chart-${ chartId }` }\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tref={ containerRef }\n\t\t\t\t\t\trole=\"grid\"\n\t\t\t\t\t\taria-label={ __( 'Heatmap chart', 'jetpack-charts' ) }\n\t\t\t\t\t\taria-rowcount={ rows }\n\t\t\t\t\t\taria-colcount={ columns }\n\t\t\t\t\t\taria-activedescendant={ activeDescendant }\n\t\t\t\t\t\ttabIndex={ 0 }\n\t\t\t\t\t\tonBlur={ onChartBlur }\n\t\t\t\t\t\tonKeyDown={ onChartKeyDown }\n\t\t\t\t\t\tclassName={ clsx( styles[ 'heatmap-chart__grid' ], {\n\t\t\t\t\t\t\t[ styles[ 'heatmap-chart__grid--compact' ] ]: compact,\n\t\t\t\t\t\t\t[ styles[ 'heatmap-chart__grid--height-capped' ] ]: heightCapped,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t\tstyle={ gridStyle as CSSProperties }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ /* Header row preserves the grid structure; cell aria-labels include this text. */ }\n\t\t\t\t\t\t<div role=\"row\" aria-hidden=\"true\" className={ styles[ 'heatmap-chart__row' ] }>\n\t\t\t\t\t\t\t<span />\n\t\t\t\t\t\t\t{ data.map( ( column, columnIndex ) => (\n\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\tkey={ `col-${ columnIndex }` }\n\t\t\t\t\t\t\t\t\tclassName={ styles[ 'heatmap-chart__col-label' ] }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ column.label }\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t{ Array.from( { length: rows } ).map( ( _row, rowIndex ) => {\n\t\t\t\t\t\t\tconst labelVisible = ! compact || rowIndex % 2 === 0;\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tkey={ `row-${ rowIndex }` }\n\t\t\t\t\t\t\t\t\trole=\"row\"\n\t\t\t\t\t\t\t\t\taria-rowindex={ rowIndex + 1 }\n\t\t\t\t\t\t\t\t\tclassName={ styles[ 'heatmap-chart__row' ] }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<span aria-hidden=\"true\" className={ styles[ 'heatmap-chart__row-label' ] }>\n\t\t\t\t\t\t\t\t\t\t{ labelVisible ? rowLabels[ rowIndex ] ?? '' : '' }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t{ data.map( ( column, columnIndex ) => {\n\t\t\t\t\t\t\t\t\t\tconst cell = column.data[ rowIndex ];\n\n\t\t\t\t\t\t\t\t\t\t// A hidden cell keeps its grid slot (so the rest of the\n\t\t\t\t\t\t\t\t\t\t// column doesn't shift) but paints nothing and takes no\n\t\t\t\t\t\t\t\t\t\t// interaction — a calendar's ragged edges.\n\t\t\t\t\t\t\t\t\t\tif ( cell?.hidden ) {\n\t\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\t\t\tkey={ `cell-${ columnIndex }-${ rowIndex }` }\n\t\t\t\t\t\t\t\t\t\t\t\t\tdata-testid=\"heatmap-cell-hidden\"\n\t\t\t\t\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstyles[ 'heatmap-chart__cell' ],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstyles[ 'heatmap-chart__cell--hidden' ]\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t// Filler: drawn like an empty cell so the grid fills its\n\t\t\t\t\t\t\t\t\t\t// container, but it stands for a day nothing was measured\n\t\t\t\t\t\t\t\t\t\t// for, so it reports nothing to a pointer or a screen\n\t\t\t\t\t\t\t\t\t\t// reader either.\n\t\t\t\t\t\t\t\t\t\tif ( cell?.placeholder ) {\n\t\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\t\t\tkey={ `cell-${ columnIndex }-${ rowIndex }` }\n\t\t\t\t\t\t\t\t\t\t\t\t\tdata-testid=\"heatmap-cell-placeholder\"\n\t\t\t\t\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstyles[ 'heatmap-chart__cell' ],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstyles[ 'heatmap-chart__cell--placeholder' ]\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tconst value = cell?.value ?? null;\n\t\t\t\t\t\t\t\t\t\tconst present = isPresent( value );\n\t\t\t\t\t\t\t\t\t\tconst normalized = present ? getNormalizedValue( value, extent ) : 0;\n\t\t\t\t\t\t\t\t\t\tconst flatIndex = columnIndex * rows + rowIndex;\n\t\t\t\t\t\t\t\t\t\tconst info = buildTooltipData( columnIndex, rowIndex );\n\t\t\t\t\t\t\t\t\t\tconst accessibleName =\n\t\t\t\t\t\t\t\t\t\t\tinfo.cellLabel ||\n\t\t\t\t\t\t\t\t\t\t\t`${ info.columnLabel ?? '' } ${ info.rowLabel ?? '' }`.trim();\n\t\t\t\t\t\t\t\t\t\tconst accessibleLabel = `${ accessibleName }: ${\n\t\t\t\t\t\t\t\t\t\t\tinfo.value === null\n\t\t\t\t\t\t\t\t\t\t\t\t? __( 'No data', 'jetpack-charts' )\n\t\t\t\t\t\t\t\t\t\t\t\t: formatNumber( info.value )\n\t\t\t\t\t\t\t\t\t\t}`;\n\n\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\t\tkey={ `cell-${ columnIndex }-${ rowIndex }` }\n\t\t\t\t\t\t\t\t\t\t\t\tid={ `${ chartId }-cell-${ columnIndex }-${ rowIndex }` }\n\t\t\t\t\t\t\t\t\t\t\t\tdata-testid=\"heatmap-cell\"\n\t\t\t\t\t\t\t\t\t\t\t\trole=\"gridcell\"\n\t\t\t\t\t\t\t\t\t\t\t\t// Focus stays on the grid (aria-activedescendant); cells are\n\t\t\t\t\t\t\t\t\t\t\t\t// focusable but out of the tab order.\n\t\t\t\t\t\t\t\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t\t\t\t\t\t\t\t\taria-colindex={ columnIndex + 1 }\n\t\t\t\t\t\t\t\t\t\t\t\taria-label={ accessibleLabel }\n\t\t\t\t\t\t\t\t\t\t\t\tdata-column={ columnIndex }\n\t\t\t\t\t\t\t\t\t\t\t\tdata-row={ rowIndex }\n\t\t\t\t\t\t\t\t\t\t\t\tclassName={ clsx( styles[ 'heatmap-chart__cell' ], {\n\t\t\t\t\t\t\t\t\t\t\t\t\t[ styles[ 'heatmap-chart__cell--filled' ] ]: present,\n\t\t\t\t\t\t\t\t\t\t\t\t\t[ styles[ 'heatmap-chart__cell--strong' ] ]:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpresent && cellHasLightText( normalized ),\n\t\t\t\t\t\t\t\t\t\t\t\t\t[ styles[ 'heatmap-chart__cell--selected' ] ]:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tselectedIndex === flatIndex,\n\t\t\t\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\t\t\t\t\tpresent\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? ( {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'--a8c-charts-heatmap-cell-intensity': normalized,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t } as CSSProperties )\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tonMouseMove={ handleCellMouseMove }\n\t\t\t\t\t\t\t\t\t\t\t\tonMouseLeave={ handleCellMouseLeave }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ drawValues && present && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span className={ styles[ 'heatmap-chart__cell-value' ] }>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ /* Compact display; tooltip and aria-label keep full precision. */ }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ formatNumberCompact( value ) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t</div>\n\t\t\t\t\t{ withTooltips && tooltipOpen && tooltipData && (\n\t\t\t\t\t\t<TooltipInPortal top={ tooltipTop } left={ tooltipLeft }>\n\t\t\t\t\t\t\t<div className={ CHART_SCOPE_CLASS } role=\"tooltip\" tabIndex={ -1 }>\n\t\t\t\t\t\t\t\t{ ( renderTooltip ?? defaultRenderTooltip )( tooltipData ) }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</TooltipInPortal>\n\t\t\t\t\t) }\n\t\t\t\t</ChartLayout>\n\t\t\t</ChartInstanceContext.Provider>\n\t\t</HeatmapContext.Provider>\n\t);\n};\n\nconst HeatmapChartWithProvider: FC< HeatmapChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\tif ( existingContext ) {\n\t\treturn <HeatmapChartInternal { ...props } />;\n\t}\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<HeatmapChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nHeatmapChartWithProvider.displayName = 'HeatmapChart';\n\ninterface HeatmapChartSubComponents {\n\tLegend: typeof HeatmapLegend;\n}\n\nconst HeatmapChart = attachSubComponents( HeatmapChartWithProvider, {\n\tLegend: HeatmapLegend,\n} ) as FC< HeatmapChartProps > & HeatmapChartSubComponents;\n\n// The responsive wrapper already sizes the container; drop its measured pixel\n// width/height so the grid fills that container via CSS and reflows fluidly,\n// instead of pinning to a debounced measurement.\nconst HeatmapChartResponsiveInner: FC< HeatmapChartProps > = props => (\n\t<HeatmapChartWithProvider { ...props } width={ undefined } height={ undefined } />\n);\nHeatmapChartResponsiveInner.displayName = 'HeatmapChart';\n\nconst HeatmapChartResponsive = attachSubComponents(\n\twithResponsive< HeatmapChartProps >( HeatmapChartResponsiveInner ),\n\t{ Legend: HeatmapLegend }\n) as FC< HeatmapChartProps & ResponsiveConfig > & HeatmapChartSubComponents;\n\nexport { HeatmapChartResponsive as default, HeatmapChart as HeatmapChartUnresponsive };\n","/*!\n * is-plain-object <https://github.com/jonschlinkert/is-plain-object>\n *\n * Copyright (c) 2014-2017, Jon Schlinkert.\n * Released under the MIT License.\n */\n\nfunction isObject(o) {\n return Object.prototype.toString.call(o) === '[object Object]';\n}\n\nfunction isPlainObject(o) {\n var ctor,prot;\n\n if (isObject(o) === false) return false;\n\n // If has modified constructor\n ctor = o.constructor;\n if (ctor === undefined) return true;\n\n // If has modified prototype\n prot = ctor.prototype;\n if (isObject(prot) === false) return false;\n\n // If constructor does not have an Object-specific method\n if (prot.hasOwnProperty('isPrototypeOf') === false) {\n return false;\n }\n\n // Most likely a plain Object\n return true;\n}\n\nexport { isPlainObject };\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.lowerCase = exports.localeLowerCase = void 0;\n/**\n * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt\n */\nvar SUPPORTED_LOCALE = {\n tr: {\n regexp: /\\u0130|\\u0049|\\u0049\\u0307/g,\n map: {\n İ: \"\\u0069\",\n I: \"\\u0131\",\n İ: \"\\u0069\",\n },\n },\n az: {\n regexp: /\\u0130/g,\n map: {\n İ: \"\\u0069\",\n I: \"\\u0131\",\n İ: \"\\u0069\",\n },\n },\n lt: {\n regexp: /\\u0049|\\u004A|\\u012E|\\u00CC|\\u00CD|\\u0128/g,\n map: {\n I: \"\\u0069\\u0307\",\n J: \"\\u006A\\u0307\",\n Į: \"\\u012F\\u0307\",\n Ì: \"\\u0069\\u0307\\u0300\",\n Í: \"\\u0069\\u0307\\u0301\",\n Ĩ: \"\\u0069\\u0307\\u0303\",\n },\n },\n};\n/**\n * Localized lower case.\n */\nfunction localeLowerCase(str, locale) {\n var lang = SUPPORTED_LOCALE[locale.toLowerCase()];\n if (lang)\n return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; }));\n return lowerCase(str);\n}\nexports.localeLowerCase = localeLowerCase;\n/**\n * Lower case as a function.\n */\nfunction lowerCase(str) {\n return str.toLowerCase();\n}\nexports.lowerCase = lowerCase;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.noCase = void 0;\nvar lower_case_1 = require(\"lower-case\");\n// Support camel case (\"camelCase\" -> \"camel Case\" and \"CAMELCase\" -> \"CAMEL Case\").\nvar DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];\n// Remove all non-word characters.\nvar DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;\n/**\n * Normalize the string into something other libraries can manipulate easier.\n */\nfunction noCase(input, options) {\n if (options === void 0) { options = {}; }\n 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;\n var result = replace(replace(input, splitRegexp, \"$1\\0$2\"), stripRegexp, \"\\0\");\n var start = 0;\n var end = result.length;\n // Trim the delimiter from around the output string.\n while (result.charAt(start) === \"\\0\")\n start++;\n while (result.charAt(end - 1) === \"\\0\")\n end--;\n // Transform each token independently.\n return result.slice(start, end).split(\"\\0\").map(transform).join(delimiter);\n}\nexports.noCase = noCase;\n/**\n * Replace `re` in the input string with the replacement value.\n */\nfunction replace(input, re, value) {\n if (re instanceof RegExp)\n return input.replace(re, value);\n return re.reduce(function (input, re) { return input.replace(re, value); }, input);\n}\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.pascalCase = exports.pascalCaseTransformMerge = exports.pascalCaseTransform = void 0;\nvar tslib_1 = require(\"tslib\");\nvar no_case_1 = require(\"no-case\");\nfunction pascalCaseTransform(input, index) {\n var firstChar = input.charAt(0);\n var lowerChars = input.substr(1).toLowerCase();\n if (index > 0 && firstChar >= \"0\" && firstChar <= \"9\") {\n return \"_\" + firstChar + lowerChars;\n }\n return \"\" + firstChar.toUpperCase() + lowerChars;\n}\nexports.pascalCaseTransform = pascalCaseTransform;\nfunction pascalCaseTransformMerge(input) {\n return input.charAt(0).toUpperCase() + input.slice(1).toLowerCase();\n}\nexports.pascalCaseTransformMerge = pascalCaseTransformMerge;\nfunction pascalCase(input, options) {\n if (options === void 0) { options = {}; }\n return no_case_1.noCase(input, tslib_1.__assign({ delimiter: \"\", transform: pascalCaseTransform }, options));\n}\nexports.pascalCase = pascalCase;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.camelCase = exports.camelCaseTransformMerge = exports.camelCaseTransform = void 0;\nvar tslib_1 = require(\"tslib\");\nvar pascal_case_1 = require(\"pascal-case\");\nfunction camelCaseTransform(input, index) {\n if (index === 0)\n return input.toLowerCase();\n return pascal_case_1.pascalCaseTransform(input, index);\n}\nexports.camelCaseTransform = camelCaseTransform;\nfunction camelCaseTransformMerge(input, index) {\n if (index === 0)\n return input.toLowerCase();\n return pascal_case_1.pascalCaseTransformMerge(input);\n}\nexports.camelCaseTransformMerge = camelCaseTransformMerge;\nfunction camelCase(input, options) {\n if (options === void 0) { options = {}; }\n return pascal_case_1.pascalCase(input, tslib_1.__assign({ transform: camelCaseTransform }, options));\n}\nexports.camelCase = camelCase;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.upperCaseFirst = void 0;\n/**\n * Upper case the first character of an input string.\n */\nfunction upperCaseFirst(input) {\n return input.charAt(0).toUpperCase() + input.substr(1);\n}\nexports.upperCaseFirst = upperCaseFirst;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.capitalCase = exports.capitalCaseTransform = void 0;\nvar tslib_1 = require(\"tslib\");\nvar no_case_1 = require(\"no-case\");\nvar upper_case_first_1 = require(\"upper-case-first\");\nfunction capitalCaseTransform(input) {\n return upper_case_first_1.upperCaseFirst(input.toLowerCase());\n}\nexports.capitalCaseTransform = capitalCaseTransform;\nfunction capitalCase(input, options) {\n if (options === void 0) { options = {}; }\n return no_case_1.noCase(input, tslib_1.__assign({ delimiter: \" \", transform: capitalCaseTransform }, options));\n}\nexports.capitalCase = capitalCase;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.upperCase = exports.localeUpperCase = void 0;\n/**\n * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt\n */\nvar SUPPORTED_LOCALE = {\n tr: {\n regexp: /[\\u0069]/g,\n map: {\n i: \"\\u0130\",\n },\n },\n az: {\n regexp: /[\\u0069]/g,\n map: {\n i: \"\\u0130\",\n },\n },\n lt: {\n regexp: /[\\u0069\\u006A\\u012F]\\u0307|\\u0069\\u0307[\\u0300\\u0301\\u0303]/g,\n map: {\n i̇: \"\\u0049\",\n j̇: \"\\u004A\",\n į̇: \"\\u012E\",\n i̇̀: \"\\u00CC\",\n i̇́: \"\\u00CD\",\n i̇̃: \"\\u0128\",\n },\n },\n};\n/**\n * Localized upper case.\n */\nfunction localeUpperCase(str, locale) {\n var lang = SUPPORTED_LOCALE[locale.toLowerCase()];\n if (lang)\n return upperCase(str.replace(lang.regexp, function (m) { return lang.map[m]; }));\n return upperCase(str);\n}\nexports.localeUpperCase = localeUpperCase;\n/**\n * Upper case as a function.\n */\nfunction upperCase(str) {\n return str.toUpperCase();\n}\nexports.upperCase = upperCase;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.constantCase = void 0;\nvar tslib_1 = require(\"tslib\");\nvar no_case_1 = require(\"no-case\");\nvar upper_case_1 = require(\"upper-case\");\nfunction constantCase(input, options) {\n if (options === void 0) { options = {}; }\n return no_case_1.noCase(input, tslib_1.__assign({ delimiter: \"_\", transform: upper_case_1.upperCase }, options));\n}\nexports.constantCase = constantCase;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.dotCase = void 0;\nvar tslib_1 = require(\"tslib\");\nvar no_case_1 = require(\"no-case\");\nfunction dotCase(input, options) {\n if (options === void 0) { options = {}; }\n return no_case_1.noCase(input, tslib_1.__assign({ delimiter: \".\" }, options));\n}\nexports.dotCase = dotCase;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.headerCase = void 0;\nvar tslib_1 = require(\"tslib\");\nvar capital_case_1 = require(\"capital-case\");\nfunction headerCase(input, options) {\n if (options === void 0) { options = {}; }\n return capital_case_1.capitalCase(input, tslib_1.__assign({ delimiter: \"-\" }, options));\n}\nexports.headerCase = headerCase;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.paramCase = void 0;\nvar tslib_1 = require(\"tslib\");\nvar dot_case_1 = require(\"dot-case\");\nfunction paramCase(input, options) {\n if (options === void 0) { options = {}; }\n return dot_case_1.dotCase(input, tslib_1.__assign({ delimiter: \"-\" }, options));\n}\nexports.paramCase = paramCase;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.pathCase = void 0;\nvar tslib_1 = require(\"tslib\");\nvar dot_case_1 = require(\"dot-case\");\nfunction pathCase(input, options) {\n if (options === void 0) { options = {}; }\n return dot_case_1.dotCase(input, tslib_1.__assign({ delimiter: \"/\" }, options));\n}\nexports.pathCase = pathCase;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.sentenceCase = exports.sentenceCaseTransform = void 0;\nvar tslib_1 = require(\"tslib\");\nvar no_case_1 = require(\"no-case\");\nvar upper_case_first_1 = require(\"upper-case-first\");\nfunction sentenceCaseTransform(input, index) {\n var result = input.toLowerCase();\n if (index === 0)\n return upper_case_first_1.upperCaseFirst(result);\n return result;\n}\nexports.sentenceCaseTransform = sentenceCaseTransform;\nfunction sentenceCase(input, options) {\n if (options === void 0) { options = {}; }\n return no_case_1.noCase(input, tslib_1.__assign({ delimiter: \" \", transform: sentenceCaseTransform }, options));\n}\nexports.sentenceCase = sentenceCase;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.snakeCase = void 0;\nvar tslib_1 = require(\"tslib\");\nvar dot_case_1 = require(\"dot-case\");\nfunction snakeCase(input, options) {\n if (options === void 0) { options = {}; }\n return dot_case_1.dotCase(input, tslib_1.__assign({ delimiter: \"_\" }, options));\n}\nexports.snakeCase = snakeCase;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = require(\"tslib\");\ntslib_1.__exportStar(require(\"camel-case\"), exports);\ntslib_1.__exportStar(require(\"capital-case\"), exports);\ntslib_1.__exportStar(require(\"constant-case\"), exports);\ntslib_1.__exportStar(require(\"dot-case\"), exports);\ntslib_1.__exportStar(require(\"header-case\"), exports);\ntslib_1.__exportStar(require(\"no-case\"), exports);\ntslib_1.__exportStar(require(\"param-case\"), exports);\ntslib_1.__exportStar(require(\"pascal-case\"), exports);\ntslib_1.__exportStar(require(\"path-case\"), exports);\ntslib_1.__exportStar(require(\"sentence-case\"), exports);\ntslib_1.__exportStar(require(\"snake-case\"), exports);\n//# sourceMappingURL=index.js.map","// packages/components/src/utils/hooks/use-update-effect.js\nimport { useRef, useEffect } from \"@wordpress/element\";\nfunction useUpdateEffect(effect, deps) {\n const mountedRef = useRef(false);\n useEffect(() => {\n if (mountedRef.current) {\n return effect();\n }\n mountedRef.current = true;\n return void 0;\n }, deps);\n useEffect(() => () => {\n mountedRef.current = false;\n }, []);\n}\nvar use_update_effect_default = useUpdateEffect;\nexport {\n use_update_effect_default as default\n};\n//# sourceMappingURL=use-update-effect.mjs.map\n","var isDevelopment = false;\n\n/*\n\nBased off glamor's StyleSheet, thanks Sunil ❤️\n\nhigh performance StyleSheet for css-in-js systems\n\n- uses multiple style tags behind the scenes for millions of rules\n- uses `insertRule` for appending in production for *much* faster performance\n\n// usage\n\nimport { StyleSheet } from '@emotion/sheet'\n\nlet styleSheet = new StyleSheet({ key: '', container: document.head })\n\nstyleSheet.insert('#box { border: 1px solid red; }')\n- appends a css rule into the stylesheet\n\nstyleSheet.flush()\n- empties the stylesheet of all its contents\n\n*/\n\nfunction sheetForTag(tag) {\n if (tag.sheet) {\n return tag.sheet;\n } // this weirdness brought to you by firefox\n\n /* istanbul ignore next */\n\n\n for (var i = 0; i < document.styleSheets.length; i++) {\n if (document.styleSheets[i].ownerNode === tag) {\n return document.styleSheets[i];\n }\n } // this function should always return with a value\n // TS can't understand it though so we make it stop complaining here\n\n\n return undefined;\n}\n\nfunction createStyleElement(options) {\n var tag = document.createElement('style');\n tag.setAttribute('data-emotion', options.key);\n\n if (options.nonce !== undefined) {\n tag.setAttribute('nonce', options.nonce);\n }\n\n tag.appendChild(document.createTextNode(''));\n tag.setAttribute('data-s', '');\n return tag;\n}\n\nvar StyleSheet = /*#__PURE__*/function () {\n // Using Node instead of HTMLElement since container may be a ShadowRoot\n function StyleSheet(options) {\n var _this = this;\n\n this._insertTag = function (tag) {\n var before;\n\n if (_this.tags.length === 0) {\n if (_this.insertionPoint) {\n before = _this.insertionPoint.nextSibling;\n } else if (_this.prepend) {\n before = _this.container.firstChild;\n } else {\n before = _this.before;\n }\n } else {\n before = _this.tags[_this.tags.length - 1].nextSibling;\n }\n\n _this.container.insertBefore(tag, before);\n\n _this.tags.push(tag);\n };\n\n this.isSpeedy = options.speedy === undefined ? !isDevelopment : options.speedy;\n this.tags = [];\n this.ctr = 0;\n this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets\n\n this.key = options.key;\n this.container = options.container;\n this.prepend = options.prepend;\n this.insertionPoint = options.insertionPoint;\n this.before = null;\n }\n\n var _proto = StyleSheet.prototype;\n\n _proto.hydrate = function hydrate(nodes) {\n nodes.forEach(this._insertTag);\n };\n\n _proto.insert = function insert(rule) {\n // the max length is how many rules we have per style tag, it's 65000 in speedy mode\n // it's 1 in dev because we insert source maps that map a single rule to a location\n // and you can only have one source map per style tag\n if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) {\n this._insertTag(createStyleElement(this));\n }\n\n var tag = this.tags[this.tags.length - 1];\n\n if (this.isSpeedy) {\n var sheet = sheetForTag(tag);\n\n try {\n // this is the ultrafast version, works across browsers\n // the big drawback is that the css won't be editable in devtools\n sheet.insertRule(rule, sheet.cssRules.length);\n } catch (e) {\n }\n } else {\n tag.appendChild(document.createTextNode(rule));\n }\n\n this.ctr++;\n };\n\n _proto.flush = function flush() {\n this.tags.forEach(function (tag) {\n var _tag$parentNode;\n\n return (_tag$parentNode = tag.parentNode) == null ? void 0 : _tag$parentNode.removeChild(tag);\n });\n this.tags = [];\n this.ctr = 0;\n };\n\n return StyleSheet;\n}();\n\nexport { StyleSheet };\n","export var MS = '-ms-'\nexport var MOZ = '-moz-'\nexport var WEBKIT = '-webkit-'\n\nexport var COMMENT = 'comm'\nexport var RULESET = 'rule'\nexport var DECLARATION = 'decl'\n\nexport var PAGE = '@page'\nexport var MEDIA = '@media'\nexport var IMPORT = '@import'\nexport var CHARSET = '@charset'\nexport var VIEWPORT = '@viewport'\nexport var SUPPORTS = '@supports'\nexport var DOCUMENT = '@document'\nexport var NAMESPACE = '@namespace'\nexport var KEYFRAMES = '@keyframes'\nexport var FONT_FACE = '@font-face'\nexport var COUNTER_STYLE = '@counter-style'\nexport var FONT_FEATURE_VALUES = '@font-feature-values'\nexport var LAYER = '@layer'\n","/**\n * @param {number}\n * @return {number}\n */\nexport var abs = Math.abs\n\n/**\n * @param {number}\n * @return {string}\n */\nexport var from = String.fromCharCode\n\n/**\n * @param {object}\n * @return {object}\n */\nexport var assign = Object.assign\n\n/**\n * @param {string} value\n * @param {number} length\n * @return {number}\n */\nexport function hash (value, length) {\n\treturn charat(value, 0) ^ 45 ? (((((((length << 2) ^ charat(value, 0)) << 2) ^ charat(value, 1)) << 2) ^ charat(value, 2)) << 2) ^ charat(value, 3) : 0\n}\n\n/**\n * @param {string} value\n * @return {string}\n */\nexport function trim (value) {\n\treturn value.trim()\n}\n\n/**\n * @param {string} value\n * @param {RegExp} pattern\n * @return {string?}\n */\nexport function match (value, pattern) {\n\treturn (value = pattern.exec(value)) ? value[0] : value\n}\n\n/**\n * @param {string} value\n * @param {(string|RegExp)} pattern\n * @param {string} replacement\n * @return {string}\n */\nexport function replace (value, pattern, replacement) {\n\treturn value.replace(pattern, replacement)\n}\n\n/**\n * @param {string} value\n * @param {string} search\n * @return {number}\n */\nexport function indexof (value, search) {\n\treturn value.indexOf(search)\n}\n\n/**\n * @param {string} value\n * @param {number} index\n * @return {number}\n */\nexport function charat (value, index) {\n\treturn value.charCodeAt(index) | 0\n}\n\n/**\n * @param {string} value\n * @param {number} begin\n * @param {number} end\n * @return {string}\n */\nexport function substr (value, begin, end) {\n\treturn value.slice(begin, end)\n}\n\n/**\n * @param {string} value\n * @return {number}\n */\nexport function strlen (value) {\n\treturn value.length\n}\n\n/**\n * @param {any[]} value\n * @return {number}\n */\nexport function sizeof (value) {\n\treturn value.length\n}\n\n/**\n * @param {any} value\n * @param {any[]} array\n * @return {any}\n */\nexport function append (value, array) {\n\treturn array.push(value), value\n}\n\n/**\n * @param {string[]} array\n * @param {function} callback\n * @return {string}\n */\nexport function combine (array, callback) {\n\treturn array.map(callback).join('')\n}\n","import {from, trim, charat, strlen, substr, append, assign} from './Utility.js'\n\nexport var line = 1\nexport var column = 1\nexport var length = 0\nexport var position = 0\nexport var character = 0\nexport var characters = ''\n\n/**\n * @param {string} value\n * @param {object | null} root\n * @param {object | null} parent\n * @param {string} type\n * @param {string[] | string} props\n * @param {object[] | string} children\n * @param {number} length\n */\nexport function node (value, root, parent, type, props, children, length) {\n\treturn {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: ''}\n}\n\n/**\n * @param {object} root\n * @param {object} props\n * @return {object}\n */\nexport function copy (root, props) {\n\treturn assign(node('', null, null, '', null, null, 0), root, {length: -root.length}, props)\n}\n\n/**\n * @return {number}\n */\nexport function char () {\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function prev () {\n\tcharacter = position > 0 ? charat(characters, --position) : 0\n\n\tif (column--, character === 10)\n\t\tcolumn = 1, line--\n\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function next () {\n\tcharacter = position < length ? charat(characters, position++) : 0\n\n\tif (column++, character === 10)\n\t\tcolumn = 1, line++\n\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function peek () {\n\treturn charat(characters, position)\n}\n\n/**\n * @return {number}\n */\nexport function caret () {\n\treturn position\n}\n\n/**\n * @param {number} begin\n * @param {number} end\n * @return {string}\n */\nexport function slice (begin, end) {\n\treturn substr(characters, begin, end)\n}\n\n/**\n * @param {number} type\n * @return {number}\n */\nexport function token (type) {\n\tswitch (type) {\n\t\t// \\0 \\t \\n \\r \\s whitespace token\n\t\tcase 0: case 9: case 10: case 13: case 32:\n\t\t\treturn 5\n\t\t// ! + , / > @ ~ isolate token\n\t\tcase 33: case 43: case 44: case 47: case 62: case 64: case 126:\n\t\t// ; { } breakpoint token\n\t\tcase 59: case 123: case 125:\n\t\t\treturn 4\n\t\t// : accompanied token\n\t\tcase 58:\n\t\t\treturn 3\n\t\t// \" ' ( [ opening delimit token\n\t\tcase 34: case 39: case 40: case 91:\n\t\t\treturn 2\n\t\t// ) ] closing delimit token\n\t\tcase 41: case 93:\n\t\t\treturn 1\n\t}\n\n\treturn 0\n}\n\n/**\n * @param {string} value\n * @return {any[]}\n */\nexport function alloc (value) {\n\treturn line = column = 1, length = strlen(characters = value), position = 0, []\n}\n\n/**\n * @param {any} value\n * @return {any}\n */\nexport function dealloc (value) {\n\treturn characters = '', value\n}\n\n/**\n * @param {number} type\n * @return {string}\n */\nexport function delimit (type) {\n\treturn trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)))\n}\n\n/**\n * @param {string} value\n * @return {string[]}\n */\nexport function tokenize (value) {\n\treturn dealloc(tokenizer(alloc(value)))\n}\n\n/**\n * @param {number} type\n * @return {string}\n */\nexport function whitespace (type) {\n\twhile (character = peek())\n\t\tif (character < 33)\n\t\t\tnext()\n\t\telse\n\t\t\tbreak\n\n\treturn token(type) > 2 || token(character) > 3 ? '' : ' '\n}\n\n/**\n * @param {string[]} children\n * @return {string[]}\n */\nexport function tokenizer (children) {\n\twhile (next())\n\t\tswitch (token(character)) {\n\t\t\tcase 0: append(identifier(position - 1), children)\n\t\t\t\tbreak\n\t\t\tcase 2: append(delimit(character), children)\n\t\t\t\tbreak\n\t\t\tdefault: append(from(character), children)\n\t\t}\n\n\treturn children\n}\n\n/**\n * @param {number} index\n * @param {number} count\n * @return {string}\n */\nexport function escaping (index, count) {\n\twhile (--count && next())\n\t\t// not 0-9 A-F a-f\n\t\tif (character < 48 || character > 102 || (character > 57 && character < 65) || (character > 70 && character < 97))\n\t\t\tbreak\n\n\treturn slice(index, caret() + (count < 6 && peek() == 32 && next() == 32))\n}\n\n/**\n * @param {number} type\n * @return {number}\n */\nexport function delimiter (type) {\n\twhile (next())\n\t\tswitch (character) {\n\t\t\t// ] ) \" '\n\t\t\tcase type:\n\t\t\t\treturn position\n\t\t\t// \" '\n\t\t\tcase 34: case 39:\n\t\t\t\tif (type !== 34 && type !== 39)\n\t\t\t\t\tdelimiter(character)\n\t\t\t\tbreak\n\t\t\t// (\n\t\t\tcase 40:\n\t\t\t\tif (type === 41)\n\t\t\t\t\tdelimiter(type)\n\t\t\t\tbreak\n\t\t\t// \\\n\t\t\tcase 92:\n\t\t\t\tnext()\n\t\t\t\tbreak\n\t\t}\n\n\treturn position\n}\n\n/**\n * @param {number} type\n * @param {number} index\n * @return {number}\n */\nexport function commenter (type, index) {\n\twhile (next())\n\t\t// //\n\t\tif (type + character === 47 + 10)\n\t\t\tbreak\n\t\t// /*\n\t\telse if (type + character === 42 + 42 && peek() === 47)\n\t\t\tbreak\n\n\treturn '/*' + slice(index, position - 1) + '*' + from(type === 47 ? type : next())\n}\n\n/**\n * @param {number} index\n * @return {string}\n */\nexport function identifier (index) {\n\twhile (!token(peek()))\n\t\tnext()\n\n\treturn slice(index, position)\n}\n","import {COMMENT, RULESET, DECLARATION} from './Enum.js'\nimport {abs, charat, trim, from, sizeof, strlen, substr, append, replace, indexof} from './Utility.js'\nimport {node, char, prev, next, peek, caret, alloc, dealloc, delimit, whitespace, escaping, identifier, commenter} from './Tokenizer.js'\n\n/**\n * @param {string} value\n * @return {object[]}\n */\nexport function compile (value) {\n\treturn dealloc(parse('', null, null, null, [''], value = alloc(value), 0, [0], value))\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {string[]} rule\n * @param {string[]} rules\n * @param {string[]} rulesets\n * @param {number[]} pseudo\n * @param {number[]} points\n * @param {string[]} declarations\n * @return {object}\n */\nexport function parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {\n\tvar index = 0\n\tvar offset = 0\n\tvar length = pseudo\n\tvar atrule = 0\n\tvar property = 0\n\tvar previous = 0\n\tvar variable = 1\n\tvar scanning = 1\n\tvar ampersand = 1\n\tvar character = 0\n\tvar type = ''\n\tvar props = rules\n\tvar children = rulesets\n\tvar reference = rule\n\tvar characters = type\n\n\twhile (scanning)\n\t\tswitch (previous = character, character = next()) {\n\t\t\t// (\n\t\t\tcase 40:\n\t\t\t\tif (previous != 108 && charat(characters, length - 1) == 58) {\n\t\t\t\t\tif (indexof(characters += replace(delimit(character), '&', '&\\f'), '&\\f') != -1)\n\t\t\t\t\t\tampersand = -1\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t// \" ' [\n\t\t\tcase 34: case 39: case 91:\n\t\t\t\tcharacters += delimit(character)\n\t\t\t\tbreak\n\t\t\t// \\t \\n \\r \\s\n\t\t\tcase 9: case 10: case 13: case 32:\n\t\t\t\tcharacters += whitespace(previous)\n\t\t\t\tbreak\n\t\t\t// \\\n\t\t\tcase 92:\n\t\t\t\tcharacters += escaping(caret() - 1, 7)\n\t\t\t\tcontinue\n\t\t\t// /\n\t\t\tcase 47:\n\t\t\t\tswitch (peek()) {\n\t\t\t\t\tcase 42: case 47:\n\t\t\t\t\t\tappend(comment(commenter(next(), caret()), root, parent), declarations)\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tcharacters += '/'\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t// {\n\t\t\tcase 123 * variable:\n\t\t\t\tpoints[index++] = strlen(characters) * ampersand\n\t\t\t// } ; \\0\n\t\t\tcase 125 * variable: case 59: case 0:\n\t\t\t\tswitch (character) {\n\t\t\t\t\t// \\0 }\n\t\t\t\t\tcase 0: case 125: scanning = 0\n\t\t\t\t\t// ;\n\t\t\t\t\tcase 59 + offset: if (ampersand == -1) characters = replace(characters, /\\f/g, '')\n\t\t\t\t\t\tif (property > 0 && (strlen(characters) - length))\n\t\t\t\t\t\t\tappend(property > 32 ? declaration(characters + ';', rule, parent, length - 1) : declaration(replace(characters, ' ', '') + ';', rule, parent, length - 2), declarations)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// @ ;\n\t\t\t\t\tcase 59: characters += ';'\n\t\t\t\t\t// { rule/at-rule\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tappend(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets)\n\n\t\t\t\t\t\tif (character === 123)\n\t\t\t\t\t\t\tif (offset === 0)\n\t\t\t\t\t\t\t\tparse(characters, root, reference, reference, props, rulesets, length, points, children)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tswitch (atrule === 99 && charat(characters, 3) === 110 ? 100 : atrule) {\n\t\t\t\t\t\t\t\t\t// d l m s\n\t\t\t\t\t\t\t\t\tcase 100: case 108: case 109: case 115:\n\t\t\t\t\t\t\t\t\t\tparse(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)\n\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tparse(characters, reference, reference, reference, [''], children, 0, points, children)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tindex = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo\n\t\t\t\tbreak\n\t\t\t// :\n\t\t\tcase 58:\n\t\t\t\tlength = 1 + strlen(characters), property = previous\n\t\t\tdefault:\n\t\t\t\tif (variable < 1)\n\t\t\t\t\tif (character == 123)\n\t\t\t\t\t\t--variable\n\t\t\t\t\telse if (character == 125 && variable++ == 0 && prev() == 125)\n\t\t\t\t\t\tcontinue\n\n\t\t\t\tswitch (characters += from(character), character * variable) {\n\t\t\t\t\t// &\n\t\t\t\t\tcase 38:\n\t\t\t\t\t\tampersand = offset > 0 ? 1 : (characters += '\\f', -1)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// ,\n\t\t\t\t\tcase 44:\n\t\t\t\t\t\tpoints[index++] = (strlen(characters) - 1) * ampersand, ampersand = 1\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// @\n\t\t\t\t\tcase 64:\n\t\t\t\t\t\t// -\n\t\t\t\t\t\tif (peek() === 45)\n\t\t\t\t\t\t\tcharacters += delimit(next())\n\n\t\t\t\t\t\tatrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// -\n\t\t\t\t\tcase 45:\n\t\t\t\t\t\tif (previous === 45 && strlen(characters) == 2)\n\t\t\t\t\t\t\tvariable = 0\n\t\t\t\t}\n\t\t}\n\n\treturn rulesets\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {number} index\n * @param {number} offset\n * @param {string[]} rules\n * @param {number[]} points\n * @param {string} type\n * @param {string[]} props\n * @param {string[]} children\n * @param {number} length\n * @return {object}\n */\nexport function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length) {\n\tvar post = offset - 1\n\tvar rule = offset === 0 ? rules : ['']\n\tvar size = sizeof(rule)\n\n\tfor (var i = 0, j = 0, k = 0; i < index; ++i)\n\t\tfor (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)\n\t\t\tif (z = trim(j > 0 ? rule[x] + ' ' + y : replace(y, /&\\f/g, rule[x])))\n\t\t\t\tprops[k++] = z\n\n\treturn node(value, root, parent, offset === 0 ? RULESET : type, props, children, length)\n}\n\n/**\n * @param {number} value\n * @param {object} root\n * @param {object?} parent\n * @return {object}\n */\nexport function comment (value, root, parent) {\n\treturn node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0)\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {number} length\n * @return {object}\n */\nexport function declaration (value, root, parent, length) {\n\treturn node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length)\n}\n","import {IMPORT, LAYER, COMMENT, RULESET, DECLARATION, KEYFRAMES} from './Enum.js'\nimport {strlen, sizeof} from './Utility.js'\n\n/**\n * @param {object[]} children\n * @param {function} callback\n * @return {string}\n */\nexport function serialize (children, callback) {\n\tvar output = ''\n\tvar length = sizeof(children)\n\n\tfor (var i = 0; i < length; i++)\n\t\toutput += callback(children[i], i, children, callback) || ''\n\n\treturn output\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n * @param {function} callback\n * @return {string}\n */\nexport function stringify (element, index, children, callback) {\n\tswitch (element.type) {\n\t\tcase LAYER: if (element.children.length) break\n\t\tcase IMPORT: case DECLARATION: return element.return = element.return || element.value\n\t\tcase COMMENT: return ''\n\t\tcase KEYFRAMES: return element.return = element.value + '{' + serialize(element.children, callback) + '}'\n\t\tcase RULESET: element.value = element.props.join(',')\n\t}\n\n\treturn strlen(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : ''\n}\n","import {MS, MOZ, WEBKIT, RULESET, KEYFRAMES, DECLARATION} from './Enum.js'\nimport {match, charat, substr, strlen, sizeof, replace, combine} from './Utility.js'\nimport {copy, tokenize} from './Tokenizer.js'\nimport {serialize} from './Serializer.js'\nimport {prefix} from './Prefixer.js'\n\n/**\n * @param {function[]} collection\n * @return {function}\n */\nexport function middleware (collection) {\n\tvar length = sizeof(collection)\n\n\treturn function (element, index, children, callback) {\n\t\tvar output = ''\n\n\t\tfor (var i = 0; i < length; i++)\n\t\t\toutput += collection[i](element, index, children, callback) || ''\n\n\t\treturn output\n\t}\n}\n\n/**\n * @param {function} callback\n * @return {function}\n */\nexport function rulesheet (callback) {\n\treturn function (element) {\n\t\tif (!element.root)\n\t\t\tif (element = element.return)\n\t\t\t\tcallback(element)\n\t}\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n * @param {function} callback\n */\nexport function prefixer (element, index, children, callback) {\n\tif (element.length > -1)\n\t\tif (!element.return)\n\t\t\tswitch (element.type) {\n\t\t\t\tcase DECLARATION: element.return = prefix(element.value, element.length, children)\n\t\t\t\t\treturn\n\t\t\t\tcase KEYFRAMES:\n\t\t\t\t\treturn serialize([copy(element, {value: replace(element.value, '@', '@' + WEBKIT)})], callback)\n\t\t\t\tcase RULESET:\n\t\t\t\t\tif (element.length)\n\t\t\t\t\t\treturn combine(element.props, function (value) {\n\t\t\t\t\t\t\tswitch (match(value, /(::plac\\w+|:read-\\w+)/)) {\n\t\t\t\t\t\t\t\t// :read-(only|write)\n\t\t\t\t\t\t\t\tcase ':read-only': case ':read-write':\n\t\t\t\t\t\t\t\t\treturn serialize([copy(element, {props: [replace(value, /:(read-\\w+)/, ':' + MOZ + '$1')]})], callback)\n\t\t\t\t\t\t\t\t// :placeholder\n\t\t\t\t\t\t\t\tcase '::placeholder':\n\t\t\t\t\t\t\t\t\treturn serialize([\n\t\t\t\t\t\t\t\t\t\tcopy(element, {props: [replace(value, /:(plac\\w+)/, ':' + WEBKIT + 'input-$1')]}),\n\t\t\t\t\t\t\t\t\t\tcopy(element, {props: [replace(value, /:(plac\\w+)/, ':' + MOZ + '$1')]}),\n\t\t\t\t\t\t\t\t\t\tcopy(element, {props: [replace(value, /:(plac\\w+)/, MS + 'input-$1')]})\n\t\t\t\t\t\t\t\t\t], callback)\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn ''\n\t\t\t\t\t\t})\n\t\t\t}\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n */\nexport function namespace (element) {\n\tswitch (element.type) {\n\t\tcase RULESET:\n\t\t\telement.props = element.props.map(function (value) {\n\t\t\t\treturn combine(tokenize(value), function (value, index, children) {\n\t\t\t\t\tswitch (charat(value, 0)) {\n\t\t\t\t\t\t// \\f\n\t\t\t\t\t\tcase 12:\n\t\t\t\t\t\t\treturn substr(value, 1, strlen(value))\n\t\t\t\t\t\t// \\0 ( + > ~\n\t\t\t\t\t\tcase 0: case 40: case 43: case 62: case 126:\n\t\t\t\t\t\t\treturn value\n\t\t\t\t\t\t// :\n\t\t\t\t\t\tcase 58:\n\t\t\t\t\t\t\tif (children[++index] === 'global')\n\t\t\t\t\t\t\t\tchildren[index] = '', children[++index] = '\\f' + substr(children[index], index = 1, -1)\n\t\t\t\t\t\t// \\s\n\t\t\t\t\t\tcase 32:\n\t\t\t\t\t\t\treturn index === 1 ? '' : value\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tswitch (index) {\n\t\t\t\t\t\t\t\tcase 0: element = value\n\t\t\t\t\t\t\t\t\treturn sizeof(children) > 1 ? '' : value\n\t\t\t\t\t\t\t\tcase index = sizeof(children) - 1: case 2:\n\t\t\t\t\t\t\t\t\treturn index === 2 ? value + element + element : value + element\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\treturn value\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t})\n\t}\n}\n","var weakMemoize = function weakMemoize(func) {\n var cache = new WeakMap();\n return function (arg) {\n if (cache.has(arg)) {\n // Use non-null assertion because we just checked that the cache `has` it\n // This allows us to remove `undefined` from the return value\n return cache.get(arg);\n }\n\n var ret = func(arg);\n cache.set(arg, ret);\n return ret;\n };\n};\n\nexport { weakMemoize as default };\n","function memoize(fn) {\n var cache = Object.create(null);\n return function (arg) {\n if (cache[arg] === undefined) cache[arg] = fn(arg);\n return cache[arg];\n };\n}\n\nexport { memoize as default };\n","import { StyleSheet } from '@emotion/sheet';\nimport { dealloc, alloc, next, token, from, peek, delimit, slice, position, RULESET, combine, match, serialize, copy, replace, WEBKIT, MOZ, MS, KEYFRAMES, DECLARATION, hash, charat, strlen, indexof, stringify, rulesheet, middleware, compile } from 'stylis';\nimport weakMemoize from '@emotion/weak-memoize';\nimport memoize from '@emotion/memoize';\n\nvar isBrowser = typeof document !== 'undefined';\n\nvar identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {\n var previous = 0;\n var character = 0;\n\n while (true) {\n previous = character;\n character = peek(); // &\\f\n\n if (previous === 38 && character === 12) {\n points[index] = 1;\n }\n\n if (token(character)) {\n break;\n }\n\n next();\n }\n\n return slice(begin, position);\n};\n\nvar toRules = function toRules(parsed, points) {\n // pretend we've started with a comma\n var index = -1;\n var character = 44;\n\n do {\n switch (token(character)) {\n case 0:\n // &\\f\n if (character === 38 && peek() === 12) {\n // this is not 100% correct, we don't account for literal sequences here - like for example quoted strings\n // stylis inserts \\f after & to know when & where it should replace this sequence with the context selector\n // and when it should just concatenate the outer and inner selectors\n // it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here\n points[index] = 1;\n }\n\n parsed[index] += identifierWithPointTracking(position - 1, points, index);\n break;\n\n case 2:\n parsed[index] += delimit(character);\n break;\n\n case 4:\n // comma\n if (character === 44) {\n // colon\n parsed[++index] = peek() === 58 ? '&\\f' : '';\n points[index] = parsed[index].length;\n break;\n }\n\n // fallthrough\n\n default:\n parsed[index] += from(character);\n }\n } while (character = next());\n\n return parsed;\n};\n\nvar getRules = function getRules(value, points) {\n return dealloc(toRules(alloc(value), points));\n}; // WeakSet would be more appropriate, but only WeakMap is supported in IE11\n\n\nvar fixedElements = /* #__PURE__ */new WeakMap();\nvar compat = function compat(element) {\n if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo\n // negative .length indicates that this rule has been already prefixed\n element.length < 1) {\n return;\n }\n\n var value = element.value;\n var parent = element.parent;\n var isImplicitRule = element.column === parent.column && element.line === parent.line;\n\n while (parent.type !== 'rule') {\n parent = parent.parent;\n if (!parent) return;\n } // short-circuit for the simplest case\n\n\n if (element.props.length === 1 && value.charCodeAt(0) !== 58\n /* colon */\n && !fixedElements.get(parent)) {\n return;\n } // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)\n // then the props has already been manipulated beforehand as they that array is shared between it and its \"rule parent\"\n\n\n if (isImplicitRule) {\n return;\n }\n\n fixedElements.set(element, true);\n var points = [];\n var rules = getRules(value, points);\n var parentRules = parent.props;\n\n for (var i = 0, k = 0; i < rules.length; i++) {\n for (var j = 0; j < parentRules.length; j++, k++) {\n element.props[k] = points[i] ? rules[i].replace(/&\\f/g, parentRules[j]) : parentRules[j] + \" \" + rules[i];\n }\n }\n};\nvar removeLabel = function removeLabel(element) {\n if (element.type === 'decl') {\n var value = element.value;\n\n if ( // charcode for l\n value.charCodeAt(0) === 108 && // charcode for b\n value.charCodeAt(2) === 98) {\n // this ignores label\n element[\"return\"] = '';\n element.value = '';\n }\n }\n};\n\n/* eslint-disable no-fallthrough */\n\nfunction prefix(value, length) {\n switch (hash(value, length)) {\n // color-adjust\n case 5103:\n return WEBKIT + 'print-' + value + value;\n // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)\n\n case 5737:\n case 4201:\n case 3177:\n case 3433:\n case 1641:\n case 4457:\n case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break\n\n case 5572:\n case 6356:\n case 5844:\n case 3191:\n case 6645:\n case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,\n\n case 6391:\n case 5879:\n case 5623:\n case 6135:\n case 4599:\n case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)\n\n case 4215:\n case 6389:\n case 5109:\n case 5365:\n case 5621:\n case 3829:\n return WEBKIT + value + value;\n // appearance, user-select, transform, hyphens, text-size-adjust\n\n case 5349:\n case 4246:\n case 4810:\n case 6968:\n case 2756:\n return WEBKIT + value + MOZ + value + MS + value + value;\n // flex, flex-direction\n\n case 6828:\n case 4268:\n return WEBKIT + value + MS + value + value;\n // order\n\n case 6165:\n return WEBKIT + value + MS + 'flex-' + value + value;\n // align-items\n\n case 5187:\n return WEBKIT + value + replace(value, /(\\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2') + value;\n // align-self\n\n case 5443:\n return WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/, '') + value;\n // align-content\n\n case 4675:\n return WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/, '') + value;\n // flex-shrink\n\n case 5548:\n return WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value;\n // flex-basis\n\n case 5292:\n return WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value;\n // flex-grow\n\n case 6060:\n return WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value;\n // transition\n\n case 4554:\n return WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value;\n // cursor\n\n case 6187:\n return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1'), value, '') + value;\n // background, background-image\n\n case 5495:\n case 3959:\n return replace(value, /(image-set\\([^]*)/, WEBKIT + '$1' + '$`$1');\n // justify-content\n\n case 4968:\n return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + WEBKIT + value + value;\n // (margin|padding)-inline-(start|end)\n\n case 4095:\n case 3583:\n case 4068:\n case 2532:\n return replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value;\n // (min|max)?(width|height|inline-size|block-size)\n\n case 8116:\n case 7059:\n case 5753:\n case 5535:\n case 5445:\n case 5701:\n case 4933:\n case 4677:\n case 5533:\n case 5789:\n case 5021:\n case 4765:\n // stretch, max-content, min-content, fill-available\n if (strlen(value) - 1 - length > 6) switch (charat(value, length + 1)) {\n // (m)ax-content, (m)in-content\n case 109:\n // -\n if (charat(value, length + 4) !== 45) break;\n // (f)ill-available, (f)it-content\n\n case 102:\n return replace(value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value;\n // (s)tretch\n\n case 115:\n return ~indexof(value, 'stretch') ? prefix(replace(value, 'stretch', 'fill-available'), length) + value : value;\n }\n break;\n // position: sticky\n\n case 4949:\n // (s)ticky?\n if (charat(value, length + 1) !== 115) break;\n // display: (flex|inline-flex)\n\n case 6444:\n switch (charat(value, strlen(value) - 3 - (~indexof(value, '!important') && 10))) {\n // stic(k)y\n case 107:\n return replace(value, ':', ':' + WEBKIT) + value;\n // (inline-)?fl(e)x\n\n case 101:\n return replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + WEBKIT + (charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3') + value;\n }\n\n break;\n // writing-mode\n\n case 5936:\n switch (charat(value, length + 11)) {\n // vertical-l(r)\n case 114:\n return WEBKIT + value + MS + replace(value, /[svh]\\w+-[tblr]{2}/, 'tb') + value;\n // vertical-r(l)\n\n case 108:\n return WEBKIT + value + MS + replace(value, /[svh]\\w+-[tblr]{2}/, 'tb-rl') + value;\n // horizontal(-)tb\n\n case 45:\n return WEBKIT + value + MS + replace(value, /[svh]\\w+-[tblr]{2}/, 'lr') + value;\n }\n\n return WEBKIT + value + MS + value + value;\n }\n\n return value;\n}\n\nvar prefixer = function prefixer(element, index, children, callback) {\n if (element.length > -1) if (!element[\"return\"]) switch (element.type) {\n case DECLARATION:\n element[\"return\"] = prefix(element.value, element.length);\n break;\n\n case KEYFRAMES:\n return serialize([copy(element, {\n value: replace(element.value, '@', '@' + WEBKIT)\n })], callback);\n\n case RULESET:\n if (element.length) return combine(element.props, function (value) {\n switch (match(value, /(::plac\\w+|:read-\\w+)/)) {\n // :read-(only|write)\n case ':read-only':\n case ':read-write':\n return serialize([copy(element, {\n props: [replace(value, /:(read-\\w+)/, ':' + MOZ + '$1')]\n })], callback);\n // :placeholder\n\n case '::placeholder':\n return serialize([copy(element, {\n props: [replace(value, /:(plac\\w+)/, ':' + WEBKIT + 'input-$1')]\n }), copy(element, {\n props: [replace(value, /:(plac\\w+)/, ':' + MOZ + '$1')]\n }), copy(element, {\n props: [replace(value, /:(plac\\w+)/, MS + 'input-$1')]\n })], callback);\n }\n\n return '';\n });\n }\n};\n\nvar getServerStylisCache = isBrowser ? undefined : weakMemoize(function () {\n return memoize(function () {\n return {};\n });\n});\nvar defaultStylisPlugins = [prefixer];\n\nvar createCache = function createCache(options) {\n var key = options.key;\n\n if (isBrowser && key === 'css') {\n var ssrStyles = document.querySelectorAll(\"style[data-emotion]:not([data-s])\"); // get SSRed styles out of the way of React's hydration\n // document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)\n // note this very very intentionally targets all style elements regardless of the key to ensure\n // that creating a cache works inside of render of a React component\n\n Array.prototype.forEach.call(ssrStyles, function (node) {\n // we want to only move elements which have a space in the data-emotion attribute value\n // because that indicates that it is an Emotion 11 server-side rendered style elements\n // while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector\n // Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes)\n // so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles\n // will not result in the Emotion 10 styles being destroyed\n var dataEmotionAttribute = node.getAttribute('data-emotion');\n\n if (dataEmotionAttribute.indexOf(' ') === -1) {\n return;\n }\n\n document.head.appendChild(node);\n node.setAttribute('data-s', '');\n });\n }\n\n var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;\n\n var inserted = {};\n var container;\n var nodesToHydrate = [];\n\n if (isBrowser) {\n container = options.container || document.head;\n Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which\n // means that the style elements we're looking at are only Emotion 11 server-rendered style elements\n document.querySelectorAll(\"style[data-emotion^=\\\"\" + key + \" \\\"]\"), function (node) {\n var attrib = node.getAttribute(\"data-emotion\").split(' ');\n\n for (var i = 1; i < attrib.length; i++) {\n inserted[attrib[i]] = true;\n }\n\n nodesToHydrate.push(node);\n });\n }\n\n var _insert;\n\n var omnipresentPlugins = [compat, removeLabel];\n\n if (!getServerStylisCache) {\n var currentSheet;\n var finalizingPlugins = [stringify, rulesheet(function (rule) {\n currentSheet.insert(rule);\n })];\n var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));\n\n var stylis = function stylis(styles) {\n return serialize(compile(styles), serializer);\n };\n\n _insert = function insert(selector, serialized, sheet, shouldCache) {\n currentSheet = sheet;\n\n stylis(selector ? selector + \"{\" + serialized.styles + \"}\" : serialized.styles);\n\n if (shouldCache) {\n cache.inserted[serialized.name] = true;\n }\n };\n } else {\n var _finalizingPlugins = [stringify];\n\n var _serializer = middleware(omnipresentPlugins.concat(stylisPlugins, _finalizingPlugins));\n\n var _stylis = function _stylis(styles) {\n return serialize(compile(styles), _serializer);\n };\n\n var serverStylisCache = getServerStylisCache(stylisPlugins)(key);\n\n var getRules = function getRules(selector, serialized) {\n var name = serialized.name;\n\n if (serverStylisCache[name] === undefined) {\n serverStylisCache[name] = _stylis(selector ? selector + \"{\" + serialized.styles + \"}\" : serialized.styles);\n }\n\n return serverStylisCache[name];\n };\n\n _insert = function _insert(selector, serialized, sheet, shouldCache) {\n var name = serialized.name;\n var rules = getRules(selector, serialized);\n\n if (cache.compat === undefined) {\n // in regular mode, we don't set the styles on the inserted cache\n // since we don't need to and that would be wasting memory\n // we return them so that they are rendered in a style tag\n if (shouldCache) {\n cache.inserted[name] = true;\n }\n\n return rules;\n } else {\n // in compat mode, we put the styles on the inserted cache so\n // that emotion-server can pull out the styles\n // except when we don't want to cache it which was in Global but now\n // is nowhere but we don't want to do a major right now\n // and just in case we're going to leave the case here\n // it's also not affecting client side bundle size\n // so it's really not a big deal\n if (shouldCache) {\n cache.inserted[name] = rules;\n } else {\n return rules;\n }\n }\n };\n }\n\n var cache = {\n key: key,\n sheet: new StyleSheet({\n key: key,\n container: container,\n nonce: options.nonce,\n speedy: options.speedy,\n prepend: options.prepend,\n insertionPoint: options.insertionPoint\n }),\n nonce: options.nonce,\n inserted: inserted,\n registered: {},\n insert: _insert\n };\n cache.sheet.hydrate(nodesToHydrate);\n return cache;\n};\n\nexport { createCache as default };\n","/** @license React v16.13.1\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';var b=\"function\"===typeof Symbol&&Symbol.for,c=b?Symbol.for(\"react.element\"):60103,d=b?Symbol.for(\"react.portal\"):60106,e=b?Symbol.for(\"react.fragment\"):60107,f=b?Symbol.for(\"react.strict_mode\"):60108,g=b?Symbol.for(\"react.profiler\"):60114,h=b?Symbol.for(\"react.provider\"):60109,k=b?Symbol.for(\"react.context\"):60110,l=b?Symbol.for(\"react.async_mode\"):60111,m=b?Symbol.for(\"react.concurrent_mode\"):60111,n=b?Symbol.for(\"react.forward_ref\"):60112,p=b?Symbol.for(\"react.suspense\"):60113,q=b?\nSymbol.for(\"react.suspense_list\"):60120,r=b?Symbol.for(\"react.memo\"):60115,t=b?Symbol.for(\"react.lazy\"):60116,v=b?Symbol.for(\"react.block\"):60121,w=b?Symbol.for(\"react.fundamental\"):60117,x=b?Symbol.for(\"react.responder\"):60118,y=b?Symbol.for(\"react.scope\"):60119;\nfunction z(a){if(\"object\"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;\nexports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t};\nexports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p};\nexports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||\"object\"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z;\n","/** @license React v16.13.1\n * react-is.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\n\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n'use strict';\n\n// The Symbol used to tag the ReactElement-like types. If there is no native Symbol\n// nor polyfill, then a plain number is used for performance.\nvar hasSymbol = typeof Symbol === 'function' && Symbol.for;\nvar REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;\nvar REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;\nvar REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;\nvar REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;\nvar REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;\nvar REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;\nvar REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary\n// (unstable) APIs that have been removed. Can we remove the symbols?\n\nvar REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;\nvar REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;\nvar REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;\nvar REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;\nvar REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;\nvar REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;\nvar REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;\nvar REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;\nvar REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;\nvar REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;\nvar REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;\n\nfunction isValidElementType(type) {\n return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.\n type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);\n}\n\nfunction typeOf(object) {\n if (typeof object === 'object' && object !== null) {\n var $$typeof = object.$$typeof;\n\n switch ($$typeof) {\n case REACT_ELEMENT_TYPE:\n var type = object.type;\n\n switch (type) {\n case REACT_ASYNC_MODE_TYPE:\n case REACT_CONCURRENT_MODE_TYPE:\n case REACT_FRAGMENT_TYPE:\n case REACT_PROFILER_TYPE:\n case REACT_STRICT_MODE_TYPE:\n case REACT_SUSPENSE_TYPE:\n return type;\n\n default:\n var $$typeofType = type && type.$$typeof;\n\n switch ($$typeofType) {\n case REACT_CONTEXT_TYPE:\n case REACT_FORWARD_REF_TYPE:\n case REACT_LAZY_TYPE:\n case REACT_MEMO_TYPE:\n case REACT_PROVIDER_TYPE:\n return $$typeofType;\n\n default:\n return $$typeof;\n }\n\n }\n\n case REACT_PORTAL_TYPE:\n return $$typeof;\n }\n }\n\n return undefined;\n} // AsyncMode is deprecated along with isAsyncMode\n\nvar AsyncMode = REACT_ASYNC_MODE_TYPE;\nvar ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;\nvar ContextConsumer = REACT_CONTEXT_TYPE;\nvar ContextProvider = REACT_PROVIDER_TYPE;\nvar Element = REACT_ELEMENT_TYPE;\nvar ForwardRef = REACT_FORWARD_REF_TYPE;\nvar Fragment = REACT_FRAGMENT_TYPE;\nvar Lazy = REACT_LAZY_TYPE;\nvar Memo = REACT_MEMO_TYPE;\nvar Portal = REACT_PORTAL_TYPE;\nvar Profiler = REACT_PROFILER_TYPE;\nvar StrictMode = REACT_STRICT_MODE_TYPE;\nvar Suspense = REACT_SUSPENSE_TYPE;\nvar hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated\n\nfunction isAsyncMode(object) {\n {\n if (!hasWarnedAboutDeprecatedIsAsyncMode) {\n hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint\n\n console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');\n }\n }\n\n return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;\n}\nfunction isConcurrentMode(object) {\n return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;\n}\nfunction isContextConsumer(object) {\n return typeOf(object) === REACT_CONTEXT_TYPE;\n}\nfunction isContextProvider(object) {\n return typeOf(object) === REACT_PROVIDER_TYPE;\n}\nfunction isElement(object) {\n return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;\n}\nfunction isForwardRef(object) {\n return typeOf(object) === REACT_FORWARD_REF_TYPE;\n}\nfunction isFragment(object) {\n return typeOf(object) === REACT_FRAGMENT_TYPE;\n}\nfunction isLazy(object) {\n return typeOf(object) === REACT_LAZY_TYPE;\n}\nfunction isMemo(object) {\n return typeOf(object) === REACT_MEMO_TYPE;\n}\nfunction isPortal(object) {\n return typeOf(object) === REACT_PORTAL_TYPE;\n}\nfunction isProfiler(object) {\n return typeOf(object) === REACT_PROFILER_TYPE;\n}\nfunction isStrictMode(object) {\n return typeOf(object) === REACT_STRICT_MODE_TYPE;\n}\nfunction isSuspense(object) {\n return typeOf(object) === REACT_SUSPENSE_TYPE;\n}\n\nexports.AsyncMode = AsyncMode;\nexports.ConcurrentMode = ConcurrentMode;\nexports.ContextConsumer = ContextConsumer;\nexports.ContextProvider = ContextProvider;\nexports.Element = Element;\nexports.ForwardRef = ForwardRef;\nexports.Fragment = Fragment;\nexports.Lazy = Lazy;\nexports.Memo = Memo;\nexports.Portal = Portal;\nexports.Profiler = Profiler;\nexports.StrictMode = StrictMode;\nexports.Suspense = Suspense;\nexports.isAsyncMode = isAsyncMode;\nexports.isConcurrentMode = isConcurrentMode;\nexports.isContextConsumer = isContextConsumer;\nexports.isContextProvider = isContextProvider;\nexports.isElement = isElement;\nexports.isForwardRef = isForwardRef;\nexports.isFragment = isFragment;\nexports.isLazy = isLazy;\nexports.isMemo = isMemo;\nexports.isPortal = isPortal;\nexports.isProfiler = isProfiler;\nexports.isStrictMode = isStrictMode;\nexports.isSuspense = isSuspense;\nexports.isValidElementType = isValidElementType;\nexports.typeOf = typeOf;\n })();\n}\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","'use strict';\n\nvar reactIs = require('react-is');\n\n/**\n * Copyright 2015, Yahoo! Inc.\n * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.\n */\nvar REACT_STATICS = {\n childContextTypes: true,\n contextType: true,\n contextTypes: true,\n defaultProps: true,\n displayName: true,\n getDefaultProps: true,\n getDerivedStateFromError: true,\n getDerivedStateFromProps: true,\n mixins: true,\n propTypes: true,\n type: true\n};\nvar KNOWN_STATICS = {\n name: true,\n length: true,\n prototype: true,\n caller: true,\n callee: true,\n arguments: true,\n arity: true\n};\nvar FORWARD_REF_STATICS = {\n '$$typeof': true,\n render: true,\n defaultProps: true,\n displayName: true,\n propTypes: true\n};\nvar MEMO_STATICS = {\n '$$typeof': true,\n compare: true,\n defaultProps: true,\n displayName: true,\n propTypes: true,\n type: true\n};\nvar TYPE_STATICS = {};\nTYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;\nTYPE_STATICS[reactIs.Memo] = MEMO_STATICS;\n\nfunction getStatics(component) {\n // React v16.11 and below\n if (reactIs.isMemo(component)) {\n return MEMO_STATICS;\n } // React v16.12 and above\n\n\n return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;\n}\n\nvar defineProperty = Object.defineProperty;\nvar getOwnPropertyNames = Object.getOwnPropertyNames;\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\nvar getPrototypeOf = Object.getPrototypeOf;\nvar objectPrototype = Object.prototype;\nfunction hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {\n if (typeof sourceComponent !== 'string') {\n // don't hoist over string (html) components\n if (objectPrototype) {\n var inheritedComponent = getPrototypeOf(sourceComponent);\n\n if (inheritedComponent && inheritedComponent !== objectPrototype) {\n hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);\n }\n }\n\n var keys = getOwnPropertyNames(sourceComponent);\n\n if (getOwnPropertySymbols) {\n keys = keys.concat(getOwnPropertySymbols(sourceComponent));\n }\n\n var targetStatics = getStatics(targetComponent);\n var sourceStatics = getStatics(sourceComponent);\n\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n\n if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {\n var descriptor = getOwnPropertyDescriptor(sourceComponent, key);\n\n try {\n // Avoid failures from read-only properties\n defineProperty(targetComponent, key, descriptor);\n } catch (e) {}\n }\n }\n }\n\n return targetComponent;\n}\n\nmodule.exports = hoistNonReactStatics;\n","var isBrowser = typeof document !== 'undefined';\n\nfunction getRegisteredStyles(registered, registeredStyles, classNames) {\n var rawClassName = '';\n classNames.split(' ').forEach(function (className) {\n if (registered[className] !== undefined) {\n registeredStyles.push(registered[className] + \";\");\n } else if (className) {\n rawClassName += className + \" \";\n }\n });\n return rawClassName;\n}\nvar registerStyles = function registerStyles(cache, serialized, isStringTag) {\n var className = cache.key + \"-\" + serialized.name;\n\n if ( // we only need to add the styles to the registered cache if the\n // class name could be used further down\n // the tree but if it's a string tag, we know it won't\n // so we don't have to add it to registered cache.\n // this improves memory usage since we can avoid storing the whole style string\n (isStringTag === false || // we need to always store it if we're in compat mode and\n // in node since emotion-server relies on whether a style is in\n // the registered cache to know whether a style is global or not\n // also, note that this check will be dead code eliminated in the browser\n isBrowser === false && cache.compat !== undefined) && cache.registered[className] === undefined) {\n cache.registered[className] = serialized.styles;\n }\n};\nvar insertStyles = function insertStyles(cache, serialized, isStringTag) {\n registerStyles(cache, serialized, isStringTag);\n var className = cache.key + \"-\" + serialized.name;\n\n if (cache.inserted[serialized.name] === undefined) {\n var stylesForSSR = '';\n var current = serialized;\n\n do {\n var maybeStyles = cache.insert(serialized === current ? \".\" + className : '', current, cache.sheet, true);\n\n if (!isBrowser && maybeStyles !== undefined) {\n stylesForSSR += maybeStyles;\n }\n\n current = current.next;\n } while (current !== undefined);\n\n if (!isBrowser && stylesForSSR.length !== 0) {\n return stylesForSSR;\n }\n }\n};\n\nexport { getRegisteredStyles, insertStyles, registerStyles };\n","/* eslint-disable */\n// Inspired by https://github.com/garycourt/murmurhash-js\n// Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86\nfunction murmur2(str) {\n // 'm' and 'r' are mixing constants generated offline.\n // They're not really 'magic', they just happen to work well.\n // const m = 0x5bd1e995;\n // const r = 24;\n // Initialize the hash\n var h = 0; // Mix 4 bytes at a time into the hash\n\n var k,\n i = 0,\n len = str.length;\n\n for (; len >= 4; ++i, len -= 4) {\n k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;\n k =\n /* Math.imul(k, m): */\n (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16);\n k ^=\n /* k >>> r: */\n k >>> 24;\n h =\n /* Math.imul(k, m): */\n (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^\n /* Math.imul(h, m): */\n (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);\n } // Handle the last few bytes of the input array\n\n\n switch (len) {\n case 3:\n h ^= (str.charCodeAt(i + 2) & 0xff) << 16;\n\n case 2:\n h ^= (str.charCodeAt(i + 1) & 0xff) << 8;\n\n case 1:\n h ^= str.charCodeAt(i) & 0xff;\n h =\n /* Math.imul(h, m): */\n (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);\n } // Do a few final mixes of the hash to ensure the last few\n // bytes are well-incorporated.\n\n\n h ^= h >>> 13;\n h =\n /* Math.imul(h, m): */\n (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);\n return ((h ^ h >>> 15) >>> 0).toString(36);\n}\n\nexport { murmur2 as default };\n","var unitlessKeys = {\n animationIterationCount: 1,\n aspectRatio: 1,\n borderImageOutset: 1,\n borderImageSlice: 1,\n borderImageWidth: 1,\n boxFlex: 1,\n boxFlexGroup: 1,\n boxOrdinalGroup: 1,\n columnCount: 1,\n columns: 1,\n flex: 1,\n flexGrow: 1,\n flexPositive: 1,\n flexShrink: 1,\n flexNegative: 1,\n flexOrder: 1,\n gridRow: 1,\n gridRowEnd: 1,\n gridRowSpan: 1,\n gridRowStart: 1,\n gridColumn: 1,\n gridColumnEnd: 1,\n gridColumnSpan: 1,\n gridColumnStart: 1,\n msGridRow: 1,\n msGridRowSpan: 1,\n msGridColumn: 1,\n msGridColumnSpan: 1,\n fontWeight: 1,\n lineHeight: 1,\n opacity: 1,\n order: 1,\n orphans: 1,\n scale: 1,\n tabSize: 1,\n widows: 1,\n zIndex: 1,\n zoom: 1,\n WebkitLineClamp: 1,\n // SVG-related properties\n fillOpacity: 1,\n floodOpacity: 1,\n stopOpacity: 1,\n strokeDasharray: 1,\n strokeDashoffset: 1,\n strokeMiterlimit: 1,\n strokeOpacity: 1,\n strokeWidth: 1\n};\n\nexport { unitlessKeys as default };\n","import hashString from '@emotion/hash';\nimport unitless from '@emotion/unitless';\nimport memoize from '@emotion/memoize';\n\nvar isDevelopment = false;\n\nvar hyphenateRegex = /[A-Z]|^ms/g;\nvar animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g;\n\nvar isCustomProperty = function isCustomProperty(property) {\n return property.charCodeAt(1) === 45;\n};\n\nvar isProcessableValue = function isProcessableValue(value) {\n return value != null && typeof value !== 'boolean';\n};\n\nvar processStyleName = /* #__PURE__ */memoize(function (styleName) {\n return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase();\n});\n\nvar processStyleValue = function processStyleValue(key, value) {\n switch (key) {\n case 'animation':\n case 'animationName':\n {\n if (typeof value === 'string') {\n return value.replace(animationRegex, function (match, p1, p2) {\n cursor = {\n name: p1,\n styles: p2,\n next: cursor\n };\n return p1;\n });\n }\n }\n }\n\n if (unitless[key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0) {\n return value + 'px';\n }\n\n return value;\n};\n\nvar noComponentSelectorMessage = 'Component selectors can only be used in conjunction with ' + '@emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware ' + 'compiler transform.';\n\nfunction handleInterpolation(mergedProps, registered, interpolation) {\n if (interpolation == null) {\n return '';\n }\n\n var componentSelector = interpolation;\n\n if (componentSelector.__emotion_styles !== undefined) {\n\n return componentSelector;\n }\n\n switch (typeof interpolation) {\n case 'boolean':\n {\n return '';\n }\n\n case 'object':\n {\n var keyframes = interpolation;\n\n if (keyframes.anim === 1) {\n cursor = {\n name: keyframes.name,\n styles: keyframes.styles,\n next: cursor\n };\n return keyframes.name;\n }\n\n var serializedStyles = interpolation;\n\n if (serializedStyles.styles !== undefined) {\n var next = serializedStyles.next;\n\n if (next !== undefined) {\n // not the most efficient thing ever but this is a pretty rare case\n // and there will be very few iterations of this generally\n while (next !== undefined) {\n cursor = {\n name: next.name,\n styles: next.styles,\n next: cursor\n };\n next = next.next;\n }\n }\n\n var styles = serializedStyles.styles + \";\";\n return styles;\n }\n\n return createStringFromObject(mergedProps, registered, interpolation);\n }\n\n case 'function':\n {\n if (mergedProps !== undefined) {\n var previousCursor = cursor;\n var result = interpolation(mergedProps);\n cursor = previousCursor;\n return handleInterpolation(mergedProps, registered, result);\n }\n\n break;\n }\n } // finalize string values (regular strings and functions interpolated into css calls)\n\n\n var asString = interpolation;\n\n if (registered == null) {\n return asString;\n }\n\n var cached = registered[asString];\n return cached !== undefined ? cached : asString;\n}\n\nfunction createStringFromObject(mergedProps, registered, obj) {\n var string = '';\n\n if (Array.isArray(obj)) {\n for (var i = 0; i < obj.length; i++) {\n string += handleInterpolation(mergedProps, registered, obj[i]) + \";\";\n }\n } else {\n for (var key in obj) {\n var value = obj[key];\n\n if (typeof value !== 'object') {\n var asString = value;\n\n if (registered != null && registered[asString] !== undefined) {\n string += key + \"{\" + registered[asString] + \"}\";\n } else if (isProcessableValue(asString)) {\n string += processStyleName(key) + \":\" + processStyleValue(key, asString) + \";\";\n }\n } else {\n if (key === 'NO_COMPONENT_SELECTOR' && isDevelopment) {\n throw new Error(noComponentSelectorMessage);\n }\n\n if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) {\n for (var _i = 0; _i < value.length; _i++) {\n if (isProcessableValue(value[_i])) {\n string += processStyleName(key) + \":\" + processStyleValue(key, value[_i]) + \";\";\n }\n }\n } else {\n var interpolated = handleInterpolation(mergedProps, registered, value);\n\n switch (key) {\n case 'animation':\n case 'animationName':\n {\n string += processStyleName(key) + \":\" + interpolated + \";\";\n break;\n }\n\n default:\n {\n\n string += key + \"{\" + interpolated + \"}\";\n }\n }\n }\n }\n }\n }\n\n return string;\n}\n\nvar labelPattern = /label:\\s*([^\\s;{]+)\\s*(;|$)/g; // this is the cursor for keyframes\n// keyframes are stored on the SerializedStyles object as a linked list\n\nvar cursor;\nfunction serializeStyles(args, registered, mergedProps) {\n if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) {\n return args[0];\n }\n\n var stringMode = true;\n var styles = '';\n cursor = undefined;\n var strings = args[0];\n\n if (strings == null || strings.raw === undefined) {\n stringMode = false;\n styles += handleInterpolation(mergedProps, registered, strings);\n } else {\n var asTemplateStringsArr = strings;\n\n styles += asTemplateStringsArr[0];\n } // we start at 1 since we've already handled the first arg\n\n\n for (var i = 1; i < args.length; i++) {\n styles += handleInterpolation(mergedProps, registered, args[i]);\n\n if (stringMode) {\n var templateStringsArr = strings;\n\n styles += templateStringsArr[i];\n }\n } // using a global regex with .exec is stateful so lastIndex has to be reset each time\n\n\n labelPattern.lastIndex = 0;\n var identifierName = '';\n var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5\n\n while ((match = labelPattern.exec(styles)) !== null) {\n identifierName += '-' + match[1];\n }\n\n var name = hashString(styles) + identifierName;\n\n return {\n name: name,\n styles: styles,\n next: cursor\n };\n}\n\nexport { serializeStyles };\n","import * as React from 'react';\n\nvar isBrowser = typeof document !== 'undefined';\n\nvar syncFallback = function syncFallback(create) {\n return create();\n};\n\nvar useInsertionEffect = React['useInsertion' + 'Effect'] ? React['useInsertion' + 'Effect'] : false;\nvar useInsertionEffectAlwaysWithSyncFallback = !isBrowser ? syncFallback : useInsertionEffect || syncFallback;\nvar useInsertionEffectWithLayoutFallback = useInsertionEffect || React.useLayoutEffect;\n\nexport { useInsertionEffectAlwaysWithSyncFallback, useInsertionEffectWithLayoutFallback };\n","import * as React from 'react';\nimport { useContext, forwardRef } from 'react';\nimport createCache from '@emotion/cache';\nimport _extends from '@babel/runtime/helpers/esm/extends';\nimport weakMemoize from '@emotion/weak-memoize';\nimport hoistNonReactStatics from '../_isolated-hnrs/dist/emotion-react-_isolated-hnrs.esm.js';\nimport { getRegisteredStyles, registerStyles, insertStyles } from '@emotion/utils';\nimport { serializeStyles } from '@emotion/serialize';\nimport { useInsertionEffectAlwaysWithSyncFallback } from '@emotion/use-insertion-effect-with-fallbacks';\n\nvar isDevelopment = false;\n\nvar isBrowser = typeof document !== 'undefined';\n\nvar EmotionCacheContext = /* #__PURE__ */React.createContext( // we're doing this to avoid preconstruct's dead code elimination in this one case\n// because this module is primarily intended for the browser and node\n// but it's also required in react native and similar environments sometimes\n// and we could have a special build just for that\n// but this is much easier and the native packages\n// might use a different theme context in the future anyway\ntypeof HTMLElement !== 'undefined' ? /* #__PURE__ */createCache({\n key: 'css'\n}) : null);\n\nvar CacheProvider = EmotionCacheContext.Provider;\nvar __unsafe_useEmotionCache = function useEmotionCache() {\n return useContext(EmotionCacheContext);\n};\n\nvar withEmotionCache = function withEmotionCache(func) {\n return /*#__PURE__*/forwardRef(function (props, ref) {\n // the cache will never be null in the browser\n var cache = useContext(EmotionCacheContext);\n return func(props, cache, ref);\n });\n};\n\nif (!isBrowser) {\n withEmotionCache = function withEmotionCache(func) {\n return function (props) {\n var cache = useContext(EmotionCacheContext);\n\n if (cache === null) {\n // yes, we're potentially creating this on every render\n // it doesn't actually matter though since it's only on the server\n // so there will only every be a single render\n // that could change in the future because of suspense and etc. but for now,\n // this works and i don't want to optimise for a future thing that we aren't sure about\n cache = createCache({\n key: 'css'\n });\n return /*#__PURE__*/React.createElement(EmotionCacheContext.Provider, {\n value: cache\n }, func(props, cache));\n } else {\n return func(props, cache);\n }\n };\n };\n}\n\nvar ThemeContext = /* #__PURE__ */React.createContext({});\n\nvar useTheme = function useTheme() {\n return React.useContext(ThemeContext);\n};\n\nvar getTheme = function getTheme(outerTheme, theme) {\n if (typeof theme === 'function') {\n var mergedTheme = theme(outerTheme);\n\n return mergedTheme;\n }\n\n return _extends({}, outerTheme, theme);\n};\n\nvar createCacheWithTheme = /* #__PURE__ */weakMemoize(function (outerTheme) {\n return weakMemoize(function (theme) {\n return getTheme(outerTheme, theme);\n });\n});\nvar ThemeProvider = function ThemeProvider(props) {\n var theme = React.useContext(ThemeContext);\n\n if (props.theme !== theme) {\n theme = createCacheWithTheme(theme)(props.theme);\n }\n\n return /*#__PURE__*/React.createElement(ThemeContext.Provider, {\n value: theme\n }, props.children);\n};\nfunction withTheme(Component) {\n var componentName = Component.displayName || Component.name || 'Component';\n var WithTheme = /*#__PURE__*/React.forwardRef(function render(props, ref) {\n var theme = React.useContext(ThemeContext);\n return /*#__PURE__*/React.createElement(Component, _extends({\n theme: theme,\n ref: ref\n }, props));\n });\n WithTheme.displayName = \"WithTheme(\" + componentName + \")\";\n return hoistNonReactStatics(WithTheme, Component);\n}\n\nvar hasOwn = {}.hasOwnProperty;\n\nvar typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__';\nvar createEmotionProps = function createEmotionProps(type, props) {\n\n var newProps = {};\n\n for (var _key in props) {\n if (hasOwn.call(props, _key)) {\n newProps[_key] = props[_key];\n }\n }\n\n newProps[typePropName] = type; // Runtime labeling is an opt-in feature because:\n\n return newProps;\n};\n\nvar Insertion = function Insertion(_ref) {\n var cache = _ref.cache,\n serialized = _ref.serialized,\n isStringTag = _ref.isStringTag;\n registerStyles(cache, serialized, isStringTag);\n var rules = useInsertionEffectAlwaysWithSyncFallback(function () {\n return insertStyles(cache, serialized, isStringTag);\n });\n\n if (!isBrowser && rules !== undefined) {\n var _ref2;\n\n var serializedNames = serialized.name;\n var next = serialized.next;\n\n while (next !== undefined) {\n serializedNames += ' ' + next.name;\n next = next.next;\n }\n\n return /*#__PURE__*/React.createElement(\"style\", (_ref2 = {}, _ref2[\"data-emotion\"] = cache.key + \" \" + serializedNames, _ref2.dangerouslySetInnerHTML = {\n __html: rules\n }, _ref2.nonce = cache.sheet.nonce, _ref2));\n }\n\n return null;\n};\n\nvar Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {\n var cssProp = props.css; // so that using `css` from `emotion` and passing the result to the css prop works\n // not passing the registered cache to serializeStyles because it would\n // make certain babel optimisations not possible\n\n if (typeof cssProp === 'string' && cache.registered[cssProp] !== undefined) {\n cssProp = cache.registered[cssProp];\n }\n\n var WrappedComponent = props[typePropName];\n var registeredStyles = [cssProp];\n var className = '';\n\n if (typeof props.className === 'string') {\n className = getRegisteredStyles(cache.registered, registeredStyles, props.className);\n } else if (props.className != null) {\n className = props.className + \" \";\n }\n\n var serialized = serializeStyles(registeredStyles, undefined, React.useContext(ThemeContext));\n\n className += cache.key + \"-\" + serialized.name;\n var newProps = {};\n\n for (var _key2 in props) {\n if (hasOwn.call(props, _key2) && _key2 !== 'css' && _key2 !== typePropName && (!isDevelopment )) {\n newProps[_key2] = props[_key2];\n }\n }\n\n newProps.className = className;\n\n if (ref) {\n newProps.ref = ref;\n }\n\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Insertion, {\n cache: cache,\n serialized: serialized,\n isStringTag: typeof WrappedComponent === 'string'\n }), /*#__PURE__*/React.createElement(WrappedComponent, newProps));\n});\n\nvar Emotion$1 = Emotion;\n\nexport { CacheProvider as C, Emotion$1 as E, ThemeContext as T, __unsafe_useEmotionCache as _, isDevelopment as a, ThemeProvider as b, createEmotionProps as c, withTheme as d, hasOwn as h, isBrowser as i, useTheme as u, withEmotionCache as w };\n","import { h as hasOwn, E as Emotion, c as createEmotionProps, w as withEmotionCache, T as ThemeContext, i as isBrowser, a as isDevelopment } from './emotion-element-d59e098f.esm.js';\nexport { C as CacheProvider, T as ThemeContext, b as ThemeProvider, _ as __unsafe_useEmotionCache, u as useTheme, w as withEmotionCache, d as withTheme } from './emotion-element-d59e098f.esm.js';\nimport * as React from 'react';\nimport { insertStyles, registerStyles, getRegisteredStyles } from '@emotion/utils';\nimport { useInsertionEffectWithLayoutFallback, useInsertionEffectAlwaysWithSyncFallback } from '@emotion/use-insertion-effect-with-fallbacks';\nimport { serializeStyles } from '@emotion/serialize';\nimport '@emotion/cache';\nimport '@babel/runtime/helpers/extends';\nimport '@emotion/weak-memoize';\nimport '../_isolated-hnrs/dist/emotion-react-_isolated-hnrs.esm.js';\nimport 'hoist-non-react-statics';\n\nvar jsx = function jsx(type, props) {\n // eslint-disable-next-line prefer-rest-params\n var args = arguments;\n\n if (props == null || !hasOwn.call(props, 'css')) {\n return React.createElement.apply(undefined, args);\n }\n\n var argsLength = args.length;\n var createElementArgArray = new Array(argsLength);\n createElementArgArray[0] = Emotion;\n createElementArgArray[1] = createEmotionProps(type, props);\n\n for (var i = 2; i < argsLength; i++) {\n createElementArgArray[i] = args[i];\n }\n\n return React.createElement.apply(null, createElementArgArray);\n};\n\n(function (_jsx) {\n var JSX;\n\n (function (_JSX) {})(JSX || (JSX = _jsx.JSX || (_jsx.JSX = {})));\n})(jsx || (jsx = {}));\n\n// initial render from browser, insertBefore context.sheet.tags[0] or if a style hasn't been inserted there yet, appendChild\n// initial client-side render from SSR, use place of hydrating tag\n\nvar Global = /* #__PURE__ */withEmotionCache(function (props, cache) {\n\n var styles = props.styles;\n var serialized = serializeStyles([styles], undefined, React.useContext(ThemeContext));\n\n if (!isBrowser) {\n var _ref;\n\n var serializedNames = serialized.name;\n var serializedStyles = serialized.styles;\n var next = serialized.next;\n\n while (next !== undefined) {\n serializedNames += ' ' + next.name;\n serializedStyles += next.styles;\n next = next.next;\n }\n\n var shouldCache = cache.compat === true;\n var rules = cache.insert(\"\", {\n name: serializedNames,\n styles: serializedStyles\n }, cache.sheet, shouldCache);\n\n if (shouldCache) {\n return null;\n }\n\n return /*#__PURE__*/React.createElement(\"style\", (_ref = {}, _ref[\"data-emotion\"] = cache.key + \"-global \" + serializedNames, _ref.dangerouslySetInnerHTML = {\n __html: rules\n }, _ref.nonce = cache.sheet.nonce, _ref));\n } // yes, i know these hooks are used conditionally\n // but it is based on a constant that will never change at runtime\n // it's effectively like having two implementations and switching them out\n // so it's not actually breaking anything\n\n\n var sheetRef = React.useRef();\n useInsertionEffectWithLayoutFallback(function () {\n var key = cache.key + \"-global\"; // use case of https://github.com/emotion-js/emotion/issues/2675\n\n var sheet = new cache.sheet.constructor({\n key: key,\n nonce: cache.sheet.nonce,\n container: cache.sheet.container,\n speedy: cache.sheet.isSpeedy\n });\n var rehydrating = false;\n var node = document.querySelector(\"style[data-emotion=\\\"\" + key + \" \" + serialized.name + \"\\\"]\");\n\n if (cache.sheet.tags.length) {\n sheet.before = cache.sheet.tags[0];\n }\n\n if (node !== null) {\n rehydrating = true; // clear the hash so this node won't be recognizable as rehydratable by other <Global/>s\n\n node.setAttribute('data-emotion', key);\n sheet.hydrate([node]);\n }\n\n sheetRef.current = [sheet, rehydrating];\n return function () {\n sheet.flush();\n };\n }, [cache]);\n useInsertionEffectWithLayoutFallback(function () {\n var sheetRefCurrent = sheetRef.current;\n var sheet = sheetRefCurrent[0],\n rehydrating = sheetRefCurrent[1];\n\n if (rehydrating) {\n sheetRefCurrent[1] = false;\n return;\n }\n\n if (serialized.next !== undefined) {\n // insert keyframes\n insertStyles(cache, serialized.next, true);\n }\n\n if (sheet.tags.length) {\n // if this doesn't exist then it will be null so the style element will be appended\n var element = sheet.tags[sheet.tags.length - 1].nextElementSibling;\n sheet.before = element;\n sheet.flush();\n }\n\n cache.insert(\"\", serialized, sheet, false);\n }, [cache, serialized.name]);\n return null;\n});\n\nfunction css() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return serializeStyles(args);\n}\n\nfunction keyframes() {\n var insertable = css.apply(void 0, arguments);\n var name = \"animation-\" + insertable.name;\n return {\n name: name,\n styles: \"@keyframes \" + name + \"{\" + insertable.styles + \"}\",\n anim: 1,\n toString: function toString() {\n return \"_EMO_\" + this.name + \"_\" + this.styles + \"_EMO_\";\n }\n };\n}\n\nvar classnames = function classnames(args) {\n var len = args.length;\n var i = 0;\n var cls = '';\n\n for (; i < len; i++) {\n var arg = args[i];\n if (arg == null) continue;\n var toAdd = void 0;\n\n switch (typeof arg) {\n case 'boolean':\n break;\n\n case 'object':\n {\n if (Array.isArray(arg)) {\n toAdd = classnames(arg);\n } else {\n\n toAdd = '';\n\n for (var k in arg) {\n if (arg[k] && k) {\n toAdd && (toAdd += ' ');\n toAdd += k;\n }\n }\n }\n\n break;\n }\n\n default:\n {\n toAdd = arg;\n }\n }\n\n if (toAdd) {\n cls && (cls += ' ');\n cls += toAdd;\n }\n }\n\n return cls;\n};\n\nfunction merge(registered, css, className) {\n var registeredStyles = [];\n var rawClassName = getRegisteredStyles(registered, registeredStyles, className);\n\n if (registeredStyles.length < 2) {\n return className;\n }\n\n return rawClassName + css(registeredStyles);\n}\n\nvar Insertion = function Insertion(_ref) {\n var cache = _ref.cache,\n serializedArr = _ref.serializedArr;\n var rules = useInsertionEffectAlwaysWithSyncFallback(function () {\n var rules = '';\n\n for (var i = 0; i < serializedArr.length; i++) {\n var res = insertStyles(cache, serializedArr[i], false);\n\n if (!isBrowser && res !== undefined) {\n rules += res;\n }\n }\n\n if (!isBrowser) {\n return rules;\n }\n });\n\n if (!isBrowser && rules.length !== 0) {\n var _ref2;\n\n return /*#__PURE__*/React.createElement(\"style\", (_ref2 = {}, _ref2[\"data-emotion\"] = cache.key + \" \" + serializedArr.map(function (serialized) {\n return serialized.name;\n }).join(' '), _ref2.dangerouslySetInnerHTML = {\n __html: rules\n }, _ref2.nonce = cache.sheet.nonce, _ref2));\n }\n\n return null;\n};\n\nvar ClassNames = /* #__PURE__ */withEmotionCache(function (props, cache) {\n var hasRendered = false;\n var serializedArr = [];\n\n var css = function css() {\n if (hasRendered && isDevelopment) {\n throw new Error('css can only be used during render');\n }\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var serialized = serializeStyles(args, cache.registered);\n serializedArr.push(serialized); // registration has to happen here as the result of this might get consumed by `cx`\n\n registerStyles(cache, serialized, false);\n return cache.key + \"-\" + serialized.name;\n };\n\n var cx = function cx() {\n if (hasRendered && isDevelopment) {\n throw new Error('cx can only be used during render');\n }\n\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n return merge(cache.registered, css, classnames(args));\n };\n\n var content = {\n css: css,\n cx: cx,\n theme: React.useContext(ThemeContext)\n };\n var ele = props.children(content);\n hasRendered = true;\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Insertion, {\n cache: cache,\n serializedArr: serializedArr\n }), ele);\n});\n\nexport { ClassNames, Global, jsx as createElement, css, jsx, keyframes };\n","import createCache from '@emotion/cache';\nimport { serializeStyles } from '@emotion/serialize';\nimport { getRegisteredStyles, insertStyles } from '@emotion/utils';\n\nfunction insertWithoutScoping(cache, serialized) {\n if (cache.inserted[serialized.name] === undefined) {\n return cache.insert('', serialized, cache.sheet, true);\n }\n}\n\nfunction merge(registered, css, className) {\n var registeredStyles = [];\n var rawClassName = getRegisteredStyles(registered, registeredStyles, className);\n\n if (registeredStyles.length < 2) {\n return className;\n }\n\n return rawClassName + css(registeredStyles);\n}\n\nvar createEmotion = function createEmotion(options) {\n var cache = createCache(options);\n\n cache.sheet.speedy = function (value) {\n\n this.isSpeedy = value;\n };\n\n cache.compat = true;\n\n var css = function css() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var serialized = serializeStyles(args, cache.registered, undefined);\n insertStyles(cache, serialized, false);\n return cache.key + \"-\" + serialized.name;\n };\n\n var keyframes = function keyframes() {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n var serialized = serializeStyles(args, cache.registered);\n var animation = \"animation-\" + serialized.name;\n insertWithoutScoping(cache, {\n name: serialized.name,\n styles: \"@keyframes \" + animation + \"{\" + serialized.styles + \"}\"\n });\n return animation;\n };\n\n var injectGlobal = function injectGlobal() {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n\n var serialized = serializeStyles(args, cache.registered);\n insertWithoutScoping(cache, serialized);\n };\n\n var cx = function cx() {\n for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n args[_key4] = arguments[_key4];\n }\n\n return merge(cache.registered, css, classnames(args));\n };\n\n return {\n css: css,\n cx: cx,\n injectGlobal: injectGlobal,\n keyframes: keyframes,\n hydrate: function hydrate(ids) {\n ids.forEach(function (key) {\n cache.inserted[key] = true;\n });\n },\n flush: function flush() {\n cache.registered = {};\n cache.inserted = {};\n cache.sheet.flush();\n },\n sheet: cache.sheet,\n cache: cache,\n getRegisteredStyles: getRegisteredStyles.bind(null, cache.registered),\n merge: merge.bind(null, cache.registered, css)\n };\n};\n\nvar classnames = function classnames(args) {\n var cls = '';\n\n for (var i = 0; i < args.length; i++) {\n var arg = args[i];\n if (arg == null) continue;\n var toAdd = void 0;\n\n switch (typeof arg) {\n case 'boolean':\n break;\n\n case 'object':\n {\n if (Array.isArray(arg)) {\n toAdd = classnames(arg);\n } else {\n toAdd = '';\n\n for (var k in arg) {\n if (arg[k] && k) {\n toAdd && (toAdd += ' ');\n toAdd += k;\n }\n }\n }\n\n break;\n }\n\n default:\n {\n toAdd = arg;\n }\n }\n\n if (toAdd) {\n cls && (cls += ' ');\n cls += toAdd;\n }\n }\n\n return cls;\n};\n\nexport { createEmotion as default };\n","import createEmotion from '../create-instance/dist/emotion-css-create-instance.esm.js';\nimport '@emotion/cache';\nimport '@emotion/serialize';\nimport '@emotion/utils';\n\nvar _createEmotion = createEmotion({\n key: 'css'\n}),\n flush = _createEmotion.flush,\n hydrate = _createEmotion.hydrate,\n cx = _createEmotion.cx,\n merge = _createEmotion.merge,\n getRegisteredStyles = _createEmotion.getRegisteredStyles,\n injectGlobal = _createEmotion.injectGlobal,\n keyframes = _createEmotion.keyframes,\n css = _createEmotion.css,\n sheet = _createEmotion.sheet,\n cache = _createEmotion.cache;\n\nexport { cache, css, cx, flush, getRegisteredStyles, hydrate, injectGlobal, keyframes, merge, sheet };\n","// packages/components/src/utils/hooks/use-cx.ts\nimport { __unsafe_useEmotionCache as useEmotionCache } from \"@emotion/react\";\nimport { insertStyles } from \"@emotion/utils\";\nimport { cx as innerCx } from \"@emotion/css\";\nimport { useCallback } from \"@wordpress/element\";\nvar isSerializedStyles = (o) => typeof o !== \"undefined\" && o !== null && [\"name\", \"styles\"].every((p) => typeof o[p] !== \"undefined\");\nvar useCx = () => {\n const cache = useEmotionCache();\n const cx = useCallback((...classNames) => {\n if (cache === null) {\n throw new Error(\"The `useCx` hook should be only used within a valid Emotion Cache Context\");\n }\n return innerCx(...classNames.map((arg) => {\n if (isSerializedStyles(arg)) {\n insertStyles(cache, arg, false);\n return `${cache.key}-${arg.name}`;\n }\n return arg;\n }));\n }, [cache]);\n return cx;\n};\nexport {\n useCx\n};\n//# sourceMappingURL=use-cx.mjs.map\n","/**\n * Memize options object.\n *\n * @typedef MemizeOptions\n *\n * @property {number} [maxSize] Maximum size of the cache.\n */\n\n/**\n * Internal cache entry.\n *\n * @typedef MemizeCacheNode\n *\n * @property {?MemizeCacheNode|undefined} [prev] Previous node.\n * @property {?MemizeCacheNode|undefined} [next] Next node.\n * @property {Array<*>} args Function arguments for cache\n * entry.\n * @property {*} val Function result.\n */\n\n/**\n * Properties of the enhanced function for controlling cache.\n *\n * @typedef MemizeMemoizedFunction\n *\n * @property {()=>void} clear Clear the cache.\n */\n\n/**\n * Accepts a function to be memoized, and returns a new memoized function, with\n * optional options.\n *\n * @template {(...args: any[]) => any} F\n *\n * @param {F} fn Function to memoize.\n * @param {MemizeOptions} [options] Options object.\n *\n * @return {((...args: Parameters<F>) => ReturnType<F>) & MemizeMemoizedFunction} Memoized function.\n */\nfunction memize(fn, options) {\n\tvar size = 0;\n\n\t/** @type {?MemizeCacheNode|undefined} */\n\tvar head;\n\n\t/** @type {?MemizeCacheNode|undefined} */\n\tvar tail;\n\n\toptions = options || {};\n\n\tfunction memoized(/* ...args */) {\n\t\tvar node = head,\n\t\t\tlen = arguments.length,\n\t\t\targs,\n\t\t\ti;\n\n\t\tsearchCache: while (node) {\n\t\t\t// Perform a shallow equality test to confirm that whether the node\n\t\t\t// under test is a candidate for the arguments passed. Two arrays\n\t\t\t// are shallowly equal if their length matches and each entry is\n\t\t\t// strictly equal between the two sets. Avoid abstracting to a\n\t\t\t// function which could incur an arguments leaking deoptimization.\n\n\t\t\t// Check whether node arguments match arguments length\n\t\t\tif (node.args.length !== arguments.length) {\n\t\t\t\tnode = node.next;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Check whether node arguments match arguments values\n\t\t\tfor (i = 0; i < len; i++) {\n\t\t\t\tif (node.args[i] !== arguments[i]) {\n\t\t\t\t\tnode = node.next;\n\t\t\t\t\tcontinue searchCache;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// At this point we can assume we've found a match\n\n\t\t\t// Surface matched node to head if not already\n\t\t\tif (node !== head) {\n\t\t\t\t// As tail, shift to previous. Must only shift if not also\n\t\t\t\t// head, since if both head and tail, there is no previous.\n\t\t\t\tif (node === tail) {\n\t\t\t\t\ttail = node.prev;\n\t\t\t\t}\n\n\t\t\t\t// Adjust siblings to point to each other. If node was tail,\n\t\t\t\t// this also handles new tail's empty `next` assignment.\n\t\t\t\t/** @type {MemizeCacheNode} */ (node.prev).next = node.next;\n\t\t\t\tif (node.next) {\n\t\t\t\t\tnode.next.prev = node.prev;\n\t\t\t\t}\n\n\t\t\t\tnode.next = head;\n\t\t\t\tnode.prev = null;\n\t\t\t\t/** @type {MemizeCacheNode} */ (head).prev = node;\n\t\t\t\thead = node;\n\t\t\t}\n\n\t\t\t// Return immediately\n\t\t\treturn node.val;\n\t\t}\n\n\t\t// No cached value found. Continue to insertion phase:\n\n\t\t// Create a copy of arguments (avoid leaking deoptimization)\n\t\targs = new Array(len);\n\t\tfor (i = 0; i < len; i++) {\n\t\t\targs[i] = arguments[i];\n\t\t}\n\n\t\tnode = {\n\t\t\targs: args,\n\n\t\t\t// Generate the result from original function\n\t\t\tval: fn.apply(null, args),\n\t\t};\n\n\t\t// Don't need to check whether node is already head, since it would\n\t\t// have been returned above already if it was\n\n\t\t// Shift existing head down list\n\t\tif (head) {\n\t\t\thead.prev = node;\n\t\t\tnode.next = head;\n\t\t} else {\n\t\t\t// If no head, follows that there's no tail (at initial or reset)\n\t\t\ttail = node;\n\t\t}\n\n\t\t// Trim tail if we're reached max size and are pending cache insertion\n\t\tif (size === /** @type {MemizeOptions} */ (options).maxSize) {\n\t\t\ttail = /** @type {MemizeCacheNode} */ (tail).prev;\n\t\t\t/** @type {MemizeCacheNode} */ (tail).next = null;\n\t\t} else {\n\t\t\tsize++;\n\t\t}\n\n\t\thead = node;\n\n\t\treturn node.val;\n\t}\n\n\tmemoized.clear = function () {\n\t\thead = null;\n\t\ttail = null;\n\t\tsize = 0;\n\t};\n\n\t// Ignore reason: There's not a clear solution to create an intersection of\n\t// the function with additional properties, where the goal is to retain the\n\t// function signature of the incoming argument and add control properties\n\t// on the return value.\n\n\t// @ts-ignore\n\treturn memoized;\n}\n\nexport { memize as default };\n","// packages/components/src/utils/colors-values.js\nvar white = \"#fff\";\nvar GRAY = {\n 900: \"#1e1e1e\",\n 800: \"#2f2f2f\",\n /** Meets 4.6:1 text contrast against white. */\n 700: \"#757575\",\n /** Meets 3:1 UI or large text contrast against white. */\n 600: \"#949494\",\n 400: \"#ccc\",\n /** Used for most borders. */\n 300: \"#ddd\",\n /** Used sparingly for light borders. */\n 200: \"#e0e0e0\",\n /** Used for light gray backgrounds. */\n 100: \"#f0f0f0\"\n};\nvar ALERT = {\n yellow: \"#f0b849\",\n red: \"#d94f4f\",\n green: \"#4ab866\"\n};\nvar THEME = {\n accent: `var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9))`,\n accentDarker10: `var(--wp-components-color-accent-darker-10, var(--wp-admin-theme-color-darker-10, #2145e6))`,\n accentDarker20: `var(--wp-components-color-accent-darker-20, var(--wp-admin-theme-color-darker-20, #183ad6))`,\n /** Used when placing text on the accent color. */\n accentInverted: `var(--wp-components-color-accent-inverted, var(--wpds-color-foreground-interactive-brand-strong, #fff))`,\n background: `var(--wp-components-color-background, var(--wpds-color-background-surface-neutral-strong, #fff))`,\n foreground: `var(--wp-components-color-foreground, var(--wpds-color-foreground-content-neutral, #1e1e1e))`,\n /** Used when placing text on the foreground color. */\n foregroundInverted: `var(--wp-components-color-foreground-inverted, var(--wpds-color-background-surface-neutral, #fcfcfc))`,\n gray: {\n /** @deprecated Use `COLORS.theme.foreground` instead. */\n 900: `var(--wp-components-color-foreground, var(--wpds-color-foreground-content-neutral, #1e1e1e))`,\n 800: `var(--wp-components-color-gray-800, var(--wpds-color-foreground-content-neutral, #1e1e1e))`,\n 700: `var(--wp-components-color-gray-700, var(--wpds-color-foreground-content-neutral-weak, #707070))`,\n 600: `var(--wp-components-color-gray-600, var(--wpds-color-stroke-interactive-neutral, #8d8d8d))`,\n 400: `var(--wp-components-color-gray-400, var(--wpds-color-stroke-interactive-neutral, #8d8d8d))`,\n 300: `var(--wp-components-color-gray-300, var(--wpds-color-stroke-surface-neutral, #dbdbdb))`,\n 200: `var(--wp-components-color-gray-200, var(--wpds-color-stroke-surface-neutral, #dbdbdb))`,\n 100: `var(--wp-components-color-gray-100, var(--wpds-color-background-surface-neutral, #fcfcfc))`\n }\n};\nvar UI = {\n background: THEME.background,\n backgroundDisabled: THEME.gray[100],\n border: THEME.gray[600],\n borderHover: THEME.gray[700],\n borderFocus: THEME.accent,\n borderDisabled: THEME.gray[400],\n textDisabled: THEME.gray[600],\n // Matches @wordpress/base-styles\n darkGrayPlaceholder: `color-mix(in srgb, ${THEME.foreground}, transparent 38%)`,\n lightGrayPlaceholder: `color-mix(in srgb, ${THEME.background}, transparent 35%)`\n};\nvar COLORS = Object.freeze({\n /**\n * The main gray color object.\n *\n * @deprecated Use semantic aliases in `COLORS.ui` or theme-ready variables in `COLORS.theme.gray`.\n */\n gray: GRAY,\n // TODO: Stop exporting this when everything is migrated to `theme` or `ui`\n /**\n * @deprecated Prefer theme-ready variables in `COLORS.theme`.\n */\n white,\n alert: ALERT,\n /**\n * Theme-ready variables with fallbacks.\n *\n * Prefer semantic aliases in `COLORS.ui` when applicable.\n */\n theme: THEME,\n /**\n * Semantic aliases (prefer these over raw variables when applicable).\n */\n ui: UI\n});\nvar colors_values_default = COLORS;\nexport {\n COLORS,\n colors_values_default as default\n};\n//# sourceMappingURL=colors-values.mjs.map\n","// packages/components/src/utils/config-values.js\nimport { COLORS } from \"./colors-values.mjs\";\nvar CONTROL_HEIGHT = \"36px\";\nvar CONTROL_PROPS = {\n // These values should be shared with TextControl.\n controlPaddingX: 12,\n controlPaddingXSmall: 8,\n controlPaddingXLarge: 12 * 1.3334,\n // TODO: Deprecate\n controlBoxShadowFocus: `0 0 0 0.5px ${COLORS.theme.accent}`,\n controlHeight: CONTROL_HEIGHT,\n controlHeightXSmall: `calc( ${CONTROL_HEIGHT} * 0.6 )`,\n controlHeightSmall: `calc( ${CONTROL_HEIGHT} * 0.8 )`,\n controlHeightLarge: `calc( ${CONTROL_HEIGHT} * 1.2 )`,\n controlHeightXLarge: `calc( ${CONTROL_HEIGHT} * 1.4 )`\n};\nvar config_values_default = Object.assign({}, CONTROL_PROPS, {\n colorDivider: \"rgba(0, 0, 0, 0.1)\",\n colorScrollbarThumb: \"rgba(0, 0, 0, 0.2)\",\n colorScrollbarThumbHover: \"rgba(0, 0, 0, 0.5)\",\n colorScrollbarTrack: \"rgba(0, 0, 0, 0.04)\",\n elevationIntensity: 1,\n radiusXSmall: \"1px\",\n radiusSmall: \"2px\",\n radiusMedium: \"4px\",\n radiusLarge: \"8px\",\n radiusFull: \"9999px\",\n radiusRound: \"50%\",\n borderWidth: \"1px\",\n borderWidthFocus: \"1.5px\",\n borderWidthTab: \"4px\",\n spinnerSize: 16,\n fontSize: \"13px\",\n fontSizeH1: \"calc(2.44 * 13px)\",\n fontSizeH2: \"calc(1.95 * 13px)\",\n fontSizeH3: \"calc(1.56 * 13px)\",\n fontSizeH4: \"calc(1.25 * 13px)\",\n fontSizeH5: \"13px\",\n fontSizeH6: \"calc(0.8 * 13px)\",\n fontSizeInputMobile: \"16px\",\n fontSizeMobile: \"15px\",\n fontSizeSmall: \"calc(0.92 * 13px)\",\n fontSizeXSmall: \"calc(0.75 * 13px)\",\n fontLineHeightBase: \"1.4\",\n fontWeight: \"normal\",\n fontWeightEmphasis: \"600\",\n gridBase: \"4px\",\n elevationXSmall: `0 1px 1px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.02), 0 3px 3px rgba(0, 0, 0, 0.02), 0 4px 4px rgba(0, 0, 0, 0.01)`,\n elevationSmall: `0 1px 2px rgba(0, 0, 0, 0.05), 0 2px 3px rgba(0, 0, 0, 0.04), 0 6px 6px rgba(0, 0, 0, 0.03), 0 8px 8px rgba(0, 0, 0, 0.02)`,\n elevationMedium: `0 2px 3px rgba(0, 0, 0, 0.05), 0 4px 5px rgba(0, 0, 0, 0.04), 0 12px 12px rgba(0, 0, 0, 0.03), 0 16px 16px rgba(0, 0, 0, 0.02)`,\n elevationLarge: `0 5px 15px rgba(0, 0, 0, 0.08), 0 15px 27px rgba(0, 0, 0, 0.07), 0 30px 36px rgba(0, 0, 0, 0.04), 0 50px 43px rgba(0, 0, 0, 0.02)`,\n surfaceBorderColor: \"rgba(0, 0, 0, 0.1)\",\n surfaceColor: COLORS.white,\n // Modal exit animation: `use-modal-exit-animation` parses this for the\n // `animationend` timeout race; keep the numeric duration equal to the WPDS\n // `motion-duration-md` token on `.components-modal__frame` in modal/style.scss.\n transitionDuration: \"200ms\",\n transitionDurationFast: \"160ms\",\n transitionDurationFaster: \"120ms\",\n transitionDurationFastest: \"100ms\",\n transitionTimingFunction: \"cubic-bezier(0.08, 0.52, 0.52, 1)\",\n transitionTimingFunctionControl: \"cubic-bezier(0.12, 0.8, 0.32, 1)\"\n});\nexport {\n config_values_default as default\n};\n//# sourceMappingURL=config-values.mjs.map\n","'use strict';\n\n// do not edit .js files directly - edit src/index.jst\n\n\n var envHasBigInt64Array = typeof BigInt64Array !== 'undefined';\n\n\nmodule.exports = function equal(a, b) {\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n\n if ((a instanceof Map) && (b instanceof Map)) {\n if (a.size !== b.size) return false;\n for (i of a.entries())\n if (!b.has(i[0])) return false;\n for (i of a.entries())\n if (!equal(i[1], b.get(i[0]))) return false;\n return true;\n }\n\n if ((a instanceof Set) && (b instanceof Set)) {\n if (a.size !== b.size) return false;\n for (i of a.entries())\n if (!b.has(i[0])) return false;\n return true;\n }\n\n if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (a[i] !== b[i]) return false;\n return true;\n }\n\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n\n for (i = length; i-- !== 0;) {\n var key = keys[i];\n\n if (!equal(a[key], b[key])) return false;\n }\n\n return true;\n }\n\n // true if both NaN, false otherwise\n return a!==a && b!==b;\n};\n","// packages/warning/src/utils.ts\nvar logged = /* @__PURE__ */ new Set();\nexport {\n logged\n};\n//# sourceMappingURL=utils.mjs.map\n","// packages/warning/src/index.ts\nimport { logged } from \"./utils.mjs\";\nfunction isDev() {\n return globalThis.SCRIPT_DEBUG === true;\n}\nfunction warning(message) {\n if (!isDev()) {\n return;\n }\n if (logged.has(message)) {\n return;\n }\n console.warn(message);\n try {\n throw Error(message);\n } catch {\n }\n logged.add(message);\n}\nexport {\n warning as default\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/components/src/context/context-system-provider.js\nimport deepmerge from \"deepmerge\";\nimport fastDeepEqual from \"fast-deep-equal/es6/index.js\";\nimport { isPlainObject } from \"is-plain-object\";\nimport { createContext, useContext, useRef, useMemo, memo } from \"@wordpress/element\";\nimport warn from \"@wordpress/warning\";\nimport { useUpdateEffect } from \"../utils/index.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nvar ComponentsContext = createContext(\n /** @type {Record<string, any>} */\n {}\n);\nComponentsContext.displayName = \"ComponentsContext\";\nvar useComponentsContext = () => useContext(ComponentsContext);\nfunction useContextSystemBridge({\n value\n}) {\n const parentContext = useComponentsContext();\n const valueRef = useRef(value);\n useUpdateEffect(() => {\n if (\n // Objects are equivalent.\n fastDeepEqual(valueRef.current, value) && // But not the same reference.\n valueRef.current !== value\n ) {\n globalThis.SCRIPT_DEBUG === true ? warn(`Please memoize your context: ${JSON.stringify(value)}`) : void 0;\n }\n }, [value]);\n const config = useMemo(() => {\n return deepmerge(parentContext ?? {}, value ?? {}, {\n isMergeableObject: isPlainObject\n });\n }, [parentContext, value]);\n return config;\n}\nvar BaseContextSystemProvider = ({\n children,\n value\n}) => {\n const contextValue = useContextSystemBridge({\n value\n });\n return /* @__PURE__ */ _jsx(ComponentsContext.Provider, {\n value: contextValue,\n children\n });\n};\nvar ContextSystemProvider = memo(BaseContextSystemProvider);\nexport {\n ComponentsContext,\n ContextSystemProvider,\n useComponentsContext\n};\n//# sourceMappingURL=context-system-provider.mjs.map\n","// packages/components/src/context/constants.js\nvar COMPONENT_NAMESPACE = \"data-wp-component\";\nvar CONNECTED_NAMESPACE = \"data-wp-c16t\";\nvar CONNECT_STATIC_NAMESPACE = \"__contextSystemKey__\";\nexport {\n COMPONENT_NAMESPACE,\n CONNECTED_NAMESPACE,\n CONNECT_STATIC_NAMESPACE\n};\n//# sourceMappingURL=constants.mjs.map\n","// packages/components/src/context/get-styled-class-name-from-key.ts\nimport { paramCase as kebabCase } from \"change-case\";\nimport memoize from \"memize\";\nfunction getStyledClassName(namespace) {\n const kebab = kebabCase(namespace);\n return `components-${kebab}`;\n}\nvar getStyledClassNameFromKey = memoize(getStyledClassName);\nexport {\n getStyledClassNameFromKey\n};\n//# sourceMappingURL=get-styled-class-name-from-key.mjs.map\n","// packages/components/src/context/context-connect.ts\nimport { forwardRef } from \"@wordpress/element\";\nimport warn from \"@wordpress/warning\";\nimport { CONNECT_STATIC_NAMESPACE } from \"./constants.mjs\";\nimport { getStyledClassNameFromKey } from \"./get-styled-class-name-from-key.mjs\";\nfunction contextConnect(Component, namespace) {\n return _contextConnect(Component, namespace, {\n forwardsRef: true\n });\n}\nfunction contextConnectWithoutRef(Component, namespace) {\n return _contextConnect(Component, namespace);\n}\nfunction _contextConnect(Component, namespace, options) {\n const WrappedComponent = options?.forwardsRef ? forwardRef(Component) : Component;\n if (typeof namespace === \"undefined\") {\n globalThis.SCRIPT_DEBUG === true ? warn(\"contextConnect: Please provide a namespace\") : void 0;\n }\n let mergedNamespace = WrappedComponent[CONNECT_STATIC_NAMESPACE] || [namespace];\n if (Array.isArray(namespace)) {\n mergedNamespace = [...mergedNamespace, ...namespace];\n }\n if (typeof namespace === \"string\") {\n mergedNamespace = [...mergedNamespace, namespace];\n }\n return Object.assign(WrappedComponent, {\n [CONNECT_STATIC_NAMESPACE]: [...new Set(mergedNamespace)],\n displayName: namespace,\n selector: `.${getStyledClassNameFromKey(namespace)}`\n });\n}\nfunction getConnectNamespace(Component) {\n if (!Component) {\n return [];\n }\n let namespaces = [];\n if (Component[CONNECT_STATIC_NAMESPACE]) {\n namespaces = Component[CONNECT_STATIC_NAMESPACE];\n }\n if (Component.type && Component.type[CONNECT_STATIC_NAMESPACE]) {\n namespaces = Component.type[CONNECT_STATIC_NAMESPACE];\n }\n return namespaces;\n}\nfunction hasConnectNamespace(Component, match) {\n if (!Component) {\n return false;\n }\n if (typeof match === \"string\") {\n return getConnectNamespace(Component).includes(match);\n }\n if (Array.isArray(match)) {\n return match.some((result) => getConnectNamespace(Component).includes(result));\n }\n return false;\n}\nexport {\n contextConnect,\n contextConnectWithoutRef,\n getConnectNamespace,\n hasConnectNamespace\n};\n//# sourceMappingURL=context-connect.mjs.map\n","// packages/components/src/context/utils.js\nimport { CONNECTED_NAMESPACE, COMPONENT_NAMESPACE } from \"./constants.mjs\";\nfunction getNamespace(componentName) {\n return {\n [COMPONENT_NAMESPACE]: componentName\n };\n}\nfunction getConnectedNamespace() {\n return {\n [CONNECTED_NAMESPACE]: true\n };\n}\nexport {\n getConnectedNamespace,\n getNamespace\n};\n//# sourceMappingURL=utils.mjs.map\n","// packages/components/src/context/use-context-system.js\nimport warn from \"@wordpress/warning\";\nimport { useComponentsContext } from \"./context-system-provider.mjs\";\nimport { getNamespace, getConnectedNamespace } from \"./utils.mjs\";\nimport { getStyledClassNameFromKey } from \"./get-styled-class-name-from-key.mjs\";\nimport { useCx } from \"../utils/hooks/use-cx.mjs\";\nfunction useContextSystem(props, namespace) {\n const contextSystemProps = useComponentsContext();\n if (typeof namespace === \"undefined\") {\n globalThis.SCRIPT_DEBUG === true ? warn(\"useContextSystem: Please provide a namespace\") : void 0;\n }\n const contextProps = contextSystemProps?.[namespace] || {};\n const finalComponentProps = {\n ...getConnectedNamespace(),\n ...getNamespace(namespace)\n };\n const {\n _overrides: overrideProps,\n ...otherContextProps\n } = contextProps;\n const initialMergedProps = Object.entries(otherContextProps).length ? Object.assign({}, otherContextProps, props) : props;\n const cx = useCx();\n const classes = cx(getStyledClassNameFromKey(namespace), props.className);\n const rendered = typeof initialMergedProps.renderChildren === \"function\" ? initialMergedProps.renderChildren(initialMergedProps) : initialMergedProps.children;\n for (const key in initialMergedProps) {\n finalComponentProps[key] = initialMergedProps[key];\n }\n for (const key in overrideProps) {\n finalComponentProps[key] = overrideProps[key];\n }\n if (rendered !== void 0) {\n finalComponentProps.children = rendered;\n }\n finalComponentProps.className = classes;\n return finalComponentProps;\n}\nexport {\n useContextSystem\n};\n//# sourceMappingURL=use-context-system.mjs.map\n","// packages/components/src/visually-hidden/styles.ts\nvar visuallyHidden = {\n border: 0,\n clip: \"rect(1px, 1px, 1px, 1px)\",\n WebkitClipPath: \"inset( 50% )\",\n clipPath: \"inset( 50% )\",\n height: \"1px\",\n margin: \"-1px\",\n overflow: \"hidden\",\n padding: 0,\n position: \"absolute\",\n width: \"1px\",\n wordWrap: \"normal\",\n wordBreak: \"normal\"\n};\nexport {\n visuallyHidden\n};\n//# sourceMappingURL=styles.mjs.map\n","// packages/components/src/utils/polymorphic-element.tsx\nimport { forwardRef } from \"@wordpress/element\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nvar customAttributeRegExp = /^(data|aria|x)-/i;\nvar eventHandlerRegExp = /^on[A-Z]/;\nvar svgElementNames = new Set(`animate animateMotion animateTransform circle clipPath defs desc ellipse\n\tfeBlend feColorMatrix feComponentTransfer feComposite feConvolveMatrix\n\tfeDiffuseLighting feDisplacementMap feDistantLight feDropShadow feFlood\n\tfeFuncA feFuncB feFuncG feFuncR feGaussianBlur feImage feMerge feMergeNode\n\tfeMorphology feOffset fePointLight feSpecularLighting feSpotLight feTile\n\tfeTurbulence filter foreignObject g image line linearGradient marker mask\n\tmetadata mpath path pattern polygon polyline radialGradient rect set stop svg\n\tswitch symbol text textPath tspan use view`.split(/\\s+/));\nvar baseElementProps = new Set(`children dangerouslySetInnerHTML key autoFocus defaultValue defaultChecked\n\tinnerHTML suppressContentEditableWarning suppressHydrationWarning valueLink\n\tabbr accept acceptCharset accessKey action allow allowUserMedia\n\tallowPaymentRequest allowFullScreen allowTransparency alt async autoComplete\n\tautoPlay capture cellPadding cellSpacing challenge charSet checked cite classID\n\tclassName cols colSpan content contentEditable contextMenu controls controlsList\n\tcoords crossOrigin data dateTime decoding default defer dir disabled\n\tdisablePictureInPicture disableRemotePlayback download draggable encType\n\tenterKeyHint fetchpriority fetchPriority form formAction formEncType formMethod\n\tformNoValidate formTarget frameBorder headers height hidden high href hrefLang\n\thtmlFor httpEquiv id inputMode integrity is keyParams keyType kind label lang\n\tlist loading loop low marginHeight marginWidth max maxLength media mediaGroup\n\tmethod min minLength multiple muted name nonce noValidate open optimum pattern\n\tplaceholder playsInline popover popoverTarget popoverTargetAction poster\n\tpreload profile radioGroup readOnly referrerPolicy rel required reversed role\n\trows rowSpan sandbox scope scoped scrolling seamless selected shape size sizes\n\tslot span spellCheck src srcDoc srcLang srcSet start step style summary\n\ttabIndex target title translate type useMap value width wmode wrap about\n\tdatatype inlist prefix property resource typeof vocab autoCapitalize\n\tautoCorrect autoSave color incremental fallback inert itemProp itemScope\n\titemType itemID itemRef on option results security unselectable`.split(/\\s+/));\nvar svgElementProps = new Set(`accentHeight accumulate additive alignmentBaseline allowReorder alphabetic\n\tamplitude arabicForm ascent attributeName attributeType autoReverse azimuth\n\tbaseFrequency baselineShift baseProfile bbox begin bias by calcMode capHeight\n\tclip clipPathUnits clipPath clipRule colorInterpolation\n\tcolorInterpolationFilters colorProfile colorRendering contentScriptType\n\tcontentStyleType cursor cx cy d decelerate descent diffuseConstant direction\n\tdisplay divisor dominantBaseline dur dx dy edgeMode elevation enableBackground\n\tend exponent externalResourcesRequired fill fillOpacity fillRule filter\n\tfilterRes filterUnits floodColor floodOpacity focusable fontFamily fontSize\n\tfontSizeAdjust fontStretch fontStyle fontVariant fontWeight format from fr fx\n\tfy g1 g2 glyphName glyphOrientationHorizontal glyphOrientationVertical\n\tglyphRef gradientTransform gradientUnits hanging horizAdvX horizOriginX\n\tideographic imageRendering in in2 intercept k k1 k2 k3 k4 kernelMatrix\n\tkernelUnitLength kerning keyPoints keySplines keyTimes lengthAdjust\n\tletterSpacing lightingColor limitingConeAngle local markerEnd markerMid\n\tmarkerStart markerHeight markerUnits markerWidth mask maskContentUnits\n\tmaskUnits mathematical mode numOctaves offset opacity operator order orient\n\torientation origin overflow overlinePosition overlineThickness panose1\n\tpaintOrder pathLength patternContentUnits patternTransform patternUnits\n\tpointerEvents points pointsAtX pointsAtY pointsAtZ preserveAlpha\n\tpreserveAspectRatio primitiveUnits r radius refX refY renderingIntent\n\trepeatCount repeatDur requiredExtensions requiredFeatures restart result rotate\n\trx ry scale seed shapeRendering slope spacing specularConstant\n\tspecularExponent speed spreadMethod startOffset stdDeviation stemh stemv\n\tstitchTiles stopColor stopOpacity strikethroughPosition strikethroughThickness\n\tstring stroke strokeDasharray strokeDashoffset strokeLinecap strokeLinejoin\n\tstrokeMiterlimit strokeOpacity strokeWidth surfaceScale systemLanguage\n\ttableValues targetX targetY textAnchor textDecoration textRendering textLength\n\tto transform u1 u2 underlinePosition underlineThickness unicode unicodeBidi\n\tunicodeRange unitsPerEm vAlphabetic vHanging vIdeographic vMathematical values\n\tvectorEffect version vertAdvY vertOriginX vertOriginY viewBox viewTarget\n\tvisibility widths wordSpacing writingMode x xHeight x1 x2 xChannelSelector\n\txlinkActuate xlinkArcrole xlinkHref xlinkRole xlinkShow xlinkTitle xlinkType\n\txmlBase xmlns xmlnsXlink xmlLang xmlSpace y y1 y2 yChannelSelector z\n\tzoomAndPan`.split(/\\s+/));\nvar compatElementProps = /* @__PURE__ */ new Set([\"autofocus\", \"class\", \"for\"]);\nfunction isValidIntrinsicElementProp(prop, element) {\n if (customAttributeRegExp.test(prop) || eventHandlerRegExp.test(prop)) {\n return true;\n }\n if (baseElementProps.has(prop) || compatElementProps.has(prop)) {\n return true;\n }\n return svgElementNames.has(element) && svgElementProps.has(prop);\n}\nfunction filterIntrinsicElementProps(props, element) {\n return Object.fromEntries(Object.entries(props).filter(([prop]) => isValidIntrinsicElementProp(prop, element)));\n}\nfunction UnforwardedPolymorphicElement({\n as,\n ...props\n}, ref) {\n const Element = as || \"div\";\n const forwardedProps = typeof Element === \"string\" ? filterIntrinsicElementProps(props, Element) : props;\n return /* @__PURE__ */ _jsx(Element, {\n ref,\n ...forwardedProps\n });\n}\nvar PolymorphicElement = forwardRef(UnforwardedPolymorphicElement);\nexport {\n PolymorphicElement\n};\n//# sourceMappingURL=polymorphic-element.mjs.map\n","// packages/components/src/view/component.tsx\nimport { forwardRef } from \"@wordpress/element\";\nimport { PolymorphicElement } from \"../utils/polymorphic-element.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nfunction UnforwardedView({\n css,\n ...restProps\n}, ref) {\n void css;\n return /* @__PURE__ */ _jsx(PolymorphicElement, {\n ref,\n ...restProps\n });\n}\nvar View = Object.assign(forwardRef(UnforwardedView), {\n selector: \".components-view\"\n});\nvar component_default = View;\nexport {\n View,\n component_default as default\n};\n//# sourceMappingURL=component.mjs.map\n","// packages/components/src/visually-hidden/component.tsx\nimport { useContextSystem, contextConnect } from \"../context/index.mjs\";\nimport { visuallyHidden } from \"./styles.mjs\";\nimport { View } from \"../view/index.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nfunction UnconnectedVisuallyHidden(props, forwardedRef) {\n const {\n style: styleProp,\n ...contextProps\n } = useContextSystem(props, \"VisuallyHidden\");\n return /* @__PURE__ */ _jsx(View, {\n ref: forwardedRef,\n ...contextProps,\n \"data-visually-hidden\": \"\",\n style: {\n ...visuallyHidden,\n ...styleProp || {}\n }\n });\n}\nvar VisuallyHidden = contextConnect(UnconnectedVisuallyHidden, \"VisuallyHidden\");\nvar component_default = VisuallyHidden;\nexport {\n VisuallyHidden,\n component_default as default\n};\n//# sourceMappingURL=component.mjs.map\n","// packages/components/src/utils/use-responsive-value.ts\nimport { useEffect, useState } from \"@wordpress/element\";\nvar breakpoints = [\"40em\", \"52em\", \"64em\"];\nvar useBreakpointIndex = (options = {}) => {\n const {\n defaultIndex = 0\n } = options;\n if (typeof defaultIndex !== \"number\") {\n throw new TypeError(`Default breakpoint index should be a number. Got: ${defaultIndex}, ${typeof defaultIndex}`);\n } else if (defaultIndex < 0 || defaultIndex > breakpoints.length - 1) {\n throw new RangeError(`Default breakpoint index out of range. Theme has ${breakpoints.length} breakpoints, got index ${defaultIndex}`);\n }\n const [value, setValue] = useState(defaultIndex);\n useEffect(() => {\n const getIndex = () => breakpoints.filter((bp) => {\n return typeof window !== \"undefined\" ? window.matchMedia(`screen and (min-width: ${bp})`).matches : false;\n }).length;\n const onResize = () => {\n const newValue = getIndex();\n if (value !== newValue) {\n setValue(newValue);\n }\n };\n onResize();\n if (typeof window !== \"undefined\") {\n window.addEventListener(\"resize\", onResize);\n }\n return () => {\n if (typeof window !== \"undefined\") {\n window.removeEventListener(\"resize\", onResize);\n }\n };\n }, [value]);\n return value;\n};\nfunction useResponsiveValue(values, options = {}) {\n const index = useBreakpointIndex(options);\n if (!Array.isArray(values) && typeof values !== \"function\") {\n return values;\n }\n const array = values || [];\n return array[index >= array.length ? array.length - 1 : index];\n}\nexport {\n useBreakpointIndex,\n useResponsiveValue\n};\n//# sourceMappingURL=use-responsive-value.mjs.map\n","// packages/components/src/grid/utils.ts\nvar ALIGNMENTS = {\n bottom: {\n alignItems: \"flex-end\",\n justifyContent: \"center\"\n },\n bottomLeft: {\n alignItems: \"flex-start\",\n justifyContent: \"flex-end\"\n },\n bottomRight: {\n alignItems: \"flex-end\",\n justifyContent: \"flex-end\"\n },\n center: {\n alignItems: \"center\",\n justifyContent: \"center\"\n },\n spaced: {\n alignItems: \"center\",\n justifyContent: \"space-between\"\n },\n left: {\n alignItems: \"center\",\n justifyContent: \"flex-start\"\n },\n right: {\n alignItems: \"center\",\n justifyContent: \"flex-end\"\n },\n stretch: {\n alignItems: \"stretch\"\n },\n top: {\n alignItems: \"flex-start\",\n justifyContent: \"center\"\n },\n topLeft: {\n alignItems: \"flex-start\",\n justifyContent: \"flex-start\"\n },\n topRight: {\n alignItems: \"flex-start\",\n justifyContent: \"flex-end\"\n }\n};\nfunction getAlignmentProps(alignment) {\n const alignmentProps = alignment ? ALIGNMENTS[alignment] : {};\n return alignmentProps;\n}\nexport {\n getAlignmentProps\n};\n//# sourceMappingURL=utils.mjs.map\n","// packages/components/src/grid/hook.ts\nimport { css } from \"@emotion/react\";\nimport { useMemo } from \"@wordpress/element\";\nimport { useContextSystem } from \"../context/index.mjs\";\nimport { getAlignmentProps } from \"./utils.mjs\";\nimport { useResponsiveValue } from \"../utils/use-responsive-value.mjs\";\nimport CONFIG from \"../utils/config-values.mjs\";\nimport { useCx } from \"../utils/hooks/use-cx.mjs\";\nfunction useGrid(props) {\n const {\n align,\n alignment,\n className,\n columnGap,\n columns = 2,\n gap = 3,\n isInline = false,\n justify,\n rowGap,\n rows,\n templateColumns,\n templateRows,\n ...otherProps\n } = useContextSystem(props, \"Grid\");\n const columnsAsArray = Array.isArray(columns) ? columns : [columns];\n const column = useResponsiveValue(columnsAsArray);\n const rowsAsArray = Array.isArray(rows) ? rows : [rows];\n const row = useResponsiveValue(rowsAsArray);\n const gridTemplateColumns = templateColumns || !!columns && `repeat( ${column}, 1fr )`;\n const gridTemplateRows = templateRows || !!rows && `repeat( ${row}, 1fr )`;\n const cx = useCx();\n const classes = useMemo(() => {\n const alignmentProps = getAlignmentProps(alignment);\n const gridClasses = /* @__PURE__ */ css({\n alignItems: align,\n display: isInline ? \"inline-grid\" : \"grid\",\n gap: `calc( ${CONFIG.gridBase} * ${gap} )`,\n gridTemplateColumns: gridTemplateColumns || void 0,\n gridTemplateRows: gridTemplateRows || void 0,\n gridRowGap: rowGap,\n gridColumnGap: columnGap,\n justifyContent: justify,\n verticalAlign: isInline ? \"middle\" : void 0,\n ...alignmentProps\n }, process.env.NODE_ENV === \"production\" ? \"\" : \";label:gridClasses;\", process.env.NODE_ENV === \"production\" ? \"\" : \"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImhvb2sudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBdURzQiIsImZpbGUiOiJob29rLnRzIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBFeHRlcm5hbCBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3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29sdW1uczogZ3JpZFRlbXBsYXRlQ29sdW1ucyB8fCB1bmRlZmluZWQsXG5cdFx0XHRncmlkVGVtcGxhdGVSb3dzOiBncmlkVGVtcGxhdGVSb3dzIHx8IHVuZGVmaW5lZCxcblx0XHRcdGdyaWRSb3dHYXA6IHJvd0dhcCxcblx0XHRcdGdyaWRDb2x1bW5HYXA6IGNvbHVtbkdhcCxcblx0XHRcdGp1c3RpZnlDb250ZW50OiBqdXN0aWZ5LFxuXHRcdFx0dmVydGljYWxBbGlnbjogaXNJbmxpbmUgPyAnbWlkZGxlJyA6IHVuZGVmaW5lZCxcblx0XHRcdC4uLmFsaWdubWVudFByb3BzLFxuXHRcdH0gKTtcblxuXHRcdHJldHVybiBjeCggZ3JpZENsYXNzZXMsIGNsYXNzTmFtZSApO1xuXHR9LCBbXG5cdFx0YWxpZ24sXG5cdFx0YWxpZ25tZW50LFxuXHRcdGNsYXNzTmFtZSxcblx0XHRjb2x1bW5HYXAsXG5cdFx0Y3gsXG5cdFx0Z2FwLFxuXHRcdGdyaWRUZW1wbGF0ZUNvbHVtbnMsXG5cdFx0Z3JpZFRlbXBsYXRlUm93cyxcblx0XHRpc0lubGluZSxcblx0XHRqdXN0aWZ5LFxuXHRcdHJvd0dhcCxcblx0XSApO1xuXG5cdHJldHVybiB7IC4uLm90aGVyUHJvcHMsIGNsYXNzTmFtZTogY2xhc3NlcyB9O1xufVxuIl19 */\");\n return cx(gridClasses, className);\n }, [align, alignment, className, columnGap, cx, gap, gridTemplateColumns, gridTemplateRows, isInline, justify, rowGap]);\n return {\n ...otherProps,\n className: classes\n };\n}\nexport {\n useGrid as default\n};\n//# sourceMappingURL=hook.mjs.map\n","// packages/components/src/grid/component.tsx\nimport { contextConnect } from \"../context/index.mjs\";\nimport { View } from \"../view/index.mjs\";\nimport useGrid from \"./hook.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nfunction UnconnectedGrid(props, forwardedRef) {\n const gridProps = useGrid(props);\n return /* @__PURE__ */ _jsx(View, {\n ...gridProps,\n ref: forwardedRef\n });\n}\nvar Grid = contextConnect(UnconnectedGrid, \"Grid\");\nvar component_default = Grid;\nexport {\n Grid,\n component_default as default\n};\n//# sourceMappingURL=component.mjs.map\n","import { useCallback, useLayoutEffect, useRef, useState } from 'react';\n\n/**\n * Fractional layout rounding can put a row's bottom a hair past the container's\n * without any visible clipping. Allow that much slack before hiding a row.\n *\n * Exported so tests and stories assert against the real tolerance rather than\n * restating it.\n */\nexport const SUBPIXEL_TOLERANCE = 0.5;\n\n/**\n * Counts how many leading rows fit inside the content container.\n *\n * Rows are read from the DOM rather than derived from constants: row height\n * depends on the theme's row gap, label wrapping, and whatever a caller renders\n * as a label, so any restated number would drift.\n *\n * Every row is a direct grid child marked with `data-row-index`; interactive rows\n * use a button wrapper and non-interactive rows use a div wrapper.\n *\n * @param enabled - Whether to measure at all. When false every row fits.\n * @param rowCount - Total number of rows rendered.\n * @param data - Rendered row data, whose geometry may change without changing the count.\n * @return Ref for the content container and the number of leading rows that fit.\n */\nexport function useFittedRowCount( enabled: boolean, rowCount: number, data: unknown ) {\n\tconst contentRef = useRef< HTMLDivElement | null >( null );\n\tconst [ fittedCount, setFittedCount ] = useState( rowCount );\n\tconst [ isMeasurable, setIsMeasurable ] = useState( true );\n\n\tconst measure = useCallback( () => {\n\t\tconst content = contentRef.current;\n\t\tif ( ! content ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Switching from the default scrollable mode can leave the content at a\n\t\t// non-zero scroll offset, which would shift every measurement below.\n\t\tcontent.scrollTop = 0;\n\n\t\tconst rows = content.querySelectorAll< HTMLElement >(\n\t\t\t':scope > [data-leaderboard-grid] > [data-row-index]'\n\t\t);\n\n\t\tconst rowBottoms: number[] = [];\n\t\trows.forEach( row => {\n\t\t\tconst index = Number( row.getAttribute( 'data-row-index' ) );\n\t\t\t// An unparseable index would write a non-numeric key, leaving a hole\n\t\t\t// that silently truncates the scan below at the preceding row.\n\t\t\tif ( ! Number.isInteger( index ) || index < 0 || index >= rowCount ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { bottom } = row.getBoundingClientRect();\n\t\t\trowBottoms[ index ] = Math.max( rowBottoms[ index ] ?? -Infinity, bottom );\n\t\t} );\n\n\t\t// Fail open. If the rows cannot be measured at all — a changed DOM shape,\n\t\t// a detached container — falling back to the scrollable default keeps the\n\t\t// data reachable, where hiding every row reads as a broken tile.\n\t\tif ( rowBottoms.length === 0 ) {\n\t\t\tsetIsMeasurable( false );\n\t\t\tsetFittedCount( rowCount );\n\t\t\treturn;\n\t\t}\n\t\tsetIsMeasurable( true );\n\n\t\tconst contentBottom = content.getBoundingClientRect().bottom + SUBPIXEL_TOLERANCE;\n\n\t\tlet fits = 0;\n\t\twhile ( fits < rowBottoms.length && rowBottoms[ fits ] <= contentBottom ) {\n\t\t\tfits++;\n\t\t}\n\n\t\t// Bail before setState: setState inside a ResizeObserver callback is the\n\t\t// usual way this grows a render loop.\n\t\tsetFittedCount( current => ( current === fits ? current : fits ) );\n\t}, [ rowCount ] );\n\n\t// Measure after row data changes so geometry updates are caught even when the\n\t// row count and the grid's overall size stay the same (for example, one label\n\t// wraps while another unwraps after a same-length data update).\n\tuseLayoutEffect( () => {\n\t\tif ( ! enabled ) {\n\t\t\tsetFittedCount( rowCount );\n\t\t\treturn;\n\t\t}\n\n\t\tmeasure();\n\t}, [ enabled, rowCount, data, measure ] );\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! enabled ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst content = contentRef.current;\n\t\tif ( ! content ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst observer = new ResizeObserver( measure );\n\t\t// The container catches tile resizing; the grid catches font, image,\n\t\t// theme, or label changes that alter row geometry on an unchanged tile.\n\t\tobserver.observe( content );\n\t\tconst grid = content.querySelector< HTMLElement >( ':scope > [data-leaderboard-grid]' );\n\t\tif ( grid ) {\n\t\t\tobserver.observe( grid );\n\t\t}\n\n\t\treturn () => observer.disconnect();\n\t}, [ enabled, rowCount, measure ] );\n\n\treturn { contentRef, fittedCount: enabled ? fittedCount : rowCount, isMeasurable };\n}\n","import { __ } from '@wordpress/i18n';\nimport { useMemo } from 'react';\nimport { useGlobalChartsTheme, useGlobalChartsContext } from '../../../providers';\nimport type { BaseLegendItem } from '../../../components/legend';\nimport type { LeaderboardEntry } from '../../../types';\n\n/**\n * Hook to create legend items from leaderboard data\n * @param root0 - Configuration object\n * @param root0.data - Array of leaderboard entries\n * @param root0.primaryColor - Primary color override\n * @param root0.secondaryColor - Secondary color override\n * @param root0.withComparison - Whether comparison data is shown\n * @param root0.withOverlayLabel - Whether to overlay the label on top of the bar\n * @param root0.legendLabels - Custom labels for legend items\n * @param root0.legendLabels.primary - Label for primary period data\n * @param root0.legendLabels.comparison - Label for comparison period data\n * @return Array of legend items for the leaderboard chart\n */\nexport function useLeaderboardLegendItems( {\n\tdata,\n\tprimaryColor,\n\tsecondaryColor,\n\twithComparison = false,\n\twithOverlayLabel = false,\n\tlegendLabels,\n}: {\n\tdata: LeaderboardEntry[];\n\tprimaryColor?: string;\n\tsecondaryColor?: string;\n\twithComparison: boolean;\n\twithOverlayLabel: boolean;\n\tlegendLabels?: {\n\t\tprimary?: string;\n\t\tcomparison?: string;\n\t};\n} ): BaseLegendItem[] {\n\tconst { leaderboardChart: leaderboardChartSettings } = useGlobalChartsTheme();\n\tconst { getElementStyles } = useGlobalChartsContext();\n\n\treturn useMemo( () => {\n\t\tif ( ! data || data.length === 0 ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst items: BaseLegendItem[] = [];\n\n\t\t// Add current period legend item\n\t\tconst { color: resolvedPrimaryColor } = getElementStyles( {\n\t\t\tindex: 0,\n\t\t\toverrideColor: primaryColor || leaderboardChartSettings.primaryColor,\n\t\t} );\n\n\t\titems.push( {\n\t\t\tlabel: legendLabels?.primary || __( 'Current period', 'jetpack-charts' ),\n\t\t\tcolor: resolvedPrimaryColor,\n\t\t} );\n\n\t\t// Add comparison period legend item if comparison is enabled and overlay label is not enabled\n\t\tif ( withComparison && ! withOverlayLabel ) {\n\t\t\tconst { color: resolvedSecondaryColor } = getElementStyles( {\n\t\t\t\tindex: 1,\n\t\t\t\toverrideColor: secondaryColor || leaderboardChartSettings.secondaryColor,\n\t\t\t} );\n\n\t\t\titems.push( {\n\t\t\t\tlabel: legendLabels?.comparison || __( 'Previous period', 'jetpack-charts' ),\n\t\t\t\tcolor: resolvedSecondaryColor,\n\t\t\t} );\n\t\t}\n\n\t\treturn items;\n\t}, [\n\t\tdata,\n\t\tprimaryColor,\n\t\tsecondaryColor,\n\t\twithComparison,\n\t\tlegendLabels,\n\t\tleaderboardChartSettings,\n\t\tgetElementStyles,\n\t\twithOverlayLabel,\n\t] );\n}\n","/* eslint-disable @wordpress/no-unsafe-wp-apis */\nimport { __experimentalGrid as Grid, VisuallyHidden } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { Icon, chevronRight } from '@wordpress/icons';\nimport { Stack, Text } from '@wordpress/ui';\nimport clsx from 'clsx';\nimport { useContext, useMemo, type FC } from 'react';\nimport { Legend } from '../../components/legend';\nimport { usePrefersReducedMotion } from '../../hooks';\nimport {\n\tGlobalChartsContext,\n\tGlobalChartsProvider,\n\tuseChartId,\n\tuseChartRegistration,\n\tuseGlobalChartsContext,\n\tuseGlobalChartsTheme,\n} from '../../providers';\nimport { formatMetricValue, attachSubComponents } from '../../utils';\nimport { useChartChildren } from '../private/chart-composition';\nimport { ChartInstanceContext } from '../private/chart-instance-context';\nimport { ChartLayout } from '../private/chart-layout';\nimport { getAllHiddenMessage } from '../private/svg-empty-state';\nimport { withResponsive } from '../private/with-responsive';\nimport { useFittedRowCount, useLeaderboardLegendItems } from './hooks';\nimport styles from './leaderboard-chart.module.scss';\nimport type { LeaderboardChartProps } from './types';\nimport type { LeaderboardEntry } from '../../types';\n\n/**\n * Default value formatter using formatMetricValue\n *\n * @param value - The numeric value to format\n * @return Formatted string representation of the value\n */\nconst defaultValueFormatter = ( value: number ): string => {\n\treturn formatMetricValue( value, 'number', {\n\t\tuseMultipliers: true,\n\t\tdecimals: 1,\n\t} );\n};\n\n/**\n * Default delta formatter using formatMetricValue\n *\n * @param value - The delta value to format\n * @return Formatted percentage string\n */\nconst defaultDeltaFormatter = ( value: number ): string => {\n\treturn formatMetricValue( value / 100, 'average', {\n\t\tdecimals: 0,\n\t\tsignDisplay: 'exceptZero',\n\t} );\n};\n\n/**\n * Build a bar's width. A hover-inset CSS variable (0 by default) is subtracted\n * on hover, scaled by the bar's share so the pull-back is proportional to its\n * length: the full-length (100%) bar — the one that reaches the value — pulls\n * back the whole inset to keep its gap with the value, while shorter bars pull\n * back proportionally less, down to ~0 for a very short bar.\n *\n * @param share - The bar's share of the row width, as a percentage.\n * @return A CSS width value.\n */\nconst getBarWidth = ( share: number ): string =>\n\t`calc(${ share }% - var(--a8c-charts-dimension-leaderboard-bar-hover-inset, 0px) * ${ share } / 100)`;\n\nconst hasPreviousValue = (\n\tentry: LeaderboardEntry\n): entry is LeaderboardEntry & {\n\tpreviousValue: number;\n\tpreviousShare: number;\n} => entry.previousValue != null && entry.previousShare != null;\n\nconst hasDeltaValue = (\n\tentry: LeaderboardEntry\n): entry is LeaderboardEntry & {\n\tpreviousValue: number;\n\tpreviousShare: number;\n\tdelta: number;\n} => hasPreviousValue( entry ) && entry.delta != null;\n\nconst BarLabel = ( { label }: { label: LeaderboardEntry[ 'label' ] } ) => (\n\t<>{ typeof label === 'string' ? <Text className={ styles.label }>{ label }</Text> : label }</>\n);\n\nconst BarWithLabel = ( {\n\tentry,\n\twithComparison,\n\twithOverlayLabel,\n\tprimaryColor,\n\tsecondaryColor,\n\tanimation,\n\tisPrimaryVisible = true,\n\tisComparisonVisible = true,\n}: {\n\tentry: LeaderboardEntry;\n\twithComparison?: boolean;\n\twithOverlayLabel?: boolean;\n\tprimaryColor: string;\n\tsecondaryColor: string;\n\tisPrimaryVisible?: boolean;\n\tisComparisonVisible?: boolean;\n\tanimation?: boolean;\n} ) => {\n\tconst showComparisonBar = withComparison && ! withOverlayLabel && isComparisonVisible;\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx( styles.barWithLabelContainer, {\n\t\t\t\t[ styles[ 'is-overlay' ] ]: withOverlayLabel,\n\t\t\t} ) }\n\t\t>\n\t\t\t<BarLabel label={ entry.label } />\n\n\t\t\t{ isPrimaryVisible && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={ clsx( styles.bar, {\n\t\t\t\t\t\t[ styles[ 'bar--animated' ] ]: animation,\n\t\t\t\t\t} ) }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\twidth: getBarWidth( entry.currentShare ),\n\t\t\t\t\t\tbackgroundColor: primaryColor,\n\t\t\t\t\t} }\n\t\t\t\t></div>\n\t\t\t) }\n\n\t\t\t{ showComparisonBar && hasPreviousValue( entry ) && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={ clsx( styles.bar, {\n\t\t\t\t\t\t[ styles[ 'bar--animated' ] ]: animation,\n\t\t\t\t\t} ) }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\twidth: getBarWidth( entry.previousShare ),\n\t\t\t\t\t\tbackgroundColor: secondaryColor,\n\t\t\t\t\t} }\n\t\t\t\t></div>\n\t\t\t) }\n\t\t</div>\n\t);\n};\n\n/**\n * LeaderboardChart component displays a ranked list of data with progress bars\n * and optional comparison values.\n *\n * @param props - Component props\n * @param props.data - Array of leaderboard entries to display\n * @param props.chartId - Optional unique identifier for the chart\n * @param props.width - Optional width of the chart container in pixels\n * @param props.height - Optional height of the chart container in pixels\n * @param props.withComparison - Whether to show comparison data\n * @param props.withOverlayLabel - Whether to overlay the label on top of the bar\n * @param props.primaryColor - Primary color for current period bars\n * @param props.secondaryColor - Secondary color for comparison period bars\n * @param props.valueFormatter - Custom formatter for values\n * @param props.deltaFormatter - Custom formatter for delta values\n * @param props.loading - Whether the chart is in loading state\n * @param props.fitRows - Whether to show only the rows that fit the chart's height\n * @param props.animation - Whether the chart should animate on load\n * @param props.showLegend - Whether to show legend\n * @param props.legend - Legend configuration (orientation, position, alignment, shape, shapeStyles, interactive)\n * @param props.legendLabels - Custom labels for legend items\n * @param props.gap - Spacing between legend and chart content\n * @param props.children - Child components for composition API\n * @param props.className - Additional CSS class name\n * @param props.style - Custom styling for the chart container\n * @return JSX element representing the leaderboard chart\n */\nconst LeaderboardChartInternal: FC< LeaderboardChartProps > = ( {\n\tdata,\n\tchartId: providedChartId,\n\twidth: propWidth,\n\theight: propHeight,\n\twithComparison = false,\n\twithOverlayLabel = false,\n\tprimaryColor,\n\tsecondaryColor,\n\tvalueFormatter = defaultValueFormatter,\n\tdeltaFormatter = defaultDeltaFormatter,\n\tanimation,\n\tloading = false,\n\tfitRows = false,\n\tshowLegend = false,\n\tlegend = {},\n\tlegendLabels,\n\tgap = 'md',\n\tclassName,\n\tstyle,\n\tchildren,\n} ) => {\n\tconst legendInteractive = legend.interactive ?? false;\n\tconst legendPosition = legend.position ?? 'bottom';\n\n\tconst chartId = useChartId( providedChartId );\n\tconst { leaderboardChart: leaderboardChartSettings } = useGlobalChartsTheme();\n\tconst legendShapeStyles = { width: 8, height: 8, ...legend.shapeStyles };\n\n\t// Process children to extract compound components\n\tconst { legendChildren, nonLegendChildren } = useChartChildren( children, 'LeaderboardChart' );\n\tconst {\n\t\tlabelSpacing,\n\t\trowGap,\n\t\tcolumnGap,\n\t\tprimaryColor: settingsPrimaryColor,\n\t\tsecondaryColor: settingsSecondaryColor,\n\t\tdeltaColors,\n\t} = leaderboardChartSettings;\n\tconst { getElementStyles, isSeriesVisible } = useGlobalChartsContext();\n\tconst { color: resolvedPrimaryColor } = getElementStyles( {\n\t\tindex: 0,\n\t\toverrideColor: primaryColor || settingsPrimaryColor,\n\t} );\n\tconst { color: resolvedSecondaryColor } = getElementStyles( {\n\t\tindex: 1,\n\t\toverrideColor: secondaryColor || settingsSecondaryColor,\n\t} );\n\n\t// Create legend items using the custom hook\n\tconst legendItems = useLeaderboardLegendItems( {\n\t\tdata: data || [],\n\t\tprimaryColor,\n\t\tsecondaryColor,\n\t\twithComparison,\n\t\twithOverlayLabel,\n\t\tlegendLabels,\n\t} );\n\n\t// Track visibility of primary and comparison series from the shared legend state.\n\tconst isPrimaryVisible = useMemo( () => {\n\t\tif ( legendItems.length === 0 ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn isSeriesVisible( chartId, legendItems[ 0 ].label );\n\t}, [ chartId, legendItems, isSeriesVisible ] );\n\n\tconst isComparisonVisible = useMemo( () => {\n\t\tif ( legendItems.length < 2 ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn isSeriesVisible( chartId, legendItems[ 1 ].label );\n\t}, [ chartId, legendItems, isSeriesVisible ] );\n\n\t// Check if all series are hidden\n\tconst allSeriesHidden = useMemo( () => {\n\t\tif ( withComparison && ! withOverlayLabel ) {\n\t\t\treturn ! isPrimaryVisible && ! isComparisonVisible;\n\t\t}\n\t\treturn ! isPrimaryVisible;\n\t}, [ isPrimaryVisible, isComparisonVisible, withComparison, withOverlayLabel ] );\n\n\t// Validate data\n\tconst isDataValid = Boolean( data && data.length > 0 );\n\n\t// Memoize metadata to prevent unnecessary re-registration\n\tconst chartMetadata = useMemo(\n\t\t() => ( {\n\t\t\twithComparison,\n\t\t\twithOverlayLabel,\n\t\t} ),\n\t\t[ withComparison, withOverlayLabel ]\n\t);\n\n\t// Register chart with context\n\tuseChartRegistration( {\n\t\tchartId,\n\t\tlegendItems,\n\t\tchartType: 'leaderboard',\n\t\tisDataValid,\n\t\tmetadata: chartMetadata,\n\t} );\n\n\tconst prefersReducedMotion = usePrefersReducedMotion();\n\n\t// There are no rows to measure while every series is hidden, whether from an\n\t// interactive legend click or a programmatic toggle. Pausing fitting restores\n\t// the full row count and, when a series is shown again, re-runs the effect\n\t// against the newly mounted grid.\n\tconst { contentRef, fittedCount, isMeasurable } = useFittedRowCount(\n\t\tfitRows && ! allSeriesHidden,\n\t\tdata?.length ?? 0,\n\t\tdata\n\t);\n\tconst shouldFitRows = fitRows && isMeasurable;\n\n\t// Handle empty or undefined data\n\tif ( ! data || data.length === 0 ) {\n\t\treturn (\n\t\t\t<ChartInstanceContext.Provider value={ { chartId } }>\n\t\t\t\t<ChartLayout\n\t\t\t\t\tlegendPosition={ legendPosition }\n\t\t\t\t\tlegendElement={ false }\n\t\t\t\t\tlegendChildren={ legendChildren }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\tstyles.leaderboardChart,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t[ styles[ 'leaderboardChart--responsive' ] ]: ! propWidth && ! propHeight,\n\t\t\t\t\t\t\t[ styles[ 'leaderboardChart--loading' ] ]: loading,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tgap={ gap }\n\t\t\t\t\tstyle={ { ...style, width: propWidth || undefined, height: propHeight || undefined } }\n\t\t\t\t\tdata-testid=\"leaderboard-chart-container\"\n\t\t\t\t\ttrailingContent={ nonLegendChildren }\n\t\t\t\t>\n\t\t\t\t\t<div className={ styles.emptyState }>\n\t\t\t\t\t\t{ loading\n\t\t\t\t\t\t\t? __( 'Loading…', 'jetpack-charts' )\n\t\t\t\t\t\t\t: __( 'No data available', 'jetpack-charts' ) }\n\t\t\t\t\t</div>\n\t\t\t\t</ChartLayout>\n\t\t\t</ChartInstanceContext.Provider>\n\t\t);\n\t}\n\n\tconst legendElement = showLegend && (\n\t\t<Legend\n\t\t\torientation={ legend.orientation ?? 'horizontal' }\n\t\t\tposition={ legendPosition }\n\t\t\talignment={ legend.alignment ?? 'center' }\n\t\t\tlabelStyles={ legend.labelStyles }\n\t\t\titemClassName={ legend.itemClassName }\n\t\t\titemStyles={ legend.itemStyles }\n\t\t\tshape={ legend.shape ?? 'circle' }\n\t\t\tshapeStyles={ legendShapeStyles }\n\t\t\tchartId={ chartId }\n\t\t\tinteractive={ legendInteractive }\n\t\t/>\n\t);\n\n\treturn (\n\t\t<ChartInstanceContext.Provider value={ { chartId } }>\n\t\t\t<ChartLayout\n\t\t\t\tlegendPosition={ legendPosition }\n\t\t\t\tlegendElement={ legendElement }\n\t\t\t\tlegendChildren={ legendChildren }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\tstyles.leaderboardChart,\n\t\t\t\t\t{\n\t\t\t\t\t\t[ styles[ 'leaderboardChart--responsive' ] ]: ! propWidth && ! propHeight,\n\t\t\t\t\t\t[ styles[ 'leaderboardChart--loading' ] ]: loading,\n\t\t\t\t\t},\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tgap={ gap }\n\t\t\t\tstyle={ {\n\t\t\t\t\t...style,\n\t\t\t\t\twidth: propWidth || undefined,\n\t\t\t\t\theight: propHeight || undefined,\n\t\t\t\t} }\n\t\t\t\tdata-testid=\"leaderboard-chart-container\"\n\t\t\t\ttrailingContent={ nonLegendChildren }\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tref={ contentRef }\n\t\t\t\t\tdata-testid=\"leaderboard-chart-content\"\n\t\t\t\t\tclassName={ clsx( styles.leaderboardChart__content, {\n\t\t\t\t\t\t[ styles[ 'leaderboardChart__content--fit' ] ]: shouldFitRows,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t{ shouldFitRows && fittedCount === 0 && ! allSeriesHidden && (\n\t\t\t\t\t\t// Overlaid, not swapped in: the rows must stay laid out to stay measurable.\n\t\t\t\t\t\t<div className={ clsx( styles.emptyState, styles.fitEmptyState ) }>\n\t\t\t\t\t\t\t{ __( 'Not enough space to display data', 'jetpack-charts' ) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t{ allSeriesHidden ? (\n\t\t\t\t\t\t<div className={ styles.emptyState }>\n\t\t\t\t\t\t\t{ getAllHiddenMessage( legendInteractive, 'series' ) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<Grid\n\t\t\t\t\t\t\ttemplateColumns=\"minmax(0, 1fr) auto\"\n\t\t\t\t\t\t\trowGap={ rowGap }\n\t\t\t\t\t\t\tcolumnGap={ columnGap }\n\t\t\t\t\t\t\tdata-leaderboard-grid\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ data.map( ( entry, rowIndex ) => {\n\t\t\t\t\t\t\t\t// visibility, not clipping: hidden rows keep their geometry (so a\n\t\t\t\t\t\t\t\t// taller container can reveal them) but leave hit testing, focus,\n\t\t\t\t\t\t\t\t// and the accessibility tree.\n\t\t\t\t\t\t\t\tconst rowStyle =\n\t\t\t\t\t\t\t\t\tshouldFitRows && rowIndex >= fittedCount\n\t\t\t\t\t\t\t\t\t\t? ( { visibility: 'hidden' } as const )\n\t\t\t\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\t\t\t\tconst showComparisonColumn = withComparison && isComparisonVisible;\n\t\t\t\t\t\t\t\tconst hasPreviousPeriodValue = hasPreviousValue( entry );\n\t\t\t\t\t\t\t\tconst hasDelta = hasDeltaValue( entry );\n\t\t\t\t\t\t\t\tconst showComparisonValue = showComparisonColumn && hasDelta;\n\t\t\t\t\t\t\t\tconst showComparisonPlaceholder = showComparisonColumn && ! hasDelta;\n\t\t\t\t\t\t\t\tconst colorIndex = showComparisonValue ? Math.sign( entry.delta ) + 1 : 1;\n\t\t\t\t\t\t\t\tconst deltaColor = deltaColors[ colorIndex ];\n\n\t\t\t\t\t\t\t\tconst rowCells = (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<Stack direction=\"column\" gap={ labelSpacing }>\n\t\t\t\t\t\t\t\t\t\t\t<BarWithLabel\n\t\t\t\t\t\t\t\t\t\t\t\tentry={ entry }\n\t\t\t\t\t\t\t\t\t\t\t\twithComparison={ withComparison }\n\t\t\t\t\t\t\t\t\t\t\t\twithOverlayLabel={ withOverlayLabel }\n\t\t\t\t\t\t\t\t\t\t\t\tprimaryColor={ resolvedPrimaryColor }\n\t\t\t\t\t\t\t\t\t\t\t\tsecondaryColor={ resolvedSecondaryColor }\n\t\t\t\t\t\t\t\t\t\t\t\tisPrimaryVisible={ isPrimaryVisible }\n\t\t\t\t\t\t\t\t\t\t\t\tisComparisonVisible={ isComparisonVisible }\n\t\t\t\t\t\t\t\t\t\t\t\tanimation={ animation && ! loading && ! prefersReducedMotion }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</Stack>\n\n\t\t\t\t\t\t\t\t\t\t<Stack\n\t\t\t\t\t\t\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\t\t\t\t\t\t\tgap=\"xs\"\n\t\t\t\t\t\t\t\t\t\t\tclassName={ clsx( styles.valueContainer, {\n\t\t\t\t\t\t\t\t\t\t\t\t[ styles.overlayLabel ]: withOverlayLabel,\n\t\t\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ isPrimaryVisible && <Text>{ valueFormatter( entry.currentValue ) }</Text> }\n\n\t\t\t\t\t\t\t\t\t\t\t{ showComparisonValue && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Text className={ styles.deltaValue } style={ { color: deltaColor } }>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ deltaFormatter( entry.delta ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t\t\t{ showComparisonPlaceholder && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName={ clsx( styles.deltaValue, styles.deltaPlaceholder ) }\n\t\t\t\t\t\t\t\t\t\t\t\t\tstyle={ { color: deltaColor } }\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span aria-hidden=\"true\">—</span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ hasPreviousPeriodValue\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? __( 'Percentage change unavailable', 'jetpack-charts' )\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: __( 'No comparison data', 'jetpack-charts' ) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tif ( entry.onClick ) {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\t\tkey={ entry.id }\n\t\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t\tdata-row-index={ rowIndex }\n\t\t\t\t\t\t\t\t\t\t\tstyle={ rowStyle }\n\t\t\t\t\t\t\t\t\t\t\tclassName={ clsx( styles.row, styles.interactiveRow ) }\n\t\t\t\t\t\t\t\t\t\t\tonClick={ entry.onClick }\n\t\t\t\t\t\t\t\t\t\t\taria-label={ entry.ariaLabel }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ rowCells }\n\t\t\t\t\t\t\t\t\t\t\t<Icon className={ styles.chevron } icon={ chevronRight } size={ 24 } />\n\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tkey={ entry.id }\n\t\t\t\t\t\t\t\t\t\tdata-row-index={ rowIndex }\n\t\t\t\t\t\t\t\t\t\tstyle={ rowStyle }\n\t\t\t\t\t\t\t\t\t\tclassName={ styles.row }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ rowCells }\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t</Grid>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</ChartLayout>\n\t\t</ChartInstanceContext.Provider>\n\t);\n};\n\nconst LeaderboardChartWithProvider: FC< LeaderboardChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, don't create a new one\n\tif ( existingContext ) {\n\t\treturn <LeaderboardChartInternal { ...props } />;\n\t}\n\n\t// Otherwise, create our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<LeaderboardChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nLeaderboardChartWithProvider.displayName = 'LeaderboardChart';\n\n// Create LeaderboardChart with composition API\nconst LeaderboardChart = attachSubComponents( LeaderboardChartWithProvider, {\n\tLegend: Legend,\n} );\n\n// Create responsive LeaderboardChart with composition API\nconst LeaderboardChartResponsive = attachSubComponents(\n\twithResponsive< LeaderboardChartProps >( LeaderboardChartWithProvider ),\n\t{\n\t\tLegend: Legend,\n\t}\n);\n\nexport { LeaderboardChartResponsive as default, LeaderboardChart as LeaderboardChartUnresponsive };\n","/**\n * This animation uses the SVG self-drawing technique (source: https://www.joshwcomeau.com/svg/friendly-introduction-to-svg/),\n * leveraging stroke-dasharray and stroke-dashoffset properties to create the effect.\n *\n * Here, we reverse the animation to \"un-draw\" the circle for the revealing / radial wipe effect:\n * - Initially, the entire circle is drawn with a white mask.\n * - The circle's border (stroke) is drawn with a black stroke, wide enough to cover the circle.\n * - The stroke is then \"un-drawn,\" creating the wipe animation.\n * - A white mask makes the area visible, while a black mask makes the area invisible.\n */\n\ntype Angle = `${ number }deg` | `${ number }rad` | `${ number }grad` | `${ number }turn` | 0 | '0';\n\n/**\n * RadialWipeAnimationProps - SVG mask props that requires a radial wipe animation effect.\n *\n * @param {object} props - The properties object.\n * @param {string} props.id - The unique ID for the mask.\n * @param {number} props.radius - The outer radius of the radial wipe.\n * @param {number} [props.innerRadius=0] - The inner radius of the radial wipe.\n * @param {number} [props.durationMs=1000] - The duration of the animation in milliseconds.\n * @param {number} [props.wipePercentage=100] - The percentage of the wipe animation to complete.\n * @param {'clockwise' | 'counter-clockwise'} [props.direction='clockwise'] - The direction of the wipe animation.\n * @param {Angle} [props.startAngle='-90deg'] - The starting angle of the wipe animation.\n *\n * @return {JSX.Element} The radial wipe mask element.\n */\nexport type RadialWipeAnimationProps = {\n\tid: string;\n\tradius: number;\n\tinnerRadius?: number;\n\tdurationMs?: number;\n\tstartAngle?: Angle;\n\tdirection?: 'clockwise' | 'counter-clockwise';\n\twipePercentage?: number;\n};\n\n/**\n * Renders a SVG mask that creates a radial wipe animation effect.\n *\n * @param {RadialWipeAnimationProps} props - Component props\n * @return {JSX.Element} The rendered mask component\n */\nfunction RadialWipeAnimation( {\n\tid,\n\tradius,\n\tinnerRadius = 0,\n\tdurationMs = 1000,\n\twipePercentage = 100,\n\tdirection = 'clockwise',\n\tstartAngle = '-90deg',\n}: RadialWipeAnimationProps ) {\n\tconst strokeWidth =\n\t\t( radius - innerRadius ) * 2 + // The stroke is centered on the circumference, so we need to double the width.\n\t\t1; // Added 1 to prevent sub-pixel rendering issues.\n\n\tconst scaleY = direction === 'clockwise' ? -1 : 1;\n\n\tconst isValidWipePercentage = 0 < wipePercentage && wipePercentage <= 100;\n\tconst animationDuration = `${\n\t\t// If wipePercentage is invalid, set animation duration to 0 to disable animation.\n\t\tisValidWipePercentage ? durationMs * ( 100 / wipePercentage ) : 0\n\t}ms`;\n\n\treturn (\n\t\t<mask id={ id }>\n\t\t\t<circle\n\t\t\t\tcx={ 0 }\n\t\t\t\tcy={ 0 }\n\t\t\t\tr={ radius }\n\t\t\t\tpathLength=\"100\"\n\t\t\t\tfill=\"white\"\n\t\t\t\tstroke=\"black\" // The stroke will be un-drawn, hence 'black' mask.\n\t\t\t\tstrokeWidth={ strokeWidth }\n\t\t\t\tstrokeDasharray=\"100, 1000\"\n\t\t\t\tstrokeDashoffset=\"0\"\n\t\t\t\tstyle={ { transform: `rotate(${ startAngle }) scaleY(${ scaleY })` } }\n\t\t\t>\n\t\t\t\t<animate\n\t\t\t\t\tattributeName=\"stroke-dashoffset\"\n\t\t\t\t\tfrom=\"0\"\n\t\t\t\t\tto=\"100.1\"\n\t\t\t\t\tdur={ animationDuration }\n\t\t\t\t\tfill=\"freeze\" // Same as CSS 'forwards' to retain the final state after animation.\n\t\t\t\t\tcalcMode=\"spline\" // custom easing\n\t\t\t\t\tkeySplines=\"0.42 0 0.58 1;0 0 1 1\" // ease-in-out ; linear (unimportant)\n\t\t\t\t\tkeyTimes={ `0;${ wipePercentage / 100 };1` }\n\t\t\t\t/>\n\t\t\t</circle>\n\t\t</mask>\n\t);\n}\n\nexport default RadialWipeAnimation;\n","import { Group } from '@visx/group';\nimport { Pie } from '@visx/shape';\nimport { useTooltip, useTooltipInPortal } from '@visx/tooltip';\nimport clsx from 'clsx';\nimport { useCallback, useContext, useMemo } from 'react';\nimport { Legend, useChartLegendItems } from '../../components/legend';\nimport { BaseTooltip } from '../../components/tooltip';\nimport {\n\tuseDataWithPercentages,\n\tuseLegendVisibilityData,\n\tusePrefersReducedMotion,\n} from '../../hooks';\nimport {\n\tGlobalChartsProvider,\n\tuseChartId,\n\tuseChartRegistration,\n\tuseGlobalChartsContext,\n\tuseGlobalChartsTheme,\n\tGlobalChartsContext,\n} from '../../providers';\nimport { CHART_SCOPE_CLASS } from '../../styles/chart-scope-class';\nimport { attachSubComponents, resolveFontSize } from '../../utils';\nimport { getStringWidth } from '../../visx/text';\nimport { Center } from '../private/center';\nimport { ChartSVG, ChartHTML, useChartChildren } from '../private/chart-composition';\nimport { ChartInstanceContext } from '../private/chart-instance-context';\nimport { ChartLayout } from '../private/chart-layout';\nimport { RadialWipeAnimation } from '../private/radial-wipe-animation/';\nimport { getAllHiddenMessage, SvgEmptyState } from '../private/svg-empty-state';\nimport { withResponsive, ResponsiveConfig } from '../private/with-responsive';\nimport styles from './pie-chart.module.scss';\nimport type { LegendValueDisplay } from '../../components/legend';\nimport type {\n\tBaseChartProps,\n\tDataPointPercentage,\n\tDataPointPercentageCalculated,\n\tOptional,\n} from '../../types';\nimport type { ChartComponentWithComposition } from '../private/chart-composition';\nimport type { SVGProps, MouseEvent, ReactNode, FC } from 'react';\n\n/**\n * Parameters passed to the renderTooltip function for pie charts.\n */\nexport type PieChartRenderTooltipParams = {\n\t/**\n\t * The data point being hovered, including label, value, and calculated percentage.\n\t */\n\ttooltipData: DataPointPercentageCalculated;\n};\n\n/**\n * Default tooltip renderer for pie charts.\n * Renders a BaseTooltip with the hovered segment's data.\n *\n * @param {PieChartRenderTooltipParams} params - The tooltip parameters containing the hovered data point\n * @return {ReactNode} The rendered tooltip content\n */\nconst renderDefaultPieTooltip = ( { tooltipData }: PieChartRenderTooltipParams ): ReactNode => {\n\treturn <BaseTooltip data={ tooltipData } top={ 0 } left={ 0 } renderContainer={ false } />;\n};\n\nexport interface PieChartProps extends BaseChartProps< DataPointPercentage[] > {\n\t/**\n\t * Inner radius in pixels. If > 0, creates a donut chart. Defaults to 0.\n\t */\n\tinnerRadius?: number;\n\n\t/**\n\t * Add padding to the chart\n\t */\n\tpadding?: number;\n\n\t/**\n\t * Thickness of the pie chart.\n\t * A value between 0 and 1, where 0 means no thickness\n\t * and 1 means the maximum thickness.\n\t */\n\tthickness?: number;\n\n\t/**\n\t * Scale of the gap between groups in the pie chart\n\t * A value between 0 and 1, where 0 means no gap.\n\t */\n\tgapScale?: number;\n\n\t/**\n\t * Scale of the corner radius for the pie chart segments.\n\t * A value between 0 and 1, where 0 means no corner radius.\n\t */\n\tcornerScale?: number;\n\n\t/**\n\t * Whether to show labels on pie segments. Defaults to true.\n\t */\n\tshowLabels?: boolean;\n\n\t/**\n\t * What type of value to display in the legend when showValues is true.\n\t * - 'percentage': Shows percentage values (e.g., \"23%\") [default]\n\t * - 'value': Shows raw numeric values (e.g., \"30000\")\n\t * - 'valueDisplay': Shows formatted values (e.g., \"30K\")\n\t * - 'none': Shows no values, only labels\n\t */\n\tlegendValueDisplay?: LegendValueDisplay;\n\n\t/**\n\t * Use the children prop to render additional elements on the chart.\n\t */\n\tchildren?: ReactNode;\n\n\t/**\n\t * Horizontal offset for tooltip positioning in pixels (default: 0)\n\t */\n\ttooltipOffsetX?: number;\n\n\t/**\n\t * Vertical offset for tooltip positioning in pixels (default: -15)\n\t */\n\ttooltipOffsetY?: number;\n\n\t/**\n\t * Custom render function for tooltip content.\n\t * When provided, replaces the default BaseTooltip with custom content.\n\t */\n\trenderTooltip?: ( params: PieChartRenderTooltipParams ) => ReactNode;\n}\n\n// Base props type with optional responsive properties\ntype PieChartBaseProps = Optional< PieChartProps, 'size' >;\n\n// Composition API types\ntype PieChartComponent = ChartComponentWithComposition< PieChartBaseProps >;\ntype PieChartResponsiveComponent = ChartComponentWithComposition<\n\tPieChartBaseProps & ResponsiveConfig\n>;\n\n/**\n * Validates the pie chart data\n * @param data - The data to validate\n * @return Object containing validation result and error message\n */\nconst validateData = ( data: DataPointPercentage[] ) => {\n\tif ( ! data.length ) {\n\t\treturn { isValid: false, message: 'No data available' };\n\t}\n\n\t// Check for negative values\n\tconst hasNegativeValues = data.some( item => item.value < 0 );\n\tif ( hasNegativeValues ) {\n\t\treturn { isValid: false, message: 'Invalid data: Negative values are not allowed' };\n\t}\n\n\t// Validate total value is greater than 0\n\tconst totalValue = data.reduce( ( sum, item ) => sum + item.value, 0 );\n\tif ( totalValue <= 0 ) {\n\t\treturn { isValid: false, message: 'Invalid data: Total value must be greater than 0' };\n\t}\n\n\treturn { isValid: true, message: '' };\n};\n\n/**\n * Renders a pie or donut chart using the provided data.\n *\n * @param {PieChartProps} props - Component props\n * @return {JSX.Element} The rendered chart component\n */\nconst PieChartInternal = ( {\n\tdata,\n\tchartId: providedChartId,\n\twithTooltips = false,\n\tclassName,\n\tshowLegend = false,\n\tlegend = {},\n\twidth: propWidth,\n\theight: propHeight,\n\tsize,\n\tanimation,\n\tthickness = 1,\n\tpadding = 0,\n\tgapScale = 0,\n\tcornerScale = 0,\n\tshowLabels = true,\n\tlegendValueDisplay = 'percentage',\n\tchildren = null,\n\ttooltipOffsetX = 0,\n\ttooltipOffsetY = -15,\n\trenderTooltip = renderDefaultPieTooltip,\n\tgap = 'md',\n}: PieChartProps ) => {\n\tconst legendInteractive = legend.interactive ?? false;\n\tconst legendPosition = legend.position ?? 'bottom';\n\n\tconst providerTheme = useGlobalChartsTheme();\n\tconst chartId = useChartId( providedChartId );\n\tconst { tooltipOpen, tooltipLeft, tooltipTop, tooltipData, hideTooltip, showTooltip } =\n\t\tuseTooltip< DataPointPercentageCalculated >();\n\n\t// Set up portal tooltip for better z-index handling\n\t// We get containerBounds to cancel out stale offsets in the position calculation\n\tconst { containerRef, TooltipInPortal, containerBounds } = useTooltipInPortal( {\n\t\tdetectBounds: true,\n\t\tscroll: true,\n\t\tdebounce: 0,\n\t} );\n\n\tconst onMouseLeave = useCallback( () => {\n\t\tif ( ! withTooltips ) {\n\t\t\treturn;\n\t\t}\n\t\thideTooltip();\n\t}, [ withTooltips, hideTooltip ] );\n\n\tconst { getElementStyles, isSeriesVisible } = useGlobalChartsContext();\n\n\t// Calculate percentages from values (single source of truth)\n\tconst dataWithPercentages = useDataWithPercentages( data );\n\n\t// Filter and recalculate data from the shared legend visibility state.\n\tconst { visibleData, allSegmentsHidden, legendData } = useLegendVisibilityData( {\n\t\tdata: dataWithPercentages,\n\t\tchartId,\n\t\tisSeriesVisible,\n\t} );\n\n\t// Memoize legend options to prevent unnecessary re-calculations\n\tconst legendOptions = useMemo(\n\t\t() => ( { showValues: true, legendValueDisplay } ),\n\t\t[ legendValueDisplay ]\n\t);\n\n\t// Create legend items using legendData (has recalculated percentages for visible items)\n\tconst legendItems = useChartLegendItems( legendData, legendOptions );\n\n\tconst { isValid, message } = validateData( data );\n\n\t// Process children to extract compound components\n\tconst { svgChildren, htmlChildren, legendChildren, otherChildren } = useChartChildren(\n\t\tchildren,\n\t\t'PieChart'\n\t);\n\n\t// Memoize metadata to prevent unnecessary re-registration\n\tconst chartMetadata = useMemo(\n\t\t() => ( {\n\t\t\tthickness,\n\t\t\tgapScale,\n\t\t\tcornerScale,\n\t\t} ),\n\t\t[ thickness, gapScale, cornerScale ]\n\t);\n\n\t// Register chart with context only if data is valid\n\tuseChartRegistration( {\n\t\tchartId,\n\t\tlegendItems,\n\t\tchartType: 'pie',\n\t\tisDataValid: isValid,\n\t\tmetadata: chartMetadata,\n\t} );\n\n\tconst prefersReducedMotion = usePrefersReducedMotion();\n\n\tif ( ! isValid ) {\n\t\treturn (\n\t\t\t<div className={ clsx( 'pie-chart', styles[ 'pie-chart' ], className ) }>\n\t\t\t\t<div className={ styles[ 'error-message' ] }>{ message }</div>\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Calculate the angle between each (use original data length for consistent spacing)\n\tconst padAngle = gapScale * ( ( 2 * Math.PI ) / data.length );\n\n\t// Map the data to include index for color assignment\n\t// When interactive, we need to find the original index to maintain consistent colors\n\tconst dataWithIndex = visibleData.map( d => {\n\t\tconst originalIndex = data.findIndex( item => item.label === d.label );\n\t\treturn {\n\t\t\t...d,\n\t\t\tindex: originalIndex >= 0 ? originalIndex : 0,\n\t\t};\n\t} );\n\n\tconst accessors = {\n\t\tvalue: ( d: DataPointPercentageCalculated ) => d.value,\n\t\tfill: ( d: DataPointPercentageCalculated & { index: number } ) => {\n\t\t\treturn getElementStyles( { data: d, index: d.index } ).color;\n\t\t},\n\t};\n\n\tconst legendElement = showLegend && (\n\t\t<Legend\n\t\t\torientation={ legend.orientation ?? 'horizontal' }\n\t\t\tposition={ legendPosition }\n\t\t\talignment={ legend.alignment ?? 'center' }\n\t\t\tlabelStyles={ legend.labelStyles }\n\t\t\titemClassName={ legend.itemClassName }\n\t\t\titemStyles={ legend.itemStyles }\n\t\t\tshapeStyles={ legend.shapeStyles }\n\t\t\tshape={ legend.shape ?? 'circle' }\n\t\t\tchartId={ chartId }\n\t\t\tinteractive={ legendInteractive }\n\t\t/>\n\t);\n\n\treturn (\n\t\t<ChartInstanceContext.Provider value={ { chartId } }>\n\t\t\t<ChartLayout\n\t\t\t\tlegendPosition={ legendPosition }\n\t\t\t\tlegendElement={ legendElement }\n\t\t\t\tlegendChildren={ legendChildren }\n\t\t\t\tgap={ gap }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'pie-chart',\n\t\t\t\t\tstyles[ 'pie-chart' ],\n\t\t\t\t\t// Fill parent when no explicit dimensions provided\n\t\t\t\t\t{ [ styles[ 'pie-chart--responsive' ] ]: ! propWidth && ! propHeight },\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth: propWidth || undefined,\n\t\t\t\t\theight: propHeight || undefined,\n\t\t\t\t} }\n\t\t\t\ttrailingContent={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ withTooltips && tooltipOpen && tooltipData && (\n\t\t\t\t\t\t\t<TooltipInPortal top={ tooltipTop || 0 } left={ tooltipLeft || 0 }>\n\t\t\t\t\t\t\t\t<div className={ CHART_SCOPE_CLASS } role=\"tooltip\">\n\t\t\t\t\t\t\t\t\t{ renderTooltip( { tooltipData } ) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</TooltipInPortal>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ htmlChildren }\n\t\t\t\t\t\t{ otherChildren }\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ ( { contentWidth, contentHeight } ) => {\n\t\t\t\t\tconst availableWidth = contentWidth > 0 ? contentWidth : 300;\n\t\t\t\t\tconst availableHeight = contentHeight > 0 ? contentHeight : 300;\n\t\t\t\t\tconst availableSize = Math.min( availableWidth, availableHeight );\n\t\t\t\t\tconst actualSize = size ? Math.min( size, availableSize ) : availableSize;\n\n\t\t\t\t\tconst width = actualSize;\n\t\t\t\t\tconst height = actualSize;\n\n\t\t\t\t\tconst radius = Math.min( width, height ) / 2;\n\t\t\t\t\tconst centerX = width / 2;\n\t\t\t\t\tconst centerY = height / 2;\n\n\t\t\t\t\tconst outerRadius = radius - padding;\n\t\t\t\t\tconst innerRadius = thickness === 0 ? 0 : outerRadius * ( 1 - thickness );\n\n\t\t\t\t\tconst maxCornerRadius = ( outerRadius - innerRadius ) / 2;\n\t\t\t\t\tconst cornerRadius = cornerScale\n\t\t\t\t\t\t? Math.min( cornerScale * outerRadius, maxCornerRadius )\n\t\t\t\t\t\t: 0;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Center ref={ containerRef }>\n\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\tviewBox={ `0 0 ${ width } ${ height }` }\n\t\t\t\t\t\t\t\tpreserveAspectRatio=\"xMidYMid meet\"\n\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\theight={ height }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<defs>\n\t\t\t\t\t\t\t\t\t<RadialWipeAnimation\n\t\t\t\t\t\t\t\t\t\tid={ `radial-wipe-${ chartId }` }\n\t\t\t\t\t\t\t\t\t\tradius={ outerRadius }\n\t\t\t\t\t\t\t\t\t\tinnerRadius={ innerRadius }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</defs>\n\n\t\t\t\t\t\t\t\t<Group\n\t\t\t\t\t\t\t\t\ttop={ centerY }\n\t\t\t\t\t\t\t\t\tleft={ centerX }\n\t\t\t\t\t\t\t\t\tmask={\n\t\t\t\t\t\t\t\t\t\tanimation && ! prefersReducedMotion ? `url(#radial-wipe-${ chartId })` : null\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ allSegmentsHidden ? (\n\t\t\t\t\t\t\t\t\t\t<SvgEmptyState x={ 0 } y={ 0 } width={ width } height={ height }>\n\t\t\t\t\t\t\t\t\t\t\t{ getAllHiddenMessage( legendInteractive, 'segments' ) }\n\t\t\t\t\t\t\t\t\t\t</SvgEmptyState>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<Pie< DataPointPercentageCalculated & { index: number } >\n\t\t\t\t\t\t\t\t\t\t\tdata={ dataWithIndex }\n\t\t\t\t\t\t\t\t\t\t\tpieValue={ accessors.value }\n\t\t\t\t\t\t\t\t\t\t\touterRadius={ outerRadius }\n\t\t\t\t\t\t\t\t\t\t\tinnerRadius={ innerRadius }\n\t\t\t\t\t\t\t\t\t\t\tpadAngle={ padAngle }\n\t\t\t\t\t\t\t\t\t\t\tcornerRadius={ cornerRadius }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ pie => {\n\t\t\t\t\t\t\t\t\t\t\t\treturn pie.arcs.map( ( arc, index ) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst [ centroidX, centroidY ] = pie.path.centroid( arc );\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst hasSpaceForLabel = arc.endAngle - arc.startAngle >= 0.25;\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst handleMouseMove = ( event: MouseEvent< SVGElement > ) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif ( ! withTooltips ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Don't show tooltip until container bounds are measured\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif ( containerBounds.width === 0 || containerBounds.height === 0 ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Use clientX/Y and subtract containerBounds to cancel out any stale offset.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// TooltipInPortal calculates: tooltipLeft + containerBounds.left + scrollX\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// By passing (clientX - containerBounds.left), we get:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// (clientX - containerBounds.left) + containerBounds.left + scrollX = clientX + scrollX\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// This gives correct page coordinates regardless of stale bounds.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tshowTooltip( {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttooltipData: arc.data,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttooltipLeft: event.clientX - containerBounds.left + tooltipOffsetX,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttooltipTop: event.clientY - containerBounds.top + tooltipOffsetY,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst pathProps: SVGProps< SVGPathElement > & {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'data-testid'?: string;\n\t\t\t\t\t\t\t\t\t\t\t\t\t} = {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\td: pie.path( arc ) || '',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfill: accessors.fill( arc.data ),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'data-testid': 'pie-segment',\n\t\t\t\t\t\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst groupProps: SVGProps< SVGGElement > = {};\n\t\t\t\t\t\t\t\t\t\t\t\t\tif ( withTooltips ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tgroupProps.onMouseMove = handleMouseMove;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tgroupProps.onMouseLeave = onMouseLeave;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst svgLabelSmall = providerTheme.svgLabelSmall;\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst fontSize = resolveFontSize( svgLabelSmall?.fontSize ) ?? 12;\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst estimatedTextWidth = getStringWidth( arc.data.label, {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfontSize,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfontFamily: svgLabelSmall?.fontFamily,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfontWeight: svgLabelSmall?.fontWeight,\n\t\t\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst labelPadding = 6;\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst backgroundWidth = estimatedTextWidth + labelPadding * 2;\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst backgroundHeight = fontSize + labelPadding * 2;\n\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<g key={ `arc-${ index }` } { ...groupProps }>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<path { ...pathProps } />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ showLabels && hasSpaceForLabel && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<g>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ providerTheme.labelBackgroundColor && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<rect\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tx={ centroidX - backgroundWidth / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ty={ centroidY - backgroundHeight / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twidth={ backgroundWidth }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\theight={ backgroundHeight }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfill={ providerTheme.labelBackgroundColor }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\trx={ 4 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\try={ 4 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpointerEvents=\"none\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<text\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tx={ centroidX }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ty={ centroidY }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdy=\".33em\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfill={ providerTheme.labelTextColor || '#333' }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfontSize={ fontSize }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttextAnchor=\"middle\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpointerEvents=\"none\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ arc.data.label }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</text>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</g>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</g>\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t</Pie>\n\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t{ /* Render SVG children (like Group, Text) inside the SVG */ }\n\t\t\t\t\t\t\t\t\t{ ! allSegmentsHidden && svgChildren }\n\t\t\t\t\t\t\t\t</Group>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t</Center>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t</ChartLayout>\n\t\t</ChartInstanceContext.Provider>\n\t);\n};\n\nconst PieChartWithProvider: FC< PieChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, don't create a new one\n\tif ( existingContext ) {\n\t\treturn <PieChartInternal { ...props } />;\n\t}\n\n\t// Otherwise, create our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<PieChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nPieChartWithProvider.displayName = 'PieChart';\n\n// Create PieChart with composition API\nconst PieChart = attachSubComponents( PieChartWithProvider, {\n\tLegend: Legend,\n\tSVG: ChartSVG,\n\tHTML: ChartHTML,\n} ) as PieChartComponent;\n\n// Create responsive PieChart with composition API\nconst PieChartResponsive = attachSubComponents(\n\twithResponsive< PieChartProps >( PieChartWithProvider ),\n\t{\n\t\tLegend: Legend,\n\t\tSVG: ChartSVG,\n\t\tHTML: ChartHTML,\n\t}\n) as PieChartResponsiveComponent;\n\nexport { PieChartResponsive as default, PieChart as PieChartUnresponsive };\n","import { Group } from '@visx/group';\nimport { Pie } from '@visx/shape';\nimport { Text } from '@visx/text';\nimport { useTooltip, useTooltipInPortal } from '@visx/tooltip';\nimport clsx from 'clsx';\nimport { useCallback, useContext, useMemo } from 'react';\nimport { Legend, useChartLegendItems } from '../../components/legend';\nimport { BaseTooltip } from '../../components/tooltip';\nimport {\n\tuseDataWithPercentages,\n\tuseLegendVisibilityData,\n\tusePrefersReducedMotion,\n} from '../../hooks';\nimport {\n\tGlobalChartsProvider,\n\tuseChartId,\n\tuseChartRegistration,\n\tuseGlobalChartsContext,\n\tGlobalChartsContext,\n} from '../../providers';\nimport { CHART_SCOPE_CLASS } from '../../styles/chart-scope-class';\nimport { attachSubComponents } from '../../utils';\nimport { Center } from '../private/center';\nimport { ChartSVG, ChartHTML, useChartChildren } from '../private/chart-composition';\nimport { ChartInstanceContext } from '../private/chart-instance-context';\nimport { ChartLayout } from '../private/chart-layout';\nimport { RadialWipeAnimation } from '../private/radial-wipe-animation';\nimport { getAllHiddenMessage, SvgEmptyState } from '../private/svg-empty-state';\nimport { withResponsive } from '../private/with-responsive';\nimport styles from './pie-semi-circle-chart.module.scss';\nimport type { LegendValueDisplay } from '../../components/legend';\nimport type {\n\tBaseChartProps,\n\tDataPointPercentage,\n\tDataPointPercentageCalculated,\n\tOptional,\n} from '../../types';\nimport type { ChartComponentWithComposition } from '../private/chart-composition';\nimport type { ResponsiveConfig } from '../private/with-responsive';\nimport type { PieProvidedProps } from '@visx/shape';\nimport type { FC, MouseEvent, ReactNode } from 'react';\n\n/**\n * Parameters passed to the renderTooltip function for semi-circle charts.\n */\nexport type PieSemiCircleChartRenderTooltipParams = {\n\t/**\n\t * The data point being hovered, including label, value, and calculated percentage.\n\t */\n\ttooltipData: DataPointPercentageCalculated;\n};\n\n/**\n * Default tooltip renderer for semi-circle pie charts.\n * Renders a BaseTooltip with the hovered segment's data.\n *\n * @param {PieSemiCircleChartRenderTooltipParams} params - The tooltip parameters containing the hovered data point\n * @return {ReactNode} The rendered tooltip content\n */\nconst renderDefaultPieSemiCircleTooltip = ( {\n\ttooltipData,\n}: PieSemiCircleChartRenderTooltipParams ): ReactNode => {\n\treturn <BaseTooltip data={ tooltipData } top={ 0 } left={ 0 } renderContainer={ false } />;\n};\n\nconst PAD_ANGLE = 0.03; // Padding between segments\nconst DEFAULT_WIDTH = 400;\n\nexport interface PieSemiCircleChartProps extends BaseChartProps< DataPointPercentage[] > {\n\t/**\n\t * Explicit width of the chart container in pixels.\n\t * When omitted, the chart fills its parent container's width.\n\t * The chart always maintains a 2:1 width-to-height ratio, constrained by available space.\n\t */\n\twidth?: number;\n\n\t/**\n\t * Thickness of the pie chart. A value between 0 and 1\n\t */\n\tthickness?: number;\n\n\t/**\n\t * Direction of chart rendering\n\t * true for clockwise, false for counter-clockwise\n\t */\n\tclockwise?: boolean;\n\n\t/**\n\t * Label text to display above the chart\n\t */\n\tlabel?: string;\n\n\t/**\n\t * Note text to display below the label\n\t */\n\tnote?: string;\n\n\t/**\n\t * Use the children prop to render additional elements on the chart.\n\t */\n\tchildren?: ReactNode;\n\n\t/**\n\t * What type of value to display in the legend when showValues is true.\n\t * - 'percentage': Shows percentage values (e.g., \"23%\") [default]\n\t * - 'value': Shows raw numeric values (e.g., \"30000\")\n\t * - 'valueDisplay': Shows formatted values (e.g., \"30K\")\n\t * - 'none': Shows no values, only labels\n\t */\n\tlegendValueDisplay?: LegendValueDisplay;\n\n\t/**\n\t * Horizontal offset for tooltip positioning in pixels (default: 0)\n\t */\n\ttooltipOffsetX?: number;\n\n\t/**\n\t * Vertical offset for tooltip positioning in pixels (default: -15)\n\t */\n\ttooltipOffsetY?: number;\n\n\t/**\n\t * Custom render function for tooltip content.\n\t * When provided, replaces the default BaseTooltip with custom content.\n\t */\n\trenderTooltip?: ( params: PieSemiCircleChartRenderTooltipParams ) => ReactNode;\n}\n\n// Base props type with optional responsive properties\ntype PieSemiCircleChartBaseProps = Optional< PieSemiCircleChartProps, 'width' >;\n\n// Composition API types\ntype PieSemiCircleChartComponent = ChartComponentWithComposition< PieSemiCircleChartBaseProps >;\ntype PieSemiCircleChartResponsiveComponent = ChartComponentWithComposition<\n\tPieSemiCircleChartBaseProps & ResponsiveConfig\n>;\n\nexport type ArcData = PieProvidedProps< DataPointPercentageCalculated >[ 'arcs' ][ number ];\n\n/**\n * Validates the semi-circle pie chart data\n * @param data - The data to validate\n * @return Object containing validation result and error message\n */\nconst validateData = ( data: DataPointPercentage[] ) => {\n\tif ( ! data.length ) {\n\t\treturn { isValid: false, message: 'No data available' };\n\t}\n\n\t// Check for negative values\n\tconst hasNegativeValues = data.some( item => item.value < 0 );\n\tif ( hasNegativeValues ) {\n\t\treturn { isValid: false, message: 'Invalid data: Negative values are not allowed' };\n\t}\n\n\t// Validate total value is greater than 0\n\tconst totalValue = data.reduce( ( sum, item ) => sum + item.value, 0 );\n\tif ( totalValue <= 0 ) {\n\t\treturn { isValid: false, message: 'Invalid data: Total value must be greater than 0' };\n\t}\n\n\treturn { isValid: true, message: '' };\n};\n\nconst PieSemiCircleChartInternal: FC< PieSemiCircleChartProps > = ( {\n\tdata,\n\tchartId: providedChartId,\n\twidth: propWidth,\n\theight: propHeight,\n\tthickness = 0.4,\n\tclockwise = true,\n\twithTooltips = false,\n\tshowLegend = false,\n\tlegend = {},\n\tlegendValueDisplay = 'percentage',\n\tlabel,\n\tanimation,\n\tnote,\n\tclassName,\n\tchildren,\n\ttooltipOffsetX = 0,\n\ttooltipOffsetY = -15,\n\trenderTooltip = renderDefaultPieSemiCircleTooltip,\n\tgap = 'md',\n} ) => {\n\tconst legendInteractive = legend.interactive ?? false;\n\tconst legendPosition = legend.position ?? 'bottom';\n\n\tconst chartId = useChartId( providedChartId );\n\tconst { tooltipOpen, tooltipLeft, tooltipTop, tooltipData, hideTooltip, showTooltip } =\n\t\tuseTooltip< DataPointPercentageCalculated >();\n\n\t// Set up portal tooltip for better z-index handling\n\t// We get containerBounds to cancel out stale offsets in the position calculation\n\tconst { containerRef, TooltipInPortal, containerBounds } = useTooltipInPortal( {\n\t\tdetectBounds: true,\n\t\tscroll: true,\n\t\tdebounce: 0,\n\t} );\n\n\tconst handleMouseMove = useCallback(\n\t\t( event: MouseEvent< SVGElement >, arc: ArcData ) => {\n\t\t\t// Don't show tooltip until container bounds are measured\n\t\t\tif ( containerBounds.width === 0 || containerBounds.height === 0 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Use clientX/Y and subtract containerBounds to cancel out any stale offset.\n\t\t\t// TooltipInPortal calculates: tooltipLeft + containerBounds.left + scrollX\n\t\t\t// By passing (clientX - containerBounds.left), we get:\n\t\t\t// (clientX - containerBounds.left) + containerBounds.left + scrollX = clientX + scrollX\n\t\t\t// This gives correct page coordinates regardless of stale bounds.\n\t\t\tshowTooltip( {\n\t\t\t\ttooltipData: arc.data,\n\t\t\t\ttooltipLeft: event.clientX - containerBounds.left + tooltipOffsetX,\n\t\t\t\ttooltipTop: event.clientY - containerBounds.top + tooltipOffsetY,\n\t\t\t} );\n\t\t},\n\t\t[\n\t\t\tcontainerBounds.width,\n\t\t\tcontainerBounds.height,\n\t\t\tcontainerBounds.left,\n\t\t\tcontainerBounds.top,\n\t\t\tshowTooltip,\n\t\t\ttooltipOffsetX,\n\t\t\ttooltipOffsetY,\n\t\t]\n\t);\n\n\tconst handleMouseLeave = useCallback( () => {\n\t\thideTooltip();\n\t}, [ hideTooltip ] );\n\n\tconst handleArcMouseMove = useCallback(\n\t\t( arc: ArcData ) => ( event: MouseEvent< SVGElement > ) => {\n\t\t\thandleMouseMove( event, arc );\n\t\t},\n\t\t[ handleMouseMove ]\n\t);\n\n\t// Validate data first to get validation result\n\tconst { isValid, message } = validateData( data );\n\n\tconst { getElementStyles, isSeriesVisible } = useGlobalChartsContext();\n\n\t// Calculate percentages from values (single source of truth)\n\tconst dataWithPercentages = useDataWithPercentages( data );\n\n\t// Filter and recalculate data from the shared legend visibility state.\n\tconst { visibleData, allSegmentsHidden, legendData } = useLegendVisibilityData( {\n\t\tdata: dataWithPercentages,\n\t\tchartId,\n\t\tisSeriesVisible,\n\t} );\n\n\t// Define accessors with useMemo to avoid changing dependencies\n\tconst accessors = useMemo(\n\t\t() => ( {\n\t\t\tvalue: ( d: DataPointPercentageCalculated ) => d.value,\n\t\t\tsort: (\n\t\t\t\ta: DataPointPercentageCalculated & { index: number },\n\t\t\t\tb: DataPointPercentageCalculated & { index: number }\n\t\t\t) => b.value - a.value,\n\t\t\tfill: ( d: DataPointPercentageCalculated & { index: number } ) =>\n\t\t\t\tgetElementStyles( { data: d, index: d.index } ).color,\n\t\t} ),\n\t\t[ getElementStyles ]\n\t);\n\n\t// Memoize legend options to prevent unnecessary re-calculations\n\tconst legendOptions = useMemo(\n\t\t() => ( { showValues: true, legendValueDisplay } ),\n\t\t[ legendValueDisplay ]\n\t);\n\n\t// Create legend items using legendData (has recalculated percentages for visible items)\n\tconst legendItems = useChartLegendItems( legendData, legendOptions );\n\n\t// Process children to extract compound components\n\tconst { svgChildren, htmlChildren, legendChildren, otherChildren } = useChartChildren(\n\t\tchildren,\n\t\t'PieSemiCircleChart'\n\t);\n\n\t// Memoize metadata to prevent unnecessary re-registration\n\tconst chartMetadata = useMemo(\n\t\t() => ( {\n\t\t\tthickness,\n\t\t\tclockwise,\n\t\t} ),\n\t\t[ thickness, clockwise ]\n\t);\n\n\t// Register chart with context only if data is valid\n\tuseChartRegistration( {\n\t\tchartId,\n\t\tlegendItems,\n\t\tchartType: 'pie-semi-circle',\n\t\tisDataValid: isValid,\n\t\tmetadata: chartMetadata,\n\t} );\n\n\tconst prefersReducedMotion = usePrefersReducedMotion();\n\n\tconst effectiveWidth = propWidth || DEFAULT_WIDTH;\n\n\tif ( ! isValid ) {\n\t\tconst errorWidth = propHeight\n\t\t\t? Math.min( propWidth || propHeight * 2, propHeight * 2 )\n\t\t\t: effectiveWidth;\n\t\tconst errorHeight = errorWidth / 2;\n\n\t\treturn (\n\t\t\t<div className={ styles[ 'pie-semi-circle-chart' ] }>\n\t\t\t\t<svg width={ errorWidth } height={ errorHeight } data-testid=\"pie-chart-svg\">\n\t\t\t\t\t<text x=\"50%\" y=\"50%\" textAnchor=\"middle\" className={ styles.error }>\n\t\t\t\t\t\t{ message }\n\t\t\t\t\t</text>\n\t\t\t\t</svg>\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Map data with index for color assignment\n\t// When interactive, we need to find the original index to maintain consistent colors\n\tconst dataWithIndex = visibleData.map( d => {\n\t\tconst originalIndex = data.findIndex( item => item.label === d.label );\n\t\treturn {\n\t\t\t...d,\n\t\t\tindex: originalIndex >= 0 ? originalIndex : 0,\n\t\t};\n\t} );\n\n\t// Configure pie angles based on clockwise direction\n\tconst startAngle = clockwise ? -Math.PI / 2 : Math.PI / 2;\n\tconst endAngle = clockwise ? Math.PI / 2 : -Math.PI / 2;\n\n\tconst legendElement = showLegend && (\n\t\t<Legend\n\t\t\torientation={ legend.orientation ?? 'horizontal' }\n\t\t\tposition={ legendPosition }\n\t\t\talignment={ legend.alignment ?? 'center' }\n\t\t\tlabelStyles={ legend.labelStyles }\n\t\t\titemClassName={ legend.itemClassName }\n\t\t\titemStyles={ legend.itemStyles }\n\t\t\tshapeStyles={ legend.shapeStyles }\n\t\t\tshape={ legend.shape ?? 'circle' }\n\t\t\tchartId={ chartId }\n\t\t\tinteractive={ legendInteractive }\n\t\t/>\n\t);\n\n\treturn (\n\t\t<ChartInstanceContext.Provider value={ { chartId } }>\n\t\t\t<ChartLayout\n\t\t\t\tlegendPosition={ legendPosition }\n\t\t\t\tlegendElement={ legendElement }\n\t\t\t\tlegendChildren={ legendChildren }\n\t\t\t\tgap={ gap }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'pie-semi-circle-chart',\n\t\t\t\t\tstyles[ 'pie-semi-circle-chart' ],\n\t\t\t\t\t{\n\t\t\t\t\t\t[ styles[ 'pie-semi-circle-chart--responsive' ] ]: ! propWidth && ! propHeight,\n\t\t\t\t\t},\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth: propWidth || undefined,\n\t\t\t\t\theight: propHeight || undefined,\n\t\t\t\t} }\n\t\t\t\tdata-testid=\"pie-chart-container\"\n\t\t\t\ttrailingContent={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ withTooltips && tooltipOpen && tooltipData && (\n\t\t\t\t\t\t\t<TooltipInPortal top={ tooltipTop || 0 } left={ tooltipLeft || 0 }>\n\t\t\t\t\t\t\t\t<div className={ CHART_SCOPE_CLASS } role=\"tooltip\">\n\t\t\t\t\t\t\t\t\t{ renderTooltip( { tooltipData } ) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</TooltipInPortal>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ htmlChildren }\n\t\t\t\t\t\t{ otherChildren }\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ ( { contentWidth, contentHeight } ) => {\n\t\t\t\t\t// Calculate chart dimensions maintaining the 2:1 width-to-height ratio.\n\t\t\t\t\t// Use measured dimensions to respect height constraints, falling back\n\t\t\t\t\t// to explicit props during initial render before measurement is available.\n\t\t\t\t\tconst availableWidth = contentWidth > 0 ? contentWidth : effectiveWidth;\n\t\t\t\t\tconst availableHeight =\n\t\t\t\t\t\tcontentHeight > 0 ? contentHeight : propHeight || effectiveWidth / 2;\n\t\t\t\t\t// Constrain width so that height (= width / 2) never exceeds the available height\n\t\t\t\t\tconst width = Math.min( availableWidth, availableHeight * 2 );\n\t\t\t\t\tconst height = width / 2;\n\t\t\t\t\tconst radius = height; // For a semi-circle, radius equals the SVG height\n\t\t\t\t\tconst innerRadius = radius * ( 1 - thickness );\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Center ref={ containerRef }>\n\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\theight={ height }\n\t\t\t\t\t\t\t\tviewBox={ `0 0 ${ width } ${ height }` }\n\t\t\t\t\t\t\t\tdata-testid=\"pie-chart-svg\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<defs>\n\t\t\t\t\t\t\t\t\t<RadialWipeAnimation\n\t\t\t\t\t\t\t\t\t\tid={ `radial-wipe-${ chartId }` }\n\t\t\t\t\t\t\t\t\t\tradius={ radius }\n\t\t\t\t\t\t\t\t\t\tinnerRadius={ innerRadius }\n\t\t\t\t\t\t\t\t\t\tstartAngle=\"-180deg\"\n\t\t\t\t\t\t\t\t\t\twipePercentage={ 50 }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</defs>\n\n\t\t\t\t\t\t\t\t{ /* Main chart group centered horizontally and positioned at bottom */ }\n\t\t\t\t\t\t\t\t<Group\n\t\t\t\t\t\t\t\t\ttop={ height }\n\t\t\t\t\t\t\t\t\tleft={ width / 2 }\n\t\t\t\t\t\t\t\t\tmask={\n\t\t\t\t\t\t\t\t\t\tanimation && ! prefersReducedMotion ? `url(#radial-wipe-${ chartId })` : null\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ allSegmentsHidden ? (\n\t\t\t\t\t\t\t\t\t\t<SvgEmptyState x={ 0 } y={ -radius / 2 } width={ width } height={ height }>\n\t\t\t\t\t\t\t\t\t\t\t{ getAllHiddenMessage( legendInteractive, 'segments' ) }\n\t\t\t\t\t\t\t\t\t\t</SvgEmptyState>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t{ /* Pie chart */ }\n\t\t\t\t\t\t\t\t\t\t\t<Pie< DataPointPercentageCalculated & { index: number } >\n\t\t\t\t\t\t\t\t\t\t\t\tdata={ dataWithIndex }\n\t\t\t\t\t\t\t\t\t\t\t\tpieValue={ accessors.value }\n\t\t\t\t\t\t\t\t\t\t\t\touterRadius={ radius }\n\t\t\t\t\t\t\t\t\t\t\t\tinnerRadius={ innerRadius }\n\t\t\t\t\t\t\t\t\t\t\t\tcornerRadius={ 3 }\n\t\t\t\t\t\t\t\t\t\t\t\tpadAngle={ PAD_ANGLE }\n\t\t\t\t\t\t\t\t\t\t\t\tstartAngle={ startAngle }\n\t\t\t\t\t\t\t\t\t\t\t\tendAngle={ endAngle }\n\t\t\t\t\t\t\t\t\t\t\t\tpieSort={ accessors.sort }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ pie => {\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn pie.arcs.map( arc => (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<g\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={ arc.data.label }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonMouseMove={ withTooltips ? handleArcMouseMove( arc ) : undefined }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonMouseLeave={ withTooltips ? handleMouseLeave : undefined }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\td={ pie.path( arc ) || '' }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfill={ accessors.fill( arc.data ) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata-testid=\"pie-segment\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</g>\n\t\t\t\t\t\t\t\t\t\t\t\t\t) );\n\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t</Pie>\n\n\t\t\t\t\t\t\t\t\t\t\t{ /* Label and note text */ }\n\t\t\t\t\t\t\t\t\t\t\t<Group>\n\t\t\t\t\t\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\t\t\t\t\t\ttextAnchor=\"middle\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tverticalAnchor=\"start\"\n\t\t\t\t\t\t\t\t\t\t\t\t\ty={ -40 } // Position above the chart with space for note\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName={ styles.label }\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\t\t\t\t\t\ttextAnchor=\"middle\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tverticalAnchor=\"start\"\n\t\t\t\t\t\t\t\t\t\t\t\t\ty={ -20 } // Position between label and chart\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName={ styles.note }\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ note }\n\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t</Group>\n\n\t\t\t\t\t\t\t\t\t\t\t{ /* Render SVG children from composition API */ }\n\t\t\t\t\t\t\t\t\t\t\t{ ! allSegmentsHidden && svgChildren }\n\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</Group>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t</Center>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t</ChartLayout>\n\t\t</ChartInstanceContext.Provider>\n\t);\n};\n\nconst PieSemiCircleChartWithProvider: FC< PieSemiCircleChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, don't create a new one\n\tif ( existingContext ) {\n\t\treturn <PieSemiCircleChartInternal { ...props } />;\n\t}\n\n\t// Otherwise, create our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<PieSemiCircleChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nPieSemiCircleChartWithProvider.displayName = 'PieSemiCircleChart';\n\n// Create PieSemiCircleChart with composition API\nconst PieSemiCircleChart = attachSubComponents( PieSemiCircleChartWithProvider, {\n\tLegend: Legend,\n\tSVG: ChartSVG,\n\tHTML: ChartHTML,\n} ) as PieSemiCircleChartComponent;\n\n// Create responsive PieSemiCircleChart with composition API\nconst PieSemiCircleChartResponsive = attachSubComponents(\n\twithResponsive< PieSemiCircleChartProps >( PieSemiCircleChartWithProvider ),\n\t{\n\t\tLegend: Legend,\n\t\tSVG: ChartSVG,\n\t\tHTML: ChartHTML,\n\t}\n) as PieSemiCircleChartResponsiveComponent;\n\nexport {\n\tPieSemiCircleChartResponsive as default,\n\tPieSemiCircleChart as PieSemiCircleChartUnresponsive,\n};\n","import clsx from 'clsx';\nimport { useMemo, forwardRef } from 'react';\nimport { useGlobalChartsTheme } from '../../providers';\nimport { LineChartUnresponsive } from '../line-chart';\nimport { withResponsive } from '../private/with-responsive';\nimport styles from './sparkline.module.scss';\nimport type { SparklineProps } from './types';\nimport type { SeriesData } from '../../types';\n\nconst DEFAULT_WIDTH = 100;\nconst DEFAULT_HEIGHT = 40;\n\n/**\n * Transforms a simple number array into SeriesData format for LineChart.\n * Uses index-based dates to create a linear x-axis.\n *\n * @param data - Array of numeric values to plot\n * @param color - Optional color for the line stroke\n * @param strokeWidth - Optional stroke width for the line\n * @return SeriesData array suitable for LineChart\n */\nconst transformToSeriesData = (\n\tdata: number[],\n\tcolor?: string,\n\tstrokeWidth?: number\n): SeriesData[] => {\n\t// Use a fixed base date and increment by index to create linear spacing\n\tconst baseDate = new Date( 2000, 0, 1 );\n\n\treturn [\n\t\t{\n\t\t\tlabel: 'sparkline',\n\t\t\tdata: data.map( ( value, index ) => ( {\n\t\t\t\tdate: new Date( baseDate.getTime() + index * 86400000 ), // Add days\n\t\t\t\tvalue,\n\t\t\t} ) ),\n\t\t\toptions: {\n\t\t\t\tstroke: color,\n\t\t\t\tseriesLineStyle: strokeWidth ? { strokeWidth } : undefined,\n\t\t\t},\n\t\t},\n\t];\n};\n\nconst SparklineComponent = forwardRef< HTMLDivElement, SparklineProps >(\n\t(\n\t\t{\n\t\t\tdata,\n\t\t\twidth = DEFAULT_WIDTH,\n\t\t\theight = DEFAULT_HEIGHT,\n\t\t\tcolor,\n\t\t\tstrokeWidth: strokeWidthProp,\n\t\t\twithGradientFill = true,\n\t\t\tgradient,\n\t\t\tclassName,\n\t\t\tchartId,\n\t\t\tmargin: marginProp,\n\t\t\tanimation,\n\t\t},\n\t\tref\n\t) => {\n\t\tconst theme = useGlobalChartsTheme();\n\n\t\t// Get theme defaults for sparkline\n\t\tconst themeStrokeWidth = theme.sparkline?.strokeWidth ?? 1.5;\n\n\t\t// Use prop values or fall back to theme defaults\n\t\tconst strokeWidth = strokeWidthProp ?? themeStrokeWidth;\n\n\t\t// Transform number[] to SeriesData[] for LineChart\n\t\tconst seriesData = useMemo( () => {\n\t\t\tif ( ! data || data.length === 0 ) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\treturn transformToSeriesData( data, color, strokeWidth );\n\t\t}, [ data, color, strokeWidth ] );\n\n\t\t// Merge margins with theme defaults\n\t\tconst finalMargin = useMemo( () => {\n\t\t\tconst themeMargin = theme.sparkline?.margin ?? { top: 2, right: 2, bottom: 2, left: 2 };\n\t\t\tconst margin = marginProp ?? themeMargin;\n\t\t\treturn {\n\t\t\t\t...themeMargin,\n\t\t\t\t...margin,\n\t\t\t};\n\t\t}, [ marginProp, theme.sparkline?.margin ] );\n\n\t\t// Build gradient options for the series if custom gradient is provided\n\t\t// Note: This must be called before any early returns to follow React hooks rules\n\t\tconst seriesWithGradient = useMemo( () => {\n\t\t\tif ( ! gradient || seriesData.length === 0 ) {\n\t\t\t\treturn seriesData;\n\t\t\t}\n\n\t\t\treturn seriesData.map( series => ( {\n\t\t\t\t...series,\n\t\t\t\toptions: {\n\t\t\t\t\t...series.options,\n\t\t\t\t\tgradient: {\n\t\t\t\t\t\tfrom: gradient.from || color || '#000000',\n\t\t\t\t\t\tto: gradient.to || '#ffffff',\n\t\t\t\t\t\tfromOpacity: gradient.fromOpacity ?? 0.5,\n\t\t\t\t\t\ttoOpacity: gradient.toOpacity ?? 0.0,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t} ) );\n\t\t}, [ seriesData, gradient, color ] );\n\n\t\t// Handle empty data\n\t\tif ( ! data || data.length === 0 ) {\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'sparkline',\n\t\t\t\t\t\tstyles.sparkline,\n\t\t\t\t\t\tstyles[ 'sparkline--empty' ],\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ { width, height } }\n\t\t\t\t\tdata-testid=\"sparkline-empty\"\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\t// Handle single data point - render a simple dot\n\t\tif ( data.length === 1 ) {\n\t\t\tconst cx = width / 2;\n\t\t\tconst cy = height / 2;\n\t\t\tconst resolvedColor = color || '#000000';\n\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'sparkline',\n\t\t\t\t\t\tstyles.sparkline,\n\t\t\t\t\t\tstyles[ 'sparkline--single-point' ],\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ { width, height } }\n\t\t\t\t\tdata-testid=\"sparkline-single-point\"\n\t\t\t\t>\n\t\t\t\t\t<svg width={ width } height={ height } aria-hidden=\"true\">\n\t\t\t\t\t\t<circle cx={ cx } cy={ cy } r={ strokeWidth * 1.5 } fill={ resolvedColor } />\n\t\t\t\t\t</svg>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tref={ ref }\n\t\t\t\tclassName={ clsx( 'sparkline', styles.sparkline, className ) }\n\t\t\t\tdata-testid=\"sparkline\"\n\t\t\t>\n\t\t\t\t<LineChartUnresponsive\n\t\t\t\t\tdata={ seriesWithGradient }\n\t\t\t\t\twidth={ width }\n\t\t\t\t\theight={ height }\n\t\t\t\t\tmargin={ finalMargin }\n\t\t\t\t\tchartId={ chartId }\n\t\t\t\t\twithGradientFill={ withGradientFill }\n\t\t\t\t\twithTooltips={ false }\n\t\t\t\t\tshowLegend={ false }\n\t\t\t\t\tgridVisibility=\"none\"\n\t\t\t\t\toptions={ {\n\t\t\t\t\t\taxis: {\n\t\t\t\t\t\t\tx: { display: false },\n\t\t\t\t\t\t\ty: { display: false },\n\t\t\t\t\t\t},\n\t\t\t\t\t} }\n\t\t\t\t\tcurveType=\"monotone\"\n\t\t\t\t\tanimation={ animation }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n);\n\nSparklineComponent.displayName = 'SparklineComponent';\n\n/**\n * Sparkline - A minimal line chart for inline data visualization.\n *\n * Sparklines are compact charts designed to be embedded inline with text or\n * displayed in small spaces like table cells or dashboards. They show trends\n * without axes, labels, or other chart chrome.\n *\n * This component is built on top of LineChart with preconfigured settings\n * for minimal display (no axes, grid, tooltips, or legend).\n */\nconst SparklineUnresponsive = SparklineComponent;\n\nSparklineUnresponsive.displayName = 'SparklineUnresponsive';\n\n/**\n * Responsive Sparkline chart component\n */\nconst Sparkline = withResponsive< SparklineProps >( SparklineUnresponsive );\n\nexport { Sparkline as default, SparklineUnresponsive };\n","import clsx from 'clsx';\nimport { useStandaloneScopeClass } from '../../providers/chart-scope';\nimport styles from './trend-indicator.module.scss';\nimport type { TrendIndicatorProps, TrendDirection } from './types';\n\nconst DIRECTION_LABELS: Record< TrendDirection, string > = {\n\tup: 'Increase',\n\tdown: 'Decrease',\n\tneutral: 'No change',\n};\n\nconst Icon = ( { direction }: { direction: TrendDirection } ) => {\n\tif ( direction === 'neutral' ) {\n\t\treturn null;\n\t}\n\n\tconst isUp = direction === 'up';\n\treturn (\n\t\t<svg\n\t\t\tclassName={ styles[ 'trend-indicator__icon' ] }\n\t\t\tviewBox=\"0 0 16 16\"\n\t\t\tfill=\"none\"\n\t\t\taria-hidden=\"true\"\n\t\t>\n\t\t\t<path\n\t\t\t\td={ isUp ? 'M8 13V3M4 7l4-4 4 4' : 'M8 3v10M4 9l4 4 4-4' }\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t</svg>\n\t);\n};\n\n/**\n * TrendIndicator displays a directional trend with a value.\n * Used to show percentage changes or growth metrics.\n *\n * @param {TrendIndicatorProps} props - Component props\n * @return {JSX.Element} The rendered trend indicator\n */\nexport function TrendIndicator( {\n\tdirection,\n\tvalue,\n\tclassName,\n\tstyle,\n\tshowIcon = true,\n}: TrendIndicatorProps ) {\n\tconst ariaLabel = `${ DIRECTION_LABELS[ direction ] }: ${ value }`;\n\tconst standaloneScopeClass = useStandaloneScopeClass();\n\n\treturn (\n\t\t<span\n\t\t\tclassName={ clsx(\n\t\t\t\tstandaloneScopeClass,\n\t\t\t\tstyles[ 'trend-indicator' ],\n\t\t\t\tstyles[ `trend-indicator--${ direction }` ],\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\tstyle={ style }\n\t\t\taria-label={ ariaLabel }\n\t\t>\n\t\t\t{ showIcon && <Icon direction={ direction } /> }\n\t\t\t<span className={ styles[ 'trend-indicator__value' ] }>{ value }</span>\n\t\t</span>\n\t);\n}\n"],"x_google_ignoreList":[22,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAa,wBAAA,GAAA,MAAA,cAAA,CAA0E,IAAK;;;ACjB5F,MAAa,gCAA2D;CACvE,MAAM,WAAA,GAAA,MAAA,WAAA,CAAsB,oBAAqB;CACjD,IAAK,CAAE,SACN,MAAM,IAAI,MAAO,+DAAgE;CAElF,OAAO;AACR;;;;;;;;ACJA,MAAa,oBAAoB;;;;;;;;;;;;;ACKjC,SAAgB,oBACf,OACA,eAC0B;CAC1B,OAAO,OAAO,OAAQ,OAAO,aAAc;AAC5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC8BA,MAAM,eAAgB,eAAiC;CACtD,MAAM,SAAS,WAAW,QAAS,GAAI;CACv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;;;;;;;;;;AClM1E,MAAM,mBAAqD;CAC1D,IAAI;CACJ,MAAM;CACN,SAAS;AACV;AAEA,MAAM,QAAS,EAAE,gBAAgD;CAChE,IAAK,cAAc,WAClB,OAAO;CAGR,MAAM,OAAO,cAAc;CAC3B,OACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EACC,WAAYC,+BAAQ;EACpB,SAAQ;EACR,MAAK;EACL,eAAY;YAEZ,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;GACC,GAAI,OAAO,wBAAwB;GACnC,QAAO;GACP,aAAY;GACZ,eAAc;GACd,gBAAe;EACf,CAAA;CACG,CAAA;AAEP;;;;;;;;AASA,SAAgB,eAAgB,EAC/B,WACA,OACA,WACA,OACA,WAAW,QACa;CACxB,MAAM,YAAY,GAAI,iBAAkB,WAAa,IAAK;CAG1D,OACC,iBAAA,GAAA,kBAAA,KAAA,CAAC,QAAD;EACC,YAAA,GAAA,KAAA,QAAA,CAJ2B,wBAKP,GACnBA,+BAAQ,oBACRA,+BAAQ,oBAAqB,cAC7B,SACD;EACQ;EACR,cAAa;YARd,CAUG,YAAY,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD,EAAkB,UAAa,CAAA,GAC7C,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;GAAM,WAAYA,+BAAQ;aAA+B;EAAa,CAAA,CACjE;;AAER"}
1
+ {"version":3,"file":"index.cjs","names":["styles","useIsomorphicLayoutEffect","useLayoutEffect","useEffect","Fragment","Group","Stack","styles","styles","curveCatmullRom","curveLinear","curveMonotoneX","toNumber","DataContext","validateData","getScaleBandwidth","DataContext","formatNumberCompact","Text","Group","BarChartUnresponsive","DOMPurify","Stack","Text","styles","tslib_1","tslib_1","tslib_1","tslib_1","tslib_1","tslib_1","tslib_1","tslib_1","tslib_1","tslib_1","isBrowser","isBrowser","getRegisteredStyles","isDevelopment","unitless","asTemplateStringsArr","templateStringsArr","hashString","isBrowser","React","getRegisteredStyles","React","React","Emotion","css","merge","getRegisteredStyles","useEmotionCache","innerCx","warn","memoize","warn","warn","component_default","View","component_default","CONFIG","View","validateData","styles","Group","Pie","styles"],"sources":["../src/charts/private/chart-instance-context/chart-instance-context.ts","../src/charts/private/chart-instance-context/use-chart-instance-context.ts","../src/styles/chart-scope-class.ts","../src/utils/create-composition.ts","../src/utils/date-parsing.ts","../src/utils/format-metric-value.ts","../src/utils/format-percentage.ts","../src/utils/get-longest-tick-width.ts","../src/utils/get-styles.ts","../src/utils/is-safari.ts","../src/utils/merge-themes.ts","../src/utils/color-utils.ts","../src/utils/resolve-css-var.ts","../src/utils/resolve-font-size.ts","../src/providers/chart-scope/chart-scope-context.ts","../src/providers/chart-context/private/get-chart-color.ts","../src/providers/chart-context/private/theme-override-vars.ts","../src/providers/chart-context/themes.ts","../src/providers/chart-context/private/with-catalog-pointers.ts","../src/providers/chart-context/global-charts-provider.tsx","../src/providers/chart-context/hooks/use-global-charts-context.ts","../src/providers/chart-context/hooks/use-chart-id.ts","../../../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js","../src/hooks/use-deep-memo.ts","../src/providers/chart-scope/use-chart-scope-element.ts","../src/providers/chart-scope/use-standalone-scope-class.ts","../src/hooks/use-xychart-theme.ts","../src/hooks/use-chart-data-transform.ts","../src/hooks/use-chart-margin.tsx","../src/hooks/use-element-size.ts","../src/hooks/use-text-truncation.ts","../src/hooks/use-zero-value-display.ts","../src/hooks/use-data-with-percentages.ts","../src/hooks/use-legend-visibility-data.ts","../src/hooks/use-prefers-reduced-motion.ts","../src/providers/chart-context/hooks/use-chart-registration.ts","../src/providers/chart-context/hooks/use-global-charts-theme.ts","../src/components/legend/utils/value-or-identity.ts","../src/components/legend/utils/label-transform-factory.ts","../src/components/legend/private/base-legend.tsx","../src/components/legend/legend.tsx","../src/components/legend/hooks/use-chart-legend-items.ts","../src/components/tooltip/base-tooltip.tsx","../src/components/tooltip/accessible-tooltip.tsx","../src/providers/chart-context/hooks/use-default-hidden-series.ts","../src/charts/private/chart-composition/chart-svg.tsx","../src/charts/private/chart-composition/chart-html.tsx","../src/charts/private/chart-composition/render-legend-slot.ts","../src/charts/private/chart-composition/use-chart-children.ts","../src/charts/private/chart-layout/chart-layout.tsx","../src/charts/private/default-glyph/default-glyph.tsx","../src/charts/private/center/center.tsx","../src/charts/private/svg-empty-state/svg-empty-state.tsx","../src/charts/private/svg-empty-state/get-all-hidden-message.ts","../src/charts/private/time-axis.ts","../src/charts/private/with-responsive/with-responsive.tsx","../src/charts/private/x-zoom/x-zoom.tsx","../src/charts/line-chart/private/line-chart-annotation-label-popover.tsx","../src/charts/line-chart/private/line-chart-annotations-overlay.tsx","../src/charts/line-chart/private/line-chart-annotation.tsx","../src/charts/line-chart/private/line-chart-glyph.tsx","../src/charts/line-chart/line-chart.tsx","../src/charts/area-chart/private/validate-data.ts","../src/charts/area-chart/private/overlays.tsx","../src/charts/area-chart/area-chart.tsx","../src/charts/bar-chart/private/truncated-tick-component.tsx","../src/charts/bar-chart/private/use-bar-chart-options.ts","../src/charts/bar-chart/private/comparison-bars-geometry.ts","../src/charts/bar-chart/private/comparison-constants.ts","../src/charts/bar-chart/private/comparison-bars.tsx","../src/charts/bar-chart/bar-chart.tsx","../src/charts/bar-list-chart/bar-list-chart.tsx","../src/charts/conversion-funnel-chart/private/use-funnel-selection.ts","../src/charts/conversion-funnel-chart/conversion-funnel-chart.tsx","../src/utils/sanitize-html.ts","../src/charts/geo-chart/geo-chart.tsx","../src/types.ts","../src/charts/heatmap-chart/private/use-heatmap-colors.ts","../src/charts/heatmap-chart/private/build-calendar-data.ts","../src/charts/heatmap-chart/private/heatmap-context.ts","../src/charts/heatmap-chart/private/heatmap-legend.tsx","../src/charts/heatmap-chart/heatmap-chart.tsx","../../../../node_modules/.pnpm/is-plain-object@5.0.0/node_modules/is-plain-object/dist/is-plain-object.mjs","../../../../node_modules/.pnpm/lower-case@2.0.2/node_modules/lower-case/dist/index.js","../../../../node_modules/.pnpm/no-case@3.0.4/node_modules/no-case/dist/index.js","../../../../node_modules/.pnpm/pascal-case@3.1.2/node_modules/pascal-case/dist/index.js","../../../../node_modules/.pnpm/camel-case@4.1.2/node_modules/camel-case/dist/index.js","../../../../node_modules/.pnpm/upper-case-first@2.0.2/node_modules/upper-case-first/dist/index.js","../../../../node_modules/.pnpm/capital-case@1.0.4/node_modules/capital-case/dist/index.js","../../../../node_modules/.pnpm/upper-case@2.0.2/node_modules/upper-case/dist/index.js","../../../../node_modules/.pnpm/constant-case@3.0.4/node_modules/constant-case/dist/index.js","../../../../node_modules/.pnpm/dot-case@3.0.4/node_modules/dot-case/dist/index.js","../../../../node_modules/.pnpm/header-case@2.0.4/node_modules/header-case/dist/index.js","../../../../node_modules/.pnpm/param-case@3.0.4/node_modules/param-case/dist/index.js","../../../../node_modules/.pnpm/path-case@3.0.4/node_modules/path-case/dist/index.js","../../../../node_modules/.pnpm/sentence-case@3.0.4/node_modules/sentence-case/dist/index.js","../../../../node_modules/.pnpm/snake-case@3.0.4/node_modules/snake-case/dist/index.js","../../../../node_modules/.pnpm/change-case@4.1.2/node_modules/change-case/dist/index.js","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/hooks/use-update-effect.mjs","../../../../node_modules/.pnpm/@emotion+sheet@1.4.0/node_modules/@emotion/sheet/dist/emotion-sheet.esm.js","../../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Enum.js","../../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Utility.js","../../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Tokenizer.js","../../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Parser.js","../../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Serializer.js","../../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Middleware.js","../../../../node_modules/.pnpm/@emotion+weak-memoize@0.4.0/node_modules/@emotion/weak-memoize/dist/emotion-weak-memoize.esm.js","../../../../node_modules/.pnpm/@emotion+memoize@0.9.0/node_modules/@emotion/memoize/dist/emotion-memoize.esm.js","../../../../node_modules/.pnpm/@emotion+cache@11.14.0/node_modules/@emotion/cache/dist/emotion-cache.esm.js","../../../../node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.production.min.js","../../../../node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.development.js","../../../../node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.js","../../../../node_modules/.pnpm/hoist-non-react-statics@3.3.2/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js","../../../../node_modules/.pnpm/@emotion+utils@1.4.2/node_modules/@emotion/utils/dist/emotion-utils.esm.js","../../../../node_modules/.pnpm/@emotion+hash@0.9.2/node_modules/@emotion/hash/dist/emotion-hash.esm.js","../../../../node_modules/.pnpm/@emotion+unitless@0.10.0/node_modules/@emotion/unitless/dist/emotion-unitless.esm.js","../../../../node_modules/.pnpm/@emotion+serialize@1.3.3/node_modules/@emotion/serialize/dist/emotion-serialize.esm.js","../../../../node_modules/.pnpm/@emotion+use-insertion-effect-with-fallbacks@1.2.0_react@18.3.1/node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.esm.js","../../../../node_modules/.pnpm/@emotion+react@11.14.0_@types+react@18.3.28_react@18.3.1/node_modules/@emotion/react/dist/emotion-element-d59e098f.esm.js","../../../../node_modules/.pnpm/@emotion+react@11.14.0_@types+react@18.3.28_react@18.3.1/node_modules/@emotion/react/dist/emotion-react.esm.js","../../../../node_modules/.pnpm/@emotion+css@11.13.5/node_modules/@emotion/css/create-instance/dist/emotion-css-create-instance.esm.js","../../../../node_modules/.pnpm/@emotion+css@11.13.5/node_modules/@emotion/css/dist/emotion-css.esm.js","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/hooks/use-cx.mjs","../../../../node_modules/.pnpm/memize@2.1.1/node_modules/memize/dist/index.js","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/colors-values.mjs","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/config-values.mjs","../../../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/es6/index.js","../../../../node_modules/.pnpm/@wordpress+warning@3.52.0/node_modules/@wordpress/warning/build-module/utils.mjs","../../../../node_modules/.pnpm/@wordpress+warning@3.52.0/node_modules/@wordpress/warning/build-module/index.mjs","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/context-system-provider.mjs","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/constants.mjs","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/get-styled-class-name-from-key.mjs","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/context-connect.mjs","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/utils.mjs","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/use-context-system.mjs","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/visually-hidden/styles.mjs","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/polymorphic-element.mjs","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/view/component.mjs","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/visually-hidden/component.mjs","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/use-responsive-value.mjs","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/grid/utils.mjs","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/grid/hook.mjs","../../../../node_modules/.pnpm/@wordpress+components@37.0.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/grid/component.mjs","../src/charts/leaderboard-chart/hooks/use-fitted-row-count.ts","../src/charts/leaderboard-chart/hooks/use-leaderboard-legend-items.ts","../src/charts/leaderboard-chart/leaderboard-chart.tsx","../src/charts/private/radial-wipe-animation/radial-wipe-animation.tsx","../src/charts/pie-chart/pie-chart.tsx","../src/charts/pie-semi-circle-chart/pie-semi-circle-chart.tsx","../src/charts/sparkline/sparkline.tsx","../src/components/trend-indicator/trend-indicator.tsx"],"sourcesContent":["import { createContext } from 'react';\n\nexport interface ChartInstanceRef {\n\tgetScales: () => { xScale: unknown; yScale: unknown } | null;\n\tgetChartDimensions: () => {\n\t\twidth: number;\n\t\theight: number;\n\t\tmargin: { top?: number; right?: number; bottom?: number; left?: number };\n\t};\n}\n\n// Local context for chart implicit state sharing\nexport interface ChartInstanceContextValue {\n\tchartId: string;\n\tchartRef?: React.RefObject< ChartInstanceRef >;\n\tchartWidth?: number;\n\tchartHeight?: number;\n\tisSeriesVisible?: ( seriesLabel: string ) => boolean;\n}\n\nexport const ChartInstanceContext = createContext< ChartInstanceContextValue | null >( null );\n","import { useContext } from 'react';\nimport { ChartInstanceContext, type ChartInstanceContextValue } from './chart-instance-context';\n\nexport const useChartInstanceContext = (): ChartInstanceContextValue => {\n\tconst context = useContext( ChartInstanceContext );\n\tif ( ! context ) {\n\t\tthrow new Error( 'useChartInstanceContext must be used within a Chart component' );\n\t}\n\treturn context;\n};\n","/**\n * 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.\n *\n * Deliberately unhashed: consumers are documented as being able to target it to override a token on the provider element.\n */\nexport const CHART_SCOPE_CLASS = 'a8c-charts-scope';\n","/**\n * Utility function to create chart components with composition API.\n *\n * This function attaches subcomponents to a chart component to enable\n * dot notation access like <Chart.Legend />, <Chart.Tooltip />, etc.\n *\n * @param Chart - The main chart component\n * @param subComponents - Object containing subcomponents to attach\n * @return Chart component with attached subcomponents\n */\nexport function attachSubComponents< TChart, TSubComponents extends Record< string, unknown > >(\n\tChart: TChart,\n\tsubComponents: TSubComponents\n): TChart & TSubComponents {\n\treturn Object.assign( Chart, subComponents );\n}\n","/**\n * @file Date parsing utilities using date-fns for local timezone handling\n *\n * This module provides utilities for parsing various date string formats and converting\n * them to local timezone dates using the battle-tested date-fns library. For formats\n * without timezone info, they're treated as local. For formats with timezone info,\n * they're converted to the equivalent local time.\n *\n * Note: And specifically it prevents format `YYYY-MM-DD` being parsed as UTC date.\n *\n * Key Features:\n * - All parsed dates are in local timezone\n * - Converts timezone-aware strings to local equivalent\n * - Robust input validation and error handling using date-fns\n * - TypeScript type safety\n * - Much smaller codebase than custom parsing\n *\n * Supported Formats:\n * - YYYY-MM-DD (treated as local)\n * - YYYY-MM-DD HH:mm:ss (treated as local)\n * - YYYY-MM-DD HH:mm (treated as local)\n * - YYYY-MM-DDTHH:mm:ss (treated as local)\n * - YYYY-MM-DDTHH:mm:ss.SSS (treated as local)\n * - YYYY-MM-DDTHH:mm (treated as local)\n * - YYYY-MM-DDTHH:mm:ssZ (converted to local)\n * - YYYY-MM-DDTHH:mm:ss±HH:mm (converted to local)\n *\n * @example\n * ```typescript\n * parseAsLocalDate(\"2025-01-01\"); // Local timezone\n * parseAsLocalDate(\"2025-01-01 14:30:00\"); // Local timezone\n * parseAsLocalDate(\"2025-01-01 14:30\"); // Local timezone\n * parseAsLocalDate(\"2025-01-01T14:30:45.123\"); // Local timezone\n * parseAsLocalDate(\"2025-01-01T14:30:00Z\"); // UTC 14:30 → Local equivalent\n * parseAsLocalDate(\"2025-01-01T14:30:00+05:00\"); // +05:00 14:30 → Local equivalent\n * ```\n */\n\nimport { parse, parseISO, isValid } from 'date-fns';\n\n/**\n * Checks if a date string contains timezone information\n * @param {string} dateString - The date string to check for timezone information\n * @return {boolean} True if the date string contains timezone information, false otherwise\n */\nconst hasTimezone = ( dateString: string ): boolean => {\n\tconst tIndex = dateString.indexOf( 'T' );\n\tif ( tIndex === -1 ) {\n\t\treturn false;\n\t}\n\n\tif ( dateString.endsWith( 'Z' ) ) {\n\t\treturn true;\n\t}\n\n\treturn /[+-]\\d{2}:?\\d{2}$/.test( dateString.slice( tIndex + 1 ) );\n};\n\n/**\n * Parses any supported date string format and returns a local timezone date\n *\n * Uses date-fns for robust parsing and validation. For strings without timezone\n * info, treats as local timezone. For strings with timezone info, converts to\n * local timezone equivalent.\n *\n * Supports:\n * - YYYY-MM-DD (local)\n * - YYYY-MM-DD HH:mm:ss (local)\n * - YYYY-MM-DD HH:mm (local)\n * - YYYY-MM-DDTHH:mm:ss (local)\n * - YYYY-MM-DDTHH:mm:ss.SSS (local)\n * - YYYY-MM-DDTHH:mm (local)\n * - YYYY-MM-DDTHH:mm:ssZ (UTC → local)\n * - YYYY-MM-DDTHH:mm:ss±HH:mm (offset → local)\n * @param {string} dateString - The date string to parse into a local timezone date\n * @return {Date} A Date object representing the parsed date in local timezone, or an invalid Date if parsing fails\n */\nexport const parseAsLocalDate = ( dateString: string ): Date => {\n\tconst trimmedString = dateString.trim();\n\n\t// If it has timezone information, parse as ISO and convert to local\n\tif ( hasTimezone( trimmedString ) ) {\n\t\tconst isoDate = parseISO( trimmedString );\n\n\t\tif ( ! isValid( isoDate ) ) {\n\t\t\treturn new Date( NaN );\n\t\t}\n\n\t\t// parseISO automatically converts to local timezone\n\t\treturn isoDate;\n\t}\n\n\t// For naive strings, try different local formats\n\tconst formats = [\n\t\t'yyyy-MM-dd', // 2025-01-01\n\t\t'yyyy-MM-dd HH:mm:ss', // 2025-01-01 14:30:45\n\t\t'yyyy-MM-dd HH:mm', // 2025-01-01 14:30\n\t\t\"yyyy-MM-dd'T'HH:mm:ss\", // 2025-01-01T14:30:45\n\t\t\"yyyy-MM-dd'T'HH:mm:ss.SSS\", // 2025-01-01T14:30:45.123\n\t\t\"yyyy-MM-dd'T'HH:mm\", // 2025-01-01T14:30\n\t];\n\n\tfor ( const format of formats ) {\n\t\tconst result = parse( trimmedString, format, new Date() );\n\t\tif ( isValid( result ) ) {\n\t\t\treturn result;\n\t\t}\n\t}\n\n\t// If no format matched, return invalid date\n\treturn new Date( NaN );\n};\n","import { formatNumberCompact, formatNumber } from '@automattic/number-formatters';\n\n/**\n * Types for formatMetricValue\n */\nexport type MetricValueType = 'number' | 'average' | 'currency';\n\ntype FormatMetricValueOptions = {\n\tdecimals?: number;\n\tuseMultipliers?: boolean;\n\tsignDisplay?: Intl.NumberFormatOptions[ 'signDisplay' ];\n};\n\n/**\n * Format a numeric metric value based on type, precision and scale.\n * Supports currency, number and percentage, using `@automattic/number-formatters`.\n *\n * @param value - The value to format\n * @param type - The type of formatting to apply\n * @param options - Formatting options\n * @param options.decimals - Number of decimal places to show\n * @param options.useMultipliers - Whether to use K, M, B suffixes for large numbers\n * @param options.signDisplay - Controls when to display the sign (auto, always, never, exceptZero)\n * @return Formatted string\n */\nexport const formatMetricValue = (\n\tvalue: string | number,\n\ttype: MetricValueType = 'number',\n\t{ decimals, useMultipliers = false, signDisplay }: FormatMetricValueOptions = {}\n): string => {\n\tif ( value === null || value === undefined ) {\n\t\treturn '';\n\t}\n\n\tconst numericValue = Number( value );\n\tif ( isNaN( numericValue ) ) {\n\t\treturn '';\n\t}\n\n\tswitch ( type ) {\n\t\tcase 'currency': {\n\t\t\t// Basic currency formatting - can be enhanced with full currency support\n\t\t\tconst formatted = useMultipliers\n\t\t\t\t? formatNumberCompact( numericValue, {\n\t\t\t\t\t\tdecimals: decimals ?? 2,\n\t\t\t\t\t\tnumberFormatOptions: {\n\t\t\t\t\t\t\tmaximumFractionDigits: decimals ?? 2,\n\t\t\t\t\t\t\tsignDisplay,\n\t\t\t\t\t\t},\n\t\t\t\t } )\n\t\t\t\t: formatNumber( numericValue, {\n\t\t\t\t\t\tdecimals: decimals ?? 2,\n\t\t\t\t\t\tnumberFormatOptions: {\n\t\t\t\t\t\t\tsignDisplay,\n\t\t\t\t\t\t},\n\t\t\t\t } );\n\t\t\treturn `$${ formatted }`;\n\t\t}\n\n\t\tcase 'average': {\n\t\t\tif ( ! Number.isFinite( numericValue ) ) {\n\t\t\t\treturn '—';\n\t\t\t}\n\n\t\t\treturn formatNumber( numericValue, {\n\t\t\t\tdecimals: decimals ?? 0,\n\t\t\t\tnumberFormatOptions: {\n\t\t\t\t\tstyle: 'percent',\n\t\t\t\t\tsignDisplay: signDisplay ?? 'exceptZero',\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\tcase 'number':\n\t\tdefault: {\n\t\t\treturn useMultipliers\n\t\t\t\t? formatNumberCompact( numericValue, {\n\t\t\t\t\t\tdecimals: decimals ?? 0,\n\t\t\t\t\t\tnumberFormatOptions: {\n\t\t\t\t\t\t\tmaximumFractionDigits: decimals ?? 0,\n\t\t\t\t\t\t\tsignDisplay,\n\t\t\t\t\t\t},\n\t\t\t\t } )\n\t\t\t\t: formatNumber( numericValue, {\n\t\t\t\t\t\tdecimals: decimals ?? 0,\n\t\t\t\t\t\tnumberFormatOptions: {\n\t\t\t\t\t\t\tsignDisplay,\n\t\t\t\t\t\t},\n\t\t\t\t } );\n\t\t}\n\t}\n};\n","import { formatNumber } from '@automattic/number-formatters';\n\n/**\n * Format a percentage value with smart decimal handling.\n * Uses `@automattic/number-formatters` for consistent formatting.\n * Removes unnecessary trailing zeros and caps at 2 decimal places.\n *\n * @param value - The percentage value (0-100 range)\n * @return Formatted percentage string (e.g., \"30%\", \"30.1%\", \"30.25%\")\n */\nexport const formatPercentage = ( value: number ): string => {\n\t// Use formatNumber with percentage style, but convert from 0-100 range to 0-1 range\n\treturn formatNumber( value / 100, {\n\t\tnumberFormatOptions: {\n\t\t\tstyle: 'percent',\n\t\t\tminimumFractionDigits: 0,\n\t\t\tmaximumFractionDigits: 2,\n\t\t},\n\t} );\n};\n","import { getStringWidth } from '@visx/text';\nimport type { TickFormatter } from '@visx/axis';\nimport type { AnyD3Scale, ScaleInput } from '@visx/scale';\n\n/**\n * Returns the width of the longest tick.\n *\n * @param ticks - Ticks to get the width of.\n * @param formatTick - Function to format the tick.\n * @param {object} labelStyle - Style object for the label.\n * @return {number} - Width of the longest tick.\n */\nexport const getLongestTickWidth = < T extends AnyD3Scale >(\n\tticks: ScaleInput< T >[],\n\tformatTick: TickFormatter< ScaleInput< T > >,\n\tlabelStyle?: object\n) => {\n\tconst formattedTicks = ticks.map( tick => formatTick( tick, 0, [] ) );\n\tconst longestTick = formattedTicks.reduce(\n\t\t( longest, current ) => ( longest.length >= current.length ? longest : current ),\n\t\tformattedTicks[ 0 ]\n\t);\n\n\treturn getStringWidth( longestTick, labelStyle );\n};\n","import type { BarStyles, ChartTheme, LegendShape, SeriesData } from '../types';\nimport type { LineStyles } from '@visx/xychart';\n\n/**\n * Utility function to get consolidated line styles for a series\n * This consolidates the logic used by both LineChart and Legend components\n *\n * @param {SeriesData} seriesData - The series data containing styling options\n * @param {number} index - The index of the series in the data array\n * @param {ChartTheme} providerTheme - The chart theme configuration\n * @return {LineStyles} The consolidated line styles for the series\n */\nexport function getSeriesLineStyles(\n\tseriesData: SeriesData,\n\tindex: number,\n\tproviderTheme: ChartTheme\n): LineStyles {\n\t// Get theme-based line styles for line type\n\tconst themeSemanticLineStyle = providerTheme?.lineChart?.lineStyles?.[ seriesData.options?.type ];\n\n\t// Get theme-based line styles for index of series data\n\tconst themeSeriesLineStyle =\n\t\tproviderTheme?.seriesLineStyles?.[ index % providerTheme.seriesLineStyles.length ];\n\n\t// Priority order: custom series style > theme line type style > default theme series style\n\treturn (\n\t\tseriesData.options?.seriesLineStyle ?? themeSemanticLineStyle ?? themeSeriesLineStyle ?? {}\n\t);\n}\n\n/**\n * Utility to get consolidated bar styles for a series by semantic type.\n * Mirrors getSeriesLineStyles: a series with `options.type` (e.g. 'comparison')\n * resolves to `theme.barChart.barStyles[ type ]`.\n *\n * @param {SeriesData} seriesData - The series data containing styling options\n * @param {number} index - The index of the series in the data array\n * @param {ChartTheme} providerTheme - The chart theme configuration\n * @return {BarStyles} The consolidated bar styles for the series\n */\nexport function getSeriesBarStyles(\n\tseriesData: SeriesData,\n\tindex: number,\n\tproviderTheme: ChartTheme\n): BarStyles {\n\tconst type = seriesData.options?.type;\n\treturn ( type && providerTheme?.barChart?.barStyles?.[ type ] ) ?? {};\n}\n\n/**\n * Utility function to get stroke color for a series\n *\n * @param {SeriesData} seriesData - The series data containing styling options\n * @param {number} index - The index of the series in the data array\n * @param {string[]} themeColors - Array of theme colors\n * @return {string} The stroke color for the series\n */\nexport function getSeriesStroke(\n\tseriesData: SeriesData,\n\tindex: number,\n\tthemeColors: string[]\n): string {\n\treturn seriesData.options?.stroke ?? themeColors[ index % themeColors.length ];\n}\n\n/**\n * Utility function to get shape styles for a legend item\n *\n * @param {SeriesData} series - The series data containing styling options\n * @param {number} index - The index of the series in the data array\n * @param {ChartTheme} theme - The chart theme configuration\n * @param {LegendShape} legendShape - The shape to use for the item (optional)\n * @return {Record< string, unknown >} The shape styles for the item\n */\nexport function getItemShapeStyles(\n\tseries: SeriesData,\n\tindex: number,\n\ttheme: ChartTheme,\n\tlegendShape?: LegendShape< SeriesData[], number >\n): Record< string, unknown > {\n\tconst seriesShapeStyles = series.options?.legendShapeStyle ?? {};\n\tconst lineStyles = legendShape === 'line' ? getSeriesLineStyles( series, index, theme ) : {};\n\t// For non-line legends (e.g. bar 'rect'), reflect the comparison bar's opacity on the\n\t// swatch so the legend marker matches the translucent comparison bar. Line-type legends\n\t// convey comparison via the dashed stroke (lineStyles) instead.\n\tconst barOpacity =\n\t\tlegendShape !== 'line' ? getSeriesBarStyles( series, index, theme ).opacity : undefined;\n\tconst barShapeStyles = barOpacity !== undefined ? { opacity: barOpacity } : {};\n\tconst themeShapeStyles = theme.legend?.shapeStyles?.[ index ];\n\n\t// Series-level styles (custom shape style + line styles) take precedence; otherwise fall\n\t// back to the per-index theme shape styles.\n\tconst explicitStyles = {\n\t\t...seriesShapeStyles,\n\t\t...lineStyles,\n\t};\n\tconst hasExplicitStyles = Object.values( explicitStyles ).some(\n\t\tvalue => value !== undefined && value !== null && value !== ''\n\t);\n\tconst baseShapeStyles = hasExplicitStyles ? explicitStyles : themeShapeStyles ?? {};\n\n\t// Layer the comparison bar opacity on top so the swatch matches the translucent bar\n\t// without discarding the base (custom or theme) shape styles.\n\treturn { ...baseShapeStyles, ...barShapeStyles };\n}\n","export const isSafari = () => {\n\tif ( typeof navigator !== 'undefined' && navigator.userAgent ) {\n\t\treturn /^((?!chrome|android).)*safari/i.test( navigator.userAgent );\n\t}\n\treturn false;\n};\n","import deepmerge from 'deepmerge';\nimport type { ChartTheme, CompleteChartTheme } from '../types';\n\n/**\n * Merges chart themes with proper precedence.\n * The second theme (override) takes precedence over the first theme (base).\n *\n * @param baseTheme - Base theme object\n * @param overrideTheme - Theme to override base with (takes precedence)\n * @return Merged theme with overrideTheme values taking precedence\n */\nexport function mergeThemes(\n\tbaseTheme: CompleteChartTheme,\n\toverrideTheme: Partial< ChartTheme >\n): CompleteChartTheme;\nexport function mergeThemes(\n\tbaseTheme: ChartTheme,\n\toverrideTheme: Partial< ChartTheme >\n): ChartTheme;\nexport function mergeThemes(\n\tbaseTheme: ChartTheme,\n\toverrideTheme: Partial< ChartTheme >\n): ChartTheme {\n\t// Use deepmerge to properly merge nested objects, with overrideTheme taking precedence\n\treturn deepmerge( baseTheme, overrideTheme, {\n\t\t// Ensure arrays are replaced rather than concatenated\n\t\tarrayMerge: ( _destinationArray, sourceArray ) => sourceArray,\n\t} ) as ChartTheme;\n}\n","import { color as d3Color, hsl as d3Hsl } from '@visx/vendor/d3-color';\n\n/**\n * Check if a value is a valid 6-digit hex color\n * @param hex - The value to check\n * @return true if valid hex color format (e.g., '#ff0000')\n */\nexport const isValidHexColor = ( hex: unknown ): hex is string => {\n\treturn typeof hex === 'string' && /^#[0-9a-fA-F]{6}$/.test( hex );\n};\n\n/**\n * Validate hex color format, throwing descriptive errors if invalid\n * @param hex - The hex color string to validate\n * @throws {Error} if hex string is malformed\n */\nexport const validateHexColor = ( hex: unknown ): void => {\n\tif ( isValidHexColor( hex ) ) {\n\t\treturn;\n\t}\n\n\t// Provide specific error messages for common issues\n\tif ( typeof hex !== 'string' ) {\n\t\tthrow new Error( 'Hex color must be a string' );\n\t}\n\tif ( ! hex.startsWith( '#' ) ) {\n\t\tthrow new Error( 'Hex color must start with #' );\n\t}\n\tif ( hex.length !== 7 ) {\n\t\tthrow new Error( 'Hex color must be 7 characters long (e.g., #ff0000)' );\n\t}\n\tthrow new Error( 'Hex color contains invalid characters. Only 0-9, a-f, A-F are allowed' );\n};\n\n/**\n * Convert hex color to rgba with specified opacity.\n * This is genuinely reusable across chart components.\n * @param hex - The hex color string (e.g., '#ff0000')\n * @param alpha - The opacity value. Values outside the [0, 1] range will be clamped by the underlying d3 color library.\n * @return The rgba color string (e.g., 'rgba(255, 0, 0, 0.5)')\n * @throws {Error} if hex string is malformed or alpha is not a valid number\n */\nexport const hexToRgba = ( hex: string, alpha: number ): string => {\n\tvalidateHexColor( hex );\n\n\tif ( typeof alpha !== 'number' || isNaN( alpha ) ) {\n\t\tthrow new Error( 'Alpha must be a number' );\n\t}\n\n\t// Safe to use non-null assertion since validateHexColor ensures valid hex\n\treturn d3Color( hex )!.copy( { opacity: alpha } ).formatRgb();\n};\n\n/**\n * Calculate the perceptual distance between two HSL colors\n * @param hsl1 - first color in HSL format [h, s, l]\n * @param hsl2 - second color in HSL format [h, s, l]\n * @return distance value (0-100+, lower means more similar)\n */\nexport const getColorDistance = (\n\thsl1: [ number, number, number ],\n\thsl2: [ number, number, number ]\n): number => {\n\tconst [ h1, s1, l1 ] = hsl1;\n\tconst [ h2, s2, l2 ] = hsl2;\n\n\t// Calculate hue difference, accounting for circular nature (0° = 360°)\n\tlet hueDiff = Math.abs( h1 - h2 );\n\thueDiff = Math.min( hueDiff, 360 - hueDiff );\n\n\t// Weight the differences: hue is most important, then lightness, then saturation\n\tconst hueWeight = 2;\n\tconst lightnessWeight = 1;\n\tconst saturationWeight = 0.5;\n\n\treturn Math.sqrt(\n\t\tMath.pow( hueDiff * hueWeight, 2 ) +\n\t\t\tMath.pow( ( l1 - l2 ) * lightnessWeight, 2 ) +\n\t\t\tMath.pow( ( s1 - s2 ) * saturationWeight, 2 )\n\t);\n};\n\n/**\n * Parse an HSL string like 'hsl(120, 50%, 50%)' into an HSL tuple.\n *\n * @param hslString - HSL color string\n * @return HSL tuple [h, s, l] or null if invalid\n */\nexport const parseHslString = ( hslString: string ): [ number, number, number ] | null => {\n\tconst lower = hslString.toLowerCase().trim();\n\n\t// Check prefix - d3-color handles the parsing\n\tif ( ! lower.startsWith( 'hsl(' ) ) {\n\t\treturn null;\n\t}\n\n\tconst parsed = d3Hsl( lower );\n\n\t// d3Hsl returns NaN values for invalid colors\n\tif ( isNaN( parsed.h ) && isNaN( parsed.s ) && isNaN( parsed.l ) ) {\n\t\treturn null;\n\t}\n\n\t// Normalize hue to 0-360 range (d3 may return NaN for achromatic colors)\n\tconst h = isNaN( parsed.h ) ? 0 : ( ( parsed.h % 360 ) + 360 ) % 360;\n\n\t// d3-color uses 0-1 scale, convert to 0-100\n\treturn [ h, parsed.s * 100, parsed.l * 100 ];\n};\n\n/**\n * Parse an RGB string like 'rgb(255, 0, 0)' into a hex color.\n *\n * @deprecated Use normalizeColorToHex() instead, which handles all color formats including rgb() and rgba().\n * @param rgbString - RGB color string (not RGBA)\n * @return hex color string or null if invalid\n */\nexport const parseRgbString = ( rgbString: string ): string | null => {\n\tconst lower = rgbString.toLowerCase().trim();\n\n\t// Check prefix - only handle rgb(), not rgba()\n\t// This is intentional - use normalizeColorToHex for rgba() support\n\tif ( ! lower.startsWith( 'rgb(' ) || lower.startsWith( 'rgba(' ) ) {\n\t\treturn null;\n\t}\n\n\tconst parsed = d3Color( lower );\n\n\t// d3Color returns null for invalid colors\n\tif ( ! parsed ) {\n\t\treturn null;\n\t}\n\n\t// d3-color clamps values automatically\n\treturn parsed.formatHex();\n};\n\n/**\n * Normalize any CSS color value to a hex color string.\n * Handles hex, HSL, HSLA, RGB, RGBA, named CSS colors, and CSS variables.\n *\n * @param color - Any CSS color value\n * @param element - Optional DOM element for resolving CSS variables\n * @param resolveCss - Function to resolve CSS variables (injected for testability)\n * @param _depth - Internal recursion depth counter to prevent infinite loops\n * @return hex color string, or the original value if conversion fails\n */\nexport const normalizeColorToHex = (\n\tcolor: string,\n\telement?: HTMLElement | null,\n\tresolveCss?: ( value: string, el?: HTMLElement | null ) => string | null,\n\t_depth = 0\n): string => {\n\tif ( ! color || typeof color !== 'string' ) {\n\t\treturn '';\n\t}\n\n\t// Already a valid hex color (6-digit format)\n\tif ( /^#[0-9a-fA-F]{6}$/.test( color ) ) {\n\t\treturn color;\n\t}\n\n\tconst trimmed = color.trim().toLowerCase();\n\n\t// Handle 3-digit hex colors - expand to 6-digit\n\tif ( /^#[0-9a-f]{3}$/i.test( trimmed ) ) {\n\t\tconst r = trimmed[ 1 ];\n\t\tconst g = trimmed[ 2 ];\n\t\tconst b = trimmed[ 3 ];\n\t\treturn `#${ r }${ r }${ g }${ g }${ b }${ b }`;\n\t}\n\n\t// Handle CSS variables - must be resolved before d3-color can parse\n\tif ( trimmed.startsWith( '--' ) || trimmed.startsWith( 'var(' ) ) {\n\t\tif ( resolveCss ) {\n\t\t\tconst resolved = resolveCss( color, element );\n\t\t\tif ( resolved && resolved !== color && _depth < 10 ) {\n\t\t\t\t// Recursively normalize the resolved value\n\t\t\t\treturn normalizeColorToHex( resolved, element, resolveCss, _depth + 1 );\n\t\t\t}\n\t\t}\n\t\t// Can't resolve CSS variable, return original\n\t\treturn color;\n\t}\n\n\t// Handle HSL, HSLA, RGB, and RGBA strings using d3-color\n\tif (\n\t\ttrimmed.startsWith( 'hsl(' ) ||\n\t\ttrimmed.startsWith( 'hsla(' ) ||\n\t\ttrimmed.startsWith( 'rgb(' ) ||\n\t\ttrimmed.startsWith( 'rgba(' )\n\t) {\n\t\tconst parsed = d3Color( trimmed );\n\t\tif ( parsed ) {\n\t\t\treturn parsed.formatHex();\n\t\t}\n\t\treturn color;\n\t}\n\n\t// Attempt d3-color for any remaining format (e.g. named CSS colors like \"steelblue\")\n\tconst parsed = d3Color( trimmed );\n\tif ( parsed ) {\n\t\treturn parsed.formatHex();\n\t}\n\n\t// Unknown format, return as-is\n\treturn color;\n};\n\n/**\n * Lighten a hex color by blending it with white.\n * Useful for creating color gradients or lighter variants.\n *\n * @param hex - Hex color string (e.g., '#98C8DF')\n * @param blend - Blend amount with white (0 = original color, 1 = white)\n * @return Lightened hex color string (e.g., '#cce4ef')\n * @throws {Error} if hex string is malformed\n */\nexport const lightenHexColor = ( hex: string, blend: number ): string => {\n\tvalidateHexColor( hex );\n\n\tconst r = parseInt( hex.slice( 1, 3 ), 16 );\n\tconst g = parseInt( hex.slice( 3, 5 ), 16 );\n\tconst b = parseInt( hex.slice( 5, 7 ), 16 );\n\n\t// Blend with white (255, 255, 255)\n\tconst newR = Math.round( r + ( 255 - r ) * blend );\n\tconst newG = Math.round( g + ( 255 - g ) * blend );\n\tconst newB = Math.round( b + ( 255 - b ) * blend );\n\n\treturn `#${ newR.toString( 16 ).padStart( 2, '0' ) }${ newG\n\t\t.toString( 16 )\n\t\t.padStart( 2, '0' ) }${ newB.toString( 16 ).padStart( 2, '0' ) }`;\n};\n\n/**\n * Blend one hex color toward another, per-channel in sRGB.\n *\n * @param fromHex - Starting hex color, returned when blend is 0\n * @param toHex - Target hex color, returned when blend is 1\n * @param blend - Amount toward toHex, clamped to [0, 1]\n * @return Blended hex color string\n * @throws {Error} if either hex string is malformed\n */\nexport const mixHexColors = ( fromHex: string, toHex: string, blend: number ): string => {\n\tvalidateHexColor( fromHex );\n\tvalidateHexColor( toHex );\n\n\tconst amount = Math.min( 1, Math.max( 0, blend ) );\n\tconst channel = ( start: number, end: number ): string =>\n\t\tMath.round( start + ( end - start ) * amount )\n\t\t\t.toString( 16 )\n\t\t\t.padStart( 2, '0' );\n\n\treturn `#${ channel(\n\t\tparseInt( fromHex.slice( 1, 3 ), 16 ),\n\t\tparseInt( toHex.slice( 1, 3 ), 16 )\n\t) }${ channel(\n\t\tparseInt( fromHex.slice( 3, 5 ), 16 ),\n\t\tparseInt( toHex.slice( 3, 5 ), 16 )\n\t) }${ channel( parseInt( fromHex.slice( 5, 7 ), 16 ), parseInt( toHex.slice( 5, 7 ), 16 ) ) }`;\n};\n\n/**\n * WCAG relative luminance of a hex color (0 = black, 1 = white).\n *\n * @param hex - Hex color string (e.g., '#98C8DF')\n * @return Relative luminance in the range [0, 1]\n * @throws {Error} if hex string is malformed\n */\nexport const relativeLuminance = ( hex: string ): number => {\n\tvalidateHexColor( hex );\n\n\tconst toLinear = ( value: number ): number => {\n\t\tconst channel = value / 255;\n\t\treturn channel <= 0.03928 ? channel / 12.92 : Math.pow( ( channel + 0.055 ) / 1.055, 2.4 );\n\t};\n\n\tconst r = toLinear( parseInt( hex.slice( 1, 3 ), 16 ) );\n\tconst g = toLinear( parseInt( hex.slice( 3, 5 ), 16 ) );\n\tconst b = toLinear( parseInt( hex.slice( 5, 7 ), 16 ) );\n\n\treturn 0.2126 * r + 0.7152 * g + 0.0722 * b;\n};\n\n/**\n * Whether light text reads better than dark text on the given background, using the W3C\n * luminance threshold (0.179) that maximizes contrast against black vs white.\n *\n * @param backgroundHex - Hex background color\n * @return true if light text should be used; false (dark text) for malformed colors\n */\nexport const prefersLightText = ( backgroundHex: string ): boolean => {\n\tif ( ! isValidHexColor( backgroundHex ) ) {\n\t\treturn false;\n\t}\n\treturn relativeLuminance( backgroundHex ) <= 0.179;\n};\n","/**\n * Pattern for valid CSS custom property names (e.g., '--my-color', '--jp-gray-10')\n */\nconst CSS_VAR_NAME_PATTERN = /^--[\\w-]+$/;\n\n/**\n * Resolves a CSS custom property (variable) to its computed value.\n * Handles multiple formats:\n * - Plain variable names: '--my-color'\n * - CSS var() syntax: 'var(--my-color)'\n * - CSS var() with fallback: 'var(--my-color, #ffffff)'\n * - Regular values (returned as-is): '#ffffff', 'red'\n *\n * @param value - A CSS variable name, var() expression, or regular value\n * @param element - Optional DOM element to resolve the variable from (defaults to document.documentElement)\n * @return The resolved value, fallback value, or null if unresolvable\n */\nexport const resolveCssVariable = ( value: string, element?: HTMLElement | null ): string | null =>\n\tcreateCssVariableResolver( element )( value );\n\n/**\n * Builds a resolver that reads every value from one `getComputedStyle` snapshot.\n *\n * `getComputedStyle` is the expensive half of resolving a token: each call can force the browser to flush pending style, and a chart theme resolves five roles at once. Taking the snapshot once per build turns that into a single query. The reads that share a snapshot happen synchronously inside one memo body, so no style change can land between them — the resolver is single-pass by design and is not meant to be held across renders.\n *\n * @param element - The element to resolve against, or null/undefined for the document root.\n * @return A resolver that resolves each value exactly as `resolveCssVariable` does.\n */\nexport function createCssVariableResolver(\n\telement?: HTMLElement | null\n): ( value: string ) => string | null {\n\tlet styles: CSSStyleDeclaration | null = null;\n\n\t// Deferred so a resolver for a theme that turns out to hold only literals costs nothing. Only a successful read is kept: caching the null would leave a resolver built before its element is in the document dead for the rest of its life.\n\tconst getStyles = () => {\n\t\tif ( ! styles ) {\n\t\t\tstyles = computedStyleFor( element );\n\t\t}\n\n\t\treturn styles;\n\t};\n\n\treturn ( value: string ): string | null => {\n\t\tif ( ! value ) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// Check if it's a var() expression: var(--name) or var(--name, fallback)\n\t\t// Parse manually to avoid regex backtracking vulnerabilities\n\t\tif ( value.startsWith( 'var(' ) && value.endsWith( ')' ) ) {\n\t\t\tconst parsed = parseVarExpression( value );\n\n\t\t\tif ( parsed ) {\n\t\t\t\tconst resolved = readCustomProperty( parsed.varName, getStyles() );\n\n\t\t\t\treturn resolved || parsed.fallback;\n\t\t\t}\n\t\t}\n\n\t\t// Check if it's a plain variable name (starts with --)\n\t\tif ( value.startsWith( '--' ) ) {\n\t\t\treturn readCustomProperty( value, getStyles() );\n\t\t}\n\n\t\t// Return regular values as-is (e.g., '#ffffff', 'red')\n\t\treturn value;\n\t};\n}\n\n/**\n * Parses a var() expression into its variable name and optional fallback.\n * Uses string manipulation instead of complex regex to avoid ReDoS.\n *\n * @param expr - A var() expression like 'var(--name)' or 'var(--name, fallback)'\n * @return Parsed result or null if invalid\n */\nfunction parseVarExpression( expr: string ): { varName: string; fallback: string | null } | null {\n\t// Remove 'var(' prefix and ')' suffix\n\tconst inner = expr.slice( 4, -1 ).trim();\n\n\tif ( ! inner.startsWith( '--' ) ) {\n\t\treturn null;\n\t}\n\n\t// Find the comma separator (if any)\n\tconst commaIndex = inner.indexOf( ',' );\n\n\tif ( commaIndex === -1 ) {\n\t\t// No fallback: var(--name)\n\t\tconst varName = inner.trim();\n\t\t// Validate variable name format\n\t\tif ( ! CSS_VAR_NAME_PATTERN.test( varName ) ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn { varName, fallback: null };\n\t}\n\n\t// Has fallback: var(--name, fallback)\n\tconst varName = inner.slice( 0, commaIndex ).trim();\n\n\t// Validate variable name format\n\tif ( ! CSS_VAR_NAME_PATTERN.test( varName ) ) {\n\t\treturn null;\n\t}\n\n\tconst fallback = inner.slice( commaIndex + 1 ).trim();\n\n\treturn { varName, fallback: fallback || null };\n}\n\n/**\n * Takes one computed-style snapshot, or null where there is nothing to read (SSR, or a detached element).\n *\n * @param element - The element to read from, or null/undefined for the document root.\n * @return The computed styles, or null.\n */\nfunction computedStyleFor( element?: HTMLElement | null ): CSSStyleDeclaration | null {\n\tif ( typeof window === 'undefined' || typeof document === 'undefined' ) {\n\t\treturn null;\n\t}\n\n\ttry {\n\t\treturn getComputedStyle( element || document.documentElement );\n\t} catch {\n\t\t// getComputedStyle throws on a detached element.\n\t\treturn null;\n\t}\n}\n\n/**\n * Reads one custom property from a computed-style snapshot.\n *\n * @param varName - A CSS variable name like '--my-color'\n * @param styles - The snapshot to read from, or null\n * @return The computed value or null\n */\nfunction readCustomProperty( varName: string, styles: CSSStyleDeclaration | null ): string | null {\n\tif ( ! styles ) {\n\t\treturn null;\n\t}\n\n\ttry {\n\t\tconst computedValue = styles.getPropertyValue( varName ).trim();\n\n\t\treturn computedValue || null;\n\t} catch {\n\t\t// Belt and braces — no engine is known to throw here. Kept because a caller may hand in a stand-in for CSSStyleDeclaration; `resolve-css-var.test.ts` covers exactly that.\n\t\treturn null;\n\t}\n}\n","/**\n * Resolve a theme `fontSize` value into a plain number suitable for\n * canvas-based measurement (e.g. `getStringWidth`).\n *\n * Accepts:\n * - A number — returned as-is\n * - A pixel string like `\"12px\"` — parsed and returned as a number\n *\n * Returns `undefined` for any other input (missing value, NaN, or\n * relative units like `rem`/`em`/`%`/`vh`) so callers can fall back to\n * their own default. Relative units are intentionally rejected because\n * we cannot resolve them to absolute pixels here without a parent\n * computed style, and silently returning the unitless prefix\n * (`parseFloat(\"0.875rem\") === 0.875`) would produce nearly-zero\n * widths in measurement code.\n * @param val - Raw font size value from a theme, axis style, or props\n * @return Parsed numeric font size in pixels, or `undefined` when unresolvable\n */\nexport const resolveFontSize = ( val?: number | string ): number | undefined => {\n\tif ( typeof val === 'number' ) {\n\t\treturn isNaN( val ) ? undefined : val;\n\t}\n\n\tif ( typeof val === 'string' ) {\n\t\t// Only accept plain numeric strings or pixel values.\n\t\t// Reject rem, em, %, vh, vw, etc. — they cannot be resolved to\n\t\t// absolute pixels without a computed style context.\n\t\tconst match = val.trim().match( /^(-?\\d+\\.?\\d*|-?\\.\\d+)(px)?$/ );\n\t\tif ( ! match ) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst parsed = parseFloat( match[ 1 ] );\n\t\treturn isNaN( parsed ) ? undefined : parsed;\n\t}\n\n\treturn undefined;\n};\n","import { createContext } from 'react';\n\n/**\n * The nearest chart element, published so JS token resolution reads the same CSS cascade that paints the chart's own colours.\n *\n * All JS token resolution reads this element rather than `document.documentElement`, so a `getComputedStyle` call sees the same `--a8c-charts-*` values — including any override set inside the provider tree — that a CSS-painted sibling element does.\n */\nexport const ChartScopeContext = createContext< HTMLElement | null >( null );\n","import { hsl as d3Hsl } from '@visx/vendor/d3-color';\nimport { getColorDistance } from '../../../utils';\n\nexport interface ColorCache {\n\tcolors: string[];\n\thues: number[];\n\texistingHslColors: Array< [ number, number, number ] >;\n\tminHue: number;\n\tmaxHue: number;\n}\n\n/**\n * Golden ratio for mathematically pleasing color distribution\n * Used to generate evenly spaced hues that are visually distinct\n */\nconst GOLDEN_RATIO = 0.618033988749;\n\n/**\n * Minimum perceptual distance between colors to ensure visual distinction\n * Based on weighted HSL distance calculation optimized for chart readability\n */\nconst MIN_COLOR_DISTANCE = 25;\n\n/**\n * Maximum attempts to find a sufficiently different color\n * Prevents infinite loops while allowing reasonable search space\n */\nconst MAX_COLOR_GENERATION_ATTEMPTS = 50;\n\n/**\n * Color variation attempt offset\n * Small increment to explore slightly different color variations per attempt\n */\nconst VARIATION_ATTEMPT_OFFSET = 0.1;\n\n// Saturation configuration for generated colors\n\n/**\n * Base saturation percentage for generated colors\n * 45% provides muted, professional colors without being washed out\n */\nconst BASE_SATURATION = 45;\n\n/**\n * Number of saturation variation steps\n * Creates 3 different saturation levels for variety\n */\nconst SATURATION_VARIATION_STEPS = 3;\n\n/**\n * Saturation increment per variation step\n * 10% increments provide subtle variation while keeping colors muted\n * Results in saturation levels: 45%, 55%, 65%\n */\nconst SATURATION_INCREMENT = 10;\n\n// Lightness configuration for WCAG AA accessibility compliance\n\n/**\n * Base lightness percentage for generated colors\n * 35% ensures sufficient contrast against white backgrounds for WCAG AA compliance\n * WCAG AA requires 4.5:1 contrast ratio for normal text\n */\nconst BASE_LIGHTNESS = 35;\n\n/**\n * Number of lightness variation steps\n * Creates 4 different lightness levels for variety\n */\nconst LIGHTNESS_VARIATION_STEPS = 4;\n\n/**\n * Lightness increment per variation step\n * 8% increments provide subtle lightness variation while maintaining accessibility\n * Results in lightness levels: 35%, 43%, 51%, 59%\n * All levels maintain WCAG AA compliance against white backgrounds\n */\nconst LIGHTNESS_INCREMENT = 8;\n\n// Hue range expansion and constraints\n\n/**\n * Minimum hue range in degrees to ensure sufficient color variety\n * 60 degrees provides reasonable color spread even for narrow palettes\n */\nconst MIN_HUE_RANGE_DEGREES = 60;\n\n/**\n * Hue range expansion factor\n * 1.3x expansion provides slightly more variety than the original palette\n */\nconst HUE_RANGE_EXPANSION_FACTOR = 1.3;\n\n/**\n * Threshold for detecting hue wrap-around (color wheel boundary crossing)\n * 180 degrees indicates the colors span more than half the color wheel\n */\nconst HUE_WRAP_THRESHOLD_DEGREES = 180;\n\n/**\n * Full color wheel rotation in degrees\n */\nconst FULL_HUE_ROTATION_DEGREES = 360;\n\n/**\n * Factor for single color hue range\n */\nconst SINGLE_COLOR_HUE_RANGE_FACTOR = 0.33;\n\n/**\n * Get a color from the colors array or generate a new color using the golden ratio\n *\n * @param index - the index of the color to get\n * @param colorCache - pre-computed color data for performance\n * @return a color from the colors array or a new color using the golden ratio\n */\nexport const getChartColor = ( index: number, colorCache: ColorCache ): string => {\n\tconst {\n\t\tcolors,\n\t\thues,\n\t\texistingHslColors,\n\t\tminHue: cachedMinHue,\n\t\tmaxHue: cachedMaxHue,\n\t} = colorCache;\n\n\tif ( index < colors.length ) {\n\t\treturn colors[ index ];\n\t}\n\n\tlet minHue = cachedMinHue;\n\tlet maxHue = cachedMaxHue;\n\n\t// Generate additional colors using golden ratio, avoiding similar colors\n\tfor ( let attempt = 0; attempt < MAX_COLOR_GENERATION_ATTEMPTS; attempt++ ) {\n\t\t// Calculate hue using golden ratio distribution with variation per attempt\n\t\t// Formula: ((base_index + attempt_variation) * golden_ratio * 360°) mod 360°\n\t\t// This ensures mathematically pleasing spacing while allowing slight shifts per attempt\n\t\tlet hue =\n\t\t\t( ( index - colors.length + attempt * VARIATION_ATTEMPT_OFFSET ) *\n\t\t\t\tGOLDEN_RATIO *\n\t\t\t\tFULL_HUE_ROTATION_DEGREES ) %\n\t\t\tFULL_HUE_ROTATION_DEGREES;\n\n\t\t// If we have existing colors, constrain new colors to their hue range\n\t\tif ( hues.length > 0 ) {\n\t\t\t// Handle hue wrap-around (e.g., if colors span across 0 degrees)\n\t\t\tlet hueRange = maxHue - minHue;\n\n\t\t\t// If there's only one color, use a set hue range for limited variety\n\t\t\tif ( hues.length === 1 ) {\n\t\t\t\thueRange = FULL_HUE_ROTATION_DEGREES * SINGLE_COLOR_HUE_RANGE_FACTOR;\n\t\t\t} else if ( hueRange > HUE_WRAP_THRESHOLD_DEGREES ) {\n\t\t\t\t// If the range is very large, it might be wrapping around the color wheel\n\t\t\t\t// Check if a smaller range exists when considering wrap-around\n\t\t\t\tconst altMinHue = Math.min( ...hues.filter( h => h > HUE_WRAP_THRESHOLD_DEGREES ) );\n\t\t\t\tconst altMaxHue =\n\t\t\t\t\tMath.max( ...hues.filter( h => h < HUE_WRAP_THRESHOLD_DEGREES ) ) +\n\t\t\t\t\tFULL_HUE_ROTATION_DEGREES;\n\t\t\t\tconst altRange = altMaxHue - altMinHue;\n\n\t\t\t\tif ( altRange < hueRange ) {\n\t\t\t\t\tminHue = altMinHue;\n\t\t\t\t\tmaxHue = altMaxHue;\n\t\t\t\t\thueRange = altRange;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Expand the range slightly to provide some variation\n\t\t\tconst expandedRange = Math.max(\n\t\t\t\thueRange * HUE_RANGE_EXPANSION_FACTOR,\n\t\t\t\tMIN_HUE_RANGE_DEGREES\n\t\t\t);\n\t\t\tconst rangeCenter = ( minHue + maxHue ) / 2;\n\t\t\tconst expandedMin = rangeCenter - expandedRange / 2;\n\n\t\t\t// Map the generated hue to the expanded range\n\t\t\thue = expandedMin + ( hue / FULL_HUE_ROTATION_DEGREES ) * expandedRange;\n\n\t\t\t// Normalize to 0-360 range\n\t\t\thue =\n\t\t\t\t( ( hue % FULL_HUE_ROTATION_DEGREES ) + FULL_HUE_ROTATION_DEGREES ) %\n\t\t\t\tFULL_HUE_ROTATION_DEGREES;\n\t\t}\n\n\t\tconst saturation =\n\t\t\tBASE_SATURATION + ( ( index + attempt ) % SATURATION_VARIATION_STEPS ) * SATURATION_INCREMENT;\n\t\tconst lightness =\n\t\t\tBASE_LIGHTNESS + ( ( index + attempt ) % LIGHTNESS_VARIATION_STEPS ) * LIGHTNESS_INCREMENT;\n\n\t\tconst candidateHsl: [ number, number, number ] = [ hue, saturation, lightness ];\n\n\t\t// Check if this color is sufficiently different from existing colors\n\t\tlet isSufficientlyDifferent = true;\n\t\tfor ( const existingHsl of existingHslColors ) {\n\t\t\tif ( getColorDistance( candidateHsl, existingHsl ) < MIN_COLOR_DISTANCE ) {\n\t\t\t\tisSufficientlyDifferent = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif ( isSufficientlyDifferent ) {\n\t\t\t// d3-color uses 0-1 scale for saturation and lightness\n\t\t\treturn d3Hsl( Math.round( hue ), saturation / 100, lightness / 100 ).formatHex();\n\t\t}\n\t}\n\n\t// Fallback if we couldn't find a sufficiently different color\n\t// Formula: ((base_index) * golden_ratio * 360°) mod 360°\n\t// This ensures mathematically pleasing spacing while maintaining consistency\n\tconst fallbackHue =\n\t\t( ( index - colors.length ) * GOLDEN_RATIO * FULL_HUE_ROTATION_DEGREES ) %\n\t\tFULL_HUE_ROTATION_DEGREES;\n\tconst fallbackSaturation =\n\t\tBASE_SATURATION + ( index % SATURATION_VARIATION_STEPS ) * SATURATION_INCREMENT;\n\tconst fallbackLightness =\n\t\tBASE_LIGHTNESS + ( index % LIGHTNESS_VARIATION_STEPS ) * LIGHTNESS_INCREMENT;\n\t// d3-color uses 0-1 scale for saturation and lightness\n\treturn d3Hsl(\n\t\tMath.round( fallbackHue ),\n\t\tfallbackSaturation / 100,\n\t\tfallbackLightness / 100\n\t).formatHex();\n};\n","import type { ChartTheme } from '../../../types';\n\n// The consumer theme fields that correspond to an emitted catalog role, and the role each one overrides. Each role must be read by exactly the elements its field controlled before the role existed: `svgLabelSmall.fill` maps to the narrow `--a8c-charts-color-label-axis` rather than `--a8c-charts-color-label`, because the broad role is also read by legend labels, heatmap cell values, funnel labels and the line-chart tooltip, which that field never moved.\nconst ROLE_FOR_FIELD: Array< [ string, ( theme: Partial< ChartTheme > ) => string | undefined ] > =\n\t[\n\t\t[ '--a8c-charts-color-background', theme => theme.backgroundColor ],\n\t\t[ '--a8c-charts-color-grid', theme => theme.gridStyles?.stroke ],\n\t\t[ '--a8c-charts-color-axis', theme => theme.xAxisLineStyles?.stroke ],\n\t\t[ '--a8c-charts-color-tick', theme => theme.xTickLineStyles?.stroke ],\n\t\t[ '--a8c-charts-color-label-axis', theme => theme.svgLabelSmall?.fill ],\n\t];\n\n/**\n * The variable a `theme` prop override is published as, one layer outside the role itself.\n *\n * `chart-scope.scss` declares each of these roles as `var(<role>-theme, <catalog default>)`, so an override that is invalid at computed-value time — a fallback-less `var()` naming a token the host never set — only invalidates this variable, and the role still resolves its mapped `--wpds-*` token. Published as the role directly, such a value took the role and every bare `var(<role>)` read site down with it.\n *\n * @param role - The catalog role being overridden.\n * @return The custom property carrying the consumer's value.\n */\nexport const themeLayerVar = ( role: string ): string => `${ role }-theme`;\n\n/** Every role whose catalog entry must read a theme layer. `src/styles/test/chart-scope.test.ts` checks the stylesheet against this. */\nexport const THEME_LAYERED_ROLES: readonly string[] = ROLE_FOR_FIELD.map( ( [ role ] ) => role );\n\n/**\n * Whether a value reads the role it is being published for, which would make the catalog entry depend on itself.\n *\n * The dependency runs `<role>: var(<role>-theme, …)`, so a value naming `<role>` closes a cycle through the catalog entry. CSS marks every custom property in a cycle invalid at computed-value time — the role's own fallback is *not* used, so the token resolves to nothing and every chart loses that colour. Verified in Chrome: `--role-theme: var(--role, blue); --role: var(--role-theme, green)` leaves `--role` empty, not `green`.\n *\n * Three things this has to get right, none of which a plain substring test gets:\n *\n * `var()` permits whitespace after the opening paren, so testing for `var(<role>` misses `var( --a8c-charts-color-grid, … )`.\n *\n * Several roles are prefixes of others (`--a8c-charts-color-label` of `--a8c-charts-color-label-secondary`), and every role is a prefix of its own theme layer. A prefix match would read a legitimate cross-role pointer as a self-reference and silently drop the override, so the role must be followed by something that cannot continue an identifier — `-` included. A value naming `<role>-theme` is therefore not treated as a self-reference: that cycle is confined to the theme layer, which leaves the role free to fall back to the catalog default.\n *\n * `resolveCssVariable` also accepts a bare custom-property name with no `var()` wrapper (`--a8c-charts-color-grid`), so that is legal `theme` input too. It forms no cycle — custom properties accept arbitrary token streams — so it survives as a literal string and drops silently at the use site instead of falling back to the catalog default.\n *\n * @param value - The consumer's value for the field.\n * @param role - The catalog role this value would override.\n * @return True when the value reads `role`, so it must not be published.\n */\nconst readsOwnRole = ( value: string, role: string ): boolean =>\n\tvalue.trim() === role ||\n\tnew RegExp( `var\\\\(\\\\s*${ role.replace( /[.*+?^${}()|[\\]\\\\]/g, '\\\\$&' ) }(?![\\\\w-])` ).test(\n\t\tvalue\n\t);\n\nexport type ThemeOverrides = {\n\t/** The custom properties to write on the provider wrapper. */\n\tvars: Record< string, string >;\n\t/** Every mapped role the consumer set a value for, whether or not it was published. */\n\troles: readonly string[];\n};\n\n/**\n * Maps a sparse consumer theme onto the theme-layer variables its overridden catalog roles read, so CSS-painted and JS-resolved colours read one source.\n *\n * A value that reads the role it would override is left unpublished — that is the default theme's own pointer surviving `mergeThemes`, and publishing it would invalidate the role. The role is still reported in `roles`: `withCatalogPointers` restores its theme field to the catalog pointer either way, so CSS and visx agree on the catalog default rather than visx painting a literal CSS never sees.\n *\n * @param theme - The consumer's `theme` prop, before merging with the default theme.\n * @return The wrapper's custom properties, and the roles the consumer overrode.\n */\nexport const themeOverrideVars = ( theme?: Partial< ChartTheme > ): ThemeOverrides => {\n\tif ( ! theme ) {\n\t\treturn { vars: {}, roles: [] };\n\t}\n\n\tconst vars: Record< string, string > = {};\n\tconst roles: string[] = [];\n\n\tfor ( const [ role, read ] of ROLE_FOR_FIELD ) {\n\t\tconst value = read( theme );\n\n\t\tif ( typeof value !== 'string' || value === '' ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\troles.push( role );\n\n\t\tif ( ! readsOwnRole( value, role ) ) {\n\t\t\tvars[ themeLayerVar( role ) ] = value;\n\t\t}\n\t}\n\n\treturn { vars, roles };\n};\n","import type { CompleteChartTheme } from '../../types';\n\n/**\n * Default theme configuration\n */\nconst defaultTheme: CompleteChartTheme = {\n\tbackgroundColor: 'var(--a8c-charts-color-background, #fff)',\n\tlabelBackgroundColor: 'transparent', // label background color (transparent by default)\n\t// White label text sits on top of arbitrary series colors, so it has no WPDS content-foreground equivalent. Every other colour here is a bare pointer at the catalog emitted by `chart-scope.scss`; the terminal literal is the last resort for the SSR and jsdom paths, where getComputedStyle resolves nothing.\n\tlabelTextColor: 'var(--a8c-charts-color-label-on-fill, #FFFFFF)',\n\tcolors: [ '#98C8DF', '#006DAB', '#A6DC80', '#1F9828', '#FF8C8F' ],\n\tgridStyles: {\n\t\tstroke: 'var(--a8c-charts-color-grid, #dbdbdb)',\n\t\tstrokeWidth: 1,\n\t},\n\ttickLength: 4,\n\tgridColor: '',\n\tgridColorDark: '',\n\txTickLineStyles: {\n\t\tstroke: 'var(--a8c-charts-color-tick, #dbdbdb)',\n\t\tstrokeWidth: 1,\n\t},\n\txAxisLineStyles: {\n\t\tstroke: 'var(--a8c-charts-color-axis, #dbdbdb)',\n\t\tstrokeWidth: 1,\n\t},\n\tlegend: {\n\t\tlabelStyles: {\n\t\t\tcolor: 'var(--a8c-charts-color-label, #1e1e1e)',\n\t\t},\n\t\tcontainerStyles: {},\n\t\tshapeStyles: [],\n\t},\n\tseriesLineStyles: [],\n\tglyphs: [],\n\t// `fontFamily: 'inherit'` overrides visx's hardcoded default font stack\n\t// (`-apple-system,BlinkMacSystemFont,Roboto,Helvetica Neue,sans-serif`)\n\t// that `buildChartTheme` injects as an inline style on SVG `<text>`\n\t// elements for axis labels and ticks. Setting `inherit` lets SVG text\n\t// pick up the host application's font-family via normal CSS inheritance.\n\tsvgLabelSmall: {\n\t\tfill: 'var(--a8c-charts-color-label-axis, #1e1e1e)',\n\t\tfontFamily: 'inherit',\n\t},\n\tsvgLabelBig: { fontFamily: 'inherit' },\n\tannotationStyles: {\n\t\tlabel: {\n\t\t\tanchorLineStroke: 'var(--a8c-charts-color-annotation, #1e1e1e)',\n\t\t\tbackgroundFill: 'var(--a8c-charts-color-surface, #fff)',\n\t\t},\n\t\tconnector: {\n\t\t\tstroke: 'var(--a8c-charts-color-annotation, #1e1e1e)',\n\t\t},\n\t\tcircleSubject: {\n\t\t\tstroke: 'transparent',\n\t\t\tfill: 'var(--a8c-charts-color-annotation, #1e1e1e)',\n\t\t\tradius: 5,\n\t\t},\n\t},\n\tgeoChart: {\n\t\tfeatureFillColor: 'var(--a8c-charts-color-surface-secondary, #f4f4f4)',\n\t},\n\tleaderboardChart: {\n\t\trowGap: 12,\n\t\tcolumnGap: 4,\n\t\tlabelSpacing: 'xs',\n\t\t// [negative, neutral, positive]\n\t\tdeltaColors: [\n\t\t\t'var(--a8c-charts-color-trend-down, #cc1818)',\n\t\t\t'var(--a8c-charts-color-trend-neutral, #707070)',\n\t\t\t'var(--a8c-charts-color-trend-up, #008030)',\n\t\t],\n\t},\n\tconversionFunnelChart: {\n\t\tbackgroundColor: 'var(--a8c-charts-color-surface-secondary, #f4f4f4)',\n\t\tpositiveChangeColor: 'var(--a8c-charts-color-trend-up, #008030)',\n\t\tnegativeChangeColor: 'var(--a8c-charts-color-trend-down, #cc1818)',\n\t},\n\tlineChart: {\n\t\tlineStyles: {\n\t\t\tcomparison: {\n\t\t\t\tstrokeDasharray: '4 4',\n\t\t\t\tstrokeLinecap: 'square',\n\t\t\t},\n\t\t},\n\t},\n\tbarChart: {\n\t\tbarStyles: {\n\t\t\tcomparison: {\n\t\t\t\twidthFactor: 1.5,\n\t\t\t\topacity: 0.5,\n\t\t\t},\n\t\t},\n\t},\n\tsparkline: {\n\t\tmargin: { top: 2, right: 2, bottom: 2, left: 2 },\n\t\tstrokeWidth: 1.5,\n\t},\n\t// `primaryColor` is left unset so it falls back to the palette's `colors[0]`. The compact\n\t// 11px square / 2px gap is the contribution-graph rhythm, which has no WPDS dimension.\n\theatmapChart: {\n\t\tcompactCellGap: 2,\n\t\tcompactCellSize: 11,\n\t},\n};\n\nexport { defaultTheme };\n","import { defaultTheme } from '../themes';\nimport type { CompleteChartTheme } from '../../../types';\n\n// Restores each overridden role's mapped theme field to the catalog pointer `defaultTheme` already carries for it, so the value comes from `themes.ts` itself rather than a second, hand-copied literal.\nconst CATALOG_RESTORE_FOR_ROLE: Record<\n\tstring,\n\t( theme: CompleteChartTheme ) => Partial< CompleteChartTheme >\n> = {\n\t'--a8c-charts-color-background': () => ( { backgroundColor: defaultTheme.backgroundColor } ),\n\t'--a8c-charts-color-grid': theme => ( {\n\t\tgridStyles: { ...theme.gridStyles, stroke: defaultTheme.gridStyles.stroke },\n\t} ),\n\t'--a8c-charts-color-axis': theme => ( {\n\t\txAxisLineStyles: { ...theme.xAxisLineStyles, stroke: defaultTheme.xAxisLineStyles.stroke },\n\t} ),\n\t'--a8c-charts-color-tick': theme => ( {\n\t\txTickLineStyles: { ...theme.xTickLineStyles, stroke: defaultTheme.xTickLineStyles.stroke },\n\t} ),\n\t'--a8c-charts-color-label-axis': theme => ( {\n\t\tsvgLabelSmall: { ...theme.svgLabelSmall, fill: defaultTheme.svgLabelSmall.fill },\n\t} ),\n};\n\n/**\n * Restores the mapped theme fields of `overriddenRoles` to their catalog pointer, so the theme-layer variable `themeOverrideVars` writes on the provider wrapper is the only carrier for an overridden role — CSS and the JS bridge (`useXYChartTheme`) then resolve it through the same cascade instead of visx reading a baked literal that can disagree with a closer CSS override.\n *\n * This covers roles `themeOverrideVars` deliberately left unpublished as well as the ones it published. A value that reads its own role is not publishable, but leaving visx the consumer's literal is what the whole mechanism exists to prevent: `theme={ { gridStyles: { stroke: 'var(--brand, var(--a8c-charts-color-grid, red))' } } }` would have CSS paint the catalog default while visx painted `--brand`.\n *\n * Every field outside the five mapped roles is left exactly as `merged` provided it: those aren't published as theme-layer vars, so rewriting them would erase a consumer's override with no replacement carrier.\n *\n * @param merged - The consumer theme merged onto `defaultTheme` (`mergeThemes` output).\n * @param overriddenRoles - The catalog roles the consumer overrode, from `themeOverrideVars`.\n * @return A new theme object; `merged` is not mutated.\n */\nexport const withCatalogPointers = (\n\tmerged: CompleteChartTheme,\n\toverriddenRoles: readonly string[]\n): CompleteChartTheme => {\n\tlet result = merged;\n\n\tfor ( const role of overriddenRoles ) {\n\t\tconst restore = CATALOG_RESTORE_FOR_ROLE[ role ];\n\n\t\tif ( restore ) {\n\t\t\tresult = { ...result, ...restore( result ) };\n\t\t}\n\t}\n\n\treturn result;\n};\n","import { hsl as d3Hsl } from '@visx/vendor/d3-color';\nimport {\n\tcreateContext,\n\tuseCallback,\n\tuseMemo,\n\tuseState,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseRef,\n} from 'react';\n// Side-effect import: emits the `--a8c-charts-*` catalog, scoped to the `a8c-charts-scope` class applied to this component's wrapper below. Every chart either sits under a `GlobalChartsProvider` or auto-mounts its own, so importing it here guarantees the catalog always reaches the bundle.\n//\n// This must be a direct import of the stylesheet, not through a re-export barrel: a barrel `.ts` file doesn't match this package's `sideEffects` glob (only `*.css`/`*.scss` do), so tsdown/Rolldown treats an unused barrel import as side-effect-free and drops it — taking the nested stylesheet import with it. The file also can't be named `*.module.scss`: it declares zero CSS-module class names (only a `:where()`-wrapped selector), and `@tsdown/css` marks a `.module.*` file's generated JS proxy `moduleSideEffects: false` (tree-shakeable unless a class name is read); a plain stylesheet gets `moduleSideEffects: \"no-treeshake\"` instead, so it always ships. `tools/assert-charts-scope-emitted.ts` fails `pnpm run build` if this regresses — a passing test suite alone does not catch a dropped stylesheet.\nimport '../../styles/chart-scope.scss';\nimport { CHART_SCOPE_CLASS } from '../../styles/chart-scope-class';\nimport {\n\tgetItemShapeStyles,\n\tgetSeriesBarStyles,\n\tgetSeriesLineStyles,\n\tmergeThemes,\n\tresolveCssVariable,\n\tnormalizeColorToHex,\n} from '../../utils';\n// Imported from the module rather than the `chart-scope` barrel: the barrel also pulls `use-standalone-scope-class`, which imports `GlobalChartsContext` back from this file. That cycle resolves today only because the binding is read lazily inside the hook body.\nimport { ChartScopeContext } from '../chart-scope/chart-scope-context';\nimport { getChartColor, type ColorCache } from './private/get-chart-color';\nimport { themeOverrideVars } from './private/theme-override-vars';\nimport { withCatalogPointers } from './private/with-catalog-pointers';\nimport { defaultTheme } from './themes';\nimport type { GlobalChartsContextValue, ChartRegistration } from './types';\nimport type { ChartTheme, CompleteChartTheme } from '../../types';\nimport type { CSSProperties, FC, ReactNode } from 'react';\n\nexport const GlobalChartsContext = createContext< GlobalChartsContextValue | null >( null );\n\nexport interface GlobalChartsProviderProps {\n\tchildren: ReactNode;\n\ttheme?: Partial< ChartTheme >;\n}\n\nexport const GlobalChartsProvider: FC< GlobalChartsProviderProps > = ( { children, theme } ) => {\n\tconst [ charts, setCharts ] = useState< Map< string, ChartRegistration > >( () => new Map() );\n\t// Track hidden series per chart: chartId -> Set<seriesLabel>\n\tconst [ hiddenSeries, setHiddenSeries ] = useState< Map< string, Set< string > > >(\n\t\t() => new Map()\n\t);\n\t// Which charts have had their defaults seeded. Kept apart from `hiddenSeries`\n\t// because that map drops a chart's entry once its hidden set empties, so an\n\t// absent entry cannot tell \"never seeded\" from \"the reader revealed the lot\".\n\tconst seededCharts = useRef< Set< string > >( new Set() );\n\n\t// Ref to the wrapper element for resolving scoped CSS variables\n\tconst wrapperRef = useRef< HTMLDivElement >( null );\n\tconst [ scopeNode, setScopeNode ] = useState< HTMLElement | null >( null );\n\n\tconst setWrapperNode = useCallback( ( node: HTMLDivElement | null ) => {\n\t\twrapperRef.current = node;\n\t\tsetScopeNode( node );\n\t}, [] );\n\n\t// themeOverrideVars reads the raw `theme` prop, never `providerTheme` — feeding it the restored theme below would make an overridden role's pointer look like a self-reference and drop the var (see themeOverrideVars' own doc comment).\n\tconst { vars: overrideVars, roles: overriddenRoles } = useMemo(\n\t\t() => themeOverrideVars( theme ),\n\t\t[ theme ]\n\t);\n\n\tconst providerTheme: CompleteChartTheme = useMemo( () => {\n\t\tif ( ! theme ) {\n\t\t\treturn defaultTheme;\n\t\t}\n\n\t\treturn withCatalogPointers( mergeThemes( defaultTheme, theme ), overriddenRoles );\n\t}, [ theme, overriddenRoles ] );\n\n\t// Cache expensive color computations that only change when theme colors change\n\t// Using useState + useLayoutEffect instead of useMemo to ensure CSS variables\n\t// in <style> tags are applied to the DOM before we try to resolve them\n\tconst [ colorCache, setColorCache ] = useState< ColorCache >( () => ( {\n\t\tcolors: [],\n\t\thues: [],\n\t\texistingHslColors: [],\n\t\tminHue: 360,\n\t\tmaxHue: 0,\n\t} ) );\n\n\t// Track if the color palette has been resolved from the DOM\n\t// Useful for animations that should only run after the color palette is resolved\n\tconst [ isColorPaletteResolved, setIsColorPaletteResolved ] = useState( false );\n\n\t// Compute color cache after DOM is updated (so CSS variables are available)\n\t// Resolves CSS variables from the wrapper element's scope to handle scoped variables\n\t// Note: Only re-runs when providerTheme changes, not when wrapper element changes.\n\t// This is intentional, as wrapperRef is expected to be stable for the lifetime of the provider.\n\tuseLayoutEffect( () => {\n\t\tsetIsColorPaletteResolved( false );\n\t\tconst { colors } = providerTheme;\n\t\tconst resolvedColors: string[] = [];\n\t\tconst hues: number[] = [];\n\t\tconst existingHslColors: Array< [ number, number, number ] > = [];\n\t\tlet minHue = 360;\n\t\tlet maxHue = 0;\n\n\t\t// Process all colors once and cache the results\n\t\tif ( Array.isArray( colors ) ) {\n\t\t\tfor ( const color of colors ) {\n\t\t\t\tif ( color && typeof color === 'string' ) {\n\t\t\t\t\t// Normalize color to hex format, handling CSS variables, RGB, HSL, etc.\n\t\t\t\t\t// This uses normalizeColorToHex which resolves CSS variables and converts\n\t\t\t\t\t// rgb(), rgba(), hsl() formats to hex\n\t\t\t\t\tconst normalizedColor = normalizeColorToHex(\n\t\t\t\t\t\tcolor,\n\t\t\t\t\t\twrapperRef.current,\n\t\t\t\t\t\tresolveCssVariable\n\t\t\t\t\t);\n\n\t\t\t\t\t// Only process valid hex colors\n\t\t\t\t\tif ( normalizedColor.startsWith( '#' ) ) {\n\t\t\t\t\t\tresolvedColors.push( normalizedColor );\n\t\t\t\t\t\tconst hslColor = d3Hsl( normalizedColor );\n\t\t\t\t\t\t// d3Hsl returns NaN values for invalid colors\n\t\t\t\t\t\tif ( ! isNaN( hslColor.h ) ) {\n\t\t\t\t\t\t\tconst hslTuple: [ number, number, number ] = [\n\t\t\t\t\t\t\t\thslColor.h,\n\t\t\t\t\t\t\t\thslColor.s * 100,\n\t\t\t\t\t\t\t\thslColor.l * 100,\n\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\thues.push( hslTuple[ 0 ] );\n\t\t\t\t\t\t\texistingHslColors.push( hslTuple );\n\t\t\t\t\t\t\tminHue = Math.min( minHue, hslTuple[ 0 ] );\n\t\t\t\t\t\t\tmaxHue = Math.max( maxHue, hslTuple[ 0 ] );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tsetColorCache( {\n\t\t\tcolors: resolvedColors,\n\t\t\thues,\n\t\t\texistingHslColors,\n\t\t\tminHue,\n\t\t\tmaxHue,\n\t\t} );\n\t}, [ providerTheme ] );\n\n\tuseEffect( () => {\n\t\tif ( colorCache.colors.length > 0 ) {\n\t\t\tsetIsColorPaletteResolved( true );\n\t\t}\n\t}, [ colorCache ] );\n\n\tconst [ groupToColorMap, setGroupToColorMap ] = useState< Map< string, string > >(\n\t\t() => new Map()\n\t);\n\n\t// Reset group color mappings when theme colors change\n\tuseEffect( () => {\n\t\t// Create a completely new Map instance to trigger dependencies, e.g. useChartLegendItems\n\t\tsetGroupToColorMap( new Map() );\n\t}, [ providerTheme.colors ] );\n\n\tconst registerChart = useCallback( ( id: string, data: ChartRegistration ) => {\n\t\tsetCharts( prev => new Map( prev ).set( id, data ) );\n\t}, [] );\n\n\tconst unregisterChart = useCallback( ( id: string ) => {\n\t\tsetCharts( prev => {\n\t\t\tconst newMap = new Map( prev );\n\t\t\tnewMap.delete( id );\n\t\t\treturn newMap;\n\t\t} );\n\t}, [] );\n\n\tconst getChartData = useCallback(\n\t\t( id: string ) => {\n\t\t\treturn charts.get( id );\n\t\t},\n\t\t[ charts ]\n\t);\n\n\tconst resolveColor = useCallback(\n\t\t( {\n\t\t\tgroup,\n\t\t\tindex,\n\t\t\toverrideColor,\n\t\t}: {\n\t\t\tgroup?: string;\n\t\t\tindex: number;\n\t\t\toverrideColor?: string;\n\t\t} ): string => {\n\t\t\t// Highest precedence: eg. explicit series stroke or chart color prop\n\t\t\tif ( overrideColor ) {\n\t\t\t\treturn normalizeColorToHex( overrideColor, wrapperRef.current, resolveCssVariable );\n\t\t\t}\n\n\t\t\t// If group provided, maintain a stable assignment\n\t\t\tif ( group ) {\n\t\t\t\tconst existing = groupToColorMap.get( group );\n\n\t\t\t\tif ( existing ) {\n\t\t\t\t\treturn existing;\n\t\t\t\t}\n\n\t\t\t\t// Use map size as index to assign colors sequentially (0, 1, 2...)\n\t\t\t\t// ensuring each new group gets the next available palette color\n\t\t\t\tconst assignedCount = groupToColorMap.size;\n\t\t\t\tconst color = getChartColor( assignedCount, colorCache );\n\t\t\t\tgroupToColorMap.set( group, color );\n\n\t\t\t\treturn color;\n\t\t\t}\n\n\t\t\treturn getChartColor( index, colorCache );\n\t\t},\n\t\t[ colorCache, groupToColorMap ]\n\t);\n\n\tconst getElementStyles = useCallback< GlobalChartsContextValue[ 'getElementStyles' ] >(\n\t\t( { data, index, overrideColor, legendShape } ) => {\n\t\t\tconst isSeriesData = data && typeof data === 'object' && 'data' in data && 'options' in data;\n\t\t\t// DataPointPercentage has a numeric 'value' directly, unlike SeriesData which has 'data' array\n\t\t\tconst isPointPercentageData =\n\t\t\t\tdata &&\n\t\t\t\ttypeof data === 'object' &&\n\t\t\t\t'value' in data &&\n\t\t\t\ttypeof data.value === 'number' &&\n\t\t\t\t! ( 'data' in data );\n\n\t\t\treturn {\n\t\t\t\tcolor: resolveColor( {\n\t\t\t\t\tgroup: data?.group,\n\t\t\t\t\tindex,\n\t\t\t\t\toverrideColor:\n\t\t\t\t\t\toverrideColor ||\n\t\t\t\t\t\t( isSeriesData && data?.options?.stroke ) ||\n\t\t\t\t\t\t( isPointPercentageData && data?.color ),\n\t\t\t\t} ),\n\t\t\t\tlineStyles: isSeriesData ? getSeriesLineStyles( data, index, providerTheme ) : {},\n\t\t\t\tbarStyles: isSeriesData ? getSeriesBarStyles( data, index, providerTheme ) : {},\n\t\t\t\tglyph: providerTheme.glyphs?.[ index ],\n\t\t\t\tshapeStyles: isSeriesData\n\t\t\t\t\t? getItemShapeStyles( data, index, providerTheme, legendShape )\n\t\t\t\t\t: {},\n\t\t\t};\n\t\t},\n\t\t[ providerTheme, resolveColor ]\n\t);\n\n\t// Keep hidden-series updates and no-op detection consistent across setters.\n\tconst updateHiddenSeries = useCallback(\n\t\t( chartId: string, update: ( current: Set< string > ) => Set< string > ) => {\n\t\t\tsetHiddenSeries( prev => {\n\t\t\t\tconst current = prev.get( chartId );\n\t\t\t\tconst next = update( new Set( current ?? [] ) );\n\n\t\t\t\tif ( ! current && next.size === 0 ) {\n\t\t\t\t\treturn prev;\n\t\t\t\t}\n\n\t\t\t\t// Preserve identity for no-op updates.\n\t\t\t\tif (\n\t\t\t\t\tcurrent &&\n\t\t\t\t\tcurrent.size === next.size &&\n\t\t\t\t\t[ ...next ].every( label => current.has( label ) )\n\t\t\t\t) {\n\t\t\t\t\treturn prev;\n\t\t\t\t}\n\n\t\t\t\tconst newMap = new Map( prev );\n\t\t\t\tif ( next.size === 0 ) {\n\t\t\t\t\tnewMap.delete( chartId );\n\t\t\t\t} else {\n\t\t\t\t\tnewMap.set( chartId, next );\n\t\t\t\t}\n\n\t\t\t\treturn newMap;\n\t\t\t} );\n\t\t},\n\t\t[]\n\t);\n\n\tconst toggleSeriesVisibility = useCallback(\n\t\t( chartId: string, seriesLabel: string ) => {\n\t\t\tupdateHiddenSeries( chartId, current => {\n\t\t\t\tif ( current.has( seriesLabel ) ) {\n\t\t\t\t\tcurrent.delete( seriesLabel );\n\t\t\t\t} else {\n\t\t\t\t\tcurrent.add( seriesLabel );\n\t\t\t\t}\n\t\t\t\treturn current;\n\t\t\t} );\n\t\t},\n\t\t[ updateHiddenSeries ]\n\t);\n\n\tconst setSeriesVisibility = useCallback(\n\t\t( chartId: string, seriesLabel: string, visible: boolean ) => {\n\t\t\tupdateHiddenSeries( chartId, current => {\n\t\t\t\tif ( visible ) {\n\t\t\t\t\tcurrent.delete( seriesLabel );\n\t\t\t\t} else {\n\t\t\t\t\tcurrent.add( seriesLabel );\n\t\t\t\t}\n\t\t\t\treturn current;\n\t\t\t} );\n\t\t},\n\t\t[ updateHiddenSeries ]\n\t);\n\n\tconst setChartHiddenSeries = useCallback(\n\t\t( chartId: string, seriesLabels: readonly string[] ) => {\n\t\t\tupdateHiddenSeries( chartId, () => new Set( seriesLabels ) );\n\t\t},\n\t\t[ updateHiddenSeries ]\n\t);\n\n\tconst hasSeededChart = useCallback(\n\t\t( chartId: string ) => seededCharts.current.has( chartId ),\n\t\t[]\n\t);\n\n\tconst seedChartHiddenSeries = useCallback(\n\t\t( chartId: string, seriesLabels: readonly string[] ) => {\n\t\t\tif ( seededCharts.current.has( chartId ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tseededCharts.current.add( chartId );\n\t\t\tsetChartHiddenSeries( chartId, seriesLabels );\n\t\t},\n\t\t[ setChartHiddenSeries ]\n\t);\n\n\tconst isSeriesVisible = useCallback(\n\t\t( chartId: string, seriesLabel: string ) => {\n\t\t\tconst chartHidden = hiddenSeries.get( chartId );\n\t\t\treturn ! chartHidden || ! chartHidden.has( seriesLabel );\n\t\t},\n\t\t[ hiddenSeries ]\n\t);\n\n\tconst getHiddenSeries = useCallback(\n\t\t( chartId: string ): Set< string > => {\n\t\t\tconst set = hiddenSeries.get( chartId );\n\t\t\treturn set ? new Set( set ) : new Set< string >();\n\t\t},\n\t\t[ hiddenSeries ]\n\t);\n\n\tconst value: GlobalChartsContextValue = useMemo(\n\t\t() => ( {\n\t\t\tcharts,\n\t\t\tregisterChart,\n\t\t\tunregisterChart,\n\t\t\tgetChartData,\n\t\t\ttheme: providerTheme,\n\t\t\tgetElementStyles,\n\t\t\ttoggleSeriesVisibility,\n\t\t\tsetSeriesVisibility,\n\t\t\tsetChartHiddenSeries,\n\t\t\tseedChartHiddenSeries,\n\t\t\thasSeededChart,\n\t\t\tisSeriesVisible,\n\t\t\tgetHiddenSeries,\n\t\t\tisColorPaletteResolved,\n\t\t} ),\n\t\t[\n\t\t\tcharts,\n\t\t\tregisterChart,\n\t\t\tunregisterChart,\n\t\t\tgetChartData,\n\t\t\tproviderTheme,\n\t\t\tgetElementStyles,\n\t\t\ttoggleSeriesVisibility,\n\t\t\tsetSeriesVisibility,\n\t\t\tsetChartHiddenSeries,\n\t\t\tseedChartHiddenSeries,\n\t\t\thasSeededChart,\n\t\t\tisSeriesVisible,\n\t\t\tgetHiddenSeries,\n\t\t\tisColorPaletteResolved,\n\t\t]\n\t);\n\n\treturn (\n\t\t<GlobalChartsContext.Provider value={ value }>\n\t\t\t<div\n\t\t\t\tref={ setWrapperNode }\n\t\t\t\tclassName={ CHART_SCOPE_CLASS }\n\t\t\t\tdata-testid=\"charts-scope\"\n\t\t\t\tstyle={ { display: 'contents', ...overrideVars } as CSSProperties }\n\t\t\t>\n\t\t\t\t<ChartScopeContext.Provider value={ scopeNode }>{ children }</ChartScopeContext.Provider>\n\t\t\t</div>\n\t\t</GlobalChartsContext.Provider>\n\t);\n};\n","import { useContext } from 'react';\nimport { GlobalChartsContext } from '../global-charts-provider';\nimport type { GlobalChartsContextValue } from '../types';\n\nexport const useGlobalChartsContext = (): GlobalChartsContextValue => {\n\tconst context = useContext( GlobalChartsContext );\n\tif ( ! context ) {\n\t\tthrow new Error( 'useGlobalChartsContext must be used within a GlobalChartsProvider' );\n\t}\n\treturn context;\n};\n","import { useId } from 'react';\n\nexport const useChartId = ( providedId?: string ): string => {\n\tconst generatedId = useId();\n\treturn providedId || generatedId;\n};\n","'use strict';\n\n// do not edit .js files directly - edit src/index.jst\n\n\n\nmodule.exports = function equal(a, b) {\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n\n for (i = length; i-- !== 0;) {\n var key = keys[i];\n\n if (!equal(a[key], b[key])) return false;\n }\n\n return true;\n }\n\n // true if both NaN, false otherwise\n return a!==a && b!==b;\n};\n","import isEqual from 'fast-deep-equal';\nimport { useRef } from 'react';\n\n/**\n * Custom hook to memoize a value using deep equality comparison.\n * Prevents unnecessary re-renders when objects have the same content but different references.\n *\n * @param value - The value to memoize with deep equality comparison\n * @return The memoized value that only changes when deeply different\n */\nexport const useDeepMemo = < T >( value: T ): T => {\n\tconst ref = useRef< T >( value );\n\n\tif ( ! isEqual( ref.current, value ) ) {\n\t\tref.current = value;\n\t}\n\n\treturn ref.current;\n};\n","import { useContext } from 'react';\nimport { ChartScopeContext } from './chart-scope-context';\n\n/**\n * Returns the nearest chart scope element, or `null` when rendered outside any scope (and during SSR, before the ref is attached).\n *\n * @return {HTMLElement | null} The nearest chart scope element, or `null`.\n */\nexport const useChartScopeElement = (): HTMLElement | null => useContext( ChartScopeContext );\n","import { useContext } from 'react';\nimport { CHART_SCOPE_CLASS } from '../../styles/chart-scope-class';\nimport { GlobalChartsContext } from '../chart-context/global-charts-provider';\n\n/**\n * Returns the catalog class when there is no `GlobalChartsProvider` above this component, and `undefined` when there is.\n *\n * Standalone components need the catalog to resolve at all, but inside a provider the tokens already inherit — re-declaring them there would shadow a consumer override set anywhere in the tree.\n *\n * @return The scope class name, or undefined when a provider is present.\n */\nexport const useStandaloneScopeClass = (): string | undefined =>\n\tuseContext( GlobalChartsContext ) ? undefined : CHART_SCOPE_CLASS;\n","import { buildChartTheme } from '@visx/xychart';\nimport { useMemo } from 'react';\nimport { useGlobalChartsTheme } from '../providers';\nimport { useChartScopeElement } from '../providers/chart-scope';\nimport { createCssVariableResolver } from '../utils';\nimport type { SeriesData } from '../types';\n\nexport const useXYChartTheme = ( data: SeriesData[] ) => {\n\tconst theme = useGlobalChartsTheme();\n\tconst scopeElement = useChartScopeElement();\n\n\t// The only thing the theme takes from `data` is the series strokes, so key the memo on those rather than on the array's identity. A caller passing an inline literal — `<LineChart data={ [ … ] } />`, which the stories and several consumers do — otherwise rebuilds the whole theme on every render. Serialised rather than joined: a stroke can be `rgba(0, 0, 0, 0.5)` or `var(--brand, #fff)`, and any separator that reads naturally inside a colour cannot round-trip.\n\tconst seriesColorKey = JSON.stringify(\n\t\t( data ?? [] )\n\t\t\t.map( series => series.options?.stroke )\n\t\t\t.filter( ( color ): color is string => Boolean( color ) )\n\t);\n\n\treturn useMemo( () => {\n\t\t// visx applies grid, axis, and tick-label colours as SVG presentation attributes, where CSS var() cannot resolve. Resolve the catalog token against the chart's own scope element — never :root — so this reads any override set inside the provider tree, the same one a CSS-painted element would inherit.\n\t\t//\n\t\t// One resolver per theme build, so the five roles below share a single getComputedStyle call rather than taking one each: this memo re-runs only when the scope element attaches or a series colour changes, which for a dashboard of charts is the difference between two style queries per chart and ten.\n\t\tconst resolve = createCssVariableResolver( scopeElement );\n\t\tconst resolveColor = ( value?: string ): string | undefined =>\n\t\t\tvalue ? resolve( value ) ?? value : value;\n\n\t\tconst seriesColors: string[] = JSON.parse( seriesColorKey );\n\n\t\treturn buildChartTheme( {\n\t\t\t...theme,\n\t\t\tcolors: [ ...seriesColors, ...( theme.colors ?? [] ) ],\n\t\t\tbackgroundColor: resolveColor( theme.backgroundColor ),\n\t\t\tgridStyles: theme.gridStyles && {\n\t\t\t\t...theme.gridStyles,\n\t\t\t\tstroke: resolveColor( theme.gridStyles.stroke ),\n\t\t\t},\n\t\t\txAxisLineStyles: theme.xAxisLineStyles && {\n\t\t\t\t...theme.xAxisLineStyles,\n\t\t\t\tstroke: resolveColor( theme.xAxisLineStyles.stroke ),\n\t\t\t},\n\t\t\txTickLineStyles: theme.xTickLineStyles && {\n\t\t\t\t...theme.xTickLineStyles,\n\t\t\t\tstroke: resolveColor( theme.xTickLineStyles.stroke ),\n\t\t\t},\n\t\t\tsvgLabelSmall: theme.svgLabelSmall && {\n\t\t\t\t...theme.svgLabelSmall,\n\t\t\t\tfill: resolveColor( theme.svgLabelSmall.fill ),\n\t\t\t},\n\t\t} );\n\t}, [ theme, seriesColorKey, scopeElement ] );\n};\n","import { useMemo } from 'react';\nimport { parseAsLocalDate } from '../utils';\nimport type { SeriesData } from '../types';\n\n/**\n * Hook that transforms and sorts chart data, handling date parsing and sorting\n *\n * This hook extracts the common data transformation logic used in both line-chart\n * and bar-chart components. It:\n * 1. Parses date strings into Date objects using parseAsLocalDate\n * 2. Sorts data points by date when date properties are present\n * 3. Returns the original data unchanged when no date properties are found\n *\n * @param {SeriesData[]} data - The raw chart data to transform\n * @return {SeriesData[]} The transformed and sorted data\n */\nexport const useChartDataTransform = ( data: SeriesData[] ) => {\n\treturn useMemo( () => {\n\t\t// Check if the first data point has date or dateString properties\n\t\tconst firstPoint = data?.[ 0 ]?.data?.[ 0 ];\n\t\tconst hasDateProperties = firstPoint && ( 'date' in firstPoint || 'dateString' in firstPoint );\n\n\t\t// If no date properties found, return data unchanged\n\t\tif ( ! hasDateProperties ) {\n\t\t\treturn data;\n\t\t}\n\n\t\t// Transform and sort data with date properties\n\t\treturn data.map( series => ( {\n\t\t\t...series,\n\t\t\tdata: series.data\n\t\t\t\t.map( point => {\n\t\t\t\t\tlet date: Date | undefined;\n\n\t\t\t\t\tif ( 'date' in point && point.date ) {\n\t\t\t\t\t\tdate = point.date;\n\t\t\t\t\t} else if ( 'dateString' in point && point.dateString ) {\n\t\t\t\t\t\tdate = parseAsLocalDate( point.dateString );\n\t\t\t\t\t}\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...point,\n\t\t\t\t\t\tdate,\n\t\t\t\t\t};\n\t\t\t\t} )\n\t\t\t\t.sort( ( a, b ) => {\n\t\t\t\t\tif ( ! a.date || ! b.date ) return 0;\n\t\t\t\t\treturn a.date.getTime() - b.date.getTime();\n\t\t\t\t} ),\n\t\t} ) );\n\t}, [ data ] );\n};\n","import { createScale, getTicks } from '@visx/scale';\nimport { useMemo } from 'react';\nimport { getLongestTickWidth, resolveFontSize } from '../utils';\nimport type { BaseChartProps, DataPointDate, SeriesData } from '../types';\nimport type { XYChartTheme } from '@visx/xychart';\n\n/**\n * Base top margin used when no dynamic adjustments are necessary.\n */\nconst DEFAULT_MARGIN_TOP = 10;\n\n/**\n * Base right margin used when no dynamic adjustments are necessary.\n */\nconst DEFAULT_MARGIN_RIGHT = 20;\n\n/**\n * Base bottom margin used for charts with a bottom X-axis.\n * This is large enough for typical font sizes and will be increased\n * dynamically when tick labels require more space.\n */\nconst DEFAULT_MARGIN_BOTTOM = 20;\n\n/**\n * Base left margin used when no dynamic adjustments are necessary.\n */\nconst DEFAULT_MARGIN_LEFT = 20;\n\n/**\n * Bottom margin to use when the X-axis is rendered at the top.\n * We only need a small buffer below the chart in that case.\n */\nconst DEFAULT_BOTTOM_FOR_TOP_AXIS = 10;\n\n/**\n * Fallback font size used when we cannot derive a font size\n * from the theme or axis styles for X-axis tick labels.\n */\nconst DEFAULT_FONT_SIZE = 12;\n\n/**\n * Fallback tick length used when tickLength is not provided\n * by the theme for either axis.\n */\nconst DEFAULT_TICK_LENGTH = 8;\n\n/**\n * Fallback width used for Y-axis tick labels when we cannot\n * measure them via getLongestTickWidth.\n */\nconst DEFAULT_Y_TICK_WIDTH = 40;\n\nconst getXAxisLabelMetrics = ( theme: XYChartTheme, orientation: 'top' | 'bottom' ) => {\n\tconst xAxisStyles =\n\t\torientation === 'top' ? theme.axisStyles?.x?.top : theme.axisStyles?.x?.bottom;\n\n\tconst fontSize =\n\t\tresolveFontSize( xAxisStyles?.axisLabel?.fontSize ) ||\n\t\tresolveFontSize( theme.svgLabelSmall?.fontSize ) ||\n\t\tDEFAULT_FONT_SIZE;\n\n\tconst tickLength = xAxisStyles?.tickLength ?? DEFAULT_TICK_LENGTH;\n\n\treturn { fontSize, tickLength };\n};\n\nexport const useChartMargin = (\n\theight: number,\n\toptions: BaseChartProps[ 'options' ],\n\tdata: SeriesData[],\n\ttheme: XYChartTheme,\n\thorizontal: boolean = false\n) => {\n\tconst yTicks = useMemo( () => {\n\t\tconst allDataPoints = data.flatMap( series => series.data as DataPointDate[] );\n\n\t\tif ( horizontal ) {\n\t\t\t// When horizontal, y ticks render the category values; leave them raw so\n\t\t\t// the axis tick formatter is applied exactly once, when measuring below.\n\t\t\treturn allDataPoints.map( d => d.label || d.date?.getTime() );\n\t\t}\n\n\t\tif ( options.axis?.y?.tickValues?.length ) {\n\t\t\treturn options.axis.y.tickValues;\n\t\t}\n\n\t\tconst minY = Math.min( ...allDataPoints.map( d => d.value ) );\n\t\tconst maxY = Math.max( ...allDataPoints.map( d => d.value ) );\n\t\tconst yScale = createScale( {\n\t\t\t...options.yScale,\n\t\t\tdomain: [ minY, maxY ],\n\t\t\trange: [ height, 0 ],\n\t\t} );\n\n\t\treturn getTicks( yScale, options.axis?.y?.numTicks );\n\t}, [ options, data, height, horizontal ] );\n\n\treturn useMemo( () => {\n\t\t// Default margin is for bottom axis labels.\n\t\tconst defaultMargin = {\n\t\t\ttop: DEFAULT_MARGIN_TOP,\n\t\t\tright: DEFAULT_MARGIN_RIGHT,\n\t\t\tbottom: DEFAULT_MARGIN_BOTTOM,\n\t\t\tleft: DEFAULT_MARGIN_LEFT,\n\t\t};\n\n\t\t// Auto-calculate margin for y axis labels based on orientation and tick width.\n\t\tconst yAxisOrientation = options.axis?.y?.orientation;\n\t\tconst yAxisStyles =\n\t\t\tyAxisOrientation === 'right' ? theme.axisStyles.y.right : theme.axisStyles.y.left;\n\t\tconst yTickWidth = getLongestTickWidth(\n\t\t\tyTicks,\n\t\t\toptions.axis?.y?.tickFormat,\n\t\t\tyAxisStyles.axisLabel\n\t\t);\n\t\t// visx's default axis theme pushes y-axis tick labels a further 0.25em\n\t\t// away from the axis (dx of -0.25em on the left, 0.25em on the right), so\n\t\t// reserve that on top of the measured label width — without it the widest\n\t\t// label clips at the SVG edge. The em resolves against the tick label's own\n\t\t// font size (theme tickLabel), not the axis-title font size (axisLabel).\n\t\tconst yTickLabelFontSize =\n\t\t\tresolveFontSize( yAxisStyles?.tickLabel?.fontSize ) || DEFAULT_FONT_SIZE;\n\t\tconst yMarginValue =\n\t\t\t( yTickWidth ?? DEFAULT_Y_TICK_WIDTH ) +\n\t\t\t( yAxisStyles?.tickLength ?? 0 ) +\n\t\t\tMath.ceil( yTickLabelFontSize * 0.25 );\n\n\t\tif ( yAxisOrientation === 'right' ) {\n\t\t\tdefaultMargin.right = yMarginValue;\n\t\t} else {\n\t\t\tdefaultMargin.left = yMarginValue;\n\t\t}\n\n\t\t// Dynamically compute X-axis margin (bottom by default, or top if orientation is 'top').\n\t\t// This mirrors Y-axis behavior where margin is based on label size and tick length,\n\t\t// but keeps the padding minimal so consumers can control container spacing themselves.\n\t\tconst xOrientation = options.axis?.x?.orientation === 'top' ? 'top' : 'bottom';\n\t\tconst { fontSize, tickLength } = getXAxisLabelMetrics( theme, xOrientation );\n\t\tconst computedXMargin = fontSize + tickLength;\n\n\t\tif ( xOrientation === 'top' ) {\n\t\t\tdefaultMargin.top = Math.max( defaultMargin.top, computedXMargin );\n\t\t\tdefaultMargin.bottom = DEFAULT_BOTTOM_FOR_TOP_AXIS;\n\t\t} else {\n\t\t\tdefaultMargin.bottom = Math.max( defaultMargin.bottom, computedXMargin );\n\t\t}\n\n\t\treturn defaultMargin;\n\t}, [ options, theme, yTicks ] );\n};\n","import { useState, useCallback, useRef } from 'react';\n\n/**\n * Hook to measure the width and height of a DOM element.\n * Returns a ref callback to attach to the element and the current dimensions in pixels.\n *\n * @param {object} props - Optional props.\n * @param {number} props.initialWidth - The initial width to use.\n * @param {number} props.initialHeight - The initial height to use.\n *\n * @return {[Function, number, number]} A tuple containing a ref callback, width, and height in pixels\n */\nexport function useElementSize< T extends HTMLElement = HTMLDivElement >( {\n\tinitialWidth = 0,\n\tinitialHeight = 0,\n}: {\n\tinitialWidth?: number;\n\tinitialHeight?: number;\n} = {} ): [ ( node: T | null ) => void, number, number ] {\n\tconst [ width, setWidth ] = useState( initialWidth );\n\tconst [ height, setHeight ] = useState( initialHeight );\n\tconst observerRef = useRef< ResizeObserver | null >( null );\n\n\tconst refCallback = useCallback( ( node: T | null ) => {\n\t\tif ( observerRef.current ) {\n\t\t\tobserverRef.current.disconnect();\n\t\t\tobserverRef.current = null;\n\t\t}\n\t\tif ( node ) {\n\t\t\tconst handleResize = () => {\n\t\t\t\tconst rect = node.getBoundingClientRect();\n\t\t\t\tsetWidth( rect.width || 0 );\n\t\t\t\tsetHeight( rect.height || 0 );\n\t\t\t};\n\t\t\thandleResize();\n\t\t\tconst resizeObserver = new ResizeObserver( handleResize );\n\t\t\tresizeObserver.observe( node );\n\t\t\tobserverRef.current = resizeObserver;\n\t\t}\n\t}, [] );\n\n\treturn [ refCallback, width, height ];\n}\n","import { useCallback, useRef, useState } from 'react';\n\n/**\n * Hook to detect if text content is truncated within its container.\n * Uses ResizeObserver to dynamically track changes in element size.\n *\n * @param enabled - Whether truncation detection should be active. Defaults to true.\n * @return A tuple containing:\n * - [0] refCallback: Function to attach to the text element as a ref\n * - [1] isTruncated: Boolean indicating if the text is currently truncated\n *\n * @example\n * ```tsx\n * const [textRef, isTruncated] = useTextTruncation(true);\n *\n * return (\n * <span ref={textRef} title={isTruncated ? fullText : undefined}>\n * {text}\n * </span>\n * );\n * ```\n */\nexport function useTextTruncation(\n\tenabled: boolean = true\n): [ ( node: HTMLElement | null ) => void, boolean ] {\n\tconst [ isTruncated, setIsTruncated ] = useState( false );\n\tconst observerRef = useRef< ResizeObserver | null >( null );\n\n\tconst refCallback = useCallback(\n\t\t( node: HTMLElement | null ) => {\n\t\t\t// Cleanup existing observer\n\t\t\tif ( observerRef.current ) {\n\t\t\t\tobserverRef.current.disconnect();\n\t\t\t\tobserverRef.current = null;\n\t\t\t}\n\n\t\t\tif ( node && enabled ) {\n\t\t\t\tconst checkTruncation = () => {\n\t\t\t\t\t// Check if content width exceeds container width (indicates truncation)\n\t\t\t\t\tconst truncated = node.scrollWidth > node.clientWidth;\n\t\t\t\t\tsetIsTruncated( truncated );\n\t\t\t\t};\n\n\t\t\t\t// Initial check\n\t\t\t\tcheckTruncation();\n\n\t\t\t\t// Watch for size changes\n\t\t\t\tconst resizeObserver = new ResizeObserver( checkTruncation );\n\t\t\t\tresizeObserver.observe( node );\n\t\t\t\tobserverRef.current = resizeObserver;\n\t\t\t} else {\n\t\t\t\tsetIsTruncated( false );\n\t\t\t}\n\t\t},\n\t\t[ enabled ]\n\t);\n\n\treturn [ refCallback, isTruncated ];\n}\n","import { useMemo } from 'react';\nimport type { SeriesData, DataPointDate } from '../types';\n\nexport type EnhancedDataPoint = DataPointDate & {\n\tvisualValue?: number;\n};\n\nexport interface EnhancedSeriesData extends Omit< SeriesData, 'data' > {\n\tdata: EnhancedDataPoint[];\n}\n\nexport interface UseZeroValueDisplayOptions {\n\tenabled: boolean;\n\t/**\n\t * The pixel length of the value axis (height for vertical charts, width for\n\t * horizontal charts). Used to calculate a minimum visible value that ensures\n\t * zero-value bars are at least MIN_PIXEL_HEIGHT pixels tall along that axis.\n\t */\n\tvalueAxisLength?: number;\n}\n\n/**\n * Minimum pixel size for near-zero bars (non-zero values that would render too small).\n * Using 3px to be visible but not misleading - larger values might look like actual data.\n */\nconst MIN_PIXEL_SIZE = 3;\n\n/**\n * Pixel size for zero-value bars (1px less than near-zero to be visually distinguishable).\n */\nconst ZERO_PIXEL_SIZE = MIN_PIXEL_SIZE - 1;\n\nexport const useZeroValueDisplay = (\n\tdata: SeriesData[],\n\toptions: UseZeroValueDisplayOptions = { enabled: false }\n): SeriesData[] | EnhancedSeriesData[] => {\n\tconst { enabled, valueAxisLength } = options;\n\n\treturn useMemo( () => {\n\t\tif ( ! enabled || ! valueAxisLength || valueAxisLength <= 0 ) return data;\n\n\t\t// Find max absolute value\n\t\tlet maxAbsoluteValue = 0;\n\t\tfor ( const series of data ) {\n\t\t\tfor ( const point of series.data ) {\n\t\t\t\tif ( point.value !== null && point.value !== 0 ) {\n\t\t\t\t\tmaxAbsoluteValue = Math.max( maxAbsoluteValue, Math.abs( point.value ) );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( maxAbsoluteValue === 0 ) return data;\n\n\t\t// Calculate values that render as specific pixel sizes, clamped to maxAbsoluteValue\n\t\t// to prevent visual distortion when valueAxisLength is very small\n\t\tconst minNonZeroValue = Math.min(\n\t\t\t( MIN_PIXEL_SIZE / valueAxisLength ) * maxAbsoluteValue,\n\t\t\tmaxAbsoluteValue\n\t\t);\n\t\tconst zeroVisualValue = Math.min(\n\t\t\t( ZERO_PIXEL_SIZE / valueAxisLength ) * maxAbsoluteValue,\n\t\t\tmaxAbsoluteValue\n\t\t);\n\n\t\treturn data.map( series => ( {\n\t\t\t...series,\n\t\t\tdata: series.data.map( ( point: DataPointDate ): EnhancedDataPoint => {\n\t\t\t\t// Zero values get a smaller visual representation (2px)\n\t\t\t\tif ( point.value === 0 ) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...point,\n\t\t\t\t\t\tvisualValue: zeroVisualValue,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\t// Null values should remain untouched\n\t\t\t\tif ( point.value === null ) {\n\t\t\t\t\treturn point;\n\t\t\t\t}\n\n\t\t\t\tconst absValue = Math.abs( point.value );\n\n\t\t\t\t// Near-zero values that would render below MIN_PIXEL_SIZE get boosted to 3px\n\t\t\t\t// Preserve the sign for negative values\n\t\t\t\tif ( absValue < minNonZeroValue ) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...point,\n\t\t\t\t\t\tvisualValue: Math.sign( point.value ) * minNonZeroValue,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\treturn point;\n\t\t\t} ),\n\t\t} ) );\n\t}, [ data, enabled, valueAxisLength ] );\n};\n","import { useMemo } from 'react';\n\ninterface DataPointWithValue {\n\tvalue: number;\n}\n\n/**\n * Hook to calculate percentages from values for chart data.\n * Ensures percentages are always derived from values (single source of truth).\n *\n * @param data - Array of data points with values\n * @return Data with calculated percentages\n */\nexport const useDataWithPercentages = < T extends DataPointWithValue >(\n\tdata: T[]\n): ( T & { percentage: number } )[] => {\n\treturn useMemo( () => {\n\t\tconst totalValue = data.reduce( ( sum, segment ) => sum + segment.value, 0 );\n\t\treturn data.map( segment => ( {\n\t\t\t...segment,\n\t\t\tpercentage: totalValue > 0 ? ( segment.value / totalValue ) * 100 : 0,\n\t\t} ) );\n\t}, [ data ] );\n};\n","import { useMemo } from 'react';\n\n/**\n * Data point interface for charts with visibility-aware legends.\n * Requires label for series identification, value for calculations,\n * and percentage (should be pre-calculated by the chart component).\n */\ninterface DataPointWithPercentage {\n\tlabel: string;\n\tvalue: number;\n\tpercentage: number;\n}\n\n/**\n * Parameters for the useLegendVisibilityData hook.\n */\ninterface UseLegendVisibilityDataParams< T extends DataPointWithPercentage > {\n\t/** The chart data with pre-calculated percentages */\n\tdata: T[];\n\t/** Unique chart identifier, required for filtering */\n\tchartId: string | undefined;\n\t/** Function to check if a series is visible in the legend */\n\tisSeriesVisible: ( chartId: string, label: string ) => boolean;\n}\n\n/**\n * Return value from the useLegendVisibilityData hook.\n */\ninterface UseLegendVisibilityDataResult< T extends DataPointWithPercentage > {\n\t/** Filtered data array containing only visible segments with recalculated percentages */\n\tvisibleData: T[];\n\t/** Boolean indicating if all segments are hidden */\n\tallSegmentsHidden: boolean;\n\t/**\n\t * Legend data with stable percentage formatting.\n\t * Hidden items keep their original percentage.\n\t * Visible items show recalculated percentages that total 100%.\n\t */\n\tlegendData: T[];\n}\n\n/**\n * Custom hook to filter and recalculate chart data based on series visibility.\n *\n * Regardless of whether the legend is interactive (clickable), this hook:\n * 1. Filters data to show only visible series (visibility can also be set programmatically)\n * 2. Recalculates percentages so visible segments total 100%\n * 3. Tracks whether all segments are hidden to show empty state\n *\n * This is particularly useful for pie charts, donut charts, and semi-circle charts\n * where segment visibility and percentages need to be dynamically adjusted.\n *\n * @example\n * ```tsx\n * const { visibleData, allSegmentsHidden, legendData } = useLegendVisibilityData({\n * data: chartData,\n * chartId: 'my-pie-chart',\n * isSeriesVisible: (id, label) => context.isSeriesVisible(id, label),\n * });\n *\n * // Use legendData for creating legend items (shows recalculated percentages)\n * const legendItems = useChartLegendItems(legendData, legendOptions);\n *\n * if (allSegmentsHidden) {\n * return <EmptyState />;\n * }\n *\n * // Use visibleData for rendering the chart (only visible segments)\n * return <PieChart data={visibleData} />;\n * ```\n *\n * @param params - Configuration object for the hook\n * @param params.data - The chart data to filter\n * @param params.chartId - Unique identifier for the chart (required for filtering)\n * @param params.isSeriesVisible - Function to check series visibility\n * @return Object containing visibleData, allSegmentsHidden flag, and legendData with recalculated percentages\n */\nexport const useLegendVisibilityData = < T extends DataPointWithPercentage >( {\n\tdata,\n\tchartId,\n\tisSeriesVisible,\n}: UseLegendVisibilityDataParams< T > ): UseLegendVisibilityDataResult< T > => {\n\t// Filter and recalculate data based on shared legend visibility state.\n\t// Note: data should already have percentages calculated by the chart component\n\tconst visibleData = useMemo( () => {\n\t\t// Visibility filtering applies regardless of whether the legend is\n\t\t// interactive: interactivity only controls whether clicking the legend\n\t\t// can change visibility, not whether the chart honors it.\n\t\tif ( ! chartId ) {\n\t\t\treturn data;\n\t\t}\n\n\t\t// Filter to only visible segments based on legend state\n\t\tconst filtered = data.filter( segment => isSeriesVisible( chartId, segment.label ) );\n\n\t\t// If no segments are visible, return empty array\n\t\tif ( filtered.length === 0 ) {\n\t\t\treturn [];\n\t\t}\n\n\t\t// Recalculate percentages from values so visible segments total 100%\n\t\tconst totalValue = filtered.reduce( ( sum, segment ) => sum + segment.value, 0 );\n\t\treturn filtered.map( segment => ( {\n\t\t\t...segment,\n\t\t\tpercentage: totalValue > 0 ? ( segment.value / totalValue ) * 100 : 0,\n\t\t} ) );\n\t}, [ data, chartId, isSeriesVisible ] );\n\n\t// Check if all segments are hidden. Guard on the source data being non-empty:\n\t// unlike line/area's `.every()`, an empty `visibleData` alone can't distinguish\n\t// \"everything was hidden\" from \"there was nothing to show\" for an empty dataset.\n\tconst allSegmentsHidden = useMemo( () => {\n\t\treturn visibleData.length === 0 && data.length > 0;\n\t}, [ visibleData, data ] );\n\n\t// Prepare legend data with percentages\n\t// Hidden items keep their original percentage (calculated from all values)\n\t// Visible items show recalculated percentages (totaling 100%)\n\tconst legendData = useMemo( () => {\n\t\tif ( ! chartId ) {\n\t\t\treturn data;\n\t\t}\n\n\t\t// Build a Map for O(1) lookups instead of O(n) find() calls\n\t\tconst visibleDataMap = new Map( visibleData.map( d => [ d.label, d ] ) );\n\n\t\treturn data.map( segment => {\n\t\t\tconst isVisible = isSeriesVisible( chartId, segment.label );\n\t\t\tif ( ! isVisible ) {\n\t\t\t\t// Hidden items keep original percentage\n\t\t\t\treturn segment;\n\t\t\t}\n\n\t\t\t// For visible items, get the recalculated percentage from visibleData\n\t\t\treturn visibleDataMap.get( segment.label ) || segment;\n\t\t} );\n\t}, [ data, visibleData, chartId, isSeriesVisible ] );\n\n\treturn { visibleData, allSegmentsHidden, legendData };\n};\n","import { useState, useEffect } from 'react';\n\n// 'no-preference' returns false in unsupported browsers,\n// causing a safe fallback to reduced motion instead of animating.\nconst QUERY = '(prefers-reduced-motion: no-preference)';\n\nconst getInitialState = () => ! window.matchMedia( QUERY ).matches;\n\n/**\n * Custom hook to determine if the user prefers reduced motion.\n * @return {boolean} A boolean indicating the user's preference for reduced motion.\n */\nexport function usePrefersReducedMotion() {\n\tconst [ prefersReducedMotion, setPrefersReducedMotion ] = useState( getInitialState );\n\n\tuseEffect( () => {\n\t\tconst mediaQueryList = window.matchMedia( QUERY );\n\n\t\tconst listener = event => {\n\t\t\tsetPrefersReducedMotion( ! event.matches );\n\t\t};\n\n\t\tmediaQueryList.addEventListener( 'change', listener );\n\n\t\treturn () => {\n\t\t\tmediaQueryList.removeEventListener( 'change', listener );\n\t\t};\n\t}, [] );\n\n\treturn prefersReducedMotion;\n}\n","import { useEffect, useMemo } from 'react';\nimport { useDeepMemo } from '../../../hooks';\nimport { useGlobalChartsContext } from './use-global-charts-context';\nimport type { BaseLegendItem } from '../../../components/legend';\nimport type { ChartType } from '../../../types';\n\nexport const useChartRegistration = ( {\n\tchartId,\n\tlegendItems,\n\tchartType,\n\tisDataValid,\n\tmetadata,\n}: {\n\tchartId: string;\n\tlegendItems: BaseLegendItem[];\n\tchartType: ChartType;\n\tisDataValid: boolean;\n\tmetadata?: Record< string, unknown >;\n} ): void => {\n\tconst { registerChart, unregisterChart } = useGlobalChartsContext();\n\n\t// Memoize legendItems with deep comparison to prevent infinite loops\n\tconst stableLegendItems = useDeepMemo( legendItems );\n\n\t// Memoize metadata to prevent unnecessary re-renders\n\tconst memoizedMetadata = useMemo( () => metadata, [ metadata ] );\n\n\tuseEffect( () => {\n\t\t// Only register if data is valid\n\t\tif ( isDataValid ) {\n\t\t\tregisterChart( chartId, {\n\t\t\t\tlegendItems: stableLegendItems,\n\t\t\t\tchartType,\n\t\t\t\tmetadata: memoizedMetadata,\n\t\t\t} );\n\t\t}\n\n\t\treturn () => {\n\t\t\tunregisterChart( chartId );\n\t\t};\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [\n\t\tchartId,\n\t\tstableLegendItems,\n\t\tchartType,\n\t\tmemoizedMetadata,\n\t\tisDataValid,\n\t\t// Removed registerChart and unregisterChart from dependencies\n\t\t// They are stable functions created with useCallback and empty deps\n\t] );\n};\n","import { useContext } from 'react';\nimport { GlobalChartsContext } from '../global-charts-provider';\nimport { defaultTheme } from '../themes';\nimport type { CompleteChartTheme } from '../../../types';\n\n/**\n * Hook to get the global chart theme from GlobalChartsProvider\n *\n * @return The global chart theme\n */\nexport const useGlobalChartsTheme = (): CompleteChartTheme => {\n\t// Get context but don't throw if it doesn't exist (for testing or standalone usage)\n\tconst context = useContext( GlobalChartsContext );\n\tconst globalTheme = context?.theme;\n\n\treturn globalTheme ?? defaultTheme;\n};\n","export type ValueOrIdentity< T > = T | { value?: T };\n\n/**\n * Returns an object's value if defined, or the object.\n * @param _ - The object to return the value of.\n * @return The value of the object, or the object itself.\n */\nexport function valueOrIdentity< T >( _: ValueOrIdentity< T > ): T {\n\tif ( _ && typeof _ === 'object' && 'value' in _ && typeof _.value !== 'undefined' )\n\t\treturn _.value;\n\treturn _ as T;\n}\n\n/**\n * Returns an object's value if defined, or the object, coerced to a string.\n * @param _ - The object to return the value of.\n * @return The value of the object, or the object itself.\n */\nexport function valueOrIdentityString< T >( _: ValueOrIdentity< T > ): string {\n\treturn String( valueOrIdentity( _ ) );\n}\n","import type { ItemTransformer, LabelFormatter } from '@visx/legend';\nimport type { AnyD3Scale, ScaleInput } from '@visx/scale';\n\n/**\n * Returns a function which takes a Datum and index as input, and returns a formatted label object.\n * @param {object} root0 - The object to return the value of.\n * @param {AnyD3Scale} root0.scale - The scale to use.\n * @param {LabelFormatter<ScaleInput<Scale>>} root0.labelFormat - The label format to use.\n * @return {ItemTransformer<ScaleInput<Scale>, ReturnType<Scale>>} The label transform factory.\n */\nexport function labelTransformFactory< Scale extends AnyD3Scale >( {\n\tscale,\n\tlabelFormat,\n}: {\n\tscale: Scale;\n\tlabelFormat: LabelFormatter< ScaleInput< Scale > >;\n} ): ItemTransformer< ScaleInput< Scale >, ReturnType< Scale > > {\n\treturn ( d, i ) => ( {\n\t\tdatum: d,\n\t\tindex: i,\n\t\ttext: `${ labelFormat( d, i ) }`,\n\t\tvalue: scale( d ),\n\t} );\n}\n","import { Group } from '@visx/group';\nimport { LegendItem, LegendLabel, LegendOrdinal, LegendShape } from '@visx/legend';\nimport { scaleOrdinal } from '@visx/scale';\nimport { _x, sprintf } from '@wordpress/i18n';\nimport { Stack } from '@wordpress/ui';\nimport clsx from 'clsx';\nimport {\n\ttype RefAttributes,\n\ttype ForwardRefExoticComponent,\n\ttype KeyboardEvent,\n\tforwardRef,\n\tuseCallback,\n\tuseContext,\n} from 'react';\nimport { ChartInstanceContext } from '../../../charts/private/chart-instance-context';\nimport { useTextTruncation } from '../../../hooks';\nimport { GlobalChartsContext, useGlobalChartsTheme } from '../../../providers';\nimport { useStandaloneScopeClass } from '../../../providers/chart-scope';\nimport { valueOrIdentity, valueOrIdentityString, labelTransformFactory } from '../utils';\nimport styles from './base-legend.module.scss';\nimport type { BaseLegendItem, BaseLegendProps } from '../types';\n\nconst ALIGNMENT_TO_FLEX = {\n\tstart: 'flex-start',\n\tcenter: 'center',\n\tend: 'flex-end',\n} as const;\n\n// Component for legend text with truncation detection\n// Moved outside BaseLegend to prevent recreation on every render\nconst LegendText = ( {\n\ttext,\n\ttextOverflow,\n\tmaxWidth,\n}: {\n\ttext: string;\n\ttextOverflow: 'ellipsis' | 'wrap';\n\tmaxWidth?: string;\n} ) => {\n\tconst isEllipsis = maxWidth != null && textOverflow === 'ellipsis';\n\tconst [ textRef, isTruncated ] = useTextTruncation( Boolean( isEllipsis ) );\n\n\treturn (\n\t\t<span\n\t\t\tref={ textRef }\n\t\t\tclassName={ clsx(\n\t\t\t\tstyles[ 'legend-item-text' ],\n\t\t\t\tmaxWidth != null && styles[ `legend-item-text--${ textOverflow }` ]\n\t\t\t) }\n\t\t\tstyle={ {\n\t\t\t\t...( maxWidth != null && {\n\t\t\t\t\tmaxWidth,\n\t\t\t\t\tminWidth: 0,\n\t\t\t\t} ),\n\t\t\t} }\n\t\t\ttitle={ isEllipsis && isTruncated ? text : undefined }\n\t\t>\n\t\t\t{ text }\n\t\t</span>\n\t);\n};\n\n// Interactive items get a toggle affordance; non-interactive items only need a label\n// when hidden, since a visible item's own text already serves as its accessible name.\nconst getLegendItemAriaLabel = (\n\ttext: string,\n\tvalue: BaseLegendItem[ 'value' ],\n\tvisible: boolean,\n\tinteractive: boolean\n) => {\n\tconst accessibleText =\n\t\tvalue != null && value !== ''\n\t\t\t? sprintf(\n\t\t\t\t\t/* translators: 1: legend item label; 2: legend item value. */\n\t\t\t\t\t_x( '%1$s, %2$s', 'legend item label and value', 'jetpack-charts' ),\n\t\t\t\t\ttext,\n\t\t\t\t\tString( value )\n\t\t\t )\n\t\t\t: text;\n\n\tif ( interactive ) {\n\t\tif ( visible ) {\n\t\t\treturn sprintf(\n\t\t\t\t/* translators: %s: legend item label (e.g. a series or segment name) */\n\t\t\t\t_x(\n\t\t\t\t\t'%s: visible. Toggle visibility.',\n\t\t\t\t\t'visible interactive legend item',\n\t\t\t\t\t'jetpack-charts'\n\t\t\t\t),\n\t\t\t\taccessibleText\n\t\t\t);\n\t\t}\n\t\treturn sprintf(\n\t\t\t/* translators: %s: legend item label (e.g. a series or segment name) */\n\t\t\t_x( '%s: hidden. Toggle visibility.', 'hidden interactive legend item', 'jetpack-charts' ),\n\t\t\taccessibleText\n\t\t);\n\t}\n\tif ( visible ) {\n\t\treturn undefined;\n\t}\n\treturn sprintf(\n\t\t/* translators: %s: legend item label (e.g. a series or segment name) */\n\t\t_x( '%s: hidden', 'hidden non-interactive legend item', 'jetpack-charts' ),\n\t\taccessibleText\n\t);\n};\n\n/*\n * Base legend component that displays color-coded items with labels based on visx LegendOrdinal.\n * We avoid using LegendOrdinal directly to enable support for advanced features such as interactivity.\n */\nexport const BaseLegend: ForwardRefExoticComponent<\n\tBaseLegendProps & RefAttributes< HTMLDivElement >\n> = forwardRef< HTMLDivElement, BaseLegendProps >(\n\t(\n\t\t{\n\t\t\titems,\n\t\t\tclassName,\n\t\t\torientation = 'horizontal',\n\t\t\talignment = 'center',\n\t\t\tshape = 'rect',\n\t\t\tfill = valueOrIdentityString,\n\t\t\tsize = valueOrIdentityString,\n\t\t\tlabelFormat = valueOrIdentity,\n\t\t\tlabelTransform = labelTransformFactory,\n\t\t\titemStyles,\n\t\t\titemClassName,\n\t\t\tlabelStyles,\n\t\t\tlabelClassName,\n\t\t\tshapeStyles,\n\t\t\trender,\n\t\t\tinteractive = false,\n\t\t\tchartId,\n\t\t},\n\t\tref\n\t) => {\n\t\tconst { margin: itemMargin = '0', flexDirection: itemDirection = 'row' } = itemStyles ?? {};\n\t\tconst {\n\t\t\tjustifyContent: labelJustifyContent = 'flex-start',\n\t\t\tflex: labelFlex = '0 0 auto',\n\t\t\tmargin: labelMargin = '0 4px',\n\t\t\tmaxWidth,\n\t\t\ttextOverflow = 'wrap',\n\t\t} = labelStyles ?? {};\n\t\tconst {\n\t\t\twidth: shapeWidth = 16,\n\t\t\theight: shapeHeight = 16,\n\t\t\tmargin: shapeMargin = '2px 4px 2px 0',\n\t\t} = shapeStyles ?? {};\n\n\t\tconst theme = useGlobalChartsTheme();\n\t\tconst context = useContext( GlobalChartsContext );\n\t\tconst chartInstanceContext = useContext( ChartInstanceContext );\n\t\tconst standaloneScopeClass = useStandaloneScopeClass();\n\n\t\tconst legendScale = scaleOrdinal( {\n\t\t\tdomain: items.map( item => item.label ),\n\t\t\trange: items.map( item => item.color ),\n\t\t} );\n\t\tconst domain = legendScale.domain();\n\n\t\tconst getShapeStyle = useCallback(\n\t\t\t( { index }: { index: number } ) => items[ index ]?.shapeStyle,\n\t\t\t[ items ]\n\t\t);\n\n\t\t// Handle legend item clicks for interactive mode\n\t\tconst handleLegendClick = useCallback(\n\t\t\t( seriesLabels: string[] ) => {\n\t\t\t\tif ( interactive && chartId && context ) {\n\t\t\t\t\tconst representativeVisible = context.isSeriesVisible( chartId, seriesLabels[ 0 ] );\n\t\t\t\t\tseriesLabels.forEach( label =>\n\t\t\t\t\t\tcontext.setSeriesVisibility( chartId, label, ! representativeVisible )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[ interactive, chartId, context ]\n\t\t);\n\n\t\t// Visibility is display state, not interaction state: a series hidden\n\t\t// programmatically must read as hidden even when the legend cannot be clicked.\n\t\tconst isSeriesVisible = useCallback(\n\t\t\t( seriesLabel: string ) => {\n\t\t\t\tif ( chartInstanceContext?.isSeriesVisible ) {\n\t\t\t\t\treturn chartInstanceContext.isSeriesVisible( seriesLabel );\n\t\t\t\t}\n\t\t\t\tif ( ! chartId || ! context ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn context.isSeriesVisible( chartId, seriesLabel );\n\t\t\t},\n\t\t\t[ chartId, chartInstanceContext, context ]\n\t\t);\n\n\t\t// Create event handlers to avoid inline arrow functions\n\t\tconst createClickHandler = useCallback(\n\t\t\t( seriesLabels: string[] ) => {\n\t\t\t\tif ( ! interactive ) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\treturn () => handleLegendClick( seriesLabels );\n\t\t\t},\n\t\t\t[ interactive, handleLegendClick ]\n\t\t);\n\n\t\tconst createKeyDownHandler = useCallback(\n\t\t\t( seriesLabels: string[] ) => {\n\t\t\t\tif ( ! interactive ) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\treturn ( event: KeyboardEvent ) => {\n\t\t\t\t\tif ( event.key === 'Enter' || event.key === ' ' ) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\thandleLegendClick( seriesLabels );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ interactive, handleLegendClick ]\n\t\t);\n\n\t\tconst flexAlignment = ALIGNMENT_TO_FLEX[ alignment ] ?? 'center';\n\n\t\treturn render ? (\n\t\t\trender( items )\n\t\t) : (\n\t\t\t<LegendOrdinal\n\t\t\t\tscale={ legendScale }\n\t\t\t\tlabelFormat={ labelFormat }\n\t\t\t\tlabelTransform={ labelTransform }\n\t\t\t>\n\t\t\t\t{ labels => (\n\t\t\t\t\t<Stack\n\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\tdirection={ orientation === 'vertical' ? 'column' : 'row' }\n\t\t\t\t\t\tgap={ orientation === 'vertical' ? 'sm' : 'lg' }\n\t\t\t\t\t\talign={ orientation === 'vertical' ? flexAlignment : undefined }\n\t\t\t\t\t\tjustify={ orientation === 'horizontal' ? flexAlignment : undefined }\n\t\t\t\t\t\twrap={ orientation === 'horizontal' ? 'wrap' : undefined }\n\t\t\t\t\t\trole={ interactive ? undefined : 'list' }\n\t\t\t\t\t\tdata-testid={ `legend-${ orientation }` }\n\t\t\t\t\t\tclassName={ clsx( standaloneScopeClass, styles.legend, className ) }\n\t\t\t\t\t\tstyle={ theme.legend?.containerStyles }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ labels.map( ( label, i ) => {\n\t\t\t\t\t\t\tconst matchedItem = items[ i ];\n\t\t\t\t\t\t\t// A grouped item toggles/reads every series it controls; a plain item just its own.\n\t\t\t\t\t\t\tconst seriesLabels = matchedItem?.seriesLabels?.length\n\t\t\t\t\t\t\t\t? matchedItem.seriesLabels\n\t\t\t\t\t\t\t\t: [ label.text ];\n\t\t\t\t\t\t\tconst visible = isSeriesVisible( seriesLabels[ 0 ] );\n\t\t\t\t\t\t\tconst handleClick = createClickHandler( seriesLabels );\n\t\t\t\t\t\t\tconst handleKeyDown = createKeyDownHandler( seriesLabels );\n\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<LegendItem\n\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t'visx-legend-item',\n\t\t\t\t\t\t\t\t\t\tstyles[ 'legend-item' ],\n\t\t\t\t\t\t\t\t\t\tinteractive && styles[ 'legend-item--interactive' ],\n\t\t\t\t\t\t\t\t\t\t! visible && styles[ 'legend-item--inactive' ],\n\t\t\t\t\t\t\t\t\t\titemClassName\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tdata-testid=\"legend-item\"\n\t\t\t\t\t\t\t\t\tkey={ `legend-${ label.text }-${ i }` }\n\t\t\t\t\t\t\t\t\tmargin={ itemMargin }\n\t\t\t\t\t\t\t\t\tflexDirection={\n\t\t\t\t\t\t\t\t\t\torientation === 'vertical' && alignment === 'end'\n\t\t\t\t\t\t\t\t\t\t\t? 'row-reverse'\n\t\t\t\t\t\t\t\t\t\t\t: itemDirection\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonClick={ handleClick }\n\t\t\t\t\t\t\t\t\tonKeyDown={ handleKeyDown }\n\t\t\t\t\t\t\t\t\trole={ interactive ? 'button' : 'listitem' }\n\t\t\t\t\t\t\t\t\ttabIndex={ interactive ? 0 : undefined }\n\t\t\t\t\t\t\t\t\taria-pressed={ interactive ? visible : undefined }\n\t\t\t\t\t\t\t\t\taria-label={ getLegendItemAriaLabel(\n\t\t\t\t\t\t\t\t\t\tlabel.text,\n\t\t\t\t\t\t\t\t\t\tmatchedItem?.value,\n\t\t\t\t\t\t\t\t\t\tvisible,\n\t\t\t\t\t\t\t\t\t\tinteractive\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ items[ i ]?.renderGlyph ? (\n\t\t\t\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\t\t\t\twidth={ items[ i ]?.glyphSize * 2 }\n\t\t\t\t\t\t\t\t\t\t\theight={ items[ i ]?.glyphSize * 2 }\n\t\t\t\t\t\t\t\t\t\t\tdata-testid=\"legend-glyph\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<Group>\n\t\t\t\t\t\t\t\t\t\t\t\t{ items[ i ]?.renderGlyph( {\n\t\t\t\t\t\t\t\t\t\t\t\t\tkey: `legend-glyph-${ label.text }`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tdatum: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex: i,\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolor: fill( label ),\n\t\t\t\t\t\t\t\t\t\t\t\t\tsize: items[ i ]?.glyphSize,\n\t\t\t\t\t\t\t\t\t\t\t\t\tx: items[ i ]?.glyphSize,\n\t\t\t\t\t\t\t\t\t\t\t\t\ty: items[ i ]?.glyphSize,\n\t\t\t\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t\t\t\t</Group>\n\t\t\t\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<LegendShape\n\t\t\t\t\t\t\t\t\t\t\tshape={ shape }\n\t\t\t\t\t\t\t\t\t\t\theight={ shapeHeight }\n\t\t\t\t\t\t\t\t\t\t\twidth={ shapeWidth }\n\t\t\t\t\t\t\t\t\t\t\tmargin={ shapeMargin }\n\t\t\t\t\t\t\t\t\t\t\titem={ domain[ i ] }\n\t\t\t\t\t\t\t\t\t\t\titemIndex={ i }\n\t\t\t\t\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\t\t\t\t\tfill={ fill }\n\t\t\t\t\t\t\t\t\t\t\tsize={ size }\n\t\t\t\t\t\t\t\t\t\t\tshapeStyle={ getShapeStyle }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t<LegendLabel\n\t\t\t\t\t\t\t\t\t\tdata-testid=\"legend-label\"\n\t\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t\t'visx-legend-label',\n\t\t\t\t\t\t\t\t\t\t\tstyles[ 'legend-item-label' ],\n\t\t\t\t\t\t\t\t\t\t\tlabelClassName\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\t\tflex: labelFlex,\n\t\t\t\t\t\t\t\t\t\t\tmargin: labelMargin,\n\t\t\t\t\t\t\t\t\t\t\t...theme.legend?.labelStyles,\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Stack align=\"center\" gap=\"sm\" justify={ labelJustifyContent }>\n\t\t\t\t\t\t\t\t\t\t\t<LegendText\n\t\t\t\t\t\t\t\t\t\t\t\ttext={ label.text }\n\t\t\t\t\t\t\t\t\t\t\t\ttextOverflow={ textOverflow }\n\t\t\t\t\t\t\t\t\t\t\t\tmaxWidth={ maxWidth }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t{ matchedItem?.value != null && matchedItem.value !== '' && (\n\t\t\t\t\t\t\t\t\t\t\t\t<span className={ styles[ 'legend-item-value' ] }>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ '\\u00A0' }\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ matchedItem.value }\n\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t\t\t</LegendLabel>\n\t\t\t\t\t\t\t\t</LegendItem>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t</Stack>\n\t\t\t\t) }\n\t\t\t</LegendOrdinal>\n\t\t);\n\t}\n);\n","import { useContext, useMemo, forwardRef } from 'react';\nimport { ChartInstanceContext } from '../../charts/private/chart-instance-context';\nimport { GlobalChartsContext } from '../../providers';\nimport { BaseLegend } from './private';\nimport type { LegendProps } from './types';\nimport type { ChartType, LegendShape } from '../../types';\n\nconst defaultShapeByChartType: Partial<\n\tRecord< ChartType, Extract< LegendShape< unknown, unknown >, string > >\n> = {\n\tarea: 'rect',\n\tline: 'line',\n\tbar: 'rect',\n\tpie: 'circle',\n\t'pie-semi-circle': 'circle',\n\tleaderboard: 'circle',\n};\n\nexport const Legend = forwardRef< HTMLDivElement, LegendProps >(\n\t( { chartId, items, shape, ...props }, ref ) => {\n\t\t// Get context but don't throw if it doesn't exist\n\t\tconst context = useContext( GlobalChartsContext );\n\t\tconst chartInstanceContext = useContext( ChartInstanceContext );\n\n\t\t// When chartId is used, it is standalone mode\n\t\t// When chartId is not provided, we use the context's chartId, meaning it is inside a chart instance\n\t\tconst contextChartId = chartId ?? chartInstanceContext?.chartId;\n\n\t\tconst chartData = useMemo(\n\t\t\t() => ( contextChartId && context ? context.getChartData( contextChartId ) : undefined ),\n\t\t\t[ contextChartId, context ]\n\t\t);\n\n\t\tconst contextItems = chartData?.legendItems;\n\n\t\t// Derive the default legend shape from the chart type when no explicit shape is provided\n\t\tconst resolvedShape =\n\t\t\tshape ??\n\t\t\t( chartData?.chartType ? defaultShapeByChartType[ chartData.chartType ] : undefined );\n\n\t\t// Provided items take precedence over context items\n\t\tconst legendItems = ( items || contextItems ) as typeof items;\n\n\t\tif ( ! legendItems ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<BaseLegend\n\t\t\t\tref={ ref }\n\t\t\t\titems={ legendItems }\n\t\t\t\tshape={ resolvedShape }\n\t\t\t\t{ ...props }\n\t\t\t\tchartId={ contextChartId }\n\t\t\t/>\n\t\t);\n\t}\n);\n","import { formatNumber } from '@automattic/number-formatters';\nimport { useMemo } from 'react';\nimport {\n\tuseGlobalChartsContext,\n\ttype GetElementStylesParams,\n\ttype ElementStyles,\n} from '../../../providers';\nimport { formatPercentage } from '../../../utils';\nimport type {\n\tSeriesData,\n\tDataPointDate,\n\tDataPointPercentageCalculated,\n\tLegendShape,\n} from '../../../types';\nimport type { BaseLegendItem } from '../types';\nimport type { GlyphProps } from '@visx/xychart';\nimport type { ReactNode } from 'react';\n\nexport type LegendValueDisplay = 'percentage' | 'value' | 'valueDisplay' | 'none';\n\nexport interface ChartLegendOptions {\n\twithGlyph?: boolean;\n\tglyphSize?: number;\n\trenderGlyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode;\n\tshowValues?: boolean;\n\tlegendValueDisplay?: LegendValueDisplay;\n\tlegendShape?: LegendShape< SeriesData[], number >;\n\t/**\n\t * Collapse series that share a `group` into a single legend item, labelled by the group's\n\t * primary series. Off by default, so every series gets its own item.\n\t */\n\tcollapseGroups?: boolean;\n}\n\n/**\n * Formats the value for a data point based on its type and display preference\n * @param point - The data point to format\n * @param showValues - Whether to show values or return empty string\n * @param legendValueDisplay - What type of value to display\n * @return Formatted value string\n */\nfunction formatPointValue(\n\tpoint: DataPointDate | DataPointPercentageCalculated,\n\tshowValues: boolean,\n\tlegendValueDisplay: LegendValueDisplay = 'percentage'\n): string {\n\tif ( ! showValues || legendValueDisplay === 'none' ) {\n\t\treturn '';\n\t}\n\n\t// Handle DataPointPercentageCalculated (pie chart data with calculated percentage)\n\tif ( 'percentage' in point ) {\n\t\tswitch ( legendValueDisplay ) {\n\t\t\tcase 'percentage':\n\t\t\t\treturn formatPercentage( point.percentage );\n\t\t\tcase 'value':\n\t\t\t\treturn formatNumber( point.value );\n\t\t\tcase 'valueDisplay':\n\t\t\t\treturn point.valueDisplay || formatNumber( point.value );\n\t\t\tdefault:\n\t\t\t\treturn '';\n\t\t}\n\t}\n\n\t// Handle DataPointDate (time series data)\n\tif ( 'value' in point ) {\n\t\treturn point.value !== null ? formatNumber( point.value ) : '';\n\t}\n\n\treturn '';\n}\n\n/**\n * Applies glyph configuration to a legend item if needed\n * @param baseItem - The base legend item\n * @param withGlyph - Whether to include glyph rendering\n * @param glyph - Glyph component from theme\n * @param renderGlyph - Custom glyph render function\n * @param glyphSize - Size of the glyph\n * @return The legend item with glyph configuration applied if applicable\n */\nfunction applyGlyphToLegendItem(\n\tbaseItem: BaseLegendItem,\n\twithGlyph: boolean,\n\tglyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode,\n\trenderGlyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode,\n\tglyphSize?: number\n): BaseLegendItem {\n\tif ( withGlyph ) {\n\t\tconst glyphToUse = glyph || renderGlyph;\n\t\tif ( glyphToUse ) {\n\t\t\treturn {\n\t\t\t\t...baseItem,\n\t\t\t\tglyphSize,\n\t\t\t\trenderGlyph: glyphToUse,\n\t\t\t};\n\t\t}\n\t}\n\n\treturn baseItem;\n}\n\ntype SeriesGroupMember = { series: SeriesData; index: number };\n\n/**\n * Buckets series by their `group`, preserving first-appearance order. Series with no group — or a\n * group value unique to them — end up in a bucket of their own. Whether a multi-series bucket then\n * collapses to a single legend item is decided by the caller: with `collapseGroups` on, every\n * multi-member bucket collapses, and the comparison pattern only decides which member represents it.\n * @param seriesData - The series data to group\n * @return Ordered groups, each holding its member series with their original indices\n */\nfunction groupSeriesForLegend( seriesData: SeriesData[] ): SeriesGroupMember[][] {\n\tconst groups: SeriesGroupMember[][] = [];\n\tconst groupIndexByKey = new Map< string, number >();\n\n\tseriesData.forEach( ( series, index ) => {\n\t\tconst member: SeriesGroupMember = { series, index };\n\t\tconst key = series.group;\n\n\t\tif ( key === undefined ) {\n\t\t\tgroups.push( [ member ] );\n\t\t\treturn;\n\t\t}\n\n\t\tconst existing = groupIndexByKey.get( key );\n\t\tif ( existing === undefined ) {\n\t\t\tgroupIndexByKey.set( key, groups.length );\n\t\t\tgroups.push( [ member ] );\n\t\t} else {\n\t\t\tgroups[ existing ].push( member );\n\t\t}\n\t} );\n\n\treturn groups;\n}\n\n/**\n * Builds a single legend item from a representative series, tagging it with the series it controls\n * @param member - The series (with its original index) that provides the label/colour\n * @param seriesLabels - Every series label this item toggles (grouped) or just its own\n * @param getElementStyles - Function to get element styles\n * @param showValues - Whether to show values in legend\n * @param withGlyph - Whether to include glyph rendering\n * @param glyphSize - Size of the glyph\n * @param renderGlyph - Component to render the glyph\n * @param legendShape - The shape type for legend items (string literal or React component)\n * @return The processed legend item\n */\nfunction buildSeriesLegendItem(\n\tmember: SeriesGroupMember,\n\tseriesLabels: string[],\n\tgetElementStyles: ( params: GetElementStylesParams ) => ElementStyles,\n\tshowValues: boolean,\n\twithGlyph: boolean,\n\tglyphSize: number,\n\trenderGlyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode,\n\tlegendShape?: LegendShape< SeriesData[], number >\n): BaseLegendItem {\n\tconst { color, glyph, shapeStyles } = getElementStyles( {\n\t\tdata: member.series,\n\t\tindex: member.index,\n\t\tlegendShape,\n\t} );\n\n\tconst baseItem: BaseLegendItem = {\n\t\tlabel: member.series.label,\n\t\tvalue: showValues ? member.series.data?.length?.toString() || '0' : '',\n\t\tcolor,\n\t\tshapeStyle: shapeStyles,\n\t\tseriesLabels,\n\t};\n\n\treturn applyGlyphToLegendItem( baseItem, withGlyph, glyph, renderGlyph, glyphSize );\n}\n\n/**\n * Processes SeriesData into legend items. Every series keeps its own legend entry unless\n * `collapseGroups` is set, in which case series sharing a `group` collapse to one item labelled by\n * the group's primary (its first non-comparison member).\n * @param seriesData - The series data to process\n * @param getElementStyles - Function to get element styles\n * @param showValues - Whether to show values in legend\n * @param withGlyph - Whether to include glyph rendering\n * @param glyphSize - Size of the glyph\n * @param collapseGroups - Whether series sharing a group collapse to a single item\n * @param renderGlyph - Component to render the glyph\n * @param legendShape - The shape type for legend items (string literal or React component)\n * @return Array of processed legend items\n */\nfunction processSeriesData(\n\tseriesData: SeriesData[],\n\tgetElementStyles: ( params: GetElementStylesParams ) => ElementStyles,\n\tshowValues: boolean,\n\twithGlyph: boolean,\n\tglyphSize: number,\n\tcollapseGroups: boolean,\n\trenderGlyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode,\n\tlegendShape?: LegendShape< SeriesData[], number >\n): BaseLegendItem[] {\n\tconst buildItem = ( member: SeriesGroupMember, seriesLabels: string[] ) =>\n\t\tbuildSeriesLegendItem(\n\t\t\tmember,\n\t\t\tseriesLabels,\n\t\t\tgetElementStyles,\n\t\t\tshowValues,\n\t\t\twithGlyph,\n\t\t\tglyphSize,\n\t\t\trenderGlyph,\n\t\t\tlegendShape\n\t\t);\n\n\t// Without collapsing there is no reason to bucket by group — mapping series directly keeps the\n\t// original order, which matters for charts that already interleave grouped series for colour.\n\tif ( ! collapseGroups ) {\n\t\treturn seriesData.map( ( series, index ) => buildItem( { series, index }, [ series.label ] ) );\n\t}\n\n\treturn groupSeriesForLegend( seriesData ).flatMap( members => {\n\t\tif ( members.length > 1 ) {\n\t\t\tconst primary =\n\t\t\t\tmembers.find( ( { series } ) => series.options?.type !== 'comparison' ) ?? members[ 0 ];\n\n\t\t\t// Primary first so the interactive visibility check reads the series that owns the swatch.\n\t\t\tconst seriesLabels = [\n\t\t\t\tprimary.series.label,\n\t\t\t\t...members.filter( member => member !== primary ).map( ( { series } ) => series.label ),\n\t\t\t];\n\n\t\t\treturn [ buildItem( primary, seriesLabels ) ];\n\t\t}\n\n\t\treturn members.map( member => buildItem( member, [ member.series.label ] ) );\n\t} );\n}\n\n/**\n * Processes point data into legend items\n * @param pointData - The point data to process\n * @param getElementStyles - Function to get element styles\n * @param showValues - Whether to show values in legend\n * @param legendValueDisplay - What type of value to display\n * @param withGlyph - Whether to include glyph rendering\n * @param glyphSize - Size of the glyph\n * @param renderGlyph - Component to render the glyph\n * @param legendShape - The shape type for legend items (string literal or React component)\n * @return Array of processed legend items\n */\nfunction processPointData(\n\tpointData: ( DataPointDate | DataPointPercentageCalculated )[],\n\tgetElementStyles: ( params: GetElementStylesParams ) => ElementStyles,\n\tshowValues: boolean,\n\tlegendValueDisplay: LegendValueDisplay,\n\twithGlyph: boolean,\n\tglyphSize: number,\n\trenderGlyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode,\n\tlegendShape?: LegendShape< SeriesData[], number >\n): BaseLegendItem[] {\n\tconst mapper = ( point: DataPointDate | DataPointPercentageCalculated, index: number ) => {\n\t\tconst { color, glyph, shapeStyles } = getElementStyles( {\n\t\t\tdata: point as DataPointPercentageCalculated,\n\t\t\tindex,\n\t\t\tlegendShape,\n\t\t} );\n\n\t\tconst baseItem: BaseLegendItem = {\n\t\t\tlabel: point.label,\n\t\t\tvalue: formatPointValue( point, showValues, legendValueDisplay ),\n\t\t\tcolor,\n\t\t\tshapeStyle: shapeStyles,\n\t\t};\n\n\t\treturn applyGlyphToLegendItem( baseItem, withGlyph, glyph, renderGlyph, glyphSize );\n\t};\n\n\treturn pointData.map( mapper );\n}\n\n/**\n * Hook to transform chart data into legend items\n * @param data - The chart data to transform\n * @param options - Configuration options for legend generation\n * @param legendShape - The shape type for legend items (string literal or React component)\n * @return Array of legend items ready for display\n */\nexport function useChartLegendItems<\n\tT extends SeriesData[] | DataPointDate[] | DataPointPercentageCalculated[],\n>(\n\tdata: T,\n\toptions: ChartLegendOptions = {},\n\tlegendShape?: LegendShape< SeriesData[], number >\n): BaseLegendItem[] {\n\tconst {\n\t\tshowValues = false,\n\t\tlegendValueDisplay = 'percentage',\n\t\twithGlyph = false,\n\t\tglyphSize = 8,\n\t\tcollapseGroups = false,\n\t\trenderGlyph,\n\t} = options;\n\tconst { getElementStyles } = useGlobalChartsContext();\n\n\treturn useMemo( () => {\n\t\tif ( ! data || ! Array.isArray( data ) || data.length === 0 ) {\n\t\t\treturn [];\n\t\t}\n\n\t\t// Handle SeriesData (multiple series with data points)\n\t\tif ( 'data' in data[ 0 ] ) {\n\t\t\treturn processSeriesData(\n\t\t\t\tdata as SeriesData[],\n\t\t\t\tgetElementStyles,\n\t\t\t\tshowValues,\n\t\t\t\twithGlyph,\n\t\t\t\tglyphSize,\n\t\t\t\tcollapseGroups,\n\t\t\t\trenderGlyph,\n\t\t\t\tlegendShape\n\t\t\t);\n\t\t}\n\n\t\t// Handle DataPointDate or DataPointPercentageCalculated (single data points)\n\t\treturn processPointData(\n\t\t\tdata as ( DataPointDate | DataPointPercentageCalculated )[],\n\t\t\tgetElementStyles,\n\t\t\tshowValues,\n\t\t\tlegendValueDisplay,\n\t\t\twithGlyph,\n\t\t\tglyphSize,\n\t\t\trenderGlyph,\n\t\t\tlegendShape\n\t\t);\n\t}, [\n\t\tdata,\n\t\tgetElementStyles,\n\t\tshowValues,\n\t\tlegendValueDisplay,\n\t\twithGlyph,\n\t\tglyphSize,\n\t\tcollapseGroups,\n\t\trenderGlyph,\n\t\tlegendShape,\n\t] );\n}\n","import { formatNumber } from '@automattic/number-formatters';\nimport clsx from 'clsx';\nimport { useStandaloneScopeClass } from '../../providers/chart-scope';\nimport styles from './base-tooltip.module.scss';\nimport type { CSSProperties, ComponentType, ReactNode } from 'react';\n\ntype TooltipData = {\n\tlabel: string;\n\tvalue: number;\n\tvalueDisplay?: string;\n};\n\ntype TooltipComponentProps = {\n\tdata: TooltipData;\n\tclassName?: string;\n};\n\ntype TooltipCommonProps = {\n\ttop: number;\n\tleft: number;\n\tstyle?: CSSProperties;\n\tclassName?: string;\n\t/**\n\t * Whether to render the tooltip container div. When false, only renders the content.\n\t * Useful when the tooltip is rendered inside a portal or custom container.\n\t * @default true\n\t */\n\trenderContainer?: boolean;\n};\n\ntype DefaultDataTooltip = {\n\tdata: TooltipData;\n\tcomponent?: ComponentType< TooltipComponentProps >;\n\tchildren?: never;\n};\n\ntype CustomTooltip = {\n\tchildren: ReactNode;\n\tdata?: never;\n\tcomponent?: never;\n};\n\ntype BaseTooltipProps = TooltipCommonProps & ( DefaultDataTooltip | CustomTooltip );\n\nconst DefaultTooltipContent = ( { data }: TooltipComponentProps ) => (\n\t<>\n\t\t{ data?.label }: { data?.valueDisplay || formatNumber( data?.value ) }\n\t</>\n);\n\nexport const BaseTooltip = ( {\n\tdata,\n\ttop,\n\tleft,\n\tcomponent: Component = DefaultTooltipContent,\n\tchildren,\n\tclassName,\n\tstyle,\n\trenderContainer = true,\n}: BaseTooltipProps ) => {\n\tconst content = children || ( data && <Component data={ data } className={ className } /> );\n\tconst standaloneScopeClass = useStandaloneScopeClass();\n\n\tif ( ! renderContainer ) {\n\t\treturn content;\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx( standaloneScopeClass, styles.tooltip ) }\n\t\t\tstyle={ { top, left, ...style } }\n\t\t\trole=\"tooltip\"\n\t\t>\n\t\t\t{ content }\n\t\t</div>\n\t);\n};\n\nexport type { BaseTooltipProps, TooltipData };\n","import { Tooltip, TooltipContext } from '@visx/xychart';\nimport clsx from 'clsx';\nimport { useContext, useEffect, useCallback, useMemo, useRef } from 'react';\nimport { CHART_SCOPE_CLASS } from '../../styles/chart-scope-class';\nimport type { SeriesData, DataPointDate } from '../../types';\nimport type { RenderTooltipParams, XyChartTooltipProps } from '../../visx/types';\nimport type { ReactNode } from 'react';\n\n// Type for flattened tooltip data used in individual mode\nexport type FlattenedTooltipData = {\n\tdatum: DataPointDate;\n\tseriesLabel: string;\n\tseriesIndex: number;\n\tdataPointIndex: number;\n};\n\n// Enhanced tooltip with keyboard navigation and accessibility\ninterface AccessibleTooltipProps\n\textends Omit< XyChartTooltipProps< DataPointDate >, 'renderTooltip' > {\n\trenderTooltip?: ( params: RenderTooltipParams< DataPointDate > ) => ReactNode;\n\tselectedIndex?: number | undefined;\n\ttooltipRef?: ( element: HTMLDivElement | null ) => void;\n\tkeyboardFocusedClassName?: string;\n\t/**\n\t * Flattened tooltip data prepared by parent component\n\t * Each index corresponds to one tooltip to show\n\t */\n\ttooltipData?: FlattenedTooltipData[];\n\t/**\n\t * For line charts: series data to show all series at selected data point\n\t * When provided, shows all series instead of individual tooltips\n\t */\n\tseries?: SeriesData[];\n\t/**\n\t * Whether to combine tooltip information from multiple series into a single tooltip. This is useful for line charts.\n\t * Or to show individual tooltips for each series. This is useful for bar charts.\n\t */\n\tmode?: 'individual' | 'group';\n}\n\nexport const AccessibleTooltip: React.FC< AccessibleTooltipProps > = ( {\n\trenderTooltip,\n\tselectedIndex,\n\ttooltipRef,\n\tkeyboardFocusedClassName,\n\tseries = [],\n\tmode = 'group',\n\t...props\n} ) => {\n\tconst tooltipContext = useContext( TooltipContext );\n\n\tconst tooltipData = useMemo( () => {\n\t\tif ( mode !== 'individual' ) return [];\n\t\tif ( series.length === 0 ) return [];\n\n\t\tconst maxDataPoints = Math.max( ...series.map( s => s.data.length ) );\n\t\tconst flattened: Array< {\n\t\t\tdatum: DataPointDate;\n\t\t\tseriesLabel: string;\n\t\t\tseriesIndex: number;\n\t\t\tdataPointIndex: number;\n\t\t} > = [];\n\n\t\t// Pattern: [series1[0], series2[0], series3[0], series1[1], series2[1], series3[1], ...]\n\t\tfor ( let dataPointIndex = 0; dataPointIndex < maxDataPoints; dataPointIndex++ ) {\n\t\t\tfor ( let seriesIndex = 0; seriesIndex < series.length; seriesIndex++ ) {\n\t\t\t\tconst seriesData = series[ seriesIndex ];\n\t\t\t\tif ( dataPointIndex < seriesData.data.length ) {\n\t\t\t\t\tflattened.push( {\n\t\t\t\t\t\tdatum: seriesData.data[ dataPointIndex ] as DataPointDate,\n\t\t\t\t\t\tseriesLabel: seriesData.label,\n\t\t\t\t\t\tseriesIndex,\n\t\t\t\t\t\tdataPointIndex,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn flattened;\n\t}, [ series, mode ] );\n\n\t// Tracks whether this effect opened a tooltip, so it only closes its own.\n\tconst hasKeyboardSelection = useRef( false );\n\n\t// Handle tooltip highlighting for keyboard navigation\n\tuseEffect( () => {\n\t\tif ( selectedIndex === undefined ) {\n\t\t\t// visx debounces the hide and cancels only the most recently scheduled one,\n\t\t\t// so hiding on every run leaves earlier hides pending. One of those lands\n\t\t\t// mid-navigation and closes the tooltip the user is reading.\n\t\t\tif ( hasKeyboardSelection.current ) {\n\t\t\t\thasKeyboardSelection.current = false;\n\t\t\t\ttooltipContext?.hideTooltip();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\thasKeyboardSelection.current = true;\n\n\t\tif ( mode === 'group' ) {\n\t\t\t// Show all series at the selected data point index in single tooltip.\n\t\t\tseries.forEach( ( s, index ) => {\n\t\t\t\tif ( selectedIndex < s.data.length ) {\n\t\t\t\t\tconst datum = s.data[ selectedIndex ];\n\n\t\t\t\t\ttooltipContext?.showTooltip( {\n\t\t\t\t\t\tdatum,\n\t\t\t\t\t\tkey: s.label,\n\t\t\t\t\t\tindex,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t} else if ( mode === 'individual' ) {\n\t\t\t// Show individual tooltips for each datapoint from each series.\n\t\t\tif ( selectedIndex < tooltipData.length ) {\n\t\t\t\tconst tooltipItem = tooltipData[ selectedIndex ];\n\n\t\t\t\ttooltipContext?.showTooltip( {\n\t\t\t\t\tdatum: tooltipItem.datum,\n\t\t\t\t\tkey: tooltipItem.seriesLabel,\n\t\t\t\t\tindex: tooltipItem.seriesIndex,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\n\t\t// Don't include tooltipContext in the dependency array to avoid loop.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ selectedIndex, tooltipData, series ] );\n\n\t// Create a focusable renderTooltip that includes accessibility features\n\tconst focusableRenderTooltip = useMemo( () => {\n\t\tif ( ! renderTooltip ) return undefined;\n\n\t\treturn ( params: RenderTooltipParams< DataPointDate > ) => {\n\t\t\tconst tooltipContent = renderTooltip( params );\n\n\t\t\tif ( selectedIndex !== undefined ) {\n\t\t\t\treturn (\n\t\t\t\t\t<div\n\t\t\t\t\t\tref={ tooltipRef }\n\t\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t\t\trole=\"tooltip\"\n\t\t\t\t\t\taria-atomic=\"true\"\n\t\t\t\t\t\tclassName={ clsx( CHART_SCOPE_CLASS, keyboardFocusedClassName ) }\n\t\t\t\t\t\tdata-testid={ `chart-tooltip-${ selectedIndex }` }\n\t\t\t\t\t\tkey={ `chart-tooltip-${ selectedIndex }` }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ tooltipContent }\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<div className={ CHART_SCOPE_CLASS } role=\"tooltip\" aria-live=\"polite\">\n\t\t\t\t\t{ tooltipContent }\n\t\t\t\t</div>\n\t\t\t);\n\t\t};\n\t}, [ renderTooltip, selectedIndex, tooltipRef, keyboardFocusedClassName ] );\n\n\treturn <Tooltip { ...props } renderTooltip={ focusableRenderTooltip } />;\n};\n\n// Keyboard navigation hook for charts\ninterface UseKeyboardNavigationProps {\n\tselectedIndex: number | undefined;\n\tsetSelectedIndex: ( index: number | undefined ) => void;\n\tisNavigating: boolean;\n\tsetIsNavigating: ( navigating: boolean ) => void;\n\tchartRef: React.RefObject< HTMLDivElement >;\n\t/**\n\t * Total number of navigation points (length of tooltip data array)\n\t */\n\ttotalPoints: number;\n}\n\nexport const useKeyboardNavigation = ( {\n\tselectedIndex,\n\tsetSelectedIndex,\n\tisNavigating,\n\tsetIsNavigating,\n\tchartRef,\n\ttotalPoints,\n}: UseKeyboardNavigationProps ) => {\n\t// Focus the tooltip as soon as it is rendered\n\tconst tooltipRef = useCallback(\n\t\t( element: HTMLDivElement | null ) => {\n\t\t\tif ( element && selectedIndex !== undefined ) {\n\t\t\t\telement.focus();\n\t\t\t}\n\t\t},\n\t\t[ selectedIndex ]\n\t);\n\n\t// On each focus of chart, reset the selectedIndex to 0, if keyboard navigation is not already active\n\tconst onChartFocus = useCallback( () => {\n\t\tif ( ! isNavigating && selectedIndex !== undefined ) {\n\t\t\tsetSelectedIndex( 0 );\n\t\t}\n\t}, [ isNavigating, selectedIndex, setSelectedIndex ] );\n\n\t// On each blur of chart, keyboard navigation should restart from first tooltip\n\tconst onChartBlur = useCallback( () => {\n\t\tsetIsNavigating( false );\n\t}, [ setIsNavigating ] );\n\n\tconst onChartKeyDown = useCallback(\n\t\t( event: React.KeyboardEvent< HTMLDivElement > ) => {\n\t\t\tif ( totalPoints === 0 ) return;\n\n\t\t\t// Keep focus on the chart if tab is pressed\n\t\t\tif ( event.key === 'Tab' ) {\n\t\t\t\tchartRef.current?.focus();\n\t\t\t\tsetSelectedIndex( undefined );\n\t\t\t\tsetIsNavigating( false );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst currentSelectedIndex = selectedIndex === undefined ? -1 : selectedIndex;\n\n\t\t\tif ( currentSelectedIndex + 1 >= totalPoints && [ 'ArrowRight' ].includes( event.key ) ) {\n\t\t\t\tchartRef.current?.focus();\n\t\t\t\tsetSelectedIndex( undefined );\n\t\t\t\tsetIsNavigating( false );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tevent.preventDefault();\n\n\t\t\tif ( [ 'ArrowRight' ].includes( event.key ) ) {\n\t\t\t\tsetIsNavigating( true );\n\t\t\t\tsetSelectedIndex( ( currentSelectedIndex + 1 ) % totalPoints );\n\t\t\t} else if ( [ 'ArrowLeft' ].includes( event.key ) ) {\n\t\t\t\tsetIsNavigating( true );\n\t\t\t\tsetSelectedIndex( ( currentSelectedIndex - 1 + totalPoints ) % totalPoints );\n\t\t\t} else if ( event.key === 'Escape' ) {\n\t\t\t\tsetSelectedIndex( undefined );\n\t\t\t\tsetIsNavigating( false );\n\t\t\t\tchartRef.current?.focus();\n\t\t\t}\n\t\t},\n\t\t[ totalPoints, selectedIndex, setSelectedIndex, setIsNavigating, chartRef ]\n\t);\n\n\treturn {\n\t\ttooltipRef,\n\t\tonChartFocus,\n\t\tonChartBlur,\n\t\tonChartKeyDown,\n\t};\n};\n\n// Re-export the base Tooltip for backwards compatibility\nexport { Tooltip };\n","import { useEffect, useLayoutEffect, useMemo, useRef } from 'react';\nimport { useGlobalChartsContext } from './use-global-charts-context';\n\n// Hide seeded series before paint without triggering React's SSR warning.\nconst useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;\n\n/**\n * Seeds a chart's hidden series once per chart ID, the first time the provider\n * sees that ID.\n *\n * The provider owns the record of what has been seeded, not this hook: a\n * mount-scoped one would re-apply the defaults on every remount, and a chart\n * remounts for reasons the reader never thinks of as a new chart — switching\n * between line and bar, tabbing away and back, a resize flipping tabs into a\n * dropdown. Each of those would throw away the series they had just revealed.\n *\n * @param chartId - The chart ID passed to the provider's visibility methods.\n * @param seriesLabels - Labels to hide when this chart ID is first seen. Later values are ignored.\n * @return The resolved hidden-series set.\n */\nexport const useDefaultHiddenSeries = (\n\tchartId: string,\n\tseriesLabels?: readonly string[]\n): Set< string > => {\n\tconst { getHiddenSeries, seedChartHiddenSeries, hasSeededChart } = useGlobalChartsContext();\n\t// Read through a ref so the effect never depends on a new array identity.\n\tconst labelsRef = useRef( seriesLabels );\n\tlabelsRef.current = seriesLabels;\n\tconst hasSeriesLabels = seriesLabels !== undefined;\n\tconst shouldUseDefaults = hasSeriesLabels && ! hasSeededChart( chartId );\n\n\tuseIsomorphicLayoutEffect( () => {\n\t\tif ( labelsRef.current === undefined ) {\n\t\t\treturn;\n\t\t}\n\t\tseedChartHiddenSeries( chartId, labelsRef.current );\n\t}, [ chartId, hasSeriesLabels, seedChartHiddenSeries ] );\n\n\t// getHiddenSeries hands out a fresh copy per call, so hold the set still between\n\t// visibility changes. Charts derive their rendered series from it, and a new\n\t// identity every render invalidates every memo downstream — including the one\n\t// the accessible tooltip watches, which closes a tooltip mid-navigation.\n\treturn useMemo(\n\t\t() => ( shouldUseDefaults ? new Set( labelsRef.current ) : getHiddenSeries( chartId ) ),\n\t\t[ shouldUseDefaults, getHiddenSeries, chartId ]\n\t);\n};\n","import type { FC, PropsWithChildren } from 'react';\n\n/**\n * Compound component for SVG children in charts.\n * This component serves as a marker for SVG content that should be rendered\n * inside the chart's SVG element. The actual rendering is handled by the parent chart.\n *\n * @param {PropsWithChildren} props - Component props\n * @param {ReactNode} props.children - Child elements to render inside the SVG\n * @return {JSX.Element} The children wrapped in a fragment\n */\nexport const ChartSVG: FC< PropsWithChildren > = ( { children } ) => {\n\t// This component doesn't render directly - its children are extracted by the parent chart\n\t// We just return the children as-is\n\treturn <>{ children }</>;\n};\n\n// Set displayName for better debugging and type checking\nChartSVG.displayName = 'Chart.SVG';\n","import type { FC, PropsWithChildren } from 'react';\n\n/**\n * Compound component for HTML children in charts.\n * This component serves as a marker for HTML content that should be rendered\n * outside the chart's SVG element. The actual rendering is handled by the parent chart.\n *\n * @param {PropsWithChildren} props - Component props\n * @param {ReactNode} props.children - Child elements to render outside the SVG\n * @return {JSX.Element} The children wrapped in a fragment\n */\nexport const ChartHTML: FC< PropsWithChildren > = ( { children } ) => {\n\t// This component doesn't render directly - its children are extracted by the parent chart\n\t// We just return the children as-is\n\treturn <>{ children }</>;\n};\n\n// Set displayName for better debugging and type checking\nChartHTML.displayName = 'Chart.HTML';\n","import { createElement, Fragment } from 'react';\nimport type { LegendChild } from './use-chart-children';\nimport type { LegendPosition } from '../../../types';\nimport type { ReactNode } from 'react';\n\n/**\n * Renders legend children filtered by position slot.\n *\n * @param {LegendChild[]} legendChildren - The legend children to filter and render\n * @param {LegendPosition} position - The position slot to render\n * @return {ReactNode[]} Array of legend elements for the given position\n */\nexport function renderLegendSlot(\n\tlegendChildren: LegendChild[],\n\tposition: LegendPosition\n): ReactNode[] {\n\treturn legendChildren\n\t\t.filter( l => l.position === position )\n\t\t.map( ( l, i ) =>\n\t\t\tcreateElement( Fragment, { key: `legend-${ position }-${ i }` }, l.element )\n\t\t);\n}\n","import { Group } from '@visx/group';\nimport { useMemo, Children, isValidElement } from 'react';\nimport { Legend } from '../../../components/legend';\nimport type { LegendPosition } from '../../../types';\nimport type { ReactElement, ReactNode } from 'react';\n\nexport type LegendChild = {\n\telement: ReactElement;\n\tposition: LegendPosition;\n};\n\ninterface ChartChildren {\n\tsvgChildren: ReactNode[];\n\thtmlChildren: ReactNode[];\n\tlegendChildren: LegendChild[];\n\totherChildren: ReactNode[];\n\t/** All children except Legend, in original order. */\n\tnonLegendChildren: ReactNode[];\n}\n\n/**\n * Custom hook to process and categorize chart children for composition API.\n * Extracts children from compound components (Chart.SVG, Chart.HTML) and\n * maintains backward compatibility with legacy Group components.\n *\n * @param {ReactNode} children - The children prop from the chart component\n * @param {string} chartType - The type of chart (e.g., 'PieChart', 'BarChart')\n * @return {ChartChildren} Categorized children for rendering\n */\nexport function useChartChildren( children: ReactNode, chartType: string ): ChartChildren {\n\treturn useMemo( () => {\n\t\tconst svg: ReactNode[] = [];\n\t\tconst html: ReactNode[] = [];\n\t\tconst legend: LegendChild[] = [];\n\t\tconst other: ReactNode[] = [];\n\t\tconst nonLegend: ReactNode[] = [];\n\n\t\tChildren.forEach( children, child => {\n\t\t\tif ( isValidElement( child ) ) {\n\t\t\t\t// Extract Legend children for position-based slot rendering\n\t\t\t\tif ( child.type === Legend ) {\n\t\t\t\t\tconst rawPosition = child.props?.position;\n\t\t\t\t\tconst position =\n\t\t\t\t\t\trawPosition === 'top' || rawPosition === 'bottom' ? rawPosition : 'bottom';\n\n\t\t\t\t\tlegend.push( { element: child as ReactElement, position } );\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Check displayName for compound components\n\t\t\t\tconst childType = child.type as { displayName?: string };\n\t\t\t\tconst displayName = childType?.displayName;\n\n\t\t\t\t// Handle chart-specific compound components (e.g., PieChart.SVG)\n\t\t\t\tif ( displayName === `${ chartType }.SVG` || displayName === 'Chart.SVG' ) {\n\t\t\t\t\t// Extract children from Chart.SVG with safety checks\n\t\t\t\t\tif ( child.props?.children ) {\n\t\t\t\t\t\tChildren.forEach( child.props.children, svgChild => {\n\t\t\t\t\t\t\tsvg.push( svgChild );\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t} else if ( displayName === `${ chartType }.HTML` || displayName === 'Chart.HTML' ) {\n\t\t\t\t\t// Extract children from Chart.HTML with safety checks\n\t\t\t\t\tif ( child.props?.children ) {\n\t\t\t\t\t\tChildren.forEach( child.props.children, htmlChild => {\n\t\t\t\t\t\t\thtml.push( htmlChild );\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t} else if ( child.type === Group ) {\n\t\t\t\t\t// Legacy support: still check for Group type for backward compatibility\n\t\t\t\t\tsvg.push( child );\n\t\t\t\t} else {\n\t\t\t\t\tother.push( child );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Preserve original order of all non-Legend children\n\t\t\tnonLegend.push( child );\n\t\t} );\n\n\t\treturn {\n\t\t\tsvgChildren: svg,\n\t\t\thtmlChildren: html,\n\t\t\tlegendChildren: legend,\n\t\t\totherChildren: other,\n\t\t\tnonLegendChildren: nonLegend,\n\t\t};\n\t}, [ children, chartType ] );\n}\n","import { Stack } from '@wordpress/ui';\nimport { useEffect } from 'react';\nimport { useElementSize } from '../../../hooks';\nimport { renderLegendSlot } from '../chart-composition';\nimport styles from './chart-layout.module.scss';\nimport type { GapSize, LegendPosition } from '../../../types';\nimport type { LegendChild } from '../chart-composition/use-chart-children';\nimport type { CSSProperties, ReactNode } from 'react';\n\n/**\n * Measurements provided to the render prop when ChartLayout handles resize listening.\n */\nexport interface ContentMeasurements {\n\t/** Measured width of the content area in pixels */\n\tcontentWidth: number;\n\t/** Measured height of the content area in pixels */\n\tcontentHeight: number;\n\t/** True when a non-zero contentHeight measurement is available */\n\tisMeasured: boolean;\n}\n\nexport interface ChartLayoutProps {\n\t/** Position for the prop-based legend element */\n\tlegendPosition: LegendPosition;\n\t/** The legend element rendered via the showLegend prop (false when hidden) */\n\tlegendElement?: ReactNode;\n\t/** Legend children from the composition API */\n\tlegendChildren: LegendChild[];\n\t/** Chart content — either a ReactNode or a render prop receiving content measurements */\n\tchildren: ReactNode | ( ( measurements: ContentMeasurements ) => ReactNode );\n\t/** Content rendered after the bottom legend (e.g., nonLegendChildren, htmlChildren, tooltips) */\n\ttrailingContent?: ReactNode;\n\t/** Called when the measured content height changes (for render-prop mode) */\n\tonContentHeightChange?: ( height: number ) => void;\n\t/** Gap between Stack items */\n\tgap?: GapSize;\n\t/** Additional class names */\n\tclassName?: string;\n\t/** Inline styles (width, height, etc.) */\n\tstyle?: CSSProperties;\n\t/** Test ID for the container */\n\t'data-testid'?: string;\n\t/** Chart ID attribute */\n\t'data-chart-id'?: string;\n}\n\nexport const ChartLayout = ( {\n\tlegendPosition,\n\tlegendElement,\n\tlegendChildren,\n\tchildren,\n\ttrailingContent,\n\tonContentHeightChange,\n\tgap,\n\tclassName,\n\tstyle,\n\t'data-testid': dataTestId,\n\t'data-chart-id': dataChartId,\n}: ChartLayoutProps ) => {\n\tconst [ contentRef, contentWidth, contentHeight ] = useElementSize< HTMLDivElement >();\n\tconst isRenderProp = typeof children === 'function';\n\tconst isMeasured = contentHeight > 0;\n\n\t// When using render-prop children, hide the layout until measurement is available\n\t// to prevent layout shift. Plain ReactNode children don't need this since they\n\t// don't depend on measured dimensions.\n\tconst visibilityStyle: { visibility?: 'hidden' | 'visible' } =\n\t\tisRenderProp && ! isMeasured ? { visibility: 'hidden' } : {};\n\n\tuseEffect( () => {\n\t\tif ( isRenderProp && onContentHeightChange && isMeasured ) {\n\t\t\tonContentHeightChange( contentHeight );\n\t\t}\n\t}, [ isRenderProp, contentHeight, isMeasured, onContentHeightChange ] );\n\tconst renderedChildren = isRenderProp\n\t\t? children( { contentWidth, contentHeight, isMeasured } )\n\t\t: children;\n\n\treturn (\n\t\t<Stack\n\t\t\tdirection=\"column\"\n\t\t\tgap={ gap }\n\t\t\tclassName={ className }\n\t\t\tstyle={ { ...style, ...visibilityStyle } }\n\t\t\tdata-testid={ dataTestId }\n\t\t\tdata-chart-id={ dataChartId }\n\t\t>\n\t\t\t{ legendPosition === 'top' && legendElement }\n\t\t\t{ renderLegendSlot( legendChildren, 'top' ) }\n\n\t\t\t{ isRenderProp ? (\n\t\t\t\t<div ref={ contentRef } className={ styles[ 'chart-layout__content' ] }>\n\t\t\t\t\t{ renderedChildren }\n\t\t\t\t</div>\n\t\t\t) : (\n\t\t\t\trenderedChildren\n\t\t\t) }\n\n\t\t\t{ legendPosition === 'bottom' && legendElement }\n\t\t\t{ renderLegendSlot( legendChildren, 'bottom' ) }\n\n\t\t\t{ trailingContent }\n\t\t</Stack>\n\t);\n};\n","import { DataContext } from '@visx/xychart';\nimport { useContext } from 'react';\nimport type { RenderLineGlyphProps } from '../../line-chart';\n\nexport const DefaultGlyph = < Datum extends object >( props: RenderLineGlyphProps< Datum > ) => {\n\tconst { theme } = useContext( DataContext ) || {};\n\tconst position = props.position || 'start';\n\n\treturn (\n\t\t<circle\n\t\t\tcx={ props.x }\n\t\t\tcy={ props.y }\n\t\t\tr={ props.size }\n\t\t\tfill={ props.color }\n\t\t\tstroke={ theme?.backgroundColor }\n\t\t\tstrokeWidth={ 1.5 }\n\t\t\tpaintOrder=\"fill\"\n\t\t\tdata-testid={ `${ position }-glyph-${ props.index }` }\n\t\t\t{ ...props.glyphStyle }\n\t\t/>\n\t);\n};\n","import { Stack } from '@wordpress/ui';\nimport clsx from 'clsx';\nimport { forwardRef, type ComponentPropsWithoutRef } from 'react';\nimport styles from './center.module.scss';\n\nexport type CenterProps = ComponentPropsWithoutRef< typeof Stack >;\n\n/**\n * Centers its children on both axes and fills its parent.\n *\n * A thin wrapper around `Stack` with `align=\"center\"` and `justify=\"center\"`\n * defaults (both overridable) plus `width: 100%; height: 100%`. Reads more\n * honestly than a `Stack` with both axes centered, and lets call sites drop\n * ad-hoc `*__centering` classes. Forwards its ref and spreads remaining props\n * onto the underlying `Stack`.\n *\n * @param props - Stack props; `align`/`justify` default to `\"center\"`.\n * @param ref - Forwarded to the underlying element.\n * @return The centered layout element.\n */\nexport const Center = forwardRef< HTMLDivElement, CenterProps >(\n\t( { align = 'center', justify = 'center', className, ...props }, ref ) => (\n\t\t<Stack\n\t\t\tref={ ref }\n\t\t\talign={ align }\n\t\t\tjustify={ justify }\n\t\t\tclassName={ clsx( styles.center, className ) }\n\t\t\t{ ...props }\n\t\t/>\n\t)\n);\n\nCenter.displayName = 'Center';\n","import { Center } from '../center';\nimport styles from './svg-empty-state.module.scss';\nimport type { FC, ReactNode } from 'react';\n\ninterface SvgEmptyStateProps {\n\t/** X coordinate of the center point */\n\tx: number;\n\t/** Y coordinate of the center point */\n\ty: number;\n\t/** Available width for the text area */\n\twidth: number;\n\t/** Available height for the text area */\n\theight: number;\n\t/** Text content */\n\tchildren: ReactNode;\n}\n\n/**\n * Renders empty-state text inside an SVG using foreignObject so that the\n * message wraps onto multiple lines instead of being clipped.\n *\n * The component centers the text within the specified area.\n *\n * @param root0 - Component props\n * @param root0.x - X coordinate of the center point\n * @param root0.y - Y coordinate of the center point\n * @param root0.width - Available width for the text area\n * @param root0.height - Available height for the text area\n * @param root0.children - Text content\n * @return {JSX.Element} A foreignObject element containing the centered text.\n */\nexport const SvgEmptyState: FC< SvgEmptyStateProps > = ( { x, y, width, height, children } ) => {\n\treturn (\n\t\t<foreignObject x={ x - width / 2 } y={ y - height / 2 } width={ width } height={ height }>\n\t\t\t<Center className={ styles[ 'svg-empty-state' ] }>{ children }</Center>\n\t\t</foreignObject>\n\t);\n};\n","import { _x } from '@wordpress/i18n';\n\nexport type HiddenChartItemType = 'series' | 'segments';\n\n/**\n * Return the empty-state message for a chart whose items are all hidden.\n *\n * Each translation call has a distinct gettext context. This prevents Terser\n * from folding conditional calls into one call with a conditional msgid, which\n * would make the strings unavailable to static translation extraction.\n *\n * @param interactive - Whether the legend can be used to show hidden items.\n * @param itemType - The chart-specific name for its data items.\n * @return The translated empty-state message.\n */\nexport const getAllHiddenMessage = (\n\tinteractive: boolean,\n\titemType: HiddenChartItemType\n): string => {\n\tif ( itemType === 'segments' ) {\n\t\tif ( interactive ) {\n\t\t\treturn _x(\n\t\t\t\t'All segments are hidden. Click legend items to show data.',\n\t\t\t\t'chart empty state: interactive segments',\n\t\t\t\t'jetpack-charts'\n\t\t\t);\n\t\t}\n\n\t\treturn _x( 'All segments are hidden.', 'chart empty state: segments', 'jetpack-charts' );\n\t}\n\n\tif ( interactive ) {\n\t\treturn _x(\n\t\t\t'All series are hidden. Click legend items to show data.',\n\t\t\t'chart empty state: interactive series',\n\t\t\t'jetpack-charts'\n\t\t);\n\t}\n\n\treturn _x( 'All series are hidden.', 'chart empty state: series', 'jetpack-charts' );\n};\n","import { curveCatmullRom, curveLinear, curveMonotoneX } from '@visx/curve';\nimport { scaleTime } from '@visx/scale';\nimport { differenceInHours, differenceInYears } from 'date-fns';\nimport type { useChartDataTransform } from '../../hooks';\nimport type { TickResolution } from '../../types';\nimport type { CurveType } from '../line-chart/types';\n\n// Approximate min pixel width for an x-axis tick label.\nconst X_TICK_WIDTH = 60;\n\n// Resolve the visx curve generator for a given `curveType` / `smoothing`\n// combination. Shared by LineChart and AreaChart so the two render\n// identically when given the same props.\n//\n// Explicit return type avoids a TS2742 portable-name error in the .d.ts\n// build: the inferred type traces back to `@types/d3-shape` (a transitive\n// dep), but `typeof curveLinear` resolves through `@visx/curve` which we\n// own directly.\nexport const getCurveType = ( type?: CurveType, smoothing?: boolean ): typeof curveLinear => {\n\tif ( ! type ) {\n\t\treturn smoothing ? curveCatmullRom : curveLinear;\n\t}\n\n\tswitch ( type ) {\n\t\tcase 'smooth':\n\t\t\treturn curveCatmullRom;\n\t\tcase 'monotone':\n\t\t\treturn curveMonotoneX;\n\t\tcase 'linear':\n\t\t\treturn curveLinear;\n\t\tdefault:\n\t\t\treturn curveLinear;\n\t}\n};\n\n// Built once and reused: these run per bucket over the whole band domain when\n// the axis picks its tick values, and `toLocaleDateString` rebuilds its\n// formatter on every call once an options object is passed.\nconst dateTimeFormat = ( options: Intl.DateTimeFormatOptions ) => {\n\tlet formatter: Intl.DateTimeFormat;\n\treturn ( timestamp: number ) => {\n\t\t// `Intl.DateTimeFormat` throws on an invalid date where the `Date`\n\t\t// methods it replaces return \"Invalid Date\", and charts are expected to\n\t\t// render past a bad point rather than fail.\n\t\t// visx hands its tick formatter a `Date`, so coerce before the check.\n\t\tif ( ! Number.isFinite( Number( timestamp ) ) ) {\n\t\t\treturn new Date( timestamp ).toLocaleDateString();\n\t\t}\n\t\tformatter = formatter ?? new Intl.DateTimeFormat( undefined, options );\n\t\treturn formatter.format( timestamp );\n\t};\n};\n\nconst formatYearTick = dateTimeFormat( { year: 'numeric' } );\n\nconst formatDateTick = dateTimeFormat( { month: 'short', day: 'numeric' } );\n\nconst formatHourTick = dateTimeFormat( { hour: 'numeric', hour12: true } );\n\nconst formatMonthTick = dateTimeFormat( { month: 'short' } );\n\n/**\n * A tick format, carrying the boundary test that decides its coarser label.\n *\n * A band scale samples by index, so `getBandTickValues` has to steer ticks onto\n * the boundaries a format prints the date or the year at. Hanging the test off\n * the format that branches on it keeps the two from drifting apart.\n */\nexport type TickFormat = ( ( timestamp: number ) => string ) & {\n\tisAnchor?: ( date: Date ) => boolean;\n};\n\nconst boundaryFormat = (\n\tisAnchor: ( date: Date ) => boolean,\n\tatBoundary: ( timestamp: number ) => string,\n\tbetween: ( timestamp: number ) => string\n): TickFormat => {\n\tconst format: TickFormat = ( timestamp: number ) =>\n\t\tisAnchor( new Date( timestamp ) ) ? atBoundary( timestamp ) : between( timestamp );\n\tformat.isAnchor = isAnchor;\n\treturn format;\n};\n\n// Hour ticks with the date at midnight boundaries, so multi-day spans of\n// sub-daily data keep their days identifiable.\nconst formatDateOrHourTick = boundaryFormat(\n\tdate => date.getHours() === 0 && date.getMinutes() === 0,\n\tformatDateTick,\n\tformatHourTick\n);\n\n// Month ticks with the year at January boundaries, for month-or-coarser\n// buckets where a full \"Sep 1\" date would misread as a daily point.\nconst formatMonthOrYearTick = boundaryFormat(\n\tdate => date.getMonth() === 0,\n\tformatYearTick,\n\tformatMonthTick\n);\n\n// Overall time span of the data. Series with no dated points are dropped rather\n// than folded in: an empty comparison series is legitimate, and one undefined\n// bound would turn the whole span into NaN. Null when nothing is dated.\nconst getSpan = ( sortedData: ReturnType< typeof useChartDataTransform > ) => {\n\tconst bounds = sortedData\n\t\t.map( datom => [ datom.data.at( 0 )?.date, datom.data.at( -1 )?.date ] )\n\t\t.filter( ( [ first, last ] ) => first !== undefined && last !== undefined );\n\n\tif ( ! bounds.length ) {\n\t\treturn null;\n\t}\n\n\treturn {\n\t\tminX: Math.min( ...bounds.map( ( [ first ] ) => Number( first ) ) ),\n\t\tmaxX: Math.max( ...bounds.map( ( [ , last ] ) => Number( last ) ) ),\n\t};\n};\n\n// Smallest interval between consecutive points across all series, in hours.\n// Infinity when no series has two points.\nconst getPointSpacingInHours = ( sortedData: ReturnType< typeof useChartDataTransform > ) => {\n\treturn sortedData.reduce(\n\t\t( spacing, datom ) =>\n\t\t\tdatom.data.reduce( ( seriesSpacing, point, index ) => {\n\t\t\t\tconst previous = datom.data[ index - 1 ];\n\t\t\t\tif ( previous?.date === undefined || point?.date === undefined ) {\n\t\t\t\t\treturn seriesSpacing;\n\t\t\t\t}\n\t\t\t\treturn Math.min(\n\t\t\t\t\tseriesSpacing,\n\t\t\t\t\tMath.abs( differenceInHours( point.date, previous.date ) )\n\t\t\t\t);\n\t\t\t}, spacing ),\n\t\tNumber.POSITIVE_INFINITY\n\t);\n};\n\n// 23, not 24: a daily gap shrinks to 23 wall-clock hours across a\n// spring-forward DST transition.\nconst SUB_DAILY_SPACING_HOURS = 23;\n\n// The shortest month, so monthly buckets clear it but weekly ones don't.\nconst MONTHLY_SPACING_HOURS = 28 * 24;\n\n// The bucket size behind the data, as the resolution label the tick formats are\n// keyed on. Exported so consumers that label a single point — bar chart\n// tooltips — read the same classification the axis does instead of inferring\n// the resolution a second way. Weeks report as 'day': both are calendar-date\n// buckets as far as labelling goes.\nexport const getBucketResolution = (\n\tsortedData: ReturnType< typeof useChartDataTransform >,\n\ttickResolution?: TickResolution\n): Exclude< TickResolution, 'week' > => {\n\tif ( tickResolution ) {\n\t\treturn tickResolution === 'week' ? 'day' : tickResolution;\n\t}\n\n\tconst spacingInHours = getPointSpacingInHours( sortedData );\n\tif ( spacingInHours < SUB_DAILY_SPACING_HOURS ) {\n\t\treturn 'hour';\n\t}\n\t// Fewer than two points leaves the spacing unknowable, so fall back to\n\t// calendar dates rather than reading Infinity as a very coarse bucket.\n\tif ( ! Number.isFinite( spacingInHours ) || spacingInHours < MONTHLY_SPACING_HOURS ) {\n\t\treturn 'day';\n\t}\n\t// Twelve shortest months: above any monthly gap (31 days at most) and below\n\t// any yearly one (365 days at least).\n\treturn spacingInHours < 12 * MONTHLY_SPACING_HOURS ? 'month' : 'year';\n};\n\n// Pick the most informative tick formatter for the data's bucket resolution and\n// time span. Month-or-coarser buckets are formatted from the resolution alone —\n// they carry no day to print at any span — while finer buckets narrow with the\n// span: hours within a day, hours with day boundaries for sub-daily data\n// spanning up to a week, calendar dates within a year, otherwise years.\nexport const getFormatter = (\n\tsortedData: ReturnType< typeof useChartDataTransform >,\n\ttickResolution?: TickResolution\n): TickFormat => {\n\tconst resolution = getBucketResolution( sortedData, tickResolution );\n\n\t// The month regime only prints the year at January boundaries, so yearly\n\t// buckets starting mid-year would render as bare month names.\n\tif ( resolution === 'year' ) {\n\t\treturn formatYearTick;\n\t}\n\n\tif ( resolution === 'month' ) {\n\t\treturn formatMonthOrYearTick;\n\t}\n\n\tconst span = getSpan( sortedData );\n\tif ( ! span ) {\n\t\treturn formatDateTick;\n\t}\n\n\tconst diffInHours = Math.abs( differenceInHours( span.maxX, span.minX ) );\n\tif ( resolution === 'hour' ) {\n\t\tif ( diffInHours <= 24 ) {\n\t\t\treturn formatHourTick;\n\t\t}\n\t\tif ( diffInHours <= 24 * 7 ) {\n\t\t\treturn formatDateOrHourTick;\n\t\t}\n\t}\n\n\t// Beyond a year, dates repeat often enough under tick sampling that the year\n\t// is the only part worth printing.\n\treturn Math.abs( differenceInYears( span.maxX, span.minX ) ) <= 1\n\t\t? formatDateTick\n\t\t: formatYearTick;\n};\n\n// Indices of the buckets whose label carries the coarser unit.\nconst getAnchorIndices = ( domain: Date[], isAnchor: ( date: Date ) => boolean ) =>\n\tdomain.reduce< number[] >( ( indices, date, index ) => {\n\t\tif ( isAnchor( date ) ) {\n\t\t\tindices.push( index );\n\t\t}\n\t\treturn indices;\n\t}, [] );\n\n// Index strides worth sampling the domain at. Both roundings of each tick count\n// are needed: flooring alone skips the stride that fits a mid-series anchor on\n// short domains. Anchors add the strides that can land on more than one of them\n// — those dividing their spacing, and the smallest whole multiple that still\n// fits, which carries spans too long for any divisor to reach.\nconst getCandidateSteps = ( length: number, maxTicks: number, anchorSpacing: number | null ) => {\n\tconst steps = new Set< number >();\n\tfor ( let count = maxTicks; count > 1; count-- ) {\n\t\tsteps.add( Math.max( 1, Math.floor( ( length - 1 ) / ( count - 1 ) ) ) );\n\t\tsteps.add( Math.max( 1, Math.ceil( ( length - 1 ) / ( count - 1 ) ) ) );\n\t}\n\n\tif ( anchorSpacing ) {\n\t\tfor ( let divisor = 1; divisor <= anchorSpacing; divisor++ ) {\n\t\t\tif ( anchorSpacing % divisor === 0 ) {\n\t\t\t\tsteps.add( anchorSpacing / divisor );\n\t\t\t}\n\t\t}\n\t\tconst minStep = Math.floor( ( length - 1 ) / Math.max( 1, maxTicks ) ) + 1;\n\t\tsteps.add( Math.ceil( minStep / anchorSpacing ) * anchorSpacing );\n\t}\n\n\treturn steps;\n};\n\n/**\n * Tick values for a band time axis.\n *\n * visx samples a band domain by index from offset zero, blind to which labels\n * carry a boundary and without collapsing repeats — so the tick that prints the\n * year or the date often isn't sampled at all, and a long series can show the\n * same label twice. Choose the values instead: sweep the evenly spaced\n * candidates, including those that step from anchor to anchor, and keep the one\n * that reaches the most anchors without thinning the axis or putting two\n * identical labels side by side.\n *\n * @param domain - Band domain, in axis order.\n * @param tickFormatter - Formatter the axis will render these values with.\n * @param maxTicks - Most ticks the axis should carry.\n * @return Values to hand the axis as `tickValues`.\n */\nexport const getBandTickValues = (\n\tdomain: Date[],\n\ttickFormatter: TickFormat,\n\tmaxTicks: number\n): Date[] => {\n\tif ( ! domain.length ) {\n\t\treturn [];\n\t}\n\n\tconst { isAnchor } = tickFormatter;\n\tconst anchorIndices = isAnchor ? getAnchorIndices( domain, isAnchor ) : [];\n\n\t// Once per bucket rather than once per bucket per candidate: the sweep reads\n\t// the same labels back for every step and offset.\n\tconst domainLabels = domain.map( date => tickFormatter( date.getTime() ) );\n\n\tconst candidates: number[][] = [];\n\tconst consider = ( indices: number[] ) => {\n\t\tif ( ! indices.length || indices.length > maxTicks ) {\n\t\t\treturn;\n\t\t}\n\t\tconst repeats = indices.some(\n\t\t\t( index, position ) =>\n\t\t\t\tposition > 0 && domainLabels[ index ] === domainLabels[ indices[ position - 1 ] ]\n\t\t);\n\t\tif ( ! repeats ) {\n\t\t\tcandidates.push( indices );\n\t\t}\n\t};\n\n\tconst anchorSpacing = anchorIndices.length > 1 ? anchorIndices[ 1 ] - anchorIndices[ 0 ] : null;\n\tfor ( const step of getCandidateSteps( domain.length, maxTicks, anchorSpacing ) ) {\n\t\tfor ( let offset = 0; offset < step; offset++ ) {\n\t\t\tconst indices: number[] = [];\n\t\t\tfor ( let index = offset; index < domain.length; index += step ) {\n\t\t\t\tindices.push( index );\n\t\t\t}\n\t\t\tconsider( indices );\n\t\t}\n\t}\n\n\t// Stepping the anchors themselves rather than the domain, so that anchors an\n\t// uneven number of buckets apart are still all reachable — a wall-clock day\n\t// is 23 buckets of hourly data across a spring-forward DST transition, and a\n\t// fixed stride drifts off midnight for the rest of the span.\n\tfor ( let stride = 1; stride <= anchorIndices.length; stride++ ) {\n\t\tconsider( anchorIndices.filter( ( _, position ) => position % stride === 0 ) );\n\t}\n\n\tif ( ! candidates.length ) {\n\t\treturn [ domain[ 0 ] ];\n\t}\n\n\t// An anchor is worth at most one tick. Ranking anchors above density outright\n\t// collapsed ordinary monthly axes to two ticks — worse than sampling by index,\n\t// which at least stayed dense — while ignoring anchors leaves the year unnamed.\n\tconst densest = candidates.reduce( ( most, indices ) => Math.max( most, indices.length ), 0 );\n\tconst anchorsIn = ( indices: number[] ) =>\n\t\tisAnchor ? indices.filter( index => isAnchor( domain[ index ] ) ).length : 0;\n\n\tconst best = candidates\n\t\t.filter( indices => indices.length >= densest - 1 )\n\t\t.reduce( ( chosen, indices ) => {\n\t\t\tconst gain = anchorsIn( indices ) - anchorsIn( chosen );\n\t\t\treturn gain > 0 || ( gain === 0 && indices.length > chosen.length ) ? indices : chosen;\n\t\t} );\n\n\treturn best.map( index => domain[ index ] );\n};\n\n// Estimate the largest number of x-axis ticks that fit without producing\n// consecutive duplicate labels under the given formatter. Used so the axis\n// adapts to the data's resolution rather than picking a fixed count.\nexport const guessOptimalNumTicks = (\n\tdata: ReturnType< typeof useChartDataTransform >,\n\tchartWidth: number,\n\ttickFormatter: ( timestamp: number, index?: number, values?: unknown ) => string\n) => {\n\tconst span = getSpan( data );\n\tif ( ! span ) {\n\t\treturn 1;\n\t}\n\n\tconst xScale = scaleTime( { domain: [ span.minX, span.maxX ] } );\n\n\tconst upperBound = Math.min(\n\t\tdata[ 0 ]?.data.length || 3,\n\t\tMath.ceil( chartWidth / X_TICK_WIDTH )\n\t);\n\tlet secondBestGuess = 1;\n\n\tfor ( let numTicks = upperBound; numTicks > 1; --numTicks ) {\n\t\tconst ticks = xScale.ticks( numTicks ).map( d => tickFormatter( d.getTime() ) );\n\n\t\tif ( ticks.length > upperBound ) continue;\n\n\t\tsecondBestGuess = Math.max( secondBestGuess, ticks.length );\n\n\t\tconst uniqueTicks = Array.from( new Set( ticks ) );\n\t\tif ( uniqueTicks.length === 1 ) return 1;\n\n\t\tconst hasConsecutiveDuplicate = ticks.some(\n\t\t\t( tick, idx ) => idx > 0 && tick === ticks[ idx - 1 ]\n\t\t);\n\t\tif ( hasConsecutiveDuplicate ) continue;\n\n\t\treturn ticks.length;\n\t}\n\n\treturn secondBestGuess;\n};\n","import { useParentSize } from '@visx/responsive';\nimport clsx from 'clsx';\nimport { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport { ChartScopeContext } from '../../../providers/chart-scope';\nimport styles from './with-responsive.module.scss';\nimport type { BaseChartProps } from '../../../types';\nimport type { ComponentType } from 'react';\n\ntype DimensionProps = {\n\twidth?: number;\n\theight?: number;\n\tsize?: number;\n};\n\nexport type ResponsiveConfig = {\n\t/**\n\t * The maximum width of the chart. Defaults to 1200.\n\t */\n\tmaxWidth?: number;\n\t/**\n\t * The aspect ratio of the chart (height = width * aspectRatio).\n\t * When provided, the chart keeps this ratio and is contained within the\n\t * parent on both axes: it fills the available width and derives its height,\n\t * but if the parent is shorter than that derived height it shrinks both axes\n\t * to fit rather than overflowing. When it is narrower than the parent (the\n\t * height-constrained case) it is centered horizontally.\n\t * When omitted, the chart fills the parent container's height.\n\t */\n\taspectRatio?: number;\n\t/**\n\t * Child render updates upon resize are delayed until debounceTime milliseconds after the last resize event is observed.\n\t */\n\tresizeDebounceTime?: number;\n};\n\n// useLayoutEffect on the client (so containment is resolved before paint, no flash),\n// useEffect on the server to avoid React's SSR warning.\nconst useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;\n\n/**\n * A higher-order component that provides responsive dimensions\n * to the wrapped chart component using useParentSize from `@visx/responsive`.\n *\n * @param WrappedComponent - The chart component to be wrapped.\n * @return A functional component that renders the wrapped component with responsive dimensions.\n */\nexport function withResponsive< T extends Exclude< BaseChartProps< unknown >, 'options' > >( // 'options' is excluded so that each chart can define its own options type\n\tWrappedComponent: ComponentType< T >\n) {\n\treturn function ResponsiveChart( {\n\t\tresizeDebounceTime = 300,\n\t\tmaxWidth = 1200,\n\t\taspectRatio,\n\t\tsize,\n\t\twidth,\n\t\theight,\n\t\t...chartProps\n\t}: Omit< T, 'width' | 'height' | 'size' > & DimensionProps & ResponsiveConfig ) {\n\t\tconst {\n\t\t\tparentRef,\n\t\t\twidth: parentWidth,\n\t\t\theight: parentHeight,\n\t\t} = useParentSize( {\n\t\t\tdebounceTime: resizeDebounceTime,\n\t\t\tenableDebounceLeadingCall: true,\n\t\t} );\n\n\t\tconst hasAspectRatio = aspectRatio !== undefined && aspectRatio > 0;\n\n\t\t// The context needs a re-render when the node attaches; wrapperRef alone cannot provide that, so mirror the node into state from the same callback ref.\n\t\tconst [ scopeNode, setScopeNode ] = useState< HTMLDivElement | null >( null );\n\n\t\t// Keep our own handle on the wrapper so we can read its live height below, and\n\t\t// still hand the node to useParentSize's ref (a callback ref in practice; guard\n\t\t// the object-ref shape too).\n\t\tconst wrapperRef = useRef< HTMLDivElement | null >( null );\n\t\tconst setWrapperRef = useCallback(\n\t\t\t( node: HTMLDivElement | null ) => {\n\t\t\t\twrapperRef.current = node;\n\t\t\t\tsetScopeNode( node );\n\t\t\t\tif ( typeof parentRef === 'function' ) {\n\t\t\t\t\tparentRef( node );\n\t\t\t\t} else if ( parentRef ) {\n\t\t\t\t\t( parentRef as { current: HTMLDivElement | null } ).current = node;\n\t\t\t\t}\n\t\t\t},\n\t\t\t[ parentRef ]\n\t\t);\n\n\t\t// The parent's available height when it actually constrains the chart, else\n\t\t// null (the chart derives its height from width and grows freely).\n\t\tconst [ containedHeight, setContainedHeight ] = useState< number | null >( null );\n\n\t\t// Cap the available width at maxWidth unless an explicit width pins it. Before\n\t\t// measurement resolves, fall back to the explicit width.\n\t\tconst cap = width === undefined ? maxWidth : Infinity;\n\t\tconst availableWidth = parentWidth > 0 ? Math.min( parentWidth, cap ) : width ?? 0;\n\n\t\tlet boxWidth = availableWidth;\n\t\tlet boxHeight: number;\n\t\tif ( hasAspectRatio ) {\n\t\t\tconst derivedHeight = availableWidth * aspectRatio;\n\t\t\tif ( containedHeight !== null && derivedHeight > containedHeight ) {\n\t\t\t\tboxHeight = containedHeight;\n\t\t\t\tboxWidth = boxHeight / aspectRatio;\n\t\t\t} else {\n\t\t\t\tboxHeight = derivedHeight;\n\t\t\t}\n\t\t} else {\n\t\t\tboxHeight = parentHeight > 0 ? parentHeight : height ?? 0;\n\t\t}\n\n\t\t// Decide containment from the wrapper's real height, measured after layout.\n\t\t// useParentSize's height is no good here: with height:100% and no definite\n\t\t// parent height it just echoes our own content back, so clamping against it\n\t\t// would freeze the chart at its current width when the container widens.\n\t\t// Compare the post-layout clientHeight to the height we drew: shorter means the\n\t\t// parent really constrains us → contain to it; equal means it is only our own\n\t\t// content → let it grow. Once contained, stay contained until the parent is tall\n\t\t// enough for the full derived height, so a now-fitting chart doesn't oscillate.\n\t\t// (parentHeight is in the deps only to re-run this; the value used is clientHeight.)\n\t\tuseIsomorphicLayoutEffect( () => {\n\t\t\tif ( ! hasAspectRatio ) {\n\t\t\t\tif ( containedHeight !== null ) {\n\t\t\t\t\tsetContainedHeight( null );\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst available = wrapperRef.current?.clientHeight ?? 0;\n\t\t\tconst derivedHeight = availableWidth * aspectRatio;\n\t\t\tif ( containedHeight === null ) {\n\t\t\t\tif ( available > 0 && derivedHeight > available + 1 ) {\n\t\t\t\t\tsetContainedHeight( available );\n\t\t\t\t}\n\t\t\t} else if ( available >= derivedHeight - 1 ) {\n\t\t\t\tsetContainedHeight( null );\n\t\t\t} else if ( Math.abs( available - containedHeight ) > 1 ) {\n\t\t\t\tsetContainedHeight( available );\n\t\t\t}\n\t\t}, [ hasAspectRatio, availableWidth, aspectRatio, containedHeight, parentHeight ] );\n\n\t\tconst wrappedComponent = (\n\t\t\t<WrappedComponent\n\t\t\t\twidth={ boxWidth }\n\t\t\t\theight={ boxHeight }\n\t\t\t\tsize={ size }\n\t\t\t\t{ ...( chartProps as T ) }\n\t\t\t/>\n\t\t);\n\n\t\t// The outer element fills the parent (via CSS) so its live height reflects the\n\t\t// real available space; JS sets width/height only when they are passed\n\t\t// explicitly. Static layout (fill, flex centering) lives in the stylesheet. With\n\t\t// an aspectRatio the chart is placed in an inner box sized to the contained\n\t\t// dimensions (centered by CSS) so it keeps its proportions and fits within the\n\t\t// parent on both axes. Charts that fill their container via CSS (e.g. the heatmap\n\t\t// grid) then track that box. Without an aspectRatio the chart fills the parent.\n\t\treturn (\n\t\t\t<div\n\t\t\t\tref={ setWrapperRef }\n\t\t\t\tdata-testid=\"responsive-wrapper\"\n\t\t\t\tclassName={ clsx( styles.container, hasAspectRatio && styles.isContained ) }\n\t\t\t\tstyle={ {\n\t\t\t\t\t...( width !== undefined ? { width } : null ),\n\t\t\t\t\t...( height !== undefined ? { height } : null ),\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<ChartScopeContext.Provider value={ scopeNode }>\n\t\t\t\t\t{ hasAspectRatio ? (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tdata-testid=\"responsive-content\"\n\t\t\t\t\t\t\tclassName={ styles.content }\n\t\t\t\t\t\t\tstyle={ { width: boxWidth, height: boxHeight } }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ wrappedComponent }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\twrappedComponent\n\t\t\t\t\t) }\n\t\t\t\t</ChartScopeContext.Provider>\n\t\t\t</div>\n\t\t);\n\t};\n}\n","import { DataContext } from '@visx/xychart';\nimport { __ } from '@wordpress/i18n';\nimport { IconButton } from '@wordpress/ui';\nimport { useCallback, useContext, useMemo, useState } from 'react';\nimport styles from './x-zoom.module.scss';\nimport type { ChartInstanceRef } from '../chart-instance-context';\nimport type { AxisScale } from '@visx/axis';\nimport type { EventHandlerParams } from '@visx/xychart';\nimport type { KeyboardEvent, ReactNode, RefObject } from 'react';\n\nconst MIN_DRAG_PIXELS = 6;\n\ntype Drag = { a: number; b: number };\ntype PointerHandler = ( params: EventHandlerParams< object > ) => void;\n\n/**\n * Drag-to-zoom state + pointer handlers for an XY chart. Designed to be\n * embedded in a chart parent: the parent owns the result, spreads the\n * `domain` into its `xScale.domain` config, and renders the selection\n * rect and reset button this returns.\n *\n * The X scale `.invert()` is read lazily from the chart's existing\n * `internalChartRef.getScales()` at commit time, so no DataContext access\n * is required from the parent.\n *\n * @param params - Hook params.\n * @param params.enabled - When false, the hook becomes a passthrough.\n * @param params.chartRef - Chart's internal scales ref.\n * @param params.userHandlers - User-supplied pointer handlers to chain.\n * @param params.userHandlers.onPointerDown - Forwarded user pointerdown handler.\n * @param params.userHandlers.onPointerMove - Forwarded user pointermove handler.\n * @param params.userHandlers.onPointerUp - Forwarded user pointerup handler.\n * @return An object with `domain`, `drag`, `reset`, and chained `handlers`.\n */\nexport function useXZoom< T extends Date | number = Date >( {\n\tenabled,\n\tchartRef,\n\tuserHandlers,\n}: {\n\tenabled: boolean;\n\tchartRef: RefObject< ChartInstanceRef | null >;\n\tuserHandlers?: {\n\t\tonPointerDown?: PointerHandler;\n\t\tonPointerMove?: PointerHandler;\n\t\tonPointerUp?: PointerHandler;\n\t};\n} ) {\n\tconst [ domain, setDomain ] = useState< [ T, T ] | null >( null );\n\tconst [ drag, setDrag ] = useState< Drag | null >( null );\n\n\tconst reset = useCallback( () => setDomain( null ), [] );\n\n\tconst onPointerDown = useCallback< PointerHandler >(\n\t\tparams => {\n\t\t\tuserHandlers?.onPointerDown?.( params );\n\t\t\tif ( ! enabled || ! params.svgPoint ) return;\n\t\t\tsetDrag( { a: params.svgPoint.x, b: params.svgPoint.x } );\n\t\t},\n\t\t[ enabled, userHandlers ]\n\t);\n\n\tconst onPointerMove = useCallback< PointerHandler >(\n\t\tparams => {\n\t\t\tuserHandlers?.onPointerMove?.( params );\n\t\t\tif ( ! enabled || ! params.svgPoint ) return;\n\t\t\tsetDrag( current => ( current ? { a: current.a, b: params.svgPoint!.x } : current ) );\n\t\t},\n\t\t[ enabled, userHandlers ]\n\t);\n\n\tconst onPointerUp = useCallback< PointerHandler >(\n\t\tparams => {\n\t\t\tuserHandlers?.onPointerUp?.( params );\n\t\t\tif ( ! enabled ) return;\n\t\t\tconst finalDrag = drag;\n\t\t\tsetDrag( null );\n\t\t\tif ( ! finalDrag ) return;\n\t\t\tconst lo = Math.min( finalDrag.a, finalDrag.b );\n\t\t\tconst hi = Math.max( finalDrag.a, finalDrag.b );\n\t\t\tif ( hi - lo < MIN_DRAG_PIXELS ) return;\n\t\t\tconst xScale = chartRef.current?.getScales()?.xScale as\n\t\t\t\t| ( AxisScale & { invert?: ( v: number ) => T } )\n\t\t\t\t| undefined;\n\t\t\tif ( ! xScale || typeof xScale.invert !== 'function' ) return;\n\t\t\tsetDomain( [ xScale.invert( lo ), xScale.invert( hi ) ] );\n\t\t},\n\t\t[ enabled, drag, chartRef, userHandlers ]\n\t);\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tdomain,\n\t\t\tdrag,\n\t\t\treset,\n\t\t\thandlers: { onPointerDown, onPointerMove, onPointerUp },\n\t\t} ),\n\t\t[ domain, drag, reset, onPointerDown, onPointerMove, onPointerUp ]\n\t);\n}\n\n/**\n * Live selection rectangle drawn inside `<XYChart>` while the user is\n * dragging. Reads plot dimensions from visx's `DataContext`.\n *\n * @param props - Props.\n * @param props.drag - Current drag, or null when idle.\n * @return JSX or null.\n */\nexport function ZoomSelectionRect( { drag }: { drag: Drag | null } ) {\n\tconst { margin, innerHeight } = useContext( DataContext );\n\tif ( ! drag || drag.a === drag.b ) return null;\n\tconst x = Math.min( drag.a, drag.b );\n\tconst w = Math.abs( drag.b - drag.a );\n\treturn (\n\t\t<rect\n\t\t\tclassName={ styles[ 'x-zoom__selection' ] }\n\t\t\tx={ x }\n\t\t\ty={ margin?.top ?? 0 }\n\t\t\twidth={ w }\n\t\t\theight={ innerHeight ?? 0 }\n\t\t\tdata-testid=\"chart-zoom-selection\"\n\t\t/>\n\t);\n}\n\n/**\n * Wraps a chart's series in a group that is clipped to the inner plot rectangle\n * while `active`. Reads the plot geometry from visx's `DataContext` (the same\n * source as `ZoomSelectionRect`), so the host charts don't compute any margins.\n * The group is always rendered (only its `clip-path` toggles) so toggling zoom\n * never remounts or re-animates the series.\n *\n * @param props - Props.\n * @param props.active - Whether to clip (e.g. `zoomable`, or `zoomable && zoomed`).\n * @param props.chartId - Chart id; used to build a unique clip-path id.\n * @param props.children - The series to clip.\n * @return JSX element.\n */\nexport function ZoomClip( {\n\tactive,\n\tchartId,\n\tchildren,\n}: {\n\tactive: boolean;\n\tchartId?: string;\n\tchildren: ReactNode;\n} ) {\n\tconst { margin, innerWidth, innerHeight } = useContext( DataContext );\n\t// Sanitise the chart id to a valid SVG/CSS id, and keep it unique per chart.\n\tconst id = `chart-zoom-clip-${ String( chartId ?? '' ).replace( /[^A-Za-z0-9_-]/g, '' ) }`;\n\tconst clip = active && ( innerWidth ?? 0 ) > 0 && ( innerHeight ?? 0 ) > 0;\n\treturn (\n\t\t<>\n\t\t\t{ clip && (\n\t\t\t\t<defs>\n\t\t\t\t\t<clipPath id={ id } data-testid=\"chart-zoom-clip\">\n\t\t\t\t\t\t<rect\n\t\t\t\t\t\t\tx={ margin?.left ?? 0 }\n\t\t\t\t\t\t\ty={ margin?.top ?? 0 }\n\t\t\t\t\t\t\twidth={ innerWidth }\n\t\t\t\t\t\t\theight={ innerHeight }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</clipPath>\n\t\t\t\t</defs>\n\t\t\t) }\n\t\t\t<g clipPath={ clip ? `url(#${ id })` : undefined } data-testid=\"chart-series-clip-group\">\n\t\t\t\t{ children }\n\t\t\t</g>\n\t\t</>\n\t);\n}\n\n/**\n * Visible icon-only reset control rendered as an HTML overlay on top of the\n * chart container, using the WPDS `IconButton`. The host should wrap its SVG in\n * a `position: relative` container so the button anchors correctly.\n *\n * @param props - Props.\n * @param props.onClick - Click handler. Typically the `reset` from `useXZoom`.\n * @return JSX element.\n */\nexport function ZoomResetButton( { onClick }: { onClick: () => void } ) {\n\t// The chart's keyboard-navigation wrapper calls preventDefault() on\n\t// bubbled keydowns, which would cancel the native Enter/Space button\n\t// activation. Keep activation keys out of its reach.\n\tconst stopActivationKeys = useCallback( ( event: KeyboardEvent< HTMLButtonElement > ) => {\n\t\tif ( event.key === 'Enter' || event.key === ' ' ) {\n\t\t\tevent.stopPropagation();\n\t\t}\n\t}, [] );\n\treturn (\n\t\t<IconButton\n\t\t\tclassName={ styles[ 'x-zoom__reset' ] }\n\t\t\tonKeyDown={ stopActivationKeys }\n\t\t\tlabel={ __( 'Reset zoom', 'jetpack-charts' ) }\n\t\t\tvariant=\"outline\"\n\t\t\ttone=\"neutral\"\n\t\t\tsize=\"small\"\n\t\t\tonClick={ onClick }\n\t\t\tdata-testid=\"chart-zoom-reset\"\n\t\t\ticon={\n\t\t\t\t<svg\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\tfocusable=\"false\"\n\t\t\t\t>\n\t\t\t\t\t{ /*\n\t\t\t\t\t\tIcons render edge-to-edge at 24px, so inset the glyph the\n\t\t\t\t\t\tway @wordpress/icons glyphs do (drawn within roughly 4-20\n\t\t\t\t\t\tof the viewBox, ~1.5px effective stroke).\n\t\t\t\t\t*/ }\n\t\t\t\t\t<g transform=\"translate(2.4 2.4) scale(0.8)\">\n\t\t\t\t\t\t<circle cx=\"10\" cy=\"10\" r=\"6\" />\n\t\t\t\t\t\t<line x1=\"15\" y1=\"15\" x2=\"20\" y2=\"20\" />\n\t\t\t\t\t\t<line x1=\"7\" y1=\"10\" x2=\"13\" y2=\"10\" />\n\t\t\t\t\t</g>\n\t\t\t\t</svg>\n\t\t\t}\n\t\t/>\n\t);\n}\n","import { __ } from '@wordpress/i18n';\nimport { Stack } from '@wordpress/ui';\nimport clsx from 'clsx';\nimport { useEffect, useId, useRef, useState } from 'react';\nimport { isSafari } from '../../../utils';\nimport styles from '../line-chart.module.scss';\nimport type { ButtonWithPopover, PopoverElement, ToggleEvent } from '../../../types';\nimport type { FC } from 'react';\n\nexport const POPOVER_BUTTON_SIZE = 44;\n\nconst CloseIcon = () => (\n\t<svg\n\t\twidth=\"16\"\n\t\theight=\"16\"\n\t\tviewBox=\"0 0 24 24\"\n\t\tfill=\"none\"\n\t\tstroke=\"currentColor\"\n\t\tstrokeWidth=\"2\"\n\t\tstrokeLinecap=\"round\"\n\t\tstrokeLinejoin=\"round\"\n\t\taria-hidden=\"true\"\n\t\tfocusable=\"false\"\n\t>\n\t\t<path d=\"M6 6l12 12M18 6L6 18\" />\n\t</svg>\n);\n\ninterface LineChartAnnotationLabelWithPopoverProps {\n\ttitle: string;\n\tsubtitle?: string;\n\trenderLabel: FC< { title: string; subtitle?: string } >;\n\trenderLabelPopover: FC< { title: string; subtitle?: string } >;\n}\n\nconst LineChartAnnotationLabelWithPopover: FC< LineChartAnnotationLabelWithPopoverProps > = ( {\n\ttitle,\n\tsubtitle,\n\trenderLabel,\n\trenderLabelPopover,\n} ) => {\n\tconst popoverId = useId();\n\tconst buttonRef = useRef< HTMLButtonElement >( null );\n\tconst popoverRef = useRef< HTMLDivElement >( null );\n\tconst [ isPositioned, setIsPositioned ] = useState( false );\n\tconst isBrowserSafari = isSafari();\n\n\tuseEffect( () => {\n\t\tconst button = buttonRef.current;\n\t\tconst popover = popoverRef.current;\n\n\t\tif ( ! button || ! popover ) return;\n\n\t\tconst positionPopover = () => {\n\t\t\t// Popover positioning in Safari is complicated due to issues with SVG foreign objects (https://bugs.webkit.org/show_bug.cgi?id=23113), so let it be positioned in the centre of the viewport.\n\t\t\tif ( ! isBrowserSafari ) {\n\t\t\t\tconst buttonRect = button.getBoundingClientRect();\n\t\t\t\tpopover.style.left = `${ buttonRect.right }px`;\n\t\t\t\tpopover.style.top = `${ buttonRect.top }px`;\n\t\t\t}\n\n\t\t\tsetIsPositioned( true );\n\t\t};\n\n\t\t// Position when popover shows\n\t\tpopover.addEventListener( 'toggle', ( e: ToggleEvent ) => {\n\t\t\tif ( e.newState === 'open' ) {\n\t\t\t\tpositionPopover();\n\t\t\t}\n\t\t} );\n\n\t\t// Initial positioning if already open\n\t\ttry {\n\t\t\tif ( popover.matches( ':popover-open' ) ) {\n\t\t\t\tpositionPopover();\n\t\t\t}\n\t\t} catch {\n\t\t\t// Ignore errors in test environments (e.g., JSDOM does not support :popover-open)\n\t\t}\n\t}, [ isBrowserSafari ] );\n\n\treturn (\n\t\t<div className={ styles[ 'line-chart__annotation-label' ] }>\n\t\t\t<button\n\t\t\t\tref={ buttonRef }\n\t\t\t\t{ ...( { popovertarget: popoverId } as ButtonWithPopover ) }\n\t\t\t\tclassName={ styles[ 'line-chart__annotation-label-trigger-button' ] }\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth: `${ POPOVER_BUTTON_SIZE }px`,\n\t\t\t\t\theight: `${ POPOVER_BUTTON_SIZE }px`,\n\t\t\t\t\ttransform: `translate(${ POPOVER_BUTTON_SIZE / 2 }px, 0)`,\n\t\t\t\t} }\n\t\t\t\taria-label={ title || __( 'View details', 'jetpack-charts' ) }\n\t\t\t>\n\t\t\t\t{ renderLabel( { title, subtitle } ) }\n\t\t\t</button>\n\t\t\t<div\n\t\t\t\tref={ popoverRef }\n\t\t\t\tid={ popoverId }\n\t\t\t\t{ ...( { popover: 'auto' } as PopoverElement ) }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\tstyles[ 'line-chart__annotation-label-popover' ],\n\t\t\t\t\tisPositioned && styles[ 'line-chart__annotation-label-popover--visible' ],\n\t\t\t\t\tisBrowserSafari && styles[ 'line-chart__annotation-label-popover--safari' ]\n\t\t\t\t) }\n\t\t\t\tdata-testid=\"line-chart-annotation-label-popover\"\n\t\t\t>\n\t\t\t\t<Stack direction=\"row\" align=\"flex-start\" justify=\"space-between\">\n\t\t\t\t\t<div className={ styles[ 'line-chart__annotation-label-popover-content' ] }>\n\t\t\t\t\t\t{ renderLabelPopover( { title, subtitle } ) }\n\t\t\t\t\t</div>\n\t\t\t\t\t<button\n\t\t\t\t\t\t{ ...( {\n\t\t\t\t\t\t\tpopovertarget: popoverId,\n\t\t\t\t\t\t\tpopovertargetaction: 'hide',\n\t\t\t\t\t\t} as ButtonWithPopover ) }\n\t\t\t\t\t\tclassName={ styles[ 'line-chart__annotation-label-popover-close-button' ] }\n\t\t\t\t\t\taria-label={ __( 'Close', 'jetpack-charts' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<CloseIcon />\n\t\t\t\t\t</button>\n\t\t\t\t</Stack>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport default LineChartAnnotationLabelWithPopover;\n","import { DataContext } from '@visx/xychart';\nimport { useEffect, useState, useCallback } from 'react';\nimport { useChartInstanceContext } from '../../private/chart-instance-context';\nimport styles from '../line-chart.module.scss';\nimport type { AxisScale } from '@visx/axis';\nimport type { FC, ReactNode } from 'react';\n\nexport interface LineChartAnnotationsProps {\n\tchildren?: ReactNode;\n}\n\ninterface ScaleData {\n\txScale: AxisScale< Date >;\n\tyScale: AxisScale< number >;\n}\n\nconst LineChartAnnotationsOverlay: FC< LineChartAnnotationsProps > = ( { children } ) => {\n\tconst { chartRef, chartWidth, chartHeight } = useChartInstanceContext();\n\n\tconst [ scales, setScales ] = useState< ScaleData | null >( null );\n\tconst [ scalesStable, setScalesStable ] = useState< boolean >( false );\n\n\t// Create a signature for scale data to enable easy comparison\n\tconst createScaleSignature = useCallback( ( scaleData: ScaleData ) => {\n\t\tconst xDomain = scaleData.xScale.domain();\n\t\tconst yDomain = scaleData.yScale.domain();\n\t\tconst xRange = scaleData.xScale.range();\n\t\tconst yRange = scaleData.yScale.range();\n\n\t\treturn `${ xDomain.join( ',' ) }-${ yDomain.join( ',' ) }-${ xRange.join(\n\t\t\t','\n\t\t) }-${ yRange.join( ',' ) }`;\n\t}, [] );\n\n\t// Get scales from chart ref and return them with signature for comparison\n\tconst getScalesData = useCallback( () => {\n\t\tif ( chartRef?.current ) {\n\t\t\tconst scaleData = chartRef.current.getScales();\n\n\t\t\tif ( scaleData ) {\n\t\t\t\tconst scaleInfo = {\n\t\t\t\t\txScale: scaleData.xScale as AxisScale< Date >,\n\t\t\t\t\tyScale: scaleData.yScale as AxisScale< number >,\n\t\t\t\t};\n\n\t\t\t\treturn {\n\t\t\t\t\tscales: scaleInfo,\n\t\t\t\t\tsignature: createScaleSignature( scaleInfo ),\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}, [ chartRef, createScaleSignature ] );\n\n\t// The chart resizes on render so we need to monitor the scales until they stabilize\n\tuseEffect( () => {\n\t\tlet timeoutId: number | null = null;\n\t\tlet lastSignature: string | null = null;\n\t\tlet retryCount = 0;\n\t\tconst maxRetries = 20; // 20 * 50ms = 1 second max\n\t\tconst checkInterval = 50; // Check every 50ms\n\n\t\t// Reset stability state when monitoring starts\n\t\tsetScalesStable( false );\n\n\t\tconst monitorScales = () => {\n\t\t\tconst currentScaleData = getScalesData();\n\n\t\t\t// If we got scales, compare signatures\n\t\t\tif ( currentScaleData ) {\n\t\t\t\t// Check if scales have settled by comparing signatures\n\t\t\t\tconst scalesSettled = lastSignature && currentScaleData.signature === lastSignature;\n\n\t\t\t\tif ( scalesSettled ) {\n\t\t\t\t\t// Scales have stabilized, mark as stable\n\t\t\t\t\tsetScalesStable( true );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Update scales and remember signature for next comparison\n\t\t\t\tsetScales( currentScaleData.scales );\n\t\t\t\tlastSignature = currentScaleData.signature;\n\t\t\t}\n\n\t\t\t// Continue monitoring if we haven't exceeded max retries\n\t\t\tif ( retryCount < maxRetries ) {\n\t\t\t\tretryCount++;\n\t\t\t\ttimeoutId = setTimeout( monitorScales, checkInterval ) as unknown as number;\n\t\t\t}\n\t\t};\n\n\t\tmonitorScales();\n\n\t\treturn () => {\n\t\t\tif ( timeoutId ) {\n\t\t\t\tclearTimeout( timeoutId );\n\t\t\t}\n\t\t};\n\t}, [ getScalesData, chartWidth, chartHeight ] );\n\n\tif ( ! chartRef || ! children || ! chartWidth || ! chartHeight ) {\n\t\treturn null;\n\t}\n\n\tif ( ! scales || ! scalesStable ) {\n\t\treturn null;\n\t}\n\n\t// Create a DataContext value that mimics what visx provides\n\t// We're intentionally providing minimal context for annotations to work\n\tconst dataContextValue = {\n\t\txScale: scales.xScale,\n\t\tyScale: scales.yScale,\n\t\tmargin: { top: 0, right: 0, bottom: 0, left: 0 },\n\t\twidth: chartWidth,\n\t\theight: chartHeight,\n\t} as unknown as Parameters< typeof DataContext.Provider >[ 0 ][ 'value' ];\n\n\treturn (\n\t\t<DataContext.Provider value={ dataContextValue }>\n\t\t\t<svg\n\t\t\t\twidth={ chartWidth }\n\t\t\t\theight={ chartHeight }\n\t\t\t\tclassName={ styles[ 'line-chart__annotations-overlay' ] }\n\t\t\t\tdata-testid=\"line-chart-annotations-overlay\"\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</svg>\n\t\t</DataContext.Provider>\n\t);\n};\n\nexport default LineChartAnnotationsOverlay;\n","import {\n\tAnnotation,\n\tCircleSubject,\n\tConnector,\n\tHtmlLabel,\n\tLabel,\n\tLineSubject,\n} from '@visx/annotation';\nimport { DataContext } from '@visx/xychart';\nimport merge from 'deepmerge';\nimport { useContext, useRef, useEffect, useState, useMemo } from 'react';\nimport { useChartScopeElement, useGlobalChartsTheme } from '../../../providers';\nimport { isSafari, resolveCssVariable } from '../../../utils';\nimport LineChartAnnotationLabelWithPopover, {\n\tPOPOVER_BUTTON_SIZE,\n} from './line-chart-annotation-label-popover';\nimport type { LineChartAnnotationProps } from '../types';\nimport type { LabelProps } from '@visx/annotation';\nimport type { TextProps } from '@visx/text';\nimport type { FC } from 'react';\n\ntype SubjectType = 'circle' | 'line-vertical' | 'line-horizontal';\n\nconst ANNOTATION_MAX_WIDTH = 125; // visx default\nconst ANNOTATION_INIT_HEIGHT = 100;\n\nexport const getLabelPosition = ( {\n\tsubjectType,\n\tx,\n\txMax,\n\ty,\n\tyMin,\n\tyMax,\n\tmaxWidth,\n\theight,\n}: {\n\tsubjectType: SubjectType;\n\tx: number;\n\txMax: number;\n\ty: number;\n\tyMin: number;\n\tyMax: number;\n\tmaxWidth?: number;\n\theight?: number | null;\n} ): {\n\tdx: number;\n\tdy: number;\n\tisFlippedHorizontally: boolean;\n\tisFlippedVertically: boolean;\n} => {\n\tconst annotationMaxWidth = maxWidth ?? ANNOTATION_MAX_WIDTH;\n\tconst annotationHeight = height ?? ANNOTATION_INIT_HEIGHT;\n\tlet dx = 15;\n\tlet dy = 15;\n\tlet isFlippedHorizontally = false;\n\tlet isFlippedVertically = false;\n\n\tif ( subjectType === 'line-horizontal' ) {\n\t\tdx = 0;\n\t\tdy = 20;\n\t}\n\n\tif ( subjectType === 'line-vertical' ) {\n\t\tdx = 20;\n\t\tdy = 0;\n\t}\n\n\t// Smart horizontal positioning: if annotation would extend beyond right edge, position it to the left\n\t// Account for the connector offset (dx) in boundary calculations\n\tconst effectiveX = x + dx;\n\n\tif ( effectiveX + annotationMaxWidth > xMax ) {\n\t\tisFlippedHorizontally = true;\n\n\t\tif ( subjectType === 'circle' ) {\n\t\t\tdx = -dx; // Just flip to the left side with same offset\n\t\t} else if ( subjectType === 'line-vertical' ) {\n\t\t\tdx = -20; // Position to the left of the line\n\t\t}\n\t}\n\n\t// Smart vertical positioning: check both top and bottom edges\n\t// For circle annotations, they are positioned below by default (dy > 0)\n\t// Only flip when close to bottom edge to position above\n\tif ( subjectType === 'circle' ) {\n\t\t// Check if positioning below would extend beyond bottom edge\n\t\tif ( y + dy + annotationHeight > yMin ) {\n\t\t\t// Too close to bottom edge, position above\n\t\t\tisFlippedVertically = true;\n\t\t\tdy = -Math.abs( dy ); // Ensure negative value to position above the point\n\t\t}\n\t\t// When close to top edge, keep default below positioning (no flip needed)\n\t} else if ( y - annotationHeight < yMax ) {\n\t\t// Too close to top edge, position below\n\t\tif ( subjectType === 'line-horizontal' ) {\n\t\t\tisFlippedVertically = true;\n\t\t\tdy = Math.abs( dy ); // Ensure positive value to position below the point\n\t\t} else if ( subjectType === 'line-vertical' ) {\n\t\t\tisFlippedVertically = true; // For anchor adjustment only\n\t\t}\n\t} else if ( y + annotationHeight > yMin ) {\n\t\t// Too close to bottom edge, position above\n\t\tif ( subjectType === 'line-horizontal' ) {\n\t\t\tisFlippedVertically = true;\n\t\t\tdy = -Math.abs( dy ); // Ensure negative value to position above the point\n\t\t} else if ( subjectType === 'line-vertical' ) {\n\t\t\tisFlippedVertically = true; // For anchor adjustment only\n\t\t}\n\t}\n\n\treturn { dx, dy, isFlippedHorizontally, isFlippedVertically };\n};\n\nconst getHorizontalAnchor = (\n\tsubjectType: SubjectType,\n\tisFlippedHorizontally: boolean\n): LabelProps[ 'horizontalAnchor' ] => {\n\tif ( subjectType === 'line-horizontal' ) {\n\t\treturn isFlippedHorizontally ? 'end' : 'start';\n\t}\n\n\treturn undefined;\n};\n\nconst getVerticalAnchor = (\n\tsubjectType: SubjectType,\n\tisFlippedVertically: boolean,\n\ty: number,\n\tyMax: number,\n\theight: number\n): TextProps[ 'verticalAnchor' ] => {\n\tif ( subjectType === 'line-vertical' ) {\n\t\tif ( isFlippedVertically ) {\n\t\t\t// If flipped due to top edge, anchor to top; if flipped due to bottom edge, anchor to bottom\n\t\t\treturn y - height < yMax ? 'start' : 'end';\n\t\t}\n\n\t\treturn 'start';\n\t}\n\n\treturn undefined;\n};\n\nconst LineChartAnnotation: FC< LineChartAnnotationProps > = ( {\n\tdatum,\n\ttitle,\n\tsubtitle,\n\tsubjectType = 'circle',\n\tstyles: datumStyles,\n\ttestId,\n\trenderLabel,\n\trenderLabelPopover,\n} ) => {\n\tconst providerTheme = useGlobalChartsTheme();\n\tconst scopeElement = useChartScopeElement();\n\tconst { xScale, yScale } = useContext( DataContext ) || {};\n\tconst labelRef = useRef< SVGGElement >( null );\n\tconst [ height, setHeight ] = useState< number | null >( null );\n\n\t// Deep merge styles to preserve nested object properties\n\tconst styles = merge( providerTheme.annotationStyles ?? {}, datumStyles ?? {} );\n\n\t// visx annotation parts apply these colours as SVG presentation attributes, where CSS var() cannot resolve. Resolve against the chart's scope element, never :root.\n\tconst resolveColor = ( value?: string ): string | undefined =>\n\t\tvalue ? resolveCssVariable( value, scopeElement ) ?? value : value;\n\n\t// Measure the label height once after initial render\n\tuseEffect( () => {\n\t\tif ( labelRef.current?.getBBox ) {\n\t\t\tconst bbox = labelRef.current.getBBox();\n\t\t\tsetHeight( bbox.height );\n\t\t}\n\t}, [] );\n\n\tconst positionData = useMemo( () => {\n\t\tif ( ! datum || ! datum.date || datum.value == null || ! xScale || ! yScale ) return null;\n\n\t\tconst x = xScale( datum.date );\n\t\tconst y = yScale( datum.value );\n\n\t\tif ( typeof x !== 'number' || typeof y !== 'number' ) return null;\n\n\t\tconst [ yMin, yMax ] = yScale.range().map( Number );\n\t\tconst [ xMin, xMax ] = xScale.range().map( Number );\n\n\t\t// If a custom label is provided, use the provided position\n\t\tif ( renderLabel ) {\n\t\t\treturn {\n\t\t\t\tx,\n\t\t\t\tdx: 0,\n\t\t\t\ty,\n\t\t\t\tdy: 0,\n\t\t\t\tyMin,\n\t\t\t\tyMax,\n\t\t\t\txMin,\n\t\t\t\txMax,\n\t\t\t\tisFlippedHorizontally: false,\n\t\t\t\tisFlippedVertically: false,\n\t\t\t};\n\t\t}\n\n\t\tconst position = getLabelPosition( {\n\t\t\tsubjectType,\n\t\t\tx,\n\t\t\txMax,\n\t\t\ty,\n\t\t\tyMin,\n\t\t\tyMax,\n\t\t\tmaxWidth: styles?.label?.maxWidth,\n\t\t\theight,\n\t\t} );\n\n\t\treturn { x, y, yMin, yMax, xMin, xMax, ...position };\n\t}, [ datum, xScale, yScale, subjectType, styles?.label?.maxWidth, height, renderLabel ] );\n\n\tif ( ! positionData ) return null;\n\n\tconst { x, y, yMin, yMax, xMin, xMax, dx, dy, isFlippedHorizontally, isFlippedVertically } =\n\t\tpositionData;\n\n\tconst getLabelY = () => {\n\t\tconst labelY = styles?.label?.y;\n\n\t\tif ( labelY === 'start' ) return yMax;\n\t\tif ( labelY === 'end' ) return yMin;\n\n\t\treturn labelY;\n\t};\n\n\tconst getLabelX = () => {\n\t\tconst labelX = styles?.label?.x;\n\n\t\tif ( labelX === 'start' ) return xMin;\n\t\tif ( labelX === 'end' ) return xMax;\n\n\t\treturn labelX;\n\t};\n\n\tconst labelPosition = {\n\t\tx: getLabelX(),\n\t\ty: getLabelY(),\n\t};\n\n\t// Safari has a bug where children of an SVG foreignObject are not positioned correctly https://bugs.webkit.org/show_bug.cgi?id=23113\n\t// This is a workaround to position the label correctly\n\tconst getSafariHTMLLabelPosition = () => {\n\t\tconst labelWidth = POPOVER_BUTTON_SIZE;\n\t\tconst labelHeight = POPOVER_BUTTON_SIZE;\n\n\t\treturn isSafari()\n\t\t\t? {\n\t\t\t\t\ttransform: `translate(${\n\t\t\t\t\t\tx +\n\t\t\t\t\t\t( dx || 0 ) +\n\t\t\t\t\t\t( typeof labelPosition.x === 'number' ? labelPosition.x - x : 0 ) -\n\t\t\t\t\t\tlabelWidth\n\t\t\t\t\t}px, ${\n\t\t\t\t\t\ty +\n\t\t\t\t\t\t( dy || 0 ) +\n\t\t\t\t\t\t( typeof labelPosition.y === 'number' ? labelPosition.y - y : 0 ) -\n\t\t\t\t\t\tlabelHeight\n\t\t\t\t\t}px)`,\n\t\t\t\t\twidth: labelWidth,\n\t\t\t\t\theight: labelHeight,\n\t\t\t }\n\t\t\t: undefined;\n\t};\n\n\treturn (\n\t\t<g data-testid={ testId }>\n\t\t\t<Annotation x={ x } y={ y } dx={ dx } dy={ dy }>\n\t\t\t\t<Connector { ...styles?.connector } stroke={ resolveColor( styles?.connector?.stroke ) } />\n\t\t\t\t{ subjectType === 'circle' && (\n\t\t\t\t\t<CircleSubject\n\t\t\t\t\t\t{ ...styles?.circleSubject }\n\t\t\t\t\t\tfill={ resolveColor( styles?.circleSubject?.fill ) }\n\t\t\t\t\t\tstroke={ resolveColor( styles?.circleSubject?.stroke ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ subjectType === 'line-vertical' && (\n\t\t\t\t\t<LineSubject\n\t\t\t\t\t\tmin={ yMax }\n\t\t\t\t\t\tmax={ yMin }\n\t\t\t\t\t\t{ ...{ ...styles?.lineSubject, orientation: 'vertical' } }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ subjectType === 'line-horizontal' && (\n\t\t\t\t\t<LineSubject\n\t\t\t\t\t\tmin={ xMin }\n\t\t\t\t\t\tmax={ xMax }\n\t\t\t\t\t\t{ ...{ ...styles?.lineSubject, orientation: 'horizontal' } }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ renderLabel ? (\n\t\t\t\t\t<HtmlLabel { ...styles?.label } { ...labelPosition }>\n\t\t\t\t\t\t<div style={ getSafariHTMLLabelPosition() }>\n\t\t\t\t\t\t\t{ renderLabelPopover ? (\n\t\t\t\t\t\t\t\t<LineChartAnnotationLabelWithPopover\n\t\t\t\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\t\t\t\tsubtitle={ subtitle }\n\t\t\t\t\t\t\t\t\trenderLabel={ renderLabel }\n\t\t\t\t\t\t\t\t\trenderLabelPopover={ renderLabelPopover }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\trenderLabel( { title, subtitle } )\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</HtmlLabel>\n\t\t\t\t) : (\n\t\t\t\t\t<g ref={ labelRef }>\n\t\t\t\t\t\t<Label\n\t\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\t\tsubtitle={ subtitle }\n\t\t\t\t\t\t\t{ ...styles?.label }\n\t\t\t\t\t\t\tanchorLineStroke={ resolveColor( styles?.label?.anchorLineStroke ) }\n\t\t\t\t\t\t\tbackgroundFill={ resolveColor( styles?.label?.backgroundFill ) }\n\t\t\t\t\t\t\t{ ...labelPosition }\n\t\t\t\t\t\t\thorizontalAnchor={ getHorizontalAnchor( subjectType, isFlippedHorizontally ) }\n\t\t\t\t\t\t\tverticalAnchor={ getVerticalAnchor(\n\t\t\t\t\t\t\t\tsubjectType,\n\t\t\t\t\t\t\t\tisFlippedVertically,\n\t\t\t\t\t\t\t\ty,\n\t\t\t\t\t\t\t\tyMax,\n\t\t\t\t\t\t\t\theight ?? ANNOTATION_INIT_HEIGHT\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</g>\n\t\t\t\t) }\n\t\t\t</Annotation>\n\t\t</g>\n\t);\n};\n\nexport default LineChartAnnotation;\n","import { DataContext } from '@visx/xychart';\nimport { useContext } from 'react';\nimport type { LineChartGlyphProps } from '../types';\nimport type { FC } from 'react';\n\nconst toNumber = ( val?: number | string | null ): number | undefined => {\n\tconst num = typeof val === 'number' ? val : parseFloat( val );\n\treturn isNaN( num ) ? undefined : num;\n};\n\nconst LineChartGlyph: FC< LineChartGlyphProps > = ( {\n\tdata,\n\tindex,\n\tcolor,\n\tglyphStyle,\n\trenderGlyph,\n\taccessors,\n\tposition,\n} ) => {\n\tconst { xScale, yScale } = useContext( DataContext ) || {};\n\tif ( ! xScale || ! yScale ) return null;\n\n\tif ( data.data.length === 0 ) return null;\n\n\tconst point = position === 'start' ? data.data[ 0 ] : data.data[ data.data.length - 1 ];\n\n\tconst x = xScale( accessors.xAccessor( point ) );\n\tconst y = yScale( accessors.yAccessor( point ) );\n\n\tif ( typeof x !== 'number' || typeof y !== 'number' ) return null;\n\n\tconst size = Math.max( 0, toNumber( glyphStyle?.radius ) ?? 4 );\n\n\treturn renderGlyph( {\n\t\tkey: `${ position }-glyph-${ data.label }`,\n\t\tindex,\n\t\tdatum: point,\n\t\tcolor,\n\t\tsize,\n\t\tx,\n\t\ty,\n\t\tglyphStyle,\n\t\tposition,\n\t} );\n};\n\nexport default LineChartGlyph;\n","import { formatNumberCompact, formatNumber } from '@automattic/number-formatters';\nimport { LinearGradient } from '@visx/gradient';\nimport { XYChart, AreaSeries, Grid, Axis, DataContext } from '@visx/xychart';\nimport { __ } from '@wordpress/i18n';\nimport { Stack } from '@wordpress/ui';\nimport clsx from 'clsx';\nimport {\n\tuseMemo,\n\tuseContext,\n\tforwardRef,\n\tuseImperativeHandle,\n\tuseState,\n\tuseRef,\n\tuseCallback,\n} from 'react';\nimport { Legend, useChartLegendItems } from '../../components/legend';\nimport { AccessibleTooltip, useKeyboardNavigation } from '../../components/tooltip';\nimport {\n\tuseXYChartTheme,\n\tuseChartDataTransform,\n\tuseChartMargin,\n\tusePrefersReducedMotion,\n} from '../../hooks';\nimport {\n\tGlobalChartsProvider,\n\tGlobalChartsContext,\n\tuseChartId,\n\tuseChartRegistration,\n\tuseGlobalChartsContext,\n\tuseGlobalChartsTheme,\n} from '../../providers';\nimport { useDefaultHiddenSeries } from '../../providers/chart-context/hooks/use-default-hidden-series';\nimport { attachSubComponents } from '../../utils';\nimport { useChartChildren } from '../private/chart-composition';\nimport { ChartInstanceContext, type ChartInstanceRef } from '../private/chart-instance-context';\nimport { ChartLayout } from '../private/chart-layout';\nimport { DefaultGlyph } from '../private/default-glyph';\nimport { getAllHiddenMessage, SvgEmptyState } from '../private/svg-empty-state';\nimport { getCurveType, getFormatter, guessOptimalNumTicks } from '../private/time-axis';\nimport { withResponsive } from '../private/with-responsive';\nimport { useXZoom, ZoomResetButton, ZoomSelectionRect, ZoomClip } from '../private/x-zoom';\nimport styles from './line-chart.module.scss';\nimport { LineChartAnnotation, LineChartAnnotationsOverlay, LineChartGlyph } from './private';\nimport type { RenderLineGlyphProps, LineChartProps, TooltipDatum } from './types';\nimport type { DataPoint, DataPointDate, SeriesData, Optional } from '../../types';\nimport type { RenderTooltipParams } from '../../visx/types';\nimport type { ResponsiveConfig } from '../private/with-responsive';\nimport type { TickFormatter } from '@visx/axis';\nimport type { GlyphProps } from '@visx/xychart';\nimport type { FC, Ref } from 'react';\n\nconst defaultRenderGlyph = < Datum extends object >( props: RenderLineGlyphProps< Datum > ) => {\n\treturn <DefaultGlyph { ...props } key={ props.key } />;\n};\n\nconst toNumber = ( val?: number | string | null ): number | undefined => {\n\tconst num = typeof val === 'number' ? val : parseFloat( val );\n\treturn isNaN( num ) ? undefined : num;\n};\n\n/**\n * Default visx-tooltip render that prints the hovered date as a heading and\n * one row per visible series (label + formatted value), sorted descending by\n * value. Reused by AreaChart, which has the same multi-series shape.\n *\n * @param params - visx `RenderTooltipParams< DataPointDate >`.\n * @return Tooltip JSX, or `null` when no datum is hovered.\n */\nexport const renderDefaultTooltip = ( params: RenderTooltipParams< DataPointDate > ) => {\n\tconst { tooltipData } = params;\n\tconst nearestDatum = tooltipData?.nearestDatum?.datum;\n\tif ( ! nearestDatum ) return null;\n\n\tconst tooltipPoints: TooltipDatum[] = Object.entries( tooltipData?.datumByKey || {} )\n\t\t.map( ( [ key, { datum } ] ) => ( {\n\t\t\tkey,\n\t\t\tvalue: datum.value as number,\n\t\t} ) )\n\t\t.sort( ( a, b ) => b.value - a.value );\n\n\treturn (\n\t\t<div className={ styles[ 'line-chart__tooltip' ] }>\n\t\t\t<div className={ styles[ 'line-chart__tooltip-date' ] }>\n\t\t\t\t{ nearestDatum.date?.toLocaleDateString() }\n\t\t\t</div>\n\t\t\t{ tooltipPoints.map( point => (\n\t\t\t\t<Stack\n\t\t\t\t\tkey={ point.key }\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\talign=\"center\"\n\t\t\t\t\tjustify=\"space-between\"\n\t\t\t\t\tclassName={ styles[ 'line-chart__tooltip-row' ] }\n\t\t\t\t>\n\t\t\t\t\t<span className={ styles[ 'line-chart__tooltip-label' ] }>{ point.key }:</span>\n\t\t\t\t\t<span className={ styles[ 'line-chart__tooltip-value' ] }>\n\t\t\t\t\t\t{ formatNumber( point.value ) }\n\t\t\t\t\t</span>\n\t\t\t\t</Stack>\n\t\t\t) ) }\n\t\t</div>\n\t);\n};\n\nconst validateData = ( data: SeriesData[] ) => {\n\tif ( ! data?.length ) return 'No data available';\n\n\tconst hasInvalidData = data.some( series =>\n\t\tseries.data.some(\n\t\t\t( point: DataPointDate | DataPoint ) =>\n\t\t\t\tisNaN( point.value as number ) ||\n\t\t\t\tpoint.value === null ||\n\t\t\t\tpoint.value === undefined ||\n\t\t\t\t( 'date' in point && point.date && isNaN( point.date.getTime() ) )\n\t\t)\n\t);\n\n\tif ( hasInvalidData ) return 'Invalid data';\n\treturn null;\n};\n\n// Inner component to access DataContext and provide scale data to ref\nconst LineChartScalesRef: FC< {\n\tchartRef?: Ref< ChartInstanceRef >;\n\twidth: number;\n\theight: number;\n\tmargin?: { top?: number; right?: number; bottom?: number; left?: number };\n} > = ( { chartRef, width, height, margin } ) => {\n\tconst context = useContext( DataContext );\n\n\tuseImperativeHandle(\n\t\tchartRef,\n\t\t() => ( {\n\t\t\tgetScales: () => {\n\t\t\t\tif ( ! context?.xScale || ! context?.yScale ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\txScale: context.xScale,\n\t\t\t\t\tyScale: context.yScale,\n\t\t\t\t};\n\t\t\t},\n\t\t\tgetChartDimensions: () => ( {\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\tmargin: margin || {},\n\t\t\t} ),\n\t\t} ),\n\t\t[ context, width, height, margin ]\n\t);\n\n\treturn null; // This component only provides the ref interface\n};\n\nconst LineChartInternal = forwardRef< ChartInstanceRef, LineChartProps >(\n\t(\n\t\t{\n\t\t\tdata,\n\t\t\tchartId: providedChartId,\n\t\t\twidth,\n\t\t\theight,\n\t\t\tclassName,\n\t\t\tmargin,\n\t\t\twithTooltips = true,\n\t\t\twithTooltipCrosshairs,\n\t\t\tshowLegend = false,\n\t\t\tlegend = {},\n\t\t\trenderGlyph = defaultRenderGlyph,\n\t\t\tglyphStyle = {},\n\t\t\twithLegendGlyph = false,\n\t\t\twithGradientFill = false,\n\t\t\tsmoothing = true,\n\t\t\tcurveType,\n\t\t\trenderTooltip = renderDefaultTooltip,\n\t\t\twithStartGlyphs = false,\n\t\t\twithEndGlyphs = false,\n\t\t\tanimation,\n\t\t\toptions = {},\n\t\t\tonPointerDown = undefined,\n\t\t\tonPointerUp = undefined,\n\t\t\tonPointerMove = undefined,\n\t\t\tonPointerOut = undefined,\n\t\t\tzoomable = false,\n\t\t\trescaleYOnVisibilityChange = true,\n\t\t\tdefaultHiddenSeries,\n\t\t\tchildren,\n\t\t\tgridVisibility,\n\t\t\tgap = 'md',\n\t\t},\n\t\tref\n\t) => {\n\t\tconst legendInteractive = legend.interactive ?? false;\n\t\tconst legendCollapseGroups = legend.collapseGroups ?? false;\n\t\tconst legendShape = legend.shape ?? 'line';\n\t\tconst legendPosition = legend.position ?? 'bottom';\n\n\t\tconst providerTheme = useGlobalChartsTheme();\n\t\tconst theme = useXYChartTheme( data );\n\t\t// Gradient stops apply this as an SVG attribute, where CSS var() cannot resolve. useXYChartTheme has already resolved the same role inside its memo, against the chart's scope element, so read it back rather than paying another getComputedStyle on every render.\n\t\tconst resolvedBackgroundColor = theme.backgroundColor ?? providerTheme.backgroundColor;\n\t\tconst chartId = useChartId( providedChartId );\n\t\tconst hiddenSeries = useDefaultHiddenSeries( chartId, defaultHiddenSeries );\n\t\tconst isSeriesVisible = useCallback(\n\t\t\t( seriesLabel: string ) => ! hiddenSeries.has( seriesLabel ),\n\t\t\t[ hiddenSeries ]\n\t\t);\n\t\tconst chartRef = useRef< HTMLDivElement >( null );\n\t\tconst [ selectedIndex, setSelectedIndex ] = useState< number | undefined >( undefined );\n\t\tconst [ isNavigating, setIsNavigating ] = useState( false );\n\t\tconst internalChartRef = useRef< ChartInstanceRef >( null );\n\n\t\tconst zoom = useXZoom< Date >( {\n\t\t\tenabled: zoomable,\n\t\t\tchartRef: internalChartRef,\n\t\t\tuserHandlers: { onPointerDown, onPointerMove, onPointerUp },\n\t\t} );\n\n\t\t// Process children for composition API (Legend, etc.)\n\t\tconst { legendChildren, nonLegendChildren } = useChartChildren( children, 'LineChart' );\n\t\tconst [ measuredChartHeight, setMeasuredChartHeight ] = useState< number | undefined >();\n\n\t\t// Callback for ChartLayout to notify us when the measured content height changes.\n\t\t// We compute chartHeight the same way the render prop does so the context stays in sync.\n\t\tconst handleContentHeightChange = useCallback(\n\t\t\t( contentHeight: number ) => {\n\t\t\t\tconst chartHeight = contentHeight > 0 ? contentHeight : height;\n\t\t\t\tsetMeasuredChartHeight( chartHeight );\n\t\t\t},\n\t\t\t[ height ]\n\t\t);\n\n\t\t// Forward the external ref to the internal ref\n\t\tuseImperativeHandle(\n\t\t\tref,\n\t\t\t() => ( {\n\t\t\t\tgetScales: () => internalChartRef.current?.getScales() || null,\n\t\t\t\tgetChartDimensions: () =>\n\t\t\t\t\tinternalChartRef.current?.getChartDimensions() || { width: 0, height: 0, margin: {} },\n\t\t\t} ),\n\t\t\t[ internalChartRef ]\n\t\t);\n\n\t\tconst dataSorted = useChartDataTransform( data );\n\t\tconst { getElementStyles } = useGlobalChartsContext();\n\n\t\t// Series visibility is owned by the provider, so it applies whether it changed\n\t\t// through the interactive legend or programmatically.\n\t\tconst seriesWithVisibility = useMemo( () => {\n\t\t\treturn dataSorted.map( ( series, index ) => ( {\n\t\t\t\tseries,\n\t\t\t\tindex,\n\t\t\t\tisVisible: ! hiddenSeries.has( series.label ),\n\t\t\t} ) );\n\t\t}, [ dataSorted, hiddenSeries ] );\n\n\t\t// Check if all series are hidden\n\t\tconst allSeriesHidden = useMemo( () => {\n\t\t\treturn seriesWithVisibility.every( ( { isVisible } ) => ! isVisible );\n\t\t}, [ seriesWithVisibility ] );\n\n\t\t// When series visibility changes — via the interactive legend or programmatically —\n\t\t// and rescaling is opted out, pin the value axis to the full data range so it stays\n\t\t// put instead of visx rescaling the domain to whatever is currently visible and\n\t\t// making the axis jump. Default is to rescale, matching the pre-existing behaviour\n\t\t// and AreaChart's `rescaleYOnVisibilityChange`.\n\t\tconst stableYDomain = useMemo< [ number, number ] | undefined >( () => {\n\t\t\tif ( rescaleYOnVisibilityChange ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tlet min = Infinity;\n\t\t\tlet max = -Infinity;\n\t\t\tfor ( const series of dataSorted ) {\n\t\t\t\tfor ( const point of series.data ?? [] ) {\n\t\t\t\t\tconst value = point?.value;\n\t\t\t\t\tif ( typeof value === 'number' && Number.isFinite( value ) ) {\n\t\t\t\t\t\tmin = Math.min( min, value );\n\t\t\t\t\t\tmax = Math.max( max, value );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn min < max ? [ min, max ] : undefined;\n\t\t}, [ rescaleYOnVisibilityChange, dataSorted ] );\n\n\t\t// Use the keyboard navigation hook\n\t\tconst { tooltipRef, onChartFocus, onChartBlur, onChartKeyDown } = useKeyboardNavigation( {\n\t\t\tselectedIndex,\n\t\t\tsetSelectedIndex,\n\t\t\tisNavigating,\n\t\t\tsetIsNavigating,\n\t\t\tchartRef,\n\t\t\ttotalPoints: dataSorted[ 0 ]?.data.length || 0,\n\t\t} );\n\n\t\tconst chartOptions = useMemo( () => {\n\t\t\tconst { tickResolution, tickFormat, ...xAxisOptions } = options?.axis?.x ?? {};\n\t\t\tconst formatter = tickFormat || getFormatter( dataSorted, tickResolution );\n\n\t\t\treturn {\n\t\t\t\taxis: {\n\t\t\t\t\tx: {\n\t\t\t\t\t\torientation: 'bottom' as const,\n\t\t\t\t\t\tnumTicks: guessOptimalNumTicks( dataSorted, width, formatter ),\n\t\t\t\t\t\ttickFormat: formatter,\n\t\t\t\t\t\tdisplay: true,\n\t\t\t\t\t\t...xAxisOptions,\n\t\t\t\t\t},\n\t\t\t\t\ty: {\n\t\t\t\t\t\torientation: 'left' as const,\n\t\t\t\t\t\tnumTicks: 4,\n\t\t\t\t\t\ttickFormat: formatNumberCompact as TickFormatter< number >,\n\t\t\t\t\t\tdisplay: true,\n\t\t\t\t\t\t...options?.axis?.y,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\txScale: {\n\t\t\t\t\ttype: 'time' as const,\n\t\t\t\t\t...options?.xScale,\n\t\t\t\t\t...( zoom.domain ? { domain: zoom.domain } : {} ),\n\t\t\t\t},\n\t\t\t\tyScale: {\n\t\t\t\t\ttype: 'linear' as const,\n\t\t\t\t\tnice: true,\n\t\t\t\t\tzero: false,\n\t\t\t\t\t...( stableYDomain ? { domain: stableYDomain } : {} ),\n\t\t\t\t\t...options?.yScale,\n\t\t\t\t},\n\t\t\t};\n\t\t}, [ options, dataSorted, width, zoom.domain, stableYDomain ] );\n\n\t\tconst tooltipRenderGlyph = useMemo( () => {\n\t\t\treturn ( props: GlyphProps< DataPointDate > ) => {\n\t\t\t\tconst seriesIndex = dataSorted.findIndex(\n\t\t\t\t\tseries =>\n\t\t\t\t\t\tseries.label === props.key || series.data.includes( props.datum as DataPointDate )\n\t\t\t\t);\n\n\t\t\t\tconst seriesData = dataSorted[ seriesIndex ];\n\n\t\t\t\tconst { color, glyph: themeGlyph } = getElementStyles( {\n\t\t\t\t\tdata: seriesData,\n\t\t\t\t\tindex: seriesIndex,\n\t\t\t\t} );\n\n\t\t\t\tconst propsWithResolvedColor = { ...props, color };\n\n\t\t\t\treturn themeGlyph\n\t\t\t\t\t? themeGlyph( propsWithResolvedColor )\n\t\t\t\t\t: renderGlyph( propsWithResolvedColor );\n\t\t\t};\n\t\t}, [ dataSorted, renderGlyph, getElementStyles ] );\n\n\t\tconst defaultMargin = useChartMargin( height, chartOptions, dataSorted, theme );\n\n\t\tconst error = validateData( dataSorted );\n\t\tconst isDataValid = ! error;\n\n\t\t// Memoize legend options to prevent unnecessary re-calculations\n\t\tconst legendOptions = useMemo(\n\t\t\t() => ( {\n\t\t\t\twithGlyph: withLegendGlyph,\n\t\t\t\tglyphSize: Math.max( 0, toNumber( glyphStyle?.radius ) ?? 4 ),\n\t\t\t\tcollapseGroups: legendCollapseGroups,\n\t\t\t\trenderGlyph,\n\t\t\t} ),\n\t\t\t[ withLegendGlyph, glyphStyle?.radius, legendCollapseGroups, renderGlyph ]\n\t\t);\n\n\t\t// Create legend items using the reusable hook\n\t\tconst legendItems = useChartLegendItems( dataSorted, legendOptions, legendShape );\n\n\t\t// Memoize metadata to prevent unnecessary re-registration\n\t\tconst chartMetadata = useMemo(\n\t\t\t() => ( {\n\t\t\t\twithGradientFill,\n\t\t\t\tsmoothing,\n\t\t\t\tcurveType,\n\t\t\t\twithStartGlyphs,\n\t\t\t\twithEndGlyphs,\n\t\t\t\twithLegendGlyph,\n\t\t\t} ),\n\t\t\t[ withGradientFill, smoothing, curveType, withStartGlyphs, withEndGlyphs, withLegendGlyph ]\n\t\t);\n\n\t\t// Register chart with context only if data is valid\n\t\tuseChartRegistration( {\n\t\t\tchartId,\n\t\t\tlegendItems,\n\t\t\tchartType: 'line',\n\t\t\tisDataValid,\n\t\t\tmetadata: chartMetadata,\n\t\t} );\n\n\t\tconst prefersReducedMotion = usePrefersReducedMotion();\n\n\t\tconst accessors = {\n\t\t\txAccessor: ( d: DataPointDate ) => d?.date,\n\t\t\tyAccessor: ( d: DataPointDate ) => d?.value,\n\t\t};\n\n\t\t// Create a custom renderTooltip that includes focus capability\n\t\tif ( error ) {\n\t\t\treturn <div className={ clsx( 'line-chart', styles[ 'line-chart' ] ) }>{ error }</div>;\n\t\t}\n\n\t\tconst legendElement = showLegend && (\n\t\t\t<Legend\n\t\t\t\torientation={ legend.orientation ?? 'horizontal' }\n\t\t\t\talignment={ legend.alignment ?? 'center' }\n\t\t\t\tposition={ legendPosition }\n\t\t\t\tlabelStyles={ legend.labelStyles }\n\t\t\t\titemClassName={ legend.itemClassName }\n\t\t\t\titemStyles={ legend.itemStyles }\n\t\t\t\tshapeStyles={ legend.shapeStyles }\n\t\t\t\tclassName={ styles[ 'line-chart__legend' ] }\n\t\t\t\tshape={ legendShape }\n\t\t\t\tchartId={ chartId }\n\t\t\t\tinteractive={ legendInteractive }\n\t\t\t/>\n\t\t);\n\n\t\treturn (\n\t\t\t<ChartInstanceContext.Provider\n\t\t\t\tvalue={ {\n\t\t\t\t\tchartId,\n\t\t\t\t\tchartRef: internalChartRef,\n\t\t\t\t\tisSeriesVisible,\n\t\t\t\t\tchartWidth: width,\n\t\t\t\t\tchartHeight: measuredChartHeight || 0,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<ChartLayout\n\t\t\t\t\tlegendPosition={ legendPosition }\n\t\t\t\t\tlegendElement={ legendElement }\n\t\t\t\t\tlegendChildren={ legendChildren }\n\t\t\t\t\tgap={ gap }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'line-chart',\n\t\t\t\t\t\tstyles[ 'line-chart' ],\n\t\t\t\t\t\t{ [ styles[ 'line-chart--animated' ] ]: animation && ! prefersReducedMotion },\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ { width, height } }\n\t\t\t\t\tdata-testid=\"line-chart\"\n\t\t\t\t\ttrailingContent={ nonLegendChildren }\n\t\t\t\t\tonContentHeightChange={ handleContentHeightChange }\n\t\t\t\t>\n\t\t\t\t\t{ ( { contentHeight } ) => {\n\t\t\t\t\t\t// Use the measured height, falling back to the passed height if provided.\n\t\t\t\t\t\tconst chartHeight = contentHeight > 0 ? contentHeight : height;\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\trole=\"grid\"\n\t\t\t\t\t\t\t\taria-label={ __( 'Line chart', 'jetpack-charts' ) }\n\t\t\t\t\t\t\t\ttabIndex={ 0 }\n\t\t\t\t\t\t\t\tonKeyDown={ onChartKeyDown }\n\t\t\t\t\t\t\t\tonFocus={ onChartFocus }\n\t\t\t\t\t\t\t\tonBlur={ onChartBlur }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ chartHeight > 0 && (\n\t\t\t\t\t\t\t\t\t<div ref={ chartRef } style={ { position: 'relative' } }>\n\t\t\t\t\t\t\t\t\t\t{ zoomable && zoom.domain && <ZoomResetButton onClick={ zoom.reset } /> }\n\t\t\t\t\t\t\t\t\t\t<XYChart\n\t\t\t\t\t\t\t\t\t\t\ttheme={ theme }\n\t\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\t\theight={ chartHeight }\n\t\t\t\t\t\t\t\t\t\t\tmargin={ {\n\t\t\t\t\t\t\t\t\t\t\t\t...defaultMargin,\n\t\t\t\t\t\t\t\t\t\t\t\t...margin,\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t// xScale and yScale could be set in Axis as well, but they are `scale` props there.\n\t\t\t\t\t\t\t\t\t\t\txScale={ chartOptions.xScale }\n\t\t\t\t\t\t\t\t\t\t\tyScale={ chartOptions.yScale }\n\t\t\t\t\t\t\t\t\t\t\tonPointerDown={ zoom.handlers.onPointerDown }\n\t\t\t\t\t\t\t\t\t\t\tonPointerUp={ zoom.handlers.onPointerUp }\n\t\t\t\t\t\t\t\t\t\t\tonPointerMove={ zoom.handlers.onPointerMove }\n\t\t\t\t\t\t\t\t\t\t\tonPointerOut={ onPointerOut }\n\t\t\t\t\t\t\t\t\t\t\tpointerEventsDataKey=\"nearest\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ /* With every series hidden there is no data to scale against, so the grid and\n\t\t\t\t\t\t\t\t\t\t\t axes are dropped while the empty state stands in — otherwise they render\n\t\t\t\t\t\t\t\t\t\t\t squished at the top. */ }\n\t\t\t\t\t\t\t\t\t\t\t{ ! allSeriesHidden && gridVisibility !== 'none' && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Grid columns={ false } numTicks={ 4 } />\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t{ ! allSeriesHidden && chartOptions.axis.x.display && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Axis { ...chartOptions.axis.x } />\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t{ ! allSeriesHidden && chartOptions.axis.y.display && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Axis { ...chartOptions.axis.y } />\n\t\t\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t\t\t{ allSeriesHidden ? (\n\t\t\t\t\t\t\t\t\t\t\t\t<SvgEmptyState\n\t\t\t\t\t\t\t\t\t\t\t\t\tx={ width / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\t\ty={ chartHeight / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\t\t\t\theight={ chartHeight }\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ getAllHiddenMessage( legendInteractive, 'series' ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</SvgEmptyState>\n\t\t\t\t\t\t\t\t\t\t\t) : null }\n\n\t\t\t\t\t\t\t\t\t\t\t{ /* Line is not animated, so clip only while zoomed; its edge glyphs sit on the plot border and must not be clipped. */ }\n\t\t\t\t\t\t\t\t\t\t\t<ZoomClip active={ zoomable && !! zoom.domain } chartId={ chartId }>\n\t\t\t\t\t\t\t\t\t\t\t\t{ seriesWithVisibility.map(\n\t\t\t\t\t\t\t\t\t\t\t\t\t( { series: seriesData, index, isVisible } ) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Skip rendering invisible series\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif ( ! isVisible ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst { color, lineStyles, glyph } = getElementStyles( {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata: seriesData,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst lineProps = {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstroke: color,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t...lineStyles,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<g key={ seriesData?.label || index }>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ withGradientFill && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<LinearGradient\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tid={ `area-gradient-${ chartId }-${ index + 1 }` }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfrom={ color }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfromOpacity={ 0.4 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttoOpacity={ 0.1 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tto={ resolvedBackgroundColor }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ ...seriesData.options?.gradient }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata-testid=\"line-gradient\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ seriesData.options?.gradient?.stops?.map(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t( stop, stopIndex ) => (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<stop\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={ `${ stop.offset }-${ stop.color || color }` }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toffset={ stop.offset }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstopColor={ stop.color || color }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstopOpacity={ stop.opacity ?? 1 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata-testid={ `line-gradient-stop-${ chartId }-${ index }-${ stopIndex }` }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</LinearGradient>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<AreaSeries\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={ seriesData?.label }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdataKey={ seriesData?.label }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata={ seriesData.data as DataPointDate[] }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ ...accessors }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfill={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twithGradientFill\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? `url(#area-gradient-${ chartId }-${ index + 1 })`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 'transparent'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\trenderLine={ true }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcurve={ getCurveType( curveType, smoothing ) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlineProps={ lineProps }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ withStartGlyphs && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<LineChartGlyph\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex={ index }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata={ seriesData }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcolor={ color }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\trenderGlyph={ glyph ?? renderGlyph }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\taccessors={ accessors }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tglyphStyle={ glyphStyle }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tposition=\"start\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ withEndGlyphs && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<LineChartGlyph\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex={ index }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata={ seriesData }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcolor={ color }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\trenderGlyph={ glyph ?? renderGlyph }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\taccessors={ accessors }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tglyphStyle={ glyphStyle }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tposition=\"end\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</g>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t</ZoomClip>\n\n\t\t\t\t\t\t\t\t\t\t\t{ withTooltips && (\n\t\t\t\t\t\t\t\t\t\t\t\t<AccessibleTooltip\n\t\t\t\t\t\t\t\t\t\t\t\t\tdetectBounds\n\t\t\t\t\t\t\t\t\t\t\t\t\tsnapTooltipToDatumX\n\t\t\t\t\t\t\t\t\t\t\t\t\tsnapTooltipToDatumY\n\t\t\t\t\t\t\t\t\t\t\t\t\tshowSeriesGlyphs\n\t\t\t\t\t\t\t\t\t\t\t\t\trenderTooltip={ renderTooltip }\n\t\t\t\t\t\t\t\t\t\t\t\t\trenderGlyph={ tooltipRenderGlyph }\n\t\t\t\t\t\t\t\t\t\t\t\t\tglyphStyle={ glyphStyle }\n\t\t\t\t\t\t\t\t\t\t\t\t\tshowVerticalCrosshair={ withTooltipCrosshairs?.showVertical }\n\t\t\t\t\t\t\t\t\t\t\t\t\tshowHorizontalCrosshair={ withTooltipCrosshairs?.showHorizontal }\n\t\t\t\t\t\t\t\t\t\t\t\t\tselectedIndex={ selectedIndex }\n\t\t\t\t\t\t\t\t\t\t\t\t\ttooltipRef={ tooltipRef }\n\t\t\t\t\t\t\t\t\t\t\t\t\tkeyboardFocusedClassName={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstyles[ 'line-chart__tooltip--keyboard-focused' ]\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tseries={ dataSorted }\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t\t\t{ /* Component to expose scale data via ref */ }\n\t\t\t\t\t\t\t\t\t\t\t<LineChartScalesRef\n\t\t\t\t\t\t\t\t\t\t\t\tchartRef={ internalChartRef }\n\t\t\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\t\t\theight={ height }\n\t\t\t\t\t\t\t\t\t\t\t\tmargin={ margin }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t{ zoomable && <ZoomSelectionRect drag={ zoom.drag } /> }\n\t\t\t\t\t\t\t\t\t\t</XYChart>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t</ChartLayout>\n\t\t\t</ChartInstanceContext.Provider>\n\t\t);\n\t}\n);\n\n// Component type definitions for composition API\ntype LineChartAnnotationComponents = {\n\tAnnotationsOverlay: typeof LineChartAnnotationsOverlay;\n\tAnnotation: typeof LineChartAnnotation;\n\tLegend: typeof Legend;\n};\n\ntype LineChartBaseProps = Optional< LineChartProps, 'width' | 'height' | 'size' >;\n\ntype LineChartComponent = React.ForwardRefExoticComponent<\n\tLineChartBaseProps & React.RefAttributes< ChartInstanceRef >\n> &\n\tLineChartAnnotationComponents;\n\ntype LineChartResponsiveComponent = React.ForwardRefExoticComponent<\n\tLineChartBaseProps & ResponsiveConfig & React.RefAttributes< ChartInstanceRef >\n> &\n\tLineChartAnnotationComponents;\n\nconst LineChartWithProvider = forwardRef< ChartInstanceRef, LineChartProps >( ( props, ref ) => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, render the core component directly\n\tif ( existingContext ) {\n\t\treturn <LineChartInternal { ...props } ref={ ref } />;\n\t}\n\n\t// Otherwise, wrap with our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<LineChartInternal { ...props } ref={ ref } />\n\t\t</GlobalChartsProvider>\n\t);\n} );\n\nLineChartWithProvider.displayName = 'LineChart';\n\nconst LineChart = attachSubComponents( LineChartWithProvider, {\n\tLegend: Legend,\n\tAnnotationsOverlay: LineChartAnnotationsOverlay,\n\tAnnotation: LineChartAnnotation,\n} ) as LineChartComponent;\n\nconst LineChartResponsive = attachSubComponents(\n\twithResponsive< LineChartProps >( LineChartWithProvider ),\n\t{\n\t\tLegend: Legend,\n\t\tAnnotationsOverlay: LineChartAnnotationsOverlay,\n\t\tAnnotation: LineChartAnnotation,\n\t}\n) as LineChartResponsiveComponent;\n\nexport { LineChartResponsive as default, LineChart as LineChartUnresponsive };\n","import { __ } from '@wordpress/i18n';\nimport type { DataPoint, DataPointDate, SeriesData } from '../../../types';\n\n/**\n * Up-front data validation. Returns a localised error message when the chart\n * cannot safely render, otherwise `null`. Catches the cases that would\n * NaN-cascade through the tick formatter and stack layout: empty top-level\n * array, empty per-series data, null/NaN values, invalid dates.\n *\n * @param data - Series data passed to AreaChart.\n * @return Error message, or `null` if the data is renderable.\n */\nexport const validateData = ( data: SeriesData[] ) => {\n\tif ( ! data?.length ) return __( 'No data available', 'jetpack-charts' );\n\n\tconst hasEmptySeries = data.some( series => ! series.data?.length );\n\tif ( hasEmptySeries ) return __( 'No data available', 'jetpack-charts' );\n\n\tconst hasInvalidData = data.some( series =>\n\t\tseries.data.some(\n\t\t\t( point: DataPointDate | DataPoint ) =>\n\t\t\t\tisNaN( point.value as number ) ||\n\t\t\t\tpoint.value === null ||\n\t\t\t\tpoint.value === undefined ||\n\t\t\t\t( 'date' in point && point.date && isNaN( point.date.getTime() ) )\n\t\t)\n\t);\n\n\tif ( hasInvalidData ) return __( 'Invalid data', 'jetpack-charts' );\n\treturn null;\n};\n","import { DataContext, TooltipContext } from '@visx/xychart';\nimport { useContext, useImperativeHandle } from 'react';\nimport type { ElementStyles, GetElementStylesParams } from '../../../providers';\nimport type { DataPointDate, SeriesData } from '../../../types';\nimport type { ChartInstanceRef } from '../../private/chart-instance-context';\nimport type { FC, ReactNode, Ref } from 'react';\n\nexport type VisibleSeriesEntry = { series: SeriesData; index: number; isVisible: boolean };\n\n// AreaChart only configures time + linear scales; cast to a callable shape\n// instead of spreading `any`. `Number(...)` + `isFinite` guards every call.\ntype ScaleFn = ( input: Date | number ) => number;\n\n// Bridges visx's `DataContext` to the chart's `ChartInstanceRef` so consumers\n// can read scales and dimensions imperatively. Must be inside `<XYChart>`.\nexport const AreaChartScalesRef: FC< {\n\tchartRef?: Ref< ChartInstanceRef >;\n\twidth: number;\n\theight: number;\n\tmargin?: { top?: number; right?: number; bottom?: number; left?: number };\n} > = ( { chartRef, width, height, margin } ) => {\n\tconst context = useContext( DataContext );\n\n\tuseImperativeHandle(\n\t\tchartRef,\n\t\t() => ( {\n\t\t\tgetScales: () => {\n\t\t\t\tif ( ! context?.xScale || ! context?.yScale ) return null;\n\t\t\t\treturn { xScale: context.xScale, yScale: context.yScale };\n\t\t\t},\n\t\t\tgetChartDimensions: () => ( { width, height, margin: margin || {} } ),\n\t\t} ),\n\t\t[ context, width, height, margin ]\n\t);\n\n\treturn null;\n};\n\n// Hover indicators for each visible series. visx's `showSeriesGlyphs`\n// mispositions on AreaStack (its registered yAccessor expects a stack-bar\n// but receives the unwrapped datum, yielding NaN), so we compute positions\n// from the chart's scales: cumulative top edge for stacked + offset='none'\n// (matches d3-stack — missing values count as 0); raw y for unstacked.\n// Skipped for `expand`/`wiggle`/`silhouette` — exact positions there would\n// need re-running the d3-stack layout.\nexport const HoverGlyphs: FC< {\n\tvisibleSeries: VisibleSeriesEntry[];\n\tstacked: boolean;\n\tstackOffset: 'none' | 'expand' | 'wiggle' | 'silhouette';\n\tgetElementStyles: ( params: GetElementStylesParams ) => ElementStyles;\n\tstrokeColor: string;\n} > = ( { visibleSeries, stacked, stackOffset, getElementStyles, strokeColor } ) => {\n\tconst dataContext = useContext( DataContext );\n\tconst tooltipContext = useContext( TooltipContext );\n\n\tconst xScale = dataContext?.xScale as ScaleFn | undefined;\n\tconst yScale = dataContext?.yScale as ScaleFn | undefined;\n\tconst tooltipOpen = tooltipContext?.tooltipOpen;\n\tconst nearestDatum = tooltipContext?.tooltipData?.nearestDatum?.datum as\n\t\t| DataPointDate\n\t\t| undefined;\n\n\tif (\n\t\t! tooltipOpen ||\n\t\t! xScale ||\n\t\t! yScale ||\n\t\t! nearestDatum ||\n\t\t! nearestDatum.date ||\n\t\t( stacked && stackOffset !== 'none' )\n\t) {\n\t\treturn null;\n\t}\n\n\tconst xPx = Number( xScale( nearestDatum.date ) );\n\tif ( ! Number.isFinite( xPx ) ) return null;\n\n\tconst hoveredTime = nearestDatum.date.getTime();\n\tlet cumulative = 0;\n\tconst circles: ReactNode[] = [];\n\n\t// Always advance `cumulative` (d3-stack treats missing/null as 0), but\n\t// only render a glyph when the series has a real value at this x.\n\tfor ( const { series, index } of visibleSeries ) {\n\t\tconst datum = series.data.find(\n\t\t\td => ( d as DataPointDate ).date?.getTime() === hoveredTime\n\t\t) as DataPointDate | undefined;\n\n\t\tconst value = datum?.value ?? 0;\n\t\tif ( stacked ) {\n\t\t\tcumulative += value;\n\t\t}\n\n\t\tif ( ! datum || datum.value == null ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst yPx = Number( yScale( stacked ? cumulative : value ) );\n\t\tif ( ! Number.isFinite( yPx ) ) continue;\n\n\t\tconst { color } = getElementStyles( { data: series, index } );\n\t\tcircles.push(\n\t\t\t<circle\n\t\t\t\tkey={ series.label || index }\n\t\t\t\tcx={ xPx }\n\t\t\t\tcy={ yPx }\n\t\t\t\tr={ 4 }\n\t\t\t\tfill={ color }\n\t\t\t\tstroke={ strokeColor }\n\t\t\t\tstrokeWidth={ 1.5 }\n\t\t\t\tpaintOrder=\"fill\"\n\t\t\t\tdata-testid={ `area-chart-hover-glyph-${ index }` }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( circles.length === 0 ) return null;\n\n\treturn (\n\t\t<g pointerEvents=\"none\" className=\"area-chart__hover-glyphs\">\n\t\t\t{ circles }\n\t\t</g>\n\t);\n};\n","import { formatNumberCompact } from '@automattic/number-formatters';\nimport { XYChart, AnimatedAreaSeries, AnimatedAreaStack, Grid, Axis } from '@visx/xychart';\nimport { __ } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport {\n\tuseMemo,\n\tuseContext,\n\tforwardRef,\n\tuseImperativeHandle,\n\tuseState,\n\tuseRef,\n\tuseCallback,\n} from 'react';\nimport { Legend, useChartLegendItems } from '../../components/legend';\nimport { AccessibleTooltip, useKeyboardNavigation } from '../../components/tooltip';\nimport {\n\tuseXYChartTheme,\n\tuseChartDataTransform,\n\tuseChartMargin,\n\tusePrefersReducedMotion,\n} from '../../hooks';\nimport {\n\tGlobalChartsProvider,\n\tGlobalChartsContext,\n\tuseChartId,\n\tuseChartRegistration,\n\tuseGlobalChartsContext,\n\tuseGlobalChartsTheme,\n} from '../../providers';\nimport { useDefaultHiddenSeries } from '../../providers/chart-context/hooks/use-default-hidden-series';\nimport { attachSubComponents } from '../../utils';\nimport { renderDefaultTooltip } from '../line-chart';\nimport { useChartChildren } from '../private/chart-composition';\nimport { ChartInstanceContext, type ChartInstanceRef } from '../private/chart-instance-context';\nimport { ChartLayout } from '../private/chart-layout';\nimport { getAllHiddenMessage, SvgEmptyState } from '../private/svg-empty-state';\nimport { getCurveType, getFormatter, guessOptimalNumTicks } from '../private/time-axis';\nimport { withResponsive } from '../private/with-responsive';\nimport { useXZoom, ZoomResetButton, ZoomSelectionRect, ZoomClip } from '../private/x-zoom';\nimport styles from './area-chart.module.scss';\nimport { AreaChartScalesRef, HoverGlyphs, validateData } from './private';\nimport type { AreaChartProps } from './types';\nimport type { DataPointDate, Optional } from '../../types';\nimport type { ResponsiveConfig } from '../private/with-responsive';\nimport type { TickFormatter } from '@visx/axis';\n\nconst AreaChartInternal = forwardRef< ChartInstanceRef, AreaChartProps >(\n\t(\n\t\t{\n\t\t\tdata,\n\t\t\tchartId: providedChartId,\n\t\t\twidth,\n\t\t\theight,\n\t\t\tclassName,\n\t\t\tmargin,\n\t\t\twithTooltips = true,\n\t\t\twithTooltipCrosshairs,\n\t\t\tshowLegend = false,\n\t\t\tlegend = {},\n\t\t\tstacked = true,\n\t\t\tstackOffset = 'none',\n\t\t\tsmoothing = true,\n\t\t\tcurveType,\n\t\t\tfillOpacity,\n\t\t\twithStroke,\n\t\t\trenderTooltip = renderDefaultTooltip,\n\t\t\tanimation,\n\t\t\toptions = {},\n\t\t\tonPointerDown,\n\t\t\tonPointerUp,\n\t\t\tonPointerMove,\n\t\t\tonPointerOut,\n\t\t\tzoomable = false,\n\t\t\trescaleYOnVisibilityChange,\n\t\t\trescaleYOnLegendToggle,\n\t\t\tdefaultHiddenSeries,\n\t\t\tchildren,\n\t\t\tgridVisibility,\n\t\t\tgap = 'md',\n\t\t},\n\t\tref\n\t) => {\n\t\tconst legendInteractive = legend.interactive ?? false;\n\t\tconst legendShape = legend.shape ?? 'rect';\n\t\tconst legendPosition = legend.position ?? 'bottom';\n\n\t\t// New prop wins; fall back to the deprecated `rescaleYOnLegendToggle`; default to rescaling.\n\t\tconst rescaleYOnVisibility = rescaleYOnVisibilityChange ?? rescaleYOnLegendToggle ?? true;\n\n\t\tconst providerTheme = useGlobalChartsTheme();\n\t\tconst theme = useXYChartTheme( data );\n\t\tconst chartId = useChartId( providedChartId );\n\t\tconst hiddenSeries = useDefaultHiddenSeries( chartId, defaultHiddenSeries );\n\t\tconst isSeriesVisible = useCallback(\n\t\t\t( seriesLabel: string ) => ! hiddenSeries.has( seriesLabel ),\n\t\t\t[ hiddenSeries ]\n\t\t);\n\t\tconst chartRef = useRef< HTMLDivElement >( null );\n\t\tconst [ selectedIndex, setSelectedIndex ] = useState< number | undefined >( undefined );\n\t\tconst [ isNavigating, setIsNavigating ] = useState( false );\n\t\tconst internalChartRef = useRef< ChartInstanceRef >( null );\n\n\t\tconst zoom = useXZoom< Date >( {\n\t\t\tenabled: zoomable,\n\t\t\tchartRef: internalChartRef,\n\t\t\tuserHandlers: { onPointerDown, onPointerMove, onPointerUp },\n\t\t} );\n\n\t\tconst { legendChildren, nonLegendChildren } = useChartChildren( children, 'AreaChart' );\n\t\tconst [ measuredChartHeight, setMeasuredChartHeight ] = useState< number | undefined >();\n\n\t\tconst handleContentHeightChange = useCallback(\n\t\t\t( contentHeight: number ) => {\n\t\t\t\tconst chartHeight = contentHeight > 0 ? contentHeight : height;\n\t\t\t\tsetMeasuredChartHeight( chartHeight );\n\t\t\t},\n\t\t\t[ height ]\n\t\t);\n\n\t\tuseImperativeHandle(\n\t\t\tref,\n\t\t\t() => ( {\n\t\t\t\tgetScales: () => internalChartRef.current?.getScales() || null,\n\t\t\t\tgetChartDimensions: () =>\n\t\t\t\t\tinternalChartRef.current?.getChartDimensions() || { width: 0, height: 0, margin: {} },\n\t\t\t} ),\n\t\t\t[ internalChartRef ]\n\t\t);\n\n\t\tconst dataSorted = useChartDataTransform( data );\n\t\tconst { getElementStyles } = useGlobalChartsContext();\n\n\t\tconst seriesWithVisibility = useMemo( () => {\n\t\t\treturn dataSorted.map( ( series, index ) => ( {\n\t\t\t\tseries,\n\t\t\t\tindex,\n\t\t\t\tisVisible: ! hiddenSeries.has( series.label ),\n\t\t\t} ) );\n\t\t}, [ dataSorted, hiddenSeries ] );\n\n\t\tconst allSeriesHidden = useMemo(\n\t\t\t() => seriesWithVisibility.every( ( { isVisible } ) => ! isVisible ),\n\t\t\t[ seriesWithVisibility ]\n\t\t);\n\n\t\tconst { tooltipRef, onChartFocus, onChartBlur, onChartKeyDown } = useKeyboardNavigation( {\n\t\t\tselectedIndex,\n\t\t\tsetSelectedIndex,\n\t\t\tisNavigating,\n\t\t\tsetIsNavigating,\n\t\t\tchartRef,\n\t\t\ttotalPoints: dataSorted[ 0 ]?.data.length || 0,\n\t\t} );\n\n\t\t// Computed from the full data set (ignoring legend visibility) so the y-axis stays\n\t\t// fixed when series are toggled off - otherwise visx auto-fits to the remaining\n\t\t// data and the chart's baseline appears to move. Opt-in via\n\t\t// `rescaleYOnVisibilityChange={ false }`. Skipped for non-default stack offsets,\n\t\t// which reshape the y-extent (`expand` -> [0,1], `wiggle`/`silhouette` -> centred\n\t\t// around zero); letting visx derive the domain is correct there.\n\t\tconst fixedYDomain = useMemo< [ number, number ] | undefined >( () => {\n\t\t\tif (\n\t\t\t\trescaleYOnVisibility ||\n\t\t\t\t! dataSorted.length ||\n\t\t\t\t! dataSorted[ 0 ].data.length ||\n\t\t\t\t( stacked && stackOffset !== 'none' )\n\t\t\t) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tif ( stacked ) {\n\t\t\t\t// d3-stack with `offset: 'none'` stacks positives upward from 0 and\n\t\t\t\t// negatives downward from 0, so we need both extremes.\n\t\t\t\tconst numPoints = Math.max( ...dataSorted.map( s => s.data.length ) );\n\t\t\t\tlet posMax = 0;\n\t\t\t\tlet negMin = 0;\n\t\t\t\tfor ( let i = 0; i < numPoints; i++ ) {\n\t\t\t\t\tlet posSum = 0;\n\t\t\t\t\tlet negSum = 0;\n\t\t\t\t\tfor ( const series of dataSorted ) {\n\t\t\t\t\t\tconst v = Number( series.data[ i ]?.value );\n\t\t\t\t\t\tif ( Number.isNaN( v ) ) continue;\n\t\t\t\t\t\tif ( v >= 0 ) posSum += v;\n\t\t\t\t\t\telse negSum += v;\n\t\t\t\t\t}\n\t\t\t\t\tif ( posSum > posMax ) posMax = posSum;\n\t\t\t\t\tif ( negSum < negMin ) negMin = negSum;\n\t\t\t\t}\n\t\t\t\treturn [ negMin, posMax ];\n\t\t\t}\n\n\t\t\tlet max = -Infinity;\n\t\t\tlet min = Infinity;\n\t\t\tfor ( const series of dataSorted ) {\n\t\t\t\tfor ( const point of series.data ) {\n\t\t\t\t\tconst v = Number( point?.value );\n\t\t\t\t\tif ( ! Number.isNaN( v ) ) {\n\t\t\t\t\t\tif ( v > max ) max = v;\n\t\t\t\t\t\tif ( v < min ) min = v;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( max === -Infinity ) return undefined;\n\t\t\treturn [ Math.min( 0, min ), max ];\n\t\t}, [ dataSorted, stacked, stackOffset, rescaleYOnVisibility ] );\n\n\t\tconst chartOptions = useMemo( () => {\n\t\t\tconst { tickResolution, tickFormat, ...xAxisOptions } = options?.axis?.x ?? {};\n\t\t\tconst formatter = tickFormat || getFormatter( dataSorted, tickResolution );\n\n\t\t\treturn {\n\t\t\t\taxis: {\n\t\t\t\t\tx: {\n\t\t\t\t\t\torientation: 'bottom' as const,\n\t\t\t\t\t\tnumTicks: guessOptimalNumTicks( dataSorted, width, formatter ),\n\t\t\t\t\t\ttickFormat: formatter,\n\t\t\t\t\t\tdisplay: true,\n\t\t\t\t\t\t...xAxisOptions,\n\t\t\t\t\t},\n\t\t\t\t\ty: {\n\t\t\t\t\t\torientation: 'left' as const,\n\t\t\t\t\t\tnumTicks: 4,\n\t\t\t\t\t\ttickFormat: formatNumberCompact as TickFormatter< number >,\n\t\t\t\t\t\tdisplay: true,\n\t\t\t\t\t\t...options?.axis?.y,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\txScale: {\n\t\t\t\t\ttype: 'time' as const,\n\t\t\t\t\t...options?.xScale,\n\t\t\t\t\t...( zoom.domain ? { domain: zoom.domain } : {} ),\n\t\t\t\t},\n\t\t\t\tyScale: {\n\t\t\t\t\ttype: 'linear' as const,\n\t\t\t\t\tnice: true,\n\t\t\t\t\t// Stacked areas should always include zero so the baseline is meaningful.\n\t\t\t\t\tzero: stacked,\n\t\t\t\t\t...( fixedYDomain ? { domain: fixedYDomain } : {} ),\n\t\t\t\t\t...options?.yScale,\n\t\t\t\t},\n\t\t\t};\n\t\t}, [ options, dataSorted, width, stacked, fixedYDomain, zoom.domain ] );\n\n\t\tconst defaultMargin = useChartMargin( height, chartOptions, dataSorted, theme );\n\n\t\tconst error = validateData( dataSorted );\n\t\tconst isDataValid = ! error;\n\n\t\tconst legendOptions = useMemo(\n\t\t\t() => ( {\n\t\t\t\twithGlyph: false,\n\t\t\t\tglyphSize: 0,\n\t\t\t\tcollapseGroups: legend.collapseGroups ?? false,\n\t\t\t} ),\n\t\t\t[ legend.collapseGroups ]\n\t\t);\n\t\tconst legendItems = useChartLegendItems( dataSorted, legendOptions, legendShape );\n\n\t\tconst chartMetadata = useMemo(\n\t\t\t() => ( { stacked, stackOffset, smoothing, curveType } ),\n\t\t\t[ stacked, stackOffset, smoothing, curveType ]\n\t\t);\n\n\t\tuseChartRegistration( {\n\t\t\tchartId,\n\t\t\tlegendItems,\n\t\t\tchartType: 'area',\n\t\t\tisDataValid,\n\t\t\tmetadata: chartMetadata,\n\t\t} );\n\n\t\tconst prefersReducedMotion = usePrefersReducedMotion();\n\t\tconst animationEnabled = !! animation && ! prefersReducedMotion;\n\n\t\tconst accessors = {\n\t\t\txAccessor: ( d: DataPointDate ) => d?.date,\n\t\t\tyAccessor: ( d: DataPointDate ) => d?.value,\n\t\t};\n\t\tconst zeroYAccessor = useCallback( () => 0, [] );\n\n\t\t// Hidden series are still registered with visx (so paths can interpolate), but their\n\t\t// data points should not appear in the tooltip.\n\t\tconst visibleLabels = useMemo(\n\t\t\t() => new Set( seriesWithVisibility.filter( s => s.isVisible ).map( s => s.series.label ) ),\n\t\t\t[ seriesWithVisibility ]\n\t\t);\n\t\tconst filteredRenderTooltip = useCallback(\n\t\t\t( params: Parameters< typeof renderTooltip >[ 0 ] ) => {\n\t\t\t\tconst datumByKey = params?.tooltipData?.datumByKey;\n\t\t\t\tif ( ! datumByKey ) return renderTooltip( params );\n\t\t\t\tconst filtered = Object.fromEntries(\n\t\t\t\t\tObject.entries( datumByKey ).filter( ( [ key ] ) => visibleLabels.has( key ) )\n\t\t\t\t);\n\t\t\t\tif ( Object.keys( filtered ).length === 0 ) return null;\n\t\t\t\t// `nearestDatum` may still point at a hidden series; re-point it at the first\n\t\t\t\t// visible entry so consumers that read it (e.g. for the tooltip heading) don't\n\t\t\t\t// surface hidden-series state.\n\t\t\t\tconst nearestDatum = params?.tooltipData?.nearestDatum;\n\t\t\t\tconst nextNearest =\n\t\t\t\t\tnearestDatum && visibleLabels.has( nearestDatum.key )\n\t\t\t\t\t\t? nearestDatum\n\t\t\t\t\t\t: { ...Object.values( filtered )[ 0 ], distance: nearestDatum?.distance ?? 0 };\n\t\t\t\treturn renderTooltip( {\n\t\t\t\t\t...params,\n\t\t\t\t\ttooltipData: {\n\t\t\t\t\t\t...params.tooltipData,\n\t\t\t\t\t\tdatumByKey: filtered,\n\t\t\t\t\t\tnearestDatum: nextNearest,\n\t\t\t\t\t} as typeof params.tooltipData,\n\t\t\t\t} );\n\t\t\t},\n\t\t\t[ renderTooltip, visibleLabels ]\n\t\t);\n\n\t\t// Defaults that depend on stacked vs overlapping mode.\n\t\tconst resolvedFillOpacity = fillOpacity ?? ( stacked ? 0.85 : 0.4 );\n\t\tconst resolvedWithStroke = withStroke ?? ! stacked;\n\n\t\tif ( error ) {\n\t\t\treturn <div className={ clsx( 'area-chart', styles[ 'area-chart' ] ) }>{ error }</div>;\n\t\t}\n\n\t\tconst legendElement = showLegend && (\n\t\t\t<Legend\n\t\t\t\torientation={ legend.orientation ?? 'horizontal' }\n\t\t\t\talignment={ legend.alignment ?? 'center' }\n\t\t\t\tposition={ legendPosition }\n\t\t\t\tlabelStyles={ legend.labelStyles }\n\t\t\t\titemClassName={ legend.itemClassName }\n\t\t\t\titemStyles={ legend.itemStyles }\n\t\t\t\tshapeStyles={ legend.shapeStyles }\n\t\t\t\tclassName={ styles[ 'area-chart__legend' ] }\n\t\t\t\tshape={ legendShape }\n\t\t\t\tchartId={ chartId }\n\t\t\t\tinteractive={ legendInteractive }\n\t\t\t/>\n\t\t);\n\n\t\tconst visibleSeries = seriesWithVisibility.filter( ( { isVisible } ) => isVisible );\n\t\tconst curve = getCurveType( curveType, smoothing );\n\n\t\t// Visx's `<AreaStack>` keys each `<Area>` by `stackIndex-dataKey`, so filtering out\n\t\t// a hidden series would shift indexes and remount every path. Instead we keep every\n\t\t// series mounted and zero out hidden ones via `yAccessor` — react-spring then\n\t\t// interpolates the `d` attribute, giving a smooth \"going down\" effect for the\n\t\t// hidden area and a smooth re-flow for the rest.\n\t\tconst renderSeries = ( {\n\t\t\tseries: seriesData,\n\t\t\tindex,\n\t\t\tisVisible,\n\t\t}: ( typeof seriesWithVisibility )[ number ] ) => {\n\t\t\tconst { color, lineStyles } = getElementStyles( { data: seriesData, index } );\n\t\t\treturn (\n\t\t\t\t<AnimatedAreaSeries\n\t\t\t\t\tkey={ seriesData?.label || index }\n\t\t\t\t\tdataKey={ seriesData?.label }\n\t\t\t\t\tdata={ seriesData.data as DataPointDate[] }\n\t\t\t\t\txAccessor={ accessors.xAccessor }\n\t\t\t\t\tyAccessor={ isVisible ? accessors.yAccessor : zeroYAccessor }\n\t\t\t\t\tfill={ color }\n\t\t\t\t\tfillOpacity={ resolvedFillOpacity }\n\t\t\t\t\t{ ...( stacked ? {} : { renderLine: resolvedWithStroke, curve } ) }\n\t\t\t\t\tlineProps={ { stroke: color, ...lineStyles } }\n\t\t\t\t\tdata-testid={ `area-chart-series-${ index }` }\n\t\t\t\t/>\n\t\t\t);\n\t\t};\n\n\t\treturn (\n\t\t\t<ChartInstanceContext.Provider\n\t\t\t\tvalue={ {\n\t\t\t\t\tchartId,\n\t\t\t\t\tchartRef: internalChartRef,\n\t\t\t\t\tisSeriesVisible,\n\t\t\t\t\tchartWidth: width,\n\t\t\t\t\tchartHeight: measuredChartHeight || 0,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<ChartLayout\n\t\t\t\t\tlegendPosition={ legendPosition }\n\t\t\t\t\tlegendElement={ legendElement }\n\t\t\t\t\tlegendChildren={ legendChildren }\n\t\t\t\t\tgap={ gap }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'area-chart',\n\t\t\t\t\t\tstyles[ 'area-chart' ],\n\t\t\t\t\t\t{ [ styles[ 'area-chart--animated' ] ]: animationEnabled },\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ { width, height } }\n\t\t\t\t\tdata-testid=\"area-chart\"\n\t\t\t\t\ttrailingContent={ nonLegendChildren }\n\t\t\t\t\tonContentHeightChange={ handleContentHeightChange }\n\t\t\t\t>\n\t\t\t\t\t{ ( { contentHeight } ) => {\n\t\t\t\t\t\tconst chartHeight = contentHeight > 0 ? contentHeight : height;\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\trole=\"grid\"\n\t\t\t\t\t\t\t\taria-label={ __( 'Area chart', 'jetpack-charts' ) }\n\t\t\t\t\t\t\t\ttabIndex={ 0 }\n\t\t\t\t\t\t\t\tonKeyDown={ onChartKeyDown }\n\t\t\t\t\t\t\t\tonFocus={ onChartFocus }\n\t\t\t\t\t\t\t\tonBlur={ onChartBlur }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ chartHeight > 0 && (\n\t\t\t\t\t\t\t\t\t<div ref={ chartRef } style={ { position: 'relative' } }>\n\t\t\t\t\t\t\t\t\t\t{ zoomable && zoom.domain && <ZoomResetButton onClick={ zoom.reset } /> }\n\t\t\t\t\t\t\t\t\t\t<XYChart\n\t\t\t\t\t\t\t\t\t\t\ttheme={ theme }\n\t\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\t\theight={ chartHeight }\n\t\t\t\t\t\t\t\t\t\t\tmargin={ { ...defaultMargin, ...margin } }\n\t\t\t\t\t\t\t\t\t\t\txScale={ chartOptions.xScale }\n\t\t\t\t\t\t\t\t\t\t\tyScale={ chartOptions.yScale }\n\t\t\t\t\t\t\t\t\t\t\tonPointerDown={ zoom.handlers.onPointerDown }\n\t\t\t\t\t\t\t\t\t\t\tonPointerUp={ zoom.handlers.onPointerUp }\n\t\t\t\t\t\t\t\t\t\t\tonPointerMove={ zoom.handlers.onPointerMove }\n\t\t\t\t\t\t\t\t\t\t\tonPointerOut={ onPointerOut }\n\t\t\t\t\t\t\t\t\t\t\tpointerEventsDataKey=\"nearest\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ /* With every series hidden the value scale collapses, so the grid and axes\n\t\t\t\t\t\t\t\t\t\t\t are dropped while the empty state stands in — otherwise they render\n\t\t\t\t\t\t\t\t\t\t\t squished at the top. */ }\n\t\t\t\t\t\t\t\t\t\t\t{ ! allSeriesHidden && gridVisibility !== 'none' && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Grid columns={ false } numTicks={ 4 } />\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t{ ! allSeriesHidden && chartOptions.axis.x.display && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Axis { ...chartOptions.axis.x } />\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t{ ! allSeriesHidden && chartOptions.axis.y.display && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Axis { ...chartOptions.axis.y } />\n\t\t\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t\t\t{ allSeriesHidden ? (\n\t\t\t\t\t\t\t\t\t\t\t\t<SvgEmptyState\n\t\t\t\t\t\t\t\t\t\t\t\t\tx={ width / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\t\ty={ chartHeight / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\t\t\t\theight={ chartHeight }\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ getAllHiddenMessage( legendInteractive, 'series' ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</SvgEmptyState>\n\t\t\t\t\t\t\t\t\t\t\t) : null }\n\n\t\t\t\t\t\t\t\t\t\t\t{ /* Area is animated, so clip the whole time it is zoomable to keep the zoom-out animation in bounds. */ }\n\t\t\t\t\t\t\t\t\t\t\t<ZoomClip active={ zoomable } chartId={ chartId }>\n\t\t\t\t\t\t\t\t\t\t\t\t{ ! allSeriesHidden && stacked && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<AnimatedAreaStack\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcurve={ curve }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\toffset={ stackOffset }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trenderLine={ resolvedWithStroke }\n\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ seriesWithVisibility.map( renderSeries ) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t</AnimatedAreaStack>\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t{ ! allSeriesHidden &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t! stacked &&\n\t\t\t\t\t\t\t\t\t\t\t\t\tseriesWithVisibility.map( renderSeries ) }\n\t\t\t\t\t\t\t\t\t\t\t</ZoomClip>\n\n\t\t\t\t\t\t\t\t\t\t\t{ withTooltips && (\n\t\t\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<AccessibleTooltip\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdetectBounds\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsnapTooltipToDatumX\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Stacked mode: yAccessor returns raw value, not stacked y — snapping mispositions.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsnapTooltipToDatumY={ ! stacked }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trenderTooltip={ filteredRenderTooltip }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tshowVerticalCrosshair={ withTooltipCrosshairs?.showVertical }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tshowHorizontalCrosshair={ withTooltipCrosshairs?.showHorizontal }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tselectedIndex={ selectedIndex }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttooltipRef={ tooltipRef }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tkeyboardFocusedClassName={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstyles[ 'area-chart__tooltip--keyboard-focused' ]\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tseries={ dataSorted }\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<HoverGlyphs\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvisibleSeries={ visibleSeries }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstacked={ stacked }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstackOffset={ stackOffset }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tgetElementStyles={ getElementStyles }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// useXYChartTheme resolved this role inside its memo, against the chart's scope element; reading it back avoids a getComputedStyle on every render.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstrokeColor={ theme.backgroundColor ?? providerTheme.backgroundColor }\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t\t\t<AreaChartScalesRef\n\t\t\t\t\t\t\t\t\t\t\t\tchartRef={ internalChartRef }\n\t\t\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\t\t\t// `||` — responsive HOC may pass `height = 0` before measurement.\n\t\t\t\t\t\t\t\t\t\t\t\theight={ height || chartHeight }\n\t\t\t\t\t\t\t\t\t\t\t\tmargin={ margin }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t{ zoomable && <ZoomSelectionRect drag={ zoom.drag } /> }\n\t\t\t\t\t\t\t\t\t\t</XYChart>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t</ChartLayout>\n\t\t\t</ChartInstanceContext.Provider>\n\t\t);\n\t}\n);\n\ntype AreaChartSubComponents = {\n\tLegend: typeof Legend;\n};\n\ntype AreaChartBaseProps = Optional< AreaChartProps, 'width' | 'height' | 'size' >;\n\ntype AreaChartComponent = React.ForwardRefExoticComponent<\n\tAreaChartBaseProps & React.RefAttributes< ChartInstanceRef >\n> &\n\tAreaChartSubComponents;\n\ntype AreaChartResponsiveComponent = React.ForwardRefExoticComponent<\n\tAreaChartBaseProps & ResponsiveConfig & React.RefAttributes< ChartInstanceRef >\n> &\n\tAreaChartSubComponents;\n\nconst AreaChartWithProvider = forwardRef< ChartInstanceRef, AreaChartProps >( ( props, ref ) => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\tif ( existingContext ) {\n\t\treturn <AreaChartInternal { ...props } ref={ ref } />;\n\t}\n\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<AreaChartInternal { ...props } ref={ ref } />\n\t\t</GlobalChartsProvider>\n\t);\n} );\n\nAreaChartWithProvider.displayName = 'AreaChart';\n\nconst AreaChart = attachSubComponents( AreaChartWithProvider, {\n\tLegend: Legend,\n} ) as AreaChartComponent;\n\nconst AreaChartResponsive = attachSubComponents(\n\twithResponsive< AreaChartProps >( AreaChartWithProvider ),\n\t{\n\t\tLegend: Legend,\n\t}\n) as AreaChartResponsiveComponent;\n\nexport { AreaChartResponsive as default, AreaChart as AreaChartUnresponsive };\n","import { DataContext } from '@visx/xychart';\nimport { useContext } from 'react';\nimport { isSafari } from '../../../utils';\nimport type { AxisScale, TickRendererProps } from '@visx/axis';\nimport type { FC, CSSProperties } from 'react';\n\n/**\n * Get the bandwidth of a scale\n *\n * @param scale - The scale to get the bandwidth of\n * @return The bandwidth of the scale\n */\nconst getScaleBandwidth = < Scale extends AxisScale >( scale?: Scale ) => {\n\treturn scale && 'bandwidth' in scale ? scale.bandwidth() ?? 0 : 0;\n};\ninterface TruncatedTickComponentProps extends TickRendererProps {\n\t/** Which axis this tick belongs to */\n\taxis: 'x' | 'y';\n}\n\n/**\n * Minimum width in pixels for tick labels when scale bandwidth is very small.\n * Prevents labels from collapsing to unreadable widths on dense charts.\n *\n * Trade-off: When bandwidth is less than this minimum (e.g., many bars in a narrow chart),\n * adjacent labels may overlap since each label uses this minimum width regardless of\n * available space. This prioritizes label readability over preventing overlap.\n *\n * For very dense charts where overlap occurs, consider:\n * - Using `numTicks` option to reduce the number of displayed labels\n * - Using `tickFormat` to abbreviate label text\n * - Increasing chart width or reducing data points\n */\nconst MIN_TICK_LABEL_WIDTH = 20;\n\n/**\n * A tick component that renders labels with text truncation (ellipsis) when they exceed\n * the available bandwidth. Shows the full text on hover via native title attribute.\n *\n * Uses foreignObject to embed HTML within SVG, enabling CSS text-overflow: ellipsis.\n * Inherits text styles from tickLabelProps passed by visx Axis component.\n *\n * Note: A minimum label width (MIN_TICK_LABEL_WIDTH) is enforced to keep labels readable.\n * On very dense charts where bandwidth < 20px, this may cause label overlap.\n * See MIN_TICK_LABEL_WIDTH documentation for mitigation strategies.\n *\n * @param props - The props for the truncated tick component\n * @param props.x - The x position of the tick\n * @param props.y - The y position of the tick\n * @param props.formattedValue - The formatted value of the tick\n * @param props.axis - The axis this tick belongs to\n * @param props.textAnchor - The text anchor of the tick\n * @param props.fill - The fill color of the tick\n * @param props.dy - The dy offset of the tick\n *\n * @return The truncated tick component\n */\nexport const TruncatedTickComponent: FC< TruncatedTickComponentProps > = ( {\n\tx,\n\ty,\n\tformattedValue,\n\taxis,\n\ttextAnchor,\n\tfill,\n\tdy,\n\t...textProps\n} ) => {\n\t// Get max width of the tick label\n\tconst { xScale, yScale } = useContext( DataContext ) || {};\n\tconst scale = axis === 'x' ? xScale : yScale;\n\tconst bandwidth = getScaleBandwidth( scale );\n\tconst maxWidth = Math.max( bandwidth, MIN_TICK_LABEL_WIDTH );\n\n\t// Map SVG textAnchor to CSS textAlign\n\tlet textAlign: 'left' | 'right' | 'center' = 'center';\n\tif ( textAnchor === 'start' ) {\n\t\ttextAlign = 'left';\n\t} else if ( textAnchor === 'end' ) {\n\t\ttextAlign = 'right';\n\t} else if ( textAnchor === 'middle' ) {\n\t\ttextAlign = 'center';\n\t}\n\n\t// Calculate x offset based on text alignment\n\tlet xOffset = 0;\n\tif ( textAlign === 'center' ) {\n\t\txOffset = -maxWidth / 2;\n\t} else if ( textAlign === 'right' ) {\n\t\txOffset = -maxWidth;\n\t}\n\n\t// Extract compatible style properties from SVG text props\n\tconst { fontSize, fontFamily, fontWeight, fontStyle, letterSpacing, opacity } = textProps as {\n\t\tfontSize?: CSSProperties[ 'fontSize' ];\n\t\tfontFamily?: CSSProperties[ 'fontFamily' ];\n\t\tfontWeight?: CSSProperties[ 'fontWeight' ];\n\t\tfontStyle?: CSSProperties[ 'fontStyle' ];\n\t\tletterSpacing?: CSSProperties[ 'letterSpacing' ];\n\t\topacity?: CSSProperties[ 'opacity' ];\n\t};\n\n\tconst textStyles: CSSProperties = {\n\t\t/**\n\t\t * SVG <text> elements are vertically aligned to the baseline by default, but HTML <div> elements inside <foreignObject>\n\t\t * are positioned relative to the top-left corner. To visually align the tick label like SVG text,\n\t\t * we shift the div up by 100% of its height and adjust by twice the SVG dy value (from visx) to approximate original placement.\n\t\t */\n\t\ttransform: `translateY(calc(-100% + ${ dy ?? '0' } * 2))`,\n\t\t// Safari doesn't work well with foreignObject positioning. Use position: fixed as a workaround.\n\t\t...( isSafari() ? { position: 'fixed' as const } : {} ),\n\t\t// Apply compatible SVG text styles\n\t\tfontSize,\n\t\tfontFamily,\n\t\tfontWeight,\n\t\tfontStyle,\n\t\tletterSpacing,\n\t\topacity,\n\t\t// Convert svg text styles to CSS styles for the div\n\t\tcolor: fill ?? 'inherit',\n\t\ttextAlign,\n\t\t// Ensure text is truncated with ellipsis, remains on one line, and shows the full value in a tooltip on hover.\n\t\t// The surrounding div uses CSS to handle overflow, and the 'title' attribute is set for accessibility.\n\t\twidth: maxWidth,\n\t\toverflow: 'hidden',\n\t\ttextOverflow: 'ellipsis',\n\t\twhiteSpace: 'nowrap',\n\t\tcursor: 'default',\n\t\tpointerEvents: 'auto',\n\t};\n\n\treturn (\n\t\t<foreignObject x={ x + xOffset } y={ y } width={ maxWidth } height={ 0 } overflow=\"visible\">\n\t\t\t<div style={ textStyles } title={ formattedValue }>\n\t\t\t\t{ formattedValue }\n\t\t\t</div>\n\t\t</foreignObject>\n\t);\n};\n\n/**\n * Factory function to create a truncated tick component for a specific axis.\n * Returns a component that can be passed to visx's tickComponent prop.\n *\n * @param axis - The axis this tick component is for ('x' or 'y')\n * @return A tick component function compatible with visx's TickRendererProps\n */\nconst createTruncatedTickComponent = ( axis: 'x' | 'y' ) => ( props: TickRendererProps ) => {\n\treturn <TruncatedTickComponent { ...props } axis={ axis } />;\n};\n\n/**\n * Pre-created tick components for x and y axes.\n * These functions are created once at module initialization and reused,\n * avoiding repeated factory calls when configuring axes.\n */\nexport const TruncatedXTickComponent = createTruncatedTickComponent( 'x' );\nexport const TruncatedYTickComponent = createTruncatedTickComponent( 'y' );\n","import { formatNumberCompact } from '@automattic/number-formatters';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useMemo } from 'react';\nimport { useDeepMemo } from '../../../hooks';\nimport { getBandTickValues, getBucketResolution, getFormatter } from '../../private/time-axis';\nimport { TruncatedXTickComponent, TruncatedYTickComponent } from './truncated-tick-component';\nimport type { EnhancedDataPoint } from '../../../hooks/use-zero-value-display';\nimport type { DataPointDate, BaseChartProps, SeriesData, TickResolution } from '../../../types';\nimport type { TickFormatter } from '@visx/axis';\n\n/** Outer padding of the category band scale (space at the chart edges). */\nexport const BASE_BAND_PADDING = 0.2;\n/** Inner padding of the category band scale (the base gap between ticks). */\nexport const BASE_BAND_PADDING_INNER = 0.1;\n/** Ticks each axis carries unless the caller asks for a different count. */\nconst DEFAULT_NUM_TICKS = 4;\n\n// A stable reference for callers that hide no series, so the memos below hold.\nconst ALL_RENDERED = () => true;\n\n// The axis abbreviates to fit a tick; a tooltip has room to spell the same\n// bucket out in full.\nconst TOOLTIP_FORMAT_BY_RESOLUTION: Record<\n\tExclude< TickResolution, 'week' >,\n\tIntl.DateTimeFormatOptions\n> = {\n\thour: { year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', hour12: true },\n\tday: { year: 'numeric', month: 'long', day: 'numeric' },\n\tmonth: { year: 'numeric', month: 'long' },\n\tyear: { year: 'numeric' },\n};\n\n/**\n * Labels one bar's bucket, at the bucket's own granularity — finer than the\n * ticks whenever the overall time span coarsens the axis.\n *\n * @param data - Date-based series, already parsed and sorted by `useChartDataTransform`.\n * @param tickResolution - Caller-declared bucket resolution, when known.\n * @return Tooltip label formatter.\n */\nconst getTooltipFormatter = ( data: SeriesData[], tickResolution?: TickResolution ) => {\n\t// Only a declared 'week' reaches this branch: seven-day spacing is\n\t// indistinguishable from sparse daily data, so inference reports 'day'.\n\tif ( tickResolution === 'week' ) {\n\t\treturn ( timestamp: number ) =>\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s is the first day of the week the bar covers. */\n\t\t\t\t__( 'Week of %s', 'jetpack-charts' ),\n\t\t\t\tnew Date( timestamp ).toLocaleDateString( undefined, {\n\t\t\t\t\tyear: 'numeric',\n\t\t\t\t\tmonth: 'long',\n\t\t\t\t\tday: 'numeric',\n\t\t\t\t} )\n\t\t\t);\n\t}\n\n\t// Fall back to the day format rather than `undefined` options, which would\n\t// print a full locale date-time for an unrecognised `tickResolution`.\n\tconst format =\n\t\tTOOLTIP_FORMAT_BY_RESOLUTION[ getBucketResolution( data, tickResolution ) ] ??\n\t\tTOOLTIP_FORMAT_BY_RESOLUTION.day;\n\n\treturn ( timestamp: number ) => new Date( timestamp ).toLocaleString( undefined, format );\n};\n\nconst identity = ( label: string ) => label;\n\n// `hasLabels` only samples the first point of the first series, so a labelled\n// bucket can still reach a formatter that was chosen for timestamps. It arrives\n// as its own string; only a dated bucket has a timestamp to format.\nconst byBucket =\n\t( format: ( timestamp: number ) => string ) => ( bucket: Date | string | number ) =>\n\t\ttypeof bucket === 'string' ? bucket : format( Number( bucket ) );\n\n// Shared with the domain below so both read a bucket the same way.\nconst bucketAccessor = ( d: DataPointDate ) => d?.label || d?.date;\n\n/**\n * The buckets the band axis can put a tick on.\n *\n * Built from the accessor visx is given, over the same series in the same order,\n * so that a tick value is a key the scale actually holds; `scaleBand` returns\n * `undefined` for one it does not, which parks the tick at the origin. Null\n * rather than a partial list when any bucket is labelled instead of dated.\n *\n * @param data - Every series handed to the chart.\n * @param isSeriesRendered - Whether visx mounts a series, i.e. the legend shows it.\n * @return Bucket dates in axis order, or null if the axis cannot be ticked by date.\n */\nconst getBandDomain = (\n\tdata: SeriesData[],\n\tisSeriesRendered: ( series: SeriesData ) => boolean\n): Date[] | null => {\n\t// visx keys its data registry on the series label and reads it back with\n\t// `Object.keys`, so a plain object reproduces both of the things that follow\n\t// from that: two series sharing a label collapse to the later one, and an\n\t// integer-like label sorts ahead of the rest whatever order it arrived in.\n\tconst registry: Record< string, SeriesData > = {};\n\n\tfor ( const series of data ) {\n\t\t// Comparison series register nothing with visx — `comparison-bars.tsx` draws\n\t\t// onto the scales the primary series established — and a hidden series is\n\t\t// unmounted, so neither contributes a key to the band scale.\n\t\tif ( series.options?.type === 'comparison' || ! isSeriesRendered( series ) ) {\n\t\t\tcontinue;\n\t\t}\n\t\tregistry[ series.label ] = series;\n\t}\n\n\tconst byTimestamp = new Map< number, Date >();\n\n\tfor ( const key of Object.keys( registry ) ) {\n\t\tfor ( const point of registry[ key ].data ) {\n\t\t\tconst bucket = bucketAccessor( point as DataPointDate );\n\t\t\tif ( ! ( bucket instanceof Date ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tif ( ! byTimestamp.has( bucket.getTime() ) ) {\n\t\t\t\tbyTimestamp.set( bucket.getTime(), bucket );\n\t\t\t}\n\t\t}\n\t}\n\n\treturn byTimestamp.size ? [ ...byTimestamp.values() ] : null;\n};\n\n/**\n * Get the group padding of a scale.\n *\n * @param scale - The scale to get the group padding of.\n * @return The group padding of the scale.\n */\nconst getGroupPadding = ( scale: Record< string, unknown > ): number => {\n\treturn typeof scale.paddingInner === 'number' ? ( scale.paddingInner as number ) : 0;\n};\n\n/**\n * Returns the merged options for the bar chart, including axis and scale configuration based on the orientation.\n *\n * @param data - The data to be displayed in the chart.\n * @param horizontal - Whether the chart is horizontal or vertical.\n * @param options - The options for the chart.\n * @param isSeriesRendered - Whether visx mounts a series, i.e. the legend shows it.\n * @return The merged options for the chart.\n */\nexport function useBarChartOptions(\n\tdata: SeriesData[],\n\thorizontal: boolean,\n\toptions: BaseChartProps[ 'options' ] = {},\n\tisSeriesRendered: ( series: SeriesData ) => boolean = ALL_RENDERED\n) {\n\t// Callers reasonably pass an object literal, which is a fresh reference every\n\t// render and would defeat every memo below.\n\tconst stableOptions = useDeepMemo( options );\n\n\t// `labelOverflow` and `tickResolution` are consumed by this hook rather than\n\t// forwarded — visx has an axis prop for neither — and `tickFormat` is merged\n\t// with the derived default explicitly, so an `undefined` passed by a caller\n\t// cannot clobber it through the spread. They are split off the caller's axis\n\t// options once, here, and only the rest reaches visx below.\n\tconst axisConfig = useMemo( () => {\n\t\tconst {\n\t\t\tlabelOverflow: xLabelOverflow,\n\t\t\ttickResolution: xTickResolution,\n\t\t\ttickFormat: xTickFormat,\n\t\t\t...xAxisOptions\n\t\t} = stableOptions.axis?.x || {};\n\t\tconst {\n\t\t\tlabelOverflow: yLabelOverflow,\n\t\t\ttickResolution: yTickResolution,\n\t\t\ttickFormat: yTickFormat,\n\t\t\t...yAxisOptions\n\t\t} = stableOptions.axis?.y || {};\n\n\t\treturn {\n\t\t\txLabelOverflow,\n\t\t\tyLabelOverflow,\n\t\t\txTickFormat,\n\t\t\tyTickFormat,\n\t\t\txAxisOptions,\n\t\t\tyAxisOptions,\n\t\t\t// The dates sit on the x axis normally, and on the y axis when the\n\t\t\t// chart is horizontal, so the hint follows them.\n\t\t\ttickResolution: horizontal ? yTickResolution : xTickResolution,\n\t\t};\n\t}, [ stableOptions, horizontal ] );\n\tconst { tickResolution } = axisConfig;\n\n\tconst defaultOptions = useMemo( () => {\n\t\tconst bandScale = {\n\t\t\ttype: 'band' as const,\n\t\t\tpadding: BASE_BAND_PADDING,\n\t\t\tpaddingInner: BASE_BAND_PADDING_INNER,\n\t\t};\n\t\tconst linearScale = {\n\t\t\ttype: 'linear' as const,\n\t\t\tnice: true,\n\t\t\tzero: false,\n\t\t};\n\n\t\t// Ticks on a date-based series share the line/area charts' time-axis\n\t\t// formatter, which narrows with the overall span as well as the bucket\n\t\t// size; the tooltip stays at the bucket's own granularity.\n\t\tconst hasLabels = Boolean( data?.[ 0 ]?.data?.[ 0 ]?.label );\n\t\tconst timeTickFormatter = hasLabels ? null : getFormatter( data, tickResolution );\n\t\tconst labelFormatter = timeTickFormatter ? byBucket( timeTickFormatter ) : identity;\n\t\tconst tooltipDatumFormatter = hasLabels\n\t\t\t? labelFormatter\n\t\t\t: byBucket( getTooltipFormatter( data, tickResolution ) );\n\t\tconst valueFormatter = formatNumberCompact as TickFormatter< unknown >;\n\n\t\tconst bandDomain = timeTickFormatter ? getBandDomain( data, isSeriesRendered ) : null;\n\n\t\tconst valueAccessor = ( d: DataPointDate | EnhancedDataPoint ) => {\n\t\t\t// Use visualValue for bar rendering if available (for zero values), otherwise use value\n\t\t\tconst enhancedPoint = d as EnhancedDataPoint;\n\t\t\treturn enhancedPoint?.visualValue !== undefined ? enhancedPoint.visualValue : d?.value;\n\t\t};\n\n\t\treturn {\n\t\t\ttimeAxis: bandDomain &&\n\t\t\t\ttimeTickFormatter && {\n\t\t\t\t\tdomain: bandDomain,\n\t\t\t\t\ttickFormatter: timeTickFormatter,\n\t\t\t\t},\n\t\t\tvertical: {\n\t\t\t\txTickFormat: labelFormatter,\n\t\t\t\tyTickFormat: valueFormatter,\n\t\t\t\ttooltipLabelFormatter: tooltipDatumFormatter,\n\t\t\t\txAccessor: bucketAccessor,\n\t\t\t\tyAccessor: valueAccessor,\n\t\t\t\tgridVisibility: 'x',\n\t\t\t\txScale: bandScale,\n\t\t\t\tyScale: linearScale,\n\t\t\t},\n\t\t\thorizontal: {\n\t\t\t\txTickFormat: valueFormatter,\n\t\t\t\tyTickFormat: labelFormatter,\n\t\t\t\ttooltipLabelFormatter: tooltipDatumFormatter,\n\t\t\t\txAccessor: valueAccessor,\n\t\t\t\tyAccessor: bucketAccessor,\n\t\t\t\tgridVisibility: 'y',\n\t\t\t\txScale: linearScale,\n\t\t\t\tyScale: bandScale,\n\t\t\t},\n\t\t};\n\t}, [ data, tickResolution, isSeriesRendered ] );\n\n\treturn useMemo( () => {\n\t\tconst orientationKey = horizontal ? 'horizontal' : 'vertical';\n\t\tconst {\n\t\t\txTickFormat: defaultXTickFormat,\n\t\t\tyTickFormat: defaultYTickFormat,\n\t\t\ttooltipLabelFormatter: defaultTooltipLabelFormatter,\n\t\t\txAccessor,\n\t\t\tyAccessor,\n\t\t\tgridVisibility,\n\t\t\txScale: baseXScale,\n\t\t\tyScale: baseYScale,\n\t\t} = defaultOptions[ orientationKey ];\n\n\t\t// When comparison series are present, visx only sees primary BarSeries and computes\n\t\t// a too-narrow domain. Compute an explicit domain spanning all series so comparison\n\t\t// shadows aren't clipped. Skip when the user has already provided an explicit domain.\n\t\tlet valueScaleDomainOverride: { domain?: [ number, number ] } = {};\n\t\tconst hasComparisonSeries = data.some( s => s.options?.type === 'comparison' );\n\t\tif ( hasComparisonSeries ) {\n\t\t\tconst valueAxisIsY = ! horizontal;\n\t\t\tconst userDomain = valueAxisIsY ? stableOptions.yScale?.domain : stableOptions.xScale?.domain;\n\t\t\tif ( ! userDomain ) {\n\t\t\t\tconst allValues: number[] = [];\n\t\t\t\tdata.forEach( series => {\n\t\t\t\t\tseries.data.forEach( d => {\n\t\t\t\t\t\tconst enhanced = d as { visualValue?: number };\n\t\t\t\t\t\tconst v =\n\t\t\t\t\t\t\tenhanced.visualValue !== undefined ? enhanced.visualValue : ( d.value as number );\n\t\t\t\t\t\tif ( typeof v === 'number' && Number.isFinite( v ) ) {\n\t\t\t\t\t\t\tallValues.push( v );\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t} );\n\t\t\t\tif ( allValues.length > 0 ) {\n\t\t\t\t\t// Keep zero in the domain so bar length stays proportional to value — a\n\t\t\t\t\t// non-zero baseline would exaggerate differences between periods. Math.max\n\t\t\t\t\t// keeps zero on the far side too, so charts with negative values still span 0.\n\t\t\t\t\tvalueScaleDomainOverride = {\n\t\t\t\t\t\tdomain: [ Math.min( 0, ...allValues ), Math.max( 0, ...allValues ) ],\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst xScale = {\n\t\t\t...baseXScale,\n\t\t\t...( stableOptions.xScale || {} ),\n\t\t\t...( horizontal ? valueScaleDomainOverride : {} ),\n\t\t};\n\t\tconst yScale = {\n\t\t\t...baseYScale,\n\t\t\t...( stableOptions.yScale || {} ),\n\t\t\t...( ! horizontal ? valueScaleDomainOverride : {} ),\n\t\t};\n\t\tconst { xLabelOverflow, yLabelOverflow, xTickFormat, yTickFormat, xAxisOptions, yAxisOptions } =\n\t\t\taxisConfig;\n\t\t// The dates sit on the y axis of a horizontal chart, so the caller's format\n\t\t// for them moves with the orientation. It also labels the tooltip.\n\t\tconst dateAxisTickFormat = horizontal ? yTickFormat : xTickFormat;\n\n\t\t// A band scale has no ticks of its own for visx to ask for, so it samples\n\t\t// the domain by index and can miss the tick that dates the day or names the\n\t\t// year. Pick the values here instead. Only for our own formatter — a\n\t\t// caller's `tickFormat` may not be the one these values were chosen for.\n\t\tconst { timeAxis } = defaultOptions;\n\t\tconst dateAxisOptions = horizontal ? yAxisOptions : xAxisOptions;\n\t\tconst bandTickValues =\n\t\t\ttimeAxis && ! dateAxisTickFormat\n\t\t\t\t? getBandTickValues(\n\t\t\t\t\t\ttimeAxis.domain,\n\t\t\t\t\t\ttimeAxis.tickFormatter,\n\t\t\t\t\t\tdateAxisOptions.numTicks ?? DEFAULT_NUM_TICKS\n\t\t\t\t )\n\t\t\t\t: null;\n\t\tconst dateAxisTickValues = bandTickValues ? { tickValues: bandTickValues } : {};\n\n\t\treturn {\n\t\t\tgridVisibility,\n\t\t\txScale,\n\t\t\tyScale,\n\t\t\taccessors: {\n\t\t\t\txAccessor,\n\t\t\t\tyAccessor,\n\t\t\t},\n\t\t\taxis: {\n\t\t\t\tx: {\n\t\t\t\t\torientation: 'bottom' as const,\n\t\t\t\t\tnumTicks: DEFAULT_NUM_TICKS,\n\t\t\t\t\ttickFormat: xTickFormat || defaultXTickFormat,\n\t\t\t\t\t...( horizontal ? {} : dateAxisTickValues ),\n\t\t\t\t\t...( xLabelOverflow === 'ellipsis' ? { tickComponent: TruncatedXTickComponent } : {} ),\n\t\t\t\t\t...xAxisOptions,\n\t\t\t\t},\n\t\t\t\ty: {\n\t\t\t\t\torientation: 'left' as const,\n\t\t\t\t\tnumTicks: DEFAULT_NUM_TICKS,\n\t\t\t\t\ttickFormat: yTickFormat || defaultYTickFormat,\n\t\t\t\t\t...( horizontal ? dateAxisTickValues : {} ),\n\t\t\t\t\t...( yLabelOverflow === 'ellipsis' ? { tickComponent: TruncatedYTickComponent } : {} ),\n\t\t\t\t\t...yAxisOptions,\n\t\t\t\t},\n\t\t\t},\n\t\t\tbarGroup: {\n\t\t\t\tpadding: getGroupPadding( horizontal ? yScale : xScale ),\n\t\t\t},\n\t\t\ttooltip: {\n\t\t\t\tlabelFormatter: dateAxisTickFormat || defaultTooltipLabelFormatter,\n\t\t\t},\n\t\t};\n\t}, [ defaultOptions, axisConfig, stableOptions, horizontal, data ] );\n}\n","export type ComparisonRect = { x: number; y: number; width: number; height: number };\n\ntype ValueScale = ( ( v: number ) => number ) & { range: () => unknown[] };\n\n/**\n * Output position of a value scale's baseline: zero if in-domain, else the\n * nearest range edge. Mirrors visx's getScaleBaseline so comparison shadows\n * sit on the same baseline as primary bars.\n *\n * @param {ValueScale} scale - The continuous value scale.\n * @return {number} The baseline output position in pixels.\n */\nexport function getValueScaleBaseline( scale: ValueScale ): number {\n\tconst [ a, b ] = scale.range().map( r => Number( r ) || 0 );\n\tconst isDescending = b < a;\n\tconst maybeZero = scale( 0 );\n\tconst [ minOutput, maxOutput ] = isDescending ? [ b, a ] : [ a, b ];\n\tif ( isDescending ) {\n\t\treturn Number.isFinite( maybeZero )\n\t\t\t? Math.min( Math.max( minOutput, maybeZero ), maxOutput )\n\t\t\t: maxOutput;\n\t}\n\treturn Number.isFinite( maybeZero )\n\t\t? Math.min( Math.max( maybeZero, minOutput ), maxOutput )\n\t\t: minOutput;\n}\n\n/**\n * Compute the rect for a comparison \"shadow\" bar, centered on the paired\n * primary bar slot and scaled by `widthFactor`.\n *\n * @param {object} params - Geometry inputs.\n * @param {boolean} params.horizontal - True for a horizontal bar chart, false for vertical.\n * @param {number} params.bandPosition - bandScale(category): start px of the category band.\n * @param {number} params.slotOffset - groupScale(primaryKey): offset of the primary slot within the band.\n * @param {number} params.slotThickness - groupScale.bandwidth(): primary bar thickness in px.\n * @param {number} params.valuePosition - valueScale(value): output px for the bar's data value.\n * @param {number} params.baseline - getValueScaleBaseline(valueScale): zero-line output px.\n * @param {number} params.widthFactor - Shadow thickness multiplier, e.g. 1.5 for 150% width.\n * @return {ComparisonRect} The {x, y, width, height} of the shadow rect.\n */\nexport function computeComparisonRect( params: {\n\thorizontal: boolean;\n\tbandPosition: number;\n\tslotOffset: number;\n\tslotThickness: number;\n\tvaluePosition: number;\n\tbaseline: number;\n\twidthFactor: number;\n} ): ComparisonRect {\n\tconst {\n\t\thorizontal,\n\t\tbandPosition,\n\t\tslotOffset,\n\t\tslotThickness,\n\t\tvaluePosition,\n\t\tbaseline,\n\t\twidthFactor,\n\t} = params;\n\tconst slotStart = bandPosition + slotOffset;\n\tconst shadowThickness = slotThickness * widthFactor;\n\tconst shadowStart = slotStart + slotThickness / 2 - shadowThickness / 2;\n\tconst valueStart = Math.min( valuePosition, baseline );\n\tconst valueLength = Math.abs( baseline - valuePosition );\n\n\tif ( horizontal ) {\n\t\treturn { x: valueStart, y: shadowStart, width: valueLength, height: shadowThickness };\n\t}\n\treturn { x: shadowStart, y: valueStart, width: shadowThickness, height: valueLength };\n}\n","// Shared comparison-mode tuning constants. These drive the geometry of the\n// translucent \"shadow\" bars and how the primary bars are narrowed to sit in front of them.\n\n/**\n * How much wider the comparison shadow is than the primary bar. Fallback used when the\n * theme value (`barChart.barStyles.comparison.widthFactor`) is absent. Also drives the\n * primary narrowing — the primary stays `1 / widthFactor` of the shadow.\n */\nexport const DEFAULT_COMPARISON_WIDTH_FACTOR = 1.5;\n\n/**\n * Opacity of the comparison shadow. Fallback used when the theme value\n * (`barChart.barStyles.comparison.opacity`) is absent.\n */\nexport const DEFAULT_COMPARISON_OPACITY = 0.5;\n\n/**\n * Fraction of each per-series step left as a gap between bars within a single tick.\n * Larger = more space between adjacent series; the shadow spans `1 - COMPARISON_INNER_GAP` of the step.\n */\nexport const COMPARISON_INNER_GAP = 0.1;\n\n/**\n * Upper clamp on the computed group padding, so bars can never collapse to zero width\n * even at very large `widthFactor` values.\n */\nexport const MAX_GROUP_PADDING = 0.9;\n\n/**\n * Factor applied to the category band's `paddingInner` in comparison mode to tighten the\n * gap between ticks. `0.75` = a 25% reduction of the tick-gap padding.\n */\nexport const COMPARISON_TICK_GAP_FACTOR = 0.75;\n","import { scaleBand } from '@visx/scale';\nimport { DataContext } from '@visx/xychart';\nimport { useContext } from 'react';\nimport { computeComparisonRect, getValueScaleBaseline } from './comparison-bars-geometry';\nimport {\n\tDEFAULT_COMPARISON_OPACITY,\n\tDEFAULT_COMPARISON_WIDTH_FACTOR,\n} from './comparison-constants';\nimport type { ElementStyles, GetElementStylesParams } from '../../../providers';\nimport type { DataPointDate, SeriesData } from '../../../types';\nimport type { FC, ReactNode } from 'react';\n\n/*\n * `process.env.NODE_ENV` is replaced by the bundler at build time. Declare a\n * minimal `process` locally so this file type-checks as source under `jetpack:src`.\n */\ndeclare const process: { env: Record< string, string | undefined > };\n\nexport type ComparisonSeriesEntry = {\n\tseries: SeriesData;\n\tindex: number;\n\tprimaryKey: string;\n\t/** dataSorted index of the paired primary series (used to share its pattern fill). */\n\tprimaryIndex: number;\n};\n\n// Minimal shape we need from visx scales — avoids spreading `any` while\n// remaining compatible with both band and continuous scale return types.\ntype AnyScale = ( ( input: unknown ) => number ) & {\n\tbandwidth?: () => number;\n\trange: () => unknown[];\n};\n\n// Renders translucent \"shadow\" bars for comparison series behind their paired primary bars.\n// IMPORTANT: each comparison datum's category key (label or date) must exactly match a key\n// used by the primary series — if it doesn't, bandScale() returns undefined and the shadow\n// is silently skipped. Ensure comparison data reuses the same label/date values as primary.\nexport const ComparisonBars: FC< {\n\tcomparisonEntries: ComparisonSeriesEntry[];\n\tprimaryKeys: string[];\n\tgroupPadding: number;\n\thorizontal: boolean;\n\txAccessor: ( d: DataPointDate ) => string | number | Date | undefined;\n\tyAccessor: ( d: DataPointDate ) => number | undefined;\n\tgetElementStyles: ( params: GetElementStylesParams ) => ElementStyles;\n\t/** Resolves the shadow fill — the paired primary's pattern when patterns are on, else a color. */\n\tresolveFill: ( entry: ComparisonSeriesEntry ) => string;\n} > = ( {\n\tcomparisonEntries,\n\tprimaryKeys,\n\tgroupPadding,\n\thorizontal,\n\txAccessor,\n\tyAccessor,\n\tgetElementStyles,\n\tresolveFill,\n} ) => {\n\tconst context = useContext( DataContext );\n\tconst xScale = context?.xScale as AnyScale | undefined;\n\tconst yScale = context?.yScale as AnyScale | undefined;\n\n\tif ( ! xScale || ! yScale || primaryKeys.length === 0 ) {\n\t\treturn null;\n\t}\n\n\t// Vertical: band axis is x, value axis is y. Horizontal: reversed.\n\tconst bandScale = ( horizontal ? yScale : xScale ) as AnyScale;\n\tconst valueScale = ( horizontal ? xScale : yScale ) as AnyScale;\n\n\tconst bandwidth = bandScale.bandwidth ? bandScale.bandwidth() : 0;\n\tif ( ! bandwidth ) {\n\t\treturn null;\n\t}\n\n\t// Rebuild visx's inner group scale exactly as BarGroup does.\n\tconst groupScale = scaleBand( {\n\t\tdomain: primaryKeys,\n\t\trange: [ 0, bandwidth ],\n\t\tpadding: groupPadding,\n\t} );\n\tconst slotThickness = groupScale.bandwidth();\n\tconst baseline = getValueScaleBaseline( valueScale );\n\n\t// Vertical uses xAccessor for category label; horizontal uses yAccessor.\n\tconst bandAccessor = horizontal ? yAccessor : xAccessor;\n\tconst valueAccessor = horizontal ? xAccessor : yAccessor;\n\n\tconst rects: ReactNode[] = [];\n\n\tcomparisonEntries.forEach( entry => {\n\t\tconst { series, index, primaryKey } = entry;\n\t\tconst slotOffset = groupScale( primaryKey );\n\t\tif ( slotOffset == null || ! Number.isFinite( slotOffset ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { barStyles } = getElementStyles( { data: series, index } );\n\t\tconst opacity = barStyles?.opacity ?? DEFAULT_COMPARISON_OPACITY; // safety net; CompleteChartTheme guarantees this value\n\t\tconst widthFactor = barStyles?.widthFactor ?? DEFAULT_COMPARISON_WIDTH_FACTOR;\n\t\t// Fill is the paired primary's pattern (when patterns are on) or its resolved color.\n\t\tconst fill = resolveFill( entry );\n\t\t// The shadow is `widthFactor` × the (narrowed) primary slot. bar-chart.tsx narrows the\n\t\t// primary bars by widening the group padding so this ratio holds with real geometry.\n\n\t\t( series.data as DataPointDate[] ).forEach( ( datum, i ) => {\n\t\t\tconst bandPosition = Number( bandScale( bandAccessor( datum ) as never ) );\n\t\t\tconst valuePosition = Number( valueScale( Number( valueAccessor( datum ) ) as never ) );\n\n\t\t\tif ( ! Number.isFinite( bandPosition ) || ! Number.isFinite( valuePosition ) ) {\n\t\t\t\tif ( process.env.NODE_ENV !== 'production' && ! Number.isFinite( bandPosition ) ) {\n\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`[Charts] ComparisonBars: datum key \"${ String(\n\t\t\t\t\t\t\tbandAccessor( datum )\n\t\t\t\t\t\t) }\" did not match any primary category. Shadow will not be rendered. ` +\n\t\t\t\t\t\t\t'Ensure comparison series data uses the same label/date keys as the primary series.'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst rect = computeComparisonRect( {\n\t\t\t\thorizontal,\n\t\t\t\tbandPosition,\n\t\t\t\tslotOffset: slotOffset as number,\n\t\t\t\tslotThickness,\n\t\t\t\tvaluePosition,\n\t\t\t\tbaseline,\n\t\t\t\twidthFactor,\n\t\t\t} );\n\n\t\t\trects.push(\n\t\t\t\t<rect\n\t\t\t\t\tkey={ `${ index }-${ i }` }\n\t\t\t\t\tdata-testid={ `bar-chart-comparison-${ index }-${ i }` }\n\t\t\t\t\tx={ rect.x }\n\t\t\t\t\ty={ rect.y }\n\t\t\t\t\twidth={ rect.width }\n\t\t\t\t\theight={ rect.height }\n\t\t\t\t\tfill={ fill }\n\t\t\t\t\topacity={ opacity }\n\t\t\t\t/>\n\t\t\t);\n\t\t} );\n\t} );\n\n\tif ( rects.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<g\n\t\t\tclassName=\"bar-chart__comparison-bars\"\n\t\t\tpointerEvents=\"none\"\n\t\t\taria-hidden=\"true\"\n\t\t\tdata-testid=\"bar-chart-comparison-bars\"\n\t\t>\n\t\t\t{ rects }\n\t\t</g>\n\t);\n};\n","import { formatNumber } from '@automattic/number-formatters';\nimport { PatternLines, PatternCircles, PatternWaves, PatternHexagons } from '@visx/pattern';\nimport { Axis, BarSeries, BarGroup, Grid, XYChart } from '@visx/xychart';\nimport { __, sprintf } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport { useCallback, useContext, useState, useRef, useMemo } from 'react';\nimport { Legend, useChartLegendItems } from '../../components/legend';\nimport { AccessibleTooltip, useKeyboardNavigation } from '../../components/tooltip';\nimport {\n\tuseXYChartTheme,\n\tuseChartDataTransform,\n\tuseZeroValueDisplay,\n\tuseChartMargin,\n\tusePrefersReducedMotion,\n} from '../../hooks';\nimport {\n\tGlobalChartsProvider,\n\tuseChartId,\n\tuseChartRegistration,\n\tuseGlobalChartsContext,\n\tGlobalChartsContext,\n} from '../../providers';\nimport { useDefaultHiddenSeries } from '../../providers/chart-context/hooks/use-default-hidden-series';\nimport { attachSubComponents } from '../../utils';\nimport { useChartChildren } from '../private/chart-composition';\nimport { ChartInstanceContext } from '../private/chart-instance-context';\nimport { ChartLayout } from '../private/chart-layout';\nimport { getAllHiddenMessage, SvgEmptyState } from '../private/svg-empty-state';\nimport { withResponsive } from '../private/with-responsive';\nimport styles from './bar-chart.module.scss';\nimport {\n\tuseBarChartOptions,\n\tComparisonBars,\n\tDEFAULT_COMPARISON_WIDTH_FACTOR,\n\tCOMPARISON_INNER_GAP,\n\tMAX_GROUP_PADDING,\n\tCOMPARISON_TICK_GAP_FACTOR,\n\tBASE_BAND_PADDING_INNER,\n} from './private';\nimport type { ComparisonSeriesEntry } from './private';\nimport type {\n\tBaseChartProps,\n\tDataPointDate,\n\tSeriesData,\n\tSeriesChartLegendConfig,\n\tSeriesVisibilityProps,\n\tOptional,\n} from '../../types';\nimport type { RenderTooltipParams } from '../../visx/types';\nimport type { ResponsiveConfig } from '../private/with-responsive';\nimport type { FC, ReactNode, ComponentType } from 'react';\n\nexport interface BarChartProps extends BaseChartProps< SeriesData[] >, SeriesVisibilityProps {\n\t/**\n\t * Legend configuration. Supports `collapseGroups` on top of the shared options.\n\t */\n\tlegend?: SeriesChartLegendConfig;\n\trenderTooltip?: ( params: RenderTooltipParams< DataPointDate > ) => ReactNode;\n\torientation?: 'horizontal' | 'vertical';\n\twithPatterns?: boolean;\n\tshowZeroValues?: boolean;\n\tchildren?: ReactNode;\n}\n\n// Base props type with optional responsive properties\ntype BarChartBaseProps = Optional< BarChartProps, 'width' | 'height' | 'size' >;\n\n// Composition API types\ninterface BarChartSubComponents {\n\tLegend: ComponentType< React.ComponentProps< typeof Legend > >;\n}\n\ntype BarChartComponent = FC< BarChartBaseProps > & BarChartSubComponents;\ntype BarChartResponsiveComponent = FC< BarChartBaseProps & ResponsiveConfig > &\n\tBarChartSubComponents;\n\n// Validation function similar to LineChart\nconst validateData = ( data: SeriesData[] ) => {\n\tif ( ! data?.length ) return 'No data available';\n\n\tconst hasInvalidData = data.some( series =>\n\t\tseries.data.some(\n\t\t\tpoint =>\n\t\t\t\tisNaN( point.value as number ) ||\n\t\t\t\tpoint.value === null ||\n\t\t\t\tpoint.value === undefined ||\n\t\t\t\t( ! point.label &&\n\t\t\t\t\t( ! ( 'date' in point && point.date ) || isNaN( point.date.getTime() ) ) )\n\t\t)\n\t);\n\n\tif ( hasInvalidData ) return 'Invalid data';\n\treturn null;\n};\n\nconst getPatternId = ( chartId: string, index: number ) => `bar-pattern-${ chartId }-${ index }`;\n\n// A \"label: value\" tooltip row. The join is a translated format string so the\n// separator (a colon + space here) can be adapted per locale.\nconst renderTooltipRow = ( label: string | undefined, value: string ) => (\n\t<div className={ styles[ 'bar-chart__tooltip-row' ] }>\n\t\t{ sprintf(\n\t\t\t/* translators: 1: data series, period, or category label. 2: its formatted value. */\n\t\t\t__( '%1$s: %2$s', 'jetpack-charts' ),\n\t\t\tlabel,\n\t\t\tvalue\n\t\t) }\n\t</div>\n);\n\nconst BarChartInternal: FC< BarChartProps > = ( {\n\tdata,\n\tchartId: providedChartId,\n\twidth,\n\theight,\n\tclassName,\n\tmargin,\n\twithTooltips = false,\n\tshowLegend = false,\n\tlegend = {},\n\tgridVisibility: gridVisibilityProp,\n\trenderTooltip,\n\toptions = {},\n\torientation = 'vertical',\n\twithPatterns = false,\n\tshowZeroValues = false,\n\tdefaultHiddenSeries,\n\tanimation,\n\tchildren,\n\tgap = 'md',\n} ) => {\n\tconst legendInteractive = legend.interactive ?? false;\n\tconst legendCollapseGroups = legend.collapseGroups ?? false;\n\tconst horizontal = orientation === 'horizontal';\n\tconst chartId = useChartId( providedChartId );\n\tconst hiddenSeries = useDefaultHiddenSeries( chartId, defaultHiddenSeries );\n\tconst isSeriesVisible = useCallback(\n\t\t( seriesLabel: string ) => ! hiddenSeries.has( seriesLabel ),\n\t\t[ hiddenSeries ]\n\t);\n\tconst theme = useXYChartTheme( data );\n\n\tconst dataSorted = useChartDataTransform( data );\n\n\t// Transform data to add a small value for zero bars to make them visible\n\t// For vertical bars, height determines bar pixel height; for horizontal bars, width does\n\tconst dataWithVisibleZeros = useZeroValueDisplay( dataSorted, {\n\t\tenabled: showZeroValues,\n\t\tvalueAxisLength: horizontal ? width : height,\n\t} );\n\n\t// Create legend items using the reusable hook\n\tconst legendOptions = useMemo(\n\t\t() => ( { collapseGroups: legendCollapseGroups } ),\n\t\t[ legendCollapseGroups ]\n\t);\n\tconst legendItems = useChartLegendItems( dataSorted, legendOptions );\n\n\tconst { getElementStyles } = useGlobalChartsContext();\n\n\t// A hidden series is unmounted, so it is not on the band scale either — the\n\t// axis has to choose its tick values from what is left. Visibility is owned by\n\t// the provider, whether it changed through the legend or programmatically.\n\tconst isSeriesRendered = useCallback(\n\t\t( series: SeriesData ) => isSeriesVisible( series.label ),\n\t\t[ isSeriesVisible ]\n\t);\n\n\tconst chartOptions = useBarChartOptions(\n\t\tdataWithVisibleZeros,\n\t\thorizontal,\n\t\toptions,\n\t\tisSeriesRendered\n\t);\n\tconst defaultMargin = useChartMargin( height, chartOptions, dataSorted, theme, horizontal );\n\tconst chartRef = useRef< HTMLDivElement >( null );\n\n\t// Process children for composition API (Legend, etc.)\n\tconst { legendChildren, nonLegendChildren } = useChartChildren( children, 'BarChart' );\n\tconst [ measuredChartHeight, setMeasuredChartHeight ] = useState< number | undefined >();\n\n\tconst handleContentHeightChange = useCallback(\n\t\t( contentHeight: number ) => {\n\t\t\tconst chartHeight = contentHeight > 0 ? contentHeight : height;\n\t\t\tsetMeasuredChartHeight( chartHeight );\n\t\t},\n\t\t[ height ]\n\t);\n\tconst [ selectedIndex, setSelectedIndex ] = useState< number | undefined >( undefined );\n\tconst [ isNavigating, setIsNavigating ] = useState( false );\n\n\t// Comparison series have no .visx-bar elements; count only primary series so\n\t// keyboard navigation doesn't cycle phantom indices into comparison-only slots.\n\tconst primarySeriesForNav = dataWithVisibleZeros.filter( s => s.options?.type !== 'comparison' );\n\tconst totalPoints =\n\t\tMath.max( 0, ...primarySeriesForNav.map( s => s.data?.length || 0 ) ) *\n\t\tprimarySeriesForNav.length;\n\n\t// Use the keyboard navigation hook\n\tconst { tooltipRef, onChartFocus, onChartBlur, onChartKeyDown } = useKeyboardNavigation( {\n\t\tselectedIndex,\n\t\tsetSelectedIndex,\n\t\tisNavigating,\n\t\tsetIsNavigating,\n\t\tchartRef,\n\t\ttotalPoints,\n\t} );\n\n\t// Add visibility information from the shared legend state.\n\tconst seriesWithVisibility = useMemo(\n\t\t() =>\n\t\t\tdataWithVisibleZeros.map( ( series, index ) => ( {\n\t\t\t\tseries,\n\t\t\t\tindex,\n\t\t\t\tisVisible: isSeriesRendered( series ),\n\t\t\t} ) ),\n\t\t[ dataWithVisibleZeros, isSeriesRendered ]\n\t);\n\n\t// Check if all series are hidden\n\tconst allSeriesHidden = useMemo( () => {\n\t\treturn seriesWithVisibility.every( ( { isVisible } ) => ! isVisible );\n\t}, [ seriesWithVisibility ] );\n\n\t// Derive primary vs comparison entries for comparison mode support.\n\tconst primaryEntries = useMemo(\n\t\t() =>\n\t\t\tseriesWithVisibility.filter(\n\t\t\t\t( { isVisible, series } ) => isVisible && series.options?.type !== 'comparison'\n\t\t\t),\n\t\t[ seriesWithVisibility ]\n\t);\n\n\tconst primaryKeys = useMemo(\n\t\t() => primaryEntries.map( ( { series } ) => series.label ),\n\t\t[ primaryEntries ]\n\t);\n\n\t// The keyboard-navigation index space and the highlight CSS both stride over primary\n\t// bars only; the accessible tooltip must use the same list, or its datum diverges from\n\t// the highlighted bar once a comparison series shifts the indices.\n\tconst primarySeries = useMemo(\n\t\t() => primaryEntries.map( ( { series } ) => series ),\n\t\t[ primaryEntries ]\n\t);\n\n\tconst comparisonEntries = useMemo( () => {\n\t\tconst primaryByGroup = new Map< string | undefined, { label: string; index: number } >(\n\t\t\tprimaryEntries.map( ( { series, index } ) => [\n\t\t\t\tseries.group,\n\t\t\t\t{ label: series.label, index },\n\t\t\t] )\n\t\t);\n\n\t\tconst entries: ComparisonSeriesEntry[] = [];\n\t\tseriesWithVisibility.forEach( ( { series, index, isVisible } ) => {\n\t\t\tif ( ! isVisible || series.options?.type !== 'comparison' ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst primary =\n\t\t\t\tprimaryByGroup.get( series.group ) ??\n\t\t\t\t( primaryEntries.length === 1\n\t\t\t\t\t? { label: primaryEntries[ 0 ].series.label, index: primaryEntries[ 0 ].index }\n\t\t\t\t\t: undefined );\n\t\t\tif ( ! primary || ! primaryKeys.includes( primary.label ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tentries.push( { series, index, primaryKey: primary.label, primaryIndex: primary.index } );\n\t\t} );\n\t\treturn entries;\n\t}, [ seriesWithVisibility, primaryEntries, primaryKeys ] );\n\n\t// Comparison widthFactor (how much wider the shadow is than the primary) drives both the\n\t// shadow width (in ComparisonBars) and the primary narrowing.\n\tconst comparisonWidthFactor = useMemo( () => {\n\t\tif ( comparisonEntries.length === 0 ) return undefined;\n\t\treturn (\n\t\t\tgetElementStyles( {\n\t\t\t\tdata: comparisonEntries[ 0 ].series,\n\t\t\t\tindex: comparisonEntries[ 0 ].index,\n\t\t\t} ).barStyles?.widthFactor ?? DEFAULT_COMPARISON_WIDTH_FACTOR\n\t\t);\n\t}, [ comparisonEntries, getElementStyles ] );\n\n\t// Narrow the primary bars by widening the visx group padding — a real geometry change, so\n\t// pattern fills and borders are not distorted (unlike a CSS transform/scale). The padding is\n\t// set so the comparison shadow (drawn at slot × widthFactor) fills all but a small gap of each\n\t// per-series step, leaving a small gap between series within a tick (the larger gap between\n\t// ticks comes from the category band's own padding). Because shadow = step × (1 - p) ×\n\t// widthFactor, choosing p = 1 - (1 - innerGap)/widthFactor makes the shadow span (1 - innerGap)\n\t// of the step; the primary stays 1/widthFactor of the shadow.\n\tconst groupPadding = useMemo( () => {\n\t\tconst basePadding = chartOptions.barGroup.padding;\n\t\tif ( ! comparisonWidthFactor || comparisonWidthFactor <= 1 ) {\n\t\t\treturn basePadding;\n\t\t}\n\t\tconst p = 1 - ( 1 - COMPARISON_INNER_GAP ) / comparisonWidthFactor;\n\t\treturn Math.min( Math.max( p, basePadding ), MAX_GROUP_PADDING );\n\t}, [ chartOptions.barGroup.padding, comparisonWidthFactor ] );\n\n\t// In comparison mode, tighten the gap between ticks by reducing the category band's inner\n\t// padding (the value axis is left untouched). COMPARISON_TICK_GAP_FACTOR is the multiplier.\n\tconst { xScale, yScale } = useMemo( () => {\n\t\tif ( comparisonEntries.length === 0 ) {\n\t\t\treturn { xScale: chartOptions.xScale, yScale: chartOptions.yScale };\n\t\t}\n\t\tconst tighten = < T extends object >( scale: T ): T =>\n\t\t\t( {\n\t\t\t\t...scale,\n\t\t\t\tpaddingInner:\n\t\t\t\t\t( ( scale as { paddingInner?: number } ).paddingInner ?? BASE_BAND_PADDING_INNER ) *\n\t\t\t\t\tCOMPARISON_TICK_GAP_FACTOR,\n\t\t\t} ) as T;\n\t\treturn horizontal\n\t\t\t? { xScale: chartOptions.xScale, yScale: tighten( chartOptions.yScale ) }\n\t\t\t: { xScale: tighten( chartOptions.xScale ), yScale: chartOptions.yScale };\n\t}, [ comparisonEntries.length, chartOptions.xScale, chartOptions.yScale, horizontal ] );\n\n\tconst getBarBackground = useCallback(\n\t\t( index: number ) => () =>\n\t\t\twithPatterns\n\t\t\t\t? `url(#${ getPatternId( chartId, index ) })`\n\t\t\t\t: getElementStyles( { data: dataSorted[ index ], index } ).color,\n\t\t[ withPatterns, getElementStyles, dataSorted, chartId ]\n\t);\n\n\t// Comparison shadow fill: when patterns are on, reuse the paired primary's pattern so the\n\t// shadow reads as the same series; otherwise use the comparison series' resolved color.\n\tconst resolveComparisonFill = useCallback(\n\t\t( entry: ComparisonSeriesEntry ) =>\n\t\t\twithPatterns\n\t\t\t\t? `url(#${ getPatternId( chartId, entry.primaryIndex ) })`\n\t\t\t\t: getElementStyles( { data: entry.series, index: entry.index } ).color,\n\t\t[ withPatterns, chartId, getElementStyles ]\n\t);\n\n\tconst renderDefaultTooltip = useCallback(\n\t\t( { tooltipData }: RenderTooltipParams< DataPointDate > ) => {\n\t\t\tconst nearestDatum = tooltipData?.nearestDatum?.datum;\n\t\t\tif ( ! nearestDatum ) return null;\n\n\t\t\tconst primaryKey = tooltipData?.nearestDatum?.key;\n\t\t\tconst categoryLabel = chartOptions.tooltip.labelFormatter(\n\t\t\t\tnearestDatum.label || ( nearestDatum.date ? nearestDatum.date.getTime() : 0 ),\n\t\t\t\t0,\n\t\t\t\t[]\n\t\t\t);\n\n\t\t\t// Find the comparison value paired with the hovered primary series (same group)\n\t\t\t// at the same category, so the tooltip can show both periods at once.\n\t\t\tconst comparisonEntry = comparisonEntries.find( entry => entry.primaryKey === primaryKey );\n\t\t\tconst comparisonDatum = comparisonEntry?.series.data.find( point => {\n\t\t\t\tconst p = point as DataPointDate;\n\t\t\t\treturn nearestDatum.label != null\n\t\t\t\t\t? p.label === nearestDatum.label\n\t\t\t\t\t: !! nearestDatum.date && !! p.date && p.date.getTime() === nearestDatum.date.getTime();\n\t\t\t} ) as DataPointDate | undefined;\n\n\t\t\t// With a paired comparison value, show the category as the header and one row\n\t\t\t// per period (primary + comparison).\n\t\t\tif ( comparisonEntry && comparisonDatum && comparisonDatum.value != null ) {\n\t\t\t\treturn (\n\t\t\t\t\t<div className={ styles[ 'bar-chart__tooltip' ] }>\n\t\t\t\t\t\t<div className={ styles[ 'bar-chart__tooltip-header' ] }>{ categoryLabel }</div>\n\t\t\t\t\t\t{ renderTooltipRow( primaryKey, formatNumber( nearestDatum.value as number ) ) }\n\t\t\t\t\t\t{ renderTooltipRow(\n\t\t\t\t\t\t\tcomparisonEntry.series.label,\n\t\t\t\t\t\t\tformatNumber( comparisonDatum.value as number )\n\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<div className={ styles[ 'bar-chart__tooltip' ] }>\n\t\t\t\t\t<div className={ styles[ 'bar-chart__tooltip-header' ] }>{ primaryKey }</div>\n\t\t\t\t\t{ renderTooltipRow( categoryLabel, formatNumber( nearestDatum.value as number ) ) }\n\t\t\t\t</div>\n\t\t\t);\n\t\t},\n\t\t[ chartOptions.tooltip, comparisonEntries ]\n\t);\n\n\tconst renderPattern = useCallback(\n\t\t( index: number, color: string ) => {\n\t\t\tconst patternType = index % 4;\n\t\t\tconst id = getPatternId( chartId, index );\n\t\t\tconst commonProps = {\n\t\t\t\tid,\n\t\t\t\tstroke: 'white',\n\t\t\t\tstrokeWidth: 1,\n\t\t\t\tbackground: color,\n\t\t\t};\n\n\t\t\tswitch ( patternType ) {\n\t\t\t\tcase 0:\n\t\t\t\tdefault:\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<PatternLines\n\t\t\t\t\t\t\tkey={ id }\n\t\t\t\t\t\t\t{ ...commonProps }\n\t\t\t\t\t\t\twidth={ 5 }\n\t\t\t\t\t\t\theight={ 5 }\n\t\t\t\t\t\t\torientation={ [ 'diagonal' ] }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\tcase 1:\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<PatternCircles key={ id } { ...commonProps } width={ 6 } height={ 6 } fill=\"white\" />\n\t\t\t\t\t);\n\t\t\t\tcase 2:\n\t\t\t\t\treturn <PatternWaves key={ id } { ...commonProps } width={ 4 } height={ 4 } />;\n\t\t\t\tcase 3:\n\t\t\t\t\treturn <PatternHexagons key={ id } { ...commonProps } size={ 8 } height={ 3 } />;\n\t\t\t}\n\t\t},\n\t\t[ chartId ]\n\t);\n\n\tconst createPatternBorderStyle = useCallback(\n\t\t( index: number, color: string ) => {\n\t\t\tconst patternId = getPatternId( chartId, index );\n\t\t\t// Border the primary bars and any comparison shadow reusing the same pattern,\n\t\t\t// so a patterned shadow gets the same outline as its primary bar.\n\t\t\treturn `\n\t\t\t.visx-bar[fill=\"url(#${ patternId })\"],\n\t\t\t.bar-chart__comparison-bars rect[fill=\"url(#${ patternId })\"] {\n\t\t\t\tstroke: ${ color };\n\t\t\t\tstroke-width: 1;\n\t\t\t\t}\n\t\t\t`;\n\t\t},\n\t\t[ chartId ]\n\t);\n\n\tconst createKeyboardHighlightStyle = useCallback( () => {\n\t\tif ( selectedIndex === undefined ) return '';\n\n\t\t// Use only primary entries — comparison series have no .visx-bar elements so\n\t\t// their indices must not appear in the nth-child selector.\n\t\t// Pattern: [series1[0], series2[0], series3[0], series1[1], series2[1], series3[1], ...]\n\t\tconst primaryCount = primaryEntries.length;\n\t\tconst maxDataPoints = Math.max( ...primaryEntries.map( e => e.series.data.length ) );\n\t\tconst dataPointIndex = Math.floor( selectedIndex / primaryCount );\n\t\tconst seriesIndex = selectedIndex % primaryCount;\n\n\t\t// Only highlight if we're within valid bounds\n\t\tif ( dataPointIndex >= maxDataPoints || seriesIndex >= primaryCount ) {\n\t\t\treturn '';\n\t\t}\n\n\t\tconst seriesData = primaryEntries[ seriesIndex ]?.series;\n\t\tif ( ! seriesData || dataPointIndex >= seriesData.data.length ) {\n\t\t\treturn '';\n\t\t}\n\n\t\t// Based on the DOM structure analysis:\n\t\t// - All bars are in a single .visx-bar-group\n\t\t// - Bars are ordered as: [series1[0], series1[1], series2[0], series2[1], ...]\n\t\t// - So we need to calculate the actual bar index in the DOM\n\t\tconst actualBarIndex = seriesIndex * maxDataPoints + dataPointIndex;\n\n\t\t// Use a CSS class selector instead of ID since useId() generates invalid CSS ID characters\n\t\tconst generatedStyles = `\n\t\t\t.bar-chart[data-chart-id=\"bar-chart-${ chartId }\"] .visx-bar-group .visx-bar:nth-child(${\n\t\t\t\tactualBarIndex + 1\n\t\t\t}) {\n\t\t\t\tstroke: #005fcc;\n\t\t\t\tstroke-width: 2px;\n\t\t\t}\n\t\t`;\n\n\t\treturn generatedStyles;\n\t}, [ selectedIndex, primaryEntries, chartId ] );\n\n\t// Validate data first\n\tconst error = validateData( dataSorted );\n\tconst isDataValid = ! error;\n\n\t// Memoize metadata to prevent unnecessary re-registration\n\tconst chartMetadata = useMemo(\n\t\t() => ( {\n\t\t\torientation,\n\t\t\twithPatterns,\n\t\t} ),\n\t\t[ orientation, withPatterns ]\n\t);\n\n\t// Register chart with context only if data is valid\n\tuseChartRegistration( {\n\t\tchartId,\n\t\tlegendItems,\n\t\tchartType: 'bar',\n\t\tisDataValid,\n\t\tmetadata: chartMetadata,\n\t} );\n\n\tconst prefersReducedMotion = usePrefersReducedMotion();\n\n\tif ( error ) {\n\t\treturn <div className={ clsx( 'bar-chart', styles[ 'bar-chart' ] ) }>{ error }</div>;\n\t}\n\n\tconst gridVisibility = gridVisibilityProp ?? chartOptions.gridVisibility;\n\tconst highlightedBarStyle = createKeyboardHighlightStyle();\n\n\tconst legendPosition = legend.position ?? 'bottom';\n\tconst legendElement = showLegend && (\n\t\t<Legend\n\t\t\torientation={ legend.orientation ?? 'horizontal' }\n\t\t\tposition={ legendPosition }\n\t\t\talignment={ legend.alignment ?? 'center' }\n\t\t\tlabelStyles={ legend.labelStyles }\n\t\t\titemClassName={ legend.itemClassName }\n\t\t\titemStyles={ legend.itemStyles }\n\t\t\tshapeStyles={ legend.shapeStyles }\n\t\t\tclassName={ styles[ 'bar-chart__legend' ] }\n\t\t\tshape={ legend.shape ?? 'rect' }\n\t\t\tchartId={ chartId }\n\t\t\tinteractive={ legendInteractive }\n\t\t/>\n\t);\n\n\treturn (\n\t\t<ChartInstanceContext.Provider\n\t\t\tvalue={ {\n\t\t\t\tchartId,\n\t\t\t\tisSeriesVisible,\n\t\t\t\tchartWidth: width,\n\t\t\t\tchartHeight: measuredChartHeight || 0,\n\t\t\t} }\n\t\t>\n\t\t\t<ChartLayout\n\t\t\t\tlegendPosition={ legendPosition }\n\t\t\t\tlegendElement={ legendElement }\n\t\t\t\tlegendChildren={ legendChildren }\n\t\t\t\tgap={ gap }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'bar-chart',\n\t\t\t\t\tstyles[ 'bar-chart' ],\n\t\t\t\t\t{\n\t\t\t\t\t\t[ styles[ `bar-chart--animated${ horizontal ? '-horizontal' : '' }` ] ]:\n\t\t\t\t\t\t\tanimation && ! prefersReducedMotion,\n\t\t\t\t\t},\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tstyle={ { width, height } }\n\t\t\t\tdata-testid=\"bar-chart\"\n\t\t\t\tdata-chart-id={ `bar-chart-${ chartId }` }\n\t\t\t\ttrailingContent={ nonLegendChildren }\n\t\t\t\tonContentHeightChange={ handleContentHeightChange }\n\t\t\t>\n\t\t\t\t{ ( { contentHeight } ) => {\n\t\t\t\t\tconst chartHeight = contentHeight > 0 ? contentHeight : height;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\trole=\"grid\"\n\t\t\t\t\t\t\taria-label={ __( 'Bar chart', 'jetpack-charts' ) }\n\t\t\t\t\t\t\ttabIndex={ 0 }\n\t\t\t\t\t\t\tonKeyDown={ onChartKeyDown }\n\t\t\t\t\t\t\tonFocus={ onChartFocus }\n\t\t\t\t\t\t\tonBlur={ onChartBlur }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ chartHeight > 0 && (\n\t\t\t\t\t\t\t\t<div ref={ chartRef }>\n\t\t\t\t\t\t\t\t\t<XYChart\n\t\t\t\t\t\t\t\t\t\ttheme={ theme }\n\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\theight={ chartHeight }\n\t\t\t\t\t\t\t\t\t\tmargin={ {\n\t\t\t\t\t\t\t\t\t\t\t...defaultMargin,\n\t\t\t\t\t\t\t\t\t\t\t...margin,\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\txScale={ xScale }\n\t\t\t\t\t\t\t\t\t\tyScale={ yScale }\n\t\t\t\t\t\t\t\t\t\thorizontal={ horizontal }\n\t\t\t\t\t\t\t\t\t\tpointerEventsDataKey=\"nearest\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ ! allSeriesHidden && (\n\t\t\t\t\t\t\t\t\t\t\t<Grid\n\t\t\t\t\t\t\t\t\t\t\t\tcolumns={ gridVisibility.includes( 'y' ) }\n\t\t\t\t\t\t\t\t\t\t\t\trows={ gridVisibility.includes( 'x' ) }\n\t\t\t\t\t\t\t\t\t\t\t\tnumTicks={ 4 }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t\t{ withPatterns && (\n\t\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t\t<defs data-testid=\"bar-chart-patterns\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ dataSorted.map( ( seriesData, index ) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trenderPattern(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tgetElementStyles( { data: seriesData, index } ).color\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t</defs>\n\t\t\t\t\t\t\t\t\t\t\t\t<style>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ dataSorted.map( ( seriesData, index ) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcreatePatternBorderStyle(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tgetElementStyles( { data: seriesData, index } ).color\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t</style>\n\t\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t\t{ highlightedBarStyle && <style>{ highlightedBarStyle }</style> }\n\n\t\t\t\t\t\t\t\t\t\t{ allSeriesHidden ? (\n\t\t\t\t\t\t\t\t\t\t\t<SvgEmptyState\n\t\t\t\t\t\t\t\t\t\t\t\tx={ width / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\ty={ chartHeight / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\t\t\theight={ chartHeight }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ getAllHiddenMessage( legendInteractive, 'series' ) }\n\t\t\t\t\t\t\t\t\t\t\t</SvgEmptyState>\n\t\t\t\t\t\t\t\t\t\t) : null }\n\n\t\t\t\t\t\t\t\t\t\t<ComparisonBars\n\t\t\t\t\t\t\t\t\t\t\tcomparisonEntries={ comparisonEntries }\n\t\t\t\t\t\t\t\t\t\t\tprimaryKeys={ primaryKeys }\n\t\t\t\t\t\t\t\t\t\t\tgroupPadding={ groupPadding }\n\t\t\t\t\t\t\t\t\t\t\thorizontal={ horizontal }\n\t\t\t\t\t\t\t\t\t\t\txAccessor={ chartOptions.accessors.xAccessor }\n\t\t\t\t\t\t\t\t\t\t\tyAccessor={\n\t\t\t\t\t\t\t\t\t\t\t\tchartOptions.accessors.yAccessor as (\n\t\t\t\t\t\t\t\t\t\t\t\t\td: DataPointDate\n\t\t\t\t\t\t\t\t\t\t\t\t) => number | undefined\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tgetElementStyles={ getElementStyles }\n\t\t\t\t\t\t\t\t\t\t\tresolveFill={ resolveComparisonFill }\n\t\t\t\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t\t\t\t<BarGroup padding={ groupPadding }>\n\t\t\t\t\t\t\t\t\t\t\t{ primaryEntries.map( ( { series: seriesData, index } ) => (\n\t\t\t\t\t\t\t\t\t\t\t\t<BarSeries\n\t\t\t\t\t\t\t\t\t\t\t\t\tkey={ seriesData?.label }\n\t\t\t\t\t\t\t\t\t\t\t\t\tdataKey={ seriesData?.label }\n\t\t\t\t\t\t\t\t\t\t\t\t\tdata={ seriesData.data as DataPointDate[] }\n\t\t\t\t\t\t\t\t\t\t\t\t\tyAccessor={ chartOptions.accessors.yAccessor }\n\t\t\t\t\t\t\t\t\t\t\t\t\txAccessor={ chartOptions.accessors.xAccessor }\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolorAccessor={ getBarBackground( index ) }\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t\t\t\t</BarGroup>\n\n\t\t\t\t\t\t\t\t\t\t{ /* With every series hidden there is no data to build the value scale from, so\n\t\t\t\t\t\t\t\t\t\t visx collapses the domain and the axes render squished at the top. Drop them\n\t\t\t\t\t\t\t\t\t\t while the empty state stands in. */ }\n\t\t\t\t\t\t\t\t\t\t{ ! allSeriesHidden && (\n\t\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t\t<Axis { ...chartOptions.axis.x } />\n\t\t\t\t\t\t\t\t\t\t\t\t<Axis { ...chartOptions.axis.y } />\n\t\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t\t{ withTooltips && (\n\t\t\t\t\t\t\t\t\t\t\t<AccessibleTooltip\n\t\t\t\t\t\t\t\t\t\t\t\tdetectBounds\n\t\t\t\t\t\t\t\t\t\t\t\tsnapTooltipToDatumX\n\t\t\t\t\t\t\t\t\t\t\t\tsnapTooltipToDatumY\n\t\t\t\t\t\t\t\t\t\t\t\trenderTooltip={ renderTooltip || renderDefaultTooltip }\n\t\t\t\t\t\t\t\t\t\t\t\tselectedIndex={ selectedIndex }\n\t\t\t\t\t\t\t\t\t\t\t\ttooltipRef={ tooltipRef }\n\t\t\t\t\t\t\t\t\t\t\t\tkeyboardFocusedClassName={\n\t\t\t\t\t\t\t\t\t\t\t\t\tstyles[ 'bar-chart__tooltip--keyboard-focused' ]\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tseries={ primarySeries }\n\t\t\t\t\t\t\t\t\t\t\t\tmode=\"individual\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</XYChart>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t</ChartLayout>\n\t\t</ChartInstanceContext.Provider>\n\t);\n};\n\nconst BarChartWithProvider: FC< BarChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, don't create a new one\n\tif ( existingContext ) {\n\t\treturn <BarChartInternal { ...props } />;\n\t}\n\n\t// Otherwise, create our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<BarChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nBarChartWithProvider.displayName = 'BarChart';\n\n// Create BarChart with composition API\nconst BarChart = attachSubComponents( BarChartWithProvider, {\n\tLegend: Legend,\n} ) as BarChartComponent;\n\n// Create responsive BarChart with composition API\nconst BarChartResponsive = attachSubComponents(\n\twithResponsive< BarChartProps >( BarChartWithProvider ),\n\t{\n\t\tLegend: Legend,\n\t}\n) as BarChartResponsiveComponent;\n\nexport { BarChartResponsive as default, BarChart as BarChartUnresponsive };\n","import { formatNumberCompact } from '@automattic/number-formatters';\nimport { Group } from '@visx/group';\nimport { createScale, scaleBand } from '@visx/scale';\nimport { Text, type TextProps } from '@visx/text';\nimport { useContext, useMemo } from 'react';\nimport { GlobalChartsContext, GlobalChartsProvider } from '../../providers';\nimport { BarChartUnresponsive } from '../bar-chart';\nimport { withResponsive } from '../private/with-responsive';\nimport type { SeriesData } from '../..';\nimport type { ScaleOptions } from '../../types';\nimport type { BarChartProps } from '../bar-chart/bar-chart';\nimport type { AxisRendererProps, AxisScale } from '@visx/axis';\nimport type { AnyD3Scale } from '@visx/scale';\nimport type { ComponentType, FC } from 'react';\n\nexport interface BarListChartProps\n\textends Exclude< BarChartProps, 'orientation' | 'size' | 'gridVisibility' > {\n\toptions?: {\n\t\t/**\n\t\t * Scale for the y axis. Exclude the type property.\n\t\t */\n\t\tyScale: Omit< ScaleOptions, 'type' >;\n\t\t/**\n\t\t * Scale for the x axis. Exclude the type property.\n\t\t */\n\t\txScale: Omit< ScaleOptions, 'type' >;\n\t\t/**\n\t\t * Formatter for the label.\n\t\t */\n\t\tlabelFormatter?: ( value: string ) => string;\n\t\t/**\n\t\t * Formatter for the value.\n\t\t */\n\t\tvalueFormatter?: ( value: number ) => string;\n\t\t/**\n\t\t * y offset of the label and value. Default is based on the number of series, automatically computed.\n\t\t */\n\t\tyOffset?: number;\n\t\t/**\n\t\t * x position of the label.\n\t\t */\n\t\tlabelPosition?: number;\n\t\t/**\n\t\t * x position of the value.\n\t\t */\n\t\tvaluePosition?: number;\n\t\t/**\n\t\t * Custom render function for the label.\n\t\t */\n\t\tlabelComponent?: ComponentType< RenderLabelProps >;\n\t\t/**\n\t\t * Custom render function for the value.\n\t\t */\n\t\tvalueComponent?: ComponentType< RenderValueProps >;\n\t};\n}\n\nexport interface RenderLabelProps {\n\ttextProps: TextProps;\n\tx: number;\n\ty: number;\n\tlabel: string;\n\tformatter: ( value: string ) => string;\n}\n\nexport interface RenderValueProps {\n\ttextProps: TextProps;\n\tx: number;\n\ty: number;\n\tvalue: number;\n\t/**\n\t * Original data\n\t */\n\tdata: SeriesData[];\n\t/**\n\t * Index of the data point\n\t */\n\tindex: number;\n\tformatter: ( value: number ) => string;\n}\n\n/**\n * Get the bandwidth of a scale\n * @param scale - The scale to get the bandwidth of\n * @return The bandwidth of the scale\n */\nconst getScaleBandwidth = < Scale extends AxisScale >( scale?: Scale ) => {\n\t// Broaden type before using 'xxx' in s as typeguard.\n\tconst s = scale as AxisScale;\n\treturn s && 'bandwidth' in s ? s?.bandwidth() ?? 0 : 0;\n};\n\nconst DefaultLabelComponent = ( { textProps, x, y, label, formatter } ) => {\n\treturn (\n\t\t<Text { ...textProps } textAnchor=\"start\" x={ x } y={ y }>\n\t\t\t{ formatter( label ) }\n\t\t</Text>\n\t);\n};\n\nconst DefaultValueComponent = ( { textProps, x, y, value, formatter }: RenderValueProps ) => {\n\treturn (\n\t\t<Text { ...textProps } textAnchor=\"end\" x={ x } y={ y } fontWeight={ 500 }>\n\t\t\t{ formatter( value ) }\n\t\t</Text>\n\t);\n};\n\nconst AxisRenderer = ( {\n\tticks,\n\ttickLabelProps,\n\tyOffset,\n\tlabelPosition,\n\tvaluePosition,\n\tdata,\n\tlabelFormatter,\n\tvalueFormatter,\n\tLabelComponent = DefaultLabelComponent,\n\tValueComponent = DefaultValueComponent,\n}: AxisRendererProps< AnyD3Scale > & {\n\tyOffset: number;\n\tlabelPosition: number;\n\tvaluePosition: number;\n\tdata: SeriesData[];\n\tlabelFormatter?: ( value: string ) => string;\n\tvalueFormatter?: ( value: number ) => string;\n\tLabelComponent?: ComponentType< RenderLabelProps >;\n\tValueComponent?: ComponentType< RenderValueProps >;\n} ) => {\n\tif ( ticks.length === 0 ) {\n\t\treturn null;\n\t}\n\n\t// compute the max tick label size to compute label offset\n\tconst allTickLabelProps = ticks.map( ( { value, index } ) =>\n\t\ttypeof tickLabelProps === 'function' ? tickLabelProps( value, index, ticks ) : {}\n\t);\n\n\treturn ticks.map( ( { from, formattedValue }, index ) => {\n\t\tconst textProps = allTickLabelProps[ index ] ?? {};\n\t\t// No need to pass textAnchor and dx. It will be handled by the component.\n\t\tdelete textProps.textAnchor;\n\t\tdelete textProps.dx;\n\n\t\tconst sum = data.reduce(\n\t\t\t( acc, { data: seriesData } ) => acc + ( seriesData[ index ]?.value ?? 0 ),\n\t\t\t0\n\t\t);\n\t\tconst y = from.y + yOffset;\n\n\t\treturn (\n\t\t\t<Group key={ index }>\n\t\t\t\t<LabelComponent\n\t\t\t\t\ttextProps={ textProps }\n\t\t\t\t\tx={ labelPosition }\n\t\t\t\t\ty={ y }\n\t\t\t\t\tlabel={ formattedValue }\n\t\t\t\t\tformatter={ labelFormatter }\n\t\t\t\t/>\n\t\t\t\t<ValueComponent\n\t\t\t\t\ttextProps={ textProps }\n\t\t\t\t\tx={ valuePosition }\n\t\t\t\t\ty={ y }\n\t\t\t\t\tvalue={ sum }\n\t\t\t\t\tformatter={ valueFormatter }\n\t\t\t\t\tdata={ data }\n\t\t\t\t\tindex={ index }\n\t\t\t\t/>\n\t\t\t</Group>\n\t\t);\n\t} );\n};\n\n/**\n * Calculate the default y offset for the bar list chart.\n * @param data - The data to calculate the default y offset for.\n * @param yScaleConfig - The y scale configuration.\n * @param height - The height of the chart.\n * @param isMultiSeries - Whether the chart is a multi series chart.\n * @return The default y offset.\n */\nconst getDefaultYOffset = (\n\tdata: SeriesData[],\n\tyScaleConfig: Omit< ScaleOptions, 'type' >,\n\theight: number,\n\tisMultiSeries: boolean\n) => {\n\tif ( ! isMultiSeries ) {\n\t\treturn 0;\n\t}\n\n\tconst dataKeys = data.map( ( { label } ) => label );\n\n\tconst yScale = createScale< string >( {\n\t\ttype: 'band' as const,\n\t\trange: [ 0, height ],\n\t\tdomain: dataKeys,\n\t\t...yScaleConfig,\n\t} );\n\n\tconst groupScale = scaleBand< string >( {\n\t\tdomain: dataKeys,\n\t\trange: [ 0, getScaleBandwidth( yScale ) ],\n\t\tpadding: yScaleConfig.paddingInner,\n\t} );\n\n\tconst GAP_BETWEEN_BARS = 6;\n\tconst barThickness = getScaleBandwidth( groupScale );\n\n\t// Use negative value to move the label up.\n\treturn -( barThickness + GAP_BETWEEN_BARS );\n};\n\nconst BarListChartInternal: FC< BarListChartProps > = ( {\n\tdata,\n\twidth,\n\theight,\n\toptions = {},\n\tmargin = {\n\t\tleft: 0,\n\t\tright: 20,\n\t\tbottom: 0,\n\t\ttop: 0,\n\t},\n\t...rest\n} ) => {\n\tconst chartOptions = useMemo( () => {\n\t\tconst isMultiSeries = data.length > 1;\n\n\t\tconst defaultYScale = {\n\t\t\t// For multi series, set default padding larger to look better.\n\t\t\tpaddingInner: isMultiSeries ? 0.3 : 0.1,\n\t\t\tpadding: isMultiSeries ? 0.3 : 0.1,\n\t\t};\n\t\tconst defaultXScale = {\n\t\t\t// Always begin at zero since the x axis is hidden.\n\t\t\tzero: true,\n\t\t};\n\t\tconst yScale = {\n\t\t\t...defaultYScale,\n\t\t\t...( options.yScale ?? {} ),\n\t\t};\n\t\tconst xScale = {\n\t\t\t...defaultXScale,\n\t\t\t...( options.xScale ?? {} ),\n\t\t};\n\n\t\treturn {\n\t\t\tyScale,\n\t\t\txScale,\n\t\t\tlabelPosition: options.labelPosition ?? ( isMultiSeries ? 0 : 10 ),\n\t\t\tvalueFormatter: options.valueFormatter ?? ( value => formatNumberCompact( value ) ),\n\t\t\tlabelFormatter: options.labelFormatter ?? ( value => String( value ) ),\n\t\t\tvaluePosition: options.valuePosition ?? width,\n\t\t\tyOffset: options.yOffset ?? getDefaultYOffset( data, yScale, height, isMultiSeries ),\n\t\t};\n\t}, [ options, width, data, height ] );\n\n\treturn (\n\t\t<BarChartUnresponsive\n\t\t\torientation=\"horizontal\"\n\t\t\tgridVisibility={ 'none' }\n\t\t\tdata={ data }\n\t\t\twidth={ width }\n\t\t\theight={ height }\n\t\t\tmargin={ margin }\n\t\t\toptions={ {\n\t\t\t\taxis: {\n\t\t\t\t\ty: {\n\t\t\t\t\t\tchildren: ( renderProps: AxisRendererProps< AnyD3Scale > ) => (\n\t\t\t\t\t\t\t<AxisRenderer\n\t\t\t\t\t\t\t\t{ ...renderProps }\n\t\t\t\t\t\t\t\tdata={ data }\n\t\t\t\t\t\t\t\tyOffset={ chartOptions.yOffset }\n\t\t\t\t\t\t\t\tlabelPosition={ chartOptions.labelPosition }\n\t\t\t\t\t\t\t\tvaluePosition={ chartOptions.valuePosition }\n\t\t\t\t\t\t\t\tlabelFormatter={ chartOptions.labelFormatter }\n\t\t\t\t\t\t\t\tvalueFormatter={ chartOptions.valueFormatter }\n\t\t\t\t\t\t\t\tLabelComponent={ options.labelComponent }\n\t\t\t\t\t\t\t\tValueComponent={ options.valueComponent }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t\tx: {\n\t\t\t\t\t\tchildren: () => null,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\txScale: chartOptions.xScale,\n\t\t\t\tyScale: chartOptions.yScale,\n\t\t\t} }\n\t\t\t{ ...rest }\n\t\t/>\n\t);\n};\n\nconst BarListChart: FC< BarListChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, render the core component directly\n\tif ( existingContext ) {\n\t\treturn <BarListChartInternal { ...props } />;\n\t}\n\n\t// Otherwise, wrap with our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<BarListChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nBarListChart.displayName = 'BarListChart';\n\nconst BarListChartResponsive = withResponsive< BarListChartProps >( BarListChart );\n\nexport { BarListChartResponsive as default, BarListChart as BarListChartUnresponsive };\n","import { useCallback, useState } from 'react';\n\n/**\n * Custom hook to manage funnel bar selection state and interactions\n * @param hideTooltip - Function to hide tooltip when selection is cleared\n * @return Object containing selection state and event handlers\n */\nexport const useFunnelSelection = ( hideTooltip?: () => void ) => {\n\tconst [ clickedStep, setClickedStep ] = useState< string | null >( null );\n\n\t// Handle bar click\n\tconst handleBarClick = useCallback(\n\t\t( stepId: string ) => {\n\t\t\tif ( clickedStep === stepId ) {\n\t\t\t\t// If clicking the same step, deselect it\n\t\t\t\tsetClickedStep( null );\n\t\t\t\thideTooltip?.();\n\t\t\t} else {\n\t\t\t\t// Otherwise, select this step\n\t\t\t\tsetClickedStep( stepId );\n\t\t\t}\n\t\t},\n\t\t[ clickedStep, hideTooltip ]\n\t);\n\n\t// Handle bar keydown\n\tconst handleBarKeyDown = useCallback(\n\t\t( stepId: string, event: React.KeyboardEvent ) => {\n\t\t\tif ( event.key === 'Enter' || event.key === ' ' ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tif ( clickedStep === stepId ) {\n\t\t\t\t\tsetClickedStep( null );\n\t\t\t\t\thideTooltip?.();\n\t\t\t\t} else {\n\t\t\t\t\tsetClickedStep( stepId );\n\t\t\t\t}\n\t\t\t} else if ( event.key === 'Escape' ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetClickedStep( null );\n\t\t\t\thideTooltip?.();\n\t\t\t}\n\t\t},\n\t\t[ clickedStep, hideTooltip ]\n\t);\n\n\t// Clear selection (for chart-level click)\n\tconst clearSelection = useCallback( () => {\n\t\tsetClickedStep( null );\n\t\thideTooltip?.();\n\t}, [ hideTooltip ] );\n\n\t// Get step state helpers\n\tconst getStepState = useCallback(\n\t\t( stepId: string ) => ( {\n\t\t\tisClicked: clickedStep === stepId,\n\t\t\tisBlurred: clickedStep !== null && clickedStep !== stepId,\n\t\t} ),\n\t\t[ clickedStep ]\n\t);\n\n\treturn {\n\t\tclickedStep,\n\t\thandleBarClick,\n\t\thandleBarKeyDown,\n\t\tclearSelection,\n\t\tgetStepState,\n\t};\n};\n","import { useTooltip, useTooltipInPortal } from '@visx/tooltip';\nimport { Stack } from '@wordpress/ui';\nimport clsx from 'clsx';\nimport { type FC, useRef, useMemo, useEffect, useState, useCallback, useContext } from 'react';\nimport { usePrefersReducedMotion } from '../../hooks';\nimport {\n\tGlobalChartsProvider,\n\tGlobalChartsContext,\n\tChartScopeContext,\n\tuseChartId,\n\tuseChartRegistration,\n\tuseGlobalChartsTheme,\n\tuseGlobalChartsContext,\n} from '../../providers';\nimport { CHART_SCOPE_CLASS } from '../../styles/chart-scope-class';\nimport { formatPercentage, hexToRgba } from '../../utils';\nimport styles from './conversion-funnel-chart.module.scss';\nimport { useFunnelSelection } from './private';\nimport type { FunnelStep, ConversionFunnelChartProps } from './types';\n\n/**\n * Internal ConversionFunnelChart component with chart registration\n *\n * @param props - Component props\n * @param props.chartId - Optional unique identifier for the chart\n * @param props.mainRate - Main conversion rate to highlight\n * @param props.changeIndicator - Change indicator (e.g., +2%, -1.5%)\n * @param props.steps - Array of funnel steps\n * @param props.loading - Whether the chart is in loading state\n * @param props.animation - Whether to show chart animation on initial render or not\n * @param props.className - Additional CSS class name\n * @param props.height - Height of the chart container. Falls back to style.height if set, otherwise defaults to \"100%\".\n * @param props.style - Custom styling\n * @param props.renderStepLabel - Custom render function for step labels\n * @param props.renderStepRate - Custom render function for step rates\n * @param props.renderMainMetric - Custom render function for the entire main metric section\n * @param props.renderTooltip - Custom render function for tooltip content\n * @return JSX element representing the conversion funnel chart\n */\nconst ConversionFunnelChartInternal: FC< ConversionFunnelChartProps > = ( {\n\tmainRate,\n\tchangeIndicator,\n\tsteps,\n\tloading = false,\n\tanimation,\n\tclassName,\n\tchartId: providedChartId,\n\theight,\n\tstyle,\n\trenderStepLabel,\n\trenderStepRate,\n\trenderMainMetric,\n\trenderTooltip,\n} ) => {\n\tconst chartId = useChartId( providedChartId );\n\tconst { conversionFunnelChart: conversionFunnelChartSettings } = useGlobalChartsTheme();\n\tconst { getElementStyles, isColorPaletteResolved } = useGlobalChartsContext();\n\tconst chartRef = useRef< HTMLDivElement >( null );\n\tconst selectedBarRef = useRef< HTMLDivElement | null >( null );\n\tconst [ scopeNode, setScopeNode ] = useState< HTMLElement | null >( null );\n\n\t// Use @visx/tooltip hooks for tooltip positioning\n\tconst { tooltipData, tooltipLeft, tooltipTop, tooltipOpen, showTooltip, hideTooltip } =\n\t\tuseTooltip();\n\n\t// Use custom hook for selection management\n\tconst { handleBarClick, handleBarKeyDown, clearSelection, getStepState } =\n\t\tuseFunnelSelection( hideTooltip );\n\tconst {\n\t\tcontainerRef: portalContainerRef,\n\t\tTooltipInPortal,\n\t\tcontainerBounds,\n\t} = useTooltipInPortal( {\n\t\t// use TooltipWithBounds for boundary detection\n\t\tdetectBounds: true,\n\t\t// when tooltip containers are scrolled, this will correctly update the Tooltip position\n\t\tscroll: true,\n\t} );\n\n\t// `useTooltipInPortal` returns a fresh `containerRef` closure on every render, so depending on it directly would give this callback a new identity every render — React then detaches and reattaches the ref on every commit, flushing the scope context to null and back. Reading it through a ref keeps the callback's identity genuinely stable.\n\tconst portalContainerRefRef = useRef( portalContainerRef );\n\tuseEffect( () => {\n\t\tportalContainerRefRef.current = portalContainerRef;\n\t}, [ portalContainerRef ] );\n\n\t// Stable identity so React doesn't detach/reattach (and re-render the scope context) on every commit. Keep all three assignments, in the same order, and keep it firing on unmount (node === null).\n\tconst setChartRef = useCallback( ( node: HTMLDivElement | null ) => {\n\t\t// Set containerRef for @visx coordinate system\n\t\tportalContainerRefRef.current( node );\n\t\tchartRef.current = node;\n\t\tsetScopeNode( node );\n\t}, [] );\n\n\t// Wrapper to clear selectedBarRef after clearing selection\n\tconst clearSelectionAndRef = useCallback( () => {\n\t\tclearSelection();\n\t\tselectedBarRef.current = null;\n\t\thideTooltip();\n\t}, [ clearSelection, hideTooltip ] );\n\n\t// Helper function to show tooltip at specific coordinates\n\tconst showTooltipAt = useCallback(\n\t\t( step: FunnelStep, x: number, y: number ) => {\n\t\t\tshowTooltip( {\n\t\t\t\ttooltipData: step,\n\t\t\t\ttooltipLeft: x,\n\t\t\t\ttooltipTop: y - 10,\n\t\t\t} );\n\t\t},\n\t\t[ showTooltip ]\n\t);\n\n\t// Helper function to get tooltip coordinates for mouse events\n\t// Use clientX/Y and subtract containerBounds to cancel out any stale offset.\n\t// TooltipInPortal calculates: tooltipLeft + containerBounds.left + scrollX\n\t// By passing (clientX - containerBounds.left), we get correct page coordinates\n\t// regardless of whether bounds are stale (e.g., after dashboard customization).\n\tconst getMouseTooltipCoords = useCallback(\n\t\t( event: React.MouseEvent ) => {\n\t\t\t// Don't return coords until container bounds are measured\n\t\t\tif ( containerBounds.width === 0 || containerBounds.height === 0 ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tx: event.clientX - containerBounds.left,\n\t\t\t\ty: event.clientY - containerBounds.top,\n\t\t\t};\n\t\t},\n\t\t[ containerBounds.width, containerBounds.height, containerBounds.left, containerBounds.top ]\n\t);\n\n\t// Helper function to get tooltip coordinates for keyboard events\n\t// Use fresh getBoundingClientRect() and subtract containerBounds to cancel out stale offset.\n\tconst getKeyboardTooltipCoords = useCallback(\n\t\t( event: React.KeyboardEvent ) => {\n\t\t\t// Don't return coords until container bounds are measured\n\t\t\tif ( containerBounds.width === 0 || containerBounds.height === 0 ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst rect = event.currentTarget.getBoundingClientRect();\n\t\t\t// Calculate center of element in viewport coordinates, then subtract containerBounds\n\t\t\tconst x = rect.left + rect.width / 2 - containerBounds.left;\n\t\t\tconst y = rect.top - containerBounds.top;\n\t\t\treturn { x, y };\n\t\t},\n\t\t[ containerBounds.width, containerBounds.height, containerBounds.left, containerBounds.top ]\n\t);\n\n\t// Helper function to handle step interaction (both click and keyboard)\n\tconst handleStepInteraction = useCallback(\n\t\t(\n\t\t\tstep: FunnelStep,\n\t\t\tevent: React.MouseEvent | React.KeyboardEvent,\n\t\t\tinteractionType: 'click' | 'keyboard'\n\t\t) => {\n\t\t\t// Store reference to the interacted element\n\t\t\tselectedBarRef.current = event.currentTarget as HTMLDivElement;\n\n\t\t\t// Check if deselecting the same step\n\t\t\tconst { isClicked } = getStepState( step.id );\n\t\t\tif ( isClicked ) {\n\t\t\t\t// Deselecting - clear selection (tooltip will be hidden by hook)\n\t\t\t\tif ( interactionType === 'click' ) {\n\t\t\t\t\thandleBarClick( step.id );\n\t\t\t\t} else {\n\t\t\t\t\thandleBarKeyDown( step.id, event as React.KeyboardEvent );\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Selecting - handle selection and show tooltip\n\t\t\tif ( interactionType === 'click' ) {\n\t\t\t\thandleBarClick( step.id );\n\t\t\t\tconst coords = getMouseTooltipCoords( event as React.MouseEvent );\n\t\t\t\tif ( coords ) {\n\t\t\t\t\tshowTooltipAt( step, coords.x, coords.y );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thandleBarKeyDown( step.id, event as React.KeyboardEvent );\n\t\t\t\tconst coords = getKeyboardTooltipCoords( event as React.KeyboardEvent );\n\t\t\t\tif ( coords ) {\n\t\t\t\t\tshowTooltipAt( step, coords.x, coords.y );\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tgetStepState,\n\t\t\thandleBarClick,\n\t\t\thandleBarKeyDown,\n\t\t\tshowTooltipAt,\n\t\t\tgetMouseTooltipCoords,\n\t\t\tgetKeyboardTooltipCoords,\n\t\t]\n\t);\n\n\t// Create handler factories to avoid arrow functions in JSX\n\tconst stepHandlers = useMemo( () => {\n\t\tconst handlers = new Map<\n\t\t\tstring,\n\t\t\t{\n\t\t\t\tonClick: ( event: React.MouseEvent ) => void;\n\t\t\t\tonKeyDown: ( event: React.KeyboardEvent ) => void;\n\t\t\t}\n\t\t>();\n\n\t\tsteps.forEach( step => {\n\t\t\tconst onClick = ( event: React.MouseEvent ) => {\n\t\t\t\tevent.stopPropagation();\n\t\t\t\thandleStepInteraction( step, event, 'click' );\n\t\t\t};\n\n\t\t\tconst onKeyDown = ( event: React.KeyboardEvent ) => {\n\t\t\t\tif ( event.key === 'Enter' || event.key === ' ' ) {\n\t\t\t\t\thandleStepInteraction( step, event, 'keyboard' );\n\t\t\t\t} else {\n\t\t\t\t\t// For other keys (like Escape), just handle the selection\n\t\t\t\t\tselectedBarRef.current = event.currentTarget as HTMLDivElement;\n\t\t\t\t\thandleBarKeyDown( step.id, event );\n\t\t\t\t}\n\t\t\t};\n\n\t\t\thandlers.set( step.id, { onClick, onKeyDown } );\n\t\t} );\n\n\t\treturn handlers;\n\t}, [ steps, handleStepInteraction, handleBarKeyDown ] );\n\n\t// Handle document-level click to clear selection when clicking outside selected bar\n\tuseEffect( () => {\n\t\tconst handleDocumentClick = ( event: MouseEvent ) => {\n\t\t\t// Only clear selection if there's an active selection and click is outside the selected bar\n\t\t\tif ( selectedBarRef.current && ! selectedBarRef.current.contains( event.target as Node ) ) {\n\t\t\t\tclearSelectionAndRef();\n\t\t\t}\n\t\t};\n\n\t\tdocument.addEventListener( 'mousedown', handleDocumentClick );\n\n\t\treturn () => {\n\t\t\tdocument.removeEventListener( 'mousedown', handleDocumentClick );\n\t\t};\n\t}, [ clearSelectionAndRef ] );\n\n\t// Resolve height: explicit height prop > style.height > default 100%\n\tconst resolvedHeight = height ?? style?.height ?? '100%';\n\n\t// Get component settings from theme with fallbacks\n\tconst { primaryColor, backgroundColor, positiveChangeColor, negativeChangeColor } =\n\t\tconversionFunnelChartSettings;\n\n\t// Resolve bar color using getElementStyles with primaryColor as override\n\tconst { color: barColor } = getElementStyles\n\t\t? getElementStyles( {\n\t\t\t\tindex: 0,\n\t\t\t\toverrideColor: primaryColor,\n\t\t } )\n\t\t: { color: primaryColor || '#000000' };\n\n\t// Determine change indicator color\n\tconst isPositiveChange = changeIndicator?.startsWith( '+' );\n\tconst changeColor = isPositiveChange ? positiveChangeColor : negativeChangeColor;\n\n\t// Create light background version of primary color if not set\n\tconst barBackgroundColor =\n\t\tbackgroundColor || hexToRgba( barColor, 0.08 ) || 'rgba(0, 0, 0, 0.08)';\n\n\t// Default main metric rendering function\n\tconst renderDefaultMainMetric = () => (\n\t\t<>\n\t\t\t<span className={ styles[ 'main-rate' ] }>{ formatPercentage( mainRate ) }</span>\n\t\t\t{ changeIndicator && (\n\t\t\t\t<span className={ styles[ 'change-indicator' ] } style={ { color: changeColor } }>\n\t\t\t\t\t{ changeIndicator }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t</>\n\t);\n\n\t// Default tooltip rendering function\n\tconst renderDefaultTooltip = ( step: FunnelStep ) => (\n\t\t<Stack direction=\"column\" align=\"flex-start\" gap=\"xs\">\n\t\t\t<div className={ styles[ 'tooltip-title' ] }>{ step.label }</div>\n\t\t\t<div className={ styles[ 'tooltip-content' ] }>\n\t\t\t\t{ formatPercentage( step.rate ) }\n\t\t\t\t{ ` • ${ step.count ?? 'no' } items` }\n\t\t\t</div>\n\t\t</Stack>\n\t);\n\n\t// Validate data\n\tconst isDataValid = Boolean( steps && steps.length > 0 );\n\n\t// Memoize metadata to prevent unnecessary re-registration\n\tconst chartMetadata = useMemo(\n\t\t() => ( {\n\t\t\tmainRate,\n\t\t\tchangeIndicator,\n\t\t\tstepsCount: steps?.length || 0,\n\t\t} ),\n\t\t[ mainRate, changeIndicator, steps?.length ]\n\t);\n\n\tuseChartRegistration( {\n\t\tchartId,\n\t\tlegendItems: [],\n\t\tchartType: 'conversion-funnel',\n\t\tisDataValid,\n\t\tmetadata: chartMetadata,\n\t} );\n\n\tconst prefersReducedMotion = usePrefersReducedMotion();\n\n\t// Handle empty or undefined data\n\tif ( ! isDataValid ) {\n\t\treturn (\n\t\t\t<Stack\n\t\t\t\tdirection=\"column\"\n\t\t\t\talign=\"center\"\n\t\t\t\tjustify=\"center\"\n\t\t\t\tdata-testid=\"conversion-funnel-chart\"\n\t\t\t\tref={ setScopeNode }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\tstyles[ 'conversion-funnel-chart' ],\n\t\t\t\t\tloading && styles[ 'conversion-funnel-chart--loading' ],\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tstyle={ { ...style, height: resolvedHeight } }\n\t\t\t>\n\t\t\t\t<div className={ styles[ 'empty-state' ] }>\n\t\t\t\t\t{ loading ? 'Loading...' : 'No data available' }\n\t\t\t\t</div>\n\t\t\t</Stack>\n\t\t);\n\t}\n\n\t// Calculate bar heights relative to the maximum (first step)\n\tconst maxRate = Math.max( ...steps.map( step => step.rate ) );\n\n\treturn (\n\t\t<>\n\t\t\t<Stack\n\t\t\t\tdirection=\"column\"\n\t\t\t\tgap=\"xl\"\n\t\t\t\tdata-testid=\"conversion-funnel-chart\"\n\t\t\t\tref={ setChartRef }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\tstyles[ 'conversion-funnel-chart' ],\n\t\t\t\t\tloading && styles[ 'conversion-funnel-chart--loading' ],\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tstyle={ { ...style, height: resolvedHeight } }\n\t\t\t>\n\t\t\t\t<ChartScopeContext.Provider value={ scopeNode }>\n\t\t\t\t\t{ /* Main Metric */ }\n\t\t\t\t\t{ renderMainMetric ? (\n\t\t\t\t\t\trenderMainMetric( {\n\t\t\t\t\t\t\tmainRate,\n\t\t\t\t\t\t\tchangeIndicator,\n\t\t\t\t\t\t\tclassName: styles[ 'main-metric' ],\n\t\t\t\t\t\t\tchangeColor,\n\t\t\t\t\t\t} )\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<Stack direction=\"row\" align=\"baseline\" gap=\"sm\" className={ styles[ 'main-metric' ] }>\n\t\t\t\t\t\t\t{ renderDefaultMainMetric() }\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ /* Funnel Steps */ }\n\t\t\t\t\t<Stack\n\t\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\t\talign=\"flex-end\"\n\t\t\t\t\t\tgap=\"lg\"\n\t\t\t\t\t\tclassName={ styles[ 'funnel-container' ] }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ steps.map( ( step, index ) => {\n\t\t\t\t\t\t\tconst barHeight = ( step.rate / maxRate ) * 100;\n\t\t\t\t\t\t\tconst { isBlurred } = getStepState( step.id );\n\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<Stack\n\t\t\t\t\t\t\t\t\tkey={ step.id }\n\t\t\t\t\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\t\t\t\t\tdata-testid=\"funnel-step\"\n\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\tstyles[ 'funnel-step' ],\n\t\t\t\t\t\t\t\t\t\tisColorPaletteResolved && styles[ 'funnel-step--animated' ],\n\t\t\t\t\t\t\t\t\t\tisBlurred && styles[ 'funnel-step--blurred' ]\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tgap=\"xl\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ /* Step Label and Rate */ }\n\t\t\t\t\t\t\t\t\t<Stack direction=\"column\" gap=\"xs\">\n\t\t\t\t\t\t\t\t\t\t{ renderStepLabel ? (\n\t\t\t\t\t\t\t\t\t\t\trenderStepLabel( {\n\t\t\t\t\t\t\t\t\t\t\t\tstep,\n\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\tclassName: styles[ 'step-label' ],\n\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\t<span className={ styles[ 'step-label' ] }>{ step.label }</span>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t{ renderStepRate ? (\n\t\t\t\t\t\t\t\t\t\t\trenderStepRate( {\n\t\t\t\t\t\t\t\t\t\t\t\tstep,\n\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\tclassName: styles[ 'step-rate' ],\n\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\t<span className={ styles[ 'step-rate' ] }>\n\t\t\t\t\t\t\t\t\t\t\t\t{ formatPercentage( step.rate ) }\n\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</Stack>\n\n\t\t\t\t\t\t\t\t\t{ /* Funnel Bar */ }\n\t\t\t\t\t\t\t\t\t<Stack\n\t\t\t\t\t\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\t\t\t\t\t\tjustify=\"flex-end\"\n\t\t\t\t\t\t\t\t\t\tclassName={ styles[ 'bar-container' ] }\n\t\t\t\t\t\t\t\t\t\tonClick={ stepHandlers.get( step.id )?.onClick }\n\t\t\t\t\t\t\t\t\t\tonKeyDown={ stepHandlers.get( step.id )?.onKeyDown }\n\t\t\t\t\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\t\t\t\t\ttabIndex={ isBlurred ? -1 : 0 }\n\t\t\t\t\t\t\t\t\t\taria-label={ step.label }\n\t\t\t\t\t\t\t\t\t\tstyle={ { backgroundColor: barBackgroundColor } }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\tclassName={ clsx( styles[ 'funnel-bar' ], {\n\t\t\t\t\t\t\t\t\t\t\t\t[ styles[ 'funnel-bar--animated' ] ]:\n\t\t\t\t\t\t\t\t\t\t\t\t\tanimation && ! loading && ! prefersReducedMotion,\n\t\t\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\t\t\theight: `${ barHeight }%`,\n\t\t\t\t\t\t\t\t\t\t\t\tbackgroundColor: barColor,\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t</Stack>\n\t\t\t\t</ChartScopeContext.Provider>\n\t\t\t</Stack>\n\n\t\t\t{ /* Tooltip Portal */ }\n\t\t\t{ tooltipOpen &&\n\t\t\t\ttooltipData &&\n\t\t\t\t( () => {\n\t\t\t\t\tconst tooltipContent = renderTooltip\n\t\t\t\t\t\t? renderTooltip( {\n\t\t\t\t\t\t\t\tstep: tooltipData as FunnelStep,\n\t\t\t\t\t\t\t\tindex: steps.findIndex( s => s.id === ( tooltipData as FunnelStep ).id ),\n\t\t\t\t\t\t\t\ttop: tooltipTop,\n\t\t\t\t\t\t\t\tleft: tooltipLeft,\n\t\t\t\t\t\t\t\tclassName: styles[ 'tooltip-wrapper' ],\n\t\t\t\t\t\t } )\n\t\t\t\t\t\t: renderDefaultTooltip( tooltipData as FunnelStep );\n\n\t\t\t\t\t// Don't render tooltip if renderTooltip returns falsy\n\t\t\t\t\tif ( ! tooltipContent ) return null;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<TooltipInPortal\n\t\t\t\t\t\t\t// set this to random so it correctly updates with parent bounds\n\t\t\t\t\t\t\tkey={ Math.random() }\n\t\t\t\t\t\t\ttop={ tooltipTop }\n\t\t\t\t\t\t\tleft={ tooltipLeft }\n\t\t\t\t\t\t\tclassName={ clsx( CHART_SCOPE_CLASS, styles[ 'tooltip-wrapper' ] ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ tooltipContent }\n\t\t\t\t\t\t</TooltipInPortal>\n\t\t\t\t\t);\n\t\t\t\t} )() }\n\t\t</>\n\t);\n};\n\n/**\n * ConversionFunnelChart component with provider wrapper\n *\n * @param props - Component props\n * @return JSX element representing the conversion funnel chart\n */\nconst ConversionFunnelChartWithProvider: FC< ConversionFunnelChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, don't create a new one\n\tif ( existingContext ) {\n\t\treturn <ConversionFunnelChartInternal { ...props } />;\n\t}\n\n\t// Otherwise, create our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<ConversionFunnelChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nConversionFunnelChartWithProvider.displayName = 'ConversionFunnelChart';\n\nexport { ConversionFunnelChartWithProvider as default };\n","/**\n * External dependencies\n */\nimport DOMPurify from 'dompurify';\n\n// Enforce rel=\"noopener noreferrer\" on links with target=\"_blank\" to prevent tab-napping.\n// Registered once at module level since DOMPurify hooks are global state.\nDOMPurify.addHook( 'afterSanitizeAttributes', ( node: Element ) => {\n\tif ( node.tagName === 'A' && node.getAttribute( 'target' ) === '_blank' ) {\n\t\tnode.setAttribute( 'rel', 'noopener noreferrer' );\n\t}\n} );\n\n/**\n * Sanitizes an HTML string using DOMPurify, allowing only safe formatting\n * markup suitable for chart tooltip content.\n *\n * @param html - The HTML string to sanitize\n * @return Sanitized HTML string safe for rendering\n */\nexport function sanitizeHtml( html: string ): string {\n\treturn DOMPurify.sanitize( html, {\n\t\tALLOWED_TAGS: [\n\t\t\t'a',\n\t\t\t'b',\n\t\t\t'br',\n\t\t\t'div',\n\t\t\t'em',\n\t\t\t'i',\n\t\t\t'li',\n\t\t\t'ol',\n\t\t\t'p',\n\t\t\t'small',\n\t\t\t'span',\n\t\t\t'strong',\n\t\t\t'sub',\n\t\t\t'sup',\n\t\t\t'table',\n\t\t\t'tbody',\n\t\t\t'td',\n\t\t\t'th',\n\t\t\t'thead',\n\t\t\t'tr',\n\t\t\t'u',\n\t\t\t'ul',\n\t\t],\n\t\tALLOWED_ATTR: [ 'class', 'href', 'target', 'rel' ],\n\t} );\n}\n","/**\n * External dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport { FC, useContext, useEffect, useMemo, useRef } from 'react';\nimport { Chart, type GoogleChartPackages, type ReactGoogleChartEvent } from 'react-google-charts';\n/**\n * Internal dependencies\n */\nimport {\n\tGlobalChartsContext,\n\tGlobalChartsProvider,\n\tuseChartScopeElement,\n\tuseGlobalChartsContext,\n} from '../../providers';\nimport { lightenHexColor, normalizeColorToHex } from '../../utils/color-utils';\nimport { resolveCssVariable } from '../../utils/resolve-css-var';\nimport { sanitizeHtml } from '../../utils/sanitize-html';\nimport { Center } from '../private/center';\nimport { withResponsive } from '../private/with-responsive';\nimport styles from './geo-chart.module.scss';\nimport type { GeoChartError, GeoChartProps } from './types';\n\nconst DEFAULT_FEATURE_FILL_COLOR = '#ffffff';\nconst DEFAULT_BACKGROUND_COLOR = '#ffffff';\n// `chartPackages` replaces (not extends) react-google-charts' default `[ 'corechart', 'controls' ]`,\n// so we restate the defaults and add `geochart`. Without it the loader backfills the geochart package\n// late, which can clash with another Google Charts version already loaded on the page.\nconst GEO_CHART_PACKAGES: GoogleChartPackages[] = [ 'corechart', 'controls', 'geochart' ];\n\ntype GoogleChartOptions = Record< string, unknown >;\ntype GoogleChartErrorPayload = {\n\tid?: unknown;\n\tmessage?: unknown;\n\tdetailedMessage?: unknown;\n\toptions?: unknown;\n};\n\n// Google Charts renders draw errors as DOM elements injected into the chart\n// container: a wrapper `<div id=\"google-visualization-errors-all-N\">` holding\n// one `<span id=\"google-visualization-errors-N\">` per error. The span id is the\n// error id accepted by `google.visualization.errors.removeError()`.\nconst GOOGLE_CHARTS_ERROR_ID_PREFIX = 'google-visualization-errors-';\nconst GOOGLE_CHARTS_ERROR_WRAPPER_INFIX = '-all-';\n\n/**\n * Collects Google Charts error elements rendered inside a chart container.\n *\n * @param container - The chart container element to scan.\n * @return Errors found in the container, one per error span.\n */\nfunction collectRenderedGeoChartErrors(\n\tcontainer: HTMLElement\n): Required< Pick< GeoChartError, 'id' | 'message' > >[] {\n\tconst elements = container.querySelectorAll< HTMLElement >(\n\t\t`[id^=\"${ GOOGLE_CHARTS_ERROR_ID_PREFIX }\"]`\n\t);\n\n\treturn Array.from( elements )\n\t\t.filter( element => ! element.id.includes( GOOGLE_CHARTS_ERROR_WRAPPER_INFIX ) )\n\t\t.map( element => ( {\n\t\t\tid: element.id,\n\t\t\tmessage: element.textContent?.trim() ?? '',\n\t\t} ) )\n\t\t.filter( error => error.message.length > 0 );\n}\n\n/**\n * Whether a node added to the chart container is — or contains — a Google\n * Charts error element. Also matches text appended into an existing error\n * span, in case Google fills the message after inserting the element.\n *\n * @param node - The added DOM node to inspect.\n * @return Whether the node involves a Google Charts error element.\n */\nfunction involvesGeoChartErrorElement( node: Node ): boolean {\n\tif ( node.nodeType === Node.TEXT_NODE ) {\n\t\treturn !! node.parentElement?.id.startsWith( GOOGLE_CHARTS_ERROR_ID_PREFIX );\n\t}\n\n\tif ( ! ( node instanceof HTMLElement ) ) {\n\t\treturn false;\n\t}\n\n\treturn (\n\t\tnode.id.startsWith( GOOGLE_CHARTS_ERROR_ID_PREFIX ) ||\n\t\tnode.querySelector( `[id^=\"${ GOOGLE_CHARTS_ERROR_ID_PREFIX }\"]` ) !== null\n\t);\n}\n\n/**\n * Normalizes the raw Google Charts error event into the GeoChart error shape.\n *\n * @param eventArgs - Error event payload from react-google-charts.\n * @return Normalized GeoChart error.\n */\nfunction normalizeGeoChartError( eventArgs: unknown ): GeoChartError {\n\tconst payload = Array.isArray( eventArgs ) ? eventArgs[ 0 ] : eventArgs;\n\n\tif ( ! payload || typeof payload !== 'object' ) {\n\t\treturn {};\n\t}\n\n\tconst { id, message, detailedMessage, options } = payload as GoogleChartErrorPayload;\n\n\treturn {\n\t\t...( typeof id === 'string' && { id } ),\n\t\t...( typeof message === 'string' && { message } ),\n\t\t...( typeof detailedMessage === 'string' && { detailedMessage } ),\n\t\t...( options &&\n\t\t\ttypeof options === 'object' &&\n\t\t\t! Array.isArray( options ) && { options: options as Record< string, unknown > } ),\n\t};\n}\n\n/**\n * Renders a geographical chart using Google Charts GeoChart to visualize data.\n *\n * Supports the full Google Charts data format including custom tooltips, formatted values,\n * and multiple data columns for maximum flexibility.\n *\n * Locations can be identified by full name (e.g., 'United States', 'California') or codes\n * (e.g., 'US', 'US-CA'). Full names are recommended for better readability in tooltips.\n *\n * @param props - The props for the GeoChart component\n * @param props.data - Data in Google Charts format (array of arrays with headers)\n * @param props.width - Width of the chart in pixels\n * @param props.height - Height of the chart in pixels\n * @param props.region - Region to display ('world', 'US', or ISO 3166-1 alpha-2 code)\n * @param props.resolution - Resolution level ('countries', 'provinces', or 'metros')\n * @param props.onError - Optional callback for Google Charts errors\n * @param props.className - Additional CSS class name for the chart container\n * @param props.renderPlaceholder - Optional render function for the loading placeholder\n * @return A React component displaying an interactive map with data visualization\n */\nconst GeoChartInternal: FC< GeoChartProps > = ( {\n\tclassName,\n\tdata,\n\twidth,\n\theight,\n\tregion = 'world',\n\tresolution = 'countries',\n\tonError,\n\trenderPlaceholder,\n} ) => {\n\tconst {\n\t\tgetElementStyles,\n\t\ttheme: {\n\t\t\tgeoChart: { featureFillColor },\n\t\t\tbackgroundColor,\n\t\t},\n\t} = useGlobalChartsContext();\n\tconst scopeElement = useChartScopeElement();\n\tconst containerRef = useRef< HTMLDivElement >( null );\n\tconst reportedErrorIdsRef = useRef< Set< string > >( new Set() );\n\n\t// The ChartWrapper `error` event does not fire for every draw failure —\n\t// notably not when GeoChart's asynchronous map-file load fails (e.g.\n\t// `resolution: 'provinces'` for a country without a provinces map). Those\n\t// errors only surface as DOM elements Google injects into the container, so\n\t// watch the container and report them through the same `onError` callback.\n\tuseEffect( () => {\n\t\tconst container = containerRef.current;\n\n\t\tif ( ! onError || ! container || typeof MutationObserver === 'undefined' ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst reportRenderedErrors = () => {\n\t\t\tfor ( const error of collectRenderedGeoChartErrors( container ) ) {\n\t\t\t\tif ( reportedErrorIdsRef.current.has( error.id ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\treportedErrorIdsRef.current.add( error.id );\n\t\t\t\tonError( error );\n\t\t\t}\n\t\t};\n\n\t\t// GeoChart mutates the container heavily while drawing and resizing;\n\t\t// only rescan when an added node involves a Google error element.\n\t\tconst observer = new MutationObserver( records => {\n\t\t\tconst hasErrorNodes = records.some( record =>\n\t\t\t\tArray.from( record.addedNodes ).some( involvesGeoChartErrorElement )\n\t\t\t);\n\n\t\t\tif ( hasErrorNodes ) {\n\t\t\t\treportRenderedErrors();\n\t\t\t}\n\t\t} );\n\t\tobserver.observe( container, { childList: true, subtree: true } );\n\t\t// Report errors already rendered before the observer attached.\n\t\treportRenderedErrors();\n\n\t\treturn () => observer.disconnect();\n\t}, [ onError ] );\n\n\t// Render loading placeholder\n\tconst loadingPlaceholder = (\n\t\t<Center\n\t\t\tclassName={ clsx( 'geo-chart', styles.container, className ) }\n\t\t\tdata-testid=\"geo-chart-loading\"\n\t\t\tstyle={ { width, height } }\n\t\t>\n\t\t\t{ renderPlaceholder ? renderPlaceholder() : __( 'Loading map', 'jetpack-charts' ) }\n\t\t</Center>\n\t);\n\n\t// Google charts doesn't accept CSS variables, so we need to convert them to hex colors\n\tconst fullColorHex = getElementStyles( { index: 0 } ).color;\n\tconst lightColorHex = lightenHexColor( fullColorHex, 0.8 );\n\t// Use normalizeColorToHex to ensure HSL/RGB values from CSS variables are converted to hex. Google Charts takes a resolved-hex snapshot at render, so this does not live-update on a theme change without a re-render — an accepted asymmetry vs CSS-painted elements.\n\tconst backgroundColorHex =\n\t\tnormalizeColorToHex( backgroundColor, scopeElement, resolveCssVariable ) ||\n\t\tDEFAULT_BACKGROUND_COLOR;\n\tconst defaultFillColorHex =\n\t\tnormalizeColorToHex( featureFillColor, scopeElement, resolveCssVariable ) ||\n\t\tDEFAULT_FEATURE_FILL_COLOR;\n\n\t// Identify HTML tooltip column indices and sanitize their content to prevent XSS.\n\tconst sanitizedData = useMemo( () => {\n\t\tif ( data.length === 0 ) {\n\t\t\treturn { data, hasHtmlTooltips: false };\n\t\t}\n\n\t\tconst htmlTooltipIndices: number[] = [];\n\t\tfor ( let i = 0; i < data[ 0 ].length; i++ ) {\n\t\t\tconst col = data[ 0 ][ i ];\n\t\t\tif (\n\t\t\t\ttypeof col === 'object' &&\n\t\t\t\tcol !== null &&\n\t\t\t\t'role' in col &&\n\t\t\t\tcol.role === 'tooltip' &&\n\t\t\t\t'p' in col &&\n\t\t\t\ttypeof col.p === 'object' &&\n\t\t\t\tcol.p !== null &&\n\t\t\t\t'html' in col.p &&\n\t\t\t\tcol.p.html === true\n\t\t\t) {\n\t\t\t\thtmlTooltipIndices.push( i );\n\t\t\t}\n\t\t}\n\n\t\tif ( htmlTooltipIndices.length === 0 ) {\n\t\t\treturn { data, hasHtmlTooltips: false };\n\t\t}\n\n\t\t// Sanitize HTML content in tooltip columns for data rows (skip header row)\n\t\tconst sanitizedRows = data.slice( 1 ).map( row => {\n\t\t\tconst newRow = [ ...row ];\n\t\t\tfor ( const colIndex of htmlTooltipIndices ) {\n\t\t\t\tif ( typeof newRow[ colIndex ] === 'string' ) {\n\t\t\t\t\tnewRow[ colIndex ] = sanitizeHtml( newRow[ colIndex ] as string );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn newRow;\n\t\t} );\n\n\t\treturn {\n\t\t\tdata: [ data[ 0 ], ...sanitizedRows ] as typeof data,\n\t\t\thasHtmlTooltips: true,\n\t\t};\n\t}, [ data ] );\n\n\tconst options: GoogleChartOptions = useMemo(\n\t\t() => ( {\n\t\t\t...( region !== 'world' && { region } ),\n\t\t\t...( resolution !== 'countries' && { resolution } ),\n\t\t\tcolorAxis: { colors: [ lightColorHex, fullColorHex ] },\n\t\t\tbackgroundColor: backgroundColorHex,\n\t\t\tdatalessRegionColor: defaultFillColorHex,\n\t\t\tdefaultColor: defaultFillColorHex,\n\t\t\ttooltip: { trigger: 'focus', isHtml: sanitizedData.hasHtmlTooltips },\n\t\t\tlegend: 'none',\n\t\t\tkeepAspectRatio: true,\n\t\t} ),\n\t\t[\n\t\t\tregion,\n\t\t\tresolution,\n\t\t\tlightColorHex,\n\t\t\tfullColorHex,\n\t\t\tbackgroundColorHex,\n\t\t\tdefaultFillColorHex,\n\t\t\tsanitizedData.hasHtmlTooltips,\n\t\t]\n\t);\n\n\tconst chartEvents = useMemo< ReactGoogleChartEvent[] | undefined >( () => {\n\t\tif ( ! onError ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn [\n\t\t\t{\n\t\t\t\teventName: 'error',\n\t\t\t\tcallback: ( { eventArgs } ) => {\n\t\t\t\t\tonError( normalizeGeoChartError( eventArgs ) );\n\t\t\t\t},\n\t\t\t},\n\t\t];\n\t}, [ onError ] );\n\n\treturn (\n\t\t<Center\n\t\t\tref={ containerRef }\n\t\t\tclassName={ clsx( 'geo-chart', styles.container, className ) }\n\t\t\tdata-testid=\"geo-chart\"\n\t\t\tstyle={ { width, height, backgroundColor } }\n\t\t>\n\t\t\t<Chart\n\t\t\t\tchartType=\"GeoChart\"\n\t\t\t\tchartPackages={ GEO_CHART_PACKAGES }\n\t\t\t\twidth={ width }\n\t\t\t\theight={ height }\n\t\t\t\tdata={ sanitizedData.data }\n\t\t\t\toptions={ options }\n\t\t\t\tchartEvents={ chartEvents }\n\t\t\t\tloader={ loadingPlaceholder }\n\t\t\t/>\n\t\t</Center>\n\t);\n};\n\nconst GeoChartWithProvider: FC< GeoChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, don't create a new one\n\tif ( existingContext ) {\n\t\treturn <GeoChartInternal { ...props } />;\n\t}\n\n\t// Otherwise, create our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<GeoChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nGeoChartWithProvider.displayName = 'GeoChart';\n\nconst GeoChartResponsive = withResponsive< GeoChartProps >( GeoChartWithProvider );\n\nexport { GeoChartResponsive as default, GeoChartWithProvider as GeoChartUnresponsive };\n","import type {\n\tCircleSubjectProps,\n\tConnectorProps,\n\tLabelProps,\n\tLineSubjectProps,\n} from '@visx/annotation';\nimport type { AxisScale, Orientation, TickFormatter, AxisRendererProps } from '@visx/axis';\nimport type { ScaleInput, ScaleType } from '@visx/scale';\nimport type { TextProps } from '@visx/text';\nimport type { EventHandlerParams, GlyphProps, GridStyles, LineStyles } from '@visx/xychart';\nimport type {\n\tComponentClass,\n\tCSSProperties,\n\tFC,\n\tMouseEvent,\n\tPointerEvent,\n\tReactElement,\n\tReactNode,\n} from 'react';\n\ntype ValueOf< T > = T[ keyof T ];\n\nexport type Optional< T, K extends keyof T > = Pick< Partial< T >, K > & Omit< T, K >;\n\n/**\n * Mirrors the WordPress Design System gap token scale used by the WordPress UI Stack.\n */\nexport type GapSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';\n\nexport type LegendShapeLabel< Data, Output, ExtraAttributes = object > = {\n\tdatum: Data;\n\tindex: number;\n\ttext: string;\n\tvalue?: Output;\n} & ExtraAttributes;\n\nexport type LegendShapeRenderProps< Data, Output > = {\n\twidth?: string | number;\n\theight?: string | number;\n\tlabel: LegendShapeLabel< Data, Output >;\n\titem: Data;\n\titemIndex: number;\n\tfill?: string;\n\tsize?: string | number;\n\tstyle?: CSSProperties;\n};\n\nexport type LegendShape< Data, Output > =\n\t| 'rect'\n\t| 'circle'\n\t| 'line'\n\t| FC< LegendShapeRenderProps< Data, Output > >\n\t| ComponentClass< LegendShapeRenderProps< Data, Output > >;\n\nexport type GoogleDataTableColumnType =\n\t| 'string'\n\t| 'number'\n\t| 'boolean'\n\t| 'date'\n\t| 'datetime'\n\t| 'timeofday';\n\nexport enum GoogleDataTableColumnRoleType {\n\tannotation = 'annotation',\n\tannotationText = 'annotationText',\n\tcertainty = 'certainty',\n\temphasis = 'emphasis',\n\tinterval = 'interval',\n\tscope = 'scope',\n\tstyle = 'style',\n\ttooltip = 'tooltip',\n\tdomain = 'domain',\n}\n\nexport type GoogleDataTableColumn =\n\t| {\n\t\t\ttype: GoogleDataTableColumnType;\n\t\t\tlabel?: string;\n\t\t\trole?: GoogleDataTableColumnRoleType;\n\t\t\tpattern?: string;\n\t\t\tp?: Record< string, unknown >;\n\t\t\tid?: string;\n\t }\n\t| string;\n\nexport type GoogleDataTableCell =\n\t| {\n\t\t\tv?: unknown;\n\t\t\tf?: string;\n\t\t\tp?: Record< string, unknown >;\n\t }\n\t| string\n\t| number\n\t| boolean\n\t| Date\n\t| null;\n\nexport type GoogleDataTableRow = GoogleDataTableCell[];\n\nexport type ChartType =\n\t| 'area'\n\t| 'bar'\n\t| 'conversion-funnel'\n\t| 'leaderboard'\n\t| 'line'\n\t| 'pie'\n\t| 'pie-semi-circle';\n\nexport type OrientationType = ValueOf< typeof Orientation >;\n\nexport type AnnotationStyles = {\n\tcircleSubject?: Omit< CircleSubjectProps, 'x' | 'y' > & { fill?: string };\n\tlineSubject?: Omit< LineSubjectProps, 'x' | 'y' >;\n\tconnector?: Omit< ConnectorProps, 'x' | 'y' | 'dx' | 'dy' >;\n\tlabel?: Omit< LabelProps, 'title' | 'subtitle' | 'x' | 'y' > & {\n\t\tx?: number | 'start' | 'end';\n\t\ty?: number | 'start' | 'end';\n\t};\n};\n\nexport type DataPoint = {\n\tlabel: string;\n\tvalue: number;\n};\n\n/**\n * Data format for GeoChart - uses Google Charts native data format for maximum flexibility.\n * First element is the header row, subsequent elements are data rows.\n *\n * Country identifiers can be either full country names or ISO 3166-1 alpha-2 codes (e.g., 'United States' or 'US').\n * Full names are recommended for better readability in tooltips.\n *\n * @example Basic usage with country names:\n * [['Country', 'Value'], ['United States', 100], ['Canada', 50], ['United Kingdom', 75]]\n *\n * @example With custom HTML tooltips:\n * [\n * ['Country', 'Value', { type: 'string', role: 'tooltip', p: { html: true } }],\n * ['United States', 100, '<b>United States</b><br/>100 visitors'],\n * ['Canada', 50, '<b>Canada</b><br/>50 visitors']\n * ]\n *\n * @example With formatted values (v = value, f = formatted):\n * [\n * ['Country', 'Value'],\n * ['United States', { v: 100, f: '100 visitors' }],\n * ['Canada', { v: 50, f: '50 visitors' }]\n * ]\n *\n * @example With multiple columns:\n * [\n * ['Country', 'Population', 'Area'],\n * ['United States', 331000000, 9834000],\n * ['Canada', 38000000, 9985000]\n * ]\n */\nexport type GeoData = [ GoogleDataTableColumn[], ...GoogleDataTableRow[] ];\n\nexport type DataPointDate = {\n\tdate?: Date;\n\t/**\n\t * Supported Formats:\n\t * - YYYY-MM-DD (local)\n\t * - YYYY-MM-DD HH:mm:ss (local)\n\t * - YYYY-MM-DD HH:mm (local)\n\t * - YYYY-MM-DDTHH:mm:ss (local)\n\t * - YYYY-MM-DDTHH:mm:ss.SSS (local)\n\t * - YYYY-MM-DDTHH:mm (local)\n\t * - YYYY-MM-DDTHH:mm:ssZ (UTC → local)\n\t * - YYYY-MM-DDTHH:mm:ss±HH:mm (offset → local)\n\t */\n\tdateString?: string;\n\tvalue: number | null;\n\tlabel?: string;\n};\n\nexport type LeaderboardEntry = {\n\t/**\n\t * Unique internal key (e.g., 'key-direct')\n\t */\n\tid: string;\n\n\t/**\n\t * Human-readable name (e.g., 'Direct') or a JSX element (e.g., <h4>Direct</h4>)\n\t */\n\tlabel: string | ReactElement;\n\n\t/**\n\t * Value of the entry\n\t */\n\tcurrentValue: number;\n\n\t/**\n\t * Value of the entry in the previous period. Omit when this row has no\n\t * matching comparison-period value.\n\t */\n\tpreviousValue?: number;\n\n\t/**\n\t * Width of current bar, as % of the current value\n\t */\n\tcurrentShare: number;\n\n\t/**\n\t * Width of previous bar, as % of the current value. Omit when this row has\n\t * no matching comparison-period value.\n\t */\n\tpreviousShare?: number;\n\n\t/**\n\t * Delta of the entry. Omit when the percentage change is unavailable, such\n\t * as when the row has no comparison value or its previous value is zero.\n\t */\n\tdelta?: number;\n\n\t/**\n\t * Optional color for the entry's image/icon\n\t */\n\timageColor?: string;\n\n\t/**\n\t * Optional click handler. When provided, the entire row becomes an\n\t * interactive `<button>`: clickable and keyboard-focusable (Enter/Space),\n\t * with a chevron affordance revealed on hover/focus. The consumer\n\t * decides what the action does (e.g. drill-down). Rows without onClick are\n\t * inert and render unchanged.\n\t *\n\t * For links or other interactive affordances (external-link icons, info\n\t * tooltips), put them in the `label` render prop instead of using onClick —\n\t * a row is either a button (onClick) or carries interactive label content,\n\t * never both, since interactive elements cannot be nested in HTML.\n\t */\n\tonClick?: ( event: MouseEvent< HTMLButtonElement > ) => void;\n\n\t/**\n\t * Optional accessible name for the interactive row's `<button>`. Only applies\n\t * when `onClick` is set — without it the row renders as a Fragment with no\n\t * element to receive `aria-label`. By default the button derives its name from\n\t * its rendered content (label text plus the formatted value), which is the\n\t * right outcome for plain-text labels. Set this when the `label` is JSX whose\n\t * text content does not yield a clean name on its own — e.g. an image-only\n\t * label — to give assistive tech a deterministic, human-readable name.\n\t */\n\tariaLabel?: string;\n};\n\nexport type GradientStop = {\n\toffset: string;\n\tcolor?: string;\n\topacity?: number;\n};\n\nexport type SeriesDataOptions = {\n\tgradient?: {\n\t\tfrom?: string;\n\t\tto?: string;\n\t\tfromOpacity?: number;\n\t\ttoOpacity?: number;\n\t\tstops?: GradientStop[];\n\t};\n\tstroke?: string;\n\tseriesLineStyle?: LineStyles;\n\tlegendShapeStyle?: CSSProperties;\n\ttype?: 'comparison';\n};\n\nexport type SeriesData = {\n\tgroup?: string;\n\tlabel: string;\n\tdata: DataPointDate[] | DataPoint[];\n\toptions?: SeriesDataOptions;\n};\n\n/**\n * Visual styling for a bar series of a given semantic type (e.g. 'comparison').\n * `widthFactor` is the bar width relative to the primary bar slot (1.5 = 150%);\n * `opacity` sets the shadow translucency.\n */\nexport type BarStyles = {\n\twidthFactor?: number;\n\topacity?: number;\n};\n\nexport type MultipleDataPointsDate = {\n\tlabel: string;\n\tdata: DataPointDate[];\n};\n\n/**\n * Input data point for percentage-based charts (pie, donut, semi-circle).\n * Provide values; percentages will be calculated automatically.\n */\nexport type DataPointPercentage = {\n\t/**\n\t * Label for the data point\n\t */\n\tlabel: string;\n\t/**\n\t * Numerical value used for slice sizing.\n\t * Percentages are calculated automatically from values.\n\t */\n\tvalue: number;\n\t/**\n\t * Formatted value for display (e.g., \"30K\" instead of 30000)\n\t */\n\tvalueDisplay?: string;\n\t/**\n\t * Color code for the segment, by default colours are taken from the theme but this property can overrides it\n\t */\n\tcolor?: string;\n\t/**\n\t * Group for the data point, used to match color with groups on other charts\n\t */\n\tgroup?: string;\n};\n\n/**\n * Internal type with calculated percentage.\n * Used internally after percentage calculation from values.\n */\nexport type DataPointPercentageCalculated = DataPointPercentage & {\n\t/**\n\t * Calculated percentage (0-100) based on value relative to total\n\t */\n\tpercentage: number;\n};\n\n/**\n * Base theme configuration for chart components with optional properties\n */\nexport type ChartTheme = {\n\t/** Background color for chart components */\n\tbackgroundColor: string;\n\t/** Background color for labels */\n\tlabelBackgroundColor?: string;\n\t/** Text color for labels */\n\tlabelTextColor?: string;\n\t/** Array of colors used for data visualization */\n\tcolors: string[];\n\t/** Optional CSS styles for grid lines */\n\tgridStyles?: GridStyles;\n\t/** Length of axis ticks in pixels */\n\ttickLength: number;\n\t/** Color of the grid lines */\n\tgridColor: string;\n\t/** Color of the grid lines in dark mode */\n\tgridColorDark: string;\n\t/** Styles for x-axis tick lines */\n\txTickLineStyles?: LineStyles;\n\t/** Styles for x-axis line */\n\txAxisLineStyles?: LineStyles;\n\t/** Styles for series lines */\n\tseriesLineStyles?: LineStyles[];\n\t/** Array of render functions for glyphs */\n\tglyphs?: Array< < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode >;\n\t/** Legend specific settings */\n\tlegend?: {\n\t\t/** Styles for legend shapes */\n\t\tshapeStyles?: Record< string, unknown >[];\n\t\t/** Styles for legend labels */\n\t\tlabelStyles?: CSSProperties;\n\t\t/** Styles for legend container */\n\t\tcontainerStyles?: CSSProperties;\n\t};\n\t/** Styles for small SVG text (eg. axis tick labels), passed through to the XYChart theme. */\n\tsvgLabelSmall?: TextProps;\n\t/** Styles for large SVG text (eg. axis titles), passed through to the XYChart theme. */\n\tsvgLabelBig?: TextProps;\n\tannotationStyles?: AnnotationStyles;\n\t/** GeoChart specific settings */\n\tgeoChart?: {\n\t\t/** Default fill color for a geo chart feature (e.g. country) with no data */\n\t\tfeatureFillColor?: string;\n\t};\n\t/** LeaderboardChart specific settings */\n\tleaderboardChart?: {\n\t\t/** Gap between rows in the leaderboard grid */\n\t\trowGap?: number;\n\t\t/** Gap between columns in the leaderboard grid */\n\t\tcolumnGap?: number;\n\t\t/** Spacing between label and progress bars */\n\t\tlabelSpacing?: GapSize;\n\t\t/** Primary color for current period bars */\n\t\tprimaryColor?: string;\n\t\t/** Secondary color for comparison period bars */\n\t\tsecondaryColor?: string;\n\t\t/** Delta colors: [negative, neutral, positive] */\n\t\tdeltaColors?: [ string, string, string ];\n\t};\n\t/** ConversionFunnelChart specific settings */\n\tconversionFunnelChart?: {\n\t\t/** Primary color for funnel bars */\n\t\tprimaryColor?: string;\n\t\t/** Background color for chart container */\n\t\tbackgroundColor?: string;\n\t\t/** Color for positive change indicators */\n\t\tpositiveChangeColor?: string;\n\t\t/** Color for negative change indicators */\n\t\tnegativeChangeColor?: string;\n\t};\n\tlineChart?: {\n\t\tlineStyles?: Partial< Record< NonNullable< SeriesDataOptions[ 'type' ] >, LineStyles > >;\n\t};\n\tbarChart?: {\n\t\tbarStyles?: Partial< Record< NonNullable< SeriesDataOptions[ 'type' ] >, BarStyles > >;\n\t};\n\t/** Sparkline specific settings */\n\tsparkline?: {\n\t\t/** Margin around the sparkline chart */\n\t\tmargin?: {\n\t\t\ttop?: number;\n\t\t\tright?: number;\n\t\t\tbottom?: number;\n\t\t\tleft?: number;\n\t\t};\n\t\t/** Stroke width for the sparkline line */\n\t\tstrokeWidth?: number;\n\t};\n\t/**\n\t * HeatmapChart settings. Cell gap, radius, value size and the selection ring come from\n\t * WPDS tokens in CSS, so only the scale color and the compact sizing live here.\n\t */\n\theatmapChart?: {\n\t\t/**\n\t\t * Color the cell scale interpolates toward at the highest value (prop > this >\n\t\t * palette `colors[0]`), fed to CSS `color-mix`. Omit to use the palette color.\n\t\t */\n\t\tprimaryColor?: string;\n\t\t/** Gap in px between cells in compact mode */\n\t\tcompactCellGap?: number;\n\t\t/** Fixed square cell size in px for compact mode */\n\t\tcompactCellSize?: number;\n\t};\n};\n\n/**\n * Theme configuration with all properties guaranteed to be defined.\n * Useful for merged themes where defaults are provided for all optional properties.\n */\nexport type CompleteChartTheme = Required< ChartTheme > & {\n\tleaderboardChart: Omit<\n\t\tRequired< NonNullable< ChartTheme[ 'leaderboardChart' ] > >,\n\t\t'primaryColor' | 'secondaryColor'\n\t> &\n\t\tPick< NonNullable< ChartTheme[ 'leaderboardChart' ] >, 'primaryColor' | 'secondaryColor' >;\n\tconversionFunnelChart: Omit<\n\t\tRequired< NonNullable< ChartTheme[ 'conversionFunnelChart' ] > >,\n\t\t'primaryColor'\n\t> &\n\t\tPick< NonNullable< ChartTheme[ 'conversionFunnelChart' ] >, 'primaryColor' >;\n\tlineChart: {\n\t\tlineStyles: Record< NonNullable< SeriesDataOptions[ 'type' ] >, LineStyles >;\n\t};\n\tbarChart: {\n\t\tbarStyles: Record< NonNullable< SeriesDataOptions[ 'type' ] >, BarStyles >;\n\t};\n\tlegend: Required< NonNullable< ChartTheme[ 'legend' ] > >;\n\tsparkline: Required< NonNullable< ChartTheme[ 'sparkline' ] > > & {\n\t\tmargin: Required< NonNullable< ChartTheme[ 'sparkline' ] >[ 'margin' ] >;\n\t};\n\theatmapChart: Omit< Required< NonNullable< ChartTheme[ 'heatmapChart' ] > >, 'primaryColor' > &\n\t\tPick< NonNullable< ChartTheme[ 'heatmapChart' ] >, 'primaryColor' >;\n};\n\n/**\n * Bucket resolution of time-series data, as known by the caller (e.g. a\n * granularity selector), for consumers that don't need to infer it.\n */\nexport type TickResolution = 'hour' | 'day' | 'week' | 'month' | 'year';\n\nexport type AxisOptions = {\n\torientation?: OrientationType;\n\tnumTicks?: number;\n\t/**\n\t * Explicit tick values for the axis. When set, takes precedence over `numTicks`\n\t * so callers can force a specific axis (e.g. integer-only steps on a sparse chart).\n\t */\n\ttickValues?: ScaleInput< AxisScale >[];\n\taxisClassName?: string;\n\taxisLineClassName?: string;\n\tlabelClassName?: string;\n\ttickClassName?: string;\n\ttickFormat?: TickFormatter< ScaleInput< AxisScale > >;\n\t/**\n\t * Bucket resolution of the data, set on whichever axis carries the dates.\n\t * When set, the automatic tick formatter derives tick formats from it\n\t * directly instead of inferring the resolution from point spacing. For\n\t * daily-or-finer buckets the overall time span still constrains the choice —\n\t * e.g. hourly buckets spanning more than a week get date ticks, since hour\n\t * ticks would be unreadable at that span. Ignored when `tickFormat` is set.\n\t */\n\ttickResolution?: TickResolution;\n\t/**\n\t * Whether to display this axis. Defaults to true.\n\t */\n\tdisplay?: boolean;\n\t/**\n\t * For more control over rendering or to add event handlers to datum, pass a function as children.\n\t */\n\tchildren?: ( renderProps: AxisRendererProps< AxisScale > ) => ReactNode;\n\t/**\n\t * Controls tick label overflow (bar charts only):\n\t *\n\t * - 'ellipsis': Truncate with ellipsis and fit to available space. Labels show full text\n\t * on hover via native tooltip. Note: A minimum width (20px) is enforced for readability.\n\t * On very dense charts (bandwidth < 20px), adjacent labels may overlap. To mitigate, use `numTicks`\n\t * to reduce labels or `tickFormat` to abbreviate text.\n\t * - undefined: No truncation; labels may overlap.\n\t *\n\t * Default: No truncation; labels may overlap.\n\t */\n\tlabelOverflow?: 'ellipsis';\n};\n\nexport type ScaleOptions = {\n\ttype?: ScaleType;\n\tzero?: boolean;\n\t/**\n\t * Extends the scale's domain to nice round values. Pass `false` together with\n\t * an explicit `domain` to keep the tick values you set exactly.\n\t */\n\tnice?: boolean;\n\tdomain?: [ number, number ] | [ Date, Date ];\n\trange?: [ number, number ];\n\t/**\n\t * For band scale, shortcut for setting `paddingInner` and `paddingOuter` to the same value.\n\t *\n\t * For point scale, the outer padding (spacing) at the ends of the range.\n\t * This is similar to band scale's `paddingOuter`.\n\t *\n\t */\n\tpadding?: number;\n\t/**\n\t * The inner padding (spacing) within each band step of band scales, as a fraction of the step size. This value must lie in the range [0,1].\n\t *\n\t */\n\tpaddingInner?: number;\n\t/**\n\t * The outer padding (spacing) at the ends of the range of band and point scales,\n\t * as a fraction of the step size. This value must lie in the range [0,1].\n\t *\n\t */\n\tpaddingOuter?: number;\n};\n\nexport type LegendItemStyles = {\n\t/** Margin around each legend item. */\n\tmargin?: CSSProperties[ 'margin' ];\n\t/** Flex direction for items within each legend entry. */\n\tflexDirection?: 'row' | 'row-reverse' | 'column' | 'column-reverse';\n};\n\nexport type LegendLabelStyles = Pick< CSSProperties, 'justifyContent' | 'flex' | 'margin' > & {\n\t/**\n\t * Maximum width for legend label text as a CSS value (e.g. '200px', '50%', '10rem').\n\t * When set, text overflow behavior is controlled by textOverflow.\n\t */\n\tmaxWidth?: string;\n\t/**\n\t * Controls how text behaves when it exceeds maxWidth.\n\t * - 'ellipsis': Truncate with ellipsis (ideal for widgets/small devices)\n\t * - 'wrap': Wrap text to multiple lines (default, ideal for larger displays)\n\t */\n\ttextOverflow?: 'ellipsis' | 'wrap';\n};\n\nexport type LegendShapeStyles = {\n\t/** Width of the legend shape in pixels. */\n\twidth?: number;\n\t/** Height of the legend shape in pixels. */\n\theight?: number;\n\t/** Margin around the legend shape. */\n\tmargin?: CSSProperties[ 'margin' ];\n};\n\n/** Position of the legend relative to chart content. */\nexport type LegendPosition = 'top' | 'bottom';\n\n/**\n * Configuration object for chart legend appearance and behavior.\n * Consolidates all legend styling and layout props into a single structured object.\n */\nexport type ChartLegendConfig< T = DataPoint | DataPointDate | LeaderboardEntry > = {\n\t/**\n\t * Layout direction of legend items.\n\t */\n\torientation?: 'horizontal' | 'vertical';\n\t/**\n\t * Position of the legend relative to the chart.\n\t * TODO: Add 'left' | 'right' positioning support in future implementation\n\t */\n\tposition?: LegendPosition;\n\t/**\n\t * Alignment of the legend within its position.\n\t */\n\talignment?: 'start' | 'center' | 'end';\n\t/**\n\t * Shape of the legend marker icon.\n\t */\n\tshape?: LegendShape< T, number >;\n\t/**\n\t * Enable interactive legend items that can toggle series visibility.\n\t * Supported for all chart types that render series.\n\t * Requires chartId and GlobalChartsProvider.\n\t * For pie charts, percentages are recalculated so visible segments total 100%.\n\t */\n\tinteractive?: boolean;\n\t/**\n\t * Additional CSS class name for individual legend items.\n\t */\n\titemClassName?: string;\n\t/**\n\t * CSS styles for each legend item (margin, flexDirection).\n\t */\n\titemStyles?: LegendItemStyles;\n\t/**\n\t * CSS styles for legend labels (maxWidth, textOverflow, justifyContent, flex, margin).\n\t */\n\tlabelStyles?: LegendLabelStyles;\n\t/**\n\t * Styles for legend shapes (width, height, margin).\n\t */\n\tshapeStyles?: LegendShapeStyles;\n};\n\n/**\n * Legend config for charts built from `SeriesData` (line, bar, area). Adds `collapseGroups` on top\n * of the shared config. It is intentionally absent from the base `ChartLegendConfig` so point-based\n * charts (pie, semi-circle pie) — whose data points carry `group` only to coordinate colours — can't\n * set it.\n */\nexport type SeriesChartLegendConfig = ChartLegendConfig< SeriesData[] > & {\n\t/**\n\t * Collapse series that share a `group` into a single legend item, labelled by the group's\n\t * primary series (its first non-comparison member). Off by default, so every series keeps its\n\t * own item. Combines with `interactive`: a collapsed item toggles every series in its group, an\n\t * uncollapsed one toggles only its own.\n\t */\n\tcollapseGroups?: boolean;\n};\n\n/**\n * Initial visibility options for charts built from labelled series.\n */\nexport interface SeriesVisibilityProps {\n\t/**\n\t * Series labels to hide from the first defined value. User changes persist until\n\t * the chart remounts or its ID changes; later values for the same ID are ignored.\n\t * Omit to retain the provider's existing visibility for the chart ID.\n\t */\n\tdefaultHiddenSeries?: readonly string[];\n}\n\n/**\n * Base properties shared across all chart components\n */\nexport type BaseChartProps< T = DataPoint | DataPointDate | LeaderboardEntry > = {\n\t/**\n\t * Array of data points to display in the chart\n\t */\n\tdata: T extends DataPoint | DataPointDate | LeaderboardEntry ? T[] : T;\n\t/**\n\t * Optional unique identifier for the chart (auto-generated if not provided)\n\t */\n\tchartId?: string;\n\t/**\n\t * Additional CSS class name for the chart container\n\t */\n\tclassName?: string;\n\t/**\n\t * Width of the chart container in pixels. When omitted, the chart fills its parent's width.\n\t */\n\twidth?: number;\n\t/**\n\t * Height of the chart container in pixels. When omitted, the chart fills its parent's height.\n\t */\n\theight?: number;\n\t/**\n\t * Maximum diameter of the pie in pixels (pie and donut charts only).\n\t * The pie will shrink if the container is smaller than this value.\n\t * When omitted, the pie fills the available space.\n\t */\n\tsize?: number;\n\t/**\n\t * Chart margins\n\t */\n\tmargin?: {\n\t\ttop?: number;\n\t\tright?: number;\n\t\tbottom?: number;\n\t\tleft?: number;\n\t};\n\t/**\n\t * Callback function for pointer down event\n\t */\n\tonPointerDown?: ( event: EventHandlerParams< DataPoint | DataPointDate > ) => void;\n\t/**\n\t * Callback function for pointer up event\n\t */\n\tonPointerUp?: ( event: EventHandlerParams< DataPoint | DataPointDate > ) => void;\n\t/**\n\t * Callback function for pointer move event\n\t */\n\tonPointerMove?: ( event: EventHandlerParams< DataPoint | DataPointDate > ) => void;\n\t/**\n\t * Callback function for pointer out event\n\t */\n\tonPointerOut?: ( event: PointerEvent< Element > ) => void;\n\t/**\n\t * Whether to show tooltips on hover. False by default.\n\t */\n\twithTooltips?: boolean;\n\t/**\n\t * Whether to show legend\n\t */\n\tshowLegend?: boolean;\n\t/**\n\t * Legend configuration object for controlling legend appearance and behavior.\n\t * Includes orientation, position, alignment, shape, styling, and interactivity options.\n\t */\n\tlegend?: ChartLegendConfig< T >;\n\t/**\n\t * Grid visibility. x is default when orientation is vertical. y is default when orientation is horizontal.\n\t */\n\tgridVisibility?: 'x' | 'y' | 'xy' | 'none';\n\t/**\n\t * Whether to show chart animation on initial render or not\n\t */\n\tanimation?: boolean;\n\n\t/**\n\t * Gap between chart elements (SVG, legend, children).\n\t * Uses WordPress design system tokens.\n\t * @default 'md'\n\t */\n\tgap?: GapSize;\n\n\t/**\n\t * More options for the chart.\n\t */\n\toptions?: {\n\t\tyScale?: ScaleOptions;\n\t\txScale?: ScaleOptions;\n\t\taxis?: {\n\t\t\tx?: AxisOptions;\n\t\t\ty?: AxisOptions;\n\t\t};\n\t};\n};\n\n/**\n * Local type definitions for Popover API attributes and events\n * These are used to avoid extending React module types while still getting type safety\n * NOTE: These type definitions are only needed for React 18 and below.\n * React 19+ includes Popover API types in the official React type definitions, so these can be removed when upgrading.\n */\nexport interface PopoverButtonAttributes {\n\tpopovertarget?: string;\n\tpopovertargetaction?: 'hide' | 'show' | 'toggle';\n}\n\nexport interface PopoverElementAttributes {\n\tpopover?: 'auto' | 'manual' | '';\n}\n\n// Combined types for spreading into JSX elements\nexport type ButtonWithPopover = PopoverButtonAttributes;\nexport type PopoverElement = PopoverElementAttributes;\n\n// ToggleEvent for native Popover API\nexport interface ToggleEvent extends Event {\n\tnewState: 'open' | 'closed';\n\toldState: 'open' | 'closed';\n}\n","import type { HeatmapColumn } from '../types';\n\nexport const isPresent = ( value: number | null | undefined ): value is number =>\n\tvalue !== null && value !== undefined && ! isNaN( value );\n\n/**\n * Get the min and max values from heatmap data, ignoring null/NaN.\n * @param data - The heatmap columns\n * @return Tuple of [min, max] values\n */\nexport const getValueExtent = ( data: HeatmapColumn[] ): [ number, number ] => {\n\tlet min = Infinity;\n\tlet max = -Infinity;\n\tfor ( const column of data ) {\n\t\tfor ( const cell of column.data ) {\n\t\t\tif ( ! isPresent( cell.value ) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif ( cell.value < min ) {\n\t\t\t\tmin = cell.value;\n\t\t\t}\n\t\t\tif ( cell.value > max ) {\n\t\t\t\tmax = cell.value;\n\t\t\t}\n\t\t}\n\t}\n\tif ( min === Infinity ) {\n\t\treturn [ 0, 0 ];\n\t}\n\treturn [ min, max ];\n};\n\n/**\n * Normalize a value to 0–1 within the extent. A flat extent (min === max)\n * maps to 1 — every cell is equally the \"highest\" — except an all-zero\n * extent, which maps to 0 so a no-activity grid renders at the scale's\n * bottom instead of full intensity.\n *\n * @param value - The value to normalize\n * @param extent - Tuple of [min, max] values for the normalization range\n * @return Normalized value between 0 and 1\n */\nexport const getNormalizedValue = ( value: number, extent: [ number, number ] ): number => {\n\tconst [ min, max ] = extent;\n\tif ( min === max ) {\n\t\treturn max === 0 ? 0 : 1;\n\t}\n\treturn Math.min( 1, Math.max( 0, ( value - min ) / ( max - min ) ) );\n};\n","import { addDays, differenceInCalendarWeeks, format, parseISO, startOfWeek } from 'date-fns';\nimport type { DataPointDate } from '../../../types';\nimport type { HeatmapCell, HeatmapColumn } from '../types';\n\nexport type CalendarHeatmapResult = {\n\tdata: HeatmapColumn[];\n\trowLabels: string[];\n};\n\n/** Rows that get a weekday label (Mon, Wed, Fri with a Monday week start). */\nconst LABELLED_ROWS = [ 0, 2, 4 ];\n\n/**\n * Resolve one grid bound: an unparseable or narrowing value falls back to the\n * series' own bound, so the grid can only ever be widened.\n *\n * @param bound - Requested bound as `yyyy-MM-dd`, if any.\n * @param fallback - The series' own bound on this side.\n * @param direction - Which way the bound is allowed to move.\n * @return The bound to draw to.\n */\nconst widenTo = (\n\tbound: string | undefined,\n\tfallback: Date,\n\tdirection: 'earlier' | 'later'\n): Date => {\n\tif ( ! bound ) {\n\t\treturn fallback;\n\t}\n\n\tconst parsed = parseISO( bound );\n\tif ( isNaN( parsed.getTime() ) ) {\n\t\treturn fallback;\n\t}\n\n\tif ( direction === 'earlier' ) {\n\t\treturn parsed < fallback ? parsed : fallback;\n\t}\n\n\treturn parsed > fallback ? parsed : fallback;\n};\n\nconst toDate = ( point: DataPointDate ): Date | null => {\n\tif ( point.date instanceof Date && ! isNaN( point.date.getTime() ) ) {\n\t\treturn point.date;\n\t}\n\tif ( point.dateString ) {\n\t\tconst parsed = parseISO( point.dateString );\n\t\tif ( ! isNaN( parsed.getTime() ) ) {\n\t\t\treturn parsed;\n\t\t}\n\t}\n\treturn null;\n};\n\nexport const buildCalendarHeatmapData = (\n\tseries: DataPointDate[],\n\toptions: {\n\t\tweekStartsOn?: 0 | 1;\n\t\t/**\n\t\t * Mark the days completing the first/last week outside the series'\n\t\t * date span as hidden cells (empty grid slots) instead of blank\n\t\t * cells, giving the calendar ragged edges. Days inside the span stay\n\t\t * blank cells even when the series has no entry for them.\n\t\t */\n\t\thideOutOfRangeDays?: boolean;\n\t\t/**\n\t\t * Draw the grid over this span (`yyyy-MM-dd` bounds) instead of the\n\t\t * series' own. Days inside the grid but outside the series become\n\t\t * placeholder cells: painted as empty slots so a short series still\n\t\t * fills its container, but reporting nothing, since they were never\n\t\t * measured. A start bound is drawn from the beginning of its week, so\n\t\t * the grid always opens on a whole column. Bounds narrower than the\n\t\t * series are ignored — the grid never drops a day that carries data.\n\t\t */\n\t\tgridSpan?: { start?: string; end?: string };\n\t} = {}\n): CalendarHeatmapResult => {\n\tconst weekStartsOn = options.weekStartsOn ?? 1;\n\tconst hideOutOfRangeDays = options.hideOutOfRangeDays ?? true;\n\n\tconst entries = series\n\t\t.map( point => ( { date: toDate( point ), value: point.value } ) )\n\t\t.filter( ( entry ): entry is { date: Date; value: number | null } => entry.date !== null );\n\n\tif ( ! entries.length ) {\n\t\treturn { data: [], rowLabels: [] };\n\t}\n\n\tconst valueByDay = new Map< string, number | null >();\n\tlet minDate = entries[ 0 ].date;\n\tlet maxDate = entries[ 0 ].date;\n\tfor ( const { date, value } of entries ) {\n\t\tvalueByDay.set( format( date, 'yyyy-MM-dd' ), value );\n\t\tif ( date < minDate ) {\n\t\t\tminDate = date;\n\t\t}\n\t\tif ( date > maxDate ) {\n\t\t\tmaxDate = date;\n\t\t}\n\t}\n\n\t// Day-key bounds for the ragged-edge option: calendar-day comparison, so\n\t// entries carrying a time of day can't shift the span.\n\tconst minDayKey = format( minDate, 'yyyy-MM-dd' );\n\tconst maxDayKey = format( maxDate, 'yyyy-MM-dd' );\n\n\t// The grid may run wider than the series, never narrower: a bound that would\n\t// cut into the data is dropped rather than honoured.\n\tconst gridMinDate = widenTo( options.gridSpan?.start, minDate, 'earlier' );\n\tconst gridMaxDate = widenTo( options.gridSpan?.end, maxDate, 'later' );\n\n\tconst gridMaxDayKey = format( gridMaxDate, 'yyyy-MM-dd' );\n\n\tconst gridStart = startOfWeek( gridMinDate, { weekStartsOn } );\n\n\t// A start bound rarely lands on a week start, and `gridStart` rounds it down.\n\t// The days it rounds past were no more measured than the rest of the widened\n\t// span, so they are filler too; treating them as a ragged edge instead would\n\t// notch the first column by however far the bound sat into its week.\n\tconst gridMinDayKey = format( gridMinDate < minDate ? gridStart : gridMinDate, 'yyyy-MM-dd' );\n\tconst weekCount = differenceInCalendarWeeks( gridMaxDate, gridStart, { weekStartsOn } ) + 1;\n\n\tconst rowLabels = Array.from( { length: 7 }, ( _, row ) =>\n\t\tLABELLED_ROWS.includes( row ) ? format( addDays( gridStart, row ), 'EEE' ) : ''\n\t);\n\n\t// Hide short partial first-month labels when a later month follows; compact\n\t// cells make adjacent labels collide. Keep the label for single-month ranges.\n\tconst MIN_FIRST_MONTH_WEEKS = 2;\n\tconst firstMonth = gridStart.getMonth();\n\tlet firstMonthWeeks = 0;\n\twhile (\n\t\tfirstMonthWeeks < weekCount &&\n\t\taddDays( gridStart, firstMonthWeeks * 7 ).getMonth() === firstMonth\n\t) {\n\t\tfirstMonthWeeks++;\n\t}\n\tconst spansLaterMonth = firstMonthWeeks < weekCount;\n\tconst showFirstMonthLabel = ! spansLaterMonth || firstMonthWeeks >= MIN_FIRST_MONTH_WEEKS;\n\n\tconst data: HeatmapColumn[] = [];\n\tlet previousMonth = -1;\n\tfor ( let week = 0; week < weekCount; week++ ) {\n\t\tconst columnStart = addDays( gridStart, week * 7 );\n\t\tconst month = columnStart.getMonth();\n\t\tconst isNewMonth = month !== previousMonth;\n\t\tconst label =\n\t\t\tisNewMonth && ( week !== 0 || showFirstMonthLabel ) ? format( columnStart, 'MMM' ) : '';\n\t\tpreviousMonth = month;\n\n\t\tconst cells: HeatmapCell[] = [];\n\t\tfor ( let row = 0; row < 7; row++ ) {\n\t\t\tconst day = addDays( gridStart, week * 7 + row );\n\t\t\tconst key = format( day, 'yyyy-MM-dd' );\n\t\t\tconst cell: HeatmapCell = {\n\t\t\t\tlabel: format( day, 'EEE, MMM d, yyyy' ),\n\t\t\t\tvalue: valueByDay.has( key ) ? ( valueByDay.get( key ) as number | null ) : null,\n\t\t\t};\n\t\t\tif ( key < gridMinDayKey || key > gridMaxDayKey ) {\n\t\t\t\t// The days completing the grid's first/last week: the calendar's\n\t\t\t\t// ragged edge.\n\t\t\t\tif ( hideOutOfRangeDays ) {\n\t\t\t\t\tcell.hidden = true;\n\t\t\t\t}\n\t\t\t} else if ( key < minDayKey || key > maxDayKey ) {\n\t\t\t\t// Inside the grid the caller asked for, outside the series: filler.\n\t\t\t\tcell.placeholder = true;\n\t\t\t}\n\t\t\tcells.push( cell );\n\t\t}\n\t\tdata.push( { label, data: cells } );\n\t}\n\n\treturn { data, rowLabels };\n};\n","import { createContext } from 'react';\n\nexport type HeatmapContextValue = {\n\textent: [ number, number ];\n\t/** The resolved primary color (full intensity); the legend mixes toward it in CSS. */\n\tprimaryColorHex: string;\n};\n\n/** Shared by the chart and legend without importing back from `heatmap-chart.tsx`. */\nexport const HeatmapContext = createContext< HeatmapContextValue | null >( null );\n","import { __ } from '@wordpress/i18n';\nimport { Stack, Text } from '@wordpress/ui';\nimport { useContext } from 'react';\nimport { useGlobalChartsTheme } from '../../../providers';\nimport styles from '../heatmap-chart.module.scss';\nimport { HeatmapContext } from './heatmap-context';\nimport type { CSSProperties, FC } from 'react';\n\nexport interface HeatmapLegendProps {\n\t/** Number of swatches in the scale. Default 5. */\n\tsteps?: number;\n\tlessLabel?: string;\n\tmoreLabel?: string;\n}\n\nexport const HeatmapLegend: FC< HeatmapLegendProps > = ( { steps = 5, lessLabel, moreLabel } ) => {\n\tconst context = useContext( HeatmapContext );\n\tconst { legend, backgroundColor } = useGlobalChartsTheme();\n\tif ( ! context ) {\n\t\treturn null;\n\t}\n\tconst { primaryColorHex } = context;\n\tconst labelStyle = legend.labelStyles;\n\n\treturn (\n\t\t<Stack direction=\"row\" gap=\"xs\" align=\"center\">\n\t\t\t<Text variant=\"body-sm\" style={ labelStyle }>\n\t\t\t\t{ lessLabel ?? __( 'Less', 'jetpack-charts' ) }\n\t\t\t</Text>\n\t\t\t<Stack direction=\"row\" gap=\"xs\">\n\t\t\t\t{ Array.from( { length: steps }, ( _, index ) => {\n\t\t\t\t\tconst intensity = steps <= 1 ? 1 : index / ( steps - 1 );\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\tclassName={ styles[ 'heatmap-chart__legend-swatch' ] }\n\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'--a8c-charts-color-heatmap-primary': primaryColorHex,\n\t\t\t\t\t\t\t\t\t'--a8c-charts-color-heatmap-background': backgroundColor,\n\t\t\t\t\t\t\t\t\t'--a8c-charts-heatmap-cell-intensity': intensity,\n\t\t\t\t\t\t\t\t} as CSSProperties\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</Stack>\n\t\t\t<Text variant=\"body-sm\" style={ labelStyle }>\n\t\t\t\t{ moreLabel ?? __( 'More', 'jetpack-charts' ) }\n\t\t\t</Text>\n\t\t</Stack>\n\t);\n};\n","import { formatNumber, formatNumberCompact } from '@automattic/number-formatters';\nimport { useTooltip, useTooltipInPortal } from '@visx/tooltip';\nimport { __ } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';\nimport {\n\tGlobalChartsProvider,\n\tuseChartId,\n\tuseChartScopeElement,\n\tuseGlobalChartsContext,\n\tGlobalChartsContext,\n} from '../../providers';\nimport { CHART_SCOPE_CLASS } from '../../styles/chart-scope-class';\nimport { attachSubComponents } from '../../utils';\nimport {\n\tisValidHexColor,\n\tmixHexColors,\n\tnormalizeColorToHex,\n\tprefersLightText,\n} from '../../utils/color-utils';\nimport { resolveCssVariable } from '../../utils/resolve-css-var';\nimport { Center } from '../private/center';\nimport { useChartChildren } from '../private/chart-composition';\nimport { ChartInstanceContext } from '../private/chart-instance-context';\nimport { ChartLayout } from '../private/chart-layout';\nimport { withResponsive } from '../private/with-responsive';\nimport styles from './heatmap-chart.module.scss';\nimport {\n\tgetValueExtent,\n\tgetNormalizedValue,\n\tHeatmapContext,\n\tHeatmapLegend,\n\tisPresent,\n} from './private';\nimport type { HeatmapContextValue } from './private';\nimport type { HeatmapChartProps, HeatmapTooltipData } from './types';\nimport type { ResponsiveConfig } from '../private/with-responsive';\nimport type { CSSProperties, FC } from 'react';\n\n// Mirrors the color-mix floor in heatmap-chart.module.scss (.heatmap-chart__cell--filled):\n// the rendered fill is the primary mixed over the chart background at 0.15 + 0.85 * intensity.\nconst CELL_MIX_FLOOR = 0.15;\n\nconst HeatmapChartInternal: FC< HeatmapChartProps > = ( {\n\tdata,\n\tchartId: providedChartId,\n\twidth = 0,\n\theight = 0,\n\tclassName,\n\tcompact = false,\n\tshowValues,\n\tmaxCellWidth,\n\tmaxCellHeight,\n\tminCellWidth,\n\tminCellHeight,\n\trowLabels = [],\n\tprimaryColor,\n\tgap = 'md',\n\twithTooltips = false,\n\trenderTooltip,\n\tchildren,\n} ) => {\n\tconst chartId = useChartId( providedChartId );\n\tconst { getElementStyles, theme } = useGlobalChartsContext();\n\tconst scopeElement = useChartScopeElement();\n\tconst { heatmapChart: heatmapChartSettings } = theme;\n\tconst { nonLegendChildren } = useChartChildren( children, 'HeatmapChart' );\n\n\tconst [ selectedIndex, setSelectedIndex ] = useState< number | undefined >();\n\tconst { tooltipOpen, tooltipLeft, tooltipTop, tooltipData, showTooltip, hideTooltip } =\n\t\tuseTooltip< HeatmapTooltipData >();\n\tconst { containerRef, containerBounds, TooltipInPortal } = useTooltipInPortal( {\n\t\tdetectBounds: true,\n\t\tscroll: true,\n\t} );\n\t// Read from a ref so the keyboard-tooltip effect doesn't depend on containerBounds, which\n\t// is a new object each render and would loop the effect via showTooltip.\n\tconst containerBoundsRef = useRef( containerBounds );\n\tcontainerBoundsRef.current = containerBounds;\n\n\tconst { color: primaryColorHex } = getElementStyles( {\n\t\tindex: 0,\n\t\toverrideColor: primaryColor || heatmapChartSettings.primaryColor,\n\t} );\n\n\t// Resolve the background against this chart's own scope element (not the provider's), matching where `--a8c-charts-color-heatmap-background` is substituted for the cell blend below — a chart-level override otherwise disagrees with a provider-level read.\n\tconst chartBackgroundHex = normalizeColorToHex(\n\t\ttheme.backgroundColor,\n\t\tscopeElement,\n\t\tresolveCssVariable\n\t);\n\n\t// Choose text color from the blended fill, not the raw value.\n\t// If either color cannot resolve to hex, keep dark text.\n\tconst primaryHex = normalizeColorToHex( primaryColorHex );\n\tconst cellHasLightText = ( intensity: number ): boolean =>\n\t\tisValidHexColor( primaryHex ) &&\n\t\tisValidHexColor( chartBackgroundHex ) &&\n\t\tprefersLightText(\n\t\t\tmixHexColors(\n\t\t\t\tprimaryHex,\n\t\t\t\tchartBackgroundHex,\n\t\t\t\t1 - ( CELL_MIX_FLOOR + ( 1 - CELL_MIX_FLOOR ) * intensity )\n\t\t\t)\n\t\t);\n\n\tconst extent = useMemo( () => getValueExtent( data ), [ data ] );\n\tconst heatmapContext = useMemo< HeatmapContextValue >(\n\t\t() => ( { extent, primaryColorHex } ),\n\t\t[ extent, primaryColorHex ]\n\t);\n\n\tconst columns = data.length;\n\tconst rows = Math.max( 0, ...data.map( column => column.data.length ) );\n\n\tconst { compactCellGap, compactCellSize } = heatmapChartSettings;\n\tconst drawValues = showValues ?? ! compact;\n\n\tconst buildTooltipData = useCallback(\n\t\t( columnIndex: number, rowIndex: number ): HeatmapTooltipData => {\n\t\t\tconst cell = data[ columnIndex ]?.data[ rowIndex ];\n\t\t\treturn {\n\t\t\t\tvalue: cell?.value ?? null,\n\t\t\t\trowLabel: rowLabels[ rowIndex ],\n\t\t\t\tcolumnLabel: data[ columnIndex ]?.label,\n\t\t\t\tcellLabel: cell?.label,\n\t\t\t\trow: rowIndex,\n\t\t\t\tcolumn: columnIndex,\n\t\t\t};\n\t\t},\n\t\t[ data, rowLabels ]\n\t);\n\n\tconst onChartBlur = useCallback( () => {\n\t\tsetSelectedIndex( undefined );\n\t\thideTooltip();\n\t}, [ hideTooltip ] );\n\n\t// Both empty-slot kinds are skipped by navigation: `hidden` paints nothing,\n\t// `placeholder` paints an empty cell, and neither has a value to report.\n\tconst isCellInert = useCallback(\n\t\t( col: number, row: number ) => {\n\t\t\tconst cell = data[ col ]?.data[ row ];\n\t\t\treturn cell?.hidden === true || cell?.placeholder === true;\n\t\t},\n\t\t[ data ]\n\t);\n\n\tconst onChartKeyDown = useCallback(\n\t\t( event: React.KeyboardEvent< HTMLDivElement > ) => {\n\t\t\tif (\n\t\t\t\t! [ 'ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Escape', 'Tab' ].includes(\n\t\t\t\t\tevent.key\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( event.key === 'Tab' || event.key === 'Escape' ) {\n\t\t\t\tsetSelectedIndex( undefined );\n\t\t\t\thideTooltip();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tevent.preventDefault();\n\n\t\t\tif ( selectedIndex === undefined ) {\n\t\t\t\t// Start at the first navigable cell (a calendar's leading edge\n\t\t\t\t// slots may be hidden).\n\t\t\t\tfor ( let index = 0; index < columns * rows; index++ ) {\n\t\t\t\t\tif ( ! isCellInert( Math.floor( index / rows ), index % rows ) ) {\n\t\t\t\t\t\tsetSelectedIndex( index );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet stepCol = 0;\n\t\t\tlet stepRow = 0;\n\t\t\tif ( event.key === 'ArrowRight' ) {\n\t\t\t\tstepCol = 1;\n\t\t\t} else if ( event.key === 'ArrowLeft' ) {\n\t\t\t\tstepCol = -1;\n\t\t\t} else if ( event.key === 'ArrowDown' ) {\n\t\t\t\tstepRow = 1;\n\t\t\t} else if ( event.key === 'ArrowUp' ) {\n\t\t\t\tstepRow = -1;\n\t\t\t}\n\n\t\t\t// Step past hidden slots to the next navigable cell in the pressed\n\t\t\t// direction; when only hidden slots (or the edge) remain that way,\n\t\t\t// the selection stays put.\n\t\t\tlet col = Math.floor( selectedIndex / rows );\n\t\t\tlet row = selectedIndex % rows;\n\t\t\tdo {\n\t\t\t\tcol += stepCol;\n\t\t\t\trow += stepRow;\n\t\t\t} while ( col >= 0 && col < columns && row >= 0 && row < rows && isCellInert( col, row ) );\n\n\t\t\tif ( col < 0 || col >= columns || row < 0 || row >= rows ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsetSelectedIndex( col * rows + row );\n\t\t},\n\t\t[ rows, columns, selectedIndex, hideTooltip, isCellInert ]\n\t);\n\n\tconst handleCellMouseMove = useCallback(\n\t\t( event: React.MouseEvent< HTMLDivElement > ) => {\n\t\t\tif ( ! withTooltips ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst target = event.currentTarget;\n\t\t\tconst columnIndex = Number( target.dataset.column );\n\t\t\tconst rowIndex = Number( target.dataset.row );\n\t\t\t// Read bounds from the ref (like the keyboard-tooltip effect) so this\n\t\t\t// callback stays stable across renders.\n\t\t\tconst bounds = containerBoundsRef.current;\n\t\t\t// TooltipInPortal re-adds containerBounds, so subtract it to land at the cursor.\n\t\t\tshowTooltip( {\n\t\t\t\ttooltipLeft: event.clientX - bounds.left,\n\t\t\t\ttooltipTop: event.clientY - bounds.top,\n\t\t\t\ttooltipData: buildTooltipData( columnIndex, rowIndex ),\n\t\t\t} );\n\t\t},\n\t\t[ withTooltips, showTooltip, buildTooltipData ]\n\t);\n\n\tconst handleCellMouseLeave = useCallback( () => {\n\t\t// Keyboard selection owns the tooltip; don't let a mouse-out clear it.\n\t\tif ( withTooltips && selectedIndex === undefined ) {\n\t\t\thideTooltip();\n\t\t}\n\t}, [ withTooltips, selectedIndex, hideTooltip ] );\n\n\t// Anchor the tooltip at the selected cell's center on keyboard nav. Cleared on blur/Escape,\n\t// not here, so a mouse hover (no selection) isn't affected.\n\tuseEffect( () => {\n\t\tif ( ! withTooltips || selectedIndex === undefined ) {\n\t\t\treturn;\n\t\t}\n\t\tconst col = Math.floor( selectedIndex / rows );\n\t\tconst row = selectedIndex % rows;\n\t\tconst cell =\n\t\t\ttypeof document !== 'undefined'\n\t\t\t\t? document.getElementById( `${ chartId }-cell-${ col }-${ row }` )\n\t\t\t\t: null;\n\t\tconst rect = cell?.getBoundingClientRect();\n\t\tconst bounds = containerBoundsRef.current;\n\t\tshowTooltip( {\n\t\t\ttooltipLeft: rect ? rect.left + rect.width / 2 - bounds.left : 0,\n\t\t\ttooltipTop: rect ? rect.top + rect.height / 2 - bounds.top : 0,\n\t\t\ttooltipData: buildTooltipData( col, row ),\n\t\t} );\n\t}, [ selectedIndex, withTooltips, rows, chartId, buildTooltipData, showTooltip ] );\n\n\tconst defaultRenderTooltip = useCallback(\n\t\t( info: HeatmapTooltipData ) => (\n\t\t\t<div>\n\t\t\t\t<strong>\n\t\t\t\t\t{ info.cellLabel || `${ info.columnLabel ?? '' } ${ info.rowLabel ?? '' }`.trim() }\n\t\t\t\t</strong>\n\t\t\t\t<div>\n\t\t\t\t\t{ info.value === null ? __( 'No data', 'jetpack-charts' ) : formatNumber( info.value ) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t),\n\t\t[]\n\t);\n\n\tif ( ! columns || ! rows ) {\n\t\treturn (\n\t\t\t<Center\n\t\t\t\tclassName={ clsx( 'heatmap-chart', styles[ 'heatmap-chart' ], className ) }\n\t\t\t\tstyle={ { width: width || undefined, height: height || undefined } }\n\t\t\t\tdata-testid=\"heatmap-chart\"\n\t\t\t>\n\t\t\t\t<span className={ styles[ 'heatmap-chart__empty' ] }>\n\t\t\t\t\t{ __( 'No data available', 'jetpack-charts' ) }\n\t\t\t\t</span>\n\t\t\t</Center>\n\t\t);\n\t}\n\n\t// Non-compact tracks split the container by default; a max cap makes them\n\t// stop growing there instead, so sparse ranges keep sensible cell sizes,\n\t// and a min floor makes the grid overflow (for a scrollable wrapper)\n\t// rather than crushing cells on long ranges.\n\tconst columnTrack = compact\n\t\t? 'var(--a8c-charts-dimension-heatmap-cell-size)'\n\t\t: `minmax(${ minCellWidth ?? 0 }px, ${ maxCellWidth ? `${ maxCellWidth }px` : '1fr' })`;\n\tconst rowTrack = compact\n\t\t? 'var(--a8c-charts-dimension-heatmap-cell-size)'\n\t\t: `minmax(${ minCellHeight ?? 0 }px, ${ maxCellHeight ? `${ maxCellHeight }px` : '1fr' })`;\n\tconst gridStyle: Record< string, string | number > = {\n\t\t'--a8c-charts-color-heatmap-primary': primaryColorHex,\n\t\t'--a8c-charts-color-heatmap-background': theme.backgroundColor,\n\t\tgridTemplateColumns: `auto repeat(${ columns }, ${ columnTrack })`,\n\t\tgridTemplateRows: `auto repeat(${ rows }, ${ rowTrack })`,\n\t};\n\tif ( compact ) {\n\t\tgridStyle[ '--a8c-charts-dimension-heatmap-cell-gap' ] = `${ compactCellGap }px`;\n\t\tgridStyle[ '--a8c-charts-dimension-heatmap-cell-size' ] = `${ compactCellSize }px`;\n\t}\n\n\tconst activeDescendant =\n\t\tselectedIndex !== undefined\n\t\t\t? `${ chartId }-cell-${ Math.floor( selectedIndex / rows ) }-${ selectedIndex % rows }`\n\t\t\t: undefined;\n\n\t// A capped row track makes the chart content-sized vertically: neither the\n\t// wrapper nor the grid stretches, or the leftover container height would\n\t// land in the auto label row. A width-only cap must keep the normal vertical\n\t// flex sizing, so it does not opt into this class.\n\tconst heightCapped = ! compact && Boolean( maxCellHeight );\n\n\treturn (\n\t\t<HeatmapContext.Provider value={ heatmapContext }>\n\t\t\t<ChartInstanceContext.Provider value={ { chartId } }>\n\t\t\t\t<ChartLayout\n\t\t\t\t\tlegendPosition=\"bottom\"\n\t\t\t\t\t// Legend renders via trailingContent, not the legend slot.\n\t\t\t\t\tlegendChildren={ [] }\n\t\t\t\t\ttrailingContent={ nonLegendChildren }\n\t\t\t\t\tgap={ gap }\n\t\t\t\t\tclassName={ clsx( 'heatmap-chart', styles[ 'heatmap-chart' ], className, {\n\t\t\t\t\t\t[ styles[ 'heatmap-chart--height-capped' ] ]: heightCapped,\n\t\t\t\t\t} ) }\n\t\t\t\t\t// Explicit dimensions (the unresponsive export) pin the size; otherwise\n\t\t\t\t\t// width/height are unset and the grid fills its container via CSS. The\n\t\t\t\t\t// responsive export drops the measured pixels so reflow stays fluid.\n\t\t\t\t\tstyle={ { width: width || undefined, height: height || undefined } }\n\t\t\t\t\tdata-testid=\"heatmap-chart\"\n\t\t\t\t\tdata-chart-id={ `heatmap-chart-${ chartId }` }\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tref={ containerRef }\n\t\t\t\t\t\trole=\"grid\"\n\t\t\t\t\t\taria-label={ __( 'Heatmap chart', 'jetpack-charts' ) }\n\t\t\t\t\t\taria-rowcount={ rows }\n\t\t\t\t\t\taria-colcount={ columns }\n\t\t\t\t\t\taria-activedescendant={ activeDescendant }\n\t\t\t\t\t\ttabIndex={ 0 }\n\t\t\t\t\t\tonBlur={ onChartBlur }\n\t\t\t\t\t\tonKeyDown={ onChartKeyDown }\n\t\t\t\t\t\tclassName={ clsx( styles[ 'heatmap-chart__grid' ], {\n\t\t\t\t\t\t\t[ styles[ 'heatmap-chart__grid--compact' ] ]: compact,\n\t\t\t\t\t\t\t[ styles[ 'heatmap-chart__grid--height-capped' ] ]: heightCapped,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t\tstyle={ gridStyle as CSSProperties }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ /* Header row preserves the grid structure; cell aria-labels include this text. */ }\n\t\t\t\t\t\t<div role=\"row\" aria-hidden=\"true\" className={ styles[ 'heatmap-chart__row' ] }>\n\t\t\t\t\t\t\t<span />\n\t\t\t\t\t\t\t{ data.map( ( column, columnIndex ) => (\n\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\tkey={ `col-${ columnIndex }` }\n\t\t\t\t\t\t\t\t\tclassName={ styles[ 'heatmap-chart__col-label' ] }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ column.label }\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t{ Array.from( { length: rows } ).map( ( _row, rowIndex ) => {\n\t\t\t\t\t\t\tconst labelVisible = ! compact || rowIndex % 2 === 0;\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tkey={ `row-${ rowIndex }` }\n\t\t\t\t\t\t\t\t\trole=\"row\"\n\t\t\t\t\t\t\t\t\taria-rowindex={ rowIndex + 1 }\n\t\t\t\t\t\t\t\t\tclassName={ styles[ 'heatmap-chart__row' ] }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<span aria-hidden=\"true\" className={ styles[ 'heatmap-chart__row-label' ] }>\n\t\t\t\t\t\t\t\t\t\t{ labelVisible ? rowLabels[ rowIndex ] ?? '' : '' }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t{ data.map( ( column, columnIndex ) => {\n\t\t\t\t\t\t\t\t\t\tconst cell = column.data[ rowIndex ];\n\n\t\t\t\t\t\t\t\t\t\t// A hidden cell keeps its grid slot (so the rest of the\n\t\t\t\t\t\t\t\t\t\t// column doesn't shift) but paints nothing and takes no\n\t\t\t\t\t\t\t\t\t\t// interaction — a calendar's ragged edges.\n\t\t\t\t\t\t\t\t\t\tif ( cell?.hidden ) {\n\t\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\t\t\tkey={ `cell-${ columnIndex }-${ rowIndex }` }\n\t\t\t\t\t\t\t\t\t\t\t\t\tdata-testid=\"heatmap-cell-hidden\"\n\t\t\t\t\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstyles[ 'heatmap-chart__cell' ],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstyles[ 'heatmap-chart__cell--hidden' ]\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t// Filler: drawn like an empty cell so the grid fills its\n\t\t\t\t\t\t\t\t\t\t// container, but it stands for a day nothing was measured\n\t\t\t\t\t\t\t\t\t\t// for, so it reports nothing to a pointer or a screen\n\t\t\t\t\t\t\t\t\t\t// reader either.\n\t\t\t\t\t\t\t\t\t\tif ( cell?.placeholder ) {\n\t\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\t\t\tkey={ `cell-${ columnIndex }-${ rowIndex }` }\n\t\t\t\t\t\t\t\t\t\t\t\t\tdata-testid=\"heatmap-cell-placeholder\"\n\t\t\t\t\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstyles[ 'heatmap-chart__cell' ],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstyles[ 'heatmap-chart__cell--placeholder' ]\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tconst value = cell?.value ?? null;\n\t\t\t\t\t\t\t\t\t\tconst present = isPresent( value );\n\t\t\t\t\t\t\t\t\t\tconst normalized = present ? getNormalizedValue( value, extent ) : 0;\n\t\t\t\t\t\t\t\t\t\tconst flatIndex = columnIndex * rows + rowIndex;\n\t\t\t\t\t\t\t\t\t\tconst info = buildTooltipData( columnIndex, rowIndex );\n\t\t\t\t\t\t\t\t\t\tconst accessibleName =\n\t\t\t\t\t\t\t\t\t\t\tinfo.cellLabel ||\n\t\t\t\t\t\t\t\t\t\t\t`${ info.columnLabel ?? '' } ${ info.rowLabel ?? '' }`.trim();\n\t\t\t\t\t\t\t\t\t\tconst accessibleLabel = `${ accessibleName }: ${\n\t\t\t\t\t\t\t\t\t\t\tinfo.value === null\n\t\t\t\t\t\t\t\t\t\t\t\t? __( 'No data', 'jetpack-charts' )\n\t\t\t\t\t\t\t\t\t\t\t\t: formatNumber( info.value )\n\t\t\t\t\t\t\t\t\t\t}`;\n\n\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\t\tkey={ `cell-${ columnIndex }-${ rowIndex }` }\n\t\t\t\t\t\t\t\t\t\t\t\tid={ `${ chartId }-cell-${ columnIndex }-${ rowIndex }` }\n\t\t\t\t\t\t\t\t\t\t\t\tdata-testid=\"heatmap-cell\"\n\t\t\t\t\t\t\t\t\t\t\t\trole=\"gridcell\"\n\t\t\t\t\t\t\t\t\t\t\t\t// Focus stays on the grid (aria-activedescendant); cells are\n\t\t\t\t\t\t\t\t\t\t\t\t// focusable but out of the tab order.\n\t\t\t\t\t\t\t\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t\t\t\t\t\t\t\t\taria-colindex={ columnIndex + 1 }\n\t\t\t\t\t\t\t\t\t\t\t\taria-label={ accessibleLabel }\n\t\t\t\t\t\t\t\t\t\t\t\tdata-column={ columnIndex }\n\t\t\t\t\t\t\t\t\t\t\t\tdata-row={ rowIndex }\n\t\t\t\t\t\t\t\t\t\t\t\tclassName={ clsx( styles[ 'heatmap-chart__cell' ], {\n\t\t\t\t\t\t\t\t\t\t\t\t\t[ styles[ 'heatmap-chart__cell--filled' ] ]: present,\n\t\t\t\t\t\t\t\t\t\t\t\t\t[ styles[ 'heatmap-chart__cell--strong' ] ]:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpresent && cellHasLightText( normalized ),\n\t\t\t\t\t\t\t\t\t\t\t\t\t[ styles[ 'heatmap-chart__cell--selected' ] ]:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tselectedIndex === flatIndex,\n\t\t\t\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\t\t\t\t\tpresent\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? ( {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'--a8c-charts-heatmap-cell-intensity': normalized,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t } as CSSProperties )\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tonMouseMove={ handleCellMouseMove }\n\t\t\t\t\t\t\t\t\t\t\t\tonMouseLeave={ handleCellMouseLeave }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ drawValues && present && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span className={ styles[ 'heatmap-chart__cell-value' ] }>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ /* Compact display; tooltip and aria-label keep full precision. */ }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ formatNumberCompact( value ) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t</div>\n\t\t\t\t\t{ withTooltips && tooltipOpen && tooltipData && (\n\t\t\t\t\t\t<TooltipInPortal top={ tooltipTop } left={ tooltipLeft }>\n\t\t\t\t\t\t\t<div className={ CHART_SCOPE_CLASS } role=\"tooltip\" tabIndex={ -1 }>\n\t\t\t\t\t\t\t\t{ ( renderTooltip ?? defaultRenderTooltip )( tooltipData ) }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</TooltipInPortal>\n\t\t\t\t\t) }\n\t\t\t\t</ChartLayout>\n\t\t\t</ChartInstanceContext.Provider>\n\t\t</HeatmapContext.Provider>\n\t);\n};\n\nconst HeatmapChartWithProvider: FC< HeatmapChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\tif ( existingContext ) {\n\t\treturn <HeatmapChartInternal { ...props } />;\n\t}\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<HeatmapChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nHeatmapChartWithProvider.displayName = 'HeatmapChart';\n\ninterface HeatmapChartSubComponents {\n\tLegend: typeof HeatmapLegend;\n}\n\nconst HeatmapChart = attachSubComponents( HeatmapChartWithProvider, {\n\tLegend: HeatmapLegend,\n} ) as FC< HeatmapChartProps > & HeatmapChartSubComponents;\n\n// The responsive wrapper already sizes the container; drop its measured pixel\n// width/height so the grid fills that container via CSS and reflows fluidly,\n// instead of pinning to a debounced measurement.\nconst HeatmapChartResponsiveInner: FC< HeatmapChartProps > = props => (\n\t<HeatmapChartWithProvider { ...props } width={ undefined } height={ undefined } />\n);\nHeatmapChartResponsiveInner.displayName = 'HeatmapChart';\n\nconst HeatmapChartResponsive = attachSubComponents(\n\twithResponsive< HeatmapChartProps >( HeatmapChartResponsiveInner ),\n\t{ Legend: HeatmapLegend }\n) as FC< HeatmapChartProps & ResponsiveConfig > & HeatmapChartSubComponents;\n\nexport { HeatmapChartResponsive as default, HeatmapChart as HeatmapChartUnresponsive };\n","/*!\n * is-plain-object <https://github.com/jonschlinkert/is-plain-object>\n *\n * Copyright (c) 2014-2017, Jon Schlinkert.\n * Released under the MIT License.\n */\n\nfunction isObject(o) {\n return Object.prototype.toString.call(o) === '[object Object]';\n}\n\nfunction isPlainObject(o) {\n var ctor,prot;\n\n if (isObject(o) === false) return false;\n\n // If has modified constructor\n ctor = o.constructor;\n if (ctor === undefined) return true;\n\n // If has modified prototype\n prot = ctor.prototype;\n if (isObject(prot) === false) return false;\n\n // If constructor does not have an Object-specific method\n if (prot.hasOwnProperty('isPrototypeOf') === false) {\n return false;\n }\n\n // Most likely a plain Object\n return true;\n}\n\nexport { isPlainObject };\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.lowerCase = exports.localeLowerCase = void 0;\n/**\n * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt\n */\nvar SUPPORTED_LOCALE = {\n tr: {\n regexp: /\\u0130|\\u0049|\\u0049\\u0307/g,\n map: {\n İ: \"\\u0069\",\n I: \"\\u0131\",\n İ: \"\\u0069\",\n },\n },\n az: {\n regexp: /\\u0130/g,\n map: {\n İ: \"\\u0069\",\n I: \"\\u0131\",\n İ: \"\\u0069\",\n },\n },\n lt: {\n regexp: /\\u0049|\\u004A|\\u012E|\\u00CC|\\u00CD|\\u0128/g,\n map: {\n I: \"\\u0069\\u0307\",\n J: \"\\u006A\\u0307\",\n Į: \"\\u012F\\u0307\",\n Ì: \"\\u0069\\u0307\\u0300\",\n Í: \"\\u0069\\u0307\\u0301\",\n Ĩ: \"\\u0069\\u0307\\u0303\",\n },\n },\n};\n/**\n * Localized lower case.\n */\nfunction localeLowerCase(str, locale) {\n var lang = SUPPORTED_LOCALE[locale.toLowerCase()];\n if (lang)\n return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; }));\n return lowerCase(str);\n}\nexports.localeLowerCase = localeLowerCase;\n/**\n * Lower case as a function.\n */\nfunction lowerCase(str) {\n return str.toLowerCase();\n}\nexports.lowerCase = lowerCase;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.noCase = void 0;\nvar lower_case_1 = require(\"lower-case\");\n// Support camel case (\"camelCase\" -> \"camel Case\" and \"CAMELCase\" -> \"CAMEL Case\").\nvar DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];\n// Remove all non-word characters.\nvar DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;\n/**\n * Normalize the string into something other libraries can manipulate easier.\n */\nfunction noCase(input, options) {\n if (options === void 0) { options = {}; }\n 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;\n var result = replace(replace(input, splitRegexp, \"$1\\0$2\"), stripRegexp, \"\\0\");\n var start = 0;\n var end = result.length;\n // Trim the delimiter from around the output string.\n while (result.charAt(start) === \"\\0\")\n start++;\n while (result.charAt(end - 1) === \"\\0\")\n end--;\n // Transform each token independently.\n return result.slice(start, end).split(\"\\0\").map(transform).join(delimiter);\n}\nexports.noCase = noCase;\n/**\n * Replace `re` in the input string with the replacement value.\n */\nfunction replace(input, re, value) {\n if (re instanceof RegExp)\n return input.replace(re, value);\n return re.reduce(function (input, re) { return input.replace(re, value); }, input);\n}\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.pascalCase = exports.pascalCaseTransformMerge = exports.pascalCaseTransform = void 0;\nvar tslib_1 = require(\"tslib\");\nvar no_case_1 = require(\"no-case\");\nfunction pascalCaseTransform(input, index) {\n var firstChar = input.charAt(0);\n var lowerChars = input.substr(1).toLowerCase();\n if (index > 0 && firstChar >= \"0\" && firstChar <= \"9\") {\n return \"_\" + firstChar + lowerChars;\n }\n return \"\" + firstChar.toUpperCase() + lowerChars;\n}\nexports.pascalCaseTransform = pascalCaseTransform;\nfunction pascalCaseTransformMerge(input) {\n return input.charAt(0).toUpperCase() + input.slice(1).toLowerCase();\n}\nexports.pascalCaseTransformMerge = pascalCaseTransformMerge;\nfunction pascalCase(input, options) {\n if (options === void 0) { options = {}; }\n return no_case_1.noCase(input, tslib_1.__assign({ delimiter: \"\", transform: pascalCaseTransform }, options));\n}\nexports.pascalCase = pascalCase;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.camelCase = exports.camelCaseTransformMerge = exports.camelCaseTransform = void 0;\nvar tslib_1 = require(\"tslib\");\nvar pascal_case_1 = require(\"pascal-case\");\nfunction camelCaseTransform(input, index) {\n if (index === 0)\n return input.toLowerCase();\n return pascal_case_1.pascalCaseTransform(input, index);\n}\nexports.camelCaseTransform = camelCaseTransform;\nfunction camelCaseTransformMerge(input, index) {\n if (index === 0)\n return input.toLowerCase();\n return pascal_case_1.pascalCaseTransformMerge(input);\n}\nexports.camelCaseTransformMerge = camelCaseTransformMerge;\nfunction camelCase(input, options) {\n if (options === void 0) { options = {}; }\n return pascal_case_1.pascalCase(input, tslib_1.__assign({ transform: camelCaseTransform }, options));\n}\nexports.camelCase = camelCase;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.upperCaseFirst = void 0;\n/**\n * Upper case the first character of an input string.\n */\nfunction upperCaseFirst(input) {\n return input.charAt(0).toUpperCase() + input.substr(1);\n}\nexports.upperCaseFirst = upperCaseFirst;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.capitalCase = exports.capitalCaseTransform = void 0;\nvar tslib_1 = require(\"tslib\");\nvar no_case_1 = require(\"no-case\");\nvar upper_case_first_1 = require(\"upper-case-first\");\nfunction capitalCaseTransform(input) {\n return upper_case_first_1.upperCaseFirst(input.toLowerCase());\n}\nexports.capitalCaseTransform = capitalCaseTransform;\nfunction capitalCase(input, options) {\n if (options === void 0) { options = {}; }\n return no_case_1.noCase(input, tslib_1.__assign({ delimiter: \" \", transform: capitalCaseTransform }, options));\n}\nexports.capitalCase = capitalCase;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.upperCase = exports.localeUpperCase = void 0;\n/**\n * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt\n */\nvar SUPPORTED_LOCALE = {\n tr: {\n regexp: /[\\u0069]/g,\n map: {\n i: \"\\u0130\",\n },\n },\n az: {\n regexp: /[\\u0069]/g,\n map: {\n i: \"\\u0130\",\n },\n },\n lt: {\n regexp: /[\\u0069\\u006A\\u012F]\\u0307|\\u0069\\u0307[\\u0300\\u0301\\u0303]/g,\n map: {\n i̇: \"\\u0049\",\n j̇: \"\\u004A\",\n į̇: \"\\u012E\",\n i̇̀: \"\\u00CC\",\n i̇́: \"\\u00CD\",\n i̇̃: \"\\u0128\",\n },\n },\n};\n/**\n * Localized upper case.\n */\nfunction localeUpperCase(str, locale) {\n var lang = SUPPORTED_LOCALE[locale.toLowerCase()];\n if (lang)\n return upperCase(str.replace(lang.regexp, function (m) { return lang.map[m]; }));\n return upperCase(str);\n}\nexports.localeUpperCase = localeUpperCase;\n/**\n * Upper case as a function.\n */\nfunction upperCase(str) {\n return str.toUpperCase();\n}\nexports.upperCase = upperCase;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.constantCase = void 0;\nvar tslib_1 = require(\"tslib\");\nvar no_case_1 = require(\"no-case\");\nvar upper_case_1 = require(\"upper-case\");\nfunction constantCase(input, options) {\n if (options === void 0) { options = {}; }\n return no_case_1.noCase(input, tslib_1.__assign({ delimiter: \"_\", transform: upper_case_1.upperCase }, options));\n}\nexports.constantCase = constantCase;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.dotCase = void 0;\nvar tslib_1 = require(\"tslib\");\nvar no_case_1 = require(\"no-case\");\nfunction dotCase(input, options) {\n if (options === void 0) { options = {}; }\n return no_case_1.noCase(input, tslib_1.__assign({ delimiter: \".\" }, options));\n}\nexports.dotCase = dotCase;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.headerCase = void 0;\nvar tslib_1 = require(\"tslib\");\nvar capital_case_1 = require(\"capital-case\");\nfunction headerCase(input, options) {\n if (options === void 0) { options = {}; }\n return capital_case_1.capitalCase(input, tslib_1.__assign({ delimiter: \"-\" }, options));\n}\nexports.headerCase = headerCase;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.paramCase = void 0;\nvar tslib_1 = require(\"tslib\");\nvar dot_case_1 = require(\"dot-case\");\nfunction paramCase(input, options) {\n if (options === void 0) { options = {}; }\n return dot_case_1.dotCase(input, tslib_1.__assign({ delimiter: \"-\" }, options));\n}\nexports.paramCase = paramCase;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.pathCase = void 0;\nvar tslib_1 = require(\"tslib\");\nvar dot_case_1 = require(\"dot-case\");\nfunction pathCase(input, options) {\n if (options === void 0) { options = {}; }\n return dot_case_1.dotCase(input, tslib_1.__assign({ delimiter: \"/\" }, options));\n}\nexports.pathCase = pathCase;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.sentenceCase = exports.sentenceCaseTransform = void 0;\nvar tslib_1 = require(\"tslib\");\nvar no_case_1 = require(\"no-case\");\nvar upper_case_first_1 = require(\"upper-case-first\");\nfunction sentenceCaseTransform(input, index) {\n var result = input.toLowerCase();\n if (index === 0)\n return upper_case_first_1.upperCaseFirst(result);\n return result;\n}\nexports.sentenceCaseTransform = sentenceCaseTransform;\nfunction sentenceCase(input, options) {\n if (options === void 0) { options = {}; }\n return no_case_1.noCase(input, tslib_1.__assign({ delimiter: \" \", transform: sentenceCaseTransform }, options));\n}\nexports.sentenceCase = sentenceCase;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.snakeCase = void 0;\nvar tslib_1 = require(\"tslib\");\nvar dot_case_1 = require(\"dot-case\");\nfunction snakeCase(input, options) {\n if (options === void 0) { options = {}; }\n return dot_case_1.dotCase(input, tslib_1.__assign({ delimiter: \"_\" }, options));\n}\nexports.snakeCase = snakeCase;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = require(\"tslib\");\ntslib_1.__exportStar(require(\"camel-case\"), exports);\ntslib_1.__exportStar(require(\"capital-case\"), exports);\ntslib_1.__exportStar(require(\"constant-case\"), exports);\ntslib_1.__exportStar(require(\"dot-case\"), exports);\ntslib_1.__exportStar(require(\"header-case\"), exports);\ntslib_1.__exportStar(require(\"no-case\"), exports);\ntslib_1.__exportStar(require(\"param-case\"), exports);\ntslib_1.__exportStar(require(\"pascal-case\"), exports);\ntslib_1.__exportStar(require(\"path-case\"), exports);\ntslib_1.__exportStar(require(\"sentence-case\"), exports);\ntslib_1.__exportStar(require(\"snake-case\"), exports);\n//# sourceMappingURL=index.js.map","// packages/components/src/utils/hooks/use-update-effect.js\nimport { useRef, useEffect } from \"@wordpress/element\";\nfunction useUpdateEffect(effect, deps) {\n const mountedRef = useRef(false);\n useEffect(() => {\n if (mountedRef.current) {\n return effect();\n }\n mountedRef.current = true;\n return void 0;\n }, deps);\n useEffect(() => () => {\n mountedRef.current = false;\n }, []);\n}\nvar use_update_effect_default = useUpdateEffect;\nexport {\n use_update_effect_default as default\n};\n//# sourceMappingURL=use-update-effect.mjs.map\n","var isDevelopment = false;\n\n/*\n\nBased off glamor's StyleSheet, thanks Sunil ❤️\n\nhigh performance StyleSheet for css-in-js systems\n\n- uses multiple style tags behind the scenes for millions of rules\n- uses `insertRule` for appending in production for *much* faster performance\n\n// usage\n\nimport { StyleSheet } from '@emotion/sheet'\n\nlet styleSheet = new StyleSheet({ key: '', container: document.head })\n\nstyleSheet.insert('#box { border: 1px solid red; }')\n- appends a css rule into the stylesheet\n\nstyleSheet.flush()\n- empties the stylesheet of all its contents\n\n*/\n\nfunction sheetForTag(tag) {\n if (tag.sheet) {\n return tag.sheet;\n } // this weirdness brought to you by firefox\n\n /* istanbul ignore next */\n\n\n for (var i = 0; i < document.styleSheets.length; i++) {\n if (document.styleSheets[i].ownerNode === tag) {\n return document.styleSheets[i];\n }\n } // this function should always return with a value\n // TS can't understand it though so we make it stop complaining here\n\n\n return undefined;\n}\n\nfunction createStyleElement(options) {\n var tag = document.createElement('style');\n tag.setAttribute('data-emotion', options.key);\n\n if (options.nonce !== undefined) {\n tag.setAttribute('nonce', options.nonce);\n }\n\n tag.appendChild(document.createTextNode(''));\n tag.setAttribute('data-s', '');\n return tag;\n}\n\nvar StyleSheet = /*#__PURE__*/function () {\n // Using Node instead of HTMLElement since container may be a ShadowRoot\n function StyleSheet(options) {\n var _this = this;\n\n this._insertTag = function (tag) {\n var before;\n\n if (_this.tags.length === 0) {\n if (_this.insertionPoint) {\n before = _this.insertionPoint.nextSibling;\n } else if (_this.prepend) {\n before = _this.container.firstChild;\n } else {\n before = _this.before;\n }\n } else {\n before = _this.tags[_this.tags.length - 1].nextSibling;\n }\n\n _this.container.insertBefore(tag, before);\n\n _this.tags.push(tag);\n };\n\n this.isSpeedy = options.speedy === undefined ? !isDevelopment : options.speedy;\n this.tags = [];\n this.ctr = 0;\n this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets\n\n this.key = options.key;\n this.container = options.container;\n this.prepend = options.prepend;\n this.insertionPoint = options.insertionPoint;\n this.before = null;\n }\n\n var _proto = StyleSheet.prototype;\n\n _proto.hydrate = function hydrate(nodes) {\n nodes.forEach(this._insertTag);\n };\n\n _proto.insert = function insert(rule) {\n // the max length is how many rules we have per style tag, it's 65000 in speedy mode\n // it's 1 in dev because we insert source maps that map a single rule to a location\n // and you can only have one source map per style tag\n if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) {\n this._insertTag(createStyleElement(this));\n }\n\n var tag = this.tags[this.tags.length - 1];\n\n if (this.isSpeedy) {\n var sheet = sheetForTag(tag);\n\n try {\n // this is the ultrafast version, works across browsers\n // the big drawback is that the css won't be editable in devtools\n sheet.insertRule(rule, sheet.cssRules.length);\n } catch (e) {\n }\n } else {\n tag.appendChild(document.createTextNode(rule));\n }\n\n this.ctr++;\n };\n\n _proto.flush = function flush() {\n this.tags.forEach(function (tag) {\n var _tag$parentNode;\n\n return (_tag$parentNode = tag.parentNode) == null ? void 0 : _tag$parentNode.removeChild(tag);\n });\n this.tags = [];\n this.ctr = 0;\n };\n\n return StyleSheet;\n}();\n\nexport { StyleSheet };\n","export var MS = '-ms-'\nexport var MOZ = '-moz-'\nexport var WEBKIT = '-webkit-'\n\nexport var COMMENT = 'comm'\nexport var RULESET = 'rule'\nexport var DECLARATION = 'decl'\n\nexport var PAGE = '@page'\nexport var MEDIA = '@media'\nexport var IMPORT = '@import'\nexport var CHARSET = '@charset'\nexport var VIEWPORT = '@viewport'\nexport var SUPPORTS = '@supports'\nexport var DOCUMENT = '@document'\nexport var NAMESPACE = '@namespace'\nexport var KEYFRAMES = '@keyframes'\nexport var FONT_FACE = '@font-face'\nexport var COUNTER_STYLE = '@counter-style'\nexport var FONT_FEATURE_VALUES = '@font-feature-values'\nexport var LAYER = '@layer'\n","/**\n * @param {number}\n * @return {number}\n */\nexport var abs = Math.abs\n\n/**\n * @param {number}\n * @return {string}\n */\nexport var from = String.fromCharCode\n\n/**\n * @param {object}\n * @return {object}\n */\nexport var assign = Object.assign\n\n/**\n * @param {string} value\n * @param {number} length\n * @return {number}\n */\nexport function hash (value, length) {\n\treturn charat(value, 0) ^ 45 ? (((((((length << 2) ^ charat(value, 0)) << 2) ^ charat(value, 1)) << 2) ^ charat(value, 2)) << 2) ^ charat(value, 3) : 0\n}\n\n/**\n * @param {string} value\n * @return {string}\n */\nexport function trim (value) {\n\treturn value.trim()\n}\n\n/**\n * @param {string} value\n * @param {RegExp} pattern\n * @return {string?}\n */\nexport function match (value, pattern) {\n\treturn (value = pattern.exec(value)) ? value[0] : value\n}\n\n/**\n * @param {string} value\n * @param {(string|RegExp)} pattern\n * @param {string} replacement\n * @return {string}\n */\nexport function replace (value, pattern, replacement) {\n\treturn value.replace(pattern, replacement)\n}\n\n/**\n * @param {string} value\n * @param {string} search\n * @return {number}\n */\nexport function indexof (value, search) {\n\treturn value.indexOf(search)\n}\n\n/**\n * @param {string} value\n * @param {number} index\n * @return {number}\n */\nexport function charat (value, index) {\n\treturn value.charCodeAt(index) | 0\n}\n\n/**\n * @param {string} value\n * @param {number} begin\n * @param {number} end\n * @return {string}\n */\nexport function substr (value, begin, end) {\n\treturn value.slice(begin, end)\n}\n\n/**\n * @param {string} value\n * @return {number}\n */\nexport function strlen (value) {\n\treturn value.length\n}\n\n/**\n * @param {any[]} value\n * @return {number}\n */\nexport function sizeof (value) {\n\treturn value.length\n}\n\n/**\n * @param {any} value\n * @param {any[]} array\n * @return {any}\n */\nexport function append (value, array) {\n\treturn array.push(value), value\n}\n\n/**\n * @param {string[]} array\n * @param {function} callback\n * @return {string}\n */\nexport function combine (array, callback) {\n\treturn array.map(callback).join('')\n}\n","import {from, trim, charat, strlen, substr, append, assign} from './Utility.js'\n\nexport var line = 1\nexport var column = 1\nexport var length = 0\nexport var position = 0\nexport var character = 0\nexport var characters = ''\n\n/**\n * @param {string} value\n * @param {object | null} root\n * @param {object | null} parent\n * @param {string} type\n * @param {string[] | string} props\n * @param {object[] | string} children\n * @param {number} length\n */\nexport function node (value, root, parent, type, props, children, length) {\n\treturn {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: ''}\n}\n\n/**\n * @param {object} root\n * @param {object} props\n * @return {object}\n */\nexport function copy (root, props) {\n\treturn assign(node('', null, null, '', null, null, 0), root, {length: -root.length}, props)\n}\n\n/**\n * @return {number}\n */\nexport function char () {\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function prev () {\n\tcharacter = position > 0 ? charat(characters, --position) : 0\n\n\tif (column--, character === 10)\n\t\tcolumn = 1, line--\n\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function next () {\n\tcharacter = position < length ? charat(characters, position++) : 0\n\n\tif (column++, character === 10)\n\t\tcolumn = 1, line++\n\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function peek () {\n\treturn charat(characters, position)\n}\n\n/**\n * @return {number}\n */\nexport function caret () {\n\treturn position\n}\n\n/**\n * @param {number} begin\n * @param {number} end\n * @return {string}\n */\nexport function slice (begin, end) {\n\treturn substr(characters, begin, end)\n}\n\n/**\n * @param {number} type\n * @return {number}\n */\nexport function token (type) {\n\tswitch (type) {\n\t\t// \\0 \\t \\n \\r \\s whitespace token\n\t\tcase 0: case 9: case 10: case 13: case 32:\n\t\t\treturn 5\n\t\t// ! + , / > @ ~ isolate token\n\t\tcase 33: case 43: case 44: case 47: case 62: case 64: case 126:\n\t\t// ; { } breakpoint token\n\t\tcase 59: case 123: case 125:\n\t\t\treturn 4\n\t\t// : accompanied token\n\t\tcase 58:\n\t\t\treturn 3\n\t\t// \" ' ( [ opening delimit token\n\t\tcase 34: case 39: case 40: case 91:\n\t\t\treturn 2\n\t\t// ) ] closing delimit token\n\t\tcase 41: case 93:\n\t\t\treturn 1\n\t}\n\n\treturn 0\n}\n\n/**\n * @param {string} value\n * @return {any[]}\n */\nexport function alloc (value) {\n\treturn line = column = 1, length = strlen(characters = value), position = 0, []\n}\n\n/**\n * @param {any} value\n * @return {any}\n */\nexport function dealloc (value) {\n\treturn characters = '', value\n}\n\n/**\n * @param {number} type\n * @return {string}\n */\nexport function delimit (type) {\n\treturn trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)))\n}\n\n/**\n * @param {string} value\n * @return {string[]}\n */\nexport function tokenize (value) {\n\treturn dealloc(tokenizer(alloc(value)))\n}\n\n/**\n * @param {number} type\n * @return {string}\n */\nexport function whitespace (type) {\n\twhile (character = peek())\n\t\tif (character < 33)\n\t\t\tnext()\n\t\telse\n\t\t\tbreak\n\n\treturn token(type) > 2 || token(character) > 3 ? '' : ' '\n}\n\n/**\n * @param {string[]} children\n * @return {string[]}\n */\nexport function tokenizer (children) {\n\twhile (next())\n\t\tswitch (token(character)) {\n\t\t\tcase 0: append(identifier(position - 1), children)\n\t\t\t\tbreak\n\t\t\tcase 2: append(delimit(character), children)\n\t\t\t\tbreak\n\t\t\tdefault: append(from(character), children)\n\t\t}\n\n\treturn children\n}\n\n/**\n * @param {number} index\n * @param {number} count\n * @return {string}\n */\nexport function escaping (index, count) {\n\twhile (--count && next())\n\t\t// not 0-9 A-F a-f\n\t\tif (character < 48 || character > 102 || (character > 57 && character < 65) || (character > 70 && character < 97))\n\t\t\tbreak\n\n\treturn slice(index, caret() + (count < 6 && peek() == 32 && next() == 32))\n}\n\n/**\n * @param {number} type\n * @return {number}\n */\nexport function delimiter (type) {\n\twhile (next())\n\t\tswitch (character) {\n\t\t\t// ] ) \" '\n\t\t\tcase type:\n\t\t\t\treturn position\n\t\t\t// \" '\n\t\t\tcase 34: case 39:\n\t\t\t\tif (type !== 34 && type !== 39)\n\t\t\t\t\tdelimiter(character)\n\t\t\t\tbreak\n\t\t\t// (\n\t\t\tcase 40:\n\t\t\t\tif (type === 41)\n\t\t\t\t\tdelimiter(type)\n\t\t\t\tbreak\n\t\t\t// \\\n\t\t\tcase 92:\n\t\t\t\tnext()\n\t\t\t\tbreak\n\t\t}\n\n\treturn position\n}\n\n/**\n * @param {number} type\n * @param {number} index\n * @return {number}\n */\nexport function commenter (type, index) {\n\twhile (next())\n\t\t// //\n\t\tif (type + character === 47 + 10)\n\t\t\tbreak\n\t\t// /*\n\t\telse if (type + character === 42 + 42 && peek() === 47)\n\t\t\tbreak\n\n\treturn '/*' + slice(index, position - 1) + '*' + from(type === 47 ? type : next())\n}\n\n/**\n * @param {number} index\n * @return {string}\n */\nexport function identifier (index) {\n\twhile (!token(peek()))\n\t\tnext()\n\n\treturn slice(index, position)\n}\n","import {COMMENT, RULESET, DECLARATION} from './Enum.js'\nimport {abs, charat, trim, from, sizeof, strlen, substr, append, replace, indexof} from './Utility.js'\nimport {node, char, prev, next, peek, caret, alloc, dealloc, delimit, whitespace, escaping, identifier, commenter} from './Tokenizer.js'\n\n/**\n * @param {string} value\n * @return {object[]}\n */\nexport function compile (value) {\n\treturn dealloc(parse('', null, null, null, [''], value = alloc(value), 0, [0], value))\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {string[]} rule\n * @param {string[]} rules\n * @param {string[]} rulesets\n * @param {number[]} pseudo\n * @param {number[]} points\n * @param {string[]} declarations\n * @return {object}\n */\nexport function parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {\n\tvar index = 0\n\tvar offset = 0\n\tvar length = pseudo\n\tvar atrule = 0\n\tvar property = 0\n\tvar previous = 0\n\tvar variable = 1\n\tvar scanning = 1\n\tvar ampersand = 1\n\tvar character = 0\n\tvar type = ''\n\tvar props = rules\n\tvar children = rulesets\n\tvar reference = rule\n\tvar characters = type\n\n\twhile (scanning)\n\t\tswitch (previous = character, character = next()) {\n\t\t\t// (\n\t\t\tcase 40:\n\t\t\t\tif (previous != 108 && charat(characters, length - 1) == 58) {\n\t\t\t\t\tif (indexof(characters += replace(delimit(character), '&', '&\\f'), '&\\f') != -1)\n\t\t\t\t\t\tampersand = -1\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t// \" ' [\n\t\t\tcase 34: case 39: case 91:\n\t\t\t\tcharacters += delimit(character)\n\t\t\t\tbreak\n\t\t\t// \\t \\n \\r \\s\n\t\t\tcase 9: case 10: case 13: case 32:\n\t\t\t\tcharacters += whitespace(previous)\n\t\t\t\tbreak\n\t\t\t// \\\n\t\t\tcase 92:\n\t\t\t\tcharacters += escaping(caret() - 1, 7)\n\t\t\t\tcontinue\n\t\t\t// /\n\t\t\tcase 47:\n\t\t\t\tswitch (peek()) {\n\t\t\t\t\tcase 42: case 47:\n\t\t\t\t\t\tappend(comment(commenter(next(), caret()), root, parent), declarations)\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tcharacters += '/'\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t// {\n\t\t\tcase 123 * variable:\n\t\t\t\tpoints[index++] = strlen(characters) * ampersand\n\t\t\t// } ; \\0\n\t\t\tcase 125 * variable: case 59: case 0:\n\t\t\t\tswitch (character) {\n\t\t\t\t\t// \\0 }\n\t\t\t\t\tcase 0: case 125: scanning = 0\n\t\t\t\t\t// ;\n\t\t\t\t\tcase 59 + offset: if (ampersand == -1) characters = replace(characters, /\\f/g, '')\n\t\t\t\t\t\tif (property > 0 && (strlen(characters) - length))\n\t\t\t\t\t\t\tappend(property > 32 ? declaration(characters + ';', rule, parent, length - 1) : declaration(replace(characters, ' ', '') + ';', rule, parent, length - 2), declarations)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// @ ;\n\t\t\t\t\tcase 59: characters += ';'\n\t\t\t\t\t// { rule/at-rule\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tappend(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets)\n\n\t\t\t\t\t\tif (character === 123)\n\t\t\t\t\t\t\tif (offset === 0)\n\t\t\t\t\t\t\t\tparse(characters, root, reference, reference, props, rulesets, length, points, children)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tswitch (atrule === 99 && charat(characters, 3) === 110 ? 100 : atrule) {\n\t\t\t\t\t\t\t\t\t// d l m s\n\t\t\t\t\t\t\t\t\tcase 100: case 108: case 109: case 115:\n\t\t\t\t\t\t\t\t\t\tparse(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)\n\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tparse(characters, reference, reference, reference, [''], children, 0, points, children)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tindex = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo\n\t\t\t\tbreak\n\t\t\t// :\n\t\t\tcase 58:\n\t\t\t\tlength = 1 + strlen(characters), property = previous\n\t\t\tdefault:\n\t\t\t\tif (variable < 1)\n\t\t\t\t\tif (character == 123)\n\t\t\t\t\t\t--variable\n\t\t\t\t\telse if (character == 125 && variable++ == 0 && prev() == 125)\n\t\t\t\t\t\tcontinue\n\n\t\t\t\tswitch (characters += from(character), character * variable) {\n\t\t\t\t\t// &\n\t\t\t\t\tcase 38:\n\t\t\t\t\t\tampersand = offset > 0 ? 1 : (characters += '\\f', -1)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// ,\n\t\t\t\t\tcase 44:\n\t\t\t\t\t\tpoints[index++] = (strlen(characters) - 1) * ampersand, ampersand = 1\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// @\n\t\t\t\t\tcase 64:\n\t\t\t\t\t\t// -\n\t\t\t\t\t\tif (peek() === 45)\n\t\t\t\t\t\t\tcharacters += delimit(next())\n\n\t\t\t\t\t\tatrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// -\n\t\t\t\t\tcase 45:\n\t\t\t\t\t\tif (previous === 45 && strlen(characters) == 2)\n\t\t\t\t\t\t\tvariable = 0\n\t\t\t\t}\n\t\t}\n\n\treturn rulesets\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {number} index\n * @param {number} offset\n * @param {string[]} rules\n * @param {number[]} points\n * @param {string} type\n * @param {string[]} props\n * @param {string[]} children\n * @param {number} length\n * @return {object}\n */\nexport function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length) {\n\tvar post = offset - 1\n\tvar rule = offset === 0 ? rules : ['']\n\tvar size = sizeof(rule)\n\n\tfor (var i = 0, j = 0, k = 0; i < index; ++i)\n\t\tfor (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)\n\t\t\tif (z = trim(j > 0 ? rule[x] + ' ' + y : replace(y, /&\\f/g, rule[x])))\n\t\t\t\tprops[k++] = z\n\n\treturn node(value, root, parent, offset === 0 ? RULESET : type, props, children, length)\n}\n\n/**\n * @param {number} value\n * @param {object} root\n * @param {object?} parent\n * @return {object}\n */\nexport function comment (value, root, parent) {\n\treturn node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0)\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {number} length\n * @return {object}\n */\nexport function declaration (value, root, parent, length) {\n\treturn node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length)\n}\n","import {IMPORT, LAYER, COMMENT, RULESET, DECLARATION, KEYFRAMES} from './Enum.js'\nimport {strlen, sizeof} from './Utility.js'\n\n/**\n * @param {object[]} children\n * @param {function} callback\n * @return {string}\n */\nexport function serialize (children, callback) {\n\tvar output = ''\n\tvar length = sizeof(children)\n\n\tfor (var i = 0; i < length; i++)\n\t\toutput += callback(children[i], i, children, callback) || ''\n\n\treturn output\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n * @param {function} callback\n * @return {string}\n */\nexport function stringify (element, index, children, callback) {\n\tswitch (element.type) {\n\t\tcase LAYER: if (element.children.length) break\n\t\tcase IMPORT: case DECLARATION: return element.return = element.return || element.value\n\t\tcase COMMENT: return ''\n\t\tcase KEYFRAMES: return element.return = element.value + '{' + serialize(element.children, callback) + '}'\n\t\tcase RULESET: element.value = element.props.join(',')\n\t}\n\n\treturn strlen(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : ''\n}\n","import {MS, MOZ, WEBKIT, RULESET, KEYFRAMES, DECLARATION} from './Enum.js'\nimport {match, charat, substr, strlen, sizeof, replace, combine} from './Utility.js'\nimport {copy, tokenize} from './Tokenizer.js'\nimport {serialize} from './Serializer.js'\nimport {prefix} from './Prefixer.js'\n\n/**\n * @param {function[]} collection\n * @return {function}\n */\nexport function middleware (collection) {\n\tvar length = sizeof(collection)\n\n\treturn function (element, index, children, callback) {\n\t\tvar output = ''\n\n\t\tfor (var i = 0; i < length; i++)\n\t\t\toutput += collection[i](element, index, children, callback) || ''\n\n\t\treturn output\n\t}\n}\n\n/**\n * @param {function} callback\n * @return {function}\n */\nexport function rulesheet (callback) {\n\treturn function (element) {\n\t\tif (!element.root)\n\t\t\tif (element = element.return)\n\t\t\t\tcallback(element)\n\t}\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n * @param {function} callback\n */\nexport function prefixer (element, index, children, callback) {\n\tif (element.length > -1)\n\t\tif (!element.return)\n\t\t\tswitch (element.type) {\n\t\t\t\tcase DECLARATION: element.return = prefix(element.value, element.length, children)\n\t\t\t\t\treturn\n\t\t\t\tcase KEYFRAMES:\n\t\t\t\t\treturn serialize([copy(element, {value: replace(element.value, '@', '@' + WEBKIT)})], callback)\n\t\t\t\tcase RULESET:\n\t\t\t\t\tif (element.length)\n\t\t\t\t\t\treturn combine(element.props, function (value) {\n\t\t\t\t\t\t\tswitch (match(value, /(::plac\\w+|:read-\\w+)/)) {\n\t\t\t\t\t\t\t\t// :read-(only|write)\n\t\t\t\t\t\t\t\tcase ':read-only': case ':read-write':\n\t\t\t\t\t\t\t\t\treturn serialize([copy(element, {props: [replace(value, /:(read-\\w+)/, ':' + MOZ + '$1')]})], callback)\n\t\t\t\t\t\t\t\t// :placeholder\n\t\t\t\t\t\t\t\tcase '::placeholder':\n\t\t\t\t\t\t\t\t\treturn serialize([\n\t\t\t\t\t\t\t\t\t\tcopy(element, {props: [replace(value, /:(plac\\w+)/, ':' + WEBKIT + 'input-$1')]}),\n\t\t\t\t\t\t\t\t\t\tcopy(element, {props: [replace(value, /:(plac\\w+)/, ':' + MOZ + '$1')]}),\n\t\t\t\t\t\t\t\t\t\tcopy(element, {props: [replace(value, /:(plac\\w+)/, MS + 'input-$1')]})\n\t\t\t\t\t\t\t\t\t], callback)\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn ''\n\t\t\t\t\t\t})\n\t\t\t}\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n */\nexport function namespace (element) {\n\tswitch (element.type) {\n\t\tcase RULESET:\n\t\t\telement.props = element.props.map(function (value) {\n\t\t\t\treturn combine(tokenize(value), function (value, index, children) {\n\t\t\t\t\tswitch (charat(value, 0)) {\n\t\t\t\t\t\t// \\f\n\t\t\t\t\t\tcase 12:\n\t\t\t\t\t\t\treturn substr(value, 1, strlen(value))\n\t\t\t\t\t\t// \\0 ( + > ~\n\t\t\t\t\t\tcase 0: case 40: case 43: case 62: case 126:\n\t\t\t\t\t\t\treturn value\n\t\t\t\t\t\t// :\n\t\t\t\t\t\tcase 58:\n\t\t\t\t\t\t\tif (children[++index] === 'global')\n\t\t\t\t\t\t\t\tchildren[index] = '', children[++index] = '\\f' + substr(children[index], index = 1, -1)\n\t\t\t\t\t\t// \\s\n\t\t\t\t\t\tcase 32:\n\t\t\t\t\t\t\treturn index === 1 ? '' : value\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tswitch (index) {\n\t\t\t\t\t\t\t\tcase 0: element = value\n\t\t\t\t\t\t\t\t\treturn sizeof(children) > 1 ? '' : value\n\t\t\t\t\t\t\t\tcase index = sizeof(children) - 1: case 2:\n\t\t\t\t\t\t\t\t\treturn index === 2 ? value + element + element : value + element\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\treturn value\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t})\n\t}\n}\n","var weakMemoize = function weakMemoize(func) {\n var cache = new WeakMap();\n return function (arg) {\n if (cache.has(arg)) {\n // Use non-null assertion because we just checked that the cache `has` it\n // This allows us to remove `undefined` from the return value\n return cache.get(arg);\n }\n\n var ret = func(arg);\n cache.set(arg, ret);\n return ret;\n };\n};\n\nexport { weakMemoize as default };\n","function memoize(fn) {\n var cache = Object.create(null);\n return function (arg) {\n if (cache[arg] === undefined) cache[arg] = fn(arg);\n return cache[arg];\n };\n}\n\nexport { memoize as default };\n","import { StyleSheet } from '@emotion/sheet';\nimport { dealloc, alloc, next, token, from, peek, delimit, slice, position, RULESET, combine, match, serialize, copy, replace, WEBKIT, MOZ, MS, KEYFRAMES, DECLARATION, hash, charat, strlen, indexof, stringify, rulesheet, middleware, compile } from 'stylis';\nimport weakMemoize from '@emotion/weak-memoize';\nimport memoize from '@emotion/memoize';\n\nvar isBrowser = typeof document !== 'undefined';\n\nvar identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {\n var previous = 0;\n var character = 0;\n\n while (true) {\n previous = character;\n character = peek(); // &\\f\n\n if (previous === 38 && character === 12) {\n points[index] = 1;\n }\n\n if (token(character)) {\n break;\n }\n\n next();\n }\n\n return slice(begin, position);\n};\n\nvar toRules = function toRules(parsed, points) {\n // pretend we've started with a comma\n var index = -1;\n var character = 44;\n\n do {\n switch (token(character)) {\n case 0:\n // &\\f\n if (character === 38 && peek() === 12) {\n // this is not 100% correct, we don't account for literal sequences here - like for example quoted strings\n // stylis inserts \\f after & to know when & where it should replace this sequence with the context selector\n // and when it should just concatenate the outer and inner selectors\n // it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here\n points[index] = 1;\n }\n\n parsed[index] += identifierWithPointTracking(position - 1, points, index);\n break;\n\n case 2:\n parsed[index] += delimit(character);\n break;\n\n case 4:\n // comma\n if (character === 44) {\n // colon\n parsed[++index] = peek() === 58 ? '&\\f' : '';\n points[index] = parsed[index].length;\n break;\n }\n\n // fallthrough\n\n default:\n parsed[index] += from(character);\n }\n } while (character = next());\n\n return parsed;\n};\n\nvar getRules = function getRules(value, points) {\n return dealloc(toRules(alloc(value), points));\n}; // WeakSet would be more appropriate, but only WeakMap is supported in IE11\n\n\nvar fixedElements = /* #__PURE__ */new WeakMap();\nvar compat = function compat(element) {\n if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo\n // negative .length indicates that this rule has been already prefixed\n element.length < 1) {\n return;\n }\n\n var value = element.value;\n var parent = element.parent;\n var isImplicitRule = element.column === parent.column && element.line === parent.line;\n\n while (parent.type !== 'rule') {\n parent = parent.parent;\n if (!parent) return;\n } // short-circuit for the simplest case\n\n\n if (element.props.length === 1 && value.charCodeAt(0) !== 58\n /* colon */\n && !fixedElements.get(parent)) {\n return;\n } // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)\n // then the props has already been manipulated beforehand as they that array is shared between it and its \"rule parent\"\n\n\n if (isImplicitRule) {\n return;\n }\n\n fixedElements.set(element, true);\n var points = [];\n var rules = getRules(value, points);\n var parentRules = parent.props;\n\n for (var i = 0, k = 0; i < rules.length; i++) {\n for (var j = 0; j < parentRules.length; j++, k++) {\n element.props[k] = points[i] ? rules[i].replace(/&\\f/g, parentRules[j]) : parentRules[j] + \" \" + rules[i];\n }\n }\n};\nvar removeLabel = function removeLabel(element) {\n if (element.type === 'decl') {\n var value = element.value;\n\n if ( // charcode for l\n value.charCodeAt(0) === 108 && // charcode for b\n value.charCodeAt(2) === 98) {\n // this ignores label\n element[\"return\"] = '';\n element.value = '';\n }\n }\n};\n\n/* eslint-disable no-fallthrough */\n\nfunction prefix(value, length) {\n switch (hash(value, length)) {\n // color-adjust\n case 5103:\n return WEBKIT + 'print-' + value + value;\n // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)\n\n case 5737:\n case 4201:\n case 3177:\n case 3433:\n case 1641:\n case 4457:\n case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break\n\n case 5572:\n case 6356:\n case 5844:\n case 3191:\n case 6645:\n case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,\n\n case 6391:\n case 5879:\n case 5623:\n case 6135:\n case 4599:\n case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)\n\n case 4215:\n case 6389:\n case 5109:\n case 5365:\n case 5621:\n case 3829:\n return WEBKIT + value + value;\n // appearance, user-select, transform, hyphens, text-size-adjust\n\n case 5349:\n case 4246:\n case 4810:\n case 6968:\n case 2756:\n return WEBKIT + value + MOZ + value + MS + value + value;\n // flex, flex-direction\n\n case 6828:\n case 4268:\n return WEBKIT + value + MS + value + value;\n // order\n\n case 6165:\n return WEBKIT + value + MS + 'flex-' + value + value;\n // align-items\n\n case 5187:\n return WEBKIT + value + replace(value, /(\\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2') + value;\n // align-self\n\n case 5443:\n return WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/, '') + value;\n // align-content\n\n case 4675:\n return WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/, '') + value;\n // flex-shrink\n\n case 5548:\n return WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value;\n // flex-basis\n\n case 5292:\n return WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value;\n // flex-grow\n\n case 6060:\n return WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value;\n // transition\n\n case 4554:\n return WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value;\n // cursor\n\n case 6187:\n return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1'), value, '') + value;\n // background, background-image\n\n case 5495:\n case 3959:\n return replace(value, /(image-set\\([^]*)/, WEBKIT + '$1' + '$`$1');\n // justify-content\n\n case 4968:\n return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + WEBKIT + value + value;\n // (margin|padding)-inline-(start|end)\n\n case 4095:\n case 3583:\n case 4068:\n case 2532:\n return replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value;\n // (min|max)?(width|height|inline-size|block-size)\n\n case 8116:\n case 7059:\n case 5753:\n case 5535:\n case 5445:\n case 5701:\n case 4933:\n case 4677:\n case 5533:\n case 5789:\n case 5021:\n case 4765:\n // stretch, max-content, min-content, fill-available\n if (strlen(value) - 1 - length > 6) switch (charat(value, length + 1)) {\n // (m)ax-content, (m)in-content\n case 109:\n // -\n if (charat(value, length + 4) !== 45) break;\n // (f)ill-available, (f)it-content\n\n case 102:\n return replace(value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value;\n // (s)tretch\n\n case 115:\n return ~indexof(value, 'stretch') ? prefix(replace(value, 'stretch', 'fill-available'), length) + value : value;\n }\n break;\n // position: sticky\n\n case 4949:\n // (s)ticky?\n if (charat(value, length + 1) !== 115) break;\n // display: (flex|inline-flex)\n\n case 6444:\n switch (charat(value, strlen(value) - 3 - (~indexof(value, '!important') && 10))) {\n // stic(k)y\n case 107:\n return replace(value, ':', ':' + WEBKIT) + value;\n // (inline-)?fl(e)x\n\n case 101:\n return replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + WEBKIT + (charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3') + value;\n }\n\n break;\n // writing-mode\n\n case 5936:\n switch (charat(value, length + 11)) {\n // vertical-l(r)\n case 114:\n return WEBKIT + value + MS + replace(value, /[svh]\\w+-[tblr]{2}/, 'tb') + value;\n // vertical-r(l)\n\n case 108:\n return WEBKIT + value + MS + replace(value, /[svh]\\w+-[tblr]{2}/, 'tb-rl') + value;\n // horizontal(-)tb\n\n case 45:\n return WEBKIT + value + MS + replace(value, /[svh]\\w+-[tblr]{2}/, 'lr') + value;\n }\n\n return WEBKIT + value + MS + value + value;\n }\n\n return value;\n}\n\nvar prefixer = function prefixer(element, index, children, callback) {\n if (element.length > -1) if (!element[\"return\"]) switch (element.type) {\n case DECLARATION:\n element[\"return\"] = prefix(element.value, element.length);\n break;\n\n case KEYFRAMES:\n return serialize([copy(element, {\n value: replace(element.value, '@', '@' + WEBKIT)\n })], callback);\n\n case RULESET:\n if (element.length) return combine(element.props, function (value) {\n switch (match(value, /(::plac\\w+|:read-\\w+)/)) {\n // :read-(only|write)\n case ':read-only':\n case ':read-write':\n return serialize([copy(element, {\n props: [replace(value, /:(read-\\w+)/, ':' + MOZ + '$1')]\n })], callback);\n // :placeholder\n\n case '::placeholder':\n return serialize([copy(element, {\n props: [replace(value, /:(plac\\w+)/, ':' + WEBKIT + 'input-$1')]\n }), copy(element, {\n props: [replace(value, /:(plac\\w+)/, ':' + MOZ + '$1')]\n }), copy(element, {\n props: [replace(value, /:(plac\\w+)/, MS + 'input-$1')]\n })], callback);\n }\n\n return '';\n });\n }\n};\n\nvar getServerStylisCache = isBrowser ? undefined : weakMemoize(function () {\n return memoize(function () {\n return {};\n });\n});\nvar defaultStylisPlugins = [prefixer];\n\nvar createCache = function createCache(options) {\n var key = options.key;\n\n if (isBrowser && key === 'css') {\n var ssrStyles = document.querySelectorAll(\"style[data-emotion]:not([data-s])\"); // get SSRed styles out of the way of React's hydration\n // document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)\n // note this very very intentionally targets all style elements regardless of the key to ensure\n // that creating a cache works inside of render of a React component\n\n Array.prototype.forEach.call(ssrStyles, function (node) {\n // we want to only move elements which have a space in the data-emotion attribute value\n // because that indicates that it is an Emotion 11 server-side rendered style elements\n // while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector\n // Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes)\n // so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles\n // will not result in the Emotion 10 styles being destroyed\n var dataEmotionAttribute = node.getAttribute('data-emotion');\n\n if (dataEmotionAttribute.indexOf(' ') === -1) {\n return;\n }\n\n document.head.appendChild(node);\n node.setAttribute('data-s', '');\n });\n }\n\n var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;\n\n var inserted = {};\n var container;\n var nodesToHydrate = [];\n\n if (isBrowser) {\n container = options.container || document.head;\n Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which\n // means that the style elements we're looking at are only Emotion 11 server-rendered style elements\n document.querySelectorAll(\"style[data-emotion^=\\\"\" + key + \" \\\"]\"), function (node) {\n var attrib = node.getAttribute(\"data-emotion\").split(' ');\n\n for (var i = 1; i < attrib.length; i++) {\n inserted[attrib[i]] = true;\n }\n\n nodesToHydrate.push(node);\n });\n }\n\n var _insert;\n\n var omnipresentPlugins = [compat, removeLabel];\n\n if (!getServerStylisCache) {\n var currentSheet;\n var finalizingPlugins = [stringify, rulesheet(function (rule) {\n currentSheet.insert(rule);\n })];\n var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));\n\n var stylis = function stylis(styles) {\n return serialize(compile(styles), serializer);\n };\n\n _insert = function insert(selector, serialized, sheet, shouldCache) {\n currentSheet = sheet;\n\n stylis(selector ? selector + \"{\" + serialized.styles + \"}\" : serialized.styles);\n\n if (shouldCache) {\n cache.inserted[serialized.name] = true;\n }\n };\n } else {\n var _finalizingPlugins = [stringify];\n\n var _serializer = middleware(omnipresentPlugins.concat(stylisPlugins, _finalizingPlugins));\n\n var _stylis = function _stylis(styles) {\n return serialize(compile(styles), _serializer);\n };\n\n var serverStylisCache = getServerStylisCache(stylisPlugins)(key);\n\n var getRules = function getRules(selector, serialized) {\n var name = serialized.name;\n\n if (serverStylisCache[name] === undefined) {\n serverStylisCache[name] = _stylis(selector ? selector + \"{\" + serialized.styles + \"}\" : serialized.styles);\n }\n\n return serverStylisCache[name];\n };\n\n _insert = function _insert(selector, serialized, sheet, shouldCache) {\n var name = serialized.name;\n var rules = getRules(selector, serialized);\n\n if (cache.compat === undefined) {\n // in regular mode, we don't set the styles on the inserted cache\n // since we don't need to and that would be wasting memory\n // we return them so that they are rendered in a style tag\n if (shouldCache) {\n cache.inserted[name] = true;\n }\n\n return rules;\n } else {\n // in compat mode, we put the styles on the inserted cache so\n // that emotion-server can pull out the styles\n // except when we don't want to cache it which was in Global but now\n // is nowhere but we don't want to do a major right now\n // and just in case we're going to leave the case here\n // it's also not affecting client side bundle size\n // so it's really not a big deal\n if (shouldCache) {\n cache.inserted[name] = rules;\n } else {\n return rules;\n }\n }\n };\n }\n\n var cache = {\n key: key,\n sheet: new StyleSheet({\n key: key,\n container: container,\n nonce: options.nonce,\n speedy: options.speedy,\n prepend: options.prepend,\n insertionPoint: options.insertionPoint\n }),\n nonce: options.nonce,\n inserted: inserted,\n registered: {},\n insert: _insert\n };\n cache.sheet.hydrate(nodesToHydrate);\n return cache;\n};\n\nexport { createCache as default };\n","/** @license React v16.13.1\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';var b=\"function\"===typeof Symbol&&Symbol.for,c=b?Symbol.for(\"react.element\"):60103,d=b?Symbol.for(\"react.portal\"):60106,e=b?Symbol.for(\"react.fragment\"):60107,f=b?Symbol.for(\"react.strict_mode\"):60108,g=b?Symbol.for(\"react.profiler\"):60114,h=b?Symbol.for(\"react.provider\"):60109,k=b?Symbol.for(\"react.context\"):60110,l=b?Symbol.for(\"react.async_mode\"):60111,m=b?Symbol.for(\"react.concurrent_mode\"):60111,n=b?Symbol.for(\"react.forward_ref\"):60112,p=b?Symbol.for(\"react.suspense\"):60113,q=b?\nSymbol.for(\"react.suspense_list\"):60120,r=b?Symbol.for(\"react.memo\"):60115,t=b?Symbol.for(\"react.lazy\"):60116,v=b?Symbol.for(\"react.block\"):60121,w=b?Symbol.for(\"react.fundamental\"):60117,x=b?Symbol.for(\"react.responder\"):60118,y=b?Symbol.for(\"react.scope\"):60119;\nfunction z(a){if(\"object\"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;\nexports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t};\nexports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p};\nexports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||\"object\"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z;\n","/** @license React v16.13.1\n * react-is.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\n\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n'use strict';\n\n// The Symbol used to tag the ReactElement-like types. If there is no native Symbol\n// nor polyfill, then a plain number is used for performance.\nvar hasSymbol = typeof Symbol === 'function' && Symbol.for;\nvar REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;\nvar REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;\nvar REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;\nvar REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;\nvar REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;\nvar REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;\nvar REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary\n// (unstable) APIs that have been removed. Can we remove the symbols?\n\nvar REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;\nvar REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;\nvar REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;\nvar REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;\nvar REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;\nvar REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;\nvar REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;\nvar REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;\nvar REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;\nvar REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;\nvar REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;\n\nfunction isValidElementType(type) {\n return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.\n type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);\n}\n\nfunction typeOf(object) {\n if (typeof object === 'object' && object !== null) {\n var $$typeof = object.$$typeof;\n\n switch ($$typeof) {\n case REACT_ELEMENT_TYPE:\n var type = object.type;\n\n switch (type) {\n case REACT_ASYNC_MODE_TYPE:\n case REACT_CONCURRENT_MODE_TYPE:\n case REACT_FRAGMENT_TYPE:\n case REACT_PROFILER_TYPE:\n case REACT_STRICT_MODE_TYPE:\n case REACT_SUSPENSE_TYPE:\n return type;\n\n default:\n var $$typeofType = type && type.$$typeof;\n\n switch ($$typeofType) {\n case REACT_CONTEXT_TYPE:\n case REACT_FORWARD_REF_TYPE:\n case REACT_LAZY_TYPE:\n case REACT_MEMO_TYPE:\n case REACT_PROVIDER_TYPE:\n return $$typeofType;\n\n default:\n return $$typeof;\n }\n\n }\n\n case REACT_PORTAL_TYPE:\n return $$typeof;\n }\n }\n\n return undefined;\n} // AsyncMode is deprecated along with isAsyncMode\n\nvar AsyncMode = REACT_ASYNC_MODE_TYPE;\nvar ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;\nvar ContextConsumer = REACT_CONTEXT_TYPE;\nvar ContextProvider = REACT_PROVIDER_TYPE;\nvar Element = REACT_ELEMENT_TYPE;\nvar ForwardRef = REACT_FORWARD_REF_TYPE;\nvar Fragment = REACT_FRAGMENT_TYPE;\nvar Lazy = REACT_LAZY_TYPE;\nvar Memo = REACT_MEMO_TYPE;\nvar Portal = REACT_PORTAL_TYPE;\nvar Profiler = REACT_PROFILER_TYPE;\nvar StrictMode = REACT_STRICT_MODE_TYPE;\nvar Suspense = REACT_SUSPENSE_TYPE;\nvar hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated\n\nfunction isAsyncMode(object) {\n {\n if (!hasWarnedAboutDeprecatedIsAsyncMode) {\n hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint\n\n console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');\n }\n }\n\n return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;\n}\nfunction isConcurrentMode(object) {\n return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;\n}\nfunction isContextConsumer(object) {\n return typeOf(object) === REACT_CONTEXT_TYPE;\n}\nfunction isContextProvider(object) {\n return typeOf(object) === REACT_PROVIDER_TYPE;\n}\nfunction isElement(object) {\n return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;\n}\nfunction isForwardRef(object) {\n return typeOf(object) === REACT_FORWARD_REF_TYPE;\n}\nfunction isFragment(object) {\n return typeOf(object) === REACT_FRAGMENT_TYPE;\n}\nfunction isLazy(object) {\n return typeOf(object) === REACT_LAZY_TYPE;\n}\nfunction isMemo(object) {\n return typeOf(object) === REACT_MEMO_TYPE;\n}\nfunction isPortal(object) {\n return typeOf(object) === REACT_PORTAL_TYPE;\n}\nfunction isProfiler(object) {\n return typeOf(object) === REACT_PROFILER_TYPE;\n}\nfunction isStrictMode(object) {\n return typeOf(object) === REACT_STRICT_MODE_TYPE;\n}\nfunction isSuspense(object) {\n return typeOf(object) === REACT_SUSPENSE_TYPE;\n}\n\nexports.AsyncMode = AsyncMode;\nexports.ConcurrentMode = ConcurrentMode;\nexports.ContextConsumer = ContextConsumer;\nexports.ContextProvider = ContextProvider;\nexports.Element = Element;\nexports.ForwardRef = ForwardRef;\nexports.Fragment = Fragment;\nexports.Lazy = Lazy;\nexports.Memo = Memo;\nexports.Portal = Portal;\nexports.Profiler = Profiler;\nexports.StrictMode = StrictMode;\nexports.Suspense = Suspense;\nexports.isAsyncMode = isAsyncMode;\nexports.isConcurrentMode = isConcurrentMode;\nexports.isContextConsumer = isContextConsumer;\nexports.isContextProvider = isContextProvider;\nexports.isElement = isElement;\nexports.isForwardRef = isForwardRef;\nexports.isFragment = isFragment;\nexports.isLazy = isLazy;\nexports.isMemo = isMemo;\nexports.isPortal = isPortal;\nexports.isProfiler = isProfiler;\nexports.isStrictMode = isStrictMode;\nexports.isSuspense = isSuspense;\nexports.isValidElementType = isValidElementType;\nexports.typeOf = typeOf;\n })();\n}\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","'use strict';\n\nvar reactIs = require('react-is');\n\n/**\n * Copyright 2015, Yahoo! Inc.\n * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.\n */\nvar REACT_STATICS = {\n childContextTypes: true,\n contextType: true,\n contextTypes: true,\n defaultProps: true,\n displayName: true,\n getDefaultProps: true,\n getDerivedStateFromError: true,\n getDerivedStateFromProps: true,\n mixins: true,\n propTypes: true,\n type: true\n};\nvar KNOWN_STATICS = {\n name: true,\n length: true,\n prototype: true,\n caller: true,\n callee: true,\n arguments: true,\n arity: true\n};\nvar FORWARD_REF_STATICS = {\n '$$typeof': true,\n render: true,\n defaultProps: true,\n displayName: true,\n propTypes: true\n};\nvar MEMO_STATICS = {\n '$$typeof': true,\n compare: true,\n defaultProps: true,\n displayName: true,\n propTypes: true,\n type: true\n};\nvar TYPE_STATICS = {};\nTYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;\nTYPE_STATICS[reactIs.Memo] = MEMO_STATICS;\n\nfunction getStatics(component) {\n // React v16.11 and below\n if (reactIs.isMemo(component)) {\n return MEMO_STATICS;\n } // React v16.12 and above\n\n\n return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;\n}\n\nvar defineProperty = Object.defineProperty;\nvar getOwnPropertyNames = Object.getOwnPropertyNames;\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\nvar getPrototypeOf = Object.getPrototypeOf;\nvar objectPrototype = Object.prototype;\nfunction hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {\n if (typeof sourceComponent !== 'string') {\n // don't hoist over string (html) components\n if (objectPrototype) {\n var inheritedComponent = getPrototypeOf(sourceComponent);\n\n if (inheritedComponent && inheritedComponent !== objectPrototype) {\n hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);\n }\n }\n\n var keys = getOwnPropertyNames(sourceComponent);\n\n if (getOwnPropertySymbols) {\n keys = keys.concat(getOwnPropertySymbols(sourceComponent));\n }\n\n var targetStatics = getStatics(targetComponent);\n var sourceStatics = getStatics(sourceComponent);\n\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n\n if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {\n var descriptor = getOwnPropertyDescriptor(sourceComponent, key);\n\n try {\n // Avoid failures from read-only properties\n defineProperty(targetComponent, key, descriptor);\n } catch (e) {}\n }\n }\n }\n\n return targetComponent;\n}\n\nmodule.exports = hoistNonReactStatics;\n","var isBrowser = typeof document !== 'undefined';\n\nfunction getRegisteredStyles(registered, registeredStyles, classNames) {\n var rawClassName = '';\n classNames.split(' ').forEach(function (className) {\n if (registered[className] !== undefined) {\n registeredStyles.push(registered[className] + \";\");\n } else if (className) {\n rawClassName += className + \" \";\n }\n });\n return rawClassName;\n}\nvar registerStyles = function registerStyles(cache, serialized, isStringTag) {\n var className = cache.key + \"-\" + serialized.name;\n\n if ( // we only need to add the styles to the registered cache if the\n // class name could be used further down\n // the tree but if it's a string tag, we know it won't\n // so we don't have to add it to registered cache.\n // this improves memory usage since we can avoid storing the whole style string\n (isStringTag === false || // we need to always store it if we're in compat mode and\n // in node since emotion-server relies on whether a style is in\n // the registered cache to know whether a style is global or not\n // also, note that this check will be dead code eliminated in the browser\n isBrowser === false && cache.compat !== undefined) && cache.registered[className] === undefined) {\n cache.registered[className] = serialized.styles;\n }\n};\nvar insertStyles = function insertStyles(cache, serialized, isStringTag) {\n registerStyles(cache, serialized, isStringTag);\n var className = cache.key + \"-\" + serialized.name;\n\n if (cache.inserted[serialized.name] === undefined) {\n var stylesForSSR = '';\n var current = serialized;\n\n do {\n var maybeStyles = cache.insert(serialized === current ? \".\" + className : '', current, cache.sheet, true);\n\n if (!isBrowser && maybeStyles !== undefined) {\n stylesForSSR += maybeStyles;\n }\n\n current = current.next;\n } while (current !== undefined);\n\n if (!isBrowser && stylesForSSR.length !== 0) {\n return stylesForSSR;\n }\n }\n};\n\nexport { getRegisteredStyles, insertStyles, registerStyles };\n","/* eslint-disable */\n// Inspired by https://github.com/garycourt/murmurhash-js\n// Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86\nfunction murmur2(str) {\n // 'm' and 'r' are mixing constants generated offline.\n // They're not really 'magic', they just happen to work well.\n // const m = 0x5bd1e995;\n // const r = 24;\n // Initialize the hash\n var h = 0; // Mix 4 bytes at a time into the hash\n\n var k,\n i = 0,\n len = str.length;\n\n for (; len >= 4; ++i, len -= 4) {\n k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;\n k =\n /* Math.imul(k, m): */\n (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16);\n k ^=\n /* k >>> r: */\n k >>> 24;\n h =\n /* Math.imul(k, m): */\n (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^\n /* Math.imul(h, m): */\n (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);\n } // Handle the last few bytes of the input array\n\n\n switch (len) {\n case 3:\n h ^= (str.charCodeAt(i + 2) & 0xff) << 16;\n\n case 2:\n h ^= (str.charCodeAt(i + 1) & 0xff) << 8;\n\n case 1:\n h ^= str.charCodeAt(i) & 0xff;\n h =\n /* Math.imul(h, m): */\n (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);\n } // Do a few final mixes of the hash to ensure the last few\n // bytes are well-incorporated.\n\n\n h ^= h >>> 13;\n h =\n /* Math.imul(h, m): */\n (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);\n return ((h ^ h >>> 15) >>> 0).toString(36);\n}\n\nexport { murmur2 as default };\n","var unitlessKeys = {\n animationIterationCount: 1,\n aspectRatio: 1,\n borderImageOutset: 1,\n borderImageSlice: 1,\n borderImageWidth: 1,\n boxFlex: 1,\n boxFlexGroup: 1,\n boxOrdinalGroup: 1,\n columnCount: 1,\n columns: 1,\n flex: 1,\n flexGrow: 1,\n flexPositive: 1,\n flexShrink: 1,\n flexNegative: 1,\n flexOrder: 1,\n gridRow: 1,\n gridRowEnd: 1,\n gridRowSpan: 1,\n gridRowStart: 1,\n gridColumn: 1,\n gridColumnEnd: 1,\n gridColumnSpan: 1,\n gridColumnStart: 1,\n msGridRow: 1,\n msGridRowSpan: 1,\n msGridColumn: 1,\n msGridColumnSpan: 1,\n fontWeight: 1,\n lineHeight: 1,\n opacity: 1,\n order: 1,\n orphans: 1,\n scale: 1,\n tabSize: 1,\n widows: 1,\n zIndex: 1,\n zoom: 1,\n WebkitLineClamp: 1,\n // SVG-related properties\n fillOpacity: 1,\n floodOpacity: 1,\n stopOpacity: 1,\n strokeDasharray: 1,\n strokeDashoffset: 1,\n strokeMiterlimit: 1,\n strokeOpacity: 1,\n strokeWidth: 1\n};\n\nexport { unitlessKeys as default };\n","import hashString from '@emotion/hash';\nimport unitless from '@emotion/unitless';\nimport memoize from '@emotion/memoize';\n\nvar isDevelopment = false;\n\nvar hyphenateRegex = /[A-Z]|^ms/g;\nvar animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g;\n\nvar isCustomProperty = function isCustomProperty(property) {\n return property.charCodeAt(1) === 45;\n};\n\nvar isProcessableValue = function isProcessableValue(value) {\n return value != null && typeof value !== 'boolean';\n};\n\nvar processStyleName = /* #__PURE__ */memoize(function (styleName) {\n return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase();\n});\n\nvar processStyleValue = function processStyleValue(key, value) {\n switch (key) {\n case 'animation':\n case 'animationName':\n {\n if (typeof value === 'string') {\n return value.replace(animationRegex, function (match, p1, p2) {\n cursor = {\n name: p1,\n styles: p2,\n next: cursor\n };\n return p1;\n });\n }\n }\n }\n\n if (unitless[key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0) {\n return value + 'px';\n }\n\n return value;\n};\n\nvar noComponentSelectorMessage = 'Component selectors can only be used in conjunction with ' + '@emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware ' + 'compiler transform.';\n\nfunction handleInterpolation(mergedProps, registered, interpolation) {\n if (interpolation == null) {\n return '';\n }\n\n var componentSelector = interpolation;\n\n if (componentSelector.__emotion_styles !== undefined) {\n\n return componentSelector;\n }\n\n switch (typeof interpolation) {\n case 'boolean':\n {\n return '';\n }\n\n case 'object':\n {\n var keyframes = interpolation;\n\n if (keyframes.anim === 1) {\n cursor = {\n name: keyframes.name,\n styles: keyframes.styles,\n next: cursor\n };\n return keyframes.name;\n }\n\n var serializedStyles = interpolation;\n\n if (serializedStyles.styles !== undefined) {\n var next = serializedStyles.next;\n\n if (next !== undefined) {\n // not the most efficient thing ever but this is a pretty rare case\n // and there will be very few iterations of this generally\n while (next !== undefined) {\n cursor = {\n name: next.name,\n styles: next.styles,\n next: cursor\n };\n next = next.next;\n }\n }\n\n var styles = serializedStyles.styles + \";\";\n return styles;\n }\n\n return createStringFromObject(mergedProps, registered, interpolation);\n }\n\n case 'function':\n {\n if (mergedProps !== undefined) {\n var previousCursor = cursor;\n var result = interpolation(mergedProps);\n cursor = previousCursor;\n return handleInterpolation(mergedProps, registered, result);\n }\n\n break;\n }\n } // finalize string values (regular strings and functions interpolated into css calls)\n\n\n var asString = interpolation;\n\n if (registered == null) {\n return asString;\n }\n\n var cached = registered[asString];\n return cached !== undefined ? cached : asString;\n}\n\nfunction createStringFromObject(mergedProps, registered, obj) {\n var string = '';\n\n if (Array.isArray(obj)) {\n for (var i = 0; i < obj.length; i++) {\n string += handleInterpolation(mergedProps, registered, obj[i]) + \";\";\n }\n } else {\n for (var key in obj) {\n var value = obj[key];\n\n if (typeof value !== 'object') {\n var asString = value;\n\n if (registered != null && registered[asString] !== undefined) {\n string += key + \"{\" + registered[asString] + \"}\";\n } else if (isProcessableValue(asString)) {\n string += processStyleName(key) + \":\" + processStyleValue(key, asString) + \";\";\n }\n } else {\n if (key === 'NO_COMPONENT_SELECTOR' && isDevelopment) {\n throw new Error(noComponentSelectorMessage);\n }\n\n if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) {\n for (var _i = 0; _i < value.length; _i++) {\n if (isProcessableValue(value[_i])) {\n string += processStyleName(key) + \":\" + processStyleValue(key, value[_i]) + \";\";\n }\n }\n } else {\n var interpolated = handleInterpolation(mergedProps, registered, value);\n\n switch (key) {\n case 'animation':\n case 'animationName':\n {\n string += processStyleName(key) + \":\" + interpolated + \";\";\n break;\n }\n\n default:\n {\n\n string += key + \"{\" + interpolated + \"}\";\n }\n }\n }\n }\n }\n }\n\n return string;\n}\n\nvar labelPattern = /label:\\s*([^\\s;{]+)\\s*(;|$)/g; // this is the cursor for keyframes\n// keyframes are stored on the SerializedStyles object as a linked list\n\nvar cursor;\nfunction serializeStyles(args, registered, mergedProps) {\n if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) {\n return args[0];\n }\n\n var stringMode = true;\n var styles = '';\n cursor = undefined;\n var strings = args[0];\n\n if (strings == null || strings.raw === undefined) {\n stringMode = false;\n styles += handleInterpolation(mergedProps, registered, strings);\n } else {\n var asTemplateStringsArr = strings;\n\n styles += asTemplateStringsArr[0];\n } // we start at 1 since we've already handled the first arg\n\n\n for (var i = 1; i < args.length; i++) {\n styles += handleInterpolation(mergedProps, registered, args[i]);\n\n if (stringMode) {\n var templateStringsArr = strings;\n\n styles += templateStringsArr[i];\n }\n } // using a global regex with .exec is stateful so lastIndex has to be reset each time\n\n\n labelPattern.lastIndex = 0;\n var identifierName = '';\n var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5\n\n while ((match = labelPattern.exec(styles)) !== null) {\n identifierName += '-' + match[1];\n }\n\n var name = hashString(styles) + identifierName;\n\n return {\n name: name,\n styles: styles,\n next: cursor\n };\n}\n\nexport { serializeStyles };\n","import * as React from 'react';\n\nvar isBrowser = typeof document !== 'undefined';\n\nvar syncFallback = function syncFallback(create) {\n return create();\n};\n\nvar useInsertionEffect = React['useInsertion' + 'Effect'] ? React['useInsertion' + 'Effect'] : false;\nvar useInsertionEffectAlwaysWithSyncFallback = !isBrowser ? syncFallback : useInsertionEffect || syncFallback;\nvar useInsertionEffectWithLayoutFallback = useInsertionEffect || React.useLayoutEffect;\n\nexport { useInsertionEffectAlwaysWithSyncFallback, useInsertionEffectWithLayoutFallback };\n","import * as React from 'react';\nimport { useContext, forwardRef } from 'react';\nimport createCache from '@emotion/cache';\nimport _extends from '@babel/runtime/helpers/esm/extends';\nimport weakMemoize from '@emotion/weak-memoize';\nimport hoistNonReactStatics from '../_isolated-hnrs/dist/emotion-react-_isolated-hnrs.esm.js';\nimport { getRegisteredStyles, registerStyles, insertStyles } from '@emotion/utils';\nimport { serializeStyles } from '@emotion/serialize';\nimport { useInsertionEffectAlwaysWithSyncFallback } from '@emotion/use-insertion-effect-with-fallbacks';\n\nvar isDevelopment = false;\n\nvar isBrowser = typeof document !== 'undefined';\n\nvar EmotionCacheContext = /* #__PURE__ */React.createContext( // we're doing this to avoid preconstruct's dead code elimination in this one case\n// because this module is primarily intended for the browser and node\n// but it's also required in react native and similar environments sometimes\n// and we could have a special build just for that\n// but this is much easier and the native packages\n// might use a different theme context in the future anyway\ntypeof HTMLElement !== 'undefined' ? /* #__PURE__ */createCache({\n key: 'css'\n}) : null);\n\nvar CacheProvider = EmotionCacheContext.Provider;\nvar __unsafe_useEmotionCache = function useEmotionCache() {\n return useContext(EmotionCacheContext);\n};\n\nvar withEmotionCache = function withEmotionCache(func) {\n return /*#__PURE__*/forwardRef(function (props, ref) {\n // the cache will never be null in the browser\n var cache = useContext(EmotionCacheContext);\n return func(props, cache, ref);\n });\n};\n\nif (!isBrowser) {\n withEmotionCache = function withEmotionCache(func) {\n return function (props) {\n var cache = useContext(EmotionCacheContext);\n\n if (cache === null) {\n // yes, we're potentially creating this on every render\n // it doesn't actually matter though since it's only on the server\n // so there will only every be a single render\n // that could change in the future because of suspense and etc. but for now,\n // this works and i don't want to optimise for a future thing that we aren't sure about\n cache = createCache({\n key: 'css'\n });\n return /*#__PURE__*/React.createElement(EmotionCacheContext.Provider, {\n value: cache\n }, func(props, cache));\n } else {\n return func(props, cache);\n }\n };\n };\n}\n\nvar ThemeContext = /* #__PURE__ */React.createContext({});\n\nvar useTheme = function useTheme() {\n return React.useContext(ThemeContext);\n};\n\nvar getTheme = function getTheme(outerTheme, theme) {\n if (typeof theme === 'function') {\n var mergedTheme = theme(outerTheme);\n\n return mergedTheme;\n }\n\n return _extends({}, outerTheme, theme);\n};\n\nvar createCacheWithTheme = /* #__PURE__ */weakMemoize(function (outerTheme) {\n return weakMemoize(function (theme) {\n return getTheme(outerTheme, theme);\n });\n});\nvar ThemeProvider = function ThemeProvider(props) {\n var theme = React.useContext(ThemeContext);\n\n if (props.theme !== theme) {\n theme = createCacheWithTheme(theme)(props.theme);\n }\n\n return /*#__PURE__*/React.createElement(ThemeContext.Provider, {\n value: theme\n }, props.children);\n};\nfunction withTheme(Component) {\n var componentName = Component.displayName || Component.name || 'Component';\n var WithTheme = /*#__PURE__*/React.forwardRef(function render(props, ref) {\n var theme = React.useContext(ThemeContext);\n return /*#__PURE__*/React.createElement(Component, _extends({\n theme: theme,\n ref: ref\n }, props));\n });\n WithTheme.displayName = \"WithTheme(\" + componentName + \")\";\n return hoistNonReactStatics(WithTheme, Component);\n}\n\nvar hasOwn = {}.hasOwnProperty;\n\nvar typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__';\nvar createEmotionProps = function createEmotionProps(type, props) {\n\n var newProps = {};\n\n for (var _key in props) {\n if (hasOwn.call(props, _key)) {\n newProps[_key] = props[_key];\n }\n }\n\n newProps[typePropName] = type; // Runtime labeling is an opt-in feature because:\n\n return newProps;\n};\n\nvar Insertion = function Insertion(_ref) {\n var cache = _ref.cache,\n serialized = _ref.serialized,\n isStringTag = _ref.isStringTag;\n registerStyles(cache, serialized, isStringTag);\n var rules = useInsertionEffectAlwaysWithSyncFallback(function () {\n return insertStyles(cache, serialized, isStringTag);\n });\n\n if (!isBrowser && rules !== undefined) {\n var _ref2;\n\n var serializedNames = serialized.name;\n var next = serialized.next;\n\n while (next !== undefined) {\n serializedNames += ' ' + next.name;\n next = next.next;\n }\n\n return /*#__PURE__*/React.createElement(\"style\", (_ref2 = {}, _ref2[\"data-emotion\"] = cache.key + \" \" + serializedNames, _ref2.dangerouslySetInnerHTML = {\n __html: rules\n }, _ref2.nonce = cache.sheet.nonce, _ref2));\n }\n\n return null;\n};\n\nvar Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {\n var cssProp = props.css; // so that using `css` from `emotion` and passing the result to the css prop works\n // not passing the registered cache to serializeStyles because it would\n // make certain babel optimisations not possible\n\n if (typeof cssProp === 'string' && cache.registered[cssProp] !== undefined) {\n cssProp = cache.registered[cssProp];\n }\n\n var WrappedComponent = props[typePropName];\n var registeredStyles = [cssProp];\n var className = '';\n\n if (typeof props.className === 'string') {\n className = getRegisteredStyles(cache.registered, registeredStyles, props.className);\n } else if (props.className != null) {\n className = props.className + \" \";\n }\n\n var serialized = serializeStyles(registeredStyles, undefined, React.useContext(ThemeContext));\n\n className += cache.key + \"-\" + serialized.name;\n var newProps = {};\n\n for (var _key2 in props) {\n if (hasOwn.call(props, _key2) && _key2 !== 'css' && _key2 !== typePropName && (!isDevelopment )) {\n newProps[_key2] = props[_key2];\n }\n }\n\n newProps.className = className;\n\n if (ref) {\n newProps.ref = ref;\n }\n\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Insertion, {\n cache: cache,\n serialized: serialized,\n isStringTag: typeof WrappedComponent === 'string'\n }), /*#__PURE__*/React.createElement(WrappedComponent, newProps));\n});\n\nvar Emotion$1 = Emotion;\n\nexport { CacheProvider as C, Emotion$1 as E, ThemeContext as T, __unsafe_useEmotionCache as _, isDevelopment as a, ThemeProvider as b, createEmotionProps as c, withTheme as d, hasOwn as h, isBrowser as i, useTheme as u, withEmotionCache as w };\n","import { h as hasOwn, E as Emotion, c as createEmotionProps, w as withEmotionCache, T as ThemeContext, i as isBrowser, a as isDevelopment } from './emotion-element-d59e098f.esm.js';\nexport { C as CacheProvider, T as ThemeContext, b as ThemeProvider, _ as __unsafe_useEmotionCache, u as useTheme, w as withEmotionCache, d as withTheme } from './emotion-element-d59e098f.esm.js';\nimport * as React from 'react';\nimport { insertStyles, registerStyles, getRegisteredStyles } from '@emotion/utils';\nimport { useInsertionEffectWithLayoutFallback, useInsertionEffectAlwaysWithSyncFallback } from '@emotion/use-insertion-effect-with-fallbacks';\nimport { serializeStyles } from '@emotion/serialize';\nimport '@emotion/cache';\nimport '@babel/runtime/helpers/extends';\nimport '@emotion/weak-memoize';\nimport '../_isolated-hnrs/dist/emotion-react-_isolated-hnrs.esm.js';\nimport 'hoist-non-react-statics';\n\nvar jsx = function jsx(type, props) {\n // eslint-disable-next-line prefer-rest-params\n var args = arguments;\n\n if (props == null || !hasOwn.call(props, 'css')) {\n return React.createElement.apply(undefined, args);\n }\n\n var argsLength = args.length;\n var createElementArgArray = new Array(argsLength);\n createElementArgArray[0] = Emotion;\n createElementArgArray[1] = createEmotionProps(type, props);\n\n for (var i = 2; i < argsLength; i++) {\n createElementArgArray[i] = args[i];\n }\n\n return React.createElement.apply(null, createElementArgArray);\n};\n\n(function (_jsx) {\n var JSX;\n\n (function (_JSX) {})(JSX || (JSX = _jsx.JSX || (_jsx.JSX = {})));\n})(jsx || (jsx = {}));\n\n// initial render from browser, insertBefore context.sheet.tags[0] or if a style hasn't been inserted there yet, appendChild\n// initial client-side render from SSR, use place of hydrating tag\n\nvar Global = /* #__PURE__ */withEmotionCache(function (props, cache) {\n\n var styles = props.styles;\n var serialized = serializeStyles([styles], undefined, React.useContext(ThemeContext));\n\n if (!isBrowser) {\n var _ref;\n\n var serializedNames = serialized.name;\n var serializedStyles = serialized.styles;\n var next = serialized.next;\n\n while (next !== undefined) {\n serializedNames += ' ' + next.name;\n serializedStyles += next.styles;\n next = next.next;\n }\n\n var shouldCache = cache.compat === true;\n var rules = cache.insert(\"\", {\n name: serializedNames,\n styles: serializedStyles\n }, cache.sheet, shouldCache);\n\n if (shouldCache) {\n return null;\n }\n\n return /*#__PURE__*/React.createElement(\"style\", (_ref = {}, _ref[\"data-emotion\"] = cache.key + \"-global \" + serializedNames, _ref.dangerouslySetInnerHTML = {\n __html: rules\n }, _ref.nonce = cache.sheet.nonce, _ref));\n } // yes, i know these hooks are used conditionally\n // but it is based on a constant that will never change at runtime\n // it's effectively like having two implementations and switching them out\n // so it's not actually breaking anything\n\n\n var sheetRef = React.useRef();\n useInsertionEffectWithLayoutFallback(function () {\n var key = cache.key + \"-global\"; // use case of https://github.com/emotion-js/emotion/issues/2675\n\n var sheet = new cache.sheet.constructor({\n key: key,\n nonce: cache.sheet.nonce,\n container: cache.sheet.container,\n speedy: cache.sheet.isSpeedy\n });\n var rehydrating = false;\n var node = document.querySelector(\"style[data-emotion=\\\"\" + key + \" \" + serialized.name + \"\\\"]\");\n\n if (cache.sheet.tags.length) {\n sheet.before = cache.sheet.tags[0];\n }\n\n if (node !== null) {\n rehydrating = true; // clear the hash so this node won't be recognizable as rehydratable by other <Global/>s\n\n node.setAttribute('data-emotion', key);\n sheet.hydrate([node]);\n }\n\n sheetRef.current = [sheet, rehydrating];\n return function () {\n sheet.flush();\n };\n }, [cache]);\n useInsertionEffectWithLayoutFallback(function () {\n var sheetRefCurrent = sheetRef.current;\n var sheet = sheetRefCurrent[0],\n rehydrating = sheetRefCurrent[1];\n\n if (rehydrating) {\n sheetRefCurrent[1] = false;\n return;\n }\n\n if (serialized.next !== undefined) {\n // insert keyframes\n insertStyles(cache, serialized.next, true);\n }\n\n if (sheet.tags.length) {\n // if this doesn't exist then it will be null so the style element will be appended\n var element = sheet.tags[sheet.tags.length - 1].nextElementSibling;\n sheet.before = element;\n sheet.flush();\n }\n\n cache.insert(\"\", serialized, sheet, false);\n }, [cache, serialized.name]);\n return null;\n});\n\nfunction css() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return serializeStyles(args);\n}\n\nfunction keyframes() {\n var insertable = css.apply(void 0, arguments);\n var name = \"animation-\" + insertable.name;\n return {\n name: name,\n styles: \"@keyframes \" + name + \"{\" + insertable.styles + \"}\",\n anim: 1,\n toString: function toString() {\n return \"_EMO_\" + this.name + \"_\" + this.styles + \"_EMO_\";\n }\n };\n}\n\nvar classnames = function classnames(args) {\n var len = args.length;\n var i = 0;\n var cls = '';\n\n for (; i < len; i++) {\n var arg = args[i];\n if (arg == null) continue;\n var toAdd = void 0;\n\n switch (typeof arg) {\n case 'boolean':\n break;\n\n case 'object':\n {\n if (Array.isArray(arg)) {\n toAdd = classnames(arg);\n } else {\n\n toAdd = '';\n\n for (var k in arg) {\n if (arg[k] && k) {\n toAdd && (toAdd += ' ');\n toAdd += k;\n }\n }\n }\n\n break;\n }\n\n default:\n {\n toAdd = arg;\n }\n }\n\n if (toAdd) {\n cls && (cls += ' ');\n cls += toAdd;\n }\n }\n\n return cls;\n};\n\nfunction merge(registered, css, className) {\n var registeredStyles = [];\n var rawClassName = getRegisteredStyles(registered, registeredStyles, className);\n\n if (registeredStyles.length < 2) {\n return className;\n }\n\n return rawClassName + css(registeredStyles);\n}\n\nvar Insertion = function Insertion(_ref) {\n var cache = _ref.cache,\n serializedArr = _ref.serializedArr;\n var rules = useInsertionEffectAlwaysWithSyncFallback(function () {\n var rules = '';\n\n for (var i = 0; i < serializedArr.length; i++) {\n var res = insertStyles(cache, serializedArr[i], false);\n\n if (!isBrowser && res !== undefined) {\n rules += res;\n }\n }\n\n if (!isBrowser) {\n return rules;\n }\n });\n\n if (!isBrowser && rules.length !== 0) {\n var _ref2;\n\n return /*#__PURE__*/React.createElement(\"style\", (_ref2 = {}, _ref2[\"data-emotion\"] = cache.key + \" \" + serializedArr.map(function (serialized) {\n return serialized.name;\n }).join(' '), _ref2.dangerouslySetInnerHTML = {\n __html: rules\n }, _ref2.nonce = cache.sheet.nonce, _ref2));\n }\n\n return null;\n};\n\nvar ClassNames = /* #__PURE__ */withEmotionCache(function (props, cache) {\n var hasRendered = false;\n var serializedArr = [];\n\n var css = function css() {\n if (hasRendered && isDevelopment) {\n throw new Error('css can only be used during render');\n }\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var serialized = serializeStyles(args, cache.registered);\n serializedArr.push(serialized); // registration has to happen here as the result of this might get consumed by `cx`\n\n registerStyles(cache, serialized, false);\n return cache.key + \"-\" + serialized.name;\n };\n\n var cx = function cx() {\n if (hasRendered && isDevelopment) {\n throw new Error('cx can only be used during render');\n }\n\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n return merge(cache.registered, css, classnames(args));\n };\n\n var content = {\n css: css,\n cx: cx,\n theme: React.useContext(ThemeContext)\n };\n var ele = props.children(content);\n hasRendered = true;\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Insertion, {\n cache: cache,\n serializedArr: serializedArr\n }), ele);\n});\n\nexport { ClassNames, Global, jsx as createElement, css, jsx, keyframes };\n","import createCache from '@emotion/cache';\nimport { serializeStyles } from '@emotion/serialize';\nimport { getRegisteredStyles, insertStyles } from '@emotion/utils';\n\nfunction insertWithoutScoping(cache, serialized) {\n if (cache.inserted[serialized.name] === undefined) {\n return cache.insert('', serialized, cache.sheet, true);\n }\n}\n\nfunction merge(registered, css, className) {\n var registeredStyles = [];\n var rawClassName = getRegisteredStyles(registered, registeredStyles, className);\n\n if (registeredStyles.length < 2) {\n return className;\n }\n\n return rawClassName + css(registeredStyles);\n}\n\nvar createEmotion = function createEmotion(options) {\n var cache = createCache(options);\n\n cache.sheet.speedy = function (value) {\n\n this.isSpeedy = value;\n };\n\n cache.compat = true;\n\n var css = function css() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var serialized = serializeStyles(args, cache.registered, undefined);\n insertStyles(cache, serialized, false);\n return cache.key + \"-\" + serialized.name;\n };\n\n var keyframes = function keyframes() {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n var serialized = serializeStyles(args, cache.registered);\n var animation = \"animation-\" + serialized.name;\n insertWithoutScoping(cache, {\n name: serialized.name,\n styles: \"@keyframes \" + animation + \"{\" + serialized.styles + \"}\"\n });\n return animation;\n };\n\n var injectGlobal = function injectGlobal() {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n\n var serialized = serializeStyles(args, cache.registered);\n insertWithoutScoping(cache, serialized);\n };\n\n var cx = function cx() {\n for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n args[_key4] = arguments[_key4];\n }\n\n return merge(cache.registered, css, classnames(args));\n };\n\n return {\n css: css,\n cx: cx,\n injectGlobal: injectGlobal,\n keyframes: keyframes,\n hydrate: function hydrate(ids) {\n ids.forEach(function (key) {\n cache.inserted[key] = true;\n });\n },\n flush: function flush() {\n cache.registered = {};\n cache.inserted = {};\n cache.sheet.flush();\n },\n sheet: cache.sheet,\n cache: cache,\n getRegisteredStyles: getRegisteredStyles.bind(null, cache.registered),\n merge: merge.bind(null, cache.registered, css)\n };\n};\n\nvar classnames = function classnames(args) {\n var cls = '';\n\n for (var i = 0; i < args.length; i++) {\n var arg = args[i];\n if (arg == null) continue;\n var toAdd = void 0;\n\n switch (typeof arg) {\n case 'boolean':\n break;\n\n case 'object':\n {\n if (Array.isArray(arg)) {\n toAdd = classnames(arg);\n } else {\n toAdd = '';\n\n for (var k in arg) {\n if (arg[k] && k) {\n toAdd && (toAdd += ' ');\n toAdd += k;\n }\n }\n }\n\n break;\n }\n\n default:\n {\n toAdd = arg;\n }\n }\n\n if (toAdd) {\n cls && (cls += ' ');\n cls += toAdd;\n }\n }\n\n return cls;\n};\n\nexport { createEmotion as default };\n","import createEmotion from '../create-instance/dist/emotion-css-create-instance.esm.js';\nimport '@emotion/cache';\nimport '@emotion/serialize';\nimport '@emotion/utils';\n\nvar _createEmotion = createEmotion({\n key: 'css'\n}),\n flush = _createEmotion.flush,\n hydrate = _createEmotion.hydrate,\n cx = _createEmotion.cx,\n merge = _createEmotion.merge,\n getRegisteredStyles = _createEmotion.getRegisteredStyles,\n injectGlobal = _createEmotion.injectGlobal,\n keyframes = _createEmotion.keyframes,\n css = _createEmotion.css,\n sheet = _createEmotion.sheet,\n cache = _createEmotion.cache;\n\nexport { cache, css, cx, flush, getRegisteredStyles, hydrate, injectGlobal, keyframes, merge, sheet };\n","// packages/components/src/utils/hooks/use-cx.ts\nimport { __unsafe_useEmotionCache as useEmotionCache } from \"@emotion/react\";\nimport { insertStyles } from \"@emotion/utils\";\nimport { cx as innerCx } from \"@emotion/css\";\nimport { useCallback } from \"@wordpress/element\";\nvar isSerializedStyles = (o) => typeof o !== \"undefined\" && o !== null && [\"name\", \"styles\"].every((p) => typeof o[p] !== \"undefined\");\nvar useCx = () => {\n const cache = useEmotionCache();\n const cx = useCallback((...classNames) => {\n if (cache === null) {\n throw new Error(\"The `useCx` hook should be only used within a valid Emotion Cache Context\");\n }\n return innerCx(...classNames.map((arg) => {\n if (isSerializedStyles(arg)) {\n insertStyles(cache, arg, false);\n return `${cache.key}-${arg.name}`;\n }\n return arg;\n }));\n }, [cache]);\n return cx;\n};\nexport {\n useCx\n};\n//# sourceMappingURL=use-cx.mjs.map\n","/**\n * Memize options object.\n *\n * @typedef MemizeOptions\n *\n * @property {number} [maxSize] Maximum size of the cache.\n */\n\n/**\n * Internal cache entry.\n *\n * @typedef MemizeCacheNode\n *\n * @property {?MemizeCacheNode|undefined} [prev] Previous node.\n * @property {?MemizeCacheNode|undefined} [next] Next node.\n * @property {Array<*>} args Function arguments for cache\n * entry.\n * @property {*} val Function result.\n */\n\n/**\n * Properties of the enhanced function for controlling cache.\n *\n * @typedef MemizeMemoizedFunction\n *\n * @property {()=>void} clear Clear the cache.\n */\n\n/**\n * Accepts a function to be memoized, and returns a new memoized function, with\n * optional options.\n *\n * @template {(...args: any[]) => any} F\n *\n * @param {F} fn Function to memoize.\n * @param {MemizeOptions} [options] Options object.\n *\n * @return {((...args: Parameters<F>) => ReturnType<F>) & MemizeMemoizedFunction} Memoized function.\n */\nfunction memize(fn, options) {\n\tvar size = 0;\n\n\t/** @type {?MemizeCacheNode|undefined} */\n\tvar head;\n\n\t/** @type {?MemizeCacheNode|undefined} */\n\tvar tail;\n\n\toptions = options || {};\n\n\tfunction memoized(/* ...args */) {\n\t\tvar node = head,\n\t\t\tlen = arguments.length,\n\t\t\targs,\n\t\t\ti;\n\n\t\tsearchCache: while (node) {\n\t\t\t// Perform a shallow equality test to confirm that whether the node\n\t\t\t// under test is a candidate for the arguments passed. Two arrays\n\t\t\t// are shallowly equal if their length matches and each entry is\n\t\t\t// strictly equal between the two sets. Avoid abstracting to a\n\t\t\t// function which could incur an arguments leaking deoptimization.\n\n\t\t\t// Check whether node arguments match arguments length\n\t\t\tif (node.args.length !== arguments.length) {\n\t\t\t\tnode = node.next;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Check whether node arguments match arguments values\n\t\t\tfor (i = 0; i < len; i++) {\n\t\t\t\tif (node.args[i] !== arguments[i]) {\n\t\t\t\t\tnode = node.next;\n\t\t\t\t\tcontinue searchCache;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// At this point we can assume we've found a match\n\n\t\t\t// Surface matched node to head if not already\n\t\t\tif (node !== head) {\n\t\t\t\t// As tail, shift to previous. Must only shift if not also\n\t\t\t\t// head, since if both head and tail, there is no previous.\n\t\t\t\tif (node === tail) {\n\t\t\t\t\ttail = node.prev;\n\t\t\t\t}\n\n\t\t\t\t// Adjust siblings to point to each other. If node was tail,\n\t\t\t\t// this also handles new tail's empty `next` assignment.\n\t\t\t\t/** @type {MemizeCacheNode} */ (node.prev).next = node.next;\n\t\t\t\tif (node.next) {\n\t\t\t\t\tnode.next.prev = node.prev;\n\t\t\t\t}\n\n\t\t\t\tnode.next = head;\n\t\t\t\tnode.prev = null;\n\t\t\t\t/** @type {MemizeCacheNode} */ (head).prev = node;\n\t\t\t\thead = node;\n\t\t\t}\n\n\t\t\t// Return immediately\n\t\t\treturn node.val;\n\t\t}\n\n\t\t// No cached value found. Continue to insertion phase:\n\n\t\t// Create a copy of arguments (avoid leaking deoptimization)\n\t\targs = new Array(len);\n\t\tfor (i = 0; i < len; i++) {\n\t\t\targs[i] = arguments[i];\n\t\t}\n\n\t\tnode = {\n\t\t\targs: args,\n\n\t\t\t// Generate the result from original function\n\t\t\tval: fn.apply(null, args),\n\t\t};\n\n\t\t// Don't need to check whether node is already head, since it would\n\t\t// have been returned above already if it was\n\n\t\t// Shift existing head down list\n\t\tif (head) {\n\t\t\thead.prev = node;\n\t\t\tnode.next = head;\n\t\t} else {\n\t\t\t// If no head, follows that there's no tail (at initial or reset)\n\t\t\ttail = node;\n\t\t}\n\n\t\t// Trim tail if we're reached max size and are pending cache insertion\n\t\tif (size === /** @type {MemizeOptions} */ (options).maxSize) {\n\t\t\ttail = /** @type {MemizeCacheNode} */ (tail).prev;\n\t\t\t/** @type {MemizeCacheNode} */ (tail).next = null;\n\t\t} else {\n\t\t\tsize++;\n\t\t}\n\n\t\thead = node;\n\n\t\treturn node.val;\n\t}\n\n\tmemoized.clear = function () {\n\t\thead = null;\n\t\ttail = null;\n\t\tsize = 0;\n\t};\n\n\t// Ignore reason: There's not a clear solution to create an intersection of\n\t// the function with additional properties, where the goal is to retain the\n\t// function signature of the incoming argument and add control properties\n\t// on the return value.\n\n\t// @ts-ignore\n\treturn memoized;\n}\n\nexport { memize as default };\n","// packages/components/src/utils/colors-values.js\nvar white = \"#fff\";\nvar GRAY = {\n 900: \"#1e1e1e\",\n 800: \"#2f2f2f\",\n /** Meets 4.6:1 text contrast against white. */\n 700: \"#757575\",\n /** Meets 3:1 UI or large text contrast against white. */\n 600: \"#949494\",\n 400: \"#ccc\",\n /** Used for most borders. */\n 300: \"#ddd\",\n /** Used sparingly for light borders. */\n 200: \"#e0e0e0\",\n /** Used for light gray backgrounds. */\n 100: \"#f0f0f0\"\n};\nvar ALERT = {\n yellow: \"#f0b849\",\n red: \"#d94f4f\",\n green: \"#4ab866\"\n};\nvar THEME = {\n accent: `var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9))`,\n accentDarker10: `var(--wp-components-color-accent-darker-10, var(--wp-admin-theme-color-darker-10, #2145e6))`,\n accentDarker20: `var(--wp-components-color-accent-darker-20, var(--wp-admin-theme-color-darker-20, #183ad6))`,\n /** Used when placing text on the accent color. */\n accentInverted: `var(--wp-components-color-accent-inverted, var(--wpds-color-foreground-interactive-brand-strong, #fff))`,\n background: `var(--wp-components-color-background, var(--wpds-color-background-surface-neutral-strong, #fff))`,\n foreground: `var(--wp-components-color-foreground, var(--wpds-color-foreground-content-neutral, #1e1e1e))`,\n /** Used when placing text on the foreground color. */\n foregroundInverted: `var(--wp-components-color-foreground-inverted, var(--wpds-color-background-surface-neutral, #fcfcfc))`,\n gray: {\n /** @deprecated Use `COLORS.theme.foreground` instead. */\n 900: `var(--wp-components-color-foreground, var(--wpds-color-foreground-content-neutral, #1e1e1e))`,\n 800: `var(--wp-components-color-gray-800, var(--wpds-color-foreground-content-neutral, #1e1e1e))`,\n 700: `var(--wp-components-color-gray-700, var(--wpds-color-foreground-content-neutral-weak, #707070))`,\n 600: `var(--wp-components-color-gray-600, var(--wpds-color-stroke-interactive-neutral, #8d8d8d))`,\n 400: `var(--wp-components-color-gray-400, var(--wpds-color-stroke-interactive-neutral, #8d8d8d))`,\n 300: `var(--wp-components-color-gray-300, var(--wpds-color-stroke-surface-neutral, #dbdbdb))`,\n 200: `var(--wp-components-color-gray-200, var(--wpds-color-stroke-surface-neutral, #dbdbdb))`,\n 100: `var(--wp-components-color-gray-100, var(--wpds-color-background-surface-neutral, #fcfcfc))`\n }\n};\nvar UI = {\n background: THEME.background,\n backgroundDisabled: THEME.gray[100],\n border: THEME.gray[600],\n borderHover: THEME.gray[700],\n borderFocus: THEME.accent,\n borderDisabled: THEME.gray[400],\n textDisabled: THEME.gray[600],\n // Matches @wordpress/base-styles\n darkGrayPlaceholder: `color-mix(in srgb, ${THEME.foreground}, transparent 38%)`,\n lightGrayPlaceholder: `color-mix(in srgb, ${THEME.background}, transparent 35%)`\n};\nvar COLORS = Object.freeze({\n /**\n * The main gray color object.\n *\n * @deprecated Use semantic aliases in `COLORS.ui` or theme-ready variables in `COLORS.theme.gray`.\n */\n gray: GRAY,\n // TODO: Stop exporting this when everything is migrated to `theme` or `ui`\n /**\n * @deprecated Prefer theme-ready variables in `COLORS.theme`.\n */\n white,\n alert: ALERT,\n /**\n * Theme-ready variables with fallbacks.\n *\n * Prefer semantic aliases in `COLORS.ui` when applicable.\n */\n theme: THEME,\n /**\n * Semantic aliases (prefer these over raw variables when applicable).\n */\n ui: UI\n});\nvar colors_values_default = COLORS;\nexport {\n COLORS,\n colors_values_default as default\n};\n//# sourceMappingURL=colors-values.mjs.map\n","// packages/components/src/utils/config-values.js\nimport { COLORS } from \"./colors-values.mjs\";\nvar CONTROL_HEIGHT = \"36px\";\nvar CONTROL_PROPS = {\n // These values should be shared with TextControl.\n controlPaddingX: 12,\n controlPaddingXSmall: 8,\n controlPaddingXLarge: 12 * 1.3334,\n // TODO: Deprecate\n controlBoxShadowFocus: `0 0 0 0.5px ${COLORS.theme.accent}`,\n controlHeight: CONTROL_HEIGHT,\n controlHeightXSmall: `calc( ${CONTROL_HEIGHT} * 0.6 )`,\n controlHeightSmall: `calc( ${CONTROL_HEIGHT} * 0.8 )`,\n controlHeightLarge: `calc( ${CONTROL_HEIGHT} * 1.2 )`,\n controlHeightXLarge: `calc( ${CONTROL_HEIGHT} * 1.4 )`\n};\nvar config_values_default = Object.assign({}, CONTROL_PROPS, {\n colorDivider: \"rgba(0, 0, 0, 0.1)\",\n colorScrollbarThumb: \"rgba(0, 0, 0, 0.2)\",\n colorScrollbarThumbHover: \"rgba(0, 0, 0, 0.5)\",\n colorScrollbarTrack: \"rgba(0, 0, 0, 0.04)\",\n elevationIntensity: 1,\n radiusXSmall: \"1px\",\n radiusSmall: \"2px\",\n radiusMedium: \"4px\",\n radiusLarge: \"8px\",\n radiusFull: \"9999px\",\n radiusRound: \"50%\",\n borderWidth: \"1px\",\n borderWidthFocus: \"1.5px\",\n borderWidthTab: \"4px\",\n spinnerSize: 16,\n fontSize: \"13px\",\n fontSizeH1: \"calc(2.44 * 13px)\",\n fontSizeH2: \"calc(1.95 * 13px)\",\n fontSizeH3: \"calc(1.56 * 13px)\",\n fontSizeH4: \"calc(1.25 * 13px)\",\n fontSizeH5: \"13px\",\n fontSizeH6: \"calc(0.8 * 13px)\",\n fontSizeInputMobile: \"16px\",\n fontSizeMobile: \"15px\",\n fontSizeSmall: \"calc(0.92 * 13px)\",\n fontSizeXSmall: \"calc(0.75 * 13px)\",\n fontLineHeightBase: \"1.4\",\n fontWeight: \"normal\",\n fontWeightEmphasis: \"600\",\n gridBase: \"4px\",\n elevationXSmall: `0 1px 1px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.02), 0 3px 3px rgba(0, 0, 0, 0.02), 0 4px 4px rgba(0, 0, 0, 0.01)`,\n elevationSmall: `0 1px 2px rgba(0, 0, 0, 0.05), 0 2px 3px rgba(0, 0, 0, 0.04), 0 6px 6px rgba(0, 0, 0, 0.03), 0 8px 8px rgba(0, 0, 0, 0.02)`,\n elevationMedium: `0 2px 3px rgba(0, 0, 0, 0.05), 0 4px 5px rgba(0, 0, 0, 0.04), 0 12px 12px rgba(0, 0, 0, 0.03), 0 16px 16px rgba(0, 0, 0, 0.02)`,\n elevationLarge: `0 5px 15px rgba(0, 0, 0, 0.08), 0 15px 27px rgba(0, 0, 0, 0.07), 0 30px 36px rgba(0, 0, 0, 0.04), 0 50px 43px rgba(0, 0, 0, 0.02)`,\n surfaceBorderColor: \"rgba(0, 0, 0, 0.1)\",\n surfaceColor: COLORS.white,\n // Modal exit animation: `use-modal-exit-animation` parses this for the\n // `animationend` timeout race; keep the numeric duration equal to the WPDS\n // `motion-duration-md` token on `.components-modal__frame` in modal/style.scss.\n transitionDuration: \"200ms\",\n transitionDurationFast: \"160ms\",\n transitionDurationFaster: \"120ms\",\n transitionDurationFastest: \"100ms\",\n transitionTimingFunction: \"cubic-bezier(0.08, 0.52, 0.52, 1)\",\n transitionTimingFunctionControl: \"cubic-bezier(0.12, 0.8, 0.32, 1)\"\n});\nexport {\n config_values_default as default\n};\n//# sourceMappingURL=config-values.mjs.map\n","'use strict';\n\n// do not edit .js files directly - edit src/index.jst\n\n\n var envHasBigInt64Array = typeof BigInt64Array !== 'undefined';\n\n\nmodule.exports = function equal(a, b) {\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n\n if ((a instanceof Map) && (b instanceof Map)) {\n if (a.size !== b.size) return false;\n for (i of a.entries())\n if (!b.has(i[0])) return false;\n for (i of a.entries())\n if (!equal(i[1], b.get(i[0]))) return false;\n return true;\n }\n\n if ((a instanceof Set) && (b instanceof Set)) {\n if (a.size !== b.size) return false;\n for (i of a.entries())\n if (!b.has(i[0])) return false;\n return true;\n }\n\n if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (a[i] !== b[i]) return false;\n return true;\n }\n\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n\n for (i = length; i-- !== 0;) {\n var key = keys[i];\n\n if (!equal(a[key], b[key])) return false;\n }\n\n return true;\n }\n\n // true if both NaN, false otherwise\n return a!==a && b!==b;\n};\n","// packages/warning/src/utils.ts\nvar logged = /* @__PURE__ */ new Set();\nexport {\n logged\n};\n//# sourceMappingURL=utils.mjs.map\n","// packages/warning/src/index.ts\nimport { logged } from \"./utils.mjs\";\nfunction isDev() {\n return globalThis.SCRIPT_DEBUG === true;\n}\nfunction warning(message) {\n if (!isDev()) {\n return;\n }\n if (logged.has(message)) {\n return;\n }\n console.warn(message);\n try {\n throw Error(message);\n } catch {\n }\n logged.add(message);\n}\nexport {\n warning as default\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/components/src/context/context-system-provider.js\nimport deepmerge from \"deepmerge\";\nimport fastDeepEqual from \"fast-deep-equal/es6/index.js\";\nimport { isPlainObject } from \"is-plain-object\";\nimport { createContext, useContext, useRef, useMemo, memo } from \"@wordpress/element\";\nimport warn from \"@wordpress/warning\";\nimport { useUpdateEffect } from \"../utils/index.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nvar ComponentsContext = createContext(\n /** @type {Record<string, any>} */\n {}\n);\nComponentsContext.displayName = \"ComponentsContext\";\nvar useComponentsContext = () => useContext(ComponentsContext);\nfunction useContextSystemBridge({\n value\n}) {\n const parentContext = useComponentsContext();\n const valueRef = useRef(value);\n useUpdateEffect(() => {\n if (\n // Objects are equivalent.\n fastDeepEqual(valueRef.current, value) && // But not the same reference.\n valueRef.current !== value\n ) {\n globalThis.SCRIPT_DEBUG === true ? warn(`Please memoize your context: ${JSON.stringify(value)}`) : void 0;\n }\n }, [value]);\n const config = useMemo(() => {\n return deepmerge(parentContext ?? {}, value ?? {}, {\n isMergeableObject: isPlainObject\n });\n }, [parentContext, value]);\n return config;\n}\nvar BaseContextSystemProvider = ({\n children,\n value\n}) => {\n const contextValue = useContextSystemBridge({\n value\n });\n return /* @__PURE__ */ _jsx(ComponentsContext.Provider, {\n value: contextValue,\n children\n });\n};\nvar ContextSystemProvider = memo(BaseContextSystemProvider);\nexport {\n ComponentsContext,\n ContextSystemProvider,\n useComponentsContext\n};\n//# sourceMappingURL=context-system-provider.mjs.map\n","// packages/components/src/context/constants.js\nvar COMPONENT_NAMESPACE = \"data-wp-component\";\nvar CONNECTED_NAMESPACE = \"data-wp-c16t\";\nvar CONNECT_STATIC_NAMESPACE = \"__contextSystemKey__\";\nexport {\n COMPONENT_NAMESPACE,\n CONNECTED_NAMESPACE,\n CONNECT_STATIC_NAMESPACE\n};\n//# sourceMappingURL=constants.mjs.map\n","// packages/components/src/context/get-styled-class-name-from-key.ts\nimport { paramCase as kebabCase } from \"change-case\";\nimport memoize from \"memize\";\nfunction getStyledClassName(namespace) {\n const kebab = kebabCase(namespace);\n return `components-${kebab}`;\n}\nvar getStyledClassNameFromKey = memoize(getStyledClassName);\nexport {\n getStyledClassNameFromKey\n};\n//# sourceMappingURL=get-styled-class-name-from-key.mjs.map\n","// packages/components/src/context/context-connect.ts\nimport { forwardRef } from \"@wordpress/element\";\nimport warn from \"@wordpress/warning\";\nimport { CONNECT_STATIC_NAMESPACE } from \"./constants.mjs\";\nimport { getStyledClassNameFromKey } from \"./get-styled-class-name-from-key.mjs\";\nfunction contextConnect(Component, namespace) {\n return _contextConnect(Component, namespace, {\n forwardsRef: true\n });\n}\nfunction contextConnectWithoutRef(Component, namespace) {\n return _contextConnect(Component, namespace);\n}\nfunction _contextConnect(Component, namespace, options) {\n const WrappedComponent = options?.forwardsRef ? forwardRef(Component) : Component;\n if (typeof namespace === \"undefined\") {\n globalThis.SCRIPT_DEBUG === true ? warn(\"contextConnect: Please provide a namespace\") : void 0;\n }\n let mergedNamespace = WrappedComponent[CONNECT_STATIC_NAMESPACE] || [namespace];\n if (Array.isArray(namespace)) {\n mergedNamespace = [...mergedNamespace, ...namespace];\n }\n if (typeof namespace === \"string\") {\n mergedNamespace = [...mergedNamespace, namespace];\n }\n return Object.assign(WrappedComponent, {\n [CONNECT_STATIC_NAMESPACE]: [...new Set(mergedNamespace)],\n displayName: namespace,\n selector: `.${getStyledClassNameFromKey(namespace)}`\n });\n}\nfunction getConnectNamespace(Component) {\n if (!Component) {\n return [];\n }\n let namespaces = [];\n if (Component[CONNECT_STATIC_NAMESPACE]) {\n namespaces = Component[CONNECT_STATIC_NAMESPACE];\n }\n if (Component.type && Component.type[CONNECT_STATIC_NAMESPACE]) {\n namespaces = Component.type[CONNECT_STATIC_NAMESPACE];\n }\n return namespaces;\n}\nfunction hasConnectNamespace(Component, match) {\n if (!Component) {\n return false;\n }\n if (typeof match === \"string\") {\n return getConnectNamespace(Component).includes(match);\n }\n if (Array.isArray(match)) {\n return match.some((result) => getConnectNamespace(Component).includes(result));\n }\n return false;\n}\nexport {\n contextConnect,\n contextConnectWithoutRef,\n getConnectNamespace,\n hasConnectNamespace\n};\n//# sourceMappingURL=context-connect.mjs.map\n","// packages/components/src/context/utils.js\nimport { CONNECTED_NAMESPACE, COMPONENT_NAMESPACE } from \"./constants.mjs\";\nfunction getNamespace(componentName) {\n return {\n [COMPONENT_NAMESPACE]: componentName\n };\n}\nfunction getConnectedNamespace() {\n return {\n [CONNECTED_NAMESPACE]: true\n };\n}\nexport {\n getConnectedNamespace,\n getNamespace\n};\n//# sourceMappingURL=utils.mjs.map\n","// packages/components/src/context/use-context-system.js\nimport warn from \"@wordpress/warning\";\nimport { useComponentsContext } from \"./context-system-provider.mjs\";\nimport { getNamespace, getConnectedNamespace } from \"./utils.mjs\";\nimport { getStyledClassNameFromKey } from \"./get-styled-class-name-from-key.mjs\";\nimport { useCx } from \"../utils/hooks/use-cx.mjs\";\nfunction useContextSystem(props, namespace) {\n const contextSystemProps = useComponentsContext();\n if (typeof namespace === \"undefined\") {\n globalThis.SCRIPT_DEBUG === true ? warn(\"useContextSystem: Please provide a namespace\") : void 0;\n }\n const contextProps = contextSystemProps?.[namespace] || {};\n const finalComponentProps = {\n ...getConnectedNamespace(),\n ...getNamespace(namespace)\n };\n const {\n _overrides: overrideProps,\n ...otherContextProps\n } = contextProps;\n const initialMergedProps = Object.entries(otherContextProps).length ? Object.assign({}, otherContextProps, props) : props;\n const cx = useCx();\n const classes = cx(getStyledClassNameFromKey(namespace), props.className);\n const rendered = typeof initialMergedProps.renderChildren === \"function\" ? initialMergedProps.renderChildren(initialMergedProps) : initialMergedProps.children;\n for (const key in initialMergedProps) {\n finalComponentProps[key] = initialMergedProps[key];\n }\n for (const key in overrideProps) {\n finalComponentProps[key] = overrideProps[key];\n }\n if (rendered !== void 0) {\n finalComponentProps.children = rendered;\n }\n finalComponentProps.className = classes;\n return finalComponentProps;\n}\nexport {\n useContextSystem\n};\n//# sourceMappingURL=use-context-system.mjs.map\n","// packages/components/src/visually-hidden/styles.ts\nvar visuallyHidden = {\n border: 0,\n clip: \"rect(1px, 1px, 1px, 1px)\",\n WebkitClipPath: \"inset( 50% )\",\n clipPath: \"inset( 50% )\",\n height: \"1px\",\n margin: \"-1px\",\n overflow: \"hidden\",\n padding: 0,\n position: \"absolute\",\n width: \"1px\",\n wordWrap: \"normal\",\n wordBreak: \"normal\"\n};\nexport {\n visuallyHidden\n};\n//# sourceMappingURL=styles.mjs.map\n","// packages/components/src/utils/polymorphic-element.tsx\nimport { forwardRef } from \"@wordpress/element\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nvar customAttributeRegExp = /^(data|aria|x)-/i;\nvar eventHandlerRegExp = /^on[A-Z]/;\nvar svgElementNames = new Set(`animate animateMotion animateTransform circle clipPath defs desc ellipse\n\tfeBlend feColorMatrix feComponentTransfer feComposite feConvolveMatrix\n\tfeDiffuseLighting feDisplacementMap feDistantLight feDropShadow feFlood\n\tfeFuncA feFuncB feFuncG feFuncR feGaussianBlur feImage feMerge feMergeNode\n\tfeMorphology feOffset fePointLight feSpecularLighting feSpotLight feTile\n\tfeTurbulence filter foreignObject g image line linearGradient marker mask\n\tmetadata mpath path pattern polygon polyline radialGradient rect set stop svg\n\tswitch symbol text textPath tspan use view`.split(/\\s+/));\nvar baseElementProps = new Set(`children dangerouslySetInnerHTML key autoFocus defaultValue defaultChecked\n\tinnerHTML suppressContentEditableWarning suppressHydrationWarning valueLink\n\tabbr accept acceptCharset accessKey action allow allowUserMedia\n\tallowPaymentRequest allowFullScreen allowTransparency alt async autoComplete\n\tautoPlay capture cellPadding cellSpacing challenge charSet checked cite classID\n\tclassName cols colSpan content contentEditable contextMenu controls controlsList\n\tcoords crossOrigin data dateTime decoding default defer dir disabled\n\tdisablePictureInPicture disableRemotePlayback download draggable encType\n\tenterKeyHint fetchpriority fetchPriority form formAction formEncType formMethod\n\tformNoValidate formTarget frameBorder headers height hidden high href hrefLang\n\thtmlFor httpEquiv id inputMode integrity is keyParams keyType kind label lang\n\tlist loading loop low marginHeight marginWidth max maxLength media mediaGroup\n\tmethod min minLength multiple muted name nonce noValidate open optimum pattern\n\tplaceholder playsInline popover popoverTarget popoverTargetAction poster\n\tpreload profile radioGroup readOnly referrerPolicy rel required reversed role\n\trows rowSpan sandbox scope scoped scrolling seamless selected shape size sizes\n\tslot span spellCheck src srcDoc srcLang srcSet start step style summary\n\ttabIndex target title translate type useMap value width wmode wrap about\n\tdatatype inlist prefix property resource typeof vocab autoCapitalize\n\tautoCorrect autoSave color incremental fallback inert itemProp itemScope\n\titemType itemID itemRef on option results security unselectable`.split(/\\s+/));\nvar svgElementProps = new Set(`accentHeight accumulate additive alignmentBaseline allowReorder alphabetic\n\tamplitude arabicForm ascent attributeName attributeType autoReverse azimuth\n\tbaseFrequency baselineShift baseProfile bbox begin bias by calcMode capHeight\n\tclip clipPathUnits clipPath clipRule colorInterpolation\n\tcolorInterpolationFilters colorProfile colorRendering contentScriptType\n\tcontentStyleType cursor cx cy d decelerate descent diffuseConstant direction\n\tdisplay divisor dominantBaseline dur dx dy edgeMode elevation enableBackground\n\tend exponent externalResourcesRequired fill fillOpacity fillRule filter\n\tfilterRes filterUnits floodColor floodOpacity focusable fontFamily fontSize\n\tfontSizeAdjust fontStretch fontStyle fontVariant fontWeight format from fr fx\n\tfy g1 g2 glyphName glyphOrientationHorizontal glyphOrientationVertical\n\tglyphRef gradientTransform gradientUnits hanging horizAdvX horizOriginX\n\tideographic imageRendering in in2 intercept k k1 k2 k3 k4 kernelMatrix\n\tkernelUnitLength kerning keyPoints keySplines keyTimes lengthAdjust\n\tletterSpacing lightingColor limitingConeAngle local markerEnd markerMid\n\tmarkerStart markerHeight markerUnits markerWidth mask maskContentUnits\n\tmaskUnits mathematical mode numOctaves offset opacity operator order orient\n\torientation origin overflow overlinePosition overlineThickness panose1\n\tpaintOrder pathLength patternContentUnits patternTransform patternUnits\n\tpointerEvents points pointsAtX pointsAtY pointsAtZ preserveAlpha\n\tpreserveAspectRatio primitiveUnits r radius refX refY renderingIntent\n\trepeatCount repeatDur requiredExtensions requiredFeatures restart result rotate\n\trx ry scale seed shapeRendering slope spacing specularConstant\n\tspecularExponent speed spreadMethod startOffset stdDeviation stemh stemv\n\tstitchTiles stopColor stopOpacity strikethroughPosition strikethroughThickness\n\tstring stroke strokeDasharray strokeDashoffset strokeLinecap strokeLinejoin\n\tstrokeMiterlimit strokeOpacity strokeWidth surfaceScale systemLanguage\n\ttableValues targetX targetY textAnchor textDecoration textRendering textLength\n\tto transform u1 u2 underlinePosition underlineThickness unicode unicodeBidi\n\tunicodeRange unitsPerEm vAlphabetic vHanging vIdeographic vMathematical values\n\tvectorEffect version vertAdvY vertOriginX vertOriginY viewBox viewTarget\n\tvisibility widths wordSpacing writingMode x xHeight x1 x2 xChannelSelector\n\txlinkActuate xlinkArcrole xlinkHref xlinkRole xlinkShow xlinkTitle xlinkType\n\txmlBase xmlns xmlnsXlink xmlLang xmlSpace y y1 y2 yChannelSelector z\n\tzoomAndPan`.split(/\\s+/));\nvar compatElementProps = /* @__PURE__ */ new Set([\"autofocus\", \"class\", \"for\"]);\nfunction isValidIntrinsicElementProp(prop, element) {\n if (customAttributeRegExp.test(prop) || eventHandlerRegExp.test(prop)) {\n return true;\n }\n if (baseElementProps.has(prop) || compatElementProps.has(prop)) {\n return true;\n }\n return svgElementNames.has(element) && svgElementProps.has(prop);\n}\nfunction filterIntrinsicElementProps(props, element) {\n return Object.fromEntries(Object.entries(props).filter(([prop]) => isValidIntrinsicElementProp(prop, element)));\n}\nfunction UnforwardedPolymorphicElement({\n as,\n ...props\n}, ref) {\n const Element = as || \"div\";\n const forwardedProps = typeof Element === \"string\" ? filterIntrinsicElementProps(props, Element) : props;\n return /* @__PURE__ */ _jsx(Element, {\n ref,\n ...forwardedProps\n });\n}\nvar PolymorphicElement = forwardRef(UnforwardedPolymorphicElement);\nexport {\n PolymorphicElement\n};\n//# sourceMappingURL=polymorphic-element.mjs.map\n","// packages/components/src/view/component.tsx\nimport { forwardRef } from \"@wordpress/element\";\nimport { PolymorphicElement } from \"../utils/polymorphic-element.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nfunction UnforwardedView({\n css,\n ...restProps\n}, ref) {\n void css;\n return /* @__PURE__ */ _jsx(PolymorphicElement, {\n ref,\n ...restProps\n });\n}\nvar View = Object.assign(forwardRef(UnforwardedView), {\n selector: \".components-view\"\n});\nvar component_default = View;\nexport {\n View,\n component_default as default\n};\n//# sourceMappingURL=component.mjs.map\n","// packages/components/src/visually-hidden/component.tsx\nimport { useContextSystem, contextConnect } from \"../context/index.mjs\";\nimport { visuallyHidden } from \"./styles.mjs\";\nimport { View } from \"../view/index.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nfunction UnconnectedVisuallyHidden(props, forwardedRef) {\n const {\n style: styleProp,\n ...contextProps\n } = useContextSystem(props, \"VisuallyHidden\");\n return /* @__PURE__ */ _jsx(View, {\n ref: forwardedRef,\n ...contextProps,\n \"data-visually-hidden\": \"\",\n style: {\n ...visuallyHidden,\n ...styleProp || {}\n }\n });\n}\nvar VisuallyHidden = contextConnect(UnconnectedVisuallyHidden, \"VisuallyHidden\");\nvar component_default = VisuallyHidden;\nexport {\n VisuallyHidden,\n component_default as default\n};\n//# sourceMappingURL=component.mjs.map\n","// packages/components/src/utils/use-responsive-value.ts\nimport { useEffect, useState } from \"@wordpress/element\";\nvar breakpoints = [\"40em\", \"52em\", \"64em\"];\nvar useBreakpointIndex = (options = {}) => {\n const {\n defaultIndex = 0\n } = options;\n if (typeof defaultIndex !== \"number\") {\n throw new TypeError(`Default breakpoint index should be a number. Got: ${defaultIndex}, ${typeof defaultIndex}`);\n } else if (defaultIndex < 0 || defaultIndex > breakpoints.length - 1) {\n throw new RangeError(`Default breakpoint index out of range. Theme has ${breakpoints.length} breakpoints, got index ${defaultIndex}`);\n }\n const [value, setValue] = useState(defaultIndex);\n useEffect(() => {\n const getIndex = () => breakpoints.filter((bp) => {\n return typeof window !== \"undefined\" ? window.matchMedia(`screen and (min-width: ${bp})`).matches : false;\n }).length;\n const onResize = () => {\n const newValue = getIndex();\n if (value !== newValue) {\n setValue(newValue);\n }\n };\n onResize();\n if (typeof window !== \"undefined\") {\n window.addEventListener(\"resize\", onResize);\n }\n return () => {\n if (typeof window !== \"undefined\") {\n window.removeEventListener(\"resize\", onResize);\n }\n };\n }, [value]);\n return value;\n};\nfunction useResponsiveValue(values, options = {}) {\n const index = useBreakpointIndex(options);\n if (!Array.isArray(values) && typeof values !== \"function\") {\n return values;\n }\n const array = values || [];\n return array[index >= array.length ? array.length - 1 : index];\n}\nexport {\n useBreakpointIndex,\n useResponsiveValue\n};\n//# sourceMappingURL=use-responsive-value.mjs.map\n","// packages/components/src/grid/utils.ts\nvar ALIGNMENTS = {\n bottom: {\n alignItems: \"flex-end\",\n justifyContent: \"center\"\n },\n bottomLeft: {\n alignItems: \"flex-start\",\n justifyContent: \"flex-end\"\n },\n bottomRight: {\n alignItems: \"flex-end\",\n justifyContent: \"flex-end\"\n },\n center: {\n alignItems: \"center\",\n justifyContent: \"center\"\n },\n spaced: {\n alignItems: \"center\",\n justifyContent: \"space-between\"\n },\n left: {\n alignItems: \"center\",\n justifyContent: \"flex-start\"\n },\n right: {\n alignItems: \"center\",\n justifyContent: \"flex-end\"\n },\n stretch: {\n alignItems: \"stretch\"\n },\n top: {\n alignItems: \"flex-start\",\n justifyContent: \"center\"\n },\n topLeft: {\n alignItems: \"flex-start\",\n justifyContent: \"flex-start\"\n },\n topRight: {\n alignItems: \"flex-start\",\n justifyContent: \"flex-end\"\n }\n};\nfunction getAlignmentProps(alignment) {\n const alignmentProps = alignment ? ALIGNMENTS[alignment] : {};\n return alignmentProps;\n}\nexport {\n getAlignmentProps\n};\n//# sourceMappingURL=utils.mjs.map\n","// packages/components/src/grid/hook.ts\nimport { css } from \"@emotion/react\";\nimport { useMemo } from \"@wordpress/element\";\nimport { useContextSystem } from \"../context/index.mjs\";\nimport { getAlignmentProps } from \"./utils.mjs\";\nimport { useResponsiveValue } from \"../utils/use-responsive-value.mjs\";\nimport CONFIG from \"../utils/config-values.mjs\";\nimport { useCx } from \"../utils/hooks/use-cx.mjs\";\nfunction useGrid(props) {\n const {\n align,\n alignment,\n className,\n columnGap,\n columns = 2,\n gap = 3,\n isInline = false,\n justify,\n rowGap,\n rows,\n templateColumns,\n templateRows,\n ...otherProps\n } = useContextSystem(props, \"Grid\");\n const columnsAsArray = Array.isArray(columns) ? columns : [columns];\n const column = useResponsiveValue(columnsAsArray);\n const rowsAsArray = Array.isArray(rows) ? rows : [rows];\n const row = useResponsiveValue(rowsAsArray);\n const gridTemplateColumns = templateColumns || !!columns && `repeat( ${column}, 1fr )`;\n const gridTemplateRows = templateRows || !!rows && `repeat( ${row}, 1fr )`;\n const cx = useCx();\n const classes = useMemo(() => {\n const alignmentProps = getAlignmentProps(alignment);\n const gridClasses = /* @__PURE__ */ css({\n alignItems: align,\n display: isInline ? \"inline-grid\" : \"grid\",\n gap: `calc( ${CONFIG.gridBase} * ${gap} )`,\n gridTemplateColumns: gridTemplateColumns || void 0,\n gridTemplateRows: gridTemplateRows || void 0,\n gridRowGap: rowGap,\n gridColumnGap: columnGap,\n justifyContent: justify,\n verticalAlign: isInline ? \"middle\" : void 0,\n ...alignmentProps\n }, process.env.NODE_ENV === \"production\" ? \"\" : \";label:gridClasses;\", process.env.NODE_ENV === \"production\" ? \"\" : \"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImhvb2sudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBdURzQiIsImZpbGUiOiJob29rLnRzIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBFeHRlcm5hbCBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuXG4vKipcbiAqIFdvcmRQcmVzcyBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHsgdXNlTWVtbyB9IGZyb20gJ0B3b3JkcHJlc3MvZWxlbWVudCc7XG5cbi8qKlxuICogSW50ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB0eXBlIHsgV29yZFByZXN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0XHRcdGp1c3RpZnlDb250ZW50OiBqdXN0aWZ5LFxuXHRcdFx0dmVydGljYWxBbGlnbjogaXNJbmxpbmUgPyAnbWlkZGxlJyA6IHVuZGVmaW5lZCxcblx0XHRcdC4uLmFsaWdubWVudFByb3BzLFxuXHRcdH0gKTtcblxuXHRcdHJldHVybiBjeCggZ3JpZENsYXNzZXMsIGNsYXNzTmFtZSApO1xuXHR9LCBbXG5cdFx0YWxpZ24sXG5cdFx0YWxpZ25tZW50LFxuXHRcdGNsYXNzTmFtZSxcblx0XHRjb2x1bW5HYXAsXG5cdFx0Y3gsXG5cdFx0Z2FwLFxuXHRcdGdyaWRUZW1wbGF0ZUNvbHVtbnMsXG5cdFx0Z3JpZFRlbXBsYXRlUm93cyxcblx0XHRpc0lubGluZSxcblx0XHRqdXN0aWZ5LFxuXHRcdHJvd0dhcCxcblx0XSApO1xuXG5cdHJldHVybiB7IC4uLm90aGVyUHJvcHMsIGNsYXNzTmFtZTogY2xhc3NlcyB9O1xufVxuIl19 */\");\n return cx(gridClasses, className);\n }, [align, alignment, className, columnGap, cx, gap, gridTemplateColumns, gridTemplateRows, isInline, justify, rowGap]);\n return {\n ...otherProps,\n className: classes\n };\n}\nexport {\n useGrid as default\n};\n//# sourceMappingURL=hook.mjs.map\n","// packages/components/src/grid/component.tsx\nimport { contextConnect } from \"../context/index.mjs\";\nimport { View } from \"../view/index.mjs\";\nimport useGrid from \"./hook.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nfunction UnconnectedGrid(props, forwardedRef) {\n const gridProps = useGrid(props);\n return /* @__PURE__ */ _jsx(View, {\n ...gridProps,\n ref: forwardedRef\n });\n}\nvar Grid = contextConnect(UnconnectedGrid, \"Grid\");\nvar component_default = Grid;\nexport {\n Grid,\n component_default as default\n};\n//# sourceMappingURL=component.mjs.map\n","import { useCallback, useLayoutEffect, useRef, useState } from 'react';\n\n/**\n * Fractional layout rounding can put a row's bottom a hair past the container's\n * without any visible clipping. Allow that much slack before hiding a row.\n *\n * Exported so tests and stories assert against the real tolerance rather than\n * restating it.\n */\nexport const SUBPIXEL_TOLERANCE = 0.5;\n\n/**\n * Counts how many leading rows fit inside the content container.\n *\n * Rows are read from the DOM rather than derived from constants: row height\n * depends on the theme's row gap, label wrapping, and whatever a caller renders\n * as a label, so any restated number would drift.\n *\n * Every row is a direct grid child marked with `data-row-index`; interactive rows\n * use a button wrapper and non-interactive rows use a div wrapper.\n *\n * @param enabled - Whether to measure at all. When false every row fits.\n * @param rowCount - Total number of rows rendered.\n * @param data - Rendered row data, whose geometry may change without changing the count.\n * @return Ref for the content container and the number of leading rows that fit.\n */\nexport function useFittedRowCount( enabled: boolean, rowCount: number, data: unknown ) {\n\tconst contentRef = useRef< HTMLDivElement | null >( null );\n\tconst [ fittedCount, setFittedCount ] = useState( rowCount );\n\tconst [ isMeasurable, setIsMeasurable ] = useState( true );\n\n\tconst measure = useCallback( () => {\n\t\tconst content = contentRef.current;\n\t\tif ( ! content ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Switching from the default scrollable mode can leave the content at a\n\t\t// non-zero scroll offset, which would shift every measurement below.\n\t\tcontent.scrollTop = 0;\n\n\t\tconst rows = content.querySelectorAll< HTMLElement >(\n\t\t\t':scope > [data-leaderboard-grid] > [data-row-index]'\n\t\t);\n\n\t\tconst rowBottoms: number[] = [];\n\t\trows.forEach( row => {\n\t\t\tconst index = Number( row.getAttribute( 'data-row-index' ) );\n\t\t\t// An unparseable index would write a non-numeric key, leaving a hole\n\t\t\t// that silently truncates the scan below at the preceding row.\n\t\t\tif ( ! Number.isInteger( index ) || index < 0 || index >= rowCount ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { bottom } = row.getBoundingClientRect();\n\t\t\trowBottoms[ index ] = Math.max( rowBottoms[ index ] ?? -Infinity, bottom );\n\t\t} );\n\n\t\t// Fail open. If the rows cannot be measured at all — a changed DOM shape,\n\t\t// a detached container — falling back to the scrollable default keeps the\n\t\t// data reachable, where hiding every row reads as a broken tile.\n\t\tif ( rowBottoms.length === 0 ) {\n\t\t\tsetIsMeasurable( false );\n\t\t\tsetFittedCount( rowCount );\n\t\t\treturn;\n\t\t}\n\t\tsetIsMeasurable( true );\n\n\t\tconst contentBottom = content.getBoundingClientRect().bottom + SUBPIXEL_TOLERANCE;\n\n\t\tlet fits = 0;\n\t\twhile ( fits < rowBottoms.length && rowBottoms[ fits ] <= contentBottom ) {\n\t\t\tfits++;\n\t\t}\n\n\t\t// Bail before setState: setState inside a ResizeObserver callback is the\n\t\t// usual way this grows a render loop.\n\t\tsetFittedCount( current => ( current === fits ? current : fits ) );\n\t}, [ rowCount ] );\n\n\t// Measure after row data changes so geometry updates are caught even when the\n\t// row count and the grid's overall size stay the same (for example, one label\n\t// wraps while another unwraps after a same-length data update).\n\tuseLayoutEffect( () => {\n\t\tif ( ! enabled ) {\n\t\t\tsetFittedCount( rowCount );\n\t\t\treturn;\n\t\t}\n\n\t\tmeasure();\n\t}, [ enabled, rowCount, data, measure ] );\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! enabled ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst content = contentRef.current;\n\t\tif ( ! content ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst observer = new ResizeObserver( measure );\n\t\t// The container catches tile resizing; the grid catches font, image,\n\t\t// theme, or label changes that alter row geometry on an unchanged tile.\n\t\tobserver.observe( content );\n\t\tconst grid = content.querySelector< HTMLElement >( ':scope > [data-leaderboard-grid]' );\n\t\tif ( grid ) {\n\t\t\tobserver.observe( grid );\n\t\t}\n\n\t\treturn () => observer.disconnect();\n\t}, [ enabled, rowCount, measure ] );\n\n\treturn { contentRef, fittedCount: enabled ? fittedCount : rowCount, isMeasurable };\n}\n","import { __ } from '@wordpress/i18n';\nimport { useMemo } from 'react';\nimport { useGlobalChartsTheme, useGlobalChartsContext } from '../../../providers';\nimport type { BaseLegendItem } from '../../../components/legend';\nimport type { LeaderboardEntry } from '../../../types';\n\n/**\n * Hook to create legend items from leaderboard data\n * @param root0 - Configuration object\n * @param root0.data - Array of leaderboard entries\n * @param root0.primaryColor - Primary color override\n * @param root0.secondaryColor - Secondary color override\n * @param root0.withComparison - Whether comparison data is shown\n * @param root0.withOverlayLabel - Whether to overlay the label on top of the bar\n * @param root0.legendLabels - Custom labels for legend items\n * @param root0.legendLabels.primary - Label for primary period data\n * @param root0.legendLabels.comparison - Label for comparison period data\n * @return Array of legend items for the leaderboard chart\n */\nexport function useLeaderboardLegendItems( {\n\tdata,\n\tprimaryColor,\n\tsecondaryColor,\n\twithComparison = false,\n\twithOverlayLabel = false,\n\tlegendLabels,\n}: {\n\tdata: LeaderboardEntry[];\n\tprimaryColor?: string;\n\tsecondaryColor?: string;\n\twithComparison: boolean;\n\twithOverlayLabel: boolean;\n\tlegendLabels?: {\n\t\tprimary?: string;\n\t\tcomparison?: string;\n\t};\n} ): BaseLegendItem[] {\n\tconst { leaderboardChart: leaderboardChartSettings } = useGlobalChartsTheme();\n\tconst { getElementStyles } = useGlobalChartsContext();\n\n\treturn useMemo( () => {\n\t\tif ( ! data || data.length === 0 ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst items: BaseLegendItem[] = [];\n\n\t\t// Add current period legend item\n\t\tconst { color: resolvedPrimaryColor } = getElementStyles( {\n\t\t\tindex: 0,\n\t\t\toverrideColor: primaryColor || leaderboardChartSettings.primaryColor,\n\t\t} );\n\n\t\titems.push( {\n\t\t\tlabel: legendLabels?.primary || __( 'Current period', 'jetpack-charts' ),\n\t\t\tcolor: resolvedPrimaryColor,\n\t\t} );\n\n\t\t// Add comparison period legend item if comparison is enabled and overlay label is not enabled\n\t\tif ( withComparison && ! withOverlayLabel ) {\n\t\t\tconst { color: resolvedSecondaryColor } = getElementStyles( {\n\t\t\t\tindex: 1,\n\t\t\t\toverrideColor: secondaryColor || leaderboardChartSettings.secondaryColor,\n\t\t\t} );\n\n\t\t\titems.push( {\n\t\t\t\tlabel: legendLabels?.comparison || __( 'Previous period', 'jetpack-charts' ),\n\t\t\t\tcolor: resolvedSecondaryColor,\n\t\t\t} );\n\t\t}\n\n\t\treturn items;\n\t}, [\n\t\tdata,\n\t\tprimaryColor,\n\t\tsecondaryColor,\n\t\twithComparison,\n\t\tlegendLabels,\n\t\tleaderboardChartSettings,\n\t\tgetElementStyles,\n\t\twithOverlayLabel,\n\t] );\n}\n","/* eslint-disable @wordpress/no-unsafe-wp-apis */\nimport { __experimentalGrid as Grid, VisuallyHidden } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { Icon, chevronRight } from '@wordpress/icons';\nimport { Stack, Text } from '@wordpress/ui';\nimport clsx from 'clsx';\nimport { useContext, useMemo, type FC } from 'react';\nimport { Legend } from '../../components/legend';\nimport { usePrefersReducedMotion } from '../../hooks';\nimport {\n\tGlobalChartsContext,\n\tGlobalChartsProvider,\n\tuseChartId,\n\tuseChartRegistration,\n\tuseGlobalChartsContext,\n\tuseGlobalChartsTheme,\n} from '../../providers';\nimport { formatMetricValue, attachSubComponents } from '../../utils';\nimport { useChartChildren } from '../private/chart-composition';\nimport { ChartInstanceContext } from '../private/chart-instance-context';\nimport { ChartLayout } from '../private/chart-layout';\nimport { getAllHiddenMessage } from '../private/svg-empty-state';\nimport { withResponsive } from '../private/with-responsive';\nimport { useFittedRowCount, useLeaderboardLegendItems } from './hooks';\nimport styles from './leaderboard-chart.module.scss';\nimport type { LeaderboardChartProps } from './types';\nimport type { LeaderboardEntry } from '../../types';\n\n/**\n * Default value formatter using formatMetricValue\n *\n * @param value - The numeric value to format\n * @return Formatted string representation of the value\n */\nconst defaultValueFormatter = ( value: number ): string => {\n\treturn formatMetricValue( value, 'number', {\n\t\tuseMultipliers: true,\n\t\tdecimals: 1,\n\t} );\n};\n\n/**\n * Default delta formatter using formatMetricValue\n *\n * @param value - The delta value to format\n * @return Formatted percentage string\n */\nconst defaultDeltaFormatter = ( value: number ): string => {\n\treturn formatMetricValue( value / 100, 'average', {\n\t\tdecimals: 0,\n\t\tsignDisplay: 'exceptZero',\n\t} );\n};\n\n/**\n * Build a bar's width. A hover-inset CSS variable (0 by default) is subtracted\n * on hover, scaled by the bar's share so the pull-back is proportional to its\n * length: the full-length (100%) bar — the one that reaches the value — pulls\n * back the whole inset to keep its gap with the value, while shorter bars pull\n * back proportionally less, down to ~0 for a very short bar.\n *\n * @param share - The bar's share of the row width, as a percentage.\n * @return A CSS width value.\n */\nconst getBarWidth = ( share: number ): string =>\n\t`calc(${ share }% - var(--a8c-charts-dimension-leaderboard-bar-hover-inset, 0px) * ${ share } / 100)`;\n\nconst hasPreviousValue = (\n\tentry: LeaderboardEntry\n): entry is LeaderboardEntry & {\n\tpreviousValue: number;\n\tpreviousShare: number;\n} => entry.previousValue != null && entry.previousShare != null;\n\nconst hasDeltaValue = (\n\tentry: LeaderboardEntry\n): entry is LeaderboardEntry & {\n\tpreviousValue: number;\n\tpreviousShare: number;\n\tdelta: number;\n} => hasPreviousValue( entry ) && entry.delta != null;\n\nconst BarLabel = ( { label }: { label: LeaderboardEntry[ 'label' ] } ) => (\n\t<>{ typeof label === 'string' ? <Text className={ styles.label }>{ label }</Text> : label }</>\n);\n\nconst BarWithLabel = ( {\n\tentry,\n\twithComparison,\n\twithOverlayLabel,\n\tprimaryColor,\n\tsecondaryColor,\n\tanimation,\n\tisPrimaryVisible = true,\n\tisComparisonVisible = true,\n}: {\n\tentry: LeaderboardEntry;\n\twithComparison?: boolean;\n\twithOverlayLabel?: boolean;\n\tprimaryColor: string;\n\tsecondaryColor: string;\n\tisPrimaryVisible?: boolean;\n\tisComparisonVisible?: boolean;\n\tanimation?: boolean;\n} ) => {\n\tconst showComparisonBar = withComparison && ! withOverlayLabel && isComparisonVisible;\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx( styles.barWithLabelContainer, {\n\t\t\t\t[ styles[ 'is-overlay' ] ]: withOverlayLabel,\n\t\t\t} ) }\n\t\t>\n\t\t\t<BarLabel label={ entry.label } />\n\n\t\t\t{ isPrimaryVisible && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={ clsx( styles.bar, {\n\t\t\t\t\t\t[ styles[ 'bar--animated' ] ]: animation,\n\t\t\t\t\t} ) }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\twidth: getBarWidth( entry.currentShare ),\n\t\t\t\t\t\tbackgroundColor: primaryColor,\n\t\t\t\t\t} }\n\t\t\t\t></div>\n\t\t\t) }\n\n\t\t\t{ showComparisonBar && hasPreviousValue( entry ) && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={ clsx( styles.bar, {\n\t\t\t\t\t\t[ styles[ 'bar--animated' ] ]: animation,\n\t\t\t\t\t} ) }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\twidth: getBarWidth( entry.previousShare ),\n\t\t\t\t\t\tbackgroundColor: secondaryColor,\n\t\t\t\t\t} }\n\t\t\t\t></div>\n\t\t\t) }\n\t\t</div>\n\t);\n};\n\n/**\n * LeaderboardChart component displays a ranked list of data with progress bars\n * and optional comparison values.\n *\n * @param props - Component props\n * @param props.data - Array of leaderboard entries to display\n * @param props.chartId - Optional unique identifier for the chart\n * @param props.width - Optional width of the chart container in pixels\n * @param props.height - Optional height of the chart container in pixels\n * @param props.withComparison - Whether to show comparison data\n * @param props.withOverlayLabel - Whether to overlay the label on top of the bar\n * @param props.primaryColor - Primary color for current period bars\n * @param props.secondaryColor - Secondary color for comparison period bars\n * @param props.valueFormatter - Custom formatter for values\n * @param props.deltaFormatter - Custom formatter for delta values\n * @param props.loading - Whether the chart is in loading state\n * @param props.fitRows - Whether to show only the rows that fit the chart's height\n * @param props.animation - Whether the chart should animate on load\n * @param props.showLegend - Whether to show legend\n * @param props.legend - Legend configuration (orientation, position, alignment, shape, shapeStyles, interactive)\n * @param props.legendLabels - Custom labels for legend items\n * @param props.gap - Spacing between legend and chart content\n * @param props.children - Child components for composition API\n * @param props.className - Additional CSS class name\n * @param props.style - Custom styling for the chart container\n * @return JSX element representing the leaderboard chart\n */\nconst LeaderboardChartInternal: FC< LeaderboardChartProps > = ( {\n\tdata,\n\tchartId: providedChartId,\n\twidth: propWidth,\n\theight: propHeight,\n\twithComparison = false,\n\twithOverlayLabel = false,\n\tprimaryColor,\n\tsecondaryColor,\n\tvalueFormatter = defaultValueFormatter,\n\tdeltaFormatter = defaultDeltaFormatter,\n\tanimation,\n\tloading = false,\n\tfitRows = false,\n\tshowLegend = false,\n\tlegend = {},\n\tlegendLabels,\n\tgap = 'md',\n\tclassName,\n\tstyle,\n\tchildren,\n} ) => {\n\tconst legendInteractive = legend.interactive ?? false;\n\tconst legendPosition = legend.position ?? 'bottom';\n\n\tconst chartId = useChartId( providedChartId );\n\tconst { leaderboardChart: leaderboardChartSettings } = useGlobalChartsTheme();\n\tconst legendShapeStyles = { width: 8, height: 8, ...legend.shapeStyles };\n\n\t// Process children to extract compound components\n\tconst { legendChildren, nonLegendChildren } = useChartChildren( children, 'LeaderboardChart' );\n\tconst {\n\t\tlabelSpacing,\n\t\trowGap,\n\t\tcolumnGap,\n\t\tprimaryColor: settingsPrimaryColor,\n\t\tsecondaryColor: settingsSecondaryColor,\n\t\tdeltaColors,\n\t} = leaderboardChartSettings;\n\tconst { getElementStyles, isSeriesVisible } = useGlobalChartsContext();\n\tconst { color: resolvedPrimaryColor } = getElementStyles( {\n\t\tindex: 0,\n\t\toverrideColor: primaryColor || settingsPrimaryColor,\n\t} );\n\tconst { color: resolvedSecondaryColor } = getElementStyles( {\n\t\tindex: 1,\n\t\toverrideColor: secondaryColor || settingsSecondaryColor,\n\t} );\n\n\t// Create legend items using the custom hook\n\tconst legendItems = useLeaderboardLegendItems( {\n\t\tdata: data || [],\n\t\tprimaryColor,\n\t\tsecondaryColor,\n\t\twithComparison,\n\t\twithOverlayLabel,\n\t\tlegendLabels,\n\t} );\n\n\t// Track visibility of primary and comparison series from the shared legend state.\n\tconst isPrimaryVisible = useMemo( () => {\n\t\tif ( legendItems.length === 0 ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn isSeriesVisible( chartId, legendItems[ 0 ].label );\n\t}, [ chartId, legendItems, isSeriesVisible ] );\n\n\tconst isComparisonVisible = useMemo( () => {\n\t\tif ( legendItems.length < 2 ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn isSeriesVisible( chartId, legendItems[ 1 ].label );\n\t}, [ chartId, legendItems, isSeriesVisible ] );\n\n\t// Check if all series are hidden\n\tconst allSeriesHidden = useMemo( () => {\n\t\tif ( withComparison && ! withOverlayLabel ) {\n\t\t\treturn ! isPrimaryVisible && ! isComparisonVisible;\n\t\t}\n\t\treturn ! isPrimaryVisible;\n\t}, [ isPrimaryVisible, isComparisonVisible, withComparison, withOverlayLabel ] );\n\n\t// Validate data\n\tconst isDataValid = Boolean( data && data.length > 0 );\n\n\t// Memoize metadata to prevent unnecessary re-registration\n\tconst chartMetadata = useMemo(\n\t\t() => ( {\n\t\t\twithComparison,\n\t\t\twithOverlayLabel,\n\t\t} ),\n\t\t[ withComparison, withOverlayLabel ]\n\t);\n\n\t// Register chart with context\n\tuseChartRegistration( {\n\t\tchartId,\n\t\tlegendItems,\n\t\tchartType: 'leaderboard',\n\t\tisDataValid,\n\t\tmetadata: chartMetadata,\n\t} );\n\n\tconst prefersReducedMotion = usePrefersReducedMotion();\n\n\t// There are no rows to measure while every series is hidden, whether from an\n\t// interactive legend click or a programmatic toggle. Pausing fitting restores\n\t// the full row count and, when a series is shown again, re-runs the effect\n\t// against the newly mounted grid.\n\tconst { contentRef, fittedCount, isMeasurable } = useFittedRowCount(\n\t\tfitRows && ! allSeriesHidden,\n\t\tdata?.length ?? 0,\n\t\tdata\n\t);\n\tconst shouldFitRows = fitRows && isMeasurable;\n\n\t// Handle empty or undefined data\n\tif ( ! data || data.length === 0 ) {\n\t\treturn (\n\t\t\t<ChartInstanceContext.Provider value={ { chartId } }>\n\t\t\t\t<ChartLayout\n\t\t\t\t\tlegendPosition={ legendPosition }\n\t\t\t\t\tlegendElement={ false }\n\t\t\t\t\tlegendChildren={ legendChildren }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\tstyles.leaderboardChart,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t[ styles[ 'leaderboardChart--responsive' ] ]: ! propWidth && ! propHeight,\n\t\t\t\t\t\t\t[ styles[ 'leaderboardChart--loading' ] ]: loading,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tgap={ gap }\n\t\t\t\t\tstyle={ { ...style, width: propWidth || undefined, height: propHeight || undefined } }\n\t\t\t\t\tdata-testid=\"leaderboard-chart-container\"\n\t\t\t\t\ttrailingContent={ nonLegendChildren }\n\t\t\t\t>\n\t\t\t\t\t<div className={ styles.emptyState }>\n\t\t\t\t\t\t{ loading\n\t\t\t\t\t\t\t? __( 'Loading…', 'jetpack-charts' )\n\t\t\t\t\t\t\t: __( 'No data available', 'jetpack-charts' ) }\n\t\t\t\t\t</div>\n\t\t\t\t</ChartLayout>\n\t\t\t</ChartInstanceContext.Provider>\n\t\t);\n\t}\n\n\tconst legendElement = showLegend && (\n\t\t<Legend\n\t\t\torientation={ legend.orientation ?? 'horizontal' }\n\t\t\tposition={ legendPosition }\n\t\t\talignment={ legend.alignment ?? 'center' }\n\t\t\tlabelStyles={ legend.labelStyles }\n\t\t\titemClassName={ legend.itemClassName }\n\t\t\titemStyles={ legend.itemStyles }\n\t\t\tshape={ legend.shape ?? 'circle' }\n\t\t\tshapeStyles={ legendShapeStyles }\n\t\t\tchartId={ chartId }\n\t\t\tinteractive={ legendInteractive }\n\t\t/>\n\t);\n\n\treturn (\n\t\t<ChartInstanceContext.Provider value={ { chartId } }>\n\t\t\t<ChartLayout\n\t\t\t\tlegendPosition={ legendPosition }\n\t\t\t\tlegendElement={ legendElement }\n\t\t\t\tlegendChildren={ legendChildren }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\tstyles.leaderboardChart,\n\t\t\t\t\t{\n\t\t\t\t\t\t[ styles[ 'leaderboardChart--responsive' ] ]: ! propWidth && ! propHeight,\n\t\t\t\t\t\t[ styles[ 'leaderboardChart--loading' ] ]: loading,\n\t\t\t\t\t},\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tgap={ gap }\n\t\t\t\tstyle={ {\n\t\t\t\t\t...style,\n\t\t\t\t\twidth: propWidth || undefined,\n\t\t\t\t\theight: propHeight || undefined,\n\t\t\t\t} }\n\t\t\t\tdata-testid=\"leaderboard-chart-container\"\n\t\t\t\ttrailingContent={ nonLegendChildren }\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tref={ contentRef }\n\t\t\t\t\tdata-testid=\"leaderboard-chart-content\"\n\t\t\t\t\tclassName={ clsx( styles.leaderboardChart__content, {\n\t\t\t\t\t\t[ styles[ 'leaderboardChart__content--fit' ] ]: shouldFitRows,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t{ shouldFitRows && fittedCount === 0 && ! allSeriesHidden && (\n\t\t\t\t\t\t// Overlaid, not swapped in: the rows must stay laid out to stay measurable.\n\t\t\t\t\t\t<div className={ clsx( styles.emptyState, styles.fitEmptyState ) }>\n\t\t\t\t\t\t\t{ __( 'Not enough space to display data', 'jetpack-charts' ) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t{ allSeriesHidden ? (\n\t\t\t\t\t\t<div className={ styles.emptyState }>\n\t\t\t\t\t\t\t{ getAllHiddenMessage( legendInteractive, 'series' ) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<Grid\n\t\t\t\t\t\t\ttemplateColumns=\"minmax(0, 1fr) auto\"\n\t\t\t\t\t\t\trowGap={ rowGap }\n\t\t\t\t\t\t\tcolumnGap={ columnGap }\n\t\t\t\t\t\t\tdata-leaderboard-grid\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ data.map( ( entry, rowIndex ) => {\n\t\t\t\t\t\t\t\t// visibility, not clipping: hidden rows keep their geometry (so a\n\t\t\t\t\t\t\t\t// taller container can reveal them) but leave hit testing, focus,\n\t\t\t\t\t\t\t\t// and the accessibility tree.\n\t\t\t\t\t\t\t\tconst rowStyle =\n\t\t\t\t\t\t\t\t\tshouldFitRows && rowIndex >= fittedCount\n\t\t\t\t\t\t\t\t\t\t? ( { visibility: 'hidden' } as const )\n\t\t\t\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\t\t\t\tconst showComparisonColumn = withComparison && isComparisonVisible;\n\t\t\t\t\t\t\t\tconst hasPreviousPeriodValue = hasPreviousValue( entry );\n\t\t\t\t\t\t\t\tconst hasDelta = hasDeltaValue( entry );\n\t\t\t\t\t\t\t\tconst showComparisonValue = showComparisonColumn && hasDelta;\n\t\t\t\t\t\t\t\tconst showComparisonPlaceholder = showComparisonColumn && ! hasDelta;\n\t\t\t\t\t\t\t\tconst colorIndex = showComparisonValue ? Math.sign( entry.delta ) + 1 : 1;\n\t\t\t\t\t\t\t\tconst deltaColor = deltaColors[ colorIndex ];\n\n\t\t\t\t\t\t\t\tconst rowCells = (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<Stack direction=\"column\" gap={ labelSpacing }>\n\t\t\t\t\t\t\t\t\t\t\t<BarWithLabel\n\t\t\t\t\t\t\t\t\t\t\t\tentry={ entry }\n\t\t\t\t\t\t\t\t\t\t\t\twithComparison={ withComparison }\n\t\t\t\t\t\t\t\t\t\t\t\twithOverlayLabel={ withOverlayLabel }\n\t\t\t\t\t\t\t\t\t\t\t\tprimaryColor={ resolvedPrimaryColor }\n\t\t\t\t\t\t\t\t\t\t\t\tsecondaryColor={ resolvedSecondaryColor }\n\t\t\t\t\t\t\t\t\t\t\t\tisPrimaryVisible={ isPrimaryVisible }\n\t\t\t\t\t\t\t\t\t\t\t\tisComparisonVisible={ isComparisonVisible }\n\t\t\t\t\t\t\t\t\t\t\t\tanimation={ animation && ! loading && ! prefersReducedMotion }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</Stack>\n\n\t\t\t\t\t\t\t\t\t\t<Stack\n\t\t\t\t\t\t\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\t\t\t\t\t\t\tgap=\"xs\"\n\t\t\t\t\t\t\t\t\t\t\tclassName={ clsx( styles.valueContainer, {\n\t\t\t\t\t\t\t\t\t\t\t\t[ styles.overlayLabel ]: withOverlayLabel,\n\t\t\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ isPrimaryVisible && <Text>{ valueFormatter( entry.currentValue ) }</Text> }\n\n\t\t\t\t\t\t\t\t\t\t\t{ showComparisonValue && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Text className={ styles.deltaValue } style={ { color: deltaColor } }>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ deltaFormatter( entry.delta ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t\t\t{ showComparisonPlaceholder && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName={ clsx( styles.deltaValue, styles.deltaPlaceholder ) }\n\t\t\t\t\t\t\t\t\t\t\t\t\tstyle={ { color: deltaColor } }\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span aria-hidden=\"true\">—</span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ hasPreviousPeriodValue\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? __( 'Percentage change unavailable', 'jetpack-charts' )\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: __( 'No comparison data', 'jetpack-charts' ) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tif ( entry.onClick ) {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\t\tkey={ entry.id }\n\t\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t\tdata-row-index={ rowIndex }\n\t\t\t\t\t\t\t\t\t\t\tstyle={ rowStyle }\n\t\t\t\t\t\t\t\t\t\t\tclassName={ clsx( styles.row, styles.interactiveRow ) }\n\t\t\t\t\t\t\t\t\t\t\tonClick={ entry.onClick }\n\t\t\t\t\t\t\t\t\t\t\taria-label={ entry.ariaLabel }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ rowCells }\n\t\t\t\t\t\t\t\t\t\t\t<Icon className={ styles.chevron } icon={ chevronRight } size={ 24 } />\n\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tkey={ entry.id }\n\t\t\t\t\t\t\t\t\t\tdata-row-index={ rowIndex }\n\t\t\t\t\t\t\t\t\t\tstyle={ rowStyle }\n\t\t\t\t\t\t\t\t\t\tclassName={ styles.row }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ rowCells }\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t</Grid>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</ChartLayout>\n\t\t</ChartInstanceContext.Provider>\n\t);\n};\n\nconst LeaderboardChartWithProvider: FC< LeaderboardChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, don't create a new one\n\tif ( existingContext ) {\n\t\treturn <LeaderboardChartInternal { ...props } />;\n\t}\n\n\t// Otherwise, create our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<LeaderboardChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nLeaderboardChartWithProvider.displayName = 'LeaderboardChart';\n\n// Create LeaderboardChart with composition API\nconst LeaderboardChart = attachSubComponents( LeaderboardChartWithProvider, {\n\tLegend: Legend,\n} );\n\n// Create responsive LeaderboardChart with composition API\nconst LeaderboardChartResponsive = attachSubComponents(\n\twithResponsive< LeaderboardChartProps >( LeaderboardChartWithProvider ),\n\t{\n\t\tLegend: Legend,\n\t}\n);\n\nexport { LeaderboardChartResponsive as default, LeaderboardChart as LeaderboardChartUnresponsive };\n","/**\n * This animation uses the SVG self-drawing technique (source: https://www.joshwcomeau.com/svg/friendly-introduction-to-svg/),\n * leveraging stroke-dasharray and stroke-dashoffset properties to create the effect.\n *\n * Here, we reverse the animation to \"un-draw\" the circle for the revealing / radial wipe effect:\n * - Initially, the entire circle is drawn with a white mask.\n * - The circle's border (stroke) is drawn with a black stroke, wide enough to cover the circle.\n * - The stroke is then \"un-drawn,\" creating the wipe animation.\n * - A white mask makes the area visible, while a black mask makes the area invisible.\n */\n\ntype Angle = `${ number }deg` | `${ number }rad` | `${ number }grad` | `${ number }turn` | 0 | '0';\n\n/**\n * RadialWipeAnimationProps - SVG mask props that requires a radial wipe animation effect.\n *\n * @param {object} props - The properties object.\n * @param {string} props.id - The unique ID for the mask.\n * @param {number} props.radius - The outer radius of the radial wipe.\n * @param {number} [props.innerRadius=0] - The inner radius of the radial wipe.\n * @param {number} [props.durationMs=1000] - The duration of the animation in milliseconds.\n * @param {number} [props.wipePercentage=100] - The percentage of the wipe animation to complete.\n * @param {'clockwise' | 'counter-clockwise'} [props.direction='clockwise'] - The direction of the wipe animation.\n * @param {Angle} [props.startAngle='-90deg'] - The starting angle of the wipe animation.\n *\n * @return {JSX.Element} The radial wipe mask element.\n */\nexport type RadialWipeAnimationProps = {\n\tid: string;\n\tradius: number;\n\tinnerRadius?: number;\n\tdurationMs?: number;\n\tstartAngle?: Angle;\n\tdirection?: 'clockwise' | 'counter-clockwise';\n\twipePercentage?: number;\n};\n\n/**\n * Renders a SVG mask that creates a radial wipe animation effect.\n *\n * @param {RadialWipeAnimationProps} props - Component props\n * @return {JSX.Element} The rendered mask component\n */\nfunction RadialWipeAnimation( {\n\tid,\n\tradius,\n\tinnerRadius = 0,\n\tdurationMs = 1000,\n\twipePercentage = 100,\n\tdirection = 'clockwise',\n\tstartAngle = '-90deg',\n}: RadialWipeAnimationProps ) {\n\tconst strokeWidth =\n\t\t( radius - innerRadius ) * 2 + // The stroke is centered on the circumference, so we need to double the width.\n\t\t1; // Added 1 to prevent sub-pixel rendering issues.\n\n\tconst scaleY = direction === 'clockwise' ? -1 : 1;\n\n\tconst isValidWipePercentage = 0 < wipePercentage && wipePercentage <= 100;\n\tconst animationDuration = `${\n\t\t// If wipePercentage is invalid, set animation duration to 0 to disable animation.\n\t\tisValidWipePercentage ? durationMs * ( 100 / wipePercentage ) : 0\n\t}ms`;\n\n\treturn (\n\t\t<mask id={ id }>\n\t\t\t<circle\n\t\t\t\tcx={ 0 }\n\t\t\t\tcy={ 0 }\n\t\t\t\tr={ radius }\n\t\t\t\tpathLength=\"100\"\n\t\t\t\tfill=\"white\"\n\t\t\t\tstroke=\"black\" // The stroke will be un-drawn, hence 'black' mask.\n\t\t\t\tstrokeWidth={ strokeWidth }\n\t\t\t\tstrokeDasharray=\"100, 1000\"\n\t\t\t\tstrokeDashoffset=\"0\"\n\t\t\t\tstyle={ { transform: `rotate(${ startAngle }) scaleY(${ scaleY })` } }\n\t\t\t>\n\t\t\t\t<animate\n\t\t\t\t\tattributeName=\"stroke-dashoffset\"\n\t\t\t\t\tfrom=\"0\"\n\t\t\t\t\tto=\"100.1\"\n\t\t\t\t\tdur={ animationDuration }\n\t\t\t\t\tfill=\"freeze\" // Same as CSS 'forwards' to retain the final state after animation.\n\t\t\t\t\tcalcMode=\"spline\" // custom easing\n\t\t\t\t\tkeySplines=\"0.42 0 0.58 1;0 0 1 1\" // ease-in-out ; linear (unimportant)\n\t\t\t\t\tkeyTimes={ `0;${ wipePercentage / 100 };1` }\n\t\t\t\t/>\n\t\t\t</circle>\n\t\t</mask>\n\t);\n}\n\nexport default RadialWipeAnimation;\n","import { Group } from '@visx/group';\nimport { Pie } from '@visx/shape';\nimport { useTooltip, useTooltipInPortal } from '@visx/tooltip';\nimport clsx from 'clsx';\nimport { useCallback, useContext, useMemo } from 'react';\nimport { Legend, useChartLegendItems } from '../../components/legend';\nimport { BaseTooltip } from '../../components/tooltip';\nimport {\n\tuseDataWithPercentages,\n\tuseLegendVisibilityData,\n\tusePrefersReducedMotion,\n} from '../../hooks';\nimport {\n\tGlobalChartsProvider,\n\tuseChartId,\n\tuseChartRegistration,\n\tuseGlobalChartsContext,\n\tuseGlobalChartsTheme,\n\tGlobalChartsContext,\n} from '../../providers';\nimport { CHART_SCOPE_CLASS } from '../../styles/chart-scope-class';\nimport { attachSubComponents, resolveFontSize } from '../../utils';\nimport { getStringWidth } from '../../visx/text';\nimport { Center } from '../private/center';\nimport { ChartSVG, ChartHTML, useChartChildren } from '../private/chart-composition';\nimport { ChartInstanceContext } from '../private/chart-instance-context';\nimport { ChartLayout } from '../private/chart-layout';\nimport { RadialWipeAnimation } from '../private/radial-wipe-animation/';\nimport { getAllHiddenMessage, SvgEmptyState } from '../private/svg-empty-state';\nimport { withResponsive, ResponsiveConfig } from '../private/with-responsive';\nimport styles from './pie-chart.module.scss';\nimport type { LegendValueDisplay } from '../../components/legend';\nimport type {\n\tBaseChartProps,\n\tDataPointPercentage,\n\tDataPointPercentageCalculated,\n\tOptional,\n} from '../../types';\nimport type { ChartComponentWithComposition } from '../private/chart-composition';\nimport type { SVGProps, MouseEvent, ReactNode, FC } from 'react';\n\n/**\n * Parameters passed to the renderTooltip function for pie charts.\n */\nexport type PieChartRenderTooltipParams = {\n\t/**\n\t * The data point being hovered, including label, value, and calculated percentage.\n\t */\n\ttooltipData: DataPointPercentageCalculated;\n};\n\n/**\n * Default tooltip renderer for pie charts.\n * Renders a BaseTooltip with the hovered segment's data.\n *\n * @param {PieChartRenderTooltipParams} params - The tooltip parameters containing the hovered data point\n * @return {ReactNode} The rendered tooltip content\n */\nconst renderDefaultPieTooltip = ( { tooltipData }: PieChartRenderTooltipParams ): ReactNode => {\n\treturn <BaseTooltip data={ tooltipData } top={ 0 } left={ 0 } renderContainer={ false } />;\n};\n\nexport interface PieChartProps extends BaseChartProps< DataPointPercentage[] > {\n\t/**\n\t * Inner radius in pixels. If > 0, creates a donut chart. Defaults to 0.\n\t */\n\tinnerRadius?: number;\n\n\t/**\n\t * Add padding to the chart\n\t */\n\tpadding?: number;\n\n\t/**\n\t * Thickness of the pie chart.\n\t * A value between 0 and 1, where 0 means no thickness\n\t * and 1 means the maximum thickness.\n\t */\n\tthickness?: number;\n\n\t/**\n\t * Scale of the gap between groups in the pie chart\n\t * A value between 0 and 1, where 0 means no gap.\n\t */\n\tgapScale?: number;\n\n\t/**\n\t * Scale of the corner radius for the pie chart segments.\n\t * A value between 0 and 1, where 0 means no corner radius.\n\t */\n\tcornerScale?: number;\n\n\t/**\n\t * Whether to show labels on pie segments. Defaults to true.\n\t */\n\tshowLabels?: boolean;\n\n\t/**\n\t * What type of value to display in the legend when showValues is true.\n\t * - 'percentage': Shows percentage values (e.g., \"23%\") [default]\n\t * - 'value': Shows raw numeric values (e.g., \"30000\")\n\t * - 'valueDisplay': Shows formatted values (e.g., \"30K\")\n\t * - 'none': Shows no values, only labels\n\t */\n\tlegendValueDisplay?: LegendValueDisplay;\n\n\t/**\n\t * Use the children prop to render additional elements on the chart.\n\t */\n\tchildren?: ReactNode;\n\n\t/**\n\t * Horizontal offset for tooltip positioning in pixels (default: 0)\n\t */\n\ttooltipOffsetX?: number;\n\n\t/**\n\t * Vertical offset for tooltip positioning in pixels (default: -15)\n\t */\n\ttooltipOffsetY?: number;\n\n\t/**\n\t * Custom render function for tooltip content.\n\t * When provided, replaces the default BaseTooltip with custom content.\n\t */\n\trenderTooltip?: ( params: PieChartRenderTooltipParams ) => ReactNode;\n}\n\n// Base props type with optional responsive properties\ntype PieChartBaseProps = Optional< PieChartProps, 'size' >;\n\n// Composition API types\ntype PieChartComponent = ChartComponentWithComposition< PieChartBaseProps >;\ntype PieChartResponsiveComponent = ChartComponentWithComposition<\n\tPieChartBaseProps & ResponsiveConfig\n>;\n\n/**\n * Validates the pie chart data\n * @param data - The data to validate\n * @return Object containing validation result and error message\n */\nconst validateData = ( data: DataPointPercentage[] ) => {\n\tif ( ! data.length ) {\n\t\treturn { isValid: false, message: 'No data available' };\n\t}\n\n\t// Check for negative values\n\tconst hasNegativeValues = data.some( item => item.value < 0 );\n\tif ( hasNegativeValues ) {\n\t\treturn { isValid: false, message: 'Invalid data: Negative values are not allowed' };\n\t}\n\n\t// Validate total value is greater than 0\n\tconst totalValue = data.reduce( ( sum, item ) => sum + item.value, 0 );\n\tif ( totalValue <= 0 ) {\n\t\treturn { isValid: false, message: 'Invalid data: Total value must be greater than 0' };\n\t}\n\n\treturn { isValid: true, message: '' };\n};\n\n/**\n * Renders a pie or donut chart using the provided data.\n *\n * @param {PieChartProps} props - Component props\n * @return {JSX.Element} The rendered chart component\n */\nconst PieChartInternal = ( {\n\tdata,\n\tchartId: providedChartId,\n\twithTooltips = false,\n\tclassName,\n\tshowLegend = false,\n\tlegend = {},\n\twidth: propWidth,\n\theight: propHeight,\n\tsize,\n\tanimation,\n\tthickness = 1,\n\tpadding = 0,\n\tgapScale = 0,\n\tcornerScale = 0,\n\tshowLabels = true,\n\tlegendValueDisplay = 'percentage',\n\tchildren = null,\n\ttooltipOffsetX = 0,\n\ttooltipOffsetY = -15,\n\trenderTooltip = renderDefaultPieTooltip,\n\tgap = 'md',\n}: PieChartProps ) => {\n\tconst legendInteractive = legend.interactive ?? false;\n\tconst legendPosition = legend.position ?? 'bottom';\n\n\tconst providerTheme = useGlobalChartsTheme();\n\tconst chartId = useChartId( providedChartId );\n\tconst { tooltipOpen, tooltipLeft, tooltipTop, tooltipData, hideTooltip, showTooltip } =\n\t\tuseTooltip< DataPointPercentageCalculated >();\n\n\t// Set up portal tooltip for better z-index handling\n\t// We get containerBounds to cancel out stale offsets in the position calculation\n\tconst { containerRef, TooltipInPortal, containerBounds } = useTooltipInPortal( {\n\t\tdetectBounds: true,\n\t\tscroll: true,\n\t\tdebounce: 0,\n\t} );\n\n\tconst onMouseLeave = useCallback( () => {\n\t\tif ( ! withTooltips ) {\n\t\t\treturn;\n\t\t}\n\t\thideTooltip();\n\t}, [ withTooltips, hideTooltip ] );\n\n\tconst { getElementStyles, isSeriesVisible } = useGlobalChartsContext();\n\n\t// Calculate percentages from values (single source of truth)\n\tconst dataWithPercentages = useDataWithPercentages( data );\n\n\t// Filter and recalculate data from the shared legend visibility state.\n\tconst { visibleData, allSegmentsHidden, legendData } = useLegendVisibilityData( {\n\t\tdata: dataWithPercentages,\n\t\tchartId,\n\t\tisSeriesVisible,\n\t} );\n\n\t// Memoize legend options to prevent unnecessary re-calculations\n\tconst legendOptions = useMemo(\n\t\t() => ( { showValues: true, legendValueDisplay } ),\n\t\t[ legendValueDisplay ]\n\t);\n\n\t// Create legend items using legendData (has recalculated percentages for visible items)\n\tconst legendItems = useChartLegendItems( legendData, legendOptions );\n\n\tconst { isValid, message } = validateData( data );\n\n\t// Process children to extract compound components\n\tconst { svgChildren, htmlChildren, legendChildren, otherChildren } = useChartChildren(\n\t\tchildren,\n\t\t'PieChart'\n\t);\n\n\t// Memoize metadata to prevent unnecessary re-registration\n\tconst chartMetadata = useMemo(\n\t\t() => ( {\n\t\t\tthickness,\n\t\t\tgapScale,\n\t\t\tcornerScale,\n\t\t} ),\n\t\t[ thickness, gapScale, cornerScale ]\n\t);\n\n\t// Register chart with context only if data is valid\n\tuseChartRegistration( {\n\t\tchartId,\n\t\tlegendItems,\n\t\tchartType: 'pie',\n\t\tisDataValid: isValid,\n\t\tmetadata: chartMetadata,\n\t} );\n\n\tconst prefersReducedMotion = usePrefersReducedMotion();\n\n\tif ( ! isValid ) {\n\t\treturn (\n\t\t\t<div className={ clsx( 'pie-chart', styles[ 'pie-chart' ], className ) }>\n\t\t\t\t<div className={ styles[ 'error-message' ] }>{ message }</div>\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Calculate the angle between each (use original data length for consistent spacing)\n\tconst padAngle = gapScale * ( ( 2 * Math.PI ) / data.length );\n\n\t// Map the data to include index for color assignment\n\t// When interactive, we need to find the original index to maintain consistent colors\n\tconst dataWithIndex = visibleData.map( d => {\n\t\tconst originalIndex = data.findIndex( item => item.label === d.label );\n\t\treturn {\n\t\t\t...d,\n\t\t\tindex: originalIndex >= 0 ? originalIndex : 0,\n\t\t};\n\t} );\n\n\tconst accessors = {\n\t\tvalue: ( d: DataPointPercentageCalculated ) => d.value,\n\t\tfill: ( d: DataPointPercentageCalculated & { index: number } ) => {\n\t\t\treturn getElementStyles( { data: d, index: d.index } ).color;\n\t\t},\n\t};\n\n\tconst legendElement = showLegend && (\n\t\t<Legend\n\t\t\torientation={ legend.orientation ?? 'horizontal' }\n\t\t\tposition={ legendPosition }\n\t\t\talignment={ legend.alignment ?? 'center' }\n\t\t\tlabelStyles={ legend.labelStyles }\n\t\t\titemClassName={ legend.itemClassName }\n\t\t\titemStyles={ legend.itemStyles }\n\t\t\tshapeStyles={ legend.shapeStyles }\n\t\t\tshape={ legend.shape ?? 'circle' }\n\t\t\tchartId={ chartId }\n\t\t\tinteractive={ legendInteractive }\n\t\t/>\n\t);\n\n\treturn (\n\t\t<ChartInstanceContext.Provider value={ { chartId } }>\n\t\t\t<ChartLayout\n\t\t\t\tlegendPosition={ legendPosition }\n\t\t\t\tlegendElement={ legendElement }\n\t\t\t\tlegendChildren={ legendChildren }\n\t\t\t\tgap={ gap }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'pie-chart',\n\t\t\t\t\tstyles[ 'pie-chart' ],\n\t\t\t\t\t// Fill parent when no explicit dimensions provided\n\t\t\t\t\t{ [ styles[ 'pie-chart--responsive' ] ]: ! propWidth && ! propHeight },\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth: propWidth || undefined,\n\t\t\t\t\theight: propHeight || undefined,\n\t\t\t\t} }\n\t\t\t\ttrailingContent={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ withTooltips && tooltipOpen && tooltipData && (\n\t\t\t\t\t\t\t<TooltipInPortal top={ tooltipTop || 0 } left={ tooltipLeft || 0 }>\n\t\t\t\t\t\t\t\t<div className={ CHART_SCOPE_CLASS } role=\"tooltip\">\n\t\t\t\t\t\t\t\t\t{ renderTooltip( { tooltipData } ) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</TooltipInPortal>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ htmlChildren }\n\t\t\t\t\t\t{ otherChildren }\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ ( { contentWidth, contentHeight } ) => {\n\t\t\t\t\tconst availableWidth = contentWidth > 0 ? contentWidth : 300;\n\t\t\t\t\tconst availableHeight = contentHeight > 0 ? contentHeight : 300;\n\t\t\t\t\tconst availableSize = Math.min( availableWidth, availableHeight );\n\t\t\t\t\tconst actualSize = size ? Math.min( size, availableSize ) : availableSize;\n\n\t\t\t\t\tconst width = actualSize;\n\t\t\t\t\tconst height = actualSize;\n\n\t\t\t\t\tconst radius = Math.min( width, height ) / 2;\n\t\t\t\t\tconst centerX = width / 2;\n\t\t\t\t\tconst centerY = height / 2;\n\n\t\t\t\t\tconst outerRadius = radius - padding;\n\t\t\t\t\tconst innerRadius = thickness === 0 ? 0 : outerRadius * ( 1 - thickness );\n\n\t\t\t\t\tconst maxCornerRadius = ( outerRadius - innerRadius ) / 2;\n\t\t\t\t\tconst cornerRadius = cornerScale\n\t\t\t\t\t\t? Math.min( cornerScale * outerRadius, maxCornerRadius )\n\t\t\t\t\t\t: 0;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Center ref={ containerRef }>\n\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\tviewBox={ `0 0 ${ width } ${ height }` }\n\t\t\t\t\t\t\t\tpreserveAspectRatio=\"xMidYMid meet\"\n\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\theight={ height }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<defs>\n\t\t\t\t\t\t\t\t\t<RadialWipeAnimation\n\t\t\t\t\t\t\t\t\t\tid={ `radial-wipe-${ chartId }` }\n\t\t\t\t\t\t\t\t\t\tradius={ outerRadius }\n\t\t\t\t\t\t\t\t\t\tinnerRadius={ innerRadius }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</defs>\n\n\t\t\t\t\t\t\t\t<Group\n\t\t\t\t\t\t\t\t\ttop={ centerY }\n\t\t\t\t\t\t\t\t\tleft={ centerX }\n\t\t\t\t\t\t\t\t\tmask={\n\t\t\t\t\t\t\t\t\t\tanimation && ! prefersReducedMotion ? `url(#radial-wipe-${ chartId })` : null\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ allSegmentsHidden ? (\n\t\t\t\t\t\t\t\t\t\t<SvgEmptyState x={ 0 } y={ 0 } width={ width } height={ height }>\n\t\t\t\t\t\t\t\t\t\t\t{ getAllHiddenMessage( legendInteractive, 'segments' ) }\n\t\t\t\t\t\t\t\t\t\t</SvgEmptyState>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<Pie< DataPointPercentageCalculated & { index: number } >\n\t\t\t\t\t\t\t\t\t\t\tdata={ dataWithIndex }\n\t\t\t\t\t\t\t\t\t\t\tpieValue={ accessors.value }\n\t\t\t\t\t\t\t\t\t\t\touterRadius={ outerRadius }\n\t\t\t\t\t\t\t\t\t\t\tinnerRadius={ innerRadius }\n\t\t\t\t\t\t\t\t\t\t\tpadAngle={ padAngle }\n\t\t\t\t\t\t\t\t\t\t\tcornerRadius={ cornerRadius }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ pie => {\n\t\t\t\t\t\t\t\t\t\t\t\treturn pie.arcs.map( ( arc, index ) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst [ centroidX, centroidY ] = pie.path.centroid( arc );\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst hasSpaceForLabel = arc.endAngle - arc.startAngle >= 0.25;\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst handleMouseMove = ( event: MouseEvent< SVGElement > ) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif ( ! withTooltips ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Don't show tooltip until container bounds are measured\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif ( containerBounds.width === 0 || containerBounds.height === 0 ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Use clientX/Y and subtract containerBounds to cancel out any stale offset.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// TooltipInPortal calculates: tooltipLeft + containerBounds.left + scrollX\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// By passing (clientX - containerBounds.left), we get:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// (clientX - containerBounds.left) + containerBounds.left + scrollX = clientX + scrollX\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// This gives correct page coordinates regardless of stale bounds.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tshowTooltip( {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttooltipData: arc.data,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttooltipLeft: event.clientX - containerBounds.left + tooltipOffsetX,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttooltipTop: event.clientY - containerBounds.top + tooltipOffsetY,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst pathProps: SVGProps< SVGPathElement > & {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'data-testid'?: string;\n\t\t\t\t\t\t\t\t\t\t\t\t\t} = {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\td: pie.path( arc ) || '',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfill: accessors.fill( arc.data ),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'data-testid': 'pie-segment',\n\t\t\t\t\t\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst groupProps: SVGProps< SVGGElement > = {};\n\t\t\t\t\t\t\t\t\t\t\t\t\tif ( withTooltips ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tgroupProps.onMouseMove = handleMouseMove;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tgroupProps.onMouseLeave = onMouseLeave;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst svgLabelSmall = providerTheme.svgLabelSmall;\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst fontSize = resolveFontSize( svgLabelSmall?.fontSize ) ?? 12;\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst estimatedTextWidth = getStringWidth( arc.data.label, {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfontSize,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfontFamily: svgLabelSmall?.fontFamily,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfontWeight: svgLabelSmall?.fontWeight,\n\t\t\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst labelPadding = 6;\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst backgroundWidth = estimatedTextWidth + labelPadding * 2;\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst backgroundHeight = fontSize + labelPadding * 2;\n\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<g key={ `arc-${ index }` } { ...groupProps }>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<path { ...pathProps } />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ showLabels && hasSpaceForLabel && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<g>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ providerTheme.labelBackgroundColor && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<rect\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tx={ centroidX - backgroundWidth / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ty={ centroidY - backgroundHeight / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twidth={ backgroundWidth }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\theight={ backgroundHeight }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfill={ providerTheme.labelBackgroundColor }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\trx={ 4 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\try={ 4 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpointerEvents=\"none\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<text\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tx={ centroidX }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ty={ centroidY }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdy=\".33em\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfill={ providerTheme.labelTextColor || '#333' }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfontSize={ fontSize }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttextAnchor=\"middle\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpointerEvents=\"none\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ arc.data.label }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</text>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</g>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</g>\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t</Pie>\n\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t{ /* Render SVG children (like Group, Text) inside the SVG */ }\n\t\t\t\t\t\t\t\t\t{ ! allSegmentsHidden && svgChildren }\n\t\t\t\t\t\t\t\t</Group>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t</Center>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t</ChartLayout>\n\t\t</ChartInstanceContext.Provider>\n\t);\n};\n\nconst PieChartWithProvider: FC< PieChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, don't create a new one\n\tif ( existingContext ) {\n\t\treturn <PieChartInternal { ...props } />;\n\t}\n\n\t// Otherwise, create our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<PieChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nPieChartWithProvider.displayName = 'PieChart';\n\n// Create PieChart with composition API\nconst PieChart = attachSubComponents( PieChartWithProvider, {\n\tLegend: Legend,\n\tSVG: ChartSVG,\n\tHTML: ChartHTML,\n} ) as PieChartComponent;\n\n// Create responsive PieChart with composition API\nconst PieChartResponsive = attachSubComponents(\n\twithResponsive< PieChartProps >( PieChartWithProvider ),\n\t{\n\t\tLegend: Legend,\n\t\tSVG: ChartSVG,\n\t\tHTML: ChartHTML,\n\t}\n) as PieChartResponsiveComponent;\n\nexport { PieChartResponsive as default, PieChart as PieChartUnresponsive };\n","import { Group } from '@visx/group';\nimport { Pie } from '@visx/shape';\nimport { Text } from '@visx/text';\nimport { useTooltip, useTooltipInPortal } from '@visx/tooltip';\nimport clsx from 'clsx';\nimport { useCallback, useContext, useMemo } from 'react';\nimport { Legend, useChartLegendItems } from '../../components/legend';\nimport { BaseTooltip } from '../../components/tooltip';\nimport {\n\tuseDataWithPercentages,\n\tuseLegendVisibilityData,\n\tusePrefersReducedMotion,\n} from '../../hooks';\nimport {\n\tGlobalChartsProvider,\n\tuseChartId,\n\tuseChartRegistration,\n\tuseGlobalChartsContext,\n\tGlobalChartsContext,\n} from '../../providers';\nimport { CHART_SCOPE_CLASS } from '../../styles/chart-scope-class';\nimport { attachSubComponents } from '../../utils';\nimport { Center } from '../private/center';\nimport { ChartSVG, ChartHTML, useChartChildren } from '../private/chart-composition';\nimport { ChartInstanceContext } from '../private/chart-instance-context';\nimport { ChartLayout } from '../private/chart-layout';\nimport { RadialWipeAnimation } from '../private/radial-wipe-animation';\nimport { getAllHiddenMessage, SvgEmptyState } from '../private/svg-empty-state';\nimport { withResponsive } from '../private/with-responsive';\nimport styles from './pie-semi-circle-chart.module.scss';\nimport type { LegendValueDisplay } from '../../components/legend';\nimport type {\n\tBaseChartProps,\n\tDataPointPercentage,\n\tDataPointPercentageCalculated,\n\tOptional,\n} from '../../types';\nimport type { ChartComponentWithComposition } from '../private/chart-composition';\nimport type { ResponsiveConfig } from '../private/with-responsive';\nimport type { PieProvidedProps } from '@visx/shape';\nimport type { FC, MouseEvent, ReactNode } from 'react';\n\n/**\n * Parameters passed to the renderTooltip function for semi-circle charts.\n */\nexport type PieSemiCircleChartRenderTooltipParams = {\n\t/**\n\t * The data point being hovered, including label, value, and calculated percentage.\n\t */\n\ttooltipData: DataPointPercentageCalculated;\n};\n\n/**\n * Default tooltip renderer for semi-circle pie charts.\n * Renders a BaseTooltip with the hovered segment's data.\n *\n * @param {PieSemiCircleChartRenderTooltipParams} params - The tooltip parameters containing the hovered data point\n * @return {ReactNode} The rendered tooltip content\n */\nconst renderDefaultPieSemiCircleTooltip = ( {\n\ttooltipData,\n}: PieSemiCircleChartRenderTooltipParams ): ReactNode => {\n\treturn <BaseTooltip data={ tooltipData } top={ 0 } left={ 0 } renderContainer={ false } />;\n};\n\nconst PAD_ANGLE = 0.03; // Padding between segments\nconst DEFAULT_WIDTH = 400;\n\nexport interface PieSemiCircleChartProps extends BaseChartProps< DataPointPercentage[] > {\n\t/**\n\t * Explicit width of the chart container in pixels.\n\t * When omitted, the chart fills its parent container's width.\n\t * The chart always maintains a 2:1 width-to-height ratio, constrained by available space.\n\t */\n\twidth?: number;\n\n\t/**\n\t * Thickness of the pie chart. A value between 0 and 1\n\t */\n\tthickness?: number;\n\n\t/**\n\t * Direction of chart rendering\n\t * true for clockwise, false for counter-clockwise\n\t */\n\tclockwise?: boolean;\n\n\t/**\n\t * Label text to display above the chart\n\t */\n\tlabel?: string;\n\n\t/**\n\t * Note text to display below the label\n\t */\n\tnote?: string;\n\n\t/**\n\t * Use the children prop to render additional elements on the chart.\n\t */\n\tchildren?: ReactNode;\n\n\t/**\n\t * What type of value to display in the legend when showValues is true.\n\t * - 'percentage': Shows percentage values (e.g., \"23%\") [default]\n\t * - 'value': Shows raw numeric values (e.g., \"30000\")\n\t * - 'valueDisplay': Shows formatted values (e.g., \"30K\")\n\t * - 'none': Shows no values, only labels\n\t */\n\tlegendValueDisplay?: LegendValueDisplay;\n\n\t/**\n\t * Horizontal offset for tooltip positioning in pixels (default: 0)\n\t */\n\ttooltipOffsetX?: number;\n\n\t/**\n\t * Vertical offset for tooltip positioning in pixels (default: -15)\n\t */\n\ttooltipOffsetY?: number;\n\n\t/**\n\t * Custom render function for tooltip content.\n\t * When provided, replaces the default BaseTooltip with custom content.\n\t */\n\trenderTooltip?: ( params: PieSemiCircleChartRenderTooltipParams ) => ReactNode;\n}\n\n// Base props type with optional responsive properties\ntype PieSemiCircleChartBaseProps = Optional< PieSemiCircleChartProps, 'width' >;\n\n// Composition API types\ntype PieSemiCircleChartComponent = ChartComponentWithComposition< PieSemiCircleChartBaseProps >;\ntype PieSemiCircleChartResponsiveComponent = ChartComponentWithComposition<\n\tPieSemiCircleChartBaseProps & ResponsiveConfig\n>;\n\nexport type ArcData = PieProvidedProps< DataPointPercentageCalculated >[ 'arcs' ][ number ];\n\n/**\n * Validates the semi-circle pie chart data\n * @param data - The data to validate\n * @return Object containing validation result and error message\n */\nconst validateData = ( data: DataPointPercentage[] ) => {\n\tif ( ! data.length ) {\n\t\treturn { isValid: false, message: 'No data available' };\n\t}\n\n\t// Check for negative values\n\tconst hasNegativeValues = data.some( item => item.value < 0 );\n\tif ( hasNegativeValues ) {\n\t\treturn { isValid: false, message: 'Invalid data: Negative values are not allowed' };\n\t}\n\n\t// Validate total value is greater than 0\n\tconst totalValue = data.reduce( ( sum, item ) => sum + item.value, 0 );\n\tif ( totalValue <= 0 ) {\n\t\treturn { isValid: false, message: 'Invalid data: Total value must be greater than 0' };\n\t}\n\n\treturn { isValid: true, message: '' };\n};\n\nconst PieSemiCircleChartInternal: FC< PieSemiCircleChartProps > = ( {\n\tdata,\n\tchartId: providedChartId,\n\twidth: propWidth,\n\theight: propHeight,\n\tthickness = 0.4,\n\tclockwise = true,\n\twithTooltips = false,\n\tshowLegend = false,\n\tlegend = {},\n\tlegendValueDisplay = 'percentage',\n\tlabel,\n\tanimation,\n\tnote,\n\tclassName,\n\tchildren,\n\ttooltipOffsetX = 0,\n\ttooltipOffsetY = -15,\n\trenderTooltip = renderDefaultPieSemiCircleTooltip,\n\tgap = 'md',\n} ) => {\n\tconst legendInteractive = legend.interactive ?? false;\n\tconst legendPosition = legend.position ?? 'bottom';\n\n\tconst chartId = useChartId( providedChartId );\n\tconst { tooltipOpen, tooltipLeft, tooltipTop, tooltipData, hideTooltip, showTooltip } =\n\t\tuseTooltip< DataPointPercentageCalculated >();\n\n\t// Set up portal tooltip for better z-index handling\n\t// We get containerBounds to cancel out stale offsets in the position calculation\n\tconst { containerRef, TooltipInPortal, containerBounds } = useTooltipInPortal( {\n\t\tdetectBounds: true,\n\t\tscroll: true,\n\t\tdebounce: 0,\n\t} );\n\n\tconst handleMouseMove = useCallback(\n\t\t( event: MouseEvent< SVGElement >, arc: ArcData ) => {\n\t\t\t// Don't show tooltip until container bounds are measured\n\t\t\tif ( containerBounds.width === 0 || containerBounds.height === 0 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Use clientX/Y and subtract containerBounds to cancel out any stale offset.\n\t\t\t// TooltipInPortal calculates: tooltipLeft + containerBounds.left + scrollX\n\t\t\t// By passing (clientX - containerBounds.left), we get:\n\t\t\t// (clientX - containerBounds.left) + containerBounds.left + scrollX = clientX + scrollX\n\t\t\t// This gives correct page coordinates regardless of stale bounds.\n\t\t\tshowTooltip( {\n\t\t\t\ttooltipData: arc.data,\n\t\t\t\ttooltipLeft: event.clientX - containerBounds.left + tooltipOffsetX,\n\t\t\t\ttooltipTop: event.clientY - containerBounds.top + tooltipOffsetY,\n\t\t\t} );\n\t\t},\n\t\t[\n\t\t\tcontainerBounds.width,\n\t\t\tcontainerBounds.height,\n\t\t\tcontainerBounds.left,\n\t\t\tcontainerBounds.top,\n\t\t\tshowTooltip,\n\t\t\ttooltipOffsetX,\n\t\t\ttooltipOffsetY,\n\t\t]\n\t);\n\n\tconst handleMouseLeave = useCallback( () => {\n\t\thideTooltip();\n\t}, [ hideTooltip ] );\n\n\tconst handleArcMouseMove = useCallback(\n\t\t( arc: ArcData ) => ( event: MouseEvent< SVGElement > ) => {\n\t\t\thandleMouseMove( event, arc );\n\t\t},\n\t\t[ handleMouseMove ]\n\t);\n\n\t// Validate data first to get validation result\n\tconst { isValid, message } = validateData( data );\n\n\tconst { getElementStyles, isSeriesVisible } = useGlobalChartsContext();\n\n\t// Calculate percentages from values (single source of truth)\n\tconst dataWithPercentages = useDataWithPercentages( data );\n\n\t// Filter and recalculate data from the shared legend visibility state.\n\tconst { visibleData, allSegmentsHidden, legendData } = useLegendVisibilityData( {\n\t\tdata: dataWithPercentages,\n\t\tchartId,\n\t\tisSeriesVisible,\n\t} );\n\n\t// Define accessors with useMemo to avoid changing dependencies\n\tconst accessors = useMemo(\n\t\t() => ( {\n\t\t\tvalue: ( d: DataPointPercentageCalculated ) => d.value,\n\t\t\tsort: (\n\t\t\t\ta: DataPointPercentageCalculated & { index: number },\n\t\t\t\tb: DataPointPercentageCalculated & { index: number }\n\t\t\t) => b.value - a.value,\n\t\t\tfill: ( d: DataPointPercentageCalculated & { index: number } ) =>\n\t\t\t\tgetElementStyles( { data: d, index: d.index } ).color,\n\t\t} ),\n\t\t[ getElementStyles ]\n\t);\n\n\t// Memoize legend options to prevent unnecessary re-calculations\n\tconst legendOptions = useMemo(\n\t\t() => ( { showValues: true, legendValueDisplay } ),\n\t\t[ legendValueDisplay ]\n\t);\n\n\t// Create legend items using legendData (has recalculated percentages for visible items)\n\tconst legendItems = useChartLegendItems( legendData, legendOptions );\n\n\t// Process children to extract compound components\n\tconst { svgChildren, htmlChildren, legendChildren, otherChildren } = useChartChildren(\n\t\tchildren,\n\t\t'PieSemiCircleChart'\n\t);\n\n\t// Memoize metadata to prevent unnecessary re-registration\n\tconst chartMetadata = useMemo(\n\t\t() => ( {\n\t\t\tthickness,\n\t\t\tclockwise,\n\t\t} ),\n\t\t[ thickness, clockwise ]\n\t);\n\n\t// Register chart with context only if data is valid\n\tuseChartRegistration( {\n\t\tchartId,\n\t\tlegendItems,\n\t\tchartType: 'pie-semi-circle',\n\t\tisDataValid: isValid,\n\t\tmetadata: chartMetadata,\n\t} );\n\n\tconst prefersReducedMotion = usePrefersReducedMotion();\n\n\tconst effectiveWidth = propWidth || DEFAULT_WIDTH;\n\n\tif ( ! isValid ) {\n\t\tconst errorWidth = propHeight\n\t\t\t? Math.min( propWidth || propHeight * 2, propHeight * 2 )\n\t\t\t: effectiveWidth;\n\t\tconst errorHeight = errorWidth / 2;\n\n\t\treturn (\n\t\t\t<div className={ styles[ 'pie-semi-circle-chart' ] }>\n\t\t\t\t<svg width={ errorWidth } height={ errorHeight } data-testid=\"pie-chart-svg\">\n\t\t\t\t\t<text x=\"50%\" y=\"50%\" textAnchor=\"middle\" className={ styles.error }>\n\t\t\t\t\t\t{ message }\n\t\t\t\t\t</text>\n\t\t\t\t</svg>\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Map data with index for color assignment\n\t// When interactive, we need to find the original index to maintain consistent colors\n\tconst dataWithIndex = visibleData.map( d => {\n\t\tconst originalIndex = data.findIndex( item => item.label === d.label );\n\t\treturn {\n\t\t\t...d,\n\t\t\tindex: originalIndex >= 0 ? originalIndex : 0,\n\t\t};\n\t} );\n\n\t// Configure pie angles based on clockwise direction\n\tconst startAngle = clockwise ? -Math.PI / 2 : Math.PI / 2;\n\tconst endAngle = clockwise ? Math.PI / 2 : -Math.PI / 2;\n\n\tconst legendElement = showLegend && (\n\t\t<Legend\n\t\t\torientation={ legend.orientation ?? 'horizontal' }\n\t\t\tposition={ legendPosition }\n\t\t\talignment={ legend.alignment ?? 'center' }\n\t\t\tlabelStyles={ legend.labelStyles }\n\t\t\titemClassName={ legend.itemClassName }\n\t\t\titemStyles={ legend.itemStyles }\n\t\t\tshapeStyles={ legend.shapeStyles }\n\t\t\tshape={ legend.shape ?? 'circle' }\n\t\t\tchartId={ chartId }\n\t\t\tinteractive={ legendInteractive }\n\t\t/>\n\t);\n\n\treturn (\n\t\t<ChartInstanceContext.Provider value={ { chartId } }>\n\t\t\t<ChartLayout\n\t\t\t\tlegendPosition={ legendPosition }\n\t\t\t\tlegendElement={ legendElement }\n\t\t\t\tlegendChildren={ legendChildren }\n\t\t\t\tgap={ gap }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'pie-semi-circle-chart',\n\t\t\t\t\tstyles[ 'pie-semi-circle-chart' ],\n\t\t\t\t\t{\n\t\t\t\t\t\t[ styles[ 'pie-semi-circle-chart--responsive' ] ]: ! propWidth && ! propHeight,\n\t\t\t\t\t},\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth: propWidth || undefined,\n\t\t\t\t\theight: propHeight || undefined,\n\t\t\t\t} }\n\t\t\t\tdata-testid=\"pie-chart-container\"\n\t\t\t\ttrailingContent={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ withTooltips && tooltipOpen && tooltipData && (\n\t\t\t\t\t\t\t<TooltipInPortal top={ tooltipTop || 0 } left={ tooltipLeft || 0 }>\n\t\t\t\t\t\t\t\t<div className={ CHART_SCOPE_CLASS } role=\"tooltip\">\n\t\t\t\t\t\t\t\t\t{ renderTooltip( { tooltipData } ) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</TooltipInPortal>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ htmlChildren }\n\t\t\t\t\t\t{ otherChildren }\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ ( { contentWidth, contentHeight } ) => {\n\t\t\t\t\t// Calculate chart dimensions maintaining the 2:1 width-to-height ratio.\n\t\t\t\t\t// Use measured dimensions to respect height constraints, falling back\n\t\t\t\t\t// to explicit props during initial render before measurement is available.\n\t\t\t\t\tconst availableWidth = contentWidth > 0 ? contentWidth : effectiveWidth;\n\t\t\t\t\tconst availableHeight =\n\t\t\t\t\t\tcontentHeight > 0 ? contentHeight : propHeight || effectiveWidth / 2;\n\t\t\t\t\t// Constrain width so that height (= width / 2) never exceeds the available height\n\t\t\t\t\tconst width = Math.min( availableWidth, availableHeight * 2 );\n\t\t\t\t\tconst height = width / 2;\n\t\t\t\t\tconst radius = height; // For a semi-circle, radius equals the SVG height\n\t\t\t\t\tconst innerRadius = radius * ( 1 - thickness );\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Center ref={ containerRef }>\n\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\theight={ height }\n\t\t\t\t\t\t\t\tviewBox={ `0 0 ${ width } ${ height }` }\n\t\t\t\t\t\t\t\tdata-testid=\"pie-chart-svg\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<defs>\n\t\t\t\t\t\t\t\t\t<RadialWipeAnimation\n\t\t\t\t\t\t\t\t\t\tid={ `radial-wipe-${ chartId }` }\n\t\t\t\t\t\t\t\t\t\tradius={ radius }\n\t\t\t\t\t\t\t\t\t\tinnerRadius={ innerRadius }\n\t\t\t\t\t\t\t\t\t\tstartAngle=\"-180deg\"\n\t\t\t\t\t\t\t\t\t\twipePercentage={ 50 }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</defs>\n\n\t\t\t\t\t\t\t\t{ /* Main chart group centered horizontally and positioned at bottom */ }\n\t\t\t\t\t\t\t\t<Group\n\t\t\t\t\t\t\t\t\ttop={ height }\n\t\t\t\t\t\t\t\t\tleft={ width / 2 }\n\t\t\t\t\t\t\t\t\tmask={\n\t\t\t\t\t\t\t\t\t\tanimation && ! prefersReducedMotion ? `url(#radial-wipe-${ chartId })` : null\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ allSegmentsHidden ? (\n\t\t\t\t\t\t\t\t\t\t<SvgEmptyState x={ 0 } y={ -radius / 2 } width={ width } height={ height }>\n\t\t\t\t\t\t\t\t\t\t\t{ getAllHiddenMessage( legendInteractive, 'segments' ) }\n\t\t\t\t\t\t\t\t\t\t</SvgEmptyState>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t{ /* Pie chart */ }\n\t\t\t\t\t\t\t\t\t\t\t<Pie< DataPointPercentageCalculated & { index: number } >\n\t\t\t\t\t\t\t\t\t\t\t\tdata={ dataWithIndex }\n\t\t\t\t\t\t\t\t\t\t\t\tpieValue={ accessors.value }\n\t\t\t\t\t\t\t\t\t\t\t\touterRadius={ radius }\n\t\t\t\t\t\t\t\t\t\t\t\tinnerRadius={ innerRadius }\n\t\t\t\t\t\t\t\t\t\t\t\tcornerRadius={ 3 }\n\t\t\t\t\t\t\t\t\t\t\t\tpadAngle={ PAD_ANGLE }\n\t\t\t\t\t\t\t\t\t\t\t\tstartAngle={ startAngle }\n\t\t\t\t\t\t\t\t\t\t\t\tendAngle={ endAngle }\n\t\t\t\t\t\t\t\t\t\t\t\tpieSort={ accessors.sort }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ pie => {\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn pie.arcs.map( arc => (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<g\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={ arc.data.label }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonMouseMove={ withTooltips ? handleArcMouseMove( arc ) : undefined }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonMouseLeave={ withTooltips ? handleMouseLeave : undefined }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\td={ pie.path( arc ) || '' }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfill={ accessors.fill( arc.data ) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata-testid=\"pie-segment\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</g>\n\t\t\t\t\t\t\t\t\t\t\t\t\t) );\n\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t</Pie>\n\n\t\t\t\t\t\t\t\t\t\t\t{ /* Label and note text */ }\n\t\t\t\t\t\t\t\t\t\t\t<Group>\n\t\t\t\t\t\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\t\t\t\t\t\ttextAnchor=\"middle\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tverticalAnchor=\"start\"\n\t\t\t\t\t\t\t\t\t\t\t\t\ty={ -40 } // Position above the chart with space for note\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName={ styles.label }\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\t\t\t\t\t\ttextAnchor=\"middle\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tverticalAnchor=\"start\"\n\t\t\t\t\t\t\t\t\t\t\t\t\ty={ -20 } // Position between label and chart\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName={ styles.note }\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ note }\n\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t</Group>\n\n\t\t\t\t\t\t\t\t\t\t\t{ /* Render SVG children from composition API */ }\n\t\t\t\t\t\t\t\t\t\t\t{ ! allSegmentsHidden && svgChildren }\n\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</Group>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t</Center>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t</ChartLayout>\n\t\t</ChartInstanceContext.Provider>\n\t);\n};\n\nconst PieSemiCircleChartWithProvider: FC< PieSemiCircleChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, don't create a new one\n\tif ( existingContext ) {\n\t\treturn <PieSemiCircleChartInternal { ...props } />;\n\t}\n\n\t// Otherwise, create our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<PieSemiCircleChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nPieSemiCircleChartWithProvider.displayName = 'PieSemiCircleChart';\n\n// Create PieSemiCircleChart with composition API\nconst PieSemiCircleChart = attachSubComponents( PieSemiCircleChartWithProvider, {\n\tLegend: Legend,\n\tSVG: ChartSVG,\n\tHTML: ChartHTML,\n} ) as PieSemiCircleChartComponent;\n\n// Create responsive PieSemiCircleChart with composition API\nconst PieSemiCircleChartResponsive = attachSubComponents(\n\twithResponsive< PieSemiCircleChartProps >( PieSemiCircleChartWithProvider ),\n\t{\n\t\tLegend: Legend,\n\t\tSVG: ChartSVG,\n\t\tHTML: ChartHTML,\n\t}\n) as PieSemiCircleChartResponsiveComponent;\n\nexport {\n\tPieSemiCircleChartResponsive as default,\n\tPieSemiCircleChart as PieSemiCircleChartUnresponsive,\n};\n","import clsx from 'clsx';\nimport { useMemo, forwardRef } from 'react';\nimport { useGlobalChartsTheme } from '../../providers';\nimport { LineChartUnresponsive } from '../line-chart';\nimport { withResponsive } from '../private/with-responsive';\nimport styles from './sparkline.module.scss';\nimport type { SparklineProps } from './types';\nimport type { SeriesData } from '../../types';\n\nconst DEFAULT_WIDTH = 100;\nconst DEFAULT_HEIGHT = 40;\n\n/**\n * Transforms a simple number array into SeriesData format for LineChart.\n * Uses index-based dates to create a linear x-axis.\n *\n * @param data - Array of numeric values to plot\n * @param color - Optional color for the line stroke\n * @param strokeWidth - Optional stroke width for the line\n * @return SeriesData array suitable for LineChart\n */\nconst transformToSeriesData = (\n\tdata: number[],\n\tcolor?: string,\n\tstrokeWidth?: number\n): SeriesData[] => {\n\t// Use a fixed base date and increment by index to create linear spacing\n\tconst baseDate = new Date( 2000, 0, 1 );\n\n\treturn [\n\t\t{\n\t\t\tlabel: 'sparkline',\n\t\t\tdata: data.map( ( value, index ) => ( {\n\t\t\t\tdate: new Date( baseDate.getTime() + index * 86400000 ), // Add days\n\t\t\t\tvalue,\n\t\t\t} ) ),\n\t\t\toptions: {\n\t\t\t\tstroke: color,\n\t\t\t\tseriesLineStyle: strokeWidth ? { strokeWidth } : undefined,\n\t\t\t},\n\t\t},\n\t];\n};\n\nconst SparklineComponent = forwardRef< HTMLDivElement, SparklineProps >(\n\t(\n\t\t{\n\t\t\tdata,\n\t\t\twidth = DEFAULT_WIDTH,\n\t\t\theight = DEFAULT_HEIGHT,\n\t\t\tcolor,\n\t\t\tstrokeWidth: strokeWidthProp,\n\t\t\twithGradientFill = true,\n\t\t\tgradient,\n\t\t\tclassName,\n\t\t\tchartId,\n\t\t\tmargin: marginProp,\n\t\t\tanimation,\n\t\t},\n\t\tref\n\t) => {\n\t\tconst theme = useGlobalChartsTheme();\n\n\t\t// Get theme defaults for sparkline\n\t\tconst themeStrokeWidth = theme.sparkline?.strokeWidth ?? 1.5;\n\n\t\t// Use prop values or fall back to theme defaults\n\t\tconst strokeWidth = strokeWidthProp ?? themeStrokeWidth;\n\n\t\t// Transform number[] to SeriesData[] for LineChart\n\t\tconst seriesData = useMemo( () => {\n\t\t\tif ( ! data || data.length === 0 ) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\treturn transformToSeriesData( data, color, strokeWidth );\n\t\t}, [ data, color, strokeWidth ] );\n\n\t\t// Merge margins with theme defaults\n\t\tconst finalMargin = useMemo( () => {\n\t\t\tconst themeMargin = theme.sparkline?.margin ?? { top: 2, right: 2, bottom: 2, left: 2 };\n\t\t\tconst margin = marginProp ?? themeMargin;\n\t\t\treturn {\n\t\t\t\t...themeMargin,\n\t\t\t\t...margin,\n\t\t\t};\n\t\t}, [ marginProp, theme.sparkline?.margin ] );\n\n\t\t// Build gradient options for the series if custom gradient is provided\n\t\t// Note: This must be called before any early returns to follow React hooks rules\n\t\tconst seriesWithGradient = useMemo( () => {\n\t\t\tif ( ! gradient || seriesData.length === 0 ) {\n\t\t\t\treturn seriesData;\n\t\t\t}\n\n\t\t\treturn seriesData.map( series => ( {\n\t\t\t\t...series,\n\t\t\t\toptions: {\n\t\t\t\t\t...series.options,\n\t\t\t\t\tgradient: {\n\t\t\t\t\t\tfrom: gradient.from || color || '#000000',\n\t\t\t\t\t\tto: gradient.to || '#ffffff',\n\t\t\t\t\t\tfromOpacity: gradient.fromOpacity ?? 0.5,\n\t\t\t\t\t\ttoOpacity: gradient.toOpacity ?? 0.0,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t} ) );\n\t\t}, [ seriesData, gradient, color ] );\n\n\t\t// Handle empty data\n\t\tif ( ! data || data.length === 0 ) {\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'sparkline',\n\t\t\t\t\t\tstyles.sparkline,\n\t\t\t\t\t\tstyles[ 'sparkline--empty' ],\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ { width, height } }\n\t\t\t\t\tdata-testid=\"sparkline-empty\"\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\t// Handle single data point - render a simple dot\n\t\tif ( data.length === 1 ) {\n\t\t\tconst cx = width / 2;\n\t\t\tconst cy = height / 2;\n\t\t\tconst resolvedColor = color || '#000000';\n\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'sparkline',\n\t\t\t\t\t\tstyles.sparkline,\n\t\t\t\t\t\tstyles[ 'sparkline--single-point' ],\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ { width, height } }\n\t\t\t\t\tdata-testid=\"sparkline-single-point\"\n\t\t\t\t>\n\t\t\t\t\t<svg width={ width } height={ height } aria-hidden=\"true\">\n\t\t\t\t\t\t<circle cx={ cx } cy={ cy } r={ strokeWidth * 1.5 } fill={ resolvedColor } />\n\t\t\t\t\t</svg>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tref={ ref }\n\t\t\t\tclassName={ clsx( 'sparkline', styles.sparkline, className ) }\n\t\t\t\tdata-testid=\"sparkline\"\n\t\t\t>\n\t\t\t\t<LineChartUnresponsive\n\t\t\t\t\tdata={ seriesWithGradient }\n\t\t\t\t\twidth={ width }\n\t\t\t\t\theight={ height }\n\t\t\t\t\tmargin={ finalMargin }\n\t\t\t\t\tchartId={ chartId }\n\t\t\t\t\twithGradientFill={ withGradientFill }\n\t\t\t\t\twithTooltips={ false }\n\t\t\t\t\tshowLegend={ false }\n\t\t\t\t\tgridVisibility=\"none\"\n\t\t\t\t\toptions={ {\n\t\t\t\t\t\taxis: {\n\t\t\t\t\t\t\tx: { display: false },\n\t\t\t\t\t\t\ty: { display: false },\n\t\t\t\t\t\t},\n\t\t\t\t\t} }\n\t\t\t\t\tcurveType=\"monotone\"\n\t\t\t\t\tanimation={ animation }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n);\n\nSparklineComponent.displayName = 'SparklineComponent';\n\n/**\n * Sparkline - A minimal line chart for inline data visualization.\n *\n * Sparklines are compact charts designed to be embedded inline with text or\n * displayed in small spaces like table cells or dashboards. They show trends\n * without axes, labels, or other chart chrome.\n *\n * This component is built on top of LineChart with preconfigured settings\n * for minimal display (no axes, grid, tooltips, or legend).\n */\nconst SparklineUnresponsive = SparklineComponent;\n\nSparklineUnresponsive.displayName = 'SparklineUnresponsive';\n\n/**\n * Responsive Sparkline chart component\n */\nconst Sparkline = withResponsive< SparklineProps >( SparklineUnresponsive );\n\nexport { Sparkline as default, SparklineUnresponsive };\n","import clsx from 'clsx';\nimport { useStandaloneScopeClass } from '../../providers/chart-scope';\nimport styles from './trend-indicator.module.scss';\nimport type { TrendIndicatorProps, TrendDirection } from './types';\n\nconst DIRECTION_LABELS: Record< TrendDirection, string > = {\n\tup: 'Increase',\n\tdown: 'Decrease',\n\tneutral: 'No change',\n};\n\nconst Icon = ( { direction }: { direction: TrendDirection } ) => {\n\tif ( direction === 'neutral' ) {\n\t\treturn null;\n\t}\n\n\tconst isUp = direction === 'up';\n\treturn (\n\t\t<svg\n\t\t\tclassName={ styles[ 'trend-indicator__icon' ] }\n\t\t\tviewBox=\"0 0 16 16\"\n\t\t\tfill=\"none\"\n\t\t\taria-hidden=\"true\"\n\t\t>\n\t\t\t<path\n\t\t\t\td={ isUp ? 'M8 13V3M4 7l4-4 4 4' : 'M8 3v10M4 9l4 4 4-4' }\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t</svg>\n\t);\n};\n\n/**\n * TrendIndicator displays a directional trend with a value.\n * Used to show percentage changes or growth metrics.\n *\n * @param {TrendIndicatorProps} props - Component props\n * @return {JSX.Element} The rendered trend indicator\n */\nexport function TrendIndicator( {\n\tdirection,\n\tvalue,\n\tclassName,\n\tstyle,\n\tshowIcon = true,\n}: TrendIndicatorProps ) {\n\tconst ariaLabel = `${ DIRECTION_LABELS[ direction ] }: ${ value }`;\n\tconst standaloneScopeClass = useStandaloneScopeClass();\n\n\treturn (\n\t\t<span\n\t\t\tclassName={ clsx(\n\t\t\t\tstandaloneScopeClass,\n\t\t\t\tstyles[ 'trend-indicator' ],\n\t\t\t\tstyles[ `trend-indicator--${ direction }` ],\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\tstyle={ style }\n\t\t\taria-label={ ariaLabel }\n\t\t>\n\t\t\t{ showIcon && <Icon direction={ direction } /> }\n\t\t\t<span className={ styles[ 'trend-indicator__value' ] }>{ value }</span>\n\t\t</span>\n\t);\n}\n"],"x_google_ignoreList":[22,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAa,wBAAA,GAAA,MAAA,cAAA,CAA0E,IAAK;;;ACjB5F,MAAa,gCAA2D;CACvE,MAAM,WAAA,GAAA,MAAA,WAAA,CAAsB,oBAAqB;CACjD,IAAK,CAAE,SACN,MAAM,IAAI,MAAO,+DAAgE;CAElF,OAAO;AACR;;;;;;;;ACJA,MAAa,oBAAoB;;;;;;;;;;;;;ACKjC,SAAgB,oBACf,OACA,eAC0B;CAC1B,OAAO,OAAO,OAAQ,OAAO,aAAc;AAC5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC8BA,MAAM,eAAgB,eAAiC;CACtD,MAAM,SAAS,WAAW,QAAS,GAAI;CACvC,IAAK,WAAW,IACf,OAAO;CAGR,IAAK,WAAW,SAAU,GAAI,GAC7B,OAAO;CAGR,OAAO,oBAAoB,KAAM,WAAW,MAAO,SAAS,CAAE,CAAE;AACjE;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,oBAAqB,eAA8B;CAC/D,MAAM,gBAAgB,WAAW,KAAK;CAGtC,IAAK,YAAa,aAAc,GAAI;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