<commit_before>"use strict";

/* jshint undef: true, unused: false */
/* global Hogan , _ */ 

(function () {

  function throw_error (msg) {
    Hogan.cache = {};
    throw new Error(msg);
  }

  function findInScope(key, scope) {
    var val;
    if (scope && typeof scope === 'object' && scope[key] !== undefined && scope[key] !== null) {
      val = scope[key];
    }

    return val;
  }

  // === My monkey-patches to Hogan. ======
  // When a variable is not found,
  // I want to throw an Error.
  // ======================================
  Hogan.Template.prototype.f = function(key, ctx) {
    var val    = false,
    v          = null,
    found      = false,
    doModelGet = this.options.modelGet;

    for (var i = ctx.length - 1; i >= 0; i--) {
      v = ctx[i];
      val = findInScope(key, v, doModelGet);
      if (val !== undefined && val !== null) {
        found = true;
        break;
      }
    }

    if (!found) {
      throw_error("Value not found: " + key);
    }

    return val;
  }; // === .f

  Hogan.Template.prototype.d = function(key, ctx) {
    var val,
    names = key.split('.'),
    data  = _.detect(ctx, function (v) { return _.has(v, names[0]);});

    if (key === '.' && _.isArray(ctx[ctx.length - 2])) {
      throw new Error("Unknown key: " + key);
    }

    val = _.reduce(names, function (memo, v) { return memo && memo[v];}, data);

    if (val === undefined || val === null) {
      throw_error("Dot-notated value not found: " + key + " in: " + JSON.stringify(ctx));
    }
    return val;
  }; // === .d
  // ======================================
  // End of monkey-patches for Hogan.
  // ======================================

})();



// ======================================
// Start of client-side WWW_App.
// ======================================

var WWW_App = {};

(function () {

  var SPACES            = /\s+/;
  var ALL_KNOWN_CLASSES = 'no_reset reset page_load prepend append no_reset'.split(SPACES);
  var script_meta       = {};
  var the_scripts       = $('script[type="text/hogan"]');

  // ================================ Helpers
  var auto_id = function (o) {
    if (!_.isNumber(auto_id.counter)) {
      auto_id.counter = -1;
    }
    auto_id.counter = auto_id.counter + 1;

    if (o.attr('id')) {
      return o.attr('id');
    }

    var new_id = "auto_id_" + auto_id.counter;
    $(o).attr('id', new_id);
    return new_id;
  };

  var is_numeric = function (val) {
    return _.isNumber(val) && !_.isNaN(val);
  };

  var log = function () {
    if (!window.console) { return; }
    return console.log.apply(console, arguments);
  };

  var classes = function (j) {
    var raw = j.attr('class');

    if (!raw)
      return [];

    var str = _.trim(raw);

    if (_.isEmpty(str))
      return [];

    return str.split(SPACES);
  };

  var known_classes  = function (j) {
    var arr = _.select(classes(j), function (v) {
      return _.contains(ALL_KNOWN_CLASSES, v);
    });
  };

  var custom_classes = function (j) {<commit_msg>Dev. checkpoint: Touchups.<commit_after>"use strict";

/* jshint undef: true, unused: false */
/* global Hogan , _ */ 

(function () {

  function throw_error (msg) {
    Hogan.cache = {};
    throw new Error(msg);
  }

  function findInScope(key, scope) {
    var val;
    if (scope && typeof scope === 'object' && scope[key] !== undefined && scope[key] !== null) {
      val = scope[key];
    }

    return val;
  }

  // === My monkey-patches to Hogan. ======
  // When a variable is not found,
  // I want to throw an Error.
  // ======================================
  Hogan.Template.prototype.f = function(key, ctx) {
    var val    = false,
    v          = null,
    found      = false,
    doModelGet = this.options.modelGet;

    for (var i = ctx.length - 1; i >= 0; i--) {
      v = ctx[i];
      val = findInScope(key, v, doModelGet);
      if (val !== undefined && val !== null) {
        found = true;
        break;
      }
    }

    if (!found) {
      throw_error("Value not found: " + key);
    }

    return val;
  }; // === .f

  Hogan.Template.prototype.d = function(key, ctx) {
    var val,
    names = key.split('.'),
    data  = _.detect(ctx, function (v) { return _.has(v, names[0]);});

    if (key === '.' && _.isArray(ctx[ctx.length - 2])) {
      throw new Error("Unknown key: " + key);
    }

    val = _.reduce(names, function (memo, v) { return memo && memo[v];}, data);

    if (val === undefined || val === null) {
      throw_error("Dot-notated value not found: " + key + " in: " + JSON.stringify(ctx));
    }
    return val;
  }; // === .d
  // ======================================
  // End of monkey-patches for Hogan.
  // ======================================

})();



// ======================================
// Start of client-side WWW_App.
// ======================================

var WWW_App = {};

(function () {

  var SPACES            = /\s+/;
  var ALL_KNOWN_CLASSES = 'no_reset reset page_load prepend append no_reset'.split(SPACES);
  var script_meta       = {};
  var the_scripts       = $('script[type="text/hogan"]');

  // ================================ Helpers
  var auto_id = function (o) {
    if (!_.isNumber(auto_id.counter)) {
      auto_id.counter = -1;
    }
    auto_id.counter = auto_id.counter + 1;

    if (o.attr('id')) {
      return o.attr('id');
    }

    var new_id = "auto_id_" + auto_id.counter;
    $(o).attr('id', new_id);
    return new_id;
  };

  var is_numeric = function (val) {
    return _.isNumber(val) && !_.isNaN(val);
  };

  var log = function () {
    if (!window.console) { return; }
    return console['log'].apply(console, arguments);
  };

  var classes = function (j) {
    var raw = j.attr('class');

    if (!raw)
      return [];

    var str = _.trim(raw);

    if (_.isEmpty(str))
      return [];

    return str.split(SPACES);
  };

  var known_classes  = function (j) {
    var arr = _.select(classes(j), function (v) {
      return _.contains(ALL_KNOWN_CLASSES, v);
    });
  };

  var custom_classes = function (j) {
{'fraction_non_alphanumeric': 0.23883559378101224, 'fraction_numerical': 0.0019847833278200462, 'mean_word_length': 2.4475484606613453, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3909902', 'n_tokens_mistral': 2083, 'n_tokens_neox': 1965, 'n_words': 488}