angular.module("c8y.ui").factory("c8yAlert",["$timeout","$rootScope","gettextCatalog",function(a,n,c){var u=[],i=3;function r(t){var n,e=!t.text&&!t.type;e||(t.text=c.getString(t.text)),_.find(u,function(n){return n.text===t.text&&n.type===t.type})||e||(u.push(t),n="success"===(e=t).type,e=!!t.detailedData,n&&!e&&a(angular.bind({},s,t),3e3),u.length>i&&u.shift())}function s(n){n=u.indexOf(n);-1<n&&u.splice(n,1)}function t(n,t,e){r({text:t,type:n,detailedData:e||void 0})}return n.$on("alert",function(n,t){r(t)}),n.$on("message",function(n,t){r(t)}),{add:r,remove:s,list:function(){return u},success:angular.bind({},t,"success"),danger:angular.bind({},t,"danger"),warning:angular.bind({},t,"warning"),info:angular.bind({},t,"info"),saveSuccess:function(n){return n="".concat(n," saved successfully"),angular.bind({},t,"success",n)},createSuccess:function(n){return n="".concat(n," created successfully"),angular.bind({},t,"success",n)},clearAll:function(){u.length=0}}}]);