import '@/style/index.scss'
import { VueQueryPlugin } from '@tanstack/vue-query'
import 'virtual:uno.css'
import { createSSRApp } from 'vue'
import App from './App.vue'
import { prototypeInterceptor, requestInterceptor } from './interceptors'
import i18n from './locale/index'
import store from './store'
import Directives from './directives'
import commonMsgBox from './components/commonMsgBox/index.vue'
import commonPopup from './components/commonPopup/index.vue'
import skuInputNumber from './components/sku-input-number/index.vue'
import commonIndexBar from './components/commonIndexBar/index.vue'

export function createApp() {
  const app = createSSRApp(App)
  // 注册全局组件
  app.component('CommonMsgBox', commonMsgBox)
  app.component('CommonPopup', commonPopup)
  app.component('SkuInputNumber', skuInputNumber)
  app.component('CommonIndexBar', commonIndexBar)
  app.use(store)
  app.use(i18n)
  app.use(requestInterceptor)
  app.use(prototypeInterceptor)
  app.use(VueQueryPlugin)
  app.use(Directives)

  return {
    app,
  }
}
