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AAC;AACD,eAAe,yBAAyB,CAAC\"}","code":"/** @license\r\n *  Copyright 2016 - present The Material Motion Authors. All Rights Reserved.\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\r\n *  use this file except in compliance with the License. You may obtain a copy\r\n *  of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\r\n *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\r\n *  License for the specific language governing permissions and limitations\r\n *  under the License.\r\n */\r\nimport { MotionObservable, } from '../observables/MotionObservable';\r\n// Passive event feature detection from\r\n// https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md\r\nlet supportsPassiveListeners = false;\r\ntry {\r\n    const eventOptions = Object.defineProperty({}, 'passive', {\r\n        get() {\r\n            supportsPassiveListeners = true;\r\n        }\r\n    });\r\n    window.addEventListener(\"test\", () => { }, eventOptions);\r\n}\r\ncatch (e) { }\r\nexport function getEventStreamFromElement(type, element, eventListenerOptions = { passive: true }) {\r\n    return new MotionObservable((observer) => {\r\n        if (!supportsPassiveListeners) {\r\n            eventListenerOptions = (eventListenerOptions.capture || false);\r\n        }\r\n        const next = observer.next.bind(observer);\r\n        // For some reason, TypeScript has an interface for\r\n        // AddEventListenerOptions, but its addEventListener signature hasn't been\r\n        // updated to use it, so for now, we manually cast to boolean.\r\n        //\r\n        // https://github.com/Microsoft/TypeScript/issues/18136\r\n        element.addEventListener(type, next, eventListenerOptions);\r\n        return () => {\r\n            element.removeEventListener(type, next, eventListenerOptions);\r\n        };\r\n    });\r\n}\r\nexport default getEventStreamFromElement;\r\n//# sourceMappingURL=getEventStreamFromElement.js.map","dts":{"name":"/Users/brentons/Projects/material-motion-js/packages/core/dom/getEventStreamFromElement.d.ts","text":"import { ObservableWithMotionOperators } from '../types';\r\nexport declare function getEventStreamFromElement<U extends Event = Event>(type: string, element: Element, eventListenerOptions?: AddEventListenerOptions): ObservableWithMotionOperators<U>;\r\nexport default getEventStreamFromElement;\r\n"}}
