/**
 * Highstock JS v13.0.0 (2026-06-11)
 * @module highcharts/indicators/pivot-points
 * @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={};e.n=t=>{var a=t&&t.__esModule?()=>t.default:()=>t;return e.d(a,{a:a}),a},e.d=(t,a)=>{for(var l in a)e.o(a,l)&&!e.o(t,l)&&Object.defineProperty(t,l,{enumerable:!0,get:a[l]})},e.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let a=t.default;var l=e.n(a);let n=t.default.SeriesRegistry;var o=e.n(n);let r=o().seriesTypes.sma.prototype.pointClass;function s(t,e){let a=t.series.pointArrayMap,l,n=a.length;for(o().seriesTypes.sma.prototype.pointClass.prototype[e].call(t);n--;)t[l="dataLabel"+a[n]]&&t[l].element&&t[l].destroy(),t[l]=null}let{sma:i}=o().seriesTypes;class p extends i{toYData(t){return[t.P]}translate(){let t=this;super.translate.apply(t),t.points.forEach(function(e){t.pointArrayMap.forEach(function(l){(0,a.defined)(e[l])&&(e["plot"+l]=t.yAxis.toPixels(e[l],!0))})}),t.plotEndPoint=t.xAxis.toPixels(t.endPoint,!0)}getGraphPath(t){let e=this,l=[[],[],[],[],[],[],[],[],[]],n=e.pointArrayMap.length,o=e.plotEndPoint,r=[],s,i,p=t.length,d;for(;p--;){for(d=0,i=t[p];d<n;d++)s=e.pointArrayMap[d],(0,a.defined)(i[s])&&l[d].push({plotX:i.plotX,plotY:i["plot"+s],isNull:!1},{plotX:o,plotY:i["plot"+s],isNull:!1},{plotX:o,plotY:null,isNull:!0});o=i.plotX}return l.forEach(t=>{r=r.concat(super.getGraphPath.call(e,t))}),r}drawDataLabels(){let t,e,a,l,n=this,o=n.pointArrayMap;n.options.dataLabels.enabled&&(e=n.points.length,o.concat([!1]).forEach((r,s)=>{for(l=e;l--;)a=n.points[l],r?(a.y=a[r],a.pivotLine=r,a.plotY=a["plot"+r],t=a["dataLabel"+r],s&&(a["dataLabel"+o[s-1]]=a.dataLabel),a.dataLabels||(a.dataLabels=[]),a.dataLabels[0]=a.dataLabel=t=t&&t.element?t:null):a["dataLabel"+o[s-1]]=a.dataLabel;super.drawDataLabels.call(n)}))}getValues(t,e){let l,n,o,r,s,i,p,d=e.period,u=t.xData,h=t.yData,c=h?h.length:0,y=this[e.algorithm+"Placement"],f=[],m=[],g=[];if(!(u.length<d)&&(0,a.isArray)(h[0])&&4===h[0].length){for(p=d+1;p<=c+d;p+=d)o=u.slice(p-d-1,p),r=h.slice(p-d-1,p),n=o.length,l=o[n-1],i=y(this.getPivotAndHLC(r)),s=f.push([l].concat(i)),m.push(l),g.push(f[s-1].slice(1));return this.endPoint=o[0]+(l-o[0])/n*d,{values:f,xData:m,yData:g}}}getPivotAndHLC(t){let e=t[t.length-1][3],a=-1/0,l=1/0;return t.forEach(function(t){a=Math.max(a,t[1]),l=Math.min(l,t[2])}),[(a+l+e)/3,a,l,e]}standardPlacement(t){let e=t[1]-t[2];return[null,null,t[0]+e,2*t[0]-t[2],t[0],2*t[0]-t[1],t[0]-e,null,null]}camarillaPlacement(t){let e=t[1]-t[2];return[t[3]+1.5*e,t[3]+1.25*e,t[3]+1.1666*e,t[3]+1.0833*e,t[0],t[3]-1.0833*e,t[3]-1.1666*e,t[3]-1.25*e,t[3]-1.5*e]}fibonacciPlacement(t){let e=t[1]-t[2];return[null,t[0]+e,t[0]+.618*e,t[0]+.382*e,t[0],t[0]-.382*e,t[0]-.618*e,t[0]-e,null]}}p.defaultOptions=(0,a.merge)(i.defaultOptions,{params:{index:void 0,period:28,algorithm:"standard"},marker:{enabled:!1},enableMouseTracking:!1,dataLabels:{enabled:!0,format:"{point.pivotLine}"},dataGrouping:{approximation:"averages"}}),(0,a.extend)(p.prototype,{nameBase:"Pivot Points",pointArrayMap:["R4","R3","R2","R1","P","S1","S2","S3","S4"],pointValKey:"P",pointClass:class extends r{destroyElements(){s(this,"destroyElements")}destroy(){s(this,"destroyElements")}}}),o().registerSeriesType("pivotpoints",p);let d=l();export{d as default};