/*
 Highcharts JS v5.0.11 (2017-05-04)
 Exporting module

 (c) 2010-2017 Torstein Honsi

 License: www.highcharts.com/license
*/
(function(f){"object"===typeof module&&module.exports?module.exports=f:f(Highcharts)})(function(f){(function(c){function f(a,k,m,b,l){var g,e=((a.options.exporting||{}).csv||{}).url||"http://www.highcharts.com/studies/csv-export/download.php";g=a.options.exporting.filename?a.options.exporting.filename:a.title?a.title.textStr.replace(/ /g,"-").toLowerCase():"chart";d.Blob&&d.navigator.msSaveOrOpenBlob?(a=new d.Blob([b]),d.navigator.msSaveOrOpenBlob(a,g+"."+m)):w?(b=t.createElement("a"),b.href=k,b.target=
"_blank",b.download=g+"."+m,a.container.append(b),b.click(),b.remove()):c.post(e,{data:b,type:l,extension:m})}var q=c.each,v=c.pick,d=c.win,t=d.document,n=c.seriesTypes,w=void 0!==t.createElement("a").download;c.setOptions({lang:{downloadCSV:"Download CSV",downloadXLS:"Download XLS",viewData:"View data table"}});c.Chart.prototype.getDataRows=function(){var a=(this.options.exporting||{}).csv||{},k,m=this.xAxis,b={},l=[],g=[],e,p,u=a.dateFormat||"%Y-%m-%d %H:%M:%S",f=a.columnHeaderFormatter||function(h,
b,a){return h instanceof c.Axis?h.options.title&&h.options.title.text||(h.isDatetimeAxis?"DateTime":"Category"):h?h.name+(1<a?" ("+b+")":""):"Category"},r=[];e=0;q(this.series,function(h){var a=h.options.keys||h.pointArrayMap||["y"],k=a.length,u=h.requireSorting,p={},l=c.inArray(h.xAxis,m),d;q(a,function(a){p[a]=h[a+"Axis"]&&h[a+"Axis"].categories||[]});if(!1!==h.options.includeInCSVExport&&!1!==h.visible){c.find(r,function(a){return a[0]===l})||r.push([l,e]);for(d=0;d<k;)g.push(f(h,a[d],a.length)),
d++;q(h.points,function(c,g){g=u?c.x:g;var m,f;d=0;b[g]||(b[g]=[],b[g].xValues=[]);b[g].x=c.x;b[g].xValues[l]=c.x;h.xAxis&&"name"!==h.exportKey||(b[g].name=c.name);for(;d<k;)m=a[d],f=c[m],b[g][e+d]=v(p[m][f],f),d++});e+=d}});for(p in b)b.hasOwnProperty(p)&&l.push(b[p]);var d,n,a=[g];for(e=r.length;e--;)d=r[e][0],n=r[e][1],k=m[d],l.sort(function(a,b){return a.xValues[d]-b.xValues[d]}),p=f(k),a[0].splice(n,0,p),q(l,function(a){var b=a.name;b||(k.isDatetimeAxis?(a.x instanceof Date&&(a.x=a.x.getTime()),
b=c.dateFormat(u,a.x)):b=k.categories?v(k.names[a.x],k.categories[a.x],a.x):a.x);a.splice(n,0,b)});return a=a.concat(l)};c.Chart.prototype.getCSV=function(a){var c="",d=this.getDataRows(),b=(this.options.exporting||{}).csv||{},l=b.itemDelimiter||",",g=b.lineDelimiter||"\n";q(d,function(b,k){for(var e,f=b.length,p=a?(1.1).toLocaleString()[1]:".";f--;)e=b[f],"string"===typeof e&&(e='"'+e+'"'),"number"===typeof e&&","===p&&(e=e.toString().replace(".",",")),b[f]=e;c+=b.join(l);k<d.length-1&&(c+=g)});
return c};c.Chart.prototype.getTable=function(a){var c="\x3ctable\x3e\x3cthead\x3e",d=this.getDataRows();q(d,function(b,d){var g=d?"td":"th",e,f,k=a?(1.1).toLocaleString()[1]:".";c+="\x3ctr\x3e";for(f=0;f<b.length;f+=1)e=b[f],"number"===typeof e?(e=e.toString(),","===k&&(e=e.replace(".",k)),c+="\x3c"+g+' class\x3d"number"\x3e'+e+"\x3c/"+g+"\x3e"):c+="\x3c"+g+"\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"};
c.Chart.prototype.downloadCSV=function(){var a=this.getCSV(!0);f(this,"data:text/csv,\ufeff"+encodeURIComponent(a),"csv",a,"text/csv")};c.Chart.prototype.downloadXLS=function(){var a='\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";}\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";f(this,"data:application/vnd.ms-excel;base64,"+d.btoa(unescape(encodeURIComponent(a))),"xls",a,"application/vnd.ms-excel")};c.Chart.prototype.viewData=function(){this.dataTableDiv||(this.dataTableDiv=t.createElement("div"),this.dataTableDiv.className="highcharts-data-table",this.renderTo.parentNode.insertBefore(this.dataTableDiv,this.renderTo.nextSibling));this.dataTableDiv.innerHTML=this.getTable()};c.getOptions().exporting&&c.getOptions().exporting.buttons.contextButton.menuItems.push({textKey:"downloadCSV",
onclick:function(){this.downloadCSV()}},{textKey:"downloadXLS",onclick:function(){this.downloadXLS()}},{textKey:"viewData",onclick:function(){this.viewData()}});n.map&&(n.map.prototype.exportKey="name");n.mapbubble&&(n.mapbubble.prototype.exportKey="name");n.treemap&&(n.treemap.prototype.exportKey="name")})(f)});
