<commit_before>import { Component, Input, HostBinding } from '@angular/core';

import { IDraftConfigDTO, IDraftState, DraftPhase, IDraftConfigDrafterDTO } from '../../../heroes-draft-service/heroes-draft-service.module';
import { HeroesService, HeroData } from '../../../heroes-data-service/heroes-data-service.module';


@Component({
  selector: 'team-hero-picks',
  templateUrl: './team-hero-picks.component.html',
  styleUrls: ['./team-hero-picks.component.scss']
})
export class TeamHeroPicksComponent {
  private heroes: HeroData[];

  @Input()
  @HostBinding('attr.team')
  public team: number;

  @Input()
  public slots: number[];

  @Input()
  public teamSlots: number[];

  @Input()
  public state: IDraftState;

  @Input()
  public config: IDraftConfigDTO;

  @Input()
  public selectedHero: HeroData;



  constructor(private heroesService: HeroesService) {
    heroesService.getHeroes().subscribe((heroes) => {
      this.heroes = heroes;
    });

  }

  public get currentPick(): number {
    return this.state && this.state.phase !== DraftPhase.WAITING ? this.state.picks.length : -1;
  }

  public get currentPickIndex(): number {
    return this.slots.indexOf(this.currentPick);
  }

  public get nextPickIndex(): number {
    let currIdx = this.currentPickIndex;
    if (currIdx !== -1) {
      let nextIdx = currIdx + 1;
      if (this.slots[nextIdx] === this.currentPick + 1) {
        return nextIdx;
      }
    }
    return -1;
  }

  public get isTeamPicking(): boolean {
    return this.slots.indexOf(this.currentPick) !== -1;
  }

  public getSlot(index): number {
    return this.slots ? this.slots[index] : -1;
  }

  public get teamsNextPick(): number {
    let currPick = this.currentPick;
    for (let i = 0; i < this.teamSlots.length; i++) {
      if (currPick <= this.teamSlots[i]) {
        return this.teamSlots[i];
      }
    }
    return -1;
  }

  private getHeroById(heroId: string): HeroData {
    if (this.heroes) {
      return this.heroes.find((value) => {
        return value.id === heroId;
      });
    }
    return null;
  }

  public isPreviewPick(index): boolean {
    let ntPick = this.teamsNextPick;
    if ((<IDraftConfigDrafterDTO>this.config).team === this.team + 1) {
      return this.slots.indexOf(ntPick) === index;
    }
    return false;
  }

  public isHeroTaken(heroId: string): boolean {
    return this.state && this.state.picks.indexOf(heroId) !== -1;
  }

  public getPick(index) {
    if (this.slots && this.heroes && this.state && this.state.picks) {
      let pickedHeroId = this.state.picks[this.slots[index]];
      if (pickedHeroId === 'failed_ban') {
        return {
          id: 'failed_ban',
          iconSmall: null,<commit_msg>fixed invalid return type<commit_after>import { Component, Input, HostBinding } from '@angular/core';

import { IDraftConfigDTO, IDraftState, DraftPhase, IDraftConfigDrafterDTO } from '../../../heroes-draft-service/heroes-draft-service.module';
import { HeroesService, HeroData } from '../../../heroes-data-service/heroes-data-service.module';


@Component({
  selector: 'team-hero-picks',
  templateUrl: './team-hero-picks.component.html',
  styleUrls: ['./team-hero-picks.component.scss']
})
export class TeamHeroPicksComponent {
  private heroes: HeroData[];

  @Input()
  @HostBinding('attr.team')
  public team: number;

  @Input()
  public slots: number[];

  @Input()
  public teamSlots: number[];

  @Input()
  public state: IDraftState;

  @Input()
  public config: IDraftConfigDTO;

  @Input()
  public selectedHero: HeroData;



  constructor(private heroesService: HeroesService) {
    heroesService.getHeroes().subscribe((heroes) => {
      this.heroes = heroes;
    });

  }

  public get currentPick(): number {
    return this.state && this.state.phase !== DraftPhase.WAITING ? this.state.picks.length : -1;
  }

  public get currentPickIndex(): number {
    return this.slots.indexOf(this.currentPick);
  }

  public get nextPickIndex(): number {
    let currIdx = this.currentPickIndex;
    if (currIdx !== -1) {
      let nextIdx = currIdx + 1;
      if (this.slots[nextIdx] === this.currentPick + 1) {
        return nextIdx;
      }
    }
    return -1;
  }

  public get isTeamPicking(): boolean {
    return this.slots.indexOf(this.currentPick) !== -1;
  }

  public getSlot(index): number {
    return this.slots ? this.slots[index] : -1;
  }

  public get teamsNextPick(): number {
    let currPick = this.currentPick;
    for (let i = 0; i < this.teamSlots.length; i++) {
      if (currPick <= this.teamSlots[i]) {
        return this.teamSlots[i];
      }
    }
    return -1;
  }

  private getHeroById(heroId: string): HeroData {
    if (this.heroes) {
      return this.heroes.find((value) => {
        return value.id === heroId;
      });
    }
    return null;
  }

  public isPreviewPick(index): boolean {
    let ntPick = this.teamsNextPick;
    if ((<IDraftConfigDrafterDTO>this.config).team === this.team + 1) {
      return this.slots.indexOf(ntPick) === index;
    }
    return false;
  }

  public isHeroTaken(heroId: string): boolean {
    return this.state && this.state.picks.indexOf(heroId) !== -1;
  }

  public getPick(index): HeroData {
    if (this.slots && this.heroes && this.state && this.state.picks) {
      let pickedHeroId = this.state.picks[this.slots[index]];
      if (pickedHeroId === 'failed_ban') {
        return {
          id: 'failed_ban',
          franchise: 'none',
          title: '',
          iconSmall: null,
{'fraction_non_alphanumeric': 0.14845173041894352, 'fraction_numerical': 0.004007285974499089, 'mean_word_length': 2.964620938628159, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '5716514', 'n_tokens_mistral': 1886, 'n_tokens_neox': 1821, 'n_words': 384}