(()=>{function e(t,n,i,e,o,r,c,s){function u(e){e=e.id?(e=e,n.all([o.childAssets(e),o.childDevices(e)]).then(function(e){var n=[];return n.push(e[0]),n.push(e[1]),_.flattenDeep(n)}).then(a)):n.resolve();return e}function a(e){t.devices=e}function l(){return n.when(t.group).then(u)}t.refresh=l,t.paging={refresh:_.noop},t.assignDevices=function(){r({templateUrl:":::PLUGIN_PATH:::/views/groupDeviceAssignment.html",controller:"groupDeviceAssignmentCtrl",resolve:{currentGroup:function(){return t.group}}}).then(l)},t.unassign=function(n){r({title:c("Unassign device"),body:s.getString('You are about to unassign device "{{name}}". Do you want to proceed?',{name:n.name}),labels:{ok:c("Unassign")},size:"sm"}).then(angular.bind(e,e.removeChildAsset,t.group,n)).then(function(){_.remove(t.devices,function(e){return e.id===n.id})})},t.isDevice=o.isDevice,t.isOtherItem=function(e){return!o.isDevice(e)},t.goToDeviceDetails=function(e){i.url("/device/".concat(e.id))},t.goToDeviceAlarms=function(e){i.url("/device/".concat(e.id,"/alarms"))},t.model=o.model,t.serial=o.serial,t.$watch("group",u)}e.$inject=["$scope","$q","$location","c8yInventory","c8yDevices","c8yModal","gettext","gettextCatalog"],angular.module("c8y.groupsHierarchy").controller("groupDevicesCtrl",e)})();