import { isEmpty } from "lodash-es";
import React from "react";
import { ColorScaleContext } from "../contexts/color-scale.context.js";
import { buildScaleFromLegendConfig } from "../functions/build-scale-from-legend-config.js";
import { useMapConfig } from "../hooks/use-map-config.js";
const ColorScaleProvider = ({ children }) => {
  const { legend } = useMapConfig();
  if (isEmpty(legend)) {
    return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
  }
  const scale = buildScaleFromLegendConfig(legend);
  return /* @__PURE__ */ React.createElement(ColorScaleContext.Provider, { value: scale }, children);
};
export {
  ColorScaleProvider
};
//# sourceMappingURL=color-scale.provider.js.map
