/**
 * Highstock JS v12.5.0 (2026-01-12)
 * @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 o=t.default.SeriesRegistry;var n=e.n(o);let r=n().seriesTypes.sma.prototype.pointClass;function s(t,e){let a=t.series.pointArrayMap,l,o=a.length;for(n().seriesTypes.sma.prototype.pointClass.prototype[e].call(t);o--;)t[l="dataLabel"+a[o]]&&t[l].element&&t[l].destroy(),t[l]=null}let{sma:i}=n().seriesTypes,{merge:p,extend:d,defined:u,isArray:h}=l();class c extends i{toYData(t){return[t.P]}translate(){let t=this;super.translate.apply(t),t.points.forEach(function(e){t.pointArrayMap.forEach(function(a){u(e[a])&&(e["plot"+a]=t.yAxis.toPixels(e[a],!0))})}),t.plotEndPoint=t.xAxis.toPixels(t.endPoint,!0)}getGraphPath(t){let e=this,a=[[],[],[],[],[],[],[],[],[]],l=e.pointArrayMap.length,o=e.plotEndPoint,n=[],r,s,i=t.length,p;for(;i--;){for(p=0,s=t[i];p<l;p++)u(s[r=e.pointArrayMap[p]])&&a[p].push({plotX:s.plotX,plotY:s["plot"+r],isNull:!1},{plotX:o,plotY:s["plot"+r],isNull:!1},{plotX:o,plotY:null,isNull:!0});o=s.plotX}return a.forEach(t=>{n=n.concat(super.getGraphPath.call(e,t))}),n}drawDataLabels(){let t,e,a,l,o=this,n=o.pointArrayMap;o.options.dataLabels.enabled&&(e=o.points.length,n.concat([!1]).forEach((r,s)=>{for(l=e;l--;)a=o.points[l],r?(a.y=a[r],a.pivotLine=r,a.plotY=a["plot"+r],t=a["dataLabel"+r],s&&(a["dataLabel"+n[s-1]]=a.dataLabel),a.dataLabels||(a.dataLabels=[]),a.dataLabels[0]=a.dataLabel=t=t&&t.element?t:null):a["dataLabel"+n[s-1]]=a.dataLabel;super.drawDataLabels.call(o)}))}getValues(t,e){let a,l,o,n,r,s,i,p=e.period,d=t.xData,u=t.yData,c=u?u.length:0,y=this[e.algorithm+"Placement"],f=[],m=[],g=[];if(!(d.length<p)&&h(u[0])&&4===u[0].length){for(i=p+1;i<=c+p;i+=p)o=d.slice(i-p-1,i),n=u.slice(i-p-1,i),l=o.length,a=o[l-1],s=y(this.getPivotAndHLC(n)),r=f.push([a].concat(s)),m.push(a),g.push(f[r-1].slice(1));return this.endPoint=o[0]+(a-o[0])/l*p,{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]}}c.defaultOptions=p(i.defaultOptions,{params:{index:void 0,period:28,algorithm:"standard"},marker:{enabled:!1},enableMouseTracking:!1,dataLabels:{enabled:!0,format:"{point.pivotLine}"},dataGrouping:{approximation:"averages"}}),d(c.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")}}}),n().registerSeriesType("pivotpoints",c);let y=l();export{y as default};