"use strict";
var __read = (this && this.__read) || function (o, n) {
    var m = typeof Symbol === "function" && o[Symbol.iterator];
    if (!m) return o;
    var i = m.call(o), r, ar = [], e;
    try {
        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
    }
    catch (error) { e = { error: error }; }
    finally {
        try {
            if (r && !r.done && (m = i["return"])) m.call(i);
        }
        finally { if (e) throw e.error; }
    }
    return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.topIcons = exports.menu = exports.components = void 0;
var entries_1 = require("./search/entries");
var misc_1 = require("@cocalc/util/misc");
exports.components = {};
exports.menu = {};
function register(opts) {
    var _a;
    var path = opts.path, title = opts.title, icon = opts.icon, desc = opts.desc, Component = opts.Component, danger = opts.danger, search = opts.search;
    var _b = __read(path.split("/"), 2), main = _b[0], sub = _b[1];
    if (!title) {
        title = (0, misc_1.capitalize)(sub);
    }
    if (!desc) {
        desc = '';
    }
    if (exports.components[main] == null) {
        exports.components[main] = (_a = {}, _a[sub] = Component, _a);
    }
    else {
        exports.components[main][sub] = Component;
    }
    if (desc || search) {
        (0, entries_1.register)({ path: path, title: title, desc: desc, icon: icon, search: search });
    }
    if (exports.menu[main] == null) {
        exports.menu[main] = {};
    }
    exports.menu[main][sub] = { title: title, icon: icon, desc: desc, danger: danger };
}
exports.default = register;
exports.topIcons = {
    search: "search",
    account: "user",
    editor: "edit",
    system: "gear",
    licenses: "key",
    purchases: "credit-card",
    support: "support",
};
//# sourceMappingURL=register.js.map