<commit_before>define( [
  "jquery",
  "codemirror",
  "ui/popin",
  "utils/eventmanager"
], function(
  $,
  CodeMirror,
  Popin,
  EventManager
) {
  function UI() {
    this.$toolbar = $( ".ui-toolbar" );
    this.$fileList = $( ".ui-filelist" );
    this.$fileInput = $( ".ui-fileInput" );
    this.$editor = $( ".ui-editor" );
    this.$output = $( ".ui-output" );
    this.editor = CodeMirror( this.$editor[0], {
      lineWrapping: false,
      lineNumbers: true,
      mode: "commander",
      theme: "lesser-dark",
      extraKeys: {
        Tab: function( cm ) {
          var spaces = Array( cm.getOption( "indentUnit" ) + 1 ).join( " " );
          cm.replaceSelection( spaces );
        }
      }
    } );

    this.editorMode = "commander";
    this.documents = {};
    this.selectedFile = null;
    this.events = new EventManager();

    this.popin = new Popin();

    this.initEvents();
  }

  UI.prototype = {

    initEvents: function() {
      var ui = this;

      this.events.on( "toolbar.file-new", function() {
        ui.popin.prompt( {
          "title": "New file",
          "label": "New file name :",
          "input:placeholder": "new_file",
          "notice": "File name must contain only letters, numbers and underscores.",
          "action:confirm": function( fileName ) {
            try {
              ui.newFile( fileName );
            } catch( error ) {
              ui.popin.show( "alert", {
                title: "Error",
                text: error
              } );
            }
          }
        } );
      } );

      this.events.on( "toolbar.file-rename", function() {
        ui.popin.prompt( {
          "title": "Rename file",
          "label": "New name for \"" + ui.selectedFile + "\" :",
          "input:placeholder": "new_file",
          "notice": "File name must contain only letters, numbers and underscores.",
          "action:confirm": function( fileName ) {
            try {
              ui.renameFile( ui.selectedFile, fileName );
            } catch( error ) {
              ui.popin.show( "alert", {
                "title": "Error",<commit_msg>regex for filenames is  /^[a-z0-9_-]+$/i so hyphens are allowed too<commit_after>define( [
  "jquery",
  "codemirror",
  "ui/popin",
  "utils/eventmanager"
], function(
  $,
  CodeMirror,
  Popin,
  EventManager
) {
  function UI() {
    this.$toolbar = $( ".ui-toolbar" );
    this.$fileList = $( ".ui-filelist" );
    this.$fileInput = $( ".ui-fileInput" );
    this.$editor = $( ".ui-editor" );
    this.$output = $( ".ui-output" );
    this.editor = CodeMirror( this.$editor[0], {
      lineWrapping: false,
      lineNumbers: true,
      mode: "commander",
      theme: "lesser-dark",
      extraKeys: {
        Tab: function( cm ) {
          var spaces = Array( cm.getOption( "indentUnit" ) + 1 ).join( " " );
          cm.replaceSelection( spaces );
        }
      }
    } );

    this.editorMode = "commander";
    this.documents = {};
    this.selectedFile = null;
    this.events = new EventManager();

    this.popin = new Popin();

    this.initEvents();
  }

  UI.prototype = {

    initEvents: function() {
      var ui = this;

      this.events.on( "toolbar.file-new", function() {
        ui.popin.prompt( {
          "title": "New file",
          "label": "New file name :",
          "input:placeholder": "new_file",
          "notice": "File name must contain only letters, numbers, hyphens, and underscores.",
          "action:confirm": function( fileName ) {
            try {
              ui.newFile( fileName );
            } catch( error ) {
              ui.popin.show( "alert", {
                title: "Error",
                text: error
              } );
            }
          }
        } );
      } );

      this.events.on( "toolbar.file-rename", function() {
        ui.popin.prompt( {
          "title": "Rename file",
          "label": "New name for \"" + ui.selectedFile + "\" :",
          "input:placeholder": "new_file",
          "notice": "File name must contain only letters, numbers, hyphens, and underscores.",
          "action:confirm": function( fileName ) {
            try {
              ui.renameFile( ui.selectedFile, fileName );
            } catch( error ) {
              ui.popin.show( "alert", {
                "title": "Error",
{'fraction_non_alphanumeric': 0.1603336422613531, 'fraction_numerical': 0.0013901760889712697, 'mean_word_length': 1.7887596899224807, 'pattern_counts': {'":': 22, '<': 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': '4053109', 'n_tokens_mistral': 1331, 'n_tokens_neox': 1304, 'n_words': 284}