/**
 * Highstock JS v13.0.0 (2026-06-11)
 * @module highcharts/indicators/bollinger-bands
 * @requires highcharts
 * @requires highcharts/modules/stock
 *
 * Indicator series type for Highcharts Stock
 *
 * (c) 2010-2026 Highsoft AS
 * Author: Paweł Fus
 *
 * A commercial license may be required depending on use,
 * see www.highcharts.com/license
 */import*as t from"../highcharts.js";var e,o={};o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var i in e)o.o(e,i)&&!o.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let i=t.default;var a=o.n(i);let r=t.default.SeriesRegistry;var s=o.n(r);let{sma:{prototype:n}}=s().seriesTypes;!function(t){let e=["bottomLine"],o=["top","bottom"],a=["top"];function r(t){return"plot"+t.charAt(0).toUpperCase()+t.slice(1)}function s(t,e){let o=[];return(t.pointArrayMap||[]).forEach(t=>{t!==e&&o.push(r(t))}),o}function l(){let t=this,e=t.pointValKey,o=t.linesApiNames,a=t.areaLinesNames,l=t.points,p=t.options,h=t.graph,d={options:{gapSize:p.gapSize}},c=[],m=s(t,e),y=l.length,f;if(m.forEach((t,e)=>{for(c[e]=[];y--;)f=l[y],c[e].push({x:f.x,plotX:f.plotX,plotY:f[t],isNull:!(0,i.defined)(f[t])});y=l.length}),t.userOptions.fillColor&&a.length){let e=c[m.indexOf(r(a[0]))],o=1===a.length?l:c[m.indexOf(r(a[1]))],s=t.color;t.points=o,t.nextPoints=e,t.color=t.userOptions.fillColor,t.options=(0,i.merge)(l,d),t.graph=t.area,t.fillGraph=!0,n.drawGraph.call(t),t.area=t.graph,delete t.nextPoints,delete t.fillGraph,t.color=s}o.forEach((e,o)=>{c[o]?(t.points=c[o],p[e]?t.options=(0,i.merge)(p[e].styles,d):(0,i.error)('Error: "There is no '+e+' in DOCS options declared. Check if linesApiNames are consistent with your DOCS line names."'),t.graph=t["graph"+e],n.drawGraph.call(t),t["graph"+e]=t.graph):(0,i.error)('Error: "'+e+" doesn't have equivalent in pointArrayMap. To many elements in linesApiNames relative to pointArrayMap.\"")}),t.points=l,t.options=p,t.graph=h,n.drawGraph.call(t)}function p(t){let e,o=[],i=[];if(t=t||this.points,this.fillGraph&&this.nextPoints){if((e=n.getGraphPath.call(this,this.nextPoints))&&e.length){e[0][0]="L",o=n.getGraphPath.call(this,t),i=e.slice(0,o.length);for(let t=i.length-1;t>=0;t--)o.push(i[t])}}else o=n.getGraphPath.apply(this,arguments);return o}function h(t){let e=[];return(this.pointArrayMap||[]).forEach(o=>{e.push(t[o])}),e}function d(){let t=this.pointArrayMap,e=[],o;e=s(this),n.translate.apply(this,arguments),this.points.forEach(i=>{t.forEach((t,a)=>{o=i[t],this.dataModify&&(o=this.dataModify.modifyValue(o)),null!==o&&(i[e[a]]=this.yAxis.toPixels(o,!0))})})}t.compose=function(t){let i=t.prototype;return i.linesApiNames=i.linesApiNames||e.slice(),i.pointArrayMap=i.pointArrayMap||o.slice(),i.pointValKey=i.pointValKey||"top",i.areaLinesNames=i.areaLinesNames||a.slice(),i.drawGraph=l,i.getGraphPath=p,i.toYData=h,i.translate=d,t}}(e||(e={}));let l=e,{sma:p}=s().seriesTypes;class h extends p{init(){s().seriesTypes.sma.prototype.init.apply(this,arguments),this.options=(0,i.merge)({topLine:{styles:{lineColor:this.color}},bottomLine:{styles:{lineColor:this.color}}},this.options)}getValues(t,e){let o,a,r,n,l,p,h,d,c,m=e.period,y=e.standardDeviation,f=[],u=[],g=t.xData,b=t.yData,x=b?b.length:0,A=[];if(g.length<m)return;let v=(0,i.isArray)(b[0]);for(c=m;c<=x;c++)l=g.slice(c-m,c),p=b.slice(c-m,c),n=(d=s().seriesTypes.sma.prototype.getValues.call(this,{xData:l,yData:p},e)).xData[0],o=d.yData[0],h=function(t,e,o,i){let a=t.length,r=0,s,n=0;for(;r<a;r++)n+=(s=(o?t[r][e]:t[r])-i)*s;return Math.sqrt(n/=a-1)}(p,e.index,v,o),a=o+y*h,r=o-y*h,A.push([n,a,o,r]),f.push(n),u.push([a,o,r]);return{values:A,xData:f,yData:u}}}h.defaultOptions=(0,i.merge)(p.defaultOptions,{params:{period:20,standardDeviation:2,index:3},bottomLine:{styles:{lineWidth:1,lineColor:void 0}},topLine:{styles:{lineWidth:1,lineColor:void 0}},tooltip:{pointFormat:'<span style="color:{point.color}">●</span><b> {series.name}</b><br/>Top: {point.top}<br/>Middle: {point.middle}<br/>Bottom: {point.bottom}<br/>'},marker:{enabled:!1},dataGrouping:{approximation:"averages"}}),(0,i.extend)(h.prototype,{areaLinesNames:["top","bottom"],linesApiNames:["topLine","bottomLine"],nameComponents:["period","standardDeviation"],pointArrayMap:["top","middle","bottom"],pointValKey:"middle"}),l.compose(h),s().registerSeriesType("bb",h);let d=a();export{d as default};