{"ast":null,"code":"import _inherits from \"C:/Users/kgamal/Downloads/HijriGregorianDatepicker-master/HijriGregorianDatepicker-master/node_modules/@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"C:/Users/kgamal/Downloads/HijriGregorianDatepicker-master/HijriGregorianDatepicker-master/node_modules/@babel/runtime/helpers/esm/createSuper\";\nimport _classCallCheck from \"C:/Users/kgamal/Downloads/HijriGregorianDatepicker-master/HijriGregorianDatepicker-master/node_modules/@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"C:/Users/kgamal/Downloads/HijriGregorianDatepicker-master/HijriGregorianDatepicker-master/node_modules/@babel/runtime/helpers/esm/createClass\";\nimport { map } from './map';\nimport { from } from '../observable/from';\nimport { SimpleOuterSubscriber, SimpleInnerSubscriber, innerSubscribe } from '../innerSubscribe';\nexport function exhaustMap(project, resultSelector) {\n  if (resultSelector) {\n    return function (source) {\n      return source.pipe(exhaustMap(function (a, i) {\n        return from(project(a, i)).pipe(map(function (b, ii) {\n          return resultSelector(a, b, i, ii);\n        }));\n      }));\n    };\n  }\n\n  return function (source) {\n    return source.lift(new ExhaustMapOperator(project));\n  };\n}\n\nvar ExhaustMapOperator = /*#__PURE__*/function () {\n  function ExhaustMapOperator(project) {\n    _classCallCheck(this, ExhaustMapOperator);\n\n    this.project = project;\n  }\n\n  _createClass(ExhaustMapOperator, [{\n    key: \"call\",\n    value: function call(subscriber, source) {\n      return source.subscribe(new ExhaustMapSubscriber(subscriber, this.project));\n    }\n  }]);\n\n  return ExhaustMapOperator;\n}();\n\nvar ExhaustMapSubscriber = /*#__PURE__*/function (_SimpleOuterSubscribe) {\n  _inherits(ExhaustMapSubscriber, _SimpleOuterSubscribe);\n\n  var _super = _createSuper(ExhaustMapSubscriber);\n\n  function ExhaustMapSubscriber(destination, project) {\n    var _this;\n\n    _classCallCheck(this, ExhaustMapSubscriber);\n\n    _this = _super.call(this, destination);\n    _this.project = project;\n    _this.hasSubscription = false;\n    _this.hasCompleted = false;\n    _this.index = 0;\n    return _this;\n  }\n\n  _createClass(ExhaustMapSubscriber, [{\n    key: \"_next\",\n    value: function _next(value) {\n      if (!this.hasSubscription) {\n        this.tryNext(value);\n      }\n    }\n  }, {\n    key: \"tryNext\",\n    value: function tryNext(value) {\n      var result;\n      var index = this.index++;\n\n      try {\n        result = this.project(value, index);\n      } catch (err) {\n        this.destination.error(err);\n        return;\n      }\n\n      this.hasSubscription = true;\n\n      this._innerSub(result);\n    }\n  }, {\n    key: \"_innerSub\",\n    value: function _innerSub(result) {\n      var innerSubscriber = new SimpleInnerSubscriber(this);\n      var destination = this.destination;\n      destination.add(innerSubscriber);\n      var innerSubscription = innerSubscribe(result, innerSubscriber);\n\n      if (innerSubscription !== innerSubscriber) {\n        destination.add(innerSubscription);\n      }\n    }\n  }, {\n    key: \"_complete\",\n    value: function _complete() {\n      this.hasCompleted = true;\n\n      if (!this.hasSubscription) {\n        this.destination.complete();\n      }\n\n      this.unsubscribe();\n    }\n  }, {\n    key: \"notifyNext\",\n    value: function notifyNext(innerValue) {\n      this.destination.next(innerValue);\n    }\n  }, {\n    key: \"notifyError\",\n    value: function notifyError(err) {\n      this.destination.error(err);\n    }\n  }, {\n    key: \"notifyComplete\",\n    value: function notifyComplete() {\n      this.hasSubscription = false;\n\n      if (this.hasCompleted) {\n        this.destination.complete();\n      }\n    }\n  }]);\n\n  return ExhaustMapSubscriber;\n}(SimpleOuterSubscriber); //# sourceMappingURL=exhaustMap.js.map","map":null,"metadata":{},"sourceType":"module"}