import { APIKEYS as u } from "./index-apiKeys.js";
import { useJsApiLoader as g } from "./index-esm.js";
import { useState as d, useEffect as a, useRef as c } from "react";
const L = (o, t = u.googleMapsApiKey, p) => {
  const [r, s] = d(!1), [n, f] = d(void 0);
  a(() => {
    typeof window < "u" && window.google && s(!0);
  }, []), o = ["places", "marker"];
  const l = c(o), {
    isLoaded: i,
    loadError: e
  } = g({
    id: "google-map-script",
    googleMapsApiKey: t,
    language: p,
    libraries: l.current
  });
  return a(() => {
    !r && e && f(e), s(i);
  }, [i, e]), {
    isLoaded: r,
    loadError: n
  };
};
export {
  L as useGoogleMapApiLoader
};
