"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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.InitialsAvatar = void 0;
var React = __importStar(require("react"));
var InitialsAvatar_interface_1 = require("../InitialsAvatar.interface");
var InitialsAvatar_style_1 = require("./InitialsAvatar.style");
exports.InitialsAvatar = function (props) {
    var name = props.name, dark = props.dark, sizeCircle = props.sizeCircle, size = props.size, _a = props.skeleton, skeleton = _a === void 0 ? false : _a;
    var initials = skeleton ? '' : name[0].toUpperCase();
    var colorNumber = skeleton
        ? 0
        : name.split('').reduce(function (previousValue, currentValue) { return previousValue + currentValue.charCodeAt(0); }, 0);
    var color = skeleton ? '#eee' : InitialsAvatar_interface_1.colorInitialsAvatar[colorNumber % InitialsAvatar_interface_1.colorInitialsAvatar.length];
    var style = {
        color: 'white',
    };
    if (!dark) {
        style.backgroundColor = "" + color;
    }
    if (skeleton) {
        style.backgroundColor = "#eee";
    }
    return (React.createElement(InitialsAvatar_style_1.Container, { style: style, size: size, sizeCircle: sizeCircle },
        React.createElement(InitialsAvatar_style_1.Initials, { color: "white", size: size, sizeCircle: sizeCircle }, initials)));
};
//# sourceMappingURL=InitialsAvatar.js.map