'use strict';

var browser = require('./browser-BwmkTmm8.js');

class Orientation {
    /**
     * Is true when the orientation is in portrait mode
     */
    get isPortrait() {
        if (browser.balBrowser.hasWindow && window.matchMedia) {
            return window.matchMedia('(orientation: portrait)').matches;
        }
        return false;
    }
    /**
     * Is true when the orientation is in landscape mode
     */
    get isLandscape() {
        if (browser.balBrowser.hasWindow && window.matchMedia) {
            return window.matchMedia('(orientation: landscape)').matches;
        }
        return true;
    }
    toObject() {
        return {
            landscape: this.isLandscape,
            portrait: this.isPortrait,
        };
    }
}
class BalDevice {
    constructor() {
        this.orientation = new Orientation();
    }
    /**
     * Is true if it is a native mobile device like a iPhone
     */
    get isMobile() {
        return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|OperaMini/i.test(browser.balBrowser.userAgent);
    }
    /**
     * Is true if the device supports touchscreen
     */
    get hasTouchScreen() {
        if (browser.balBrowser.hasWindow && browser.balBrowser.hasNavigator) {
            return !!('ontouchstart' in window || navigator.msMaxTouchPoints);
        }
        return false;
    }
}
const balDevice = new BalDevice();

exports.BalDevice = BalDevice;
exports.balDevice = balDevice;
