tupali/librerias/gantt/code/modules/annotations.js
2020-05-23 15:45:54 -05:00

103 lines
46 KiB
JavaScript

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