import { createApp, ref } from "vue";
import { createPinia } from "pinia";
import { createI18n } from "vue-i18n";
import App from "./App.vue";
import router from "./router";

import { createVfm } from 'vue-final-modal'
import { register } from 'swiper/element/bundle';
import 'swiper/css';
import 'swiper/css/pagination';
import 'swiper/css/navigation';

import "./assets/main.css";
import "./assets/base.css";
import { globalConfig } from "./config";

// 注册 Swiper Web Components
register();

document.documentElement.style.setProperty("--global-primary-color", globalConfig.primary_color);
document.documentElement.style.setProperty("--global-primary-color2", globalConfig.primary_color2);
document.documentElement.style.setProperty("--global-primary-color3", globalConfig.primary_color3);
const userData = ref({});

const app = createApp(App);
app.config.globalProperties.$currentUser = userData;
const i18n = createI18n({
  locale: globalConfig.language,
  fallbackLocale: globalConfig.language,
  messages: {
    [globalConfig.language]: globalConfig.language_file,
  },
});
const vfm = createVfm()
app.use(vfm)
app.use(i18n);
app.use(createPinia());
app.use(router);

app.mount("#app");
export default i18n;
