(()=>{function n(a){function c(n){return n.data.c8y_ui||{}}function o(n,t){return t[n]||[]}function f(t,n){var r=null;return _.isArray(n)&&n.forEach(function(n){return n.id!==t||(r=n,!1)}),r}function u(n,t){return a.detail(t).then(c).then(angular.bind({},o,n))}return{detail:function(n,t,r){return u(n,t).then(angular.bind({},f,r))},list:u,save:function(i,n,e){return a.detail(n).then(function(n){var t=n.data,n=c(n),r=o(i,n),u=f(e.id,r);return u?_.assign(u,e):r.push(e),n[i]=r,t.c8y_ui=n,a.save(t)})},remove:function(u,n,i){var e;return a.detail(n).then(function(n){return(e=n.data).c8y_ui||{}}).then(angular.bind({},o,u)).then(function(n){var r,t=null;return n.forEach(function(n,t){return n.id!==i.id||(r=t,!1)}),_.isUndefined(r)||(n.splice(r,1),e.c8y_ui[u]=n,t=a.save(e)),t})}}}n.$inject=["c8yInventory"],angular.module("c8y.ui").factory("uiConfig",n)})();