import { flatten } from 'ramda';
export var flattenGroupedItemsData = function (groupedItems) {
    var getFlattenedItems = function (items) {
        return flatten(items.map(function (item) { return [item].concat(item.items ? getFlattenedItems(item.items) : []); }));
    };
    var titleItemIndex = null;
    var items = getFlattenedItems(groupedItems).map(function (item, index) {
        if (item && item.items) {
            titleItemIndex = index;
        }
        return { item: item, index: index, titleItemIndex: titleItemIndex };
    });
    return items;
};
export var isTitleListItem = function (listItem) {
    return listItem.titleItemIndex === listItem.index;
};
