/**
 * Transforms the scores menu data by filtering out hidden categories and scores,
 * and sorting them by their order.
 *
 * This function is used to prepare the scores menu data for rendering in the UI.
 *
 * @param scoresMenu
 * @returns
 */
export function transformScoresMenuData(scoresMenu) {
    return Object.assign(Object.assign({}, (scoresMenu || {})), { categories: Object.entries((scoresMenu === null || scoresMenu === void 0 ? void 0 : scoresMenu.categories) || {})
            .filter(([, category]) => category.hide !== true)
            .sort(([, a], [, b]) => { var _a, _b; return ((_a = a.order) !== null && _a !== void 0 ? _a : 0) - ((_b = b.order) !== null && _b !== void 0 ? _b : 0); })
            .map(
        // Map categories to the expected format so we can loop through them
        ([categoryKey, category]) => [
            categoryKey,
            Object.assign(Object.assign({}, category), { 
                // Sort scores by order within each category
                scores: Object.entries(category.scores || {})
                    .filter(([, score]) => score.hide !== true)
                    .sort(([, a], [, b]) => { var _a, _b; return ((_a = a.order) !== null && _a !== void 0 ? _a : 0) - ((_b = b.order) !== null && _b !== void 0 ? _b : 0); }) }),
        ]) });
}
//# sourceMappingURL=index.js.map