// 引入unocss css
import '@/config/plugins/unocss'

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

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

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

// 引入全局样式
import '@/config/styles/index.scss'

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

// 路由
import router, { setupRouter } from '@/router'

import { createApp } from 'vue'

import App from './App.vue'

import './permission'

import VueDOMPurifyHTML from 'vue-dompurify-html' // 解决v-html 的安全隐患

// 自定义插件
import VideoPopup from '@/components/Video/install'
import ImagePopup from '@/components/ImageView/install'

// 自定义指令
import { setupAuth } from '@/config/directives'

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

  const app = createApp(App)

  setupStore(app)

  setupElementPlus(app)

  setupRouter(app)

  setupAuth(app)

  await router.isReady()

  app.use(VueDOMPurifyHTML)

  app.use(VideoPopup)
  app.use(ImagePopup)

  app.mount('#app')

  // 清除警告，规范排查时请开启
  app.config.warnHandler = () => {}

}

setupAll()

