import { createApp } from 'vue'
import { createPinia } from 'pinia'

import 'element-plus/theme-chalk/src/index.scss'
import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import VueAMap, { initAMapApiLoader } from '@vuemap/vue-amap'

const app = createApp(App)

initAMapApiLoader({
  // 在这里替换成你申请的 Key
  key: '5a5935de1c13991663c5b222e1ad2392',
  // 你需要使用的插件列表
  plugins: ['AMap.ToolBar', 'AMap.Scale', 'AMap.Geolocation', 'AMap.Geocoder'],
  // 其他安全密钥等配置
  securityJsCode: '52dec9705905111f788fcc1ba9b385d6', // 如果你设置了安全密钥
})

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.use(router)

app.use(ElementPlus, {
  locale: zhCn,
})
app.use(createPinia())
app.use(VueAMap)
app.mount('#app')
