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 BackgroundLayer_exports = {};
__export(BackgroundLayer_exports, {
  BackgroundLayer: () => BackgroundLayer
});
module.exports = __toCommonJS(BackgroundLayer_exports);
var import_react = __toESM(require("react"));
var import_react_map_gl = require("react-map-gl");
var import_calculate_circle_translate = require("./functions/calculate-circle-translate.js");
var import_resolve_icon_background = require("./functions/resolve-icon-background.js");
var import_constants = require("../../constants.js");
var import_calculate_hovered_color = require("../../functions/calculate-hovered-color.js");
const BackgroundLayer = (props) => {
  const { background, beforeId, source, radius, iconAnchor } = props;
  const iconBackground = (0, import_resolve_icon_background.resolveIconBackground)(background);
  const hoveredColor = (0, import_calculate_hovered_color.calculateHoveredColor)(iconBackground.color);
  const circleTranslate = (0, import_calculate_circle_translate.calculateCircleTranslate)(iconAnchor, radius);
  return /* @__PURE__ */ import_react.default.createElement(
    import_react_map_gl.Layer,
    {
      type: "circle",
      beforeId,
      source,
      paint: {
        "circle-color": [
          "case",
          ["boolean", ["feature-state", "hover"], false],
          hoveredColor,
          iconBackground.color
        ],
        "circle-radius": radius,
        "circle-opacity": [
          "case",
          ["boolean", iconBackground.enabled, false],
          import_constants.ICON_BACKGROUND_OPACITY,
          ["boolean", ["feature-state", "hover"], false],
          import_constants.ICON_BACKGROUND_OPACITY,
          0
        ],
        "circle-stroke-width": [
          "case",
          ["boolean", ["feature-state", "active"], false],
          import_constants.BUBBLE_OUTLINE_STROKE,
          0
        ],
        "circle-translate": circleTranslate
      }
    }
  );
};
