/*
 Highcharts JS v6.0.3 (2017-11-14)
 Exporting module

 (c) 2010-2017 Torstein Honsi

 License: www.highcharts.com/license
*/
(function(r){"object"===typeof module&&module.exports?module.exports=r:r(Highcharts)})(function(r){(function(b){var u=b.each,r=b.pick,h=b.win,l=h.document,d=b.seriesTypes,x=void 0!==l.createElement("a").download;b.setOptions({exporting:{csv:{columnHeaderFormatter:null,dateFormat:"%Y-%m-%d %H:%M:%S",itemDelimiter:",",lineDelimiter:"\n"},showTable:!1},lang:{downloadCSV:"Download CSV",downloadXLS:"Download XLS",viewData:"View data table"}});b.addEvent(b.Chart.prototype,"render",function(){this.options&&
this.options.exporting&&this.options.exporting.showTable&&this.viewData()});b.Chart.prototype.setUpKeyToAxis=function(){d.arearange&&(d.arearange.prototype.keyToAxis={low:"y",high:"y"})};b.Chart.prototype.getDataRows=function(){var q=this.options.exporting&&this.options.exporting.csv||{},c,f=this.xAxis,g={},t=[],k,e=[],m,v,d=function(a,c,g){if(q.columnHeaderFormatter){var e=q.columnHeaderFormatter(a,c,g);if(!1!==e)return e}return a instanceof b.Axis?a.options.title&&a.options.title.text||(a.isDatetimeAxis?
"DateTime":"Category"):a?a.name+(1<g?" ("+c+")":""):"Category"},n=[];m=0;this.setUpKeyToAxis();u(this.series,function(a){var c=a.options.keys||a.pointArrayMap||["y"],k=c.length,v=!a.requireSorting&&{},h={},t={},l=b.inArray(a.xAxis,f),p;u(c,function(c){var b=(a.keyToAxis&&a.keyToAxis[c]||c)+"Axis";h[c]=a[b]&&a[b].categories||[];t[c]=a[b]&&a[b].isDatetimeAxis});if(!1!==a.options.includeInCSVExport&&!1!==a.visible){b.find(n,function(a){return a[0]===l})||n.push([l,m]);for(p=0;p<k;)e.push(d(a,c[p],c.length)),
p++;u(a.points,function(e,f){var d=e.x,n;v&&(v[d]&&(d+="|"+f),v[d]=!0);p=0;g[d]||(g[d]=[],g[d].xValues=[]);g[d].x=e.x;g[d].xValues[l]=e.x;a.xAxis&&"name"!==a.exportKey||(g[d].name=e.name);for(;p<k;)f=c[p],n=e[f],g[d][m+p]=r(h[f][n],t[f]?b.dateFormat(q.dateFormat,n):null,n),p++});m+=p}});for(k in g)g.hasOwnProperty(k)&&t.push(g[k]);var h,l;k=[e];for(m=n.length;m--;)h=n[m][0],l=n[m][1],c=f[h],t.sort(function(a,c){return a.xValues[h]-c.xValues[h]}),v=d(c),k[0].splice(l,0,v),u(t,function(a){var e=a.name;
e||(c.isDatetimeAxis?(a.x instanceof Date&&(a.x=a.x.getTime()),e=b.dateFormat(q.dateFormat,a.x)):e=c.categories?r(c.names[a.x],c.categories[a.x],a.x):a.x);a.splice(l,0,e)});return k=k.concat(t)};b.Chart.prototype.getCSV=function(b){var c="",d=this.getDataRows(),g=this.options.exporting.csv,q=g.itemDelimiter,k=g.lineDelimiter;u(d,function(e,g){for(var f,h=e.length,m=b?(1.1).toLocaleString()[1]:".";h--;)f=e[h],"string"===typeof f&&(f='"'+f+'"'),"number"===typeof f&&","===m&&(f=f.toString().replace(".",
",")),e[h]=f;c+=e.join(q);g<d.length-1&&(c+=k)});return c};b.Chart.prototype.getTable=function(b){var c="\x3ctable\x3e\x3cthead\x3e",f=this.getDataRows();u(f,function(f,d){var g=d?"td":"th",e,h,q=b?(1.1).toLocaleString()[1]:".";c+="\x3ctr\x3e";for(h=0;h<f.length;h+=1)e=f[h],"number"===typeof e?(e=e.toString(),","===q&&(e=e.replace(".",q)),c+="\x3c"+g+' class\x3d"number"\x3e'+e+"\x3c/"+g+"\x3e"):c+="\x3c"+g+' class\x3d"text"\x3e'+(void 0===e?"":e)+"\x3c/"+g+"\x3e";c+="\x3c/tr\x3e";d||(c+="\x3c/thead\x3e\x3ctbody\x3e")});
return c+="\x3c/tbody\x3e\x3c/table\x3e"};b.Chart.prototype.fileDownload=function(d,c,f){var g;g=this.options.exporting.filename?this.options.exporting.filename:this.title&&this.title.textStr?this.title.textStr.replace(/ /g,"-").toLowerCase():"chart";h.Blob&&h.navigator.msSaveOrOpenBlob?(d=new h.Blob(["\ufeff"+f],{type:"text/csv"}),h.navigator.msSaveOrOpenBlob(d,g+"."+c)):x?(f=l.createElement("a"),f.href=d,f.download=g+"."+c,this.container.appendChild(f),f.click(),f.remove()):b.error("The browser doesn't support downloading files")};
b.Chart.prototype.downloadCSV=function(){var b=this.getCSV(!0);this.fileDownload("data:text/csv,\ufeff"+encodeURIComponent(b),"csv",b,"text/csv")};b.Chart.prototype.downloadXLS=function(){var b='\x3chtml xmlns:o\x3d"urn:schemas-microsoft-com:office:office" xmlns:x\x3d"urn:schemas-microsoft-com:office:excel" xmlns\x3d"http://www.w3.org/TR/REC-html40"\x3e\x3chead\x3e\x3c!--[if gte mso 9]\x3e\x3cxml\x3e\x3cx:ExcelWorkbook\x3e\x3cx:ExcelWorksheets\x3e\x3cx:ExcelWorksheet\x3e\x3cx:Name\x3eArk1\x3c/x:Name\x3e\x3cx:WorksheetOptions\x3e\x3cx:DisplayGridlines/\x3e\x3c/x:WorksheetOptions\x3e\x3c/x:ExcelWorksheet\x3e\x3c/x:ExcelWorksheets\x3e\x3c/x:ExcelWorkbook\x3e\x3c/xml\x3e\x3c![endif]--\x3e\x3cstyle\x3etd{border:none;font-family: Calibri, sans-serif;} .number{mso-number-format:"0.00";} .text{ mso-number-format:"@";}\x3c/style\x3e\x3cmeta name\x3dProgId content\x3dExcel.Sheet\x3e\x3cmeta charset\x3dUTF-8\x3e\x3c/head\x3e\x3cbody\x3e'+
this.getTable(!0)+"\x3c/body\x3e\x3c/html\x3e";this.fileDownload("data:application/vnd.ms-excel;base64,"+h.btoa(unescape(encodeURIComponent(b))),"xls",b,"application/vnd.ms-excel")};b.Chart.prototype.viewData=function(){this.dataTableDiv||(this.dataTableDiv=l.createElement("div"),this.dataTableDiv.className="highcharts-data-table",this.renderTo.parentNode.insertBefore(this.dataTableDiv,this.renderTo.nextSibling));this.dataTableDiv.innerHTML=this.getTable()};var w=b.getOptions().exporting;w&&(b.extend(w.menuItemDefinitions,
{downloadCSV:{textKey:"downloadCSV",onclick:function(){this.downloadCSV()}},downloadXLS:{textKey:"downloadXLS",onclick:function(){this.downloadXLS()}},viewData:{textKey:"viewData",onclick:function(){this.viewData()}}}),w.buttons.contextButton.menuItems.push("separator","downloadCSV","downloadXLS","viewData"));d.map&&(d.map.prototype.exportKey="name");d.mapbubble&&(d.mapbubble.prototype.exportKey="name");d.treemap&&(d.treemap.prototype.exportKey="name")})(r)});
