import Vue from 'vue'
import App from './App.vue'
import router from './router'

import KissUI from '@thing.js/kiss-ui'
import '@thing.js/kiss-ui/dist/styles/kiss-ui-proxima.css'
import PropertyPanel from '@uino/thing-ui-property-panel'
import '@uino/thing-ui-property-panel/dist/style/dark-blue.css'
import * as clickOutside from './directives/v-click-outside-x'
import prefabMapData from './locale/prefab'

Vue.config.productionTip = false

Vue.use(KissUI)
Vue.use(PropertyPanel, {
  mediaUpload: {
    url: '/local-api/upload',
    transformResponse(data) {
      return data.data.url
    },
  },
  mediaPreview: {},
  imageUpload: {
    url: '/local-api/upload',
    config: {
      successCode: 200,
      fieldName: 'file',
    },
    level: 'data.url',
  },
  imagePreview: (value) => {
    // console.log('value', value)
  },
  videoUpload: {
    url: '/local-api/upload',
    config: {
      successCode: 200,
      fieldName: 'file',
    },
    level: 'data.url',
  },
})

Vue.use(clickOutside)

PropertyPanel.i18n.loadLocalData(prefabMapData, 'zh_CN')

window.Vue = Vue // 用于 conch 组件

new Vue({
  router,
  render: (h) => h(App),
}).$mount('#app')
