@guihz/trading-vue-editor-tes 0.0.298 → 0.0.299

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.
@@ -65,7 +65,7 @@ Example:
65
65
  * Dual licensed under the MIT or GPL Version 2 licenses.
66
66
  **/(function(o,e){(function(t){var r=2e3,M={s:1,n:0,d:1};function n(d,m){if(isNaN(d=parseInt(d,10)))throw A();return d*m}function b(d,m){if(m===0)throw q();var _=Object.create(l.prototype);_.s=d<0?-1:1,d=d<0?-d:d;var R=u(d,m);return _.n=d/R,_.d=m/R,_}function z(d){for(var m={},_=d,R=2,g=4;g<=_;){for(;_%R===0;)_/=R,m[R]=(m[R]||0)+1;g+=1+2*R++}return _!==d?_>1&&(m[_]=(m[_]||0)+1):m[d]=(m[d]||0)+1,m}var i=function(d,m){var _=0,R=1,g=1,L=0,y=0,D=0,T=1,N=1,w=0,C=1,P=1,H=1,Y=1e7,k;if(d!=null)if(m!==void 0){if(_=d,R=m,g=_*R,_%1!==0||R%1!==0)throw h()}else switch(typeof d){case"object":{if("d"in d&&"n"in d)_=d.n,R=d.d,"s"in d&&(_*=d.s);else if(0 in d)_=d[0],1 in d&&(R=d[1]);else throw A();g=_*R;break}case"number":{if(d<0&&(g=d,d=-d),d%1===0)_=d;else if(d>0){for(d>=1&&(N=Math.pow(10,Math.floor(1+Math.log(d)/Math.LN10)),d/=N);C<=Y&&H<=Y;)if(k=(w+P)/(C+H),d===k){C+H<=Y?(_=w+P,R=C+H):H>C?(_=P,R=H):(_=w,R=C);break}else d>k?(w+=P,C+=H):(P+=w,H+=C),C>Y?(_=P,R=H):(_=w,R=C);_*=N}else(isNaN(d)||isNaN(m))&&(R=_=NaN);break}case"string":{if(C=d.match(/\d+|./g),C===null)throw A();if(C[w]==="-"?(g=-1,w++):C[w]==="+"&&w++,C.length===w+1?y=n(C[w++],g):C[w+1]==="."||C[w]==="."?(C[w]!=="."&&(L=n(C[w++],g)),w++,(w+1===C.length||C[w+1]==="("&&C[w+3]===")"||C[w+1]==="'"&&C[w+3]==="'")&&(y=n(C[w],g),T=Math.pow(10,C[w].length),w++),(C[w]==="("&&C[w+2]===")"||C[w]==="'"&&C[w+2]==="'")&&(D=n(C[w+1],g),N=Math.pow(10,C[w+1].length)-1,w+=3)):C[w+1]==="/"||C[w+1]===":"?(y=n(C[w],g),T=n(C[w+2],1),w+=3):C[w+3]==="/"&&C[w+1]===" "&&(L=n(C[w],g),y=n(C[w+2],g),T=n(C[w+4],1),w+=5),C.length<=w){R=T*N,g=_=D+R*L+N*y;break}}default:throw A()}if(R===0)throw q();M.s=g<0?-1:1,M.n=Math.abs(_),M.d=Math.abs(R)};function c(d,m,_){for(var R=1;m>0;d=d*d%_,m>>=1)m&1&&(R=R*d%_);return R}function O(d,m){for(;m%2===0;m/=2);for(;m%5===0;m/=5);if(m===1)return 0;for(var _=10%m,R=1;_!==1;R++)if(_=_*10%m,R>r)return 0;return R}function s(d,m,_){for(var R=1,g=c(10,_,m),L=0;L<300;L++){if(R===g)return L;R=R*10%m,g=g*10%m}return 0}function u(d,m){if(!d)return m;if(!m)return d;for(;;){if(d%=m,!d)return m;if(m%=d,!m)return d}}function l(d,m){if(i(d,m),this instanceof l)d=u(M.d,M.n),this.s=M.s,this.n=M.n/d,this.d=M.d/d;else return b(M.s*M.n,M.d)}var q=function(){return new Error("Division by Zero")},A=function(){return new Error("Invalid argument")},h=function(){return new Error("Parameters must be integer")};l.prototype={s:1,n:0,d:1,abs:function(){return b(this.n,this.d)},neg:function(){return b(-this.s*this.n,this.d)},add:function(d,m){return i(d,m),b(this.s*this.n*M.d+M.s*this.d*M.n,this.d*M.d)},sub:function(d,m){return i(d,m),b(this.s*this.n*M.d-M.s*this.d*M.n,this.d*M.d)},mul:function(d,m){return i(d,m),b(this.s*M.s*this.n*M.n,this.d*M.d)},div:function(d,m){return i(d,m),b(this.s*M.s*this.n*M.d,this.d*M.n)},clone:function(){return b(this.s*this.n,this.d)},mod:function(d,m){if(isNaN(this.n)||isNaN(this.d))return new l(NaN);if(d===void 0)return b(this.s*this.n%this.d,1);if(i(d,m),M.n===0&&this.d===0)throw q();return b(this.s*(M.d*this.n)%(M.n*this.d),M.d*this.d)},gcd:function(d,m){return i(d,m),b(u(M.n,this.n)*u(M.d,this.d),M.d*this.d)},lcm:function(d,m){return i(d,m),M.n===0&&this.n===0?b(0,1):b(M.n*this.n,u(M.n,this.n)*u(M.d,this.d))},ceil:function(d){return d=Math.pow(10,d||0),isNaN(this.n)||isNaN(this.d)?new l(NaN):b(Math.ceil(d*this.s*this.n/this.d),d)},floor:function(d){return d=Math.pow(10,d||0),isNaN(this.n)||isNaN(this.d)?new l(NaN):b(Math.floor(d*this.s*this.n/this.d),d)},round:function(d){return d=Math.pow(10,d||0),isNaN(this.n)||isNaN(this.d)?new l(NaN):b(Math.round(d*this.s*this.n/this.d),d)},inverse:function(){return b(this.s*this.d,this.n)},pow:function(d,m){if(i(d,m),M.d===1)return M.s<0?b(Math.pow(this.s*this.d,M.n),Math.pow(this.n,M.n)):b(Math.pow(this.s*this.n,M.n),Math.pow(this.d,M.n));if(this.s<0)return null;var _=z(this.n),R=z(this.d),g=1,L=1;for(var y in _)if(y!=="1"){if(y==="0"){g=0;break}if(_[y]*=M.n,_[y]%M.d===0)_[y]/=M.d;else return null;g*=Math.pow(y,_[y])}for(var y in R)if(y!=="1"){if(R[y]*=M.n,R[y]%M.d===0)R[y]/=M.d;else return null;L*=Math.pow(y,R[y])}return M.s<0?b(L,g):b(g,L)},equals:function(d,m){return i(d,m),this.s*this.n*M.d===M.s*M.n*this.d},compare:function(d,m){i(d,m);var _=this.s*this.n*M.d-M.s*M.n*this.d;return(0<_)-(_<0)},simplify:function(d){if(isNaN(this.n)||isNaN(this.d))return this;d=d||.001;for(var m=this.abs(),_=m.toContinued(),R=1;R<_.length;R++){for(var g=b(_[R-1],1),L=R-2;L>=0;L--)g=g.inverse().add(_[L]);if(Math.abs(g.sub(m).valueOf())<d)return g.mul(this.s)}return this},divisible:function(d,m){return i(d,m),!(!(M.n*this.d)||this.n*M.d%(M.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(d){var m,_="",R=this.n,g=this.d;return this.s<0&&(_+="-"),g===1?_+=R:(d&&(m=Math.floor(R/g))>0&&(_+=m,_+=" ",R%=g),_+=R,_+="/",_+=g),_},toLatex:function(d){var m,_="",R=this.n,g=this.d;return this.s<0&&(_+="-"),g===1?_+=R:(d&&(m=Math.floor(R/g))>0&&(_+=m,R%=g),_+="\\frac{",_+=R,_+="}{",_+=g,_+="}"),_},toContinued:function(){var d,m=this.n,_=this.d,R=[];if(isNaN(m)||isNaN(_))return R;do R.push(Math.floor(m/_)),d=m%_,m=_,_=d;while(m!==1);return R},toString:function(d){var m=this.n,_=this.d;if(isNaN(m)||isNaN(_))return"NaN";d=d||15;var R=O(m,_),g=s(m,_,R),L=this.s<0?"-":"";if(L+=m/_|0,m%=_,m*=10,m&&(L+="."),R){for(var y=g;y--;)L+=m/_|0,m%=_,m*=10;L+="(";for(var y=R;y--;)L+=m/_|0,m%=_,m*=10;L+=")"}else for(var y=d;m&&y--;)L+=m/_|0,m%=_,m*=10;return L}},Object.defineProperty(l,"__esModule",{value:!0}),l.default=l,l.Fraction=l,o.exports=l})()})(fa);var R5=fa.exports,rt=B1(R5),v5="Fraction",L5=[],N5=h0(v5,L5,()=>(Object.defineProperty(rt,"name",{value:"Fraction"}),rt.prototype.constructor=rt,rt.prototype.type="Fraction",rt.prototype.isFraction=!0,rt.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},rt.fromJSON=function(o){return new rt(o)},rt),{isClass:!0}),y5="Matrix",B5=[],w5=h0(y5,B5,()=>{function o(){if(!(this instanceof o))throw new SyntaxError("Constructor must be called with the new operator")}return o.prototype.type="Matrix",o.prototype.isMatrix=!0,o.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},o.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},o.prototype.create=function(e,t){throw new Error("Cannot invoke create on a Matrix interface")},o.prototype.subset=function(e,t,r){throw new Error("Cannot invoke subset on a Matrix interface")},o.prototype.get=function(e){throw new Error("Cannot invoke get on a Matrix interface")},o.prototype.set=function(e,t,r){throw new Error("Cannot invoke set on a Matrix interface")},o.prototype.resize=function(e,t){throw new Error("Cannot invoke resize on a Matrix interface")},o.prototype.reshape=function(e,t){throw new Error("Cannot invoke reshape on a Matrix interface")},o.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},o.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},o.prototype.map=function(e,t){throw new Error("Cannot invoke map on a Matrix interface")},o.prototype.forEach=function(e){throw new Error("Cannot invoke forEach on a Matrix interface")},o.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},o.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},o.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},o.prototype.format=function(e){throw new Error("Cannot invoke format on a Matrix interface")},o.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},o},{isClass:!0});function la(o){return Object.keys(o.signatures||{}).reduce(function(e,t){var r=(t.match(/,/g)||[]).length+1;return Math.max(e,r)},-1)}var D5="DenseMatrix",X5=["Matrix"],E5=h0(D5,X5,o=>{var{Matrix:e}=o;function t(O,s){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");if(s&&!Te(s))throw new Error("Invalid datatype: "+s);if(P1(O))O.type==="DenseMatrix"?(this._data=g1(O._data),this._size=g1(O._size),this._datatype=s||O._datatype):(this._data=O.toArray(),this._size=O.size(),this._datatype=s||O._datatype);else if(O&&V1(O.data)&&V1(O.size))this._data=O.data,this._size=O.size,jc(this._data,this._size),this._datatype=s||O.datatype;else if(V1(O))this._data=c(O),this._size=o2(this._data),jc(this._data,this._size),this._datatype=s;else{if(O)throw new TypeError("Unsupported type of data ("+_t(O)+")");this._data=[],this._size=[0],this._datatype=s}}t.prototype=new e,t.prototype.createDenseMatrix=function(O,s){return new t(O,s)},Object.defineProperty(t,"name",{value:"DenseMatrix"}),t.prototype.constructor=t,t.prototype.type="DenseMatrix",t.prototype.isDenseMatrix=!0,t.prototype.getDataType=function(){return ho(this._data,_t)},t.prototype.storage=function(){return"dense"},t.prototype.datatype=function(){return this._datatype},t.prototype.create=function(O,s){return new t(O,s)},t.prototype.subset=function(O,s,u){switch(arguments.length){case 1:return r(this,O);case 2:case 3:return n(this,O,s,u);default:throw new SyntaxError("Wrong number of arguments")}},t.prototype.get=function(O){if(!V1(O))throw new TypeError("Array expected");if(O.length!==this._size.length)throw new d1(O.length,this._size.length);for(var s=0;s<O.length;s++)K1(O[s],this._size[s]);for(var u=this._data,l=0,q=O.length;l<q;l++){var A=O[l];K1(A,u.length),u=u[A]}return u},t.prototype.set=function(O,s,u){if(!V1(O))throw new TypeError("Array expected");if(O.length<this._size.length)throw new d1(O.length,this._size.length,"<");var l,q,A,h=O.map(function(m){return m+1});i(this,h,u);var d=this._data;for(l=0,q=O.length-1;l<q;l++)A=O[l],K1(A,d.length),d=d[A];return A=O[O.length-1],K1(A,d.length),d[A]=s,this};function r(O,s){if(!Ub(s))throw new TypeError("Invalid index");var u=s.isScalar();if(u)return O.get(s.min());var l=s.size();if(l.length!==O._size.length)throw new d1(l.length,O._size.length);for(var q=s.min(),A=s.max(),h=0,d=O._size.length;h<d;h++)K1(q[h],O._size[h]),K1(A[h],O._size[h]);return new t(M(O._data,s,l.length,0),O._datatype)}function M(O,s,u,l){var q=l===u-1,A=s.dimension(l);return q?A.map(function(h){return K1(h,O.length),O[h]}).valueOf():A.map(function(h){K1(h,O.length);var d=O[h];return M(d,s,u,l+1)}).valueOf()}function n(O,s,u,l){if(!s||s.isIndex!==!0)throw new TypeError("Invalid index");var q=s.size(),A=s.isScalar(),h;if(P1(u)?(h=u.size(),u=u.valueOf()):h=o2(u),A){if(h.length!==0)throw new TypeError("Scalar expected");O.set(s.min(),u,l)}else{if(!gr(h,q))try{h.length===0?u=Jc([u],q):u=Jc(u,q),h=o2(u)}catch{}if(q.length<O._size.length)throw new d1(q.length,O._size.length,"<");if(h.length<q.length){for(var d=0,m=0;q[d]===1&&h[d]===1;)d++;for(;q[d]===1;)m++,d++;u=Yc(u,q.length,m,h)}if(!gr(q,h))throw new d1(q,h,">");var _=s.max().map(function(L){return L+1});i(O,_,l);var R=q.length,g=0;b(O._data,s,u,R,g)}return O}function b(O,s,u,l,q){var A=q===l-1,h=s.dimension(q);A?h.forEach(function(d,m){K1(d),O[d]=u[m[0]]}):h.forEach(function(d,m){K1(d),b(O[d],s,u[m[0]],l,q+1)})}t.prototype.resize=function(O,s,u){if(!uM(O))throw new TypeError("Array or Matrix expected");var l=O.valueOf().map(A=>Array.isArray(A)&&A.length===1?A[0]:A),q=u?this.clone():this;return z(q,l,s)};function z(O,s,u){if(s.length===0){for(var l=O._data;V1(l);)l=l[0];return l}return O._size=s.slice(0),O._data=Vb(O._data,O._size,u),O}t.prototype.reshape=function(O,s){var u=s?this.clone():this;u._data=Jb(u._data,O);var l=u._size.reduce((q,A)=>q*A);return u._size=Qb(O,l),u};function i(O,s,u){for(var l=O._size.slice(0),q=!1;l.length<s.length;)l.push(0),q=!0;for(var A=0,h=s.length;A<h;A++)s[A]>l[A]&&(l[A]=s[A],q=!0);q&&z(O,l,u)}t.prototype.clone=function(){var O=new t({data:g1(this._data),size:g1(this._size),datatype:this._datatype});return O},t.prototype.size=function(){return this._size.slice(0)},t.prototype.map=function(O){var s=this,u=la(O),l=function h(d,m){return V1(d)?d.map(function(_,R){return h(_,m.concat(R))}):u===1?O(d):u===2?O(d,m):O(d,m,s)},q=l(this._data,[]),A=this._datatype!==void 0?ho(q,_t):void 0;return new t(q,A)},t.prototype.forEach=function(O){var s=this,u=function l(q,A){V1(q)?q.forEach(function(h,d){l(h,A.concat(d))}):O(q,A,s)};u(this._data,[])},t.prototype[Symbol.iterator]=function*(){var O=function*s(u,l){if(V1(u))for(var q=0;q<u.length;q++)yield*s(u[q],l.concat(q));else yield{value:u,index:l}};yield*O(this._data,[])},t.prototype.rows=function(){var O=[],s=this.size();if(s.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");var u=this._data;for(var l of u)O.push(new t([l],this._datatype));return O},t.prototype.columns=function(){var O=this,s=[],u=this.size();if(u.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");for(var l=this._data,q=function(d){var m=l.map(_=>[_[d]]);s.push(new t(m,O._datatype))},A=0;A<u[1];A++)q(A);return s},t.prototype.toArray=function(){return g1(this._data)},t.prototype.valueOf=function(){return this._data},t.prototype.format=function(O){return D1(this._data,O)},t.prototype.toString=function(){return D1(this._data)},t.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},t.prototype.diagonal=function(O){if(O){if(e2(O)&&(O=O.toNumber()),!C1(O)||!U1(O))throw new TypeError("The parameter k must be an integer number")}else O=0;for(var s=O>0?O:0,u=O<0?-O:0,l=this._size[0],q=this._size[1],A=Math.min(l-u,q-s),h=[],d=0;d<A;d++)h[d]=this._data[d+u][d+s];return new t({data:h,size:[A],datatype:this._datatype})},t.diagonal=function(O,s,u,l){if(!V1(O))throw new TypeError("Array expected, size parameter");if(O.length!==2)throw new Error("Only two dimensions matrix are supported");if(O=O.map(function(y){if(e2(y)&&(y=y.toNumber()),!C1(y)||!U1(y)||y<1)throw new Error("Size values must be positive integers");return y}),u){if(e2(u)&&(u=u.toNumber()),!C1(u)||!U1(u))throw new TypeError("The parameter k must be an integer number")}else u=0;var q=u>0?u:0,A=u<0?-u:0,h=O[0],d=O[1],m=Math.min(h-A,d-q),_;if(V1(s)){if(s.length!==m)throw new Error("Invalid value array length");_=function(D){return s[D]}}else if(P1(s)){var R=s.size();if(R.length!==1||R[0]!==m)throw new Error("Invalid matrix length");_=function(D){return s.get([D])}}else _=function(){return s};l||(l=e2(_(0))?_(0).mul(0):0);var g=[];if(O.length>0){g=Vb(g,O,l);for(var L=0;L<m;L++)g[L+A][L+q]=_(L)}return new t({data:g,size:[h,d]})},t.fromJSON=function(O){return new t(O)},t.prototype.swapRows=function(O,s){if(!C1(O)||!U1(O)||!C1(s)||!U1(s))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return K1(O,this._size[0]),K1(s,this._size[0]),t._swapRows(O,s,this._data),this},t._swapRows=function(O,s,u){var l=u[O];u[O]=u[s],u[s]=l};function c(O){return P1(O)?c(O.valueOf()):V1(O)?O.map(c):O}return t},{isClass:!0});function T5(o){var e=o.length,t=o[0].length,r,M,n=[];for(M=0;M<t;M++){var b=[];for(r=0;r<e;r++)b.push(o[r][M]);n.push(b)}return n}function Bo(o){for(var e=0;e<o.length;e++)if(uM(o[e]))return!0;return!1}function lM(o,e){P1(o)&&(o=o.valueOf());for(var t=0,r=o.length;t<r;t++){var M=o[t];Array.isArray(M)?lM(M,e):e(M)}}function Re(o,e,t){return o&&typeof o.map=="function"?o.map(function(r){return Re(r,e)}):e(o)}function zp(o,e,t){var r=Array.isArray(o)?o2(o):o.size();if(e<0||e>=r.length)throw new mt(e,r.length);return P1(o)?o.create(wo(o.valueOf(),e,t)):wo(o,e,t)}function wo(o,e,t){var r,M,n,b;if(e<=0)if(Array.isArray(o[0])){for(b=T5(o),M=[],r=0;r<b.length;r++)M[r]=wo(b[r],e-1,t);return M}else{for(n=o[0],r=1;r<o.length;r++)n=t(n,o[r]);return n}else{for(M=[],r=0;r<o.length;r++)M[r]=wo(o[r],e-1,t);return M}}var da="isInteger",C5=["typed"],x5=h0(da,C5,o=>{var{typed:e}=o;return e(da,{number:U1,BigNumber:function(r){return r.isInt()},Fraction:function(r){return r.d===1&&isFinite(r.n)},"Array | Matrix":e.referToSelf(t=>r=>Re(r,t))})}),qa="number",Do="number, number";function ha(o){return Math.abs(o)}ha.signature=qa;function Wa(o,e){return o+e}Wa.signature=Do;function _a(o,e){return o-e}_a.signature=Do;function ma(o,e){return o*e}ma.signature=Do;function ga(o){return-o}ga.signature=qa;function Ra(o,e){return o*o<1&&e===1/0||o*o>1&&e===-1/0?0:Math.pow(o,e)}Ra.signature=Do;var va="number";function La(o){return o===0}La.signature=va;function Na(o){return Number.isNaN(o)}Na.signature=va;var ya="isNumeric",S5=["typed"],F5=h0(ya,S5,o=>{var{typed:e}=o;return e(ya,{"number | BigNumber | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":e.referToSelf(t=>r=>Re(r,t))})}),Ba="isZero",I5=["typed"],P5=h0(Ba,I5,o=>{var{typed:e}=o;return e(Ba,{number:La,BigNumber:function(r){return r.isZero()},Complex:function(r){return r.re===0&&r.im===0},Fraction:function(r){return r.d===1&&r.n===0},Unit:e.referToSelf(t=>r=>e.find(t,r.valueType())(r.value)),"Array | Matrix":e.referToSelf(t=>r=>Re(r,t))})}),wa="isNaN",k5=["typed"],$5=h0(wa,k5,o=>{var{typed:e}=o;return e(wa,{number:Na,BigNumber:function(r){return r.isNaN()},Fraction:function(r){return!1},Complex:function(r){return r.isNaN()},Unit:function(r){return Number.isNaN(r.value)},"Array | Matrix":function(r){return Re(r,Number.isNaN)}})});function Xo(o,e,t){if(t==null)return o.eq(e);if(o.eq(e))return!0;if(o.isNaN()||e.isNaN())return!1;if(o.isFinite()&&e.isFinite()){var r=o.minus(e).abs();if(r.isZero())return!0;var M=o.constructor.max(o.abs(),e.abs());return r.lte(M.times(t))}return!1}function U5(o,e,t){return Gt(o.re,e.re,t)&&Gt(o.im,e.im,t)}var Eo=h0("compareUnits",["typed"],o=>{var{typed:e}=o;return{"Unit, Unit":e.referToSelf(t=>(r,M)=>{if(!r.equalBase(M))throw new Error("Cannot compare units with different base");return e.find(t,[r.valueType(),M.valueType()])(r.value,M.value)})}}),To="equalScalar",j5=["typed","config"],H5=h0(To,j5,o=>{var{typed:e,config:t}=o,r=Eo({typed:e});return e(To,{"boolean, boolean":function(n,b){return n===b},"number, number":function(n,b){return Gt(n,b,t.epsilon)},"BigNumber, BigNumber":function(n,b){return n.eq(b)||Xo(n,b,t.epsilon)},"Fraction, Fraction":function(n,b){return n.equals(b)},"Complex, Complex":function(n,b){return U5(n,b,t.epsilon)}},r)});h0(To,["typed","config"],o=>{var{typed:e,config:t}=o;return e(To,{"number, number":function(M,n){return Gt(M,n,t.epsilon)}})});var Y5="SparseMatrix",G5=["typed","equalScalar","Matrix"],V5=h0(Y5,G5,o=>{var{typed:e,equalScalar:t,Matrix:r}=o;function M(A,h){if(!(this instanceof M))throw new SyntaxError("Constructor must be called with the new operator");if(h&&!Te(h))throw new Error("Invalid datatype: "+h);if(P1(A))n(this,A,h);else if(A&&V1(A.index)&&V1(A.ptr)&&V1(A.size))this._values=A.values,this._index=A.index,this._ptr=A.ptr,this._size=A.size,this._datatype=h||A.datatype;else if(V1(A))b(this,A,h);else{if(A)throw new TypeError("Unsupported type of data ("+_t(A)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=h}}function n(A,h,d){h.type==="SparseMatrix"?(A._values=h._values?g1(h._values):void 0,A._index=g1(h._index),A._ptr=g1(h._ptr),A._size=g1(h._size),A._datatype=d||h._datatype):b(A,h.valueOf(),d||h._datatype)}function b(A,h,d){A._values=[],A._index=[],A._ptr=[],A._datatype=d;var m=h.length,_=0,R=t,g=0;if(Te(d)&&(R=e.find(t,[d,d])||t,g=e.convert(0,d)),m>0){var L=0;do{A._ptr.push(A._index.length);for(var y=0;y<m;y++){var D=h[y];if(V1(D)){if(L===0&&_<D.length&&(_=D.length),L<D.length){var T=D[L];R(T,g)||(A._values.push(T),A._index.push(y))}}else L===0&&_<1&&(_=1),R(D,g)||(A._values.push(D),A._index.push(y))}L++}while(L<_)}A._ptr.push(A._index.length),A._size=[m,_]}M.prototype=new r,M.prototype.createSparseMatrix=function(A,h){return new M(A,h)},Object.defineProperty(M,"name",{value:"SparseMatrix"}),M.prototype.constructor=M,M.prototype.type="SparseMatrix",M.prototype.isSparseMatrix=!0,M.prototype.getDataType=function(){return ho(this._values,_t)},M.prototype.storage=function(){return"sparse"},M.prototype.datatype=function(){return this._datatype},M.prototype.create=function(A,h){return new M(A,h)},M.prototype.density=function(){var A=this._size[0],h=this._size[1];return A!==0&&h!==0?this._index.length/(A*h):0},M.prototype.subset=function(A,h,d){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return z(this,A);case 2:case 3:return i(this,A,h,d);default:throw new SyntaxError("Wrong number of arguments")}};function z(A,h){if(!Ub(h))throw new TypeError("Invalid index");var d=h.isScalar();if(d)return A.get(h.min());var m=h.size();if(m.length!==A._size.length)throw new d1(m.length,A._size.length);var _,R,g,L,y=h.min(),D=h.max();for(_=0,R=A._size.length;_<R;_++)K1(y[_],A._size[_]),K1(D[_],A._size[_]);var T=A._values,N=A._index,w=A._ptr,C=h.dimension(0),P=h.dimension(1),H=[],Y=[];C.forEach(function(b0,O0){Y[b0]=O0[0],H[b0]=!0});var k=T?[]:void 0,K=[],e0=[];return P.forEach(function(b0){for(e0.push(K.length),g=w[b0],L=w[b0+1];g<L;g++)_=N[g],H[_]===!0&&(K.push(Y[_]),k&&k.push(T[g]))}),e0.push(K.length),new M({values:k,index:K,ptr:e0,size:m,datatype:A._datatype})}function i(A,h,d,m){if(!h||h.isIndex!==!0)throw new TypeError("Invalid index");var _=h.size(),R=h.isScalar(),g;if(P1(d)?(g=d.size(),d=d.toArray()):g=o2(d),R){if(g.length!==0)throw new TypeError("Scalar expected");A.set(h.min(),d,m)}else{if(_.length!==1&&_.length!==2)throw new d1(_.length,A._size.length,"<");if(g.length<_.length){for(var L=0,y=0;_[L]===1&&g[L]===1;)L++;for(;_[L]===1;)y++,L++;d=Yc(d,_.length,y,g)}if(!gr(_,g))throw new d1(_,g,">");if(_.length===1){var D=h.dimension(0);D.forEach(function(w,C){K1(w),A.set([w,0],d[C[0]],m)})}else{var T=h.dimension(0),N=h.dimension(1);T.forEach(function(w,C){K1(w),N.forEach(function(P,H){K1(P),A.set([w,P],d[C[0]][H[0]],m)})})}}return A}M.prototype.get=function(A){if(!V1(A))throw new TypeError("Array expected");if(A.length!==this._size.length)throw new d1(A.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var h=A[0],d=A[1];K1(h,this._size[0]),K1(d,this._size[1]);var m=c(h,this._ptr[d],this._ptr[d+1],this._index);return m<this._ptr[d+1]&&this._index[m]===h?this._values[m]:0},M.prototype.set=function(A,h,d){if(!V1(A))throw new TypeError("Array expected");if(A.length!==this._size.length)throw new d1(A.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var m=A[0],_=A[1],R=this._size[0],g=this._size[1],L=t,y=0;Te(this._datatype)&&(L=e.find(t,[this._datatype,this._datatype])||t,y=e.convert(0,this._datatype)),(m>R-1||_>g-1)&&(u(this,Math.max(m+1,R),Math.max(_+1,g),d),R=this._size[0],g=this._size[1]),K1(m,R),K1(_,g);var D=c(m,this._ptr[_],this._ptr[_+1],this._index);return D<this._ptr[_+1]&&this._index[D]===m?L(h,y)?O(D,_,this._values,this._index,this._ptr):this._values[D]=h:L(h,y)||s(D,m,_,h,this._values,this._index,this._ptr),this};function c(A,h,d,m){if(d-h===0)return d;for(var _=h;_<d;_++)if(m[_]===A)return _;return h}function O(A,h,d,m,_){d.splice(A,1),m.splice(A,1);for(var R=h+1;R<_.length;R++)_[R]--}function s(A,h,d,m,_,R,g){_.splice(A,0,m),R.splice(A,0,h);for(var L=d+1;L<g.length;L++)g[L]++}M.prototype.resize=function(A,h,d){if(!uM(A))throw new TypeError("Array or Matrix expected");var m=A.valueOf().map(R=>Array.isArray(R)&&R.length===1?R[0]:R);if(m.length!==2)throw new Error("Only two dimensions matrix are supported");m.forEach(function(R){if(!C1(R)||!U1(R)||R<0)throw new TypeError("Invalid size, must contain positive integers (size: "+D1(m)+")")});var _=d?this.clone():this;return u(_,m[0],m[1],h)};function u(A,h,d,m){var _=m||0,R=t,g=0;Te(A._datatype)&&(R=e.find(t,[A._datatype,A._datatype])||t,g=e.convert(0,A._datatype),_=e.convert(_,A._datatype));var L=!R(_,g),y=A._size[0],D=A._size[1],T,N,w;if(d>D){for(N=D;N<d;N++)if(A._ptr[N]=A._values.length,L)for(T=0;T<y;T++)A._values.push(_),A._index.push(T);A._ptr[d]=A._values.length}else d<D&&(A._ptr.splice(d+1,D-d),A._values.splice(A._ptr[d],A._values.length),A._index.splice(A._ptr[d],A._index.length));if(D=d,h>y){if(L){var C=0;for(N=0;N<D;N++){A._ptr[N]=A._ptr[N]+C,w=A._ptr[N+1]+C;var P=0;for(T=y;T<h;T++,P++)A._values.splice(w+P,0,_),A._index.splice(w+P,0,T),C++}A._ptr[D]=A._values.length}}else if(h<y){var H=0;for(N=0;N<D;N++){A._ptr[N]=A._ptr[N]-H;var Y=A._ptr[N],k=A._ptr[N+1]-H;for(w=Y;w<k;w++)T=A._index[w],T>h-1&&(A._values.splice(w,1),A._index.splice(w,1),H++)}A._ptr[N]=A._values.length}return A._size[0]=h,A._size[1]=d,A}M.prototype.reshape=function(A,h){if(!V1(A))throw new TypeError("Array expected");if(A.length!==2)throw new Error("Sparse matrices can only be reshaped in two dimensions");A.forEach(function(b0){if(!C1(b0)||!U1(b0)||b0<=-2||b0===0)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+D1(A)+")")});var d=this._size[0]*this._size[1];A=Qb(A,d);var m=A[0]*A[1];if(d!==m)throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var _=h?this.clone():this;if(this._size[0]===A[0]&&this._size[1]===A[1])return _;for(var R=[],g=0;g<_._ptr.length;g++)for(var L=0;L<_._ptr[g+1]-_._ptr[g];L++)R.push(g);for(var y=_._values.slice(),D=_._index.slice(),T=0;T<_._index.length;T++){var N=D[T],w=R[T],C=N*_._size[1]+w;R[T]=C%A[1],D[T]=Math.floor(C/A[1])}_._values.length=0,_._index.length=0,_._ptr.length=A[1]+1,_._size=A.slice();for(var P=0;P<_._ptr.length;P++)_._ptr[P]=0;for(var H=0;H<y.length;H++){var Y=D[H],k=R[H],K=y[H],e0=c(Y,_._ptr[k],_._ptr[k+1],_._index);s(e0,Y,k,K,_._values,_._index,_._ptr)}return _},M.prototype.clone=function(){var A=new M({values:this._values?g1(this._values):void 0,index:g1(this._index),ptr:g1(this._ptr),size:g1(this._size),datatype:this._datatype});return A},M.prototype.size=function(){return this._size.slice(0)},M.prototype.map=function(A,h){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var d=this,m=this._size[0],_=this._size[1],R=la(A),g=function(y,D,T){return R===1?A(y):R===2?A(y,[D,T]):A(y,[D,T],d)};return l(this,0,m-1,0,_-1,g,h)};function l(A,h,d,m,_,R,g){var L=[],y=[],D=[],T=t,N=0;Te(A._datatype)&&(T=e.find(t,[A._datatype,A._datatype])||t,N=e.convert(0,A._datatype));for(var w=function(A0,$0,P0){A0=R(A0,$0,P0),T(A0,N)||(L.push(A0),y.push($0))},C=m;C<=_;C++){D.push(L.length);var P=A._ptr[C],H=A._ptr[C+1];if(g)for(var Y=P;Y<H;Y++){var k=A._index[Y];k>=h&&k<=d&&w(A._values[Y],k-h,C-m)}else{for(var K={},e0=P;e0<H;e0++){var b0=A._index[e0];K[b0]=A._values[e0]}for(var O0=h;O0<=d;O0++){var v0=O0 in K?K[O0]:0;w(v0,O0-h,C-m)}}}return D.push(L.length),new M({values:L,index:y,ptr:D,size:[d-h+1,_-m+1]})}M.prototype.forEach=function(A,h){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var d=this,m=this._size[0],_=this._size[1],R=0;R<_;R++){var g=this._ptr[R],L=this._ptr[R+1];if(h)for(var y=g;y<L;y++){var D=this._index[y];A(this._values[y],[D,R],d)}else{for(var T={},N=g;N<L;N++){var w=this._index[N];T[w]=this._values[N]}for(var C=0;C<m;C++){var P=C in T?T[C]:0;A(P,[C,R],d)}}}},M.prototype[Symbol.iterator]=function*(){if(!this._values)throw new Error("Cannot iterate a Pattern only matrix");for(var A=this._size[1],h=0;h<A;h++)for(var d=this._ptr[h],m=this._ptr[h+1],_=d;_<m;_++){var R=this._index[_];yield{value:this._values[_],index:[R,h]}}},M.prototype.toArray=function(){return q(this._values,this._index,this._ptr,this._size,!0)},M.prototype.valueOf=function(){return q(this._values,this._index,this._ptr,this._size,!1)};function q(A,h,d,m,_){var R=m[0],g=m[1],L=[],y,D;for(y=0;y<R;y++)for(L[y]=[],D=0;D<g;D++)L[y][D]=0;for(D=0;D<g;D++)for(var T=d[D],N=d[D+1],w=T;w<N;w++)y=h[w],L[y][D]=A?_?g1(A[w]):A[w]:1;return L}return M.prototype.format=function(A){for(var h=this._size[0],d=this._size[1],m=this.density(),_="Sparse Matrix ["+D1(h,A)+" x "+D1(d,A)+"] density: "+D1(m,A)+`
67
67
  `,R=0;R<d;R++)for(var g=this._ptr[R],L=this._ptr[R+1],y=g;y<L;y++){var D=this._index[y];_+=`
68
- (`+D1(D,A)+", "+D1(R,A)+") ==> "+(this._values?D1(this._values[y],A):"X")}return _},M.prototype.toString=function(){return D1(this.toArray())},M.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},M.prototype.diagonal=function(A){if(A){if(e2(A)&&(A=A.toNumber()),!C1(A)||!U1(A))throw new TypeError("The parameter k must be an integer number")}else A=0;var h=A>0?A:0,d=A<0?-A:0,m=this._size[0],_=this._size[1],R=Math.min(m-d,_-h),g=[],L=[],y=[];y[0]=0;for(var D=h;D<_&&g.length<R;D++)for(var T=this._ptr[D],N=this._ptr[D+1],w=T;w<N;w++){var C=this._index[w];if(C===D-h+d){g.push(this._values[w]),L[g.length-1]=C-d;break}}return y.push(g.length),new M({values:g,index:L,ptr:y,size:[R,1]})},M.fromJSON=function(A){return new M(A)},M.diagonal=function(A,h,d,m,_){if(!V1(A))throw new TypeError("Array expected, size parameter");if(A.length!==2)throw new Error("Only two dimensions matrix are supported");if(A=A.map(function(b0){if(e2(b0)&&(b0=b0.toNumber()),!C1(b0)||!U1(b0)||b0<1)throw new Error("Size values must be positive integers");return b0}),d){if(e2(d)&&(d=d.toNumber()),!C1(d)||!U1(d))throw new TypeError("The parameter k must be an integer number")}else d=0;var R=t,g=0;Te(_)&&(R=e.find(t,[_,_])||t,g=e.convert(0,_));var L=d>0?d:0,y=d<0?-d:0,D=A[0],T=A[1],N=Math.min(D-y,T-L),w;if(V1(h)){if(h.length!==N)throw new Error("Invalid value array length");w=function(O0){return h[O0]}}else if(P1(h)){var C=h.size();if(C.length!==1||C[0]!==N)throw new Error("Invalid matrix length");w=function(O0){return h.get([O0])}}else w=function(){return h};for(var P=[],H=[],Y=[],k=0;k<T;k++){Y.push(P.length);var K=k-L;if(K>=0&&K<N){var e0=w(K);R(e0,g)||(H.push(K+y),P.push(e0))}}return Y.push(P.length),new M({values:P,index:H,ptr:Y,size:[D,T]})},M.prototype.swapRows=function(A,h){if(!C1(A)||!U1(A)||!C1(h)||!U1(h))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return K1(A,this._size[0]),K1(h,this._size[0]),M._swapRows(A,h,this._size[1],this._values,this._index,this._ptr),this},M._forEachRow=function(A,h,d,m,_){for(var R=m[A],g=m[A+1],L=R;L<g;L++)_(d[L],h[L])},M._swapRows=function(A,h,d,m,_,R){for(var g=0;g<d;g++){var L=R[g],y=R[g+1],D=c(A,L,y,_),T=c(h,L,y,_);if(D<y&&T<y&&_[D]===A&&_[T]===h){if(m){var N=m[D];m[D]=m[T],m[T]=N}continue}if(D<y&&_[D]===A&&(T>=y||_[T]!==h)){var w=m?m[D]:void 0;_.splice(T,0,h),m&&m.splice(T,0,w),_.splice(T<=D?D+1:D,1),m&&m.splice(T<=D?D+1:D,1);continue}if(T<y&&_[T]===h&&(D>=y||_[D]!==A)){var C=m?m[T]:void 0;_.splice(D,0,A),m&&m.splice(D,0,C),_.splice(D<=T?T+1:T,1),m&&m.splice(D<=T?T+1:T,1)}}},M},{isClass:!0}),K5="number",J5=["typed"];function Q5(o){var e=o.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(e){var t={"0b":2,"0o":8,"0x":16}[e[1]],r=e[2],M=e[3];return{input:o,radix:t,integerPart:r,fractionalPart:M}}else return null}function Z5(o){for(var e=parseInt(o.integerPart,o.radix),t=0,r=0;r<o.fractionalPart.length;r++){var M=parseInt(o.fractionalPart[r],o.radix);t+=M/Math.pow(o.radix,r+1)}var n=e+t;if(isNaN(n))throw new SyntaxError('String "'+o.input+'" is not a valid number');return n}var eh=h0(K5,J5,o=>{var{typed:e}=o,t=e("number",{"":function(){return 0},number:function(M){return M},string:function(M){if(M==="NaN")return NaN;var n=Q5(M);if(n)return Z5(n);var b=0,z=M.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);z&&(b=Number(z[2]),M=z[1]);var i=Number(M);if(isNaN(i))throw new SyntaxError('String "'+M+'" is not a valid number');if(z){if(i>2**b-1)throw new SyntaxError('String "'.concat(M,'" is out of range'));i>=2**(b-1)&&(i=i-2**b)}return i},BigNumber:function(M){return M.toNumber()},Fraction:function(M){return M.valueOf()},Unit:e.referToSelf(r=>M=>{var n=M.clone();return n.value=r(M.value),n}),null:function(M){return 0},"Unit, string | Unit":function(M,n){return M.toNumber(n)},"Array | Matrix":e.referToSelf(r=>M=>Re(M,r))});return t.fromJSON=function(r){return parseFloat(r.value)},t}),th="bignumber",rh=["typed","BigNumber"],Mh=h0(th,rh,o=>{var{typed:e,BigNumber:t}=o;return e("bignumber",{"":function(){return new t(0)},number:function(M){return new t(M+"")},string:function(M){var n=M.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(n){var b=n[2],z=t(n[1]),i=new t(2).pow(Number(b));if(z.gt(i.sub(1)))throw new SyntaxError('String "'.concat(M,'" is out of range'));var c=new t(2).pow(Number(b)-1);return z.gte(c)?z.sub(i):z}return new t(M)},BigNumber:function(M){return M},Unit:e.referToSelf(r=>M=>{var n=M.clone();return n.value=r(M.value),n}),Fraction:function(M){return new t(M.n).div(M.d).times(M.s)},null:function(M){return new t(0)},"Array | Matrix":e.referToSelf(r=>M=>Re(M,r))})}),oh="fraction",nh=["typed","Fraction"],bh=h0(oh,nh,o=>{var{typed:e,Fraction:t}=o;return e("fraction",{number:function(M){if(!isFinite(M)||isNaN(M))throw new Error(M+" cannot be represented as a fraction");return new t(M)},string:function(M){return new t(M)},"number, number":function(M,n){return new t(M,n)},null:function(M){return new t(0)},BigNumber:function(M){return new t(M.toString())},Fraction:function(M){return M},Unit:e.referToSelf(r=>M=>{var n=M.clone();return n.value=r(M.value),n}),Object:function(M){return new t(M)},"Array | Matrix":e.referToSelf(r=>M=>Re(M,r))})}),Da="matrix",ph=["typed","Matrix","DenseMatrix","SparseMatrix"],zh=h0(Da,ph,o=>{var{typed:e,Matrix:t,DenseMatrix:r,SparseMatrix:M}=o;return e(Da,{"":function(){return n([])},string:function(z){return n([],z)},"string, string":function(z,i){return n([],z,i)},Array:function(z){return n(z)},Matrix:function(z){return n(z,z.storage())},"Array | Matrix, string":n,"Array | Matrix, string, string":n});function n(b,z,i){if(z==="dense"||z==="default"||z===void 0)return new r(b,i);if(z==="sparse")return new M(b,i);throw new TypeError("Unknown matrix type "+JSON.stringify(z)+".")}}),Xa="unaryMinus",ih=["typed"],ch=h0(Xa,ih,o=>{var{typed:e}=o;return e(Xa,{number:ga,"Complex | BigNumber | Fraction":t=>t.neg(),Unit:e.referToSelf(t=>r=>{var M=r.clone();return M.value=e.find(t,M.valueType())(r.value),M}),"Array | Matrix":e.referToSelf(t=>r=>Re(r,t))})}),Ea="abs",ah=["typed"],sh=h0(Ea,ah,o=>{var{typed:e}=o;return e(Ea,{number:ha,"Complex | BigNumber | Fraction | Unit":t=>t.abs(),"Array | Matrix":e.referToSelf(t=>r=>Re(r,t))})}),Ta="addScalar",Oh=["typed"],uh=h0(Ta,Oh,o=>{var{typed:e}=o;return e(Ta,{"number, number":Wa,"Complex, Complex":function(r,M){return r.add(M)},"BigNumber, BigNumber":function(r,M){return r.plus(M)},"Fraction, Fraction":function(r,M){return r.add(M)},"Unit, Unit":e.referToSelf(t=>(r,M)=>{if(r.value===null||r.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(M.value===null||M.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!r.equalBase(M))throw new Error("Units do not match");var n=r.clone();return n.value=e.find(t,[n.valueType(),M.valueType()])(n.value,M.value),n.fixPrefix=!1,n})})}),Ca="subtractScalar",Ah=["typed"],fh=h0(Ca,Ah,o=>{var{typed:e}=o;return e(Ca,{"number, number":_a,"Complex, Complex":function(r,M){return r.sub(M)},"BigNumber, BigNumber":function(r,M){return r.minus(M)},"Fraction, Fraction":function(r,M){return r.sub(M)},"Unit, Unit":e.referToSelf(t=>(r,M)=>{if(r.value===null||r.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(M.value===null||M.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!r.equalBase(M))throw new Error("Units do not match");var n=r.clone();return n.value=e.find(t,[n.valueType(),M.valueType()])(n.value,M.value),n.fixPrefix=!1,n})})}),lh="matAlgo11xS0s",dh=["typed","equalScalar"],ip=h0(lh,dh,o=>{var{typed:e,equalScalar:t}=o;return function(M,n,b,z){var i=M._values,c=M._index,O=M._ptr,s=M._size,u=M._datatype;if(!i)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var l=s[0],q=s[1],A,h=t,d=0,m=b;typeof u=="string"&&(A=u,h=e.find(t,[A,A]),d=e.convert(0,A),n=e.convert(n,A),m=e.find(b,[A,A]));for(var _=[],R=[],g=[],L=0;L<q;L++){g[L]=R.length;for(var y=O[L],D=O[L+1],T=y;T<D;T++){var N=c[T],w=z?m(n,i[T]):m(i[T],n);h(w,d)||(R.push(N),_.push(w))}}return g[q]=R.length,M.createSparseMatrix({values:_,index:R,ptr:g,size:[l,q],datatype:A})}}),qh="matAlgo12xSfs",hh=["typed","DenseMatrix"],Br=h0(qh,hh,o=>{var{typed:e,DenseMatrix:t}=o;return function(M,n,b,z){var i=M._values,c=M._index,O=M._ptr,s=M._size,u=M._datatype;if(!i)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var l=s[0],q=s[1],A,h=b;typeof u=="string"&&(A=u,n=e.convert(n,A),h=e.find(b,[A,A]));for(var d=[],m=[],_=[],R=0;R<q;R++){for(var g=R+1,L=O[R],y=O[R+1],D=L;D<y;D++){var T=c[D];m[T]=i[D],_[T]=g}for(var N=0;N<l;N++)R===0&&(d[N]=[]),_[N]===g?d[N][R]=z?h(n,m[N]):h(m[N],n):d[N][R]=z?h(n,0):h(0,n)}return new t({data:d,size:[l,q],datatype:A})}}),Wh="matAlgo14xDs",_h=["typed"],cp=h0(Wh,_h,o=>{var{typed:e}=o;return function(M,n,b,z){var i=M._data,c=M._size,O=M._datatype,s,u=b;typeof O=="string"&&(s=O,n=e.convert(n,s),u=e.find(b,[s,s]));var l=c.length>0?t(u,0,c,c[0],i,n,z):[];return M.createDenseMatrix({data:l,size:g1(c),datatype:s})};function t(r,M,n,b,z,i,c){var O=[];if(M===n.length-1)for(var s=0;s<b;s++)O[s]=c?r(i,z[s]):r(z[s],i);else for(var u=0;u<b;u++)O[u]=t(r,M+1,n,n[M+1],z[u],i,c);return O}}),mh="matAlgo02xDS0",gh=["typed","equalScalar"],Rh=h0(mh,gh,o=>{var{typed:e,equalScalar:t}=o;return function(M,n,b,z){var i=M._data,c=M._size,O=M._datatype||M.getDataType(),s=n._values,u=n._index,l=n._ptr,q=n._size,A=n._datatype||n._data===void 0?n._datatype:n.getDataType();if(c.length!==q.length)throw new d1(c.length,q.length);if(c[0]!==q[0]||c[1]!==q[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+q+")");if(!s)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var h=c[0],d=c[1],m,_=t,R=0,g=b;typeof O=="string"&&O===A&&O!=="mixed"&&(m=O,_=e.find(t,[m,m]),R=e.convert(0,m),g=e.find(b,[m,m]));for(var L=[],y=[],D=[],T=0;T<d;T++){D[T]=y.length;for(var N=l[T],w=l[T+1],C=N;C<w;C++){var P=u[C],H=z?g(s[C],i[P][T]):g(i[P][T],s[C]);_(H,R)||(y.push(P),L.push(H))}}return D[d]=y.length,n.createSparseMatrix({values:L,index:y,ptr:D,size:[h,d],datatype:O===M._datatype&&A===n._datatype?m:void 0})}}),vh="matAlgo03xDSf",Lh=["typed"],wr=h0(vh,Lh,o=>{var{typed:e}=o;return function(r,M,n,b){var z=r._data,i=r._size,c=r._datatype||r.getDataType(),O=M._values,s=M._index,u=M._ptr,l=M._size,q=M._datatype||M._data===void 0?M._datatype:M.getDataType();if(i.length!==l.length)throw new d1(i.length,l.length);if(i[0]!==l[0]||i[1]!==l[1])throw new RangeError("Dimension mismatch. Matrix A ("+i+") must match Matrix B ("+l+")");if(!O)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var A=i[0],h=i[1],d,m=0,_=n;typeof c=="string"&&c===q&&c!=="mixed"&&(d=c,m=e.convert(0,d),_=e.find(n,[d,d]));for(var R=[],g=0;g<A;g++)R[g]=[];for(var L=[],y=[],D=0;D<h;D++){for(var T=D+1,N=u[D],w=u[D+1],C=N;C<w;C++){var P=s[C];L[P]=b?_(O[C],z[P][D]):_(z[P][D],O[C]),y[P]=T}for(var H=0;H<A;H++)y[H]===T?R[H][D]=L[H]:R[H][D]=b?_(m,z[H][D]):_(z[H][D],m)}return r.createDenseMatrix({data:R,size:[A,h],datatype:c===r._datatype&&q===M._datatype?d:void 0})}}),Nh="matAlgo05xSfSf",yh=["typed","equalScalar"],xa=h0(Nh,yh,o=>{var{typed:e,equalScalar:t}=o;return function(M,n,b){var z=M._values,i=M._index,c=M._ptr,O=M._size,s=M._datatype||M._data===void 0?M._datatype:M.getDataType(),u=n._values,l=n._index,q=n._ptr,A=n._size,h=n._datatype||n._data===void 0?n._datatype:n.getDataType();if(O.length!==A.length)throw new d1(O.length,A.length);if(O[0]!==A[0]||O[1]!==A[1])throw new RangeError("Dimension mismatch. Matrix A ("+O+") must match Matrix B ("+A+")");var d=O[0],m=O[1],_,R=t,g=0,L=b;typeof s=="string"&&s===h&&s!=="mixed"&&(_=s,R=e.find(t,[_,_]),g=e.convert(0,_),L=e.find(b,[_,_]));var y=z&&u?[]:void 0,D=[],T=[],N=y?[]:void 0,w=y?[]:void 0,C=[],P=[],H,Y,k,K;for(Y=0;Y<m;Y++){T[Y]=D.length;var e0=Y+1;for(k=c[Y],K=c[Y+1];k<K;k++)H=i[k],D.push(H),C[H]=e0,N&&(N[H]=z[k]);for(k=q[Y],K=q[Y+1];k<K;k++)H=l[k],C[H]!==e0&&D.push(H),P[H]=e0,w&&(w[H]=u[k]);if(y)for(k=T[Y];k<D.length;){H=D[k];var b0=C[H],O0=P[H];if(b0===e0||O0===e0){var v0=b0===e0?N[H]:g,B0=O0===e0?w[H]:g,A0=L(v0,B0);R(A0,g)?D.splice(k,1):(y.push(A0),k++)}}}return T[m]=D.length,M.createSparseMatrix({values:y,index:D,ptr:T,size:[d,m],datatype:s===M._datatype&&h===n._datatype?_:void 0})}}),Bh="matAlgo13xDD",wh=["typed"],Dh=h0(Bh,wh,o=>{var{typed:e}=o;return function(M,n,b){var z=M._data,i=M._size,c=M._datatype,O=n._data,s=n._size,u=n._datatype,l=[];if(i.length!==s.length)throw new d1(i.length,s.length);for(var q=0;q<i.length;q++){if(i[q]!==s[q])throw new RangeError("Dimension mismatch. Matrix A ("+i+") must match Matrix B ("+s+")");l[q]=i[q]}var A,h=b;typeof c=="string"&&c===u&&(A=c,h=e.find(b,[A,A]));var d=l.length>0?t(h,0,l,l[0],z,O):[];return M.createDenseMatrix({data:d,size:l,datatype:A})};function t(r,M,n,b,z,i){var c=[];if(M===n.length-1)for(var O=0;O<b;O++)c[O]=r(z[O],i[O]);else for(var s=0;s<b;s++)c[s]=t(r,M+1,n,n[M+1],z[s],i[s]);return c}}),Xh="broadcast",Eh=["concat"],Th=h0(Xh,Eh,o=>{var{concat:e}=o;return function(M,n){var b=Math.max(M._size.length,n._size.length);if(M._size.length===n._size.length&&M._size.every((q,A)=>q===n._size[A]))return[M,n];for(var z=t(M._size,b,0),i=t(n._size,b,0),c=[],O=0;O<b;O++)c[O]=Math.max(z[O],i[O]);Wo(z,c),Wo(i,c);var s=M.clone(),u=n.clone();s._size.length<b?s.reshape(t(s._size,b,1)):u._size.length<b&&u.reshape(t(u._size,b,1));for(var l=0;l<b;l++)s._size[l]<c[l]&&(s=r(s,c[l],l)),u._size[l]<c[l]&&(u=r(u,c[l],l));return[s,u]};function t(M,n,b){return[...Array(n-M.length).fill(b),...M]}function r(M,n,b){return e(...Array(n).fill(M),b)}}),Ch="matrixAlgorithmSuite",xh=["typed","matrix","concat"],Vt=h0(Ch,xh,o=>{var{typed:e,matrix:t,concat:r}=o,M=Dh({typed:e}),n=cp({typed:e}),b=Th({concat:r});return function(i){var c=i.elop,O=i.SD||i.DS,s;c?(s={"DenseMatrix, DenseMatrix":(A,h)=>M(...b(A,h),c),"Array, Array":(A,h)=>M(...b(t(A),t(h)),c).valueOf(),"Array, DenseMatrix":(A,h)=>M(...b(t(A),h),c),"DenseMatrix, Array":(A,h)=>M(...b(A,t(h)),c)},i.SS&&(s["SparseMatrix, SparseMatrix"]=(A,h)=>i.SS(...b(A,h),c,!1)),i.DS&&(s["DenseMatrix, SparseMatrix"]=(A,h)=>i.DS(...b(A,h),c,!1),s["Array, SparseMatrix"]=(A,h)=>i.DS(...b(t(A),h),c,!1)),O&&(s["SparseMatrix, DenseMatrix"]=(A,h)=>O(...b(h,A),c,!0),s["SparseMatrix, Array"]=(A,h)=>O(...b(t(h),A),c,!0))):(s={"DenseMatrix, DenseMatrix":e.referToSelf(A=>(h,d)=>M(...b(h,d),A)),"Array, Array":e.referToSelf(A=>(h,d)=>M(...b(t(h),t(d)),A).valueOf()),"Array, DenseMatrix":e.referToSelf(A=>(h,d)=>M(...b(t(h),d),A)),"DenseMatrix, Array":e.referToSelf(A=>(h,d)=>M(...b(h,t(d)),A))},i.SS&&(s["SparseMatrix, SparseMatrix"]=e.referToSelf(A=>(h,d)=>i.SS(...b(h,d),A,!1))),i.DS&&(s["DenseMatrix, SparseMatrix"]=e.referToSelf(A=>(h,d)=>i.DS(...b(h,d),A,!1)),s["Array, SparseMatrix"]=e.referToSelf(A=>(h,d)=>i.DS(...b(t(h),d),A,!1))),O&&(s["SparseMatrix, DenseMatrix"]=e.referToSelf(A=>(h,d)=>O(...b(d,h),A,!0)),s["SparseMatrix, Array"]=e.referToSelf(A=>(h,d)=>O(...b(t(d),h),A,!0))));var u=i.scalar||"any",l=i.Ds||i.Ss;l&&(c?(s["DenseMatrix,"+u]=(A,h)=>n(A,h,c,!1),s[u+", DenseMatrix"]=(A,h)=>n(h,A,c,!0),s["Array,"+u]=(A,h)=>n(t(A),h,c,!1).valueOf(),s[u+", Array"]=(A,h)=>n(t(h),A,c,!0).valueOf()):(s["DenseMatrix,"+u]=e.referToSelf(A=>(h,d)=>n(h,d,A,!1)),s[u+", DenseMatrix"]=e.referToSelf(A=>(h,d)=>n(d,h,A,!0)),s["Array,"+u]=e.referToSelf(A=>(h,d)=>n(t(h),d,A,!1).valueOf()),s[u+", Array"]=e.referToSelf(A=>(h,d)=>n(t(d),h,A,!0).valueOf())));var q=i.sS!==void 0?i.sS:i.Ss;return c?(i.Ss&&(s["SparseMatrix,"+u]=(A,h)=>i.Ss(A,h,c,!1)),q&&(s[u+", SparseMatrix"]=(A,h)=>q(h,A,c,!0))):(i.Ss&&(s["SparseMatrix,"+u]=e.referToSelf(A=>(h,d)=>i.Ss(h,d,A,!1))),q&&(s[u+", SparseMatrix"]=e.referToSelf(A=>(h,d)=>q(d,h,A,!0)))),c&&c.signatures&&Bc(s,c.signatures),s}}),Sh="matAlgo01xDSid",Fh=["typed"],Sa=h0(Sh,Fh,o=>{var{typed:e}=o;return function(r,M,n,b){var z=r._data,i=r._size,c=r._datatype||r.getDataType(),O=M._values,s=M._index,u=M._ptr,l=M._size,q=M._datatype||M._data===void 0?M._datatype:M.getDataType();if(i.length!==l.length)throw new d1(i.length,l.length);if(i[0]!==l[0]||i[1]!==l[1])throw new RangeError("Dimension mismatch. Matrix A ("+i+") must match Matrix B ("+l+")");if(!O)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var A=i[0],h=i[1],d=typeof c=="string"&&c!=="mixed"&&c===q?c:void 0,m=d?e.find(n,[d,d]):n,_,R,g=[];for(_=0;_<A;_++)g[_]=[];var L=[],y=[];for(R=0;R<h;R++){for(var D=R+1,T=u[R],N=u[R+1],w=T;w<N;w++)_=s[w],L[_]=b?m(O[w],z[_][R]):m(z[_][R],O[w]),y[_]=D;for(_=0;_<A;_++)y[_]===D?g[_][R]=L[_]:g[_][R]=z[_][R]}return r.createDenseMatrix({data:g,size:[A,h],datatype:c===r._datatype&&q===M._datatype?d:void 0})}}),Ih="matAlgo04xSidSid",Ph=["typed","equalScalar"],kh=h0(Ih,Ph,o=>{var{typed:e,equalScalar:t}=o;return function(M,n,b){var z=M._values,i=M._index,c=M._ptr,O=M._size,s=M._datatype||M._data===void 0?M._datatype:M.getDataType(),u=n._values,l=n._index,q=n._ptr,A=n._size,h=n._datatype||n._data===void 0?n._datatype:n.getDataType();if(O.length!==A.length)throw new d1(O.length,A.length);if(O[0]!==A[0]||O[1]!==A[1])throw new RangeError("Dimension mismatch. Matrix A ("+O+") must match Matrix B ("+A+")");var d=O[0],m=O[1],_,R=t,g=0,L=b;typeof s=="string"&&s===h&&s!=="mixed"&&(_=s,R=e.find(t,[_,_]),g=e.convert(0,_),L=e.find(b,[_,_]));var y=z&&u?[]:void 0,D=[],T=[],N=z&&u?[]:void 0,w=z&&u?[]:void 0,C=[],P=[],H,Y,k,K,e0;for(Y=0;Y<m;Y++){T[Y]=D.length;var b0=Y+1;for(K=c[Y],e0=c[Y+1],k=K;k<e0;k++)H=i[k],D.push(H),C[H]=b0,N&&(N[H]=z[k]);for(K=q[Y],e0=q[Y+1],k=K;k<e0;k++)if(H=l[k],C[H]===b0){if(N){var O0=L(N[H],u[k]);R(O0,g)?C[H]=null:N[H]=O0}}else D.push(H),P[H]=b0,w&&(w[H]=u[k]);if(N&&w)for(k=T[Y];k<D.length;)H=D[k],C[H]===b0?(y[k]=N[H],k++):P[H]===b0?(y[k]=w[H],k++):D.splice(k,1)}return T[m]=D.length,M.createSparseMatrix({values:y,index:D,ptr:T,size:[d,m],datatype:s===M._datatype&&h===n._datatype?_:void 0})}}),$h="matAlgo10xSids",Uh=["typed","DenseMatrix"],Fa=h0($h,Uh,o=>{var{typed:e,DenseMatrix:t}=o;return function(M,n,b,z){var i=M._values,c=M._index,O=M._ptr,s=M._size,u=M._datatype;if(!i)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var l=s[0],q=s[1],A,h=b;typeof u=="string"&&(A=u,n=e.convert(n,A),h=e.find(b,[A,A]));for(var d=[],m=[],_=[],R=0;R<q;R++){for(var g=R+1,L=O[R],y=O[R+1],D=L;D<y;D++){var T=c[D];m[T]=i[D],_[T]=g}for(var N=0;N<l;N++)R===0&&(d[N]=[]),_[N]===g?d[N][R]=z?h(n,m[N]):h(m[N],n):d[N][R]=n}return new t({data:d,size:[l,q],datatype:A})}}),jh="multiplyScalar",Hh=["typed"],Yh=h0(jh,Hh,o=>{var{typed:e}=o;return e("multiplyScalar",{"number, number":ma,"Complex, Complex":function(r,M){return r.mul(M)},"BigNumber, BigNumber":function(r,M){return r.times(M)},"Fraction, Fraction":function(r,M){return r.mul(M)},"number | Fraction | BigNumber | Complex, Unit":(t,r)=>r.multiply(t),"Unit, number | Fraction | BigNumber | Complex | Unit":(t,r)=>t.multiply(r)})}),Ia="multiply",Gh=["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],Vh=h0(Ia,Gh,o=>{var{typed:e,matrix:t,addScalar:r,multiplyScalar:M,equalScalar:n,dot:b}=o,z=ip({typed:e,equalScalar:n}),i=cp({typed:e});function c(g,L){switch(g.length){case 1:switch(L.length){case 1:if(g[0]!==L[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(g[0]!==L[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+g[0]+") must match Matrix rows ("+L[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+L.length+" dimensions)")}break;case 2:switch(L.length){case 1:if(g[1]!==L[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+g[1]+") must match Vector length ("+L[0]+")");break;case 2:if(g[1]!==L[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+g[1]+") must match Matrix B rows ("+L[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+L.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+g.length+" dimensions)")}}function O(g,L,y){if(y===0)throw new Error("Cannot multiply two empty vectors");return b(g,L)}function s(g,L){if(L.storage()!=="dense")throw new Error("Support for SparseMatrix not implemented");return u(g,L)}function u(g,L){var y=g._data,D=g._size,T=g._datatype||g.getDataType(),N=L._data,w=L._size,C=L._datatype||L.getDataType(),P=D[0],H=w[1],Y,k=r,K=M;T&&C&&T===C&&typeof T=="string"&&T!=="mixed"&&(Y=T,k=e.find(r,[Y,Y]),K=e.find(M,[Y,Y]));for(var e0=[],b0=0;b0<H;b0++){for(var O0=K(y[0],N[0][b0]),v0=1;v0<P;v0++)O0=k(O0,K(y[v0],N[v0][b0]));e0[b0]=O0}return g.createDenseMatrix({data:e0,size:[H],datatype:T===g._datatype&&C===L._datatype?Y:void 0})}var l=e("_multiplyMatrixVector",{"DenseMatrix, any":A,"SparseMatrix, any":m}),q=e("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":h,"DenseMatrix, SparseMatrix":d,"SparseMatrix, DenseMatrix":_,"SparseMatrix, SparseMatrix":R});function A(g,L){var y=g._data,D=g._size,T=g._datatype||g.getDataType(),N=L._data,w=L._datatype||L.getDataType(),C=D[0],P=D[1],H,Y=r,k=M;T&&w&&T===w&&typeof T=="string"&&T!=="mixed"&&(H=T,Y=e.find(r,[H,H]),k=e.find(M,[H,H]));for(var K=[],e0=0;e0<C;e0++){for(var b0=y[e0],O0=k(b0[0],N[0]),v0=1;v0<P;v0++)O0=Y(O0,k(b0[v0],N[v0]));K[e0]=O0}return g.createDenseMatrix({data:K,size:[C],datatype:T===g._datatype&&w===L._datatype?H:void 0})}function h(g,L){var y=g._data,D=g._size,T=g._datatype||g.getDataType(),N=L._data,w=L._size,C=L._datatype||L.getDataType(),P=D[0],H=D[1],Y=w[1],k,K=r,e0=M;T&&C&&T===C&&typeof T=="string"&&T!=="mixed"&&T!=="mixed"&&(k=T,K=e.find(r,[k,k]),e0=e.find(M,[k,k]));for(var b0=[],O0=0;O0<P;O0++){var v0=y[O0];b0[O0]=[];for(var B0=0;B0<Y;B0++){for(var A0=e0(v0[0],N[0][B0]),$0=1;$0<H;$0++)A0=K(A0,e0(v0[$0],N[$0][B0]));b0[O0][B0]=A0}}return g.createDenseMatrix({data:b0,size:[P,Y],datatype:T===g._datatype&&C===L._datatype?k:void 0})}function d(g,L){var y=g._data,D=g._size,T=g._datatype||g.getDataType(),N=L._values,w=L._index,C=L._ptr,P=L._size,H=L._datatype||L._data===void 0?L._datatype:L.getDataType();if(!N)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var Y=D[0],k=P[1],K,e0=r,b0=M,O0=n,v0=0;T&&H&&T===H&&typeof T=="string"&&T!=="mixed"&&(K=T,e0=e.find(r,[K,K]),b0=e.find(M,[K,K]),O0=e.find(n,[K,K]),v0=e.convert(0,K));for(var B0=[],A0=[],$0=[],P0=L.createSparseMatrix({values:B0,index:A0,ptr:$0,size:[Y,k],datatype:T===g._datatype&&H===L._datatype?K:void 0}),k0=0;k0<k;k0++){$0[k0]=A0.length;var W0=C[k0],i1=C[k0+1];if(i1>W0)for(var e1=0,c1=0;c1<Y;c1++){for(var t2=c1+1,W1=void 0,F=W0;F<i1;F++){var J=w[F];e1!==t2?(W1=b0(y[c1][J],N[F]),e1=t2):W1=e0(W1,b0(y[c1][J],N[F]))}e1===t2&&!O0(W1,v0)&&(A0.push(c1),B0.push(W1))}}return $0[k]=A0.length,P0}function m(g,L){var y=g._values,D=g._index,T=g._ptr,N=g._datatype||g._data===void 0?g._datatype:g.getDataType();if(!y)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var w=L._data,C=L._datatype||L.getDataType(),P=g._size[0],H=L._size[0],Y=[],k=[],K=[],e0,b0=r,O0=M,v0=n,B0=0;N&&C&&N===C&&typeof N=="string"&&N!=="mixed"&&(e0=N,b0=e.find(r,[e0,e0]),O0=e.find(M,[e0,e0]),v0=e.find(n,[e0,e0]),B0=e.convert(0,e0));var A0=[],$0=[];K[0]=0;for(var P0=0;P0<H;P0++){var k0=w[P0];if(!v0(k0,B0))for(var W0=T[P0],i1=T[P0+1],e1=W0;e1<i1;e1++){var c1=D[e1];$0[c1]?A0[c1]=b0(A0[c1],O0(k0,y[e1])):($0[c1]=!0,k.push(c1),A0[c1]=O0(k0,y[e1]))}}for(var t2=k.length,W1=0;W1<t2;W1++){var F=k[W1];Y[W1]=A0[F]}return K[1]=k.length,g.createSparseMatrix({values:Y,index:k,ptr:K,size:[P,1],datatype:N===g._datatype&&C===L._datatype?e0:void 0})}function _(g,L){var y=g._values,D=g._index,T=g._ptr,N=g._datatype||g._data===void 0?g._datatype:g.getDataType();if(!y)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var w=L._data,C=L._datatype||L.getDataType(),P=g._size[0],H=L._size[0],Y=L._size[1],k,K=r,e0=M,b0=n,O0=0;N&&C&&N===C&&typeof N=="string"&&N!=="mixed"&&(k=N,K=e.find(r,[k,k]),e0=e.find(M,[k,k]),b0=e.find(n,[k,k]),O0=e.convert(0,k));for(var v0=[],B0=[],A0=[],$0=g.createSparseMatrix({values:v0,index:B0,ptr:A0,size:[P,Y],datatype:N===g._datatype&&C===L._datatype?k:void 0}),P0=[],k0=[],W0=0;W0<Y;W0++){A0[W0]=B0.length;for(var i1=W0+1,e1=0;e1<H;e1++){var c1=w[e1][W0];if(!b0(c1,O0))for(var t2=T[e1],W1=T[e1+1],F=t2;F<W1;F++){var J=D[F];k0[J]!==i1?(k0[J]=i1,B0.push(J),P0[J]=e0(c1,y[F])):P0[J]=K(P0[J],e0(c1,y[F]))}}for(var Z=A0[W0],s0=B0.length,R0=Z;R0<s0;R0++){var Y0=B0[R0];v0[R0]=P0[Y0]}}return A0[Y]=B0.length,$0}function R(g,L){var y=g._values,D=g._index,T=g._ptr,N=g._datatype||g._data===void 0?g._datatype:g.getDataType(),w=L._values,C=L._index,P=L._ptr,H=L._datatype||L._data===void 0?L._datatype:L.getDataType(),Y=g._size[0],k=L._size[1],K=y&&w,e0,b0=r,O0=M;N&&H&&N===H&&typeof N=="string"&&N!=="mixed"&&(e0=N,b0=e.find(r,[e0,e0]),O0=e.find(M,[e0,e0]));for(var v0=K?[]:void 0,B0=[],A0=[],$0=g.createSparseMatrix({values:v0,index:B0,ptr:A0,size:[Y,k],datatype:N===g._datatype&&H===L._datatype?e0:void 0}),P0=K?[]:void 0,k0=[],W0,i1,e1,c1,t2,W1,F,J,Z=0;Z<k;Z++){A0[Z]=B0.length;var s0=Z+1;for(t2=P[Z],W1=P[Z+1],c1=t2;c1<W1;c1++)if(J=C[c1],K)for(i1=T[J],e1=T[J+1],W0=i1;W0<e1;W0++)F=D[W0],k0[F]!==s0?(k0[F]=s0,B0.push(F),P0[F]=O0(w[c1],y[W0])):P0[F]=b0(P0[F],O0(w[c1],y[W0]));else for(i1=T[J],e1=T[J+1],W0=i1;W0<e1;W0++)F=D[W0],k0[F]!==s0&&(k0[F]=s0,B0.push(F));if(K)for(var R0=A0[Z],Y0=B0.length,v1=R0;v1<Y0;v1++){var Q0=B0[v1];v0[v1]=P0[Q0]}}return A0[k]=B0.length,$0}return e(Ia,M,{"Array, Array":e.referTo("Matrix, Matrix",g=>(L,y)=>{c(o2(L),o2(y));var D=g(t(L),t(y));return P1(D)?D.valueOf():D}),"Matrix, Matrix":function(L,y){var D=L.size(),T=y.size();return c(D,T),D.length===1?T.length===1?O(L,y,D[0]):s(L,y):T.length===1?l(L,y):q(L,y)},"Matrix, Array":e.referTo("Matrix,Matrix",g=>(L,y)=>g(L,t(y))),"Array, Matrix":e.referToSelf(g=>(L,y)=>g(t(L,y.storage()),y)),"SparseMatrix, any":function(L,y){return z(L,y,M,!1)},"DenseMatrix, any":function(L,y){return i(L,y,M,!1)},"any, SparseMatrix":function(L,y){return z(y,L,M,!0)},"any, DenseMatrix":function(L,y){return i(y,L,M,!0)},"Array, any":function(L,y){return i(t(L),y,M,!1).valueOf()},"any, Array":function(L,y){return i(t(y),L,M,!0).valueOf()},"any, any":M,"any, any, ...any":e.referToSelf(g=>(L,y,D)=>{for(var T=g(L,y),N=0;N<D.length;N++)T=g(T,D[N]);return T})})}),Pa="subtract",Kh=["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],Jh=h0(Pa,Kh,o=>{var{typed:e,matrix:t,equalScalar:r,subtractScalar:M,unaryMinus:n,DenseMatrix:b,concat:z}=o,i=Sa({typed:e}),c=wr({typed:e}),O=xa({typed:e,equalScalar:r}),s=Fa({typed:e,DenseMatrix:b}),u=Br({typed:e,DenseMatrix:b}),l=Vt({typed:e,matrix:t,concat:z});return e(Pa,{"any, any":M},l({elop:M,SS:O,DS:i,SD:c,Ss:u,sS:s}))}),Qh="matAlgo07xSSf",Zh=["typed","DenseMatrix"],Co=h0(Qh,Zh,o=>{var{typed:e,DenseMatrix:t}=o;return function(n,b,z){var i=n._size,c=n._datatype||n._data===void 0?n._datatype:n.getDataType(),O=b._size,s=b._datatype||b._data===void 0?b._datatype:b.getDataType();if(i.length!==O.length)throw new d1(i.length,O.length);if(i[0]!==O[0]||i[1]!==O[1])throw new RangeError("Dimension mismatch. Matrix A ("+i+") must match Matrix B ("+O+")");var u=i[0],l=i[1],q,A=0,h=z;typeof c=="string"&&c===s&&c!=="mixed"&&(q=c,A=e.convert(0,q),h=e.find(z,[q,q]));var d,m,_=[];for(d=0;d<u;d++)_[d]=[];var R=[],g=[],L=[],y=[];for(m=0;m<l;m++){var D=m+1;for(r(n,m,L,R,D),r(b,m,y,g,D),d=0;d<u;d++){var T=L[d]===D?R[d]:A,N=y[d]===D?g[d]:A;_[d][m]=h(T,N)}}return new t({data:_,size:[u,l],datatype:c===n._datatype&&s===b._datatype?q:void 0})};function r(M,n,b,z,i){for(var c=M._values,O=M._index,s=M._ptr,u=s[n],l=s[n+1];u<l;u++){var q=O[u];b[q]=i,z[q]=c[u]}}}),ka="conj",eW=["typed"],tW=h0(ka,eW,o=>{var{typed:e}=o;return e(ka,{"number | BigNumber | Fraction":t=>t,Complex:t=>t.conjugate(),"Array | Matrix":e.referToSelf(t=>r=>Re(r,t))})}),$a="concat",rW=["typed","matrix","isInteger"],MW=h0($a,rW,o=>{var{typed:e,matrix:t,isInteger:r}=o;return e($a,{"...Array | Matrix | number | BigNumber":function(n){var b,z=n.length,i=-1,c,O=!1,s=[];for(b=0;b<z;b++){var u=n[b];if(P1(u)&&(O=!0),C1(u)||e2(u)){if(b!==z-1)throw new Error("Dimension must be specified as last argument");if(c=i,i=u.valueOf(),!r(i))throw new TypeError("Integer number expected for dimension");if(i<0||b>0&&i>c)throw new mt(i,c+1)}else{var l=g1(u).valueOf(),q=o2(l);if(s[b]=l,c=i,i=q.length-1,b>0&&i!==c)throw new d1(c+1,i+1)}}if(s.length===0)throw new SyntaxError("At least one matrix expected");for(var A=s.shift();s.length;)A=Kc(A,s.shift(),i);return O?t(A):A},"...string":function(n){return n.join("")}})}),Ua="count",oW=["typed","size","prod"],nW=h0(Ua,oW,o=>{var{typed:e,size:t,prod:r}=o;return e(Ua,{string:function(n){return n.length},"Matrix | Array":function(n){return r(t(n))}})}),ja="identity",bW=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],pW=h0(ja,bW,o=>{var{typed:e,config:t,matrix:r,BigNumber:M,DenseMatrix:n,SparseMatrix:b}=o;return e(ja,{"":function(){return t.matrix==="Matrix"?r([]):[]},string:function(O){return r(O)},"number | BigNumber":function(O){return i(O,O,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, string":function(O,s){return i(O,O,s)},"number | BigNumber, number | BigNumber":function(O,s){return i(O,s,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(O,s,u){return i(O,s,u)},Array:function(O){return z(O)},"Array, string":function(O,s){return z(O,s)},Matrix:function(O){return z(O.valueOf(),O.storage())},"Matrix, string":function(O,s){return z(O.valueOf(),s)}});function z(c,O){switch(c.length){case 0:return O?r(O):[];case 1:return i(c[0],c[0],O);case 2:return i(c[0],c[1],O);default:throw new Error("Vector containing two values expected")}}function i(c,O,s){var u=e2(c)||e2(O)?M:null;if(e2(c)&&(c=c.toNumber()),e2(O)&&(O=O.toNumber()),!U1(c)||c<1)throw new Error("Parameters in function identity must be positive integers");if(!U1(O)||O<1)throw new Error("Parameters in function identity must be positive integers");var l=u?new M(1):1,q=u?new u(0):0,A=[c,O];if(s){if(s==="sparse")return b.diagonal(A,l,0,q);if(s==="dense")return n.diagonal(A,l,0,q);throw new TypeError('Unknown matrix type "'.concat(s,'"'))}for(var h=Vb([],A,q),d=c<O?c:O,m=0;m<d;m++)h[m][m]=l;return h}}),Ha="kron",zW=["typed","matrix","multiplyScalar"],iW=h0(Ha,zW,o=>{var{typed:e,matrix:t,multiplyScalar:r}=o;return e(Ha,{"Matrix, Matrix":function(b,z){return t(M(b.toArray(),z.toArray()))},"Matrix, Array":function(b,z){return t(M(b.toArray(),z))},"Array, Matrix":function(b,z){return t(M(b,z.toArray()))},"Array, Array":M});function M(n,b){if(o2(n).length===1&&(n=[n]),o2(b).length===1&&(b=[b]),o2(n).length>2||o2(b).length>2)throw new RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(n.length)+", y = "+JSON.stringify(b.length)+")");var z=[],i=[];return n.map(function(c){return b.map(function(O){return i=[],z.push(i),c.map(function(s){return O.map(function(u){return i.push(r(s,u))})})})})&&z}});function cW(){throw new Error('No "bignumber" implementation available')}function aW(){throw new Error('No "fraction" implementation available')}function sW(){throw new Error('No "matrix" implementation available')}var Ya="reshape",OW=["typed","isInteger","matrix"],uW=h0(Ya,OW,o=>{var{typed:e,isInteger:t}=o;return e(Ya,{"Matrix, Array":function(M,n){return M.reshape(n,!0)},"Array, Array":function(M,n){return n.forEach(function(b){if(!t(b))throw new TypeError("Invalid size for dimension: "+b)}),Jb(M,n)}})}),Ga="size",AW=["typed","config","?matrix"],fW=h0(Ga,AW,o=>{var{typed:e,config:t,matrix:r}=o;return e(Ga,{Matrix:function(n){return n.create(n.size())},Array:o2,string:function(n){return t.matrix==="Array"?[n.length]:r([n.length])},"number | Complex | BigNumber | Unit | boolean | null":function(n){return t.matrix==="Array"?[]:r?r([]):sW()}})}),Va="transpose",lW=["typed","matrix"],dW=h0(Va,lW,o=>{var{typed:e,matrix:t}=o;return e(Va,{Array:b=>r(t(b)).valueOf(),Matrix:r,any:g1});function r(b){var z=b.size(),i;switch(z.length){case 1:i=b.clone();break;case 2:{var c=z[0],O=z[1];if(O===0)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+D1(z)+")");switch(b.storage()){case"dense":i=M(b,c,O);break;case"sparse":i=n(b,c,O);break}}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+D1(z)+")")}return i}function M(b,z,i){for(var c=b._data,O=[],s,u=0;u<i;u++){s=O[u]=[];for(var l=0;l<z;l++)s[l]=g1(c[l][u])}return b.createDenseMatrix({data:O,size:[i,z],datatype:b._datatype})}function n(b,z,i){for(var c=b._values,O=b._index,s=b._ptr,u=c?[]:void 0,l=[],q=[],A=[],h=0;h<z;h++)A[h]=0;var d,m,_;for(d=0,m=O.length;d<m;d++)A[O[d]]++;for(var R=0,g=0;g<z;g++)q.push(R),R+=A[g],A[g]=q[g];for(q.push(R),_=0;_<i;_++)for(var L=s[_],y=s[_+1],D=L;D<y;D++){var T=A[O[D]]++;l[T]=_,c&&(u[T]=g1(c[D]))}return b.createSparseMatrix({values:u,index:l,ptr:q,size:[i,z],datatype:b._datatype})}}),Ka="ctranspose",qW=["typed","transpose","conj"],hW=h0(Ka,qW,o=>{var{typed:e,transpose:t,conj:r}=o;return e(Ka,{any:function(n){return r(t(n))}})}),Ja="mode",WW=["typed","isNaN","isNumeric"],_W=h0(Ja,WW,o=>{var{typed:e,isNaN:t,isNumeric:r}=o;return e(Ja,{"Array | Matrix":M,"...":function(b){return M(b)}});function M(n){n=Zb(n.valueOf());var b=n.length;if(b===0)throw new Error("Cannot calculate mode of an empty array");for(var z={},i=[],c=0,O=0;O<n.length;O++){var s=n[O];if(r(s)&&t(s))throw new Error("Cannot calculate mode of an array containing NaN values");s in z||(z[s]=0),z[s]++,z[s]===c?i.push(s):z[s]>c&&(c=z[s],i=[s])}return i}});function Nt(o,e,t){var r;return String(o).indexOf("Unexpected type")!==-1?(r=arguments.length>2?" (type: "+_t(t)+", value: "+JSON.stringify(t)+")":" (type: "+o.data.actual+")",new TypeError("Cannot calculate "+e+", unexpected type of argument"+r)):String(o).indexOf("complex numbers")!==-1?(r=arguments.length>2?" (type: "+_t(t)+", value: "+JSON.stringify(t)+")":"",new TypeError("Cannot calculate "+e+", no ordering relation is defined for complex numbers"+r)):o}var Qa="prod",mW=["typed","config","multiplyScalar","numeric"],gW=h0(Qa,mW,o=>{var{typed:e,config:t,multiplyScalar:r,numeric:M}=o;return e(Qa,{"Array | Matrix":n,"Array | Matrix, number | BigNumber":function(z,i){throw new Error("prod(A, dim) is not yet supported")},"...":function(z){return n(z)}});function n(b){var z;if(lM(b,function(i){try{z=z===void 0?i:r(z,i)}catch(c){throw Nt(c,"prod",i)}}),typeof z=="string"&&(z=M(z,t.number)),z===void 0)throw new Error("Cannot calculate prod of an empty array");return z}}),RW="numeric",vW=["number","?bignumber","?fraction"],LW=h0(RW,vW,o=>{var{number:e,bignumber:t,fraction:r}=o,M={string:!0,number:!0,BigNumber:!0,Fraction:!0},n={number:b=>e(b),BigNumber:t?b=>t(b):cW,Fraction:r?b=>r(b):aW};return function(z){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"number",c=arguments.length>2?arguments[2]:void 0;if(c!==void 0)throw new SyntaxError("numeric() takes one or two arguments");var O=_t(z);if(!(O in M))throw new TypeError("Cannot convert "+z+' of type "'+O+'"; valid input types are '+Object.keys(M).join(", "));if(!(i in n))throw new TypeError("Cannot convert "+z+' to type "'+i+'"; valid output types are '+Object.keys(n).join(", "));return i===O?z:n[i](z)}}),Za="divideScalar",NW=["typed","numeric"],yW=h0(Za,NW,o=>{var{typed:e,numeric:t}=o;return e(Za,{"number, number":function(M,n){return M/n},"Complex, Complex":function(M,n){return M.div(n)},"BigNumber, BigNumber":function(M,n){return M.div(n)},"Fraction, Fraction":function(M,n){return M.div(n)},"Unit, number | Complex | Fraction | BigNumber | Unit":(r,M)=>r.divide(M),"number | Fraction | Complex | BigNumber, Unit":(r,M)=>M.divideInto(r)})}),es="pow",BW=["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],wW=h0(es,BW,o=>{var{typed:e,config:t,identity:r,multiply:M,matrix:n,inv:b,number:z,fraction:i,Complex:c}=o;return e(es,{"number, number":O,"Complex, Complex":function(q,A){return q.pow(A)},"BigNumber, BigNumber":function(q,A){return A.isInteger()||q>=0||t.predictable?q.pow(A):new c(q.toNumber(),0).pow(A.toNumber(),0)},"Fraction, Fraction":function(q,A){var h=q.pow(A);if(h!=null)return h;if(t.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return O(q.valueOf(),A.valueOf())},"Array, number":s,"Array, BigNumber":function(q,A){return s(q,A.toNumber())},"Matrix, number":u,"Matrix, BigNumber":function(q,A){return u(q,A.toNumber())},"Unit, number | BigNumber":function(q,A){return q.pow(A)}});function O(l,q){if(t.predictable&&!U1(q)&&l<0)try{var A=i(q),h=z(A);if((q===h||Math.abs((q-h)/q)<1e-14)&&A.d%2===1)return(A.n%2===0?1:-1)*Math.pow(-l,q)}catch{}return t.predictable&&(l<-1&&q===1/0||l>-1&&l<0&&q===-1/0)?NaN:U1(q)||l>=0||t.predictable?Ra(l,q):l*l<1&&q===1/0||l*l>1&&q===-1/0?0:new c(l,0).pow(q,0)}function s(l,q){if(!U1(q))throw new TypeError("For A^b, b must be an integer (value is "+q+")");var A=o2(l);if(A.length!==2)throw new Error("For A^b, A must be 2 dimensional (A has "+A.length+" dimensions)");if(A[0]!==A[1])throw new Error("For A^b, A must be square (size is "+A[0]+"x"+A[1]+")");if(q<0)try{return s(b(l),-q)}catch(m){throw m.message==="Cannot calculate inverse, determinant is zero"?new TypeError("For A^b, when A is not invertible, b must be a positive integer (value is "+q+")"):m}for(var h=r(A[0]).valueOf(),d=l;q>=1;)(q&1)===1&&(h=M(d,h)),q>>=1,d=M(d,d);return h}function u(l,q){return n(s(l.valueOf(),q))}}),ts="dotDivide",DW=["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],XW=h0(ts,DW,o=>{var{typed:e,matrix:t,equalScalar:r,divideScalar:M,DenseMatrix:n,concat:b}=o,z=Rh({typed:e,equalScalar:r}),i=wr({typed:e}),c=Co({typed:e,DenseMatrix:n}),O=ip({typed:e,equalScalar:r}),s=Br({typed:e,DenseMatrix:n}),u=Vt({typed:e,matrix:t,concat:b});return e(ts,u({elop:M,SS:c,DS:i,SD:z,Ss:O,sS:s}))}),xo="compare",EW=["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],TW=h0(xo,EW,o=>{var{typed:e,config:t,equalScalar:r,matrix:M,BigNumber:n,Fraction:b,DenseMatrix:z,concat:i}=o,c=wr({typed:e}),O=xa({typed:e,equalScalar:r}),s=Br({typed:e,DenseMatrix:z}),u=Vt({typed:e,matrix:M,concat:i}),l=Eo({typed:e});return e(xo,CW({typed:e,config:t}),{"boolean, boolean":function(A,h){return A===h?0:A>h?1:-1},"BigNumber, BigNumber":function(A,h){return Xo(A,h,t.epsilon)?new n(0):new n(A.cmp(h))},"Fraction, Fraction":function(A,h){return new b(A.compare(h))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},l,u({SS:O,DS:c,Ss:s}))}),CW=h0(xo,["typed","config"],o=>{var{typed:e,config:t}=o;return e(xo,{"number, number":function(M,n){return Gt(M,n,t.epsilon)?0:M>n?1:-1}})}),So="equal",xW=["typed","matrix","equalScalar","DenseMatrix","concat"],SW=h0(So,xW,o=>{var{typed:e,matrix:t,equalScalar:r,DenseMatrix:M,concat:n}=o,b=wr({typed:e}),z=Co({typed:e,DenseMatrix:M}),i=Br({typed:e,DenseMatrix:M}),c=Vt({typed:e,matrix:t,concat:n});return e(So,FW({typed:e,equalScalar:r}),c({elop:r,SS:z,DS:b,Ss:i}))}),FW=h0(So,["typed","equalScalar"],o=>{var{typed:e,equalScalar:t}=o;return e(So,{"any, any":function(M,n){return M===null?n===null:n===null?M===null:M===void 0?n===void 0:n===void 0?M===void 0:t(M,n)}})}),Fo="smaller",IW=["typed","config","matrix","DenseMatrix","concat"],PW=h0(Fo,IW,o=>{var{typed:e,config:t,matrix:r,DenseMatrix:M,concat:n}=o,b=wr({typed:e}),z=Co({typed:e,DenseMatrix:M}),i=Br({typed:e,DenseMatrix:M}),c=Vt({typed:e,matrix:r,concat:n}),O=Eo({typed:e});return e(Fo,kW({typed:e,config:t}),{"boolean, boolean":(s,u)=>s<u,"BigNumber, BigNumber":function(u,l){return u.lt(l)&&!Xo(u,l,t.epsilon)},"Fraction, Fraction":(s,u)=>s.compare(u)===-1,"Complex, Complex":function(u,l){throw new TypeError("No ordering relation is defined for complex numbers")}},O,c({SS:z,DS:b,Ss:i}))}),kW=h0(Fo,["typed","config"],o=>{var{typed:e,config:t}=o;return e(Fo,{"number, number":function(M,n){return M<n&&!Gt(M,n,t.epsilon)}})}),Io="larger",$W=["typed","config","matrix","DenseMatrix","concat"],UW=h0(Io,$W,o=>{var{typed:e,config:t,matrix:r,DenseMatrix:M,concat:n}=o,b=wr({typed:e}),z=Co({typed:e,DenseMatrix:M}),i=Br({typed:e,DenseMatrix:M}),c=Vt({typed:e,matrix:r,concat:n}),O=Eo({typed:e});return e(Io,jW({typed:e,config:t}),{"boolean, boolean":(s,u)=>s>u,"BigNumber, BigNumber":function(u,l){return u.gt(l)&&!Xo(u,l,t.epsilon)},"Fraction, Fraction":(s,u)=>s.compare(u)===1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},O,c({SS:z,DS:b,Ss:i}))}),jW=h0(Io,["typed","config"],o=>{var{typed:e,config:t}=o;return e(Io,{"number, number":function(M,n){return M>n&&!Gt(M,n,t.epsilon)}})}),rs="deepEqual",HW=["typed","equal"],YW=h0(rs,HW,o=>{var{typed:e,equal:t}=o;return e(rs,{"any, any":function(n,b){return r(n.valueOf(),b.valueOf())}});function r(M,n){if(Array.isArray(M))if(Array.isArray(n)){var b=M.length;if(b!==n.length)return!1;for(var z=0;z<b;z++)if(!r(M[z],n[z]))return!1;return!0}else return!1;else return Array.isArray(n)?!1:t(M,n)}}),Ms="partitionSelect",GW=["typed","isNumeric","isNaN","compare"],VW=h0(Ms,GW,o=>{var{typed:e,isNumeric:t,isNaN:r,compare:M}=o,n=M,b=(c,O)=>-M(c,O);return e(Ms,{"Array | Matrix, number":function(O,s){return z(O,s,n)},"Array | Matrix, number, string":function(O,s,u){if(u==="asc")return z(O,s,n);if(u==="desc")return z(O,s,b);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":z});function z(c,O,s){if(!U1(O)||O<0)throw new Error("k must be a non-negative integer");if(P1(c)){var u=c.size();if(u.length>1)throw new Error("Only one dimensional matrices supported");return i(c.valueOf(),O,s)}if(Array.isArray(c))return i(c,O,s)}function i(c,O,s){if(O>=c.length)throw new Error("k out of bounds");for(var u=0;u<c.length;u++)if(t(c[u])&&r(c[u]))return c[u];for(var l=0,q=c.length-1;l<q;){for(var A=l,h=q,d=c[Math.floor(Math.random()*(q-l+1))+l];A<h;)if(s(c[A],d)>=0){var m=c[h];c[h]=c[A],c[A]=m,--h}else++A;s(c[A],d)>0&&--A,O<=A?q=A:l=A+1}return c[O]}}),os="max",KW=["typed","config","numeric","larger"],JW=h0(os,KW,o=>{var{typed:e,config:t,numeric:r,larger:M}=o;return e(os,{"Array | Matrix":b,"Array | Matrix, number | BigNumber":function(i,c){return zp(i,c.valueOf(),n)},"...":function(i){if(Bo(i))throw new TypeError("Scalar values expected in function max");return b(i)}});function n(z,i){try{return M(z,i)?z:i}catch(c){throw Nt(c,"max",i)}}function b(z){var i;if(lM(z,function(c){try{isNaN(c)&&typeof c=="number"?i=NaN:(i===void 0||M(c,i))&&(i=c)}catch(O){throw Nt(O,"max",c)}}),i===void 0)throw new Error("Cannot calculate max of an empty array");return typeof i=="string"&&(i=r(i,t.number)),i}}),ns="min",QW=["typed","config","numeric","smaller"],ZW=h0(ns,QW,o=>{var{typed:e,config:t,numeric:r,smaller:M}=o;return e(ns,{"Array | Matrix":b,"Array | Matrix, number | BigNumber":function(i,c){return zp(i,c.valueOf(),n)},"...":function(i){if(Bo(i))throw new TypeError("Scalar values expected in function min");return b(i)}});function n(z,i){try{return M(z,i)?z:i}catch(c){throw Nt(c,"min",i)}}function b(z){var i;if(lM(z,function(c){try{isNaN(c)&&typeof c=="number"?i=NaN:(i===void 0||M(c,i))&&(i=c)}catch(O){throw Nt(O,"min",c)}}),i===void 0)throw new Error("Cannot calculate min of an empty array");return typeof i=="string"&&(i=r(i,t.number)),i}}),bs="add",e6=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],t6=h0(bs,e6,o=>{var{typed:e,matrix:t,addScalar:r,equalScalar:M,DenseMatrix:n,SparseMatrix:b,concat:z}=o,i=Sa({typed:e}),c=kh({typed:e,equalScalar:M}),O=Fa({typed:e,DenseMatrix:n}),s=Vt({typed:e,matrix:t,concat:z});return e(bs,{"any, any":r,"any, any, ...any":e.referToSelf(u=>(l,q,A)=>{for(var h=u(l,q),d=0;d<A.length;d++)h=u(h,A[d]);return h})},s({elop:r,DS:i,SS:c,Ss:O}))}),ps="dot",r6=["typed","addScalar","multiplyScalar","conj","size"],M6=h0(ps,r6,o=>{var{typed:e,addScalar:t,multiplyScalar:r,conj:M,size:n}=o;return e(ps,{"Array | DenseMatrix, Array | DenseMatrix":z,"SparseMatrix, SparseMatrix":i});function b(O,s){var u=c(O),l=c(s),q,A;if(u.length===1)q=u[0];else if(u.length===2&&u[1]===1)q=u[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+u.join(", ")+")");if(l.length===1)A=l[0];else if(l.length===2&&l[1]===1)A=l[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+l.join(", ")+")");if(q!==A)throw new RangeError("Vectors must have equal length ("+q+" != "+A+")");if(q===0)throw new RangeError("Cannot calculate the dot product of empty vectors");return q}function z(O,s){var u=b(O,s),l=P1(O)?O._data:O,q=P1(O)?O._datatype||O.getDataType():void 0,A=P1(s)?s._data:s,h=P1(s)?s._datatype||s.getDataType():void 0,d=c(O).length===2,m=c(s).length===2,_=t,R=r;if(q&&h&&q===h&&typeof q=="string"&&q!=="mixed"){var g=q;_=e.find(t,[g,g]),R=e.find(r,[g,g])}if(!d&&!m){for(var L=R(M(l[0]),A[0]),y=1;y<u;y++)L=_(L,R(M(l[y]),A[y]));return L}if(!d&&m){for(var D=R(M(l[0]),A[0][0]),T=1;T<u;T++)D=_(D,R(M(l[T]),A[T][0]));return D}if(d&&!m){for(var N=R(M(l[0][0]),A[0]),w=1;w<u;w++)N=_(N,R(M(l[w][0]),A[w]));return N}if(d&&m){for(var C=R(M(l[0][0]),A[0][0]),P=1;P<u;P++)C=_(C,R(M(l[P][0]),A[P][0]));return C}}function i(O,s){b(O,s);for(var u=O._index,l=O._values,q=s._index,A=s._values,h=0,d=t,m=r,_=0,R=0;_<u.length&&R<q.length;){var g=u[_],L=q[R];if(g<L){_++;continue}if(g>L){R++;continue}g===L&&(h=d(h,m(l[_],A[R])),_++,R++)}return h}function c(O){return P1(O)?O.size():n(O)}}),o6="trace",n6=["typed","matrix","add"],b6=h0(o6,n6,o=>{var{typed:e,matrix:t,add:r}=o;return e("trace",{Array:function(z){return M(t(z))},SparseMatrix:n,DenseMatrix:M,any:g1});function M(b){var z=b._size,i=b._data;switch(z.length){case 1:if(z[0]===1)return g1(i[0]);throw new RangeError("Matrix must be square (size: "+D1(z)+")");case 2:{var c=z[0],O=z[1];if(c===O){for(var s=0,u=0;u<c;u++)s=r(s,i[u][u]);return s}else throw new RangeError("Matrix must be square (size: "+D1(z)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+D1(z)+")")}}function n(b){var z=b._values,i=b._index,c=b._ptr,O=b._size,s=O[0],u=O[1];if(s===u){var l=0;if(z.length>0)for(var q=0;q<u;q++)for(var A=c[q],h=c[q+1],d=A;d<h;d++){var m=i[d];if(m===q){l=r(l,z[d]);break}if(m>q)break}return l}throw new RangeError("Matrix must be square (size: "+D1(O)+")")}}),zs="det",p6=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],z6=h0(zs,p6,o=>{var{typed:e,matrix:t,subtractScalar:r,multiply:M,divideScalar:n,isZero:b,unaryMinus:z}=o;return e(zs,{any:function(O){return g1(O)},"Array | Matrix":function(O){var s;switch(P1(O)?s=O.size():Array.isArray(O)?(O=t(O),s=O.size()):s=[],s.length){case 0:return g1(O);case 1:if(s[0]===1)return g1(O.valueOf()[0]);if(s[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+D1(s)+")");case 2:{var u=s[0],l=s[1];if(u===l)return i(O.clone().valueOf(),u);if(l===0)return 1;throw new RangeError("Matrix must be square (size: "+D1(s)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+D1(s)+")")}}});function i(c,O,s){if(O===1)return g1(c[0][0]);if(O===2)return r(M(c[0][0],c[1][1]),M(c[1][0],c[0][1]));for(var u=!1,l=new Array(O).fill(0).map((y,D)=>D),q=0;q<O;q++){var A=l[q];if(b(c[A][q])){var h=void 0;for(h=q+1;h<O;h++)if(!b(c[l[h]][q])){A=l[h],l[h]=l[q],l[q]=A,u=!u;break}if(h===O)return c[A][q]}for(var d=c[A][q],m=q===0?1:c[l[q-1]][q-1],_=q+1;_<O;_++)for(var R=l[_],g=q+1;g<O;g++)c[R][g]=n(r(M(c[R][g],d),M(c[R][q],c[A][g])),m)}var L=c[l[O-1]][O-1];return u?z(L):L}}),is="inv",i6=["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],c6=h0(is,i6,o=>{var{typed:e,matrix:t,divideScalar:r,addScalar:M,multiply:n,unaryMinus:b,det:z,identity:i,abs:c}=o;return e(is,{"Array | Matrix":function(u){var l=P1(u)?u.size():o2(u);switch(l.length){case 1:if(l[0]===1)return P1(u)?t([r(1,u.valueOf()[0])]):[r(1,u[0])];throw new RangeError("Matrix must be square (size: "+D1(l)+")");case 2:{var q=l[0],A=l[1];if(q===A)return P1(u)?t(O(u.valueOf(),q,A),u.storage()):O(u,q,A);throw new RangeError("Matrix must be square (size: "+D1(l)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+D1(l)+")")}},any:function(u){return r(1,u)}});function O(s,u,l){var q,A,h,d,m;if(u===1){if(d=s[0][0],d===0)throw Error("Cannot calculate inverse, determinant is zero");return[[r(1,d)]]}else if(u===2){var _=z(s);if(_===0)throw Error("Cannot calculate inverse, determinant is zero");return[[r(s[1][1],_),r(b(s[0][1]),_)],[r(b(s[1][0]),_),r(s[0][0],_)]]}else{var R=s.concat();for(q=0;q<u;q++)R[q]=R[q].concat();for(var g=i(u).valueOf(),L=0;L<l;L++){var y=c(R[L][L]),D=L;for(q=L+1;q<u;)c(R[q][L])>y&&(y=c(R[q][L]),D=q),q++;if(y===0)throw Error("Cannot calculate inverse, determinant is zero");q=D,q!==L&&(m=R[L],R[L]=R[q],R[q]=m,m=g[L],g[L]=g[q],g[q]=m);var T=R[L],N=g[L];for(q=0;q<u;q++){var w=R[q],C=g[q];if(q!==L){if(w[L]!==0){for(h=r(b(w[L]),T[L]),A=L;A<l;A++)w[A]=M(w[A],n(h,T[A]));for(A=0;A<l;A++)C[A]=M(C[A],n(h,N[A]))}}else{for(h=T[L],A=L;A<l;A++)w[A]=r(w[A],h);for(A=0;A<l;A++)C[A]=r(C[A],h)}}}return g}}}),cs="pinv",a6=["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],s6=h0(cs,a6,o=>{var{typed:e,matrix:t,inv:r,deepEqual:M,equal:n,dotDivide:b,dot:z,ctranspose:i,divideScalar:c,multiply:O,add:s,Complex:u}=o;return e(cs,{"Array | Matrix":function(_){var R=P1(_)?_.size():o2(_);switch(R.length){case 1:return d(_)?i(_):R[0]===1?r(_):b(i(_),z(_,_));case 2:{if(d(_))return i(_);var g=R[0],L=R[1];if(g===L)try{return r(_)}catch(y){if(!(y instanceof Error&&y.message.match(/Cannot calculate inverse, determinant is zero/)))throw y}return P1(_)?t(l(_.valueOf(),g,L),_.storage()):l(_,g,L)}default:throw new RangeError("Matrix must be two dimensional (size: "+D1(R)+")")}},any:function(_){return n(_,0)?g1(_):c(1,_)}});function l(m,_,R){var{C:g,F:L}=A(m,_,R),y=O(r(O(i(g),g)),i(g)),D=O(i(L),r(O(L,i(L))));return O(D,y)}function q(m,_,R){for(var g=g1(m),L=0,y=0;y<_;y++){if(R<=L)return g;for(var D=y;h(g[D][L]);)if(D++,_===D&&(D=y,L++,R===L))return g;[g[D],g[y]]=[g[y],g[D]];for(var T=g[y][L],N=0;N<R;N++)g[y][N]=b(g[y][N],T);for(var w=0;w<_;w++)if(w!==y){T=g[w][L];for(var C=0;C<R;C++)g[w][C]=s(g[w][C],O(-1,O(T,g[y][C])))}L++}return g}function A(m,_,R){var g=q(m,_,R),L=m.map((D,T)=>D.filter((N,w)=>w<_&&!h(z(g[w],g[w])))),y=g.filter((D,T)=>!h(z(g[T],g[T])));return{C:L,F:y}}function h(m){return n(s(m,u(1,1)),s(0,u(1,1)))}function d(m){return M(s(m,u(1,1)),s(O(m,0),u(1,1)))}}),O6="divide",u6=["typed","matrix","multiply","equalScalar","divideScalar","inv"],A6=h0(O6,u6,o=>{var{typed:e,matrix:t,multiply:r,equalScalar:M,divideScalar:n,inv:b}=o,z=ip({typed:e,equalScalar:M}),i=cp({typed:e});return e("divide",Bc({"Array | Matrix, Array | Matrix":function(O,s){return r(O,b(s))},"DenseMatrix, any":function(O,s){return i(O,s,n,!1)},"SparseMatrix, any":function(O,s){return z(O,s,n,!1)},"Array, any":function(O,s){return i(t(O),s,n,!1).valueOf()},"any, Array | Matrix":function(O,s){return r(O,b(s))}},n.signatures))}),as="sum",f6=["typed","config","add","numeric"],l6=h0(as,f6,o=>{var{typed:e,config:t,add:r,numeric:M}=o;return e(as,{"Array | Matrix":n,"Array | Matrix, number | BigNumber":b,"...":function(i){if(Bo(i))throw new TypeError("Scalar values expected in function sum");return n(i)}});function n(z){var i;return lM(z,function(c){try{i=i===void 0?c:r(i,c)}catch(O){throw Nt(O,"sum",c)}}),i===void 0&&(i=M(0,t.number)),typeof i=="string"&&(i=M(i,t.number)),i}function b(z,i){try{var c=zp(z,i,r);return c}catch(O){throw Nt(O,"sum")}}}),ss="median",d6=["typed","add","divide","compare","partitionSelect"],q6=h0(ss,d6,o=>{var{typed:e,add:t,divide:r,compare:M,partitionSelect:n}=o;function b(c){try{c=Zb(c.valueOf());var O=c.length;if(O===0)throw new Error("Cannot calculate median of an empty array");if(O%2===0){for(var s=O/2-1,u=n(c,s+1),l=c[s],q=0;q<s;++q)M(c[q],l)>0&&(l=c[q]);return i(l,u)}else{var A=n(c,(O-1)/2);return z(A)}}catch(h){throw Nt(h,"median")}}var z=e({"number | BigNumber | Complex | Unit":function(O){return O}}),i=e({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(O,s){return r(t(O,s),2)}});return e(ss,{"Array | Matrix":b,"Array | Matrix, number | BigNumber":function(O,s){throw new Error("median(A, dim) is not yet supported")},"...":function(O){if(Bo(O))throw new TypeError("Scalar values expected in function median");return b(O)}})}),Po=h5({config:U2}),ap=g5({}),sp=N5({}),Op=w5({}),xe=E5({Matrix:Op}),S0=mq({BigNumber:Po,Complex:ap,DenseMatrix:xe,Fraction:sp}),h6=sh({typed:S0}),ko=uh({typed:S0}),W6=Mh({BigNumber:Po,typed:S0}),Os=tW({typed:S0}),yt=H5({config:U2,typed:S0}),$o=x5({typed:S0}),_6=P5({typed:S0}),Uo=Yh({typed:S0}),us=eh({typed:S0}),up=V5({Matrix:Op,equalScalar:yt,typed:S0}),As=fh({typed:S0}),fs=$5({typed:S0}),Ap=ch({typed:S0}),ls=bh({Fraction:sp,typed:S0}),ds=F5({typed:S0}),n2=zh({DenseMatrix:xe,Matrix:Op,SparseMatrix:up,typed:S0}),qs=_W({isNaN:fs,isNumeric:ds,typed:S0}),dM=LW({bignumber:W6,fraction:ls,number:us}),m6=gW({config:U2,multiplyScalar:Uo,numeric:dM,typed:S0}),g6=uW({isInteger:$o,matrix:n2,typed:S0}),hs=fW({matrix:n2,config:U2,typed:S0}),Ws=dW({matrix:n2,typed:S0}),Kt=MW({isInteger:$o,matrix:n2,typed:S0}),R6=nW({prod:m6,size:hs,typed:S0}),v6=hW({conj:Os,transpose:Ws,typed:S0}),qM=yW({numeric:dM,typed:S0}),L6=XW({DenseMatrix:xe,concat:Kt,divideScalar:qM,equalScalar:yt,matrix:n2,typed:S0}),_s=SW({DenseMatrix:xe,concat:Kt,equalScalar:yt,matrix:n2,typed:S0}),ms=pW({BigNumber:Po,DenseMatrix:xe,SparseMatrix:up,config:U2,matrix:n2,typed:S0}),N6=iW({matrix:n2,multiplyScalar:Uo,typed:S0}),y6=PW({DenseMatrix:xe,concat:Kt,config:U2,matrix:n2,typed:S0}),B6=Jh({DenseMatrix:xe,concat:Kt,equalScalar:yt,matrix:n2,subtractScalar:As,typed:S0,unaryMinus:Ap}),hM=t6({DenseMatrix:xe,SparseMatrix:up,addScalar:ko,concat:Kt,equalScalar:yt,matrix:n2,typed:S0}),gs=TW({BigNumber:Po,DenseMatrix:xe,Fraction:sp,concat:Kt,config:U2,equalScalar:yt,matrix:n2,typed:S0}),w6=YW({equal:_s,typed:S0}),Rs=M6({addScalar:ko,conj:Os,multiplyScalar:Uo,size:hs,typed:S0}),D6=UW({DenseMatrix:xe,concat:Kt,config:U2,matrix:n2,typed:S0}),fp=ZW({config:U2,numeric:dM,smaller:y6,typed:S0}),Dr=Vh({addScalar:ko,dot:Rs,equalScalar:yt,matrix:n2,multiplyScalar:Uo,typed:S0}),X6=VW({compare:gs,isNaN:fs,isNumeric:ds,typed:S0}),E6=l6({add:hM,config:U2,numeric:dM,typed:S0}),T6=b6({add:hM,matrix:n2,typed:S0}),vs=z6({divideScalar:qM,isZero:_6,matrix:n2,multiply:Dr,subtractScalar:As,typed:S0,unaryMinus:Ap}),C6=JW({config:U2,larger:D6,numeric:dM,typed:S0}),jo=c6({abs:h6,addScalar:ko,det:vs,divideScalar:qM,identity:ms,matrix:n2,multiply:Dr,typed:S0,unaryMinus:Ap}),x6=s6({Complex:ap,add:hM,ctranspose:v6,deepEqual:w6,divideScalar:qM,dot:Rs,dotDivide:L6,equal:_s,inv:jo,matrix:n2,multiply:Dr,typed:S0}),S6=wW({Complex:ap,config:U2,fraction:ls,identity:ms,inv:jo,matrix:n2,multiply:Dr,number:us,typed:S0}),F6=A6({divideScalar:qM,equalScalar:yt,inv:jo,matrix:n2,multiply:Dr,typed:S0}),Ls=q6({add:hM,compare:gs,divide:F6,partitionSelect:X6,typed:S0});class I6{constructor(e,t,r){E(this,"_cacheData");E(this,"_variables");E(this,"_math");E(this,"_timeframe");this._cacheData={},this._variables=e,this._math=t,this._timeframe=r}get _taCacheData(){return this._cacheData}set _taCacheData(e){this._cacheData=e}alma({series:e,length:t,offset:r,sigma:M,floor:n,isSeriesLen:b},z){if(t===void 0||r===void 0||M===void 0)return;const i=this._cacheDataList(e,t,`alma_${z}`,b);if(i===void 0)return;let c=r*(t-1);n&&(c=Math.floor(c));const O=t/M;let s=0,u=0;for(let l=0;l<=t-1;l++){const q=Math.exp(-1*Math.pow(l-c,2)/(2*Math.pow(O,2)));s+=q,u+=i[i.length-1-(t-l-1)]*q}return u/s}sma({source:e,length:t,isSeriesLen:r},M){if(e===void 0||isNaN(e)||t===void 0)return;let n=0;const b=this._cacheDataList(e,t,`sma_${M}`,r);if(b===void 0)return;const z=b.slice(-t);return n=E6(...z)/t,n}rma({source:e,length:t,isSeriesLen:r},M){if(e===void 0||t===void 0||isNaN(e))return;const n=this._verifyCacheData(`rma_${M}`);if(n)return n==null?void 0:n.sum;const{sum:b}=this._getCacheData(`rma_${M}`),z=1/t,i=this.sma({source:e,length:t,isSeriesLen:r},M),c=b===void 0?i:z*e+(1-z)*(b||0);return this._cacheDataHandle(`rma_${M}`,{sum:c}),c}atr({length:e,isSeriesLen:t},r){const M=this._verifyCacheData(`atr_${r}`);if(M)return M==null?void 0:M.value;const{high:n,close:b}=this._getCacheData(`atr_${r}`),{high:z,close:i,low:c}=this._variables,O=n===void 0?z-c:Math.max(Math.max(z-c,Math.abs(z-b)),Math.abs(c-b)),s=this.rma({source:O,length:e,isSeriesLen:t},r);return this._cacheDataHandle(`atr_${r}`,{high:z,close:i,value:s}),s}barssince({condition:e},t){const r=this._verifyCacheData(`barssince_${t}`);if(r)return r==null?void 0:r.count;let{count:M}=this._getCacheData(`barssince_${t}`);if(e)M=0;else{if(M===void 0)return;M+=1}return this._cacheDataHandle(`barssince_${t}`,{count:M}),M}stdev({source:e,length:t,biased:r=!0,isSeriesLen:M},n){if(e===void 0||isNaN(e)||t===void 0)return;const b=this._cacheDataList(e,t,`stdev_${n}`,M),z=this.sma({source:e,length:t,isSeriesLen:M},n);if(b===void 0)return;let i=0;for(let c=0;c<t;c++){const O=this._sum(b[b.length-1-c],-(z||0));i+=O*O}return r||t<=1?Math.sqrt(i/t):Math.sqrt(i/(t-1))}_sum(e,t){let M=e+t;return Math.abs(M)<=1e-10&&(M=0),M}bb({series:e,length:t,mult:r,isSeriesLen:M},n){if(e===void 0||isNaN(e)||t===void 0||r===void 0)return[];const b=this.sma({source:e,length:t,isSeriesLen:M},n),z=this.stdev({source:e,length:t,isSeriesLen:M},n);if(b===void 0||z===void 0)return[];const i=r*z;return[b,b+i,b-i]}bbw({series:e,length:t,mult:r,isSeriesLen:M},n){if(e===void 0||isNaN(e)||t===void 0||r===void 0)return;const b=this.sma({source:e,length:t,isSeriesLen:M},n),z=this.stdev({source:e,length:t,isSeriesLen:M},n);if(b===void 0||z===void 0)return;const i=r*z;return(b+i-(b-i))/b}cci({source:e,length:t,isSeriesLen:r},M){if(e===void 0||isNaN(e)||t===void 0)return;const n=this.sma({source:e,length:t,isSeriesLen:r},M),b=this.dev({source:e,length:t,isSeriesLen:r},M);if(!(n===void 0||b===void 0))return(e-n)/(.015*b)}change({source:e,length:t=1,isSeriesLen:r},M){const n=this._cacheDataList(e,t,`change_${M}`,r);if(n===void 0)return;const b=n[n.length-1-t];if(!(e===void 0||isNaN(e)))return b===void 0?b:typeof e=="boolean"?b!==e:e-b}cmo({series:e,length:t},r){if(e===void 0||isNaN(e)||t===void 0)return;const M=this.change({source:e},r);if(M===void 0)return;const n=this._math.sum({source:M>=0?M:0,length:t},`sm1_${r}`),b=this._math.sum({source:M>=0?0:-M,length:t},`sm2_${r}`);if(!(n===void 0||b===void 0))return 100*(n-b)/(n+b)}cog({source:e,length:t,isSeriesLen:r},M){if(e===void 0||isNaN(e)||t===void 0)return;const n=this._cacheDataList(e,t,`cog_${M}`,r),b=this._math.sum({source:e,length:t},M);if(b===void 0||n===void 0)return;let z=0;for(let i=0;i<t;i++){const c=n[n.length-1-i];z+=c*(i+1)}return-z/b}correlation({source1:e,source2:t,length:r,isSeriesLen:M},n){if(e===void 0||isNaN(e)||t===void 0||isNaN(t)||r===void 0)return;const b=this._cacheDataList([e,t],r,`correlation_${n}`,M),z=this.sma({source:e,length:r,isSeriesLen:M},`sma1_${n}`),i=this.sma({source:t,length:r,isSeriesLen:M},`sma2_${n}`);if(z===void 0||i===void 0||b===void 0)return;let c=0,O=0,s=0;for(let l=0;l<r;l++){const[q,A]=b[b.length-1-l],h=q-z,d=A-i;c+=h*d,O+=h*h,s+=d*d}return isNaN(O)||isNaN(c)||isNaN(s)?void 0:c/Math.sqrt(O*s)}cross({source1:e,source2:t},r){if(e===void 0||t===void 0)return!1;const M=this._verifyCacheData(`cross_${r}`);if(M)return M==null?void 0:M.value;const{source1:n,source2:b}=this._getCacheData(`cross_${r}`);let z=!1;return n===void 0||b===void 0?z=!1:z=n>=b&&e<t||n<=b&&e>t,this._cacheDataHandle(`cross_${r}`,{source1:e,source2:t,value:z}),z}crossover({source1:e,source2:t},r){if(e===void 0||t===void 0)return!1;const M=this._verifyCacheData(`crossover_${r}`);if(M)return M==null?void 0:M.value;const{source1:n,source2:b}=this._getCacheData(`crossover_${r}`);let z=!1;return n===void 0||b===void 0?z=!1:z=n<=b&&e>t,this._cacheDataHandle(`crossover_${r}`,{source1:e,source2:t,value:z}),z}crossunder({source1:e,source2:t},r){if(e===void 0||t===void 0)return!1;const M=this._verifyCacheData(`crossunder_${r}`);if(M)return M==null?void 0:M.value;const{source1:n,source2:b}=this._getCacheData(`crossunder_${r}`);let z=!1;return n===void 0||b===void 0?z=!1:z=n>=b&&e<t,this._cacheDataHandle(`crossunder_${r}`,{source1:e,source2:t,value:z}),z}cum({source:e=0},t){const r=this._verifyCacheData(`cum_${t}`);if(r)return r==null?void 0:r.sum;e=isNaN(e)?0:e;let{sum:M}=this._getCacheData(`cum_${t}`);return M=M||0,M+=e,this._cacheDataHandle(`cum_${t}`,{sum:M}),M}dev({source:e,length:t,isSeriesLen:r},M){if(e===void 0||isNaN(e)||t===void 0)return;const n=this.sma({source:e,length:t,isSeriesLen:r},M);let b=0;const z=this._cacheDataList(e,t,`dev_${M}`,r);if(!(!z||n===void 0)){for(let i=0;i<t;i++){const c=z[z.length-1-i];b+=Math.abs(c-n)}return b/t}}dmi({diLength:e,adxSmoothing:t},r){if(e===void 0||t===void 0)return[void 0,void 0,void 0];const M=`dmi_${r}`,n=this._verifyCacheData(M);if(n)return n==null?void 0:n.value;const{low:b,high:z,close:i,PDMS:c,NDMS:O,TRS:s,ADX:u,count:l=0}=this._getCacheData(M),{low:q,high:A,close:h}=this._variables;if(b===void 0||z===void 0||i===void 0)return this._cacheData[M]={low:q,high:A,close:h,PDMS:c,NDMS:O,TRS:A-q,count:1},[void 0,void 0,void 0];let d=A-z,m=b-q;d=d>m&&d>0?d:0,m=m>d&&m>0?m:0,d===m&&(d=m=0);const _=Math.max(A-q,Math.abs(A-i),Math.abs(q-i));let R={};if(l<e)R={low:q,high:A,close:h,PDMS:(c||0)+d,NDMS:(O||0)+m,TRS:(s||0)+_,count:l+1,value:[void 0,void 0,void 0]};else{const g=c-c/e+d,L=O-O/e+m,y=s-s/e+_,D=g/y*100,T=L/y*100,N=Math.abs((D-T)/(D+T))*100;let w=N,C=[D,T,void 0];if(l+1-e<t){const P=l+1-e;w=((u||0)*(P-1)+N)/P}else w=(u*(t-1)+N)/t,C=[D,T,w];R={low:q,high:A,close:h,PDMS:g,NDMS:L,TRS:y,ADX:w,count:l+1,value:C}}return this._cacheDataHandle(M,R),R.value}ema({source:e,length:t,isSeriesLen:r},M){if(e===void 0||t===void 0||isNaN(e))return;const n=this._verifyCacheData(`ema_${M}`);if(n)return n==null?void 0:n.sum;let{sum:b,count:z=1}=this._getCacheData(`ema_${M}`);const i=this.sma({source:e,length:t,isSeriesLen:r},M);if(z>t){const c=2/(t+1);b=b===void 0?e:c*e+(1-c)*(b||0)}else b=i;return z+=1,this._cacheDataHandle(`ema_${M}`,{sum:b,count:z}),b}falling({source:e,length:t},r){if(e===void 0||isNaN(e)||t===void 0)return!1;const M=this._verifyCacheData(`falling_${r}`);if(M)return M==null?void 0:M.value;const{source:n,fallings:b=[]}=this._getCacheData(`falling_${r}`);b.push(n>e);const z=b.slice(-t);let i=!1;return z.length<t?i=!1:i=z.every(c=>c),this._cacheDataHandle(`falling_${r}`,{source:e,fallings:z,value:i}),i}rising({source:e,length:t},r){if(e===void 0||isNaN(e)||t===void 0)return!1;const M=this._verifyCacheData(`rising_${r}`);if(M)return M==null?void 0:M.value;const{source:n,risings:b=[]}=this._getCacheData(`rising_${r}`);b.push(n<e);const z=b.slice(-t);let i=!1;return z.length<t?i=!1:i=z.every(c=>c),this._cacheDataHandle(`rising_${r}`,{source:e,risings:z,value:i}),i}highest({source:e,length:t,isSeriesLen:r},M){if(t===void 0||t<=0)return;const{high:n}=this._variables,b=this._cacheDataList(typeof e!="number"?n:e,t,`highest_${M}`,r,!0,!0);if(b!=null&&b.length)return Math.max(...b.slice(-t))}highestbars({source:e,length:t,isSeriesLen:r},M){if(t===void 0||t<=0)return;const{high:n}=this._variables,b=this._cacheDataList(typeof e!="number"?n:e,t,`highestbars_${M}`,r);return b?b.slice(-t).reduce((i,c,O,s)=>c>=s[i]?O:i,0)-t+1:void 0}wma({source:e,length:t,isSeriesLen:r},M){if(t===void 0||e===void 0||isNaN(e)||t<=0)return;const n=this._cacheDataList(e,t,`wma_${M}`,r);if(!n)return;let b=0,z=0;for(let i=0;i<t;i++){const c=(t-i)*t;b+=c,z+=n[n.length-1-i]*c}return z/b}hma({source:e,length:t,isSeriesLen:r},M){if(t===void 0||e===void 0||isNaN(e)||t<=0)return;const n=this.wma({source:e,length:t,isSeriesLen:r},M),b=this.wma({source:e,length:Math.round(t/2),isSeriesLen:r},`half_${M}`);return n===void 0||b===void 0?void 0:this.wma({source:2*b-n,length:Math.floor(Math.sqrt(t)),isSeriesLen:r},`hma_${M}`)}kc({series:e,length:t,mult:r,useTrueRange:M=!0,isSeriesLen:n},b){if(e===void 0||isNaN(e)||t===void 0||r===void 0)return[void 0,void 0,void 0];const z=this.ema({source:e,length:t,isSeriesLen:n},b),{ta:i,high:c,low:O}=this._variables,s=M?i.tr:c-O,u=this.ema({source:s,length:t,isSeriesLen:n},`range_${b}`);return[z,z+u*r,z-u*r]}kcw({series:e,length:t,mult:r,useTrueRange:M=!0,isSeriesLen:n},b){if(e===void 0||isNaN(e)||t===void 0||r===void 0)return;const z=this.ema({source:e,length:t,isSeriesLen:n},b),{ta:i,high:c,low:O}=this._variables,s=M?i.tr:c-O,u=this.ema({source:s,length:t,isSeriesLen:n},`range_${b}`);return(z+u*r-(z-u*r))/z}linreg({source:e,length:t,offset:r,isSeriesLen:M},n){if(t===void 0||r===void 0)return;const b=this._cacheDataList(e,t,`dev_${n}`,M);if(!b)return;const z=b.slice(-t).filter(q=>q!==void 0);let i=0,c=0,O=0,s=0;for(const[q,A]of z.entries())i+=q,c+=A,O+=q*A,s+=q*q;const u=(t*O-i*c)/(t*s-i*i);return(c-u*i)/t+u*(t-1-r)}lowest({source:e,length:t,isSeriesLen:r},M){if(t===void 0||t<=0)return;const{low:n}=this._variables,b=this._cacheDataList(typeof e!="number"?n:e,t,`lowest_${M}`,r,!0,!0);if(b!=null&&b.length)return Math.min(...b.slice(-t))}lowestbars({source:e,length:t,isSeriesLen:r},M){if(t===void 0||t<=0)return;const{low:n}=this._variables,b=this._cacheDataList(typeof e!="number"?n:e,t,`lowestbars_${M}`,r);return b?b.slice(-t).reduce((i,c,O,s)=>c<=s[i]?O:i,0)-t+1:void 0}macd({source:e,fastlen:t,slowlen:r,siglen:M},n){if(e===void 0||isNaN(e)||t===void 0||r===void 0||M===void 0)return[void 0,void 0,void 0];const b=this.ema({source:e,length:t},`ema1_${n}`),z=this.ema({source:e,length:r},`ema2_${n}`);if(b===void 0||z===void 0)return[void 0,void 0,void 0];const i=b-z,c=this.ema({source:i,length:M},`macd_${n}`);if(c===void 0)return[i,c,void 0];const O=i-c;return[i,c,O]}max({source:e},t){if(e===void 0||isNaN(e))return;let r=this._cacheData[`max_${t}`]||0;return e>r&&(r=e),this._cacheData[`max_${t}`]=r,r}min({source:e},t){if(e===void 0||isNaN(e))return;let r=this._cacheData[`min_${t}`]||1/0;return e<r&&(r=e),this._cacheData[`min_${t}`]=r,r}median({source:e,length:t,isSeriesLen:r},M){if(t===void 0||e===void 0||isNaN(e)||t<=0)return;const n=this._cacheDataList(e,t,`dev_${M}`,r);if(n)return Ls(n.slice(-t))}mfi({series:e,length:t},r){if(t===void 0||e===void 0||isNaN(e)||t<=0)return;const{volume:M}=this._variables,n=this.change({source:e},r),b=this._math.sum({source:M*(n>=0?0:e),length:t},`lower_${r}`),z=this._math.sum({source:M*(n<=0?0:e),length:t},`upper_${r}`);if(!(z===void 0||b===void 0))return 100-100/(1+z/b)}mode({source:e,length:t,isSeriesLen:r},M){if(t===void 0||e===void 0||isNaN(e)||t<=0)return;const n=this._cacheDataList(e,t,`mode_${M}`,r);if(n)return fp(qs(n.slice(-t)))}mom({source:e,length:t,isSeriesLen:r},M){if(t===void 0||t<0)return;const n=`mom_${M}`,b=this._cacheDataList(e,t,n,r);if(!b||b.length<=t||e===void 0||isNaN(e))return;let z=b.length-t-1,i;for(;i===void 0&&z>=0;)i=b[z],z--;return i===void 0?i:e-i}percentile_linear_interpolation({source:e,length:t,percentage:r,isSeriesLen:M},n){if(t===void 0||r===void 0||t<0||r<0||r>100)return;const b=this._cacheDataList(e,t,`percentile_linear_interpolation_${n}`,M);if(!b)return;const z=this._sort(b.slice(-t)),i=z.length;r/=100;const c=1/(i*2);if(r<=c)return z[0];if(r>=1-1/(i*2))return z[i-1];for(const[O,s]of z.entries()){const u=z[O-1];if(r<(O+.5)/i)return u===void 0||s===void 0?void 0:u+(s-u)*(r-(O-.5)/i)/(1/i)}}percentile_nearest_rank({source:e,length:t,percentage:r,isSeriesLen:M},n){if(t===void 0||r===void 0||e===void 0||isNaN(e)||t<0||r<0||r>100)return;const b=this._cacheDataList(e,t,`percentile_nearest_rank_${n}`,M);if(!b)return;const z=this._sort(b.slice(-t)),i=r/100*z.length;let c=Math.ceil(i)-1;return c=c<0?0:c,z[c>=z.length?z.length-1:c]}percentrank({source:e,length:t,isSeriesLen:r},M){if(t===void 0||t<0)return;const n=this._cacheDataList(e,t+1,`percentile_nearest_rank_${M}`,r);if(!n)return;const b=n.slice(-(t+1)),z=e;if(z===void 0)return;let i=0;for(let c=0;c<b.length;c++)b[c]!==void 0&&(b[c]<z||b[c]===z&&c<t)&&i++;return i/(b.length-1)*100}pivot_point_levels({type:e,anchor:t,developing:r},M){const n=z1(0,void 0,L0.FLOAT);let{close:b,open:z,low:i,high:c}=this._variables;const O=`pivot_point_levels_${M}`,s=this._verifyCacheData(O);if(s)return n._value=(s==null?void 0:s.result)||[],n;const{close:u,low:l,high:q,open:A,result:h}=this._getCacheData(O);if(!t&&(q&&l&&(c=Math.max(q,c),i=Math.min(l,i)),this._cacheDataHandle(O,{close:b,open:z,low:i,high:c,result:h}),!r))return n._value=h||[],n;const d={close:b,open:z,low:i,high:c};t===!0&&!r&&(b=u,z=A,i=l,c=q);const m=this._getPivotPointLevels(c,i,b,z,r,e);return this._cacheDataHandle(O,{...d,result:m}),n._value=m,n}_getPivotPointLevels(e,t,r,M,n,b){if(r===void 0||M===void 0||t===void 0||e===void 0)return[];switch(b){case kt.traditional:return this._traditional(e,t,r);case kt.fibonacci:return this._fibonacci(e,t,r);case kt.woodie:return n?[]:this._woodie(e,t);case kt.classic:return this._classic(e,t,r);case kt.dm:return this._DM(e,t,r,M);case kt.camarilla:return this._camarilla(e,t,r);default:return[]}}_traditional(e,t,r){const M=(e+t+r)/3,n=M*2-t,b=M+(e-t),z=M*2+(e-2*t),i=M*3+(e-3*t),c=M*4+(e-4*t),O=M*2-e,s=M-(e-t),u=M*2-(2*e-t),l=M*3-(3*e-t),q=M*4-(4*e-t);return[M,n,O,b,s,z,u,i,l,c,q]}_fibonacci(e,t,r){const M=(e+t+r)/3,n=M+.382*(e-t),b=M-.382*(e-t),z=M+.618*(e-t),i=M-.618*(e-t),c=M+(e-t),O=M-(e-t);return[M,n,b,z,i,c,O]}_woodie(e,t){const{open:r}=this._variables,M=(e+t+2*r)/4,n=2*M-t,b=2*M-e,z=M+(e-t),i=M-(e-t),c=e+2*(M-t),O=t-2*(e-M),s=c+(e-t),u=O-(e-t);return[M,n,b,z,i,c,O,s,u]}_classic(e,t,r){const M=(e+t+r)/3,n=2*M-t,b=2*M-e,z=M+(e-t),i=M-(e-t),c=M+2*(e-t),O=M-2*(e-t),s=M+3*(e-t),u=M-3*(e-t);return[M,n,b,z,i,c,O,s,u]}_DM(e,t,r,M){let n;M===r?n=e+t+2*r:r>M?n=2*e+t+r:n=2*t+e+r;const b=n/4,z=n/2-t,i=n/2-e;return[b,z,i]}_camarilla(e,t,r){const M=(e+t+r)/3,n=r+1.1*(e-t)/12,b=r-1.1*(e-t)/12,z=r+1.1*(e-t)/6,i=r-1.1*(e-t)/6,c=r+1.1*(e-t)/4,O=r-1.1*(e-t)/4,s=r+1.1*(e-t)/2,u=r-1.1*(e-t)/2,l=e/t*r,q=r-(l-r);return[M,n,b,z,i,c,O,s,u,l,q]}pivothigh(e,t){const{leftbars:r,rightbars:M}=e;if(r===void 0||M===void 0||r<0||M<0)return;let n=this._variables.high;e.hasOwnProperty("source")&&(n=e.source);const b=this._cacheDataList(n,r+M+1,`pivothigh_${t}`);if(!b)return;const z=b.slice(-(r+M+1)),i=z[r],c=z.splice(0,r+1),O=Math.max(...z),s=Math.max(...c);return i>=s&&i>O?i:void 0}pivotlow(e,t){const{leftbars:r,rightbars:M}=e;if(r===void 0||M===void 0||r<0||M<0)return;let n=this._variables.low;e.hasOwnProperty("source")&&(n=e.source);const b=this._cacheDataList(n,r+M+1,`pivotlow_${t}`);if(!b)return;const z=b.slice(-(r+M+1)),i=z[r],c=z.splice(0,r+1),O=Math.min(...z),s=Math.min(...c);return i<=s&&i<O?i:void 0}range({source:e,length:t},r){if(t===void 0||e===void 0||isNaN(e)||t<0)return;const M=this._cacheDataList(e,t,`range_${r}`,!0);if(!M)return;const n=M.filter(i=>i!==void 0).slice(-t),b=Math.max(...n),z=Math.min(...n);return b-z}roc({source:e,length:t,isSeriesLen:r},M){if(t===void 0||t<0)return;const n=this._cacheDataList(e,t+1,`roc_${M}`,r),b=this.change({source:e,length:t,isSeriesLen:r},M);if(n)return 100*b/n[n.length-1-t]}rsi({source:e,length:t,isSeriesLen:r},M){if(t===void 0||e===void 0||isNaN(e)||t<0)return;const n=this._verifyCacheData(`rsi_${M}`);if(n)return n==null?void 0:n.value;const{source:b}=this._getCacheData(`rsi_${M}`),z=Math.max(e-b,0),i=Math.max(b-e,0),c=this.rma({source:z,length:t,isSeriesLen:r},`rma1_${M}`),O=this.rma({source:i,length:t,isSeriesLen:r},`rma2_${M}`),s=c===void 0||O===void 0?void 0:100-100/(1+c/O);return this._cacheDataHandle(`rsi_${M}`,{source:e,value:s}),s}sar({start:e,inc:t,max:r},M){if(e===void 0||t===void 0||r===void 0)return;const n=this._verifyCacheData(`sar_${M}`);if(n)return n==null?void 0:n.result;const{close:b,low:z,high:i,preLow:c,preHigh:O,data:s={}}=this._getCacheData(`sar_${M}`);let{result:u,maxMin:l,acceleration:q,isBelow:A}=s,h=!1;const{close:d,low:m,high:_,bar_index:R}=this._variables;return R===1&&(d>b?(A=!0,l=_,u=z):(A=!1,l=m,u=i),h=!0,q=e),u=u+q*(l-u),A?u>m&&(h=!0,A=!1,u=Math.max(_,l||0),l=m,q=e):u<_&&(h=!0,A=!0,u=Math.min(m,l||0),l=_,q=e),h||(A?_>(l||0)&&(l=_,q=Math.min((q||0)+t,r)):m<(l||0)&&(l=m,q=Math.min((q||0)+t,r))),A?(u=Math.min(u,z),R>1&&(u=Math.min(u,c))):(u=Math.max(u,i),R>1&&(u=Math.max(u,O))),this._cacheDataHandle(`sar_${M}`,{high:_,close:d,low:m,preLow:z,preHigh:i,data:Object.assign(s,{result:u,maxMin:l,acceleration:q,isBelow:A})}),u}stoch({source:e,high:t,low:r,length:M,isSeriesLen:n},b){if(M===void 0||t===void 0||r===void 0||e===void 0||isNaN(e)||M<0)return;const z=this.lowest({source:r,length:M,isSeriesLen:n},b),i=this.highest({source:t,length:M,isSeriesLen:n},b);if(!(z===void 0||i===void 0))return 100*(e-z)/(i-z)}supertrend({factor:e,atrPeriod:t},r){if(e===void 0||t===void 0)return[void 0,void 0];const M=`supertrend_${r}`,n=this._verifyCacheData(M);if(n)return n==null?void 0:n.value;let b=1;const{hl2:z,close:i}=this._variables,{upperBand:c,lowerBand:O,superTrend:s,atr:u,close:l}=this._getCacheData(M),q=this.atr({length:t},r);if(q===void 0)return this._cacheDataHandle(M,{close:i,value:[void 0,b]}),[void 0,b];let A=z+e*q,h=z-e*q;const d=c||0,m=O||0;h=h>m||l<m?h:m,A=A<d||l>d?A:d,u===void 0?b=1:s===d?b=i>A?-1:1:b=i<h?1:-1;const _=b===-1?h:A;return this._cacheDataHandle(M,{upperBand:A,lowerBand:h,superTrend:_,atr:q,close:i,value:[_,b]}),[_,b]}swma({source:e},t){const r=this._verifyCacheData(`swma_${t}`);if(r)return r==null?void 0:r.value;let{list:M}=this._getCacheData(`swma_${t}`);M||(M=[]),M.push(e),M=M.slice(-4);const n=M.filter(b=>b!==void 0).length<4?void 0:M[3]*1/6+M[2]*2/6+M[1]*2/6+M[0]*1/6;return this._cacheDataHandle(`swma_${t}`,{list:M,value:n}),n}tr({handle_na:e=!1},t){const{close:r,low:M,high:n}=this._variables,b=this._verifyCacheData(`tr_${t}`);if(b)return b==null?void 0:b.value;const{close:z}=this._getCacheData(`tr_${t}`);let i;return z===void 0?i=e?n-M:void 0:i=Math.max(n-M,Math.abs(n-z),Math.abs(M-z)),this._cacheDataHandle(`tr_${t}`,{close:r,value:i}),i}tsi({source:e,short_length:t,long_length:r},M){if(e===void 0||isNaN(e)||t===void 0||r===void 0)return;const n=this.change({source:e},M);if(n===void 0)return;const b=this._doubleSmooth(n,r,t,M),z=this._doubleSmooth(Math.abs(n),r,t,`abs_${M}`);if(!(z===void 0||b===void 0))return b/z}_doubleSmooth(e,t,r,M){const n=this.ema({source:e,length:t},`ema1_${M}`);return this.ema({source:n,length:r},`ema2_${M}`)}valuewhen({condition:e,source:t,occurrence:r},M){if(r===void 0||r<0)return;let{list:n}=this._getCacheData(`valuewhen_${M}`);n||(n=[]),e&&n.push(t);const b=n[n.length-1-r];return this._cacheDataHandle(`valuewhen_${M}`,{list:n,value:b}),b}variance({source:e,length:t,biased:r=!0,isSeriesLen:M},n){if(e===void 0||isNaN(e)||t===void 0||t<0)return;const b=this.sma({source:e,length:t,isSeriesLen:M},n),z=this._cacheDataList(e,t,`variance_${n}`,!0);if(!z||b===void 0)return;const i=z.filter(O=>O!==void 0&&!isNaN(O)).slice(-t);if(i.length<t)return;const c=i.reduce((O,s)=>O+Math.pow(s-b,2),0);if(c!==void 0)return r||t<=1?c/t:c/(t-1)}vwap({source:e,anchor:t,stdev_mult:r},M){if(e===void 0)return;const n=`vwap_${M}`,b=this._verifyCacheData(n);if(b)return b==null?void 0:b.value;t=t===void 0?this._timeframe.change({timeframe:"1D"},M):t;const{volume:z}=this._variables;let{sum:i=0,sumV:c=0,count:O=0,isReset:s,sumS:u=0}=this._getCacheData(n);if(t&&(i=c=O=u=0,s=!0),!s)return r!==void 0?[]:void 0;const l=e*z+i,q=z+c,A=l/q;if(O++,r!==void 0){u=z*Math.pow(e,2)+u;const h=this._computeBands(u,q,r,A);return this._cacheDataHandle(n,{sum:l,sumV:q,count:O,isReset:s,sumS:u,value:h}),h}return this._cacheDataHandle(n,{sum:l,sumV:q,count:O,isReset:s,value:A}),A}_computeBands(e,t,r,M){let n=e/t-Math.pow(M,2);n=n<0?0:n;const b=Math.sqrt(n),z=b!==void 0&&!isNaN(b)?M+r*b:void 0,i=b!==void 0&&!isNaN(b)?M-r*b:void 0;return[M,z,i]}vwma({source:e,length:t,isSeriesLen:r},M){if(e===void 0||isNaN(e)||t===void 0||t<=0)return;const{volume:n}=this._variables,b=this.sma({source:e*n,length:t,isSeriesLen:r},`sma1_${M}`),z=this.sma({source:n,length:t,isSeriesLen:r},`sma2_${M}`);if(!(b===void 0||z===void 0))return b/z}wpr({length:e,isSeriesLen:t},r){if(e===void 0||e<=0)return;const M=this.highest({length:e,isSeriesLen:t},r),n=this.lowest({length:e,isSeriesLen:t},r),{close:b}=this._variables;if(!(M===void 0||n===void 0))return(M-b)/(M-n)*-100}_sort(e){const t=[];for(const r of e){if(typeof r=="number")break;t.push(r)}return e.sort((r,M)=>r-M),t.concat(e)}_cacheDataList(e,t,r,M=!1,n=!0,b=!1){const z=this._cacheData[r]||{barIndex:-1,list:[],length:t},{bar_index:i}=this._variables;if(z.length<t&&(z.length=t),z.barIndex<=i&&!(isNaN(e)&&b)){const c=z.list.length;z.barIndex===i?z.list[c-1]=e:z.list.push(e),z.barIndex=i,z.list.length>z.length+5&&!M&&z.list.shift(),this._cacheData[r]=z}if(!(z.list.length<t&&n))return z.list}_getCacheData(e){const{bar_index:t}=this._variables,r=this._cacheData[e]||{};return r.barIndex===t?r.preCacheData||{}:r}_cacheDataHandle(e,t){const{bar_index:r,_isRealTimeBar:M,_isRepeated:n}=this._variables;if(!M&&!n){let b=this._cacheData[e]||{};b.barIndex===r&&(b=b.preCacheData),this._cacheData[e]=Object.assign(t,{barIndex:r,preCacheData:{...b,preCacheData:void 0}})}}_verifyCacheData(e){const{bar_index:t,_isRepeated:r}=this._variables,M=this._cacheData[e]||{},{barIndex:n}=M;if(n===t&&r)return M}}class P6{constructor(e,t,r){E(this,"_cacheData");E(this,"_variables");E(this,"_errorListener");E(this,"_historyInputs");E(this,"_name");E(this,"_newCacheData",{});this._cacheData={},this._variables=e,this._errorListener=t,this._name=`inputs_${r}`,this._historyInputs=self.workerStorage.get(this._name)||{}}get _inputCacheData(){return this._cacheData}set _inputCacheData(e){this._cacheData=e}update(e){if(!(e!=null&&e.length)){self.workerStorage.delete(this._name),this._cacheData={};return}for(const t of e){const r=t.id,M=this._historyInputs[r];(!(t!=null&&t.sourceTypeName)&&(M==null?void 0:M.defval)!==t.defval||M!=null&&M.sourceTypeName&&t.sourceTypeName!==(M==null?void 0:M.sourceTypeName))&&(this._cacheData[r]=Object.assign(this._cacheData[r]||{},{...t,isModify:!0}))}}input(e,t){return this._cacheHandle(e,t)}int(e,t){return this._verifyMaxOrMin(e,t),this._cacheHandle(e,t,N2.INT)}bool(e,t){return this._cacheHandle(e,t,N2.BOOL)}color(e,t){return this._cacheHandle(e,t,N2.COLOR)}time(e,t){return this._cacheHandle(e,t,N2.TIME)}float(e,t){return this._verifyMaxOrMin(e,t),this._cacheHandle(e,t,N2.FLOAT)}price(e,t){return this._cacheHandle(e,t,N2.PRICE)}source(e,t){return this._cacheHandle(e,t,N2.SOURCE)}string(e,t){return this._cacheHandle(e,t,N2.STRING)}symbol(e,t){return this._cacheHandle(e,t,N2.SYMBOL)}session(e,t){return this._cacheHandle(e,t,N2.SESSION)}text_area(e,t){return this._cacheHandle(e,t,N2.TEXT_AREA)}timeframe(e,t){return this._cacheHandle(e,t,N2.TIMEFRAME)}enum(e,t){return this._cacheHandle(e,t,N2.ENUM)}_cacheHandle(e,t,r){if(t.startsWith("export"))return e.defval;const M=`${r||"input"}_${t}`,n=this._newCacheData[M]||this._cacheData[M];if(this._variables.bar_index&&n)return n.sourceTypeName&&(n.defval=this._variables[n.sourceTypeName]),n.defval;if(e.defval===void 0&&this._errorListener.addError(N1.inputDefvalErr,t,J0.Error),n)if(!n.isModify)Object.assign(this._newCacheData[M],e);else{this._newCacheData[M]=n;const b=this._historyInputs[M];!(e.sourceTypeName||b!=null&&b.sourceTypeName)&&e.defval===(b==null?void 0:b.defval)||e.sourceTypeName&&(b==null?void 0:b.sourceTypeName)===e.sourceTypeName?n.sourceTypeName&&(this._newCacheData[M].defval=this._variables[n.sourceTypeName]):Object.assign(this._newCacheData[M],e)}else{const{defval:b,display:z}=e;if(this._displayVerify(t,z),e={inputType:r,...e},this._newCacheData[M]=e,(r||e.inputType)===N2.SOURCE)this._newCacheData[M].options=Ai;else if(e.options)if(!e.options.includes(b))this._errorListener.addError(l2(N1.inputOptErr,{defval:String(b),args:e.options.toString()}),t,J0.Error,6+((r==null?void 0:r.length)||-1));else{const i=new Map;for(const c of e.options){if(i.has(c)){this._errorListener.addError(l2(N1.optionsRepeatErr,{option:String(c)}),t,J0.Error,6+((r==null?void 0:r.length)||-1));break}i.set(c,c)}}}return self.workerStorage.setValue(this._name,M,{...e}),this._newCacheData[M].defval}_displayVerify(e,t){!t||!t.length||t.includes(le.dataWindow)||t.includes(le.statusLine)||this._errorListener.addError(l2(N1.displayErr,{func:"input",values:"[display.none, display.data_window, display.status_line, display.all]"}),e,J0.Error)}_verifyMaxOrMin(e,t){const{defval:r,maxval:M,minval:n}=e;typeof r=="number"&&(M!==void 0&&r>M||n!==void 0&&r<n)&&this._errorListener.addError(N1.minOrMaxErr,t,J0.Error)}getInputs(){const e=Object.keys(this._newCacheData),t=[];for(const r of e){const M=this._newCacheData[r];M.id=r,t.push(M)}return this._cacheData=this._newCacheData,t.sort((r,M)=>(r.index||0)-(M.index||0))}}class k6{color({x:e}){return e===void 0?null:e}new({color:e,transp:t=100}){u0(t)&&(t=100);let r=(100-Math.round(t))/100;r=r<0?0:r>1?1:r;const{r:M,g:n,b}=this._parseColor(e||"");return`rgba(${Math.round(M)}, ${Math.round(n)}, ${Math.round(b)}, ${r})`}rgb({red:e=0,green:t=0,blue:r=0,transp:M=0}){return u0(M)&&(M=0),u0(e)&&(e=0),u0(t)&&(t=0),u0(r)&&(r=0),`rgba(${Math.round(e)}, ${Math.round(t)}, ${Math.round(r)}, ${(100-Math.round(M))/100})`}g({color:e}){return e?this._parseColor(e).g:0}r({color:e}){return e?this._parseColor(e).r:0}b({color:e}){return e?this._parseColor(e).b:0}t({color:e}){return e?100-Math.round(this._parseColor(e).a*100):0}from_gradient({value:e,bottom_value:t,top_value:r,bottom_color:M,top_color:n}){if(u0(e)||u0(t)||u0(r)||r===t)return"rgba(0,0,0,1)";const b=(e-t)/(r-t),z=Math.min(Math.max(b,0),1);if(!M&&!n)return"rgba(0,0,0,0)";let{r:i,g:c,b:O,a:s}=M?this._parseColor(M):{},{r:u,g:l,b:q,a:A}=n?this._parseColor(n):{};M?n||(u=i,l=c,q=O,A=0):(i=u,c=l,O=q,s=0);const h=i+z*(u-i),d=c+z*(l-c),m=O+z*(q-O),_=s+z*(A-s);return`rgba(${Math.round(h)}, ${Math.round(d)}, ${Math.round(m)}, ${_.toFixed(2)})`}_parseColor(e){let t,r,M,n;if(e.startsWith("#")){t=parseInt(e.substring(1,3),16),r=parseInt(e.substring(3,5),16),M=parseInt(e.substring(5,7),16);const b=e.substring(7);b?n=parseInt(b,16)/255:n=1}else{const b=this._parserRgbColor(e);t=b[0]||0,r=b[1]||0,M=b[2]||0,n=b[3],n=n===void 0?1:n}return{r:t,g:r,b:M,a:n}}_parserRgbColor(e){var t;return((t=e.match(/[\d.]+/g))==null?void 0:t.map(Number))||[]}}var r1={};const $6=Object.prototype.toString;function WM(o){const e=$6.call(o);return e.endsWith("Array]")&&!e.includes("Big")}var U6=Object.freeze({__proto__:null,isAnyArray:WM}),j6=Y1(U6);function H6(o){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!WM(o))throw new TypeError("input must be an array");if(o.length===0)throw new TypeError("input must not be empty");var t=e.fromIndex,r=t===void 0?0:t,M=e.toIndex,n=M===void 0?o.length:M;if(r<0||r>=o.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(n<=r||n>o.length||!Number.isInteger(n))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var b=o[r],z=r+1;z<n;z++)o[z]>b&&(b=o[z]);return b}function Y6(o){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!WM(o))throw new TypeError("input must be an array");if(o.length===0)throw new TypeError("input must not be empty");var t=e.fromIndex,r=t===void 0?0:t,M=e.toIndex,n=M===void 0?o.length:M;if(r<0||r>=o.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(n<=r||n>o.length||!Number.isInteger(n))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var b=o[r],z=r+1;z<n;z++)o[z]<b&&(b=o[z]);return b}function G6(o){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(WM(o)){if(o.length===0)throw new TypeError("input must not be empty")}else throw new TypeError("input must be an array");var t;if(e.output!==void 0){if(!WM(e.output))throw new TypeError("output option must be an array if specified");t=e.output}else t=new Array(o.length);var r=Y6(o),M=H6(o);if(r===M)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var n=e.min,b=n===void 0?e.autoMinMax?r:0:n,z=e.max,i=z===void 0?e.autoMinMax?M:1:z;if(b>=i)throw new RangeError("min option must be smaller than max option");for(var c=(i-b)/(M-r),O=0;O<o.length;O++)t[O]=(o[O]-r)*c+b;return t}var V6=Object.freeze({__proto__:null,default:G6}),K6=Y1(V6);Object.defineProperty(r1,"__esModule",{value:!0});var C2=j6,Ns=K6;const Ho=" ".repeat(2),ys=" ".repeat(4);function J6(){return Bs(this)}function Bs(o,e={}){const{maxRows:t=15,maxColumns:r=10,maxNumSize:M=8,padMinus:n="auto"}=e;return`${o.constructor.name} {
68
+ (`+D1(D,A)+", "+D1(R,A)+") ==> "+(this._values?D1(this._values[y],A):"X")}return _},M.prototype.toString=function(){return D1(this.toArray())},M.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},M.prototype.diagonal=function(A){if(A){if(e2(A)&&(A=A.toNumber()),!C1(A)||!U1(A))throw new TypeError("The parameter k must be an integer number")}else A=0;var h=A>0?A:0,d=A<0?-A:0,m=this._size[0],_=this._size[1],R=Math.min(m-d,_-h),g=[],L=[],y=[];y[0]=0;for(var D=h;D<_&&g.length<R;D++)for(var T=this._ptr[D],N=this._ptr[D+1],w=T;w<N;w++){var C=this._index[w];if(C===D-h+d){g.push(this._values[w]),L[g.length-1]=C-d;break}}return y.push(g.length),new M({values:g,index:L,ptr:y,size:[R,1]})},M.fromJSON=function(A){return new M(A)},M.diagonal=function(A,h,d,m,_){if(!V1(A))throw new TypeError("Array expected, size parameter");if(A.length!==2)throw new Error("Only two dimensions matrix are supported");if(A=A.map(function(b0){if(e2(b0)&&(b0=b0.toNumber()),!C1(b0)||!U1(b0)||b0<1)throw new Error("Size values must be positive integers");return b0}),d){if(e2(d)&&(d=d.toNumber()),!C1(d)||!U1(d))throw new TypeError("The parameter k must be an integer number")}else d=0;var R=t,g=0;Te(_)&&(R=e.find(t,[_,_])||t,g=e.convert(0,_));var L=d>0?d:0,y=d<0?-d:0,D=A[0],T=A[1],N=Math.min(D-y,T-L),w;if(V1(h)){if(h.length!==N)throw new Error("Invalid value array length");w=function(O0){return h[O0]}}else if(P1(h)){var C=h.size();if(C.length!==1||C[0]!==N)throw new Error("Invalid matrix length");w=function(O0){return h.get([O0])}}else w=function(){return h};for(var P=[],H=[],Y=[],k=0;k<T;k++){Y.push(P.length);var K=k-L;if(K>=0&&K<N){var e0=w(K);R(e0,g)||(H.push(K+y),P.push(e0))}}return Y.push(P.length),new M({values:P,index:H,ptr:Y,size:[D,T]})},M.prototype.swapRows=function(A,h){if(!C1(A)||!U1(A)||!C1(h)||!U1(h))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return K1(A,this._size[0]),K1(h,this._size[0]),M._swapRows(A,h,this._size[1],this._values,this._index,this._ptr),this},M._forEachRow=function(A,h,d,m,_){for(var R=m[A],g=m[A+1],L=R;L<g;L++)_(d[L],h[L])},M._swapRows=function(A,h,d,m,_,R){for(var g=0;g<d;g++){var L=R[g],y=R[g+1],D=c(A,L,y,_),T=c(h,L,y,_);if(D<y&&T<y&&_[D]===A&&_[T]===h){if(m){var N=m[D];m[D]=m[T],m[T]=N}continue}if(D<y&&_[D]===A&&(T>=y||_[T]!==h)){var w=m?m[D]:void 0;_.splice(T,0,h),m&&m.splice(T,0,w),_.splice(T<=D?D+1:D,1),m&&m.splice(T<=D?D+1:D,1);continue}if(T<y&&_[T]===h&&(D>=y||_[D]!==A)){var C=m?m[T]:void 0;_.splice(D,0,A),m&&m.splice(D,0,C),_.splice(D<=T?T+1:T,1),m&&m.splice(D<=T?T+1:T,1)}}},M},{isClass:!0}),K5="number",J5=["typed"];function Q5(o){var e=o.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(e){var t={"0b":2,"0o":8,"0x":16}[e[1]],r=e[2],M=e[3];return{input:o,radix:t,integerPart:r,fractionalPart:M}}else return null}function Z5(o){for(var e=parseInt(o.integerPart,o.radix),t=0,r=0;r<o.fractionalPart.length;r++){var M=parseInt(o.fractionalPart[r],o.radix);t+=M/Math.pow(o.radix,r+1)}var n=e+t;if(isNaN(n))throw new SyntaxError('String "'+o.input+'" is not a valid number');return n}var eh=h0(K5,J5,o=>{var{typed:e}=o,t=e("number",{"":function(){return 0},number:function(M){return M},string:function(M){if(M==="NaN")return NaN;var n=Q5(M);if(n)return Z5(n);var b=0,z=M.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);z&&(b=Number(z[2]),M=z[1]);var i=Number(M);if(isNaN(i))throw new SyntaxError('String "'+M+'" is not a valid number');if(z){if(i>2**b-1)throw new SyntaxError('String "'.concat(M,'" is out of range'));i>=2**(b-1)&&(i=i-2**b)}return i},BigNumber:function(M){return M.toNumber()},Fraction:function(M){return M.valueOf()},Unit:e.referToSelf(r=>M=>{var n=M.clone();return n.value=r(M.value),n}),null:function(M){return 0},"Unit, string | Unit":function(M,n){return M.toNumber(n)},"Array | Matrix":e.referToSelf(r=>M=>Re(M,r))});return t.fromJSON=function(r){return parseFloat(r.value)},t}),th="bignumber",rh=["typed","BigNumber"],Mh=h0(th,rh,o=>{var{typed:e,BigNumber:t}=o;return e("bignumber",{"":function(){return new t(0)},number:function(M){return new t(M+"")},string:function(M){var n=M.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(n){var b=n[2],z=t(n[1]),i=new t(2).pow(Number(b));if(z.gt(i.sub(1)))throw new SyntaxError('String "'.concat(M,'" is out of range'));var c=new t(2).pow(Number(b)-1);return z.gte(c)?z.sub(i):z}return new t(M)},BigNumber:function(M){return M},Unit:e.referToSelf(r=>M=>{var n=M.clone();return n.value=r(M.value),n}),Fraction:function(M){return new t(M.n).div(M.d).times(M.s)},null:function(M){return new t(0)},"Array | Matrix":e.referToSelf(r=>M=>Re(M,r))})}),oh="fraction",nh=["typed","Fraction"],bh=h0(oh,nh,o=>{var{typed:e,Fraction:t}=o;return e("fraction",{number:function(M){if(!isFinite(M)||isNaN(M))throw new Error(M+" cannot be represented as a fraction");return new t(M)},string:function(M){return new t(M)},"number, number":function(M,n){return new t(M,n)},null:function(M){return new t(0)},BigNumber:function(M){return new t(M.toString())},Fraction:function(M){return M},Unit:e.referToSelf(r=>M=>{var n=M.clone();return n.value=r(M.value),n}),Object:function(M){return new t(M)},"Array | Matrix":e.referToSelf(r=>M=>Re(M,r))})}),Da="matrix",ph=["typed","Matrix","DenseMatrix","SparseMatrix"],zh=h0(Da,ph,o=>{var{typed:e,Matrix:t,DenseMatrix:r,SparseMatrix:M}=o;return e(Da,{"":function(){return n([])},string:function(z){return n([],z)},"string, string":function(z,i){return n([],z,i)},Array:function(z){return n(z)},Matrix:function(z){return n(z,z.storage())},"Array | Matrix, string":n,"Array | Matrix, string, string":n});function n(b,z,i){if(z==="dense"||z==="default"||z===void 0)return new r(b,i);if(z==="sparse")return new M(b,i);throw new TypeError("Unknown matrix type "+JSON.stringify(z)+".")}}),Xa="unaryMinus",ih=["typed"],ch=h0(Xa,ih,o=>{var{typed:e}=o;return e(Xa,{number:ga,"Complex | BigNumber | Fraction":t=>t.neg(),Unit:e.referToSelf(t=>r=>{var M=r.clone();return M.value=e.find(t,M.valueType())(r.value),M}),"Array | Matrix":e.referToSelf(t=>r=>Re(r,t))})}),Ea="abs",ah=["typed"],sh=h0(Ea,ah,o=>{var{typed:e}=o;return e(Ea,{number:ha,"Complex | BigNumber | Fraction | Unit":t=>t.abs(),"Array | Matrix":e.referToSelf(t=>r=>Re(r,t))})}),Ta="addScalar",Oh=["typed"],uh=h0(Ta,Oh,o=>{var{typed:e}=o;return e(Ta,{"number, number":Wa,"Complex, Complex":function(r,M){return r.add(M)},"BigNumber, BigNumber":function(r,M){return r.plus(M)},"Fraction, Fraction":function(r,M){return r.add(M)},"Unit, Unit":e.referToSelf(t=>(r,M)=>{if(r.value===null||r.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(M.value===null||M.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!r.equalBase(M))throw new Error("Units do not match");var n=r.clone();return n.value=e.find(t,[n.valueType(),M.valueType()])(n.value,M.value),n.fixPrefix=!1,n})})}),Ca="subtractScalar",Ah=["typed"],fh=h0(Ca,Ah,o=>{var{typed:e}=o;return e(Ca,{"number, number":_a,"Complex, Complex":function(r,M){return r.sub(M)},"BigNumber, BigNumber":function(r,M){return r.minus(M)},"Fraction, Fraction":function(r,M){return r.sub(M)},"Unit, Unit":e.referToSelf(t=>(r,M)=>{if(r.value===null||r.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(M.value===null||M.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!r.equalBase(M))throw new Error("Units do not match");var n=r.clone();return n.value=e.find(t,[n.valueType(),M.valueType()])(n.value,M.value),n.fixPrefix=!1,n})})}),lh="matAlgo11xS0s",dh=["typed","equalScalar"],ip=h0(lh,dh,o=>{var{typed:e,equalScalar:t}=o;return function(M,n,b,z){var i=M._values,c=M._index,O=M._ptr,s=M._size,u=M._datatype;if(!i)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var l=s[0],q=s[1],A,h=t,d=0,m=b;typeof u=="string"&&(A=u,h=e.find(t,[A,A]),d=e.convert(0,A),n=e.convert(n,A),m=e.find(b,[A,A]));for(var _=[],R=[],g=[],L=0;L<q;L++){g[L]=R.length;for(var y=O[L],D=O[L+1],T=y;T<D;T++){var N=c[T],w=z?m(n,i[T]):m(i[T],n);h(w,d)||(R.push(N),_.push(w))}}return g[q]=R.length,M.createSparseMatrix({values:_,index:R,ptr:g,size:[l,q],datatype:A})}}),qh="matAlgo12xSfs",hh=["typed","DenseMatrix"],Br=h0(qh,hh,o=>{var{typed:e,DenseMatrix:t}=o;return function(M,n,b,z){var i=M._values,c=M._index,O=M._ptr,s=M._size,u=M._datatype;if(!i)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var l=s[0],q=s[1],A,h=b;typeof u=="string"&&(A=u,n=e.convert(n,A),h=e.find(b,[A,A]));for(var d=[],m=[],_=[],R=0;R<q;R++){for(var g=R+1,L=O[R],y=O[R+1],D=L;D<y;D++){var T=c[D];m[T]=i[D],_[T]=g}for(var N=0;N<l;N++)R===0&&(d[N]=[]),_[N]===g?d[N][R]=z?h(n,m[N]):h(m[N],n):d[N][R]=z?h(n,0):h(0,n)}return new t({data:d,size:[l,q],datatype:A})}}),Wh="matAlgo14xDs",_h=["typed"],cp=h0(Wh,_h,o=>{var{typed:e}=o;return function(M,n,b,z){var i=M._data,c=M._size,O=M._datatype,s,u=b;typeof O=="string"&&(s=O,n=e.convert(n,s),u=e.find(b,[s,s]));var l=c.length>0?t(u,0,c,c[0],i,n,z):[];return M.createDenseMatrix({data:l,size:g1(c),datatype:s})};function t(r,M,n,b,z,i,c){var O=[];if(M===n.length-1)for(var s=0;s<b;s++)O[s]=c?r(i,z[s]):r(z[s],i);else for(var u=0;u<b;u++)O[u]=t(r,M+1,n,n[M+1],z[u],i,c);return O}}),mh="matAlgo02xDS0",gh=["typed","equalScalar"],Rh=h0(mh,gh,o=>{var{typed:e,equalScalar:t}=o;return function(M,n,b,z){var i=M._data,c=M._size,O=M._datatype||M.getDataType(),s=n._values,u=n._index,l=n._ptr,q=n._size,A=n._datatype||n._data===void 0?n._datatype:n.getDataType();if(c.length!==q.length)throw new d1(c.length,q.length);if(c[0]!==q[0]||c[1]!==q[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+q+")");if(!s)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var h=c[0],d=c[1],m,_=t,R=0,g=b;typeof O=="string"&&O===A&&O!=="mixed"&&(m=O,_=e.find(t,[m,m]),R=e.convert(0,m),g=e.find(b,[m,m]));for(var L=[],y=[],D=[],T=0;T<d;T++){D[T]=y.length;for(var N=l[T],w=l[T+1],C=N;C<w;C++){var P=u[C],H=z?g(s[C],i[P][T]):g(i[P][T],s[C]);_(H,R)||(y.push(P),L.push(H))}}return D[d]=y.length,n.createSparseMatrix({values:L,index:y,ptr:D,size:[h,d],datatype:O===M._datatype&&A===n._datatype?m:void 0})}}),vh="matAlgo03xDSf",Lh=["typed"],wr=h0(vh,Lh,o=>{var{typed:e}=o;return function(r,M,n,b){var z=r._data,i=r._size,c=r._datatype||r.getDataType(),O=M._values,s=M._index,u=M._ptr,l=M._size,q=M._datatype||M._data===void 0?M._datatype:M.getDataType();if(i.length!==l.length)throw new d1(i.length,l.length);if(i[0]!==l[0]||i[1]!==l[1])throw new RangeError("Dimension mismatch. Matrix A ("+i+") must match Matrix B ("+l+")");if(!O)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var A=i[0],h=i[1],d,m=0,_=n;typeof c=="string"&&c===q&&c!=="mixed"&&(d=c,m=e.convert(0,d),_=e.find(n,[d,d]));for(var R=[],g=0;g<A;g++)R[g]=[];for(var L=[],y=[],D=0;D<h;D++){for(var T=D+1,N=u[D],w=u[D+1],C=N;C<w;C++){var P=s[C];L[P]=b?_(O[C],z[P][D]):_(z[P][D],O[C]),y[P]=T}for(var H=0;H<A;H++)y[H]===T?R[H][D]=L[H]:R[H][D]=b?_(m,z[H][D]):_(z[H][D],m)}return r.createDenseMatrix({data:R,size:[A,h],datatype:c===r._datatype&&q===M._datatype?d:void 0})}}),Nh="matAlgo05xSfSf",yh=["typed","equalScalar"],xa=h0(Nh,yh,o=>{var{typed:e,equalScalar:t}=o;return function(M,n,b){var z=M._values,i=M._index,c=M._ptr,O=M._size,s=M._datatype||M._data===void 0?M._datatype:M.getDataType(),u=n._values,l=n._index,q=n._ptr,A=n._size,h=n._datatype||n._data===void 0?n._datatype:n.getDataType();if(O.length!==A.length)throw new d1(O.length,A.length);if(O[0]!==A[0]||O[1]!==A[1])throw new RangeError("Dimension mismatch. Matrix A ("+O+") must match Matrix B ("+A+")");var d=O[0],m=O[1],_,R=t,g=0,L=b;typeof s=="string"&&s===h&&s!=="mixed"&&(_=s,R=e.find(t,[_,_]),g=e.convert(0,_),L=e.find(b,[_,_]));var y=z&&u?[]:void 0,D=[],T=[],N=y?[]:void 0,w=y?[]:void 0,C=[],P=[],H,Y,k,K;for(Y=0;Y<m;Y++){T[Y]=D.length;var e0=Y+1;for(k=c[Y],K=c[Y+1];k<K;k++)H=i[k],D.push(H),C[H]=e0,N&&(N[H]=z[k]);for(k=q[Y],K=q[Y+1];k<K;k++)H=l[k],C[H]!==e0&&D.push(H),P[H]=e0,w&&(w[H]=u[k]);if(y)for(k=T[Y];k<D.length;){H=D[k];var b0=C[H],O0=P[H];if(b0===e0||O0===e0){var v0=b0===e0?N[H]:g,B0=O0===e0?w[H]:g,A0=L(v0,B0);R(A0,g)?D.splice(k,1):(y.push(A0),k++)}}}return T[m]=D.length,M.createSparseMatrix({values:y,index:D,ptr:T,size:[d,m],datatype:s===M._datatype&&h===n._datatype?_:void 0})}}),Bh="matAlgo13xDD",wh=["typed"],Dh=h0(Bh,wh,o=>{var{typed:e}=o;return function(M,n,b){var z=M._data,i=M._size,c=M._datatype,O=n._data,s=n._size,u=n._datatype,l=[];if(i.length!==s.length)throw new d1(i.length,s.length);for(var q=0;q<i.length;q++){if(i[q]!==s[q])throw new RangeError("Dimension mismatch. Matrix A ("+i+") must match Matrix B ("+s+")");l[q]=i[q]}var A,h=b;typeof c=="string"&&c===u&&(A=c,h=e.find(b,[A,A]));var d=l.length>0?t(h,0,l,l[0],z,O):[];return M.createDenseMatrix({data:d,size:l,datatype:A})};function t(r,M,n,b,z,i){var c=[];if(M===n.length-1)for(var O=0;O<b;O++)c[O]=r(z[O],i[O]);else for(var s=0;s<b;s++)c[s]=t(r,M+1,n,n[M+1],z[s],i[s]);return c}}),Xh="broadcast",Eh=["concat"],Th=h0(Xh,Eh,o=>{var{concat:e}=o;return function(M,n){var b=Math.max(M._size.length,n._size.length);if(M._size.length===n._size.length&&M._size.every((q,A)=>q===n._size[A]))return[M,n];for(var z=t(M._size,b,0),i=t(n._size,b,0),c=[],O=0;O<b;O++)c[O]=Math.max(z[O],i[O]);Wo(z,c),Wo(i,c);var s=M.clone(),u=n.clone();s._size.length<b?s.reshape(t(s._size,b,1)):u._size.length<b&&u.reshape(t(u._size,b,1));for(var l=0;l<b;l++)s._size[l]<c[l]&&(s=r(s,c[l],l)),u._size[l]<c[l]&&(u=r(u,c[l],l));return[s,u]};function t(M,n,b){return[...Array(n-M.length).fill(b),...M]}function r(M,n,b){return e(...Array(n).fill(M),b)}}),Ch="matrixAlgorithmSuite",xh=["typed","matrix","concat"],Vt=h0(Ch,xh,o=>{var{typed:e,matrix:t,concat:r}=o,M=Dh({typed:e}),n=cp({typed:e}),b=Th({concat:r});return function(i){var c=i.elop,O=i.SD||i.DS,s;c?(s={"DenseMatrix, DenseMatrix":(A,h)=>M(...b(A,h),c),"Array, Array":(A,h)=>M(...b(t(A),t(h)),c).valueOf(),"Array, DenseMatrix":(A,h)=>M(...b(t(A),h),c),"DenseMatrix, Array":(A,h)=>M(...b(A,t(h)),c)},i.SS&&(s["SparseMatrix, SparseMatrix"]=(A,h)=>i.SS(...b(A,h),c,!1)),i.DS&&(s["DenseMatrix, SparseMatrix"]=(A,h)=>i.DS(...b(A,h),c,!1),s["Array, SparseMatrix"]=(A,h)=>i.DS(...b(t(A),h),c,!1)),O&&(s["SparseMatrix, DenseMatrix"]=(A,h)=>O(...b(h,A),c,!0),s["SparseMatrix, Array"]=(A,h)=>O(...b(t(h),A),c,!0))):(s={"DenseMatrix, DenseMatrix":e.referToSelf(A=>(h,d)=>M(...b(h,d),A)),"Array, Array":e.referToSelf(A=>(h,d)=>M(...b(t(h),t(d)),A).valueOf()),"Array, DenseMatrix":e.referToSelf(A=>(h,d)=>M(...b(t(h),d),A)),"DenseMatrix, Array":e.referToSelf(A=>(h,d)=>M(...b(h,t(d)),A))},i.SS&&(s["SparseMatrix, SparseMatrix"]=e.referToSelf(A=>(h,d)=>i.SS(...b(h,d),A,!1))),i.DS&&(s["DenseMatrix, SparseMatrix"]=e.referToSelf(A=>(h,d)=>i.DS(...b(h,d),A,!1)),s["Array, SparseMatrix"]=e.referToSelf(A=>(h,d)=>i.DS(...b(t(h),d),A,!1))),O&&(s["SparseMatrix, DenseMatrix"]=e.referToSelf(A=>(h,d)=>O(...b(d,h),A,!0)),s["SparseMatrix, Array"]=e.referToSelf(A=>(h,d)=>O(...b(t(d),h),A,!0))));var u=i.scalar||"any",l=i.Ds||i.Ss;l&&(c?(s["DenseMatrix,"+u]=(A,h)=>n(A,h,c,!1),s[u+", DenseMatrix"]=(A,h)=>n(h,A,c,!0),s["Array,"+u]=(A,h)=>n(t(A),h,c,!1).valueOf(),s[u+", Array"]=(A,h)=>n(t(h),A,c,!0).valueOf()):(s["DenseMatrix,"+u]=e.referToSelf(A=>(h,d)=>n(h,d,A,!1)),s[u+", DenseMatrix"]=e.referToSelf(A=>(h,d)=>n(d,h,A,!0)),s["Array,"+u]=e.referToSelf(A=>(h,d)=>n(t(h),d,A,!1).valueOf()),s[u+", Array"]=e.referToSelf(A=>(h,d)=>n(t(d),h,A,!0).valueOf())));var q=i.sS!==void 0?i.sS:i.Ss;return c?(i.Ss&&(s["SparseMatrix,"+u]=(A,h)=>i.Ss(A,h,c,!1)),q&&(s[u+", SparseMatrix"]=(A,h)=>q(h,A,c,!0))):(i.Ss&&(s["SparseMatrix,"+u]=e.referToSelf(A=>(h,d)=>i.Ss(h,d,A,!1))),q&&(s[u+", SparseMatrix"]=e.referToSelf(A=>(h,d)=>q(d,h,A,!0)))),c&&c.signatures&&Bc(s,c.signatures),s}}),Sh="matAlgo01xDSid",Fh=["typed"],Sa=h0(Sh,Fh,o=>{var{typed:e}=o;return function(r,M,n,b){var z=r._data,i=r._size,c=r._datatype||r.getDataType(),O=M._values,s=M._index,u=M._ptr,l=M._size,q=M._datatype||M._data===void 0?M._datatype:M.getDataType();if(i.length!==l.length)throw new d1(i.length,l.length);if(i[0]!==l[0]||i[1]!==l[1])throw new RangeError("Dimension mismatch. Matrix A ("+i+") must match Matrix B ("+l+")");if(!O)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var A=i[0],h=i[1],d=typeof c=="string"&&c!=="mixed"&&c===q?c:void 0,m=d?e.find(n,[d,d]):n,_,R,g=[];for(_=0;_<A;_++)g[_]=[];var L=[],y=[];for(R=0;R<h;R++){for(var D=R+1,T=u[R],N=u[R+1],w=T;w<N;w++)_=s[w],L[_]=b?m(O[w],z[_][R]):m(z[_][R],O[w]),y[_]=D;for(_=0;_<A;_++)y[_]===D?g[_][R]=L[_]:g[_][R]=z[_][R]}return r.createDenseMatrix({data:g,size:[A,h],datatype:c===r._datatype&&q===M._datatype?d:void 0})}}),Ih="matAlgo04xSidSid",Ph=["typed","equalScalar"],kh=h0(Ih,Ph,o=>{var{typed:e,equalScalar:t}=o;return function(M,n,b){var z=M._values,i=M._index,c=M._ptr,O=M._size,s=M._datatype||M._data===void 0?M._datatype:M.getDataType(),u=n._values,l=n._index,q=n._ptr,A=n._size,h=n._datatype||n._data===void 0?n._datatype:n.getDataType();if(O.length!==A.length)throw new d1(O.length,A.length);if(O[0]!==A[0]||O[1]!==A[1])throw new RangeError("Dimension mismatch. Matrix A ("+O+") must match Matrix B ("+A+")");var d=O[0],m=O[1],_,R=t,g=0,L=b;typeof s=="string"&&s===h&&s!=="mixed"&&(_=s,R=e.find(t,[_,_]),g=e.convert(0,_),L=e.find(b,[_,_]));var y=z&&u?[]:void 0,D=[],T=[],N=z&&u?[]:void 0,w=z&&u?[]:void 0,C=[],P=[],H,Y,k,K,e0;for(Y=0;Y<m;Y++){T[Y]=D.length;var b0=Y+1;for(K=c[Y],e0=c[Y+1],k=K;k<e0;k++)H=i[k],D.push(H),C[H]=b0,N&&(N[H]=z[k]);for(K=q[Y],e0=q[Y+1],k=K;k<e0;k++)if(H=l[k],C[H]===b0){if(N){var O0=L(N[H],u[k]);R(O0,g)?C[H]=null:N[H]=O0}}else D.push(H),P[H]=b0,w&&(w[H]=u[k]);if(N&&w)for(k=T[Y];k<D.length;)H=D[k],C[H]===b0?(y[k]=N[H],k++):P[H]===b0?(y[k]=w[H],k++):D.splice(k,1)}return T[m]=D.length,M.createSparseMatrix({values:y,index:D,ptr:T,size:[d,m],datatype:s===M._datatype&&h===n._datatype?_:void 0})}}),$h="matAlgo10xSids",Uh=["typed","DenseMatrix"],Fa=h0($h,Uh,o=>{var{typed:e,DenseMatrix:t}=o;return function(M,n,b,z){var i=M._values,c=M._index,O=M._ptr,s=M._size,u=M._datatype;if(!i)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var l=s[0],q=s[1],A,h=b;typeof u=="string"&&(A=u,n=e.convert(n,A),h=e.find(b,[A,A]));for(var d=[],m=[],_=[],R=0;R<q;R++){for(var g=R+1,L=O[R],y=O[R+1],D=L;D<y;D++){var T=c[D];m[T]=i[D],_[T]=g}for(var N=0;N<l;N++)R===0&&(d[N]=[]),_[N]===g?d[N][R]=z?h(n,m[N]):h(m[N],n):d[N][R]=n}return new t({data:d,size:[l,q],datatype:A})}}),jh="multiplyScalar",Hh=["typed"],Yh=h0(jh,Hh,o=>{var{typed:e}=o;return e("multiplyScalar",{"number, number":ma,"Complex, Complex":function(r,M){return r.mul(M)},"BigNumber, BigNumber":function(r,M){return r.times(M)},"Fraction, Fraction":function(r,M){return r.mul(M)},"number | Fraction | BigNumber | Complex, Unit":(t,r)=>r.multiply(t),"Unit, number | Fraction | BigNumber | Complex | Unit":(t,r)=>t.multiply(r)})}),Ia="multiply",Gh=["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],Vh=h0(Ia,Gh,o=>{var{typed:e,matrix:t,addScalar:r,multiplyScalar:M,equalScalar:n,dot:b}=o,z=ip({typed:e,equalScalar:n}),i=cp({typed:e});function c(g,L){switch(g.length){case 1:switch(L.length){case 1:if(g[0]!==L[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(g[0]!==L[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+g[0]+") must match Matrix rows ("+L[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+L.length+" dimensions)")}break;case 2:switch(L.length){case 1:if(g[1]!==L[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+g[1]+") must match Vector length ("+L[0]+")");break;case 2:if(g[1]!==L[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+g[1]+") must match Matrix B rows ("+L[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+L.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+g.length+" dimensions)")}}function O(g,L,y){if(y===0)throw new Error("Cannot multiply two empty vectors");return b(g,L)}function s(g,L){if(L.storage()!=="dense")throw new Error("Support for SparseMatrix not implemented");return u(g,L)}function u(g,L){var y=g._data,D=g._size,T=g._datatype||g.getDataType(),N=L._data,w=L._size,C=L._datatype||L.getDataType(),P=D[0],H=w[1],Y,k=r,K=M;T&&C&&T===C&&typeof T=="string"&&T!=="mixed"&&(Y=T,k=e.find(r,[Y,Y]),K=e.find(M,[Y,Y]));for(var e0=[],b0=0;b0<H;b0++){for(var O0=K(y[0],N[0][b0]),v0=1;v0<P;v0++)O0=k(O0,K(y[v0],N[v0][b0]));e0[b0]=O0}return g.createDenseMatrix({data:e0,size:[H],datatype:T===g._datatype&&C===L._datatype?Y:void 0})}var l=e("_multiplyMatrixVector",{"DenseMatrix, any":A,"SparseMatrix, any":m}),q=e("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":h,"DenseMatrix, SparseMatrix":d,"SparseMatrix, DenseMatrix":_,"SparseMatrix, SparseMatrix":R});function A(g,L){var y=g._data,D=g._size,T=g._datatype||g.getDataType(),N=L._data,w=L._datatype||L.getDataType(),C=D[0],P=D[1],H,Y=r,k=M;T&&w&&T===w&&typeof T=="string"&&T!=="mixed"&&(H=T,Y=e.find(r,[H,H]),k=e.find(M,[H,H]));for(var K=[],e0=0;e0<C;e0++){for(var b0=y[e0],O0=k(b0[0],N[0]),v0=1;v0<P;v0++)O0=Y(O0,k(b0[v0],N[v0]));K[e0]=O0}return g.createDenseMatrix({data:K,size:[C],datatype:T===g._datatype&&w===L._datatype?H:void 0})}function h(g,L){var y=g._data,D=g._size,T=g._datatype||g.getDataType(),N=L._data,w=L._size,C=L._datatype||L.getDataType(),P=D[0],H=D[1],Y=w[1],k,K=r,e0=M;T&&C&&T===C&&typeof T=="string"&&T!=="mixed"&&T!=="mixed"&&(k=T,K=e.find(r,[k,k]),e0=e.find(M,[k,k]));for(var b0=[],O0=0;O0<P;O0++){var v0=y[O0];b0[O0]=[];for(var B0=0;B0<Y;B0++){for(var A0=e0(v0[0],N[0][B0]),$0=1;$0<H;$0++)A0=K(A0,e0(v0[$0],N[$0][B0]));b0[O0][B0]=A0}}return g.createDenseMatrix({data:b0,size:[P,Y],datatype:T===g._datatype&&C===L._datatype?k:void 0})}function d(g,L){var y=g._data,D=g._size,T=g._datatype||g.getDataType(),N=L._values,w=L._index,C=L._ptr,P=L._size,H=L._datatype||L._data===void 0?L._datatype:L.getDataType();if(!N)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var Y=D[0],k=P[1],K,e0=r,b0=M,O0=n,v0=0;T&&H&&T===H&&typeof T=="string"&&T!=="mixed"&&(K=T,e0=e.find(r,[K,K]),b0=e.find(M,[K,K]),O0=e.find(n,[K,K]),v0=e.convert(0,K));for(var B0=[],A0=[],$0=[],P0=L.createSparseMatrix({values:B0,index:A0,ptr:$0,size:[Y,k],datatype:T===g._datatype&&H===L._datatype?K:void 0}),k0=0;k0<k;k0++){$0[k0]=A0.length;var W0=C[k0],i1=C[k0+1];if(i1>W0)for(var e1=0,c1=0;c1<Y;c1++){for(var t2=c1+1,W1=void 0,F=W0;F<i1;F++){var J=w[F];e1!==t2?(W1=b0(y[c1][J],N[F]),e1=t2):W1=e0(W1,b0(y[c1][J],N[F]))}e1===t2&&!O0(W1,v0)&&(A0.push(c1),B0.push(W1))}}return $0[k]=A0.length,P0}function m(g,L){var y=g._values,D=g._index,T=g._ptr,N=g._datatype||g._data===void 0?g._datatype:g.getDataType();if(!y)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var w=L._data,C=L._datatype||L.getDataType(),P=g._size[0],H=L._size[0],Y=[],k=[],K=[],e0,b0=r,O0=M,v0=n,B0=0;N&&C&&N===C&&typeof N=="string"&&N!=="mixed"&&(e0=N,b0=e.find(r,[e0,e0]),O0=e.find(M,[e0,e0]),v0=e.find(n,[e0,e0]),B0=e.convert(0,e0));var A0=[],$0=[];K[0]=0;for(var P0=0;P0<H;P0++){var k0=w[P0];if(!v0(k0,B0))for(var W0=T[P0],i1=T[P0+1],e1=W0;e1<i1;e1++){var c1=D[e1];$0[c1]?A0[c1]=b0(A0[c1],O0(k0,y[e1])):($0[c1]=!0,k.push(c1),A0[c1]=O0(k0,y[e1]))}}for(var t2=k.length,W1=0;W1<t2;W1++){var F=k[W1];Y[W1]=A0[F]}return K[1]=k.length,g.createSparseMatrix({values:Y,index:k,ptr:K,size:[P,1],datatype:N===g._datatype&&C===L._datatype?e0:void 0})}function _(g,L){var y=g._values,D=g._index,T=g._ptr,N=g._datatype||g._data===void 0?g._datatype:g.getDataType();if(!y)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var w=L._data,C=L._datatype||L.getDataType(),P=g._size[0],H=L._size[0],Y=L._size[1],k,K=r,e0=M,b0=n,O0=0;N&&C&&N===C&&typeof N=="string"&&N!=="mixed"&&(k=N,K=e.find(r,[k,k]),e0=e.find(M,[k,k]),b0=e.find(n,[k,k]),O0=e.convert(0,k));for(var v0=[],B0=[],A0=[],$0=g.createSparseMatrix({values:v0,index:B0,ptr:A0,size:[P,Y],datatype:N===g._datatype&&C===L._datatype?k:void 0}),P0=[],k0=[],W0=0;W0<Y;W0++){A0[W0]=B0.length;for(var i1=W0+1,e1=0;e1<H;e1++){var c1=w[e1][W0];if(!b0(c1,O0))for(var t2=T[e1],W1=T[e1+1],F=t2;F<W1;F++){var J=D[F];k0[J]!==i1?(k0[J]=i1,B0.push(J),P0[J]=e0(c1,y[F])):P0[J]=K(P0[J],e0(c1,y[F]))}}for(var Z=A0[W0],s0=B0.length,R0=Z;R0<s0;R0++){var Y0=B0[R0];v0[R0]=P0[Y0]}}return A0[Y]=B0.length,$0}function R(g,L){var y=g._values,D=g._index,T=g._ptr,N=g._datatype||g._data===void 0?g._datatype:g.getDataType(),w=L._values,C=L._index,P=L._ptr,H=L._datatype||L._data===void 0?L._datatype:L.getDataType(),Y=g._size[0],k=L._size[1],K=y&&w,e0,b0=r,O0=M;N&&H&&N===H&&typeof N=="string"&&N!=="mixed"&&(e0=N,b0=e.find(r,[e0,e0]),O0=e.find(M,[e0,e0]));for(var v0=K?[]:void 0,B0=[],A0=[],$0=g.createSparseMatrix({values:v0,index:B0,ptr:A0,size:[Y,k],datatype:N===g._datatype&&H===L._datatype?e0:void 0}),P0=K?[]:void 0,k0=[],W0,i1,e1,c1,t2,W1,F,J,Z=0;Z<k;Z++){A0[Z]=B0.length;var s0=Z+1;for(t2=P[Z],W1=P[Z+1],c1=t2;c1<W1;c1++)if(J=C[c1],K)for(i1=T[J],e1=T[J+1],W0=i1;W0<e1;W0++)F=D[W0],k0[F]!==s0?(k0[F]=s0,B0.push(F),P0[F]=O0(w[c1],y[W0])):P0[F]=b0(P0[F],O0(w[c1],y[W0]));else for(i1=T[J],e1=T[J+1],W0=i1;W0<e1;W0++)F=D[W0],k0[F]!==s0&&(k0[F]=s0,B0.push(F));if(K)for(var R0=A0[Z],Y0=B0.length,v1=R0;v1<Y0;v1++){var Q0=B0[v1];v0[v1]=P0[Q0]}}return A0[k]=B0.length,$0}return e(Ia,M,{"Array, Array":e.referTo("Matrix, Matrix",g=>(L,y)=>{c(o2(L),o2(y));var D=g(t(L),t(y));return P1(D)?D.valueOf():D}),"Matrix, Matrix":function(L,y){var D=L.size(),T=y.size();return c(D,T),D.length===1?T.length===1?O(L,y,D[0]):s(L,y):T.length===1?l(L,y):q(L,y)},"Matrix, Array":e.referTo("Matrix,Matrix",g=>(L,y)=>g(L,t(y))),"Array, Matrix":e.referToSelf(g=>(L,y)=>g(t(L,y.storage()),y)),"SparseMatrix, any":function(L,y){return z(L,y,M,!1)},"DenseMatrix, any":function(L,y){return i(L,y,M,!1)},"any, SparseMatrix":function(L,y){return z(y,L,M,!0)},"any, DenseMatrix":function(L,y){return i(y,L,M,!0)},"Array, any":function(L,y){return i(t(L),y,M,!1).valueOf()},"any, Array":function(L,y){return i(t(y),L,M,!0).valueOf()},"any, any":M,"any, any, ...any":e.referToSelf(g=>(L,y,D)=>{for(var T=g(L,y),N=0;N<D.length;N++)T=g(T,D[N]);return T})})}),Pa="subtract",Kh=["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],Jh=h0(Pa,Kh,o=>{var{typed:e,matrix:t,equalScalar:r,subtractScalar:M,unaryMinus:n,DenseMatrix:b,concat:z}=o,i=Sa({typed:e}),c=wr({typed:e}),O=xa({typed:e,equalScalar:r}),s=Fa({typed:e,DenseMatrix:b}),u=Br({typed:e,DenseMatrix:b}),l=Vt({typed:e,matrix:t,concat:z});return e(Pa,{"any, any":M},l({elop:M,SS:O,DS:i,SD:c,Ss:u,sS:s}))}),Qh="matAlgo07xSSf",Zh=["typed","DenseMatrix"],Co=h0(Qh,Zh,o=>{var{typed:e,DenseMatrix:t}=o;return function(n,b,z){var i=n._size,c=n._datatype||n._data===void 0?n._datatype:n.getDataType(),O=b._size,s=b._datatype||b._data===void 0?b._datatype:b.getDataType();if(i.length!==O.length)throw new d1(i.length,O.length);if(i[0]!==O[0]||i[1]!==O[1])throw new RangeError("Dimension mismatch. Matrix A ("+i+") must match Matrix B ("+O+")");var u=i[0],l=i[1],q,A=0,h=z;typeof c=="string"&&c===s&&c!=="mixed"&&(q=c,A=e.convert(0,q),h=e.find(z,[q,q]));var d,m,_=[];for(d=0;d<u;d++)_[d]=[];var R=[],g=[],L=[],y=[];for(m=0;m<l;m++){var D=m+1;for(r(n,m,L,R,D),r(b,m,y,g,D),d=0;d<u;d++){var T=L[d]===D?R[d]:A,N=y[d]===D?g[d]:A;_[d][m]=h(T,N)}}return new t({data:_,size:[u,l],datatype:c===n._datatype&&s===b._datatype?q:void 0})};function r(M,n,b,z,i){for(var c=M._values,O=M._index,s=M._ptr,u=s[n],l=s[n+1];u<l;u++){var q=O[u];b[q]=i,z[q]=c[u]}}}),ka="conj",eW=["typed"],tW=h0(ka,eW,o=>{var{typed:e}=o;return e(ka,{"number | BigNumber | Fraction":t=>t,Complex:t=>t.conjugate(),"Array | Matrix":e.referToSelf(t=>r=>Re(r,t))})}),$a="concat",rW=["typed","matrix","isInteger"],MW=h0($a,rW,o=>{var{typed:e,matrix:t,isInteger:r}=o;return e($a,{"...Array | Matrix | number | BigNumber":function(n){var b,z=n.length,i=-1,c,O=!1,s=[];for(b=0;b<z;b++){var u=n[b];if(P1(u)&&(O=!0),C1(u)||e2(u)){if(b!==z-1)throw new Error("Dimension must be specified as last argument");if(c=i,i=u.valueOf(),!r(i))throw new TypeError("Integer number expected for dimension");if(i<0||b>0&&i>c)throw new mt(i,c+1)}else{var l=g1(u).valueOf(),q=o2(l);if(s[b]=l,c=i,i=q.length-1,b>0&&i!==c)throw new d1(c+1,i+1)}}if(s.length===0)throw new SyntaxError("At least one matrix expected");for(var A=s.shift();s.length;)A=Kc(A,s.shift(),i);return O?t(A):A},"...string":function(n){return n.join("")}})}),Ua="count",oW=["typed","size","prod"],nW=h0(Ua,oW,o=>{var{typed:e,size:t,prod:r}=o;return e(Ua,{string:function(n){return n.length},"Matrix | Array":function(n){return r(t(n))}})}),ja="identity",bW=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],pW=h0(ja,bW,o=>{var{typed:e,config:t,matrix:r,BigNumber:M,DenseMatrix:n,SparseMatrix:b}=o;return e(ja,{"":function(){return t.matrix==="Matrix"?r([]):[]},string:function(O){return r(O)},"number | BigNumber":function(O){return i(O,O,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, string":function(O,s){return i(O,O,s)},"number | BigNumber, number | BigNumber":function(O,s){return i(O,s,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(O,s,u){return i(O,s,u)},Array:function(O){return z(O)},"Array, string":function(O,s){return z(O,s)},Matrix:function(O){return z(O.valueOf(),O.storage())},"Matrix, string":function(O,s){return z(O.valueOf(),s)}});function z(c,O){switch(c.length){case 0:return O?r(O):[];case 1:return i(c[0],c[0],O);case 2:return i(c[0],c[1],O);default:throw new Error("Vector containing two values expected")}}function i(c,O,s){var u=e2(c)||e2(O)?M:null;if(e2(c)&&(c=c.toNumber()),e2(O)&&(O=O.toNumber()),!U1(c)||c<1)throw new Error("Parameters in function identity must be positive integers");if(!U1(O)||O<1)throw new Error("Parameters in function identity must be positive integers");var l=u?new M(1):1,q=u?new u(0):0,A=[c,O];if(s){if(s==="sparse")return b.diagonal(A,l,0,q);if(s==="dense")return n.diagonal(A,l,0,q);throw new TypeError('Unknown matrix type "'.concat(s,'"'))}for(var h=Vb([],A,q),d=c<O?c:O,m=0;m<d;m++)h[m][m]=l;return h}}),Ha="kron",zW=["typed","matrix","multiplyScalar"],iW=h0(Ha,zW,o=>{var{typed:e,matrix:t,multiplyScalar:r}=o;return e(Ha,{"Matrix, Matrix":function(b,z){return t(M(b.toArray(),z.toArray()))},"Matrix, Array":function(b,z){return t(M(b.toArray(),z))},"Array, Matrix":function(b,z){return t(M(b,z.toArray()))},"Array, Array":M});function M(n,b){if(o2(n).length===1&&(n=[n]),o2(b).length===1&&(b=[b]),o2(n).length>2||o2(b).length>2)throw new RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(n.length)+", y = "+JSON.stringify(b.length)+")");var z=[],i=[];return n.map(function(c){return b.map(function(O){return i=[],z.push(i),c.map(function(s){return O.map(function(u){return i.push(r(s,u))})})})})&&z}});function cW(){throw new Error('No "bignumber" implementation available')}function aW(){throw new Error('No "fraction" implementation available')}function sW(){throw new Error('No "matrix" implementation available')}var Ya="reshape",OW=["typed","isInteger","matrix"],uW=h0(Ya,OW,o=>{var{typed:e,isInteger:t}=o;return e(Ya,{"Matrix, Array":function(M,n){return M.reshape(n,!0)},"Array, Array":function(M,n){return n.forEach(function(b){if(!t(b))throw new TypeError("Invalid size for dimension: "+b)}),Jb(M,n)}})}),Ga="size",AW=["typed","config","?matrix"],fW=h0(Ga,AW,o=>{var{typed:e,config:t,matrix:r}=o;return e(Ga,{Matrix:function(n){return n.create(n.size())},Array:o2,string:function(n){return t.matrix==="Array"?[n.length]:r([n.length])},"number | Complex | BigNumber | Unit | boolean | null":function(n){return t.matrix==="Array"?[]:r?r([]):sW()}})}),Va="transpose",lW=["typed","matrix"],dW=h0(Va,lW,o=>{var{typed:e,matrix:t}=o;return e(Va,{Array:b=>r(t(b)).valueOf(),Matrix:r,any:g1});function r(b){var z=b.size(),i;switch(z.length){case 1:i=b.clone();break;case 2:{var c=z[0],O=z[1];if(O===0)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+D1(z)+")");switch(b.storage()){case"dense":i=M(b,c,O);break;case"sparse":i=n(b,c,O);break}}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+D1(z)+")")}return i}function M(b,z,i){for(var c=b._data,O=[],s,u=0;u<i;u++){s=O[u]=[];for(var l=0;l<z;l++)s[l]=g1(c[l][u])}return b.createDenseMatrix({data:O,size:[i,z],datatype:b._datatype})}function n(b,z,i){for(var c=b._values,O=b._index,s=b._ptr,u=c?[]:void 0,l=[],q=[],A=[],h=0;h<z;h++)A[h]=0;var d,m,_;for(d=0,m=O.length;d<m;d++)A[O[d]]++;for(var R=0,g=0;g<z;g++)q.push(R),R+=A[g],A[g]=q[g];for(q.push(R),_=0;_<i;_++)for(var L=s[_],y=s[_+1],D=L;D<y;D++){var T=A[O[D]]++;l[T]=_,c&&(u[T]=g1(c[D]))}return b.createSparseMatrix({values:u,index:l,ptr:q,size:[i,z],datatype:b._datatype})}}),Ka="ctranspose",qW=["typed","transpose","conj"],hW=h0(Ka,qW,o=>{var{typed:e,transpose:t,conj:r}=o;return e(Ka,{any:function(n){return r(t(n))}})}),Ja="mode",WW=["typed","isNaN","isNumeric"],_W=h0(Ja,WW,o=>{var{typed:e,isNaN:t,isNumeric:r}=o;return e(Ja,{"Array | Matrix":M,"...":function(b){return M(b)}});function M(n){n=Zb(n.valueOf());var b=n.length;if(b===0)throw new Error("Cannot calculate mode of an empty array");for(var z={},i=[],c=0,O=0;O<n.length;O++){var s=n[O];if(r(s)&&t(s))throw new Error("Cannot calculate mode of an array containing NaN values");s in z||(z[s]=0),z[s]++,z[s]===c?i.push(s):z[s]>c&&(c=z[s],i=[s])}return i}});function Nt(o,e,t){var r;return String(o).indexOf("Unexpected type")!==-1?(r=arguments.length>2?" (type: "+_t(t)+", value: "+JSON.stringify(t)+")":" (type: "+o.data.actual+")",new TypeError("Cannot calculate "+e+", unexpected type of argument"+r)):String(o).indexOf("complex numbers")!==-1?(r=arguments.length>2?" (type: "+_t(t)+", value: "+JSON.stringify(t)+")":"",new TypeError("Cannot calculate "+e+", no ordering relation is defined for complex numbers"+r)):o}var Qa="prod",mW=["typed","config","multiplyScalar","numeric"],gW=h0(Qa,mW,o=>{var{typed:e,config:t,multiplyScalar:r,numeric:M}=o;return e(Qa,{"Array | Matrix":n,"Array | Matrix, number | BigNumber":function(z,i){throw new Error("prod(A, dim) is not yet supported")},"...":function(z){return n(z)}});function n(b){var z;if(lM(b,function(i){try{z=z===void 0?i:r(z,i)}catch(c){throw Nt(c,"prod",i)}}),typeof z=="string"&&(z=M(z,t.number)),z===void 0)throw new Error("Cannot calculate prod of an empty array");return z}}),RW="numeric",vW=["number","?bignumber","?fraction"],LW=h0(RW,vW,o=>{var{number:e,bignumber:t,fraction:r}=o,M={string:!0,number:!0,BigNumber:!0,Fraction:!0},n={number:b=>e(b),BigNumber:t?b=>t(b):cW,Fraction:r?b=>r(b):aW};return function(z){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"number",c=arguments.length>2?arguments[2]:void 0;if(c!==void 0)throw new SyntaxError("numeric() takes one or two arguments");var O=_t(z);if(!(O in M))throw new TypeError("Cannot convert "+z+' of type "'+O+'"; valid input types are '+Object.keys(M).join(", "));if(!(i in n))throw new TypeError("Cannot convert "+z+' to type "'+i+'"; valid output types are '+Object.keys(n).join(", "));return i===O?z:n[i](z)}}),Za="divideScalar",NW=["typed","numeric"],yW=h0(Za,NW,o=>{var{typed:e,numeric:t}=o;return e(Za,{"number, number":function(M,n){return M/n},"Complex, Complex":function(M,n){return M.div(n)},"BigNumber, BigNumber":function(M,n){return M.div(n)},"Fraction, Fraction":function(M,n){return M.div(n)},"Unit, number | Complex | Fraction | BigNumber | Unit":(r,M)=>r.divide(M),"number | Fraction | Complex | BigNumber, Unit":(r,M)=>M.divideInto(r)})}),es="pow",BW=["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],wW=h0(es,BW,o=>{var{typed:e,config:t,identity:r,multiply:M,matrix:n,inv:b,number:z,fraction:i,Complex:c}=o;return e(es,{"number, number":O,"Complex, Complex":function(q,A){return q.pow(A)},"BigNumber, BigNumber":function(q,A){return A.isInteger()||q>=0||t.predictable?q.pow(A):new c(q.toNumber(),0).pow(A.toNumber(),0)},"Fraction, Fraction":function(q,A){var h=q.pow(A);if(h!=null)return h;if(t.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return O(q.valueOf(),A.valueOf())},"Array, number":s,"Array, BigNumber":function(q,A){return s(q,A.toNumber())},"Matrix, number":u,"Matrix, BigNumber":function(q,A){return u(q,A.toNumber())},"Unit, number | BigNumber":function(q,A){return q.pow(A)}});function O(l,q){if(t.predictable&&!U1(q)&&l<0)try{var A=i(q),h=z(A);if((q===h||Math.abs((q-h)/q)<1e-14)&&A.d%2===1)return(A.n%2===0?1:-1)*Math.pow(-l,q)}catch{}return t.predictable&&(l<-1&&q===1/0||l>-1&&l<0&&q===-1/0)?NaN:U1(q)||l>=0||t.predictable?Ra(l,q):l*l<1&&q===1/0||l*l>1&&q===-1/0?0:new c(l,0).pow(q,0)}function s(l,q){if(!U1(q))throw new TypeError("For A^b, b must be an integer (value is "+q+")");var A=o2(l);if(A.length!==2)throw new Error("For A^b, A must be 2 dimensional (A has "+A.length+" dimensions)");if(A[0]!==A[1])throw new Error("For A^b, A must be square (size is "+A[0]+"x"+A[1]+")");if(q<0)try{return s(b(l),-q)}catch(m){throw m.message==="Cannot calculate inverse, determinant is zero"?new TypeError("For A^b, when A is not invertible, b must be a positive integer (value is "+q+")"):m}for(var h=r(A[0]).valueOf(),d=l;q>=1;)(q&1)===1&&(h=M(d,h)),q>>=1,d=M(d,d);return h}function u(l,q){return n(s(l.valueOf(),q))}}),ts="dotDivide",DW=["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],XW=h0(ts,DW,o=>{var{typed:e,matrix:t,equalScalar:r,divideScalar:M,DenseMatrix:n,concat:b}=o,z=Rh({typed:e,equalScalar:r}),i=wr({typed:e}),c=Co({typed:e,DenseMatrix:n}),O=ip({typed:e,equalScalar:r}),s=Br({typed:e,DenseMatrix:n}),u=Vt({typed:e,matrix:t,concat:b});return e(ts,u({elop:M,SS:c,DS:i,SD:z,Ss:O,sS:s}))}),xo="compare",EW=["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],TW=h0(xo,EW,o=>{var{typed:e,config:t,equalScalar:r,matrix:M,BigNumber:n,Fraction:b,DenseMatrix:z,concat:i}=o,c=wr({typed:e}),O=xa({typed:e,equalScalar:r}),s=Br({typed:e,DenseMatrix:z}),u=Vt({typed:e,matrix:M,concat:i}),l=Eo({typed:e});return e(xo,CW({typed:e,config:t}),{"boolean, boolean":function(A,h){return A===h?0:A>h?1:-1},"BigNumber, BigNumber":function(A,h){return Xo(A,h,t.epsilon)?new n(0):new n(A.cmp(h))},"Fraction, Fraction":function(A,h){return new b(A.compare(h))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},l,u({SS:O,DS:c,Ss:s}))}),CW=h0(xo,["typed","config"],o=>{var{typed:e,config:t}=o;return e(xo,{"number, number":function(M,n){return Gt(M,n,t.epsilon)?0:M>n?1:-1}})}),So="equal",xW=["typed","matrix","equalScalar","DenseMatrix","concat"],SW=h0(So,xW,o=>{var{typed:e,matrix:t,equalScalar:r,DenseMatrix:M,concat:n}=o,b=wr({typed:e}),z=Co({typed:e,DenseMatrix:M}),i=Br({typed:e,DenseMatrix:M}),c=Vt({typed:e,matrix:t,concat:n});return e(So,FW({typed:e,equalScalar:r}),c({elop:r,SS:z,DS:b,Ss:i}))}),FW=h0(So,["typed","equalScalar"],o=>{var{typed:e,equalScalar:t}=o;return e(So,{"any, any":function(M,n){return M===null?n===null:n===null?M===null:M===void 0?n===void 0:n===void 0?M===void 0:t(M,n)}})}),Fo="smaller",IW=["typed","config","matrix","DenseMatrix","concat"],PW=h0(Fo,IW,o=>{var{typed:e,config:t,matrix:r,DenseMatrix:M,concat:n}=o,b=wr({typed:e}),z=Co({typed:e,DenseMatrix:M}),i=Br({typed:e,DenseMatrix:M}),c=Vt({typed:e,matrix:r,concat:n}),O=Eo({typed:e});return e(Fo,kW({typed:e,config:t}),{"boolean, boolean":(s,u)=>s<u,"BigNumber, BigNumber":function(u,l){return u.lt(l)&&!Xo(u,l,t.epsilon)},"Fraction, Fraction":(s,u)=>s.compare(u)===-1,"Complex, Complex":function(u,l){throw new TypeError("No ordering relation is defined for complex numbers")}},O,c({SS:z,DS:b,Ss:i}))}),kW=h0(Fo,["typed","config"],o=>{var{typed:e,config:t}=o;return e(Fo,{"number, number":function(M,n){return M<n&&!Gt(M,n,t.epsilon)}})}),Io="larger",$W=["typed","config","matrix","DenseMatrix","concat"],UW=h0(Io,$W,o=>{var{typed:e,config:t,matrix:r,DenseMatrix:M,concat:n}=o,b=wr({typed:e}),z=Co({typed:e,DenseMatrix:M}),i=Br({typed:e,DenseMatrix:M}),c=Vt({typed:e,matrix:r,concat:n}),O=Eo({typed:e});return e(Io,jW({typed:e,config:t}),{"boolean, boolean":(s,u)=>s>u,"BigNumber, BigNumber":function(u,l){return u.gt(l)&&!Xo(u,l,t.epsilon)},"Fraction, Fraction":(s,u)=>s.compare(u)===1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},O,c({SS:z,DS:b,Ss:i}))}),jW=h0(Io,["typed","config"],o=>{var{typed:e,config:t}=o;return e(Io,{"number, number":function(M,n){return M>n&&!Gt(M,n,t.epsilon)}})}),rs="deepEqual",HW=["typed","equal"],YW=h0(rs,HW,o=>{var{typed:e,equal:t}=o;return e(rs,{"any, any":function(n,b){return r(n.valueOf(),b.valueOf())}});function r(M,n){if(Array.isArray(M))if(Array.isArray(n)){var b=M.length;if(b!==n.length)return!1;for(var z=0;z<b;z++)if(!r(M[z],n[z]))return!1;return!0}else return!1;else return Array.isArray(n)?!1:t(M,n)}}),Ms="partitionSelect",GW=["typed","isNumeric","isNaN","compare"],VW=h0(Ms,GW,o=>{var{typed:e,isNumeric:t,isNaN:r,compare:M}=o,n=M,b=(c,O)=>-M(c,O);return e(Ms,{"Array | Matrix, number":function(O,s){return z(O,s,n)},"Array | Matrix, number, string":function(O,s,u){if(u==="asc")return z(O,s,n);if(u==="desc")return z(O,s,b);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":z});function z(c,O,s){if(!U1(O)||O<0)throw new Error("k must be a non-negative integer");if(P1(c)){var u=c.size();if(u.length>1)throw new Error("Only one dimensional matrices supported");return i(c.valueOf(),O,s)}if(Array.isArray(c))return i(c,O,s)}function i(c,O,s){if(O>=c.length)throw new Error("k out of bounds");for(var u=0;u<c.length;u++)if(t(c[u])&&r(c[u]))return c[u];for(var l=0,q=c.length-1;l<q;){for(var A=l,h=q,d=c[Math.floor(Math.random()*(q-l+1))+l];A<h;)if(s(c[A],d)>=0){var m=c[h];c[h]=c[A],c[A]=m,--h}else++A;s(c[A],d)>0&&--A,O<=A?q=A:l=A+1}return c[O]}}),os="max",KW=["typed","config","numeric","larger"],JW=h0(os,KW,o=>{var{typed:e,config:t,numeric:r,larger:M}=o;return e(os,{"Array | Matrix":b,"Array | Matrix, number | BigNumber":function(i,c){return zp(i,c.valueOf(),n)},"...":function(i){if(Bo(i))throw new TypeError("Scalar values expected in function max");return b(i)}});function n(z,i){try{return M(z,i)?z:i}catch(c){throw Nt(c,"max",i)}}function b(z){var i;if(lM(z,function(c){try{isNaN(c)&&typeof c=="number"?i=NaN:(i===void 0||M(c,i))&&(i=c)}catch(O){throw Nt(O,"max",c)}}),i===void 0)throw new Error("Cannot calculate max of an empty array");return typeof i=="string"&&(i=r(i,t.number)),i}}),ns="min",QW=["typed","config","numeric","smaller"],ZW=h0(ns,QW,o=>{var{typed:e,config:t,numeric:r,smaller:M}=o;return e(ns,{"Array | Matrix":b,"Array | Matrix, number | BigNumber":function(i,c){return zp(i,c.valueOf(),n)},"...":function(i){if(Bo(i))throw new TypeError("Scalar values expected in function min");return b(i)}});function n(z,i){try{return M(z,i)?z:i}catch(c){throw Nt(c,"min",i)}}function b(z){var i;if(lM(z,function(c){try{isNaN(c)&&typeof c=="number"?i=NaN:(i===void 0||M(c,i))&&(i=c)}catch(O){throw Nt(O,"min",c)}}),i===void 0)throw new Error("Cannot calculate min of an empty array");return typeof i=="string"&&(i=r(i,t.number)),i}}),bs="add",e6=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],t6=h0(bs,e6,o=>{var{typed:e,matrix:t,addScalar:r,equalScalar:M,DenseMatrix:n,SparseMatrix:b,concat:z}=o,i=Sa({typed:e}),c=kh({typed:e,equalScalar:M}),O=Fa({typed:e,DenseMatrix:n}),s=Vt({typed:e,matrix:t,concat:z});return e(bs,{"any, any":r,"any, any, ...any":e.referToSelf(u=>(l,q,A)=>{for(var h=u(l,q),d=0;d<A.length;d++)h=u(h,A[d]);return h})},s({elop:r,DS:i,SS:c,Ss:O}))}),ps="dot",r6=["typed","addScalar","multiplyScalar","conj","size"],M6=h0(ps,r6,o=>{var{typed:e,addScalar:t,multiplyScalar:r,conj:M,size:n}=o;return e(ps,{"Array | DenseMatrix, Array | DenseMatrix":z,"SparseMatrix, SparseMatrix":i});function b(O,s){var u=c(O),l=c(s),q,A;if(u.length===1)q=u[0];else if(u.length===2&&u[1]===1)q=u[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+u.join(", ")+")");if(l.length===1)A=l[0];else if(l.length===2&&l[1]===1)A=l[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+l.join(", ")+")");if(q!==A)throw new RangeError("Vectors must have equal length ("+q+" != "+A+")");if(q===0)throw new RangeError("Cannot calculate the dot product of empty vectors");return q}function z(O,s){var u=b(O,s),l=P1(O)?O._data:O,q=P1(O)?O._datatype||O.getDataType():void 0,A=P1(s)?s._data:s,h=P1(s)?s._datatype||s.getDataType():void 0,d=c(O).length===2,m=c(s).length===2,_=t,R=r;if(q&&h&&q===h&&typeof q=="string"&&q!=="mixed"){var g=q;_=e.find(t,[g,g]),R=e.find(r,[g,g])}if(!d&&!m){for(var L=R(M(l[0]),A[0]),y=1;y<u;y++)L=_(L,R(M(l[y]),A[y]));return L}if(!d&&m){for(var D=R(M(l[0]),A[0][0]),T=1;T<u;T++)D=_(D,R(M(l[T]),A[T][0]));return D}if(d&&!m){for(var N=R(M(l[0][0]),A[0]),w=1;w<u;w++)N=_(N,R(M(l[w][0]),A[w]));return N}if(d&&m){for(var C=R(M(l[0][0]),A[0][0]),P=1;P<u;P++)C=_(C,R(M(l[P][0]),A[P][0]));return C}}function i(O,s){b(O,s);for(var u=O._index,l=O._values,q=s._index,A=s._values,h=0,d=t,m=r,_=0,R=0;_<u.length&&R<q.length;){var g=u[_],L=q[R];if(g<L){_++;continue}if(g>L){R++;continue}g===L&&(h=d(h,m(l[_],A[R])),_++,R++)}return h}function c(O){return P1(O)?O.size():n(O)}}),o6="trace",n6=["typed","matrix","add"],b6=h0(o6,n6,o=>{var{typed:e,matrix:t,add:r}=o;return e("trace",{Array:function(z){return M(t(z))},SparseMatrix:n,DenseMatrix:M,any:g1});function M(b){var z=b._size,i=b._data;switch(z.length){case 1:if(z[0]===1)return g1(i[0]);throw new RangeError("Matrix must be square (size: "+D1(z)+")");case 2:{var c=z[0],O=z[1];if(c===O){for(var s=0,u=0;u<c;u++)s=r(s,i[u][u]);return s}else throw new RangeError("Matrix must be square (size: "+D1(z)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+D1(z)+")")}}function n(b){var z=b._values,i=b._index,c=b._ptr,O=b._size,s=O[0],u=O[1];if(s===u){var l=0;if(z.length>0)for(var q=0;q<u;q++)for(var A=c[q],h=c[q+1],d=A;d<h;d++){var m=i[d];if(m===q){l=r(l,z[d]);break}if(m>q)break}return l}throw new RangeError("Matrix must be square (size: "+D1(O)+")")}}),zs="det",p6=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],z6=h0(zs,p6,o=>{var{typed:e,matrix:t,subtractScalar:r,multiply:M,divideScalar:n,isZero:b,unaryMinus:z}=o;return e(zs,{any:function(O){return g1(O)},"Array | Matrix":function(O){var s;switch(P1(O)?s=O.size():Array.isArray(O)?(O=t(O),s=O.size()):s=[],s.length){case 0:return g1(O);case 1:if(s[0]===1)return g1(O.valueOf()[0]);if(s[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+D1(s)+")");case 2:{var u=s[0],l=s[1];if(u===l)return i(O.clone().valueOf(),u);if(l===0)return 1;throw new RangeError("Matrix must be square (size: "+D1(s)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+D1(s)+")")}}});function i(c,O,s){if(O===1)return g1(c[0][0]);if(O===2)return r(M(c[0][0],c[1][1]),M(c[1][0],c[0][1]));for(var u=!1,l=new Array(O).fill(0).map((y,D)=>D),q=0;q<O;q++){var A=l[q];if(b(c[A][q])){var h=void 0;for(h=q+1;h<O;h++)if(!b(c[l[h]][q])){A=l[h],l[h]=l[q],l[q]=A,u=!u;break}if(h===O)return c[A][q]}for(var d=c[A][q],m=q===0?1:c[l[q-1]][q-1],_=q+1;_<O;_++)for(var R=l[_],g=q+1;g<O;g++)c[R][g]=n(r(M(c[R][g],d),M(c[R][q],c[A][g])),m)}var L=c[l[O-1]][O-1];return u?z(L):L}}),is="inv",i6=["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],c6=h0(is,i6,o=>{var{typed:e,matrix:t,divideScalar:r,addScalar:M,multiply:n,unaryMinus:b,det:z,identity:i,abs:c}=o;return e(is,{"Array | Matrix":function(u){var l=P1(u)?u.size():o2(u);switch(l.length){case 1:if(l[0]===1)return P1(u)?t([r(1,u.valueOf()[0])]):[r(1,u[0])];throw new RangeError("Matrix must be square (size: "+D1(l)+")");case 2:{var q=l[0],A=l[1];if(q===A)return P1(u)?t(O(u.valueOf(),q,A),u.storage()):O(u,q,A);throw new RangeError("Matrix must be square (size: "+D1(l)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+D1(l)+")")}},any:function(u){return r(1,u)}});function O(s,u,l){var q,A,h,d,m;if(u===1){if(d=s[0][0],d===0)throw Error("Cannot calculate inverse, determinant is zero");return[[r(1,d)]]}else if(u===2){var _=z(s);if(_===0)throw Error("Cannot calculate inverse, determinant is zero");return[[r(s[1][1],_),r(b(s[0][1]),_)],[r(b(s[1][0]),_),r(s[0][0],_)]]}else{var R=s.concat();for(q=0;q<u;q++)R[q]=R[q].concat();for(var g=i(u).valueOf(),L=0;L<l;L++){var y=c(R[L][L]),D=L;for(q=L+1;q<u;)c(R[q][L])>y&&(y=c(R[q][L]),D=q),q++;if(y===0)throw Error("Cannot calculate inverse, determinant is zero");q=D,q!==L&&(m=R[L],R[L]=R[q],R[q]=m,m=g[L],g[L]=g[q],g[q]=m);var T=R[L],N=g[L];for(q=0;q<u;q++){var w=R[q],C=g[q];if(q!==L){if(w[L]!==0){for(h=r(b(w[L]),T[L]),A=L;A<l;A++)w[A]=M(w[A],n(h,T[A]));for(A=0;A<l;A++)C[A]=M(C[A],n(h,N[A]))}}else{for(h=T[L],A=L;A<l;A++)w[A]=r(w[A],h);for(A=0;A<l;A++)C[A]=r(C[A],h)}}}return g}}}),cs="pinv",a6=["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],s6=h0(cs,a6,o=>{var{typed:e,matrix:t,inv:r,deepEqual:M,equal:n,dotDivide:b,dot:z,ctranspose:i,divideScalar:c,multiply:O,add:s,Complex:u}=o;return e(cs,{"Array | Matrix":function(_){var R=P1(_)?_.size():o2(_);switch(R.length){case 1:return d(_)?i(_):R[0]===1?r(_):b(i(_),z(_,_));case 2:{if(d(_))return i(_);var g=R[0],L=R[1];if(g===L)try{return r(_)}catch(y){if(!(y instanceof Error&&y.message.match(/Cannot calculate inverse, determinant is zero/)))throw y}return P1(_)?t(l(_.valueOf(),g,L),_.storage()):l(_,g,L)}default:throw new RangeError("Matrix must be two dimensional (size: "+D1(R)+")")}},any:function(_){return n(_,0)?g1(_):c(1,_)}});function l(m,_,R){var{C:g,F:L}=A(m,_,R),y=O(r(O(i(g),g)),i(g)),D=O(i(L),r(O(L,i(L))));return O(D,y)}function q(m,_,R){for(var g=g1(m),L=0,y=0;y<_;y++){if(R<=L)return g;for(var D=y;h(g[D][L]);)if(D++,_===D&&(D=y,L++,R===L))return g;[g[D],g[y]]=[g[y],g[D]];for(var T=g[y][L],N=0;N<R;N++)g[y][N]=b(g[y][N],T);for(var w=0;w<_;w++)if(w!==y){T=g[w][L];for(var C=0;C<R;C++)g[w][C]=s(g[w][C],O(-1,O(T,g[y][C])))}L++}return g}function A(m,_,R){var g=q(m,_,R),L=m.map((D,T)=>D.filter((N,w)=>w<_&&!h(z(g[w],g[w])))),y=g.filter((D,T)=>!h(z(g[T],g[T])));return{C:L,F:y}}function h(m){return n(s(m,u(1,1)),s(0,u(1,1)))}function d(m){return M(s(m,u(1,1)),s(O(m,0),u(1,1)))}}),O6="divide",u6=["typed","matrix","multiply","equalScalar","divideScalar","inv"],A6=h0(O6,u6,o=>{var{typed:e,matrix:t,multiply:r,equalScalar:M,divideScalar:n,inv:b}=o,z=ip({typed:e,equalScalar:M}),i=cp({typed:e});return e("divide",Bc({"Array | Matrix, Array | Matrix":function(O,s){return r(O,b(s))},"DenseMatrix, any":function(O,s){return i(O,s,n,!1)},"SparseMatrix, any":function(O,s){return z(O,s,n,!1)},"Array, any":function(O,s){return i(t(O),s,n,!1).valueOf()},"any, Array | Matrix":function(O,s){return r(O,b(s))}},n.signatures))}),as="sum",f6=["typed","config","add","numeric"],l6=h0(as,f6,o=>{var{typed:e,config:t,add:r,numeric:M}=o;return e(as,{"Array | Matrix":n,"Array | Matrix, number | BigNumber":b,"...":function(i){if(Bo(i))throw new TypeError("Scalar values expected in function sum");return n(i)}});function n(z){var i;return lM(z,function(c){try{i=i===void 0?c:r(i,c)}catch(O){throw Nt(O,"sum",c)}}),i===void 0&&(i=M(0,t.number)),typeof i=="string"&&(i=M(i,t.number)),i}function b(z,i){try{var c=zp(z,i,r);return c}catch(O){throw Nt(O,"sum")}}}),ss="median",d6=["typed","add","divide","compare","partitionSelect"],q6=h0(ss,d6,o=>{var{typed:e,add:t,divide:r,compare:M,partitionSelect:n}=o;function b(c){try{c=Zb(c.valueOf());var O=c.length;if(O===0)throw new Error("Cannot calculate median of an empty array");if(O%2===0){for(var s=O/2-1,u=n(c,s+1),l=c[s],q=0;q<s;++q)M(c[q],l)>0&&(l=c[q]);return i(l,u)}else{var A=n(c,(O-1)/2);return z(A)}}catch(h){throw Nt(h,"median")}}var z=e({"number | BigNumber | Complex | Unit":function(O){return O}}),i=e({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(O,s){return r(t(O,s),2)}});return e(ss,{"Array | Matrix":b,"Array | Matrix, number | BigNumber":function(O,s){throw new Error("median(A, dim) is not yet supported")},"...":function(O){if(Bo(O))throw new TypeError("Scalar values expected in function median");return b(O)}})}),Po=h5({config:U2}),ap=g5({}),sp=N5({}),Op=w5({}),xe=E5({Matrix:Op}),S0=mq({BigNumber:Po,Complex:ap,DenseMatrix:xe,Fraction:sp}),h6=sh({typed:S0}),ko=uh({typed:S0}),W6=Mh({BigNumber:Po,typed:S0}),Os=tW({typed:S0}),yt=H5({config:U2,typed:S0}),$o=x5({typed:S0}),_6=P5({typed:S0}),Uo=Yh({typed:S0}),us=eh({typed:S0}),up=V5({Matrix:Op,equalScalar:yt,typed:S0}),As=fh({typed:S0}),fs=$5({typed:S0}),Ap=ch({typed:S0}),ls=bh({Fraction:sp,typed:S0}),ds=F5({typed:S0}),n2=zh({DenseMatrix:xe,Matrix:Op,SparseMatrix:up,typed:S0}),qs=_W({isNaN:fs,isNumeric:ds,typed:S0}),dM=LW({bignumber:W6,fraction:ls,number:us}),m6=gW({config:U2,multiplyScalar:Uo,numeric:dM,typed:S0}),g6=uW({isInteger:$o,matrix:n2,typed:S0}),hs=fW({matrix:n2,config:U2,typed:S0}),Ws=dW({matrix:n2,typed:S0}),Kt=MW({isInteger:$o,matrix:n2,typed:S0}),R6=nW({prod:m6,size:hs,typed:S0}),v6=hW({conj:Os,transpose:Ws,typed:S0}),qM=yW({numeric:dM,typed:S0}),L6=XW({DenseMatrix:xe,concat:Kt,divideScalar:qM,equalScalar:yt,matrix:n2,typed:S0}),_s=SW({DenseMatrix:xe,concat:Kt,equalScalar:yt,matrix:n2,typed:S0}),ms=pW({BigNumber:Po,DenseMatrix:xe,SparseMatrix:up,config:U2,matrix:n2,typed:S0}),N6=iW({matrix:n2,multiplyScalar:Uo,typed:S0}),y6=PW({DenseMatrix:xe,concat:Kt,config:U2,matrix:n2,typed:S0}),B6=Jh({DenseMatrix:xe,concat:Kt,equalScalar:yt,matrix:n2,subtractScalar:As,typed:S0,unaryMinus:Ap}),hM=t6({DenseMatrix:xe,SparseMatrix:up,addScalar:ko,concat:Kt,equalScalar:yt,matrix:n2,typed:S0}),gs=TW({BigNumber:Po,DenseMatrix:xe,Fraction:sp,concat:Kt,config:U2,equalScalar:yt,matrix:n2,typed:S0}),w6=YW({equal:_s,typed:S0}),Rs=M6({addScalar:ko,conj:Os,multiplyScalar:Uo,size:hs,typed:S0}),D6=UW({DenseMatrix:xe,concat:Kt,config:U2,matrix:n2,typed:S0}),fp=ZW({config:U2,numeric:dM,smaller:y6,typed:S0}),Dr=Vh({addScalar:ko,dot:Rs,equalScalar:yt,matrix:n2,multiplyScalar:Uo,typed:S0}),X6=VW({compare:gs,isNaN:fs,isNumeric:ds,typed:S0}),E6=l6({add:hM,config:U2,numeric:dM,typed:S0}),T6=b6({add:hM,matrix:n2,typed:S0}),vs=z6({divideScalar:qM,isZero:_6,matrix:n2,multiply:Dr,subtractScalar:As,typed:S0,unaryMinus:Ap}),C6=JW({config:U2,larger:D6,numeric:dM,typed:S0}),jo=c6({abs:h6,addScalar:ko,det:vs,divideScalar:qM,identity:ms,matrix:n2,multiply:Dr,typed:S0,unaryMinus:Ap}),x6=s6({Complex:ap,add:hM,ctranspose:v6,deepEqual:w6,divideScalar:qM,dot:Rs,dotDivide:L6,equal:_s,inv:jo,matrix:n2,multiply:Dr,typed:S0}),S6=wW({Complex:ap,config:U2,fraction:ls,identity:ms,inv:jo,matrix:n2,multiply:Dr,number:us,typed:S0}),F6=A6({divideScalar:qM,equalScalar:yt,inv:jo,matrix:n2,multiply:Dr,typed:S0}),Ls=q6({add:hM,compare:gs,divide:F6,partitionSelect:X6,typed:S0});class I6{constructor(e,t,r){E(this,"_cacheData");E(this,"_variables");E(this,"_math");E(this,"_timeframe");this._cacheData={},this._variables=e,this._math=t,this._timeframe=r}get _taCacheData(){return this._cacheData}set _taCacheData(e){this._cacheData=e}alma({series:e,length:t,offset:r,sigma:M,floor:n,isSeriesLen:b},z){if(t===void 0||r===void 0||M===void 0)return;const i=this._cacheDataList(e,t,`alma_${z}`,b);if(i===void 0)return;let c=r*(t-1);n&&(c=Math.floor(c));const O=t/M;let s=0,u=0;for(let l=0;l<=t-1;l++){const q=Math.exp(-1*Math.pow(l-c,2)/(2*Math.pow(O,2)));s+=q,u+=i[i.length-1-(t-l-1)]*q}return u/s}sma({source:e,length:t,isSeriesLen:r},M){if(e===void 0||isNaN(e)||t===void 0)return;let n=0;const b=this._cacheDataList(e,t,`sma_${M}`,r);if(b===void 0)return;const z=b.slice(-t);return n=E6(...z)/t,n}rma({source:e,length:t,isSeriesLen:r},M){if(e===void 0||t===void 0||isNaN(e))return;const n=this._verifyCacheData(`rma_${M}`);if(n)return n==null?void 0:n.sum;const{sum:b}=this._getCacheData(`rma_${M}`),z=1/t,i=this.sma({source:e,length:t,isSeriesLen:r},M),c=b===void 0?i:z*e+(1-z)*(b||0);return this._cacheDataHandle(`rma_${M}`,{sum:c}),c}atr({length:e,isSeriesLen:t},r){const M=this._verifyCacheData(`atr_${r}`);if(M)return M==null?void 0:M.value;const{high:n,close:b}=this._getCacheData(`atr_${r}`),{high:z,close:i,low:c}=this._variables,O=n===void 0?z-c:Math.max(Math.max(z-c,Math.abs(z-b)),Math.abs(c-b)),s=this.rma({source:O,length:e,isSeriesLen:t},r);return this._cacheDataHandle(`atr_${r}`,{high:z,close:i,value:s}),s}barssince({condition:e},t){const r=this._verifyCacheData(`barssince_${t}`);if(r)return r==null?void 0:r.count;let{count:M}=this._getCacheData(`barssince_${t}`);if(e)M=0;else{if(M===void 0)return;M+=1}return this._cacheDataHandle(`barssince_${t}`,{count:M}),M}stdev({source:e,length:t,biased:r=!0,isSeriesLen:M},n){if(e===void 0||isNaN(e)||t===void 0)return;const b=this._cacheDataList(e,t,`stdev_${n}`,M),z=this.sma({source:e,length:t,isSeriesLen:M},n);if(b===void 0)return;let i=0;for(let c=0;c<t;c++){const O=this._sum(b[b.length-1-c],-(z||0));i+=O*O}return r||t<=1?Math.sqrt(i/t):Math.sqrt(i/(t-1))}_sum(e,t){let M=e+t;return Math.abs(M)<=1e-10&&(M=0),M}bb({series:e,length:t,mult:r,isSeriesLen:M},n){if(e===void 0||isNaN(e)||t===void 0||r===void 0)return[];const b=this.sma({source:e,length:t,isSeriesLen:M},n),z=this.stdev({source:e,length:t,isSeriesLen:M},n);if(b===void 0||z===void 0)return[];const i=r*z;return[b,b+i,b-i]}bbw({series:e,length:t,mult:r,isSeriesLen:M},n){if(e===void 0||isNaN(e)||t===void 0||r===void 0)return;const b=this.sma({source:e,length:t,isSeriesLen:M},n),z=this.stdev({source:e,length:t,isSeriesLen:M},n);if(b===void 0||z===void 0)return;const i=r*z;return(b+i-(b-i))/b}cci({source:e,length:t,isSeriesLen:r},M){if(e===void 0||isNaN(e)||t===void 0)return;const n=this.sma({source:e,length:t,isSeriesLen:r},M),b=this.dev({source:e,length:t,isSeriesLen:r},M);if(!(n===void 0||b===void 0))return(e-n)/(.015*b)}change({source:e,length:t=1,isSeriesLen:r},M){const n=this._cacheDataList(e,t,`change_${M}`,r);if(n===void 0)return;const b=n[n.length-1-t];if(!(e===void 0||isNaN(e)))return b===void 0?b:typeof e=="boolean"?b!==e:e-b}cmo({series:e,length:t},r){if(e===void 0||isNaN(e)||t===void 0)return;const M=this.change({source:e},r);if(M===void 0)return;const n=this._math.sum({source:M>=0?M:0,length:t},`sm1_${r}`),b=this._math.sum({source:M>=0?0:-M,length:t},`sm2_${r}`);if(!(n===void 0||b===void 0))return 100*(n-b)/(n+b)}cog({source:e,length:t,isSeriesLen:r},M){if(e===void 0||isNaN(e)||t===void 0)return;const n=this._cacheDataList(e,t,`cog_${M}`,r),b=this._math.sum({source:e,length:t},M);if(b===void 0||n===void 0)return;let z=0;for(let i=0;i<t;i++){const c=n[n.length-1-i];z+=c*(i+1)}return-z/b}correlation({source1:e,source2:t,length:r,isSeriesLen:M},n){if(e===void 0||isNaN(e)||t===void 0||isNaN(t)||r===void 0)return;const b=this._cacheDataList([e,t],r,`correlation_${n}`,M),z=this.sma({source:e,length:r,isSeriesLen:M},`sma1_${n}`),i=this.sma({source:t,length:r,isSeriesLen:M},`sma2_${n}`);if(z===void 0||i===void 0||b===void 0)return;let c=0,O=0,s=0;for(let l=0;l<r;l++){const[q,A]=b[b.length-1-l],h=q-z,d=A-i;c+=h*d,O+=h*h,s+=d*d}return isNaN(O)||isNaN(c)||isNaN(s)?void 0:c/Math.sqrt(O*s)}cross({source1:e,source2:t},r){if(e===void 0||t===void 0)return!1;const M=this._verifyCacheData(`cross_${r}`);if(M)return M==null?void 0:M.value;const{source1:n,source2:b}=this._getCacheData(`cross_${r}`);let z=!1;return n===void 0||b===void 0?z=!1:z=n>=b&&e<t||n<=b&&e>t,this._cacheDataHandle(`cross_${r}`,{source1:e,source2:t,value:z}),z}crossover({source1:e,source2:t},r){if(e===void 0||t===void 0)return!1;const M=this._verifyCacheData(`crossover_${r}`);if(M)return M==null?void 0:M.value;const{source1:n,source2:b}=this._getCacheData(`crossover_${r}`);let z=!1;return n===void 0||b===void 0?z=!1:z=n<=b&&e>t,this._cacheDataHandle(`crossover_${r}`,{source1:e,source2:t,value:z}),z}crossunder({source1:e,source2:t},r){if(e===void 0||t===void 0)return!1;const M=this._verifyCacheData(`crossunder_${r}`);if(M)return M==null?void 0:M.value;const{source1:n,source2:b}=this._getCacheData(`crossunder_${r}`);let z=!1;return n===void 0||b===void 0?z=!1:z=n>=b&&e<t,this._cacheDataHandle(`crossunder_${r}`,{source1:e,source2:t,value:z}),z}cum({source:e=0},t){const r=this._verifyCacheData(`cum_${t}`);if(r)return r==null?void 0:r.sum;e=isNaN(e)?0:e;let{sum:M}=this._getCacheData(`cum_${t}`);return M=M||0,M+=e,this._cacheDataHandle(`cum_${t}`,{sum:M}),M}dev({source:e,length:t,isSeriesLen:r},M){if(e===void 0||isNaN(e)||t===void 0)return;const n=this.sma({source:e,length:t,isSeriesLen:r},M);let b=0;const z=this._cacheDataList(e,t,`dev_${M}`,r);if(!(!z||n===void 0)){for(let i=0;i<t;i++){const c=z[z.length-1-i];b+=Math.abs(c-n)}return b/t}}dmi({diLength:e,adxSmoothing:t},r){if(e===void 0||t===void 0)return[void 0,void 0,void 0];const M=`dmi_${r}`,n=this._verifyCacheData(M);if(n)return n==null?void 0:n.value;const{low:b,high:z,close:i,PDMS:c,NDMS:O,TRS:s,ADX:u,count:l=0}=this._getCacheData(M),{low:q,high:A,close:h}=this._variables;if(b===void 0||z===void 0||i===void 0)return this._cacheData[M]={low:q,high:A,close:h,PDMS:c,NDMS:O,TRS:A-q,count:1},[void 0,void 0,void 0];let d=A-z,m=b-q;d=d>m&&d>0?d:0,m=m>d&&m>0?m:0,d===m&&(d=m=0);const _=Math.max(A-q,Math.abs(A-i),Math.abs(q-i));let R={};if(l<e)R={low:q,high:A,close:h,PDMS:(c||0)+d,NDMS:(O||0)+m,TRS:(s||0)+_,count:l+1,value:[void 0,void 0,void 0]};else{const g=c-c/e+d,L=O-O/e+m,y=s-s/e+_,D=g/y*100,T=L/y*100,N=Math.abs((D-T)/(D+T))*100;let w=N,C=[D,T,void 0];if(l+1-e<t){const P=l+1-e;w=((u||0)*(P-1)+N)/P}else w=(u*(t-1)+N)/t,C=[D,T,w];R={low:q,high:A,close:h,PDMS:g,NDMS:L,TRS:y,ADX:w,count:l+1,value:C}}return this._cacheDataHandle(M,R),R.value}ema({source:e,length:t,isSeriesLen:r},M){if(e===void 0||t===void 0||isNaN(e))return;const n=this._verifyCacheData(`ema_${M}`);if(n)return n==null?void 0:n.sum;let{sum:b,count:z=1}=this._getCacheData(`ema_${M}`);const i=this.sma({source:e,length:t,isSeriesLen:r},M);if(z>t){const c=2/(t+1);b=b===void 0?e:c*e+(1-c)*(b||0)}else b=i;return z+=1,this._cacheDataHandle(`ema_${M}`,{sum:b,count:z}),b}falling({source:e,length:t},r){if(e===void 0||isNaN(e)||t===void 0)return!1;const M=this._verifyCacheData(`falling_${r}`);if(M)return M==null?void 0:M.value;const{source:n,fallings:b=[]}=this._getCacheData(`falling_${r}`);b.push(n>e);const z=b.slice(-t);let i=!1;return z.length<t?i=!1:i=z.every(c=>c),this._cacheDataHandle(`falling_${r}`,{source:e,fallings:z,value:i}),i}rising({source:e,length:t},r){if(e===void 0||isNaN(e)||t===void 0)return!1;const M=this._verifyCacheData(`rising_${r}`);if(M)return M==null?void 0:M.value;const{source:n,risings:b=[]}=this._getCacheData(`rising_${r}`);b.push(n<e);const z=b.slice(-t);let i=!1;return z.length<t?i=!1:i=z.every(c=>c),this._cacheDataHandle(`rising_${r}`,{source:e,risings:z,value:i}),i}highest(e,t){const{source:r,length:M,isSeriesLen:n}=e;if(M===void 0||M<=0)return;const{high:b}=this._variables,z=this._cacheDataList(e.hasOwnProperty("source")?r:b,M,`highest_${t}`,n,!0,!0);if(z!=null&&z.length)return Math.max(...z.slice(-M))}highestbars(e,t){const{source:r,length:M,isSeriesLen:n}=e;if(M===void 0||M<=0)return;const{high:b}=this._variables,z=this._cacheDataList(e.hasOwnProperty("source")?r:b,M,`highestbars_${t}`,n);return z?z.slice(-M).reduce((c,O,s,u)=>isNaN(O)||isNaN(u[c])||O>=u[c]?s:c,0)-M+1:void 0}wma({source:e,length:t,isSeriesLen:r},M){if(t===void 0||e===void 0||isNaN(e)||t<=0)return;const n=this._cacheDataList(e,t,`wma_${M}`,r);if(!n)return;let b=0,z=0;for(let i=0;i<t;i++){const c=(t-i)*t;b+=c,z+=n[n.length-1-i]*c}return z/b}hma({source:e,length:t,isSeriesLen:r},M){if(t===void 0||e===void 0||isNaN(e)||t<=0)return;const n=this.wma({source:e,length:t,isSeriesLen:r},M),b=this.wma({source:e,length:Math.round(t/2),isSeriesLen:r},`half_${M}`);return n===void 0||b===void 0?void 0:this.wma({source:2*b-n,length:Math.floor(Math.sqrt(t)),isSeriesLen:r},`hma_${M}`)}kc({series:e,length:t,mult:r,useTrueRange:M=!0,isSeriesLen:n},b){if(e===void 0||isNaN(e)||t===void 0||r===void 0)return[void 0,void 0,void 0];const z=this.ema({source:e,length:t,isSeriesLen:n},b),{ta:i,high:c,low:O}=this._variables,s=M?i.tr:c-O,u=this.ema({source:s,length:t,isSeriesLen:n},`range_${b}`);return[z,z+u*r,z-u*r]}kcw({series:e,length:t,mult:r,useTrueRange:M=!0,isSeriesLen:n},b){if(e===void 0||isNaN(e)||t===void 0||r===void 0)return;const z=this.ema({source:e,length:t,isSeriesLen:n},b),{ta:i,high:c,low:O}=this._variables,s=M?i.tr:c-O,u=this.ema({source:s,length:t,isSeriesLen:n},`range_${b}`);return(z+u*r-(z-u*r))/z}linreg({source:e,length:t,offset:r,isSeriesLen:M},n){if(t===void 0||r===void 0)return;const b=this._cacheDataList(e,t,`dev_${n}`,M);if(!b)return;const z=b.slice(-t).filter(q=>q!==void 0);let i=0,c=0,O=0,s=0;for(const[q,A]of z.entries())i+=q,c+=A,O+=q*A,s+=q*q;const u=(t*O-i*c)/(t*s-i*i);return(c-u*i)/t+u*(t-1-r)}lowest(e,t){const{source:r,length:M,isSeriesLen:n}=e;if(M===void 0||M<=0)return;const{low:b}=this._variables,z=this._cacheDataList(e.hasOwnProperty("source")?r:b,M,`lowest_${t}`,n,!0,!0);if(z!=null&&z.length)return Math.min(...z.slice(-M))}lowestbars(e,t){const{source:r,length:M,isSeriesLen:n}=e;if(M===void 0||M<=0)return;const{low:b}=this._variables,z=this._cacheDataList(e.hasOwnProperty("source")?r:b,M,`lowestbars_${t}`,n);return z?z.slice(-M).reduce((c,O,s,u)=>isNaN(O)||isNaN(u[c])||O<=u[c]?s:c,0)-M+1:void 0}macd({source:e,fastlen:t,slowlen:r,siglen:M},n){if(e===void 0||isNaN(e)||t===void 0||r===void 0||M===void 0)return[void 0,void 0,void 0];const b=this.ema({source:e,length:t},`ema1_${n}`),z=this.ema({source:e,length:r},`ema2_${n}`);if(b===void 0||z===void 0)return[void 0,void 0,void 0];const i=b-z,c=this.ema({source:i,length:M},`macd_${n}`);if(c===void 0)return[i,c,void 0];const O=i-c;return[i,c,O]}max({source:e},t){if(e===void 0||isNaN(e))return;let r=this._cacheData[`max_${t}`]||0;return e>r&&(r=e),this._cacheData[`max_${t}`]=r,r}min({source:e},t){if(e===void 0||isNaN(e))return;let r=this._cacheData[`min_${t}`]||1/0;return e<r&&(r=e),this._cacheData[`min_${t}`]=r,r}median({source:e,length:t,isSeriesLen:r},M){if(t===void 0||e===void 0||isNaN(e)||t<=0)return;const n=this._cacheDataList(e,t,`dev_${M}`,r);if(n)return Ls(n.slice(-t))}mfi({series:e,length:t},r){if(t===void 0||e===void 0||isNaN(e)||t<=0)return;const{volume:M}=this._variables,n=this.change({source:e},r),b=this._math.sum({source:M*(n>=0?0:e),length:t},`lower_${r}`),z=this._math.sum({source:M*(n<=0?0:e),length:t},`upper_${r}`);if(!(z===void 0||b===void 0))return 100-100/(1+z/b)}mode({source:e,length:t,isSeriesLen:r},M){if(t===void 0||e===void 0||isNaN(e)||t<=0)return;const n=this._cacheDataList(e,t,`mode_${M}`,r);if(n)return fp(qs(n.slice(-t)))}mom({source:e,length:t,isSeriesLen:r},M){if(t===void 0||t<0)return;const n=`mom_${M}`,b=this._cacheDataList(e,t,n,r);if(!b||b.length<=t||e===void 0||isNaN(e))return;let z=b.length-t-1,i;for(;i===void 0&&z>=0;)i=b[z],z--;return i===void 0?i:e-i}percentile_linear_interpolation({source:e,length:t,percentage:r,isSeriesLen:M},n){if(t===void 0||r===void 0||t<0||r<0||r>100)return;const b=this._cacheDataList(e,t,`percentile_linear_interpolation_${n}`,M);if(!b)return;const z=this._sort(b.slice(-t)),i=z.length;r/=100;const c=1/(i*2);if(r<=c)return z[0];if(r>=1-1/(i*2))return z[i-1];for(const[O,s]of z.entries()){const u=z[O-1];if(r<(O+.5)/i)return u===void 0||s===void 0?void 0:u+(s-u)*(r-(O-.5)/i)/(1/i)}}percentile_nearest_rank({source:e,length:t,percentage:r,isSeriesLen:M},n){if(t===void 0||r===void 0||e===void 0||isNaN(e)||t<0||r<0||r>100)return;const b=this._cacheDataList(e,t,`percentile_nearest_rank_${n}`,M);if(!b)return;const z=this._sort(b.slice(-t)),i=r/100*z.length;let c=Math.ceil(i)-1;return c=c<0?0:c,z[c>=z.length?z.length-1:c]}percentrank({source:e,length:t,isSeriesLen:r},M){if(t===void 0||t<0)return;const n=this._cacheDataList(e,t+1,`percentile_nearest_rank_${M}`,r);if(!n)return;const b=n.slice(-(t+1)),z=e;if(z===void 0)return;let i=0;for(let c=0;c<b.length;c++)b[c]!==void 0&&(b[c]<z||b[c]===z&&c<t)&&i++;return i/(b.length-1)*100}pivot_point_levels({type:e,anchor:t,developing:r},M){const n=z1(0,void 0,L0.FLOAT);let{close:b,open:z,low:i,high:c}=this._variables;const O=`pivot_point_levels_${M}`,s=this._verifyCacheData(O);if(s)return n._value=(s==null?void 0:s.result)||[],n;const{close:u,low:l,high:q,open:A,result:h}=this._getCacheData(O);if(!t&&(q&&l&&(c=Math.max(q,c),i=Math.min(l,i)),this._cacheDataHandle(O,{close:b,open:z,low:i,high:c,result:h}),!r))return n._value=h||[],n;const d={close:b,open:z,low:i,high:c};t===!0&&!r&&(b=u,z=A,i=l,c=q);const m=this._getPivotPointLevels(c,i,b,z,r,e);return this._cacheDataHandle(O,{...d,result:m}),n._value=m,n}_getPivotPointLevels(e,t,r,M,n,b){if(r===void 0||M===void 0||t===void 0||e===void 0)return[];switch(b){case kt.traditional:return this._traditional(e,t,r);case kt.fibonacci:return this._fibonacci(e,t,r);case kt.woodie:return n?[]:this._woodie(e,t);case kt.classic:return this._classic(e,t,r);case kt.dm:return this._DM(e,t,r,M);case kt.camarilla:return this._camarilla(e,t,r);default:return[]}}_traditional(e,t,r){const M=(e+t+r)/3,n=M*2-t,b=M+(e-t),z=M*2+(e-2*t),i=M*3+(e-3*t),c=M*4+(e-4*t),O=M*2-e,s=M-(e-t),u=M*2-(2*e-t),l=M*3-(3*e-t),q=M*4-(4*e-t);return[M,n,O,b,s,z,u,i,l,c,q]}_fibonacci(e,t,r){const M=(e+t+r)/3,n=M+.382*(e-t),b=M-.382*(e-t),z=M+.618*(e-t),i=M-.618*(e-t),c=M+(e-t),O=M-(e-t);return[M,n,b,z,i,c,O]}_woodie(e,t){const{open:r}=this._variables,M=(e+t+2*r)/4,n=2*M-t,b=2*M-e,z=M+(e-t),i=M-(e-t),c=e+2*(M-t),O=t-2*(e-M),s=c+(e-t),u=O-(e-t);return[M,n,b,z,i,c,O,s,u]}_classic(e,t,r){const M=(e+t+r)/3,n=2*M-t,b=2*M-e,z=M+(e-t),i=M-(e-t),c=M+2*(e-t),O=M-2*(e-t),s=M+3*(e-t),u=M-3*(e-t);return[M,n,b,z,i,c,O,s,u]}_DM(e,t,r,M){let n;M===r?n=e+t+2*r:r>M?n=2*e+t+r:n=2*t+e+r;const b=n/4,z=n/2-t,i=n/2-e;return[b,z,i]}_camarilla(e,t,r){const M=(e+t+r)/3,n=r+1.1*(e-t)/12,b=r-1.1*(e-t)/12,z=r+1.1*(e-t)/6,i=r-1.1*(e-t)/6,c=r+1.1*(e-t)/4,O=r-1.1*(e-t)/4,s=r+1.1*(e-t)/2,u=r-1.1*(e-t)/2,l=e/t*r,q=r-(l-r);return[M,n,b,z,i,c,O,s,u,l,q]}pivothigh(e,t){const{leftbars:r,rightbars:M}=e;if(r===void 0||M===void 0||r<0||M<0)return;let n=this._variables.high;e.hasOwnProperty("source")&&(n=e.source);const b=this._cacheDataList(n,r+M+1,`pivothigh_${t}`);if(!b)return;const z=b.slice(-(r+M+1)),i=z[r],c=z.splice(0,r+1),O=Math.max(...z),s=Math.max(...c);return i>=s&&i>O?i:void 0}pivotlow(e,t){const{leftbars:r,rightbars:M}=e;if(r===void 0||M===void 0||r<0||M<0)return;let n=this._variables.low;e.hasOwnProperty("source")&&(n=e.source);const b=this._cacheDataList(n,r+M+1,`pivotlow_${t}`);if(!b)return;const z=b.slice(-(r+M+1)),i=z[r],c=z.splice(0,r+1),O=Math.min(...z),s=Math.min(...c);return i<=s&&i<O?i:void 0}range({source:e,length:t},r){if(t===void 0||e===void 0||isNaN(e)||t<0)return;const M=this._cacheDataList(e,t,`range_${r}`,!0);if(!M)return;const n=M.filter(i=>i!==void 0).slice(-t),b=Math.max(...n),z=Math.min(...n);return b-z}roc({source:e,length:t,isSeriesLen:r},M){if(t===void 0||t<0)return;const n=this._cacheDataList(e,t+1,`roc_${M}`,r),b=this.change({source:e,length:t,isSeriesLen:r},M);if(n)return 100*b/n[n.length-1-t]}rsi({source:e,length:t,isSeriesLen:r},M){if(t===void 0||e===void 0||isNaN(e)||t<0)return;const n=this._verifyCacheData(`rsi_${M}`);if(n)return n==null?void 0:n.value;const{source:b}=this._getCacheData(`rsi_${M}`),z=Math.max(e-b,0),i=Math.max(b-e,0),c=this.rma({source:z,length:t,isSeriesLen:r},`rma1_${M}`),O=this.rma({source:i,length:t,isSeriesLen:r},`rma2_${M}`),s=c===void 0||O===void 0?void 0:100-100/(1+c/O);return this._cacheDataHandle(`rsi_${M}`,{source:e,value:s}),s}sar({start:e,inc:t,max:r},M){if(e===void 0||t===void 0||r===void 0)return;const n=this._verifyCacheData(`sar_${M}`);if(n)return n==null?void 0:n.result;const{close:b,low:z,high:i,preLow:c,preHigh:O,data:s={}}=this._getCacheData(`sar_${M}`);let{result:u,maxMin:l,acceleration:q,isBelow:A}=s,h=!1;const{close:d,low:m,high:_,bar_index:R}=this._variables;return R===1&&(d>b?(A=!0,l=_,u=z):(A=!1,l=m,u=i),h=!0,q=e),u=u+q*(l-u),A?u>m&&(h=!0,A=!1,u=Math.max(_,l||0),l=m,q=e):u<_&&(h=!0,A=!0,u=Math.min(m,l||0),l=_,q=e),h||(A?_>(l||0)&&(l=_,q=Math.min((q||0)+t,r)):m<(l||0)&&(l=m,q=Math.min((q||0)+t,r))),A?(u=Math.min(u,z),R>1&&(u=Math.min(u,c))):(u=Math.max(u,i),R>1&&(u=Math.max(u,O))),this._cacheDataHandle(`sar_${M}`,{high:_,close:d,low:m,preLow:z,preHigh:i,data:{...s,result:u,maxMin:l,acceleration:q,isBelow:A}}),u}stoch({source:e,high:t,low:r,length:M,isSeriesLen:n},b){if(M===void 0||t===void 0||r===void 0||e===void 0||isNaN(e)||M<0)return;const z=this.lowest({source:r,length:M,isSeriesLen:n},b),i=this.highest({source:t,length:M,isSeriesLen:n},b);if(!(z===void 0||i===void 0))return 100*(e-z)/(i-z)}supertrend({factor:e,atrPeriod:t},r){if(e===void 0||t===void 0)return[void 0,void 0];const M=`supertrend_${r}`,n=this._verifyCacheData(M);if(n)return n==null?void 0:n.value;let b=1;const{hl2:z,close:i}=this._variables,{upperBand:c,lowerBand:O,superTrend:s,atr:u,close:l}=this._getCacheData(M),q=this.atr({length:t},r);if(q===void 0)return this._cacheDataHandle(M,{close:i,value:[void 0,b]}),[void 0,b];let A=z+e*q,h=z-e*q;const d=c||0,m=O||0;h=h>m||l<m?h:m,A=A<d||l>d?A:d,u===void 0?b=1:s===d?b=i>A?-1:1:b=i<h?1:-1;const _=b===-1?h:A;return this._cacheDataHandle(M,{upperBand:A,lowerBand:h,superTrend:_,atr:q,close:i,value:[_,b]}),[_,b]}swma({source:e},t){const r=this._verifyCacheData(`swma_${t}`);if(r)return r==null?void 0:r.value;let{list:M}=this._getCacheData(`swma_${t}`);M||(M=[]),M.push(e),M=M.slice(-4);const n=M.filter(b=>b!==void 0).length<4?void 0:M[3]*1/6+M[2]*2/6+M[1]*2/6+M[0]*1/6;return this._cacheDataHandle(`swma_${t}`,{list:M,value:n}),n}tr({handle_na:e=!1},t){const{close:r,low:M,high:n}=this._variables,b=this._verifyCacheData(`tr_${t}`);if(b)return b==null?void 0:b.value;const{close:z}=this._getCacheData(`tr_${t}`);let i;return z===void 0?i=e?n-M:void 0:i=Math.max(n-M,Math.abs(n-z),Math.abs(M-z)),this._cacheDataHandle(`tr_${t}`,{close:r,value:i}),i}tsi({source:e,short_length:t,long_length:r},M){if(e===void 0||isNaN(e)||t===void 0||r===void 0)return;const n=this.change({source:e},M);if(n===void 0)return;const b=this._doubleSmooth(n,r,t,M),z=this._doubleSmooth(Math.abs(n),r,t,`abs_${M}`);if(!(z===void 0||b===void 0))return b/z}_doubleSmooth(e,t,r,M){const n=this.ema({source:e,length:t},`ema1_${M}`);return this.ema({source:n,length:r},`ema2_${M}`)}valuewhen({condition:e,source:t,occurrence:r},M){if(r===void 0||r<0)return;let{list:n}=this._getCacheData(`valuewhen_${M}`);n||(n=[]),e&&n.push(t);const b=n[n.length-1-r];return this._cacheDataHandle(`valuewhen_${M}`,{list:n,value:b}),b}variance({source:e,length:t,biased:r=!0,isSeriesLen:M},n){if(e===void 0||isNaN(e)||t===void 0||t<0)return;const b=this.sma({source:e,length:t,isSeriesLen:M},n),z=this._cacheDataList(e,t,`variance_${n}`,!0);if(!z||b===void 0)return;const i=z.filter(O=>O!==void 0&&!isNaN(O)).slice(-t);if(i.length<t)return;const c=i.reduce((O,s)=>O+Math.pow(s-b,2),0);if(c!==void 0)return r||t<=1?c/t:c/(t-1)}vwap({source:e,anchor:t,stdev_mult:r},M){if(e===void 0)return;const n=`vwap_${M}`,b=this._verifyCacheData(n);if(b)return b==null?void 0:b.value;t=t===void 0?this._timeframe.change({timeframe:"1D"},M):t;const{volume:z}=this._variables;let{sum:i=0,sumV:c=0,count:O=0,isReset:s,sumS:u=0}=this._getCacheData(n);if(t&&(i=c=O=u=0,s=!0),!s)return r!==void 0?[]:void 0;const l=e*z+i,q=z+c,A=l/q;if(O++,r!==void 0){u=z*Math.pow(e,2)+u;const h=this._computeBands(u,q,r,A);return this._cacheDataHandle(n,{sum:l,sumV:q,count:O,isReset:s,sumS:u,value:h}),h}return this._cacheDataHandle(n,{sum:l,sumV:q,count:O,isReset:s,value:A}),A}_computeBands(e,t,r,M){let n=e/t-Math.pow(M,2);n=n<0?0:n;const b=Math.sqrt(n),z=b!==void 0&&!isNaN(b)?M+r*b:void 0,i=b!==void 0&&!isNaN(b)?M-r*b:void 0;return[M,z,i]}vwma({source:e,length:t,isSeriesLen:r},M){if(e===void 0||isNaN(e)||t===void 0||t<=0)return;const{volume:n}=this._variables,b=this.sma({source:e*n,length:t,isSeriesLen:r},`sma1_${M}`),z=this.sma({source:n,length:t,isSeriesLen:r},`sma2_${M}`);if(!(b===void 0||z===void 0))return b/z}wpr({length:e,isSeriesLen:t},r){if(e===void 0||e<=0)return;const M=this.highest({length:e,isSeriesLen:t},r),n=this.lowest({length:e,isSeriesLen:t},r),{close:b}=this._variables;if(!(M===void 0||n===void 0))return(M-b)/(M-n)*-100}_sort(e){const t=[];for(const r of e){if(typeof r=="number")break;t.push(r)}return e.sort((r,M)=>r-M),t.concat(e)}_cacheDataList(e,t,r,M=!1,n=!0,b=!1){const z=this._cacheData[r]||{barIndex:-1,list:[],length:t},{bar_index:i}=this._variables;if(z.length<t&&(z.length=t),z.barIndex<=i&&!(isNaN(e)&&b)){const c=z.list.length;z.barIndex===i?z.list[c-1]=e:z.list.push(e),z.barIndex=i,z.list.length>z.length+5&&!M&&z.list.shift(),this._cacheData[r]=z}if(!(z.list.length<t&&n))return z.list}_getCacheData(e){const{bar_index:t}=this._variables,r=this._cacheData[e]||{};return r.barIndex===t?r.preCacheData||{}:r}_cacheDataHandle(e,t){const{bar_index:r,_isRealTimeBar:M,_isRepeated:n}=this._variables;if(!M&&!n){let b=this._cacheData[e]||{};b.barIndex===r&&(b=b.preCacheData),this._cacheData[e]=Object.assign(t,{barIndex:r,preCacheData:{...b,preCacheData:void 0}})}}_verifyCacheData(e){const{bar_index:t,_isRepeated:r}=this._variables,M=this._cacheData[e]||{},{barIndex:n}=M;if(n===t&&r)return M}}class P6{constructor(e,t,r){E(this,"_cacheData");E(this,"_variables");E(this,"_errorListener");E(this,"_historyInputs");E(this,"_name");E(this,"_newCacheData",{});this._cacheData={},this._variables=e,this._errorListener=t,this._name=`inputs_${r}`,this._historyInputs=self.workerStorage.get(this._name)||{}}get _inputCacheData(){return this._cacheData}set _inputCacheData(e){this._cacheData=e}update(e){if(!(e!=null&&e.length)){self.workerStorage.delete(this._name),this._cacheData={};return}for(const t of e){const r=t.id,M=this._historyInputs[r];(!(t!=null&&t.sourceTypeName)&&(M==null?void 0:M.defval)!==t.defval||M!=null&&M.sourceTypeName&&t.sourceTypeName!==(M==null?void 0:M.sourceTypeName))&&(this._cacheData[r]=Object.assign(this._cacheData[r]||{},{...t,isModify:!0}))}}input(e,t){return this._cacheHandle(e,t)}int(e,t){return this._verifyMaxOrMin(e,t),this._cacheHandle(e,t,N2.INT)}bool(e,t){return this._cacheHandle(e,t,N2.BOOL)}color(e,t){return this._cacheHandle(e,t,N2.COLOR)}time(e,t){return this._cacheHandle(e,t,N2.TIME)}float(e,t){return this._verifyMaxOrMin(e,t),this._cacheHandle(e,t,N2.FLOAT)}price(e,t){return this._cacheHandle(e,t,N2.PRICE)}source(e,t){return this._cacheHandle(e,t,N2.SOURCE)}string(e,t){return this._cacheHandle(e,t,N2.STRING)}symbol(e,t){return this._cacheHandle(e,t,N2.SYMBOL)}session(e,t){return this._cacheHandle(e,t,N2.SESSION)}text_area(e,t){return this._cacheHandle(e,t,N2.TEXT_AREA)}timeframe(e,t){return this._cacheHandle(e,t,N2.TIMEFRAME)}enum(e,t){return this._cacheHandle(e,t,N2.ENUM)}_cacheHandle(e,t,r){if(t.startsWith("export"))return e.defval;const M=`${r||"input"}_${t}`,n=this._newCacheData[M]||this._cacheData[M];if(this._variables.bar_index&&n)return n.sourceTypeName&&(n.defval=this._variables[n.sourceTypeName]),n.defval;if(e.defval===void 0&&this._errorListener.addError(N1.inputDefvalErr,t,J0.Error),n)if(!n.isModify)Object.assign(this._newCacheData[M],e);else{this._newCacheData[M]=n;const b=this._historyInputs[M];!(e.sourceTypeName||b!=null&&b.sourceTypeName)&&e.defval===(b==null?void 0:b.defval)||e.sourceTypeName&&(b==null?void 0:b.sourceTypeName)===e.sourceTypeName?n.sourceTypeName&&(this._newCacheData[M].defval=this._variables[n.sourceTypeName]):Object.assign(this._newCacheData[M],e)}else{const{defval:b,display:z}=e;if(this._displayVerify(t,z),e={inputType:r,...e},this._newCacheData[M]=e,(r||e.inputType)===N2.SOURCE)this._newCacheData[M].options=Ai;else if(e.options)if(!e.options.includes(b))this._errorListener.addError(l2(N1.inputOptErr,{defval:String(b),args:e.options.toString()}),t,J0.Error,6+((r==null?void 0:r.length)||-1));else{const i=new Map;for(const c of e.options){if(i.has(c)){this._errorListener.addError(l2(N1.optionsRepeatErr,{option:String(c)}),t,J0.Error,6+((r==null?void 0:r.length)||-1));break}i.set(c,c)}}}return self.workerStorage.setValue(this._name,M,{...e}),this._newCacheData[M].defval}_displayVerify(e,t){!t||!t.length||t.includes(le.dataWindow)||t.includes(le.statusLine)||this._errorListener.addError(l2(N1.displayErr,{func:"input",values:"[display.none, display.data_window, display.status_line, display.all]"}),e,J0.Error)}_verifyMaxOrMin(e,t){const{defval:r,maxval:M,minval:n}=e;typeof r=="number"&&(M!==void 0&&r>M||n!==void 0&&r<n)&&this._errorListener.addError(N1.minOrMaxErr,t,J0.Error)}getInputs(){const e=Object.keys(this._newCacheData),t=[];for(const r of e){const M=this._newCacheData[r];M.id=r,t.push(M)}return this._cacheData=this._newCacheData,t.sort((r,M)=>(r.index||0)-(M.index||0))}}class k6{color({x:e}){return e===void 0?null:e}new({color:e,transp:t=100}){u0(t)&&(t=100);let r=(100-Math.round(t))/100;r=r<0?0:r>1?1:r;const{r:M,g:n,b}=this._parseColor(e||"");return`rgba(${Math.round(M)}, ${Math.round(n)}, ${Math.round(b)}, ${r})`}rgb({red:e=0,green:t=0,blue:r=0,transp:M=0}){return u0(M)&&(M=0),u0(e)&&(e=0),u0(t)&&(t=0),u0(r)&&(r=0),`rgba(${Math.round(e)}, ${Math.round(t)}, ${Math.round(r)}, ${(100-Math.round(M))/100})`}g({color:e}){return e?this._parseColor(e).g:0}r({color:e}){return e?this._parseColor(e).r:0}b({color:e}){return e?this._parseColor(e).b:0}t({color:e}){return e?100-Math.round(this._parseColor(e).a*100):0}from_gradient({value:e,bottom_value:t,top_value:r,bottom_color:M,top_color:n}){if(u0(e)||u0(t)||u0(r)||r===t)return"rgba(0,0,0,1)";const b=(e-t)/(r-t),z=Math.min(Math.max(b,0),1);if(!M&&!n)return"rgba(0,0,0,0)";let{r:i,g:c,b:O,a:s}=M?this._parseColor(M):{},{r:u,g:l,b:q,a:A}=n?this._parseColor(n):{};M?n||(u=i,l=c,q=O,A=0):(i=u,c=l,O=q,s=0);const h=i+z*(u-i),d=c+z*(l-c),m=O+z*(q-O),_=s+z*(A-s);return`rgba(${Math.round(h)}, ${Math.round(d)}, ${Math.round(m)}, ${_.toFixed(2)})`}_parseColor(e){let t,r,M,n;if(e.startsWith("#")){t=parseInt(e.substring(1,3),16),r=parseInt(e.substring(3,5),16),M=parseInt(e.substring(5,7),16);const b=e.substring(7);b?n=parseInt(b,16)/255:n=1}else{const b=this._parserRgbColor(e);t=b[0]||0,r=b[1]||0,M=b[2]||0,n=b[3],n=n===void 0?1:n}return{r:t,g:r,b:M,a:n}}_parserRgbColor(e){var t;return((t=e.match(/[\d.]+/g))==null?void 0:t.map(Number))||[]}}var r1={};const $6=Object.prototype.toString;function WM(o){const e=$6.call(o);return e.endsWith("Array]")&&!e.includes("Big")}var U6=Object.freeze({__proto__:null,isAnyArray:WM}),j6=Y1(U6);function H6(o){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!WM(o))throw new TypeError("input must be an array");if(o.length===0)throw new TypeError("input must not be empty");var t=e.fromIndex,r=t===void 0?0:t,M=e.toIndex,n=M===void 0?o.length:M;if(r<0||r>=o.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(n<=r||n>o.length||!Number.isInteger(n))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var b=o[r],z=r+1;z<n;z++)o[z]>b&&(b=o[z]);return b}function Y6(o){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!WM(o))throw new TypeError("input must be an array");if(o.length===0)throw new TypeError("input must not be empty");var t=e.fromIndex,r=t===void 0?0:t,M=e.toIndex,n=M===void 0?o.length:M;if(r<0||r>=o.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(n<=r||n>o.length||!Number.isInteger(n))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var b=o[r],z=r+1;z<n;z++)o[z]<b&&(b=o[z]);return b}function G6(o){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(WM(o)){if(o.length===0)throw new TypeError("input must not be empty")}else throw new TypeError("input must be an array");var t;if(e.output!==void 0){if(!WM(e.output))throw new TypeError("output option must be an array if specified");t=e.output}else t=new Array(o.length);var r=Y6(o),M=H6(o);if(r===M)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var n=e.min,b=n===void 0?e.autoMinMax?r:0:n,z=e.max,i=z===void 0?e.autoMinMax?M:1:z;if(b>=i)throw new RangeError("min option must be smaller than max option");for(var c=(i-b)/(M-r),O=0;O<o.length;O++)t[O]=(o[O]-r)*c+b;return t}var V6=Object.freeze({__proto__:null,default:G6}),K6=Y1(V6);Object.defineProperty(r1,"__esModule",{value:!0});var C2=j6,Ns=K6;const Ho=" ".repeat(2),ys=" ".repeat(4);function J6(){return Bs(this)}function Bs(o,e={}){const{maxRows:t=15,maxColumns:r=10,maxNumSize:M=8,padMinus:n="auto"}=e;return`${o.constructor.name} {
69
69
  ${Ho}[
70
70
  ${ys}${Q6(o,t,r,M,n)}
71
71
  ${Ho}]
@@ -71,15 +71,15 @@ export default class BuildInTa {
71
71
  ema({ source, length, isSeriesLen }: ITaArgs, posStr: string): any;
72
72
  falling({ source, length }: ITaArgs, posStr: string): any;
73
73
  rising({ source, length }: ITaArgs, posStr: string): any;
74
- highest({ source, length, isSeriesLen }: ITaArgs, posStr: string): number | undefined;
75
- highestbars({ source, length, isSeriesLen }: ITaArgs, posStr: string): number | undefined;
74
+ highest(args: ITaArgs, posStr: string): number | undefined;
75
+ highestbars(args: ITaArgs, posStr: string): number | undefined;
76
76
  wma({ source, length, isSeriesLen }: ITaArgs, posStr: string): number | undefined;
77
77
  hma({ source, length, isSeriesLen }: ITaArgs, posStr: string): number | undefined;
78
78
  kc({ series, length, mult, useTrueRange, isSeriesLen }: ITaArgs, posStr: string): any[];
79
79
  kcw({ series, length, mult, useTrueRange, isSeriesLen }: ITaArgs, posStr: string): number | undefined;
80
80
  linreg({ source, length, offset, isSeriesLen }: ITaArgs, posStr: string): number | undefined;
81
- lowest({ source, length, isSeriesLen }: ITaArgs, posStr: string): number | undefined;
82
- lowestbars({ source, length, isSeriesLen }: ITaArgs, posStr: string): number | undefined;
81
+ lowest(args: ITaArgs, posStr: string): number | undefined;
82
+ lowestbars(args: ITaArgs, posStr: string): number | undefined;
83
83
  macd({ source, fastlen, slowlen, siglen }: ITaArgs, posStr: string): any[];
84
84
  max({ source }: ITaArgs, posStr: string): any;
85
85
  min({ source }: ITaArgs, posStr: string): any;
@@ -69555,7 +69555,7 @@ function xr(a, s, r) {
69555
69555
  function Lw() {
69556
69556
  return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
69557
69557
  }
69558
- const Nd = new Worker(new URL("" + new URL("assets/scriptsRunWorker-C0Vbn0MB.js", import.meta.url).href, import.meta.url), { type: "module", name: "Run TccScript Server" });
69558
+ const Nd = new Worker(new URL("" + new URL("assets/scriptsRunWorker-COXrDXBU.js", import.meta.url).href, import.meta.url), { type: "module", name: "Run TccScript Server" });
69559
69559
  Nd.onerror = (a) => {
69560
69560
  console.error(a);
69561
69561
  };
@@ -141,7 +141,7 @@ function print() { __p += __j.call(arguments, '') }
141
141
  * @license
142
142
  * Copyright 2019 Google LLC
143
143
  * SPDX-License-Identifier: Apache-2.0
144
- */const rl=Symbol("Comlink.proxy"),qm=Symbol("Comlink.endpoint"),Cm=Symbol("Comlink.releaseProxy"),Un=Symbol("Comlink.finalizer"),xa=Symbol("Comlink.thrown"),al=a=>typeof a=="object"&&a!==null||typeof a=="function",Sm={canHandle:a=>al(a)&&a[rl],serialize(a){const{port1:s,port2:r}=new MessageChannel;return il(a,s),[r,[r]]},deserialize(a){return a.start(),$n(a)}},zm={canHandle:a=>al(a)&&xa in a,serialize({value:a}){let s;return a instanceof Error?s={isError:!0,value:{message:a.message,name:a.name,stack:a.stack}}:s={isError:!1,value:a},[s,[]]},deserialize(a){throw a.isError?Object.assign(new Error(a.value.message),a.value):a.value}},nl=new Map([["proxy",Sm],["throw",zm]]);function Nm(a,s){for(const r of a)if(s===r||r==="*"||r instanceof RegExp&&r.test(s))return!0;return!1}function il(a,s=globalThis,r=["*"]){s.addEventListener("message",function n(o){if(!o||!o.data)return;if(!Nm(r,o.origin)){console.warn(`Invalid origin '${o.origin}' for comlink proxy`);return}const{id:l,type:c,path:u}=Object.assign({path:[]},o.data),m=(o.data.argumentList||[]).map(As);let _;try{const g=u.slice(0,-1).reduce((h,D)=>h[D],a),x=u.reduce((h,D)=>h[D],a);switch(c){case"GET":_=x;break;case"SET":g[u.slice(-1)[0]]=As(o.data.value),_=!0;break;case"APPLY":_=x.apply(g,m);break;case"CONSTRUCT":{const h=new x(...m);_=jn(h)}break;case"ENDPOINT":{const{port1:h,port2:D}=new MessageChannel;il(a,D),_=Pm(h,[h])}break;case"RELEASE":_=void 0;break;default:return}}catch(g){_={value:g,[xa]:0}}Promise.resolve(_).catch(g=>({value:g,[xa]:0})).then(g=>{const[x,h]=Ta(g);s.postMessage(Object.assign(Object.assign({},x),{id:l}),h),c==="RELEASE"&&(s.removeEventListener("message",n),ol(s),Un in a&&typeof a[Un]=="function"&&a[Un]())}).catch(g=>{const[x,h]=Ta({value:new TypeError("Unserializable return value"),[xa]:0});s.postMessage(Object.assign(Object.assign({},x),{id:l}),h)})}),s.start&&s.start()}function Em(a){return a.constructor.name==="MessagePort"}function ol(a){Em(a)&&a.close()}function $n(a,s){return Kn(a,[],s)}function ha(a){if(a)throw new Error("Proxy has been released and is not useable")}function ll(a){return Ws(a,{type:"RELEASE"}).then(()=>{ol(a)})}const wa=new WeakMap,va="FinalizationRegistry"in globalThis&&new FinalizationRegistry(a=>{const s=(wa.get(a)||0)-1;wa.set(a,s),s===0&&ll(a)});function Lm(a,s){const r=(wa.get(s)||0)+1;wa.set(s,r),va&&va.register(a,s,a)}function Mm(a){va&&va.unregister(a)}function Kn(a,s=[],r=function(){}){let n=!1;const o=new Proxy(r,{get(l,c){if(ha(n),c===Cm)return()=>{Mm(o),ll(a),n=!0};if(c==="then"){if(s.length===0)return{then:()=>o};const u=Ws(a,{type:"GET",path:s.map(m=>m.toString())}).then(As);return u.then.bind(u)}return Kn(a,[...s,c])},set(l,c,u){ha(n);const[m,_]=Ta(u);return Ws(a,{type:"SET",path:[...s,c].map(g=>g.toString()),value:m},_).then(As)},apply(l,c,u){ha(n);const m=s[s.length-1];if(m===qm)return Ws(a,{type:"ENDPOINT"}).then(As);if(m==="bind")return Kn(a,s.slice(0,-1));const[_,g]=cl(u);return Ws(a,{type:"APPLY",path:s.map(x=>x.toString()),argumentList:_},g).then(As)},construct(l,c){ha(n);const[u,m]=cl(c);return Ws(a,{type:"CONSTRUCT",path:s.map(_=>_.toString()),argumentList:u},m).then(As)}});return Lm(o,a),o}function Om(a){return Array.prototype.concat.apply([],a)}function cl(a){const s=a.map(Ta);return[s.map(r=>r[0]),Om(s.map(r=>r[1]))]}const pl=new WeakMap;function Pm(a,s){return pl.set(a,s),a}function jn(a){return Object.assign(a,{[rl]:!0})}function Ta(a){for(const[s,r]of nl)if(r.canHandle(a)){const[n,o]=r.serialize(a);return[{type:"HANDLER",name:s,value:n},o]}return[{type:"RAW",value:a},pl.get(a)||[]]}function As(a){switch(a.type){case"HANDLER":return nl.get(a.name).deserialize(a.value);case"RAW":return a.value}}function Ws(a,s,r){return new Promise(n=>{const o=Rm();a.addEventListener("message",function l(c){!c.data||!c.data.id||c.data.id!==o||(a.removeEventListener("message",l),n(c.data))}),a.start&&a.start(),a.postMessage(Object.assign({id:o},s),r)})}function Rm(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const dl=new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/scriptsRunWorker-C0Vbn0MB.js").href:new URL("assets/scriptsRunWorker-C0Vbn0MB.js",typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||document.baseURI).href),typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:aa&&aa.src||new URL("trading-vue-editor.umd.packages.mjs",document.baseURI).href),{type:"module",name:"Run TccScript Server"});dl.onerror=a=>{console.error(a)};async function ul(a){return await fa.setInlayHints(a)}const ml=$n(dl),yl=$n(new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/parserTccWorker-4IWywR7k.js").href:new URL("assets/parserTccWorker-4IWywR7k.js",typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||document.baseURI).href),typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:aa&&aa.src||new URL("trading-vue-editor.umd.packages.mjs",document.baseURI).href),{type:"module",name:"Parser TccScript Server"}));async function _l(a,s=!1){const{functions:r,types:n,constants:o,variables:l,methods:c}=nt;return await yl.parseTcc(a,s,jn(ul),{functions:Object.fromEntries(r),methods:Object.fromEntries(c),types:Object.fromEntries(n),constants:Object.fromEntries(o),variables:Object.fromEntries(l)})}async function Fm(a,s){const{functions:r,types:n,constants:o,variables:l,methods:c}=nt;return await yl.parseLibraryCode(a,s,jn(ul),{functions:Object.fromEntries(r),methods:Object.fromEntries(c),types:Object.fromEntries(n),constants:Object.fromEntries(o),variables:Object.fromEntries(l)})}async function Bm(a,s,r=!0){return await ml.runScript(a,s,r)}async function Um(a){return await ml.removeScript(a)}function $m(a){return new Worker(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/editor.worker-CT5Cb1wO.js").href:new URL("assets/editor.worker-CT5Cb1wO.js",typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||document.baseURI).href),{name:a==null?void 0:a.name})}const{slice:Km,forEach:jm}=[];function Hm(a){return jm.call(Km.call(arguments,1),s=>{if(s)for(const r in s)a[r]===void 0&&(a[r]=s[r])}),a}const fl=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Wm=(a,s,r)=>{const n=r||{};n.path=n.path||"/";const o=encodeURIComponent(s);let l=`${a}=${o}`;if(n.maxAge>0){const c=n.maxAge-0;if(Number.isNaN(c))throw new Error("maxAge should be a Number");l+=`; Max-Age=${Math.floor(c)}`}if(n.domain){if(!fl.test(n.domain))throw new TypeError("option domain is invalid");l+=`; Domain=${n.domain}`}if(n.path){if(!fl.test(n.path))throw new TypeError("option path is invalid");l+=`; Path=${n.path}`}if(n.expires){if(typeof n.expires.toUTCString!="function")throw new TypeError("option expires is invalid");l+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(l+="; HttpOnly"),n.secure&&(l+="; Secure"),n.sameSite)switch(typeof n.sameSite=="string"?n.sameSite.toLowerCase():n.sameSite){case!0:l+="; SameSite=Strict";break;case"lax":l+="; SameSite=Lax";break;case"strict":l+="; SameSite=Strict";break;case"none":l+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return l},gl={create(a,s,r,n){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(o.expires=new Date,o.expires.setTime(o.expires.getTime()+r*60*1e3)),n&&(o.domain=n),document.cookie=Wm(a,encodeURIComponent(s),o)},read(a){const s=`${a}=`,r=document.cookie.split(";");for(let n=0;n<r.length;n++){let o=r[n];for(;o.charAt(0)===" ";)o=o.substring(1,o.length);if(o.indexOf(s)===0)return o.substring(s.length,o.length)}return null},remove(a){this.create(a,"",-1)}};var Vm={name:"cookie",lookup(a){let{lookupCookie:s}=a;if(s&&typeof document<"u")return gl.read(s)||void 0},cacheUserLanguage(a,s){let{lookupCookie:r,cookieMinutes:n,cookieDomain:o,cookieOptions:l}=s;r&&typeof document<"u"&&gl.create(r,a,n,o,l)}},Gm={name:"querystring",lookup(a){var n;let{lookupQuerystring:s}=a,r;if(typeof window<"u"){let{search:o}=window.location;!window.location.search&&((n=window.location.hash)==null?void 0:n.indexOf("?"))>-1&&(o=window.location.hash.substring(window.location.hash.indexOf("?")));const c=o.substring(1).split("&");for(let u=0;u<c.length;u++){const m=c[u].indexOf("=");m>0&&c[u].substring(0,m)===s&&(r=c[u].substring(m+1))}}return r}};let Sr=null;const bl=()=>{if(Sr!==null)return Sr;try{Sr=window!=="undefined"&&window.localStorage!==null;const a="i18next.translate.boo";window.localStorage.setItem(a,"foo"),window.localStorage.removeItem(a)}catch{Sr=!1}return Sr};var Xm={name:"localStorage",lookup(a){let{lookupLocalStorage:s}=a;if(s&&bl())return window.localStorage.getItem(s)||void 0},cacheUserLanguage(a,s){let{lookupLocalStorage:r}=s;r&&bl()&&window.localStorage.setItem(r,a)}};let zr=null;const xl=()=>{if(zr!==null)return zr;try{zr=window!=="undefined"&&window.sessionStorage!==null;const a="i18next.translate.boo";window.sessionStorage.setItem(a,"foo"),window.sessionStorage.removeItem(a)}catch{zr=!1}return zr};var Ym={name:"sessionStorage",lookup(a){let{lookupSessionStorage:s}=a;if(s&&xl())return window.sessionStorage.getItem(s)||void 0},cacheUserLanguage(a,s){let{lookupSessionStorage:r}=s;r&&xl()&&window.sessionStorage.setItem(r,a)}},Qm={name:"navigator",lookup(a){const s=[];if(typeof navigator<"u"){const{languages:r,userLanguage:n,language:o}=navigator;if(r)for(let l=0;l<r.length;l++)s.push(r[l]);n&&s.push(n),o&&s.push(o)}return s.length>0?s:void 0}},Zm={name:"htmlTag",lookup(a){let{htmlTag:s}=a,r;const n=s||(typeof document<"u"?document.documentElement:null);return n&&typeof n.getAttribute=="function"&&(r=n.getAttribute("lang")),r}},Jm={name:"path",lookup(a){var o;let{lookupFromPathIndex:s}=a;if(typeof window>"u")return;const r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(r)?(o=r[typeof s=="number"?s:0])==null?void 0:o.replace("/",""):void 0}},ey={name:"subdomain",lookup(a){var o,l;let{lookupFromSubdomainIndex:s}=a;const r=typeof s=="number"?s+1:1,n=typeof window<"u"&&((l=(o=window.location)==null?void 0:o.hostname)==null?void 0:l.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(n)return n[r]}};function ty(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:a=>a}}class hl{constructor(s){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(s,r)}init(s){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=s||{languageUtils:{}},this.options=Hm(r,this.options||{},ty()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=o=>o.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(Vm),this.addDetector(Gm),this.addDetector(Xm),this.addDetector(Ym),this.addDetector(Qm),this.addDetector(Zm),this.addDetector(Jm),this.addDetector(ey)}addDetector(s){return this.detectors[s.name]=s,this}detect(s){s||(s=this.options.order);let r=[];return s.forEach(n=>{if(this.detectors[n]){let o=this.detectors[n].lookup(this.options);o&&typeof o=="string"&&(o=[o]),o&&(r=r.concat(o))}}),r=r.map(n=>this.options.convertDetectedLanguage(n)),this.services.languageUtils.getBestMatchFromCodes?r:r.length>0?r[0]:null}cacheUserLanguage(s,r){r||(r=this.options.caches),r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(s)>-1||r.forEach(n=>{this.detectors[n]&&this.detectors[n].cacheUserLanguage(s,this.options)}))}}hl.type="languageDetector";const sy=(...a)=>{console!=null&&console.warn&&(qs(a[0])&&(a[0]=`react-i18next:: ${a[0]}`),console.warn(...a))},wl={},Hn=(...a)=>{qs(a[0])&&wl[a[0]]||(qs(a[0])&&(wl[a[0]]=new Date),sy(...a))},vl=(a,s)=>()=>{if(a.isInitialized)s();else{const r=()=>{setTimeout(()=>{a.off("initialized",r)},0),s()};a.on("initialized",r)}},Wn=(a,s,r)=>{a.loadNamespaces(s,vl(a,r))},Tl=(a,s,r,n)=>{if(qs(r)&&(r=[r]),a.options.preload&&a.options.preload.indexOf(s)>-1)return Wn(a,r,n);r.forEach(o=>{a.options.ns.indexOf(o)<0&&a.options.ns.push(o)}),a.loadLanguages(s,vl(a,n))},ry=(a,s,r={})=>!s.languages||!s.languages.length?(Hn("i18n.languages were undefined or empty",s.languages),!0):s.hasLoadedNamespace(a,{lng:r.lng,precheck:(n,o)=>{var l;if(((l=r.bindI18n)==null?void 0:l.indexOf("languageChanging"))>-1&&n.services.backendConnector.backend&&n.isLanguageChangingTo&&!o(n.isLanguageChangingTo,a))return!1}}),qs=a=>typeof a=="string",ay=a=>typeof a=="object"&&a!==null,ny=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,iy={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},oy=a=>iy[a];let Vn={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:a=>a.replace(ny,oy)};const ly=(a={})=>{Vn={...Vn,...a}},cy=()=>Vn;let kl;const py=a=>{kl=a},dy=()=>kl,uy={type:"3rdParty",init(a){ly(a.options.react),py(a)}},my=N.createContext();class yy{constructor(){this.usedNamespaces={}}addUsedNamespaces(s){s.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const _y=(a,s)=>{const r=N.useRef();return N.useEffect(()=>{r.current=s?r.current:a},[a,s]),r.current},Dl=(a,s,r,n)=>a.getFixedT(s,r,n),fy=(a,s,r,n)=>N.useCallback(Dl(a,s,r,n),[a,s,r,n]),Vs=(a,s={})=>{var W,Q,C,z;const{i18n:r}=s,{i18n:n,defaultNS:o}=N.useContext(my)||{},l=r||n||dy();if(l&&!l.reportNamespaces&&(l.reportNamespaces=new yy),!l){Hn("You will need to pass in an i18next instance by using initReactI18next");const V=(A,L)=>qs(L)?L:ay(L)&&qs(L.defaultValue)?L.defaultValue:Array.isArray(A)?A[A.length-1]:A,q=[V,{},!1];return q.t=V,q.i18n={},q.ready=!1,q}(W=l.options.react)!=null&&W.wait&&Hn("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const c={...cy(),...l.options.react,...s},{useSuspense:u,keyPrefix:m}=c;let _=a||o||((Q=l.options)==null?void 0:Q.defaultNS);_=qs(_)?[_]:_||["translation"],(z=(C=l.reportNamespaces).addUsedNamespaces)==null||z.call(C,_);const g=(l.isInitialized||l.initializedStoreOnce)&&_.every(V=>ry(V,l,c)),x=fy(l,s.lng||null,c.nsMode==="fallback"?_:_[0],m),h=()=>x,D=()=>Dl(l,s.lng||null,c.nsMode==="fallback"?_:_[0],m),[S,R]=N.useState(h);let U=_.join();s.lng&&(U=`${s.lng}${U}`);const K=_y(U),H=N.useRef(!0);N.useEffect(()=>{const{bindI18n:V,bindI18nStore:q}=c;H.current=!0,!g&&!u&&(s.lng?Tl(l,s.lng,_,()=>{H.current&&R(D)}):Wn(l,_,()=>{H.current&&R(D)})),g&&K&&K!==U&&H.current&&R(D);const A=()=>{H.current&&R(D)};return V&&(l==null||l.on(V,A)),q&&(l==null||l.store.on(q,A)),()=>{H.current=!1,l&&(V==null||V.split(" ").forEach(L=>l.off(L,A))),q&&l&&q.split(" ").forEach(L=>l.store.off(L,A))}},[l,U]),N.useEffect(()=>{H.current&&g&&R(h)},[l,m,g]);const re=[S,l,g];if(re.t=S,re.i18n=l,re.ready=g,g||!g&&!u)return re;throw new Promise(V=>{s.lng?Tl(l,s.lng,_,()=>V()):Wn(l,_,()=>V())})},gy={type:"type",syntax:"syntax",overloads:"overloads",arguments:"arguments",fields:"fields",example:"example",returns:"returns",remarks:"remarks","see also":"see also","Copy code":"Copy code","Copy link":"Copy link",Copied:"Copied","Link copied":"Link copied",variables:"Variables",constants:"Constants",functions:"Functions",keywords:"Keywords",types:"Types",operators:"Operators",annotations:"Annotations",search:"Search","Mine Script® v1 Reference Manual":"Mine Script® v1 Reference Manual","This script is read-only. It cannot be edited.":"This script is read-only. It cannot be edited.","save script":"Save script","open script":"Open script","find/replace":"Find/Replace","toggle console":"Toggle console","open editor in new tab":"Open editor in new tab","open editor in new window":"Open editor in new window",keyword:"keyword","built-in function":"built-in function","built-in variable":"built-in variable","built-in method":"built-in method","built-in type":"built-in type",annotation:"annotation","built-in constant":"built-in constant",namespace:"namespace","user-defined variable":"user-defined variable","user-defined type":"user-defined type",field:"field",enum:"enum","user-defined method":"user-defined method","user-defined function":"user-defined function",parameter:"parameter","**Namespaces** are immutable terms that act as prefixes for groups of identifiers. A dot and another term always follow a namespace when naming Tcc functions, variables, and methods.":"**Namespaces** are immutable terms that act as prefixes for groups of identifiers. A dot and another term always follow a namespace when naming Mine functions, variables, and methods.","to trigger parameters hint":"to trigger parameters hint",library:"library","enum member":"enum member",Returns:"Returns",Syntax:"Syntax",Remarks:"Remarks",Fields:"Fields",Description:"Description",Example:"Example","Enum members":"Enum members",statement:"statement",loop:"loop","`click` on keyword for more help":"`click` on keyword for more help"},by={type:"类型",syntax:"语法",overloads:"重载",arguments:"参数",fields:"字段",example:"例子",returns:"返回值",remarks:"备注","see also":"另见","Copy code":"复制代码","Copy link":"复制链接",Copied:"已复制","Link copied":"链接已复制",variables:"内置变量",constants:"常量",functions:"函数",keywords:"关键词",types:"类型",operators:"运算符",annotations:"注释",search:"搜索","Mine Script® v1 Reference Manual":"Mine Script™ v1参考手册","This script is read-only. It cannot be edited.":"该脚本是只读的。它无法被编辑。","save script":"保存脚本","open script":"打开脚本","find/replace":"寻找/替换","toggle console":"切换控制台","open editor in new tab":"在新标签页中打开","open editor in new window":"在新窗口中打开",keyword:"关键词","built-in function":"内置函数","built-in variable":"内置变量","built-in method":"内置方法","built-in type":"内置类型",annotation:"注释","built-in constant":"内置常量",namespace:"命名空间","user-defined variable":"用户自定义变量","user-defined type":"用户自定义类型",field:"字段",enum:"枚举","user-defined method":"用户自定义方法","user-defined function":"用户自定义函数",parameter:"参数","**Namespaces** are immutable terms that act as prefixes for groups of identifiers. A dot and another term always follow a namespace when naming Tcc functions, variables, and methods.":"命名空间是不可变的术语,充当标识符组的前缀。在命名Mine函数、变量和方法时,点和另一个术语始终遵循命名空间。","to trigger parameters hint":"触发参数提示",library:"脚本库","enum member":"枚举成员",Returns:"返回值",Syntax:"语法",Remarks:"备注",Fields:"字段",Description:"描述",Example:"例子","Enum members":"枚举成员",statement:"声明",loop:"循环","`click` on keyword for more help":"“点击”关键词以获得更多帮助"};Me.use(hl).use(uy).init({debug:!1,fallbackLng:"zh",interpolation:{escapeValue:!1},resources:{en:{translation:gy},zh:{translation:by}}}),self.MonacoEnvironment={getWorker(){return new $m({name:"Editor Worker"})}},An.config({paths:{vs:"https://my.tradingvue.com/vs"},"vs/nls":{availableLanguages:{"*":"zh-cn"}}});const xy=(a,s)=>{const{height:r,width:n,theme:o,options:l,hasDiff:c,readOnly:u,defaultValue:m,language:_,onChange:g,onLinkOpen:x,onCursorPositionChange:h,onActionTrigger:D,onEditorDidMount:S}=a,{t:R,i18n:U}=Vs(),K=N.useRef(null),H=N.useRef(null),re=N.useRef(!1),W=N.useRef(!1);N.useImperativeHandle(s,()=>({setOriginalScript(A){var L;(L=K.current)==null||L.setOriginalScript(A)},setScript(A){var L;(L=K.current)==null||L.setValue(A)},gotoLine(){var A;(A=K.current)==null||A.gotoLine()},getEditorLayout(){var A;return(A=K.current)==null?void 0:A.getEditorLayout()},setPosition(A,L){var Z;(Z=K.current)==null||Z.setPosition({column:A,lineNumber:L})},setModelMarkers(A){var L;W.current=!0,(L=K.current)==null||L.setModelMarkers(A),setTimeout(()=>{W.current=!1},2e3)},focus(){var A;(A=K.current)==null||A.focus()}})),N.useEffect(()=>{var A,L;c?(L=K.current)==null||L.addDiffDecorations():(A=K.current)==null||A.removeDiffDecorations()},[c]),N.useEffect(()=>{o&&Ne.editor.setTheme(o)},[o]),N.useEffect(()=>{_&&U.changeLanguage(_)},[_]),N.useEffect(()=>{var A;(A=K.current)==null||A.updateActionTrigger(D)},[D]),N.useEffect(()=>{var A;x&&((A=K.current)==null||A.addLinkOpenFunc(x))},[x]);function Q(A,L){var ee,ne;Pt.initBuiltinsTrees(),fa.setEditor(A),K.current=new Am(A,L,D),x&&((ee=K.current)==null||ee.addLinkOpenFunc(x)),c&&((ne=K.current)==null||ne.addDiffDecorations()),Yu(A),requestAnimationFrame(q);const Z=A.getValue();K.current.onChangeCursorPosition(h),g&&g(Z),!u&&C(Z),S&&S()}const C=N.useCallback(async A=>{var Rt;re.current=!1;const{errors:L,functions:Z,methods:ee,types:ne,variables:Y,overloadsFuncs:le,imports:xe,enums:pe}=await _l(A),_e=new Map(Object.entries(Z)),Ee=new Map(Object.entries(ee)),te=new Map(Object.entries(ne)),de=new Map(Object.entries(Y)),Oe=new Map(Object.entries(xe)),Ge=new Map(Object.entries(pe));Is.setUserDefined({functions:_e,methods:Ee,types:te,variables:de,imports:Oe,enums:Ge},le),Pt.setUserDefind(_e,te,de,Ee,Ge);const Qe=L.map(ms=>({...ms,severity:ms.type||Ne.MarkerSeverity.Error}));u||!re.current&&!W.current&&Qe.length&&((Rt=K.current)==null||Rt.setModelMarkers(Qe))},[u]),z=N.useMemo(()=>Ju.debounce(C,1500),[C]);function V(A){var L;if(u){C(A||"");return}re.current=!0,fa.clearInlayHints(),(L=K.current)==null||L.setModelMarkers([]),A!==void 0&&(g&&g(A),z(A))}const q=N.useCallback(()=>{var L,Z;const A=(L=H.current)==null?void 0:L.getBoundingClientRect();(Z=K.current)==null||Z.setEditorLayout((A==null?void 0:A.height)||0,A==null?void 0:A.width)},[]);return N.useEffect(()=>{const A=()=>{window.requestAnimationFrame(q)},L=new ResizeObserver(A);return H.current&&L.observe(H.current),()=>{var Z;H.current&&L.unobserve(H.current),L.disconnect(),(Z=K.current)==null||Z.dispose()}},[]),T.jsx("div",{ref:H,children:T.jsx(_u,{height:r,width:n||"100%",defaultLanguage:Ke,defaultValue:m||`indicator("我的脚本")
144
+ */const rl=Symbol("Comlink.proxy"),qm=Symbol("Comlink.endpoint"),Cm=Symbol("Comlink.releaseProxy"),Un=Symbol("Comlink.finalizer"),xa=Symbol("Comlink.thrown"),al=a=>typeof a=="object"&&a!==null||typeof a=="function",Sm={canHandle:a=>al(a)&&a[rl],serialize(a){const{port1:s,port2:r}=new MessageChannel;return il(a,s),[r,[r]]},deserialize(a){return a.start(),$n(a)}},zm={canHandle:a=>al(a)&&xa in a,serialize({value:a}){let s;return a instanceof Error?s={isError:!0,value:{message:a.message,name:a.name,stack:a.stack}}:s={isError:!1,value:a},[s,[]]},deserialize(a){throw a.isError?Object.assign(new Error(a.value.message),a.value):a.value}},nl=new Map([["proxy",Sm],["throw",zm]]);function Nm(a,s){for(const r of a)if(s===r||r==="*"||r instanceof RegExp&&r.test(s))return!0;return!1}function il(a,s=globalThis,r=["*"]){s.addEventListener("message",function n(o){if(!o||!o.data)return;if(!Nm(r,o.origin)){console.warn(`Invalid origin '${o.origin}' for comlink proxy`);return}const{id:l,type:c,path:u}=Object.assign({path:[]},o.data),m=(o.data.argumentList||[]).map(As);let _;try{const g=u.slice(0,-1).reduce((h,D)=>h[D],a),x=u.reduce((h,D)=>h[D],a);switch(c){case"GET":_=x;break;case"SET":g[u.slice(-1)[0]]=As(o.data.value),_=!0;break;case"APPLY":_=x.apply(g,m);break;case"CONSTRUCT":{const h=new x(...m);_=jn(h)}break;case"ENDPOINT":{const{port1:h,port2:D}=new MessageChannel;il(a,D),_=Pm(h,[h])}break;case"RELEASE":_=void 0;break;default:return}}catch(g){_={value:g,[xa]:0}}Promise.resolve(_).catch(g=>({value:g,[xa]:0})).then(g=>{const[x,h]=Ta(g);s.postMessage(Object.assign(Object.assign({},x),{id:l}),h),c==="RELEASE"&&(s.removeEventListener("message",n),ol(s),Un in a&&typeof a[Un]=="function"&&a[Un]())}).catch(g=>{const[x,h]=Ta({value:new TypeError("Unserializable return value"),[xa]:0});s.postMessage(Object.assign(Object.assign({},x),{id:l}),h)})}),s.start&&s.start()}function Em(a){return a.constructor.name==="MessagePort"}function ol(a){Em(a)&&a.close()}function $n(a,s){return Kn(a,[],s)}function ha(a){if(a)throw new Error("Proxy has been released and is not useable")}function ll(a){return Ws(a,{type:"RELEASE"}).then(()=>{ol(a)})}const wa=new WeakMap,va="FinalizationRegistry"in globalThis&&new FinalizationRegistry(a=>{const s=(wa.get(a)||0)-1;wa.set(a,s),s===0&&ll(a)});function Lm(a,s){const r=(wa.get(s)||0)+1;wa.set(s,r),va&&va.register(a,s,a)}function Mm(a){va&&va.unregister(a)}function Kn(a,s=[],r=function(){}){let n=!1;const o=new Proxy(r,{get(l,c){if(ha(n),c===Cm)return()=>{Mm(o),ll(a),n=!0};if(c==="then"){if(s.length===0)return{then:()=>o};const u=Ws(a,{type:"GET",path:s.map(m=>m.toString())}).then(As);return u.then.bind(u)}return Kn(a,[...s,c])},set(l,c,u){ha(n);const[m,_]=Ta(u);return Ws(a,{type:"SET",path:[...s,c].map(g=>g.toString()),value:m},_).then(As)},apply(l,c,u){ha(n);const m=s[s.length-1];if(m===qm)return Ws(a,{type:"ENDPOINT"}).then(As);if(m==="bind")return Kn(a,s.slice(0,-1));const[_,g]=cl(u);return Ws(a,{type:"APPLY",path:s.map(x=>x.toString()),argumentList:_},g).then(As)},construct(l,c){ha(n);const[u,m]=cl(c);return Ws(a,{type:"CONSTRUCT",path:s.map(_=>_.toString()),argumentList:u},m).then(As)}});return Lm(o,a),o}function Om(a){return Array.prototype.concat.apply([],a)}function cl(a){const s=a.map(Ta);return[s.map(r=>r[0]),Om(s.map(r=>r[1]))]}const pl=new WeakMap;function Pm(a,s){return pl.set(a,s),a}function jn(a){return Object.assign(a,{[rl]:!0})}function Ta(a){for(const[s,r]of nl)if(r.canHandle(a)){const[n,o]=r.serialize(a);return[{type:"HANDLER",name:s,value:n},o]}return[{type:"RAW",value:a},pl.get(a)||[]]}function As(a){switch(a.type){case"HANDLER":return nl.get(a.name).deserialize(a.value);case"RAW":return a.value}}function Ws(a,s,r){return new Promise(n=>{const o=Rm();a.addEventListener("message",function l(c){!c.data||!c.data.id||c.data.id!==o||(a.removeEventListener("message",l),n(c.data))}),a.start&&a.start(),a.postMessage(Object.assign({id:o},s),r)})}function Rm(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const dl=new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/scriptsRunWorker-COXrDXBU.js").href:new URL("assets/scriptsRunWorker-COXrDXBU.js",typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||document.baseURI).href),typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:aa&&aa.src||new URL("trading-vue-editor.umd.packages.mjs",document.baseURI).href),{type:"module",name:"Run TccScript Server"});dl.onerror=a=>{console.error(a)};async function ul(a){return await fa.setInlayHints(a)}const ml=$n(dl),yl=$n(new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/parserTccWorker-4IWywR7k.js").href:new URL("assets/parserTccWorker-4IWywR7k.js",typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||document.baseURI).href),typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:aa&&aa.src||new URL("trading-vue-editor.umd.packages.mjs",document.baseURI).href),{type:"module",name:"Parser TccScript Server"}));async function _l(a,s=!1){const{functions:r,types:n,constants:o,variables:l,methods:c}=nt;return await yl.parseTcc(a,s,jn(ul),{functions:Object.fromEntries(r),methods:Object.fromEntries(c),types:Object.fromEntries(n),constants:Object.fromEntries(o),variables:Object.fromEntries(l)})}async function Fm(a,s){const{functions:r,types:n,constants:o,variables:l,methods:c}=nt;return await yl.parseLibraryCode(a,s,jn(ul),{functions:Object.fromEntries(r),methods:Object.fromEntries(c),types:Object.fromEntries(n),constants:Object.fromEntries(o),variables:Object.fromEntries(l)})}async function Bm(a,s,r=!0){return await ml.runScript(a,s,r)}async function Um(a){return await ml.removeScript(a)}function $m(a){return new Worker(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/editor.worker-CT5Cb1wO.js").href:new URL("assets/editor.worker-CT5Cb1wO.js",typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||document.baseURI).href),{name:a==null?void 0:a.name})}const{slice:Km,forEach:jm}=[];function Hm(a){return jm.call(Km.call(arguments,1),s=>{if(s)for(const r in s)a[r]===void 0&&(a[r]=s[r])}),a}const fl=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Wm=(a,s,r)=>{const n=r||{};n.path=n.path||"/";const o=encodeURIComponent(s);let l=`${a}=${o}`;if(n.maxAge>0){const c=n.maxAge-0;if(Number.isNaN(c))throw new Error("maxAge should be a Number");l+=`; Max-Age=${Math.floor(c)}`}if(n.domain){if(!fl.test(n.domain))throw new TypeError("option domain is invalid");l+=`; Domain=${n.domain}`}if(n.path){if(!fl.test(n.path))throw new TypeError("option path is invalid");l+=`; Path=${n.path}`}if(n.expires){if(typeof n.expires.toUTCString!="function")throw new TypeError("option expires is invalid");l+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(l+="; HttpOnly"),n.secure&&(l+="; Secure"),n.sameSite)switch(typeof n.sameSite=="string"?n.sameSite.toLowerCase():n.sameSite){case!0:l+="; SameSite=Strict";break;case"lax":l+="; SameSite=Lax";break;case"strict":l+="; SameSite=Strict";break;case"none":l+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return l},gl={create(a,s,r,n){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(o.expires=new Date,o.expires.setTime(o.expires.getTime()+r*60*1e3)),n&&(o.domain=n),document.cookie=Wm(a,encodeURIComponent(s),o)},read(a){const s=`${a}=`,r=document.cookie.split(";");for(let n=0;n<r.length;n++){let o=r[n];for(;o.charAt(0)===" ";)o=o.substring(1,o.length);if(o.indexOf(s)===0)return o.substring(s.length,o.length)}return null},remove(a){this.create(a,"",-1)}};var Vm={name:"cookie",lookup(a){let{lookupCookie:s}=a;if(s&&typeof document<"u")return gl.read(s)||void 0},cacheUserLanguage(a,s){let{lookupCookie:r,cookieMinutes:n,cookieDomain:o,cookieOptions:l}=s;r&&typeof document<"u"&&gl.create(r,a,n,o,l)}},Gm={name:"querystring",lookup(a){var n;let{lookupQuerystring:s}=a,r;if(typeof window<"u"){let{search:o}=window.location;!window.location.search&&((n=window.location.hash)==null?void 0:n.indexOf("?"))>-1&&(o=window.location.hash.substring(window.location.hash.indexOf("?")));const c=o.substring(1).split("&");for(let u=0;u<c.length;u++){const m=c[u].indexOf("=");m>0&&c[u].substring(0,m)===s&&(r=c[u].substring(m+1))}}return r}};let Sr=null;const bl=()=>{if(Sr!==null)return Sr;try{Sr=window!=="undefined"&&window.localStorage!==null;const a="i18next.translate.boo";window.localStorage.setItem(a,"foo"),window.localStorage.removeItem(a)}catch{Sr=!1}return Sr};var Xm={name:"localStorage",lookup(a){let{lookupLocalStorage:s}=a;if(s&&bl())return window.localStorage.getItem(s)||void 0},cacheUserLanguage(a,s){let{lookupLocalStorage:r}=s;r&&bl()&&window.localStorage.setItem(r,a)}};let zr=null;const xl=()=>{if(zr!==null)return zr;try{zr=window!=="undefined"&&window.sessionStorage!==null;const a="i18next.translate.boo";window.sessionStorage.setItem(a,"foo"),window.sessionStorage.removeItem(a)}catch{zr=!1}return zr};var Ym={name:"sessionStorage",lookup(a){let{lookupSessionStorage:s}=a;if(s&&xl())return window.sessionStorage.getItem(s)||void 0},cacheUserLanguage(a,s){let{lookupSessionStorage:r}=s;r&&xl()&&window.sessionStorage.setItem(r,a)}},Qm={name:"navigator",lookup(a){const s=[];if(typeof navigator<"u"){const{languages:r,userLanguage:n,language:o}=navigator;if(r)for(let l=0;l<r.length;l++)s.push(r[l]);n&&s.push(n),o&&s.push(o)}return s.length>0?s:void 0}},Zm={name:"htmlTag",lookup(a){let{htmlTag:s}=a,r;const n=s||(typeof document<"u"?document.documentElement:null);return n&&typeof n.getAttribute=="function"&&(r=n.getAttribute("lang")),r}},Jm={name:"path",lookup(a){var o;let{lookupFromPathIndex:s}=a;if(typeof window>"u")return;const r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(r)?(o=r[typeof s=="number"?s:0])==null?void 0:o.replace("/",""):void 0}},ey={name:"subdomain",lookup(a){var o,l;let{lookupFromSubdomainIndex:s}=a;const r=typeof s=="number"?s+1:1,n=typeof window<"u"&&((l=(o=window.location)==null?void 0:o.hostname)==null?void 0:l.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(n)return n[r]}};function ty(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:a=>a}}class hl{constructor(s){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(s,r)}init(s){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=s||{languageUtils:{}},this.options=Hm(r,this.options||{},ty()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=o=>o.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(Vm),this.addDetector(Gm),this.addDetector(Xm),this.addDetector(Ym),this.addDetector(Qm),this.addDetector(Zm),this.addDetector(Jm),this.addDetector(ey)}addDetector(s){return this.detectors[s.name]=s,this}detect(s){s||(s=this.options.order);let r=[];return s.forEach(n=>{if(this.detectors[n]){let o=this.detectors[n].lookup(this.options);o&&typeof o=="string"&&(o=[o]),o&&(r=r.concat(o))}}),r=r.map(n=>this.options.convertDetectedLanguage(n)),this.services.languageUtils.getBestMatchFromCodes?r:r.length>0?r[0]:null}cacheUserLanguage(s,r){r||(r=this.options.caches),r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(s)>-1||r.forEach(n=>{this.detectors[n]&&this.detectors[n].cacheUserLanguage(s,this.options)}))}}hl.type="languageDetector";const sy=(...a)=>{console!=null&&console.warn&&(qs(a[0])&&(a[0]=`react-i18next:: ${a[0]}`),console.warn(...a))},wl={},Hn=(...a)=>{qs(a[0])&&wl[a[0]]||(qs(a[0])&&(wl[a[0]]=new Date),sy(...a))},vl=(a,s)=>()=>{if(a.isInitialized)s();else{const r=()=>{setTimeout(()=>{a.off("initialized",r)},0),s()};a.on("initialized",r)}},Wn=(a,s,r)=>{a.loadNamespaces(s,vl(a,r))},Tl=(a,s,r,n)=>{if(qs(r)&&(r=[r]),a.options.preload&&a.options.preload.indexOf(s)>-1)return Wn(a,r,n);r.forEach(o=>{a.options.ns.indexOf(o)<0&&a.options.ns.push(o)}),a.loadLanguages(s,vl(a,n))},ry=(a,s,r={})=>!s.languages||!s.languages.length?(Hn("i18n.languages were undefined or empty",s.languages),!0):s.hasLoadedNamespace(a,{lng:r.lng,precheck:(n,o)=>{var l;if(((l=r.bindI18n)==null?void 0:l.indexOf("languageChanging"))>-1&&n.services.backendConnector.backend&&n.isLanguageChangingTo&&!o(n.isLanguageChangingTo,a))return!1}}),qs=a=>typeof a=="string",ay=a=>typeof a=="object"&&a!==null,ny=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,iy={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},oy=a=>iy[a];let Vn={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:a=>a.replace(ny,oy)};const ly=(a={})=>{Vn={...Vn,...a}},cy=()=>Vn;let kl;const py=a=>{kl=a},dy=()=>kl,uy={type:"3rdParty",init(a){ly(a.options.react),py(a)}},my=N.createContext();class yy{constructor(){this.usedNamespaces={}}addUsedNamespaces(s){s.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const _y=(a,s)=>{const r=N.useRef();return N.useEffect(()=>{r.current=s?r.current:a},[a,s]),r.current},Dl=(a,s,r,n)=>a.getFixedT(s,r,n),fy=(a,s,r,n)=>N.useCallback(Dl(a,s,r,n),[a,s,r,n]),Vs=(a,s={})=>{var W,Q,C,z;const{i18n:r}=s,{i18n:n,defaultNS:o}=N.useContext(my)||{},l=r||n||dy();if(l&&!l.reportNamespaces&&(l.reportNamespaces=new yy),!l){Hn("You will need to pass in an i18next instance by using initReactI18next");const V=(A,L)=>qs(L)?L:ay(L)&&qs(L.defaultValue)?L.defaultValue:Array.isArray(A)?A[A.length-1]:A,q=[V,{},!1];return q.t=V,q.i18n={},q.ready=!1,q}(W=l.options.react)!=null&&W.wait&&Hn("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const c={...cy(),...l.options.react,...s},{useSuspense:u,keyPrefix:m}=c;let _=a||o||((Q=l.options)==null?void 0:Q.defaultNS);_=qs(_)?[_]:_||["translation"],(z=(C=l.reportNamespaces).addUsedNamespaces)==null||z.call(C,_);const g=(l.isInitialized||l.initializedStoreOnce)&&_.every(V=>ry(V,l,c)),x=fy(l,s.lng||null,c.nsMode==="fallback"?_:_[0],m),h=()=>x,D=()=>Dl(l,s.lng||null,c.nsMode==="fallback"?_:_[0],m),[S,R]=N.useState(h);let U=_.join();s.lng&&(U=`${s.lng}${U}`);const K=_y(U),H=N.useRef(!0);N.useEffect(()=>{const{bindI18n:V,bindI18nStore:q}=c;H.current=!0,!g&&!u&&(s.lng?Tl(l,s.lng,_,()=>{H.current&&R(D)}):Wn(l,_,()=>{H.current&&R(D)})),g&&K&&K!==U&&H.current&&R(D);const A=()=>{H.current&&R(D)};return V&&(l==null||l.on(V,A)),q&&(l==null||l.store.on(q,A)),()=>{H.current=!1,l&&(V==null||V.split(" ").forEach(L=>l.off(L,A))),q&&l&&q.split(" ").forEach(L=>l.store.off(L,A))}},[l,U]),N.useEffect(()=>{H.current&&g&&R(h)},[l,m,g]);const re=[S,l,g];if(re.t=S,re.i18n=l,re.ready=g,g||!g&&!u)return re;throw new Promise(V=>{s.lng?Tl(l,s.lng,_,()=>V()):Wn(l,_,()=>V())})},gy={type:"type",syntax:"syntax",overloads:"overloads",arguments:"arguments",fields:"fields",example:"example",returns:"returns",remarks:"remarks","see also":"see also","Copy code":"Copy code","Copy link":"Copy link",Copied:"Copied","Link copied":"Link copied",variables:"Variables",constants:"Constants",functions:"Functions",keywords:"Keywords",types:"Types",operators:"Operators",annotations:"Annotations",search:"Search","Mine Script® v1 Reference Manual":"Mine Script® v1 Reference Manual","This script is read-only. It cannot be edited.":"This script is read-only. It cannot be edited.","save script":"Save script","open script":"Open script","find/replace":"Find/Replace","toggle console":"Toggle console","open editor in new tab":"Open editor in new tab","open editor in new window":"Open editor in new window",keyword:"keyword","built-in function":"built-in function","built-in variable":"built-in variable","built-in method":"built-in method","built-in type":"built-in type",annotation:"annotation","built-in constant":"built-in constant",namespace:"namespace","user-defined variable":"user-defined variable","user-defined type":"user-defined type",field:"field",enum:"enum","user-defined method":"user-defined method","user-defined function":"user-defined function",parameter:"parameter","**Namespaces** are immutable terms that act as prefixes for groups of identifiers. A dot and another term always follow a namespace when naming Tcc functions, variables, and methods.":"**Namespaces** are immutable terms that act as prefixes for groups of identifiers. A dot and another term always follow a namespace when naming Mine functions, variables, and methods.","to trigger parameters hint":"to trigger parameters hint",library:"library","enum member":"enum member",Returns:"Returns",Syntax:"Syntax",Remarks:"Remarks",Fields:"Fields",Description:"Description",Example:"Example","Enum members":"Enum members",statement:"statement",loop:"loop","`click` on keyword for more help":"`click` on keyword for more help"},by={type:"类型",syntax:"语法",overloads:"重载",arguments:"参数",fields:"字段",example:"例子",returns:"返回值",remarks:"备注","see also":"另见","Copy code":"复制代码","Copy link":"复制链接",Copied:"已复制","Link copied":"链接已复制",variables:"内置变量",constants:"常量",functions:"函数",keywords:"关键词",types:"类型",operators:"运算符",annotations:"注释",search:"搜索","Mine Script® v1 Reference Manual":"Mine Script™ v1参考手册","This script is read-only. It cannot be edited.":"该脚本是只读的。它无法被编辑。","save script":"保存脚本","open script":"打开脚本","find/replace":"寻找/替换","toggle console":"切换控制台","open editor in new tab":"在新标签页中打开","open editor in new window":"在新窗口中打开",keyword:"关键词","built-in function":"内置函数","built-in variable":"内置变量","built-in method":"内置方法","built-in type":"内置类型",annotation:"注释","built-in constant":"内置常量",namespace:"命名空间","user-defined variable":"用户自定义变量","user-defined type":"用户自定义类型",field:"字段",enum:"枚举","user-defined method":"用户自定义方法","user-defined function":"用户自定义函数",parameter:"参数","**Namespaces** are immutable terms that act as prefixes for groups of identifiers. A dot and another term always follow a namespace when naming Tcc functions, variables, and methods.":"命名空间是不可变的术语,充当标识符组的前缀。在命名Mine函数、变量和方法时,点和另一个术语始终遵循命名空间。","to trigger parameters hint":"触发参数提示",library:"脚本库","enum member":"枚举成员",Returns:"返回值",Syntax:"语法",Remarks:"备注",Fields:"字段",Description:"描述",Example:"例子","Enum members":"枚举成员",statement:"声明",loop:"循环","`click` on keyword for more help":"“点击”关键词以获得更多帮助"};Me.use(hl).use(uy).init({debug:!1,fallbackLng:"zh",interpolation:{escapeValue:!1},resources:{en:{translation:gy},zh:{translation:by}}}),self.MonacoEnvironment={getWorker(){return new $m({name:"Editor Worker"})}},An.config({paths:{vs:"https://my.tradingvue.com/vs"},"vs/nls":{availableLanguages:{"*":"zh-cn"}}});const xy=(a,s)=>{const{height:r,width:n,theme:o,options:l,hasDiff:c,readOnly:u,defaultValue:m,language:_,onChange:g,onLinkOpen:x,onCursorPositionChange:h,onActionTrigger:D,onEditorDidMount:S}=a,{t:R,i18n:U}=Vs(),K=N.useRef(null),H=N.useRef(null),re=N.useRef(!1),W=N.useRef(!1);N.useImperativeHandle(s,()=>({setOriginalScript(A){var L;(L=K.current)==null||L.setOriginalScript(A)},setScript(A){var L;(L=K.current)==null||L.setValue(A)},gotoLine(){var A;(A=K.current)==null||A.gotoLine()},getEditorLayout(){var A;return(A=K.current)==null?void 0:A.getEditorLayout()},setPosition(A,L){var Z;(Z=K.current)==null||Z.setPosition({column:A,lineNumber:L})},setModelMarkers(A){var L;W.current=!0,(L=K.current)==null||L.setModelMarkers(A),setTimeout(()=>{W.current=!1},2e3)},focus(){var A;(A=K.current)==null||A.focus()}})),N.useEffect(()=>{var A,L;c?(L=K.current)==null||L.addDiffDecorations():(A=K.current)==null||A.removeDiffDecorations()},[c]),N.useEffect(()=>{o&&Ne.editor.setTheme(o)},[o]),N.useEffect(()=>{_&&U.changeLanguage(_)},[_]),N.useEffect(()=>{var A;(A=K.current)==null||A.updateActionTrigger(D)},[D]),N.useEffect(()=>{var A;x&&((A=K.current)==null||A.addLinkOpenFunc(x))},[x]);function Q(A,L){var ee,ne;Pt.initBuiltinsTrees(),fa.setEditor(A),K.current=new Am(A,L,D),x&&((ee=K.current)==null||ee.addLinkOpenFunc(x)),c&&((ne=K.current)==null||ne.addDiffDecorations()),Yu(A),requestAnimationFrame(q);const Z=A.getValue();K.current.onChangeCursorPosition(h),g&&g(Z),!u&&C(Z),S&&S()}const C=N.useCallback(async A=>{var Rt;re.current=!1;const{errors:L,functions:Z,methods:ee,types:ne,variables:Y,overloadsFuncs:le,imports:xe,enums:pe}=await _l(A),_e=new Map(Object.entries(Z)),Ee=new Map(Object.entries(ee)),te=new Map(Object.entries(ne)),de=new Map(Object.entries(Y)),Oe=new Map(Object.entries(xe)),Ge=new Map(Object.entries(pe));Is.setUserDefined({functions:_e,methods:Ee,types:te,variables:de,imports:Oe,enums:Ge},le),Pt.setUserDefind(_e,te,de,Ee,Ge);const Qe=L.map(ms=>({...ms,severity:ms.type||Ne.MarkerSeverity.Error}));u||!re.current&&!W.current&&Qe.length&&((Rt=K.current)==null||Rt.setModelMarkers(Qe))},[u]),z=N.useMemo(()=>Ju.debounce(C,1500),[C]);function V(A){var L;if(u){C(A||"");return}re.current=!0,fa.clearInlayHints(),(L=K.current)==null||L.setModelMarkers([]),A!==void 0&&(g&&g(A),z(A))}const q=N.useCallback(()=>{var L,Z;const A=(L=H.current)==null?void 0:L.getBoundingClientRect();(Z=K.current)==null||Z.setEditorLayout((A==null?void 0:A.height)||0,A==null?void 0:A.width)},[]);return N.useEffect(()=>{const A=()=>{window.requestAnimationFrame(q)},L=new ResizeObserver(A);return H.current&&L.observe(H.current),()=>{var Z;H.current&&L.unobserve(H.current),L.disconnect(),(Z=K.current)==null||Z.dispose()}},[]),T.jsx("div",{ref:H,children:T.jsx(_u,{height:r,width:n||"100%",defaultLanguage:Ke,defaultValue:m||`indicator("我的脚本")
145
145
  plot(close)
146
146
  `,theme:o||"vs-dark",className:`tvue-script ${o||"vs-dark"}`,options:{colorDecorators:!0,useShadowDOM:!1,matchOnWordStartOnly:!0,automaticLayout:!1,unicodeHighlight:{allowedCharacters:{" ":!0}},suggest:{filterGraceful:!0},fontSize:13,...u?om:{},readOnlyMessage:{value:R("This script is read-only. It cannot be edited.")},...l},onMount:Q,onChange:V})})},hy=N.forwardRef(xy),wy=a=>{const{theme:s,modified:r,original:n,height:o,width:l,renderSideBySide:c=!0}=a,u=N.useCallback((m,_)=>{_.languages.register({id:Ke}),_.editor.defineTheme("vs-dark",On),_.editor.defineTheme("vs",Mn),_.languages.setMonarchTokensProvider(Ke,Hs),_.languages.setLanguageConfiguration(Ke,Ln)},[]);return T.jsx(pu,{height:o||"90vh",width:l||"100%",theme:s||"vs-dark",options:{readOnly:!0,renderSideBySide:c,scrollBeyondLastLine:!1},language:Ke,modified:r,original:n,onMount:u})};M.VMarkerSeverity=void 0,function(a){a[a.Hint=1]="Hint",a[a.Info=2]="Info",a[a.Warning=4]="Warning",a[a.Error=8]="Error"}(M.VMarkerSeverity||(M.VMarkerSeverity={}));var ka={},vy=function(){var a=document.getSelection();if(!a.rangeCount)return function(){};for(var s=document.activeElement,r=[],n=0;n<a.rangeCount;n++)r.push(a.getRangeAt(n));switch(s.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":s.blur();break;default:s=null;break}return a.removeAllRanges(),function(){a.type==="Caret"&&a.removeAllRanges(),a.rangeCount||r.forEach(function(o){a.addRange(o)}),s&&s.focus()}},Ty=vy,Il={"text/plain":"Text","text/html":"Url",default:"Text"},ky="Copy to clipboard: #{key}, Enter";function Dy(a){var s=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return a.replace(/#{\s*key\s*}/g,s)}function Iy(a,s){var r,n,o,l,c,u,m=!1;s||(s={}),r=s.debug||!1;try{o=Ty(),l=document.createRange(),c=document.getSelection(),u=document.createElement("span"),u.textContent=a,u.ariaHidden="true",u.style.all="unset",u.style.position="fixed",u.style.top=0,u.style.clip="rect(0, 0, 0, 0)",u.style.whiteSpace="pre",u.style.webkitUserSelect="text",u.style.MozUserSelect="text",u.style.msUserSelect="text",u.style.userSelect="text",u.addEventListener("copy",function(g){if(g.stopPropagation(),s.format)if(g.preventDefault(),typeof g.clipboardData>"u"){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var x=Il[s.format]||Il.default;window.clipboardData.setData(x,a)}else g.clipboardData.clearData(),g.clipboardData.setData(s.format,a);s.onCopy&&(g.preventDefault(),s.onCopy(g.clipboardData))}),document.body.appendChild(u),l.selectNodeContents(u),c.addRange(l);var _=document.execCommand("copy");if(!_)throw new Error("copy command was unsuccessful");m=!0}catch(g){r&&console.error("unable to copy using execCommand: ",g),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(s.format||"text",a),s.onCopy&&s.onCopy(window.clipboardData),m=!0}catch(x){r&&console.error("unable to copy using clipboardData: ",x),r&&console.error("falling back to prompt"),n=Dy("message"in s?s.message:ky),window.prompt(n,a)}}finally{c&&(typeof c.removeRange=="function"?c.removeRange(l):c.removeAllRanges()),u&&document.body.removeChild(u),o()}return m}var Ay=Iy;function Gn(a){"@babel/helpers - typeof";return Gn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},Gn(a)}Object.defineProperty(ka,"__esModule",{value:!0}),ka.CopyToClipboard=void 0;var Da=Al(N),qy=Al(Ay),Cy=["text","onCopy","options","children"];function Al(a){return a&&a.__esModule?a:{default:a}}function ql(a,s){var r=Object.keys(a);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(a);s&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(a,o).enumerable})),r.push.apply(r,n)}return r}function Cl(a){for(var s=1;s<arguments.length;s++){var r=arguments[s]!=null?arguments[s]:{};s%2?ql(Object(r),!0).forEach(function(n){Yn(a,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(r)):ql(Object(r)).forEach(function(n){Object.defineProperty(a,n,Object.getOwnPropertyDescriptor(r,n))})}return a}function Sy(a,s){if(a==null)return{};var r=zy(a,s),n,o;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(a);for(o=0;o<l.length;o++)n=l[o],!(s.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(a,n)&&(r[n]=a[n])}return r}function zy(a,s){if(a==null)return{};var r={},n=Object.keys(a),o,l;for(l=0;l<n.length;l++)o=n[l],!(s.indexOf(o)>=0)&&(r[o]=a[o]);return r}function Ny(a,s){if(!(a instanceof s))throw new TypeError("Cannot call a class as a function")}function Sl(a,s){for(var r=0;r<s.length;r++){var n=s[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(a,n.key,n)}}function Ey(a,s,r){return s&&Sl(a.prototype,s),r&&Sl(a,r),Object.defineProperty(a,"prototype",{writable:!1}),a}function Ly(a,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(s&&s.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),Object.defineProperty(a,"prototype",{writable:!1}),s&&Xn(a,s)}function Xn(a,s){return Xn=Object.setPrototypeOf||function(n,o){return n.__proto__=o,n},Xn(a,s)}function My(a){var s=Py();return function(){var n=Ia(a),o;if(s){var l=Ia(this).constructor;o=Reflect.construct(n,arguments,l)}else o=n.apply(this,arguments);return Oy(this,o)}}function Oy(a,s){if(s&&(Gn(s)==="object"||typeof s=="function"))return s;if(s!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return zl(a)}function zl(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function Py(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ia(a){return Ia=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Ia(a)}function Yn(a,s,r){return s in a?Object.defineProperty(a,s,{value:r,enumerable:!0,configurable:!0,writable:!0}):a[s]=r,a}var Nl=function(a){Ly(r,a);var s=My(r);function r(){var n;Ny(this,r);for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];return n=s.call.apply(s,[this].concat(l)),Yn(zl(n),"onClick",function(u){var m=n.props,_=m.text,g=m.onCopy,x=m.children,h=m.options,D=Da.default.Children.only(x),S=(0,qy.default)(_,h);g&&g(_,S),D&&D.props&&typeof D.props.onClick=="function"&&D.props.onClick(u)}),n}return Ey(r,[{key:"render",value:function(){var o=this.props;o.text,o.onCopy,o.options;var l=o.children,c=Sy(o,Cy),u=Da.default.Children.only(l);return Da.default.cloneElement(u,Cl(Cl({},c),{},{onClick:this.onClick}))}}]),r}(Da.default.PureComponent);ka.CopyToClipboard=Nl,Yn(Nl,"defaultProps",{onCopy:void 0,options:void 0});var Ry=ka,Qn=Ry.CopyToClipboard;Qn.CopyToClipboard=Qn;var Fy=Qn;const Gs=od(Fy);Ne.languages.register({id:Ke}),Ne.editor.defineTheme("vs-dark",On),Ne.editor.defineTheme("vs",Mn),Ne.languages.setMonarchTokensProvider(Ke,Hs),Ne.languages.setLanguageConfiguration(Ke,Ln);async function El(a,s){return s&&Ne.editor.setTheme(s.includes("dark")?"vs-dark":"light"),await Ne.editor.colorize(a,Ke,{tabSize:4})}async function Zn(a,s=0){const r=a[s];if(!r)return;const{name:n,args:o,type:l,desc:c,examples:u,remarks:m,seeAlso:_,syntax:g,detailedDesc:x,fields:h,returns:D}=r,S={name:n,orirginalName:n};if(a.length>1&&(S.overloads=`${a.length} ${Me.t("overloads")}`),l&&(S.type=l),o&&(S.name=`${n}()`,S.args=o.map(R=>{const{name:U,desc:K,displayType:H}=R;return{label:`${U} (${H})`,desc:K&&Cs(K)}})),c&&(S.desc=c.map(R=>Cs(R))),u&&(S.originalExample=u.join(`
147
147
  `),S.examples=await Ne.editor.colorize(S.originalExample,Ke,{tabSize:4})),x){S.detailedDesc=[];for(const R of x){const{desc:U,examples:K}=R;let H=U.map(Q=>Cs(Q)),re,W;K&&(W=K.join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guihz/trading-vue-editor-tes",
3
- "version": "0.0.298",
3
+ "version": "0.0.299",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "lib"