import { b as balBrowser } from './browser.js';

class Orientation {
    /**
     * Is true when the orientation is in portrait mode
     */
    get isPortrait() {
        if (balBrowser.hasWindow && window.matchMedia) {
            return window.matchMedia('(orientation: portrait)').matches;
        }
        return false;
    }
    /**
     * Is true when the orientation is in landscape mode
     */
    get isLandscape() {
        if (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(balBrowser.userAgent);
    }
    /**
     * Is true if the device supports touchscreen
     */
    get hasTouchScreen() {
        if (balBrowser.hasWindow && balBrowser.hasNavigator) {
            return !!('ontouchstart' in window || navigator.msMaxTouchPoints);
        }
        return false;
    }
}
const balDevice = new BalDevice();

export { BalDevice as B, balDevice as b };
