<commit_before>let spinnerElements = {};
let spinnerShown = {};

export default {
  show: function(elementOrId) {
    var elementId;
    var element;

    if (typeof elementOrId === 'string') {
      elementId = elementOrId;
    } else if (elementOrId) {
      element = elementOrId;
      if (element.id) {
        elementId = element.id;
      } else {
        elementId = element.id = 'temp-' + tempId++;
      }
    } else {
      elementId = 'cssload-container';
    }

    if (!element) {
      element = document.getElementById(elementId);
      if (!element) {
        element = document.createElement('div');
        element.id = elementId;
        element.innerHTML = '<div class="cssload-container"><div class="cssload-loading"><i></i><i></i></div></div>';
        document.body.appendChild(element);
      }
    }

    spinnerElements[elementId] = element;
    spinnerShown[elementId] = Date.now();

    element.style.display = 'block';
  },

  hide: function(elementOrId) {
    var elementId;

    if (typeof elementOrId === 'string') {
      elementId = elementOrId;
    } else if (elementOrId) {
      elementId = elementOrId.id;
    } else {
      elementId = 'cssload-container';
    }

    var element = spinnerElements[elementId];
    var shown = spinnerShown[elementId];

    if (shown) {
      var minTime = 500;
      var now = Date.now();

      if (now - shown > minTime) {
        element.style.display = 'none';<commit_msg>Allow spinner to be opened in a custom parent element<commit_after>let spinnerElements = {};
let spinnerShown = {};
let tempId = 0;

export default {
  show: function(elementOrId, parentElementOrId) {
    var elementId;
    var element;

    if (typeof elementOrId === 'string') {
      elementId = elementOrId;
    } else if (elementOrId) {
      element = elementOrId;
      if (element.id) {
        elementId = element.id;
      } else {
        elementId = element.id = 'spinner-temp-' + tempId++;
      }
    } else {
      elementId = 'cssload-container';
    }

    if (!element) {
      element = document.getElementById(elementId);
      if (!element) {
        element = document.createElement('div');
        element.id = elementId;
        element.innerHTML = '<div class="cssload-container"><div class="cssload-loading"><i></i><i></i></div></div>';

        let parentElement;
        if (parentElementOrId) {
          if (typeof parentElementOrId === 'string') {
            parentElement = document.getElementById(parentElementOrId);
          } else {
            parentElement = parentElement;
          }
        } else {
          parentElement = document.body;
        }
        parentElement.appendChild(element);
      }
    }

    spinnerElements[elementId] = element;
    spinnerShown[elementId] = Date.now();

    element.style.display = 'block';
  },

  hide: function(elementOrId) {
    var elementId;

    if (typeof elementOrId === 'string') {
      elementId = elementOrId;
    } else if (elementOrId) {
      elementId = elementOrId.id;
    } else {
      elementId = 'cssload-container';
    }

    var element = spinnerElements[elementId];
    var shown = spinnerShown[elementId];

    if (shown) {
      var minTime = 500;
      var now = Date.now();

      if (now - shown > minTime) {
        element.style.display = 'none';
{'fraction_non_alphanumeric': 0.13198429477499246, 'fraction_numerical': 0.0021141649048625794, 'mean_word_length': 2.4214876033057853, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, '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': '5876354', 'n_tokens_mistral': 1010, 'n_tokens_neox': 979, 'n_words': 216}