angular.module("c8y.ui").provider("c8yObjectActions",function(){var i,o,r={},c={};function e(n,t,e){if(r[n])throw new Error('Object action "'.concat(n,'" already registered'));r[n]={config:e,action:t}}function a(n,t){if(t){var e=c[t];if(!e)throw new Error('Object action "'.concat(t,'" is not registered.'));f(n,t,e)}else o=n,i&&_.forEach(r,function(t,e){var n=t.config||{},r=n.attachIf&&function(){return i.invoke(n.attachIf,void 0,{target:o})};r?(r=r(o))&&(r.then?r.then(function(n){n&&f(o,e,t)}):f(o,e,t)):f(o,e,t)});var o}function u(){var n=_.map(r,function(n,t){n=_.cloneDeep(n);return n.name=t,n});return o.when(n)}function f(n,t,e){var r;i&&(e=e.action,r=i.invoke(e,void 0,{object:n}),Object.defineProperty(n,t,{enumerable:!1,value:function(){for(var n=arguments.length,t=new Array(n),e=0;e<n;e++)t[e]=arguments[e];return o.when(r.apply(this,t))}}))}return{register:e,$get:["$injector","$q",function(n,t){return i=n,o=t,{register:e,attach:a,list:u}}]}});