{"map":"{\"version\":3,\"file\":\"dedupe.js\",\"sourceRoot\":\"\",\"sources\":[\"../../../src/operators/dedupe.ts\"],\"names\":[],\"mappings\":\"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAkBxC,MAAM,qBAA6F,UAAa;IAC9G,MAAM,CAAC,KAAM,SAAQ,UAAU;QAC7B;;WAEG;QACH,MAAM,CAAC,EAAE,QAAQ,GAAG,SAAS,EAAE,GAAG,EAAE;YAClC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC;gBACxB,SAAS,CAAC,EAAE,IAAI,EAAE;oBAChB,IAAI,OAAO,GAAG,KAAK,CAAC;oBACpB,IAAI,SAAY,CAAC;oBAEjB,MAAM,CAAC,CAAC,EAAE,QAAQ,EAAE;wBAClB,EAAE,CAAC,CAAC,OAAO,IAAI,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;4BAC7C,MAAM,CAAC;wBACT,CAAC;wBAED,gEAAgE;wBAChE,8CAA8C;wBAC9C,SAAS,GAAG,QAAQ,CAAC;wBACrB,OAAO,GAAG,IAAI,CAAC;wBAEf,IAAI,CAAC,QAAQ,CAAC,CAAC;oBACjB,CAAC,CAAC;gBACJ,CAAC;aACF,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,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 { deepEqual } from 'fast-equals';\r\nexport function withDedupe(superclass) {\r\n    return class extends superclass {\r\n        /**\r\n         * Ensures that every emission is different than the previous one.\r\n         */\r\n        dedupe({ areEqual = deepEqual } = {}) {\r\n            return this._nextOperator({\r\n                operation({ emit }) {\r\n                    let emitted = false;\r\n                    let lastValue;\r\n                    return ({ upstream }) => {\r\n                        if (emitted && areEqual(upstream, lastValue)) {\r\n                            return;\r\n                        }\r\n                        // To prevent a potential infinite loop, these flags must be set\r\n                        // before emitting the result to the observer.\r\n                        lastValue = upstream;\r\n                        emitted = true;\r\n                        emit(upstream);\r\n                    };\r\n                }\r\n            });\r\n        }\r\n    };\r\n}\r\n//# sourceMappingURL=dedupe.js.map","dts":{"name":"/Users/brentons/Projects/material-motion-js/packages/core/operators/dedupe.d.ts","text":"import { Constructor, EqualityCheck, ObservableWithFoundationalMotionOperators, ObservableWithMotionOperators } from '../types';\r\nexport declare type DedupeArgs = {\r\n    areEqual?: EqualityCheck;\r\n};\r\nexport interface MotionDeduplicable<T> {\r\n    dedupe(kwargs?: DedupeArgs): ObservableWithMotionOperators<T>;\r\n}\r\nexport declare function withDedupe<T, S extends Constructor<ObservableWithFoundationalMotionOperators<T>>>(superclass: S): S & Constructor<MotionDeduplicable<T>>;\r\n"}}
