<commit_before>module lui.iban {
	"use strict";

	export class LuidIbanController {
		public static IID: string = "luidIbanController";
		public static $inject: Array<string> = ["$scope", "iban"];
		private $scope: ILuidIbanScope;
		private ngModelCtrl: ng.INgModelController;
		private countryInput: ng.IAugmentedJQuery;
		private controlInput: ng.IAugmentedJQuery;
		private bbanInput: ng.IAugmentedJQuery;

		private ibanChecker: IBANStatic;

		constructor($scope: ILuidIbanScope, iban: IBANStatic) {
			this.$scope = $scope;
			this.ibanChecker = iban;
			this.initScope();
		}

		public setNgModelCtrl(ngModelCtrl: ng.INgModelController): void {
			this.ngModelCtrl = ngModelCtrl;
			this.ngModelCtrl.$render = (): void => {
				let iban = this.getViewValue();
				if (!!iban) {
					this.$scope.countryCode = iban.substring(0, 2);
					this.$scope.controlKey = iban.substring(2, 4);
					this.$scope.bban = iban.substring(4);
				} else {
					this.$scope.countryCode = "";
					this.$scope.controlKey = "";
					this.$scope.bban = "";
				}
			};
			(<ILuidIbanValidators>this.ngModelCtrl.$validators).iban = (): boolean => {
				if (!!this.ngModelCtrl.$viewValue) {
					return this.ibanChecker.isValid(ngModelCtrl.$viewValue);
				}
				return true;
			};
		}

		public setInputs(elt: ng.IAugmentedJQuery): void {
			let inputs = elt.find("input");
			this.countryInput = angular.element(inputs[0]);
			this.controlInput = angular.element(inputs[1]);
			this.bbanInput = angular.element(inputs[2]);
		}

		private initScope(): void {
			this.$scope.updateValue = (): void => {
				this.setViewValue(this.$scope.countryCode.toUpperCase() + this.$scope.controlKey.toUpperCase() + this.$scope.bban.toUpperCase());
			};

			this.$scope.pasteIban = (event: ClipboardEvent): void => {
				this.setViewValue(event.clipboardData.getData("text/plain"));
				this.ngModelCtrl.$render();
				(<HTMLInputElement>event.target).blur();
			};

			this.$scope.selectInput = (event: JQueryEventObject): void => {
				(<HTMLInputElement>event.target).select();
			};

			this.$scope.setTouched = () => {
				this.setTouched();
			};

			this.$scope.controlKeyMappings = { 
				8: () => { // backspace
					if (!this.$scope.controlKey) {
						this.focusCountryInput();
					}
				}
			};
			this.$scope.bbanMappings = { 
				8: () => { // backspace
					if (!this.$scope.bban) {
						this.focusControlInput();
					}
				}
			};
		}

		private getViewValue(): string {
			return <string>this.ngModelCtrl.$viewValue;
		}

		private setViewValue(iban: string): void {
			this.ngModelCtrl.$setViewValue(iban);
			this.ngModelCtrl.$setTouched();
		}

		private setTouched(): void {
			this.ngModelCtrl.$setTouched();
		}

		private focusCountryInput(): void {
			this.countryInput[0].focus();
			this.countryInput[0]["selectionStart"] = this.countryInput[0]["selectionEnd"];
		}
		private focusControlInput(): void {
			this.controlInput[0].focus();
			this.controlInput[0]["selectionStart"] = this.controlInput[0]["selectionEnd"];
		}
	}

	angular.module("lui.iban").controller(LuidIbanController.IID, LuidIbanController);
}
<commit_msg>iban  [rem] typings dependency to IBANStatic<commit_after>module lui.iban {
	"use strict";

	export interface IbanChecker {
		isValid(value: string): boolean;
	}

	export class LuidIbanController {
		public static IID: string = "luidIbanController";
		public static $inject: Array<string> = ["$scope", "iban"];
		private $scope: ILuidIbanScope;
		private ngModelCtrl: ng.INgModelController;
		private countryInput: ng.IAugmentedJQuery;
		private controlInput: ng.IAugmentedJQuery;
		private bbanInput: ng.IAugmentedJQuery;

		private ibanChecker: IbanChecker;

		constructor($scope: ILuidIbanScope, iban: IbanChecker) {
			this.$scope = $scope;
			this.ibanChecker = iban;
			this.initScope();
		}

		public setNgModelCtrl(ngModelCtrl: ng.INgModelController): void {
			this.ngModelCtrl = ngModelCtrl;
			this.ngModelCtrl.$render = (): void => {
				let iban = this.getViewValue();
				if (!!iban) {
					this.$scope.countryCode = iban.substring(0, 2);
					this.$scope.controlKey = iban.substring(2, 4);
					this.$scope.bban = iban.substring(4);
				} else {
					this.$scope.countryCode = "";
					this.$scope.controlKey = "";
					this.$scope.bban = "";
				}
			};
			(<ILuidIbanValidators>this.ngModelCtrl.$validators).iban = (): boolean => {
				if (!!this.ngModelCtrl.$viewValue) {
					return this.ibanChecker.isValid(ngModelCtrl.$viewValue);
				}
				return true;
			};
		}

		public setInputs(elt: ng.IAugmentedJQuery): void {
			let inputs = elt.find("input");
			this.countryInput = angular.element(inputs[0]);
			this.controlInput = angular.element(inputs[1]);
			this.bbanInput = angular.element(inputs[2]);
		}

		private initScope(): void {
			this.$scope.updateValue = (): void => {
				this.setViewValue(this.$scope.countryCode.toUpperCase() + this.$scope.controlKey.toUpperCase() + this.$scope.bban.toUpperCase());
			};

			this.$scope.pasteIban = (event: ClipboardEvent): void => {
				this.setViewValue(event.clipboardData.getData("text/plain"));
				this.ngModelCtrl.$render();
				(<HTMLInputElement>event.target).blur();
			};

			this.$scope.selectInput = (event: JQueryEventObject): void => {
				(<HTMLInputElement>event.target).select();
			};

			this.$scope.setTouched = () => {
				this.setTouched();
			};

			this.$scope.controlKeyMappings = { 
				8: () => { // backspace
					if (!this.$scope.controlKey) {
						this.focusCountryInput();
					}
				}
			};
			this.$scope.bbanMappings = { 
				8: () => { // backspace
					if (!this.$scope.bban) {
						this.focusControlInput();
					}
				}
			};
		}

		private getViewValue(): string {
			return <string>this.ngModelCtrl.$viewValue;
		}

		private setViewValue(iban: string): void {
			this.ngModelCtrl.$setViewValue(iban);
			this.ngModelCtrl.$setTouched();
		}

		private setTouched(): void {
			this.ngModelCtrl.$setTouched();
		}

		private focusCountryInput(): void {
			this.countryInput[0].focus();
			this.countryInput[0]["selectionStart"] = this.countryInput[0]["selectionEnd"];
		}
		private focusControlInput(): void {
			this.controlInput[0].focus();
			this.controlInput[0]["selectionStart"] = this.controlInput[0]["selectionEnd"];
		}
	}

	angular.module("lui.iban").controller(LuidIbanController.IID, LuidIbanController);
}

{'fraction_non_alphanumeric': 0.15932683233721295, 'fraction_numerical': 0.0050330292544825414, 'mean_word_length': 3.7173590504451037, 'pattern_counts': {'":': 0, '<': 13, '<?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': '4302933', 'n_tokens_mistral': 2571, 'n_tokens_neox': 2110, 'n_words': 319}