import { useState as c, useRef as m, useEffect as p } from "react";
import { useMapContext as L } from "../../../MapContext.js";
const g = (o) => {
  const { id: r, createLayer: s } = o, [u, f] = c([]);
  m([]);
  const { api: e, enableWebGL: t, language: n, baseLayer: y } = L(), l = e.map?.getLayers();
  return console.log({ mapLayers: l?.asArray() }), p(() => {
    const a = s(e, t, y, n);
    return a && (console.log(`add layer - ${r}`), e.map?.addLayer(a)), () => {
      a && (e.map?.removeLayer(a), a.dispose(), console.log(`remove layer - ${r}`));
    };
  }, [e.map]), null;
};
export {
  g as default
};
//# sourceMappingURL=Layer.js.map
