apexcharts 7.2.0 → 7.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/LICENSE +30 -11
  2. package/dist/apexcharts.common.js +2 -2
  3. package/dist/apexcharts.core.js +545 -463
  4. package/dist/apexcharts.core.min.js +2 -2
  5. package/dist/apexcharts.esm.js +1149 -801
  6. package/dist/apexcharts.js +684 -254
  7. package/dist/apexcharts.min.js +2 -2
  8. package/dist/apexcharts.ssr.common.js +2 -2
  9. package/dist/apexcharts.ssr.esm.js +684 -254
  10. package/dist/area.common.js +1 -1
  11. package/dist/area.esm.js +1 -1
  12. package/dist/bar.common.js +2 -2
  13. package/dist/bar.esm.js +20 -10
  14. package/dist/bar.js +2 -2
  15. package/dist/boxPlot.common.js +2 -2
  16. package/dist/boxPlot.esm.js +20 -10
  17. package/dist/bubble.common.js +1 -1
  18. package/dist/bubble.esm.js +1 -1
  19. package/dist/candlestick.common.js +2 -2
  20. package/dist/candlestick.esm.js +20 -10
  21. package/dist/candlestick.js +2 -2
  22. package/dist/column.common.js +2 -2
  23. package/dist/column.esm.js +20 -10
  24. package/dist/core.common.js +2 -2
  25. package/dist/core.esm.js +545 -463
  26. package/dist/donut.common.js +1 -1
  27. package/dist/donut.esm.js +1 -1
  28. package/dist/dumbbell.common.js +2 -2
  29. package/dist/dumbbell.esm.js +20 -10
  30. package/dist/features/all.common.js +2 -2
  31. package/dist/features/all.esm.js +364 -26
  32. package/dist/features/annotations.common.js +1 -1
  33. package/dist/features/annotations.esm.js +1 -1
  34. package/dist/features/annotations.js +1 -1
  35. package/dist/features/context-menu.common.js +1 -1
  36. package/dist/features/context-menu.esm.js +1 -1
  37. package/dist/features/context-menu.js +1 -1
  38. package/dist/features/drilldown.common.js +1 -1
  39. package/dist/features/drilldown.esm.js +1 -1
  40. package/dist/features/drilldown.js +1 -1
  41. package/dist/features/dumbbell.common.js +1 -1
  42. package/dist/features/dumbbell.esm.js +1 -1
  43. package/dist/features/dumbbell.js +1 -1
  44. package/dist/features/exports.common.js +2 -2
  45. package/dist/features/exports.esm.js +12 -14
  46. package/dist/features/exports.js +2 -2
  47. package/dist/features/facet.common.js +1 -1
  48. package/dist/features/facet.esm.js +1 -1
  49. package/dist/features/facet.js +1 -1
  50. package/dist/features/history.common.js +1 -1
  51. package/dist/features/history.esm.js +1 -1
  52. package/dist/features/history.js +1 -1
  53. package/dist/features/ink.common.js +1 -1
  54. package/dist/features/ink.esm.js +1 -1
  55. package/dist/features/ink.js +1 -1
  56. package/dist/features/keyboard.common.js +2 -2
  57. package/dist/features/keyboard.esm.js +14 -1
  58. package/dist/features/keyboard.js +2 -2
  59. package/dist/features/legend.common.js +1 -1
  60. package/dist/features/legend.esm.js +1 -1
  61. package/dist/features/legend.js +1 -1
  62. package/dist/features/link.common.js +1 -1
  63. package/dist/features/link.esm.js +38 -38
  64. package/dist/features/link.js +1 -1
  65. package/dist/features/marks.common.js +1 -1
  66. package/dist/features/marks.esm.js +1 -1
  67. package/dist/features/marks.js +1 -1
  68. package/dist/features/measure.common.js +1 -1
  69. package/dist/features/measure.esm.js +1 -1
  70. package/dist/features/measure.js +1 -1
  71. package/dist/features/morph.common.js +1 -1
  72. package/dist/features/morph.esm.js +1 -1
  73. package/dist/features/morph.js +1 -1
  74. package/dist/features/perspectives.common.js +1 -1
  75. package/dist/features/perspectives.esm.js +11 -11
  76. package/dist/features/perspectives.js +1 -1
  77. package/dist/features/raincloud.common.js +1 -1
  78. package/dist/features/raincloud.esm.js +1 -1
  79. package/dist/features/raincloud.js +1 -1
  80. package/dist/features/renderer-canvas.common.js +1 -1
  81. package/dist/features/renderer-canvas.esm.js +1 -1
  82. package/dist/features/renderer-canvas.js +1 -1
  83. package/dist/features/stats.common.js +1 -1
  84. package/dist/features/stats.esm.js +1 -1
  85. package/dist/features/stats.js +1 -1
  86. package/dist/features/storyboard.common.js +1 -1
  87. package/dist/features/storyboard.esm.js +11 -11
  88. package/dist/features/storyboard.js +1 -1
  89. package/dist/features/streamgraph.common.js +1 -1
  90. package/dist/features/streamgraph.esm.js +1 -1
  91. package/dist/features/streamgraph.js +1 -1
  92. package/dist/features/toolbar.common.js +2 -2
  93. package/dist/features/toolbar.esm.js +172 -25
  94. package/dist/features/toolbar.js +2 -2
  95. package/dist/features/trellis.common.js +1 -1
  96. package/dist/features/trellis.esm.js +1 -1
  97. package/dist/features/trellis.js +1 -1
  98. package/dist/features/waterfall.common.js +1 -1
  99. package/dist/features/waterfall.esm.js +1 -1
  100. package/dist/features/waterfall.js +1 -1
  101. package/dist/features/weave.common.js +2 -2
  102. package/dist/features/weave.esm.js +180 -2
  103. package/dist/features/weave.js +2 -2
  104. package/dist/heatmap.common.js +1 -1
  105. package/dist/heatmap.esm.js +1 -1
  106. package/dist/heatmap.js +1 -1
  107. package/dist/histogram.common.js +2 -2
  108. package/dist/histogram.esm.js +20 -10
  109. package/dist/line.common.js +1 -1
  110. package/dist/line.esm.js +1 -1
  111. package/dist/line.js +1 -1
  112. package/dist/pictograms.common.js +1 -1
  113. package/dist/pictograms.esm.js +1 -1
  114. package/dist/pictograms.js +1 -1
  115. package/dist/pie.common.js +1 -1
  116. package/dist/pie.esm.js +1 -1
  117. package/dist/pie.js +1 -1
  118. package/dist/polarArea.common.js +1 -1
  119. package/dist/polarArea.esm.js +1 -1
  120. package/dist/radar.common.js +1 -1
  121. package/dist/radar.esm.js +1 -1
  122. package/dist/radar.js +1 -1
  123. package/dist/radialBar.common.js +1 -1
  124. package/dist/radialBar.esm.js +1 -1
  125. package/dist/radialBar.js +1 -1
  126. package/dist/raincloud.common.js +2 -2
  127. package/dist/raincloud.esm.js +20 -10
  128. package/dist/rangeArea.common.js +1 -1
  129. package/dist/rangeArea.esm.js +1 -1
  130. package/dist/rangeBar.common.js +2 -2
  131. package/dist/rangeBar.esm.js +20 -10
  132. package/dist/scatter.common.js +1 -1
  133. package/dist/scatter.esm.js +1 -1
  134. package/dist/streamgraph.common.js +1 -1
  135. package/dist/streamgraph.esm.js +1 -1
  136. package/dist/sunburst.common.js +1 -1
  137. package/dist/sunburst.esm.js +1 -1
  138. package/dist/sunburst.js +1 -1
  139. package/dist/treemap.common.js +1 -1
  140. package/dist/treemap.esm.js +1 -1
  141. package/dist/treemap.js +1 -1
  142. package/dist/unit-shapes.common.js +1 -1
  143. package/dist/unit-shapes.esm.js +1 -1
  144. package/dist/unit-shapes.js +1 -1
  145. package/dist/unit.common.js +1 -1
  146. package/dist/unit.esm.js +79 -79
  147. package/dist/unit.js +1 -1
  148. package/dist/violin.common.js +2 -2
  149. package/dist/violin.esm.js +20 -10
  150. package/dist/violin.js +2 -2
  151. package/dist/waterfall.common.js +2 -2
  152. package/dist/waterfall.esm.js +20 -10
  153. package/package.json +2 -2
  154. package/src/apexcharts.js +39 -15
  155. package/src/charts/common/bar/Helpers.js +31 -12
  156. package/src/modules/Data.js +8 -2
  157. package/src/modules/Exports.js +14 -12
  158. package/src/modules/Formatters.js +24 -1
  159. package/src/modules/Range.js +28 -1
  160. package/src/modules/Toolbar.js +112 -2
  161. package/src/modules/ZoomPanSelection.js +85 -7
  162. package/src/modules/accessibility/KeyboardNavigation.js +14 -0
  163. package/src/modules/axes/YAxis.js +12 -15
  164. package/src/modules/helpers/UpdateHelpers.js +25 -8
  165. package/src/modules/settings/Globals.js +5 -10
  166. package/src/modules/settings/Options.js +15 -0
  167. package/src/modules/weave/PluginAPI.js +57 -1
  168. package/src/modules/weave/WeaveHost.js +148 -0
  169. package/src/ssr/DOMShim.js +50 -0
  170. package/src/types/internal.d.ts +1 -1
  171. package/src/utils/Utils.js +6 -9
  172. package/types/apexcharts.d.ts +17 -0
@@ -39,7 +39,7 @@ var __async = (__this, __arguments, generator) => {
39
39
  });
40
40
  };
41
41
  /*!
42
- * ApexCharts v7.2.0
42
+ * ApexCharts v7.4.0
43
43
  * (c) 2018-2026 ApexCharts
44
44
  */
45
45
  import * as _core from "apexcharts/core";
@@ -810,8 +810,7 @@ class Exports {
810
810
  }
811
811
  };
