/*
 Highcharts JS v8.2.0 (2020-08-20)

 Annotations module

 (c) 2009-2019 Torstein Honsi

 License: www.highcharts.com/license
*/
(function(a){"object"===typeof module&&module.exports?(a["default"]=a,module.exports=a):"function"===typeof define&&define.amd?define("highcharts/modules/annotations",["highcharts"],function(v){a(v);a.Highcharts=v;return a}):a("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(a){function v(c,a,p,g){c.hasOwnProperty(a)||(c[a]=g.apply(null,p))}a=a?a._modules:{};v(a,"Extensions/Annotations/Mixins/EventEmitterMixin.js",[a["Core/Globals.js"],a["Core/Utilities.js"]],function(c,a){var k=a.addEvent,
g=a.fireEvent,z=a.objectEach,b=a.pick,A=a.removeEvent;return{addEvents:function(){var b=this,d=function(d){k(d,c.isTouchDevice?"touchstart":"mousedown",function(d){b.onMouseDown(d)})};d(this.graphic.element);(b.labels||[]).forEach(function(b){b.options.useHTML&&b.graphic.text&&d(b.graphic.text.element)});z(b.options.events,function(d,e){var l=function(l){"click"===e&&b.cancelClick||d.call(b,b.chart.pointer.normalize(l),b.target)};if(-1===(b.nonDOMEvents||[]).indexOf(e))b.graphic.on(e,l);else k(b,
e,l)});if(b.options.draggable&&(k(b,"drag",b.onDrag),!b.graphic.renderer.styledMode)){var e={cursor:{x:"ew-resize",y:"ns-resize",xy:"move"}[b.options.draggable]};b.graphic.css(e);(b.labels||[]).forEach(function(d){d.options.useHTML&&d.graphic.text&&d.graphic.text.css(e)})}b.isUpdating||g(b,"add")},removeDocEvents:function(){this.removeDrag&&(this.removeDrag=this.removeDrag());this.removeMouseUp&&(this.removeMouseUp=this.removeMouseUp())},onMouseDown:function(t){var d=this,e=d.chart.pointer;t.preventDefault&&
t.preventDefault();if(2!==t.button){t=e.normalize(t);var u=t.chartX;var l=t.chartY;d.cancelClick=!1;d.chart.hasDraggedAnnotation=!0;d.removeDrag=k(c.doc,c.isTouchDevice?"touchmove":"mousemove",function(b){d.hasDragged=!0;b=e.normalize(b);b.prevChartX=u;b.prevChartY=l;g(d,"drag",b);u=b.chartX;l=b.chartY});d.removeMouseUp=k(c.doc,c.isTouchDevice?"touchend":"mouseup",function(e){d.cancelClick=d.hasDragged;d.hasDragged=!1;d.chart.hasDraggedAnnotation=!1;g(b(d.target,d),"afterUpdate");d.onMouseUp(e)})}},
onMouseUp:function(b){var d=this.chart;b=this.target||this;var e=d.options.annotations;d=d.annotations.indexOf(b);this.removeDocEvents();e[d]=b.options},onDrag:function(b){if(this.chart.isInsidePlot(b.chartX-this.chart.plotLeft,b.chartY-this.chart.plotTop)){var d=this.mouseMoveToTranslation(b);"x"===this.options.draggable&&(d.y=0);"y"===this.options.draggable&&(d.x=0);this.points.length?this.translate(d.x,d.y):(this.shapes.forEach(function(b){b.translate(d.x,d.y)}),this.labels.forEach(function(b){b.translate(d.x,
d.y)}));this.redraw(!1)}},mouseMoveToRadians:function(b,d,e){var c=b.prevChartY-e,l=b.prevChartX-d;e=b.chartY-e;b=b.chartX-d;this.chart.inverted&&(d=l,l=c,c=d,d=b,b=e,e=d);return Math.atan2(e,b)-Math.atan2(c,l)},mouseMoveToTranslation:function(b){var d=b.chartX-b.prevChartX;b=b.chartY-b.prevChartY;if(this.chart.inverted){var e=b;b=d;d=e}return{x:d,y:b}},mouseMoveToScale:function(b,d,e){d=(b.chartX-d||1)/(b.prevChartX-d||1);b=(b.chartY-e||1)/(b.prevChartY-e||1);this.chart.inverted&&(e=b,b=d,d=e);return{x:d,
y:b}},destroy:function(){this.removeDocEvents();A(this);this.hcEvents=null}}});v(a,"Extensions/Annotations/ControlPoint.js",[a["Core/Utilities.js"],a["Extensions/Annotations/Mixins/EventEmitterMixin.js"]],function(c,a){var k=c.merge,g=c.pick;return function(){function c(b,c,t,d){this.addEvents=a.addEvents;this.graphic=void 0;this.mouseMoveToRadians=a.mouseMoveToRadians;this.mouseMoveToScale=a.mouseMoveToScale;this.mouseMoveToTranslation=a.mouseMoveToTranslation;this.onDrag=a.onDrag;this.onMouseDown=
a.onMouseDown;this.onMouseUp=a.onMouseUp;this.removeDocEvents=a.removeDocEvents;this.nonDOMEvents=["drag"];this.chart=b;this.target=c;this.options=t;this.index=g(t.index,d)}c.prototype.setVisibility=function(b){this.graphic.attr("visibility",b?"visible":"hidden");this.options.visible=b};c.prototype.render=function(){var b=this.chart,c=this.options;this.graphic=b.renderer.symbol(c.symbol,0,0,c.width,c.height).add(b.controlPointsGroup).css(c.style);this.setVisibility(c.visible);this.addEvents()};c.prototype.redraw=
function(b){this.graphic[b?"animate":"attr"](this.options.positioner.call(this,this.target))};c.prototype.destroy=function(){a.destroy.call(this);this.graphic&&(this.graphic=this.graphic.destroy());this.options=this.target=this.chart=null};c.prototype.update=function(b){var c=this.chart,a=this.target,d=this.index;b=k(!0,this.options,b);this.destroy();this.constructor(c,a,b,d);this.render(c.controlPointsGroup);this.redraw()};return c}()});v(a,"Extensions/Annotations/MockPoint.js",[a["Core/Globals.js"],
a["Core/Utilities.js"]],function(c,a){var k=a.defined,g=a.fireEvent;return function(){function a(b,a,t){this.y=this.x=this.plotY=this.plotX=this.isInside=void 0;this.mock=!0;this.series={visible:!0,chart:b,getPlotBox:c.Series.prototype.getPlotBox};this.target=a||null;this.options=t;this.applyOptions(this.getOptions())}a.fromPoint=function(b){return new a(b.series.chart,null,{x:b.x,y:b.y,xAxis:b.series.xAxis,yAxis:b.series.yAxis})};a.pointToPixels=function(b,c){var a=b.series,d=a.chart,e=b.plotX,u=
b.plotY;d.inverted&&(b.mock?(e=b.plotY,u=b.plotX):(e=d.plotWidth-b.plotY,u=d.plotHeight-b.plotX));a&&!c&&(b=a.getPlotBox(),e+=b.translateX,u+=b.translateY);return{x:e,y:u}};a.pointToOptions=function(b){return{x:b.x,y:b.y,xAxis:b.series.xAxis,yAxis:b.series.yAxis}};a.prototype.hasDynamicOptions=function(){return"function"===typeof this.options};a.prototype.getOptions=function(){return this.hasDynamicOptions()?this.options(this.target):this.options};a.prototype.applyOptions=function(b){this.command=
b.command;this.setAxis(b,"x");this.setAxis(b,"y");this.refresh()};a.prototype.setAxis=function(b,a){a+="Axis";b=b[a];var t=this.series.chart;this.series[a]=b instanceof c.Axis?b:k(b)?t[a][b]||t.get(b):null};a.prototype.toAnchor=function(){var b=[this.plotX,this.plotY,0,0];this.series.chart.inverted&&(b[0]=this.plotY,b[1]=this.plotX);return b};a.prototype.getLabelConfig=function(){return{x:this.x,y:this.y,point:this}};a.prototype.isInsidePlot=function(){var b=this.plotX,c=this.plotY,a=this.series.xAxis,
d=this.series.yAxis,e={x:b,y:c,isInsidePlot:!0};a&&(e.isInsidePlot=k(b)&&0<=b&&b<=a.len);d&&(e.isInsidePlot=e.isInsidePlot&&k(c)&&0<=c&&c<=d.len);g(this.series.chart,"afterIsInsidePlot",e);return e.isInsidePlot};a.prototype.refresh=function(){var b=this.series,c=b.xAxis;b=b.yAxis;var a=this.getOptions();c?(this.x=a.x,this.plotX=c.toPixels(a.x,!0)):(this.x=null,this.plotX=a.x);b?(this.y=a.y,this.plotY=b.toPixels(a.y,!0)):(this.y=null,this.plotY=a.y);this.isInside=this.isInsidePlot()};a.prototype.translate=
function(b,c,a,d){this.hasDynamicOptions()||(this.plotX+=a,this.plotY+=d,this.refreshOptions())};a.prototype.scale=function(b,c,a,d){if(!this.hasDynamicOptions()){var e=this.plotY*d;this.plotX=(1-a)*b+this.plotX*a;this.plotY=(1-d)*c+e;this.refreshOptions()}};a.prototype.rotate=function(b,c,a){if(!this.hasDynamicOptions()){var d=Math.cos(a);a=Math.sin(a);var e=this.plotX,u=this.plotY;e-=b;u-=c;this.plotX=e*d-u*a+b;this.plotY=e*a+u*d+c;this.refreshOptions()}};a.prototype.refreshOptions=function(){var b=
this.series,c=b.xAxis;b=b.yAxis;this.x=this.options.x=c?this.options.x=c.toValue(this.plotX,!0):this.plotX;this.y=this.options.y=b?b.toValue(this.plotY,!0):this.plotY};return a}()});v(a,"Extensions/Annotations/Mixins/ControllableMixin.js",[a["Extensions/Annotations/ControlPoint.js"],a["Extensions/Annotations/MockPoint.js"],a["Core/Tooltip.js"],a["Core/Utilities.js"]],function(c,a,p,g){var k=g.isObject,b=g.isString,A=g.merge,t=g.splat;return{init:function(b,c,a){this.annotation=b;this.chart=b.chart;
this.options=c;this.points=[];this.controlPoints=[];this.index=a;this.linkPoints();this.addControlPoints()},attr:function(){this.graphic.attr.apply(this.graphic,arguments)},getPointsOptions:function(){var b=this.options;return b.points||b.point&&t(b.point)},attrsFromOptions:function(b){var c=this.constructor.attrsMap,d={},a,m=this.chart.styledMode;for(a in b){var q=c[a];!q||m&&-1!==["fill","stroke","stroke-width"].indexOf(q)||(d[q]=b[a])}return d},anchor:function(b){var c=b.series.getPlotBox();b=
b.mock?b.toAnchor():p.prototype.getAnchor.call({chart:b.series.chart},b);b={x:b[0]+(this.options.x||0),y:b[1]+(this.options.y||0),height:b[2]||0,width:b[3]||0};return{relativePosition:b,absolutePosition:A(b,{x:b.x+c.translateX,y:b.y+c.translateY})}},point:function(c,e){if(c&&c.series)return c;e&&null!==e.series||(k(c)?e=new a(this.chart,this,c):b(c)?e=this.chart.get(c)||null:"function"===typeof c&&(e=c.call(e,this),e=e.series?e:new a(this.chart,this,c)));return e},linkPoints:function(){var b=this.getPointsOptions(),
c=this.points,a=b&&b.length||0,l;for(l=0;l<a;l++){var m=this.point(b[l],c[l]);if(!m){c.length=0;return}m.mock&&m.refresh();c[l]=m}return c},addControlPoints:function(){var b=this.options.controlPoints;(b||[]).forEach(function(a,d){a=A(this.options.controlPointOptions,a);a.index||(a.index=d);b[d]=a;this.controlPoints.push(new c(this.chart,this,a))},this)},shouldBeDrawn:function(){return!!this.points.length},render:function(b){this.controlPoints.forEach(function(b){b.render()})},redraw:function(b){this.controlPoints.forEach(function(c){c.redraw(b)})},
transform:function(b,c,a,l,m){if(this.chart.inverted){var d=c;c=a;a=d}this.points.forEach(function(f,d){this.transformPoint(b,c,a,l,m,d)},this)},transformPoint:function(b,c,u,l,m,q){var f=this.points[q];f.mock||(f=this.points[q]=a.fromPoint(f));f[b](c,u,l,m)},translate:function(b,c){this.transform("translate",null,null,b,c)},translatePoint:function(b,c,a){this.transformPoint("translate",null,null,b,c,a)},translateShape:function(b,c){var a=this.annotation.chart,d=this.annotation.userOptions,e=a.annotations.indexOf(this.annotation);
a=a.options.annotations[e];this.translatePoint(b,c,0);a[this.collection][this.index].point=this.options.point;d[this.collection][this.index].point=this.options.point},rotate:function(b,c,a){this.transform("rotate",b,c,a)},scale:function(b,c,a,l){this.transform("scale",b,c,a,l)},setControlPointsVisibility:function(b){this.controlPoints.forEach(function(c){c.setVisibility(b)})},destroy:function(){this.graphic&&(this.graphic=this.graphic.destroy());this.tracker&&(this.tracker=this.tracker.destroy());
this.controlPoints.forEach(function(b){b.destroy()});this.options=this.controlPoints=this.points=this.chart=null;this.annotation&&(this.annotation=null)},update:function(b){var c=this.annotation;b=A(!0,this.options,b);var a=this.graphic.parentGroup;this.destroy();this.constructor(c,b);this.render(a);this.redraw()}}});v(a,"Extensions/Annotations/Mixins/MarkerMixin.js",[a["Core/Chart/Chart.js"],a["Core/Renderer/SVG/SVGRenderer.js"],a["Core/Utilities.js"]],function(c,a,p){function g(b){return function(c){this.attr(b,
"url(#"+c+")")}}var k=p.addEvent,b=p.defined,A=p.merge,t=p.objectEach,d=p.uniqueKey,e={arrow:{tagName:"marker",render:!1,id:"arrow",refY:5,refX:9,markerWidth:10,markerHeight:10,children:[{tagName:"path",d:"M 0 0 L 10 5 L 0 10 Z",strokeWidth:0}]},"reverse-arrow":{tagName:"marker",render:!1,id:"reverse-arrow",refY:5,refX:1,markerWidth:10,markerHeight:10,children:[{tagName:"path",d:"M 0 5 L 10 0 L 10 10 Z",strokeWidth:0}]}};a.prototype.addMarker=function(b,c){var a={id:b},d={stroke:c.color||"none",fill:c.color||
"rgba(0, 0, 0, 0.75)"};a.children=c.children.map(function(b){return A(d,b)});c=this.definition(A(!0,{markerWidth:20,markerHeight:20,refX:0,refY:0,orient:"auto"},c,a));c.id=b;return c};a={markerEndSetter:g("marker-end"),markerStartSetter:g("marker-start"),setItemMarkers:function(c){var a=c.options,e=c.chart,q=e.options.defs,f=a.fill,h=b(f)&&"none"!==f?f:a.stroke;["markerStart","markerEnd"].forEach(function(b){var f=a[b],l;if(f){for(l in q){var n=q[l];if(f===n.id&&"marker"===n.tagName){var y=n;break}}y&&
(f=c[b]=e.renderer.addMarker((a.id||d())+"-"+y.id,A(y,{color:h})),c.attr(b,f.attr("id")))}})}};k(c,"afterGetContainer",function(){this.options.defs=A(e,this.options.defs||{});t(this.options.defs,function(b){"marker"===b.tagName&&!1!==b.render&&this.renderer.addMarker(b.id,b)},this)});return a});v(a,"Extensions/Annotations/Controllables/ControllablePath.js",[a["Extensions/Annotations/Mixins/ControllableMixin.js"],a["Core/Globals.js"],a["Extensions/Annotations/Mixins/MarkerMixin.js"],a["Core/Utilities.js"]],
function(c,a,p,g){var k=g.extend,b="rgba(192,192,192,"+(a.svg?.0001:.002)+")";return function(){function a(b,a,e){this.addControlPoints=c.addControlPoints;this.anchor=c.anchor;this.attr=c.attr;this.attrsFromOptions=c.attrsFromOptions;this.destroy=c.destroy;this.getPointsOptions=c.getPointsOptions;this.init=c.init;this.linkPoints=c.linkPoints;this.point=c.point;this.rotate=c.rotate;this.scale=c.scale;this.setControlPointsVisibility=c.setControlPointsVisibility;this.setMarkers=p.setItemMarkers;this.transform=
c.transform;this.transformPoint=c.transformPoint;this.translate=c.translate;this.translatePoint=c.translatePoint;this.translateShape=c.translateShape;this.update=c.update;this.type="path";this.init(b,a,e);this.collection="shapes"}a.prototype.toD=function(){var b=this.options.d;if(b)return"function"===typeof b?b.call(this):b;b=this.points;var c=b.length,a=c,u=b[0],l=a&&this.anchor(u).absolutePosition,m=0,q=[];if(l)for(q.push(["M",l.x,l.y]);++m<c&&a;)u=b[m],a=u.command||"L",l=this.anchor(u).absolutePosition,
"M"===a?q.push([a,l.x,l.y]):"L"===a?q.push([a,l.x,l.y]):"Z"===a&&q.push([a]),a=u.series.visible;return a?this.chart.renderer.crispLine(q,this.graphic.strokeWidth()):null};a.prototype.shouldBeDrawn=function(){return c.shouldBeDrawn.call(this)||!!this.options.d};a.prototype.render=function(a){var d=this.options,e=this.attrsFromOptions(d);this.graphic=this.annotation.chart.renderer.path([["M",0,0]]).attr(e).add(a);d.className&&this.graphic.addClass(d.className);this.tracker=this.annotation.chart.renderer.path([["M",
0,0]]).addClass("highcharts-tracker-line").attr({zIndex:2}).add(a);this.annotation.chart.styledMode||this.tracker.attr({"stroke-linejoin":"round",stroke:b,fill:b,"stroke-width":this.graphic.strokeWidth()+2*d.snap});c.render.call(this);k(this.graphic,{markerStartSetter:p.markerStartSetter,markerEndSetter:p.markerEndSetter});this.setMarkers(this)};a.prototype.redraw=function(b){var a=this.toD(),e=b?"animate":"attr";a?(this.graphic[e]({d:a}),this.tracker[e]({d:a})):(this.graphic.attr({d:"M 0 -9000000000"}),
this.tracker.attr({d:"M 0 -9000000000"}));this.graphic.placed=this.tracker.placed=!!a;c.redraw.call(this,b)};a.attrsMap={dashStyle:"dashstyle",strokeWidth:"stroke-width",stroke:"stroke",fill:"fill",zIndex:"zIndex"};return a}()});v(a,"Extensions/Annotations/Controllables/ControllableRect.js",[a["Extensions/Annotations/Mixins/ControllableMixin.js"],a["Extensions/Annotations/Controllables/ControllablePath.js"],a["Core/Utilities.js"]],function(c,a,p){var g=p.merge;return function(){function k(b,a,k){this.addControlPoints=
c.addControlPoints;this.anchor=c.anchor;this.attr=c.attr;this.attrsFromOptions=c.attrsFromOptions;this.destroy=c.destroy;this.getPointsOptions=c.getPointsOptions;this.init=c.init;this.linkPoints=c.linkPoints;this.point=c.point;this.rotate=c.rotate;this.scale=c.scale;this.setControlPointsVisibility=c.setControlPointsVisibility;this.shouldBeDrawn=c.shouldBeDrawn;this.transform=c.transform;this.transformPoint=c.transformPoint;this.translatePoint=c.translatePoint;this.translateShape=c.translateShape;
this.update=c.update;this.type="rect";this.translate=c.translateShape;this.init(b,a,k);this.collection="shapes"}k.prototype.render=function(b){var a=this.attrsFromOptions(this.options);this.graphic=this.annotation.chart.renderer.rect(0,-9E9,0,0).attr(a).add(b);c.render.call(this)};k.prototype.redraw=function(b){var a=this.anchor(this.points[0]).absolutePosition;if(a)this.graphic[b?"animate":"attr"]({x:a.x,y:a.y,width:this.options.width,height:this.options.height});else this.attr({x:0,y:-9E9});this.graphic.placed=
!!a;c.redraw.call(this,b)};k.attrsMap=g(a.attrsMap,{width:"width",height:"height"});return k}()});v(a,"Extensions/Annotations/Controllables/ControllableCircle.js",[a["Extensions/Annotations/Mixins/ControllableMixin.js"],a["Extensions/Annotations/Controllables/ControllablePath.js"],a["Core/Utilities.js"]],function(a,k,p){var c=p.merge;return function(){function g(b,c,g){this.addControlPoints=a.addControlPoints;this.anchor=a.anchor;this.attr=a.attr;this.attrsFromOptions=a.attrsFromOptions;this.destroy=
a.destroy;this.getPointsOptions=a.getPointsOptions;this.init=a.init;this.linkPoints=a.linkPoints;this.point=a.point;this.rotate=a.rotate;this.scale=a.scale;this.setControlPointsVisibility=a.setControlPointsVisibility;this.shouldBeDrawn=a.shouldBeDrawn;this.transform=a.transform;this.transformPoint=a.transformPoint;this.translatePoint=a.translatePoint;this.translateShape=a.translateShape;this.update=a.update;this.type="circle";this.translate=a.translateShape;this.init(b,c,g);this.collection="shapes"}
g.prototype.render=function(b){var c=this.attrsFromOptions(this.options);this.graphic=this.annotation.chart.renderer.circle(0,-9E9,0).attr(c).add(b);a.render.call(this)};g.prototype.redraw=function(b){var c=this.anchor(this.points[0]).absolutePosition;if(c)this.graphic[b?"animate":"attr"]({x:c.x,y:c.y,r:this.options.r});else this.graphic.attr({x:0,y:-9E9});this.graphic.placed=!!c;a.redraw.call(this,b)};g.prototype.setRadius=function(b){this.options.r=b};g.attrsMap=c(k.attrsMap,{r:"r"});return g}()});
v(a,"Extensions/Annotations/Controllables/ControllableLabel.js",[a["Extensions/Annotations/Mixins/ControllableMixin.js"],a["Extensions/Annotations/MockPoint.js"],a["Core/Renderer/SVG/SVGRenderer.js"],a["Core/Tooltip.js"],a["Core/Utilities.js"]],function(a,k,p,g,z){var b=z.extend,c=z.format,t=z.isNumber,d=z.pick;z=function(){function e(b,c,d){this.addControlPoints=a.addControlPoints;this.attr=a.attr;this.attrsFromOptions=a.attrsFromOptions;this.destroy=a.destroy;this.getPointsOptions=a.getPointsOptions;
this.init=a.init;this.linkPoints=a.linkPoints;this.point=a.point;this.rotate=a.rotate;this.scale=a.scale;this.setControlPointsVisibility=a.setControlPointsVisibility;this.shouldBeDrawn=a.shouldBeDrawn;this.transform=a.transform;this.transformPoint=a.transformPoint;this.translateShape=a.translateShape;this.update=a.update;this.init(b,c,d);this.collection="labels"}e.alignedPosition=function(b,a){var c=b.align,d=b.verticalAlign,f=(a.x||0)+(b.x||0),h=(a.y||0)+(b.y||0),l,e;"right"===c?l=1:"center"===c&&
(l=2);l&&(f+=(a.width-(b.width||0))/l);"bottom"===d?e=1:"middle"===d&&(e=2);e&&(h+=(a.height-(b.height||0))/e);return{x:Math.round(f),y:Math.round(h)}};e.justifiedOptions=function(b,a,c,d){var f=c.align,h=c.verticalAlign,e=a.box?0:a.padding||0,l=a.getBBox();a={align:f,verticalAlign:h,x:c.x,y:c.y,width:a.width,height:a.height};c=d.x-b.plotLeft;var g=d.y-b.plotTop;d=c+e;0>d&&("right"===f?a.align="left":a.x=-d);d=c+l.width-e;d>b.plotWidth&&("left"===f?a.align="right":a.x=b.plotWidth-d);d=g+e;0>d&&("bottom"===
h?a.verticalAlign="top":a.y=-d);d=g+l.height-e;d>b.plotHeight&&("top"===h?a.verticalAlign="bottom":a.y=b.plotHeight-d);return a};e.prototype.translatePoint=function(b,c){a.translatePoint.call(this,b,c,0)};e.prototype.translate=function(b,a){var c=this.annotation.chart,d=this.annotation.userOptions,f=c.annotations.indexOf(this.annotation);f=c.options.annotations[f];c.inverted&&(c=b,b=a,a=c);this.options.x+=b;this.options.y+=a;f[this.collection][this.index].x=this.options.x;f[this.collection][this.index].y=
this.options.y;d[this.collection][this.index].x=this.options.x;d[this.collection][this.index].y=this.options.y};e.prototype.render=function(b){var c=this.options,d=this.attrsFromOptions(c),g=c.style;this.graphic=this.annotation.chart.renderer.label("",0,-9999,c.shape,null,null,c.useHTML,null,"annotation-label").attr(d).add(b);this.annotation.chart.styledMode||("contrast"===g.color&&(g.color=this.annotation.chart.renderer.getContrast(-1<e.shapesWithoutBackground.indexOf(c.shape)?"#FFFFFF":c.backgroundColor)),
this.graphic.css(c.style).shadow(c.shadow));c.className&&this.graphic.addClass(c.className);this.graphic.labelrank=c.labelrank;a.render.call(this)};e.prototype.redraw=function(b){var d=this.options,e=this.text||d.format||d.text,g=this.graphic,f=this.points[0];g.attr({text:e?c(e,f.getLabelConfig(),this.annotation.chart):d.formatter.call(f,this)});d=this.anchor(f);(e=this.position(d))?(g.alignAttr=e,e.anchorX=d.absolutePosition.x,e.anchorY=d.absolutePosition.y,g[b?"animate":"attr"](e)):g.attr({x:0,
y:-9999});g.placed=!!e;a.redraw.call(this,b)};e.prototype.anchor=function(b){var c=a.anchor.apply(this,arguments),d=this.options.x||0,e=this.options.y||0;c.absolutePosition.x-=d;c.absolutePosition.y-=e;c.relativePosition.x-=d;c.relativePosition.y-=e;return c};e.prototype.position=function(a){var c=this.graphic,m=this.annotation.chart,q=this.points[0],f=this.options,h=a.absolutePosition,w=a.relativePosition;if(a=q.series.visible&&k.prototype.isInsidePlot.call(q)){if(f.distance)var r=g.prototype.getPosition.call({chart:m,
distance:d(f.distance,16)},c.width,c.height,{plotX:w.x,plotY:w.y,negative:q.negative,ttBelow:q.ttBelow,h:w.height||w.width});else f.positioner?r=f.positioner.call(this):(q={x:h.x,y:h.y,width:0,height:0},r=e.alignedPosition(b(f,{width:c.width,height:c.height}),q),"justify"===this.options.overflow&&(r=e.alignedPosition(e.justifiedOptions(m,c,f,r),q)));f.crop&&(f=r.x-m.plotLeft,q=r.y-m.plotTop,a=m.isInsidePlot(f,q)&&m.isInsidePlot(f+c.width,q+c.height))}return a?r:null};e.attrsMap={backgroundColor:"fill",
borderColor:"stroke",borderWidth:"stroke-width",zIndex:"zIndex",borderRadius:"r",padding:"padding"};e.shapesWithoutBackground=["connector"];return e}();p.prototype.symbols.connector=function(b,a,c,d,g){var f=g&&g.anchorX;g=g&&g.anchorY;var h=c/2;if(t(f)&&t(g)){var e=[["M",f,g]];var r=a-g;0>r&&(r=-d-r);r<c&&(h=f<b+c/2?r:c-r);g>a+d?e.push(["L",b+h,a+d]):g<a?e.push(["L",b+h,a]):f<b?e.push(["L",b,a+d/2]):f>b+c&&e.push(["L",b+c,a+d/2])}return e||[]};return z});v(a,"Extensions/Annotations/Controllables/ControllableImage.js",
[a["Extensions/Annotations/Controllables/ControllableLabel.js"],a["Extensions/Annotations/Mixins/ControllableMixin.js"]],function(a,k){return function(){function c(a,c,b){this.addControlPoints=k.addControlPoints;this.anchor=k.anchor;this.attr=k.attr;this.attrsFromOptions=k.attrsFromOptions;this.destroy=k.destroy;this.getPointsOptions=k.getPointsOptions;this.init=k.init;this.linkPoints=k.linkPoints;this.point=k.point;this.rotate=k.rotate;this.scale=k.scale;this.setControlPointsVisibility=k.setControlPointsVisibility;
this.shouldBeDrawn=k.shouldBeDrawn;this.transform=k.transform;this.transformPoint=k.transformPoint;this.translatePoint=k.translatePoint;this.translateShape=k.translateShape;this.update=k.update;this.type="image";this.translate=k.translateShape;this.init(a,c,b);this.collection="shapes"}c.prototype.render=function(a){var c=this.attrsFromOptions(this.options),b=this.options;this.graphic=this.annotation.chart.renderer.image(b.src,0,-9E9,b.width,b.height).attr(c).add(a);this.graphic.width=b.width;this.graphic.height=
b.height;k.render.call(this)};c.prototype.redraw=function(c){var g=this.anchor(this.points[0]);if(g=a.prototype.position.call(this,g))this.graphic[c?"animate":"attr"]({x:g.x,y:g.y});else this.graphic.attr({x:0,y:-9E9});this.graphic.placed=!!g;k.redraw.call(this,c)};c.attrsMap={width:"width",height:"height",zIndex:"zIndex"};return c}()});v(a,"Extensions/Annotations/Annotations.js",[a["Core/Chart/Chart.js"],a["Extensions/Annotations/Mixins/ControllableMixin.js"],a["Extensions/Annotations/Controllables/ControllableRect.js"],
a["Extensions/Annotations/Controllables/ControllableCircle.js"],a["Extensions/Annotations/Controllables/ControllablePath.js"],a["Extensions/Annotations/Controllables/ControllableImage.js"],a["Extensions/Annotations/Controllables/ControllableLabel.js"],a["Extensions/Annotations/ControlPoint.js"],a["Extensions/Annotations/Mixins/EventEmitterMixin.js"],a["Core/Globals.js"],a["Extensions/Annotations/MockPoint.js"],a["Core/Pointer.js"],a["Core/Utilities.js"]],function(a,k,p,g,z,b,v,t,d,e,u,l,m){a=a.prototype;
var c=m.addEvent,f=m.defined,h=m.destroyObjectProperties,w=m.erase,r=m.extend,B=m.find,n=m.fireEvent,y=m.getDeferredAnimation,x=m.merge,C=m.pick,E=m.splat;m=m.wrap;var D=function(){function a(a,b){this.annotation=void 0;this.coll="annotations";this.shapesGroup=this.labelsGroup=this.labelCollector=this.group=this.graphic=this.animationConfig=this.collection=void 0;this.chart=a;this.points=[];this.controlPoints=[];this.coll="annotations";this.labels=[];this.shapes=[];this.options=x(this.defaultOptions,
b);this.userOptions=b;b=this.getLabelsAndShapesOptions(this.options,b);this.options.labels=b.labels;this.options.shapes=b.shapes;this.init(a,this.options)}a.prototype.init=function(){var a=this.chart,b=this.options.animation;this.linkPoints();this.addControlPoints();this.addShapes();this.addLabels();this.setLabelCollector();this.animationConfig=y(a,b)};a.prototype.getLabelsAndShapesOptions=function(a,b){var c={};["labels","shapes"].forEach(function(d){a[d]&&(c[d]=E(b[d]).map(function(b,c){return x(a[d][c],
b)}))});return c};a.prototype.addShapes=function(){(this.options.shapes||[]).forEach(function(a,b){a=this.initShape(a,b);x(!0,this.options.shapes[b],a.options)},this)};a.prototype.addLabels=function(){(this.options.labels||[]).forEach(function(a,b){a=this.initLabel(a,b);x(!0,this.options.labels[b],a.options)},this)};a.prototype.addClipPaths=function(){this.setClipAxes();this.clipXAxis&&this.clipYAxis&&(this.clipRect=this.chart.renderer.clipRect(this.getClipBox()))};a.prototype.setClipAxes=function(){var a=
this.chart.xAxis,b=this.chart.yAxis,c=(this.options.labels||[]).concat(this.options.shapes||[]).reduce(function(c,d){return[a[d&&d.point&&d.point.xAxis]||c[0],b[d&&d.point&&d.point.yAxis]||c[1]]},[]);this.clipXAxis=c[0];this.clipYAxis=c[1]};a.prototype.getClipBox=function(){if(this.clipXAxis&&this.clipYAxis)return{x:this.clipXAxis.left,y:this.clipYAxis.top,width:this.clipXAxis.width,height:this.clipYAxis.height}};a.prototype.setLabelCollector=function(){var a=this;a.labelCollector=function(){return a.labels.reduce(function(a,
b){b.options.allowOverlap||a.push(b.graphic);return a},[])};a.chart.labelCollectors.push(a.labelCollector)};a.prototype.setOptions=function(a){this.options=x(this.defaultOptions,a)};a.prototype.redraw=function(a){this.linkPoints();this.graphic||this.render();this.clipRect&&this.clipRect.animate(this.getClipBox());this.redrawItems(this.shapes,a);this.redrawItems(this.labels,a);k.redraw.call(this,a)};a.prototype.redrawItems=function(a,b){for(var c=a.length;c--;)this.redrawItem(a[c],b)};a.prototype.renderItems=
function(a){for(var b=a.length;b--;)this.renderItem(a[b])};a.prototype.render=function(){var a=this.chart.renderer;this.graphic=a.g("annotation").attr({opacity:0,zIndex:this.options.zIndex,visibility:this.options.visible?"visible":"hidden"}).add();this.shapesGroup=a.g("annotation-shapes").add(this.graphic).clip(this.chart.plotBoxClip);this.labelsGroup=a.g("annotation-labels").attr({translateX:0,translateY:0}).add(this.graphic);this.addClipPaths();this.clipRect&&this.graphic.clip(this.clipRect);this.renderItems(this.shapes);
this.renderItems(this.labels);this.addEvents();k.render.call(this)};a.prototype.setVisibility=function(a){var b=this.options;a=C(a,!b.visible);this.graphic.attr("visibility",a?"visible":"hidden");a||this.setControlPointsVisibility(!1);b.visible=a};a.prototype.setControlPointsVisibility=function(a){var b=function(b){b.setControlPointsVisibility(a)};k.setControlPointsVisibility.call(this,a);this.shapes.forEach(b);this.labels.forEach(b)};a.prototype.destroy=function(){var a=this.chart,b=function(a){a.destroy()};
this.labels.forEach(b);this.shapes.forEach(b);this.clipYAxis=this.clipXAxis=null;w(a.labelCollectors,this.labelCollector);d.destroy.call(this);k.destroy.call(this);h(this,a)};a.prototype.remove=function(){return this.chart.removeAnnotation(this)};a.prototype.update=function(a,b){var c=this.chart,d=this.getLabelsAndShapesOptions(this.userOptions,a),f=c.annotations.indexOf(this);a=x(!0,this.userOptions,a);a.labels=d.labels;a.shapes=d.shapes;this.destroy();this.constructor(c,a);c.options.annotations[f]=
a;this.isUpdating=!0;C(b,!0)&&c.redraw();n(this,"afterUpdate");this.isUpdating=!1};a.prototype.initShape=function(b,c){b=x(this.options.shapeOptions,{controlPointOptions:this.options.controlPointOptions},b);c=new a.shapesMap[b.type](this,b,c);c.itemType="shape";this.shapes.push(c);return c};a.prototype.initLabel=function(a,b){a=x(this.options.labelOptions,{controlPointOptions:this.options.controlPointOptions},a);b=new v(this,a,b);b.itemType="label";this.labels.push(b);return b};a.prototype.redrawItem=
function(a,b){a.linkPoints();a.shouldBeDrawn()?(a.graphic||this.renderItem(a),a.redraw(C(b,!0)&&a.graphic.placed),a.points.length&&this.adjustVisibility(a)):this.destroyItem(a)};a.prototype.adjustVisibility=function(a){var b=!1,c=a.graphic;a.points.forEach(function(a){!1!==a.series.visible&&!1!==a.visible&&(b=!0)});b?"hidden"===c.visibility&&c.show():c.hide()};a.prototype.destroyItem=function(a){w(this[a.itemType+"s"],a);a.destroy()};a.prototype.renderItem=function(a){a.render("label"===a.itemType?
this.labelsGroup:this.shapesGroup)};a.ControlPoint=t;a.MockPoint=u;a.shapesMap={rect:p,circle:g,path:z,image:b};a.types={};return a}();x(!0,D.prototype,k,d,x(D.prototype,{nonDOMEvents:["add","afterUpdate","drag","remove"],defaultOptions:{visible:!0,animation:{},draggable:"xy",labelOptions:{align:"center",allowOverlap:!1,backgroundColor:"rgba(0, 0, 0, 0.75)",borderColor:"black",borderRadius:3,borderWidth:1,className:"",crop:!1,formatter:function(){return f(this.y)?this.y:"Annotation label"},includeInDataExport:!0,
overflow:"justify",padding:5,shadow:!1,shape:"callout",style:{fontSize:"11px",fontWeight:"normal",color:"contrast"},useHTML:!1,verticalAlign:"bottom",x:0,y:-16},shapeOptions:{stroke:"rgba(0, 0, 0, 0.75)",strokeWidth:1,fill:"rgba(0, 0, 0, 0.75)",r:0,snap:2},controlPointOptions:{symbol:"circle",width:10,height:10,style:{stroke:"black","stroke-width":2,fill:"white"},visible:!1,events:{}},events:{},zIndex:6}}));e.extendAnnotation=function(a,b,c,d){b=b||D;x(!0,a.prototype,b.prototype,c);a.prototype.defaultOptions=
x(a.prototype.defaultOptions,d||{})};r(a,{initAnnotation:function(a){a=new (D.types[a.type]||D)(this,a);this.annotations.push(a);return a},addAnnotation:function(a,b){a=this.initAnnotation(a);this.options.annotations.push(a.options);C(b,!0)&&(a.redraw(),a.graphic.attr({opacity:1}));return a},removeAnnotation:function(a){var b=this.annotations,c="annotations"===a.coll?a:B(b,function(b){return b.options.id===a});c&&(n(c,"remove"),w(this.options.annotations,c.options),w(b,c),c.destroy())},drawAnnotations:function(){this.plotBoxClip.attr(this.plotBox);
this.annotations.forEach(function(a){a.redraw();a.graphic.animate({opacity:1},a.animationConfig)})}});a.collectionsWithUpdate.push("annotations");a.collectionsWithInit.annotations=[a.addAnnotation];a.callbacks.push(function(a){a.annotations=[];a.options.annotations||(a.options.annotations=[]);a.plotBoxClip=this.renderer.clipRect(this.plotBox);a.controlPointsGroup=a.renderer.g("control-points").attr({zIndex:99}).clip(a.plotBoxClip).add();a.options.annotations.forEach(function(b,c){b=a.initAnnotation(b);
a.options.annotations[c]=b.options});a.drawAnnotations();c(a,"redraw",a.drawAnnotations);c(a,"destroy",function(){a.plotBoxClip.destroy();a.controlPointsGroup.destroy()});c(a,"exportData",function(b){var c,d,f,e,h,n,x,y,g=a.annotations,C=(this.options.exporting&&this.options.exporting.csv||{}).columnHeaderFormatter,w=!b.dataRows[1].xValues,r=null===(d=null===(c=a.options.lang)||void 0===c?void 0:c.exportData)||void 0===d?void 0:d.annotationHeader;c=function(a){if(C){var b=C(a);if(!1!==b)return b}b=
r+" "+a;return w?{columnTitle:b,topLevelColumnTitle:b}:b};var k=b.dataRows[0].length,E=null===(h=null===(e=null===(f=a.options.exporting)||void 0===f?void 0:f.csv)||void 0===e?void 0:e.annotations)||void 0===h?void 0:h.itemDelimiter,B=null===(y=null===(x=null===(n=a.options.exporting)||void 0===n?void 0:n.csv)||void 0===x?void 0:x.annotations)||void 0===y?void 0:y.join;g.forEach(function(a){a.options.labelOptions.includeInDataExport&&a.labels.forEach(function(a){if(a.options.text){var c=a.options.text;
a.points.forEach(function(a){var d=a.x,f=a.series.xAxis?a.series.xAxis.options.index:-1,e=!1;if(-1===f){a=b.dataRows[0].length;for(var h=Array(a),n=0;n<a;++n)h[n]="";h.push(c);h.xValues=[];h.xValues[f]=d;b.dataRows.push(h);e=!0}e||b.dataRows.forEach(function(a,b){!e&&a.xValues&&void 0!==f&&d===a.xValues[f]&&(B&&a.length>k?a[a.length-1]+=E+c:a.push(c),e=!0)});if(!e){a=b.dataRows[0].length;h=Array(a);for(n=0;n<a;++n)h[n]="";h[0]=d;h.push(c);h.xValues=[];void 0!==f&&(h.xValues[f]=d);b.dataRows.push(h)}})}})});
var l=0;b.dataRows.forEach(function(a){l=Math.max(l,a.length)});f=l-b.dataRows[0].length;for(e=0;e<f;e++)h=c(e+1),w?(b.dataRows[0].push(h.topLevelColumnTitle),b.dataRows[1].push(h.columnTitle)):b.dataRows[0].push(h)})});m(l.prototype,"onContainerMouseDown",function(a){this.chart.hasDraggedAnnotation||a.apply(this,Array.prototype.slice.call(arguments,1))});return e.Annotation=D});v(a,"Mixins/Navigation.js",[],function(){return{initUpdate:function(a){a.navigation||(a.navigation={updates:[],update:function(a,
c){this.updates.forEach(function(g){g.update.call(g.context,a,c)})}})},addUpdate:function(a,k){k.navigation||this.initUpdate(k);k.navigation.updates.push({update:a,context:k})}}});v(a,"Extensions/Annotations/NavigationBindings.js",[a["Extensions/Annotations/Annotations.js"],a["Mixins/Navigation.js"],a["Core/Globals.js"],a["Core/Utilities.js"]],function(a,k,p,g){function c(a){var b=a.prototype.defaultOptions.events&&a.prototype.defaultOptions.events.click;q(!0,a.prototype.defaultOptions.events,{click:function(a){var c=
this,f=c.chart.navigationBindings,h=f.activeAnnotation;b&&b.call(c,a);h!==c?(f.deselectAnnotation(),f.activeAnnotation=c,c.setControlPointsVisibility(!0),d(f,"showPopup",{annotation:c,formType:"annotation-toolbar",options:f.annotationToFields(c),onSubmit:function(a){var b={};"remove"===a.actionType?(f.activeAnnotation=!1,f.chart.removeAnnotation(c)):(f.fieldsToOptions(a.fields,b),f.deselectAnnotation(),a=b.typeOptions,"measure"===c.options.type&&(a.crosshairY.enabled=0!==a.crosshairY.strokeWidth,
a.crosshairX.enabled=0!==a.crosshairX.strokeWidth),c.update(b))}})):(f.deselectAnnotation(),d(f,"closePopup"));a.activeAnnotation=!0}})}var b=g.addEvent,v=g.attr,t=g.format,d=g.fireEvent,e=g.isArray,u=g.isFunction,l=g.isNumber,m=g.isObject,q=g.merge,f=g.objectEach,h=g.pick;g=g.setOptions;var w=p.doc,r=p.win,B=function(){function a(a,b){this.selectedButton=this.boundClassNames=void 0;this.chart=a;this.options=b;this.eventsToUnbind=[];this.container=w.getElementsByClassName(this.options.bindingsClassName||
"")}a.prototype.initEvents=function(){var a=this,c=a.chart,d=a.container,h=a.options;a.boundClassNames={};f(h.bindings||{},function(b){a.boundClassNames[b.className]=b});[].forEach.call(d,function(c){a.eventsToUnbind.push(b(c,"click",function(b){var d=a.getButtonEvents(c,b);d&&a.bindingsButtonClick(d.button,d.events,b)}))});f(h.events||{},function(c,d){u(c)&&a.eventsToUnbind.push(b(a,d,c))});a.eventsToUnbind.push(b(c.container,"click",function(b){!c.cancelClick&&c.isInsidePlot(b.chartX-c.plotLeft,
b.chartY-c.plotTop)&&a.bindingsChartClick(this,b)}));a.eventsToUnbind.push(b(c.container,p.isTouchDevice?"touchmove":"mousemove",function(b){a.bindingsContainerMouseMove(this,b)}))};a.prototype.initUpdate=function(){var a=this;k.addUpdate(function(b){a.update(b)},this.chart)};a.prototype.bindingsButtonClick=function(a,b,c){var f=this.chart;this.selectedButtonElement&&(d(this,"deselectButton",{button:this.selectedButtonElement}),this.nextEvent&&(this.currentUserDetails&&"annotations"===this.currentUserDetails.coll&&
f.removeAnnotation(this.currentUserDetails),this.mouseMoveEvent=this.nextEvent=!1));this.selectedButton=b;this.selectedButtonElement=a;d(this,"selectButton",{button:a});b.init&&b.init.call(this,a,c);(b.start||b.steps)&&f.renderer.boxWrapper.addClass("highcharts-draw-mode")};a.prototype.bindingsChartClick=function(a,b){a=this.chart;var c=this.selectedButton;a=a.renderer.boxWrapper;var f;if(f=this.activeAnnotation&&!b.activeAnnotation&&b.target.parentNode){a:{f=b.target;var h=r.Element.prototype,e=
h.matches||h.msMatchesSelector||h.webkitMatchesSelector,n=null;if(h.closest)n=h.closest.call(f,".highcharts-popup");else{do{if(e.call(f,".highcharts-popup"))break a;f=f.parentElement||f.parentNode}while(null!==f&&1===f.nodeType)}f=n}f=!f}f&&(d(this,"closePopup"),this.deselectAnnotation());c&&c.start&&(this.nextEvent?(this.nextEvent(b,this.currentUserDetails),this.steps&&(this.stepIndex++,c.steps[this.stepIndex]?this.mouseMoveEvent=this.nextEvent=c.steps[this.stepIndex]:(d(this,"deselectButton",{button:this.selectedButtonElement}),
a.removeClass("highcharts-draw-mode"),c.end&&c.end.call(this,b,this.currentUserDetails),this.mouseMoveEvent=this.nextEvent=!1,this.selectedButton=null))):(this.currentUserDetails=c.start.call(this,b),c.steps?(this.stepIndex=0,this.steps=!0,this.mouseMoveEvent=this.nextEvent=c.steps[this.stepIndex]):(d(this,"deselectButton",{button:this.selectedButtonElement}),a.removeClass("highcharts-draw-mode"),this.steps=!1,this.selectedButton=null,c.end&&c.end.call(this,b,this.currentUserDetails))))};a.prototype.bindingsContainerMouseMove=
function(a,b){this.mouseMoveEvent&&this.mouseMoveEvent(b,this.currentUserDetails)};a.prototype.fieldsToOptions=function(a,b){f(a,function(a,c){var f=parseFloat(a),d=c.split("."),e=b,n=d.length-1;!l(f)||a.match(/px/g)||c.match(/format/g)||(a=f);""!==a&&"undefined"!==a&&d.forEach(function(b,c){var f=h(d[c+1],"");n===c?e[b]=a:(e[b]||(e[b]=f.match(/\d/g)?[]:{}),e=e[b])})});return b};a.prototype.deselectAnnotation=function(){this.activeAnnotation&&(this.activeAnnotation.setControlPointsVisibility(!1),
this.activeAnnotation=!1)};a.prototype.annotationToFields=function(b){function c(a,d,h,n){if(h&&a&&-1===k.indexOf(d)&&(0<=(h.indexOf&&h.indexOf(d))||h[d]||!0===h))if(e(a))n[d]=[],a.forEach(function(a,b){m(a)?(n[d][b]={},f(a,function(a,f){c(a,f,g[d],n[d][b])})):c(a,0,g[d],n[d])});else if(m(a)){var r={};e(n)?(n.push(r),r[d]={},r=r[d]):n[d]=r;f(a,function(a,b){c(a,b,0===d?h:g[d],r)})}else"format"===d?n[d]=[t(a,b.labels[0].points[0]).toString(),"text"]:e(n)?n.push([a,w(a)]):n[d]=[a,w(a)]}var d=b.options,
n=a.annotationsEditable,g=n.nestedOptions,w=this.utils.getFieldType,r=h(d.type,d.shapes&&d.shapes[0]&&d.shapes[0].type,d.labels&&d.labels[0]&&d.labels[0].itemType,"label"),k=a.annotationsNonEditable[d.langKey]||[],y={langKey:d.langKey,type:r};f(d,function(a,b){"typeOptions"===b?(y[b]={},f(d[b],function(a,d){c(a,d,g,y[b],!0)})):c(a,b,n[r],y)});return y};a.prototype.getClickedClassNames=function(a,b){var c=b.target;b=[];for(var d;c&&((d=v(c,"class"))&&(b=b.concat(d.split(" ").map(function(a){return[a,
c]}))),c=c.parentNode,c!==a););return b};a.prototype.getButtonEvents=function(a,b){var c=this,d;this.getClickedClassNames(a,b).forEach(function(a){c.boundClassNames[a[0]]&&!d&&(d={events:c.boundClassNames[a[0]],button:a[1]})});return d};a.prototype.update=function(a){this.options=q(!0,this.options,a);this.removeEvents();this.initEvents()};a.prototype.removeEvents=function(){this.eventsToUnbind.forEach(function(a){a()})};a.prototype.destroy=function(){this.removeEvents()};a.annotationsEditable={nestedOptions:{labelOptions:["style",
"format","backgroundColor"],labels:["style"],label:["style"],style:["fontSize","color"],background:["fill","strokeWidth","stroke"],innerBackground:["fill","strokeWidth","stroke"],outerBackground:["fill","strokeWidth","stroke"],shapeOptions:["fill","strokeWidth","stroke"],shapes:["fill","strokeWidth","stroke"],line:["strokeWidth","stroke"],backgroundColors:[!0],connector:["fill","strokeWidth","stroke"],crosshairX:["strokeWidth","stroke"],crosshairY:["strokeWidth","stroke"]},circle:["shapes"],verticalLine:[],
label:["labelOptions"],measure:["background","crosshairY","crosshairX"],fibonacci:[],tunnel:["background","line","height"],pitchfork:["innerBackground","outerBackground"],rect:["shapes"],crookedLine:[],basicAnnotation:["shapes","labelOptions"]};a.annotationsNonEditable={rectangle:["crosshairX","crosshairY","label"]};return a}();B.prototype.utils={updateRectSize:function(a,b){var c=b.chart,d=b.options.typeOptions,f=c.pointer.getCoordinates(a);a=f.xAxis[0].value-d.point.x;d=d.point.y-f.yAxis[0].value;
b.update({typeOptions:{background:{width:c.inverted?d:a,height:c.inverted?a:d}}})},getFieldType:function(a){return{string:"text",number:"number","boolean":"checkbox"}[typeof a]}};p.Chart.prototype.initNavigationBindings=function(){var a=this.options;a&&a.navigation&&a.navigation.bindings&&(this.navigationBindings=new B(this,a.navigation),this.navigationBindings.initEvents(),this.navigationBindings.initUpdate())};b(p.Chart,"load",function(){this.initNavigationBindings()});b(p.Chart,"destroy",function(){this.navigationBindings&&
this.navigationBindings.destroy()});b(B,"deselectButton",function(){this.selectedButtonElement=null});b(a,"remove",function(){this.chart.navigationBindings&&this.chart.navigationBindings.deselectAnnotation()});p.Annotation&&(c(a),f(a.types,function(a){c(a)}));g({lang:{navigation:{popup:{simpleShapes:"Simple shapes",lines:"Lines",circle:"Circle",rectangle:"Rectangle",label:"Label",shapeOptions:"Shape options",typeOptions:"Details",fill:"Fill",format:"Text",strokeWidth:"Line width",stroke:"Line color",
title:"Title",name:"Name",labelOptions:"Label options",labels:"Labels",backgroundColor:"Background color",backgroundColors:"Background colors",borderColor:"Border color",borderRadius:"Border radius",borderWidth:"Border width",style:"Style",padding:"Padding",fontSize:"Font size",color:"Color",height:"Height",shapes:"Shape options"}}},navigation:{bindingsClassName:"highcharts-bindings-container",bindings:{circleAnnotation:{className:"highcharts-circle-annotation",start:function(a){a=this.chart.pointer.getCoordinates(a);
var b=this.chart.options.navigation;return this.chart.addAnnotation(q({langKey:"circle",type:"basicAnnotation",shapes:[{type:"circle",point:{xAxis:0,yAxis:0,x:a.xAxis[0].value,y:a.yAxis[0].value},r:5}]},b.annotationsOptions,b.bindings.circleAnnotation.annotationsOptions))},steps:[function(a,b){var c=b.options.shapes[0].point,d=this.chart.xAxis[0].toPixels(c.x);c=this.chart.yAxis[0].toPixels(c.y);var f=this.chart.inverted;b.update({shapes:[{r:Math.max(Math.sqrt(Math.pow(f?c-a.chartX:d-a.chartX,2)+
Math.pow(f?d-a.chartY:c-a.chartY,2)),5)}]})}]},rectangleAnnotation:{className:"highcharts-rectangle-annotation",start:function(a){var b=this.chart.pointer.getCoordinates(a);a=this.chart.options.navigation;var c=b.xAxis[0].value;b=b.yAxis[0].value;return this.chart.addAnnotation(q({langKey:"rectangle",type:"basicAnnotation",shapes:[{type:"path",points:[{xAxis:0,yAxis:0,x:c,y:b},{xAxis:0,yAxis:0,x:c,y:b},{xAxis:0,yAxis:0,x:c,y:b},{xAxis:0,yAxis:0,x:c,y:b}]}]},a.annotationsOptions,a.bindings.rectangleAnnotation.annotationsOptions))},
steps:[function(a,b){var c=b.options.shapes[0].points,d=this.chart.pointer.getCoordinates(a);a=d.xAxis[0].value;d=d.yAxis[0].value;c[1].x=a;c[2].x=a;c[2].y=d;c[3].y=d;b.update({shapes:[{points:c}]})}]},labelAnnotation:{className:"highcharts-label-annotation",start:function(a){a=this.chart.pointer.getCoordinates(a);var b=this.chart.options.navigation;return this.chart.addAnnotation(q({langKey:"label",type:"basicAnnotation",labelOptions:{format:"{y:.2f}"},labels:[{point:{xAxis:0,yAxis:0,x:a.xAxis[0].value,
y:a.yAxis[0].value},overflow:"none",crop:!0}]},b.annotationsOptions,b.bindings.labelAnnotation.annotationsOptions))}}},events:{},annotationsOptions:{animation:{defer:0}}}});return B});v(a,"Extensions/Annotations/Popup.js",[a["Core/Globals.js"],a["Extensions/Annotations/NavigationBindings.js"],a["Core/Pointer.js"],a["Core/Utilities.js"]],function(a,k,p,g){var c=g.addEvent,b=g.createElement,v=g.defined,t=g.getOptions,d=g.isArray,e=g.isObject,u=g.isString,l=g.objectEach,m=g.pick;g=g.wrap;var q=/\d/g;
g(p.prototype,"onContainerMouseDown",function(a,b){var c=b.target&&b.target.className;u(c)&&0<=c.indexOf("highcharts-popup-field")||a.apply(this,Array.prototype.slice.call(arguments,1))});a.Popup=function(a,b){this.init(a,b)};a.Popup.prototype={init:function(a,c){this.container=b("div",{className:"highcharts-popup"},null,a);this.lang=this.getLangpack();this.iconsURL=c;this.addCloseBtn()},addCloseBtn:function(){var a=this;var d=b("div",{className:"highcharts-popup-close"},null,this.container);d.style["background-image"]=
"url("+this.iconsURL+"close.svg)";["click","touchstart"].forEach(function(b){c(d,b,function(){a.closePopup()})})},addColsContainer:function(a){var c=b("div",{className:"highcharts-popup-lhs-col"},null,a);a=b("div",{className:"highcharts-popup-rhs-col"},null,a);b("div",{className:"highcharts-popup-rhs-col-wrapper"},null,a);return{lhsCol:c,rhsCol:a}},addInput:function(a,c,d,e){var f=a.split(".");f=f[f.length-1];var h=this.lang;c="highcharts-"+c+"-"+f;c.match(q)||b("label",{innerHTML:h[f]||f,htmlFor:c},
null,d);b("input",{name:c,value:e[0],type:e[1],className:"highcharts-popup-field"},null,d).setAttribute("highcharts-data-name",a)},addButton:function(a,d,e,g,k){var f=this,h=this.closePopup,r=this.getFields;var w=b("button",{innerHTML:d},null,a);["click","touchstart"].forEach(function(a){c(w,a,function(){h.call(f);return g(r(k,e))})});return w},getFields:function(a,b){var c=a.querySelectorAll("input"),d=a.querySelectorAll("#highcharts-select-series > option:checked")[0];a=a.querySelectorAll("#highcharts-select-volume > option:checked")[0];
var f,e;var h={actionType:b,linkedTo:d&&d.getAttribute("value"),fields:{}};[].forEach.call(c,function(a){e=a.getAttribute("highcharts-data-name");(f=a.getAttribute("highcharts-data-series-id"))?h.seriesId=a.value:e?h.fields[e]=a.value:h.type=a.value});a&&(h.fields["params.volumeSeriesID"]=a.getAttribute("value"));return h},showPopup:function(){var a=this.container,b=a.querySelectorAll(".highcharts-popup-close")[0];a.innerHTML="";0<=a.className.indexOf("highcharts-annotation-toolbar")&&(a.classList.remove("highcharts-annotation-toolbar"),
a.removeAttribute("style"));a.appendChild(b);a.style.display="block"},closePopup:function(){this.popup.container.style.display="none"},showForm:function(a,b,c,d){this.popup=b.navigationBindings.popup;this.showPopup();"indicators"===a&&this.indicators.addForm.call(this,b,c,d);"annotation-toolbar"===a&&this.annotations.addToolbar.call(this,b,c,d);"annotation-edit"===a&&this.annotations.addForm.call(this,b,c,d);"flag"===a&&this.annotations.addForm.call(this,b,c,d,!0)},getLangpack:function(){return t().lang.navigation.popup},
annotations:{addToolbar:function(a,c,d){var f=this,e=this.lang,h=this.popup.container,g=this.showForm;-1===h.className.indexOf("highcharts-annotation-toolbar")&&(h.className+=" highcharts-annotation-toolbar");h.style.top=a.plotTop+10+"px";b("span",{innerHTML:m(e[c.langKey]||c.langKey,c.shapes&&c.shapes[0].type)},null,h);var k=this.addButton(h,e.removeButton||"remove","remove",d,h);k.className+=" highcharts-annotation-remove-button";k.style["background-image"]="url("+this.iconsURL+"destroy.svg)";k=
this.addButton(h,e.editButton||"edit","edit",function(){g.call(f,"annotation-edit",a,c,d)},h);k.className+=" highcharts-annotation-edit-button";k.style["background-image"]="url("+this.iconsURL+"edit.svg)"},addForm:function(a,c,d,e){var f=this.popup.container,h=this.lang;b("h2",{innerHTML:h[c.langKey]||c.langKey,className:"highcharts-popup-main-title"},null,f);var g=b("div",{className:"highcharts-popup-lhs-col highcharts-popup-lhs-full"},null,f);var k=b("div",{className:"highcharts-popup-bottom-row"},
null,f);this.annotations.addFormFields.call(this,g,a,"",c,[],!0);this.addButton(k,e?h.addButton||"add":h.saveButton||"save",e?"add":"save",d,f)},addFormFields:function(a,c,g,k,m,n){var f=this,h=this.annotations.addFormFields,r=this.addInput,w=this.lang,p,t;l(k,function(b,k){p=""!==g?g+"."+k:k;e(b)&&(!d(b)||d(b)&&e(b[0])?(t=w[k]||k,t.match(q)||m.push([!0,t,a]),h.call(f,a,c,p,b,m,!1)):m.push([f,p,"annotation",a,b]))});n&&(m=m.sort(function(a){return a[1].match(/format/g)?-1:1}),m.forEach(function(a){!0===
a[0]?b("span",{className:"highcharts-annotation-title",innerHTML:a[1]},null,a[2]):r.apply(a[0],a.splice(1))}))}},indicators:{addForm:function(a,b,c){var d=this.indicators,f=this.lang;this.tabs.init.call(this,a);b=this.popup.container.querySelectorAll(".highcharts-tab-item-content");this.addColsContainer(b[0]);d.addIndicatorList.call(this,a,b[0],"add");var e=b[0].querySelectorAll(".highcharts-popup-rhs-col")[0];this.addButton(e,f.addButton||"add","add",c,e);this.addColsContainer(b[1]);d.addIndicatorList.call(this,
a,b[1],"edit");e=b[1].querySelectorAll(".highcharts-popup-rhs-col")[0];this.addButton(e,f.saveButton||"save","edit",c,e);this.addButton(e,f.removeButton||"remove","remove",c,e)},addIndicatorList:function(a,d,e){var f=this,h=d.querySelectorAll(".highcharts-popup-lhs-col")[0];d=d.querySelectorAll(".highcharts-popup-rhs-col")[0];var g="edit"===e,k=g?a.series:a.options.plotOptions,w=this.indicators.addFormFields,m;var p=b("ul",{className:"highcharts-indicator-list"},null,h);var q=d.querySelectorAll(".highcharts-popup-rhs-col-wrapper")[0];
l(k,function(d,e){var h=d.options;if(d.params||h&&h.params){var r=f.indicators.getNameType(d,e),l=r.type;m=b("li",{className:"highcharts-indicator-list",innerHTML:r.name},null,p);["click","touchstart"].forEach(function(e){c(m,e,function(){w.call(f,a,g?d:k[l],r.type,q);g&&d.options&&b("input",{type:"hidden",name:"highcharts-id-"+l,value:d.options.id},null,q).setAttribute("highcharts-data-series-id",d.options.id)})})}});0<p.childNodes.length&&p.childNodes[0].click()},getNameType:function(b,c){var d=
b.options,f=a.seriesTypes;f=f[c]&&f[c].prototype.nameBase||c.toUpperCase();d&&d.type&&(c=b.options.type,f=b.name);return{name:f,type:c}},listAllSeries:function(a,c,d,e,g){a="highcharts-"+c+"-type-"+a;var f;b("label",{innerHTML:this.lang[c]||c,htmlFor:a},null,e);var h=b("select",{name:a,className:"highcharts-popup-field"},null,e);h.setAttribute("id","highcharts-select-"+c);d.series.forEach(function(a){f=a.options;!f.params&&f.id&&"highcharts-navigator-series"!==f.id&&b("option",{innerHTML:f.name||
f.id,value:f.id},null,h)});v(g)&&(h.value=g)},addFormFields:function(a,c,d,e){var f=c.params||c.options.params,h=this.indicators.getNameType;e.innerHTML="";b("h3",{className:"highcharts-indicator-title",innerHTML:h(c,d).name},null,e);b("input",{type:"hidden",name:"highcharts-type-"+d,value:d},null,e);this.indicators.listAllSeries.call(this,d,"series",a,e,c.linkedParent&&f.volumeSeriesID);f.volumeSeriesID&&this.indicators.listAllSeries.call(this,d,"volume",a,e,c.linkedParent&&c.linkedParent.options.id);
this.indicators.addParamInputs.call(this,a,"params",f,d,e)},addParamInputs:function(a,b,c,d,g){var f=this,h=this.indicators.addParamInputs,k=this.addInput,m;l(c,function(c,l){m=b+"."+l;e(c)?h.call(f,a,m,c,d,g):"params.volumeSeriesID"!==m&&k.call(f,m,d,g,[c,"text"])})},getAmount:function(){var a=0;this.series.forEach(function(b){var c=b.options;(b.params||c&&c.params)&&a++});return a}},tabs:{init:function(a){var b=this.tabs;a=this.indicators.getAmount.call(a);var c=b.addMenuItem.call(this,"add");b.addMenuItem.call(this,
"edit",a);b.addContentItem.call(this,"add");b.addContentItem.call(this,"edit");b.switchTabs.call(this,a);b.selectTab.call(this,c,0)},addMenuItem:function(a,c){var d=this.popup.container,e="highcharts-tab-item",f=this.lang;0===c&&(e+=" highcharts-tab-disabled");c=b("span",{innerHTML:f[a+"Button"]||a,className:e},null,d);c.setAttribute("highcharts-data-tab-type",a);return c},addContentItem:function(){return b("div",{className:"highcharts-tab-item-content"},null,this.popup.container)},switchTabs:function(a){var b=
this,d;this.popup.container.querySelectorAll(".highcharts-tab-item").forEach(function(e,f){d=e.getAttribute("highcharts-data-tab-type");"edit"===d&&0===a||["click","touchstart"].forEach(function(a){c(e,a,function(){b.tabs.deselectAll.call(b);b.tabs.selectTab.call(b,this,f)})})})},selectTab:function(a,b){var c=this.popup.container.querySelectorAll(".highcharts-tab-item-content");a.className+=" highcharts-tab-item-active";c[b].className+=" highcharts-tab-item-show"},deselectAll:function(){var a=this.popup.container,
b=a.querySelectorAll(".highcharts-tab-item");a=a.querySelectorAll(".highcharts-tab-item-content");var c;for(c=0;c<b.length;c++)b[c].classList.remove("highcharts-tab-item-active"),a[c].classList.remove("highcharts-tab-item-show")}}};c(k,"showPopup",function(b){this.popup||(this.popup=new a.Popup(this.chart.container,this.chart.options.navigation.iconsURL||this.chart.options.stockTools&&this.chart.options.stockTools.gui.iconsURL||"https://code.highcharts.com/8.2.0/gfx/stock-icons/"));this.popup.showForm(b.formType,
this.chart,b.options,b.onSubmit)});c(k,"closePopup",function(){this.popup&&this.popup.closePopup()})});v(a,"masters/modules/annotations.src.js",[],function(){})});
//# sourceMappingURL=annotations.js.map