/*
 Highcharts JS v7.0.3 (2019-02-06)

 (c) 2009-2019 Torstein Honsi

 License: www.highcharts.com/license
*/
(function(m){"object"===typeof module&&module.exports?(m["default"]=m,module.exports=m):"function"===typeof define&&define.amd?define(function(){return m}):m("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(m){(function(h){function m(a){return{left:"right",right:"left",top:"bottom",bottom:"top"}[a]}function L(a){var b=["draggableX","draggableY"],c;n(a.dragDropProps,function(a){a.optionName&&b.push(a.optionName)});for(c=b.length;c--;)if(a.options.dragDrop[b[c]])return!0}function M(a){var b=
a.series?a.series.length:0;if(a.hasCartesianSeries&&!a.polar)for(;b--;)if(a.series[b].options.dragDrop&&L(a.series[b]))return!0}function N(a){var b=a.series,c=b.options.dragDrop||{};a=a.options&&a.options.dragDrop;var e,f;n(b.dragDropProps,function(a){"x"===a.axis&&a.move?e=!0:"y"===a.axis&&a.move&&(f=!0)});return(c.draggableX&&e||c.draggableY&&f)&&!(a&&!1===a.draggableX&&!1===a.draggableY)&&b.yAxis&&b.xAxis}function t(a,b){return void 0===a.chartX||void 0===a.chartY?b.pointer.normalize(a):a}function w(a,
b,c,e){var f=b.map(function(b){return p(a,b,c,e)});return function(){f.forEach(function(a){a()})}}function O(a,b,c){var e=b.dragDropData.origin;b=e.chartX;var e=e.chartY,f=a.chartX;a=a.chartY;return Math.sqrt((f-b)*(f-b)+(a-e)*(a-e))>c}function P(a,b,c){var e={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(a){var b={};n(a.series.dragDropProps,function(c,e){b[e]=a[e]});b.point=a;e.points[a.id]=b});
return e}function Q(a){var b=a.series,c=b.options.dragDrop.groupBy;return a.options[c]?b.points.filter(function(b){return b.options[c]===a.options[c]}):[a]}function D(a,b){var c=Q(b),e=b.series,f=e.chart,l;u(e.options.dragDrop&&e.options.dragDrop.liveRedraw,!0)||(f.dragGuideBox=l=e.getGuideBox(c),f.setGuideBoxState("default",e.options.dragDrop.guideBox).add(e.group));f.dragDropData={origin:P(a,c,l),point:b,groupedPoints:c,isDragging:!0}}function R(a,b){var c=a.point,e=q(c.series.options.dragDrop,
c.options.dragDrop),f={},l=a.updateProp,C={};n(c.series.dragDropProps,function(a,b){if(!l||l===b&&a.resize&&(!a.optionName||!1!==e[a.optionName]))if(l||a.move&&("x"===a.axis&&e.draggableX||"y"===a.axis&&e.draggableY))f[b]=a});(l?[c]:a.groupedPoints).forEach(function(c){C[c.id]={point:c,newValues:c.getDropValues(a.origin,b,f)}});return C}function E(a,b){var c=a.dragDropData.newPoints;b=!1===b?!1:q({duration:400},a.options.animation);a.isDragDropAnimating=!0;n(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)a.hasOwnProperty(c)&&b++;return b}function H(a){for(var b in a)if(a.hasOwnProperty(b))return a[b]}function S(a,b){if(!b.zoomOrPanKeyPressed(a)){var c=
b.dragDropData,e,f;f=0;c&&c.isDragging&&(e=c.point,f=e.series.options.dragDrop,a.preventDefault(),c.draggedPastSensitivity||(c.draggedPastSensitivity=O(a,b,u(e.options.dragDrop&&e.options.dragDrop.dragSensitivity,f&&f.dragSensitivity,2))),c.draggedPastSensitivity&&(c.newPoints=R(c,a),b=c.newPoints,f=G(b),b=1===f?H(b):null,e.firePointEvent("drag",{origin:c.origin,newPoints:c.newPoints,newPoint:b&&b.newValues,newPointId:b&&b.point.id,numNewPoints:f,chartX:a.chartX,chartY:a.chartY},function(){var b=
e.series,c=b.chart,f=c.dragDropData,d=q(b.options.dragDrop,e.options.dragDrop),g=d.draggableX,k=d.draggableY,b=f.origin,h=a.chartX-b.chartX,x=a.chartY-b.chartY,r=h,f=f.updateProp;c.inverted&&(h=-x,x=-r);if(u(d.liveRedraw,!0))E(c,!1),e.showDragHandles();else if(f){var g=h,c=x,r=e.series,k=r.chart,f=k.dragDropData,n,p,d=r.dragDropProps[f.updateProp];p=f.newPoints[e.id].newValues;n="function"===typeof d.resizeSide?d.resizeSide(p,e):d.resizeSide;d.beforeResize&&d.beforeResize(k.dragGuideBox,p,e);var k=
k.dragGuideBox,r="x"===d.axis&&r.xAxis.reversed||"y"===d.axis&&r.yAxis.reversed?m(n):n,g="x"===d.axis?g-(f.origin.prevdX||0):0,c="y"===d.axis?c-(f.origin.prevdY||0):0,v;switch(r){case "left":v={x:k.attr("x")+g,width:Math.max(1,k.attr("width")-g)};break;case "right":v={width:Math.max(1,k.attr("width")+g)};break;case "top":v={y:k.attr("y")+c,height:Math.max(1,k.attr("height")-c)};break;case "bottom":v={height:Math.max(1,k.attr("height")+c)}}k.attr(v)}else c.dragGuideBox.translate(g?h:0,k?x:0);b.prevdX=
h;b.prevdY=x})))}}function A(a,b){var c=b.dragDropData;if(c&&c.isDragging&&c.draggedPastSensitivity){var e=c.point,f=c.newPoints,l=G(f),d=1===l?H(f):null;b.dragHandles&&b.hideDragHandles();a.preventDefault();b.cancelClick=!0;e.firePointEvent("drop",{origin:c.origin,chartX:a.chartX,chartY:a.chartY,newPoints:f,numNewPoints:l,newPoint:d&&d.newValues,newPointId:d&&d.point.id},function(){E(b)})}delete b.dragDropData;b.dragGuideBox&&(b.dragGuideBox.destroy(),delete b.dragGuideBox)}function T(a){var b=a.container,
c=h.doc;M(a)&&(w(b,["mousedown","touchstart"],function(b){b=t(b,a);var c=a.hoverPoint,e=h.merge(c.series.options.dragDrop,c.options.dragDrop),d=e.draggableX||!1,e=e.draggableY||!1;a.cancelClick=!1;!d&&!e||a.zoomOrPanKeyPressed(b)||(a.dragDropData&&a.dragDropData.isDragging?A(b,a):c&&N(c)&&(a.mouseIsDown=!1,D(b,c),c.firePointEvent("dragStart",b)))}),w(b,["mousemove","touchmove"],function(b){S(t(b,a),a)}),p(b,"mouseleave",function(b){A(t(b,a),a)}),a.unbindDragDropMouseUp=w(c,["mouseup","touchend"],
function(b){A(t(b,a),a)}),a.hasAddedDragDropEvents=!0,p(a,"destroy",function(){a.unbindDragDropMouseUp&&a.unbindDragDropMouseUp()}))}var p=h.addEvent,n=h.objectEach,u=h.pick,q=h.merge,d=h.seriesTypes,I=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]},z=d.line.prototype.dragDropProps={x:{axis:"x",move:!0},y:{axis:"y",move:!0}};d.flags&&(d.flags.prototype.dragDropProps=z);var g=d.column.prototype.dragDropProps=
{x:{axis:"x",move:!0},y:{axis:"y",move:!1,resize:!0,beforeResize:function(a,b,c){var e=c.series.translatedThreshold,f=a.attr("y");b.y>=c.series.options.threshold?(b=a.attr("height"),a.attr({height:Math.max(0,Math.round(b+(e?e-(f+b):0)))})):a.attr({y:Math.round(f+(e?e-f:0))})},resizeSide:function(a,b){var c=b.series.chart.dragHandles;a=a.y>=(b.series.options.threshold||0)?"top":"bottom";b=m(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]}}};d.bullet&&(d.bullet.prototype.dragDropProps={x:g.x,y:g.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:g.y.handleFormatter}});
d.columnrange&&(d.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:g.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:g.y.handleFormatter,
propValidate:function(a,b){return a>=b.low}}});d.boxplot&&(d.boxplot.prototype.dragDropProps={x:g.x,low:{optionName:"draggableLow",axis:"y",move:!0,resize:!0,resizeSide:"bottom",handlePositioner:function(a){return{x:a.shapeArgs.x,y:a.lowPlot}},handleFormatter:g.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:g.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:g.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:g.y.handleFormatter,propValidate:function(a,
b){return a>=b.q3}}});d.ohlc&&(d.ohlc.prototype.dragDropProps={x:g.x,low:{optionName:"draggableLow",axis:"y",move:!0,resize:!0,resizeSide:"bottom",handlePositioner:function(a){return{x:a.shapeArgs.x,y:a.plotLow}},handleFormatter:g.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:g.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:g.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:g.y.handleFormatter,propValidate:function(a,b){return a<=b.high&&a>=b.low}}});if(d.arearange){var z=d.columnrange.prototype.dragDropProps,J=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]};d.arearange.prototype.dragDropProps={x:z.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:J,propValidate:z.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:J,propValidate:z.high.propValidate}}}d.waterfall&&(d.waterfall.prototype.dragDropProps={x:g.x,y:q(g.y,{handleFormatter:function(a){return a.isSum||a.isIntermediateSum?null:g.y.handleFormatter(a)}})});if(d.xrange)var K=
function(a,b){var c=a.series,e=c.xAxis,f=c.yAxis,c=c.chart.inverted;b=e.toPixels(a[b],!0);var d=f.toPixels(a.y,!0);c?(b=e.len-b,d=f.len-d-a.shapeArgs.height/2):d-=a.shapeArgs.height/2;return{x:Math.round(b),y:Math.round(d)}},B=d.xrange.prototype.dragDropProps={y:{axis:"y",move:!0},x:{optionName:"draggableX1",axis:"x",move:!0,resize:!0,resizeSide:"left",handlePositioner:function(a){return K(a,"x")},handleFormatter:I,propValidate:function(a,b){return a<=b.x2}},x2:{optionName:"draggableX2",axis:"x",
move:!0,resize:!0,resizeSide:"right",handlePositioner:function(a){return K(a,"x2")},handleFormatter:I,propValidate:function(a,b){return a>=b.x}}};d.gantt&&(d.gantt.prototype.dragDropProps={y:B.y,start:q(B.x,{optionName:"draggableStart",validateIndividualDrag:function(a){return!a.milestone}}),end:q(B.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){d[a]&&
(d[a].prototype.dragDropProps=null)});var U={"default":{className:"highcharts-drag-box-default",lineWidth:1,lineColor:"#888",color:"rgba(0, 0, 0, 0.1)",cursor:"move",zIndex:900}},V={className:"highcharts-drag-handle",color:"#fff",lineColor:"rgba(0, 0, 0, 0.6)",lineWidth:1,zIndex:901};h.Chart.prototype.setGuideBoxState=function(a,b){var c=this.dragGuideBox;b=q(U,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"})};
h.Point.prototype.getDropValues=function(a,b,c){var e=this,f=e.series,d=q(f.options.dragDrop,e.options.dragDrop),g=f.yAxis,y=f.xAxis,h=b.chartX-a.chartX;b=b.chartY-a.chartY;var p=u(a.x,e.x),k=u(a.y,e.y),m=y.toValue(y.toPixels(p,!0)+(y.horiz?h:b),!0)-p,x=g.toValue(g.toPixels(k,!0)+(g.horiz?h:b),!0)-k,r={},t,w=a.points[e.id],v;for(v in c)if(c.hasOwnProperty(v)){if(void 0!==t){t=!1;break}t=!0}n(c,function(a,b){var c=w[b],l;l=c+("x"===a.axis?m:x);var g=a.axis.toUpperCase(),h=f[g.toLowerCase()+"Axis"].categories?
1:0,h=u(d["dragPrecision"+g],h),y=u(d["dragMin"+g],-Infinity),g=u(d["dragMax"+g],Infinity);h&&(l=Math.round(l/h)*h);l=Math.max(y,Math.min(g,l));t&&a.propValidate&&!a.propValidate(l,e)||void 0===c||(r[b]=l)});return r};h.Series.prototype.getGuideBox=function(a){var b=this.chart,c=Infinity,e=-Infinity,f=Infinity,d=-Infinity,g;a.forEach(function(a){(a=a.graphic&&a.graphic.getBBox()||a.shapeArgs)&&(a.width||a.height||a.x||a.y)&&(g=!0,c=Math.min(a.x,c),e=Math.max(a.x+a.width,e),f=Math.min(a.y,f),d=Math.max(a.y+
a.height,d))});return g?b.renderer.rect(c,f,e-c,d-f):b.renderer.g()};h.Point.prototype.showDragHandles=function(){var a=this,b=a.series,c=b.chart,e=c.renderer,f=q(b.options.dragDrop,a.options.dragDrop);n(b.dragDropProps,function(d,g){var h=q(V,d.handleOptions,f.dragHandle),l={className:h.className,"stroke-width":h.lineWidth,fill:h.color,stroke:h.lineColor},m=h.pathFormatter||d.handleFormatter,k=d.handlePositioner,n;n=d.validateIndividualDrag?d.validateIndividualDrag(a):!0;d.resize&&n&&d.resizeSide&&
m&&(f["draggable"+d.axis.toUpperCase()]||f[d.optionName])&&!1!==f[d.optionName]&&(c.dragHandles||(c.dragHandles={group:e.g("drag-drop-handles").add(b.markerGroup||b.group)}),c.dragHandles.point=a.id,k=k(a),l.d=n=m(a),m="function"===typeof d.resizeSide?d.resizeSide(a.options,a):d.resizeSide,!n||0>k.x||0>k.y||(l.cursor=h.cursor||"x"===d.axis!==!!c.inverted?"ew-resize":"ns-resize",(d=c.dragHandles[m])||(d=c.dragHandles[m]=e.path().add(c.dragHandles.group)),d.translate(k.x,k.y).attr(l),w(d.element,["touchstart",
"mousedown"],function(b){b=t(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())}),p(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)})))})};h.Chart.prototype.hideDragHandles=function(){this.dragHandles&&(n(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)};p(h.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)});p(h.Point,"mouseOut",function(){var a=this;setTimeout(function(){a.series&&F(a)},10)});p(h.Point,"remove",function(){var a=this.series.chart,b=a.dragHandles;b&&b.point===this.id&&a.hideDragHandles()});h.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]};p(h.Chart,"render",function(){this.hasAddedDragDropEvents||
T(this)})})(m)});
//# sourceMappingURL=draggable-points.js.map
