<commit_before>export function classToModules(className = [], cssModule) {
  const ClassName = [];
  let i = className.length;
  // eslint-disable-next-line
  while (i--) {
    if (cssModule[className[i]]) {
      ClassName.push(cssModule[className[i]]);
    }
  }
  return ClassName.join(' ').trim();
}

export function getClassName(className = '', cssModule) {
  if (cssModule) {
    return cssModule[className] || className;
  }
  return className;
}

export function setCssEndEvent(element, type, callback) {
  if (!element) {
    return false;
  }
  const capitalized = type.charAt(0).toUpperCase() + type.slice(1);
  if (element.style[`Webkit${capitalized}`] !== undefined) {
    return element.addEventListener(`webkit${capitalized}End`, callback);
  } else if (element.style.OTransition !== undefined) {
    return element.addEventListener(`o${type}End`, callback);
  }
  return element.addEventListener(`${type}End`, callback);
}

const POSITION_STATES = ['middle', 'left', 'right'];

export function toggleMoveClasses({
  element,
  root,
  cssModule = null,
  state = null,
}) {
  if (!element) {
    return false;
  }
  if (!state) {
    element.classList.remove(
      classToModules([`${root}--${POSITION_STATES[0]}`], cssModule),
      classToModules([`${root}--${POSITION_STATES[1]}`], cssModule),
      classToModules([`${root}--${POSITION_STATES[2]}`], cssModule),
    );
    return false;
  }
  const options = POSITION_STATES.filter(item => item !== state);
  let i = options.length;
  // eslint-disable-next-line<commit_msg>fix position states bug<commit_after>export function classToModules(className = [], cssModule) {
  const ClassName = [];
  let i = className.length;
  // eslint-disable-next-line
  while (i--) {
    if (cssModule[className[i]]) {
      ClassName.push(cssModule[className[i]]);
    }
  }
  return ClassName.join(' ').trim();
}

export function getClassName(className = '', cssModule) {
  if (cssModule) {
    return cssModule[className] || className;
  }
  return className;
}

export function setCssEndEvent(element, type, callback) {
  if (!element) {
    return false;
  }
  const capitalized = type.charAt(0).toUpperCase() + type.slice(1);
  if (element.style[`Webkit${capitalized}`] !== undefined) {
    return element.addEventListener(`webkit${capitalized}End`, callback);
  } else if (element.style.OTransition !== undefined) {
    return element.addEventListener(`o${type}End`, callback);
  }
  return element.addEventListener(`${type}End`, callback);
}

export function toggleMoveClasses({
  element,
  root,
  cssModule = null,
  state = null,
}) {
  if (!element) {
    return false;
  }
  const POSITION_STATES = ['middle', 'left', 'right'];
  if (!state) {
    element.classList.remove(
      classToModules([`${root}--${POSITION_STATES[0]}`], cssModule),
      classToModules([`${root}--${POSITION_STATES[1]}`], cssModule),
      classToModules([`${root}--${POSITION_STATES[2]}`], cssModule),
    );
    return false;
  }
  const options = POSITION_STATES.filter(item => item !== state);
  let i = options.length;
  // eslint-disable-next-line
{'fraction_non_alphanumeric': 0.1689777491131893, 'fraction_numerical': 0.0032247662044501773, 'mean_word_length': 4.161397670549085, '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': '5272347', 'n_tokens_mistral': 998, 'n_tokens_neox': 1001, 'n_words': 194}