"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = __importStar(require("react"));
const styled_components_1 = require("styled-components");
const borderRadius_1 = __importDefault(require("../themes/foundations/borderRadius"));
const PeerName_1 = __importDefault(require("./PeerName"));
const components_1 = require("../themes/components");
// In nametag, if user request for start presenting modal (of webinar),
// The audio track is undefined
function NameTag({ audioMuted, audioTrack, name, size: selectedSize, screenshare, }) {
    const sizes = {
        sm: {
            px: '6',
            py: '1',
            iconSize: '4',
            boxSize: '14',
        },
        md: {
            px: '3',
            py: '2',
            iconSize: '6',
            boxSize: '16',
        },
    }[selectedSize];
    const hexToRGBA = (hex, alpha) => {
        const r = parseInt(hex.slice(1, 3), 16);
        const g = parseInt(hex.slice(3, 5), 16);
        const b = parseInt(hex.slice(5, 7), 16);
        if (alpha) {
            return `rgba(${r}, ${g}, ${b}, ${alpha})`;
        }
        return `rgba(${r}, ${g}, ${b}, 0)`;
    };
    const { colors } = react_1.useContext(styled_components_1.ThemeContext);
    return (react_1.default.createElement(components_1.Flex, { bg: selectedSize === 'sm' || screenshare
            ? hexToRGBA(colors.secondary[800], 0.5)
            : colors.secondary[800], color: "textPrimary.300", borderRadius: borderRadius_1.default.small, px: sizes.px, py: sizes.py, my: selectedSize === 'sm' && 2, position: "relative", direction: "row", justify: "flex-start" },
        !(screenshare && audioMuted) && (react_1.default.createElement(components_1.Center, null, !audioMuted && audioTrack
            ? null
            : react_1.default.createElement(components_1.Icon, { name: "mic-off", boxSize: sizes.boxSize, fill: "red" }))),
        react_1.default.createElement(components_1.Center, { ml: sizes.px, padding: 4 },
            react_1.default.createElement(PeerName_1.default, { name: name }))));
}
exports.default = NameTag;
NameTag.defaultProps = {
    size: 'md',
    screenshare: false,
};
//# sourceMappingURL=NameTag.js.map