"use client";
import { useThrottledCallbackWithClearTimeout } from "../use-throttled-callback/use-throttled-callback.mjs";
import { useEffect, useRef, useState } from "react";
//#region packages/@mantine/hooks/src/use-throttled-value/use-throttled-value.ts
function useThrottledValue(value, wait) {
	const [throttledValue, setThrottledValue] = useState(value);
	const valueRef = useRef(value);
	const [throttledSetValue, clearTimeout] = useThrottledCallbackWithClearTimeout(setThrottledValue, wait);
	useEffect(() => {
		if (value !== valueRef.current) {
			valueRef.current = value;
			throttledSetValue(value);
		}
	}, [throttledSetValue, value]);
	useEffect(() => clearTimeout, []);
	return throttledValue;
}
//#endregion
export { useThrottledValue };

//# sourceMappingURL=use-throttled-value.mjs.map