"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getServerSideProps = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const antd_1 = require("antd");
const footer_1 = __importDefault(require("components/landing/footer"));
const head_1 = __importDefault(require("components/landing/head"));
const header_1 = __importDefault(require("components/landing/header"));
const image_1 = __importDefault(require("components/landing/image"));
const software_info_1 = __importDefault(require("components/landing/software-info"));
const software_libraries_1 = __importDefault(require("components/landing/software-libraries"));
const A_1 = __importDefault(require("components/misc/A"));
const customize_1 = require("lib/customize");
const software_specs_1 = require("lib/landing/software-specs");
const _1 = require(".");
const cocalc_r_jupyter_png_1 = __importDefault(require("/public/features/cocalc-r-jupyter.png"));
function R(props) {
    const { customize, spec, inventory, components, execInfo } = props;
    function renderEnvs() {
        const envs = [];
        for (const [key, info] of Object.entries(spec)) {
            envs.push((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("b", { children: [(0, jsx_runtime_1.jsx)(A_1.default, { href: info.url, children: info.name }), ":"] }), " ", info.doc] }, key));
        }
        return envs;
    }
    function renderBox() {
        return ((0, jsx_runtime_1.jsx)(antd_1.Alert, { style: { margin: "15px 0" }, message: "Learn More", description: (0, jsx_runtime_1.jsxs)("span", { style: { fontSize: "10pt" }, children: ["Learn more about", " ", (0, jsx_runtime_1.jsx)("strong", { children: (0, jsx_runtime_1.jsx)(A_1.default, { href: "/features/r-statistical-software", children: "R functionality in CoCalc" }) }), "."] }), type: "info", showIcon: true }));
    }
    function renderIntro() {
        return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { style: { width: "50%", float: "right", padding: "0 0 15px 15px" }, children: (0, jsx_runtime_1.jsx)(image_1.default, { src: cocalc_r_jupyter_png_1.default, alt: "Using R in a Jupyter notebook" }) }), (0, jsx_runtime_1.jsxs)("p", { children: ["This table lists all R packages that are", " ", (0, jsx_runtime_1.jsx)("b", { children: "immediately available by default in every CoCalc project" }), ", along with their version numbers. If something is missing, you can", " ", (0, jsx_runtime_1.jsx)(A_1.default, { href: "https://doc.cocalc.com/howto/install-r-package.html", children: "install it yourself" }), ", or request that we install them."] })] }));
    }
    return ((0, jsx_runtime_1.jsxs)(customize_1.Customize, { value: customize, children: [(0, jsx_runtime_1.jsx)(head_1.default, { title: "R Packages in CoCalc" }), (0, jsx_runtime_1.jsxs)(antd_1.Layout, { children: [(0, jsx_runtime_1.jsx)(header_1.default, { page: "software", subPage: "r" }), (0, jsx_runtime_1.jsxs)(antd_1.Layout.Content, { style: {
                            backgroundColor: "white",
                        }, children: [(0, jsx_runtime_1.jsxs)("div", { style: _1.STYLE_PAGE, children: [(0, jsx_runtime_1.jsx)("h1", { style: { textAlign: "center", fontSize: "32pt", color: "#444" }, children: "Installed R Statistical Software Packages" }), renderIntro(), renderBox(), (0, jsx_runtime_1.jsx)("h2", { children: "R Statistical Software Environments" }), (0, jsx_runtime_1.jsx)("ul", { children: renderEnvs() }), (0, jsx_runtime_1.jsx)(software_info_1.default, { info: execInfo, showHeader: false }), (0, jsx_runtime_1.jsx)(software_libraries_1.default, { spec: spec, inventory: inventory, components: components, libWidthPct: 60 })] }), (0, jsx_runtime_1.jsx)(footer_1.default, {})] })] })] }));
}
exports.default = R;
async function getServerSideProps(context) {
    return await (0, software_specs_1.withCustomizedAndSoftwareSpec)(context, "R", [
        "/usr/bin/R",
        "/usr/local/bin/R-sage",
    ]);
}
exports.getServerSideProps = getServerSideProps;
//# sourceMappingURL=r.js.map