"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BadgeDisplayRow = exports.Badge = exports.BADGE_IMAGES = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const expo_image_1 = require("expo-image");
const react_native_1 = require("react-native");
exports.BADGE_IMAGES = {
    "place.stream.badge.defs#mod": require("../../../assets/badges/mod_2x.png"),
    "place.stream.badge.defs#streamer": require("../../../assets/badges/live_2x.png"),
    "place.stream.badge.defs#vip": require("../../../assets/badges/vip_2x.png"),
    "place.stream.badge.defs#bot": require("../../../assets/badges/robot_2x.png"),
};
const Badge = ({ badgeType, size = 18, isInChat = false, imageUrl, }) => {
    const source = exports.BADGE_IMAGES[badgeType];
    if (source) {
        return ((0, jsx_runtime_1.jsx)(expo_image_1.Image, { source: source, style: [
                {
                    height: size,
                    width: size,
                    marginRight: 2,
                },
                isInChat && {
                    marginBottom: react_native_1.Platform.OS === "web" ? -size : 0,
                    transform: react_native_1.Platform.OS === "web" ? [{ translateY: -size / 1.3 }] : [],
                },
            ] }));
    }
    if (imageUrl) {
        return ((0, jsx_runtime_1.jsx)(expo_image_1.Image, { source: { uri: imageUrl }, style: [
                {
                    height: size,
                    width: size,
                    marginRight: 2,
                    borderRadius: 2,
                },
                isInChat && {
                    marginBottom: react_native_1.Platform.OS === "web" ? -size : 0,
                    transform: react_native_1.Platform.OS === "web" ? [{ translateY: -size / 1.3 }] : [],
                },
            ] }));
    }
    return null;
};
exports.Badge = Badge;
const BadgeDisplayRow = ({ badges, }) => {
    if (!badges?.length)
        return null;
    return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: badges.map((badge, index) => ((0, jsx_runtime_1.jsx)(exports.Badge, { badgeType: badge.badgeType, imageUrl: badge.imageUrl, isInChat: true }, index))) }));
};
exports.BadgeDisplayRow = BadgeDisplayRow;
//# sourceMappingURL=badge.js.map