import { createApp } from 'vue';
import pinia from '/@/stores/index';
import App from './App.vue';
import router from './router';
import { directive } from '/@/directive';
import Components from '/@/components';
import { i18n } from '/@/i18n';
import { properties } from '/@/utils/globalProperties';
import { initAntiDebug } from './utils/antiDebug';

// Initialize anti-debug protection
initAntiDebug();

// 导入全局样式
import '/@/theme/tailwind.css';
import '/@/theme/index.scss';
// 导入 Font Awesome
import '@fortawesome/fontawesome-free/css/all.css';

import { ConvertName, ConvertRoleName, ConvertGroupName, dynamicImport } from '/@/flow/components/index';
import { DIC_PROP } from '/@/flow/support/dict-prop';
import { PROP_CONST } from "/@/flow/support/prop-const";
import {validateRunFlow, getLabelByLanguage} from "/@/flow";
import {validateNull} from "/@/utils/validate";

const app = createApp(App);

// 导入通用自定义组件
app.component('ConvertName', ConvertName);
app.component('ConvertRoleName', ConvertRoleName);
app.component('ConvertGroupName', ConvertGroupName);
// 全局方法挂载
app.config.globalProperties.DIC_PROP = DIC_PROP;
app.config.globalProperties.PROP_CONST = PROP_CONST;
app.config.globalProperties.validateRunFlow = validateRunFlow;
app.config.globalProperties.getLabelByLanguage = getLabelByLanguage;
app.config.globalProperties.validateNull = validateNull;

// 全局自定方法挂载
properties(app);
// 全局自定义指令挂载
directive(app);
dynamicImport(app);
app
	.use(pinia) // pinia 存储
	.use(router) // 路由
	.use(Components) // 全局引入自定义的组件&第三方的组件
	.use(i18n) // 国际化
	.mount('#app');
