angular.module("c8y.parts.kpi").controller("kpiGraphCtrl",["$scope","$routeParams","c8yKpi",function(e,n,t){function c(){var i=n.deviceId;return i=e.child.config&&e.child.config.device&&e.child.config.device.id?e.child.config.device.id:i}e.$watch("child.config.kpis",function(i){var n=_.filter(_.map(i,"moId"),_.identity);t.listByIds(n).then(function(i){return _.map(i,function(i){return i.c8y_Kpi||i})}).then(function(n){return _.map(i,function(i){return _.find(n,{fragment:i.fragment,series:i.series})||i})}).then(function(i){e.deviceId=c(),e.kpis=i})}),e.$watch("child.config.timeInterval",function(i){e.interval=i}),e.$watch("child.config.aggregationType",function(i){e.aggregationType=i}),e.deviceId=c(),e.autoStart=!0}]);