(function(e){"use strict";if(typeof define==="function"&&define.amd){define(["jquery","./jquery.fileupload.min"],e)}else{e(window.jQuery)}})(function(n){"use strict";var i=n.blueimp.fileupload.prototype.options.add;n.widget("blueimp.fileupload",n.blueimp.fileupload,{options:{processQueue:[],add:function(e,s){var r=n(this);s.process(function(){return r.fileupload("process",s)});i.call(this,e,s)}},processActions:{},_processFile:function(e,i){var t=this,s=n.Deferred().resolveWith(t,[e]),o=s.promise();this._trigger("process",null,e);n.each(e.processQueue,function(e,s){var r=function(e){if(i.errorThrown){return n.Deferred().rejectWith(t,[i]).promise()}return t.processActions[s.action].call(t,e,s)};o=o.pipe(r,s.always&&r)});o.done(function(){t._trigger("processdone",null,e);t._trigger("processalways",null,e)}).fail(function(){t._trigger("processfail",null,e);t._trigger("processalways",null,e)});return o},_transformProcessQueue:function(t){var s=[];n.each(t.processQueue,function(){var r={},e=this.action,i=this.prefix===true?e:this.prefix;n.each(this,function(e,s){if(n.type(s)==="string"&&s.charAt(0)==="@"){r[e]=t[s.slice(1)||(i?i+e.charAt(0).toUpperCase()+e.slice(1):e)]}else{r[e]=s}});s.push(r)});t.processQueue=s},processing:function(){return this._processing},process:function(i){var t=this,o=n.extend({},this.options,i);if(o.processQueue&&o.processQueue.length){this._transformProcessQueue(o);if(this._processing===0){this._trigger("processstart")}n.each(i.files,function(e){var s=e?n.extend({},o):o,r=function(){if(i.errorThrown){return n.Deferred().rejectWith(t,[i]).promise()}return t._processFile(s,i)};s.index=e;t._processing+=1;t._processingQueue=t._processingQueue.pipe(r,r).always(function(){t._processing-=1;if(t._processing===0){t._trigger("processstop")}})})}return this._processingQueue},_create:function(){this._super();this._processing=0;this._processingQueue=n.Deferred().resolveWith(this).promise()}})});