import { t as translations, i as i18n, g as getLocale } from './store.js';

/**
 * Class with helper functions to get sensor labels and to translate raw values into human readable ones
 */
class sensorInfo {
    static getLabel(sensorId, locale) {
        const currentLocale = getLocale(locale);
        const labels = translations[currentLocale].sensorLabels;
        return labels[String(sensorId)] || sensorId.toString();
    }
    static getShortLabel(sensorId, locale) {
        const currentLocale = getLocale(locale);
        const labels = translations[currentLocale].sensorLabelsShort;
        return labels[String(sensorId)] || sensorId.toString();
    }
    static getValue(sensorValue, sensorId, locale) {
        const currentLocale = getLocale(locale);
        if ([10, 524].includes(sensorId)) {
            return sensorValue === 1
                ? i18n.t("ui:status.healthy", { lng: currentLocale })
                : i18n.t("ui:status.unhealthy", { lng: currentLocale });
        }
        if (sensorId === 23) {
            const numValue = Number(sensorValue);
            if (isNaN(numValue) ||
                sensorValue === undefined ||
                sensorValue === null) {
                return "-";
            }
            return new Intl.NumberFormat(translations[currentLocale].intlLocale, {
                style: "percent",
            }).format(numValue / 100);
        }
        const values = translations[currentLocale].sensorValues;
        return values[String(sensorValue)] || sensorValue;
    }
}

export { sensorInfo as s };
//# sourceMappingURL=sensorInfo.js.map

//# sourceMappingURL=sensorInfo.js.map