/*
 Highcharts JS v6.0.3 (2017-11-14)
 Client side exporting module

 (c) 2015 Torstein Honsi / Oystein Moseng

 License: www.highcharts.com/license
*/
(function(n){"object"===typeof module&&module.exports?module.exports=n:n(Highcharts)})(function(n){(function(d){function n(a,f){var c=t.getElementsByTagName("head")[0],b=t.createElement("script");b.type="text/javascript";b.src=a;b.onload=f;b.onerror=function(){d.error("Error loading script "+a)};c.appendChild(b)}var C=d.merge,e=d.win,r=e.navigator,t=e.document,w=d.each,x=e.URL||e.webkitURL||e,B=/Edge\/|Trident\/|MSIE /.test(r.userAgent),D=/Edge\/\d+/.test(r.userAgent),E=B?150:0;d.CanVGRenderer={};
d.dataURLtoBlob=function(a){if(e.atob&&e.ArrayBuffer&&e.Uint8Array&&e.Blob&&x.createObjectURL){a=a.match(/data:([^;]*)(;base64)?,([0-9A-Za-z+/]+)/);for(var d=e.atob(a[3]),c=new e.ArrayBuffer(d.length),c=new e.Uint8Array(c),b=0;b<c.length;++b)c[b]=d.charCodeAt(b);a=new e.Blob([c],{type:a[1]});return x.createObjectURL(a)}};d.downloadURL=function(a,f){var c=t.createElement("a"),b;if("string"===typeof a||a instanceof String||!r.msSaveOrOpenBlob){if(D||2E6<a.length)if(a=d.dataURLtoBlob(a),!a)throw"Data URL length limit reached";
if(void 0!==c.download)c.href=a,c.download=f,t.body.appendChild(c),c.click(),t.body.removeChild(c);else try{if(b=e.open(a,"chart"),void 0===b||null===b)throw"Failed to open window";}catch(u){e.location.href=a}}else r.msSaveOrOpenBlob(a,f)};d.svgToDataUrl=function(a){var d=-1<r.userAgent.indexOf("WebKit")&&0>r.userAgent.indexOf("Chrome");try{if(!d&&0>r.userAgent.toLowerCase().indexOf("firefox"))return x.createObjectURL(new e.Blob([a],{type:"image/svg+xml;charset-utf-16"}))}catch(c){}return"data:image/svg+xml;charset\x3dUTF-8,"+
encodeURIComponent(a)};d.imageToDataUrl=function(a,d,c,b,u,l,k,m,p){var g=new e.Image,h,f=function(){setTimeout(function(){var e=t.createElement("canvas"),f=e.getContext&&e.getContext("2d"),y;try{if(f){e.height=g.height*b;e.width=g.width*b;f.drawImage(g,0,0,e.width,e.height);try{y=e.toDataURL(d),u(y,d,c,b)}catch(F){h(a,d,c,b)}}else k(a,d,c,b)}finally{p&&p(a,d,c,b)}},E)},q=function(){m(a,d,c,b);p&&p(a,d,c,b)};h=function(){g=new e.Image;h=l;g.crossOrigin="Anonymous";g.onload=f;g.onerror=q;g.src=a};
g.onload=f;g.onerror=q;g.src=a};d.downloadSVGLocal=function(a,f,c,b){function u(b,a){a=new e.jsPDF("l","pt",[b.width.baseVal.value+2*a,b.height.baseVal.value+2*a]);w(b.querySelectorAll('*[visibility\x3d"hidden"]'),function(b){b.parentNode.removeChild(b)});e.svg2pdf(b,a,{removeInvalid:!0});return a.output("datauristring")}function l(){z.innerHTML=a;var e=z.getElementsByTagName("text"),f,g=z.getElementsByTagName("svg")[0].style;w(e,function(b){w(["font-family","font-size"],function(a){!b.style[a]&&
g[a]&&(b.style[a]=g[a])});b.style["font-family"]=b.style["font-family"]&&b.style["font-family"].split(" ").splice(-1);f=b.getElementsByTagName("title");w(f,function(a){b.removeChild(a)})});e=u(z.firstChild,0);try{d.downloadURL(e,v),b&&b()}catch(G){c()}}var k,m,p=!0,g,h=f.libURL||d.getOptions().exporting.libURL,z=t.createElement("div"),q=f.type||"image/png",v=(f.filename||"chart")+"."+("image/svg+xml"===q?"svg":q.split("/")[1]),A=f.scale||1,h="/"!==h.slice(-1)?h+"/":h;if("image/svg+xml"===q)try{r.msSaveOrOpenBlob?
(m=new MSBlobBuilder,m.append(a),k=m.getBlob("image/svg+xml")):k=d.svgToDataUrl(a),d.downloadURL(k,v),b&&b()}catch(y){c()}else"application/pdf"===q?e.jsPDF&&e.svg2pdf?l():(p=!0,n(h+"jspdf.js",function(){n(h+"svg2pdf.js",function(){l()})})):(k=d.svgToDataUrl(a),g=function(){try{x.revokeObjectURL(k)}catch(y){}},d.imageToDataUrl(k,q,{},A,function(a){try{d.downloadURL(a,v),b&&b()}catch(F){c()}},function(){var f=t.createElement("canvas"),u=f.getContext("2d"),l=a.match(/^<svg[^>]*width\s*=\s*\"?(\d+)\"?[^>]*>/)[1]*
A,k=a.match(/^<svg[^>]*height\s*=\s*\"?(\d+)\"?[^>]*>/)[1]*A,m=function(){u.drawSvg(a,0,0,l,k);try{d.downloadURL(r.msSaveOrOpenBlob?f.msToBlob():f.toDataURL(q),v),b&&b()}catch(H){c()}finally{g()}};f.width=l;f.height=k;e.canvg?m():(p=!0,n(h+"rgbcolor.js",function(){n(h+"canvg.js",function(){m()})}))},c,c,function(){p&&g()}))};d.Chart.prototype.getSVGForLocalExport=function(a,e,c,b){var f=this,l,k=0,m,p,g,h,n,q=function(a,d,c){++k;c.imageElement.setAttributeNS("http://www.w3.org/1999/xlink","href",
a);k===l.length&&b(f.sanitizeSVG(m.innerHTML,p))};d.wrap(d.Chart.prototype,"getChartHTML",function(b){var a=b.apply(this,Array.prototype.slice.call(arguments,1));p=this.options;m=this.container.cloneNode(!0);return a});f.getSVGForExport(a,e);l=m.getElementsByTagName("image");try{if(l.length)for(h=0,n=l.length;h<n;++h)g=l[h],d.imageToDataUrl(g.getAttributeNS("http://www.w3.org/1999/xlink","href"),"image/png",{imageElement:g},a.scale,q,c,c,c);else b(f.sanitizeSVG(m.innerHTML,p))}catch(v){c()}};d.Chart.prototype.exportChartLocal=
function(a,e){var c=this,b=d.merge(c.options.exporting,a),f=function(){if(!1===b.fallbackToExportServer)if(b.error)b.error(b);else throw"Fallback to export server disabled";else c.exportChart(b)};B&&("application/pdf"===b.type||c.container.getElementsByTagName("image").length&&"image/svg+xml"!==b.type)||"application/pdf"===b.type&&c.container.getElementsByTagName("image").length?f():c.getSVGForLocalExport(b,e,f,function(a){-1<a.indexOf("\x3cforeignObject")&&"image/svg+xml"!==b.type?f():d.downloadSVGLocal(a,
b,f)})};C(!0,d.getOptions().exporting,{libURL:"https://code.highcharts.com/6.0.3/lib/",menuItemDefinitions:{downloadPNG:{textKey:"downloadPNG",onclick:function(){this.exportChartLocal()}},downloadJPEG:{textKey:"downloadJPEG",onclick:function(){this.exportChartLocal({type:"image/jpeg"})}},downloadSVG:{textKey:"downloadSVG",onclick:function(){this.exportChartLocal({type:"image/svg+xml"})}},downloadPDF:{textKey:"downloadPDF",onclick:function(){this.exportChartLocal({type:"application/pdf"})}}}})})(n)});
