"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "IndexesSequence", {
    enumerable: true,
    get: function() {
        return IndexesSequence;
    }
});
const _indexMap = require("./indexMap");
const _indexesSequence = require("./utils/indexesSequence");
const _utils = require("./utils");
class IndexesSequence extends _indexMap.IndexMap {
    /**
   * Add values to list and reorganize.
   *
   * @private
   * @param {number} insertionIndex Position inside the list.
   * @param {Array} insertedIndexes List of inserted indexes.
   */ insert(insertionIndex, insertedIndexes) {
        const listAfterUpdate = (0, _utils.getIncreasedIndexes)(this.indexedValues, insertedIndexes);
        this.indexedValues = (0, _indexesSequence.getListWithInsertedItems)(listAfterUpdate, insertionIndex, insertedIndexes);
        super.insert(insertionIndex, insertedIndexes);
    }
    /**
   * Remove values from the list and reorganize.
   *
   * @private
   * @param {Array} removedIndexes List of removed indexes.
   */ remove(removedIndexes) {
        const listAfterUpdate = (0, _indexesSequence.getListWithRemovedItems)(this.indexedValues, removedIndexes);
        this.indexedValues = (0, _utils.getDecreasedIndexes)(listAfterUpdate, removedIndexes);
        super.remove(removedIndexes);
    }
    constructor(){
        // Not handling custom init function or init value.
        super((index)=>index);
    }
}
