import Vue from 'vue';
import '@/assets/css/transition.css';

import '@/plugins/Filters/index';

import '@/plugins/Directive/index';

import Swiper from 'swiper/dist/js/swiper.js';
import 'swiper/dist/css/swiper.css';
Vue.prototype.$swiper = Swiper;

import Layer from '@/plugins/Layer/index';
import '@/plugins/Layer/style.css';
Vue.prototype.$layer = Layer;

import md5 from 'js-md5';
Vue.prototype.$md5 = md5;
Vue.prototype.$redSV = {
  rob: 'ROB_RED_PACKET_SV',
  open: 'OPEN_RED_PACKET_SV'
};

import filterXSS from 'xss'
Vue.prototype.$filterXSS = (params) => filterXSS(params)

import VueLazyload from 'vue-lazyload';
const errorImg = require('@/assets/img/error.png');
const loadingImg = require('@/assets/img/loading.png');
Vue.use(VueLazyload, {
  preLoad: 1.3,
  error: errorImg,
  loading: loadingImg,
  attempt: 1
});

const Bus = {
  install: () => {
    Vue.prototype.$Bus = new Vue();
  }
};
Vue.use(Bus);

if (process.client) {
  if (!process.env.private) {
    require('@/plugins/arms');
    if (process.env.X_CA_STAGE) {
      // const Inkmarks = require('@gdyfe/ink-marks');
      // Vue.prototype.$inkmarks = Inkmarks;
    }
  }
  const Cookie = require('js-cookie');
  Vue.prototype.$cookie = Cookie;
  require('@/plugins/deviceId');

  const PhotoSwipe = require('vue-photoswipe.js');
  require('vue-photoswipe.js/dist/static/css/photoswipe.css');
  Vue.use(PhotoSwipe.default, {
    wechat: window.wx,
    pswpOptions: {
      showShare: false,
      showClose: true,
      showFullscreen: false,
      showZoom: false
    }
  });
}
