"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var material_1 = require("@mui/material");
var react_1 = __importDefault(require("react"));
var Alert_1 = __importDefault(require("@mui/lab/Alert"));
var lodash_1 = __importDefault(require("lodash"));
var Flex_1 = require("../Flex");
function ErrorBox(_a) {
    var error = _a.error, link = _a.link, _b = _a.mb, mb = _b === void 0 ? 2 : _b, _c = _a.mt, mt = _c === void 0 ? 0 : _c;
    var renderContents = function () {
        if (Array.isArray(error)) {
            return (react_1.default.createElement(Flex_1.Flex, { column: true }, error.map(function (e) { return (react_1.default.createElement(Flex_1.Flex, { key: e },
                react_1.default.createElement(Flex_1.Flex, { mr: 1 }, e),
                link || null)); })));
        }
        else {
            return (react_1.default.createElement(Flex_1.Flex, null,
                react_1.default.createElement(Flex_1.Flex, { mr: 1 }, error),
                link || null));
        }
    };
    return !lodash_1.default.isEmpty(error) ? (react_1.default.createElement(material_1.Box, { mb: mb, mt: mt, className: "spec-error-box" },
        react_1.default.createElement(Alert_1.default, { severity: "error" }, renderContents()))) : null;
}
exports.default = ErrorBox;
//# sourceMappingURL=ErrorBox.js.map