<commit_before>'use babel'
/* globals atom */

import { View } from 'atom-space-pen-views'
import { Icons } from '../../assets/svgs'
import KDHelpView from './kd-help-view'
import KD from '../kd-states'

let lastPrompt, wasSticky

export default class StatusBarIcon extends View {

  static content () {
    this.div({
      class: 'inline-block kd-statusbar-icon'
    }, () => {
      this.raw(Icons.statusBar)
      this.span({
        outlet: 'message',
        class: 'inline-block loading-message'
      }, 'Initializing…')
    })
  }

  attached (event) {
    this.succeeded = []
    /* to give statusbar sometime to put other
       tiles installed by other packages */
    setTimeout(() => { this.init() }, 1000)
  }

  init () {
    this.setTooltip(null, true)

    KD.emitter.on('kd-state', prompt => {
      if (prompt === 'ALL_GOOD') {
        setTimeout(() => {
          this.setTooltip(prompt)
        }, 2000)
        this.element.classList.add('good')
      } else {
        this.setTooltip(prompt, true)
        this.element.classList.remove('good')
      }
    })

    KD.emitter.on('kd-state-loading', message => {
      this.element.classList.add('loading')
      this.setLoadingMessage(message)
    })

    KD.emitter.on('kd-state-loading-finished', () => {
      this.element.classList.remove('loading')
      this.setLoadingMessage('')
    })

    KD.emitter.on('kd-state-success', prompt => {
      this.succeeded.push(prompt)
      this.setTooltip(null, true, true)
    })
  }

  setLoadingMessage (message) {
    this.message.html(message)
  }

  setTooltip (prompt, sticky, force) {
    if (!force && prompt === lastPrompt && sticky === wasSticky) {<commit_msg>default param for loading message<commit_after>'use babel'
/* globals atom */

import { View } from 'atom-space-pen-views'
import { Icons } from '../../assets/svgs'
import KDHelpView from './kd-help-view'
import KD from '../kd-states'

let lastPrompt, wasSticky

export default class StatusBarIcon extends View {

  static content () {
    this.div({
      class: 'inline-block kd-statusbar-icon'
    }, () => {
      this.raw(Icons.statusBar)
      this.span({
        outlet: 'message',
        class: 'inline-block loading-message'
      }, 'Initializing…')
    })
  }

  attached (event) {
    this.succeeded = []
    /* to give statusbar sometime to put other
       tiles installed by other packages */
    setTimeout(() => { this.init() }, 1000)
  }

  init () {
    this.setTooltip(null, true)

    KD.emitter.on('kd-state', prompt => {
      if (prompt === 'ALL_GOOD') {
        setTimeout(() => {
          this.setTooltip(prompt)
        }, 2000)
        this.element.classList.add('good')
      } else {
        this.setTooltip(prompt, true)
        this.element.classList.remove('good')
      }
    })

    KD.emitter.on('kd-state-loading', message => {
      this.element.classList.add('loading')
      this.setLoadingMessage(message)
    })

    KD.emitter.on('kd-state-loading-finished', () => {
      this.element.classList.remove('loading')
      this.setLoadingMessage()
    })

    KD.emitter.on('kd-state-success', prompt => {
      this.succeeded.push(prompt)
      this.setTooltip(null, true, true)
    })
  }

  setLoadingMessage (message = '') {
    this.message.html(message)
  }

  setTooltip (prompt, sticky, force) {
    if (!force && prompt === lastPrompt && sticky === wasSticky) {
{'fraction_non_alphanumeric': 0.1590708615113202, 'fraction_numerical': 0.004704498676859747, 'mean_word_length': 2.5253886010362696, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '2332035', 'n_tokens_mistral': 1135, 'n_tokens_neox': 1086, 'n_words': 210}