let t;/**
 * Highstock JS v12.5.0 (2026-01-12)
 * @module highcharts/modules/datagrouping
 * @requires highcharts
 *
 * Data grouping module
 *
 * (c) 2010-2026 Highsoft AS
 * Author: Torstein Hønsi
 *
 * A commercial license may be required depending on use.
 * See www.highcharts.com/license
 */import*as e from"../highcharts.js";var i,o,a,n={};n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let r=e.default;var s=n.n(r);let l={},{arrayMax:u,arrayMin:h,correctFloat:p,extend:d,isNumber:c}=s();function g(t){let e=t.length,i=m(t);return c(i)&&e&&(i=p(i/e)),i}function m(t){let e=t.length,i;if(!e&&t.hasNulls)i=null;else if(e)for(i=0;e--;)i+=t[e];return i}let f={average:g,averages:function(){let t=[];return[].forEach.call(arguments,function(e){t.push(g(e))}),void 0===t[0]?void 0:t},close:function(t){return t.length?t[t.length-1]:t.hasNulls?null:void 0},high:function(t){return t.length?u(t):t.hasNulls?null:void 0},hlc:function(t,e,i){if(t=l.high(t),e=l.low(e),i=l.close(i),c(t)||c(e)||c(i))return[t,e,i]},low:function(t){return t.length?h(t):t.hasNulls?null:void 0},ohlc:function(t,e,i,o){if(t=l.open(t),e=l.high(e),i=l.low(i),o=l.close(o),c(t)||c(e)||c(i)||c(o))return[t,e,i,o]},open:function(t){return t.length?t[0]:t.hasNulls?null:void 0},range:function(t,e){return(t=l.low(t),e=l.high(e),c(t)||c(e))?[t,e]:null===t&&null===e?null:void 0},sum:m};d(l,f);let y={groupPixelWidth:2,dateTimeLabelFormats:{millisecond:["%[AebHMSL]","%[AebHMSL]","-%[HMSL]"],second:["%[AebHMS]","%[AebHMS]","-%[HMS]"],minute:["%[AebHM]","%[AebHM]","-%[HM]"],hour:["%[AebHM]","%[AebHM]","-%[HM]"],day:["%[AebY]","%[Aeb]","-%[AebY]"],week:["%v %[AebY]","%[Aeb]","-%[AebY]"],month:["%[BY]","%[B]","-%[BY]"],year:["%Y","%Y","-%Y"]}},x={line:{},spline:{},area:{},areaspline:{},arearange:{},column:{groupPixelWidth:10},columnrange:{groupPixelWidth:10},candlestick:{groupPixelWidth:10},ohlc:{groupPixelWidth:5},hlc:{groupPixelWidth:5},heikinashi:{groupPixelWidth:10}},G=[["millisecond",[1,2,5,10,20,25,50,100,200,500]],["second",[1,2,5,10,15,30]],["minute",[1,2,5,10,15,30]],["hour",[1,2,3,4,6,8,12]],["day",[1]],["week",[1]],["month",[1,3,6]],["year",null]],{addEvent:M,extend:b,merge:v,pick:A}=s();function T(t){let e=this,i=e.series;i.forEach(function(t){t.groupPixelWidth=void 0}),i.forEach(function(i){i.groupPixelWidth=e.getGroupPixelWidth&&e.getGroupPixelWidth(),i.groupPixelWidth&&(i.hasProcessed=!0),i.applyGrouping(!!t.hasExtremesChanged)})}function C(){let t=this.series,e=t.length,i=0,o=!1,a,n;for(;e--;)(n=t[e].options.dataGrouping)&&(i=Math.max(i,A(n.groupPixelWidth,y.groupPixelWidth)),a=(t[e].dataTable.getModified()||t[e].dataTable).rowCount,(t[e].groupPixelWidth||a>this.chart.plotSizeX/i||a&&n.forced)&&(o=!0));return o?i:0}function D(){this.series.forEach(function(t){t.hasProcessed=!1})}function w(e,i){let o;if(i=A(i,!0),e||(e={forced:!1,units:null}),this instanceof t)for(o=this.series.length;o--;)this.series[o].update({dataGrouping:e},!1);else this.chart.options.series.forEach(function(t){t.dataGrouping="boolean"==typeof e?e:v(e,t.dataGrouping)});this.ordinal&&(this.ordinal.slope=void 0),i&&this.chart.redraw()}let P=function(e){t=e;let i=e.prototype;i.applyGrouping||(M(e,"afterSetScale",D),M(e,"postProcessData",T),b(i,{applyGrouping:T,getGroupPixelWidth:C,setDataGrouping:w}))};(i=o||(o={})).setLength=function(t,e,i){return Array.isArray(t)?(t.length=e,t):t[i?"subarray":"slice"](0,e)},i.splice=function(t,e,i,o,a=[]){if(Array.isArray(t))return Array.isArray(a)||(a=Array.from(a)),{removed:t.splice(e,i,...a),array:t};let n=Object.getPrototypeOf(t).constructor,r=t[o?"subarray":"slice"](e,e+i),s=new n(t.length-i+a.length);return s.set(t.subarray(0,e),0),s.set(a,e),s.set(t.subarray(e+i),e+a.length),{removed:r,array:s}},i.convertToNumber=function(t,e){switch(typeof t){case"boolean":return+!!t;case"number":return isNaN(t)&&!e?null:t;default:return isNaN(t=parseFloat(`${t??""}`))&&!e?null:t}};let{setLength:S,splice:k}=o,{fireEvent:O,objectEach:F,uniqueKey:R}=s(),W=class{constructor(t={}){this.autoId=!t.id,this.columns={},this.id=t.id||R(),this.rowCount=0,this.versionTag=R();let e=0;F(t.columns||{},(t,i)=>{this.columns[i]=t.slice(),e=Math.max(e,t.length)}),this.applyRowCount(e)}applyRowCount(t){this.rowCount=t,F(this.columns,(e,i)=>{e.length!==t&&(this.columns[i]=S(e,t))})}deleteRows(t,e=1){if(e>0&&t<this.rowCount){let i=0;F(this.columns,(o,a)=>{this.columns[a]=k(o,t,e).array,i=o.length}),this.rowCount=i}O(this,"afterDeleteRows",{rowIndex:t,rowCount:e}),this.versionTag=R()}getColumn(t,e){return this.columns[t]}getColumns(t,e){return(t||Object.keys(this.columns)).reduce((t,e)=>(t[e]=this.columns[e],t),{})}getRow(t,e){return(e||Object.keys(this.columns)).map(e=>this.columns[e]?.[t])}setColumn(t,e=[],i=0,o){this.setColumns({[t]:e},i,o)}setColumns(t,e,i){let o=this.rowCount;F(t,(t,e)=>{this.columns[e]=t.slice(),o=t.length}),this.applyRowCount(o),i?.silent||(O(this,"afterSetColumns"),this.versionTag=R())}setRow(t,e=this.rowCount,i,o){let{columns:a}=this,n=i?this.rowCount+1:e+1,r=Object.keys(t);if(o?.addColumns!==!1)for(let t=0,e=r.length;t<e;t++){let e=r[t];a[e]||(a[e]=[])}F(a,(r,s)=>{r||o?.addColumns===!1||(r=Array(n)),r&&(i?r=k(r,e,0,!0,[t[s]??null]).array:r[e]=t[s]??null,a[s]=r)}),n>this.rowCount&&this.applyRowCount(n),o?.silent||(O(this,"afterSetRows"),this.versionTag=R())}getModified(){return this.modified||this}},{addEvent:N,getMagnitude:E,normalizeTickInterval:H,timeUnits:I}=s();!function(t){function e(){return this.chart.time.getTimeTicks.apply(this.chart.time,arguments)}function i(){if("datetime"!==this.type){this.dateTime=void 0;return}this.dateTime||(this.dateTime=new o(this))}t.compose=function(t){return t.keepProps.includes("dateTime")||(t.keepProps.push("dateTime"),t.prototype.getTimeTicks=e,N(t,"afterSetType",i)),t};class o{constructor(t){this.axis=t}normalizeTimeTickInterval(t,e){let i=e||[["millisecond",[1,2,5,10,20,25,50,100,200,500]],["second",[1,2,5,10,15,30]],["minute",[1,2,5,10,15,30]],["hour",[1,2,3,4,6,8,12]],["day",[1,2]],["week",[1,2]],["month",[1,2,3,4,6]],["year",null]],o=i[i.length-1],a=I[o[0]],n=o[1],r;for(r=0;r<i.length&&(a=I[(o=i[r])[0]],n=o[1],!i[r+1]||!(t<=(a*n[n.length-1]+I[i[r+1][0]])/2));r++);a===I.year&&t<5*a&&(n=[1,2,5]);let s=H(t/a,n,"year"===o[0]?Math.max(E(t/a),1):1);return{unitRange:a,count:s,unitName:o[0]}}getXDateFormat(t,e){let{axis:i}=this,o=i.chart.time;return i.closestPointRange?o.getDateFormat(i.closestPointRange,t,i.options.startOfWeek,e)||o.resolveDTLFormat(e.year).main:o.resolveDTLFormat(e.day).main}}t.Additions=o}(a||(a={}));let L=a,Y=e.default.SeriesRegistry,{series:{prototype:j}}=n.n(Y)(),{addEvent:z,defined:X,error:q,extend:B,isNumber:_,merge:$,pick:J,splat:K}=s(),Q=j.generatePoints;function U(t){var e,i,o;let a,n,r=this.chart,s=this.options.dataGrouping,l=!1!==this.allowDG&&s&&J(s.enabled,r.options.isStock),u=this.reserveSpace(),h=this.currentDataGrouping,p,d,c=!1;l&&!this.requireSorting&&(this.requireSorting=c=!0);let g=!1==(e=this,i=t,!(e.isCartesian&&!e.isDirty&&!e.xAxis.isDirty&&!e.yAxis.isDirty&&!i))||!l;if(c&&(this.requireSorting=!1),g)return;this.destroyGroupedData();let m=s.groupAll?this.dataTable:this.dataTable.getModified()||this.dataTable,f=this.getColumn("x",!s.groupAll),y=r.plotSizeX,x=this.xAxis,M=x.getExtremes(),b=x.options.ordinal,v=this.groupPixelWidth;if(v&&f&&m.rowCount&&y&&_(M.min)){n=!0,this.isDirty=!0,this.points=null;let t=M.min,e=M.max,i=b&&x.ordinal&&x.ordinal.getGroupIntervalFactor(t,e,this)||1,l=v*(e-t)/y*i,h=x.getTimeTicks(L.Additions.prototype.normalizeTimeTickInterval(l,s.units||G),Math.min(t,f[0]),Math.max(e,f[f.length-1]),x.options.startOfWeek,f,this.closestPointRange),c=j.groupData.apply(this,[m,h,s.approximation]),g=c.modified,A=g.getColumn("x",!0),T=0;for(s?.smoothed&&g.rowCount&&(s.firstAnchor="firstPoint",s.anchor="middle",s.lastAnchor="lastPoint",q(32,!1,r,{"dataGrouping.smoothed":"use dataGrouping.anchor"})),a=1;a<h.length;a++)h.info.segmentStarts&&-1!==h.info.segmentStarts.indexOf(a)||(T=Math.max(h[a]-h[a-1],T));(p=h.info).gapSize=T,this.closestPointRange=h.info.totalRange,this.groupMap=c.groupMap,this.currentDataGrouping=p,function(t,e,i){let o=t.options.dataGrouping,a=t.currentDataGrouping&&t.currentDataGrouping.gapSize,n=t.getColumn("x");if(!(o&&n.length&&a&&t.groupMap))return;let r=e.length-1,s=o.anchor,l=o.firstAnchor,u=o.lastAnchor,h=e.length-1,p=0;if(l&&n[0]>=e[0]){let i;p++;let o=t.groupMap[0].start,r=t.groupMap[0].length;_(o)&&_(r)&&(i=o+(r-1)),e[0]=({start:e[0],middle:e[0]+.5*a,end:e[0]+a,firstPoint:n[0],lastPoint:i&&n[i]})[l]}if(r>0&&u&&a&&e[r]>=i-a){h--;let i=t.groupMap[t.groupMap.length-1].start;e[r]=({start:e[r],middle:e[r]+.5*a,end:e[r]+a,firstPoint:i&&n[i],lastPoint:n[n.length-1]})[u]}if(s&&"start"!==s){let t=a*({middle:.5,end:1})[s];for(;h>=p;)e[h]+=t,h--}}(this,A||[],e),u&&A&&(X((o=A)[0])&&_(x.min)&&_(x.dataMin)&&o[0]<x.min&&((!X(x.options.min)&&x.min<=x.dataMin||x.min===x.dataMin)&&(x.min=Math.min(o[0],x.min)),x.dataMin=Math.min(o[0],x.dataMin)),X(o[o.length-1])&&_(x.max)&&_(x.dataMax)&&o[o.length-1]>x.max&&((!X(x.options.max)&&_(x.dataMax)&&x.max>=x.dataMax||x.max===x.dataMax)&&(x.max=Math.max(o[o.length-1],x.max)),x.dataMax=Math.max(o[o.length-1],x.dataMax))),s.groupAll&&(this.allGroupedTable=g,A=(g=(d=this.cropData(g,x.min||0,x.max||0)).modified).getColumn("x"),this.cropStart=d.start),this.dataTable.modified=g}else this.groupMap=void 0,this.currentDataGrouping=void 0;this.hasGroupedData=n,this.preventGraphAnimation=(h&&h.totalRange)!==(p&&p.totalRange)}function V(){this.groupedData&&(this.groupedData.forEach(function(t,e){t&&(this.groupedData[e]=t.destroy?t.destroy():null)},this),this.groupedData.length=0,delete this.allGroupedTable)}function Z(){Q.apply(this),this.destroyGroupedData(),this.groupedData=this.hasGroupedData?this.points:null}function tt(){return this.is("arearange")?"range":this.is("ohlc")?"ohlc":this.is("hlc")?"hlc":this.is("column")||this.options.cumulative?"sum":"average"}function te(t,e,i){let o=t.getColumn("x",!0)||[],a=t.getColumn("y",!0),n=this,r=n.data,s=n.options&&n.options.data,u=[],h=new W,p=[],d=t.rowCount,c=!!a,g=[],m=n.pointArrayMap,f=m&&m.length,y=["x"].concat(m||["y"]),x=(m||["y"]).map(()=>[]),G=this.options.dataGrouping&&this.options.dataGrouping.groupAll,M,b,v,A=0,T=0,C="function"==typeof i?i:i&&l[i]?l[i]:l[n.getDGApproximation&&n.getDGApproximation()||"average"];if(f){let t=m.length;for(;t--;)g.push([])}else g.push([]);let D=f||1;for(let t=0;t<=d;t++)if(!(o[t]<e[0])){for(;void 0!==e[A+1]&&o[t]>=e[A+1]||t===d;){if(M=e[A],n.dataGroupInfo={start:G?T:n.cropStart+T,length:g[0].length,groupStart:M},v=C.apply(n,g),n.pointClass&&!X(n.dataGroupInfo.options)&&(n.dataGroupInfo.options=$(n.pointClass.prototype.optionsToObject.call({series:n},n.options.data[n.cropStart+T])),y.forEach(function(t){delete n.dataGroupInfo.options[t]})),void 0!==v){u.push(M);let t=K(v);for(let e=0;e<t.length;e++)x[e].push(t[e]);p.push(n.dataGroupInfo)}T=t;for(let t=0;t<D;t++)g[t].length=0,g[t].hasNulls=!1;if(A+=1,t===d)break}if(t===d)break;if(m){let e,i=G?t:n.cropStart+t,o=r&&r[i]||n.pointClass.prototype.applyOptions.apply({series:n},[s[i]]);for(let t=0;t<f;t++)_(e=o[m[t]])?g[t].push(e):null===e&&(g[t].hasNulls=!0)}else _(b=c?a[t]:null)?g[0].push(b):null===b&&(g[0].hasNulls=!0)}let w={x:u};return(m||["y"]).forEach((t,e)=>{w[t]=x[e]}),h.setColumns(w),{groupMap:p,modified:h}}function ti(t){let e=t.options,i=this.type,o=this.chart.options.plotOptions,a=this.useCommonDataGrouping&&y,n=s().defaultOptions.plotOptions[i].dataGrouping;if(o&&(x[i]||a)){let t=this.chart.rangeSelector;n||(n=$(y,x[i])),e.dataGrouping=$(a,n,o.series&&o.series.dataGrouping,o[i].dataGrouping,this.userOptions.dataGrouping,!e.isInternal&&t&&_(t.selected)&&t.buttonOptions[t.selected].dataGrouping)}}let to=function(t){let e=t.prototype;e.applyGrouping||(z(t.prototype.pointClass,"update",function(){if(this.dataGroup)return q(24,!1,this.series.chart),!1}),z(t,"afterSetOptions",ti),z(t,"destroy",V),B(e,{applyGrouping:U,destroyGroupedData:V,generatePoints:Z,getDGApproximation:tt,groupData:te}))},ta=e.default.Templating,{format:tn}=n.n(ta)(),{composed:tr}=s(),{addEvent:ts,extend:tl,isNumber:tu,pick:th,pushUnique:tp}=s();function td(t){let e=this.chart,i=e.time,o=t.point,a=o.series,n=a.options,r=a.tooltipOptions,s=n.dataGrouping,l=a.xAxis,u=r.xDateFormat||"",h,p,d,c,g,m=r[t.isFooter?"footerFormat":"headerFormat"];if(l&&"datetime"===l.options.type&&s&&tu(o.key)){p=a.currentDataGrouping,d=s.dateTimeLabelFormats||y.dateTimeLabelFormats,p?(c=d[p.unitName],1===p.count?u=c[0]:(u=c[1],h=c[2])):!u&&d&&l.dateTime&&(u=l.dateTime.getXDateFormat(o.x,r.dateTimeLabelFormats));let n=th(a.groupMap?.[o.index].groupStart,o.key),f=n+(p?.totalRange||0)-1;g=i.dateFormat(u,n),h&&(g+=i.dateFormat(h,f)),a.chart.styledMode&&(m=this.styledModeFormat(m)),t.text=tn(m,{point:tl(o,{key:g}),series:a},e),t.preventDefault()}}let tc=s();tc.dataGrouping=tc.dataGrouping||{},tc.dataGrouping.approximationDefaults=tc.dataGrouping.approximationDefaults||f,tc.dataGrouping.approximations=tc.dataGrouping.approximations||l,({compose:function(t,e,i){P(t),to(e),i&&tp(tr,"DataGrouping")&&ts(i,"headerFormatter",td)},groupData:te}).compose(tc.Axis,tc.Series,tc.Tooltip);let tg=s();export{tg as default};