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GAAf,UAAgB,KAAQ;QACd,wCAAc,CAAU;QAChC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3B,EAAE,CAAC,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC;YACnC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QACxD,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;IAES,6BAAM,GAAhB,UAAiB,GAAQ;QACf,wCAAc,CAAU;QAChC,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC1B,EAAE,CAAC,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC;YACnC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QACxD,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;IAES,gCAAS,GAAnB;QACU,wCAAc,CAAU;QAChC,cAAc,CAAC,QAAQ,EAAE,CAAC;QAC1B,EAAE,CAAC,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC;YACnC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QACxD,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;QAC9B,CAAC;IACH,CAAC;IACH,mBAAC;AAAD,CAAC,AA7CD,CAA8B,uBAAU,GA6CvC","sourcesContent":["import { Operator } from '../Operator';\nimport { Subscriber } from '../Subscriber';\nimport { Observable } from '../Observable';\nimport { PartialObserver } from '../Observer';\nimport { TeardownLogic } from '../Subscription';\nimport { MonoTypeOperatorFunction } from '../interfaces';\n\n/* tslint:disable:max-line-length */\nexport function tap<T>(next: (x: T) => void, error?: (e: any) => void, complete?: () => void): MonoTypeOperatorFunction<T>;\nexport function tap<T>(observer: PartialObserver<T>): MonoTypeOperatorFunction<T>;\n/* tslint:enable:max-line-length */\n\n/**\n * Perform a side effect for every emission on the source Observable, but return\n * an Observable that is identical to the source.\n *\n * <span class=\"informal\">Intercepts each emission on the source and runs a\n * function, but returns an output which is identical to the source as long as errors don't occur.</span>\n *\n * <img src=\"./img/do.png\" width=\"100%\">\n *\n * Returns a mirrored Observable of the source Observable, but modified so that\n * the provided Observer is called to perform a side effect for every value,\n * error, and completion emitted by the source. Any errors that are thrown in\n * the aforementioned Observer or handlers are safely sent down the error path\n * of the output Observable.\n *\n * This operator is useful for debugging your Observables for the correct values\n * or performing other side effects.\n *\n * Note: this is different to a `subscribe` on the Observable. If the Observable\n * returned by `do` is not subscribed, the side effects specified by the\n * Observer will never happen. `do` therefore simply spies on existing\n * execution, it does not trigger an execution to happen like `subscribe` does.\n *\n * @example <caption>Map every click to the clientX position of that click, while also logging the click event</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var positions = clicks\n * .do(ev => console.log(ev))\n * .map(ev => ev.clientX);\n * positions.subscribe(x => console.log(x));\n *\n * @see {@link map}\n * @see {@link subscribe}\n *\n * @param {Observer|function} [nextOrObserver] A normal Observer object or a\n * callback for `next`.\n * @param {function} [error] Callback for errors in the source.\n * @param {function} [complete] Callback for the completion of the source.\n * @return {Observable} An Observable identical to the source, but runs the\n * specified Observer or callback(s) for each item.\n * @name tap\n */\nexport function tap<T>(nextOrObserver?: PartialObserver<T> | ((x: T) => void),\n error?: (e: any) => void,\n complete?: () => void): MonoTypeOperatorFunction<T> {\n return function tapOperatorFunction(source: Observable<T>): Observable<T> {\n return source.lift(new DoOperator(nextOrObserver, error, complete));\n };\n}\n\nclass DoOperator<T> implements Operator<T, T> {\n constructor(private nextOrObserver?: PartialObserver<T> | ((x: T) => void),\n private error?: (e: any) => void,\n private complete?: () => void) {\n }\n call(subscriber: Subscriber<T>, source: any): TeardownLogic {\n return source.subscribe(new DoSubscriber(subscriber, this.nextOrObserver, this.error, this.complete));\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nclass DoSubscriber<T> extends Subscriber<T> {\n\n private safeSubscriber: Subscriber<T>;\n\n constructor(destination: Subscriber<T>,\n nextOrObserver?: PartialObserver<T> | ((x: T) => void),\n error?: (e: any) => void,\n complete?: () => void) {\n super(destination);\n\n const safeSubscriber = new Subscriber<T>(nextOrObserver, error, complete);\n safeSubscriber.syncErrorThrowable = true;\n this.add(safeSubscriber);\n this.safeSubscriber = safeSubscriber;\n }\n\n protected _next(value: T): void {\n const { safeSubscriber } = this;\n safeSubscriber.next(value);\n if (safeSubscriber.syncErrorThrown) {\n this.destination.error(safeSubscriber.syncErrorValue);\n } else {\n this.destination.next(value);\n }\n }\n\n protected _error(err: any): void {\n const { safeSubscriber } = this;\n safeSubscriber.error(err);\n if (safeSubscriber.syncErrorThrown) {\n this.destination.error(safeSubscriber.syncErrorValue);\n } else {\n this.destination.error(err);\n }\n }\n\n protected _complete(): void {\n const { safeSubscriber } = this;\n safeSubscriber.complete();\n if (safeSubscriber.syncErrorThrown) {\n this.destination.error(safeSubscriber.syncErrorValue);\n } else {\n this.destination.complete();\n }\n }\n}\n"]}