@automattic/charts 1.5.0 → 1.5.2

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.
package/dist/index.cjs CHANGED
@@ -3311,6 +3311,35 @@ function ZoomSelectionRect({
3311
3311
  height: _nullishCoalesce(innerHeight, () => ( 0))
3312
3312
  });
3313
3313
  }
3314
+ function ZoomClip({
3315
+ active,
3316
+ chartId,
3317
+ children
3318
+ }) {
3319
+ const {
3320
+ margin,
3321
+ innerWidth,
3322
+ innerHeight
3323
+ } = _react.useContext.call(void 0, _xychart.DataContext);
3324
+ const id = `chart-zoom-clip-${String(_nullishCoalesce(chartId, () => ( ""))).replace(/[^A-Za-z0-9_-]/g, "")}`;
3325
+ const clip = active && (_nullishCoalesce(innerWidth, () => ( 0))) > 0 && (_nullishCoalesce(innerHeight, () => ( 0))) > 0;
3326
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, {
3327
+ children: [clip && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "defs", {
3328
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "clipPath", {
3329
+ id,
3330
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "rect", {
3331
+ x: _nullishCoalesce(_optionalChain([margin, 'optionalAccess', _151 => _151.left]), () => ( 0)),
3332
+ y: _nullishCoalesce(_optionalChain([margin, 'optionalAccess', _152 => _152.top]), () => ( 0)),
3333
+ width: innerWidth,
3334
+ height: innerHeight
3335
+ })
3336
+ })
3337
+ }), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "g", {
3338
+ clipPath: clip ? `url(#${id})` : void 0,
3339
+ children
3340
+ })]
3341
+ });
3342
+ }
3314
3343
  function ZoomResetButton({
3315
3344
  onClick
3316
3345
  }) {
@@ -3480,7 +3509,7 @@ var LineChartAnnotationsOverlay = ({
3480
3509
  return `${xDomain.join(",")}-${yDomain.join(",")}-${xRange.join(",")}-${yRange.join(",")}`;
3481
3510
  }, []);
3482
3511
  const getScalesData = _react.useCallback.call(void 0, () => {
3483
- if (_optionalChain([chartRef, 'optionalAccess', _151 => _151.current])) {
3512
+ if (_optionalChain([chartRef, 'optionalAccess', _153 => _153.current])) {
3484
3513
  const scaleData = chartRef.current.getScales();
3485
3514
  if (scaleData) {
3486
3515
  const scaleInfo = {
@@ -3657,7 +3686,7 @@ var LineChartAnnotation = ({
3657
3686
  const [height, setHeight] = _react.useState.call(void 0, null);
3658
3687
  const styles = _deepmerge2.default.call(void 0, _nullishCoalesce(providerTheme.annotationStyles, () => ( {})), _nullishCoalesce(datumStyles, () => ( {})));
3659
3688
  _react.useEffect.call(void 0, () => {
3660
- if (_optionalChain([labelRef, 'access', _152 => _152.current, 'optionalAccess', _153 => _153.getBBox])) {
3689
+ if (_optionalChain([labelRef, 'access', _154 => _154.current, 'optionalAccess', _155 => _155.getBBox])) {
3661
3690
  const bbox = labelRef.current.getBBox();
3662
3691
  setHeight(bbox.height);
3663
3692
  }
@@ -3690,7 +3719,7 @@ var LineChartAnnotation = ({
3690
3719
  y: y2,
3691
3720
  yMin: yMin2,
3692
3721
  yMax: yMax2,
3693
- maxWidth: _optionalChain([styles, 'optionalAccess', _154 => _154.label, 'optionalAccess', _155 => _155.maxWidth]),
3722
+ maxWidth: _optionalChain([styles, 'optionalAccess', _156 => _156.label, 'optionalAccess', _157 => _157.maxWidth]),
3694
3723
  height
3695
3724
  });
3696
3725
  return {
@@ -3702,7 +3731,7 @@ var LineChartAnnotation = ({
3702
3731
  xMax: xMax2,
3703
3732
  ...position2
3704
3733
  };
3705
- }, [datum, xScale, yScale, subjectType, _optionalChain([styles, 'optionalAccess', _156 => _156.label, 'optionalAccess', _157 => _157.maxWidth]), height, renderLabel]);
3734
+ }, [datum, xScale, yScale, subjectType, _optionalChain([styles, 'optionalAccess', _158 => _158.label, 'optionalAccess', _159 => _159.maxWidth]), height, renderLabel]);
3706
3735
  if (!positionData) return null;
3707
3736
  const {
3708
3737
  x,
@@ -3717,13 +3746,13 @@ var LineChartAnnotation = ({
3717
3746
  isFlippedVertically
3718
3747
  } = positionData;
3719
3748
  const getLabelY = () => {
3720
- const labelY = _optionalChain([styles, 'optionalAccess', _158 => _158.label, 'optionalAccess', _159 => _159.y]);
3749
+ const labelY = _optionalChain([styles, 'optionalAccess', _160 => _160.label, 'optionalAccess', _161 => _161.y]);
3721
3750
  if (labelY === "start") return yMax;
3722
3751
  if (labelY === "end") return yMin;
3723
3752
  return labelY;
3724
3753
  };
3725
3754
  const getLabelX = () => {
3726
- const labelX = _optionalChain([styles, 'optionalAccess', _160 => _160.label, 'optionalAccess', _161 => _161.x]);
3755
+ const labelX = _optionalChain([styles, 'optionalAccess', _162 => _162.label, 'optionalAccess', _163 => _163.x]);
3727
3756
  if (labelX === "start") return xMin;
3728
3757
  if (labelX === "end") return xMax;
3729
3758
  return labelX;
@@ -3748,21 +3777,21 @@ var LineChartAnnotation = ({
3748
3777
  dx,
3749
3778
  dy,
3750
3779
  children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _annotation.Connector, {
3751
- ..._optionalChain([styles, 'optionalAccess', _162 => _162.connector])
3780
+ ..._optionalChain([styles, 'optionalAccess', _164 => _164.connector])
3752
3781
  }), subjectType === "circle" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _annotation.CircleSubject, {
3753
- ..._optionalChain([styles, 'optionalAccess', _163 => _163.circleSubject])
3782
+ ..._optionalChain([styles, 'optionalAccess', _165 => _165.circleSubject])
3754
3783
  }), subjectType === "line-vertical" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _annotation.LineSubject, {
3755
3784
  min: yMax,
3756
3785
  max: yMin,
3757
- ..._optionalChain([styles, 'optionalAccess', _164 => _164.lineSubject]),
3786
+ ..._optionalChain([styles, 'optionalAccess', _166 => _166.lineSubject]),
3758
3787
  orientation: "vertical"
3759
3788
  }), subjectType === "line-horizontal" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _annotation.LineSubject, {
3760
3789
  min: xMin,
3761
3790
  max: xMax,
3762
- ..._optionalChain([styles, 'optionalAccess', _165 => _165.lineSubject]),
3791
+ ..._optionalChain([styles, 'optionalAccess', _167 => _167.lineSubject]),
3763
3792
  orientation: "horizontal"
3764
3793
  }), renderLabel ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _annotation.HtmlLabel, {
3765
- ..._optionalChain([styles, 'optionalAccess', _166 => _166.label]),
3794
+ ..._optionalChain([styles, 'optionalAccess', _168 => _168.label]),
3766
3795
  ...labelPosition,
3767
3796
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
3768
3797
  style: getSafariHTMLLabelPosition(),
@@ -3781,7 +3810,7 @@ var LineChartAnnotation = ({
3781
3810
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _annotation.Label, {
3782
3811
  title,
3783
3812
  subtitle,
3784
- ..._optionalChain([styles, 'optionalAccess', _167 => _167.label]),
3813
+ ..._optionalChain([styles, 'optionalAccess', _169 => _169.label]),
3785
3814
  ...labelPosition,
3786
3815
  horizontalAnchor: getHorizontalAnchor(subjectType, isFlippedHorizontally),
3787
3816
  verticalAnchor: getVerticalAnchor(subjectType, isFlippedVertically, y, yMax, _nullishCoalesce(height, () => ( ANNOTATION_INIT_HEIGHT)))
@@ -3818,7 +3847,7 @@ var LineChartGlyph = ({
3818
3847
  const x = xScale(accessors.xAccessor(point));
3819
3848
  const y = yScale(accessors.yAccessor(point));
3820
3849
  if (typeof x !== "number" || typeof y !== "number") return null;
3821
- const size = Math.max(0, _nullishCoalesce(toNumber(_optionalChain([glyphStyle, 'optionalAccess', _168 => _168.radius])), () => ( 4)));
3850
+ const size = Math.max(0, _nullishCoalesce(toNumber(_optionalChain([glyphStyle, 'optionalAccess', _170 => _170.radius])), () => ( 4)));
3822
3851
  return renderGlyph({
3823
3852
  key: `${position2}-glyph-${data.label}`,
3824
3853
  index,
@@ -3849,9 +3878,9 @@ var renderDefaultTooltip = (params) => {
3849
3878
  const {
3850
3879
  tooltipData
3851
3880
  } = params;
3852
- const nearestDatum = _optionalChain([tooltipData, 'optionalAccess', _169 => _169.nearestDatum, 'optionalAccess', _170 => _170.datum]);
3881
+ const nearestDatum = _optionalChain([tooltipData, 'optionalAccess', _171 => _171.nearestDatum, 'optionalAccess', _172 => _172.datum]);
3853
3882
  if (!nearestDatum) return null;
3854
- const tooltipPoints = Object.entries(_optionalChain([tooltipData, 'optionalAccess', _171 => _171.datumByKey]) || {}).map(([key, {
3883
+ const tooltipPoints = Object.entries(_optionalChain([tooltipData, 'optionalAccess', _173 => _173.datumByKey]) || {}).map(([key, {
3855
3884
  datum
3856
3885
  }]) => ({
3857
3886
  key,
@@ -3861,7 +3890,7 @@ var renderDefaultTooltip = (params) => {
3861
3890
  className: line_chart_module_default["line-chart__tooltip"],
3862
3891
  children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
3863
3892
  className: line_chart_module_default["line-chart__tooltip-date"],
3864
- children: _optionalChain([nearestDatum, 'access', _172 => _172.date, 'optionalAccess', _173 => _173.toLocaleDateString, 'call', _174 => _174()])
3893
+ children: _optionalChain([nearestDatum, 'access', _174 => _174.date, 'optionalAccess', _175 => _175.toLocaleDateString, 'call', _176 => _176()])
3865
3894
  }), tooltipPoints.map((point) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Stack, {
3866
3895
  direction: "row",
3867
3896
  align: "center",
@@ -3878,7 +3907,7 @@ var renderDefaultTooltip = (params) => {
3878
3907
  });
3879
3908
  };
3880
3909
  var validateData = (data) => {
3881
- if (!_optionalChain([data, 'optionalAccess', _175 => _175.length])) return "No data available";
3910
+ if (!_optionalChain([data, 'optionalAccess', _177 => _177.length])) return "No data available";
3882
3911
  const hasInvalidData = data.some((series) => series.data.some((point) => isNaN(point.value) || point.value === null || point.value === void 0 || "date" in point && point.date && isNaN(point.date.getTime())));
3883
3912
  if (hasInvalidData) return "Invalid data";
3884
3913
  return null;
@@ -3892,7 +3921,7 @@ var LineChartScalesRef = ({
3892
3921
  const context = _react.useContext.call(void 0, _xychart.DataContext);
3893
3922
  _react.useImperativeHandle.call(void 0, chartRef, () => ({
3894
3923
  getScales: () => {
3895
- if (!_optionalChain([context, 'optionalAccess', _176 => _176.xScale]) || !_optionalChain([context, 'optionalAccess', _177 => _177.yScale])) {
3924
+ if (!_optionalChain([context, 'optionalAccess', _178 => _178.xScale]) || !_optionalChain([context, 'optionalAccess', _179 => _179.yScale])) {
3896
3925
  return null;
3897
3926
  }
3898
3927
  return {
@@ -3968,8 +3997,8 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
3968
3997
  setMeasuredChartHeight(chartHeight);
3969
3998
  }, [height]);
3970
3999
  _react.useImperativeHandle.call(void 0, ref, () => ({
3971
- getScales: () => _optionalChain([internalChartRef, 'access', _178 => _178.current, 'optionalAccess', _179 => _179.getScales, 'call', _180 => _180()]) || null,
3972
- getChartDimensions: () => _optionalChain([internalChartRef, 'access', _181 => _181.current, 'optionalAccess', _182 => _182.getChartDimensions, 'call', _183 => _183()]) || {
4000
+ getScales: () => _optionalChain([internalChartRef, 'access', _180 => _180.current, 'optionalAccess', _181 => _181.getScales, 'call', _182 => _182()]) || null,
4001
+ getChartDimensions: () => _optionalChain([internalChartRef, 'access', _183 => _183.current, 'optionalAccess', _184 => _184.getChartDimensions, 'call', _185 => _185()]) || {
3973
4002
  width: 0,
3974
4003
  height: 0,
3975
4004
  margin: {}
@@ -4010,10 +4039,10 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
4010
4039
  isNavigating,
4011
4040
  setIsNavigating,
4012
4041
  chartRef,
4013
- totalPoints: _optionalChain([dataSorted, 'access', _184 => _184[0], 'optionalAccess', _185 => _185.data, 'access', _186 => _186.length]) || 0
4042
+ totalPoints: _optionalChain([dataSorted, 'access', _186 => _186[0], 'optionalAccess', _187 => _187.data, 'access', _188 => _188.length]) || 0
4014
4043
  });
4015
4044
  const chartOptions = _react.useMemo.call(void 0, () => {
4016
- const formatter = _optionalChain([options, 'optionalAccess', _187 => _187.axis, 'optionalAccess', _188 => _188.x, 'optionalAccess', _189 => _189.tickFormat]) || getFormatter(dataSorted);
4045
+ const formatter = _optionalChain([options, 'optionalAccess', _189 => _189.axis, 'optionalAccess', _190 => _190.x, 'optionalAccess', _191 => _191.tickFormat]) || getFormatter(dataSorted);
4017
4046
  return {
4018
4047
  axis: {
4019
4048
  x: {
@@ -4021,19 +4050,19 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
4021
4050
  numTicks: guessOptimalNumTicks(dataSorted, width, formatter),
4022
4051
  tickFormat: formatter,
4023
4052
  display: true,
4024
- ..._optionalChain([options, 'optionalAccess', _190 => _190.axis, 'optionalAccess', _191 => _191.x])
4053
+ ..._optionalChain([options, 'optionalAccess', _192 => _192.axis, 'optionalAccess', _193 => _193.x])
4025
4054
  },
4026
4055
  y: {
4027
4056
  orientation: "left",
4028
4057
  numTicks: 4,
4029
4058
  tickFormat: _numberformatters.formatNumberCompact,
4030
4059
  display: true,
4031
- ..._optionalChain([options, 'optionalAccess', _192 => _192.axis, 'optionalAccess', _193 => _193.y])
4060
+ ..._optionalChain([options, 'optionalAccess', _194 => _194.axis, 'optionalAccess', _195 => _195.y])
4032
4061
  }
4033
4062
  },
4034
4063
  xScale: {
4035
4064
  type: "time",
4036
- ..._optionalChain([options, 'optionalAccess', _194 => _194.xScale]),
4065
+ ..._optionalChain([options, 'optionalAccess', _196 => _196.xScale]),
4037
4066
  ...zoom.domain ? {
4038
4067
  domain: zoom.domain
4039
4068
  } : {}
@@ -4042,7 +4071,7 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
4042
4071
  type: "linear",
4043
4072
  nice: true,
4044
4073
  zero: false,
4045
- ..._optionalChain([options, 'optionalAccess', _195 => _195.yScale])
4074
+ ..._optionalChain([options, 'optionalAccess', _197 => _197.yScale])
4046
4075
  }
4047
4076
  };
4048
4077
  }, [options, dataSorted, width, zoom.domain]);
@@ -4069,9 +4098,9 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
4069
4098
  const isDataValid = !error;
4070
4099
  const legendOptions = _react.useMemo.call(void 0, () => ({
4071
4100
  withGlyph: withLegendGlyph,
4072
- glyphSize: Math.max(0, _nullishCoalesce(toNumber2(_optionalChain([glyphStyle, 'optionalAccess', _196 => _196.radius])), () => ( 4))),
4101
+ glyphSize: Math.max(0, _nullishCoalesce(toNumber2(_optionalChain([glyphStyle, 'optionalAccess', _198 => _198.radius])), () => ( 4))),
4073
4102
  renderGlyph
4074
- }), [withLegendGlyph, _optionalChain([glyphStyle, 'optionalAccess', _197 => _197.radius]), renderGlyph]);
4103
+ }), [withLegendGlyph, _optionalChain([glyphStyle, 'optionalAccess', _199 => _199.radius]), renderGlyph]);
4075
4104
  const legendItems = useChartLegendItems(dataSorted, legendOptions, legendShape);
4076
4105
  const chartMetadata = _react.useMemo.call(void 0, () => ({
4077
4106
  withGradientFill,
@@ -4090,8 +4119,8 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
4090
4119
  });
4091
4120
  const prefersReducedMotion = usePrefersReducedMotion();
4092
4121
  const accessors = {
4093
- xAccessor: (d) => _optionalChain([d, 'optionalAccess', _198 => _198.date]),
4094
- yAccessor: (d) => _optionalChain([d, 'optionalAccess', _199 => _199.value])
4122
+ xAccessor: (d) => _optionalChain([d, 'optionalAccess', _200 => _200.date]),
4123
+ yAccessor: (d) => _optionalChain([d, 'optionalAccess', _201 => _201.value])
4095
4124
  };
4096
4125
  if (error) {
4097
4126
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
@@ -4179,65 +4208,69 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
4179
4208
  width,
4180
4209
  height: chartHeight,
4181
4210
  children: _i18n.__.call(void 0, "All series are hidden. Click legend items to show data.", "jetpack-charts")
4182
- }) : null, seriesWithVisibility.map(({
4183
- series: seriesData,
4184
- index,
4185
- isVisible
4186
- }) => {
4187
- if (!isVisible) {
4188
- return null;
4189
- }
4190
- const {
4191
- color,
4192
- lineStyles,
4193
- glyph
4194
- } = getElementStyles({
4195
- data: seriesData,
4196
- index
4197
- });
4198
- const lineProps = {
4199
- stroke: color,
4200
- ...lineStyles
4201
- };
4202
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "g", {
4203
- children: [withGradientFill && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _gradient.LinearGradient, {
4204
- id: `area-gradient-${chartId}-${index + 1}`,
4205
- from: color,
4206
- fromOpacity: 0.4,
4207
- toOpacity: 0.1,
4208
- to: providerTheme.backgroundColor,
4209
- ..._optionalChain([seriesData, 'access', _200 => _200.options, 'optionalAccess', _201 => _201.gradient]),
4210
- children: _optionalChain([seriesData, 'access', _202 => _202.options, 'optionalAccess', _203 => _203.gradient, 'optionalAccess', _204 => _204.stops, 'optionalAccess', _205 => _205.map, 'call', _206 => _206((stop, stopIndex) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "stop", {
4211
- offset: stop.offset,
4212
- stopColor: stop.color || color,
4213
- stopOpacity: _nullishCoalesce(stop.opacity, () => ( 1))
4214
- }, `${stop.offset}-${stop.color || color}`))])
4215
- }), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _xychart.AreaSeries, {
4216
- dataKey: _optionalChain([seriesData, 'optionalAccess', _207 => _207.label]),
4217
- data: seriesData.data,
4218
- ...accessors,
4219
- fill: withGradientFill ? `url(#area-gradient-${chartId}-${index + 1})` : "transparent",
4220
- renderLine: true,
4221
- curve: getCurveType(curveType, smoothing),
4222
- lineProps
4223
- }, _optionalChain([seriesData, 'optionalAccess', _208 => _208.label])), withStartGlyphs && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, line_chart_glyph_default, {
4224
- index,
4225
- data: seriesData,
4211
+ }) : null, /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ZoomClip, {
4212
+ active: zoomable && !!zoom.domain,
4213
+ chartId,
4214
+ children: seriesWithVisibility.map(({
4215
+ series: seriesData,
4216
+ index,
4217
+ isVisible
4218
+ }) => {
4219
+ if (!isVisible) {
4220
+ return null;
4221
+ }
4222
+ const {
4226
4223
  color,
4227
- renderGlyph: _nullishCoalesce(glyph, () => ( renderGlyph)),
4228
- accessors,
4229
- glyphStyle,
4230
- position: "start"
4231
- }), withEndGlyphs && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, line_chart_glyph_default, {
4232
- index,
4224
+ lineStyles,
4225
+ glyph
4226
+ } = getElementStyles({
4233
4227
  data: seriesData,
4234
- color,
4235
- renderGlyph: _nullishCoalesce(glyph, () => ( renderGlyph)),
4236
- accessors,
4237
- glyphStyle,
4238
- position: "end"
4239
- })]
4240
- }, _optionalChain([seriesData, 'optionalAccess', _209 => _209.label]) || index);
4228
+ index
4229
+ });
4230
+ const lineProps = {
4231
+ stroke: color,
4232
+ ...lineStyles
4233
+ };
4234
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "g", {
4235
+ children: [withGradientFill && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _gradient.LinearGradient, {
4236
+ id: `area-gradient-${chartId}-${index + 1}`,
4237
+ from: color,
4238
+ fromOpacity: 0.4,
4239
+ toOpacity: 0.1,
4240
+ to: providerTheme.backgroundColor,
4241
+ ..._optionalChain([seriesData, 'access', _202 => _202.options, 'optionalAccess', _203 => _203.gradient]),
4242
+ children: _optionalChain([seriesData, 'access', _204 => _204.options, 'optionalAccess', _205 => _205.gradient, 'optionalAccess', _206 => _206.stops, 'optionalAccess', _207 => _207.map, 'call', _208 => _208((stop, stopIndex) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "stop", {
4243
+ offset: stop.offset,
4244
+ stopColor: stop.color || color,
4245
+ stopOpacity: _nullishCoalesce(stop.opacity, () => ( 1))
4246
+ }, `${stop.offset}-${stop.color || color}`))])
4247
+ }), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _xychart.AreaSeries, {
4248
+ dataKey: _optionalChain([seriesData, 'optionalAccess', _209 => _209.label]),
4249
+ data: seriesData.data,
4250
+ ...accessors,
4251
+ fill: withGradientFill ? `url(#area-gradient-${chartId}-${index + 1})` : "transparent",
4252
+ renderLine: true,
4253
+ curve: getCurveType(curveType, smoothing),
4254
+ lineProps
4255
+ }, _optionalChain([seriesData, 'optionalAccess', _210 => _210.label])), withStartGlyphs && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, line_chart_glyph_default, {
4256
+ index,
4257
+ data: seriesData,
4258
+ color,
4259
+ renderGlyph: _nullishCoalesce(glyph, () => ( renderGlyph)),
4260
+ accessors,
4261
+ glyphStyle,
4262
+ position: "start"
4263
+ }), withEndGlyphs && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, line_chart_glyph_default, {
4264
+ index,
4265
+ data: seriesData,
4266
+ color,
4267
+ renderGlyph: _nullishCoalesce(glyph, () => ( renderGlyph)),
4268
+ accessors,
4269
+ glyphStyle,
4270
+ position: "end"
4271
+ })]
4272
+ }, _optionalChain([seriesData, 'optionalAccess', _211 => _211.label]) || index);
4273
+ })
4241
4274
  }), withTooltips && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AccessibleTooltip, {
4242
4275
  detectBounds: true,
4243
4276
  snapTooltipToDatumX: true,
@@ -4246,8 +4279,8 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
4246
4279
  renderTooltip,
4247
4280
  renderGlyph: tooltipRenderGlyph,
4248
4281
  glyphStyle,
4249
- showVerticalCrosshair: _optionalChain([withTooltipCrosshairs, 'optionalAccess', _210 => _210.showVertical]),
4250
- showHorizontalCrosshair: _optionalChain([withTooltipCrosshairs, 'optionalAccess', _211 => _211.showHorizontal]),
4282
+ showVerticalCrosshair: _optionalChain([withTooltipCrosshairs, 'optionalAccess', _212 => _212.showVertical]),
4283
+ showHorizontalCrosshair: _optionalChain([withTooltipCrosshairs, 'optionalAccess', _213 => _213.showHorizontal]),
4251
4284
  selectedIndex,
4252
4285
  tooltipRef,
4253
4286
  keyboardFocusedClassName: line_chart_module_default["line-chart__tooltip--keyboard-focused"],
@@ -4304,8 +4337,8 @@ var area_chart_module_default = {
4304
4337
  // src/charts/area-chart/private/validate-data.ts
4305
4338
 
4306
4339
  var validateData2 = (data) => {
4307
- if (!_optionalChain([data, 'optionalAccess', _212 => _212.length])) return _i18n.__.call(void 0, "No data available", "jetpack-charts");
4308
- const hasEmptySeries = data.some((series) => !_optionalChain([series, 'access', _213 => _213.data, 'optionalAccess', _214 => _214.length]));
4340
+ if (!_optionalChain([data, 'optionalAccess', _214 => _214.length])) return _i18n.__.call(void 0, "No data available", "jetpack-charts");
4341
+ const hasEmptySeries = data.some((series) => !_optionalChain([series, 'access', _215 => _215.data, 'optionalAccess', _216 => _216.length]));
4309
4342
  if (hasEmptySeries) return _i18n.__.call(void 0, "No data available", "jetpack-charts");
4310
4343
  const hasInvalidData = data.some(
4311
4344
  (series) => series.data.some(
@@ -4329,7 +4362,7 @@ var AreaChartScalesRef = ({
4329
4362
  const context = _react.useContext.call(void 0, _xychart.DataContext);
4330
4363
  _react.useImperativeHandle.call(void 0, chartRef, () => ({
4331
4364
  getScales: () => {
4332
- if (!_optionalChain([context, 'optionalAccess', _215 => _215.xScale]) || !_optionalChain([context, 'optionalAccess', _216 => _216.yScale])) return null;
4365
+ if (!_optionalChain([context, 'optionalAccess', _217 => _217.xScale]) || !_optionalChain([context, 'optionalAccess', _218 => _218.yScale])) return null;
4333
4366
  return {
4334
4367
  xScale: context.xScale,
4335
4368
  yScale: context.yScale
@@ -4352,10 +4385,10 @@ var HoverGlyphs = ({
4352
4385
  }) => {
4353
4386
  const dataContext = _react.useContext.call(void 0, _xychart.DataContext);
4354
4387
  const tooltipContext = _react.useContext.call(void 0, _xychart.TooltipContext);
4355
- const xScale = _optionalChain([dataContext, 'optionalAccess', _217 => _217.xScale]);
4356
- const yScale = _optionalChain([dataContext, 'optionalAccess', _218 => _218.yScale]);
4357
- const tooltipOpen = _optionalChain([tooltipContext, 'optionalAccess', _219 => _219.tooltipOpen]);
4358
- const nearestDatum = _optionalChain([tooltipContext, 'optionalAccess', _220 => _220.tooltipData, 'optionalAccess', _221 => _221.nearestDatum, 'optionalAccess', _222 => _222.datum]);
4388
+ const xScale = _optionalChain([dataContext, 'optionalAccess', _219 => _219.xScale]);
4389
+ const yScale = _optionalChain([dataContext, 'optionalAccess', _220 => _220.yScale]);
4390
+ const tooltipOpen = _optionalChain([tooltipContext, 'optionalAccess', _221 => _221.tooltipOpen]);
4391
+ const nearestDatum = _optionalChain([tooltipContext, 'optionalAccess', _222 => _222.tooltipData, 'optionalAccess', _223 => _223.nearestDatum, 'optionalAccess', _224 => _224.datum]);
4359
4392
  if (!tooltipOpen || !xScale || !yScale || !nearestDatum || !nearestDatum.date || stacked && stackOffset !== "none") {
4360
4393
  return null;
4361
4394
  }
@@ -4368,8 +4401,8 @@ var HoverGlyphs = ({
4368
4401
  series,
4369
4402
  index
4370
4403
  } of visibleSeries) {
4371
- const datum = series.data.find((d) => _optionalChain([d, 'access', _223 => _223.date, 'optionalAccess', _224 => _224.getTime, 'call', _225 => _225()]) === hoveredTime);
4372
- const value = _nullishCoalesce(_optionalChain([datum, 'optionalAccess', _226 => _226.value]), () => ( 0));
4404
+ const datum = series.data.find((d) => _optionalChain([d, 'access', _225 => _225.date, 'optionalAccess', _226 => _226.getTime, 'call', _227 => _227()]) === hoveredTime);
4405
+ const value = _nullishCoalesce(_optionalChain([datum, 'optionalAccess', _228 => _228.value]), () => ( 0));
4373
4406
  if (stacked) {
4374
4407
  cumulative += value;
4375
4408
  }
@@ -4463,8 +4496,8 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
4463
4496
  setMeasuredChartHeight(chartHeight);
4464
4497
  }, [height]);
4465
4498
  _react.useImperativeHandle.call(void 0, ref, () => ({
4466
- getScales: () => _optionalChain([internalChartRef, 'access', _227 => _227.current, 'optionalAccess', _228 => _228.getScales, 'call', _229 => _229()]) || null,
4467
- getChartDimensions: () => _optionalChain([internalChartRef, 'access', _230 => _230.current, 'optionalAccess', _231 => _231.getChartDimensions, 'call', _232 => _232()]) || {
4499
+ getScales: () => _optionalChain([internalChartRef, 'access', _229 => _229.current, 'optionalAccess', _230 => _230.getScales, 'call', _231 => _231()]) || null,
4500
+ getChartDimensions: () => _optionalChain([internalChartRef, 'access', _232 => _232.current, 'optionalAccess', _233 => _233.getChartDimensions, 'call', _234 => _234()]) || {
4468
4501
  width: 0,
4469
4502
  height: 0,
4470
4503
  margin: {}
@@ -4503,7 +4536,7 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
4503
4536
  isNavigating,
4504
4537
  setIsNavigating,
4505
4538
  chartRef,
4506
- totalPoints: _optionalChain([dataSorted, 'access', _233 => _233[0], 'optionalAccess', _234 => _234.data, 'access', _235 => _235.length]) || 0
4539
+ totalPoints: _optionalChain([dataSorted, 'access', _235 => _235[0], 'optionalAccess', _236 => _236.data, 'access', _237 => _237.length]) || 0
4507
4540
  });
4508
4541
  const fixedYDomain = _react.useMemo.call(void 0, () => {
4509
4542
  if (rescaleYOnLegendToggle || !legendInteractive || !dataSorted.length || !dataSorted[0].data.length || stacked && stackOffset !== "none") {
@@ -4517,7 +4550,7 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
4517
4550
  let posSum = 0;
4518
4551
  let negSum = 0;
4519
4552
  for (const series of dataSorted) {
4520
- const v = Number(_optionalChain([series, 'access', _236 => _236.data, 'access', _237 => _237[i], 'optionalAccess', _238 => _238.value]));
4553
+ const v = Number(_optionalChain([series, 'access', _238 => _238.data, 'access', _239 => _239[i], 'optionalAccess', _240 => _240.value]));
4521
4554
  if (Number.isNaN(v)) continue;
4522
4555
  if (v >= 0) posSum += v;
4523
4556
  else negSum += v;
@@ -4531,7 +4564,7 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
4531
4564
  let min = Infinity;
4532
4565
  for (const series of dataSorted) {
4533
4566
  for (const point of series.data) {
4534
- const v = Number(_optionalChain([point, 'optionalAccess', _239 => _239.value]));
4567
+ const v = Number(_optionalChain([point, 'optionalAccess', _241 => _241.value]));
4535
4568
  if (!Number.isNaN(v)) {
4536
4569
  if (v > max) max = v;
4537
4570
  if (v < min) min = v;
@@ -4542,7 +4575,7 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
4542
4575
  return [Math.min(0, min), max];
4543
4576
  }, [dataSorted, stacked, stackOffset, legendInteractive, rescaleYOnLegendToggle]);
4544
4577
  const chartOptions = _react.useMemo.call(void 0, () => {
4545
- const formatter = _optionalChain([options, 'optionalAccess', _240 => _240.axis, 'optionalAccess', _241 => _241.x, 'optionalAccess', _242 => _242.tickFormat]) || getFormatter(dataSorted);
4578
+ const formatter = _optionalChain([options, 'optionalAccess', _242 => _242.axis, 'optionalAccess', _243 => _243.x, 'optionalAccess', _244 => _244.tickFormat]) || getFormatter(dataSorted);
4546
4579
  return {
4547
4580
  axis: {
4548
4581
  x: {
@@ -4550,19 +4583,19 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
4550
4583
  numTicks: guessOptimalNumTicks(dataSorted, width, formatter),
4551
4584
  tickFormat: formatter,
4552
4585
  display: true,
4553
- ..._optionalChain([options, 'optionalAccess', _243 => _243.axis, 'optionalAccess', _244 => _244.x])
4586
+ ..._optionalChain([options, 'optionalAccess', _245 => _245.axis, 'optionalAccess', _246 => _246.x])
4554
4587
  },
4555
4588
  y: {
4556
4589
  orientation: "left",
4557
4590
  numTicks: 4,
4558
4591
  tickFormat: _numberformatters.formatNumberCompact,
4559
4592
  display: true,
4560
- ..._optionalChain([options, 'optionalAccess', _245 => _245.axis, 'optionalAccess', _246 => _246.y])
4593
+ ..._optionalChain([options, 'optionalAccess', _247 => _247.axis, 'optionalAccess', _248 => _248.y])
4561
4594
  }
4562
4595
  },
4563
4596
  xScale: {
4564
4597
  type: "time",
4565
- ..._optionalChain([options, 'optionalAccess', _247 => _247.xScale]),
4598
+ ..._optionalChain([options, 'optionalAccess', _249 => _249.xScale]),
4566
4599
  ...zoom.domain ? {
4567
4600
  domain: zoom.domain
4568
4601
  } : {}
@@ -4575,7 +4608,7 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
4575
4608
  ...fixedYDomain ? {
4576
4609
  domain: fixedYDomain
4577
4610
  } : {},
4578
- ..._optionalChain([options, 'optionalAccess', _248 => _248.yScale])
4611
+ ..._optionalChain([options, 'optionalAccess', _250 => _250.yScale])
4579
4612
  }
4580
4613
  };
4581
4614
  }, [options, dataSorted, width, stacked, fixedYDomain, zoom.domain]);
@@ -4603,21 +4636,21 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
4603
4636
  const prefersReducedMotion = usePrefersReducedMotion();
4604
4637
  const animationEnabled = !!animation && !prefersReducedMotion;
4605
4638
  const accessors = {
4606
- xAccessor: (d) => _optionalChain([d, 'optionalAccess', _249 => _249.date]),
4607
- yAccessor: (d) => _optionalChain([d, 'optionalAccess', _250 => _250.value])
4639
+ xAccessor: (d) => _optionalChain([d, 'optionalAccess', _251 => _251.date]),
4640
+ yAccessor: (d) => _optionalChain([d, 'optionalAccess', _252 => _252.value])
4608
4641
  };
4609
4642
  const zeroYAccessor = _react.useCallback.call(void 0, () => 0, []);
4610
4643
  const visibleLabels = _react.useMemo.call(void 0, () => new Set(seriesWithVisibility.filter((s) => s.isVisible).map((s) => s.series.label)), [seriesWithVisibility]);
4611
4644
  const filteredRenderTooltip = _react.useCallback.call(void 0, (params) => {
4612
4645
  if (!legendInteractive) return renderTooltip(params);
4613
- const datumByKey = _optionalChain([params, 'optionalAccess', _251 => _251.tooltipData, 'optionalAccess', _252 => _252.datumByKey]);
4646
+ const datumByKey = _optionalChain([params, 'optionalAccess', _253 => _253.tooltipData, 'optionalAccess', _254 => _254.datumByKey]);
4614
4647
  if (!datumByKey) return renderTooltip(params);
4615
4648
  const filtered = Object.fromEntries(Object.entries(datumByKey).filter(([key]) => visibleLabels.has(key)));
4616
4649
  if (Object.keys(filtered).length === 0) return null;
4617
- const nearestDatum = _optionalChain([params, 'optionalAccess', _253 => _253.tooltipData, 'optionalAccess', _254 => _254.nearestDatum]);
4650
+ const nearestDatum = _optionalChain([params, 'optionalAccess', _255 => _255.tooltipData, 'optionalAccess', _256 => _256.nearestDatum]);
4618
4651
  const nextNearest = nearestDatum && visibleLabels.has(nearestDatum.key) ? nearestDatum : {
4619
4652
  ...Object.values(filtered)[0],
4620
- distance: _nullishCoalesce(_optionalChain([nearestDatum, 'optionalAccess', _255 => _255.distance]), () => ( 0))
4653
+ distance: _nullishCoalesce(_optionalChain([nearestDatum, 'optionalAccess', _257 => _257.distance]), () => ( 0))
4621
4654
  };
4622
4655
  return renderTooltip({
4623
4656
  ...params,
@@ -4666,7 +4699,7 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
4666
4699
  index
4667
4700
  });
4668
4701
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _xychart.AnimatedAreaSeries, {
4669
- dataKey: _optionalChain([seriesData, 'optionalAccess', _256 => _256.label]),
4702
+ dataKey: _optionalChain([seriesData, 'optionalAccess', _258 => _258.label]),
4670
4703
  data: seriesData.data,
4671
4704
  xAccessor: accessors.xAccessor,
4672
4705
  yAccessor: isVisible || !legendInteractive ? accessors.yAccessor : zeroYAccessor,
@@ -4680,7 +4713,7 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
4680
4713
  stroke: color,
4681
4714
  ...lineStyles
4682
4715
  }
4683
- }, _optionalChain([seriesData, 'optionalAccess', _257 => _257.label]) || index);
4716
+ }, _optionalChain([seriesData, 'optionalAccess', _259 => _259.label]) || index);
4684
4717
  };
4685
4718
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SingleChartContext.Provider, {
4686
4719
  value: {
@@ -4749,19 +4782,23 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
4749
4782
  width,
4750
4783
  height: chartHeight,
4751
4784
  children: _i18n.__.call(void 0, "All series are hidden. Click legend items to show data.", "jetpack-charts")
4752
- }) : null, !allSeriesHidden && stacked && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _xychart.AnimatedAreaStack, {
4753
- curve,
4754
- offset: stackOffset,
4755
- renderLine: resolvedWithStroke,
4756
- children: seriesWithVisibility.map(renderSeries)
4757
- }), !allSeriesHidden && !stacked && seriesWithVisibility.map(renderSeries), withTooltips && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, {
4785
+ }) : null, /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, ZoomClip, {
4786
+ active: zoomable,
4787
+ chartId,
4788
+ children: [!allSeriesHidden && stacked && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _xychart.AnimatedAreaStack, {
4789
+ curve,
4790
+ offset: stackOffset,
4791
+ renderLine: resolvedWithStroke,
4792
+ children: seriesWithVisibility.map(renderSeries)
4793
+ }), !allSeriesHidden && !stacked && seriesWithVisibility.map(renderSeries)]
4794
+ }), withTooltips && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, {
4758
4795
  children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, AccessibleTooltip, {
4759
4796
  detectBounds: true,
4760
4797
  snapTooltipToDatumX: true,
4761
4798
  snapTooltipToDatumY: !stacked,
4762
4799
  renderTooltip: filteredRenderTooltip,
4763
- showVerticalCrosshair: _optionalChain([withTooltipCrosshairs, 'optionalAccess', _258 => _258.showVertical]),
4764
- showHorizontalCrosshair: _optionalChain([withTooltipCrosshairs, 'optionalAccess', _259 => _259.showHorizontal]),
4800
+ showVerticalCrosshair: _optionalChain([withTooltipCrosshairs, 'optionalAccess', _260 => _260.showVertical]),
4801
+ showHorizontalCrosshair: _optionalChain([withTooltipCrosshairs, 'optionalAccess', _261 => _261.showHorizontal]),
4765
4802
  selectedIndex,
4766
4803
  tooltipRef,
4767
4804
  keyboardFocusedClassName: area_chart_module_default["area-chart__tooltip--keyboard-focused"],
@@ -4954,12 +4991,12 @@ function useBarChartOptions(data, horizontal, options = {}) {
4954
4991
  nice: true,
4955
4992
  zero: false
4956
4993
  };
4957
- const labelFormatter = _optionalChain([data, 'optionalAccess', _260 => _260[0], 'optionalAccess', _261 => _261.data, 'optionalAccess', _262 => _262[0], 'optionalAccess', _263 => _263.label]) ? (label) => label : formatDateTick2;
4994
+ const labelFormatter = _optionalChain([data, 'optionalAccess', _262 => _262[0], 'optionalAccess', _263 => _263.data, 'optionalAccess', _264 => _264[0], 'optionalAccess', _265 => _265.label]) ? (label) => label : formatDateTick2;
4958
4995
  const valueFormatter = _numberformatters.formatNumberCompact;
4959
- const labelAccessor = (d) => _optionalChain([d, 'optionalAccess', _264 => _264.label]) || _optionalChain([d, 'optionalAccess', _265 => _265.date]);
4996
+ const labelAccessor = (d) => _optionalChain([d, 'optionalAccess', _266 => _266.label]) || _optionalChain([d, 'optionalAccess', _267 => _267.date]);
4960
4997
  const valueAccessor = (d) => {
4961
4998
  const enhancedPoint = d;
4962
- return _optionalChain([enhancedPoint, 'optionalAccess', _266 => _266.visualValue]) !== void 0 ? enhancedPoint.visualValue : _optionalChain([d, 'optionalAccess', _267 => _267.value]);
4999
+ return _optionalChain([enhancedPoint, 'optionalAccess', _268 => _268.visualValue]) !== void 0 ? enhancedPoint.visualValue : _optionalChain([d, 'optionalAccess', _269 => _269.value]);
4963
5000
  };
4964
5001
  return {
4965
5002
  vertical: {
@@ -4998,9 +5035,9 @@ function useBarChartOptions(data, horizontal, options = {}) {
4998
5035
  } = defaultOptions[orientationKey];
4999
5036
  const xScale = { ...baseXScale, ...options.xScale || {} };
5000
5037
  const yScale = { ...baseYScale, ...options.yScale || {} };
5001
- const providedToolTipLabelFormatter = horizontal ? _optionalChain([options, 'access', _268 => _268.axis, 'optionalAccess', _269 => _269.y, 'optionalAccess', _270 => _270.tickFormat]) : _optionalChain([options, 'access', _271 => _271.axis, 'optionalAccess', _272 => _272.x, 'optionalAccess', _273 => _273.tickFormat]);
5002
- const { labelOverflow: xLabelOverflow, ...xAxisOptions } = _optionalChain([options, 'access', _274 => _274.axis, 'optionalAccess', _275 => _275.x]) || {};
5003
- const { labelOverflow: yLabelOverflow, ...yAxisOptions } = _optionalChain([options, 'access', _276 => _276.axis, 'optionalAccess', _277 => _277.y]) || {};
5038
+ const providedToolTipLabelFormatter = horizontal ? _optionalChain([options, 'access', _270 => _270.axis, 'optionalAccess', _271 => _271.y, 'optionalAccess', _272 => _272.tickFormat]) : _optionalChain([options, 'access', _273 => _273.axis, 'optionalAccess', _274 => _274.x, 'optionalAccess', _275 => _275.tickFormat]);
5039
+ const { labelOverflow: xLabelOverflow, ...xAxisOptions } = _optionalChain([options, 'access', _276 => _276.axis, 'optionalAccess', _277 => _277.x]) || {};
5040
+ const { labelOverflow: yLabelOverflow, ...yAxisOptions } = _optionalChain([options, 'access', _278 => _278.axis, 'optionalAccess', _279 => _279.y]) || {};
5004
5041
  return {
5005
5042
  gridVisibility,
5006
5043
  xScale,
@@ -5038,7 +5075,7 @@ function useBarChartOptions(data, horizontal, options = {}) {
5038
5075
  // src/charts/bar-chart/bar-chart.tsx
5039
5076
 
5040
5077
  var validateData3 = (data) => {
5041
- if (!_optionalChain([data, 'optionalAccess', _278 => _278.length])) return "No data available";
5078
+ if (!_optionalChain([data, 'optionalAccess', _280 => _280.length])) return "No data available";
5042
5079
  const hasInvalidData = data.some((series) => series.data.some((point) => isNaN(point.value) || point.value === null || point.value === void 0 || !point.label && (!("date" in point && point.date) || isNaN(point.date.getTime()))));
5043
5080
  if (hasInvalidData) return "Invalid data";
5044
5081
  return null;
@@ -5088,7 +5125,7 @@ var BarChartInternal = ({
5088
5125
  }, [height]);
5089
5126
  const [selectedIndex, setSelectedIndex] = _react.useState.call(void 0, void 0);
5090
5127
  const [isNavigating, setIsNavigating] = _react.useState.call(void 0, false);
5091
- const totalPoints = Math.max(0, ...data.map((series) => _optionalChain([series, 'access', _279 => _279.data, 'optionalAccess', _280 => _280.length]) || 0)) * data.length;
5128
+ const totalPoints = Math.max(0, ...data.map((series) => _optionalChain([series, 'access', _281 => _281.data, 'optionalAccess', _282 => _282.length]) || 0)) * data.length;
5092
5129
  const {
5093
5130
  tooltipRef,
5094
5131
  onChartFocus,
@@ -5132,13 +5169,13 @@ var BarChartInternal = ({
5132
5169
  const renderDefaultTooltip2 = _react.useCallback.call(void 0, ({
5133
5170
  tooltipData
5134
5171
  }) => {
5135
- const nearestDatum = _optionalChain([tooltipData, 'optionalAccess', _281 => _281.nearestDatum, 'optionalAccess', _282 => _282.datum]);
5172
+ const nearestDatum = _optionalChain([tooltipData, 'optionalAccess', _283 => _283.nearestDatum, 'optionalAccess', _284 => _284.datum]);
5136
5173
  if (!nearestDatum) return null;
5137
5174
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", {
5138
5175
  className: bar_chart_module_default["bar-chart__tooltip"],
5139
5176
  children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
5140
5177
  className: bar_chart_module_default["bar-chart__tooltip-header"],
5141
- children: _optionalChain([tooltipData, 'optionalAccess', _283 => _283.nearestDatum, 'optionalAccess', _284 => _284.key])
5178
+ children: _optionalChain([tooltipData, 'optionalAccess', _285 => _285.nearestDatum, 'optionalAccess', _286 => _286.key])
5142
5179
  }), /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", {
5143
5180
  className: bar_chart_module_default["bar-chart__tooltip-row"],
5144
5181
  children: [/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", {
@@ -5337,12 +5374,12 @@ var BarChartInternal = ({
5337
5374
  return null;
5338
5375
  }
5339
5376
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _xychart.BarSeries, {
5340
- dataKey: _optionalChain([seriesData, 'optionalAccess', _285 => _285.label]),
5377
+ dataKey: _optionalChain([seriesData, 'optionalAccess', _287 => _287.label]),
5341
5378
  data: seriesData.data,
5342
5379
  yAccessor: chartOptions.accessors.yAccessor,
5343
5380
  xAccessor: chartOptions.accessors.xAccessor,
5344
5381
  colorAccessor: getBarBackground(index)
5345
- }, _optionalChain([seriesData, 'optionalAccess', _286 => _286.label]));
5382
+ }, _optionalChain([seriesData, 'optionalAccess', _288 => _288.label]));
5346
5383
  })
5347
5384
  }), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _xychart.Axis, {
5348
5385
  ...chartOptions.axis.x
@@ -5396,7 +5433,7 @@ var BarChartResponsive = attachSubComponents(withResponsive(BarChartWithProvider
5396
5433
 
5397
5434
  var getScaleBandwidth2 = (scale) => {
5398
5435
  const s = scale;
5399
- return s && "bandwidth" in s ? _nullishCoalesce(_optionalChain([s, 'optionalAccess', _287 => _287.bandwidth, 'call', _288 => _288()]), () => ( 0)) : 0;
5436
+ return s && "bandwidth" in s ? _nullishCoalesce(_optionalChain([s, 'optionalAccess', _289 => _289.bandwidth, 'call', _290 => _290()]), () => ( 0)) : 0;
5400
5437
  };
5401
5438
  var DefaultLabelComponent = ({
5402
5439
  textProps,
@@ -5457,7 +5494,7 @@ var AxisRenderer = ({
5457
5494
  delete textProps.dx;
5458
5495
  const sum = data.reduce((acc, {
5459
5496
  data: seriesData
5460
- }) => acc + (_nullishCoalesce(_optionalChain([seriesData, 'access', _289 => _289[index], 'optionalAccess', _290 => _290.value]), () => ( 0))), 0);
5497
+ }) => acc + (_nullishCoalesce(_optionalChain([seriesData, 'access', _291 => _291[index], 'optionalAccess', _292 => _292.value]), () => ( 0))), 0);
5461
5498
  const y = from2.y + yOffset;
5462
5499
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _group.Group, {
5463
5500
  children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, LabelComponent, {
@@ -5625,7 +5662,7 @@ var useFunnelSelection = (hideTooltip) => {
5625
5662
  (stepId) => {
5626
5663
  if (clickedStep === stepId) {
5627
5664
  setClickedStep(null);
5628
- _optionalChain([hideTooltip, 'optionalCall', _291 => _291()]);
5665
+ _optionalChain([hideTooltip, 'optionalCall', _293 => _293()]);
5629
5666
  } else {
5630
5667
  setClickedStep(stepId);
5631
5668
  }
@@ -5638,21 +5675,21 @@ var useFunnelSelection = (hideTooltip) => {
5638
5675
  event.preventDefault();
5639
5676
  if (clickedStep === stepId) {
5640
5677
  setClickedStep(null);
5641
- _optionalChain([hideTooltip, 'optionalCall', _292 => _292()]);
5678
+ _optionalChain([hideTooltip, 'optionalCall', _294 => _294()]);
5642
5679
  } else {
5643
5680
  setClickedStep(stepId);
5644
5681
  }
5645
5682
  } else if (event.key === "Escape") {
5646
5683
  event.preventDefault();
5647
5684
  setClickedStep(null);
5648
- _optionalChain([hideTooltip, 'optionalCall', _293 => _293()]);
5685
+ _optionalChain([hideTooltip, 'optionalCall', _295 => _295()]);
5649
5686
  }
5650
5687
  },
5651
5688
  [clickedStep, hideTooltip]
5652
5689
  );
5653
5690
  const clearSelection = _react.useCallback.call(void 0, () => {
5654
5691
  setClickedStep(null);
5655
- _optionalChain([hideTooltip, 'optionalCall', _294 => _294()]);
5692
+ _optionalChain([hideTooltip, 'optionalCall', _296 => _296()]);
5656
5693
  }, [hideTooltip]);
5657
5694
  const getStepState = _react.useCallback.call(void 0,
5658
5695
  (stepId) => ({
@@ -5814,7 +5851,7 @@ var ConversionFunnelChartInternal = ({
5814
5851
  document.removeEventListener("mousedown", handleDocumentClick);
5815
5852
  };
5816
5853
  }, [clearSelectionAndRef]);
5817
- const resolvedHeight = _nullishCoalesce(_nullishCoalesce(height, () => ( _optionalChain([style, 'optionalAccess', _295 => _295.height]))), () => ( "100%"));
5854
+ const resolvedHeight = _nullishCoalesce(_nullishCoalesce(height, () => ( _optionalChain([style, 'optionalAccess', _297 => _297.height]))), () => ( "100%"));
5818
5855
  const {
5819
5856
  primaryColor,
5820
5857
  backgroundColor,
@@ -5829,7 +5866,7 @@ var ConversionFunnelChartInternal = ({
5829
5866
  }) : {
5830
5867
  color: primaryColor || "#000000"
5831
5868
  };
5832
- const isPositiveChange = _optionalChain([changeIndicator, 'optionalAccess', _296 => _296.startsWith, 'call', _297 => _297("+")]);
5869
+ const isPositiveChange = _optionalChain([changeIndicator, 'optionalAccess', _298 => _298.startsWith, 'call', _299 => _299("+")]);
5833
5870
  const changeColor = isPositiveChange ? positiveChangeColor : negativeChangeColor;
5834
5871
  const barBackgroundColor = backgroundColor || hexToRgba(barColor, 0.08) || "rgba(0, 0, 0, 0.08)";
5835
5872
  const renderDefaultMainMetric = () => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, {
@@ -5860,8 +5897,8 @@ var ConversionFunnelChartInternal = ({
5860
5897
  const chartMetadata = _react.useMemo.call(void 0, () => ({
5861
5898
  mainRate,
5862
5899
  changeIndicator,
5863
- stepsCount: _optionalChain([steps, 'optionalAccess', _298 => _298.length]) || 0
5864
- }), [mainRate, changeIndicator, _optionalChain([steps, 'optionalAccess', _299 => _299.length])]);
5900
+ stepsCount: _optionalChain([steps, 'optionalAccess', _300 => _300.length]) || 0
5901
+ }), [mainRate, changeIndicator, _optionalChain([steps, 'optionalAccess', _301 => _301.length])]);
5865
5902
  useChartRegistration({
5866
5903
  chartId,
5867
5904
  legendItems: [],
@@ -5947,8 +5984,8 @@ var ConversionFunnelChartInternal = ({
5947
5984
  direction: "column",
5948
5985
  justify: "flex-end",
5949
5986
  className: conversion_funnel_chart_module_default["bar-container"],
5950
- onClick: _optionalChain([stepHandlers, 'access', _300 => _300.get, 'call', _301 => _301(step.id), 'optionalAccess', _302 => _302.onClick]),
5951
- onKeyDown: _optionalChain([stepHandlers, 'access', _303 => _303.get, 'call', _304 => _304(step.id), 'optionalAccess', _305 => _305.onKeyDown]),
5987
+ onClick: _optionalChain([stepHandlers, 'access', _302 => _302.get, 'call', _303 => _303(step.id), 'optionalAccess', _304 => _304.onClick]),
5988
+ onKeyDown: _optionalChain([stepHandlers, 'access', _305 => _305.get, 'call', _306 => _306(step.id), 'optionalAccess', _307 => _307.onKeyDown]),
5952
5989
  role: "button",
5953
5990
  tabIndex: isBlurred ? -1 : 0,
5954
5991
  "aria-label": step.label,
@@ -7961,7 +7998,7 @@ function contextConnect(Component2, namespace) {
7961
7998
  });
7962
7999
  }
7963
8000
  function _contextConnect(Component2, namespace, options) {
7964
- const WrappedComponent = _optionalChain([options, 'optionalAccess', _306 => _306.forwardsRef]) ? _react.forwardRef.call(void 0, Component2) : Component2;
8001
+ const WrappedComponent = _optionalChain([options, 'optionalAccess', _308 => _308.forwardsRef]) ? _react.forwardRef.call(void 0, Component2) : Component2;
7965
8002
  if (typeof namespace === "undefined") {
7966
8003
  globalThis.SCRIPT_DEBUG === true ? warning("contextConnect: Please provide a namespace") : void 0;
7967
8004
  }
@@ -7997,7 +8034,7 @@ function useContextSystem(props, namespace) {
7997
8034
  if (typeof namespace === "undefined") {
7998
8035
  globalThis.SCRIPT_DEBUG === true ? warning("useContextSystem: Please provide a namespace") : void 0;
7999
8036
  }
8000
- const contextProps = _optionalChain([contextSystemProps, 'optionalAccess', _307 => _307[namespace]]) || {};
8037
+ const contextProps = _optionalChain([contextSystemProps, 'optionalAccess', _309 => _309[namespace]]) || {};
8001
8038
  const finalComponentProps = {
8002
8039
  ...getConnectedNamespace(),
8003
8040
  ...getNamespace(namespace)
@@ -8378,7 +8415,7 @@ function useLeaderboardLegendItems({
8378
8415
  overrideColor: primaryColor || leaderboardChartSettings.primaryColor
8379
8416
  });
8380
8417
  items.push({
8381
- label: _optionalChain([legendLabels, 'optionalAccess', _308 => _308.primary]) || _i18n.__.call(void 0, "Current period", "jetpack-charts"),
8418
+ label: _optionalChain([legendLabels, 'optionalAccess', _310 => _310.primary]) || _i18n.__.call(void 0, "Current period", "jetpack-charts"),
8382
8419
  color: resolvedPrimaryColor
8383
8420
  });
8384
8421
  if (withComparison && !withOverlayLabel) {
@@ -8387,7 +8424,7 @@ function useLeaderboardLegendItems({
8387
8424
  overrideColor: secondaryColor || leaderboardChartSettings.secondaryColor
8388
8425
  });
8389
8426
  items.push({
8390
- label: _optionalChain([legendLabels, 'optionalAccess', _309 => _309.comparison]) || _i18n.__.call(void 0, "Previous period", "jetpack-charts"),
8427
+ label: _optionalChain([legendLabels, 'optionalAccess', _311 => _311.comparison]) || _i18n.__.call(void 0, "Previous period", "jetpack-charts"),
8391
8428
  color: resolvedSecondaryColor
8392
8429
  });
8393
8430
  }
@@ -9046,11 +9083,11 @@ var PieChartInternal = ({
9046
9083
  groupProps.onMouseLeave = onMouseLeave;
9047
9084
  }
9048
9085
  const svgLabelSmall = providerTheme.svgLabelSmall;
9049
- const fontSize = _nullishCoalesce(resolveFontSize(_optionalChain([svgLabelSmall, 'optionalAccess', _310 => _310.fontSize])), () => ( 12));
9086
+ const fontSize = _nullishCoalesce(resolveFontSize(_optionalChain([svgLabelSmall, 'optionalAccess', _312 => _312.fontSize])), () => ( 12));
9050
9087
  const estimatedTextWidth = _chunk7OZEQ5HEcjs.getStringWidth.call(void 0, arc.data.label, {
9051
9088
  fontSize,
9052
- fontFamily: _optionalChain([svgLabelSmall, 'optionalAccess', _311 => _311.fontFamily]),
9053
- fontWeight: _optionalChain([svgLabelSmall, 'optionalAccess', _312 => _312.fontWeight])
9089
+ fontFamily: _optionalChain([svgLabelSmall, 'optionalAccess', _313 => _313.fontFamily]),
9090
+ fontWeight: _optionalChain([svgLabelSmall, 'optionalAccess', _314 => _314.fontWeight])
9054
9091
  });
9055
9092
  const labelPadding = 6;
9056
9093
  const backgroundWidth = estimatedTextWidth + labelPadding * 2;
@@ -9500,7 +9537,7 @@ var SparklineComponent = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
9500
9537
  animation
9501
9538
  }, ref) => {
9502
9539
  const theme = useGlobalChartsTheme();
9503
- const themeStrokeWidth = _nullishCoalesce(_optionalChain([theme, 'access', _313 => _313.sparkline, 'optionalAccess', _314 => _314.strokeWidth]), () => ( 1.5));
9540
+ const themeStrokeWidth = _nullishCoalesce(_optionalChain([theme, 'access', _315 => _315.sparkline, 'optionalAccess', _316 => _316.strokeWidth]), () => ( 1.5));
9504
9541
  const strokeWidth = _nullishCoalesce(strokeWidthProp, () => ( themeStrokeWidth));
9505
9542
  const seriesData = _react.useMemo.call(void 0, () => {
9506
9543
  if (!data || data.length === 0) {
@@ -9509,7 +9546,7 @@ var SparklineComponent = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
9509
9546
  return transformToSeriesData(data, color, strokeWidth);
9510
9547
  }, [data, color, strokeWidth]);
9511
9548
  const finalMargin = _react.useMemo.call(void 0, () => {
9512
- const themeMargin = _nullishCoalesce(_optionalChain([theme, 'access', _315 => _315.sparkline, 'optionalAccess', _316 => _316.margin]), () => ( {
9549
+ const themeMargin = _nullishCoalesce(_optionalChain([theme, 'access', _317 => _317.sparkline, 'optionalAccess', _318 => _318.margin]), () => ( {
9513
9550
  top: 2,
9514
9551
  right: 2,
9515
9552
  bottom: 2,
@@ -9520,7 +9557,7 @@ var SparklineComponent = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
9520
9557
  ...themeMargin,
9521
9558
  ...margin
9522
9559
  };
9523
- }, [marginProp, _optionalChain([theme, 'access', _317 => _317.sparkline, 'optionalAccess', _318 => _318.margin])]);
9560
+ }, [marginProp, _optionalChain([theme, 'access', _319 => _319.sparkline, 'optionalAccess', _320 => _320.margin])]);
9524
9561
  const seriesWithGradient = _react.useMemo.call(void 0, () => {
9525
9562
  if (!gradient || seriesData.length === 0) {
9526
9563
  return seriesData;