{"ast":null,"code":"import _createForOfIteratorHelper from \"C:/Users/lucas.hsilva/Desktop/Nome_do_projeto/thf2/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js\";\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { arrRemove } from '../util/arrRemove';\nexport function bufferCount(bufferSize) {\n  var startBufferEvery = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n  startBufferEvery = startBufferEvery !== null && startBufferEvery !== void 0 ? startBufferEvery : bufferSize;\n  return operate(function (source, subscriber) {\n    var buffers = [];\n    var count = 0;\n    source.subscribe(createOperatorSubscriber(subscriber, function (value) {\n      var toEmit = null;\n      if (count++ % startBufferEvery === 0) {\n        buffers.push([]);\n      }\n      var _iterator = _createForOfIteratorHelper(buffers),\n        _step;\n      try {\n        for (_iterator.s(); !(_step = _iterator.n()).done;) {\n          var _buffer = _step.value;\n          _buffer.push(value);\n          if (bufferSize <= _buffer.length) {\n            toEmit = toEmit !== null && toEmit !== void 0 ? toEmit : [];\n            toEmit.push(_buffer);\n          }\n        }\n      } catch (err) {\n        _iterator.e(err);\n      } finally {\n        _iterator.f();\n      }\n      if (toEmit) {\n        var _iterator2 = _createForOfIteratorHelper(toEmit),\n          _step2;\n        try {\n          for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n            var buffer = _step2.value;\n            arrRemove(buffers, buffer);\n            subscriber.next(buffer);\n          }\n        } catch (err) {\n          _iterator2.e(err);\n        } finally {\n          _iterator2.f();\n        }\n      }\n    }, function () {\n      var _iterator3 = _createForOfIteratorHelper(buffers),\n        _step3;\n      try {\n        for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {\n          var buffer = _step3.value;\n          subscriber.next(buffer);\n        }\n      } catch (err) {\n        _iterator3.e(err);\n      } finally {\n        _iterator3.f();\n      }\n      subscriber.complete();\n    }, undefined, function () {\n      buffers = null;\n    }));\n  });\n}\n//# sourceMappingURL=bufferCount.js.map","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}