import { c } from "react-compiler-runtime";
import { useHistory, useLocation } from "react-router-dom";
//#region src/hooks/useSetLocationState.js
const useSetLocationState = () => {
	const $ = c(6);
	const history = useHistory();
	const location = useLocation();
	let t0;
	if ($[0] !== history || $[1] !== location.hash || $[2] !== location.pathname || $[3] !== location.search || $[4] !== location.state) {
		t0 = (newState) => {
			const currentState = location.state || {};
			if (!Object.entries(newState).some((t1) => {
				const [key, value] = t1;
				return currentState[key] !== value;
			}) || !!location?.state) return;
			history.replace({
				pathname: location.pathname,
				search: location.search,
				hash: location.hash,
				state: {
					...currentState,
					...newState
				}
			});
		};
		$[0] = history;
		$[1] = location.hash;
		$[2] = location.pathname;
		$[3] = location.search;
		$[4] = location.state;
		$[5] = t0;
	} else t0 = $[5];
	return t0;
};
//#endregion
export { useSetLocationState };

//# sourceMappingURL=useSetLocationState.mjs.map