"use client";
import { createSlice as o } from "../../../@reduxjs/toolkit/dist/redux-toolkit.modern.js";
import { current as c, castDraft as n } from "../../../immer/dist/immer.js";
var t = {
  active: !1,
  index: null,
  dataKey: void 0,
  coordinate: void 0
}, r = {
  itemInteraction: {
    click: t,
    hover: t
  },
  axisInteraction: {
    click: t,
    hover: t
  },
  keyboardInteraction: t,
  syncInteraction: {
    active: !1,
    index: null,
    dataKey: void 0,
    label: void 0,
    coordinate: void 0
  },
  tooltipItemPayloads: [],
  settings: {
    shared: void 0,
    trigger: "hover",
    axisId: 0,
    active: !1,
    defaultIndex: void 0
  }
}, d = o({
  name: "tooltip",
  initialState: r,
  reducers: {
    addTooltipEntrySettings(e, a) {
      e.tooltipItemPayloads.push(n(a.payload));
    },
    removeTooltipEntrySettings(e, a) {
      var i = c(e).tooltipItemPayloads.indexOf(n(a.payload));
      i > -1 && e.tooltipItemPayloads.splice(i, 1);
    },
    setTooltipSettingsState(e, a) {
      e.settings = a.payload;
    },
    setActiveMouseOverItemIndex(e, a) {
      e.syncInteraction.active = !1, e.keyboardInteraction.active = !1, e.itemInteraction.hover.active = !0, e.itemInteraction.hover.index = a.payload.activeIndex, e.itemInteraction.hover.dataKey = a.payload.activeDataKey, e.itemInteraction.hover.coordinate = a.payload.activeCoordinate;
    },
    mouseLeaveChart(e) {
      e.itemInteraction.hover.active = !1, e.axisInteraction.hover.active = !1;
    },
    mouseLeaveItem(e) {
      e.itemInteraction.hover.active = !1;
    },
    setActiveClickItemIndex(e, a) {
      e.syncInteraction.active = !1, e.itemInteraction.click.active = !0, e.keyboardInteraction.active = !1, e.itemInteraction.click.index = a.payload.activeIndex, e.itemInteraction.click.dataKey = a.payload.activeDataKey, e.itemInteraction.click.coordinate = a.payload.activeCoordinate;
    },
    setMouseOverAxisIndex(e, a) {
      e.syncInteraction.active = !1, e.axisInteraction.hover.active = !0, e.keyboardInteraction.active = !1, e.axisInteraction.hover.index = a.payload.activeIndex, e.axisInteraction.hover.dataKey = a.payload.activeDataKey, e.axisInteraction.hover.coordinate = a.payload.activeCoordinate;
    },
    setMouseClickAxisIndex(e, a) {
      e.syncInteraction.active = !1, e.keyboardInteraction.active = !1, e.axisInteraction.click.active = !0, e.axisInteraction.click.index = a.payload.activeIndex, e.axisInteraction.click.dataKey = a.payload.activeDataKey, e.axisInteraction.click.coordinate = a.payload.activeCoordinate;
    },
    setSyncInteraction(e, a) {
      e.syncInteraction = a.payload;
    },
    setKeyboardInteraction(e, a) {
      e.keyboardInteraction.active = a.payload.active, e.keyboardInteraction.index = a.payload.activeIndex, e.keyboardInteraction.coordinate = a.payload.activeCoordinate, e.keyboardInteraction.dataKey = a.payload.activeDataKey;
    }
  }
}), {
  addTooltipEntrySettings: I,
  removeTooltipEntrySettings: y,
  setTooltipSettingsState: s,
  setActiveMouseOverItemIndex: x,
  mouseLeaveItem: p,
  mouseLeaveChart: m,
  setActiveClickItemIndex: u,
  setMouseOverAxisIndex: f,
  setMouseClickAxisIndex: k,
  setSyncInteraction: h,
  setKeyboardInteraction: K
} = d.actions;
export {
  I as addTooltipEntrySettings,
  r as initialState,
  m as mouseLeaveChart,
  p as mouseLeaveItem,
  t as noInteraction,
  y as removeTooltipEntrySettings,
  u as setActiveClickItemIndex,
  x as setActiveMouseOverItemIndex,
  K as setKeyboardInteraction,
  k as setMouseClickAxisIndex,
  f as setMouseOverAxisIndex,
  h as setSyncInteraction,
  s as setTooltipSettingsState
};
