"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 link_1 = __importDefault(require("next/link"));
var external_link_1 = __importDefault(require("./external-link"));
var raw_url_1 = __importDefault(require("lib/share/raw-url"));
var download_url_1 = __importDefault(require("lib/share/download-url"));
var r_join_1 = require("@cocalc/frontend/components/r_join");
var site_name_1 = __importDefault(require("./site-name"));
var edit_1 = __importDefault(require("./edit"));
function PathActions(_a) {
    var id = _a.id, path = _a.path, relativePath = _a.relativePath, isDir = _a.isDir, exclude = _a.exclude, project_id = _a.project_id, image = _a.image, description = _a.description;
    var include = function (action) { return !(exclude === null || exclude === void 0 ? void 0 : exclude.has(action)); };
    var v = [];
    if (include("hosted")) {
        v.push((0, jsx_runtime_1.jsx)(link_1.default, __assign({ href: "/share/public_paths/".concat(id) }, { children: (0, jsx_runtime_1.jsxs)("a", { children: ["Hosted by ", (0, jsx_runtime_1.jsx)(site_name_1.default, {})] }) }), "hosted"));
    }
    if (include("raw")) {
        v.push((0, jsx_runtime_1.jsx)(external_link_1.default, __assign({ href: (0, raw_url_1.default)({ id: id, path: path, relativePath: relativePath }) }, { children: "Raw" }), "raw"));
    }
    if (include("embed")) {
        v.push((0, jsx_runtime_1.jsx)(link_1.default, __assign({ href: "/share/public_paths/embed/".concat(id).concat(relativePath ? "/" + relativePath : "") }, { children: (0, jsx_runtime_1.jsx)("a", { children: "Embed" }) }), "embed"));
    }
    if (!isDir && include("download")) {
        v.push((0, jsx_runtime_1.jsx)("a", __assign({ href: (0, download_url_1.default)(id, path, relativePath) }, { children: "Download" }), "download"));
    }
    if (include("edit")) {
        v.push((0, jsx_runtime_1.jsx)(edit_1.default, { id: id, isDir: isDir, path: path, relativePath: relativePath, image: image, project_id: project_id, description: description }, "edit"));
    }
    return (0, r_join_1.r_join)(v, " | ");
}
exports.default = PathActions;
//# sourceMappingURL=path-actions.js.map