import { createApp } from 'vue'
import LDesign from '@ldesign/desktop-next'
import LDesignProfession from '@ldesign/desktop-profession-next'
import { LeapApi, LeapConfig, LeapRouter, pinia } from '@ldesign/business-next'

import '@ldesign/desktop-next/es/style'
/** 正式环境使用下面的地址 */
// import '@ldesign/desktop-next/es/style/index.css'

import App from '@/App.vue'

/** 通用路由配置 */
const router = new LeapRouter({
  globs: import.meta.glob('@/**/*.vue'),
  baseUrl: import.meta.env.BASE_URL,
  env: import.meta.env,
})

/** 通用api */
export const $api = new LeapApi({ env: import.meta.env })

/** 通用配置 */
const $config = new LeapConfig({
  env: import.meta.env,
})

const app = createApp(App)
  .use(LDesign)
  .use(LDesignProfession)
  .use(pinia)
  .use(router._router)
  .provide('$api', $api)
  .provide('$config', $config)

app.mount('#app')
