text: function init() {
      fillTribes();
      fillCrafters();
  }
  
  async function draw() {
      const filters = getFilters();
  
      if (!filters) {
          alert('Selecione o filtro');
          return;
      }
  
      document.getElementById('loadingBar').style.opacity = 100;
      setTimeout(function () { document.getElementById('loadingBar').style.display = 'block'; }, 500);
      document.getElementById('text').innerText = '...'
  
      console.log(filters);
      const data = await loadCsv();
      console.log(data);
      const graph = makeGraph(data, filters);
  
      if (graph.nodes.length === 0) {
          alert('Nenhuma doação encontrada');
          return;
      }
  
      console.log(graph);
  
      render(graph);
  }
  
  function getFilters() {
      const elements = getElements();
  
      if (elements.byTribe1.checked)
          return {
              type: 'bytribe',
              value: elements.tribe1.options[elements.tribe1.selectedIndex].value,
              insideTribe: elements.insideTribe1.checked,
              directed: elements.directedGraph.checked
          };
  
      if (elements.byCrafter1.checked)
          return {
              type: 'bycrafter',
              value: elements.crafter1.options[elements.crafter1.selectedIndex].value,
              deepth: elements.deepth1.options[elements.deepth1.selectedIndex].value,
              directed: elements.directedGraph.checked
          };
  
      if (elements.byPeriod.checked)
          return {
              type: 'byperiod',
              value: elements.period.options[elements.period.selectedIndex].value,
              directed: elements.directedGraph.checked
          };
  
      if (elements.everyone.checked)
          return {
              type: 'nofilter',
              directed: elements.directedGraph.checked
          };
  
  }
  
  function getElements() {
      return {
          filter: document.getElementById('filter'),
          loading: document.getElementById('loading'),
          byTribe1: document.getElementById('byTribe1'),
          tribe1: document.getElementById('tribe1'),
          insideTribe1: document.getElementById('insideTribe1'),
          byCrafter1: document.getElementById('byCrafter1'),
          crafter1: document.getElementById('crafter1'),
          deepth1: document.getElementById('deepth1'),
          byPeriod: document.getElementById('byPeriod'),
          period: document.getElementById('period'),
          everyone: document.getElementById('everyone'),
          directedGraph: document.getElementById('directedGraph')
      };
  }
  
  function toggleDisplay(id) {
      let element = document.getElementById(id);
      if (element.offsetParent === null)
          element.style.display = 'block';
      else
          element.style.display = 'none';
  }
  