"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "default", {
    enumerable: true,
    get: function() {
        return _default;
    }
});
const _translations = require("../../../translations");
const { getListWithInsertedItems, getListWithRemovedItems } = (0, _translations.alterUtilsFactory)('physicallyIndexed');
/**
 * Map from physical index to another index.
 */ class LooseBindsMap extends _translations.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, _translations.getIncreasedIndexes)(this.indexedValues, insertedIndexes);
        this.indexedValues = getListWithInsertedItems(listAfterUpdate, insertionIndex, insertedIndexes, this.initValueOrFn);
        super.insert(insertionIndex, insertedIndexes);
    }
    /**
   * Remove values from the list and reorganize.
   *
   * @private
   * @param {Array} removedIndexes List of removed indexes.
   */ remove(removedIndexes) {
        const listAfterUpdate = getListWithRemovedItems(this.indexedValues, removedIndexes);
        this.indexedValues = (0, _translations.getDecreasedIndexes)(listAfterUpdate, removedIndexes);
        super.remove(removedIndexes);
    }
    constructor(){
        super((index)=>index);
    }
}
const _default = LooseBindsMap;
