import "core-js/modules/es.array.iterator.js";
import "core-js/modules/es.map.js";
import "core-js/modules/es.object.to-string.js";
import "core-js/modules/es.string.iterator.js";
import "core-js/modules/web.dom-collections.iterator.js";
import "core-js/modules/es.array.concat.js";
import "core-js/modules/es.array.from.js";
export var command = {
  name: 'populateSelectedCellsData',
  callback: function callback(hot) {
    var selectedRange = hot.getSelectedRange();
    var _selectedRange$highli = selectedRange[selectedRange.length - 1].highlight.normalize(),
      highlightRow = _selectedRange$highli.row,
      highlightColumn = _selectedRange$highli.col;
    var valueToPopulate = hot.getDataAtCell(highlightRow, highlightColumn);
    var cellValues = new Map();
    for (var i = 0; i < selectedRange.length; i++) {
      selectedRange[i].forAll(function (row, column) {
        if (row >= 0 && column >= 0 && (row !== highlightRow || column !== highlightColumn)) {
          var _hot$getCellMeta = hot.getCellMeta(row, column),
            readOnly = _hot$getCellMeta.readOnly;
          if (!readOnly) {
            cellValues.set("".concat(row, "x").concat(column), [row, column, valueToPopulate]);
          }
        }
      });
    }
    hot.setDataAtCell(Array.from(cellValues.values()));
  }
};