"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 MethodNotImplementedError_1 = require("../exception/MethodNotImplementedError");
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')),
        },
        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');
            },
            fallbackShowOpenFilePicker: () => {
                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: {
            read: () => {
                throw new APINotImplementedError_1.APINotSupportedError('Clipboard');
            },
            readText: () => {
                throw new APINotImplementedError_1.APINotSupportedError('Clipboard');
            },
            writeText: () => {
                throw new APINotImplementedError_1.APINotSupportedError('Clipboard');
            },
        },
        http: {
            fetch: () => {
                throw new APINotImplementedError_1.APINotSupportedError('Fetch');
            },
            EventSource: undefined,
            listen: function (port, handler) {
                throw new APINotImplementedError_1.APINotSupportedError('HTTP Server');
            },
        },
        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 MethodNotImplementedError_1.MethodNotImplementedError();
            },
            createElementNS(namespaceURI, qualifiedName) {
                throw new MethodNotImplementedError_1.MethodNotImplementedError();
            },
            createTextNode(text) {
                throw new MethodNotImplementedError_1.MethodNotImplementedError();
            },
            elementFromPoint(x, y) {
                throw new MethodNotImplementedError_1.MethodNotImplementedError();
            },
            elementsFromPoint(x, y) {
                throw new MethodNotImplementedError_1.MethodNotImplementedError();
            },
            getSelection() {
                // @ts-ignore
                return root.shadowRoot.getSelection() || document.getSelection();
            },
            createRange() {
                return document.createRange();
            },
            exitPictureInPicture() {
                throw new MethodNotImplementedError_1.MethodNotImplementedError();
            },
            setTheme: function (theme) {
                throw new MethodNotImplementedError_1.MethodNotImplementedError();
            },
            MutationObserver: null,
            PositionObserver: null,
            ResizeObserver: null,
            IntersectionObserver: null,
        },
        querystring: {
            stringify: function (obj) {
                throw new MethodNotImplementedError_1.MethodNotImplementedError();
            },
            parse: function (str) {
                throw new MethodNotImplementedError_1.MethodNotImplementedError();
            },
        },
        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 MethodNotImplementedError_1.MethodNotImplementedError();
            },
        },
        uri: {
            encodeURI: function (str) {
                throw new APINotImplementedError_1.APINotSupportedError('URI');
            },
        },
        alert: {
            alert: function (message) {
                throw new MethodNotImplementedError_1.MethodNotImplementedError();
            },
            prompt: function (message) {
                throw new MethodNotImplementedError_1.MethodNotImplementedError();
            },
        },
        location: {
            toString: function () {
                throw new MethodNotImplementedError_1.MethodNotImplementedError();
            },
        },
        window: {
            open: function (url, target, features) {
                throw new MethodNotImplementedError_1.MethodNotImplementedError();
            },
            AudioContext: undefined,
            OscillatorNode: undefined,
            MediaStreamAudioSourceNode: undefined,
            AnalyserNode: undefined,
            GainNode: undefined,
            DelayNode: undefined,
            ImageCapture: undefined,
            CompressionStream: undefined,
            DecompressionStream: undefined,
            ReadableStream: undefined,
            getComputedStyle: function (element) {
                throw new MethodNotImplementedError_1.MethodNotImplementedError();
            },
        },
        navigator: {
            share: function (data) {
                throw new MethodNotImplementedError_1.MethodNotImplementedError();
            },
        },
        layout: {
            reflectChildrenTrait: function (parentTrait, parentStyle, children, path, expandChild) {
                throw new MethodNotImplementedError_1.MethodNotImplementedError();
            },
        },
        history: {
            pushState: function (data, title, url) {
                throw new MethodNotImplementedError_1.MethodNotImplementedError();
            },
            replaceState: function (data, title, url) {
                throw new MethodNotImplementedError_1.MethodNotImplementedError();
            },
        },
    };
    return api;
}
exports.noHost = noHost;
//# sourceMappingURL=none.js.map