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