angular.module("c8y.ui").directive("c8yDownloadButton",["c8yBinary",function(a){return{restrict:"E",link:function(o){var l;o.download=function(){o.downloading=!0,o.downloadProgress=0;var n=a.downloadAndSaveAs(l,o.length);return n.then(null,null,function(n){o.downloadProgress=100*n}),n.finally(function(){o.downloading=!1,o.downloadProgress=100})},o.downloading=!1,l=!_.isNaN(Number(o.binary))||_.isObjectLike(o.binary)?o.binary:_.last(o.binary.split("/"))},templateUrl:":::PLUGIN_PATH:::/ui/views/downloadButton.html",scope:{downloading:"=?",binary:"=",length:"=?"},replace:!0}}]);