"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = generateDisplayPositions;
function generateDisplayPositions(records) {
  var asMap = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;

  var positionTuples = [];
  var positionMap = {};
  var displayPosition = 1;

  for (var i = 0; i < records.size; i++) {
    var record = records.get(i);
    positionTuples.push({ displayPosition: displayPosition, record: record });
    positionMap[record.id] = displayPosition;
    // stimuli or bank_entries that are stimuli
    if (record.hasNestedRecords) {
      i += record.positionSlots;
    }
    displayPosition += record.displayPositionSlots;
  }

  return asMap ? positionMap : positionTuples;
}