"use strict";
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");
/*
Edit a file using the CoCalc app.
*/
var antd_1 = require("antd");
var base_path_1 = __importDefault(require("lib/base-path"));
var edit_url_1 = __importDefault(require("lib/share/edit-url"));
var path_1 = require("path");
var iframe_1 = __importDefault(require("./iframe"));
var use_customize_1 = __importDefault(require("lib/use-customize"));
var in_place_sign_in_or_up_1 = __importDefault(require("components/auth/in-place-sign-in-or-up"));
var open_anonymously_1 = __importDefault(require("components/share/edit/open-anonymously"));
function Path(_a) {
    var project_id = _a.project_id, path = _a.path, style = _a.style, fullscreen = _a.fullscreen, embed = _a.embed;
    var _b = (0, use_customize_1.default)(), account = _b.account, anonymousSignup = _b.anonymousSignup;
    if (!account) {
        return ((0, jsx_runtime_1.jsx)(antd_1.Alert, { type: "success", style: style, message: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(in_place_sign_in_or_up_1.default, { title: "To use the sandbox..." }), anonymousSignup && (0, jsx_runtime_1.jsx)(open_anonymously_1.default, {})] }) }));
    }
    var appURL = (0, edit_url_1.default)({ type: "collaborator", project_id: project_id, path: path });
    var src = embed
        ? (0, path_1.join)(base_path_1.default, "static/embed.html?target=projects/".concat(project_id, "/files/").concat(path !== null && path !== void 0 ? path : ""))
        : appURL + "?fullscreen=project&session=";
    return ((0, jsx_runtime_1.jsx)(iframe_1.default, { src: src, appURL: appURL, path: path, style: style, fullscreen: fullscreen }));
}
exports.default = Path;
//# sourceMappingURL=path.js.map