{"version":3,"file":"first.js","sourceRoot":"","sources":["../../src/operator/first.ts"],"names":[],"mappings":";AACA,sBAAqC,oBAAoB,CAAC,CAAA;AAuB1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,eAAiD,SAAuE,EAC5F,cAAwD,EACxD,YAAgB;IAC1C,MAAM,CAAC,aAAW,CAAC,SAAS,EAAE,cAAqB,EAAE,YAAY,CAAC,CAAC,IAAI,CAAC,CAAC;AAC3E,CAAC;AAJe,aAAK,QAIpB,CAAA","sourcesContent":["import { Observable } from '../Observable';\nimport { first as higherOrder } from '../operators/first';\n\n/* tslint:disable:max-line-length */\nexport function first(this: Observable,\n predicate: (value: T, index: number, source: Observable) => value is S): Observable;\nexport function first(this: Observable,\n predicate: (value: T | S, index: number, source: Observable) => value is S,\n resultSelector: (value: S, index: number) => R, defaultValue?: R): Observable;\nexport function first(this: Observable,\n predicate: (value: T, index: number, source: Observable) => value is S,\n resultSelector: void,\n defaultValue?: S): Observable;\nexport function first(this: Observable,\n predicate?: (value: T, index: number, source: Observable) => boolean): Observable;\nexport function first(this: Observable,\n predicate: (value: T, index: number, source: Observable) => boolean,\n resultSelector?: (value: T, index: number) => R,\n defaultValue?: R): Observable;\nexport function first(this: Observable,\n predicate: (value: T, index: number, source: Observable) => boolean,\n resultSelector: void,\n defaultValue?: T): Observable;\n\n/**\n * Emits only the first value (or the first value that meets some condition)\n * emitted by the source Observable.\n *\n * Emits only the first value. Or emits only the first\n * value that passes some test.\n *\n * \n *\n * If called with no arguments, `first` emits the first value of the source\n * Observable, then completes. If called with a `predicate` function, `first`\n * emits the first value of the source that matches the specified condition. It\n * may also take a `resultSelector` function to produce the output value from\n * the input value, and a `defaultValue` to emit in case the source completes\n * before it is able to emit a valid value. Throws an error if `defaultValue`\n * was not provided and a matching element is not found.\n *\n * @example Emit only the first click that happens on the DOM\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.first();\n * result.subscribe(x => console.log(x));\n *\n * @example Emits the first click that happens on a DIV\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.first(ev => ev.target.tagName === 'DIV');\n * result.subscribe(x => console.log(x));\n *\n * @see {@link filter}\n * @see {@link find}\n * @see {@link take}\n *\n * @throws {EmptyError} Delivers an EmptyError to the Observer's `error`\n * callback if the Observable completes before any `next` notification was sent.\n *\n * @param {function(value: T, index: number, source: Observable): boolean} [predicate]\n * An optional function called with each item to test for condition matching.\n * @param {function(value: T, index: number): R} [resultSelector] A function to\n * produce the value on the output Observable based on the values\n * and the indices of the source Observable. The arguments passed to this\n * function are:\n * - `value`: the value that was emitted on the source.\n * - `index`: the \"index\" of the value from the source.\n * @param {R} [defaultValue] The default value emitted in case no valid value\n * was found on the source.\n * @return {Observable} An Observable of the first item that matches the\n * condition.\n * @method first\n * @owner Observable\n */\nexport function first(this: Observable, predicate?: (value: T, index: number, source: Observable) => boolean,\n resultSelector?: ((value: T, index: number) => R) | void,\n defaultValue?: R): Observable {\n return higherOrder(predicate, resultSelector as any, defaultValue)(this);\n}\n"]}