(()=>{function n(n,t,e,r,o,a){var i="event/events";return{downloadAsDataUri:function(n){var e=n.id,n=_.get(n,"c8y_IsBinary.length"),t=r.url([i,e,"binaries"].join("/"));return a.download(e,t,n).then(function(n){var e=n.getResponseHeader("Content-Type"),n=a.arrayBufferToBase64(n.response);return"data:".concat(e,";base64,").concat(n)})},downloadAndSaveAs:function(n){var e=n.id,n=_.get(n,"c8y_IsBinary.length"),t=r.url([i,e,"binaries"].join("/"));return a.download(e,t,n).then(function(n){var e=n.getResponseHeader("Content-Type"),t=n.getResponseHeader("Content-Disposition"),n=new Blob([n.response],{type:e});saveAs(n,a.getFilenameFromContentDisposition(t))})},doesContainBinary:function(n){return!(!n||!n.c8y_IsBinary)},downloadAsText:function(n){var n=n.id,n=r.url([i,n,"binaries"].join("/")),e={headers:o.headers(),responseType:"text",transformResponse:function(n){return n}};return t.get(n,e)},upload:function(n,e){e=e.id,e=r.url([i,e,"binaries"].join("/"));return a.upload(n,{url:e})},canDownload:function(n){return!_.isUndefined(_.get(n,"c8y_IsBinary.length"))}}}n.$inject=["$q","$http","$upload","c8yBase","c8yAuth","c8yBinaryCommon"],angular.module("c8y.eventsBinary").factory("eventsBinaryService",n)})();