angular.module("c8y.ui").provider("c8yActions",function(){n.$inject=["$q","$location","$injector","$rootScope","$timeout","c8yUiUtil","c8yActionBar"];var p=[];return{addUrlAction:function(n){t(n)},addGlobalAction:g,findAction:function(n){return _.find(p,n)},$get:n};function g(n){n.global=!0,t(n)}function t(n){n.hidden=n.autoRun||n.actionBar,p.push(n)}function n(i,o,t,n,e,r,c){var a=n.$new(!0),u=0;function f(){var t=u+=1,n=p.map(l);i.all(n).then(function(n){return n.filter(function(n){return!n.disabled})}).then(function(n){u===t&&(n.filter(function(n){return n.autoRun}).forEach(h),n.filter(function(n){return n.actionBar&&n.path}).forEach(s))})}function l(n){return n.path&&d(n),n.path&&n.disabled?i.when(n):r.configureVisibility(n,"disabled",!0)}function d(n){var t=o.path(),i=new RegExp(n.path.replace(/:[^/]+/g,"(.+)").replace(/\//g,"\\/"));return n.disabled=!i.test(t),n}function s(n){c.addLiveAction({action:n,run:function(){return h(n)}})}function h(n){t.invoke(n.action,n)}return _.assign(a,{addAction:s,addGlobalAction:g,registeredActions:p,processUrlAction:d,invoke:h,hasLiveAction:function(n){var t=c.elements.map(function(n){return angular.element(n).data("action")});return _.some(t,n)}}),n.$on("$routeChangeSuccess",f),f(),a}});