{"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 { Subscriber } from '../Subscriber';\nimport { EmptyError } from '../util/EmptyError';\nexport function single(predicate) {\n  return function (source) {\n    return source.lift(new SingleOperator(predicate, source));\n  };\n}\n\nvar SingleOperator = /*#__PURE__*/function () {\n  function SingleOperator(predicate, source) {\n    _classCallCheck(this, SingleOperator);\n\n    this.predicate = predicate;\n    this.source = source;\n  }\n\n  _createClass(SingleOperator, [{\n    key: \"call\",\n    value: function call(subscriber, source) {\n      return source.subscribe(new SingleSubscriber(subscriber, this.predicate, this.source));\n    }\n  }]);\n\n  return SingleOperator;\n}();\n\nvar SingleSubscriber = /*#__PURE__*/function (_Subscriber) {\n  _inherits(SingleSubscriber, _Subscriber);\n\n  var _super = _createSuper(SingleSubscriber);\n\n  function SingleSubscriber(destination, predicate, source) {\n    var _this;\n\n    _classCallCheck(this, SingleSubscriber);\n\n    _this = _super.call(this, destination);\n    _this.predicate = predicate;\n    _this.source = source;\n    _this.seenValue = false;\n    _this.index = 0;\n    return _this;\n  }\n\n  _createClass(SingleSubscriber, [{\n    key: \"applySingleValue\",\n    value: function applySingleValue(value) {\n      if (this.seenValue) {\n        this.destination.error('Sequence contains more than one element');\n      } else {\n        this.seenValue = true;\n        this.singleValue = value;\n      }\n    }\n  }, {\n    key: \"_next\",\n    value: function _next(value) {\n      var index = this.index++;\n\n      if (this.predicate) {\n        this.tryNext(value, index);\n      } else {\n        this.applySingleValue(value);\n      }\n    }\n  }, {\n    key: \"tryNext\",\n    value: function tryNext(value, index) {\n      try {\n        if (this.predicate(value, index, this.source)) {\n          this.applySingleValue(value);\n        }\n      } catch (err) {\n        this.destination.error(err);\n      }\n    }\n  }, {\n    key: \"_complete\",\n    value: function _complete() {\n      var destination = this.destination;\n\n      if (this.index > 0) {\n        destination.next(this.seenValue ? this.singleValue : undefined);\n        destination.complete();\n      } else {\n        destination.error(new EmptyError());\n      }\n    }\n  }]);\n\n  return SingleSubscriber;\n}(Subscriber); //# sourceMappingURL=single.js.map","map":null,"metadata":{},"sourceType":"module"}