<commit_before>/**!
 * AngularJS file upload/drop directive with http post and progress
 * @author  Danial  <<EMAIL>>
 * @version 1.0.2
 */
(function() {
	
var angularFileUpload = angular.module('angularFileUpload', []);

angularFileUpload.html5 = !!window.FormData;

if (!angularFileUpload.html5) {
	HTMLInputElement.prototype.realAddEventListener = HTMLInputElement.prototype.addEventListener;

	HTMLInputElement.prototype.addEventListener = function(e, fn, b, d) {
		if (e === 'change' && this.getAttribute('type') == 'file') {
			if (!this.__isWrapped && (this.getAttribute('ng-file-select') != null || this.getAttribute('data-ng-file-select') != null)) {
				var wrap = document.createElement('div');
				wrap.innerHTML = '<div class="js-fileapi-wrapper" style="position:relative; overflow:hidden"></div>';
				wrap = wrap.firstChild;
				var parent = this.parentNode;
				parent.insertBefore(wrap, this);
				parent.removeChild(this);
				wrap.appendChild(this);
				this.__isWrapped = true;
			}
			this.realAddEventListener(e, 
					function(evt) {
						evt.target.files = FileAPI.getFiles(evt);
						evt.target.files.item = function(i) {
							return evt.target.files[i] || null;
						}
						fn(evt);
					}, b, d); 
		} else {
			this.realAddEventListener(e, fn, b, d);
		}
	};
	
	(function () {
		//load FileAPI
		if (!window.FileAPI || !FileAPI.upload) {
			var base = '', script = document.createElement('script'), allScripts = document.getElementsByTagName('script'), i, index;
			if (window.FileAPI && window.FileAPI.jsPath) {
				base = window.FileAPI.jsPath;
			} else {
				for (i = 0; i < allScripts.length; i++) {
					index = allScripts[i].src.indexOf('angular-file-upload.js')
					if (index == -1) {
						index = allScripts[i].src.indexOf('angular-file-upload.min.js');
					}
					if (index > -1) {
						base = allScripts[i].src.substring(0, index);
						break;
					}
				}
			}

			if (!window.FileAPI || FileAPI.staticPath == null) {
				FileAPI = {
					staticPath: base
				}
			}
	
<<<<<<< HEAD
			script.setAttribute('src', base + "FileAPI.js");
=======
			script.setAttribute('src', base + "FileAPI.min.js");
>>>>>>> 20ca5c79183597eaac9c7f21c3894528ede17cb8
			document.getElementsByTagName('head')[0].appendChild(script);
		}
	})();
}

angularFileUpload.XMLHttpRequest = function() {
	if (!angularFileUpload.html5) {
		window.FormData = FormData = function() {
			return {
				append: function(key, val) {
					this[key] = val;
				}
			};
		};
		var xhr = {
			onreadystatechange: function(){},
			headers: {},
			responseHeaders: {},
			config: {
				complete: function(err, x) {
					xhr.status = x.status;
					xhr.readyState = 4;
					xhr.responseHeaders = x.getAllResponseHeaders();
					xhr.responseText = x.responseText;
					xhr.onreadystatechange();
				}
			},
			getAllResponseHeaders: function() {
				return this.responseHeaders;
			},
			setRequestHeader: function(key, value) {<commit_msg>FIX unmerged setAttribute for 'FileApi.min.js'<commit_after>/**!
 * AngularJS file upload/drop directive with http post and progress
 * @author  Danial  <<EMAIL>>
 * @version 1.0.2
 */
(function() {
	
var angularFileUpload = angular.module('angularFileUpload', []);

angularFileUpload.html5 = !!window.FormData;

if (!angularFileUpload.html5) {
	HTMLInputElement.prototype.realAddEventListener = HTMLInputElement.prototype.addEventListener;

	HTMLInputElement.prototype.addEventListener = function(e, fn, b, d) {
		if (e === 'change' && this.getAttribute('type') == 'file') {
			if (!this.__isWrapped && (this.getAttribute('ng-file-select') != null || this.getAttribute('data-ng-file-select') != null)) {
				var wrap = document.createElement('div');
				wrap.innerHTML = '<div class="js-fileapi-wrapper" style="position:relative; overflow:hidden"></div>';
				wrap = wrap.firstChild;
				var parent = this.parentNode;
				parent.insertBefore(wrap, this);
				parent.removeChild(this);
				wrap.appendChild(this);
				this.__isWrapped = true;
			}
			this.realAddEventListener(e, 
					function(evt) {
						evt.target.files = FileAPI.getFiles(evt);
						evt.target.files.item = function(i) {
							return evt.target.files[i] || null;
						}
						fn(evt);
					}, b, d); 
		} else {
			this.realAddEventListener(e, fn, b, d);
		}
	};
	
	(function () {
		//load FileAPI
		if (!window.FileAPI || !FileAPI.upload) {
			var base = '', script = document.createElement('script'), allScripts = document.getElementsByTagName('script'), i, index;
			if (window.FileAPI && window.FileAPI.jsPath) {
				base = window.FileAPI.jsPath;
			} else {
				for (i = 0; i < allScripts.length; i++) {
					index = allScripts[i].src.indexOf('angular-file-upload.js')
					if (index == -1) {
						index = allScripts[i].src.indexOf('angular-file-upload.min.js');
					}
					if (index > -1) {
						base = allScripts[i].src.substring(0, index);
						break;
					}
				}
			}

			if (!window.FileAPI || FileAPI.staticPath == null) {
				FileAPI = {
					staticPath: base
				}
			}
	
			script.setAttribute('src', base + "FileAPI.min.js");
			document.getElementsByTagName('head')[0].appendChild(script);
		}
	})();
}

angularFileUpload.XMLHttpRequest = function() {
	if (!angularFileUpload.html5) {
		window.FormData = FormData = function() {
			return {
				append: function(key, val) {
					this[key] = val;
				}
			};
		};
		var xhr = {
			onreadystatechange: function(){},
			headers: {},
			responseHeaders: {},
			config: {
				complete: function(err, x) {
					xhr.status = x.status;
					xhr.readyState = 4;
					xhr.responseHeaders = x.getAllResponseHeaders();
					xhr.responseText = x.responseText;
					xhr.onreadystatechange();
				}
			},
			getAllResponseHeaders: function() {
				return this.responseHeaders;
			},
			setRequestHeader: function(key, value) {
{'fraction_non_alphanumeric': 0.16301912803722213, 'fraction_numerical': 0.008443908323281062, 'mean_word_length': 3.3281133482475767, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, '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': '5733903', 'n_tokens_mistral': 2345, 'n_tokens_neox': 1914, 'n_words': 343}