import 'vue/jsx'

// 引入windi css
import '@common/src/plugins/unocss'

// 导入全局的svg图标
import '@common/src/plugins/svgIcon'

// 初始化多语言
import { setupI18n } from '@common/src/plugins/vueI18n'

// 引入状态管理
import { setupStore } from '@common/src/store'

// 全局组件
import { setupGlobCom } from '@common/src/components'

// 引入element-plus
import { setupElementPlus } from '@common/src/plugins/elementPlus'

// 引入全局样式
import '@common/src/styles/index.less'

// 引入动画
import '@common/src/plugins/animate.css'

// 路由
import { setupRouter } from './router'

// 权限
import { setupPermission } from '@common/src/directives'

import { createApp } from 'vue'

import App from '@common/src/App.vue'

import './permission'

import * as icons from '@element-plus/icons'

// 创建实例
const setupAll = async () => {
  const app = createApp(App)

  Object.keys(icons).forEach((key) => {
    app.component(key, icons[key])
  })

  await setupI18n(app)

  setupStore(app)

  setupGlobCom(app)

  setupElementPlus(app)

  setupRouter(app)

  setupPermission(app)

  app.mount('#app')
}

setupAll()
