"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 });
exports.LinkStyle = void 0;
var 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
 */
var link_1 = __importDefault(require("next/link"));
var logo_square_1 = __importDefault(require("components/logo-square"));
var A_1 = __importDefault(require("components/misc/A"));
var path_1 = require("path");
var antd_1 = require("antd");
var customize_1 = require("lib/customize");
var base_path_1 = __importDefault(require("lib/base-path"));
var sub_nav_1 = __importDefault(require("./sub-nav"));
var analytics_1 = __importDefault(require("components/analytics"));
var navtab_1 = __importDefault(require("components/account/navtab"));
var GAP = "4%";
exports.LinkStyle = {
    color: "white",
    marginRight: GAP,
    display: "inline-block",
};
var SelectedStyle = __assign(__assign({}, exports.LinkStyle), { color: "#c7d9f5", fontWeight: "bold", borderBottom: "5px solid #c7d9f5" });
function Header(_a) {
    var page = _a.page, subPage = _a.subPage;
    var _b = (0, customize_1.useCustomize)(), isCommercial = _b.isCommercial, anonymousSignup = _b.anonymousSignup, siteName = _b.siteName, termsOfServiceURL = _b.termsOfServiceURL, shareServer = _b.shareServer, landingPages = _b.landingPages, account = _b.account, imprintOrPolicies = _b.imprintOrPolicies;
    if (base_path_1.default == null)
        return null;
    return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(analytics_1.default, {}), (0, jsx_runtime_1.jsxs)(antd_1.Layout.Header, __assign({ style: {
                    minHeight: "64px",
                    height: "auto",
                    lineHeight: "32px",
                    padding: "16px",
                    textAlign: "center",
                } }, { children: [(0, jsx_runtime_1.jsx)(A_1.default, __assign({ href: "/" }, { children: (0, jsx_runtime_1.jsx)("div", __assign({ style: {
                                position: "relative",
                                display: "inline-block",
                                height: "40px",
                                width: "40px",
                                marginTop: "-30px",
                                marginRight: "64px",
                            } }, { children: (0, jsx_runtime_1.jsx)(logo_square_1.default, { style: {
                                    height: "40px",
                                    width: "40px",
                                    position: "absolute",
                                    top: "15px",
                                } }) })) })), account && ((0, jsx_runtime_1.jsx)("a", __assign({ style: exports.LinkStyle, href: (0, path_1.join)(base_path_1.default, "projects"), title: "View your projects" }, { children: "Projects" }))), landingPages && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(A_1.default, __assign({ href: "/features/", style: page == "features" ? SelectedStyle : exports.LinkStyle }, { children: "Features" })), (0, jsx_runtime_1.jsx)(A_1.default, __assign({ href: "/software", style: page == "software" ? SelectedStyle : exports.LinkStyle }, { children: "Software" })), isCommercial && ((0, jsx_runtime_1.jsx)(A_1.default, __assign({ href: "/pricing", style: page == "pricing" ? SelectedStyle : exports.LinkStyle }, { children: "Pricing" })))] })), !landingPages && termsOfServiceURL && ((0, jsx_runtime_1.jsx)(A_1.default, __assign({ style: exports.LinkStyle, href: termsOfServiceURL, title: "View the terms of service and other legal documents." }, { children: "Legal" }))), (0, jsx_runtime_1.jsx)(A_1.default, __assign({ style: page == "info" ? SelectedStyle : exports.LinkStyle, href: "/info", title: "Information and links to resources for learning more about CoCalc" }, { children: "Info" })), (landingPages || imprintOrPolicies) && ((0, jsx_runtime_1.jsx)(A_1.default, __assign({ href: "/policies", style: page == "policies" ? SelectedStyle : exports.LinkStyle }, { children: "Policies" }))), shareServer && ((0, jsx_runtime_1.jsx)(link_1.default, __assign({ href: "/share/public_paths/page/1" }, { children: (0, jsx_runtime_1.jsx)("a", __assign({ style: page == "share" ? SelectedStyle : exports.LinkStyle, title: "View files that people have published." }, { children: "Share" })) }))), (0, jsx_runtime_1.jsx)(A_1.default, __assign({ style: page == "support" ? SelectedStyle : exports.LinkStyle, href: "/support", title: "Create and view support tickets" }, { children: "Support" })), " ", !account && anonymousSignup && ((0, jsx_runtime_1.jsx)(A_1.default, __assign({ style: page == "try" ? SelectedStyle : exports.LinkStyle, href: "/auth/try", title: "Try ".concat(siteName, " immediately without creating an account.") }, { children: "Try" }))), " ", account ? ((0, jsx_runtime_1.jsx)(navtab_1.default, { style: page == "account" ? SelectedStyle : exports.LinkStyle })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(A_1.default, __assign({ style: page == "sign-in" ? SelectedStyle : exports.LinkStyle, href: "/auth/sign-in", title: "Sign in to ".concat(siteName, " or create an account.") }, { children: "Sign In" })), (0, jsx_runtime_1.jsx)(A_1.default, __assign({ style: page == "sign-up" ? SelectedStyle : exports.LinkStyle, href: "/auth/sign-up", title: "Sign up for a ".concat(siteName, " account.") }, { children: "Sign Up" }))] }))] })), (landingPages || imprintOrPolicies) && page && ((0, jsx_runtime_1.jsx)(sub_nav_1.default, { page: page, subPage: subPage }))] }));
}
exports.default = Header;
//# sourceMappingURL=header.js.map