{"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 { ArgumentOutOfRangeError } from '../util/ArgumentOutOfRangeError';\nimport { empty } from '../observable/empty';\nexport function takeLast(count) {\n  return function takeLastOperatorFunction(source) {\n    if (count === 0) {\n      return empty();\n    } else {\n      return source.lift(new TakeLastOperator(count));\n    }\n  };\n}\n\nvar TakeLastOperator = /*#__PURE__*/function () {\n  function TakeLastOperator(total) {\n    _classCallCheck(this, TakeLastOperator);\n\n    this.total = total;\n\n    if (this.total < 0) {\n      throw new ArgumentOutOfRangeError();\n    }\n  }\n\n  _createClass(TakeLastOperator, [{\n    key: \"call\",\n    value: function call(subscriber, source) {\n      return source.subscribe(new TakeLastSubscriber(subscriber, this.total));\n    }\n  }]);\n\n  return TakeLastOperator;\n}();\n\nvar TakeLastSubscriber = /*#__PURE__*/function (_Subscriber) {\n  _inherits(TakeLastSubscriber, _Subscriber);\n\n  var _super = _createSuper(TakeLastSubscriber);\n\n  function TakeLastSubscriber(destination, total) {\n    var _this;\n\n    _classCallCheck(this, TakeLastSubscriber);\n\n    _this = _super.call(this, destination);\n    _this.total = total;\n    _this.ring = new Array();\n    _this.count = 0;\n    return _this;\n  }\n\n  _createClass(TakeLastSubscriber, [{\n    key: \"_next\",\n    value: function _next(value) {\n      var ring = this.ring;\n      var total = this.total;\n      var count = this.count++;\n\n      if (ring.length < total) {\n        ring.push(value);\n      } else {\n        var index = count % total;\n        ring[index] = value;\n      }\n    }\n  }, {\n    key: \"_complete\",\n    value: function _complete() {\n      var destination = this.destination;\n      var count = this.count;\n\n      if (count > 0) {\n        var total = this.count >= this.total ? this.total : this.count;\n        var ring = this.ring;\n\n        for (var i = 0; i < total; i++) {\n          var idx = count++ % total;\n          destination.next(ring[idx]);\n        }\n      }\n\n      destination.complete();\n    }\n  }]);\n\n  return TakeLastSubscriber;\n}(Subscriber); //# sourceMappingURL=takeLast.js.map","map":null,"metadata":{},"sourceType":"module"}