(function () {
  'use strict';
  const selectAll = document.getElementById('selectAll');
  if (selectAll) {
    selectAll.addEventListener('change', function () {
      document.querySelectorAll('.rowCheck').forEach(function (c) { c.checked = selectAll.checked; });
    });
  }
  document.querySelectorAll('.rowCheck').forEach(function (c) {
    c.addEventListener('change', function () {
      if (!c.checked && selectAll) selectAll.checked = false;
    });
  });
})();
