"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CodeLangSelect = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("react");
const uikit_1 = require("@gravity-ui/uikit");
const classname_1 = require("../../../../../classname.js");
const codeblock_1 = require("../../../../../i18n/codeblock/index.js");
const placeholder_1 = require("../../../../../i18n/placeholder/index.js");
const const_1 = require("../const.js");
const bCodeBlock = (0, classname_1.cn)('code-block');
exports.CodeLangSelect = (0, react_1.memo)(function CodeLangSelect({ lang, focus, onChange, selectItems, mapping }) {
    const value = mapping[lang] || lang || const_1.PlainTextLang;
    const handleClick = (type) => {
        focus();
        if (type === value)
            return;
        onChange(type);
    };
    return ((0, jsx_runtime_1.jsx)(uikit_1.Select, { size: "m", width: "max", disablePortal: true, value: [value], onUpdate: (v) => handleClick(v[0]), options: selectItems, filterable: true, filterPlaceholder: (0, placeholder_1.i18n)('select_filter'), popupClassName: bCodeBlock('select-popup'), className: bCodeBlock('select-button'), renderEmptyOptions: () => ((0, jsx_runtime_1.jsx)("div", { className: bCodeBlock('select-empty'), children: (0, codeblock_1.i18n)('empty_option') })) }));
});
//# sourceMappingURL=CodeLangSelect.js.map
