import { createApp } from 'vue'
import { initStore } from './store'
import { initRouter } from './router'
import App from './App.vue'

//ele
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'

import '@/styles/global.scss'

import vue3TreeOrg from 'vue3-tree-org';
import "vue3-tree-org/lib/vue3-tree-org.css";


import 'froala-editor/js/plugins.pkgd.min.js';
//Import third party plugins
import 'froala-editor/js/third_party/embedly.min';
import 'froala-editor/js/third_party/font_awesome.min';
import 'froala-editor/js/third_party/spell_checker.min';
import 'froala-editor/js/third_party/image_tui.min';
// Import Froala Editor css files.
import 'froala-editor/css/froala_editor.pkgd.min.css';
import 'froala-editor/css/froala_style.min.css';

import icons from '@/utils/icon.js'

import moment from 'moment';
import 'moment/dist/locale/zh-cn'; // 引入中文语言包

// 设置全局默认语言环境为简体中文
moment.locale('zh-cn');

import VueFroala from 'vue-froala-wysiwyg';

import {registerComponents} from "@/utils/registryComponents"

import 'vue-datepicker-next/index.css';
import 'vue-datepicker-next/locale/zh-cn';

function setupApp() {
  const app = createApp(App)
  initStore(app)
  app.config.globalProperties.$icons = icons

  initRouter(app)
  
  // 注册全局组件
  registerComponents(app)

  app.use(ElementPlus,{locale: zhCn,size: 'large'})
  app.use(vue3TreeOrg)
  app.use(VueFroala);
  app.mount('#app')
}

setupApp()