import { useContext } from "react";
import { MapStore } from "./map-store.context.js";
const useSetState = () => {
  const { setState } = useContext(MapStore);
  return setState;
};
export * from "./selectors.js";
const useSetStateSelection = () => {
  const setState = useSetState();
  return (newSelectionState) => {
    setState((prev) => ({
      ...prev,
      selection: {
        ...prev.selection,
        ...newSelectionState
      }
    }));
  };
};
const useSetStateTooltip = () => {
  const setState = useSetState();
  return (newTooltipState) => {
    setState((prev) => ({
      ...prev,
      tooltip: {
        ...prev.tooltip,
        ...newTooltipState
      }
    }));
  };
};
const useSetStateOverlay = () => {
  const setState = useSetState();
  return (newOverlayState) => {
    setState((prev) => ({
      ...prev,
      overlay: {
        ...prev.overlay,
        ...newOverlayState
      }
    }));
  };
};
const useToggleStatePinnedTooltip = () => {
  const setState = useSetState();
  return () => {
    setState((prev) => {
      if (prev.tooltip.visible || prev.tooltip.pinned) {
        return {
          ...prev,
          tooltip: {
            ...prev.tooltip,
            pinned: !prev.tooltip.pinned
          }
        };
      }
      return { ...prev };
    });
  };
};
export {
  useSetState,
  useSetStateOverlay,
  useSetStateSelection,
  useSetStateTooltip,
  useToggleStatePinnedTooltip
};
//# sourceMappingURL=store.js.map
