import 'virtual:svg-icons-register';
import { createApp, nextTick } from 'vue';
import App from './App.vue';
import router from './router';
import pinia from './store';
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
import 'animate.css';
import './utils/permission';
import { registerDirective } from './directives';
import { registerElIcons } from './plugins/icon';
import VueAMap, { initAMapApiLoader } from '@vuemap/vue-amap';
import '@vuemap/vue-amap/dist/style.css';

// 初始化高德地图 API
initAMapApiLoader({
  key: 'c843a50db7157faf295c6fa37c48719f',
  securityJsCode: 'f09302d3ed65110614bdb26e44717ddf', // 新版key需要配合安全密钥使用
  version: '2.0',
  Loca: {
    version: '2.0',
  },
  AMapUI: {
    plugins: ['misc/PathSimplifier'],
  },
  plugins: ['AMap.MapType'],
});

const app = createApp(App);
nextTick(() => {
  registerElIcons(app);
  registerDirective(app);
});
app.use(pinia).use(router).use(ElementPlus).use(VueAMap).mount('#app');
