{"ast":null,"code":"import _toConsumableArray from \"C:/Users/kgamal/Downloads/HijriGregorianDatepicker-master/HijriGregorianDatepicker-master/node_modules/@babel/runtime/helpers/esm/toConsumableArray\";\nimport _assertThisInitialized from \"C:/Users/kgamal/Downloads/HijriGregorianDatepicker-master/HijriGregorianDatepicker-master/node_modules/@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _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 { OuterSubscriber } from '../OuterSubscriber';\nimport { subscribeToResult } from '../util/subscribeToResult';\nexport function withLatestFrom() {\n  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n    args[_key] = arguments[_key];\n  }\n\n  return function (source) {\n    var project;\n\n    if (typeof args[args.length - 1] === 'function') {\n      project = args.pop();\n    }\n\n    var observables = args;\n    return source.lift(new WithLatestFromOperator(observables, project));\n  };\n}\n\nvar WithLatestFromOperator = /*#__PURE__*/function () {\n  function WithLatestFromOperator(observables, project) {\n    _classCallCheck(this, WithLatestFromOperator);\n\n    this.observables = observables;\n    this.project = project;\n  }\n\n  _createClass(WithLatestFromOperator, [{\n    key: \"call\",\n    value: function call(subscriber, source) {\n      return source.subscribe(new WithLatestFromSubscriber(subscriber, this.observables, this.project));\n    }\n  }]);\n\n  return WithLatestFromOperator;\n}();\n\nvar WithLatestFromSubscriber = /*#__PURE__*/function (_OuterSubscriber) {\n  _inherits(WithLatestFromSubscriber, _OuterSubscriber);\n\n  var _super = _createSuper(WithLatestFromSubscriber);\n\n  function WithLatestFromSubscriber(destination, observables, project) {\n    var _this;\n\n    _classCallCheck(this, WithLatestFromSubscriber);\n\n    _this = _super.call(this, destination);\n    _this.observables = observables;\n    _this.project = project;\n    _this.toRespond = [];\n    var len = observables.length;\n    _this.values = new Array(len);\n\n    for (var i = 0; i < len; i++) {\n      _this.toRespond.push(i);\n    }\n\n    for (var _i = 0; _i < len; _i++) {\n      var observable = observables[_i];\n\n      _this.add(subscribeToResult(_assertThisInitialized(_this), observable, undefined, _i));\n    }\n\n    return _this;\n  }\n\n  _createClass(WithLatestFromSubscriber, [{\n    key: \"notifyNext\",\n    value: function notifyNext(_outerValue, innerValue, outerIndex) {\n      this.values[outerIndex] = innerValue;\n      var toRespond = this.toRespond;\n\n      if (toRespond.length > 0) {\n        var found = toRespond.indexOf(outerIndex);\n\n        if (found !== -1) {\n          toRespond.splice(found, 1);\n        }\n      }\n    }\n  }, {\n    key: \"notifyComplete\",\n    value: function notifyComplete() {}\n  }, {\n    key: \"_next\",\n    value: function _next(value) {\n      if (this.toRespond.length === 0) {\n        var args = [value].concat(_toConsumableArray(this.values));\n\n        if (this.project) {\n          this._tryProject(args);\n        } else {\n          this.destination.next(args);\n        }\n      }\n    }\n  }, {\n    key: \"_tryProject\",\n    value: function _tryProject(args) {\n      var result;\n\n      try {\n        result = this.project.apply(this, args);\n      } catch (err) {\n        this.destination.error(err);\n        return;\n      }\n\n      this.destination.next(result);\n    }\n  }]);\n\n  return WithLatestFromSubscriber;\n}(OuterSubscriber); //# sourceMappingURL=withLatestFrom.js.map","map":null,"metadata":{},"sourceType":"module"}