import { deprecate } from '../../util/console';
import Vue from 'vue';
/* @vue/component */

export default Vue.extend({
  name: 'mobile',
  props: {
    mobileBreakpoint: {
      type: [Number, String],

      default() {
        // Avoid destroying unit
        // tests for users
        return this.$ifrontui ? this.$ifrontui.breakpoint.mobileBreakpoint : undefined;
      },

      validator: v => !isNaN(Number(v)) || ['xs', 'sm', 'md', 'lg', 'xl'].includes(String(v))
    }
  },
  computed: {
    isMobile() {
      const {
        mobile,
        width,
        name,
        mobileBreakpoint
      } = this.$ifrontui.breakpoint; // Check if local mobileBreakpoint matches
      // the application's mobileBreakpoint

      if (mobileBreakpoint === this.mobileBreakpoint) return mobile;
      const mobileWidth = parseInt(this.mobileBreakpoint, 10);
      const isNumber = !isNaN(mobileWidth);
      return isNumber ? width < mobileWidth : name === this.mobileBreakpoint;
    }

  },

  created() {
    /* istanbul ignore next */
    if (this.$attrs.hasOwnProperty('mobile-break-point')) {
      deprecate('mobile-break-point', 'mobile-breakpoint', this);
    }
  }

});
//# sourceMappingURL=index.js.map