/*! bootstrap-FileUpload - v0.7.0 */ !function(i,e,g,o){"use strict";var v={},t={},s={init:function(e){return v[i(this).attr("id")]={options:i.extend({},i.fn.bootstrapFileUpload.defaults,e||{}),wrapper:null,form:null,btnBar:null,btnWrapper:null,btnAdd:null,btnStart:null,btnCancel:null,btnReset:null,overallProgressBar:null,overallStatus:null,filePreviewTable:null,formData:null,arrayFiles:{},arrayLength:0},this.each(function(){!function(e){v[e].wrapper=i("#"+e),t.archives=["zip","7z","gz","gzip","rar","tar"],t.audio=["mp3","wav","wma","wpl","aac","flac","m4a","m4b","m4p","midi","ogg"],t.files=["doc","docx","dotx","docm","ods","odt","ott","ods","pdf","ppt","pptm","pptx","pub","rtf","csv","log","txt","xls","xlsm","xlsx"],t.images=["bmp","tif","tiff","gif","jpeg","jpg","png","svg","ico","raw"],t.video=["avi","flv","swf","m4v","mkv","mov","mp4","ogv","wmv"],a=e,i.each(v[a].options.fileTypes,function(e,o){i.isNumeric(e)?v[a].options.fileTypes[o]=t[o]:!i.isNumeric(e)&&i.isEmptyObject(o)&&(v[a].options.fileTypes[e]=t[e])}),!0!==v[e].options.debug&&!1!==v[e].options.debug&&(v[e].options.debug=!1);var a;if("function"!=typeof i().emulateTransitionEnd)return l(e,"bootstrap");if(!0===v[e].options.showThumb&&!0===v[e].options.useFontAwesome){if(!i("link[href*='fontawesome']").length&&!i("link[href*='font-awesome']").length)return l(e,"fontAwesome");if(!1===function(e){var o,a;if(o=i('').appendTo("body"),a=o.css("fontFamily"),o.remove(),"FontAwesome"===a)v[e].options.fontAwesomeVer=4;else{if(-1===a.indexOf("Font Awesome 5"))return!1;v[e].options.fontAwesomeVer=5}return!0}(e))return l(e,"fontAwesomeVersion")}if(null===v[e].options.url||!n(v[e].options.url))return l(e,"url");if("post"!==v[e].options.formMethod&&"get"!==v[e].options.formMethod)return l(e,"formMethod");if(null!==v[e].options.fallbackUrl&&!n(v[e].options.fallbackUrl))return l(e,"fallbackUrl");!1===v[e].options.forceFallback?(v[o=e].formData=new FormData,v[o].form=i('
'),v[o].btnBar=i('
'),v[o].btnWrapper=i('
'),v[o].btnAdd=i('
 Add Files…
'),v[o].btnReset=i(''),v[o].btnStart=i(''),v[o].btnCancel=i(''),v[o].overallProgressBar=i('
 
'),v[o].overallStatus=i('
Uploaded Successfully!
'),v[o].filePreviewTable=i(''),v[o].btnWrapper.append(v[o].btnAdd,v[o].btnReset,v[o].btnStart,v[o].btnCancel),v[o].btnBar.append(v[o].btnWrapper,v[o].overallProgressBar),v[o].form.append(v[o].btnBar,v[o].overallStatus),v[o].wrapper.append(v[o].form,v[o].filePreviewTable),v[o].btnAdd.on("change","input",function(e){s.addFile(o,e)}),v[o].btnReset.on("click",function(e){e.preventDefault(),s.resetUpload(o)}),v[o].btnStart.on("click",function(e){e.preventDefault(),s.uploadStart(o)}),v[o].btnCancel.on("click",function(){s.resetUpload(o)}),v[o].filePreviewTable.on("click",".fileupload-remove",function(){s.removeFile(o,i(this).val())})):function(a){v[a].form=i('
'),v[a].btnAdd=i('
 Add Files…
'),v[a].btnStart=i('
'),v[a].form.append(v[a].btnAdd,v[a].btnStart),v[a].options.hiddenInput&&i.each(v[a].options.hiddenInput,function(e,o){v[a].form.append('')});v[a].wrapper.append(v[a].form),v[a].btnAdd.on("change",".fileupload-fallback-add input[type=file]",function(){var e,o,a;e=i(this),o=e.get(0).files?e.get(0).files.length:1,a=e.val().replace(/\\/g,"/").replace(/.*\//,""),e.trigger("fileselect",[o,a])}),v[a].btnAdd.find(".fileupload-fallback-add input[type=file]").on("fileselect",function(e,o,a){var t,s;t=i(this).parents(".input-group").find("input[type=text]"),s=1v[e].options.maxFiles&&(g.alert("You're trying to upload "+l+" files and only "+v[e].options.maxFiles+" files is currently supported! The system will only upload what is supported and you will have to upload again."),l=v[e].options.maxFiles),v[e].filePreviewTable.detach();for(var i=0;iv[e].options.maxSize)g.alert('The file size for "'+d.name+'" is too large! Maximum supported file size is '+v[e].options.maxSize+"MB and the size of the file is "+f);else if(v[e].arrayFiles&&0<=y(e,d))g.alert('The file "'+d.name+'" is already in queue!');else{v[e].arrayFiles[n]=d,v[e].arrayLength=++v[e].arrayLength,v[e].btnStart.fadeIn("slow","linear"),v[e].btnCancel.fadeIn("slow","linear");var b='
Uploaded Successfully!
';if(!0===v[e].options.showThumb){var m=F(e,d,p,r);u=!1===v[e].options.multiUpload?''+m+''+d.name+''+f+''+b+'':''+m+''+d.name+''+f+''}else u=!1===v[e].options.multiUpload?''+d.name+''+f+''+b+'':''+d.name+''+f+'';v[e].filePreviewTable.append(u)}else g.alert('The file "'+d.name+'" is not a supported filetype!')}v[e].wrapper.append(v[e].filePreviewTable),v[e].filePreviewTable.fadeIn("slow","linear"),"function"==typeof v[e].options.onFileAdded&&v[e].options.onFileAdded.call(this)},uploadStart:function(a){i(".fileupload-add, .fileupload-start, .fileupload-cancel, .fileupload-remove").attr("disabled","disabled"),v[a].options.hiddenInput&&i.each(v[a].options.hiddenInput,function(e,o){v[a].formData.append(e,o)}),!1===v[a].options.multiUpload?i.each(v[a].arrayFiles,function(e,o){v[a].formData.append(v[a].options.inputName,o),i("#"+e+" .fileupload-progress .progress-bar-striped").fadeIn("slow","linear"),r(a,e),"function"==typeof v[a].options.onUploadProgress&&v[a].options.onUploadProgress.call(this)}):(v[a].overallProgressBar.fadeIn("slow","linear"),i.each(v[a].arrayFiles,function(e,o){v[a].formData.append(v[a].options.inputName+"[]",o)}),r(a,"")),v[a].btnAdd.fadeOut("slow","linear"),v[a].btnStart.fadeOut("slow","linear"),v[a].btnCancel.fadeOut("slow","linear"),v[a].btnReset.delay(600).fadeIn("slow","linear"),"function"==typeof v[a].options.onUploadComplete&&v[a].options.onUploadComplete.call(this)},removeFile:function(e,o){v[e].arrayLength<=1?s.resetUpload(e):(i("#"+o).fadeOut("slow","linear"),i("#"+o+" .alert").fadeOut("slow","linear"),i("#"+o).remove(),delete v[e].arrayFiles[o],v[e].arrayLength=--v[e].arrayLength),"function"==typeof v[e].options.onFileRemoved&&v[e].options.onFileRemoved.call(this)},resetUpload:function(e){v[e].filePreviewTable.find("tbody").empty(),v[e].form[0].reset(),v[e].arrayFiles={},v[e].arrayLength=0,v[e].filePreviewTable.fadeOut("slow","linear"),v[e].btnStart.fadeOut("slow","linear"),v[e].btnCancel.fadeOut("slow","linear"),i(".fileupload-previewrow .alert").fadeOut("slow","linear"),i(".fileupload-add, .fileupload-start, .fileupload-cancel").removeAttr("disabled"),i(".fileupload-add").delay(800).fadeIn("slow","linear"),v[e].overallProgressBar.find(".progress-bar-success").attr("aria-valuenow",0).css("width","0%"),v[e].overallProgressBar.fadeOut("slow","linear"),v[e].btnReset.fadeOut("slow","linear"),"function"==typeof v[e].options.onUploadReset&&v[e].options.onUploadReset.call(this)}};function l(e,o){var a,t=i('');switch(o){case"method":a="The passed method "+name+" is not a valid method. Please check the configuration.";break;case"fontAwesome":a="The Font Awesome CSS is not available within the head of the website and is a required unless the option showThumb is set to false.";break;case"fontAwesomeVersion":a="The Font Awesome version could not be detected. Please set manually with the fontAwesomeVer option.";break;case"url":a="The URL provided in the configuration is not a valid URL.";break;case"fallbackUrl":a="The Fallback URL provided in the configuration is not a valid URL.";break;case"formMethod":a="The Form Method provided in the configuration is not a valid, please choose either get or post in the configuration.";break;case"bootstrap":a="The Twitter Bootstrap API is not available on the current page. Please check to make sure all the dependencies are in place.";break;default:a="An unknown error occured."}!1===v[e].options.debug&&g.console&&g.console.error?g.console.error(a):!0===v[e].options.debug&&(t.append(a),v[e].wrapper.append(t))}function n(e){return/((http(s)?|ftp(s)?):\/\/)?[\w-]+(\.[\w-]+)+([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])?/.test(e)}function h(e,a){var t=!1;return i.each(v[e].options.fileTypes,function(e,o){if(0<=i.inArray(a,o))return!(t=!0)}),t}function w(e,a){var t;return i.each(v[e].options.fileTypes,function(e,o){if(0<=i.inArray(a,o))return t=e,!1}),t}function y(e,o){var a=[];return i.each(v[e].arrayFiles,function(e,o){a.push(o.name)}),i.inArray(o.name,a)}function F(e,o,a,t){var s;switch(a){case"archives":s=!0===v[e].options.useFontAwesome&&!1!==v[e].options.fontAwesomeVer?'':"";break;case"audio":s=!0===v[e].options.useFontAwesome&&!1!==v[e].options.fontAwesomeVer?'':"";break;case"files":switch(t){case"doc":case"docx":case"dotx":case"docm":s=!0===v[e].options.useFontAwesome&&!1!==v[e].options.fontAwesomeVer?'':"";break;case"ppt":case"pptm":case"pptx":s=!0===v[e].options.useFontAwesome&&!1!==v[e].options.fontAwesomeVer?'':"";break;case"pdf":s=!0===v[e].options.useFontAwesome&&!1!==v[e].options.fontAwesomeVer?'':"";break;case"xls":case"csv":case"xlsm":case"xlsx":s=!0===v[e].options.useFontAwesome&&!1!==v[e].options.fontAwesomeVer?'':"";break;default:s=!0===v[e].options.useFontAwesome&&!1!==v[e].options.fontAwesomeVer?'':""}break;case"images":s=''+o.name+'';break;case"video":s=!0===v[e].options.useFontAwesome&&!1!==v[e].options.fontAwesomeVer?'':""}return s}function r(s,l){i.ajax({url:v[s].options.url,type:v[s].options.formMethod,data:JSON.stringify({content:v[s].formData}),cache:!1,contentType:"application/json",processData:!1,accepts:"json",success:function(e,o,a){var t=e.match("{.*:{.*:.*}}")?JSON.parse(e):"";t.error||!e.match("{.*:{.*:.*}}")?(!1===v[s].options.multiUpload?(i("#"+l+" .fileupload-progress .progress-bar-striped").attr("aria-valuenow",0).css("width","0%"),i("#"+l+" .fileupload-progress .progress-bar-danger").attr("aria-valuenow",100).css("width","100%"),i("#"+l+" .alert-danger").fadeIn("slow","linear").html("Error:
"+t.error)):(v[s].overallProgressBar.find(".progress-bar-striped").attr("aria-valuenow",0).css("width","0%"),v[s].overallProgressBar.find(".progress-bar-danger").attr("aria-valuenow",100).css("width","100%"),v[s].overallStatus.fadeIn("slow","linear"),v[s].overallStatus.find(".alert-danger").fadeIn("slow","linear").html("Error:
"+t.error)),"function"==typeof v[s].options.onUploadError&&v[s].options.onUploadError.call(this)):(!1===v[s].options.multiUpload?(i("#"+l+" .fileupload-progress .progress-bar-striped").attr("aria-valuenow",0).css("width","0%"),i("#"+l+" .fileupload-progress .progress-bar-success").attr("aria-valuenow",100).css("width","100%"),i("#"+l+" .alert-success").fadeIn("slow","linear")):(v[s].overallProgressBar.find(".progress-bar-striped").attr("aria-valuenow",0).css("width","0%"),v[s].overallProgressBar.find(".progress-bar-success").attr("aria-valuenow",100).css("width","100%"),v[s].overallStatus.fadeIn("slow","linear"),v[s].overallStatus.find(".alert-success").fadeIn("slow","linear")),"function"==typeof v[s].options.onUploadSuccess&&v[s].options.onUploadSuccess.call(this))},error:function(e,o,a){!1===v[s].options.multiUpload?(i("#"+l+" .fileupload-progress .progress-bar-striped").attr("aria-valuenow",0).css("width","0%"),i("#"+l+" .fileupload-progress .progress-bar-danger").attr("aria-valuenow",100).css("width","100%"),i("#"+l+" .alert-danger").fadeIn("slow","linear").html(o+": "+a.message)):(v[s].overallProgressBar.find(".progress-bar-striped").attr("aria-valuenow",0).css("width","0%"),v[s].overallProgressBar.find(".progress-bar-danger").attr("aria-valuenow",100).css("width","100%"),v[s].overallStatus.fadeIn("slow","linear"),v[s].overallStatus.find(".alert-danger").fadeIn("slow","linear").html(o+": "+a.message)),"function"==typeof v[s].options.onUploadError&&v[s].options.onUploadError.call(this)},xhr:function(){var e=i.ajaxSettings.xhr();return e.upload&&e.upload.addEventListener("progress",function(e){if(e.lengthComputable){var o=e.loaded/e.total;!1===v[s].options.multiUpload?i("#"+l+" .fileupload-progress .progress-bar-striped").attr("aria-valuenow",Math.round(100*o)).css("width",Math.round(100*o)+"%"):v[s].overallProgressBar.find(".progress-bar-striped").attr("aria-valuenow",Math.round(100*o)).css("width",Math.round(100*o)+"%"),"function"==typeof v[s].options.onUploadProgress&&v[s].options.onUploadProgress.call(this)}}),e}})}i.bootstrapFileUpload=i.fn.bootstrapFileUpload=function(e){if(s[e])return s[e].apply(this,Array.prototype.slice.call(arguments,1));"object"!=typeof e&&e?g.console.error("The passed method "+e+" is not a valid method. Please check the configuration."):s.init.apply(this,arguments)},i.fn.bootstrapFileUpload.defaults={url:null,fallbackUrl:null,formMethod:"post",multiFile:!0,multiUpload:!1,inputName:"files",hiddenInput:null,forceFallback:!1,maxSize:5,maxFiles:null,showThumb:!0,useFontAwesome:!1,fontAwesomeVer:!1,thumbWidth:80,thumbHeight:80,fileTypes:{archives:[],audio:[],files:[],images:[],video:[]},debug:!1,onInit:function(){},onFileAdded:function(){},onFileRemoved:function(){},onFileCancel:function(){},onFileProcessing:function(){},onUploadProgress:function(){},onUploadError:function(){},onUploadSuccess:function(){},onUploadComplete:function(){},onUploadReset:function(){}}}(jQuery,document,window);