import { browser } from "$app/environment";
import { theme as themeStore } from "$lib/store";
import { addTranslations, setLocale, setRoute } from "$lib/translations/index";
import { addIcon } from "iconify-icon";
import cookies from "js-cookie";
/** @type {import('@sveltejs/kit').Load} */
export const load = async ({ data }) => {
const { i18n, translations } = data;
const { locale, route } = i18n;
addTranslations(translations);
await setRoute(route);
await setLocale(locale);
if (browser) {
let theme = cookies.get("theme");
if (!theme) {
theme = matchMedia("(prefers-color-scheme: dark)").matches
? "dark"
: "light";
const expires = new Date();
expires.setSeconds(expires.getSeconds() + 21000000);
cookies.set("theme", theme, { path: "/", expires });
if (theme === "dark") setTimeout(() => themeStore.set(theme), 100);
}
}
};
addIcon("coinos:logo", {
body: ' ',
width: 224,
height: 72,
});
addIcon("coinos:rays", {
body: '',
width: 158,
height: 60,
});
addIcon("coinos:shield", {
body: '',
width: 96,
height: 122,
});
addIcon("coinos:hand", {
body: '',
width: 106,
height: 100,
});
addIcon("coinos:bolt", {
body: '',
width: 96,
height: 121,
});
addIcon("coinos:smile", {
body: '',
width: 112,
height: 108,
});
addIcon("coinos:symbol", {
body: ``,
width: 72,
height: 72,
});