/*! grafana - v4.5.1 - 2017-09-19
 * Copyright (c) 2017 Torkel Ödegaard; Licensed Apache-2.0 */

System.register(["lodash","moment"],function(a,b){"use strict";function c(a,b,c){void 0===b&&(b=i),void 0===c&&(c=!1);var d=c?"sep=;\n":"Series;Time;Value\n";g.default.each(a,function(a){g.default.each(a.datapoints,function(c){d+=a.alias+";"+h.default(c[1]).format(b)+";"+c[0]+"\n"})}),f(d,"grafana_data_export.csv")}function d(a,b,c){void 0===b&&(b=i),void 0===c&&(c=!1);var d=c?"sep=;\n":"Time;";g.default.each(a,function(a){d+=a.alias+";"}),d=d.substring(0,d.length-1),d+="\n";var e=[[]],j=1;g.default.each(a,function(a){var c=0;e.push([]),g.default.each(a.datapoints,function(a){e[0][c]=h.default(a[1]).format(b),e[j][c]=a[0],c++}),j++});for(var k=0;k<e[0].length;k++){d+=e[0][k]+";";for(var l=1;l<e.length;l++)d+=e[l][k]+";";d=d.substring(0,d.length-1),d+="\n"}f(d,"grafana_data_export.csv")}function e(a,b){void 0===b&&(b=!1);var c=b?"sep=;\n":"";g.default.each(a.columns,function(a){c+=(a.title||a.text)+";"}),c+="\n",g.default.each(a.rows,function(a){g.default.each(a,function(a){c+=a+";"}),c+="\n"}),f(c,"grafana_data_export.csv")}function f(a,b){var c=new Blob([a],{type:"text/csv;charset=utf-8"});window.saveAs(c,b)}b&&b.id;a("exportSeriesListToCsv",c),a("exportSeriesListToCsvColumns",d),a("exportTableDataToCsv",e),a("saveSaveBlob",f);var g,h,i;return{setters:[function(a){g=a},function(a){h=a}],execute:function(){i="YYYY-MM-DDTHH:mm:ssZ"}}});