"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.noHost = exports.noStorage = void 0;
const APINotImplementedError_1 = require("../exception/APINotImplementedError");
const DisplayMediaAPINotSupported_1 = require("../exception/DisplayMediaAPINotSupported");
const MediaDeviceAPINotSupported_1 = require("../exception/MediaDeviceAPINotSupported");
const Storage_1 = require("../system/platform/api/storage/Storage_");
function noStorage(name) {
    return {
        getItem(key) {
            throw new APINotImplementedError_1.APINotSupportedError(name);
        },
        removeItem(key) {
            throw new APINotImplementedError_1.APINotSupportedError(name);
        },
        setItem(key, value) {
            throw new APINotImplementedError_1.APINotSupportedError(name);
        },
        clear() {
            throw new APINotImplementedError_1.APINotSupportedError(name);
        },
    };
}
exports.noStorage = noStorage;
function noHost() {
    const api = {
        storage: {
            local: () => new Storage_1.Storage_(noStorage('Local Storage')),
            session: () => new Storage_1.Storage_(noStorage('Session Storage')),
        },
        selection: {
            containsSelection: () => {
                throw new APINotImplementedError_1.APINotSupportedError('Selection');
            },
            removeSelection: () => {
                throw new APINotImplementedError_1.APINotSupportedError('Selection');
            },
        },
        file: {
            isSaveFilePickerSupported: () => false,
            isOpenFilePickerSupported: () => false,
            showOpenFilePicker: () => {
                throw new APINotImplementedError_1.APINotSupportedError('File System');
            },
            showSaveFilePicker: () => {
                throw new APINotImplementedError_1.APINotSupportedError('File System');
            },
            downloadText: (opt) => {
                throw new APINotImplementedError_1.APINotSupportedError('Download');
            },
            downloadURL: (opt) => {
                throw new APINotImplementedError_1.APINotSupportedError('Download');
            },
        },
        animation: {
            requestAnimationFrame: () => {
                throw new APINotImplementedError_1.APINotSupportedError('Animation Frame');
            },
            cancelAnimationFrame: () => {
                throw new APINotImplementedError_1.APINotSupportedError('Animation Frame');
            },
        },
        device: {
            vibrate: () => {
                throw new APINotImplementedError_1.APINotSupportedError('Vibrate');
            },
        },
        geolocation: {
            getCurrentPosition: () => {
                throw new APINotImplementedError_1.APINotSupportedError('Geolocation');
            },
        },
        input: {
            keyboard: {},
            gamepad: {
                getGamepad: () => {
                    throw new APINotImplementedError_1.APINotSupportedError('Gamepad');
                },
                addEventListener: (type, listener, options) => {
                    throw new APINotImplementedError_1.APINotSupportedError('Gamepad');
                },
            },
            pointer: {
                getPointerPosition(pointerId) {
                    throw new APINotImplementedError_1.APINotSupportedError('Pointer');
                },
                setPointerCapture(element, pointerId) {
                    throw new APINotImplementedError_1.APINotSupportedError('Pointer Capture');
                },
            },
        },
        media: {
            getUserMedia: () => {
                throw new MediaDeviceAPINotSupported_1.MediaDevicesAPINotSupported();
            },
            getDisplayMedia: () => {
                throw new DisplayMediaAPINotSupported_1.DisplayMediaAPINotSupported();
            },
            enumerateDevices: () => {
                throw new APINotImplementedError_1.APINotSupportedError('Enumerate Media Devices');
            },
            image: {
                createImageBitmap: () => {
                    throw new APINotImplementedError_1.APINotSupportedError('Image Bitmap');
                },
            },
        },
        screen: {
            requestWakeLock: () => {
                throw new APINotImplementedError_1.APINotSupportedError('Screen Wake Lock');
            },
        },
        bluetooth: {
            requestDevice: () => {
                throw new APINotImplementedError_1.APINotSupportedError('Bluetooth');
            },
        },
        clipboard: {
            readText: () => {
                throw new APINotImplementedError_1.APINotSupportedError('Clipboard');
            },
            writeText: () => {
                throw new APINotImplementedError_1.APINotSupportedError('Clipboard');
            },
        },
        http: {
            server: {
                local: function (opt) {
                    throw new APINotImplementedError_1.APINotSupportedError('Local HTTP Server');
                },
                cloud: function (opt) {
                    throw new APINotImplementedError_1.APINotSupportedError('Cloud HTTP Server');
                },
            },
            fetch: () => {
                throw new APINotImplementedError_1.APINotSupportedError('Fetch');
            },
        },
        channel: {
            session: function (opt) {
                throw new APINotImplementedError_1.APINotSupportedError('Session Channel');
            },
            local: function (opt) {
                throw new APINotImplementedError_1.APINotSupportedError('Local Channel');
            },
        },
        speech: {
            SpeechGrammarList: function (opt) {
                throw new APINotImplementedError_1.APINotSupportedError('Speech Recognition');
            },
            SpeechRecognition: function (opt) {
                throw new APINotImplementedError_1.APINotSupportedError('Speech Recognition');
            },
            SpeechSynthesis: function (opt) {
                throw new APINotImplementedError_1.APINotSupportedError('Speech Synthesis');
            },
            SpeechSynthesisUtterance: function (opt) {
                throw new APINotImplementedError_1.APINotSupportedError('Speech Synthesis');
            },
        },
        document: {
            createElement(tagName, options) {
                throw new Error(); // TODO
            },
            createElementNS(namespaceURI, qualifiedName) {
                throw new Error();
            },
            createTextNode(text) {
                throw new Error();
            },
            elementFromPoint(x, y) {
                throw new Error();
            },
            elementsFromPoint(x, y) {
                throw new Error();
            },
            getSelection() {
                // @ts-ignore
                return root.shadowRoot.getSelection() || document.getSelection();
            },
            createRange() {
                return document.createRange();
            },
            MutationObserver: null,
            PositionObserver: null,
            ResizeObserver: null,
        },
        querystring: {
            stringify: function (obj) {
                throw new Error('Function not implemented.');
            },
            parse: function (str) {
                throw new Error('Function not implemented.');
            },
        },
        text: {
            measureText: (text) => {
                throw new APINotImplementedError_1.APINotSupportedError('Measure Text');
            },
        },
        worker: {
            start: () => {
                throw new APINotImplementedError_1.APINotSupportedError('Worker');
            },
        },
        db: undefined,
        url: {
            createObjectURL: function (object) {
                throw new Error('Function not implemented.');
            },
        },
        uri: {
            encodeURI: function (str) {
                throw new APINotImplementedError_1.APINotSupportedError('URI');
            },
        },
        alert: {
            alert: function (message) {
                throw new Error('Function not implemented.');
            },
            prompt: function (message) {
                throw new Error('Function not implemented.');
            },
        },
    };
    return api;
}
exports.noHost = noHost;
//# sourceMappingURL=none.js.map