"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");
var antd_1 = require("antd");
var loading_1 = __importDefault(require("components/share/loading"));
var register_1 = __importDefault(require("../register"));
var edit_table_1 = __importDefault(require("lib/hooks/edit-table"));
var accounts_1 = require("@cocalc/util/db-schema/accounts");
var codemirror_1 = __importDefault(require("components/share/codemirror"));
var desc = {
    font_size: "\nNewly opened files will open with this font size in pixels by default. You can\nchange the font size for a particular file (or editor frame) at any time,\nand the setting is saved in your browser.\n",
    theme: "The editor theme determines the color scheme used by CodeMirror.\nThis impacts editing files and input cells of Jupyter notebooks.",
    line_wrapping: "Enable line or word wrapping so that when I line is longer than the width of the editor,\nthe line will get wrapped so it stays visible, and there is no horizontal scroll bar.  Enabling\nthis can make it difficult to view the structure of some text involving longer lines, but avoids having\nto scroll horizontally.",
    line_numbers: "Display line numbers to the left of the editor content.",
};
var EXAMPLE = "def is_prime_lucas_lehmer(p):\n    \"\"\"\n    Test primality of Mersenne number 2**p - 1.  This is a long line hopefully illustrating line wrapping.\n\n    >>> is_prime_lucas_lehmer(107)\n    True\n    \"\"\"\n    k = 2**p - 1; s = 4\n    for i in range(3, p+1):\n        s = (s*s - 2) % k\n    return s == 0";
(0, register_1.default)({
    path: "editor/appearance",
    title: "Appearance",
    icon: "font",
    desc: "Editor default font size, color theme, etc.",
    search: desc,
    Component: function () {
        var _a = (0, edit_table_1.default)({
            accounts: { font_size: null, editor_settings: null },
        }), edited = _a.edited, original = _a.original, Save = _a.Save, EditBoolean = _a.EditBoolean, EditNumber = _a.EditNumber, EditSelect = _a.EditSelect;
        if (original == null || edited == null) {
            return (0, jsx_runtime_1.jsx)(loading_1.default, {});
        }
        return ((0, jsx_runtime_1.jsx)(antd_1.Space, __assign({ direction: "vertical", style: { width: "100%" } }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Row, { children: [(0, jsx_runtime_1.jsxs)(antd_1.Col, __assign({ md: 14, sm: 24, style: { paddingRight: "15px" } }, { children: [(0, jsx_runtime_1.jsx)(Save, {}), (0, jsx_runtime_1.jsx)(EditNumber, { path: "font_size", icon: "text-height", title: "Default Font Size", desc: desc.font_size, min: 5, max: 32, units: "px" }), (0, jsx_runtime_1.jsx)(EditSelect, { path: "editor_settings.theme", icon: "colors", desc: desc.theme, options: accounts_1.EDITOR_COLOR_SCHEMES, style: { width: "30ex" } }), (0, jsx_runtime_1.jsx)(EditBoolean, { icon: "align-left", path: "editor_settings.line_wrapping", desc: desc.line_wrapping }), (0, jsx_runtime_1.jsx)(EditBoolean, { icon: "list-ol", path: "editor_settings.line_numbers", desc: desc.line_numbers })] })), (0, jsx_runtime_1.jsxs)(antd_1.Col, __assign({ md: 10, sm: 24 }, { children: [(0, jsx_runtime_1.jsx)("h3", __assign({ style: { marginTop: "10px" } }, { children: "Preview" })), (0, jsx_runtime_1.jsx)(codemirror_1.default, { content: EXAMPLE, filename: "a.py", fontSize: edited.font_size, options: {
                                    // @ts-ignore
                                    theme: edited.editor_settings.theme,
                                    lineNumbers: edited.editor_settings.line_numbers,
                                    lineWrapping: edited.editor_settings.line_wrapping,
                                } })] }))] }) })));
    },
});
//# sourceMappingURL=appearance.js.map