812
812
  const handleUnequalXValues = () => {
813
- const categories = /* @__PURE__ */ new Set();
814
- const data = {};
813
+ const byCategory = /* @__PURE__ */ new Map();
815
814
  series.forEach((s, sI) => {
816
815
  s == null ? void 0 : s.data.forEach((dataItem) => {
817
816
  let cat, value;
@@ -824,23 +823,22 @@ class Exports {
824
823
  } else {
825
824
  return;
826
825
  }
827
- if (!/** @type {Record<string,any>} */
828
- data[cat]) {
829
- data[cat] = Array(
830
- series.length
831
- ).fill("");
826
+ const key = String(cat);
827
+ let row = byCategory.get(key);
828
+ if (!row) {
829
+ row = { cat, values: Array(series.length).fill("") };
830
+ byCategory.set(key, row);
832
831
  }
833
- data[cat][sI] = getFormattedValue(value);
834
- categories.add(cat);
832
+ row.values[sI] = getFormattedValue(value);
835
833
  });
836
834
  });
837
835
  if (columns.length) {
838
836
  rows.push(columns.join(columnDelimiter));
839
837
  }
840
- Array.from(categories).sort().forEach((cat) => {
841
- const values = (
842
- /** @type {Record<string,any>} */
843
- data[cat]
838
+ Array.from(byCategory.keys()).sort().forEach((key) => {
839
+ const { cat, values } = (
840
+ /** @type {{cat: any, values: string[]}} */
841
+ byCategory.get(key)
844
842
  );
845
843
  rows.push([getFormattedCategory(cat), ...values].join(columnDelimiter));
846
844
  });
@@ -2600,10 +2598,49 @@ class Toolbar {
2600
2598
  this.elMenu = null;
2601
2599
  this.elMenuItems = [];
2602
2600
  this.t = null;
2601
+ this._drawnForZoom = null;
2603
2602
  }
2604
- createToolbar() {
2605
- var _a, _b;
2603
+ /**
2604
+ * Whether this chart's built-in ways back out of a zoom are switched on.
2605
+ *
2606
+ * The gate `chart.zoom.resetControl` opens, and the one the Escape shortcut
2607
+ * reads too, so a page that says it supplies its own reset gets neither.
2608
+ * 'auto' means "supply one when nothing else on screen can": a toolbar
2609
+ * showing its reset tool is a way back, and anything else is not.
2610
+ *
2611
+ * @returns {boolean}
2612
+ */
2613
+ resetControlAllowed() {
2614
+ const c = this.w.config.chart;
2615
+ if (!c.zoom || !c.zoom.enabled) return false;
2616
+ const setting = c.zoom.resetControl === void 0 ? "auto" : c.zoom.resetControl;
2617
+ if (setting !== "auto") return !!setting;
2618
+ const onScreen = c.toolbar && c.toolbar.show && c.toolbar.tools && c.toolbar.tools.reset;
2619
+ return !onScreen;
2620
+ }
2621
+ /**
2622
+ * Whether a reset control has to be drawn for the state the chart is in now.
2623
+ *
2624
+ * Only while the chart is actually zoomed, which is the whole idea: the
2625
+ * control appears at the moment the viewer changed the view, where they are
2626
+ * already looking, and goes again when the range does. A page that never
2627
+ * zooms never sees it, so `toolbar: { show: false }` still means an empty
2628
+ * chart for everyone who does not zoom.
2629
+ *
2630
+ * @returns {boolean}
2631
+ */
2632
+ resetControlDue() {
2633
+ return !!this.w.interact.zoomed && this.resetControlAllowed();
2634
+ }
2635
+ /**
2636
+ * @param {{ resetOnly?: boolean }} [opts] `resetOnly` draws the on-demand
2637
+ * reset control and nothing else, for a chart whose page asked for no
2638
+ * toolbar at all. See {@link Toolbar#resetControlDue}.
2639
+ */
2640
+ createToolbar(opts = {}) {
2641
+ var _a, _b, _c;
2606
2642
  const w = this.w;
2643
+ const resetOnly = !!opts.resetOnly;
2607
2644
  const createDiv = () => {
2608
2645
  return BrowserAPIs.createElementNS("http://www.w3.org/1999/xhtml", "div");
2609
2646
  };
@@ -2631,6 +2668,24 @@ class Toolbar {
2631
2668
  this.elMenu = createDiv();
2632
2669
  this.elCustomIcons = [];
2633
2670
  this.t = w.config.chart.toolbar.tools;
2671
+ this._drawnForZoom = null;
2672
+ if (resetOnly) {
2673
+ this.t = {
2674
+ zoom: false,
2675
+ zoomin: false,
2676
+ zoomout: false,
2677
+ selection: false,
2678
+ pan: false,
2679
+ measure: false,
2680
+ download: false,
2681
+ customIcons: [],
2682
+ reset: true
2683
+ };
2684
+ this._drawnForZoom = "wrap";
2685
+ } else if (!this.t.reset && this.resetControlDue()) {
2686
+ this.t = __spreadProps(__spreadValues({}, this.t), { reset: true });
2687
+ this._drawnForZoom = "control";
2688
+ }
2634
2689
  if (Array.isArray(this.t.customIcons)) {
2635
2690
  for (let i = 0; i < this.t.customIcons.length; i++) {
2636
2691
  this.elCustomIcons.push(createBtn());
@@ -2741,7 +2796,14 @@ class Toolbar {
2741
2796
  this.elMenuIcon.setAttribute("aria-haspopup", "true");
2742
2797
  this.elMenuIcon.setAttribute("aria-expanded", "false");
2743
2798
  }
2744
- this._createHamburgerMenu(elToolbarWrap);
2799
+ if (!resetOnly) this._createHamburgerMenu(elToolbarWrap);
2800
+ if (resetOnly) {
2801
+ (_a = this.elZoomReset) == null ? void 0 : _a.addEventListener(
2802
+ "click",
2803
+ this.handleZoomReset.bind(this)
2804
+ );
2805
+ return;
2806
+ }
2745
2807
  if (w.interact.zoomEnabled) {
2746
2808
  this.elZoom.classList.add(this.selectedClass);
2747
2809
  } else if (w.interact.panEnabled) {
@@ -2750,7 +2812,7 @@ class Toolbar {
2750
2812
  this.elSelection.classList.add(this.selectedClass);
2751
2813
  } else if (w.interact.measureEnabled && this.elMeasure) {
2752
2814
  this.elMeasure.classList.add(this.selectedClass);
2753
- (_b = (_a = this.ctx.measure) == null ? void 0 : _a.startMeasure) == null ? void 0 : _b.call(_a);
2815
+ (_c = (_b = this.ctx.measure) == null ? void 0 : _b.startMeasure) == null ? void 0 : _c.call(_b);
2754
2816
  }
2755
2817
  this.addToolbarEventListeners();
2756
2818
  }
@@ -3156,9 +3218,28 @@ class Toolbar {
3156
3218
  break;
3157
3219
  }
3158
3220
  }
3221
+ /**
3222
+ * Take down whatever the zoom alone put on screen.
3223
+ *
3224
+ * By hand, and not left to the next render, because of the order in
3225
+ * {@link Toolbar#handleZoomReset}: the re-render happens while
3226
+ * `interact.zoomed` is still true, so the control is drawn once more and then
3227
+ * the flag clears with no further pass to notice. Reversing that order would
3228
+ * change what every listener downstream of the update sees, which is a much
3229
+ * larger promise than this control is worth.
3230
+ */
3231
+ clearZoomAffordance() {
3232
+ const drawn = this._drawnForZoom;
3233
+ this._drawnForZoom = null;
3234
+ if (!drawn || !this.elZoomReset) return;
3235
+ const parent = this.elZoomReset.parentNode;
3236
+ const gone = drawn === "wrap" ? parent : this.elZoomReset;
3237
+ if (gone && gone.parentNode) gone.parentNode.removeChild(gone);
3238
+ }
3159
3239
  handleZoomReset() {
3160
3240
  const charts = this.ctx.getSyncedCharts();
3161
3241
  charts.forEach((ch) => {
3242
+ var _a;
3162
3243
  const w = ch.w;
3163
3244
  if (!w.interact.zoomed) return;
3164
3245
  w.globals.lastXAxis.min = w.globals.initialConfig.xaxis.min;
@@ -3184,6 +3265,7 @@ class Toolbar {
3184
3265
  w.config.chart.animations.dynamicAnimation.enabled
3185
3266
  );
3186
3267
  w.interact.zoomed = false;
3268
+ (_a = ch.ctx.toolbar) == null ? void 0 : _a.clearZoomAffordance();
3187
3269
  });
3188
3270
  }
3189
3271
  destroy() {
@@ -3332,6 +3414,10 @@ class ZoomPanSelection extends Toolbar {
3332
3414
  passive: false
3333
3415
  });
3334
3416
  }
3417
+ this.hoverArea.addEventListener("keydown", me.escapeResetEvent.bind(me), {
3418
+ capture: false,
3419
+ passive: true
3420
+ });
3335
3421
  if (this._momentumEnabled()) {
3336
3422
  ["touchstart", "touchmove", "touchend", "touchcancel"].forEach(
3337
3423
  (event) => {
@@ -3464,12 +3550,16 @@ class ZoomPanSelection extends Toolbar {
3464
3550
  /**
3465
3551
  * A wheel or pinch zoom is an incidental gesture: the viewer can land in a
3466
3552
  * zoomed window without meaning to (a page scroll over the chart, a two-finger
3467
- * swipe), so it is only offered when there is a way back out of it. The only
3468
- * built-in way back is the toolbar's reset button, hence 'auto' (the default
3469
- * for both allowMouseWheelZoom and pinch) resolves against that button being
3470
- * present. A page that builds its own reset control sets the option to true
3471
- * and gets the gesture with no toolbar. Drag-to-zoom is deliberate, so it is
3472
- * not gated this way.
3553
+ * swipe), so it is only offered when there is a way back out of it. 'auto'
3554
+ * (the default for both allowMouseWheelZoom and pinch) resolves against a
3555
+ * reset button that is already on screen. A page that builds its own reset
3556
+ * control sets the option to true and gets the gesture with no toolbar.
3557
+ * Drag-to-zoom is deliberate, so it is not gated this way.
3558
+ *
3559
+ * `chart.zoom.resetControl` supplies a reset of its own once a chart IS
3560
+ * zoomed, and deliberately does NOT open this gate. It arrives after the
3561
+ * fact, and what an incidental wheel zoom takes from the viewer first is the
3562
+ * page scroll it swallowed, which no button hands back.
3473
3563
  *
3474
3564
  * @param {boolean|'auto'} setting
3475
3565
  */
@@ -3484,6 +3574,58 @@ class ZoomPanSelection extends Toolbar {
3484
3574
  const { zoom } = this.w.config.chart;
3485
3575
  return this._incidentalZoomEnabled(zoom && zoom.allowMouseWheelZoom);
3486
3576
  }
3577
+ /**
3578
+ * Put keyboard focus on the chart, where the chart is focusable at all.
3579
+ *
3580
+ * A drag is swallowed by the zoom handlers before the browser can move focus,
3581
+ * so a viewer who has just zoomed by hand leaves nothing focused, and every
3582
+ * key the chart offers is out of reach: Escape to reset (see
3583
+ * {@link ZoomPanSelection#escapeResetEvent}) and the +, - and 0 the keyboard
3584
+ * module already binds. Focusing what they just acted on puts those in reach.
3585
+ *
3586
+ * Pointer-driven focus, which keyboard navigation expects and does not read
3587
+ * as a request to start navigating, and which the stylesheet draws no ring
3588
+ * around (`svg:focus:not(:focus-visible)`).
3589
+ *
3590
+ * Only where the accessibility module has made the SVG focusable, which is
3591
+ * the default: a page that turned keyboard support off is not handed a tab
3592
+ * stop it never asked for, and still has the reset control as its way back.
3593
+ */
3594
+ _focusForKeyboard() {
3595
+ var _a, _b;
3596
+ const node = this.w.dom.Paper && this.w.dom.Paper.node;
3597
+ if (!node || typeof node.focus !== "function") return;
3598
+ if (node.getAttribute("tabindex") === null) return;
3599
+ (_b = (_a = this.ctx.keyboardNavigation) == null ? void 0 : _a.notePointerFocus) == null ? void 0 : _b.call(_a);
3600
+ try {
3601
+ node.focus({ preventScroll: true });
3602
+ } catch (e) {
3603
+ node.focus();
3604
+ }
3605
+ }
3606
+ /**
3607
+ * Escape, on a zoomed chart, puts the range back.
3608
+ *
3609
+ * The quiet half of the same answer the on-demand reset control gives, and
3610
+ * gated on it, so a page that says it supplies its own way back gets neither.
3611
+ *
3612
+ * It defers to keyboard navigation, whose Escape dismisses the tooltip and
3613
+ * which offers `0` for this, so the key means one thing at a time. It does
3614
+ * not stop the event either, so a page listening for Escape still hears it.
3615
+ *
3616
+ * Reachable because a completed drag-zoom puts focus on the chart; see
3617
+ * {@link ZoomPanSelection#_focusForKeyboard}.
3618
+ *
3619
+ * @param {any} e
3620
+ */
3621
+ escapeResetEvent(e) {
3622
+ if (e.key !== "Escape" && e.key !== "Esc") return;
3623
+ if (!this.w.interact.zoomed) return;
3624
+ const nav = this.ctx.keyboardNavigation;
3625
+ if (nav && nav.active) return;
3626
+ if (!this.resetControlAllowed()) return;
3627
+ this.handleZoomReset();
3628
+ }
3487
3629
  /** Lazily-created, re-render-surviving wheel-gesture state. */
3488
3630
  _wheel() {
3489
3631
  const it = this.w.interact;
@@ -3966,11 +4108,16 @@ class ZoomPanSelection extends Toolbar {
3966
4108
  if (!w.config.chart.group) {
3967
4109
  options.yaxis = yaxis;
3968
4110
  }
3969
- me.ctx.updateHelpers._updateOptions(
4111
+ const applied = me.ctx.updateHelpers._updateOptions(
3970
4112
  options,
3971
4113
  false,
3972
4114
  me.w.config.chart.animations.dynamicAnimation.enabled
3973
4115
  );
4116
+ if (applied && typeof applied.then === "function") {
4117
+ applied.then(() => me._focusForKeyboard());
4118
+ } else {
4119
+ me._focusForKeyboard();
4120
+ }
3974
4121
  if (typeof w.config.chart.events.zoomed === "function") {
3975
4122
  toolbar.zoomCallback(xaxis, yaxis);
3976
4123
  }
@@ -5726,6 +5873,19 @@ class KeyboardNavigation {
5726
5873
  _onPointerDown() {
5727
5874
  this._lastPointerDownAt = Date.now();
5728
5875
  }
5876
+ /**
5877
+ * Note that a pointer gesture is about to move focus into the chart.
5878
+ *
5879
+ * The 100 ms window above catches the browser's own click-to-focus, which
5880
+ * lands immediately. A drag-zoom moves focus deliberately, and only once its
5881
+ * re-render is done (ZoomPanSelection#_focusForKeyboard), which is far
5882
+ * outside that window. Without this it reads as a viewer asking to navigate
5883
+ * by keyboard, which activates nav and flashes a tooltip at the first visible
5884
+ * point after every zoom.
5885
+ */
5886
+ notePointerFocus() {
5887
+ this._lastPointerDownAt = Date.now();
5888
+ }
5729
5889
  /**
5730
5890
  * Called from Events.js keydown handler. Navigation keys are already handled
5731
5891
  * by the direct SVG listener (which can call preventDefault). This entry
@@ -9318,7 +9478,7 @@ function getRegistry() {
9318
9478
  function getPlugin(name) {
9319
9479
  return getRegistry()[name] || null;
9320
9480
  }
9321
- const WEAVE_API_VERSION = 3;
9481
+ const WEAVE_API_VERSION = 5;
9322
9482
  const PLUGIN_CHART_METHODS = [
9323
9483
  "updateOptions",
9324
9484
  "updateSeries",
@@ -9549,6 +9709,19 @@ function buildPluginAPI(host, record) {
9549
9709
  enabledOnSeries: Array.isArray(
9550
9710
  w.config.dataLabels && w.config.dataLabels.enabledOnSeries
9551
9711
  ) ? w.config.dataLabels.enabledOnSeries.slice() : null
9712
+ }),
9713
+ // The caller's own dashing, reported for the same reason and against
9714
+ // the same trap (v5). `stroke.dashArray` is indexed by series position
9715
+ // with no per-series escape hatch, so a plugin that wants ITS OWN
9716
+ // computed series dashed has to write the whole array, and writing one
9717
+ // without knowing what was there discards the caller's dashed lines
9718
+ // with nothing to restore them from.
9719
+ //
9720
+ // A scalar applies to every series and an array is per series. There is
9721
+ // no "unset" to report: the option defaults to 0, and 0 already means
9722
+ // no dashing, so restoring it restores exactly what was there.
9723
+ stroke: Object.freeze({
9724
+ dashArray: Array.isArray(w.config.stroke && w.config.stroke.dashArray) ? w.config.stroke.dashArray.slice() : w.config.stroke && w.config.stroke.dashArray || 0
9552
9725
  })
9553
9726
  });
9554
9727
  },
@@ -9616,6 +9789,36 @@ function buildPluginAPI(host, record) {
9616
9789
  host._reserve(record.def.name, box);
9617
9790
  return api;
9618
9791
  },
9792
+ /**
9793
+ * Subscribe to the data point a viewer is pointing at.
9794
+ *
9795
+ * The chart already knows this: it resolves the series and point under the
9796
+ * pointer for its own tooltip and fires `dataPointMouseEnter`,
9797
+ * `dataPointMouseLeave` and `dataPointSelection` for the caller. This
9798
+ * forwards the same three, so a plugin gets the host's answer rather than
9799
+ * hit-testing the SVG itself and disagreeing with the tooltip.
9800
+ *
9801
+ * The payload is normalised rather than the chart's own argument list,
9802
+ * which passes `w`. A plugin must not receive `w`, and the three things a
9803
+ * plugin actually wants (which series, which point, what the point is
9804
+ * called) are exactly what the chart has already resolved.
9805
+ *
9806
+ * `category` is the resolved display label, the same string `api.categories`
9807
+ * carries, because a plugin coordinating two charts keys on the label
9808
+ * rather than on an index that means something different on each chart.
9809
+ *
9810
+ * Nothing here gives a plugin the ability to intercept or cancel: the
9811
+ * chart's own tooltip, selection state and caller events are unaffected,
9812
+ * and a handler that throws is contained rather than allowed to break the
9813
+ * interaction it was watching.
9814
+ *
9815
+ * @param {(e: {type: 'enter'|'leave'|'select', seriesIndex: number, dataPointIndex: number, category: string|undefined, seriesName: string|undefined, selected: boolean|undefined}) => void} fn
9816
+ * @returns {() => void} unsubscribe
9817
+ * @since Weave v4
9818
+ */
9819
+ pointer(fn) {
9820
+ return host._onPointer(record.def.name, fn);
9821
+ },
9619
9822
  // ── custom events out to the host app ──
9620
9823
  /**
9621
9824
  * Fires as `plugin:<pluginName>:<name>` on the chart's event bus. The
@@ -9653,6 +9856,8 @@ const _WeaveHost = class _WeaveHost {
9653
9856
  this._derived = null;
9654
9857
  this._reserved = null;
9655
9858
  this._reserveTimer = null;
9859
+ this._pointerSubs = null;
9860
+ this._pointerWired = null;
9656
9861
  this._onUpdated = this._onUpdated.bind(this);
9657
9862
  this._init();
9658
9863
  }
@@ -9895,6 +10100,132 @@ const _WeaveHost = class _WeaveHost {
9895
10100
  }
9896
10101
  this._repairInitialSeries();
9897
10102
  }
10103
+ /**
10104
+ * Subscribe a plugin to the data point the viewer is pointing at.
10105
+ *
10106
+ * Wired lazily: a chart whose plugins never ask pays nothing, and the chart
10107
+ * fires these three events whether or not anyone is listening, so there is no
10108
+ * cost to the chart either way.
10109
+ *
10110
+ * The chart's own handler signature is `(e, ctx, {seriesIndex,
10111
+ * dataPointIndex, w})`. `w` stops here: what reaches a plugin is the
10112
+ * normalised payload documented on `api.pointer`.
10113
+ *
10114
+ * @param {string} pluginName
10115
+ * @param {Function} fn
10116
+ * @returns {() => void} unsubscribe
10117
+ */
10118
+ _onPointer(pluginName, fn) {
10119
+ if (typeof fn !== "function") return () => {
10120
+ };
10121
+ if (!this._pointerSubs) this._pointerSubs = /* @__PURE__ */ new Map();
10122
+ const list = this._pointerSubs.get(pluginName) || [];
10123
+ list.push(fn);
10124
+ this._pointerSubs.set(pluginName, list);
10125
+ this._wirePointer();
10126
+ return () => {
10127
+ const current = this._pointerSubs && this._pointerSubs.get(pluginName);
10128
+ if (!current) return;
10129
+ const i = current.indexOf(fn);
10130
+ if (i > -1) current.splice(i, 1);
10131
+ };
10132
+ }
10133
+ /** Attach to the chart's own data point events, once. */
10134
+ _wirePointer() {
10135
+ if (this._pointerWired) return;
10136
+ if (!this.ctx || typeof this.ctx.addEventListener !== "function") return;
10137
+ const map = [
10138
+ ["enter", "dataPointMouseEnter"],
10139
+ ["leave", "dataPointMouseLeave"],
10140
+ ["select", "dataPointSelection"]
10141
+ ];
10142
+ this._pointerWired = [];
10143
+ for (const [type, name] of map) {
10144
+ const handler = (_e, _ctx, opts) => {
10145
+ this._emitPointer(type, opts);
10146
+ };
10147
+ this.ctx.addEventListener(name, handler);
10148
+ this._pointerWired.push([name, handler]);
10149
+ }
10150
+ }
10151
+ /**
10152
+ * Hand one pointer event to every subscribed plugin.
10153
+ *
10154
+ * A handler that throws is contained per plugin, on the same terms as every
10155
+ * other plugin callback here: this runs inside the viewer's own hover, and a
10156
+ * plugin breaking the chart's interaction would be the worst failure mode
10157
+ * this facade has.
10158
+ *
10159
+ * @param {'enter'|'leave'|'select'} type
10160
+ * @param {any} opts
10161
+ */
10162
+ _emitPointer(type, opts) {
10163
+ if (!this._pointerSubs || !this._pointerSubs.size) return;
10164
+ const seriesIndex = opts && typeof opts.seriesIndex === "number" ? opts.seriesIndex : -1;
10165
+ const dataPointIndex = opts && typeof opts.dataPointIndex === "number" ? opts.dataPointIndex : -1;
10166
+ const labels = this._categories() || [];
10167
+ const w = this.w;
10168
+ const config = w && w.config && w.config.series || [];
10169
+ const payload = {
10170
+ type,
10171
+ seriesIndex,
10172
+ dataPointIndex,
10173
+ category: dataPointIndex > -1 ? labels[dataPointIndex] : void 0,
10174
+ // A pie/donut carries bare numbers in `series`, so there is no name to
10175
+ // read: undefined rather than a guess, on the same terms as `category`.
10176
+ seriesName: _WeaveHost._seriesName(config, seriesIndex),
10177
+ // Only meaningful on a select: the chart hands back its whole selection
10178
+ // set, and what a plugin wants to know is whether THIS point is now in
10179
+ // it, so a second click reads as a deselect rather than another select.
10180
+ selected: type === "select" ? _WeaveHost._isSelected(opts, seriesIndex, dataPointIndex) : void 0
10181
+ };
10182
+ for (const [name, handlers] of this._pointerSubs) {
10183
+ for (const fn of handlers.slice()) {
10184
+ try {
10185
+ fn(payload);
10186
+ } catch (e) {
10187
+ console.warn(
10188
+ '[apexcharts] plugin "' + name + '" threw in a pointer handler',
10189
+ e
10190
+ );
10191
+ }
10192
+ }
10193
+ }
10194
+ }
10195
+ /**
10196
+ * The configured name of series `i`, where there is one.
10197
+ *
10198
+ * @param {any[]} config
10199
+ * @param {number} i
10200
+ * @returns {string|undefined}
10201
+ */
10202
+ static _seriesName(config, i) {
10203
+ if (i < 0) return void 0;
10204
+ const entry = config[i];
10205
+ if (!entry || typeof entry !== "object") return void 0;
10206
+ return typeof entry.name === "string" ? entry.name : void 0;
10207
+ }
10208
+ /**
10209
+ * Whether the chart now counts this point as selected.
10210
+ *
10211
+ * `selectedDataPoints` is an array per series of the indexes selected in it.
10212
+ * Absent on a chart type that does not carry point selection, in which case
10213
+ * the answer is undefined rather than false: "not selected" and "selection
10214
+ * does not apply here" are different, and a plugin keying on it should be
10215
+ * able to tell.
10216
+ *
10217
+ * @param {any} opts
10218
+ * @param {number} seriesIndex
10219
+ * @param {number} dataPointIndex
10220
+ * @returns {boolean|undefined}
10221
+ */
10222
+ static _isSelected(opts, seriesIndex, dataPointIndex) {
10223
+ const all = opts && opts.selectedDataPoints;
10224
+ if (!Array.isArray(all) || seriesIndex < 0) return void 0;
10225
+ const mine = all[seriesIndex];
10226
+ if (!Array.isArray(mine)) return false;
10227
+ return mine.indexOf(dataPointIndex) > -1;
10228
+ }
9898
10229
  /**
9899
10230
  * Record a plugin's container reservation and re-render if it changed.
9900
10231
  *
@@ -10119,6 +10450,13 @@ const _WeaveHost = class _WeaveHost {
10119
10450
  this.active = [];
10120
10451
  this._derived = null;
10121
10452
  this._reserved = null;
10453
+ this._pointerSubs = null;
10454
+ if (this._pointerWired) {
10455
+ for (const [name, handler] of this._pointerWired) {
10456
+ this.ctx.removeEventListener && this.ctx.removeEventListener(name, handler);
10457
+ }
10458
+ this._pointerWired = null;
10459
+ }
10122
10460
  if (this._reserveTimer != null) {
10123
10461
  clearTimeout(this._reserveTimer);
10124
10462
  this._reserveTimer = null;
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * ApexCharts v7.2.0
2
+ * ApexCharts v7.4.0
3
3
  * (c) 2018-2026 ApexCharts
4
4
  */
5
5
  "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function t(t){if(t&&t.__esModule)return t;const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t)for(const o in t)if("default"!==o){const a=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,a.get?a:{enumerable:!0,get:()=>t[o]})}return e.default=t,Object.freeze(e)}const e=t(require("apexcharts/core")),o=e.__apex_Graphics,a=e.__apex_Utils,i=e.__apex_CoreUtils,n=e.__apex_Animations_applyProgressiveReveal;class s{constructor(t){this.w=t.w,this.annoCtx=t}setOrientations(t,e=null){var o,a;const i=this.w;if("vertical"===t.label.orientation){const n=null!==e?e:0,s=i.dom.baseEl.querySelector(`.apexcharts-xaxis-annotations .apexcharts-xaxis-annotation-label[rel='${n}']`);if(null!==s){const e=s.getBBox();s.setAttribute("x",String(parseFloat(null!=(o=s.getAttribute("x"))?o:"0")-e.height+4));const i="top"===t.label.position?e.width:-e.width;s.setAttribute("y",String(parseFloat(null!=(a=s.getAttribute("y"))?a:"0")+i));const{x:n,y:l}=this.annoCtx.graphics.rotateAroundCenter(s);s.setAttribute("transform",`rotate(-90 ${n} ${l})`)}}}addBackgroundToAnno(t,e){const o=this.w;if(!t||!e.label.text||!String(e.label.text).trim())return null;const a=o.dom.baseEl.querySelector(".apexcharts-grid");if(!a)return null;const i=a.getBoundingClientRect(),n=a.getBBox(),s=i.width/n.width||1,l=t.getBoundingClientRect();let{left:r,right:d,top:h,bottom:c}=e.label.style.padding;"vertical"===e.label.orientation&&([h,c,r,d]=[r,d,h,c]);const x=i.left-n.x*s,p=i.top-n.y*s,g=(l.left-x)/s-r,f=(l.top-p)/s-h,b=this.annoCtx.graphics.drawRect(g,f,l.width/s+r+d,l.height/s+h+c,e.label.borderRadius,e.label.style.background,1,e.label.borderWidth,e.label.borderColor,0);return e.id&&b.node.classList.add(e.id),b}annotationsBackground(){const t=this.w,e=(e,o,a)=>{const i=t.dom.baseEl.querySelector(`.apexcharts-${a}-annotations .apexcharts-${a}-annotation-label[rel='${o}']`);if(i){const o=i.parentNode,a=this.addBackgroundToAnno(i,e);if(a){null==o||o.insertBefore(a.node,i);const s=i.getAttribute("x");null!==s&&n(a,parseFloat(s),t),e.label.mouseEnter&&a.node.addEventListener("mouseenter",e.label.mouseEnter.bind(this,e)),e.label.mouseLeave&&a.node.addEventListener("mouseleave",e.label.mouseLeave.bind(this,e)),e.label.click&&a.node.addEventListener("click",e.label.click.bind(this,e))}}};t.config.annotations.xaxis.forEach((t,o)=>e(t,o,"xaxis")),t.config.annotations.yaxis.forEach((t,o)=>e(t,o,"yaxis")),t.config.annotations.points.forEach((t,o)=>e(t,o,"point"))}usesCategoryX(){const t=this.w;return("category"===t.config.xaxis.type||t.config.xaxis.convertedCatToNumeric)&&!this.annoCtx.invertAxis&&!t.axisFlags.dataFormatXNumeric&&!t.config.chart.sparkline.enabled}hasXDomain(){const t=this.w;return this.annoCtx.invertAxis?a.isNumber(t.globals.minY)&&a.isNumber(t.globals.yRange[0]):this.usesCategoryX()?t.labelData.labels.length>0||t.labelData.categoryLabels.length>0:a.isNumber(t.globals.minX)&&a.isNumber(t.globals.xRange)}getY1Y2(t,e){var o,a,n;const s=this.w,l="y1"===t?e.y:e.y2,r="string"==typeof l&&l.includes("px");let d,h=!1;if(this.annoCtx.invertAxis){const t=s.config.xaxis.convertedCatToNumeric?s.labelData.categoryLabels:s.labelData.labels,a=t.indexOf(l);if(!r&&-1===a)return{yP:0,clipped:!0};const i=s.dom.baseEl.querySelector(`.apexcharts-yaxis-texts-g text:nth-child(${a+1})`);d=i?parseFloat(null!=(o=i.getAttribute("y"))?o:"0"):(s.layout.gridHeight/t.length-1)*(a+1)-s.globals.barHeight,void 0!==e.seriesIndex&&s.globals.barHeight&&(d-=s.globals.barHeight/2*(s.seriesData.series.length-1)-s.globals.barHeight*e.seriesIndex)}else{if(!s.config.yaxis[e.yAxisIndex])return{yP:0,clipped:!0};const t=s.globals.seriesYAxisMap[e.yAxisIndex],o=null!=(a=null==t?void 0:t[0])?a:null;if(null===o&&s.seriesData.series.length)return{yP:0,clipped:!0};const r=null===o?s.globals.minY:s.globals.minYArr[o],c=null===o?s.globals.maxY-s.globals.minY:s.globals.yRange[o],x=s.config.yaxis[e.yAxisIndex].logarithmic&&null!==o?new i(this.w).getLogVal(s.config.yaxis[e.yAxisIndex].logBase,l,o)/s.globals.yLogRatio[o]:(l-r)/(c/s.layout.gridHeight);d=s.layout.gridHeight-Math.min(Math.max(x,0),s.layout.gridHeight),h=x>s.layout.gridHeight||x<0,!e.marker||void 0!==e.y&&null!==e.y||(d=0),(null==(n=s.config.yaxis[e.yAxisIndex])?void 0:n.reversed)&&(d=x)}return r&&(d=parseFloat(l)),{yP:d,clipped:h}}getX1X2(t,e){const o=this.w,a="x1"===t?e.x:e.x2,i=this.annoCtx.invertAxis?o.globals.minY:o.globals.minX,n=this.annoCtx.invertAxis?o.globals.maxY:o.globals.maxX,s=this.annoCtx.invertAxis?o.globals.yRange[0]:o.globals.xRange;let l=!1;const r="string"==typeof a&&a.includes("px"),d=null==a&&e.marker;if(!r&&!d&&!this.hasXDomain())return{x:0,clipped:!0};let h=this.annoCtx.inversedReversedAxis?(n-a)/(s/o.layout.gridWidth):(a-i)/(s/o.layout.gridWidth);return"category"!==o.config.xaxis.type&&!o.config.xaxis.convertedCatToNumeric||this.annoCtx.invertAxis||o.axisFlags.dataFormatXNumeric||o.config.chart.sparkline.enabled||(h=this.getStringX(a)),"string"==typeof a&&a.includes("px")&&(h=parseFloat(a)),null==a&&e.marker&&(h=o.layout.gridWidth),void 0!==e.seriesIndex&&o.globals.barWidth&&!this.annoCtx.invertAxis&&(h-=o.globals.barWidth/2*(o.seriesData.series.length-1)-o.globals.barWidth*e.seriesIndex),"number"!=typeof h&&(h=0,l=!0),parseFloat(h.toFixed(10))>parseFloat(o.layout.gridWidth.toFixed(10))?(h=o.layout.gridWidth,l=!0):h<0&&(h=0,l=!0),{x:h,clipped:l}}getStringX(t){var e;const o=this.w;let a=t;if(o.config.xaxis.convertedCatToNumeric&&o.labelData.categoryLabels.length){const e=String(t);t=o.labelData.categoryLabels.findIndex(t=>String(t)===e)+1}const i=o.labelData.labels.map(t=>Array.isArray(t)?t.join(" "):t).indexOf(t),n=o.dom.baseEl.querySelector(`.apexcharts-xaxis-texts-g text:nth-child(${i+1})`);return n&&(a=parseFloat(null!=(e=n.getAttribute("x"))?e:"0")),a}}class l{constructor(t){this.w=t.w,this.annoCtx=t,this.invertAxis=this.annoCtx.invertAxis,this.helpers=new s(this.annoCtx)}addXaxisAnnotation(t,e,o){const i=this.w,s=this.helpers.getX1X2("x1",t);let l=s.x;const r=s.clipped;let d,h=!0;const c=t.label.text,x=t.strokeDashArray;if(a.isNumber(l)){if(null===t.x2||void 0===t.x2){if(!r){const o=this.annoCtx.graphics.drawLine(l+t.offsetX,0+t.offsetY,l+t.offsetX,i.layout.gridHeight+t.offsetY,t.borderColor,x,t.borderWidth);e.appendChild(o.node),t.id&&o.node.classList.add(t.id),n(o,l+t.offsetX,i)}}else{const o=this.helpers.getX1X2("x2",t);if(d=o.x,h=o.clipped,d<l){const t=l;l=d,d=t}const a=this.annoCtx.graphics.drawRect(l+t.offsetX,0+t.offsetY,d-l,i.layout.gridHeight+t.offsetY,0,t.fillColor,t.opacity,1,t.borderColor,x);a.node.classList.add("apexcharts-annotation-rect"),a.attr("clip-path",`url(#gridRectMask${i.globals.cuid})`),e.appendChild(a.node),t.id&&a.node.classList.add(t.id),n(a,l+t.offsetX,i)}if(!r||!h){const a=this.annoCtx.graphics.getTextRects(c,t.label.style.fontSize),s="top"===t.label.position?4:"center"===t.label.position?i.layout.gridHeight/2+("vertical"===t.label.orientation?a.width/2:0):i.layout.gridHeight,r=this.annoCtx.graphics.drawText({x:l+t.label.offsetX,y:s+t.label.offsetY-("vertical"===t.label.orientation?"top"===t.label.position?a.width/2-12:-a.width/2:0),text:c,textAnchor:t.label.textAnchor,fontSize:t.label.style.fontSize,fontFamily:t.label.style.fontFamily,fontWeight:t.label.style.fontWeight,foreColor:t.label.style.color,cssClass:`apexcharts-xaxis-annotation-label ${t.label.style.cssClass} ${t.id?t.id:""}`});r.attr({rel:o}),e.appendChild(r.node),n(r,l+t.label.offsetX,i),this.annoCtx.helpers.setOrientations(t,o)}}}drawXAxisAnnotations(){const t=this.w,e=this.annoCtx.graphics.group({class:"apexcharts-xaxis-annotations"});return t.config.annotations.xaxis.map((t,o)=>{this.addXaxisAnnotation(t,e.node,o)}),e}}const r=e.__apex_axes_AxesUtils;class d{constructor(t){this.w=t.w,this.annoCtx=t,this.helpers=new s(this.annoCtx),this.axesUtils=new r(this.annoCtx.w,{theme:this.annoCtx.theme,timeScale:this.annoCtx.timeScale})}addYaxisAnnotation(t,e,o){const a=this.w,i=t.strokeDashArray;let n=this.helpers.getY1Y2("y1",t),s=n.yP;const l=n.clipped;let r,d=!0,h=!1;const c=t.label.text;if(null===t.y2||void 0===t.y2){if(!l){h=!0;const o=this.annoCtx.graphics.drawLine(0+t.offsetX,s+t.offsetY,this._getYAxisAnnotationWidth(t),s+t.offsetY,t.borderColor,i,t.borderWidth);e.appendChild(o.node),t.id&&o.node.classList.add(t.id)}}else{if(n=this.helpers.getY1Y2("y2",t),r=n.yP,d=n.clipped,r>s){const t=s;s=r,r=t}if(!l||!d){h=!0;const o=this.annoCtx.graphics.drawRect(0+t.offsetX,r+t.offsetY,this._getYAxisAnnotationWidth(t),s-r,0,t.fillColor,t.opacity,1,t.borderColor,i);o.node.classList.add("apexcharts-annotation-rect"),o.attr("clip-path",`url(#gridRectMask${a.globals.cuid})`),e.appendChild(o.node),t.id&&o.node.classList.add(t.id)}}if(h){const i="right"===t.label.position?a.layout.gridWidth:"center"===t.label.position?a.layout.gridWidth/2:0,n=this.annoCtx.graphics.drawText({x:i+t.label.offsetX,y:(null!=r?r:s)+t.label.offsetY-3,text:c,textAnchor:t.label.textAnchor,fontSize:t.label.style.fontSize,fontFamily:t.label.style.fontFamily,fontWeight:t.label.style.fontWeight,foreColor:t.label.style.color,cssClass:`apexcharts-yaxis-annotation-label ${t.label.style.cssClass} ${t.id?t.id:""}`});n.attr({rel:o}),e.appendChild(n.node)}}_getYAxisAnnotationWidth(t){const e=this.w;let o=e.layout.gridWidth;return o=t.width.indexOf("%")>-1?e.layout.gridWidth*parseInt(t.width,10)/100:parseInt(t.width,10),o+t.offsetX}drawYAxisAnnotations(){const t=this.w,e=this.annoCtx.graphics.group({class:"apexcharts-yaxis-annotations"});return t.config.annotations.yaxis.forEach((t,o)=>{t.yAxisIndex=this.axesUtils.translateYAxisIndex(t.yAxisIndex),this.axesUtils.isYAxisHidden(t.yAxisIndex)&&this.axesUtils.yAxisAllSeriesCollapsed(t.yAxisIndex)||this.addYaxisAnnotation(t,e.node,o)}),e}}const h=e.__apex_BrowserAPIs_BrowserAPIs;class c{constructor(t){this.w=t.w,this.annoCtx=t,this.helpers=new s(this.annoCtx)}addPointAnnotation(t,e,o){const i=this.w;if(i.globals.collapsedSeriesIndices.indexOf(t.seriesIndex)>-1)return;const s=this.helpers.getX1X2("x1",t),l=s.x,r=s.clipped,d=this.helpers.getY1Y2("y1",t),h=d.yP,c=d.clipped;if(a.isNumber(l)&&!c&&!r){const a={pSize:t.marker.size,pointStrokeWidth:t.marker.strokeWidth,pointFillColor:t.marker.fillColor,pointStrokeColor:t.marker.strokeColor,shape:t.marker.shape,pRadius:t.marker.radius,class:`apexcharts-point-annotation-marker ${t.marker.cssClass} ${t.id?t.id:""}`};let s=this.annoCtx.graphics.drawMarker(l+t.marker.offsetX,h+t.marker.offsetY,a);e.appendChild(s.node);const r=[s.node];n(s,l,i);const d=t.label.text?t.label.text:"",c=this.getConstrainedLabelX(d,l+t.label.offsetX,t.label),x=this.annoCtx.graphics.drawText({x:c,y:h+t.label.offsetY-t.marker.size-parseFloat(t.label.style.fontSize)/1.6,text:d,textAnchor:t.label.textAnchor,fontSize:t.label.style.fontSize,fontFamily:t.label.style.fontFamily,fontWeight:t.label.style.fontWeight,foreColor:t.label.style.color,cssClass:`apexcharts-point-annotation-label ${t.label.style.cssClass} ${t.id?t.id:""}`});if(x.attr({rel:o}),e.appendChild(x.node),n(x,l,i),t.customSVG.SVG){const o=this.annoCtx.graphics.group({class:"apexcharts-point-annotations-custom-svg "+t.customSVG.cssClass});o.attr({transform:`translate(${l+t.customSVG.offsetX}, ${h+t.customSVG.offsetY})`}),o.node.innerHTML=t.customSVG.SVG,e.appendChild(o.node),r.push(o.node)}if(t.image.path){const e=t.image.width?t.image.width:20,o=t.image.height?t.image.height:20;s=this.annoCtx.addImage({x:l+t.image.offsetX-e/2,y:h+t.image.offsetY-o/2,width:e,height:o,path:t.image.path,appendTo:".apexcharts-point-annotations"}),r.push(s.node)}t.tooltip&&t.tooltip.enabled&&r.forEach(e=>{e.addEventListener("mouseenter",()=>{this.showPointTooltip(t,e)}),e.addEventListener("mouseleave",()=>{this.hidePointTooltip()})}),t.mouseEnter&&s.node.addEventListener("mouseenter",t.mouseEnter.bind(this,t)),t.mouseLeave&&s.node.addEventListener("mouseleave",t.mouseLeave.bind(this,t)),t.click&&s.node.addEventListener("click",t.click.bind(this,t))}}getConstrainedLabelX(t,e,o){const a=this.w;if(!t)return e;const{width:i}=this.annoCtx.graphics.getTextRects(t,o.style.fontSize,o.style.fontFamily,void 0,!0,o.style.fontWeight);let n,s;switch(o.textAnchor){case"start":n=e,s=e+i;break;case"end":n=e-i,s=e;break;default:n=e-i/2,s=e+i/2}const l=o.style.padding||{};return n-=l.left||0,s+=l.right||0,n<0?e-n:s>a.layout.gridWidth?e-(s-a.layout.gridWidth):e}getPointTooltipEl(){const t=this.w;let e=t.dom.elWrap.querySelector(".apexcharts-annotation-tooltip");return e||(e=h.createElementNS("http://www.w3.org/1999/xhtml","div"),e.classList.add("apexcharts-tooltip","apexcharts-annotation-tooltip"),t.dom.elWrap.appendChild(e)),e}getPointTooltipContent(t){const e=this.w,o=t.tooltip||{};if("function"==typeof o.formatter)return o.formatter({annotation:t,seriesIndex:t.seriesIndex,id:t.id,w:e});let a=null!=o.text?o.text:t.label&&t.label.text;return Array.isArray(a)&&(a=a.join("<br/>")),null==a?"":String(a)}showPointTooltip(t,e){const o=this.w,a=this.getPointTooltipContent(t);if(!a)return;const i=this.getPointTooltipEl();i.innerHTML=a;const n=t.tooltip.theme||o.config.tooltip.theme||"light";i.classList.remove("apexcharts-theme-light","apexcharts-theme-dark"),i.classList.add(`apexcharts-theme-${n}`),i.classList.add("apexcharts-active");const s=o.dom.elWrap.getBoundingClientRect(),l=e.getBoundingClientRect(),r=i.getBoundingClientRect(),d=t.tooltip.offsetX||0,h=t.tooltip.offsetY||0;let c=l.left-s.left+l.width/2-r.width/2,x=l.top-s.top-r.height-10;c=Math.max(0,Math.min(c,s.width-r.width)),x<0&&(x=l.top-s.top+l.height+10),i.style.left=c+d+"px",i.style.top=x+h+"px"}hidePointTooltip(){const t=this.w.dom.elWrap.querySelector(".apexcharts-annotation-tooltip");t&&t.classList.remove("apexcharts-active")}drawPointAnnotations(){const t=this.w,e=this.annoCtx.graphics.group({class:"apexcharts-point-annotations"});return t.config.annotations.points.map((t,o)=>{this.addPointAnnotation(t,e.node,o)}),e}}const x=e.__apex_Options;e.default.registerFeatures({annotations:class{constructor(t,{theme:e=null,timeScale:a=null}={}){this.w=t,this.theme=e,this.timeScale=a,this.invertAxis=void 0,this.inversedReversedAxis=void 0,this.graphics=new o(this.w),this.w.globals.isBarHorizontal&&(this.invertAxis=!0),this.helpers=new s(this),this.xAxisAnnotations=new l(this),this.yAxisAnnotations=new d(this),this.pointsAnnotations=new c(this),this.w.globals.isBarHorizontal&&this.w.config.yaxis[0].reversed&&(this.inversedReversedAxis=!0),this.xDivision=this.w.layout.gridWidth/this.w.globals.dataPoints}drawAxesAnnotations(){const t=this.w;if(t.globals.axisCharts){const e=this.yAxisAnnotations.drawYAxisAnnotations(),o=this.xAxisAnnotations.drawXAxisAnnotations(),a=this.pointsAnnotations.drawPointAnnotations(),i=t.config.chart.animations.enabled,n=[e,o,a],s=[o.node,e.node,a.node],l="line"===t.config.chart.type||"area"===t.config.chart.type||"rangeArea"===t.config.chart.type,r=[l,!1,l];for(let e=0;e<3;e++)t.dom.elGraphical.add(n[e]),!i||t.globals.resized||t.globals.dataChanged||"scatter"!==t.config.chart.type&&"bubble"!==t.config.chart.type&&t.globals.dataPoints>1&&!r[e]&&s[e].classList.add("apexcharts-element-hidden"),t.globals.delayedElements.push({el:s[e],index:0});this.helpers.annotationsBackground()}}drawImageAnnos(){this.w.config.annotations.images.map(t=>{this.addImage(t)})}drawTextAnnos(){this.w.config.annotations.texts.map(t=>{this.addText(t)})}addXaxisAnnotation(t,e,o){this.xAxisAnnotations.addXaxisAnnotation(t,e,o)}addYaxisAnnotation(t,e,o){this.yAxisAnnotations.addYaxisAnnotation(t,e,o)}addPointAnnotation(t,e,o){this.pointsAnnotations.addPointAnnotation(t,e,o)}addText(t){const{x:e,y:o,text:a,textAnchor:i,foreColor:n,fontSize:s,fontFamily:l,fontWeight:r,cssClass:d,backgroundColor:h,borderWidth:c,strokeDashArray:x,borderRadius:p,borderColor:g,appendTo:f=".apexcharts-svg",paddingLeft:b=4,paddingRight:u=4,paddingBottom:y=2,paddingTop:m=2}=t,A=this.w,w=this.graphics.drawText({x:e,y:o,text:a,textAnchor:i||"start",fontSize:s||"12px",fontWeight:r||"regular",fontFamily:l||A.config.chart.fontFamily,foreColor:n||A.config.chart.foreColor,cssClass:d}),C=A.dom.baseEl.querySelector(f);C&&C.appendChild(w.node);const v=w.bbox();if(a){const t=this.graphics.drawRect(v.x-b,v.y-m,v.width+b+u,v.height+y+m,p,h||"transparent",1,c,g,x);C.insertBefore(t.node,w.node)}}addImage(t){const e=this.w,{path:o,x:a=0,y:i=0,width:n=20,height:s=20,appendTo:l=".apexcharts-svg"}=t,r=e.dom.Paper.image(o);r.size(n,s).move(a,i);const d=e.dom.baseEl.querySelector(l);return d&&d.appendChild(r.node),r}addXaxisAnnotationExternal(t,e,o){return this.addAnnotationExternal({params:t,pushToMemory:e,context:o,type:"xaxis",contextMethod:o.addXaxisAnnotation}),o}addYaxisAnnotationExternal(t,e,o){return this.addAnnotationExternal({params:t,pushToMemory:e,context:o,type:"yaxis",contextMethod:o.addYaxisAnnotation}),o}addPointAnnotationExternal(t,e,o){return void 0===this.invertAxis&&(this.invertAxis=o.w.globals.isBarHorizontal),this.addAnnotationExternal({params:t,pushToMemory:e,context:o,type:"point",contextMethod:o.addPointAnnotation}),o}addAnnotationExternal({params:t,pushToMemory:e,context:o,type:i,contextMethod:n}){const s=o,l=s.w,r=l.dom.baseEl.querySelector(`.apexcharts-${i}-annotations`),d=r.childNodes.length+1,h=new x,c=Object.assign({},"xaxis"===i?h.xAxisAnnotation:"yaxis"===i?h.yAxisAnnotation:h.pointAnnotation),p=a.extend(c,t);switch(i){case"xaxis":this.addXaxisAnnotation(p,r,d);break;case"yaxis":this.addYaxisAnnotation(p,r,d);break;case"point":this.addPointAnnotation(p,r,d)}const g=l.dom.baseEl.querySelector(`.apexcharts-${i}-annotations .apexcharts-${i}-annotation-label[rel='${d}']`),f=this.helpers.addBackgroundToAnno(g,p);return f&&r.insertBefore(f.node,g),e&&l.globals.memory.methodsToExec.push({context:s,id:p.id?p.id:a.randomId(),method:n,label:"addAnnotation",params:t}),o}_removeAnnotationTooltip(t){const e=t.dom.elWrap&&t.dom.elWrap.querySelector(".apexcharts-annotation-tooltip");e&&e.parentNode&&e.parentNode.removeChild(e)}clearAnnotations(t){const e=t.w;this._removeAnnotationTooltip(e);const o=e.dom.baseEl.querySelectorAll(".apexcharts-yaxis-annotations, .apexcharts-xaxis-annotations, .apexcharts-point-annotations");for(let t=e.globals.memory.methodsToExec.length-1;t>=0;t--)"addText"!==e.globals.memory.methodsToExec[t].label&&"addAnnotation"!==e.globals.memory.methodsToExec[t].label||e.globals.memory.methodsToExec.splice(t,1);Array.prototype.forEach.call(o,t=>{for(;t.firstChild;)t.removeChild(t.firstChild)})}removeAnnotation(t,e){const o=t.w;this._removeAnnotationTooltip(o);const a=o.dom.baseEl.querySelectorAll(`.${e}`);a&&(o.globals.memory.methodsToExec.map((t,a)=>{t.id===e&&o.globals.memory.methodsToExec.splice(a,1)}),Object.keys(o.config.annotations).forEach(t=>{const a=o.config.annotations[t];Array.isArray(a)&&(o.config.annotations[t]=a.filter(t=>t.id!==e))}),Array.prototype.forEach.call(a,t=>{t.parentElement.removeChild(t)}))}}}),Object.defineProperty(exports,"default",{enumerable:!0,get:()=>e.default});
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * ApexCharts v7.2.0
2
+ * ApexCharts v7.4.0
3
3
  * (c) 2018-2026 ApexCharts
4
4
  */
5
5
  import * as _core from "apexcharts/core";
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * ApexCharts v7.2.0
2
+ * ApexCharts v7.4.0
3
3
  * (c) 2018-2026 ApexCharts
4
4
  */
5
5
  !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ApexAnnotations={})}(this,function(t){"use strict";const e=globalThis.ApexCharts,o=globalThis.ApexCharts.__internals.__apex_Graphics,a=globalThis.ApexCharts.__internals.__apex_Utils,i=globalThis.ApexCharts.__internals.__apex_CoreUtils,n=globalThis.ApexCharts.__internals;n.__apex_Animations,n.__apex_Animations_computeStagger,n.__apex_Animations_applyAnimationPolicy,n.__apex_Animations_prefersReducedMotion;const s=n.__apex_Animations_applyProgressiveReveal;class l{constructor(t){this.w=t.w,this.annoCtx=t}setOrientations(t,e=null){var o,a;const i=this.w;if("vertical"===t.label.orientation){const n=null!==e?e:0,s=i.dom.baseEl.querySelector(`.apexcharts-xaxis-annotations .apexcharts-xaxis-annotation-label[rel='${n}']`);if(null!==s){const e=s.getBBox();s.setAttribute("x",String(parseFloat(null!=(o=s.getAttribute("x"))?o:"0")-e.height+4));const i="top"===t.label.position?e.width:-e.width;s.setAttribute("y",String(parseFloat(null!=(a=s.getAttribute("y"))?a:"0")+i));const{x:n,y:l}=this.annoCtx.graphics.rotateAroundCenter(s);s.setAttribute("transform",`rotate(-90 ${n} ${l})`)}}}addBackgroundToAnno(t,e){const o=this.w;if(!t||!e.label.text||!String(e.label.text).trim())return null;const a=o.dom.baseEl.querySelector(".apexcharts-grid");if(!a)return null;const i=a.getBoundingClientRect(),n=a.getBBox(),s=i.width/n.width||1,l=t.getBoundingClientRect();let{left:r,right:d,top:h,bottom:c}=e.label.style.padding;"vertical"===e.label.orientation&&([h,c,r,d]=[r,d,h,c]);const x=i.left-n.x*s,p=i.top-n.y*s,g=(l.left-x)/s-r,f=(l.top-p)/s-h,b=this.annoCtx.graphics.drawRect(g,f,l.width/s+r+d,l.height/s+h+c,e.label.borderRadius,e.label.style.background,1,e.label.borderWidth,e.label.borderColor,0);return e.id&&b.node.classList.add(e.id),b}annotationsBackground(){const t=this.w,e=(e,o,a)=>{const i=t.dom.baseEl.querySelector(`.apexcharts-${a}-annotations .apexcharts-${a}-annotation-label[rel='${o}']`);if(i){const o=i.parentNode,a=this.addBackgroundToAnno(i,e);if(a){null==o||o.insertBefore(a.node,i);const n=i.getAttribute("x");null!==n&&s(a,parseFloat(n),t),e.label.mouseEnter&&a.node.addEventListener("mouseenter",e.label.mouseEnter.bind(this,e)),e.label.mouseLeave&&a.node.addEventListener("mouseleave",e.label.mouseLeave.bind(this,e)),e.label.click&&a.node.addEventListener("click",e.label.click.bind(this,e))}}};t.config.annotations.xaxis.forEach((t,o)=>e(t,o,"xaxis")),t.config.annotations.yaxis.forEach((t,o)=>e(t,o,"yaxis")),t.config.annotations.points.forEach((t,o)=>e(t,o,"point"))}usesCategoryX(){const t=this.w;return("category"===t.config.xaxis.type||t.config.xaxis.convertedCatToNumeric)&&!this.annoCtx.invertAxis&&!t.axisFlags.dataFormatXNumeric&&!t.config.chart.sparkline.enabled}hasXDomain(){const t=this.w;return this.annoCtx.invertAxis?a.isNumber(t.globals.minY)&&a.isNumber(t.globals.yRange[0]):this.usesCategoryX()?t.labelData.labels.length>0||t.labelData.categoryLabels.length>0:a.isNumber(t.globals.minX)&&a.isNumber(t.globals.xRange)}getY1Y2(t,e){var o,a,n;const s=this.w,l="y1"===t?e.y:e.y2,r="string"==typeof l&&l.includes("px");let d,h=!1;if(this.annoCtx.invertAxis){const t=s.config.xaxis.convertedCatToNumeric?s.labelData.categoryLabels:s.labelData.labels,a=t.indexOf(l);if(!r&&-1===a)return{yP:0,clipped:!0};const i=s.dom.baseEl.querySelector(`.apexcharts-yaxis-texts-g text:nth-child(${a+1})`);d=i?parseFloat(null!=(o=i.getAttribute("y"))?o:"0"):(s.layout.gridHeight/t.length-1)*(a+1)-s.globals.barHeight,void 0!==e.seriesIndex&&s.globals.barHeight&&(d-=s.globals.barHeight/2*(s.seriesData.series.length-1)-s.globals.barHeight*e.seriesIndex)}else{if(!s.config.yaxis[e.yAxisIndex])return{yP:0,clipped:!0};const t=s.globals.seriesYAxisMap[e.yAxisIndex],o=null!=(a=null==t?void 0:t[0])?a:null;if(null===o&&s.seriesData.series.length)return{yP:0,clipped:!0};const r=null===o?s.globals.minY:s.globals.minYArr[o],c=null===o?s.globals.maxY-s.globals.minY:s.globals.yRange[o],x=s.config.yaxis[e.yAxisIndex].logarithmic&&null!==o?new i(this.w).getLogVal(s.config.yaxis[e.yAxisIndex].logBase,l,o)/s.globals.yLogRatio[o]:(l-r)/(c/s.layout.gridHeight);d=s.layout.gridHeight-Math.min(Math.max(x,0),s.layout.gridHeight),h=x>s.layout.gridHeight||x<0,!e.marker||void 0!==e.y&&null!==e.y||(d=0),(null==(n=s.config.yaxis[e.yAxisIndex])?void 0:n.reversed)&&(d=x)}return r&&(d=parseFloat(l)),{yP:d,clipped:h}}getX1X2(t,e){const o=this.w,a="x1"===t?e.x:e.x2,i=this.annoCtx.invertAxis?o.globals.minY:o.globals.minX,n=this.annoCtx.invertAxis?o.globals.maxY:o.globals.maxX,s=this.annoCtx.invertAxis?o.globals.yRange[0]:o.globals.xRange;let l=!1;const r="string"==typeof a&&a.includes("px"),d=null==a&&e.marker;if(!r&&!d&&!this.hasXDomain())return{x:0,clipped:!0};let h=this.annoCtx.inversedReversedAxis?(n-a)/(s/o.layout.gridWidth):(a-i)/(s/o.layout.gridWidth);return"category"!==o.config.xaxis.type&&!o.config.xaxis.convertedCatToNumeric||this.annoCtx.invertAxis||o.axisFlags.dataFormatXNumeric||o.config.chart.sparkline.enabled||(h=this.getStringX(a)),"string"==typeof a&&a.includes("px")&&(h=parseFloat(a)),null==a&&e.marker&&(h=o.layout.gridWidth),void 0!==e.seriesIndex&&o.globals.barWidth&&!this.annoCtx.invertAxis&&(h-=o.globals.barWidth/2*(o.seriesData.series.length-1)-o.globals.barWidth*e.seriesIndex),"number"!=typeof h&&(h=0,l=!0),parseFloat(h.toFixed(10))>parseFloat(o.layout.gridWidth.toFixed(10))?(h=o.layout.gridWidth,l=!0):h<0&&(h=0,l=!0),{x:h,clipped:l}}getStringX(t){var e;const o=this.w;let a=t;if(o.config.xaxis.convertedCatToNumeric&&o.labelData.categoryLabels.length){const e=String(t);t=o.labelData.categoryLabels.findIndex(t=>String(t)===e)+1}const i=o.labelData.labels.map(t=>Array.isArray(t)?t.join(" "):t).indexOf(t),n=o.dom.baseEl.querySelector(`.apexcharts-xaxis-texts-g text:nth-child(${i+1})`);return n&&(a=parseFloat(null!=(e=n.getAttribute("x"))?e:"0")),a}}class r{constructor(t){this.w=t.w,this.annoCtx=t,this.invertAxis=this.annoCtx.invertAxis,this.helpers=new l(this.annoCtx)}addXaxisAnnotation(t,e,o){const i=this.w,n=this.helpers.getX1X2("x1",t);let l=n.x;const r=n.clipped;let d,h=!0;const c=t.label.text,x=t.strokeDashArray;if(a.isNumber(l)){if(null===t.x2||void 0===t.x2){if(!r){const o=this.annoCtx.graphics.drawLine(l+t.offsetX,0+t.offsetY,l+t.offsetX,i.layout.gridHeight+t.offsetY,t.borderColor,x,t.borderWidth);e.appendChild(o.node),t.id&&o.node.classList.add(t.id),s(o,l+t.offsetX,i)}}else{const o=this.helpers.getX1X2("x2",t);if(d=o.x,h=o.clipped,d<l){const t=l;l=d,d=t}const a=this.annoCtx.graphics.drawRect(l+t.offsetX,0+t.offsetY,d-l,i.layout.gridHeight+t.offsetY,0,t.fillColor,t.opacity,1,t.borderColor,x);a.node.classList.add("apexcharts-annotation-rect"),a.attr("clip-path",`url(#gridRectMask${i.globals.cuid})`),e.appendChild(a.node),t.id&&a.node.classList.add(t.id),s(a,l+t.offsetX,i)}if(!r||!h){const a=this.annoCtx.graphics.getTextRects(c,t.label.style.fontSize),n="top"===t.label.position?4:"center"===t.label.position?i.layout.gridHeight/2+("vertical"===t.label.orientation?a.width/2:0):i.layout.gridHeight,r=this.annoCtx.graphics.drawText({x:l+t.label.offsetX,y:n+t.label.offsetY-("vertical"===t.label.orientation?"top"===t.label.position?a.width/2-12:-a.width/2:0),text:c,textAnchor:t.label.textAnchor,fontSize:t.label.style.fontSize,fontFamily:t.label.style.fontFamily,fontWeight:t.label.style.fontWeight,foreColor:t.label.style.color,cssClass:`apexcharts-xaxis-annotation-label ${t.label.style.cssClass} ${t.id?t.id:""}`});r.attr({rel:o}),e.appendChild(r.node),s(r,l+t.label.offsetX,i),this.annoCtx.helpers.setOrientations(t,o)}}}drawXAxisAnnotations(){const t=this.w,e=this.annoCtx.graphics.group({class:"apexcharts-xaxis-annotations"});return t.config.annotations.xaxis.map((t,o)=>{this.addXaxisAnnotation(t,e.node,o)}),e}}const d=globalThis.ApexCharts.__internals.__apex_axes_AxesUtils;class h{constructor(t){this.w=t.w,this.annoCtx=t,this.helpers=new l(this.annoCtx),this.axesUtils=new d(this.annoCtx.w,{theme:this.annoCtx.theme,timeScale:this.annoCtx.timeScale})}addYaxisAnnotation(t,e,o){const a=this.w,i=t.strokeDashArray;let n=this.helpers.getY1Y2("y1",t),s=n.yP;const l=n.clipped;let r,d=!0,h=!1;const c=t.label.text;if(null===t.y2||void 0===t.y2){if(!l){h=!0;const o=this.annoCtx.graphics.drawLine(0+t.offsetX,s+t.offsetY,this._getYAxisAnnotationWidth(t),s+t.offsetY,t.borderColor,i,t.borderWidth);e.appendChild(o.node),t.id&&o.node.classList.add(t.id)}}else{if(n=this.helpers.getY1Y2("y2",t),r=n.yP,d=n.clipped,r>s){const t=s;s=r,r=t}if(!l||!d){h=!0;const o=this.annoCtx.graphics.drawRect(0+t.offsetX,r+t.offsetY,this._getYAxisAnnotationWidth(t),s-r,0,t.fillColor,t.opacity,1,t.borderColor,i);o.node.classList.add("apexcharts-annotation-rect"),o.attr("clip-path",`url(#gridRectMask${a.globals.cuid})`),e.appendChild(o.node),t.id&&o.node.classList.add(t.id)}}if(h){const i="right"===t.label.position?a.layout.gridWidth:"center"===t.label.position?a.layout.gridWidth/2:0,n=this.annoCtx.graphics.drawText({x:i+t.label.offsetX,y:(null!=r?r:s)+t.label.offsetY-3,text:c,textAnchor:t.label.textAnchor,fontSize:t.label.style.fontSize,fontFamily:t.label.style.fontFamily,fontWeight:t.label.style.fontWeight,foreColor:t.label.style.color,cssClass:`apexcharts-yaxis-annotation-label ${t.label.style.cssClass} ${t.id?t.id:""}`});n.attr({rel:o}),e.appendChild(n.node)}}_getYAxisAnnotationWidth(t){const e=this.w;let o=e.layout.gridWidth;return o=t.width.indexOf("%")>-1?e.layout.gridWidth*parseInt(t.width,10)/100:parseInt(t.width,10),o+t.offsetX}drawYAxisAnnotations(){const t=this.w,e=this.annoCtx.graphics.group({class:"apexcharts-yaxis-annotations"});return t.config.annotations.yaxis.forEach((t,o)=>{t.yAxisIndex=this.axesUtils.translateYAxisIndex(t.yAxisIndex),this.axesUtils.isYAxisHidden(t.yAxisIndex)&&this.axesUtils.yAxisAllSeriesCollapsed(t.yAxisIndex)||this.addYaxisAnnotation(t,e.node,o)}),e}}const c=globalThis.ApexCharts.__internals.__apex_BrowserAPIs_BrowserAPIs;class x{constructor(t){this.w=t.w,this.annoCtx=t,this.helpers=new l(this.annoCtx)}addPointAnnotation(t,e,o){const i=this.w;if(i.globals.collapsedSeriesIndices.indexOf(t.seriesIndex)>-1)return;const n=this.helpers.getX1X2("x1",t),l=n.x,r=n.clipped,d=this.helpers.getY1Y2("y1",t),h=d.yP,c=d.clipped;if(a.isNumber(l)&&!c&&!r){const a={pSize:t.marker.size,pointStrokeWidth:t.marker.strokeWidth,pointFillColor:t.marker.fillColor,pointStrokeColor:t.marker.strokeColor,shape:t.marker.shape,pRadius:t.marker.radius,class:`apexcharts-point-annotation-marker ${t.marker.cssClass} ${t.id?t.id:""}`};let n=this.annoCtx.graphics.drawMarker(l+t.marker.offsetX,h+t.marker.offsetY,a);e.appendChild(n.node);const r=[n.node];s(n,l,i);const d=t.label.text?t.label.text:"",c=this.getConstrainedLabelX(d,l+t.label.offsetX,t.label),x=this.annoCtx.graphics.drawText({x:c,y:h+t.label.offsetY-t.marker.size-parseFloat(t.label.style.fontSize)/1.6,text:d,textAnchor:t.label.textAnchor,fontSize:t.label.style.fontSize,fontFamily:t.label.style.fontFamily,fontWeight:t.label.style.fontWeight,foreColor:t.label.style.color,cssClass:`apexcharts-point-annotation-label ${t.label.style.cssClass} ${t.id?t.id:""}`});if(x.attr({rel:o}),e.appendChild(x.node),s(x,l,i),t.customSVG.SVG){const o=this.annoCtx.graphics.group({class:"apexcharts-point-annotations-custom-svg "+t.customSVG.cssClass});o.attr({transform:`translate(${l+t.customSVG.offsetX}, ${h+t.customSVG.offsetY})`}),o.node.innerHTML=t.customSVG.SVG,e.appendChild(o.node),r.push(o.node)}if(t.image.path){const e=t.image.width?t.image.width:20,o=t.image.height?t.image.height:20;n=this.annoCtx.addImage({x:l+t.image.offsetX-e/2,y:h+t.image.offsetY-o/2,width:e,height:o,path:t.image.path,appendTo:".apexcharts-point-annotations"}),r.push(n.node)}t.tooltip&&t.tooltip.enabled&&r.forEach(e=>{e.addEventListener("mouseenter",()=>{this.showPointTooltip(t,e)}),e.addEventListener("mouseleave",()=>{this.hidePointTooltip()})}),t.mouseEnter&&n.node.addEventListener("mouseenter",t.mouseEnter.bind(this,t)),t.mouseLeave&&n.node.addEventListener("mouseleave",t.mouseLeave.bind(this,t)),t.click&&n.node.addEventListener("click",t.click.bind(this,t))}}getConstrainedLabelX(t,e,o){const a=this.w;if(!t)return e;const{width:i}=this.annoCtx.graphics.getTextRects(t,o.style.fontSize,o.style.fontFamily,void 0,!0,o.style.fontWeight);let n,s;switch(o.textAnchor){case"start":n=e,s=e+i;break;case"end":n=e-i,s=e;break;default:n=e-i/2,s=e+i/2}const l=o.style.padding||{};return n-=l.left||0,s+=l.right||0,n<0?e-n:s>a.layout.gridWidth?e-(s-a.layout.gridWidth):e}getPointTooltipEl(){const t=this.w;let e=t.dom.elWrap.querySelector(".apexcharts-annotation-tooltip");return e||(e=c.createElementNS("http://www.w3.org/1999/xhtml","div"),e.classList.add("apexcharts-tooltip","apexcharts-annotation-tooltip"),t.dom.elWrap.appendChild(e)),e}getPointTooltipContent(t){const e=this.w,o=t.tooltip||{};if("function"==typeof o.formatter)return o.formatter({annotation:t,seriesIndex:t.seriesIndex,id:t.id,w:e});let a=null!=o.text?o.text:t.label&&t.label.text;return Array.isArray(a)&&(a=a.join("<br/>")),null==a?"":String(a)}showPointTooltip(t,e){const o=this.w,a=this.getPointTooltipContent(t);if(!a)return;const i=this.getPointTooltipEl();i.innerHTML=a;const n=t.tooltip.theme||o.config.tooltip.theme||"light";i.classList.remove("apexcharts-theme-light","apexcharts-theme-dark"),i.classList.add(`apexcharts-theme-${n}`),i.classList.add("apexcharts-active");const s=o.dom.elWrap.getBoundingClientRect(),l=e.getBoundingClientRect(),r=i.getBoundingClientRect(),d=t.tooltip.offsetX||0,h=t.tooltip.offsetY||0;let c=l.left-s.left+l.width/2-r.width/2,x=l.top-s.top-r.height-10;c=Math.max(0,Math.min(c,s.width-r.width)),x<0&&(x=l.top-s.top+l.height+10),i.style.left=c+d+"px",i.style.top=x+h+"px"}hidePointTooltip(){const t=this.w.dom.elWrap.querySelector(".apexcharts-annotation-tooltip");t&&t.classList.remove("apexcharts-active")}drawPointAnnotations(){const t=this.w,e=this.annoCtx.graphics.group({class:"apexcharts-point-annotations"});return t.config.annotations.points.map((t,o)=>{this.addPointAnnotation(t,e.node,o)}),e}}const p=globalThis.ApexCharts.__internals.__apex_Options;e.registerFeatures({annotations:class{constructor(t,{theme:e=null,timeScale:a=null}={}){this.w=t,this.theme=e,this.timeScale=a,this.invertAxis=void 0,this.inversedReversedAxis=void 0,this.graphics=new o(this.w),this.w.globals.isBarHorizontal&&(this.invertAxis=!0),this.helpers=new l(this),this.xAxisAnnotations=new r(this),this.yAxisAnnotations=new h(this),this.pointsAnnotations=new x(this),this.w.globals.isBarHorizontal&&this.w.config.yaxis[0].reversed&&(this.inversedReversedAxis=!0),this.xDivision=this.w.layout.gridWidth/this.w.globals.dataPoints}drawAxesAnnotations(){const t=this.w;if(t.globals.axisCharts){const e=this.yAxisAnnotations.drawYAxisAnnotations(),o=this.xAxisAnnotations.drawXAxisAnnotations(),a=this.pointsAnnotations.drawPointAnnotations(),i=t.config.chart.animations.enabled,n=[e,o,a],s=[o.node,e.node,a.node],l="line"===t.config.chart.type||"area"===t.config.chart.type||"rangeArea"===t.config.chart.type,r=[l,!1,l];for(let e=0;e<3;e++)t.dom.elGraphical.add(n[e]),!i||t.globals.resized||t.globals.dataChanged||"scatter"!==t.config.chart.type&&"bubble"!==t.config.chart.type&&t.globals.dataPoints>1&&!r[e]&&s[e].classList.add("apexcharts-element-hidden"),t.globals.delayedElements.push({el:s[e],index:0});this.helpers.annotationsBackground()}}drawImageAnnos(){this.w.config.annotations.images.map(t=>{this.addImage(t)})}drawTextAnnos(){this.w.config.annotations.texts.map(t=>{this.addText(t)})}addXaxisAnnotation(t,e,o){this.xAxisAnnotations.addXaxisAnnotation(t,e,o)}addYaxisAnnotation(t,e,o){this.yAxisAnnotations.addYaxisAnnotation(t,e,o)}addPointAnnotation(t,e,o){this.pointsAnnotations.addPointAnnotation(t,e,o)}addText(t){const{x:e,y:o,text:a,textAnchor:i,foreColor:n,fontSize:s,fontFamily:l,fontWeight:r,cssClass:d,backgroundColor:h,borderWidth:c,strokeDashArray:x,borderRadius:p,borderColor:g,appendTo:f=".apexcharts-svg",paddingLeft:b=4,paddingRight:u=4,paddingBottom:m=2,paddingTop:y=2}=t,A=this.w,C=this.graphics.drawText({x:e,y:o,text:a,textAnchor:i||"start",fontSize:s||"12px",fontWeight:r||"regular",fontFamily:l||A.config.chart.fontFamily,foreColor:n||A.config.chart.foreColor,cssClass:d}),w=A.dom.baseEl.querySelector(f);w&&w.appendChild(C.node);const v=C.bbox();if(a){const t=this.graphics.drawRect(v.x-b,v.y-y,v.width+b+u,v.height+m+y,p,h||"transparent",1,c,g,x);w.insertBefore(t.node,C.node)}}addImage(t){const e=this.w,{path:o,x:a=0,y:i=0,width:n=20,height:s=20,appendTo:l=".apexcharts-svg"}=t,r=e.dom.Paper.image(o);r.size(n,s).move(a,i);const d=e.dom.baseEl.querySelector(l);return d&&d.appendChild(r.node),r}addXaxisAnnotationExternal(t,e,o){return this.addAnnotationExternal({params:t,pushToMemory:e,context:o,type:"xaxis",contextMethod:o.addXaxisAnnotation}),o}addYaxisAnnotationExternal(t,e,o){return this.addAnnotationExternal({params:t,pushToMemory:e,context:o,type:"yaxis",contextMethod:o.addYaxisAnnotation}),o}addPointAnnotationExternal(t,e,o){return void 0===this.invertAxis&&(this.invertAxis=o.w.globals.isBarHorizontal),this.addAnnotationExternal({params:t,pushToMemory:e,context:o,type:"point",contextMethod:o.addPointAnnotation}),o}addAnnotationExternal({params:t,pushToMemory:e,context:o,type:i,contextMethod:n}){const s=o,l=s.w,r=l.dom.baseEl.querySelector(`.apexcharts-${i}-annotations`),d=r.childNodes.length+1,h=new p,c=Object.assign({},"xaxis"===i?h.xAxisAnnotation:"yaxis"===i?h.yAxisAnnotation:h.pointAnnotation),x=a.extend(c,t);switch(i){case"xaxis":this.addXaxisAnnotation(x,r,d);break;case"yaxis":this.addYaxisAnnotation(x,r,d);break;case"point":this.addPointAnnotation(x,r,d)}const g=l.dom.baseEl.querySelector(`.apexcharts-${i}-annotations .apexcharts-${i}-annotation-label[rel='${d}']`),f=this.helpers.addBackgroundToAnno(g,x);return f&&r.insertBefore(f.node,g),e&&l.globals.memory.methodsToExec.push({context:s,id:x.id?x.id:a.randomId(),method:n,label:"addAnnotation",params:t}),o}_removeAnnotationTooltip(t){const e=t.dom.elWrap&&t.dom.elWrap.querySelector(".apexcharts-annotation-tooltip");e&&e.parentNode&&e.parentNode.removeChild(e)}clearAnnotations(t){const e=t.w;this._removeAnnotationTooltip(e);const o=e.dom.baseEl.querySelectorAll(".apexcharts-yaxis-annotations, .apexcharts-xaxis-annotations, .apexcharts-point-annotations");for(let t=e.globals.memory.methodsToExec.length-1;t>=0;t--)"addText"!==e.globals.memory.methodsToExec[t].label&&"addAnnotation"!==e.globals.memory.methodsToExec[t].label||e.globals.memory.methodsToExec.splice(t,1);Array.prototype.forEach.call(o,t=>{for(;t.firstChild;)t.removeChild(t.firstChild)})}removeAnnotation(t,e){const o=t.w;this._removeAnnotationTooltip(o);const a=o.dom.baseEl.querySelectorAll(`.${e}`);a&&(o.globals.memory.methodsToExec.map((t,a)=>{t.id===e&&o.globals.memory.methodsToExec.splice(a,1)}),Object.keys(o.config.annotations).forEach(t=>{const a=o.config.annotations[t];Array.isArray(a)&&(o.config.annotations[t]=a.filter(t=>t.id!==e))}),Array.prototype.forEach.call(a,t=>{t.parentElement.removeChild(t)}))}}}),t.default=e,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});