<commit_before>var log = console.log.bind(console);
var dir = (ver) => {
  if (['v0.17', 'v0.18'].indexOf(ver) > -1) {
    return 'Latest'
  }
  return ''
}
var baseUrlGen = (ver, lng) => `https://raw.githubusercontent.com/cryptape/cita/${ver|| 'develop'}/docs/${lng || 'zh-CN'}/${dir(ver)}`

const loadTags = () => {
  // let tag
  const tagList = document.querySelector("#tag-list")
  const fragment = document.createDocumentFragment()
  const appendTags = (tagNames) => {
    tagNames.forEach(tagName => {
      const item = document.createElement('li')
      item.innerHTML = `<a href="javascript:setVersion('${tagName}')">${tagName}</a>`
      fragment.appendChild(item)
    })
    tagList.appendChild(fragment)

  }
  if (fetch) {
    fetch('https://api.github.com/repos/cryptape/cita/tags').then(res => res.json()).then(tags => tags.slice(0, -5).filter(tag => !tag.name.endsWith('rc')).map(tag => tag.name)).then(tagNames => {
      window.tags = tagNames
      appendTags(tagNames)
    })
  } else {
    appendTags(['v0.17', 'v0.18rc', 'v0.18'])
  }
}


const handleSSRRouter = () => {
  const lngs = {
    en: 'en-US',
    zh: 'zh-CN'
  }
  const params = window.location.hash.replace('#/', '').split('/')
  if (Object.keys(lngs).indexOf(params[0]) > -1) {
    const fileRouter = !params[2] ? '' : params.slice(2).join('/')
    const newPath = `${window.location.hostname === 'localhost' ? '' : '/cita'}/#/` + fileRouter
    window.location.replace(newPath)
  }
}

const formatURLtoSSRRouter = (lng, ver) => {
  const lngs = {
    'en-US': 'en',
    'zh-CN': 'zh'
  }<commit_msg>fix: fix en ssr url[skip ci]<commit_after>var remoteUrls = {
  baseUrl: 'https://raw.githubusercontent.com/cryptape/cita/',
  tagsUrl: 'https://api.github.com/repos/cryptape/cita/tags/'
}
var dir = (ver) => {
  if (['v0.17', 'v0.18'].indexOf(ver) > -1) {
    return 'Latest'
  }
  return ''
}
var baseUrlGen = (ver, lng) => `${remoteUrls.baseUrl}${ver|| 'develop'}/docs/${lng || 'zh-CN'}/${dir(ver)}`

const loadTags = () => {
  // let tag
  const tagList = document.querySelector("#tag-list")
  const fragment = document.createDocumentFragment()
  const appendTags = (tagNames) => {
    tagNames.forEach(tagName => {
      const item = document.createElement('li')
      item.innerHTML = `<a href="javascript:setVersion('${tagName}')">${tagName}</a>`
      fragment.appendChild(item)
    })
    tagList.appendChild(fragment)

  }
  if (fetch) {
    fetch(remoteUrls.tagsUrl).then(res => res.json()).then(tags => tags.slice(0, -5).filter(tag => !tag.name.endsWith('rc')).map(tag => tag.name)).then(tagNames => {
      window.tags = tagNames
      appendTags(tagNames)
    })
  } else {
    appendTags(['v0.17', 'v0.18rc', 'v0.18'])
  }
}


const handleSSRRouter = () => {
  const lngs = {
    en: 'en-US',
    zh: 'zh-CN'
  }
  const params = window.location.hash.replace('#/', '').split('/')
  if (Object.keys(lngs).indexOf(params[0]) > -1) {
    let fileRouter = !params[2] ? '' : params.slice(2).join('/')
    fileRouter = fileRouter + `?version=${params[1]}&lng=${lngs[params[0]]}`
    const newPath = `${window.location.hostname === 'localhost' ? '' : '/cita'}/#/` + fileRouter
    window.location.replace(newPath)
  }
}

const formatURLtoSSRRouter = (lng, ver) => {
  const lngs = {
    'en-US': 'en',
    'zh-CN': 'zh'
  }
{'fraction_non_alphanumeric': 0.21917395236659631, 'fraction_numerical': 0.013867952969550798, 'mean_word_length': 3.4299065420560746, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 35, 'https://': 4, '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': '4185699', 'n_tokens_mistral': 1242, 'n_tokens_neox': 1229, 'n_words': 197}