var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var DefaultTooltip_exports = {};
__export(DefaultTooltip_exports, {
  DefaultTooltip: () => DefaultTooltip
});
module.exports = __toCommonJS(DefaultTooltip_exports);
var import_react = __toESM(require("react"));
var import_charts = require("@dynatrace/strato-components-preview/charts");
var import_get_default_actions = require("./utils/get-default-actions.js");
var import_handle_copy_to_clipboard = require("./utils/handle-copy-to-clipboard.js");
var import_tooltip_type_guards = require("../../functions/tooltip-type-guards.js");
const DefaultTooltip = (props) => {
  const { closestPoint, layerData } = props;
  let locations;
  if ((0, import_tooltip_type_guards.isRegion)(closestPoint)) {
    return /* @__PURE__ */ import_react.default.createElement(import_charts._ChartTooltip.Body, { "data-testid": "default-tooltip-template" }, /* @__PURE__ */ import_react.default.createElement(
      import_charts._ChartTooltip.SeriesItem,
      {
        color: closestPoint.color,
        name: closestPoint.name,
        value: closestPoint.data.value && closestPoint.data.value.toString() ? closestPoint.data.value.toString() : void 0
      }
    ));
  }
  if ((0, import_tooltip_type_guards.isConnection)(closestPoint)) {
    locations = closestPoint.data.path;
  } else {
    locations = layerData === void 0 || layerData === null || layerData.length === 0 ? [closestPoint.data] : layerData.map(
      (point) => point.data
    );
  }
  return /* @__PURE__ */ import_react.default.createElement(
    import_charts._ChartTooltip.Body,
    {
      "data-testid": "default-tooltip-template",
      virtualization: false
    },
    locations.map((location) => /* @__PURE__ */ import_react.default.createElement(
      import_charts._ChartTooltip.GeoItem,
      {
        key: `${location.latitude}-${location.longitude}`,
        latitude: location.latitude,
        longitude: location.longitude,
        actions: () => (0, import_get_default_actions.getDefaultActions)(() => (0, import_handle_copy_to_clipboard.handleCopyToClipboard)(location))
      }
    ))
  );
};
DefaultTooltip["displayName"] = "DefaultTooltip";
