<commit_before><!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Papan</title>

    <script src="node_modules/babel-standalone/babel.min.js"></script>

    <style is="papan-style">
      html:not([style-scope]):not(.style-scope),body:not([style-scope]):not(.style-scope) {
        margin: 0;
          font-family: 'Roboto', 'Noto', sans-serif;
          -webkit-font-smoothing: antialiased;
          background: #f1f1f1;
      }

      .js-off {
        display: none;
      }

      .js-on {
        height: 100%;
      }

      html {
        height: 100%;
      }

      body {
        overflow: hidden;
        height: 100%;
      }
    </style>

    <script type="text/babel" data-presets="es2017,stage-0">
      var Papan = {
        asyncLoader: ({ path, elementType, baseObj }) => new Promise((resolve, reject) => {
          const element = document.createElement(elementType)
          element.onload = resolve
          Object.keys(baseObj).forEach(key => { element[key] = baseObj[key] })
          document.head.appendChild(element)
        }),

        babelLoader: path => new Promise((resolve, reject) => {
          const element = document.createElement('script')
          const xhr = new global.XMLHttpRequest()

          xhr.open('GET', path, true)
          if ('overrideMimeType' in xhr) {
            xhr.overrideMimeType('text/plain')
          }
          xhr.onreadystatechange = () => {
            if (xhr.readyState === 4) {
              if (xhr.status === 0 || xhr.status === 200) {
                const transformed = global.Babel.transform(xhr.responseText, {
                  presets: [
                    'es2017',
                    'stage-0'
                  ],
                  sourceMaps: 'inline',
                  filename: path
                })
                element.text = transformed.code
                document.head.appendChild(element)
                resolve()
              } else {
                reject(Error('Couldn\'t load ' + path))
              }
            }
          }
          xhr.send(null)
        }),

        jsLoader: path => Papan.asyncLoader({
          path: path,
          elementType: 'script',
          baseObj: {
            src: path
          }
        }),

        cssLoader: path => Papan.asyncLoader({
          path: path,
          elementType: 'link',
          baseObj: {
            rel: 'stylesheet',
            type: 'text/css',
            href: path
          }
        }),

        importLoader: path => Papan.asyncLoader({
          path: path,
          elementType: 'link',
          baseObj: {
            rel: 'import',
            href: path
          }
        })
      }

      setTimeout(() => {
        console.log('Papan Loading...')

        // Getting the CSS spinner first to display it as fast as possible.
        Papan.cssLoader('node_modules/spinkit/css/spinners/3-wave.css')
          .then(() => Promise.all([
          // Loading all the code that doesn't depend on anything else first.
            Papan.babelLoader('src/common/utils.js'),
            Papan.jsLoader('bower_components/webcomponentsjs/webcomponents-loader.js'),
            Papan.jsLoader('node_modules/deep-diff/dist/deep-diff.min.js'),
            Papan.jsLoader('node_modules/deepmerge/dist/umd.js'),
            Papan.jsLoader('node_modules/event-emitter-es6/dist/event-emitter.min.js'),
            new Promise((resolve, reject) => window.addEventListener('WebComponentsReady', resolve()))
          ]))
          .then(() => Promise.all([
          // Depend on utils.js
            Papan.babelLoader('src/client/channel.js'),
            Papan.babelLoader('src/client/web-torrent.js'),
            // Depends on webcomponents,
            Papan.importLoader('bower_components/font-roboto-local/roboto.html'),
            Papan.importLoader('template/mainwindow.html')
          ]))
          .then(() => Promise.all([
          // Depends on channel.js
            Papan.babelLoader('src/client/lobby-interface.js')
          ]))
          .then(() => Promise.all([
          // Depends on webtorrent, channel, lobby-interface and webcomponents
            Papan.babelLoader('src/client/component-loader.js')
          ]))
          .then(() => Promise.all([
          // Waiting for channels and webtorrents to be ready.
            new Promise((resolve, reject) => {
              if (global.channel.ready()) {
                resolve()
              } else {
                global.channel.onready = resolve
              }
            }),
            new Promise((resolve, reject) => {
              if (global.webtorrentReady) {
                resolve()
              } else {
                global.webtorrentOnReady = resolve
              }
            })
          ]))
          .then(() => {
          // Adding the main window in, and removing the spinner.
            const main = document.createElement('papan-main-window')
            const loader = document.getElementById('mainloader')

            document.getElementById('body').removeChild(loader)
            document.getElementById('maindiv').appendChild(main)

            console.log('Papan Loaded.')
          })
      }, 0)
    </script>

    <noscript>
      <style is="papan-js-off">
        .js-on {
          display: hidden;
        }

        .js-off {
          display: inline;
        }
      </style>
    </noscript><commit_msg>Loading the main window template last.<commit_after><!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Papan</title>

    <script src="node_modules/babel-standalone/babel.min.js"></script>

    <style is="papan-style">
      html:not([style-scope]):not(.style-scope),body:not([style-scope]):not(.style-scope) {
        margin: 0;
          font-family: 'Roboto', 'Noto', sans-serif;
          -webkit-font-smoothing: antialiased;
          background: #f1f1f1;
      }

      .js-off {
        display: none;
      }

      .js-on {
        height: 100%;
      }

      html {
        height: 100%;
      }

      body {
        overflow: hidden;
        height: 100%;
      }
    </style>

    <script type="text/babel" data-presets="es2017,stage-0">
      var Papan = {
        asyncLoader: ({ path, elementType, baseObj }) => new Promise((resolve, reject) => {
          const element = document.createElement(elementType)
          element.onload = resolve
          Object.keys(baseObj).forEach(key => { element[key] = baseObj[key] })
          document.head.appendChild(element)
        }),

        babelLoader: path => new Promise((resolve, reject) => {
          const element = document.createElement('script')
          const xhr = new global.XMLHttpRequest()

          xhr.open('GET', path, true)
          if ('overrideMimeType' in xhr) {
            xhr.overrideMimeType('text/plain')
          }
          xhr.onreadystatechange = () => {
            if (xhr.readyState === 4) {
              if (xhr.status === 0 || xhr.status === 200) {
                const transformed = global.Babel.transform(xhr.responseText, {
                  presets: [
                    'es2017',
                    'stage-0'
                  ],
                  sourceMaps: 'inline',
                  filename: path
                })
                element.text = transformed.code
                document.head.appendChild(element)
                resolve()
              } else {
                reject(Error('Couldn\'t load ' + path))
              }
            }
          }
          xhr.send(null)
        }),

        jsLoader: path => Papan.asyncLoader({
          path: path,
          elementType: 'script',
          baseObj: {
            src: path
          }
        }),

        cssLoader: path => Papan.asyncLoader({
          path: path,
          elementType: 'link',
          baseObj: {
            rel: 'stylesheet',
            type: 'text/css',
            href: path
          }
        }),

        importLoader: path => Papan.asyncLoader({
          path: path,
          elementType: 'link',
          baseObj: {
            rel: 'import',
            href: path
          }
        })
      }

      setTimeout(() => {
        console.log('Papan Loading...')

        // Getting the CSS spinner first to display it as fast as possible.
        Papan.cssLoader('node_modules/spinkit/css/spinners/3-wave.css')
          .then(() => Promise.all([
          // Loading all the code that doesn't depend on anything else first.
            Papan.babelLoader('src/common/utils.js'),
            Papan.jsLoader('bower_components/webcomponentsjs/webcomponents-loader.js'),
            Papan.jsLoader('node_modules/deep-diff/dist/deep-diff.min.js'),
            Papan.jsLoader('node_modules/deepmerge/dist/umd.js'),
            Papan.jsLoader('node_modules/event-emitter-es6/dist/event-emitter.min.js'),
            new Promise((resolve, reject) => window.addEventListener('WebComponentsReady', resolve()))
          ]))
          .then(() => Promise.all([
          // Depend on utils.js
            Papan.babelLoader('src/client/channel.js'),
            Papan.babelLoader('src/client/web-torrent.js'),
            // Depends on webcomponents
            Papan.importLoader('bower_components/font-roboto-local/roboto.html')
          ]))
          .then(() => Promise.all([
          // Depends on channel.js
            Papan.babelLoader('src/client/lobby-interface.js')
          ]))
          .then(() => Promise.all([
          // Depends on webtorrent, channel, lobby-interface and webcomponents
            Papan.babelLoader('src/client/component-loader.js')
          ]))
          .then(() => Promise.all([
          // Waiting for channels and webtorrents to be ready.
            new Promise((resolve, reject) => {
              if (global.channel.ready()) {
                resolve()
              } else {
                global.channel.onready = resolve
              }
            }),
            new Promise((resolve, reject) => {
              if (global.webtorrentReady) {
                resolve()
              } else {
                global.webtorrentOnReady = resolve
              }
            })
          ]))
          // Adding the main window in, and removing the spinner.
          .then(() => Papan.importLoader('template/mainwindow.html'))
          .then(() => {
            const main = document.createElement('papan-main-window')
            const loader = document.getElementById('mainloader')

            document.getElementById('body').removeChild(loader)
            document.getElementById('maindiv').appendChild(main)

            console.log('Papan Loaded.')
          })
      }, 0)
    </script>

    <noscript>
      <style is="papan-js-off">
        .js-on {
          display: hidden;
        }

        .js-off {
          display: inline;
        }
      </style>
    </noscript>
{'fraction_non_alphanumeric': 0.1329543370621676, 'fraction_numerical': 0.005868329359985329, 'mean_word_length': 1.5353324035332403, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 74, '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': '6564549', 'n_tokens_mistral': 3110, 'n_tokens_neox': 2939, 'n_words': 545}