"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "getWindow", {
    enumerable: true,
    get: function() {
        return getWindow;
    }
});
const _reactutilities = require("@fluentui/react-utilities");
let _window = undefined;
// Note: Accessing "window" in IE11 is somewhat expensive, and calling "typeof window"
// hits a memory leak, whereas aliasing it and calling "typeof _window" does not.
// Caching the window value at the file scope lets us minimize the impact.
try {
    _window = window;
} catch (e) {
/* no-op */ }
function getWindow(rootElement) {
    if (!(0, _reactutilities.canUseDOM)() || typeof _window === 'undefined') {
        return undefined;
    } else {
        const el = rootElement;
        return el && el.ownerDocument && el.ownerDocument.defaultView ? el.ownerDocument.defaultView : _window;
    }
}
