// @ts-nocheck
import App from './App'
import uvUiTools from "@/uni_modules/uv-ui-tools";
// #ifdef H5
import "@/uni.webview.1.5.6"
import './common/webview.bridge'
import './preload'
// #endif
import { useRequest } from '@/utils/request'
import tool from '@/utils/uni-tool'
import * as Pinia from 'pinia';
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'

// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'

Vue.config.productionTip = false
Vue.use(uvUiTools)
useRequest(Vue)
App.mpType = 'app'
const app = new Vue({
  ...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
import { useTheme } from "@/hooks/useTheme";
import "./static/style/tailwind.scss";

export function createApp() {
  const app = createSSRApp(App)
  useRequest(app)
  app.use(uvUiTools)

  const { setTheme } = useTheme()
  setTheme()

  uni.$ie = tool;

  uni.$uv.setConfig({
    props: {
      loadingPage: {
        loadingText: { default: '' },
        image: { default: '/static/logo/loading1.gif' },
        class: { default: 'mx-loading-page' }
      },
      navbar: {
        placeholder: { default: true },
        clickHover: { default: true },
        statusBarHeight: { default: 0 }
      },
      statusBar: {
        statusBarHeight: { default: 0 }
      },
      tabs: {
        activeStyle: { default: () => ({ color: 'var(--primary-color)' }) }
      },
      steps: {
        activeColor: { default: 'var(--primary-color)' }
      },
      search: {
        color: { default: 'var(--main-color)' },
        actionStyle: { default: () => ({ color: 'var(--primary-color)' }) }
      },
      empty: {
        icon: { default: '/static/mescroll-empty.png' },
        height: { default: 140 },
        width: { default: 140 },
        text: { default: '暂无相关数据' }
      },
      icon: {
        customClass: {
          default: ''
        }
      },
      popup: {
        theme: {
          default: 'theme-ie'
        }
      },
      image: {
        customClass: {
          default: ''
        }
      },
      cell: {
        disableHover: {
          default: false
        }
      }
    }
  })

  const pinia = Pinia.createPinia();
  app.use(pinia);
  pinia.use(piniaPluginPersistedstate);

  return {
    app
  }
}

// #endif
