/**
 * Highcharts JS v12.5.0 (2026-01-12)
 * @module highcharts/modules/xrange
 * @requires highcharts
 *
 * X-range series
 *
 * (c) 2010-2026 Highsoft AS
 * Author: Torstein Honsi, Lars A. V. Cabrera
 *
 * A commercial license may be required depending on use.
 * See www.highcharts.com/license
 */import*as t from"../highcharts.js";var e={};e.n=t=>{var i=t&&t.__esModule?()=>t.default:()=>t;return e.d(i,{a:i}),i},e.d=(t,i)=>{for(var s in i)e.o(i,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:i[s]})},e.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let i=t.default;var s=e.n(i);let o=t.default.Color;var r=e.n(o);let a=t.default.SeriesRegistry;var l=e.n(a);let{correctFloat:n,isNumber:p,isObject:h}=s(),{column:{prototype:{pointClass:d}}}=l().seriesTypes,{extend:c}=s();class u extends d{static getColorByCategory(t,e){let i=t.options.colors||t.chart.options.colors,s=i?i.length:t.chart.options.chart.colorCount,o=e.y%s,r=i?.[o];return{colorIndex:o,color:r}}resolveColor(){let t=this.series;if(t.options.colorByPoint&&!this.options.color){let e=u.getColorByCategory(t,this);t.chart.styledMode||(this.color=e.color),(void 0===this.options.colorIndex||null===this.options.colorIndex)&&(this.colorIndex=e.colorIndex)}else this.color=this.options.color||t.color}constructor(t,e){super(t,e),this.y||(this.y=0)}applyOptions(t,e){return super.applyOptions(t,e),this.x2=this.series.chart.time.parse(this.x2),this.isNull=!this.isValid?.(),this.formatPrefix=this.isNull?"null":"point",this}setState(){super.setState.apply(this,arguments),this.series.drawPoint(this,this.series.getAnimationVerb())}isValid(){return"number"==typeof this.x&&"number"==typeof this.x2}}c(u.prototype,{ttBelow:!1,tooltipDateKeys:["x","x2"]});let{composed:x,noop:g}=s(),{parse:y}=r(),{column:m}=l().seriesTypes,{addEvent:f,clamp:b,crisp:A,defined:C,extend:w,find:v,isNumber:M,isObject:P,merge:R,pick:X,pushUnique:S,relativeLength:I}=s();function L(){let t,e;if(this.isXAxis){for(let i of(t=X(this.dataMax,-Number.MAX_VALUE),this.series)){let s=i.dataTable.getColumn("x2",!0)||i.dataTable.getColumn("end",!0);if(s)for(let i of s)M(i)&&i>t&&(t=i,e=!0)}e&&(this.dataMax=t)}}class O extends m{static compose(t){S(x,"Series.XRange")&&f(t,"afterGetSeriesExtremes",L)}init(){super.init.apply(this,arguments),this.options.stacking=void 0}getColumnMetrics(){let t=()=>{for(let t of this.chart.series){let e=t.xAxis;t.xAxis=t.yAxis,t.yAxis=e}};t();let e=super.getColumnMetrics();return t(),e}cropData(t,e,i){let s=t.getColumn("x")||[],o=t.getColumn("x2");t.setColumn("x",o,void 0,{silent:!0});let r=super.cropData(t,e,i);return t.setColumn("x",s.slice(r.start,r.end),void 0,{silent:!0}),r}findPointIndex(t){let e,{cropStart:i,points:s}=this,{id:o}=t;if(o){let t=v(s,t=>t.id===o);e=t?t.index:void 0}if(void 0===e){let i=v(s,e=>e.x===t.x&&e.x2===t.x2&&!e.touched);e=i?i.index:void 0}return this.cropped&&M(e)&&M(i)&&e>=i&&(e-=i),e}alignDataLabel(t){let e=t.plotX;t.plotX=X(t.dlBox?.centerX,t.plotX),t.dataLabel&&t.shapeArgs?.width&&t.dataLabel.css({width:`${t.shapeArgs.width}px`}),super.alignDataLabel.apply(this,arguments),t.plotX=e}translatePoint(t){let e=this.xAxis,i=this.yAxis,s=this.columnMetrics,o=this.options,r=o.minPointLength||0,a=(t.shapeArgs?.width||0)/2,l=this.pointXOffset=s.offset,n=X(t.x2,t.x+(t.len||0)),p=o.borderRadius,h=this.chart.plotTop,d=this.chart.plotLeft,c=t.plotX,u=e.translate(n,0,0,0,1),x=Math.abs(u-c),g=this.chart.inverted,y=X(o.borderWidth,1),m,f,w=s.offset,v=Math.round(s.width),S,L,O,B;r&&((m=r-x)<0&&(m=0),c-=m/2,u+=m/2),c=Math.max(c,-10),u=b(u,-10,e.len+10),C(t.options.pointWidth)&&(w-=(Math.ceil(t.options.pointWidth)-v)/2,v=Math.ceil(t.options.pointWidth)),o.pointPlacement&&M(t.plotY)&&i.categories&&(t.plotY=i.translate(t.y,0,1,0,1,o.pointPlacement));let F=A(Math.min(c,u),y),T=A(Math.max(c,u),y)-F,N=Math.min(I("object"==typeof p?p.radius:p||0,v),Math.min(T,v)/2),D={x:F,y:A((t.plotY||0)+w,y),width:T,height:v,r:N};t.shapeArgs=D,g?t.tooltipPos[1]+=l+a:t.tooltipPos[0]-=a+l-D.width/2,L=(S=D.x)+D.width,S<0||L>e.len?(S=b(S,0,e.len),O=(L=b(L,0,e.len))-S,t.dlBox=R(D,{x:S,width:L-S,centerX:O?O/2:null})):t.dlBox=null;let V=t.tooltipPos,j=+!!g,Y=+!g,W=this.columnMetrics?this.columnMetrics.offset:-s.width/2;g?V[j]+=D.width/2:V[j]=b(V[j]+(e.reversed?-1:0)*D.width,e.left-d,e.left+e.len-d-1),V[Y]=b(V[Y]+(g?-1:1)*W,i.top-h,i.top+i.len-h-1),(f=t.partialFill)&&(P(f)&&(f=f.amount),M(f)||(f=0),t.partShapeArgs=R(D),B=Math.max(Math.round(x*f+t.plotX-c),0),t.clipRectArgs={x:e.reversed?D.x+x-B:D.x,y:D.y,width:B,height:D.height}),t.key=t.category||t.name,t.yCategory=i.categories?.[t.y??-1]}translate(){for(let t of(super.translate.apply(this,arguments),this.points))this.translatePoint(t)}drawPoint(t,e){let i=this.options,s=this.chart.renderer,o=t.shapeType,r=t.shapeArgs,a=t.partShapeArgs,l=t.clipRectArgs,n=t.state,p=i.states[n||"normal"]||{},h=void 0===n?"attr":e,d=this.pointAttribs(t,n),c=X(this.chart.options.chart.animation,p.animation),u=t.graphic,x=t.partialFill;if(t.isNull||!1===t.visible)u&&(t.graphic=u.destroy());else if(u?u.rect[e](r):(t.graphic=u=s.g("point").addClass(t.getClassName()).add(t.group||this.group),u.rect=s[o](R(r)).addClass(t.getClassName()).addClass("highcharts-partfill-original").add(u)),a&&(u.partRect?(u.partRect[e](R(a)),u.partialClipRect[e](R(l))):(u.partialClipRect=s.clipRect(l.x,l.y,l.width,l.height),u.partRect=s[o](a).addClass("highcharts-partfill-overlay").add(u).clip(u.partialClipRect))),!this.chart.styledMode&&(u.rect[e](d,c).shadow(i.shadow),a)){P(x)||(x={}),P(i.partialFill)&&(x=R(i.partialFill,x));let e=x.fill||y(d.fill).brighten(-.3).get()||y(t.color||this.color).brighten(-.3).get();d.fill=e,u.partRect[h](d,c).shadow(i.shadow)}}drawPoints(){let t=this.getAnimationVerb();for(let e of this.points)this.drawPoint(e,t)}getAnimationVerb(){return this.chart.pointCount<(this.options.animationLimit||250)?"animate":"attr"}isPointInside(t){let e=t.shapeArgs,i=t.plotX,s=t.plotY;return e?void 0!==i&&void 0!==s&&s>=0&&s<=this.yAxis.len&&(e.x||0)+(e.width||0)>=0&&i<=this.xAxis.len:super.isPointInside.apply(this,arguments)}}O.defaultOptions=R(m.defaultOptions,{colorByPoint:!0,dataLabels:{formatter:function(){let t=this.partialFill;if(h(t)&&(t=t.amount),p(t)&&t>0)return n(100*t)+"%"},inside:!0,verticalAlign:"middle",style:{whiteSpace:"nowrap"}},tooltip:{headerFormat:'<span style="font-size: 0.8em">{ucfirst point.x} - {point.x2}</span><br/>',pointFormat:'<span style="color:{point.color}">●</span> {series.name}: <b>{point.yCategory}</b><br/>'},borderRadius:3,pointRange:0}),w(O.prototype,{pointClass:u,pointArrayMap:["x2","y"],getExtremesFromAll:!0,keysAffectYAxis:["y"],parallelArrays:["x","x2","y"],requireSorting:!1,type:"xrange",animate:l().series.prototype.animate,autoIncrement:g,buildKDTree:g}),l().registerSeriesType("xrange",O);let B=s();O.compose(B.Axis);let F=s();export{F as default};