import { useCallback as p } from "react";
import { isRefObject as i } from "../../utils/is-ref-object.es.js";
function b(r, u, f) {
  return p(
    (o) => {
      o && r.onMount && r.onMount(o), u && (o ? u.mount(o) : u.unmount()), f && (typeof f == "function" ? f(o) : i(f) && (f.current = o));
    },
    /**
     * Include externalRef in dependencies to ensure the callback updates
     * when the ref changes, allowing proper ref forwarding.
     */
    [u]
  );
}
export {
  b as useMotionRef
};
//# sourceMappingURL=use-motion-ref.es.js.map
