import { useImageUrl as f } from "./index-useImageUrl.js";
import { useState as a, useEffect as m } from "react";
const c = (r) => {
  r = f(r);
  const [t, e] = a(!0), [n, s] = a(!1);
  return m(() => {
    e(!0), s(!1);
    const o = new Image();
    o.onload = () => {
      e(!1);
    }, o.onerror = () => {
      e(!1), s(!0);
    }, o.src = r;
  }, []), {
    isLazyLoading: t,
    isLazyError: n,
    setIsLazyLoading: e,
    setIsLazyError: s
  };
};
export {
  c as useLazyImage
};
