(function (global, factory) {
  if (typeof define === "function" && define.amd) {
    define(["exports", "rxjs/operators"], factory);
  } else if (typeof exports !== "undefined") {
    factory(exports, require("rxjs/operators"));
  } else {
    var mod = {
      exports: {}
    };
    factory(mod.exports, global.operators);
    global.sum = mod.exports;
  }
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _operators) {
  "use strict";

  Object.defineProperty(_exports, "__esModule", {
    value: true
  });
  _exports.default = void 0;

  const sum = function sum(initialState = {
    total: 0
  }) {
    return source$ => source$.pipe((0, _operators.scan)(({
      total
    }, num) => ({
      total: total + num
    }), initialState), (0, _operators.map)(({
      total
    }) => total));
  };

  var _default = sum;
  _exports.default = _default;
});
//# sourceMappingURL=sum.js.map