import warning from 'warning';
var globalObject = (typeof window === 'object' && window) ||
    (typeof globalThis === 'object' && globalThis) ||
    (typeof global === 'object' && global) ||
    Function('return this')();
export function isBrowser(obj) {
    return !!obj && typeof obj.window !== 'undefined';
}
export function getSafeWindow() {
    return globalObject;
}
export function getOwnerGlobalObject(element) {
    if (!element) {
        warning(false, "The 'element' argument is missing. This indicates incorrect type casting and may cause issues in iframes.");
        return globalObject;
    }
    if (element.nodeType === Node.DOCUMENT_NODE && 'defaultView' in element) {
        warning(false, "The 'element' argument is 'document', but 'Element' was expected.");
        return element.defaultView;
    }
    if ('window' in element && element.window === element) {
        warning(false, "The 'element' argument is 'window', but 'Element' was expected.");
        return element;
    }
    if (!element.ownerDocument.defaultView) {
        warning(false, "The 'element.ownerDocument.defaultView' is missing. This is an unexpected edge case.");
        return globalObject;
    }
    return element.ownerDocument.defaultView;
}
//# sourceMappingURL=globalObject.js.map