"use client";
import { useCombineMotionValues } from './use-combine-values.mjs';
import { collectMotionValues } from '../../../../../../motion-dom@12.38.0/node_modules/motion-dom/dist/es/value/index.mjs';

function useComputed(compute) {
    /**
     * Open session of collectMotionValues. Any MotionValue that calls get()
     * will be saved into this array.
     */
    collectMotionValues.current = [];
    compute();
    const value = useCombineMotionValues(collectMotionValues.current, compute);
    /**
     * Synchronously close session of collectMotionValues.
     */
    collectMotionValues.current = undefined;
    return value;
}

export { useComputed };
