/*!
 * Built by Revolist OU ❤️
 */
import { setMode } from "@stencil/core";
import { getTheme } from "../themeManager/theme.service";
export default function () {
    setMode(elm => {
        let theme = elm.theme || elm.getAttribute('theme');
        if (typeof theme === 'string') {
            theme = theme.trim();
        }
        const parsedTheme = getTheme(theme);
        if (parsedTheme !== theme) {
            elm.setAttribute('theme', parsedTheme);
        }
        return parsedTheme;
    });
}
