(()=>{function e(e,i,l,n){var t=this,o=128;function c(){t.files.push({file:null})}function s(e){return 0===t.allowedFileType.length||(e=>(e=n.getFileExtension(e),n.extractFileExtensions(t.allowedFileType.toString()).includes(e)))(e)}function r(e){return o>e.name.length}function a(e){return s(e)&&t.hasValidSize(e)&&r(e)}_.assign(t,{$onInit:function(){i.getBytesSizeLimitAsync().then(function(e){t.fileSizeLimit=e}),t.files=t.files||[],t.allowedFileType=t.allowedFileType||[],0===t.files.length&&c()},add:c,remove:function(i){i.file=null;var e=_.findIndex(t.files,function(e){return e===i});t.files.splice(e,1),t.onFileRemoved(i),0===t.files.length&&c()},onFileSelect:function(e,i){0<i.length&&(e.file=i[0],t.onFileSelected)&&a(e.file)&&t.onFileSelected(e.file)},checkFileType:s,checkMaxLength:r,isValid:a,hasValidSize:i.hasValidSize}),e.$watch(function(){return t.processingStatus()},function(e){t.process=e||{},t.process.label=t.process.label||l("Processing")},!0)}e.$inject=["$scope","c8yBinary","gettext","c8yFilesService"],angular.module("c8y.ui").directive("filePicker",function(){return{restrict:"E",scope:{files:"=?",required:"=?",multiple:"=?",disabled:"=?",allowedFileType:"=?",displayDropZone:"&",dropZoneIcon:"&",dropZoneLabel:"&",dropZoneHideHint:"&",onFileSelected:"&",onFileRemoved:"&",processingStatus:"&"},templateUrl:":::PLUGIN_PATH:::/ui/views/filePicker.html",controller:e,controllerAs:"vm",bindToController:!0}})})();