import * as index from '../labels/index.js';
import { labelWeekday } from '../labels/labelWeekday.js';
import { labelWeekNumberHeader } from '../labels/labelWeekNumberHeader.js';
import { labelNav } from '../labels/labelNav.js';
import { labelGridcell } from '../labels/labelGridcell.js';
import { labelGrid } from '../labels/labelGrid.js';
import { labelYearDropdown } from '../labels/labelYearDropdown.js';
import { labelWeekNumber } from '../labels/labelWeekNumber.js';
import { labelPrevious } from '../labels/labelPrevious.js';
import { labelNext } from '../labels/labelNext.js';
import { labelMonthDropdown } from '../labels/labelMonthDropdown.js';
import { labelDayButton } from '../labels/labelDayButton.js';

const resolveLabel = (defaultLabel, customLabel, localeLabel) => {
    if (customLabel)
        return customLabel;
    if (localeLabel) {
        return (typeof localeLabel === "function"
            ? localeLabel
            : (..._args) => localeLabel);
    }
    return defaultLabel;
};
/**
 * Merges custom labels from the props with the default labels.
 *
 * When available, uses the locale-provided translation for `labelNext`.
 *
 * @param customLabels The custom labels provided in the DayPicker props.
 * @param options Options from the date library, used to resolve locale
 *   translations.
 * @returns The merged labels object with locale-aware defaults.
 */
function getLabels(customLabels, options) {
    const localeLabels = options.locale?.labels ?? {};
    return {
        ...index,
        ...(customLabels ?? {}),
        labelDayButton: resolveLabel(labelDayButton, customLabels?.labelDayButton, localeLabels.labelDayButton),
        labelMonthDropdown: resolveLabel(labelMonthDropdown, customLabels?.labelMonthDropdown, localeLabels.labelMonthDropdown),
        labelNext: resolveLabel(labelNext, customLabels?.labelNext, localeLabels.labelNext),
        labelPrevious: resolveLabel(labelPrevious, customLabels?.labelPrevious, localeLabels.labelPrevious),
        labelWeekNumber: resolveLabel(labelWeekNumber, customLabels?.labelWeekNumber, localeLabels.labelWeekNumber),
        labelYearDropdown: resolveLabel(labelYearDropdown, customLabels?.labelYearDropdown, localeLabels.labelYearDropdown),
        labelGrid: resolveLabel(labelGrid, customLabels?.labelGrid, localeLabels.labelGrid),
        labelGridcell: resolveLabel(labelGridcell, customLabels?.labelGridcell, localeLabels.labelGridcell),
        labelNav: resolveLabel(labelNav, customLabels?.labelNav, localeLabels.labelNav),
        labelWeekNumberHeader: resolveLabel(labelWeekNumberHeader, customLabels?.labelWeekNumberHeader, localeLabels.labelWeekNumberHeader),
        labelWeekday: resolveLabel(labelWeekday, customLabels?.labelWeekday, localeLabels.labelWeekday),
    };
}

export { getLabels };
//# sourceMappingURL=getLabels.js.map
