import { jsx as o } from "react/jsx-runtime";
/* empty css                      */
import { useGoogleMapApiLoader as h } from "./index-use-google-map-api-loader.js";
import { GoogleMap as L } from "./index-esm.js";
import { googleMapBlackWhiteTheme_NoPoi as M, googleMapBlackWhiteTheme as I } from "./index-GoogleMapBlackWhiteTheme.js";
import { googleMapColouredTheme as A } from "./index-GoogleMapColouredTheme.js";
import { Render as x } from "./index-Render.js";
import { useState as y } from "react";
import { ComponentContainer as C } from "./index-ComponentContainer.js";
import { MapContext as T } from "./index-map-context.js";
const b = "fb831772aadb7781", D = (t) => {
  const {
    apiKey: s,
    isJsApiLoaded: n,
    theme: d = "default",
    testId: l = "presence-insights-competitors-map-google-itself-textid",
    onLoad: i,
    mapId: e,
    children: p
  } = t, [r, m] = y(null), {
    isLoaded: c
  } = h([], s), u = n !== void 0 ? n : c, f = (a) => {
    m(a), i && i(a);
  };
  function g() {
    if (e)
      return null;
    switch (d) {
      case "coloured":
        return A;
      case "blackWhite":
        return I;
      case "blackWhiteNoPoi":
        return M;
      case "default":
      default:
        return null;
    }
  }
  return o(C, {
    "data-testid": l,
    className: "GoogleMaps-container",
    children: o(x, {
      if: u,
      children: o(L, {
        ...t,
        onLoad: f,
        mapContainerStyle: {
          width: "100%",
          height: "100%"
        },
        options: {
          gestureHandling: "greedy",
          ...t.options,
          styles: g(),
          mapId: typeof e == "string" ? e : e === !0 ? b : void 0
        },
        children: r !== null ? o(T.Provider, {
          value: r,
          children: p
        }) : null
      })
    })
  });
};
export {
  D as GoogleMaps
};
