{"ast":null,"code":"import { Subject } from './Subject';\nimport { Subscription } from './Subscription';\nexport class AsyncSubject extends Subject {\n  constructor() {\n    super(...arguments);\n    this.value = null;\n    this.hasNext = false;\n    this.hasCompleted = false;\n  }\n\n  _subscribe(subscriber) {\n    if (this.hasError) {\n      subscriber.error(this.thrownError);\n      return Subscription.EMPTY;\n    } else if (this.hasCompleted && this.hasNext) {\n      subscriber.next(this.value);\n      subscriber.complete();\n      return Subscription.EMPTY;\n    }\n\n    return super._subscribe(subscriber);\n  }\n\n  next(value) {\n    if (!this.hasCompleted) {\n      this.value = value;\n      this.hasNext = true;\n    }\n  }\n\n  error(error) {\n    if (!this.hasCompleted) {\n      super.error(error);\n    }\n  }\n\n  complete() {\n    this.hasCompleted = true;\n\n    if (this.hasNext) {\n      super.next(this.value);\n    }\n\n    super.complete();\n  }\n\n} //# sourceMappingURL=AsyncSubject.js.map","map":null,"metadata":{},"sourceType":"module"}