/*
 Highcharts JS v7.2.1 (2019-10-31)

 (c) 2009-2019 Torstein Honsi

 License: www.highcharts.com/license
*/
(function(e){"object"===typeof module&&module.exports?(e["default"]=e,module.exports=e):"function"===typeof define&&define.amd?define("highcharts/modules/draggable-points",["highcharts"],function(r){e(r);e.Highcharts=r;return e}):e("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(e){function r(z,e,r,A){z.hasOwnProperty(e)||(z[e]=A.apply(null,r))}e=e?e._modules:{};r(e,"modules/draggable-points.src.js",[e["parts/Globals.js"],e["parts/Utilities.js"]],function(e,l){function r(a){return{left:"right",
right:"left",top:"bottom",bottom:"top"}[a]}function A(a){var b=["draggableX","draggableY"],c;p(a.dragDropProps,function(a){a.optionName&&b.push(a.optionName)});for(c=b.length;c--;)if(a.options.dragDrop[b[c]])return!0}function z(a){var b=a.series?a.series.length:0;if(a.hasCartesianSeries&&!a.polar)for(;b--;)if(a.series[b].options.dragDrop&&A(a.series[b]))return!0}function K(a){var b=a.series,c=b.options.dragDrop||{};a=a.options&&a.options.dragDrop;var d,g;p(b.dragDropProps,function(a){"x"===a.axis&&
a.move?d=!0:"y"===a.axis&&a.move&&(g=!0)});return(c.draggableX&&d||c.draggableY&&g)&&!(a&&!1===a.draggableX&&!1===a.draggableY)&&b.yAxis&&b.xAxis}function v(a,b){return void 0===a.chartX||void 0===a.chartY?b.pointer.normalize(a):a}function w(a,b,c,d){var g=b.map(function(b){return m(a,b,c,d)});return function(){g.forEach(function(a){a()})}}function L(a,b,c){var d=b.dragDropData.origin;b=d.chartX;d=d.chartY;var g=a.chartX;a=a.chartY;return Math.sqrt((g-b)*(g-b)+(a-d)*(a-d))>c}function M(a,b,c){var d=
{chartX:a.chartX,chartY:a.chartY,guideBox:c&&{x:c.attr("x"),y:c.attr("y"),width:c.attr("width"),height:c.attr("height")},points:{}};b.forEach(function(b){var c={};p(b.series.dragDropProps,function(d,g){d=b.series[d.axis+"Axis"];c[g]=b[g];c[g+"Offset"]=d.toPixels(b[g])-(d.horiz?a.chartX:a.chartY)});c.point=b;d.points[b.id]=c});return d}function N(a){var b=a.series,c=[],d=b.options.dragDrop.groupBy;b.isSeriesBoosting?b.options.data.forEach(function(a,d){c.push((new b.pointClass).init(b,a));c[c.length-
1].index=d}):c=b.points;return a.options[d]?c.filter(function(b){return b.options[d]===a.options[d]}):[a]}function D(a,b){var c=N(b),d=b.series,g=d.chart,n;u(d.options.dragDrop&&d.options.dragDrop.liveRedraw,!0)||(g.dragGuideBox=n=d.getGuideBox(c),g.setGuideBoxState("default",d.options.dragDrop.guideBox).add(d.group));g.dragDropData={origin:M(a,c,n),point:b,groupedPoints:c,isDragging:!0}}function O(a,b){var c=a.point,d=q(c.series.options.dragDrop,c.options.dragDrop),g={},n=a.updateProp,e={};p(c.series.dragDropProps,
function(a,b){if(!n||n===b&&a.resize&&(!a.optionName||!1!==d[a.optionName]))if(n||a.move&&("x"===a.axis&&d.draggableX||"y"===a.axis&&d.draggableY))g[b]=a});(n?[c]:a.groupedPoints).forEach(function(c){e[c.id]={point:c,newValues:c.getDropValues(a.origin,b,g)}});return e}function E(a,b){var c=a.dragDropData.newPoints;b=!1===b?!1:q({duration:400},a.options.chart.animation);a.isDragDropAnimating=!0;p(c,function(a){a.point.update(a.newValues,!1)});a.redraw(b);setTimeout(function(){delete a.isDragDropAnimating;
a.hoverPoint&&!a.dragHandles&&a.hoverPoint.showDragHandles()},b.duration)}function F(a){var b=a.series&&a.series.chart,c=b&&b.dragDropData;!b||!b.dragHandles||c&&(c.isDragging&&c.draggedPastSensitivity||c.isHoveringHandle===a.id)||b.hideDragHandles()}function G(a){var b=0,c;for(c in a)Object.hasOwnProperty.call(a,c)&&b++;return b}function H(a){for(var b in a)if(Object.hasOwnProperty.call(a,b))return a[b]}function P(a,b){if(!b.zoomOrPanKeyPressed(a)){var c=b.dragDropData;var d=0;if(c&&c.isDragging){var g=
c.point;d=g.series.options.dragDrop;a.preventDefault();c.draggedPastSensitivity||(c.draggedPastSensitivity=L(a,b,u(g.options.dragDrop&&g.options.dragDrop.dragSensitivity,d&&d.dragSensitivity,2)));c.draggedPastSensitivity&&(c.newPoints=O(c,a),b=c.newPoints,d=G(b),b=1===d?H(b):null,g.firePointEvent("drag",{origin:c.origin,newPoints:c.newPoints,newPoint:b&&b.newValues,newPointId:b&&b.point.id,numNewPoints:d,chartX:a.chartX,chartY:a.chartY},function(){var b=g.series,c=b.chart,d=c.dragDropData,e=q(b.options.dragDrop,
g.options.dragDrop),f=e.draggableX,k=e.draggableY;b=d.origin;var h=a.chartX-b.chartX,x=a.chartY-b.chartY,t=h;d=d.updateProp;c.inverted&&(h=-x,x=-t);if(u(e.liveRedraw,!0))E(c,!1),g.showDragHandles();else if(d){f=h;c=x;t=g.series;k=t.chart;d=k.dragDropData;e=t.dragDropProps[d.updateProp];var l=d.newPoints[g.id].newValues;var p="function"===typeof e.resizeSide?e.resizeSide(l,g):e.resizeSide;e.beforeResize&&e.beforeResize(k.dragGuideBox,l,g);k=k.dragGuideBox;t="x"===e.axis&&t.xAxis.reversed||"y"===e.axis&&
t.yAxis.reversed?r(p):p;f="x"===e.axis?f-(d.origin.prevdX||0):0;c="y"===e.axis?c-(d.origin.prevdY||0):0;switch(t){case "left":var m={x:k.attr("x")+f,width:Math.max(1,k.attr("width")-f)};break;case "right":m={width:Math.max(1,k.attr("width")+f)};break;case "top":m={y:k.attr("y")+c,height:Math.max(1,k.attr("height")-c)};break;case "bottom":m={height:Math.max(1,k.attr("height")+c)}}k.attr(m)}else c.dragGuideBox.translate(f?h:0,k?x:0);b.prevdX=h;b.prevdY=x}))}}}function B(a,b){var c=b.dragDropData;if(c&&
c.isDragging&&c.draggedPastSensitivity){var d=c.point,g=c.newPoints,e=G(g),f=1===e?H(g):null;b.dragHandles&&b.hideDragHandles();a.preventDefault();b.cancelClick=!0;d.firePointEvent("drop",{origin:c.origin,chartX:a.chartX,chartY:a.chartY,newPoints:g,numNewPoints:e,newPoint:f&&f.newValues,newPointId:f&&f.point.id},function(){E(b)})}delete b.dragDropData;b.dragGuideBox&&(b.dragGuideBox.destroy(),delete b.dragGuideBox)}function Q(a){var b=a.container,c=e.doc;z(a)&&(w(b,["mousedown","touchstart"],function(b){b=
v(b,a);var c=a.hoverPoint,d=e.merge(c&&c.series.options.dragDrop,c&&c.options.dragDrop),f=d.draggableX||!1;d=d.draggableY||!1;a.cancelClick=!1;!f&&!d||a.zoomOrPanKeyPressed(b)||a.hasDraggedAnnotation||(a.dragDropData&&a.dragDropData.isDragging?B(b,a):c&&K(c)&&(a.mouseIsDown=!1,D(b,c),c.firePointEvent("dragStart",b)))}),w(b,["mousemove","touchmove"],function(b){P(v(b,a),a)}),m(b,"mouseleave",function(b){B(v(b,a),a)}),a.unbindDragDropMouseUp=w(c,["mouseup","touchend"],function(b){B(v(b,a),a)}),a.hasAddedDragDropEvents=
!0,m(a,"destroy",function(){a.unbindDragDropMouseUp&&a.unbindDragDropMouseUp()}))}var p=l.objectEach,u=l.pick,m=e.addEvent,q=e.merge,f=e.seriesTypes;l=function(a){a=a.shapeArgs||a.graphic.getBBox();var b=a.r||0,c=a.height/2;return["M",0,b,"L",0,c-5,"A",1,1,0,0,0,0,c+5,"A",1,1,0,0,0,0,c-5,"M",0,c+5,"L",0,a.height-b]};var y=f.line.prototype.dragDropProps={x:{axis:"x",move:!0},y:{axis:"y",move:!0}};f.flags&&(f.flags.prototype.dragDropProps=y);var h=f.column.prototype.dragDropProps={x:{axis:"x",move:!0},
y:{axis:"y",move:!1,resize:!0,beforeResize:function(a,b,c){var d=c.series.translatedThreshold,g=a.attr("y");b.y>=c.series.options.threshold?(b=a.attr("height"),a.attr({height:Math.max(0,Math.round(b+(d?d-(g+b):0)))})):a.attr({y:Math.round(g+(d?d-g:0))})},resizeSide:function(a,b){var c=b.series.chart.dragHandles;a=a.y>=(b.series.options.threshold||0)?"top":"bottom";b=r(a);c[b]&&(c[b].destroy(),delete c[b]);return a},handlePositioner:function(a){var b=a.shapeArgs||a.graphic.getBBox();return{x:b.x,y:a.y>=
(a.series.options.threshold||0)?b.y:b.y+b.height}},handleFormatter:function(a){a=a.shapeArgs;var b=a.r||0,c=a.width/2;return["M",b,0,"L",c-5,0,"A",1,1,0,0,0,c+5,0,"A",1,1,0,0,0,c-5,0,"M",c+5,0,"L",a.width-b,0]}}};f.bullet&&(f.bullet.prototype.dragDropProps={x:h.x,y:h.y,target:{optionName:"draggableTarget",axis:"y",move:!0,resize:!0,resizeSide:"top",handlePositioner:function(a){var b=a.targetGraphic.getBBox();return{x:a.barX,y:b.y+b.height/2}},handleFormatter:h.y.handleFormatter}});f.columnrange&&
(f.columnrange.prototype.dragDropProps={x:{axis:"x",move:!0},low:{optionName:"draggableLow",axis:"y",move:!0,resize:!0,resizeSide:"bottom",handlePositioner:function(a){a=a.shapeArgs||a.graphic.getBBox();return{x:a.x,y:a.y+a.height}},handleFormatter:h.y.handleFormatter,propValidate:function(a,b){return a<=b.high}},high:{optionName:"draggableHigh",axis:"y",move:!0,resize:!0,resizeSide:"top",handlePositioner:function(a){a=a.shapeArgs||a.graphic.getBBox();return{x:a.x,y:a.y}},handleFormatter:h.y.handleFormatter,
propValidate:function(a,b){return a>=b.low}}});f.boxplot&&(f.boxplot.prototype.dragDropProps={x:h.x,low:{optionName:"draggableLow",axis:"y",move:!0,resize:!0,resizeSide:"bottom",handlePositioner:function(a){return{x:a.shapeArgs.x,y:a.lowPlot}},handleFormatter:h.y.handleFormatter,propValidate:function(a,b){return a<=b.q1}},q1:{optionName:"draggableQ1",axis:"y",move:!0,resize:!0,resizeSide:"bottom",handlePositioner:function(a){return{x:a.shapeArgs.x,y:a.q1Plot}},handleFormatter:h.y.handleFormatter,
propValidate:function(a,b){return a<=b.median&&a>=b.low}},median:{axis:"y",move:!0},q3:{optionName:"draggableQ3",axis:"y",move:!0,resize:!0,resizeSide:"top",handlePositioner:function(a){return{x:a.shapeArgs.x,y:a.q3Plot}},handleFormatter:h.y.handleFormatter,propValidate:function(a,b){return a<=b.high&&a>=b.median}},high:{optionName:"draggableHigh",axis:"y",move:!0,resize:!0,resizeSide:"top",handlePositioner:function(a){return{x:a.shapeArgs.x,y:a.highPlot}},handleFormatter:h.y.handleFormatter,propValidate:function(a,
b){return a>=b.q3}}});f.ohlc&&(f.ohlc.prototype.dragDropProps={x:h.x,low:{optionName:"draggableLow",axis:"y",move:!0,resize:!0,resizeSide:"bottom",handlePositioner:function(a){return{x:a.shapeArgs.x,y:a.plotLow}},handleFormatter:h.y.handleFormatter,propValidate:function(a,b){return a<=b.open&&a<=b.close}},high:{optionName:"draggableHigh",axis:"y",move:!0,resize:!0,resizeSide:"top",handlePositioner:function(a){return{x:a.shapeArgs.x,y:a.plotHigh}},handleFormatter:h.y.handleFormatter,propValidate:function(a,
b){return a>=b.open&&a>=b.close}},open:{optionName:"draggableOpen",axis:"y",move:!0,resize:!0,resizeSide:function(a){return a.open>=a.close?"top":"bottom"},handlePositioner:function(a){return{x:a.shapeArgs.x,y:a.plotOpen}},handleFormatter:h.y.handleFormatter,propValidate:function(a,b){return a<=b.high&&a>=b.low}},close:{optionName:"draggableClose",axis:"y",move:!0,resize:!0,resizeSide:function(a){return a.open>=a.close?"bottom":"top"},handlePositioner:function(a){return{x:a.shapeArgs.x,y:a.plotClose}},
handleFormatter:h.y.handleFormatter,propValidate:function(a,b){return a<=b.high&&a>=b.low}}});if(f.arearange){y=f.columnrange.prototype.dragDropProps;var I=function(a){a=a.graphic?a.graphic.getBBox().width/2+1:4;return["M",0-a,0,"a",a,a,0,1,0,2*a,0,"a",a,a,0,1,0,-2*a,0]};f.arearange.prototype.dragDropProps={x:y.x,low:{optionName:"draggableLow",axis:"y",move:!0,resize:!0,resizeSide:"bottom",handlePositioner:function(a){return(a=a.lowerGraphic&&a.lowerGraphic.getBBox())?{x:a.x+a.width/2,y:a.y+a.height/
2}:{x:-999,y:-999}},handleFormatter:I,propValidate:y.low.propValidate},high:{optionName:"draggableHigh",axis:"y",move:!0,resize:!0,resizeSide:"top",handlePositioner:function(a){return(a=a.upperGraphic&&a.upperGraphic.getBBox())?{x:a.x+a.width/2,y:a.y+a.height/2}:{x:-999,y:-999}},handleFormatter:I,propValidate:y.high.propValidate}}}f.waterfall&&(f.waterfall.prototype.dragDropProps={x:h.x,y:q(h.y,{handleFormatter:function(a){return a.isSum||a.isIntermediateSum?null:h.y.handleFormatter(a)}})});if(f.xrange){var J=
function(a,b){var c=a.series,d=c.xAxis,g=c.yAxis;c=c.chart.inverted;b=d.toPixels(a[b],!0);var e=g.toPixels(a.y,!0);c?(b=d.len-b,e=g.len-e-a.shapeArgs.height/2):e-=a.shapeArgs.height/2;return{x:Math.round(b),y:Math.round(e)}};l=f.xrange.prototype.dragDropProps={y:{axis:"y",move:!0},x:{optionName:"draggableX1",axis:"x",move:!0,resize:!0,resizeSide:"left",handlePositioner:function(a){return J(a,"x")},handleFormatter:l,propValidate:function(a,b){return a<=b.x2}},x2:{optionName:"draggableX2",axis:"x",
move:!0,resize:!0,resizeSide:"right",handlePositioner:function(a){return J(a,"x2")},handleFormatter:l,propValidate:function(a,b){return a>=b.x}}};f.gantt&&(f.gantt.prototype.dragDropProps={y:l.y,start:q(l.x,{optionName:"draggableStart",validateIndividualDrag:function(a){return!a.milestone}}),end:q(l.x2,{optionName:"draggableEnd",validateIndividualDrag:function(a){return!a.milestone}})})}"gauge pie sunburst wordcloud sankey histogram pareto vector windbarb treemap bellcurve sma map mapline".split(" ").forEach(function(a){f[a]&&
(f[a].prototype.dragDropProps=null)});var R={"default":{className:"highcharts-drag-box-default",lineWidth:1,lineColor:"#888",color:"rgba(0, 0, 0, 0.1)",cursor:"move",zIndex:900}},S={className:"highcharts-drag-handle",color:"#fff",lineColor:"rgba(0, 0, 0, 0.6)",lineWidth:1,zIndex:901};e.Chart.prototype.setGuideBoxState=function(a,b){var c=this.dragGuideBox;b=q(R,b);a=q(b["default"],b[a]);return c.attr({className:a.className,stroke:a.lineColor,strokeWidth:a.lineWidth,fill:a.color,cursor:a.cursor,zIndex:a.zIndex}).css({pointerEvents:"none"})};
e.Point.prototype.getDropValues=function(a,b,c){var d=this,e=d.series,f=q(e.options.dragDrop,d.options.dragDrop),h={},C=a.points[d.id],m;for(m in c)if(Object.hasOwnProperty.call(c,m)){if(void 0!==l){var l=!1;break}l=!0}p(c,function(a,c){var g=C[c],n=e[a.axis+"Axis"];n=n.toValue((n.horiz?b.chartX:b.chartY)+C[c+"Offset"]);var k=a.axis.toUpperCase(),m=e[k.toLowerCase()+"Axis"].categories?1:0;m=u(f["dragPrecision"+k],m);var p=u(f["dragMin"+k],-Infinity);k=u(f["dragMax"+k],Infinity);m&&(n=Math.round(n/
m)*m);n=Math.max(p,Math.min(k,n));l&&a.propValidate&&!a.propValidate(n,d)||void 0===g||(h[c]=n)});return h};e.Series.prototype.getGuideBox=function(a){var b=this.chart,c=Infinity,d=-Infinity,e=Infinity,f=-Infinity,h;a.forEach(function(a){(a=a.graphic&&a.graphic.getBBox()||a.shapeArgs)&&(a.width||a.height||a.x||a.y)&&(h=!0,c=Math.min(a.x,c),d=Math.max(a.x+a.width,d),e=Math.min(a.y,e),f=Math.max(a.y+a.height,f))});return h?b.renderer.rect(c,e,d-c,f-e):b.renderer.g()};e.Point.prototype.showDragHandles=
function(){var a=this,b=a.series,c=b.chart,d=c.renderer,e=q(b.options.dragDrop,a.options.dragDrop);p(b.dragDropProps,function(f,g){var h=q(S,f.handleOptions,e.dragHandle),n={className:h.className,"stroke-width":h.lineWidth,fill:h.color,stroke:h.lineColor},l=h.pathFormatter||f.handleFormatter,k=f.handlePositioner;var p=f.validateIndividualDrag?f.validateIndividualDrag(a):!0;f.resize&&p&&f.resizeSide&&l&&(e["draggable"+f.axis.toUpperCase()]||e[f.optionName])&&!1!==e[f.optionName]&&(c.dragHandles||(c.dragHandles=
{group:d.g("drag-drop-handles").add(b.markerGroup||b.group)}),c.dragHandles.point=a.id,k=k(a),n.d=p=l(a),l="function"===typeof f.resizeSide?f.resizeSide(a.options,a):f.resizeSide,!p||0>k.x||0>k.y||(n.cursor=h.cursor||"x"===f.axis!==!!c.inverted?"ew-resize":"ns-resize",(f=c.dragHandles[l])||(f=c.dragHandles[l]=d.path().add(c.dragHandles.group)),f.translate(k.x,k.y).attr(n),w(f.element,["touchstart","mousedown"],function(b){b=v(b,c);var d=a.series.chart;d.zoomOrPanKeyPressed(b)||(d.mouseIsDown=!1,D(b,
a),d.dragDropData.updateProp=b.updateProp=g,a.firePointEvent("dragStart",b),b.stopPropagation(),b.preventDefault())}),m(c.dragHandles.group.element,"mouseover",function(){c.dragDropData=c.dragDropData||{};c.dragDropData.isHoveringHandle=a.id}),w(c.dragHandles.group.element,["touchend","mouseout"],function(){var b=a.series.chart;b.dragDropData&&a.id===b.dragDropData.isHoveringHandle&&delete b.dragDropData.isHoveringHandle;b.hoverPoint||F(a)})))})};e.Chart.prototype.hideDragHandles=function(){this.dragHandles&&
(p(this.dragHandles,function(a,b){"group"!==b&&a.destroy&&a.destroy()}),this.dragHandles.group&&this.dragHandles.group.destroy&&this.dragHandles.group.destroy(),delete this.dragHandles)};m(e.Point,"mouseOver",function(){var a=this;setTimeout(function(){var b=a.series,c=b&&b.chart,d=c&&c.dragDropData;!c||d&&d.isDragging&&d.draggedPastSensitivity||c.isDragDropAnimating||!b.options.dragDrop||c.options&&c.options.chart&&c.options.chart.options3d||(c.dragHandles&&c.hideDragHandles(),a.showDragHandles())},
12)});m(e.Point,"mouseOut",function(){var a=this;setTimeout(function(){a.series&&F(a)},10)});m(e.Point,"remove",function(){var a=this.series.chart,b=a.dragHandles;b&&b.point===this.id&&a.hideDragHandles()});e.Chart.prototype.zoomOrPanKeyPressed=function(a){var b=this.userOptions.chart||{},c=b.panKey&&b.panKey+"Key";return a[b.zoomKey&&b.zoomKey+"Key"]||a[c]};m(e.Chart,"render",function(){this.hasAddedDragDropEvents||Q(this)})});r(e,"masters/modules/draggable-points.src.js",[],function(){})});
//# sourceMappingURL=draggable-points.js.map