"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.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = __importStar(require("react"));
var material_1 = require("@mui/material");
var colors_1 = require("../../base/colors");
var cloudImageHelpers_1 = require("./cloudImageHelpers");
function PartnerCloudIcon(_a) {
    var _b = _a.size, size = _b === void 0 ? 50 : _b, _c = _a.slug, slug = _c === void 0 ? "" : _c, _d = _a.alt, alt = _d === void 0 ? "" : _d, _e = _a.white, white = _e === void 0 ? false : _e, _f = _a.square, square = _f === void 0 ? false : _f, _g = _a.backgroundColor, backgroundColor = _g === void 0 ? colors_1.grey.subtle : _g;
    var _h = react_1.useState(false), error = _h[0], setError = _h[1];
    var avatarLetter = slug.substring(0, 1);
    var url = cloudImageHelpers_1.partnerIconUrl(slug, { white: white });
    return (react_1.default.createElement(material_1.Avatar, { style: {
            backgroundColor: backgroundColor,
            color: white ? "white" : colors_1.green.dark,
            height: size,
            width: size,
        }, variant: square ? "rounded" : "circular" }, !error ? (react_1.default.createElement("img", { src: url, style: { minWidth: size / 2 }, width: size / 2, alt: alt || "", onError: function () { return setError(true); } })) : (avatarLetter.toUpperCase())));
}
exports.default = PartnerCloudIcon;
//# sourceMappingURL=PartnerCloudIcon.js.map