<commit_before>import Component from '@ember/component';
import { alias } from '@ember/object/computed';
import { later } from '@ember/runloop';
import $ from 'jquery';
import { Promise } from 'rsvp';

export default Component.extend({
  tagName: 'img',
  classNames: ['gravatar'],
  attributeBindings: [
    'src',
    'alt',
    'title',
    'data-sending-progress',
    'data-receiving-progress',
  ],
  src: alias('peer.avatarUrl'),
  alt: alias('peer.label'),
  title: alias('peer.uuid'),
  'data-sending-progress': alias('peer.transfer.sendingProgress'),
  'data-receiving-progress': alias('peer.transfer.receivingProgress'),

  toggleTransferCompletedClass() {
    const className = 'transfer-completed';

    later(
      this,
      function toggleClass() {
        this.$()
          .parent('.avatar')
          .addClass(className)
          .delay(2000)
          .queue(function removeClass() {
            $(this)
              .removeClass(className)
              .dequeue();
          });
      },
      250
    );
  },

  didInsertElement(...args) {
    this._super(args);
    const peer = this.get('peer');

    this.toggleTransferCompletedClass = this.toggleTransferCompletedClass.bind(
      this
    );

    peer.on('didReceiveFile', this.toggleTransferCompletedClass);
    peer.on('didSendFile', this.toggleTransferCompletedClass);
  },

  willDestroyElement(...args) {
    this._super(args);
    const peer = this.get('peer');

    peer.off('didReceiveFile', this.toggleTransferCompletedClass);
    peer.off('didSendFile', this.toggleTransferCompletedClass);
  },

  // Delegate click to hidden file field in peer template
  click() {
    if (this.canSendFile()) {
      this.$()
        .closest('.peer')
        .find('input[type=file]')
        .click();
    }
  },

  // Handle drop events
  dragEnter(event) {
    this.cancelEvent(event);

    this.$()
      .parent('.avatar')<commit_msg>Fix ember deprecation warning for .off(event) call<commit_after>import Component from '@ember/component';
import { alias } from '@ember/object/computed';
import { later } from '@ember/runloop';
import $ from 'jquery';
import { Promise } from 'rsvp';

export default Component.extend({
  tagName: 'img',
  classNames: ['gravatar'],
  attributeBindings: [
    'src',
    'alt',
    'title',
    'data-sending-progress',
    'data-receiving-progress',
  ],
  src: alias('peer.avatarUrl'),
  alt: alias('peer.label'),
  title: alias('peer.uuid'),
  'data-sending-progress': alias('peer.transfer.sendingProgress'),
  'data-receiving-progress': alias('peer.transfer.receivingProgress'),

  toggleTransferCompletedClass() {
    const className = 'transfer-completed';

    later(
      this,
      function toggleClass() {
        this.$()
          .parent('.avatar')
          .addClass(className)
          .delay(2000)
          .queue(function removeClass() {
            $(this)
              .removeClass(className)
              .dequeue();
          });
      },
      250
    );
  },

  init(...args) {
    this._super(args);

    this.toggleTransferCompletedClass = this.toggleTransferCompletedClass.bind(
      this
    );
  },

  didInsertElement(...args) {
    this._super(args);
    const peer = this.get('peer');

    peer.on('didReceiveFile', this.toggleTransferCompletedClass);
    peer.on('didSendFile', this.toggleTransferCompletedClass);
  },

  willDestroyElement(...args) {
    this._super(args);
    const peer = this.get('peer');

    peer.off('didReceiveFile', this.toggleTransferCompletedClass);
    peer.off('didSendFile', this.toggleTransferCompletedClass);
  },

  // Delegate click to hidden file field in peer template
  click() {
    if (this.canSendFile()) {
      this.$()
        .closest('.peer')
        .find('input[type=file]')
        .click();
    }
  },

  // Handle drop events
  dragEnter(event) {
    this.cancelEvent(event);

    this.$()
      .parent('.avatar')
{'fraction_non_alphanumeric': 0.15578786333503314, 'fraction_numerical': 0.0035696073431922487, 'mean_word_length': 2.812439261418853, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '749519', 'n_tokens_mistral': 1200, 'n_tokens_neox': 1155, 'n_words': 215}