<commit_before>define([ "chroma-js", "map", "sidebar", "tabs", "container", "meshstats",
         "linklist", "nodelist", "simplenodelist", "infobox/main",
         "proportions", "forcegraph", "title", "about", "datadistributor",
         "filters/filtergui" ],
function (chroma, Map, Sidebar, Tabs, Container, Meshstats, Linklist,
          Nodelist, SimpleNodelist, Infobox, Proportions, ForceGraph,
          Title, About, DataDistributor, FilterGUI) {
  return function (config, router) {
    var self = this
    var fanout = new DataDistributor()
    var content
    var contentDiv

    var linkScale = chroma.scale(chroma.interpolate.bezier(["#04C714", "#FF5500", "#F02311"])).domain([1, 5])
    var sidebar

    var buttons = document.createElement("div")
    buttons.classList.add("buttons")

    function removeContent() {
      if (!content)
        return

      router.removeTarget(content)
      fanout.remove(content)

      content.destroy()
      contentDiv.removeChild(content.div)
      content = null
    }

    function addContent(K) {
      removeContent()

      content = new K(config, linkScale, sidebar, router, buttons)
      contentDiv.appendChild(content.div)

      fanout.add(content)
      router.addTarget(content)
    }

    function mkView(K) {
      return function () {
        addContent(K)
      }
    }

    contentDiv = document.createElement("div")
    contentDiv.classList.add("content")
    document.body.appendChild(contentDiv)

    sidebar = new Sidebar(document.body)

    contentDiv.appendChild(buttons)

    var buttonToggle = document.createElement("button")
    buttonToggle.textContent = ""
    buttonToggle.onclick = function () {
      if (content.constructor === Map)
        router.view("g")
      else
        router.view("m")
    }

    buttons.appendChild(buttonToggle)

    var title = new Title(config)
    var infobox = new Infobox(config, sidebar, router)
    var tabs = new Tabs()
    var overview = new Container()
    var meshstats = new Meshstats(config)
    var newnodeslist = new SimpleNodelist("new", "firstseen", router, "Neue Knoten")
    var lostnodeslist = new SimpleNodelist("lost", "lastseen", router, "Verschwundene Knoten")
    var nodelist = new Nodelist(router)
    var linklist = new Linklist(linkScale, router)
    var statistics = new Proportions(config, fanout)
    var about = new About()

    fanout.add(meshstats)
    fanout.add(newnodeslist)
    fanout.add(lostnodeslist)
    fanout.add(nodelist)
    fanout.add(linklist)
    fanout.add(statistics)

    overview.add(meshstats)
    overview.add(newnodeslist)
    overview.add(lostnodeslist)

    var filterGUI = new FilterGUI(fanout)
    fanout.watchFilters(filterGUI)
    sidebar.add(filterGUI)

    sidebar.add(tabs)
    tabs.add("Übersicht", overview)
    tabs.add("Knoten", nodelist)
    tabs.add("Verbindungen", linklist)
    tabs.add("Statistiken", statistics)
    tabs.add("Über", about)

    router.addTarget(title)
    router.addTarget(infobox)

    router.addView("m", mkView(Map))
    router.addView("g", mkView(ForceGraph))

    router.view("m")

    self.setData = fanout.setData

    return self
  }
})<commit_msg>gui: use two datadistributors, one for filtered data<commit_after>define([ "chroma-js", "map", "sidebar", "tabs", "container", "meshstats",
         "linklist", "nodelist", "simplenodelist", "infobox/main",
         "proportions", "forcegraph", "title", "about", "datadistributor",
         "filters/filtergui" ],
function (chroma, Map, Sidebar, Tabs, Container, Meshstats, Linklist,
          Nodelist, SimpleNodelist, Infobox, Proportions, ForceGraph,
          Title, About, DataDistributor, FilterGUI) {
  return function (config, router) {
    var self = this
    var content
    var contentDiv

    var linkScale = chroma.scale(chroma.interpolate.bezier(["#04C714", "#FF5500", "#F02311"])).domain([1, 5])
    var sidebar

    var buttons = document.createElement("div")
    buttons.classList.add("buttons")

    var fanout = new DataDistributor()
    var fanoutUnfiltered = new DataDistributor()
    fanoutUnfiltered.add(fanout)

    function removeContent() {
      if (!content)
        return

      router.removeTarget(content)
      fanout.remove(content)

      content.destroy()
      contentDiv.removeChild(content.div)
      content = null
    }

    function addContent(K) {
      removeContent()

      content = new K(config, linkScale, sidebar, router, buttons)
      contentDiv.appendChild(content.div)

      fanout.add(content)
      router.addTarget(content)
    }

    function mkView(K) {
      return function () {
        addContent(K)
      }
    }

    contentDiv = document.createElement("div")
    contentDiv.classList.add("content")
    document.body.appendChild(contentDiv)

    sidebar = new Sidebar(document.body)

    contentDiv.appendChild(buttons)

    var buttonToggle = document.createElement("button")
    buttonToggle.textContent = ""
    buttonToggle.onclick = function () {
      if (content.constructor === Map)
        router.view("g")
      else
        router.view("m")
    }

    buttons.appendChild(buttonToggle)

    var title = new Title(config)
    var infobox = new Infobox(config, sidebar, router)
    var tabs = new Tabs()
    var overview = new Container()
    var meshstats = new Meshstats(config)
    var newnodeslist = new SimpleNodelist("new", "firstseen", router, "Neue Knoten")
    var lostnodeslist = new SimpleNodelist("lost", "lastseen", router, "Verschwundene Knoten")
    var nodelist = new Nodelist(router)
    var linklist = new Linklist(linkScale, router)
    var statistics = new Proportions(config, fanout)
    var about = new About()

    fanoutUnfiltered.add(meshstats)
    fanoutUnfiltered.add(newnodeslist)
    fanoutUnfiltered.add(lostnodeslist)
    fanout.add(nodelist)
    fanout.add(linklist)
    fanout.add(statistics)

    overview.add(meshstats)
    overview.add(newnodeslist)
    overview.add(lostnodeslist)

    var filterGUI = new FilterGUI(fanout)
    fanout.watchFilters(filterGUI)
    sidebar.add(filterGUI)

    sidebar.add(tabs)
    tabs.add("Übersicht", overview)
    tabs.add("Knoten", nodelist)
    tabs.add("Verbindungen", linklist)
    tabs.add("Statistiken", statistics)
    tabs.add("Über", about)

    router.addTarget(title)
    router.addTarget(infobox)

    router.addView("m", mkView(Map))
    router.addView("g", mkView(ForceGraph))

    router.view("m")

    self.setData = fanoutUnfiltered.setData

    return self
  }
})
{'fraction_non_alphanumeric': 0.12192118226600986, 'fraction_numerical': 0.0049261083743842365, 'mean_word_length': 3.319813829787234, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4683211', 'n_tokens_mistral': 2132, 'n_tokens_neox': 1995, 'n_words': 422}