import { isNotNil } from '@angular-ru/cdk/utils';

// eslint-disable-next-line max-lines-per-function
function unpatchEvents() {
    var _a;
    if (typeof window !== 'undefined') {
        const windowInstance = window;
        if (isNotNil(windowInstance.Zone)) {
            throw new Error('You must import `@angular-ru/cdk/zone.js/unpatch-events` before importing rxjs');
        }
        windowInstance.__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
        windowInstance.__Zone_disable_on_property = true; // disable patch onProperty such as onclick
        windowInstance.__zone_symbol__UNPATCHED_EVENTS = [
            'scroll',
            'mouseenter',
            'mouseleave',
            'mousemove',
            'mouseover',
            'mouseout',
            'mousewheel',
            'message'
        ];
        // black list scroll event handler for onProp
        const targets = [window, Document, HTMLBodyElement, HTMLElement, document.body, WebSocket];
        windowInstance.__Zone_ignore_on_properties = [];
        for (const target of targets) {
            (_a = windowInstance.__Zone_ignore_on_properties) === null || _a === void 0 ? void 0 : _a.push({
                target,
                ignoreProperties: [
                    'scroll',
                    'mouseenter',
                    'mouseleave',
                    'mousemove',
                    'mouseover',
                    'mouseout',
                    'mousewheel',
                    'dragover',
                    'drop',
                    'close',
                    'error',
                    'open',
                    'message'
                ]
            });
        }
    }
}

// Note: without export the current library is not compiled
// Note: we should invoke before running zone.js
unpatchEvents();

/**
 * Generated bundle index. Do not edit.
 */

export { unpatchEvents };
//# sourceMappingURL=angular-ru-cdk-zone-js-unpatch.js.map
