var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var parse_bubble_data_to_geo_json_exports = {};
__export(parse_bubble_data_to_geo_json_exports, {
  parseBubbleDataToGeoJSON: () => parseBubbleDataToGeoJSON
});
module.exports = __toCommonJS(parse_bubble_data_to_geo_json_exports);
var import_charts = require("@dynatrace/strato-components-preview/charts");
var import_define_radius = require("./define-radius.js");
var import_calculate_hovered_color = require("../../../functions/calculate-hovered-color.js");
var import_define_color = require("../../../functions/define-color.js");
const parseBubbleDataToGeoJSON = (data, color, radius, scale) => {
  return {
    type: "FeatureCollection",
    features: data.map((feature) => {
      const { longitude, latitude, ...properties } = feature;
      const canvasColor = (0, import_charts._getCanvasColor)((0, import_define_color.defineColor)(color, feature));
      const hoveredColor = (0, import_calculate_hovered_color.calculateHoveredColor)(canvasColor);
      const scaledRadius = scale((0, import_define_radius.defineRadius)(radius, feature));
      return {
        type: "Feature",
        properties: {
          data: feature,
          ...properties,
          __color: canvasColor,
          __hoveredColor: hoveredColor,
          __radius: scaledRadius,
          __lat: latitude
        },
        geometry: { type: "Point", coordinates: [longitude, latitude] }
      };
    })
  };
};
