<commit_before><template>
<div class="veui-check-button-group veui-button-group"
  :ui="ui"
  role="listbox"
  aria-multiselectable="true"
  :aria-readonly="String(realReadonly)"
  :aria-disabled="String(realDisabled)">
  <veui-button
    :class="{
      'veui-button-selected': localValue.indexOf(item.value) !== -1
    }"
    :ui="inheritedUi"
    v-for="(item, index) in items"
    :key="index"
    :disabled="item.disabled || realDisabled || realReadonly"
    @click="handleChange(item.value)"
    role="option"
    :aria-selected="String(localValue.indexOf(item.value) !== -1)"
    :aria-posinset="index + 1"
    :aria-setsize="items.length">
    <slot v-bind="item">{{ item.label }}</slot>
  </veui-button>
</div>
</template>

<script>
import input from '../mixins/input'
import ui from '../mixins/ui'
import { includes, findIndex } from 'lodash'
import Button from './Button'

export default {
  name: 'veui-check-button-group',
  components: {
    'veui-button': Button
  },
  mixins: [ui, input],
  model: {
    event: 'change'
  },
  props: {
    items: Array,
    value: Array
  },
  data () {
    return {
      localValue: null
    }
  },
  watch: {
    value (val) {
      this.localValue = val || []
    }
  },
  methods: {
    handleChange (val) {
      if (!includes(this.localValue, val)) {
        this.localValue.push(val)
      } else {
        this.localValue.splice(findIndex(this.localValue, item => item === val), 1)
      }
      this.$emit('change', this.localValue)
    }
  }
}
</script>
<commit_msg>fix CheckButtonGroup<commit_after><template>
<div class="veui-check-button-group veui-button-group"
  :ui="ui"
  role="listbox"
  aria-multiselectable="true"
  :aria-readonly="String(realReadonly)"
  :aria-disabled="String(realDisabled)">
  <veui-button
    :class="{
      'veui-button-selected': localValue.indexOf(item.value) !== -1
    }"
    :ui="inheritedUi"
    v-for="(item, index) in items"
    :key="index"
    :disabled="item.disabled || realDisabled || realReadonly"
    @click="handleChange(item.value)"
    role="option"
    :aria-selected="String(localValue.indexOf(item.value) !== -1)"
    :aria-posinset="index + 1"
    :aria-setsize="items.length">
    <slot v-bind="item">{{ item.label }}</slot>
  </veui-button>
</div>
</template>

<script>
import input from '../mixins/input'
import ui from '../mixins/ui'
import { includes, findIndex } from 'lodash'
import Button from './Button'

export default {
  name: 'veui-check-button-group',
  components: {
    'veui-button': Button
  },
  mixins: [ui, input],
  model: {
    event: 'change'
  },
  props: {
    items: Array,
    value: {
      type: Array,
      default () {
        return []
      }
    }
  },
  data () {
    return {
      localValue: this.value
    }
  },
  watch: {
    value (val) {
      this.localValue = val || []
    }
  },
  methods: {
    handleChange (val) {
      if (!includes(this.localValue, val)) {
        this.localValue.push(val)
      } else {
        this.localValue.splice(findIndex(this.localValue, item => item === val), 1)
      }
      this.$emit('change', this.localValue)
    }
  }
}
</script>

{'fraction_non_alphanumeric': 0.17894736842105263, 'fraction_numerical': 0.002551834130781499, 'mean_word_length': 2.900497512437811, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 25, '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': '1783692', 'n_tokens_mistral': 1109, 'n_tokens_neox': 1088, 'n_words': 200}