/**
 * Highstock JS v12.6.0 (2026-04-13)
 * @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 r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);let r=e.default;var i=o.n(r);let n=e.default.SeriesRegistry;var a=o.n(n);let{doc:l,win:s}=i();function p(e,t){return e>1e14?e:parseFloat(e.toPrecision(t||14))}function h(e){return c(e)&&"number"==typeof e.nodeType}function c(e,t){let o;return!!e&&"object"==typeof e&&(!t||"[object Array]"!==(o=Object.prototype.toString.call(e))&&"[object Array Iterator]"!==o)}function u(e,...t){let o,r=[e,...t],i={},n=function(e,t){return"object"!=typeof e&&(e={}),function(e,t,o){for(let o in e)Object.hasOwnProperty.call(e,o)&&t.call((0,e[o]),e[o],o,e)}(t,function(o,r){if("__proto__"!==r&&"constructor"!==r){let i;!c(o,!0)||(i=o?.constructor,c(o,!0)&&!h(o)&&i?.name&&"Object"!==i.name)||h(o)?e[r]=t[r]:e[r]=n(e[r]||{},o)}}),e};!0===e&&(i=r[1],r=Array.prototype.slice.call(r,2));let a=r.length;for(o=0;o<a;o++)i=n(i,r[o]);return i}Array.prototype.find;let{sma:{prototype:f}}=a().seriesTypes;!function(e){let t=["bottomLine"],o=["top","bottom"],i=["top"];function n(e){return"plot"+e.charAt(0).toUpperCase()+e.slice(1)}function a(e,t){let o=[];return(e.pointArrayMap||[]).forEach(e=>{e!==t&&o.push(n(e))}),o}function l(){let e=this,t=e.pointValKey,o=e.linesApiNames,i=e.areaLinesNames,l=e.points,s=e.options,p=e.graph,h={options:{gapSize:s.gapSize}},c=[],y=a(e,t),d=l.length,m;if(y.forEach((e,t)=>{for(c[t]=[];d--;)m=l[d],c[t].push({x:m.x,plotX:m.plotX,plotY:m[e],isNull:null==m[e]});d=l.length}),e.userOptions.fillColor&&i.length){let t=c[y.indexOf(n(i[0]))],o=1===i.length?l:c[y.indexOf(n(i[1]))],r=e.color;e.points=o,e.nextPoints=t,e.color=e.userOptions.fillColor,e.options=u(l,h),e.graph=e.area,e.fillGraph=!0,f.drawGraph.call(e),e.area=e.graph,delete e.nextPoints,delete e.fillGraph,e.color=r}o.forEach((t,o)=>{c[o]?(e.points=c[o],s[t]?e.options=u(s[t].styles,h):(0,r.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],f.drawGraph.call(e),e["graph"+t]=e.graph):(0,r.error)('Error: "'+t+" doesn't have equivalent in pointArrayMap. To many elements in linesApiNames relative to pointArrayMap.\"")}),e.points=l,e.options=s,e.graph=p,f.drawGraph.call(e)}function s(e){let t,o=[],r=[];if(e=e||this.points,this.fillGraph&&this.nextPoints){if((t=f.getGraphPath.call(this,this.nextPoints))&&t.length){t[0][0]="L",o=f.getGraphPath.call(this,e),r=t.slice(0,o.length);for(let e=r.length-1;e>=0;e--)o.push(r[e])}}else o=f.getGraphPath.apply(this,arguments);return o}function p(e){let t=[];return(this.pointArrayMap||[]).forEach(o=>{t.push(e[o])}),t}function h(){let e=this.pointArrayMap,t=[],o;t=a(this),f.translate.apply(this,arguments),this.points.forEach(r=>{e.forEach((e,i)=>{o=r[e],this.dataModify&&(o=this.dataModify.modifyValue(o)),null!==o&&(r[t[i]]=this.yAxis.toPixels(o,!0))})})}e.compose=function(e){let r=e.prototype;return r.linesApiNames=r.linesApiNames||t.slice(),r.pointArrayMap=r.pointArrayMap||o.slice(),r.pointValKey=r.pointValKey||"top",r.areaLinesNames=r.areaLinesNames||i.slice(),r.drawGraph=l,r.getGraphPath=s,r.toYData=p,r.translate=h,e}}(t||(t={}));let y=t,{sma:d}=a().seriesTypes;class m extends d{init(){a().seriesTypes.sma.prototype.init.apply(this,arguments),this.options=u({topLine:{styles:{lineColor:this.color}},bottomLine:{styles:{lineColor:this.color}}},this.options)}getValues(e,t){let o,r,i,n,l,s,h,c=t.period,u=t.periodATR,f=t.multiplierATR,y=t.index,d=e.yData,m=d?d.length:0,g=[],A=a().seriesTypes.ema.prototype.getValues(e,{period:c,index:y}),b=a().seriesTypes.atr.prototype.getValues(e,{period:u}),x=[],O=[];if(!(m<c)){for(h=c;h<=m;h++)l=A.values[h-c],s=b.values[h-u],n=l[0],r=p(l[1]+f*s[1]),i=p(l[1]-f*s[1]),o=l[1],g.push([n,r,o,i]),x.push(n),O.push([r,o,i]);return{values:g,xData:x,yData:O}}}}m.defaultOptions=u(d.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}),function(e,t){let o;for(o in e||(e={}),t)e[o]=t[o]}(m.prototype,{nameBase:"Keltner Channels",areaLinesNames:["top","bottom"],nameComponents:["period","periodATR","multiplierATR"],linesApiNames:["topLine","bottomLine"],pointArrayMap:["top","middle","bottom"],pointValKey:"middle"}),y.compose(m),a().registerSeriesType("keltnerchannels",m);let g=i();export{g as default};