/**
 * Highcharts JS v12.6.0 (2026-04-13)
 * @module highcharts/modules/xrange
 * @requires highcharts
 *
 * X-range series
 *
 * (c) 2010-2026 Highsoft AS
 * Author: Torstein Hønsi, 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 o in i)e.o(i,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:i[o]})},e.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let i=t.default;var o=e.n(i);let r=t.default.Color;var s=e.n(r);let a=t.default.SeriesRegistry;var l=e.n(a);let{doc:n,win:p}=o();function h(t,e,i){return t>e?t<i?t:i:e}function c(t,e=0,i){let o=e%2/2,r=i?-1:1;return(Math.round(t*r-o)+o)*r}function d(t,e){let i;for(i in t||(t={}),e)t[i]=e[i];return t}let u=Array.prototype.find?function(t,e){return t.find(e)}:function(t,e){let i,o=t.length;for(i=0;i<o;i++)if(e(t[i],i))return t[i]};function f(t){return x(t)&&"number"==typeof t.nodeType}function y(t){return"number"==typeof t&&!isNaN(t)&&t<1/0&&t>-1/0}function x(t,e){let i;return!!t&&"object"==typeof t&&(!e||"[object Array]"!==(i=Object.prototype.toString.call(t))&&"[object Array Iterator]"!==i)}function g(t,...e){let i,o=[t,...e],r={},s=function(t,e){return"object"!=typeof t&&(t={}),function(t,e,i){for(let o in t)Object.hasOwnProperty.call(t,o)&&e.call(i||t[o],t[o],o,t)}(e,function(i,o){if("__proto__"!==o&&"constructor"!==o){let r;!x(i,!0)||(r=i?.constructor,x(i,!0)&&!f(i)&&r?.name&&"Object"!==r.name)||f(i)?t[o]=e[o]:t[o]=s(t[o]||{},i)}}),t};!0===t&&(r=o[1],o=Array.prototype.slice.call(o,2));let a=o.length;for(i=0;i<a;i++)r=s(r,o[i]);return r}function m(){let t=arguments,e=t.length;for(let i=0;i<e;i++){let e=t[i];if(null!=e)return e}}let{column:{prototype:{pointClass:b}}}=l().seriesTypes;class A extends b{static getColorByCategory(t,e){let i=t.options.colors||t.chart.options.colors,o=i?i.length:t.chart.options.chart.colorCount,r=e.y%o,s=i?.[r];return{colorIndex:r,color:s}}resolveColor(){let t=this.series;if(t.options.colorByPoint&&!this.options.color){let e=A.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}}d(A.prototype,{ttBelow:!1,tooltipDateKeys:["x","x2"]});let{composed:v,noop:C}=o(),{parse:w}=s(),{column:P}=l().seriesTypes;function M(){let t,e;if(this.isXAxis){for(let i of(t=m(this.dataMax,-Number.MAX_VALUE),this.series)){let o=i.dataTable.getColumn("x2",!0)||i.dataTable.getColumn("end",!0);if(o)for(let i of o)y(i)&&i>t&&(t=i,e=!0)}e&&(this.dataMax=t)}}class O extends P{static compose(t){0>v.indexOf("Series.XRange")&&v.push("Series.XRange")&&function(t,e,i,r={}){let s="function"==typeof t&&t.prototype||t;Object.hasOwnProperty.call(s,"hcEvents")||(s.hcEvents={});let a=s.hcEvents;o().Point&&t instanceof o().Point&&t.series&&t.series.chart&&(t.series.chart.runTrackerClick=!0);let l=t.addEventListener;l&&l.call(t,e,i,!!o().supportsPassiveEvents&&{passive:void 0===r.passive?-1!==e.indexOf("touch"):r.passive,capture:!1}),a[e]||(a[e]=[]);let n={fn:i,order:"number"==typeof r.order?r.order:1/0};a[e].push(n),a[e].sort((t,e)=>t.order-e.order)}(t,"afterGetSeriesExtremes",M)}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 o=t.getColumn("x")||[],r=t.getColumn("x2");t.setColumn("x",r,void 0,{silent:!0});let s=super.cropData(t,e,i);return t.setColumn("x",o.slice(s.start,s.end),void 0,{silent:!0}),s}findPointIndex(t){let e,{cropStart:i,points:o}=this,{id:r}=t;if(r){let t=u(o,t=>t.id===r);e=t?t.index:void 0}if(void 0===e){let i=u(o,e=>e.x===t.x&&e.x2===t.x2&&!e.touched);e=i?i.index:void 0}return this.cropped&&y(e)&&y(i)&&e>=i&&(e-=i),e}alignDataLabel(t){let e=t.plotX;t.plotX=m(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){var e,i;let o=this.xAxis,r=this.yAxis,s=this.columnMetrics,a=this.options,l=a.minPointLength||0,n=(t.shapeArgs?.width||0)/2,p=this.pointXOffset=s.offset,d=m(t.x2,t.x+(t.len||0)),u=a.borderRadius,f=this.chart.plotTop,b=this.chart.plotLeft,A=t.plotX,v=o.translate(d,0,0,0,1),C=Math.abs(v-A),w=this.chart.inverted,P=m(a.borderWidth,1),M,O,R=s.offset,X=Math.round(s.width),j,S,F,I;l&&((M=l-C)<0&&(M=0),A-=M/2,v+=M/2),A=Math.max(A,-10),v=h(v,-10,o.len+10),null!=t.options.pointWidth&&(R-=(Math.ceil(t.options.pointWidth)-X)/2,X=Math.ceil(t.options.pointWidth)),a.pointPlacement&&y(t.plotY)&&r.categories&&(t.plotY=r.translate(t.y,0,1,0,1,a.pointPlacement));let L=c(Math.min(A,v),P),T=c(Math.max(A,v),P)-L,B=Math.min((e="object"==typeof u?u.radius:u||0,i=X,/%$/.test(e)?i*parseFloat(e)/100+0:parseFloat(e)),Math.min(T,X)/2),E={x:L,y:c((t.plotY||0)+R,P),width:T,height:X,r:B};t.shapeArgs=E,w?t.tooltipPos[1]+=p+n:t.tooltipPos[0]-=n+p-E.width/2,S=(j=E.x)+E.width,j<0||S>o.len?(j=h(j,0,o.len),F=(S=h(S,0,o.len))-j,t.dlBox=g(E,{x:j,width:S-j,centerX:F?F/2:null})):t.dlBox=null;let N=t.tooltipPos,_=+!!w,D=+!w,V=this.columnMetrics?this.columnMetrics.offset:-s.width/2;w?N[_]+=E.width/2:N[_]=h(N[_]+(o.reversed?-1:0)*E.width,o.left-b,o.left+o.len-b-1),N[D]=h(N[D]+(w?-1:1)*V,r.top-f,r.top+r.len-f-1),(O=t.partialFill??0)&&(x(O)&&(O=O.amount||0),y(O)||(O=0),t.partShapeArgs=g(E),I=Math.max(Math.round(C*O+t.plotX-A),0),t.clipRectArgs={x:o.reversed?E.x+C-I:E.x,y:E.y,width:I,height:E.height}),t.key=t.category||t.name,t.yCategory=r.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,o=this.chart.renderer,r=t.shapeType,s=t.shapeArgs,a=t.partShapeArgs,l=t.clipRectArgs,n=t.state,p=i.states[n||"normal"]||{},h=void 0===n?"attr":e,c=this.pointAttribs(t,n),d=m(this.chart.options.chart.animation,p.animation),u=t.graphic,f=t.partialFill;if(t.isNull||!1===t.visible)u&&(t.graphic=u.destroy());else if(u?u.rect[e](s):(t.graphic=u=o.g("point").addClass(t.getClassName()).add(t.group||this.group),u.rect=o[r](g(s)).addClass(t.getClassName()).addClass("highcharts-partfill-original").add(u)),a&&(u.partRect?(u.partRect[e](g(a)),u.partialClipRect[e](g(l))):(u.partialClipRect=o.clipRect(l.x,l.y,l.width,l.height),u.partRect=o[r](a).addClass("highcharts-partfill-overlay").add(u).clip(u.partialClipRect))),!this.chart.styledMode&&(u.rect[e](c,d).shadow(i.shadow),a)){x(f)||(f={}),x(i.partialFill)&&(f=g(i.partialFill,f));let e=f.fill||w(c.fill).brighten(-.3).get()||w(t.color||this.color).brighten(-.3).get();c.fill=e,u.partRect[h](c,d).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,o=t.plotY;return e?void 0!==i&&void 0!==o&&o>=0&&o<=this.yAxis.len&&(e.x||0)+(e.width||0)>=0&&i<=this.xAxis.len:super.isPointInside.apply(this,arguments)}}O.defaultOptions=g(P.defaultOptions,{colorByPoint:!0,dataLabels:{formatter:function(){let t=this.partialFill;if(x(t)&&(t=t.amount),y(t)&&t>0){var e;return((e=100*t)>1e14?e:parseFloat(e.toPrecision(14)))+"%"}},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}),d(O.prototype,{pointClass:A,pointArrayMap:["x2","y"],getExtremesFromAll:!0,keysAffectYAxis:["y"],parallelArrays:["x","x2","y"],requireSorting:!1,type:"xrange",animate:l().series.prototype.animate,autoIncrement:C,buildKDTree:C}),l().registerSeriesType("xrange",O);let R=o();O.compose(R.Axis);let X=o();export{X as default};