"use strict";var ZoomCharts=ZoomCharts||{};!function(t){var e=t.Configuration||(t.Configuration={}),i=t.Internal||(t.Internal={}); /*! @license DVSL Charting library, version 1.16.5. (c) 2013 - 2017 Data Visualization Software Lab https://zoomcharts.com Embedded 3rd party software libraries: CssColorParser.js author : Dean McNamee , 2012. license : MIT github.com/deanm/css-color-parser-js SHA-256 implementation in JavaScript author : Chris Veness license: MIT github.com/chrisveness/crypto jsrsasign (RSA-Sign JavaScript Library) version : 4.7.2 author : Kenji Urushima license : MIT kjur.github.io/jsrsasign/ jsbn (RSA and ECC in JavaScript) version : 1.4 author : Tom Wu license : BSD (http://www-cs-students.stanford.edu/~tjw/jsbn/LICENSE) www-cs-students.stanford.edu/~tjw/jsbn/ */ t.PackageInfo={LibraryName:"zoomcharts",Version:"1.16.5",Revision:"c815cfd8b472475fdca6f5fdf81f200303706965",Built:"2017-02-20"};var n=function(t,e){function i(){this.constructor=t}t.__baseType=e;for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)};!function(i){var s=i.GeoChart||(i.GeoChart={}),r=i.FacetChart||(i.FacetChart={}),a=i.PieChart||(i.PieChart={}),o=i.TimeChart||(i.TimeChart={}),l=i.LinearChart||(i.LinearChart={}),h=i.NetChart||(i.NetChart={}),u=i.ItemsChart||(i.ItemsChart={}),c=i.Resources||(i.Resources={}),d=i.Base||(i.Base={});"undefined"!=typeof module&&module.exports&&(module.exports.Internal=i),function(s){function r(){}function a(t,e){for(var i in e)e.hasOwnProperty(i)&&!t.hasOwnProperty(i)&&(t[i]=e[i])}var o=s.Bar||(s.Bar={}),l=Object.prototype.hasOwnProperty,h=("undefined"==typeof console?null:console)||{};h.log||(h.log=r),h.warn||(h.warn=r),h.error||(h.error=r),h.info||(h.info=r),s.overlayConsole=!1;var u=function(){function t(){}return t.exportSymbol=function(t,e){"undefined"!=typeof window&&(window[t]=e),"undefined"!=typeof module&&module.exports&&(module.exports[t]=e)},t.extendStyleTo=function(t,e){for(var i=Object.keys(t),n=0;n0},t.removePropertyValue=function(t){var e=Object.keys(t);if(0===e.length)return null;var i=e[0],n=t[i];return delete t[i],{key:i,value:n}},t.countProperties=function(t){return Object.keys(t).length},t.realClone=function(t){if(this.isFunction(t)||this.isDomObject(t))return t;if(Array.isArray(t)){for(var e=new Array(t.length),i=0;i-1;)t.splice(i,1),n=!0;return n},t.removeFromArrayHasty=function(t,e){var i=t.indexOf(e);if(i<0)return!1;var n=t.pop();return i!==t.length&&(t[i]=n),!0},t.arrayToMap=function(t,e){for(var i={},n=0;nr)return;n===!0&&(n=5e3),this._previousConsoleMessages[e]=r+n}s.overlayConsole?t.overlayConsoleMessage("warn",e,i):i&&i.length?h.warn.apply(h,[e].concat(i)):h.warn(e)},t.error=function(e){for(var i=[],n=1;n-1&&(this.addClass(t,e.substr(i+1)),e=e.substr(0,i)),t.classList)t.classList.add(e);else{var n=t.className.length>0&&new RegExp("(^|s)"+e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")+"(s|$)").test(t.className);n||(t.className.length>0&&(e=" "+e),t.className=e)}}},t.removeClass=function(t,e){if(e=(e||"").trim()){var i=e.indexOf(" ");if(i>-1&&(this.removeClass(t,e.substr(i+1)),e=e.substr(0,i)),t.classList)t.classList.remove(e);else{var n=function(t,i){return i===e?"":t};t.className=t.className.replace(/(\S+)\s*/g,n).trim()}}},t.isStyleSheetDefined=function(t,e){var i=document.createElement("dvsl-test"),n=document.body;n.appendChild(i);try{var s=window.getComputedStyle(i),r=s[e];return i.className=t,n.removeChild(i),n.appendChild(i),r!==s[e]}finally{n.removeChild(i)}},t.listen=function(t,e,i){t.addEventListener(e,i)},t.unlisten=function(t,e,i){t.removeEventListener(e,i)},t.stopPropagation=function(t){t.stopPropagation()},t.canvasScaling=function(){var t,e;return window.screen.deviceXDPI?(t=window.screen.deviceXDPI/window.screen.logicalXDPI,e=window.screen.deviceYDPI/window.screen.logicalYDPI):t=e=window.devicePixelRatio?window.devicePixelRatio:1,{x:t,y:e}},t.convertPointFromPageToNode=function(t,e,i,n,s){if(window&&window.webkitConvertPointFromPageToNode){var r=window.webkitConvertPointFromPageToNode(t,new WebKitPoint(e,i));if(r)return r}var a=t.getBoundingClientRect();return{x:n-a.left,y:s-a.top}},t.elementPos=function(t){var e=t.getBoundingClientRect(),i=e.top+(window.pageYOffset||document.documentElement.scrollTop)-(document.documentElement.clientTop||0),n=e.left+(window.pageXOffset||document.documentElement.scrollLeft)-(document.documentElement.clientLeft||0);return{left:n,top:i}},t.isParentOf=function(t,e){for(;e;){if(e===t)return!0;e=e.parentElement}return!1},t.getProp=function(t,e,i){void 0===i&&(i=!1);for(var n=0,s=e.split(".");n=0;i+=-2)e.push(t[i-1],t[i]);return e},t.toleranceMax=function(t,e,i){return t>=e*i?t:e},t.toleranceMin=function(t,e,i){return t*i<=e?t:e},t.getIdentifierStr=function(){return t.SeparatorChar+(t.nextIdentifier++).toString()},t.doPostRequest=function(t,e,i,n,s){this.isString(i)||(i=JSON.stringify(i)),this.doRequestRaw(t,e,"POST",i,n,s)},t.doRequest=function(t,e,i,n,s){if(i&&i.length){t+=t.indexOf("?")!==-1?"&":"?";for(var r=0;r0&&(t+="&"),t+=encodeURIComponent(a[0])+"="+encodeURIComponent(a[1])}}this.doRequestRaw(t,e,"GET","",n,s)},t.doRequestRaw=function(t,e,i,n,s,r){var a;if("undefined"==typeof XMLHttpRequest)throw new Error("Cannot create XMLHttpRequest. Please verify if the feature is not disabled in the browser configuration.");a=new XMLHttpRequest,a.onreadystatechange=function(){4===a.readyState&&(200===a.status?s(a.responseText):r(a.responseText))};try{a.open(i,t,!0),a.timeout=e,a.ontimeout=function(){r('{"error": "Request timeout."}')},a.send(n)}catch(t){return void window.setTimeout(function(){return r(t)},1)}},t.openUrl=function(t,e){return window.open(t,e||"_blank")},t.parseData=function(e,i,n){void 0===n&&(n=!1);var s=null,r=null;if(i=i.toLowerCase(),"json"===i||"geojson"===i)if(t.isString(e))try{r=JSON.parse(e)}catch(t){s=n?e:"Failed to parse JSON response: "+t+". Response text: "+e}else r=e;else s="Unsupported data format: "+i;return null==r&&null==s&&(s="NULL response"),s?{error:s}:r},t.numberFormat=function(t,e,i,n){void 0===e&&(e=2),void 0===i&&(i="."),void 0===n&&(n="聽");var s=parseFloat(t);if(isNaN(s))return"鈥�";var r;s<0?(r="-",s=-s):r="";for(var a,o=Math.floor(s),l=s-o,h=i+l.toFixed(e).substr(2);;){if(a=o%1e3,h=a.toFixed(0)+h,!(o>=1e3))break;o=Math.floor(o/1e3),a<10?h="00"+h:a<100&&(h="0"+h),h=n+h}return r+h},t.buildImage=function(t,e,i,n){var s=this,r=new Image,a=function(){return i(r)},o=function(a){e?s.buildImage(t,null,i,n):n(r)};return e&&(r.crossOrigin=e),r.src=t,r.complete?r.width>0?a():setTimeout(a,0):(r.onload=a,r.onerror=o),r},t.sort=function(t,e){e||(e=function(t,e){return t-e});for(var i,n,s=t,r=0|s.length,a=0;a<=r-2;a+=2)i=s[a],n=s[a+1],e(i,n)>0&&(s[a]=n,s[a+1]=i);for(var o=s.slice(0),l=2;l=r)for(var a=c;a<=r-1;a++)o[a]=s[a];else{var p=d,f=Math.min(d+l,r),g=u;for(i=s[c],n=s[d];;)if(e(i,n)<=0){if(o[g]=i,g=g+1|0,c=c+1|0,c===p){for(o[g]=n,g=g+1|0,d=d+1|0;de)){for(;s>0&&t[s-1]===e;)s-=1;return s}n=s}}return i
',s.insertBefore(r,s.firstChild),t.updateResize(r),s.__resizeListener__=a,s.addEventListener("scroll",a,!0)}},t.updateResize=function(t){var e=t.__resizeTriggers__;e&&this.updateResizeTriggers(e)},t.updateResizeTriggers=function(t){var e=t.firstElementChild,i=t.lastElementChild,n=e.firstElementChild;i.scrollLeft=i.scrollWidth,i.scrollTop=i.scrollHeight,n.style.width=e.offsetWidth+1+"px",n.style.height=e.offsetHeight+1+"px",e.scrollLeft=e.scrollWidth,e.scrollTop=e.scrollHeight},t.unlistenResize=function(t){var e=t,i=e.__resizeTriggers__;i?(e.removeEventListener("scroll",e.__resizeListener__,!0),i.parentNode&&i.parentNode.removeChild(i),delete e.__resizeListener__,delete e.__resizeTriggers__):delete t.onresize},t.decodeEntities=function(e){return e.indexOf("&")===-1?e:(t.decodeTextarea||(t.decodeTextarea=document.createElement("textarea")),t.decodeTextarea.innerHTML=e,t.decodeTextarea.value)},t.base64Encode=function(t){if(window.btoa)return window.btoa(t);for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",i="",n=0,s=0;t.charAt(0|s)||(e="=",s%1);i+=e.charAt(63&n>>8-s%1*8)){var r=t.charCodeAt(s+=.75);if(r>255)throw new Error("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");n=n<<8|r}return i},t.compareVersions=function(t,e){for(var i=t.split("."),n=i.length,s=e.length,r=0;ro)return!0;if(a0?s.result(r,n):null},t._previousConsoleMessages={},t.SeparatorChar=String.fromCharCode(63743),t.nextIdentifier=0,t.decodeTextarea=null,t.aggregationCallbacks={sum:{start:0,increment:function(t,e){return t+e},result:function(t,e){return t}},min:{start:1/0,increment:function(t,e){return Math.min(t,e)},result:function(t,e){return t}},max:{start:-(1/0),increment:function(t,e){return Math.max(t,e)},result:function(t,e){return t}},avg:{start:0,increment:function(t,e){return t+e},result:function(t,e){return t/e}},count:{start:0,increment:function(t,e){return 0},result:function(t,e){return e}},first:{start:null,increment:function(t,e){return null!==t&&void 0!==t?t:e},result:function(t,e){return t}},last:{start:null,increment:function(t,e){return null!==e&&void 0!==e?e:t},result:function(t,e){return t}}},t}();if(s.Helpers=u,"undefined"!=typeof window){var d=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame,p=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelRequestAnimationFrame||window.oCancelAnimationFrame;if(!d){var f=0;d=function(t){var e=(new Date).getTime(),i=Math.max(0,16-(e-f)),n=window.setTimeout(function(){return t(e+i)},i);return f=e+i,n},p=window.clearTimeout}p||(p=function(){}),u.requestAnimationFrame=function(t){return d.call(window,t)},u.cancelAnimationFrame=function(t){return p.call(window,t)};var g=(new Date).getTime();"performance"in window==!1?u.performanceNow=function(){return(new Date).getTime()-g}:"now"in window.performance==!1?(performance.timing&&performance.timing.navigationStart&&(g=performance.timing.navigationStart),u.performanceNow=function(){return(new Date).getTime()-g}):u.performanceNow=function(){return window.performance.now()};var m=g-u.performanceNow();u.timeToPerfNow=function(t){return t-m}}var v=function(){function t(){this.id="default",this.url=null,this.urlParameters=[],this.postprocessorFunction=null,this.preloaded=null,this.format="JSON",this.requestTimeout=4e4,this.numberOfParallelRequests=3}return t}();s.SettingsData=v;var y=function(){function t(t,e){this.removed=!1,this.requestScheduled=!1,this.requestsRunning=!1,this.requestCount=0,this.dataSettings=e,this.chart=t,this.settings=t.settings}return t.doRequest=function(t,e,i,n,s){if(e.urlParameters.length){i=i.slice();for(var r=0;r0},t.prototype.addData=function(t){this._dataArrived(null,t)},t.prototype.applyPreloadedData=function(){this.dataSettings.preloaded&&this._dataArrived(null,this.dataSettings.preloaded)},t.prototype.scheduleRequests=function(t){var e=this;void 0===t&&(t=!1),t?this._runRequests():this.requestScheduled||(this.requestScheduled=!0,setTimeout(function(){return e._runRequests()},0))},t.prototype._runRequests=function(){var t=this;if(!this.removed&&!this.requestsRunning){this.requestScheduled=!1;var e;try{for(this.requestsRunning=!0;this.requestCountthis.timeStamp)},t}();s.MouseEvent=b;var C=function(){function t(t,e){this.noClick=!1,this.scrolling=!1,this.ptsIndex=0,this.ptsLength=3,this.ptsMax=72,this.settings=e,this.identifier=t.identifier,this.touch=!1,this.x=t.x,this.y=t.y,this.pageX=t.pageX,this.pageY=t.pageY,this.timeStamp=t.timeStamp,"undefined"!=typeof Int32Array?this.pts=new Int32Array(this.ptsMax):this.pts=new Array(this.ptsMax),this.pts[0]=0|this.x,this.pts[1]=0|this.y,this.pts[2]=0}return t.prototype.moveTo=function(t){var e=this.ptsIndex+this.ptsLength,i=t.timeStamp-this.timeStamp|0,n=this.ptsMax;i===this.pts[e-1]&&(this.ptsLength-=3,e-=3),t.x||t.y?(t.dx=t.x-this.x,t.dy=t.y-this.y,this.x=t.x,this.y=t.y):(t.dx=0,t.dy=0,t.x=this.x,t.y=this.y),e===this.ptsMax&&(e=0),this.pts[e++]=0|this.x,this.pts[e++]=0|this.y,this.pts[e++]=0|i,(this.ptsLength+=3)>n&&(this.ptsLength-=3,n===(this.ptsIndex+=3)&&(this.ptsIndex=0))},t.prototype.getPosAndSpeed=function(t){t.touch=this.touch,t.velocityPointer=this,t.vx=null,t.vy=null},t.prototype.calculatePosAndSpeed=function(t){var e,i,n=this.pts,s=this.ptsMax,r=10*s,a=50,o=(t.timeStamp-this.timeStamp|0)-r;for(e=this.ptsIndex;eo));e+=3);return r=(t.timeStamp-this.timeStamp|0)-n[i+2],e===this.ptsIndex+this.ptsLength||r0);t.currentTarget!==window&&this.capturePointer(t),this.downHappened(e),this.processConsumed(t,e.consumed)},t.prototype.handlePointerMove=function(t){var e=this.buildEvent(t,t.pointerId.toString(),t.timeStamp,t.buttons>0);this.moveHappened(e),this.processConsumed(t,e.consumed,!0)},t.prototype.handlePointerUp=function(t){if(0===t.buttons){var e=this.buildEvent(t,t.pointerId.toString(),t.timeStamp,!1);this.releasePointer(t),this.upHappened(e),this.processConsumed(t,e.consumed)}},t.prototype.handlePointerCancel=function(t){var e=this.buildEvent(t,t.pointerId.toString(),t.timeStamp,!1);this.cancelHappened(e)},t.prototype.handleMouseDown=function(t){if(!(t.timeStamp2*a?(e.swipeSpeed=r,n>0?e.swipeLeft=!0:e.swipeRight=!0):a>2*r&&(e.swipeSpeed=a,s<0?e.swipeUp=!0:e.swipeDown=!0),this.fireEvent(t.EVENT_UP,e),!i.noClick&&e.isWithinDistance(i,this.settings.clickSensitivity,this.settings.doubleClickTimeout)&&this.click_Next(e)}},t.prototype.cancelHappened=function(e){this.downPointers[e.identifier]&&(this.cancelLongPress(),delete this.downPointers[e.identifier],this.fireEvent(t.EVENT_CANCEL,e))},t.prototype.moveHappened=function(e){var i=this.downPointers[e.identifier];e.pressed=void 0!==i&&null!==i,void 0!==i&&null!==i?(this.cancelLongPress(e),i.scrolling=!0,i.moveTo(e),i.getPosAndSpeed(e),this.fireEvent(t.EVENT_DRAG,e),this.click_Cancel(e)):this.click_OnMove(e)||(this.isTargetOkay(e.target)?(this.inPointers[e.identifier]=!0,this.fireEvent(t.EVENT_MOVE,e)):this.pointerLeave(e))},t.prototype.wheelHappened=function(e){this.fireEvent(t.EVENT_WHEEL,e)},t.prototype.pointerLeave=function(e){this.inPointers.hasOwnProperty(e.identifier)&&(this.click_Cancel(e)||this.fireEvent(t.EVENT_LEAVE,e),delete this.inPointers[e.identifier])},t.prototype.click_Next=function(e){var i=this;if(e.isRightMB)return void this.fireEvent(t.EVENT_RCLICK,e);this.settings.scrollIntoView&&this.container.scrollIntoView(); var n;switch(this.clickCounter){case 1:n=t.EVENT_CLICK;break;case 2:n=t.EVENT_DBLCLICK;break;default:case 3:n=t.EVENT_TPLCLICK}var s=null!==this.clickEvent&&this.clickEvent.timeStamp+this.settings.doubleClickTimeout>=e.timeStamp&&this.clickEvent.distance(e)t&&s.tope)return!0}return!1},t}();s.ChartElement=A;var T=function(){function t(t,e,i,n){this.side="top",this.align="fill",this.floating=!1,this.margin=0,this.location="outside",this.packingOrder=void 0,void 0!==t&&(this.side=t),void 0!==e&&(this.align=e),void 0!==i&&(this.margin=i),void 0!==n&&(this.packingOrder=n)}return t}();s.SettingsChartPanel=T;var M=function(){function t(){this.packingOrder=0,this.location="outside",this.side="top",this.align="fill",this.outsideEdge=!1,this.floating=!1,this.desiredWidth=0,this.desiredHeight=0,this.margin=0,this.left=0,this.top=0,this.right=0,this.bottom=0,this.visible=!1,this.enableClipping=!1,this._tempData=null}return t.prototype.pushClip=function(t){this.enableClipping&&s.Graphics.pushClip(t,this.left,this.top,this.right-this.left,this.bottom-this.top)},t.prototype.popClip=function(t){this.enableClipping&&s.Graphics.popClip(t)},t.prototype.computeSize=function(t,e,i,n){return{width:this.desiredWidth,height:this.desiredHeight}},t.prototype.placePanel=function(t,e,i,n){this.bottom=n,this.right=i,this.top=e,this.left=t},t}();s.ChartPanel=M;var k=function(){function t(t){this.framesCount=0,this.shell=t,this.measureFpsIters=0,this.measureFpsT0=0,this.measureFpsIter=0,this.measureFpsCallback=null}return t.prototype.hasPendingRequests=function(){return this.shell.chart.hasPendingRequests()},t.prototype.measureFps=function(t,e){var i=this;this.measureFpsCallback=e,this.measureFpsIters=t;var n=this.shell.settings.advanced.useAnimationFrame;if(n){this.shell.chart.updateSettings({advanced:{useAnimationFrame:!1}});var s=this.measureFpsCallback;this.measureFpsCallback=function(t,e,n){i.shell.chart.updateSettings({advanced:{useAnimationFrame:!0}}),s&&s.call(window,t,e,n)}}return this.measureFpsIter=0,this.measureFpsT0=(new Date).getTime(),this.shell.events.notifySceneChanges({requestPaint:!0}),!0},t.prototype.paintDone=function(){if(this.framesCount+=1,this.measureFpsIters){this.measureFpsIter+=1;var t=(new Date).getTime()-this.measureFpsT0;if(this.measureFpsIter>=this.measureFpsIters&&t>4e3||t>1e4&&this.measureFpsIter>=5){var e=1e3*this.measureFpsIter/Math.max(1e-4,t);this.measureFpsCallback(e,this.measureFpsIter,t),this.measureFpsCallback=null,this.measureFpsIters=0}else this.shell.events.notifySceneChanges({requestPaint:!0})}},t}();s.Profiler=k;var P=function(){function t(){this.subchart=null,this.element=null}return t}(),I=function(){function t(t,e){this.sceneChanges={},this.forceFloating=!1,this._paintSuspended=0,this.pointerState={},this.animationOrder=[],this.updateOrder=[],this.paintOrder=[],this.subcharts=[],this._lastPanelCount=[0,0,0],this.chartBounds=new gt(0,0,1,1),this.chartOuterBounds=new gt(0,0,1,1),this.chartBoundsIsOuter=!0,this.chart=t,this.shell=e,this.scene=t.scene}return t.panelSortCallback=function(t,e){return t.packingOrder-e.packingOrder},t.prototype.addElement=function(t){if(!t)throw new Error("`element` must be defined.");return this.paintOrder.push(t),this.updateOrder.push(t),this.animationOrder.push(t),this.refreshElementOrder(),t},t.prototype.refreshElementOrder=function(){this.animationOrder.sort(function(t,e){return t.animationOrder-e.animationOrder}),this.paintOrder.sort(function(t,e){return t.paintOrder-e.paintOrder}),this.updateOrder.sort(function(t,e){return t.updateOrder-e.updateOrder})},t.prototype.removeElement=function(t){u.removeFromArray(this.paintOrder,t),u.removeFromArray(this.animationOrder,t),u.removeFromArray(this.updateOrder,t)},t.prototype.addSubchart=function(t){this.subcharts.push(t)},t.prototype.removeSubchart=function(t){u.removeFromArray(this.subcharts,t);for(var e in this.pointerState){var i=this.pointerState[e];i.subchart===t&&(i.subchart=null)}},t.prototype.suspendPaint=function(){this._paintSuspended++},t.prototype.resumePaint=function(){this._paintSuspended--,this._paintSuspended<=0&&(this._paintSuspended=0,this.requestPaint())},t.prototype.notifySceneChanges=function(t){if(u.hasProperties(t)){var e=t.settingsChanges;void 0!==e&&e instanceof s.Settings?(this.sceneChanges.settingsChanges=u.extendCopy(this.sceneChanges.settingsChanges||{},e,function(t,e){return"_"===t[0]||e}),delete t.settingsChanges,u.extendDeep(this.sceneChanges,t),t.settingsChanges=e):u.extendDeep(this.sceneChanges,t),this.requestPaint()}},t.prototype.requestPaint=function(){this._paintSuspended<=0&&this.shell.requestPaint()},t.prototype.paintNow=function(t){void 0===t&&(t=!1),this.shell.paintNow(t=!1)},t.prototype.clearSceneChanges=function(t){for(var e in t)delete this.sceneChanges[e]},t.prototype.onMouseEvent=function(t,e){var i=e.name;t.changes={},t.capture=!1;var n,s,r=null,a=null,o=void 0,l=t.identifier,h=this.pointerState[l];h||(h=new P,h.identifier=l,this.pointerState[l]=h);for(var u=0;u=0;d-=1){var p=this.subcharts[d],c=p.events;if(c.chartOuterBounds.containsPoint(t.x,t.y)){if(c.onMouseEvent(t,e),t.consumed||t.hovered||t.capture){a=p,t.capture=!0;break}c.onMouseEvent(t,{ev:x.EVENT_LEAVE,name:"PointerOut"})}}if(!t.capture&&!e.needsCapture)for(var u=0;u-1)){var d=c.events;(d.sceneChanges.bounds||d.chartOuterBounds.overlaps(this.chartOuterBounds))&&d.animateFrame(t)}}for(var u=0;u=n.left&&i>=n.top&&e<=n.right&&i<=n.bottom&&this.settings.url&&(t.cursor="pointer")},e.prototype.onClick=function(t){var e=t.x,i=t.y,n=this.panel,s=this.settings;n.visible&&e>=n.left&&i>=n.top&&e<=n.right&&i<=n.bottom&&s.url&&(u.openUrl(s.url,s.urlTarget),t.consumed=!0)},e.prototype.imageLoaded=function(t){this.chart.updateSize(!0),this.chart.events.notifySceneChanges({settings:!0,settingsChanges:{credits:!0}})},e}(A);s.Credits=F;var N=function(){function t(){}return t.isLight=function(t){return null==t?null:.299*t.R+.587*t.G+.114*t.B>128},t.format=function(t){return null==t?null:"rgba("+(0|t.R)+","+(0|t.G)+","+(0|t.B)+","+t.A.toFixed(3)+")"},t.areEqual=function(t,e){return null==t?null==e:null!=e&&(t.R===e.R&&t.G===e.G&&t.B===e.B&&t.A===e.A)},t.parse=function(t){var e=E.parseCSSColor(t);return null==e&&t&&u.warn("Color value '"+t+"' could not be parsed.",null,!0),e},t.normalize=function(t){return this.format(E.parseCSSColor(t))},t.derive=function(t,e,i){var n="string"==typeof t,s=n?this.parse(t):t,r=255*(e-1),a={R:Math.round(Math.min(255,Math.max(0,s.R+r))),G:Math.round(Math.min(255,Math.max(0,s.G+r))),B:Math.round(Math.min(255,Math.max(0,s.B+r))),A:Math.min(1,s.A*i)};return n?this.format(a):a},t.blend=function(t,e,i,n){void 0===n&&(n=!0);var s,r="string"==typeof t,a=r?this.parse(t):t,o=r?this.parse(e):e;if(n){var l=1-i;s={R:Math.round(o.R*i+a.R*l),G:Math.round(o.G*i+a.G*l),B:Math.round(o.B*i+a.B*l),A:o.A*i+a.A*l}}else s=this._blendSlow(a,o,i);return r?this.format(s):s},t._blendSlow=function(t,e,i){var n=this._rgb2lab(t),s=this._rgb2lab(e),r=1-i,a=Math.round(s.L*i+n.L*r),o=Math.round(s.A*i+n.A*r),l=Math.round(s.B*i+n.B*r),h=this._lab2rgb(a,o,l);return h.R=Math.max(0,Math.min(255,h.R)),h.G=Math.max(0,Math.min(255,h.G)),h.B=Math.max(0,Math.min(255,h.B)),h.A=e.A*i+t.A*r,h},t.colorTone=function(t,e,i){var n=this.parse(t),s=this.derive(n,e,i);return{color:this.format(s),opacity:n.A}},t.copyHue=function(t,e){var i="string"==typeof t,n=i?this.parse(t):t,s=i?this.parse(e):e,r=(n.R+n.G+n.B)/765,a=(s.R+s.G+s.B)/765,o={R:Math.round(n.R/r*a),G:Math.round(n.G/r*a),B:Math.round(n.B/r*a),A:s.A};return i?this.format(o):o},t.inverse=function(t){var e="string"==typeof t,i=e?this.parse(t):t,n={R:255-i.R,G:255-i.G,B:255-i.B,A:i.A};return e?this.format(n):n},t._rgb2xyz=function(t){var e=t.R/255,i=t.G/255,n=t.B/255;return e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92,i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92,n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92,{X:.4124*e+.3576*i+.1805*n,Y:.2126*e+.7152*i+.0722*n,Z:.0193*e+.1192*i+.9505*n}},t._rgb2lab=function(t){if(t._lab)return t._lab;var e=this._rgb2xyz(t),i=e.X/.95047,n=e.Y,s=e.Z/1.08883;return i=i>.008856?Math.pow(i,1/3):7.787*i+16/116,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,s=s>.008856?Math.pow(s,1/3):7.787*s+16/116,t._lab={L:116*n-16,A:500*(i-n),B:200*(n-s)}},t._xyz2rgb=function(t,e,i){var n=3.2406*t+e*-1.5372+i*-.4986,s=t*-.9689+1.8758*e+.0415*i,r=.0557*t+e*-.204+1.057*i;return n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,s=s>.0031308?1.055*Math.pow(s,1/2.4)-.055:12.92*s,r=r>.0031308?1.055*Math.pow(r,1/2.4)-.055:12.92*r,{R:Math.round(255*n),G:Math.round(255*s),B:Math.round(255*r),A:1}},t._lab2rgb=function(t,e,i){var n=(t+16)/116,s=e/500+n,r=n-i/200;n=n>this._lab2rgbConst?Math.pow(n,3):(n-16/116)/7.787,s=s>this._lab2rgbConst?Math.pow(s,3):(s-16/116)/7.787,r=r>this._lab2rgbConst?Math.pow(r,3):(r-16/116)/7.787;var a=this._xyz2rgb(.95047*s,n,1.08883*r);return a._lab={L:t,A:e,B:i},a},t._lab2rgbConst=Math.pow(.008856,1/3),t}();s.Colors=N;var E=function(){function t(){}return t.clamp_css_byte=function(t){return t=Math.round(t),t<0?0:t>255?255:t},t.clamp_css_float=function(t){return t<0?0:t>1?1:t},t.parse_css_int=function(e){return"%"===e[e.length-1]?t.clamp_css_byte(parseFloat(e)/100*255):t.clamp_css_byte(parseInt(e,10))},t.parse_css_float=function(e){return"%"===e[e.length-1]?t.clamp_css_float(parseFloat(e)/100):t.clamp_css_float(parseFloat(e))},t.css_hue_to_rgb=function(t,e,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t},t.parseCSSColor=function(e){if(null==e)return{R:0,G:0,B:0,A:0};var i=e.replace(RegExp(" ","g"),"").toLowerCase();if(i in t.kCSSColorTable){var n=t.kCSSColorTable[i];return{R:n[0],G:n[1],B:n[2],A:n[3]}}if("#"===i[0]){if(4===i.length){var s=parseInt(i.substr(1),16);return s>=0&&s<=4095?{R:(3840&s)>>4|(3840&s)>>8,G:240&s|(240&s)>>4,B:15&s|(15&s)<<4,A:1}:null}if(7===i.length){var s=parseInt(i.substr(1),16);return s>=0&&s<=16777215?{R:(16711680&s)>>16,G:(65280&s)>>8,B:255&s,A:1}:null}return null}var r=i.indexOf("("),a=i.indexOf(")");if(r!==-1&&a+1===i.length){var o=i.substr(0,r),l=i.substr(r+1,a-(r+1)).split(","),h=1;if("rgba"===o){if(4!==l.length)return null;h=t.parse_css_float(l.pop())}if("rgba"===o||"rgb"===o)return 3!==l.length?null:{R:t.parse_css_int(l[0]),G:t.parse_css_int(l[1]),B:t.parse_css_int(l[2]),A:h};if("hsla"===o){if(4!==l.length)return null;h=t.parse_css_float(l.pop())}if("hsla"===o||"hsl"===o){if(3!==l.length)return null;var u=(parseFloat(l[0])%360+360)%360/360,c=t.parse_css_float(l[1]),d=t.parse_css_float(l[2]),p=d<=.5?d*(c+1):d+c-d*c,f=2*d-p;return{R:t.clamp_css_byte(255*t.css_hue_to_rgb(f,p,u+1/3)),G:t.clamp_css_byte(255*t.css_hue_to_rgb(f,p,u)),B:t.clamp_css_byte(255*t.css_hue_to_rgb(f,p,u-1/3)),A:h}}}return null},t.kCSSColorTable={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]},t}(),z=function(){function t(t,e,i){this.isFilling=i,this.lineDash=e,this.g=t,this.beginPath()}return t.prototype.beginPath=function(){this.remaining=this.lineDash[0],this.dashes=[],this.pos=0,this.x0=0,this.y0=0,this.x=0,this.y=0,this.hasPos=!1},t.prototype.moveTo=function(t,e){this.y=e,this.x=t,this.isFilling&&this.dashes.push(0,t,e),this.g.moveTo(t,e),this.x0=t,this.y0=e,this.hasPos=!0},t.prototype.rect=function(t,e,i,n){this.moveTo(t,e),this.lineTo(t+i,n),this.lineTo(t+i,e+n),this.lineTo(t,e+n),this.lineTo(t,e)},t.prototype.lineTo=function(t,e){this.isFilling&&this.g.lineTo(t,e);var i=t-this.x,n=e-this.y,s=this.x,r=this.y;this.x=t,this.y=e;var a=Math.sqrt(i*i+n*n),o=1/a;i*=o,n*=o;for(var l=this.lineDash.length,h=this.pos,u=this.remaining;;){var c=Math.min(a,u);if(s+=i*c,r+=n*c,h%2===0?this.isFilling?this.dashes.push(1,s,r):this.g.lineTo(s,r):this.isFilling?this.dashes.push(0,s,r):this.g.moveTo(s,r),!(a>c)){u-=c;break}h=(h+1)%l,u=this.lineDash[h],a-=c}this.pos=h,this.remaining=u,this.hasPos=!0},t.prototype.arc=function(t,e,i,n,s,r){var a=2*Math.PI,o=Math.min(.6,2/i),l=Math.cos(o),h=Math.sin(o),u=Math.sin(n)*i,c=Math.cos(n)*i,d=Math.sin(s)*i,p=Math.cos(s)*i;if(this.hasPos||(this.moveTo(t+c,e+u),this.hasPos=!0),r){n=0;g--){if(g-1<=0){this.lineTo(t+p,e+d);break}this.lineTo(t+c,e+u);var m=c*l+u*h,v=-c*h+u*l;c=m,u=v}}else{n>s&&(n-=2*Math.PI);for(var f=(s-n)/o,g=f;g>=0;g--){if(g-1<=0){this.lineTo(t+p,e+d);break}this.lineTo(t+c,e+u);var m=c*l-u*h,v=c*h+u*l;c=m,u=v}}},t.prototype.quadraticCurveTo=function(t,e,i,n){this.lineTo(t,e),this.lineTo(i,n)},t.prototype.bezierCurveTo=function(t,e,i,n,s,r){throw new Error("Bezier curves in dashed line context haven't been implemented yet")},t.prototype.closePath=function(){this.lineTo(this.x0,this.y0)},t.prototype.strokeDashes=function(){for(var t=this.dashes,e=0;e1&&"undefined"==typeof t.setLineDash?(i&&!e.fillColor&&(i=!1),new z(t,e.lineDash,i)):t},t.endStroke=function(e,i,n,s){void 0===s&&(s=!1),i instanceof z?(i.isFilling&&(t.fill(e,n),e.beginPath(),i.strokeDashes()),t.strokeWithShadow(e,n)):s?t.paint(e,n):t.stroke(e,n)},t.beginStrokeAndFill=function(e,i){return t.beginStroke(e,i,!0)},t.endStrokeAndFill=function(e,i,n){return t.endStroke(e,i,n,!0)},t.fill=function(t,e){e.fillColor&&(t.fillStyle=e.fillColor,e.shadowColor&&(t.shadowOffsetX=e.shadowOffsetX,t.shadowOffsetY=e.shadowOffsetY,t.shadowBlur=e.shadowBlur,t.shadowColor=e.shadowColor),t.fill(),e.shadowColor&&(t.shadowBlur=0,t.shadowColor="transparent"))},t.paint=function(t,e){e.shadowColor&&(t.shadowOffsetX=e.shadowOffsetX,t.shadowOffsetY=e.shadowOffsetY,t.shadowBlur=e.shadowBlur,t.shadowColor=e.shadowColor),e.fillColor&&(t.fillStyle=e.fillColor,t.fill()),0!==e.lineWidth&&e.lineColor&&(t.lineWidth=e.lineWidth||1,t.strokeStyle=e.lineColor,e.lineDash&&"undefined"!=typeof t.setLineDash?(t.setLineDash(e.lineDash),t.stroke(),t.setLineDash([])):t.stroke()),e.shadowColor&&(t.shadowBlur=0,t.shadowColor="transparent")},t.textStyle=function(t,e){t.__textStyle&&this.resetTextStyle(t);var i=e.fillColor;void 0===i&&(i="#000"),t.fillStyle=i,t.__font=t.font=e.font||null,e.shadowColor&&(t.shadowOffsetX=e.shadowOffsetX,t.shadowOffsetY=e.shadowOffsetY,t.shadowBlur=e.shadowBlur,t.shadowColor=e.shadowColor),e.outlineColor&&(t.strokeStyle=e.outlineColor,t.lineWidth=2*(e.outlineWidth||1),t.lineJoin=e.outlineJoin||"miter",t.miterLimit=2),t.__textStyle=e},t.getTextWidth=function(t,e,i){if(e){var n=e.font;t.__font!==n&&(t.__textStyle=null,t.__font=t.font=n||null)}var s=t.measureText(i).width;return e.outlineColor&&(s+=2*(e.outlineWidth||1)),s},t.drawText=function(t,e,i,n,s){t.__textStyle!==e&&this.textStyle(t,e),null!=i&&i.length&&(e.outlineColor&&t.strokeText(i,n,s),t.fillText(i,n,s))},t.resetTextStyle=function(t){t.__font=null;var e=t.__textStyle;e&&(e.shadowColor&&(t.shadowColor="transparent",t.shadowBlur=0),e.outlineColor&&(t.lineJoin="miter",t.miterLimit=10,t.lineWidth=1),t.__textStyle=null)},t.restore=function(t){this.resetTextStyle(t),t.restore()},t.rectStyle=function(t,e){void 0!==e.lineColor&&(t.strokeStyle=e.lineColor),void 0!==e.fillColor&&(t.fillStyle=e.fillColor),void 0!==e.lineWidth&&(t.lineWidth=e.lineWidth)},t.pushClip=function(t,e,i,n,s){var r=t.context,a=t.scaleX,o=t.scaleY;1===a&&1===o||!window.screen.deviceXDPI?(r.save(),r.beginPath(),r.rect(e,i,n,s),r.clip()):(r.save(),r.setTransform(1,0,0,1,0,0),r.beginPath(),r.rect(e*a|0,i*o|0,n*a|0,s*o|0),r.clip(),r.setTransform(a,0,0,o,0,0))},t.popClip=function(t){this.restore(t.context)},t.arcBetweenTwoPoints=function(t,e,i,n,s,r,a,o){var l=(s+a)/2,h=(r+o)/2,u=o-r,c=s-a,d=u*u+c*c;if(0!==d){var p=Math.sqrt(d);n=Math.min(Math.max(n,p/2),3*p);var f=Math.sqrt(n*n/d-.25),g=l+u*f,m=h+c*f,v=l-u*f,y=h-c*f,S=(g-e)*(g-e)+(m-i)*(m-i),b=(v-e)*(v-e)+(y-i)*(y-i);S>b?(e=v,i=y):(e=g,i=m);var C=Math.atan2(r-i,s-e),x=Math.atan2(o-i,a-e);xMath.PI;t.arc(e,i,n,C,x,w)}},t.strokeMarker=function(e,i,n,s,r){var a=1.41421356237*r;switch(i){case"rect": case"square":e.moveTo(n-r,s-r),e.lineTo(n+r,s-r),e.lineTo(n+r,s+r),e.lineTo(n-r,s+r),e.lineTo(n-r,s-r);break;case"romb":case"rhombus":a=.9*a,e.moveTo(n-a,s),e.lineTo(n,s-a),e.lineTo(n+a,s),e.lineTo(n,s+a),e.lineTo(n-a,s);break;case"triangle":var o=t.SQRT3D6*(3*r);e.moveTo(n-r,s+o),e.lineTo(n+r,s+o),e.lineTo(n,s-o),e.lineTo(n-r,s+o);break;case"triangle2":e.moveTo(n-a,s-a),e.lineTo(n+a,s-a),e.lineTo(n,s+a),e.lineTo(n-a,s-a);break;case"circle":e.moveTo(n+r,s),e.arc(n,s,r,0,2*Math.PI,!1);break;default:throw new Error("Unknown marker shape "+i+". Valid values are `square`, `rhombus`, `triangle`, `triangle2`, `circle`.")}},t.strokeBalloon=function(t,e,i,n,s){n=Math.max(n,2*s);var r=5,a=4,o=(s+2*a)/2,l=e,h=i;t.moveTo(l,h),l+=3,h+=r+1,t.lineTo(l,h),l+=n-a,t.lineTo(l,h),t.arc(l,h+o,o,-Math.PI/2,Math.PI/2),h+=2*o,l-=n-a,t.lineTo(l,h),t.arc(l,h-o,o,.5*Math.PI,1.3*Math.PI),t.closePath()},t.strokeBalloon2=function(t,e,i,n,s){var r=4,a=(s+2*r)/2;n=Math.max(n,2*s)/2-r;var o=e+n,l=i-a;t.moveTo(o,l),t.arc(o,l+a,a,-Math.PI/2,Math.PI/2,!1),l+=2*a,o-=2*n,t.lineTo(o,l),t.arc(o,l-a,a,.5*Math.PI,1.5*Math.PI,!1),t.closePath()},t.applyColorToImage=function(t,e,i){void 0===i&&(i=!0);var n=N.parse(e),s=n.R,r=n.G,a=n.B,o=document.createElement("canvas"),l=o.width=t.width,h=o.height=t.height,u=o.getContext("2d");u.drawImage(t,0,0);var c=u.getImageData(0,0,l,h),d=c.data;if(i)for(var p=0;p<=d.length;p+=4)255===d[p+3]&&(d[p]=d[p]*s>>8,d[p+1]=d[p+1]*r>>8,d[p+2]=d[p+2]*a>>8);else for(var p=0;p<=d.length;p+=4)d[p]=d[p]*s>>8,d[p+1]=d[p+1]*r>>8,d[p+2]=d[p+2]*a>>8;return u.putImageData(c,0,0),o},t.cropImageToCircle=function(t,e){var i=Math.min(t.width,t.height),n=Math.max(t.width,t.height),s=Math.min(n,2*i),r=document.createElement("canvas");r.width=s,r.height=s;var a=r.getContext("2d"),o=t.width,l=t.height;a.fillStyle="rgba(0,0,0,1)",a.beginPath(),a.arc(s/2,s/2,s/2,0,2*-Math.PI,!1),a.fill();var h=a.globalCompositeOperation;if(a.globalCompositeOperation="source-in","crop"===e){var u=Math.min(o,l)/2;a.drawImage(t,o/2-u,l/2-u,2*u,2*u,0,0,s,s)}else if("letterbox"===e){a.fillStyle="black",a.fillRect(0,0,s,s);var c=s/Math.max(o,l);a.drawImage(t,0,0,o,l,s/2-o/2*c,s/2-l/2*c,o*c,l*c)}else if("fit"===e){a.fillStyle="black",a.fillRect(0,0,s,s);var c=s/Math.sqrt(o*o+l*l);a.drawImage(t,0,0,o,l,s/2-o/2*c,s/2-l/2*c,o*c,l*c)}else a.drawImage(t,0,0,o,l,0,0,s,s);return a.globalCompositeOperation=h,r},t.applyShadow=function(t,e){e.shadowColor&&(t.shadowOffsetX=e.shadowOffsetX,t.shadowOffsetY=e.shadowOffsetY,t.shadowBlur=e.shadowBlur,t.shadowColor=e.shadowColor)},t.clearShadow=function(t){t.shadowBlur=0,t.shadowColor="transparent"},t.drawImageInSquare=function(t,e,i,n,s,r,a,o,l){var h=l/Math.max(s,r),u=s*h,c=r*h;this.drawImageHighQuality(t,e,i,n,s,r,a-u,o-c,2*u,2*c)},t.drawImageHighQuality=function(t,e,i,n,s,r,a,o,l,h){void 0===a&&(a=i,o=n,l=s,h=r,s=e.width,r=e.height,i=0,n=0);var u=t.__scaleX||1,c=t.__scaleY||1;if(!(h<1/c||l<1/u)){for(var d=s,p=r,f=e,g=1,m="__size:"+i+"/"+n+"/"+s+"/"+r+"/";d>=l*u*2&&p>=h*c*2;){var v=Math.round(d/2),y=Math.round(p/2);g/=2;var S=m+g,b=e[S];if(!b){b=e[S]=document.createElement("canvas"),b.width=v,b.height=y;var C=b.getContext("2d");C.drawImage(f,i,n,d,p,0,0,v,y)}i=0,n=0,f=b,p=y,d=v}t.drawImage(f,i,n,0|d,0|p,a,o,l,h)}},t.getTextHeight=function(e,i){var n=t._heightCache;if(n.hasOwnProperty(i))return n[i];var r=t._heightElem;if(!r){var a=document.createElement("div");a.className="DVSL-font-height",t._heightElem=r=document.createElement("div"),r.appendChild(document.createTextNode("Mg9!")), a.appendChild(r),document.body.appendChild(a)}r.style.font=i;var o=r.getBoundingClientRect();return o.top>=0&&o.left>=0?(s.Helpers.error("getTextHeight called before CSS loaded"),o.height):n[i]=o.height},t.SQRT3D6=Math.sqrt(3)/6,t._heightElem=null,t._heightCache={},t}();s.Graphics=O;var H=function(){function t(){this.enabled=!0,this.enabledOnExport=!0,this.align="center",this.margin=25,this.style={font:"20px Arial",fillColor:"#000"},this.text=""}return t}();s.SettingsTitle=H;var _=function(t){function e(e){var i=this;t.call(this),this.lineSpacing=0,this.animationOrder=2e3,this.paintOrder=55,this.updateOrder=500,this.chart=e,this.scene=e.scene,this.settings=this.scene.settings.title,this.panel=new M,this.panel.packingOrder=10,this.panel.side="top",this.panel.outsideEdge=!0,this.panel.align="fill",this.panel.visible=!1,this.panel.computeSize=function(t,e,n){return i.computePanelSize(t,e,n)},this.lines=null}return n(e,t),e.prototype.onSceneChange=function(t){var e=t.changes;e.settings&&e.settingsChanges.title&&(e.bounds=!0)},e.prototype.getPanels=function(t){var e=this.settings;return this.panel.visible=!!e.text&&(t?e.enabledOnExport:e.enabled),this.panel.visible?(this.panel.margin=e.margin,t&&!e.enabled?this.panel.location="external":this.panel.location="outside",[this.panel]):[]},e.prototype.computePanelSize=function(t,e,i){if(!this.chart.assetsLoaded)return{width:0,height:0};this.lines=[];var n=this.settings.text,s=this.settings.style;i.save();var r=O.getTextWidth(i,s,n),a=O.getTextHeight(i,s.font);if(this.lineSpacing=1.15*a,r>t){for(var o=0,l=n.split(" "),h=l[0],u=O.getTextWidth(i,s,h),c=1;c<=l.length-1;c++){var d=h+" "+l[c],p=O.getTextWidth(i,s,d);p<=t?(h=d,u=p):(this.lines.push(h),r=Math.max(r,u),h=l[c],u=O.getTextWidth(i,s,h))}this.lines.push(h),r=Math.max(o,u)}else this.lines.push(n);return O.restore(i),a=(this.lines.length-1)*this.lineSpacing+a,{width:r,height:a}},e.prototype.paintScene=function(t){if(this.panel.visible&&this.lines){var e=this.settings,i=t.context,n=this.panel.left,s=this.panel.right,r=this.panel.top,a=e.style;i.textBaseline="top";var o;"left"===e.align?(i.textAlign="start",o=n):"right"===e.align?(i.textAlign="end",o=s):(i.textAlign="center",o=(n+s)/2);for(var l=0;l3*e)for(var i in this.cache)this.frameLabels[i]||delete this.cache[i];this.frameLabels={}}},t.prototype.measure=function(t,e){var i=e.needMeasure();if(i===!0){var n=e.style,s=(new U).totalPadding(n),r=0,a=0;if(e.text){var o=this.measureText(t,e),l=o.w,h=o.h;a=Math.max(a,h),r+=l}else e.rows={subLines:[],rowWidths:[]};if(n.image){var u=n.imageSlicing;if(u)r+=u[2],a=Math.max(a,u[3]);else{var c=this.assetsLoader.getAssetImage(n.image,null);c&&c.width?(r+=c.width,a=Math.max(a,c.height)):e._pendingImage=!0}}if(0===r&&(r=10,a=10),r+=2*s,a+=2*s,n.borderRadius>0&&e.text){var d=Math.min(n.borderRadius,a/2);r+=.45*d,n.image||(r+=.45*d)}e.hwidth=r/2,e.hheight=a/2,e.measureComplete(!1)}else if(null===i)throw new Error("Label.needMeasure assert.")},t.prototype.measureText=function(t,e){var i,n,s=e.style,r=s.aspectRatio,a=s.maxWidth,o=new U,l=o.styleTagParser(t,e);if((r>0||a>0)&&l.maxLines>1){r||(r=1e9),a||(a=1e9);var h=function(t){return{x:0,y:0,dx:0,dy:0,width:Math.min(a,t*(r+.2))}};o.fitLabelInRect(t,e,h,!1),i=2*e.hwidth,n=2*e.hheight}else{for(var u=l.words,c=l.breaks,d=0;d=r){var d=e+s-r;c.moveTo(d,i-r),c.arc(d,i,r,-Math.PI/2,Math.PI/2,!1),d=e-s+r,c.lineTo(d,i+r),c.arc(d,i,r,Math.PI/2,-Math.PI/2,!1),c.closePath()}else h>0?(c.moveTo(e-s+h,i-r),c.lineTo(e+s-h,i-r),c.arc(e+s-h,i-r+h,h,-Math.PI/2,0,!1),c.lineTo(e+s,i+r-h),c.arc(e+s-h,i+r-h,h,0,+Math.PI/2,!1),c.lineTo(e-s+h,i+r),c.arc(e-s+h,i+r-h,h,+Math.PI/2,Math.PI,!1),c.lineTo(e-s,i-r+h),c.arc(e-s+h,i-r+h,h,Math.PI,Math.PI+Math.PI/2,!1)):(c.moveTo(e-s,i-r),c.lineTo(e+s,i-r),c.lineTo(e+s,i+r),c.lineTo(e-s,i+r),c.closePath());O.endStrokeAndFill(t,c,o),s+=u,r+=u}var p=a.image;s-=l,r-=l;var f=e-s,g=e+s;if(p){var m=this.assetsLoader.getAssetImage(p);if(m){var v=a.imageSlicing;v?(O.drawImageHighQuality(t,m,v[0],v[1],v[2],v[3],e-s,i-r,v[2],v[3]),f+=v[2]):(t.drawImage(m,e-s,i-r),f+=m.width)}}var y=n.rows.subLines,S=n.rows.rowWidths,b=S.length;if(y.length>0){var C=n.lineHeight*(1+(a.lineSpacing||0)),x=a.align,w=void 0,L=void 0;t.textBaseline="bottom";var A=i-(b+1)*C/2+.58*n.lineHeight;"left"===x?(L=f,p||(L+=.45*h),w="start"):"right"===x?(L=g-.45*h,w="end"):(L=(f+g)/2,w="center");var T=a.textStyle,M=-1,k=0;t.textAlign=w;var P=void 0;O.textStyle(t,T);for(var I=T.font,D=0;Dm){v=P,m=M,c=L.dx,d=L.dy,y=L.x,S=L.y,b=A,C=0;for(var I=0;I=1)break}if(v){if(!e.userPlaced){var F=e.style.align,N=void 0;N="left"===F?(C-b)/2:"right"===F?(b-C)/2:0,y+=c*N,S+=d*N}n&&(e.x=y,e.y=S),e.rows=this.stringsByFont(p,v),e.hheight=(u+h*v.length)/2+a,e.lineHeight=o,e.lineHeightM=h,e.hwidth=C/2+a,e.visible=!0,e.measureComplete(!0),s.borderRadius>0&&(e.hwidth+=.45*Math.min(s.borderRadius,e.hheight))}else e.rows={subLines:[],rowWidths:[]},e.visible=!1;return m},t.prototype.styleTagParser=function(t,e){return e.needTextParsing()&&(e._textCache=this.styleTagParser2(t,e.text,e.style.textStyle)),e._textCache},t.prototype.styleTagParser2=function(e,i,n){var s=n.font;s?(e.font=s,s=e.font):s="11px Arial";var r=t._spaceWidth;r[s]||(r[s]=O.getTextWidth(e,{font:s}," "));var a=s,o=0,l=0,h=!0,c=i;i=null==i?"":""+i;var d=0,p=0,f=[],g=[],m=-1;f.push({word:"",width:0,font:a,spaceWidth:0});var v={word:"",width:0,font:a,spaceWidth:0};f.push(v);for(var y=i.length,S=0===y?-1:i.charCodeAt(0);dy){S=-1;break}var b=d,C=i.charCodeAt(++d),x=47===C?-1:1;x<0&&(C=i.charCodeAt(++d));var w=i.charCodeAt(++d),L=-1;if(98===C||66===C?82===w||114===w?(w=++d===y?-1:i.charCodeAt(d),L=2):L=0:73!==C&&105!==C||(L=1),L>-1&&62===w){S=++d===y?-1:i.charCodeAt(d),p=d;var A=!1,T=v.word||v.spaceWidth>0;if(2===L)m===f.length-1&&(T=!0),g.push(m=f.length-(T?0:1)),h=!0,A=!0;else{1===L?l=Math.max(0,l+x):o=Math.max(0,o+x);var M=(l?"italic ":"")+(o?"bold ":"")+s;M!==a&&(A=!0,a=M,r[a]||(r[a]=O.getTextWidth(e,{font:a}," ")))}A&&(T?(v={word:"",width:0,font:a,spaceWidth:0},f.push(v)):v.font=a)}else d=b,S=-1;break;default:for(var k=!1;32!==S&&60!==S&&++d0||v.font!==a?(v={word:P,width:0,font:a,spaceWidth:0},f.push(v)):v.word+=P,h=!1,p=d}for(var I=0;I=0;I--){var D=f[I];if(D.width>0)break;N--}return{sourceText:c,sourceFont:n.font,breaks:g,maxLines:N,words:f}},t.prototype.stringsByFont=function(t,e){for(var i=t[0].font,n=e.slice(0),s=[],r=[],a=0,o=0,l="",h=0,u=0,c=0;c<=t.length-1;c++){var d=t[c];u=d.spaceWidth;var p=c===n[0];d.font!==i&&(o&&s.push({text:l,width:o,font:i,row:h}),i=d.font,l="",o=0),o+=d.width,l+=d.word,a+=d.width+d.spaceWidth,p&&(s.push({text:l,width:o,font:i,row:h}),r.push(a-d.spaceWidth),l="",h++,o=a=0,n.shift()),p||d.spaceWidth&&(o+=d.spaceWidth,l+=" ")}return l&&(s.push({text:l,width:o,font:i,row:h}),r.push(a-u)),{subLines:s,rowWidths:r}},t.prototype.fitLabelInLines=function(t,e,i,n,s,r,a){var o=e.style,l=o.margin||0,h=this.totalPadding(o),u=O.getTextHeight(t,o.textStyle.font),c=o.lineSpacing||0,d=u*(c+1),p=-u*c;this.styleTagParser(t,e);var f=e._textCache.words,g=e._textCache.breaks,m=e._textCache.maxLines,v=-(1/0),y=null,S=null,b=null,C=0,x=[],w=[];w.push(a(i,n));for(var L=1;L<=g.length-1;L++){var A=p+d*L,T=void 0;T=L%2===1?x:w;var M=a(i,n-A/2-l);T.unshift([M[0]-l,M[1]-l]),M=a(i,n+A/2+l),T.push([M[0]-l,M[1]-l])}for(var L=g.length;L<=m;L++){var k,A=p+d*L;k=L%2===1?x:w;var M=a(i,n-A/2-l);k.unshift([M[0]-l,M[1]-l]),M=a(i,n+A/2+l),k.push([M[0]-l,M[1]-l]);var P=function(t){return Math.min(k[t][0]+k[t][1],k[t+1][0]+k[t+1][1])},I=this.splitWordsToLines(f,g,L,P),D=I.prop,F=I.actualWidthForLines,N=I.positions;if(D>v&&(C=n-A/2,y=N,v=D,S=F,b=k.slice(0),N.length+1>k.length))throw new Error("Internal error - fitLabelInLines");if(D>=1)break}if(y){var E=0,z=0,H=void 0,_=void 0;if("left"===s){for(var R=1e30,B=0;B<=y.length;B++)R=Math.min(b[B][0]);var U=-R;H=U,_=U;for(var B=0;B<=y.length-1;B++){var V=S[B],G=Math.min(b[B][1],b[B+1][1]);_=Math.max(U+V),z=Math.max(z,V-(G-U))}}else if("right"===s){for(var G=1e30,B=0;B<=y.length;B++)G=Math.min(b[B][1]);var W=G;H=W,_=W;for(var B=0;B<=y.length-1;B++){var V=S[B];H=Math.min(W-V),E=Math.max(E,V-(G+W))}}else if("center"===s){for(var R=1e30,G=1e30,B=0;B<=y.length-1;B++){var V=S[B]/2;R=Math.min(b[B][0]-V,Math.min(b[B+1][0]-V,R)),G=Math.min(b[B][1]-V,Math.min(b[B+1][1]-V,G))}var j=void 0;j=R>0&&G>0?0:R>-G?G:G>-R?-R:(G-R)/2,H=j,_=j;for(var B=0;B<=y.length-1;B++){var V=S[B];R=Math.min(b[B][0],b[B+1][0]),G=Math.min(b[B][1],b[B+1][1]),H=Math.min(H,j-V/2),_=Math.max(_,j+V/2),E=Math.max(E,V/2-R-j),z=Math.max(z,V/2-G+j)}}if("left"===r&&E>0)H+=E,_+=E;else if("right"===r&&z>0)H-=z,_-=z;else if("center"===r){var Y=(E-z)/2;H+=Y,_+=Y}e.rows=this.stringsByFont(f,y),e.hwidth=(_-H)/2+h,e.hheight=(p+d*y.length)/2+h,e.lineHeight=u,e.lineHeightM=d,e.visible=!0,e.measureComplete(!0),o.borderRadius>0&&(e.hwidth+=.45*Math.min(o.borderRadius,e.hheight)),e.userPlaced||(e.x=i+(H+_)/2,e.y=C+e.hheight)}else e.rows={subLines:[],rowWidths:[]},e.visible=!1;return v},t.prototype.splitWordsToLines=function(t,e,i,n){for(var s=100,r=[],a=[],o=0,l=e[o],h=i-e.length,u=t[0],c=0,d=n(0),p=0,f=1;f<=t.length-1;f++){var g=t[f],m=c+(u.spaceWidth+g.width);l===f||u.spaceWidth>0&&m>d&&h>0?(a.push(f-1),r.push(c),s=Math.min(s,d/c),c=g.width,p+=1,d=n(p),l!==f?h-=1:(o+=1,l=e[o])):c=m,u=g}return a.push(t.length),r.push(c),s=Math.min(s,d/c),{prop:s,actualWidthForLines:r,positions:a}},t.prototype.getFormatedText=function(t,e,i,n,s){var r,a=e.style,o=a.textStyle,l=O.getTextHeight(t,a.textStyle.font),h=a.lineSpacing||0,u=l*(h+1),c=a.margin||0,d=this.totalPadding(a),p=!a.angle||0===a.angle,f=90===a.angle||a.angle===-90,g=p||f;if(f)r=n-2*c,n=i-c;else{n-=c;var m=s(l/2+d,i-2*c,n-c);r=m.width}var v=this.getIncludingPart(t,o,e.text,"",r,0),y=e.text,S=null,b=!1,C=O.getTextWidth(t,e.style.textStyle,"鈥�");if(g)for(var x=Math.floor(n/l)-2,w=0;w<=x;){if(y=y.replace(/\s+$/g,""),v=this.getIncludingPart(t,o,y,"",r,0),v===y){this.addLine(t,e,v,w,b);break}if(b=!0,v.length<=1){v=y.slice(0,1),b=e.text!==v,this.addLine(t,e,v,w,b),S=e.rows.rowWidths[0];break}if(w===x)v=this.getIncludingPart(t,o,y,"",r-C,0);else{var L=v.lastIndexOf(" "),A=void 0;if(L===-1){A=y.indexOf(" ");var T=A===-1?y:y.substring(0,A);b=v!==T,b&&(v=this.getIncludingPart(t,o,y,"",r-C,0).replace(/\s+$/g,""),A=y.indexOf(" "),T=A===-1?y:y.substring(0,A)),y=y.substr(v.length),A=y.indexOf(" "),y=A===-1?"":y.substr(A+1)}else v=v.substr(0,L),y=y.substr(L+1),b=!1}if(v.length<=1){if(0!==w)break;v=e.text.slice(0,1)}if(this.addLine(t,e,v,w,b),""===y)break;y=y.trim(),b=!1,w++}else b=v!==y,b&&(v=this.getIncludingPart(t,o,y,"",r-C,0).replace(/\s+$/g,"")),this.addLine(t,e,v,0,b);e.rows||this.addLine(t,e,"",0,!1);var M=(u*e.rows.subLines.length-l*h)/2,k=0;if("left"===a.align||"right"===a.align){var P=Math.max.apply(Math,e.rows.rowWidths),I=(r-P)/2;k="right"===a.align?I:-I}a.angle&&(S=Math.max.apply(Math,e.rows.rowWidths));var D=s(M,S||i,n);e.x=D.x+D.dx*k,e.y=c+D.y,e.hheight=M+d,e.hwidth=Math.max.apply(Math,e.rows.rowWidths)/2+d,e.lineHeight=l,e.lineHeightM=u,e.visible=!0,e.measureComplete(!0),a.borderRadius>0&&(e.hwidth+=.45*Math.min(a.borderRadius,e.hheight))},t.prototype.addLine=function(t,e,i,n,s){s&&(i=i.replace(/\s+$/g,"")+"鈥�");var r=e.style.textStyle,a=O.getTextWidth(t,r,i);null==e.rows&&(e.rows={rowWidths:[],subLines:[]}),e.rows.rowWidths.push(a),e.rows.subLines.push({font:r.font,row:n,text:i,width:a})},t.prototype.getIncludingPart=function(t,e,i,n,s,r){if(i.length<=1){var a=O.getTextWidth(t,e,i);return r+a<=s&&(n+=i),n}var o=i.slice(0,i.length/2),l=O.getTextWidth(t,e,o);if(r+l<=s&&(n+=o),r+l===s)return n;if(r+l0},t.prototype.isEnabled=function(){return this.enabled},t}();s.LegendEntry=V;var G=function(){function t(){this.enabled=!1,this.width=null,this.height=null,this.numberOfRows=null,this.numberOfColumns=null,this.margin=1,this.padding=5,this.maxLineSymbols=15,this.lineSpacing=.2,this.text={font:"12px Arial",fillColor:"#000"},this.marker=new q,this.equalizeRowsColumns=!0,this.panel=new Y("left","fill",1),this.advanced=new j,this.interaction=new W}return t}();s.SettingsLegend=G;var W=function(){function t(){this.click=!0}return t}();s.SettingsLegendInteraction=W;var j=function(){function t(){this.selectedBackground="rgba(208,233,255,0.3)",this.selectedBorder="rgba(208,233,255,0.3)"}return t}();s.SettingsLegendAdvanced=j;var Y=function(t){function e(e,i,n,s,r){t.call(this,e,i,n,s),this.padding=0,void 0!==r&&(this.padding=r)}return n(e,t),e}(s.SettingsChartPanel);s.SettingsLegendPanel=Y;var q=function(){function t(){this.size=20,this.alignment="left",this.lineColor="#fff"}return t}();s.SettingsLegendMarker=q;var Z=function(t){function e(e){var i=this;t.call(this),this.animationOrder=300,this.entries=[],this.hoverPointers={},this.hoverOrder=[],this.entryWidth=0,this.textHeight=0,this.columns=null,this.rows=null,this.contentWidth=0,this.contentHeight=0,this.markerSize=0,this.drawingEntries=0,this.lastInsensitive=!1,this.needsMeasure=!1,this.chart=e,this.settings=e.settings.legend,this.panel=new M,this.panel.packingOrder=50,this.panel.location="outside",this.panel.computeSize=function(t,e,n,s){return i.computePanelSize(t,e,n,s)},u.extendDeep(this.panel,this.settings.panel),this.orientation="left"===this.settings.panel.side||"right"===this.settings.panel.side?"vertical":"horizontal"}return n(e,t),e.prototype.onSceneChange=function(t){var e=t.changes;e.settings&&e.settingsChanges.legend&&(e.bounds=!0,this.settings.enabled||(this.entries=[]),u.extendDeep(this.panel,this.settings.panel))},e.prototype.getPanels=function(){return this.settings.enabled?[this.panel]:[]},e.prototype.computePanelSize=function(t,e,i,n){if(this.needsMeasure=!1,0===this.entries.length||!this.chart.assetsLoaded)return{width:0,height:0};for(var s=O.getTextWidth(i,this.settings.text,"M")*this.settings.maxLineSymbols,r=0,a=this.settings.numberOfRows,o=this.settings.numberOfColumns,l=2*(this.settings.margin+this.settings.padding),h=2*(this.settings.panel.margin+this.settings.panel.padding),u=0;u0?Math.min(t,Math.max(this.settings.width,this.entryWidth)+h):t)-h,m=(this.settings.height>0?Math.min(e,Math.max(this.settings.height,this.entryHeight)+h):e)-h;if("vertical"===this.orientation){this.rows=Math.floor(m/this.entryHeight);var v=Math.min(Math.ceil(this.entries.length/this.rows),Math.max(1,Math.floor(g/this.entryWidth)));this.columns=o>0?Math.min(o,v):v,this.drawingEntries=Math.min(Math.floor(m/this.entryHeight)*this.columns,this.entries.length),f=this.columns*this.entryWidth,this.drawingEntries>this.rows?(this.settings.equalizeRowsColumns&&(this.rows=Math.ceil(this.drawingEntries/this.columns)),p=this.rows*this.entryHeight):p=this.drawingEntries*this.entryHeight}if("horizontal"===this.orientation){this.columns=Math.floor(g/this.entryWidth);var y=Math.min(Math.ceil(this.entries.length/this.columns),Math.max(1,Math.floor(m/this.entryHeight)));this.rows=a>0?Math.min(a,y):y,this.drawingEntries=Math.min(Math.floor(g/this.entryWidth)*this.rows,this.entries.length),p=this.rows*this.entryHeight,this.drawingEntries>this.columns?(this.settings.equalizeRowsColumns&&(this.columns=Math.ceil(this.drawingEntries/this.rows)),f=this.columns*this.entryWidth):f=this.drawingEntries*this.entryWidth}if(f<=0||p<=0)return{width:0,height:0};this.contentHeight=p,this.contentWidth=f;var S=this.settings.panel.padding;return this.resetHovers(),{width:f+2*S,height:p+2*S}},e.prototype.paintScene=function(t){if(!(this.needsMeasure||!this.settings.enabled||this.entries.length<1||this.drawingEntries<1)){this.lastInsensitive=!1;for(var e=t.context,i=t.labelRenderer,n=this.panel.top,r=this.panel.left,a=this.settings.margin,o=this.settings.padding,l=this.settings.panel.padding,h=0,u=0,c=0;cthis.markerSize/2?0:this.markerSize/2-this.textHeight/2,b=f+o+this.markerSize/2,C=f+S+o+m.hheight;if(this.drawingEntriesn+this.contentWidth||ei+this.contentHeight;if(s)return null;var r,a,o="vertical"===this.orientation?Math.abs(this.contentHeight/this.entryHeight):Math.abs(this.contentWidth/this.entryWidth);"vertical"===this.orientation?(r=Math.floor((t-n)/this.entryWidth),a=Math.floor((e-i)/this.entryHeight)):(r=Math.floor((e-i)/this.entryHeight),a=Math.floor((t-n)/this.entryWidth));var l=Math.floor(o*r+a);return l>this.drawingEntries-1?null:this.lastInsensitive&&l===this.drawingEntries-1?null:this.entries[l]},e.prototype.rect=function(t,e,i,n,s,r,a){t.beginPath(),t.rect(e,i,r,a),t.fillStyle=s,t.fill(),t.lineWidth=1,t.strokeStyle=n,t.stroke()},e.prototype.resetEntries=function(t){this.entries=t,this.needsMeasure=!0},e.prototype.getLastHoveredEntry=function(){return this.hoverOrder.length<1?null:this.hoverOrder[this.hoverOrder.length-1].entry},e.prototype.resetHovers=function(){for(var t=this.hoverOrder.length-1;t>=0;t--){var e=this.hoverOrder[t],i=this.findItemAt(e.lastX,e.lastY);e.entry!==i&&(i?(this.itemUnhovered(null,e.entry),e.entry=i,this.itemHovered(null,i)):(this.itemUnhovered(null,e.entry),delete this.hoverPointers[e.id],this.hoverOrder.splice(t,1)))}},e.prototype.pointerHoverIn=function(t){var e=this.hoverPointers[t.identifier],i=this.findItemAt(t.x,t.y);return i?(this.settings.interaction.click&&(t.cursor="pointer"),void(e?(e.lastX=t.x,e.lastY=t.y,e.entry!==i&&(this.itemUnhovered(t,e.entry),e.entry=i,this.hoverOrder.splice(this.hoverOrder.indexOf(e),1),this.hoverOrder.push(e),this.itemHovered(t,i))):(e={id:t.identifier,lastX:t.x,lastY:t.y,entry:i},this.hoverPointers[t.identifier]=e,this.hoverOrder.push(e),this.itemHovered(t,i)))):void(e&&(this.itemUnhovered(t,e.entry),delete this.hoverPointers[t.identifier],this.hoverOrder.splice(this.hoverOrder.indexOf(e),1)))},e.prototype.pointerHoverOut=function(t){var e=this.hoverPointers[t.identifier];e&&(this.itemUnhovered(t,e.entry),delete this.hoverPointers[t.identifier],this.hoverOrder.splice(this.hoverOrder.indexOf(e),1))},e.prototype.itemHovered=function(t,e){e.hoverCount++,1===e.hoverCount&&this.chart.events.notifySceneChanges({hover:!0})},e.prototype.itemUnhovered=function(t,e){e.hoverCount--,0===e.hoverCount&&this.chart.events.notifySceneChanges({hover:!0})},e.prototype.itemClicked=function(t,e){if(this.chart.events.requestPaint(),this.chart.notifyChartUpdate("user",!0),t.consumed=!0,t.preventDefault(),null==e.groupId||!e.enabled)return void(e.enabled=!e.enabled);var i=this.entries.filter(function(t){return t.groupId===e.groupId});if(i.length<2)return void(e.enabled=!e.enabled);for(var n=!1,s=!1,r=0;rt.x||a>t.y||l0&&this.contentWidthWithLabels>t;n!==this.hideLabels&&(this.hideLabels=n,this.toolbar.rebuildItems())}return this.vertical?{width:Math.max(this.leftPanel.offsetWidth,this.rightPanel.offsetWidth),height:0}:{width:0,height:Math.max(this.leftPanel.offsetHeight,this.rightPanel.offsetHeight)}},e.prototype.placePanel=function(t,e,i,n){var s=this.leftPanel,r=this.rightPanel,a=s.style,o=r.style,l="px",h=this.toolbar.scene,u=h.chartHeight,c=h.chartWidth;if(this.vertical)a.top=e+l,o.bottom=u-n+l,"left"===this.side?(a.left=t+l,o.left=t+l):(a.right=c-i+l,o.right=c-i+l);else{a.left=t+l,o.right=c-i+l;var d="top"===this.side;if(d?(a.top=e+l,o.top=e+l):(a.bottom=u-n+l,o.bottom=u-n+l),this.hideLabels){var p=s.offsetLeft+s.offsetWidth;o.marginLeft=p+"px",r.offsetLeft0&&(a.visibility="visible"),r.offsetWidth>0&&(o.visibility="visible")},e.prototype.remove=function(){this.container.removeChild(this.leftPanel),this.container.removeChild(this.rightPanel)},e}(M);s.ToolbarPanel=$;var tt=function(){function t(){this.enabled=!0,this.fixedAspect=!1,this.visibilityDistance=45,this.grabDistance=10}return t}();s.SettingsResizer=tt;var et=function(t){function e(e){t.call(this),this.animationOrder=2e3,this.paintOrder=65,this.updateOrder=300,this.oh=0,this.sy=0,this.barVisible=!1,this.resizing=!1,this.aspect=null,this.chart=e,this.scene=this.chart.scene,this.options=this.scene.settings.interaction.resizing,this.resizerBar=s.Helpers.createDom("div","DVSL-resizer",null,this.chart.shell.interactiveContainer)}return n(e,t),e.prototype.onSceneChange=function(t){this.options.enabled||this.hideUI()},e.prototype.doAnimations=function(t){t.changes.bounds&&this.resizerBar&&(this.resizerBar.style.width=this.scene.chartWidth+"px")},e.prototype.onPointerOut=function(t){this.options.enabled&&this.hideUI()},e.prototype.onPointerMove=function(t){if(this.options.enabled){var e=this.scene.chartHeight-t.y;ei?(this.x1=t,this.x0=i):(this.x1=i,this.x0=t),e!==1/0&&e>n?(this.y1=e,this.y0=n):(this.y1=n,this.y0=e)}return t.createEmpty=function(){return new t(1/0,1/0,-(1/0),-(1/0))},t.prototype.isEmpty=function(){return this.x0>=this.x1||this.y0>=this.y1},t.prototype.clone=function(){return new t(this.x0,this.y0,this.x1,this.y1)},t.prototype.w=function(){return this.x1-this.x0},t.prototype.h=function(){return this.y1-this.y0},t.prototype.equals=function(t){return this.x0===t.x0&&this.x1===t.x1&&this.y0===t.y0&&this.y1===t.y1},t.prototype.inflate=function(t){var e=(this.x0+this.x1)/2,i=(this.y0+this.y1)/2;return this.x0=(this.x0-e)*t+e,this.x1=(this.x1-e)*t+e,this.y0=(this.y0-i)*t+i,this.y1=(this.y1-i)*t+i,this},t.prototype.clip=function(t){return this.x0=Math.max(this.x0,t.x0),this.x1=Math.min(this.x1,t.x1),this.y0=Math.max(this.y0,t.y0),this.y1=Math.min(this.y1,t.y1),this},t.prototype.isInside=function(t){return this.x0>=t.x0&&this.x1<=t.x1&&this.y0>=t.y0&&this.y1<=t.y1},t.prototype.isOutside=function(t){return this.x0>t.x1||this.x1t.y1||this.y1this.x0&&ethis.y0},t.prototype.intersectsSegment=function(t,e,i,n){return null!=s.Geometry.clipSegmentToRect(t,e,i-t,n-e,this.x0,this.y0,this.x1,this.y1)},t.prototype.area=function(){return(this.x1-this.x0)*(this.y1-this.y0)},t.prototype.toString=function(){return this.x0+","+this.y0+", "+this.x1+", "+this.y1},t.prototype.addPoint=function(t,e){return this.x0=Math.min(this.x0,t),this.x1=Math.max(this.x1,t),this.y0=Math.min(this.y0,e),this.y1=Math.max(this.y1,e),this},t.prototype.addBounds=function(t,e,i,n){return this.x0=Math.min(this.x0,t),this.x1=Math.max(this.x1,i),this.y0=Math.min(this.y0,e),this.y1=Math.max(this.y1,n),this},t.prototype.addRect=function(t){return this.x0=Math.min(this.x0,t.x0),this.x1=Math.max(this.x1,t.x1),this.y0=Math.min(this.y0,t.y0),this.y1=Math.max(this.y1,t.y1),this},t.prototype.moveBy=function(t,e){return this.x0+=t,this.x1+=t,this.y0+=e,this.y1+=e,this},t.prototype.containsPoint=function(t,e){return t>=this.x0&&t=this.y0&&et.x0&&this.y0t.y0},t}();s.Rect=gt;var mt=function(){function t(t,e){this.msg=t,this.pri=e}return t}(),vt=function(){function t(){this.settings=null,this.assetsLoader=null,this.mainData=null,this.mainDataEnabled=!0,this.chartLeft=0,this.chartTop=0,this.chartWidth=1,this.chartHeight=1,this.x0=0,this.y0=0,this.height=0,this.width=0,this.leftMargin=0,this.rightMargin=0,this.topMargin=0,this.bottomMargin=0,this.loading=!0,this.messages={},this.backStack=[]}return t.prototype.setMessage=function(t,e,i){void 0===i&&(i=0);var n;return e?(n=!this.messages[t]||this.messages[t].msg!==e||this.messages[t].pri!==i,this.messages[t]=new mt(e,i)):(n=this.messages.hasOwnProperty(t),delete this.messages[t]),n},t.prototype.getMessage=function(){var t=null,e=0;for(var i in this.messages){var n=this.messages[i];n.pri>e&&(t=n.msg,e=n.pri)}return t},t.prototype.pushBack=function(t){this.backStack.push(t),this.backStack.length>1e3&&(this.backStack=this.backStack.slice(200))},t}();s.Scene=vt;var yt=2*Math.PI,St=function(){function t(){}return t.distanceToSegmentSq=function(t,e,i,n,s,r){var a=s-t,o=r-e,l=i-t,h=n-e,u=a*l+o*h,c=l*l+h*h,d=-1;0!==c&&(d=u/c);var p,f;d<0?(p=t,f=e):d>1?(p=i,f=n):(p=t+d*l,f=e+d*h);var g=s-p,m=r-f;return g*g+m*m},t.rayIntersectsSegment=function(t,e,i,n,s,r,a,o){var l=1/0,h=a-s,u=o-r,c=i*u-n*h;if(0!==c){var d=(e*h-t*u+s*u-r*h)/c,p=void 0;p=Math.abs(h)>Math.abs(u)?(t+i*d-s)/h:(e+n*d-r)/u,p>=0&&p<=1&&d>=0&&(l=d)}return l},t.lineIntersectsSegment=function(t,e,i,n,s,r,a,o){var l=1/0,h=a-s,u=o-r,c=i*u-n*h;if(0!==c){var d=(e*h-t*u+s*u-r*h)/c,p=void 0;p=Math.abs(h)>Math.abs(u)?(t+i*d-s)/h:(e+n*d-r)/u,p>=0&&p<=1&&(l=d)}return l},t.lineIntersectsLine=function(t,e,i,n,s,r,a,o){var l=1/0,h=i-t,u=n-e,c=a-s,d=o-r,p=h*d-u*c;if(0!==p){var f=(e*c-t*d+s*d-r*c)/p,g=void 0;g=Math.abs(c)>Math.abs(d)?(t+h*f-s)/c:(e+u*f-r)/d,l=f}return l},t.rayIntersectsCircle=function(t,e,i,n,s){var r=i*i+n*n,a=t*i+e*n,o=t*t+e*e-s*s,l=a*a-r*o,h=1/0;if(l>0){l=Math.sqrt(l);var u=(-a-l)/r,c=(-a+l)/r;u>=0&&(h=u),c>=0&&(h=Math.min(h,c))}return h},t.clipSegmentToRect=function(t,e,i,n,s,r,a,o){var l=0,h=1;if(0!==n){var u=1/n,c=(r-e)*u,d=(o-e)*u;if(l=Math.min(c,d),h=Math.max(c,d),l>1||h<0)return null}else if(eo)return null;if(0!==i){var p=1/i,f=(s-t)*p,g=(a-t)*p,m=Math.min(f,g),v=Math.max(f,g);if(l=Math.max(l,m),h=Math.min(h,v),l>1||h<0||l>h)return null}else if(ta)return null;return[l,h]},t.rayIntersectsCircleOuter=function(t,e,i,n,s){var r=i*i+n*n,a=t*i+e*n,o=t*t+e*e-s*s,l=a*a-r*o;return l=Math.sqrt(l),Math.max((-a+l)/r,(-a-l)/r)},t.lineTouchingCircle=function(t,e,i,n,s){var r=Math.sqrt(t*t+e*e);if(!(r>s))return null;var a=Math.sqrt(r*r-s*s),o=s*a/r,l=s*s/r,h=t/r,u=e/r,c=t*n-e*i;return c<0&&(o=-o),{x:h*l-u*o,y:u*l+h*o}},t.distanceToPolygonSq=function(e,i,n){if(t.isInsidePolygon(e,i,n))return 0;for(var s=1/0,r=0;r2)for(var l=a[0],h=a[1],u=2;u<=o-2;u+=2){var c=a[u],d=a[u+1];s=Math.min(s,t.distanceToSegmentSq(l,h,c,d,e,i)),l=c,h=d}}return s},t.isInsidePolygon=function(t,e,i){for(var n=!1,s=0;se!=l>e&&t<(u-o)*(e-l)/(c-l)+o&&(n=!n),o=u,l=c}return n},t.distanceToBalloon=function(e,i,n,s){var r;if(e>=i)r=e;else if(0===s)r=i;else{var a=u.sign(s);r=e/s*a,Math.abs(n*r)>i-e&&(r=t.rayIntersectsCircleOuter(-(i-e),0,Math.abs(n),s,e))}return r},t.distanceToRect=function(t,e,i,n,r,a,o){void 0===o&&(o=!1);var l,h;i instanceof s.Rect?(o=n,l=i.x0,h=i.y0,r=i.x1,a=i.y1):(l=i,h=n);var u,c;return u=tr?t-r:0,c=ea?e-a:0,o?u*u+c*c:Math.sqrt(u*u+c*c)},t.clipSegmentToBounds=function(e,i,n,s,r,a,o,l,h,u){var c=Math.max(r,a),d=n-e,p=s-i,f=t.clipSegmentToRect(e,i,d,p,o-c,l-c,h+c,u+c);if(null===f)return null;var g=Math.max(0,f[0]),m=Math.min(1,f[1]);return[e+d*g,i+p*g,e+d*m,i+p*m]},t.computeBoundsSize=function(t){for(var e=1/0,i=-(1/0),n=1/0,s=-(1/0),r=t.length,a=0;aa&&(o=d,a=p)}a>n&&(i[o]=1,t.simplifyDPStep(e,i,n,s,o),t.simplifyDPStep(e,i,n,o,r))},t.reducePoints=function(t,e){for(var i,n,s=t[0],r=t[1],a=[s,r],o=t.length,l=2;le&&(a.push(i),a.push(n),s=i,r=n);return s!==i&&r!==n&&a.push(i,n),a},t.transformPolyline=function(t,e,i,n,s){for(var r=[],a=0;a=yt&&(t%=yt), t},t.sectorBetweenAngles=function(t,e){for(;eMath.PI?i-=yt:i<-Math.PI&&(i+=yt),i},t.rotateVector=function(t,e,i,n){return{x:t*n-e*i,y:t*i+e*n}},t}();s.Geometry=St;var bt=function(){function t(t){this.scene=t,this.bounds=null}return t.prototype.setBounds=function(t,e,i,n){this.bounds=new gt(t,e,i,n)},t.prototype.findObjectAt=function(t,e,i){return null},t.prototype.remove=function(){},t}();s.Layer=bt,function(t){t.ToolbarItemNames.fullscreen=function(t,e){var i=t.settings.localization.toolbar;return new s.Bar.ToggleButton(t,e,{labelDisabled:e.label||i.fullscreenButton,titleDisabled:e.title||i.fullscreenTitle,cssClassEnabled:"DVSL-bar-btn-fullscreen-active",cssClassDisabled:e.cssClass||"DVSL-bar-btn-fullscreen",onEnable:function(){return t.setFullscreen(!0)},onDisable:function(){return t.setFullscreen(!1)},getChartState:function(){return t.isFullscreen()}})};var e=function(t){function e(){t.apply(this,arguments)}return n(e,t),e.prototype.onSceneChange=function(e){t.prototype.onSceneChange.call(this,e);var i=this.chart.scene.backStack.length>0,n=this.options;n.enabled!==i&&(n.enabled=i,this.updateSettings())},e}(t.Button);t.ToolbarItemNames.back=function(t,i){var n=t.settings.localization.toolbar;i.label=i.label||n.backButton,i.title=i.title||n.backTitle,i.cssClass=i.cssClass||"DVSL-bar-btn-back";var s=i.onClick;return i.onClick=function(e,i){t.back(!0,"user"),s&&s(e,i)},new e(t,i)}}(o);var Ct=function(){function t(t){this.seed=t,this.A=48271,this.M=2147483647,this.Q=this.M/this.A,this.R=this.M%this.A,this.oneOverM=1/this.M}return t.prototype.get=function(){var t=this.seed/this.Q,e=this.seed%this.Q,i=this.A*e-this.R*t;return i>0?this.seed=i:this.seed=i+this.M,this.seed*this.oneOverM},t.prototype.getArrayElement=function(t){return t[t.length*this.get()|0]},t}();s.Random=Ct;var xt=function(t){function e(e){t.call(this),this.animationOrder=500,this.paintOrder=35,this.updateOrder=600,this.container=null,this.backgroundContainer=null,this.background=null,this.canvas=null,this.interactionContainer=null,this.menuContainer=null,this.outerBorder=null,this.scene=null,this.curThemeClass=null,this.chart=e,this.scene=e.scene}return n(e,t),e.setContainerStyle=function(t){t.style.position="absolute",t.style.left="0px",t.style.right="0px",t.style.top="0px",t.style.bottom="0px"},e.prototype.createDom=function(t){this.shell=t,this.container=s.Helpers.createDom("div","DVSL-container DVSL-"+t.chart.api.typeName),this.container.style.position="relative",this.container.style.width="100%",this.backgroundContainer=s.Helpers.createDom("div","DVSL-background-container",null,this.container),e.setContainerStyle(this.backgroundContainer),this.background=s.Helpers.createDom("div","DVSL-background",null,this.backgroundContainer),e.setContainerStyle(this.background),this.backgroundImage=s.Helpers.createDom("div","DVSL-background-image",null,this.background),this.canvas=s.Helpers.createDom("canvas","DVSL-canvas",null,this.container),e.setContainerStyle(this.canvas),this.outerBorder=s.Helpers.createDom("div","DVSL-border",null,this.container),e.setContainerStyle(this.outerBorder),this.interactionContainer=s.Helpers.createDom("div","DVSL-interaction",null,this.container),e.setContainerStyle(this.interactionContainer),this.menuContainer=s.Helpers.createDom("div","DVSL-menu-container DVSL-menu-workaround",null,this.container),e.setContainerStyle(this.menuContainer),s.Helpers.createDom("span","DVSL-empty"," ",this.menuContainer),this.updateSettings(this.scene.settings),this.interactionContainer.tabIndex=0},e.prototype.updateSettings=function(t){if(s.Helpers.hasProp(t,"area.style.image")){var e=t.area.style.image;this.backgroundImage.style.backgroundImage=e?"url("+e+")":""}var i=this.curThemeClass,n=this.scene.settings.advanced.themeCSSClass;n!==i&&(i&&s.Helpers.removeClass(this.container,i),this.curThemeClass=n,s.Helpers.addClass(this.container,n))},e.prototype.doAnimations=function(t){t.changes.bounds&&(this.backgroundImage.style.bottom=this.scene.bottomMargin+"px",this.backgroundImage.style.top=this.scene.topMargin+"px")},e}(A);s.DomLayer=xt;var wt=function(){function t(t,e,i){void 0===i&&(i=[]),this.x=i,this.y1=e,this.y0=t}return t.prototype.isEmpty=function(){return 0===this.x.length},t.prototype.makeCopy=function(){return new t(this.y0,this.y1,this.x.slice(0))},t.prototype.split=function(e){var i=new t(e,this.y1);return this.y1=e,i.x=this.x.slice(0),i},t.prototype.add=function(t,e){for(var i=[],n=this.x.length,s=0;s=c)o+=2;else if(u>=h){if(e.push(l,h),a+=2,a===s)break;l=i[a],h=i[a+1]}else if(u>l&&e.push(l,u),c=u)a+=2;else{if(!(h>=l))return!0;r+=2}}return!1},t.prototype.coversSlice=function(t){if(t.isEmpty())return!0;for(var e=this.x,i=t.x,n=e.length,s=i.length,r=0,a=0;a=l)r+=2;else{if(!(h>=o&&u<=l))return!1;a+=2}}return a===s},t.prototype.clip=function(t,e){for(var i=[],n=0;n<=this.x.length-2;n+=2){var s=this.x[n],r=this.x[n+1];r>t&&st)return!0}return!1},t.prototype.covers=function(t,e){for(var i=0;i<=this.x.length-2;i+=2){var n=this.x[i],s=this.x[i+1];if(n<=t&&s>=e)return!0}return!1},t.prototype.findOverlappingRect=function(t,e,i){for(var n=!1,s=0;s<=this.x.length-2;s+=2){var r=this.x[s],a=this.x[s+1];rt&&t+i>r&&(e=Math.max(e,Math.min(a,t+i)),n=!0)}return{x0:t,x1:e,overlaps:n}},t.prototype.toRects=function(t){for(var e=0;e<=this.x.length-2;e+=2){var i=this.x[e],n=this.x[e+1];t.push(new s.Rect(i,this.y0,n,this.y1))}},t}();s.AreaSlice=wt;var Lt=function(){function t(){this.slices=[new wt(-1e30,1e30)]}return t.prototype.makeCopy=function(){var e=new t;e.slices=[];for(var i=0;i1){i=this.slices[1].y0,n=this.slices[this.slices.length-1].y1;for(var r=0;r0&&(t=Math.min(t,a.x[0]),e=Math.max(e,a.x[a.x.length-1]))}}return new s.Rect(t,i,e,n)},t.prototype.addRect=function(t){if(t.isEmpty())return this;for(var e=t.x0,i=t.x1,n=t.y0,s=t.y1,r=[],a=null,o=0;o=s||l.y1<=n)a&&a.tryMerge(l)||(r.push(l),a=l);else{if(n>l.y0){var h=l.split(n);a&&a.tryMerge(l)||(r.push(l),a=l),l=h}if(s=s||l.y1<=n)a&&a.tryMerge(l)||(r.push(l),a=l);else{if(n>l.y0){var h=l.split(n);a&&a.tryMerge(l)||(r.push(l),a=l),l=h}if(su.y1){var c=h.split(u.y1);h.subtractSlice(u),i&&i.tryMerge(h)||(e.push(h),i=h),h=c,l+=1}else{if(h.subtractSlice(u),i&&i.tryMerge(h)||(e.push(h),i=h),o+=1,o===r)break;h=n[o]}}}for(;o=r+e)break;var h=l.findOverlappingRect(i,n,t);i=h.x0,n=h.x1;var u=h.overlaps;u&&(a=Math.min(l.y1,r+e))}return new s.Rect(i,r,n,a)},t.prototype.findTopPosition=function(t,e){for(var i=1/0,n=0;nn&&a.intersects(e,i))return!0}return!1},t.prototype.isEmpty=function(){return 1===this.slices.length&&this.slices[0].isEmpty()},t.prototype.coversRect=function(t){for(var e=t.x0,i=t.x1,n=t.y0,s=t.y1,r=0;ra.y0&&!a.covers(e,i))return!1}return!0},t.prototype.toRects=function(){for(var t=[],e=0;e0?(e=this.fullscreenBeforeW,i=this.fullscreenBeforeH,this.fullscreenBeforeW=0,this.fullscreenBeforeH=0):(e=n.width||Math.min(n.maxWidth,this.container.clientWidth),i=n.height||Math.min(n.maxHeight,this.container.clientHeight),e>0&&i<2&&(i=this.settings.area.height||this.settings.area.defaultHeight),e=Math.max(n.minWidth,e),i=Math.max(n.minHeight,i)),(t||e>=2&&e!==this.chartWidth||i>=2&&i!==this.chartHeight)&&this.setSize(e,i,t),u.updateResize(this.container)},e.prototype.setSize=function(t,e,i){this.chart.log("Update size: "+e+", "+t);var n=this.domLayer.container.style;n.height=e+"px",n.width=t+"px",this.chartHeight=e,this.chartWidth=t,this.sizeChanged=!0,this.events.setNewSize(new gt(0,0,t,e),!0,i)},e.prototype.setFullscreen=function(t){t!==this.fullScreenMode&&(this.fullScreenMode=t,t?(this.fullscreenBeforeW=this.scene.chartWidth,this.fullscreenBeforeH=this.scene.chartHeight,u.addClass(this.domLayer.container,"DVSL-fullscreen")):u.removeClass(this.domLayer.container,"DVSL-fullscreen"),this.updateSize(!0))},e.prototype.buildDom=function(){if(!this.settings.container)throw new Error("Chart container is not defined in the settings.");if(!u.isDomObject(this.settings.container))throw new Error("Chart container is not a DOM object.");this.container=this.settings.container,null!=this.container._DVSL_ChartInstance&&this.container._DVSL_ChartInstance.remove(),this.container.innerHTML="",this.container._DVSL_ChartInstance=this.chart,this.domLayer.createDom(this),this.container.appendChild(this.domLayer.container),this.backgroundContainer=this.domLayer.backgroundContainer,this.interactiveContainer=this.domLayer.interactionContainer,this.menuContainer=this.domLayer.menuContainer,this.canvas=this.domLayer.canvas},e.prototype.remove=function(){this.mouseEvents.remove(),this.domLayer.remove(),u.unlistenResize(this.container),delete this.container._DVSL_ChartInstance,u.unlisten(window,"resize",this.containerResizeFunc),this.container.innerHTML=""},e.prototype.updateSettings=function(t){t.area&&this.updateSize(!0),this.domLayer.updateSettings(t)},e.prototype.notifyMouseEvent=function(t,e){this.chart.removed||(t.consumed=!1,this.events.onMouseEvent(t,e),t.cursor||(t.cursor="default"),this.lastCursor!==t.cursor&&(this.interactiveContainer.style.cursor=t.cursor,this.menuContainer.style.cursor=t.cursor,this.lastCursor=t.cursor))},e.prototype.requestPaint=function(){var t=this;null===this.paintRequested&&(this.settings.advanced.useAnimationFrame?this.paintRequested=s.Helpers.requestAnimationFrame(function(e,i){return t.paintScene(i?e:null)}):this.paintRequested=window.setTimeout(function(){return t.paintScene(null)},5))},e.prototype.paintNow=function(t){return void 0===t&&(t=!1),this.paintNowInProgreess?void this.chart.error("paintNow called from within paintNow call"):(this.paintNowInProgreess=!0,(null!==this.paintRequested||t)&&(this.settings.advanced.useAnimationFrame?s.Helpers.cancelAnimationFrame(this.paintRequested):window.clearTimeout(this.paintRequested),this.paintScene(null)),void(this.paintNowInProgreess=!1))},e.prototype.paintScene=function(t){if(!this.chart.removed){this.paintRequested=null;var e=null!==t?t:u.performanceNow(),i=new w;i.timeStamp=e,i.isExport=!1,this.prevTime&&this.animationInProgress?(i.dtime=i.timeStamp-this.prevTime,i.dtime>1e3&&(i.dtime=1e3),i.dtime<1&&(i.dtime=1)):i.dtime=30,this.prevTime=e,this.chartWidth>0&&this.chartHeight>0&&(this.sizeChanged&&(this.resizeCanvas(),this.sizeChanged=!1),this.innerAreaCache=null,this.events.animateFrame(i),i.animating?(this.animationInProgress=!0,this.events.requestPaint()):this.animationInProgress=!1,this.profiler.paintDone())}},e.prototype.resizeCanvas=function(){var t=this.chart.settings.advanced,e=1,i=1;if(t.highDPI===!0){var n=u.canvasScaling();e=n.x,i=n.y}else t.highDPI>0&&(e=i=t.highDPI);var s,r,a=this.chartWidth,o=this.chartHeight,l=Math.max(100,t.maxCanvasWidth),h=Math.max(100,t.maxCanvasHeight),c=0,d=0;do c++,s=Math.ceil(a*e/c);while(s>l);do d++,r=Math.ceil(o*i/d);while(r>h);e/=c,i/=d,a=s/e,o=r/i,this.scaleX=e,this.scaleY=i,this.canvas.width=s,this.canvas.height=r,this.canvas.style.width=a+"px",this.canvas.style.height=o+"px"},e.prototype.prepareContext=function(t){var e=this.scene,i=this.canvas,n=i.getContext("2d");n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,i.width,i.height),534===Tt&&(i.style.display="none",i.offsetHeight,i.style.display="inherit"),this.areaStylesBefore(n,this.canvas);var s=this.scaleX,r=this.scaleY;n.setTransform(s,0,0,r,0,0),n.__scaleX=s,n.__scaleY=r,t.context=n,t.scaleX=s,t.scaleY=r,t.labelRenderer=this.labelRenderer,this.labelRenderer.startFrame(e.chartWidth,e.chartHeight,s,r)},e.prototype.areaStylesBefore=function(t,e){var i=this.settings.area.style.fillColor;i&&(t.fillStyle=i,t.fillRect(0,0,e.width,e.height))},e.prototype.areaStylesAfter=function(t,e){var i=this.settings.area.style.overlayColor;i&&(t.fillStyle=i,t.setTransform(1,0,0,1,0,0),t.fillRect(0,0,e.width,e.height))},e.prototype.finalizeContext=function(t){this.areaStylesAfter(t.context,this.canvas),this.labelRenderer.finishFrame()},e.prototype.exportToImageGetDimensions=function(){var t=new w;t.isExport=!0,t.context=this.canvas.getContext("2d"),t.labelRenderer=this.labelRenderer;var e=this.events.updateLayout(t);return t.isExport=!1,this.events.updateLayout(t),{width:e.w(),height:e.h()}},e.prototype.exportToContext=function(t,e,i){var n=new B(this.settings,this.chart.assetsLoader,this.container);n.allowCache=!1,n.startFrame(1,1,i,i);var s=new w;s.isExport=!0,s.timeStamp=this.prevTime,s.dtime=0,s.context=t,s.scaleX=i,s.scaleY=i,s.labelRenderer=n;var r=this.events.updateLayout(s);this.areaStylesBefore(t,e),t.save(),t.setTransform(i,0,0,i,-r.x0*i,-r.y0*i),this.events.doPaint(s),this.areaStylesAfter(t,e),s.isExport=!1,this.events.updateLayout(s),O.restore(t)},e.prototype.getChartInnerArea=function(){if(this.innerAreaCache)return this.innerAreaCache;var t=new s.AreaCollection;t.addRect(new s.Rect(this.scene.x0,this.scene.y0,this.scene.x0+this.scene.width,this.scene.y0+this.scene.height));for(var e=this.menuContainer.getBoundingClientRect(),i=e.left,n=e.top,r=this.menuContainer.children,a=0;a0||o.offsetWidth>0){var l=o.getBoundingClientRect();t.subtractRect(new gt(l.left-i,l.top-n,l.right-i,l.bottom-n))}}return this.innerAreaCache=t,t},e.MouseEventConfig=[{ev:x.EVENT_GLOBAL_DOWN,name:"GlobalPointerDown"},{ev:x.EVENT_DOWN,name:"PointerDown",captures:!0},{ev:x.EVENT_UP,name:"PointerUp",needsCapture:!0,releasesCapture:!0},{ev:x.EVENT_DRAG,name:"PointerDrag",needsCapture:!0,captures:!0},{ev:x.EVENT_MOVE,name:"PointerMove",captures:!0},{ev:x.EVENT_LEAVE,name:"PointerOut"},{ev:x.EVENT_CANCEL,name:"PointerCancel",needsCapture:!0,releasesCapture:!0},{ev:x.EVENT_CLICK,name:"Click"},{ev:x.EVENT_INSTACLICK,name:"InstantClick"},{ev:x.EVENT_LONGPRESS,name:"LongPress"},{ev:x.EVENT_RCLICK,name:"RightClick"},{ev:x.EVENT_DBLCLICK,name:"DoubleClick"},{ev:x.EVENT_TPLCLICK,name:"TripleClick"},{ev:x.EVENT_WHEEL,name:"Wheel"}],e}();s.ChartOuterShell=Mt;var kt=function(){function t(t,e){this.fullScreenMode=!1,this.chart=t,this.settings=t.settings,this.scene=t.scene,this.parentShell=e,this.buildDom(),this.events=new I(t,this),this.parentShell.events.addSubchart(this.chart),this.updateSize()}return t.prototype.getChartInnerArea=function(){return this.parentShell.getChartInnerArea()},t.prototype.requestPaint=function(){this.parentShell.requestPaint()},t.prototype.paintNow=function(t){this.parentShell.paintNow(t)},t.prototype.buildDom=function(){this.container=this.parentShell.container,this.interactiveContainer=this.parentShell.interactiveContainer,this.backgroundContainer=this.parentShell.backgroundContainer,this.menuContainer=this.parentShell.menuContainer},t.prototype.remove=function(){this.parentShell.events.removeSubchart(this.chart)},t.prototype.updateSettings=function(t){t.area&&this.updateSize()},t.prototype.updateSize=function(t){void 0===t&&(t=!1);var e=this.settings.area;this.events.setNewSize(new gt(e.left,e.top,e.left+e.width,e.top+e.height),!1,t)},t.prototype.prepareContext=function(t){var e=this.settings.area.style;if(e.fillColor){var i=t.context,n=this.scene;i.fillStyle=e.fillColor,i.fillRect(n.chartLeft,n.chartTop,n.chartWidth,n.chartHeight)}},t.prototype.finalizeContext=function(t){var e=this.settings.area.style;if(e.overlayColor){var i=t.context,n=this.scene;i.fillStyle=e.overlayColor,i.fillRect(n.chartLeft,n.chartTop,n.chartWidth,n.chartHeight)}},t.prototype.forceChromeRedraw=function(){this.parentShell.forceChromeRedraw()},t.prototype.setFullscreen=function(t){},t}();s.ChartInnerShell=kt;var Pt=function(t){function e(e){t.call(this),this.animationOrder=2e3,this.paintOrder=70,this.updateOrder=200,this.scene=null,this.loadingTime=null,this.chart=e,this.scene=e.scene}return n(e,t),e.prototype.doAnimations=function(t){this.scene.loading&&(t.animating=!0)},e.prototype.paintScene=function(t){var e=this.scene,i=e.getMessage(),n=e.settings.advanced.style,s=n.loadingArcStyle,r=e.loading&&"hidden"!==s.location;if(r||(this.loadingTime=null),i||r){null===this.loadingTime&&(this.loadingTime=t.timeStamp);var a,o,l=t.context,h="corner"===s.location,u=s.r,c=s.lineWidth;if(h){a=e.x0+e.width-1.2*(u+c),o=e.y0+1.2*(u+c);var d=this.chart.shell.getChartInnerArea();o+=d.findTopPosition(a,a)}else a=e.x0+e.width/2,o=e.y0+e.height/2+u;if(i){var p=n.messageTextStyle;l.textBaseline="top",l.textAlign="left";var f=O.getTextHeight(l,p.font),g=O.getTextWidth(l,p,i),m=void 0,v=void 0,y=void 0,S=n.messageBackgroundStyle,b=S.padding||0;r&&(h?(a-=b,m=a-1.2*u-g,v=f>2*u?4:o-f/2,y=g+2.2*u):(o-=f/2,m=a-g/2,v=o+1.3*f,y=g));var C=O.beginStrokeAndFill(l,S);C.rect(m-b,o-u-b,y+2*b,v-o+u+2*b+f),O.endStrokeAndFill(l,C,S),O.drawText(l,p,i,m,v),O.resetTextStyle(l)}if(r){l.save(),l.lineCap="round",l.lineWidth=c;var x=(t.timeStamp-this.loadingTime)/700*Math.PI,w=l.createLinearGradient(a+u*Math.cos(x+Math.PI),o+u*Math.sin(x+Math.PI),a+u*Math.cos(x),o+u*Math.sin(x));w.addColorStop(0,s.lineColor),w.addColorStop(1,"transparent"),l.strokeStyle=w,l.beginPath(),l.arc(a,o,u,x,x+Math.PI),l.stroke(),O.restore(l)}}},e}(A);s.MessagesOverlay=Pt;var It="undefined"!=typeof document?document.currentScript:null,Dt=null,Ft=function(){if(Dt)return Dt;if("undefined"==typeof document)return"";var e=t.PackageInfo.LibraryName;"-1&&(e=e.substr(0,i));for(var n=new RegExp("^(.*?/"+e+"(-dev|.min|).js)"),r=document.getElementsByTagName("script"),a=0;al){var g=document.createElement("link");if(g.rel="stylesheet",g.href=r,g.type="text/css",!t.required){s.Helpers.warn("Asset url "+r+" does not define the `required` delegate which prevents the detection of asset load in older browsers.");var m=5;t.required=function(){return m-- >0},h=!0}var v=100;c=window.setInterval(function(){v--<0?f():t.required()||p()},100),i=g}else{if(!(l>-1))return this.errors.push("Assets: Do not know how to load "+r+'. The URL should contain either ".css" or ".js" - it can be either in the path, the file name or the query string.'),!1;var y=document.createElement("script");y.src=r,y.type="text/javascript",y.async=!1,i=y}return u.listen(i,"load",p),u.listen(i,"error",f),document.getElementsByTagName("head")[0].appendChild(i),!0},t._imageCache={},t._imageLoading={},t._imagesPendingForErrors=[],t.loadedHTMLAssets={},t.pendingHTMLAssets={},t.callbacks=[],t.errors=[],t}(),Et=function(){function e(t){this.chart=t,this.settings=t.settings;var e=this.settings.assetsUrlBase||Ft();e.length>0&&"/"!==e[e.length-1]&&(e+="/"),this.assetsUrlBase=e}return e.prototype.getAssetUrl=function(e){return 0===e.indexOf("builtin://")?this.settings.advanced.builtinAssets[e.slice(10)]:0===e.indexOf("assets://")?(this.assetsUrlBase||this.chart.error("Cannot locate the ZoomCharts script path based on file name '"+t.PackageInfo.LibraryName+".js'. Please specify 'assetsUrlBase' in settings when creating the chart."),this.assetsUrlBase+e.slice(9)):e},e.prototype.hasPendingRequests=function(){return Nt.hasPendingRequests()},e.prototype.getAssetImage=function(t,e){var i=this;return Nt.getAssetImage(this.getAssetUrl(t),this.settings.advanced.crossOriginHeader,function(t){i.chart.events.requestPaint(),e&&e(t)})},e.prototype.ensureAssetsList=function(t,e){for(var i=[],n=0;n"),void 0===r&&(r=null),this.t=0,this.startSpeed=0,this.duration=n,this.from=e,this.to=i,null==this.from&&(this.from=this.to),this.startTime=r,this.x=this.from,this.t=this.startTime,this.formula=t.easingFormulas[s],!this.formula)throw new Error("Easing formula not defined: "+s)}return t.prototype.jump=function(t){this.to=t,this.from=t,this.x=t,this.t=this.startTime=null},t.prototype.reset=function(t,e,i){void 0===i&&(i=null),this.from=t,this.to=e,this.startTime=i,this.x=this.from,this.t=this.startTime},t.prototype.retarget=function(t,e){return this.finished(this.t)?this.startSpeed=0:(this.startSpeed=this._getSpeed(),e||(e=this.t)),e?(this.from=this.get(e),this.startTime=e):(this.startTime=null,this.from=this.x),this.to=t,this},t.prototype.switchCoordinates=function(t,e){this.from=this.from*e+t,this.x=this.x*e+t,this.to=this.to*e+t,this.startSpeed=this.startSpeed*e},t.prototype.updateAndGet=function(t,e){var i=this.x!==t;return t!==this.to&&this.retarget(t,e),{value:this.get(e),changes:i}},t.prototype.updateAndGetFixed=function(t,e){var i=this.x!==t;return t!==this.to&&(this.startSpeed=0,this.startTime=e,this.from=this.x,this.to=t),{value:this.get(e),changes:i}},t.prototype.getClean=function(t){return this.duration<=0?this.to:this.startTime?this._calculate(t):this.from},t.prototype._calculate=function(t){var e=Math.min(1,Math.max(t-this.startTime,0)/this.duration);if(e>=1)return this.to;var i=this.formula(e),n=i*(this.to-this.from);if(this.startSpeed&&e<1){var s=this.startSpeed*e*this.duration;n=n*i+s*(1-i)}return n=this.from+n},t.prototype.get=function(t){if(this.duration<=0)return this.t=t,this.x=this.to,this.to;this.startTime||(this.startTime=t);var e=this._calculate(t);return this.t=t,this.x=e,e},t.prototype.finished=function(t){return this.startTime||(this.startTime=t),t>=this.startTime+this.duration},t.prototype._getSpeed=function(){var t=this.t,e=this.duration/1e3,i=this.getClean(t-e/2),n=this.getClean(t+e/2);return this.t=t,(n-i)/e},t.easingFormulas={"=":function(t){return t},"<>":function(t){return t<.5?2*t*t:-.5*((2*t-1)*(2*t-3)-1)},scroll:function(t){return 1-(1-t)*(1-t)}},t}();s.Animator=zt;var Ot=function(){function t(t,e,i,n,s){void 0===n&&(n="<>"),void 0===s&&(s=null),this._animator=new zt(0,1,i,n,s),this.reset(t,e,s)}return t.prototype.reset=function(t,e,i){return u.isString(t)||null==t?this._fromColor=N.parse(t):this._fromColor=t,u.isString(e)||null==e?this._toColor=N.parse(e):this._toColor=e,this._animator.reset(0,1,i),this},t.prototype.getColor=function(t){var e=Math.min(1,this._animator.get(t));return this._lastValue=N.blend(this._fromColor,this._toColor,e)},t.prototype.get=function(t){return N.format(this.getColor(t))},t.prototype.updateAndGet=function(t,e){(u.isString(t)||null==t)&&(t=N.parse(t));var i=!N.areEqual(this._lastValue,t);return N.areEqual(this._toColor,t)||this.reset(this._lastValue,t,e),{value:this.get(e),changes:i}},t.prototype.finished=function(t){return this._animator.finished(t)},t}();s.ColorAnimator=Ot;var Ht=function(t){function e(e){t.call(this),this.animationOrder=0,this.paintOrder=1e4,this.touches={},this.fps=0,this.prevFrame=null,this.frameCount=0,this.chart=e,this.settings=e.settings.advanced,this.captureTouches=this.settings.showTouches}return n(e,t),e.prototype.onSceneChange=function(t){this.captureTouches=this.settings.showTouches},e.prototype.paintScene=function(t){var e="";if(this.settings.showTimestamp&&(e+=Math.round(t.timeStamp)),this.settings.showFPS){if(this.frameCount+=1,this.prevFrame){var i=Math.max(t.timeStamp-this.prevFrame,1)/1e3,n=1/i,s=Math.min(1,3*i);this.fps=this.fps*(1-s)+n*s}this.prevFrame=t.timeStamp,e+="FPS:"+Math.round(this.fps)}var r=t.context;if(this.captureTouches){var a=this.settings.showTouchTrail,o=0;for(var l in this.touches){var h=this.touches[l];if(this.touches.hasOwnProperty(l)){r.beginPath(),r.moveTo(h.dx,h.dy);for(var u=0;u0){var d=this.chart.shell.getChartInnerArea(),p=Math.max(30,d.findTopPosition(50,200));O.resetTextStyle(r),r.fillStyle="#000",r.textAlign="start",r.textBaseline="middle",r.font="bold 11px Arial",r.fillText(e,50,p)}},e.prototype.previewPointerDown=function(t){if(this.captureTouches){for(var e in this.touches){var i=this.touches[e];this.touches.hasOwnProperty(e)&&i.up&&delete this.touches[e]}this.touches[t.identifier]={dx:t.x,dy:t.y,x:t.x,y:t.y,up:!1,cancelled:!1,trace:[],animator:new s.Animator(10,40,200)},t.changes.requestPaint=!0}},e.prototype.previewPointerDrag=function(t){if(this.captureTouches){var e=this.touches[t.identifier];e.x=t.x,e.y=t.y,this.settings.showTouchTrail&&e.trace.push({x:e.x,y:e.y}),t.changes.requestPaint=!0}},e.prototype.previewPointerUp=function(t){if(this.captureTouches){var e=this.touches[t.identifier];e.up=!0,e.animator.retarget(0),this.previewPointerDrag(t),t.changes.requestPaint=!0}},e.prototype.previewPointerCancel=function(t){if(this.captureTouches){var e=this.touches[t.identifier];e.up=!0,e.cancelled=!0,e.animator.retarget(0),this.previewPointerDrag(t),t.changes.requestPaint=!0}},e}(A);s.TouchMarkers=Ht;var _t="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",Rt=function(){function t(){}return t.createImage=function(e,i,n,r){var a=t.getSizes(e,n),o=document.createElement("canvas");o.width=a.width,o.height=a.height;var l=o.getContext("2d");r||(l.fillStyle="#fff",l.fillRect(0,0,a.width,a.height)),e.exportToContext(l,o,a.scale);try{return o.toDataURL(i)}catch(t){throw s.Helpers.error(t),new Error("Browser security prevents exporting this chart. The canvas might be tainted. See `advanced.crossOriginHeader` setting in the documentation.")}},t.createPdf=function(e,i){var n,s=e.exportToImageGetDimensions(),r=[10,10,10,10],a=e.settings.advanced.exportPdfSize,o=0,l=0,h=0,u=0,c=72,d=1,p=0,f=0;s.width>=s.height?(a=[a[1],a[0]],n="l"):n="p",o=a[0]/25.4*c,l=a[1]/25.4*c,d=Math.min(l/s.height,o/s.width),"l"===n?(p=s.width*d/o*a[0]-r[1]-r[3],h=(a[0]-p-r[1]-r[3])/2,f=s.height/s.width*p,u=(a[1]-r[0]-r[2]-f)/2):(f=s.height*d/l*a[1]-r[0]-r[2],u=(a[1]-f-r[0]-r[2])/2,p=s.width/s.height*f,h=(a[0]-r[1]-r[3]-p)/2);var g=t.createImage(e,"image/jpeg",{scaling:3*d},!1),m=new jsPDF(n,"mm",a);return m.addImage(g,"JPEG",r[3]+h,r[0]+u,p,f),m.output("datauristring")},t.createCsv=function(e){for(var i=/[^a-zA-Z0-9\.]/,n="data:text/csv;charset=utf-8,",s=encodeURIComponent("\r\n"),r=0;r0&&(n+=t._csvSeparator);var l=a[o];if(null!=l){var h=void 0;h=l instanceof Date?l.toISOString():""+l,n+=i.test(h)?'"'+encodeURIComponent(h.replace('"','""'))+'"':h}}n+=s}return n},t.retrieveData=function(t,e){var i=t.exportVisibleData,n=t.settings.advanced.dataExportFunction;if(!i&&!n)throw new Error("This chart type does not support data export. Provide `advanced.dataExportFunction` delegate to enable it.");var s=i?t.exportVisibleData():null;n?n(s,e):e(s)},t.createExcel=function(t){function e(t){return(t.getTime()+22091616e5)/864e5}for(var i=Object.create(null),n={s:{c:1/0,r:1/0},e:{c:0,r:0}},s=0;ss&&(n.s.r=s),n.e.ra&&(n.s.c=a),n.e.c0&&(r*=l),a>0&&(a*=l)}r>0&&a>0?o=Math.min(r/n,a/s):r>0?(o=r/n,a=s*o):a>0?(o=a/s,r=n*o):(r=n,a=s);var h=u.tryParseFloat(e.scaling,1);return 1!==h&&(o*=h,r*=h,a*=h),{width:r,height:a,scale:o,chartWidth:n,chartHeight:s}},t.getDimensions=function(t,e){var i=t.shell;if(!(i instanceof Mt))throw new Error("Export functionality is only available on the top level chart, not within nested charts.");return this.getSizes(i,e||{})},t.dataUriToBlob=function(t,e){var i=e.indexOf(","),n=i>13&&";base64"===e.substr(i-7,7);e=e.substr(i+1),e=n?window.atob(e):decodeURIComponent(e);for(var s=new ArrayBuffer(e.length),r=new Uint8Array(s),a=0;a2097152);else if(void 0!==o.download)return o.download=a,o.type=i,o.href=s,r.appendChild(o),o.click(),void r.removeChild(o);var l=e.settings.advanced.exportProxyURL;if(!l)return void alert(e.settings.localization.exportNotAvailable);var h=document.createElement("form");h.action=e.settings.advanced.exportProxyURL,h.target="_top",h.method="POST",h.style.display="none";var c=document.createElement("input");c.name="name",c.value=a,h.appendChild(c);var d=document.createElement("textarea");d.name="data",d.value=s,h.appendChild(d),r.appendChild(h),h.submit(),r.removeChild(h)},t._csvSeparator=";",t._mimeMap={png:{mime:"image/png",extension:"png",image:!0,transparent:!0},jpg:{mime:"image/jpeg",extension:"jpg",image:!0},jpeg:{mime:"image/jpeg",extension:"jpg",image:!0},csv:{mime:"text/csv",extension:"csv",csv:!0},txt:{mime:"text/csv",extension:"csv",csv:!0},xlsx:{mime:_t,extension:"xlsx",excel:!0},xls:{mime:_t,extension:"xlsx",excel:!0},pdf:{mime:"application/pdf",extension:"pdf",pdf:!0}},t}();s.Export=Rt,function(t){var e=function(t){function e(e,i){var n=e.settings.localization.toolbar;if(!i.dropDownItems){var s=e.settings.toolbar.exportOptions,r=[];(!s||s.indexOf("jpg")>-1)&&r.push({label:n.exportJpeg,onClick:function(){return Rt.download(e,"jpg",{scaling:2})}}),(!s||s.indexOf("png")>-1)&&r.push({label:n.exportPNG,onClick:function(){return Rt.download(e,"png",{scaling:3})}}),(!s||s.indexOf("pdf")>-1)&&r.push({label:n.exportPDF,onClick:function(){return Rt.download(e,"pdf")}}),(e.exportVisibleData||e.settings.advanced.dataExportFunction)&&((!s||s.indexOf("csv")>-1)&&r.push({label:n.exportCSV,onClick:function(){return Rt.download(e,"csv")}}),(!s||s.indexOf("xlsx")>-1)&&r.push({label:n.exportXLS,onClick:function(){return Rt.download(e,"xlsx")}})),i.dropDownItems=r}i.title=i.title||n.exportTitle,i.label=i.label||n.exportButton,i.cssClass=i.cssClass||"DVSL-bar-btn-export",t.call(this,e,i)}return n(e,t),e}(t.Dropdown);t.ExportDropdown=e,s.Bar.ToolbarItemNames.export=function(t,e){return new s.Bar.ExportDropdown(t,e)}}(o);var Bt=function(t){function e(e){t.call(this),this.animationOrder=2e3,this.paintOrder=65,this.updateOrder=0,this.chart=e}return n(e,t),e.prototype.onKeyDown=function(t){this.chart.isFullscreen()&&27===t.keyCode?(this.chart.setFullscreen(!1),t.consumed=!0):8===t.keyCode&&this.chart.back(!0,"user")&&(t.consumed=!0)},e}(A);s.KeyShortcuts=Bt;var Ut="C314F39F62CBF2AEFA1D5BA41E38EFFD080E88849EE210BA17971BF63A55C44E159C9F9ED004F8D50856EC8ECE673690F60C29AAC124B7C46D549D20EB22CC2A387B2FB643700546312114F831133F242CFFD023A1788167025FF398F5F09D1003C47C9B3208860A547577F540D07FF66403097FE27E7BB6B8D76036AD31B62B04EAD1BB8B2C314F6DA7489346978286491D0DF7504E9EE85A4459805F4FFCEE664122FC27B80DAD6751A7A6C0D38E9C2ECD7C0AD1F2B774D6FF81C5A2CE14D608F08E13BEE45663450519774ADF87D34CE6150FC819558EBD336511D51405A42E7A38EBB786ED5050345CBC532ED7C0EECB05C5D6D4D00534249ED4585DFABD",Vt=function(){function t(){}return t.verifySignature=function(t,e){var i=new Gt;return i.setPublic(Ut,"10001"),i.verify(t,e)},t.hash=function(t){return Gt.hash(t)},t}();s.RsaCrypto=Vt,Object.freeze(Vt);var Gt=function(){function t(t,e){null!=t&&(null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}function e(){return new t(null)}function i(t,e,i,n,s,r){for(;--r>=0;){var a=e*this[t++]+i[n]+s;s=Math.floor(a/67108864),i[n++]=67108863&a}return s}function n(t,e,i,n,s,r){for(var a=32767&e,o=e>>15;--r>=0;){var l=32767&this[t],h=this[t++]>>15,u=o*l+h*a;l=a*l+((32767&u)<<15)+i[n]+(1073741823&s),s=(l>>>30)+(u>>>15)+o*h+(s>>>30),i[n++]=1073741823&l}return s}function s(t,e,i,n,s,r){for(var a=16383&e,o=e>>14;--r>=0;){var l=16383&this[t],h=this[t++]>>14,u=o*l+h*a;l=a*l+((16383&u)<<14)+i[n]+s,s=(l>>28)+(u>>14)+o*h,i[n++]=268435455&l}return s}function r(t){return et.charAt(t)}function a(t,e){var i=it[t.charCodeAt(e)];return null==i?-1:i}function o(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s}function l(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0}function h(t){var i=e();return i.fromInt(t),i}function u(e,i){var n;if(16==i)n=4;else if(8==i)n=3;else if(256==i)n=8;else if(2==i)n=1;else if(32==i)n=5;else{if(4!=i)return void this.fromRadix(e,i);n=2}this.t=0,this.s=0;for(var s=e.length,r=!1,o=0;--s>=0;){var l=8==n?255&e[s]:a(e,s);l<0?"-"==e.charAt(s)&&(r=!0):(r=!1,0==o?this[this.t++]=l:o+n>this.DB?(this[this.t-1]|=(l&(1<>this.DB-o):this[this.t-1]|=l<=this.DB&&(o-=this.DB))}8==n&&0!=(128&e[0])&&(this.s=-1,o>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==t;)--this.t}function d(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var i,n=(1<0)for(l>l)>0&&(s=!0,a=r(i));o>=0;)l>(l+=this.DB-e)):(i=this[o]>>(l-=e)&n,l<=0&&(l+=this.DB,--o)),i>0&&(s=!0),s&&(a+=r(i));return s?a:"0"}function p(){var i=e();return t.ZERO.subTo(this,i),i}function f(){return this.s<0?this.negate():this}function g(t){var e=this.s-t.s;if(0!=e)return e;var i=this.t;if(e=i-t.t,0!=e)return this.s<0?-e:e;for(;--i>=0;)if(0!=(e=this[i]-t[i]))return e;return 0}function m(t){var e,i=1;return 0!=(e=t>>>16)&&(t=e,i+=16),0!=(e=t>>8)&&(t=e,i+=8),0!=(e=t>>4)&&(t=e,i+=4),0!=(e=t>>2)&&(t=e,i+=2),0!=(e=t>>1)&&(t=e,i+=1),i}function v(){return this.t<=0?0:this.DB*(this.t-1)+m(this[this.t-1]^this.s&this.DM)}function y(t,e){var i;for(i=this.t-1;i>=0;--i)e[i+t]=this[i];for(i=t-1;i>=0;--i)e[i]=0;e.t=this.t+t,e.s=this.s}function S(t,e){for(var i=t;i=0;--i)e[i+a+1]=this[i]>>s|o,o=(this[i]&r)<=0;--i)e[i]=0;e[a]=o,e.t=this.t+a+1,e.s=this.s,e.clamp()}function C(t,e){e.s=this.s;var i=Math.floor(t/this.DB);if(i>=this.t)return void(e.t=0);var n=t%this.DB,s=this.DB-n,r=(1<>n;for(var a=i+1;a>n;n>0&&(e[this.t-i-1]|=(this.s&r)<>=this.DB;if(t.t>=this.DB;n+=this.s}else{for(n+=this.s;i>=this.DB;n-=t.s}e.s=n<0?-1:0,n<-1?e[i++]=this.DV+n:n>0&&(e[i++]=n),e.t=i,e.clamp()}function w(e,i){var n=this.abs(),s=e.abs(),r=n.t;for(i.t=r+s.t;--r>=0;)i[r]=0;for(r=0;r=0;)t[i]=0;for(i=0;i=e.DV&&(t[i+e.t]-=e.DV,t[i+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(i,e[i],t,2*i,0,1)),t.s=0,t.clamp()}function A(i,n,s){var r=i.abs();if(!(r.t<=0)){var a=this.abs();if(a.t0?(r.lShiftTo(u,o),a.lShiftTo(u,s)):(r.copyTo(o),a.copyTo(s));var c=o.t,d=o[c-1];if(0!=d){var p=d*(1<1?o[c-2]>>this.F2:0),f=this.FV/p,g=(1<=0&&(s[s.t++]=1,s.subTo(b,s)),t.ONE.dlShiftTo(c,b),b.subTo(o,o);o.t=0;){var C=s[--y]==d?this.DM:Math.floor(s[y]*f+(s[y-1]+v)*g);if((s[y]+=o.am(0,C,s,S,0,c))0&&s.rShiftTo(u,s),l<0&&t.ZERO.subTo(s,s)}}}function T(i){var n=e();return this.abs().divRemTo(i,null,n),this.s<0&&n.compareTo(t.ZERO)>0&&i.subTo(n,n),n}function M(t){this.m=t}function k(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function P(t){return t}function I(t){t.divRemTo(this.m,null,t)}function D(t,e,i){t.multiplyTo(e,i),this.reduce(i)}function F(t,e){t.squareTo(e),this.reduce(e)}function N(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return e=e*(2-(15&t)*e)&15,e=e*(2-(255&t)*e)&255,e=e*(2-((65535&t)*e&65535))&65535,e=e*(2-t*e%this.DV)%this.DV,e>0?this.DV-e:-e}function E(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(n,n),n}function O(t){var i=e();return t.copyTo(i),this.reduce(i),i}function H(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&t.DM;for(i=e+this.m.t,t[i]+=this.m.am(0,n,t,e,0,this.m.t);t[i]>=t.DV;)t[i]-=t.DV,t[++i]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}function _(t,e){t.squareTo(e),this.reduce(e)}function R(t,e,i){t.multiplyTo(e,i),this.reduce(i)}function B(){return 0==(this.t>0?1&this[0]:this.s)}function U(i,n){if(i>4294967295||i<1)return t.ONE;var s=e(),r=e(),a=n.convert(this),o=m(i)-1;for(a.copyTo(s);--o>=0;)if(n.sqrTo(s,r),(i&1<0)n.mulTo(r,a,s);else{var l=s;s=r,r=l}return n.revert(s)}function V(t,e){var i;return i=t<256||e.isEven()?new M(e):new E(e),this.exp(t,i)}function G(e,i){return new t(e,i)}function W(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}function j(t,e){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=G(t,16),this.e=parseInt(e,16)):alert("Invalid RSA public key")}function Y(t){return t.modPowInt(this.e,this.n)}function q(t){for(var e in st.crypto.Util.DIGESTINFOHEAD){var i=st.crypto.Util.DIGESTINFOHEAD[e],n=i.length;if(t.substring(0,n)==i)return[e,t.substring(n)]}return[]}function Z(t,e){e=e.replace(rt,""),e=e.replace(/[ \n]+/g,"");var i=G(e,16);if(i.bitLength()>this.n.bitLength())return!1;var n=this.doPublic(i),s=n.toString(16).replace(/^1f+00/,""),r=q(s);if(0===r.length)return!1;var a=r[1],o=nt.hash(t);return a===o}var X,Q=0xdeadbeefcafe,K=15715070==(16777215&Q);"undefined"==typeof window?null:window.crypto||window.msCrypto;K&&"undefined"!=typeof navigator&&"Microsoft Internet Explorer"===navigator.appName?(t.prototype.am=n,X=30):K&&"undefined"!=typeof navigator&&"Netscape"!==navigator.appName?(t.prototype.am=i,X=26):(t.prototype.am=s,X=28),t.prototype.DB=X,t.prototype.DM=(1<>>t|e<<32-t},nt.S0=function(t){return nt.ROTR(2,t)^nt.ROTR(13,t)^nt.ROTR(22,t)},nt.S1=function(t){return nt.ROTR(6,t)^nt.ROTR(11,t)^nt.ROTR(25,t)},nt.s0=function(t){return nt.ROTR(7,t)^nt.ROTR(18,t)^t>>>3},nt.s1=function(t){return nt.ROTR(17,t)^nt.ROTR(19,t)^t>>>10},nt.Ch=function(t,e,i){return t&e^~t&i},nt.Maj=function(t,e,i){return t&e^t&i^e&i},nt.toHexStr=function(t){for(var e,i="",n=7;n>=0;n--)e=t>>>4*n&15,i+=e.toString(16);return i};var st={crypto:{Util:{DIGESTINFOHEAD:{sha256:"3031300d060960864801650304020105000420"}}}},rt=new RegExp("[^0-9a-f]","gi");return W.prototype.verify=Z,W.hash=nt.hash,W}(),Wt=function(){function t(t,e,i){var n=this;this.api=null,this.scene=null,this.settings=null,this.shell=null,this.events=null,this.removed=!0,this.assetsLoaded=!1,this.toolbar=null,this.data={},this.navigator=null,this.curState=null,this.goingBack=!1,this.chartUpdateOrigin=null,this.chartUpdateTimeout=null,this.scene=e,this.settings=t,this.api=i,i._impl=this,this.scene.settings=t,this.scene.assetsLoader=this.assetsLoader=new Et(this),this.data={},this.settings.parentChart?(this.shell=new kt(this,this.settings.parentChart._impl.shell),this.events=this.shell.events):(this.shell=new Mt(this,this.createDomLayer()),this.events=this.shell.events,this.events.addElement(new Ht(this)),this.events.addElement(new et(this)),this.events.addElement(new F(this,this.settings.credits))),//window.setTimeout(function(){return Zt.execute(n,!!n.settings.parentChart)},500), this.removed=!1,this.EVENT_NAMES={};var s;for(s in t.events)if(0===s.indexOf("on")){var r=s.charAt(2).toLowerCase()+s.slice(3);this.EVENT_NAMES[s]=r,this.EVENT_NAMES[r]=r}this.eventListeners={},this.assetsLoaded=!1,this.assetsLoader.ensureAssetsList(this.settings.advanced.assets,function(){return n.notifyAssetsLoaded()}),this.clearData(),this.events.addElement(new Bt(this)),this.title=this.events.addElement(new _(this)),this.events.addElement(new Pt(this))}return t.prototype.createDomLayer=function(){return new s.DomLayer(this)},t.prototype.updateFilters=function(t){this.events.notifySceneChanges({filters:!0})},t.prototype.updateStyle=function(t){this.events.notifySceneChanges({style:!0})},t.prototype.defaultDoubleClick=function(t,e){},t.prototype.defaultTripleClick=function(t,e){},t.prototype.defaultClick=function(t,e){},t.prototype.defaultRightClick=function(t,e){},t.prototype.finalInitialize=function(){var t={settings:!0,settingsChanges:this.scene.settings,data:{}};this.processChangedSettings(t),this.events.notifySceneChanges(t),this.updateSize(),this.updateEvents(null,this.settings.events)},t.prototype.getRootChart=function(){var t=this.settings.parentChart;return t?t._impl.getRootChart():this},t.prototype.processChangedSettings=function(t){},t.prototype.updateSettings=function(t,e){var i=this;if(void 0===e&&(e=null),!this.removed){var n=u.clone(this.settings.events),s=this.settings.apply(t),r={settings:!0,settingsChanges:s};this.processChangedSettings(r),s.events&&this.updateEvents(n,this.settings.events),s.advanced&&s.advanced.assets&&(this.assetsLoaded=!1,this.assetsLoader.ensureAssetsList(this.settings.advanced.assets,function(){return i.notifyAssetsLoaded()})),s.data&&this.dataSettingsChanged(s.data),this.shell.updateSettings(s),this.onSettingsChanged(s),s.toolbar&&this.assetsLoaded&&this.createToolbar(),this.events.notifySceneChanges(r);var a=s.area;if(a&&(a.width||a.height||a.maxWidth||a.minWidth||a.minHeight||a.maxHeight)&&this.updateSize(!0),e){var o=this.createEventArguments(null,e);o.changes=s,this.notifySettingsChanged(o)}}},t.prototype.getData=function(t){if(this.data[t])return this.data[t];var e=this.settings._computedDataMap[t];if(e){var i=this.createDataObj(e);return i.applyPreloadedData(),this.data[t]=i,i}throw new Error("No data configured for source ID "+t)},t.prototype.addData=function(t,e){this.removed||this.getData(e).addData(t)},t.prototype.reloadData=function(t,e){if(void 0===t&&(t=null),void 0===e&&(e=!1),!this.removed){this.log("Reload data"),t?this.data[t]&&(this.data[t].remove(),delete this.data[t]):this.clearData(),this.scene.mainDataEnabled&&(this.scene.mainData=this.getData(this.settings.data[0].id));var i={};for(var n in this.settings._computedDataMap)i[n]=!0;this.events.notifySceneChanges({data:i,dataDeep:e}),this.navigator&&this.navigator.onNewDataObject()}},t.prototype.replaceData=function(t,e){if(void 0===e&&(e="default"),null==e&&(e="default"),!this.removed){this.events.clearSceneChanges({dataArrived:null}),this.data[e]&&this.data[e].remove();var i=this.data[e]=this.createDataObj(this.settings._computedDataMap[e]);i.addData(t),this.scene.mainDataEnabled&&(this.scene.mainData=this.getData(this.settings.data[0].id));var n={};n[e]=!0,this.events.notifySceneChanges({data:n}),this.navigator&&this.navigator.onNewDataObject()}},t.prototype.clearData=function(t){void 0===t&&(t=!1);for(var e in this.data){var i=this.data[e];i.remove()}this.events.clearSceneChanges({dataArrived:null}),this.data={},this.scene.mainData=null,!t&&this.scene.mainDataEnabled&&(this.scene.mainData=this.getData(this.settings.data[0].id))},t.prototype.dataSettingsChanged=function(t){for(var e in this.data)!t[e]&&this.settings._computedDataMap[e]||(this.data[e].remove(),delete this.data[e]);this.events.clearSceneChanges({dataArrived:null}),this.events.notifySceneChanges({data:t,dataDeep:!0}),this.scene.mainDataEnabled&&(this.scene.mainData=this.getData(this.settings.data[0].id)),this.navigator&&this.navigator.onNewDataObject()},t.prototype.hasPendingRequests=function(){if(!this.assetsLoaded)return!0;if(this.assetsLoader.hasPendingRequests())return!0;for(var t in this.data)if(this.data[t].hasPendingRequests())return!0;return!1},t.prototype.remove=function(){return this.removed?void s.Helpers.warn("Removing already removed chart"):(this.cancelChartUpdateNotify(),this.removed=!0,this.toolbar&&this.toolbar.remove(),this.shell.remove(),this.clearData(!0),this.shell=null,this.scene=null,void(this.events=null))},t.prototype.setFullscreen=function(t){this.shell.setFullscreen(t)},t.prototype.isFullscreen=function(){return this.shell.fullScreenMode},t.prototype.updateSize=function(t){void 0===t&&(t=!1),this.removed||this.shell.updateSize(t)},t.prototype.on=function(t,e){var i=this.EVENT_NAMES[t];return i?(this.eventListeners[i]||(this.eventListeners[i]=[]),void this.eventListeners[i].push(e)):void this.error("Unrecognized event name: "+t)},t.prototype.off=function(t,e){var i=this.EVENT_NAMES[t];return i?this.eventListeners[i]?u.removeFromArray(this.eventListeners[i],e):void 0:void this.error("Unrecognized event name: "+t)},t.prototype.updateEvents=function(t,e){var i=t,n=e;for(var s in this.EVENT_NAMES){var r=this.EVENT_NAMES[s];t&&i[s]&&this.off(r,i[s]),n[s]&&this.on(r,n[s])}},t.prototype.notifyHoverChanged=function(t,e){this.dispatchEvent("hoverChange",t,e,null)},t.prototype.notifyDoubleClick=function(t,e){var i=this;this.dispatchEvent("doubleClick",t,e,function(t,e){return i.defaultDoubleClick(t,e)})},t.prototype.notifyTripleClick=function(t,e){var i=this;this.dispatchEvent("tripleClick",t,e,function(t,e){return i.defaultTripleClick(t,e)})},t.prototype.notifyRightClick=function(t,e){var i=this;this.dispatchEvent("rightClick",t,e,function(t,e){return i.defaultRightClick(t,e)})},t.prototype.notifyClick=function(t,e){var i=this;this.dispatchEvent("click",t,e,function(t,e){return i.defaultClick(t,e)})},t.prototype.notifySelectionChanged=function(t){return this.dispatchEventParams("selectionChange",t,null)},t.prototype.notifySettingsChanged=function(t){return this.dispatchEventParams("settingsChange",t,null)},t.prototype.notifyPositionChange=function(t){return this.dispatchEventParams("positionChange",t,null)},t.prototype.notifyChartUpdate=function(t,e){var i=this;void 0===e&&(e=!1);var n=u.performanceNow();e&&(this.chartUpdateForce=!0),t&&(this.chartUpdateWasBack=this.goingBack,this.chartUpdateOrigin=t,this.chartUpdateTime=n),this.chartUpdateState=this.saveNavigation(),null===this.chartUpdateTimeout&&(this.chartUpdateTimeout=setTimeout(function(){return i.chartUpdateNotify()},this.chartUpdateTime+this.scene.settings.events.chartUpdateDelay-n))},t.prototype.cancelChartUpdateNotify=function(){this.chartUpdateOrigin=null,this.chartUpdateTimeout&&(clearTimeout(this.chartUpdateTimeout),this.chartUpdateTimeout=null)},t.prototype.chartUpdateNotify=function(){this.chartUpdateTimeout=null;var t=this.chartUpdateOrigin;if(t){var e=this.chartUpdateState;!e||this.curState&&JSON.stringify(e)===JSON.stringify(this.curState)?this.chartUpdateForce&&(this.chartUpdateForce=!1,this.chartUpdateOrigin=null,this.chartUpdateState=null,this.doChartUpdateNotify(t)):(this.chartUpdateForce=!1,!this.chartUpdateWasBack&&this.curState&&(this.scene.pushBack(this.curState),this.events.notifySceneChanges({requestPaint:!0})),this.curState=e,this.chartUpdateOrigin=null,this.chartUpdateState=null,this.doChartUpdateNotify(t))}},t.prototype.doChartUpdateNotify=function(t){var e=this.createEventArguments(null,t);this.dispatchEventParams("chartUpdate",e,null)},t.prototype.back=function(t,e){if(void 0===t&&(t=!0),void 0===e&&(e="api"),0===this.scene.backStack.length)return!1;var i=this.scene.backStack.pop();return this.goingBack=!0,this.restoreNavigation(i,t,e),this.goingBack=!1,!0},t.prototype.goHome=function(t,e){if(void 0===t&&(t=!0),void 0===e&&(e="api"),0===this.scene.backStack.length)return!1;var i=this.scene.backStack[0];return this.restoreNavigation(i,t,e),!0},t.prototype.clearHistory=function(){return this.scene.backStack=[],!0},t.prototype.dispatchEventParams=function(t,e,i){var n=new b(0,0,u.performanceNow(),"api");return i||this.eventListeners[t]&&this.eventListeners[t].length?(this.dispatchEvent(t,n,e,i),n):n},t.prototype.dispatchEvent=function(t,e,i,n){if(n||this.eventListeners[t]&&this.eventListeners[t].length>0){for(var s=Object.keys(i),r=0;r47&&n<58;)s=10*s+n-48,i++;var r=jt[t];return r>0&&(s&r)===r},e.execute=function(e,i){var n=this,r=window.ZoomChartsLicense,a=window.ZoomChartsLicenseKey,o=e.api.typeName,l=r+u.SeparatorChar+o,h=qt[l];if(h)return void(h.result?this.handleServerResponse([e],h.result):h.charts.push(e));qt[l]=h={charts:[e],result:null};var c="ZoomCharts "+t.PackageInfo.Version;r&&a?Vt.verifySignature(r,a)?Yt||(u.log(c+" license verified: "+r),Yt=!0):u.error(c+(" license key for license '"+r+"' is invalid. Please configure the correct key in order to use the charts.")):(u.error(c+" license key was not found on the page. Please make sure ZoomChartsLicense and ZoomChartsLicenseKey variables are correctly set before initializing the chart."), r=a="---:");var d=". Please upgrade your license on https://zoomcharts.com",p=r.charAt(2);if(!this.checkChartType(o,r)&&(u.error("ZoomCharts license used on this page does not allow use of "+o+d),p="-",i))return void this.displayBanner(e,"builtin://logo-development");var f=/(\d\d\d\d-\d\d-\d\d)$/,g="builtin://logo-supported-by",m=g;switch(p){case"F":case"O":var v=r.match(f),y=t.PackageInfo.Built;return void(v&&v[1]')}}t.length=0}},e.parseUriDomain=function(t){var e=document.createElement("a");return e.href=t,e.hostname||(e.href=e.href),e.hostname},e.blockChart=function(t,e){var i=t.settings.container;t.remove(),i.innerHTML="Unable to use ZoomCharts library because of a licensing issue:
"+e},e}();!function(t){t[t.inside=0]="inside",t[t.outside=1]="outside"}(s.InfoPopupPosition||(s.InfoPopupPosition={}));var Xt=s.InfoPopupPosition,Qt=function(){function t(t){this.chart=t,this.container=t.shell.interactiveContainer,this.events=t.events,this.popup=null,this.visible=!1,this.x0=null,this.x1=null,this.y=null,this.contentsChanged=!1}return t.prototype.hide=function(){return!(!this.visible||!this.popup)&&(this.visible=!1,this.popup.style.display="none",!0)},t.prototype.ensurePopup=function(){this.popup||(this.popup=u.createDom("div","DVSL-info-center",null,this.container),u.createDom("em",null,null,this.popup),this.popup.style.position="absolute",this.popup.style.display="none")},t.prototype.show=function(t,e,i,n,s){void 0===s&&(s=Xt.inside),this.ensurePopup();var r=this.popup;n?(n.indexOf("<")===-1&&n.indexOf(">")===-1&&(n=""+n+""),this.visible=!0,r.style.display="block",n!==r.innerHTML&&(r.innerHTML=n,this.postProcessHtml(r),this.contentsChanged=!0),this.updateXY(t,e,i,s)):r.style.display="none"},t.prototype.postProcessHtml=function(t){if(t instanceof HTMLElement){var e=t.getAttribute("data-color");e&&(t.style.color=e,null!=t.getAttribute("data-selected")&&(t.style.borderColor=e))}for(var i=t.firstElementChild;i;)this.postProcessHtml(i),i=i.nextElementSibling},t.prototype.updateContents=function(t){null===t?this.hide():this.show(this.x0,this.x1,this.y,t,this.position)},t.prototype.updateXY=function(t,e,i,n){if(void 0===n&&(n=Xt.inside),this.visible&&(this.contentsChanged||this.x0!==t||this.x1!==e||this.y!==i||this.position!==n)){this.ensurePopup(),this.contentsChanged&&(this.contentsChanged=!1,this.popup.style.right=null,this.width=this.popup.offsetWidth,this.height=this.popup.offsetHeight),this.x0=t,this.x1=e,this.y=i,this.position=n;var s,r=12,a=10,o=this.width,l=this.height,h=null,u=this.popup.style,c=this.chart.scene;if(t>c.x0+c.width||e=e+o+a?(h=e+a,s="DVSL-info-right"):(h=(Math.max(t,d.x0)+Math.min(e,d.x0+d.width)-o)/2,s="DVSL-info-center"),i=Math.min(Math.max(d.y0+r,i-l/2),d.y0+d.height-l),i=Math.max(this.chart.shell.getChartInnerArea().findTopPosition(h,h+o),i);break;case Xt.outside:s="DVSL-info-center",h=Math.min(d.x0+d.width-o,Math.max(0,(t+e-o)/2));var p=this.chart.shell.container.offsetTop;i=p>l?d.y0-l:d.y0+d.height}var f=null;o>=d.chartWidth?(f=0,h=0):h+o>d.chartWidth-20&&(h+o>d.chartWidth?(f=0,h=null):(f=d.chartWidth-h-o,h=null)),u.right=null!==f?f+"px":null,u.left=null!==h?h+"px":null,u.top=i+"px",this.popupClass!==s&&(this.popupClass=s,this.popup.className=s)}},t}();s.InfoPopup=Qt;var Kt=function(){function t(t,e,i){void 0===i&&(i=!1),this._direction=1,this._endTime=0,this._midTime=0,this._startTime=0,this._preventOvershoot=!1,this._setTargetPending=!1,this._settableTargetValue=0,this._settableAcceleration=0,this._acceleration=t,this._initialValue=this._targetValue=e,this._preventOvershoot=i}return t.prototype.setTarget=function(t,e,i,n){if(null==e)return this._settableTargetValue=t,this._settableAcceleration=i,void(this._setTargetPending=!0);this._settableAcceleration=null,this._setTargetPending=!1,null!=i&&this.setAcceleration(i,e);var s=this._getDeltaT(e),r=this._getDistanceToV0(s),a=this._composeValue(e,r),o=Math.abs(t-a),l=t>a?1:-1;if(eo||this._direction!==l)if(this._preventOvershoot)if(this._direction===l){var h=this._getCurrentVelocity(s);this._acceleration=h*h/(2*o),this._startTime=e-h/this._acceleration,this._initialValue=a-o*this._direction}else this._startTime=e,this._initialValue=a;else this._startTime=e+s,this._initialValue=a+r*this._direction;else(e>=this._midTime||e<=this._startTime)&&(this._startTime=e-s,this._initialValue=a-r*this._direction);else this._startTime=e,this._initialValue=a;this._direction=this._targetValue>this._initialValue?1:-1;var u=Math.abs(this._targetValue-this._initialValue),c=Math.sqrt(u/this._acceleration);this._midTime=this._startTime+c,this._endTime=this._startTime+2*c,null!=n&&this._endTime-this._startTime>n&&(this._endTime=this._startTime+n,this._midTime=(this._startTime+this._endTime)/2,c=this._endTime-this._midTime,this._acceleration=u/(c*c))},t.prototype.getValue=function(t){return this._setTargetPending&&this.setTarget(this._settableTargetValue,t,this._settableAcceleration),this.finished(t)?this._targetValue:this._composeValue(t,this._getDistanceToV0(this._getDeltaT(t)))},t.prototype.getTargetValue=function(){return this._targetValue},t.prototype.finished=function(t){return!this._setTargetPending&&t>=this._endTime},t.prototype.jump=function(t,e,i){if(this._initialValue=this._targetValue=t,this._startTime=this._midTime=this._endTime=0,null!=e&&null!=i&&0!==e){var n=e>0?1:-1,s=Math.abs(e/this._acceleration);this._direction=n,this._midTime=i,this._endTime=i+s,this._targetValue=t+this._getDistanceToV0(s)*n}return this._targetValue},t.prototype.setAcceleration=function(t,e){if(t!==this._acceleration){var i=e9){var c=3/Math.sqrt(u);r=c*r,h=c*h}}s[a-i-1]=r,r=h,o=l}s[a-i-1]=r,this.x=t,this.y=e,this.m=s}return t.prototype.interpolate=function(t,e){var i=this.x[t+1]-this.x[t],n=(e-this.x[t])/i,s=n*n,r=s*n,a=2*r-3*s+1,o=r-2*s+n,l=-2*r+3*s,h=r-s,u=a*this.y[t]+o*i*this.m[t-this.n0]+l*this.y[t+1]+h*i*this.m[t-this.n0+1];return u},t.prototype.interpolateArray=function(t,e,i,n,s){for(var r=this.x[t],a=this.y[t],o=this.m[t-this.n0],l=this.y[t+1],h=this.m[t-this.n0+1],u=this.x[t+1]-r,c=1/u,d=i;d=0},t.prototype.clone=function(){var e=new t;for(var i in this._dict)e._dict[i]=this._dict[i].slice();return e._count=this._count,e},t.prototype.count=function(){return this._count},t}(),i=function(t){function i(){t.apply(this,arguments),this.centerX=0,this.centerY=0,this.zoom=1,this.hoverNode=null,this.hoverLink=null,this.hoverItem=null,this.lastClickedNode=null,this.selection=[],this.selectionSet=new e,this.notifyChanges=!0,this.lastNotifiedSelectionSet=new e,this.autoZoomMode=!1,this.layoutActive=!1}return n(i,t),i.prototype.xyInChart=function(t,e){return t>=this.x0&&t=this.y0&&et&&this.y+r.y0*si},t.prototype.paintSelection=function(t,e,i){var n=this.hWidth*(1+e)+i;t.moveTo(this.x,this.y),t.arc(this.x,this.y,n,0,2*Math.PI),t.closePath()},t.prototype.paint=function(t,e,i){this.paintBasicShape(t),i&&(this.image=this.nodesLayer.getNodeImage(this.node),this.paintDetails(t,e))},t.prototype.paintBasicShape=function(t){var e=d.Graphics.beginStrokeAndFill(t,this.node);if(this.hWidth!==this.hHeight){var i=this.x+this.hHeight-this.hWidth;e.moveTo(i,this.y-this.hWidth),e.arc(i,this.y,this.hWidth,-Math.PI/2,Math.PI/2,!1),i=this.x-this.hHeight+this.hWidth,e.lineTo(i,this.y+this.hWidth),e.arc(i,this.y,this.hWidth,.5*Math.PI,1.5*Math.PI,!1),e.closePath()}else e.moveTo(this.x+this.hWidth,this.y),e.arc(this.x,this.y,this.hWidth,0,s,!1);d.Graphics.endStrokeAndFill(t,e,this.node)},t.prototype.paintDetails=function(t,e){this.image&&this.basicPaintImage(t),this.paintLabel(t,e)},t.prototype.basicPaintImage=function(t,e){if(void 0===e&&(e=1),this.image){var i,n,s=0,r=0;if(this.node.imageSlicing){var a=this.node.imageSlicing;s=a[0],r=a[1],i=a[2],n=a[3]}else i=this.image.width,n=this.image.height;d.Graphics.drawImageInSquare(t,this.image,s,r,i,n,this.x-this.hHeight+this.hWidth,this.y,this.hWidth*e)}},t.prototype.paintLabel=function(t,e){var i=this.nodesLayer.style.nodeLabelScaleBase;if(this.node.hovered&&(i=d.Helpers.toleranceMin(i,this.hWidth,.9)),this.currentLabel){var n=this.hWidth/i,s=this.currentLabel,r=1;if(this.node.labelStyle.scaleWithSize?r=n:this.node.labelStyle.scaleWithZoom&&(r=this.zoom),e.measure(t,s),s.hheight>1.5){var a=this.getLabelPosition(s,r);e.paint(t,a.x,a.y,r,s)}}},t.prototype.getLabelPosition=function(t,e){return{x:this.x,y:this.y+this.hWidth+t.hheight*e*.8+(t.style.margin||0)*this.zoom}},t.prototype.distanceToEdge=function(t,e,i,n){return t},t.prototype.hitTest=function(t,e,i,n){var s,r=this.node,a=r.renderHheight*i,o=r.renderHwidth*i,l=r.x,h=r.y;if(a0){for(var i=[],n=[],s=0;s0||n.length>0)&&this.paintSelection(t,i,n)}var a=this.links(),o=this._makeHoveredLast(a,this.scene.hoverLink);this.paintLinks(t,a),this._restoreHovered(a,o);var l=this.nodes(),c=this._makeHoveredLast(l,this.scene.hoverNode);this.paintNodes(t,l),this._restoreHovered(l,c)},e.prototype.clearObjects=function(){for(var t=0,e=this.nodes();t=0)break}else if(m.style.zIndex<0)continue;var v=m.style.x||0,y=m.style.y||0,S=m.style.px||0,b=m.style.py||0,C=e+n*S+v,x=i+s*b+y;h=m.style.scaleWithSize?s/(m.style.hoverEffect?c:a):m.style.scaleWithZoom?m.style.hoverEffect?u:r:1,p.measure(f,m),m.hheight>1.5&&p.paint(f,C,x,h,m)}},e.prototype.getNodesSceneZoom=function(){return this.scaleNodesWithZoom?1:1/this.scene.zoom},e.prototype.getGeometry=function(){var t=this.scene.toDisplayTransform(),e=t.xm,i=t.xa,n=t.ym,s=t.ya,r=this.bounds.x0,a=this.bounds.x1,o=this.bounds.y0,l=this.bounds.y1,h=(r-i)/e,u=(a-i)/e,c=(o-s)/n,d=(l-s)/n,p=this.scaleNodesWithZoom?this.scene.zoom:1,f=this.scaleLinksWithZoom?this.scene.zoom:1;return{txm:e,txa:i,tym:n,tya:s,zoom:p,linkZoom:f,x0s:r,x1s:a,y0s:o,y1s:l,x0w:h,y0w:c,x1w:u,y1w:d}},e.prototype._makeHoveredLast=function(t,e){var i=t.length;if(i<2||!e||e===t[i-1])return i-1;for(var n=0;n0){l=this.layer.modifiedNodes;for(var h in l){var u=l[h];this.applyStyleRules(u,this.nodeRules)}}if(this.linkRules.length>0){c=this.layer.modifiedLinks;for(var h in c){var d=c[h];this.applyStyleRules(d,this.linkRules)}}},t.prototype.postprocessLayer=function(t){var e=this.layer.modifiedNodes;for(var i in e){var n=e[i];this.postprocessNode(n)}var s=this.layer.modifiedLinks;for(var i in s){var r=s[i];this.postprocessLink(r)}},t.prototype.postprocessItems=function(t){for(var e=t.currentItems,i=t instanceof h?d.SettingsMapping.ItemsChartSettingsNodeItem:d.SettingsMapping.ItemsChartSettingsLinkItem,n=this.styleSettings.item,s=0;s2){if(e.measure(t,i),this._computeScale(),this.image){var n=this.image,s=this.x-this.hHeight,r=this.y-this.imSize/2;if(this.node.imageSlicing){var a=this.node.imageSlicing;d.Graphics.drawImageHighQuality(t,n,a[0],a[1],a[2],a[3],s,r,this.imSize,this.imSize)}else d.Graphics.drawImageHighQuality(t,n,0,0,n.width,n.height,s,r,this.imSize,this.imSize)}e.paint(t,this.x+this.leftOffset,this.y,this.scale,i),d.Graphics.clearShadow(t)}}else this.basicPaintImage(t)},e.prototype._computeScale=function(){this.scale=this.hWidth/this.currentLabel.hheight,this.image&&(this.leftOffset=this.hWidth,this.imSize=2*this.hWidth)},e}(r);t.TextShape=A;var T=function(t){function e(){t.apply(this,arguments)}return n(e,t),e.prototype.postProcessLabel=function(t,e){if(this.nodesLayer.chart.assetsLoaded){var i=this.node.labelStyle;i.backgroundStyle.fillColor="transparent";var n=this.currentLabel;null==n?n=this.currentLabel=new d.Label(i,!0):n.style=this.node.labelStyle,n.text=this.node.label.toString(),n.style.aspectRatio=1,n.style.image=null}},e.prototype.distanceToEdge=function(t,e,i,n){return r.prototype.distanceToEdge.call(this,t,e,i,n)},e.prototype._computeScale=function(){var t=Math.sqrt(this.currentLabel.hwidth*this.currentLabel.hwidth+this.currentLabel.hheight*this.currentLabel.hheight);if(this.image){var e=this.currentLabel.lineHeight+2*this.currentLabel.hwidth,i=(e*e+this.currentLabel.hheight*this.currentLabel.hheight)/2/e;i>t&&(this.leftOffset=i-t,t=i)}this.scale=this.hWidth/t,this.image&&(this.imSize=this.currentLabel.lineHeight*this.scale)},e}(A);t.RoundTextShape=T;var M={a0x:0,a0y:-1,a1x:.556548642145067,a1y:-1,a2x:1,a2y:-.5534547954623581,b0x:1,b0y:0,b1x:1,b1y:.808869027157099,b2x:0,b2y:1.2870402200068753,apexX:0,apexY:1.878652526641458,imageRadius:.6170212765957447},k=[M.a0x,M.a0y,M.a1x,M.a1y,M.a2x,M.a2y,M.b0x,M.b0y,M.b1x,M.b1y,M.b2x,M.b2y,M.apexX,M.apexY],P=d.Helpers.reversePolyline(d.Geometry.transformPolyline(k,-1,0,1,0)),I=[0,-1,.7095605708093294,-.7046444467621514,1,0,1,0,.4313896533498214,.9021657092700437,1,0],D=d.Helpers.reversePolyline(d.Geometry.transformPolyline(I,-1,0,1,0)),F=function(t){function e(){t.apply(this,arguments)}return n(e,t),e.prototype.postProcess=function(e,i,n){t.prototype.postProcess.call(this,e,i,n),this.node.bounds.addBounds(0,0,0,this.node.targetHHeight*M.apexY),this.node.shapeAnchorX=0,this.node.shapeAnchorY=this.node.radius*M.apexY},e.prototype.getAnchor=function(){return{x:0,y:this.hWidth*M.apexY}},e.prototype.adaptToViewport=function(e,i,n,s,r){t.prototype.adaptToViewport.call(this,e,i,n,s,r),this.controlPoints=d.Geometry.transformPolyline(k,this.hWidth,this.x,this.hHeight,this.y),this.reverseControlPoints=d.Geometry.transformPolyline(P,this.hWidth,this.x,this.hHeight,this.y)},e.prototype.paintSelection=function(t,e,i){var n=this.hWidth*e+i,s=d.Geometry.outlinePolylineByVectors(this.controlPoints,I,n),r=d.Geometry.outlinePolylineByVectors(this.reverseControlPoints,D,n);t.moveTo.apply(t,s.slice(0,2)),t.bezierCurveTo.apply(t,s.slice(2,8)),t.bezierCurveTo.apply(t,s.slice(8,14)),t.arc(this.controlPoints[12],this.controlPoints[13],n,0,Math.PI,!1),t.bezierCurveTo.apply(t,r.slice(2,8)),t.bezierCurveTo.apply(t,r.slice(8,14)),t.closePath()},e.prototype.paintBasicShape=function(t){var e=d.Graphics.beginStrokeAndFill(t,this.node);e.beginPath(),e.moveTo.apply(e,this.controlPoints.slice(0,2)),e.bezierCurveTo.apply(e,this.controlPoints.slice(2,8)),e.bezierCurveTo.apply(e,this.controlPoints.slice(8,14)),e.bezierCurveTo.apply(e,this.reverseControlPoints.slice(2,8)),e.bezierCurveTo.apply(e,this.reverseControlPoints.slice(8,14)),e.closePath(),d.Graphics.endStrokeAndFill(t,e,this.node)},e.prototype.paintDetails=function(t,e){this.image&&this.basicPaintImage(t,M.imageRadius),this.paintLabel(t,e)},e.prototype.getLabelPosition=function(t,e){return{x:this.x,y:this.y-this.hWidth-t.hheight*e*1.1}},e.prototype.distanceToEdge=function(t,e,i,n){var s=e,r=t*M.apexY,a=d.Geometry.rayIntersectsSegment(0,0,i,n,0,r,s,0),o=d.Geometry.rayIntersectsSegment(0,0,i,n,-s,0,0,r),l=Math.min(a,o);return l<1/0?l:t},e}(r);t.DropletShape=F;var N=function(t){function e(){t.apply(this,arguments)}return n(e,t),e.prototype.calcHalf=function(t,e){return this.node.aspectRatio>1?{hWidth:t,hHeight:t/this.node.aspectRatio}:{hWidth:e*this.node.aspectRatio,hHeight:e}},e.prototype.render=function(t,e,i){var n=this.calcHalf(this.hWidth,this.hHeight),s=n.hHeight,r=n.hWidth;s=s*(1+e)+i,r=r*(1+e)+i,t.moveTo(this.x,this.y),t.moveTo(this.x-r,this.y-s),t.lineTo(this.x+r,this.y-s),t.lineTo(this.x+r,this.y+s),t.lineTo(this.x-r,this.y+s),t.lineTo(this.x-r,this.y-s)},e.prototype.paintBasicShape=function(t){var e=d.Graphics.beginStrokeAndFill(t,this.node);this.render(e,0,0),d.Graphics.endStrokeAndFill(t,e,this.node)},e.prototype.paintSelection=function(t,e,i){this.render(t,e,i),t.closePath()},e.prototype.distanceToEdge=function(t,e,i,n){var s=this.calcHalf(t,e);return Math.min(s.hHeight/Math.abs(n),s.hWidth/Math.abs(i))},e.prototype.hitTest=function(t,e,i,n){var s=this.node,r=this.calcHalf(s.renderHwidth*i,s.renderHheight*i),a=Math.max(Math.abs(t-s.x)-r.hWidth,Math.abs(e-s.y)-r.hHeight);return a<0?0:Math.min(a,n)},e}(r);t.RectangleShape=N;var E=function(t){function e(){t.apply(this,arguments),this.multilinkSpacing=10,this.nodeRadiusExtent=[10,150],this.linkRadiusExtent=[.6,30],this.linkStrengthExtent=[.1,1],this.linkLengthExtent=[.3,150],this.nodeAutoScaling=null,this.linkAutoScaling=null,this.linkStrengthAutoScaling=null,this.linkLengthAutoScaling=null,this.hiddenLinks={lineColor:"rgba(100,100,100,0.3)",lineWidth:1,size:7},this.fadeTime=600}return n(e,t),e}(m);t.SettingsNodesLayerStyle=E;var z=function(t){function e(e,i,n){t.call(this,e,i),this.g=null,this.fadeout=n,this.styleSettings=e}return n(e,t),e.prototype.updateLayer=function(e,i){ void 0===i&&(i=!1),this.nodeRadiusChanged=d.Helpers.hasProperties(this.layer.newNodes)||d.Helpers.hasProperties(this.layer.deletedNodes)||this.styleSettings.allObjectsStyleFunction&&this.layer.hasStyleChanges()||this.nodeRules.length>0,this.linkRadiusChanged=d.Helpers.hasProperties(this.layer.newLinks)||d.Helpers.hasProperties(this.layer.deletedLinks)||this.styleSettings.allObjectsStyleFunction&&this.layer.hasStyleChanges()||this.linkRules.length>0,t.prototype.updateLayer.call(this,e,i)},e.prototype.postprocessLayer=function(t){this.g=t.context;var e=this.layer,i=this.styleSettings.removedColor;this.itemRenderer=t.labelRenderer;for(var n in e.modifiedLinks){var s=e.modifiedLinks[n];this.fadeout&&s.relevance<1&&(s.fillColor&&(s.fillColor=d.Colors.blend(i,s.fillColor,s.relevance)),s.lineColor&&(s.lineColor=d.Colors.blend(i,s.lineColor,s.relevance)),s.length=.2+(s.length-.2)*s.relevance),this.postprocessLink(s)}for(var r in e.modifiedNodes){var a=e.modifiedNodes[r];this.fadeout&&a.relevance<1&&(a.fillColor&&(a.fillColor=d.Colors.blend(i,a.fillColor,a.relevance)),a.lineColor&&(a.lineColor=d.Colors.blend(i,a.lineColor,a.relevance)))}var o=this.layer.nodes();if(this.nodeRadiusChanged||this.fadeout&&t.changes.navigation){this.computeNodeSize(o,this.styleSettings.nodeAutoScaling,this.styleSettings.nodeRadiusExtent);for(var l=0;le.targetRadius?1:-1})}d.Helpers.sort(o,function(t,e){return t.zindex-e.zindex})},e.prototype.updateLink=function(e){var i=e.radius;t.prototype.updateLink.call(this,e),i!==e.radius&&(this.linkRadiusChanged=!0)},e.prototype.updateNode=function(e){var i=e.radius;t.prototype.updateNode.call(this,e),i!==e.radius&&(this.nodeRadiusChanged=!0),null==e.label&&e.data&&(e.label=e.data.id)},e.prototype.computeNodeSize=function(t,e,i){var n=i[0],s=i[1];if("linear"===e||"logarithmic"===e||"square"===e){for(var r=1/0,a=-(1/0),o=0;o=a)for(var o=0;o=a)for(var o=0;o=a)for(var o=0;o=a)for(var o=0;o"+this.scene.settings.localization.loadingLabel+"":this.contents}else n=i.label;a(n),this.updateButtons(),e.showData?(this.details.innerHTML=JSON.stringify(i.data,null," "),this.detailsDiv.style.display="block"):(this.detailsDiv.style.display="none",null==n&&0===this.buttons.length&&this.hideMenu())},e.prototype.updateXY=function(){var t,e,i,n,s,r,a=12;if(this.node){var o=this.scene.toDisplay(this.node.x,this.node.y);s=o.x,r=o.y,t=r-this.node.renderHheight-a,n=r+this.node.renderHheight+a,e=s-this.node.renderHheight-a,i=s+this.node.renderHheight+a}else t=n=r=this.y,e=this.x-a,i=this.x+a;var l=this.chart.getRootChart().scene,h=l.x0,u=l.x0+l.width,c=this.popup.offsetWidth,d=this.popup.offsetHeight;r=Math.max(Math.min(r,l.y0+l.height-d),l.y0),i+c<=u?s=i:e-c>=h?s=e-c:(s=Math.max(e-c/2,h),r=n),this.popup.style.left=s+"px",this.popup.style.top=r+"px"},e.prototype.buildDefaultButton=function(t,e){this.chart.error("The menu does not support any named buttons.")},e.prototype.buildButton=function(t,e,i,n,s,r){var a=this,o=d.Helpers.createDom("a",e,i,this.popupActions);o.title=i,o.onclick=function(e){s&&s.call(a.chart.api,t,o),a.hideMenu(),e.preventDefault()},o.href="#",n&&n.call(this.chart.api,t,o),this.buttons.push({e:o,t:t,a:r})},e.prototype.buildButtons=function(){this.popupActions.innerHTML="",this.buttons=[];var t,e;this.node?(t=this.scene.settings.nodeMenu,e=this.node):(t=this.scene.settings.linkMenu,e=this.link);var i=t.buttons;if(i)for(var n=0;n1&&(d.Helpers.warn("One or more nodes defined more than one aura. It is recommended to set `overlap: true` in the chart configuration to better handle this scenario."),this._overlapWarning=!0):r=[r];for(var a=0;a0&&(this._polygons=[]));i&&this._events.notifySceneChanges({settingsChanges:{auras:{}}});var l=e.changes,h=l.settingsChanges;(i||!this._auras||l.bounds||h&&h.auras)&&this.reinitialize(e),this.reset(),this.stage1(t),this.stage2(),this.stage3()}},t.prototype.ensureAura=function(t){var e=this._settings,i=this._autoAuraCounter,n=e.defaultColors;if(!n||!n.length)return!1;var s=e.style[t];s||(s=d.Helpers.realClone(this._settings.defaultStyle)||{},e.style[t]=s);var r=!1;return void 0===s.lineWidth&&(s.lineWidth=1,r=!0),void 0===s.fillColor&&(s.fillColor=n[i],this._autoAuraCounter=(i+1)%n.length,r=!0),null==s.showInLegend&&(s.showInLegend=!0),null==s.enabled&&(s.enabled=!0),null==s.zIndex&&(s.zIndex=0),r},t.prototype.reset=function(){for(var t=this._cellEdges,e=0;e-P&&v-P&&y=a-r))for(var N=C-F,E=-D;E=o-r)){var z=x-E,O=Math.sqrt(N*N+z*z)-I;if(Os?(s=a,e[n]=0,n=i+r):a>0&&(e[i+r]=0)}},t.prototype.stage3FindEdge=function(t,e){var i=this._cells,n=this._cellEdges,s=this._settings,r=s.drawLimit,a=this._edgeFinderDeltas,o=[e],l=e,h=2,u=0,c=0,p=s.overlap,f=0,g=0;do{for(var m=n[l],v=void 0,y=(h+5)%8,S=y,b=!1;S=r)){b=!0;break}if(!b){l!==e&&d.Helpers.error("Edge finder stuck");break}if(S%=8,(h!==S||++f>5)&&(0===u&&(u=7===S?7:1,c=7===S?6:2),(!p||h!==(S+u)%8&&h!==(S+c)%8)&&o.push(l),f=0),m===-1&&(n[l]=S),h=S,l=v,++g>1e4){d.Helpers.error("Edge finder run into a loop");break}}while(l!==e);o[o.length-1]!==e&&o.push(e),t.push(o)},t.prototype.stage3=function(){for(var t=this._cellLength,e=this._widthCells*t,i=this._cells,n=this._cellEdges,s=this._settings,r=s.drawLimit,a=e-t,o=this._polygons,l=0,h=i.length-t,u=0;u=a||c=r&&n[p]<0&&(this.stage3FindEdge(o[p%t],p),++l>1e4)){d.Helpers.error("Edge finder found too many polygons");break}}}},t.prototype.paintPolygons=function(t){if(this._settings.enabled){var e=t.context;e.save();for(var i=this._settings,n=i.cellSize,s=this._marginCells,r=s*n-n/2,a=this._cellLength,o=this._widthCells,l=this._auras,h=this._polygons,u=this._scene,c=-u.centerX*u.zoom%n,p=-u.centerY*u.zoom%n,f=1;f0)||n>a;var o=[],l=[];if(i){for(var h=0,u=this.nodes();h0?Math.max(0,Math.pow(.2,n/a)):0,m=.01,h=0,u=this.nodes();h=.5||Math.abs(S-b)/Math.max(S,b)>=.5)&&(r=!0),s=!0,c.hHeight=y*g+v*(1-g),c.hWidth=b*g+S*(1-g),Math.abs(c.hHeight-v)this.style.linkDetailMinZoom})},i.prototype.paintNodes=function(t,e){var i=this.getGeometry();t.animating=this.paintNodesImpl(t,e,{geometry:i,paintDetails:i.zoom>this.style.nodeDetailMinZoom},t.timeStamp)||t.animating},i.prototype.updateMultilinks=function(){if(!this.hasTopologyChanges())return this.multilinks;for(var t=this.links(),e={},i=[],n=0;ny;if(G>25){var q=Math.sqrt(G);if(E&&(z=Math.atan2(V,U)*(180/Math.PI),P>=D&&(z-=180),k.currentItems[0].style.angle=z),k.toPieValue>0){var Z=H+L,X=Z+A+T*H;this.paintLinkPie(s,D,F,Z,X,k.toPie0,k.toPie1,k.toPieColor),H=X}if(qk.to.id&&(at=-at),k.currentCenterOffset=at*g,P-=J*at,D-=J*at,I+=K*at,F+=K*at}else k.currentCenterOffset=0;if(k.renderPoints={x0:P,y0:I,x1:D,y1:F},k.renderBounds=new d.Rect(P,I,D,F),Y&&k.currentItems&&!k.removed&&(k.currentItems.sort(function(t,e){return t.style.zIndex-e.style.zIndex}),this.paintLinkItems(s,t.labelRenderer,h,W/w,P,I,K,J,q,W,k.currentItems,k.renderBounds,j,!0)),s.beginPath(),k.fromDecoration&&this.paintLinkDecoration(s,P,I,K,J,et,k.fromDecoration,k.fillColor),k.toDecoration&&this.paintLinkDecoration(s,D,F,-K,-J,et,k.toDecoration,k.fillColor),k.lineDash){var ot=P+J*W,lt=I-K*W,ht=P-J*W,ut=I+K*W;if(k.lineDash.length>0)for(var ct=k.lineDash,dt=ct.length,pt=ct.reduce(function(t,e){return t+e})*h,ft=0,gt=0;gt<=q/pt;gt++){for(var mt=0;mt<=dt-1;mt+=2){var vt=gt*pt+ft;if(vt>q-W)break;var yt=vt+ct[mt]*h,St=yt>=q-W?q-W:yt;s.moveTo(ot+vt*K,lt+vt*J),s.lineTo(ht+vt*K,ut+vt*J),s.lineTo(ht+St*K,ut+St*J),s.lineTo(ot+St*K,lt+St*J),s.closePath(),ft+=h*(ct[mt]+ct[mt+1])}ft=0}else for(var bt=Math.max(5,3*W),gt=0;gt<=q/bt;gt+=2){var vt=gt*bt,St=Math.min((gt+1)*bt,q);s.moveTo(ot+vt*K,lt+vt*J),s.lineTo(ht+vt*K,ut+vt*J),s.lineTo(ht+St*K,ut+St*J),s.lineTo(ot+St*K,lt+St*J),s.closePath()}}else s.moveTo(P+J*W,I-K*W),s.lineTo(P-J*W,I+K*W),s.lineTo(D-J*W,F+K*W),s.lineTo(D+J*W,F-K*W),s.closePath();d.Graphics.fill(s,k),Y&&k.currentItems&&!k.removed&&this.paintLinkItems(s,t.labelRenderer,h,W/w,P,I,K,J,q,W,k.currentItems,k.renderBounds,j,!1)}else if(k.fillColor){if(s.beginPath(),s.lineWidth=Math.max(.1,2*W),s.strokeStyle=k.fillColor,k.dashed)for(var q=Math.sqrt(G),Q=1/q,K=U*Q,J=V*Q,bt=Math.max(5,3*W),gt=0;gt<=q/bt;gt+=2){var vt=gt*bt,St=Math.min((gt+1)*bt,q);s.moveTo(P+vt*K,I+vt*J),s.lineTo(P+St*K,I+St*J)}else s.moveTo(P,I),s.lineTo(D,F);s.stroke(),k.renderPoints={x0:P,y0:I,x1:D,y1:F},k.renderBounds=new d.Rect(P,I,D,F)}}}}return!1},i.prototype.paintNodesImpl=function(e,i,n,s){var r=!1,a=e.context,o=n.geometry.txm,l=n.geometry.txa,h=n.geometry.tym,u=n.geometry.tya,c=n.geometry.zoom,p=n.geometry.x0s,f=n.geometry.x1s,g=n.geometry.y0s,m=n.geometry.y1s,v=1/o,y=n.paintDetails,S=this.style.nodeDetailMinSize*this.style.nodeDetailMinSize*v*v,b=this.style.hiddenLinks,C=this.style.nodeLabelScaleBase;a.textAlign="center",a.textBaseline="middle";for(var x=this.style.removedColor,w=0;wS||L.hovered;if(E<1&&(a.globalAlpha=E),H&&!L.removed){var _=L.dataLinks.length-L.links.length;if(_>0)if(this.useFadeout&&L.relevance<1){var R=b.lineColor;b.lineColor=d.Colors.blend(x,R,L.relevance),this.paintHiddenLinks(a,L,A.x,A.y,A.hWidth,A.hHeight,_,b,b.size*c),b.lineColor=R}else this.paintHiddenLinks(a,L,A.x,A.y,A.hWidth,A.hHeight,_,b,b.size*c);L.items.sort(function(t,e){return t.zIndex-e.zIndex}),this.paintNodeDetails(L,A.x,A.y,A.hHeight,A.hWidth,c,C,e,!0)}A.paint(a,e.labelRenderer,H),H&&!L.removed&&this.paintNodeDetails(L,A.x,A.y,A.hHeight,A.hWidth,c,C,e,!1),E<1&&(a.globalAlpha=1)}}if(this.scene.settings.advanced.perNodeLoadingIndicator){var B=this.scene.settings.advanced.style.loadingArcStyle;a.save(),a.lineCap="round",a.lineWidth=B.lineWidth,a.strokeStyle=B.lineColor;var U=s/1400;U=(U-Math.floor(U))*(2*Math.PI);for(var V=U+Math.PI/2,w=0;w=0)break}else if(y.style.zIndex<0)continue;var S=y.x||0,b=y.y||0,C=y.style.px||0,x=y.style.py||0,w=y.style.lx||0,L=y.style.ly||0;C=l*(C+1)*.5+w,x=x*h+L;var A=s+a*C-o*x+S,T=r+o*C+a*x+b,M=0;M=y.style.scaleWithSize?y.style.hoverEffect?m:n:y.style.scaleWithZoom?y.style.hoverEffect?g:i:1,e.paint(t,A,T,M,y),c.addRect(y.currentBounds)}},i.prototype.paintHiddenLinks=function(t,e,i,n,s,r,a,o,l){var h,u,c=2*Math.PI;if(e.links.length>0){for(var d=0,p=0,f=0;f=0;y--){var S=v[y];if(!S.removed&&!S.invisible&&d.Geometry.distanceToRect(r-S.x,a-S.y,S.outerBounds)0){var b=n.hoverLink;if(b&&b.layer===this&&!b.invisible){var C=b.targetRadius/2*l,x=b.renderPoints,w=d.Geometry.distanceToSegmentSq(x.x0,x.y0,x.x1,x.y1,t,e);if(w<=(p+C)*(p+C)){p=0,h=b;var m=this.findItem(t,e,h,i);if(m&&(c=m.item,p=Math.min(p,m.distance)),p<=0)return{object:h,details:c}}}}if(p>0)for(var L=0,A=this.links();Li&&(h=null,c=null),{object:h,details:c}},i.prototype.findItem=function(t,e,i,n){if(!i)return null;var s=n*n,r=this.scene.hoverItem;if(r&&r.hwidth&&i.currentItems.indexOf(r)>-1){var a=d.Geometry.distanceToRect(t,e,r.currentBounds,!0);if(a<=s)return{item:r,distance:Math.sqrt(a)}}var o=null,l=n*n;if(i instanceof h){var u=i.shape.currentLabel;if(u&&u.currentBounds){var a=d.Geometry.distanceToRect(t,e,u.currentBounds,!0);as||!o?null:{item:o,distance:Math.sqrt(l)}},i.prototype.getGraphBounds=function(t){if(void 0===t&&(t=this.nodes()),!t||!t.length)return new d.Rect(0,0,0,0);for(var e=d.Rect.createEmpty(),i=0;i0&&(r+=o.toPieValue,e.push(o),o._angle=Math.atan2(o.to.y-o.from.y,o.to.x-o.from.x))}if(r>0){e.sort(function(t,e){return t._angle-e._angle});for(var l=t/r,h=0,u=0,c=0;c0&&this.buildTreeRecursive(t,0,e,this.root);for(var i=0;i<=e-1;i++)t[i].repulsiveForceX=0,t[i].repulsiveForceY=0,t[i].repulsiveForceZ=0;this.calculateForces()},t.prototype.freeNode=function(t){t.left&&this.freeNode(t.left),t.right&&this.freeNode(t.right),t.left=this.freeNodeRoot,this.freeNodeRoot=t},t.prototype.newNode=function(){var t;return this.freeNodeRoot?(t=this.freeNodeRoot,this.freeNodeRoot=t.left,t.left=null,t.right=null,t.leafCount=0,t.sizeEstimate=0,t.forceLinkList.length=0):(t=new a,t.forceLinkList=[],t.leaves=new Array(this.maxLeafCount)),t.repulsiveForceX=0,t.repulsiveForceY=0,t.repulsiveForceZ=0,t},t.prototype.addForceLink=function(t,e){t.forceLinkList.push(e)},t.prototype.getMedianX=function(e,i,n){n-=1;for(var s=(i+n)/2|0;;){if(n<=i)return s;if(n===i+1&&e[i].x>e[n].x)return t._swap(e,i,n),s;var r=(i+n)/2|0;e[r].x>e[n].x&&t._swap(e,r,n),e[i].x>e[n].x&&t._swap(e,i,n),e[r].x>e[i].x&&t._swap(e,r,i),t._swap(e,r,i+1);for(var a=i+1,o=n;;){for(;;)if(a+=1,!(e[i].x>e[a].x))break;for(;;)if(o-=1,!(e[o].x>e[i].x))break;if(o=s&&(n=o-1)}},t.prototype.getMedianY=function(e,i,n){n-=1;for(var s=(i+n)/2|0;;){if(n<=i)return s;if(n===i+1)return e[i].y>e[n].y&&t._swap(e,i,n),s;var r=(i+n)/2|0;e[r].y>e[n].y&&t._swap(e,r,n),e[i].y>e[n].y&&t._swap(e,i,n),e[r].y>e[i].y&&t._swap(e,r,i),t._swap(e,r,i+1);for(var a=i+1,o=n;;){for(;;)if(a+=1,!(e[i].y>e[a].y))break;for(;;)if(o-=1,!(e[o].y>e[i].y))break;if(o=s&&(n=o-1)}},t.prototype.buildTreeRecursive=function(t,e,i,n){for(var s=t[e].x,r=t[e].y,a=s,o=r,l=e+1;l<=i-1;l++){var h=t[l],u=h.x,c=h.y;ua&&(a=u),co&&(o=c)}n.sizeEstimate=Math.max(a-s,o-r),n.sizeEstimate=n.sizeEstimate*n.sizeEstimate+.1,n.sizeEstimate*=2;var d=i-e;if(d<=this.maxLeafCount){n.leafCount=d;for(var u=0,c=0,p=0,f=0,l=0;l<=d-1;l++){var g=t[l+e];u+=g.x,c+=g.y,p+=g.z,f+=g.r,n.leaves[l]=g}var m=1/d;return n.r=f,n.x=u*m,n.y=c*m,void(n.z=p*m)}var v;v=a-s>o-r?this.getMedianX(t,e,i):this.getMedianY(t,e,i),v++;var y=this.newNode();n.left=y,this.buildTreeRecursive(t,e,v,y),y=this.newNode(),n.right=y,this.buildTreeRecursive(t,v,i,y);var S=1/d;n.r=n.right.r+n.left.r,n.x=(n.left.x*(v-e)+n.right.x*(i-v))*S,n.y=(n.left.y*(v-e)+n.right.y*(i-v))*S,n.z=(n.left.z*(v-e)+n.right.z*(i-v))*S},t.prototype.calculateForces=function(){var t=new Array(this.nodeCount),e=0,i=0;for(null!==this.root.left?(t[i]=this.root.left,i++,t[i]=this.root.right,i++,this.addForceLink(this.root.left,this.root.right)):(t[i]=this.root,i++);e0&&(u+=y/v,c+=1),this.idToIndex[g]=p,this.nodes[p]=m,h.hasOwnProperty(g)){var S=h[g],b=n[S];m.z=b.z,this.oldForceX[p]=a[S],this.oldForceY[p]=o[S],this.oldForceZ[p]=l[S]}else this.oldForceX[p]=0,this.oldForceY[p]=0,this.oldForceZ[p]=0}this.nodesForRepulsion=this.nodes.slice(),c>0?this.nodesAspect=Math.max(.3,u/c):this.nodesAspect=1}for(var p=0;p0){var m=u?e.initialLayoutMaxTime:e.incrementalLayoutMaxTime;this.layoutMovement=this.doForceLayout(o*c,r||t.changes.layout,a,h,m,u),t.animating=!0,l=!0}l&&(t.changes.position=!0)},e.prototype.placeNewNodes=function(){for(var t={},e=this.chart.layer,i=!1,n=0,s=e.nodes();n1)f=l/o,g=h/o,a=.5;else if(1===o){for(var m=0,v=0,y=0,c=0;c0){var b=Math.sqrt(v*v+y*y);if(b>0){var C=1/(b*m);v*=C,y*=C,f=u.x-v*u.hHeight*1.2,g=u.y-y*u.hHeight*1.2,a=.2}else f=u.x,g=u.y}else i=!0,f=u.x,g=u.y}else i=!0,f=0,g=0;r.x=f+(this.random.get()-.5)*a*(r.hHeight+1),r.y=g+(this.random.get()-.5)*a*(r.hHeight+1)}}return{newNodes:t,majorChanges:i}},e.prototype.doForceLayout=function(t,e,i,n,s,r){var a=this.chart.scene,o=this.chart.settings.layout,l=this.chart.layer,h=(a.width+1)/(a.height+1);h>0||(h=null);for(var u=a.settings.layout.aspectRatio?h:null,c=o.nodeSpacing,p=1,f=l.nodes(),g=!1,m=!1,v=0;v0,m=m||y.locked,g=g||1!==y.visibility}for(var S={},b=[],C=0,x=l.links();C1&&w.to.links.length>1,P=void 0;P=k||w.removed?.2:A,w.added&&(T=.2+(T-.2)*M,A=A*M+P*(1-M))}if(S.hasOwnProperty(L)){var I=S[L];I.strength=Math.max(A,I.strength),I.length=Math.max(T,I.length),I.visibility=Math.max(M,I.visibility)}else{var I={from:w.from,to:w.to,strength:A,length:T,visibility:M,direction:w.direction};S[L]=I,b.push(I)}}if(this.updateParams(c,p,u),r||d.Helpers.hasProperties(n)){for(var v=0;v1)for(var o=2*this.chart.settings.layout.nodeSpacing,l=e.getNodesBounds(i[0]).x1+o,r=1;r0;){for(var r=[],a=0;a0;){var o=void 0;if(1===r&&this.chart.settings.layout.twoRingRadialLayout){t=a[0];var l=e.getNodeSize(t);o=this.getSubnodes(t);for(var h=Math.floor(o.length/2),u=new Array(h),c=new Array(o.length-h),d=0;d0){for(var u=0,c=0;c=0;l--){for(var h=n[l],u=null,c=void 0,d=0;d0){c=h[d];break}if(c.node.x=e(c),c.levelIndex>0){i(h,null,c,r,a);var p=h[c.levelIndex-1],f=p.node.x+p.hWidth+r+c.hWidth;f>c.node.x&&(c.shift=f-c.node.x,c.node.x+=c.shift)}for(;;){u=c,c=null;for(var d=u.levelIndex+1;d0){c=h[d];break}if(null===c)break;c.node.x=e(c)+u.shift,c.shift=u.shift;for(var g=0,m=0,d=u.levelIndex+1;dS){var b=y-S;c.node.x+=b,c.shift+=b,S=y,i(h,u,c,r,a)}else if(0===m){var C=(S-u.hWidth-c.hWidth-g)/(c.levelIndex-u.levelIndex);i(h,u,c,C,0)}else{var x=(S-u.hWidth-c.hWidth-g-(v-m)*r)/m;i(h,u,c,r,x)}}i(h,u,null,r,a)}for(var w=0,l=0;l=this.dataSettings.requestMaxUnits)break;return 0===t.length?null:{nodes:t}},e.prototype.dataFunc=function(t,e,i){var n=this.dataSettings;if(n.dataFunction)n.dataFunction(t.nodes||null,e,i);else if(n.url){var s=[];if(t.nodes){for(var r="",a=0;a0){for(var f=!1,g=!1,m=0;m-1&&(f=!0,g=g||o.loaded)}f?g||(this.chart.error("Data response: loaded field was not set on any of the requested nodes!"),i=!1):(this.chart.error("Data response: Results set did not contain any of requested nodes!",t.nodes),i=!1)}return i},e.prototype.addVerifiedData=function(t,e){for(var i=this.updateGraph(e),n=0;n0?this.addData(this.genRandomGraph(this.dataSettings)):t.prototype.applyPreloadedData.call(this)},e.prototype.getNode=function(t,e,i){void 0===e&&(e=!0),void 0===i&&(i=null);var n=d.Helpers.hasProperty(this.nodes,t)?this.nodes[t]:null;if(i&&(i.loading=!1),n){if(this.settings.legend.enabled&&!this.chart.legend.isNodeVisible(n))return null;var s=this.settings.filters.nodeFilter;if(s){var r=d.Helpers.hasProperty(this.nodeToLinks,t)?this.nodeToLinks[t]:null;if(!s(n,r))return null}!n.loaded&&e&&(i&&(i.loading=!0),this.requestNodeData(t))}else e?(i&&(i.loading=!0),this.requestNodeData(t)):i&&(i.loading=this.isNodeLoading(t));return n},e.prototype.isNodeLoading=function(t){return this.pendingAllData||this.requestedAllData||d.Helpers.hasProperty(this.pendingNodes,t)||d.Helpers.hasProperty(this.requestedNodes,t)},e.prototype.getLinks=function(t,i){void 0===i&&(i=!0);var n=this.settings.legend.enabled,s=d.Helpers.hasProperty(this.nodes,t)?this.nodes[t]:null;if(!s)return i&&this.requestNodeData(t),[];if(n&&!this.chart.legend.isNodeVisible(s))return[];var r=d.Helpers.hasProperty(this.nodeToLinks,t)?this.nodeToLinks[t]:[],a=this.settings.filters.nodeFilter;if(a&&!a(s,r))return[];!s.loaded&&i&&this.requestNodeData(t);var o=this.settings.filters.linkFilter,l=this.settings.filters.nodeLinksProcessor,h=this.settings.filters.multilinkProcessor,u={};if(u[t]=!0,r.length>0&&(a||o||n)){for(var c=new Array(r.length),p=0,f=0;f=t||(h>0&&o.get()<=e&&n.push({from:"n"+u,to:"n"+(u-1)}),l>0&&o.get()<=e&&n.push({from:"n"+u,to:"n"+(u-a)}))}for(var c=0;c0){var o={id:"l"+r,from:a.id,to:n[i.get()*n.length|0].id};s.push(o)}n.push(a)}for(var r=s.length;r<=e-1;r++){var o={id:"l"+(r+1),from:n[i.get()*n.length|0].id,to:n[i.get()*n.length|0].id};s.push(o)}return{nodes:n,links:s}},e.prototype.genRandomTree=function(t,e){for(var i=new d.Random(31927832),n={id:"n0",loaded:!0},s=[n],r=[n],a=[];r.length0){this.scene.autoZoomMode&&this.autoZoom(!0)&&(t.changes.position=!0);var n=t.timeStamp,s=this.inertiaX.getValue(n),r=this.inertiaY.getValue(n),a=1/this.inertiaZ.getValue(n);s===this.scene.centerX&&r===this.scene.centerY&&a===this.scene.zoom||(this.scene.centerX=s,this.scene.centerY=r,this.scene.zoom=a,t.changes.position=!0),this.inertiaX.finished(n)&&this.inertiaY.finished(n)&&this.inertiaZ.finished(n)||(t.animating=!0)}else this.inertiaX.jump(this.scene.centerX),this.inertiaY.jump(this.scene.centerY),this.inertiaZ.jump(1/this.scene.zoom)},e.prototype._getInertiaAccelerations=function(){var t=this.scene.settings.interaction.zooming.autoZoomPositionEllasticity,e=.5*(this.scene.width+this.scene.height)*t;return{x:e,y:e,z:2*t}},e.prototype.autoZoom=function(t,e){var i=!1,n=this.computeAutoZoom("overview"===this.scene.autoZoomMode);if(null==n)return!1;var s=n.centerX,r=n.centerY,a=n.zoom,o=.01,l=1+o,h=1-o,u=1/this.inertiaZ.getTargetValue()/a,c=this._getInertiaAccelerations();(u>l||uo||p<-o)&&(t?this.inertiaX.setTarget(s,e,c.x):(this.inertiaX.jump(s),this.scene.centerX=s),i=!0);var f=this.scene.height,g=(this.inertiaY.getTargetValue()-r)*a/f;return(g>o||g<-o)&&(t?this.inertiaY.setTarget(r,e,c.y):(this.inertiaY.jump(r),this.scene.centerY=r),i=!0),i},e.prototype.computeAutoZoom=function(t,e,i){var n,s=this.scene;n=t?this.layer.getGraphBounds(e):this.layer.getNodeNeighborsBounds(s.lastClickedNode);var r=n.x0,a=n.y0,o=n.x1,l=n.y1;if(0===r&&0===o&&0===a&&0===l)return null;i&&(n.y0-=i[0],n.x1+=i[1],n.y1+=i[2],n.x0-=i[3]);var h=s.getVisibleBounds(),u=s.settings.interaction.zooming,c=(1-u.autoZoomSize)/2,d=c*n.w(),p=c*n.h(),f=Math.abs(h.x0-n.x0+d),g=Math.abs(h.x1-n.x1-d),m=Math.abs(h.y0-n.y0+p),v=Math.abs(h.y1-n.y1-p);if(f0){for(var m=0,v=0,y=0,S=0;S0&&(p=m/y,f=v/y)}var C,x;p&&f?(C=(s.centerX-p)/t+p,x=(s.centerY-f)/t+f):(C=p=s.centerX,x=f=s.centerY);var w=s.zoom*t,L=s.getVisibleBounds();if(ph){var A=void 0;A=L.x0>o&&L.x1>h?Math.max(h-L.x1,o-L.x0):L.x1c){var T=void 0;T=L.y0>l&&L.y1>c?Math.max(c-L.y1,l-L.y0):L.y1=0;n--){var s=i[n];if(!s.removed){var r=s.otherEnd(t);r!==t&&!r.removed&&r.expanded&&(r.expanded=!1,e.touchNode(r)),e.removeLink(s)}}return e.removeNode(t),!0},e.prototype.ensureLinkRemoved=function(t){if(!t||t.removed)return!1;var e=this.chart.layer;return!t.from.removed&&t.from.expanded&&(t.from.expanded=!1,e.touchNode(t.from)),!t.to.removed&&t.to.expanded&&(t.to.expanded=!1,e.touchNode(t.to)),e.removeLink(t),!0},e}(d.Navigator);t.Navigator=k;var P=function(t){function e(){t.apply(this,arguments),this.saveHack=null,this.retryList=[]}return n(e,t),e.prototype.executeAllSceneChanges=function(t){var e=this.retryList;this.retryList=[];for(var i=0;i0&&(t.changes.navigation||t.changes.dataArrived)&&this.executeAllSceneChanges(t)},e.prototype.canFocusNode=function(t){return!t.focused},e.prototype.canUnfocusNode=function(t){return t.focused},e.prototype.canExpandNode=function(t){return!t.expanded},e.prototype.canCollapseNode=function(t){return this.canHideNode(t)},e.prototype.canHideNode=function(t){for(var e=this.chart.layer,i=Object.keys(e.idToNode),n=0;n0},e}(k);t.ManualNavigator=P;var I=function(t){function e(){t.apply(this,arguments),this.hiddenNodes={},this.isInitialized=!1}return n(e,t),e.prototype.showNode=function(e,i){delete this.hiddenNodes[e],t.prototype.showNode.call(this,e,i)},e.prototype.hideNode=function(e,i){var n=this.chart.layer.idToNode;d.Helpers.hasProperty(n,e)&&(this.hiddenNodes[e]=!0,t.prototype.hideNode.call(this,e,i))},e.prototype.collapseNode=function(e,i){var n=this.chart.layer.idToNode;if(d.Helpers.hasProperty(n,e)){this.hiddenNodes[e]=!0;for(var s=n[e],r=0;r0&&(e.changes.newGraph=!0),!0})},e.prototype.onNewDataObject=function(){var t=this,e=this.chart.settings.navigation.initialNodes;(null==e||e.length<1)&&this.chart.scene.mainData.getAllNodes(),this.notifyNavigation(null,function(e){return t.updateGraphWithNewData(null,e),!1})},e.prototype.updateGraphWithNewData=function(t,e){if(this.isInitialized){var i,n=this.chart.layer,s=this.chart.scene.mainData,r=n.idToNode,a={};if(t){i=Object.keys(t);for(var o=0;o=this.chart.settings.navigation.numberOfFocusNodes){if(!this.chart.settings.navigation.autoUnfocus)return;this.focusNodes.pop()}this.focusNodes.unshift({id:t,assignedRelevance:e,calculatedRelevance:null}),d.Helpers.hasProperty(this.extraFlags,t)&&this.extraFlags[t]===D.Hidden&&delete this.extraFlags[t];var s=this.chart.scene.mainData.getLinks(t,!1);if(s)for(var n=0;nthis.chart.settings.navigation.numberOfFocusNodes&&(this.chart.error("Too many initialNodes. numberOfFocusNodes is "+this.chart.settings.navigation.numberOfFocusNodes+" but there are "+i+" nodes in initialNodes. Discarding excess focus nodes."),i=this.chart.settings.navigation.numberOfFocusNodes),this.focusNodes.length=i}else this.focusNodes=[];this.wasReset=!0,this.chart.notifyChartUpdate("init"),this.scheduleFullRecalculate()},e.prototype.save=function(){return{focusNodes:this.focusNodes,extraFlags:this.extraFlags}},e.prototype.restore=function(t){this.focusNodes=d.Helpers.realClone(t.focusNodes),this.extraFlags=d.Helpers.clone(t.extraFlags),this.scheduleFullRecalculate(),this.chart.notifyChartUpdate("restore")},e.prototype.onNewDataObject=function(){for(var t=this.chart.scene.mainData,e=Object.keys(this.chart.layer.idToNode),i=0;i1)for(var p=null==n.focusNodeTailExpansionRadius?n.focusNodeExpansionRadius:n.focusNodeTailExpansionRadius,f=Math.max(n.focusNodeExpansionRadius+1,1),g=Math.max(p+1,1),m=(f-g)/(n.numberOfFocusNodes-1),u=0;u=1?b.assignedRelevance:b.calculatedRelevance,c.relevance=c.baseRelevance,c.showTimestamp=-(1/0),v.push(c),y[b.id]=!0,S[b.id]=!0,this.wasReset&&(this.wasReset=!1,e.changes.newGraph=!0)}for(var x=Object.keys(this.extraFlags),u=0;u0,L=0;L=2&&delete this.extraFlags[N];var T=d.Helpers.hasProperty(o,N)?o[N]:null,O=!1;if(!T||T.removed){if(z<=0)continue;var C=r.getNode(N);if(!C)continue;if(c.showTimestamp>a){M>c.showTimestamp&&(M=c.showTimestamp);continue}this.ensureNode(C,r.getLinks(N)),T=o[N],T.relevance=z,T.baseRelevance=k,T.showTimestamp=t,O=!0}else T.relevanceMath.max(this.chart.settings.navigation.minNumberOfFocusNodes,1)},e.prototype.canExpandNode=function(t){return!t.expanded},e.prototype.canCollapseNode=function(t){for(var e=0;e0&&(t.changes.position||t.changes.selection||this.manager.chart.layer.hasTopologyChanges())&&this.updateSelection()},e.prototype.updateSelection=function(){for(var t=this.manager.chart.layer.nodes(),e=this.manager.chart.scene,i=e.fromDisplay(this.startX,this.startY),n=e.fromDisplay(this.lastX,this.lastY),s=Math.min(i.x,n.x),r=Math.min(i.y,n.y),a=Math.max(i.x,n.x),o=Math.max(i.y,n.y),l=0;l=s&&h.x<=a&&h.y>=r&&h.y<=o?this.selectedNodes[h.id]||(this.selectedNodes[h.id]=h,h.selectionLock=!0,h.selected||e.addToSelection(h)):this.selectedNodes[h.id]&&(delete this.selectedNodes[h.id],h.selectionLock=!1,h.selected&&e.removeFromSelection(h)))}},e.prototype.paintScene=function(t){if(this.pointers.length>0){var e=this.manager.chart.settings.style.dragSelection,i=d.Graphics.beginStrokeAndFill(t.context,e);i.rect(this.startX-.5,this.startY-.5,this.lastX-this.startX,this.lastY-this.startY),d.Graphics.endStrokeAndFill(t.context,i,e)}},e}(e);t.MultiSelectGesture=i;var s=function(t){function e(){t.apply(this,arguments),this.dragPointers={}}return n(e,t),e.prototype.addPointer=function(e,i){t.prototype.addPointer.call(this,e,i);var n=this.manager.chart.scene.selection.filter(function(t){return!t.dragging});n.indexOf(i.object)<0&&n.push(i.object);for(var s=n.filter(function(t){return t instanceof u.Node}),r=0;rd*d}this.moveNodes(i.nodes,a,o,l),this.manager.chart.events.notifySceneChanges({coordinates:!0})}},e.prototype.moveNodes=function(t,e,i,n){for(var s=this.manager.chart.scene,r=s.getVisibleBounds(),a=s.zoom,o=this.manager.chart.settings.interaction.selection.allowMoveNodesOffscreen,l=this.manager.chart.layer,h=0;h=b?(h=this.x1,u=this.y1,c=t,p=e,f=Math.sqrt(S)):(h=this.x2,u=this.y2,c=i,p=n,f=Math.sqrt(b));var C=c-h,x=p-u,w=C/f,L=x/f,A=(Math.PI+l)/2,T=Math.PI-A,M=d.Geometry.rotateVector(w,L,Math.sin(T),Math.cos(T)),k=d.Geometry.rotateVector(w,L,Math.sin(A),Math.cos(A)),P=d.Geometry.lineIntersectsLine(0,0,M.x,M.y,C,x,C+k.x,x+k.y);if(P===1/0)return!1;for(var I,D=h+M.x*P,F=u+M.y*P,N=this.manager.chart.scene.fromDisplay(D,F),E=N.x,z=N.y,O=this.manager.chart.layer.nodes(),H=Math.sin(l),_=Math.cos(l),R=0;R0){var r=this.assignPointer(t,e,this.ignoreGesture);s&&(r.longPressGesture=this.multiSelectGesture)}else if(n&&this.panGesture.pointers.length>0)this.reassignToTwoFinger(this.panGesture.pointers[0],t,e);else if(n&&this.postponeGesture.pointers.length>0)this.reassignToTwoFinger(this.postponeGesture.pointers[0],t,e);else if(n&&this.nodeDragGesture.pointers.length>0)this.reassignToTwoFinger(this.nodeDragGesture.pointers[0],t,e);else{var r=this.assignPointer(t,e,i.panning.enabled&&this.panGesture.pointers.length<1?this.panGesture:this.postponeGesture);s&&(r.longPressGesture=this.multiSelectGesture)}},l.prototype.assignNodePointer=function(t,e){var i=this.chart.settings.interaction,n=i.rotation.fingers||i.zooming.fingers;if(n&&this.panGesture.pointers.length>0)this.reassignToTwoFinger(this.panGesture.pointers[0],t,e);else if(n&&this.postponeGesture.pointers.length>0&&this.twoFingerGesture.pointers.length<1)this.reassignToTwoFinger(this.postponeGesture.pointers[0],t,e);else if(e.object.dragging){var s=this.assignPointer(t,e,this.postponeGesture);s.longPressGesture=this.ignoreGesture}else{var s=this.assignPointer(t,e,this.nodeDragGesture);s.longPressGesture=this.ignoreGesture}},l.prototype.updateSelection=function(t,e){var i=this.chart.settings.interaction.selection;if(i.enabled&&(e.object instanceof u.Node&&i.nodesSelectable||e.object instanceof u.Link&&i.linksSelectable)&&!e.object.selectionLock&&!e.object.dragging){var n=!1;if(t.shiftKey||t.ctrlKey)n=e.object.selected?this.chart.scene.removeFromSelection(e.object):this.chart.scene.addToSelection(e.object);else if(!e.object.selected){var s=this.chart.scene.selection.filter(function(t){return t.dragging||t.selectionLock});s.push(e.object),n=this.chart.scene.setSelection(s)}n&&this.chart.scene.notifySelectionChangesIfNeeded(this.chart,"user")}},l.prototype.onPointerDown=function(t){var e=this.findObject(t);this.updateSelection(t,e),this.assignUnknownPointer(t,e)},l.prototype.onPointerUp=function(t){var e=this.pointerMap[t.identifier];if(e.gesture.removePointer(t),delete this.pointerMap[t.identifier],e.gesture===this.twoFingerGesture){var i=this.twoFingerGesture.pointers[0],n=this.pointerMap[i];delete this.pointerMap[i];var s=new d.MouseEvent(n.lastX,n.lastY,t.timeStamp,i);this.twoFingerGesture.removePointer(s),this.assignPointer(s,o,this.chart.settings.interaction.panning.enabled?this.panGesture:this.postponeGesture)}},l.prototype.onPointerDrag=function(t){var e=this.pointerMap[t.identifier];e.lastX=t.x,e.lastY=t.y,e.gesture.movePointer(t)},l.prototype.onPointerCancel=function(t){this.onPointerUp(t)},l.prototype.onInstantClick=function(t){if(!t.shiftKey&&!t.ctrlKey&&!this.findObject(t).object){var e=this.chart.scene.selection.filter(function(t){return t.dragging||t.selectionLock});e.length!==this.chart.scene.selection.length&&(this.chart.scene.setSelection(e),this.chart.scene.notifySelectionChangesIfNeeded(this.chart,"user"))}},l.prototype.doAnimations=function(t){this.nodeDragGesture.doAnimations(t),this.multiSelectGesture.doAnimations(t)},l.prototype.paintScene=function(t){this.multiSelectGesture.paintScene(t)},l.prototype.buildClickEventArgs=function(t){var e=this.chart.createEventArguments(t,"user"),i=this.findObject(t);e.clickItem=i.details;var n=i.object;return n instanceof u.Node?(e.clickNode=n,this.autoZoomIn(t,n)):e.clickLink=n,e},l.prototype.updateHover=function(t,e){t.cursor=e.object&&e.object.cursor?e.object.cursor:"default",t.changes.current=!0,this.chart.scene.setActiveObject(e.object,e.details),this.chart.notifyHoverChanged(t,this.chart.createEventArguments(null,"api"))},l.prototype.autoZoomIn=function(t,e){this.chart.scene.lastClickedNode=e,this.chart.settings.interaction.zooming.autoZoomAfterClick&&(this.chart.scene.autoZoomMode=!0,t.changes.zoom=!0)},l.prototype.onPointerMove=function(t){if(!this.chart.scene.xyInChart(t.x,t.y))return void this.onPointerOut(t);this.hoverPointer=t.identifier;var e=this.findObject(t);e.object===(this.chart.scene.hoverLink||this.chart.scene.hoverNode)&&e.details===this.chart.scene.hoverItem||this.updateHover(t,e)},l.prototype.onPointerOut=function(t){this.hoverPointer===t.identifier&&(this.hoverPointer=null,this.updateHover(t,o)),this.pointerMap[t.identifier]&&this.onPointerUp(t)},l.prototype.onWheel=function(t){if(this.chart.scene.xyInChart(t.x,t.y)&&this.chart.settings.interaction.zooming.wheel){var e=Math.pow(1+this.chart.settings.interaction.zooming.sensitivity,.004*t.wheely);this.chart.autoZoom.manualZoom(e,t.x,t.y),t.consumed=!0,t.changes.position=!0}},l.prototype.onClick=function(t){this.chart.scene.xyInChart(t.x,t.y)&&(this.chart.notifyClick(t,this.buildClickEventArgs(t)),t.defaultPrevented&&(t.consumed=!0))},l.prototype.onRightClick=function(t){this.chart.scene.xyInChart(t.x,t.y)&&(this.chart.notifyRightClick(t,this.buildClickEventArgs(t)),t.defaultPrevented&&(t.consumed=!0))},l.prototype.onLongPress=function(t){if(this.chart.scene.xyInChart(t.x,t.y)){var e=this.pointerMap[t.identifier];e&&(e.longPressGesture&&(e.longPressGesture===this.multiSelectGesture&&this.multiSelectGesture.pointers.length>0&&(e.longPressGesture=this.ignoreGesture),this.assignPointer(t,o,e.longPressGesture),e.longPressGesture=null),t.consumed=e.gesture!==this.ignoreGesture)}},l.prototype.onDoubleClick=function(t){if(this.chart.scene.xyInChart(t.x,t.y))if(this.chart.notifyDoubleClick(t,this.buildClickEventArgs(t)),t.defaultPrevented)t.consumed=!0;else{var e=this.chart.settings.interaction.zooming.doubleClickZoom;e&&this.chart.settings.interaction.zooming.zoomInOnDoubleClick&&(this.chart.autoZoom.manualZoom(e,t.x,t.y),t.changes.position=!0,t.consumed=!0)}},l}(d.ChartElement);t.GestureManager=l}(e);var N=function(t){function e(){t.apply(this,arguments)}return n(e,t),e.prototype.buildDefaultButton=function(t,e){var i=this.chart;if(t instanceof u.Node){var n=this.scene.settings.localization.menu,s=function(t,e){t.style.display=e?"":"none"};"expand"===e?(this.buildButton(t,"DVSL-NC-button-expand",n.expand,null,function(t,e){i.expandNode(t.id)},function(t,e){s(e,i.navigator.canExpandNode(t))}),this.buildButton(t,"DVSL-NC-button-collapse",n.collapse,null,function(t,e){i.collapseNode(t.id)},function(t,e){s(e,i.navigator.canCollapseNode(t))}),this.buildButton(t,"DVSL-NC-button-collapse",n.close,null,function(t,e){i.closeNode(t.id)},function(t,e){s(e,i.navigator.canCloseNode(t))})):"focus"===e?(this.buildButton(t,"DVSL-NC-button-focus",n.focus,null,function(t,e){i.addFocusNode(t.id,-1)},function(t,e){s(e,i.navigator.canFocusNode(t))}),this.buildButton(t,"DVSL-NC-button-unfocus",n.unfocus,null,function(t,e){i.removeFocusNode(t.id)},function(t,e){s(e,i.navigator.canUnfocusNode(t))})):"lock"===e?(this.buildButton(t,"DVSL-NC-button-lock",n.fixed,null,function(t,e){i.unlockNode(t.id)},function(t,e){s(e,t.userLock)}),this.buildButton(t,"DVSL-NC-button-unlock",n.dynamic,null,function(t,e){i.lockNode(t.id)},function(t,e){s(e,!t.userLock)})):"hide"===e?this.buildButton(t,"DVSL-NC-button-hide",n.hide,null,function(t,e){i.hideNode(t.id)},function(t,e){s(e,i.navigator.canHideNode(t))}):i.error("The node menu button with name `"+e+"` was not recognized. Valid values are: expand, focus, lock, hide.")}else i.error("The link menu does not support any named buttons.")},e}(u.Menu);t.Menu=N;var E=function(s){function r(n,r){s.call(this,new p(n),new x,r),this.isLayoutFrozen=!1,this.focusNodeStack=[];var a="focusnodes"===this.settings.navigation.mode&&this.settings.navigation.focusAutoFadeout;this.layer=new u.NodesLayer(this,this.settings,a),this.graph=new T(this),this.navigator=this.events.addElement(k.CreateNavigator(this)),this.gestures=this.events.addElement(new e.GestureManager(this)),this.layout=this.events.addElement(i.LayoutBase.ConstructLayout(this)),this.info=this.events.addElement(new u.InfoPopup(this)),this.menu=this.events.addElement(new t.Menu(this)),this.autoZoom=this.events.addElement(new M(this)),this.renderer=this.events.addElement(new w(this)),this.legend=this.events.addElement(new c(this)),this.autoZoom.resetZoom=!0,this.scene.loading=!1,this.navigator.showInitialNodes(),this.finalInitialize()}return n(r,s),r.prototype.createDataObj=function(t){return new A(this,t)},r.prototype.getData=function(t){return s.prototype.getData.call(this,t)},r.prototype.onSettingsChanged=function(t){var e={};this.layer.onSettingsChanged(t),t.navigation&&t.navigation.mode&&(this.events.removeElement(this.navigator),this.navigator=k.CreateNavigator(this),this.events.addElement(this.navigator));var n=!(!t.navigation||!t.navigation.mode&&!t.navigation.initialNodes);if(t.data&&t.data.length){var s=t.data[0];(s.dataFunction||s.format||s.preloaded||s.url||s.randomNodes)&&(n=!0)}n&&(this.navigator.showInitialNodes(),this.autoZoom.resetZoom=!0),t.filters&&(e.filters=!0),t.style&&(e.style=!0),t.layout&&t.layout.mode&&(this.events.removeElement(this.layout),this.layout=i.LayoutBase.ConstructLayout(this),this.events.addElement(this.layout),this.isLayoutFrozen=!1),this.events.notifySceneChanges(e)},r.prototype.save=function(){var t=this.graph.save(),e=this.navigator.save();return JSON.stringify({xy:t,nav:e})},r.prototype.restore=function(t,e){if(t){var i=JSON.parse(t),n=i.xy,s=i.nav;s&&this.navigator.restore(s),n&&this.graph.restore(n),this.autoZoom.resetZoom=!0}},r.prototype.saveNavigation=function(){var t=JSON.stringify(this.navigator.save());return"{}"===t?null:t},r.prototype.restoreNavigation=function(t){this.navigator.restore(JSON.parse(t))},r.prototype.getCurrentNodes=function(){for(var t=[],e=0,i=this.layer.nodes();e0;){var t=this.focusNodeStack[this.focusNodeStack.length-1],e=d.Helpers.hasProperty(this.layer.idToNode,t)?this.layer.idToNode[t]:null;if(e&&e.focused)return e;this.focusNodeStack.pop()}if(this.settings.navigation.initialNodes)for(var i=0;i0?n[0]:null},r.prototype.clearFocus=function(){this.navigator.clearFocusNodes("api")},r.prototype.removeFocusNode=function(t){return t.id&&(t=t.id),this.navigator.unfocusNode(t,"api")},r.prototype.expandNode=function(t){return t.id&&(t=t.id),this.navigator.expandNode(t,"api")},r.prototype.collapseNode=function(t){return t.id&&(t=t.id),this.navigator.collapseNode(t,"api")},r.prototype.closeNode=function(t){return t.id&&(t=t.id),this.navigator.closeNode(t,"api")},r.prototype.hideNode=function(t){return t.id&&(t=t.id),this.navigator.hideNode(t,"api")},r.prototype.showNode=function(t){return this.navigator.showNode(t,"api")},r.prototype.getNode=function(t){return this.layer.idToNode[t]},r.prototype.getLink=function(t){return this.layer.idToLink[t]},r.prototype.touchObjects=function(t){for(var e=0;e0||this.seriesHovered},e}(d.LegendEntry),h=function(t){function e(e){t.call(this,e),this.paintOrder=75,this.updateOrder=100}return n(e,t),e.prototype.notifyHoveredSeries=function(t){for(var e=0;e=0}},e.prototype.getLastHoveredSeries=function(){var t=this.getLastHoveredEntry();return t?t.series[0]:null},e.prototype.onSceneChange=function(e){t.prototype.onSceneChange.call(this,e);var i=e.changes;i.linearChartSeries&&(this.rebuildItems(e),i.bounds=!0)},e.prototype.paintMarker=function(t,e,i,n,r){var a=t.context,o=r.isEnabled()?r.series[0]:r.disabledSeries,l=this.settings.marker,h=o.style.legend.marker,u=h.shape||l.shape;if(a.beginPath(),u){var c={fillColor:h.fillColor||o.style.fillColor||o.style.lineColor,lineColor:h.lineColor||l.lineColor,lineWidth:h.lineWidth||1};null!=h.width&&(n=h.width/2),d.Graphics.strokeMarker(a,u,e,i,n),d.Graphics.paint(a,c)}else{var p=l.size,f=e-p/2,g=e,m=e+p/2,v=p/2.1,y=p/2,S=3*p/4,b=i+p/2;if(o instanceof x){var L=o.style.marker.width;o.style.marker.width*=.8;var A=[[v,y,S]],T=[f,g,m],M=[T,[b-v,b-y,b-S]],k=b-y,P=new s.Line(null,[o]);P.paintLines(a,[o],[{markerY:null,segments:M}],T,[null],A,b),P.paintMarkers(a,o,[g],[y],[k]),o.style.marker.width=L}else if(o instanceof C){var A=[p,p],I=new s.Columns(this.chart.scene,[o]);I.paintStack(t,[e],[p/2],[A],[null],b)}else if(o instanceof w){var D=new s.Candlestick(this.chart.scene,[o]),F=[[0],[p/3],[2*p/3],[p]];D.paintStack(t,[e],[p/2],F,[null],b)}}},e.prototype.rebuildItems=function(t){for(var e=[],n=this.chart.scene.settings._computedSeries,s=this.settings.advanced.disabledSeries,r={},a=this.settings.text.fillColor,o=0;os;)this.locations.push(o),this.values.push(l),e.logScale?l*=10:l+=i,o-=a}else{if(this.fontHeight||(this.fontHeight=1.4*d.Graphics.getTextHeight(t.context,e.style.valueLabel.textStyle.font)||0),0===s&&(s+=this.fontHeight/2),this.scene.bottomAxisSize=r||(this.locations.push((0|f)-.5),this.values.push(p))}for(p=-1/u;;){p*=c;var f=this.zeroY-this.valueToRelativeY(p);if(f>=r)break;this.locations.push((0|f)-.5),this.values.push(p)}}else{i=this.calcLinearValuePerLine();var p=0;for(e.scaleStep&&(i=Math.max(i,this.fontHeight/this.scale));;){p+=i;var f=this.zeroY-this.valueToRelativeY(p);if(f<=s)break;f>=r||(this.locations.push(0|f),this.values.push(p))}for(p=0;;){p-=i;var f=this.zeroY-this.valueToRelativeY(p);if(f>=r)break;this.locations.push(0|f),this.values.push(p)}}var g=this.minValue,m=this.maxValue;if(g<=0&&m>=0){var v=e.style.baseLine.showLabel;(2===v||1===v&&(g<0||!this.isInside&&0===g))&&(this.locations.push(0|this.zeroY),this.values.push(0))}}var y,S,b,C=e.valueFormatterFunction;if(!this.isLogScale){var x=this.getUnitAndName(i,this.scene.settings);y=x.unit,S=x.digitsAfterComma,b=x.name}for(var w=0;w0&&(this.paintGrid(i),this.paintZeroLine(i),this.paintLabels(i,t.labelRenderer)),e.axisLine){var r=d.Graphics.beginStrokeAndFill(i,e.style.axisLine);this.paintAxisLine(r),d.Graphics.endStrokeAndFill(i,r,e.style.axisLine)}}},t.prototype.shouldChangeScale=function(){var t=this.seriesMinValue,e=this.seriesMaxValue;if(null===t||null===e)return!1;if(null===this.lastMinValue||null===this.lastMaxValue||!(this.lastMinValuethis.maxValue)return!0;var i=(this.lastMaxValue-this.lastMinValue)*this.options.scaleAdjustmentTolerance;return t>this.lastMinValue+i||e0&&t0?s=this.options.scaleStep:this.options.scaleMinStep>0&&(s=this.options.scaleMinStep),s>0&&(t<0&&(t=Math.floor(t/s)*s),e>0&&(e=Math.ceil(e/s)*s));var r=e-t;if(0!==t&&t!==-100)if(this.isLogScale)t=d.Helpers.sign(t)*Math.pow(Math.abs(t),1-d.Helpers.sign(t)*this.options.scaleAdjustmentTolerance);else{var a=t-r*this.options.scaleAdjustmentTolerance;t>0?t=Math.max(0,a):t<0&&(t=Math.min(0,a))}if(0!==e&&100!==e)if(this.isLogScale)e=d.Helpers.sign(e)*Math.pow(Math.abs(e),1+d.Helpers.sign(e)*this.options.scaleAdjustmentTolerance);else{var o=e+r*this.options.scaleAdjustmentTolerance;e>0?e=Math.max(0,o):e<0&&(e=Math.min(0,o))}null!==this.options.minValue&&(t=this.options.minValue),null!==this.options.maxValue&&(e=this.options.maxValue),this.minValue=t,this.maxValue=e;var l;this.isLogScale?t<=0&&e>=0?(this.logOffset=1,l=Math.log(e+this.logOffset)+Math.log(-t+this.logOffset)):t<0?(this.logOffset=1-t,l=Math.log(-t+this.logOffset)):e>0&&(this.logOffset=1+e,l=Math.log(e+this.logOffset)):l=e-t,this.scale=i/l;var h=this.valueToRelativeY(t);this.zeroY=n+i+h},t.prototype.valueToRelativeY=function(t){return this.isLogScale?t>0?this.scale*Math.log(t+this.logOffset):t<0?-this.scale*Math.log(-t+this.logOffset):0:this.scale*t},t.prototype.calcLinearValuePerLine=function(){if(this.options.scaleStep)return this.options.scaleStep;var t=this.options.style.labelSpacing/this.scale,e=Math.log(t)/Math.log(10),i=Math.pow(10,Math.floor(e-1));for(i=Math.max(i,this.options.scaleMinStep);i=t)return 2*i;if(i>10&&2.5*i>=t)return 2.5*i;if(5*i>=t)return 5*i;i*=10}return i},t.prototype.calcExpValuePerLine=function(){var t=this.valueToRelativeY(10)-this.valueToRelativeY(1),e=10,i=10,n=t;if(n>4*this.options.style.labelSpacing)return{unit:2,valueMultiplier:2};for(;n=1){n=a,s=r;break}}var l=0;if(t>0)for(var h=1;tthis.scene.chartHeight)){var e=this.options.style.baseLine,i=Math.max(e.lineDepth,this.seriesDepth);if(i>0){var n=d.Graphics.beginStroke(t,this.options.style.baseLine),s=this.scene.x0,r=s+this.scene.width,a=Math.round(this.zeroY)-.5*(e.lineWidth||1);n.moveTo(s,a),n.lineTo(s+i,a-i),n.lineTo(r,a-i),n.lineTo(r,a),t.fillStyle=e.depthColor,t.fill(),d.Graphics.endStroke(t,n,e)}}},t.prototype.paintZeroLine=function(t){if(!(this.zeroY>this.scene.chartHeight)){var e=this.options.style.baseLine,i=this.scene.x0,n=i+this.scene.width,s=Math.round(this.zeroY)-.5*(e.lineWidth||1),r=d.Graphics.beginStroke(t,e);r.moveTo(i,s),r.lineTo(n,s),d.Graphics.endStroke(t,r,e)}},t.prototype.paintThreshold=function(t,e){if(0!==this.scale){var i=this.scene.x0,n=this.scene.x0+this.scene.width,s=this.scene.y0,r=s+this.scene.height,a=this.zeroY-this.valueToRelativeY(e.from),o=this.zeroY-this.valueToRelativeY(e.to);a=a>=r-.5?(0|r)+.5:(this.zeroY-this.valueToRelativeY(e.from)|0)-.5,o=o<=s-.5?(0|s)+.5:(this.zeroY-this.valueToRelativeY(e.to)|0)-.5,e.style.fillColor&&(t.fillStyle=e.style.fillColor,t.beginPath(),t.rect(i,o,this.scene.width,a-o),t.fill(),t.closePath());var l=d.Graphics.beginStroke(t,e.style);a-.5!==r&&(l.moveTo(i,a),l.lineTo(n,a)),o-.5!==s&&(l.moveTo(i,o),l.lineTo(n,o)),d.Graphics.endStroke(t,l,e.style)}},t.prototype.paintLabels=function(t,e){if(this._chart.assetsLoaded){var i=this.scene,n=this.panel.left,s=this.panel.right,r="right"===this.options.side,a=this.title;if(this.options.title&&a){var o=i.y0,l=i.height,h=a.hheight,u=a.style.margin||0,c=o+.5*l,p=void 0;r?(p=s-u-h,s-=h+2*u):(p=n+u+h,n+=h+2*u),e.paint(t,p,c,1,a)}var f,g=(n+s)/2;if(f=r?n:s-4,!this.isInside){t.beginPath();for(var m=0;m0){var o=this.series,l=this.prevy;l.length1))return{result:null,distance:1/0};var h=this.series,u=d.Helpers.binSearch(t,r),c=t[u]-e[u],p=t[u]+e[u];if(c>r&&u>0){var f=t[u-1]-e[u-1],g=t[u-1]+e[u-1];(g>r||Math.abs(g-r)0;){if(null!==r[E][x]){N=!1;break}E--}F=N}else{if(!(T>M))continue;I=Math.max(T-M,y),D=T-I;for(var z=!0,E=o+1;E0){D+=f/2,k+=f/2,P-=f,I-=f;var B=d.Graphics.beginStroke(g,C);P>0?I>0?(B.moveTo(k,D),B.lineTo(k+P,D),B.lineTo(k+P,D+I),B.lineTo(k,D+I),B.lineTo(k,D)):f>0&&(g.moveTo(k,T),g.lineTo(k+P,T)):f>0&&(g.moveTo(w,D),g.lineTo(w,D+I)),d.Graphics.endStroke(g,B,C)}c||p||!u||d.Graphics.clearShadow(g);var U=C.previewLineColor;if(l&&l[x]){g.beginPath();for(var V=0,G=M-T,W=l[x],j=0;jT-w&&(p=T-w,c={x0:C,y0:x,x1:C,y1:x,seriesIndex:g,isMarker:!0})}}for(var M=null,k=y.segments,S=0;S=r-o){var E=I[F-1],z=I[F],O=Math.sqrt(d.Geometry.distanceToSegmentSq(D,E,N,z,r,a));O=r){var E=I[F-1],z=I[F],H=d.Geometry.lineIntersectsSegment(r,a,0,1,D,E,N,z);H!==1/0&&(M=H)}D=N}null!==M&&(d.Helpers.sign(M)!==d.Helpers.sign(f)&&(v.fillColor||v.fillGradient)&&p>=0&&(p=0,c={x0:0,y0:0,x1:1,y1:1,seriesIndex:g,isMarker:!1}),f=M)}return{result:c,distance:Math.max(p,0)}},t.prototype.computeLineSegments=function(t,e,i,n){var s=t.length,r=this.prevyL,a=this.prevyR;r.length2&&l[l.length-1]===l[l.length-2]&&(l.pop(),h.pop()),{segments:[l,h],markerY:o}}for(var L=!1,A=[],u=0;u1&&i[u-1]!==n[u-1]&&(l.push(t[u-1]),h.push(n[u-1])),l.push(c),h.push(p-d),i[u]-=d,n[u]-=d):(l.push(c),h.push(f-d),n[u]-=d),L=!0):(o.push(s[u]),L&&(l.length>0&&(1===l.length&&(l.push(l[0]),h.push(h[0])),A.push(l,h),l=[],h=[]),n[u-1]+=r[u-1]),L=!1)}return l.length>0&&(1===l.length&&(l.push(l[0]),h.push(h[0])),A.push(l,h)),{segments:A,markerY:o}},t.prototype.buildStepSegments=function(t,e,i,n,s,r,a,o){for(var l=[],h=[],u=[],c=[],d=null,p=0,f=0;f0&&(null!==d&&(u.push(p),c.push(d)),d=null,l.push(u,c),u=[],c=[])}}return u.length>0&&(null!==d&&(u.push(p),c.push(d)),l.push(u,c)),{segments:l,markerY:h}},t.prototype.smoothLine=function(t,e){var i=t[0],n=t[t.length-1],s=(n-i)/t.length;if(s<2)return{x:t,y:e};var r=[],a=[];r.push(i),a.push(e[0]);for(var o=0;o+1=0;u+=-2){var c=n[u],d=n[u+1];if(!(c.length<2||c[0]>h||c[c.length-1]=0;r--){if(g=c[r],h===f)t.lineTo(f,d[r+1]),h=g;else if(hg){var m=d[r],v=d[r+1],y=(h-g)/(f-g),S=m+y*(v-m);t.lineTo(h,S),h=g}if(h<=a){h=a;var m=d[r],v=d[r+1],y=(h-g)/(f-g),S=m+y*(v-m);t.lineTo(h,S);break}f=g}r===-1&&h===g&&t.lineTo(h,d[0])}}h!==a&&(t.lineTo(h,l),t.lineTo(a,l)),t.closePath()},t}();t.Line=i;var n=function(){function t(t,e){this.series=e,this.scene=t,this.prevy=[]}return t.prototype.paintStack=function(t,e,i,n,s,r){if(e.length>0){var a=this.series[0];this.seriesEnabled=a.enabled;var o=this.prevy;o.length1))return{result:null,distance:1/0};var h=this.series,u=d.Helpers.binSearch(t,r),c=t[u]-e[u],p=t[u]+e[u];if(c>r&&u>0){var f=t[u-1]-e[u-1],g=t[u-1]+e[u-1];(g>r||Math.abs(g-r)=n?e.increase:e.decrease,r="candlestick"===e.pattern?s.candlestick:s.bar,a=r;if(!this.seriesEnabled){a=d.Helpers.realClone(r);var o=this.scene.settings.legend.advanced.disabledSeries;a.lineColor=o.lineColor,void 0!==a.fillColor&&(a.fillColor=o.fillColor)}return e.lineColor&&e.shadowColor&&d.Graphics.applyShadow(t,e),a},t}();t.Candlestick=n}(s);var f=function(){function t(t,e,i){this.scene=e,this.chart=t,this.valueAxis=i}return t.prototype.setSeriesFont=function(t,e,i,n,s,r){var a=this.scene.dataLabels.metaData,o=2*n[0];null===a.styles&&(a.styles={});for(var l=0;l=0?1:-1,T=b.style.minHeight;T&&(S=S*AS&&(b=b-S+C,S=C);var x=this.scene.chartTop+this.scene.chartHeight-this.scene.bottomAxisSize;if(b>x&&(S=S-b+x,b=x),g)for(var w=0;wA){if(!(r.type===L.type&&a>L.value))return;g[w]=null}}}g||(g=this.scene.dataLabels.spots[f]=[]),g.push({value:a,type:r.type,edges:[S,b],x:parseInt(f,10),y:S+y.fontHeight/2,font:y.font,id:u,style:r.valueLabels.style,function:r.valueLabels.contentsFunction,timestamp:h})}}}},t.prototype.reduceFontSize=function(t,e,i,n,s){var r=e.match(/^([^\"\d]*)(\d+\.?\d*)(.*)$/i);if(!r)return d.Helpers.warn("Could not parse the font size from the value `"+e+"`."),{font:e,value:n(e)};for(var a=r[2],o=r[1],l=r[3],h=parseFloat(a);h>=i;){var u=o+h+l,c=n(u);if(c<=s)return{font:u,value:c};if(h===i)break;h=Math.round((h-1)*s/c*100)/100,h=0?-1:1,h=null,u=null,c=l*n,p=d.Graphics.getTextHeight(t,s)+2*o+4,f=pu?{min:u,max:h,font:s,fontHeight:p}:{min:h,max:u,font:s,fontHeight:p}},t.prototype.reduceFontWidth=function(t,e,i,n,s,r){var a=this.scene.dataLabels.fontWidths,o=n.style.textStyle;if(r=r.replace(/\d/g,"9"),(a[o.font+";"+r]||1/0)<=s)return o.font;var l=new d.Label(n.style),h=l.style.textStyle,u=h.font;l.text=r;var c=this.reduceFontSize(t,u,n.minFontSize,function(i){var n=a[i+";"+r];return n||(h.font=i,e.labelRenderer.measure(t,l),a[i+";"+r]=n=2*l.hwidth),n},s);return c?c.font:null},t.prototype.getLongestNumber=function(t){for(var e=0,i=-1,n=0;n=s.seriesWithLabels){r.processed=0;for(var l=s.dataLabels.spots,h=Object.keys(l),u=0,c=h.length;ut&&i>0){var r=this.centers[i-1]-this.radii[i-1],a=this.centers[i-1]+this.radii[i-1];(a>t||Math.abs(a-t)0){if(v&&v[0]<0&&m.addColorStop(0,d.Colors.blend(v[1],C,(0-v[0])/(b-v[0]),!1)),b>1){v&&m.addColorStop(1,d.Colors.blend(v[1],C,(1-v[0])/(b-v[0]),!1));break}m.addColorStop(b,C)}v=S}e._currentFillStyle=m,e._currentFillStyleKey={hash:h,gradient:i}}},t.prototype.processData=function(t){var e=this;this.vstack=[],this.countStack=[],this.styles=[];var i=t[this.seriesId[0]];if(0!==i.times.length){this.xes=i.xes.slice(i.fromIndex,i.toIndex),this.times=i.times.slice(i.fromIndex,i.toIndex),this.centers=new Array(this.xes.length-1),this.radii=new Array(this.xes.length-1),this.cluster.computeStackCenterRadius(this,this.xes,this.centers,this.radii),this.externalItemsCache=null,this.externalItems=function(){var t=e.externalItemsCache;return null===t&&(t=e.externalItemsCache=i.externalItems(i.fromIndex,i.toIndex-1)), t},this.previewData=[];for(var n=0;no){this.centers.splice(h,0,o),this.radii.splice(h,0,l),this.times.splice(h,0,s);for(var u=0;u<=i-1;u++)this.vstack[u].splice(h,0,null),this.countStack[u].splice(h,0,null),this.styles[u]&&this.styles[u].splice(h,0,null)}this.vstack[e][h]=n,this.countStack[e][h]=t.counts[0]},t.prototype.getSeparateNegative=function(){var t=this.options.separateNegativeValues;return null===t&&(t="line"!==this.renderingType),t},t.prototype.computeMinMax=function(){var t=1/0,e=-(1/0);if(this.vstack.length>0){for(var i=this.vstack,n=i[0].length,s=i.length,r=this.options.type,a=this.getSeparateNegative(),o=this.scene.x0,l=o+this.scene.width,h=0,u=n-1;h=h&&this.centers[u]-this.radii[u]>l;)u-=1;if("proportional"===r)t=0,e=100;else if(this.candleStacks)for(var c=h;c<=u;c++)for(var p=0;p<=s-1;p++){var f=i[p][c];d.Helpers.isNumber(f)&&(t=Math.min(t,f),e=Math.max(e,f))}else if(1===s)for(var g=i[0],c=h;c<=u;c++){var f=g[c];d.Helpers.isNumber(f)&&(t=Math.min(t,f),e=Math.max(e,f))}else if("based"===r)for(var c=h;c<=u;c++)for(var p=0;p<=s-1;p++){var f=i[p][c];d.Helpers.isNumber(f)&&(t=Math.min(t,f),e=Math.max(e,f))}else if("normal"!==r||a){if("normal"!==r)throw"stack.type unknown value: "+r;for(var c=h;c<=u;c++)for(var m=0,v=0,p=0;p<=s-1;p++){var f=i[p][c];d.Helpers.isNumber(f)&&(f>0?v+=f:f<0&&(m+=f),t=Math.min(t,m),e=Math.max(e,v))}}else for(var c=h;c<=u;c++)for(var y=0,p=0;p<=s-1;p++){var f=i[p][c];d.Helpers.isNumber(f)&&(null!==f&&(y+=f),t=Math.min(t,y),e=Math.max(e,y))}}this.min=t,this.max=e,t<=e?this.va.receiveSeriesGeometry(t,e,this.calculatedDepth):this.va.receiveSeriesGeometry(void 0,void 0,this.calculatedDepth)},t.prototype.computeY=function(){var t=this.vstack,e=t.length;if(0!==e){var i,n=this.options.type,s=this.getSeparateNegative(),r=t[0].length,a=this.va,o=null;if("proportional"===n){i=t.map(function(){return[]});for(var l=0;l<=r-1;l++){for(var h=0,u=0;u<=e-1;u++){var c=t[u][l];null!==c&&(h+=Math.abs(c))}if(h>0){h*=.01;for(var u=0;u<=e-1;u++){var c=t[u][l];null!==c?i[u].push(a.valueToRelativeY(Math.abs(c)/h)):i[u].push(null)}}else for(var u=0;u<=e-1;u++)i[u].push(null)}}else if("based"===n||1===e){i=[];for(var d=t[0].map(function(){return 0}),p=0;p=0&&v<=y||c<0&&v>=y?g[m]=0:(g[m]=v-y,d[m]=v)}else g[m]=null}i.push(g)}}else if("normal"===n&&s&&this.min<0&&this.max>0){i=t.map(function(){return[]}),o=t.map(function(){return[]});for(var l=0;l<=r-1;l++)for(var u=0;u<=e-1;u++){var c=t[u][l];c>0?(i[u].push(a.valueToRelativeY(c)),o[u].push(null)):c<0?(i[u].push(null),o[u].push(a.valueToRelativeY(c))):(i[u].push(null),o[u].push(null))}}else if("candlestick"===this.renderingType){i=t.map(function(){return[]});for(var l=0;l<=r-1;l++)for(var u=0;u<=e-1;u++){var c=t[u][l];null!==c?i[u].push(a.valueToRelativeY(c)):i[u].push(null)}}else{if("normal"!==n)throw"stack.type unknown value: "+n;var S=0,b=0,C=0;i=t.map(function(){return[]});for(var l=0;l<=r-1;l++)for(var u=0;u<=e-1;u++){var c=t[u][l];if(0===u&&(S=b=C=0),null!==c){b+=c;var x=a.valueToRelativeY(b);i[u].push(x-C),C=x}else i[u].push(null)}}this.ystackNegative=o,this.ystack=i}},t.prototype.exportData=function(t,e){var i;if(this.times&&this.vstack){for(var n=this.times,s=this.centers.length,r=0;r0?i.push({sum:u,max:c,min:d,first:p,last:f,count:s,avg:v?u/s:null,change:f-p}):i.push(null)}}else i=this.series.map(function(){return null});for(var C=[],x=this.series.length-1;x>=0;x--){var w=this.series[x];C.push({name:w.name||"",values:i[x],config:w})}return{name:this.options.name,stack:this,config:this.options,data:C}},t}();t.Stack=e}(i);var g=function(t){function e(){t.apply(this,arguments),this._computedValueAxisList=[],this._computedValueAxis={},this._computedSeries=[],this._computedStacks={},this.area=new N,this.legend=new r,this.valueAxisDefault=new u,this.valueAxis={},this.chartTypes={columns:{type:"columns"},line:{type:"line"},candlestick:{type:"candlestick"}},this.stacks={},this.seriesDefault={type:"columns"},this.series=[],this.info=new M,this.events=new m,this.interaction=new I,this.localization=new k,this.style={columnColors:["#32CD32","#36BEFF","#FBBD30","#EE3431","#894BBC","#0EC9AC","#524BBC"],lineColors:["#32CD32","#36BEFF","#FBBD30","#EE3431","#894BBC","#0EC9AC","#524BBC"]}}return n(e,t),e.addSeparateSeries=function(t,e,i,n,s,r,a){var o=d.Helpers.extendCopy({},t);o.stack=s,o.id="series"+d.Helpers.SeparatorChar+r,o.name=e,o.data={aggregation:n,index:i},o.style=t.style,a.push(o)},e._hasSeriesSettingsChanged=function(t){return t.series||t.chartTypes||t.seriesDefault||t.stacks||t.style},e.prototype.apply=function(i,n){var s=i.valueAxis;if(s){var r=[{from:"style.baseLineColor",to:"style.baseLine.lineColor"},{from:"style.baseLineWidth",to:"style.baseLine.lineWidth"},{from:"style.hgridLineColor",to:"style.hgrid.lineColor"},{from:"style.title.alignment",to:"style.title.align"},{from:"style.title.font",to:"style.title.textStyle.font"},{from:"style.title.fillColor",to:"style.title.textStyle.fillColor"},{from:"style.valueLabel.font",to:"style.valueLabel.textStyle.font"},{from:"style.valueLabel.fillColor",to:"style.valueLabel.textStyle.fillColor"}];for(var a in s)this.applyCompatibility(s[a],r,"valueAxis["+a+"]")}this.applyCompatibility(i,[{from:"valueAxis.default",to:"valueAxisDefault"},{from:"valueAxisDefault.style.baseLineColor",to:"valueAxisDefault.style.baseLine.lineColor"},{from:"valueAxisDefault.style.baseLineWidth",to:"valueAxisDefault.style.baseLine.lineWidth"},{from:"valueAxisDefault.style.hgridLineColor",to:"valueAxisDefault.style.hgrid.lineColor"},{from:"valueAxisDefault.style.title.alignment",to:"valueAxisDefault.style.title.align"},{from:"valueAxisDefault.style.title.font",to:"valueAxisDefault.style.title.textStyle.font"},{from:"valueAxisDefault.style.title.fillColor",to:"valueAxisDefault.style.title.textStyle.fillColor"},{from:"valueAxisDefault.style.valueLabel.font",to:"valueAxisDefault.style.valueLabel.textStyle.font"},{from:"valueAxisDefault.style.valueLabel.fillColor",to:"valueAxisDefault.style.valueLabel.textStyle.fillColor"}]);var o=t.prototype.apply.call(this,i);if(this._initializing||e._hasSeriesSettingsChanged(o)){this._initializing&&!o.series&&(o.series=[]);var l=this.series,h=[],c=null,p=0;this._computedStacks=d.Helpers.clone(this.stacks);for(var f=0;f=i)){var n=this._settings;if(n.zooming.wheel&&n.zooming.enabled&&this.xyInArea(t.x,t.y)){this.active=!0;var s=this.wheelOrigin;null===s&&(this.wheelOrigin=this.scaleOrigin=s=this.xyToPosition(t.x,t.y),this.wheelProportion=(s-e)/(i-e),this.x1=t.x);var r=this.wheelProportion,a=Math.pow(Math.max(1.1,n.zooming.wheelSensitivity),.004*t.wheely);e=s-(i-e)*r*a,i=s+(i-e)*(1-r)*a;var o=t.wheely<0?1:-1,l=d.Helpers.performanceNow();this.handleZoomWheel(e,i,s,l,o),t.consumed=!0,this.active=!1}}}},e.prototype.onPointerDown=function(t){this.wheelOrigin=null;var e=this._settings;if(this.xyInArea(t.x,t.y)&&(e.scrolling.enabled||e.zooming.enabled)){var i=this.xyToPosition(t.x,t.y),n=d.Helpers.performanceNow(),s=this.getFrom(n),r=this.getTo(n);if(s>r){var a=r;r=s,s=a}null===this.pointer1?(this.pointer1=t.identifier,this.x1=t.x,this.t1=i,this.scaleOrigin=i,this.onStartDragging(s,r,i),this.lastScrollingY=t.y,this.dragStartFrom=s,this.dragStartTo=r,this.dragCurFrom=s,this.dragCurTo=r,t.consumed=!0,this.inertiaF.finished(n)&&this.inertiaT.finished(n)||(this.setFrom(s),this.setTo(r),this.stopAnimations(),this.scrollingActive=!0),this.chart.cancelChartUpdateNotify(),t.consumed=!0):null===this.pointer2?(this.pointer2=t.identifier,this.x2=t.x,this.t2=i,this.initialZoom=r-s,this.scaleOrigin=(this.t1+this.t2)/2,t.consumed=!0):(this.scalingActive||this.scrollingActive)&&(t.consumed=!0)}},e.prototype.xyToDragPosition=function(t,e){return this.dragCurFrom+(t-this.scene.x0)/this.scene.width*(this.dragCurTo-this.dragCurFrom)},e.prototype.scaleViewRange=function(t,e,i){var n=Math.pow(1+this._settings.zooming.sensitivity,-t.dy/this.scene.height);return e=(e-this.scaleOrigin)*n+this.scaleOrigin,i=(i-this.scaleOrigin)*n+this.scaleOrigin,{from:e,to:i}},e.prototype.onPointerMove=function(t){null!==this.wheelOrigin&&Math.abs(this.x1-t.x)>this._settings.zooming.sensitivity&&(this.wheelOrigin=null)},e.prototype.onPointerDrag=function(t){var e=this.dragCurFrom,i=this.dragCurTo,n=this._settings;if(t.identifier===this.pointer1&&null===this.pointer2){this.scaleOrigin=this.t1,this.x1=t.x;var s=t.y-this.lastScrollingY;if(Math.abs(t.dx)>4*Math.abs(t.dy)&&n.scrolling.enabled&&(this.scrollingActive=!0),n.zooming.enabled&&n.zooming.swipe&&Math.abs(s)>n.zooming.upDownTreshold?this.scalingActive=s>0?1:-1:this.scalingActive=0,this.scalingActive){this.clearZoomHighlight();var r=this.scaleViewRange(t,e,i);e=r.from,i=r.to,t.consumed=!0}if(this.scrollingActive){var a=this.xyToDragPosition(t.x,t.y),o=this.t1-a;e+=o,i+=o}}else if(t.identifier===this.pointer1&&n.scrolling.enabled){this.x1=t.x,this.clearZoomHighlight();var l=this.twoPointerDrag();e=l.from,i=l.to}else{if(t.identifier!==this.pointer2||!n.scrolling.enabled)return void((this.scalingActive||this.scrollingActive)&&(t.consumed=!0));this.x2=t.x,this.clearZoomHighlight();var l=this.twoPointerDrag();e=l.from,i=l.to}this.dragCurFrom=e,this.dragCurTo=i;var h=this.onSnapWhileDragging(e,i,this.scaleOrigin,this.scrollingActive,this.scalingActive);this.goToPositionDragging(h.from,h.to),t.consumed=!0},e.prototype.twoPointerDrag=function(){var t=this._settings,e=t.zooming.fingersMaxZoom;this.scaleOrigin=(this.t1+this.t2)/2;var i=this.t2-this.t1,n=this.dragCurFrom,s=this.dragCurTo,r=this.xyToDragPosition(this.x1,0),a=this.xyToDragPosition(this.x2,0);if(t.scrolling.enabled&&t.zooming.enabled&&t.zooming.fingers&&0!==i){var o=this.initialZoom,l=((r+a)/2-this._currentFrom)/(this._currentTo-this._currentFrom),h=(a-r)/(this._currentTo-this._currentFrom),u=void 0;u=i*h>0?i/h:1/0;var c=o*e,d=o/e;u=Math.max(d,Math.min(c,u)),n=this.scaleOrigin-l*u,s=this.scaleOrigin+(1-l)*u,this.scalingActive=u0?Math.min(o,.002*this.scene.width):Math.max(o,.002*-this.scene.width);var l=this.getVisibleRange();o=o*l/this.scene.width}else o=0;if(this.updateFriction(i),this.inertiaF.jump(this._currentFrom,o,i),this.inertiaT.jump(this._currentTo,o,i),this._animationsDone=!1,e.scrolling.swipePageFlipping&&t.swipeUp&&this.scalingActive&&t.swipeSpeed>this.scene.height/e.swipeSensitivity){var h=this.onZoomOut(this.dragStartFrom,this.dragStartTo,this.scaleOrigin);r=h.from,a=h.to}else if(e.scrolling.swipePageFlipping&&t.swipeDown&&this.scalingActive&&t.swipeSpeed>this.scene.height/e.swipeSensitivity){var u=this.onZoomIn(this.dragStartFrom,this.dragStartTo,this.scaleOrigin);r=u.from,a=u.to}else if(n||s){if(n&&!s&&e.scrolling.swipePageFlipping&&(t.swipeLeft||t.swipeRight)&&t.swipeSpeed>this.scene.width/e.swipeSensitivity*.7){var c=t.swipeLeft?"<":">",p=this.onScroll(this.dragStartFrom,this.dragStartTo,c);r=p.from,a=p.to}else r=this._currentFrom,a=this._currentTo;this.scaleOrigin=(r+a)/2}if(r||a){var f=this.onSnapAfterDragging(this.inertiaF.getTargetValue(),this.inertiaT.getTargetValue(),this.scaleOrigin,n||0!==s,s);f&&this.goToPosition(f.from,f.to,!0,i,!1),t.consumed=!0,this.scaleOrigin=null}this.active=!1,this.dragStartFrom=null,this.dragStartTo=null,this.scalingActive=0,this.scrollingActive=!1}else(s||n)&&(t.consumed=!0)},e.prototype.onPointerCancel=function(t){t.identifier===this.pointer2?(this.pointer2=null,this.scaleOrigin=this.t1):t.identifier===this.pointer1&&null!==this.pointer2?(this.pointer1=this.pointer2,this.t1=this.t2,this.scaleOrigin=this.t1,this.pointer2=null,this.t2=null):t.identifier===this.pointer1&&(this.active=!0,this.pointer1=null,this.t1=null,this.scaleOrigin=null,this.dragStartFrom=null,this.dragStartTo=null,this.scalingActive=0,this.scrollingActive=!1,this.active=!1)},e.prototype.onKeyDown=function(t){},e.prototype.goToPositionDragging=function(t,e){this.setFrom(t),this.setTo(e),this.clearZoomHighlight(),this.onPositionChanged(t,e)},e.prototype.goToPosition=function(t,e,i,n,s){if(tr){var h=null!==this.dragStartFrom?this.dragStartFrom:a,u=null!==this.dragStartTo?this.dragStartTo:o;this.setZoomHighlight(h,u,!1)}this.events.notifySceneChanges({requestPaint:!0})}else this.setFrom(t),this.setTo(e),this.clearZoomHighlight(),this.onPositionChanged(t,e),this.onAnimationDone(t,e),this._animationsDone=!0},e.prototype.doAnimations=function(t){if(!this._animationsDone){var e=t.timeStamp,i=this.inertiaF.finished(e),n=this.inertiaT.finished(e);this._animationsDone=i&&n;var s=this._currentFrom=this.getFrom(e),r=this._currentTo=this.getTo(e);this._animationsDone||isNaN(s+r)?(this.stopAnimations(),this.onPositionChanged(s,r,!1),this.onAnimationDone(s,r)):(this.onPositionChanged(s,r,!0),t.animating=!0)}},e.prototype.stopAnimations=function(){this.highlight&&(this.highlightRemoveWhenDone?this.clearZoomHighlight():(this.highlight.style.fillColor=this.scene.settings.area.style.zoomHighlightInactive.fillColor,this.events.notifySceneChanges({highlight:!0})))},e.prototype.abort=function(){this.isActive()&&(this.pointer2&&this.onPointerCancel({identifier:this.pointer2}),this.pointer1&&this.onPointerCancel({identifier:this.pointer1}),this.setFrom(this._currentFrom),this.setTo(this._currentTo),this.clearZoomHighlight(),this._animationsDone=!0)},e.prototype.isActive=function(){return this.active||null!=this.pointer1||!this._animationsDone},e.prototype.clearZoomHighlight=function(){this.highlight&&(this.scene.removeHighlight("zoomTrace"),this.highlight=null,this.events.notifySceneChanges({highlight:!0}))},e.prototype.setZoomHighlight=function(t,e,i){this.highlight=this.scene.setHighlight("zoomTrace",t,e,this.scene.settings.area.style.zoomHighlight),this.highlightRemoveWhenDone=i,this.events.notifySceneChanges({highlight:!0})},e.prototype.updateFriction=function(t,e,i){var n=this.getVisibleRange();if(null!=e&&null!=i){var s=i-e,r=.3,a=n*(1-r)>s,o=n*(1+r)=this.x0&&t=this.y0&&e=this.x0&&t=this.y0&&e=this.x0&&t=this.y0+this.height&&e0&&(this.animating=!0,n.animator=new d.ColorAnimator(d.Colors.derive(d.Colors.parse(n.style.fillColor),1,0),n.style.fillColor,n.style.fadeIn,"=",t.timeStamp))}}for(var i in this.highlights){var n=this.highlights[i];if(n.exiting&&!n.animator){var a=n.style;a.fadeOut>0?(this.animating=!0,n.animator=new d.ColorAnimator(a.fillColor,d.Colors.derive(d.Colors.parse(a.fillColor),1,0),a.fadeOut,"=",t.timeStamp)):delete this.highlights[i]}}}if(this.animating){var o=!1,l=t.timeStamp;for(var i in this.highlights){var n=this.highlights[i];n.animator&&(n.style.fillColor=n.animator.get(l),n.animator.finished(l)?(n.animator=null,n.exiting&&delete this.highlights[i]):o=!0)}this.animating=o,t.animating=t.animating||o}},e.prototype.paintScene=function(t){var e=this.scene.x0,i=e+this.scene.width,n=Math.round(this.scene.y0),s=this.scene.height,r=t.context;for(var a in this.highlights){var o=this.highlights[a],l=Math.max(this.scene.timeToX(o.from),e),h=Math.min(this.scene.timeToX(o.to),i);hi||(d.Graphics.rectStyle(r,o.style),r.fillRect(l,n,h-l,s))}},e}(d.ChartElement);t.Highlights=_;var R=function(t){function e(e){t.call(this,e),this.rightAxis=null,this.leftAxis=null,this.timeAxisPanel=null}return n(e,t),e.prototype.createDom=function(e){t.prototype.createDom.call(this,e),this.timeAxisPanel=d.Helpers.createDom("div","DVSL-TC-timeAxis",null,this.backgroundContainer),d.DomLayer.setContainerStyle(this.timeAxisPanel),this.leftAxis=d.Helpers.createDom("div","DVSL-valueAxis",null,this.backgroundContainer),d.DomLayer.setContainerStyle(this.leftAxis),this.rightAxis=d.Helpers.createDom("div","DVSL-valueAxis",null,this.backgroundContainer),d.DomLayer.setContainerStyle(this.rightAxis)},e.prototype.doAnimations=function(e){t.prototype.doAnimations.call(this,e),e.changes.bounds&&(this.background.style.left=this.scene.x0+"px",this.background.style.right=this.scene.chartWidth-(this.scene.x0+this.scene.width)+"px",this.leftAxis.style.width=this.scene.leftMargin+"px",this.leftAxis.style.bottom=this.scene.bottomMargin+"px",this.rightAxis.style.width=this.scene.rightMargin+"px",this.rightAxis.style.bottom=this.scene.bottomMargin+"px",this.timeAxisPanel.style.top=this.scene.y0+this.scene.height+"px",this.timeAxisPanel.style.left=this.scene.x0+"px", this.timeAxisPanel.style.width=this.scene.width+"px",this.outerBorder.style.left=this.scene.x0+"px",this.outerBorder.style.width=this.scene.width+"px")},e}(d.DomLayer);t.DomLayer=R;var B=function(t){function e(e,i,n){t.call(this,e,i,n),this.scrolling=null,this.renderer=null}return n(e,t),e.prototype.createDomLayer=function(){return new R(this)},e.prototype.notifyAnimationDone=function(){var t=this;window.setTimeout(function(){t.removed||t.dispatchEventParams("animationDone",t.createEventArguments(null,"api"),null)},0)},e.prototype.processChangedSettings=function(t){var e=t.settingsChanges;e&&(g._hasSeriesSettingsChanged(e)&&(t.linearChartSeries=!0),(e.valueAxis||e.valueAxisDefault)&&(t.linearChartValueAxis=!0))},e.prototype.updateSettings=function(e,i){t.prototype.updateSettings.call(this,e,i)},e.prototype.setLogScale=function(t,e){var i={};for(var n in this.settings.valueAxis)i[n]={logScale:t};this.updateSettings({valueAxisDefault:{logScale:t},valueAxis:i},e)},e.prototype.finalInitialize=function(){t.prototype.finalInitialize.call(this),this.legend=this.events.addElement(new h(this))},e.prototype.getEnabledSeries=function(){for(var t=[],e=this.settings._computedSeries,i=0,n=e.length;ii&&(o=this.scene.settings._computedSeries[i]),s=r.contentsFunction.call(this.chart.api,a,o,this.getContentsFunctionRange(t,e))}else s=this.buildValues(a,i,n);if(!r.showHeader)return s;var l=this.buildHeader(t,e);return l+s},e.prototype.buildValues=function(t,e,i){for(var n=this.chart.settings,s=n.localization.noDataLabel,r=n.info.valueFormatterFunction,a=n.info.advanced.showOnlyHoveredSeries?n.info.advanced.scope:null,o=i&&("stack"===a||"value"===a)||"auto"===a&&void 0!==e&&null!==e,l="value"===a,h="",u=!1,c=0;c",u=!1),p.data.length>1?h+="

"+p.name+"

":v=p.name),u||(h+='',u=!0);for(var g=0;g"}}}return u&&(h+="
",r)h+=r.call(this.chart.api,m.values,m.config);else if(m.values)if(m.values.count>1&&n.info.aggregations&&n.info.aggregations.length>0)for(var w=0;w
"),h},e}(d.ChartElement);t.InfoPopup=U;var V=function(){function t(t,e){if(this.axisConfigList=e,this.chart=t,this.axis=Object.create(null),0!==e.length)for(var i=!1,n=0;nd/2&&(l=d/2,h=h/d*(d-l));for(var u=0;ui){s=1/0,n=null;for(var r=0;rt.approxTime()},e.prototype.isEqual=function(t){return!!t&&this.approxTime()===t.approxTime()},e.prototype.getBigger=function(){return"y"===this.unit?new e(this.unit,10*this.count):new e(e.toBiggerUnit[this.unit],1)},e.prototype.roundTimeDown=function(t,e){if(null==t)return null;t=Math.round(t);var n=this.count,s=this.unit;if("ms"===s)return Math.floor(t/n)*n;if("s"===s)return Math.floor(t/1e3/n)*n*1e3;if("m"===s)return Math.floor(t/6e4/n)*n*6e4;if("h"===s)return Math.floor(t/36e5/n)*n*36e5;if("d"===s){if(n%7!==0)return Math.floor(t/i/n)*n*i;s="w",n/=7}if("w"===s){var r=e.week.dow+3,a=t;return t=(t/i-r)/7+1,t=(Math.floor(t/n)*n*7+r)*i,t>a&&(t-=7*i),t}var o=new Date(Math.floor(t/i)*i);if("y"===s)return o.setUTCFullYear(Math.floor(o.getUTCFullYear()/n)*n,0,1),o.getTime();if("M"===s){var l=12*o.getUTCFullYear()+o.getUTCMonth();return o.setUTCMonth(o.getUTCMonth()+Math.floor(l/n)*n-l,1),o.getTime()}throw new Error("Unrecognized unit: `"+this.unit+"`")},e.prototype.roundTimeUp=function(t,e){return null==t?null:this.roundTimeDown(this.add(t)-1,e)},e.prototype.roundTimeRound=function(t,e){return null==t?null:this.roundTimeDown((this.add(t)+t-1)/2,e)},e.prototype.isMultipleOf=function(t){var e=this.unit,i=t.unit,n=this.approxTime(),s=t.approxTime(),r=n/s;if(r<1||(0|r)!==r)return!1;if(e===i)return!0;if(1===t.count&&"w"!==i)return!0;var a=864e5,o=a/s;return o>=1&&(0|o)===o||("y"===e?"M"===i:"M"!==e&&"w"!==e)},e.parsingMap={milliseconds:"ms",millisecond:"ms",sec:"s",second:"s",seconds:"s",min:"m",minute:"m",minutes:"m",hour:"h",hours:"h",day:"d",days:"d",week:"w",weeks:"w",mon:"M",month:"M",months:"M",year:"y",years:"y",ms:"ms",s:"s",m:"m",h:"h",d:"d",D:"d",w:"w",W:"w",M:"M",y:"y",Y:"y"},e.knownUnits=["ms","s","m","h","d","w","M","y"],e.timeUnitDiffs={ms:1,s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5,M:2592e6,y:31104e6},e.unitsTranslation={s:"second",m:"minute",h:"hour",d:"day",w:"week",M:"month",y:"year"},e.toBiggerUnit={ms:"s",s:"m",m:"h",h:"d",d:"w",w:"M",M:"y",y:null},e.toSmallerUnit={ms:null,s:"ms",m:"s",h:"m",d:"h",w:"d",M:"d",y:"M"},e}();t.TimeStep=s,function(e){var i=function(t){function e(e,i){i.cssClass=i.cssClass||"DVSL-bar-btn-month",i.title=i.title||e.settings.localization.toolbar.periodDropdownTitle,t.call(this,e,i),this._getItemsCache=null,this.custom={displayAnchor:null,disabled:!1,displayPeriod:null,displayPeriodStr:null,displayUnit:null,displayUnitStr:null,selected:!1,name:e.settings.localization.toolbar.customPeriod},this.updateSelectedItem()}return n(e,t),e.prototype.onSelectionChange=function(t){this.chart.setDisplayPeriod(t.displayPeriodStr,t.displayAnchor,null==t.displayUnit?null:t.displayUnit.toString(),!0,"user")},e.prototype.onSceneChange=function(t){t.settings&&(this._getItemsCache=null),(t.settingsChanges&&(t.settingsChanges.area||t.settingsChanges.toolbar)||t.time)&&this.updateSelectedItem()},e.prototype.updateSelectedItem=function(){var t=this._lastSelectedItem;if(t&&t!==this.custom&&this.chart.isThisDisplayPeriod(t.displayPeriodStr,t.displayAnchor,t.displayUnitStr))return void this.setSelectedItem(t);for(var e=this.getItems(),i=0;it.approxTime()&&(null===e||n.approxTime()n)}},t.prototype.adjustTimeRangeToUnits=function(t,e,i,n){var s,r=i-(i-e)/2,a=n.approxTime(),o=this.getUnitRange(t,[n]),l=i-e;s=li.displayUnit.approxTime()},t.prototype.getBiggerDisplayPeriod=function(t,e){for(var i=Math.abs(e-t),n=0,s=null,r=0;rn&&(n=l,s=a)}return s},t.prototype.getBiggerDisplayUnit=function(t){for(var e=this.settings._displayUnitsParsed,i=t.approxTime(),n=0;ni)return s}return t},t.prototype.getSmallerDisplayUnit=function(t){for(var e=this.settings._displayUnitsParsed,i=t.approxTime(),n=e.length-1;n>=0;n--){var s=e[n];if(s.approxTime()=t&&(null===r||a>h)&&(r=l,a=h)}return i?e&&e.approxTime()<.8*t?e:null!==r&&a<1.2*t||null===n?r:n:null!==n&&(s>.8*t||a>1.2*t)?n:r},t.prototype.isAllowedDisplayUnit=function(t){for(var e=0;eC)){var A=void 0;A=null===m||(b?L>=f&&Lv:L<=g&&L>v||v>g&&L0;){for(var N=!1,x=0;xv),A&&(m=w,v=L)}}if(!m&&!N){var E=(T+M)/2,z=u/p*S/2;m=h._minUnit,T=E-z,M=E+z}if(m){var O=this.scene.timeStepSettings;return{from:m.roundTimeDown(T,O),to:m.roundTimeUp(M,O),unit:m}}var H=M-T,_=H-H/4>=S,R=_?H/4:H-S;I?T+=R:D?M-=R:(T+=R/2,M-=R/2),f=(M-T)/u*c.minUnitWidth,g=(M-T)/u*p}0===F&&d.Helpers.warn("`computeDisplayUnit` could not lookup the new unit. It is possible that the chart did not load the data properly.")}if(!m)throw d.Helpers.error("",t,e,i,n,s,u),new Error("Could not calculate displayUnit");return o.unit=m,o},t.prototype.tryComputeDisplayPeriod=function(t,e,i,n,r,a,o){var l="auto"===i?null:s.parse(i),h=null,u=null;if(t&&t.indexOf(">")>-1){var c=t.split(">",2);h=parseInt(c[0],10),u=parseInt(c[1],10);var p=s.timeUnitDiffs,f=!l||p[l.unit]S&&(l=C,h=u-S),u-hh-l){var f=(l+h)/2,g=(h-l)/2;return g=Math.max(g,c/2),this.adjustTimeRangeToUnits(t,f-g,f+g,r)}p*=.99,c*=1.01;var m=s-n;m=Math.min(m,p),m=Math.max(m,c);var v=m===c?m/(s-n):1;return null===i&&(i=(n+s)/2),n===s&&n>0&&d.Helpers.error("From = To, trouble",n,s),{from:i+(n-i)*v,to:i+(s-i)*v}},t.prototype.preventOverscroll=function(t,e,i,n){var s=this.getLimits(t,n),r=s.from,a=s.to,o=this.settings.interaction.scrolling,l=i-e;return null!==r&&null!==a&&(l=Math.min(l,a-r)),l*=o.overscrollProportion,null!==r&&(r-=l),null!==a&&(a+=l),null!==r&&null!==a&&a-ri&&(l=i-a),e-=l,i-=l):null!==a&&ae&&(l=r-e,e=r,i+=l),{from:e,to:i}},t.prototype.scroll=function(t,e,i,n,r,a){var o;if("displayUnit"===a)o=i.clone();else if("page"===a)o=this.getTimeRangeStep(t,e);else{if(!s.isGoodUnit(a))return void d.Helpers.error("Incorrect scroll unit: "+a);o=s.parse(a)}return o.count*=r,"<"===n?{from:o.sub(t),to:o.sub(e)}:{from:o.add(t),to:o.add(e)}},t.prototype.getTimeRangeStep=function(t,e){t=Math.round(t),e=Math.round(e);for(var i=null,n=this.scene.timeStepSettings,r=0;re)){for(;s>0&&t[s-1][0]===e;)s-=1;return s}n=s}}return i=0;s--)if(null!==n(t[s]))return s}else for(var s=e-1;s>=0;s--)if(null!==t[s][i])return s;return-1},e.findSubrange=function(t,i,n){var s=e.binSearch(t,i),r=e.binSearch(t,n);return{i0:s,i1:r}},e.prototype.notifyAssetsLoaded=function(){if(t.moment&&t.moment.tz){for(var e=this._pendingAddData,i=0;it){(r.useSmallerUnitCache||p.unit.approxTime()===n.approxTime())&&(a=p,o=lp.to);break}}var f=!1;if(o&&(o=!!r.dataFunction||!!r.url||!!r.urlByUnit,o&&(!r.minimizeRequests||!this.chart.scrolling.isActive()))){var g=this._findUsableUnit(n),m=!1;a&&g.approxTime()===a.unit.approxTime()&&(l>=a.from&&(m=!0,l=Math.max(l,a.to)),(h<=a.to||ly&&(d.Helpers.warn("The chart requires "+v+" values (using data unit `"+g+"`) to display the current time range. `data.cacheSize` limit (currently "+y+") will be automatically increased to allow this."),r.cacheSize=1.2*v|0),f=this.scheduleDataLoading(g,l,h,m,s)}if(a){var S=e.findSubrange(a.values,t,i),b=S.i0,C=S.i1;return{unit:n.unit,count:n.count,from:a.from,to:a.to,values:a.values,startIndex:b,endIndex:C,loading:f}}return f?{unit:n.unit,count:n.count,from:l,to:h,values:[],startIndex:0,endIndex:0,loading:!0}:(d.Helpers.warn("The datasource `"+r.id+"` cannot return data for unit "+n,null,!0),{unit:null,count:null,from:null,to:null,values:[],startIndex:0,endIndex:0,loading:!1})},e.prototype.updateData=function(t,e,i){var n=this._findUsableUnit(t),s=n.toString();if(this.cache[s]&&!this.requests[s]){var r=this.scene.timeStepSettings,a=n.roundTimeUp(e,r),o=n.roundTimeDown(this.cache[s].lastTimestamp,r);o<=a&&this.scheduleDataLoading(t,o,a,!1,i)}},e.prototype.scheduleDataLoading=function(t,e,i,n,r){var a=this;if(!t)throw"No unit";if(e>i)return!1;this.chart.log("Scheduling data loading "+t+","+e+","+i);var o=d.Helpers.performanceNow(),l=t.toString(),h=this.requests[l];if(h){if(!(h.time+this.dataSettings.requestTimeoutthis.dataSettings.requestMaxUnits&&(n?c=t.add(u,this.dataSettings.requestMaxUnits):u=t.sub(c,this.dataSettings.requestMaxUnits))}var m=this.getDataFunction();if(!m)return this.chart.log("No data function. Cannot load data?"),!1;var v=s.timeUnitDiffs[t.unit]t)&&(this.dataFrom=t),void 0!==e&&null!==e&&(null===this.dataTo||this.dataTo=e.to&&(this.chart.error("Data logic error. from >= to: "+e.from+", "+e.to+". The values will be ignored."),e.from=null,e.to=null),null!=e.dataLimitFrom&&null!=e.dataLimitTo&&e.dataLimitFrom>=e.dataLimitTo&&(this.chart.error("Data logic error. dataLimitFrom >= dataLimitTo: "+e.dataLimitFrom+", "+e.dataLimitTo+". The values will be ignored."),e.dataLimitFrom=null,e.dataLimitTo=null);var g=e.dataLimitFrom,m=e.dataLimitTo;null==g&&(g=-(1/0)),null==m&&(m=1/0);var v=0;if("UTC"===a&&"UTC"===this.settings.timeAxis.timeZone&&(v=this.dataSettings.timestampInSeconds?1e3:1),e.values.length>0){for(var y=[],S=0;Sm)&&this.chart.error("Data error: value timestamp outside data limits. values["+S+"][0] = "+b[0]+". Limits: "+g+"..."+m),i&&p===L&&d.Helpers.warn("There are multiple values given for the same timestamp "+b[0]+" which might produce invalid results."),p>L&&!f&&(i&&d.Helpers.warn("Data values are not sorted on timestamp in ascending order (timestamp "+b[0]+"). TimeChart will sort the data automatically but to achieve better performance the data source should be sorted."),f=!0),p=b[0],y.push(b)}}else this.chart.error("Data error: the value at index "+S+" is not an array.")}e.values=y,f&&y.sort(function(t,e){return t[0]-e[0]}),u=y[0][0],c=y[y.length-1][0]}return null!=e.from&&u=e.to&&(d.Helpers.warn("Data logic error. Data time "+c+" outside [from, to) range: "+e.from+", "+e.to),e.to=c+1),t.moment.defaultZone=l,t.moment.locale(h),e},e.prototype.analyzeDataNoRequest=function(t,e){var i=this.dataSettings,n=t.from,r=t.to,a=s.parse(t.unit),o=null,l=null;if((null==n||null==r)&&t.values.length>0){var h=this.scene.timeStepSettings;o=t.values[0][0],l=t.values[t.values.length-1][0],o=a.roundTimeDown(o,h),l=a.roundTimeUp(l+1,h),null==n&&(n=o),null==r&&(r=l)}null!=i.dataFunction||null!=i.url||null!=t.dataLimitFrom||null!=t.dataLimitTo||d.Helpers.hasProperties(i.urlByUnit)||(d.Helpers.warn("Using preloaded data without specifying `dataLimitFrom` and `dataLimitTo` is not recommended - these values will be implied from the data and might result in invalid behavior.",null,1e30),null==t.dataLimitFrom&&(t.dataLimitFrom=Math.min((e?this.dataLimitFrom:0)||1e30,t.from||o)),null==t.dataLimitTo&&(t.dataLimitTo=Math.max((e?this.dataLimitTo:0)||-1e30,t.to||l))),this.updateDataLimit(o,l,t.dataLimitFrom,t.dataLimitTo,a);var u=new p(a,n,r,t.values);return null!=t.error&&(u.error=t.error),u},e.prototype.analyzeData=function(t,e){null===e.from&&null==t.from&&null!=t.dataLimitFrom&&(t.from=t.dataLimitFrom,d.Helpers.warn("`from` is not set in the data response - using `dataLimitFrom` instead. This may produce unexpected results.")),null===e.to&&null==t.to&&null!=t.dataLimitTo&&(t.to=t.dataLimitTo,d.Helpers.warn("`to` is not set in the data response - using `dataLimitTo` instead. This may produce unexpected results."));var i=t.from,n=t.to,r=null,a=null;null!=i&&null!=n&&i>=n&&this.chart.error("Data logic error. from >= to: "+i+", "+n);var o=s.parse(t.unit),l=this.scene.timeStepSettings;if(t.values.length>0?(r=t.values[0][0],a=t.values[t.values.length-1][0],r=o.roundTimeDown(r,l),a=o.roundTimeUp(a+1,l),null==i&&(i=null!==e.from?Math.min(e.from,r):r),null==n&&(n=null!==e.to?Math.max(e.to,a):a),e.from&&a<=e.unit.add(e.from)&&(this.dataSettings._skipRequestRangeRounding=!0)):(null==i&&(i=e.from),null==n&&(n=e.to),null!=t.from&&null!=t.to?(r=t.from,a=t.to):(r=e.from,a=e.to,null===e.from&&null===e.to&&null==i&&null==n&&null==t.dataLimitFrom&&null==t.dataLimitTo&&(this.noData=!0))),this.updateDataLimit(r,a,t.dataLimitFrom,t.dataLimitTo,o),null!==e.from&&null!=t.to){var h=o.roundTimeDown(t.to,l);h<=e.from&&this.updateDataLimit(null,null,null,t.to,o)}if(null!==e.to&&null!=t.from){var u=o.roundTimeUp(t.from,l);u>=e.to&&this.updateDataLimit(null,null,t.from,null,o)}null==t.from&&null==t.dataLimitFrom&&(null!==this.dataLimitFrom&&(null===e.from||e.from<=this.dataLimitFrom&&r>this.dataLimitFrom)||null===this.dataLimitFrom&&(void 0===e.from||null===e.from))&&(this.updateDataLimit(null,null,r,null,o),i=r),null==t.to&&null==t.dataLimitTo&&(null!==this.dataLimitTo&&(null===e.to||e.to>=this.dataLimitTo&&a0?this.lastTimestamp=this.values[this.values.length-1][0]:this.lastTimestamp=0},t.prototype.merge=function(t,e,i,n){if(t.unit.approxTime()!==this.unit.approxTime())throw new Error("merge unit mismatch");if(!n&&(this.from>t.to||this.to0&&t.from>t.values[0][0]&&i.error("Data merge - oldest data before from"),t.values.length>0&&t.to0&&this.values[r-1][0]>=t.to;)r-=1;var a=t.values;if(this.from=Math.min(this.from,t.from),this.to=Math.max(this.to,t.to),s>0){var o=Math.max(0,a.length+s-e);a=this.values.slice(o,s-1+1).concat(a),o>0&&(this.from=this.values[o-1][0]+1)}if(re)){if(!i){var o=this.computeDisplayUnit(t,e);t=o.from,e=o.to,i=o.unit}if("init"===s){var o=this.timeSetup.getMinRangeForUnit(t,e,i,r);t=o.from,e=o.to}t===this.getFrom()&&e===this.getTo()&&i.isEqual(this.scene.displayUnit)||(n&&this.abort(),this.scene.anchor=r,this.scene.period=a,this.targetUnit=i,this.animationUnit=!i||this.scene.displayUnit&&i.toString()!==this.scene.displayUnit.toString()?null:i,this.goToPosition(t,e,n,d.Helpers.performanceNow(),!0),this.events.notifySceneChanges({time:!0}),s&&this.chart.notifyTimeChanged(t,e,i,s))}},e.prototype.zoomOut=function(t,e,i,n,s){if(this.scene.displayUnit){var r=this.computeZoomOut(e,i);this.scene.displayUnit=r.unit,this.setTimeRangeSnap(r.from,r.to,r.center,r.unit,n,s,!1,!0)}},e.prototype.zoomIn=function(t,e,i,n,s,r){if(this.scene.displayUnit){null===e&&(e=(i+n)/2);var a=this.onZoomIn(i,n,e,.5);this.setTimeRangeSnap(a.from,a.to,a.center,t,s,r,!1,!0)}},e.prototype.handleZoomWheel=function(t,e,i,n,s){var r=this.onSnapWhileDragging(t,e,i,this.scrollingActive,s);t=r.from,e=r.to;var a=r.unit;if(this.scene.displayUnit=a,null===this.pointer1){var o=this.onSnapAfterDragging(t,e,i,this.scrollingActive,s);t=o.from,e=o.to,a=o.unit,this.scene.displayUnit=a}this.goToPosition(t,e,!0,n,!0)},e.prototype.xyInArea=function(t,e){return this.scene.xyInChart(t,e)},e.prototype.xyToPosition=function(t,e){return this.scene.xToTime(t)},e.prototype.onZoomOut=function(e,i,n,s){return void 0===s&&(s=null),s?t.prototype.onZoomOut.call(this,e,i,n,s):this.computeZoomOut(e,i)},e.prototype.onZoomIn=function(e,i,n,s){if(void 0===s&&(s=null),s)return t.prototype.onZoomIn.call(this,e,i,n,s);if(this.dragStartBar0&&(e=this.dragStartBar0,i=this.dragStartBar1,i-e>this.scene.timeEnd-this.scene.timeStart)){var r=this.scene.getClickBar(n);e=r.time0,i=r.time1}return{from:e,to:i,center:(e+i)/2}},e.prototype.onScroll=function(t,e,i){return this.timeSetup.scroll(t,e,this.scene.displayUnit,i,1,"page")},e.prototype.onGoHome=function(t,e){var i=this.chart.getDisplayLimits().to;if(null===i)return{from:t,to:e,origin:null};this.scene.anchor="newestData";var n=e-t;return{from:i-n,to:i,origin:i}},e.prototype.onStartDragging=function(t,e,i){this.scene.anchor=null,this.animationUnit=null,this.dragStartUnit=this.scene.displayUnit;var n=this.scene.getClickBar(i);this.dragStartBar0=n.time0,this.dragStartBar1=n.time1},e.prototype.onSnapWhileDragging=function(t,e,i,n,s){var r=this._preventOverscale(t,e,null,i,!1);t=r.from,e=r.to;var a=this.computeDisplayUnit(t,e).unit,o=this._preventOverscroll(t,e,a,!1);return t=o.from,e=o.to,this.events.notifySceneChanges({time:!0}),{from:t,to:e,unit:a}},e.prototype.onSnapAfterDragging=function(t,e,i,n,s){if(s){var r=this.timeSetup.adjustTimeAfterScale(t,e,this.dragStartBar0,this.dragStartBar1);t=r.from,e=r.to}var a=this.snap(t,e,i,null,n,!1),o=a.unit,l=a.period,h=a.anchor;return this.targetUnit=o,this.animationUnit=this.scene.displayUnit,this.scene.period=l,this.scene.anchor=h,this.dragStartBar0=null,this.dragStartBar1=null,this.dragStartFrom=null,this.dragStartTo=null,this.dragStartUnit=null,this.events.notifySceneChanges({time:!0}),this.chart.notifyTimeChanged(t,e,o,"user"),{from:a.from,to:a.to,unit:o}},e.prototype.onPositionChanged=function(t,e,i){if(!isNaN(t)||!isNaN(e)){var n;n=this.animationUnit?this.animationUnit:this.computeDisplayUnit(t,e).unit,this.scene.setTimeRange(t,e,n),this.chart.timeStart=t,this.chart.timeEnd=e,this.chart.displayUnit=n,this.events.notifySceneChanges({position:!0,time:!0})}},e.prototype.onAnimationDone=function(t,e){if(this.targetUnit){var i=this.targetUnit?this.targetUnit:this.computeDisplayUnit(t,e).unit;this.chart.displayUnit=i,this.scene.setTimeRange(t,e,i)}this.targetUnit=null,this.animationUnit=null,this.chart.notifyAnimationDone()},e.prototype.onPointerDrag=function(e){this.scene.displayUnit&&t.prototype.onPointerDrag.call(this,e)},e.prototype.computeZoomOut=function(t,e){var i,n=this.scene.settings.toolbar.zoomOutFunction,r=this.scene.displayUnit,a=null,o=null,l=e-t,h=e-l/2;n&&(o=n(r.unit,r.count,t,e)),null!=o&&o.unit&&(a=new s(o.unit,o.count||1)),a||(a=this.timeSetup.getBiggerDisplayUnit(r));var u=a.approxTime(),c=this.timeSetup.getUnitRange(this.scene,[a]),d=null!=o&&(null!=o.from||null!=o.to);if(d){i=Math.min(c.maxTime,o.to-o.from);var p=this.timeSetup.verifyUnitWidth(o.from,o.to,a);if(p.min||p.max){var f=this.timeSetup.adjustTimeRangeToUnits(this.chart.scene,o.from,o.to,a);t=f.from,e=f.to}}else{var g=Math.min(30*l/u,Math.floor(c.maxTime/u));i=u*g}return(!o||o&&!o.from)&&(t=h-i/2,e=h+i/2),{from:t,to:e,center:h,unit:a}},e.prototype.snap=function(t,e,i,n,s,r){if((r||s)&&this.scene.settings.interaction.scrolling.limitMode){var a=this._preventOverscale(t,e,n,i,!0);t=a.from,e=a.to}var o,l;if(n?o=n:!r||!r&&s?o=this.scene.displayUnit:(l=this.computeDisplayUnit(t,e),o=l.unit,t=l.from,e=l.to),s||r){var h=e-t,u=this._preventOverscroll(t,e,o,!1);t=u.from,e=u.to,u=this._preventOverscroll(t,e,o,!0),t=u.from,e=u.to,r=r||e-t!==h}if(!n&&r)return l=this.computeDisplayUnit(t,e),t=l.from,e=l.to,this.snap(t,e,i,o,s,r);var c=r?null:this.scene.period,d=this.scene.anchor,p=this.scene.settings.interaction.snapMode;if(p){var f=this.scene.majorTimeUnit&&"y"===this.scene.majorTimeUnit.unit,g=void 0;if("displayUnit"===p)g=o;else if("multiperiod"===p||"period"===p){var m=e-t,v=this.chart.getDisplayLimits(),y=v.from,S=v.to;null!==y&&(m=Math.min(m,S-y));var b=this.timeSetup.getClosestDisplayPeriod(m,this.scene.majorTimeUnit,"multiperiod"===p||f);g=b,c=b.toString()}var C=this.scene.timeStepSettings;if("period"!==p||f)if(r)t=g.roundTimeRound(t,C),e=g.roundTimeRound(e,C);else{var x=Math.max(g.numberOfUnits(t,e),1),w=Math.abs(g.roundTimeRound(t,C)-t),L=Math.abs(g.roundTimeRound(e,C)-e);wr-4*s&&(i=r+s),n+s>a&&nr&&(u=r),b+C+20t.x&&(t.cursor="move",t.consumed=!0)}this.isHoveringEdge=n}},i.prototype.onPointerDown=function(t){var e=this.scene,i=this.settings;if(e.xyInChartOrBottom(t.x,t.y)&&null===this.selectingPointer&&i.enabled){this.selectionRemoved=!1,this.lastX=t.x;var n=null,s=null;if(null!==e.selectionStart||null!==e.selectionEnd){var r=this.getLineCoordinates(),a=Math.abs(r.start-t.x),o=Math.abs(r.end-t.x),l=!1;if(at.x&&(this.isMoving=!0,this.moveStartX=t.x,this.moveStartY=t.y,this.moveSelectionStart=e.selectionStart,this.moveSelectionEnd=e.selectionEnd,this.selectStart=e.xToTime(t.x),l=!0),l)return this.selectingPointer=t.identifier,t.consumed=!0,this.roundAround=!0,void(this.isSelecting=!0)}e.xyInBottom(t.x,t.y)&&(this.selectingPointer=t.identifier,this.selectStart=e.xToTime(t.x),t.capture=!0,this.roundAround=!0,this.isSelecting=!0,t.x>=n&&t.x<=s||null!==e.selectionStart&&(this.selectionRemoved=!0,e.selectionStart=null,e.selectionEnd=null,t.changes.selection=!0))}},i.prototype.onPointerDrag=function(t){this.scene.displayUnit&&this.selectingPointer===t.identifier&&(this.dragPointer(t,t.x,t.y,t.changes),t.consumed=!0)},i.prototype.dragPointer=function(t,e,i,n){var s,r,a=this.scene;if(this.isMoving){var o=a.dxToDtime(e-this.moveStartX);s=this.moveSelectionStart+o,r=this.moveSelectionEnd+o;var l=i-this.moveStartY,h=this.settings.resizeTolerance;if(Math.abs(l)>h){l=l<0?l+h:l-h;var u=this.moveSelectionEnd-this.moveSelectionStart,c=Math.min(u,a.dxToDtime(l*this.settings.resizeSensitivity)),p=0===u?.5:(this.selectStart-this.moveSelectionStart)/u;s+=c*p,r-=c*(1-p)}}else{var f=this.selectStart,g=this.scene.xToTime(e),m=Math.abs(f-g),v=a.snapTimeRound(f),o=v-f,y=d.Helpers.sign(o);v=f+Math.min(o*y,.9*m)*y,ve+1+this.uniformTolerance?t.add(e-i+1,"d"):t.add(this.step.count,this.step.unit)},e.prototype._sub=function(t){if(this.uniform||1===this.step.count||"d"!==this.step.unit)return t.subtract(this.step.count,this.step.unit);var e=t.date();if(e<=this.step.count){t.subtract(1,"M");var i=t.daysInMonth()-1,n=i+1-this.step.count+this.uniformTolerance;return t.date(1+n-(n%this.step.count|0))}return t.subtract(this.step.count,this.step.unit)},e.prototype.init=function(e,i){for(var n=this,s=0;s=i)return this.fromIndex=0,this.toIndex=0,this.fromBar=null,void(this.toBar=null);this.fromBar=t.moment(this._getOrigin(e)).utc(),this.fromIndex=0;var a=t.moment(this.fromBar).utc();for(this.times.push(a.valueOf());a.valueOf()this.toBar.valueOf()||e0){var h=(l/this.step.approxTime()|0)+2;if(this.fromIndext;)this._sub(this.fromBar),this.fromIndex-=1,p=this.fromBar.valueOf(),this.times[this.fromIndex]=p,this.xes[this.fromIndex]=a+p*o}var f=e-this.toBar.valueOf();if(f>0){var h=(f/this.step.approxTime()|0)+2;if(this.times.length=e;)this.toIndex-=1,this._sub(this.toBar);this._add(this.toBar);var m=this.toIndex-this.fromIndex+this.bufExpandSize;if(this.fromIndex>m){for(var v=this.fromIndex-this.bufExpandSize,c=0;c1?this.multiYearWidth:e?this.majorLabelWidths[t.unit]:null!==this.fullLabelWidths?this.fullLabelWidths[t.unit]||null:null},i.prototype.computeLabels=function(t){var e,i,n=new o(this.chart),r=this.scene.timeEnd-this.scene.timeStart,a=n.toBiggerDisplayUnit(t);if(a){var l=new s("s",1);for(e=a.isSmaller(l)?l:a,i=this.computeMinorUnit(e),a=n.toBiggerDisplayUnit(e);a&&(a.approxTime()<=.5*r||e.approxTime()this.scene.dxToDtime(this.getMajorLabelWidth(e,null!=i)))break}}return{minorUnit:i,majorUnit:e}},i.prototype.computeMinorUnit=function(t){var e=this.scene.displayUnit.clone(),i=new s(s.toSmallerUnit[t.unit],1);i.unit&&i.isBigger(e)&&(e=i);var n=e.approxTime(),r=null;if(null===this.minorLabelWidths)return null;for(var a=1.5*this.scene.dxToDtime(this.minorLabelWidths[e.unit]),o=0;o-1&&D.rect(C,u,x-C,Math.min(5,h)+c),k=k%7+1,C=x}d.Graphics.endStrokeAndFill(n,D,I)}if(this.options.vgrid){for(var F=d.Graphics.beginStrokeAndFill(n,this.options.style.vgrid),b=m+1;b<=v-2;b++){var N=(0|f[b])+.5;if(N>=a)break;F.moveTo(N,u),F.lineTo(N,l)}d.Graphics.endStrokeAndFill(n,F,this.options.style.vgrid)}var E="y"===this.majorSlices.step.unit&&this.majorSlices.step.count>1,z=this.getMajorLabelWidth(this.majorSlices.step,null!=this.minorFormat),O=this.scene.momentLocale;if(!this.minorSlices||this.majorSlices.step.unit!==this.minorSlices.step.unit){if(i.showMajorTimeBalloons){n.beginPath();for(var b=m;b<=v-2;b++){var H=f[b],_=f[b+1];if(!(H>=a||_<=r)){var R=(H+_)/2;Ha&&(_=a,R=Math.max((H+_)/2,H+z)),d.Graphics.strokeBalloon2(n,R,p+1,z,this.majorLabelHeight)}}d.Graphics.paint(n,i.majorTimeBalloonStyle)}for(var b=m;b<=v-2;b++){var H=f[b],_=f[b+1];if(!(H>=a||_<=r)){var M=g[b],B=void 0;if(E){var U=g[b+1]-1;B=t.moment.utc(M).locale(O).format(this.majorFormat)+" - "+t.moment(U).locale(O).utc().format(this.majorFormat)}else B=t.moment.utc(M).locale(O).format(this.majorFormat);var R=(H+_)/2;Ha&&(_=a,R=Math.max((H+_)/2,H+z));var V=new d.Label({text:B,textStyle:i.majorTimeLabel},!0);s.paint(n,R,p,1,V)}}}var G=this.scene.settings.timeAxis,W=G.style.minorTimeRuler;if(this.minorSlices){g=this.minorSlices.times,f=this.minorSlices.xes,m=this.minorSlices.fromIndex,v=this.minorSlices.toIndex,z=this.minorLabelWidths[this.minorSlices.step.unit];var j=o+.4*this.minorLabelHeight|0,Y=o-1,q=j+1.6*this.minorLabelHeight|0;if(i.showMinorTimeBalloons){n.beginPath();for(var b=m;b<=v-1;b++){var N=f[b];d.Graphics.strokeBalloon(n,N,o-5,z,this.minorLabelHeight)}d.Graphics.paint(n,i.minorTimeBalloonStyle)}else{var Z=this.majorSlices.fromIndex,X=this.majorSlices.xes;n.beginPath();for(var Q=Z,b=m;b<=v-1;b++){for(var N=f[b];N>X[Q];)Q+=1;if(X[Q]!==N){if(N>=a)break;N=(0|N)-.5,n.moveTo(N,Y),n.lineTo(N,q)}}d.Graphics.stroke(n,W)}for(var K=i.showMinorTimeBalloons?"center":"left",J=i.showMinorTimeBalloons?0:3,b=m;b<=v-1;b++){var N=f[b],M=g[b],B=t.moment(M).locale(O).utc().format(this.minorFormat),V=new d.Label({text:B,aspectRatio:1e9,align:K,textStyle:i.minorTimeLabel});s.measure(n,V);var $=N+J+V.hwidth;s.paint(n,$,j+V.hheight,1,V)}}var tt=this.chart.dataWarehouse.getDisplayUnitsSlicer();if(G.miniTimeRuler&&W&&tt&&tt.xes[tt.fromIndex+1]-tt.xes[tt.fromIndex]>4){var et=o-1,it=o+3;f=tt.xes;var nt=this.majorSlices.fromIndex,st=this.minorSlices?this.minorSlices.fromIndex:nt,rt=this.majorSlices.xes,at=this.minorSlices?this.minorSlices.xes:rt;n.beginPath();for(var ot=nt,lt=st,ht=0,b=tt.fromIndex;b<=tt.toIndex-2;b++){for(var N=f[b];N>rt[ot];)ot+=1;if(rt[ot]!==N){for(;N>at[lt];)lt+=1;if(at[lt]!==N){if(N>=a)break;N=(0|N)-.5,n.moveTo(N,et),n.lineTo(N,it),ht++}}}if(ht&&d.Graphics.stroke(n,W),this.scene.settings.advanced.themeCSSClass.indexOf("gradient")!==-1){var ut=d.Colors.colorTone(W.lineColor,2,2);ht=0,n.beginPath(),ot=nt,lt=st;for(var b=tt.fromIndex;b<=tt.toIndex-2;b++){for(var N=f[b];N>rt[ot];)ot+=1;if(rt[ot]!==N){for(;N>at[lt];)lt+=1;if(at[lt]!==N){if(N>=a)break;N=(0|N)+.5,n.moveTo(N,et),n.lineTo(N,it),ht++}}}ht&&d.Graphics.stroke(n,{lineColor:ut.color})}}d.Graphics.popClip(e)}},i}(d.ChartElement);t.TimeAxis=w;var L=function(){function t(){this.enabled=!0,this.label={padding:3,margin:3,aspectRatio:3,align:"center",textStyle:{fillColor:"white",font:"12px Arial"},backgroundStyle:{lineColor:"#0099cc",fillColor:"#0099cc"}},this.align="left",this.side="top",this.style={lineColor:"#0099cc"},this.time=null,this.overrideLimits=!1,this.showTime=!1}return t}();t.SettingsMarker=L;var A=function(){function t(t,e,i){if(this.labelCacheUnit=null,this.labelCacheTime=null,this.initialText=null,this.isMilestone=!0,this.settings=e,this.label=new d.Label(e.label),i){var n=d.Helpers.clone(i);d.Helpers.extendStyleTo(this.label.style.textStyle,n),n.fillColor||(n.fillColor=e.style.lineColor),this.label.style.textStyle=n}null!=e.time?this.time=t.timestampToInternal(e.time,!0):this.time=null,this.initialText=this.label.text||null}return t}();t.Marker=A;var T=function(e){function i(t){e.call(this),this.animationOrder=2e3,this.paintOrder=40,this.updateOrder=800,this.scene=null,this._initialized=!1,this.chart=t,this.scene=this.chart.scene}return n(i,e),i.prototype.onSceneChange=function(t){if(this.chart.assetsLoaded){var e=t.changes,i=e.settingsChanges,n=i&&i.milestones;(!this._initialized||n||e.assets)&&(this.createMarkers(),this._initialized=!0),(e.time||n)&&this.scene.markers.sort(function(t,e){return t.time-e.time})}},i.prototype.paintScene=function(t){var e=this.scene,i=e.markers,n=t.labelRenderer,s=t.context;if(0!==i.length&&e.displayUnit){var r=Math.round(e.y0);s.textBaseline="middle",d.Graphics.pushClip(t,e.x0,Math.round(e.y0),e.width,e.height+e.bottomAxisSize);for(var a=this.getRenderingParts(t,i),o=a.lines,l=0;l=l-1&&w-A<=h+1){var P=x.settings.align,I="center"===P?A:M;w+I>=h?(P="left",w-=2):w-I<=l&&(P="right",w+=2);var D=w-A,F=w+A,N=w;"left"===P?(N=w-A+L,F=w,D=w-M):"right"===P&&(N=w+A-L,F=w+M,D=w);var E=[],z=-1,O=Dh?Math.min(h,D):D,H=this.getTopPos(O,I),_="top"===x.settings.side?H:Math.round(s.height+.5*s.bottomAxisSize);if(0!==d.length)for(;;){var R=z!==-1?f[z]+m[z]:_,B=R+k;z=-1;for(var U=0;U=G&&D<=V||F>=G&&F<=V||D<=G&&F>=V,q=R>=W&&R<=j||B>=W&&B<=j||R<=W&&B>=j;if(Y&&q){E.push(U),_=f[U]+m[U],z=U;break}}if(z===-1)break}var Z=void 0;"top"===x.settings.side?Z=_+T:(c=u+s.height-T+L,Z=Math.min(_,s.height+.5*s.bottomAxisSize)),Z=(0|Z)+.5,m.push(k),v.push(M),f.push(_),g.push(_+k),d.push(D),p.push(D+M);var X={value:c,changes:!1};null!=x.animator&&(X=x.animator.updateAndGet(Z,e.timeStamp)),y.push({x:w,y:X.value+T-L,style:x.settings.style,side:x.settings.side}),S.push({x:N,y:X.value,label:x.label}),X.changes&&(e.animating=!0)}}return{lines:y,labels:S}},i.prototype.getTopPos=function(t,e){var i=this.scene.x0+this.scene.width,n=this.chart.shell.getChartInnerArea();return n.findTopPosition(t,Math.min(t+e,i))},i.prototype.createMarkers=function(){var t=this.scene,e=t.markers.filter(function(t){return!t.isMilestone}),i=t.settings,n=i.milestones;for(var s in n){var r=n[s];if(r.enabled){var a=new A(t,r,i.area.style.markerText);a.animator=new d.Animator(0,0,200),e.push(a)}}t.markers=e},i}(d.ChartElement);t.Markers=T;var M=function(t){function e(){t.apply(this,arguments),this.showTime=!0,this.align="left",this.side="bottom",this.label={margin:4,padding:3,textStyle:{font:"12px Arial",fillColor:"red"}},this.style={lineColor:"red"}}return n(e,t),e}(L);t.SettingsCurrentTime=M;var k=function(t){function e(e){t.call(this),this.animationOrder=100,this.paintOrder=35,this.updateOrder=900,this.marker=null,this.timeTimerUnit=null,this.timeTimer=null,this.timeTimerTarget=-(1/0),this.timeTickerEnabled=!1,this.timeTimerCheckAlways=!1,this._lastAnchor=null,this.chart=e,this.settings=this.chart.settings,this.scene=this.chart.scene,this.events=this.chart.events,this.createMarker(),this.updateTimers()}return n(e,t),e.prototype.updateTimers=function(){var t=this,e=this.settings.advanced;this.timeTickerEnabled=e.timeUpdateInterval&&(this.settings.currentTime.enabled||"now"===this.scene.anchor),this.timeTickerEnabled?this.updateCurTime():this.timeTimer&&(clearTimeout(this.timeTimer),this.timeTimer=null),e.dataUpdateInterval?this.dataTimer=setInterval(function(){return t.dataTick()},e.dataUpdateInterval):this.dataTimer&&(clearInterval(this.dataTimer),this.dataTimer=null)},e.prototype.createMarker=function(){var t=this.settings.currentTime,e=this.marker,i=this.scene.markers;e&&(i.splice(i.indexOf(e),1),this.marker=null),t.enabled&&(e=this.marker=new A(this.scene,t,null),e.isMilestone=!1,i.push(e))},e.prototype.onSceneChange=function(t){var e=!1,i=t.changes.settingsChanges;i&&((i.advanced||i.currentTime)&&(this.updateTimers(),e=!0),i.currentTime&&this.createMarker()),this._lastAnchor!==this.scene.anchor&&(e||this.updateTimers(),this._lastAnchor=this.scene.anchor),this.timeTickerEnabled&&(t.changes.timeMarker||t.changes.time&&(this.timeTimerCheckAlways||!this.timeTimer||this.scene.getScale()i.x0&&s-200=36e5&&(o=(i.xToTime(s+1|0)-n)/2,a=Math.max(a,o),o/=4);else{if(s>0)return;a=Math.max(a,i.dxToDtime(-s-200)/2),this.timeTimerCheckAlways=!0}var l=+new Date;if(this.timeTimer){var h=this.timeTimerTarget-l;if(h1?this.events.notifySceneChanges({timeMarker:!0}):(this.timeTimerTarget=l+a,this.timeTimer=setTimeout(function(){return e.timerTick()},a))}},e.prototype.updateVisiblePeriod=function(){var t=this.scene,e=t.displayUnit;if(e&&this.settings.navigation.followAnchor){var i=null;if("now"===t.anchor){var n=t.getCurTime();i=n}else if("newestData"===t.anchor){var s=this.chart.getDataLimits().to;i=s}if(null!==i){var r=this.chart.scrolling,a=r.getTo();if(a"+s+("("+l+" "+h+")")},i}(l.InfoPopup);t.InfoPopup=j;var Y=function(t){function e(e){t.call(this),this.animationOrder=600,this.paintOrder=20,this.updateOrder=1200,this.chart=null,this.scene=null,this.pointer=null,this.chart=e,this.scene=e.scene}return n(e,t),e.prototype.previewPointerMove=function(t){this.pointer=null,this.updateHover(t)},e.prototype.onPointerOut=function(t){var e=this.scene;e.hoverFrom=null,e.hoverTo=null,e.hoverSeriesItem=null,t.changes.hover=!0,this.chart.notifyHoverChanged(t,this.chart.createEventArguments(t,"user"))},e.prototype.previewPointerDown=function(t){this.pointer=t.identifier,this.updateHover(t)},e.prototype.updateHover=function(t){var e=this.chart,i=e.scene,n=this.getClickRange(t.x,t.y),s=null,r=null,a=null;if(n&&(s=n.t0,r=n.t1,a=e.renderer.hitTest(t.x,t.y)),e.legend)if(a)e.legend.notifyHoveredSeries(i.settings._computedSeries[a.seriesIndex]);else{e.legend.notifyHoveredSeries(null);var o=e.legend.getLastHoveredSeries();o&&(a={x0:null,y0:null,x1:null,y1:null,isMarker:!1,seriesIndex:i.settings._computedSeries.indexOf(o)})}(s!==i.hoverFrom||r!==i.hoverTo||!a!=!i.hoverSeriesItem||a&&(a.seriesIndex!==i.hoverSeriesItem.seriesIndex||a.x0!==i.hoverSeriesItem.x0))&&(i.hoverFrom=s,i.hoverTo=r,i.hoverSeriesItem=a,t.changes.hover=!0,e.notifyHoverChanged(t,e.createEventArguments(t,"user")))},e.prototype.onClick=function(t){t.identifier===this.pointer&&this.chart.notifyClick(t,this.chart.createEventArguments(t,"user"))},e.prototype.defaultClick=function(t,e){var i=this.scene,n=this.chart,s=i.settings.interaction;if(s.zooming.click){var r=i.xToTime(t.x);if(null!==i.selectionStart&&(i.selectionStart>r||i.selectionEnd=i.selectionStart&&ai.y0+i.height&&(h>i.timeStart||u=this.scene.timeEnd)for(var i in this.requests){var n=this.results[i];n.dataExistsFrom=null,n.dataExistsTo=null}else{this.hasNewRequests=!1,this.loading=!1,this.hasSomeData=!1;var s=!!e.data||e.time;for(var i in this.requests){var r=this.requests[i],n=this.results[i],a=this.updateData(s,r,n);this.updateSlices(a,i,r,n)}this.scene.loading=this.loading,this.loading?this.scene.setMessage("noData",this.scene.settings.localization.loadingLabel,10):this.hasSomeData?this.scene.setMessage("noData",null):this.scene.setMessage("noData",this.scene.settings.localization.noDataLabel,999)}},t.prototype.exportData=function(t,e,i,n){for(var s=new C(this.scene,i,[],t,e,!0,0),r=s.times,a=[],o=0;o=i.to||this.scene.timeStart-oi.to||null!==i.dataExistsFrom&&i.dataExistsFrom>this.scene.timeEnd||null!==i.dataExistsTo&&i.dataExistsTothis.scene.timeEnd||u.tothis.scene.timeStart||u.to0&&!a&&r>=o[0].length?this.chart.error("No data for this DataIndex: "+r+", only "+(o[0].length-1)+" values present"):(t?this.fillValues(o,d,f,p,l.fromIndex,l.toIndex,i,s):(this.fillValues(o,d,f,p,l.fromIndex,u+1,i,s),this.fillValues(o,d,f,p,c-1,l.toIndex,i,s)),this.setLeads(i,n,s));else{f=n.values=new Array(d.length);for(var g=0;g=r)&&("sum"===l?this.fillValueSum(t,e,i,n,s,r,h,u,c):"min"===l?this.fillValueMin(t,e,i,n,s,r,h,u,c):"max"===l?this.fillValueMax(t,e,i,n,s,r,h,u,c):"avg"===l?this.fillValueAvg(t,e,i,n,s,r,h,u,c):"count"===l?this.fillValueCount(t,e,i,n,s,r,h,u,c):"first"===l?this.fillValueFirst(t,e,i,n,s,r,h,u,c):"last"===l?this.fillValueLast(t,e,i,n,s,r,h,u,c):this.chart.error("Unrecognized aggregation function: "+l),d))for(var p=s;p<=r-2;p++)i[p]=d(i[p],e[p],o?o.toString():null)},t.prototype.fillValueSum=function(t,e,i,n,s,r,a,o,l){for(var h=t.length,u=c.binSearch(t,e[s]),d=s;d<=r-2;d++){for(var p=e[d+1],f=0,g=0,m=void 0;u