"use client";
import { noInteraction as o } from "../../tooltipSlice.js";
function u(e, r) {
  var n = Object.keys(e);
  if (Object.getOwnPropertySymbols) {
    var t = Object.getOwnPropertySymbols(e);
    r && (t = t.filter(function(i) {
      return Object.getOwnPropertyDescriptor(e, i).enumerable;
    })), n.push.apply(n, t);
  }
  return n;
}
function c(e) {
  for (var r = 1; r < arguments.length; r++) {
    var n = arguments[r] != null ? arguments[r] : {};
    r % 2 ? u(Object(n), !0).forEach(function(t) {
      f(e, t, n[t]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : u(Object(n)).forEach(function(t) {
      Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
    });
  }
  return e;
}
function f(e, r, n) {
  return (r = s(r)) in e ? Object.defineProperty(e, r, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = n, e;
}
function s(e) {
  var r = y(e, "string");
  return typeof r == "symbol" ? r : r + "";
}
function y(e, r) {
  if (typeof e != "object" || !e) return e;
  var n = e[Symbol.toPrimitive];
  if (n !== void 0) {
    var t = n.call(e, r);
    if (typeof t != "object") return t;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return (r === "string" ? String : Number)(e);
}
function b(e, r, n) {
  return r === "axis" ? n === "click" ? e.axisInteraction.click : e.axisInteraction.hover : n === "click" ? e.itemInteraction.click : e.itemInteraction.hover;
}
function v(e) {
  return e.index != null;
}
var p = (e, r, n, t) => {
  if (r == null)
    return o;
  var i = b(e, r, n);
  if (i == null)
    return o;
  if (i.active)
    return i;
  if (e.keyboardInteraction.active)
    return e.keyboardInteraction;
  if (e.syncInteraction.active && e.syncInteraction.index != null)
    return e.syncInteraction;
  var a = e.settings.active === !0;
  if (v(i)) {
    if (a)
      return c(c({}, i), {}, {
        active: !0
      });
  } else if (t != null)
    return {
      active: !0,
      coordinate: void 0,
      dataKey: void 0,
      index: t
    };
  return c(c({}, o), {}, {
    coordinate: i.coordinate
  });
};
export {
  p as combineTooltipInteractionState
};
