
import { isStandalone, isSafari } from './browser.js';
import { mainWindow } from './window.js';
import { isNative } from '../common/platform.js';

var KeyboardSupport;
(function (KeyboardSupport) {
    KeyboardSupport[KeyboardSupport["Always"] = 0] = "Always";
    KeyboardSupport[KeyboardSupport["FullScreen"] = 1] = "FullScreen";
    KeyboardSupport[KeyboardSupport["None"] = 2] = "None";
})(KeyboardSupport || (KeyboardSupport = {}));
const BrowserFeatures = {
    clipboard: {
        writeText: (isNative
            || (document.queryCommandSupported && document.queryCommandSupported('copy'))
            || !!(navigator && navigator.clipboard && navigator.clipboard.writeText)),
        readText: (isNative
            || !!(navigator && navigator.clipboard && navigator.clipboard.readText))
    },
    keyboard: (() => {
        if (isNative || isStandalone()) {
            return KeyboardSupport.Always;
        }
        if (navigator.keyboard || isSafari) {
            return KeyboardSupport.FullScreen;
        }
        return KeyboardSupport.None;
    })(),
    touch: 'ontouchstart' in mainWindow || navigator.maxTouchPoints > 0,
    pointerEvents: mainWindow.PointerEvent && ('ontouchstart' in mainWindow || navigator.maxTouchPoints > 0)
};

export { BrowserFeatures, KeyboardSupport };
