{"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 { async } from '../scheduler/async';\nimport { defaultThrottleConfig } from './throttle';\nexport function throttleTime(duration) {\n  var scheduler = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : async;\n  var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultThrottleConfig;\n  return function (source) {\n    return source.lift(new ThrottleTimeOperator(duration, scheduler, config.leading, config.trailing));\n  };\n}\n\nvar ThrottleTimeOperator = /*#__PURE__*/function () {\n  function ThrottleTimeOperator(duration, scheduler, leading, trailing) {\n    _classCallCheck(this, ThrottleTimeOperator);\n\n    this.duration = duration;\n    this.scheduler = scheduler;\n    this.leading = leading;\n    this.trailing = trailing;\n  }\n\n  _createClass(ThrottleTimeOperator, [{\n    key: \"call\",\n    value: function call(subscriber, source) {\n      return source.subscribe(new ThrottleTimeSubscriber(subscriber, this.duration, this.scheduler, this.leading, this.trailing));\n    }\n  }]);\n\n  return ThrottleTimeOperator;\n}();\n\nvar ThrottleTimeSubscriber = /*#__PURE__*/function (_Subscriber) {\n  _inherits(ThrottleTimeSubscriber, _Subscriber);\n\n  var _super = _createSuper(ThrottleTimeSubscriber);\n\n  function ThrottleTimeSubscriber(destination, duration, scheduler, leading, trailing) {\n    var _this;\n\n    _classCallCheck(this, ThrottleTimeSubscriber);\n\n    _this = _super.call(this, destination);\n    _this.duration = duration;\n    _this.scheduler = scheduler;\n    _this.leading = leading;\n    _this.trailing = trailing;\n    _this._hasTrailingValue = false;\n    _this._trailingValue = null;\n    return _this;\n  }\n\n  _createClass(ThrottleTimeSubscriber, [{\n    key: \"_next\",\n    value: function _next(value) {\n      if (this.throttled) {\n        if (this.trailing) {\n          this._trailingValue = value;\n          this._hasTrailingValue = true;\n        }\n      } else {\n        this.add(this.throttled = this.scheduler.schedule(dispatchNext, this.duration, {\n          subscriber: this\n        }));\n\n        if (this.leading) {\n          this.destination.next(value);\n        } else if (this.trailing) {\n          this._trailingValue = value;\n          this._hasTrailingValue = true;\n        }\n      }\n    }\n  }, {\n    key: \"_complete\",\n    value: function _complete() {\n      if (this._hasTrailingValue) {\n        this.destination.next(this._trailingValue);\n        this.destination.complete();\n      } else {\n        this.destination.complete();\n      }\n    }\n  }, {\n    key: \"clearThrottle\",\n    value: function clearThrottle() {\n      var throttled = this.throttled;\n\n      if (throttled) {\n        if (this.trailing && this._hasTrailingValue) {\n          this.destination.next(this._trailingValue);\n          this._trailingValue = null;\n          this._hasTrailingValue = false;\n        }\n\n        throttled.unsubscribe();\n        this.remove(throttled);\n        this.throttled = null;\n      }\n    }\n  }]);\n\n  return ThrottleTimeSubscriber;\n}(Subscriber);\n\nfunction dispatchNext(arg) {\n  var subscriber = arg.subscriber;\n  subscriber.clearThrottle();\n} //# sourceMappingURL=throttleTime.js.map","map":null,"metadata":{},"sourceType":"module"}