/*! grafana - v4.2.0 - 2017-03-24
 * Copyright (c) 2017 Torkel Ödegaard; Licensed Apache-2.0 */

System.register(["lodash","angular"],function(a,b){"use strict";var c,d,e;b&&b.id;return{setters:[function(a){c=a},function(a){d=a}],execute:function(){e=function(){function a(a,b){this.backendSrv=a,this.$q=b}return a.$inject=["backendSrv","$q"],a.prototype.query=function(a){var b=c.default.filter(a.targets,function(a){return a.hide!==!0}).map(function(b){return{refId:b.refId,scenarioId:b.scenarioId,intervalMs:a.intervalMs,maxDataPoints:a.maxDataPoints,stringInput:b.stringInput,jsonInput:d.default.fromJson(b.jsonInput)}});return 0===b.length?this.$q.when({data:[]}):this.backendSrv.post("/api/tsdb/query",{from:a.range.from.valueOf().toString(),to:a.range.to.valueOf().toString(),queries:b}).then(function(a){var b=[];return a.results&&c.default.forEach(a.results,function(a){for(var c=0,d=a.series;c<d.length;c++){var e=d[c];b.push({target:e.name,datapoints:e.points})}}),{data:b}})},a.prototype.annotationQuery=function(a){return this.backendSrv.get("/api/annotations",{from:a.range.from.valueOf(),to:a.range.to.valueOf(),limit:a.limit,type:a.type})},a}(),a("TestDataDatasource",e)}}});