"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.VERSION_STYLE_PARENT = exports.VERSION_STYLE = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
/*
 *  This file is part of CoCalc: Copyright © 2021 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */
// A small banner on top of the list of packages, surfacing information about the executable.
const antd_1 = require("antd");
const { TabPane } = antd_1.Tabs;
exports.VERSION_STYLE = {
    maxHeight: "8em",
    backgroundColor: "rgba(150, 150, 150, 0.1)",
    fontSize: "12px",
    padding: "10px",
    overflow: "auto",
    marginBottom: "20px",
};
exports.VERSION_STYLE_PARENT = {
    clear: "both",
};
function SoftwareInfo({ info, showHeader = true, }) {
    if (info == null)
        return null;
    function renderInfoTabs() {
        if (info == null)
            return null;
        return Object.entries(info).map(([k, v]) => {
            if (v == null)
                return null;
            return ((0, jsx_runtime_1.jsx)(TabPane, { tab: k, children: (0, jsx_runtime_1.jsx)("div", { style: exports.VERSION_STYLE, children: (0, jsx_runtime_1.jsx)("pre", { style: exports.VERSION_STYLE_PARENT, children: v }) }) }, k));
        });
    }
    function renderInfo() {
        return (0, jsx_runtime_1.jsx)(antd_1.Tabs, { children: renderInfoTabs() });
    }
    return ((0, jsx_runtime_1.jsxs)("div", { style: exports.VERSION_STYLE_PARENT, children: [showHeader && (0, jsx_runtime_1.jsx)("h4", { children: "Executable information" }), renderInfo()] }));
}
exports.default = SoftwareInfo;
//# sourceMappingURL=software-info.js.map