"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.preparedGroupedItems = void 0;
var ramda_1 = require("ramda");
var filterItems = (0, ramda_1.curry)(function (filterText, items) {
    return (0, ramda_1.filter)(function (item) { return (item.label || item.name).toLowerCase().includes(filterText.toLowerCase()); })(items);
});
var preparedGroupedItems = function (_a) {
    var attrTypes = _a.attrTypes, _b = _a.filter, filter = _b === void 0 ? '' : _b, sortingFn = _a.sortingFn;
    return (0, ramda_1.pipe)(filterItems(filter), (0, ramda_1.sort)(sortingFn), (0, ramda_1.map)(function (attrType) { return ({
        item: {
            id: attrType.uri,
            label: attrType.label || attrType.name,
            attrType: attrType
        }
    }); }))(attrTypes);
};
exports.preparedGroupedItems = preparedGroupedItems;
