import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

import BaseTable from '@comp/BaseTable.vue'
import AuthButton from '@comp/AuthButton.vue'

import '@/styles/common.less'
import '@/styles/layout.less'
import '@/styles/theme.less'

const app = createApp(App)

const pinia = createPinia()
pinia.use(piniaPluginPersistedstate)

app.use(pinia)
app.use(router)
app.use(ElementPlus, { locale: zhCn })

app.component('BaseTable', BaseTable)
app.component('ElAuthButton', AuthButton)

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.mount('#app')

window.document.title = import.meta.env.VITE_APP_TITLE
