// @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 tool from '@/utils/uni-tool'
import * as Pinia from 'pinia';
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import { useImage } from '@/hooks/useImage';

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

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

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

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

  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)' }) },
        animationEnabled: { default: true } // 滚动时是否带有动画
      },
      steps: {
        activeColor: { default: 'var(--primary-color)' }
      },
      search: {
        color: { default: 'var(--main-color)' },
        actionStyle: { default: () => ({ color: 'var(--primary-color)' }) }
      },
      empty: {
        icon: { default: '/static/icon-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
        }
      },
      collapseItem: {
        padding: {
          default: '12px 15px;'
        },
        data: { default: null },
        lazy: { default: false },
        load: { default: null }
      },
      input: {
        fontSize: { default: '30rpx' },
        disabledColor: { default: 'var(--back-light)' },
        customStyle: {
          default: () => ({
            height: '30px',
            paddingLeft: '40rpx',
            paddingRight: '40rpx',
            borderRadius: '24rpx'
          })
        }
      },
      tags: {
        customClass: {
          default: ''
        }
      }
    }
  })

  const { resolvePath } = useImage();
  uni.$zp = {
    config: {
      'default-page-size': 20,
      'refresher-title-style': {
        fontSize: '28rpx'
      },
      'loading-more-title-custom-style': {
        fontSize: '26rpx'
      },
      // 底部安全区域以placeholder形式实现
      'use-safe-area-placeholder': true
      // 'empty-view-img-style': {
      //   width: '364rpx',
      //   height: '252rpx'
      // },
      // 'empty-view-img': resolvePath('/pagesStudy/static/image/icon-empty.png'),
      // 'empty-view-title-style': {
      //   color: '#B3B3B3',
      //   fontSize: '30rpx',
      //   marginTop: '40rpx'
      // },
      // 'empty-view-style': {
      //   marginTop: '-200rpx'
      // }
    }
  }

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

  return {
    app
  }
}

// #endif
