<commit_before>function launch(prefix, container, config) {
  if (typeof container === 'string') {
    container = document.getElementById(container);
  }
  config = config || {};
  var deps = [
    "yoob/element-factory.js",
    "yoob/playfield.js",
    "yoob/playfield-html-view.js",
    "yoob/cursor.js",
    "yoob/tape.js",
    "yoob/tape-html-view.js",
    "yoob/controller.js",
    "yoob/source-manager.js",
    "yoob/preset-manager.js",
    "wunnel.js"
  ];
  var loaded = 0;
  var onload = function() {
    if (++loaded < deps.length) return;
    /* ----- launch ----- */
    var programView = new yoob.PlayfieldHTMLView().init({
      element: document.getElementById('program_display')
    });
    var opTableView = new yoob.PlayfieldHTMLView().init({
      element: document.getElementById('op_table_display')
    });
    opTableView.render = function(value) {
          return ' ' + value + ' ';
    };
    var tapeView = new yoob.TapeHTMLView().init({
      element: document.getElementById('tape_display')
    });

    var controlPanel = document.getElementById("panel_container");
    var editor = document.getElementById("editor");
    var display = document.getElementById("program_display");

    var WunnelController = getWunnelControllerClass();
    var controller = (new WunnelController()).init({
        programView: programView,
        opTableView: opTableView,
        tapeView: tapeView,
        inputElem: document.getElementById("input"),
        outputElem: document.getElementById("output"),
        panelContainer: controlPanel
    });

    var sourceManager = (new yoob.SourceManager()).init({
        panelContainer: controlPanel,
        editor: editor,
        hideDuringEdit: [display],
        disableDuringEdit: [controller.panel],
        storageKey: '<KEY>',
        onDone: function() {
            controller.performReset(this.getEditorText());
        }
    });
    var p = (new yoob.PresetManager()).init({
      selectElem: document.getElementById('select_source'),
      controller: controller
    });
    function makeCallback(sourceText) {
      return function(id) {
        sourceManager.loadSource(sourceText);
      }
    }
    for (var i = 0; i < examplePrograms.length; i++) {
      p.add(examplePrograms[i][0], makeCallback(examplePrograms[i][1]));
    }
    p.select(examplePrograms[0][0]);
  };
  for (var i = 0; i < deps.length; i++) {<commit_msg>Use yoob.elementFactory to create the UI.<commit_after>function launch(prefix, container, config) {
  if (typeof container === 'string') {
    container = document.getElementById(container);
  }
  config = config || {};
  var deps = [
    "yoob/element-factory.js",
    "yoob/playfield.js",
    "yoob/playfield-html-view.js",
    "yoob/cursor.js",
    "yoob/tape.js",
    "yoob/tape-html-view.js",
    "yoob/controller.js",
    "yoob/source-manager.js",
    "yoob/preset-manager.js",
    "wunnel.js"
  ];
  var loaded = 0;
  var onload = function() {
    if (++loaded < deps.length) return;
    /* ----- launch, phase 1: create the UI ----- */
    var controlPanel = yoob.makeDiv(container);
    controlPanel.id = "panel_container";

    var subPanel = yoob.makeDiv(container);
    var selectSource = yoob.makeSelect(subPanel, 'example source:', []);

    var displayContainer = yoob.makeDiv();
    displayContainer.id = 'display_container';

    var programDisplay = yoob.makePre(displayContainer);
    programDisplay.id = 'program_display';

    var editor = yoob.makeTextArea(displayContainer, 40, 25);

    var stateDisplay = yoob.makeDiv();
    stateDisplay.id = "state_display";

    var opTableDisplay = yoob.makePre(stateDisplay);
    opTableDisplay.id = 'op_table_display';

    var tapeSubDisplay = yoob.makeDiv(stateDispay);
    yoob.makeSpan(tapeSubDisplay, "Tape:");
    var tapeDisplay = yoob.makeSpan(tapeSubDisplay);

    var ioSubDisplay = yoob.makeDiv(stateDispay);
    ioSubDisplay.innerHTML = 'Input: <input id="input"></input><br />' +
                             'Output: <div id="output">';

    new yoob.PlayfieldHTMLView().init({
      element: programDisplay
    });
    var opTableView = new yoob.PlayfieldHTMLView().init({
      element: opTableDisplay
    });
    opTableView.render = function(value) {
          return ' ' + value + ' ';
    };
    var tapeView = new yoob.TapeHTMLView().init({
      element: tapeDisplay
    });

    /* ----- launch, phase 2: connect the controller ----- */
    var WunnelController = getWunnelControllerClass();
    var controller = (new WunnelController()).init({
        programView: programView,
        opTableView: opTableView,
        tapeView: tapeView,
        inputElem: document.getElementById("input"),
        outputElem: document.getElementById("output"),
        panelContainer: controlPanel
    });

    var sourceManager = (new yoob.SourceManager()).init({
        panelContainer: controlPanel,
        editor: editor,
        hideDuringEdit: [programDisplay],
        disableDuringEdit: [controller.panel],
        storageKey: 'wunnel.js',
        onDone: function() {
            controller.performReset(this.getEditorText());
        }
    });
    var p = (new yoob.PresetManager()).init({
      selectElem: selectSource,
      controller: controller
    });
    function makeCallback(sourceText) {
      return function(id) {
        sourceManager.loadSource(sourceText);
      }
    }
    for (var i = 0; i < examplePrograms.length; i++) {
      p.add(examplePrograms[i][0], makeCallback(examplePrograms[i][1]));
    }
    p.select(examplePrograms[0][0]);
  };
  for (var i = 0; i < deps.length; i++) {
{'fraction_non_alphanumeric': 0.14438884917798428, 'fraction_numerical': 0.0035739814152966403, 'mean_word_length': 2.938775510204082, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 8, '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': '5308867', 'n_tokens_mistral': 1696, 'n_tokens_neox': 1668, 'n_words': 325}