"use strict";var __extends=this&&this.__extends||function(){var t=function(i,e){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var e in i)i.hasOwnProperty(e)&&(t[e]=i[e])})(i,e)};return function(i,e){function o(){this.constructor=i}t(i,e),i.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}}();import H from"../../Core/Globals.js";import Color from"../../Core/Color/Color.js";var color=Color.parse;import SeriesRegistry from"../../Core/Series/SeriesRegistry.js";var Series=SeriesRegistry.series,ColumnSeries=SeriesRegistry.seriesTypes.column,columnProto=ColumnSeries.prototype;import U from"../../Core/Utilities.js";var clamp=U.clamp,correctFloat=U.correctFloat,defined=U.defined,extend=U.extend,find=U.find,isNumber=U.isNumber,isObject=U.isObject,merge=U.merge,pick=U.pick;import XRangePoint from"./XRangePoint.js";import"./XRangeComposition.js";var XRangeSeries=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i.data=void 0,i.options=void 0,i.points=void 0,i}return __extends(i,t),i.prototype.init=function(){ColumnSeries.prototype.init.apply(this,arguments),this.options.stacking=void 0},i.prototype.getColumnMetrics=function(){var t,i=this.chart;function e(){i.series.forEach(function(t){var i=t.xAxis;t.xAxis=t.yAxis,t.yAxis=i})}return e(),t=columnProto.getColumnMetrics.call(this),e(),t},i.prototype.cropData=function(t,i,e,o){var r=Series.prototype.cropData.call(this,this.x2Data,i,e,o);return r.xData=t.slice(r.start,r.end),r},i.prototype.findPointIndex=function(t){var i,e,o=this.cropped,r=this.cropStart,s=this.points,n=t.id;n&&(i=(e=find(s,function(t){return t.id===n}))?e.index:void 0);void 0===i&&(i=(e=find(s,function(i){return i.x===t.x&&i.x2===t.x2&&!i.touched}))?e.index:void 0);return o&&isNumber(i)&&isNumber(r)&&i>=r&&(i-=r),i},i.prototype.translatePoint=function(t){var i,e,o,r,s,n,a,p,l,h,c=this.xAxis,d=this.yAxis,u=this.columnMetrics,m=this.options,g=m.minPointLength||0,f=(null===(i=t.shapeArgs)||void 0===i?void 0:i.width)/2,y=this.pointXOffset=u.offset,x=t.plotX,v=pick(t.x2,t.x+(t.len||0)),b=c.translate(v,0,0,0,1),A=Math.abs(b-x),C=this.chart.inverted,R=pick(m.borderWidth,1)%2/2,S=u.offset,w=Math.round(u.width);g&&((o=g-A)<0&&(o=0),x-=o/2,b+=o/2),x=Math.max(x,-10),b=clamp(b,-10,c.len+10),defined(t.options.pointWidth)&&(S-=(Math.ceil(t.options.pointWidth)-w)/2,w=Math.ceil(t.options.pointWidth)),m.pointPlacement&&isNumber(t.plotY)&&d.categories&&(t.plotY=d.translate(t.y,0,1,0,1,m.pointPlacement)),t.shapeArgs={x:Math.floor(Math.min(x,b))+R,y:Math.floor(t.plotY+S)+R,width:Math.round(Math.abs(b-x)),height:w,r:this.options.borderRadius},C?t.tooltipPos[1]+=y+f:t.tooltipPos[0]-=f+y-(null===(e=t.shapeArgs)||void 0===e?void 0:e.width)/2,a=(n=t.shapeArgs.x)+t.shapeArgs.width,n<0||a>c.len?(n=clamp(n,0,c.len),p=(a=clamp(a,0,c.len))-n,t.dlBox=merge(t.shapeArgs,{x:n,width:a-n,centerX:p?p/2:null})):t.dlBox=null;var P=t.tooltipPos,M=C?1:0,j=C?0:1;h=this.columnMetrics?this.columnMetrics.offset:-u.width/2,P[M]+=C?t.shapeArgs.width/2:(c.reversed?-1:0)*t.shapeArgs.width,P[j]=clamp(P[j]+(C?-1:1)*h,0,d.len-1),(s=t.partialFill)&&(isObject(s)&&(s=s.amount),isNumber(s)||(s=0),r=t.shapeArgs,t.partShapeArgs={x:r.x,y:r.y,width:r.width,height:r.height,r:this.options.borderRadius},l=Math.max(Math.round(A*s+t.plotX-x),0),t.clipRectArgs={x:c.reversed?r.x+A-l:r.x,y:r.y,width:l,height:r.height})},i.prototype.translate=function(){columnProto.translate.apply(this,arguments),this.points.forEach(function(t){this.translatePoint(t)},this)},i.prototype.drawPoint=function(t,i){var e,o=this.options,r=this.chart.renderer,s=t.graphic,n=t.shapeType,a=t.shapeArgs,p=t.partShapeArgs,l=t.clipRectArgs,h=t.partialFill,c=o.stacking&&!o.borderRadius,d=t.state,u=o.states[d||"normal"]||{},m=void 0===d?"attr":i,g=this.pointAttribs(t,d),f=pick(this.chart.options.chart.animation,u.animation);t.isNull||!1===t.visible?s&&(t.graphic=s.destroy()):(s?s.rect[i](a):(t.graphic=s=r.g("point").addClass(t.getClassName()).add(t.group||this.group),s.rect=r[n](merge(a)).addClass(t.getClassName()).addClass("highcharts-partfill-original").add(s)),p&&(s.partRect?(s.partRect[i](merge(p)),s.partialClipRect[i](merge(l))):(s.partialClipRect=r.clipRect(l.x,l.y,l.width,l.height),s.partRect=r[n](p).addClass("highcharts-partfill-overlay").add(s).clip(s.partialClipRect))),this.chart.styledMode||(s.rect[i](g,f).shadow(o.shadow,null,c),p&&(isObject(h)||(h={}),isObject(o.partialFill)&&(h=merge(o.partialFill,h)),e=h.fill||color(g.fill).brighten(-.3).get()||color(t.color||this.color).brighten(-.3).get(),g.fill=e,s.partRect[m](g,f).shadow(o.shadow,null,c))))},i.prototype.drawPoints=function(){var t=this,i=t.getAnimationVerb();t.points.forEach(function(e){t.drawPoint(e,i)})},i.prototype.getAnimationVerb=function(){return this.chart.pointCount<(this.options.animationLimit||250)?"animate":"attr"},i.prototype.isPointInside=function(i){var e=i.shapeArgs,o=i.plotX,r=i.plotY;return e?void 0!==o&&void 0!==r&&r>=0&&r<=this.yAxis.len&&e.x+e.width>=0&&o<=this.xAxis.len:t.prototype.isPointInside.apply(this,arguments)},i.defaultOptions=merge(ColumnSeries.defaultOptions,{colorByPoint:!0,dataLabels:{formatter:function(){var t=this.point.partialFill;if(isObject(t)&&(t=t.amount),isNumber(t)&&t>0)return correctFloat(100*t)+"%"},inside:!0,verticalAlign:"middle"},tooltip:{headerFormat:'{point.x} - {point.x2}
',pointFormat:'● {series.name}: {point.yCategory}
'},borderRadius:3,pointRange:0}),i}(ColumnSeries);extend(XRangeSeries.prototype,{type:"xrange",parallelArrays:["x","x2","y"],requireSorting:!1,animate:Series.prototype.animate,cropShoulder:1,getExtremesFromAll:!0,autoIncrement:H.noop,buildKDTree:H.noop,pointClass:XRangePoint}),SeriesRegistry.registerSeriesType("xrange",XRangeSeries);export default XRangeSeries;