import { b as reactExports, K as getDefaultTokenImage, w as jsx } from './index-Cy6GwrlT.js';

function TokenImage({ src, name, environment, theme, defaultImage, ...forwardedProps }) {
    const [error, setError] = reactExports.useState(false);
    const url = reactExports.useMemo(() => (!src || error
        ? defaultImage
            || (theme && getDefaultTokenImage(environment, theme))
            || ''
        : src), [src, error]);
    const { ...cleanedProps } = forwardedProps;
    if (Object.prototype.hasOwnProperty.call(cleanedProps, 'responsiveSizes')) {
        delete cleanedProps.responsiveSizes;
    }
    return (jsx("img", { src: url, alt: name, onError: () => setError(true), ...cleanedProps }));
}

export { TokenImage as T };
