/**
 * Highstock JS v12.6.0 (2026-04-13)
 * @module highcharts/indicators/indicators
 * @requires highcharts
 * @requires highcharts/modules/stock
 *
 * Indicator series type for Highcharts Stock
 *
 * (c) 2010-2026 Highsoft AS
 * Author: Paweł Fus, Sebastian Bochan
 *
 * A commercial license may be required depending on use.
 * See www.highcharts.com/license
 */import*as t from"../highcharts.js";var e,a={};a.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},a.d=(t,e)=>{for(var n in e)a.o(e,n)&&!a.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let n=t.default;var i=a.n(n);let r=t.default.Chart;var s=a.n(r);let o=t.default.SeriesRegistry;var l=a.n(o);let{doc:p,win:h}=i();function c(t,e,a,n={}){let r="function"==typeof t&&t.prototype||t;Object.hasOwnProperty.call(r,"hcEvents")||(r.hcEvents={});let s=r.hcEvents;i().Point&&t instanceof i().Point&&t.series&&t.series.chart&&(t.series.chart.runTrackerClick=!0);let o=t.addEventListener;o&&o.call(t,e,a,!!i().supportsPassiveEvents&&{passive:void 0===n.passive?-1!==e.indexOf("touch"):n.passive,capture:!1}),s[e]||(s[e]=[]);let l={fn:a,order:"number"==typeof n.order?n.order:1/0};return s[e].push(l),s[e].sort((t,e)=>t.order-e.order),function(){!function(t,e,a){function n(e,a){let n=t.removeEventListener;n&&n.call(t,e,a,!1)}function i(a){let i,r;t.nodeName&&(e?(i={})[e]=!0:i=a,v(i,function(t,e){if(a[e])for(r=a[e].length;r--;)n(e,a[e][r].fn)}))}let r="function"==typeof t&&t.prototype||t;if(Object.hasOwnProperty.call(r,"hcEvents")){let t=r.hcEvents;if(e){let r=t[e]||[];a?(t[e]=r.filter(function(t){return a!==t.fn}),n(e,a)):(i(t),t[e]=[])}else i(t),delete r.hcEvents}}(t,e,a)}}function u(t,e){let a;for(a in t||(t={}),e)t[a]=e[a];return t}function d(t){return y(t)&&"number"==typeof t.nodeType}function f(t){let e=Object.prototype.toString.call(t);return"[object Array]"===e||"[object Array Iterator]"===e}function y(t,e){return!!t&&"object"==typeof t&&(!e||!f(t))}function m(t,...e){let a,n=[t,...e],i={},r=function(t,e){return"object"!=typeof t&&(t={}),v(e,function(a,n){if("__proto__"!==n&&"constructor"!==n){let i;!y(a,!0)||(i=a?.constructor,y(a,!0)&&!d(a)&&i?.name&&"Object"!==i.name)||d(a)?t[n]=e[n]:t[n]=r(t[n]||{},a)}}),t};!0===t&&(i=n[1],n=Array.prototype.slice.call(n,2));let s=n.length;for(a=0;a<s;a++)i=r(i,n[a]);return i}function v(t,e,a){for(let n in t)Object.hasOwnProperty.call(t,n)&&e.call(a||t[n],t[n],n,t)}Array.prototype.find;let{line:x}=l().seriesTypes,g=(t,e)=>{let a=[],n=t.pointArrayMap,i=e&&t.dataTable.getModified()||t.dataTable;if(!n)return t.getColumn("y",e);let r=n.map(a=>t.getColumn(a,e));for(let t=0;t<i.rowCount;t++){let e=n.map((e,a)=>r[a]?.[t]||0);a.push(e)}return a};class D extends x{destroy(){this.dataEventsToUnbind.forEach(function(t){t()}),super.destroy.apply(this,arguments)}getName(){let t=[],e=this.name;return e||((this.nameComponents||[]).forEach(function(e,a){t.push(this.options.params[e]+function(){let t=arguments,e=t.length;for(let a=0;a<e;a++){let e=t[a];if(null!=e)return e}}(this.nameSuffixes[a],""))},this),e=(this.nameBase||this.type.toUpperCase())+(this.nameComponents?" ("+t.join(", ")+")":"")),e}getValues(t,e){let a=e.period,n=t.xData||[],i=t.yData,r=i.length,s=[],o=[],l=[],p,h=-1,c=0,u,d=0;if(!(n.length<a)){for(f(i[0])&&(h=e.index?e.index:0);c<a-1;)d+=h<0?i[c]:i[c][h],c++;for(p=c;p<r;p++)d+=h<0?i[p]:i[p][h],u=[n[p],d/a],s.push(u),o.push(u[0]),l.push(u[1]),d-=h<0?i[p-c]:i[p-c][h];return{values:s,xData:o,yData:l}}}init(t,e){let a=this;super.init.call(a,t,e);let i=c(s(),"afterLinkSeries",function({isUpdating:e}){if(e)return;let i=!!a.dataEventsToUnbind.length;if(!a.linkedParent)return(0,n.error)("Series "+a.options.linkedTo+" not found! Check `linkedTo`.",!1,t);if(!i&&(a.dataEventsToUnbind.push(c(a.linkedParent,"updatedData",function(){a.recalculateValues()})),a.calculateOn.xAxis&&a.dataEventsToUnbind.push(c(a.linkedParent.xAxis,a.calculateOn.xAxis,function(){a.recalculateValues()}))),"init"===a.calculateOn.chart)a.closestPointRange||a.recalculateValues();else if(!i){let t=c(a.chart,a.calculateOn.chart,function(){a.recalculateValues(),t()})}},{order:0});a.dataEventsToUnbind=[],a.eventsToUnbind.push(i)}recalculateValues(){let t=[],e=this.dataTable,a=this.points||[],n=this.dataTable.rowCount,r=!0,s,o,l,h,c=this.linkedParent.yData,d=this.linkedParent.processedYData;this.linkedParent.xData=this.linkedParent.getColumn("x"),this.linkedParent.yData=g(this.linkedParent),this.linkedParent.processedYData=g(this.linkedParent,!0);let y=this.linkedParent.options&&this.linkedParent.dataTable.rowCount&&this.getValues(this.linkedParent,this.options.params)||{values:[],xData:[],yData:[]};delete this.linkedParent.xData,this.linkedParent.yData=c,this.linkedParent.processedYData=d;let m=this.pointArrayMap||["y"],v={};if(y.yData.forEach(t=>{m.forEach((e,a)=>{let n=v[e]||[];n.push(f(t)?t[a]:t),v[e]||(v[e]=n)})}),n&&!this.hasGroupedData&&this.visible&&this.points)if(this.cropped){this.xAxis&&(l=this.xAxis.min,h=this.xAxis.max);let n=this.cropData(e,l,h),i=["x",...this.pointArrayMap||["y"]];for(let e=0;e<(n.modified?.rowCount||0);e++){let a=i.map(t=>this.getColumn(t)[e]||0);t.push(a)}let r=this.getColumn("x");s=y.xData.indexOf(r[0]),o=y.xData.indexOf(r[r.length-1]),-1===s&&o===y.xData.length-2&&t[0][0]===a[0].x&&t.shift(),this.updateData(t)}else(this.updateAllPoints||y.xData.length!==n-1&&y.xData.length!==n+1)&&(r=!1,this.updateData(y.values));r&&(e.setColumns({...v,x:y.xData}),this.options.data=y.values),this.calculateOn.xAxis&&this.getColumn("x",!0).length&&(this.isDirty=!0,this.redraw()),this.isDirtyData=!!this.linkedSeries.length,function(t,e,a,n){if(a=a||{},p?.createEvent&&(t.dispatchEvent||t.fireEvent&&t!==i())){let n=p.createEvent("Events");n.initEvent(e,!0,!0),a=u(n,a),t.dispatchEvent?t.dispatchEvent(a):t.fireEvent(e,a)}else if(t.hcEvents){a.target||u(a,{preventDefault:function(){a.defaultPrevented=!0},target:t,type:e});let n=[],i=t,r=!1;for(;i.hcEvents;)Object.hasOwnProperty.call(i,"hcEvents")&&i.hcEvents[e]&&(n.length&&(r=!0),n.unshift.apply(n,i.hcEvents[e])),i=Object.getPrototypeOf(i);r&&n.sort((t,e)=>t.order-e.order),n.forEach(e=>{!1===e.fn.call(t,a,t)&&a.preventDefault()})}}(this,"updatedData")}processData(){let t=this.options.compareToMain,e=this.linkedParent;super.processData.apply(this,arguments),this.dataModify&&e&&e.dataModify&&e.dataModify.compareValue&&t&&(this.dataModify.compareValue=e.dataModify.compareValue)}}D.defaultOptions=m(x.defaultOptions,{name:void 0,tooltip:{valueDecimals:4},linkedTo:void 0,compareToMain:!1,params:{index:3,period:14}}),u(D.prototype,{calculateOn:{chart:"init"},hasDerivedData:!0,nameComponents:["period"],nameSuffixes:[],useCommonDataGrouping:!0}),l().registerSeriesType("sma",D);let{sma:P}=l().seriesTypes;class E extends P{accumulatePeriodPoints(t,e,a){let n=0,i=0;for(;i<t;)n+=e<0?a[i]:a[i][e],i++;return n}calculateEma(t,e,a,n,i,r,s){var o;let l=t[a-1],p=r<0?e[a-1]:e[a-1][r];return[l,void 0===i?s:(o=p*n+i*(1-n))>1e14?o:parseFloat(o.toPrecision(14))]}getValues(t,e){let a=e.period,n=t.xData,i=t.yData,r=i?i.length:0,s=2/(a+1),o=[],l=[],p=[],h,c,u,d=-1,y=0;if(!(r<a)){for(f(i[0])&&(d=e.index?e.index:0),y=this.accumulatePeriodPoints(a,d,i)/a,u=a;u<r+1;u++)c=this.calculateEma(n,i,u,s,h,d,y),o.push(c),l.push(c[0]),p.push(c[1]),h=c[1];return{values:o,xData:l,yData:p}}}}E.defaultOptions=m(P.defaultOptions,{params:{index:3,period:9}}),l().registerSeriesType("ema",E);let{sma:{prototype:O}}=l().seriesTypes;!function(t){let e=["bottomLine"],a=["top","bottom"],i=["top"];function r(t){return"plot"+t.charAt(0).toUpperCase()+t.slice(1)}function s(t,e){let a=[];return(t.pointArrayMap||[]).forEach(t=>{t!==e&&a.push(r(t))}),a}function o(){let t=this,e=t.pointValKey,a=t.linesApiNames,i=t.areaLinesNames,o=t.points,l=t.options,p=t.graph,h={options:{gapSize:l.gapSize}},c=[],u=s(t,e),d=o.length,f;if(u.forEach((t,e)=>{for(c[e]=[];d--;)f=o[d],c[e].push({x:f.x,plotX:f.plotX,plotY:f[t],isNull:null==f[t]});d=o.length}),t.userOptions.fillColor&&i.length){let e=c[u.indexOf(r(i[0]))],a=1===i.length?o:c[u.indexOf(r(i[1]))],n=t.color;t.points=a,t.nextPoints=e,t.color=t.userOptions.fillColor,t.options=m(o,h),t.graph=t.area,t.fillGraph=!0,O.drawGraph.call(t),t.area=t.graph,delete t.nextPoints,delete t.fillGraph,t.color=n}a.forEach((e,a)=>{c[a]?(t.points=c[a],l[e]?t.options=m(l[e].styles,h):(0,n.error)('Error: "There is no '+e+' in DOCS options declared. Check if linesApiNames are consistent with your DOCS line names."'),t.graph=t["graph"+e],O.drawGraph.call(t),t["graph"+e]=t.graph):(0,n.error)('Error: "'+e+" doesn't have equivalent in pointArrayMap. To many elements in linesApiNames relative to pointArrayMap.\"")}),t.points=o,t.options=l,t.graph=p,O.drawGraph.call(t)}function l(t){let e,a=[],n=[];if(t=t||this.points,this.fillGraph&&this.nextPoints){if((e=O.getGraphPath.call(this,this.nextPoints))&&e.length){e[0][0]="L",a=O.getGraphPath.call(this,t),n=e.slice(0,a.length);for(let t=n.length-1;t>=0;t--)a.push(n[t])}}else a=O.getGraphPath.apply(this,arguments);return a}function p(t){let e=[];return(this.pointArrayMap||[]).forEach(a=>{e.push(t[a])}),e}function h(){let t=this.pointArrayMap,e=[],a;e=s(this),O.translate.apply(this,arguments),this.points.forEach(n=>{t.forEach((t,i)=>{a=n[t],this.dataModify&&(a=this.dataModify.modifyValue(a)),null!==a&&(n[e[i]]=this.yAxis.toPixels(a,!0))})})}t.compose=function(t){let n=t.prototype;return n.linesApiNames=n.linesApiNames||e.slice(),n.pointArrayMap=n.pointArrayMap||a.slice(),n.pointValKey=n.pointValKey||"top",n.areaLinesNames=n.areaLinesNames||i.slice(),n.drawGraph=o,n.getGraphPath=l,n.toYData=p,n.translate=h,t}}(e||(e={}));let b=e,A=i();A.MultipleLinesComposition=A.MultipleLinesComposition||b;let k=i();export{k as default};