!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["angular-file-upload"]=t():e["angular-file-upload"]=t()}(this,function(){return function(e){function t(n){if(o[n])return o[n].exports;var r=o[n]={exports:{},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}var r=n(o(1)),i=n(o(2)),s=n(o(3)),a=n(o(4)),l=n(o(5)),u=n(o(6)),p=n(o(7)),c=n(o(8)),f=n(o(9)),d=n(o(10)),h=n(o(11)),y=n(o(12)),v=n(o(13));angular.module(r.default.name,[]).value("fileUploaderOptions",i.default).factory("FileUploader",s.default).factory("FileLikeObject",a.default).factory("FileItem",l.default).factory("FileDirective",u.default).factory("FileSelect",p.default).factory("FileDrop",f.default).factory("FileOver",d.default).factory("Pipeline",c.default).directive("nvFileSelect",h.default).directive("nvFileDrop",y.default).directive("nvFileOver",v.default).run(["FileUploader","FileLikeObject","FileItem","FileDirective","FileSelect","FileDrop","FileOver","Pipeline",function(e,t,o,n,r,i,s,a){e.FileLikeObject=t,e.FileItem=o,e.FileDirective=n,e.FileSelect=r,e.FileDrop=i,e.FileOver=s,e.Pipeline=a}])},function(e,t){e.exports={name:"angularFileUpload"}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={url:"/",alias:"file",headers:{},queue:[],progress:0,autoUpload:!1,removeAfterUpload:!1,method:"POST",filters:[],formData:[],queueLimit:Number.MAX_VALUE,withCredentials:!1,disableMultipart:!1}},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,o,r,s,m,_,g){var b=r.File,F=r.FormData,O=function(){function r(t){n(this,r);var o=l(e);u(this,o,t,{isUploading:!1,_nextIndex:0,_directives:{select:[],drop:[],over:[]}}),this.filters.unshift({name:"queueLimit",fn:this._queueLimitFilter}),this.filters.unshift({name:"folder",fn:this._folderFilter})}return r.prototype.addToQueue=function(e,t,o){var n=this,r=this.isArrayLikeObject(e)?Array.prototype.slice.call(e):[e],s=this._getFilters(o),a=this.queue.length,l=[],u=function(){n.queue.length!==a&&(n._onAfterAddingAll(l),n.progress=n._getTotalProgress()),n._render(),n.autoUpload&&n.uploadAll()};!function e(){var o=r.shift();if(y(o))return u();var a=n.isFile(o)?o:new m(o),p=n._convertFiltersToPipes(s),c=new g(p),f=function(t){var o=t.pipe.originalFilter,r=i(t.args,2),s=r[0],a=r[1];n._onWhenAddingFileFailed(s,o,a),e()},d=function(t,o){var r=new _(n,t,o);l.push(r),n.queue.push(r),n._onAfterAddingFile(r),e()};c.onThrown=f,c.onSuccessful=d,c.exec(a,t)}()},r.prototype.removeFromQueue=function(e){var t=this.getIndexOfItem(e),o=this.queue[t];o.isUploading&&o.cancel(),this.queue.splice(t,1),o._destroy(),this.progress=this._getTotalProgress()},r.prototype.clearQueue=function(){for(;this.queue.length;)this.queue[0].remove();this.progress=0},r.prototype.uploadItem=function(e){var t=this.getIndexOfItem(e),o=this.queue[t],n=this.isHTML5?"_xhrTransport":"_iframeTransport";o._prepareToUploading(),this.isUploading||(this._onBeforeUploadItem(o),o.isCancel||(o.isUploading=!0,this.isUploading=!0,this[n](o),this._render()))},r.prototype.cancelItem=function(e){var t=this,o=this.getIndexOfItem(e),n=this.queue[o],r=this.isHTML5?"_xhr":"_form";n&&(n.isCancel=!0,n.isUploading?n[r].abort():function(){var e=[void 0,0,{}];s(function(){t._onCancelItem.apply(t,[n].concat(e)),t._onCompleteItem.apply(t,[n].concat(e))})}())},r.prototype.uploadAll=function(){var e=this.getNotUploadedItems().filter(function(e){return!e.isUploading});e.length&&(p(e,function(e){return e._prepareToUploading()}),e[0].upload())},r.prototype.cancelAll=function(){var e=this.getNotUploadedItems();p(e,function(e){return e.cancel()})},r.prototype.isFile=function(e){return this.constructor.isFile(e)},r.prototype.isFileLikeObject=function(e){return this.constructor.isFileLikeObject(e)},r.prototype.isArrayLikeObject=function(e){return this.constructor.isArrayLikeObject(e)},r.prototype.getIndexOfItem=function(e){return f(e)?e:this.queue.indexOf(e)},r.prototype.getNotUploadedItems=function(){return this.queue.filter(function(e){return!e.isUploaded})},r.prototype.getReadyItems=function(){return this.queue.filter(function(e){return e.isReady&&!e.isUploading}).sort(function(e,t){return e.index-t.index})},r.prototype.destroy=function(){var e=this;p(this._directives,function(t){p(e._directives[t],function(e){e.destroy()})})},r.prototype.onAfterAddingAll=function(e){},r.prototype.onAfterAddingFile=function(e){},r.prototype.onWhenAddingFileFailed=function(e,t,o){},r.prototype.onBeforeUploadItem=function(e){},r.prototype.onProgressItem=function(e,t){},r.prototype.onProgressAll=function(e){},r.prototype.onSuccessItem=function(e,t,o,n){},r.prototype.onErrorItem=function(e,t,o,n){},r.prototype.onCancelItem=function(e,t,o,n){},r.prototype.onCompleteItem=function(e,t,o,n){},r.prototype.onCompleteAll=function(){},r.prototype._getTotalProgress=function(e){if(this.removeAfterUpload)return e||0;var t=this.getNotUploadedItems().length,o=t?this.queue.length-t:this.queue.length,n=100/this.queue.length,r=(e||0)*n/100;return Math.round(o*n+r)},r.prototype._getFilters=function(e){if(!e)return this.filters;if(h(e))return e;var t=e.match(/[^\s,]+/g);return this.filters.filter(function(e){return-1!==t.indexOf(e.name)})},r.prototype._convertFiltersToPipes=function(e){var t=this;return e.map(function(e){var o=a(t,e.fn);return o.isAsync=3===e.fn.length,o.originalFilter=e,o})},r.prototype._render=function(){t.$$phase||t.$apply()},r.prototype._folderFilter=function(e){return!(!e.size&&!e.type)},r.prototype._queueLimitFilter=function(){return this.queue.length=200&&e<300||304===e},r.prototype._transformResponse=function(e,t){var n=this._headersGetter(t);return p(o.defaults.transformResponse,function(t){e=t(e,n)}),e},r.prototype._parseHeaders=function(e){var t,o,n,r={};return e?(p(e.split("\n"),function(e){n=e.indexOf(":"),t=e.slice(0,n).trim().toLowerCase(),o=e.slice(n+1).trim(),t&&(r[t]=r[t]?r[t]+", "+o:o)}),r):r},r.prototype._headersGetter=function(e){return function(t){return t?e[t.toLowerCase()]||null:e}},r.prototype._xhrTransport=function(e){var t,o=this,n=e._xhr=new XMLHttpRequest;if(e.disableMultipart?t=e._file:(t=new F,p(e.formData,function(e){p(e,function(e,o){t.append(o,e)})}),t.append(e.alias,e._file,e.file.name)),"number"!=typeof e._file.size)throw new TypeError("The file specified is no longer valid");n.upload.onprogress=function(t){var n=Math.round(t.lengthComputable?100*t.loaded/t.total:0);o._onProgressItem(e,n)},n.onload=function(){var t=o._parseHeaders(n.getAllResponseHeaders()),r=o._transformResponse(n.response,t),i=o._isSuccessCode(n.status)?"Success":"Error";o["_on"+i+"Item"](e,r,n.status,t),o._onCompleteItem(e,r,n.status,t)},n.onerror=function(){var t=o._parseHeaders(n.getAllResponseHeaders()),r=o._transformResponse(n.response,t);o._onErrorItem(e,r,n.status,t),o._onCompleteItem(e,r,n.status,t)},n.onabort=function(){var t=o._parseHeaders(n.getAllResponseHeaders()),r=o._transformResponse(n.response,t);o._onCancelItem(e,r,n.status,t),o._onCompleteItem(e,r,n.status,t)},n.open(e.method,e.url,!0),n.withCredentials=e.withCredentials,p(e.headers,function(e,t){n.setRequestHeader(t,e)}),n.send(t)},r.prototype._iframeTransport=function(e){var t=this,o=v('
'),n=v('