/**
 * Highstock JS v13.0.0 (2026-06-11)
 * @module highcharts/indicators/price-channel
 * @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,a={};a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);let r=e.default;var i=a.n(r);let o=function(e,t,a){return e.reduce((e,r)=>[Math.min(e[0],r[t]),Math.max(e[1],r[a])],[Number.MAX_VALUE,-Number.MAX_VALUE])},n=e.default.SeriesRegistry;var s=a.n(n);let{sma:{prototype:l}}=s().seriesTypes;!function(e){let t=["bottomLine"],a=["top","bottom"],i=["top"];function o(e){return"plot"+e.charAt(0).toUpperCase()+e.slice(1)}function n(e,t){let a=[];return(e.pointArrayMap||[]).forEach(e=>{e!==t&&a.push(o(e))}),a}function s(){let e=this,t=e.pointValKey,a=e.linesApiNames,i=e.areaLinesNames,s=e.points,p=e.options,h=e.graph,c={options:{gapSize:p.gapSize}},u=[],d=n(e,t),f=s.length,m;if(d.forEach((e,t)=>{for(u[t]=[];f--;)m=s[f],u[t].push({x:m.x,plotX:m.plotX,plotY:m[e],isNull:!(0,r.defined)(m[e])});f=s.length}),e.userOptions.fillColor&&i.length){let t=u[d.indexOf(o(i[0]))],a=1===i.length?s:u[d.indexOf(o(i[1]))],n=e.color;e.points=a,e.nextPoints=t,e.color=e.userOptions.fillColor,e.options=(0,r.merge)(s,c),e.graph=e.area,e.fillGraph=!0,l.drawGraph.call(e),e.area=e.graph,delete e.nextPoints,delete e.fillGraph,e.color=n}a.forEach((t,a)=>{u[a]?(e.points=u[a],p[t]?e.options=(0,r.merge)(p[t].styles,c):(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],l.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=s,e.options=p,e.graph=h,l.drawGraph.call(e)}function p(e){let t,a=[],r=[];if(e=e||this.points,this.fillGraph&&this.nextPoints){if((t=l.getGraphPath.call(this,this.nextPoints))&&t.length){t[0][0]="L",a=l.getGraphPath.call(this,e),r=t.slice(0,a.length);for(let e=r.length-1;e>=0;e--)a.push(r[e])}}else a=l.getGraphPath.apply(this,arguments);return a}function h(e){let t=[];return(this.pointArrayMap||[]).forEach(a=>{t.push(e[a])}),t}function c(){let e=this.pointArrayMap,t=[],a;t=n(this),l.translate.apply(this,arguments),this.points.forEach(r=>{e.forEach((e,i)=>{a=r[e],this.dataModify&&(a=this.dataModify.modifyValue(a)),null!==a&&(r[t[i]]=this.yAxis.toPixels(a,!0))})})}e.compose=function(e){let r=e.prototype;return r.linesApiNames=r.linesApiNames||t.slice(),r.pointArrayMap=r.pointArrayMap||a.slice(),r.pointValKey=r.pointValKey||"top",r.areaLinesNames=r.areaLinesNames||i.slice(),r.drawGraph=s,r.getGraphPath=p,r.toYData=h,r.translate=c,e}}(t||(t={}));let p=t,{sma:h}=s().seriesTypes;class c extends h{getValues(e,t){let a,r,i,n,s,l,p=t.period,h=e.xData,c=e.yData,u=c?c.length:0,d=[],f=[],m=[];if(!(u<p)){for(l=p;l<=u;l++)n=h[l-1],a=((r=(s=o(c.slice(l-p,l),2,1))[1])+(i=s[0]))/2,d.push([n,r,a,i]),f.push(n),m.push([r,a,i]);return{values:d,xData:f,yData:m}}}}c.defaultOptions=(0,r.merge)(h.defaultOptions,{params:{index:void 0,period:20},lineWidth:1,topLine:{styles:{lineColor:"var(--highcharts-color-2)",lineWidth:1}},bottomLine:{styles:{lineColor:"var(--highcharts-color-8)",lineWidth:1}},dataGrouping:{approximation:"averages"}}),(0,r.extend)(c.prototype,{areaLinesNames:["top","bottom"],nameBase:"Price Channel",nameComponents:["period"],linesApiNames:["topLine","bottomLine"],pointArrayMap:["top","middle","bottom"],pointValKey:"middle"}),p.compose(c),s().registerSeriesType("pc",c);let u=i();export{u as default};