ohlcv-indicators 2.1.5 → 2.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- var OHLCV_INDICATORS;(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};(()=>{function r(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var o=0,i=function(){};return{s:i,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){c=!0,a=t},f:function(){try{u||null==r.return||r.return()}finally{if(c)throw a}}}}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}t.r(e),t.d(e,{default:()=>We});var o=function(t){return"string"==typeof t&&/^\d{4}-\d{2}-\d{2}/.test(t)},i=function(t){if(0!==t.lastComputedIndex)throw Error('ohlcv is already computed, you can not add new indicators after "compute", "getLastValues" , "getDataAsCols" or "getData" methods are called.')},a=1e6,u="[big.js] ",c=u+"Invalid ",l=c+"decimal places",s=c+"rounding mode",f=u+"Division by zero",h={},p=void 0,y=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function v(t,e,r,n){var o=t.c;if(r===p&&(r=t.constructor.RM),0!==r&&1!==r&&2!==r&&3!==r)throw Error(s);if(e<1)n=3===r&&(n||!!o[0])||0===e&&(1===r&&o[0]>=5||2===r&&(o[0]>5||5===o[0]&&(n||o[1]!==p))),o.length=1,n?(t.e=t.e-e+1,o[0]=1):o[0]=t.e=0;else if(e<o.length){if(n=1===r&&o[e]>=5||2===r&&(o[e]>5||5===o[e]&&(n||o[e+1]!==p||1&o[e-1]))||3===r&&(n||!!o[0]),o.length=e,n)for(;++o[--e]>9;)if(o[e]=0,0===e){++t.e,o.unshift(1);break}for(e=o.length;!o[--e];)o.pop()}return t}function d(t,e,r){var n=t.e,o=t.c.join(""),i=o.length;if(e)o=o.charAt(0)+(i>1?"."+o.slice(1):"")+(n<0?"e":"e+")+n;else if(n<0){for(;++n;)o="0"+o;o="0."+o}else if(n>0)if(++n>i)for(n-=i;n--;)o+="0";else n<i&&(o=o.slice(0,n)+"."+o.slice(n));else i>1&&(o=o.charAt(0)+"."+o.slice(1));return t.s<0&&r?"-"+o:o}function b(t){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},b(t)}function m(t){var e="function"==typeof Map?new Map:void 0;return m=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return function(t,e,r){if(g())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&w(o,r.prototype),o}(t,arguments,O(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),w(r,t)},m(t)}function g(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(g=function(){return!!t})()}function w(t,e){return w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},w(t,e)}function O(t){return O=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},O(t)}h.abs=function(){var t=new this.constructor(this);return t.s=1,t},h.cmp=function(t){var e,r=this,n=r.c,o=(t=new r.constructor(t)).c,i=r.s,a=t.s,u=r.e,c=t.e;if(!n[0]||!o[0])return n[0]?i:o[0]?-a:0;if(i!=a)return i;if(e=i<0,u!=c)return u>c^e?1:-1;for(a=(u=n.length)<(c=o.length)?u:c,i=-1;++i<a;)if(n[i]!=o[i])return n[i]>o[i]^e?1:-1;return u==c?0:u>c^e?1:-1},h.div=function(t){var e=this,r=e.constructor,n=e.c,o=(t=new r(t)).c,i=e.s==t.s?1:-1,u=r.DP;if(u!==~~u||u<0||u>a)throw Error(l);if(!o[0])throw Error(f);if(!n[0])return t.s=i,t.c=[t.e=0],t;var c,s,h,y,d,b=o.slice(),m=c=o.length,g=n.length,w=n.slice(0,c),O=w.length,S=t,_=S.c=[],j=0,A=u+(S.e=e.e-t.e)+1;for(S.s=i,i=A<0?0:A,b.unshift(0);O++<c;)w.push(0);do{for(h=0;h<10;h++){if(c!=(O=w.length))y=c>O?1:-1;else for(d=-1,y=0;++d<c;)if(o[d]!=w[d]){y=o[d]>w[d]?1:-1;break}if(!(y<0))break;for(s=O==c?o:b;O;){if(w[--O]<s[O]){for(d=O;d&&!w[--d];)w[d]=9;--w[d],w[O]+=10}w[O]-=s[O]}for(;!w[0];)w.shift()}_[j++]=y?h:++h,w[0]&&y?w[O]=n[m]||0:w=[n[m]]}while((m++<g||w[0]!==p)&&i--);return _[0]||1==j||(_.shift(),S.e--,A--),j>A&&v(S,A,r.RM,w[0]!==p),S},h.eq=function(t){return 0===this.cmp(t)},h.gt=function(t){return this.cmp(t)>0},h.gte=function(t){return this.cmp(t)>-1},h.lt=function(t){return this.cmp(t)<0},h.lte=function(t){return this.cmp(t)<1},h.minus=h.sub=function(t){var e,r,n,o,i=this,a=i.constructor,u=i.s,c=(t=new a(t)).s;if(u!=c)return t.s=-c,i.plus(t);var l=i.c.slice(),s=i.e,f=t.c,h=t.e;if(!l[0]||!f[0])return f[0]?t.s=-c:l[0]?t=new a(i):t.s=1,t;if(u=s-h){for((o=u<0)?(u=-u,n=l):(h=s,n=f),n.reverse(),c=u;c--;)n.push(0);n.reverse()}else for(r=((o=l.length<f.length)?l:f).length,u=c=0;c<r;c++)if(l[c]!=f[c]){o=l[c]<f[c];break}if(o&&(n=l,l=f,f=n,t.s=-t.s),(c=(r=f.length)-(e=l.length))>0)for(;c--;)l[e++]=0;for(c=e;r>u;){if(l[--r]<f[r]){for(e=r;e&&!l[--e];)l[e]=9;--l[e],l[r]+=10}l[r]-=f[r]}for(;0===l[--c];)l.pop();for(;0===l[0];)l.shift(),--h;return l[0]||(t.s=1,l=[h=0]),t.c=l,t.e=h,t},h.mod=function(t){var e,r=this,n=r.constructor,o=r.s,i=(t=new n(t)).s;if(!t.c[0])throw Error(f);return r.s=t.s=1,e=1==t.cmp(r),r.s=o,t.s=i,e?new n(r):(o=n.DP,i=n.RM,n.DP=n.RM=0,r=r.div(t),n.DP=o,n.RM=i,this.minus(r.times(t)))},h.neg=function(){var t=new this.constructor(this);return t.s=-t.s,t},h.plus=h.add=function(t){var e,r,n,o=this,i=o.constructor;if(t=new i(t),o.s!=t.s)return t.s=-t.s,o.minus(t);var a=o.e,u=o.c,c=t.e,l=t.c;if(!u[0]||!l[0])return l[0]||(u[0]?t=new i(o):t.s=o.s),t;if(u=u.slice(),e=a-c){for(e>0?(c=a,n=l):(e=-e,n=u),n.reverse();e--;)n.push(0);n.reverse()}for(u.length-l.length<0&&(n=l,l=u,u=n),e=l.length,r=0;e;u[e]%=10)r=(u[--e]=u[e]+l[e]+r)/10|0;for(r&&(u.unshift(r),++c),e=u.length;0===u[--e];)u.pop();return t.c=u,t.e=c,t},h.pow=function(t){var e=this,r=new e.constructor("1"),n=r,o=t<0;if(t!==~~t||t<-1e6||t>1e6)throw Error(c+"exponent");for(o&&(t=-t);1&t&&(n=n.times(e)),t>>=1;)e=e.times(e);return o?r.div(n):n},h.prec=function(t,e){if(t!==~~t||t<1||t>a)throw Error(c+"precision");return v(new this.constructor(this),t,e)},h.round=function(t,e){if(t===p)t=0;else if(t!==~~t||t<-a||t>a)throw Error(l);return v(new this.constructor(this),t+this.e+1,e)},h.sqrt=function(){var t,e,r,n=this,o=n.constructor,i=n.s,a=n.e,c=new o("0.5");if(!n.c[0])return new o(n);if(i<0)throw Error(u+"No square root");0===(i=Math.sqrt(n+""))||i===1/0?((e=n.c.join("")).length+a&1||(e+="0"),a=((a+1)/2|0)-(a<0||1&a),t=new o(((i=Math.sqrt(e))==1/0?"5e":(i=i.toExponential()).slice(0,i.indexOf("e")+1))+a)):t=new o(i+""),a=t.e+(o.DP+=4);do{r=t,t=c.times(r.plus(n.div(r)))}while(r.c.slice(0,a).join("")!==t.c.slice(0,a).join(""));return v(t,(o.DP-=4)+t.e+1,o.RM)},h.times=h.mul=function(t){var e,r=this,n=r.constructor,o=r.c,i=(t=new n(t)).c,a=o.length,u=i.length,c=r.e,l=t.e;if(t.s=r.s==t.s?1:-1,!o[0]||!i[0])return t.c=[t.e=0],t;for(t.e=c+l,a<u&&(e=o,o=i,i=e,l=a,a=u,u=l),e=new Array(l=a+u);l--;)e[l]=0;for(c=u;c--;){for(u=0,l=a+c;l>c;)u=e[l]+i[c]*o[l-c-1]+u,e[l--]=u%10,u=u/10|0;e[l]=u}for(u?++t.e:e.shift(),c=e.length;!e[--c];)e.pop();return t.c=e,t},h.toExponential=function(t,e){var r=this,n=r.c[0];if(t!==p){if(t!==~~t||t<0||t>a)throw Error(l);for(r=v(new r.constructor(r),++t,e);r.c.length<t;)r.c.push(0)}return d(r,!0,!!n)},h.toFixed=function(t,e){var r=this,n=r.c[0];if(t!==p){if(t!==~~t||t<0||t>a)throw Error(l);for(t=t+(r=v(new r.constructor(r),t+r.e+1,e)).e+1;r.c.length<t;)r.c.push(0)}return d(r,!1,!!n)},h[Symbol.for("nodejs.util.inspect.custom")]=h.toJSON=h.toString=function(){var t=this,e=t.constructor;return d(t,t.e<=e.NE||t.e>=e.PE,!!t.c[0])},h.toNumber=function(){var t=Number(d(this,!0,!0));if(!0===this.constructor.strict&&!this.eq(t.toString()))throw Error(u+"Imprecise conversion");return t},h.toPrecision=function(t,e){var r=this,n=r.constructor,o=r.c[0];if(t!==p){if(t!==~~t||t<1||t>a)throw Error(c+"precision");for(r=v(new n(r),t,e);r.c.length<t;)r.c.push(0)}return d(r,t<=r.e||r.e<=n.NE||r.e>=n.PE,!!o)},h.valueOf=function(){var t=this,e=t.constructor;if(!0===e.strict)throw Error(u+"valueOf disallowed");return d(t,t.e<=e.NE||t.e>=e.PE,!0)},function t(){function e(r){var n=this;if(!(n instanceof e))return r===p?t():new e(r);if(r instanceof e)n.s=r.s,n.e=r.e,n.c=r.c.slice();else{if("string"!=typeof r){if(!0===e.strict&&"bigint"!=typeof r)throw TypeError(c+"value");r=0===r&&1/r<0?"-0":String(r)}!function(t,e){var r,n,o;if(!y.test(e))throw Error(c+"number");for(t.s="-"==e.charAt(0)?(e=e.slice(1),-1):1,(r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),o=e.length,n=0;n<o&&"0"==e.charAt(n);)++n;if(n==o)t.c=[t.e=0];else{for(;o>0&&"0"==e.charAt(--o););for(t.e=r-n-1,t.c=[],r=0;n<=o;)t.c[r++]=+e.charAt(n++)}}(n,r)}n.constructor=e}return e.prototype=h,e.DP=20,e.RM=1,e.NE=-7,e.PE=21,e.strict=!1,e.roundDown=0,e.roundHalfUp=1,e.roundHalfEven=2,e.roundUp=3,e}();var S=function(t){function e(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Not enough data";return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),t=function(t,e,r){return e=O(e),function(t,e){if(e&&("object"==b(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,g()?Reflect.construct(e,r||[],O(t).constructor):e.apply(t,r))}(this,e,[r]),Object.setPrototypeOf(t,(this instanceof e?this.constructor:void 0).prototype),t.name="NotEnoughDataError",t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&w(t,e)}(e,t),r=e,Object.defineProperty(r,"prototype",{writable:!1}),r;var r}(m(Error));function _(t){return _="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_(t)}function j(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,P(n.key),n)}}function A(t,e,r){return(e=P(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function P(t){var e=function(t,e){if("object"!=_(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=_(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==_(e)?e:e+""}var E=function(){return t=function t(){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),A(this,"previousHighest",void 0),A(this,"highest",void 0),A(this,"previousLowest",void 0),A(this,"lowest",void 0),A(this,"previousResult",void 0),A(this,"result",void 0)},(e=[{key:"isStable",get:function(){return void 0!==this.result}},{key:"getResult",value:function(){if(void 0===this.result)throw new S;return this.result}},{key:"setResult",value:function(t,e){return e&&(this.highest=this.previousHighest,this.lowest=this.previousLowest,this.result=this.previousResult),void 0===this.highest?this.highest=t:t>this.highest?(this.previousHighest=this.highest,this.highest=t):this.previousHighest=this.highest,void 0===this.lowest?this.lowest=t:t<this.lowest?(this.previousLowest=this.lowest,this.lowest=t):this.previousLowest=this.lowest,this.previousResult=this.result,this.result=t}},{key:"replace",value:function(t){return this.update(t,!0)}}])&&j(t.prototype,e),r&&j(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function k(t){return k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},k(t)}function T(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,C(n.key),n)}}function I(t,e,r){return e=M(e),function(t,e){if(e&&("object"==k(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,x()?Reflect.construct(e,r||[],M(t).constructor):e.apply(t,r))}function x(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(x=function(){return!!t})()}function M(t){return M=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},M(t)}function R(t,e){return R=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},R(t,e)}function C(t){var e=function(t,e){if("object"!=k(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=k(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==k(e)?e:e+""}var D=function(t){function e(t){var r,n,o,i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=r=I(this,e),i=void 0,(o=C(o="interval"))in n?Object.defineProperty(n,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[o]=i,r.interval=t,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&R(t,e)}(e,t),r=e,(n=[{key:"updates",value:function(t){var e=this;return t.forEach((function(t){return e.update(t)})),this.result}},{key:"replace",value:function(t){return this.update(t,!0)}}])&&T(r.prototype,n),o&&T(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(E);function B(t){return B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},B(t)}function L(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,N(n.key),n)}}function V(t,e,r){return e=z(e),function(t,e){if(e&&("object"==B(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,H()?Reflect.construct(e,r||[],z(t).constructor):e.apply(t,r))}function H(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(H=function(){return!!t})()}function z(t){return z=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},z(t)}function U(t,e){return U=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},U(t,e)}function N(t){var e=function(t,e){if("object"!=B(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=B(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==B(e)?e:e+""}var $=function(t){function e(){var t,r,n,o;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);for(var i=arguments.length,a=new Array(i),u=0;u<i;u++)a[u]=arguments[u];return r=t=V(this,e,[].concat(a)),o=[],(n=N(n="prices"))in r?Object.defineProperty(r,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[n]=o,t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&U(t,e)}(e,t),r=e,n=[{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.prices.length&&e?this.prices[this.prices.length-1]=t:this.prices.push(t),this.prices.length>this.interval&&this.prices.shift(),this.prices.length===this.interval){var r=this.prices.reduce((function(t,e){return t+e}),0);return this.setResult(r/this.prices.length,e)}}}],n&&L(r.prototype,n),o&&L(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(D);function F(t){return F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},F(t)}function q(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Q(n.key),n)}}function G(t,e,r){return e=K(e),function(t,e){if(e&&("object"==F(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,J()?Reflect.construct(e,r||[],K(t).constructor):e.apply(t,r))}function J(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(J=function(){return!!t})()}function K(t){return K=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},K(t)}function Y(t,e){return Y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Y(t,e)}function W(t,e,r){return(e=Q(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Q(t){var e=function(t,e){if("object"!=F(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=F(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==F(e)?e:e+""}var X=function(t){function e(t){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),W(r=G(this,e),"interval",void 0),W(r,"indicator",void 0),W(r,"smoothingFactor",void 0),r.interval=t,r.indicator=new $(t),r.smoothingFactor=1/r.interval,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Y(t,e)}(e,t),r=e,n=[{key:"updates",value:function(t){var e=this;return t.forEach((function(t){return e.update(t)})),this.result}},{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.indicator.update(t);if(e&&void 0!==this.previousResult){var n=(t-this.previousResult)*this.smoothingFactor;return this.setResult(n+this.previousResult,e)}if(!e&&void 0!==this.result){var o=(t-this.result)*this.smoothingFactor;return this.setResult(o+this.result,e)}if(void 0===this.result&&void 0!==r)return this.setResult(r,e)}}],n&&q(r.prototype,n),o&&q(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(E);function Z(t){return t.length?t.reduce((function(t,e){return t+e}),0)/t.length:0}function tt(t){return tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tt(t)}function et(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,nt(n.key),n)}}function rt(t,e,r){return(e=nt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function nt(t){var e=function(t,e){if("object"!=tt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=tt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==tt(e)?e:e+""}var ot=function(){return t=function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),rt(this,"interval",void 0),rt(this,"deviationMultiplier",void 0),rt(this,"prices",[]),rt(this,"result",void 0),this.interval=e,this.deviationMultiplier=r},(e=[{key:"update",value:function(t){if(this.prices.push(t),this.prices.length>this.interval){this.prices.shift();var e=Z(this.prices),r=function(t,e){var r=e||Z(t),n=Z(t.map((function(t){return t-r})).map((function(t){return t*t})));return Math.sqrt(n)}(this.prices,e);return this.result={lower:e-r*this.deviationMultiplier,middle:e,upper:e+r*this.deviationMultiplier}}}},{key:"getResult",value:function(){if(void 0===this.result)throw new S;return this.result}},{key:"isStable",get:function(){return void 0!==this.result}}])&&et(t.prototype,e),r&&et(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function it(t){return it="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},it(t)}function at(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ht(n.key),n)}}function ut(t,e,r){return e=lt(e),function(t,e){if(e&&("object"==it(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ct()?Reflect.construct(e,r||[],lt(t).constructor):e.apply(t,r))}function ct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ct=function(){return!!t})()}function lt(t){return lt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},lt(t)}function st(t,e){return st=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},st(t,e)}function ft(t,e,r){return(e=ht(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ht(t){var e=function(t,e){if("object"!=it(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=it(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==it(e)?e:e+""}var pt=function(t){function e(t){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ft(r=ut(this,e,[t]),"interval",void 0),ft(r,"pricesCounter",0),ft(r,"weightFactor",void 0),r.interval=t,r.weightFactor=2/(r.interval+1),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&st(t,e)}(e,t),r=e,n=[{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e?e&&0===this.pricesCounter&&this.pricesCounter++:this.pricesCounter++,e&&void 0!==this.previousResult?this.setResult(t*this.weightFactor+this.previousResult*(1-this.weightFactor),e):this.setResult(t*this.weightFactor+(void 0!==this.result?this.result:t)*(1-this.weightFactor),e)}},{key:"getResult",value:function(){if(this.pricesCounter<this.interval)throw new S;return this.result}},{key:"isStable",get:function(){try{return this.getResult(),!0}catch(t){return!1}}}],n&&at(r.prototype,n),o&&at(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(D);function yt(t){return yt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yt(t)}function vt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,bt(n.key),n)}}function dt(t,e,r){return(e=bt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function bt(t){var e=function(t,e){if("object"!=yt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=yt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==yt(e)?e:e+""}var mt=function(){return t=function t(e,r,n){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),dt(this,"short",void 0),dt(this,"long",void 0),dt(this,"signal",void 0),dt(this,"prices",[]),dt(this,"result",void 0),this.short=e,this.long=r,this.signal=n},e=[{key:"getResult",value:function(){if(void 0===this.result)throw new S;return this.result}},{key:"isStable",get:function(){return void 0!==this.result}},{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.prices.length&&e?this.prices[this.prices.length-1]=t:this.prices.push(t);var r=this.short.update(t,e),n=this.long.update(t,e);if(this.prices.length>this.long.interval&&this.prices.shift(),this.prices.length===this.long.interval){var o=r-n,i=this.signal.update(o,e);return this.result={histogram:o-i,macd:o,signal:i}}}}],e&&vt(t.prototype,e),r&&vt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function gt(t){return gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gt(t)}function wt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Pt(n.key),n)}}function Ot(t,e,r){return e=_t(e),function(t,e){if(e&&("object"==gt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,St()?Reflect.construct(e,r||[],_t(t).constructor):e.apply(t,r))}function St(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(St=function(){return!!t})()}function _t(t){return _t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_t(t)}function jt(t,e){return jt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},jt(t,e)}function At(t,e,r){return(e=Pt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Pt(t){var e=function(t,e){if("object"!=gt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=gt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==gt(e)?e:e+""}var Et=function(t){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:X;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),At(r=Ot(this,e),"interval",void 0),At(r,"previousPrices",[]),At(r,"avgGain",void 0),At(r,"avgLoss",void 0),At(r,"maxValue",100),r.interval=t,r.avgGain=new n(r.interval),r.avgLoss=new n(r.interval),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&jt(t,e)}(e,t),r=e,n=[{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.previousPrices.length&&e?this.previousPrices[this.previousPrices.length-1]=t:this.previousPrices.push(t),!(this.previousPrices.length<2)){var r=t,n=this.previousPrices[this.previousPrices.length-2];if(r>n?(this.avgLoss.update(0,e),this.avgGain.update(t-n,e)):(this.avgLoss.update(n-r,e),this.avgGain.update(0,e)),this.avgGain.isStable){var o=this.avgLoss.getResult();if(0===o)return this.setResult(100,e);var i=this.avgGain.getResult()/o;return this.setResult(this.maxValue-this.maxValue/(i+1),e)}}}}],n&&wt(r.prototype,n),o&&wt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(E);function kt(t){return kt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kt(t)}function Tt(t){return function(t){if(Array.isArray(t))return It(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return It(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?It(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function It(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function xt(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=kt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=kt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==kt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Mt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Rt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Ct(t){return Ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ct(t)}function Dt(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=Ct(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ct(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ct(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Bt(t){return function(t){if(Array.isArray(t))return Lt(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Lt(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Lt(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Lt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Vt(t){return Vt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vt(t)}function Ht(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function zt(t){return zt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zt(t)}function Ut(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=$t(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function Nt(t){return function(t){if(Array.isArray(t))return Ft(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||$t(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $t(t,e){if(t){if("string"==typeof t)return Ft(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ft(t,e):void 0}}function Ft(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function qt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Gt(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=zt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=zt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==zt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Jt(t){return Jt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jt(t)}function Kt(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Wt(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function Yt(t){return function(t){if(Array.isArray(t))return Qt(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Wt(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Wt(t,e){if(t){if("string"==typeof t)return Qt(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Qt(t,e):void 0}}function Qt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Xt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Zt(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=Jt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Jt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Jt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function te(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var ee=function(t,e){var r=t.value,n=t.positive,o=void 0===n||n;if(null==r||null==e)return null;var i=e.upper,a=e.middle,u=e.lower;if(r<u)return 0;if(r>i)return o?1:-1;var c=Number.EPSILON*Math.max(Math.abs(r),Math.abs(a));if(Math.abs(r-a)<c)return o?.5:-.5;if(i===u)return null;var l=(r-u)/(i-u),s=Math.round(10*l)/10;return o?s:-s};function re(t){return function(t){if(Array.isArray(t))return ne(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return ne(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ne(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ne(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var oe=function(t,e){var r=t-e;return{value:Math.abs(r),positive:r>=0}};function ie(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||ue(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ae(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=ue(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function ue(t,e){if(t){if("string"==typeof t)return ce(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ce(t,e):void 0}}function ce(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function le(t){return le="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},le(t)}var se=function(t,e){if(0===e){var r=t.inputParams.filter((function(t){return"lag"===t.key}));if("object"!==le(r))return;var n,o=r.map((function(t){return t.params})),i=ae(o);try{for(i.s();!(n=i.n()).done;){var a,u=ie(n.value,2),c=u[0],l=u[1],s=ae(c);try{for(s.s();!(a=s.n()).done;){var f=a.value;if(t.priceBased.includes(f))for(var h=1;h<=l;h++)t.priceBased.push("".concat(f,"_lag_").concat(h))}}catch(t){s.e(t)}finally{s.f()}}}catch(t){i.e(t)}finally{i.f()}t.instances.lag={lagParams:o}}var p,y,v=ae(t.instances.lag.lagParams);try{for(v.s();!(p=v.n()).done;){var d,b=ie(p.value,2),m=b[0],g=b[1],w=ae(m);try{for(w.s();!(d=w.n()).done;){var O=d.value,S=t.verticalOhlcv[O];if(0===e)for(var _=1;_<=g;_++){var j="".concat(O,"_lag_").concat(_);t.verticalOhlcv[j]=function(t){if(Array.isArray(t))return ce(t)}(y=t.nullArray)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(y)||ue(y)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}for(var A=1;A<=g;A++){var P="".concat(O,"_lag_").concat(A),E=e-A;if(E<=0)break;t.pushToMain({index:e,key:P,value:S[E]})}}}catch(t){w.e(t)}finally{w.f()}}}catch(t){v.e(t)}finally{v.f()}return!0};function fe(t,e){if(t){if("string"==typeof t)return he(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?he(t,e):void 0}}function he(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function pe(t){return pe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pe(t)}function ye(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ve(n.key),n)}}function ve(t){var e=function(t,e){if("object"!=pe(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=pe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==pe(e)?e:e+""}var de=function(t,e){return t>e},be=function(t,e){return t<e},me=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Object.assign(this,{interval:0,prevState:.5,prevFast:null,prevSlow:null,prevHigh:null,prevLow:null,areHighAndLowUndefined:!1,index:0,crossIndexes:{up:[],down:[]}})},(e=[{key:"update",value:function(t){var e=t.fast,r=t.high,n=t.slow,o=t.low,i=this.prevState;this.areHighAndLowUndefined||void 0!==r&&void 0!==o||(this.areHighAndLowUndefined=!0),null===e||null===n||function(t,e){return t===e}(e,n)?i=.5:de(e,n)?i=this.areHighAndLowUndefined?1:[o,n,this.prevLow,this.prevSlow].every((function(t){return null!==t}))&&be(o,n)&&de(this.prevLow,this.prevSlow)?0:1:be(e,n)&&(i=this.areHighAndLowUndefined?0:[r,n,this.prevHigh,this.prevSlow].every((function(t){return null!==t}))&&de(r,n)&&be(this.prevHigh,this.prevSlow)?1:0),.5===i?this.interval=0:1===i?this.prevState<=.5?this.interval=1:this.interval++:0===i&&(this.prevState>=.5?this.interval=-1:this.interval--),1===this.interval&&this.crossIndexes.up.push(this.index),-1===this.interval&&this.crossIndexes.down.push(this.index),Object.assign(this,{index:this.index+1,prevState:i,prevFast:e,prevSlow:n,prevHigh:r,prevLow:o})}},{key:"getResult",value:function(){return this.interval}}])&&ye(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}(),ge=function(t,e){if(0===e){var r=t.inputParams.filter((function(t){return"crossPairs"===t.key}));if("object"!==pe(r))return;t.instances.crossPairs={crossPairsList:r.flatMap((function(t){return t.params.flat()}))}}var n,o,i=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=fe(t))){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}(t.instances.crossPairs.crossPairsList);try{for(i.s();!(n=i.n()).done;){var a=n.value,u=a.fast,c=a.slow;if(u&&c){var l="".concat(u,"_x_").concat(c);if(0===e){if("number"==typeof c&&(t.verticalOhlcv[c]=new Array(t.len).fill(c)),"price"!==u&&!t.verticalOhlcv.hasOwnProperty(u))throw Error('fast "'.concat(u,' not found in crossPairs"'));if(!t.verticalOhlcv.hasOwnProperty(c))throw Error('slow "'.concat(c,' not found in crossPairs"'));t.instances[l]=new me,t.verticalOhlcv[l]=function(t){if(Array.isArray(t))return he(t)}(o=t.nullArray)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(o)||fe(o)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var s=void 0,f=void 0,h=void 0,p=void 0,y=void 0;"price"===u?(f=t.verticalOhlcv.close[e],h=t.verticalOhlcv.high[e],p=t.verticalOhlcv.low[e],y=t.verticalOhlcv[c][e],t.instances[l].update({fast:f,slow:y,high:h,low:p})):(s=t.verticalOhlcv[u][e],y=t.verticalOhlcv[c][e],t.instances[l].update({fast:s,slow:y})),t.pushToMain({index:e,key:l,value:t.instances[l].getResult()})}}}catch(t){i.e(t)}finally{i.f()}};function we(t){return function(t){if(Array.isArray(t))return Oe(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Oe(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Oe(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Oe(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Se(t){return function(t){if(Array.isArray(t))return _e(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return _e(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_e(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _e(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var je=["open","high","low","close","volume"];function Ae(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=ke(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function Pe(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.includes(n))continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],e.includes(r)||{}.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function Ee(t){return function(t){if(Array.isArray(t))return Te(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||ke(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ke(t,e){if(t){if("string"==typeof t)return Te(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Te(t,e):void 0}}function Te(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var Ie=function(t){return t.replace(/(?!^-)[^0-9.]/g,"")},xe={dateTime:function(t,e){if(0===e){if(!t.isValidDate)throw Error('dateTime method found and invalid "date" in input ohlcv');var r=t.verticalOhlcv.date[0].slice(0,10);Object.assign(t.instances,{dateTime:{prevDateStr:r,sessionDailyIndexCount:0,sessionIntradayIndexCount:0,cachedDayInfo:r}}),Object.assign(t.verticalOhlcv,{day_of_the_week:we(t.nullArray),day_of_the_month:we(t.nullArray),week_of_the_month:we(t.nullArray),hour:we(t.nullArray),month:we(t.nullArray),year:we(t.nullArray),session_daily_index:we(t.nullArray),session_intraday_index:we(t.nullArray)})}var n=t.verticalOhlcv.date[e],o=function(t){var e=new Date(t),r=e.getMonth(),n=e.getFullYear(),o=e.getHours(),i=e.getMinutes(),a=e.getDay(),u=e.getDate(),c=new Date(e.getFullYear(),e.getMonth(),1).getDay();return{month:r,year:n,hour:o,minute:i,day_of_the_week:a,day_of_the_month:u,week_of_the_month:Math.ceil((u+c)/7)}}(n),i=o.day_of_the_week,a=o.day_of_the_month,u=o.week_of_the_month,c=o.month,l=o.year,s=o.hour,f=n.slice(0,10);f!==t.instances.dateTime.prevDateStr&&(t.instances.dateTime.prevDateStr=f,t.instances.dateTime.sessionDailyIndexCount++,t.instances.dateTime.sessionIntradayIndexCount=0),t.pushToMain({index:e,key:"session_daily_index",value:t.instances.dateTime.sessionDailyIndexCount}),t.pushToMain({index:e,key:"session_intraday_index",value:t.instances.dateTime.sessionIntradayIndexCount}),t.pushToMain({index:e,key:"day_of_the_week",value:i}),t.pushToMain({index:e,key:"day_of_the_month",value:a}),t.pushToMain({index:e,key:"week_of_the_month",value:u}),t.pushToMain({index:e,key:"month",value:c}),t.pushToMain({index:e,key:"year",value:l}),t.pushToMain({index:e,key:"hour",value:s})},priceVariations:function(t,e){0===e&&(t.priceBased=Se(new Set([].concat(Se(t.priceBased),["mid_price_open_close","mid_price_high_low"]))),Object.assign(t.verticalOhlcv,{mid_price_open_close:Se(t.nullArray),mid_price_high_low:Se(t.nullArray)}));var r=t.verticalOhlcv.open[e],n=t.verticalOhlcv.high[e],o=t.verticalOhlcv.low[e],i=t.verticalOhlcv.close[e];t.pushToMain({index:e,key:"mid_price_open_close",value:(r+i)/2}),t.pushToMain({index:e,key:"mid_price_high_low",value:(n+o)/2})},rsi:function(t,e,r){var n,o,i=t.verticalOhlcv.close[e];0===e&&(t.crossPairsList.push({fast:"rsi_".concat(r),slow:"rsi_sma_".concat(r),isDefault:!0}),Object.assign(t.instances,xt(xt({},"rsi_".concat(r),new Et(r)),"rsi_sma_".concat(r),new $(r))),Object.assign(t.verticalOhlcv,xt(xt({},"rsi_".concat(r),Tt(t.nullArray)),"rsi_sma_".concat(r),Tt(t.nullArray)))),t.instances["rsi_".concat(r)].update(i,t.lastIndexReplace);try{n=t.instances["rsi_".concat(r)].getResult()}catch(t){n=null}n&&(t.pushToMain({index:e,key:"rsi_".concat(r),value:n}),t.instances["rsi_sma_".concat(r)].update(n,t.lastIndexReplace));try{o=t.instances["rsi_sma_".concat(r)].getResult()}catch(t){o=null}return o&&t.pushToMain({index:e,key:"rsi_sma_".concat(r),value:o}),!0},sma:function(t,e,r,n){var o,i,a=t.verticalOhlcv.close[e],u="string"==typeof n&&t.verticalOhlcv.hasOwnProperty(n)&&"close"!==n?"".concat(n,"_"):"",c="".concat(u,"sma_").concat(r);0===e&&(t.instances[c]=new $(r),t.verticalOhlcv[c]=function(t){if(Array.isArray(t))return Mt(t)}(i=t.nullArray)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(i)||function(t,e){if(t){if("string"==typeof t)return Mt(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Mt(t,e):void 0}}(i)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),t.instances[c].update(a,t.lastIndexReplace);try{o=t.instances[c].getResult()}catch(t){}o&&t.pushToMain({index:e,key:c,value:o})},ema:function(t,e,r,n){var o,i,a=t.verticalOhlcv.close[e],u="string"==typeof n&&t.verticalOhlcv.hasOwnProperty(n)&&"close"!==n?"".concat(n,"_"):"",c="".concat(u,"ema_").concat(r);0===e&&(t.instances[c]=new pt(r),t.verticalOhlcv[c]=function(t){if(Array.isArray(t))return Rt(t)}(i=t.nullArray)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(i)||function(t,e){if(t){if("string"==typeof t)return Rt(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Rt(t,e):void 0}}(i)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),t.instances[c].update(a,t.lastIndexReplace);try{o=t.instances[c].getResult()}catch(t){o=null}o&&t.pushToMain({index:e,key:c,value:o})},macd:function(t,e,r,n,o,i){var a=i.target,u="close"===a?"":"_".concat(a),c="".concat(r,"_").concat(n,"_").concat(o).concat(u);if(0===e){if(!t.verticalOhlcv.hasOwnProperty(a))throw new Error("Target property ".concat(a," not found in verticalOhlcv for macd."));var l=t.inputParams.filter((function(t){return"macd"===t.key})).length,s=l>1?"macd_".concat(c):"macd".concat(u);t.crossPairsList.push({fast:"".concat(s,"_diff"),slow:"".concat(s,"_dea"),isDefault:!0}),t.instances.hasOwnProperty("macd")||(t.instances.macd={numberOfIndicators:l,settings:{}}),t.instances.macd.settings[c]=new mt(new pt(r),new pt(n),new pt(o)),Object.assign(t.verticalOhlcv,Dt(Dt(Dt({},"".concat(s,"_diff"),Bt(t.nullArray)),"".concat(s,"_dea"),Bt(t.nullArray)),"".concat(s,"_histogram"),Bt(t.nullArray)))}var f,h=t.instances.macd.numberOfIndicators>1?"macd_".concat(c):"macd".concat(u),p=t.instances.macd.settings[c],y=t.verticalOhlcv[a][e];p.update(y,t.lastIndexReplace);try{f=p.getResult()}catch(t){}return f&&(t.pushToMain({index:e,key:"".concat(h,"_diff"),value:f.macd}),t.pushToMain({index:e,key:"".concat(h,"_dea"),value:f.signal}),t.pushToMain({index:e,key:"".concat(h,"_histogram"),value:f.histogram})),!0},relativeVolume:function(t,e){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,o="relative_volume_".concat(n);0===e&&(t.instances[o]={instance:new $(n),prevRelativeVolumeSma:null},Object.assign(t.verticalOhlcv,function(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=Vt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Vt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Vt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}({},o,function(t){if(Array.isArray(t))return Ht(t)}(r=t.nullArray)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(r)||function(t,e){if(t){if("string"==typeof t)return Ht(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ht(t,e):void 0}}(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())));var i,a=t.verticalOhlcv.volume[e],u=t.instances[o].instance;u.update(a,t.lastIndexReplace);try{i=u.getResult()}catch(t){}var c=t.instances[o].prevRelativeVolumeSma;return t.pushToMain({index:e,key:o,value:null!==i&&null!==c?a/c:null}),t.instances[o].prevRelativeVolumeSma=i,!0},donchianChannels:function(t,e,r,n,o){var i=o.height,a=o.range,u="".concat(r,"_").concat(n);if(0===e){var c=t.inputParams.filter((function(t){return"donchianChannels"===t.key})).length,l=c>1?"donchian_channel_".concat(u):"donchian_channel";Object.assign(t.verticalOhlcv,function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?qt(Object(r),!0).forEach((function(e){Gt(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):qt(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}(Gt(Gt(Gt({},"".concat(l,"_upper"),Nt(t.nullArray)),"".concat(l,"_basis"),Nt(t.nullArray)),"".concat(l,"_lower"),Nt(t.nullArray)),i&&Gt({},"".concat(l,"_height"),Nt(t.nullArray)))),t.instances.hasOwnProperty("donchian_channel")||(t.instances.donchian_channel={numberOfIndicators:c,settings:{}});var s,f=Ut(a);try{for(f.s();!(s=f.n()).done;){var h=s.value;if(!(h in t.verticalOhlcv)||!t.priceBased.includes(h))throw new Error('Invalid range item value "'.concat(h,'" property for donchianChannels. Only price based key names are accepted:\n').concat(JSON.stringify(t.priceBased)));t.verticalOhlcv["".concat(l,"_range_").concat(h)]=Nt(t.nullArray)}}catch(t){f.e(t)}finally{f.f()}t.instances.donchian_channel.settings[u]={maxDeque:[],minDeque:[]}}var p=t.instances.donchian_channel.numberOfIndicators>1?"donchian_channel_".concat(u):"donchian_channel",y=t.instances.donchian_channel.settings[u],v=y.maxDeque,d=y.minDeque,b=e-n,m=b+1,g=m-r;if(g<0||m>t.len)return!0;for(var w=t.verticalOhlcv.high,O=t.verticalOhlcv.low;v.length&&v[0]<g;)v.shift();for(;v.length&&w[v[v.length-1]]<=w[b];)v.pop();for(v.push(b);d.length&&d[0]<g;)d.shift();for(;d.length&&O[d[d.length-1]]>=O[b];)d.pop();d.push(b);var S=w[v[0]],_=O[d[0]],j=(S+_)/2;if(t.pushToMain({index:e,key:"".concat(p,"_upper"),value:S}),t.pushToMain({index:e,key:"".concat(p,"_basis"),value:j}),t.pushToMain({index:e,key:"".concat(p,"_lower"),value:_}),i){var A=(S-_)/_*100;t.pushToMain({index:e,key:"".concat(p,"_height"),value:A})}var P,E=Ut(a);try{for(E.s();!(P=E.n()).done;){var k=P.value,T=(t.verticalOhlcv[k][e]-_)/(S-_);t.pushToMain({index:e,key:"".concat(p,"_range_").concat(k),value:T})}}catch(t){E.e(t)}finally{E.f()}return!0},bollingerBands:function(t,e,r,n,o){var i,a=t.verticalOhlcv,u=t.instances,c=t.lastIndexReplace,l=o.height,s=o.range,f=void 0===s?[]:s,h=o.zScore,p=void 0===h?[]:h,y=o.target,v="close"===y?"":"_".concat(y),d="".concat(r,"_").concat(n).concat(v);if(0===e){var b=t.nullArray,m=t.priceBased,g=t.inputParams;if(!(y in a))throw new Error('bollingerBands could not find target "'.concat(y,'"'));var w=g.filter((function(t){return"bollingerBands"===t.key})).length;i=w>1?"bollinger_bands_".concat(d):"bollinger_bands".concat(v),u.bollinger_bands||(u.bollinger_bands={numberOfIndicators:w,settings:{}}),u.bollinger_bands.settings[d]={instance:new ot(r,n)};var O,S=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Xt(Object(r),!0).forEach((function(e){Zt(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Xt(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}(Zt(Zt(Zt({},"".concat(i,"_upper"),Yt(b)),"".concat(i,"_middle"),Yt(b)),"".concat(i,"_lower"),Yt(b)),l&&Zt({},"".concat(i,"_height"),Yt(b))),_=Kt(f);try{for(_.s();!(O=_.n()).done;){var j=O.value;if(!(j in a)||!m.includes(j))throw new Error('Invalid range item value "'.concat(j,'" property for bollingerBands. Only price based key names are accepted:\n').concat(JSON.stringify(t.priceBased)));S["".concat(i,"_range_").concat(j)]=Yt(b)}}catch(t){_.e(t)}finally{_.f()}var A,P=Kt(p);try{for(P.s();!(A=P.n()).done;){var E=A.value;if(!(E in a)||!m.includes(E))throw new Error('Invalid zScore item value "'.concat(E,'" for bollingerBands. Only price based key names are accepted:\n').concat(JSON.stringify(t.priceBased)));S["".concat(i,"_zscore_").concat(E)]=Yt(b)}}catch(t){P.e(t)}finally{P.f()}Object.assign(a,S)}i||(i=u.bollinger_bands.numberOfIndicators>1?"bollinger_bands_".concat(d):"bollinger_bands".concat(v));var k,T=i,I=u.bollinger_bands.settings[d].instance,x=a[y][e];I.update(x,c);try{k=I.getResult()}catch(t){}if(!k)return!0;var M=k,R=M.upper,C=M.middle,D=M.lower;if(t.pushToMain({index:e,key:"".concat(T,"_upper"),value:R}),t.pushToMain({index:e,key:"".concat(T,"_middle"),value:C}),t.pushToMain({index:e,key:"".concat(T,"_lower"),value:D}),l){var B=(R-D)/D*100;t.pushToMain({index:e,key:"".concat(T,"_height"),value:B})}var L,V=Kt(f);try{for(V.s();!(L=V.n()).done;){var H=L.value,z=(a[H][e]-D)/(R-D);t.pushToMain({index:e,key:"".concat(T,"_range_").concat(H),value:z})}}catch(t){V.e(t)}finally{V.f()}var U,N=Kt(p);try{for(N.s();!(U=N.n()).done;){var $=U.value,F=R-D,q=0!==F?2*n*(a[$][e]-C)/F:0;t.pushToMain({index:e,key:"".concat(T,"_zscore_").concat($),value:q})}}catch(t){N.e(t)}finally{N.f()}return!0},volumeOscillator:function(t,e,r,n){var o,i=t.verticalOhlcv.volume[e],a="volume_oscillator";0===e&&(Object.assign(t.instances,{volume_oscillator:{fastEMA:new pt(r),slowEMA:new pt(n)}}),t.verticalOhlcv[a]=function(t){if(Array.isArray(t))return te(t)}(o=t.nullArray)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(o)||function(t,e){if(t){if("string"==typeof t)return te(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?te(t,e):void 0}}(o)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),t.crossPairsList.push({fast:a,slow:0,isDefault:!0}));var u=t.instances[a],c=u.fastEMA,l=u.slowEMA;c.update(i,t.lastIndexReplace),l.update(i,t.lastIndexReplace);var s=null,f=null;try{s=c.getResult()}catch(t){s=null}try{f=l.getResult()}catch(t){f=null}return"number"==typeof s&&"number"==typeof f&&0!==f?t.pushToMain({index:e,key:a,value:100*(s-f)/f}):t.pushToMain({index:e,key:a,value:null}),!0},candleStudies:function(t,e,r,n,o){var i=t.verticalOhlcv,a=t.instances,u=t.lastIndexReplace;if(0===e){var c=t.nullArray;Object.assign(i,{candle_gap:re(c),candle_body:re(c),candle_top:re(c),candle_bottom:re(c),candle_close:re(c),candle_high:re(c),candle_low:re(c),candle_open:re(c)}),Object.assign(a,{candleStudies:{bodyInstance:new ot(r,n),closeInstance:new ot(r,n),highInstance:new ot(r,n),lowInstance:new ot(r,n),openInstance:new ot(r,n)}}),o>0&&t.lag(["candle_body","candle_gap","candle_close","candle_high","candle_low","candle_open","candle_top","candle_bottom"],o)}var l=i.open[e-1],s=i.high[e-1],f=i.low[e-1],h=i.close[e-1];if(0===e)return!0;var p=i.open[e],y=i.high[e],v=i.low[e],d=i.close[e],b=oe(d,p),m=oe(y,Math.max(p,d)),g=oe(Math.min(p,d),v),w=oe(h,p),O=oe(d,h),S=oe(y,s),_=oe(v,f),j=oe(p,l),A=null,P=null,E=null,k=null,T=null,I=a.candleStudies,x=I.bodyInstance,M=I.closeInstance,R=I.highInstance,C=I.lowInstance,D=I.openInstance;x.update(b.value,u),M.update(O.value,u),R.update(S.value,u),C.update(_.value,u),D.update(j.value,u);try{A=x.getResult(),P=M.getResult(),E=R.getResult(),k=C.getResult(),T=D.getResult()}catch(t){}return t.pushToMain({index:e,key:"candle_close",value:ee(O,P)}),t.pushToMain({index:e,key:"candle_high",value:ee(S,E)}),t.pushToMain({index:e,key:"candle_low",value:ee(_,k)}),t.pushToMain({index:e,key:"candle_open",value:ee(j,T)}),t.pushToMain({index:e,key:"candle_body",value:ee(b,A)}),t.pushToMain({index:e,key:"candle_gap",value:ee(w,A)}),t.pushToMain({index:e,key:"candle_top",value:ee(m,A)}),t.pushToMain({index:e,key:"candle_bottom",value:ee(g,A)}),!0}},Me=function(t,e,r){var n=function(t){return r>1?t*r:t};if("number"===e)return n(t);if("string"===e){var o=Ie(t);return n(Number(o))}return 0},Re=function(t,e){return"number"===e?t:"string"===e?Number(Ie(t)):0},Ce=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=e.len,i=e.inputParams;e.nullArray=new Array(o).fill(null);var a=["open","high","low","close","volume"],u=new Set(a);if(0===n){!function(t){var e,n=t.inputParams,o=t.len,i=r(n);try{for(i.s();!(e=i.n()).done;){var a,u=r(e.value.params);try{for(u.s();!(a=u.n()).done;){var c=a.value;if("number"==typeof c&&c>o)throw console.log(c,o),new Error("At least one of the params of the indicator is greater than the input OHLCV length. Make sure to have enough datapoints in the input OHLCV.")}}catch(t){u.e(t)}finally{u.f()}}}catch(t){i.e(t)}finally{i.f()}}(e),a.forEach((function(t){e.verticalOhlcv[t]=Ee(e.nullArray)}));var c=Object.keys(t[0]).filter((function(t){return!u.has(t)}));c.forEach((function(t){e.verticalOhlcv[t]=Ee(e.nullArray)})),e.otherKeys=c,function(t,e){for(var r=0,n=Object.keys(e.inputTypes);r<n.length;r++){var o=n[r];if(!(o in t))throw new Error('Property "'.concat(o,'" not found in ohlcv array. ').concat(e.ticker));var i=t[o];if("number"==typeof i&&i>0)e.inputTypes[o]="number";else{if("string"!=typeof i||!/^(\d+(\.\d*)?|\.\d+)$/.test(i))throw new Error('Invalid property "'.concat(o,'" in ohlcv array. ').concat(e.ticker));e.inputTypes[o]="string",i=Ie(i)}if(0===e.precisionMultiplier&&!0===e.precision){var a=(l=String(i).split("."),s=2,function(t){if(Array.isArray(t))return t}(l)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(l,s)||ke(l,s)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[1],u=void 0===a?"":a,c=Math.max(4,u.length);e.precisionMultiplier=c>1?Math.pow(10,c-1):1}}var l,s}(t[0],e)}else if(!e.otherKeys)throw new Error("otherKeys not found in main. Ensure you run with startIndex=0 first to initialize.");for(var l=function(t){return Array.isArray(t)?t.map((function(t){var e=t.key,r=t.params;return{key:e,fn:xe[e],args:r}})):[]}(i),s=n;s<o;s++){var f=t[s],h=f.open,p=f.high,y=f.low,v=f.close,d=f.volume,b=Pe(f,je),m=e.precisionMultiplier,g=Me(h,e.inputTypes.open,m),w=Me(p,e.inputTypes.high,m),O=Me(y,e.inputTypes.low,m),S=Me(v,e.inputTypes.close,m),_=Re(d,e.inputTypes.volume);e.pushToMain({index:s,key:"open",value:g}),e.pushToMain({index:s,key:"high",value:w}),e.pushToMain({index:s,key:"low",value:O}),e.pushToMain({index:s,key:"close",value:S}),e.pushToMain({index:s,key:"volume",value:_});var j,A=Ae(e.otherKeys);try{for(A.s();!(j=A.n()).done;){var P=j.value;e.pushToMain({index:s,key:P,value:b[P]})}}catch(t){A.e(t)}finally{A.f()}var E,k=Ae(l);try{for(k.s();!(E=k.n()).done;){var T=E.value,I=T.key,x=T.fn,M=T.args;["crossPairs","lag"].includes(I)||x.apply(void 0,[e,s].concat(Ee(M)))}}catch(t){k.e(t)}finally{k.f()}se(e,s),ge(e,s),e.lastComputedIndex++}},De=function(t,e){for(var r=t.length,n=new $(e),o=new Array(r),i=0,a=0,u=0,c=0;c<r;c++)if(n.update(t[c]),n.isStable){var l=n.getResult();o[c]=l,i+=l,a+=l*l,u++}else o[c]=null;var s=i/u,f=a/u-s*s,h=Math.sqrt(f);return o.map((function(t){return null!==t?(t-s)/h:null}))},Be=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5;if(t.length!==e.length)throw new Error("Both arrays must have the same length");for(var n=De(t,r),o=De(e,r),i=t.length,a=[],u=0,c=0,l=0,s=0,f=0,h=0,p=-1,y=0;y<i;y++){if(null!==n[y]&&null!==o[y]){p=y;break}a.push(0)}if(-1===p)return new Array(i).fill(0);for(var v=p;v<i;v++){var d=n[v],b=o[v];if(null!==d&&null!==b)if(u+=d,c+=b,l+=d*b,s+=d*d,f+=b*b,++h<2)a.push(0);else{var m=h*l-u*c,g=Math.sqrt((h*s-u*u)*(h*f-c*c)),w=0===g?0:m/g;a.push(w)}else u=c=l=s=f=h=0,a.push(0)}return a};function Le(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var Ve=function(t){for(var e=t.input,r=t.inputParams,n=new(0,t.OHLCV_INDICATORS)({input:e}),o=0;o<r.length;o++){var i=r[o],a=i.key,u=i.params;Array.isArray(u)&&(u.length>0?(Array.isArray(u)&&"crossPairs"===a&&Array.isArray(u[0])&&(u[0]=u[0].filter((function(t){return!t.isDefault}))),n[a].apply(n,function(t){if(Array.isArray(t))return Le(t)}(c=u)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(c)||function(t,e){if(t){if("string"==typeof t)return Le(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Le(t,e):void 0}}(c)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())):n[a]())}var c;return n};function He(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var ze=function(t){for(var e=t.row,r=t.precisionMultiplier,n=t.priceBased,o={},i=0,a=Object.entries(e);i<a.length;i++){var u=(s=a[i],f=2,function(t){if(Array.isArray(t))return t}(s)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(s,f)||function(t,e){if(t){if("string"==typeof t)return He(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?He(t,e):void 0}}(s,f)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),c=u[0],l=u[1];n.includes(c)&&(l/=r),o[c]=l}var s,f;return o};function Ue(t){return function(t){if(Array.isArray(t))return qe(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Fe(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ne(t){return Ne="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ne(t)}function $e(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||Fe(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Fe(t,e){if(t){if("string"==typeof t)return qe(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?qe(t,e):void 0}}function qe(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Ge(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Je(t,e,r){return(e=Ye(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ke(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ye(n.key),n)}}function Ye(t){var e=function(t,e){if("object"!=Ne(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ne(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ne(e)?e:e+""}var We=function(){return t=function t(e){var r=e.input,n=e.ticker,o=void 0===n?null:n,i=e.precision,a=void 0===i||i;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!Array.isArray(r))throw Error("input OHLCV must be an array: "+o);if(0===r.length)throw Error("input OHLCV must not be empty: "+o);if(!r[0].hasOwnProperty("close"))throw Error("input OHLCV array objects require at least close property: "+o);return this.isComputed=!1,this.lastComputedIndex=0,this.input=r,this.inputTypes={open:"",high:"",low:"",close:"",volume:""},this.priceBased=["open","high","low","close"],this.len=r.length,this.lastIndexReplace=!1,this.instances={},this.crossPairsList=[],this.verticalOhlcv={},this.horizontalOhlcv=Array.from({length:this.len},(function(){return{}})),this.inputParams=[],this.studies={},this.utilities={correlation:Be},this.precision=a,this.precisionMultiplier=!0===this.precision?0:1,this.setIndicatorsFromInputParams=Ve,this},e=[{key:"pushToMain",value:function(t){var e=t.index,r=t.key,n=t.value;this.verticalOhlcv[r][e]=n,this.horizontalOhlcv[e][r]=n}},{key:"getDataAsCols",value:function(){this.compute();var t=this.precisionMultiplier,e=this.precision,r=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Ge(Object(r),!0).forEach((function(e){Je(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ge(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},this.verticalOhlcv);if(e)for(var n=0,o=Object.entries(r);n<o.length;n++){var i=$e(o[n],2),a=i[0],u=i[1];this.priceBased.includes(a)&&(this.precision?r[a]=u.map((function(e){return e/t})):r[a]=u)}return r}},{key:"getData",value:function(){this.compute();var t=this.precisionMultiplier,e=this.priceBased;return this.precision?this.horizontalOhlcv.filter((function(t){return!Object.values(t).some((function(t){return null==t}))})).map((function(r){return ze({row:r,precisionMultiplier:t,priceBased:e})})):this.horizontalOhlcv.filter((function(t){return!Object.values(t).some((function(t){return null==t}))}))}},{key:"getLastValues",value:function(){this.compute();var t=this.precisionMultiplier,e=this.priceBased;return this.precision?ze({row:this.horizontalOhlcv[this.horizontalOhlcv.length-1],precisionMultiplier:t,priceBased:e}):this.horizontalOhlcv[this.horizontalOhlcv.length-1]}},{key:"compute",value:function(t){if(!0===this.isComputed&&!t)return this;if(this.isComputed=!1,this.isValidDate=this.input[0].hasOwnProperty("date")&&o(this.input[0].date),this.len>this.lastComputedIndex&&!t&&Ce(this.input,this,0),t&&"object"===Ne(t)){var e;if(!["open","high","low","close","volume","date"].every((function(e){return Object.keys(t).includes(e)})))throw Error('Invalid OHLCV object sent in "compute". Correct usage: .compute({open: 108.25, high: 108.410004, low: 108.25, close: 99999999, volume: 875903, date: "2024-12-16 15:45:00" || "2024-12-16"})');if(!this.isValidDate)throw Error('All the OHLCV rows require a valid date property to access the compute change method. Correct date format: "2024-12-16 15:45:00" or "2024-12-16"');if(!o(t.date))throw Error('The date in the new OHLCV row is invalid. Correct date format: "2024-12-16 15:45:00" or "2024-12-16"');var r=t.date,n=this.len-1,i=null===(e=this.input[n])||void 0===e?void 0:e.date;0===this.lastComputedIndex&&this.compute(),i!==r?(this.len++,this.input.push(t),Ce(this.input,this,this.len)):(this.input[n]=t,Ce(this.input,this,n))}return this}},{key:"crossPairs",value:function(t){return i(this),this.crossPairsList=[].concat(Ue(this.crossPairsList),Ue(t)),this.inputParams.push({key:"crossPairs",params:[this.crossPairsList]}),this}},{key:"lag",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["close"],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;i(this),this.inputParams.push({key:"lag",params:[e,r]});for(var n=function(){var r=e[o];t.priceBased.find((function(t){return r.startsWith(t)}))&&t.priceBased.push(r)},o=0;o<e.length;o++)n();return this}},{key:"relativeVolume",value:function(t){return i(this),this.inputParams.push({key:"relativeVolume",params:[t]}),this}},{key:"ema",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(i(this),!e||"object"!==Ne(e))throw new Error('"options" must be an object in ema. eg: {target, height, range}');var r=e.target,n=void 0===r?"close":r;if("number"!=typeof t||t<=0)throw new Error('"size" must be a positive number in ema.');return this.inputParams.push({key:"ema",params:[t,n]}),this.priceBased.push("ema_".concat(t)),this}},{key:"sma",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(i(this),!e||"object"!==Ne(e))throw new Error('"options" must be an object in sma. eg: {target, height, range}');var r=e.target,n=void 0===r?"close":r;if("number"!=typeof t||t<=0)throw new Error('"size" must be a positive number in sma.');return this.inputParams.push({key:"sma",params:[t,n]}),this.priceBased.push("sma_".concat(t)),this}},{key:"macd",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:12,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:26,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:9,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(i(this),"number"!=typeof t||t<=0)throw new Error('"fast" must be a positive number in macd.');if("number"!=typeof e||e<=t)throw new Error('"slow" must be a positive number greater than "fast" in macd.');if("number"!=typeof r||r<=0)throw new Error('"signal" must be a positive number in macd.');if("object"!==Ne(n))throw new Error('"options" must be an object in macd. eg: {target}');var o=n.target,a=void 0===o?"close":o;return this.inputParams.push({key:"macd",params:[t,e,r,{target:a}]}),this}},{key:"bollingerBands",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(i(this),!r||"object"!==Ne(r))throw new Error('"options" must be an object in bollingerBands. eg: {target, height, range}');var n=r.target,o=void 0===n?"close":n,a=r.height,u=void 0!==a&&a,c=r.range,l=void 0===c?[]:c,s=r.zScore,f=void 0===s?[]:s;if("number"!=typeof t||t<=0)throw new Error('"size" must be a positive number in bollingerBands.');if("number"!=typeof e||e<=0)throw new Error('"stdDev" must be a positive number in bollingerBands.');if(!Array.isArray(l))throw new Error('If set, "range" must be a array of column names in bollingerBands.');if(!Array.isArray(f))throw new Error('If set, "zScore" must be a array of column names in bollingerBands.');if("boolean"!=typeof u)throw new Error('"height" must be a boolean in bollingerBands.');return this.inputParams.push({key:"bollingerBands",params:[t,e,{target:o,height:u,range:l,zScore:f}]}),this.priceBased.push("bollinger_bands_middle","bollinger_bands_upper","bollinger_bands_lower"),this}},{key:"rsi",value:function(t){if(i(this),"number"!=typeof t||t<=0)throw new Error('"size" must be a positive number in rsi.');return this.inputParams.push({key:"rsi",params:[t]}),this}},{key:"donchianChannels",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(i(this),"number"!=typeof t||t<=0)throw new Error('"size" must be a positive number or 0 in donchianChannels.');if("number"!=typeof e||e<0)throw new Error('"offset" must be a positive number or 0 in donchianChannels.');var n=r.height,o=void 0!==n&&n,a=r.range,u=void 0===a?[]:a;if(!Array.isArray(u))throw new Error('If set, "range" must be a array of column names in donchianChannels.');if("boolean"!=typeof o)throw new Error('"height" must be a boolean in donchianChannels.');return this.inputParams.push({key:"donchianChannels",params:[t,e,{height:o,range:u}]}),this.priceBased.push("donchian_channel_upper","donchian_channel_lower","donchian_channel_basis"),this}},{key:"candleStudies",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(i(this),"number"!=typeof t||t<=0)throw new Error('"size" must be a positive number or 0 in candleStudies.');var r=e.stdDev,n=void 0===r?2:r,o=e.lag,a=void 0===o?0:o;if("number"!=typeof n||"number"==typeof n&&n<=0)throw new Error('"stdDev" must be a positive number greater than 0 in candleStudies.');return this.inputParams.push({key:"candleStudies",params:[t,n,a]}),this}},{key:"volumeOscillator",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;if(i(this),"number"!=typeof t||t<=0)throw new Error('fastSize" must be a positive number in volumeOscillator.');if("number"!=typeof e||e<=t)throw new Error('"slowSize" must be a positive number greater than the "fastSize" in volumeOscillator.');return this.inputParams.push({key:"volumeOscillator",params:[t,e]}),this}},{key:"dateTime",value:function(){return i(this),this.inputParams.push({key:"dateTime",params:[]}),this}},{key:"priceVariations",value:function(){return i(this),this.inputParams.push({key:"priceVariations",params:[]}),this}}],e&&Ke(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}()})(),OHLCV_INDICATORS=e})();
1
+ var OHLCV_INDICATORS;(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};(()=>{function r(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var o=0,i=function(){};return{s:i,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){c=!0,a=t},f:function(){try{u||null==r.return||r.return()}finally{if(c)throw a}}}}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}t.r(e),t.d(e,{default:()=>rr});var o=function(t){return"string"==typeof t&&/^\d{4}-\d{2}-\d{2}/.test(t)},i=function(t){if(0!==t.lastComputedIndex)throw Error('ohlcv is already computed, you can not add new indicators after "compute", "getLastValues" , "getDataAsCols" or "getData" methods are called.')},a=1e6,u="[big.js] ",c=u+"Invalid ",l=c+"decimal places",s=c+"rounding mode",f=u+"Division by zero",h={},y=void 0,p=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function v(t,e,r,n){var o=t.c;if(r===y&&(r=t.constructor.RM),0!==r&&1!==r&&2!==r&&3!==r)throw Error(s);if(e<1)n=3===r&&(n||!!o[0])||0===e&&(1===r&&o[0]>=5||2===r&&(o[0]>5||5===o[0]&&(n||o[1]!==y))),o.length=1,n?(t.e=t.e-e+1,o[0]=1):o[0]=t.e=0;else if(e<o.length){if(n=1===r&&o[e]>=5||2===r&&(o[e]>5||5===o[e]&&(n||o[e+1]!==y||1&o[e-1]))||3===r&&(n||!!o[0]),o.length=e,n)for(;++o[--e]>9;)if(o[e]=0,0===e){++t.e,o.unshift(1);break}for(e=o.length;!o[--e];)o.pop()}return t}function d(t,e,r){var n=t.e,o=t.c.join(""),i=o.length;if(e)o=o.charAt(0)+(i>1?"."+o.slice(1):"")+(n<0?"e":"e+")+n;else if(n<0){for(;++n;)o="0"+o;o="0."+o}else if(n>0)if(++n>i)for(n-=i;n--;)o+="0";else n<i&&(o=o.slice(0,n)+"."+o.slice(n));else i>1&&(o=o.charAt(0)+"."+o.slice(1));return t.s<0&&r?"-"+o:o}function b(t){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},b(t)}function m(t){var e="function"==typeof Map?new Map:void 0;return m=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return function(t,e,r){if(g())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&w(o,r.prototype),o}(t,arguments,O(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),w(r,t)},m(t)}function g(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(g=function(){return!!t})()}function w(t,e){return w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},w(t,e)}function O(t){return O=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},O(t)}h.abs=function(){var t=new this.constructor(this);return t.s=1,t},h.cmp=function(t){var e,r=this,n=r.c,o=(t=new r.constructor(t)).c,i=r.s,a=t.s,u=r.e,c=t.e;if(!n[0]||!o[0])return n[0]?i:o[0]?-a:0;if(i!=a)return i;if(e=i<0,u!=c)return u>c^e?1:-1;for(a=(u=n.length)<(c=o.length)?u:c,i=-1;++i<a;)if(n[i]!=o[i])return n[i]>o[i]^e?1:-1;return u==c?0:u>c^e?1:-1},h.div=function(t){var e=this,r=e.constructor,n=e.c,o=(t=new r(t)).c,i=e.s==t.s?1:-1,u=r.DP;if(u!==~~u||u<0||u>a)throw Error(l);if(!o[0])throw Error(f);if(!n[0])return t.s=i,t.c=[t.e=0],t;var c,s,h,p,d,b=o.slice(),m=c=o.length,g=n.length,w=n.slice(0,c),O=w.length,S=t,j=S.c=[],_=0,P=u+(S.e=e.e-t.e)+1;for(S.s=i,i=P<0?0:P,b.unshift(0);O++<c;)w.push(0);do{for(h=0;h<10;h++){if(c!=(O=w.length))p=c>O?1:-1;else for(d=-1,p=0;++d<c;)if(o[d]!=w[d]){p=o[d]>w[d]?1:-1;break}if(!(p<0))break;for(s=O==c?o:b;O;){if(w[--O]<s[O]){for(d=O;d&&!w[--d];)w[d]=9;--w[d],w[O]+=10}w[O]-=s[O]}for(;!w[0];)w.shift()}j[_++]=p?h:++h,w[0]&&p?w[O]=n[m]||0:w=[n[m]]}while((m++<g||w[0]!==y)&&i--);return j[0]||1==_||(j.shift(),S.e--,P--),_>P&&v(S,P,r.RM,w[0]!==y),S},h.eq=function(t){return 0===this.cmp(t)},h.gt=function(t){return this.cmp(t)>0},h.gte=function(t){return this.cmp(t)>-1},h.lt=function(t){return this.cmp(t)<0},h.lte=function(t){return this.cmp(t)<1},h.minus=h.sub=function(t){var e,r,n,o,i=this,a=i.constructor,u=i.s,c=(t=new a(t)).s;if(u!=c)return t.s=-c,i.plus(t);var l=i.c.slice(),s=i.e,f=t.c,h=t.e;if(!l[0]||!f[0])return f[0]?t.s=-c:l[0]?t=new a(i):t.s=1,t;if(u=s-h){for((o=u<0)?(u=-u,n=l):(h=s,n=f),n.reverse(),c=u;c--;)n.push(0);n.reverse()}else for(r=((o=l.length<f.length)?l:f).length,u=c=0;c<r;c++)if(l[c]!=f[c]){o=l[c]<f[c];break}if(o&&(n=l,l=f,f=n,t.s=-t.s),(c=(r=f.length)-(e=l.length))>0)for(;c--;)l[e++]=0;for(c=e;r>u;){if(l[--r]<f[r]){for(e=r;e&&!l[--e];)l[e]=9;--l[e],l[r]+=10}l[r]-=f[r]}for(;0===l[--c];)l.pop();for(;0===l[0];)l.shift(),--h;return l[0]||(t.s=1,l=[h=0]),t.c=l,t.e=h,t},h.mod=function(t){var e,r=this,n=r.constructor,o=r.s,i=(t=new n(t)).s;if(!t.c[0])throw Error(f);return r.s=t.s=1,e=1==t.cmp(r),r.s=o,t.s=i,e?new n(r):(o=n.DP,i=n.RM,n.DP=n.RM=0,r=r.div(t),n.DP=o,n.RM=i,this.minus(r.times(t)))},h.neg=function(){var t=new this.constructor(this);return t.s=-t.s,t},h.plus=h.add=function(t){var e,r,n,o=this,i=o.constructor;if(t=new i(t),o.s!=t.s)return t.s=-t.s,o.minus(t);var a=o.e,u=o.c,c=t.e,l=t.c;if(!u[0]||!l[0])return l[0]||(u[0]?t=new i(o):t.s=o.s),t;if(u=u.slice(),e=a-c){for(e>0?(c=a,n=l):(e=-e,n=u),n.reverse();e--;)n.push(0);n.reverse()}for(u.length-l.length<0&&(n=l,l=u,u=n),e=l.length,r=0;e;u[e]%=10)r=(u[--e]=u[e]+l[e]+r)/10|0;for(r&&(u.unshift(r),++c),e=u.length;0===u[--e];)u.pop();return t.c=u,t.e=c,t},h.pow=function(t){var e=this,r=new e.constructor("1"),n=r,o=t<0;if(t!==~~t||t<-1e6||t>1e6)throw Error(c+"exponent");for(o&&(t=-t);1&t&&(n=n.times(e)),t>>=1;)e=e.times(e);return o?r.div(n):n},h.prec=function(t,e){if(t!==~~t||t<1||t>a)throw Error(c+"precision");return v(new this.constructor(this),t,e)},h.round=function(t,e){if(t===y)t=0;else if(t!==~~t||t<-a||t>a)throw Error(l);return v(new this.constructor(this),t+this.e+1,e)},h.sqrt=function(){var t,e,r,n=this,o=n.constructor,i=n.s,a=n.e,c=new o("0.5");if(!n.c[0])return new o(n);if(i<0)throw Error(u+"No square root");0===(i=Math.sqrt(n+""))||i===1/0?((e=n.c.join("")).length+a&1||(e+="0"),a=((a+1)/2|0)-(a<0||1&a),t=new o(((i=Math.sqrt(e))==1/0?"5e":(i=i.toExponential()).slice(0,i.indexOf("e")+1))+a)):t=new o(i+""),a=t.e+(o.DP+=4);do{r=t,t=c.times(r.plus(n.div(r)))}while(r.c.slice(0,a).join("")!==t.c.slice(0,a).join(""));return v(t,(o.DP-=4)+t.e+1,o.RM)},h.times=h.mul=function(t){var e,r=this,n=r.constructor,o=r.c,i=(t=new n(t)).c,a=o.length,u=i.length,c=r.e,l=t.e;if(t.s=r.s==t.s?1:-1,!o[0]||!i[0])return t.c=[t.e=0],t;for(t.e=c+l,a<u&&(e=o,o=i,i=e,l=a,a=u,u=l),e=new Array(l=a+u);l--;)e[l]=0;for(c=u;c--;){for(u=0,l=a+c;l>c;)u=e[l]+i[c]*o[l-c-1]+u,e[l--]=u%10,u=u/10|0;e[l]=u}for(u?++t.e:e.shift(),c=e.length;!e[--c];)e.pop();return t.c=e,t},h.toExponential=function(t,e){var r=this,n=r.c[0];if(t!==y){if(t!==~~t||t<0||t>a)throw Error(l);for(r=v(new r.constructor(r),++t,e);r.c.length<t;)r.c.push(0)}return d(r,!0,!!n)},h.toFixed=function(t,e){var r=this,n=r.c[0];if(t!==y){if(t!==~~t||t<0||t>a)throw Error(l);for(t=t+(r=v(new r.constructor(r),t+r.e+1,e)).e+1;r.c.length<t;)r.c.push(0)}return d(r,!1,!!n)},h[Symbol.for("nodejs.util.inspect.custom")]=h.toJSON=h.toString=function(){var t=this,e=t.constructor;return d(t,t.e<=e.NE||t.e>=e.PE,!!t.c[0])},h.toNumber=function(){var t=Number(d(this,!0,!0));if(!0===this.constructor.strict&&!this.eq(t.toString()))throw Error(u+"Imprecise conversion");return t},h.toPrecision=function(t,e){var r=this,n=r.constructor,o=r.c[0];if(t!==y){if(t!==~~t||t<1||t>a)throw Error(c+"precision");for(r=v(new n(r),t,e);r.c.length<t;)r.c.push(0)}return d(r,t<=r.e||r.e<=n.NE||r.e>=n.PE,!!o)},h.valueOf=function(){var t=this,e=t.constructor;if(!0===e.strict)throw Error(u+"valueOf disallowed");return d(t,t.e<=e.NE||t.e>=e.PE,!0)},function t(){function e(r){var n=this;if(!(n instanceof e))return r===y?t():new e(r);if(r instanceof e)n.s=r.s,n.e=r.e,n.c=r.c.slice();else{if("string"!=typeof r){if(!0===e.strict&&"bigint"!=typeof r)throw TypeError(c+"value");r=0===r&&1/r<0?"-0":String(r)}!function(t,e){var r,n,o;if(!p.test(e))throw Error(c+"number");for(t.s="-"==e.charAt(0)?(e=e.slice(1),-1):1,(r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),o=e.length,n=0;n<o&&"0"==e.charAt(n);)++n;if(n==o)t.c=[t.e=0];else{for(;o>0&&"0"==e.charAt(--o););for(t.e=r-n-1,t.c=[],r=0;n<=o;)t.c[r++]=+e.charAt(n++)}}(n,r)}n.constructor=e}return e.prototype=h,e.DP=20,e.RM=1,e.NE=-7,e.PE=21,e.strict=!1,e.roundDown=0,e.roundHalfUp=1,e.roundHalfEven=2,e.roundUp=3,e}();var S=function(t){function e(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Not enough data";return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),t=function(t,e,r){return e=O(e),function(t,e){if(e&&("object"==b(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,g()?Reflect.construct(e,r||[],O(t).constructor):e.apply(t,r))}(this,e,[r]),Object.setPrototypeOf(t,(this instanceof e?this.constructor:void 0).prototype),t.name="NotEnoughDataError",t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&w(t,e)}(e,t),r=e,Object.defineProperty(r,"prototype",{writable:!1}),r;var r}(m(Error));function j(t){return j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},j(t)}function _(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,A(n.key),n)}}function P(t,e,r){return(e=A(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function A(t){var e=function(t,e){if("object"!=j(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=j(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==j(e)?e:e+""}var E=function(){return t=function t(){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),P(this,"previousHighest",void 0),P(this,"highest",void 0),P(this,"previousLowest",void 0),P(this,"lowest",void 0),P(this,"previousResult",void 0),P(this,"result",void 0)},(e=[{key:"isStable",get:function(){return void 0!==this.result}},{key:"getResult",value:function(){if(void 0===this.result)throw new S;return this.result}},{key:"setResult",value:function(t,e){return e&&(this.highest=this.previousHighest,this.lowest=this.previousLowest,this.result=this.previousResult),void 0===this.highest?this.highest=t:t>this.highest?(this.previousHighest=this.highest,this.highest=t):this.previousHighest=this.highest,void 0===this.lowest?this.lowest=t:t<this.lowest?(this.previousLowest=this.lowest,this.lowest=t):this.previousLowest=this.lowest,this.previousResult=this.result,this.result=t}},{key:"replace",value:function(t){return this.update(t,!0)}}])&&_(t.prototype,e),r&&_(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function k(t){return k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},k(t)}function T(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,C(n.key),n)}}function I(t,e,r){return e=x(e),function(t,e){if(e&&("object"==k(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,M()?Reflect.construct(e,r||[],x(t).constructor):e.apply(t,r))}function M(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(M=function(){return!!t})()}function x(t){return x=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},x(t)}function R(t,e){return R=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},R(t,e)}function C(t){var e=function(t,e){if("object"!=k(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=k(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==k(e)?e:e+""}var D=function(t){function e(t){var r,n,o,i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=r=I(this,e),i=void 0,(o=C(o="interval"))in n?Object.defineProperty(n,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[o]=i,r.interval=t,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&R(t,e)}(e,t),r=e,(n=[{key:"updates",value:function(t){var e=this;return t.forEach((function(t){return e.update(t)})),this.result}},{key:"replace",value:function(t){return this.update(t,!0)}}])&&T(r.prototype,n),o&&T(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(E);function B(t){return B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},B(t)}function L(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,U(n.key),n)}}function z(t,e,r){return e=H(e),function(t,e){if(e&&("object"==B(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,V()?Reflect.construct(e,r||[],H(t).constructor):e.apply(t,r))}function V(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(V=function(){return!!t})()}function H(t){return H=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},H(t)}function N(t,e){return N=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},N(t,e)}function U(t){var e=function(t,e){if("object"!=B(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=B(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==B(e)?e:e+""}var $=function(t){function e(){var t,r,n,o;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);for(var i=arguments.length,a=new Array(i),u=0;u<i;u++)a[u]=arguments[u];return r=t=z(this,e,[].concat(a)),o=[],(n=U(n="prices"))in r?Object.defineProperty(r,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[n]=o,t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&N(t,e)}(e,t),r=e,n=[{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.prices.length&&e?this.prices[this.prices.length-1]=t:this.prices.push(t),this.prices.length>this.interval&&this.prices.shift(),this.prices.length===this.interval){var r=this.prices.reduce((function(t,e){return t+e}),0);return this.setResult(r/this.prices.length,e)}}}],n&&L(r.prototype,n),o&&L(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(D);function q(t){return q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},q(t)}function F(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,W(n.key),n)}}function G(t,e,r){return e=K(e),function(t,e){if(e&&("object"==q(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,J()?Reflect.construct(e,r||[],K(t).constructor):e.apply(t,r))}function J(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(J=function(){return!!t})()}function K(t){return K=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},K(t)}function Y(t,e){return Y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Y(t,e)}function Q(t,e,r){return(e=W(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function W(t){var e=function(t,e){if("object"!=q(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=q(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==q(e)?e:e+""}var X=function(t){function e(t){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Q(r=G(this,e),"interval",void 0),Q(r,"indicator",void 0),Q(r,"smoothingFactor",void 0),r.interval=t,r.indicator=new $(t),r.smoothingFactor=1/r.interval,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Y(t,e)}(e,t),r=e,n=[{key:"updates",value:function(t){var e=this;return t.forEach((function(t){return e.update(t)})),this.result}},{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.indicator.update(t);if(e&&void 0!==this.previousResult){var n=(t-this.previousResult)*this.smoothingFactor;return this.setResult(n+this.previousResult,e)}if(!e&&void 0!==this.result){var o=(t-this.result)*this.smoothingFactor;return this.setResult(o+this.result,e)}if(void 0===this.result&&void 0!==r)return this.setResult(r,e)}}],n&&F(r.prototype,n),o&&F(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(E);function Z(t){return t.length?t.reduce((function(t,e){return t+e}),0)/t.length:0}function tt(t){return tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tt(t)}function et(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,nt(n.key),n)}}function rt(t,e,r){return(e=nt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function nt(t){var e=function(t,e){if("object"!=tt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=tt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==tt(e)?e:e+""}var ot=function(){return t=function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),rt(this,"interval",void 0),rt(this,"deviationMultiplier",void 0),rt(this,"prices",[]),rt(this,"result",void 0),this.interval=e,this.deviationMultiplier=r},(e=[{key:"update",value:function(t){if(this.prices.push(t),this.prices.length>this.interval){this.prices.shift();var e=Z(this.prices),r=function(t,e){var r=e||Z(t),n=Z(t.map((function(t){return t-r})).map((function(t){return t*t})));return Math.sqrt(n)}(this.prices,e);return this.result={lower:e-r*this.deviationMultiplier,middle:e,upper:e+r*this.deviationMultiplier}}}},{key:"getResult",value:function(){if(void 0===this.result)throw new S;return this.result}},{key:"isStable",get:function(){return void 0!==this.result}}])&&et(t.prototype,e),r&&et(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function it(t){return it="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},it(t)}function at(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ht(n.key),n)}}function ut(t,e,r){return e=lt(e),function(t,e){if(e&&("object"==it(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ct()?Reflect.construct(e,r||[],lt(t).constructor):e.apply(t,r))}function ct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ct=function(){return!!t})()}function lt(t){return lt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},lt(t)}function st(t,e){return st=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},st(t,e)}function ft(t,e,r){return(e=ht(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ht(t){var e=function(t,e){if("object"!=it(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=it(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==it(e)?e:e+""}var yt=function(t){function e(t){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ft(r=ut(this,e,[t]),"interval",void 0),ft(r,"pricesCounter",0),ft(r,"weightFactor",void 0),r.interval=t,r.weightFactor=2/(r.interval+1),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&st(t,e)}(e,t),r=e,n=[{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e?e&&0===this.pricesCounter&&this.pricesCounter++:this.pricesCounter++,e&&void 0!==this.previousResult?this.setResult(t*this.weightFactor+this.previousResult*(1-this.weightFactor),e):this.setResult(t*this.weightFactor+(void 0!==this.result?this.result:t)*(1-this.weightFactor),e)}},{key:"getResult",value:function(){if(this.pricesCounter<this.interval)throw new S;return this.result}},{key:"isStable",get:function(){try{return this.getResult(),!0}catch(t){return!1}}}],n&&at(r.prototype,n),o&&at(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(D);function pt(t){return pt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pt(t)}function vt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,bt(n.key),n)}}function dt(t,e,r){return(e=bt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function bt(t){var e=function(t,e){if("object"!=pt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=pt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==pt(e)?e:e+""}var mt=function(){return t=function t(e,r,n){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),dt(this,"short",void 0),dt(this,"long",void 0),dt(this,"signal",void 0),dt(this,"prices",[]),dt(this,"result",void 0),this.short=e,this.long=r,this.signal=n},e=[{key:"getResult",value:function(){if(void 0===this.result)throw new S;return this.result}},{key:"isStable",get:function(){return void 0!==this.result}},{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.prices.length&&e?this.prices[this.prices.length-1]=t:this.prices.push(t);var r=this.short.update(t,e),n=this.long.update(t,e);if(this.prices.length>this.long.interval&&this.prices.shift(),this.prices.length===this.long.interval){var o=r-n,i=this.signal.update(o,e);return this.result={histogram:o-i,macd:o,signal:i}}}}],e&&vt(t.prototype,e),r&&vt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function gt(t){return gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gt(t)}function wt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,At(n.key),n)}}function Ot(t,e,r){return e=jt(e),function(t,e){if(e&&("object"==gt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,St()?Reflect.construct(e,r||[],jt(t).constructor):e.apply(t,r))}function St(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(St=function(){return!!t})()}function jt(t){return jt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},jt(t)}function _t(t,e){return _t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_t(t,e)}function Pt(t,e,r){return(e=At(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function At(t){var e=function(t,e){if("object"!=gt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=gt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==gt(e)?e:e+""}var Et=function(t){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:X;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Pt(r=Ot(this,e),"interval",void 0),Pt(r,"previousPrices",[]),Pt(r,"avgGain",void 0),Pt(r,"avgLoss",void 0),Pt(r,"maxValue",100),r.interval=t,r.avgGain=new n(r.interval),r.avgLoss=new n(r.interval),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_t(t,e)}(e,t),r=e,n=[{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.previousPrices.length&&e?this.previousPrices[this.previousPrices.length-1]=t:this.previousPrices.push(t),!(this.previousPrices.length<2)){var r=t,n=this.previousPrices[this.previousPrices.length-2];if(r>n?(this.avgLoss.update(0,e),this.avgGain.update(t-n,e)):(this.avgLoss.update(n-r,e),this.avgGain.update(0,e)),this.avgGain.isStable){var o=this.avgLoss.getResult();if(0===o)return this.setResult(100,e);var i=this.avgGain.getResult()/o;return this.setResult(this.maxValue-this.maxValue/(i+1),e)}}}}],n&&wt(r.prototype,n),o&&wt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(E);function kt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var Tt=function(t){var e=1/(arguments.length>1&&void 0!==arguments[1]?arguments[1]:.1);return Math.round(t*e)/e},It=function(t){return t.replace(/(?!^-)[^0-9.]/g,"")},Mt=function(t){for(var e=t.row,r=t.precisionMultiplier,n=t.priceBased,o={},i=0,a=Object.entries(e);i<a.length;i++){var u=(s=a[i],f=2,function(t){if(Array.isArray(t))return t}(s)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(s,f)||function(t,e){if(t){if("string"==typeof t)return kt(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?kt(t,e):void 0}}(s,f)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),c=u[0],l=u[1];n.includes(c)&&(l/=r),o[c]=l}var s,f;return o};function xt(t){return xt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xt(t)}function Rt(t){return function(t){if(Array.isArray(t))return Ct(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Ct(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ct(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ct(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Dt(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=xt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=xt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==xt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Bt=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.05;if(null==t||null==e)return null;var n=t>=0,o=Math.abs(t),i=e.upper,a=e.middle,u=e.lower;if(o<u)return 0;if(o>i)return n?1:-1;var c=Number.EPSILON*Math.max(o,Math.abs(a));if(Math.abs(o-a)<c)return n?.5:-.5;if(i===u)return null;var l=Tt((o-u)/(i-u),r);return n?l:-l};function Lt(t){return Lt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Lt(t)}function zt(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Ht(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function Vt(t){return function(t){if(Array.isArray(t))return Nt(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Ht(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ht(t,e){if(t){if("string"==typeof t)return Nt(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Nt(t,e):void 0}}function Nt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var Ut={ema:yt,sma:$},$t=function(t,e,r,n){if(!r||"object"!==Lt(r))throw new Error('"options" must be an object in '.concat(t,". eg: {target, height, range}"));var o=r.target,i=void 0===o?"close":o,a=r.diff,u=void 0===a?null:a;if("string"!=typeof i)throw new Error('"target" must be a valid keyName '.concat(t,"."));if("number"!=typeof e||e<=0)throw new Error('"size" must be a positive number in '.concat(t,"."));var c={target:i,diff:null};if(null!==u&&("object"===Lt(u)||"boolean"==typeof u&&!0===u)){var l=u=!0===u?{}:u,s=l.stdDev,f=void 0===s?2:s,h=l.scale,y=void 0===h?.05:h,p=l.targets,v=void 0===p?["close"]:p,d=l.size,b=void 0===d?e:d,m=l.lag,g=void 0===m?0:m;if("number"!=typeof f||f<=0)throw new Error('"diff.stdDev" must be a number greater than 0 in '.concat(t,"."));if("number"!=typeof y||!n.includes(y))throw new Error('"diff.scale" must be a number between 0.01 and 1 in '.concat(t,"."));if("number"!=typeof b||!Number.isInteger(b)||b<=0)throw new Error('"diff.size" must be an integer greater than or equal to size in '.concat(t,"."));if(!Array.isArray(v))throw new Error('"diff.targest" must be an array of keyNames with at least 1 item in '.concat(t,"."));if("number"!=typeof g||!Number.isInteger(g)||g<0)throw new Error('"diff.lag" must be an integer greater than 0 in '.concat(t,"."));c.diff={stdDev:f,scale:y,size:b,targets:v,lag:g}}return c};function qt(t){return qt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qt(t)}function Ft(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=qt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=qt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==qt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Gt(t){return function(t){if(Array.isArray(t))return Jt(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Jt(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Jt(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Jt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var Kt="close";function Yt(t){return Yt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yt(t)}function Qt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Wt(t){return Wt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wt(t)}function Xt(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=te(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function Zt(t){return function(t){if(Array.isArray(t))return ee(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||te(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function te(t,e){if(t){if("string"==typeof t)return ee(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ee(t,e):void 0}}function ee(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function re(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ne(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=Wt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Wt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Wt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function oe(t){return oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},oe(t)}function ie(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=ue(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function ae(t){return function(t){if(Array.isArray(t))return ce(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||ue(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ue(t,e){if(t){if("string"==typeof t)return ce(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ce(t,e):void 0}}function ce(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function le(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function se(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=oe(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=oe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==oe(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function fe(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var he=function(t,e){return t-e};function ye(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||ve(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pe(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=ve(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function ve(t,e){if(t){if("string"==typeof t)return de(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?de(t,e):void 0}}function de(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function be(t){return be="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},be(t)}var me=function(t,e){if(0===e){var r=t.inputParams.filter((function(t){return"lag"===t.key}));if("object"!==be(r))return;var n,o=r.map((function(t){return t.params})),i=pe(o);try{for(i.s();!(n=i.n()).done;){var a,u=ye(n.value,2),c=u[0],l=u[1],s=pe(c);try{for(s.s();!(a=s.n()).done;){var f=a.value;if(t.priceBased.includes(f))for(var h=1;h<=l;h++)t.priceBased.push("".concat(f,"_lag_").concat(h))}}catch(t){s.e(t)}finally{s.f()}}}catch(t){i.e(t)}finally{i.f()}t.instances.lag={lagParams:o}}var y,p,v=pe(t.instances.lag.lagParams);try{for(v.s();!(y=v.n()).done;){var d,b=ye(y.value,2),m=b[0],g=b[1],w=pe(m);try{for(w.s();!(d=w.n()).done;){var O=d.value,S=t.verticalOhlcv[O];if(0===e)for(var j=1;j<=g;j++){var _="".concat(O,"_lag_").concat(j);t.verticalOhlcv[_]=function(t){if(Array.isArray(t))return de(t)}(p=t.nullArray)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(p)||ve(p)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}for(var P=1;P<=g;P++){var A="".concat(O,"_lag_").concat(P),E=e-P;if(E<=0)break;t.pushToMain({index:e,key:A,value:S[E]})}}}catch(t){w.e(t)}finally{w.f()}}}catch(t){v.e(t)}finally{v.f()}return!0};function ge(t,e){if(t){if("string"==typeof t)return we(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?we(t,e):void 0}}function we(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Oe(t){return Oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Oe(t)}function Se(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,je(n.key),n)}}function je(t){var e=function(t,e){if("object"!=Oe(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Oe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Oe(e)?e:e+""}var _e=function(t,e){return t>e},Pe=function(t,e){return t<e},Ae=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Object.assign(this,{interval:0,prevState:.5,prevFast:null,prevSlow:null,prevHigh:null,prevLow:null,areHighAndLowUndefined:!1,index:0,crossIndexes:{up:[],down:[]}})},(e=[{key:"update",value:function(t){var e=t.fast,r=t.high,n=t.slow,o=t.low,i=this.prevState;this.areHighAndLowUndefined||void 0!==r&&void 0!==o||(this.areHighAndLowUndefined=!0),null===e||null===n||function(t,e){return t===e}(e,n)?i=.5:_e(e,n)?i=this.areHighAndLowUndefined?1:[o,n,this.prevLow,this.prevSlow].every((function(t){return null!==t}))&&Pe(o,n)&&_e(this.prevLow,this.prevSlow)?0:1:Pe(e,n)&&(i=this.areHighAndLowUndefined?0:[r,n,this.prevHigh,this.prevSlow].every((function(t){return null!==t}))&&_e(r,n)&&Pe(this.prevHigh,this.prevSlow)?1:0),.5===i?this.interval=0:1===i?this.prevState<=.5?this.interval=1:this.interval++:0===i&&(this.prevState>=.5?this.interval=-1:this.interval--),1===this.interval&&this.crossIndexes.up.push(this.index),-1===this.interval&&this.crossIndexes.down.push(this.index),Object.assign(this,{index:this.index+1,prevState:i,prevFast:e,prevSlow:n,prevHigh:r,prevLow:o})}},{key:"getResult",value:function(){return this.interval}}])&&Se(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}(),Ee=function(t,e){if(0===e){var r=t.inputParams.filter((function(t){return"crossPairs"===t.key}));if("object"!==Oe(r))return;t.instances.crossPairs={crossPairsList:r.flatMap((function(t){return t.params.flat()}))}}var n,o,i=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=ge(t))){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}(t.instances.crossPairs.crossPairsList);try{for(i.s();!(n=i.n()).done;){var a=n.value,u=a.fast,c=a.slow;if(u&&c){var l="".concat(u,"_x_").concat(c);if(0===e){if("number"==typeof c&&(t.verticalOhlcv[c]=new Array(t.len).fill(c)),"price"!==u&&!t.verticalOhlcv.hasOwnProperty(u))throw Error('fast "'.concat(u,' not found in crossPairs"'));if(!t.verticalOhlcv.hasOwnProperty(c))throw Error('slow "'.concat(c,' not found in crossPairs"'));t.instances[l]=new Ae,t.verticalOhlcv[l]=function(t){if(Array.isArray(t))return we(t)}(o=t.nullArray)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(o)||ge(o)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var s=void 0,f=void 0,h=void 0,y=void 0,p=void 0;"price"===u?(f=t.verticalOhlcv.close[e],h=t.verticalOhlcv.high[e],y=t.verticalOhlcv.low[e],p=t.verticalOhlcv[c][e],t.instances[l].update({fast:f,slow:p,high:h,low:y})):(s=t.verticalOhlcv[u][e],p=t.verticalOhlcv[c][e],t.instances[l].update({fast:s,slow:p})),t.pushToMain({index:e,key:l,value:t.instances[l].getResult()})}}}catch(t){i.e(t)}finally{i.f()}};function ke(t){return function(t){if(Array.isArray(t))return Te(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Te(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Te(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Te(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Ie(t){return function(t){if(Array.isArray(t))return Me(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Me(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Me(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Me(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var xe=["open","high","low","close","volume"];function Re(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Be(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function Ce(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.includes(n))continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],e.includes(r)||{}.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function De(t){return function(t){if(Array.isArray(t))return Le(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Be(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Be(t,e){if(t){if("string"==typeof t)return Le(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Le(t,e):void 0}}function Le(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var ze={dateTime:function(t,e){if(0===e){if(!t.isValidDate)throw Error('dateTime method found and invalid "date" in input ohlcv');var r=t.verticalOhlcv.date[0].slice(0,10);Object.assign(t.instances,{dateTime:{prevDateStr:r,sessionDailyIndexCount:0,sessionIntradayIndexCount:0,cachedDayInfo:r}}),Object.assign(t.verticalOhlcv,{day_of_the_week:ke(t.nullArray),day_of_the_month:ke(t.nullArray),week_of_the_month:ke(t.nullArray),hour:ke(t.nullArray),month:ke(t.nullArray),year:ke(t.nullArray),session_daily_index:ke(t.nullArray),session_intraday_index:ke(t.nullArray)})}var n=t.verticalOhlcv.date[e],o=function(t){var e=new Date(t),r=e.getMonth(),n=e.getFullYear(),o=e.getHours(),i=e.getMinutes(),a=e.getDay(),u=e.getDate(),c=new Date(e.getFullYear(),e.getMonth(),1).getDay();return{month:r,year:n,hour:o,minute:i,day_of_the_week:a,day_of_the_month:u,week_of_the_month:Math.ceil((u+c)/7)}}(n),i=o.day_of_the_week,a=o.day_of_the_month,u=o.week_of_the_month,c=o.month,l=o.year,s=o.hour,f=n.slice(0,10);f!==t.instances.dateTime.prevDateStr&&(t.instances.dateTime.prevDateStr=f,t.instances.dateTime.sessionDailyIndexCount++,t.instances.dateTime.sessionIntradayIndexCount=0),t.pushToMain({index:e,key:"session_daily_index",value:t.instances.dateTime.sessionDailyIndexCount}),t.pushToMain({index:e,key:"session_intraday_index",value:t.instances.dateTime.sessionIntradayIndexCount}),t.pushToMain({index:e,key:"day_of_the_week",value:i}),t.pushToMain({index:e,key:"day_of_the_month",value:a}),t.pushToMain({index:e,key:"week_of_the_month",value:u}),t.pushToMain({index:e,key:"month",value:c}),t.pushToMain({index:e,key:"year",value:l}),t.pushToMain({index:e,key:"hour",value:s})},priceVariations:function(t,e){0===e&&(t.priceBased=Ie(new Set([].concat(Ie(t.priceBased),["mid_price_open_close","mid_price_high_low"]))),Object.assign(t.verticalOhlcv,{mid_price_open_close:Ie(t.nullArray),mid_price_high_low:Ie(t.nullArray)}));var r=t.verticalOhlcv.open[e],n=t.verticalOhlcv.high[e],o=t.verticalOhlcv.low[e],i=t.verticalOhlcv.close[e];t.pushToMain({index:e,key:"mid_price_open_close",value:(r+i)/2}),t.pushToMain({index:e,key:"mid_price_high_low",value:(n+o)/2})},rsi:function(t,e,r,n){var o=n.scale,i=n.target,a=t.verticalOhlcv,u=t.instances,c=t.lastIndexReplace,l="close"===i?"":"_".concat(i),s="rsi_".concat(r).concat(l),f="rsi_sma_".concat(r).concat(l);if(0===e){var h=t.crossPairsList,y=t.nullArray;if(!a.hasOwnProperty(i))throw new Error("Target property ".concat(i," not found in verticalOhlcv for rsi."));h.push({fast:s,slow:f,isDefault:!0}),Object.assign(u,Dt(Dt({},s,new Et(r)),f,new $(r))),Object.assign(a,Dt(Dt({},s,Rt(y)),f,Rt(y)))}var p,v,d=a[i][e];u[s].update(d,c);try{p=u[s].getResult()}catch(t){p=null}p&&(o&&(p=Tt(p,o)),t.pushToMain({index:e,key:s,value:p}),u[f].update(p,c));try{v=u[f].getResult()}catch(t){v=null}return v&&(o&&(v=Tt(v,o)),t.pushToMain({index:e,key:f,value:v})),!0},movingAverages:function(t,e,r,n,o){var i=o.target,a=o.diff,u=t.verticalOhlcv,c=t.instances,l=t.priceBased,s=t.lastIndexReplace,f="string"==typeof i&&u.hasOwnProperty(i)&&"close"!==i?"_".concat(i):"",h="".concat(r,"_").concat(n).concat(f),y="".concat(r,"_").concat(n,"_diff").concat(f);if(0===e){var p=t.nullArray;if(!u.hasOwnProperty(i))throw new Error("Target property ".concat(i," not found in verticalOhlcv for ").concat(r,"."));if(c[h]={maInstance:new Ut[r](n)},u[h]=Vt(p),null!==a){c[h].diffInstance=new ot(a.size,a.stdDev);var v,d=[],b=zt(a.targets);try{for(b.s();!(v=b.n()).done;){var m=v.value;u["".concat(y,"_").concat(m)]=Vt(p),a.lag>0&&d.push("".concat(y,"_").concat(m))}}catch(t){b.e(t)}finally{b.f()}a.lag>0&&(console.log(d,a.lag),t.lag(d,a.lag))}l.push(h)}var g,w=u[i][e],O=c[h],S=O.maInstance,j=O.diffInstance;S.update(w,s);try{g=S.getResult()}catch(t){}if(g){if(t.pushToMain({index:e,key:h,value:g}),null===a)return!0;var _,P=zt(a.targets);try{for(P.s();!(_=P.n()).done;){var A=_.value,E=i===A?w-g:u[A][e];j.update(Math.abs(E),s);var k=void 0;try{k=j.getResult()}catch(t){k=null}t.pushToMain({index:e,key:"".concat(y,"_").concat(A),value:Bt(E,k,a.scale)})}}catch(t){P.e(t)}finally{P.f()}}},macd:function(t,e,r,n,o,i){var a=i.target,u=t.verticalOhlcv,c=t.instances,l="".concat(r,"_").concat(n,"_").concat(o).concat(a===Kt?"":"_".concat(a));if(0===e){var s=t.inputParams,f=t.crossPairsList,h=t.nullArray;if(!u.hasOwnProperty(a))throw new Error("Target property ".concat(a," not found in verticalOhlcv for macd."));var y=s.filter((function(t){return"macd"===t.key})).length,p=y>1?"macd_".concat(r,"_").concat(n,"_").concat(o):"macd",v=a===Kt?"".concat(p,"_diff"):"".concat(p,"_diff_").concat(a),d=a===Kt?"".concat(p,"_dea"):"".concat(p,"_dea_").concat(a),b=a===Kt?"".concat(p,"_histogram"):"".concat(p,"_histogram_").concat(a);f.push({fast:v,slow:d,isDefault:!0}),c.hasOwnProperty("macd")||(c.macd={numberOfIndicators:y,settings:{}}),c.macd.settings[l]=new mt(new yt(r),new yt(n),new yt(o)),Object.assign(u,Ft(Ft(Ft({},v,Gt(h)),d,Gt(h)),b,Gt(h)))}var m,g=c.macd,w=g.numberOfIndicators,O=g.settings,S=w>1?"macd_".concat(r,"_").concat(n,"_").concat(o):"macd",j=a===Kt?"".concat(S,"_diff"):"".concat(S,"_diff_").concat(a),_=a===Kt?"".concat(S,"_dea"):"".concat(S,"_dea_").concat(a),P=a===Kt?"".concat(S,"_histogram"):"".concat(S,"_histogram_").concat(a),A=O[l],E=u[a][e];A.update(E,t.lastIndexReplace);try{m=A.getResult()}catch(t){}return m&&(t.pushToMain({index:e,key:j,value:m.macd}),t.pushToMain({index:e,key:_,value:m.signal}),t.pushToMain({index:e,key:P,value:m.histogram})),!0},relativeVolume:function(t,e){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,o=(arguments.length>3?arguments[3]:void 0).scale,i="relative_volume_".concat(n);0===e&&(t.instances[i]={instance:new $(n),prevRelativeVolumeSma:null},Object.assign(t.verticalOhlcv,function(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=Yt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Yt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Yt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}({},i,function(t){if(Array.isArray(t))return Qt(t)}(r=t.nullArray)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(r)||function(t,e){if(t){if("string"==typeof t)return Qt(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Qt(t,e):void 0}}(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())));var a,u=t.verticalOhlcv.volume[e],c=t.instances[i].instance;c.update(u,t.lastIndexReplace);try{a=c.getResult()}catch(t){}var l=t.instances[i].prevRelativeVolumeSma,s=null;return null!==a&&null!==l&&(s=u/l,o&&(s=Tt(s,o))),t.pushToMain({index:e,key:i,value:s}),t.instances[i].prevRelativeVolumeSma=a,!0},donchianChannels:function(t,e,r,n,o){var i=o.height,a=o.range,u=o.scale,c="".concat(r,"_").concat(n),l=t.verticalOhlcv,s=t.instances,f=t.len;if(0===e){var h=t.inputParams,y=t.nullArray,p=t.priceBased,v=h.filter((function(t){return"donchianChannels"===t.key})).length,d=v>1?"donchian_channel_".concat(c):"donchian_channel";Object.assign(l,function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?re(Object(r),!0).forEach((function(e){ne(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):re(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}(ne(ne(ne({},"".concat(d,"_upper"),Zt(y)),"".concat(d,"_basis"),Zt(y)),"".concat(d,"_lower"),Zt(y)),i&&ne({},"".concat(d,"_height"),Zt(y)))),p.push("".concat(d,"_upper"),"".concat(d,"_basis"),"".concat(d,"_lower")),s.hasOwnProperty("donchian_channel")||(s.donchian_channel={numberOfIndicators:v,settings:{}});var b,m=Xt(a);try{for(m.s();!(b=m.n()).done;){var g=b.value;if(!(g in l)||!p.includes(g))throw new Error('Invalid range item value "'.concat(g,'" property for donchianChannels. Only price based key names are accepted:\n').concat(JSON.stringify(p)));l["".concat(d,"_range_").concat(g)]=Zt(y)}}catch(t){m.e(t)}finally{m.f()}s.donchian_channel.settings[c]={maxDeque:[],minDeque:[]}}var w=s.donchian_channel.numberOfIndicators>1?"donchian_channel_".concat(c):"donchian_channel",O=s.donchian_channel.settings[c],S=O.maxDeque,j=O.minDeque,_=e-n,P=_+1,A=P-r;if(A<0||P>f)return!0;for(var E=l.high,k=l.low;S.length&&S[0]<A;)S.shift();for(;S.length&&E[S[S.length-1]]<=E[_];)S.pop();for(S.push(_);j.length&&j[0]<A;)j.shift();for(;j.length&&k[j[j.length-1]]>=k[_];)j.pop();j.push(_);var T=E[S[0]],I=k[j[0]],M=(T+I)/2;if(t.pushToMain({index:e,key:"".concat(w,"_upper"),value:T}),t.pushToMain({index:e,key:"".concat(w,"_basis"),value:M}),t.pushToMain({index:e,key:"".concat(w,"_lower"),value:I}),i){var x=(T-I)/I;u&&(x=Tt(x,u)),t.pushToMain({index:e,key:"".concat(w,"_height"),value:x})}var R,C=Xt(a);try{for(C.s();!(R=C.n()).done;){var D=R.value,B=(l[D][e]-I)/(T-I);u&&(B=Tt(B,u)),t.pushToMain({index:e,key:"".concat(w,"_range_").concat(D),value:B})}}catch(t){C.e(t)}finally{C.f()}return!0},bollingerBands:function(t,e,r,n,o){var i,a=o.height,u=o.range,c=void 0===u?[]:u,l=o.zScore,s=void 0===l?[]:l,f=o.target,h=o.scale,y=t.verticalOhlcv,p=t.instances,v=t.lastIndexReplace,d="close"===f?"":"_".concat(f),b="".concat(r,"_").concat(n).concat(d);if(0===e){var m=t.nullArray,g=t.priceBased,w=t.inputParams;if(!(f in y))throw new Error('bollingerBands could not find target "'.concat(f,'"'));var O=w.filter((function(t){return"bollingerBands"===t.key})).length;i=O>1?"bollinger_bands_".concat(b):"bollinger_bands".concat(d),p.bollinger_bands||(p.bollinger_bands={numberOfIndicators:O,settings:{}}),p.bollinger_bands.settings[b]={instance:new ot(r,n)};var S=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?le(Object(r),!0).forEach((function(e){se(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):le(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}(se(se(se({},"".concat(i,"_upper"),ae(m)),"".concat(i,"_middle"),ae(m)),"".concat(i,"_lower"),ae(m)),a&&se({},"".concat(i,"_height"),ae(m)));t.priceBased.push("".concat(i,"_upper"),"".concat(i,"_middle"),"".concat(i,"_lower"));var j,_=ie(c);try{for(_.s();!(j=_.n()).done;){var P=j.value;if(!(P in y)||!g.includes(P))throw new Error('Invalid range item value "'.concat(P,'" property for bollingerBands. Only price based key names are accepted:\n').concat(JSON.stringify(g)));S["".concat(i,"_range_").concat(P)]=ae(m)}}catch(t){_.e(t)}finally{_.f()}var A,E=ie(s);try{for(E.s();!(A=E.n()).done;){var k=A.value;if(!(k in y)||!g.includes(k))throw new Error('Invalid zScore item value "'.concat(k,'" for bollingerBands. Only price based key names are accepted:\n').concat(JSON.stringify(g)));S["".concat(i,"_zscore_").concat(k)]=ae(m)}}catch(t){E.e(t)}finally{E.f()}Object.assign(y,S)}i||(i=p.bollinger_bands.numberOfIndicators>1?"bollinger_bands_".concat(b):"bollinger_bands".concat(d));var T,I=i,M=p.bollinger_bands.settings[b].instance,x=y[f][e];M.update(x,v);try{T=M.getResult()}catch(t){}if(!T)return!0;var R=T,C=R.upper,D=R.middle,B=R.lower;if(t.pushToMain({index:e,key:"".concat(I,"_upper"),value:C}),t.pushToMain({index:e,key:"".concat(I,"_middle"),value:D}),t.pushToMain({index:e,key:"".concat(I,"_lower"),value:B}),a){var L=(C-B)/B;h&&(L=Tt(L,h)),t.pushToMain({index:e,key:"".concat(I,"_height"),value:L})}var z,V=ie(c);try{for(V.s();!(z=V.n()).done;){var H=z.value,N=(y[H][e]-B)/(C-B);h&&(N=Tt(N,h)),t.pushToMain({index:e,key:"".concat(I,"_range_").concat(H),value:N})}}catch(t){V.e(t)}finally{V.f()}var U,$=ie(s);try{for($.s();!(U=$.n()).done;){var q=U.value,F=C-B,G=0!==F?2*n*(y[q][e]-D)/F:0;0!==F&&h&&(G=Tt(G,h)),t.pushToMain({index:e,key:"".concat(I,"_zscore_").concat(q),value:G})}}catch(t){$.e(t)}finally{$.f()}return!0},volumeOscillator:function(t,e,r,n,o){var i,a=o.scale,u=t.verticalOhlcv.volume[e],c="volume_oscillator";0===e&&(Object.assign(t.instances,{volume_oscillator:{fastEMA:new yt(r),slowEMA:new yt(n)}}),t.verticalOhlcv[c]=function(t){if(Array.isArray(t))return fe(t)}(i=t.nullArray)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(i)||function(t,e){if(t){if("string"==typeof t)return fe(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?fe(t,e):void 0}}(i)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),t.crossPairsList.push({fast:c,slow:0,isDefault:!0}));var l=t.instances[c],s=l.fastEMA,f=l.slowEMA;s.update(u,t.lastIndexReplace),f.update(u,t.lastIndexReplace);var h=null,y=null;try{h=s.getResult()}catch(t){h=null}try{y=f.getResult()}catch(t){y=null}var p=null;return"number"==typeof h&&"number"==typeof y&&0!==y&&(p=100*(h-y)/y,a&&(p=Tt(p,a))),t.pushToMain({index:e,key:c,value:p}),!0},candleStudies:function(t,e,r,n,o){var i=o.lag,a=o.scale,u=t.verticalOhlcv,c=t.instances,l=t.lastIndexReplace;if(0===e){var s=t.nullArray,f=[].concat(["candle_body","candle_top","candle_bottom"],["candle_gap"],["candle_change_close","candle_change_high","candle_change_low","candle_change_open"]);Object.assign(u,Object.fromEntries(f.map((function(t){return[t,s]})))),Object.assign(c,{candleStudies:{bodyInstance:new ot(r,n),closeInstance:new ot(r,n),highInstance:new ot(r,n),lowInstance:new ot(r,n),openInstance:new ot(r,n)}}),i>0&&t.lag(f,i)}var h=u.open[e-1],y=u.high[e-1],p=u.low[e-1],v=u.close[e-1];if(0===e)return!0;var d=u.open[e],b=u.high[e],m=u.low[e],g=u.close[e],w=he(g,d),O=he(b,Math.max(d,g)),S=he(Math.min(d,g),m),j=he(v,d),_=he(g,v),P=he(b,y),A=he(m,p),E=he(d,h),k=null,T=null,I=null,M=null,x=null,R=c.candleStudies,C=R.bodyInstance,D=R.closeInstance,B=R.highInstance,L=R.lowInstance,z=R.openInstance;C.update(Math.abs(w),l),D.update(Math.abs(_),l),B.update(Math.abs(P),l),L.update(Math.abs(A),l),z.update(Math.abs(E),l);try{k=C.getResult(),T=D.getResult(),I=B.getResult(),M=L.getResult(),x=z.getResult()}catch(t){}return t.pushToMain({index:e,key:"candle_body",value:Bt(w,k,a)}),t.pushToMain({index:e,key:"candle_top",value:Bt(O,k,a)}),t.pushToMain({index:e,key:"candle_bottom",value:Bt(S,k,a)}),t.pushToMain({index:e,key:"candle_gap",value:Bt(j,k,a)}),t.pushToMain({index:e,key:"candle_change_close",value:Bt(_,T,a)}),t.pushToMain({index:e,key:"candle_change_high",value:Bt(P,I,a)}),t.pushToMain({index:e,key:"candle_change_low",value:Bt(A,M,a)}),t.pushToMain({index:e,key:"candle_change_open",value:Bt(E,x,a)}),!0}},Ve=function(t,e,r){var n=function(t){return r>1?t*r:t};if("number"===e)return n(t);if("string"===e){var o=It(t);return n(Number(o))}return 0},He=function(t,e){return"number"===e?t:"string"===e?Number(It(t)):0},Ne=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=e.len,i=e.inputParams;e.nullArray=new Array(o).fill(null);var a=["open","high","low","close","volume"],u=new Set(a);if(0===n){!function(t){var e,n=t.inputParams,o=t.len,i=r(n);try{for(i.s();!(e=i.n()).done;){var a,u=r(e.value.params);try{for(u.s();!(a=u.n()).done;){var c=a.value;if("number"==typeof c&&c>o)throw console.log(c,o),new Error("At least one of the params of the indicator is greater than the input OHLCV length. Make sure to have enough datapoints in the input OHLCV.")}}catch(t){u.e(t)}finally{u.f()}}}catch(t){i.e(t)}finally{i.f()}}(e),a.forEach((function(t){e.verticalOhlcv[t]=De(e.nullArray)}));var c=Object.keys(t[0]).filter((function(t){return!u.has(t)}));c.forEach((function(t){e.verticalOhlcv[t]=De(e.nullArray)})),e.otherKeys=c,function(t,e){for(var r=0,n=Object.keys(e.inputTypes);r<n.length;r++){var o=n[r];if(!(o in t))throw new Error('Property "'.concat(o,'" not found in ohlcv array. ').concat(e.ticker));var i=t[o];if("number"==typeof i&&i>0)e.inputTypes[o]="number";else{if("string"!=typeof i||!/^(\d+(\.\d*)?|\.\d+)$/.test(i))throw new Error('Invalid property "'.concat(o,'" in ohlcv array. ').concat(e.ticker));e.inputTypes[o]="string",i=It(i)}if(0===e.precisionMultiplier&&!0===e.precision){var a=(l=String(i).split("."),s=2,function(t){if(Array.isArray(t))return t}(l)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(l,s)||Be(l,s)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[1],u=void 0===a?"":a,c=Math.max(4,u.length);e.precisionMultiplier=c>1?Math.pow(10,c-1):1}}var l,s}(t[0],e)}else if(!e.otherKeys)throw new Error("otherKeys not found in main. Ensure you run with startIndex=0 first to initialize.");for(var l=function(t){return Array.isArray(t)?t.map((function(t){var e=t.key,r=t.params;return{key:e,fn:ze[e],args:r}})):[]}(i),s=n;s<o;s++){var f=t[s],h=f.open,y=f.high,p=f.low,v=f.close,d=f.volume,b=Ce(f,xe),m=e.precisionMultiplier,g=Ve(h,e.inputTypes.open,m),w=Ve(y,e.inputTypes.high,m),O=Ve(p,e.inputTypes.low,m),S=Ve(v,e.inputTypes.close,m),j=He(d,e.inputTypes.volume);e.pushToMain({index:s,key:"open",value:g}),e.pushToMain({index:s,key:"high",value:w}),e.pushToMain({index:s,key:"low",value:O}),e.pushToMain({index:s,key:"close",value:S}),e.pushToMain({index:s,key:"volume",value:j});var _,P=Re(e.otherKeys);try{for(P.s();!(_=P.n()).done;){var A=_.value;e.pushToMain({index:s,key:A,value:b[A]})}}catch(t){P.e(t)}finally{P.f()}var E,k=Re(l);try{for(k.s();!(E=k.n()).done;){var T=E.value,I=T.key,M=T.fn,x=T.args;["crossPairs","lag"].includes(I)||M.apply(void 0,[e,s].concat(De(x)))}}catch(t){k.e(t)}finally{k.f()}me(e,s),Ee(e,s),e.lastComputedIndex++}},Ue=function(t,e){for(var r=t.length,n=new $(e),o=new Array(r),i=0,a=0,u=0,c=0;c<r;c++)if(n.update(t[c]),n.isStable){var l=n.getResult();o[c]=l,i+=l,a+=l*l,u++}else o[c]=null;var s=i/u,f=a/u-s*s,h=Math.sqrt(f);return o.map((function(t){return null!==t?(t-s)/h:null}))},$e=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5;if(t.length!==e.length)throw new Error("Both arrays must have the same length");for(var n=Ue(t,r),o=Ue(e,r),i=t.length,a=[],u=0,c=0,l=0,s=0,f=0,h=0,y=-1,p=0;p<i;p++){if(null!==n[p]&&null!==o[p]){y=p;break}a.push(0)}if(-1===y)return new Array(i).fill(0);for(var v=y;v<i;v++){var d=n[v],b=o[v];if(null!==d&&null!==b)if(u+=d,c+=b,l+=d*b,s+=d*d,f+=b*b,++h<2)a.push(0);else{var m=h*l-u*c,g=Math.sqrt((h*s-u*u)*(h*f-c*c)),w=0===g?0:m/g;a.push(w)}else u=c=l=s=f=h=0,a.push(0)}return a};function qe(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var Fe=function(t){for(var e=t.input,r=t.inputParams,n=new(0,t.OHLCV_INDICATORS)({input:e}),o=0;o<r.length;o++){var i=r[o],a=i.key,u=i.params;Array.isArray(u)&&(u.length>0?(Array.isArray(u)&&"crossPairs"===a&&Array.isArray(u[0])&&(u[0]=u[0].filter((function(t){return!t.isDefault}))),n[a].apply(n,function(t){if(Array.isArray(t))return qe(t)}(c=u)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(c)||function(t,e){if(t){if("string"==typeof t)return qe(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?qe(t,e):void 0}}(c)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())):n[a]())}var c;return n};function Ge(t){return function(t){if(Array.isArray(t))return Qe(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Ye(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Je(t){return Je="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Je(t)}function Ke(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||Ye(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ye(t,e){if(t){if("string"==typeof t)return Qe(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Qe(t,e):void 0}}function Qe(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function We(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Xe(t,e,r){return(e=tr(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ze(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,tr(n.key),n)}}function tr(t){var e=function(t,e){if("object"!=Je(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Je(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Je(e)?e:e+""}var er=[.01,.02,.025,.05,.1,.2,.25,.5,1],rr=function(){return t=function t(e){var r=e.input,n=e.ticker,o=void 0===n?null:n,i=e.precision,a=void 0===i||i;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!Array.isArray(r))throw Error("input OHLCV must be an array: "+o);if(0===r.length)throw Error("input OHLCV must not be empty: "+o);if(!r[0].hasOwnProperty("close"))throw Error("input OHLCV array objects require at least close property: "+o);return this.isComputed=!1,this.lastComputedIndex=0,this.input=r,this.inputTypes={open:"",high:"",low:"",close:"",volume:""},this.priceBased=["open","high","low","close"],this.len=r.length,this.lastIndexReplace=!1,this.instances={},this.crossPairsList=[],this.verticalOhlcv={},this.horizontalOhlcv=Array.from({length:this.len},(function(){return{}})),this.inputParams=[],this.studies={},this.utilities={correlation:$e},this.precision=a,this.precisionMultiplier=!0===this.precision?0:1,this.setIndicatorsFromInputParams=Fe,this},e=[{key:"pushToMain",value:function(t){var e=t.index,r=t.key,n=t.value;this.verticalOhlcv[r][e]=n,this.horizontalOhlcv[e][r]=n}},{key:"getDataAsCols",value:function(){this.compute();var t=this.precisionMultiplier,e=this.precision,r=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?We(Object(r),!0).forEach((function(e){Xe(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):We(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},this.verticalOhlcv);if(e)for(var n=0,o=Object.entries(r);n<o.length;n++){var i=Ke(o[n],2),a=i[0],u=i[1];this.priceBased.includes(a)&&(this.precision?r[a]=u.map((function(e){return e/t})):r[a]=u)}return r}},{key:"getData",value:function(){this.compute();var t=this.precisionMultiplier,e=this.priceBased;return this.precision?this.horizontalOhlcv.filter((function(t){return!Object.values(t).some((function(t){return null==t}))})).map((function(r){return Mt({row:r,precisionMultiplier:t,priceBased:e})})):this.horizontalOhlcv.filter((function(t){return!Object.values(t).some((function(t){return null==t}))}))}},{key:"getLastValues",value:function(){this.compute();var t=this.precisionMultiplier,e=this.priceBased;return this.precision?Mt({row:this.horizontalOhlcv[this.horizontalOhlcv.length-1],precisionMultiplier:t,priceBased:e}):this.horizontalOhlcv[this.horizontalOhlcv.length-1]}},{key:"compute",value:function(t){if(!0===this.isComputed&&!t)return this;if(this.isComputed=!1,this.isValidDate=this.input[0].hasOwnProperty("date")&&o(this.input[0].date),this.len>this.lastComputedIndex&&!t&&Ne(this.input,this,0),t&&"object"===Je(t)){var e;if(!["open","high","low","close","volume","date"].every((function(e){return Object.keys(t).includes(e)})))throw Error('Invalid OHLCV object sent in "compute". Correct usage: .compute({open: 108.25, high: 108.410004, low: 108.25, close: 99999999, volume: 875903, date: "2024-12-16 15:45:00" || "2024-12-16"})');if(!this.isValidDate)throw Error('All the OHLCV rows require a valid date property to access the compute change method. Correct date format: "2024-12-16 15:45:00" or "2024-12-16"');if(!o(t.date))throw Error('The date in the new OHLCV row is invalid. Correct date format: "2024-12-16 15:45:00" or "2024-12-16"');var r=t.date,n=this.len-1,i=null===(e=this.input[n])||void 0===e?void 0:e.date;0===this.lastComputedIndex&&this.compute(),i!==r?(this.len++,this.input.push(t),Ne(this.input,this,this.len)):(this.input[n]=t,Ne(this.input,this,n))}return this}},{key:"crossPairs",value:function(t){return i(this),this.crossPairsList=[].concat(Ge(this.crossPairsList),Ge(t)),this.inputParams.push({key:"crossPairs",params:[this.crossPairsList]}),this}},{key:"lag",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["close"],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;i(this),this.inputParams.push({key:"lag",params:[e,r]});for(var n=function(){var r=e[o];t.priceBased.find((function(t){return r===t}))&&t.priceBased.push(r)},o=0;o<e.length;o++)n();return this}},{key:"relativeVolume",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};i(this);var r=e.scale,n=void 0===r?null:r;if("number"==typeof n&&!er.includes(n))throw new Error('"scale" value in relativeVolume must be any of the following numbers: '.concat(er.join(", ")));return this.inputParams.push({key:"relativeVolume",params:[t,{scale:n}]}),this}},{key:"ema",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};i(this);var r=$t("ema",t,e,er);return this.inputParams.push({key:"movingAverages",params:["ema",t,r]}),this}},{key:"sma",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};i(this);var r=$t("sma",t,e,er);return this.inputParams.push({key:"movingAverages",params:["sma",t,r]}),this}},{key:"macd",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:12,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:26,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:9,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(i(this),"number"!=typeof t||t<=0)throw new Error('"fast" must be a positive number in macd.');if("number"!=typeof e||e<=t)throw new Error('"slow" must be a positive number greater than "fast" in macd.');if("number"!=typeof r||r<=0)throw new Error('"signal" must be a positive number in macd.');if("object"!==Je(n))throw new Error('"options" must be an object in macd. eg: {target}');var o=n.target,a=void 0===o?"close":o;return this.inputParams.push({key:"macd",params:[t,e,r,{target:a}]}),this}},{key:"bollingerBands",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(i(this),!r||"object"!==Je(r))throw new Error('"options" must be an object in bollingerBands. eg: {target, height, range}');var n=r.target,o=void 0===n?"close":n,a=r.height,u=void 0!==a&&a,c=r.range,l=void 0===c?[]:c,s=r.zScore,f=void 0===s?[]:s,h=r.scale,y=void 0===h?null:h;if("number"!=typeof t||t<=0)throw new Error('"size" must be a positive number in bollingerBands.');if("number"!=typeof e||e<=0)throw new Error('"stdDev" must be a positive number in bollingerBands.');if(!Array.isArray(l))throw new Error('If set, "range" must be a array of column names in bollingerBands.');if(!Array.isArray(f))throw new Error('If set, "zScore" must be a array of column names in bollingerBands.');if("boolean"!=typeof u)throw new Error('"height" must be a boolean in bollingerBands.');if("number"==typeof y&&!er.includes(y))throw new Error('"scale" value in bollingerBands must be any of the following numbers: '.concat(er.join(", ")));return this.inputParams.push({key:"bollingerBands",params:[t,e,{target:o,height:u,scale:y,range:l,zScore:f}]}),this}},{key:"rsi",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(i(this),"number"!=typeof t||t<=0)throw new Error('"size" must be a positive number in rsi.');var r=e.scale,n=void 0===r?null:r,o=e.target,a=void 0===o?"close":o;if("number"==typeof n&&!er.includes(n))throw new Error('"scale" value in rsi must be any of the following numbers: '.concat(er.join(", ")));return this.inputParams.push({key:"rsi",params:[t,{scale:n,target:a}]}),this}},{key:"donchianChannels",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(i(this),"number"!=typeof t||t<=0)throw new Error('"size" must be a positive number greater than 0 in donchianChannels.');if("number"!=typeof e||e<0)throw new Error('"offset" must be a number greater than or equal to 0 in donchianChannels.');var n=r.height,o=void 0!==n&&n,a=r.range,u=void 0===a?[]:a,c=r.scale,l=void 0===c?null:c;if(!Array.isArray(u))throw new Error('If set, "range" must be an array of column names in donchianChannels.');if("boolean"!=typeof o)throw new Error('"height" must be a boolean in donchianChannels.');if("number"==typeof l&&!er.includes(l))throw new Error('"scale" value in donchianChannels must be any of the following numbers: '.concat(er.join(", ")));return this.inputParams.push({key:"donchianChannels",params:[t,e,{height:o,range:u,scale:l}]}),this}},{key:"candleStudies",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(i(this),"number"!=typeof t||t<=0)throw new Error('"size" must be a positive number greater than 0 in candleStudies.');if("number"!=typeof e||e<=0)throw new Error('"stdDev" must be a positive number greater than 0 in candleStudies.');var n=r.lag,o=void 0===n?0:n,a=r.scale,u=void 0===a?.05:a;if("number"==typeof u&&!er.includes(u))throw new Error('"scale" value in candleStudies must be any of the following numbers: '.concat(er.join(", ")));return this.inputParams.push({key:"candleStudies",params:[t,e,{lag:o,scale:u}]}),this}},{key:"volumeOscillator",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(i(this),"number"!=typeof t||t<=1)throw new Error('fastSize" must be a positive number greater than 1 in volumeOscillator.');if("number"!=typeof e||e<=t)throw new Error('"slowSize" must be a positive number greater than the "fastSize" in volumeOscillator.');var n=r.scale,o=void 0===n?null:n;if("number"==typeof o&&!er.includes(o))throw new Error('"scale" value in volumeOscillator must be any of the following numbers: '.concat(er.join(", ")));return this.inputParams.push({key:"volumeOscillator",params:[t,e,{scale:o}]}),this}},{key:"dateTime",value:function(){return i(this),this.inputParams.push({key:"dateTime",params:[]}),this}},{key:"priceVariations",value:function(){return i(this),this.inputParams.push({key:"priceVariations",params:[]}),this}}],e&&Ze(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}()})(),OHLCV_INDICATORS=e})();