<commit_before><template>
  <div v-if="alert_Is_Visible" :class="['alert', alert.type]">
    <a class="close" v-if="alert.dismissable" v-on:click="dismissMessage">&times;</a>
    <span v-html="alert.message"></span>
  </div>
</template>

<script>
  export default {
    methods: {
      dismissMessage: function () {
        this.$nuxt.$store.dispatch('dismiss_alert')
      }
    },
    computed: {
      alert: function () {
        if (this.$nuxt.$store.state.alert) {
          return this.$nuxt.$store.state.alert
        } else {
          return { message: '', type: '', dismissable: true, duration: 0 }
        }
      },
      alert_Is_Visible: function () {
        if (this.alert.message.length > 0 && !this.alert.dismissable) {
          return true
        } else if (this.alert.message.length > 0 && this.alert.dismissable) {
          return true
        } else {
          return false
        }
      }
    }
  }
</script>

<style scoped>
  .alert {
    position: absolute;
    z-index: 1002;
    top: 10px;
    left: 40px;<commit_msg>alert timeout/auto-timeout functionality<commit_after><template>
  <div v-if="alert_Is_Visible" :class="['alert', alert.type]">
    <a class="close" v-if="alert.dismissable" v-on:click="dismissMessage">&times;</a>
    <span v-html="alert.message"></span>
  </div>
</template>

<script>
  export default {
    methods: {
      dismissMessage: function () {
        this.$nuxt.$store.dispatch('dismiss_alert')
      }
    },
    computed: {
      alert: function () {
        if (this.$nuxt.$store.state.alert) {
          return this.$nuxt.$store.state.alert
        } else {
          return { message: '', type: '', dismissable: true, duration: 0 }
        }
      },
      alert_Is_Visible: function () {
        var self = this
        var timeout = this.$nuxt.$store.state.alert.duration === 0 ? 1500 : this.$nuxt.$store.state.alert.duration
        if (this.alert.message.length > 0 && !this.alert.dismissable) {
          setTimeout(self.dismissMessage, timeout)
          return true
        } else if (this.alert.message.length > 0 && this.alert.dismissable) {
          setTimeout(self.dismissMessage, timeout)
          return true
        } else {
          return false
        }
      }
    }
  }
</script>

<style scoped>
  .alert {
    position: absolute;
    z-index: 1002;
    top: 10px;
    left: 40px;
{'fraction_non_alphanumeric': 0.1538785834738617, 'fraction_numerical': 0.011382799325463743, 'mean_word_length': 2.2024291497975708, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 29, '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': '3006646', 'n_tokens_mistral': 776, 'n_tokens_neox': 741, 'n_words': 144}