<commit_before>import {
  Directive,
  forwardRef,
  Provider,
} from '@angular/core';
import {
  ControlValueAccessor,
  NG_VALUE_ACCESSOR,
} from '@angular/forms';

import { RecaptchaComponent } from './recaptcha.component';

export const RECAPTCHA_VALUE_ACCESSOR = new Provider(NG_VALUE_ACCESSOR, {
  multi: true,
  useExisting: forwardRef(() => RecaptchaValueAccessor),
});

@Directive({
  selector: 'recaptcha',
  host: { '(resolved)': 'onResolve($event)' },
  providers: [RECAPTCHA_VALUE_ACCESSOR],
})
export class RecaptchaValueAccessor implements ControlValueAccessor {
  /** @internal */
  private onChange: (value: string) => void;

  /** @internal */
  private onTouched: () => void;

  constructor(private host: RecaptchaComponent) { }

  public writeValue(value: string): void {
    if (!value) {
      this.host.reset();
    }
  }

  /** @internal */
  // tslint:disable-next-line:no-unused-variable
  private onResolve($event: string) {
    if (this.onChange) {
      this.onChange($event);
    }
    if (this.onTouched) {
      this.onTouched();
    }
  }

  public registerOnChange(fn: (value: string) => void): void { this.onChange = fn; }
  public registerOnTouched(fn: () => void): void { this.onTouched = fn; }
}<commit_msg>tslint: rearrange members<commit_after>import {
  Directive,
  forwardRef,
  Provider,
} from '@angular/core';
import {
  ControlValueAccessor,
  NG_VALUE_ACCESSOR,
} from '@angular/forms';

import { RecaptchaComponent } from './recaptcha.component';

export const RECAPTCHA_VALUE_ACCESSOR = new Provider(NG_VALUE_ACCESSOR, {
  multi: true,
  useExisting: forwardRef(() => RecaptchaValueAccessor),
});

@Directive({
  selector: 'recaptcha',
  host: { '(resolved)': 'onResolve($event)' },
  providers: [RECAPTCHA_VALUE_ACCESSOR],
})
export class RecaptchaValueAccessor implements ControlValueAccessor {
  /** @internal */
  private onChange: (value: string) => void;

  /** @internal */
  private onTouched: () => void;

  constructor(private host: RecaptchaComponent) { }

  public writeValue(value: string): void {
    if (!value) {
      this.host.reset();
    }
  }

  public registerOnChange(fn: (value: string) => void): void { this.onChange = fn; }
  public registerOnTouched(fn: () => void): void { this.onTouched = fn; }

  /** @internal */
  // tslint:disable-next-line:no-unused-variable
  private onResolve($event: string) {
    if (this.onChange) {
      this.onChange($event);
    }
    if (this.onTouched) {
      this.onTouched();
    }
  }
}
{'fraction_non_alphanumeric': 0.15067945643485212, 'fraction_numerical': 0.0, 'mean_word_length': 3.996007984031936, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '4035141', 'n_tokens_mistral': 847, 'n_tokens_neox': 824, 'n_words': 168}