import { jsx as _jsx } from "react/jsx-runtime";
// (C) 2026 GoodData Corporation
import { useIntl } from "react-intl";
import { olpGranteeAvatarMessages } from "../../locales.js";
import { UiAvatar } from "../UiAvatar/UiAvatar.js";
const ICON_BY_KIND = {
    user: "user",
    group: "users",
};
/**
 * 32×32 circle avatar used by the OLP share-dialog grantee list. Thin wrapper
 * over `UiAvatar` that picks the right silhouette and i18n
 * accessibility label per grantee kind. Pass `decorative` when
 * the avatar is paired with a visible name in the same row.
 *
 * @internal
 */
export function UiGranteeAvatar({ kind, decorative, dataTestId }) {
    const intl = useIntl();
    if (decorative) {
        return (_jsx(UiAvatar, { icon: ICON_BY_KIND[kind], accessibilityConfig: { ariaHidden: true }, dataTestId: dataTestId }));
    }
    const ariaLabel = intl.formatMessage(kind === "group" ? olpGranteeAvatarMessages.group : olpGranteeAvatarMessages.user);
    return _jsx(UiAvatar, { icon: ICON_BY_KIND[kind], accessibilityConfig: { ariaLabel }, dataTestId: dataTestId });
}
