"use strict";
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var jsx_runtime_1 = require("react/jsx-runtime");
/*
 *  This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */
var directory_listing_1 = __importDefault(require("./directory-listing"));
var file_contents_1 = __importDefault(require("./file-contents"));
var loading_1 = __importDefault(require("./loading"));
function PathContents(_a) {
    var id = _a.id, isdir = _a.isdir, listing = _a.listing, content = _a.content, relativePath = _a.relativePath, path = _a.path, truncated = _a.truncated;
    if (isdir) {
        if (listing == null)
            return (0, jsx_runtime_1.jsx)(loading_1.default, { style: { fontSize: "30px" } });
        return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Truncated, { truncated: truncated }), (0, jsx_runtime_1.jsx)(directory_listing_1.default, { id: id, listing: listing, relativePath: relativePath })] }));
    }
    else {
        return ((0, jsx_runtime_1.jsxs)("div", __assign({ style: {
                padding: "20px 15px",
            } }, { children: [(0, jsx_runtime_1.jsx)(Truncated, { truncated: truncated }), (0, jsx_runtime_1.jsx)(file_contents_1.default, { id: id, content: content, path: path, relativePath: relativePath })] })));
    }
}
exports.default = PathContents;
var Truncated = function (_a) {
    var truncated = _a.truncated;
    return truncated == null ? null : (0, jsx_runtime_1.jsx)("h3", { children: truncated });
};
//# sourceMappingURL=path-contents.js.map