(function(n){"object"==typeof module&&module.exports?(n["default"]=n,module.exports=n):"function"==typeof define&&define.amd?define("highcharts/modules/export-data",["highcharts","highcharts/modules/exporting"],function(t){return n(t),n.Highcharts=t,n}):n("undefined"!=typeof Highcharts?Highcharts:void 0)})(function(n){function t(n,t,i,r){n.hasOwnProperty(t)||(n[t]=r.apply(null,i))}n=n?n._modules:{};t(n,"mixins/ajax.js",[n["parts/Globals.js"],n["parts/Utilities.js"]],function(n,t){var i=t.merge,r=t.objectEach;n.ajax=function(n){var t=i(!0,{url:!1,type:"get",dataType:"json",success:!1,error:!1,data:!1,headers:{}},n),u;if(n={json:"application/json",xml:"application/xml",text:"text/plain",octet:"application/octet-stream"},u=new XMLHttpRequest,!t.url)return!1;u.open(t.type.toUpperCase(),t.url,!0);t.headers["Content-Type"]||u.setRequestHeader("Content-Type",n[t.dataType]||n.text);r(t.headers,function(n,t){u.setRequestHeader(t,n)});u.onreadystatechange=function(){if(4===u.readyState){if(200===u.status){var n=u.responseText;if("json"===t.dataType)try{n=JSON.parse(n)}catch(i){t.error&&t.error(u,i);return}return t.success&&t.success(n)}t.error&&t.error(u,u.responseText)}};try{t.data=JSON.stringify(t.data)}catch(f){}u.send(t.data||!0)};n.getJSON=function(t,i){n.ajax({url:t,success:i,dataType:"json",headers:{"Content-Type":"text/plain"}})}});t(n,"mixins/download-url.js",[n["parts/Globals.js"]],function(n){var t=n.win,i=t.navigator,r=t.document,u=t.URL||t.webkitURL||t,f=/Edge\/\d+/.test(i.userAgent);n.dataURLtoBlob=function(n){var f,i,r;if((n=n.match(/data:([^;]*)(;base64)?,([0-9A-Za-z+/]+)/))&&3<n.length&&t.atob&&t.ArrayBuffer&&t.Uint8Array&&t.Blob&&u.createObjectURL){for(f=t.atob(n[3]),i=new t.ArrayBuffer(f.length),i=new t.Uint8Array(i),r=0;r<i.length;++r)i[r]=f.charCodeAt(r);return n=new t.Blob([i],{type:n[1]}),u.createObjectURL(n)}};n.downloadURL=function(u,e){var o=r.createElement("a"),s;if("string"==typeof u||u instanceof String||!i.msSaveOrOpenBlob){if((f||2e6<u.length)&&(u=n.dataURLtoBlob(u),!u))throw Error("Failed to convert to blob");if("undefined"!=typeof o.download)o.href=u,o.download=e,r.body.appendChild(o),o.click(),r.body.removeChild(o);else try{if(s=t.open(u,"chart"),"undefined"==typeof s||null===s)throw Error("Failed to open window");}catch(h){t.location.href=u}}else i.msSaveOrOpenBlob(u,e)}});t(n,"modules/export-data.src.js",[n["parts/Axis.js"],n["parts/Chart.js"],n["parts/Globals.js"],n["parts/Utilities.js"]],function(n,t,i,r){function h(n,t){var i=f.navigator,u=-1<i.userAgent.indexOf("WebKit")&&0>i.userAgent.indexOf("Chrome"),e=f.URL||f.webkitURL||f,r;try{if(i.msSaveOrOpenBlob&&f.MSBlobBuilder)return r=new f.MSBlobBuilder,r.append(n),r.getBlob("image/svg+xml");if(!u)return e.createObjectURL(new f.Blob(["﻿"+n],{type:t}))}catch(o){}}var c=i.doc,u=i.seriesTypes,f=i.win,l=r.addEvent,a=r.defined,v=r.extend,y=r.find,o=r.fireEvent,p=r.getOptions,w=r.isNumber,e=r.pick,s;r=r.setOptions;s=i.downloadURL;r({exporting:{csv:{columnHeaderFormatter:null,dateFormat:"%Y-%m-%d %H:%M:%S",decimalPoint:null,itemDelimiter:null,lineDelimiter:"\n"},showTable:!1,useMultiLevelHeaders:!0,useRowspanHeaders:!0},lang:{downloadCSV:"Download CSV",downloadXLS:"Download XLS",exportData:{categoryHeader:"Category",categoryDatetimeHeader:"DateTime"},viewData:"View data table"}});l(t,"render",function(){this.options&&this.options.exporting&&this.options.exporting.showTable&&!this.options.chart.forExport&&this.viewData()});t.prototype.setUpKeyToAxis=function(){u.arearange&&(u.arearange.prototype.keyToAxis={low:"y",high:"y"});u.gantt&&(u.gantt.prototype.keyToAxis={start:"x",end:"x"})};t.prototype.getDataRows=function(t){var d=this.hasParallelCoordinates,g=this.time,l=this.options.exporting&&this.options.exporting.csv||{},nt=this.xAxis,r={},v=[],tt=[],p=[],s,h=this.options.lang.exportData,it=h.categoryHeader,ft=h.categoryDatetimeHeader,rt=function(i,r,u){if(l.columnHeaderFormatter){var f=l.columnHeaderFormatter(i,r,u);if(!1!==f)return f}return i?i instanceof n?i.options.title&&i.options.title.text||(i.dateTime?ft:it):t?{columnTitle:1<u?r:i.name,topLevelColumnTitle:i.name}:i.name+(1<u?" ("+r+")":""):it},ut=function(n,t,i){var r={},u={};return t.forEach(function(t){var f=(n.keyToAxis&&n.keyToAxis[t]||t)+"Axis";f=w(i)?n.chart[f][i]:n[f];r[t]=f&&f.categories||[];u[t]=f&&f.dateTime}),{categoryMap:r,dateTimeValueAxisMap:u}},et=function(n,t){return n.data.filter(function(n){return n.name}).length&&t&&!t.categories&&!n.keyToAxis?n.pointArrayMap&&n.pointArrayMap.filter(function(n){return"x"===n}).length?(n.pointArrayMap.unshift("x"),n.pointArrayMap):["x","y"]:n.pointArrayMap||["y"]},c=[],u=0,i;this.setUpKeyToAxis();this.series.forEach(function(n){var o=n.xAxis,f=n.options.keys||et(n,o),w=f.length,h=!n.requireSorting&&{},a=nt.indexOf(o),v=ut(n,f),i,b;if(!1!==n.options.includeInDataExport&&!n.options.isInternal&&!1!==n.visible){for(y(c,function(n){return n[0]===a})||c.push([a,u]),i=0;i<w;)s=rt(n,f[i],f.length),p.push(s.columnTitle||s),t&&tt.push(s.topLevelColumnTitle||s),i++;b={chart:n.chart,autoIncrement:n.autoIncrement,options:n.options,pointArrayMap:n.pointArrayMap};n.options.data.forEach(function(t,s){var y,c;for(d&&(v=ut(n,f,s)),y={series:b},n.pointClass.prototype.applyOptions.apply(y,[t]),t=y.x,c=n.data[s]&&n.data[s].name,i=0,(!o||"name"===n.exportKey||!d&&o&&o.hasNames&&c)&&(t=c),h&&(h[t]&&(t+="|"+s),h[t]=!0),r[t]||(r[t]=[],r[t].xValues=[]),r[t].x=y.x,r[t].name=c,r[t].xValues[a]=y.x;i<w;)s=f[i],c=y[s],r[t][u+i]=e(v.categoryMap[s][c],v.dateTimeValueAxisMap[s]?g.dateFormat(l.dateFormat,c):null,c),i++});u+=i}});for(i in r)Object.hasOwnProperty.call(r,i)&&v.push(r[i]);for(i=t?[tt,p]:[p],u=c.length;u--;){var b=c[u][0],k=c[u][1],f=nt[b];v.sort(function(n,t){return n.xValues[b]-t.xValues[b]});h=rt(f);i[0].splice(k,0,h);t&&i[1]&&i[1].splice(k,0,h);v.forEach(function(n){var t=n.name;f&&!a(t)&&(f.dateTime?(n.x instanceof Date&&(n.x=n.x.getTime()),t=g.dateFormat(l.dateFormat,n.x)):t=f.categories?e(f.names[n.x],f.categories[n.x],n.x):n.x);n.splice(k,0,t)})}return i=i.concat(v),o(this,"exportData",{dataRows:i}),i};t.prototype.getCSV=function(n){var i="",u=this.getDataRows(),t=this.options.exporting.csv,r=e(t.decimalPoint,","!==t.itemDelimiter&&n?1.1.toLocaleString()[1]:"."),f=e(t.itemDelimiter,","===r?";":","),o=t.lineDelimiter;return u.forEach(function(n,t){for(var e,s=n.length;s--;)e=n[s],"string"==typeof e&&(e='"'+e+'"'),"number"==typeof e&&"."!==r&&(e=e.toString().replace(".",r)),n[s]=e;i+=n.join(f);t<u.length-1&&(i+=o)}),i};t.prototype.getTable=function(n){var t='<table id="highcharts-data-table-'+this.index+'">',i=this.options,h=n?1.1.toLocaleString()[1]:".",s=e(i.exporting.useMultiLevelHeaders,!0),r,l;n=this.getDataRows(s);var u=0,a=s?n.shift():null,c=n.shift(),f=function(n,t,i,r){var u=e(r,"");return t="text"+(t?" "+t:""),"number"==typeof u?(u=u.toString(),","===h&&(u=u.replace(".",h)),t="number"):r||(t="empty"),"<"+n+(i?" "+i:"")+' class="'+t+'">'+u+"<\/"+n+">"};for(!1!==i.exporting.tableCaption&&(t+='<caption class="highcharts-table-caption">'+e(i.exporting.tableCaption,i.title.text?i.title.text.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/\//g,"&#x2F;"):"Chart")+"<\/caption>"),r=0,l=n.length;r<l;++r)n[r].length>u&&(u=n[r].length);return t+=function(n,t,r){var o="<thead>",e=0,u,c,h;if(r=r||t&&t.length,c=0,u=s&&n&&t){n:if(u=n.length,t.length===u){for(;u--;)if(n[u]!==t[u]){u=!1;break n}u=!0}else u=!1;u=!u}if(u){for(o+="<tr>";e<r;++e)u=n[e],h=n[e+1],u===h?++c:c?(o+=f("th","highcharts-table-topheading",'scope="col" colspan="'+(c+1)+'"',u),c=0):(u===t[e]?i.exporting.useRowspanHeaders?(h=2,delete t[e]):(h=1,t[e]=""):h=1,o+=f("th","highcharts-table-topheading",'scope="col"'+(1<h?' valign="top" rowspan="'+h+'"':""),u));o+="<\/tr>"}if(t){for(o+="<tr>",e=0,r=t.length;e<r;++e)"undefined"!=typeof t[e]&&(o+=f("th",null,'scope="col"',t[e]));o+="<\/tr>"}return o+"<\/thead>"}(a,c,Math.max(u,c.length)),t+="<tbody>",n.forEach(function(n){t+="<tr>";for(var i=0;i<u;i++)t+=f(i?"td":"th",null,i?"":'scope="row"',n[i]);t+="<\/tr>"}),t+="<\/tbody><\/table>",n={html:t},o(this,"afterGetTable",n),n.html};t.prototype.downloadCSV=function(){var n=this.getCSV(!0);s(h(n,"text/csv")||"data:text/csv,﻿"+encodeURIComponent(n),this.getFilename()+".csv")};t.prototype.downloadXLS=function(){var n='<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>Ark1<\/x:Name><x:WorksheetOptions><x:DisplayGridlines/><\/x:WorksheetOptions><\/x:ExcelWorksheet><\/x:ExcelWorksheets><\/x:ExcelWorkbook><\/xml><![endif]--><style>td{border:none;font-family: Calibri, sans-serif;} .number{mso-number-format:"0.00";} .text{ mso-number-format:"@";}<\/style><meta name=ProgId content=Excel.Sheet><meta charset=UTF-8><\/head><body>'+this.getTable(!0)+"<\/body><\/html>";s(h(n,"application/vnd.ms-excel")||"data:application/vnd.ms-excel;base64,"+f.btoa(unescape(encodeURIComponent(n))),this.getFilename()+".xls")};t.prototype.viewData=function(){this.dataTableDiv||(this.dataTableDiv=c.createElement("div"),this.dataTableDiv.className="highcharts-data-table",this.renderTo.parentNode.insertBefore(this.dataTableDiv,this.renderTo.nextSibling));this.dataTableDiv.innerHTML=this.getTable();o(this,"afterViewData",this.dataTableDiv)};(t=p().exporting)&&(v(t.menuItemDefinitions,{downloadCSV:{textKey:"downloadCSV",onclick:function(){this.downloadCSV()}},downloadXLS:{textKey:"downloadXLS",onclick:function(){this.downloadXLS()}},viewData:{textKey:"viewData",onclick:function(){this.viewData()}}}),t.buttons&&t.buttons.contextButton.menuItems.push("separator","downloadCSV","downloadXLS","viewData"));u.map&&(u.map.prototype.exportKey="name");u.mapbubble&&(u.mapbubble.prototype.exportKey="name");u.treemap&&(u.treemap.prototype.exportKey="name")});t(n,"masters/modules/export-data.src.js",[],function(){})})