import { watch } from '../watch/index.svelte.js';
export function getPrevious(getter, initial = undefined) {
const _previous = $state({ current: initial });
watch(() => $state.snapshot(getter()), (_, prev) => {
_previous.current = prev;
});
return _previous;
}