(()=>{function e(n,e,r,l,t,a){var i=[];function u(){return!n.uploading&&_.every(n.files,function(e){return t.hasValidSize(e.file)})}n.uploading=!1,n.uploadProgress=0,n.allowMultipleFiles=!0,n.filesRequired=!0,n.files=[],_.assign(n,{canUpload:u,upload:function(){var o=r.defer();u()?(n.uploading=!0,_.forEach(n.files,function(e){var n=t.upload(e.file);i.push(n),n.progress(function(e){n.uploadProgress=e.loaded/e.total,o.notify(_(i).map("uploadProgress").reduce(function(e,n){return e+n})/i.length)})}),r.all(i).then(function(e){return o.resolve(e)})):o.reject();return n.uploadProgress=0,o.promise.then(function(){l.success(a("Files uploaded.")),e.close()},function(){l.danger(a("Could not upload the files."))},function(e){n.uploadProgress=100*e}).finally(function(){n.uploading=!1,n.uploadProgress=100})},dismiss:e.dismiss}),e.closed.then(function(){_.forEach(i,function(e){return e.abort()})})}e.$inject=["$scope","$uibModalInstance","$q","c8yAlert","c8yBinary","gettext"],angular.module("c8y.binaryArtefactsManagement").controller("binaryArtefactsUploadCtrl",e)})();