"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.webDocument = void 0;
const MutationObserver_1 = require("../../../MutationObserver_");
const PositionObserver_1 = require("../../../PositionObserver");
const ResizeObserver_1 = require("../../../ResizeObserver_");
function webDocument(window, root, opt) {
    const { document } = window;
    // @ts-ignore
    const MutationObserver = window.MutationObserver || MutationObserver_1.MutationObserver_;
    // @ts-ignore
    const ResizeObserver = window.ResizeObserver || ResizeObserver_1.ResizeObserver_;
    const _document = {
        createElement(tagName) {
            return document.createElement(tagName);
        },
        createElementNS(namespaceURI, qualifiedName) {
            return document.createElementNS(namespaceURI, qualifiedName);
        },
        createTextNode(text) {
            return document.createTextNode(text);
        },
        elementFromPoint(x, y) {
            return root.shadowRoot.elementFromPoint(x, y);
        },
        elementsFromPoint(x, y) {
            return root.shadowRoot.elementsFromPoint(x, y);
        },
        getSelection() {
            // @ts-ignore
            return root.shadowRoot.getSelection() || document.getSelection();
        },
        createRange() {
            return document.createRange();
        },
        MutationObserver: MutationObserver,
        ResizeObserver: ResizeObserver,
        PositionObserver: PositionObserver_1.PositionObserver,
    };
    return _document;
}
exports.webDocument = webDocument;
//# sourceMappingURL=document.js.map