export function activateTab(element) {
  var _element$classList;

  element == null ? void 0 : (_element$classList = element.classList) == null ? void 0 : _element$classList.add('active', 'show');
}
export function buildTree() {
  var _document, _document$querySelect;

  return Array.from(((_document = document) == null ? void 0 : (_document$querySelect = _document.querySelector('.nav-tabs')) == null ? void 0 : _document$querySelect.getElementsByTagName('a')) || []).map(item => {
    var _Array$from, _childContainer$first;

    var parentId = item.href.slice(item.href.indexOf('#'));
    var childContainer = document.querySelector(parentId);
    var result = {
      parentId,
      label: item.innerHTML,
      children: []
    };
    (_Array$from = Array.from((childContainer == null ? void 0 : (_childContainer$first = childContainer.firstElementChild) == null ? void 0 : _childContainer$first.getElementsByTagName('div')) || [])) == null ? void 0 : _Array$from.forEach(currentItem => {
      var _document$querySelect2;

      if ((_document$querySelect2 = document.querySelector("[href='#" + currentItem.id + "']")) != null && _document$querySelect2.innerHTML) {
        var _document$querySelect3;

        result.children.push({
          label: (_document$querySelect3 = document.querySelector("[href='#" + currentItem.id + "']")) == null ? void 0 : _document$querySelect3.innerHTML,
          parentId: '#' + currentItem.id
        });
      }
    });
    return result;
  });
}
export function setSelectedSize(label) {
  document.querySelectorAll('tr').forEach(item => {
    var _selectedRow$parentEl;

    var selectedRow = Array.from((item == null ? void 0 : item.children) || []).find(x => x.innerHTML === label);
    selectedRow == null ? void 0 : (_selectedRow$parentEl = selectedRow.parentElement) == null ? void 0 : _selectedRow$parentEl.classList.add('activated');
  });
}
export function setDefaultSelectedTab() {
  var _panels$, _panels$$firstElement, _panels$$firstElement2;

  var panels = document.querySelectorAll('.tab-pane');
  panels.forEach(item => item.classList.remove('active', 'show'));
  activateTab(panels == null ? void 0 : panels[0]);

  if ((panels == null ? void 0 : (_panels$ = panels[0]) == null ? void 0 : (_panels$$firstElement = _panels$.firstElementChild) == null ? void 0 : (_panels$$firstElement2 = _panels$$firstElement.firstElementChild) == null ? void 0 : _panels$$firstElement2.tagName) !== 'TBODY') {
    var _panels$2, _panels$2$firstElemen;

    activateTab(panels == null ? void 0 : (_panels$2 = panels[0]) == null ? void 0 : (_panels$2$firstElemen = _panels$2.firstElementChild) == null ? void 0 : _panels$2$firstElemen.firstElementChild);
  }
}
export function removeDefaultNavigation() {
  document.querySelectorAll('.nav').forEach(item => item.remove());
}
//# sourceMappingURL=utils.js.map