AmCharts.translations.export||(AmCharts.translations.export={}),AmCharts.translations.export.en||(AmCharts.translations.export.en={"fallback.save.text":"CTRL + C to copy the data into the clipboard.","fallback.save.image":"Rightclick -> Save picture as... to save the image.","capturing.delayed.menu.label":"{{duration}}","capturing.delayed.menu.title":"Click to cancel","menu.label.print":"Print","menu.label.undo":"Undo","menu.label.redo":"Redo","menu.label.cancel":"Cancel","menu.label.save.image":"Download as ...","menu.label.save.data":"Save as ...","menu.label.draw":"Annotate ...","menu.label.draw.change":"Change ...","menu.label.draw.add":"Add ...","menu.label.draw.shapes":"Shape ...","menu.label.draw.colors":"Color ...","menu.label.draw.widths":"Size ...","menu.label.draw.opacities":"Opacity ...","menu.label.draw.text":"Text","menu.label.draw.modes":"Mode ...","menu.label.draw.modes.pencil":"Pencil","menu.label.draw.modes.line":"Line","menu.label.draw.modes.arrow":"Arrow","label.saved.from":"Saved from: "}),function(){AmCharts.export=function(a,b){var c,d={name:"export",version:"1.4.66",libs:{async:!0,autoLoad:!0,reload:!1,resources:["fabric.js/fabric.min.js","FileSaver.js/FileSaver.min.js",{"jszip/jszip.min.js":["xlsx/xlsx.min.js"],"pdfmake/pdfmake.min.js":["pdfmake/vfs_fonts.js"]}],namespaces:{"pdfmake.min.js":"pdfMake","jszip.min.js":"JSZip","xlsx.min.js":"XLSX","fabric.min.js":"fabric","FileSaver.min.js":"saveAs"},loadTimeout:1e4},config:{},setup:{chart:a,hasBlob:!1,wrapper:!1,isIE:!!window.document.documentMode,IEversion:window.document.documentMode,hasTouch:"object"==typeof window.Touch,focusedMenuItem:void 0},drawing:{enabled:!1,undos:[],redos:[],buffer:{position:{x1:0,y1:0,x2:0,y2:0,xD:0,yD:0}},handler:{undo:function(a,b){var c=d.drawing.undos.pop();if(c){c.selectable=!0,d.drawing.redos.push(c),"added"==c.action&&d.setup.fabric.remove(c.target);var e=JSON.parse(c.state);c.target.set(e),c.target instanceof fabric.Group&&d.drawing.handler.change({color:e.cfg.color,width:e.cfg.width,opacity:e.cfg.opacity},!0,c.target),d.setup.fabric.renderAll(),c.state!=c.target.recentState||b||d.drawing.handler.undo(c,!0)}},redo:function(a,b){var c=d.drawing.redos.pop();if(c){c.selectable=!0,d.drawing.undos.push(c),"added"==c.action&&d.setup.fabric.add(c.target);var e=JSON.parse(c.state);c.target.recentState=c.state,c.target.set(e),c.target instanceof fabric.Group&&d.drawing.handler.change({color:e.cfg.color,width:e.cfg.width,opacity:e.cfg.opacity},!0,c.target),d.setup.fabric.renderAll(),"addified"==c.action&&d.drawing.handler.redo()}},done:function(a){d.drawing.enabled=!1,d.drawing.buffer.enabled=!1,d.drawing.undos=[],d.drawing.redos=[],d.createMenu(d.config.menu),d.setup.fabric.deactivateAll(),d.setup.wrapper&&(d.setup.chart.containerDiv.removeChild(d.setup.wrapper),d.setup.wrapper=!1)},add:function(a){var b=d.deepMerge({top:d.setup.fabric.height/2,left:d.setup.fabric.width/2},a||{});(-1!=b.url.indexOf(".svg")?fabric.loadSVGFromURL:fabric.Image.fromURL)(b.url,function(a,c){var e=void 0!==c?fabric.util.groupSVGElements(a,c):a,f=!1;(e.height>d.setup.fabric.height||e.width>d.setup.fabric.width)&&(f=d.setup.fabric.height/2/e.height),b.top>d.setup.fabric.height&&(b.top=d.setup.fabric.height/2),b.left>d.setup.fabric.width&&(b.left=d.setup.fabric.width/2),d.drawing.buffer.isDrawing=!0,e.set({originX:"center",originY:"center",top:b.top,left:b.left,width:f?e.width*f:e.width,height:f?e.height*f:e.height,fill:d.drawing.color}),d.setup.fabric.add(e)})},change:function(a,b,c){var f,g,h,e=d.deepMerge({},a||{}),i=c||d.drawing.buffer.target,j=i?i._objects?i._objects:[i]:null;if(e.mode&&(d.drawing.mode=e.mode),e.width&&(d.drawing.width=e.width,d.drawing.fontSize=e.fontSize=3*e.width,1==d.drawing.width&&(d.drawing.fontSize=e.fontSize=d.defaults.fabric.drawing.fontSize)),e.fontSize&&(d.drawing.fontSize=e.fontSize),e.color&&(d.drawing.color=e.color),e.opacity&&(d.drawing.opacity=e.opacity),h=d.getRGBA(d.drawing.color),h.pop(),h.push(d.drawing.opacity),d.drawing.color="rgba("+h.join()+")",d.setup.fabric.freeDrawingBrush.color=d.drawing.color,d.setup.fabric.freeDrawingBrush.width=d.drawing.width,i){for(f=JSON.parse(i.recentState).cfg,f&&(e.color=e.color||f.color,e.width=e.width||f.width,e.opacity=e.opacity||f.opacity,e.fontSize=e.fontSize||f.fontSize,h=d.getRGBA(e.color),h.pop(),h.push(e.opacity),e.color="rgba("+h.join()+")"),g=0;g0?Math.PI/2:3*Math.PI/2:0==f?e>0?0:Math.PI:e<0?Math.atan(f/e)+Math.PI:f<0?Math.atan(f/e)+2*Math.PI:Math.atan(f/e))/Math.PI},gatherAttribute:function(a,b,c,e){var f,e=e||0,c=c||3;return a&&!(f=a.getAttribute(b))&&e1?g.set({left:g.getLeft()+h,top:g.getTop()+g.fontSize*(e.length-1)*(.18+g._fontSizeFraction),textAlign:b.originX,lineHeight:e.length>1?.965:1.16}):g.set({left:g.getLeft()+h,top:g.getTop()-g.getHeight()/2+g.fontSize*(.18+g._fontSizeFraction)}),g}},capture:function(a,b){var c,e=d.deepMerge(d.deepMerge({},d.config.fabric),a||{}),f=[],g={x:0,y:0,pX:0,pY:0,lX:0,lY:0,width:d.setup.chart.divRealWidth,height:d.setup.chart.divRealHeight},h={loaded:0,included:0},i={items:[],width:0,height:0,maxWidth:0,maxHeight:0};if(!d.handleNamespace("fabric",{scope:this,cb:d.capture,args:arguments}))return!1;d.modifyFabric(),d.handleCallback(e.beforeCapture,e);var j=d.setup.chart.containerDiv.getElementsByTagName("svg");for(c=0;ci.maxWidth?k.legend.width:i.maxWidth,i.maxHeight=k.legend.height>i.maxHeight?k.legend.height:i.maxHeight,k=d.gatherElements(k,e,h),f[k.legend.type](k)}-1!=["top","bottom"].indexOf(d.config.legend.position)?(g.width=i.maxWidth>g.width?i.maxWidth:g.width,g.height+=i.height):-1!=["left","right"].indexOf(d.config.legend.position)?(g.width+=i.maxWidth,g.height=i.height>g.height?i.height:g.height):(g.height+=i.height,g.width+=i.maxWidth)}if(d.drawing.enabled=e.drawing.enabled="draw"==e.action,d.drawing.buffer.enabled=d.drawing.enabled,d.setup.wrapper=document.createElement("div"),d.setup.wrapper.setAttribute("class",d.setup.chart.classNamePrefix+"-export-canvas"),d.setup.chart.containerDiv.appendChild(d.setup.wrapper),"stock"==d.setup.chart.type){var m={top:0,right:0,bottom:0,left:0};d.setup.chart.leftContainer&&(g.width-=d.setup.chart.leftContainer.offsetWidth,m.left=d.setup.chart.leftContainer.offsetWidth+2*d.setup.chart.panelsSettings.panelSpacing),d.setup.chart.rightContainer&&(g.width-=d.setup.chart.rightContainer.offsetWidth,m.right=d.setup.chart.rightContainer.offsetWidth+2*d.setup.chart.panelsSettings.panelSpacing),d.setup.chart.periodSelector&&-1!=["top","bottom"].indexOf(d.setup.chart.periodSelector.position)&&(g.height-=d.setup.chart.periodSelector.offsetHeight+d.setup.chart.panelsSettings.panelSpacing,m[d.setup.chart.periodSelector.position]+=d.setup.chart.periodSelector.offsetHeight+d.setup.chart.panelsSettings.panelSpacing),d.setup.chart.dataSetSelector&&-1!=["top","bottom"].indexOf(d.setup.chart.dataSetSelector.position)&&(g.height-=d.setup.chart.dataSetSelector.offsetHeight,m[d.setup.chart.dataSetSelector.position]+=d.setup.chart.dataSetSelector.offsetHeight),d.setup.wrapper.style.paddingTop=d.numberToPx(m.top),d.setup.wrapper.style.paddingRight=d.numberToPx(m.right),d.setup.wrapper.style.paddingBottom=d.numberToPx(m.bottom),d.setup.wrapper.style.paddingLeft=d.numberToPx(m.left)}for(d.setup.canvas=document.createElement("canvas"),d.setup.wrapper.appendChild(d.setup.canvas),d.setup.fabric=new fabric.Canvas(d.setup.canvas,d.deepMerge({width:g.width,height:g.height,isDrawingMode:!0},e)),d.deepMerge(d.setup.fabric,e),d.deepMerge(d.setup.fabric.freeDrawingBrush,e.drawing),d.deepMerge(d.drawing,e.drawing),d.drawing.handler.change(e.drawing),d.setup.fabric.on("mouse:down",function(a){d.gatherPosition(a.e,1);d.drawing.buffer.pressedTS=Number(new Date),d.isPressed(a.e),d.drawing.buffer.isDrawing=!1,d.drawing.buffer.isDrawingTimer=setTimeout(function(){d.drawing.buffer.isSelected||(d.drawing.buffer.isDrawing=!0)},200)}),d.setup.fabric.on("mouse:move",function(a){var b=d.gatherPosition(a.e,2);if(d.isPressed(a.e),d.drawing.buffer.isPressed&&!d.drawing.buffer.isSelected&&(d.drawing.buffer.isDrawing=!0,!d.drawing.buffer.line&&"pencil"!=d.drawing.mode&&(b.xD>5||b.yD>5)&&(d.setup.fabric.isDrawingMode=!1,d.setup.fabric._isCurrentlyDrawing=!1,d.setup.fabric.freeDrawingBrush.onMouseUp(),d.setup.fabric.remove(d.setup.fabric._objects.pop()),d.drawing.buffer.line=d.drawing.handler.line({x1:b.x1,y1:b.y1,x2:b.x2,y2:b.y2,arrow:"line"!=d.drawing.mode&&d.drawing.arrow,action:"config"}))),d.drawing.buffer.isSelected&&(d.setup.fabric.isDrawingMode=!1),d.drawing.buffer.line){var e,f,g,h=d.drawing.buffer.line;for(h.x2=b.x2,h.y2=b.y2,c=0;cd.config.fabric.loadTimeout)&&(clearTimeout(w),d.handleBorder(e),d.handleCallback(e.afterCapture,e),d.setup.fabric.renderAll(),d.handleCallback(b,e))},AmCharts.updateRate)}}(k),function(a,b){var c,f=d.gatherAttribute(a,"class"),g=d.gatherAttribute(a,"visibility"),h=d.gatherAttribute(a,"clip-path");b.className=String(f),b.classList=String(f).split(" "),b.clipPath=h,b.svg=a;var i=["fill","stroke"];for(c=0;c"!=q&&(p=3,q=a.slice(-p));var r=a.slice(0,a.length-p),s=' clip-path="url(#'+o+')" ',t=d.gatherAttribute(b.svg,"class");if(t=t?t.split(" "):[],a=-1!=t.indexOf(d.setup.chart.classNamePrefix+"-graph-line")?r+s+q:""+a+"",-1==e.indexOf(o)){var u=(new XMLSerializer).serializeToString(b.svg);c.push(u),e.push(o)}}return a}},a||{});if(!d.handleNamespace("fabric",{scope:this,cb:d.toSVG,args:arguments}))return!1;if(g=d.setup.fabric.toSVG(f,f.reviver),c.length){var h=g.slice(0,g.length-6),i=g.slice(-6);g=h+c.join("")+i}return f.compress&&(g=g.replace(/[\t\r\n]+/g,"")),f.getBase64&&(g="data:image/svg+xml;base64,"+btoa(g)),d.handleCallback(b,g,f),g},toPDF:function(a,b){function f(a){if("number"==typeof a||a instanceof Number)a={left:a,right:a,top:a,bottom:a};else if(a instanceof Array)if(2===a.length)a={left:a[0],top:a[1],right:a[0],bottom:a[1]};else{if(4!==a.length)throw"Invalid pageMargins definition";a={left:a[0],top:a[1],right:a[2],bottom:a[3]}}else a={left:d.defaults.pdfMake.pageMargins,top:d.defaults.pdfMake.pageMargins,right:d.defaults.pdfMake.pageMargins,bottom:d.defaults.pdfMake.pageMargins};return a}function g(a,b){var c=d.defaults.pdfMake.pageSizes[String(a).toUpperCase()].slice();if(!c)throw new Error('The given pageSize "'+a+'" does not exist!');return"landscape"==b&&c.reverse(),c}var e,c=d.deepMerge(d.deepMerge({multiplier:d.config.multiplier||2,pageOrigin:void 0===d.config.pageOrigin},d.config.pdfMake),a||{},!0);if(!d.handleNamespace("pdfMake",{scope:this,cb:d.toPDF,args:arguments}))return!1;if(e=new pdfMake.createPdf(c),c.images.reference=d.toPNG(c),!c.content){var h=[],i=g(c.pageSize,c.pageOrientation),j=f(c.pageMargins);i[0]-=j.left+j.right,i[1]-=j.top+j.bottom,c.pageOrigin&&(h.push(d.i18l("label.saved.from")),h.push(window.location.href),i[1]-=28.128),h.push({image:"reference",fit:i}),c.content=h}return b&&e.getDataUrl(function(a){return function(b){a.apply(d,arguments)}}(b)),e},toPRINT:function(a,b){var c,e=d.deepMerge({delay:.01,lossless:!1},a||{}),f=d.toImage(e),g=[],h=document.body.childNodes,i=document.documentElement.scrollTop||document.body.scrollTop;for(f.setAttribute("style","width: 100%; max-height: 100%;"),c=0;ce&&(d.s.r=e),d.s.c>f&&(d.s.c=f),d.e.r0)throw new Error("Invalid string. Length must be a multiple of 4");var i=a.length;g="="===a.charAt(i-2)?2:"="===a.charAt(i-1)?1:0,h=new e(3*a.length/4-g),d=g>0?a.length-4:a.length;var j=0;for(b=0,c=0;b>16),k((65280&f)>>8),k(255&f);return 2===g?(f=l(a.charAt(b))<<2|l(a.charAt(b+1))>>4,k(255&f)):1===g&&(f=l(a.charAt(b))<<10|l(a.charAt(b+1))<<4|l(a.charAt(b+2))>>2,k(f>>8&255),k(255&f)),h}var c=d.deepMerge({},a||{}),e="undefined"!=typeof Uint8Array?Uint8Array:Array,f="+".charCodeAt(0),g="/".charCodeAt(0),h="0".charCodeAt(0),i="a".charCodeAt(0),j="A".charCodeAt(0),k=m(c.data);return d.handleCallback(b,k,c),k},handleCallback:function(a){var b,c=Array();if(a&&a instanceof Function){for(b=0;b0&&c.push(arguments[b]);return a.apply(d,c)}},handleLog:function(a){!0===d.config.debug&&console.log(a)},handleNamespace:function(a,b){function h(){var i=Number(new Date);e=!!(a in c),"pdfMake"==a&&e&&(e=c.pdfMake.vfs),e?(clearTimeout(g),b.cb.apply(b.scope,b.args),d.handleLog(['AmCharts [export]: Namespace "',a,'" showed up in: ',String(c)].join(""))):i-fd.libs.loadTimeout||b in window)&&(clearTimeout(c),d.handleCallback(a,b,f-e>d.libs.loadTimeout))},AmCharts.updateRate)}(f)}},getChartData:function(a){function j(a,e,f){function g(a,c){return-1!=b.dataFields.indexOf(a)?g([a,".",c].join("")):a}a&&b.exportTitles&&"gantt"!=d.setup.chart.type&&(c=g(a,f),b.dataFieldsMap[c]=a,b.dataFields.push(c),b.titles[c]=e||c)}var c,e,f,g,i,b=d.deepMerge({data:[],titles:{},dateFields:[],dataFields:[],dataFieldsMap:{},exportTitles:d.config.exportTitles,exportFields:d.config.exportFields,exportSelection:d.config.exportSelection,columnNames:d.config.columnNames},a||{},!0),h=["valueField","openField","closeField","highField","lowField","xField","yField"];if(0==b.data.length)if("stock"==d.setup.chart.type){for(b.data=d.cloneObject(d.setup.chart.mainDataSet.dataProvider),j(d.setup.chart.mainDataSet.categoryField),b.dateFields.push(d.setup.chart.mainDataSet.categoryField),e=0;ea.endDate)&&(i=!0):(ea.endIndex)&&(i=!0)),c.dateFormat&&"dateObject"!=c.dateFormat&&m instanceof Date&&(m=AmCharts.formatDate(m,c.dateFormat))),c.dataFieldsTitlesMap[k]=l,h[l]=m}i||g.push(h)}c.data=g}return void 0!==c.processData&&(c.data=d.handleCallback(c.processData,c.data,c)),c.data},capitalize:function(a){return a.charAt(0).toUpperCase()+a.slice(1).toLowerCase()},createMenu:function(b,c){function g(b,c){var e,h,i=document.createElement("ul");for(e=0;e0}function m(a){return a.classList.contains("export-main")||a.classList.contains("export-drawing")}b.preventDefault();var c=a.elements.li,g=j(c),i=(k(c),l(c));if(!m(c)&&i||d.setup.menu.classList.toggle("active"),!g||!i)for(;f.length;){var n=f.pop(),o=m(n),p=n!==c;o?i||n.classList.remove("active"):p&&n.classList.remove("active")}f.push(c),i&&c.classList.toggle("active")}}(j)),k.appendChild(l),d.isElement(j.label)?n.appendChild(j.label):n.innerHTML=j.label,j.class&&(k.className=j.class),j.style&&k.setAttribute("style",j.style),j.icon&&(m.setAttribute("src",(j.ignore||-1!=j.icon.slice(0,10).indexOf("//")?"":a.pathToImages)+j.icon),l.appendChild(m)),j.label&&l.appendChild(n),j.title&&l.setAttribute("title",j.title),d.config.menuReviver&&(k=d.config.menuReviver.apply(d,[j,k])),j.elements={li:k,a:l,img:m,span:n},(j.menu||j.items)&&"draw"!=j.action?g(j.menu||j.items,k).childNodes.length&&i.appendChild(k):i.appendChild(k))}}return i.childNodes.length&&c.appendChild(i),i}var f=[];return c||("string"==typeof d.config.divId?d.config.divId=c=document.getElementById(d.config.divId):c=d.isElement(d.config.divId)?d.config.divId:d.setup.chart.containerDiv),d.isElement(d.setup.menu)?d.setup.menu.innerHTML="":d.setup.menu=document.createElement("div"),d.setup.menu.setAttribute("class",d.setup.chart.classNamePrefix+"-export-menu "+d.setup.chart.classNamePrefix+"-export-menu-"+d.config.position+" amExportButton"),d.config.menuWalker&&(g=d.config.menuWalker),g.apply(this,[b,d.setup.menu]),d.setup.menu.childNodes.length&&c.appendChild(d.setup.menu),d.setup.menu},delay:function(a,b){var e,f,c=d.deepMerge({delay:3,precision:2},a||{}),g=Number(new Date),h=d.createMenu([{label:d.i18l("capturing.delayed.menu.label").replace("{{duration}}",AmCharts.toFixed(c.delay,c.precision)),title:d.i18l("capturing.delayed.menu.title"),class:"export-delayed-capturing",click:function(){clearTimeout(e),clearTimeout(f),d.createMenu(d.config.menu)}}]),i=h.getElementsByTagName("a")[0];e=setInterval(function(){var a=c.delay-(Number(new Date)-g)/1e3;a<=0?(clearTimeout(e),"draw"!=c.action&&d.createMenu(d.config.menu)):i&&(i.innerHTML=d.i18l("capturing.delayed.menu.label").replace("{{duration}}",AmCharts.toFixed(a,2)))},AmCharts.updateRate),f=setTimeout(function(){b.apply(d,arguments)},1e3*c.delay)},migrateSetup:function(a){function c(a){var d;for(d in a){var e=a[d];"export"==d.slice(0,6)&&e?b.menu.push(d.slice(6)):"userCFG"==d?c(e):"menuItems"==d?b.menu=e:"libs"==d?b.libs=e:"string"==typeof d&&(b[d]=e)}}var b={enabled:!0,migrated:!0,libs:{autoLoad:!0},menu:[]};return c(a),b},clear:function(){d.setup=void 0,d.docListener&&document.removeEventListener("keydown",d.docListener);var a=d.listenersToRemove;if(a)for(var b=0;b