@guihz/trading-vue-editor-tes 0.0.33 → 0.0.35
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.
- package/lib/assets/{parserTccWorker-DngDuQ-v.js → parserTccWorker-DaBGcwpy.js} +1 -1
- package/lib/assets/{scriptsRunWorker-C8unrW65.js → scriptsRunWorker-uULdCfgb.js} +12 -12
- package/lib/components/editor/constants/newContents_en.d.ts +1523 -0
- package/lib/components/editor/constants/newContents_zh.d.ts +1523 -0
- package/lib/components/editor/index.d.ts +1 -0
- package/lib/components/editor/parseScript/buildInFuncNamespace/log.d.ts +1 -0
- package/lib/components/editor/parseScript/buildInVarNamespace/strategy.d.ts +4 -2
- package/lib/components/editor/utils/completions.d.ts +4 -1
- package/lib/components/editor/utils/parse.d.ts +2 -1
- package/lib/components/editor/utils/suggestions.d.ts +1 -0
- package/lib/trading-vue-editor.js +4022 -2628
- package/lib/trading-vue-editor.umd.cjs +42 -40
- package/package.json +1 -1
@@ -5,9 +5,9 @@ var M2=Object.defineProperty;var N2=(jt,Zt,be)=>Zt in jt?M2(jt,Zt,{enumerable:!0
|
|
5
5
|
* Released under MIT license <https://lodash.com/license>
|
6
6
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
7
7
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
8
|
-
*/Ln.exports,function(i,t){(function(){var e,r="4.17.21",n=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",l="Invalid `variable` option passed into `_.template`",f="__lodash_hash_undefined__",h=500,p="__lodash_placeholder__",c=1,d=2,g=4,w=1,m=2,D=1,v=2,E=4,b=8,N=16,x=32,F=64,M=128,S=256,O=512,C=30,T="...",L=800,U=16,k=1,W=2,P=3,K=1/0,G=9007199254740991,V=17976931348623157e292,tt=NaN,ft=4294967295,vt=ft-1,lt=ft>>>1,yt=[["ary",M],["bind",D],["bindKey",v],["curry",b],["curryRight",N],["flip",O],["partial",x],["partialRight",F],["rearg",S]],bt="[object Arguments]",Bt="[object Array]",Et="[object AsyncFunction]",ne="[object Boolean]",It="[object Date]",Nt="[object DOMException]",se="[object Error]",Vt="[object Function]",qt="[object GeneratorFunction]",Kt="[object Map]",Me="[object Number]",ur="[object Null]",Se="[object Object]",rn="[object Promise]",En="[object Proxy]",nn="[object RegExp]",lr="[object Set]",xn="[object String]",$="[object Symbol]",Z="[object Undefined]",H="[object WeakMap]",nt="[object WeakSet]",st="[object ArrayBuffer]",rt="[object DataView]",ct="[object Float32Array]",ut="[object Float64Array]",ht="[object Int8Array]",at="[object Int16Array]",Ht="[object Int32Array]",Qt="[object Uint8Array]",_e="[object Uint8ClampedArray]",$e="[object Uint16Array]",Be="[object Uint32Array]",fr=/\b__p \+= '';/g,cr=/\b(__p \+=) '' \+/g,An=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Kn=/&(?:amp|lt|gt|quot|#39);/g,co=/[&<>"']/g,ka=RegExp(Kn.source),Ua=RegExp(co.source),Wa=/<%-([\s\S]+?)%>/g,ja=/<%([\s\S]+?)%>/g,ho=/<%=([\s\S]+?)%>/g,Ya=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Za=/^\w*$/,Ga=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Qi=/[\\^$.*+?()[\]{}|]/g,Ka=RegExp(Qi.source),ts=/^\s+/,Ha=/\s/,Ja=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Xa=/\{\n\/\* \[wrapped with (.+)\] \*/,Va=/,? & /,Qa=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,tu=/[()=,{}\[\]\/\s]/,eu=/\\(\\)?/g,ru=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,po=/\w*$/,nu=/^[-+]0x[0-9a-f]+$/i,iu=/^0b[01]+$/i,su=/^\[object .+?Constructor\]$/,ou=/^0o[0-7]+$/i,au=/^(?:0|[1-9]\d*)$/,uu=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ei=/($^)/,Hn=/['\n\r\u2028\u2029\\]/g,Yt="\\ud800-\\udfff",je="\\u0300-\\u036f",lu="\\ufe20-\\ufe2f",xi="\\u20d0-\\u20ff",Cn=je+lu+xi,_o="\\u2700-\\u27bf",nh="a-z\\xdf-\\xf6\\xf8-\\xff",xy="\\xac\\xb1\\xd7\\xf7",Ay="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Cy="\\u2000-\\u206f",Fy=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ih="A-Z\\xc0-\\xd6\\xd8-\\xde",sh="\\ufe0e\\ufe0f",oh=xy+Ay+Cy+Fy,fu="['’]",My="["+Yt+"]",ah="["+oh+"]",mo="["+Cn+"]",uh="\\d+",Ny="["+_o+"]",lh="["+nh+"]",fh="[^"+Yt+oh+uh+_o+nh+ih+"]",cu="\\ud83c[\\udffb-\\udfff]",Sy="(?:"+mo+"|"+cu+")",ch="[^"+Yt+"]",hu="(?:\\ud83c[\\udde6-\\uddff]){2}",pu="[\\ud800-\\udbff][\\udc00-\\udfff]",Ai="["+ih+"]",hh="\\u200d",ph="(?:"+lh+"|"+fh+")",By="(?:"+Ai+"|"+fh+")",dh="(?:"+fu+"(?:d|ll|m|re|s|t|ve))?",_h="(?:"+fu+"(?:D|LL|M|RE|S|T|VE))?",mh=Sy+"?",gh="["+sh+"]?",Ty="(?:"+hh+"(?:"+[ch,hu,pu].join("|")+")"+gh+mh+")*",Iy="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Oy="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",vh=gh+mh+Ty,$y="(?:"+[Ny,hu,pu].join("|")+")"+vh,Ly="(?:"+[ch+mo+"?",mo,hu,pu,My].join("|")+")",Ry=RegExp(fu,"g"),Py=RegExp(mo,"g"),du=RegExp(cu+"(?="+cu+")|"+Ly+vh,"g"),zy=RegExp([Ai+"?"+lh+"+"+dh+"(?="+[ah,Ai,"$"].join("|")+")",By+"+"+_h+"(?="+[ah,Ai+ph,"$"].join("|")+")",Ai+"?"+ph+"+"+dh,Ai+"+"+_h,Oy,Iy,uh,$y].join("|"),"g"),qy=RegExp("["+hh+Yt+Cn+sh+"]"),ky=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Uy=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Wy=-1,he={};he[ct]=he[ut]=he[ht]=he[at]=he[Ht]=he[Qt]=he[_e]=he[$e]=he[Be]=!0,he[bt]=he[Bt]=he[st]=he[ne]=he[rt]=he[It]=he[se]=he[Vt]=he[Kt]=he[Me]=he[Se]=he[nn]=he[lr]=he[xn]=he[H]=!1;var fe={};fe[bt]=fe[Bt]=fe[st]=fe[rt]=fe[ne]=fe[It]=fe[ct]=fe[ut]=fe[ht]=fe[at]=fe[Ht]=fe[Kt]=fe[Me]=fe[Se]=fe[nn]=fe[lr]=fe[xn]=fe[$]=fe[Qt]=fe[_e]=fe[$e]=fe[Be]=!0,fe[se]=fe[Vt]=fe[H]=!1;var jy={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Yy={"&":"&","<":"<",">":">",'"':""","'":"'"},Zy={"&":"&","<":"<",">":">",""":'"',"'":"'"},Gy={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ky=parseFloat,Hy=parseInt,wh=typeof jt=="object"&&jt&&jt.Object===Object&&jt,Jy=typeof self=="object"&&self&&self.Object===Object&&self,qe=wh||Jy||Function("return this")(),_u=t&&!t.nodeType&&t,Jn=_u&&!0&&i&&!i.nodeType&&i,yh=Jn&&Jn.exports===_u,mu=yh&&wh.process,br=function(){try{var j=Jn&&Jn.require&&Jn.require("util").types;return j||mu&&mu.binding&&mu.binding("util")}catch{}}(),Dh=br&&br.isArrayBuffer,bh=br&&br.isDate,Eh=br&&br.isMap,xh=br&&br.isRegExp,Ah=br&&br.isSet,Ch=br&&br.isTypedArray;function hr(j,X,J){switch(J.length){case 0:return j.call(X);case 1:return j.call(X,J[0]);case 2:return j.call(X,J[0],J[1]);case 3:return j.call(X,J[0],J[1],J[2])}return j.apply(X,J)}function Xy(j,X,J,gt){for(var Tt=-1,Xt=j==null?0:j.length;++Tt<Xt;){var Te=j[Tt];X(gt,Te,J(Te),j)}return gt}function Er(j,X){for(var J=-1,gt=j==null?0:j.length;++J<gt&&X(j[J],J,j)!==!1;);return j}function Vy(j,X){for(var J=j==null?0:j.length;J--&&X(j[J],J,j)!==!1;);return j}function Fh(j,X){for(var J=-1,gt=j==null?0:j.length;++J<gt;)if(!X(j[J],J,j))return!1;return!0}function Fn(j,X){for(var J=-1,gt=j==null?0:j.length,Tt=0,Xt=[];++J<gt;){var Te=j[J];X(Te,J,j)&&(Xt[Tt++]=Te)}return Xt}function go(j,X){var J=j==null?0:j.length;return!!J&&Ci(j,X,0)>-1}function gu(j,X,J){for(var gt=-1,Tt=j==null?0:j.length;++gt<Tt;)if(J(X,j[gt]))return!0;return!1}function me(j,X){for(var J=-1,gt=j==null?0:j.length,Tt=Array(gt);++J<gt;)Tt[J]=X(j[J],J,j);return Tt}function Mn(j,X){for(var J=-1,gt=X.length,Tt=j.length;++J<gt;)j[Tt+J]=X[J];return j}function vu(j,X,J,gt){var Tt=-1,Xt=j==null?0:j.length;for(gt&&Xt&&(J=j[++Tt]);++Tt<Xt;)J=X(J,j[Tt],Tt,j);return J}function Qy(j,X,J,gt){var Tt=j==null?0:j.length;for(gt&&Tt&&(J=j[--Tt]);Tt--;)J=X(J,j[Tt],Tt,j);return J}function wu(j,X){for(var J=-1,gt=j==null?0:j.length;++J<gt;)if(X(j[J],J,j))return!0;return!1}var tD=yu("length");function eD(j){return j.split("")}function rD(j){return j.match(Qa)||[]}function Mh(j,X,J){var gt;return J(j,function(Tt,Xt,Te){if(X(Tt,Xt,Te))return gt=Xt,!1}),gt}function vo(j,X,J,gt){for(var Tt=j.length,Xt=J+(gt?1:-1);gt?Xt--:++Xt<Tt;)if(X(j[Xt],Xt,j))return Xt;return-1}function Ci(j,X,J){return X===X?dD(j,X,J):vo(j,Nh,J)}function nD(j,X,J,gt){for(var Tt=J-1,Xt=j.length;++Tt<Xt;)if(gt(j[Tt],X))return Tt;return-1}function Nh(j){return j!==j}function Sh(j,X){var J=j==null?0:j.length;return J?bu(j,X)/J:tt}function yu(j){return function(X){return X==null?e:X[j]}}function Du(j){return function(X){return j==null?e:j[X]}}function Bh(j,X,J,gt,Tt){return Tt(j,function(Xt,Te,ue){J=gt?(gt=!1,Xt):X(J,Xt,Te,ue)}),J}function iD(j,X){var J=j.length;for(j.sort(X);J--;)j[J]=j[J].value;return j}function bu(j,X){for(var J,gt=-1,Tt=j.length;++gt<Tt;){var Xt=X(j[gt]);Xt!==e&&(J=J===e?Xt:J+Xt)}return J}function Eu(j,X){for(var J=-1,gt=Array(j);++J<j;)gt[J]=X(J);return gt}function sD(j,X){return me(X,function(J){return[J,j[J]]})}function Th(j){return j&&j.slice(0,Lh(j)+1).replace(ts,"")}function pr(j){return function(X){return j(X)}}function xu(j,X){return me(X,function(J){return j[J]})}function es(j,X){return j.has(X)}function Ih(j,X){for(var J=-1,gt=j.length;++J<gt&&Ci(X,j[J],0)>-1;);return J}function Oh(j,X){for(var J=j.length;J--&&Ci(X,j[J],0)>-1;);return J}function oD(j,X){for(var J=j.length,gt=0;J--;)j[J]===X&&++gt;return gt}var aD=Du(jy),uD=Du(Yy);function lD(j){return"\\"+Gy[j]}function fD(j,X){return j==null?e:j[X]}function Fi(j){return qy.test(j)}function cD(j){return ky.test(j)}function hD(j){for(var X,J=[];!(X=j.next()).done;)J.push(X.value);return J}function Au(j){var X=-1,J=Array(j.size);return j.forEach(function(gt,Tt){J[++X]=[Tt,gt]}),J}function $h(j,X){return function(J){return j(X(J))}}function Nn(j,X){for(var J=-1,gt=j.length,Tt=0,Xt=[];++J<gt;){var Te=j[J];(Te===X||Te===p)&&(j[J]=p,Xt[Tt++]=J)}return Xt}function wo(j){var X=-1,J=Array(j.size);return j.forEach(function(gt){J[++X]=gt}),J}function pD(j){var X=-1,J=Array(j.size);return j.forEach(function(gt){J[++X]=[gt,gt]}),J}function dD(j,X,J){for(var gt=J-1,Tt=j.length;++gt<Tt;)if(j[gt]===X)return gt;return-1}function _D(j,X,J){for(var gt=J+1;gt--;)if(j[gt]===X)return gt;return gt}function Mi(j){return Fi(j)?gD(j):tD(j)}function Rr(j){return Fi(j)?vD(j):eD(j)}function Lh(j){for(var X=j.length;X--&&Ha.test(j.charAt(X)););return X}var mD=Du(Zy);function gD(j){for(var X=du.lastIndex=0;du.test(j);)++X;return X}function vD(j){return j.match(du)||[]}function wD(j){return j.match(zy)||[]}var yD=function j(X){X=X==null?qe:Ni.defaults(qe.Object(),X,Ni.pick(qe,Uy));var J=X.Array,gt=X.Date,Tt=X.Error,Xt=X.Function,Te=X.Math,ue=X.Object,Cu=X.RegExp,DD=X.String,xr=X.TypeError,yo=J.prototype,bD=Xt.prototype,Si=ue.prototype,Do=X["__core-js_shared__"],bo=bD.toString,ie=Si.hasOwnProperty,ED=0,Rh=function(){var o=/[^.]+$/.exec(Do&&Do.keys&&Do.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""}(),Eo=Si.toString,xD=bo.call(ue),AD=qe._,CD=Cu("^"+bo.call(ie).replace(Qi,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),xo=yh?X.Buffer:e,Sn=X.Symbol,Ao=X.Uint8Array,Ph=xo?xo.allocUnsafe:e,Co=$h(ue.getPrototypeOf,ue),zh=ue.create,qh=Si.propertyIsEnumerable,Fo=yo.splice,kh=Sn?Sn.isConcatSpreadable:e,rs=Sn?Sn.iterator:e,Xn=Sn?Sn.toStringTag:e,Mo=function(){try{var o=ri(ue,"defineProperty");return o({},"",{}),o}catch{}}(),FD=X.clearTimeout!==qe.clearTimeout&&X.clearTimeout,MD=gt&>.now!==qe.Date.now&>.now,ND=X.setTimeout!==qe.setTimeout&&X.setTimeout,No=Te.ceil,So=Te.floor,Fu=ue.getOwnPropertySymbols,SD=xo?xo.isBuffer:e,Uh=X.isFinite,BD=yo.join,TD=$h(ue.keys,ue),Ie=Te.max,Ye=Te.min,ID=gt.now,OD=X.parseInt,Wh=Te.random,$D=yo.reverse,Mu=ri(X,"DataView"),ns=ri(X,"Map"),Nu=ri(X,"Promise"),Bi=ri(X,"Set"),is=ri(X,"WeakMap"),ss=ri(ue,"create"),Bo=is&&new is,Ti={},LD=ni(Mu),RD=ni(ns),PD=ni(Nu),zD=ni(Bi),qD=ni(is),To=Sn?Sn.prototype:e,os=To?To.valueOf:e,jh=To?To.toString:e;function B(o){if(De(o)&&!Ot(o)&&!(o instanceof Ut)){if(o instanceof Ar)return o;if(ie.call(o,"__wrapped__"))return Y0(o)}return new Ar(o)}var Ii=function(){function o(){}return function(u){if(!ye(u))return{};if(zh)return zh(u);o.prototype=u;var _=new o;return o.prototype=e,_}}();function Io(){}function Ar(o,u){this.__wrapped__=o,this.__actions__=[],this.__chain__=!!u,this.__index__=0,this.__values__=e}B.templateSettings={escape:Wa,evaluate:ja,interpolate:ho,variable:"",imports:{_:B}},B.prototype=Io.prototype,B.prototype.constructor=B,Ar.prototype=Ii(Io.prototype),Ar.prototype.constructor=Ar;function Ut(o){this.__wrapped__=o,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=ft,this.__views__=[]}function kD(){var o=new Ut(this.__wrapped__);return o.__actions__=tr(this.__actions__),o.__dir__=this.__dir__,o.__filtered__=this.__filtered__,o.__iteratees__=tr(this.__iteratees__),o.__takeCount__=this.__takeCount__,o.__views__=tr(this.__views__),o}function UD(){if(this.__filtered__){var o=new Ut(this);o.__dir__=-1,o.__filtered__=!0}else o=this.clone(),o.__dir__*=-1;return o}function WD(){var o=this.__wrapped__.value(),u=this.__dir__,_=Ot(o),y=u<0,A=_?o.length:0,I=eE(0,A,this.__views__),R=I.start,q=I.end,Y=q-R,Q=y?q:R-1,et=this.__iteratees__,ot=et.length,dt=0,wt=Ye(Y,this.__takeCount__);if(!_||!y&&A==Y&&wt==Y)return d0(o,this.__actions__);var Ct=[];t:for(;Y--&&dt<wt;){Q+=u;for(var Rt=-1,Ft=o[Q];++Rt<ot;){var kt=et[Rt],Wt=kt.iteratee,mr=kt.type,Je=Wt(Ft);if(mr==W)Ft=Je;else if(!Je){if(mr==k)continue t;break t}}Ct[dt++]=Ft}return Ct}Ut.prototype=Ii(Io.prototype),Ut.prototype.constructor=Ut;function Vn(o){var u=-1,_=o==null?0:o.length;for(this.clear();++u<_;){var y=o[u];this.set(y[0],y[1])}}function jD(){this.__data__=ss?ss(null):{},this.size=0}function YD(o){var u=this.has(o)&&delete this.__data__[o];return this.size-=u?1:0,u}function ZD(o){var u=this.__data__;if(ss){var _=u[o];return _===f?e:_}return ie.call(u,o)?u[o]:e}function GD(o){var u=this.__data__;return ss?u[o]!==e:ie.call(u,o)}function KD(o,u){var _=this.__data__;return this.size+=this.has(o)?0:1,_[o]=ss&&u===e?f:u,this}Vn.prototype.clear=jD,Vn.prototype.delete=YD,Vn.prototype.get=ZD,Vn.prototype.has=GD,Vn.prototype.set=KD;function sn(o){var u=-1,_=o==null?0:o.length;for(this.clear();++u<_;){var y=o[u];this.set(y[0],y[1])}}function HD(){this.__data__=[],this.size=0}function JD(o){var u=this.__data__,_=Oo(u,o);if(_<0)return!1;var y=u.length-1;return _==y?u.pop():Fo.call(u,_,1),--this.size,!0}function XD(o){var u=this.__data__,_=Oo(u,o);return _<0?e:u[_][1]}function VD(o){return Oo(this.__data__,o)>-1}function QD(o,u){var _=this.__data__,y=Oo(_,o);return y<0?(++this.size,_.push([o,u])):_[y][1]=u,this}sn.prototype.clear=HD,sn.prototype.delete=JD,sn.prototype.get=XD,sn.prototype.has=VD,sn.prototype.set=QD;function on(o){var u=-1,_=o==null?0:o.length;for(this.clear();++u<_;){var y=o[u];this.set(y[0],y[1])}}function tb(){this.size=0,this.__data__={hash:new Vn,map:new(ns||sn),string:new Vn}}function eb(o){var u=Zo(this,o).delete(o);return this.size-=u?1:0,u}function rb(o){return Zo(this,o).get(o)}function nb(o){return Zo(this,o).has(o)}function ib(o,u){var _=Zo(this,o),y=_.size;return _.set(o,u),this.size+=_.size==y?0:1,this}on.prototype.clear=tb,on.prototype.delete=eb,on.prototype.get=rb,on.prototype.has=nb,on.prototype.set=ib;function Qn(o){var u=-1,_=o==null?0:o.length;for(this.__data__=new on;++u<_;)this.add(o[u])}function sb(o){return this.__data__.set(o,f),this}function ob(o){return this.__data__.has(o)}Qn.prototype.add=Qn.prototype.push=sb,Qn.prototype.has=ob;function Pr(o){var u=this.__data__=new sn(o);this.size=u.size}function ab(){this.__data__=new sn,this.size=0}function ub(o){var u=this.__data__,_=u.delete(o);return this.size=u.size,_}function lb(o){return this.__data__.get(o)}function fb(o){return this.__data__.has(o)}function cb(o,u){var _=this.__data__;if(_ instanceof sn){var y=_.__data__;if(!ns||y.length<n-1)return y.push([o,u]),this.size=++_.size,this;_=this.__data__=new on(y)}return _.set(o,u),this.size=_.size,this}Pr.prototype.clear=ab,Pr.prototype.delete=ub,Pr.prototype.get=lb,Pr.prototype.has=fb,Pr.prototype.set=cb;function Yh(o,u){var _=Ot(o),y=!_&&ii(o),A=!_&&!y&&$n(o),I=!_&&!y&&!A&&Ri(o),R=_||y||A||I,q=R?Eu(o.length,DD):[],Y=q.length;for(var Q in o)(u||ie.call(o,Q))&&!(R&&(Q=="length"||A&&(Q=="offset"||Q=="parent")||I&&(Q=="buffer"||Q=="byteLength"||Q=="byteOffset")||fn(Q,Y)))&&q.push(Q);return q}function Zh(o){var u=o.length;return u?o[qu(0,u-1)]:e}function hb(o,u){return Go(tr(o),ti(u,0,o.length))}function pb(o){return Go(tr(o))}function Su(o,u,_){(_!==e&&!zr(o[u],_)||_===e&&!(u in o))&&an(o,u,_)}function as(o,u,_){var y=o[u];(!(ie.call(o,u)&&zr(y,_))||_===e&&!(u in o))&&an(o,u,_)}function Oo(o,u){for(var _=o.length;_--;)if(zr(o[_][0],u))return _;return-1}function db(o,u,_,y){return Bn(o,function(A,I,R){u(y,A,_(A),R)}),y}function Gh(o,u){return o&&Hr(u,Le(u),o)}function _b(o,u){return o&&Hr(u,rr(u),o)}function an(o,u,_){u=="__proto__"&&Mo?Mo(o,u,{configurable:!0,enumerable:!0,value:_,writable:!0}):o[u]=_}function Bu(o,u){for(var _=-1,y=u.length,A=J(y),I=o==null;++_<y;)A[_]=I?e:cl(o,u[_]);return A}function ti(o,u,_){return o===o&&(_!==e&&(o=o<=_?o:_),u!==e&&(o=o>=u?o:u)),o}function Cr(o,u,_,y,A,I){var R,q=u&c,Y=u&d,Q=u&g;if(_&&(R=A?_(o,y,A,I):_(o)),R!==e)return R;if(!ye(o))return o;var et=Ot(o);if(et){if(R=nE(o),!q)return tr(o,R)}else{var ot=Ze(o),dt=ot==Vt||ot==qt;if($n(o))return g0(o,q);if(ot==Se||ot==bt||dt&&!A){if(R=Y||dt?{}:L0(o),!q)return Y?Zb(o,_b(R,o)):Yb(o,Gh(R,o))}else{if(!fe[ot])return A?o:{};R=iE(o,ot,q)}}I||(I=new Pr);var wt=I.get(o);if(wt)return wt;I.set(o,R),cp(o)?o.forEach(function(Ft){R.add(Cr(Ft,u,_,Ft,o,I))}):lp(o)&&o.forEach(function(Ft,kt){R.set(kt,Cr(Ft,u,_,kt,o,I))});var Ct=Q?Y?Xu:Ju:Y?rr:Le,Rt=et?e:Ct(o);return Er(Rt||o,function(Ft,kt){Rt&&(kt=Ft,Ft=o[kt]),as(R,kt,Cr(Ft,u,_,kt,o,I))}),R}function mb(o){var u=Le(o);return function(_){return Kh(_,o,u)}}function Kh(o,u,_){var y=_.length;if(o==null)return!y;for(o=ue(o);y--;){var A=_[y],I=u[A],R=o[A];if(R===e&&!(A in o)||!I(R))return!1}return!0}function Hh(o,u,_){if(typeof o!="function")throw new xr(a);return ds(function(){o.apply(e,_)},u)}function us(o,u,_,y){var A=-1,I=go,R=!0,q=o.length,Y=[],Q=u.length;if(!q)return Y;_&&(u=me(u,pr(_))),y?(I=gu,R=!1):u.length>=n&&(I=es,R=!1,u=new Qn(u));t:for(;++A<q;){var et=o[A],ot=_==null?et:_(et);if(et=y||et!==0?et:0,R&&ot===ot){for(var dt=Q;dt--;)if(u[dt]===ot)continue t;Y.push(et)}else I(u,ot,y)||Y.push(et)}return Y}var Bn=b0(Kr),Jh=b0(Iu,!0);function gb(o,u){var _=!0;return Bn(o,function(y,A,I){return _=!!u(y,A,I),_}),_}function $o(o,u,_){for(var y=-1,A=o.length;++y<A;){var I=o[y],R=u(I);if(R!=null&&(q===e?R===R&&!_r(R):_(R,q)))var q=R,Y=I}return Y}function vb(o,u,_,y){var A=o.length;for(_=Lt(_),_<0&&(_=-_>A?0:A+_),y=y===e||y>A?A:Lt(y),y<0&&(y+=A),y=_>y?0:pp(y);_<y;)o[_++]=u;return o}function Xh(o,u){var _=[];return Bn(o,function(y,A,I){u(y,A,I)&&_.push(y)}),_}function ke(o,u,_,y,A){var I=-1,R=o.length;for(_||(_=oE),A||(A=[]);++I<R;){var q=o[I];u>0&&_(q)?u>1?ke(q,u-1,_,y,A):Mn(A,q):y||(A[A.length]=q)}return A}var Tu=E0(),Vh=E0(!0);function Kr(o,u){return o&&Tu(o,u,Le)}function Iu(o,u){return o&&Vh(o,u,Le)}function Lo(o,u){return Fn(u,function(_){return cn(o[_])})}function ei(o,u){u=In(u,o);for(var _=0,y=u.length;o!=null&&_<y;)o=o[Jr(u[_++])];return _&&_==y?o:e}function Qh(o,u,_){var y=u(o);return Ot(o)?y:Mn(y,_(o))}function Ke(o){return o==null?o===e?Z:ur:Xn&&Xn in ue(o)?tE(o):pE(o)}function Ou(o,u){return o>u}function wb(o,u){return o!=null&&ie.call(o,u)}function yb(o,u){return o!=null&&u in ue(o)}function Db(o,u,_){return o>=Ye(u,_)&&o<Ie(u,_)}function $u(o,u,_){for(var y=_?gu:go,A=o[0].length,I=o.length,R=I,q=J(I),Y=1/0,Q=[];R--;){var et=o[R];R&&u&&(et=me(et,pr(u))),Y=Ye(et.length,Y),q[R]=!_&&(u||A>=120&&et.length>=120)?new Qn(R&&et):e}et=o[0];var ot=-1,dt=q[0];t:for(;++ot<A&&Q.length<Y;){var wt=et[ot],Ct=u?u(wt):wt;if(wt=_||wt!==0?wt:0,!(dt?es(dt,Ct):y(Q,Ct,_))){for(R=I;--R;){var Rt=q[R];if(!(Rt?es(Rt,Ct):y(o[R],Ct,_)))continue t}dt&&dt.push(Ct),Q.push(wt)}}return Q}function bb(o,u,_,y){return Kr(o,function(A,I,R){u(y,_(A),I,R)}),y}function ls(o,u,_){u=In(u,o),o=q0(o,u);var y=o==null?o:o[Jr(Mr(u))];return y==null?e:hr(y,o,_)}function t0(o){return De(o)&&Ke(o)==bt}function Eb(o){return De(o)&&Ke(o)==st}function xb(o){return De(o)&&Ke(o)==It}function fs(o,u,_,y,A){return o===u?!0:o==null||u==null||!De(o)&&!De(u)?o!==o&&u!==u:Ab(o,u,_,y,fs,A)}function Ab(o,u,_,y,A,I){var R=Ot(o),q=Ot(u),Y=R?Bt:Ze(o),Q=q?Bt:Ze(u);Y=Y==bt?Se:Y,Q=Q==bt?Se:Q;var et=Y==Se,ot=Q==Se,dt=Y==Q;if(dt&&$n(o)){if(!$n(u))return!1;R=!0,et=!1}if(dt&&!et)return I||(I=new Pr),R||Ri(o)?I0(o,u,_,y,A,I):Vb(o,u,Y,_,y,A,I);if(!(_&w)){var wt=et&&ie.call(o,"__wrapped__"),Ct=ot&&ie.call(u,"__wrapped__");if(wt||Ct){var Rt=wt?o.value():o,Ft=Ct?u.value():u;return I||(I=new Pr),A(Rt,Ft,_,y,I)}}return dt?(I||(I=new Pr),Qb(o,u,_,y,A,I)):!1}function Cb(o){return De(o)&&Ze(o)==Kt}function Lu(o,u,_,y){var A=_.length,I=A,R=!y;if(o==null)return!I;for(o=ue(o);A--;){var q=_[A];if(R&&q[2]?q[1]!==o[q[0]]:!(q[0]in o))return!1}for(;++A<I;){q=_[A];var Y=q[0],Q=o[Y],et=q[1];if(R&&q[2]){if(Q===e&&!(Y in o))return!1}else{var ot=new Pr;if(y)var dt=y(Q,et,Y,o,u,ot);if(!(dt===e?fs(et,Q,w|m,y,ot):dt))return!1}}return!0}function e0(o){if(!ye(o)||uE(o))return!1;var u=cn(o)?CD:su;return u.test(ni(o))}function Fb(o){return De(o)&&Ke(o)==nn}function Mb(o){return De(o)&&Ze(o)==lr}function Nb(o){return De(o)&&Qo(o.length)&&!!he[Ke(o)]}function r0(o){return typeof o=="function"?o:o==null?nr:typeof o=="object"?Ot(o)?s0(o[0],o[1]):i0(o):xp(o)}function Ru(o){if(!ps(o))return TD(o);var u=[];for(var _ in ue(o))ie.call(o,_)&&_!="constructor"&&u.push(_);return u}function Sb(o){if(!ye(o))return hE(o);var u=ps(o),_=[];for(var y in o)y=="constructor"&&(u||!ie.call(o,y))||_.push(y);return _}function Pu(o,u){return o<u}function n0(o,u){var _=-1,y=er(o)?J(o.length):[];return Bn(o,function(A,I,R){y[++_]=u(A,I,R)}),y}function i0(o){var u=Qu(o);return u.length==1&&u[0][2]?P0(u[0][0],u[0][1]):function(_){return _===o||Lu(_,o,u)}}function s0(o,u){return el(o)&&R0(u)?P0(Jr(o),u):function(_){var y=cl(_,o);return y===e&&y===u?hl(_,o):fs(u,y,w|m)}}function Ro(o,u,_,y,A){o!==u&&Tu(u,function(I,R){if(A||(A=new Pr),ye(I))Bb(o,u,R,_,Ro,y,A);else{var q=y?y(nl(o,R),I,R+"",o,u,A):e;q===e&&(q=I),Su(o,R,q)}},rr)}function Bb(o,u,_,y,A,I,R){var q=nl(o,_),Y=nl(u,_),Q=R.get(Y);if(Q){Su(o,_,Q);return}var et=I?I(q,Y,_+"",o,u,R):e,ot=et===e;if(ot){var dt=Ot(Y),wt=!dt&&$n(Y),Ct=!dt&&!wt&&Ri(Y);et=Y,dt||wt||Ct?Ot(q)?et=q:xe(q)?et=tr(q):wt?(ot=!1,et=g0(Y,!0)):Ct?(ot=!1,et=v0(Y,!0)):et=[]:_s(Y)||ii(Y)?(et=q,ii(q)?et=dp(q):(!ye(q)||cn(q))&&(et=L0(Y))):ot=!1}ot&&(R.set(Y,et),A(et,Y,y,I,R),R.delete(Y)),Su(o,_,et)}function o0(o,u){var _=o.length;if(_)return u+=u<0?_:0,fn(u,_)?o[u]:e}function a0(o,u,_){u.length?u=me(u,function(I){return Ot(I)?function(R){return ei(R,I.length===1?I[0]:I)}:I}):u=[nr];var y=-1;u=me(u,pr(At()));var A=n0(o,function(I,R,q){var Y=me(u,function(Q){return Q(I)});return{criteria:Y,index:++y,value:I}});return iD(A,function(I,R){return jb(I,R,_)})}function Tb(o,u){return u0(o,u,function(_,y){return hl(o,y)})}function u0(o,u,_){for(var y=-1,A=u.length,I={};++y<A;){var R=u[y],q=ei(o,R);_(q,R)&&cs(I,In(R,o),q)}return I}function Ib(o){return function(u){return ei(u,o)}}function zu(o,u,_,y){var A=y?nD:Ci,I=-1,R=u.length,q=o;for(o===u&&(u=tr(u)),_&&(q=me(o,pr(_)));++I<R;)for(var Y=0,Q=u[I],et=_?_(Q):Q;(Y=A(q,et,Y,y))>-1;)q!==o&&Fo.call(q,Y,1),Fo.call(o,Y,1);return o}function l0(o,u){for(var _=o?u.length:0,y=_-1;_--;){var A=u[_];if(_==y||A!==I){var I=A;fn(A)?Fo.call(o,A,1):Wu(o,A)}}return o}function qu(o,u){return o+So(Wh()*(u-o+1))}function Ob(o,u,_,y){for(var A=-1,I=Ie(No((u-o)/(_||1)),0),R=J(I);I--;)R[y?I:++A]=o,o+=_;return R}function ku(o,u){var _="";if(!o||u<1||u>G)return _;do u%2&&(_+=o),u=So(u/2),u&&(o+=o);while(u);return _}function Pt(o,u){return il(z0(o,u,nr),o+"")}function $b(o){return Zh(Pi(o))}function Lb(o,u){var _=Pi(o);return Go(_,ti(u,0,_.length))}function cs(o,u,_,y){if(!ye(o))return o;u=In(u,o);for(var A=-1,I=u.length,R=I-1,q=o;q!=null&&++A<I;){var Y=Jr(u[A]),Q=_;if(Y==="__proto__"||Y==="constructor"||Y==="prototype")return o;if(A!=R){var et=q[Y];Q=y?y(et,Y,q):e,Q===e&&(Q=ye(et)?et:fn(u[A+1])?[]:{})}as(q,Y,Q),q=q[Y]}return o}var f0=Bo?function(o,u){return Bo.set(o,u),o}:nr,Rb=Mo?function(o,u){return Mo(o,"toString",{configurable:!0,enumerable:!1,value:dl(u),writable:!0})}:nr;function Pb(o){return Go(Pi(o))}function Fr(o,u,_){var y=-1,A=o.length;u<0&&(u=-u>A?0:A+u),_=_>A?A:_,_<0&&(_+=A),A=u>_?0:_-u>>>0,u>>>=0;for(var I=J(A);++y<A;)I[y]=o[y+u];return I}function zb(o,u){var _;return Bn(o,function(y,A,I){return _=u(y,A,I),!_}),!!_}function Po(o,u,_){var y=0,A=o==null?y:o.length;if(typeof u=="number"&&u===u&&A<=lt){for(;y<A;){var I=y+A>>>1,R=o[I];R!==null&&!_r(R)&&(_?R<=u:R<u)?y=I+1:A=I}return A}return Uu(o,u,nr,_)}function Uu(o,u,_,y){var A=0,I=o==null?0:o.length;if(I===0)return 0;u=_(u);for(var R=u!==u,q=u===null,Y=_r(u),Q=u===e;A<I;){var et=So((A+I)/2),ot=_(o[et]),dt=ot!==e,wt=ot===null,Ct=ot===ot,Rt=_r(ot);if(R)var Ft=y||Ct;else Q?Ft=Ct&&(y||dt):q?Ft=Ct&&dt&&(y||!wt):Y?Ft=Ct&&dt&&!wt&&(y||!Rt):wt||Rt?Ft=!1:Ft=y?ot<=u:ot<u;Ft?A=et+1:I=et}return Ye(I,vt)}function c0(o,u){for(var _=-1,y=o.length,A=0,I=[];++_<y;){var R=o[_],q=u?u(R):R;if(!_||!zr(q,Y)){var Y=q;I[A++]=R===0?0:R}}return I}function h0(o){return typeof o=="number"?o:_r(o)?tt:+o}function dr(o){if(typeof o=="string")return o;if(Ot(o))return me(o,dr)+"";if(_r(o))return jh?jh.call(o):"";var u=o+"";return u=="0"&&1/o==-K?"-0":u}function Tn(o,u,_){var y=-1,A=go,I=o.length,R=!0,q=[],Y=q;if(_)R=!1,A=gu;else if(I>=n){var Q=u?null:Jb(o);if(Q)return wo(Q);R=!1,A=es,Y=new Qn}else Y=u?[]:q;t:for(;++y<I;){var et=o[y],ot=u?u(et):et;if(et=_||et!==0?et:0,R&&ot===ot){for(var dt=Y.length;dt--;)if(Y[dt]===ot)continue t;u&&Y.push(ot),q.push(et)}else A(Y,ot,_)||(Y!==q&&Y.push(ot),q.push(et))}return q}function Wu(o,u){return u=In(u,o),o=q0(o,u),o==null||delete o[Jr(Mr(u))]}function p0(o,u,_,y){return cs(o,u,_(ei(o,u)),y)}function zo(o,u,_,y){for(var A=o.length,I=y?A:-1;(y?I--:++I<A)&&u(o[I],I,o););return _?Fr(o,y?0:I,y?I+1:A):Fr(o,y?I+1:0,y?A:I)}function d0(o,u){var _=o;return _ instanceof Ut&&(_=_.value()),vu(u,function(y,A){return A.func.apply(A.thisArg,Mn([y],A.args))},_)}function ju(o,u,_){var y=o.length;if(y<2)return y?Tn(o[0]):[];for(var A=-1,I=J(y);++A<y;)for(var R=o[A],q=-1;++q<y;)q!=A&&(I[A]=us(I[A]||R,o[q],u,_));return Tn(ke(I,1),u,_)}function _0(o,u,_){for(var y=-1,A=o.length,I=u.length,R={};++y<A;){var q=y<I?u[y]:e;_(R,o[y],q)}return R}function Yu(o){return xe(o)?o:[]}function Zu(o){return typeof o=="function"?o:nr}function In(o,u){return Ot(o)?o:el(o,u)?[o]:j0(te(o))}var qb=Pt;function On(o,u,_){var y=o.length;return _=_===e?y:_,!u&&_>=y?o:Fr(o,u,_)}var m0=FD||function(o){return qe.clearTimeout(o)};function g0(o,u){if(u)return o.slice();var _=o.length,y=Ph?Ph(_):new o.constructor(_);return o.copy(y),y}function Gu(o){var u=new o.constructor(o.byteLength);return new Ao(u).set(new Ao(o)),u}function kb(o,u){var _=u?Gu(o.buffer):o.buffer;return new o.constructor(_,o.byteOffset,o.byteLength)}function Ub(o){var u=new o.constructor(o.source,po.exec(o));return u.lastIndex=o.lastIndex,u}function Wb(o){return os?ue(os.call(o)):{}}function v0(o,u){var _=u?Gu(o.buffer):o.buffer;return new o.constructor(_,o.byteOffset,o.length)}function w0(o,u){if(o!==u){var _=o!==e,y=o===null,A=o===o,I=_r(o),R=u!==e,q=u===null,Y=u===u,Q=_r(u);if(!q&&!Q&&!I&&o>u||I&&R&&Y&&!q&&!Q||y&&R&&Y||!_&&Y||!A)return 1;if(!y&&!I&&!Q&&o<u||Q&&_&&A&&!y&&!I||q&&_&&A||!R&&A||!Y)return-1}return 0}function jb(o,u,_){for(var y=-1,A=o.criteria,I=u.criteria,R=A.length,q=_.length;++y<R;){var Y=w0(A[y],I[y]);if(Y){if(y>=q)return Y;var Q=_[y];return Y*(Q=="desc"?-1:1)}}return o.index-u.index}function y0(o,u,_,y){for(var A=-1,I=o.length,R=_.length,q=-1,Y=u.length,Q=Ie(I-R,0),et=J(Y+Q),ot=!y;++q<Y;)et[q]=u[q];for(;++A<R;)(ot||A<I)&&(et[_[A]]=o[A]);for(;Q--;)et[q++]=o[A++];return et}function D0(o,u,_,y){for(var A=-1,I=o.length,R=-1,q=_.length,Y=-1,Q=u.length,et=Ie(I-q,0),ot=J(et+Q),dt=!y;++A<et;)ot[A]=o[A];for(var wt=A;++Y<Q;)ot[wt+Y]=u[Y];for(;++R<q;)(dt||A<I)&&(ot[wt+_[R]]=o[A++]);return ot}function tr(o,u){var _=-1,y=o.length;for(u||(u=J(y));++_<y;)u[_]=o[_];return u}function Hr(o,u,_,y){var A=!_;_||(_={});for(var I=-1,R=u.length;++I<R;){var q=u[I],Y=y?y(_[q],o[q],q,_,o):e;Y===e&&(Y=o[q]),A?an(_,q,Y):as(_,q,Y)}return _}function Yb(o,u){return Hr(o,tl(o),u)}function Zb(o,u){return Hr(o,O0(o),u)}function qo(o,u){return function(_,y){var A=Ot(_)?Xy:db,I=u?u():{};return A(_,o,At(y,2),I)}}function Oi(o){return Pt(function(u,_){var y=-1,A=_.length,I=A>1?_[A-1]:e,R=A>2?_[2]:e;for(I=o.length>3&&typeof I=="function"?(A--,I):e,R&&He(_[0],_[1],R)&&(I=A<3?e:I,A=1),u=ue(u);++y<A;){var q=_[y];q&&o(u,q,y,I)}return u})}function b0(o,u){return function(_,y){if(_==null)return _;if(!er(_))return o(_,y);for(var A=_.length,I=u?A:-1,R=ue(_);(u?I--:++I<A)&&y(R[I],I,R)!==!1;);return _}}function E0(o){return function(u,_,y){for(var A=-1,I=ue(u),R=y(u),q=R.length;q--;){var Y=R[o?q:++A];if(_(I[Y],Y,I)===!1)break}return u}}function Gb(o,u,_){var y=u&D,A=hs(o);function I(){var R=this&&this!==qe&&this instanceof I?A:o;return R.apply(y?_:this,arguments)}return I}function x0(o){return function(u){u=te(u);var _=Fi(u)?Rr(u):e,y=_?_[0]:u.charAt(0),A=_?On(_,1).join(""):u.slice(1);return y[o]()+A}}function $i(o){return function(u){return vu(bp(Dp(u).replace(Ry,"")),o,"")}}function hs(o){return function(){var u=arguments;switch(u.length){case 0:return new o;case 1:return new o(u[0]);case 2:return new o(u[0],u[1]);case 3:return new o(u[0],u[1],u[2]);case 4:return new o(u[0],u[1],u[2],u[3]);case 5:return new o(u[0],u[1],u[2],u[3],u[4]);case 6:return new o(u[0],u[1],u[2],u[3],u[4],u[5]);case 7:return new o(u[0],u[1],u[2],u[3],u[4],u[5],u[6])}var _=Ii(o.prototype),y=o.apply(_,u);return ye(y)?y:_}}function Kb(o,u,_){var y=hs(o);function A(){for(var I=arguments.length,R=J(I),q=I,Y=Li(A);q--;)R[q]=arguments[q];var Q=I<3&&R[0]!==Y&&R[I-1]!==Y?[]:Nn(R,Y);if(I-=Q.length,I<_)return N0(o,u,ko,A.placeholder,e,R,Q,e,e,_-I);var et=this&&this!==qe&&this instanceof A?y:o;return hr(et,this,R)}return A}function A0(o){return function(u,_,y){var A=ue(u);if(!er(u)){var I=At(_,3);u=Le(u),_=function(q){return I(A[q],q,A)}}var R=o(u,_,y);return R>-1?A[I?u[R]:R]:e}}function C0(o){return ln(function(u){var _=u.length,y=_,A=Ar.prototype.thru;for(o&&u.reverse();y--;){var I=u[y];if(typeof I!="function")throw new xr(a);if(A&&!R&&Yo(I)=="wrapper")var R=new Ar([],!0)}for(y=R?y:_;++y<_;){I=u[y];var q=Yo(I),Y=q=="wrapper"?Vu(I):e;Y&&rl(Y[0])&&Y[1]==(M|b|x|S)&&!Y[4].length&&Y[9]==1?R=R[Yo(Y[0])].apply(R,Y[3]):R=I.length==1&&rl(I)?R[q]():R.thru(I)}return function(){var Q=arguments,et=Q[0];if(R&&Q.length==1&&Ot(et))return R.plant(et).value();for(var ot=0,dt=_?u[ot].apply(this,Q):et;++ot<_;)dt=u[ot].call(this,dt);return dt}})}function ko(o,u,_,y,A,I,R,q,Y,Q){var et=u&M,ot=u&D,dt=u&v,wt=u&(b|N),Ct=u&O,Rt=dt?e:hs(o);function Ft(){for(var kt=arguments.length,Wt=J(kt),mr=kt;mr--;)Wt[mr]=arguments[mr];if(wt)var Je=Li(Ft),gr=oD(Wt,Je);if(y&&(Wt=y0(Wt,y,A,wt)),I&&(Wt=D0(Wt,I,R,wt)),kt-=gr,wt&&kt<Q){var Ae=Nn(Wt,Je);return N0(o,u,ko,Ft.placeholder,_,Wt,Ae,q,Y,Q-kt)}var qr=ot?_:this,pn=dt?qr[o]:o;return kt=Wt.length,q?Wt=dE(Wt,q):Ct&&kt>1&&Wt.reverse(),et&&Y<kt&&(Wt.length=Y),this&&this!==qe&&this instanceof Ft&&(pn=Rt||hs(pn)),pn.apply(qr,Wt)}return Ft}function F0(o,u){return function(_,y){return bb(_,o,u(y),{})}}function Uo(o,u){return function(_,y){var A;if(_===e&&y===e)return u;if(_!==e&&(A=_),y!==e){if(A===e)return y;typeof _=="string"||typeof y=="string"?(_=dr(_),y=dr(y)):(_=h0(_),y=h0(y)),A=o(_,y)}return A}}function Ku(o){return ln(function(u){return u=me(u,pr(At())),Pt(function(_){var y=this;return o(u,function(A){return hr(A,y,_)})})})}function Wo(o,u){u=u===e?" ":dr(u);var _=u.length;if(_<2)return _?ku(u,o):u;var y=ku(u,No(o/Mi(u)));return Fi(u)?On(Rr(y),0,o).join(""):y.slice(0,o)}function Hb(o,u,_,y){var A=u&D,I=hs(o);function R(){for(var q=-1,Y=arguments.length,Q=-1,et=y.length,ot=J(et+Y),dt=this&&this!==qe&&this instanceof R?I:o;++Q<et;)ot[Q]=y[Q];for(;Y--;)ot[Q++]=arguments[++q];return hr(dt,A?_:this,ot)}return R}function M0(o){return function(u,_,y){return y&&typeof y!="number"&&He(u,_,y)&&(_=y=e),u=hn(u),_===e?(_=u,u=0):_=hn(_),y=y===e?u<_?1:-1:hn(y),Ob(u,_,y,o)}}function jo(o){return function(u,_){return typeof u=="string"&&typeof _=="string"||(u=Nr(u),_=Nr(_)),o(u,_)}}function N0(o,u,_,y,A,I,R,q,Y,Q){var et=u&b,ot=et?R:e,dt=et?e:R,wt=et?I:e,Ct=et?e:I;u|=et?x:F,u&=~(et?F:x),u&E||(u&=~(D|v));var Rt=[o,u,A,wt,ot,Ct,dt,q,Y,Q],Ft=_.apply(e,Rt);return rl(o)&&k0(Ft,Rt),Ft.placeholder=y,U0(Ft,o,u)}function Hu(o){var u=Te[o];return function(_,y){if(_=Nr(_),y=y==null?0:Ye(Lt(y),292),y&&Uh(_)){var A=(te(_)+"e").split("e"),I=u(A[0]+"e"+(+A[1]+y));return A=(te(I)+"e").split("e"),+(A[0]+"e"+(+A[1]-y))}return u(_)}}var Jb=Bi&&1/wo(new Bi([,-0]))[1]==K?function(o){return new Bi(o)}:gl;function S0(o){return function(u){var _=Ze(u);return _==Kt?Au(u):_==lr?pD(u):sD(u,o(u))}}function un(o,u,_,y,A,I,R,q){var Y=u&v;if(!Y&&typeof o!="function")throw new xr(a);var Q=y?y.length:0;if(Q||(u&=~(x|F),y=A=e),R=R===e?R:Ie(Lt(R),0),q=q===e?q:Lt(q),Q-=A?A.length:0,u&F){var et=y,ot=A;y=A=e}var dt=Y?e:Vu(o),wt=[o,u,_,y,A,et,ot,I,R,q];if(dt&&cE(wt,dt),o=wt[0],u=wt[1],_=wt[2],y=wt[3],A=wt[4],q=wt[9]=wt[9]===e?Y?0:o.length:Ie(wt[9]-Q,0),!q&&u&(b|N)&&(u&=~(b|N)),!u||u==D)var Ct=Gb(o,u,_);else u==b||u==N?Ct=Kb(o,u,q):(u==x||u==(D|x))&&!A.length?Ct=Hb(o,u,_,y):Ct=ko.apply(e,wt);var Rt=dt?f0:k0;return U0(Rt(Ct,wt),o,u)}function B0(o,u,_,y){return o===e||zr(o,Si[_])&&!ie.call(y,_)?u:o}function T0(o,u,_,y,A,I){return ye(o)&&ye(u)&&(I.set(u,o),Ro(o,u,e,T0,I),I.delete(u)),o}function Xb(o){return _s(o)?e:o}function I0(o,u,_,y,A,I){var R=_&w,q=o.length,Y=u.length;if(q!=Y&&!(R&&Y>q))return!1;var Q=I.get(o),et=I.get(u);if(Q&&et)return Q==u&&et==o;var ot=-1,dt=!0,wt=_&m?new Qn:e;for(I.set(o,u),I.set(u,o);++ot<q;){var Ct=o[ot],Rt=u[ot];if(y)var Ft=R?y(Rt,Ct,ot,u,o,I):y(Ct,Rt,ot,o,u,I);if(Ft!==e){if(Ft)continue;dt=!1;break}if(wt){if(!wu(u,function(kt,Wt){if(!es(wt,Wt)&&(Ct===kt||A(Ct,kt,_,y,I)))return wt.push(Wt)})){dt=!1;break}}else if(!(Ct===Rt||A(Ct,Rt,_,y,I))){dt=!1;break}}return I.delete(o),I.delete(u),dt}function Vb(o,u,_,y,A,I,R){switch(_){case rt:if(o.byteLength!=u.byteLength||o.byteOffset!=u.byteOffset)return!1;o=o.buffer,u=u.buffer;case st:return!(o.byteLength!=u.byteLength||!I(new Ao(o),new Ao(u)));case ne:case It:case Me:return zr(+o,+u);case se:return o.name==u.name&&o.message==u.message;case nn:case xn:return o==u+"";case Kt:var q=Au;case lr:var Y=y&w;if(q||(q=wo),o.size!=u.size&&!Y)return!1;var Q=R.get(o);if(Q)return Q==u;y|=m,R.set(o,u);var et=I0(q(o),q(u),y,A,I,R);return R.delete(o),et;case $:if(os)return os.call(o)==os.call(u)}return!1}function Qb(o,u,_,y,A,I){var R=_&w,q=Ju(o),Y=q.length,Q=Ju(u),et=Q.length;if(Y!=et&&!R)return!1;for(var ot=Y;ot--;){var dt=q[ot];if(!(R?dt in u:ie.call(u,dt)))return!1}var wt=I.get(o),Ct=I.get(u);if(wt&&Ct)return wt==u&&Ct==o;var Rt=!0;I.set(o,u),I.set(u,o);for(var Ft=R;++ot<Y;){dt=q[ot];var kt=o[dt],Wt=u[dt];if(y)var mr=R?y(Wt,kt,dt,u,o,I):y(kt,Wt,dt,o,u,I);if(!(mr===e?kt===Wt||A(kt,Wt,_,y,I):mr)){Rt=!1;break}Ft||(Ft=dt=="constructor")}if(Rt&&!Ft){var Je=o.constructor,gr=u.constructor;Je!=gr&&"constructor"in o&&"constructor"in u&&!(typeof Je=="function"&&Je instanceof Je&&typeof gr=="function"&&gr instanceof gr)&&(Rt=!1)}return I.delete(o),I.delete(u),Rt}function ln(o){return il(z0(o,e,K0),o+"")}function Ju(o){return Qh(o,Le,tl)}function Xu(o){return Qh(o,rr,O0)}var Vu=Bo?function(o){return Bo.get(o)}:gl;function Yo(o){for(var u=o.name+"",_=Ti[u],y=ie.call(Ti,u)?_.length:0;y--;){var A=_[y],I=A.func;if(I==null||I==o)return A.name}return u}function Li(o){var u=ie.call(B,"placeholder")?B:o;return u.placeholder}function At(){var o=B.iteratee||_l;return o=o===_l?r0:o,arguments.length?o(arguments[0],arguments[1]):o}function Zo(o,u){var _=o.__data__;return aE(u)?_[typeof u=="string"?"string":"hash"]:_.map}function Qu(o){for(var u=Le(o),_=u.length;_--;){var y=u[_],A=o[y];u[_]=[y,A,R0(A)]}return u}function ri(o,u){var _=fD(o,u);return e0(_)?_:e}function tE(o){var u=ie.call(o,Xn),_=o[Xn];try{o[Xn]=e;var y=!0}catch{}var A=Eo.call(o);return y&&(u?o[Xn]=_:delete o[Xn]),A}var tl=Fu?function(o){return o==null?[]:(o=ue(o),Fn(Fu(o),function(u){return qh.call(o,u)}))}:vl,O0=Fu?function(o){for(var u=[];o;)Mn(u,tl(o)),o=Co(o);return u}:vl,Ze=Ke;(Mu&&Ze(new Mu(new ArrayBuffer(1)))!=rt||ns&&Ze(new ns)!=Kt||Nu&&Ze(Nu.resolve())!=rn||Bi&&Ze(new Bi)!=lr||is&&Ze(new is)!=H)&&(Ze=function(o){var u=Ke(o),_=u==Se?o.constructor:e,y=_?ni(_):"";if(y)switch(y){case LD:return rt;case RD:return Kt;case PD:return rn;case zD:return lr;case qD:return H}return u});function eE(o,u,_){for(var y=-1,A=_.length;++y<A;){var I=_[y],R=I.size;switch(I.type){case"drop":o+=R;break;case"dropRight":u-=R;break;case"take":u=Ye(u,o+R);break;case"takeRight":o=Ie(o,u-R);break}}return{start:o,end:u}}function rE(o){var u=o.match(Xa);return u?u[1].split(Va):[]}function $0(o,u,_){u=In(u,o);for(var y=-1,A=u.length,I=!1;++y<A;){var R=Jr(u[y]);if(!(I=o!=null&&_(o,R)))break;o=o[R]}return I||++y!=A?I:(A=o==null?0:o.length,!!A&&Qo(A)&&fn(R,A)&&(Ot(o)||ii(o)))}function nE(o){var u=o.length,_=new o.constructor(u);return u&&typeof o[0]=="string"&&ie.call(o,"index")&&(_.index=o.index,_.input=o.input),_}function L0(o){return typeof o.constructor=="function"&&!ps(o)?Ii(Co(o)):{}}function iE(o,u,_){var y=o.constructor;switch(u){case st:return Gu(o);case ne:case It:return new y(+o);case rt:return kb(o,_);case ct:case ut:case ht:case at:case Ht:case Qt:case _e:case $e:case Be:return v0(o,_);case Kt:return new y;case Me:case xn:return new y(o);case nn:return Ub(o);case lr:return new y;case $:return Wb(o)}}function sE(o,u){var _=u.length;if(!_)return o;var y=_-1;return u[y]=(_>1?"& ":"")+u[y],u=u.join(_>2?", ":" "),o.replace(Ja,`{
|
8
|
+
*/Ln.exports,function(i,t){(function(){var e,r="4.17.21",n=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",l="Invalid `variable` option passed into `_.template`",f="__lodash_hash_undefined__",h=500,p="__lodash_placeholder__",c=1,d=2,g=4,w=1,m=2,D=1,v=2,E=4,b=8,N=16,x=32,F=64,M=128,S=256,O=512,C=30,T="...",L=800,U=16,k=1,W=2,P=3,K=1/0,G=9007199254740991,V=17976931348623157e292,tt=NaN,ft=4294967295,vt=ft-1,lt=ft>>>1,yt=[["ary",M],["bind",D],["bindKey",v],["curry",b],["curryRight",N],["flip",O],["partial",x],["partialRight",F],["rearg",S]],bt="[object Arguments]",Bt="[object Array]",Et="[object AsyncFunction]",ne="[object Boolean]",It="[object Date]",Nt="[object DOMException]",se="[object Error]",Qt="[object Function]",qt="[object GeneratorFunction]",Kt="[object Map]",Ne="[object Number]",ur="[object Null]",Be="[object Object]",rn="[object Promise]",En="[object Proxy]",nn="[object RegExp]",lr="[object Set]",xn="[object String]",$="[object Symbol]",Z="[object Undefined]",H="[object WeakMap]",nt="[object WeakSet]",st="[object ArrayBuffer]",rt="[object DataView]",ct="[object Float32Array]",ut="[object Float64Array]",ht="[object Int8Array]",at="[object Int16Array]",Ht="[object Int32Array]",te="[object Uint8Array]",_e="[object Uint8ClampedArray]",Le="[object Uint16Array]",Te="[object Uint32Array]",fr=/\b__p \+= '';/g,cr=/\b(__p \+=) '' \+/g,An=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Kn=/&(?:amp|lt|gt|quot|#39);/g,co=/[&<>"']/g,ka=RegExp(Kn.source),Ua=RegExp(co.source),Wa=/<%-([\s\S]+?)%>/g,ja=/<%([\s\S]+?)%>/g,ho=/<%=([\s\S]+?)%>/g,Ya=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Za=/^\w*$/,Ga=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Qi=/[\\^$.*+?()[\]{}|]/g,Ka=RegExp(Qi.source),ts=/^\s+/,Ha=/\s/,Ja=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Xa=/\{\n\/\* \[wrapped with (.+)\] \*/,Va=/,? & /,Qa=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,tu=/[()=,{}\[\]\/\s]/,eu=/\\(\\)?/g,ru=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,po=/\w*$/,nu=/^[-+]0x[0-9a-f]+$/i,iu=/^0b[01]+$/i,su=/^\[object .+?Constructor\]$/,ou=/^0o[0-7]+$/i,au=/^(?:0|[1-9]\d*)$/,uu=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ei=/($^)/,Hn=/['\n\r\u2028\u2029\\]/g,Yt="\\ud800-\\udfff",je="\\u0300-\\u036f",lu="\\ufe20-\\ufe2f",xi="\\u20d0-\\u20ff",Cn=je+lu+xi,_o="\\u2700-\\u27bf",ih="a-z\\xdf-\\xf6\\xf8-\\xff",xy="\\xac\\xb1\\xd7\\xf7",Ay="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Cy="\\u2000-\\u206f",Fy=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",sh="A-Z\\xc0-\\xd6\\xd8-\\xde",oh="\\ufe0e\\ufe0f",ah=xy+Ay+Cy+Fy,fu="['’]",My="["+Yt+"]",uh="["+ah+"]",mo="["+Cn+"]",lh="\\d+",Ny="["+_o+"]",fh="["+ih+"]",ch="[^"+Yt+ah+lh+_o+ih+sh+"]",cu="\\ud83c[\\udffb-\\udfff]",Sy="(?:"+mo+"|"+cu+")",hh="[^"+Yt+"]",hu="(?:\\ud83c[\\udde6-\\uddff]){2}",pu="[\\ud800-\\udbff][\\udc00-\\udfff]",Ai="["+sh+"]",ph="\\u200d",dh="(?:"+fh+"|"+ch+")",By="(?:"+Ai+"|"+ch+")",_h="(?:"+fu+"(?:d|ll|m|re|s|t|ve))?",mh="(?:"+fu+"(?:D|LL|M|RE|S|T|VE))?",gh=Sy+"?",vh="["+oh+"]?",Ty="(?:"+ph+"(?:"+[hh,hu,pu].join("|")+")"+vh+gh+")*",Iy="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Oy="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",wh=vh+gh+Ty,$y="(?:"+[Ny,hu,pu].join("|")+")"+wh,Ly="(?:"+[hh+mo+"?",mo,hu,pu,My].join("|")+")",Ry=RegExp(fu,"g"),Py=RegExp(mo,"g"),du=RegExp(cu+"(?="+cu+")|"+Ly+wh,"g"),zy=RegExp([Ai+"?"+fh+"+"+_h+"(?="+[uh,Ai,"$"].join("|")+")",By+"+"+mh+"(?="+[uh,Ai+dh,"$"].join("|")+")",Ai+"?"+dh+"+"+_h,Ai+"+"+mh,Oy,Iy,lh,$y].join("|"),"g"),qy=RegExp("["+ph+Yt+Cn+oh+"]"),ky=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Uy=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Wy=-1,he={};he[ct]=he[ut]=he[ht]=he[at]=he[Ht]=he[te]=he[_e]=he[Le]=he[Te]=!0,he[bt]=he[Bt]=he[st]=he[ne]=he[rt]=he[It]=he[se]=he[Qt]=he[Kt]=he[Ne]=he[Be]=he[nn]=he[lr]=he[xn]=he[H]=!1;var fe={};fe[bt]=fe[Bt]=fe[st]=fe[rt]=fe[ne]=fe[It]=fe[ct]=fe[ut]=fe[ht]=fe[at]=fe[Ht]=fe[Kt]=fe[Ne]=fe[Be]=fe[nn]=fe[lr]=fe[xn]=fe[$]=fe[te]=fe[_e]=fe[Le]=fe[Te]=!0,fe[se]=fe[Qt]=fe[H]=!1;var jy={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Yy={"&":"&","<":"<",">":">",'"':""","'":"'"},Zy={"&":"&","<":"<",">":">",""":'"',"'":"'"},Gy={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ky=parseFloat,Hy=parseInt,yh=typeof jt=="object"&&jt&&jt.Object===Object&&jt,Jy=typeof self=="object"&&self&&self.Object===Object&&self,qe=yh||Jy||Function("return this")(),_u=t&&!t.nodeType&&t,Jn=_u&&!0&&i&&!i.nodeType&&i,Dh=Jn&&Jn.exports===_u,mu=Dh&&yh.process,br=function(){try{var j=Jn&&Jn.require&&Jn.require("util").types;return j||mu&&mu.binding&&mu.binding("util")}catch{}}(),bh=br&&br.isArrayBuffer,Eh=br&&br.isDate,xh=br&&br.isMap,Ah=br&&br.isRegExp,Ch=br&&br.isSet,Fh=br&&br.isTypedArray;function hr(j,X,J){switch(J.length){case 0:return j.call(X);case 1:return j.call(X,J[0]);case 2:return j.call(X,J[0],J[1]);case 3:return j.call(X,J[0],J[1],J[2])}return j.apply(X,J)}function Xy(j,X,J,gt){for(var Tt=-1,Xt=j==null?0:j.length;++Tt<Xt;){var Ie=j[Tt];X(gt,Ie,J(Ie),j)}return gt}function Er(j,X){for(var J=-1,gt=j==null?0:j.length;++J<gt&&X(j[J],J,j)!==!1;);return j}function Vy(j,X){for(var J=j==null?0:j.length;J--&&X(j[J],J,j)!==!1;);return j}function Mh(j,X){for(var J=-1,gt=j==null?0:j.length;++J<gt;)if(!X(j[J],J,j))return!1;return!0}function Fn(j,X){for(var J=-1,gt=j==null?0:j.length,Tt=0,Xt=[];++J<gt;){var Ie=j[J];X(Ie,J,j)&&(Xt[Tt++]=Ie)}return Xt}function go(j,X){var J=j==null?0:j.length;return!!J&&Ci(j,X,0)>-1}function gu(j,X,J){for(var gt=-1,Tt=j==null?0:j.length;++gt<Tt;)if(J(X,j[gt]))return!0;return!1}function me(j,X){for(var J=-1,gt=j==null?0:j.length,Tt=Array(gt);++J<gt;)Tt[J]=X(j[J],J,j);return Tt}function Mn(j,X){for(var J=-1,gt=X.length,Tt=j.length;++J<gt;)j[Tt+J]=X[J];return j}function vu(j,X,J,gt){var Tt=-1,Xt=j==null?0:j.length;for(gt&&Xt&&(J=j[++Tt]);++Tt<Xt;)J=X(J,j[Tt],Tt,j);return J}function Qy(j,X,J,gt){var Tt=j==null?0:j.length;for(gt&&Tt&&(J=j[--Tt]);Tt--;)J=X(J,j[Tt],Tt,j);return J}function wu(j,X){for(var J=-1,gt=j==null?0:j.length;++J<gt;)if(X(j[J],J,j))return!0;return!1}var tD=yu("length");function eD(j){return j.split("")}function rD(j){return j.match(Qa)||[]}function Nh(j,X,J){var gt;return J(j,function(Tt,Xt,Ie){if(X(Tt,Xt,Ie))return gt=Xt,!1}),gt}function vo(j,X,J,gt){for(var Tt=j.length,Xt=J+(gt?1:-1);gt?Xt--:++Xt<Tt;)if(X(j[Xt],Xt,j))return Xt;return-1}function Ci(j,X,J){return X===X?dD(j,X,J):vo(j,Sh,J)}function nD(j,X,J,gt){for(var Tt=J-1,Xt=j.length;++Tt<Xt;)if(gt(j[Tt],X))return Tt;return-1}function Sh(j){return j!==j}function Bh(j,X){var J=j==null?0:j.length;return J?bu(j,X)/J:tt}function yu(j){return function(X){return X==null?e:X[j]}}function Du(j){return function(X){return j==null?e:j[X]}}function Th(j,X,J,gt,Tt){return Tt(j,function(Xt,Ie,ue){J=gt?(gt=!1,Xt):X(J,Xt,Ie,ue)}),J}function iD(j,X){var J=j.length;for(j.sort(X);J--;)j[J]=j[J].value;return j}function bu(j,X){for(var J,gt=-1,Tt=j.length;++gt<Tt;){var Xt=X(j[gt]);Xt!==e&&(J=J===e?Xt:J+Xt)}return J}function Eu(j,X){for(var J=-1,gt=Array(j);++J<j;)gt[J]=X(J);return gt}function sD(j,X){return me(X,function(J){return[J,j[J]]})}function Ih(j){return j&&j.slice(0,Rh(j)+1).replace(ts,"")}function pr(j){return function(X){return j(X)}}function xu(j,X){return me(X,function(J){return j[J]})}function es(j,X){return j.has(X)}function Oh(j,X){for(var J=-1,gt=j.length;++J<gt&&Ci(X,j[J],0)>-1;);return J}function $h(j,X){for(var J=j.length;J--&&Ci(X,j[J],0)>-1;);return J}function oD(j,X){for(var J=j.length,gt=0;J--;)j[J]===X&&++gt;return gt}var aD=Du(jy),uD=Du(Yy);function lD(j){return"\\"+Gy[j]}function fD(j,X){return j==null?e:j[X]}function Fi(j){return qy.test(j)}function cD(j){return ky.test(j)}function hD(j){for(var X,J=[];!(X=j.next()).done;)J.push(X.value);return J}function Au(j){var X=-1,J=Array(j.size);return j.forEach(function(gt,Tt){J[++X]=[Tt,gt]}),J}function Lh(j,X){return function(J){return j(X(J))}}function Nn(j,X){for(var J=-1,gt=j.length,Tt=0,Xt=[];++J<gt;){var Ie=j[J];(Ie===X||Ie===p)&&(j[J]=p,Xt[Tt++]=J)}return Xt}function wo(j){var X=-1,J=Array(j.size);return j.forEach(function(gt){J[++X]=gt}),J}function pD(j){var X=-1,J=Array(j.size);return j.forEach(function(gt){J[++X]=[gt,gt]}),J}function dD(j,X,J){for(var gt=J-1,Tt=j.length;++gt<Tt;)if(j[gt]===X)return gt;return-1}function _D(j,X,J){for(var gt=J+1;gt--;)if(j[gt]===X)return gt;return gt}function Mi(j){return Fi(j)?gD(j):tD(j)}function Rr(j){return Fi(j)?vD(j):eD(j)}function Rh(j){for(var X=j.length;X--&&Ha.test(j.charAt(X)););return X}var mD=Du(Zy);function gD(j){for(var X=du.lastIndex=0;du.test(j);)++X;return X}function vD(j){return j.match(du)||[]}function wD(j){return j.match(zy)||[]}var yD=function j(X){X=X==null?qe:Ni.defaults(qe.Object(),X,Ni.pick(qe,Uy));var J=X.Array,gt=X.Date,Tt=X.Error,Xt=X.Function,Ie=X.Math,ue=X.Object,Cu=X.RegExp,DD=X.String,xr=X.TypeError,yo=J.prototype,bD=Xt.prototype,Si=ue.prototype,Do=X["__core-js_shared__"],bo=bD.toString,ie=Si.hasOwnProperty,ED=0,Ph=function(){var o=/[^.]+$/.exec(Do&&Do.keys&&Do.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""}(),Eo=Si.toString,xD=bo.call(ue),AD=qe._,CD=Cu("^"+bo.call(ie).replace(Qi,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),xo=Dh?X.Buffer:e,Sn=X.Symbol,Ao=X.Uint8Array,zh=xo?xo.allocUnsafe:e,Co=Lh(ue.getPrototypeOf,ue),qh=ue.create,kh=Si.propertyIsEnumerable,Fo=yo.splice,Uh=Sn?Sn.isConcatSpreadable:e,rs=Sn?Sn.iterator:e,Xn=Sn?Sn.toStringTag:e,Mo=function(){try{var o=ri(ue,"defineProperty");return o({},"",{}),o}catch{}}(),FD=X.clearTimeout!==qe.clearTimeout&&X.clearTimeout,MD=gt&>.now!==qe.Date.now&>.now,ND=X.setTimeout!==qe.setTimeout&&X.setTimeout,No=Ie.ceil,So=Ie.floor,Fu=ue.getOwnPropertySymbols,SD=xo?xo.isBuffer:e,Wh=X.isFinite,BD=yo.join,TD=Lh(ue.keys,ue),Oe=Ie.max,Ye=Ie.min,ID=gt.now,OD=X.parseInt,jh=Ie.random,$D=yo.reverse,Mu=ri(X,"DataView"),ns=ri(X,"Map"),Nu=ri(X,"Promise"),Bi=ri(X,"Set"),is=ri(X,"WeakMap"),ss=ri(ue,"create"),Bo=is&&new is,Ti={},LD=ni(Mu),RD=ni(ns),PD=ni(Nu),zD=ni(Bi),qD=ni(is),To=Sn?Sn.prototype:e,os=To?To.valueOf:e,Yh=To?To.toString:e;function B(o){if(De(o)&&!Ot(o)&&!(o instanceof Ut)){if(o instanceof Ar)return o;if(ie.call(o,"__wrapped__"))return Z0(o)}return new Ar(o)}var Ii=function(){function o(){}return function(u){if(!ye(u))return{};if(qh)return qh(u);o.prototype=u;var _=new o;return o.prototype=e,_}}();function Io(){}function Ar(o,u){this.__wrapped__=o,this.__actions__=[],this.__chain__=!!u,this.__index__=0,this.__values__=e}B.templateSettings={escape:Wa,evaluate:ja,interpolate:ho,variable:"",imports:{_:B}},B.prototype=Io.prototype,B.prototype.constructor=B,Ar.prototype=Ii(Io.prototype),Ar.prototype.constructor=Ar;function Ut(o){this.__wrapped__=o,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=ft,this.__views__=[]}function kD(){var o=new Ut(this.__wrapped__);return o.__actions__=tr(this.__actions__),o.__dir__=this.__dir__,o.__filtered__=this.__filtered__,o.__iteratees__=tr(this.__iteratees__),o.__takeCount__=this.__takeCount__,o.__views__=tr(this.__views__),o}function UD(){if(this.__filtered__){var o=new Ut(this);o.__dir__=-1,o.__filtered__=!0}else o=this.clone(),o.__dir__*=-1;return o}function WD(){var o=this.__wrapped__.value(),u=this.__dir__,_=Ot(o),y=u<0,A=_?o.length:0,I=eE(0,A,this.__views__),R=I.start,q=I.end,Y=q-R,Q=y?q:R-1,et=this.__iteratees__,ot=et.length,dt=0,wt=Ye(Y,this.__takeCount__);if(!_||!y&&A==Y&&wt==Y)return _0(o,this.__actions__);var Ct=[];t:for(;Y--&&dt<wt;){Q+=u;for(var Rt=-1,Ft=o[Q];++Rt<ot;){var kt=et[Rt],Wt=kt.iteratee,mr=kt.type,Je=Wt(Ft);if(mr==W)Ft=Je;else if(!Je){if(mr==k)continue t;break t}}Ct[dt++]=Ft}return Ct}Ut.prototype=Ii(Io.prototype),Ut.prototype.constructor=Ut;function Vn(o){var u=-1,_=o==null?0:o.length;for(this.clear();++u<_;){var y=o[u];this.set(y[0],y[1])}}function jD(){this.__data__=ss?ss(null):{},this.size=0}function YD(o){var u=this.has(o)&&delete this.__data__[o];return this.size-=u?1:0,u}function ZD(o){var u=this.__data__;if(ss){var _=u[o];return _===f?e:_}return ie.call(u,o)?u[o]:e}function GD(o){var u=this.__data__;return ss?u[o]!==e:ie.call(u,o)}function KD(o,u){var _=this.__data__;return this.size+=this.has(o)?0:1,_[o]=ss&&u===e?f:u,this}Vn.prototype.clear=jD,Vn.prototype.delete=YD,Vn.prototype.get=ZD,Vn.prototype.has=GD,Vn.prototype.set=KD;function sn(o){var u=-1,_=o==null?0:o.length;for(this.clear();++u<_;){var y=o[u];this.set(y[0],y[1])}}function HD(){this.__data__=[],this.size=0}function JD(o){var u=this.__data__,_=Oo(u,o);if(_<0)return!1;var y=u.length-1;return _==y?u.pop():Fo.call(u,_,1),--this.size,!0}function XD(o){var u=this.__data__,_=Oo(u,o);return _<0?e:u[_][1]}function VD(o){return Oo(this.__data__,o)>-1}function QD(o,u){var _=this.__data__,y=Oo(_,o);return y<0?(++this.size,_.push([o,u])):_[y][1]=u,this}sn.prototype.clear=HD,sn.prototype.delete=JD,sn.prototype.get=XD,sn.prototype.has=VD,sn.prototype.set=QD;function on(o){var u=-1,_=o==null?0:o.length;for(this.clear();++u<_;){var y=o[u];this.set(y[0],y[1])}}function tb(){this.size=0,this.__data__={hash:new Vn,map:new(ns||sn),string:new Vn}}function eb(o){var u=Zo(this,o).delete(o);return this.size-=u?1:0,u}function rb(o){return Zo(this,o).get(o)}function nb(o){return Zo(this,o).has(o)}function ib(o,u){var _=Zo(this,o),y=_.size;return _.set(o,u),this.size+=_.size==y?0:1,this}on.prototype.clear=tb,on.prototype.delete=eb,on.prototype.get=rb,on.prototype.has=nb,on.prototype.set=ib;function Qn(o){var u=-1,_=o==null?0:o.length;for(this.__data__=new on;++u<_;)this.add(o[u])}function sb(o){return this.__data__.set(o,f),this}function ob(o){return this.__data__.has(o)}Qn.prototype.add=Qn.prototype.push=sb,Qn.prototype.has=ob;function Pr(o){var u=this.__data__=new sn(o);this.size=u.size}function ab(){this.__data__=new sn,this.size=0}function ub(o){var u=this.__data__,_=u.delete(o);return this.size=u.size,_}function lb(o){return this.__data__.get(o)}function fb(o){return this.__data__.has(o)}function cb(o,u){var _=this.__data__;if(_ instanceof sn){var y=_.__data__;if(!ns||y.length<n-1)return y.push([o,u]),this.size=++_.size,this;_=this.__data__=new on(y)}return _.set(o,u),this.size=_.size,this}Pr.prototype.clear=ab,Pr.prototype.delete=ub,Pr.prototype.get=lb,Pr.prototype.has=fb,Pr.prototype.set=cb;function Zh(o,u){var _=Ot(o),y=!_&&ii(o),A=!_&&!y&&$n(o),I=!_&&!y&&!A&&Ri(o),R=_||y||A||I,q=R?Eu(o.length,DD):[],Y=q.length;for(var Q in o)(u||ie.call(o,Q))&&!(R&&(Q=="length"||A&&(Q=="offset"||Q=="parent")||I&&(Q=="buffer"||Q=="byteLength"||Q=="byteOffset")||fn(Q,Y)))&&q.push(Q);return q}function Gh(o){var u=o.length;return u?o[qu(0,u-1)]:e}function hb(o,u){return Go(tr(o),ti(u,0,o.length))}function pb(o){return Go(tr(o))}function Su(o,u,_){(_!==e&&!zr(o[u],_)||_===e&&!(u in o))&&an(o,u,_)}function as(o,u,_){var y=o[u];(!(ie.call(o,u)&&zr(y,_))||_===e&&!(u in o))&&an(o,u,_)}function Oo(o,u){for(var _=o.length;_--;)if(zr(o[_][0],u))return _;return-1}function db(o,u,_,y){return Bn(o,function(A,I,R){u(y,A,_(A),R)}),y}function Kh(o,u){return o&&Hr(u,Re(u),o)}function _b(o,u){return o&&Hr(u,rr(u),o)}function an(o,u,_){u=="__proto__"&&Mo?Mo(o,u,{configurable:!0,enumerable:!0,value:_,writable:!0}):o[u]=_}function Bu(o,u){for(var _=-1,y=u.length,A=J(y),I=o==null;++_<y;)A[_]=I?e:cl(o,u[_]);return A}function ti(o,u,_){return o===o&&(_!==e&&(o=o<=_?o:_),u!==e&&(o=o>=u?o:u)),o}function Cr(o,u,_,y,A,I){var R,q=u&c,Y=u&d,Q=u&g;if(_&&(R=A?_(o,y,A,I):_(o)),R!==e)return R;if(!ye(o))return o;var et=Ot(o);if(et){if(R=nE(o),!q)return tr(o,R)}else{var ot=Ze(o),dt=ot==Qt||ot==qt;if($n(o))return v0(o,q);if(ot==Be||ot==bt||dt&&!A){if(R=Y||dt?{}:R0(o),!q)return Y?Zb(o,_b(R,o)):Yb(o,Kh(R,o))}else{if(!fe[ot])return A?o:{};R=iE(o,ot,q)}}I||(I=new Pr);var wt=I.get(o);if(wt)return wt;I.set(o,R),hp(o)?o.forEach(function(Ft){R.add(Cr(Ft,u,_,Ft,o,I))}):fp(o)&&o.forEach(function(Ft,kt){R.set(kt,Cr(Ft,u,_,kt,o,I))});var Ct=Q?Y?Xu:Ju:Y?rr:Re,Rt=et?e:Ct(o);return Er(Rt||o,function(Ft,kt){Rt&&(kt=Ft,Ft=o[kt]),as(R,kt,Cr(Ft,u,_,kt,o,I))}),R}function mb(o){var u=Re(o);return function(_){return Hh(_,o,u)}}function Hh(o,u,_){var y=_.length;if(o==null)return!y;for(o=ue(o);y--;){var A=_[y],I=u[A],R=o[A];if(R===e&&!(A in o)||!I(R))return!1}return!0}function Jh(o,u,_){if(typeof o!="function")throw new xr(a);return ds(function(){o.apply(e,_)},u)}function us(o,u,_,y){var A=-1,I=go,R=!0,q=o.length,Y=[],Q=u.length;if(!q)return Y;_&&(u=me(u,pr(_))),y?(I=gu,R=!1):u.length>=n&&(I=es,R=!1,u=new Qn(u));t:for(;++A<q;){var et=o[A],ot=_==null?et:_(et);if(et=y||et!==0?et:0,R&&ot===ot){for(var dt=Q;dt--;)if(u[dt]===ot)continue t;Y.push(et)}else I(u,ot,y)||Y.push(et)}return Y}var Bn=E0(Kr),Xh=E0(Iu,!0);function gb(o,u){var _=!0;return Bn(o,function(y,A,I){return _=!!u(y,A,I),_}),_}function $o(o,u,_){for(var y=-1,A=o.length;++y<A;){var I=o[y],R=u(I);if(R!=null&&(q===e?R===R&&!_r(R):_(R,q)))var q=R,Y=I}return Y}function vb(o,u,_,y){var A=o.length;for(_=Lt(_),_<0&&(_=-_>A?0:A+_),y=y===e||y>A?A:Lt(y),y<0&&(y+=A),y=_>y?0:dp(y);_<y;)o[_++]=u;return o}function Vh(o,u){var _=[];return Bn(o,function(y,A,I){u(y,A,I)&&_.push(y)}),_}function ke(o,u,_,y,A){var I=-1,R=o.length;for(_||(_=oE),A||(A=[]);++I<R;){var q=o[I];u>0&&_(q)?u>1?ke(q,u-1,_,y,A):Mn(A,q):y||(A[A.length]=q)}return A}var Tu=x0(),Qh=x0(!0);function Kr(o,u){return o&&Tu(o,u,Re)}function Iu(o,u){return o&&Qh(o,u,Re)}function Lo(o,u){return Fn(u,function(_){return cn(o[_])})}function ei(o,u){u=In(u,o);for(var _=0,y=u.length;o!=null&&_<y;)o=o[Jr(u[_++])];return _&&_==y?o:e}function t0(o,u,_){var y=u(o);return Ot(o)?y:Mn(y,_(o))}function Ke(o){return o==null?o===e?Z:ur:Xn&&Xn in ue(o)?tE(o):pE(o)}function Ou(o,u){return o>u}function wb(o,u){return o!=null&&ie.call(o,u)}function yb(o,u){return o!=null&&u in ue(o)}function Db(o,u,_){return o>=Ye(u,_)&&o<Oe(u,_)}function $u(o,u,_){for(var y=_?gu:go,A=o[0].length,I=o.length,R=I,q=J(I),Y=1/0,Q=[];R--;){var et=o[R];R&&u&&(et=me(et,pr(u))),Y=Ye(et.length,Y),q[R]=!_&&(u||A>=120&&et.length>=120)?new Qn(R&&et):e}et=o[0];var ot=-1,dt=q[0];t:for(;++ot<A&&Q.length<Y;){var wt=et[ot],Ct=u?u(wt):wt;if(wt=_||wt!==0?wt:0,!(dt?es(dt,Ct):y(Q,Ct,_))){for(R=I;--R;){var Rt=q[R];if(!(Rt?es(Rt,Ct):y(o[R],Ct,_)))continue t}dt&&dt.push(Ct),Q.push(wt)}}return Q}function bb(o,u,_,y){return Kr(o,function(A,I,R){u(y,_(A),I,R)}),y}function ls(o,u,_){u=In(u,o),o=k0(o,u);var y=o==null?o:o[Jr(Mr(u))];return y==null?e:hr(y,o,_)}function e0(o){return De(o)&&Ke(o)==bt}function Eb(o){return De(o)&&Ke(o)==st}function xb(o){return De(o)&&Ke(o)==It}function fs(o,u,_,y,A){return o===u?!0:o==null||u==null||!De(o)&&!De(u)?o!==o&&u!==u:Ab(o,u,_,y,fs,A)}function Ab(o,u,_,y,A,I){var R=Ot(o),q=Ot(u),Y=R?Bt:Ze(o),Q=q?Bt:Ze(u);Y=Y==bt?Be:Y,Q=Q==bt?Be:Q;var et=Y==Be,ot=Q==Be,dt=Y==Q;if(dt&&$n(o)){if(!$n(u))return!1;R=!0,et=!1}if(dt&&!et)return I||(I=new Pr),R||Ri(o)?O0(o,u,_,y,A,I):Vb(o,u,Y,_,y,A,I);if(!(_&w)){var wt=et&&ie.call(o,"__wrapped__"),Ct=ot&&ie.call(u,"__wrapped__");if(wt||Ct){var Rt=wt?o.value():o,Ft=Ct?u.value():u;return I||(I=new Pr),A(Rt,Ft,_,y,I)}}return dt?(I||(I=new Pr),Qb(o,u,_,y,A,I)):!1}function Cb(o){return De(o)&&Ze(o)==Kt}function Lu(o,u,_,y){var A=_.length,I=A,R=!y;if(o==null)return!I;for(o=ue(o);A--;){var q=_[A];if(R&&q[2]?q[1]!==o[q[0]]:!(q[0]in o))return!1}for(;++A<I;){q=_[A];var Y=q[0],Q=o[Y],et=q[1];if(R&&q[2]){if(Q===e&&!(Y in o))return!1}else{var ot=new Pr;if(y)var dt=y(Q,et,Y,o,u,ot);if(!(dt===e?fs(et,Q,w|m,y,ot):dt))return!1}}return!0}function r0(o){if(!ye(o)||uE(o))return!1;var u=cn(o)?CD:su;return u.test(ni(o))}function Fb(o){return De(o)&&Ke(o)==nn}function Mb(o){return De(o)&&Ze(o)==lr}function Nb(o){return De(o)&&Qo(o.length)&&!!he[Ke(o)]}function n0(o){return typeof o=="function"?o:o==null?nr:typeof o=="object"?Ot(o)?o0(o[0],o[1]):s0(o):Ap(o)}function Ru(o){if(!ps(o))return TD(o);var u=[];for(var _ in ue(o))ie.call(o,_)&&_!="constructor"&&u.push(_);return u}function Sb(o){if(!ye(o))return hE(o);var u=ps(o),_=[];for(var y in o)y=="constructor"&&(u||!ie.call(o,y))||_.push(y);return _}function Pu(o,u){return o<u}function i0(o,u){var _=-1,y=er(o)?J(o.length):[];return Bn(o,function(A,I,R){y[++_]=u(A,I,R)}),y}function s0(o){var u=Qu(o);return u.length==1&&u[0][2]?z0(u[0][0],u[0][1]):function(_){return _===o||Lu(_,o,u)}}function o0(o,u){return el(o)&&P0(u)?z0(Jr(o),u):function(_){var y=cl(_,o);return y===e&&y===u?hl(_,o):fs(u,y,w|m)}}function Ro(o,u,_,y,A){o!==u&&Tu(u,function(I,R){if(A||(A=new Pr),ye(I))Bb(o,u,R,_,Ro,y,A);else{var q=y?y(nl(o,R),I,R+"",o,u,A):e;q===e&&(q=I),Su(o,R,q)}},rr)}function Bb(o,u,_,y,A,I,R){var q=nl(o,_),Y=nl(u,_),Q=R.get(Y);if(Q){Su(o,_,Q);return}var et=I?I(q,Y,_+"",o,u,R):e,ot=et===e;if(ot){var dt=Ot(Y),wt=!dt&&$n(Y),Ct=!dt&&!wt&&Ri(Y);et=Y,dt||wt||Ct?Ot(q)?et=q:xe(q)?et=tr(q):wt?(ot=!1,et=v0(Y,!0)):Ct?(ot=!1,et=w0(Y,!0)):et=[]:_s(Y)||ii(Y)?(et=q,ii(q)?et=_p(q):(!ye(q)||cn(q))&&(et=R0(Y))):ot=!1}ot&&(R.set(Y,et),A(et,Y,y,I,R),R.delete(Y)),Su(o,_,et)}function a0(o,u){var _=o.length;if(_)return u+=u<0?_:0,fn(u,_)?o[u]:e}function u0(o,u,_){u.length?u=me(u,function(I){return Ot(I)?function(R){return ei(R,I.length===1?I[0]:I)}:I}):u=[nr];var y=-1;u=me(u,pr(At()));var A=i0(o,function(I,R,q){var Y=me(u,function(Q){return Q(I)});return{criteria:Y,index:++y,value:I}});return iD(A,function(I,R){return jb(I,R,_)})}function Tb(o,u){return l0(o,u,function(_,y){return hl(o,y)})}function l0(o,u,_){for(var y=-1,A=u.length,I={};++y<A;){var R=u[y],q=ei(o,R);_(q,R)&&cs(I,In(R,o),q)}return I}function Ib(o){return function(u){return ei(u,o)}}function zu(o,u,_,y){var A=y?nD:Ci,I=-1,R=u.length,q=o;for(o===u&&(u=tr(u)),_&&(q=me(o,pr(_)));++I<R;)for(var Y=0,Q=u[I],et=_?_(Q):Q;(Y=A(q,et,Y,y))>-1;)q!==o&&Fo.call(q,Y,1),Fo.call(o,Y,1);return o}function f0(o,u){for(var _=o?u.length:0,y=_-1;_--;){var A=u[_];if(_==y||A!==I){var I=A;fn(A)?Fo.call(o,A,1):Wu(o,A)}}return o}function qu(o,u){return o+So(jh()*(u-o+1))}function Ob(o,u,_,y){for(var A=-1,I=Oe(No((u-o)/(_||1)),0),R=J(I);I--;)R[y?I:++A]=o,o+=_;return R}function ku(o,u){var _="";if(!o||u<1||u>G)return _;do u%2&&(_+=o),u=So(u/2),u&&(o+=o);while(u);return _}function Pt(o,u){return il(q0(o,u,nr),o+"")}function $b(o){return Gh(Pi(o))}function Lb(o,u){var _=Pi(o);return Go(_,ti(u,0,_.length))}function cs(o,u,_,y){if(!ye(o))return o;u=In(u,o);for(var A=-1,I=u.length,R=I-1,q=o;q!=null&&++A<I;){var Y=Jr(u[A]),Q=_;if(Y==="__proto__"||Y==="constructor"||Y==="prototype")return o;if(A!=R){var et=q[Y];Q=y?y(et,Y,q):e,Q===e&&(Q=ye(et)?et:fn(u[A+1])?[]:{})}as(q,Y,Q),q=q[Y]}return o}var c0=Bo?function(o,u){return Bo.set(o,u),o}:nr,Rb=Mo?function(o,u){return Mo(o,"toString",{configurable:!0,enumerable:!1,value:dl(u),writable:!0})}:nr;function Pb(o){return Go(Pi(o))}function Fr(o,u,_){var y=-1,A=o.length;u<0&&(u=-u>A?0:A+u),_=_>A?A:_,_<0&&(_+=A),A=u>_?0:_-u>>>0,u>>>=0;for(var I=J(A);++y<A;)I[y]=o[y+u];return I}function zb(o,u){var _;return Bn(o,function(y,A,I){return _=u(y,A,I),!_}),!!_}function Po(o,u,_){var y=0,A=o==null?y:o.length;if(typeof u=="number"&&u===u&&A<=lt){for(;y<A;){var I=y+A>>>1,R=o[I];R!==null&&!_r(R)&&(_?R<=u:R<u)?y=I+1:A=I}return A}return Uu(o,u,nr,_)}function Uu(o,u,_,y){var A=0,I=o==null?0:o.length;if(I===0)return 0;u=_(u);for(var R=u!==u,q=u===null,Y=_r(u),Q=u===e;A<I;){var et=So((A+I)/2),ot=_(o[et]),dt=ot!==e,wt=ot===null,Ct=ot===ot,Rt=_r(ot);if(R)var Ft=y||Ct;else Q?Ft=Ct&&(y||dt):q?Ft=Ct&&dt&&(y||!wt):Y?Ft=Ct&&dt&&!wt&&(y||!Rt):wt||Rt?Ft=!1:Ft=y?ot<=u:ot<u;Ft?A=et+1:I=et}return Ye(I,vt)}function h0(o,u){for(var _=-1,y=o.length,A=0,I=[];++_<y;){var R=o[_],q=u?u(R):R;if(!_||!zr(q,Y)){var Y=q;I[A++]=R===0?0:R}}return I}function p0(o){return typeof o=="number"?o:_r(o)?tt:+o}function dr(o){if(typeof o=="string")return o;if(Ot(o))return me(o,dr)+"";if(_r(o))return Yh?Yh.call(o):"";var u=o+"";return u=="0"&&1/o==-K?"-0":u}function Tn(o,u,_){var y=-1,A=go,I=o.length,R=!0,q=[],Y=q;if(_)R=!1,A=gu;else if(I>=n){var Q=u?null:Jb(o);if(Q)return wo(Q);R=!1,A=es,Y=new Qn}else Y=u?[]:q;t:for(;++y<I;){var et=o[y],ot=u?u(et):et;if(et=_||et!==0?et:0,R&&ot===ot){for(var dt=Y.length;dt--;)if(Y[dt]===ot)continue t;u&&Y.push(ot),q.push(et)}else A(Y,ot,_)||(Y!==q&&Y.push(ot),q.push(et))}return q}function Wu(o,u){return u=In(u,o),o=k0(o,u),o==null||delete o[Jr(Mr(u))]}function d0(o,u,_,y){return cs(o,u,_(ei(o,u)),y)}function zo(o,u,_,y){for(var A=o.length,I=y?A:-1;(y?I--:++I<A)&&u(o[I],I,o););return _?Fr(o,y?0:I,y?I+1:A):Fr(o,y?I+1:0,y?A:I)}function _0(o,u){var _=o;return _ instanceof Ut&&(_=_.value()),vu(u,function(y,A){return A.func.apply(A.thisArg,Mn([y],A.args))},_)}function ju(o,u,_){var y=o.length;if(y<2)return y?Tn(o[0]):[];for(var A=-1,I=J(y);++A<y;)for(var R=o[A],q=-1;++q<y;)q!=A&&(I[A]=us(I[A]||R,o[q],u,_));return Tn(ke(I,1),u,_)}function m0(o,u,_){for(var y=-1,A=o.length,I=u.length,R={};++y<A;){var q=y<I?u[y]:e;_(R,o[y],q)}return R}function Yu(o){return xe(o)?o:[]}function Zu(o){return typeof o=="function"?o:nr}function In(o,u){return Ot(o)?o:el(o,u)?[o]:Y0(ee(o))}var qb=Pt;function On(o,u,_){var y=o.length;return _=_===e?y:_,!u&&_>=y?o:Fr(o,u,_)}var g0=FD||function(o){return qe.clearTimeout(o)};function v0(o,u){if(u)return o.slice();var _=o.length,y=zh?zh(_):new o.constructor(_);return o.copy(y),y}function Gu(o){var u=new o.constructor(o.byteLength);return new Ao(u).set(new Ao(o)),u}function kb(o,u){var _=u?Gu(o.buffer):o.buffer;return new o.constructor(_,o.byteOffset,o.byteLength)}function Ub(o){var u=new o.constructor(o.source,po.exec(o));return u.lastIndex=o.lastIndex,u}function Wb(o){return os?ue(os.call(o)):{}}function w0(o,u){var _=u?Gu(o.buffer):o.buffer;return new o.constructor(_,o.byteOffset,o.length)}function y0(o,u){if(o!==u){var _=o!==e,y=o===null,A=o===o,I=_r(o),R=u!==e,q=u===null,Y=u===u,Q=_r(u);if(!q&&!Q&&!I&&o>u||I&&R&&Y&&!q&&!Q||y&&R&&Y||!_&&Y||!A)return 1;if(!y&&!I&&!Q&&o<u||Q&&_&&A&&!y&&!I||q&&_&&A||!R&&A||!Y)return-1}return 0}function jb(o,u,_){for(var y=-1,A=o.criteria,I=u.criteria,R=A.length,q=_.length;++y<R;){var Y=y0(A[y],I[y]);if(Y){if(y>=q)return Y;var Q=_[y];return Y*(Q=="desc"?-1:1)}}return o.index-u.index}function D0(o,u,_,y){for(var A=-1,I=o.length,R=_.length,q=-1,Y=u.length,Q=Oe(I-R,0),et=J(Y+Q),ot=!y;++q<Y;)et[q]=u[q];for(;++A<R;)(ot||A<I)&&(et[_[A]]=o[A]);for(;Q--;)et[q++]=o[A++];return et}function b0(o,u,_,y){for(var A=-1,I=o.length,R=-1,q=_.length,Y=-1,Q=u.length,et=Oe(I-q,0),ot=J(et+Q),dt=!y;++A<et;)ot[A]=o[A];for(var wt=A;++Y<Q;)ot[wt+Y]=u[Y];for(;++R<q;)(dt||A<I)&&(ot[wt+_[R]]=o[A++]);return ot}function tr(o,u){var _=-1,y=o.length;for(u||(u=J(y));++_<y;)u[_]=o[_];return u}function Hr(o,u,_,y){var A=!_;_||(_={});for(var I=-1,R=u.length;++I<R;){var q=u[I],Y=y?y(_[q],o[q],q,_,o):e;Y===e&&(Y=o[q]),A?an(_,q,Y):as(_,q,Y)}return _}function Yb(o,u){return Hr(o,tl(o),u)}function Zb(o,u){return Hr(o,$0(o),u)}function qo(o,u){return function(_,y){var A=Ot(_)?Xy:db,I=u?u():{};return A(_,o,At(y,2),I)}}function Oi(o){return Pt(function(u,_){var y=-1,A=_.length,I=A>1?_[A-1]:e,R=A>2?_[2]:e;for(I=o.length>3&&typeof I=="function"?(A--,I):e,R&&He(_[0],_[1],R)&&(I=A<3?e:I,A=1),u=ue(u);++y<A;){var q=_[y];q&&o(u,q,y,I)}return u})}function E0(o,u){return function(_,y){if(_==null)return _;if(!er(_))return o(_,y);for(var A=_.length,I=u?A:-1,R=ue(_);(u?I--:++I<A)&&y(R[I],I,R)!==!1;);return _}}function x0(o){return function(u,_,y){for(var A=-1,I=ue(u),R=y(u),q=R.length;q--;){var Y=R[o?q:++A];if(_(I[Y],Y,I)===!1)break}return u}}function Gb(o,u,_){var y=u&D,A=hs(o);function I(){var R=this&&this!==qe&&this instanceof I?A:o;return R.apply(y?_:this,arguments)}return I}function A0(o){return function(u){u=ee(u);var _=Fi(u)?Rr(u):e,y=_?_[0]:u.charAt(0),A=_?On(_,1).join(""):u.slice(1);return y[o]()+A}}function $i(o){return function(u){return vu(Ep(bp(u).replace(Ry,"")),o,"")}}function hs(o){return function(){var u=arguments;switch(u.length){case 0:return new o;case 1:return new o(u[0]);case 2:return new o(u[0],u[1]);case 3:return new o(u[0],u[1],u[2]);case 4:return new o(u[0],u[1],u[2],u[3]);case 5:return new o(u[0],u[1],u[2],u[3],u[4]);case 6:return new o(u[0],u[1],u[2],u[3],u[4],u[5]);case 7:return new o(u[0],u[1],u[2],u[3],u[4],u[5],u[6])}var _=Ii(o.prototype),y=o.apply(_,u);return ye(y)?y:_}}function Kb(o,u,_){var y=hs(o);function A(){for(var I=arguments.length,R=J(I),q=I,Y=Li(A);q--;)R[q]=arguments[q];var Q=I<3&&R[0]!==Y&&R[I-1]!==Y?[]:Nn(R,Y);if(I-=Q.length,I<_)return S0(o,u,ko,A.placeholder,e,R,Q,e,e,_-I);var et=this&&this!==qe&&this instanceof A?y:o;return hr(et,this,R)}return A}function C0(o){return function(u,_,y){var A=ue(u);if(!er(u)){var I=At(_,3);u=Re(u),_=function(q){return I(A[q],q,A)}}var R=o(u,_,y);return R>-1?A[I?u[R]:R]:e}}function F0(o){return ln(function(u){var _=u.length,y=_,A=Ar.prototype.thru;for(o&&u.reverse();y--;){var I=u[y];if(typeof I!="function")throw new xr(a);if(A&&!R&&Yo(I)=="wrapper")var R=new Ar([],!0)}for(y=R?y:_;++y<_;){I=u[y];var q=Yo(I),Y=q=="wrapper"?Vu(I):e;Y&&rl(Y[0])&&Y[1]==(M|b|x|S)&&!Y[4].length&&Y[9]==1?R=R[Yo(Y[0])].apply(R,Y[3]):R=I.length==1&&rl(I)?R[q]():R.thru(I)}return function(){var Q=arguments,et=Q[0];if(R&&Q.length==1&&Ot(et))return R.plant(et).value();for(var ot=0,dt=_?u[ot].apply(this,Q):et;++ot<_;)dt=u[ot].call(this,dt);return dt}})}function ko(o,u,_,y,A,I,R,q,Y,Q){var et=u&M,ot=u&D,dt=u&v,wt=u&(b|N),Ct=u&O,Rt=dt?e:hs(o);function Ft(){for(var kt=arguments.length,Wt=J(kt),mr=kt;mr--;)Wt[mr]=arguments[mr];if(wt)var Je=Li(Ft),gr=oD(Wt,Je);if(y&&(Wt=D0(Wt,y,A,wt)),I&&(Wt=b0(Wt,I,R,wt)),kt-=gr,wt&&kt<Q){var Ae=Nn(Wt,Je);return S0(o,u,ko,Ft.placeholder,_,Wt,Ae,q,Y,Q-kt)}var qr=ot?_:this,pn=dt?qr[o]:o;return kt=Wt.length,q?Wt=dE(Wt,q):Ct&&kt>1&&Wt.reverse(),et&&Y<kt&&(Wt.length=Y),this&&this!==qe&&this instanceof Ft&&(pn=Rt||hs(pn)),pn.apply(qr,Wt)}return Ft}function M0(o,u){return function(_,y){return bb(_,o,u(y),{})}}function Uo(o,u){return function(_,y){var A;if(_===e&&y===e)return u;if(_!==e&&(A=_),y!==e){if(A===e)return y;typeof _=="string"||typeof y=="string"?(_=dr(_),y=dr(y)):(_=p0(_),y=p0(y)),A=o(_,y)}return A}}function Ku(o){return ln(function(u){return u=me(u,pr(At())),Pt(function(_){var y=this;return o(u,function(A){return hr(A,y,_)})})})}function Wo(o,u){u=u===e?" ":dr(u);var _=u.length;if(_<2)return _?ku(u,o):u;var y=ku(u,No(o/Mi(u)));return Fi(u)?On(Rr(y),0,o).join(""):y.slice(0,o)}function Hb(o,u,_,y){var A=u&D,I=hs(o);function R(){for(var q=-1,Y=arguments.length,Q=-1,et=y.length,ot=J(et+Y),dt=this&&this!==qe&&this instanceof R?I:o;++Q<et;)ot[Q]=y[Q];for(;Y--;)ot[Q++]=arguments[++q];return hr(dt,A?_:this,ot)}return R}function N0(o){return function(u,_,y){return y&&typeof y!="number"&&He(u,_,y)&&(_=y=e),u=hn(u),_===e?(_=u,u=0):_=hn(_),y=y===e?u<_?1:-1:hn(y),Ob(u,_,y,o)}}function jo(o){return function(u,_){return typeof u=="string"&&typeof _=="string"||(u=Nr(u),_=Nr(_)),o(u,_)}}function S0(o,u,_,y,A,I,R,q,Y,Q){var et=u&b,ot=et?R:e,dt=et?e:R,wt=et?I:e,Ct=et?e:I;u|=et?x:F,u&=~(et?F:x),u&E||(u&=~(D|v));var Rt=[o,u,A,wt,ot,Ct,dt,q,Y,Q],Ft=_.apply(e,Rt);return rl(o)&&U0(Ft,Rt),Ft.placeholder=y,W0(Ft,o,u)}function Hu(o){var u=Ie[o];return function(_,y){if(_=Nr(_),y=y==null?0:Ye(Lt(y),292),y&&Wh(_)){var A=(ee(_)+"e").split("e"),I=u(A[0]+"e"+(+A[1]+y));return A=(ee(I)+"e").split("e"),+(A[0]+"e"+(+A[1]-y))}return u(_)}}var Jb=Bi&&1/wo(new Bi([,-0]))[1]==K?function(o){return new Bi(o)}:gl;function B0(o){return function(u){var _=Ze(u);return _==Kt?Au(u):_==lr?pD(u):sD(u,o(u))}}function un(o,u,_,y,A,I,R,q){var Y=u&v;if(!Y&&typeof o!="function")throw new xr(a);var Q=y?y.length:0;if(Q||(u&=~(x|F),y=A=e),R=R===e?R:Oe(Lt(R),0),q=q===e?q:Lt(q),Q-=A?A.length:0,u&F){var et=y,ot=A;y=A=e}var dt=Y?e:Vu(o),wt=[o,u,_,y,A,et,ot,I,R,q];if(dt&&cE(wt,dt),o=wt[0],u=wt[1],_=wt[2],y=wt[3],A=wt[4],q=wt[9]=wt[9]===e?Y?0:o.length:Oe(wt[9]-Q,0),!q&&u&(b|N)&&(u&=~(b|N)),!u||u==D)var Ct=Gb(o,u,_);else u==b||u==N?Ct=Kb(o,u,q):(u==x||u==(D|x))&&!A.length?Ct=Hb(o,u,_,y):Ct=ko.apply(e,wt);var Rt=dt?c0:U0;return W0(Rt(Ct,wt),o,u)}function T0(o,u,_,y){return o===e||zr(o,Si[_])&&!ie.call(y,_)?u:o}function I0(o,u,_,y,A,I){return ye(o)&&ye(u)&&(I.set(u,o),Ro(o,u,e,I0,I),I.delete(u)),o}function Xb(o){return _s(o)?e:o}function O0(o,u,_,y,A,I){var R=_&w,q=o.length,Y=u.length;if(q!=Y&&!(R&&Y>q))return!1;var Q=I.get(o),et=I.get(u);if(Q&&et)return Q==u&&et==o;var ot=-1,dt=!0,wt=_&m?new Qn:e;for(I.set(o,u),I.set(u,o);++ot<q;){var Ct=o[ot],Rt=u[ot];if(y)var Ft=R?y(Rt,Ct,ot,u,o,I):y(Ct,Rt,ot,o,u,I);if(Ft!==e){if(Ft)continue;dt=!1;break}if(wt){if(!wu(u,function(kt,Wt){if(!es(wt,Wt)&&(Ct===kt||A(Ct,kt,_,y,I)))return wt.push(Wt)})){dt=!1;break}}else if(!(Ct===Rt||A(Ct,Rt,_,y,I))){dt=!1;break}}return I.delete(o),I.delete(u),dt}function Vb(o,u,_,y,A,I,R){switch(_){case rt:if(o.byteLength!=u.byteLength||o.byteOffset!=u.byteOffset)return!1;o=o.buffer,u=u.buffer;case st:return!(o.byteLength!=u.byteLength||!I(new Ao(o),new Ao(u)));case ne:case It:case Ne:return zr(+o,+u);case se:return o.name==u.name&&o.message==u.message;case nn:case xn:return o==u+"";case Kt:var q=Au;case lr:var Y=y&w;if(q||(q=wo),o.size!=u.size&&!Y)return!1;var Q=R.get(o);if(Q)return Q==u;y|=m,R.set(o,u);var et=O0(q(o),q(u),y,A,I,R);return R.delete(o),et;case $:if(os)return os.call(o)==os.call(u)}return!1}function Qb(o,u,_,y,A,I){var R=_&w,q=Ju(o),Y=q.length,Q=Ju(u),et=Q.length;if(Y!=et&&!R)return!1;for(var ot=Y;ot--;){var dt=q[ot];if(!(R?dt in u:ie.call(u,dt)))return!1}var wt=I.get(o),Ct=I.get(u);if(wt&&Ct)return wt==u&&Ct==o;var Rt=!0;I.set(o,u),I.set(u,o);for(var Ft=R;++ot<Y;){dt=q[ot];var kt=o[dt],Wt=u[dt];if(y)var mr=R?y(Wt,kt,dt,u,o,I):y(kt,Wt,dt,o,u,I);if(!(mr===e?kt===Wt||A(kt,Wt,_,y,I):mr)){Rt=!1;break}Ft||(Ft=dt=="constructor")}if(Rt&&!Ft){var Je=o.constructor,gr=u.constructor;Je!=gr&&"constructor"in o&&"constructor"in u&&!(typeof Je=="function"&&Je instanceof Je&&typeof gr=="function"&&gr instanceof gr)&&(Rt=!1)}return I.delete(o),I.delete(u),Rt}function ln(o){return il(q0(o,e,H0),o+"")}function Ju(o){return t0(o,Re,tl)}function Xu(o){return t0(o,rr,$0)}var Vu=Bo?function(o){return Bo.get(o)}:gl;function Yo(o){for(var u=o.name+"",_=Ti[u],y=ie.call(Ti,u)?_.length:0;y--;){var A=_[y],I=A.func;if(I==null||I==o)return A.name}return u}function Li(o){var u=ie.call(B,"placeholder")?B:o;return u.placeholder}function At(){var o=B.iteratee||_l;return o=o===_l?n0:o,arguments.length?o(arguments[0],arguments[1]):o}function Zo(o,u){var _=o.__data__;return aE(u)?_[typeof u=="string"?"string":"hash"]:_.map}function Qu(o){for(var u=Re(o),_=u.length;_--;){var y=u[_],A=o[y];u[_]=[y,A,P0(A)]}return u}function ri(o,u){var _=fD(o,u);return r0(_)?_:e}function tE(o){var u=ie.call(o,Xn),_=o[Xn];try{o[Xn]=e;var y=!0}catch{}var A=Eo.call(o);return y&&(u?o[Xn]=_:delete o[Xn]),A}var tl=Fu?function(o){return o==null?[]:(o=ue(o),Fn(Fu(o),function(u){return kh.call(o,u)}))}:vl,$0=Fu?function(o){for(var u=[];o;)Mn(u,tl(o)),o=Co(o);return u}:vl,Ze=Ke;(Mu&&Ze(new Mu(new ArrayBuffer(1)))!=rt||ns&&Ze(new ns)!=Kt||Nu&&Ze(Nu.resolve())!=rn||Bi&&Ze(new Bi)!=lr||is&&Ze(new is)!=H)&&(Ze=function(o){var u=Ke(o),_=u==Be?o.constructor:e,y=_?ni(_):"";if(y)switch(y){case LD:return rt;case RD:return Kt;case PD:return rn;case zD:return lr;case qD:return H}return u});function eE(o,u,_){for(var y=-1,A=_.length;++y<A;){var I=_[y],R=I.size;switch(I.type){case"drop":o+=R;break;case"dropRight":u-=R;break;case"take":u=Ye(u,o+R);break;case"takeRight":o=Oe(o,u-R);break}}return{start:o,end:u}}function rE(o){var u=o.match(Xa);return u?u[1].split(Va):[]}function L0(o,u,_){u=In(u,o);for(var y=-1,A=u.length,I=!1;++y<A;){var R=Jr(u[y]);if(!(I=o!=null&&_(o,R)))break;o=o[R]}return I||++y!=A?I:(A=o==null?0:o.length,!!A&&Qo(A)&&fn(R,A)&&(Ot(o)||ii(o)))}function nE(o){var u=o.length,_=new o.constructor(u);return u&&typeof o[0]=="string"&&ie.call(o,"index")&&(_.index=o.index,_.input=o.input),_}function R0(o){return typeof o.constructor=="function"&&!ps(o)?Ii(Co(o)):{}}function iE(o,u,_){var y=o.constructor;switch(u){case st:return Gu(o);case ne:case It:return new y(+o);case rt:return kb(o,_);case ct:case ut:case ht:case at:case Ht:case te:case _e:case Le:case Te:return w0(o,_);case Kt:return new y;case Ne:case xn:return new y(o);case nn:return Ub(o);case lr:return new y;case $:return Wb(o)}}function sE(o,u){var _=u.length;if(!_)return o;var y=_-1;return u[y]=(_>1?"& ":"")+u[y],u=u.join(_>2?", ":" "),o.replace(Ja,`{
|
9
9
|
/* [wrapped with `+u+`] */
|
10
|
-
`)}function oE(o){return Ot(o)||ii(o)||!!(kh&&o&&o[kh])}function fn(o,u){var _=typeof o;return u=u??G,!!u&&(_=="number"||_!="symbol"&&au.test(o))&&o>-1&&o%1==0&&o<u}function He(o,u,_){if(!ye(_))return!1;var y=typeof u;return(y=="number"?er(_)&&fn(u,_.length):y=="string"&&u in _)?zr(_[u],o):!1}function el(o,u){if(Ot(o))return!1;var _=typeof o;return _=="number"||_=="symbol"||_=="boolean"||o==null||_r(o)?!0:Za.test(o)||!Ya.test(o)||u!=null&&o in ue(u)}function aE(o){var u=typeof o;return u=="string"||u=="number"||u=="symbol"||u=="boolean"?o!=="__proto__":o===null}function rl(o){var u=Yo(o),_=B[u];if(typeof _!="function"||!(u in Ut.prototype))return!1;if(o===_)return!0;var y=Vu(_);return!!y&&o===y[0]}function uE(o){return!!Rh&&Rh in o}var lE=Do?cn:wl;function ps(o){var u=o&&o.constructor,_=typeof u=="function"&&u.prototype||Si;return o===_}function R0(o){return o===o&&!ye(o)}function P0(o,u){return function(_){return _==null?!1:_[o]===u&&(u!==e||o in ue(_))}}function fE(o){var u=Xo(o,function(y){return _.size===h&&_.clear(),y}),_=u.cache;return u}function cE(o,u){var _=o[1],y=u[1],A=_|y,I=A<(D|v|M),R=y==M&&_==b||y==M&&_==S&&o[7].length<=u[8]||y==(M|S)&&u[7].length<=u[8]&&_==b;if(!(I||R))return o;y&D&&(o[2]=u[2],A|=_&D?0:E);var q=u[3];if(q){var Y=o[3];o[3]=Y?y0(Y,q,u[4]):q,o[4]=Y?Nn(o[3],p):u[4]}return q=u[5],q&&(Y=o[5],o[5]=Y?D0(Y,q,u[6]):q,o[6]=Y?Nn(o[5],p):u[6]),q=u[7],q&&(o[7]=q),y&M&&(o[8]=o[8]==null?u[8]:Ye(o[8],u[8])),o[9]==null&&(o[9]=u[9]),o[0]=u[0],o[1]=A,o}function hE(o){var u=[];if(o!=null)for(var _ in ue(o))u.push(_);return u}function pE(o){return Eo.call(o)}function z0(o,u,_){return u=Ie(u===e?o.length-1:u,0),function(){for(var y=arguments,A=-1,I=Ie(y.length-u,0),R=J(I);++A<I;)R[A]=y[u+A];A=-1;for(var q=J(u+1);++A<u;)q[A]=y[A];return q[u]=_(R),hr(o,this,q)}}function q0(o,u){return u.length<2?o:ei(o,Fr(u,0,-1))}function dE(o,u){for(var _=o.length,y=Ye(u.length,_),A=tr(o);y--;){var I=u[y];o[y]=fn(I,_)?A[I]:e}return o}function nl(o,u){if(!(u==="constructor"&&typeof o[u]=="function")&&u!="__proto__")return o[u]}var k0=W0(f0),ds=ND||function(o,u){return qe.setTimeout(o,u)},il=W0(Rb);function U0(o,u,_){var y=u+"";return il(o,sE(y,_E(rE(y),_)))}function W0(o){var u=0,_=0;return function(){var y=ID(),A=U-(y-_);if(_=y,A>0){if(++u>=L)return arguments[0]}else u=0;return o.apply(e,arguments)}}function Go(o,u){var _=-1,y=o.length,A=y-1;for(u=u===e?y:u;++_<u;){var I=qu(_,A),R=o[I];o[I]=o[_],o[_]=R}return o.length=u,o}var j0=fE(function(o){var u=[];return o.charCodeAt(0)===46&&u.push(""),o.replace(Ga,function(_,y,A,I){u.push(A?I.replace(eu,"$1"):y||_)}),u});function Jr(o){if(typeof o=="string"||_r(o))return o;var u=o+"";return u=="0"&&1/o==-K?"-0":u}function ni(o){if(o!=null){try{return bo.call(o)}catch{}try{return o+""}catch{}}return""}function _E(o,u){return Er(yt,function(_){var y="_."+_[0];u&_[1]&&!go(o,y)&&o.push(y)}),o.sort()}function Y0(o){if(o instanceof Ut)return o.clone();var u=new Ar(o.__wrapped__,o.__chain__);return u.__actions__=tr(o.__actions__),u.__index__=o.__index__,u.__values__=o.__values__,u}function mE(o,u,_){(_?He(o,u,_):u===e)?u=1:u=Ie(Lt(u),0);var y=o==null?0:o.length;if(!y||u<1)return[];for(var A=0,I=0,R=J(No(y/u));A<y;)R[I++]=Fr(o,A,A+=u);return R}function gE(o){for(var u=-1,_=o==null?0:o.length,y=0,A=[];++u<_;){var I=o[u];I&&(A[y++]=I)}return A}function vE(){var o=arguments.length;if(!o)return[];for(var u=J(o-1),_=arguments[0],y=o;y--;)u[y-1]=arguments[y];return Mn(Ot(_)?tr(_):[_],ke(u,1))}var wE=Pt(function(o,u){return xe(o)?us(o,ke(u,1,xe,!0)):[]}),yE=Pt(function(o,u){var _=Mr(u);return xe(_)&&(_=e),xe(o)?us(o,ke(u,1,xe,!0),At(_,2)):[]}),DE=Pt(function(o,u){var _=Mr(u);return xe(_)&&(_=e),xe(o)?us(o,ke(u,1,xe,!0),e,_):[]});function bE(o,u,_){var y=o==null?0:o.length;return y?(u=_||u===e?1:Lt(u),Fr(o,u<0?0:u,y)):[]}function EE(o,u,_){var y=o==null?0:o.length;return y?(u=_||u===e?1:Lt(u),u=y-u,Fr(o,0,u<0?0:u)):[]}function xE(o,u){return o&&o.length?zo(o,At(u,3),!0,!0):[]}function AE(o,u){return o&&o.length?zo(o,At(u,3),!0):[]}function CE(o,u,_,y){var A=o==null?0:o.length;return A?(_&&typeof _!="number"&&He(o,u,_)&&(_=0,y=A),vb(o,u,_,y)):[]}function Z0(o,u,_){var y=o==null?0:o.length;if(!y)return-1;var A=_==null?0:Lt(_);return A<0&&(A=Ie(y+A,0)),vo(o,At(u,3),A)}function G0(o,u,_){var y=o==null?0:o.length;if(!y)return-1;var A=y-1;return _!==e&&(A=Lt(_),A=_<0?Ie(y+A,0):Ye(A,y-1)),vo(o,At(u,3),A,!0)}function K0(o){var u=o==null?0:o.length;return u?ke(o,1):[]}function FE(o){var u=o==null?0:o.length;return u?ke(o,K):[]}function ME(o,u){var _=o==null?0:o.length;return _?(u=u===e?1:Lt(u),ke(o,u)):[]}function NE(o){for(var u=-1,_=o==null?0:o.length,y={};++u<_;){var A=o[u];y[A[0]]=A[1]}return y}function H0(o){return o&&o.length?o[0]:e}function SE(o,u,_){var y=o==null?0:o.length;if(!y)return-1;var A=_==null?0:Lt(_);return A<0&&(A=Ie(y+A,0)),Ci(o,u,A)}function BE(o){var u=o==null?0:o.length;return u?Fr(o,0,-1):[]}var TE=Pt(function(o){var u=me(o,Yu);return u.length&&u[0]===o[0]?$u(u):[]}),IE=Pt(function(o){var u=Mr(o),_=me(o,Yu);return u===Mr(_)?u=e:_.pop(),_.length&&_[0]===o[0]?$u(_,At(u,2)):[]}),OE=Pt(function(o){var u=Mr(o),_=me(o,Yu);return u=typeof u=="function"?u:e,u&&_.pop(),_.length&&_[0]===o[0]?$u(_,e,u):[]});function $E(o,u){return o==null?"":BD.call(o,u)}function Mr(o){var u=o==null?0:o.length;return u?o[u-1]:e}function LE(o,u,_){var y=o==null?0:o.length;if(!y)return-1;var A=y;return _!==e&&(A=Lt(_),A=A<0?Ie(y+A,0):Ye(A,y-1)),u===u?_D(o,u,A):vo(o,Nh,A,!0)}function RE(o,u){return o&&o.length?o0(o,Lt(u)):e}var PE=Pt(J0);function J0(o,u){return o&&o.length&&u&&u.length?zu(o,u):o}function zE(o,u,_){return o&&o.length&&u&&u.length?zu(o,u,At(_,2)):o}function qE(o,u,_){return o&&o.length&&u&&u.length?zu(o,u,e,_):o}var kE=ln(function(o,u){var _=o==null?0:o.length,y=Bu(o,u);return l0(o,me(u,function(A){return fn(A,_)?+A:A}).sort(w0)),y});function UE(o,u){var _=[];if(!(o&&o.length))return _;var y=-1,A=[],I=o.length;for(u=At(u,3);++y<I;){var R=o[y];u(R,y,o)&&(_.push(R),A.push(y))}return l0(o,A),_}function sl(o){return o==null?o:$D.call(o)}function WE(o,u,_){var y=o==null?0:o.length;return y?(_&&typeof _!="number"&&He(o,u,_)?(u=0,_=y):(u=u==null?0:Lt(u),_=_===e?y:Lt(_)),Fr(o,u,_)):[]}function jE(o,u){return Po(o,u)}function YE(o,u,_){return Uu(o,u,At(_,2))}function ZE(o,u){var _=o==null?0:o.length;if(_){var y=Po(o,u);if(y<_&&zr(o[y],u))return y}return-1}function GE(o,u){return Po(o,u,!0)}function KE(o,u,_){return Uu(o,u,At(_,2),!0)}function HE(o,u){var _=o==null?0:o.length;if(_){var y=Po(o,u,!0)-1;if(zr(o[y],u))return y}return-1}function JE(o){return o&&o.length?c0(o):[]}function XE(o,u){return o&&o.length?c0(o,At(u,2)):[]}function VE(o){var u=o==null?0:o.length;return u?Fr(o,1,u):[]}function QE(o,u,_){return o&&o.length?(u=_||u===e?1:Lt(u),Fr(o,0,u<0?0:u)):[]}function tx(o,u,_){var y=o==null?0:o.length;return y?(u=_||u===e?1:Lt(u),u=y-u,Fr(o,u<0?0:u,y)):[]}function ex(o,u){return o&&o.length?zo(o,At(u,3),!1,!0):[]}function rx(o,u){return o&&o.length?zo(o,At(u,3)):[]}var nx=Pt(function(o){return Tn(ke(o,1,xe,!0))}),ix=Pt(function(o){var u=Mr(o);return xe(u)&&(u=e),Tn(ke(o,1,xe,!0),At(u,2))}),sx=Pt(function(o){var u=Mr(o);return u=typeof u=="function"?u:e,Tn(ke(o,1,xe,!0),e,u)});function ox(o){return o&&o.length?Tn(o):[]}function ax(o,u){return o&&o.length?Tn(o,At(u,2)):[]}function ux(o,u){return u=typeof u=="function"?u:e,o&&o.length?Tn(o,e,u):[]}function ol(o){if(!(o&&o.length))return[];var u=0;return o=Fn(o,function(_){if(xe(_))return u=Ie(_.length,u),!0}),Eu(u,function(_){return me(o,yu(_))})}function X0(o,u){if(!(o&&o.length))return[];var _=ol(o);return u==null?_:me(_,function(y){return hr(u,e,y)})}var lx=Pt(function(o,u){return xe(o)?us(o,u):[]}),fx=Pt(function(o){return ju(Fn(o,xe))}),cx=Pt(function(o){var u=Mr(o);return xe(u)&&(u=e),ju(Fn(o,xe),At(u,2))}),hx=Pt(function(o){var u=Mr(o);return u=typeof u=="function"?u:e,ju(Fn(o,xe),e,u)}),px=Pt(ol);function dx(o,u){return _0(o||[],u||[],as)}function _x(o,u){return _0(o||[],u||[],cs)}var mx=Pt(function(o){var u=o.length,_=u>1?o[u-1]:e;return _=typeof _=="function"?(o.pop(),_):e,X0(o,_)});function V0(o){var u=B(o);return u.__chain__=!0,u}function gx(o,u){return u(o),o}function Ko(o,u){return u(o)}var vx=ln(function(o){var u=o.length,_=u?o[0]:0,y=this.__wrapped__,A=function(I){return Bu(I,o)};return u>1||this.__actions__.length||!(y instanceof Ut)||!fn(_)?this.thru(A):(y=y.slice(_,+_+(u?1:0)),y.__actions__.push({func:Ko,args:[A],thisArg:e}),new Ar(y,this.__chain__).thru(function(I){return u&&!I.length&&I.push(e),I}))});function wx(){return V0(this)}function yx(){return new Ar(this.value(),this.__chain__)}function Dx(){this.__values__===e&&(this.__values__=hp(this.value()));var o=this.__index__>=this.__values__.length,u=o?e:this.__values__[this.__index__++];return{done:o,value:u}}function bx(){return this}function Ex(o){for(var u,_=this;_ instanceof Io;){var y=Y0(_);y.__index__=0,y.__values__=e,u?A.__wrapped__=y:u=y;var A=y;_=_.__wrapped__}return A.__wrapped__=o,u}function xx(){var o=this.__wrapped__;if(o instanceof Ut){var u=o;return this.__actions__.length&&(u=new Ut(this)),u=u.reverse(),u.__actions__.push({func:Ko,args:[sl],thisArg:e}),new Ar(u,this.__chain__)}return this.thru(sl)}function Ax(){return d0(this.__wrapped__,this.__actions__)}var Cx=qo(function(o,u,_){ie.call(o,_)?++o[_]:an(o,_,1)});function Fx(o,u,_){var y=Ot(o)?Fh:gb;return _&&He(o,u,_)&&(u=e),y(o,At(u,3))}function Mx(o,u){var _=Ot(o)?Fn:Xh;return _(o,At(u,3))}var Nx=A0(Z0),Sx=A0(G0);function Bx(o,u){return ke(Ho(o,u),1)}function Tx(o,u){return ke(Ho(o,u),K)}function Ix(o,u,_){return _=_===e?1:Lt(_),ke(Ho(o,u),_)}function Q0(o,u){var _=Ot(o)?Er:Bn;return _(o,At(u,3))}function tp(o,u){var _=Ot(o)?Vy:Jh;return _(o,At(u,3))}var Ox=qo(function(o,u,_){ie.call(o,_)?o[_].push(u):an(o,_,[u])});function $x(o,u,_,y){o=er(o)?o:Pi(o),_=_&&!y?Lt(_):0;var A=o.length;return _<0&&(_=Ie(A+_,0)),ta(o)?_<=A&&o.indexOf(u,_)>-1:!!A&&Ci(o,u,_)>-1}var Lx=Pt(function(o,u,_){var y=-1,A=typeof u=="function",I=er(o)?J(o.length):[];return Bn(o,function(R){I[++y]=A?hr(u,R,_):ls(R,u,_)}),I}),Rx=qo(function(o,u,_){an(o,_,u)});function Ho(o,u){var _=Ot(o)?me:n0;return _(o,At(u,3))}function Px(o,u,_,y){return o==null?[]:(Ot(u)||(u=u==null?[]:[u]),_=y?e:_,Ot(_)||(_=_==null?[]:[_]),a0(o,u,_))}var zx=qo(function(o,u,_){o[_?0:1].push(u)},function(){return[[],[]]});function qx(o,u,_){var y=Ot(o)?vu:Bh,A=arguments.length<3;return y(o,At(u,4),_,A,Bn)}function kx(o,u,_){var y=Ot(o)?Qy:Bh,A=arguments.length<3;return y(o,At(u,4),_,A,Jh)}function Ux(o,u){var _=Ot(o)?Fn:Xh;return _(o,Vo(At(u,3)))}function Wx(o){var u=Ot(o)?Zh:$b;return u(o)}function jx(o,u,_){(_?He(o,u,_):u===e)?u=1:u=Lt(u);var y=Ot(o)?hb:Lb;return y(o,u)}function Yx(o){var u=Ot(o)?pb:Pb;return u(o)}function Zx(o){if(o==null)return 0;if(er(o))return ta(o)?Mi(o):o.length;var u=Ze(o);return u==Kt||u==lr?o.size:Ru(o).length}function Gx(o,u,_){var y=Ot(o)?wu:zb;return _&&He(o,u,_)&&(u=e),y(o,At(u,3))}var Kx=Pt(function(o,u){if(o==null)return[];var _=u.length;return _>1&&He(o,u[0],u[1])?u=[]:_>2&&He(u[0],u[1],u[2])&&(u=[u[0]]),a0(o,ke(u,1),[])}),Jo=MD||function(){return qe.Date.now()};function Hx(o,u){if(typeof u!="function")throw new xr(a);return o=Lt(o),function(){if(--o<1)return u.apply(this,arguments)}}function ep(o,u,_){return u=_?e:u,u=o&&u==null?o.length:u,un(o,M,e,e,e,e,u)}function rp(o,u){var _;if(typeof u!="function")throw new xr(a);return o=Lt(o),function(){return--o>0&&(_=u.apply(this,arguments)),o<=1&&(u=e),_}}var al=Pt(function(o,u,_){var y=D;if(_.length){var A=Nn(_,Li(al));y|=x}return un(o,y,u,_,A)}),np=Pt(function(o,u,_){var y=D|v;if(_.length){var A=Nn(_,Li(np));y|=x}return un(u,y,o,_,A)});function ip(o,u,_){u=_?e:u;var y=un(o,b,e,e,e,e,e,u);return y.placeholder=ip.placeholder,y}function sp(o,u,_){u=_?e:u;var y=un(o,N,e,e,e,e,e,u);return y.placeholder=sp.placeholder,y}function op(o,u,_){var y,A,I,R,q,Y,Q=0,et=!1,ot=!1,dt=!0;if(typeof o!="function")throw new xr(a);u=Nr(u)||0,ye(_)&&(et=!!_.leading,ot="maxWait"in _,I=ot?Ie(Nr(_.maxWait)||0,u):I,dt="trailing"in _?!!_.trailing:dt);function wt(Ae){var qr=y,pn=A;return y=A=e,Q=Ae,R=o.apply(pn,qr),R}function Ct(Ae){return Q=Ae,q=ds(kt,u),et?wt(Ae):R}function Rt(Ae){var qr=Ae-Y,pn=Ae-Q,Ap=u-qr;return ot?Ye(Ap,I-pn):Ap}function Ft(Ae){var qr=Ae-Y,pn=Ae-Q;return Y===e||qr>=u||qr<0||ot&&pn>=I}function kt(){var Ae=Jo();if(Ft(Ae))return Wt(Ae);q=ds(kt,Rt(Ae))}function Wt(Ae){return q=e,dt&&y?wt(Ae):(y=A=e,R)}function mr(){q!==e&&m0(q),Q=0,y=Y=A=q=e}function Je(){return q===e?R:Wt(Jo())}function gr(){var Ae=Jo(),qr=Ft(Ae);if(y=arguments,A=this,Y=Ae,qr){if(q===e)return Ct(Y);if(ot)return m0(q),q=ds(kt,u),wt(Y)}return q===e&&(q=ds(kt,u)),R}return gr.cancel=mr,gr.flush=Je,gr}var Jx=Pt(function(o,u){return Hh(o,1,u)}),Xx=Pt(function(o,u,_){return Hh(o,Nr(u)||0,_)});function Vx(o){return un(o,O)}function Xo(o,u){if(typeof o!="function"||u!=null&&typeof u!="function")throw new xr(a);var _=function(){var y=arguments,A=u?u.apply(this,y):y[0],I=_.cache;if(I.has(A))return I.get(A);var R=o.apply(this,y);return _.cache=I.set(A,R)||I,R};return _.cache=new(Xo.Cache||on),_}Xo.Cache=on;function Vo(o){if(typeof o!="function")throw new xr(a);return function(){var u=arguments;switch(u.length){case 0:return!o.call(this);case 1:return!o.call(this,u[0]);case 2:return!o.call(this,u[0],u[1]);case 3:return!o.call(this,u[0],u[1],u[2])}return!o.apply(this,u)}}function Qx(o){return rp(2,o)}var tA=qb(function(o,u){u=u.length==1&&Ot(u[0])?me(u[0],pr(At())):me(ke(u,1),pr(At()));var _=u.length;return Pt(function(y){for(var A=-1,I=Ye(y.length,_);++A<I;)y[A]=u[A].call(this,y[A]);return hr(o,this,y)})}),ul=Pt(function(o,u){var _=Nn(u,Li(ul));return un(o,x,e,u,_)}),ap=Pt(function(o,u){var _=Nn(u,Li(ap));return un(o,F,e,u,_)}),eA=ln(function(o,u){return un(o,S,e,e,e,u)});function rA(o,u){if(typeof o!="function")throw new xr(a);return u=u===e?u:Lt(u),Pt(o,u)}function nA(o,u){if(typeof o!="function")throw new xr(a);return u=u==null?0:Ie(Lt(u),0),Pt(function(_){var y=_[u],A=On(_,0,u);return y&&Mn(A,y),hr(o,this,A)})}function iA(o,u,_){var y=!0,A=!0;if(typeof o!="function")throw new xr(a);return ye(_)&&(y="leading"in _?!!_.leading:y,A="trailing"in _?!!_.trailing:A),op(o,u,{leading:y,maxWait:u,trailing:A})}function sA(o){return ep(o,1)}function oA(o,u){return ul(Zu(u),o)}function aA(){if(!arguments.length)return[];var o=arguments[0];return Ot(o)?o:[o]}function uA(o){return Cr(o,g)}function lA(o,u){return u=typeof u=="function"?u:e,Cr(o,g,u)}function fA(o){return Cr(o,c|g)}function cA(o,u){return u=typeof u=="function"?u:e,Cr(o,c|g,u)}function hA(o,u){return u==null||Kh(o,u,Le(u))}function zr(o,u){return o===u||o!==o&&u!==u}var pA=jo(Ou),dA=jo(function(o,u){return o>=u}),ii=t0(function(){return arguments}())?t0:function(o){return De(o)&&ie.call(o,"callee")&&!qh.call(o,"callee")},Ot=J.isArray,_A=Dh?pr(Dh):Eb;function er(o){return o!=null&&Qo(o.length)&&!cn(o)}function xe(o){return De(o)&&er(o)}function mA(o){return o===!0||o===!1||De(o)&&Ke(o)==ne}var $n=SD||wl,gA=bh?pr(bh):xb;function vA(o){return De(o)&&o.nodeType===1&&!_s(o)}function wA(o){if(o==null)return!0;if(er(o)&&(Ot(o)||typeof o=="string"||typeof o.splice=="function"||$n(o)||Ri(o)||ii(o)))return!o.length;var u=Ze(o);if(u==Kt||u==lr)return!o.size;if(ps(o))return!Ru(o).length;for(var _ in o)if(ie.call(o,_))return!1;return!0}function yA(o,u){return fs(o,u)}function DA(o,u,_){_=typeof _=="function"?_:e;var y=_?_(o,u):e;return y===e?fs(o,u,e,_):!!y}function ll(o){if(!De(o))return!1;var u=Ke(o);return u==se||u==Nt||typeof o.message=="string"&&typeof o.name=="string"&&!_s(o)}function bA(o){return typeof o=="number"&&Uh(o)}function cn(o){if(!ye(o))return!1;var u=Ke(o);return u==Vt||u==qt||u==Et||u==En}function up(o){return typeof o=="number"&&o==Lt(o)}function Qo(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=G}function ye(o){var u=typeof o;return o!=null&&(u=="object"||u=="function")}function De(o){return o!=null&&typeof o=="object"}var lp=Eh?pr(Eh):Cb;function EA(o,u){return o===u||Lu(o,u,Qu(u))}function xA(o,u,_){return _=typeof _=="function"?_:e,Lu(o,u,Qu(u),_)}function AA(o){return fp(o)&&o!=+o}function CA(o){if(lE(o))throw new Tt(s);return e0(o)}function FA(o){return o===null}function MA(o){return o==null}function fp(o){return typeof o=="number"||De(o)&&Ke(o)==Me}function _s(o){if(!De(o)||Ke(o)!=Se)return!1;var u=Co(o);if(u===null)return!0;var _=ie.call(u,"constructor")&&u.constructor;return typeof _=="function"&&_ instanceof _&&bo.call(_)==xD}var fl=xh?pr(xh):Fb;function NA(o){return up(o)&&o>=-G&&o<=G}var cp=Ah?pr(Ah):Mb;function ta(o){return typeof o=="string"||!Ot(o)&&De(o)&&Ke(o)==xn}function _r(o){return typeof o=="symbol"||De(o)&&Ke(o)==$}var Ri=Ch?pr(Ch):Nb;function SA(o){return o===e}function BA(o){return De(o)&&Ze(o)==H}function TA(o){return De(o)&&Ke(o)==nt}var IA=jo(Pu),OA=jo(function(o,u){return o<=u});function hp(o){if(!o)return[];if(er(o))return ta(o)?Rr(o):tr(o);if(rs&&o[rs])return hD(o[rs]());var u=Ze(o),_=u==Kt?Au:u==lr?wo:Pi;return _(o)}function hn(o){if(!o)return o===0?o:0;if(o=Nr(o),o===K||o===-K){var u=o<0?-1:1;return u*V}return o===o?o:0}function Lt(o){var u=hn(o),_=u%1;return u===u?_?u-_:u:0}function pp(o){return o?ti(Lt(o),0,ft):0}function Nr(o){if(typeof o=="number")return o;if(_r(o))return tt;if(ye(o)){var u=typeof o.valueOf=="function"?o.valueOf():o;o=ye(u)?u+"":u}if(typeof o!="string")return o===0?o:+o;o=Th(o);var _=iu.test(o);return _||ou.test(o)?Hy(o.slice(2),_?2:8):nu.test(o)?tt:+o}function dp(o){return Hr(o,rr(o))}function $A(o){return o?ti(Lt(o),-G,G):o===0?o:0}function te(o){return o==null?"":dr(o)}var LA=Oi(function(o,u){if(ps(u)||er(u)){Hr(u,Le(u),o);return}for(var _ in u)ie.call(u,_)&&as(o,_,u[_])}),_p=Oi(function(o,u){Hr(u,rr(u),o)}),ea=Oi(function(o,u,_,y){Hr(u,rr(u),o,y)}),RA=Oi(function(o,u,_,y){Hr(u,Le(u),o,y)}),PA=ln(Bu);function zA(o,u){var _=Ii(o);return u==null?_:Gh(_,u)}var qA=Pt(function(o,u){o=ue(o);var _=-1,y=u.length,A=y>2?u[2]:e;for(A&&He(u[0],u[1],A)&&(y=1);++_<y;)for(var I=u[_],R=rr(I),q=-1,Y=R.length;++q<Y;){var Q=R[q],et=o[Q];(et===e||zr(et,Si[Q])&&!ie.call(o,Q))&&(o[Q]=I[Q])}return o}),kA=Pt(function(o){return o.push(e,T0),hr(mp,e,o)});function UA(o,u){return Mh(o,At(u,3),Kr)}function WA(o,u){return Mh(o,At(u,3),Iu)}function jA(o,u){return o==null?o:Tu(o,At(u,3),rr)}function YA(o,u){return o==null?o:Vh(o,At(u,3),rr)}function ZA(o,u){return o&&Kr(o,At(u,3))}function GA(o,u){return o&&Iu(o,At(u,3))}function KA(o){return o==null?[]:Lo(o,Le(o))}function HA(o){return o==null?[]:Lo(o,rr(o))}function cl(o,u,_){var y=o==null?e:ei(o,u);return y===e?_:y}function JA(o,u){return o!=null&&$0(o,u,wb)}function hl(o,u){return o!=null&&$0(o,u,yb)}var XA=F0(function(o,u,_){u!=null&&typeof u.toString!="function"&&(u=Eo.call(u)),o[u]=_},dl(nr)),VA=F0(function(o,u,_){u!=null&&typeof u.toString!="function"&&(u=Eo.call(u)),ie.call(o,u)?o[u].push(_):o[u]=[_]},At),QA=Pt(ls);function Le(o){return er(o)?Yh(o):Ru(o)}function rr(o){return er(o)?Yh(o,!0):Sb(o)}function tC(o,u){var _={};return u=At(u,3),Kr(o,function(y,A,I){an(_,u(y,A,I),y)}),_}function eC(o,u){var _={};return u=At(u,3),Kr(o,function(y,A,I){an(_,A,u(y,A,I))}),_}var rC=Oi(function(o,u,_){Ro(o,u,_)}),mp=Oi(function(o,u,_,y){Ro(o,u,_,y)}),nC=ln(function(o,u){var _={};if(o==null)return _;var y=!1;u=me(u,function(I){return I=In(I,o),y||(y=I.length>1),I}),Hr(o,Xu(o),_),y&&(_=Cr(_,c|d|g,Xb));for(var A=u.length;A--;)Wu(_,u[A]);return _});function iC(o,u){return gp(o,Vo(At(u)))}var sC=ln(function(o,u){return o==null?{}:Tb(o,u)});function gp(o,u){if(o==null)return{};var _=me(Xu(o),function(y){return[y]});return u=At(u),u0(o,_,function(y,A){return u(y,A[0])})}function oC(o,u,_){u=In(u,o);var y=-1,A=u.length;for(A||(A=1,o=e);++y<A;){var I=o==null?e:o[Jr(u[y])];I===e&&(y=A,I=_),o=cn(I)?I.call(o):I}return o}function aC(o,u,_){return o==null?o:cs(o,u,_)}function uC(o,u,_,y){return y=typeof y=="function"?y:e,o==null?o:cs(o,u,_,y)}var vp=S0(Le),wp=S0(rr);function lC(o,u,_){var y=Ot(o),A=y||$n(o)||Ri(o);if(u=At(u,4),_==null){var I=o&&o.constructor;A?_=y?new I:[]:ye(o)?_=cn(I)?Ii(Co(o)):{}:_={}}return(A?Er:Kr)(o,function(R,q,Y){return u(_,R,q,Y)}),_}function fC(o,u){return o==null?!0:Wu(o,u)}function cC(o,u,_){return o==null?o:p0(o,u,Zu(_))}function hC(o,u,_,y){return y=typeof y=="function"?y:e,o==null?o:p0(o,u,Zu(_),y)}function Pi(o){return o==null?[]:xu(o,Le(o))}function pC(o){return o==null?[]:xu(o,rr(o))}function dC(o,u,_){return _===e&&(_=u,u=e),_!==e&&(_=Nr(_),_=_===_?_:0),u!==e&&(u=Nr(u),u=u===u?u:0),ti(Nr(o),u,_)}function _C(o,u,_){return u=hn(u),_===e?(_=u,u=0):_=hn(_),o=Nr(o),Db(o,u,_)}function mC(o,u,_){if(_&&typeof _!="boolean"&&He(o,u,_)&&(u=_=e),_===e&&(typeof u=="boolean"?(_=u,u=e):typeof o=="boolean"&&(_=o,o=e)),o===e&&u===e?(o=0,u=1):(o=hn(o),u===e?(u=o,o=0):u=hn(u)),o>u){var y=o;o=u,u=y}if(_||o%1||u%1){var A=Wh();return Ye(o+A*(u-o+Ky("1e-"+((A+"").length-1))),u)}return qu(o,u)}var gC=$i(function(o,u,_){return u=u.toLowerCase(),o+(_?yp(u):u)});function yp(o){return pl(te(o).toLowerCase())}function Dp(o){return o=te(o),o&&o.replace(uu,aD).replace(Py,"")}function vC(o,u,_){o=te(o),u=dr(u);var y=o.length;_=_===e?y:ti(Lt(_),0,y);var A=_;return _-=u.length,_>=0&&o.slice(_,A)==u}function wC(o){return o=te(o),o&&Ua.test(o)?o.replace(co,uD):o}function yC(o){return o=te(o),o&&Ka.test(o)?o.replace(Qi,"\\$&"):o}var DC=$i(function(o,u,_){return o+(_?"-":"")+u.toLowerCase()}),bC=$i(function(o,u,_){return o+(_?" ":"")+u.toLowerCase()}),EC=x0("toLowerCase");function xC(o,u,_){o=te(o),u=Lt(u);var y=u?Mi(o):0;if(!u||y>=u)return o;var A=(u-y)/2;return Wo(So(A),_)+o+Wo(No(A),_)}function AC(o,u,_){o=te(o),u=Lt(u);var y=u?Mi(o):0;return u&&y<u?o+Wo(u-y,_):o}function CC(o,u,_){o=te(o),u=Lt(u);var y=u?Mi(o):0;return u&&y<u?Wo(u-y,_)+o:o}function FC(o,u,_){return _||u==null?u=0:u&&(u=+u),OD(te(o).replace(ts,""),u||0)}function MC(o,u,_){return(_?He(o,u,_):u===e)?u=1:u=Lt(u),ku(te(o),u)}function NC(){var o=arguments,u=te(o[0]);return o.length<3?u:u.replace(o[1],o[2])}var SC=$i(function(o,u,_){return o+(_?"_":"")+u.toLowerCase()});function BC(o,u,_){return _&&typeof _!="number"&&He(o,u,_)&&(u=_=e),_=_===e?ft:_>>>0,_?(o=te(o),o&&(typeof u=="string"||u!=null&&!fl(u))&&(u=dr(u),!u&&Fi(o))?On(Rr(o),0,_):o.split(u,_)):[]}var TC=$i(function(o,u,_){return o+(_?" ":"")+pl(u)});function IC(o,u,_){return o=te(o),_=_==null?0:ti(Lt(_),0,o.length),u=dr(u),o.slice(_,_+u.length)==u}function OC(o,u,_){var y=B.templateSettings;_&&He(o,u,_)&&(u=e),o=te(o),u=ea({},u,y,B0);var A=ea({},u.imports,y.imports,B0),I=Le(A),R=xu(A,I),q,Y,Q=0,et=u.interpolate||Ei,ot="__p += '",dt=Cu((u.escape||Ei).source+"|"+et.source+"|"+(et===ho?ru:Ei).source+"|"+(u.evaluate||Ei).source+"|$","g"),wt="//# sourceURL="+(ie.call(u,"sourceURL")?(u.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Wy+"]")+`
|
10
|
+
`)}function oE(o){return Ot(o)||ii(o)||!!(Uh&&o&&o[Uh])}function fn(o,u){var _=typeof o;return u=u??G,!!u&&(_=="number"||_!="symbol"&&au.test(o))&&o>-1&&o%1==0&&o<u}function He(o,u,_){if(!ye(_))return!1;var y=typeof u;return(y=="number"?er(_)&&fn(u,_.length):y=="string"&&u in _)?zr(_[u],o):!1}function el(o,u){if(Ot(o))return!1;var _=typeof o;return _=="number"||_=="symbol"||_=="boolean"||o==null||_r(o)?!0:Za.test(o)||!Ya.test(o)||u!=null&&o in ue(u)}function aE(o){var u=typeof o;return u=="string"||u=="number"||u=="symbol"||u=="boolean"?o!=="__proto__":o===null}function rl(o){var u=Yo(o),_=B[u];if(typeof _!="function"||!(u in Ut.prototype))return!1;if(o===_)return!0;var y=Vu(_);return!!y&&o===y[0]}function uE(o){return!!Ph&&Ph in o}var lE=Do?cn:wl;function ps(o){var u=o&&o.constructor,_=typeof u=="function"&&u.prototype||Si;return o===_}function P0(o){return o===o&&!ye(o)}function z0(o,u){return function(_){return _==null?!1:_[o]===u&&(u!==e||o in ue(_))}}function fE(o){var u=Xo(o,function(y){return _.size===h&&_.clear(),y}),_=u.cache;return u}function cE(o,u){var _=o[1],y=u[1],A=_|y,I=A<(D|v|M),R=y==M&&_==b||y==M&&_==S&&o[7].length<=u[8]||y==(M|S)&&u[7].length<=u[8]&&_==b;if(!(I||R))return o;y&D&&(o[2]=u[2],A|=_&D?0:E);var q=u[3];if(q){var Y=o[3];o[3]=Y?D0(Y,q,u[4]):q,o[4]=Y?Nn(o[3],p):u[4]}return q=u[5],q&&(Y=o[5],o[5]=Y?b0(Y,q,u[6]):q,o[6]=Y?Nn(o[5],p):u[6]),q=u[7],q&&(o[7]=q),y&M&&(o[8]=o[8]==null?u[8]:Ye(o[8],u[8])),o[9]==null&&(o[9]=u[9]),o[0]=u[0],o[1]=A,o}function hE(o){var u=[];if(o!=null)for(var _ in ue(o))u.push(_);return u}function pE(o){return Eo.call(o)}function q0(o,u,_){return u=Oe(u===e?o.length-1:u,0),function(){for(var y=arguments,A=-1,I=Oe(y.length-u,0),R=J(I);++A<I;)R[A]=y[u+A];A=-1;for(var q=J(u+1);++A<u;)q[A]=y[A];return q[u]=_(R),hr(o,this,q)}}function k0(o,u){return u.length<2?o:ei(o,Fr(u,0,-1))}function dE(o,u){for(var _=o.length,y=Ye(u.length,_),A=tr(o);y--;){var I=u[y];o[y]=fn(I,_)?A[I]:e}return o}function nl(o,u){if(!(u==="constructor"&&typeof o[u]=="function")&&u!="__proto__")return o[u]}var U0=j0(c0),ds=ND||function(o,u){return qe.setTimeout(o,u)},il=j0(Rb);function W0(o,u,_){var y=u+"";return il(o,sE(y,_E(rE(y),_)))}function j0(o){var u=0,_=0;return function(){var y=ID(),A=U-(y-_);if(_=y,A>0){if(++u>=L)return arguments[0]}else u=0;return o.apply(e,arguments)}}function Go(o,u){var _=-1,y=o.length,A=y-1;for(u=u===e?y:u;++_<u;){var I=qu(_,A),R=o[I];o[I]=o[_],o[_]=R}return o.length=u,o}var Y0=fE(function(o){var u=[];return o.charCodeAt(0)===46&&u.push(""),o.replace(Ga,function(_,y,A,I){u.push(A?I.replace(eu,"$1"):y||_)}),u});function Jr(o){if(typeof o=="string"||_r(o))return o;var u=o+"";return u=="0"&&1/o==-K?"-0":u}function ni(o){if(o!=null){try{return bo.call(o)}catch{}try{return o+""}catch{}}return""}function _E(o,u){return Er(yt,function(_){var y="_."+_[0];u&_[1]&&!go(o,y)&&o.push(y)}),o.sort()}function Z0(o){if(o instanceof Ut)return o.clone();var u=new Ar(o.__wrapped__,o.__chain__);return u.__actions__=tr(o.__actions__),u.__index__=o.__index__,u.__values__=o.__values__,u}function mE(o,u,_){(_?He(o,u,_):u===e)?u=1:u=Oe(Lt(u),0);var y=o==null?0:o.length;if(!y||u<1)return[];for(var A=0,I=0,R=J(No(y/u));A<y;)R[I++]=Fr(o,A,A+=u);return R}function gE(o){for(var u=-1,_=o==null?0:o.length,y=0,A=[];++u<_;){var I=o[u];I&&(A[y++]=I)}return A}function vE(){var o=arguments.length;if(!o)return[];for(var u=J(o-1),_=arguments[0],y=o;y--;)u[y-1]=arguments[y];return Mn(Ot(_)?tr(_):[_],ke(u,1))}var wE=Pt(function(o,u){return xe(o)?us(o,ke(u,1,xe,!0)):[]}),yE=Pt(function(o,u){var _=Mr(u);return xe(_)&&(_=e),xe(o)?us(o,ke(u,1,xe,!0),At(_,2)):[]}),DE=Pt(function(o,u){var _=Mr(u);return xe(_)&&(_=e),xe(o)?us(o,ke(u,1,xe,!0),e,_):[]});function bE(o,u,_){var y=o==null?0:o.length;return y?(u=_||u===e?1:Lt(u),Fr(o,u<0?0:u,y)):[]}function EE(o,u,_){var y=o==null?0:o.length;return y?(u=_||u===e?1:Lt(u),u=y-u,Fr(o,0,u<0?0:u)):[]}function xE(o,u){return o&&o.length?zo(o,At(u,3),!0,!0):[]}function AE(o,u){return o&&o.length?zo(o,At(u,3),!0):[]}function CE(o,u,_,y){var A=o==null?0:o.length;return A?(_&&typeof _!="number"&&He(o,u,_)&&(_=0,y=A),vb(o,u,_,y)):[]}function G0(o,u,_){var y=o==null?0:o.length;if(!y)return-1;var A=_==null?0:Lt(_);return A<0&&(A=Oe(y+A,0)),vo(o,At(u,3),A)}function K0(o,u,_){var y=o==null?0:o.length;if(!y)return-1;var A=y-1;return _!==e&&(A=Lt(_),A=_<0?Oe(y+A,0):Ye(A,y-1)),vo(o,At(u,3),A,!0)}function H0(o){var u=o==null?0:o.length;return u?ke(o,1):[]}function FE(o){var u=o==null?0:o.length;return u?ke(o,K):[]}function ME(o,u){var _=o==null?0:o.length;return _?(u=u===e?1:Lt(u),ke(o,u)):[]}function NE(o){for(var u=-1,_=o==null?0:o.length,y={};++u<_;){var A=o[u];y[A[0]]=A[1]}return y}function J0(o){return o&&o.length?o[0]:e}function SE(o,u,_){var y=o==null?0:o.length;if(!y)return-1;var A=_==null?0:Lt(_);return A<0&&(A=Oe(y+A,0)),Ci(o,u,A)}function BE(o){var u=o==null?0:o.length;return u?Fr(o,0,-1):[]}var TE=Pt(function(o){var u=me(o,Yu);return u.length&&u[0]===o[0]?$u(u):[]}),IE=Pt(function(o){var u=Mr(o),_=me(o,Yu);return u===Mr(_)?u=e:_.pop(),_.length&&_[0]===o[0]?$u(_,At(u,2)):[]}),OE=Pt(function(o){var u=Mr(o),_=me(o,Yu);return u=typeof u=="function"?u:e,u&&_.pop(),_.length&&_[0]===o[0]?$u(_,e,u):[]});function $E(o,u){return o==null?"":BD.call(o,u)}function Mr(o){var u=o==null?0:o.length;return u?o[u-1]:e}function LE(o,u,_){var y=o==null?0:o.length;if(!y)return-1;var A=y;return _!==e&&(A=Lt(_),A=A<0?Oe(y+A,0):Ye(A,y-1)),u===u?_D(o,u,A):vo(o,Sh,A,!0)}function RE(o,u){return o&&o.length?a0(o,Lt(u)):e}var PE=Pt(X0);function X0(o,u){return o&&o.length&&u&&u.length?zu(o,u):o}function zE(o,u,_){return o&&o.length&&u&&u.length?zu(o,u,At(_,2)):o}function qE(o,u,_){return o&&o.length&&u&&u.length?zu(o,u,e,_):o}var kE=ln(function(o,u){var _=o==null?0:o.length,y=Bu(o,u);return f0(o,me(u,function(A){return fn(A,_)?+A:A}).sort(y0)),y});function UE(o,u){var _=[];if(!(o&&o.length))return _;var y=-1,A=[],I=o.length;for(u=At(u,3);++y<I;){var R=o[y];u(R,y,o)&&(_.push(R),A.push(y))}return f0(o,A),_}function sl(o){return o==null?o:$D.call(o)}function WE(o,u,_){var y=o==null?0:o.length;return y?(_&&typeof _!="number"&&He(o,u,_)?(u=0,_=y):(u=u==null?0:Lt(u),_=_===e?y:Lt(_)),Fr(o,u,_)):[]}function jE(o,u){return Po(o,u)}function YE(o,u,_){return Uu(o,u,At(_,2))}function ZE(o,u){var _=o==null?0:o.length;if(_){var y=Po(o,u);if(y<_&&zr(o[y],u))return y}return-1}function GE(o,u){return Po(o,u,!0)}function KE(o,u,_){return Uu(o,u,At(_,2),!0)}function HE(o,u){var _=o==null?0:o.length;if(_){var y=Po(o,u,!0)-1;if(zr(o[y],u))return y}return-1}function JE(o){return o&&o.length?h0(o):[]}function XE(o,u){return o&&o.length?h0(o,At(u,2)):[]}function VE(o){var u=o==null?0:o.length;return u?Fr(o,1,u):[]}function QE(o,u,_){return o&&o.length?(u=_||u===e?1:Lt(u),Fr(o,0,u<0?0:u)):[]}function tx(o,u,_){var y=o==null?0:o.length;return y?(u=_||u===e?1:Lt(u),u=y-u,Fr(o,u<0?0:u,y)):[]}function ex(o,u){return o&&o.length?zo(o,At(u,3),!1,!0):[]}function rx(o,u){return o&&o.length?zo(o,At(u,3)):[]}var nx=Pt(function(o){return Tn(ke(o,1,xe,!0))}),ix=Pt(function(o){var u=Mr(o);return xe(u)&&(u=e),Tn(ke(o,1,xe,!0),At(u,2))}),sx=Pt(function(o){var u=Mr(o);return u=typeof u=="function"?u:e,Tn(ke(o,1,xe,!0),e,u)});function ox(o){return o&&o.length?Tn(o):[]}function ax(o,u){return o&&o.length?Tn(o,At(u,2)):[]}function ux(o,u){return u=typeof u=="function"?u:e,o&&o.length?Tn(o,e,u):[]}function ol(o){if(!(o&&o.length))return[];var u=0;return o=Fn(o,function(_){if(xe(_))return u=Oe(_.length,u),!0}),Eu(u,function(_){return me(o,yu(_))})}function V0(o,u){if(!(o&&o.length))return[];var _=ol(o);return u==null?_:me(_,function(y){return hr(u,e,y)})}var lx=Pt(function(o,u){return xe(o)?us(o,u):[]}),fx=Pt(function(o){return ju(Fn(o,xe))}),cx=Pt(function(o){var u=Mr(o);return xe(u)&&(u=e),ju(Fn(o,xe),At(u,2))}),hx=Pt(function(o){var u=Mr(o);return u=typeof u=="function"?u:e,ju(Fn(o,xe),e,u)}),px=Pt(ol);function dx(o,u){return m0(o||[],u||[],as)}function _x(o,u){return m0(o||[],u||[],cs)}var mx=Pt(function(o){var u=o.length,_=u>1?o[u-1]:e;return _=typeof _=="function"?(o.pop(),_):e,V0(o,_)});function Q0(o){var u=B(o);return u.__chain__=!0,u}function gx(o,u){return u(o),o}function Ko(o,u){return u(o)}var vx=ln(function(o){var u=o.length,_=u?o[0]:0,y=this.__wrapped__,A=function(I){return Bu(I,o)};return u>1||this.__actions__.length||!(y instanceof Ut)||!fn(_)?this.thru(A):(y=y.slice(_,+_+(u?1:0)),y.__actions__.push({func:Ko,args:[A],thisArg:e}),new Ar(y,this.__chain__).thru(function(I){return u&&!I.length&&I.push(e),I}))});function wx(){return Q0(this)}function yx(){return new Ar(this.value(),this.__chain__)}function Dx(){this.__values__===e&&(this.__values__=pp(this.value()));var o=this.__index__>=this.__values__.length,u=o?e:this.__values__[this.__index__++];return{done:o,value:u}}function bx(){return this}function Ex(o){for(var u,_=this;_ instanceof Io;){var y=Z0(_);y.__index__=0,y.__values__=e,u?A.__wrapped__=y:u=y;var A=y;_=_.__wrapped__}return A.__wrapped__=o,u}function xx(){var o=this.__wrapped__;if(o instanceof Ut){var u=o;return this.__actions__.length&&(u=new Ut(this)),u=u.reverse(),u.__actions__.push({func:Ko,args:[sl],thisArg:e}),new Ar(u,this.__chain__)}return this.thru(sl)}function Ax(){return _0(this.__wrapped__,this.__actions__)}var Cx=qo(function(o,u,_){ie.call(o,_)?++o[_]:an(o,_,1)});function Fx(o,u,_){var y=Ot(o)?Mh:gb;return _&&He(o,u,_)&&(u=e),y(o,At(u,3))}function Mx(o,u){var _=Ot(o)?Fn:Vh;return _(o,At(u,3))}var Nx=C0(G0),Sx=C0(K0);function Bx(o,u){return ke(Ho(o,u),1)}function Tx(o,u){return ke(Ho(o,u),K)}function Ix(o,u,_){return _=_===e?1:Lt(_),ke(Ho(o,u),_)}function tp(o,u){var _=Ot(o)?Er:Bn;return _(o,At(u,3))}function ep(o,u){var _=Ot(o)?Vy:Xh;return _(o,At(u,3))}var Ox=qo(function(o,u,_){ie.call(o,_)?o[_].push(u):an(o,_,[u])});function $x(o,u,_,y){o=er(o)?o:Pi(o),_=_&&!y?Lt(_):0;var A=o.length;return _<0&&(_=Oe(A+_,0)),ta(o)?_<=A&&o.indexOf(u,_)>-1:!!A&&Ci(o,u,_)>-1}var Lx=Pt(function(o,u,_){var y=-1,A=typeof u=="function",I=er(o)?J(o.length):[];return Bn(o,function(R){I[++y]=A?hr(u,R,_):ls(R,u,_)}),I}),Rx=qo(function(o,u,_){an(o,_,u)});function Ho(o,u){var _=Ot(o)?me:i0;return _(o,At(u,3))}function Px(o,u,_,y){return o==null?[]:(Ot(u)||(u=u==null?[]:[u]),_=y?e:_,Ot(_)||(_=_==null?[]:[_]),u0(o,u,_))}var zx=qo(function(o,u,_){o[_?0:1].push(u)},function(){return[[],[]]});function qx(o,u,_){var y=Ot(o)?vu:Th,A=arguments.length<3;return y(o,At(u,4),_,A,Bn)}function kx(o,u,_){var y=Ot(o)?Qy:Th,A=arguments.length<3;return y(o,At(u,4),_,A,Xh)}function Ux(o,u){var _=Ot(o)?Fn:Vh;return _(o,Vo(At(u,3)))}function Wx(o){var u=Ot(o)?Gh:$b;return u(o)}function jx(o,u,_){(_?He(o,u,_):u===e)?u=1:u=Lt(u);var y=Ot(o)?hb:Lb;return y(o,u)}function Yx(o){var u=Ot(o)?pb:Pb;return u(o)}function Zx(o){if(o==null)return 0;if(er(o))return ta(o)?Mi(o):o.length;var u=Ze(o);return u==Kt||u==lr?o.size:Ru(o).length}function Gx(o,u,_){var y=Ot(o)?wu:zb;return _&&He(o,u,_)&&(u=e),y(o,At(u,3))}var Kx=Pt(function(o,u){if(o==null)return[];var _=u.length;return _>1&&He(o,u[0],u[1])?u=[]:_>2&&He(u[0],u[1],u[2])&&(u=[u[0]]),u0(o,ke(u,1),[])}),Jo=MD||function(){return qe.Date.now()};function Hx(o,u){if(typeof u!="function")throw new xr(a);return o=Lt(o),function(){if(--o<1)return u.apply(this,arguments)}}function rp(o,u,_){return u=_?e:u,u=o&&u==null?o.length:u,un(o,M,e,e,e,e,u)}function np(o,u){var _;if(typeof u!="function")throw new xr(a);return o=Lt(o),function(){return--o>0&&(_=u.apply(this,arguments)),o<=1&&(u=e),_}}var al=Pt(function(o,u,_){var y=D;if(_.length){var A=Nn(_,Li(al));y|=x}return un(o,y,u,_,A)}),ip=Pt(function(o,u,_){var y=D|v;if(_.length){var A=Nn(_,Li(ip));y|=x}return un(u,y,o,_,A)});function sp(o,u,_){u=_?e:u;var y=un(o,b,e,e,e,e,e,u);return y.placeholder=sp.placeholder,y}function op(o,u,_){u=_?e:u;var y=un(o,N,e,e,e,e,e,u);return y.placeholder=op.placeholder,y}function ap(o,u,_){var y,A,I,R,q,Y,Q=0,et=!1,ot=!1,dt=!0;if(typeof o!="function")throw new xr(a);u=Nr(u)||0,ye(_)&&(et=!!_.leading,ot="maxWait"in _,I=ot?Oe(Nr(_.maxWait)||0,u):I,dt="trailing"in _?!!_.trailing:dt);function wt(Ae){var qr=y,pn=A;return y=A=e,Q=Ae,R=o.apply(pn,qr),R}function Ct(Ae){return Q=Ae,q=ds(kt,u),et?wt(Ae):R}function Rt(Ae){var qr=Ae-Y,pn=Ae-Q,Cp=u-qr;return ot?Ye(Cp,I-pn):Cp}function Ft(Ae){var qr=Ae-Y,pn=Ae-Q;return Y===e||qr>=u||qr<0||ot&&pn>=I}function kt(){var Ae=Jo();if(Ft(Ae))return Wt(Ae);q=ds(kt,Rt(Ae))}function Wt(Ae){return q=e,dt&&y?wt(Ae):(y=A=e,R)}function mr(){q!==e&&g0(q),Q=0,y=Y=A=q=e}function Je(){return q===e?R:Wt(Jo())}function gr(){var Ae=Jo(),qr=Ft(Ae);if(y=arguments,A=this,Y=Ae,qr){if(q===e)return Ct(Y);if(ot)return g0(q),q=ds(kt,u),wt(Y)}return q===e&&(q=ds(kt,u)),R}return gr.cancel=mr,gr.flush=Je,gr}var Jx=Pt(function(o,u){return Jh(o,1,u)}),Xx=Pt(function(o,u,_){return Jh(o,Nr(u)||0,_)});function Vx(o){return un(o,O)}function Xo(o,u){if(typeof o!="function"||u!=null&&typeof u!="function")throw new xr(a);var _=function(){var y=arguments,A=u?u.apply(this,y):y[0],I=_.cache;if(I.has(A))return I.get(A);var R=o.apply(this,y);return _.cache=I.set(A,R)||I,R};return _.cache=new(Xo.Cache||on),_}Xo.Cache=on;function Vo(o){if(typeof o!="function")throw new xr(a);return function(){var u=arguments;switch(u.length){case 0:return!o.call(this);case 1:return!o.call(this,u[0]);case 2:return!o.call(this,u[0],u[1]);case 3:return!o.call(this,u[0],u[1],u[2])}return!o.apply(this,u)}}function Qx(o){return np(2,o)}var tA=qb(function(o,u){u=u.length==1&&Ot(u[0])?me(u[0],pr(At())):me(ke(u,1),pr(At()));var _=u.length;return Pt(function(y){for(var A=-1,I=Ye(y.length,_);++A<I;)y[A]=u[A].call(this,y[A]);return hr(o,this,y)})}),ul=Pt(function(o,u){var _=Nn(u,Li(ul));return un(o,x,e,u,_)}),up=Pt(function(o,u){var _=Nn(u,Li(up));return un(o,F,e,u,_)}),eA=ln(function(o,u){return un(o,S,e,e,e,u)});function rA(o,u){if(typeof o!="function")throw new xr(a);return u=u===e?u:Lt(u),Pt(o,u)}function nA(o,u){if(typeof o!="function")throw new xr(a);return u=u==null?0:Oe(Lt(u),0),Pt(function(_){var y=_[u],A=On(_,0,u);return y&&Mn(A,y),hr(o,this,A)})}function iA(o,u,_){var y=!0,A=!0;if(typeof o!="function")throw new xr(a);return ye(_)&&(y="leading"in _?!!_.leading:y,A="trailing"in _?!!_.trailing:A),ap(o,u,{leading:y,maxWait:u,trailing:A})}function sA(o){return rp(o,1)}function oA(o,u){return ul(Zu(u),o)}function aA(){if(!arguments.length)return[];var o=arguments[0];return Ot(o)?o:[o]}function uA(o){return Cr(o,g)}function lA(o,u){return u=typeof u=="function"?u:e,Cr(o,g,u)}function fA(o){return Cr(o,c|g)}function cA(o,u){return u=typeof u=="function"?u:e,Cr(o,c|g,u)}function hA(o,u){return u==null||Hh(o,u,Re(u))}function zr(o,u){return o===u||o!==o&&u!==u}var pA=jo(Ou),dA=jo(function(o,u){return o>=u}),ii=e0(function(){return arguments}())?e0:function(o){return De(o)&&ie.call(o,"callee")&&!kh.call(o,"callee")},Ot=J.isArray,_A=bh?pr(bh):Eb;function er(o){return o!=null&&Qo(o.length)&&!cn(o)}function xe(o){return De(o)&&er(o)}function mA(o){return o===!0||o===!1||De(o)&&Ke(o)==ne}var $n=SD||wl,gA=Eh?pr(Eh):xb;function vA(o){return De(o)&&o.nodeType===1&&!_s(o)}function wA(o){if(o==null)return!0;if(er(o)&&(Ot(o)||typeof o=="string"||typeof o.splice=="function"||$n(o)||Ri(o)||ii(o)))return!o.length;var u=Ze(o);if(u==Kt||u==lr)return!o.size;if(ps(o))return!Ru(o).length;for(var _ in o)if(ie.call(o,_))return!1;return!0}function yA(o,u){return fs(o,u)}function DA(o,u,_){_=typeof _=="function"?_:e;var y=_?_(o,u):e;return y===e?fs(o,u,e,_):!!y}function ll(o){if(!De(o))return!1;var u=Ke(o);return u==se||u==Nt||typeof o.message=="string"&&typeof o.name=="string"&&!_s(o)}function bA(o){return typeof o=="number"&&Wh(o)}function cn(o){if(!ye(o))return!1;var u=Ke(o);return u==Qt||u==qt||u==Et||u==En}function lp(o){return typeof o=="number"&&o==Lt(o)}function Qo(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=G}function ye(o){var u=typeof o;return o!=null&&(u=="object"||u=="function")}function De(o){return o!=null&&typeof o=="object"}var fp=xh?pr(xh):Cb;function EA(o,u){return o===u||Lu(o,u,Qu(u))}function xA(o,u,_){return _=typeof _=="function"?_:e,Lu(o,u,Qu(u),_)}function AA(o){return cp(o)&&o!=+o}function CA(o){if(lE(o))throw new Tt(s);return r0(o)}function FA(o){return o===null}function MA(o){return o==null}function cp(o){return typeof o=="number"||De(o)&&Ke(o)==Ne}function _s(o){if(!De(o)||Ke(o)!=Be)return!1;var u=Co(o);if(u===null)return!0;var _=ie.call(u,"constructor")&&u.constructor;return typeof _=="function"&&_ instanceof _&&bo.call(_)==xD}var fl=Ah?pr(Ah):Fb;function NA(o){return lp(o)&&o>=-G&&o<=G}var hp=Ch?pr(Ch):Mb;function ta(o){return typeof o=="string"||!Ot(o)&&De(o)&&Ke(o)==xn}function _r(o){return typeof o=="symbol"||De(o)&&Ke(o)==$}var Ri=Fh?pr(Fh):Nb;function SA(o){return o===e}function BA(o){return De(o)&&Ze(o)==H}function TA(o){return De(o)&&Ke(o)==nt}var IA=jo(Pu),OA=jo(function(o,u){return o<=u});function pp(o){if(!o)return[];if(er(o))return ta(o)?Rr(o):tr(o);if(rs&&o[rs])return hD(o[rs]());var u=Ze(o),_=u==Kt?Au:u==lr?wo:Pi;return _(o)}function hn(o){if(!o)return o===0?o:0;if(o=Nr(o),o===K||o===-K){var u=o<0?-1:1;return u*V}return o===o?o:0}function Lt(o){var u=hn(o),_=u%1;return u===u?_?u-_:u:0}function dp(o){return o?ti(Lt(o),0,ft):0}function Nr(o){if(typeof o=="number")return o;if(_r(o))return tt;if(ye(o)){var u=typeof o.valueOf=="function"?o.valueOf():o;o=ye(u)?u+"":u}if(typeof o!="string")return o===0?o:+o;o=Ih(o);var _=iu.test(o);return _||ou.test(o)?Hy(o.slice(2),_?2:8):nu.test(o)?tt:+o}function _p(o){return Hr(o,rr(o))}function $A(o){return o?ti(Lt(o),-G,G):o===0?o:0}function ee(o){return o==null?"":dr(o)}var LA=Oi(function(o,u){if(ps(u)||er(u)){Hr(u,Re(u),o);return}for(var _ in u)ie.call(u,_)&&as(o,_,u[_])}),mp=Oi(function(o,u){Hr(u,rr(u),o)}),ea=Oi(function(o,u,_,y){Hr(u,rr(u),o,y)}),RA=Oi(function(o,u,_,y){Hr(u,Re(u),o,y)}),PA=ln(Bu);function zA(o,u){var _=Ii(o);return u==null?_:Kh(_,u)}var qA=Pt(function(o,u){o=ue(o);var _=-1,y=u.length,A=y>2?u[2]:e;for(A&&He(u[0],u[1],A)&&(y=1);++_<y;)for(var I=u[_],R=rr(I),q=-1,Y=R.length;++q<Y;){var Q=R[q],et=o[Q];(et===e||zr(et,Si[Q])&&!ie.call(o,Q))&&(o[Q]=I[Q])}return o}),kA=Pt(function(o){return o.push(e,I0),hr(gp,e,o)});function UA(o,u){return Nh(o,At(u,3),Kr)}function WA(o,u){return Nh(o,At(u,3),Iu)}function jA(o,u){return o==null?o:Tu(o,At(u,3),rr)}function YA(o,u){return o==null?o:Qh(o,At(u,3),rr)}function ZA(o,u){return o&&Kr(o,At(u,3))}function GA(o,u){return o&&Iu(o,At(u,3))}function KA(o){return o==null?[]:Lo(o,Re(o))}function HA(o){return o==null?[]:Lo(o,rr(o))}function cl(o,u,_){var y=o==null?e:ei(o,u);return y===e?_:y}function JA(o,u){return o!=null&&L0(o,u,wb)}function hl(o,u){return o!=null&&L0(o,u,yb)}var XA=M0(function(o,u,_){u!=null&&typeof u.toString!="function"&&(u=Eo.call(u)),o[u]=_},dl(nr)),VA=M0(function(o,u,_){u!=null&&typeof u.toString!="function"&&(u=Eo.call(u)),ie.call(o,u)?o[u].push(_):o[u]=[_]},At),QA=Pt(ls);function Re(o){return er(o)?Zh(o):Ru(o)}function rr(o){return er(o)?Zh(o,!0):Sb(o)}function tC(o,u){var _={};return u=At(u,3),Kr(o,function(y,A,I){an(_,u(y,A,I),y)}),_}function eC(o,u){var _={};return u=At(u,3),Kr(o,function(y,A,I){an(_,A,u(y,A,I))}),_}var rC=Oi(function(o,u,_){Ro(o,u,_)}),gp=Oi(function(o,u,_,y){Ro(o,u,_,y)}),nC=ln(function(o,u){var _={};if(o==null)return _;var y=!1;u=me(u,function(I){return I=In(I,o),y||(y=I.length>1),I}),Hr(o,Xu(o),_),y&&(_=Cr(_,c|d|g,Xb));for(var A=u.length;A--;)Wu(_,u[A]);return _});function iC(o,u){return vp(o,Vo(At(u)))}var sC=ln(function(o,u){return o==null?{}:Tb(o,u)});function vp(o,u){if(o==null)return{};var _=me(Xu(o),function(y){return[y]});return u=At(u),l0(o,_,function(y,A){return u(y,A[0])})}function oC(o,u,_){u=In(u,o);var y=-1,A=u.length;for(A||(A=1,o=e);++y<A;){var I=o==null?e:o[Jr(u[y])];I===e&&(y=A,I=_),o=cn(I)?I.call(o):I}return o}function aC(o,u,_){return o==null?o:cs(o,u,_)}function uC(o,u,_,y){return y=typeof y=="function"?y:e,o==null?o:cs(o,u,_,y)}var wp=B0(Re),yp=B0(rr);function lC(o,u,_){var y=Ot(o),A=y||$n(o)||Ri(o);if(u=At(u,4),_==null){var I=o&&o.constructor;A?_=y?new I:[]:ye(o)?_=cn(I)?Ii(Co(o)):{}:_={}}return(A?Er:Kr)(o,function(R,q,Y){return u(_,R,q,Y)}),_}function fC(o,u){return o==null?!0:Wu(o,u)}function cC(o,u,_){return o==null?o:d0(o,u,Zu(_))}function hC(o,u,_,y){return y=typeof y=="function"?y:e,o==null?o:d0(o,u,Zu(_),y)}function Pi(o){return o==null?[]:xu(o,Re(o))}function pC(o){return o==null?[]:xu(o,rr(o))}function dC(o,u,_){return _===e&&(_=u,u=e),_!==e&&(_=Nr(_),_=_===_?_:0),u!==e&&(u=Nr(u),u=u===u?u:0),ti(Nr(o),u,_)}function _C(o,u,_){return u=hn(u),_===e?(_=u,u=0):_=hn(_),o=Nr(o),Db(o,u,_)}function mC(o,u,_){if(_&&typeof _!="boolean"&&He(o,u,_)&&(u=_=e),_===e&&(typeof u=="boolean"?(_=u,u=e):typeof o=="boolean"&&(_=o,o=e)),o===e&&u===e?(o=0,u=1):(o=hn(o),u===e?(u=o,o=0):u=hn(u)),o>u){var y=o;o=u,u=y}if(_||o%1||u%1){var A=jh();return Ye(o+A*(u-o+Ky("1e-"+((A+"").length-1))),u)}return qu(o,u)}var gC=$i(function(o,u,_){return u=u.toLowerCase(),o+(_?Dp(u):u)});function Dp(o){return pl(ee(o).toLowerCase())}function bp(o){return o=ee(o),o&&o.replace(uu,aD).replace(Py,"")}function vC(o,u,_){o=ee(o),u=dr(u);var y=o.length;_=_===e?y:ti(Lt(_),0,y);var A=_;return _-=u.length,_>=0&&o.slice(_,A)==u}function wC(o){return o=ee(o),o&&Ua.test(o)?o.replace(co,uD):o}function yC(o){return o=ee(o),o&&Ka.test(o)?o.replace(Qi,"\\$&"):o}var DC=$i(function(o,u,_){return o+(_?"-":"")+u.toLowerCase()}),bC=$i(function(o,u,_){return o+(_?" ":"")+u.toLowerCase()}),EC=A0("toLowerCase");function xC(o,u,_){o=ee(o),u=Lt(u);var y=u?Mi(o):0;if(!u||y>=u)return o;var A=(u-y)/2;return Wo(So(A),_)+o+Wo(No(A),_)}function AC(o,u,_){o=ee(o),u=Lt(u);var y=u?Mi(o):0;return u&&y<u?o+Wo(u-y,_):o}function CC(o,u,_){o=ee(o),u=Lt(u);var y=u?Mi(o):0;return u&&y<u?Wo(u-y,_)+o:o}function FC(o,u,_){return _||u==null?u=0:u&&(u=+u),OD(ee(o).replace(ts,""),u||0)}function MC(o,u,_){return(_?He(o,u,_):u===e)?u=1:u=Lt(u),ku(ee(o),u)}function NC(){var o=arguments,u=ee(o[0]);return o.length<3?u:u.replace(o[1],o[2])}var SC=$i(function(o,u,_){return o+(_?"_":"")+u.toLowerCase()});function BC(o,u,_){return _&&typeof _!="number"&&He(o,u,_)&&(u=_=e),_=_===e?ft:_>>>0,_?(o=ee(o),o&&(typeof u=="string"||u!=null&&!fl(u))&&(u=dr(u),!u&&Fi(o))?On(Rr(o),0,_):o.split(u,_)):[]}var TC=$i(function(o,u,_){return o+(_?" ":"")+pl(u)});function IC(o,u,_){return o=ee(o),_=_==null?0:ti(Lt(_),0,o.length),u=dr(u),o.slice(_,_+u.length)==u}function OC(o,u,_){var y=B.templateSettings;_&&He(o,u,_)&&(u=e),o=ee(o),u=ea({},u,y,T0);var A=ea({},u.imports,y.imports,T0),I=Re(A),R=xu(A,I),q,Y,Q=0,et=u.interpolate||Ei,ot="__p += '",dt=Cu((u.escape||Ei).source+"|"+et.source+"|"+(et===ho?ru:Ei).source+"|"+(u.evaluate||Ei).source+"|$","g"),wt="//# sourceURL="+(ie.call(u,"sourceURL")?(u.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Wy+"]")+`
|
11
11
|
`;o.replace(dt,function(Ft,kt,Wt,mr,Je,gr){return Wt||(Wt=mr),ot+=o.slice(Q,gr).replace(Hn,lD),kt&&(q=!0,ot+=`' +
|
12
12
|
__e(`+kt+`) +
|
13
13
|
'`),Je&&(Y=!0,ot+=`';
|
@@ -24,43 +24,43 @@ __p += '`),Wt&&(ot+=`' +
|
|
24
24
|
function print() { __p += __j.call(arguments, '') }
|
25
25
|
`:`;
|
26
26
|
`)+ot+`return __p
|
27
|
-
}`;var Rt=Ep(function(){return Xt(I,wt+"return "+ot).apply(e,R)});if(Rt.source=ot,ll(Rt))throw Rt;return Rt}function $C(o){return te(o).toLowerCase()}function LC(o){return te(o).toUpperCase()}function RC(o,u,_){if(o=te(o),o&&(_||u===e))return Th(o);if(!o||!(u=dr(u)))return o;var y=Rr(o),A=Rr(u),I=Ih(y,A),R=Oh(y,A)+1;return On(y,I,R).join("")}function PC(o,u,_){if(o=te(o),o&&(_||u===e))return o.slice(0,Lh(o)+1);if(!o||!(u=dr(u)))return o;var y=Rr(o),A=Oh(y,Rr(u))+1;return On(y,0,A).join("")}function zC(o,u,_){if(o=te(o),o&&(_||u===e))return o.replace(ts,"");if(!o||!(u=dr(u)))return o;var y=Rr(o),A=Ih(y,Rr(u));return On(y,A).join("")}function qC(o,u){var _=C,y=T;if(ye(u)){var A="separator"in u?u.separator:A;_="length"in u?Lt(u.length):_,y="omission"in u?dr(u.omission):y}o=te(o);var I=o.length;if(Fi(o)){var R=Rr(o);I=R.length}if(_>=I)return o;var q=_-Mi(y);if(q<1)return y;var Y=R?On(R,0,q).join(""):o.slice(0,q);if(A===e)return Y+y;if(R&&(q+=Y.length-q),fl(A)){if(o.slice(q).search(A)){var Q,et=Y;for(A.global||(A=Cu(A.source,te(po.exec(A))+"g")),A.lastIndex=0;Q=A.exec(et);)var ot=Q.index;Y=Y.slice(0,ot===e?q:ot)}}else if(o.indexOf(dr(A),q)!=q){var dt=Y.lastIndexOf(A);dt>-1&&(Y=Y.slice(0,dt))}return Y+y}function kC(o){return o=te(o),o&&ka.test(o)?o.replace(Kn,mD):o}var UC=$i(function(o,u,_){return o+(_?" ":"")+u.toUpperCase()}),pl=x0("toUpperCase");function bp(o,u,_){return o=te(o),u=_?e:u,u===e?cD(o)?wD(o):rD(o):o.match(u)||[]}var Ep=Pt(function(o,u){try{return hr(o,e,u)}catch(_){return ll(_)?_:new Tt(_)}}),WC=ln(function(o,u){return Er(u,function(_){_=Jr(_),an(o,_,al(o[_],o))}),o});function jC(o){var u=o==null?0:o.length,_=At();return o=u?me(o,function(y){if(typeof y[1]!="function")throw new xr(a);return[_(y[0]),y[1]]}):[],Pt(function(y){for(var A=-1;++A<u;){var I=o[A];if(hr(I[0],this,y))return hr(I[1],this,y)}})}function YC(o){return mb(Cr(o,c))}function dl(o){return function(){return o}}function ZC(o,u){return o==null||o!==o?u:o}var GC=C0(),KC=C0(!0);function nr(o){return o}function _l(o){return r0(typeof o=="function"?o:Cr(o,c))}function HC(o){return i0(Cr(o,c))}function JC(o,u){return s0(o,Cr(u,c))}var XC=Pt(function(o,u){return function(_){return ls(_,o,u)}}),VC=Pt(function(o,u){return function(_){return ls(o,_,u)}});function ml(o,u,_){var y=Le(u),A=Lo(u,y);_==null&&!(ye(u)&&(A.length||!y.length))&&(_=u,u=o,o=this,A=Lo(u,Le(u)));var I=!(ye(_)&&"chain"in _)||!!_.chain,R=cn(o);return Er(A,function(q){var Y=u[q];o[q]=Y,R&&(o.prototype[q]=function(){var Q=this.__chain__;if(I||Q){var et=o(this.__wrapped__),ot=et.__actions__=tr(this.__actions__);return ot.push({func:Y,args:arguments,thisArg:o}),et.__chain__=Q,et}return Y.apply(o,Mn([this.value()],arguments))})}),o}function QC(){return qe._===this&&(qe._=AD),this}function gl(){}function t2(o){return o=Lt(o),Pt(function(u){return o0(u,o)})}var e2=Ku(me),r2=Ku(Fh),n2=Ku(wu);function xp(o){return el(o)?yu(Jr(o)):Ib(o)}function i2(o){return function(u){return o==null?e:ei(o,u)}}var s2=M0(),o2=M0(!0);function vl(){return[]}function wl(){return!1}function a2(){return{}}function u2(){return""}function l2(){return!0}function f2(o,u){if(o=Lt(o),o<1||o>G)return[];var _=ft,y=Ye(o,ft);u=At(u),o-=ft;for(var A=Eu(y,u);++_<o;)u(_);return A}function c2(o){return Ot(o)?me(o,Jr):_r(o)?[o]:tr(j0(te(o)))}function h2(o){var u=++ED;return te(o)+u}var p2=Uo(function(o,u){return o+u},0),d2=Hu("ceil"),_2=Uo(function(o,u){return o/u},1),m2=Hu("floor");function g2(o){return o&&o.length?$o(o,nr,Ou):e}function v2(o,u){return o&&o.length?$o(o,At(u,2),Ou):e}function w2(o){return Sh(o,nr)}function y2(o,u){return Sh(o,At(u,2))}function D2(o){return o&&o.length?$o(o,nr,Pu):e}function b2(o,u){return o&&o.length?$o(o,At(u,2),Pu):e}var E2=Uo(function(o,u){return o*u},1),x2=Hu("round"),A2=Uo(function(o,u){return o-u},0);function C2(o){return o&&o.length?bu(o,nr):0}function F2(o,u){return o&&o.length?bu(o,At(u,2)):0}return B.after=Hx,B.ary=ep,B.assign=LA,B.assignIn=_p,B.assignInWith=ea,B.assignWith=RA,B.at=PA,B.before=rp,B.bind=al,B.bindAll=WC,B.bindKey=np,B.castArray=aA,B.chain=V0,B.chunk=mE,B.compact=gE,B.concat=vE,B.cond=jC,B.conforms=YC,B.constant=dl,B.countBy=Cx,B.create=zA,B.curry=ip,B.curryRight=sp,B.debounce=op,B.defaults=qA,B.defaultsDeep=kA,B.defer=Jx,B.delay=Xx,B.difference=wE,B.differenceBy=yE,B.differenceWith=DE,B.drop=bE,B.dropRight=EE,B.dropRightWhile=xE,B.dropWhile=AE,B.fill=CE,B.filter=Mx,B.flatMap=Bx,B.flatMapDeep=Tx,B.flatMapDepth=Ix,B.flatten=K0,B.flattenDeep=FE,B.flattenDepth=ME,B.flip=Vx,B.flow=GC,B.flowRight=KC,B.fromPairs=NE,B.functions=KA,B.functionsIn=HA,B.groupBy=Ox,B.initial=BE,B.intersection=TE,B.intersectionBy=IE,B.intersectionWith=OE,B.invert=XA,B.invertBy=VA,B.invokeMap=Lx,B.iteratee=_l,B.keyBy=Rx,B.keys=Le,B.keysIn=rr,B.map=Ho,B.mapKeys=tC,B.mapValues=eC,B.matches=HC,B.matchesProperty=JC,B.memoize=Xo,B.merge=rC,B.mergeWith=mp,B.method=XC,B.methodOf=VC,B.mixin=ml,B.negate=Vo,B.nthArg=t2,B.omit=nC,B.omitBy=iC,B.once=Qx,B.orderBy=Px,B.over=e2,B.overArgs=tA,B.overEvery=r2,B.overSome=n2,B.partial=ul,B.partialRight=ap,B.partition=zx,B.pick=sC,B.pickBy=gp,B.property=xp,B.propertyOf=i2,B.pull=PE,B.pullAll=J0,B.pullAllBy=zE,B.pullAllWith=qE,B.pullAt=kE,B.range=s2,B.rangeRight=o2,B.rearg=eA,B.reject=Ux,B.remove=UE,B.rest=rA,B.reverse=sl,B.sampleSize=jx,B.set=aC,B.setWith=uC,B.shuffle=Yx,B.slice=WE,B.sortBy=Kx,B.sortedUniq=JE,B.sortedUniqBy=XE,B.split=BC,B.spread=nA,B.tail=VE,B.take=QE,B.takeRight=tx,B.takeRightWhile=ex,B.takeWhile=rx,B.tap=gx,B.throttle=iA,B.thru=Ko,B.toArray=hp,B.toPairs=vp,B.toPairsIn=wp,B.toPath=c2,B.toPlainObject=dp,B.transform=lC,B.unary=sA,B.union=nx,B.unionBy=ix,B.unionWith=sx,B.uniq=ox,B.uniqBy=ax,B.uniqWith=ux,B.unset=fC,B.unzip=ol,B.unzipWith=X0,B.update=cC,B.updateWith=hC,B.values=Pi,B.valuesIn=pC,B.without=lx,B.words=bp,B.wrap=oA,B.xor=fx,B.xorBy=cx,B.xorWith=hx,B.zip=px,B.zipObject=dx,B.zipObjectDeep=_x,B.zipWith=mx,B.entries=vp,B.entriesIn=wp,B.extend=_p,B.extendWith=ea,ml(B,B),B.add=p2,B.attempt=Ep,B.camelCase=gC,B.capitalize=yp,B.ceil=d2,B.clamp=dC,B.clone=uA,B.cloneDeep=fA,B.cloneDeepWith=cA,B.cloneWith=lA,B.conformsTo=hA,B.deburr=Dp,B.defaultTo=ZC,B.divide=_2,B.endsWith=vC,B.eq=zr,B.escape=wC,B.escapeRegExp=yC,B.every=Fx,B.find=Nx,B.findIndex=Z0,B.findKey=UA,B.findLast=Sx,B.findLastIndex=G0,B.findLastKey=WA,B.floor=m2,B.forEach=Q0,B.forEachRight=tp,B.forIn=jA,B.forInRight=YA,B.forOwn=ZA,B.forOwnRight=GA,B.get=cl,B.gt=pA,B.gte=dA,B.has=JA,B.hasIn=hl,B.head=H0,B.identity=nr,B.includes=$x,B.indexOf=SE,B.inRange=_C,B.invoke=QA,B.isArguments=ii,B.isArray=Ot,B.isArrayBuffer=_A,B.isArrayLike=er,B.isArrayLikeObject=xe,B.isBoolean=mA,B.isBuffer=$n,B.isDate=gA,B.isElement=vA,B.isEmpty=wA,B.isEqual=yA,B.isEqualWith=DA,B.isError=ll,B.isFinite=bA,B.isFunction=cn,B.isInteger=up,B.isLength=Qo,B.isMap=lp,B.isMatch=EA,B.isMatchWith=xA,B.isNaN=AA,B.isNative=CA,B.isNil=MA,B.isNull=FA,B.isNumber=fp,B.isObject=ye,B.isObjectLike=De,B.isPlainObject=_s,B.isRegExp=fl,B.isSafeInteger=NA,B.isSet=cp,B.isString=ta,B.isSymbol=_r,B.isTypedArray=Ri,B.isUndefined=SA,B.isWeakMap=BA,B.isWeakSet=TA,B.join=$E,B.kebabCase=DC,B.last=Mr,B.lastIndexOf=LE,B.lowerCase=bC,B.lowerFirst=EC,B.lt=IA,B.lte=OA,B.max=g2,B.maxBy=v2,B.mean=w2,B.meanBy=y2,B.min=D2,B.minBy=b2,B.stubArray=vl,B.stubFalse=wl,B.stubObject=a2,B.stubString=u2,B.stubTrue=l2,B.multiply=E2,B.nth=RE,B.noConflict=QC,B.noop=gl,B.now=Jo,B.pad=xC,B.padEnd=AC,B.padStart=CC,B.parseInt=FC,B.random=mC,B.reduce=qx,B.reduceRight=kx,B.repeat=MC,B.replace=NC,B.result=oC,B.round=x2,B.runInContext=j,B.sample=Wx,B.size=Zx,B.snakeCase=SC,B.some=Gx,B.sortedIndex=jE,B.sortedIndexBy=YE,B.sortedIndexOf=ZE,B.sortedLastIndex=GE,B.sortedLastIndexBy=KE,B.sortedLastIndexOf=HE,B.startCase=TC,B.startsWith=IC,B.subtract=A2,B.sum=C2,B.sumBy=F2,B.template=OC,B.times=f2,B.toFinite=hn,B.toInteger=Lt,B.toLength=pp,B.toLower=$C,B.toNumber=Nr,B.toSafeInteger=$A,B.toString=te,B.toUpper=LC,B.trim=RC,B.trimEnd=PC,B.trimStart=zC,B.truncate=qC,B.unescape=kC,B.uniqueId=h2,B.upperCase=UC,B.upperFirst=pl,B.each=Q0,B.eachRight=tp,B.first=H0,ml(B,function(){var o={};return Kr(B,function(u,_){ie.call(B.prototype,_)||(o[_]=u)}),o}(),{chain:!1}),B.VERSION=r,Er(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){B[o].placeholder=B}),Er(["drop","take"],function(o,u){Ut.prototype[o]=function(_){_=_===e?1:Ie(Lt(_),0);var y=this.__filtered__&&!u?new Ut(this):this.clone();return y.__filtered__?y.__takeCount__=Ye(_,y.__takeCount__):y.__views__.push({size:Ye(_,ft),type:o+(y.__dir__<0?"Right":"")}),y},Ut.prototype[o+"Right"]=function(_){return this.reverse()[o](_).reverse()}}),Er(["filter","map","takeWhile"],function(o,u){var _=u+1,y=_==k||_==P;Ut.prototype[o]=function(A){var I=this.clone();return I.__iteratees__.push({iteratee:At(A,3),type:_}),I.__filtered__=I.__filtered__||y,I}}),Er(["head","last"],function(o,u){var _="take"+(u?"Right":"");Ut.prototype[o]=function(){return this[_](1).value()[0]}}),Er(["initial","tail"],function(o,u){var _="drop"+(u?"":"Right");Ut.prototype[o]=function(){return this.__filtered__?new Ut(this):this[_](1)}}),Ut.prototype.compact=function(){return this.filter(nr)},Ut.prototype.find=function(o){return this.filter(o).head()},Ut.prototype.findLast=function(o){return this.reverse().find(o)},Ut.prototype.invokeMap=Pt(function(o,u){return typeof o=="function"?new Ut(this):this.map(function(_){return ls(_,o,u)})}),Ut.prototype.reject=function(o){return this.filter(Vo(At(o)))},Ut.prototype.slice=function(o,u){o=Lt(o);var _=this;return _.__filtered__&&(o>0||u<0)?new Ut(_):(o<0?_=_.takeRight(-o):o&&(_=_.drop(o)),u!==e&&(u=Lt(u),_=u<0?_.dropRight(-u):_.take(u-o)),_)},Ut.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},Ut.prototype.toArray=function(){return this.take(ft)},Kr(Ut.prototype,function(o,u){var _=/^(?:filter|find|map|reject)|While$/.test(u),y=/^(?:head|last)$/.test(u),A=B[y?"take"+(u=="last"?"Right":""):u],I=y||/^find/.test(u);A&&(B.prototype[u]=function(){var R=this.__wrapped__,q=y?[1]:arguments,Y=R instanceof Ut,Q=q[0],et=Y||Ot(R),ot=function(kt){var Wt=A.apply(B,Mn([kt],q));return y&&dt?Wt[0]:Wt};et&&_&&typeof Q=="function"&&Q.length!=1&&(Y=et=!1);var dt=this.__chain__,wt=!!this.__actions__.length,Ct=I&&!dt,Rt=Y&&!wt;if(!I&&et){R=Rt?R:new Ut(this);var Ft=o.apply(R,q);return Ft.__actions__.push({func:Ko,args:[ot],thisArg:e}),new Ar(Ft,dt)}return Ct&&Rt?o.apply(this,q):(Ft=this.thru(ot),Ct?y?Ft.value()[0]:Ft.value():Ft)})}),Er(["pop","push","shift","sort","splice","unshift"],function(o){var u=yo[o],_=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",y=/^(?:pop|shift)$/.test(o);B.prototype[o]=function(){var A=arguments;if(y&&!this.__chain__){var I=this.value();return u.apply(Ot(I)?I:[],A)}return this[_](function(R){return u.apply(Ot(R)?R:[],A)})}}),Kr(Ut.prototype,function(o,u){var _=B[u];if(_){var y=_.name+"";ie.call(Ti,y)||(Ti[y]=[]),Ti[y].push({name:u,func:_})}}),Ti[ko(e,v).name]=[{name:"wrapper",func:e}],Ut.prototype.clone=kD,Ut.prototype.reverse=UD,Ut.prototype.value=WD,B.prototype.at=vx,B.prototype.chain=wx,B.prototype.commit=yx,B.prototype.next=Dx,B.prototype.plant=Ex,B.prototype.reverse=xx,B.prototype.toJSON=B.prototype.valueOf=B.prototype.value=Ax,B.prototype.first=B.prototype.head,rs&&(B.prototype[rs]=bx),B},Ni=yD();Jn?((Jn.exports=Ni)._=Ni,_u._=Ni):qe._=Ni}).call(jt)}(Ln,Ln.exports);var Sr=Ln.exports;class Cp{constructor(t,e){z(this,"_defaultParams");z(this,"_UserTypeFileds");z(this,"_varipKeys");this._defaultParams=t,this._UserTypeFileds=this._createDynamicClass(),this._varipKeys=e}copy(t){return Sr.cloneDeep(t)}new(t={}){return new this._UserTypeFileds(Object.assign(Sr.cloneDeep(this._defaultParams),t),this._varipKeys)}addNewMethod(t,e){this._UserTypeFileds.prototype[t]=e}_createDynamicClass(){return class{constructor(t,e){z(this,"_varipKeys");Object.assign(this,t),this._varipKeys=e}get varipKeys(){return[...this._varipKeys]}copy(){return Sr.cloneDeep(this)}}}}var xl={exports:{}};(function(i,t){(function(e,r){i.exports=r()})(jt,function(){var e=1e3,r=6e4,n=36e5,s="millisecond",a="second",l="minute",f="hour",h="day",p="week",c="month",d="quarter",g="year",w="date",m="Invalid Date",D=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,v=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,E={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(k){var W=["th","st","nd","rd"],P=k%100;return"["+k+(W[(P-20)%10]||W[P]||W[0])+"]"}},b=function(k,W,P){var K=String(k);return!K||K.length>=W?k:""+Array(W+1-K.length).join(P)+k},N={s:b,z:function(k){var W=-k.utcOffset(),P=Math.abs(W),K=Math.floor(P/60),G=P%60;return(W<=0?"+":"-")+b(K,2,"0")+":"+b(G,2,"0")},m:function k(W,P){if(W.date()<P.date())return-k(P,W);var K=12*(P.year()-W.year())+(P.month()-W.month()),G=W.clone().add(K,c),V=P-G<0,tt=W.clone().add(K+(V?-1:1),c);return+(-(K+(P-G)/(V?G-tt:tt-G))||0)},a:function(k){return k<0?Math.ceil(k)||0:Math.floor(k)},p:function(k){return{M:c,y:g,w:p,d:h,D:w,h:f,m:l,s:a,ms:s,Q:d}[k]||String(k||"").toLowerCase().replace(/s$/,"")},u:function(k){return k===void 0}},x="en",F={};F[x]=E;var M="$isDayjsObject",S=function(k){return k instanceof L||!(!k||!k[M])},O=function k(W,P,K){var G;if(!W)return x;if(typeof W=="string"){var V=W.toLowerCase();F[V]&&(G=V),P&&(F[V]=P,G=V);var tt=W.split("-");if(!G&&tt.length>1)return k(tt[0])}else{var ft=W.name;F[ft]=W,G=ft}return!K&&G&&(x=G),G||!K&&x},C=function(k,W){if(S(k))return k.clone();var P=typeof W=="object"?W:{};return P.date=k,P.args=arguments,new L(P)},T=N;T.l=O,T.i=S,T.w=function(k,W){return C(k,{locale:W.$L,utc:W.$u,x:W.$x,$offset:W.$offset})};var L=function(){function k(P){this.$L=O(P.locale,null,!0),this.parse(P),this.$x=this.$x||P.x||{},this[M]=!0}var W=k.prototype;return W.parse=function(P){this.$d=function(K){var G=K.date,V=K.utc;if(G===null)return new Date(NaN);if(T.u(G))return new Date;if(G instanceof Date)return new Date(G);if(typeof G=="string"&&!/Z$/i.test(G)){var tt=G.match(D);if(tt){var ft=tt[2]-1||0,vt=(tt[7]||"0").substring(0,3);return V?new Date(Date.UTC(tt[1],ft,tt[3]||1,tt[4]||0,tt[5]||0,tt[6]||0,vt)):new Date(tt[1],ft,tt[3]||1,tt[4]||0,tt[5]||0,tt[6]||0,vt)}}return new Date(G)}(P),this.init()},W.init=function(){var P=this.$d;this.$y=P.getFullYear(),this.$M=P.getMonth(),this.$D=P.getDate(),this.$W=P.getDay(),this.$H=P.getHours(),this.$m=P.getMinutes(),this.$s=P.getSeconds(),this.$ms=P.getMilliseconds()},W.$utils=function(){return T},W.isValid=function(){return this.$d.toString()!==m},W.isSame=function(P,K){var G=C(P);return this.startOf(K)<=G&&G<=this.endOf(K)},W.isAfter=function(P,K){return C(P)<this.startOf(K)},W.isBefore=function(P,K){return this.endOf(K)<C(P)},W.$g=function(P,K,G){return T.u(P)?this[K]:this.set(G,P)},W.unix=function(){return Math.floor(this.valueOf()/1e3)},W.valueOf=function(){return this.$d.getTime()},W.startOf=function(P,K){var G=this,V=!!T.u(K)||K,tt=T.p(P),ft=function(It,Nt){var se=T.w(G.$u?Date.UTC(G.$y,Nt,It):new Date(G.$y,Nt,It),G);return V?se:se.endOf(h)},vt=function(It,Nt){return T.w(G.toDate()[It].apply(G.toDate("s"),(V?[0,0,0,0]:[23,59,59,999]).slice(Nt)),G)},lt=this.$W,yt=this.$M,bt=this.$D,Bt="set"+(this.$u?"UTC":"");switch(tt){case g:return V?ft(1,0):ft(31,11);case c:return V?ft(1,yt):ft(0,yt+1);case p:var Et=this.$locale().weekStart||0,ne=(lt<Et?lt+7:lt)-Et;return ft(V?bt-ne:bt+(6-ne),yt);case h:case w:return vt(Bt+"Hours",0);case f:return vt(Bt+"Minutes",1);case l:return vt(Bt+"Seconds",2);case a:return vt(Bt+"Milliseconds",3);default:return this.clone()}},W.endOf=function(P){return this.startOf(P,!1)},W.$set=function(P,K){var G,V=T.p(P),tt="set"+(this.$u?"UTC":""),ft=(G={},G[h]=tt+"Date",G[w]=tt+"Date",G[c]=tt+"Month",G[g]=tt+"FullYear",G[f]=tt+"Hours",G[l]=tt+"Minutes",G[a]=tt+"Seconds",G[s]=tt+"Milliseconds",G)[V],vt=V===h?this.$D+(K-this.$W):K;if(V===c||V===g){var lt=this.clone().set(w,1);lt.$d[ft](vt),lt.init(),this.$d=lt.set(w,Math.min(this.$D,lt.daysInMonth())).$d}else ft&&this.$d[ft](vt);return this.init(),this},W.set=function(P,K){return this.clone().$set(P,K)},W.get=function(P){return this[T.p(P)]()},W.add=function(P,K){var G,V=this;P=Number(P);var tt=T.p(K),ft=function(yt){var bt=C(V);return T.w(bt.date(bt.date()+Math.round(yt*P)),V)};if(tt===c)return this.set(c,this.$M+P);if(tt===g)return this.set(g,this.$y+P);if(tt===h)return ft(1);if(tt===p)return ft(7);var vt=(G={},G[l]=r,G[f]=n,G[a]=e,G)[tt]||1,lt=this.$d.getTime()+P*vt;return T.w(lt,this)},W.subtract=function(P,K){return this.add(-1*P,K)},W.format=function(P){var K=this,G=this.$locale();if(!this.isValid())return G.invalidDate||m;var V=P||"YYYY-MM-DDTHH:mm:ssZ",tt=T.z(this),ft=this.$H,vt=this.$m,lt=this.$M,yt=G.weekdays,bt=G.months,Bt=G.meridiem,Et=function(Nt,se,Vt,qt){return Nt&&(Nt[se]||Nt(K,V))||Vt[se].slice(0,qt)},ne=function(Nt){return T.s(ft%12||12,Nt,"0")},It=Bt||function(Nt,se,Vt){var qt=Nt<12?"AM":"PM";return Vt?qt.toLowerCase():qt};return V.replace(v,function(Nt,se){return se||function(Vt){switch(Vt){case"YY":return String(K.$y).slice(-2);case"YYYY":return T.s(K.$y,4,"0");case"M":return lt+1;case"MM":return T.s(lt+1,2,"0");case"MMM":return Et(G.monthsShort,lt,bt,3);case"MMMM":return Et(bt,lt);case"D":return K.$D;case"DD":return T.s(K.$D,2,"0");case"d":return String(K.$W);case"dd":return Et(G.weekdaysMin,K.$W,yt,2);case"ddd":return Et(G.weekdaysShort,K.$W,yt,3);case"dddd":return yt[K.$W];case"H":return String(ft);case"HH":return T.s(ft,2,"0");case"h":return ne(1);case"hh":return ne(2);case"a":return It(ft,vt,!0);case"A":return It(ft,vt,!1);case"m":return String(vt);case"mm":return T.s(vt,2,"0");case"s":return String(K.$s);case"ss":return T.s(K.$s,2,"0");case"SSS":return T.s(K.$ms,3,"0");case"Z":return tt}return null}(Nt)||tt.replace(":","")})},W.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},W.diff=function(P,K,G){var V,tt=this,ft=T.p(K),vt=C(P),lt=(vt.utcOffset()-this.utcOffset())*r,yt=this-vt,bt=function(){return T.m(tt,vt)};switch(ft){case g:V=bt()/12;break;case c:V=bt();break;case d:V=bt()/3;break;case p:V=(yt-lt)/6048e5;break;case h:V=(yt-lt)/864e5;break;case f:V=yt/n;break;case l:V=yt/r;break;case a:V=yt/e;break;default:V=yt}return G?V:T.a(V)},W.daysInMonth=function(){return this.endOf(c).$D},W.$locale=function(){return F[this.$L]},W.locale=function(P,K){if(!P)return this.$L;var G=this.clone(),V=O(P,K,!0);return V&&(G.$L=V),G},W.clone=function(){return T.w(this.$d,this)},W.toDate=function(){return new Date(this.valueOf())},W.toJSON=function(){return this.isValid()?this.toISOString():null},W.toISOString=function(){return this.$d.toISOString()},W.toString=function(){return this.$d.toUTCString()},k}(),U=L.prototype;return C.prototype=U,[["$ms",s],["$s",a],["$m",l],["$H",f],["$W",h],["$M",c],["$y",g],["$D",w]].forEach(function(k){U[k[1]]=function(W){return this.$g(W,k[0],k[1])}}),C.extend=function(k,W){return k.$i||(k(W,L,C),k.$i=!0),C},C.locale=O,C.isDayjs=S,C.unix=function(k){return C(1e3*k)},C.en=F[x],C.Ls=F,C.p={},C})})(xl);var Fp=xl.exports,ee=Zt(Fp),Al={exports:{}};(function(i,t){(function(e,r){i.exports=r()})(jt,function(){var e="minute",r=/[+-]\d\d(?::?\d\d)?/g,n=/([+-]|\d\d)/g;return function(s,a,l){var f=a.prototype;l.utc=function(m){var D={date:m,utc:!0,args:arguments};return new a(D)},f.utc=function(m){var D=l(this.toDate(),{locale:this.$L,utc:!0});return m?D.add(this.utcOffset(),e):D},f.local=function(){return l(this.toDate(),{locale:this.$L,utc:!1})};var h=f.parse;f.parse=function(m){m.utc&&(this.$u=!0),this.$utils().u(m.$offset)||(this.$offset=m.$offset),h.call(this,m)};var p=f.init;f.init=function(){if(this.$u){var m=this.$d;this.$y=m.getUTCFullYear(),this.$M=m.getUTCMonth(),this.$D=m.getUTCDate(),this.$W=m.getUTCDay(),this.$H=m.getUTCHours(),this.$m=m.getUTCMinutes(),this.$s=m.getUTCSeconds(),this.$ms=m.getUTCMilliseconds()}else p.call(this)};var c=f.utcOffset;f.utcOffset=function(m,D){var v=this.$utils().u;if(v(m))return this.$u?0:v(this.$offset)?c.call(this):this.$offset;if(typeof m=="string"&&(m=function(x){x===void 0&&(x="");var F=x.match(r);if(!F)return null;var M=(""+F[0]).match(n)||["-",0,0],S=M[0],O=60*+M[1]+ +M[2];return O===0?0:S==="+"?O:-O}(m),m===null))return this;var E=Math.abs(m)<=16?60*m:m,b=this;if(D)return b.$offset=E,b.$u=m===0,b;if(m!==0){var N=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(b=this.local().add(E+N,e)).$offset=E,b.$x.$localOffset=N}else b=this.utc();return b};var d=f.format;f.format=function(m){var D=m||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return d.call(this,D)},f.valueOf=function(){var m=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*m},f.isUTC=function(){return!!this.$u},f.toISOString=function(){return this.toDate().toISOString()},f.toString=function(){return this.toDate().toUTCString()};var g=f.toDate;f.toDate=function(m){return m==="s"&&this.$offset?l(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():g.call(this)};var w=f.diff;f.diff=function(m,D,v){if(m&&this.$u===m.$u)return w.call(this,m,D,v);var E=this.local(),b=l(m).local();return w.call(E,b,D,v)}}})})(Al);var Mp=Al.exports,Np=Zt(Mp),Cl={exports:{}};(function(i,t){(function(e,r){i.exports=r()})(jt,function(){var e={year:0,month:1,day:2,hour:3,minute:4,second:5},r={};return function(n,s,a){var l,f=function(d,g,w){w===void 0&&(w={});var m=new Date(d),D=function(v,E){E===void 0&&(E={});var b=E.timeZoneName||"short",N=v+"|"+b,x=r[N];return x||(x=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:v,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:b}),r[N]=x),x}(g,w);return D.formatToParts(m)},h=function(d,g){for(var w=f(d,g),m=[],D=0;D<w.length;D+=1){var v=w[D],E=v.type,b=v.value,N=e[E];N>=0&&(m[N]=parseInt(b,10))}var x=m[3],F=x===24?0:x,M=m[0]+"-"+m[1]+"-"+m[2]+" "+F+":"+m[4]+":"+m[5]+":000",S=+d;return(a.utc(M).valueOf()-(S-=S%1e3))/6e4},p=s.prototype;p.tz=function(d,g){d===void 0&&(d=l);var w=this.utcOffset(),m=this.toDate(),D=m.toLocaleString("en-US",{timeZone:d}),v=Math.round((m-new Date(D))/1e3/60),E=a(D,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(15*-Math.round(m.getTimezoneOffset()/15)-v,!0);if(g){var b=E.utcOffset();E=E.add(w-b,"minute")}return E.$x.$timezone=d,E},p.offsetName=function(d){var g=this.$x.$timezone||a.tz.guess(),w=f(this.valueOf(),g,{timeZoneName:d}).find(function(m){return m.type.toLowerCase()==="timezonename"});return w&&w.value};var c=p.startOf;p.startOf=function(d,g){if(!this.$x||!this.$x.$timezone)return c.call(this,d,g);var w=a(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return c.call(w,d,g).tz(this.$x.$timezone,!0)},a.tz=function(d,g,w){var m=w&&g,D=w||g||l,v=h(+a(),D);if(typeof d!="string")return a(d).tz(D);var E=function(F,M,S){var O=F-60*M*1e3,C=h(O,S);if(M===C)return[O,M];var T=h(O-=60*(C-M)*1e3,S);return C===T?[O,C]:[F-60*Math.min(C,T)*1e3,Math.max(C,T)]}(a.utc(d,m).valueOf(),v,D),b=E[0],N=E[1],x=a(b).utcOffset(N);return x.$x.$timezone=D,x},a.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},a.tz.setDefault=function(d){l=d}}})})(Cl);var Sp=Cl.exports,Bp=Zt(Sp),Fl={exports:{}};(function(i,t){(function(e,r){i.exports=r()})(jt,function(){var e="week",r="year";return function(n,s,a){var l=s.prototype;l.week=function(f){if(f===void 0&&(f=null),f!==null)return this.add(7*(f-this.week()),"day");var h=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var p=a(this).startOf(r).add(1,r).date(h),c=a(this).endOf(e);if(p.isBefore(c))return 1}var d=a(this).startOf(r).date(h).startOf(e).subtract(1,"millisecond"),g=this.diff(d,e,!0);return g<0?a(this).startOf("week").week():Math.ceil(g)},l.weeks=function(f){return f===void 0&&(f=null),this.week(f)}}})})(Fl);var Tp=Fl.exports,Ip=Zt(Tp);function ms(i){const t=parseInt(i)||1;let e=i.replace(/\d+/,"");return e==="m"||e==="M"?e="M":e?e=e.toLocaleLowerCase():e="m",[t,e]}function Op(i=10){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let e="";const r=t.length;for(let n=0;n<i;n++)e+=t.charAt(Math.floor(Math.random()*r));return e}function $p(i){const t=/([+-])(\d{2})(\d{2})/,e=i.match(t);if(!e)throw new Error("Invalid timezone string");const[,r,n,s]=e;return(r==="+"?1:-1)*(parseInt(n,10)*60+parseInt(s,10))}function Br(i,t){return t&&(t.startsWith("UTC")||t.startsWith("GMT"))?ee(i).utcOffset($p(t)):ee(i).tz(t)}function Xr(i){const[t,e]=ms(i);let r=0;switch(e){case"m":r=60;break;case"s":r=1;break;case"M":r=31*24*60*60;break;case"d":r=24*60*60;break;case"w":r=7*24*60*60;break;default:r=60*60;break}return Math.round(Number(t)*r)}function _t(i){return typeof i!="number"||isNaN(i)}var Ur=(i=>(i.BOOL="bool",i.INT="int",i.FLOAT="float",i.ARRAY="array",i.BOX="box",i.CHART_POINT="chart.point",i.COLOR="color",i.CONST="const",i.LABEL="label",i.LINE="line",i.LINEFILL="linefill",i.MAP="map",i.MATRIX="matrix",i.POLYLINE="polyline",i.SERIES="series",i.SIMPLE="simple",i.STRING="string",i.TABLE="table",i.UNDETERMINED="undetermined type",i.INPUT="input",i.NA="na",i.VOID="void",i))(Ur||{}),gs=(i=>(i.dividends="dividends",i.none="none",i.splits="splits",i))(gs||{}),dn=(i=>(i.freqAll="freq_all",i.freqOncePerBar="freq_once_per_bar",i.freqOncePerBarClose="freq_once_per_bar_close",i))(dn||{}),zi=(i=>(i.gapsOff="gaps_off",i.gapsOn="gaps_on",i.lookaheadOff="lookahead_off",i.lookaheadOn="lookahead_on",i))(zi||{}),ir=(i=>(i.all="all",i.dataWindow="data_window",i.none="none",i.pane="pane",i.priceScale="price_scale",i.statusLine="status_line",i))(ir||{}),Rn=(i=>(i.both="both",i.left="left",i.none="none",i.right="right",i))(Rn||{}),Pn=(i=>(i.inherit="inherit",i.mintick="mintick",i.percent="percent",i.price="price",i.volume="volume",i))(Pn||{}),vs=(i=>(i.styleDashed="style_dashed",i.styleDotted="style_dotted",i.styleSolid="style_solid",i))(vs||{}),ge=(i=>(i.styleArrowdown="style_arrowdown",i.styleArrowup="style_arrowup",i.styleCircle="style_circle",i.styleCross="style_cross",i.styleDiamond="style_diamond",i.styleFlag="style_flag",i.styleLabelCenter="style_label_center",i.styleLabelDown="style_label_down",i.styleLabelLeft="style_label_left",i.styleLabelLowerLeft="style_label_lower_left",i.styleLabelLowerRight="style_label_lower_right",i.styleLabelRight="style_label_right",i.styleLabelUp="style_label_up",i.styleLabelUpperLeft="style_label_upper_left",i.styleLabelUpperRight="style_label_upper_right",i.styleNone="style_none",i.styleSquare="style_square",i.styleTextOutline="style_text_outline",i.styleTriangledown="style_triangledown",i.styleTriangleup="style_triangleup",i.styleXcross="style_xcross",i))(ge||{}),Wr=(i=>(i.styleArrowBoth="style_arrow_both",i.styleArrowLeft="style_arrow_left",i.styleArrowRight="style_arrow_right",i.styleDashed="style_dashed",i.styleDotted="style_dotted",i.styleSolid="style_solid",i))(Wr||{}),si=(i=>(i.abovebar="abovebar",i.absolute="absolute",i.belowbar="belowbar",i.bottom="bottom",i.top="top",i))(si||{}),zn=(i=>(i.ascending="ascending",i.descending="descending",i))(zn||{}),vr=(i=>(i.styleArea="Area",i.styleAreabr="Area With Breaks",i.styleCircles="Circles",i.styleColumns="Columns",i.styleCross="Cross",i.styleHistogram="Histogram",i.styleLine="Line",i.styleLinebr="Line With Breaks",i.styleStepline="Step Line",i.styleSteplineDiamond="Step Line With Diamonds",i.styleSteplinebr="Step line with Breaks",i))(vr||{}),Tr=(i=>(i.bottomCenter="bottom_center",i.bottomLeft="bottom_left",i.bottomRight="bottom_right",i.middleCenter="middle_center",i.middleLeft="middle_left",i.middleRight="middle_right",i.topCenter="top_center",i.topLeft="top_left",i.topRight="top_right",i))(Tr||{}),ws=(i=>(i.left="left",i.none="none",i.right="right",i))(ws||{}),na=(i=>(i.extended="extended",i.regular="regular",i))(na||{}),sr=(i=>(i.arrowdown="arrowdown",i.arrowup="arrowup",i.circle="circle",i.cross="cross",i.diamond="diamond",i.flag="flag",i.labeldown="labeldown",i.labelup="labelup",i.square="square",i.triangledown="triangledown",i.triangleup="triangleup",i.xcross="xcross",i))(sr||{}),jr=(i=>(i.auto="auto",i.huge="huge",i.large="large",i.normal="normal",i.small="small",i.tiny="tiny",i))(jr||{}),Ge=(i=>(i.cash="cash",i.fixed="fixed",i.percentOfEquity="percent_of_equity",i))(Ge||{}),Ir=(i=>(i.cashPerContract="cash_per_contract",i.cashPerOrder="cash_per_order",i.percent="percent",i))(Ir||{}),pe=(i=>(i.all="all",i.long="long",i.short="short",i))(pe||{}),qn=(i=>(i.cancel="cancel",i.none="none",i.reduce="reduce",i))(qn||{}),Xe=(i=>(i.alignBottom="align_bottom",i.alignCenter="align_center",i.alignLeft="align_left",i.alignRight="align_right",i.alignTop="align_top",i.wrapAuto="wrap_auto",i.wrapNone="wrap_none",i))(Xe||{}),Oe=(i=>(i.bar_index="bar_index",i.bar_time="bar_time",i))(Oe||{}),qi=(i=>(i.abovebar="abovebar",i.belowbar="belowbar",i.price="price",i))(qi||{}),ys=(i=>(i.actual="actual",i.estimate="estimate",i.standardized="standardized",i))(ys||{}),kn=(i=>(i.traditional="Traditional",i.fibonacci="Fibonacci",i.woodie="Woodie",i.classic="Classic",i.dm="DM",i.camarilla="Camarilla",i))(kn||{}),Re=(i=>(i[i.Hint=1]="Hint",i[i.Info=2]="Info",i[i.Warning=4]="Warning",i[i.Error=8]="Error",i))(Re||{});class Lp{constructor(t){z(this,"_errorListener");this._errorListener=t}new({size:t,initial_value:e}={}){return new Jt(t,e,this._errorListener)}new_float({size:t,initial_value:e}={}){return new Jt(t,e,this._errorListener)}new_int({size:t,initial_value:e}={}){return new Jt(t,e,this._errorListener)}new_color({size:t,initial_value:e}={}){return new Jt(t,e,this._errorListener)}new_bool({size:t,initial_value:e}={}){return new Jt(t,e,this._errorListener)}new_string({size:t,initial_value:e}={}){return new Jt(t,e,this._errorListener)}new_line({size:t,initial_value:e}={}){return new Jt(t,e,this._errorListener)}new_box({size:t,initial_value:e}={}){return new Jt(t,e,this._errorListener)}new_table({size:t,initial_value:e}={}){return new Jt(t,e,this._errorListener)}new_linefill({size:t,initial_value:e}={}){return new Jt(t,e,this._errorListener)}new_label({size:t,initial_value:e}={}){return new Jt(t,e,this._errorListener)}copy({id:t}){return t==null?void 0:t.copy()}slice({id:t,index_from:e,index_to:r}){return t==null?void 0:t.slice({index_from:e,index_to:r})}size({id:t}){return t==null?void 0:t.size()}first({id:t}){return t==null?void 0:t.first()}abs({id:t},e){return t==null?void 0:t.abs(e)}avg({id:t},e){return t==null?void 0:t.avg(e)}binary_search({id:t,val:e},r){return t==null?void 0:t.binary_search({val:e},r)}binary_search_leftmost({id:t,val:e},r){return t==null?void 0:t.binary_search_leftmost({val:e},r)}binary_search_rightmost({id:t,val:e},r){return t==null?void 0:t.binary_search_rightmost({val:e},r)}clear({id:t}){t==null||t.clear()}concat({id1:t,id2:e}){return t==null?void 0:t.concat({id2:e})}covariance({id1:t,id2:e,biased:r},n){return t==null?void 0:t.covariance({id2:e,biased:r},n)}every({id:t},e){return t==null?void 0:t.every(e)}from(t,e){const r=new Jt(0,void 0,this._errorListener);return r._value=e,r}fill({id:t,value:e,index_from:r,index_to:n}){t==null||t.fill({value:e,index_from:r,index_to:n})}get({id:t,index:e}){return t==null?void 0:t.get({index:e})}includes({id:t,value:e}){return t==null?void 0:t.includes({value:e})}indexof({id:t,value:e}){return t==null?void 0:t.indexof({value:e})}insert({id:t,index:e,value:r}){t==null||t.insert({index:e,value:r})}join({id:t,separator:e},r){return t==null?void 0:t.join({separator:e},r)}last({id:t}){return t==null?void 0:t.last()}lastindexof({id:t,value:e}){return t==null?void 0:t.lastindexof({value:e})}max({id:t,nth:e},r){return t==null?void 0:t.max({nth:e},r)}median({id:t},e){return t==null?void 0:t.median(e)}min({id:t,nth:e},r){return t==null?void 0:t.min({nth:e},r)}mode({id:t},e){return t==null?void 0:t.mode(e)}percentile_linear_interpolation({id:t,percentage:e},r){return t==null?void 0:t.percentile_linear_interpolation({percentage:e},r)}percentile_nearest_rank({id:t,percentage:e},r){return t==null?void 0:t.percentile_nearest_rank({percentage:e},r)}percentrank({id:t,index:e},r){return t==null?void 0:t.percentrank({index:e},r)}pop({id:t}){return t==null?void 0:t.pop()}push({id:t,value:e}){t==null||t.push({value:e})}range({id:t},e){return t==null?void 0:t.range(e)}remove({id:t,index:e}){return t==null?void 0:t.remove({index:e})}reverse({id:t}){return t==null?void 0:t.reverse()}set({id:t,index:e,value:r}){t==null||t.set({index:e,value:r})}shift({id:t}){return t==null?void 0:t.shift()}some({id:t},e){return t==null?void 0:t.some(e)}sort({id:t,order:e},r){t==null||t.sort({order:e},r)}sort_indices({id:t,order:e},r){return t==null?void 0:t.sort_indices({order:e},r)}standardize({id:t},e){return t==null?void 0:t.standardize(e)}stdev({id:t,biased:e},r){return t==null?void 0:t.stdev({biased:e},r)}sum({id:t},e){return t==null?void 0:t.sum(e)}unshift({id:t,value:e}){t==null||t.unshift({value:e})}variance({id:t,biased:e},r){return t==null?void 0:t.variance({biased:e},r)}}class Jt{constructor(t=0,e,r){z(this,"_arrInstance");z(this,"_errorListener");this._errorListener=r,this._arrInstance=Array.from(new Array(t||0),()=>Sr.cloneDeep(e))}get isArray(){return!0}get _value(){return[...this._arrInstance]}set _value(t){this._arrInstance=[...t]}_deepCopyData(t){this._arrInstance=Sr.cloneDeep(t)}_copyData(t){this._arrInstance=t}copy(){const t=new Jt(0,void 0,this._errorListener);return t._deepCopyData(this._arrInstance),t}slice({index_from:t,index_to:e}){const r=new Jt(0,void 0,this._errorListener);return r._copyData(this._arrInstance.slice(t,e)),r}size(){return this._arrInstance.length}first(){return this._arrInstance[0]}abs(t){const e=new Jt(0,void 0,this._errorListener);this._verifySimpleType("number","abs","int/float",t);const r=this._arrInstance.map(n=>Math.abs(n));return e._copyData(r),e}avg(t){return this._verifySimpleType("number","avg","int/float",t),Sr.mean(this._arrInstance)}binary_search({val:t},e){return this._verifySimpleType("number","binary_search","int/float",e),_t(t)?-1:this._binarySearch(this._arrInstance,t)}binary_search_leftmost({val:t},e){return this._verifySimpleType("number","binary_search_leftmost","int/float",e),_t(t)?this._arrInstance.length-1:this._binarySearchLeftMost(this._arrInstance,t)}binary_search_rightmost({val:t},e){return this._verifySimpleType("number","binary_search_rightmost","int/float",e),_t(t)?this._arrInstance.length:this._binarySearchRightMost(this._arrInstance,t)}clear(){this._arrInstance=[]}concat({id2:t}){return this._arrInstance=this._arrInstance.concat(t==null?void 0:t._value),this}covariance({id2:t,biased:e},r){return this._verifySimpleType("number","covariance","int/float",r),this._verifySimpleType("number","covariance","int/float",r,t==null?void 0:t._value),this._covariance(this._arrInstance,t._value,e,r)}every(t){return this._verifySimpleType("number|boolean","every","int/float/bool",t),this._arrInstance.every(e=>!!e)}fill({value:t,index_from:e=0,index_to:r}){this._arrInstance=this._setElements(this._arrInstance,t,e,r)}get({index:t}){if(!_t(t))return this._arrInstance[t]}includes({value:t}){return this._arrInstance.includes(t)}indexof({value:t}){return this._arrInstance.indexOf(t)}insert({index:t,value:e}){_t(t)||this._arrInstance.splice(t,0,e)}join({separator:t}={},e){return this._verifySimpleType("number|string","join","int/float/string",e),this._arrInstance.join(t)}last(){return this._arrInstance[this._arrInstance.length-1]}lastindexof({value:t}){return this._arrInstance.lastIndexOf(t)}max({nth:t}={},e){return this._verifySimpleType("number","max","int/float",e),this._maxNth([...this._arrInstance],t)}median(t){return this._verifySimpleType("number","median","int/float",t),this._median([...this._arrInstance])}min({nth:t}={},e){return this._verifySimpleType("number","min","int/float",e),this._minNth([...this._arrInstance],t)}mode(t){return this._verifySimpleType("number","mode","int/float",t),this._mode([...this._arrInstance])}percentile_linear_interpolation({percentage:t},e){return this._verifySimpleType("number","percentile_linear_interpolation","int/float",e),this._percentileLinearInterpolation([...this._arrInstance],t)}percentile_nearest_rank({percentage:t=0},e){var r;if(this._arrInstance.length===0||t<0||t>100||_t(t)){(r=this._errorListener)==null||r.addError("Invalid percentile or empty array",e,Re.Error);return}return this._verifySimpleType("number","percentile_nearest_rank","int/float",e),this._getNearestRankPercentile([...this._arrInstance],t)}percentrank({index:t},e){return this._verifySimpleType("number","percentrank","int/float",e),this._getPercentileRank([...this._arrInstance],t)}pop(){return this._arrInstance.pop()}push({value:t}){this._arrInstance.push(t)}range(t){var s;if(this._arrInstance.length===0){(s=this._errorListener)==null||s.addError("Array must not be empty",t,Re.Error);return}this._verifySimpleType("number","range","int/float",t);const e=Math.min(...this._arrInstance);return Math.max(...this._arrInstance)-e}remove({index:t}){if(!_t(t))return this._arrInstance.splice(t,1)[0]}reverse(){this._arrInstance.reverse()}set({index:t,value:e}){_t(t)||(this._arrInstance[t]=e)}shift(){return this._arrInstance.shift()}some(t){return this._verifySimpleType("number|boolean","some","int/float/bool",t),this._arrInstance.some(e=>!!e)}sort({order:t}={},e){this._verifySimpleType("number","sort","int/float",e),this._arrInstance.sort((r,n)=>t!==zn.descending?r-n:n-r)}sort_indices({order:t}={},e){this._verifySimpleType("number","sort_indices","int/float",e);const r=this._arrInstance.map((s,a)=>a);r.sort((s,a)=>t!==zn.descending?this._arrInstance[s]-this._arrInstance[a]:this._arrInstance[a]-this._arrInstance[s]);const n=new Jt(0,void 0,this._errorListener);return n._copyData(r),n}standardize(t){this._verifySimpleType("number","standardize","int/float",t);const e=new Jt(0,void 0,this._errorListener);return e._copyData(this._standardizeArray([...this._arrInstance])),e}stdev({biased:t}={},e){var r;if(this._arrInstance.length===0){(r=this._errorListener)==null||r.addError("Array must not be empty",e,Re.Error);return}return this._verifySimpleType("number","stdev","int/float",e),this._calculateStandardDeviations([...this._arrInstance],t)}sum(t){return this._verifySimpleType("number","sum","int/float",t),this._arrInstance.reduce((r,n)=>r+(n||0),0)}unshift({value:t}){this._arrInstance.unshift(t)}variance({biased:t}={},e){var r;if(this._arrInstance.length===0){(r=this._errorListener)==null||r.addError("Array must not be empty",e,Re.Error);return}return this._verifySimpleType("number","variance","int/float",e),this._calculateVariances([...this._arrInstance],t)}_calculateVariances(t,e=!0){const r=t.reduce((a,l)=>a+(l||0),0)/t.length,n=t.reduce((a,l)=>a+((l||0)-r)**2,0),s=n/t.length;return e?s:t.length>1?n/(t.length-1):s}_calculateStandardDeviations(t,e=!0){const r=t.reduce((a,l)=>a+(l||0),0)/t.length,n=t.reduce((a,l)=>{const f=(l||0)-r;return a+f*f},0),s=Math.sqrt(n/t.length);return e?s:t.length>1?Math.sqrt(n/(t.length-1)):s}_standardizeArray(t){const e=t.reduce((s,a)=>s+(a||0),0)/t.length,r=Math.sqrt(t.reduce((s,a)=>s+Math.pow((a||0)-e,2),0)/t.length);return t.map(s=>((s||0)-e)/r)}_getPercentileRank(t,e=0){if(_t(e))return;const r=t[e];let n=0;for(let a=0;a<t.length;a++)(t[a]<r||t[a]===r&&a!=e)&&n++;return n/(t.length-1)*100}_getNearestRankPercentile(t,e=0){const r=t.slice().sort((a,l)=>a-l),n=e/100*r.length,s=Math.ceil(n)-1;return r[s>=r.length?r.length-1:s]}_percentileLinearInterpolation(t,e=0){if(e<0||e>100||_t(e))return;t.sort(function(s,a){return s-a});const r=t.length;e/=100;const n=1/(r*2);if(e<=n)return t[0];if(e>=1-1/(r*2))return t[r-1];for(const[s,a]of t.entries()){const l=t[s-1];if(e<(s+.5)/r)return l+(a-l)*(e-(s-.5)/r)/(1/r)}}_mode(t){const e={};let r=0;const n=[];for(const s of t)e[s]=(e[s]||0)+1,r=Math.max(r,e[s]);for(const s in e)e[s]===r&&n.push(Number(s));return Math.min(...r===1?t:n)}_median(t){t.sort(function(r,n){return r-n});const e=Math.floor(t.length/2);return t.length%2?t[e]:(t[e-1]+t[e])/2}_minNth(t,e=0){return t.sort(function(r,n){return r-n}),t[e]}_maxNth(t,e=0){return t.sort(function(r,n){return n-r}),t[e]}_setElements(t,e,r=0,n){n===void 0&&(n=t.length);for(let s=r;s<n;s++)t[s]=e;return t}_covariance(t,e,r=!0,n){var f;if(t.length!=e.length){(f=this._errorListener)==null||f.addError("Arrays have different lengths",n,Re.Error);return}t=t.filter(h=>h!==void 0),e=e.filter(h=>h!==void 0);const s=t.reduce((h,p)=>h+p,0)/t.length,a=e.reduce((h,p)=>h+p,0)/e.length;let l=0;for(let h=0;h<t.length;h++)l+=(t[h]-s)*(e[h]-a);return r?l/t.length:l/(t.length-1)}_verifySimpleType(t,e,r,n,s=this._arrInstance){var l;s.filter(f=>f!==void 0).some(f=>!t.split("|").includes(typeof f))&&((l=this._errorListener)==null||l.addError(`数组类型错误,array.${e}方法只能使用${r}类型数组!`,n,Re.Error))}_binarySearch(t,e){let r=0,n=t.length-1;for(;r<=n;){const s=Math.floor((r+n)/2);if(t[s]===e)return s;t[s]<e?r=s+1:n=s-1}return-1}_binarySearchLeftMost(t,e){let r=0,n=t.length-1;const s=[];for(;r<=n;){const a=Math.floor((r+n)/2);t[a]===e&&s.push(a),t[a]<e?r=a+1:n=a-1}return s.length?Math.min(...s):r-1}_binarySearchRightMost(t,e){let r=0,n=t.length-1;const s=[];for(;r<=n;){const a=Math.floor((r+n)/2);t[a]===e&&s.push(a),t[a]<=e?r=a+1:n=a-1}return s.length?Math.max(...s):r}}class Rp{constructor(t,e){z(this,"_randomNums");z(this,"_mintick");z(this,"_cacheData");z(this,"_barIndex");z(this,"_errorListener");this._mintick=t,this._randomNums={},this._cacheData={},this._barIndex=0,this._errorListener=e}update(t){this._barIndex=t,this._randomNums={}}abs({number:t}){if(!_t(t))return Math.abs(t)}acos({angle:t}){if(_t(t))return;const e=Math.acos(t);return isNaN(e)?void 0:e}asin({angle:t}){if(_t(t))return;const e=Math.asin(t);return isNaN(e)?void 0:e}atan({angle:t}){if(_t(t))return;const e=Math.atan(t);return isNaN(e)?void 0:e}avg(t,e){return Sr.mean(e)}ceil({number:t}){if(!_t(t))return Math.ceil(t)}floor({number:t}){if(!_t(t))return Math.floor(t)}cos({angle:t}){if(_t(t))return;const e=Math.cos(t);return isNaN(e)?void 0:e}sin({angle:t}){if(_t(t))return;const e=Math.sin(t);return isNaN(e)?void 0:e}tan({angle:t}){if(_t(t))return;const e=Math.tan(t);return isNaN(e)?void 0:e}exp({number:t}){if(!_t(t))return Math.exp(t)}log({number:t}){if(!_t(t))return Math.log(t)}log10({number:t}){if(!_t(t))return Math.log10(t)}max(t,e){return e=e.filter(r=>!_t(r)),Math.max(...e)}min(t,e){return e=e.filter(r=>!_t(r)),Math.min(...e)}pow({base:t,exponent:e}){if(!(_t(t)||_t(e)))return Math.pow(t,e)}random({min:t=0,max:e=1,seed:r},n){if(_t(t)&&(t=0),_t(e)&&(e=1),r&&this._randomNums[r])return this._randomNums[r];if(t>=e){this._errorListener.addError("min must be less than max",n,Re.Error);return}let s;do s=Math.random()*(e-t)+t;while(s===t||s===e);return r&&(this._randomNums[r]=s),s}round({number:t,precision:e}){if(!_t(t))return _t(e)?Math.round(t):Number(t==null?void 0:t.toFixed(e))}round_to_mintick({number:t}){if(!_t(t))return Number(t==null?void 0:t.toFixed(this._mintick))}sign({number:t}){if(!_t(t))return t&&Math.sign(t)}sqrt({number:t}){if(!_t(t))return Math.sqrt(t)}sum({source:t,length:e=1},r){let n=this._cacheData[`sum_${r}`];n||(n=[]),n[this._barIndex]=t,this._cacheData[`sum_${r}`]=n;const s=n.filter(a=>!_t(a));if(!(s.length<e))return Sr.sum(s.slice(-e))}todegrees({radians:t}){if(!_t(t))return t*(180/Math.PI)}toradians({degrees:t}){if(_t(t))return;const e=t*(Math.PI/180);return Number(e.toFixed(this._mintick))}}function Ds(){return Ds=Object.assign?Object.assign.bind():function(i){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i[r]=e[r])}return i},Ds.apply(this,arguments)}var Ml={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null};function le(i){return typeof i=="number"}function Ee(i){return!i||typeof i!="object"||typeof i.constructor!="function"?!1:i.isBigNumber===!0&&typeof i.constructor.prototype=="object"&&i.constructor.prototype.isBigNumber===!0||typeof i.constructor.isDecimal=="function"&&i.constructor.isDecimal(i)===!0}function Nl(i){return i&&typeof i=="object"&&Object.getPrototypeOf(i).isComplex===!0||!1}function Sl(i){return i&&typeof i=="object"&&Object.getPrototypeOf(i).isFraction===!0||!1}function Bl(i){return i&&i.constructor.prototype.isUnit===!0||!1}function Yr(i){return typeof i=="string"}var ve=Array.isArray;function ce(i){return i&&i.constructor.prototype.isMatrix===!0||!1}function ki(i){return Array.isArray(i)||ce(i)}function Pp(i){return i&&i.isDenseMatrix&&i.constructor.prototype.isMatrix===!0||!1}function zp(i){return i&&i.isSparseMatrix&&i.constructor.prototype.isMatrix===!0||!1}function qp(i){return i&&i.constructor.prototype.isRange===!0||!1}function ia(i){return i&&i.constructor.prototype.isIndex===!0||!1}function kp(i){return typeof i=="boolean"}function Up(i){return i&&i.constructor.prototype.isResultSet===!0||!1}function Wp(i){return i&&i.constructor.prototype.isHelp===!0||!1}function jp(i){return typeof i=="function"}function Yp(i){return i instanceof Date}function Zp(i){return i instanceof RegExp}function sa(i){return!!(i&&typeof i=="object"&&i.constructor===Object&&!Nl(i)&&!Sl(i))}function Gp(i){return i===null}function Kp(i){return i===void 0}function Hp(i){return i&&i.isAccessorNode===!0&&i.constructor.prototype.isNode===!0||!1}function Jp(i){return i&&i.isArrayNode===!0&&i.constructor.prototype.isNode===!0||!1}function Xp(i){return i&&i.isAssignmentNode===!0&&i.constructor.prototype.isNode===!0||!1}function Vp(i){return i&&i.isBlockNode===!0&&i.constructor.prototype.isNode===!0||!1}function Qp(i){return i&&i.isConditionalNode===!0&&i.constructor.prototype.isNode===!0||!1}function td(i){return i&&i.isConstantNode===!0&&i.constructor.prototype.isNode===!0||!1}function ed(i){return i&&i.isFunctionAssignmentNode===!0&&i.constructor.prototype.isNode===!0||!1}function rd(i){return i&&i.isFunctionNode===!0&&i.constructor.prototype.isNode===!0||!1}function nd(i){return i&&i.isIndexNode===!0&&i.constructor.prototype.isNode===!0||!1}function id(i){return i&&i.isNode===!0&&i.constructor.prototype.isNode===!0||!1}function sd(i){return i&&i.isObjectNode===!0&&i.constructor.prototype.isNode===!0||!1}function od(i){return i&&i.isOperatorNode===!0&&i.constructor.prototype.isNode===!0||!1}function ad(i){return i&&i.isParenthesisNode===!0&&i.constructor.prototype.isNode===!0||!1}function ud(i){return i&&i.isRangeNode===!0&&i.constructor.prototype.isNode===!0||!1}function ld(i){return i&&i.isRelationalNode===!0&&i.constructor.prototype.isNode===!0||!1}function fd(i){return i&&i.isSymbolNode===!0&&i.constructor.prototype.isNode===!0||!1}function cd(i){return i&&i.constructor.prototype.isChain===!0||!1}function _n(i){var t=typeof i;return t==="object"?i===null?"null":Ee(i)?"BigNumber":i.constructor&&i.constructor.name?i.constructor.name:"Object":t}function re(i){var t=typeof i;if(t==="number"||t==="string"||t==="boolean"||i===null||i===void 0)return i;if(typeof i.clone=="function")return i.clone();if(Array.isArray(i))return i.map(function(e){return re(e)});if(i instanceof Date)return new Date(i.valueOf());if(Ee(i))return i;if(sa(i))return hd(i,re);throw new TypeError("Cannot clone: unknown type of value (value: ".concat(i,")"))}function hd(i,t){var e={};for(var r in i)Ui(i,r)&&(e[r]=t(i[r]));return e}function Tl(i,t){for(var e in t)Ui(t,e)&&(i[e]=t[e]);return i}function oi(i,t){var e,r,n;if(Array.isArray(i)){if(!Array.isArray(t)||i.length!==t.length)return!1;for(r=0,n=i.length;r<n;r++)if(!oi(i[r],t[r]))return!1;return!0}else{if(typeof i=="function")return i===t;if(i instanceof Object){if(Array.isArray(t)||!(t instanceof Object))return!1;for(e in i)if(!(e in t)||!oi(i[e],t[e]))return!1;for(e in t)if(!(e in i))return!1;return!0}else return i===t}}function Ui(i,t){return i&&Object.hasOwnProperty.call(i,t)}function pd(i,t){for(var e={},r=0;r<t.length;r++){var n=t[r],s=i[n];s!==void 0&&(e[n]=s)}return e}var dd=["Matrix","Array"],_d=["number","BigNumber","Fraction"],or=function(t){if(t)throw new Error(`The global config is readonly.
|
27
|
+
}`;var Rt=xp(function(){return Xt(I,wt+"return "+ot).apply(e,R)});if(Rt.source=ot,ll(Rt))throw Rt;return Rt}function $C(o){return ee(o).toLowerCase()}function LC(o){return ee(o).toUpperCase()}function RC(o,u,_){if(o=ee(o),o&&(_||u===e))return Ih(o);if(!o||!(u=dr(u)))return o;var y=Rr(o),A=Rr(u),I=Oh(y,A),R=$h(y,A)+1;return On(y,I,R).join("")}function PC(o,u,_){if(o=ee(o),o&&(_||u===e))return o.slice(0,Rh(o)+1);if(!o||!(u=dr(u)))return o;var y=Rr(o),A=$h(y,Rr(u))+1;return On(y,0,A).join("")}function zC(o,u,_){if(o=ee(o),o&&(_||u===e))return o.replace(ts,"");if(!o||!(u=dr(u)))return o;var y=Rr(o),A=Oh(y,Rr(u));return On(y,A).join("")}function qC(o,u){var _=C,y=T;if(ye(u)){var A="separator"in u?u.separator:A;_="length"in u?Lt(u.length):_,y="omission"in u?dr(u.omission):y}o=ee(o);var I=o.length;if(Fi(o)){var R=Rr(o);I=R.length}if(_>=I)return o;var q=_-Mi(y);if(q<1)return y;var Y=R?On(R,0,q).join(""):o.slice(0,q);if(A===e)return Y+y;if(R&&(q+=Y.length-q),fl(A)){if(o.slice(q).search(A)){var Q,et=Y;for(A.global||(A=Cu(A.source,ee(po.exec(A))+"g")),A.lastIndex=0;Q=A.exec(et);)var ot=Q.index;Y=Y.slice(0,ot===e?q:ot)}}else if(o.indexOf(dr(A),q)!=q){var dt=Y.lastIndexOf(A);dt>-1&&(Y=Y.slice(0,dt))}return Y+y}function kC(o){return o=ee(o),o&&ka.test(o)?o.replace(Kn,mD):o}var UC=$i(function(o,u,_){return o+(_?" ":"")+u.toUpperCase()}),pl=A0("toUpperCase");function Ep(o,u,_){return o=ee(o),u=_?e:u,u===e?cD(o)?wD(o):rD(o):o.match(u)||[]}var xp=Pt(function(o,u){try{return hr(o,e,u)}catch(_){return ll(_)?_:new Tt(_)}}),WC=ln(function(o,u){return Er(u,function(_){_=Jr(_),an(o,_,al(o[_],o))}),o});function jC(o){var u=o==null?0:o.length,_=At();return o=u?me(o,function(y){if(typeof y[1]!="function")throw new xr(a);return[_(y[0]),y[1]]}):[],Pt(function(y){for(var A=-1;++A<u;){var I=o[A];if(hr(I[0],this,y))return hr(I[1],this,y)}})}function YC(o){return mb(Cr(o,c))}function dl(o){return function(){return o}}function ZC(o,u){return o==null||o!==o?u:o}var GC=F0(),KC=F0(!0);function nr(o){return o}function _l(o){return n0(typeof o=="function"?o:Cr(o,c))}function HC(o){return s0(Cr(o,c))}function JC(o,u){return o0(o,Cr(u,c))}var XC=Pt(function(o,u){return function(_){return ls(_,o,u)}}),VC=Pt(function(o,u){return function(_){return ls(o,_,u)}});function ml(o,u,_){var y=Re(u),A=Lo(u,y);_==null&&!(ye(u)&&(A.length||!y.length))&&(_=u,u=o,o=this,A=Lo(u,Re(u)));var I=!(ye(_)&&"chain"in _)||!!_.chain,R=cn(o);return Er(A,function(q){var Y=u[q];o[q]=Y,R&&(o.prototype[q]=function(){var Q=this.__chain__;if(I||Q){var et=o(this.__wrapped__),ot=et.__actions__=tr(this.__actions__);return ot.push({func:Y,args:arguments,thisArg:o}),et.__chain__=Q,et}return Y.apply(o,Mn([this.value()],arguments))})}),o}function QC(){return qe._===this&&(qe._=AD),this}function gl(){}function t2(o){return o=Lt(o),Pt(function(u){return a0(u,o)})}var e2=Ku(me),r2=Ku(Mh),n2=Ku(wu);function Ap(o){return el(o)?yu(Jr(o)):Ib(o)}function i2(o){return function(u){return o==null?e:ei(o,u)}}var s2=N0(),o2=N0(!0);function vl(){return[]}function wl(){return!1}function a2(){return{}}function u2(){return""}function l2(){return!0}function f2(o,u){if(o=Lt(o),o<1||o>G)return[];var _=ft,y=Ye(o,ft);u=At(u),o-=ft;for(var A=Eu(y,u);++_<o;)u(_);return A}function c2(o){return Ot(o)?me(o,Jr):_r(o)?[o]:tr(Y0(ee(o)))}function h2(o){var u=++ED;return ee(o)+u}var p2=Uo(function(o,u){return o+u},0),d2=Hu("ceil"),_2=Uo(function(o,u){return o/u},1),m2=Hu("floor");function g2(o){return o&&o.length?$o(o,nr,Ou):e}function v2(o,u){return o&&o.length?$o(o,At(u,2),Ou):e}function w2(o){return Bh(o,nr)}function y2(o,u){return Bh(o,At(u,2))}function D2(o){return o&&o.length?$o(o,nr,Pu):e}function b2(o,u){return o&&o.length?$o(o,At(u,2),Pu):e}var E2=Uo(function(o,u){return o*u},1),x2=Hu("round"),A2=Uo(function(o,u){return o-u},0);function C2(o){return o&&o.length?bu(o,nr):0}function F2(o,u){return o&&o.length?bu(o,At(u,2)):0}return B.after=Hx,B.ary=rp,B.assign=LA,B.assignIn=mp,B.assignInWith=ea,B.assignWith=RA,B.at=PA,B.before=np,B.bind=al,B.bindAll=WC,B.bindKey=ip,B.castArray=aA,B.chain=Q0,B.chunk=mE,B.compact=gE,B.concat=vE,B.cond=jC,B.conforms=YC,B.constant=dl,B.countBy=Cx,B.create=zA,B.curry=sp,B.curryRight=op,B.debounce=ap,B.defaults=qA,B.defaultsDeep=kA,B.defer=Jx,B.delay=Xx,B.difference=wE,B.differenceBy=yE,B.differenceWith=DE,B.drop=bE,B.dropRight=EE,B.dropRightWhile=xE,B.dropWhile=AE,B.fill=CE,B.filter=Mx,B.flatMap=Bx,B.flatMapDeep=Tx,B.flatMapDepth=Ix,B.flatten=H0,B.flattenDeep=FE,B.flattenDepth=ME,B.flip=Vx,B.flow=GC,B.flowRight=KC,B.fromPairs=NE,B.functions=KA,B.functionsIn=HA,B.groupBy=Ox,B.initial=BE,B.intersection=TE,B.intersectionBy=IE,B.intersectionWith=OE,B.invert=XA,B.invertBy=VA,B.invokeMap=Lx,B.iteratee=_l,B.keyBy=Rx,B.keys=Re,B.keysIn=rr,B.map=Ho,B.mapKeys=tC,B.mapValues=eC,B.matches=HC,B.matchesProperty=JC,B.memoize=Xo,B.merge=rC,B.mergeWith=gp,B.method=XC,B.methodOf=VC,B.mixin=ml,B.negate=Vo,B.nthArg=t2,B.omit=nC,B.omitBy=iC,B.once=Qx,B.orderBy=Px,B.over=e2,B.overArgs=tA,B.overEvery=r2,B.overSome=n2,B.partial=ul,B.partialRight=up,B.partition=zx,B.pick=sC,B.pickBy=vp,B.property=Ap,B.propertyOf=i2,B.pull=PE,B.pullAll=X0,B.pullAllBy=zE,B.pullAllWith=qE,B.pullAt=kE,B.range=s2,B.rangeRight=o2,B.rearg=eA,B.reject=Ux,B.remove=UE,B.rest=rA,B.reverse=sl,B.sampleSize=jx,B.set=aC,B.setWith=uC,B.shuffle=Yx,B.slice=WE,B.sortBy=Kx,B.sortedUniq=JE,B.sortedUniqBy=XE,B.split=BC,B.spread=nA,B.tail=VE,B.take=QE,B.takeRight=tx,B.takeRightWhile=ex,B.takeWhile=rx,B.tap=gx,B.throttle=iA,B.thru=Ko,B.toArray=pp,B.toPairs=wp,B.toPairsIn=yp,B.toPath=c2,B.toPlainObject=_p,B.transform=lC,B.unary=sA,B.union=nx,B.unionBy=ix,B.unionWith=sx,B.uniq=ox,B.uniqBy=ax,B.uniqWith=ux,B.unset=fC,B.unzip=ol,B.unzipWith=V0,B.update=cC,B.updateWith=hC,B.values=Pi,B.valuesIn=pC,B.without=lx,B.words=Ep,B.wrap=oA,B.xor=fx,B.xorBy=cx,B.xorWith=hx,B.zip=px,B.zipObject=dx,B.zipObjectDeep=_x,B.zipWith=mx,B.entries=wp,B.entriesIn=yp,B.extend=mp,B.extendWith=ea,ml(B,B),B.add=p2,B.attempt=xp,B.camelCase=gC,B.capitalize=Dp,B.ceil=d2,B.clamp=dC,B.clone=uA,B.cloneDeep=fA,B.cloneDeepWith=cA,B.cloneWith=lA,B.conformsTo=hA,B.deburr=bp,B.defaultTo=ZC,B.divide=_2,B.endsWith=vC,B.eq=zr,B.escape=wC,B.escapeRegExp=yC,B.every=Fx,B.find=Nx,B.findIndex=G0,B.findKey=UA,B.findLast=Sx,B.findLastIndex=K0,B.findLastKey=WA,B.floor=m2,B.forEach=tp,B.forEachRight=ep,B.forIn=jA,B.forInRight=YA,B.forOwn=ZA,B.forOwnRight=GA,B.get=cl,B.gt=pA,B.gte=dA,B.has=JA,B.hasIn=hl,B.head=J0,B.identity=nr,B.includes=$x,B.indexOf=SE,B.inRange=_C,B.invoke=QA,B.isArguments=ii,B.isArray=Ot,B.isArrayBuffer=_A,B.isArrayLike=er,B.isArrayLikeObject=xe,B.isBoolean=mA,B.isBuffer=$n,B.isDate=gA,B.isElement=vA,B.isEmpty=wA,B.isEqual=yA,B.isEqualWith=DA,B.isError=ll,B.isFinite=bA,B.isFunction=cn,B.isInteger=lp,B.isLength=Qo,B.isMap=fp,B.isMatch=EA,B.isMatchWith=xA,B.isNaN=AA,B.isNative=CA,B.isNil=MA,B.isNull=FA,B.isNumber=cp,B.isObject=ye,B.isObjectLike=De,B.isPlainObject=_s,B.isRegExp=fl,B.isSafeInteger=NA,B.isSet=hp,B.isString=ta,B.isSymbol=_r,B.isTypedArray=Ri,B.isUndefined=SA,B.isWeakMap=BA,B.isWeakSet=TA,B.join=$E,B.kebabCase=DC,B.last=Mr,B.lastIndexOf=LE,B.lowerCase=bC,B.lowerFirst=EC,B.lt=IA,B.lte=OA,B.max=g2,B.maxBy=v2,B.mean=w2,B.meanBy=y2,B.min=D2,B.minBy=b2,B.stubArray=vl,B.stubFalse=wl,B.stubObject=a2,B.stubString=u2,B.stubTrue=l2,B.multiply=E2,B.nth=RE,B.noConflict=QC,B.noop=gl,B.now=Jo,B.pad=xC,B.padEnd=AC,B.padStart=CC,B.parseInt=FC,B.random=mC,B.reduce=qx,B.reduceRight=kx,B.repeat=MC,B.replace=NC,B.result=oC,B.round=x2,B.runInContext=j,B.sample=Wx,B.size=Zx,B.snakeCase=SC,B.some=Gx,B.sortedIndex=jE,B.sortedIndexBy=YE,B.sortedIndexOf=ZE,B.sortedLastIndex=GE,B.sortedLastIndexBy=KE,B.sortedLastIndexOf=HE,B.startCase=TC,B.startsWith=IC,B.subtract=A2,B.sum=C2,B.sumBy=F2,B.template=OC,B.times=f2,B.toFinite=hn,B.toInteger=Lt,B.toLength=dp,B.toLower=$C,B.toNumber=Nr,B.toSafeInteger=$A,B.toString=ee,B.toUpper=LC,B.trim=RC,B.trimEnd=PC,B.trimStart=zC,B.truncate=qC,B.unescape=kC,B.uniqueId=h2,B.upperCase=UC,B.upperFirst=pl,B.each=tp,B.eachRight=ep,B.first=J0,ml(B,function(){var o={};return Kr(B,function(u,_){ie.call(B.prototype,_)||(o[_]=u)}),o}(),{chain:!1}),B.VERSION=r,Er(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){B[o].placeholder=B}),Er(["drop","take"],function(o,u){Ut.prototype[o]=function(_){_=_===e?1:Oe(Lt(_),0);var y=this.__filtered__&&!u?new Ut(this):this.clone();return y.__filtered__?y.__takeCount__=Ye(_,y.__takeCount__):y.__views__.push({size:Ye(_,ft),type:o+(y.__dir__<0?"Right":"")}),y},Ut.prototype[o+"Right"]=function(_){return this.reverse()[o](_).reverse()}}),Er(["filter","map","takeWhile"],function(o,u){var _=u+1,y=_==k||_==P;Ut.prototype[o]=function(A){var I=this.clone();return I.__iteratees__.push({iteratee:At(A,3),type:_}),I.__filtered__=I.__filtered__||y,I}}),Er(["head","last"],function(o,u){var _="take"+(u?"Right":"");Ut.prototype[o]=function(){return this[_](1).value()[0]}}),Er(["initial","tail"],function(o,u){var _="drop"+(u?"":"Right");Ut.prototype[o]=function(){return this.__filtered__?new Ut(this):this[_](1)}}),Ut.prototype.compact=function(){return this.filter(nr)},Ut.prototype.find=function(o){return this.filter(o).head()},Ut.prototype.findLast=function(o){return this.reverse().find(o)},Ut.prototype.invokeMap=Pt(function(o,u){return typeof o=="function"?new Ut(this):this.map(function(_){return ls(_,o,u)})}),Ut.prototype.reject=function(o){return this.filter(Vo(At(o)))},Ut.prototype.slice=function(o,u){o=Lt(o);var _=this;return _.__filtered__&&(o>0||u<0)?new Ut(_):(o<0?_=_.takeRight(-o):o&&(_=_.drop(o)),u!==e&&(u=Lt(u),_=u<0?_.dropRight(-u):_.take(u-o)),_)},Ut.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},Ut.prototype.toArray=function(){return this.take(ft)},Kr(Ut.prototype,function(o,u){var _=/^(?:filter|find|map|reject)|While$/.test(u),y=/^(?:head|last)$/.test(u),A=B[y?"take"+(u=="last"?"Right":""):u],I=y||/^find/.test(u);A&&(B.prototype[u]=function(){var R=this.__wrapped__,q=y?[1]:arguments,Y=R instanceof Ut,Q=q[0],et=Y||Ot(R),ot=function(kt){var Wt=A.apply(B,Mn([kt],q));return y&&dt?Wt[0]:Wt};et&&_&&typeof Q=="function"&&Q.length!=1&&(Y=et=!1);var dt=this.__chain__,wt=!!this.__actions__.length,Ct=I&&!dt,Rt=Y&&!wt;if(!I&&et){R=Rt?R:new Ut(this);var Ft=o.apply(R,q);return Ft.__actions__.push({func:Ko,args:[ot],thisArg:e}),new Ar(Ft,dt)}return Ct&&Rt?o.apply(this,q):(Ft=this.thru(ot),Ct?y?Ft.value()[0]:Ft.value():Ft)})}),Er(["pop","push","shift","sort","splice","unshift"],function(o){var u=yo[o],_=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",y=/^(?:pop|shift)$/.test(o);B.prototype[o]=function(){var A=arguments;if(y&&!this.__chain__){var I=this.value();return u.apply(Ot(I)?I:[],A)}return this[_](function(R){return u.apply(Ot(R)?R:[],A)})}}),Kr(Ut.prototype,function(o,u){var _=B[u];if(_){var y=_.name+"";ie.call(Ti,y)||(Ti[y]=[]),Ti[y].push({name:u,func:_})}}),Ti[ko(e,v).name]=[{name:"wrapper",func:e}],Ut.prototype.clone=kD,Ut.prototype.reverse=UD,Ut.prototype.value=WD,B.prototype.at=vx,B.prototype.chain=wx,B.prototype.commit=yx,B.prototype.next=Dx,B.prototype.plant=Ex,B.prototype.reverse=xx,B.prototype.toJSON=B.prototype.valueOf=B.prototype.value=Ax,B.prototype.first=B.prototype.head,rs&&(B.prototype[rs]=bx),B},Ni=yD();Jn?((Jn.exports=Ni)._=Ni,_u._=Ni):qe._=Ni}).call(jt)}(Ln,Ln.exports);var Sr=Ln.exports;class Fp{constructor(t,e){z(this,"_defaultParams");z(this,"_UserTypeFileds");z(this,"_varipKeys");this._defaultParams=t,this._UserTypeFileds=this._createDynamicClass(),this._varipKeys=e}copy(t){return Sr.cloneDeep(t)}new(t={}){return new this._UserTypeFileds(Object.assign(Sr.cloneDeep(this._defaultParams),t),this._varipKeys)}addNewMethod(t,e){this._UserTypeFileds.prototype[t]=e}_createDynamicClass(){return class{constructor(t,e){z(this,"_varipKeys");Object.assign(this,t),this._varipKeys=e}get varipKeys(){return[...this._varipKeys]}copy(){return Sr.cloneDeep(this)}}}}var xl={exports:{}};(function(i,t){(function(e,r){i.exports=r()})(jt,function(){var e=1e3,r=6e4,n=36e5,s="millisecond",a="second",l="minute",f="hour",h="day",p="week",c="month",d="quarter",g="year",w="date",m="Invalid Date",D=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,v=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,E={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(k){var W=["th","st","nd","rd"],P=k%100;return"["+k+(W[(P-20)%10]||W[P]||W[0])+"]"}},b=function(k,W,P){var K=String(k);return!K||K.length>=W?k:""+Array(W+1-K.length).join(P)+k},N={s:b,z:function(k){var W=-k.utcOffset(),P=Math.abs(W),K=Math.floor(P/60),G=P%60;return(W<=0?"+":"-")+b(K,2,"0")+":"+b(G,2,"0")},m:function k(W,P){if(W.date()<P.date())return-k(P,W);var K=12*(P.year()-W.year())+(P.month()-W.month()),G=W.clone().add(K,c),V=P-G<0,tt=W.clone().add(K+(V?-1:1),c);return+(-(K+(P-G)/(V?G-tt:tt-G))||0)},a:function(k){return k<0?Math.ceil(k)||0:Math.floor(k)},p:function(k){return{M:c,y:g,w:p,d:h,D:w,h:f,m:l,s:a,ms:s,Q:d}[k]||String(k||"").toLowerCase().replace(/s$/,"")},u:function(k){return k===void 0}},x="en",F={};F[x]=E;var M="$isDayjsObject",S=function(k){return k instanceof L||!(!k||!k[M])},O=function k(W,P,K){var G;if(!W)return x;if(typeof W=="string"){var V=W.toLowerCase();F[V]&&(G=V),P&&(F[V]=P,G=V);var tt=W.split("-");if(!G&&tt.length>1)return k(tt[0])}else{var ft=W.name;F[ft]=W,G=ft}return!K&&G&&(x=G),G||!K&&x},C=function(k,W){if(S(k))return k.clone();var P=typeof W=="object"?W:{};return P.date=k,P.args=arguments,new L(P)},T=N;T.l=O,T.i=S,T.w=function(k,W){return C(k,{locale:W.$L,utc:W.$u,x:W.$x,$offset:W.$offset})};var L=function(){function k(P){this.$L=O(P.locale,null,!0),this.parse(P),this.$x=this.$x||P.x||{},this[M]=!0}var W=k.prototype;return W.parse=function(P){this.$d=function(K){var G=K.date,V=K.utc;if(G===null)return new Date(NaN);if(T.u(G))return new Date;if(G instanceof Date)return new Date(G);if(typeof G=="string"&&!/Z$/i.test(G)){var tt=G.match(D);if(tt){var ft=tt[2]-1||0,vt=(tt[7]||"0").substring(0,3);return V?new Date(Date.UTC(tt[1],ft,tt[3]||1,tt[4]||0,tt[5]||0,tt[6]||0,vt)):new Date(tt[1],ft,tt[3]||1,tt[4]||0,tt[5]||0,tt[6]||0,vt)}}return new Date(G)}(P),this.init()},W.init=function(){var P=this.$d;this.$y=P.getFullYear(),this.$M=P.getMonth(),this.$D=P.getDate(),this.$W=P.getDay(),this.$H=P.getHours(),this.$m=P.getMinutes(),this.$s=P.getSeconds(),this.$ms=P.getMilliseconds()},W.$utils=function(){return T},W.isValid=function(){return this.$d.toString()!==m},W.isSame=function(P,K){var G=C(P);return this.startOf(K)<=G&&G<=this.endOf(K)},W.isAfter=function(P,K){return C(P)<this.startOf(K)},W.isBefore=function(P,K){return this.endOf(K)<C(P)},W.$g=function(P,K,G){return T.u(P)?this[K]:this.set(G,P)},W.unix=function(){return Math.floor(this.valueOf()/1e3)},W.valueOf=function(){return this.$d.getTime()},W.startOf=function(P,K){var G=this,V=!!T.u(K)||K,tt=T.p(P),ft=function(It,Nt){var se=T.w(G.$u?Date.UTC(G.$y,Nt,It):new Date(G.$y,Nt,It),G);return V?se:se.endOf(h)},vt=function(It,Nt){return T.w(G.toDate()[It].apply(G.toDate("s"),(V?[0,0,0,0]:[23,59,59,999]).slice(Nt)),G)},lt=this.$W,yt=this.$M,bt=this.$D,Bt="set"+(this.$u?"UTC":"");switch(tt){case g:return V?ft(1,0):ft(31,11);case c:return V?ft(1,yt):ft(0,yt+1);case p:var Et=this.$locale().weekStart||0,ne=(lt<Et?lt+7:lt)-Et;return ft(V?bt-ne:bt+(6-ne),yt);case h:case w:return vt(Bt+"Hours",0);case f:return vt(Bt+"Minutes",1);case l:return vt(Bt+"Seconds",2);case a:return vt(Bt+"Milliseconds",3);default:return this.clone()}},W.endOf=function(P){return this.startOf(P,!1)},W.$set=function(P,K){var G,V=T.p(P),tt="set"+(this.$u?"UTC":""),ft=(G={},G[h]=tt+"Date",G[w]=tt+"Date",G[c]=tt+"Month",G[g]=tt+"FullYear",G[f]=tt+"Hours",G[l]=tt+"Minutes",G[a]=tt+"Seconds",G[s]=tt+"Milliseconds",G)[V],vt=V===h?this.$D+(K-this.$W):K;if(V===c||V===g){var lt=this.clone().set(w,1);lt.$d[ft](vt),lt.init(),this.$d=lt.set(w,Math.min(this.$D,lt.daysInMonth())).$d}else ft&&this.$d[ft](vt);return this.init(),this},W.set=function(P,K){return this.clone().$set(P,K)},W.get=function(P){return this[T.p(P)]()},W.add=function(P,K){var G,V=this;P=Number(P);var tt=T.p(K),ft=function(yt){var bt=C(V);return T.w(bt.date(bt.date()+Math.round(yt*P)),V)};if(tt===c)return this.set(c,this.$M+P);if(tt===g)return this.set(g,this.$y+P);if(tt===h)return ft(1);if(tt===p)return ft(7);var vt=(G={},G[l]=r,G[f]=n,G[a]=e,G)[tt]||1,lt=this.$d.getTime()+P*vt;return T.w(lt,this)},W.subtract=function(P,K){return this.add(-1*P,K)},W.format=function(P){var K=this,G=this.$locale();if(!this.isValid())return G.invalidDate||m;var V=P||"YYYY-MM-DDTHH:mm:ssZ",tt=T.z(this),ft=this.$H,vt=this.$m,lt=this.$M,yt=G.weekdays,bt=G.months,Bt=G.meridiem,Et=function(Nt,se,Qt,qt){return Nt&&(Nt[se]||Nt(K,V))||Qt[se].slice(0,qt)},ne=function(Nt){return T.s(ft%12||12,Nt,"0")},It=Bt||function(Nt,se,Qt){var qt=Nt<12?"AM":"PM";return Qt?qt.toLowerCase():qt};return V.replace(v,function(Nt,se){return se||function(Qt){switch(Qt){case"YY":return String(K.$y).slice(-2);case"YYYY":return T.s(K.$y,4,"0");case"M":return lt+1;case"MM":return T.s(lt+1,2,"0");case"MMM":return Et(G.monthsShort,lt,bt,3);case"MMMM":return Et(bt,lt);case"D":return K.$D;case"DD":return T.s(K.$D,2,"0");case"d":return String(K.$W);case"dd":return Et(G.weekdaysMin,K.$W,yt,2);case"ddd":return Et(G.weekdaysShort,K.$W,yt,3);case"dddd":return yt[K.$W];case"H":return String(ft);case"HH":return T.s(ft,2,"0");case"h":return ne(1);case"hh":return ne(2);case"a":return It(ft,vt,!0);case"A":return It(ft,vt,!1);case"m":return String(vt);case"mm":return T.s(vt,2,"0");case"s":return String(K.$s);case"ss":return T.s(K.$s,2,"0");case"SSS":return T.s(K.$ms,3,"0");case"Z":return tt}return null}(Nt)||tt.replace(":","")})},W.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},W.diff=function(P,K,G){var V,tt=this,ft=T.p(K),vt=C(P),lt=(vt.utcOffset()-this.utcOffset())*r,yt=this-vt,bt=function(){return T.m(tt,vt)};switch(ft){case g:V=bt()/12;break;case c:V=bt();break;case d:V=bt()/3;break;case p:V=(yt-lt)/6048e5;break;case h:V=(yt-lt)/864e5;break;case f:V=yt/n;break;case l:V=yt/r;break;case a:V=yt/e;break;default:V=yt}return G?V:T.a(V)},W.daysInMonth=function(){return this.endOf(c).$D},W.$locale=function(){return F[this.$L]},W.locale=function(P,K){if(!P)return this.$L;var G=this.clone(),V=O(P,K,!0);return V&&(G.$L=V),G},W.clone=function(){return T.w(this.$d,this)},W.toDate=function(){return new Date(this.valueOf())},W.toJSON=function(){return this.isValid()?this.toISOString():null},W.toISOString=function(){return this.$d.toISOString()},W.toString=function(){return this.$d.toUTCString()},k}(),U=L.prototype;return C.prototype=U,[["$ms",s],["$s",a],["$m",l],["$H",f],["$W",h],["$M",c],["$y",g],["$D",w]].forEach(function(k){U[k[1]]=function(W){return this.$g(W,k[0],k[1])}}),C.extend=function(k,W){return k.$i||(k(W,L,C),k.$i=!0),C},C.locale=O,C.isDayjs=S,C.unix=function(k){return C(1e3*k)},C.en=F[x],C.Ls=F,C.p={},C})})(xl);var Mp=xl.exports,Vt=Zt(Mp),Al={exports:{}};(function(i,t){(function(e,r){i.exports=r()})(jt,function(){var e="minute",r=/[+-]\d\d(?::?\d\d)?/g,n=/([+-]|\d\d)/g;return function(s,a,l){var f=a.prototype;l.utc=function(m){var D={date:m,utc:!0,args:arguments};return new a(D)},f.utc=function(m){var D=l(this.toDate(),{locale:this.$L,utc:!0});return m?D.add(this.utcOffset(),e):D},f.local=function(){return l(this.toDate(),{locale:this.$L,utc:!1})};var h=f.parse;f.parse=function(m){m.utc&&(this.$u=!0),this.$utils().u(m.$offset)||(this.$offset=m.$offset),h.call(this,m)};var p=f.init;f.init=function(){if(this.$u){var m=this.$d;this.$y=m.getUTCFullYear(),this.$M=m.getUTCMonth(),this.$D=m.getUTCDate(),this.$W=m.getUTCDay(),this.$H=m.getUTCHours(),this.$m=m.getUTCMinutes(),this.$s=m.getUTCSeconds(),this.$ms=m.getUTCMilliseconds()}else p.call(this)};var c=f.utcOffset;f.utcOffset=function(m,D){var v=this.$utils().u;if(v(m))return this.$u?0:v(this.$offset)?c.call(this):this.$offset;if(typeof m=="string"&&(m=function(x){x===void 0&&(x="");var F=x.match(r);if(!F)return null;var M=(""+F[0]).match(n)||["-",0,0],S=M[0],O=60*+M[1]+ +M[2];return O===0?0:S==="+"?O:-O}(m),m===null))return this;var E=Math.abs(m)<=16?60*m:m,b=this;if(D)return b.$offset=E,b.$u=m===0,b;if(m!==0){var N=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(b=this.local().add(E+N,e)).$offset=E,b.$x.$localOffset=N}else b=this.utc();return b};var d=f.format;f.format=function(m){var D=m||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return d.call(this,D)},f.valueOf=function(){var m=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*m},f.isUTC=function(){return!!this.$u},f.toISOString=function(){return this.toDate().toISOString()},f.toString=function(){return this.toDate().toUTCString()};var g=f.toDate;f.toDate=function(m){return m==="s"&&this.$offset?l(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():g.call(this)};var w=f.diff;f.diff=function(m,D,v){if(m&&this.$u===m.$u)return w.call(this,m,D,v);var E=this.local(),b=l(m).local();return w.call(E,b,D,v)}}})})(Al);var Np=Al.exports,Cl=Zt(Np),Fl={exports:{}};(function(i,t){(function(e,r){i.exports=r()})(jt,function(){var e={year:0,month:1,day:2,hour:3,minute:4,second:5},r={};return function(n,s,a){var l,f=function(d,g,w){w===void 0&&(w={});var m=new Date(d),D=function(v,E){E===void 0&&(E={});var b=E.timeZoneName||"short",N=v+"|"+b,x=r[N];return x||(x=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:v,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:b}),r[N]=x),x}(g,w);return D.formatToParts(m)},h=function(d,g){for(var w=f(d,g),m=[],D=0;D<w.length;D+=1){var v=w[D],E=v.type,b=v.value,N=e[E];N>=0&&(m[N]=parseInt(b,10))}var x=m[3],F=x===24?0:x,M=m[0]+"-"+m[1]+"-"+m[2]+" "+F+":"+m[4]+":"+m[5]+":000",S=+d;return(a.utc(M).valueOf()-(S-=S%1e3))/6e4},p=s.prototype;p.tz=function(d,g){d===void 0&&(d=l);var w=this.utcOffset(),m=this.toDate(),D=m.toLocaleString("en-US",{timeZone:d}),v=Math.round((m-new Date(D))/1e3/60),E=a(D,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(15*-Math.round(m.getTimezoneOffset()/15)-v,!0);if(g){var b=E.utcOffset();E=E.add(w-b,"minute")}return E.$x.$timezone=d,E},p.offsetName=function(d){var g=this.$x.$timezone||a.tz.guess(),w=f(this.valueOf(),g,{timeZoneName:d}).find(function(m){return m.type.toLowerCase()==="timezonename"});return w&&w.value};var c=p.startOf;p.startOf=function(d,g){if(!this.$x||!this.$x.$timezone)return c.call(this,d,g);var w=a(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return c.call(w,d,g).tz(this.$x.$timezone,!0)},a.tz=function(d,g,w){var m=w&&g,D=w||g||l,v=h(+a(),D);if(typeof d!="string")return a(d).tz(D);var E=function(F,M,S){var O=F-60*M*1e3,C=h(O,S);if(M===C)return[O,M];var T=h(O-=60*(C-M)*1e3,S);return C===T?[O,C]:[F-60*Math.min(C,T)*1e3,Math.max(C,T)]}(a.utc(d,m).valueOf(),v,D),b=E[0],N=E[1],x=a(b).utcOffset(N);return x.$x.$timezone=D,x},a.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},a.tz.setDefault=function(d){l=d}}})})(Fl);var Sp=Fl.exports,Bp=Zt(Sp),Ml={exports:{}};(function(i,t){(function(e,r){i.exports=r()})(jt,function(){var e="week",r="year";return function(n,s,a){var l=s.prototype;l.week=function(f){if(f===void 0&&(f=null),f!==null)return this.add(7*(f-this.week()),"day");var h=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var p=a(this).startOf(r).add(1,r).date(h),c=a(this).endOf(e);if(p.isBefore(c))return 1}var d=a(this).startOf(r).date(h).startOf(e).subtract(1,"millisecond"),g=this.diff(d,e,!0);return g<0?a(this).startOf("week").week():Math.ceil(g)},l.weeks=function(f){return f===void 0&&(f=null),this.week(f)}}})})(Ml);var Tp=Ml.exports,Ip=Zt(Tp);function ms(i){const t=parseInt(i)||1;let e=i.replace(/\d+/,"");return e==="m"||e==="M"?e="M":e?e=e.toLocaleLowerCase():e="m",[t,e]}function Op(i=10){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let e="";const r=t.length;for(let n=0;n<i;n++)e+=t.charAt(Math.floor(Math.random()*r));return e}function $p(i){const t=/([+-])(\d{1,2})(\d{0,2})/,e=i.replace(/GMT|UTC/,"").match(t);if(!e)throw new Error("Invalid timezone string");const[,r,n,s]=e,a=parseInt(n,10)*60||0,l=parseInt(s,10)||0;return(r==="+"?-1:1)*(a+l)}function Br(i,t){return t&&(t.startsWith("UTC")||t.startsWith("GMT"))?Vt(i).utcOffset($p(t)):Vt(i).tz(t)}function Xr(i){const[t,e]=ms(i);let r=0;switch(e){case"m":r=60;break;case"s":r=1;break;case"M":r=31*24*60*60;break;case"d":r=24*60*60;break;case"w":r=7*24*60*60;break;default:r=60*60;break}return Math.round(Number(t)*r)}function _t(i){return typeof i!="number"||isNaN(i)}var Ur=(i=>(i.BOOL="bool",i.INT="int",i.FLOAT="float",i.ARRAY="array",i.BOX="box",i.CHART_POINT="chart.point",i.COLOR="color",i.CONST="const",i.LABEL="label",i.LINE="line",i.LINEFILL="linefill",i.MAP="map",i.MATRIX="matrix",i.POLYLINE="polyline",i.SERIES="series",i.SIMPLE="simple",i.STRING="string",i.TABLE="table",i.UNDETERMINED="undetermined type",i.INPUT="input",i.NA="na",i.VOID="void",i))(Ur||{}),gs=(i=>(i.dividends="dividends",i.none="none",i.splits="splits",i))(gs||{}),dn=(i=>(i.freqAll="freq_all",i.freqOncePerBar="freq_once_per_bar",i.freqOncePerBarClose="freq_once_per_bar_close",i))(dn||{}),zi=(i=>(i.gapsOff="gaps_off",i.gapsOn="gaps_on",i.lookaheadOff="lookahead_off",i.lookaheadOn="lookahead_on",i))(zi||{}),ir=(i=>(i.all="all",i.dataWindow="data_window",i.none="none",i.pane="pane",i.priceScale="price_scale",i.statusLine="status_line",i))(ir||{}),Rn=(i=>(i.both="both",i.left="left",i.none="none",i.right="right",i))(Rn||{}),Pn=(i=>(i.inherit="inherit",i.mintick="mintick",i.percent="percent",i.price="price",i.volume="volume",i))(Pn||{}),vs=(i=>(i.styleDashed="style_dashed",i.styleDotted="style_dotted",i.styleSolid="style_solid",i))(vs||{}),ge=(i=>(i.styleArrowdown="style_arrowdown",i.styleArrowup="style_arrowup",i.styleCircle="style_circle",i.styleCross="style_cross",i.styleDiamond="style_diamond",i.styleFlag="style_flag",i.styleLabelCenter="style_label_center",i.styleLabelDown="style_label_down",i.styleLabelLeft="style_label_left",i.styleLabelLowerLeft="style_label_lower_left",i.styleLabelLowerRight="style_label_lower_right",i.styleLabelRight="style_label_right",i.styleLabelUp="style_label_up",i.styleLabelUpperLeft="style_label_upper_left",i.styleLabelUpperRight="style_label_upper_right",i.styleNone="style_none",i.styleSquare="style_square",i.styleTextOutline="style_text_outline",i.styleTriangledown="style_triangledown",i.styleTriangleup="style_triangleup",i.styleXcross="style_xcross",i))(ge||{}),Wr=(i=>(i.styleArrowBoth="style_arrow_both",i.styleArrowLeft="style_arrow_left",i.styleArrowRight="style_arrow_right",i.styleDashed="style_dashed",i.styleDotted="style_dotted",i.styleSolid="style_solid",i))(Wr||{}),si=(i=>(i.abovebar="abovebar",i.absolute="absolute",i.belowbar="belowbar",i.bottom="bottom",i.top="top",i))(si||{}),zn=(i=>(i.ascending="ascending",i.descending="descending",i))(zn||{}),vr=(i=>(i.styleArea="Area",i.styleAreabr="Area With Breaks",i.styleCircles="Circles",i.styleColumns="Columns",i.styleCross="Cross",i.styleHistogram="Histogram",i.styleLine="Line",i.styleLinebr="Line With Breaks",i.styleStepline="Step Line",i.styleSteplineDiamond="Step Line With Diamonds",i.styleSteplinebr="Step line with Breaks",i))(vr||{}),Tr=(i=>(i.bottomCenter="bottom_center",i.bottomLeft="bottom_left",i.bottomRight="bottom_right",i.middleCenter="middle_center",i.middleLeft="middle_left",i.middleRight="middle_right",i.topCenter="top_center",i.topLeft="top_left",i.topRight="top_right",i))(Tr||{}),ws=(i=>(i.left="left",i.none="none",i.right="right",i))(ws||{}),na=(i=>(i.extended="extended",i.regular="regular",i))(na||{}),sr=(i=>(i.arrowdown="arrowdown",i.arrowup="arrowup",i.circle="circle",i.cross="cross",i.diamond="diamond",i.flag="flag",i.labeldown="labeldown",i.labelup="labelup",i.square="square",i.triangledown="triangledown",i.triangleup="triangleup",i.xcross="xcross",i))(sr||{}),jr=(i=>(i.auto="auto",i.huge="huge",i.large="large",i.normal="normal",i.small="small",i.tiny="tiny",i))(jr||{}),Ge=(i=>(i.cash="cash",i.fixed="fixed",i.percentOfEquity="percent_of_equity",i))(Ge||{}),Ir=(i=>(i.cashPerContract="cash_per_contract",i.cashPerOrder="cash_per_order",i.percent="percent",i))(Ir||{}),pe=(i=>(i.all="all",i.long="long",i.short="short",i))(pe||{}),qn=(i=>(i.cancel="cancel",i.none="none",i.reduce="reduce",i))(qn||{}),Xe=(i=>(i.alignBottom="align_bottom",i.alignCenter="align_center",i.alignLeft="align_left",i.alignRight="align_right",i.alignTop="align_top",i.wrapAuto="wrap_auto",i.wrapNone="wrap_none",i))(Xe||{}),$e=(i=>(i.bar_index="bar_index",i.bar_time="bar_time",i))($e||{}),qi=(i=>(i.abovebar="abovebar",i.belowbar="belowbar",i.price="price",i))(qi||{}),ys=(i=>(i.actual="actual",i.estimate="estimate",i.standardized="standardized",i))(ys||{}),kn=(i=>(i.traditional="Traditional",i.fibonacci="Fibonacci",i.woodie="Woodie",i.classic="Classic",i.dm="DM",i.camarilla="Camarilla",i))(kn||{}),Ce=(i=>(i[i.Hint=1]="Hint",i[i.Info=2]="Info",i[i.Warning=4]="Warning",i[i.Error=8]="Error",i))(Ce||{});class Lp{constructor(t){z(this,"_errorListener");this._errorListener=t}new({size:t,initial_value:e}={}){return new Jt(t,e,this._errorListener)}new_float({size:t,initial_value:e}={}){return new Jt(t,e,this._errorListener)}new_int({size:t,initial_value:e}={}){return new Jt(t,e,this._errorListener)}new_color({size:t,initial_value:e}={}){return new Jt(t,e,this._errorListener)}new_bool({size:t,initial_value:e}={}){return new Jt(t,e,this._errorListener)}new_string({size:t,initial_value:e}={}){return new Jt(t,e,this._errorListener)}new_line({size:t,initial_value:e}={}){return new Jt(t,e,this._errorListener)}new_box({size:t,initial_value:e}={}){return new Jt(t,e,this._errorListener)}new_table({size:t,initial_value:e}={}){return new Jt(t,e,this._errorListener)}new_linefill({size:t,initial_value:e}={}){return new Jt(t,e,this._errorListener)}new_label({size:t,initial_value:e}={}){return new Jt(t,e,this._errorListener)}copy({id:t}){return t==null?void 0:t.copy()}slice({id:t,index_from:e,index_to:r}){return t==null?void 0:t.slice({index_from:e,index_to:r})}size({id:t}){return t==null?void 0:t.size()}first({id:t}){return t==null?void 0:t.first()}abs({id:t},e){return t==null?void 0:t.abs(e)}avg({id:t},e){return t==null?void 0:t.avg(e)}binary_search({id:t,val:e},r){return t==null?void 0:t.binary_search({val:e},r)}binary_search_leftmost({id:t,val:e},r){return t==null?void 0:t.binary_search_leftmost({val:e},r)}binary_search_rightmost({id:t,val:e},r){return t==null?void 0:t.binary_search_rightmost({val:e},r)}clear({id:t}){t==null||t.clear()}concat({id1:t,id2:e}){return t==null?void 0:t.concat({id2:e})}covariance({id1:t,id2:e,biased:r},n){return t==null?void 0:t.covariance({id2:e,biased:r},n)}every({id:t},e){return t==null?void 0:t.every(e)}from(t,e){const r=new Jt(0,void 0,this._errorListener);return r._value=e,r}fill({id:t,value:e,index_from:r,index_to:n}){t==null||t.fill({value:e,index_from:r,index_to:n})}get({id:t,index:e}){return t==null?void 0:t.get({index:e})}includes({id:t,value:e}){return t==null?void 0:t.includes({value:e})}indexof({id:t,value:e}){return t==null?void 0:t.indexof({value:e})}insert({id:t,index:e,value:r}){t==null||t.insert({index:e,value:r})}join({id:t,separator:e},r){return t==null?void 0:t.join({separator:e},r)}last({id:t}){return t==null?void 0:t.last()}lastindexof({id:t,value:e}){return t==null?void 0:t.lastindexof({value:e})}max({id:t,nth:e},r){return t==null?void 0:t.max({nth:e},r)}median({id:t},e){return t==null?void 0:t.median(e)}min({id:t,nth:e},r){return t==null?void 0:t.min({nth:e},r)}mode({id:t},e){return t==null?void 0:t.mode(e)}percentile_linear_interpolation({id:t,percentage:e},r){return t==null?void 0:t.percentile_linear_interpolation({percentage:e},r)}percentile_nearest_rank({id:t,percentage:e},r){return t==null?void 0:t.percentile_nearest_rank({percentage:e},r)}percentrank({id:t,index:e},r){return t==null?void 0:t.percentrank({index:e},r)}pop({id:t}){return t==null?void 0:t.pop()}push({id:t,value:e}){t==null||t.push({value:e})}range({id:t},e){return t==null?void 0:t.range(e)}remove({id:t,index:e}){return t==null?void 0:t.remove({index:e})}reverse({id:t}){return t==null?void 0:t.reverse()}set({id:t,index:e,value:r}){t==null||t.set({index:e,value:r})}shift({id:t}){return t==null?void 0:t.shift()}some({id:t},e){return t==null?void 0:t.some(e)}sort({id:t,order:e},r){t==null||t.sort({order:e},r)}sort_indices({id:t,order:e},r){return t==null?void 0:t.sort_indices({order:e},r)}standardize({id:t},e){return t==null?void 0:t.standardize(e)}stdev({id:t,biased:e},r){return t==null?void 0:t.stdev({biased:e},r)}sum({id:t},e){return t==null?void 0:t.sum(e)}unshift({id:t,value:e}){t==null||t.unshift({value:e})}variance({id:t,biased:e},r){return t==null?void 0:t.variance({biased:e},r)}}class Jt{constructor(t=0,e,r){z(this,"_arrInstance");z(this,"_errorListener");this._errorListener=r,this._arrInstance=Array.from(new Array(t||0),()=>Sr.cloneDeep(e))}get isArray(){return!0}get _value(){return[...this._arrInstance]}set _value(t){this._arrInstance=[...t]}_deepCopyData(t){this._arrInstance=Sr.cloneDeep(t)}_copyData(t){this._arrInstance=t}copy(){const t=new Jt(0,void 0,this._errorListener);return t._deepCopyData(this._arrInstance),t}slice({index_from:t,index_to:e}){const r=new Jt(0,void 0,this._errorListener);return r._copyData(this._arrInstance.slice(t,e)),r}size(){return this._arrInstance.length}first(){return this._arrInstance[0]}abs(t){const e=new Jt(0,void 0,this._errorListener);this._verifySimpleType("number","abs","int/float",t);const r=this._arrInstance.map(n=>Math.abs(n));return e._copyData(r),e}avg(t){return this._verifySimpleType("number","avg","int/float",t),Sr.mean(this._arrInstance)}binary_search({val:t},e){return this._verifySimpleType("number","binary_search","int/float",e),_t(t)?-1:this._binarySearch(this._arrInstance,t)}binary_search_leftmost({val:t},e){return this._verifySimpleType("number","binary_search_leftmost","int/float",e),_t(t)?this._arrInstance.length-1:this._binarySearchLeftMost(this._arrInstance,t)}binary_search_rightmost({val:t},e){return this._verifySimpleType("number","binary_search_rightmost","int/float",e),_t(t)?this._arrInstance.length:this._binarySearchRightMost(this._arrInstance,t)}clear(){this._arrInstance=[]}concat({id2:t}){return this._arrInstance=this._arrInstance.concat(t==null?void 0:t._value),this}covariance({id2:t,biased:e},r){return this._verifySimpleType("number","covariance","int/float",r),this._verifySimpleType("number","covariance","int/float",r,t==null?void 0:t._value),this._covariance(this._arrInstance,t._value,e,r)}every(t){return this._verifySimpleType("number|boolean","every","int/float/bool",t),this._arrInstance.every(e=>!!e)}fill({value:t,index_from:e=0,index_to:r}){this._arrInstance=this._setElements(this._arrInstance,t,e,r)}get({index:t}){if(!_t(t))return this._arrInstance[t]}includes({value:t}){return this._arrInstance.includes(t)}indexof({value:t}){return this._arrInstance.indexOf(t)}insert({index:t,value:e}){_t(t)||this._arrInstance.splice(t,0,e)}join({separator:t}={},e){return this._verifySimpleType("number|string","join","int/float/string",e),this._arrInstance.join(t)}last(){return this._arrInstance[this._arrInstance.length-1]}lastindexof({value:t}){return this._arrInstance.lastIndexOf(t)}max({nth:t}={},e){return this._verifySimpleType("number","max","int/float",e),this._maxNth([...this._arrInstance],t)}median(t){return this._verifySimpleType("number","median","int/float",t),this._median([...this._arrInstance])}min({nth:t}={},e){return this._verifySimpleType("number","min","int/float",e),this._minNth([...this._arrInstance],t)}mode(t){return this._verifySimpleType("number","mode","int/float",t),this._mode([...this._arrInstance])}percentile_linear_interpolation({percentage:t},e){return this._verifySimpleType("number","percentile_linear_interpolation","int/float",e),this._percentileLinearInterpolation([...this._arrInstance],t)}percentile_nearest_rank({percentage:t=0},e){var r;if(this._arrInstance.length===0||t<0||t>100||_t(t)){(r=this._errorListener)==null||r.addError("Invalid percentile or empty array",e,Ce.Error);return}return this._verifySimpleType("number","percentile_nearest_rank","int/float",e),this._getNearestRankPercentile([...this._arrInstance],t)}percentrank({index:t},e){return this._verifySimpleType("number","percentrank","int/float",e),this._getPercentileRank([...this._arrInstance],t)}pop(){return this._arrInstance.pop()}push({value:t}){this._arrInstance.push(t)}range(t){var s;if(this._arrInstance.length===0){(s=this._errorListener)==null||s.addError("Array must not be empty",t,Ce.Error);return}this._verifySimpleType("number","range","int/float",t);const e=Math.min(...this._arrInstance);return Math.max(...this._arrInstance)-e}remove({index:t}){if(!_t(t))return this._arrInstance.splice(t,1)[0]}reverse(){this._arrInstance.reverse()}set({index:t,value:e}){_t(t)||(this._arrInstance[t]=e)}shift(){return this._arrInstance.shift()}some(t){return this._verifySimpleType("number|boolean","some","int/float/bool",t),this._arrInstance.some(e=>!!e)}sort({order:t}={},e){this._verifySimpleType("number","sort","int/float",e),this._arrInstance.sort((r,n)=>t!==zn.descending?r-n:n-r)}sort_indices({order:t}={},e){this._verifySimpleType("number","sort_indices","int/float",e);const r=this._arrInstance.map((s,a)=>a);r.sort((s,a)=>t!==zn.descending?this._arrInstance[s]-this._arrInstance[a]:this._arrInstance[a]-this._arrInstance[s]);const n=new Jt(0,void 0,this._errorListener);return n._copyData(r),n}standardize(t){this._verifySimpleType("number","standardize","int/float",t);const e=new Jt(0,void 0,this._errorListener);return e._copyData(this._standardizeArray([...this._arrInstance])),e}stdev({biased:t}={},e){var r;if(this._arrInstance.length===0){(r=this._errorListener)==null||r.addError("Array must not be empty",e,Ce.Error);return}return this._verifySimpleType("number","stdev","int/float",e),this._calculateStandardDeviations([...this._arrInstance],t)}sum(t){return this._verifySimpleType("number","sum","int/float",t),this._arrInstance.reduce((r,n)=>r+(n||0),0)}unshift({value:t}){this._arrInstance.unshift(t)}variance({biased:t}={},e){var r;if(this._arrInstance.length===0){(r=this._errorListener)==null||r.addError("Array must not be empty",e,Ce.Error);return}return this._verifySimpleType("number","variance","int/float",e),this._calculateVariances([...this._arrInstance],t)}_calculateVariances(t,e=!0){const r=t.reduce((a,l)=>a+(l||0),0)/t.length,n=t.reduce((a,l)=>a+((l||0)-r)**2,0),s=n/t.length;return e?s:t.length>1?n/(t.length-1):s}_calculateStandardDeviations(t,e=!0){const r=t.reduce((a,l)=>a+(l||0),0)/t.length,n=t.reduce((a,l)=>{const f=(l||0)-r;return a+f*f},0),s=Math.sqrt(n/t.length);return e?s:t.length>1?Math.sqrt(n/(t.length-1)):s}_standardizeArray(t){const e=t.reduce((s,a)=>s+(a||0),0)/t.length,r=Math.sqrt(t.reduce((s,a)=>s+Math.pow((a||0)-e,2),0)/t.length);return t.map(s=>((s||0)-e)/r)}_getPercentileRank(t,e=0){if(_t(e))return;const r=t[e];let n=0;for(let a=0;a<t.length;a++)(t[a]<r||t[a]===r&&a!=e)&&n++;return n/(t.length-1)*100}_getNearestRankPercentile(t,e=0){const r=t.slice().sort((a,l)=>a-l),n=e/100*r.length,s=Math.ceil(n)-1;return r[s>=r.length?r.length-1:s]}_percentileLinearInterpolation(t,e=0){if(e<0||e>100||_t(e))return;t.sort(function(s,a){return s-a});const r=t.length;e/=100;const n=1/(r*2);if(e<=n)return t[0];if(e>=1-1/(r*2))return t[r-1];for(const[s,a]of t.entries()){const l=t[s-1];if(e<(s+.5)/r)return l+(a-l)*(e-(s-.5)/r)/(1/r)}}_mode(t){const e={};let r=0;const n=[];for(const s of t)e[s]=(e[s]||0)+1,r=Math.max(r,e[s]);for(const s in e)e[s]===r&&n.push(Number(s));return Math.min(...r===1?t:n)}_median(t){t.sort(function(r,n){return r-n});const e=Math.floor(t.length/2);return t.length%2?t[e]:(t[e-1]+t[e])/2}_minNth(t,e=0){return t.sort(function(r,n){return r-n}),t[e]}_maxNth(t,e=0){return t.sort(function(r,n){return n-r}),t[e]}_setElements(t,e,r=0,n){n===void 0&&(n=t.length);for(let s=r;s<n;s++)t[s]=e;return t}_covariance(t,e,r=!0,n){var f;if(t.length!=e.length){(f=this._errorListener)==null||f.addError("Arrays have different lengths",n,Ce.Error);return}t=t.filter(h=>h!==void 0),e=e.filter(h=>h!==void 0);const s=t.reduce((h,p)=>h+p,0)/t.length,a=e.reduce((h,p)=>h+p,0)/e.length;let l=0;for(let h=0;h<t.length;h++)l+=(t[h]-s)*(e[h]-a);return r?l/t.length:l/(t.length-1)}_verifySimpleType(t,e,r,n,s=this._arrInstance){var l;s.filter(f=>f!==void 0).some(f=>!t.split("|").includes(typeof f))&&((l=this._errorListener)==null||l.addError(`数组类型错误,array.${e}方法只能使用${r}类型数组!`,n,Ce.Error))}_binarySearch(t,e){let r=0,n=t.length-1;for(;r<=n;){const s=Math.floor((r+n)/2);if(t[s]===e)return s;t[s]<e?r=s+1:n=s-1}return-1}_binarySearchLeftMost(t,e){let r=0,n=t.length-1;const s=[];for(;r<=n;){const a=Math.floor((r+n)/2);t[a]===e&&s.push(a),t[a]<e?r=a+1:n=a-1}return s.length?Math.min(...s):r-1}_binarySearchRightMost(t,e){let r=0,n=t.length-1;const s=[];for(;r<=n;){const a=Math.floor((r+n)/2);t[a]===e&&s.push(a),t[a]<=e?r=a+1:n=a-1}return s.length?Math.max(...s):r}}class Rp{constructor(t,e){z(this,"_randomNums");z(this,"_mintick");z(this,"_cacheData");z(this,"_barIndex");z(this,"_errorListener");this._mintick=t,this._randomNums={},this._cacheData={},this._barIndex=0,this._errorListener=e}update(t){this._barIndex=t,this._randomNums={}}abs({number:t}){if(!_t(t))return Math.abs(t)}acos({angle:t}){if(_t(t))return;const e=Math.acos(t);return isNaN(e)?void 0:e}asin({angle:t}){if(_t(t))return;const e=Math.asin(t);return isNaN(e)?void 0:e}atan({angle:t}){if(_t(t))return;const e=Math.atan(t);return isNaN(e)?void 0:e}avg(t,e){return Sr.mean(e)}ceil({number:t}){if(!_t(t))return Math.ceil(t)}floor({number:t}){if(!_t(t))return Math.floor(t)}cos({angle:t}){if(_t(t))return;const e=Math.cos(t);return isNaN(e)?void 0:e}sin({angle:t}){if(_t(t))return;const e=Math.sin(t);return isNaN(e)?void 0:e}tan({angle:t}){if(_t(t))return;const e=Math.tan(t);return isNaN(e)?void 0:e}exp({number:t}){if(!_t(t))return Math.exp(t)}log({number:t}){if(!_t(t))return Math.log(t)}log10({number:t}){if(!_t(t))return Math.log10(t)}max(t,e){return e=e.filter(r=>!_t(r)),Math.max(...e)}min(t,e){return e=e.filter(r=>!_t(r)),Math.min(...e)}pow({base:t,exponent:e}){if(!(_t(t)||_t(e)))return Math.pow(t,e)}random({min:t=0,max:e=1,seed:r},n){if(_t(t)&&(t=0),_t(e)&&(e=1),r&&this._randomNums[r])return this._randomNums[r];if(t>=e){this._errorListener.addError("min must be less than max",n,Ce.Error);return}let s;do s=Math.random()*(e-t)+t;while(s===t||s===e);return r&&(this._randomNums[r]=s),s}round({number:t,precision:e}){if(!_t(t))return _t(e)?Math.round(t):Number(t==null?void 0:t.toFixed(e))}round_to_mintick({number:t}){if(!_t(t))return Number(t==null?void 0:t.toFixed(this._mintick))}sign({number:t}){if(!_t(t))return t&&Math.sign(t)}sqrt({number:t}){if(!_t(t))return Math.sqrt(t)}sum({source:t,length:e=1},r){let n=this._cacheData[`sum_${r}`];n||(n=[]),n[this._barIndex]=t,this._cacheData[`sum_${r}`]=n;const s=n.filter(a=>!_t(a));if(!(s.length<e))return Sr.sum(s.slice(-e))}todegrees({radians:t}){if(!_t(t))return t*(180/Math.PI)}toradians({degrees:t}){if(_t(t))return;const e=t*(Math.PI/180);return Number(e.toFixed(this._mintick))}}function Ds(){return Ds=Object.assign?Object.assign.bind():function(i){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i[r]=e[r])}return i},Ds.apply(this,arguments)}var Nl={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null};function le(i){return typeof i=="number"}function Ee(i){return!i||typeof i!="object"||typeof i.constructor!="function"?!1:i.isBigNumber===!0&&typeof i.constructor.prototype=="object"&&i.constructor.prototype.isBigNumber===!0||typeof i.constructor.isDecimal=="function"&&i.constructor.isDecimal(i)===!0}function Sl(i){return i&&typeof i=="object"&&Object.getPrototypeOf(i).isComplex===!0||!1}function Bl(i){return i&&typeof i=="object"&&Object.getPrototypeOf(i).isFraction===!0||!1}function Tl(i){return i&&i.constructor.prototype.isUnit===!0||!1}function Yr(i){return typeof i=="string"}var ve=Array.isArray;function ce(i){return i&&i.constructor.prototype.isMatrix===!0||!1}function ki(i){return Array.isArray(i)||ce(i)}function Pp(i){return i&&i.isDenseMatrix&&i.constructor.prototype.isMatrix===!0||!1}function zp(i){return i&&i.isSparseMatrix&&i.constructor.prototype.isMatrix===!0||!1}function qp(i){return i&&i.constructor.prototype.isRange===!0||!1}function ia(i){return i&&i.constructor.prototype.isIndex===!0||!1}function kp(i){return typeof i=="boolean"}function Up(i){return i&&i.constructor.prototype.isResultSet===!0||!1}function Wp(i){return i&&i.constructor.prototype.isHelp===!0||!1}function jp(i){return typeof i=="function"}function Yp(i){return i instanceof Date}function Zp(i){return i instanceof RegExp}function sa(i){return!!(i&&typeof i=="object"&&i.constructor===Object&&!Sl(i)&&!Bl(i))}function Gp(i){return i===null}function Kp(i){return i===void 0}function Hp(i){return i&&i.isAccessorNode===!0&&i.constructor.prototype.isNode===!0||!1}function Jp(i){return i&&i.isArrayNode===!0&&i.constructor.prototype.isNode===!0||!1}function Xp(i){return i&&i.isAssignmentNode===!0&&i.constructor.prototype.isNode===!0||!1}function Vp(i){return i&&i.isBlockNode===!0&&i.constructor.prototype.isNode===!0||!1}function Qp(i){return i&&i.isConditionalNode===!0&&i.constructor.prototype.isNode===!0||!1}function td(i){return i&&i.isConstantNode===!0&&i.constructor.prototype.isNode===!0||!1}function ed(i){return i&&i.isFunctionAssignmentNode===!0&&i.constructor.prototype.isNode===!0||!1}function rd(i){return i&&i.isFunctionNode===!0&&i.constructor.prototype.isNode===!0||!1}function nd(i){return i&&i.isIndexNode===!0&&i.constructor.prototype.isNode===!0||!1}function id(i){return i&&i.isNode===!0&&i.constructor.prototype.isNode===!0||!1}function sd(i){return i&&i.isObjectNode===!0&&i.constructor.prototype.isNode===!0||!1}function od(i){return i&&i.isOperatorNode===!0&&i.constructor.prototype.isNode===!0||!1}function ad(i){return i&&i.isParenthesisNode===!0&&i.constructor.prototype.isNode===!0||!1}function ud(i){return i&&i.isRangeNode===!0&&i.constructor.prototype.isNode===!0||!1}function ld(i){return i&&i.isRelationalNode===!0&&i.constructor.prototype.isNode===!0||!1}function fd(i){return i&&i.isSymbolNode===!0&&i.constructor.prototype.isNode===!0||!1}function cd(i){return i&&i.constructor.prototype.isChain===!0||!1}function _n(i){var t=typeof i;return t==="object"?i===null?"null":Ee(i)?"BigNumber":i.constructor&&i.constructor.name?i.constructor.name:"Object":t}function re(i){var t=typeof i;if(t==="number"||t==="string"||t==="boolean"||i===null||i===void 0)return i;if(typeof i.clone=="function")return i.clone();if(Array.isArray(i))return i.map(function(e){return re(e)});if(i instanceof Date)return new Date(i.valueOf());if(Ee(i))return i;if(sa(i))return hd(i,re);throw new TypeError("Cannot clone: unknown type of value (value: ".concat(i,")"))}function hd(i,t){var e={};for(var r in i)Ui(i,r)&&(e[r]=t(i[r]));return e}function Il(i,t){for(var e in t)Ui(t,e)&&(i[e]=t[e]);return i}function oi(i,t){var e,r,n;if(Array.isArray(i)){if(!Array.isArray(t)||i.length!==t.length)return!1;for(r=0,n=i.length;r<n;r++)if(!oi(i[r],t[r]))return!1;return!0}else{if(typeof i=="function")return i===t;if(i instanceof Object){if(Array.isArray(t)||!(t instanceof Object))return!1;for(e in i)if(!(e in t)||!oi(i[e],t[e]))return!1;for(e in t)if(!(e in i))return!1;return!0}else return i===t}}function Ui(i,t){return i&&Object.hasOwnProperty.call(i,t)}function pd(i,t){for(var e={},r=0;r<t.length;r++){var n=t[r],s=i[n];s!==void 0&&(e[n]=s)}return e}var dd=["Matrix","Array"],_d=["number","BigNumber","Fraction"],or=function(t){if(t)throw new Error(`The global config is readonly.
|
28
28
|
Please create a mathjs instance if you want to change the default configuration.
|
29
29
|
Example:
|
30
30
|
|
31
31
|
import { create, all } from 'mathjs';
|
32
32
|
const mathjs = create(all);
|
33
33
|
mathjs.config({ number: 'BigNumber' });
|
34
|
-
`);return Object.freeze(Ml)};Ds(or,Ml,{MATRIX_OPTIONS:dd,NUMBER_OPTIONS:_d});function Il(){return!0}function wr(){return!1}function ai(){}const Ol="Argument is not a typed-function.";function $l(){function i($){return typeof $=="object"&&$!==null&&$.constructor===Object}const t=[{name:"number",test:function($){return typeof $=="number"}},{name:"string",test:function($){return typeof $=="string"}},{name:"boolean",test:function($){return typeof $=="boolean"}},{name:"Function",test:function($){return typeof $=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function($){return $ instanceof Date}},{name:"RegExp",test:function($){return $ instanceof RegExp}},{name:"Object",test:i},{name:"null",test:function($){return $===null}},{name:"undefined",test:function($){return $===void 0}}],e={name:"any",test:Il,isAny:!0};let r,n,s=0,a={createCount:0};function l($){const Z=r.get($);if(Z)return Z;let H='Unknown type "'+$+'"';const nt=$.toLowerCase();let st;for(st of n)if(st.toLowerCase()===nt){H+='. Did you mean "'+st+'" ?';break}throw new TypeError(H)}function f($){let Z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any";const H=Z?l(Z).index:n.length,nt=[];for(let rt=0;rt<$.length;++rt){if(!$[rt]||typeof $[rt].name!="string"||typeof $[rt].test!="function")throw new TypeError("Object with properties {name: string, test: function} expected");const ct=$[rt].name;if(r.has(ct))throw new TypeError('Duplicate type name "'+ct+'"');nt.push(ct),r.set(ct,{name:ct,test:$[rt].test,isAny:$[rt].isAny,index:H+rt,conversionsTo:[]})}const st=n.slice(H);n=n.slice(0,H).concat(nt).concat(st);for(let rt=H+nt.length;rt<n.length;++rt)r.get(n[rt]).index=rt}function h(){r=new Map,n=[],s=0,f([e],!1)}h(),f(t);function p(){let $;for($ of n)r.get($).conversionsTo=[];s=0}function c($){const Z=n.filter(H=>{const nt=r.get(H);return!nt.isAny&&nt.test($)});return Z.length?Z:["any"]}function d($){return $&&typeof $=="function"&&"_typedFunctionData"in $}function g($,Z,H){if(!d($))throw new TypeError(Ol);const nt=H&&H.exact,st=Array.isArray(Z)?Z.join(","):Z,rt=N(st),ct=D(rt);if(!nt||ct in $.signatures){const Ht=$._typedFunctionData.signatureMap.get(ct);if(Ht)return Ht}const ut=rt.length;let ht;if(nt){ht=[];let Ht;for(Ht in $.signatures)ht.push($._typedFunctionData.signatureMap.get(Ht))}else ht=$._typedFunctionData.signatures;for(let Ht=0;Ht<ut;++Ht){const Qt=rt[Ht],_e=[];let $e;for($e of ht){const Be=S($e.params,Ht);if(!(!Be||Qt.restParam&&!Be.restParam)){if(!Be.hasAny){const fr=b(Be);if(Qt.types.some(cr=>!fr.has(cr.name)))continue}_e.push($e)}}if(ht=_e,ht.length===0)break}let at;for(at of ht)if(at.params.length<=ut)return at;throw new TypeError("Signature not found (signature: "+($.name||"unnamed")+"("+D(rt,", ")+"))")}function w($,Z,H){return g($,Z,H).implementation}function m($,Z){const H=l(Z);if(H.test($))return $;const nt=H.conversionsTo;if(nt.length===0)throw new Error("There are no conversions to "+Z+" defined.");for(let st=0;st<nt.length;st++)if(l(nt[st].from).test($))return nt[st].convert($);throw new Error("Cannot convert "+$+" to "+Z)}function D($){let Z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:",";return $.map(H=>H.name).join(Z)}function v($){const Z=$.indexOf("...")===0,nt=(Z?$.length>3?$.slice(3):"any":$).split("|").map(ut=>l(ut.trim()));let st=!1,rt=Z?"...":"";return{types:nt.map(function(ut){return st=ut.isAny||st,rt+=ut.name+"|",{name:ut.name,typeIndex:ut.index,test:ut.test,isAny:ut.isAny,conversion:null,conversionIndex:-1}}),name:rt.slice(0,-1),hasAny:st,hasConversion:!1,restParam:Z}}function E($){const Z=$.types.map(ct=>ct.name),H=K(Z);let nt=$.hasAny,st=$.name;const rt=H.map(function(ct){const ut=l(ct.from);return nt=ut.isAny||nt,st+="|"+ct.from,{name:ct.from,typeIndex:ut.index,test:ut.test,isAny:ut.isAny,conversion:ct,conversionIndex:ct.index}});return{types:$.types.concat(rt),name:st,hasAny:nt,hasConversion:rt.length>0,restParam:$.restParam}}function b($){return $.typeSet||($.typeSet=new Set,$.types.forEach(Z=>$.typeSet.add(Z.name))),$.typeSet}function N($){const Z=[];if(typeof $!="string")throw new TypeError("Signatures must be strings");const H=$.trim();if(H==="")return Z;const nt=H.split(",");for(let st=0;st<nt.length;++st){const rt=v(nt[st].trim());if(rt.restParam&&st!==nt.length-1)throw new SyntaxError('Unexpected rest parameter "'+nt[st]+'": only allowed for the last parameter');if(rt.types.length===0)return null;Z.push(rt)}return Z}function x($){const Z=It($);return Z?Z.restParam:!1}function F($){if(!$||$.types.length===0)return Il;if($.types.length===1)return l($.types[0].name).test;if($.types.length===2){const Z=l($.types[0].name).test,H=l($.types[1].name).test;return function(st){return Z(st)||H(st)}}else{const Z=$.types.map(function(H){return l(H.name).test});return function(nt){for(let st=0;st<Z.length;st++)if(Z[st](nt))return!0;return!1}}}function M($){let Z,H,nt;if(x($)){Z=ne($).map(F);const st=Z.length,rt=F(It($)),ct=function(ut){for(let ht=st;ht<ut.length;ht++)if(!rt(ut[ht]))return!1;return!0};return function(ht){for(let at=0;at<Z.length;at++)if(!Z[at](ht[at]))return!1;return ct(ht)&&ht.length>=st+1}}else return $.length===0?function(rt){return rt.length===0}:$.length===1?(H=F($[0]),function(rt){return H(rt[0])&&rt.length===1}):$.length===2?(H=F($[0]),nt=F($[1]),function(rt){return H(rt[0])&&nt(rt[1])&&rt.length===2}):(Z=$.map(F),function(rt){for(let ct=0;ct<Z.length;ct++)if(!Z[ct](rt[ct]))return!1;return rt.length===Z.length})}function S($,Z){return Z<$.length?$[Z]:x($)?It($):null}function O($,Z){const H=S($,Z);return H?b(H):new Set}function C($){return $.conversion===null||$.conversion===void 0}function T($,Z){const H=new Set;return $.forEach(nt=>{const st=O(nt.params,Z);let rt;for(rt of st)H.add(rt)}),H.has("any")?["any"]:Array.from(H)}function L($,Z,H){let nt,st;const rt=$||"unnamed";let ct=H,ut;for(ut=0;ut<Z.length;ut++){const Qt=[];if(ct.forEach(_e=>{const $e=S(_e.params,ut),Be=F($e);(ut<_e.params.length||x(_e.params))&&Be(Z[ut])&&Qt.push(_e)}),Qt.length===0){if(st=T(ct,ut),st.length>0){const _e=c(Z[ut]);return nt=new TypeError("Unexpected type of argument in function "+rt+" (expected: "+st.join(" or ")+", actual: "+_e.join(" | ")+", index: "+ut+")"),nt.data={category:"wrongType",fn:rt,index:ut,actual:_e,expected:st},nt}}else ct=Qt}const ht=ct.map(function(Qt){return x(Qt.params)?1/0:Qt.params.length});if(Z.length<Math.min.apply(null,ht))return st=T(ct,ut),nt=new TypeError("Too few arguments in function "+rt+" (expected: "+st.join(" or ")+", index: "+Z.length+")"),nt.data={category:"tooFewArgs",fn:rt,index:Z.length,expected:st},nt;const at=Math.max.apply(null,ht);if(Z.length>at)return nt=new TypeError("Too many arguments in function "+rt+" (expected: "+at+", actual: "+Z.length+")"),nt.data={category:"tooManyArgs",fn:rt,index:Z.length,expectedLength:at},nt;const Ht=[];for(let Qt=0;Qt<Z.length;++Qt)Ht.push(c(Z[Qt]).join("|"));return nt=new TypeError('Arguments of type "'+Ht.join(", ")+'" do not match any of the defined signatures of function '+rt+"."),nt.data={category:"mismatch",actual:Ht},nt}function U($){let Z=n.length+1;for(let H=0;H<$.types.length;H++)C($.types[H])&&(Z=Math.min(Z,$.types[H].typeIndex));return Z}function k($){let Z=s+1;for(let H=0;H<$.types.length;H++)C($.types[H])||(Z=Math.min(Z,$.types[H].conversionIndex));return Z}function W($,Z){if($.hasAny){if(!Z.hasAny)return 1}else if(Z.hasAny)return-1;if($.restParam){if(!Z.restParam)return 1}else if(Z.restParam)return-1;if($.hasConversion){if(!Z.hasConversion)return 1}else if(Z.hasConversion)return-1;const H=U($)-U(Z);if(H<0)return-1;if(H>0)return 1;const nt=k($)-k(Z);return nt<0?-1:nt>0?1:0}function P($,Z){const H=$.params,nt=Z.params,st=It(H),rt=It(nt),ct=x(H),ut=x(nt);if(ct&&st.hasAny){if(!ut||!rt.hasAny)return 1}else if(ut&&rt.hasAny)return-1;let ht=0,at=0,Ht;for(Ht of H)Ht.hasAny&&++ht,Ht.hasConversion&&++at;let Qt=0,_e=0;for(Ht of nt)Ht.hasAny&&++Qt,Ht.hasConversion&&++_e;if(ht!==Qt)return ht-Qt;if(ct&&st.hasConversion){if(!ut||!rt.hasConversion)return 1}else if(ut&&rt.hasConversion)return-1;if(at!==_e)return at-_e;if(ct){if(!ut)return 1}else if(ut)return-1;const $e=(H.length-nt.length)*(ct?-1:1);if($e!==0)return $e;const Be=[];let fr=0;for(let An=0;An<H.length;++An){const Kn=W(H[An],nt[An]);Be.push(Kn),fr+=Kn}if(fr!==0)return fr;let cr;for(cr of Be)if(cr!==0)return cr;return 0}function K($){if($.length===0)return[];const Z=$.map(l);$.length>1&&Z.sort((st,rt)=>st.index-rt.index);let H=Z[0].conversionsTo;if($.length===1)return H;H=H.concat([]);const nt=new Set($);for(let st=1;st<Z.length;++st){let rt;for(rt of Z[st].conversionsTo)nt.has(rt.from)||(H.push(rt),nt.add(rt.from))}return H}function G($,Z){let H=Z;if($.some(st=>st.hasConversion)){const st=x($),rt=$.map(V);H=function(){const ut=[],ht=st?arguments.length-1:arguments.length;for(let at=0;at<ht;at++)ut[at]=rt[at](arguments[at]);return st&&(ut[ht]=arguments[ht].map(rt[ht])),Z.apply(this,ut)}}let nt=H;if(x($)){const st=$.length-1;nt=function(){return H.apply(this,Nt(arguments,0,st).concat([Nt(arguments,st)]))}}return nt}function V($){let Z,H,nt,st;const rt=[],ct=[];switch($.types.forEach(function(ut){ut.conversion&&(rt.push(l(ut.conversion.from).test),ct.push(ut.conversion.convert))}),ct.length){case 0:return function(ht){return ht};case 1:return Z=rt[0],nt=ct[0],function(ht){return Z(ht)?nt(ht):ht};case 2:return Z=rt[0],H=rt[1],nt=ct[0],st=ct[1],function(ht){return Z(ht)?nt(ht):H(ht)?st(ht):ht};default:return function(ht){for(let at=0;at<ct.length;at++)if(rt[at](ht))return ct[at](ht);return ht}}}function tt($){function Z(H,nt,st){if(nt<H.length){const rt=H[nt];let ct=[];if(rt.restParam){const ut=rt.types.filter(C);ut.length<rt.types.length&&ct.push({types:ut,name:"..."+ut.map(ht=>ht.name).join("|"),hasAny:ut.some(ht=>ht.isAny),hasConversion:!1,restParam:!0}),ct.push(rt)}else ct=rt.types.map(function(ut){return{types:[ut],name:ut.name,hasAny:ut.isAny,hasConversion:ut.conversion,restParam:!1}});return Vt(ct,function(ut){return Z(H,nt+1,st.concat([ut]))})}else return[st]}return Z($,0,[])}function ft($,Z){const H=Math.max($.length,Z.length);for(let ut=0;ut<H;ut++){const ht=O($,ut),at=O(Z,ut);let Ht=!1,Qt;for(Qt of at)if(ht.has(Qt)){Ht=!0;break}if(!Ht)return!1}const nt=$.length,st=Z.length,rt=x($),ct=x(Z);return rt?ct?nt===st:st>=nt:ct?nt>=st:nt===st}function vt($){return $.map(Z=>Se(Z)?Me(Z.referToSelf.callback):ur(Z)?Kt(Z.referTo.references,Z.referTo.callback):Z)}function lt($,Z,H){const nt=[];let st;for(st of $){let rt=H[st];if(typeof rt!="number")throw new TypeError('No definition for referenced signature "'+st+'"');if(rt=Z[rt],typeof rt!="function")return!1;nt.push(rt)}return nt}function yt($,Z,H){const nt=vt($),st=new Array(nt.length).fill(!1);let rt=!0;for(;rt;){rt=!1;let ct=!0;for(let ut=0;ut<nt.length;++ut){if(st[ut])continue;const ht=nt[ut];if(Se(ht))nt[ut]=ht.referToSelf.callback(H),nt[ut].referToSelf=ht.referToSelf,st[ut]=!0,ct=!1;else if(ur(ht)){const at=lt(ht.referTo.references,nt,Z);at?(nt[ut]=ht.referTo.callback.apply(this,at),nt[ut].referTo=ht.referTo,st[ut]=!0,ct=!1):rt=!0}}if(ct&&rt)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return nt}function bt($){const Z=/\bthis(\(|\.signatures\b)/;Object.keys($).forEach(H=>{const nt=$[H];if(Z.test(nt.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}function Bt($,Z){if(a.createCount++,Object.keys(Z).length===0)throw new SyntaxError("No signatures provided");a.warnAgainstDeprecatedThis&&bt(Z);const H=[],nt=[],st={},rt=[];let ct;for(ct in Z){if(!Object.prototype.hasOwnProperty.call(Z,ct))continue;const Yt=N(ct);if(!Yt)continue;H.forEach(function(Cn){if(ft(Cn,Yt))throw new TypeError('Conflicting signatures "'+D(Cn)+'" and "'+D(Yt)+'".')}),H.push(Yt);const je=nt.length;nt.push(Z[ct]);const lu=Yt.map(E);let xi;for(xi of tt(lu)){const Cn=D(xi);rt.push({params:xi,name:Cn,fn:je}),xi.every(_o=>!_o.hasConversion)&&(st[Cn]=je)}}rt.sort(P);const ut=yt(nt,st,Hn);let ht;for(ht in st)Object.prototype.hasOwnProperty.call(st,ht)&&(st[ht]=ut[st[ht]]);const at=[],Ht=new Map;for(ht of rt)Ht.has(ht.name)||(ht.fn=ut[ht.fn],at.push(ht),Ht.set(ht.name,ht));const Qt=at[0]&&at[0].params.length<=2&&!x(at[0].params),_e=at[1]&&at[1].params.length<=2&&!x(at[1].params),$e=at[2]&&at[2].params.length<=2&&!x(at[2].params),Be=at[3]&&at[3].params.length<=2&&!x(at[3].params),fr=at[4]&&at[4].params.length<=2&&!x(at[4].params),cr=at[5]&&at[5].params.length<=2&&!x(at[5].params),An=Qt&&_e&&$e&&Be&&fr&&cr;for(let Yt=0;Yt<at.length;++Yt)at[Yt].test=M(at[Yt].params);const Kn=Qt?F(at[0].params[0]):wr,co=_e?F(at[1].params[0]):wr,ka=$e?F(at[2].params[0]):wr,Ua=Be?F(at[3].params[0]):wr,Wa=fr?F(at[4].params[0]):wr,ja=cr?F(at[5].params[0]):wr,ho=Qt?F(at[0].params[1]):wr,Ya=_e?F(at[1].params[1]):wr,Za=$e?F(at[2].params[1]):wr,Ga=Be?F(at[3].params[1]):wr,Qi=fr?F(at[4].params[1]):wr,Ka=cr?F(at[5].params[1]):wr;for(let Yt=0;Yt<at.length;++Yt)at[Yt].implementation=G(at[Yt].params,at[Yt].fn);const ts=Qt?at[0].implementation:ai,Ha=_e?at[1].implementation:ai,Ja=$e?at[2].implementation:ai,Xa=Be?at[3].implementation:ai,Va=fr?at[4].implementation:ai,Qa=cr?at[5].implementation:ai,tu=Qt?at[0].params.length:-1,eu=_e?at[1].params.length:-1,ru=$e?at[2].params.length:-1,po=Be?at[3].params.length:-1,nu=fr?at[4].params.length:-1,iu=cr?at[5].params.length:-1,su=An?6:0,ou=at.length,au=at.map(Yt=>Yt.test),uu=at.map(Yt=>Yt.implementation),Ei=function(){for(let je=su;je<ou;je++)if(au[je](arguments))return uu[je].apply(this,arguments);return a.onMismatch($,arguments,at)};function Hn(Yt,je){return arguments.length===tu&&Kn(Yt)&&ho(je)?ts.apply(this,arguments):arguments.length===eu&&co(Yt)&&Ya(je)?Ha.apply(this,arguments):arguments.length===ru&&ka(Yt)&&Za(je)?Ja.apply(this,arguments):arguments.length===po&&Ua(Yt)&&Ga(je)?Xa.apply(this,arguments):arguments.length===nu&&Wa(Yt)&&Qi(je)?Va.apply(this,arguments):arguments.length===iu&&ja(Yt)&&Ka(je)?Qa.apply(this,arguments):Ei.apply(this,arguments)}try{Object.defineProperty(Hn,"name",{value:$})}catch{}return Hn.signatures=st,Hn._typedFunctionData={signatures:at,signatureMap:Ht},Hn}function Et($,Z,H){throw L($,Z,H)}function ne($){return Nt($,0,$.length-1)}function It($){return $[$.length-1]}function Nt($,Z,H){return Array.prototype.slice.call($,Z,H)}function se($,Z){for(let H=0;H<$.length;H++)if(Z($[H]))return $[H]}function Vt($,Z){return Array.prototype.concat.apply([],$.map(Z))}function qt(){const $=ne(arguments).map(H=>D(N(H))),Z=It(arguments);if(typeof Z!="function")throw new TypeError("Callback function expected as last argument");return Kt($,Z)}function Kt($,Z){return{referTo:{references:$,callback:Z}}}function Me($){if(typeof $!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:$}}}function ur($){return $&&typeof $.referTo=="object"&&Array.isArray($.referTo.references)&&typeof $.referTo.callback=="function"}function Se($){return $&&typeof $.referToSelf=="object"&&typeof $.referToSelf.callback=="function"}function rn($,Z){if(!$)return Z;if(Z&&Z!==$){const H=new Error("Function names do not match (expected: "+$+", actual: "+Z+")");throw H.data={actual:Z,expected:$},H}return $}function En($){let Z;for(const H in $)Object.prototype.hasOwnProperty.call($,H)&&(d($[H])||typeof $[H].signature=="string")&&(Z=rn(Z,$[H].name));return Z}function nn($,Z){let H;for(H in Z)if(Object.prototype.hasOwnProperty.call(Z,H)){if(H in $&&Z[H]!==$[H]){const nt=new Error('Signature "'+H+'" is defined twice');throw nt.data={signature:H,sourceFunction:Z[H],destFunction:$[H]},nt}$[H]=Z[H]}}const lr=a;a=function($){const Z=typeof $=="string",H=Z?1:0;let nt=Z?$:"";const st={};for(let rt=H;rt<arguments.length;++rt){const ct=arguments[rt];let ut={},ht;if(typeof ct=="function"?(ht=ct.name,typeof ct.signature=="string"?ut[ct.signature]=ct:d(ct)&&(ut=ct.signatures)):i(ct)&&(ut=ct,Z||(ht=En(ct))),Object.keys(ut).length===0){const at=new TypeError("Argument to 'typed' at index "+rt+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw at.data={index:rt,argument:ct},at}Z||(nt=rn(nt,ht)),nn(st,ut)}return Bt(nt||"",st)},a.create=$l,a.createCount=lr.createCount,a.onMismatch=Et,a.throwMismatchError=Et,a.createError=L,a.clear=h,a.clearConversions=p,a.addTypes=f,a._findType=l,a.referTo=qt,a.referToSelf=Me,a.convert=m,a.findSignature=g,a.find=w,a.isTypedFunction=d,a.warnAgainstDeprecatedThis=!0,a.addType=function($,Z){let H="any";Z!==!1&&r.has("Object")&&(H="Object"),a.addTypes([$],H)};function xn($){if(!$||typeof $.from!="string"||typeof $.to!="string"||typeof $.convert!="function")throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if($.to===$.from)throw new SyntaxError('Illegal to define conversion from "'+$.from+'" to itself.')}return a.addConversion=function($){xn($);const Z=l($.to);if(Z.conversionsTo.every(function(H){return H.from!==$.from}))Z.conversionsTo.push({from:$.from,convert:$.convert,index:s++});else throw new Error('There is already a conversion from "'+$.from+'" to "'+Z.name+'"')},a.addConversions=function($){$.forEach(a.addConversion)},a.removeConversion=function($){xn($);const Z=l($.to),H=se(Z.conversionsTo,st=>st.from===$.from);if(!H)throw new Error("Attempt to remove nonexistent conversion from "+$.from+" to "+$.to);if(H.convert!==$.convert)throw new Error("Conversion to remove does not match existing conversion");const nt=Z.conversionsTo.indexOf(H);Z.conversionsTo.splice(nt,1)},a.resolve=function($,Z){if(!d($))throw new TypeError(Ol);const H=$._typedFunctionData.signatures;for(let nt=0;nt<H.length;++nt)if(H[nt].test(Z))return H[nt];return null},a}var Ll=$l();function de(i){return typeof i=="boolean"?!0:isFinite(i)?i===Math.round(i):!1}function oa(i,t,e){var r={2:"0b",8:"0o",16:"0x"},n=r[t],s="";if(e){if(e<1)throw new Error("size must be in greater than 0");if(!de(e))throw new Error("size must be an integer");if(i>2**(e-1)-1||i<-(2**(e-1)))throw new Error("Value must be in range [-2^".concat(e-1,", 2^").concat(e-1,"-1]"));if(!de(i))throw new Error("Value must be an integer");i<0&&(i=i+2**e),s="i".concat(e)}var a="";return i<0&&(i=-i,a="-"),"".concat(a).concat(n).concat(i.toString(t)).concat(s)}function aa(i,t){if(typeof t=="function")return t(i);if(i===1/0)return"Infinity";if(i===-1/0)return"-Infinity";if(isNaN(i))return"NaN";var{notation:e,precision:r,wordSize:n}=Rl(t);switch(e){case"fixed":return gd(i,r);case"exponential":return Pl(i,r);case"engineering":return md(i,r);case"bin":return oa(i,2,n);case"oct":return oa(i,8,n);case"hex":return oa(i,16,n);case"auto":return vd(i,r,t).replace(/((\.\d*?)(0+))($|e)/,function(){var s=arguments[2],a=arguments[4];return s!=="."?s+a:a});default:throw new Error('Unknown notation "'+e+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function Rl(i){var t="auto",e,r;if(i!==void 0)if(le(i))e=i;else if(Ee(i))e=i.toNumber();else if(sa(i))i.precision!==void 0&&(e=zl(i.precision,()=>{throw new Error('Option "precision" must be a number or BigNumber')})),i.wordSize!==void 0&&(r=zl(i.wordSize,()=>{throw new Error('Option "wordSize" must be a number or BigNumber')})),i.notation&&(t=i.notation);else throw new Error("Unsupported type of options, number, BigNumber, or object expected");return{notation:t,precision:e,wordSize:r}}function bs(i){var t=String(i).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!t)throw new SyntaxError("Invalid number "+i);var e=t[1],r=t[2],n=parseFloat(t[4]||"0"),s=r.indexOf(".");n+=s!==-1?s-1:r.length-1;var a=r.replace(".","").replace(/^0*/,function(l){return n-=l.length,""}).replace(/0*$/,"").split("").map(function(l){return parseInt(l)});return a.length===0&&(a.push(0),n++),{sign:e,coefficients:a,exponent:n}}function md(i,t){if(isNaN(i)||!isFinite(i))return String(i);var e=bs(i),r=Es(e,t),n=r.exponent,s=r.coefficients,a=n%3===0?n:n<0?n-3-n%3:n-n%3;if(le(t))for(;t>s.length||n-a+1>s.length;)s.push(0);else for(var l=Math.abs(n-a)-(s.length-1),f=0;f<l;f++)s.push(0);for(var h=Math.abs(n-a),p=1;h>0;)p++,h--;var c=s.slice(p).join(""),d=le(t)&&c.length||c.match(/[1-9]/)?"."+c:"",g=s.slice(0,p).join("")+d+"e"+(n>=0?"+":"")+a.toString();return r.sign+g}function gd(i,t){if(isNaN(i)||!isFinite(i))return String(i);var e=bs(i),r=typeof t=="number"?Es(e,e.exponent+1+t):e,n=r.coefficients,s=r.exponent+1,a=s+(t||0);return n.length<a&&(n=n.concat(ui(a-n.length))),s<0&&(n=ui(-s+1).concat(n),s=1),s<n.length&&n.splice(s,0,s===0?"0.":"."),r.sign+n.join("")}function Pl(i,t){if(isNaN(i)||!isFinite(i))return String(i);var e=bs(i),r=t?Es(e,t):e,n=r.coefficients,s=r.exponent;n.length<t&&(n=n.concat(ui(t-n.length)));var a=n.shift();return r.sign+a+(n.length>0?"."+n.join(""):"")+"e"+(s>=0?"+":"")+s}function vd(i,t,e){if(isNaN(i)||!isFinite(i))return String(i);var r=ql(e==null?void 0:e.lowerExp,-3),n=ql(e==null?void 0:e.upperExp,5),s=bs(i),a=t?Es(s,t):s;if(a.exponent<r||a.exponent>=n)return Pl(i,t);var l=a.coefficients,f=a.exponent;l.length<t&&(l=l.concat(ui(t-l.length))),l=l.concat(ui(f-l.length+1+(l.length<t?t-l.length:0))),l=ui(-f).concat(l);var h=f>0?f:0;return h<l.length-1&&l.splice(h+1,0,"."),a.sign+l.join("")}function Es(i,t){for(var e={sign:i.sign,coefficients:i.coefficients,exponent:i.exponent},r=e.coefficients;t<=0;)r.unshift(0),e.exponent++,t++;if(r.length>t){var n=r.splice(t,r.length-t);if(n[0]>=5){var s=t-1;for(r[s]++;r[s]===10;)r.pop(),s===0&&(r.unshift(0),e.exponent++,s++),s--,r[s]++}}return e}function ui(i){for(var t=[],e=0;e<i;e++)t.push(0);return t}function wd(i){return i.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length}var yd=Number.EPSILON||2220446049250313e-31;function Un(i,t,e){if(e==null)return i===t;if(i===t)return!0;if(isNaN(i)||isNaN(t))return!1;if(isFinite(i)&&isFinite(t)){var r=Math.abs(i-t);return r<=yd?!0:r<=Math.max(Math.abs(i),Math.abs(t))*e}return!1}function zl(i,t){if(le(i))return i;if(Ee(i))return i.toNumber();t()}function ql(i,t){return le(i)?i:Ee(i)?i.toNumber():t}function ua(i,t,e){var r=i.constructor,n=new r(2),s="";if(e){if(e<1)throw new Error("size must be in greater than 0");if(!de(e))throw new Error("size must be an integer");if(i.greaterThan(n.pow(e-1).sub(1))||i.lessThan(n.pow(e-1).mul(-1)))throw new Error("Value must be in range [-2^".concat(e-1,", 2^").concat(e-1,"-1]"));if(!i.isInteger())throw new Error("Value must be an integer");i.lessThan(0)&&(i=i.add(n.pow(e))),s="i".concat(e)}switch(t){case 2:return"".concat(i.toBinary()).concat(s);case 8:return"".concat(i.toOctal()).concat(s);case 16:return"".concat(i.toHexadecimal()).concat(s);default:throw new Error("Base ".concat(t," not supported "))}}function Dd(i,t){if(typeof t=="function")return t(i);if(!i.isFinite())return i.isNaN()?"NaN":i.gt(0)?"Infinity":"-Infinity";var{notation:e,precision:r,wordSize:n}=Rl(t);switch(e){case"fixed":return Ed(i,r);case"exponential":return kl(i,r);case"engineering":return bd(i,r);case"bin":return ua(i,2,n);case"oct":return ua(i,8,n);case"hex":return ua(i,16,n);case"auto":{var s=Ul(t==null?void 0:t.lowerExp,-3),a=Ul(t==null?void 0:t.upperExp,5);if(i.isZero())return"0";var l,f=i.toSignificantDigits(r),h=f.e;return h>=s&&h<a?l=f.toFixed():l=kl(i,r),l.replace(/((\.\d*?)(0+))($|e)/,function(){var p=arguments[2],c=arguments[4];return p!=="."?p+c:c})}default:throw new Error('Unknown notation "'+e+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function bd(i,t){var e=i.e,r=e%3===0?e:e<0?e-3-e%3:e-e%3,n=i.mul(Math.pow(10,-r)),s=n.toPrecision(t);if(s.indexOf("e")!==-1){var a=i.constructor;s=new a(s).toFixed()}return s+"e"+(e>=0?"+":"")+r.toString()}function kl(i,t){return t!==void 0?i.toExponential(t-1):i.toExponential()}function Ed(i,t){return i.toFixed(t)}function Ul(i,t){return le(i)?i:Ee(i)?i.toNumber():t}function oe(i,t){var e=xd(i,t);return t&&typeof t=="object"&&"truncate"in t&&e.length>t.truncate?e.substring(0,t.truncate-3)+"...":e}function xd(i,t){if(typeof i=="number")return aa(i,t);if(Ee(i))return Dd(i,t);if(Ad(i))return!t||t.fraction!=="decimal"?i.s*i.n+"/"+i.d:i.toString();if(Array.isArray(i))return Yl(i,t);if(Yr(i))return Wl(i);if(typeof i=="function")return i.syntax?String(i.syntax):"function";if(i&&typeof i=="object"){if(typeof i.format=="function")return i.format(t);if(i&&i.toString(t)!=={}.toString())return i.toString(t);var e=Object.keys(i).map(r=>Wl(r)+": "+oe(i[r],t));return"{"+e.join(", ")+"}"}return String(i)}function Wl(i){for(var t=String(i),e="",r=0;r<t.length;){var n=t.charAt(r);e+=n in jl?jl[n]:n,r++}return'"'+e+'"'}var jl={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"};function Yl(i,t){if(Array.isArray(i)){for(var e="[",r=i.length,n=0;n<r;n++)n!==0&&(e+=", "),e+=Yl(i[n],t);return e+="]",e}else return oe(i,t)}function Ad(i){return i&&typeof i=="object"&&typeof i.s=="number"&&typeof i.n=="number"&&typeof i.d=="number"||!1}function Gt(i,t,e){if(!(this instanceof Gt))throw new SyntaxError("Constructor must be called with the new operator");this.actual=i,this.expected=t,this.relation=e,this.message="Dimension mismatch ("+(Array.isArray(i)?"["+i.join(", ")+"]":i)+" "+(this.relation||"!=")+" "+(Array.isArray(t)?"["+t.join(", ")+"]":t)+")",this.stack=new Error().stack}Gt.prototype=new RangeError,Gt.prototype.constructor=RangeError,Gt.prototype.name="DimensionError",Gt.prototype.isDimensionError=!0;function mn(i,t,e){if(!(this instanceof mn))throw new SyntaxError("Constructor must be called with the new operator");this.index=i,arguments.length<3?(this.min=0,this.max=t):(this.min=t,this.max=e),this.min!==void 0&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":this.max!==void 0&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=new Error().stack}mn.prototype=new RangeError,mn.prototype.constructor=RangeError,mn.prototype.name="IndexError",mn.prototype.isIndexError=!0;function Ce(i){for(var t=[];Array.isArray(i);)t.push(i.length),i=i[0];return t}function Zl(i,t,e){var r,n=i.length;if(n!==t[e])throw new Gt(n,t[e]);if(e<t.length-1){var s=e+1;for(r=0;r<n;r++){var a=i[r];if(!Array.isArray(a))throw new Gt(t.length-1,t.length,"<");Zl(i[r],t,s)}}else for(r=0;r<n;r++)if(Array.isArray(i[r]))throw new Gt(t.length+1,t.length,">")}function Gl(i,t){var e=t.length===0;if(e){if(Array.isArray(i))throw new Gt(i.length,0)}else Zl(i,t,0)}function we(i,t){if(i!==void 0){if(!le(i)||!de(i))throw new TypeError("Index must be an integer (value: "+i+")");if(i<0||typeof t=="number"&&i>=t)throw new mn(i,t)}}function la(i,t,e){if(!Array.isArray(t))throw new TypeError("Array expected");if(t.length===0)throw new Error("Resizing to scalar is not supported");t.forEach(function(n){if(!le(n)||!de(n)||n<0)throw new TypeError("Invalid size, must contain positive integers (size: "+oe(t)+")")}),(le(i)||Ee(i))&&(i=[i]);var r=e!==void 0?e:0;return fa(i,t,0,r),i}function fa(i,t,e,r){var n,s,a=i.length,l=t[e],f=Math.min(a,l);if(i.length=l,e<t.length-1){var h=e+1;for(n=0;n<f;n++)s=i[n],Array.isArray(s)||(s=[s],i[n]=s),fa(s,t,h,r);for(n=f;n<l;n++)s=[],i[n]=s,fa(s,t,h,r)}else{for(n=0;n<f;n++)for(;Array.isArray(i[n]);)i[n]=i[n][0];for(n=f;n<l;n++)i[n]=r}}function ca(i,t){var e=pa(i),r=e.length;if(!Array.isArray(i)||!Array.isArray(t))throw new TypeError("Array expected");if(t.length===0)throw new Gt(0,r,"!=");t=ha(t,r);var n=Kl(t);if(r!==n)throw new Gt(n,r,"!=");try{return Cd(e,t)}catch(s){throw s instanceof Gt?new Gt(n,r,"!="):s}}function ha(i,t){var e=Kl(i),r=i.slice(),n=-1,s=i.indexOf(n),a=i.indexOf(n,s+1)>=0;if(a)throw new Error("More than one wildcard in sizes");var l=s>=0,f=t%e===0;if(l)if(f)r[s]=-t/e;else throw new Error("Could not replace wildcard, since "+t+" is no multiple of "+-e);return r}function Kl(i){return i.reduce((t,e)=>t*e,1)}function Cd(i,t){for(var e=i,r,n=t.length-1;n>0;n--){var s=t[n];r=[];for(var a=e.length/s,l=0;l<a;l++)r.push(e.slice(l*s,(l+1)*s));e=r}return e}function Hl(i,t,e,r){var n=r||Ce(i);if(e)for(var s=0;s<e;s++)i=[i],n.unshift(1);for(i=Jl(i,t,0);n.length<t;)n.push(1);return i}function Jl(i,t,e){var r,n;if(Array.isArray(i)){var s=e+1;for(r=0,n=i.length;r<n;r++)i[r]=Jl(i[r],t,s)}else for(var a=e;a<t;a++)i=[i];return i}function pa(i){if(!Array.isArray(i))return i;var t=[];return i.forEach(function e(r){Array.isArray(r)?r.forEach(e):t.push(r)}),t}function xs(i,t){for(var e,r=0,n=0;n<i.length;n++){var s=i[n],a=Array.isArray(s);if(n===0&&a&&(r=s.length),a&&s.length!==r)return;var l=a?xs(s,t):t(s);if(e===void 0)e=l;else if(e!==l)return"mixed"}return e}function Xl(i,t,e,r){if(r<e){if(i.length!==t.length)throw new Gt(i.length,t.length);for(var n=[],s=0;s<i.length;s++)n[s]=Xl(i[s],t[s],e,r+1);return n}else return i.concat(t)}function Vl(){var i=Array.prototype.slice.call(arguments,0,-1),t=Array.prototype.slice.call(arguments,-1);if(i.length===1)return i[0];if(i.length>1)return i.slice(1).reduce(function(e,r){return Xl(e,r,t,0)},i[0]);throw new Error("Wrong number of arguments in function concat")}function Fd(){for(var i=arguments.length,t=new Array(i),e=0;e<i;e++)t[e]=arguments[e];for(var r=t.map(d=>d.length),n=Math.max(...r),s=new Array(n).fill(null),a=0;a<t.length;a++)for(var l=t[a],f=r[a],h=0;h<f;h++){var p=n-f+h;l[h]>s[p]&&(s[p]=l[h])}for(var c=0;c<t.length;c++)As(t[c],s);return s}function As(i,t){for(var e=t.length,r=i.length,n=0;n<r;n++){var s=e-r+n;if(i[n]<t[s]&&i[n]>1||i[n]>t[s])throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(i,") not possible to broadcast dimension ").concat(r," with size ").concat(i[n]," to size ").concat(t[s]))}}function Ql(i,t){var e=Ce(i);if(oi(e,t))return i;As(e,t);var r=Fd(e,t),n=r.length,s=[...Array(n-e.length).fill(1),...e],a=Nd(i);e.length<n&&(a=ca(a,s),e=Ce(a));for(var l=0;l<n;l++)e[l]<r[l]&&(a=Md(a,r[l],l),e=Ce(a));return a}function Md(i,t,e){return Vl(...Array(t).fill(i),e)}function Nd(i){return Ds([],i)}function mt(i,t,e,r){function n(s){var a=pd(s,t.map(Td));return Sd(i,t,s),e(a)}return n.isFactory=!0,n.fn=i,n.dependencies=t.slice().sort(),r&&(n.meta=r),n}function Sd(i,t,e){var r=t.filter(s=>!Bd(s)).every(s=>e[s]!==void 0);if(!r){var n=t.filter(s=>e[s]===void 0);throw new Error('Cannot create function "'.concat(i,'", ')+"some dependencies are missing: ".concat(n.map(s=>'"'.concat(s,'"')).join(", "),"."))}}function Bd(i){return i&&i[0]==="?"}function Td(i){return i&&i[0]==="?"?i.slice(1):i}function Id(i,t){if(ef(i)&&tf(i,t))return i[t];throw typeof i[t]=="function"&&Ld(i,t)?new Error('Cannot access method "'+t+'" as a property'):new Error('No access to property "'+t+'"')}function Od(i,t,e){if(ef(i)&&tf(i,t))return i[t]=e,e;throw new Error('No access to property "'+t+'"')}function $d(i,t){return t in i}function tf(i,t){return!i||typeof i!="object"?!1:Ui(Rd,t)?!0:!(t in Object.prototype||t in Function.prototype)}function Ld(i,t){return i==null||typeof i[t]!="function"||Ui(i,t)&&Object.getPrototypeOf&&t in Object.getPrototypeOf(i)?!1:Ui(Pd,t)?!0:!(t in Object.prototype||t in Function.prototype)}function ef(i){return typeof i=="object"&&i&&i.constructor===Object}var Rd={length:!0,name:!0},Pd={toString:!0,valueOf:!0,toLocaleString:!0};class zd{constructor(t){this.wrappedObject=t,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).values()}get(t){return Id(this.wrappedObject,t)}set(t,e){return Od(this.wrappedObject,t,e),this}has(t){return $d(this.wrappedObject,t)}entries(){return qd(this.keys(),t=>[t,this.get(t)])}forEach(t){for(var e of this.keys())t(this.get(e),e,this)}delete(t){delete this.wrappedObject[t]}clear(){for(var t of this.keys())this.delete(t)}get size(){return Object.keys(this.wrappedObject).length}}function qd(i,t){return{next:()=>{var e=i.next();return e.done?e:{value:t(e.value),done:!1}}}}function kd(i){return i?i instanceof Map||i instanceof zd||typeof i.set=="function"&&typeof i.get=="function"&&typeof i.keys=="function"&&typeof i.has=="function":!1}var rf=function(){return rf=Ll.create,Ll},Ud=["?BigNumber","?Complex","?DenseMatrix","?Fraction"],Wd=mt("typed",Ud,function(t){var{BigNumber:e,Complex:r,DenseMatrix:n,Fraction:s}=t,a=rf();return a.clear(),a.addTypes([{name:"number",test:le},{name:"Complex",test:Nl},{name:"BigNumber",test:Ee},{name:"Fraction",test:Sl},{name:"Unit",test:Bl},{name:"identifier",test:l=>Yr&&/^(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(l)},{name:"string",test:Yr},{name:"Chain",test:cd},{name:"Array",test:ve},{name:"Matrix",test:ce},{name:"DenseMatrix",test:Pp},{name:"SparseMatrix",test:zp},{name:"Range",test:qp},{name:"Index",test:ia},{name:"boolean",test:kp},{name:"ResultSet",test:Up},{name:"Help",test:Wp},{name:"function",test:jp},{name:"Date",test:Yp},{name:"RegExp",test:Zp},{name:"null",test:Gp},{name:"undefined",test:Kp},{name:"AccessorNode",test:Hp},{name:"ArrayNode",test:Jp},{name:"AssignmentNode",test:Xp},{name:"BlockNode",test:Vp},{name:"ConditionalNode",test:Qp},{name:"ConstantNode",test:td},{name:"FunctionNode",test:rd},{name:"FunctionAssignmentNode",test:ed},{name:"IndexNode",test:nd},{name:"Node",test:id},{name:"ObjectNode",test:sd},{name:"OperatorNode",test:od},{name:"ParenthesisNode",test:ad},{name:"RangeNode",test:ud},{name:"RelationalNode",test:ld},{name:"SymbolNode",test:fd},{name:"Map",test:kd},{name:"Object",test:sa}]),a.addConversions([{from:"number",to:"BigNumber",convert:function(f){if(e||da(f),wd(f)>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+f+"). Use function bignumber(x) to convert to BigNumber.");return new e(f)}},{from:"number",to:"Complex",convert:function(f){return r||Cs(f),new r(f,0)}},{from:"BigNumber",to:"Complex",convert:function(f){return r||Cs(f),new r(f.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(f){throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(f){return r||Cs(f),new r(f.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(f){s||_a(f);var h=new s(f);if(h.valueOf()!==f)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+f+"). Use function fraction(x) to convert to Fraction.");return h}},{from:"string",to:"number",convert:function(f){var h=Number(f);if(isNaN(h))throw new Error('Cannot convert "'+f+'" to a number');return h}},{from:"string",to:"BigNumber",convert:function(f){e||da(f);try{return new e(f)}catch{throw new Error('Cannot convert "'+f+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(f){s||_a(f);try{return new s(f)}catch{throw new Error('Cannot convert "'+f+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(f){r||Cs(f);try{return new r(f)}catch{throw new Error('Cannot convert "'+f+'" to Complex')}}},{from:"boolean",to:"number",convert:function(f){return+f}},{from:"boolean",to:"BigNumber",convert:function(f){return e||da(f),new e(+f)}},{from:"boolean",to:"Fraction",convert:function(f){return s||_a(f),new s(+f)}},{from:"boolean",to:"string",convert:function(f){return String(f)}},{from:"Array",to:"Matrix",convert:function(f){return n||jd(),new n(f)}},{from:"Matrix",to:"Array",convert:function(f){return f.valueOf()}}]),a.onMismatch=(l,f,h)=>{var p=a.createError(l,f,h);if(["wrongType","mismatch"].includes(p.data.category)&&f.length===1&&ki(f[0])&&h.some(d=>!d.params.includes(","))){var c=new TypeError("Function '".concat(l,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(l,")'."));throw c.data=p.data,c}throw p},a.onMismatch=(l,f,h)=>{var p=a.createError(l,f,h);if(["wrongType","mismatch"].includes(p.data.category)&&f.length===1&&ki(f[0])&&h.some(d=>!d.params.includes(","))){var c=new TypeError("Function '".concat(l,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(l,")'."));throw c.data=p.data,c}throw p},a});function da(i){throw new Error("Cannot convert value ".concat(i," into a BigNumber: no class 'BigNumber' provided"))}function Cs(i){throw new Error("Cannot convert value ".concat(i," into a Complex number: no class 'Complex' provided"))}function jd(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}function _a(i){throw new Error("Cannot convert value ".concat(i," into a Fraction, no class 'Fraction' provided."))}/*!
|
34
|
+
`);return Object.freeze(Nl)};Ds(or,Nl,{MATRIX_OPTIONS:dd,NUMBER_OPTIONS:_d});function Ol(){return!0}function wr(){return!1}function ai(){}const $l="Argument is not a typed-function.";function Ll(){function i($){return typeof $=="object"&&$!==null&&$.constructor===Object}const t=[{name:"number",test:function($){return typeof $=="number"}},{name:"string",test:function($){return typeof $=="string"}},{name:"boolean",test:function($){return typeof $=="boolean"}},{name:"Function",test:function($){return typeof $=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function($){return $ instanceof Date}},{name:"RegExp",test:function($){return $ instanceof RegExp}},{name:"Object",test:i},{name:"null",test:function($){return $===null}},{name:"undefined",test:function($){return $===void 0}}],e={name:"any",test:Ol,isAny:!0};let r,n,s=0,a={createCount:0};function l($){const Z=r.get($);if(Z)return Z;let H='Unknown type "'+$+'"';const nt=$.toLowerCase();let st;for(st of n)if(st.toLowerCase()===nt){H+='. Did you mean "'+st+'" ?';break}throw new TypeError(H)}function f($){let Z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any";const H=Z?l(Z).index:n.length,nt=[];for(let rt=0;rt<$.length;++rt){if(!$[rt]||typeof $[rt].name!="string"||typeof $[rt].test!="function")throw new TypeError("Object with properties {name: string, test: function} expected");const ct=$[rt].name;if(r.has(ct))throw new TypeError('Duplicate type name "'+ct+'"');nt.push(ct),r.set(ct,{name:ct,test:$[rt].test,isAny:$[rt].isAny,index:H+rt,conversionsTo:[]})}const st=n.slice(H);n=n.slice(0,H).concat(nt).concat(st);for(let rt=H+nt.length;rt<n.length;++rt)r.get(n[rt]).index=rt}function h(){r=new Map,n=[],s=0,f([e],!1)}h(),f(t);function p(){let $;for($ of n)r.get($).conversionsTo=[];s=0}function c($){const Z=n.filter(H=>{const nt=r.get(H);return!nt.isAny&&nt.test($)});return Z.length?Z:["any"]}function d($){return $&&typeof $=="function"&&"_typedFunctionData"in $}function g($,Z,H){if(!d($))throw new TypeError($l);const nt=H&&H.exact,st=Array.isArray(Z)?Z.join(","):Z,rt=N(st),ct=D(rt);if(!nt||ct in $.signatures){const Ht=$._typedFunctionData.signatureMap.get(ct);if(Ht)return Ht}const ut=rt.length;let ht;if(nt){ht=[];let Ht;for(Ht in $.signatures)ht.push($._typedFunctionData.signatureMap.get(Ht))}else ht=$._typedFunctionData.signatures;for(let Ht=0;Ht<ut;++Ht){const te=rt[Ht],_e=[];let Le;for(Le of ht){const Te=S(Le.params,Ht);if(!(!Te||te.restParam&&!Te.restParam)){if(!Te.hasAny){const fr=b(Te);if(te.types.some(cr=>!fr.has(cr.name)))continue}_e.push(Le)}}if(ht=_e,ht.length===0)break}let at;for(at of ht)if(at.params.length<=ut)return at;throw new TypeError("Signature not found (signature: "+($.name||"unnamed")+"("+D(rt,", ")+"))")}function w($,Z,H){return g($,Z,H).implementation}function m($,Z){const H=l(Z);if(H.test($))return $;const nt=H.conversionsTo;if(nt.length===0)throw new Error("There are no conversions to "+Z+" defined.");for(let st=0;st<nt.length;st++)if(l(nt[st].from).test($))return nt[st].convert($);throw new Error("Cannot convert "+$+" to "+Z)}function D($){let Z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:",";return $.map(H=>H.name).join(Z)}function v($){const Z=$.indexOf("...")===0,nt=(Z?$.length>3?$.slice(3):"any":$).split("|").map(ut=>l(ut.trim()));let st=!1,rt=Z?"...":"";return{types:nt.map(function(ut){return st=ut.isAny||st,rt+=ut.name+"|",{name:ut.name,typeIndex:ut.index,test:ut.test,isAny:ut.isAny,conversion:null,conversionIndex:-1}}),name:rt.slice(0,-1),hasAny:st,hasConversion:!1,restParam:Z}}function E($){const Z=$.types.map(ct=>ct.name),H=K(Z);let nt=$.hasAny,st=$.name;const rt=H.map(function(ct){const ut=l(ct.from);return nt=ut.isAny||nt,st+="|"+ct.from,{name:ct.from,typeIndex:ut.index,test:ut.test,isAny:ut.isAny,conversion:ct,conversionIndex:ct.index}});return{types:$.types.concat(rt),name:st,hasAny:nt,hasConversion:rt.length>0,restParam:$.restParam}}function b($){return $.typeSet||($.typeSet=new Set,$.types.forEach(Z=>$.typeSet.add(Z.name))),$.typeSet}function N($){const Z=[];if(typeof $!="string")throw new TypeError("Signatures must be strings");const H=$.trim();if(H==="")return Z;const nt=H.split(",");for(let st=0;st<nt.length;++st){const rt=v(nt[st].trim());if(rt.restParam&&st!==nt.length-1)throw new SyntaxError('Unexpected rest parameter "'+nt[st]+'": only allowed for the last parameter');if(rt.types.length===0)return null;Z.push(rt)}return Z}function x($){const Z=It($);return Z?Z.restParam:!1}function F($){if(!$||$.types.length===0)return Ol;if($.types.length===1)return l($.types[0].name).test;if($.types.length===2){const Z=l($.types[0].name).test,H=l($.types[1].name).test;return function(st){return Z(st)||H(st)}}else{const Z=$.types.map(function(H){return l(H.name).test});return function(nt){for(let st=0;st<Z.length;st++)if(Z[st](nt))return!0;return!1}}}function M($){let Z,H,nt;if(x($)){Z=ne($).map(F);const st=Z.length,rt=F(It($)),ct=function(ut){for(let ht=st;ht<ut.length;ht++)if(!rt(ut[ht]))return!1;return!0};return function(ht){for(let at=0;at<Z.length;at++)if(!Z[at](ht[at]))return!1;return ct(ht)&&ht.length>=st+1}}else return $.length===0?function(rt){return rt.length===0}:$.length===1?(H=F($[0]),function(rt){return H(rt[0])&&rt.length===1}):$.length===2?(H=F($[0]),nt=F($[1]),function(rt){return H(rt[0])&&nt(rt[1])&&rt.length===2}):(Z=$.map(F),function(rt){for(let ct=0;ct<Z.length;ct++)if(!Z[ct](rt[ct]))return!1;return rt.length===Z.length})}function S($,Z){return Z<$.length?$[Z]:x($)?It($):null}function O($,Z){const H=S($,Z);return H?b(H):new Set}function C($){return $.conversion===null||$.conversion===void 0}function T($,Z){const H=new Set;return $.forEach(nt=>{const st=O(nt.params,Z);let rt;for(rt of st)H.add(rt)}),H.has("any")?["any"]:Array.from(H)}function L($,Z,H){let nt,st;const rt=$||"unnamed";let ct=H,ut;for(ut=0;ut<Z.length;ut++){const te=[];if(ct.forEach(_e=>{const Le=S(_e.params,ut),Te=F(Le);(ut<_e.params.length||x(_e.params))&&Te(Z[ut])&&te.push(_e)}),te.length===0){if(st=T(ct,ut),st.length>0){const _e=c(Z[ut]);return nt=new TypeError("Unexpected type of argument in function "+rt+" (expected: "+st.join(" or ")+", actual: "+_e.join(" | ")+", index: "+ut+")"),nt.data={category:"wrongType",fn:rt,index:ut,actual:_e,expected:st},nt}}else ct=te}const ht=ct.map(function(te){return x(te.params)?1/0:te.params.length});if(Z.length<Math.min.apply(null,ht))return st=T(ct,ut),nt=new TypeError("Too few arguments in function "+rt+" (expected: "+st.join(" or ")+", index: "+Z.length+")"),nt.data={category:"tooFewArgs",fn:rt,index:Z.length,expected:st},nt;const at=Math.max.apply(null,ht);if(Z.length>at)return nt=new TypeError("Too many arguments in function "+rt+" (expected: "+at+", actual: "+Z.length+")"),nt.data={category:"tooManyArgs",fn:rt,index:Z.length,expectedLength:at},nt;const Ht=[];for(let te=0;te<Z.length;++te)Ht.push(c(Z[te]).join("|"));return nt=new TypeError('Arguments of type "'+Ht.join(", ")+'" do not match any of the defined signatures of function '+rt+"."),nt.data={category:"mismatch",actual:Ht},nt}function U($){let Z=n.length+1;for(let H=0;H<$.types.length;H++)C($.types[H])&&(Z=Math.min(Z,$.types[H].typeIndex));return Z}function k($){let Z=s+1;for(let H=0;H<$.types.length;H++)C($.types[H])||(Z=Math.min(Z,$.types[H].conversionIndex));return Z}function W($,Z){if($.hasAny){if(!Z.hasAny)return 1}else if(Z.hasAny)return-1;if($.restParam){if(!Z.restParam)return 1}else if(Z.restParam)return-1;if($.hasConversion){if(!Z.hasConversion)return 1}else if(Z.hasConversion)return-1;const H=U($)-U(Z);if(H<0)return-1;if(H>0)return 1;const nt=k($)-k(Z);return nt<0?-1:nt>0?1:0}function P($,Z){const H=$.params,nt=Z.params,st=It(H),rt=It(nt),ct=x(H),ut=x(nt);if(ct&&st.hasAny){if(!ut||!rt.hasAny)return 1}else if(ut&&rt.hasAny)return-1;let ht=0,at=0,Ht;for(Ht of H)Ht.hasAny&&++ht,Ht.hasConversion&&++at;let te=0,_e=0;for(Ht of nt)Ht.hasAny&&++te,Ht.hasConversion&&++_e;if(ht!==te)return ht-te;if(ct&&st.hasConversion){if(!ut||!rt.hasConversion)return 1}else if(ut&&rt.hasConversion)return-1;if(at!==_e)return at-_e;if(ct){if(!ut)return 1}else if(ut)return-1;const Le=(H.length-nt.length)*(ct?-1:1);if(Le!==0)return Le;const Te=[];let fr=0;for(let An=0;An<H.length;++An){const Kn=W(H[An],nt[An]);Te.push(Kn),fr+=Kn}if(fr!==0)return fr;let cr;for(cr of Te)if(cr!==0)return cr;return 0}function K($){if($.length===0)return[];const Z=$.map(l);$.length>1&&Z.sort((st,rt)=>st.index-rt.index);let H=Z[0].conversionsTo;if($.length===1)return H;H=H.concat([]);const nt=new Set($);for(let st=1;st<Z.length;++st){let rt;for(rt of Z[st].conversionsTo)nt.has(rt.from)||(H.push(rt),nt.add(rt.from))}return H}function G($,Z){let H=Z;if($.some(st=>st.hasConversion)){const st=x($),rt=$.map(V);H=function(){const ut=[],ht=st?arguments.length-1:arguments.length;for(let at=0;at<ht;at++)ut[at]=rt[at](arguments[at]);return st&&(ut[ht]=arguments[ht].map(rt[ht])),Z.apply(this,ut)}}let nt=H;if(x($)){const st=$.length-1;nt=function(){return H.apply(this,Nt(arguments,0,st).concat([Nt(arguments,st)]))}}return nt}function V($){let Z,H,nt,st;const rt=[],ct=[];switch($.types.forEach(function(ut){ut.conversion&&(rt.push(l(ut.conversion.from).test),ct.push(ut.conversion.convert))}),ct.length){case 0:return function(ht){return ht};case 1:return Z=rt[0],nt=ct[0],function(ht){return Z(ht)?nt(ht):ht};case 2:return Z=rt[0],H=rt[1],nt=ct[0],st=ct[1],function(ht){return Z(ht)?nt(ht):H(ht)?st(ht):ht};default:return function(ht){for(let at=0;at<ct.length;at++)if(rt[at](ht))return ct[at](ht);return ht}}}function tt($){function Z(H,nt,st){if(nt<H.length){const rt=H[nt];let ct=[];if(rt.restParam){const ut=rt.types.filter(C);ut.length<rt.types.length&&ct.push({types:ut,name:"..."+ut.map(ht=>ht.name).join("|"),hasAny:ut.some(ht=>ht.isAny),hasConversion:!1,restParam:!0}),ct.push(rt)}else ct=rt.types.map(function(ut){return{types:[ut],name:ut.name,hasAny:ut.isAny,hasConversion:ut.conversion,restParam:!1}});return Qt(ct,function(ut){return Z(H,nt+1,st.concat([ut]))})}else return[st]}return Z($,0,[])}function ft($,Z){const H=Math.max($.length,Z.length);for(let ut=0;ut<H;ut++){const ht=O($,ut),at=O(Z,ut);let Ht=!1,te;for(te of at)if(ht.has(te)){Ht=!0;break}if(!Ht)return!1}const nt=$.length,st=Z.length,rt=x($),ct=x(Z);return rt?ct?nt===st:st>=nt:ct?nt>=st:nt===st}function vt($){return $.map(Z=>Be(Z)?Ne(Z.referToSelf.callback):ur(Z)?Kt(Z.referTo.references,Z.referTo.callback):Z)}function lt($,Z,H){const nt=[];let st;for(st of $){let rt=H[st];if(typeof rt!="number")throw new TypeError('No definition for referenced signature "'+st+'"');if(rt=Z[rt],typeof rt!="function")return!1;nt.push(rt)}return nt}function yt($,Z,H){const nt=vt($),st=new Array(nt.length).fill(!1);let rt=!0;for(;rt;){rt=!1;let ct=!0;for(let ut=0;ut<nt.length;++ut){if(st[ut])continue;const ht=nt[ut];if(Be(ht))nt[ut]=ht.referToSelf.callback(H),nt[ut].referToSelf=ht.referToSelf,st[ut]=!0,ct=!1;else if(ur(ht)){const at=lt(ht.referTo.references,nt,Z);at?(nt[ut]=ht.referTo.callback.apply(this,at),nt[ut].referTo=ht.referTo,st[ut]=!0,ct=!1):rt=!0}}if(ct&&rt)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return nt}function bt($){const Z=/\bthis(\(|\.signatures\b)/;Object.keys($).forEach(H=>{const nt=$[H];if(Z.test(nt.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}function Bt($,Z){if(a.createCount++,Object.keys(Z).length===0)throw new SyntaxError("No signatures provided");a.warnAgainstDeprecatedThis&&bt(Z);const H=[],nt=[],st={},rt=[];let ct;for(ct in Z){if(!Object.prototype.hasOwnProperty.call(Z,ct))continue;const Yt=N(ct);if(!Yt)continue;H.forEach(function(Cn){if(ft(Cn,Yt))throw new TypeError('Conflicting signatures "'+D(Cn)+'" and "'+D(Yt)+'".')}),H.push(Yt);const je=nt.length;nt.push(Z[ct]);const lu=Yt.map(E);let xi;for(xi of tt(lu)){const Cn=D(xi);rt.push({params:xi,name:Cn,fn:je}),xi.every(_o=>!_o.hasConversion)&&(st[Cn]=je)}}rt.sort(P);const ut=yt(nt,st,Hn);let ht;for(ht in st)Object.prototype.hasOwnProperty.call(st,ht)&&(st[ht]=ut[st[ht]]);const at=[],Ht=new Map;for(ht of rt)Ht.has(ht.name)||(ht.fn=ut[ht.fn],at.push(ht),Ht.set(ht.name,ht));const te=at[0]&&at[0].params.length<=2&&!x(at[0].params),_e=at[1]&&at[1].params.length<=2&&!x(at[1].params),Le=at[2]&&at[2].params.length<=2&&!x(at[2].params),Te=at[3]&&at[3].params.length<=2&&!x(at[3].params),fr=at[4]&&at[4].params.length<=2&&!x(at[4].params),cr=at[5]&&at[5].params.length<=2&&!x(at[5].params),An=te&&_e&&Le&&Te&&fr&&cr;for(let Yt=0;Yt<at.length;++Yt)at[Yt].test=M(at[Yt].params);const Kn=te?F(at[0].params[0]):wr,co=_e?F(at[1].params[0]):wr,ka=Le?F(at[2].params[0]):wr,Ua=Te?F(at[3].params[0]):wr,Wa=fr?F(at[4].params[0]):wr,ja=cr?F(at[5].params[0]):wr,ho=te?F(at[0].params[1]):wr,Ya=_e?F(at[1].params[1]):wr,Za=Le?F(at[2].params[1]):wr,Ga=Te?F(at[3].params[1]):wr,Qi=fr?F(at[4].params[1]):wr,Ka=cr?F(at[5].params[1]):wr;for(let Yt=0;Yt<at.length;++Yt)at[Yt].implementation=G(at[Yt].params,at[Yt].fn);const ts=te?at[0].implementation:ai,Ha=_e?at[1].implementation:ai,Ja=Le?at[2].implementation:ai,Xa=Te?at[3].implementation:ai,Va=fr?at[4].implementation:ai,Qa=cr?at[5].implementation:ai,tu=te?at[0].params.length:-1,eu=_e?at[1].params.length:-1,ru=Le?at[2].params.length:-1,po=Te?at[3].params.length:-1,nu=fr?at[4].params.length:-1,iu=cr?at[5].params.length:-1,su=An?6:0,ou=at.length,au=at.map(Yt=>Yt.test),uu=at.map(Yt=>Yt.implementation),Ei=function(){for(let je=su;je<ou;je++)if(au[je](arguments))return uu[je].apply(this,arguments);return a.onMismatch($,arguments,at)};function Hn(Yt,je){return arguments.length===tu&&Kn(Yt)&&ho(je)?ts.apply(this,arguments):arguments.length===eu&&co(Yt)&&Ya(je)?Ha.apply(this,arguments):arguments.length===ru&&ka(Yt)&&Za(je)?Ja.apply(this,arguments):arguments.length===po&&Ua(Yt)&&Ga(je)?Xa.apply(this,arguments):arguments.length===nu&&Wa(Yt)&&Qi(je)?Va.apply(this,arguments):arguments.length===iu&&ja(Yt)&&Ka(je)?Qa.apply(this,arguments):Ei.apply(this,arguments)}try{Object.defineProperty(Hn,"name",{value:$})}catch{}return Hn.signatures=st,Hn._typedFunctionData={signatures:at,signatureMap:Ht},Hn}function Et($,Z,H){throw L($,Z,H)}function ne($){return Nt($,0,$.length-1)}function It($){return $[$.length-1]}function Nt($,Z,H){return Array.prototype.slice.call($,Z,H)}function se($,Z){for(let H=0;H<$.length;H++)if(Z($[H]))return $[H]}function Qt($,Z){return Array.prototype.concat.apply([],$.map(Z))}function qt(){const $=ne(arguments).map(H=>D(N(H))),Z=It(arguments);if(typeof Z!="function")throw new TypeError("Callback function expected as last argument");return Kt($,Z)}function Kt($,Z){return{referTo:{references:$,callback:Z}}}function Ne($){if(typeof $!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:$}}}function ur($){return $&&typeof $.referTo=="object"&&Array.isArray($.referTo.references)&&typeof $.referTo.callback=="function"}function Be($){return $&&typeof $.referToSelf=="object"&&typeof $.referToSelf.callback=="function"}function rn($,Z){if(!$)return Z;if(Z&&Z!==$){const H=new Error("Function names do not match (expected: "+$+", actual: "+Z+")");throw H.data={actual:Z,expected:$},H}return $}function En($){let Z;for(const H in $)Object.prototype.hasOwnProperty.call($,H)&&(d($[H])||typeof $[H].signature=="string")&&(Z=rn(Z,$[H].name));return Z}function nn($,Z){let H;for(H in Z)if(Object.prototype.hasOwnProperty.call(Z,H)){if(H in $&&Z[H]!==$[H]){const nt=new Error('Signature "'+H+'" is defined twice');throw nt.data={signature:H,sourceFunction:Z[H],destFunction:$[H]},nt}$[H]=Z[H]}}const lr=a;a=function($){const Z=typeof $=="string",H=Z?1:0;let nt=Z?$:"";const st={};for(let rt=H;rt<arguments.length;++rt){const ct=arguments[rt];let ut={},ht;if(typeof ct=="function"?(ht=ct.name,typeof ct.signature=="string"?ut[ct.signature]=ct:d(ct)&&(ut=ct.signatures)):i(ct)&&(ut=ct,Z||(ht=En(ct))),Object.keys(ut).length===0){const at=new TypeError("Argument to 'typed' at index "+rt+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw at.data={index:rt,argument:ct},at}Z||(nt=rn(nt,ht)),nn(st,ut)}return Bt(nt||"",st)},a.create=Ll,a.createCount=lr.createCount,a.onMismatch=Et,a.throwMismatchError=Et,a.createError=L,a.clear=h,a.clearConversions=p,a.addTypes=f,a._findType=l,a.referTo=qt,a.referToSelf=Ne,a.convert=m,a.findSignature=g,a.find=w,a.isTypedFunction=d,a.warnAgainstDeprecatedThis=!0,a.addType=function($,Z){let H="any";Z!==!1&&r.has("Object")&&(H="Object"),a.addTypes([$],H)};function xn($){if(!$||typeof $.from!="string"||typeof $.to!="string"||typeof $.convert!="function")throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if($.to===$.from)throw new SyntaxError('Illegal to define conversion from "'+$.from+'" to itself.')}return a.addConversion=function($){xn($);const Z=l($.to);if(Z.conversionsTo.every(function(H){return H.from!==$.from}))Z.conversionsTo.push({from:$.from,convert:$.convert,index:s++});else throw new Error('There is already a conversion from "'+$.from+'" to "'+Z.name+'"')},a.addConversions=function($){$.forEach(a.addConversion)},a.removeConversion=function($){xn($);const Z=l($.to),H=se(Z.conversionsTo,st=>st.from===$.from);if(!H)throw new Error("Attempt to remove nonexistent conversion from "+$.from+" to "+$.to);if(H.convert!==$.convert)throw new Error("Conversion to remove does not match existing conversion");const nt=Z.conversionsTo.indexOf(H);Z.conversionsTo.splice(nt,1)},a.resolve=function($,Z){if(!d($))throw new TypeError($l);const H=$._typedFunctionData.signatures;for(let nt=0;nt<H.length;++nt)if(H[nt].test(Z))return H[nt];return null},a}var Rl=Ll();function de(i){return typeof i=="boolean"?!0:isFinite(i)?i===Math.round(i):!1}function oa(i,t,e){var r={2:"0b",8:"0o",16:"0x"},n=r[t],s="";if(e){if(e<1)throw new Error("size must be in greater than 0");if(!de(e))throw new Error("size must be an integer");if(i>2**(e-1)-1||i<-(2**(e-1)))throw new Error("Value must be in range [-2^".concat(e-1,", 2^").concat(e-1,"-1]"));if(!de(i))throw new Error("Value must be an integer");i<0&&(i=i+2**e),s="i".concat(e)}var a="";return i<0&&(i=-i,a="-"),"".concat(a).concat(n).concat(i.toString(t)).concat(s)}function aa(i,t){if(typeof t=="function")return t(i);if(i===1/0)return"Infinity";if(i===-1/0)return"-Infinity";if(isNaN(i))return"NaN";var{notation:e,precision:r,wordSize:n}=Pl(t);switch(e){case"fixed":return gd(i,r);case"exponential":return zl(i,r);case"engineering":return md(i,r);case"bin":return oa(i,2,n);case"oct":return oa(i,8,n);case"hex":return oa(i,16,n);case"auto":return vd(i,r,t).replace(/((\.\d*?)(0+))($|e)/,function(){var s=arguments[2],a=arguments[4];return s!=="."?s+a:a});default:throw new Error('Unknown notation "'+e+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function Pl(i){var t="auto",e,r;if(i!==void 0)if(le(i))e=i;else if(Ee(i))e=i.toNumber();else if(sa(i))i.precision!==void 0&&(e=ql(i.precision,()=>{throw new Error('Option "precision" must be a number or BigNumber')})),i.wordSize!==void 0&&(r=ql(i.wordSize,()=>{throw new Error('Option "wordSize" must be a number or BigNumber')})),i.notation&&(t=i.notation);else throw new Error("Unsupported type of options, number, BigNumber, or object expected");return{notation:t,precision:e,wordSize:r}}function bs(i){var t=String(i).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!t)throw new SyntaxError("Invalid number "+i);var e=t[1],r=t[2],n=parseFloat(t[4]||"0"),s=r.indexOf(".");n+=s!==-1?s-1:r.length-1;var a=r.replace(".","").replace(/^0*/,function(l){return n-=l.length,""}).replace(/0*$/,"").split("").map(function(l){return parseInt(l)});return a.length===0&&(a.push(0),n++),{sign:e,coefficients:a,exponent:n}}function md(i,t){if(isNaN(i)||!isFinite(i))return String(i);var e=bs(i),r=Es(e,t),n=r.exponent,s=r.coefficients,a=n%3===0?n:n<0?n-3-n%3:n-n%3;if(le(t))for(;t>s.length||n-a+1>s.length;)s.push(0);else for(var l=Math.abs(n-a)-(s.length-1),f=0;f<l;f++)s.push(0);for(var h=Math.abs(n-a),p=1;h>0;)p++,h--;var c=s.slice(p).join(""),d=le(t)&&c.length||c.match(/[1-9]/)?"."+c:"",g=s.slice(0,p).join("")+d+"e"+(n>=0?"+":"")+a.toString();return r.sign+g}function gd(i,t){if(isNaN(i)||!isFinite(i))return String(i);var e=bs(i),r=typeof t=="number"?Es(e,e.exponent+1+t):e,n=r.coefficients,s=r.exponent+1,a=s+(t||0);return n.length<a&&(n=n.concat(ui(a-n.length))),s<0&&(n=ui(-s+1).concat(n),s=1),s<n.length&&n.splice(s,0,s===0?"0.":"."),r.sign+n.join("")}function zl(i,t){if(isNaN(i)||!isFinite(i))return String(i);var e=bs(i),r=t?Es(e,t):e,n=r.coefficients,s=r.exponent;n.length<t&&(n=n.concat(ui(t-n.length)));var a=n.shift();return r.sign+a+(n.length>0?"."+n.join(""):"")+"e"+(s>=0?"+":"")+s}function vd(i,t,e){if(isNaN(i)||!isFinite(i))return String(i);var r=kl(e==null?void 0:e.lowerExp,-3),n=kl(e==null?void 0:e.upperExp,5),s=bs(i),a=t?Es(s,t):s;if(a.exponent<r||a.exponent>=n)return zl(i,t);var l=a.coefficients,f=a.exponent;l.length<t&&(l=l.concat(ui(t-l.length))),l=l.concat(ui(f-l.length+1+(l.length<t?t-l.length:0))),l=ui(-f).concat(l);var h=f>0?f:0;return h<l.length-1&&l.splice(h+1,0,"."),a.sign+l.join("")}function Es(i,t){for(var e={sign:i.sign,coefficients:i.coefficients,exponent:i.exponent},r=e.coefficients;t<=0;)r.unshift(0),e.exponent++,t++;if(r.length>t){var n=r.splice(t,r.length-t);if(n[0]>=5){var s=t-1;for(r[s]++;r[s]===10;)r.pop(),s===0&&(r.unshift(0),e.exponent++,s++),s--,r[s]++}}return e}function ui(i){for(var t=[],e=0;e<i;e++)t.push(0);return t}function wd(i){return i.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length}var yd=Number.EPSILON||2220446049250313e-31;function Un(i,t,e){if(e==null)return i===t;if(i===t)return!0;if(isNaN(i)||isNaN(t))return!1;if(isFinite(i)&&isFinite(t)){var r=Math.abs(i-t);return r<=yd?!0:r<=Math.max(Math.abs(i),Math.abs(t))*e}return!1}function ql(i,t){if(le(i))return i;if(Ee(i))return i.toNumber();t()}function kl(i,t){return le(i)?i:Ee(i)?i.toNumber():t}function ua(i,t,e){var r=i.constructor,n=new r(2),s="";if(e){if(e<1)throw new Error("size must be in greater than 0");if(!de(e))throw new Error("size must be an integer");if(i.greaterThan(n.pow(e-1).sub(1))||i.lessThan(n.pow(e-1).mul(-1)))throw new Error("Value must be in range [-2^".concat(e-1,", 2^").concat(e-1,"-1]"));if(!i.isInteger())throw new Error("Value must be an integer");i.lessThan(0)&&(i=i.add(n.pow(e))),s="i".concat(e)}switch(t){case 2:return"".concat(i.toBinary()).concat(s);case 8:return"".concat(i.toOctal()).concat(s);case 16:return"".concat(i.toHexadecimal()).concat(s);default:throw new Error("Base ".concat(t," not supported "))}}function Dd(i,t){if(typeof t=="function")return t(i);if(!i.isFinite())return i.isNaN()?"NaN":i.gt(0)?"Infinity":"-Infinity";var{notation:e,precision:r,wordSize:n}=Pl(t);switch(e){case"fixed":return Ed(i,r);case"exponential":return Ul(i,r);case"engineering":return bd(i,r);case"bin":return ua(i,2,n);case"oct":return ua(i,8,n);case"hex":return ua(i,16,n);case"auto":{var s=Wl(t==null?void 0:t.lowerExp,-3),a=Wl(t==null?void 0:t.upperExp,5);if(i.isZero())return"0";var l,f=i.toSignificantDigits(r),h=f.e;return h>=s&&h<a?l=f.toFixed():l=Ul(i,r),l.replace(/((\.\d*?)(0+))($|e)/,function(){var p=arguments[2],c=arguments[4];return p!=="."?p+c:c})}default:throw new Error('Unknown notation "'+e+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function bd(i,t){var e=i.e,r=e%3===0?e:e<0?e-3-e%3:e-e%3,n=i.mul(Math.pow(10,-r)),s=n.toPrecision(t);if(s.indexOf("e")!==-1){var a=i.constructor;s=new a(s).toFixed()}return s+"e"+(e>=0?"+":"")+r.toString()}function Ul(i,t){return t!==void 0?i.toExponential(t-1):i.toExponential()}function Ed(i,t){return i.toFixed(t)}function Wl(i,t){return le(i)?i:Ee(i)?i.toNumber():t}function oe(i,t){var e=xd(i,t);return t&&typeof t=="object"&&"truncate"in t&&e.length>t.truncate?e.substring(0,t.truncate-3)+"...":e}function xd(i,t){if(typeof i=="number")return aa(i,t);if(Ee(i))return Dd(i,t);if(Ad(i))return!t||t.fraction!=="decimal"?i.s*i.n+"/"+i.d:i.toString();if(Array.isArray(i))return Zl(i,t);if(Yr(i))return jl(i);if(typeof i=="function")return i.syntax?String(i.syntax):"function";if(i&&typeof i=="object"){if(typeof i.format=="function")return i.format(t);if(i&&i.toString(t)!=={}.toString())return i.toString(t);var e=Object.keys(i).map(r=>jl(r)+": "+oe(i[r],t));return"{"+e.join(", ")+"}"}return String(i)}function jl(i){for(var t=String(i),e="",r=0;r<t.length;){var n=t.charAt(r);e+=n in Yl?Yl[n]:n,r++}return'"'+e+'"'}var Yl={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"};function Zl(i,t){if(Array.isArray(i)){for(var e="[",r=i.length,n=0;n<r;n++)n!==0&&(e+=", "),e+=Zl(i[n],t);return e+="]",e}else return oe(i,t)}function Ad(i){return i&&typeof i=="object"&&typeof i.s=="number"&&typeof i.n=="number"&&typeof i.d=="number"||!1}function Gt(i,t,e){if(!(this instanceof Gt))throw new SyntaxError("Constructor must be called with the new operator");this.actual=i,this.expected=t,this.relation=e,this.message="Dimension mismatch ("+(Array.isArray(i)?"["+i.join(", ")+"]":i)+" "+(this.relation||"!=")+" "+(Array.isArray(t)?"["+t.join(", ")+"]":t)+")",this.stack=new Error().stack}Gt.prototype=new RangeError,Gt.prototype.constructor=RangeError,Gt.prototype.name="DimensionError",Gt.prototype.isDimensionError=!0;function mn(i,t,e){if(!(this instanceof mn))throw new SyntaxError("Constructor must be called with the new operator");this.index=i,arguments.length<3?(this.min=0,this.max=t):(this.min=t,this.max=e),this.min!==void 0&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":this.max!==void 0&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=new Error().stack}mn.prototype=new RangeError,mn.prototype.constructor=RangeError,mn.prototype.name="IndexError",mn.prototype.isIndexError=!0;function Fe(i){for(var t=[];Array.isArray(i);)t.push(i.length),i=i[0];return t}function Gl(i,t,e){var r,n=i.length;if(n!==t[e])throw new Gt(n,t[e]);if(e<t.length-1){var s=e+1;for(r=0;r<n;r++){var a=i[r];if(!Array.isArray(a))throw new Gt(t.length-1,t.length,"<");Gl(i[r],t,s)}}else for(r=0;r<n;r++)if(Array.isArray(i[r]))throw new Gt(t.length+1,t.length,">")}function Kl(i,t){var e=t.length===0;if(e){if(Array.isArray(i))throw new Gt(i.length,0)}else Gl(i,t,0)}function we(i,t){if(i!==void 0){if(!le(i)||!de(i))throw new TypeError("Index must be an integer (value: "+i+")");if(i<0||typeof t=="number"&&i>=t)throw new mn(i,t)}}function la(i,t,e){if(!Array.isArray(t))throw new TypeError("Array expected");if(t.length===0)throw new Error("Resizing to scalar is not supported");t.forEach(function(n){if(!le(n)||!de(n)||n<0)throw new TypeError("Invalid size, must contain positive integers (size: "+oe(t)+")")}),(le(i)||Ee(i))&&(i=[i]);var r=e!==void 0?e:0;return fa(i,t,0,r),i}function fa(i,t,e,r){var n,s,a=i.length,l=t[e],f=Math.min(a,l);if(i.length=l,e<t.length-1){var h=e+1;for(n=0;n<f;n++)s=i[n],Array.isArray(s)||(s=[s],i[n]=s),fa(s,t,h,r);for(n=f;n<l;n++)s=[],i[n]=s,fa(s,t,h,r)}else{for(n=0;n<f;n++)for(;Array.isArray(i[n]);)i[n]=i[n][0];for(n=f;n<l;n++)i[n]=r}}function ca(i,t){var e=pa(i),r=e.length;if(!Array.isArray(i)||!Array.isArray(t))throw new TypeError("Array expected");if(t.length===0)throw new Gt(0,r,"!=");t=ha(t,r);var n=Hl(t);if(r!==n)throw new Gt(n,r,"!=");try{return Cd(e,t)}catch(s){throw s instanceof Gt?new Gt(n,r,"!="):s}}function ha(i,t){var e=Hl(i),r=i.slice(),n=-1,s=i.indexOf(n),a=i.indexOf(n,s+1)>=0;if(a)throw new Error("More than one wildcard in sizes");var l=s>=0,f=t%e===0;if(l)if(f)r[s]=-t/e;else throw new Error("Could not replace wildcard, since "+t+" is no multiple of "+-e);return r}function Hl(i){return i.reduce((t,e)=>t*e,1)}function Cd(i,t){for(var e=i,r,n=t.length-1;n>0;n--){var s=t[n];r=[];for(var a=e.length/s,l=0;l<a;l++)r.push(e.slice(l*s,(l+1)*s));e=r}return e}function Jl(i,t,e,r){var n=r||Fe(i);if(e)for(var s=0;s<e;s++)i=[i],n.unshift(1);for(i=Xl(i,t,0);n.length<t;)n.push(1);return i}function Xl(i,t,e){var r,n;if(Array.isArray(i)){var s=e+1;for(r=0,n=i.length;r<n;r++)i[r]=Xl(i[r],t,s)}else for(var a=e;a<t;a++)i=[i];return i}function pa(i){if(!Array.isArray(i))return i;var t=[];return i.forEach(function e(r){Array.isArray(r)?r.forEach(e):t.push(r)}),t}function xs(i,t){for(var e,r=0,n=0;n<i.length;n++){var s=i[n],a=Array.isArray(s);if(n===0&&a&&(r=s.length),a&&s.length!==r)return;var l=a?xs(s,t):t(s);if(e===void 0)e=l;else if(e!==l)return"mixed"}return e}function Vl(i,t,e,r){if(r<e){if(i.length!==t.length)throw new Gt(i.length,t.length);for(var n=[],s=0;s<i.length;s++)n[s]=Vl(i[s],t[s],e,r+1);return n}else return i.concat(t)}function Ql(){var i=Array.prototype.slice.call(arguments,0,-1),t=Array.prototype.slice.call(arguments,-1);if(i.length===1)return i[0];if(i.length>1)return i.slice(1).reduce(function(e,r){return Vl(e,r,t,0)},i[0]);throw new Error("Wrong number of arguments in function concat")}function Fd(){for(var i=arguments.length,t=new Array(i),e=0;e<i;e++)t[e]=arguments[e];for(var r=t.map(d=>d.length),n=Math.max(...r),s=new Array(n).fill(null),a=0;a<t.length;a++)for(var l=t[a],f=r[a],h=0;h<f;h++){var p=n-f+h;l[h]>s[p]&&(s[p]=l[h])}for(var c=0;c<t.length;c++)As(t[c],s);return s}function As(i,t){for(var e=t.length,r=i.length,n=0;n<r;n++){var s=e-r+n;if(i[n]<t[s]&&i[n]>1||i[n]>t[s])throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(i,") not possible to broadcast dimension ").concat(r," with size ").concat(i[n]," to size ").concat(t[s]))}}function tf(i,t){var e=Fe(i);if(oi(e,t))return i;As(e,t);var r=Fd(e,t),n=r.length,s=[...Array(n-e.length).fill(1),...e],a=Nd(i);e.length<n&&(a=ca(a,s),e=Fe(a));for(var l=0;l<n;l++)e[l]<r[l]&&(a=Md(a,r[l],l),e=Fe(a));return a}function Md(i,t,e){return Ql(...Array(t).fill(i),e)}function Nd(i){return Ds([],i)}function mt(i,t,e,r){function n(s){var a=pd(s,t.map(Td));return Sd(i,t,s),e(a)}return n.isFactory=!0,n.fn=i,n.dependencies=t.slice().sort(),r&&(n.meta=r),n}function Sd(i,t,e){var r=t.filter(s=>!Bd(s)).every(s=>e[s]!==void 0);if(!r){var n=t.filter(s=>e[s]===void 0);throw new Error('Cannot create function "'.concat(i,'", ')+"some dependencies are missing: ".concat(n.map(s=>'"'.concat(s,'"')).join(", "),"."))}}function Bd(i){return i&&i[0]==="?"}function Td(i){return i&&i[0]==="?"?i.slice(1):i}function Id(i,t){if(rf(i)&&ef(i,t))return i[t];throw typeof i[t]=="function"&&Ld(i,t)?new Error('Cannot access method "'+t+'" as a property'):new Error('No access to property "'+t+'"')}function Od(i,t,e){if(rf(i)&&ef(i,t))return i[t]=e,e;throw new Error('No access to property "'+t+'"')}function $d(i,t){return t in i}function ef(i,t){return!i||typeof i!="object"?!1:Ui(Rd,t)?!0:!(t in Object.prototype||t in Function.prototype)}function Ld(i,t){return i==null||typeof i[t]!="function"||Ui(i,t)&&Object.getPrototypeOf&&t in Object.getPrototypeOf(i)?!1:Ui(Pd,t)?!0:!(t in Object.prototype||t in Function.prototype)}function rf(i){return typeof i=="object"&&i&&i.constructor===Object}var Rd={length:!0,name:!0},Pd={toString:!0,valueOf:!0,toLocaleString:!0};class zd{constructor(t){this.wrappedObject=t,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).values()}get(t){return Id(this.wrappedObject,t)}set(t,e){return Od(this.wrappedObject,t,e),this}has(t){return $d(this.wrappedObject,t)}entries(){return qd(this.keys(),t=>[t,this.get(t)])}forEach(t){for(var e of this.keys())t(this.get(e),e,this)}delete(t){delete this.wrappedObject[t]}clear(){for(var t of this.keys())this.delete(t)}get size(){return Object.keys(this.wrappedObject).length}}function qd(i,t){return{next:()=>{var e=i.next();return e.done?e:{value:t(e.value),done:!1}}}}function kd(i){return i?i instanceof Map||i instanceof zd||typeof i.set=="function"&&typeof i.get=="function"&&typeof i.keys=="function"&&typeof i.has=="function":!1}var nf=function(){return nf=Rl.create,Rl},Ud=["?BigNumber","?Complex","?DenseMatrix","?Fraction"],Wd=mt("typed",Ud,function(t){var{BigNumber:e,Complex:r,DenseMatrix:n,Fraction:s}=t,a=nf();return a.clear(),a.addTypes([{name:"number",test:le},{name:"Complex",test:Sl},{name:"BigNumber",test:Ee},{name:"Fraction",test:Bl},{name:"Unit",test:Tl},{name:"identifier",test:l=>Yr&&/^(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(l)},{name:"string",test:Yr},{name:"Chain",test:cd},{name:"Array",test:ve},{name:"Matrix",test:ce},{name:"DenseMatrix",test:Pp},{name:"SparseMatrix",test:zp},{name:"Range",test:qp},{name:"Index",test:ia},{name:"boolean",test:kp},{name:"ResultSet",test:Up},{name:"Help",test:Wp},{name:"function",test:jp},{name:"Date",test:Yp},{name:"RegExp",test:Zp},{name:"null",test:Gp},{name:"undefined",test:Kp},{name:"AccessorNode",test:Hp},{name:"ArrayNode",test:Jp},{name:"AssignmentNode",test:Xp},{name:"BlockNode",test:Vp},{name:"ConditionalNode",test:Qp},{name:"ConstantNode",test:td},{name:"FunctionNode",test:rd},{name:"FunctionAssignmentNode",test:ed},{name:"IndexNode",test:nd},{name:"Node",test:id},{name:"ObjectNode",test:sd},{name:"OperatorNode",test:od},{name:"ParenthesisNode",test:ad},{name:"RangeNode",test:ud},{name:"RelationalNode",test:ld},{name:"SymbolNode",test:fd},{name:"Map",test:kd},{name:"Object",test:sa}]),a.addConversions([{from:"number",to:"BigNumber",convert:function(f){if(e||da(f),wd(f)>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+f+"). Use function bignumber(x) to convert to BigNumber.");return new e(f)}},{from:"number",to:"Complex",convert:function(f){return r||Cs(f),new r(f,0)}},{from:"BigNumber",to:"Complex",convert:function(f){return r||Cs(f),new r(f.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(f){throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(f){return r||Cs(f),new r(f.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(f){s||_a(f);var h=new s(f);if(h.valueOf()!==f)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+f+"). Use function fraction(x) to convert to Fraction.");return h}},{from:"string",to:"number",convert:function(f){var h=Number(f);if(isNaN(h))throw new Error('Cannot convert "'+f+'" to a number');return h}},{from:"string",to:"BigNumber",convert:function(f){e||da(f);try{return new e(f)}catch{throw new Error('Cannot convert "'+f+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(f){s||_a(f);try{return new s(f)}catch{throw new Error('Cannot convert "'+f+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(f){r||Cs(f);try{return new r(f)}catch{throw new Error('Cannot convert "'+f+'" to Complex')}}},{from:"boolean",to:"number",convert:function(f){return+f}},{from:"boolean",to:"BigNumber",convert:function(f){return e||da(f),new e(+f)}},{from:"boolean",to:"Fraction",convert:function(f){return s||_a(f),new s(+f)}},{from:"boolean",to:"string",convert:function(f){return String(f)}},{from:"Array",to:"Matrix",convert:function(f){return n||jd(),new n(f)}},{from:"Matrix",to:"Array",convert:function(f){return f.valueOf()}}]),a.onMismatch=(l,f,h)=>{var p=a.createError(l,f,h);if(["wrongType","mismatch"].includes(p.data.category)&&f.length===1&&ki(f[0])&&h.some(d=>!d.params.includes(","))){var c=new TypeError("Function '".concat(l,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(l,")'."));throw c.data=p.data,c}throw p},a.onMismatch=(l,f,h)=>{var p=a.createError(l,f,h);if(["wrongType","mismatch"].includes(p.data.category)&&f.length===1&&ki(f[0])&&h.some(d=>!d.params.includes(","))){var c=new TypeError("Function '".concat(l,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(l,")'."));throw c.data=p.data,c}throw p},a});function da(i){throw new Error("Cannot convert value ".concat(i," into a BigNumber: no class 'BigNumber' provided"))}function Cs(i){throw new Error("Cannot convert value ".concat(i," into a Complex number: no class 'Complex' provided"))}function jd(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}function _a(i){throw new Error("Cannot convert value ".concat(i," into a Fraction, no class 'Fraction' provided."))}/*!
|
35
35
|
* decimal.js v10.4.3
|
36
36
|
* An arbitrary-precision Decimal type for JavaScript.
|
37
37
|
* https://github.com/MikeMcl/decimal.js
|
38
38
|
* Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
|
39
39
|
* MIT Licence
|
40
|
-
*/var li=9e15,gn=1e9,ma="0123456789abcdef",Fs="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Ms="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",ga={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-li,maxE:li,crypto:!1},nf,Vr,St=!0,Ns="[DecimalError] ",vn=Ns+"Invalid argument: ",sf=Ns+"Precision limit exceeded",of=Ns+"crypto unavailable",af="[object Decimal]",Ue=Math.floor,Ne=Math.pow,Yd=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Zd=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Gd=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,uf=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Or=1e7,xt=7,Kd=9007199254740991,Hd=Fs.length-1,va=Ms.length-1,it={toStringTag:af};it.absoluteValue=it.abs=function(){var i=new this.constructor(this);return i.s<0&&(i.s=1),Dt(i)},it.ceil=function(){return Dt(new this.constructor(this),this.e+1,2)},it.clampedTo=it.clamp=function(i,t){var e,r=this,n=r.constructor;if(i=new n(i),t=new n(t),!i.s||!t.s)return new n(NaN);if(i.gt(t))throw Error(vn+t);return e=r.cmp(i),e<0?i:r.cmp(t)>0?t:new n(r)},it.comparedTo=it.cmp=function(i){var t,e,r,n,s=this,a=s.d,l=(i=new s.constructor(i)).d,f=s.s,h=i.s;if(!a||!l)return!f||!h?NaN:f!==h?f:a===l?0:!a^f<0?1:-1;if(!a[0]||!l[0])return a[0]?f:l[0]?-h:0;if(f!==h)return f;if(s.e!==i.e)return s.e>i.e^f<0?1:-1;for(r=a.length,n=l.length,t=0,e=r<n?r:n;t<e;++t)if(a[t]!==l[t])return a[t]>l[t]^f<0?1:-1;return r===n?0:r>n^f<0?1:-1},it.cosine=it.cos=function(){var i,t,e=this,r=e.constructor;return e.d?e.d[0]?(i=r.precision,t=r.rounding,r.precision=i+Math.max(e.e,e.sd())+xt,r.rounding=1,e=Jd(r,df(r,e)),r.precision=i,r.rounding=t,Dt(Vr==2||Vr==3?e.neg():e,i,t,!0)):new r(1):new r(NaN)},it.cubeRoot=it.cbrt=function(){var i,t,e,r,n,s,a,l,f,h,p=this,c=p.constructor;if(!p.isFinite()||p.isZero())return new c(p);for(St=!1,s=p.s*Ne(p.s*p,1/3),!s||Math.abs(s)==1/0?(e=Pe(p.d),i=p.e,(s=(i-e.length+1)%3)&&(e+=s==1||s==-2?"0":"00"),s=Ne(e,1/3),i=Ue((i+1)/3)-(i%3==(i<0?-1:2)),s==1/0?e="5e"+i:(e=s.toExponential(),e=e.slice(0,e.indexOf("e")+1)+i),r=new c(e),r.s=p.s):r=new c(s.toString()),a=(i=c.precision)+3;;)if(l=r,f=l.times(l).times(l),h=f.plus(p),r=ae(h.plus(p).times(l),h.plus(f),a+2,1),Pe(l.d).slice(0,a)===(e=Pe(r.d)).slice(0,a))if(e=e.slice(a-3,a+1),e=="9999"||!n&&e=="4999"){if(!n&&(Dt(l,i+1,0),l.times(l).times(l).eq(p))){r=l;break}a+=4,n=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(Dt(r,i+1,1),t=!r.times(r).times(r).eq(p));break}return St=!0,Dt(r,i,c.rounding,t)},it.decimalPlaces=it.dp=function(){var i,t=this.d,e=NaN;if(t){if(i=t.length-1,e=(i-Ue(this.e/xt))*xt,i=t[i],i)for(;i%10==0;i/=10)e--;e<0&&(e=0)}return e},it.dividedBy=it.div=function(i){return ae(this,new this.constructor(i))},it.dividedToIntegerBy=it.divToInt=function(i){var t=this,e=t.constructor;return Dt(ae(t,new e(i),0,1,1),e.precision,e.rounding)},it.equals=it.eq=function(i){return this.cmp(i)===0},it.floor=function(){return Dt(new this.constructor(this),this.e+1,3)},it.greaterThan=it.gt=function(i){return this.cmp(i)>0},it.greaterThanOrEqualTo=it.gte=function(i){var t=this.cmp(i);return t==1||t===0},it.hyperbolicCosine=it.cosh=function(){var i,t,e,r,n,s=this,a=s.constructor,l=new a(1);if(!s.isFinite())return new a(s.s?1/0:NaN);if(s.isZero())return l;e=a.precision,r=a.rounding,a.precision=e+Math.max(s.e,s.sd())+4,a.rounding=1,n=s.d.length,n<32?(i=Math.ceil(n/3),t=(1/Is(4,i)).toString()):(i=16,t="2.3283064365386962890625e-10"),s=fi(a,1,s.times(t),new a(1),!0);for(var f,h=i,p=new a(8);h--;)f=s.times(s),s=l.minus(f.times(p.minus(f.times(p))));return Dt(s,a.precision=e,a.rounding=r,!0)},it.hyperbolicSine=it.sinh=function(){var i,t,e,r,n=this,s=n.constructor;if(!n.isFinite()||n.isZero())return new s(n);if(t=s.precision,e=s.rounding,s.precision=t+Math.max(n.e,n.sd())+4,s.rounding=1,r=n.d.length,r<3)n=fi(s,2,n,n,!0);else{i=1.4*Math.sqrt(r),i=i>16?16:i|0,n=n.times(1/Is(5,i)),n=fi(s,2,n,n,!0);for(var a,l=new s(5),f=new s(16),h=new s(20);i--;)a=n.times(n),n=n.times(l.plus(a.times(f.times(a).plus(h))))}return s.precision=t,s.rounding=e,Dt(n,t,e,!0)},it.hyperbolicTangent=it.tanh=function(){var i,t,e=this,r=e.constructor;return e.isFinite()?e.isZero()?new r(e):(i=r.precision,t=r.rounding,r.precision=i+7,r.rounding=1,ae(e.sinh(),e.cosh(),r.precision=i,r.rounding=t)):new r(e.s)},it.inverseCosine=it.acos=function(){var i,t=this,e=t.constructor,r=t.abs().cmp(1),n=e.precision,s=e.rounding;return r!==-1?r===0?t.isNeg()?$r(e,n,s):new e(0):new e(NaN):t.isZero()?$r(e,n+4,s).times(.5):(e.precision=n+6,e.rounding=1,t=t.asin(),i=$r(e,n+4,s).times(.5),e.precision=n,e.rounding=s,i.minus(t))},it.inverseHyperbolicCosine=it.acosh=function(){var i,t,e=this,r=e.constructor;return e.lte(1)?new r(e.eq(1)?0:NaN):e.isFinite()?(i=r.precision,t=r.rounding,r.precision=i+Math.max(Math.abs(e.e),e.sd())+4,r.rounding=1,St=!1,e=e.times(e).minus(1).sqrt().plus(e),St=!0,r.precision=i,r.rounding=t,e.ln()):new r(e)},it.inverseHyperbolicSine=it.asinh=function(){var i,t,e=this,r=e.constructor;return!e.isFinite()||e.isZero()?new r(e):(i=r.precision,t=r.rounding,r.precision=i+2*Math.max(Math.abs(e.e),e.sd())+6,r.rounding=1,St=!1,e=e.times(e).plus(1).sqrt().plus(e),St=!0,r.precision=i,r.rounding=t,e.ln())},it.inverseHyperbolicTangent=it.atanh=function(){var i,t,e,r,n=this,s=n.constructor;return n.isFinite()?n.e>=0?new s(n.abs().eq(1)?n.s/0:n.isZero()?n:NaN):(i=s.precision,t=s.rounding,r=n.sd(),Math.max(r,i)<2*-n.e-1?Dt(new s(n),i,t,!0):(s.precision=e=r-n.e,n=ae(n.plus(1),new s(1).minus(n),e+i,1),s.precision=i+4,s.rounding=1,n=n.ln(),s.precision=i,s.rounding=t,n.times(.5))):new s(NaN)},it.inverseSine=it.asin=function(){var i,t,e,r,n=this,s=n.constructor;return n.isZero()?new s(n):(t=n.abs().cmp(1),e=s.precision,r=s.rounding,t!==-1?t===0?(i=$r(s,e+4,r).times(.5),i.s=n.s,i):new s(NaN):(s.precision=e+6,s.rounding=1,n=n.div(new s(1).minus(n.times(n)).sqrt().plus(1)).atan(),s.precision=e,s.rounding=r,n.times(2)))},it.inverseTangent=it.atan=function(){var i,t,e,r,n,s,a,l,f,h=this,p=h.constructor,c=p.precision,d=p.rounding;if(h.isFinite()){if(h.isZero())return new p(h);if(h.abs().eq(1)&&c+4<=va)return a=$r(p,c+4,d).times(.25),a.s=h.s,a}else{if(!h.s)return new p(NaN);if(c+4<=va)return a=$r(p,c+4,d).times(.5),a.s=h.s,a}for(p.precision=l=c+10,p.rounding=1,e=Math.min(28,l/xt+2|0),i=e;i;--i)h=h.div(h.times(h).plus(1).sqrt().plus(1));for(St=!1,t=Math.ceil(l/xt),r=1,f=h.times(h),a=new p(h),n=h;i!==-1;)if(n=n.times(f),s=a.minus(n.div(r+=2)),n=n.times(f),a=s.plus(n.div(r+=2)),a.d[t]!==void 0)for(i=t;a.d[i]===s.d[i]&&i--;);return e&&(a=a.times(2<<e-1)),St=!0,Dt(a,p.precision=c,p.rounding=d,!0)},it.isFinite=function(){return!!this.d},it.isInteger=it.isInt=function(){return!!this.d&&Ue(this.e/xt)>this.d.length-2},it.isNaN=function(){return!this.s},it.isNegative=it.isNeg=function(){return this.s<0},it.isPositive=it.isPos=function(){return this.s>0},it.isZero=function(){return!!this.d&&this.d[0]===0},it.lessThan=it.lt=function(i){return this.cmp(i)<0},it.lessThanOrEqualTo=it.lte=function(i){return this.cmp(i)<1},it.logarithm=it.log=function(i){var t,e,r,n,s,a,l,f,h=this,p=h.constructor,c=p.precision,d=p.rounding,g=5;if(i==null)i=new p(10),t=!0;else{if(i=new p(i),e=i.d,i.s<0||!e||!e[0]||i.eq(1))return new p(NaN);t=i.eq(10)}if(e=h.d,h.s<0||!e||!e[0]||h.eq(1))return new p(e&&!e[0]?-1/0:h.s!=1?NaN:e?0:1/0);if(t)if(e.length>1)s=!0;else{for(n=e[0];n%10===0;)n/=10;s=n!==1}if(St=!1,l=c+g,a=yn(h,l),r=t?Ts(p,l+10):yn(i,l),f=ae(a,r,l,1),Wi(f.d,n=c,d))do if(l+=10,a=yn(h,l),r=t?Ts(p,l+10):yn(i,l),f=ae(a,r,l,1),!s){+Pe(f.d).slice(n+1,n+15)+1==1e14&&(f=Dt(f,c+1,0));break}while(Wi(f.d,n+=10,d));return St=!0,Dt(f,c,d)},it.minus=it.sub=function(i){var t,e,r,n,s,a,l,f,h,p,c,d,g=this,w=g.constructor;if(i=new w(i),!g.d||!i.d)return!g.s||!i.s?i=new w(NaN):g.d?i.s=-i.s:i=new w(i.d||g.s!==i.s?g:NaN),i;if(g.s!=i.s)return i.s=-i.s,g.plus(i);if(h=g.d,d=i.d,l=w.precision,f=w.rounding,!h[0]||!d[0]){if(d[0])i.s=-i.s;else if(h[0])i=new w(g);else return new w(f===3?-0:0);return St?Dt(i,l,f):i}if(e=Ue(i.e/xt),p=Ue(g.e/xt),h=h.slice(),s=p-e,s){for(c=s<0,c?(t=h,s=-s,a=d.length):(t=d,e=p,a=h.length),r=Math.max(Math.ceil(l/xt),a)+2,s>r&&(s=r,t.length=1),t.reverse(),r=s;r--;)t.push(0);t.reverse()}else{for(r=h.length,a=d.length,c=r<a,c&&(a=r),r=0;r<a;r++)if(h[r]!=d[r]){c=h[r]<d[r];break}s=0}for(c&&(t=h,h=d,d=t,i.s=-i.s),a=h.length,r=d.length-a;r>0;--r)h[a++]=0;for(r=d.length;r>s;){if(h[--r]<d[r]){for(n=r;n&&h[--n]===0;)h[n]=Or-1;--h[n],h[r]+=Or}h[r]-=d[r]}for(;h[--a]===0;)h.pop();for(;h[0]===0;h.shift())--e;return h[0]?(i.d=h,i.e=Bs(h,e),St?Dt(i,l,f):i):new w(f===3?-0:0)},it.modulo=it.mod=function(i){var t,e=this,r=e.constructor;return i=new r(i),!e.d||!i.s||i.d&&!i.d[0]?new r(NaN):!i.d||e.d&&!e.d[0]?Dt(new r(e),r.precision,r.rounding):(St=!1,r.modulo==9?(t=ae(e,i.abs(),0,3,1),t.s*=i.s):t=ae(e,i,0,r.modulo,1),t=t.times(i),St=!0,e.minus(t))},it.naturalExponential=it.exp=function(){return wa(this)},it.naturalLogarithm=it.ln=function(){return yn(this)},it.negated=it.neg=function(){var i=new this.constructor(this);return i.s=-i.s,Dt(i)},it.plus=it.add=function(i){var t,e,r,n,s,a,l,f,h,p,c=this,d=c.constructor;if(i=new d(i),!c.d||!i.d)return!c.s||!i.s?i=new d(NaN):c.d||(i=new d(i.d||c.s===i.s?c:NaN)),i;if(c.s!=i.s)return i.s=-i.s,c.minus(i);if(h=c.d,p=i.d,l=d.precision,f=d.rounding,!h[0]||!p[0])return p[0]||(i=new d(c)),St?Dt(i,l,f):i;if(s=Ue(c.e/xt),r=Ue(i.e/xt),h=h.slice(),n=s-r,n){for(n<0?(e=h,n=-n,a=p.length):(e=p,r=s,a=h.length),s=Math.ceil(l/xt),a=s>a?s+1:a+1,n>a&&(n=a,e.length=1),e.reverse();n--;)e.push(0);e.reverse()}for(a=h.length,n=p.length,a-n<0&&(n=a,e=p,p=h,h=e),t=0;n;)t=(h[--n]=h[n]+p[n]+t)/Or|0,h[n]%=Or;for(t&&(h.unshift(t),++r),a=h.length;h[--a]==0;)h.pop();return i.d=h,i.e=Bs(h,r),St?Dt(i,l,f):i},it.precision=it.sd=function(i){var t,e=this;if(i!==void 0&&i!==!!i&&i!==1&&i!==0)throw Error(vn+i);return e.d?(t=lf(e.d),i&&e.e+1>t&&(t=e.e+1)):t=NaN,t},it.round=function(){var i=this,t=i.constructor;return Dt(new t(i),i.e+1,t.rounding)},it.sine=it.sin=function(){var i,t,e=this,r=e.constructor;return e.isFinite()?e.isZero()?new r(e):(i=r.precision,t=r.rounding,r.precision=i+Math.max(e.e,e.sd())+xt,r.rounding=1,e=Vd(r,df(r,e)),r.precision=i,r.rounding=t,Dt(Vr>2?e.neg():e,i,t,!0)):new r(NaN)},it.squareRoot=it.sqrt=function(){var i,t,e,r,n,s,a=this,l=a.d,f=a.e,h=a.s,p=a.constructor;if(h!==1||!l||!l[0])return new p(!h||h<0&&(!l||l[0])?NaN:l?a:1/0);for(St=!1,h=Math.sqrt(+a),h==0||h==1/0?(t=Pe(l),(t.length+f)%2==0&&(t+="0"),h=Math.sqrt(t),f=Ue((f+1)/2)-(f<0||f%2),h==1/0?t="5e"+f:(t=h.toExponential(),t=t.slice(0,t.indexOf("e")+1)+f),r=new p(t)):r=new p(h.toString()),e=(f=p.precision)+3;;)if(s=r,r=s.plus(ae(a,s,e+2,1)).times(.5),Pe(s.d).slice(0,e)===(t=Pe(r.d)).slice(0,e))if(t=t.slice(e-3,e+1),t=="9999"||!n&&t=="4999"){if(!n&&(Dt(s,f+1,0),s.times(s).eq(a))){r=s;break}e+=4,n=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(Dt(r,f+1,1),i=!r.times(r).eq(a));break}return St=!0,Dt(r,f,p.rounding,i)},it.tangent=it.tan=function(){var i,t,e=this,r=e.constructor;return e.isFinite()?e.isZero()?new r(e):(i=r.precision,t=r.rounding,r.precision=i+10,r.rounding=1,e=e.sin(),e.s=1,e=ae(e,new r(1).minus(e.times(e)).sqrt(),i+10,0),r.precision=i,r.rounding=t,Dt(Vr==2||Vr==4?e.neg():e,i,t,!0)):new r(NaN)},it.times=it.mul=function(i){var t,e,r,n,s,a,l,f,h,p=this,c=p.constructor,d=p.d,g=(i=new c(i)).d;if(i.s*=p.s,!d||!d[0]||!g||!g[0])return new c(!i.s||d&&!d[0]&&!g||g&&!g[0]&&!d?NaN:!d||!g?i.s/0:i.s*0);for(e=Ue(p.e/xt)+Ue(i.e/xt),f=d.length,h=g.length,f<h&&(s=d,d=g,g=s,a=f,f=h,h=a),s=[],a=f+h,r=a;r--;)s.push(0);for(r=h;--r>=0;){for(t=0,n=f+r;n>r;)l=s[n]+g[r]*d[n-r-1]+t,s[n--]=l%Or|0,t=l/Or|0;s[n]=(s[n]+t)%Or|0}for(;!s[--a];)s.pop();return t?++e:s.shift(),i.d=s,i.e=Bs(s,e),St?Dt(i,c.precision,c.rounding):i},it.toBinary=function(i,t){return Da(this,2,i,t)},it.toDecimalPlaces=it.toDP=function(i,t){var e=this,r=e.constructor;return e=new r(e),i===void 0?e:(Ve(i,0,gn),t===void 0?t=r.rounding:Ve(t,0,8),Dt(e,i+e.e+1,t))},it.toExponential=function(i,t){var e,r=this,n=r.constructor;return i===void 0?e=Zr(r,!0):(Ve(i,0,gn),t===void 0?t=n.rounding:Ve(t,0,8),r=Dt(new n(r),i+1,t),e=Zr(r,!0,i+1)),r.isNeg()&&!r.isZero()?"-"+e:e},it.toFixed=function(i,t){var e,r,n=this,s=n.constructor;return i===void 0?e=Zr(n):(Ve(i,0,gn),t===void 0?t=s.rounding:Ve(t,0,8),r=Dt(new s(n),i+n.e+1,t),e=Zr(r,!1,i+r.e+1)),n.isNeg()&&!n.isZero()?"-"+e:e},it.toFraction=function(i){var t,e,r,n,s,a,l,f,h,p,c,d,g=this,w=g.d,m=g.constructor;if(!w)return new m(g);if(h=e=new m(1),r=f=new m(0),t=new m(r),s=t.e=lf(w)-g.e-1,a=s%xt,t.d[0]=Ne(10,a<0?xt+a:a),i==null)i=s>0?t:h;else{if(l=new m(i),!l.isInt()||l.lt(h))throw Error(vn+l);i=l.gt(t)?s>0?t:h:l}for(St=!1,l=new m(Pe(w)),p=m.precision,m.precision=s=w.length*xt*2;c=ae(l,t,0,1,1),n=e.plus(c.times(r)),n.cmp(i)!=1;)e=r,r=n,n=h,h=f.plus(c.times(n)),f=n,n=t,t=l.minus(c.times(n)),l=n;return n=ae(i.minus(e),r,0,1,1),f=f.plus(n.times(h)),e=e.plus(n.times(r)),f.s=h.s=g.s,d=ae(h,r,s,1).minus(g).abs().cmp(ae(f,e,s,1).minus(g).abs())<1?[h,r]:[f,e],m.precision=p,St=!0,d},it.toHexadecimal=it.toHex=function(i,t){return Da(this,16,i,t)},it.toNearest=function(i,t){var e=this,r=e.constructor;if(e=new r(e),i==null){if(!e.d)return e;i=new r(1),t=r.rounding}else{if(i=new r(i),t===void 0?t=r.rounding:Ve(t,0,8),!e.d)return i.s?e:i;if(!i.d)return i.s&&(i.s=e.s),i}return i.d[0]?(St=!1,e=ae(e,i,0,t,1).times(i),St=!0,Dt(e)):(i.s=e.s,e=i),e},it.toNumber=function(){return+this},it.toOctal=function(i,t){return Da(this,8,i,t)},it.toPower=it.pow=function(i){var t,e,r,n,s,a,l=this,f=l.constructor,h=+(i=new f(i));if(!l.d||!i.d||!l.d[0]||!i.d[0])return new f(Ne(+l,h));if(l=new f(l),l.eq(1))return l;if(r=f.precision,s=f.rounding,i.eq(1))return Dt(l,r,s);if(t=Ue(i.e/xt),t>=i.d.length-1&&(e=h<0?-h:h)<=Kd)return n=ff(f,l,e,r),i.s<0?new f(1).div(n):Dt(n,r,s);if(a=l.s,a<0){if(t<i.d.length-1)return new f(NaN);if(i.d[t]&1||(a=1),l.e==0&&l.d[0]==1&&l.d.length==1)return l.s=a,l}return e=Ne(+l,h),t=e==0||!isFinite(e)?Ue(h*(Math.log("0."+Pe(l.d))/Math.LN10+l.e+1)):new f(e+"").e,t>f.maxE+1||t<f.minE-1?new f(t>0?a/0:0):(St=!1,f.rounding=l.s=1,e=Math.min(12,(t+"").length),n=wa(i.times(yn(l,r+e)),r),n.d&&(n=Dt(n,r+5,1),Wi(n.d,r,s)&&(t=r+10,n=Dt(wa(i.times(yn(l,t+e)),t),t+5,1),+Pe(n.d).slice(r+1,r+15)+1==1e14&&(n=Dt(n,r+1,0)))),n.s=a,St=!0,f.rounding=s,Dt(n,r,s))},it.toPrecision=function(i,t){var e,r=this,n=r.constructor;return i===void 0?e=Zr(r,r.e<=n.toExpNeg||r.e>=n.toExpPos):(Ve(i,1,gn),t===void 0?t=n.rounding:Ve(t,0,8),r=Dt(new n(r),i,t),e=Zr(r,i<=r.e||r.e<=n.toExpNeg,i)),r.isNeg()&&!r.isZero()?"-"+e:e},it.toSignificantDigits=it.toSD=function(i,t){var e=this,r=e.constructor;return i===void 0?(i=r.precision,t=r.rounding):(Ve(i,1,gn),t===void 0?t=r.rounding:Ve(t,0,8)),Dt(new r(e),i,t)},it.toString=function(){var i=this,t=i.constructor,e=Zr(i,i.e<=t.toExpNeg||i.e>=t.toExpPos);return i.isNeg()&&!i.isZero()?"-"+e:e},it.truncated=it.trunc=function(){return Dt(new this.constructor(this),this.e+1,1)},it.valueOf=it.toJSON=function(){var i=this,t=i.constructor,e=Zr(i,i.e<=t.toExpNeg||i.e>=t.toExpPos);return i.isNeg()?"-"+e:e};function Pe(i){var t,e,r,n=i.length-1,s="",a=i[0];if(n>0){for(s+=a,t=1;t<n;t++)r=i[t]+"",e=xt-r.length,e&&(s+=wn(e)),s+=r;a=i[t],r=a+"",e=xt-r.length,e&&(s+=wn(e))}else if(a===0)return"0";for(;a%10===0;)a/=10;return s+a}function Ve(i,t,e){if(i!==~~i||i<t||i>e)throw Error(vn+i)}function Wi(i,t,e,r){var n,s,a,l;for(s=i[0];s>=10;s/=10)--t;return--t<0?(t+=xt,n=0):(n=Math.ceil((t+1)/xt),t%=xt),s=Ne(10,xt-t),l=i[n]%s|0,r==null?t<3?(t==0?l=l/100|0:t==1&&(l=l/10|0),a=e<4&&l==99999||e>3&&l==49999||l==5e4||l==0):a=(e<4&&l+1==s||e>3&&l+1==s/2)&&(i[n+1]/s/100|0)==Ne(10,t-2)-1||(l==s/2||l==0)&&(i[n+1]/s/100|0)==0:t<4?(t==0?l=l/1e3|0:t==1?l=l/100|0:t==2&&(l=l/10|0),a=(r||e<4)&&l==9999||!r&&e>3&&l==4999):a=((r||e<4)&&l+1==s||!r&&e>3&&l+1==s/2)&&(i[n+1]/s/1e3|0)==Ne(10,t-3)-1,a}function Ss(i,t,e){for(var r,n=[0],s,a=0,l=i.length;a<l;){for(s=n.length;s--;)n[s]*=t;for(n[0]+=ma.indexOf(i.charAt(a++)),r=0;r<n.length;r++)n[r]>e-1&&(n[r+1]===void 0&&(n[r+1]=0),n[r+1]+=n[r]/e|0,n[r]%=e)}return n.reverse()}function Jd(i,t){var e,r,n;if(t.isZero())return t;r=t.d.length,r<32?(e=Math.ceil(r/3),n=(1/Is(4,e)).toString()):(e=16,n="2.3283064365386962890625e-10"),i.precision+=e,t=fi(i,1,t.times(n),new i(1));for(var s=e;s--;){var a=t.times(t);t=a.times(a).minus(a).times(8).plus(1)}return i.precision-=e,t}var ae=function(){function i(r,n,s){var a,l=0,f=r.length;for(r=r.slice();f--;)a=r[f]*n+l,r[f]=a%s|0,l=a/s|0;return l&&r.unshift(l),r}function t(r,n,s,a){var l,f;if(s!=a)f=s>a?1:-1;else for(l=f=0;l<s;l++)if(r[l]!=n[l]){f=r[l]>n[l]?1:-1;break}return f}function e(r,n,s,a){for(var l=0;s--;)r[s]-=l,l=r[s]<n[s]?1:0,r[s]=l*a+r[s]-n[s];for(;!r[0]&&r.length>1;)r.shift()}return function(r,n,s,a,l,f){var h,p,c,d,g,w,m,D,v,E,b,N,x,F,M,S,O,C,T,L,U=r.constructor,k=r.s==n.s?1:-1,W=r.d,P=n.d;if(!W||!W[0]||!P||!P[0])return new U(!r.s||!n.s||(W?P&&W[0]==P[0]:!P)?NaN:W&&W[0]==0||!P?k*0:k/0);for(f?(g=1,p=r.e-n.e):(f=Or,g=xt,p=Ue(r.e/g)-Ue(n.e/g)),T=P.length,O=W.length,v=new U(k),E=v.d=[],c=0;P[c]==(W[c]||0);c++);if(P[c]>(W[c]||0)&&p--,s==null?(F=s=U.precision,a=U.rounding):l?F=s+(r.e-n.e)+1:F=s,F<0)E.push(1),w=!0;else{if(F=F/g+2|0,c=0,T==1){for(d=0,P=P[0],F++;(c<O||d)&&F--;c++)M=d*f+(W[c]||0),E[c]=M/P|0,d=M%P|0;w=d||c<O}else{for(d=f/(P[0]+1)|0,d>1&&(P=i(P,d,f),W=i(W,d,f),T=P.length,O=W.length),S=T,b=W.slice(0,T),N=b.length;N<T;)b[N++]=0;L=P.slice(),L.unshift(0),C=P[0],P[1]>=f/2&&++C;do d=0,h=t(P,b,T,N),h<0?(x=b[0],T!=N&&(x=x*f+(b[1]||0)),d=x/C|0,d>1?(d>=f&&(d=f-1),m=i(P,d,f),D=m.length,N=b.length,h=t(m,b,D,N),h==1&&(d--,e(m,T<D?L:P,D,f))):(d==0&&(h=d=1),m=P.slice()),D=m.length,D<N&&m.unshift(0),e(b,m,N,f),h==-1&&(N=b.length,h=t(P,b,T,N),h<1&&(d++,e(b,T<N?L:P,N,f))),N=b.length):h===0&&(d++,b=[0]),E[c++]=d,h&&b[0]?b[N++]=W[S]||0:(b=[W[S]],N=1);while((S++<O||b[0]!==void 0)&&F--);w=b[0]!==void 0}E[0]||E.shift()}if(g==1)v.e=p,nf=w;else{for(c=1,d=E[0];d>=10;d/=10)c++;v.e=c+p*g-1,Dt(v,l?s+v.e+1:s,a,w)}return v}}();function Dt(i,t,e,r){var n,s,a,l,f,h,p,c,d,g=i.constructor;t:if(t!=null){if(c=i.d,!c)return i;for(n=1,l=c[0];l>=10;l/=10)n++;if(s=t-n,s<0)s+=xt,a=t,p=c[d=0],f=p/Ne(10,n-a-1)%10|0;else if(d=Math.ceil((s+1)/xt),l=c.length,d>=l)if(r){for(;l++<=d;)c.push(0);p=f=0,n=1,s%=xt,a=s-xt+1}else break t;else{for(p=l=c[d],n=1;l>=10;l/=10)n++;s%=xt,a=s-xt+n,f=a<0?0:p/Ne(10,n-a-1)%10|0}if(r=r||t<0||c[d+1]!==void 0||(a<0?p:p%Ne(10,n-a-1)),h=e<4?(f||r)&&(e==0||e==(i.s<0?3:2)):f>5||f==5&&(e==4||r||e==6&&(s>0?a>0?p/Ne(10,n-a):0:c[d-1])%10&1||e==(i.s<0?8:7)),t<1||!c[0])return c.length=0,h?(t-=i.e+1,c[0]=Ne(10,(xt-t%xt)%xt),i.e=-t||0):c[0]=i.e=0,i;if(s==0?(c.length=d,l=1,d--):(c.length=d+1,l=Ne(10,xt-s),c[d]=a>0?(p/Ne(10,n-a)%Ne(10,a)|0)*l:0),h)for(;;)if(d==0){for(s=1,a=c[0];a>=10;a/=10)s++;for(a=c[0]+=l,l=1;a>=10;a/=10)l++;s!=l&&(i.e++,c[0]==Or&&(c[0]=1));break}else{if(c[d]+=l,c[d]!=Or)break;c[d--]=0,l=1}for(s=c.length;c[--s]===0;)c.pop()}return St&&(i.e>g.maxE?(i.d=null,i.e=NaN):i.e<g.minE&&(i.e=0,i.d=[0])),i}function Zr(i,t,e){if(!i.isFinite())return pf(i);var r,n=i.e,s=Pe(i.d),a=s.length;return t?(e&&(r=e-a)>0?s=s.charAt(0)+"."+s.slice(1)+wn(r):a>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(i.e<0?"e":"e+")+i.e):n<0?(s="0."+wn(-n-1)+s,e&&(r=e-a)>0&&(s+=wn(r))):n>=a?(s+=wn(n+1-a),e&&(r=e-n-1)>0&&(s=s+"."+wn(r))):((r=n+1)<a&&(s=s.slice(0,r)+"."+s.slice(r)),e&&(r=e-a)>0&&(n+1===a&&(s+="."),s+=wn(r))),s}function Bs(i,t){var e=i[0];for(t*=xt;e>=10;e/=10)t++;return t}function Ts(i,t,e){if(t>Hd)throw St=!0,e&&(i.precision=e),Error(sf);return Dt(new i(Fs),t,1,!0)}function $r(i,t,e){if(t>va)throw Error(sf);return Dt(new i(Ms),t,e,!0)}function lf(i){var t=i.length-1,e=t*xt+1;if(t=i[t],t){for(;t%10==0;t/=10)e--;for(t=i[0];t>=10;t/=10)e++}return e}function wn(i){for(var t="";i--;)t+="0";return t}function ff(i,t,e,r){var n,s=new i(1),a=Math.ceil(r/xt+4);for(St=!1;;){if(e%2&&(s=s.times(t),_f(s.d,a)&&(n=!0)),e=Ue(e/2),e===0){e=s.d.length-1,n&&s.d[e]===0&&++s.d[e];break}t=t.times(t),_f(t.d,a)}return St=!0,s}function cf(i){return i.d[i.d.length-1]&1}function hf(i,t,e){for(var r,n=new i(t[0]),s=0;++s<t.length;)if(r=new i(t[s]),r.s)n[e](r)&&(n=r);else{n=r;break}return n}function wa(i,t){var e,r,n,s,a,l,f,h=0,p=0,c=0,d=i.constructor,g=d.rounding,w=d.precision;if(!i.d||!i.d[0]||i.e>17)return new d(i.d?i.d[0]?i.s<0?0:1/0:1:i.s?i.s<0?0:i:NaN);for(t==null?(St=!1,f=w):f=t,l=new d(.03125);i.e>-2;)i=i.times(l),c+=5;for(r=Math.log(Ne(2,c))/Math.LN10*2+5|0,f+=r,e=s=a=new d(1),d.precision=f;;){if(s=Dt(s.times(i),f,1),e=e.times(++p),l=a.plus(ae(s,e,f,1)),Pe(l.d).slice(0,f)===Pe(a.d).slice(0,f)){for(n=c;n--;)a=Dt(a.times(a),f,1);if(t==null)if(h<3&&Wi(a.d,f-r,g,h))d.precision=f+=10,e=s=l=new d(1),p=0,h++;else return Dt(a,d.precision=w,g,St=!0);else return d.precision=w,a}a=l}}function yn(i,t){var e,r,n,s,a,l,f,h,p,c,d,g=1,w=10,m=i,D=m.d,v=m.constructor,E=v.rounding,b=v.precision;if(m.s<0||!D||!D[0]||!m.e&&D[0]==1&&D.length==1)return new v(D&&!D[0]?-1/0:m.s!=1?NaN:D?0:m);if(t==null?(St=!1,p=b):p=t,v.precision=p+=w,e=Pe(D),r=e.charAt(0),Math.abs(s=m.e)<15e14){for(;r<7&&r!=1||r==1&&e.charAt(1)>3;)m=m.times(i),e=Pe(m.d),r=e.charAt(0),g++;s=m.e,r>1?(m=new v("0."+e),s++):m=new v(r+"."+e.slice(1))}else return h=Ts(v,p+2,b).times(s+""),m=yn(new v(r+"."+e.slice(1)),p-w).plus(h),v.precision=b,t==null?Dt(m,b,E,St=!0):m;for(c=m,f=a=m=ae(m.minus(1),m.plus(1),p,1),d=Dt(m.times(m),p,1),n=3;;){if(a=Dt(a.times(d),p,1),h=f.plus(ae(a,new v(n),p,1)),Pe(h.d).slice(0,p)===Pe(f.d).slice(0,p))if(f=f.times(2),s!==0&&(f=f.plus(Ts(v,p+2,b).times(s+""))),f=ae(f,new v(g),p,1),t==null)if(Wi(f.d,p-w,E,l))v.precision=p+=w,h=a=m=ae(c.minus(1),c.plus(1),p,1),d=Dt(m.times(m),p,1),n=l=1;else return Dt(f,v.precision=b,E,St=!0);else return v.precision=b,f;f=h,n+=2}}function pf(i){return String(i.s*i.s/0)}function ya(i,t){var e,r,n;for((e=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(e<0&&(e=r),e+=+t.slice(r+1),t=t.substring(0,r)):e<0&&(e=t.length),r=0;t.charCodeAt(r)===48;r++);for(n=t.length;t.charCodeAt(n-1)===48;--n);if(t=t.slice(r,n),t){if(n-=r,i.e=e=e-r-1,i.d=[],r=(e+1)%xt,e<0&&(r+=xt),r<n){for(r&&i.d.push(+t.slice(0,r)),n-=xt;r<n;)i.d.push(+t.slice(r,r+=xt));t=t.slice(r),r=xt-t.length}else r-=n;for(;r--;)t+="0";i.d.push(+t),St&&(i.e>i.constructor.maxE?(i.d=null,i.e=NaN):i.e<i.constructor.minE&&(i.e=0,i.d=[0]))}else i.e=0,i.d=[0];return i}function Xd(i,t){var e,r,n,s,a,l,f,h,p;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),uf.test(t))return ya(i,t)}else if(t==="Infinity"||t==="NaN")return+t||(i.s=NaN),i.e=NaN,i.d=null,i;if(Zd.test(t))e=16,t=t.toLowerCase();else if(Yd.test(t))e=2;else if(Gd.test(t))e=8;else throw Error(vn+t);for(s=t.search(/p/i),s>0?(f=+t.slice(s+1),t=t.substring(2,s)):t=t.slice(2),s=t.indexOf("."),a=s>=0,r=i.constructor,a&&(t=t.replace(".",""),l=t.length,s=l-s,n=ff(r,new r(e),s,s*2)),h=Ss(t,e,Or),p=h.length-1,s=p;h[s]===0;--s)h.pop();return s<0?new r(i.s*0):(i.e=Bs(h,p),i.d=h,St=!1,a&&(i=ae(i,n,l*4)),f&&(i=i.times(Math.abs(f)<54?Ne(2,f):ci.pow(2,f))),St=!0,i)}function Vd(i,t){var e,r=t.d.length;if(r<3)return t.isZero()?t:fi(i,2,t,t);e=1.4*Math.sqrt(r),e=e>16?16:e|0,t=t.times(1/Is(5,e)),t=fi(i,2,t,t);for(var n,s=new i(5),a=new i(16),l=new i(20);e--;)n=t.times(t),t=t.times(s.plus(n.times(a.times(n).minus(l))));return t}function fi(i,t,e,r,n){var s,a,l,f,h=i.precision,p=Math.ceil(h/xt);for(St=!1,f=e.times(e),l=new i(r);;){if(a=ae(l.times(f),new i(t++*t++),h,1),l=n?r.plus(a):r.minus(a),r=ae(a.times(f),new i(t++*t++),h,1),a=l.plus(r),a.d[p]!==void 0){for(s=p;a.d[s]===l.d[s]&&s--;);if(s==-1)break}s=l,l=r,r=a,a=s}return St=!0,a.d.length=p+1,a}function Is(i,t){for(var e=i;--t;)e*=i;return e}function df(i,t){var e,r=t.s<0,n=$r(i,i.precision,1),s=n.times(.5);if(t=t.abs(),t.lte(s))return Vr=r?4:1,t;if(e=t.divToInt(n),e.isZero())Vr=r?3:2;else{if(t=t.minus(e.times(n)),t.lte(s))return Vr=cf(e)?r?2:3:r?4:1,t;Vr=cf(e)?r?1:4:r?3:2}return t.minus(n).abs()}function Da(i,t,e,r){var n,s,a,l,f,h,p,c,d,g=i.constructor,w=e!==void 0;if(w?(Ve(e,1,gn),r===void 0?r=g.rounding:Ve(r,0,8)):(e=g.precision,r=g.rounding),!i.isFinite())p=pf(i);else{for(p=Zr(i),a=p.indexOf("."),w?(n=2,t==16?e=e*4-3:t==8&&(e=e*3-2)):n=t,a>=0&&(p=p.replace(".",""),d=new g(1),d.e=p.length-a,d.d=Ss(Zr(d),10,n),d.e=d.d.length),c=Ss(p,10,n),s=f=c.length;c[--f]==0;)c.pop();if(!c[0])p=w?"0p+0":"0";else{if(a<0?s--:(i=new g(i),i.d=c,i.e=s,i=ae(i,d,e,r,0,n),c=i.d,s=i.e,h=nf),a=c[e],l=n/2,h=h||c[e+1]!==void 0,h=r<4?(a!==void 0||h)&&(r===0||r===(i.s<0?3:2)):a>l||a===l&&(r===4||h||r===6&&c[e-1]&1||r===(i.s<0?8:7)),c.length=e,h)for(;++c[--e]>n-1;)c[e]=0,e||(++s,c.unshift(1));for(f=c.length;!c[f-1];--f);for(a=0,p="";a<f;a++)p+=ma.charAt(c[a]);if(w){if(f>1)if(t==16||t==8){for(a=t==16?4:3,--f;f%a;f++)p+="0";for(c=Ss(p,n,t),f=c.length;!c[f-1];--f);for(a=1,p="1.";a<f;a++)p+=ma.charAt(c[a])}else p=p.charAt(0)+"."+p.slice(1);p=p+(s<0?"p":"p+")+s}else if(s<0){for(;++s;)p="0"+p;p="0."+p}else if(++s>f)for(s-=f;s--;)p+="0";else s<f&&(p=p.slice(0,s)+"."+p.slice(s))}p=(t==16?"0x":t==2?"0b":t==8?"0o":"")+p}return i.s<0?"-"+p:p}function _f(i,t){if(i.length>t)return i.length=t,!0}function Qd(i){return new this(i).abs()}function t_(i){return new this(i).acos()}function e_(i){return new this(i).acosh()}function r_(i,t){return new this(i).plus(t)}function n_(i){return new this(i).asin()}function i_(i){return new this(i).asinh()}function s_(i){return new this(i).atan()}function o_(i){return new this(i).atanh()}function a_(i,t){i=new this(i),t=new this(t);var e,r=this.precision,n=this.rounding,s=r+4;return!i.s||!t.s?e=new this(NaN):!i.d&&!t.d?(e=$r(this,s,1).times(t.s>0?.25:.75),e.s=i.s):!t.d||i.isZero()?(e=t.s<0?$r(this,r,n):new this(0),e.s=i.s):!i.d||t.isZero()?(e=$r(this,s,1).times(.5),e.s=i.s):t.s<0?(this.precision=s,this.rounding=1,e=this.atan(ae(i,t,s,1)),t=$r(this,s,1),this.precision=r,this.rounding=n,e=i.s<0?e.minus(t):e.plus(t)):e=this.atan(ae(i,t,s,1)),e}function u_(i){return new this(i).cbrt()}function l_(i){return Dt(i=new this(i),i.e+1,2)}function f_(i,t,e){return new this(i).clamp(t,e)}function c_(i){if(!i||typeof i!="object")throw Error(Ns+"Object expected");var t,e,r,n=i.defaults===!0,s=["precision",1,gn,"rounding",0,8,"toExpNeg",-li,0,"toExpPos",0,li,"maxE",0,li,"minE",-li,0,"modulo",0,9];for(t=0;t<s.length;t+=3)if(e=s[t],n&&(this[e]=ga[e]),(r=i[e])!==void 0)if(Ue(r)===r&&r>=s[t+1]&&r<=s[t+2])this[e]=r;else throw Error(vn+e+": "+r);if(e="crypto",n&&(this[e]=ga[e]),(r=i[e])!==void 0)if(r===!0||r===!1||r===0||r===1)if(r)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[e]=!0;else throw Error(of);else this[e]=!1;else throw Error(vn+e+": "+r);return this}function h_(i){return new this(i).cos()}function p_(i){return new this(i).cosh()}function mf(i){var t,e,r;function n(s){var a,l,f,h=this;if(!(h instanceof n))return new n(s);if(h.constructor=n,gf(s)){h.s=s.s,St?!s.d||s.e>n.maxE?(h.e=NaN,h.d=null):s.e<n.minE?(h.e=0,h.d=[0]):(h.e=s.e,h.d=s.d.slice()):(h.e=s.e,h.d=s.d?s.d.slice():s.d);return}if(f=typeof s,f==="number"){if(s===0){h.s=1/s<0?-1:1,h.e=0,h.d=[0];return}if(s<0?(s=-s,h.s=-1):h.s=1,s===~~s&&s<1e7){for(a=0,l=s;l>=10;l/=10)a++;St?a>n.maxE?(h.e=NaN,h.d=null):a<n.minE?(h.e=0,h.d=[0]):(h.e=a,h.d=[s]):(h.e=a,h.d=[s]);return}else if(s*0!==0){s||(h.s=NaN),h.e=NaN,h.d=null;return}return ya(h,s.toString())}else if(f!=="string")throw Error(vn+s);return(l=s.charCodeAt(0))===45?(s=s.slice(1),h.s=-1):(l===43&&(s=s.slice(1)),h.s=1),uf.test(s)?ya(h,s):Xd(h,s)}if(n.prototype=it,n.ROUND_UP=0,n.ROUND_DOWN=1,n.ROUND_CEIL=2,n.ROUND_FLOOR=3,n.ROUND_HALF_UP=4,n.ROUND_HALF_DOWN=5,n.ROUND_HALF_EVEN=6,n.ROUND_HALF_CEIL=7,n.ROUND_HALF_FLOOR=8,n.EUCLID=9,n.config=n.set=c_,n.clone=mf,n.isDecimal=gf,n.abs=Qd,n.acos=t_,n.acosh=e_,n.add=r_,n.asin=n_,n.asinh=i_,n.atan=s_,n.atanh=o_,n.atan2=a_,n.cbrt=u_,n.ceil=l_,n.clamp=f_,n.cos=h_,n.cosh=p_,n.div=d_,n.exp=__,n.floor=m_,n.hypot=g_,n.ln=v_,n.log=w_,n.log10=D_,n.log2=y_,n.max=b_,n.min=E_,n.mod=x_,n.mul=A_,n.pow=C_,n.random=F_,n.round=M_,n.sign=N_,n.sin=S_,n.sinh=B_,n.sqrt=T_,n.sub=I_,n.sum=O_,n.tan=$_,n.tanh=L_,n.trunc=R_,i===void 0&&(i={}),i&&i.defaults!==!0)for(r=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],t=0;t<r.length;)i.hasOwnProperty(e=r[t++])||(i[e]=this[e]);return n.config(i),n}function d_(i,t){return new this(i).div(t)}function __(i){return new this(i).exp()}function m_(i){return Dt(i=new this(i),i.e+1,3)}function g_(){var i,t,e=new this(0);for(St=!1,i=0;i<arguments.length;)if(t=new this(arguments[i++]),t.d)e.d&&(e=e.plus(t.times(t)));else{if(t.s)return St=!0,new this(1/0);e=t}return St=!0,e.sqrt()}function gf(i){return i instanceof ci||i&&i.toStringTag===af||!1}function v_(i){return new this(i).ln()}function w_(i,t){return new this(i).log(t)}function y_(i){return new this(i).log(2)}function D_(i){return new this(i).log(10)}function b_(){return hf(this,arguments,"lt")}function E_(){return hf(this,arguments,"gt")}function x_(i,t){return new this(i).mod(t)}function A_(i,t){return new this(i).mul(t)}function C_(i,t){return new this(i).pow(t)}function F_(i){var t,e,r,n,s=0,a=new this(1),l=[];if(i===void 0?i=this.precision:Ve(i,1,gn),r=Math.ceil(i/xt),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(r));s<r;)n=t[s],n>=429e7?t[s]=crypto.getRandomValues(new Uint32Array(1))[0]:l[s++]=n%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(r*=4);s<r;)n=t[s]+(t[s+1]<<8)+(t[s+2]<<16)+((t[s+3]&127)<<24),n>=214e7?crypto.randomBytes(4).copy(t,s):(l.push(n%1e7),s+=4);s=r/4}else throw Error(of);else for(;s<r;)l[s++]=Math.random()*1e7|0;for(r=l[--s],i%=xt,r&&i&&(n=Ne(10,xt-i),l[s]=(r/n|0)*n);l[s]===0;s--)l.pop();if(s<0)e=0,l=[0];else{for(e=-1;l[0]===0;e-=xt)l.shift();for(r=1,n=l[0];n>=10;n/=10)r++;r<xt&&(e-=xt-r)}return a.e=e,a.d=l,a}function M_(i){return Dt(i=new this(i),i.e+1,this.rounding)}function N_(i){return i=new this(i),i.d?i.d[0]?i.s:0*i.s:i.s||NaN}function S_(i){return new this(i).sin()}function B_(i){return new this(i).sinh()}function T_(i){return new this(i).sqrt()}function I_(i,t){return new this(i).sub(t)}function O_(){var i=0,t=arguments,e=new this(t[i]);for(St=!1;e.s&&++i<t.length;)e=e.plus(t[i]);return St=!0,Dt(e,this.precision,this.rounding)}function $_(i){return new this(i).tan()}function L_(i){return new this(i).tanh()}function R_(i){return Dt(i=new this(i),i.e+1,1)}it[Symbol.for("nodejs.util.inspect.custom")]=it.toString,it[Symbol.toStringTag]="Decimal";var ci=it.constructor=mf(ga);Fs=new ci(Fs),Ms=new ci(Ms);var P_="BigNumber",z_=["?on","config"],q_=mt(P_,z_,i=>{var{on:t,config:e}=i,r=ci.clone({precision:e.precision,modulo:ci.EUCLID});return r.prototype=Object.create(r.prototype),r.prototype.type="BigNumber",r.prototype.isBigNumber=!0,r.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},r.fromJSON=function(n){return new r(n.value)},t&&t("config",function(n,s){n.precision!==s.precision&&r.config({precision:n.precision})}),r},{isClass:!0}),vf={exports:{}};/**
|
40
|
+
*/var li=9e15,gn=1e9,ma="0123456789abcdef",Fs="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Ms="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",ga={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-li,maxE:li,crypto:!1},sf,Vr,St=!0,Ns="[DecimalError] ",vn=Ns+"Invalid argument: ",of=Ns+"Precision limit exceeded",af=Ns+"crypto unavailable",uf="[object Decimal]",Ue=Math.floor,Se=Math.pow,Yd=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Zd=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Gd=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,lf=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Or=1e7,xt=7,Kd=9007199254740991,Hd=Fs.length-1,va=Ms.length-1,it={toStringTag:uf};it.absoluteValue=it.abs=function(){var i=new this.constructor(this);return i.s<0&&(i.s=1),Dt(i)},it.ceil=function(){return Dt(new this.constructor(this),this.e+1,2)},it.clampedTo=it.clamp=function(i,t){var e,r=this,n=r.constructor;if(i=new n(i),t=new n(t),!i.s||!t.s)return new n(NaN);if(i.gt(t))throw Error(vn+t);return e=r.cmp(i),e<0?i:r.cmp(t)>0?t:new n(r)},it.comparedTo=it.cmp=function(i){var t,e,r,n,s=this,a=s.d,l=(i=new s.constructor(i)).d,f=s.s,h=i.s;if(!a||!l)return!f||!h?NaN:f!==h?f:a===l?0:!a^f<0?1:-1;if(!a[0]||!l[0])return a[0]?f:l[0]?-h:0;if(f!==h)return f;if(s.e!==i.e)return s.e>i.e^f<0?1:-1;for(r=a.length,n=l.length,t=0,e=r<n?r:n;t<e;++t)if(a[t]!==l[t])return a[t]>l[t]^f<0?1:-1;return r===n?0:r>n^f<0?1:-1},it.cosine=it.cos=function(){var i,t,e=this,r=e.constructor;return e.d?e.d[0]?(i=r.precision,t=r.rounding,r.precision=i+Math.max(e.e,e.sd())+xt,r.rounding=1,e=Jd(r,_f(r,e)),r.precision=i,r.rounding=t,Dt(Vr==2||Vr==3?e.neg():e,i,t,!0)):new r(1):new r(NaN)},it.cubeRoot=it.cbrt=function(){var i,t,e,r,n,s,a,l,f,h,p=this,c=p.constructor;if(!p.isFinite()||p.isZero())return new c(p);for(St=!1,s=p.s*Se(p.s*p,1/3),!s||Math.abs(s)==1/0?(e=Pe(p.d),i=p.e,(s=(i-e.length+1)%3)&&(e+=s==1||s==-2?"0":"00"),s=Se(e,1/3),i=Ue((i+1)/3)-(i%3==(i<0?-1:2)),s==1/0?e="5e"+i:(e=s.toExponential(),e=e.slice(0,e.indexOf("e")+1)+i),r=new c(e),r.s=p.s):r=new c(s.toString()),a=(i=c.precision)+3;;)if(l=r,f=l.times(l).times(l),h=f.plus(p),r=ae(h.plus(p).times(l),h.plus(f),a+2,1),Pe(l.d).slice(0,a)===(e=Pe(r.d)).slice(0,a))if(e=e.slice(a-3,a+1),e=="9999"||!n&&e=="4999"){if(!n&&(Dt(l,i+1,0),l.times(l).times(l).eq(p))){r=l;break}a+=4,n=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(Dt(r,i+1,1),t=!r.times(r).times(r).eq(p));break}return St=!0,Dt(r,i,c.rounding,t)},it.decimalPlaces=it.dp=function(){var i,t=this.d,e=NaN;if(t){if(i=t.length-1,e=(i-Ue(this.e/xt))*xt,i=t[i],i)for(;i%10==0;i/=10)e--;e<0&&(e=0)}return e},it.dividedBy=it.div=function(i){return ae(this,new this.constructor(i))},it.dividedToIntegerBy=it.divToInt=function(i){var t=this,e=t.constructor;return Dt(ae(t,new e(i),0,1,1),e.precision,e.rounding)},it.equals=it.eq=function(i){return this.cmp(i)===0},it.floor=function(){return Dt(new this.constructor(this),this.e+1,3)},it.greaterThan=it.gt=function(i){return this.cmp(i)>0},it.greaterThanOrEqualTo=it.gte=function(i){var t=this.cmp(i);return t==1||t===0},it.hyperbolicCosine=it.cosh=function(){var i,t,e,r,n,s=this,a=s.constructor,l=new a(1);if(!s.isFinite())return new a(s.s?1/0:NaN);if(s.isZero())return l;e=a.precision,r=a.rounding,a.precision=e+Math.max(s.e,s.sd())+4,a.rounding=1,n=s.d.length,n<32?(i=Math.ceil(n/3),t=(1/Is(4,i)).toString()):(i=16,t="2.3283064365386962890625e-10"),s=fi(a,1,s.times(t),new a(1),!0);for(var f,h=i,p=new a(8);h--;)f=s.times(s),s=l.minus(f.times(p.minus(f.times(p))));return Dt(s,a.precision=e,a.rounding=r,!0)},it.hyperbolicSine=it.sinh=function(){var i,t,e,r,n=this,s=n.constructor;if(!n.isFinite()||n.isZero())return new s(n);if(t=s.precision,e=s.rounding,s.precision=t+Math.max(n.e,n.sd())+4,s.rounding=1,r=n.d.length,r<3)n=fi(s,2,n,n,!0);else{i=1.4*Math.sqrt(r),i=i>16?16:i|0,n=n.times(1/Is(5,i)),n=fi(s,2,n,n,!0);for(var a,l=new s(5),f=new s(16),h=new s(20);i--;)a=n.times(n),n=n.times(l.plus(a.times(f.times(a).plus(h))))}return s.precision=t,s.rounding=e,Dt(n,t,e,!0)},it.hyperbolicTangent=it.tanh=function(){var i,t,e=this,r=e.constructor;return e.isFinite()?e.isZero()?new r(e):(i=r.precision,t=r.rounding,r.precision=i+7,r.rounding=1,ae(e.sinh(),e.cosh(),r.precision=i,r.rounding=t)):new r(e.s)},it.inverseCosine=it.acos=function(){var i,t=this,e=t.constructor,r=t.abs().cmp(1),n=e.precision,s=e.rounding;return r!==-1?r===0?t.isNeg()?$r(e,n,s):new e(0):new e(NaN):t.isZero()?$r(e,n+4,s).times(.5):(e.precision=n+6,e.rounding=1,t=t.asin(),i=$r(e,n+4,s).times(.5),e.precision=n,e.rounding=s,i.minus(t))},it.inverseHyperbolicCosine=it.acosh=function(){var i,t,e=this,r=e.constructor;return e.lte(1)?new r(e.eq(1)?0:NaN):e.isFinite()?(i=r.precision,t=r.rounding,r.precision=i+Math.max(Math.abs(e.e),e.sd())+4,r.rounding=1,St=!1,e=e.times(e).minus(1).sqrt().plus(e),St=!0,r.precision=i,r.rounding=t,e.ln()):new r(e)},it.inverseHyperbolicSine=it.asinh=function(){var i,t,e=this,r=e.constructor;return!e.isFinite()||e.isZero()?new r(e):(i=r.precision,t=r.rounding,r.precision=i+2*Math.max(Math.abs(e.e),e.sd())+6,r.rounding=1,St=!1,e=e.times(e).plus(1).sqrt().plus(e),St=!0,r.precision=i,r.rounding=t,e.ln())},it.inverseHyperbolicTangent=it.atanh=function(){var i,t,e,r,n=this,s=n.constructor;return n.isFinite()?n.e>=0?new s(n.abs().eq(1)?n.s/0:n.isZero()?n:NaN):(i=s.precision,t=s.rounding,r=n.sd(),Math.max(r,i)<2*-n.e-1?Dt(new s(n),i,t,!0):(s.precision=e=r-n.e,n=ae(n.plus(1),new s(1).minus(n),e+i,1),s.precision=i+4,s.rounding=1,n=n.ln(),s.precision=i,s.rounding=t,n.times(.5))):new s(NaN)},it.inverseSine=it.asin=function(){var i,t,e,r,n=this,s=n.constructor;return n.isZero()?new s(n):(t=n.abs().cmp(1),e=s.precision,r=s.rounding,t!==-1?t===0?(i=$r(s,e+4,r).times(.5),i.s=n.s,i):new s(NaN):(s.precision=e+6,s.rounding=1,n=n.div(new s(1).minus(n.times(n)).sqrt().plus(1)).atan(),s.precision=e,s.rounding=r,n.times(2)))},it.inverseTangent=it.atan=function(){var i,t,e,r,n,s,a,l,f,h=this,p=h.constructor,c=p.precision,d=p.rounding;if(h.isFinite()){if(h.isZero())return new p(h);if(h.abs().eq(1)&&c+4<=va)return a=$r(p,c+4,d).times(.25),a.s=h.s,a}else{if(!h.s)return new p(NaN);if(c+4<=va)return a=$r(p,c+4,d).times(.5),a.s=h.s,a}for(p.precision=l=c+10,p.rounding=1,e=Math.min(28,l/xt+2|0),i=e;i;--i)h=h.div(h.times(h).plus(1).sqrt().plus(1));for(St=!1,t=Math.ceil(l/xt),r=1,f=h.times(h),a=new p(h),n=h;i!==-1;)if(n=n.times(f),s=a.minus(n.div(r+=2)),n=n.times(f),a=s.plus(n.div(r+=2)),a.d[t]!==void 0)for(i=t;a.d[i]===s.d[i]&&i--;);return e&&(a=a.times(2<<e-1)),St=!0,Dt(a,p.precision=c,p.rounding=d,!0)},it.isFinite=function(){return!!this.d},it.isInteger=it.isInt=function(){return!!this.d&&Ue(this.e/xt)>this.d.length-2},it.isNaN=function(){return!this.s},it.isNegative=it.isNeg=function(){return this.s<0},it.isPositive=it.isPos=function(){return this.s>0},it.isZero=function(){return!!this.d&&this.d[0]===0},it.lessThan=it.lt=function(i){return this.cmp(i)<0},it.lessThanOrEqualTo=it.lte=function(i){return this.cmp(i)<1},it.logarithm=it.log=function(i){var t,e,r,n,s,a,l,f,h=this,p=h.constructor,c=p.precision,d=p.rounding,g=5;if(i==null)i=new p(10),t=!0;else{if(i=new p(i),e=i.d,i.s<0||!e||!e[0]||i.eq(1))return new p(NaN);t=i.eq(10)}if(e=h.d,h.s<0||!e||!e[0]||h.eq(1))return new p(e&&!e[0]?-1/0:h.s!=1?NaN:e?0:1/0);if(t)if(e.length>1)s=!0;else{for(n=e[0];n%10===0;)n/=10;s=n!==1}if(St=!1,l=c+g,a=yn(h,l),r=t?Ts(p,l+10):yn(i,l),f=ae(a,r,l,1),Wi(f.d,n=c,d))do if(l+=10,a=yn(h,l),r=t?Ts(p,l+10):yn(i,l),f=ae(a,r,l,1),!s){+Pe(f.d).slice(n+1,n+15)+1==1e14&&(f=Dt(f,c+1,0));break}while(Wi(f.d,n+=10,d));return St=!0,Dt(f,c,d)},it.minus=it.sub=function(i){var t,e,r,n,s,a,l,f,h,p,c,d,g=this,w=g.constructor;if(i=new w(i),!g.d||!i.d)return!g.s||!i.s?i=new w(NaN):g.d?i.s=-i.s:i=new w(i.d||g.s!==i.s?g:NaN),i;if(g.s!=i.s)return i.s=-i.s,g.plus(i);if(h=g.d,d=i.d,l=w.precision,f=w.rounding,!h[0]||!d[0]){if(d[0])i.s=-i.s;else if(h[0])i=new w(g);else return new w(f===3?-0:0);return St?Dt(i,l,f):i}if(e=Ue(i.e/xt),p=Ue(g.e/xt),h=h.slice(),s=p-e,s){for(c=s<0,c?(t=h,s=-s,a=d.length):(t=d,e=p,a=h.length),r=Math.max(Math.ceil(l/xt),a)+2,s>r&&(s=r,t.length=1),t.reverse(),r=s;r--;)t.push(0);t.reverse()}else{for(r=h.length,a=d.length,c=r<a,c&&(a=r),r=0;r<a;r++)if(h[r]!=d[r]){c=h[r]<d[r];break}s=0}for(c&&(t=h,h=d,d=t,i.s=-i.s),a=h.length,r=d.length-a;r>0;--r)h[a++]=0;for(r=d.length;r>s;){if(h[--r]<d[r]){for(n=r;n&&h[--n]===0;)h[n]=Or-1;--h[n],h[r]+=Or}h[r]-=d[r]}for(;h[--a]===0;)h.pop();for(;h[0]===0;h.shift())--e;return h[0]?(i.d=h,i.e=Bs(h,e),St?Dt(i,l,f):i):new w(f===3?-0:0)},it.modulo=it.mod=function(i){var t,e=this,r=e.constructor;return i=new r(i),!e.d||!i.s||i.d&&!i.d[0]?new r(NaN):!i.d||e.d&&!e.d[0]?Dt(new r(e),r.precision,r.rounding):(St=!1,r.modulo==9?(t=ae(e,i.abs(),0,3,1),t.s*=i.s):t=ae(e,i,0,r.modulo,1),t=t.times(i),St=!0,e.minus(t))},it.naturalExponential=it.exp=function(){return wa(this)},it.naturalLogarithm=it.ln=function(){return yn(this)},it.negated=it.neg=function(){var i=new this.constructor(this);return i.s=-i.s,Dt(i)},it.plus=it.add=function(i){var t,e,r,n,s,a,l,f,h,p,c=this,d=c.constructor;if(i=new d(i),!c.d||!i.d)return!c.s||!i.s?i=new d(NaN):c.d||(i=new d(i.d||c.s===i.s?c:NaN)),i;if(c.s!=i.s)return i.s=-i.s,c.minus(i);if(h=c.d,p=i.d,l=d.precision,f=d.rounding,!h[0]||!p[0])return p[0]||(i=new d(c)),St?Dt(i,l,f):i;if(s=Ue(c.e/xt),r=Ue(i.e/xt),h=h.slice(),n=s-r,n){for(n<0?(e=h,n=-n,a=p.length):(e=p,r=s,a=h.length),s=Math.ceil(l/xt),a=s>a?s+1:a+1,n>a&&(n=a,e.length=1),e.reverse();n--;)e.push(0);e.reverse()}for(a=h.length,n=p.length,a-n<0&&(n=a,e=p,p=h,h=e),t=0;n;)t=(h[--n]=h[n]+p[n]+t)/Or|0,h[n]%=Or;for(t&&(h.unshift(t),++r),a=h.length;h[--a]==0;)h.pop();return i.d=h,i.e=Bs(h,r),St?Dt(i,l,f):i},it.precision=it.sd=function(i){var t,e=this;if(i!==void 0&&i!==!!i&&i!==1&&i!==0)throw Error(vn+i);return e.d?(t=ff(e.d),i&&e.e+1>t&&(t=e.e+1)):t=NaN,t},it.round=function(){var i=this,t=i.constructor;return Dt(new t(i),i.e+1,t.rounding)},it.sine=it.sin=function(){var i,t,e=this,r=e.constructor;return e.isFinite()?e.isZero()?new r(e):(i=r.precision,t=r.rounding,r.precision=i+Math.max(e.e,e.sd())+xt,r.rounding=1,e=Vd(r,_f(r,e)),r.precision=i,r.rounding=t,Dt(Vr>2?e.neg():e,i,t,!0)):new r(NaN)},it.squareRoot=it.sqrt=function(){var i,t,e,r,n,s,a=this,l=a.d,f=a.e,h=a.s,p=a.constructor;if(h!==1||!l||!l[0])return new p(!h||h<0&&(!l||l[0])?NaN:l?a:1/0);for(St=!1,h=Math.sqrt(+a),h==0||h==1/0?(t=Pe(l),(t.length+f)%2==0&&(t+="0"),h=Math.sqrt(t),f=Ue((f+1)/2)-(f<0||f%2),h==1/0?t="5e"+f:(t=h.toExponential(),t=t.slice(0,t.indexOf("e")+1)+f),r=new p(t)):r=new p(h.toString()),e=(f=p.precision)+3;;)if(s=r,r=s.plus(ae(a,s,e+2,1)).times(.5),Pe(s.d).slice(0,e)===(t=Pe(r.d)).slice(0,e))if(t=t.slice(e-3,e+1),t=="9999"||!n&&t=="4999"){if(!n&&(Dt(s,f+1,0),s.times(s).eq(a))){r=s;break}e+=4,n=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(Dt(r,f+1,1),i=!r.times(r).eq(a));break}return St=!0,Dt(r,f,p.rounding,i)},it.tangent=it.tan=function(){var i,t,e=this,r=e.constructor;return e.isFinite()?e.isZero()?new r(e):(i=r.precision,t=r.rounding,r.precision=i+10,r.rounding=1,e=e.sin(),e.s=1,e=ae(e,new r(1).minus(e.times(e)).sqrt(),i+10,0),r.precision=i,r.rounding=t,Dt(Vr==2||Vr==4?e.neg():e,i,t,!0)):new r(NaN)},it.times=it.mul=function(i){var t,e,r,n,s,a,l,f,h,p=this,c=p.constructor,d=p.d,g=(i=new c(i)).d;if(i.s*=p.s,!d||!d[0]||!g||!g[0])return new c(!i.s||d&&!d[0]&&!g||g&&!g[0]&&!d?NaN:!d||!g?i.s/0:i.s*0);for(e=Ue(p.e/xt)+Ue(i.e/xt),f=d.length,h=g.length,f<h&&(s=d,d=g,g=s,a=f,f=h,h=a),s=[],a=f+h,r=a;r--;)s.push(0);for(r=h;--r>=0;){for(t=0,n=f+r;n>r;)l=s[n]+g[r]*d[n-r-1]+t,s[n--]=l%Or|0,t=l/Or|0;s[n]=(s[n]+t)%Or|0}for(;!s[--a];)s.pop();return t?++e:s.shift(),i.d=s,i.e=Bs(s,e),St?Dt(i,c.precision,c.rounding):i},it.toBinary=function(i,t){return Da(this,2,i,t)},it.toDecimalPlaces=it.toDP=function(i,t){var e=this,r=e.constructor;return e=new r(e),i===void 0?e:(Ve(i,0,gn),t===void 0?t=r.rounding:Ve(t,0,8),Dt(e,i+e.e+1,t))},it.toExponential=function(i,t){var e,r=this,n=r.constructor;return i===void 0?e=Zr(r,!0):(Ve(i,0,gn),t===void 0?t=n.rounding:Ve(t,0,8),r=Dt(new n(r),i+1,t),e=Zr(r,!0,i+1)),r.isNeg()&&!r.isZero()?"-"+e:e},it.toFixed=function(i,t){var e,r,n=this,s=n.constructor;return i===void 0?e=Zr(n):(Ve(i,0,gn),t===void 0?t=s.rounding:Ve(t,0,8),r=Dt(new s(n),i+n.e+1,t),e=Zr(r,!1,i+r.e+1)),n.isNeg()&&!n.isZero()?"-"+e:e},it.toFraction=function(i){var t,e,r,n,s,a,l,f,h,p,c,d,g=this,w=g.d,m=g.constructor;if(!w)return new m(g);if(h=e=new m(1),r=f=new m(0),t=new m(r),s=t.e=ff(w)-g.e-1,a=s%xt,t.d[0]=Se(10,a<0?xt+a:a),i==null)i=s>0?t:h;else{if(l=new m(i),!l.isInt()||l.lt(h))throw Error(vn+l);i=l.gt(t)?s>0?t:h:l}for(St=!1,l=new m(Pe(w)),p=m.precision,m.precision=s=w.length*xt*2;c=ae(l,t,0,1,1),n=e.plus(c.times(r)),n.cmp(i)!=1;)e=r,r=n,n=h,h=f.plus(c.times(n)),f=n,n=t,t=l.minus(c.times(n)),l=n;return n=ae(i.minus(e),r,0,1,1),f=f.plus(n.times(h)),e=e.plus(n.times(r)),f.s=h.s=g.s,d=ae(h,r,s,1).minus(g).abs().cmp(ae(f,e,s,1).minus(g).abs())<1?[h,r]:[f,e],m.precision=p,St=!0,d},it.toHexadecimal=it.toHex=function(i,t){return Da(this,16,i,t)},it.toNearest=function(i,t){var e=this,r=e.constructor;if(e=new r(e),i==null){if(!e.d)return e;i=new r(1),t=r.rounding}else{if(i=new r(i),t===void 0?t=r.rounding:Ve(t,0,8),!e.d)return i.s?e:i;if(!i.d)return i.s&&(i.s=e.s),i}return i.d[0]?(St=!1,e=ae(e,i,0,t,1).times(i),St=!0,Dt(e)):(i.s=e.s,e=i),e},it.toNumber=function(){return+this},it.toOctal=function(i,t){return Da(this,8,i,t)},it.toPower=it.pow=function(i){var t,e,r,n,s,a,l=this,f=l.constructor,h=+(i=new f(i));if(!l.d||!i.d||!l.d[0]||!i.d[0])return new f(Se(+l,h));if(l=new f(l),l.eq(1))return l;if(r=f.precision,s=f.rounding,i.eq(1))return Dt(l,r,s);if(t=Ue(i.e/xt),t>=i.d.length-1&&(e=h<0?-h:h)<=Kd)return n=cf(f,l,e,r),i.s<0?new f(1).div(n):Dt(n,r,s);if(a=l.s,a<0){if(t<i.d.length-1)return new f(NaN);if(i.d[t]&1||(a=1),l.e==0&&l.d[0]==1&&l.d.length==1)return l.s=a,l}return e=Se(+l,h),t=e==0||!isFinite(e)?Ue(h*(Math.log("0."+Pe(l.d))/Math.LN10+l.e+1)):new f(e+"").e,t>f.maxE+1||t<f.minE-1?new f(t>0?a/0:0):(St=!1,f.rounding=l.s=1,e=Math.min(12,(t+"").length),n=wa(i.times(yn(l,r+e)),r),n.d&&(n=Dt(n,r+5,1),Wi(n.d,r,s)&&(t=r+10,n=Dt(wa(i.times(yn(l,t+e)),t),t+5,1),+Pe(n.d).slice(r+1,r+15)+1==1e14&&(n=Dt(n,r+1,0)))),n.s=a,St=!0,f.rounding=s,Dt(n,r,s))},it.toPrecision=function(i,t){var e,r=this,n=r.constructor;return i===void 0?e=Zr(r,r.e<=n.toExpNeg||r.e>=n.toExpPos):(Ve(i,1,gn),t===void 0?t=n.rounding:Ve(t,0,8),r=Dt(new n(r),i,t),e=Zr(r,i<=r.e||r.e<=n.toExpNeg,i)),r.isNeg()&&!r.isZero()?"-"+e:e},it.toSignificantDigits=it.toSD=function(i,t){var e=this,r=e.constructor;return i===void 0?(i=r.precision,t=r.rounding):(Ve(i,1,gn),t===void 0?t=r.rounding:Ve(t,0,8)),Dt(new r(e),i,t)},it.toString=function(){var i=this,t=i.constructor,e=Zr(i,i.e<=t.toExpNeg||i.e>=t.toExpPos);return i.isNeg()&&!i.isZero()?"-"+e:e},it.truncated=it.trunc=function(){return Dt(new this.constructor(this),this.e+1,1)},it.valueOf=it.toJSON=function(){var i=this,t=i.constructor,e=Zr(i,i.e<=t.toExpNeg||i.e>=t.toExpPos);return i.isNeg()?"-"+e:e};function Pe(i){var t,e,r,n=i.length-1,s="",a=i[0];if(n>0){for(s+=a,t=1;t<n;t++)r=i[t]+"",e=xt-r.length,e&&(s+=wn(e)),s+=r;a=i[t],r=a+"",e=xt-r.length,e&&(s+=wn(e))}else if(a===0)return"0";for(;a%10===0;)a/=10;return s+a}function Ve(i,t,e){if(i!==~~i||i<t||i>e)throw Error(vn+i)}function Wi(i,t,e,r){var n,s,a,l;for(s=i[0];s>=10;s/=10)--t;return--t<0?(t+=xt,n=0):(n=Math.ceil((t+1)/xt),t%=xt),s=Se(10,xt-t),l=i[n]%s|0,r==null?t<3?(t==0?l=l/100|0:t==1&&(l=l/10|0),a=e<4&&l==99999||e>3&&l==49999||l==5e4||l==0):a=(e<4&&l+1==s||e>3&&l+1==s/2)&&(i[n+1]/s/100|0)==Se(10,t-2)-1||(l==s/2||l==0)&&(i[n+1]/s/100|0)==0:t<4?(t==0?l=l/1e3|0:t==1?l=l/100|0:t==2&&(l=l/10|0),a=(r||e<4)&&l==9999||!r&&e>3&&l==4999):a=((r||e<4)&&l+1==s||!r&&e>3&&l+1==s/2)&&(i[n+1]/s/1e3|0)==Se(10,t-3)-1,a}function Ss(i,t,e){for(var r,n=[0],s,a=0,l=i.length;a<l;){for(s=n.length;s--;)n[s]*=t;for(n[0]+=ma.indexOf(i.charAt(a++)),r=0;r<n.length;r++)n[r]>e-1&&(n[r+1]===void 0&&(n[r+1]=0),n[r+1]+=n[r]/e|0,n[r]%=e)}return n.reverse()}function Jd(i,t){var e,r,n;if(t.isZero())return t;r=t.d.length,r<32?(e=Math.ceil(r/3),n=(1/Is(4,e)).toString()):(e=16,n="2.3283064365386962890625e-10"),i.precision+=e,t=fi(i,1,t.times(n),new i(1));for(var s=e;s--;){var a=t.times(t);t=a.times(a).minus(a).times(8).plus(1)}return i.precision-=e,t}var ae=function(){function i(r,n,s){var a,l=0,f=r.length;for(r=r.slice();f--;)a=r[f]*n+l,r[f]=a%s|0,l=a/s|0;return l&&r.unshift(l),r}function t(r,n,s,a){var l,f;if(s!=a)f=s>a?1:-1;else for(l=f=0;l<s;l++)if(r[l]!=n[l]){f=r[l]>n[l]?1:-1;break}return f}function e(r,n,s,a){for(var l=0;s--;)r[s]-=l,l=r[s]<n[s]?1:0,r[s]=l*a+r[s]-n[s];for(;!r[0]&&r.length>1;)r.shift()}return function(r,n,s,a,l,f){var h,p,c,d,g,w,m,D,v,E,b,N,x,F,M,S,O,C,T,L,U=r.constructor,k=r.s==n.s?1:-1,W=r.d,P=n.d;if(!W||!W[0]||!P||!P[0])return new U(!r.s||!n.s||(W?P&&W[0]==P[0]:!P)?NaN:W&&W[0]==0||!P?k*0:k/0);for(f?(g=1,p=r.e-n.e):(f=Or,g=xt,p=Ue(r.e/g)-Ue(n.e/g)),T=P.length,O=W.length,v=new U(k),E=v.d=[],c=0;P[c]==(W[c]||0);c++);if(P[c]>(W[c]||0)&&p--,s==null?(F=s=U.precision,a=U.rounding):l?F=s+(r.e-n.e)+1:F=s,F<0)E.push(1),w=!0;else{if(F=F/g+2|0,c=0,T==1){for(d=0,P=P[0],F++;(c<O||d)&&F--;c++)M=d*f+(W[c]||0),E[c]=M/P|0,d=M%P|0;w=d||c<O}else{for(d=f/(P[0]+1)|0,d>1&&(P=i(P,d,f),W=i(W,d,f),T=P.length,O=W.length),S=T,b=W.slice(0,T),N=b.length;N<T;)b[N++]=0;L=P.slice(),L.unshift(0),C=P[0],P[1]>=f/2&&++C;do d=0,h=t(P,b,T,N),h<0?(x=b[0],T!=N&&(x=x*f+(b[1]||0)),d=x/C|0,d>1?(d>=f&&(d=f-1),m=i(P,d,f),D=m.length,N=b.length,h=t(m,b,D,N),h==1&&(d--,e(m,T<D?L:P,D,f))):(d==0&&(h=d=1),m=P.slice()),D=m.length,D<N&&m.unshift(0),e(b,m,N,f),h==-1&&(N=b.length,h=t(P,b,T,N),h<1&&(d++,e(b,T<N?L:P,N,f))),N=b.length):h===0&&(d++,b=[0]),E[c++]=d,h&&b[0]?b[N++]=W[S]||0:(b=[W[S]],N=1);while((S++<O||b[0]!==void 0)&&F--);w=b[0]!==void 0}E[0]||E.shift()}if(g==1)v.e=p,sf=w;else{for(c=1,d=E[0];d>=10;d/=10)c++;v.e=c+p*g-1,Dt(v,l?s+v.e+1:s,a,w)}return v}}();function Dt(i,t,e,r){var n,s,a,l,f,h,p,c,d,g=i.constructor;t:if(t!=null){if(c=i.d,!c)return i;for(n=1,l=c[0];l>=10;l/=10)n++;if(s=t-n,s<0)s+=xt,a=t,p=c[d=0],f=p/Se(10,n-a-1)%10|0;else if(d=Math.ceil((s+1)/xt),l=c.length,d>=l)if(r){for(;l++<=d;)c.push(0);p=f=0,n=1,s%=xt,a=s-xt+1}else break t;else{for(p=l=c[d],n=1;l>=10;l/=10)n++;s%=xt,a=s-xt+n,f=a<0?0:p/Se(10,n-a-1)%10|0}if(r=r||t<0||c[d+1]!==void 0||(a<0?p:p%Se(10,n-a-1)),h=e<4?(f||r)&&(e==0||e==(i.s<0?3:2)):f>5||f==5&&(e==4||r||e==6&&(s>0?a>0?p/Se(10,n-a):0:c[d-1])%10&1||e==(i.s<0?8:7)),t<1||!c[0])return c.length=0,h?(t-=i.e+1,c[0]=Se(10,(xt-t%xt)%xt),i.e=-t||0):c[0]=i.e=0,i;if(s==0?(c.length=d,l=1,d--):(c.length=d+1,l=Se(10,xt-s),c[d]=a>0?(p/Se(10,n-a)%Se(10,a)|0)*l:0),h)for(;;)if(d==0){for(s=1,a=c[0];a>=10;a/=10)s++;for(a=c[0]+=l,l=1;a>=10;a/=10)l++;s!=l&&(i.e++,c[0]==Or&&(c[0]=1));break}else{if(c[d]+=l,c[d]!=Or)break;c[d--]=0,l=1}for(s=c.length;c[--s]===0;)c.pop()}return St&&(i.e>g.maxE?(i.d=null,i.e=NaN):i.e<g.minE&&(i.e=0,i.d=[0])),i}function Zr(i,t,e){if(!i.isFinite())return df(i);var r,n=i.e,s=Pe(i.d),a=s.length;return t?(e&&(r=e-a)>0?s=s.charAt(0)+"."+s.slice(1)+wn(r):a>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(i.e<0?"e":"e+")+i.e):n<0?(s="0."+wn(-n-1)+s,e&&(r=e-a)>0&&(s+=wn(r))):n>=a?(s+=wn(n+1-a),e&&(r=e-n-1)>0&&(s=s+"."+wn(r))):((r=n+1)<a&&(s=s.slice(0,r)+"."+s.slice(r)),e&&(r=e-a)>0&&(n+1===a&&(s+="."),s+=wn(r))),s}function Bs(i,t){var e=i[0];for(t*=xt;e>=10;e/=10)t++;return t}function Ts(i,t,e){if(t>Hd)throw St=!0,e&&(i.precision=e),Error(of);return Dt(new i(Fs),t,1,!0)}function $r(i,t,e){if(t>va)throw Error(of);return Dt(new i(Ms),t,e,!0)}function ff(i){var t=i.length-1,e=t*xt+1;if(t=i[t],t){for(;t%10==0;t/=10)e--;for(t=i[0];t>=10;t/=10)e++}return e}function wn(i){for(var t="";i--;)t+="0";return t}function cf(i,t,e,r){var n,s=new i(1),a=Math.ceil(r/xt+4);for(St=!1;;){if(e%2&&(s=s.times(t),mf(s.d,a)&&(n=!0)),e=Ue(e/2),e===0){e=s.d.length-1,n&&s.d[e]===0&&++s.d[e];break}t=t.times(t),mf(t.d,a)}return St=!0,s}function hf(i){return i.d[i.d.length-1]&1}function pf(i,t,e){for(var r,n=new i(t[0]),s=0;++s<t.length;)if(r=new i(t[s]),r.s)n[e](r)&&(n=r);else{n=r;break}return n}function wa(i,t){var e,r,n,s,a,l,f,h=0,p=0,c=0,d=i.constructor,g=d.rounding,w=d.precision;if(!i.d||!i.d[0]||i.e>17)return new d(i.d?i.d[0]?i.s<0?0:1/0:1:i.s?i.s<0?0:i:NaN);for(t==null?(St=!1,f=w):f=t,l=new d(.03125);i.e>-2;)i=i.times(l),c+=5;for(r=Math.log(Se(2,c))/Math.LN10*2+5|0,f+=r,e=s=a=new d(1),d.precision=f;;){if(s=Dt(s.times(i),f,1),e=e.times(++p),l=a.plus(ae(s,e,f,1)),Pe(l.d).slice(0,f)===Pe(a.d).slice(0,f)){for(n=c;n--;)a=Dt(a.times(a),f,1);if(t==null)if(h<3&&Wi(a.d,f-r,g,h))d.precision=f+=10,e=s=l=new d(1),p=0,h++;else return Dt(a,d.precision=w,g,St=!0);else return d.precision=w,a}a=l}}function yn(i,t){var e,r,n,s,a,l,f,h,p,c,d,g=1,w=10,m=i,D=m.d,v=m.constructor,E=v.rounding,b=v.precision;if(m.s<0||!D||!D[0]||!m.e&&D[0]==1&&D.length==1)return new v(D&&!D[0]?-1/0:m.s!=1?NaN:D?0:m);if(t==null?(St=!1,p=b):p=t,v.precision=p+=w,e=Pe(D),r=e.charAt(0),Math.abs(s=m.e)<15e14){for(;r<7&&r!=1||r==1&&e.charAt(1)>3;)m=m.times(i),e=Pe(m.d),r=e.charAt(0),g++;s=m.e,r>1?(m=new v("0."+e),s++):m=new v(r+"."+e.slice(1))}else return h=Ts(v,p+2,b).times(s+""),m=yn(new v(r+"."+e.slice(1)),p-w).plus(h),v.precision=b,t==null?Dt(m,b,E,St=!0):m;for(c=m,f=a=m=ae(m.minus(1),m.plus(1),p,1),d=Dt(m.times(m),p,1),n=3;;){if(a=Dt(a.times(d),p,1),h=f.plus(ae(a,new v(n),p,1)),Pe(h.d).slice(0,p)===Pe(f.d).slice(0,p))if(f=f.times(2),s!==0&&(f=f.plus(Ts(v,p+2,b).times(s+""))),f=ae(f,new v(g),p,1),t==null)if(Wi(f.d,p-w,E,l))v.precision=p+=w,h=a=m=ae(c.minus(1),c.plus(1),p,1),d=Dt(m.times(m),p,1),n=l=1;else return Dt(f,v.precision=b,E,St=!0);else return v.precision=b,f;f=h,n+=2}}function df(i){return String(i.s*i.s/0)}function ya(i,t){var e,r,n;for((e=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(e<0&&(e=r),e+=+t.slice(r+1),t=t.substring(0,r)):e<0&&(e=t.length),r=0;t.charCodeAt(r)===48;r++);for(n=t.length;t.charCodeAt(n-1)===48;--n);if(t=t.slice(r,n),t){if(n-=r,i.e=e=e-r-1,i.d=[],r=(e+1)%xt,e<0&&(r+=xt),r<n){for(r&&i.d.push(+t.slice(0,r)),n-=xt;r<n;)i.d.push(+t.slice(r,r+=xt));t=t.slice(r),r=xt-t.length}else r-=n;for(;r--;)t+="0";i.d.push(+t),St&&(i.e>i.constructor.maxE?(i.d=null,i.e=NaN):i.e<i.constructor.minE&&(i.e=0,i.d=[0]))}else i.e=0,i.d=[0];return i}function Xd(i,t){var e,r,n,s,a,l,f,h,p;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),lf.test(t))return ya(i,t)}else if(t==="Infinity"||t==="NaN")return+t||(i.s=NaN),i.e=NaN,i.d=null,i;if(Zd.test(t))e=16,t=t.toLowerCase();else if(Yd.test(t))e=2;else if(Gd.test(t))e=8;else throw Error(vn+t);for(s=t.search(/p/i),s>0?(f=+t.slice(s+1),t=t.substring(2,s)):t=t.slice(2),s=t.indexOf("."),a=s>=0,r=i.constructor,a&&(t=t.replace(".",""),l=t.length,s=l-s,n=cf(r,new r(e),s,s*2)),h=Ss(t,e,Or),p=h.length-1,s=p;h[s]===0;--s)h.pop();return s<0?new r(i.s*0):(i.e=Bs(h,p),i.d=h,St=!1,a&&(i=ae(i,n,l*4)),f&&(i=i.times(Math.abs(f)<54?Se(2,f):ci.pow(2,f))),St=!0,i)}function Vd(i,t){var e,r=t.d.length;if(r<3)return t.isZero()?t:fi(i,2,t,t);e=1.4*Math.sqrt(r),e=e>16?16:e|0,t=t.times(1/Is(5,e)),t=fi(i,2,t,t);for(var n,s=new i(5),a=new i(16),l=new i(20);e--;)n=t.times(t),t=t.times(s.plus(n.times(a.times(n).minus(l))));return t}function fi(i,t,e,r,n){var s,a,l,f,h=i.precision,p=Math.ceil(h/xt);for(St=!1,f=e.times(e),l=new i(r);;){if(a=ae(l.times(f),new i(t++*t++),h,1),l=n?r.plus(a):r.minus(a),r=ae(a.times(f),new i(t++*t++),h,1),a=l.plus(r),a.d[p]!==void 0){for(s=p;a.d[s]===l.d[s]&&s--;);if(s==-1)break}s=l,l=r,r=a,a=s}return St=!0,a.d.length=p+1,a}function Is(i,t){for(var e=i;--t;)e*=i;return e}function _f(i,t){var e,r=t.s<0,n=$r(i,i.precision,1),s=n.times(.5);if(t=t.abs(),t.lte(s))return Vr=r?4:1,t;if(e=t.divToInt(n),e.isZero())Vr=r?3:2;else{if(t=t.minus(e.times(n)),t.lte(s))return Vr=hf(e)?r?2:3:r?4:1,t;Vr=hf(e)?r?1:4:r?3:2}return t.minus(n).abs()}function Da(i,t,e,r){var n,s,a,l,f,h,p,c,d,g=i.constructor,w=e!==void 0;if(w?(Ve(e,1,gn),r===void 0?r=g.rounding:Ve(r,0,8)):(e=g.precision,r=g.rounding),!i.isFinite())p=df(i);else{for(p=Zr(i),a=p.indexOf("."),w?(n=2,t==16?e=e*4-3:t==8&&(e=e*3-2)):n=t,a>=0&&(p=p.replace(".",""),d=new g(1),d.e=p.length-a,d.d=Ss(Zr(d),10,n),d.e=d.d.length),c=Ss(p,10,n),s=f=c.length;c[--f]==0;)c.pop();if(!c[0])p=w?"0p+0":"0";else{if(a<0?s--:(i=new g(i),i.d=c,i.e=s,i=ae(i,d,e,r,0,n),c=i.d,s=i.e,h=sf),a=c[e],l=n/2,h=h||c[e+1]!==void 0,h=r<4?(a!==void 0||h)&&(r===0||r===(i.s<0?3:2)):a>l||a===l&&(r===4||h||r===6&&c[e-1]&1||r===(i.s<0?8:7)),c.length=e,h)for(;++c[--e]>n-1;)c[e]=0,e||(++s,c.unshift(1));for(f=c.length;!c[f-1];--f);for(a=0,p="";a<f;a++)p+=ma.charAt(c[a]);if(w){if(f>1)if(t==16||t==8){for(a=t==16?4:3,--f;f%a;f++)p+="0";for(c=Ss(p,n,t),f=c.length;!c[f-1];--f);for(a=1,p="1.";a<f;a++)p+=ma.charAt(c[a])}else p=p.charAt(0)+"."+p.slice(1);p=p+(s<0?"p":"p+")+s}else if(s<0){for(;++s;)p="0"+p;p="0."+p}else if(++s>f)for(s-=f;s--;)p+="0";else s<f&&(p=p.slice(0,s)+"."+p.slice(s))}p=(t==16?"0x":t==2?"0b":t==8?"0o":"")+p}return i.s<0?"-"+p:p}function mf(i,t){if(i.length>t)return i.length=t,!0}function Qd(i){return new this(i).abs()}function t_(i){return new this(i).acos()}function e_(i){return new this(i).acosh()}function r_(i,t){return new this(i).plus(t)}function n_(i){return new this(i).asin()}function i_(i){return new this(i).asinh()}function s_(i){return new this(i).atan()}function o_(i){return new this(i).atanh()}function a_(i,t){i=new this(i),t=new this(t);var e,r=this.precision,n=this.rounding,s=r+4;return!i.s||!t.s?e=new this(NaN):!i.d&&!t.d?(e=$r(this,s,1).times(t.s>0?.25:.75),e.s=i.s):!t.d||i.isZero()?(e=t.s<0?$r(this,r,n):new this(0),e.s=i.s):!i.d||t.isZero()?(e=$r(this,s,1).times(.5),e.s=i.s):t.s<0?(this.precision=s,this.rounding=1,e=this.atan(ae(i,t,s,1)),t=$r(this,s,1),this.precision=r,this.rounding=n,e=i.s<0?e.minus(t):e.plus(t)):e=this.atan(ae(i,t,s,1)),e}function u_(i){return new this(i).cbrt()}function l_(i){return Dt(i=new this(i),i.e+1,2)}function f_(i,t,e){return new this(i).clamp(t,e)}function c_(i){if(!i||typeof i!="object")throw Error(Ns+"Object expected");var t,e,r,n=i.defaults===!0,s=["precision",1,gn,"rounding",0,8,"toExpNeg",-li,0,"toExpPos",0,li,"maxE",0,li,"minE",-li,0,"modulo",0,9];for(t=0;t<s.length;t+=3)if(e=s[t],n&&(this[e]=ga[e]),(r=i[e])!==void 0)if(Ue(r)===r&&r>=s[t+1]&&r<=s[t+2])this[e]=r;else throw Error(vn+e+": "+r);if(e="crypto",n&&(this[e]=ga[e]),(r=i[e])!==void 0)if(r===!0||r===!1||r===0||r===1)if(r)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[e]=!0;else throw Error(af);else this[e]=!1;else throw Error(vn+e+": "+r);return this}function h_(i){return new this(i).cos()}function p_(i){return new this(i).cosh()}function gf(i){var t,e,r;function n(s){var a,l,f,h=this;if(!(h instanceof n))return new n(s);if(h.constructor=n,vf(s)){h.s=s.s,St?!s.d||s.e>n.maxE?(h.e=NaN,h.d=null):s.e<n.minE?(h.e=0,h.d=[0]):(h.e=s.e,h.d=s.d.slice()):(h.e=s.e,h.d=s.d?s.d.slice():s.d);return}if(f=typeof s,f==="number"){if(s===0){h.s=1/s<0?-1:1,h.e=0,h.d=[0];return}if(s<0?(s=-s,h.s=-1):h.s=1,s===~~s&&s<1e7){for(a=0,l=s;l>=10;l/=10)a++;St?a>n.maxE?(h.e=NaN,h.d=null):a<n.minE?(h.e=0,h.d=[0]):(h.e=a,h.d=[s]):(h.e=a,h.d=[s]);return}else if(s*0!==0){s||(h.s=NaN),h.e=NaN,h.d=null;return}return ya(h,s.toString())}else if(f!=="string")throw Error(vn+s);return(l=s.charCodeAt(0))===45?(s=s.slice(1),h.s=-1):(l===43&&(s=s.slice(1)),h.s=1),lf.test(s)?ya(h,s):Xd(h,s)}if(n.prototype=it,n.ROUND_UP=0,n.ROUND_DOWN=1,n.ROUND_CEIL=2,n.ROUND_FLOOR=3,n.ROUND_HALF_UP=4,n.ROUND_HALF_DOWN=5,n.ROUND_HALF_EVEN=6,n.ROUND_HALF_CEIL=7,n.ROUND_HALF_FLOOR=8,n.EUCLID=9,n.config=n.set=c_,n.clone=gf,n.isDecimal=vf,n.abs=Qd,n.acos=t_,n.acosh=e_,n.add=r_,n.asin=n_,n.asinh=i_,n.atan=s_,n.atanh=o_,n.atan2=a_,n.cbrt=u_,n.ceil=l_,n.clamp=f_,n.cos=h_,n.cosh=p_,n.div=d_,n.exp=__,n.floor=m_,n.hypot=g_,n.ln=v_,n.log=w_,n.log10=D_,n.log2=y_,n.max=b_,n.min=E_,n.mod=x_,n.mul=A_,n.pow=C_,n.random=F_,n.round=M_,n.sign=N_,n.sin=S_,n.sinh=B_,n.sqrt=T_,n.sub=I_,n.sum=O_,n.tan=$_,n.tanh=L_,n.trunc=R_,i===void 0&&(i={}),i&&i.defaults!==!0)for(r=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],t=0;t<r.length;)i.hasOwnProperty(e=r[t++])||(i[e]=this[e]);return n.config(i),n}function d_(i,t){return new this(i).div(t)}function __(i){return new this(i).exp()}function m_(i){return Dt(i=new this(i),i.e+1,3)}function g_(){var i,t,e=new this(0);for(St=!1,i=0;i<arguments.length;)if(t=new this(arguments[i++]),t.d)e.d&&(e=e.plus(t.times(t)));else{if(t.s)return St=!0,new this(1/0);e=t}return St=!0,e.sqrt()}function vf(i){return i instanceof ci||i&&i.toStringTag===uf||!1}function v_(i){return new this(i).ln()}function w_(i,t){return new this(i).log(t)}function y_(i){return new this(i).log(2)}function D_(i){return new this(i).log(10)}function b_(){return pf(this,arguments,"lt")}function E_(){return pf(this,arguments,"gt")}function x_(i,t){return new this(i).mod(t)}function A_(i,t){return new this(i).mul(t)}function C_(i,t){return new this(i).pow(t)}function F_(i){var t,e,r,n,s=0,a=new this(1),l=[];if(i===void 0?i=this.precision:Ve(i,1,gn),r=Math.ceil(i/xt),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(r));s<r;)n=t[s],n>=429e7?t[s]=crypto.getRandomValues(new Uint32Array(1))[0]:l[s++]=n%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(r*=4);s<r;)n=t[s]+(t[s+1]<<8)+(t[s+2]<<16)+((t[s+3]&127)<<24),n>=214e7?crypto.randomBytes(4).copy(t,s):(l.push(n%1e7),s+=4);s=r/4}else throw Error(af);else for(;s<r;)l[s++]=Math.random()*1e7|0;for(r=l[--s],i%=xt,r&&i&&(n=Se(10,xt-i),l[s]=(r/n|0)*n);l[s]===0;s--)l.pop();if(s<0)e=0,l=[0];else{for(e=-1;l[0]===0;e-=xt)l.shift();for(r=1,n=l[0];n>=10;n/=10)r++;r<xt&&(e-=xt-r)}return a.e=e,a.d=l,a}function M_(i){return Dt(i=new this(i),i.e+1,this.rounding)}function N_(i){return i=new this(i),i.d?i.d[0]?i.s:0*i.s:i.s||NaN}function S_(i){return new this(i).sin()}function B_(i){return new this(i).sinh()}function T_(i){return new this(i).sqrt()}function I_(i,t){return new this(i).sub(t)}function O_(){var i=0,t=arguments,e=new this(t[i]);for(St=!1;e.s&&++i<t.length;)e=e.plus(t[i]);return St=!0,Dt(e,this.precision,this.rounding)}function $_(i){return new this(i).tan()}function L_(i){return new this(i).tanh()}function R_(i){return Dt(i=new this(i),i.e+1,1)}it[Symbol.for("nodejs.util.inspect.custom")]=it.toString,it[Symbol.toStringTag]="Decimal";var ci=it.constructor=gf(ga);Fs=new ci(Fs),Ms=new ci(Ms);var P_="BigNumber",z_=["?on","config"],q_=mt(P_,z_,i=>{var{on:t,config:e}=i,r=ci.clone({precision:e.precision,modulo:ci.EUCLID});return r.prototype=Object.create(r.prototype),r.prototype.type="BigNumber",r.prototype.isBigNumber=!0,r.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},r.fromJSON=function(n){return new r(n.value)},t&&t("config",function(n,s){n.precision!==s.precision&&r.config({precision:n.precision})}),r},{isClass:!0}),wf={exports:{}};/**
|
41
41
|
* @license Complex.js v2.1.1 12/05/2020
|
42
42
|
*
|
43
43
|
* Copyright (c) 2020, Robert Eisele (robert@xarg.org)
|
44
44
|
* Dual licensed under the MIT or GPL Version 2 licenses.
|
45
45
|
**/(function(i,t){(function(e){var r=Math.cosh||function(c){return Math.abs(c)<1e-9?1-c:(Math.exp(c)+Math.exp(-c))*.5},n=Math.sinh||function(c){return Math.abs(c)<1e-9?c:(Math.exp(c)-Math.exp(-c))*.5},s=function(c){var d=Math.PI/4;if(-d>c||c>d)return Math.cos(c)-1;var g=c*c;return g*(g*(g*(g*(g*(g*(g*(g/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-1/2)},a=function(c,d){var g=Math.abs(c),w=Math.abs(d);return g<3e3&&w<3e3?Math.sqrt(g*g+w*w):(g<w?(g=w,w=c/d):w=d/c,g*Math.sqrt(1+w*w))},l=function(){throw SyntaxError("Invalid Param")};function f(c,d){var g=Math.abs(c),w=Math.abs(d);return c===0?Math.log(w):d===0?Math.log(g):g<3e3&&w<3e3?Math.log(c*c+d*d)*.5:(c=c/2,d=d/2,.5*Math.log(c*c+d*d)+Math.LN2)}var h=function(c,d){var g={re:0,im:0};if(c==null)g.re=g.im=0;else if(d!==void 0)g.re=c,g.im=d;else switch(typeof c){case"object":if("im"in c&&"re"in c)g.re=c.re,g.im=c.im;else if("abs"in c&&"arg"in c){if(!Number.isFinite(c.abs)&&Number.isFinite(c.arg))return p.INFINITY;g.re=c.abs*Math.cos(c.arg),g.im=c.abs*Math.sin(c.arg)}else if("r"in c&&"phi"in c){if(!Number.isFinite(c.r)&&Number.isFinite(c.phi))return p.INFINITY;g.re=c.r*Math.cos(c.phi),g.im=c.r*Math.sin(c.phi)}else c.length===2?(g.re=c[0],g.im=c[1]):l();break;case"string":g.im=g.re=0;var w=c.match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),m=1,D=0;w===null&&l();for(var v=0;v<w.length;v++){var E=w[v];E===" "||E===" "||E===`
|
46
|
-
`||(E==="+"?m++:E==="-"?D++:E==="i"||E==="I"?(m+D===0&&l(),w[v+1]!==" "&&!isNaN(w[v+1])?(g.im+=parseFloat((D%2?"-":"")+w[v+1]),v++):g.im+=parseFloat((D%2?"-":"")+"1"),m=D=0):((m+D===0||isNaN(E))&&l(),w[v+1]==="i"||w[v+1]==="I"?(g.im+=parseFloat((D%2?"-":"")+E),v++):g.re+=parseFloat((D%2?"-":"")+E),m=D=0))}m+D>0&&l();break;case"number":g.im=0,g.re=c;break;default:l()}return isNaN(g.re)||isNaN(g.im),g};function p(c,d){if(!(this instanceof p))return new p(c,d);var g=h(c,d);this.re=g.re,this.im=g.im}p.prototype={re:0,im:0,sign:function(){var c=this.abs();return new p(this.re/c,this.im/c)},add:function(c,d){var g=new p(c,d);return this.isInfinite()&&g.isInfinite()?p.NAN:this.isInfinite()||g.isInfinite()?p.INFINITY:new p(this.re+g.re,this.im+g.im)},sub:function(c,d){var g=new p(c,d);return this.isInfinite()&&g.isInfinite()?p.NAN:this.isInfinite()||g.isInfinite()?p.INFINITY:new p(this.re-g.re,this.im-g.im)},mul:function(c,d){var g=new p(c,d);return this.isInfinite()&&g.isZero()||this.isZero()&&g.isInfinite()?p.NAN:this.isInfinite()||g.isInfinite()?p.INFINITY:g.im===0&&this.im===0?new p(this.re*g.re,0):new p(this.re*g.re-this.im*g.im,this.re*g.im+this.im*g.re)},div:function(c,d){var g=new p(c,d);if(this.isZero()&&g.isZero()||this.isInfinite()&&g.isInfinite())return p.NAN;if(this.isInfinite()||g.isZero())return p.INFINITY;if(this.isZero()||g.isInfinite())return p.ZERO;c=this.re,d=this.im;var w=g.re,m=g.im,D,v;return m===0?new p(c/w,d/w):Math.abs(w)<Math.abs(m)?(v=w/m,D=w*v+m,new p((c*v+d)/D,(d*v-c)/D)):(v=m/w,D=m*v+w,new p((c+d*v)/D,(d-c*v)/D))},pow:function(c,d){var g=new p(c,d);if(c=this.re,d=this.im,g.isZero())return p.ONE;if(g.im===0){if(d===0&&c>0)return new p(Math.pow(c,g.re),0);if(c===0)switch((g.re%4+4)%4){case 0:return new p(Math.pow(d,g.re),0);case 1:return new p(0,Math.pow(d,g.re));case 2:return new p(-Math.pow(d,g.re),0);case 3:return new p(0,-Math.pow(d,g.re))}}if(c===0&&d===0&&g.re>0&&g.im>=0)return p.ZERO;var w=Math.atan2(d,c),m=f(c,d);return c=Math.exp(g.re*m-g.im*w),d=g.im*m+g.re*w,new p(c*Math.cos(d),c*Math.sin(d))},sqrt:function(){var c=this.re,d=this.im,g=this.abs(),w,m;if(c>=0){if(d===0)return new p(Math.sqrt(c),0);w=.5*Math.sqrt(2*(g+c))}else w=Math.abs(d)/Math.sqrt(2*(g-c));return c<=0?m=.5*Math.sqrt(2*(g-c)):m=Math.abs(d)/Math.sqrt(2*(g+c)),new p(w,d<0?-m:m)},exp:function(){var c=Math.exp(this.re);return this.im,new p(c*Math.cos(this.im),c*Math.sin(this.im))},expm1:function(){var c=this.re,d=this.im;return new p(Math.expm1(c)*Math.cos(d)+s(d),Math.exp(c)*Math.sin(d))},log:function(){var c=this.re,d=this.im;return new p(f(c,d),Math.atan2(d,c))},abs:function(){return a(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var c=this.re,d=this.im;return new p(Math.sin(c)*r(d),Math.cos(c)*n(d))},cos:function(){var c=this.re,d=this.im;return new p(Math.cos(c)*r(d),-Math.sin(c)*n(d))},tan:function(){var c=2*this.re,d=2*this.im,g=Math.cos(c)+r(d);return new p(Math.sin(c)/g,n(d)/g)},cot:function(){var c=2*this.re,d=2*this.im,g=Math.cos(c)-r(d);return new p(-Math.sin(c)/g,n(d)/g)},sec:function(){var c=this.re,d=this.im,g=.5*r(2*d)+.5*Math.cos(2*c);return new p(Math.cos(c)*r(d)/g,Math.sin(c)*n(d)/g)},csc:function(){var c=this.re,d=this.im,g=.5*r(2*d)-.5*Math.cos(2*c);return new p(Math.sin(c)*r(d)/g,-Math.cos(c)*n(d)/g)},asin:function(){var c=this.re,d=this.im,g=new p(d*d-c*c+1,-2*c*d).sqrt(),w=new p(g.re-d,g.im+c).log();return new p(w.im,-w.re)},acos:function(){var c=this.re,d=this.im,g=new p(d*d-c*c+1,-2*c*d).sqrt(),w=new p(g.re-d,g.im+c).log();return new p(Math.PI/2-w.im,w.re)},atan:function(){var c=this.re,d=this.im;if(c===0){if(d===1)return new p(0,1/0);if(d===-1)return new p(0,-1/0)}var g=c*c+(1-d)*(1-d),w=new p((1-d*d-c*c)/g,-2*c/g).log();return new p(-.5*w.im,.5*w.re)},acot:function(){var c=this.re,d=this.im;if(d===0)return new p(Math.atan2(1,c),0);var g=c*c+d*d;return g!==0?new p(c/g,-d/g).atan():new p(c!==0?c/0:0,d!==0?-d/0:0).atan()},asec:function(){var c=this.re,d=this.im;if(c===0&&d===0)return new p(0,1/0);var g=c*c+d*d;return g!==0?new p(c/g,-d/g).acos():new p(c!==0?c/0:0,d!==0?-d/0:0).acos()},acsc:function(){var c=this.re,d=this.im;if(c===0&&d===0)return new p(Math.PI/2,1/0);var g=c*c+d*d;return g!==0?new p(c/g,-d/g).asin():new p(c!==0?c/0:0,d!==0?-d/0:0).asin()},sinh:function(){var c=this.re,d=this.im;return new p(n(c)*Math.cos(d),r(c)*Math.sin(d))},cosh:function(){var c=this.re,d=this.im;return new p(r(c)*Math.cos(d),n(c)*Math.sin(d))},tanh:function(){var c=2*this.re,d=2*this.im,g=r(c)+Math.cos(d);return new p(n(c)/g,Math.sin(d)/g)},coth:function(){var c=2*this.re,d=2*this.im,g=r(c)-Math.cos(d);return new p(n(c)/g,-Math.sin(d)/g)},csch:function(){var c=this.re,d=this.im,g=Math.cos(2*d)-r(2*c);return new p(-2*n(c)*Math.cos(d)/g,2*r(c)*Math.sin(d)/g)},sech:function(){var c=this.re,d=this.im,g=Math.cos(2*d)+r(2*c);return new p(2*r(c)*Math.cos(d)/g,-2*n(c)*Math.sin(d)/g)},asinh:function(){var c=this.im;this.im=-this.re,this.re=c;var d=this.asin();return this.re=-this.im,this.im=c,c=d.re,d.re=-d.im,d.im=c,d},acosh:function(){var c=this.acos();if(c.im<=0){var d=c.re;c.re=-c.im,c.im=d}else{var d=c.im;c.im=-c.re,c.re=d}return c},atanh:function(){var c=this.re,d=this.im,g=c>1&&d===0,w=1-c,m=1+c,D=w*w+d*d,v=D!==0?new p((m*w-d*d)/D,(d*w+m*d)/D):new p(c!==-1?c/0:0,d!==0?d/0:0),E=v.re;return v.re=f(v.re,v.im)/2,v.im=Math.atan2(v.im,E)/2,g&&(v.im=-v.im),v},acoth:function(){var c=this.re,d=this.im;if(c===0&&d===0)return new p(0,Math.PI/2);var g=c*c+d*d;return g!==0?new p(c/g,-d/g).atanh():new p(c!==0?c/0:0,d!==0?-d/0:0).atanh()},acsch:function(){var c=this.re,d=this.im;if(d===0)return new p(c!==0?Math.log(c+Math.sqrt(c*c+1)):1/0,0);var g=c*c+d*d;return g!==0?new p(c/g,-d/g).asinh():new p(c!==0?c/0:0,d!==0?-d/0:0).asinh()},asech:function(){var c=this.re,d=this.im;if(this.isZero())return p.INFINITY;var g=c*c+d*d;return g!==0?new p(c/g,-d/g).acosh():new p(c!==0?c/0:0,d!==0?-d/0:0).acosh()},inverse:function(){if(this.isZero())return p.INFINITY;if(this.isInfinite())return p.ZERO;var c=this.re,d=this.im,g=c*c+d*d;return new p(c/g,-d/g)},conjugate:function(){return new p(this.re,-this.im)},neg:function(){return new p(-this.re,-this.im)},ceil:function(c){return c=Math.pow(10,c||0),new p(Math.ceil(this.re*c)/c,Math.ceil(this.im*c)/c)},floor:function(c){return c=Math.pow(10,c||0),new p(Math.floor(this.re*c)/c,Math.floor(this.im*c)/c)},round:function(c){return c=Math.pow(10,c||0),new p(Math.round(this.re*c)/c,Math.round(this.im*c)/c)},equals:function(c,d){var g=new p(c,d);return Math.abs(g.re-this.re)<=p.EPSILON&&Math.abs(g.im-this.im)<=p.EPSILON},clone:function(){return new p(this.re,this.im)},toString:function(){var c=this.re,d=this.im,g="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(c)<p.EPSILON&&(c=0),Math.abs(d)<p.EPSILON&&(d=0),d===0?g+c:(c!==0?(g+=c,g+=" ",d<0?(d=-d,g+="-"):g+="+",g+=" "):d<0&&(d=-d,g+="-"),d!==1&&(g+=d),g+"i"))},toVector:function(){return[this.re,this.im]},valueOf:function(){return this.im===0?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return this.im===0&&this.re===0},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!(this.isNaN()||this.isFinite())}},p.ZERO=new p(0,0),p.ONE=new p(1,0),p.I=new p(0,1),p.PI=new p(Math.PI,0),p.E=new p(Math.E,0),p.INFINITY=new p(1/0,1/0),p.NAN=new p(NaN,NaN),p.EPSILON=1e-15,Object.defineProperty(p,"__esModule",{value:!0}),p.default=p,p.Complex=p,i.exports=p})()})(
|
46
|
+
`||(E==="+"?m++:E==="-"?D++:E==="i"||E==="I"?(m+D===0&&l(),w[v+1]!==" "&&!isNaN(w[v+1])?(g.im+=parseFloat((D%2?"-":"")+w[v+1]),v++):g.im+=parseFloat((D%2?"-":"")+"1"),m=D=0):((m+D===0||isNaN(E))&&l(),w[v+1]==="i"||w[v+1]==="I"?(g.im+=parseFloat((D%2?"-":"")+E),v++):g.re+=parseFloat((D%2?"-":"")+E),m=D=0))}m+D>0&&l();break;case"number":g.im=0,g.re=c;break;default:l()}return isNaN(g.re)||isNaN(g.im),g};function p(c,d){if(!(this instanceof p))return new p(c,d);var g=h(c,d);this.re=g.re,this.im=g.im}p.prototype={re:0,im:0,sign:function(){var c=this.abs();return new p(this.re/c,this.im/c)},add:function(c,d){var g=new p(c,d);return this.isInfinite()&&g.isInfinite()?p.NAN:this.isInfinite()||g.isInfinite()?p.INFINITY:new p(this.re+g.re,this.im+g.im)},sub:function(c,d){var g=new p(c,d);return this.isInfinite()&&g.isInfinite()?p.NAN:this.isInfinite()||g.isInfinite()?p.INFINITY:new p(this.re-g.re,this.im-g.im)},mul:function(c,d){var g=new p(c,d);return this.isInfinite()&&g.isZero()||this.isZero()&&g.isInfinite()?p.NAN:this.isInfinite()||g.isInfinite()?p.INFINITY:g.im===0&&this.im===0?new p(this.re*g.re,0):new p(this.re*g.re-this.im*g.im,this.re*g.im+this.im*g.re)},div:function(c,d){var g=new p(c,d);if(this.isZero()&&g.isZero()||this.isInfinite()&&g.isInfinite())return p.NAN;if(this.isInfinite()||g.isZero())return p.INFINITY;if(this.isZero()||g.isInfinite())return p.ZERO;c=this.re,d=this.im;var w=g.re,m=g.im,D,v;return m===0?new p(c/w,d/w):Math.abs(w)<Math.abs(m)?(v=w/m,D=w*v+m,new p((c*v+d)/D,(d*v-c)/D)):(v=m/w,D=m*v+w,new p((c+d*v)/D,(d-c*v)/D))},pow:function(c,d){var g=new p(c,d);if(c=this.re,d=this.im,g.isZero())return p.ONE;if(g.im===0){if(d===0&&c>0)return new p(Math.pow(c,g.re),0);if(c===0)switch((g.re%4+4)%4){case 0:return new p(Math.pow(d,g.re),0);case 1:return new p(0,Math.pow(d,g.re));case 2:return new p(-Math.pow(d,g.re),0);case 3:return new p(0,-Math.pow(d,g.re))}}if(c===0&&d===0&&g.re>0&&g.im>=0)return p.ZERO;var w=Math.atan2(d,c),m=f(c,d);return c=Math.exp(g.re*m-g.im*w),d=g.im*m+g.re*w,new p(c*Math.cos(d),c*Math.sin(d))},sqrt:function(){var c=this.re,d=this.im,g=this.abs(),w,m;if(c>=0){if(d===0)return new p(Math.sqrt(c),0);w=.5*Math.sqrt(2*(g+c))}else w=Math.abs(d)/Math.sqrt(2*(g-c));return c<=0?m=.5*Math.sqrt(2*(g-c)):m=Math.abs(d)/Math.sqrt(2*(g+c)),new p(w,d<0?-m:m)},exp:function(){var c=Math.exp(this.re);return this.im,new p(c*Math.cos(this.im),c*Math.sin(this.im))},expm1:function(){var c=this.re,d=this.im;return new p(Math.expm1(c)*Math.cos(d)+s(d),Math.exp(c)*Math.sin(d))},log:function(){var c=this.re,d=this.im;return new p(f(c,d),Math.atan2(d,c))},abs:function(){return a(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var c=this.re,d=this.im;return new p(Math.sin(c)*r(d),Math.cos(c)*n(d))},cos:function(){var c=this.re,d=this.im;return new p(Math.cos(c)*r(d),-Math.sin(c)*n(d))},tan:function(){var c=2*this.re,d=2*this.im,g=Math.cos(c)+r(d);return new p(Math.sin(c)/g,n(d)/g)},cot:function(){var c=2*this.re,d=2*this.im,g=Math.cos(c)-r(d);return new p(-Math.sin(c)/g,n(d)/g)},sec:function(){var c=this.re,d=this.im,g=.5*r(2*d)+.5*Math.cos(2*c);return new p(Math.cos(c)*r(d)/g,Math.sin(c)*n(d)/g)},csc:function(){var c=this.re,d=this.im,g=.5*r(2*d)-.5*Math.cos(2*c);return new p(Math.sin(c)*r(d)/g,-Math.cos(c)*n(d)/g)},asin:function(){var c=this.re,d=this.im,g=new p(d*d-c*c+1,-2*c*d).sqrt(),w=new p(g.re-d,g.im+c).log();return new p(w.im,-w.re)},acos:function(){var c=this.re,d=this.im,g=new p(d*d-c*c+1,-2*c*d).sqrt(),w=new p(g.re-d,g.im+c).log();return new p(Math.PI/2-w.im,w.re)},atan:function(){var c=this.re,d=this.im;if(c===0){if(d===1)return new p(0,1/0);if(d===-1)return new p(0,-1/0)}var g=c*c+(1-d)*(1-d),w=new p((1-d*d-c*c)/g,-2*c/g).log();return new p(-.5*w.im,.5*w.re)},acot:function(){var c=this.re,d=this.im;if(d===0)return new p(Math.atan2(1,c),0);var g=c*c+d*d;return g!==0?new p(c/g,-d/g).atan():new p(c!==0?c/0:0,d!==0?-d/0:0).atan()},asec:function(){var c=this.re,d=this.im;if(c===0&&d===0)return new p(0,1/0);var g=c*c+d*d;return g!==0?new p(c/g,-d/g).acos():new p(c!==0?c/0:0,d!==0?-d/0:0).acos()},acsc:function(){var c=this.re,d=this.im;if(c===0&&d===0)return new p(Math.PI/2,1/0);var g=c*c+d*d;return g!==0?new p(c/g,-d/g).asin():new p(c!==0?c/0:0,d!==0?-d/0:0).asin()},sinh:function(){var c=this.re,d=this.im;return new p(n(c)*Math.cos(d),r(c)*Math.sin(d))},cosh:function(){var c=this.re,d=this.im;return new p(r(c)*Math.cos(d),n(c)*Math.sin(d))},tanh:function(){var c=2*this.re,d=2*this.im,g=r(c)+Math.cos(d);return new p(n(c)/g,Math.sin(d)/g)},coth:function(){var c=2*this.re,d=2*this.im,g=r(c)-Math.cos(d);return new p(n(c)/g,-Math.sin(d)/g)},csch:function(){var c=this.re,d=this.im,g=Math.cos(2*d)-r(2*c);return new p(-2*n(c)*Math.cos(d)/g,2*r(c)*Math.sin(d)/g)},sech:function(){var c=this.re,d=this.im,g=Math.cos(2*d)+r(2*c);return new p(2*r(c)*Math.cos(d)/g,-2*n(c)*Math.sin(d)/g)},asinh:function(){var c=this.im;this.im=-this.re,this.re=c;var d=this.asin();return this.re=-this.im,this.im=c,c=d.re,d.re=-d.im,d.im=c,d},acosh:function(){var c=this.acos();if(c.im<=0){var d=c.re;c.re=-c.im,c.im=d}else{var d=c.im;c.im=-c.re,c.re=d}return c},atanh:function(){var c=this.re,d=this.im,g=c>1&&d===0,w=1-c,m=1+c,D=w*w+d*d,v=D!==0?new p((m*w-d*d)/D,(d*w+m*d)/D):new p(c!==-1?c/0:0,d!==0?d/0:0),E=v.re;return v.re=f(v.re,v.im)/2,v.im=Math.atan2(v.im,E)/2,g&&(v.im=-v.im),v},acoth:function(){var c=this.re,d=this.im;if(c===0&&d===0)return new p(0,Math.PI/2);var g=c*c+d*d;return g!==0?new p(c/g,-d/g).atanh():new p(c!==0?c/0:0,d!==0?-d/0:0).atanh()},acsch:function(){var c=this.re,d=this.im;if(d===0)return new p(c!==0?Math.log(c+Math.sqrt(c*c+1)):1/0,0);var g=c*c+d*d;return g!==0?new p(c/g,-d/g).asinh():new p(c!==0?c/0:0,d!==0?-d/0:0).asinh()},asech:function(){var c=this.re,d=this.im;if(this.isZero())return p.INFINITY;var g=c*c+d*d;return g!==0?new p(c/g,-d/g).acosh():new p(c!==0?c/0:0,d!==0?-d/0:0).acosh()},inverse:function(){if(this.isZero())return p.INFINITY;if(this.isInfinite())return p.ZERO;var c=this.re,d=this.im,g=c*c+d*d;return new p(c/g,-d/g)},conjugate:function(){return new p(this.re,-this.im)},neg:function(){return new p(-this.re,-this.im)},ceil:function(c){return c=Math.pow(10,c||0),new p(Math.ceil(this.re*c)/c,Math.ceil(this.im*c)/c)},floor:function(c){return c=Math.pow(10,c||0),new p(Math.floor(this.re*c)/c,Math.floor(this.im*c)/c)},round:function(c){return c=Math.pow(10,c||0),new p(Math.round(this.re*c)/c,Math.round(this.im*c)/c)},equals:function(c,d){var g=new p(c,d);return Math.abs(g.re-this.re)<=p.EPSILON&&Math.abs(g.im-this.im)<=p.EPSILON},clone:function(){return new p(this.re,this.im)},toString:function(){var c=this.re,d=this.im,g="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(c)<p.EPSILON&&(c=0),Math.abs(d)<p.EPSILON&&(d=0),d===0?g+c:(c!==0?(g+=c,g+=" ",d<0?(d=-d,g+="-"):g+="+",g+=" "):d<0&&(d=-d,g+="-"),d!==1&&(g+=d),g+"i"))},toVector:function(){return[this.re,this.im]},valueOf:function(){return this.im===0?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return this.im===0&&this.re===0},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!(this.isNaN()||this.isFinite())}},p.ZERO=new p(0,0),p.ONE=new p(1,0),p.I=new p(0,1),p.PI=new p(Math.PI,0),p.E=new p(Math.E,0),p.INFINITY=new p(1/0,1/0),p.NAN=new p(NaN,NaN),p.EPSILON=1e-15,Object.defineProperty(p,"__esModule",{value:!0}),p.default=p,p.Complex=p,i.exports=p})()})(wf);var k_=wf.exports,ze=Zt(k_),U_="Complex",W_=[],j_=mt(U_,W_,()=>(Object.defineProperty(ze,"name",{value:"Complex"}),ze.prototype.constructor=ze,ze.prototype.type="Complex",ze.prototype.isComplex=!0,ze.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},ze.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},ze.prototype.format=function(i){var t="",e=this.im,r=this.re,n=aa(this.re,i),s=aa(this.im,i),a=le(i)?i:i?i.precision:null;if(a!==null){var l=Math.pow(10,-a);Math.abs(r/e)<l&&(r=0),Math.abs(e/r)<l&&(e=0)}return e===0?t=n:r===0?e===1?t="i":e===-1?t="-i":t=s+"i":e<0?e===-1?t=n+" - i":t=n+" - "+s.substring(1)+"i":e===1?t=n+" + i":t=n+" + "+s+"i",t},ze.fromPolar=function(i){switch(arguments.length){case 1:{var t=arguments[0];if(typeof t=="object")return ze(t);throw new TypeError("Input has to be an object with r and phi keys.")}case 2:{var e=arguments[0],r=arguments[1];if(le(e)){if(Tl(r)&&r.hasBase("ANGLE")&&(r=r.toNumber("rad")),le(r))return new ze({r:e,phi:r});throw new TypeError("Phi is not a number nor an angle unit.")}else throw new TypeError("Radius r is not a number.")}default:throw new SyntaxError("Wrong number of arguments in function fromPolar")}},ze.prototype.valueOf=ze.prototype.toString,ze.fromJSON=function(i){return new ze(i)},ze.compare=function(i,t){return i.re>t.re?1:i.re<t.re?-1:i.im>t.im?1:i.im<t.im?-1:0},ze),{isClass:!0}),yf={exports:{}};/**
|
47
47
|
* @license Fraction.js v4.3.0 20/08/2023
|
48
48
|
* https://www.xarg.org/2014/03/rational-numbers-in-javascript/
|
49
49
|
*
|
50
50
|
* Copyright (c) 2023, Robert Eisele (robert@raw.org)
|
51
51
|
* Dual licensed under the MIT or GPL Version 2 licenses.
|
52
|
-
**/(function(i,t){(function(e){var r=2e3,n={s:1,n:0,d:1};function s(v,E){if(isNaN(v=parseInt(v,10)))throw m();return v*E}function a(v,E){if(E===0)throw w();var b=Object.create(g.prototype);b.s=v<0?-1:1,v=v<0?-v:v;var N=d(v,E);return b.n=v/N,b.d=E/N,b}function l(v){for(var E={},b=v,N=2,x=4;x<=b;){for(;b%N===0;)b/=N,E[N]=(E[N]||0)+1;x+=1+2*N++}return b!==v?b>1&&(E[b]=(E[b]||0)+1):E[v]=(E[v]||0)+1,E}var f=function(v,E){var b=0,N=1,x=1,F=0,M=0,S=0,O=1,C=1,T=0,L=1,U=1,k=1,W=1e7,P;if(v!=null)if(E!==void 0){if(b=v,N=E,x=b*N,b%1!==0||N%1!==0)throw D()}else switch(typeof v){case"object":{if("d"in v&&"n"in v)b=v.n,N=v.d,"s"in v&&(b*=v.s);else if(0 in v)b=v[0],1 in v&&(N=v[1]);else throw m();x=b*N;break}case"number":{if(v<0&&(x=v,v=-v),v%1===0)b=v;else if(v>0){for(v>=1&&(C=Math.pow(10,Math.floor(1+Math.log(v)/Math.LN10)),v/=C);L<=W&&k<=W;)if(P=(T+U)/(L+k),v===P){L+k<=W?(b=T+U,N=L+k):k>L?(b=U,N=k):(b=T,N=L);break}else v>P?(T+=U,L+=k):(U+=T,k+=L),L>W?(b=U,N=k):(b=T,N=L);b*=C}else(isNaN(v)||isNaN(E))&&(N=b=NaN);break}case"string":{if(L=v.match(/\d+|./g),L===null)throw m();if(L[T]==="-"?(x=-1,T++):L[T]==="+"&&T++,L.length===T+1?M=s(L[T++],x):L[T+1]==="."||L[T]==="."?(L[T]!=="."&&(F=s(L[T++],x)),T++,(T+1===L.length||L[T+1]==="("&&L[T+3]===")"||L[T+1]==="'"&&L[T+3]==="'")&&(M=s(L[T],x),O=Math.pow(10,L[T].length),T++),(L[T]==="("&&L[T+2]===")"||L[T]==="'"&&L[T+2]==="'")&&(S=s(L[T+1],x),C=Math.pow(10,L[T+1].length)-1,T+=3)):L[T+1]==="/"||L[T+1]===":"?(M=s(L[T],x),O=s(L[T+2],1),T+=3):L[T+3]==="/"&&L[T+1]===" "&&(F=s(L[T],x),M=s(L[T+2],x),O=s(L[T+4],1),T+=5),L.length<=T){N=O*C,x=b=S+N*F+C*M;break}}default:throw m()}if(N===0)throw w();n.s=x<0?-1:1,n.n=Math.abs(b),n.d=Math.abs(N)};function h(v,E,b){for(var N=1;E>0;v=v*v%b,E>>=1)E&1&&(N=N*v%b);return N}function p(v,E){for(;E%2===0;E/=2);for(;E%5===0;E/=5);if(E===1)return 0;for(var b=10%E,N=1;b!==1;N++)if(b=b*10%E,N>r)return 0;return N}function c(v,E,b){for(var N=1,x=h(10,b,E),F=0;F<300;F++){if(N===x)return F;N=N*10%E,x=x*10%E}return 0}function d(v,E){if(!v)return E;if(!E)return v;for(;;){if(v%=E,!v)return E;if(E%=v,!E)return v}}function g(v,E){if(f(v,E),this instanceof g)v=d(n.d,n.n),this.s=n.s,this.n=n.n/v,this.d=n.d/v;else return a(n.s*n.n,n.d)}var w=function(){return new Error("Division by Zero")},m=function(){return new Error("Invalid argument")},D=function(){return new Error("Parameters must be integer")};g.prototype={s:1,n:0,d:1,abs:function(){return a(this.n,this.d)},neg:function(){return a(-this.s*this.n,this.d)},add:function(v,E){return f(v,E),a(this.s*this.n*n.d+n.s*this.d*n.n,this.d*n.d)},sub:function(v,E){return f(v,E),a(this.s*this.n*n.d-n.s*this.d*n.n,this.d*n.d)},mul:function(v,E){return f(v,E),a(this.s*n.s*this.n*n.n,this.d*n.d)},div:function(v,E){return f(v,E),a(this.s*n.s*this.n*n.d,this.d*n.n)},clone:function(){return a(this.s*this.n,this.d)},mod:function(v,E){if(isNaN(this.n)||isNaN(this.d))return new g(NaN);if(v===void 0)return a(this.s*this.n%this.d,1);if(f(v,E),n.n===0&&this.d===0)throw w();return a(this.s*(n.d*this.n)%(n.n*this.d),n.d*this.d)},gcd:function(v,E){return f(v,E),a(d(n.n,this.n)*d(n.d,this.d),n.d*this.d)},lcm:function(v,E){return f(v,E),n.n===0&&this.n===0?a(0,1):a(n.n*this.n,d(n.n,this.n)*d(n.d,this.d))},ceil:function(v){return v=Math.pow(10,v||0),isNaN(this.n)||isNaN(this.d)?new g(NaN):a(Math.ceil(v*this.s*this.n/this.d),v)},floor:function(v){return v=Math.pow(10,v||0),isNaN(this.n)||isNaN(this.d)?new g(NaN):a(Math.floor(v*this.s*this.n/this.d),v)},round:function(v){return v=Math.pow(10,v||0),isNaN(this.n)||isNaN(this.d)?new g(NaN):a(Math.round(v*this.s*this.n/this.d),v)},inverse:function(){return a(this.s*this.d,this.n)},pow:function(v,E){if(f(v,E),n.d===1)return n.s<0?a(Math.pow(this.s*this.d,n.n),Math.pow(this.n,n.n)):a(Math.pow(this.s*this.n,n.n),Math.pow(this.d,n.n));if(this.s<0)return null;var b=l(this.n),N=l(this.d),x=1,F=1;for(var M in b)if(M!=="1"){if(M==="0"){x=0;break}if(b[M]*=n.n,b[M]%n.d===0)b[M]/=n.d;else return null;x*=Math.pow(M,b[M])}for(var M in N)if(M!=="1"){if(N[M]*=n.n,N[M]%n.d===0)N[M]/=n.d;else return null;F*=Math.pow(M,N[M])}return n.s<0?a(F,x):a(x,F)},equals:function(v,E){return f(v,E),this.s*this.n*n.d===n.s*n.n*this.d},compare:function(v,E){f(v,E);var b=this.s*this.n*n.d-n.s*n.n*this.d;return(0<b)-(b<0)},simplify:function(v){if(isNaN(this.n)||isNaN(this.d))return this;v=v||.001;for(var E=this.abs(),b=E.toContinued(),N=1;N<b.length;N++){for(var x=a(b[N-1],1),F=N-2;F>=0;F--)x=x.inverse().add(b[F]);if(Math.abs(x.sub(E).valueOf())<v)return x.mul(this.s)}return this},divisible:function(v,E){return f(v,E),!(!(n.n*this.d)||this.n*n.d%(n.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(v){var E,b="",N=this.n,x=this.d;return this.s<0&&(b+="-"),x===1?b+=N:(v&&(E=Math.floor(N/x))>0&&(b+=E,b+=" ",N%=x),b+=N,b+="/",b+=x),b},toLatex:function(v){var E,b="",N=this.n,x=this.d;return this.s<0&&(b+="-"),x===1?b+=N:(v&&(E=Math.floor(N/x))>0&&(b+=E,N%=x),b+="\\frac{",b+=N,b+="}{",b+=x,b+="}"),b},toContinued:function(){var v,E=this.n,b=this.d,N=[];if(isNaN(E)||isNaN(b))return N;do N.push(Math.floor(E/b)),v=E%b,E=b,b=v;while(E!==1);return N},toString:function(v){var E=this.n,b=this.d;if(isNaN(E)||isNaN(b))return"NaN";v=v||15;var N=p(E,b),x=c(E,b,N),F=this.s<0?"-":"";if(F+=E/b|0,E%=b,E*=10,E&&(F+="."),N){for(var M=x;M--;)F+=E/b|0,E%=b,E*=10;F+="(";for(var M=N;M--;)F+=E/b|0,E%=b,E*=10;F+=")"}else for(var M=v;E&&M--;)F+=E/b|0,E%=b,E*=10;return F}},Object.defineProperty(g,"__esModule",{value:!0}),g.default=g,g.Fraction=g,i.exports=g})()})(wf);var Y_=wf.exports,Qr=Zt(Y_),Z_="Fraction",G_=[],K_=mt(Z_,G_,()=>(Object.defineProperty(Qr,"name",{value:"Fraction"}),Qr.prototype.constructor=Qr,Qr.prototype.type="Fraction",Qr.prototype.isFraction=!0,Qr.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},Qr.fromJSON=function(i){return new Qr(i)},Qr),{isClass:!0}),H_="Matrix",J_=[],X_=mt(H_,J_,()=>{function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator")}return i.prototype.type="Matrix",i.prototype.isMatrix=!0,i.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},i.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},i.prototype.create=function(t,e){throw new Error("Cannot invoke create on a Matrix interface")},i.prototype.subset=function(t,e,r){throw new Error("Cannot invoke subset on a Matrix interface")},i.prototype.get=function(t){throw new Error("Cannot invoke get on a Matrix interface")},i.prototype.set=function(t,e,r){throw new Error("Cannot invoke set on a Matrix interface")},i.prototype.resize=function(t,e){throw new Error("Cannot invoke resize on a Matrix interface")},i.prototype.reshape=function(t,e){throw new Error("Cannot invoke reshape on a Matrix interface")},i.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},i.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},i.prototype.map=function(t,e){throw new Error("Cannot invoke map on a Matrix interface")},i.prototype.forEach=function(t){throw new Error("Cannot invoke forEach on a Matrix interface")},i.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},i.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},i.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},i.prototype.format=function(t){throw new Error("Cannot invoke format on a Matrix interface")},i.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},i},{isClass:!0});function yf(i){return Object.keys(i.signatures||{}).reduce(function(t,e){var r=(e.match(/,/g)||[]).length+1;return Math.max(t,r)},-1)}var V_="DenseMatrix",Q_=["Matrix"],tm=mt(V_,Q_,i=>{var{Matrix:t}=i;function e(p,c){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");if(c&&!Yr(c))throw new Error("Invalid datatype: "+c);if(ce(p))p.type==="DenseMatrix"?(this._data=re(p._data),this._size=re(p._size),this._datatype=c||p._datatype):(this._data=p.toArray(),this._size=p.size(),this._datatype=c||p._datatype);else if(p&&ve(p.data)&&ve(p.size))this._data=p.data,this._size=p.size,Gl(this._data,this._size),this._datatype=c||p.datatype;else if(ve(p))this._data=h(p),this._size=Ce(this._data),Gl(this._data,this._size),this._datatype=c;else{if(p)throw new TypeError("Unsupported type of data ("+_n(p)+")");this._data=[],this._size=[0],this._datatype=c}}e.prototype=new t,e.prototype.createDenseMatrix=function(p,c){return new e(p,c)},Object.defineProperty(e,"name",{value:"DenseMatrix"}),e.prototype.constructor=e,e.prototype.type="DenseMatrix",e.prototype.isDenseMatrix=!0,e.prototype.getDataType=function(){return xs(this._data,_n)},e.prototype.storage=function(){return"dense"},e.prototype.datatype=function(){return this._datatype},e.prototype.create=function(p,c){return new e(p,c)},e.prototype.subset=function(p,c,d){switch(arguments.length){case 1:return r(this,p);case 2:case 3:return s(this,p,c,d);default:throw new SyntaxError("Wrong number of arguments")}},e.prototype.get=function(p){if(!ve(p))throw new TypeError("Array expected");if(p.length!==this._size.length)throw new Gt(p.length,this._size.length);for(var c=0;c<p.length;c++)we(p[c],this._size[c]);for(var d=this._data,g=0,w=p.length;g<w;g++){var m=p[g];we(m,d.length),d=d[m]}return d},e.prototype.set=function(p,c,d){if(!ve(p))throw new TypeError("Array expected");if(p.length<this._size.length)throw new Gt(p.length,this._size.length,"<");var g,w,m,D=p.map(function(E){return E+1});f(this,D,d);var v=this._data;for(g=0,w=p.length-1;g<w;g++)m=p[g],we(m,v.length),v=v[m];return m=p[p.length-1],we(m,v.length),v[m]=c,this};function r(p,c){if(!ia(c))throw new TypeError("Invalid index");var d=c.isScalar();if(d)return p.get(c.min());var g=c.size();if(g.length!==p._size.length)throw new Gt(g.length,p._size.length);for(var w=c.min(),m=c.max(),D=0,v=p._size.length;D<v;D++)we(w[D],p._size[D]),we(m[D],p._size[D]);return new e(n(p._data,c,g.length,0),p._datatype)}function n(p,c,d,g){var w=g===d-1,m=c.dimension(g);return w?m.map(function(D){return we(D,p.length),p[D]}).valueOf():m.map(function(D){we(D,p.length);var v=p[D];return n(v,c,d,g+1)}).valueOf()}function s(p,c,d,g){if(!c||c.isIndex!==!0)throw new TypeError("Invalid index");var w=c.size(),m=c.isScalar(),D;if(ce(d)?(D=d.size(),d=d.valueOf()):D=Ce(d),m){if(D.length!==0)throw new TypeError("Scalar expected");p.set(c.min(),d,g)}else{if(!oi(D,w))try{D.length===0?d=Ql([d],w):d=Ql(d,w),D=Ce(d)}catch{}if(w.length<p._size.length)throw new Gt(w.length,p._size.length,"<");if(D.length<w.length){for(var v=0,E=0;w[v]===1&&D[v]===1;)v++;for(;w[v]===1;)E++,v++;d=Hl(d,w.length,E,D)}if(!oi(w,D))throw new Gt(w,D,">");var b=c.max().map(function(F){return F+1});f(p,b,g);var N=w.length,x=0;a(p._data,c,d,N,x)}return p}function a(p,c,d,g,w){var m=w===g-1,D=c.dimension(w);m?D.forEach(function(v,E){we(v),p[v]=d[E[0]]}):D.forEach(function(v,E){we(v),a(p[v],c,d[E[0]],g,w+1)})}e.prototype.resize=function(p,c,d){if(!ki(p))throw new TypeError("Array or Matrix expected");var g=p.valueOf().map(m=>Array.isArray(m)&&m.length===1?m[0]:m),w=d?this.clone():this;return l(w,g,c)};function l(p,c,d){if(c.length===0){for(var g=p._data;ve(g);)g=g[0];return g}return p._size=c.slice(0),p._data=la(p._data,p._size,d),p}e.prototype.reshape=function(p,c){var d=c?this.clone():this;d._data=ca(d._data,p);var g=d._size.reduce((w,m)=>w*m);return d._size=ha(p,g),d};function f(p,c,d){for(var g=p._size.slice(0),w=!1;g.length<c.length;)g.push(0),w=!0;for(var m=0,D=c.length;m<D;m++)c[m]>g[m]&&(g[m]=c[m],w=!0);w&&l(p,g,d)}e.prototype.clone=function(){var p=new e({data:re(this._data),size:re(this._size),datatype:this._datatype});return p},e.prototype.size=function(){return this._size.slice(0)},e.prototype.map=function(p){var c=this,d=yf(p),g=function D(v,E){return ve(v)?v.map(function(b,N){return D(b,E.concat(N))}):d===1?p(v):d===2?p(v,E):p(v,E,c)},w=g(this._data,[]),m=this._datatype!==void 0?xs(w,_n):void 0;return new e(w,m)},e.prototype.forEach=function(p){var c=this,d=function g(w,m){ve(w)?w.forEach(function(D,v){g(D,m.concat(v))}):p(w,m,c)};d(this._data,[])},e.prototype[Symbol.iterator]=function*(){var p=function*c(d,g){if(ve(d))for(var w=0;w<d.length;w++)yield*c(d[w],g.concat(w));else yield{value:d,index:g}};yield*p(this._data,[])},e.prototype.rows=function(){var p=[],c=this.size();if(c.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");var d=this._data;for(var g of d)p.push(new e([g],this._datatype));return p},e.prototype.columns=function(){var p=this,c=[],d=this.size();if(d.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");for(var g=this._data,w=function(v){var E=g.map(b=>[b[v]]);c.push(new e(E,p._datatype))},m=0;m<d[1];m++)w(m);return c},e.prototype.toArray=function(){return re(this._data)},e.prototype.valueOf=function(){return this._data},e.prototype.format=function(p){return oe(this._data,p)},e.prototype.toString=function(){return oe(this._data)},e.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},e.prototype.diagonal=function(p){if(p){if(Ee(p)&&(p=p.toNumber()),!le(p)||!de(p))throw new TypeError("The parameter k must be an integer number")}else p=0;for(var c=p>0?p:0,d=p<0?-p:0,g=this._size[0],w=this._size[1],m=Math.min(g-d,w-c),D=[],v=0;v<m;v++)D[v]=this._data[v+d][v+c];return new e({data:D,size:[m],datatype:this._datatype})},e.diagonal=function(p,c,d,g){if(!ve(p))throw new TypeError("Array expected, size parameter");if(p.length!==2)throw new Error("Only two dimensions matrix are supported");if(p=p.map(function(M){if(Ee(M)&&(M=M.toNumber()),!le(M)||!de(M)||M<1)throw new Error("Size values must be positive integers");return M}),d){if(Ee(d)&&(d=d.toNumber()),!le(d)||!de(d))throw new TypeError("The parameter k must be an integer number")}else d=0;var w=d>0?d:0,m=d<0?-d:0,D=p[0],v=p[1],E=Math.min(D-m,v-w),b;if(ve(c)){if(c.length!==E)throw new Error("Invalid value array length");b=function(S){return c[S]}}else if(ce(c)){var N=c.size();if(N.length!==1||N[0]!==E)throw new Error("Invalid matrix length");b=function(S){return c.get([S])}}else b=function(){return c};g||(g=Ee(b(0))?b(0).mul(0):0);var x=[];if(p.length>0){x=la(x,p,g);for(var F=0;F<E;F++)x[F+m][F+w]=b(F)}return new e({data:x,size:[D,v]})},e.fromJSON=function(p){return new e(p)},e.prototype.swapRows=function(p,c){if(!le(p)||!de(p)||!le(c)||!de(c))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return we(p,this._size[0]),we(c,this._size[0]),e._swapRows(p,c,this._data),this},e._swapRows=function(p,c,d){var g=d[p];d[p]=d[c],d[c]=g};function h(p){return ce(p)?h(p.valueOf()):ve(p)?p.map(h):p}return e},{isClass:!0});function em(i){var t=i.length,e=i[0].length,r,n,s=[];for(n=0;n<e;n++){var a=[];for(r=0;r<t;r++)a.push(i[r][n]);s.push(a)}return s}function Os(i){for(var t=0;t<i.length;t++)if(ki(i[t]))return!0;return!1}function ji(i,t){ce(i)&&(i=i.valueOf());for(var e=0,r=i.length;e<r;e++){var n=i[e];Array.isArray(n)?ji(n,t):t(n)}}function Lr(i,t,e){return i&&typeof i.map=="function"?i.map(function(r){return Lr(r,t)}):t(i)}function ba(i,t,e){var r=Array.isArray(i)?Ce(i):i.size();if(t<0||t>=r.length)throw new mn(t,r.length);return ce(i)?i.create($s(i.valueOf(),t,e)):$s(i,t,e)}function $s(i,t,e){var r,n,s,a;if(t<=0)if(Array.isArray(i[0])){for(a=em(i),n=[],r=0;r<a.length;r++)n[r]=$s(a[r],t-1,e);return n}else{for(s=i[0],r=1;r<i.length;r++)s=e(s,i[r]);return s}else{for(n=[],r=0;r<i.length;r++)n[r]=$s(i[r],t-1,e);return n}}var Df="isInteger",rm=["typed"],nm=mt(Df,rm,i=>{var{typed:t}=i;return t(Df,{number:de,BigNumber:function(r){return r.isInt()},Fraction:function(r){return r.d===1&&isFinite(r.n)},"Array | Matrix":t.referToSelf(e=>r=>Lr(r,e))})}),bf="number",Ls="number, number";function Ef(i){return Math.abs(i)}Ef.signature=bf;function xf(i,t){return i+t}xf.signature=Ls;function Af(i,t){return i-t}Af.signature=Ls;function Cf(i,t){return i*t}Cf.signature=Ls;function Ff(i){return-i}Ff.signature=bf;function Mf(i,t){return i*i<1&&t===1/0||i*i>1&&t===-1/0?0:Math.pow(i,t)}Mf.signature=Ls;var Nf="number";function Sf(i){return i===0}Sf.signature=Nf;function Bf(i){return Number.isNaN(i)}Bf.signature=Nf;var Tf="isNumeric",im=["typed"],sm=mt(Tf,im,i=>{var{typed:t}=i;return t(Tf,{"number | BigNumber | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":t.referToSelf(e=>r=>Lr(r,e))})}),If="isZero",om=["typed"],am=mt(If,om,i=>{var{typed:t}=i;return t(If,{number:Sf,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:t.referToSelf(e=>r=>t.find(e,r.valueType())(r.value)),"Array | Matrix":t.referToSelf(e=>r=>Lr(r,e))})}),Of="isNaN",um=["typed"],lm=mt(Of,um,i=>{var{typed:t}=i;return t(Of,{number:Bf,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 Lr(r,Number.isNaN)}})});function Rs(i,t,e){if(e==null)return i.eq(t);if(i.eq(t))return!0;if(i.isNaN()||t.isNaN())return!1;if(i.isFinite()&&t.isFinite()){var r=i.minus(t).abs();if(r.isZero())return!0;var n=i.constructor.max(i.abs(),t.abs());return r.lte(n.times(e))}return!1}function fm(i,t,e){return Un(i.re,t.re,e)&&Un(i.im,t.im,e)}var Ps=mt("compareUnits",["typed"],i=>{var{typed:t}=i;return{"Unit, Unit":t.referToSelf(e=>(r,n)=>{if(!r.equalBase(n))throw new Error("Cannot compare units with different base");return t.find(e,[r.valueType(),n.valueType()])(r.value,n.value)})}}),zs="equalScalar",cm=["typed","config"],hm=mt(zs,cm,i=>{var{typed:t,config:e}=i,r=Ps({typed:t});return t(zs,{"boolean, boolean":function(s,a){return s===a},"number, number":function(s,a){return Un(s,a,e.epsilon)},"BigNumber, BigNumber":function(s,a){return s.eq(a)||Rs(s,a,e.epsilon)},"Fraction, Fraction":function(s,a){return s.equals(a)},"Complex, Complex":function(s,a){return fm(s,a,e.epsilon)}},r)});mt(zs,["typed","config"],i=>{var{typed:t,config:e}=i;return t(zs,{"number, number":function(n,s){return Un(n,s,e.epsilon)}})});var pm="SparseMatrix",dm=["typed","equalScalar","Matrix"],_m=mt(pm,dm,i=>{var{typed:t,equalScalar:e,Matrix:r}=i;function n(m,D){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(D&&!Yr(D))throw new Error("Invalid datatype: "+D);if(ce(m))s(this,m,D);else if(m&&ve(m.index)&&ve(m.ptr)&&ve(m.size))this._values=m.values,this._index=m.index,this._ptr=m.ptr,this._size=m.size,this._datatype=D||m.datatype;else if(ve(m))a(this,m,D);else{if(m)throw new TypeError("Unsupported type of data ("+_n(m)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=D}}function s(m,D,v){D.type==="SparseMatrix"?(m._values=D._values?re(D._values):void 0,m._index=re(D._index),m._ptr=re(D._ptr),m._size=re(D._size),m._datatype=v||D._datatype):a(m,D.valueOf(),v||D._datatype)}function a(m,D,v){m._values=[],m._index=[],m._ptr=[],m._datatype=v;var E=D.length,b=0,N=e,x=0;if(Yr(v)&&(N=t.find(e,[v,v])||e,x=t.convert(0,v)),E>0){var F=0;do{m._ptr.push(m._index.length);for(var M=0;M<E;M++){var S=D[M];if(ve(S)){if(F===0&&b<S.length&&(b=S.length),F<S.length){var O=S[F];N(O,x)||(m._values.push(O),m._index.push(M))}}else F===0&&b<1&&(b=1),N(S,x)||(m._values.push(S),m._index.push(M))}F++}while(F<b)}m._ptr.push(m._index.length),m._size=[E,b]}n.prototype=new r,n.prototype.createSparseMatrix=function(m,D){return new n(m,D)},Object.defineProperty(n,"name",{value:"SparseMatrix"}),n.prototype.constructor=n,n.prototype.type="SparseMatrix",n.prototype.isSparseMatrix=!0,n.prototype.getDataType=function(){return xs(this._values,_n)},n.prototype.storage=function(){return"sparse"},n.prototype.datatype=function(){return this._datatype},n.prototype.create=function(m,D){return new n(m,D)},n.prototype.density=function(){var m=this._size[0],D=this._size[1];return m!==0&&D!==0?this._index.length/(m*D):0},n.prototype.subset=function(m,D,v){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return l(this,m);case 2:case 3:return f(this,m,D,v);default:throw new SyntaxError("Wrong number of arguments")}};function l(m,D){if(!ia(D))throw new TypeError("Invalid index");var v=D.isScalar();if(v)return m.get(D.min());var E=D.size();if(E.length!==m._size.length)throw new Gt(E.length,m._size.length);var b,N,x,F,M=D.min(),S=D.max();for(b=0,N=m._size.length;b<N;b++)we(M[b],m._size[b]),we(S[b],m._size[b]);var O=m._values,C=m._index,T=m._ptr,L=D.dimension(0),U=D.dimension(1),k=[],W=[];L.forEach(function(V,tt){W[V]=tt[0],k[V]=!0});var P=O?[]:void 0,K=[],G=[];return U.forEach(function(V){for(G.push(K.length),x=T[V],F=T[V+1];x<F;x++)b=C[x],k[b]===!0&&(K.push(W[b]),P&&P.push(O[x]))}),G.push(K.length),new n({values:P,index:K,ptr:G,size:E,datatype:m._datatype})}function f(m,D,v,E){if(!D||D.isIndex!==!0)throw new TypeError("Invalid index");var b=D.size(),N=D.isScalar(),x;if(ce(v)?(x=v.size(),v=v.toArray()):x=Ce(v),N){if(x.length!==0)throw new TypeError("Scalar expected");m.set(D.min(),v,E)}else{if(b.length!==1&&b.length!==2)throw new Gt(b.length,m._size.length,"<");if(x.length<b.length){for(var F=0,M=0;b[F]===1&&x[F]===1;)F++;for(;b[F]===1;)M++,F++;v=Hl(v,b.length,M,x)}if(!oi(b,x))throw new Gt(b,x,">");if(b.length===1){var S=D.dimension(0);S.forEach(function(T,L){we(T),m.set([T,0],v[L[0]],E)})}else{var O=D.dimension(0),C=D.dimension(1);O.forEach(function(T,L){we(T),C.forEach(function(U,k){we(U),m.set([T,U],v[L[0]][k[0]],E)})})}}return m}n.prototype.get=function(m){if(!ve(m))throw new TypeError("Array expected");if(m.length!==this._size.length)throw new Gt(m.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var D=m[0],v=m[1];we(D,this._size[0]),we(v,this._size[1]);var E=h(D,this._ptr[v],this._ptr[v+1],this._index);return E<this._ptr[v+1]&&this._index[E]===D?this._values[E]:0},n.prototype.set=function(m,D,v){if(!ve(m))throw new TypeError("Array expected");if(m.length!==this._size.length)throw new Gt(m.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var E=m[0],b=m[1],N=this._size[0],x=this._size[1],F=e,M=0;Yr(this._datatype)&&(F=t.find(e,[this._datatype,this._datatype])||e,M=t.convert(0,this._datatype)),(E>N-1||b>x-1)&&(d(this,Math.max(E+1,N),Math.max(b+1,x),v),N=this._size[0],x=this._size[1]),we(E,N),we(b,x);var S=h(E,this._ptr[b],this._ptr[b+1],this._index);return S<this._ptr[b+1]&&this._index[S]===E?F(D,M)?p(S,b,this._values,this._index,this._ptr):this._values[S]=D:F(D,M)||c(S,E,b,D,this._values,this._index,this._ptr),this};function h(m,D,v,E){if(v-D===0)return v;for(var b=D;b<v;b++)if(E[b]===m)return b;return D}function p(m,D,v,E,b){v.splice(m,1),E.splice(m,1);for(var N=D+1;N<b.length;N++)b[N]--}function c(m,D,v,E,b,N,x){b.splice(m,0,E),N.splice(m,0,D);for(var F=v+1;F<x.length;F++)x[F]++}n.prototype.resize=function(m,D,v){if(!ki(m))throw new TypeError("Array or Matrix expected");var E=m.valueOf().map(N=>Array.isArray(N)&&N.length===1?N[0]:N);if(E.length!==2)throw new Error("Only two dimensions matrix are supported");E.forEach(function(N){if(!le(N)||!de(N)||N<0)throw new TypeError("Invalid size, must contain positive integers (size: "+oe(E)+")")});var b=v?this.clone():this;return d(b,E[0],E[1],D)};function d(m,D,v,E){var b=E||0,N=e,x=0;Yr(m._datatype)&&(N=t.find(e,[m._datatype,m._datatype])||e,x=t.convert(0,m._datatype),b=t.convert(b,m._datatype));var F=!N(b,x),M=m._size[0],S=m._size[1],O,C,T;if(v>S){for(C=S;C<v;C++)if(m._ptr[C]=m._values.length,F)for(O=0;O<M;O++)m._values.push(b),m._index.push(O);m._ptr[v]=m._values.length}else v<S&&(m._ptr.splice(v+1,S-v),m._values.splice(m._ptr[v],m._values.length),m._index.splice(m._ptr[v],m._index.length));if(S=v,D>M){if(F){var L=0;for(C=0;C<S;C++){m._ptr[C]=m._ptr[C]+L,T=m._ptr[C+1]+L;var U=0;for(O=M;O<D;O++,U++)m._values.splice(T+U,0,b),m._index.splice(T+U,0,O),L++}m._ptr[S]=m._values.length}}else if(D<M){var k=0;for(C=0;C<S;C++){m._ptr[C]=m._ptr[C]-k;var W=m._ptr[C],P=m._ptr[C+1]-k;for(T=W;T<P;T++)O=m._index[T],O>D-1&&(m._values.splice(T,1),m._index.splice(T,1),k++)}m._ptr[C]=m._values.length}return m._size[0]=D,m._size[1]=v,m}n.prototype.reshape=function(m,D){if(!ve(m))throw new TypeError("Array expected");if(m.length!==2)throw new Error("Sparse matrices can only be reshaped in two dimensions");m.forEach(function(V){if(!le(V)||!de(V)||V<=-2||V===0)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+oe(m)+")")});var v=this._size[0]*this._size[1];m=ha(m,v);var E=m[0]*m[1];if(v!==E)throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var b=D?this.clone():this;if(this._size[0]===m[0]&&this._size[1]===m[1])return b;for(var N=[],x=0;x<b._ptr.length;x++)for(var F=0;F<b._ptr[x+1]-b._ptr[x];F++)N.push(x);for(var M=b._values.slice(),S=b._index.slice(),O=0;O<b._index.length;O++){var C=S[O],T=N[O],L=C*b._size[1]+T;N[O]=L%m[1],S[O]=Math.floor(L/m[1])}b._values.length=0,b._index.length=0,b._ptr.length=m[1]+1,b._size=m.slice();for(var U=0;U<b._ptr.length;U++)b._ptr[U]=0;for(var k=0;k<M.length;k++){var W=S[k],P=N[k],K=M[k],G=h(W,b._ptr[P],b._ptr[P+1],b._index);c(G,W,P,K,b._values,b._index,b._ptr)}return b},n.prototype.clone=function(){var m=new n({values:this._values?re(this._values):void 0,index:re(this._index),ptr:re(this._ptr),size:re(this._size),datatype:this._datatype});return m},n.prototype.size=function(){return this._size.slice(0)},n.prototype.map=function(m,D){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var v=this,E=this._size[0],b=this._size[1],N=yf(m),x=function(M,S,O){return N===1?m(M):N===2?m(M,[S,O]):m(M,[S,O],v)};return g(this,0,E-1,0,b-1,x,D)};function g(m,D,v,E,b,N,x){var F=[],M=[],S=[],O=e,C=0;Yr(m._datatype)&&(O=t.find(e,[m._datatype,m._datatype])||e,C=t.convert(0,m._datatype));for(var T=function(lt,yt,bt){lt=N(lt,yt,bt),O(lt,C)||(F.push(lt),M.push(yt))},L=E;L<=b;L++){S.push(F.length);var U=m._ptr[L],k=m._ptr[L+1];if(x)for(var W=U;W<k;W++){var P=m._index[W];P>=D&&P<=v&&T(m._values[W],P-D,L-E)}else{for(var K={},G=U;G<k;G++){var V=m._index[G];K[V]=m._values[G]}for(var tt=D;tt<=v;tt++){var ft=tt in K?K[tt]:0;T(ft,tt-D,L-E)}}}return S.push(F.length),new n({values:F,index:M,ptr:S,size:[v-D+1,b-E+1]})}n.prototype.forEach=function(m,D){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var v=this,E=this._size[0],b=this._size[1],N=0;N<b;N++){var x=this._ptr[N],F=this._ptr[N+1];if(D)for(var M=x;M<F;M++){var S=this._index[M];m(this._values[M],[S,N],v)}else{for(var O={},C=x;C<F;C++){var T=this._index[C];O[T]=this._values[C]}for(var L=0;L<E;L++){var U=L in O?O[L]:0;m(U,[L,N],v)}}}},n.prototype[Symbol.iterator]=function*(){if(!this._values)throw new Error("Cannot iterate a Pattern only matrix");for(var m=this._size[1],D=0;D<m;D++)for(var v=this._ptr[D],E=this._ptr[D+1],b=v;b<E;b++){var N=this._index[b];yield{value:this._values[b],index:[N,D]}}},n.prototype.toArray=function(){return w(this._values,this._index,this._ptr,this._size,!0)},n.prototype.valueOf=function(){return w(this._values,this._index,this._ptr,this._size,!1)};function w(m,D,v,E,b){var N=E[0],x=E[1],F=[],M,S;for(M=0;M<N;M++)for(F[M]=[],S=0;S<x;S++)F[M][S]=0;for(S=0;S<x;S++)for(var O=v[S],C=v[S+1],T=O;T<C;T++)M=D[T],F[M][S]=m?b?re(m[T]):m[T]:1;return F}return n.prototype.format=function(m){for(var D=this._size[0],v=this._size[1],E=this.density(),b="Sparse Matrix ["+oe(D,m)+" x "+oe(v,m)+"] density: "+oe(E,m)+`
|
52
|
+
**/(function(i,t){(function(e){var r=2e3,n={s:1,n:0,d:1};function s(v,E){if(isNaN(v=parseInt(v,10)))throw m();return v*E}function a(v,E){if(E===0)throw w();var b=Object.create(g.prototype);b.s=v<0?-1:1,v=v<0?-v:v;var N=d(v,E);return b.n=v/N,b.d=E/N,b}function l(v){for(var E={},b=v,N=2,x=4;x<=b;){for(;b%N===0;)b/=N,E[N]=(E[N]||0)+1;x+=1+2*N++}return b!==v?b>1&&(E[b]=(E[b]||0)+1):E[v]=(E[v]||0)+1,E}var f=function(v,E){var b=0,N=1,x=1,F=0,M=0,S=0,O=1,C=1,T=0,L=1,U=1,k=1,W=1e7,P;if(v!=null)if(E!==void 0){if(b=v,N=E,x=b*N,b%1!==0||N%1!==0)throw D()}else switch(typeof v){case"object":{if("d"in v&&"n"in v)b=v.n,N=v.d,"s"in v&&(b*=v.s);else if(0 in v)b=v[0],1 in v&&(N=v[1]);else throw m();x=b*N;break}case"number":{if(v<0&&(x=v,v=-v),v%1===0)b=v;else if(v>0){for(v>=1&&(C=Math.pow(10,Math.floor(1+Math.log(v)/Math.LN10)),v/=C);L<=W&&k<=W;)if(P=(T+U)/(L+k),v===P){L+k<=W?(b=T+U,N=L+k):k>L?(b=U,N=k):(b=T,N=L);break}else v>P?(T+=U,L+=k):(U+=T,k+=L),L>W?(b=U,N=k):(b=T,N=L);b*=C}else(isNaN(v)||isNaN(E))&&(N=b=NaN);break}case"string":{if(L=v.match(/\d+|./g),L===null)throw m();if(L[T]==="-"?(x=-1,T++):L[T]==="+"&&T++,L.length===T+1?M=s(L[T++],x):L[T+1]==="."||L[T]==="."?(L[T]!=="."&&(F=s(L[T++],x)),T++,(T+1===L.length||L[T+1]==="("&&L[T+3]===")"||L[T+1]==="'"&&L[T+3]==="'")&&(M=s(L[T],x),O=Math.pow(10,L[T].length),T++),(L[T]==="("&&L[T+2]===")"||L[T]==="'"&&L[T+2]==="'")&&(S=s(L[T+1],x),C=Math.pow(10,L[T+1].length)-1,T+=3)):L[T+1]==="/"||L[T+1]===":"?(M=s(L[T],x),O=s(L[T+2],1),T+=3):L[T+3]==="/"&&L[T+1]===" "&&(F=s(L[T],x),M=s(L[T+2],x),O=s(L[T+4],1),T+=5),L.length<=T){N=O*C,x=b=S+N*F+C*M;break}}default:throw m()}if(N===0)throw w();n.s=x<0?-1:1,n.n=Math.abs(b),n.d=Math.abs(N)};function h(v,E,b){for(var N=1;E>0;v=v*v%b,E>>=1)E&1&&(N=N*v%b);return N}function p(v,E){for(;E%2===0;E/=2);for(;E%5===0;E/=5);if(E===1)return 0;for(var b=10%E,N=1;b!==1;N++)if(b=b*10%E,N>r)return 0;return N}function c(v,E,b){for(var N=1,x=h(10,b,E),F=0;F<300;F++){if(N===x)return F;N=N*10%E,x=x*10%E}return 0}function d(v,E){if(!v)return E;if(!E)return v;for(;;){if(v%=E,!v)return E;if(E%=v,!E)return v}}function g(v,E){if(f(v,E),this instanceof g)v=d(n.d,n.n),this.s=n.s,this.n=n.n/v,this.d=n.d/v;else return a(n.s*n.n,n.d)}var w=function(){return new Error("Division by Zero")},m=function(){return new Error("Invalid argument")},D=function(){return new Error("Parameters must be integer")};g.prototype={s:1,n:0,d:1,abs:function(){return a(this.n,this.d)},neg:function(){return a(-this.s*this.n,this.d)},add:function(v,E){return f(v,E),a(this.s*this.n*n.d+n.s*this.d*n.n,this.d*n.d)},sub:function(v,E){return f(v,E),a(this.s*this.n*n.d-n.s*this.d*n.n,this.d*n.d)},mul:function(v,E){return f(v,E),a(this.s*n.s*this.n*n.n,this.d*n.d)},div:function(v,E){return f(v,E),a(this.s*n.s*this.n*n.d,this.d*n.n)},clone:function(){return a(this.s*this.n,this.d)},mod:function(v,E){if(isNaN(this.n)||isNaN(this.d))return new g(NaN);if(v===void 0)return a(this.s*this.n%this.d,1);if(f(v,E),n.n===0&&this.d===0)throw w();return a(this.s*(n.d*this.n)%(n.n*this.d),n.d*this.d)},gcd:function(v,E){return f(v,E),a(d(n.n,this.n)*d(n.d,this.d),n.d*this.d)},lcm:function(v,E){return f(v,E),n.n===0&&this.n===0?a(0,1):a(n.n*this.n,d(n.n,this.n)*d(n.d,this.d))},ceil:function(v){return v=Math.pow(10,v||0),isNaN(this.n)||isNaN(this.d)?new g(NaN):a(Math.ceil(v*this.s*this.n/this.d),v)},floor:function(v){return v=Math.pow(10,v||0),isNaN(this.n)||isNaN(this.d)?new g(NaN):a(Math.floor(v*this.s*this.n/this.d),v)},round:function(v){return v=Math.pow(10,v||0),isNaN(this.n)||isNaN(this.d)?new g(NaN):a(Math.round(v*this.s*this.n/this.d),v)},inverse:function(){return a(this.s*this.d,this.n)},pow:function(v,E){if(f(v,E),n.d===1)return n.s<0?a(Math.pow(this.s*this.d,n.n),Math.pow(this.n,n.n)):a(Math.pow(this.s*this.n,n.n),Math.pow(this.d,n.n));if(this.s<0)return null;var b=l(this.n),N=l(this.d),x=1,F=1;for(var M in b)if(M!=="1"){if(M==="0"){x=0;break}if(b[M]*=n.n,b[M]%n.d===0)b[M]/=n.d;else return null;x*=Math.pow(M,b[M])}for(var M in N)if(M!=="1"){if(N[M]*=n.n,N[M]%n.d===0)N[M]/=n.d;else return null;F*=Math.pow(M,N[M])}return n.s<0?a(F,x):a(x,F)},equals:function(v,E){return f(v,E),this.s*this.n*n.d===n.s*n.n*this.d},compare:function(v,E){f(v,E);var b=this.s*this.n*n.d-n.s*n.n*this.d;return(0<b)-(b<0)},simplify:function(v){if(isNaN(this.n)||isNaN(this.d))return this;v=v||.001;for(var E=this.abs(),b=E.toContinued(),N=1;N<b.length;N++){for(var x=a(b[N-1],1),F=N-2;F>=0;F--)x=x.inverse().add(b[F]);if(Math.abs(x.sub(E).valueOf())<v)return x.mul(this.s)}return this},divisible:function(v,E){return f(v,E),!(!(n.n*this.d)||this.n*n.d%(n.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(v){var E,b="",N=this.n,x=this.d;return this.s<0&&(b+="-"),x===1?b+=N:(v&&(E=Math.floor(N/x))>0&&(b+=E,b+=" ",N%=x),b+=N,b+="/",b+=x),b},toLatex:function(v){var E,b="",N=this.n,x=this.d;return this.s<0&&(b+="-"),x===1?b+=N:(v&&(E=Math.floor(N/x))>0&&(b+=E,N%=x),b+="\\frac{",b+=N,b+="}{",b+=x,b+="}"),b},toContinued:function(){var v,E=this.n,b=this.d,N=[];if(isNaN(E)||isNaN(b))return N;do N.push(Math.floor(E/b)),v=E%b,E=b,b=v;while(E!==1);return N},toString:function(v){var E=this.n,b=this.d;if(isNaN(E)||isNaN(b))return"NaN";v=v||15;var N=p(E,b),x=c(E,b,N),F=this.s<0?"-":"";if(F+=E/b|0,E%=b,E*=10,E&&(F+="."),N){for(var M=x;M--;)F+=E/b|0,E%=b,E*=10;F+="(";for(var M=N;M--;)F+=E/b|0,E%=b,E*=10;F+=")"}else for(var M=v;E&&M--;)F+=E/b|0,E%=b,E*=10;return F}},Object.defineProperty(g,"__esModule",{value:!0}),g.default=g,g.Fraction=g,i.exports=g})()})(yf);var Y_=yf.exports,Qr=Zt(Y_),Z_="Fraction",G_=[],K_=mt(Z_,G_,()=>(Object.defineProperty(Qr,"name",{value:"Fraction"}),Qr.prototype.constructor=Qr,Qr.prototype.type="Fraction",Qr.prototype.isFraction=!0,Qr.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},Qr.fromJSON=function(i){return new Qr(i)},Qr),{isClass:!0}),H_="Matrix",J_=[],X_=mt(H_,J_,()=>{function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator")}return i.prototype.type="Matrix",i.prototype.isMatrix=!0,i.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},i.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},i.prototype.create=function(t,e){throw new Error("Cannot invoke create on a Matrix interface")},i.prototype.subset=function(t,e,r){throw new Error("Cannot invoke subset on a Matrix interface")},i.prototype.get=function(t){throw new Error("Cannot invoke get on a Matrix interface")},i.prototype.set=function(t,e,r){throw new Error("Cannot invoke set on a Matrix interface")},i.prototype.resize=function(t,e){throw new Error("Cannot invoke resize on a Matrix interface")},i.prototype.reshape=function(t,e){throw new Error("Cannot invoke reshape on a Matrix interface")},i.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},i.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},i.prototype.map=function(t,e){throw new Error("Cannot invoke map on a Matrix interface")},i.prototype.forEach=function(t){throw new Error("Cannot invoke forEach on a Matrix interface")},i.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},i.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},i.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},i.prototype.format=function(t){throw new Error("Cannot invoke format on a Matrix interface")},i.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},i},{isClass:!0});function Df(i){return Object.keys(i.signatures||{}).reduce(function(t,e){var r=(e.match(/,/g)||[]).length+1;return Math.max(t,r)},-1)}var V_="DenseMatrix",Q_=["Matrix"],tm=mt(V_,Q_,i=>{var{Matrix:t}=i;function e(p,c){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");if(c&&!Yr(c))throw new Error("Invalid datatype: "+c);if(ce(p))p.type==="DenseMatrix"?(this._data=re(p._data),this._size=re(p._size),this._datatype=c||p._datatype):(this._data=p.toArray(),this._size=p.size(),this._datatype=c||p._datatype);else if(p&&ve(p.data)&&ve(p.size))this._data=p.data,this._size=p.size,Kl(this._data,this._size),this._datatype=c||p.datatype;else if(ve(p))this._data=h(p),this._size=Fe(this._data),Kl(this._data,this._size),this._datatype=c;else{if(p)throw new TypeError("Unsupported type of data ("+_n(p)+")");this._data=[],this._size=[0],this._datatype=c}}e.prototype=new t,e.prototype.createDenseMatrix=function(p,c){return new e(p,c)},Object.defineProperty(e,"name",{value:"DenseMatrix"}),e.prototype.constructor=e,e.prototype.type="DenseMatrix",e.prototype.isDenseMatrix=!0,e.prototype.getDataType=function(){return xs(this._data,_n)},e.prototype.storage=function(){return"dense"},e.prototype.datatype=function(){return this._datatype},e.prototype.create=function(p,c){return new e(p,c)},e.prototype.subset=function(p,c,d){switch(arguments.length){case 1:return r(this,p);case 2:case 3:return s(this,p,c,d);default:throw new SyntaxError("Wrong number of arguments")}},e.prototype.get=function(p){if(!ve(p))throw new TypeError("Array expected");if(p.length!==this._size.length)throw new Gt(p.length,this._size.length);for(var c=0;c<p.length;c++)we(p[c],this._size[c]);for(var d=this._data,g=0,w=p.length;g<w;g++){var m=p[g];we(m,d.length),d=d[m]}return d},e.prototype.set=function(p,c,d){if(!ve(p))throw new TypeError("Array expected");if(p.length<this._size.length)throw new Gt(p.length,this._size.length,"<");var g,w,m,D=p.map(function(E){return E+1});f(this,D,d);var v=this._data;for(g=0,w=p.length-1;g<w;g++)m=p[g],we(m,v.length),v=v[m];return m=p[p.length-1],we(m,v.length),v[m]=c,this};function r(p,c){if(!ia(c))throw new TypeError("Invalid index");var d=c.isScalar();if(d)return p.get(c.min());var g=c.size();if(g.length!==p._size.length)throw new Gt(g.length,p._size.length);for(var w=c.min(),m=c.max(),D=0,v=p._size.length;D<v;D++)we(w[D],p._size[D]),we(m[D],p._size[D]);return new e(n(p._data,c,g.length,0),p._datatype)}function n(p,c,d,g){var w=g===d-1,m=c.dimension(g);return w?m.map(function(D){return we(D,p.length),p[D]}).valueOf():m.map(function(D){we(D,p.length);var v=p[D];return n(v,c,d,g+1)}).valueOf()}function s(p,c,d,g){if(!c||c.isIndex!==!0)throw new TypeError("Invalid index");var w=c.size(),m=c.isScalar(),D;if(ce(d)?(D=d.size(),d=d.valueOf()):D=Fe(d),m){if(D.length!==0)throw new TypeError("Scalar expected");p.set(c.min(),d,g)}else{if(!oi(D,w))try{D.length===0?d=tf([d],w):d=tf(d,w),D=Fe(d)}catch{}if(w.length<p._size.length)throw new Gt(w.length,p._size.length,"<");if(D.length<w.length){for(var v=0,E=0;w[v]===1&&D[v]===1;)v++;for(;w[v]===1;)E++,v++;d=Jl(d,w.length,E,D)}if(!oi(w,D))throw new Gt(w,D,">");var b=c.max().map(function(F){return F+1});f(p,b,g);var N=w.length,x=0;a(p._data,c,d,N,x)}return p}function a(p,c,d,g,w){var m=w===g-1,D=c.dimension(w);m?D.forEach(function(v,E){we(v),p[v]=d[E[0]]}):D.forEach(function(v,E){we(v),a(p[v],c,d[E[0]],g,w+1)})}e.prototype.resize=function(p,c,d){if(!ki(p))throw new TypeError("Array or Matrix expected");var g=p.valueOf().map(m=>Array.isArray(m)&&m.length===1?m[0]:m),w=d?this.clone():this;return l(w,g,c)};function l(p,c,d){if(c.length===0){for(var g=p._data;ve(g);)g=g[0];return g}return p._size=c.slice(0),p._data=la(p._data,p._size,d),p}e.prototype.reshape=function(p,c){var d=c?this.clone():this;d._data=ca(d._data,p);var g=d._size.reduce((w,m)=>w*m);return d._size=ha(p,g),d};function f(p,c,d){for(var g=p._size.slice(0),w=!1;g.length<c.length;)g.push(0),w=!0;for(var m=0,D=c.length;m<D;m++)c[m]>g[m]&&(g[m]=c[m],w=!0);w&&l(p,g,d)}e.prototype.clone=function(){var p=new e({data:re(this._data),size:re(this._size),datatype:this._datatype});return p},e.prototype.size=function(){return this._size.slice(0)},e.prototype.map=function(p){var c=this,d=Df(p),g=function D(v,E){return ve(v)?v.map(function(b,N){return D(b,E.concat(N))}):d===1?p(v):d===2?p(v,E):p(v,E,c)},w=g(this._data,[]),m=this._datatype!==void 0?xs(w,_n):void 0;return new e(w,m)},e.prototype.forEach=function(p){var c=this,d=function g(w,m){ve(w)?w.forEach(function(D,v){g(D,m.concat(v))}):p(w,m,c)};d(this._data,[])},e.prototype[Symbol.iterator]=function*(){var p=function*c(d,g){if(ve(d))for(var w=0;w<d.length;w++)yield*c(d[w],g.concat(w));else yield{value:d,index:g}};yield*p(this._data,[])},e.prototype.rows=function(){var p=[],c=this.size();if(c.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");var d=this._data;for(var g of d)p.push(new e([g],this._datatype));return p},e.prototype.columns=function(){var p=this,c=[],d=this.size();if(d.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");for(var g=this._data,w=function(v){var E=g.map(b=>[b[v]]);c.push(new e(E,p._datatype))},m=0;m<d[1];m++)w(m);return c},e.prototype.toArray=function(){return re(this._data)},e.prototype.valueOf=function(){return this._data},e.prototype.format=function(p){return oe(this._data,p)},e.prototype.toString=function(){return oe(this._data)},e.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},e.prototype.diagonal=function(p){if(p){if(Ee(p)&&(p=p.toNumber()),!le(p)||!de(p))throw new TypeError("The parameter k must be an integer number")}else p=0;for(var c=p>0?p:0,d=p<0?-p:0,g=this._size[0],w=this._size[1],m=Math.min(g-d,w-c),D=[],v=0;v<m;v++)D[v]=this._data[v+d][v+c];return new e({data:D,size:[m],datatype:this._datatype})},e.diagonal=function(p,c,d,g){if(!ve(p))throw new TypeError("Array expected, size parameter");if(p.length!==2)throw new Error("Only two dimensions matrix are supported");if(p=p.map(function(M){if(Ee(M)&&(M=M.toNumber()),!le(M)||!de(M)||M<1)throw new Error("Size values must be positive integers");return M}),d){if(Ee(d)&&(d=d.toNumber()),!le(d)||!de(d))throw new TypeError("The parameter k must be an integer number")}else d=0;var w=d>0?d:0,m=d<0?-d:0,D=p[0],v=p[1],E=Math.min(D-m,v-w),b;if(ve(c)){if(c.length!==E)throw new Error("Invalid value array length");b=function(S){return c[S]}}else if(ce(c)){var N=c.size();if(N.length!==1||N[0]!==E)throw new Error("Invalid matrix length");b=function(S){return c.get([S])}}else b=function(){return c};g||(g=Ee(b(0))?b(0).mul(0):0);var x=[];if(p.length>0){x=la(x,p,g);for(var F=0;F<E;F++)x[F+m][F+w]=b(F)}return new e({data:x,size:[D,v]})},e.fromJSON=function(p){return new e(p)},e.prototype.swapRows=function(p,c){if(!le(p)||!de(p)||!le(c)||!de(c))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return we(p,this._size[0]),we(c,this._size[0]),e._swapRows(p,c,this._data),this},e._swapRows=function(p,c,d){var g=d[p];d[p]=d[c],d[c]=g};function h(p){return ce(p)?h(p.valueOf()):ve(p)?p.map(h):p}return e},{isClass:!0});function em(i){var t=i.length,e=i[0].length,r,n,s=[];for(n=0;n<e;n++){var a=[];for(r=0;r<t;r++)a.push(i[r][n]);s.push(a)}return s}function Os(i){for(var t=0;t<i.length;t++)if(ki(i[t]))return!0;return!1}function ji(i,t){ce(i)&&(i=i.valueOf());for(var e=0,r=i.length;e<r;e++){var n=i[e];Array.isArray(n)?ji(n,t):t(n)}}function Lr(i,t,e){return i&&typeof i.map=="function"?i.map(function(r){return Lr(r,t)}):t(i)}function ba(i,t,e){var r=Array.isArray(i)?Fe(i):i.size();if(t<0||t>=r.length)throw new mn(t,r.length);return ce(i)?i.create($s(i.valueOf(),t,e)):$s(i,t,e)}function $s(i,t,e){var r,n,s,a;if(t<=0)if(Array.isArray(i[0])){for(a=em(i),n=[],r=0;r<a.length;r++)n[r]=$s(a[r],t-1,e);return n}else{for(s=i[0],r=1;r<i.length;r++)s=e(s,i[r]);return s}else{for(n=[],r=0;r<i.length;r++)n[r]=$s(i[r],t-1,e);return n}}var bf="isInteger",rm=["typed"],nm=mt(bf,rm,i=>{var{typed:t}=i;return t(bf,{number:de,BigNumber:function(r){return r.isInt()},Fraction:function(r){return r.d===1&&isFinite(r.n)},"Array | Matrix":t.referToSelf(e=>r=>Lr(r,e))})}),Ef="number",Ls="number, number";function xf(i){return Math.abs(i)}xf.signature=Ef;function Af(i,t){return i+t}Af.signature=Ls;function Cf(i,t){return i-t}Cf.signature=Ls;function Ff(i,t){return i*t}Ff.signature=Ls;function Mf(i){return-i}Mf.signature=Ef;function Nf(i,t){return i*i<1&&t===1/0||i*i>1&&t===-1/0?0:Math.pow(i,t)}Nf.signature=Ls;var Sf="number";function Bf(i){return i===0}Bf.signature=Sf;function Tf(i){return Number.isNaN(i)}Tf.signature=Sf;var If="isNumeric",im=["typed"],sm=mt(If,im,i=>{var{typed:t}=i;return t(If,{"number | BigNumber | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":t.referToSelf(e=>r=>Lr(r,e))})}),Of="isZero",om=["typed"],am=mt(Of,om,i=>{var{typed:t}=i;return t(Of,{number:Bf,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:t.referToSelf(e=>r=>t.find(e,r.valueType())(r.value)),"Array | Matrix":t.referToSelf(e=>r=>Lr(r,e))})}),$f="isNaN",um=["typed"],lm=mt($f,um,i=>{var{typed:t}=i;return t($f,{number:Tf,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 Lr(r,Number.isNaN)}})});function Rs(i,t,e){if(e==null)return i.eq(t);if(i.eq(t))return!0;if(i.isNaN()||t.isNaN())return!1;if(i.isFinite()&&t.isFinite()){var r=i.minus(t).abs();if(r.isZero())return!0;var n=i.constructor.max(i.abs(),t.abs());return r.lte(n.times(e))}return!1}function fm(i,t,e){return Un(i.re,t.re,e)&&Un(i.im,t.im,e)}var Ps=mt("compareUnits",["typed"],i=>{var{typed:t}=i;return{"Unit, Unit":t.referToSelf(e=>(r,n)=>{if(!r.equalBase(n))throw new Error("Cannot compare units with different base");return t.find(e,[r.valueType(),n.valueType()])(r.value,n.value)})}}),zs="equalScalar",cm=["typed","config"],hm=mt(zs,cm,i=>{var{typed:t,config:e}=i,r=Ps({typed:t});return t(zs,{"boolean, boolean":function(s,a){return s===a},"number, number":function(s,a){return Un(s,a,e.epsilon)},"BigNumber, BigNumber":function(s,a){return s.eq(a)||Rs(s,a,e.epsilon)},"Fraction, Fraction":function(s,a){return s.equals(a)},"Complex, Complex":function(s,a){return fm(s,a,e.epsilon)}},r)});mt(zs,["typed","config"],i=>{var{typed:t,config:e}=i;return t(zs,{"number, number":function(n,s){return Un(n,s,e.epsilon)}})});var pm="SparseMatrix",dm=["typed","equalScalar","Matrix"],_m=mt(pm,dm,i=>{var{typed:t,equalScalar:e,Matrix:r}=i;function n(m,D){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(D&&!Yr(D))throw new Error("Invalid datatype: "+D);if(ce(m))s(this,m,D);else if(m&&ve(m.index)&&ve(m.ptr)&&ve(m.size))this._values=m.values,this._index=m.index,this._ptr=m.ptr,this._size=m.size,this._datatype=D||m.datatype;else if(ve(m))a(this,m,D);else{if(m)throw new TypeError("Unsupported type of data ("+_n(m)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=D}}function s(m,D,v){D.type==="SparseMatrix"?(m._values=D._values?re(D._values):void 0,m._index=re(D._index),m._ptr=re(D._ptr),m._size=re(D._size),m._datatype=v||D._datatype):a(m,D.valueOf(),v||D._datatype)}function a(m,D,v){m._values=[],m._index=[],m._ptr=[],m._datatype=v;var E=D.length,b=0,N=e,x=0;if(Yr(v)&&(N=t.find(e,[v,v])||e,x=t.convert(0,v)),E>0){var F=0;do{m._ptr.push(m._index.length);for(var M=0;M<E;M++){var S=D[M];if(ve(S)){if(F===0&&b<S.length&&(b=S.length),F<S.length){var O=S[F];N(O,x)||(m._values.push(O),m._index.push(M))}}else F===0&&b<1&&(b=1),N(S,x)||(m._values.push(S),m._index.push(M))}F++}while(F<b)}m._ptr.push(m._index.length),m._size=[E,b]}n.prototype=new r,n.prototype.createSparseMatrix=function(m,D){return new n(m,D)},Object.defineProperty(n,"name",{value:"SparseMatrix"}),n.prototype.constructor=n,n.prototype.type="SparseMatrix",n.prototype.isSparseMatrix=!0,n.prototype.getDataType=function(){return xs(this._values,_n)},n.prototype.storage=function(){return"sparse"},n.prototype.datatype=function(){return this._datatype},n.prototype.create=function(m,D){return new n(m,D)},n.prototype.density=function(){var m=this._size[0],D=this._size[1];return m!==0&&D!==0?this._index.length/(m*D):0},n.prototype.subset=function(m,D,v){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return l(this,m);case 2:case 3:return f(this,m,D,v);default:throw new SyntaxError("Wrong number of arguments")}};function l(m,D){if(!ia(D))throw new TypeError("Invalid index");var v=D.isScalar();if(v)return m.get(D.min());var E=D.size();if(E.length!==m._size.length)throw new Gt(E.length,m._size.length);var b,N,x,F,M=D.min(),S=D.max();for(b=0,N=m._size.length;b<N;b++)we(M[b],m._size[b]),we(S[b],m._size[b]);var O=m._values,C=m._index,T=m._ptr,L=D.dimension(0),U=D.dimension(1),k=[],W=[];L.forEach(function(V,tt){W[V]=tt[0],k[V]=!0});var P=O?[]:void 0,K=[],G=[];return U.forEach(function(V){for(G.push(K.length),x=T[V],F=T[V+1];x<F;x++)b=C[x],k[b]===!0&&(K.push(W[b]),P&&P.push(O[x]))}),G.push(K.length),new n({values:P,index:K,ptr:G,size:E,datatype:m._datatype})}function f(m,D,v,E){if(!D||D.isIndex!==!0)throw new TypeError("Invalid index");var b=D.size(),N=D.isScalar(),x;if(ce(v)?(x=v.size(),v=v.toArray()):x=Fe(v),N){if(x.length!==0)throw new TypeError("Scalar expected");m.set(D.min(),v,E)}else{if(b.length!==1&&b.length!==2)throw new Gt(b.length,m._size.length,"<");if(x.length<b.length){for(var F=0,M=0;b[F]===1&&x[F]===1;)F++;for(;b[F]===1;)M++,F++;v=Jl(v,b.length,M,x)}if(!oi(b,x))throw new Gt(b,x,">");if(b.length===1){var S=D.dimension(0);S.forEach(function(T,L){we(T),m.set([T,0],v[L[0]],E)})}else{var O=D.dimension(0),C=D.dimension(1);O.forEach(function(T,L){we(T),C.forEach(function(U,k){we(U),m.set([T,U],v[L[0]][k[0]],E)})})}}return m}n.prototype.get=function(m){if(!ve(m))throw new TypeError("Array expected");if(m.length!==this._size.length)throw new Gt(m.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var D=m[0],v=m[1];we(D,this._size[0]),we(v,this._size[1]);var E=h(D,this._ptr[v],this._ptr[v+1],this._index);return E<this._ptr[v+1]&&this._index[E]===D?this._values[E]:0},n.prototype.set=function(m,D,v){if(!ve(m))throw new TypeError("Array expected");if(m.length!==this._size.length)throw new Gt(m.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var E=m[0],b=m[1],N=this._size[0],x=this._size[1],F=e,M=0;Yr(this._datatype)&&(F=t.find(e,[this._datatype,this._datatype])||e,M=t.convert(0,this._datatype)),(E>N-1||b>x-1)&&(d(this,Math.max(E+1,N),Math.max(b+1,x),v),N=this._size[0],x=this._size[1]),we(E,N),we(b,x);var S=h(E,this._ptr[b],this._ptr[b+1],this._index);return S<this._ptr[b+1]&&this._index[S]===E?F(D,M)?p(S,b,this._values,this._index,this._ptr):this._values[S]=D:F(D,M)||c(S,E,b,D,this._values,this._index,this._ptr),this};function h(m,D,v,E){if(v-D===0)return v;for(var b=D;b<v;b++)if(E[b]===m)return b;return D}function p(m,D,v,E,b){v.splice(m,1),E.splice(m,1);for(var N=D+1;N<b.length;N++)b[N]--}function c(m,D,v,E,b,N,x){b.splice(m,0,E),N.splice(m,0,D);for(var F=v+1;F<x.length;F++)x[F]++}n.prototype.resize=function(m,D,v){if(!ki(m))throw new TypeError("Array or Matrix expected");var E=m.valueOf().map(N=>Array.isArray(N)&&N.length===1?N[0]:N);if(E.length!==2)throw new Error("Only two dimensions matrix are supported");E.forEach(function(N){if(!le(N)||!de(N)||N<0)throw new TypeError("Invalid size, must contain positive integers (size: "+oe(E)+")")});var b=v?this.clone():this;return d(b,E[0],E[1],D)};function d(m,D,v,E){var b=E||0,N=e,x=0;Yr(m._datatype)&&(N=t.find(e,[m._datatype,m._datatype])||e,x=t.convert(0,m._datatype),b=t.convert(b,m._datatype));var F=!N(b,x),M=m._size[0],S=m._size[1],O,C,T;if(v>S){for(C=S;C<v;C++)if(m._ptr[C]=m._values.length,F)for(O=0;O<M;O++)m._values.push(b),m._index.push(O);m._ptr[v]=m._values.length}else v<S&&(m._ptr.splice(v+1,S-v),m._values.splice(m._ptr[v],m._values.length),m._index.splice(m._ptr[v],m._index.length));if(S=v,D>M){if(F){var L=0;for(C=0;C<S;C++){m._ptr[C]=m._ptr[C]+L,T=m._ptr[C+1]+L;var U=0;for(O=M;O<D;O++,U++)m._values.splice(T+U,0,b),m._index.splice(T+U,0,O),L++}m._ptr[S]=m._values.length}}else if(D<M){var k=0;for(C=0;C<S;C++){m._ptr[C]=m._ptr[C]-k;var W=m._ptr[C],P=m._ptr[C+1]-k;for(T=W;T<P;T++)O=m._index[T],O>D-1&&(m._values.splice(T,1),m._index.splice(T,1),k++)}m._ptr[C]=m._values.length}return m._size[0]=D,m._size[1]=v,m}n.prototype.reshape=function(m,D){if(!ve(m))throw new TypeError("Array expected");if(m.length!==2)throw new Error("Sparse matrices can only be reshaped in two dimensions");m.forEach(function(V){if(!le(V)||!de(V)||V<=-2||V===0)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+oe(m)+")")});var v=this._size[0]*this._size[1];m=ha(m,v);var E=m[0]*m[1];if(v!==E)throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var b=D?this.clone():this;if(this._size[0]===m[0]&&this._size[1]===m[1])return b;for(var N=[],x=0;x<b._ptr.length;x++)for(var F=0;F<b._ptr[x+1]-b._ptr[x];F++)N.push(x);for(var M=b._values.slice(),S=b._index.slice(),O=0;O<b._index.length;O++){var C=S[O],T=N[O],L=C*b._size[1]+T;N[O]=L%m[1],S[O]=Math.floor(L/m[1])}b._values.length=0,b._index.length=0,b._ptr.length=m[1]+1,b._size=m.slice();for(var U=0;U<b._ptr.length;U++)b._ptr[U]=0;for(var k=0;k<M.length;k++){var W=S[k],P=N[k],K=M[k],G=h(W,b._ptr[P],b._ptr[P+1],b._index);c(G,W,P,K,b._values,b._index,b._ptr)}return b},n.prototype.clone=function(){var m=new n({values:this._values?re(this._values):void 0,index:re(this._index),ptr:re(this._ptr),size:re(this._size),datatype:this._datatype});return m},n.prototype.size=function(){return this._size.slice(0)},n.prototype.map=function(m,D){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var v=this,E=this._size[0],b=this._size[1],N=Df(m),x=function(M,S,O){return N===1?m(M):N===2?m(M,[S,O]):m(M,[S,O],v)};return g(this,0,E-1,0,b-1,x,D)};function g(m,D,v,E,b,N,x){var F=[],M=[],S=[],O=e,C=0;Yr(m._datatype)&&(O=t.find(e,[m._datatype,m._datatype])||e,C=t.convert(0,m._datatype));for(var T=function(lt,yt,bt){lt=N(lt,yt,bt),O(lt,C)||(F.push(lt),M.push(yt))},L=E;L<=b;L++){S.push(F.length);var U=m._ptr[L],k=m._ptr[L+1];if(x)for(var W=U;W<k;W++){var P=m._index[W];P>=D&&P<=v&&T(m._values[W],P-D,L-E)}else{for(var K={},G=U;G<k;G++){var V=m._index[G];K[V]=m._values[G]}for(var tt=D;tt<=v;tt++){var ft=tt in K?K[tt]:0;T(ft,tt-D,L-E)}}}return S.push(F.length),new n({values:F,index:M,ptr:S,size:[v-D+1,b-E+1]})}n.prototype.forEach=function(m,D){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var v=this,E=this._size[0],b=this._size[1],N=0;N<b;N++){var x=this._ptr[N],F=this._ptr[N+1];if(D)for(var M=x;M<F;M++){var S=this._index[M];m(this._values[M],[S,N],v)}else{for(var O={},C=x;C<F;C++){var T=this._index[C];O[T]=this._values[C]}for(var L=0;L<E;L++){var U=L in O?O[L]:0;m(U,[L,N],v)}}}},n.prototype[Symbol.iterator]=function*(){if(!this._values)throw new Error("Cannot iterate a Pattern only matrix");for(var m=this._size[1],D=0;D<m;D++)for(var v=this._ptr[D],E=this._ptr[D+1],b=v;b<E;b++){var N=this._index[b];yield{value:this._values[b],index:[N,D]}}},n.prototype.toArray=function(){return w(this._values,this._index,this._ptr,this._size,!0)},n.prototype.valueOf=function(){return w(this._values,this._index,this._ptr,this._size,!1)};function w(m,D,v,E,b){var N=E[0],x=E[1],F=[],M,S;for(M=0;M<N;M++)for(F[M]=[],S=0;S<x;S++)F[M][S]=0;for(S=0;S<x;S++)for(var O=v[S],C=v[S+1],T=O;T<C;T++)M=D[T],F[M][S]=m?b?re(m[T]):m[T]:1;return F}return n.prototype.format=function(m){for(var D=this._size[0],v=this._size[1],E=this.density(),b="Sparse Matrix ["+oe(D,m)+" x "+oe(v,m)+"] density: "+oe(E,m)+`
|
53
53
|
`,N=0;N<v;N++)for(var x=this._ptr[N],F=this._ptr[N+1],M=x;M<F;M++){var S=this._index[M];b+=`
|
54
|
-
(`+oe(S,m)+", "+oe(N,m)+") ==> "+(this._values?oe(this._values[M],m):"X")}return b},n.prototype.toString=function(){return oe(this.toArray())},n.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},n.prototype.diagonal=function(m){if(m){if(Ee(m)&&(m=m.toNumber()),!le(m)||!de(m))throw new TypeError("The parameter k must be an integer number")}else m=0;var D=m>0?m:0,v=m<0?-m:0,E=this._size[0],b=this._size[1],N=Math.min(E-v,b-D),x=[],F=[],M=[];M[0]=0;for(var S=D;S<b&&x.length<N;S++)for(var O=this._ptr[S],C=this._ptr[S+1],T=O;T<C;T++){var L=this._index[T];if(L===S-D+v){x.push(this._values[T]),F[x.length-1]=L-v;break}}return M.push(x.length),new n({values:x,index:F,ptr:M,size:[N,1]})},n.fromJSON=function(m){return new n(m)},n.diagonal=function(m,D,v,E,b){if(!ve(m))throw new TypeError("Array expected, size parameter");if(m.length!==2)throw new Error("Only two dimensions matrix are supported");if(m=m.map(function(V){if(Ee(V)&&(V=V.toNumber()),!le(V)||!de(V)||V<1)throw new Error("Size values must be positive integers");return V}),v){if(Ee(v)&&(v=v.toNumber()),!le(v)||!de(v))throw new TypeError("The parameter k must be an integer number")}else v=0;var N=e,x=0;Yr(b)&&(N=t.find(e,[b,b])||e,x=t.convert(0,b));var F=v>0?v:0,M=v<0?-v:0,S=m[0],O=m[1],C=Math.min(S-M,O-F),T;if(ve(D)){if(D.length!==C)throw new Error("Invalid value array length");T=function(tt){return D[tt]}}else if(ce(D)){var L=D.size();if(L.length!==1||L[0]!==C)throw new Error("Invalid matrix length");T=function(tt){return D.get([tt])}}else T=function(){return D};for(var U=[],k=[],W=[],P=0;P<O;P++){W.push(U.length);var K=P-F;if(K>=0&&K<C){var G=T(K);N(G,x)||(k.push(K+M),U.push(G))}}return W.push(U.length),new n({values:U,index:k,ptr:W,size:[S,O]})},n.prototype.swapRows=function(m,D){if(!le(m)||!de(m)||!le(D)||!de(D))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return we(m,this._size[0]),we(D,this._size[0]),n._swapRows(m,D,this._size[1],this._values,this._index,this._ptr),this},n._forEachRow=function(m,D,v,E,b){for(var N=E[m],x=E[m+1],F=N;F<x;F++)b(v[F],D[F])},n._swapRows=function(m,D,v,E,b,N){for(var x=0;x<v;x++){var F=N[x],M=N[x+1],S=h(m,F,M,b),O=h(D,F,M,b);if(S<M&&O<M&&b[S]===m&&b[O]===D){if(E){var C=E[S];E[S]=E[O],E[O]=C}continue}if(S<M&&b[S]===m&&(O>=M||b[O]!==D)){var T=E?E[S]:void 0;b.splice(O,0,D),E&&E.splice(O,0,T),b.splice(O<=S?S+1:S,1),E&&E.splice(O<=S?S+1:S,1);continue}if(O<M&&b[O]===D&&(S>=M||b[S]!==m)){var L=E?E[O]:void 0;b.splice(S,0,m),E&&E.splice(S,0,L),b.splice(S<=O?O+1:O,1),E&&E.splice(S<=O?O+1:O,1)}}},n},{isClass:!0}),mm="number",gm=["typed"];function vm(i){var t=i.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(t){var e={"0b":2,"0o":8,"0x":16}[t[1]],r=t[2],n=t[3];return{input:i,radix:e,integerPart:r,fractionalPart:n}}else return null}function wm(i){for(var t=parseInt(i.integerPart,i.radix),e=0,r=0;r<i.fractionalPart.length;r++){var n=parseInt(i.fractionalPart[r],i.radix);e+=n/Math.pow(i.radix,r+1)}var s=t+e;if(isNaN(s))throw new SyntaxError('String "'+i.input+'" is not a valid number');return s}var ym=mt(mm,gm,i=>{var{typed:t}=i,e=t("number",{"":function(){return 0},number:function(n){return n},string:function(n){if(n==="NaN")return NaN;var s=vm(n);if(s)return wm(s);var a=0,l=n.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);l&&(a=Number(l[2]),n=l[1]);var f=Number(n);if(isNaN(f))throw new SyntaxError('String "'+n+'" is not a valid number');if(l){if(f>2**a-1)throw new SyntaxError('String "'.concat(n,'" is out of range'));f>=2**(a-1)&&(f=f-2**a)}return f},BigNumber:function(n){return n.toNumber()},Fraction:function(n){return n.valueOf()},Unit:t.referToSelf(r=>n=>{var s=n.clone();return s.value=r(n.value),s}),null:function(n){return 0},"Unit, string | Unit":function(n,s){return n.toNumber(s)},"Array | Matrix":t.referToSelf(r=>n=>Lr(n,r))});return e.fromJSON=function(r){return parseFloat(r.value)},e}),Dm="bignumber",bm=["typed","BigNumber"],Em=mt(Dm,bm,i=>{var{typed:t,BigNumber:e}=i;return t("bignumber",{"":function(){return new e(0)},number:function(n){return new e(n+"")},string:function(n){var s=n.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(s){var a=s[2],l=e(s[1]),f=new e(2).pow(Number(a));if(l.gt(f.sub(1)))throw new SyntaxError('String "'.concat(n,'" is out of range'));var h=new e(2).pow(Number(a)-1);return l.gte(h)?l.sub(f):l}return new e(n)},BigNumber:function(n){return n},Unit:t.referToSelf(r=>n=>{var s=n.clone();return s.value=r(n.value),s}),Fraction:function(n){return new e(n.n).div(n.d).times(n.s)},null:function(n){return new e(0)},"Array | Matrix":t.referToSelf(r=>n=>Lr(n,r))})}),xm="fraction",Am=["typed","Fraction"],Cm=mt(xm,Am,i=>{var{typed:t,Fraction:e}=i;return t("fraction",{number:function(n){if(!isFinite(n)||isNaN(n))throw new Error(n+" cannot be represented as a fraction");return new e(n)},string:function(n){return new e(n)},"number, number":function(n,s){return new e(n,s)},null:function(n){return new e(0)},BigNumber:function(n){return new e(n.toString())},Fraction:function(n){return n},Unit:t.referToSelf(r=>n=>{var s=n.clone();return s.value=r(n.value),s}),Object:function(n){return new e(n)},"Array | Matrix":t.referToSelf(r=>n=>Lr(n,r))})}),$f="matrix",Fm=["typed","Matrix","DenseMatrix","SparseMatrix"],Mm=mt($f,Fm,i=>{var{typed:t,Matrix:e,DenseMatrix:r,SparseMatrix:n}=i;return t($f,{"":function(){return s([])},string:function(l){return s([],l)},"string, string":function(l,f){return s([],l,f)},Array:function(l){return s(l)},Matrix:function(l){return s(l,l.storage())},"Array | Matrix, string":s,"Array | Matrix, string, string":s});function s(a,l,f){if(l==="dense"||l==="default"||l===void 0)return new r(a,f);if(l==="sparse")return new n(a,f);throw new TypeError("Unknown matrix type "+JSON.stringify(l)+".")}}),Lf="unaryMinus",Nm=["typed"],Sm=mt(Lf,Nm,i=>{var{typed:t}=i;return t(Lf,{number:Ff,"Complex | BigNumber | Fraction":e=>e.neg(),Unit:t.referToSelf(e=>r=>{var n=r.clone();return n.value=t.find(e,n.valueType())(r.value),n}),"Array | Matrix":t.referToSelf(e=>r=>Lr(r,e))})}),Rf="abs",Bm=["typed"],Tm=mt(Rf,Bm,i=>{var{typed:t}=i;return t(Rf,{number:Ef,"Complex | BigNumber | Fraction | Unit":e=>e.abs(),"Array | Matrix":t.referToSelf(e=>r=>Lr(r,e))})}),Pf="addScalar",Im=["typed"],Om=mt(Pf,Im,i=>{var{typed:t}=i;return t(Pf,{"number, number":xf,"Complex, Complex":function(r,n){return r.add(n)},"BigNumber, BigNumber":function(r,n){return r.plus(n)},"Fraction, Fraction":function(r,n){return r.add(n)},"Unit, Unit":t.referToSelf(e=>(r,n)=>{if(r.value===null||r.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(n.value===null||n.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!r.equalBase(n))throw new Error("Units do not match");var s=r.clone();return s.value=t.find(e,[s.valueType(),n.valueType()])(s.value,n.value),s.fixPrefix=!1,s})})}),zf="subtractScalar",$m=["typed"],Lm=mt(zf,$m,i=>{var{typed:t}=i;return t(zf,{"number, number":Af,"Complex, Complex":function(r,n){return r.sub(n)},"BigNumber, BigNumber":function(r,n){return r.minus(n)},"Fraction, Fraction":function(r,n){return r.sub(n)},"Unit, Unit":t.referToSelf(e=>(r,n)=>{if(r.value===null||r.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(n.value===null||n.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!r.equalBase(n))throw new Error("Units do not match");var s=r.clone();return s.value=t.find(e,[s.valueType(),n.valueType()])(s.value,n.value),s.fixPrefix=!1,s})})}),Rm="matAlgo11xS0s",Pm=["typed","equalScalar"],Ea=mt(Rm,Pm,i=>{var{typed:t,equalScalar:e}=i;return function(n,s,a,l){var f=n._values,h=n._index,p=n._ptr,c=n._size,d=n._datatype;if(!f)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var g=c[0],w=c[1],m,D=e,v=0,E=a;typeof d=="string"&&(m=d,D=t.find(e,[m,m]),v=t.convert(0,m),s=t.convert(s,m),E=t.find(a,[m,m]));for(var b=[],N=[],x=[],F=0;F<w;F++){x[F]=N.length;for(var M=p[F],S=p[F+1],O=M;O<S;O++){var C=h[O],T=l?E(s,f[O]):E(f[O],s);D(T,v)||(N.push(C),b.push(T))}}return x[w]=N.length,n.createSparseMatrix({values:b,index:N,ptr:x,size:[g,w],datatype:m})}}),zm="matAlgo12xSfs",qm=["typed","DenseMatrix"],hi=mt(zm,qm,i=>{var{typed:t,DenseMatrix:e}=i;return function(n,s,a,l){var f=n._values,h=n._index,p=n._ptr,c=n._size,d=n._datatype;if(!f)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var g=c[0],w=c[1],m,D=a;typeof d=="string"&&(m=d,s=t.convert(s,m),D=t.find(a,[m,m]));for(var v=[],E=[],b=[],N=0;N<w;N++){for(var x=N+1,F=p[N],M=p[N+1],S=F;S<M;S++){var O=h[S];E[O]=f[S],b[O]=x}for(var C=0;C<g;C++)N===0&&(v[C]=[]),b[C]===x?v[C][N]=l?D(s,E[C]):D(E[C],s):v[C][N]=l?D(s,0):D(0,s)}return new e({data:v,size:[g,w],datatype:m})}}),km="matAlgo14xDs",Um=["typed"],xa=mt(km,Um,i=>{var{typed:t}=i;return function(n,s,a,l){var f=n._data,h=n._size,p=n._datatype,c,d=a;typeof p=="string"&&(c=p,s=t.convert(s,c),d=t.find(a,[c,c]));var g=h.length>0?e(d,0,h,h[0],f,s,l):[];return n.createDenseMatrix({data:g,size:re(h),datatype:c})};function e(r,n,s,a,l,f,h){var p=[];if(n===s.length-1)for(var c=0;c<a;c++)p[c]=h?r(f,l[c]):r(l[c],f);else for(var d=0;d<a;d++)p[d]=e(r,n+1,s,s[n+1],l[d],f,h);return p}}),Wm="matAlgo02xDS0",jm=["typed","equalScalar"],Ym=mt(Wm,jm,i=>{var{typed:t,equalScalar:e}=i;return function(n,s,a,l){var f=n._data,h=n._size,p=n._datatype||n.getDataType(),c=s._values,d=s._index,g=s._ptr,w=s._size,m=s._datatype||s._data===void 0?s._datatype:s.getDataType();if(h.length!==w.length)throw new Gt(h.length,w.length);if(h[0]!==w[0]||h[1]!==w[1])throw new RangeError("Dimension mismatch. Matrix A ("+h+") must match Matrix B ("+w+")");if(!c)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var D=h[0],v=h[1],E,b=e,N=0,x=a;typeof p=="string"&&p===m&&p!=="mixed"&&(E=p,b=t.find(e,[E,E]),N=t.convert(0,E),x=t.find(a,[E,E]));for(var F=[],M=[],S=[],O=0;O<v;O++){S[O]=M.length;for(var C=g[O],T=g[O+1],L=C;L<T;L++){var U=d[L],k=l?x(c[L],f[U][O]):x(f[U][O],c[L]);b(k,N)||(M.push(U),F.push(k))}}return S[v]=M.length,s.createSparseMatrix({values:F,index:M,ptr:S,size:[D,v],datatype:p===n._datatype&&m===s._datatype?E:void 0})}}),Zm="matAlgo03xDSf",Gm=["typed"],pi=mt(Zm,Gm,i=>{var{typed:t}=i;return function(r,n,s,a){var l=r._data,f=r._size,h=r._datatype||r.getDataType(),p=n._values,c=n._index,d=n._ptr,g=n._size,w=n._datatype||n._data===void 0?n._datatype:n.getDataType();if(f.length!==g.length)throw new Gt(f.length,g.length);if(f[0]!==g[0]||f[1]!==g[1])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+g+")");if(!p)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var m=f[0],D=f[1],v,E=0,b=s;typeof h=="string"&&h===w&&h!=="mixed"&&(v=h,E=t.convert(0,v),b=t.find(s,[v,v]));for(var N=[],x=0;x<m;x++)N[x]=[];for(var F=[],M=[],S=0;S<D;S++){for(var O=S+1,C=d[S],T=d[S+1],L=C;L<T;L++){var U=c[L];F[U]=a?b(p[L],l[U][S]):b(l[U][S],p[L]),M[U]=O}for(var k=0;k<m;k++)M[k]===O?N[k][S]=F[k]:N[k][S]=a?b(E,l[k][S]):b(l[k][S],E)}return r.createDenseMatrix({data:N,size:[m,D],datatype:h===r._datatype&&w===n._datatype?v:void 0})}}),Km="matAlgo05xSfSf",Hm=["typed","equalScalar"],qf=mt(Km,Hm,i=>{var{typed:t,equalScalar:e}=i;return function(n,s,a){var l=n._values,f=n._index,h=n._ptr,p=n._size,c=n._datatype||n._data===void 0?n._datatype:n.getDataType(),d=s._values,g=s._index,w=s._ptr,m=s._size,D=s._datatype||s._data===void 0?s._datatype:s.getDataType();if(p.length!==m.length)throw new Gt(p.length,m.length);if(p[0]!==m[0]||p[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+p+") must match Matrix B ("+m+")");var v=p[0],E=p[1],b,N=e,x=0,F=a;typeof c=="string"&&c===D&&c!=="mixed"&&(b=c,N=t.find(e,[b,b]),x=t.convert(0,b),F=t.find(a,[b,b]));var M=l&&d?[]:void 0,S=[],O=[],C=M?[]:void 0,T=M?[]:void 0,L=[],U=[],k,W,P,K;for(W=0;W<E;W++){O[W]=S.length;var G=W+1;for(P=h[W],K=h[W+1];P<K;P++)k=f[P],S.push(k),L[k]=G,C&&(C[k]=l[P]);for(P=w[W],K=w[W+1];P<K;P++)k=g[P],L[k]!==G&&S.push(k),U[k]=G,T&&(T[k]=d[P]);if(M)for(P=O[W];P<S.length;){k=S[P];var V=L[k],tt=U[k];if(V===G||tt===G){var ft=V===G?C[k]:x,vt=tt===G?T[k]:x,lt=F(ft,vt);N(lt,x)?S.splice(P,1):(M.push(lt),P++)}}}return O[E]=S.length,n.createSparseMatrix({values:M,index:S,ptr:O,size:[v,E],datatype:c===n._datatype&&D===s._datatype?b:void 0})}}),Jm="matAlgo13xDD",Xm=["typed"],Vm=mt(Jm,Xm,i=>{var{typed:t}=i;return function(n,s,a){var l=n._data,f=n._size,h=n._datatype,p=s._data,c=s._size,d=s._datatype,g=[];if(f.length!==c.length)throw new Gt(f.length,c.length);for(var w=0;w<f.length;w++){if(f[w]!==c[w])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+c+")");g[w]=f[w]}var m,D=a;typeof h=="string"&&h===d&&(m=h,D=t.find(a,[m,m]));var v=g.length>0?e(D,0,g,g[0],l,p):[];return n.createDenseMatrix({data:v,size:g,datatype:m})};function e(r,n,s,a,l,f){var h=[];if(n===s.length-1)for(var p=0;p<a;p++)h[p]=r(l[p],f[p]);else for(var c=0;c<a;c++)h[c]=e(r,n+1,s,s[n+1],l[c],f[c]);return h}}),Qm="broadcast",tg=["concat"],eg=mt(Qm,tg,i=>{var{concat:t}=i;return function(n,s){var a=Math.max(n._size.length,s._size.length);if(n._size.length===s._size.length&&n._size.every((w,m)=>w===s._size[m]))return[n,s];for(var l=e(n._size,a,0),f=e(s._size,a,0),h=[],p=0;p<a;p++)h[p]=Math.max(l[p],f[p]);As(l,h),As(f,h);var c=n.clone(),d=s.clone();c._size.length<a?c.reshape(e(c._size,a,1)):d._size.length<a&&d.reshape(e(d._size,a,1));for(var g=0;g<a;g++)c._size[g]<h[g]&&(c=r(c,h[g],g)),d._size[g]<h[g]&&(d=r(d,h[g],g));return[c,d]};function e(n,s,a){return[...Array(s-n.length).fill(a),...n]}function r(n,s,a){return t(...Array(s).fill(n),a)}}),rg="matrixAlgorithmSuite",ng=["typed","matrix","concat"],Wn=mt(rg,ng,i=>{var{typed:t,matrix:e,concat:r}=i,n=Vm({typed:t}),s=xa({typed:t}),a=eg({concat:r});return function(f){var h=f.elop,p=f.SD||f.DS,c;h?(c={"DenseMatrix, DenseMatrix":(m,D)=>n(...a(m,D),h),"Array, Array":(m,D)=>n(...a(e(m),e(D)),h).valueOf(),"Array, DenseMatrix":(m,D)=>n(...a(e(m),D),h),"DenseMatrix, Array":(m,D)=>n(...a(m,e(D)),h)},f.SS&&(c["SparseMatrix, SparseMatrix"]=(m,D)=>f.SS(...a(m,D),h,!1)),f.DS&&(c["DenseMatrix, SparseMatrix"]=(m,D)=>f.DS(...a(m,D),h,!1),c["Array, SparseMatrix"]=(m,D)=>f.DS(...a(e(m),D),h,!1)),p&&(c["SparseMatrix, DenseMatrix"]=(m,D)=>p(...a(D,m),h,!0),c["SparseMatrix, Array"]=(m,D)=>p(...a(e(D),m),h,!0))):(c={"DenseMatrix, DenseMatrix":t.referToSelf(m=>(D,v)=>n(...a(D,v),m)),"Array, Array":t.referToSelf(m=>(D,v)=>n(...a(e(D),e(v)),m).valueOf()),"Array, DenseMatrix":t.referToSelf(m=>(D,v)=>n(...a(e(D),v),m)),"DenseMatrix, Array":t.referToSelf(m=>(D,v)=>n(...a(D,e(v)),m))},f.SS&&(c["SparseMatrix, SparseMatrix"]=t.referToSelf(m=>(D,v)=>f.SS(...a(D,v),m,!1))),f.DS&&(c["DenseMatrix, SparseMatrix"]=t.referToSelf(m=>(D,v)=>f.DS(...a(D,v),m,!1)),c["Array, SparseMatrix"]=t.referToSelf(m=>(D,v)=>f.DS(...a(e(D),v),m,!1))),p&&(c["SparseMatrix, DenseMatrix"]=t.referToSelf(m=>(D,v)=>p(...a(v,D),m,!0)),c["SparseMatrix, Array"]=t.referToSelf(m=>(D,v)=>p(...a(e(v),D),m,!0))));var d=f.scalar||"any",g=f.Ds||f.Ss;g&&(h?(c["DenseMatrix,"+d]=(m,D)=>s(m,D,h,!1),c[d+", DenseMatrix"]=(m,D)=>s(D,m,h,!0),c["Array,"+d]=(m,D)=>s(e(m),D,h,!1).valueOf(),c[d+", Array"]=(m,D)=>s(e(D),m,h,!0).valueOf()):(c["DenseMatrix,"+d]=t.referToSelf(m=>(D,v)=>s(D,v,m,!1)),c[d+", DenseMatrix"]=t.referToSelf(m=>(D,v)=>s(v,D,m,!0)),c["Array,"+d]=t.referToSelf(m=>(D,v)=>s(e(D),v,m,!1).valueOf()),c[d+", Array"]=t.referToSelf(m=>(D,v)=>s(e(v),D,m,!0).valueOf())));var w=f.sS!==void 0?f.sS:f.Ss;return h?(f.Ss&&(c["SparseMatrix,"+d]=(m,D)=>f.Ss(m,D,h,!1)),w&&(c[d+", SparseMatrix"]=(m,D)=>w(D,m,h,!0))):(f.Ss&&(c["SparseMatrix,"+d]=t.referToSelf(m=>(D,v)=>f.Ss(D,v,m,!1))),w&&(c[d+", SparseMatrix"]=t.referToSelf(m=>(D,v)=>w(v,D,m,!0)))),h&&h.signatures&&Tl(c,h.signatures),c}}),ig="matAlgo01xDSid",sg=["typed"],kf=mt(ig,sg,i=>{var{typed:t}=i;return function(r,n,s,a){var l=r._data,f=r._size,h=r._datatype||r.getDataType(),p=n._values,c=n._index,d=n._ptr,g=n._size,w=n._datatype||n._data===void 0?n._datatype:n.getDataType();if(f.length!==g.length)throw new Gt(f.length,g.length);if(f[0]!==g[0]||f[1]!==g[1])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+g+")");if(!p)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var m=f[0],D=f[1],v=typeof h=="string"&&h!=="mixed"&&h===w?h:void 0,E=v?t.find(s,[v,v]):s,b,N,x=[];for(b=0;b<m;b++)x[b]=[];var F=[],M=[];for(N=0;N<D;N++){for(var S=N+1,O=d[N],C=d[N+1],T=O;T<C;T++)b=c[T],F[b]=a?E(p[T],l[b][N]):E(l[b][N],p[T]),M[b]=S;for(b=0;b<m;b++)M[b]===S?x[b][N]=F[b]:x[b][N]=l[b][N]}return r.createDenseMatrix({data:x,size:[m,D],datatype:h===r._datatype&&w===n._datatype?v:void 0})}}),og="matAlgo04xSidSid",ag=["typed","equalScalar"],ug=mt(og,ag,i=>{var{typed:t,equalScalar:e}=i;return function(n,s,a){var l=n._values,f=n._index,h=n._ptr,p=n._size,c=n._datatype||n._data===void 0?n._datatype:n.getDataType(),d=s._values,g=s._index,w=s._ptr,m=s._size,D=s._datatype||s._data===void 0?s._datatype:s.getDataType();if(p.length!==m.length)throw new Gt(p.length,m.length);if(p[0]!==m[0]||p[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+p+") must match Matrix B ("+m+")");var v=p[0],E=p[1],b,N=e,x=0,F=a;typeof c=="string"&&c===D&&c!=="mixed"&&(b=c,N=t.find(e,[b,b]),x=t.convert(0,b),F=t.find(a,[b,b]));var M=l&&d?[]:void 0,S=[],O=[],C=l&&d?[]:void 0,T=l&&d?[]:void 0,L=[],U=[],k,W,P,K,G;for(W=0;W<E;W++){O[W]=S.length;var V=W+1;for(K=h[W],G=h[W+1],P=K;P<G;P++)k=f[P],S.push(k),L[k]=V,C&&(C[k]=l[P]);for(K=w[W],G=w[W+1],P=K;P<G;P++)if(k=g[P],L[k]===V){if(C){var tt=F(C[k],d[P]);N(tt,x)?L[k]=null:C[k]=tt}}else S.push(k),U[k]=V,T&&(T[k]=d[P]);if(C&&T)for(P=O[W];P<S.length;)k=S[P],L[k]===V?(M[P]=C[k],P++):U[k]===V?(M[P]=T[k],P++):S.splice(P,1)}return O[E]=S.length,n.createSparseMatrix({values:M,index:S,ptr:O,size:[v,E],datatype:c===n._datatype&&D===s._datatype?b:void 0})}}),lg="matAlgo10xSids",fg=["typed","DenseMatrix"],Uf=mt(lg,fg,i=>{var{typed:t,DenseMatrix:e}=i;return function(n,s,a,l){var f=n._values,h=n._index,p=n._ptr,c=n._size,d=n._datatype;if(!f)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var g=c[0],w=c[1],m,D=a;typeof d=="string"&&(m=d,s=t.convert(s,m),D=t.find(a,[m,m]));for(var v=[],E=[],b=[],N=0;N<w;N++){for(var x=N+1,F=p[N],M=p[N+1],S=F;S<M;S++){var O=h[S];E[O]=f[S],b[O]=x}for(var C=0;C<g;C++)N===0&&(v[C]=[]),b[C]===x?v[C][N]=l?D(s,E[C]):D(E[C],s):v[C][N]=s}return new e({data:v,size:[g,w],datatype:m})}}),cg="multiplyScalar",hg=["typed"],pg=mt(cg,hg,i=>{var{typed:t}=i;return t("multiplyScalar",{"number, number":Cf,"Complex, Complex":function(r,n){return r.mul(n)},"BigNumber, BigNumber":function(r,n){return r.times(n)},"Fraction, Fraction":function(r,n){return r.mul(n)},"number | Fraction | BigNumber | Complex, Unit":(e,r)=>r.multiply(e),"Unit, number | Fraction | BigNumber | Complex | Unit":(e,r)=>e.multiply(r)})}),Wf="multiply",dg=["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],_g=mt(Wf,dg,i=>{var{typed:t,matrix:e,addScalar:r,multiplyScalar:n,equalScalar:s,dot:a}=i,l=Ea({typed:t,equalScalar:s}),f=xa({typed:t});function h(x,F){switch(x.length){case 1:switch(F.length){case 1:if(x[0]!==F[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(x[0]!==F[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+x[0]+") must match Matrix rows ("+F[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+F.length+" dimensions)")}break;case 2:switch(F.length){case 1:if(x[1]!==F[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+x[1]+") must match Vector length ("+F[0]+")");break;case 2:if(x[1]!==F[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+x[1]+") must match Matrix B rows ("+F[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+F.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+x.length+" dimensions)")}}function p(x,F,M){if(M===0)throw new Error("Cannot multiply two empty vectors");return a(x,F)}function c(x,F){if(F.storage()!=="dense")throw new Error("Support for SparseMatrix not implemented");return d(x,F)}function d(x,F){var M=x._data,S=x._size,O=x._datatype||x.getDataType(),C=F._data,T=F._size,L=F._datatype||F.getDataType(),U=S[0],k=T[1],W,P=r,K=n;O&&L&&O===L&&typeof O=="string"&&O!=="mixed"&&(W=O,P=t.find(r,[W,W]),K=t.find(n,[W,W]));for(var G=[],V=0;V<k;V++){for(var tt=K(M[0],C[0][V]),ft=1;ft<U;ft++)tt=P(tt,K(M[ft],C[ft][V]));G[V]=tt}return x.createDenseMatrix({data:G,size:[k],datatype:O===x._datatype&&L===F._datatype?W:void 0})}var g=t("_multiplyMatrixVector",{"DenseMatrix, any":m,"SparseMatrix, any":E}),w=t("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":D,"DenseMatrix, SparseMatrix":v,"SparseMatrix, DenseMatrix":b,"SparseMatrix, SparseMatrix":N});function m(x,F){var M=x._data,S=x._size,O=x._datatype||x.getDataType(),C=F._data,T=F._datatype||F.getDataType(),L=S[0],U=S[1],k,W=r,P=n;O&&T&&O===T&&typeof O=="string"&&O!=="mixed"&&(k=O,W=t.find(r,[k,k]),P=t.find(n,[k,k]));for(var K=[],G=0;G<L;G++){for(var V=M[G],tt=P(V[0],C[0]),ft=1;ft<U;ft++)tt=W(tt,P(V[ft],C[ft]));K[G]=tt}return x.createDenseMatrix({data:K,size:[L],datatype:O===x._datatype&&T===F._datatype?k:void 0})}function D(x,F){var M=x._data,S=x._size,O=x._datatype||x.getDataType(),C=F._data,T=F._size,L=F._datatype||F.getDataType(),U=S[0],k=S[1],W=T[1],P,K=r,G=n;O&&L&&O===L&&typeof O=="string"&&O!=="mixed"&&O!=="mixed"&&(P=O,K=t.find(r,[P,P]),G=t.find(n,[P,P]));for(var V=[],tt=0;tt<U;tt++){var ft=M[tt];V[tt]=[];for(var vt=0;vt<W;vt++){for(var lt=G(ft[0],C[0][vt]),yt=1;yt<k;yt++)lt=K(lt,G(ft[yt],C[yt][vt]));V[tt][vt]=lt}}return x.createDenseMatrix({data:V,size:[U,W],datatype:O===x._datatype&&L===F._datatype?P:void 0})}function v(x,F){var M=x._data,S=x._size,O=x._datatype||x.getDataType(),C=F._values,T=F._index,L=F._ptr,U=F._size,k=F._datatype||F._data===void 0?F._datatype:F.getDataType();if(!C)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var W=S[0],P=U[1],K,G=r,V=n,tt=s,ft=0;O&&k&&O===k&&typeof O=="string"&&O!=="mixed"&&(K=O,G=t.find(r,[K,K]),V=t.find(n,[K,K]),tt=t.find(s,[K,K]),ft=t.convert(0,K));for(var vt=[],lt=[],yt=[],bt=F.createSparseMatrix({values:vt,index:lt,ptr:yt,size:[W,P],datatype:O===x._datatype&&k===F._datatype?K:void 0}),Bt=0;Bt<P;Bt++){yt[Bt]=lt.length;var Et=L[Bt],ne=L[Bt+1];if(ne>Et)for(var It=0,Nt=0;Nt<W;Nt++){for(var se=Nt+1,Vt=void 0,qt=Et;qt<ne;qt++){var Kt=T[qt];It!==se?(Vt=V(M[Nt][Kt],C[qt]),It=se):Vt=G(Vt,V(M[Nt][Kt],C[qt]))}It===se&&!tt(Vt,ft)&&(lt.push(Nt),vt.push(Vt))}}return yt[P]=lt.length,bt}function E(x,F){var M=x._values,S=x._index,O=x._ptr,C=x._datatype||x._data===void 0?x._datatype:x.getDataType();if(!M)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var T=F._data,L=F._datatype||F.getDataType(),U=x._size[0],k=F._size[0],W=[],P=[],K=[],G,V=r,tt=n,ft=s,vt=0;C&&L&&C===L&&typeof C=="string"&&C!=="mixed"&&(G=C,V=t.find(r,[G,G]),tt=t.find(n,[G,G]),ft=t.find(s,[G,G]),vt=t.convert(0,G));var lt=[],yt=[];K[0]=0;for(var bt=0;bt<k;bt++){var Bt=T[bt];if(!ft(Bt,vt))for(var Et=O[bt],ne=O[bt+1],It=Et;It<ne;It++){var Nt=S[It];yt[Nt]?lt[Nt]=V(lt[Nt],tt(Bt,M[It])):(yt[Nt]=!0,P.push(Nt),lt[Nt]=tt(Bt,M[It]))}}for(var se=P.length,Vt=0;Vt<se;Vt++){var qt=P[Vt];W[Vt]=lt[qt]}return K[1]=P.length,x.createSparseMatrix({values:W,index:P,ptr:K,size:[U,1],datatype:C===x._datatype&&L===F._datatype?G:void 0})}function b(x,F){var M=x._values,S=x._index,O=x._ptr,C=x._datatype||x._data===void 0?x._datatype:x.getDataType();if(!M)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var T=F._data,L=F._datatype||F.getDataType(),U=x._size[0],k=F._size[0],W=F._size[1],P,K=r,G=n,V=s,tt=0;C&&L&&C===L&&typeof C=="string"&&C!=="mixed"&&(P=C,K=t.find(r,[P,P]),G=t.find(n,[P,P]),V=t.find(s,[P,P]),tt=t.convert(0,P));for(var ft=[],vt=[],lt=[],yt=x.createSparseMatrix({values:ft,index:vt,ptr:lt,size:[U,W],datatype:C===x._datatype&&L===F._datatype?P:void 0}),bt=[],Bt=[],Et=0;Et<W;Et++){lt[Et]=vt.length;for(var ne=Et+1,It=0;It<k;It++){var Nt=T[It][Et];if(!V(Nt,tt))for(var se=O[It],Vt=O[It+1],qt=se;qt<Vt;qt++){var Kt=S[qt];Bt[Kt]!==ne?(Bt[Kt]=ne,vt.push(Kt),bt[Kt]=G(Nt,M[qt])):bt[Kt]=K(bt[Kt],G(Nt,M[qt]))}}for(var Me=lt[Et],ur=vt.length,Se=Me;Se<ur;Se++){var rn=vt[Se];ft[Se]=bt[rn]}}return lt[W]=vt.length,yt}function N(x,F){var M=x._values,S=x._index,O=x._ptr,C=x._datatype||x._data===void 0?x._datatype:x.getDataType(),T=F._values,L=F._index,U=F._ptr,k=F._datatype||F._data===void 0?F._datatype:F.getDataType(),W=x._size[0],P=F._size[1],K=M&&T,G,V=r,tt=n;C&&k&&C===k&&typeof C=="string"&&C!=="mixed"&&(G=C,V=t.find(r,[G,G]),tt=t.find(n,[G,G]));for(var ft=K?[]:void 0,vt=[],lt=[],yt=x.createSparseMatrix({values:ft,index:vt,ptr:lt,size:[W,P],datatype:C===x._datatype&&k===F._datatype?G:void 0}),bt=K?[]:void 0,Bt=[],Et,ne,It,Nt,se,Vt,qt,Kt,Me=0;Me<P;Me++){lt[Me]=vt.length;var ur=Me+1;for(se=U[Me],Vt=U[Me+1],Nt=se;Nt<Vt;Nt++)if(Kt=L[Nt],K)for(ne=O[Kt],It=O[Kt+1],Et=ne;Et<It;Et++)qt=S[Et],Bt[qt]!==ur?(Bt[qt]=ur,vt.push(qt),bt[qt]=tt(T[Nt],M[Et])):bt[qt]=V(bt[qt],tt(T[Nt],M[Et]));else for(ne=O[Kt],It=O[Kt+1],Et=ne;Et<It;Et++)qt=S[Et],Bt[qt]!==ur&&(Bt[qt]=ur,vt.push(qt));if(K)for(var Se=lt[Me],rn=vt.length,En=Se;En<rn;En++){var nn=vt[En];ft[En]=bt[nn]}}return lt[P]=vt.length,yt}return t(Wf,n,{"Array, Array":t.referTo("Matrix, Matrix",x=>(F,M)=>{h(Ce(F),Ce(M));var S=x(e(F),e(M));return ce(S)?S.valueOf():S}),"Matrix, Matrix":function(F,M){var S=F.size(),O=M.size();return h(S,O),S.length===1?O.length===1?p(F,M,S[0]):c(F,M):O.length===1?g(F,M):w(F,M)},"Matrix, Array":t.referTo("Matrix,Matrix",x=>(F,M)=>x(F,e(M))),"Array, Matrix":t.referToSelf(x=>(F,M)=>x(e(F,M.storage()),M)),"SparseMatrix, any":function(F,M){return l(F,M,n,!1)},"DenseMatrix, any":function(F,M){return f(F,M,n,!1)},"any, SparseMatrix":function(F,M){return l(M,F,n,!0)},"any, DenseMatrix":function(F,M){return f(M,F,n,!0)},"Array, any":function(F,M){return f(e(F),M,n,!1).valueOf()},"any, Array":function(F,M){return f(e(M),F,n,!0).valueOf()},"any, any":n,"any, any, ...any":t.referToSelf(x=>(F,M,S)=>{for(var O=x(F,M),C=0;C<S.length;C++)O=x(O,S[C]);return O})})}),jf="subtract",mg=["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],gg=mt(jf,mg,i=>{var{typed:t,matrix:e,equalScalar:r,subtractScalar:n,unaryMinus:s,DenseMatrix:a,concat:l}=i,f=kf({typed:t}),h=pi({typed:t}),p=qf({typed:t,equalScalar:r}),c=Uf({typed:t,DenseMatrix:a}),d=hi({typed:t,DenseMatrix:a}),g=Wn({typed:t,matrix:e,concat:l});return t(jf,{"any, any":n},g({elop:n,SS:p,DS:f,SD:h,Ss:d,sS:c}))}),vg="matAlgo07xSSf",wg=["typed","DenseMatrix"],qs=mt(vg,wg,i=>{var{typed:t,DenseMatrix:e}=i;return function(s,a,l){var f=s._size,h=s._datatype||s._data===void 0?s._datatype:s.getDataType(),p=a._size,c=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(f.length!==p.length)throw new Gt(f.length,p.length);if(f[0]!==p[0]||f[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+p+")");var d=f[0],g=f[1],w,m=0,D=l;typeof h=="string"&&h===c&&h!=="mixed"&&(w=h,m=t.convert(0,w),D=t.find(l,[w,w]));var v,E,b=[];for(v=0;v<d;v++)b[v]=[];var N=[],x=[],F=[],M=[];for(E=0;E<g;E++){var S=E+1;for(r(s,E,F,N,S),r(a,E,M,x,S),v=0;v<d;v++){var O=F[v]===S?N[v]:m,C=M[v]===S?x[v]:m;b[v][E]=D(O,C)}}return new e({data:b,size:[d,g],datatype:h===s._datatype&&c===a._datatype?w:void 0})};function r(n,s,a,l,f){for(var h=n._values,p=n._index,c=n._ptr,d=c[s],g=c[s+1];d<g;d++){var w=p[d];a[w]=f,l[w]=h[d]}}}),Yf="conj",yg=["typed"],Dg=mt(Yf,yg,i=>{var{typed:t}=i;return t(Yf,{"number | BigNumber | Fraction":e=>e,Complex:e=>e.conjugate(),"Array | Matrix":t.referToSelf(e=>r=>Lr(r,e))})}),Zf="concat",bg=["typed","matrix","isInteger"],Eg=mt(Zf,bg,i=>{var{typed:t,matrix:e,isInteger:r}=i;return t(Zf,{"...Array | Matrix | number | BigNumber":function(s){var a,l=s.length,f=-1,h,p=!1,c=[];for(a=0;a<l;a++){var d=s[a];if(ce(d)&&(p=!0),le(d)||Ee(d)){if(a!==l-1)throw new Error("Dimension must be specified as last argument");if(h=f,f=d.valueOf(),!r(f))throw new TypeError("Integer number expected for dimension");if(f<0||a>0&&f>h)throw new mn(f,h+1)}else{var g=re(d).valueOf(),w=Ce(g);if(c[a]=g,h=f,f=w.length-1,a>0&&f!==h)throw new Gt(h+1,f+1)}}if(c.length===0)throw new SyntaxError("At least one matrix expected");for(var m=c.shift();c.length;)m=Vl(m,c.shift(),f);return p?e(m):m},"...string":function(s){return s.join("")}})}),Gf="count",xg=["typed","size","prod"],Ag=mt(Gf,xg,i=>{var{typed:t,size:e,prod:r}=i;return t(Gf,{string:function(s){return s.length},"Matrix | Array":function(s){return r(e(s))}})}),Kf="identity",Cg=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],Fg=mt(Kf,Cg,i=>{var{typed:t,config:e,matrix:r,BigNumber:n,DenseMatrix:s,SparseMatrix:a}=i;return t(Kf,{"":function(){return e.matrix==="Matrix"?r([]):[]},string:function(p){return r(p)},"number | BigNumber":function(p){return f(p,p,e.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, string":function(p,c){return f(p,p,c)},"number | BigNumber, number | BigNumber":function(p,c){return f(p,c,e.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(p,c,d){return f(p,c,d)},Array:function(p){return l(p)},"Array, string":function(p,c){return l(p,c)},Matrix:function(p){return l(p.valueOf(),p.storage())},"Matrix, string":function(p,c){return l(p.valueOf(),c)}});function l(h,p){switch(h.length){case 0:return p?r(p):[];case 1:return f(h[0],h[0],p);case 2:return f(h[0],h[1],p);default:throw new Error("Vector containing two values expected")}}function f(h,p,c){var d=Ee(h)||Ee(p)?n:null;if(Ee(h)&&(h=h.toNumber()),Ee(p)&&(p=p.toNumber()),!de(h)||h<1)throw new Error("Parameters in function identity must be positive integers");if(!de(p)||p<1)throw new Error("Parameters in function identity must be positive integers");var g=d?new n(1):1,w=d?new d(0):0,m=[h,p];if(c){if(c==="sparse")return a.diagonal(m,g,0,w);if(c==="dense")return s.diagonal(m,g,0,w);throw new TypeError('Unknown matrix type "'.concat(c,'"'))}for(var D=la([],m,w),v=h<p?h:p,E=0;E<v;E++)D[E][E]=g;return D}}),Hf="kron",Mg=["typed","matrix","multiplyScalar"],Ng=mt(Hf,Mg,i=>{var{typed:t,matrix:e,multiplyScalar:r}=i;return t(Hf,{"Matrix, Matrix":function(a,l){return e(n(a.toArray(),l.toArray()))},"Matrix, Array":function(a,l){return e(n(a.toArray(),l))},"Array, Matrix":function(a,l){return e(n(a,l.toArray()))},"Array, Array":n});function n(s,a){if(Ce(s).length===1&&(s=[s]),Ce(a).length===1&&(a=[a]),Ce(s).length>2||Ce(a).length>2)throw new RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(s.length)+", y = "+JSON.stringify(a.length)+")");var l=[],f=[];return s.map(function(h){return a.map(function(p){return f=[],l.push(f),h.map(function(c){return p.map(function(d){return f.push(r(c,d))})})})})&&l}});function Sg(){throw new Error('No "bignumber" implementation available')}function Bg(){throw new Error('No "fraction" implementation available')}function Tg(){throw new Error('No "matrix" implementation available')}var Jf="reshape",Ig=["typed","isInteger","matrix"],Og=mt(Jf,Ig,i=>{var{typed:t,isInteger:e}=i;return t(Jf,{"Matrix, Array":function(n,s){return n.reshape(s,!0)},"Array, Array":function(n,s){return s.forEach(function(a){if(!e(a))throw new TypeError("Invalid size for dimension: "+a)}),ca(n,s)}})}),Xf="size",$g=["typed","config","?matrix"],Lg=mt(Xf,$g,i=>{var{typed:t,config:e,matrix:r}=i;return t(Xf,{Matrix:function(s){return s.create(s.size())},Array:Ce,string:function(s){return e.matrix==="Array"?[s.length]:r([s.length])},"number | Complex | BigNumber | Unit | boolean | null":function(s){return e.matrix==="Array"?[]:r?r([]):Tg()}})}),Vf="transpose",Rg=["typed","matrix"],Pg=mt(Vf,Rg,i=>{var{typed:t,matrix:e}=i;return t(Vf,{Array:a=>r(e(a)).valueOf(),Matrix:r,any:re});function r(a){var l=a.size(),f;switch(l.length){case 1:f=a.clone();break;case 2:{var h=l[0],p=l[1];if(p===0)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+oe(l)+")");switch(a.storage()){case"dense":f=n(a,h,p);break;case"sparse":f=s(a,h,p);break}}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+oe(l)+")")}return f}function n(a,l,f){for(var h=a._data,p=[],c,d=0;d<f;d++){c=p[d]=[];for(var g=0;g<l;g++)c[g]=re(h[g][d])}return a.createDenseMatrix({data:p,size:[f,l],datatype:a._datatype})}function s(a,l,f){for(var h=a._values,p=a._index,c=a._ptr,d=h?[]:void 0,g=[],w=[],m=[],D=0;D<l;D++)m[D]=0;var v,E,b;for(v=0,E=p.length;v<E;v++)m[p[v]]++;for(var N=0,x=0;x<l;x++)w.push(N),N+=m[x],m[x]=w[x];for(w.push(N),b=0;b<f;b++)for(var F=c[b],M=c[b+1],S=F;S<M;S++){var O=m[p[S]]++;g[O]=b,h&&(d[O]=re(h[S]))}return a.createSparseMatrix({values:d,index:g,ptr:w,size:[f,l],datatype:a._datatype})}}),Qf="ctranspose",zg=["typed","transpose","conj"],qg=mt(Qf,zg,i=>{var{typed:t,transpose:e,conj:r}=i;return t(Qf,{any:function(s){return r(e(s))}})}),tc="mode",kg=["typed","isNaN","isNumeric"],Ug=mt(tc,kg,i=>{var{typed:t,isNaN:e,isNumeric:r}=i;return t(tc,{"Array | Matrix":n,"...":function(a){return n(a)}});function n(s){s=pa(s.valueOf());var a=s.length;if(a===0)throw new Error("Cannot calculate mode of an empty array");for(var l={},f=[],h=0,p=0;p<s.length;p++){var c=s[p];if(r(c)&&e(c))throw new Error("Cannot calculate mode of an array containing NaN values");c in l||(l[c]=0),l[c]++,l[c]===h?f.push(c):l[c]>h&&(h=l[c],f=[c])}return f}});function Dn(i,t,e){var r;return String(i).indexOf("Unexpected type")!==-1?(r=arguments.length>2?" (type: "+_n(e)+", value: "+JSON.stringify(e)+")":" (type: "+i.data.actual+")",new TypeError("Cannot calculate "+t+", unexpected type of argument"+r)):String(i).indexOf("complex numbers")!==-1?(r=arguments.length>2?" (type: "+_n(e)+", value: "+JSON.stringify(e)+")":"",new TypeError("Cannot calculate "+t+", no ordering relation is defined for complex numbers"+r)):i}var ec="prod",Wg=["typed","config","multiplyScalar","numeric"],jg=mt(ec,Wg,i=>{var{typed:t,config:e,multiplyScalar:r,numeric:n}=i;return t(ec,{"Array | Matrix":s,"Array | Matrix, number | BigNumber":function(l,f){throw new Error("prod(A, dim) is not yet supported")},"...":function(l){return s(l)}});function s(a){var l;if(ji(a,function(f){try{l=l===void 0?f:r(l,f)}catch(h){throw Dn(h,"prod",f)}}),typeof l=="string"&&(l=n(l,e.number)),l===void 0)throw new Error("Cannot calculate prod of an empty array");return l}}),Yg="numeric",Zg=["number","?bignumber","?fraction"],Gg=mt(Yg,Zg,i=>{var{number:t,bignumber:e,fraction:r}=i,n={string:!0,number:!0,BigNumber:!0,Fraction:!0},s={number:a=>t(a),BigNumber:e?a=>e(a):Sg,Fraction:r?a=>r(a):Bg};return function(l){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"number",h=arguments.length>2?arguments[2]:void 0;if(h!==void 0)throw new SyntaxError("numeric() takes one or two arguments");var p=_n(l);if(!(p in n))throw new TypeError("Cannot convert "+l+' of type "'+p+'"; valid input types are '+Object.keys(n).join(", "));if(!(f in s))throw new TypeError("Cannot convert "+l+' to type "'+f+'"; valid output types are '+Object.keys(s).join(", "));return f===p?l:s[f](l)}}),rc="divideScalar",Kg=["typed","numeric"],Hg=mt(rc,Kg,i=>{var{typed:t,numeric:e}=i;return t(rc,{"number, number":function(n,s){return n/s},"Complex, Complex":function(n,s){return n.div(s)},"BigNumber, BigNumber":function(n,s){return n.div(s)},"Fraction, Fraction":function(n,s){return n.div(s)},"Unit, number | Complex | Fraction | BigNumber | Unit":(r,n)=>r.divide(n),"number | Fraction | Complex | BigNumber, Unit":(r,n)=>n.divideInto(r)})}),nc="pow",Jg=["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],Xg=mt(nc,Jg,i=>{var{typed:t,config:e,identity:r,multiply:n,matrix:s,inv:a,number:l,fraction:f,Complex:h}=i;return t(nc,{"number, number":p,"Complex, Complex":function(w,m){return w.pow(m)},"BigNumber, BigNumber":function(w,m){return m.isInteger()||w>=0||e.predictable?w.pow(m):new h(w.toNumber(),0).pow(m.toNumber(),0)},"Fraction, Fraction":function(w,m){var D=w.pow(m);if(D!=null)return D;if(e.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return p(w.valueOf(),m.valueOf())},"Array, number":c,"Array, BigNumber":function(w,m){return c(w,m.toNumber())},"Matrix, number":d,"Matrix, BigNumber":function(w,m){return d(w,m.toNumber())},"Unit, number | BigNumber":function(w,m){return w.pow(m)}});function p(g,w){if(e.predictable&&!de(w)&&g<0)try{var m=f(w),D=l(m);if((w===D||Math.abs((w-D)/w)<1e-14)&&m.d%2===1)return(m.n%2===0?1:-1)*Math.pow(-g,w)}catch{}return e.predictable&&(g<-1&&w===1/0||g>-1&&g<0&&w===-1/0)?NaN:de(w)||g>=0||e.predictable?Mf(g,w):g*g<1&&w===1/0||g*g>1&&w===-1/0?0:new h(g,0).pow(w,0)}function c(g,w){if(!de(w))throw new TypeError("For A^b, b must be an integer (value is "+w+")");var m=Ce(g);if(m.length!==2)throw new Error("For A^b, A must be 2 dimensional (A has "+m.length+" dimensions)");if(m[0]!==m[1])throw new Error("For A^b, A must be square (size is "+m[0]+"x"+m[1]+")");if(w<0)try{return c(a(g),-w)}catch(E){throw E.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 "+w+")"):E}for(var D=r(m[0]).valueOf(),v=g;w>=1;)(w&1)===1&&(D=n(v,D)),w>>=1,v=n(v,v);return D}function d(g,w){return s(c(g.valueOf(),w))}}),ic="dotDivide",Vg=["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],Qg=mt(ic,Vg,i=>{var{typed:t,matrix:e,equalScalar:r,divideScalar:n,DenseMatrix:s,concat:a}=i,l=Ym({typed:t,equalScalar:r}),f=pi({typed:t}),h=qs({typed:t,DenseMatrix:s}),p=Ea({typed:t,equalScalar:r}),c=hi({typed:t,DenseMatrix:s}),d=Wn({typed:t,matrix:e,concat:a});return t(ic,d({elop:n,SS:h,DS:f,SD:l,Ss:p,sS:c}))}),ks="compare",tv=["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],ev=mt(ks,tv,i=>{var{typed:t,config:e,equalScalar:r,matrix:n,BigNumber:s,Fraction:a,DenseMatrix:l,concat:f}=i,h=pi({typed:t}),p=qf({typed:t,equalScalar:r}),c=hi({typed:t,DenseMatrix:l}),d=Wn({typed:t,matrix:n,concat:f}),g=Ps({typed:t});return t(ks,rv({typed:t,config:e}),{"boolean, boolean":function(m,D){return m===D?0:m>D?1:-1},"BigNumber, BigNumber":function(m,D){return Rs(m,D,e.epsilon)?new s(0):new s(m.cmp(D))},"Fraction, Fraction":function(m,D){return new a(m.compare(D))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},g,d({SS:p,DS:h,Ss:c}))}),rv=mt(ks,["typed","config"],i=>{var{typed:t,config:e}=i;return t(ks,{"number, number":function(n,s){return Un(n,s,e.epsilon)?0:n>s?1:-1}})}),Us="equal",nv=["typed","matrix","equalScalar","DenseMatrix","concat"],iv=mt(Us,nv,i=>{var{typed:t,matrix:e,equalScalar:r,DenseMatrix:n,concat:s}=i,a=pi({typed:t}),l=qs({typed:t,DenseMatrix:n}),f=hi({typed:t,DenseMatrix:n}),h=Wn({typed:t,matrix:e,concat:s});return t(Us,sv({typed:t,equalScalar:r}),h({elop:r,SS:l,DS:a,Ss:f}))}),sv=mt(Us,["typed","equalScalar"],i=>{var{typed:t,equalScalar:e}=i;return t(Us,{"any, any":function(n,s){return n===null?s===null:s===null?n===null:n===void 0?s===void 0:s===void 0?n===void 0:e(n,s)}})}),Ws="smaller",ov=["typed","config","matrix","DenseMatrix","concat"],av=mt(Ws,ov,i=>{var{typed:t,config:e,matrix:r,DenseMatrix:n,concat:s}=i,a=pi({typed:t}),l=qs({typed:t,DenseMatrix:n}),f=hi({typed:t,DenseMatrix:n}),h=Wn({typed:t,matrix:r,concat:s}),p=Ps({typed:t});return t(Ws,uv({typed:t,config:e}),{"boolean, boolean":(c,d)=>c<d,"BigNumber, BigNumber":function(d,g){return d.lt(g)&&!Rs(d,g,e.epsilon)},"Fraction, Fraction":(c,d)=>c.compare(d)===-1,"Complex, Complex":function(d,g){throw new TypeError("No ordering relation is defined for complex numbers")}},p,h({SS:l,DS:a,Ss:f}))}),uv=mt(Ws,["typed","config"],i=>{var{typed:t,config:e}=i;return t(Ws,{"number, number":function(n,s){return n<s&&!Un(n,s,e.epsilon)}})}),js="larger",lv=["typed","config","matrix","DenseMatrix","concat"],fv=mt(js,lv,i=>{var{typed:t,config:e,matrix:r,DenseMatrix:n,concat:s}=i,a=pi({typed:t}),l=qs({typed:t,DenseMatrix:n}),f=hi({typed:t,DenseMatrix:n}),h=Wn({typed:t,matrix:r,concat:s}),p=Ps({typed:t});return t(js,cv({typed:t,config:e}),{"boolean, boolean":(c,d)=>c>d,"BigNumber, BigNumber":function(d,g){return d.gt(g)&&!Rs(d,g,e.epsilon)},"Fraction, Fraction":(c,d)=>c.compare(d)===1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},p,h({SS:l,DS:a,Ss:f}))}),cv=mt(js,["typed","config"],i=>{var{typed:t,config:e}=i;return t(js,{"number, number":function(n,s){return n>s&&!Un(n,s,e.epsilon)}})}),sc="deepEqual",hv=["typed","equal"],pv=mt(sc,hv,i=>{var{typed:t,equal:e}=i;return t(sc,{"any, any":function(s,a){return r(s.valueOf(),a.valueOf())}});function r(n,s){if(Array.isArray(n))if(Array.isArray(s)){var a=n.length;if(a!==s.length)return!1;for(var l=0;l<a;l++)if(!r(n[l],s[l]))return!1;return!0}else return!1;else return Array.isArray(s)?!1:e(n,s)}}),oc="partitionSelect",dv=["typed","isNumeric","isNaN","compare"],_v=mt(oc,dv,i=>{var{typed:t,isNumeric:e,isNaN:r,compare:n}=i,s=n,a=(h,p)=>-n(h,p);return t(oc,{"Array | Matrix, number":function(p,c){return l(p,c,s)},"Array | Matrix, number, string":function(p,c,d){if(d==="asc")return l(p,c,s);if(d==="desc")return l(p,c,a);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":l});function l(h,p,c){if(!de(p)||p<0)throw new Error("k must be a non-negative integer");if(ce(h)){var d=h.size();if(d.length>1)throw new Error("Only one dimensional matrices supported");return f(h.valueOf(),p,c)}if(Array.isArray(h))return f(h,p,c)}function f(h,p,c){if(p>=h.length)throw new Error("k out of bounds");for(var d=0;d<h.length;d++)if(e(h[d])&&r(h[d]))return h[d];for(var g=0,w=h.length-1;g<w;){for(var m=g,D=w,v=h[Math.floor(Math.random()*(w-g+1))+g];m<D;)if(c(h[m],v)>=0){var E=h[D];h[D]=h[m],h[m]=E,--D}else++m;c(h[m],v)>0&&--m,p<=m?w=m:g=m+1}return h[p]}}),ac="max",mv=["typed","config","numeric","larger"],gv=mt(ac,mv,i=>{var{typed:t,config:e,numeric:r,larger:n}=i;return t(ac,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(f,h){return ba(f,h.valueOf(),s)},"...":function(f){if(Os(f))throw new TypeError("Scalar values expected in function max");return a(f)}});function s(l,f){try{return n(l,f)?l:f}catch(h){throw Dn(h,"max",f)}}function a(l){var f;if(ji(l,function(h){try{isNaN(h)&&typeof h=="number"?f=NaN:(f===void 0||n(h,f))&&(f=h)}catch(p){throw Dn(p,"max",h)}}),f===void 0)throw new Error("Cannot calculate max of an empty array");return typeof f=="string"&&(f=r(f,e.number)),f}}),uc="min",vv=["typed","config","numeric","smaller"],wv=mt(uc,vv,i=>{var{typed:t,config:e,numeric:r,smaller:n}=i;return t(uc,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(f,h){return ba(f,h.valueOf(),s)},"...":function(f){if(Os(f))throw new TypeError("Scalar values expected in function min");return a(f)}});function s(l,f){try{return n(l,f)?l:f}catch(h){throw Dn(h,"min",f)}}function a(l){var f;if(ji(l,function(h){try{isNaN(h)&&typeof h=="number"?f=NaN:(f===void 0||n(h,f))&&(f=h)}catch(p){throw Dn(p,"min",h)}}),f===void 0)throw new Error("Cannot calculate min of an empty array");return typeof f=="string"&&(f=r(f,e.number)),f}}),lc="add",yv=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],Dv=mt(lc,yv,i=>{var{typed:t,matrix:e,addScalar:r,equalScalar:n,DenseMatrix:s,SparseMatrix:a,concat:l}=i,f=kf({typed:t}),h=ug({typed:t,equalScalar:n}),p=Uf({typed:t,DenseMatrix:s}),c=Wn({typed:t,matrix:e,concat:l});return t(lc,{"any, any":r,"any, any, ...any":t.referToSelf(d=>(g,w,m)=>{for(var D=d(g,w),v=0;v<m.length;v++)D=d(D,m[v]);return D})},c({elop:r,DS:f,SS:h,Ss:p}))}),fc="dot",bv=["typed","addScalar","multiplyScalar","conj","size"],Ev=mt(fc,bv,i=>{var{typed:t,addScalar:e,multiplyScalar:r,conj:n,size:s}=i;return t(fc,{"Array | DenseMatrix, Array | DenseMatrix":l,"SparseMatrix, SparseMatrix":f});function a(p,c){var d=h(p),g=h(c),w,m;if(d.length===1)w=d[0];else if(d.length===2&&d[1]===1)w=d[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+d.join(", ")+")");if(g.length===1)m=g[0];else if(g.length===2&&g[1]===1)m=g[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+g.join(", ")+")");if(w!==m)throw new RangeError("Vectors must have equal length ("+w+" != "+m+")");if(w===0)throw new RangeError("Cannot calculate the dot product of empty vectors");return w}function l(p,c){var d=a(p,c),g=ce(p)?p._data:p,w=ce(p)?p._datatype||p.getDataType():void 0,m=ce(c)?c._data:c,D=ce(c)?c._datatype||c.getDataType():void 0,v=h(p).length===2,E=h(c).length===2,b=e,N=r;if(w&&D&&w===D&&typeof w=="string"&&w!=="mixed"){var x=w;b=t.find(e,[x,x]),N=t.find(r,[x,x])}if(!v&&!E){for(var F=N(n(g[0]),m[0]),M=1;M<d;M++)F=b(F,N(n(g[M]),m[M]));return F}if(!v&&E){for(var S=N(n(g[0]),m[0][0]),O=1;O<d;O++)S=b(S,N(n(g[O]),m[O][0]));return S}if(v&&!E){for(var C=N(n(g[0][0]),m[0]),T=1;T<d;T++)C=b(C,N(n(g[T][0]),m[T]));return C}if(v&&E){for(var L=N(n(g[0][0]),m[0][0]),U=1;U<d;U++)L=b(L,N(n(g[U][0]),m[U][0]));return L}}function f(p,c){a(p,c);for(var d=p._index,g=p._values,w=c._index,m=c._values,D=0,v=e,E=r,b=0,N=0;b<d.length&&N<w.length;){var x=d[b],F=w[N];if(x<F){b++;continue}if(x>F){N++;continue}x===F&&(D=v(D,E(g[b],m[N])),b++,N++)}return D}function h(p){return ce(p)?p.size():s(p)}}),xv="trace",Av=["typed","matrix","add"],Cv=mt(xv,Av,i=>{var{typed:t,matrix:e,add:r}=i;return t("trace",{Array:function(l){return n(e(l))},SparseMatrix:s,DenseMatrix:n,any:re});function n(a){var l=a._size,f=a._data;switch(l.length){case 1:if(l[0]===1)return re(f[0]);throw new RangeError("Matrix must be square (size: "+oe(l)+")");case 2:{var h=l[0],p=l[1];if(h===p){for(var c=0,d=0;d<h;d++)c=r(c,f[d][d]);return c}else throw new RangeError("Matrix must be square (size: "+oe(l)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+oe(l)+")")}}function s(a){var l=a._values,f=a._index,h=a._ptr,p=a._size,c=p[0],d=p[1];if(c===d){var g=0;if(l.length>0)for(var w=0;w<d;w++)for(var m=h[w],D=h[w+1],v=m;v<D;v++){var E=f[v];if(E===w){g=r(g,l[v]);break}if(E>w)break}return g}throw new RangeError("Matrix must be square (size: "+oe(p)+")")}}),cc="det",Fv=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],Mv=mt(cc,Fv,i=>{var{typed:t,matrix:e,subtractScalar:r,multiply:n,divideScalar:s,isZero:a,unaryMinus:l}=i;return t(cc,{any:function(p){return re(p)},"Array | Matrix":function(p){var c;switch(ce(p)?c=p.size():Array.isArray(p)?(p=e(p),c=p.size()):c=[],c.length){case 0:return re(p);case 1:if(c[0]===1)return re(p.valueOf()[0]);if(c[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+oe(c)+")");case 2:{var d=c[0],g=c[1];if(d===g)return f(p.clone().valueOf(),d);if(g===0)return 1;throw new RangeError("Matrix must be square (size: "+oe(c)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+oe(c)+")")}}});function f(h,p,c){if(p===1)return re(h[0][0]);if(p===2)return r(n(h[0][0],h[1][1]),n(h[1][0],h[0][1]));for(var d=!1,g=new Array(p).fill(0).map((M,S)=>S),w=0;w<p;w++){var m=g[w];if(a(h[m][w])){var D=void 0;for(D=w+1;D<p;D++)if(!a(h[g[D]][w])){m=g[D],g[D]=g[w],g[w]=m,d=!d;break}if(D===p)return h[m][w]}for(var v=h[m][w],E=w===0?1:h[g[w-1]][w-1],b=w+1;b<p;b++)for(var N=g[b],x=w+1;x<p;x++)h[N][x]=s(r(n(h[N][x],v),n(h[N][w],h[m][x])),E)}var F=h[g[p-1]][p-1];return d?l(F):F}}),hc="inv",Nv=["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],Sv=mt(hc,Nv,i=>{var{typed:t,matrix:e,divideScalar:r,addScalar:n,multiply:s,unaryMinus:a,det:l,identity:f,abs:h}=i;return t(hc,{"Array | Matrix":function(d){var g=ce(d)?d.size():Ce(d);switch(g.length){case 1:if(g[0]===1)return ce(d)?e([r(1,d.valueOf()[0])]):[r(1,d[0])];throw new RangeError("Matrix must be square (size: "+oe(g)+")");case 2:{var w=g[0],m=g[1];if(w===m)return ce(d)?e(p(d.valueOf(),w,m),d.storage()):p(d,w,m);throw new RangeError("Matrix must be square (size: "+oe(g)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+oe(g)+")")}},any:function(d){return r(1,d)}});function p(c,d,g){var w,m,D,v,E;if(d===1){if(v=c[0][0],v===0)throw Error("Cannot calculate inverse, determinant is zero");return[[r(1,v)]]}else if(d===2){var b=l(c);if(b===0)throw Error("Cannot calculate inverse, determinant is zero");return[[r(c[1][1],b),r(a(c[0][1]),b)],[r(a(c[1][0]),b),r(c[0][0],b)]]}else{var N=c.concat();for(w=0;w<d;w++)N[w]=N[w].concat();for(var x=f(d).valueOf(),F=0;F<g;F++){var M=h(N[F][F]),S=F;for(w=F+1;w<d;)h(N[w][F])>M&&(M=h(N[w][F]),S=w),w++;if(M===0)throw Error("Cannot calculate inverse, determinant is zero");w=S,w!==F&&(E=N[F],N[F]=N[w],N[w]=E,E=x[F],x[F]=x[w],x[w]=E);var O=N[F],C=x[F];for(w=0;w<d;w++){var T=N[w],L=x[w];if(w!==F){if(T[F]!==0){for(D=r(a(T[F]),O[F]),m=F;m<g;m++)T[m]=n(T[m],s(D,O[m]));for(m=0;m<g;m++)L[m]=n(L[m],s(D,C[m]))}}else{for(D=O[F],m=F;m<g;m++)T[m]=r(T[m],D);for(m=0;m<g;m++)L[m]=r(L[m],D)}}}return x}}}),pc="pinv",Bv=["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],Tv=mt(pc,Bv,i=>{var{typed:t,matrix:e,inv:r,deepEqual:n,equal:s,dotDivide:a,dot:l,ctranspose:f,divideScalar:h,multiply:p,add:c,Complex:d}=i;return t(pc,{"Array | Matrix":function(b){var N=ce(b)?b.size():Ce(b);switch(N.length){case 1:return v(b)?f(b):N[0]===1?r(b):a(f(b),l(b,b));case 2:{if(v(b))return f(b);var x=N[0],F=N[1];if(x===F)try{return r(b)}catch(M){if(!(M instanceof Error&&M.message.match(/Cannot calculate inverse, determinant is zero/)))throw M}return ce(b)?e(g(b.valueOf(),x,F),b.storage()):g(b,x,F)}default:throw new RangeError("Matrix must be two dimensional (size: "+oe(N)+")")}},any:function(b){return s(b,0)?re(b):h(1,b)}});function g(E,b,N){var{C:x,F}=m(E,b,N),M=p(r(p(f(x),x)),f(x)),S=p(f(F),r(p(F,f(F))));return p(S,M)}function w(E,b,N){for(var x=re(E),F=0,M=0;M<b;M++){if(N<=F)return x;for(var S=M;D(x[S][F]);)if(S++,b===S&&(S=M,F++,N===F))return x;[x[S],x[M]]=[x[M],x[S]];for(var O=x[M][F],C=0;C<N;C++)x[M][C]=a(x[M][C],O);for(var T=0;T<b;T++)if(T!==M){O=x[T][F];for(var L=0;L<N;L++)x[T][L]=c(x[T][L],p(-1,p(O,x[M][L])))}F++}return x}function m(E,b,N){var x=w(E,b,N),F=E.map((S,O)=>S.filter((C,T)=>T<b&&!D(l(x[T],x[T])))),M=x.filter((S,O)=>!D(l(x[O],x[O])));return{C:F,F:M}}function D(E){return s(c(E,d(1,1)),c(0,d(1,1)))}function v(E){return n(c(E,d(1,1)),c(p(E,0),d(1,1)))}}),Iv="divide",Ov=["typed","matrix","multiply","equalScalar","divideScalar","inv"],$v=mt(Iv,Ov,i=>{var{typed:t,matrix:e,multiply:r,equalScalar:n,divideScalar:s,inv:a}=i,l=Ea({typed:t,equalScalar:n}),f=xa({typed:t});return t("divide",Tl({"Array | Matrix, Array | Matrix":function(p,c){return r(p,a(c))},"DenseMatrix, any":function(p,c){return f(p,c,s,!1)},"SparseMatrix, any":function(p,c){return l(p,c,s,!1)},"Array, any":function(p,c){return f(e(p),c,s,!1).valueOf()},"any, Array | Matrix":function(p,c){return r(p,a(c))}},s.signatures))}),dc="sum",Lv=["typed","config","add","numeric"],Rv=mt(dc,Lv,i=>{var{typed:t,config:e,add:r,numeric:n}=i;return t(dc,{"Array | Matrix":s,"Array | Matrix, number | BigNumber":a,"...":function(f){if(Os(f))throw new TypeError("Scalar values expected in function sum");return s(f)}});function s(l){var f;return ji(l,function(h){try{f=f===void 0?h:r(f,h)}catch(p){throw Dn(p,"sum",h)}}),f===void 0&&(f=n(0,e.number)),typeof f=="string"&&(f=n(f,e.number)),f}function a(l,f){try{var h=ba(l,f,r);return h}catch(p){throw Dn(p,"sum")}}}),_c="median",Pv=["typed","add","divide","compare","partitionSelect"],zv=mt(_c,Pv,i=>{var{typed:t,add:e,divide:r,compare:n,partitionSelect:s}=i;function a(h){try{h=pa(h.valueOf());var p=h.length;if(p===0)throw new Error("Cannot calculate median of an empty array");if(p%2===0){for(var c=p/2-1,d=s(h,c+1),g=h[c],w=0;w<c;++w)n(h[w],g)>0&&(g=h[w]);return f(g,d)}else{var m=s(h,(p-1)/2);return l(m)}}catch(D){throw Dn(D,"median")}}var l=t({"number | BigNumber | Complex | Unit":function(p){return p}}),f=t({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(p,c){return r(e(p,c),2)}});return t(_c,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(p,c){throw new Error("median(A, dim) is not yet supported")},"...":function(p){if(Os(p))throw new TypeError("Scalar values expected in function median");return a(p)}})}),Ys=q_({config:or}),Aa=j_({}),Ca=K_({}),Fa=X_({}),Gr=tm({Matrix:Fa}),Mt=Wd({BigNumber:Ys,Complex:Aa,DenseMatrix:Gr,Fraction:Ca}),qv=Tm({typed:Mt}),Zs=Om({typed:Mt}),kv=Em({BigNumber:Ys,typed:Mt}),mc=Dg({typed:Mt}),bn=hm({config:or,typed:Mt}),Gs=nm({typed:Mt}),Uv=am({typed:Mt}),Ks=pg({typed:Mt}),gc=ym({typed:Mt}),Ma=_m({Matrix:Fa,equalScalar:bn,typed:Mt}),vc=Lm({typed:Mt}),wc=lm({typed:Mt}),Na=Sm({typed:Mt}),yc=Cm({Fraction:Ca,typed:Mt}),Dc=sm({typed:Mt}),Fe=Mm({DenseMatrix:Gr,Matrix:Fa,SparseMatrix:Ma,typed:Mt}),bc=Ug({isNaN:wc,isNumeric:Dc,typed:Mt}),Yi=Gg({bignumber:kv,fraction:yc,number:gc}),Wv=jg({config:or,multiplyScalar:Ks,numeric:Yi,typed:Mt}),jv=Og({isInteger:Gs,matrix:Fe,typed:Mt}),Ec=Lg({matrix:Fe,config:or,typed:Mt}),xc=Pg({matrix:Fe,typed:Mt}),jn=Eg({isInteger:Gs,matrix:Fe,typed:Mt}),Yv=Ag({prod:Wv,size:Ec,typed:Mt}),Zv=qg({conj:mc,transpose:xc,typed:Mt}),Zi=Hg({numeric:Yi,typed:Mt}),Gv=Qg({DenseMatrix:Gr,concat:jn,divideScalar:Zi,equalScalar:bn,matrix:Fe,typed:Mt}),Ac=iv({DenseMatrix:Gr,concat:jn,equalScalar:bn,matrix:Fe,typed:Mt}),Cc=Fg({BigNumber:Ys,DenseMatrix:Gr,SparseMatrix:Ma,config:or,matrix:Fe,typed:Mt}),Kv=Ng({matrix:Fe,multiplyScalar:Ks,typed:Mt}),Hv=av({DenseMatrix:Gr,concat:jn,config:or,matrix:Fe,typed:Mt}),Jv=gg({DenseMatrix:Gr,concat:jn,equalScalar:bn,matrix:Fe,subtractScalar:vc,typed:Mt,unaryMinus:Na}),Gi=Dv({DenseMatrix:Gr,SparseMatrix:Ma,addScalar:Zs,concat:jn,equalScalar:bn,matrix:Fe,typed:Mt}),Fc=ev({BigNumber:Ys,DenseMatrix:Gr,Fraction:Ca,concat:jn,config:or,equalScalar:bn,matrix:Fe,typed:Mt}),Xv=pv({equal:Ac,typed:Mt}),Mc=Ev({addScalar:Zs,conj:mc,multiplyScalar:Ks,size:Ec,typed:Mt}),Vv=fv({DenseMatrix:Gr,concat:jn,config:or,matrix:Fe,typed:Mt}),Sa=wv({config:or,numeric:Yi,smaller:Hv,typed:Mt}),di=_g({addScalar:Zs,dot:Mc,equalScalar:bn,matrix:Fe,multiplyScalar:Ks,typed:Mt}),Qv=_v({compare:Fc,isNaN:wc,isNumeric:Dc,typed:Mt}),t1=Rv({add:Gi,config:or,numeric:Yi,typed:Mt}),e1=Cv({add:Gi,matrix:Fe,typed:Mt}),Nc=Mv({divideScalar:Zi,isZero:Uv,matrix:Fe,multiply:di,subtractScalar:vc,typed:Mt,unaryMinus:Na}),r1=gv({config:or,larger:Vv,numeric:Yi,typed:Mt}),Hs=Sv({abs:qv,addScalar:Zs,det:Nc,divideScalar:Zi,identity:Cc,matrix:Fe,multiply:di,typed:Mt,unaryMinus:Na}),n1=Tv({Complex:Aa,add:Gi,ctranspose:Zv,deepEqual:Xv,divideScalar:Zi,dot:Mc,dotDivide:Gv,equal:Ac,inv:Hs,matrix:Fe,multiply:di,typed:Mt}),i1=Xg({Complex:Aa,config:or,fraction:yc,identity:Cc,inv:Hs,matrix:Fe,multiply:di,number:gc,typed:Mt}),s1=$v({divideScalar:Zi,equalScalar:bn,inv:Hs,matrix:Fe,multiply:di,typed:Mt}),Sc=zv({add:Gi,compare:Fc,divide:s1,partitionSelect:Qv,typed:Mt});class o1{constructor(t,e,r){z(this,"_cacheData");z(this,"_variables");z(this,"_math");z(this,"_timeframe");this._cacheData={},this._variables=t,this._math=e,this._timeframe=r}alma({series:t,length:e,offset:r,sigma:n,floor:s},a){if(e===void 0||r===void 0||n===void 0)return;const l=this._cacheDataList(t,e,`alma_${a}`);if(l===void 0)return;let f=r*(e-1);s&&(f=Math.floor(f));const h=e/n;let p=0,c=0;for(let d=0;d<=e-1;d++){const g=Math.exp(-1*Math.pow(d-f,2)/(2*Math.pow(h,2)));p+=g,c+=l[l.length-1-(e-d-1)]*g}return c/p}sma({source:t,length:e},r){if(t===void 0||isNaN(t)||e===void 0)return;let n=0;const s=this._cacheDataList(t,e,`sma_${r}`);if(s===void 0)return;const a=s.slice(-e);return n=t1(...a)/e,n}rma({source:t,length:e},r){if(t===void 0||e===void 0||isNaN(t))return;const n=this._cacheData[`sma_${r}`]||[];n[this._variables.bar_index]=t,this._cacheData[`sma_${r}`]=n;const{sum:s}=this._cacheData[`rma_${r}`]||{},a=1/e,l=s===void 0?this.sma({source:t,length:e},r):a*t+(1-a)*(s||0);return this._cacheDataHandle(`rma_${r}`,{sum:l}),l}atr({length:t},e){const{high:r,close:n}=this._cacheData[`atr_${e}`]||{},{high:s,close:a,low:l}=this._variables,f=r===void 0?s-l:Math.max(Math.max(s-l,Math.abs(s-n)),Math.abs(l-n));return this._cacheDataHandle(`atr_${e}`,{high:s,close:a}),this.rma({source:f,length:t},e)}barssince({condition:t},e){let{count:r}=this._cacheData[`barssince_${e}`]||{};if(t)r=0;else{if(r===void 0)return;r+=1}return this._cacheDataHandle(`barssince_${e}`,{count:r}),r}stdev({source:t,length:e,biased:r=!0},n){if(t===void 0||isNaN(t)||e===void 0)return;const s=this._cacheDataList(t,e,`stdev_${n}`),a=this.sma({source:t,length:e},n);if(s===void 0)return;let l=0;for(let f=0;f<e;f++){const h=this._sum(s[s.length-1-f],-(a||0));l+=h*h}return r||e<=1?Math.sqrt(l/e):Math.sqrt(l/(e-1))}_sum(t,e){let n=t+e;return Math.abs(n)<=1e-10&&(n=0),n}bb({series:t,length:e,mult:r},n){if(t===void 0||isNaN(t)||e===void 0||r===void 0)return[];const s=this.sma({source:t,length:e},n),a=this.stdev({source:t,length:e},n);if(s===void 0||a===void 0)return[];const l=r*a;return[s,s+l,s-l]}bbw({series:t,length:e,mult:r},n){if(t===void 0||isNaN(t)||e===void 0||r===void 0)return;const s=this.sma({source:t,length:e},n),a=this.stdev({source:t,length:e},n);if(s===void 0||a===void 0)return;const l=r*a;return(s+l-(s-l))/s}cci({source:t,length:e},r){if(t===void 0||isNaN(t)||e===void 0)return;const n=this.sma({source:t,length:e},r),s=this.dev({source:t,length:e},r);if(!(n===void 0||s===void 0))return(t-n)/(.015*s)}change({source:t,length:e=1},r){const n=this._cacheData[`change_${r}`]||[];n[this._variables.bar_index]=t,this._cacheData[`change_${r}`]=n;const s=n[n.length-1-e];if(!(t===void 0||isNaN(t)))return s===void 0?s:typeof t=="boolean"?s!==t:t-s}cmo({series:t,length:e},r){if(t===void 0||isNaN(t)||e===void 0)return;const n=this.change({source:t},r);if(n===void 0)return;const s=this._math.sum({source:n>=0?n:0,length:e},`sm1_${r}`),a=this._math.sum({source:n>=0?0:-n,length:e},`sm2_${r}`);if(!(s===void 0||a===void 0))return 100*(s-a)/(s+a)}cog({source:t,length:e},r){if(t===void 0||isNaN(t)||e===void 0)return;const n=this._cacheDataList(t,e,`cog_${r}`),s=this._math.sum({source:t,length:e},r);if(s===void 0||n===void 0)return;let a=0;for(let l=0;l<e;l++){const f=n[n.length-1-l];a+=f*(l+1)}return-a/s}correlation({source1:t,source2:e,length:r},n){if(t===void 0||isNaN(t)||e===void 0||isNaN(e)||r===void 0)return;const s=this._cacheDataList([t,e],r,`correlation_${n}`),a=this.sma({source:t,length:r},`sma1_${n}`),l=this.sma({source:e,length:r},`sma2_${n}`);if(a===void 0||l===void 0||s===void 0)return;let f=0,h=0,p=0;for(let d=0;d<r;d++){const[g,w]=s[s.length-1-d],m=g-a,D=w-l;f+=m*D,h+=m*m,p+=D*D}return isNaN(h)||isNaN(f)||isNaN(p)?void 0:f/Math.sqrt(h*p)}cross({source1:t,source2:e},r){if(t===void 0||e===void 0)return!1;const{source1:n,source2:s}=this._cacheData[`cross_${r}`]||{};return this._cacheDataHandle(`cross_${r}`,{source1:t,source2:e}),n===void 0||s===void 0?!1:n>=s&&t<e||n<=s&&t>e}crossover({source1:t,source2:e},r){if(t===void 0||e===void 0)return!1;const{source1:n,source2:s}=this._cacheData[`crossover_${r}`]||{};return this._cacheDataHandle(`crossover_${r}`,{source1:t,source2:e}),n===void 0||s===void 0?!1:n<=s&&t>e}crossunder({source1:t,source2:e},r){if(t===void 0||e===void 0)return!1;const{source1:n,source2:s}=this._cacheData[`crossunder_${r}`]||{};return this._cacheDataHandle(`crossunder_${r}`,{source1:t,source2:e}),n===void 0||s===void 0?!1:n>=s&&t<e}cum({source:t=0},e){t=isNaN(t)?0:t;let{sum:r}=this._cacheData[`cum_${e}`]||{};return r=r||0,r+=t,this._cacheDataHandle(`cum_${e}`,{sum:r}),r}dev({source:t,length:e},r){if(t===void 0||isNaN(t)||e===void 0)return;const n=this.sma({source:t,length:e},r);let s=0;const a=this._cacheDataList(t,e,`dev_${r}`);if(!(!a||n===void 0)){for(let l=0;l<e;l++){const f=a[a.length-1-l];s+=Math.abs(f-n)}return s/e}}dmi({diLength:t,adxSmoothing:e},r){if(t===void 0||e===void 0)return[void 0,void 0,void 0];const n=`dmi_${r}`,{low:s,high:a,close:l,PDMS:f,NDMS:h,TRS:p,ADX:c,count:d=0}=this._cacheData[n]||{},{low:g,high:w,close:m}=this._variables;if(s===void 0||a===void 0||l===void 0)return this._cacheData[n]={low:g,high:w,close:m,PDMS:f,NDMS:h,TRS:w-g,count:1},[void 0,void 0,void 0];let D=w-a,v=s-g;D=D>v&&D>0?D:0,v=v>D&&v>0?v:0,D===v&&(D=v=0);const E=Math.max(w-g,Math.abs(w-l),Math.abs(g-l));if(d<t)return this._cacheDataHandle(n,{low:g,high:w,close:m,PDMS:(f||0)+D,NDMS:(h||0)+v,TRS:(p||0)+E,count:d+1}),[void 0,void 0,void 0];{const b=f-f/t+D,N=h-h/t+v,x=p-p/t+E,F=b/x*100,M=N/x*100,S=Math.abs((F-M)/(F+M))*100;let O=S,C=[F,M,void 0];if(d+1-t<e){const T=d+1-t;O=((c||0)*(T-1)+S)/T}else O=(c*(e-1)+S)/e,C=[F,M,O];return this._cacheDataHandle(n,{low:g,high:w,close:m,PDMS:b,NDMS:N,TRS:x,ADX:O,count:d+1}),C}}ema({source:t,length:e},r){if(t===void 0||e===void 0||isNaN(t))return;let{sum:n,count:s=1}=this._cacheData[`ema_${r}`]||{};const a=this.sma({source:t,length:e},r);if(s>e){const l=2/(e+1);n=n===void 0?t:l*t+(1-l)*(n||0)}else n=a;return s+=1,this._cacheDataHandle(`ema_${r}`,{sum:n,count:s}),n}falling({source:t,length:e},r){if(t===void 0||isNaN(t)||e===void 0)return!1;const{source:n,fallings:s=[]}=this._cacheData[`falling_${r}`]||{};s.push(n>t);const a=s.slice(-e);return this._cacheDataHandle(`falling_${r}`,{source:t,fallings:a}),a.length<e?!1:a.every(l=>l)}rising({source:t,length:e},r){if(t===void 0||isNaN(t)||e===void 0)return!1;const{source:n,risings:s=[]}=this._cacheData[`rising_${r}`]||{};s.push(n<t);const a=s.slice(-e);return this._cacheDataHandle(`rising_${r}`,{source:t,risings:a}),a.length<e?!1:a.every(l=>l)}highest({source:t,length:e},r){if(e===void 0||e<=0)return;const n=this._cacheData[`highest_${r}`]||[],{high:s,bar_index:a}=this._variables;typeof t!="number"?n[a]=s:n[a]=t,this._cacheData[`highest_${r}`]=n;const l=n.filter(()=>!0);if(!(l.length<e))return Math.max(...l.slice(-e))}highestbars({source:t,length:e},r){if(e===void 0||e<=0)return;const n=this._cacheData[`highestbars_${r}`]||[],{high:s,bar_index:a}=this._variables;typeof t!="number"?n[a]=s:n[a]=t,this._cacheData[`highestbars_${r}`]=n;const l=n.filter(()=>!0);return l.length<e?void 0:l.slice(-e).reduce((h,p,c,d)=>p>=d[h]?c:h,0)-e+1}wma({source:t,length:e},r){if(e===void 0||t===void 0||isNaN(t)||e<=0)return;const n=this._cacheDataList(t,e,`wma_${r}`);if(!n)return;let s=0,a=0;for(let l=0;l<e;l++){const f=(e-l)*e;s+=f,a+=n[n.length-1-l]*f}return a/s}hma({source:t,length:e},r){if(e===void 0||t===void 0||isNaN(t)||e<=0)return;const n=this.wma({source:t,length:e},r),s=this.wma({source:t,length:Math.round(e/2)},r);return n===void 0||s===void 0?void 0:this.wma({source:2*s-n,length:Math.floor(Math.sqrt(e))},`hma_${r}`)}kc({series:t,length:e,mult:r,useTrueRange:n=!0},s){if(t===void 0||isNaN(t)||e===void 0||r===void 0)return[void 0,void 0,void 0];const a=this.ema({source:t,length:e},s),{ta:l,high:f,low:h}=this._variables,p=n?l.tr:f-h,c=this.ema({source:p,length:e},`range_${s}`);return[a,a+c*r,a-c*r]}kcw({series:t,length:e,mult:r,useTrueRange:n=!0},s){if(t===void 0||isNaN(t)||e===void 0||r===void 0)return;const a=this.ema({source:t,length:e},s),{ta:l,high:f,low:h}=this._variables,p=n?l.tr:f-h,c=this.ema({source:p,length:e},`range_${s}`);return(a+c*r-(a-c*r))/a}linreg({source:t,length:e,offset:r},n){if(e===void 0||r===void 0)return;const s=this._cacheDataList(t,e,`dev_${n}`);if(!s)return;const a=s.slice(-e).filter(g=>g!==void 0);let l=0,f=0,h=0,p=0;for(const[g,w]of a.entries())l+=g,f+=w,h+=g*w,p+=g*g;const c=(e*h-l*f)/(e*p-l*l);return(f-c*l)/e+c*(e-1-r)}lowest({source:t,length:e},r){if(e===void 0||e<=0)return;const n=this._cacheData[`lowest_${r}`]||[],{low:s,bar_index:a}=this._variables;typeof t!="number"?n[a]=s:n[a]=t,this._cacheData[`lowest_${r}`]=n;const l=n.filter(()=>!0);if(!(l.length<e))return Math.min(...l.slice(-e))}lowestbars({source:t,length:e},r){if(e===void 0||e<=0)return;const n=this._cacheData[`lowestbars_${r}`]||[],{low:s,bar_index:a}=this._variables;typeof t!="number"?n[a]=s:n[a]=t,this._cacheData[`lowestbars_${r}`]=n;const l=n.filter(()=>!0);return l.length<e?void 0:l.slice(-e).reduce((h,p,c,d)=>p<=d[h]?c:h,0)-e+1}macd({source:t,fastlen:e,slowlen:r,siglen:n},s){if(t===void 0||isNaN(t)||e===void 0||r===void 0||n===void 0)return[void 0,void 0,void 0];const a=this.ema({source:t,length:e},`ema1_${s}`),l=this.ema({source:t,length:r},`ema2_${s}`);if(a===void 0||l===void 0)return[void 0,void 0,void 0];const f=a-l,h=this.ema({source:f,length:n},`macd_${s}`);if(h===void 0)return[f,h,void 0];const p=f-h;return[f,h,p]}max({source:t},e){if(t===void 0||isNaN(t))return;let r=this._cacheData[`max_${e}`]||0;return t>r&&(r=t),this._cacheData[`max_${e}`]=r,r}min({source:t},e){if(t===void 0||isNaN(t))return;let r=this._cacheData[`min_${e}`]||1/0;return t<r&&(r=t),this._cacheData[`min_${e}`]=r,r}median({source:t,length:e},r){if(e===void 0||t===void 0||isNaN(t)||e<=0)return;const n=this._cacheDataList(t,e,`dev_${r}`);if(n)return Sc(n.slice(-e))}mfi({series:t,length:e},r){if(e===void 0||t===void 0||isNaN(t)||e<=0)return;const{volume:n}=this._variables,s=this.change({source:t},r),a=this._math.sum({source:n*(s>=0?0:t),length:e},`lower_${r}`),l=this._math.sum({source:n*(s<=0?0:t),length:e},`upper_${r}`);if(!(l===void 0||a===void 0))return 100-100/(1+l/a)}mode({source:t,length:e},r){if(e===void 0||t===void 0||isNaN(t)||e<=0)return;const n=this._cacheDataList(t,e,`mode_${r}`);if(n)return Sa(bc(n.slice(-e)))}mom({source:t,length:e},r){if(e===void 0||e<0)return;const n=`mom_${r}`,s=this._cacheData[n]||[];if(s[this._variables.bar_index]=t,this._cacheData[n]=s,s.length<=e||t===void 0||isNaN(t))return;let a=s.length-e-1,l;for(;l===void 0&&a>=0;)l=s[a],a--;return l===void 0?l:t-l}percentile_linear_interpolation({source:t,length:e,percentage:r},n){if(e===void 0||r===void 0||e<0||r<0||r>100)return;const s=this._cacheDataList(t,e+1,`percentile_linear_interpolation_${n}`);if(!s)return;const a=this._sort(s.slice(-(e+1))),l=a.length;r/=100;const f=1/(l*2);if(r<=f)return a[0];if(r>=1-1/(l*2))return a[l-1];for(const[h,p]of a.entries()){const c=a[h-1];if(r<(h+.5)/l)return c===void 0||p===void 0?void 0:c+(p-c)*(r-(h-.5)/l)/(1/l)}}percentile_nearest_rank({source:t,length:e,percentage:r},n){if(e===void 0||r===void 0||t===void 0||isNaN(t)||e<0||r<0||r>100)return;const s=this._cacheDataList(t,e,`percentile_nearest_rank_${n}`);if(!s)return;const a=this._sort(s.slice(-e)),l=r/100*a.length,f=Math.ceil(l)-1;return a[f>=a.length?a.length-1:f]}percentrank({source:t,length:e},r){if(e===void 0||e<0)return;const n=this._cacheDataList(t,e+1,`percentile_nearest_rank_${r}`);if(!n)return;const s=n.slice(-(e+1)),a=t;if(a===void 0)return;let l=0;for(let f=0;f<s.length;f++)s[f]!==void 0&&(s[f]<a||s[f]===a&&f<e)&&l++;return l/(s.length-1)*100}pivot_point_levels({type:t,anchor:e,developing:r},n){const s=new Jt;let{close:a,open:l,low:f,high:h}=this._variables;const p=`pivot_point_levels_${n}`,{close:c,low:d,high:g,open:w,result:m}=this._cacheData[p]||{};if(!e&&(g&&d&&(h=Math.max(g,h),f=Math.min(d,f)),this._cacheDataHandle(p,{close:a,open:l,low:f,high:h,result:m}),!r))return s._value=m||[],s;const D={close:a,open:l,low:f,high:h};e===!0&&!r&&(a=c,l=w,f=d,h=g);const v=this._getPivotPointLevels(h,f,a,l,r,t);return this._cacheDataHandle(p,{...D,result:v}),s._value=v,s}_getPivotPointLevels(t,e,r,n,s,a){if(r===void 0||n===void 0||e===void 0||t===void 0)return[];switch(a){case kn.traditional:return this._traditional(t,e,r);case kn.fibonacci:return this._fibonacci(t,e,r);case kn.woodie:return s?[]:this._woodie(t,e);case kn.classic:return this._classic(t,e,r);case kn.dm:return this._DM(t,e,r,n);case kn.camarilla:return this._camarilla(t,e,r);default:return[]}}_traditional(t,e,r){const n=(t+e+r)/3,s=n*2-e,a=n+(t-e),l=n*2+(t-2*e),f=n*3+(t-3*e),h=n*4+(t-4*e),p=n*2-t,c=n-(t-e),d=n*2-(2*t-e),g=n*3-(3*t-e),w=n*4-(4*t-e);return[n,s,p,a,c,l,d,f,g,h,w]}_fibonacci(t,e,r){const n=(t+e+r)/3,s=n+.382*(t-e),a=n-.382*(t-e),l=n+.618*(t-e),f=n-.618*(t-e),h=n+(t-e),p=n-(t-e);return[n,s,a,l,f,h,p]}_woodie(t,e){const{open:r}=this._variables,n=(t+e+2*r)/4,s=2*n-e,a=2*n-t,l=n+(t-e),f=n-(t-e),h=t+2*(n-e),p=e-2*(t-n),c=h+(t-e),d=p-(t-e);return[n,s,a,l,f,h,p,c,d]}_classic(t,e,r){const n=(t+e+r)/3,s=2*n-e,a=2*n-t,l=n+(t-e),f=n-(t-e),h=n+2*(t-e),p=n-2*(t-e),c=n+3*(t-e),d=n-3*(t-e);return[n,s,a,l,f,h,p,c,d]}_DM(t,e,r,n){let s;n===r?s=t+e+2*r:r>n?s=2*t+e+r:s=2*e+t+r;const a=s/4,l=s/2-e,f=s/2-t;return[a,l,f]}_camarilla(t,e,r){const n=(t+e+r)/3,s=r+1.1*(t-e)/12,a=r-1.1*(t-e)/12,l=r+1.1*(t-e)/6,f=r-1.1*(t-e)/6,h=r+1.1*(t-e)/4,p=r-1.1*(t-e)/4,c=r+1.1*(t-e)/2,d=r-1.1*(t-e)/2,g=t/e*r,w=r-(g-r);return[n,s,a,l,f,h,p,c,d,g,w]}pivothigh({source:t=this._variables.high,leftbars:e,rightbars:r},n){if(e===void 0||r===void 0||e<0||r<0)return;const s=this._cacheDataList(t,e+r+1,`pivothigh_${n}`);if(!s)return;const a=s.slice(-(e+r+1)),l=a[e];return Math.max(...a)===l?l:void 0}pivotlow({source:t=this._variables.low,leftbars:e,rightbars:r},n){if(e===void 0||r===void 0||e<0||r<0)return;const s=this._cacheDataList(t,e+r+1,`pivotlow_${n}`);if(!s)return;const a=s.slice(-(e+r+1)),l=a[e];return Math.min(...a)===l?l:void 0}range({source:t,length:e},r){if(e===void 0||t===void 0||isNaN(t)||e<0)return;const n=this._cacheDataList(t,e,`range_${r}`);if(!n)return;const s=n.filter(f=>f!==void 0).slice(-e),a=Math.max(...s),l=Math.min(...s);return a-l}roc({source:t,length:e},r){if(e===void 0||e<0)return;const n=this._cacheDataList(t,e+1,`roc_${r}`),s=this.change({source:t,length:e},r);if(n)return 100*s/n[n.length-1-e]}rsi({source:t,length:e},r){if(e===void 0||t===void 0||isNaN(t)||e<0)return;const{source:n}=this._cacheData[`rsi_${r}`]||{},s=Math.max(t-n,0),a=Math.max(n-t,0),l=this.rma({source:s,length:e},`rma1_${r}`),f=this.rma({source:a,length:e},`rma2_${r}`);if(this._cacheDataHandle(`rsi_${r}`,{source:t}),!(l===void 0||f===void 0))return 100-100/(1+l/f)}sar({start:t,inc:e,max:r},n){if(t===void 0||e===void 0||r===void 0)return;const{close:s,low:a,high:l,preLow:f,preHigh:h,data:p={}}=this._cacheData[`sar_${n}`]||{};let{result:c,maxMin:d,acceleration:g,isBelow:w}=p,m=!1;const{close:D,low:v,high:E,bar_index:b}=this._variables;return b===1&&(D>s?(w=!0,d=E,c=a):(w=!1,d=v,c=l),m=!0,g=t),c=c+g*(d-c),w?c>v&&(m=!0,w=!1,c=Math.max(E,d||0),d=v,g=t):c<E&&(m=!0,w=!0,c=Math.min(v,d||0),d=E,g=t),m||(w?E>(d||0)&&(d=E,g=Math.min((g||0)+e,r)):v<(d||0)&&(d=v,g=Math.min((g||0)+e,r))),w?(c=Math.min(c,a),b>1&&(c=Math.min(c,f))):(c=Math.max(c,l),b>1&&(c=Math.max(c,h))),this._cacheDataHandle(`sar_${n}`,{high:E,close:D,low:v,preLow:a,preHigh:l,data:Object.assign(p,{result:c,maxMin:d,acceleration:g,isBelow:w})}),c}stoch({source:t,high:e,low:r,length:n},s){if(n===void 0||e===void 0||r===void 0||t===void 0||isNaN(t)||n<0)return;const a=this.lowest({source:r,length:n},s),l=this.highest({source:e,length:n},s);if(!(a===void 0||l===void 0))return 100*(this._variables.close-a)/(l-a)}supertrend({factor:t,atrPeriod:e},r){if(t===void 0||e===void 0)return[void 0,void 0];const{hl2:n,close:s}=this._variables,a=`supertrend_${r}`,{upperBand:l,lowerBand:f,superTrend:h,atr:p,close:c}=this._cacheData[a]||{},d=this.atr({length:e},r);if(d===void 0)return this._cacheDataHandle(a,{close:s}),[void 0,void 0];let g=n+t*d,w=n-t*d;const m=l||0,D=f||0;w=w>D||c<D?w:D,g=g<m||c>m?g:m;let v;p===void 0?v=1:h===m?v=s>g?-1:1:v=s<w?1:-1;const E=v===-1?w:g;return this._cacheDataHandle(a,{upperBand:g,lowerBand:w,superTrend:E,atr:d,close:s}),[E,v]}swma({source:t},e){let{list:r}=this._cacheData[`swma_${e}`]||{};if(r||(r=[]),r.push(t),r=r.slice(-4),this._cacheDataHandle(`swma_${e}`,{list:r}),!(r.filter(n=>n!==void 0).length<4))return r[3]*1/6+r[2]*2/6+r[1]*2/6+r[0]*1/6}tr({handle_na:t=!1},e){const{close:r,low:n,high:s}=this._variables,{close:a}=this._cacheData[`tr_${e}`]||{};return this._cacheDataHandle(`tr_${e}`,{close:r}),a===void 0?t?s-n:void 0:Math.max(s-n,Math.abs(s-a),Math.abs(n-a))}tsi({source:t,short_length:e,long_length:r},n){if(t===void 0||isNaN(t)||e===void 0||r===void 0)return;const s=this.change({source:t},n);if(s===void 0)return;const a=this.ema({source:Math.abs(s),length:e},`absema1_${n}`),l=this.ema({source:s,length:e},`ema1_${n}`);if(l===void 0)return;const f=this.ema({source:l,length:r},`ema2_${n}`),h=this.ema({source:a,length:e},`absema2_${n}`);if(f!==void 0)return f/h}valuewhen({condition:t,source:e,occurrence:r},n){if(e===void 0||r===void 0||r<0)return;let{list:s}=this._cacheData[`valuewhen_${n}`]||{};return s||(s=[]),t&&s.push(e),this._cacheDataHandle(`valuewhen_${n}`,{list:s}),s[s.length-1-r]}variance({source:t,length:e,biased:r=!0},n){if(t===void 0||isNaN(t)||e===void 0||e<0)return;const s=this.sma({source:t,length:e},n),a=this._cacheDataList(t,e,`mode_${n}`);if(!a||s===void 0)return;const l=a.filter(h=>h!==void 0&&!isNaN(h)).slice(-e);if(l.length<e)return;const f=l.reduce((h,p)=>h+Math.pow(p-s,2),0);if(f!==void 0)return r||e<=1?f/e:f/(e-1)}vwap({source:t,anchor:e,stdev_mult:r},n){if(t===void 0)return;e=e===void 0?this._timeframe.change({timeframe:"1D"},n):e;const{volume:s}=this._variables;let{sum:a=0,sumV:l=0,count:f=0,isReset:h,sumS:p=0}=this._cacheData[`vwap_${n}`]||{};if(e&&(a=l=f=p=0,h=!0),!h)return r!==void 0?[]:void 0;const c=t*s+a,d=s+l,g=c/d;return f++,r!==void 0?(p=s*Math.pow(t,2)+p,this._cacheDataHandle(`vwap_${n}`,{sum:c,sumV:d,count:f,isReset:h,sumS:p}),this._computeBands(p,d,r,g)):(this._cacheDataHandle(`vwap_${n}`,{sum:c,sumV:d,count:f,isReset:h}),g)}_computeBands(t,e,r,n){let s=t/e-Math.pow(n,2);s=s<0?0:s;const a=Math.sqrt(s),l=a!==void 0&&!isNaN(a)?n+r*a:void 0,f=a!==void 0&&!isNaN(a)?n-r*a:void 0;return[n,l,f]}vwma({source:t,length:e},r){if(t===void 0||isNaN(t)||e===void 0||e<=0)return;const{volume:n}=this._variables,s=this.sma({source:t*n,length:e},`sma1_${r}`),a=this.sma({source:n,length:e},`sma2_${r}`);if(!(s===void 0||a===void 0))return s/a}wpr({length:t},e){if(t===void 0||t<=0)return;const r=this.highest({length:t},e),n=this.lowest({length:t},e),{close:s}=this._variables;if(!(r===void 0||n===void 0))return(r-s)/(r-n)*-100}_sort(t){const e=t.length;for(let r=0;r<e;r++){let n={};for(let s=0;s<e-r;s++){const{currentVal:a,currentIndex:l}=n,f=t[s];if(f!==void 0){if(a!==void 0&&f<a){t.splice(s,1),t.splice(l,0,f),n={currentIndex:l+1,currentVal:a};continue}n={currentIndex:s,currentVal:f}}}}return t}_cacheDataList(t,e,r){const n=this._cacheData[r]||[];n[this._variables.bar_index]=t,this._cacheData[r]=n;const s=n.filter(()=>!0);if(!(s.length<e))return s}_cacheDataHandle(t,e){const{barIndex:r}=this._cacheData[t]||{};r!==this._variables.bar_index&&(this._cacheData[t]=Object.assign(e,{barIndex:this._variables.bar_index}))}}const a1={onlyInLoop:"'$text' is only allowed inside loops",invalidType:"Invalid argument 'expr$index' in 'operator SQBR' call",typeUseError:"Cannot specify a type form '$text' without also specifying the type.",notTypeKeyword:"'$text' is not a valid type keyword in variable declaration",undeclared:"Undeclared identifier '$name'",repeatVar:"'$name' is already defined",typeMismatch:"Cannot call '$operator' with argument '$index'. An argument of '$typeE' type was used but a '$typeR' is expected.",assignTypeMismatch:"Cannot assign a value of the `$typeE` type to the '$name' variable. The variable is declared with the `$typeR` type.",voidNotVar:"Void expression cannot be assigned to a variable",declareTypeErr:"Declared type '$type' is not compatible with assigned type '$valueType'",mapKeyValErr:"Cannot put <$typeA, $typeB> pairs into a map containing `$typeC` keys and `$typeD` values. The maps passed into the `$name()` function must have the same key types and value types.",inputSourceErr:"Invalid value for the '$name' parameter of the '$funcName' function. Possible values: [open, high, low, close, hl2, hlc3, ohlc4, hlcc4, volume].",buildInUseErr:"Cannot use '$name' as the default value of a type's field. The default value cannot be a function, variable or calculation.",argsLenErr:"Too many arguments passed into the `$name()` function call. Passed $lenA arguments but expected $lenB.",requiredParamErr:"No value assigned to the `$argName` parameter in $name()",argsSyntaxErr:"Syntax error after the argument for `$argName`. Arguments without their parameter name cannot be used after arguments with parameter names.",requestArgsErr:"Type $type cannot be used in $name '$argName' argument",mapKeyErr:"Incorrect `key` type `$type` in the variable. The `key` type must be one of the following: int, float, string, bool, color.",templateErr:"Incorrect number of arguments for the template: $countA expected, $countB passed.",templateNoSupportErr:"The '$name()' function does not support templates",ifOrSwitchTypeErr:"Return type of one of the '$keyword' blocks is not compatible with return type of other block(s) ($types)",argsNameErr:"The '$name' function does not have an argument with the name '$argName'",noFiledErr:"Object has no field $name",methodNotExistErr:"Could not find method or method reference '$methodName' for '$name'",tupleVarErr:"Syntax error: The quantities of tuple elements on each side of the assignment operator do not match. The right side has $indexA but the left side has $indexB.",tupleLeftVarErr:"Invalid assignment. Cannot assign a tuple to a variable '$name'.",tupleRightVarErr:"Cannot assign a variable to a tuple. The right side must be a function call or structure ('if', 'switch', 'for', 'while') returning a tuple with the same number of elements.",tempateTypeErr:"Syntax error: Only templates for arrays and matrices consist of a single type identifier enclosed in angle brackets.",qualifierErr:"'$name' is not a valid type qualifier. Possible values: 'const', 'simple', 'series'",notFindFuncErr:"Could not find function or function reference '$name'",naVarErr:"Value with NA type cannot be assigned to a variable that was defined without type keyword",notHistoryErr:"Variable '$name' doesn't have history values",defaultValueErr:"The default value cannot be a function, variable or calculation.",defaultValueTypeErr:"Default value of type $typeE can not be assigned to an argument of type $typeR",unaryErr:"Syntax error at input '$sign'",funcArgAssignErr:"Function arguments cannot be mutable ('$name')",declaredErr:"A variable declared with the '$prefix' keyword cannot accept values of the '$type' form. Assign a '$prefix' value to this variable or remove the '$prefix' keyword from its declaration.",globalFuncErr:"Cannot use '$name' in local scope",onlyStatementErr:"Scripts must contain one declaration statement: `indicator()`, `strategy()` or `library()`, Your script has $count.",modifyGlobalVarErr:"Cannot modify global variable '$name' in function",inputDefvalErr:"Arguments of input function must be of constant type, or 'source' builtin variables.",objectIsNaErr:"Cannot access the '$name' $type of an undefined object. The object is 'na'.",buidinAssignErr:"Cannot assign a new value to the built-in variable '$name'.",buidinVarErr:"Cannot shadow the built-in variable `$name` because it has already been used as a built-in.",useNaErr:"Cannot use an `na` value of an unspecified type in the `$name` function."};Ur.SERIES,Ur.SIMPLE,Ur.INPUT,Ur.CONST,Ur.INT,Ur.FLOAT,Ur.BOOL,Ur.COLOR,Ur.STRING;const u1=["close","open","high","low","hl2","hlc3","hlcc4","ohlc4","volume"];class l1{constructor(t,e){z(this,"_cacheData");z(this,"_variables");z(this,"_errorListener");z(this,"_count");z(this,"_historyInputs");z(this,"_name");this._cacheData={},this._variables=t,this._errorListener=e,this._count=-1,this._name=`inputs_${Op()}`,this._historyInputs=self.workerStorage.get(this._name)||{}}update(t){for(const e of t){const r=e.id;if(!this._cacheData[r])return;Object.assign(this._cacheData[r],{...e,isModify:!0}),self.workerStorage.updateValue(this._name,`in_${e.index}`,{modifyDefval:e.sourceTypeName||e.defval})}}input(t,e){return this._cacheHandle(t,e)}int(t,e){return this._cacheHandle(t,e,"int")}bool(t,e){return this._cacheHandle(t,e,"bool")}color(t,e){return this._cacheHandle(t,e,"color")}time(t,e){return this._cacheHandle(t,e,"time")}float(t,e){return this._cacheHandle(t,e,"float")}price(t,e){return this._cacheHandle(t,e,"price")}source(t,e){return this._cacheHandle(t,e,"source")}string(t,e){return this._cacheHandle(t,e,"string")}symbol(t,e){return this._cacheHandle(t,e,"symbol")}session(t,e){return this._cacheHandle(t,e,"session")}text_area(t,e){return this._cacheHandle(t,e,"text_area")}timeframe(t,e){return this._cacheHandle(t,e,"timeframe")}_cacheHandle(t,e,r){const n=`${r||"input"}_${e}`,s=this._cacheData[n];if(t.defval===void 0&&this._errorListener.addError(a1.inputDefvalErr,e,Re.Error),s)s.isModify?s.sourceTypeName&&(this._cacheData[n].defval=this._variables[s.sourceTypeName]):Object.assign(this._cacheData[n],t);else{const{defval:a,display:l}=t;this._displayVerify(e,l),this._count++,t={inputType:r,...t,index:this._count},this._cacheData[n]=t,this._judgeHistoryInputs(t),(r||t.inputType)==="source"?this._cacheData[n].options=u1:t.options&&!t.options.includes(a)&&this._errorListener.addError(`input's defval should be in options, but '${a}' is not in [${t.options.toString()}]`,e,Re.Error)}return this._cacheData[n].defval}_judgeHistoryInputs(t){const{defval:e,sourceTypeName:r,index:n}=t;let s=r||e;const a=`in_${n}`,l=this._historyInputs[a];if(!l)self.workerStorage.setValue(this._name,a,{defval:s});else{const{defval:f,modifyDefval:h}=l;f===s?s=h||s:self.workerStorage.setValue(this._name,a,{defval:s})}r?t.sourceTypeName=s:t.defval=s}_displayVerify(t,e){!e||!e.length||e.includes(ir.dataWindow)||e.includes(ir.statusLine)||this._errorListener.addError("Invalid argument 'display' in 'input' call. Possible values: [display.none, display.data_window, display.status_line, display.all]",t,Re.Error)}getInputs(){const t=Object.keys(this._cacheData),e=[];for(const r of t){const n=this._cacheData[r];n.id=r,e.push(n)}return e}_getGroups(t){const e=[];for(const[r,n]of t)e.push({name:r,inputs:n});return e}}class f1{color({x:t}){return t}new({color:t,transp:e=100}){_t(e)&&(e=100);const{r,g:n,b:s}=this._parseColor(t||"");return`rgba(${Math.round(r)}, ${Math.round(n)}, ${Math.round(s)}, ${(100-e)/100})`}rgb({red:t=0,green:e=0,blue:r=0,transp:n=0}){return _t(n)&&(n=0),_t(t)&&(t=0),_t(e)&&(e=0),_t(r)&&(r=0),`rgba(${t}, ${e}, ${r}, ${(100-n)/100})`}g({color:t}){return t?this._parseColor(t).g:0}r({color:t}){return t?this._parseColor(t).r:0}b({color:t}){return t?this._parseColor(t).b:0}t({color:t}){return t?Math.round(this._parseColor(t).a*100):0}from_gradient({value:t,bottom_value:e,top_value:r,bottom_color:n,top_color:s}){if(_t(t)||_t(e)||_t(r))return"rgba(0,0,0,1)";const a=(t-e)/(r-e),l=Math.min(Math.max(a,0),1),{r:f,g:h,b:p,a:c}=this._parseColor(n||"rgba(0,0,0,0)"),{r:d,g,b:w,a:m}=this._parseColor(s||"rgba(0,0,0,0)"),D=f+l*(d-f),v=h+l*(g-h),E=p+l*(w-p),b=c+l*(m-c);return`rgba(${Math.round(D)}, ${Math.round(v)}, ${Math.round(E)}, ${b.toFixed(2)})`}_parseColor(t){let e,r,n,s;if(t.startsWith("#")){e=parseInt(t.substring(1,3),16),r=parseInt(t.substring(3,5),16),n=parseInt(t.substring(5,7),16);const a=t.substring(7);a?s=(255-parseInt(a,16))/255:s=1}else{const a=this._parserRgbColor(t);e=a[0]||0,r=a[1]||0,n=a[2]||0,s=a[3]||1}return{r:e,g:r,b:n,a:s}}_parserRgbColor(t){var e;return((e=t.match(/\d+/g))==null?void 0:e.map(Number))||[]}}var zt={};const c1=Object.prototype.toString;function Ki(i){const t=c1.call(i);return t.endsWith("Array]")&&!t.includes("Big")}var h1=Object.freeze({__proto__:null,isAnyArray:Ki}),p1=be(h1);function d1(i){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Ki(i))throw new TypeError("input must be an array");if(i.length===0)throw new TypeError("input must not be empty");var e=t.fromIndex,r=e===void 0?0:e,n=t.toIndex,s=n===void 0?i.length:n;if(r<0||r>=i.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(s<=r||s>i.length||!Number.isInteger(s))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=i[r],l=r+1;l<s;l++)i[l]>a&&(a=i[l]);return a}function _1(i){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Ki(i))throw new TypeError("input must be an array");if(i.length===0)throw new TypeError("input must not be empty");var e=t.fromIndex,r=e===void 0?0:e,n=t.toIndex,s=n===void 0?i.length:n;if(r<0||r>=i.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(s<=r||s>i.length||!Number.isInteger(s))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=i[r],l=r+1;l<s;l++)i[l]<a&&(a=i[l]);return a}function m1(i){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(Ki(i)){if(i.length===0)throw new TypeError("input must not be empty")}else throw new TypeError("input must be an array");var e;if(t.output!==void 0){if(!Ki(t.output))throw new TypeError("output option must be an array if specified");e=t.output}else e=new Array(i.length);var r=_1(i),n=d1(i);if(r===n)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var s=t.min,a=s===void 0?t.autoMinMax?r:0:s,l=t.max,f=l===void 0?t.autoMinMax?n:1:l;if(a>=f)throw new RangeError("min option must be smaller than max option");for(var h=(f-a)/(n-r),p=0;p<i.length;p++)e[p]=(i[p]-r)*h+a;return e}var g1=Object.freeze({__proto__:null,default:m1}),v1=be(g1);Object.defineProperty(zt,"__esModule",{value:!0});var Qe=p1,Bc=v1;const Js=" ".repeat(2),Tc=" ".repeat(4);function w1(){return Ic(this)}function Ic(i,t={}){const{maxRows:e=15,maxColumns:r=10,maxNumSize:n=8,padMinus:s="auto"}=t;return`${i.constructor.name} {
|
54
|
+
(`+oe(S,m)+", "+oe(N,m)+") ==> "+(this._values?oe(this._values[M],m):"X")}return b},n.prototype.toString=function(){return oe(this.toArray())},n.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},n.prototype.diagonal=function(m){if(m){if(Ee(m)&&(m=m.toNumber()),!le(m)||!de(m))throw new TypeError("The parameter k must be an integer number")}else m=0;var D=m>0?m:0,v=m<0?-m:0,E=this._size[0],b=this._size[1],N=Math.min(E-v,b-D),x=[],F=[],M=[];M[0]=0;for(var S=D;S<b&&x.length<N;S++)for(var O=this._ptr[S],C=this._ptr[S+1],T=O;T<C;T++){var L=this._index[T];if(L===S-D+v){x.push(this._values[T]),F[x.length-1]=L-v;break}}return M.push(x.length),new n({values:x,index:F,ptr:M,size:[N,1]})},n.fromJSON=function(m){return new n(m)},n.diagonal=function(m,D,v,E,b){if(!ve(m))throw new TypeError("Array expected, size parameter");if(m.length!==2)throw new Error("Only two dimensions matrix are supported");if(m=m.map(function(V){if(Ee(V)&&(V=V.toNumber()),!le(V)||!de(V)||V<1)throw new Error("Size values must be positive integers");return V}),v){if(Ee(v)&&(v=v.toNumber()),!le(v)||!de(v))throw new TypeError("The parameter k must be an integer number")}else v=0;var N=e,x=0;Yr(b)&&(N=t.find(e,[b,b])||e,x=t.convert(0,b));var F=v>0?v:0,M=v<0?-v:0,S=m[0],O=m[1],C=Math.min(S-M,O-F),T;if(ve(D)){if(D.length!==C)throw new Error("Invalid value array length");T=function(tt){return D[tt]}}else if(ce(D)){var L=D.size();if(L.length!==1||L[0]!==C)throw new Error("Invalid matrix length");T=function(tt){return D.get([tt])}}else T=function(){return D};for(var U=[],k=[],W=[],P=0;P<O;P++){W.push(U.length);var K=P-F;if(K>=0&&K<C){var G=T(K);N(G,x)||(k.push(K+M),U.push(G))}}return W.push(U.length),new n({values:U,index:k,ptr:W,size:[S,O]})},n.prototype.swapRows=function(m,D){if(!le(m)||!de(m)||!le(D)||!de(D))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return we(m,this._size[0]),we(D,this._size[0]),n._swapRows(m,D,this._size[1],this._values,this._index,this._ptr),this},n._forEachRow=function(m,D,v,E,b){for(var N=E[m],x=E[m+1],F=N;F<x;F++)b(v[F],D[F])},n._swapRows=function(m,D,v,E,b,N){for(var x=0;x<v;x++){var F=N[x],M=N[x+1],S=h(m,F,M,b),O=h(D,F,M,b);if(S<M&&O<M&&b[S]===m&&b[O]===D){if(E){var C=E[S];E[S]=E[O],E[O]=C}continue}if(S<M&&b[S]===m&&(O>=M||b[O]!==D)){var T=E?E[S]:void 0;b.splice(O,0,D),E&&E.splice(O,0,T),b.splice(O<=S?S+1:S,1),E&&E.splice(O<=S?S+1:S,1);continue}if(O<M&&b[O]===D&&(S>=M||b[S]!==m)){var L=E?E[O]:void 0;b.splice(S,0,m),E&&E.splice(S,0,L),b.splice(S<=O?O+1:O,1),E&&E.splice(S<=O?O+1:O,1)}}},n},{isClass:!0}),mm="number",gm=["typed"];function vm(i){var t=i.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(t){var e={"0b":2,"0o":8,"0x":16}[t[1]],r=t[2],n=t[3];return{input:i,radix:e,integerPart:r,fractionalPart:n}}else return null}function wm(i){for(var t=parseInt(i.integerPart,i.radix),e=0,r=0;r<i.fractionalPart.length;r++){var n=parseInt(i.fractionalPart[r],i.radix);e+=n/Math.pow(i.radix,r+1)}var s=t+e;if(isNaN(s))throw new SyntaxError('String "'+i.input+'" is not a valid number');return s}var ym=mt(mm,gm,i=>{var{typed:t}=i,e=t("number",{"":function(){return 0},number:function(n){return n},string:function(n){if(n==="NaN")return NaN;var s=vm(n);if(s)return wm(s);var a=0,l=n.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);l&&(a=Number(l[2]),n=l[1]);var f=Number(n);if(isNaN(f))throw new SyntaxError('String "'+n+'" is not a valid number');if(l){if(f>2**a-1)throw new SyntaxError('String "'.concat(n,'" is out of range'));f>=2**(a-1)&&(f=f-2**a)}return f},BigNumber:function(n){return n.toNumber()},Fraction:function(n){return n.valueOf()},Unit:t.referToSelf(r=>n=>{var s=n.clone();return s.value=r(n.value),s}),null:function(n){return 0},"Unit, string | Unit":function(n,s){return n.toNumber(s)},"Array | Matrix":t.referToSelf(r=>n=>Lr(n,r))});return e.fromJSON=function(r){return parseFloat(r.value)},e}),Dm="bignumber",bm=["typed","BigNumber"],Em=mt(Dm,bm,i=>{var{typed:t,BigNumber:e}=i;return t("bignumber",{"":function(){return new e(0)},number:function(n){return new e(n+"")},string:function(n){var s=n.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(s){var a=s[2],l=e(s[1]),f=new e(2).pow(Number(a));if(l.gt(f.sub(1)))throw new SyntaxError('String "'.concat(n,'" is out of range'));var h=new e(2).pow(Number(a)-1);return l.gte(h)?l.sub(f):l}return new e(n)},BigNumber:function(n){return n},Unit:t.referToSelf(r=>n=>{var s=n.clone();return s.value=r(n.value),s}),Fraction:function(n){return new e(n.n).div(n.d).times(n.s)},null:function(n){return new e(0)},"Array | Matrix":t.referToSelf(r=>n=>Lr(n,r))})}),xm="fraction",Am=["typed","Fraction"],Cm=mt(xm,Am,i=>{var{typed:t,Fraction:e}=i;return t("fraction",{number:function(n){if(!isFinite(n)||isNaN(n))throw new Error(n+" cannot be represented as a fraction");return new e(n)},string:function(n){return new e(n)},"number, number":function(n,s){return new e(n,s)},null:function(n){return new e(0)},BigNumber:function(n){return new e(n.toString())},Fraction:function(n){return n},Unit:t.referToSelf(r=>n=>{var s=n.clone();return s.value=r(n.value),s}),Object:function(n){return new e(n)},"Array | Matrix":t.referToSelf(r=>n=>Lr(n,r))})}),Lf="matrix",Fm=["typed","Matrix","DenseMatrix","SparseMatrix"],Mm=mt(Lf,Fm,i=>{var{typed:t,Matrix:e,DenseMatrix:r,SparseMatrix:n}=i;return t(Lf,{"":function(){return s([])},string:function(l){return s([],l)},"string, string":function(l,f){return s([],l,f)},Array:function(l){return s(l)},Matrix:function(l){return s(l,l.storage())},"Array | Matrix, string":s,"Array | Matrix, string, string":s});function s(a,l,f){if(l==="dense"||l==="default"||l===void 0)return new r(a,f);if(l==="sparse")return new n(a,f);throw new TypeError("Unknown matrix type "+JSON.stringify(l)+".")}}),Rf="unaryMinus",Nm=["typed"],Sm=mt(Rf,Nm,i=>{var{typed:t}=i;return t(Rf,{number:Mf,"Complex | BigNumber | Fraction":e=>e.neg(),Unit:t.referToSelf(e=>r=>{var n=r.clone();return n.value=t.find(e,n.valueType())(r.value),n}),"Array | Matrix":t.referToSelf(e=>r=>Lr(r,e))})}),Pf="abs",Bm=["typed"],Tm=mt(Pf,Bm,i=>{var{typed:t}=i;return t(Pf,{number:xf,"Complex | BigNumber | Fraction | Unit":e=>e.abs(),"Array | Matrix":t.referToSelf(e=>r=>Lr(r,e))})}),zf="addScalar",Im=["typed"],Om=mt(zf,Im,i=>{var{typed:t}=i;return t(zf,{"number, number":Af,"Complex, Complex":function(r,n){return r.add(n)},"BigNumber, BigNumber":function(r,n){return r.plus(n)},"Fraction, Fraction":function(r,n){return r.add(n)},"Unit, Unit":t.referToSelf(e=>(r,n)=>{if(r.value===null||r.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(n.value===null||n.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!r.equalBase(n))throw new Error("Units do not match");var s=r.clone();return s.value=t.find(e,[s.valueType(),n.valueType()])(s.value,n.value),s.fixPrefix=!1,s})})}),qf="subtractScalar",$m=["typed"],Lm=mt(qf,$m,i=>{var{typed:t}=i;return t(qf,{"number, number":Cf,"Complex, Complex":function(r,n){return r.sub(n)},"BigNumber, BigNumber":function(r,n){return r.minus(n)},"Fraction, Fraction":function(r,n){return r.sub(n)},"Unit, Unit":t.referToSelf(e=>(r,n)=>{if(r.value===null||r.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(n.value===null||n.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!r.equalBase(n))throw new Error("Units do not match");var s=r.clone();return s.value=t.find(e,[s.valueType(),n.valueType()])(s.value,n.value),s.fixPrefix=!1,s})})}),Rm="matAlgo11xS0s",Pm=["typed","equalScalar"],Ea=mt(Rm,Pm,i=>{var{typed:t,equalScalar:e}=i;return function(n,s,a,l){var f=n._values,h=n._index,p=n._ptr,c=n._size,d=n._datatype;if(!f)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var g=c[0],w=c[1],m,D=e,v=0,E=a;typeof d=="string"&&(m=d,D=t.find(e,[m,m]),v=t.convert(0,m),s=t.convert(s,m),E=t.find(a,[m,m]));for(var b=[],N=[],x=[],F=0;F<w;F++){x[F]=N.length;for(var M=p[F],S=p[F+1],O=M;O<S;O++){var C=h[O],T=l?E(s,f[O]):E(f[O],s);D(T,v)||(N.push(C),b.push(T))}}return x[w]=N.length,n.createSparseMatrix({values:b,index:N,ptr:x,size:[g,w],datatype:m})}}),zm="matAlgo12xSfs",qm=["typed","DenseMatrix"],hi=mt(zm,qm,i=>{var{typed:t,DenseMatrix:e}=i;return function(n,s,a,l){var f=n._values,h=n._index,p=n._ptr,c=n._size,d=n._datatype;if(!f)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var g=c[0],w=c[1],m,D=a;typeof d=="string"&&(m=d,s=t.convert(s,m),D=t.find(a,[m,m]));for(var v=[],E=[],b=[],N=0;N<w;N++){for(var x=N+1,F=p[N],M=p[N+1],S=F;S<M;S++){var O=h[S];E[O]=f[S],b[O]=x}for(var C=0;C<g;C++)N===0&&(v[C]=[]),b[C]===x?v[C][N]=l?D(s,E[C]):D(E[C],s):v[C][N]=l?D(s,0):D(0,s)}return new e({data:v,size:[g,w],datatype:m})}}),km="matAlgo14xDs",Um=["typed"],xa=mt(km,Um,i=>{var{typed:t}=i;return function(n,s,a,l){var f=n._data,h=n._size,p=n._datatype,c,d=a;typeof p=="string"&&(c=p,s=t.convert(s,c),d=t.find(a,[c,c]));var g=h.length>0?e(d,0,h,h[0],f,s,l):[];return n.createDenseMatrix({data:g,size:re(h),datatype:c})};function e(r,n,s,a,l,f,h){var p=[];if(n===s.length-1)for(var c=0;c<a;c++)p[c]=h?r(f,l[c]):r(l[c],f);else for(var d=0;d<a;d++)p[d]=e(r,n+1,s,s[n+1],l[d],f,h);return p}}),Wm="matAlgo02xDS0",jm=["typed","equalScalar"],Ym=mt(Wm,jm,i=>{var{typed:t,equalScalar:e}=i;return function(n,s,a,l){var f=n._data,h=n._size,p=n._datatype||n.getDataType(),c=s._values,d=s._index,g=s._ptr,w=s._size,m=s._datatype||s._data===void 0?s._datatype:s.getDataType();if(h.length!==w.length)throw new Gt(h.length,w.length);if(h[0]!==w[0]||h[1]!==w[1])throw new RangeError("Dimension mismatch. Matrix A ("+h+") must match Matrix B ("+w+")");if(!c)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var D=h[0],v=h[1],E,b=e,N=0,x=a;typeof p=="string"&&p===m&&p!=="mixed"&&(E=p,b=t.find(e,[E,E]),N=t.convert(0,E),x=t.find(a,[E,E]));for(var F=[],M=[],S=[],O=0;O<v;O++){S[O]=M.length;for(var C=g[O],T=g[O+1],L=C;L<T;L++){var U=d[L],k=l?x(c[L],f[U][O]):x(f[U][O],c[L]);b(k,N)||(M.push(U),F.push(k))}}return S[v]=M.length,s.createSparseMatrix({values:F,index:M,ptr:S,size:[D,v],datatype:p===n._datatype&&m===s._datatype?E:void 0})}}),Zm="matAlgo03xDSf",Gm=["typed"],pi=mt(Zm,Gm,i=>{var{typed:t}=i;return function(r,n,s,a){var l=r._data,f=r._size,h=r._datatype||r.getDataType(),p=n._values,c=n._index,d=n._ptr,g=n._size,w=n._datatype||n._data===void 0?n._datatype:n.getDataType();if(f.length!==g.length)throw new Gt(f.length,g.length);if(f[0]!==g[0]||f[1]!==g[1])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+g+")");if(!p)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var m=f[0],D=f[1],v,E=0,b=s;typeof h=="string"&&h===w&&h!=="mixed"&&(v=h,E=t.convert(0,v),b=t.find(s,[v,v]));for(var N=[],x=0;x<m;x++)N[x]=[];for(var F=[],M=[],S=0;S<D;S++){for(var O=S+1,C=d[S],T=d[S+1],L=C;L<T;L++){var U=c[L];F[U]=a?b(p[L],l[U][S]):b(l[U][S],p[L]),M[U]=O}for(var k=0;k<m;k++)M[k]===O?N[k][S]=F[k]:N[k][S]=a?b(E,l[k][S]):b(l[k][S],E)}return r.createDenseMatrix({data:N,size:[m,D],datatype:h===r._datatype&&w===n._datatype?v:void 0})}}),Km="matAlgo05xSfSf",Hm=["typed","equalScalar"],kf=mt(Km,Hm,i=>{var{typed:t,equalScalar:e}=i;return function(n,s,a){var l=n._values,f=n._index,h=n._ptr,p=n._size,c=n._datatype||n._data===void 0?n._datatype:n.getDataType(),d=s._values,g=s._index,w=s._ptr,m=s._size,D=s._datatype||s._data===void 0?s._datatype:s.getDataType();if(p.length!==m.length)throw new Gt(p.length,m.length);if(p[0]!==m[0]||p[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+p+") must match Matrix B ("+m+")");var v=p[0],E=p[1],b,N=e,x=0,F=a;typeof c=="string"&&c===D&&c!=="mixed"&&(b=c,N=t.find(e,[b,b]),x=t.convert(0,b),F=t.find(a,[b,b]));var M=l&&d?[]:void 0,S=[],O=[],C=M?[]:void 0,T=M?[]:void 0,L=[],U=[],k,W,P,K;for(W=0;W<E;W++){O[W]=S.length;var G=W+1;for(P=h[W],K=h[W+1];P<K;P++)k=f[P],S.push(k),L[k]=G,C&&(C[k]=l[P]);for(P=w[W],K=w[W+1];P<K;P++)k=g[P],L[k]!==G&&S.push(k),U[k]=G,T&&(T[k]=d[P]);if(M)for(P=O[W];P<S.length;){k=S[P];var V=L[k],tt=U[k];if(V===G||tt===G){var ft=V===G?C[k]:x,vt=tt===G?T[k]:x,lt=F(ft,vt);N(lt,x)?S.splice(P,1):(M.push(lt),P++)}}}return O[E]=S.length,n.createSparseMatrix({values:M,index:S,ptr:O,size:[v,E],datatype:c===n._datatype&&D===s._datatype?b:void 0})}}),Jm="matAlgo13xDD",Xm=["typed"],Vm=mt(Jm,Xm,i=>{var{typed:t}=i;return function(n,s,a){var l=n._data,f=n._size,h=n._datatype,p=s._data,c=s._size,d=s._datatype,g=[];if(f.length!==c.length)throw new Gt(f.length,c.length);for(var w=0;w<f.length;w++){if(f[w]!==c[w])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+c+")");g[w]=f[w]}var m,D=a;typeof h=="string"&&h===d&&(m=h,D=t.find(a,[m,m]));var v=g.length>0?e(D,0,g,g[0],l,p):[];return n.createDenseMatrix({data:v,size:g,datatype:m})};function e(r,n,s,a,l,f){var h=[];if(n===s.length-1)for(var p=0;p<a;p++)h[p]=r(l[p],f[p]);else for(var c=0;c<a;c++)h[c]=e(r,n+1,s,s[n+1],l[c],f[c]);return h}}),Qm="broadcast",tg=["concat"],eg=mt(Qm,tg,i=>{var{concat:t}=i;return function(n,s){var a=Math.max(n._size.length,s._size.length);if(n._size.length===s._size.length&&n._size.every((w,m)=>w===s._size[m]))return[n,s];for(var l=e(n._size,a,0),f=e(s._size,a,0),h=[],p=0;p<a;p++)h[p]=Math.max(l[p],f[p]);As(l,h),As(f,h);var c=n.clone(),d=s.clone();c._size.length<a?c.reshape(e(c._size,a,1)):d._size.length<a&&d.reshape(e(d._size,a,1));for(var g=0;g<a;g++)c._size[g]<h[g]&&(c=r(c,h[g],g)),d._size[g]<h[g]&&(d=r(d,h[g],g));return[c,d]};function e(n,s,a){return[...Array(s-n.length).fill(a),...n]}function r(n,s,a){return t(...Array(s).fill(n),a)}}),rg="matrixAlgorithmSuite",ng=["typed","matrix","concat"],Wn=mt(rg,ng,i=>{var{typed:t,matrix:e,concat:r}=i,n=Vm({typed:t}),s=xa({typed:t}),a=eg({concat:r});return function(f){var h=f.elop,p=f.SD||f.DS,c;h?(c={"DenseMatrix, DenseMatrix":(m,D)=>n(...a(m,D),h),"Array, Array":(m,D)=>n(...a(e(m),e(D)),h).valueOf(),"Array, DenseMatrix":(m,D)=>n(...a(e(m),D),h),"DenseMatrix, Array":(m,D)=>n(...a(m,e(D)),h)},f.SS&&(c["SparseMatrix, SparseMatrix"]=(m,D)=>f.SS(...a(m,D),h,!1)),f.DS&&(c["DenseMatrix, SparseMatrix"]=(m,D)=>f.DS(...a(m,D),h,!1),c["Array, SparseMatrix"]=(m,D)=>f.DS(...a(e(m),D),h,!1)),p&&(c["SparseMatrix, DenseMatrix"]=(m,D)=>p(...a(D,m),h,!0),c["SparseMatrix, Array"]=(m,D)=>p(...a(e(D),m),h,!0))):(c={"DenseMatrix, DenseMatrix":t.referToSelf(m=>(D,v)=>n(...a(D,v),m)),"Array, Array":t.referToSelf(m=>(D,v)=>n(...a(e(D),e(v)),m).valueOf()),"Array, DenseMatrix":t.referToSelf(m=>(D,v)=>n(...a(e(D),v),m)),"DenseMatrix, Array":t.referToSelf(m=>(D,v)=>n(...a(D,e(v)),m))},f.SS&&(c["SparseMatrix, SparseMatrix"]=t.referToSelf(m=>(D,v)=>f.SS(...a(D,v),m,!1))),f.DS&&(c["DenseMatrix, SparseMatrix"]=t.referToSelf(m=>(D,v)=>f.DS(...a(D,v),m,!1)),c["Array, SparseMatrix"]=t.referToSelf(m=>(D,v)=>f.DS(...a(e(D),v),m,!1))),p&&(c["SparseMatrix, DenseMatrix"]=t.referToSelf(m=>(D,v)=>p(...a(v,D),m,!0)),c["SparseMatrix, Array"]=t.referToSelf(m=>(D,v)=>p(...a(e(v),D),m,!0))));var d=f.scalar||"any",g=f.Ds||f.Ss;g&&(h?(c["DenseMatrix,"+d]=(m,D)=>s(m,D,h,!1),c[d+", DenseMatrix"]=(m,D)=>s(D,m,h,!0),c["Array,"+d]=(m,D)=>s(e(m),D,h,!1).valueOf(),c[d+", Array"]=(m,D)=>s(e(D),m,h,!0).valueOf()):(c["DenseMatrix,"+d]=t.referToSelf(m=>(D,v)=>s(D,v,m,!1)),c[d+", DenseMatrix"]=t.referToSelf(m=>(D,v)=>s(v,D,m,!0)),c["Array,"+d]=t.referToSelf(m=>(D,v)=>s(e(D),v,m,!1).valueOf()),c[d+", Array"]=t.referToSelf(m=>(D,v)=>s(e(v),D,m,!0).valueOf())));var w=f.sS!==void 0?f.sS:f.Ss;return h?(f.Ss&&(c["SparseMatrix,"+d]=(m,D)=>f.Ss(m,D,h,!1)),w&&(c[d+", SparseMatrix"]=(m,D)=>w(D,m,h,!0))):(f.Ss&&(c["SparseMatrix,"+d]=t.referToSelf(m=>(D,v)=>f.Ss(D,v,m,!1))),w&&(c[d+", SparseMatrix"]=t.referToSelf(m=>(D,v)=>w(v,D,m,!0)))),h&&h.signatures&&Il(c,h.signatures),c}}),ig="matAlgo01xDSid",sg=["typed"],Uf=mt(ig,sg,i=>{var{typed:t}=i;return function(r,n,s,a){var l=r._data,f=r._size,h=r._datatype||r.getDataType(),p=n._values,c=n._index,d=n._ptr,g=n._size,w=n._datatype||n._data===void 0?n._datatype:n.getDataType();if(f.length!==g.length)throw new Gt(f.length,g.length);if(f[0]!==g[0]||f[1]!==g[1])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+g+")");if(!p)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var m=f[0],D=f[1],v=typeof h=="string"&&h!=="mixed"&&h===w?h:void 0,E=v?t.find(s,[v,v]):s,b,N,x=[];for(b=0;b<m;b++)x[b]=[];var F=[],M=[];for(N=0;N<D;N++){for(var S=N+1,O=d[N],C=d[N+1],T=O;T<C;T++)b=c[T],F[b]=a?E(p[T],l[b][N]):E(l[b][N],p[T]),M[b]=S;for(b=0;b<m;b++)M[b]===S?x[b][N]=F[b]:x[b][N]=l[b][N]}return r.createDenseMatrix({data:x,size:[m,D],datatype:h===r._datatype&&w===n._datatype?v:void 0})}}),og="matAlgo04xSidSid",ag=["typed","equalScalar"],ug=mt(og,ag,i=>{var{typed:t,equalScalar:e}=i;return function(n,s,a){var l=n._values,f=n._index,h=n._ptr,p=n._size,c=n._datatype||n._data===void 0?n._datatype:n.getDataType(),d=s._values,g=s._index,w=s._ptr,m=s._size,D=s._datatype||s._data===void 0?s._datatype:s.getDataType();if(p.length!==m.length)throw new Gt(p.length,m.length);if(p[0]!==m[0]||p[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+p+") must match Matrix B ("+m+")");var v=p[0],E=p[1],b,N=e,x=0,F=a;typeof c=="string"&&c===D&&c!=="mixed"&&(b=c,N=t.find(e,[b,b]),x=t.convert(0,b),F=t.find(a,[b,b]));var M=l&&d?[]:void 0,S=[],O=[],C=l&&d?[]:void 0,T=l&&d?[]:void 0,L=[],U=[],k,W,P,K,G;for(W=0;W<E;W++){O[W]=S.length;var V=W+1;for(K=h[W],G=h[W+1],P=K;P<G;P++)k=f[P],S.push(k),L[k]=V,C&&(C[k]=l[P]);for(K=w[W],G=w[W+1],P=K;P<G;P++)if(k=g[P],L[k]===V){if(C){var tt=F(C[k],d[P]);N(tt,x)?L[k]=null:C[k]=tt}}else S.push(k),U[k]=V,T&&(T[k]=d[P]);if(C&&T)for(P=O[W];P<S.length;)k=S[P],L[k]===V?(M[P]=C[k],P++):U[k]===V?(M[P]=T[k],P++):S.splice(P,1)}return O[E]=S.length,n.createSparseMatrix({values:M,index:S,ptr:O,size:[v,E],datatype:c===n._datatype&&D===s._datatype?b:void 0})}}),lg="matAlgo10xSids",fg=["typed","DenseMatrix"],Wf=mt(lg,fg,i=>{var{typed:t,DenseMatrix:e}=i;return function(n,s,a,l){var f=n._values,h=n._index,p=n._ptr,c=n._size,d=n._datatype;if(!f)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var g=c[0],w=c[1],m,D=a;typeof d=="string"&&(m=d,s=t.convert(s,m),D=t.find(a,[m,m]));for(var v=[],E=[],b=[],N=0;N<w;N++){for(var x=N+1,F=p[N],M=p[N+1],S=F;S<M;S++){var O=h[S];E[O]=f[S],b[O]=x}for(var C=0;C<g;C++)N===0&&(v[C]=[]),b[C]===x?v[C][N]=l?D(s,E[C]):D(E[C],s):v[C][N]=s}return new e({data:v,size:[g,w],datatype:m})}}),cg="multiplyScalar",hg=["typed"],pg=mt(cg,hg,i=>{var{typed:t}=i;return t("multiplyScalar",{"number, number":Ff,"Complex, Complex":function(r,n){return r.mul(n)},"BigNumber, BigNumber":function(r,n){return r.times(n)},"Fraction, Fraction":function(r,n){return r.mul(n)},"number | Fraction | BigNumber | Complex, Unit":(e,r)=>r.multiply(e),"Unit, number | Fraction | BigNumber | Complex | Unit":(e,r)=>e.multiply(r)})}),jf="multiply",dg=["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],_g=mt(jf,dg,i=>{var{typed:t,matrix:e,addScalar:r,multiplyScalar:n,equalScalar:s,dot:a}=i,l=Ea({typed:t,equalScalar:s}),f=xa({typed:t});function h(x,F){switch(x.length){case 1:switch(F.length){case 1:if(x[0]!==F[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(x[0]!==F[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+x[0]+") must match Matrix rows ("+F[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+F.length+" dimensions)")}break;case 2:switch(F.length){case 1:if(x[1]!==F[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+x[1]+") must match Vector length ("+F[0]+")");break;case 2:if(x[1]!==F[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+x[1]+") must match Matrix B rows ("+F[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+F.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+x.length+" dimensions)")}}function p(x,F,M){if(M===0)throw new Error("Cannot multiply two empty vectors");return a(x,F)}function c(x,F){if(F.storage()!=="dense")throw new Error("Support for SparseMatrix not implemented");return d(x,F)}function d(x,F){var M=x._data,S=x._size,O=x._datatype||x.getDataType(),C=F._data,T=F._size,L=F._datatype||F.getDataType(),U=S[0],k=T[1],W,P=r,K=n;O&&L&&O===L&&typeof O=="string"&&O!=="mixed"&&(W=O,P=t.find(r,[W,W]),K=t.find(n,[W,W]));for(var G=[],V=0;V<k;V++){for(var tt=K(M[0],C[0][V]),ft=1;ft<U;ft++)tt=P(tt,K(M[ft],C[ft][V]));G[V]=tt}return x.createDenseMatrix({data:G,size:[k],datatype:O===x._datatype&&L===F._datatype?W:void 0})}var g=t("_multiplyMatrixVector",{"DenseMatrix, any":m,"SparseMatrix, any":E}),w=t("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":D,"DenseMatrix, SparseMatrix":v,"SparseMatrix, DenseMatrix":b,"SparseMatrix, SparseMatrix":N});function m(x,F){var M=x._data,S=x._size,O=x._datatype||x.getDataType(),C=F._data,T=F._datatype||F.getDataType(),L=S[0],U=S[1],k,W=r,P=n;O&&T&&O===T&&typeof O=="string"&&O!=="mixed"&&(k=O,W=t.find(r,[k,k]),P=t.find(n,[k,k]));for(var K=[],G=0;G<L;G++){for(var V=M[G],tt=P(V[0],C[0]),ft=1;ft<U;ft++)tt=W(tt,P(V[ft],C[ft]));K[G]=tt}return x.createDenseMatrix({data:K,size:[L],datatype:O===x._datatype&&T===F._datatype?k:void 0})}function D(x,F){var M=x._data,S=x._size,O=x._datatype||x.getDataType(),C=F._data,T=F._size,L=F._datatype||F.getDataType(),U=S[0],k=S[1],W=T[1],P,K=r,G=n;O&&L&&O===L&&typeof O=="string"&&O!=="mixed"&&O!=="mixed"&&(P=O,K=t.find(r,[P,P]),G=t.find(n,[P,P]));for(var V=[],tt=0;tt<U;tt++){var ft=M[tt];V[tt]=[];for(var vt=0;vt<W;vt++){for(var lt=G(ft[0],C[0][vt]),yt=1;yt<k;yt++)lt=K(lt,G(ft[yt],C[yt][vt]));V[tt][vt]=lt}}return x.createDenseMatrix({data:V,size:[U,W],datatype:O===x._datatype&&L===F._datatype?P:void 0})}function v(x,F){var M=x._data,S=x._size,O=x._datatype||x.getDataType(),C=F._values,T=F._index,L=F._ptr,U=F._size,k=F._datatype||F._data===void 0?F._datatype:F.getDataType();if(!C)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var W=S[0],P=U[1],K,G=r,V=n,tt=s,ft=0;O&&k&&O===k&&typeof O=="string"&&O!=="mixed"&&(K=O,G=t.find(r,[K,K]),V=t.find(n,[K,K]),tt=t.find(s,[K,K]),ft=t.convert(0,K));for(var vt=[],lt=[],yt=[],bt=F.createSparseMatrix({values:vt,index:lt,ptr:yt,size:[W,P],datatype:O===x._datatype&&k===F._datatype?K:void 0}),Bt=0;Bt<P;Bt++){yt[Bt]=lt.length;var Et=L[Bt],ne=L[Bt+1];if(ne>Et)for(var It=0,Nt=0;Nt<W;Nt++){for(var se=Nt+1,Qt=void 0,qt=Et;qt<ne;qt++){var Kt=T[qt];It!==se?(Qt=V(M[Nt][Kt],C[qt]),It=se):Qt=G(Qt,V(M[Nt][Kt],C[qt]))}It===se&&!tt(Qt,ft)&&(lt.push(Nt),vt.push(Qt))}}return yt[P]=lt.length,bt}function E(x,F){var M=x._values,S=x._index,O=x._ptr,C=x._datatype||x._data===void 0?x._datatype:x.getDataType();if(!M)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var T=F._data,L=F._datatype||F.getDataType(),U=x._size[0],k=F._size[0],W=[],P=[],K=[],G,V=r,tt=n,ft=s,vt=0;C&&L&&C===L&&typeof C=="string"&&C!=="mixed"&&(G=C,V=t.find(r,[G,G]),tt=t.find(n,[G,G]),ft=t.find(s,[G,G]),vt=t.convert(0,G));var lt=[],yt=[];K[0]=0;for(var bt=0;bt<k;bt++){var Bt=T[bt];if(!ft(Bt,vt))for(var Et=O[bt],ne=O[bt+1],It=Et;It<ne;It++){var Nt=S[It];yt[Nt]?lt[Nt]=V(lt[Nt],tt(Bt,M[It])):(yt[Nt]=!0,P.push(Nt),lt[Nt]=tt(Bt,M[It]))}}for(var se=P.length,Qt=0;Qt<se;Qt++){var qt=P[Qt];W[Qt]=lt[qt]}return K[1]=P.length,x.createSparseMatrix({values:W,index:P,ptr:K,size:[U,1],datatype:C===x._datatype&&L===F._datatype?G:void 0})}function b(x,F){var M=x._values,S=x._index,O=x._ptr,C=x._datatype||x._data===void 0?x._datatype:x.getDataType();if(!M)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var T=F._data,L=F._datatype||F.getDataType(),U=x._size[0],k=F._size[0],W=F._size[1],P,K=r,G=n,V=s,tt=0;C&&L&&C===L&&typeof C=="string"&&C!=="mixed"&&(P=C,K=t.find(r,[P,P]),G=t.find(n,[P,P]),V=t.find(s,[P,P]),tt=t.convert(0,P));for(var ft=[],vt=[],lt=[],yt=x.createSparseMatrix({values:ft,index:vt,ptr:lt,size:[U,W],datatype:C===x._datatype&&L===F._datatype?P:void 0}),bt=[],Bt=[],Et=0;Et<W;Et++){lt[Et]=vt.length;for(var ne=Et+1,It=0;It<k;It++){var Nt=T[It][Et];if(!V(Nt,tt))for(var se=O[It],Qt=O[It+1],qt=se;qt<Qt;qt++){var Kt=S[qt];Bt[Kt]!==ne?(Bt[Kt]=ne,vt.push(Kt),bt[Kt]=G(Nt,M[qt])):bt[Kt]=K(bt[Kt],G(Nt,M[qt]))}}for(var Ne=lt[Et],ur=vt.length,Be=Ne;Be<ur;Be++){var rn=vt[Be];ft[Be]=bt[rn]}}return lt[W]=vt.length,yt}function N(x,F){var M=x._values,S=x._index,O=x._ptr,C=x._datatype||x._data===void 0?x._datatype:x.getDataType(),T=F._values,L=F._index,U=F._ptr,k=F._datatype||F._data===void 0?F._datatype:F.getDataType(),W=x._size[0],P=F._size[1],K=M&&T,G,V=r,tt=n;C&&k&&C===k&&typeof C=="string"&&C!=="mixed"&&(G=C,V=t.find(r,[G,G]),tt=t.find(n,[G,G]));for(var ft=K?[]:void 0,vt=[],lt=[],yt=x.createSparseMatrix({values:ft,index:vt,ptr:lt,size:[W,P],datatype:C===x._datatype&&k===F._datatype?G:void 0}),bt=K?[]:void 0,Bt=[],Et,ne,It,Nt,se,Qt,qt,Kt,Ne=0;Ne<P;Ne++){lt[Ne]=vt.length;var ur=Ne+1;for(se=U[Ne],Qt=U[Ne+1],Nt=se;Nt<Qt;Nt++)if(Kt=L[Nt],K)for(ne=O[Kt],It=O[Kt+1],Et=ne;Et<It;Et++)qt=S[Et],Bt[qt]!==ur?(Bt[qt]=ur,vt.push(qt),bt[qt]=tt(T[Nt],M[Et])):bt[qt]=V(bt[qt],tt(T[Nt],M[Et]));else for(ne=O[Kt],It=O[Kt+1],Et=ne;Et<It;Et++)qt=S[Et],Bt[qt]!==ur&&(Bt[qt]=ur,vt.push(qt));if(K)for(var Be=lt[Ne],rn=vt.length,En=Be;En<rn;En++){var nn=vt[En];ft[En]=bt[nn]}}return lt[P]=vt.length,yt}return t(jf,n,{"Array, Array":t.referTo("Matrix, Matrix",x=>(F,M)=>{h(Fe(F),Fe(M));var S=x(e(F),e(M));return ce(S)?S.valueOf():S}),"Matrix, Matrix":function(F,M){var S=F.size(),O=M.size();return h(S,O),S.length===1?O.length===1?p(F,M,S[0]):c(F,M):O.length===1?g(F,M):w(F,M)},"Matrix, Array":t.referTo("Matrix,Matrix",x=>(F,M)=>x(F,e(M))),"Array, Matrix":t.referToSelf(x=>(F,M)=>x(e(F,M.storage()),M)),"SparseMatrix, any":function(F,M){return l(F,M,n,!1)},"DenseMatrix, any":function(F,M){return f(F,M,n,!1)},"any, SparseMatrix":function(F,M){return l(M,F,n,!0)},"any, DenseMatrix":function(F,M){return f(M,F,n,!0)},"Array, any":function(F,M){return f(e(F),M,n,!1).valueOf()},"any, Array":function(F,M){return f(e(M),F,n,!0).valueOf()},"any, any":n,"any, any, ...any":t.referToSelf(x=>(F,M,S)=>{for(var O=x(F,M),C=0;C<S.length;C++)O=x(O,S[C]);return O})})}),Yf="subtract",mg=["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],gg=mt(Yf,mg,i=>{var{typed:t,matrix:e,equalScalar:r,subtractScalar:n,unaryMinus:s,DenseMatrix:a,concat:l}=i,f=Uf({typed:t}),h=pi({typed:t}),p=kf({typed:t,equalScalar:r}),c=Wf({typed:t,DenseMatrix:a}),d=hi({typed:t,DenseMatrix:a}),g=Wn({typed:t,matrix:e,concat:l});return t(Yf,{"any, any":n},g({elop:n,SS:p,DS:f,SD:h,Ss:d,sS:c}))}),vg="matAlgo07xSSf",wg=["typed","DenseMatrix"],qs=mt(vg,wg,i=>{var{typed:t,DenseMatrix:e}=i;return function(s,a,l){var f=s._size,h=s._datatype||s._data===void 0?s._datatype:s.getDataType(),p=a._size,c=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(f.length!==p.length)throw new Gt(f.length,p.length);if(f[0]!==p[0]||f[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+p+")");var d=f[0],g=f[1],w,m=0,D=l;typeof h=="string"&&h===c&&h!=="mixed"&&(w=h,m=t.convert(0,w),D=t.find(l,[w,w]));var v,E,b=[];for(v=0;v<d;v++)b[v]=[];var N=[],x=[],F=[],M=[];for(E=0;E<g;E++){var S=E+1;for(r(s,E,F,N,S),r(a,E,M,x,S),v=0;v<d;v++){var O=F[v]===S?N[v]:m,C=M[v]===S?x[v]:m;b[v][E]=D(O,C)}}return new e({data:b,size:[d,g],datatype:h===s._datatype&&c===a._datatype?w:void 0})};function r(n,s,a,l,f){for(var h=n._values,p=n._index,c=n._ptr,d=c[s],g=c[s+1];d<g;d++){var w=p[d];a[w]=f,l[w]=h[d]}}}),Zf="conj",yg=["typed"],Dg=mt(Zf,yg,i=>{var{typed:t}=i;return t(Zf,{"number | BigNumber | Fraction":e=>e,Complex:e=>e.conjugate(),"Array | Matrix":t.referToSelf(e=>r=>Lr(r,e))})}),Gf="concat",bg=["typed","matrix","isInteger"],Eg=mt(Gf,bg,i=>{var{typed:t,matrix:e,isInteger:r}=i;return t(Gf,{"...Array | Matrix | number | BigNumber":function(s){var a,l=s.length,f=-1,h,p=!1,c=[];for(a=0;a<l;a++){var d=s[a];if(ce(d)&&(p=!0),le(d)||Ee(d)){if(a!==l-1)throw new Error("Dimension must be specified as last argument");if(h=f,f=d.valueOf(),!r(f))throw new TypeError("Integer number expected for dimension");if(f<0||a>0&&f>h)throw new mn(f,h+1)}else{var g=re(d).valueOf(),w=Fe(g);if(c[a]=g,h=f,f=w.length-1,a>0&&f!==h)throw new Gt(h+1,f+1)}}if(c.length===0)throw new SyntaxError("At least one matrix expected");for(var m=c.shift();c.length;)m=Ql(m,c.shift(),f);return p?e(m):m},"...string":function(s){return s.join("")}})}),Kf="count",xg=["typed","size","prod"],Ag=mt(Kf,xg,i=>{var{typed:t,size:e,prod:r}=i;return t(Kf,{string:function(s){return s.length},"Matrix | Array":function(s){return r(e(s))}})}),Hf="identity",Cg=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],Fg=mt(Hf,Cg,i=>{var{typed:t,config:e,matrix:r,BigNumber:n,DenseMatrix:s,SparseMatrix:a}=i;return t(Hf,{"":function(){return e.matrix==="Matrix"?r([]):[]},string:function(p){return r(p)},"number | BigNumber":function(p){return f(p,p,e.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, string":function(p,c){return f(p,p,c)},"number | BigNumber, number | BigNumber":function(p,c){return f(p,c,e.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(p,c,d){return f(p,c,d)},Array:function(p){return l(p)},"Array, string":function(p,c){return l(p,c)},Matrix:function(p){return l(p.valueOf(),p.storage())},"Matrix, string":function(p,c){return l(p.valueOf(),c)}});function l(h,p){switch(h.length){case 0:return p?r(p):[];case 1:return f(h[0],h[0],p);case 2:return f(h[0],h[1],p);default:throw new Error("Vector containing two values expected")}}function f(h,p,c){var d=Ee(h)||Ee(p)?n:null;if(Ee(h)&&(h=h.toNumber()),Ee(p)&&(p=p.toNumber()),!de(h)||h<1)throw new Error("Parameters in function identity must be positive integers");if(!de(p)||p<1)throw new Error("Parameters in function identity must be positive integers");var g=d?new n(1):1,w=d?new d(0):0,m=[h,p];if(c){if(c==="sparse")return a.diagonal(m,g,0,w);if(c==="dense")return s.diagonal(m,g,0,w);throw new TypeError('Unknown matrix type "'.concat(c,'"'))}for(var D=la([],m,w),v=h<p?h:p,E=0;E<v;E++)D[E][E]=g;return D}}),Jf="kron",Mg=["typed","matrix","multiplyScalar"],Ng=mt(Jf,Mg,i=>{var{typed:t,matrix:e,multiplyScalar:r}=i;return t(Jf,{"Matrix, Matrix":function(a,l){return e(n(a.toArray(),l.toArray()))},"Matrix, Array":function(a,l){return e(n(a.toArray(),l))},"Array, Matrix":function(a,l){return e(n(a,l.toArray()))},"Array, Array":n});function n(s,a){if(Fe(s).length===1&&(s=[s]),Fe(a).length===1&&(a=[a]),Fe(s).length>2||Fe(a).length>2)throw new RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(s.length)+", y = "+JSON.stringify(a.length)+")");var l=[],f=[];return s.map(function(h){return a.map(function(p){return f=[],l.push(f),h.map(function(c){return p.map(function(d){return f.push(r(c,d))})})})})&&l}});function Sg(){throw new Error('No "bignumber" implementation available')}function Bg(){throw new Error('No "fraction" implementation available')}function Tg(){throw new Error('No "matrix" implementation available')}var Xf="reshape",Ig=["typed","isInteger","matrix"],Og=mt(Xf,Ig,i=>{var{typed:t,isInteger:e}=i;return t(Xf,{"Matrix, Array":function(n,s){return n.reshape(s,!0)},"Array, Array":function(n,s){return s.forEach(function(a){if(!e(a))throw new TypeError("Invalid size for dimension: "+a)}),ca(n,s)}})}),Vf="size",$g=["typed","config","?matrix"],Lg=mt(Vf,$g,i=>{var{typed:t,config:e,matrix:r}=i;return t(Vf,{Matrix:function(s){return s.create(s.size())},Array:Fe,string:function(s){return e.matrix==="Array"?[s.length]:r([s.length])},"number | Complex | BigNumber | Unit | boolean | null":function(s){return e.matrix==="Array"?[]:r?r([]):Tg()}})}),Qf="transpose",Rg=["typed","matrix"],Pg=mt(Qf,Rg,i=>{var{typed:t,matrix:e}=i;return t(Qf,{Array:a=>r(e(a)).valueOf(),Matrix:r,any:re});function r(a){var l=a.size(),f;switch(l.length){case 1:f=a.clone();break;case 2:{var h=l[0],p=l[1];if(p===0)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+oe(l)+")");switch(a.storage()){case"dense":f=n(a,h,p);break;case"sparse":f=s(a,h,p);break}}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+oe(l)+")")}return f}function n(a,l,f){for(var h=a._data,p=[],c,d=0;d<f;d++){c=p[d]=[];for(var g=0;g<l;g++)c[g]=re(h[g][d])}return a.createDenseMatrix({data:p,size:[f,l],datatype:a._datatype})}function s(a,l,f){for(var h=a._values,p=a._index,c=a._ptr,d=h?[]:void 0,g=[],w=[],m=[],D=0;D<l;D++)m[D]=0;var v,E,b;for(v=0,E=p.length;v<E;v++)m[p[v]]++;for(var N=0,x=0;x<l;x++)w.push(N),N+=m[x],m[x]=w[x];for(w.push(N),b=0;b<f;b++)for(var F=c[b],M=c[b+1],S=F;S<M;S++){var O=m[p[S]]++;g[O]=b,h&&(d[O]=re(h[S]))}return a.createSparseMatrix({values:d,index:g,ptr:w,size:[f,l],datatype:a._datatype})}}),tc="ctranspose",zg=["typed","transpose","conj"],qg=mt(tc,zg,i=>{var{typed:t,transpose:e,conj:r}=i;return t(tc,{any:function(s){return r(e(s))}})}),ec="mode",kg=["typed","isNaN","isNumeric"],Ug=mt(ec,kg,i=>{var{typed:t,isNaN:e,isNumeric:r}=i;return t(ec,{"Array | Matrix":n,"...":function(a){return n(a)}});function n(s){s=pa(s.valueOf());var a=s.length;if(a===0)throw new Error("Cannot calculate mode of an empty array");for(var l={},f=[],h=0,p=0;p<s.length;p++){var c=s[p];if(r(c)&&e(c))throw new Error("Cannot calculate mode of an array containing NaN values");c in l||(l[c]=0),l[c]++,l[c]===h?f.push(c):l[c]>h&&(h=l[c],f=[c])}return f}});function Dn(i,t,e){var r;return String(i).indexOf("Unexpected type")!==-1?(r=arguments.length>2?" (type: "+_n(e)+", value: "+JSON.stringify(e)+")":" (type: "+i.data.actual+")",new TypeError("Cannot calculate "+t+", unexpected type of argument"+r)):String(i).indexOf("complex numbers")!==-1?(r=arguments.length>2?" (type: "+_n(e)+", value: "+JSON.stringify(e)+")":"",new TypeError("Cannot calculate "+t+", no ordering relation is defined for complex numbers"+r)):i}var rc="prod",Wg=["typed","config","multiplyScalar","numeric"],jg=mt(rc,Wg,i=>{var{typed:t,config:e,multiplyScalar:r,numeric:n}=i;return t(rc,{"Array | Matrix":s,"Array | Matrix, number | BigNumber":function(l,f){throw new Error("prod(A, dim) is not yet supported")},"...":function(l){return s(l)}});function s(a){var l;if(ji(a,function(f){try{l=l===void 0?f:r(l,f)}catch(h){throw Dn(h,"prod",f)}}),typeof l=="string"&&(l=n(l,e.number)),l===void 0)throw new Error("Cannot calculate prod of an empty array");return l}}),Yg="numeric",Zg=["number","?bignumber","?fraction"],Gg=mt(Yg,Zg,i=>{var{number:t,bignumber:e,fraction:r}=i,n={string:!0,number:!0,BigNumber:!0,Fraction:!0},s={number:a=>t(a),BigNumber:e?a=>e(a):Sg,Fraction:r?a=>r(a):Bg};return function(l){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"number",h=arguments.length>2?arguments[2]:void 0;if(h!==void 0)throw new SyntaxError("numeric() takes one or two arguments");var p=_n(l);if(!(p in n))throw new TypeError("Cannot convert "+l+' of type "'+p+'"; valid input types are '+Object.keys(n).join(", "));if(!(f in s))throw new TypeError("Cannot convert "+l+' to type "'+f+'"; valid output types are '+Object.keys(s).join(", "));return f===p?l:s[f](l)}}),nc="divideScalar",Kg=["typed","numeric"],Hg=mt(nc,Kg,i=>{var{typed:t,numeric:e}=i;return t(nc,{"number, number":function(n,s){return n/s},"Complex, Complex":function(n,s){return n.div(s)},"BigNumber, BigNumber":function(n,s){return n.div(s)},"Fraction, Fraction":function(n,s){return n.div(s)},"Unit, number | Complex | Fraction | BigNumber | Unit":(r,n)=>r.divide(n),"number | Fraction | Complex | BigNumber, Unit":(r,n)=>n.divideInto(r)})}),ic="pow",Jg=["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],Xg=mt(ic,Jg,i=>{var{typed:t,config:e,identity:r,multiply:n,matrix:s,inv:a,number:l,fraction:f,Complex:h}=i;return t(ic,{"number, number":p,"Complex, Complex":function(w,m){return w.pow(m)},"BigNumber, BigNumber":function(w,m){return m.isInteger()||w>=0||e.predictable?w.pow(m):new h(w.toNumber(),0).pow(m.toNumber(),0)},"Fraction, Fraction":function(w,m){var D=w.pow(m);if(D!=null)return D;if(e.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return p(w.valueOf(),m.valueOf())},"Array, number":c,"Array, BigNumber":function(w,m){return c(w,m.toNumber())},"Matrix, number":d,"Matrix, BigNumber":function(w,m){return d(w,m.toNumber())},"Unit, number | BigNumber":function(w,m){return w.pow(m)}});function p(g,w){if(e.predictable&&!de(w)&&g<0)try{var m=f(w),D=l(m);if((w===D||Math.abs((w-D)/w)<1e-14)&&m.d%2===1)return(m.n%2===0?1:-1)*Math.pow(-g,w)}catch{}return e.predictable&&(g<-1&&w===1/0||g>-1&&g<0&&w===-1/0)?NaN:de(w)||g>=0||e.predictable?Nf(g,w):g*g<1&&w===1/0||g*g>1&&w===-1/0?0:new h(g,0).pow(w,0)}function c(g,w){if(!de(w))throw new TypeError("For A^b, b must be an integer (value is "+w+")");var m=Fe(g);if(m.length!==2)throw new Error("For A^b, A must be 2 dimensional (A has "+m.length+" dimensions)");if(m[0]!==m[1])throw new Error("For A^b, A must be square (size is "+m[0]+"x"+m[1]+")");if(w<0)try{return c(a(g),-w)}catch(E){throw E.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 "+w+")"):E}for(var D=r(m[0]).valueOf(),v=g;w>=1;)(w&1)===1&&(D=n(v,D)),w>>=1,v=n(v,v);return D}function d(g,w){return s(c(g.valueOf(),w))}}),sc="dotDivide",Vg=["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],Qg=mt(sc,Vg,i=>{var{typed:t,matrix:e,equalScalar:r,divideScalar:n,DenseMatrix:s,concat:a}=i,l=Ym({typed:t,equalScalar:r}),f=pi({typed:t}),h=qs({typed:t,DenseMatrix:s}),p=Ea({typed:t,equalScalar:r}),c=hi({typed:t,DenseMatrix:s}),d=Wn({typed:t,matrix:e,concat:a});return t(sc,d({elop:n,SS:h,DS:f,SD:l,Ss:p,sS:c}))}),ks="compare",tv=["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],ev=mt(ks,tv,i=>{var{typed:t,config:e,equalScalar:r,matrix:n,BigNumber:s,Fraction:a,DenseMatrix:l,concat:f}=i,h=pi({typed:t}),p=kf({typed:t,equalScalar:r}),c=hi({typed:t,DenseMatrix:l}),d=Wn({typed:t,matrix:n,concat:f}),g=Ps({typed:t});return t(ks,rv({typed:t,config:e}),{"boolean, boolean":function(m,D){return m===D?0:m>D?1:-1},"BigNumber, BigNumber":function(m,D){return Rs(m,D,e.epsilon)?new s(0):new s(m.cmp(D))},"Fraction, Fraction":function(m,D){return new a(m.compare(D))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},g,d({SS:p,DS:h,Ss:c}))}),rv=mt(ks,["typed","config"],i=>{var{typed:t,config:e}=i;return t(ks,{"number, number":function(n,s){return Un(n,s,e.epsilon)?0:n>s?1:-1}})}),Us="equal",nv=["typed","matrix","equalScalar","DenseMatrix","concat"],iv=mt(Us,nv,i=>{var{typed:t,matrix:e,equalScalar:r,DenseMatrix:n,concat:s}=i,a=pi({typed:t}),l=qs({typed:t,DenseMatrix:n}),f=hi({typed:t,DenseMatrix:n}),h=Wn({typed:t,matrix:e,concat:s});return t(Us,sv({typed:t,equalScalar:r}),h({elop:r,SS:l,DS:a,Ss:f}))}),sv=mt(Us,["typed","equalScalar"],i=>{var{typed:t,equalScalar:e}=i;return t(Us,{"any, any":function(n,s){return n===null?s===null:s===null?n===null:n===void 0?s===void 0:s===void 0?n===void 0:e(n,s)}})}),Ws="smaller",ov=["typed","config","matrix","DenseMatrix","concat"],av=mt(Ws,ov,i=>{var{typed:t,config:e,matrix:r,DenseMatrix:n,concat:s}=i,a=pi({typed:t}),l=qs({typed:t,DenseMatrix:n}),f=hi({typed:t,DenseMatrix:n}),h=Wn({typed:t,matrix:r,concat:s}),p=Ps({typed:t});return t(Ws,uv({typed:t,config:e}),{"boolean, boolean":(c,d)=>c<d,"BigNumber, BigNumber":function(d,g){return d.lt(g)&&!Rs(d,g,e.epsilon)},"Fraction, Fraction":(c,d)=>c.compare(d)===-1,"Complex, Complex":function(d,g){throw new TypeError("No ordering relation is defined for complex numbers")}},p,h({SS:l,DS:a,Ss:f}))}),uv=mt(Ws,["typed","config"],i=>{var{typed:t,config:e}=i;return t(Ws,{"number, number":function(n,s){return n<s&&!Un(n,s,e.epsilon)}})}),js="larger",lv=["typed","config","matrix","DenseMatrix","concat"],fv=mt(js,lv,i=>{var{typed:t,config:e,matrix:r,DenseMatrix:n,concat:s}=i,a=pi({typed:t}),l=qs({typed:t,DenseMatrix:n}),f=hi({typed:t,DenseMatrix:n}),h=Wn({typed:t,matrix:r,concat:s}),p=Ps({typed:t});return t(js,cv({typed:t,config:e}),{"boolean, boolean":(c,d)=>c>d,"BigNumber, BigNumber":function(d,g){return d.gt(g)&&!Rs(d,g,e.epsilon)},"Fraction, Fraction":(c,d)=>c.compare(d)===1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},p,h({SS:l,DS:a,Ss:f}))}),cv=mt(js,["typed","config"],i=>{var{typed:t,config:e}=i;return t(js,{"number, number":function(n,s){return n>s&&!Un(n,s,e.epsilon)}})}),oc="deepEqual",hv=["typed","equal"],pv=mt(oc,hv,i=>{var{typed:t,equal:e}=i;return t(oc,{"any, any":function(s,a){return r(s.valueOf(),a.valueOf())}});function r(n,s){if(Array.isArray(n))if(Array.isArray(s)){var a=n.length;if(a!==s.length)return!1;for(var l=0;l<a;l++)if(!r(n[l],s[l]))return!1;return!0}else return!1;else return Array.isArray(s)?!1:e(n,s)}}),ac="partitionSelect",dv=["typed","isNumeric","isNaN","compare"],_v=mt(ac,dv,i=>{var{typed:t,isNumeric:e,isNaN:r,compare:n}=i,s=n,a=(h,p)=>-n(h,p);return t(ac,{"Array | Matrix, number":function(p,c){return l(p,c,s)},"Array | Matrix, number, string":function(p,c,d){if(d==="asc")return l(p,c,s);if(d==="desc")return l(p,c,a);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":l});function l(h,p,c){if(!de(p)||p<0)throw new Error("k must be a non-negative integer");if(ce(h)){var d=h.size();if(d.length>1)throw new Error("Only one dimensional matrices supported");return f(h.valueOf(),p,c)}if(Array.isArray(h))return f(h,p,c)}function f(h,p,c){if(p>=h.length)throw new Error("k out of bounds");for(var d=0;d<h.length;d++)if(e(h[d])&&r(h[d]))return h[d];for(var g=0,w=h.length-1;g<w;){for(var m=g,D=w,v=h[Math.floor(Math.random()*(w-g+1))+g];m<D;)if(c(h[m],v)>=0){var E=h[D];h[D]=h[m],h[m]=E,--D}else++m;c(h[m],v)>0&&--m,p<=m?w=m:g=m+1}return h[p]}}),uc="max",mv=["typed","config","numeric","larger"],gv=mt(uc,mv,i=>{var{typed:t,config:e,numeric:r,larger:n}=i;return t(uc,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(f,h){return ba(f,h.valueOf(),s)},"...":function(f){if(Os(f))throw new TypeError("Scalar values expected in function max");return a(f)}});function s(l,f){try{return n(l,f)?l:f}catch(h){throw Dn(h,"max",f)}}function a(l){var f;if(ji(l,function(h){try{isNaN(h)&&typeof h=="number"?f=NaN:(f===void 0||n(h,f))&&(f=h)}catch(p){throw Dn(p,"max",h)}}),f===void 0)throw new Error("Cannot calculate max of an empty array");return typeof f=="string"&&(f=r(f,e.number)),f}}),lc="min",vv=["typed","config","numeric","smaller"],wv=mt(lc,vv,i=>{var{typed:t,config:e,numeric:r,smaller:n}=i;return t(lc,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(f,h){return ba(f,h.valueOf(),s)},"...":function(f){if(Os(f))throw new TypeError("Scalar values expected in function min");return a(f)}});function s(l,f){try{return n(l,f)?l:f}catch(h){throw Dn(h,"min",f)}}function a(l){var f;if(ji(l,function(h){try{isNaN(h)&&typeof h=="number"?f=NaN:(f===void 0||n(h,f))&&(f=h)}catch(p){throw Dn(p,"min",h)}}),f===void 0)throw new Error("Cannot calculate min of an empty array");return typeof f=="string"&&(f=r(f,e.number)),f}}),fc="add",yv=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],Dv=mt(fc,yv,i=>{var{typed:t,matrix:e,addScalar:r,equalScalar:n,DenseMatrix:s,SparseMatrix:a,concat:l}=i,f=Uf({typed:t}),h=ug({typed:t,equalScalar:n}),p=Wf({typed:t,DenseMatrix:s}),c=Wn({typed:t,matrix:e,concat:l});return t(fc,{"any, any":r,"any, any, ...any":t.referToSelf(d=>(g,w,m)=>{for(var D=d(g,w),v=0;v<m.length;v++)D=d(D,m[v]);return D})},c({elop:r,DS:f,SS:h,Ss:p}))}),cc="dot",bv=["typed","addScalar","multiplyScalar","conj","size"],Ev=mt(cc,bv,i=>{var{typed:t,addScalar:e,multiplyScalar:r,conj:n,size:s}=i;return t(cc,{"Array | DenseMatrix, Array | DenseMatrix":l,"SparseMatrix, SparseMatrix":f});function a(p,c){var d=h(p),g=h(c),w,m;if(d.length===1)w=d[0];else if(d.length===2&&d[1]===1)w=d[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+d.join(", ")+")");if(g.length===1)m=g[0];else if(g.length===2&&g[1]===1)m=g[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+g.join(", ")+")");if(w!==m)throw new RangeError("Vectors must have equal length ("+w+" != "+m+")");if(w===0)throw new RangeError("Cannot calculate the dot product of empty vectors");return w}function l(p,c){var d=a(p,c),g=ce(p)?p._data:p,w=ce(p)?p._datatype||p.getDataType():void 0,m=ce(c)?c._data:c,D=ce(c)?c._datatype||c.getDataType():void 0,v=h(p).length===2,E=h(c).length===2,b=e,N=r;if(w&&D&&w===D&&typeof w=="string"&&w!=="mixed"){var x=w;b=t.find(e,[x,x]),N=t.find(r,[x,x])}if(!v&&!E){for(var F=N(n(g[0]),m[0]),M=1;M<d;M++)F=b(F,N(n(g[M]),m[M]));return F}if(!v&&E){for(var S=N(n(g[0]),m[0][0]),O=1;O<d;O++)S=b(S,N(n(g[O]),m[O][0]));return S}if(v&&!E){for(var C=N(n(g[0][0]),m[0]),T=1;T<d;T++)C=b(C,N(n(g[T][0]),m[T]));return C}if(v&&E){for(var L=N(n(g[0][0]),m[0][0]),U=1;U<d;U++)L=b(L,N(n(g[U][0]),m[U][0]));return L}}function f(p,c){a(p,c);for(var d=p._index,g=p._values,w=c._index,m=c._values,D=0,v=e,E=r,b=0,N=0;b<d.length&&N<w.length;){var x=d[b],F=w[N];if(x<F){b++;continue}if(x>F){N++;continue}x===F&&(D=v(D,E(g[b],m[N])),b++,N++)}return D}function h(p){return ce(p)?p.size():s(p)}}),xv="trace",Av=["typed","matrix","add"],Cv=mt(xv,Av,i=>{var{typed:t,matrix:e,add:r}=i;return t("trace",{Array:function(l){return n(e(l))},SparseMatrix:s,DenseMatrix:n,any:re});function n(a){var l=a._size,f=a._data;switch(l.length){case 1:if(l[0]===1)return re(f[0]);throw new RangeError("Matrix must be square (size: "+oe(l)+")");case 2:{var h=l[0],p=l[1];if(h===p){for(var c=0,d=0;d<h;d++)c=r(c,f[d][d]);return c}else throw new RangeError("Matrix must be square (size: "+oe(l)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+oe(l)+")")}}function s(a){var l=a._values,f=a._index,h=a._ptr,p=a._size,c=p[0],d=p[1];if(c===d){var g=0;if(l.length>0)for(var w=0;w<d;w++)for(var m=h[w],D=h[w+1],v=m;v<D;v++){var E=f[v];if(E===w){g=r(g,l[v]);break}if(E>w)break}return g}throw new RangeError("Matrix must be square (size: "+oe(p)+")")}}),hc="det",Fv=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],Mv=mt(hc,Fv,i=>{var{typed:t,matrix:e,subtractScalar:r,multiply:n,divideScalar:s,isZero:a,unaryMinus:l}=i;return t(hc,{any:function(p){return re(p)},"Array | Matrix":function(p){var c;switch(ce(p)?c=p.size():Array.isArray(p)?(p=e(p),c=p.size()):c=[],c.length){case 0:return re(p);case 1:if(c[0]===1)return re(p.valueOf()[0]);if(c[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+oe(c)+")");case 2:{var d=c[0],g=c[1];if(d===g)return f(p.clone().valueOf(),d);if(g===0)return 1;throw new RangeError("Matrix must be square (size: "+oe(c)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+oe(c)+")")}}});function f(h,p,c){if(p===1)return re(h[0][0]);if(p===2)return r(n(h[0][0],h[1][1]),n(h[1][0],h[0][1]));for(var d=!1,g=new Array(p).fill(0).map((M,S)=>S),w=0;w<p;w++){var m=g[w];if(a(h[m][w])){var D=void 0;for(D=w+1;D<p;D++)if(!a(h[g[D]][w])){m=g[D],g[D]=g[w],g[w]=m,d=!d;break}if(D===p)return h[m][w]}for(var v=h[m][w],E=w===0?1:h[g[w-1]][w-1],b=w+1;b<p;b++)for(var N=g[b],x=w+1;x<p;x++)h[N][x]=s(r(n(h[N][x],v),n(h[N][w],h[m][x])),E)}var F=h[g[p-1]][p-1];return d?l(F):F}}),pc="inv",Nv=["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],Sv=mt(pc,Nv,i=>{var{typed:t,matrix:e,divideScalar:r,addScalar:n,multiply:s,unaryMinus:a,det:l,identity:f,abs:h}=i;return t(pc,{"Array | Matrix":function(d){var g=ce(d)?d.size():Fe(d);switch(g.length){case 1:if(g[0]===1)return ce(d)?e([r(1,d.valueOf()[0])]):[r(1,d[0])];throw new RangeError("Matrix must be square (size: "+oe(g)+")");case 2:{var w=g[0],m=g[1];if(w===m)return ce(d)?e(p(d.valueOf(),w,m),d.storage()):p(d,w,m);throw new RangeError("Matrix must be square (size: "+oe(g)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+oe(g)+")")}},any:function(d){return r(1,d)}});function p(c,d,g){var w,m,D,v,E;if(d===1){if(v=c[0][0],v===0)throw Error("Cannot calculate inverse, determinant is zero");return[[r(1,v)]]}else if(d===2){var b=l(c);if(b===0)throw Error("Cannot calculate inverse, determinant is zero");return[[r(c[1][1],b),r(a(c[0][1]),b)],[r(a(c[1][0]),b),r(c[0][0],b)]]}else{var N=c.concat();for(w=0;w<d;w++)N[w]=N[w].concat();for(var x=f(d).valueOf(),F=0;F<g;F++){var M=h(N[F][F]),S=F;for(w=F+1;w<d;)h(N[w][F])>M&&(M=h(N[w][F]),S=w),w++;if(M===0)throw Error("Cannot calculate inverse, determinant is zero");w=S,w!==F&&(E=N[F],N[F]=N[w],N[w]=E,E=x[F],x[F]=x[w],x[w]=E);var O=N[F],C=x[F];for(w=0;w<d;w++){var T=N[w],L=x[w];if(w!==F){if(T[F]!==0){for(D=r(a(T[F]),O[F]),m=F;m<g;m++)T[m]=n(T[m],s(D,O[m]));for(m=0;m<g;m++)L[m]=n(L[m],s(D,C[m]))}}else{for(D=O[F],m=F;m<g;m++)T[m]=r(T[m],D);for(m=0;m<g;m++)L[m]=r(L[m],D)}}}return x}}}),dc="pinv",Bv=["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],Tv=mt(dc,Bv,i=>{var{typed:t,matrix:e,inv:r,deepEqual:n,equal:s,dotDivide:a,dot:l,ctranspose:f,divideScalar:h,multiply:p,add:c,Complex:d}=i;return t(dc,{"Array | Matrix":function(b){var N=ce(b)?b.size():Fe(b);switch(N.length){case 1:return v(b)?f(b):N[0]===1?r(b):a(f(b),l(b,b));case 2:{if(v(b))return f(b);var x=N[0],F=N[1];if(x===F)try{return r(b)}catch(M){if(!(M instanceof Error&&M.message.match(/Cannot calculate inverse, determinant is zero/)))throw M}return ce(b)?e(g(b.valueOf(),x,F),b.storage()):g(b,x,F)}default:throw new RangeError("Matrix must be two dimensional (size: "+oe(N)+")")}},any:function(b){return s(b,0)?re(b):h(1,b)}});function g(E,b,N){var{C:x,F}=m(E,b,N),M=p(r(p(f(x),x)),f(x)),S=p(f(F),r(p(F,f(F))));return p(S,M)}function w(E,b,N){for(var x=re(E),F=0,M=0;M<b;M++){if(N<=F)return x;for(var S=M;D(x[S][F]);)if(S++,b===S&&(S=M,F++,N===F))return x;[x[S],x[M]]=[x[M],x[S]];for(var O=x[M][F],C=0;C<N;C++)x[M][C]=a(x[M][C],O);for(var T=0;T<b;T++)if(T!==M){O=x[T][F];for(var L=0;L<N;L++)x[T][L]=c(x[T][L],p(-1,p(O,x[M][L])))}F++}return x}function m(E,b,N){var x=w(E,b,N),F=E.map((S,O)=>S.filter((C,T)=>T<b&&!D(l(x[T],x[T])))),M=x.filter((S,O)=>!D(l(x[O],x[O])));return{C:F,F:M}}function D(E){return s(c(E,d(1,1)),c(0,d(1,1)))}function v(E){return n(c(E,d(1,1)),c(p(E,0),d(1,1)))}}),Iv="divide",Ov=["typed","matrix","multiply","equalScalar","divideScalar","inv"],$v=mt(Iv,Ov,i=>{var{typed:t,matrix:e,multiply:r,equalScalar:n,divideScalar:s,inv:a}=i,l=Ea({typed:t,equalScalar:n}),f=xa({typed:t});return t("divide",Il({"Array | Matrix, Array | Matrix":function(p,c){return r(p,a(c))},"DenseMatrix, any":function(p,c){return f(p,c,s,!1)},"SparseMatrix, any":function(p,c){return l(p,c,s,!1)},"Array, any":function(p,c){return f(e(p),c,s,!1).valueOf()},"any, Array | Matrix":function(p,c){return r(p,a(c))}},s.signatures))}),_c="sum",Lv=["typed","config","add","numeric"],Rv=mt(_c,Lv,i=>{var{typed:t,config:e,add:r,numeric:n}=i;return t(_c,{"Array | Matrix":s,"Array | Matrix, number | BigNumber":a,"...":function(f){if(Os(f))throw new TypeError("Scalar values expected in function sum");return s(f)}});function s(l){var f;return ji(l,function(h){try{f=f===void 0?h:r(f,h)}catch(p){throw Dn(p,"sum",h)}}),f===void 0&&(f=n(0,e.number)),typeof f=="string"&&(f=n(f,e.number)),f}function a(l,f){try{var h=ba(l,f,r);return h}catch(p){throw Dn(p,"sum")}}}),mc="median",Pv=["typed","add","divide","compare","partitionSelect"],zv=mt(mc,Pv,i=>{var{typed:t,add:e,divide:r,compare:n,partitionSelect:s}=i;function a(h){try{h=pa(h.valueOf());var p=h.length;if(p===0)throw new Error("Cannot calculate median of an empty array");if(p%2===0){for(var c=p/2-1,d=s(h,c+1),g=h[c],w=0;w<c;++w)n(h[w],g)>0&&(g=h[w]);return f(g,d)}else{var m=s(h,(p-1)/2);return l(m)}}catch(D){throw Dn(D,"median")}}var l=t({"number | BigNumber | Complex | Unit":function(p){return p}}),f=t({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(p,c){return r(e(p,c),2)}});return t(mc,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(p,c){throw new Error("median(A, dim) is not yet supported")},"...":function(p){if(Os(p))throw new TypeError("Scalar values expected in function median");return a(p)}})}),Ys=q_({config:or}),Aa=j_({}),Ca=K_({}),Fa=X_({}),Gr=tm({Matrix:Fa}),Mt=Wd({BigNumber:Ys,Complex:Aa,DenseMatrix:Gr,Fraction:Ca}),qv=Tm({typed:Mt}),Zs=Om({typed:Mt}),kv=Em({BigNumber:Ys,typed:Mt}),gc=Dg({typed:Mt}),bn=hm({config:or,typed:Mt}),Gs=nm({typed:Mt}),Uv=am({typed:Mt}),Ks=pg({typed:Mt}),vc=ym({typed:Mt}),Ma=_m({Matrix:Fa,equalScalar:bn,typed:Mt}),wc=Lm({typed:Mt}),yc=lm({typed:Mt}),Na=Sm({typed:Mt}),Dc=Cm({Fraction:Ca,typed:Mt}),bc=sm({typed:Mt}),Me=Mm({DenseMatrix:Gr,Matrix:Fa,SparseMatrix:Ma,typed:Mt}),Ec=Ug({isNaN:yc,isNumeric:bc,typed:Mt}),Yi=Gg({bignumber:kv,fraction:Dc,number:vc}),Wv=jg({config:or,multiplyScalar:Ks,numeric:Yi,typed:Mt}),jv=Og({isInteger:Gs,matrix:Me,typed:Mt}),xc=Lg({matrix:Me,config:or,typed:Mt}),Ac=Pg({matrix:Me,typed:Mt}),jn=Eg({isInteger:Gs,matrix:Me,typed:Mt}),Yv=Ag({prod:Wv,size:xc,typed:Mt}),Zv=qg({conj:gc,transpose:Ac,typed:Mt}),Zi=Hg({numeric:Yi,typed:Mt}),Gv=Qg({DenseMatrix:Gr,concat:jn,divideScalar:Zi,equalScalar:bn,matrix:Me,typed:Mt}),Cc=iv({DenseMatrix:Gr,concat:jn,equalScalar:bn,matrix:Me,typed:Mt}),Fc=Fg({BigNumber:Ys,DenseMatrix:Gr,SparseMatrix:Ma,config:or,matrix:Me,typed:Mt}),Kv=Ng({matrix:Me,multiplyScalar:Ks,typed:Mt}),Hv=av({DenseMatrix:Gr,concat:jn,config:or,matrix:Me,typed:Mt}),Jv=gg({DenseMatrix:Gr,concat:jn,equalScalar:bn,matrix:Me,subtractScalar:wc,typed:Mt,unaryMinus:Na}),Gi=Dv({DenseMatrix:Gr,SparseMatrix:Ma,addScalar:Zs,concat:jn,equalScalar:bn,matrix:Me,typed:Mt}),Mc=ev({BigNumber:Ys,DenseMatrix:Gr,Fraction:Ca,concat:jn,config:or,equalScalar:bn,matrix:Me,typed:Mt}),Xv=pv({equal:Cc,typed:Mt}),Nc=Ev({addScalar:Zs,conj:gc,multiplyScalar:Ks,size:xc,typed:Mt}),Vv=fv({DenseMatrix:Gr,concat:jn,config:or,matrix:Me,typed:Mt}),Sa=wv({config:or,numeric:Yi,smaller:Hv,typed:Mt}),di=_g({addScalar:Zs,dot:Nc,equalScalar:bn,matrix:Me,multiplyScalar:Ks,typed:Mt}),Qv=_v({compare:Mc,isNaN:yc,isNumeric:bc,typed:Mt}),t1=Rv({add:Gi,config:or,numeric:Yi,typed:Mt}),e1=Cv({add:Gi,matrix:Me,typed:Mt}),Sc=Mv({divideScalar:Zi,isZero:Uv,matrix:Me,multiply:di,subtractScalar:wc,typed:Mt,unaryMinus:Na}),r1=gv({config:or,larger:Vv,numeric:Yi,typed:Mt}),Hs=Sv({abs:qv,addScalar:Zs,det:Sc,divideScalar:Zi,identity:Fc,matrix:Me,multiply:di,typed:Mt,unaryMinus:Na}),n1=Tv({Complex:Aa,add:Gi,ctranspose:Zv,deepEqual:Xv,divideScalar:Zi,dot:Nc,dotDivide:Gv,equal:Cc,inv:Hs,matrix:Me,multiply:di,typed:Mt}),i1=Xg({Complex:Aa,config:or,fraction:Dc,identity:Fc,inv:Hs,matrix:Me,multiply:di,number:vc,typed:Mt}),s1=$v({divideScalar:Zi,equalScalar:bn,inv:Hs,matrix:Me,multiply:di,typed:Mt}),Bc=zv({add:Gi,compare:Mc,divide:s1,partitionSelect:Qv,typed:Mt});class o1{constructor(t,e,r){z(this,"_cacheData");z(this,"_variables");z(this,"_math");z(this,"_timeframe");this._cacheData={},this._variables=t,this._math=e,this._timeframe=r}alma({series:t,length:e,offset:r,sigma:n,floor:s},a){if(e===void 0||r===void 0||n===void 0)return;const l=this._cacheDataList(t,e,`alma_${a}`);if(l===void 0)return;let f=r*(e-1);s&&(f=Math.floor(f));const h=e/n;let p=0,c=0;for(let d=0;d<=e-1;d++){const g=Math.exp(-1*Math.pow(d-f,2)/(2*Math.pow(h,2)));p+=g,c+=l[l.length-1-(e-d-1)]*g}return c/p}sma({source:t,length:e},r){if(t===void 0||isNaN(t)||e===void 0)return;let n=0;const s=this._cacheDataList(t,e,`sma_${r}`);if(s===void 0)return;const a=s.slice(-e);return n=t1(...a)/e,n}rma({source:t,length:e},r){if(t===void 0||e===void 0||isNaN(t))return;const n=this._cacheData[`sma_${r}`]||[];n[this._variables.bar_index]=t,this._cacheData[`sma_${r}`]=n;const{sum:s}=this._cacheData[`rma_${r}`]||{},a=1/e,l=s===void 0?this.sma({source:t,length:e},r):a*t+(1-a)*(s||0);return this._cacheDataHandle(`rma_${r}`,{sum:l}),l}atr({length:t},e){const{high:r,close:n}=this._cacheData[`atr_${e}`]||{},{high:s,close:a,low:l}=this._variables,f=r===void 0?s-l:Math.max(Math.max(s-l,Math.abs(s-n)),Math.abs(l-n));return this._cacheDataHandle(`atr_${e}`,{high:s,close:a}),this.rma({source:f,length:t},e)}barssince({condition:t},e){let{count:r}=this._cacheData[`barssince_${e}`]||{};if(t)r=0;else{if(r===void 0)return;r+=1}return this._cacheDataHandle(`barssince_${e}`,{count:r}),r}stdev({source:t,length:e,biased:r=!0},n){if(t===void 0||isNaN(t)||e===void 0)return;const s=this._cacheDataList(t,e,`stdev_${n}`),a=this.sma({source:t,length:e},n);if(s===void 0)return;let l=0;for(let f=0;f<e;f++){const h=this._sum(s[s.length-1-f],-(a||0));l+=h*h}return r||e<=1?Math.sqrt(l/e):Math.sqrt(l/(e-1))}_sum(t,e){let n=t+e;return Math.abs(n)<=1e-10&&(n=0),n}bb({series:t,length:e,mult:r},n){if(t===void 0||isNaN(t)||e===void 0||r===void 0)return[];const s=this.sma({source:t,length:e},n),a=this.stdev({source:t,length:e},n);if(s===void 0||a===void 0)return[];const l=r*a;return[s,s+l,s-l]}bbw({series:t,length:e,mult:r},n){if(t===void 0||isNaN(t)||e===void 0||r===void 0)return;const s=this.sma({source:t,length:e},n),a=this.stdev({source:t,length:e},n);if(s===void 0||a===void 0)return;const l=r*a;return(s+l-(s-l))/s}cci({source:t,length:e},r){if(t===void 0||isNaN(t)||e===void 0)return;const n=this.sma({source:t,length:e},r),s=this.dev({source:t,length:e},r);if(!(n===void 0||s===void 0))return(t-n)/(.015*s)}change({source:t,length:e=1},r){const n=this._cacheData[`change_${r}`]||[];n[this._variables.bar_index]=t,this._cacheData[`change_${r}`]=n;const s=n[n.length-1-e];if(!(t===void 0||isNaN(t)))return s===void 0?s:typeof t=="boolean"?s!==t:t-s}cmo({series:t,length:e},r){if(t===void 0||isNaN(t)||e===void 0)return;const n=this.change({source:t},r);if(n===void 0)return;const s=this._math.sum({source:n>=0?n:0,length:e},`sm1_${r}`),a=this._math.sum({source:n>=0?0:-n,length:e},`sm2_${r}`);if(!(s===void 0||a===void 0))return 100*(s-a)/(s+a)}cog({source:t,length:e},r){if(t===void 0||isNaN(t)||e===void 0)return;const n=this._cacheDataList(t,e,`cog_${r}`),s=this._math.sum({source:t,length:e},r);if(s===void 0||n===void 0)return;let a=0;for(let l=0;l<e;l++){const f=n[n.length-1-l];a+=f*(l+1)}return-a/s}correlation({source1:t,source2:e,length:r},n){if(t===void 0||isNaN(t)||e===void 0||isNaN(e)||r===void 0)return;const s=this._cacheDataList([t,e],r,`correlation_${n}`),a=this.sma({source:t,length:r},`sma1_${n}`),l=this.sma({source:e,length:r},`sma2_${n}`);if(a===void 0||l===void 0||s===void 0)return;let f=0,h=0,p=0;for(let d=0;d<r;d++){const[g,w]=s[s.length-1-d],m=g-a,D=w-l;f+=m*D,h+=m*m,p+=D*D}return isNaN(h)||isNaN(f)||isNaN(p)?void 0:f/Math.sqrt(h*p)}cross({source1:t,source2:e},r){if(t===void 0||e===void 0)return!1;const{source1:n,source2:s}=this._cacheData[`cross_${r}`]||{};return this._cacheDataHandle(`cross_${r}`,{source1:t,source2:e}),n===void 0||s===void 0?!1:n>=s&&t<e||n<=s&&t>e}crossover({source1:t,source2:e},r){if(t===void 0||e===void 0)return!1;const{source1:n,source2:s}=this._cacheData[`crossover_${r}`]||{};return this._cacheDataHandle(`crossover_${r}`,{source1:t,source2:e}),n===void 0||s===void 0?!1:n<=s&&t>e}crossunder({source1:t,source2:e},r){if(t===void 0||e===void 0)return!1;const{source1:n,source2:s}=this._cacheData[`crossunder_${r}`]||{};return this._cacheDataHandle(`crossunder_${r}`,{source1:t,source2:e}),n===void 0||s===void 0?!1:n>=s&&t<e}cum({source:t=0},e){t=isNaN(t)?0:t;let{sum:r}=this._cacheData[`cum_${e}`]||{};return r=r||0,r+=t,this._cacheDataHandle(`cum_${e}`,{sum:r}),r}dev({source:t,length:e},r){if(t===void 0||isNaN(t)||e===void 0)return;const n=this.sma({source:t,length:e},r);let s=0;const a=this._cacheDataList(t,e,`dev_${r}`);if(!(!a||n===void 0)){for(let l=0;l<e;l++){const f=a[a.length-1-l];s+=Math.abs(f-n)}return s/e}}dmi({diLength:t,adxSmoothing:e},r){if(t===void 0||e===void 0)return[void 0,void 0,void 0];const n=`dmi_${r}`,{low:s,high:a,close:l,PDMS:f,NDMS:h,TRS:p,ADX:c,count:d=0}=this._cacheData[n]||{},{low:g,high:w,close:m}=this._variables;if(s===void 0||a===void 0||l===void 0)return this._cacheData[n]={low:g,high:w,close:m,PDMS:f,NDMS:h,TRS:w-g,count:1},[void 0,void 0,void 0];let D=w-a,v=s-g;D=D>v&&D>0?D:0,v=v>D&&v>0?v:0,D===v&&(D=v=0);const E=Math.max(w-g,Math.abs(w-l),Math.abs(g-l));if(d<t)return this._cacheDataHandle(n,{low:g,high:w,close:m,PDMS:(f||0)+D,NDMS:(h||0)+v,TRS:(p||0)+E,count:d+1}),[void 0,void 0,void 0];{const b=f-f/t+D,N=h-h/t+v,x=p-p/t+E,F=b/x*100,M=N/x*100,S=Math.abs((F-M)/(F+M))*100;let O=S,C=[F,M,void 0];if(d+1-t<e){const T=d+1-t;O=((c||0)*(T-1)+S)/T}else O=(c*(e-1)+S)/e,C=[F,M,O];return this._cacheDataHandle(n,{low:g,high:w,close:m,PDMS:b,NDMS:N,TRS:x,ADX:O,count:d+1}),C}}ema({source:t,length:e},r){if(t===void 0||e===void 0||isNaN(t))return;let{sum:n,count:s=1}=this._cacheData[`ema_${r}`]||{};const a=this.sma({source:t,length:e},r);if(s>e){const l=2/(e+1);n=n===void 0?t:l*t+(1-l)*(n||0)}else n=a;return s+=1,this._cacheDataHandle(`ema_${r}`,{sum:n,count:s}),n}falling({source:t,length:e},r){if(t===void 0||isNaN(t)||e===void 0)return!1;const{source:n,fallings:s=[]}=this._cacheData[`falling_${r}`]||{};s.push(n>t);const a=s.slice(-e);return this._cacheDataHandle(`falling_${r}`,{source:t,fallings:a}),a.length<e?!1:a.every(l=>l)}rising({source:t,length:e},r){if(t===void 0||isNaN(t)||e===void 0)return!1;const{source:n,risings:s=[]}=this._cacheData[`rising_${r}`]||{};s.push(n<t);const a=s.slice(-e);return this._cacheDataHandle(`rising_${r}`,{source:t,risings:a}),a.length<e?!1:a.every(l=>l)}highest({source:t,length:e},r){if(e===void 0||e<=0)return;const n=this._cacheData[`highest_${r}`]||[],{high:s,bar_index:a}=this._variables;typeof t!="number"?n[a]=s:n[a]=t,this._cacheData[`highest_${r}`]=n;const l=n.filter(()=>!0);if(!(l.length<e))return Math.max(...l.slice(-e))}highestbars({source:t,length:e},r){if(e===void 0||e<=0)return;const n=this._cacheData[`highestbars_${r}`]||[],{high:s,bar_index:a}=this._variables;typeof t!="number"?n[a]=s:n[a]=t,this._cacheData[`highestbars_${r}`]=n;const l=n.filter(()=>!0);return l.length<e?void 0:l.slice(-e).reduce((h,p,c,d)=>p>=d[h]?c:h,0)-e+1}wma({source:t,length:e},r){if(e===void 0||t===void 0||isNaN(t)||e<=0)return;const n=this._cacheDataList(t,e,`wma_${r}`);if(!n)return;let s=0,a=0;for(let l=0;l<e;l++){const f=(e-l)*e;s+=f,a+=n[n.length-1-l]*f}return a/s}hma({source:t,length:e},r){if(e===void 0||t===void 0||isNaN(t)||e<=0)return;const n=this.wma({source:t,length:e},r),s=this.wma({source:t,length:Math.round(e/2)},r);return n===void 0||s===void 0?void 0:this.wma({source:2*s-n,length:Math.floor(Math.sqrt(e))},`hma_${r}`)}kc({series:t,length:e,mult:r,useTrueRange:n=!0},s){if(t===void 0||isNaN(t)||e===void 0||r===void 0)return[void 0,void 0,void 0];const a=this.ema({source:t,length:e},s),{ta:l,high:f,low:h}=this._variables,p=n?l.tr:f-h,c=this.ema({source:p,length:e},`range_${s}`);return[a,a+c*r,a-c*r]}kcw({series:t,length:e,mult:r,useTrueRange:n=!0},s){if(t===void 0||isNaN(t)||e===void 0||r===void 0)return;const a=this.ema({source:t,length:e},s),{ta:l,high:f,low:h}=this._variables,p=n?l.tr:f-h,c=this.ema({source:p,length:e},`range_${s}`);return(a+c*r-(a-c*r))/a}linreg({source:t,length:e,offset:r},n){if(e===void 0||r===void 0)return;const s=this._cacheDataList(t,e,`dev_${n}`);if(!s)return;const a=s.slice(-e).filter(g=>g!==void 0);let l=0,f=0,h=0,p=0;for(const[g,w]of a.entries())l+=g,f+=w,h+=g*w,p+=g*g;const c=(e*h-l*f)/(e*p-l*l);return(f-c*l)/e+c*(e-1-r)}lowest({source:t,length:e},r){if(e===void 0||e<=0)return;const n=this._cacheData[`lowest_${r}`]||[],{low:s,bar_index:a}=this._variables;typeof t!="number"?n[a]=s:n[a]=t,this._cacheData[`lowest_${r}`]=n;const l=n.filter(()=>!0);if(!(l.length<e))return Math.min(...l.slice(-e))}lowestbars({source:t,length:e},r){if(e===void 0||e<=0)return;const n=this._cacheData[`lowestbars_${r}`]||[],{low:s,bar_index:a}=this._variables;typeof t!="number"?n[a]=s:n[a]=t,this._cacheData[`lowestbars_${r}`]=n;const l=n.filter(()=>!0);return l.length<e?void 0:l.slice(-e).reduce((h,p,c,d)=>p<=d[h]?c:h,0)-e+1}macd({source:t,fastlen:e,slowlen:r,siglen:n},s){if(t===void 0||isNaN(t)||e===void 0||r===void 0||n===void 0)return[void 0,void 0,void 0];const a=this.ema({source:t,length:e},`ema1_${s}`),l=this.ema({source:t,length:r},`ema2_${s}`);if(a===void 0||l===void 0)return[void 0,void 0,void 0];const f=a-l,h=this.ema({source:f,length:n},`macd_${s}`);if(h===void 0)return[f,h,void 0];const p=f-h;return[f,h,p]}max({source:t},e){if(t===void 0||isNaN(t))return;let r=this._cacheData[`max_${e}`]||0;return t>r&&(r=t),this._cacheData[`max_${e}`]=r,r}min({source:t},e){if(t===void 0||isNaN(t))return;let r=this._cacheData[`min_${e}`]||1/0;return t<r&&(r=t),this._cacheData[`min_${e}`]=r,r}median({source:t,length:e},r){if(e===void 0||t===void 0||isNaN(t)||e<=0)return;const n=this._cacheDataList(t,e,`dev_${r}`);if(n)return Bc(n.slice(-e))}mfi({series:t,length:e},r){if(e===void 0||t===void 0||isNaN(t)||e<=0)return;const{volume:n}=this._variables,s=this.change({source:t},r),a=this._math.sum({source:n*(s>=0?0:t),length:e},`lower_${r}`),l=this._math.sum({source:n*(s<=0?0:t),length:e},`upper_${r}`);if(!(l===void 0||a===void 0))return 100-100/(1+l/a)}mode({source:t,length:e},r){if(e===void 0||t===void 0||isNaN(t)||e<=0)return;const n=this._cacheDataList(t,e,`mode_${r}`);if(n)return Sa(Ec(n.slice(-e)))}mom({source:t,length:e},r){if(e===void 0||e<0)return;const n=`mom_${r}`,s=this._cacheData[n]||[];if(s[this._variables.bar_index]=t,this._cacheData[n]=s,s.length<=e||t===void 0||isNaN(t))return;let a=s.length-e-1,l;for(;l===void 0&&a>=0;)l=s[a],a--;return l===void 0?l:t-l}percentile_linear_interpolation({source:t,length:e,percentage:r},n){if(e===void 0||r===void 0||e<0||r<0||r>100)return;const s=this._cacheDataList(t,e+1,`percentile_linear_interpolation_${n}`);if(!s)return;const a=this._sort(s.slice(-(e+1))),l=a.length;r/=100;const f=1/(l*2);if(r<=f)return a[0];if(r>=1-1/(l*2))return a[l-1];for(const[h,p]of a.entries()){const c=a[h-1];if(r<(h+.5)/l)return c===void 0||p===void 0?void 0:c+(p-c)*(r-(h-.5)/l)/(1/l)}}percentile_nearest_rank({source:t,length:e,percentage:r},n){if(e===void 0||r===void 0||t===void 0||isNaN(t)||e<0||r<0||r>100)return;const s=this._cacheDataList(t,e,`percentile_nearest_rank_${n}`);if(!s)return;const a=this._sort(s.slice(-e)),l=r/100*a.length,f=Math.ceil(l)-1;return a[f>=a.length?a.length-1:f]}percentrank({source:t,length:e},r){if(e===void 0||e<0)return;const n=this._cacheDataList(t,e+1,`percentile_nearest_rank_${r}`);if(!n)return;const s=n.slice(-(e+1)),a=t;if(a===void 0)return;let l=0;for(let f=0;f<s.length;f++)s[f]!==void 0&&(s[f]<a||s[f]===a&&f<e)&&l++;return l/(s.length-1)*100}pivot_point_levels({type:t,anchor:e,developing:r},n){const s=new Jt;let{close:a,open:l,low:f,high:h}=this._variables;const p=`pivot_point_levels_${n}`,{close:c,low:d,high:g,open:w,result:m}=this._cacheData[p]||{};if(!e&&(g&&d&&(h=Math.max(g,h),f=Math.min(d,f)),this._cacheDataHandle(p,{close:a,open:l,low:f,high:h,result:m}),!r))return s._value=m||[],s;const D={close:a,open:l,low:f,high:h};e===!0&&!r&&(a=c,l=w,f=d,h=g);const v=this._getPivotPointLevels(h,f,a,l,r,t);return this._cacheDataHandle(p,{...D,result:v}),s._value=v,s}_getPivotPointLevels(t,e,r,n,s,a){if(r===void 0||n===void 0||e===void 0||t===void 0)return[];switch(a){case kn.traditional:return this._traditional(t,e,r);case kn.fibonacci:return this._fibonacci(t,e,r);case kn.woodie:return s?[]:this._woodie(t,e);case kn.classic:return this._classic(t,e,r);case kn.dm:return this._DM(t,e,r,n);case kn.camarilla:return this._camarilla(t,e,r);default:return[]}}_traditional(t,e,r){const n=(t+e+r)/3,s=n*2-e,a=n+(t-e),l=n*2+(t-2*e),f=n*3+(t-3*e),h=n*4+(t-4*e),p=n*2-t,c=n-(t-e),d=n*2-(2*t-e),g=n*3-(3*t-e),w=n*4-(4*t-e);return[n,s,p,a,c,l,d,f,g,h,w]}_fibonacci(t,e,r){const n=(t+e+r)/3,s=n+.382*(t-e),a=n-.382*(t-e),l=n+.618*(t-e),f=n-.618*(t-e),h=n+(t-e),p=n-(t-e);return[n,s,a,l,f,h,p]}_woodie(t,e){const{open:r}=this._variables,n=(t+e+2*r)/4,s=2*n-e,a=2*n-t,l=n+(t-e),f=n-(t-e),h=t+2*(n-e),p=e-2*(t-n),c=h+(t-e),d=p-(t-e);return[n,s,a,l,f,h,p,c,d]}_classic(t,e,r){const n=(t+e+r)/3,s=2*n-e,a=2*n-t,l=n+(t-e),f=n-(t-e),h=n+2*(t-e),p=n-2*(t-e),c=n+3*(t-e),d=n-3*(t-e);return[n,s,a,l,f,h,p,c,d]}_DM(t,e,r,n){let s;n===r?s=t+e+2*r:r>n?s=2*t+e+r:s=2*e+t+r;const a=s/4,l=s/2-e,f=s/2-t;return[a,l,f]}_camarilla(t,e,r){const n=(t+e+r)/3,s=r+1.1*(t-e)/12,a=r-1.1*(t-e)/12,l=r+1.1*(t-e)/6,f=r-1.1*(t-e)/6,h=r+1.1*(t-e)/4,p=r-1.1*(t-e)/4,c=r+1.1*(t-e)/2,d=r-1.1*(t-e)/2,g=t/e*r,w=r-(g-r);return[n,s,a,l,f,h,p,c,d,g,w]}pivothigh({source:t=this._variables.high,leftbars:e,rightbars:r},n){if(e===void 0||r===void 0||e<0||r<0)return;const s=this._cacheDataList(t,e+r+1,`pivothigh_${n}`);if(!s)return;const a=s.slice(-(e+r+1)),l=a[e];return Math.max(...a)===l?l:void 0}pivotlow({source:t=this._variables.low,leftbars:e,rightbars:r},n){if(e===void 0||r===void 0||e<0||r<0)return;const s=this._cacheDataList(t,e+r+1,`pivotlow_${n}`);if(!s)return;const a=s.slice(-(e+r+1)),l=a[e];return Math.min(...a)===l?l:void 0}range({source:t,length:e},r){if(e===void 0||t===void 0||isNaN(t)||e<0)return;const n=this._cacheDataList(t,e,`range_${r}`);if(!n)return;const s=n.filter(f=>f!==void 0).slice(-e),a=Math.max(...s),l=Math.min(...s);return a-l}roc({source:t,length:e},r){if(e===void 0||e<0)return;const n=this._cacheDataList(t,e+1,`roc_${r}`),s=this.change({source:t,length:e},r);if(n)return 100*s/n[n.length-1-e]}rsi({source:t,length:e},r){if(e===void 0||t===void 0||isNaN(t)||e<0)return;const{source:n}=this._cacheData[`rsi_${r}`]||{},s=Math.max(t-n,0),a=Math.max(n-t,0),l=this.rma({source:s,length:e},`rma1_${r}`),f=this.rma({source:a,length:e},`rma2_${r}`);if(this._cacheDataHandle(`rsi_${r}`,{source:t}),!(l===void 0||f===void 0))return 100-100/(1+l/f)}sar({start:t,inc:e,max:r},n){if(t===void 0||e===void 0||r===void 0)return;const{close:s,low:a,high:l,preLow:f,preHigh:h,data:p={}}=this._cacheData[`sar_${n}`]||{};let{result:c,maxMin:d,acceleration:g,isBelow:w}=p,m=!1;const{close:D,low:v,high:E,bar_index:b}=this._variables;return b===1&&(D>s?(w=!0,d=E,c=a):(w=!1,d=v,c=l),m=!0,g=t),c=c+g*(d-c),w?c>v&&(m=!0,w=!1,c=Math.max(E,d||0),d=v,g=t):c<E&&(m=!0,w=!0,c=Math.min(v,d||0),d=E,g=t),m||(w?E>(d||0)&&(d=E,g=Math.min((g||0)+e,r)):v<(d||0)&&(d=v,g=Math.min((g||0)+e,r))),w?(c=Math.min(c,a),b>1&&(c=Math.min(c,f))):(c=Math.max(c,l),b>1&&(c=Math.max(c,h))),this._cacheDataHandle(`sar_${n}`,{high:E,close:D,low:v,preLow:a,preHigh:l,data:Object.assign(p,{result:c,maxMin:d,acceleration:g,isBelow:w})}),c}stoch({source:t,high:e,low:r,length:n},s){if(n===void 0||e===void 0||r===void 0||t===void 0||isNaN(t)||n<0)return;const a=this.lowest({source:r,length:n},s),l=this.highest({source:e,length:n},s);if(!(a===void 0||l===void 0))return 100*(this._variables.close-a)/(l-a)}supertrend({factor:t,atrPeriod:e},r){if(t===void 0||e===void 0)return[void 0,void 0];const{hl2:n,close:s}=this._variables,a=`supertrend_${r}`,{upperBand:l,lowerBand:f,superTrend:h,atr:p,close:c}=this._cacheData[a]||{},d=this.atr({length:e},r);if(d===void 0)return this._cacheDataHandle(a,{close:s}),[void 0,void 0];let g=n+t*d,w=n-t*d;const m=l||0,D=f||0;w=w>D||c<D?w:D,g=g<m||c>m?g:m;let v;p===void 0?v=1:h===m?v=s>g?-1:1:v=s<w?1:-1;const E=v===-1?w:g;return this._cacheDataHandle(a,{upperBand:g,lowerBand:w,superTrend:E,atr:d,close:s}),[E,v]}swma({source:t},e){let{list:r}=this._cacheData[`swma_${e}`]||{};if(r||(r=[]),r.push(t),r=r.slice(-4),this._cacheDataHandle(`swma_${e}`,{list:r}),!(r.filter(n=>n!==void 0).length<4))return r[3]*1/6+r[2]*2/6+r[1]*2/6+r[0]*1/6}tr({handle_na:t=!1},e){const{close:r,low:n,high:s}=this._variables,{close:a}=this._cacheData[`tr_${e}`]||{};return this._cacheDataHandle(`tr_${e}`,{close:r}),a===void 0?t?s-n:void 0:Math.max(s-n,Math.abs(s-a),Math.abs(n-a))}tsi({source:t,short_length:e,long_length:r},n){if(t===void 0||isNaN(t)||e===void 0||r===void 0)return;const s=this.change({source:t},n);if(s===void 0)return;const a=this.ema({source:Math.abs(s),length:e},`absema1_${n}`),l=this.ema({source:s,length:e},`ema1_${n}`);if(l===void 0)return;const f=this.ema({source:l,length:r},`ema2_${n}`),h=this.ema({source:a,length:e},`absema2_${n}`);if(f!==void 0)return f/h}valuewhen({condition:t,source:e,occurrence:r},n){if(e===void 0||r===void 0||r<0)return;let{list:s}=this._cacheData[`valuewhen_${n}`]||{};return s||(s=[]),t&&s.push(e),this._cacheDataHandle(`valuewhen_${n}`,{list:s}),s[s.length-1-r]}variance({source:t,length:e,biased:r=!0},n){if(t===void 0||isNaN(t)||e===void 0||e<0)return;const s=this.sma({source:t,length:e},n),a=this._cacheDataList(t,e,`mode_${n}`);if(!a||s===void 0)return;const l=a.filter(h=>h!==void 0&&!isNaN(h)).slice(-e);if(l.length<e)return;const f=l.reduce((h,p)=>h+Math.pow(p-s,2),0);if(f!==void 0)return r||e<=1?f/e:f/(e-1)}vwap({source:t,anchor:e,stdev_mult:r},n){if(t===void 0)return;e=e===void 0?this._timeframe.change({timeframe:"1D"},n):e;const{volume:s}=this._variables;let{sum:a=0,sumV:l=0,count:f=0,isReset:h,sumS:p=0}=this._cacheData[`vwap_${n}`]||{};if(e&&(a=l=f=p=0,h=!0),!h)return r!==void 0?[]:void 0;const c=t*s+a,d=s+l,g=c/d;return f++,r!==void 0?(p=s*Math.pow(t,2)+p,this._cacheDataHandle(`vwap_${n}`,{sum:c,sumV:d,count:f,isReset:h,sumS:p}),this._computeBands(p,d,r,g)):(this._cacheDataHandle(`vwap_${n}`,{sum:c,sumV:d,count:f,isReset:h}),g)}_computeBands(t,e,r,n){let s=t/e-Math.pow(n,2);s=s<0?0:s;const a=Math.sqrt(s),l=a!==void 0&&!isNaN(a)?n+r*a:void 0,f=a!==void 0&&!isNaN(a)?n-r*a:void 0;return[n,l,f]}vwma({source:t,length:e},r){if(t===void 0||isNaN(t)||e===void 0||e<=0)return;const{volume:n}=this._variables,s=this.sma({source:t*n,length:e},`sma1_${r}`),a=this.sma({source:n,length:e},`sma2_${r}`);if(!(s===void 0||a===void 0))return s/a}wpr({length:t},e){if(t===void 0||t<=0)return;const r=this.highest({length:t},e),n=this.lowest({length:t},e),{close:s}=this._variables;if(!(r===void 0||n===void 0))return(r-s)/(r-n)*-100}_sort(t){const e=t.length;for(let r=0;r<e;r++){let n={};for(let s=0;s<e-r;s++){const{currentVal:a,currentIndex:l}=n,f=t[s];if(f!==void 0){if(a!==void 0&&f<a){t.splice(s,1),t.splice(l,0,f),n={currentIndex:l+1,currentVal:a};continue}n={currentIndex:s,currentVal:f}}}}return t}_cacheDataList(t,e,r){const n=this._cacheData[r]||[];n[this._variables.bar_index]=t,this._cacheData[r]=n;const s=n.filter(()=>!0);if(!(s.length<e))return s}_cacheDataHandle(t,e){const{barIndex:r}=this._cacheData[t]||{};r!==this._variables.bar_index&&(this._cacheData[t]=Object.assign(e,{barIndex:this._variables.bar_index}))}}const a1={onlyInLoop:"'$text' is only allowed inside loops",invalidType:"Invalid argument 'expr$index' in 'operator SQBR' call",typeUseError:"Cannot specify a type form '$text' without also specifying the type.",notTypeKeyword:"'$text' is not a valid type keyword in variable declaration",undeclared:"Undeclared identifier '$name'",repeatVar:"'$name' is already defined",typeMismatch:"Cannot call '$operator' with argument '$index'. An argument of '$typeE' type was used but a '$typeR' is expected.",assignTypeMismatch:"Cannot assign a value of the `$typeE` type to the '$name' variable. The variable is declared with the `$typeR` type.",voidNotVar:"Void expression cannot be assigned to a variable",declareTypeErr:"Declared type '$type' is not compatible with assigned type '$valueType'",mapKeyValErr:"Cannot put <$typeA, $typeB> pairs into a map containing `$typeC` keys and `$typeD` values. The maps passed into the `$name()` function must have the same key types and value types.",inputSourceErr:"Invalid value for the '$name' parameter of the '$funcName' function. Possible values: [open, high, low, close, hl2, hlc3, ohlc4, hlcc4, volume].",buildInUseErr:"Cannot use '$name' as the default value of a type's field. The default value cannot be a function, variable or calculation.",argsLenErr:"Too many arguments passed into the `$name()` function call. Passed $lenA arguments but expected $lenB.",requiredParamErr:"No value assigned to the `$argName` parameter in $name()",argsSyntaxErr:"Syntax error after the argument for `$argName`. Arguments without their parameter name cannot be used after arguments with parameter names.",requestArgsErr:"Type $type cannot be used in $name '$argName' argument",mapKeyErr:"Incorrect `key` type `$type` in the variable. The `key` type must be one of the following: int, float, string, bool, color.",templateErr:"Incorrect number of arguments for the template: $countA expected, $countB passed.",templateNoSupportErr:"The '$name()' function does not support templates",ifOrSwitchTypeErr:"Return type of one of the '$keyword' blocks is not compatible with return type of other block(s) ($types)",argsNameErr:"The '$name' function does not have an argument with the name '$argName'",noFiledErr:"Object has no field $name",methodNotExistErr:"Could not find method or method reference '$methodName' for '$name'",tupleVarErr:"Syntax error: The quantities of tuple elements on each side of the assignment operator do not match. The right side has $indexA but the left side has $indexB.",tupleLeftVarErr:"Invalid assignment. Cannot assign a tuple to a variable '$name'.",tupleRightVarErr:"Cannot assign a variable to a tuple. The right side must be a function call or structure ('if', 'switch', 'for', 'while') returning a tuple with the same number of elements.",tempateTypeErr:"Syntax error: Only templates for arrays and matrices consist of a single type identifier enclosed in angle brackets.",qualifierErr:"'$name' is not a valid type qualifier. Possible values: 'const', 'simple', 'series'",notFindFuncErr:"Could not find function or function reference '$name'",naVarErr:"Value with NA type cannot be assigned to a variable that was defined without type keyword",notHistoryErr:"Variable '$name' doesn't have history values",defaultValueErr:"The default value cannot be a function, variable or calculation.",defaultValueTypeErr:"Default value of type $typeE can not be assigned to an argument of type $typeR",unaryErr:"Syntax error at input '$sign'",funcArgAssignErr:"Function arguments cannot be mutable ('$name')",declaredErr:"A variable declared with the '$prefix' keyword cannot accept values of the '$type' form. Assign a '$prefix' value to this variable or remove the '$prefix' keyword from its declaration.",globalFuncErr:"Cannot use '$name' in local scope",onlyStatementErr:"Scripts must contain one declaration statement: `indicator()`, `strategy()` or `library()`, Your script has $count.",modifyGlobalVarErr:"Cannot modify global variable '$name' in function",inputDefvalErr:"Arguments of input function must be of constant type, or 'source' builtin variables.",objectIsNaErr:"Cannot access the '$name' $type of an undefined object. The object is 'na'.",buidinAssignErr:"Cannot assign a new value to the built-in variable '$name'.",buidinVarErr:"Cannot shadow the built-in variable `$name` because it has already been used as a built-in.",useNaErr:"Cannot use an `na` value of an unspecified type in the `$name` function."};Ur.SERIES,Ur.SIMPLE,Ur.INPUT,Ur.CONST,Ur.INT,Ur.FLOAT,Ur.BOOL,Ur.COLOR,Ur.STRING;const u1=["close","open","high","low","hl2","hlc3","hlcc4","ohlc4","volume"];class l1{constructor(t,e){z(this,"_cacheData");z(this,"_variables");z(this,"_errorListener");z(this,"_count");z(this,"_historyInputs");z(this,"_name");this._cacheData={},this._variables=t,this._errorListener=e,this._count=-1,this._name=`inputs_${Op()}`,this._historyInputs=self.workerStorage.get(this._name)||{}}update(t){for(const e of t){const r=e.id;if(!this._cacheData[r])return;Object.assign(this._cacheData[r],{...e,isModify:!0}),self.workerStorage.updateValue(this._name,`in_${e.index}`,{modifyDefval:e.sourceTypeName||e.defval})}}input(t,e){return this._cacheHandle(t,e)}int(t,e){return this._cacheHandle(t,e,"int")}bool(t,e){return this._cacheHandle(t,e,"bool")}color(t,e){return this._cacheHandle(t,e,"color")}time(t,e){return this._cacheHandle(t,e,"time")}float(t,e){return this._cacheHandle(t,e,"float")}price(t,e){return this._cacheHandle(t,e,"price")}source(t,e){return this._cacheHandle(t,e,"source")}string(t,e){return this._cacheHandle(t,e,"string")}symbol(t,e){return this._cacheHandle(t,e,"symbol")}session(t,e){return this._cacheHandle(t,e,"session")}text_area(t,e){return this._cacheHandle(t,e,"text_area")}timeframe(t,e){return this._cacheHandle(t,e,"timeframe")}_cacheHandle(t,e,r){const n=`${r||"input"}_${e}`,s=this._cacheData[n];if(t.defval===void 0&&this._errorListener.addError(a1.inputDefvalErr,e,Ce.Error),s)s.isModify?s.sourceTypeName&&(this._cacheData[n].defval=this._variables[s.sourceTypeName]):Object.assign(this._cacheData[n],t);else{const{defval:a,display:l}=t;this._displayVerify(e,l),this._count++,t={inputType:r,...t,index:this._count},this._cacheData[n]=t,this._judgeHistoryInputs(t),(r||t.inputType)==="source"?this._cacheData[n].options=u1:t.options&&!t.options.includes(a)&&this._errorListener.addError(`input's defval should be in options, but '${a}' is not in [${t.options.toString()}]`,e,Ce.Error)}return this._cacheData[n].defval}_judgeHistoryInputs(t){const{defval:e,sourceTypeName:r,index:n}=t;let s=r||e;const a=`in_${n}`,l=this._historyInputs[a];if(!l)self.workerStorage.setValue(this._name,a,{defval:s});else{const{defval:f,modifyDefval:h}=l;f===s?s=h||s:self.workerStorage.setValue(this._name,a,{defval:s})}r?t.sourceTypeName=s:t.defval=s}_displayVerify(t,e){!e||!e.length||e.includes(ir.dataWindow)||e.includes(ir.statusLine)||this._errorListener.addError("Invalid argument 'display' in 'input' call. Possible values: [display.none, display.data_window, display.status_line, display.all]",t,Ce.Error)}getInputs(){const t=Object.keys(this._cacheData),e=[];for(const r of t){const n=this._cacheData[r];n.id=r,e.push(n)}return e}_getGroups(t){const e=[];for(const[r,n]of t)e.push({name:r,inputs:n});return e}}class f1{color({x:t}){return t}new({color:t,transp:e=100}){_t(e)&&(e=100);const{r,g:n,b:s}=this._parseColor(t||"");return`rgba(${Math.round(r)}, ${Math.round(n)}, ${Math.round(s)}, ${(100-e)/100})`}rgb({red:t=0,green:e=0,blue:r=0,transp:n=0}){return _t(n)&&(n=0),_t(t)&&(t=0),_t(e)&&(e=0),_t(r)&&(r=0),`rgba(${t}, ${e}, ${r}, ${(100-n)/100})`}g({color:t}){return t?this._parseColor(t).g:0}r({color:t}){return t?this._parseColor(t).r:0}b({color:t}){return t?this._parseColor(t).b:0}t({color:t}){return t?Math.round(this._parseColor(t).a*100):0}from_gradient({value:t,bottom_value:e,top_value:r,bottom_color:n,top_color:s}){if(_t(t)||_t(e)||_t(r))return"rgba(0,0,0,1)";const a=(t-e)/(r-e),l=Math.min(Math.max(a,0),1),{r:f,g:h,b:p,a:c}=this._parseColor(n||"rgba(0,0,0,0)"),{r:d,g,b:w,a:m}=this._parseColor(s||"rgba(0,0,0,0)"),D=f+l*(d-f),v=h+l*(g-h),E=p+l*(w-p),b=c+l*(m-c);return`rgba(${Math.round(D)}, ${Math.round(v)}, ${Math.round(E)}, ${b.toFixed(2)})`}_parseColor(t){let e,r,n,s;if(t.startsWith("#")){e=parseInt(t.substring(1,3),16),r=parseInt(t.substring(3,5),16),n=parseInt(t.substring(5,7),16);const a=t.substring(7);a?s=(255-parseInt(a,16))/255:s=1}else{const a=this._parserRgbColor(t);e=a[0]||0,r=a[1]||0,n=a[2]||0,s=a[3]||1}return{r:e,g:r,b:n,a:s}}_parserRgbColor(t){var e;return((e=t.match(/\d+/g))==null?void 0:e.map(Number))||[]}}var zt={};const c1=Object.prototype.toString;function Ki(i){const t=c1.call(i);return t.endsWith("Array]")&&!t.includes("Big")}var h1=Object.freeze({__proto__:null,isAnyArray:Ki}),p1=be(h1);function d1(i){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Ki(i))throw new TypeError("input must be an array");if(i.length===0)throw new TypeError("input must not be empty");var e=t.fromIndex,r=e===void 0?0:e,n=t.toIndex,s=n===void 0?i.length:n;if(r<0||r>=i.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(s<=r||s>i.length||!Number.isInteger(s))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=i[r],l=r+1;l<s;l++)i[l]>a&&(a=i[l]);return a}function _1(i){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Ki(i))throw new TypeError("input must be an array");if(i.length===0)throw new TypeError("input must not be empty");var e=t.fromIndex,r=e===void 0?0:e,n=t.toIndex,s=n===void 0?i.length:n;if(r<0||r>=i.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(s<=r||s>i.length||!Number.isInteger(s))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=i[r],l=r+1;l<s;l++)i[l]<a&&(a=i[l]);return a}function m1(i){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(Ki(i)){if(i.length===0)throw new TypeError("input must not be empty")}else throw new TypeError("input must be an array");var e;if(t.output!==void 0){if(!Ki(t.output))throw new TypeError("output option must be an array if specified");e=t.output}else e=new Array(i.length);var r=_1(i),n=d1(i);if(r===n)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var s=t.min,a=s===void 0?t.autoMinMax?r:0:s,l=t.max,f=l===void 0?t.autoMinMax?n:1:l;if(a>=f)throw new RangeError("min option must be smaller than max option");for(var h=(f-a)/(n-r),p=0;p<i.length;p++)e[p]=(i[p]-r)*h+a;return e}var g1=Object.freeze({__proto__:null,default:m1}),v1=be(g1);Object.defineProperty(zt,"__esModule",{value:!0});var Qe=p1,Tc=v1;const Js=" ".repeat(2),Ic=" ".repeat(4);function w1(){return Oc(this)}function Oc(i,t={}){const{maxRows:e=15,maxColumns:r=10,maxNumSize:n=8,padMinus:s="auto"}=t;return`${i.constructor.name} {
|
55
55
|
${Js}[
|
56
|
-
${
|
56
|
+
${Ic}${y1(i,e,r,n,s)}
|
57
57
|
${Js}]
|
58
58
|
${Js}rows: ${i.rows}
|
59
59
|
${Js}columns: ${i.columns}
|
60
60
|
}`}function y1(i,t,e,r,n){const{rows:s,columns:a}=i,l=Math.min(s,t),f=Math.min(a,e),h=[];if(n==="auto"){n=!1;t:for(let p=0;p<l;p++)for(let c=0;c<f;c++)if(i.get(p,c)<0){n=!0;break t}}for(let p=0;p<l;p++){let c=[];for(let d=0;d<f;d++)c.push(D1(i.get(p,d),r,n));h.push(`${c.join(" ")}`)}return f!==a&&(h[h.length-1]+=` ... ${a-e} more columns`),l!==s&&h.push(`... ${s-t} more rows`),h.join(`
|
61
|
-
${Tc}`)}function D1(i,t,e){return(i>=0&&e?` ${Oc(i,t-1)}`:Oc(i,t)).padEnd(t)}function Oc(i,t){let e=i.toString();if(e.length<=t)return e;let r=i.toFixed(t);if(r.length>t&&(r=i.toFixed(Math.max(0,t-(r.length-t)))),r.length<=t&&!r.startsWith("0.000")&&!r.startsWith("-0.000"))return r;let n=i.toExponential(t);return n.length>t&&(n=i.toExponential(Math.max(0,t-(n.length-t)))),n.slice(0)}function b1(i,t){i.prototype.add=function(r){return typeof r=="number"?this.addS(r):this.addM(r)},i.prototype.addS=function(r){for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)+r);return this},i.prototype.addM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)+r.get(n,s));return this},i.add=function(r,n){return new t(r).add(n)},i.prototype.sub=function(r){return typeof r=="number"?this.subS(r):this.subM(r)},i.prototype.subS=function(r){for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)-r);return this},i.prototype.subM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)-r.get(n,s));return this},i.sub=function(r,n){return new t(r).sub(n)},i.prototype.subtract=i.prototype.sub,i.prototype.subtractS=i.prototype.subS,i.prototype.subtractM=i.prototype.subM,i.subtract=i.sub,i.prototype.mul=function(r){return typeof r=="number"?this.mulS(r):this.mulM(r)},i.prototype.mulS=function(r){for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)*r);return this},i.prototype.mulM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)*r.get(n,s));return this},i.mul=function(r,n){return new t(r).mul(n)},i.prototype.multiply=i.prototype.mul,i.prototype.multiplyS=i.prototype.mulS,i.prototype.multiplyM=i.prototype.mulM,i.multiply=i.mul,i.prototype.div=function(r){return typeof r=="number"?this.divS(r):this.divM(r)},i.prototype.divS=function(r){for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)/r);return this},i.prototype.divM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)/r.get(n,s));return this},i.div=function(r,n){return new t(r).div(n)},i.prototype.divide=i.prototype.div,i.prototype.divideS=i.prototype.divS,i.prototype.divideM=i.prototype.divM,i.divide=i.div,i.prototype.mod=function(r){return typeof r=="number"?this.modS(r):this.modM(r)},i.prototype.modS=function(r){for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)%r);return this},i.prototype.modM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)%r.get(n,s));return this},i.mod=function(r,n){return new t(r).mod(n)},i.prototype.modulus=i.prototype.mod,i.prototype.modulusS=i.prototype.modS,i.prototype.modulusM=i.prototype.modM,i.modulus=i.mod,i.prototype.and=function(r){return typeof r=="number"?this.andS(r):this.andM(r)},i.prototype.andS=function(r){for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)&r);return this},i.prototype.andM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)&r.get(n,s));return this},i.and=function(r,n){return new t(r).and(n)},i.prototype.or=function(r){return typeof r=="number"?this.orS(r):this.orM(r)},i.prototype.orS=function(r){for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)|r);return this},i.prototype.orM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)|r.get(n,s));return this},i.or=function(r,n){return new t(r).or(n)},i.prototype.xor=function(r){return typeof r=="number"?this.xorS(r):this.xorM(r)},i.prototype.xorS=function(r){for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)^r);return this},i.prototype.xorM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)^r.get(n,s));return this},i.xor=function(r,n){return new t(r).xor(n)},i.prototype.leftShift=function(r){return typeof r=="number"?this.leftShiftS(r):this.leftShiftM(r)},i.prototype.leftShiftS=function(r){for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)<<r);return this},i.prototype.leftShiftM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)<<r.get(n,s));return this},i.leftShift=function(r,n){return new t(r).leftShift(n)},i.prototype.signPropagatingRightShift=function(r){return typeof r=="number"?this.signPropagatingRightShiftS(r):this.signPropagatingRightShiftM(r)},i.prototype.signPropagatingRightShiftS=function(r){for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)>>r);return this},i.prototype.signPropagatingRightShiftM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)>>r.get(n,s));return this},i.signPropagatingRightShift=function(r,n){return new t(r).signPropagatingRightShift(n)},i.prototype.rightShift=function(r){return typeof r=="number"?this.rightShiftS(r):this.rightShiftM(r)},i.prototype.rightShiftS=function(r){for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)>>>r);return this},i.prototype.rightShiftM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)>>>r.get(n,s));return this},i.rightShift=function(r,n){return new t(r).rightShift(n)},i.prototype.zeroFillRightShift=i.prototype.rightShift,i.prototype.zeroFillRightShiftS=i.prototype.rightShiftS,i.prototype.zeroFillRightShiftM=i.prototype.rightShiftM,i.zeroFillRightShift=i.rightShift,i.prototype.not=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,~this.get(r,n));return this},i.not=function(r){return new t(r).not()},i.prototype.abs=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.abs(this.get(r,n)));return this},i.abs=function(r){return new t(r).abs()},i.prototype.acos=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.acos(this.get(r,n)));return this},i.acos=function(r){return new t(r).acos()},i.prototype.acosh=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.acosh(this.get(r,n)));return this},i.acosh=function(r){return new t(r).acosh()},i.prototype.asin=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.asin(this.get(r,n)));return this},i.asin=function(r){return new t(r).asin()},i.prototype.asinh=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.asinh(this.get(r,n)));return this},i.asinh=function(r){return new t(r).asinh()},i.prototype.atan=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.atan(this.get(r,n)));return this},i.atan=function(r){return new t(r).atan()},i.prototype.atanh=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.atanh(this.get(r,n)));return this},i.atanh=function(r){return new t(r).atanh()},i.prototype.cbrt=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.cbrt(this.get(r,n)));return this},i.cbrt=function(r){return new t(r).cbrt()},i.prototype.ceil=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.ceil(this.get(r,n)));return this},i.ceil=function(r){return new t(r).ceil()},i.prototype.clz32=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.clz32(this.get(r,n)));return this},i.clz32=function(r){return new t(r).clz32()},i.prototype.cos=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.cos(this.get(r,n)));return this},i.cos=function(r){return new t(r).cos()},i.prototype.cosh=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.cosh(this.get(r,n)));return this},i.cosh=function(r){return new t(r).cosh()},i.prototype.exp=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.exp(this.get(r,n)));return this},i.exp=function(r){return new t(r).exp()},i.prototype.expm1=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.expm1(this.get(r,n)));return this},i.expm1=function(r){return new t(r).expm1()},i.prototype.floor=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.floor(this.get(r,n)));return this},i.floor=function(r){return new t(r).floor()},i.prototype.fround=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.fround(this.get(r,n)));return this},i.fround=function(r){return new t(r).fround()},i.prototype.log=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.log(this.get(r,n)));return this},i.log=function(r){return new t(r).log()},i.prototype.log1p=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.log1p(this.get(r,n)));return this},i.log1p=function(r){return new t(r).log1p()},i.prototype.log10=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.log10(this.get(r,n)));return this},i.log10=function(r){return new t(r).log10()},i.prototype.log2=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.log2(this.get(r,n)));return this},i.log2=function(r){return new t(r).log2()},i.prototype.round=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.round(this.get(r,n)));return this},i.round=function(r){return new t(r).round()},i.prototype.sign=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.sign(this.get(r,n)));return this},i.sign=function(r){return new t(r).sign()},i.prototype.sin=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.sin(this.get(r,n)));return this},i.sin=function(r){return new t(r).sin()},i.prototype.sinh=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.sinh(this.get(r,n)));return this},i.sinh=function(r){return new t(r).sinh()},i.prototype.sqrt=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.sqrt(this.get(r,n)));return this},i.sqrt=function(r){return new t(r).sqrt()},i.prototype.tan=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.tan(this.get(r,n)));return this},i.tan=function(r){return new t(r).tan()},i.prototype.tanh=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.tanh(this.get(r,n)));return this},i.tanh=function(r){return new t(r).tanh()},i.prototype.trunc=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.trunc(this.get(r,n)));return this},i.trunc=function(r){return new t(r).trunc()},i.pow=function(r,n){return new t(r).pow(n)},i.prototype.pow=function(r){return typeof r=="number"?this.powS(r):this.powM(r)},i.prototype.powS=function(r){for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,Math.pow(this.get(n,s),r));return this},i.prototype.powM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,Math.pow(this.get(n,s),r.get(n,s)));return this}}function yr(i,t,e){let r=e?i.rows:i.rows-1;if(t<0||t>r)throw new RangeError("Row index out of range")}function Dr(i,t,e){let r=e?i.columns:i.columns-1;if(t<0||t>r)throw new RangeError("Column index out of range")}function _i(i,t){if(t.to1DArray&&(t=t.to1DArray()),t.length!==i.columns)throw new RangeError("vector size must be the same as the number of columns");return t}function mi(i,t){if(t.to1DArray&&(t=t.to1DArray()),t.length!==i.rows)throw new RangeError("vector size must be the same as the number of rows");return t}function Ba(i,t){if(!Qe.isAnyArray(t))throw new TypeError("row indices must be an array");for(let e=0;e<t.length;e++)if(t[e]<0||t[e]>=i.rows)throw new RangeError("row indices are out of range")}function Ta(i,t){if(!Qe.isAnyArray(t))throw new TypeError("column indices must be an array");for(let e=0;e<t.length;e++)if(t[e]<0||t[e]>=i.columns)throw new RangeError("column indices are out of range")}function Ia(i,t,e,r,n){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(Vs("startRow",t),Vs("endRow",e),Vs("startColumn",r),Vs("endColumn",n),t>e||r>n||t<0||t>=i.rows||e<0||e>=i.rows||r<0||r>=i.columns||n<0||n>=i.columns)throw new RangeError("Submatrix indices are out of range")}function Xs(i,t=0){let e=[];for(let r=0;r<i;r++)e.push(t);return e}function Vs(i,t){if(typeof t!="number")throw new TypeError(`${i} must be a number`)}function gi(i){if(i.isEmpty())throw new Error("Empty matrix has no elements to index")}function E1(i){let t=Xs(i.rows);for(let e=0;e<i.rows;++e)for(let r=0;r<i.columns;++r)t[e]+=i.get(e,r);return t}function x1(i){let t=Xs(i.columns);for(let e=0;e<i.rows;++e)for(let r=0;r<i.columns;++r)t[r]+=i.get(e,r);return t}function A1(i){let t=0;for(let e=0;e<i.rows;e++)for(let r=0;r<i.columns;r++)t+=i.get(e,r);return t}function C1(i){let t=Xs(i.rows,1);for(let e=0;e<i.rows;++e)for(let r=0;r<i.columns;++r)t[e]*=i.get(e,r);return t}function F1(i){let t=Xs(i.columns,1);for(let e=0;e<i.rows;++e)for(let r=0;r<i.columns;++r)t[r]*=i.get(e,r);return t}function M1(i){let t=1;for(let e=0;e<i.rows;e++)for(let r=0;r<i.columns;r++)t*=i.get(e,r);return t}function N1(i,t,e){const r=i.rows,n=i.columns,s=[];for(let a=0;a<r;a++){let l=0,f=0,h=0;for(let p=0;p<n;p++)h=i.get(a,p)-e[a],l+=h,f+=h*h;t?s.push((f-l*l/n)/(n-1)):s.push((f-l*l/n)/n)}return s}function S1(i,t,e){const r=i.rows,n=i.columns,s=[];for(let a=0;a<n;a++){let l=0,f=0,h=0;for(let p=0;p<r;p++)h=i.get(p,a)-e[a],l+=h,f+=h*h;t?s.push((f-l*l/r)/(r-1)):s.push((f-l*l/r)/r)}return s}function B1(i,t,e){const r=i.rows,n=i.columns,s=r*n;let a=0,l=0,f=0;for(let h=0;h<r;h++)for(let p=0;p<n;p++)f=i.get(h,p)-e,a+=f,l+=f*f;return t?(l-a*a/s)/(s-1):(l-a*a/s)/s}function T1(i,t){for(let e=0;e<i.rows;e++)for(let r=0;r<i.columns;r++)i.set(e,r,i.get(e,r)-t[e])}function I1(i,t){for(let e=0;e<i.rows;e++)for(let r=0;r<i.columns;r++)i.set(e,r,i.get(e,r)-t[r])}function O1(i,t){for(let e=0;e<i.rows;e++)for(let r=0;r<i.columns;r++)i.set(e,r,i.get(e,r)-t)}function $1(i){const t=[];for(let e=0;e<i.rows;e++){let r=0;for(let n=0;n<i.columns;n++)r+=Math.pow(i.get(e,n),2)/(i.columns-1);t.push(Math.sqrt(r))}return t}function L1(i,t){for(let e=0;e<i.rows;e++)for(let r=0;r<i.columns;r++)i.set(e,r,i.get(e,r)/t[e])}function R1(i){const t=[];for(let e=0;e<i.columns;e++){let r=0;for(let n=0;n<i.rows;n++)r+=Math.pow(i.get(n,e),2)/(i.rows-1);t.push(Math.sqrt(r))}return t}function P1(i,t){for(let e=0;e<i.rows;e++)for(let r=0;r<i.columns;r++)i.set(e,r,i.get(e,r)/t[r])}function z1(i){const t=i.size-1;let e=0;for(let r=0;r<i.columns;r++)for(let n=0;n<i.rows;n++)e+=Math.pow(i.get(n,r),2)/t;return Math.sqrt(e)}function q1(i,t){for(let e=0;e<i.rows;e++)for(let r=0;r<i.columns;r++)i.set(e,r,i.get(e,r)/t)}class $t{static from1DArray(t,e,r){if(t*e!==r.length)throw new RangeError("data length does not match given dimensions");let s=new pt(t,e);for(let a=0;a<t;a++)for(let l=0;l<e;l++)s.set(a,l,r[a*e+l]);return s}static rowVector(t){let e=new pt(1,t.length);for(let r=0;r<t.length;r++)e.set(0,r,t[r]);return e}static columnVector(t){let e=new pt(t.length,1);for(let r=0;r<t.length;r++)e.set(r,0,t[r]);return e}static zeros(t,e){return new pt(t,e)}static ones(t,e){return new pt(t,e).fill(1)}static rand(t,e,r={}){if(typeof r!="object")throw new TypeError("options must be an object");const{random:n=Math.random}=r;let s=new pt(t,e);for(let a=0;a<t;a++)for(let l=0;l<e;l++)s.set(a,l,n());return s}static randInt(t,e,r={}){if(typeof r!="object")throw new TypeError("options must be an object");const{min:n=0,max:s=1e3,random:a=Math.random}=r;if(!Number.isInteger(n))throw new TypeError("min must be an integer");if(!Number.isInteger(s))throw new TypeError("max must be an integer");if(n>=s)throw new RangeError("min must be smaller than max");let l=s-n,f=new pt(t,e);for(let h=0;h<t;h++)for(let p=0;p<e;p++){let c=n+Math.round(a()*l);f.set(h,p,c)}return f}static eye(t,e,r){e===void 0&&(e=t),r===void 0&&(r=1);let n=Math.min(t,e),s=this.zeros(t,e);for(let a=0;a<n;a++)s.set(a,a,r);return s}static diag(t,e,r){let n=t.length;e===void 0&&(e=n),r===void 0&&(r=e);let s=Math.min(n,e,r),a=this.zeros(e,r);for(let l=0;l<s;l++)a.set(l,l,t[l]);return a}static min(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,n=t.columns,s=new pt(r,n);for(let a=0;a<r;a++)for(let l=0;l<n;l++)s.set(a,l,Math.min(t.get(a,l),e.get(a,l)));return s}static max(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,n=t.columns,s=new this(r,n);for(let a=0;a<r;a++)for(let l=0;l<n;l++)s.set(a,l,Math.max(t.get(a,l),e.get(a,l)));return s}static checkMatrix(t){return $t.isMatrix(t)?t:new pt(t)}static isMatrix(t){return t!=null&&t.klass==="Matrix"}get size(){return this.rows*this.columns}apply(t){if(typeof t!="function")throw new TypeError("callback must be a function");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.call(this,e,r);return this}to1DArray(){let t=[];for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.push(this.get(e,r));return t}to2DArray(){let t=[];for(let e=0;e<this.rows;e++){t.push([]);for(let r=0;r<this.columns;r++)t[e].push(this.get(e,r))}return t}toJSON(){return this.to2DArray()}isRowVector(){return this.rows===1}isColumnVector(){return this.columns===1}isVector(){return this.rows===1||this.columns===1}isSquare(){return this.rows===this.columns}isEmpty(){return this.rows===0||this.columns===0}isSymmetric(){if(this.isSquare()){for(let t=0;t<this.rows;t++)for(let e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}isDistance(){if(!this.isSymmetric())return!1;for(let t=0;t<this.rows;t++)if(this.get(t,t)!==0)return!1;return!0}isEchelonForm(){let t=0,e=0,r=-1,n=!0,s=!1;for(;t<this.rows&&n;){for(e=0,s=!1;e<this.columns&&s===!1;)this.get(t,e)===0?e++:this.get(t,e)===1&&e>r?(s=!0,r=e):(n=!1,s=!0);t++}return n}isReducedEchelonForm(){let t=0,e=0,r=-1,n=!0,s=!1;for(;t<this.rows&&n;){for(e=0,s=!1;e<this.columns&&s===!1;)this.get(t,e)===0?e++:this.get(t,e)===1&&e>r?(s=!0,r=e):(n=!1,s=!0);for(let a=e+1;a<this.rows;a++)this.get(t,a)!==0&&(n=!1);t++}return n}echelonForm(){let t=this.clone(),e=0,r=0;for(;e<t.rows&&r<t.columns;){let n=e;for(let s=e;s<t.rows;s++)t.get(s,r)>t.get(n,r)&&(n=s);if(t.get(n,r)===0)r++;else{t.swapRows(e,n);let s=t.get(e,r);for(let a=r;a<t.columns;a++)t.set(e,a,t.get(e,a)/s);for(let a=e+1;a<t.rows;a++){let l=t.get(a,r)/t.get(e,r);t.set(a,r,0);for(let f=r+1;f<t.columns;f++)t.set(a,f,t.get(a,f)-t.get(e,f)*l)}e++,r++}}return t}reducedEchelonForm(){let t=this.echelonForm(),e=t.columns,r=t.rows,n=r-1;for(;n>=0;)if(t.maxRow(n)===0)n--;else{let s=0,a=!1;for(;s<r&&a===!1;)t.get(n,s)===1?a=!0:s++;for(let l=0;l<n;l++){let f=t.get(l,s);for(let h=s;h<e;h++){let p=t.get(l,h)-f*t.get(n,h);t.set(l,h,p)}}n--}return t}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(t={}){if(typeof t!="object")throw new TypeError("options must be an object");const{rows:e=1,columns:r=1}=t;if(!Number.isInteger(e)||e<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(r)||r<=0)throw new TypeError("columns must be a positive integer");let n=new pt(this.rows*e,this.columns*r);for(let s=0;s<e;s++)for(let a=0;a<r;a++)n.setSubMatrix(this,this.rows*s,this.columns*a);return n}fill(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,t);return this}neg(){return this.mulS(-1)}getRow(t){yr(this,t);let e=[];for(let r=0;r<this.columns;r++)e.push(this.get(t,r));return e}getRowVector(t){return pt.rowVector(this.getRow(t))}setRow(t,e){yr(this,t),e=_i(this,e);for(let r=0;r<this.columns;r++)this.set(t,r,e[r]);return this}swapRows(t,e){yr(this,t),yr(this,e);for(let r=0;r<this.columns;r++){let n=this.get(t,r);this.set(t,r,this.get(e,r)),this.set(e,r,n)}return this}getColumn(t){Dr(this,t);let e=[];for(let r=0;r<this.rows;r++)e.push(this.get(r,t));return e}getColumnVector(t){return pt.columnVector(this.getColumn(t))}setColumn(t,e){Dr(this,t),e=mi(this,e);for(let r=0;r<this.rows;r++)this.set(r,t,e[r]);return this}swapColumns(t,e){Dr(this,t),Dr(this,e);for(let r=0;r<this.rows;r++){let n=this.get(r,t);this.set(r,t,this.get(r,e)),this.set(r,e,n)}return this}addRowVector(t){t=_i(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[r]);return this}subRowVector(t){t=_i(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[r]);return this}mulRowVector(t){t=_i(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[r]);return this}divRowVector(t){t=_i(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[r]);return this}addColumnVector(t){t=mi(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[e]);return this}subColumnVector(t){t=mi(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[e]);return this}mulColumnVector(t){t=mi(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[e]);return this}divColumnVector(t){t=mi(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[e]);return this}mulRow(t,e){yr(this,t);for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)*e);return this}mulColumn(t,e){Dr(this,t);for(let r=0;r<this.rows;r++)this.set(r,t,this.get(r,t)*e);return this}max(t){if(this.isEmpty())return NaN;switch(t){case"row":{const e=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)>e[r]&&(e[r]=this.get(r,n));return e}case"column":{const e=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)>e[n]&&(e[n]=this.get(r,n));return e}case void 0:{let e=this.get(0,0);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)>e&&(e=this.get(r,n));return e}default:throw new Error(`invalid option: ${t}`)}}maxIndex(){gi(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)>t&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}min(t){if(this.isEmpty())return NaN;switch(t){case"row":{const e=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)<e[r]&&(e[r]=this.get(r,n));return e}case"column":{const e=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)<e[n]&&(e[n]=this.get(r,n));return e}case void 0:{let e=this.get(0,0);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)<e&&(e=this.get(r,n));return e}default:throw new Error(`invalid option: ${t}`)}}minIndex(){gi(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)<t&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}maxRow(t){if(yr(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)>e&&(e=this.get(t,r));return e}maxRowIndex(t){yr(this,t),gi(this);let e=this.get(t,0),r=[t,0];for(let n=1;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n),r[1]=n);return r}minRow(t){if(yr(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)<e&&(e=this.get(t,r));return e}minRowIndex(t){yr(this,t),gi(this);let e=this.get(t,0),r=[t,0];for(let n=1;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n),r[1]=n);return r}maxColumn(t){if(Dr(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)>e&&(e=this.get(r,t));return e}maxColumnIndex(t){Dr(this,t),gi(this);let e=this.get(0,t),r=[0,t];for(let n=1;n<this.rows;n++)this.get(n,t)>e&&(e=this.get(n,t),r[0]=n);return r}minColumn(t){if(Dr(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)<e&&(e=this.get(r,t));return e}minColumnIndex(t){Dr(this,t),gi(this);let e=this.get(0,t),r=[0,t];for(let n=1;n<this.rows;n++)this.get(n,t)<e&&(e=this.get(n,t),r[0]=n);return r}diag(){let t=Math.min(this.rows,this.columns),e=[];for(let r=0;r<t;r++)e.push(this.get(r,r));return e}norm(t="frobenius"){switch(t){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw new RangeError(`unknown norm type: ${t}`)}}cumulativeSum(){let t=0;for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t+=this.get(e,r),this.set(e,r,t);return this}dot(t){$t.isMatrix(t)&&(t=t.to1DArray());let e=this.to1DArray();if(e.length!==t.length)throw new RangeError("vectors do not have the same size");let r=0;for(let n=0;n<e.length;n++)r+=e[n]*t[n];return r}mmul(t){t=pt.checkMatrix(t);let e=this.rows,r=this.columns,n=t.columns,s=new pt(e,n),a=new Float64Array(r);for(let l=0;l<n;l++){for(let f=0;f<r;f++)a[f]=t.get(f,l);for(let f=0;f<e;f++){let h=0;for(let p=0;p<r;p++)h+=this.get(f,p)*a[p];s.set(f,l,h)}}return s}strassen2x2(t){t=pt.checkMatrix(t);let e=new pt(2,2);const r=this.get(0,0),n=t.get(0,0),s=this.get(0,1),a=t.get(0,1),l=this.get(1,0),f=t.get(1,0),h=this.get(1,1),p=t.get(1,1),c=(r+h)*(n+p),d=(l+h)*n,g=r*(a-p),w=h*(f-n),m=(r+s)*p,D=(l-r)*(n+a),v=(s-h)*(f+p),E=c+w-m+v,b=g+m,N=d+w,x=c-d+g+D;return e.set(0,0,E),e.set(0,1,b),e.set(1,0,N),e.set(1,1,x),e}strassen3x3(t){t=pt.checkMatrix(t);let e=new pt(3,3);const r=this.get(0,0),n=this.get(0,1),s=this.get(0,2),a=this.get(1,0),l=this.get(1,1),f=this.get(1,2),h=this.get(2,0),p=this.get(2,1),c=this.get(2,2),d=t.get(0,0),g=t.get(0,1),w=t.get(0,2),m=t.get(1,0),D=t.get(1,1),v=t.get(1,2),E=t.get(2,0),b=t.get(2,1),N=t.get(2,2),x=(r+n+s-a-l-p-c)*D,F=(r-a)*(-g+D),M=l*(-d+g+m-D-v-E+N),S=(-r+a+l)*(d-g+D),O=(a+l)*(-d+g),C=r*d,T=(-r+h+p)*(d-w+v),L=(-r+h)*(w-v),U=(h+p)*(-d+w),k=(r+n+s-l-f-h-p)*v,W=p*(-d+w+m-D-v-E+b),P=(-s+p+c)*(D+E-b),K=(s-c)*(D-b),G=s*E,V=(p+c)*(-E+b),tt=(-s+l+f)*(v+E-N),ft=(s-f)*(v-N),vt=(l+f)*(-E+N),lt=n*m,yt=f*b,bt=a*w,Bt=h*g,Et=c*N,ne=C+G+lt,It=x+S+O+C+P+G+V,Nt=C+T+U+k+G+tt+vt,se=F+M+S+C+G+tt+ft,Vt=F+S+O+C+yt,qt=G+tt+ft+vt+bt,Kt=C+T+L+W+P+K+G,Me=P+K+G+V+Bt,ur=C+T+L+U+Et;return e.set(0,0,ne),e.set(0,1,It),e.set(0,2,Nt),e.set(1,0,se),e.set(1,1,Vt),e.set(1,2,qt),e.set(2,0,Kt),e.set(2,1,Me),e.set(2,2,ur),e}mmulStrassen(t){t=pt.checkMatrix(t);let e=this.clone(),r=e.rows,n=e.columns,s=t.rows,a=t.columns;n!==s&&console.warn(`Multiplying ${r} x ${n} and ${s} x ${a} matrix: dimensions do not match.`);function l(c,d,g){let w=c.rows,m=c.columns;if(w===d&&m===g)return c;{let D=$t.zeros(d,g);return D=D.setSubMatrix(c,0,0),D}}let f=Math.max(r,s),h=Math.max(n,a);e=l(e,f,h),t=l(t,f,h);function p(c,d,g,w){if(g<=512||w<=512)return c.mmul(d);g%2===1&&w%2===1?(c=l(c,g+1,w+1),d=l(d,g+1,w+1)):g%2===1?(c=l(c,g+1,w),d=l(d,g+1,w)):w%2===1&&(c=l(c,g,w+1),d=l(d,g,w+1));let m=parseInt(c.rows/2,10),D=parseInt(c.columns/2,10),v=c.subMatrix(0,m-1,0,D-1),E=d.subMatrix(0,m-1,0,D-1),b=c.subMatrix(0,m-1,D,c.columns-1),N=d.subMatrix(0,m-1,D,d.columns-1),x=c.subMatrix(m,c.rows-1,0,D-1),F=d.subMatrix(m,d.rows-1,0,D-1),M=c.subMatrix(m,c.rows-1,D,c.columns-1),S=d.subMatrix(m,d.rows-1,D,d.columns-1),O=p($t.add(v,M),$t.add(E,S),m,D),C=p($t.add(x,M),E,m,D),T=p(v,$t.sub(N,S),m,D),L=p(M,$t.sub(F,E),m,D),U=p($t.add(v,b),S,m,D),k=p($t.sub(x,v),$t.add(E,N),m,D),W=p($t.sub(b,M),$t.add(F,S),m,D),P=$t.add(O,L);P.sub(U),P.add(W);let K=$t.add(T,U),G=$t.add(C,L),V=$t.sub(O,C);V.add(T),V.add(k);let tt=$t.zeros(2*P.rows,2*P.columns);return tt=tt.setSubMatrix(P,0,0),tt=tt.setSubMatrix(K,P.rows,0),tt=tt.setSubMatrix(G,0,P.columns),tt=tt.setSubMatrix(V,P.rows,P.columns),tt.subMatrix(0,g-1,0,w-1)}return p(e,t,f,h)}scaleRows(t={}){if(typeof t!="object")throw new TypeError("options must be an object");const{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(e>=r)throw new RangeError("min must be smaller than max");let n=new pt(this.rows,this.columns);for(let s=0;s<this.rows;s++){const a=this.getRow(s);a.length>0&&Bc(a,{min:e,max:r,output:a}),n.setRow(s,a)}return n}scaleColumns(t={}){if(typeof t!="object")throw new TypeError("options must be an object");const{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(e>=r)throw new RangeError("min must be smaller than max");let n=new pt(this.rows,this.columns);for(let s=0;s<this.columns;s++){const a=this.getColumn(s);a.length&&Bc(a,{min:e,max:r,output:a}),n.setColumn(s,a)}return n}flipRows(){const t=Math.ceil(this.columns/2);for(let e=0;e<this.rows;e++)for(let r=0;r<t;r++){let n=this.get(e,r),s=this.get(e,this.columns-1-r);this.set(e,r,s),this.set(e,this.columns-1-r,n)}return this}flipColumns(){const t=Math.ceil(this.rows/2);for(let e=0;e<this.columns;e++)for(let r=0;r<t;r++){let n=this.get(r,e),s=this.get(this.rows-1-r,e);this.set(r,e,s),this.set(this.rows-1-r,e,n)}return this}kroneckerProduct(t){t=pt.checkMatrix(t);let e=this.rows,r=this.columns,n=t.rows,s=t.columns,a=new pt(e*n,r*s);for(let l=0;l<e;l++)for(let f=0;f<r;f++)for(let h=0;h<n;h++)for(let p=0;p<s;p++)a.set(n*l+h,s*f+p,this.get(l,f)*t.get(h,p));return a}kroneckerSum(t){if(t=pt.checkMatrix(t),!this.isSquare()||!t.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let e=this.rows,r=t.rows,n=this.kroneckerProduct(pt.eye(r,r)),s=pt.eye(e,e).kroneckerProduct(t);return n.add(s)}transpose(){let t=new pt(this.columns,this.rows);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.set(r,e,this.get(e,r));return t}sortRows(t=$c){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=$c){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,r,n){Ia(this,t,e,r,n);let s=new pt(e-t+1,n-r+1);for(let a=t;a<=e;a++)for(let l=r;l<=n;l++)s.set(a-t,l-r,this.get(a,l));return s}subMatrixRow(t,e,r){if(e===void 0&&(e=0),r===void 0&&(r=this.columns-1),e>r||e<0||e>=this.columns||r<0||r>=this.columns)throw new RangeError("Argument out of range");let n=new pt(t.length,r-e+1);for(let s=0;s<t.length;s++)for(let a=e;a<=r;a++){if(t[s]<0||t[s]>=this.rows)throw new RangeError(`Row index out of range: ${t[s]}`);n.set(s,a-e,this.get(t[s],a))}return n}subMatrixColumn(t,e,r){if(e===void 0&&(e=0),r===void 0&&(r=this.rows-1),e>r||e<0||e>=this.rows||r<0||r>=this.rows)throw new RangeError("Argument out of range");let n=new pt(r-e+1,t.length);for(let s=0;s<t.length;s++)for(let a=e;a<=r;a++){if(t[s]<0||t[s]>=this.columns)throw new RangeError(`Column index out of range: ${t[s]}`);n.set(a-e,s,this.get(a,t[s]))}return n}setSubMatrix(t,e,r){if(t=pt.checkMatrix(t),t.isEmpty())return this;let n=e+t.rows-1,s=r+t.columns-1;Ia(this,e,n,r,s);for(let a=0;a<t.rows;a++)for(let l=0;l<t.columns;l++)this.set(e+a,r+l,t.get(a,l));return this}selection(t,e){Ba(this,t),Ta(this,e);let r=new pt(t.length,e.length);for(let n=0;n<t.length;n++){let s=t[n];for(let a=0;a<e.length;a++){let l=e[a];r.set(n,a,this.get(s,l))}}return r}trace(){let t=Math.min(this.rows,this.columns),e=0;for(let r=0;r<t;r++)e+=this.get(r,r);return e}clone(){return this.constructor.copy(this,new pt(this.rows,this.columns))}static copy(t,e){for(const[r,n,s]of t.entries())e.set(r,n,s);return e}sum(t){switch(t){case"row":return E1(this);case"column":return x1(this);case void 0:return A1(this);default:throw new Error(`invalid option: ${t}`)}}product(t){switch(t){case"row":return C1(this);case"column":return F1(this);case void 0:return M1(this);default:throw new Error(`invalid option: ${t}`)}}mean(t){const e=this.sum(t);switch(t){case"row":{for(let r=0;r<this.rows;r++)e[r]/=this.columns;return e}case"column":{for(let r=0;r<this.columns;r++)e[r]/=this.rows;return e}case void 0:return e/this.size;default:throw new Error(`invalid option: ${t}`)}}variance(t,e={}){if(typeof t=="object"&&(e=t,t=void 0),typeof e!="object")throw new TypeError("options must be an object");const{unbiased:r=!0,mean:n=this.mean(t)}=e;if(typeof r!="boolean")throw new TypeError("unbiased must be a boolean");switch(t){case"row":{if(!Qe.isAnyArray(n))throw new TypeError("mean must be an array");return N1(this,r,n)}case"column":{if(!Qe.isAnyArray(n))throw new TypeError("mean must be an array");return S1(this,r,n)}case void 0:{if(typeof n!="number")throw new TypeError("mean must be a number");return B1(this,r,n)}default:throw new Error(`invalid option: ${t}`)}}standardDeviation(t,e){typeof t=="object"&&(e=t,t=void 0);const r=this.variance(t,e);if(t===void 0)return Math.sqrt(r);for(let n=0;n<r.length;n++)r[n]=Math.sqrt(r[n]);return r}center(t,e={}){if(typeof t=="object"&&(e=t,t=void 0),typeof e!="object")throw new TypeError("options must be an object");const{center:r=this.mean(t)}=e;switch(t){case"row":{if(!Qe.isAnyArray(r))throw new TypeError("center must be an array");return T1(this,r),this}case"column":{if(!Qe.isAnyArray(r))throw new TypeError("center must be an array");return I1(this,r),this}case void 0:{if(typeof r!="number")throw new TypeError("center must be a number");return O1(this,r),this}default:throw new Error(`invalid option: ${t}`)}}scale(t,e={}){if(typeof t=="object"&&(e=t,t=void 0),typeof e!="object")throw new TypeError("options must be an object");let r=e.scale;switch(t){case"row":{if(r===void 0)r=$1(this);else if(!Qe.isAnyArray(r))throw new TypeError("scale must be an array");return L1(this,r),this}case"column":{if(r===void 0)r=R1(this);else if(!Qe.isAnyArray(r))throw new TypeError("scale must be an array");return P1(this,r),this}case void 0:{if(r===void 0)r=z1(this);else if(typeof r!="number")throw new TypeError("scale must be a number");return q1(this,r),this}default:throw new Error(`invalid option: ${t}`)}}toString(t){return Ic(this,t)}[Symbol.iterator](){return this.entries()}*entries(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield[t,e,this.get(t,e)]}*values(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield this.get(t,e)}}$t.prototype.klass="Matrix",typeof Symbol<"u"&&($t.prototype[Symbol.for("nodejs.util.inspect.custom")]=w1);function $c(i,t){return i-t}function k1(i){return i.every(t=>typeof t=="number")}$t.random=$t.rand,$t.randomInt=$t.randInt,$t.diagonal=$t.diag,$t.prototype.diagonal=$t.prototype.diag,$t.identity=$t.eye,$t.prototype.negate=$t.prototype.neg,$t.prototype.tensorProduct=$t.prototype.kroneckerProduct;let pt=(bi=class extends $t{constructor(e,r){super();Dl(this,Vi);z(this,"data");if(bi.isMatrix(e))bl(this,Vi,El).call(this,e.rows,e.columns),bi.copy(e,this);else if(Number.isInteger(e)&&e>=0)bl(this,Vi,El).call(this,e,r);else if(Qe.isAnyArray(e)){const n=e;if(e=n.length,r=e?n[0].length:0,typeof r!="number")throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let s=0;s<e;s++){if(n[s].length!==r)throw new RangeError("Inconsistent array dimensions");if(!k1(n[s]))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(n[s]))}this.rows=e,this.columns=r}else throw new TypeError("First argument must be a positive number or an array")}set(e,r,n){return this.data[e][r]=n,this}get(e,r){return this.data[e][r]}removeRow(e){return yr(this,e),this.data.splice(e,1),this.rows-=1,this}addRow(e,r){return r===void 0&&(r=e,e=this.rows),yr(this,e,!0),r=Float64Array.from(_i(this,r)),this.data.splice(e,0,r),this.rows+=1,this}removeColumn(e){Dr(this,e);for(let r=0;r<this.rows;r++){const n=new Float64Array(this.columns-1);for(let s=0;s<e;s++)n[s]=this.data[r][s];for(let s=e+1;s<this.columns;s++)n[s-1]=this.data[r][s];this.data[r]=n}return this.columns-=1,this}addColumn(e,r){typeof r>"u"&&(r=e,e=this.columns),Dr(this,e,!0),r=mi(this,r);for(let n=0;n<this.rows;n++){const s=new Float64Array(this.columns+1);let a=0;for(;a<e;a++)s[a]=this.data[n][a];for(s[a++]=r[n];a<this.columns+1;a++)s[a]=this.data[n][a-1];this.data[n]=s}return this.columns+=1,this}},Vi=new WeakSet,El=function(e,r){if(this.data=[],Number.isInteger(r)&&r>=0)for(let n=0;n<e;n++)this.data.push(new Float64Array(r));else throw new TypeError("nColumns must be a positive integer");this.rows=e,this.columns=r},bi);b1($t,pt);const fo=class fo extends $t{constructor(e){super();Dl(this,We,void 0);if(pt.isMatrix(e)){if(!e.isSymmetric())throw new TypeError("not symmetric data");ra(this,We,pt.copy(e,new pt(e.rows,e.rows)))}else if(Number.isInteger(e)&&e>=0)ra(this,We,new pt(e,e));else if(ra(this,We,new pt(e)),!this.isSymmetric())throw new TypeError("not symmetric data")}get size(){return kr(this,We).size}get rows(){return kr(this,We).rows}get columns(){return kr(this,We).columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(e){return pt.isMatrix(e)&&e.klassType==="SymmetricMatrix"}static zeros(e){return new this(e)}static ones(e){return new this(e).fill(1)}clone(){const e=new fo(this.diagonalSize);for(const[r,n,s]of this.upperRightEntries())e.set(r,n,s);return e}toMatrix(){return new pt(this)}get(e,r){return kr(this,We).get(e,r)}set(e,r,n){return kr(this,We).set(e,r,n),kr(this,We).set(r,e,n),this}removeCross(e){return kr(this,We).removeRow(e),kr(this,We).removeColumn(e),this}addCross(e,r){r===void 0&&(r=e,e=this.diagonalSize);const n=r.slice();return n.splice(e,1),kr(this,We).addRow(e,n),kr(this,We).addColumn(e,r),this}applyMask(e){if(e.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const r=[];for(const[n,s]of e.entries())s||r.push(n);r.reverse();for(const n of r)this.removeCross(n);return this}toCompact(){const{diagonalSize:e}=this,r=new Array(e*(e+1)/2);for(let n=0,s=0,a=0;a<r.length;a++)r[a]=this.get(s,n),++n>=e&&(n=++s);return r}static fromCompact(e){const r=e.length,n=(Math.sqrt(8*r+1)-1)/2;if(!Number.isInteger(n))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(e)}`);const s=new fo(n);for(let a=0,l=0,f=0;f<r;f++)s.set(a,l,e[f]),++a>=n&&(a=++l);return s}*upperRightEntries(){for(let e=0,r=0;e<this.diagonalSize;void 0){const n=this.get(e,r);yield[e,r,n],++r>=this.diagonalSize&&(r=++e)}}*upperRightValues(){for(let e=0,r=0;e<this.diagonalSize;void 0)yield this.get(e,r),++r>=this.diagonalSize&&(r=++e)}};We=new WeakMap;let Yn=fo;Yn.prototype.klassType="SymmetricMatrix";class Qs extends Yn{static isDistanceMatrix(t){return Yn.isSymmetricMatrix(t)&&t.klassSubType==="DistanceMatrix"}constructor(t){if(super(t),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(t,e,r){return t===e&&(r=0),super.set(t,e,r)}addCross(t,e){return e===void 0&&(e=t,t=this.diagonalSize),e=e.slice(),e[t]=0,super.addCross(t,e)}toSymmetricMatrix(){return new Yn(this)}clone(){const t=new Qs(this.diagonalSize);for(const[e,r,n]of this.upperRightEntries())e!==r&&t.set(e,r,n);return t}toCompact(){const{diagonalSize:t}=this,e=(t-1)*t/2,r=new Array(e);for(let n=1,s=0,a=0;a<r.length;a++)r[a]=this.get(s,n),++n>=t&&(n=++s+1);return r}static fromCompact(t){const e=t.length,r=(Math.sqrt(8*e+1)+1)/2;if(!Number.isInteger(r))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(t)}`);const n=new this(r);for(let s=1,a=0,l=0;l<e;l++)n.set(s,a,t[l]),++s>=r&&(s=++a+1);return n}}Qs.prototype.klassSubType="DistanceMatrix";class tn extends $t{constructor(t,e,r){super(),this.matrix=t,this.rows=e,this.columns=r}}class U1 extends tn{constructor(t,e){Dr(t,e),super(t,t.rows,1),this.column=e}set(t,e,r){return this.matrix.set(t,this.column,r),this}get(t){return this.matrix.get(t,this.column)}}class W1 extends tn{constructor(t,e){Ta(t,e),super(t,t.rows,e.length),this.columnIndices=e}set(t,e,r){return this.matrix.set(t,this.columnIndices[e],r),this}get(t,e){return this.matrix.get(t,this.columnIndices[e])}}class j1 extends tn{constructor(t){super(t,t.rows,t.columns)}set(t,e,r){return this.matrix.set(t,this.columns-e-1,r),this}get(t,e){return this.matrix.get(t,this.columns-e-1)}}class Y1 extends tn{constructor(t){super(t,t.rows,t.columns)}set(t,e,r){return this.matrix.set(this.rows-t-1,e,r),this}get(t,e){return this.matrix.get(this.rows-t-1,e)}}class Z1 extends tn{constructor(t,e){yr(t,e),super(t,1,t.columns),this.row=e}set(t,e,r){return this.matrix.set(this.row,e,r),this}get(t,e){return this.matrix.get(this.row,e)}}class G1 extends tn{constructor(t,e){Ba(t,e),super(t,e.length,t.columns),this.rowIndices=e}set(t,e,r){return this.matrix.set(this.rowIndices[t],e,r),this}get(t,e){return this.matrix.get(this.rowIndices[t],e)}}class to extends tn{constructor(t,e,r){Ba(t,e),Ta(t,r),super(t,e.length,r.length),this.rowIndices=e,this.columnIndices=r}set(t,e,r){return this.matrix.set(this.rowIndices[t],this.columnIndices[e],r),this}get(t,e){return this.matrix.get(this.rowIndices[t],this.columnIndices[e])}}class K1 extends tn{constructor(t,e,r,n,s){Ia(t,e,r,n,s),super(t,r-e+1,s-n+1),this.startRow=e,this.startColumn=n}set(t,e,r){return this.matrix.set(this.startRow+t,this.startColumn+e,r),this}get(t,e){return this.matrix.get(this.startRow+t,this.startColumn+e)}}class H1 extends tn{constructor(t){super(t,t.columns,t.rows)}set(t,e,r){return this.matrix.set(e,t,r),this}get(t,e){return this.matrix.get(e,t)}}class Lc extends $t{constructor(t,e={}){const{rows:r=1}=e;if(t.length%r!==0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=r,this.columns=t.length/r,this.data=t}set(t,e,r){let n=this._calculateIndex(t,e);return this.data[n]=r,this}get(t,e){let r=this._calculateIndex(t,e);return this.data[r]}_calculateIndex(t,e){return t*this.columns+e}}class ar extends $t{constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}}function J1(i,t){if(Qe.isAnyArray(i))return i[0]&&Qe.isAnyArray(i[0])?new ar(i):new Lc(i,t);throw new Error("the argument is not an array")}class eo{constructor(t){t=ar.checkMatrix(t);let e=t.clone(),r=e.rows,n=e.columns,s=new Float64Array(r),a=1,l,f,h,p,c,d,g,w,m;for(l=0;l<r;l++)s[l]=l;for(w=new Float64Array(r),f=0;f<n;f++){for(l=0;l<r;l++)w[l]=e.get(l,f);for(l=0;l<r;l++){for(m=Math.min(l,f),c=0,h=0;h<m;h++)c+=e.get(l,h)*w[h];w[l]-=c,e.set(l,f,w[l])}for(p=f,l=f+1;l<r;l++)Math.abs(w[l])>Math.abs(w[p])&&(p=l);if(p!==f){for(h=0;h<n;h++)d=e.get(p,h),e.set(p,h,e.get(f,h)),e.set(f,h,d);g=s[p],s[p]=s[f],s[f]=g,a=-a}if(f<r&&e.get(f,f)!==0)for(l=f+1;l<r;l++)e.set(l,f,e.get(l,f)/e.get(f,f))}this.LU=e,this.pivotVector=s,this.pivotSign=a}isSingular(){let t=this.LU,e=t.columns;for(let r=0;r<e;r++)if(t.get(r,r)===0)return!0;return!1}solve(t){t=pt.checkMatrix(t);let e=this.LU;if(e.rows!==t.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let n=t.columns,s=t.subMatrixRow(this.pivotVector,0,n-1),a=e.columns,l,f,h;for(h=0;h<a;h++)for(l=h+1;l<a;l++)for(f=0;f<n;f++)s.set(l,f,s.get(l,f)-s.get(h,f)*e.get(l,h));for(h=a-1;h>=0;h--){for(f=0;f<n;f++)s.set(h,f,s.get(h,f)/e.get(h,h));for(l=0;l<h;l++)for(f=0;f<n;f++)s.set(l,f,s.get(l,f)-s.get(h,f)*e.get(l,h))}return s}get determinant(){let t=this.LU;if(!t.isSquare())throw new Error("Matrix must be square");let e=this.pivotSign,r=t.columns;for(let n=0;n<r;n++)e*=t.get(n,n);return e}get lowerTriangularMatrix(){let t=this.LU,e=t.rows,r=t.columns,n=new pt(e,r);for(let s=0;s<e;s++)for(let a=0;a<r;a++)s>a?n.set(s,a,t.get(s,a)):s===a?n.set(s,a,1):n.set(s,a,0);return n}get upperTriangularMatrix(){let t=this.LU,e=t.rows,r=t.columns,n=new pt(e,r);for(let s=0;s<e;s++)for(let a=0;a<r;a++)s<=a?n.set(s,a,t.get(s,a)):n.set(s,a,0);return n}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function en(i,t){let e=0;return Math.abs(i)>Math.abs(t)?(e=t/i,Math.abs(i)*Math.sqrt(1+e*e)):t!==0?(e=i/t,Math.abs(t)*Math.sqrt(1+e*e)):0}class Oa{constructor(t){t=ar.checkMatrix(t);let e=t.clone(),r=t.rows,n=t.columns,s=new Float64Array(n),a,l,f,h;for(f=0;f<n;f++){let p=0;for(a=f;a<r;a++)p=en(p,e.get(a,f));if(p!==0){for(e.get(f,f)<0&&(p=-p),a=f;a<r;a++)e.set(a,f,e.get(a,f)/p);for(e.set(f,f,e.get(f,f)+1),l=f+1;l<n;l++){for(h=0,a=f;a<r;a++)h+=e.get(a,f)*e.get(a,l);for(h=-h/e.get(f,f),a=f;a<r;a++)e.set(a,l,e.get(a,l)+h*e.get(a,f))}}s[f]=-p}this.QR=e,this.Rdiag=s}solve(t){t=pt.checkMatrix(t);let e=this.QR,r=e.rows;if(t.rows!==r)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let n=t.columns,s=t.clone(),a=e.columns,l,f,h,p;for(h=0;h<a;h++)for(f=0;f<n;f++){for(p=0,l=h;l<r;l++)p+=e.get(l,h)*s.get(l,f);for(p=-p/e.get(h,h),l=h;l<r;l++)s.set(l,f,s.get(l,f)+p*e.get(l,h))}for(h=a-1;h>=0;h--){for(f=0;f<n;f++)s.set(h,f,s.get(h,f)/this.Rdiag[h]);for(l=0;l<h;l++)for(f=0;f<n;f++)s.set(l,f,s.get(l,f)-s.get(h,f)*e.get(l,h))}return s.subMatrix(0,a-1,0,n-1)}isFullRank(){let t=this.QR.columns;for(let e=0;e<t;e++)if(this.Rdiag[e]===0)return!1;return!0}get upperTriangularMatrix(){let t=this.QR,e=t.columns,r=new pt(e,e),n,s;for(n=0;n<e;n++)for(s=0;s<e;s++)n<s?r.set(n,s,t.get(n,s)):n===s?r.set(n,s,this.Rdiag[n]):r.set(n,s,0);return r}get orthogonalMatrix(){let t=this.QR,e=t.rows,r=t.columns,n=new pt(e,r),s,a,l,f;for(l=r-1;l>=0;l--){for(s=0;s<e;s++)n.set(s,l,0);for(n.set(l,l,1),a=l;a<r;a++)if(t.get(l,l)!==0){for(f=0,s=l;s<e;s++)f+=t.get(s,l)*n.get(s,a);for(f=-f/t.get(l,l),s=l;s<e;s++)n.set(s,a,n.get(s,a)+f*t.get(s,l))}}return n}}class vi{constructor(t,e={}){if(t=ar.checkMatrix(t),t.isEmpty())throw new Error("Matrix must be non-empty");let r=t.rows,n=t.columns;const{computeLeftSingularVectors:s=!0,computeRightSingularVectors:a=!0,autoTranspose:l=!1}=e;let f=!!s,h=!!a,p=!1,c;if(r<n)if(!l)c=t.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else{c=t.transpose(),r=c.rows,n=c.columns,p=!0;let C=f;f=h,h=C}else c=t.clone();let d=Math.min(r,n),g=Math.min(r+1,n),w=new Float64Array(g),m=new pt(r,d),D=new pt(n,n),v=new Float64Array(n),E=new Float64Array(r),b=new Float64Array(g);for(let C=0;C<g;C++)b[C]=C;let N=Math.min(r-1,n),x=Math.max(0,Math.min(n-2,r)),F=Math.max(N,x);for(let C=0;C<F;C++){if(C<N){w[C]=0;for(let T=C;T<r;T++)w[C]=en(w[C],c.get(T,C));if(w[C]!==0){c.get(C,C)<0&&(w[C]=-w[C]);for(let T=C;T<r;T++)c.set(T,C,c.get(T,C)/w[C]);c.set(C,C,c.get(C,C)+1)}w[C]=-w[C]}for(let T=C+1;T<n;T++){if(C<N&&w[C]!==0){let L=0;for(let U=C;U<r;U++)L+=c.get(U,C)*c.get(U,T);L=-L/c.get(C,C);for(let U=C;U<r;U++)c.set(U,T,c.get(U,T)+L*c.get(U,C))}v[T]=c.get(C,T)}if(f&&C<N)for(let T=C;T<r;T++)m.set(T,C,c.get(T,C));if(C<x){v[C]=0;for(let T=C+1;T<n;T++)v[C]=en(v[C],v[T]);if(v[C]!==0){v[C+1]<0&&(v[C]=0-v[C]);for(let T=C+1;T<n;T++)v[T]/=v[C];v[C+1]+=1}if(v[C]=-v[C],C+1<r&&v[C]!==0){for(let T=C+1;T<r;T++)E[T]=0;for(let T=C+1;T<r;T++)for(let L=C+1;L<n;L++)E[T]+=v[L]*c.get(T,L);for(let T=C+1;T<n;T++){let L=-v[T]/v[C+1];for(let U=C+1;U<r;U++)c.set(U,T,c.get(U,T)+L*E[U])}}if(h)for(let T=C+1;T<n;T++)D.set(T,C,v[T])}}let M=Math.min(n,r+1);if(N<n&&(w[N]=c.get(N,N)),r<M&&(w[M-1]=0),x+1<M&&(v[x]=c.get(x,M-1)),v[M-1]=0,f){for(let C=N;C<d;C++){for(let T=0;T<r;T++)m.set(T,C,0);m.set(C,C,1)}for(let C=N-1;C>=0;C--)if(w[C]!==0){for(let T=C+1;T<d;T++){let L=0;for(let U=C;U<r;U++)L+=m.get(U,C)*m.get(U,T);L=-L/m.get(C,C);for(let U=C;U<r;U++)m.set(U,T,m.get(U,T)+L*m.get(U,C))}for(let T=C;T<r;T++)m.set(T,C,-m.get(T,C));m.set(C,C,1+m.get(C,C));for(let T=0;T<C-1;T++)m.set(T,C,0)}else{for(let T=0;T<r;T++)m.set(T,C,0);m.set(C,C,1)}}if(h)for(let C=n-1;C>=0;C--){if(C<x&&v[C]!==0)for(let T=C+1;T<n;T++){let L=0;for(let U=C+1;U<n;U++)L+=D.get(U,C)*D.get(U,T);L=-L/D.get(C+1,C);for(let U=C+1;U<n;U++)D.set(U,T,D.get(U,T)+L*D.get(U,C))}for(let T=0;T<n;T++)D.set(T,C,0);D.set(C,C,1)}let S=M-1,O=Number.EPSILON;for(;M>0;){let C,T;for(C=M-2;C>=-1&&C!==-1;C--){const L=Number.MIN_VALUE+O*Math.abs(w[C]+Math.abs(w[C+1]));if(Math.abs(v[C])<=L||Number.isNaN(v[C])){v[C]=0;break}}if(C===M-2)T=4;else{let L;for(L=M-1;L>=C&&L!==C;L--){let U=(L!==M?Math.abs(v[L]):0)+(L!==C+1?Math.abs(v[L-1]):0);if(Math.abs(w[L])<=O*U){w[L]=0;break}}L===C?T=3:L===M-1?T=1:(T=2,C=L)}switch(C++,T){case 1:{let L=v[M-2];v[M-2]=0;for(let U=M-2;U>=C;U--){let k=en(w[U],L),W=w[U]/k,P=L/k;if(w[U]=k,U!==C&&(L=-P*v[U-1],v[U-1]=W*v[U-1]),h)for(let K=0;K<n;K++)k=W*D.get(K,U)+P*D.get(K,M-1),D.set(K,M-1,-P*D.get(K,U)+W*D.get(K,M-1)),D.set(K,U,k)}break}case 2:{let L=v[C-1];v[C-1]=0;for(let U=C;U<M;U++){let k=en(w[U],L),W=w[U]/k,P=L/k;if(w[U]=k,L=-P*v[U],v[U]=W*v[U],f)for(let K=0;K<r;K++)k=W*m.get(K,U)+P*m.get(K,C-1),m.set(K,C-1,-P*m.get(K,U)+W*m.get(K,C-1)),m.set(K,U,k)}break}case 3:{const L=Math.max(Math.abs(w[M-1]),Math.abs(w[M-2]),Math.abs(v[M-2]),Math.abs(w[C]),Math.abs(v[C])),U=w[M-1]/L,k=w[M-2]/L,W=v[M-2]/L,P=w[C]/L,K=v[C]/L,G=((k+U)*(k-U)+W*W)/2,V=U*W*(U*W);let tt=0;(G!==0||V!==0)&&(G<0?tt=0-Math.sqrt(G*G+V):tt=Math.sqrt(G*G+V),tt=V/(G+tt));let ft=(P+U)*(P-U)+tt,vt=P*K;for(let lt=C;lt<M-1;lt++){let yt=en(ft,vt);yt===0&&(yt=Number.MIN_VALUE);let bt=ft/yt,Bt=vt/yt;if(lt!==C&&(v[lt-1]=yt),ft=bt*w[lt]+Bt*v[lt],v[lt]=bt*v[lt]-Bt*w[lt],vt=Bt*w[lt+1],w[lt+1]=bt*w[lt+1],h)for(let Et=0;Et<n;Et++)yt=bt*D.get(Et,lt)+Bt*D.get(Et,lt+1),D.set(Et,lt+1,-Bt*D.get(Et,lt)+bt*D.get(Et,lt+1)),D.set(Et,lt,yt);if(yt=en(ft,vt),yt===0&&(yt=Number.MIN_VALUE),bt=ft/yt,Bt=vt/yt,w[lt]=yt,ft=bt*v[lt]+Bt*w[lt+1],w[lt+1]=-Bt*v[lt]+bt*w[lt+1],vt=Bt*v[lt+1],v[lt+1]=bt*v[lt+1],f&<<r-1)for(let Et=0;Et<r;Et++)yt=bt*m.get(Et,lt)+Bt*m.get(Et,lt+1),m.set(Et,lt+1,-Bt*m.get(Et,lt)+bt*m.get(Et,lt+1)),m.set(Et,lt,yt)}v[M-2]=ft;break}case 4:{if(w[C]<=0&&(w[C]=w[C]<0?-w[C]:0,h))for(let L=0;L<=S;L++)D.set(L,C,-D.get(L,C));for(;C<S&&!(w[C]>=w[C+1]);){let L=w[C];if(w[C]=w[C+1],w[C+1]=L,h&&C<n-1)for(let U=0;U<n;U++)L=D.get(U,C+1),D.set(U,C+1,D.get(U,C)),D.set(U,C,L);if(f&&C<r-1)for(let U=0;U<r;U++)L=m.get(U,C+1),m.set(U,C+1,m.get(U,C)),m.set(U,C,L);C++}M--;break}}}if(p){let C=D;D=m,m=C}this.m=r,this.n=n,this.s=w,this.U=m,this.V=D}solve(t){let e=t,r=this.threshold,n=this.s.length,s=pt.zeros(n,n);for(let d=0;d<n;d++)Math.abs(this.s[d])<=r?s.set(d,d,0):s.set(d,d,1/this.s[d]);let a=this.U,l=this.rightSingularVectors,f=l.mmul(s),h=l.rows,p=a.rows,c=pt.zeros(h,p);for(let d=0;d<h;d++)for(let g=0;g<p;g++){let w=0;for(let m=0;m<n;m++)w+=f.get(d,m)*a.get(g,m);c.set(d,g,w)}return c.mmul(e)}solveForDiagonal(t){return this.solve(pt.diag(t))}inverse(){let t=this.V,e=this.threshold,r=t.rows,n=t.columns,s=new pt(r,this.s.length);for(let p=0;p<r;p++)for(let c=0;c<n;c++)Math.abs(this.s[c])>e&&s.set(p,c,t.get(p,c)/this.s[c]);let a=this.U,l=a.rows,f=a.columns,h=new pt(r,l);for(let p=0;p<r;p++)for(let c=0;c<l;c++){let d=0;for(let g=0;g<f;g++)d+=s.get(p,g)*a.get(c,g);h.set(p,c,d)}return h}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,e=0,r=this.s;for(let n=0,s=r.length;n<s;n++)r[n]>t&&e++;return e}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return pt.diag(this.s)}}function X1(i,t=!1){return i=ar.checkMatrix(i),t?new vi(i).inverse():Rc(i,pt.eye(i.rows))}function Rc(i,t,e=!1){return i=ar.checkMatrix(i),t=ar.checkMatrix(t),e?new vi(i).solve(t):i.isSquare()?new eo(i).solve(t):new Oa(i).solve(t)}function ro(i){if(i=pt.checkMatrix(i),i.isSquare()){if(i.columns===0)return 1;let t,e,r,n;if(i.columns===2)return t=i.get(0,0),e=i.get(0,1),r=i.get(1,0),n=i.get(1,1),t*n-e*r;if(i.columns===3){let s,a,l;return s=new to(i,[1,2],[1,2]),a=new to(i,[1,2],[0,2]),l=new to(i,[1,2],[0,1]),t=i.get(0,0),e=i.get(0,1),r=i.get(0,2),t*ro(s)-e*ro(a)+r*ro(l)}else return new eo(i).determinant}else throw Error("determinant can only be calculated for a square matrix")}function V1(i,t){let e=[];for(let r=0;r<i;r++)r!==t&&e.push(r);return e}function Q1(i,t,e,r=1e-9,n=1e-9){if(i>n)return new Array(t.rows+1).fill(0);{let s=t.addRow(e,[0]);for(let a=0;a<s.rows;a++)Math.abs(s.get(a,0))<r&&s.set(a,0,0);return s.to1DArray()}}function tw(i,t={}){const{thresholdValue:e=1e-9,thresholdError:r=1e-9}=t;i=pt.checkMatrix(i);let n=i.rows,s=new pt(n,n);for(let a=0;a<n;a++){let l=pt.columnVector(i.getRow(a)),f=i.subMatrixRow(V1(n,a)).transpose(),p=new vi(f).solve(l),c=pt.sub(l,f.mmul(p)).abs().max();s.setRow(a,Q1(c,p,a,e,r))}return s}function ew(i,t=Number.EPSILON){if(i=pt.checkMatrix(i),i.isEmpty())return i.transpose();let e=new vi(i,{autoTranspose:!0}),r=e.leftSingularVectors,n=e.rightSingularVectors,s=e.diagonal;for(let a=0;a<s.length;a++)Math.abs(s[a])>t?s[a]=1/s[a]:s[a]=0;return n.mmul(pt.diag(s).mmul(r.transpose()))}function rw(i,t=i,e={}){i=new pt(i);let r=!1;if(typeof t=="object"&&!pt.isMatrix(t)&&!Qe.isAnyArray(t)?(e=t,t=i,r=!0):t=new pt(t),i.rows!==t.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:n=!0}=e;n&&(i=i.center("column"),r||(t=t.center("column")));const s=i.transpose().mmul(t);for(let a=0;a<s.rows;a++)for(let l=0;l<s.columns;l++)s.set(a,l,s.get(a,l)*(1/(i.rows-1)));return s}function nw(i,t=i,e={}){i=new pt(i);let r=!1;if(typeof t=="object"&&!pt.isMatrix(t)&&!Qe.isAnyArray(t)?(e=t,t=i,r=!0):t=new pt(t),i.rows!==t.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:n=!0,scale:s=!0}=e;n&&(i.center("column"),r||t.center("column")),s&&(i.scale("column"),r||t.scale("column"));const a=i.standardDeviation("column",{unbiased:!0}),l=r?a:t.standardDeviation("column",{unbiased:!0}),f=i.transpose().mmul(t);for(let h=0;h<f.rows;h++)for(let p=0;p<f.columns;p++)f.set(h,p,f.get(h,p)*(1/(a[h]*l[p]))*(1/(i.rows-1)));return f}let Pc=class{constructor(t,e={}){const{assumeSymmetric:r=!1}=e;if(t=ar.checkMatrix(t),!t.isSquare())throw new Error("Matrix is not a square matrix");if(t.isEmpty())throw new Error("Matrix must be non-empty");let n=t.columns,s=new pt(n,n),a=new Float64Array(n),l=new Float64Array(n),f=t,h,p,c=!1;if(r?c=!0:c=t.isSymmetric(),c){for(h=0;h<n;h++)for(p=0;p<n;p++)s.set(h,p,f.get(h,p));iw(n,l,a,s),sw(n,l,a,s)}else{let d=new pt(n,n),g=new Float64Array(n);for(p=0;p<n;p++)for(h=0;h<n;h++)d.set(h,p,f.get(h,p));ow(n,d,g,s),aw(n,l,a,s,d)}this.n=n,this.e=l,this.d=a,this.V=s}get realEigenvalues(){return Array.from(this.d)}get imaginaryEigenvalues(){return Array.from(this.e)}get eigenvectorMatrix(){return this.V}get diagonalMatrix(){let t=this.n,e=this.e,r=this.d,n=new pt(t,t),s,a;for(s=0;s<t;s++){for(a=0;a<t;a++)n.set(s,a,0);n.set(s,s,r[s]),e[s]>0?n.set(s,s+1,e[s]):e[s]<0&&n.set(s,s-1,e[s])}return n}};function iw(i,t,e,r){let n,s,a,l,f,h,p,c;for(f=0;f<i;f++)e[f]=r.get(i-1,f);for(l=i-1;l>0;l--){for(c=0,a=0,h=0;h<l;h++)c=c+Math.abs(e[h]);if(c===0)for(t[l]=e[l-1],f=0;f<l;f++)e[f]=r.get(l-1,f),r.set(l,f,0),r.set(f,l,0);else{for(h=0;h<l;h++)e[h]/=c,a+=e[h]*e[h];for(n=e[l-1],s=Math.sqrt(a),n>0&&(s=-s),t[l]=c*s,a=a-n*s,e[l-1]=n-s,f=0;f<l;f++)t[f]=0;for(f=0;f<l;f++){for(n=e[f],r.set(f,l,n),s=t[f]+r.get(f,f)*n,h=f+1;h<=l-1;h++)s+=r.get(h,f)*e[h],t[h]+=r.get(h,f)*n;t[f]=s}for(n=0,f=0;f<l;f++)t[f]/=a,n+=t[f]*e[f];for(p=n/(a+a),f=0;f<l;f++)t[f]-=p*e[f];for(f=0;f<l;f++){for(n=e[f],s=t[f],h=f;h<=l-1;h++)r.set(h,f,r.get(h,f)-(n*t[h]+s*e[h]));e[f]=r.get(l-1,f),r.set(l,f,0)}}e[l]=a}for(l=0;l<i-1;l++){if(r.set(i-1,l,r.get(l,l)),r.set(l,l,1),a=e[l+1],a!==0){for(h=0;h<=l;h++)e[h]=r.get(h,l+1)/a;for(f=0;f<=l;f++){for(s=0,h=0;h<=l;h++)s+=r.get(h,l+1)*r.get(h,f);for(h=0;h<=l;h++)r.set(h,f,r.get(h,f)-s*e[h])}}for(h=0;h<=l;h++)r.set(h,l+1,0)}for(f=0;f<i;f++)e[f]=r.get(i-1,f),r.set(i-1,f,0);r.set(i-1,i-1,1),t[0]=0}function sw(i,t,e,r){let n,s,a,l,f,h,p,c,d,g,w,m,D,v,E,b;for(a=1;a<i;a++)t[a-1]=t[a];t[i-1]=0;let N=0,x=0,F=Number.EPSILON;for(h=0;h<i;h++){for(x=Math.max(x,Math.abs(e[h])+Math.abs(t[h])),p=h;p<i&&!(Math.abs(t[p])<=F*x);)p++;if(p>h)do{for(n=e[h],c=(e[h+1]-n)/(2*t[h]),d=en(c,1),c<0&&(d=-d),e[h]=t[h]/(c+d),e[h+1]=t[h]*(c+d),g=e[h+1],s=n-e[h],a=h+2;a<i;a++)e[a]-=s;for(N=N+s,c=e[p],w=1,m=w,D=w,v=t[h+1],E=0,b=0,a=p-1;a>=h;a--)for(D=m,m=w,b=E,n=w*t[a],s=w*c,d=en(c,t[a]),t[a+1]=E*d,E=t[a]/d,w=c/d,c=w*e[a]-E*n,e[a+1]=s+E*(w*n+E*e[a]),f=0;f<i;f++)s=r.get(f,a+1),r.set(f,a+1,E*r.get(f,a)+w*s),r.set(f,a,w*r.get(f,a)-E*s);c=-E*b*D*v*t[h]/g,t[h]=E*c,e[h]=w*c}while(Math.abs(t[h])>F*x);e[h]=e[h]+N,t[h]=0}for(a=0;a<i-1;a++){for(f=a,c=e[a],l=a+1;l<i;l++)e[l]<c&&(f=l,c=e[l]);if(f!==a)for(e[f]=e[a],e[a]=c,l=0;l<i;l++)c=r.get(l,a),r.set(l,a,r.get(l,f)),r.set(l,f,c)}}function ow(i,t,e,r){let n=0,s=i-1,a,l,f,h,p,c,d;for(c=n+1;c<=s-1;c++){for(d=0,h=c;h<=s;h++)d=d+Math.abs(t.get(h,c-1));if(d!==0){for(f=0,h=s;h>=c;h--)e[h]=t.get(h,c-1)/d,f+=e[h]*e[h];for(l=Math.sqrt(f),e[c]>0&&(l=-l),f=f-e[c]*l,e[c]=e[c]-l,p=c;p<i;p++){for(a=0,h=s;h>=c;h--)a+=e[h]*t.get(h,p);for(a=a/f,h=c;h<=s;h++)t.set(h,p,t.get(h,p)-a*e[h])}for(h=0;h<=s;h++){for(a=0,p=s;p>=c;p--)a+=e[p]*t.get(h,p);for(a=a/f,p=c;p<=s;p++)t.set(h,p,t.get(h,p)-a*e[p])}e[c]=d*e[c],t.set(c,c-1,d*l)}}for(h=0;h<i;h++)for(p=0;p<i;p++)r.set(h,p,h===p?1:0);for(c=s-1;c>=n+1;c--)if(t.get(c,c-1)!==0){for(h=c+1;h<=s;h++)e[h]=t.get(h,c-1);for(p=c;p<=s;p++){for(l=0,h=c;h<=s;h++)l+=e[h]*r.get(h,p);for(l=l/e[c]/t.get(c,c-1),h=c;h<=s;h++)r.set(h,p,r.get(h,p)+l*e[h])}}}function aw(i,t,e,r,n){let s=i-1,a=0,l=i-1,f=Number.EPSILON,h=0,p=0,c=0,d=0,g=0,w=0,m=0,D=0,v,E,b,N,x,F,M,S,O,C,T,L,U,k,W;for(v=0;v<i;v++)for((v<a||v>l)&&(e[v]=n.get(v,v),t[v]=0),E=Math.max(v-1,0);E<i;E++)p=p+Math.abs(n.get(v,E));for(;s>=a;){for(N=s;N>a&&(w=Math.abs(n.get(N-1,N-1))+Math.abs(n.get(N,N)),w===0&&(w=p),!(Math.abs(n.get(N,N-1))<f*w));)N--;if(N===s)n.set(s,s,n.get(s,s)+h),e[s]=n.get(s,s),t[s]=0,s--,D=0;else if(N===s-1){if(M=n.get(s,s-1)*n.get(s-1,s),c=(n.get(s-1,s-1)-n.get(s,s))/2,d=c*c+M,m=Math.sqrt(Math.abs(d)),n.set(s,s,n.get(s,s)+h),n.set(s-1,s-1,n.get(s-1,s-1)+h),S=n.get(s,s),d>=0){for(m=c>=0?c+m:c-m,e[s-1]=S+m,e[s]=e[s-1],m!==0&&(e[s]=S-M/m),t[s-1]=0,t[s]=0,S=n.get(s,s-1),w=Math.abs(S)+Math.abs(m),c=S/w,d=m/w,g=Math.sqrt(c*c+d*d),c=c/g,d=d/g,E=s-1;E<i;E++)m=n.get(s-1,E),n.set(s-1,E,d*m+c*n.get(s,E)),n.set(s,E,d*n.get(s,E)-c*m);for(v=0;v<=s;v++)m=n.get(v,s-1),n.set(v,s-1,d*m+c*n.get(v,s)),n.set(v,s,d*n.get(v,s)-c*m);for(v=a;v<=l;v++)m=r.get(v,s-1),r.set(v,s-1,d*m+c*r.get(v,s)),r.set(v,s,d*r.get(v,s)-c*m)}else e[s-1]=S+c,e[s]=S+c,t[s-1]=m,t[s]=-m;s=s-2,D=0}else{if(S=n.get(s,s),O=0,M=0,N<s&&(O=n.get(s-1,s-1),M=n.get(s,s-1)*n.get(s-1,s)),D===10){for(h+=S,v=a;v<=s;v++)n.set(v,v,n.get(v,v)-S);w=Math.abs(n.get(s,s-1))+Math.abs(n.get(s-1,s-2)),S=O=.75*w,M=-.4375*w*w}if(D===30&&(w=(O-S)/2,w=w*w+M,w>0)){for(w=Math.sqrt(w),O<S&&(w=-w),w=S-M/((O-S)/2+w),v=a;v<=s;v++)n.set(v,v,n.get(v,v)-w);h+=w,S=O=M=.964}for(D=D+1,x=s-2;x>=N&&(m=n.get(x,x),g=S-m,w=O-m,c=(g*w-M)/n.get(x+1,x)+n.get(x,x+1),d=n.get(x+1,x+1)-m-g-w,g=n.get(x+2,x+1),w=Math.abs(c)+Math.abs(d)+Math.abs(g),c=c/w,d=d/w,g=g/w,!(x===N||Math.abs(n.get(x,x-1))*(Math.abs(d)+Math.abs(g))<f*(Math.abs(c)*(Math.abs(n.get(x-1,x-1))+Math.abs(m)+Math.abs(n.get(x+1,x+1))))));)x--;for(v=x+2;v<=s;v++)n.set(v,v-2,0),v>x+2&&n.set(v,v-3,0);for(b=x;b<=s-1&&(k=b!==s-1,b!==x&&(c=n.get(b,b-1),d=n.get(b+1,b-1),g=k?n.get(b+2,b-1):0,S=Math.abs(c)+Math.abs(d)+Math.abs(g),S!==0&&(c=c/S,d=d/S,g=g/S)),S!==0);b++)if(w=Math.sqrt(c*c+d*d+g*g),c<0&&(w=-w),w!==0){for(b!==x?n.set(b,b-1,-w*S):N!==x&&n.set(b,b-1,-n.get(b,b-1)),c=c+w,S=c/w,O=d/w,m=g/w,d=d/c,g=g/c,E=b;E<i;E++)c=n.get(b,E)+d*n.get(b+1,E),k&&(c=c+g*n.get(b+2,E),n.set(b+2,E,n.get(b+2,E)-c*m)),n.set(b,E,n.get(b,E)-c*S),n.set(b+1,E,n.get(b+1,E)-c*O);for(v=0;v<=Math.min(s,b+3);v++)c=S*n.get(v,b)+O*n.get(v,b+1),k&&(c=c+m*n.get(v,b+2),n.set(v,b+2,n.get(v,b+2)-c*g)),n.set(v,b,n.get(v,b)-c),n.set(v,b+1,n.get(v,b+1)-c*d);for(v=a;v<=l;v++)c=S*r.get(v,b)+O*r.get(v,b+1),k&&(c=c+m*r.get(v,b+2),r.set(v,b+2,r.get(v,b+2)-c*g)),r.set(v,b,r.get(v,b)-c),r.set(v,b+1,r.get(v,b+1)-c*d)}}}if(p!==0){for(s=i-1;s>=0;s--)if(c=e[s],d=t[s],d===0)for(N=s,n.set(s,s,1),v=s-1;v>=0;v--){for(M=n.get(v,v)-c,g=0,E=N;E<=s;E++)g=g+n.get(v,E)*n.get(E,s);if(t[v]<0)m=M,w=g;else if(N=v,t[v]===0?n.set(v,s,M!==0?-g/M:-g/(f*p)):(S=n.get(v,v+1),O=n.get(v+1,v),d=(e[v]-c)*(e[v]-c)+t[v]*t[v],F=(S*w-m*g)/d,n.set(v,s,F),n.set(v+1,s,Math.abs(S)>Math.abs(m)?(-g-M*F)/S:(-w-O*F)/m)),F=Math.abs(n.get(v,s)),f*F*F>1)for(E=v;E<=s;E++)n.set(E,s,n.get(E,s)/F)}else if(d<0)for(N=s-1,Math.abs(n.get(s,s-1))>Math.abs(n.get(s-1,s))?(n.set(s-1,s-1,d/n.get(s,s-1)),n.set(s-1,s,-(n.get(s,s)-c)/n.get(s,s-1))):(W=no(0,-n.get(s-1,s),n.get(s-1,s-1)-c,d),n.set(s-1,s-1,W[0]),n.set(s-1,s,W[1])),n.set(s,s-1,0),n.set(s,s,1),v=s-2;v>=0;v--){for(C=0,T=0,E=N;E<=s;E++)C=C+n.get(v,E)*n.get(E,s-1),T=T+n.get(v,E)*n.get(E,s);if(M=n.get(v,v)-c,t[v]<0)m=M,g=C,w=T;else if(N=v,t[v]===0?(W=no(-C,-T,M,d),n.set(v,s-1,W[0]),n.set(v,s,W[1])):(S=n.get(v,v+1),O=n.get(v+1,v),L=(e[v]-c)*(e[v]-c)+t[v]*t[v]-d*d,U=(e[v]-c)*2*d,L===0&&U===0&&(L=f*p*(Math.abs(M)+Math.abs(d)+Math.abs(S)+Math.abs(O)+Math.abs(m))),W=no(S*g-m*C+d*T,S*w-m*T-d*C,L,U),n.set(v,s-1,W[0]),n.set(v,s,W[1]),Math.abs(S)>Math.abs(m)+Math.abs(d)?(n.set(v+1,s-1,(-C-M*n.get(v,s-1)+d*n.get(v,s))/S),n.set(v+1,s,(-T-M*n.get(v,s)-d*n.get(v,s-1))/S)):(W=no(-g-O*n.get(v,s-1),-w-O*n.get(v,s),m,d),n.set(v+1,s-1,W[0]),n.set(v+1,s,W[1]))),F=Math.max(Math.abs(n.get(v,s-1)),Math.abs(n.get(v,s))),f*F*F>1)for(E=v;E<=s;E++)n.set(E,s-1,n.get(E,s-1)/F),n.set(E,s,n.get(E,s)/F)}for(v=0;v<i;v++)if(v<a||v>l)for(E=v;E<i;E++)r.set(v,E,n.get(v,E));for(E=i-1;E>=a;E--)for(v=a;v<=l;v++){for(m=0,b=a;b<=Math.min(E,l);b++)m=m+r.get(v,b)*n.get(b,E);r.set(v,E,m)}}}function no(i,t,e,r){let n,s;return Math.abs(e)>Math.abs(r)?(n=r/e,s=e+n*r,[(i+n*t)/s,(t-n*i)/s]):(n=e/r,s=r+n*e,[(n*i+t)/s,(n*t-i)/s])}class zc{constructor(t){if(t=ar.checkMatrix(t),!t.isSymmetric())throw new Error("Matrix is not symmetric");let e=t,r=e.rows,n=new pt(r,r),s=!0,a,l,f;for(l=0;l<r;l++){let h=0;for(f=0;f<l;f++){let p=0;for(a=0;a<f;a++)p+=n.get(f,a)*n.get(l,a);p=(e.get(l,f)-p)/n.get(f,f),n.set(l,f,p),h=h+p*p}for(h=e.get(l,l)-h,s&=h>0,n.set(l,l,Math.sqrt(Math.max(h,0))),f=l+1;f<r;f++)n.set(l,f,0)}this.L=n,this.positiveDefinite=!!s}isPositiveDefinite(){return this.positiveDefinite}solve(t){t=ar.checkMatrix(t);let e=this.L,r=e.rows;if(t.rows!==r)throw new Error("Matrix dimensions do not match");if(this.isPositiveDefinite()===!1)throw new Error("Matrix is not positive definite");let n=t.columns,s=t.clone(),a,l,f;for(f=0;f<r;f++)for(l=0;l<n;l++){for(a=0;a<f;a++)s.set(f,l,s.get(f,l)-s.get(a,l)*e.get(f,a));s.set(f,l,s.get(f,l)/e.get(f,f))}for(f=r-1;f>=0;f--)for(l=0;l<n;l++){for(a=f+1;a<r;a++)s.set(f,l,s.get(f,l)-s.get(a,l)*e.get(a,f));s.set(f,l,s.get(f,l)/e.get(f,f))}return s}get lowerTriangularMatrix(){return this.L}}class qc{constructor(t,e={}){t=ar.checkMatrix(t);let{Y:r}=e;const{scaleScores:n=!1,maxIterations:s=1e3,terminationCriteria:a=1e-10}=e;let l;if(r){if(Qe.isAnyArray(r)&&typeof r[0]=="number"?r=pt.columnVector(r):r=ar.checkMatrix(r),r.rows!==t.rows)throw new Error("Y should have the same number of rows as X");l=r.getColumnVector(0)}else l=t.getColumnVector(0);let f=1,h,p,c,d;for(let g=0;g<s&&f>a;g++)c=t.transpose().mmul(l).div(l.transpose().mmul(l).get(0,0)),c=c.div(c.norm()),h=t.mmul(c).div(c.transpose().mmul(c).get(0,0)),g>0&&(f=h.clone().sub(d).pow(2).sum()),d=h.clone(),r?(p=r.transpose().mmul(h).div(h.transpose().mmul(h).get(0,0)),p=p.div(p.norm()),l=r.mmul(p).div(p.transpose().mmul(p).get(0,0))):l=h;if(r){let g=t.transpose().mmul(h).div(h.transpose().mmul(h).get(0,0));g=g.div(g.norm());let w=t.clone().sub(h.clone().mmul(g.transpose())),m=l.transpose().mmul(h).div(h.transpose().mmul(h).get(0,0)),D=r.clone().sub(h.clone().mulS(m.get(0,0)).mmul(p.transpose()));this.t=h,this.p=g.transpose(),this.w=c.transpose(),this.q=p,this.u=l,this.s=h.transpose().mmul(h),this.xResidual=w,this.yResidual=D,this.betas=m}else this.w=c.transpose(),this.s=h.transpose().mmul(h).sqrt(),n?this.t=h.clone().div(this.s.get(0,0)):this.t=h,this.xResidual=t.sub(h.mmul(c.transpose()))}}zt.AbstractMatrix=$t,zt.CHO=zc,zt.CholeskyDecomposition=zc,zt.DistanceMatrix=Qs,zt.EVD=Pc;var uw=zt.EigenvalueDecomposition=Pc;zt.LU=eo,zt.LuDecomposition=eo;var kc=zt.Matrix=pt;zt.MatrixColumnSelectionView=W1,zt.MatrixColumnView=U1,zt.MatrixFlipColumnView=j1,zt.MatrixFlipRowView=Y1,zt.MatrixRowSelectionView=G1,zt.MatrixRowView=Z1,zt.MatrixSelectionView=to,zt.MatrixSubView=K1,zt.MatrixTransposeView=H1,zt.NIPALS=qc,zt.Nipals=qc,zt.QR=Oa,zt.QrDecomposition=Oa,zt.SVD=vi,zt.SingularValueDecomposition=vi,zt.SymmetricMatrix=Yn,zt.WrapperMatrix1D=Lc,zt.WrapperMatrix2D=ar,zt.correlation=nw,zt.covariance=rw;var Uc=zt.default=pt;zt.determinant=ro,zt.inverse=X1,zt.linearDependencies=tw,zt.pseudoInverse=ew,zt.solve=Rc,zt.wrap=J1;const Wc=uw,jc=kc;Uc.Matrix&&Uc.Matrix;class lw{constructor(t){z(this,"_errorListener");this._errorListener=t}new({rows:t,columns:e,initial_value:r}={}){return new $a(t,e,r,this._errorListener)}avg({id:t}){return t==null?void 0:t.avg()}col({id:t,column:e}){return t==null?void 0:t.col({column:e})}det({id:t}){return t==null?void 0:t.det()}get({id:t,row:e,column:r}){return t==null?void 0:t.get({row:e,column:r})}inv({id:t}){return t==null?void 0:t.inv()}max({id:t}){return t==null?void 0:t.max()}min({id:t}){return t==null?void 0:t.min()}pow({id:t,power:e}){return t==null?void 0:t.pow({power:e})}row({id:t,row:e}){return t==null?void 0:t.row({row:e})}set({id:t,row:e,column:r,value:n}){t==null||t.set({row:e,column:r,value:n})}sum({id1:t,id2:e}){return t==null?void 0:t.sum({id2:e})}copy({id:t}){return t==null?void 0:t.copy()}diff({id1:t,id2:e}){return t==null?void 0:t.diff({id2:e})}rows({id:t}){return t==null?void 0:t.rows()}columns({id:t}){return t==null?void 0:t.columns()}fill({id:t,value:e,from_row:r,to_row:n,from_column:s,to_column:a}){t==null||t.fill({value:e,from_row:r,to_row:n,from_column:s,to_column:a})}kron({id1:t,id2:e}){return t==null?void 0:t.kron({id2:e})}mode({id:t}){return t==null?void 0:t.mode()}mult({id1:t,id2:e}){return t==null?void 0:t.mult({id2:e})}pinv({id:t}){return t==null?void 0:t.pinv()}rank({id:t}){return t==null?void 0:t.rank()}sort({id:t,column:e,order:r}){t==null||t.sort({column:e,order:r})}trace({id:t}){return t==null?void 0:t.trace()}concat({id1:t,id2:e}){return t==null?void 0:t.concat({id2:e})}median({id:t}){return t==null?void 0:t.median()}add_col({id:t,column:e,array_id:r}){t==null||t.add_col({column:e,array_id:r})}add_row({id:t,row:e,array_id:r}){t==null||t.add_row({row:e,array_id:r})}is_zero({id:t}){return t==null?void 0:t.is_zero()}reshape({id:t,rows:e,columns:r},n){return t==null?void 0:t.reshape({rows:e,columns:r},n)}reverse({id:t}){t==null||t.reverse()}is_binary({id:t}){return t==null?void 0:t.is_binary()}is_square({id:t}){return t==null?void 0:t.is_square()}submatrix({id:t,from_row:e,to_row:r,from_column:n,to_column:s}){return t==null?void 0:t.submatrix({from_row:e,to_row:r,from_column:n,to_column:s})}swap_rows({id:t,row1:e,row2:r}){t==null||t.swap_rows({row1:e,row2:r})}transpose({id:t}){return t==null?void 0:t.transpose()}remove_col({id:t,column:e}){return t==null?void 0:t.remove_col({column:e})}remove_row({id:t,row:e}){return t==null?void 0:t.remove_row({row:e})}eigenvalues({id:t}){return t==null?void 0:t.eigenvalues()}is_diagonal({id:t}){return t==null?void 0:t.is_diagonal()}is_identity({id:t}){return t==null?void 0:t.is_identity()}eigenvectors({id:t}){return t==null?void 0:t.eigenvectors()}is_symmetric({id:t}){return t==null?void 0:t.is_symmetric()}swap_columns({id:t,column1:e,column2:r}){t==null||t.swap_columns({column1:e,column2:r})}is_stochastic({id:t}){return t==null?void 0:t.is_stochastic()}is_triangular({id:t}){return t==null?void 0:t.is_triangular()}elements_count({id:t}){return t==null?void 0:t.elements_count()}is_antidiagonal({id:t}){return t==null?void 0:t.is_antidiagonal()}is_antisymmetric({id:t}){return t==null?void 0:t.is_antisymmetric()}}class $a{constructor(t=0,e=0,r=void 0,n){z(this,"_matrixInstance");z(this,"_errorListener");this._matrixInstance=this._createMatrix(t,e,r),this._errorListener=n}get _matrixArray(){return this._matrixInstance.map(t=>[...t._value])}get _value(){return this._matrixInstance}set _value(t){this._matrixInstance=t}get isMatrix(){return!0}_createMatrix(t,e,r){return Array.from(new Array(t),()=>new Jt(e,r,this._errorListener))}avg(){let t=0,e=0;for(const n of this._matrixInstance)for(const s of n._value)t+=_t(s)?0:s,e+=1;return t/e}col({column:t}){const e=[],r=new Jt(0,void 0,this._errorListener);if(_t(t))return r;for(const n of this._matrixInstance)e.push(n._value[t]);return r._value=e,r}det(){return Nc(this._matrixArray)}get({row:t,column:e}){var r,n;if(!(_t(t)||_t(e)))return(n=(r=this._matrixInstance[t])==null?void 0:r._value)==null?void 0:n[e]}inv(){const t=Hs(this._matrixArray);return this._newMatrix(t)}max(){return r1(this._matrixArray)}min(){return Sa(this._matrixArray)}pow({power:t}){const e=_t(t)?this._matrixArray:i1(this._matrixArray,t);return this._newMatrix(e)}row({row:t}){return _t(t)?new Jt(0,void 0,this._errorListener):this._matrixInstance[t]}set({row:t,column:e,value:r}){_t(t)||_t(e)||this._matrixInstance[t].set({index:e,value:r})}sum({id2:t}){const e=Gi(this._matrixArray,typeof t=="number"?t:t._matrixArray);return this._newMatrix(e)}copy(){return this._newMatrix(this._matrixArray)}diff({id2:t}){const e=Jv(this._matrixArray,typeof t=="number"?t:t._matrixArray);return this._newMatrix(e)}rows(){return this._matrixInstance.length}columns(){return this._matrixArray.length&&this._matrixArray[0].length}fill({value:t,from_row:e,to_row:r,from_column:n,to_column:s}={}){_t(e)&&(e=0),_t(r)&&(r=this.rows()),_t(n)&&(n=0),_t(s)&&(s=this.columns());for(const[a,l]of this._matrixInstance.entries())for(const[f]of l._value.entries())a<r&&a>=e&&f>=n&&f<s&&l.set({index:f,value:t})}kron({id2:t}){const e=Kv(this._matrixArray,t._matrixArray);return this._newMatrix(e)}mode(){return Sa(bc(this._matrixArray))}mult({id2:t}){const e=typeof t=="number"?t:t._matrixArray?t._matrixArray:t._value,r=di(this._matrixArray,e);return this._newMatrix(r)}pinv(){const t=n1(this._matrixArray);return this._newMatrix(t)}rank(){return this._matrixRank(this._matrixArray)}sort({column:t,order:e=zn.ascending}={}){_t(t)&&(t=0),this._matrixInstance.sort((r,n)=>{const s=r._value[t],a=n._value[t];return e!==zn.descending?s-a:a-s})}trace(){return e1(this._matrixArray)}concat({id2:t}){for(const e of t._value)this._matrixInstance.push(e);return this}median(){return Sc(this._matrixArray)}add_col({column:t,array_id:e}={}){_t(t)&&(t=this.columns());for(const[r,n]of this._matrixInstance.entries())n.insert({index:t,value:e?e._value[r]:void 0})}add_row({row:t,array_id:e}){_t(t)&&(t=this.rows()),this._matrixInstance.splice(t,0,e||new Jt(this.columns(),void 0,this._errorListener))}is_zero(){return this._matrixArray.every(t=>t.every(e=>e===0))}reshape({rows:t=0,columns:e=0},r){if(t*e!==this.columns()*this.rows()){this._errorListener.addError("New matrix must be of same area as original matrix",r,Re.Error);return}const n=jv(this._matrixArray,[t,e]);this._matrixInstance=n.map(s=>{const a=new Jt(0,void 0,this._errorListener);return a._value=[...s],a})}reverse(){this._matrixInstance.reverse();for(const t of this._matrixInstance)t.reverse()}is_binary(){return this._matrixArray.every(t=>t.every(e=>e===0||e===1))}is_square(){return this.rows()===this.columns()}submatrix({from_row:t,to_row:e,from_column:r,to_column:n}={}){_t(t)&&(t=0),_t(e)&&(e=this.rows()),_t(r)&&(r=0),_t(n)&&(n=this.columns());const s=this._matrixArray.splice(t,e),a=[];for(const l of s)a.push(l.splice(r,n));return this._newMatrix(a)}swap_rows({row1:t,row2:e}){if(_t(t)||_t(e))return;const r=this._matrixInstance[t],n=this._matrixInstance[e];this._matrixInstance[t]=n,this._matrixInstance[e]=r}transpose(){const t=xc(this._matrixArray);return this._newMatrix(t)}remove_col({column:t}={}){_t(t)&&(t=this.columns());const e=[];for(const n of this._matrixInstance){const s=n._value.splice(t,1);e.push(s[0])}const r=new Jt(0,void 0,this._errorListener);return r._value=e,r}remove_row({row:t}={}){return _t(t)&&(t=this.rows()),this._matrixInstance.splice(t,1)[0]}eigenvalues(){const t=new Wc(new jc(this._matrixArray)),e=new Jt(0,void 0,this._errorListener);return e._value=t.realEigenvalues,e}is_diagonal(){const t=this.rows(),e=this.columns();if(t!==e)return!1;const r=this._matrixArray;for(let n=0;n<t;n++)for(let s=0;s<e;s++)if(n!==s&&r[n][s]!==0)return!1;return!0}is_identity(){const t=this.rows(),e=this.columns();if(t!==e)return!1;const r=this._matrixArray;for(let n=0;n<t;n++)for(let s=0;s<e;s++)if(n!==s&&r[n][s]!==0||n===s&&r[n][s]!==1)return!1;return!0}eigenvectors(){const t=new Wc(new jc(this._matrixArray));return this._newMatrix(t.eigenvectorMatrix.to2DArray())}is_symmetric(){const t=this.rows(),e=this.columns();if(t!==e)return!1;const r=this._matrixArray;for(let n=0;n<t;n++)for(let s=n+1;s<e;s++)if(r[n][s]!==r[s][n])return!1;return!0}swap_columns({column1:t,column2:e}){if(!(_t(t)||_t(e)))for(const r of this._matrixInstance){const n=r._value[t],s=r._value[e];r.set({index:t,value:s}),r.set({index:e,value:n})}}is_stochastic(){const t=this._matrixArray;for(let e=0;e<t.length;e++){let r=0;for(let n=0;n<t[e].length;n++){if(t[e][n]<0)return!1;r+=t[e][n]}if(Math.abs(r-1)>Number.EPSILON)return!1}return!0}is_triangular(){const t=this.rows(),e=this.columns();return t!==e?!1:this._isUpperTriangular(t)||this._isLowerTriangular(t)}elements_count(){return Yv(this._matrixArray)}is_antidiagonal(){const t=this.rows(),e=this.columns();if(t!==e)return!1;const r=this._matrixArray;for(let n=0;n<t;n++)for(let s=0;s<t;s++)if(n+s!==t-1&&r[n][s]!==0)return!1;return!0}is_antisymmetric(){const t=this.rows(),e=this.columns();if(t!==e)return!1;const r=this._matrixArray;for(let n=0;n<t;n++)for(let s=0;s<t;s++)if(n!==s&&r[n][s]!==-r[s][n])return!1;return!0}_isUpperTriangular(t){const e=this._matrixArray;for(let r=1;r<t;r++)for(let n=0;n<r;n++)if(e[r][n]!==0)return!1;return!0}_isLowerTriangular(t){const e=this._matrixArray;for(let r=0;r<t-1;r++)for(let n=r+1;n<t;n++)if(e[r][n]!==0)return!1;return!0}_newMatrix(t){const e=new $a(0,0,void 0,this._errorListener);return e._value=t.map(r=>{const n=new Jt(0,void 0,this._errorListener);return n._value=[...r],n}),e}_matrixRank(t){let e=0;const r=t.length,n=t[0].length,s=[...t].map(a=>[...a]);for(let a=0;a<r&&!(a>=n);a++){let l=a;for(;l<r&&s[l][a]===0;)l++;if(l===r)continue;if(l!==a){const h=s[l];s[l]=s[a],s[a]=h}const f=s[a][a];for(let h=0;h<n;h++)s[a][h]/=f;for(let h=a+1;h<r;h++){const p=s[h][a];s[h]=s[h].map((c,d)=>c-p*s[a][d]),s[h][a]=0}}for(let a=0;a<r;a++)s[a].some(l=>Number(l.toFixed(8))!==0)&&e++;return e}}class fw{constructor(t){z(this,"_variables");z(this,"_cacheData");this._variables=t,this._cacheData={}}change({timeframe:t},e){if(!t)return!0;const r=Xr(t),n=Xr(this._variables.timeframe.period);if(r<n)return!0;const s=`change_${e}`,a=this._cacheData[s],l=this._variables.time;if(a){if(a.offset){if(a.currentTime+a.offset<=l)return this._cacheData[s]={currentTime:l,offset:0},!0}else if(a.currentTime+r*1e3<=l)return this._cacheData[s]={currentTime:l,offset:0},!0}else{const f=this._calcTimeOffset(l,t);return this._cacheData[s]={currentTime:l,offset:f},!1}return!1}in_seconds({timeframe:t}={}){return Xr(t||this._variables.timeframe.period)}from_seconds({seconds:t=0}){const e=t*1e3,r=ee.duration(e);if(r.years())return"12M";const s=r.asMonths();if(Gs(s))return`${s}M`;const a=r.asWeeks();if(Gs(a))return`${a}M`;const l=r.asDays();if(l>=1)return`${Math.ceil(l)}D`;const f=r.asMinutes();if(f>=1)return`${Math.ceil(f)}`;const h=r.asSeconds();return h<=1?"1S":h<=5?"5S":h<=10?"10S":h<=15?"15S":h<=30?"30S":"1"}_calcTimeOffset(t,e){let r=0;if(e.includes("W")){const l=ee(t).day();e="1D",l!==1&&(r=(8-l)*60*60*24*1e3)}else if(e.includes("M")){const l=ee(t).date();e="1D";const f=ee(t).daysInMonth();l!==1&&(r=(f-l+1)*60*60*24*1e3)}const n=this._variables.getTimeTradingday(t,e),s=Xr(e)*1e3,a=t-n-Math.floor((t-n)/s)*s;return r?r-a:a}}class cw{constructor(t){z(this,"_errorListener");this._errorListener=t}pos({source:t="",str:e=""}){return t==null?void 0:t.indexOf(e)}trim({source:t=""}){return t==null?void 0:t.trim()}lower({source:t=""}){return t==null?void 0:t.toLocaleLowerCase()}match({source:t="",regex:e=""}){const r=t==null?void 0:t.match(new RegExp(e));return r?r[0]:""}split({string:t="",separator:e=""}){const r=t==null?void 0:t.split(e),n=new Jt;return n._value=r||[],n}upper({source:t=""}){return t==null?void 0:t.toLocaleUpperCase()}format({formatString:t=""},e){return this._strFormat(t,e)}length({string:t=""}){return t==null?void 0:t.length}repeat({source:t="",repeat:e,separator:r=""},n){if(_t(e)){this._errorListener.addError("Invalid array length",n,Re.Error);return}return Array.from(new Array(e),()=>t).join(r)}replace({source:t="",target:e="",replacement:r="",occurrence:n}){_t(n)&&(n=0);let s=-1;for(let a=0;a<n+1&&(s=t.indexOf(e,s+1),s!==-1);a++);return s!==-1?t.substring(0,s)+r+t.substring(s+e.length):t}contains({source:t="",str:e=""}){return t==null?void 0:t.includes(e)}endswith({source:t="",str:e=""}){return t==null?void 0:t.endsWith(e)}tonumber({string:t=""}){if(/[^\d.]/.test(t))return;const e=parseFloat(t);return isNaN(e)?void 0:e}tostring({value:t,format:e}){if(t===void 0)return"NaN";if(typeof t=="object"){if(t.isArray)return this._arrToStr(t._value,e);if(t.isMatrix){const r=[];for(const n of t._matrixArray)r.push(this._arrToStr(n,e));return r.join(`
|
62
|
-
`)}}if(typeof t=="string")return t;if(typeof t=="boolean")return String(t);if(typeof t=="number")return this._formatNumber(t,e)}_arrToStr(t,e){return`[${t.map(n=>typeof n=="number"?this._formatNumber(n,e):n).toString()}]`}substring({source:t="",begin_pos:e=0,end_pos:r}){return _t(e)&&(e=0),_t(r)&&(r=void 0),t==null?void 0:t.substring(e,r)}startswith({source:t="",str:e=""}){return t==null?void 0:t.startsWith(e)}format_time({time:t,format:e="yyyy-MM-dd'T'HH:mm:ssZ",timezone:r}){return _t(t)&&(t=0),Br(t,r).format(e)}replace_all({source:t="",target:e="",replacement:r=""}){return t==null?void 0:t.replace(new RegExp(e,"g"),r)}_formatNumber(t,e){if(!e)return t;switch(e){case"integer":return String(Math.round(t));case"currency":return`$${t}`;case"percent":return`${t*100}%`;default:const r=e.split(".")[1],n=r?r.length:0;return parseFloat(t.toFixed(n))}}_strFormat(t,e){let r=t;return e.forEach((n,s)=>{if(typeof n=="number"){const a=`\\{\\s*${s}\\s*,\\s*number\\s*,\\s*([^\\}]+)\\s*\\}`,l=t.match(new RegExp(a));if(l){const f=l[1];r=r.replace(new RegExp(a,"g"),String(this._formatNumber(n,f)))}else r=r.replace(new RegExp(`\\{${s}\\}`,"g"),String(n))}else r=r.replace(new RegExp(`\\{${s}\\}`,"g"),n)}),r}}class hw{constructor(t){z(this,"_errorListener");this._errorListener=t}new(){return new La(this._errorListener)}copy({id:t}){return t==null?void 0:t.copy()}get({id:t,key:e}){return t==null?void 0:t.get({key:e})}put({id:t,key:e,value:r}){return t==null?void 0:t.put({key:e,value:r})}keys({id:t}){return t==null?void 0:t.keys()}size({id:t}){return t==null?void 0:t.size()}clear({id:t}){t==null||t.clear()}remove({id:t,key:e}){return t==null?void 0:t.remove({key:e})}values({id:t}){return t==null?void 0:t.values()}put_all({id:t,id2:e}){t==null||t.put_all({id2:e})}contains({id:t,key:e}){return t==null?void 0:t.contains({key:e})}}class La{constructor(t){z(this,"_errorListener");z(this,"_mapInstance");this._errorListener=t,this._mapInstance=new Map}get isMap(){return!0}_copyMap(t){const e=new La(this._errorListener);return e._mapInstance=new Map(t.entries()),e}copy(){return this._copyMap(this._mapInstance)}get({key:t}){return this._mapInstance.get(t)}put({key:t,value:e}){return this._mapInstance.set(t,e)}keys(){const t=new Jt(0,void 0,this._errorListener);return t._value=[...this._mapInstance.keys()],t}size(){return this._mapInstance.size}clear(){this._mapInstance.clear()}remove({key:t}){const e=this._mapInstance.get(t);return this._mapInstance.delete(t),e||void 0}values(){const t=new Jt(0,void 0,this._errorListener);return t._value=[...this._mapInstance.values()],t}put_all({id2:t}){this._mapInstance=new Map([...this._mapInstance,...t._mapInstance])}contains({key:t}){return this._mapInstance.has(t)}}class pw{constructor(t){z(this,"_variables");this._variables=t}new({price:t,time:e,index:r}){return new Zn(t,r,e)}now({price:t}){const{time:e,bar_index:r}=this._variables;return new Zn(t,r,e)}copy({id:t}){const{price:e,time:r,index:n}=t||{};return new Zn(e,n,r)}from_index({price:t,index:e}){return new Zn(t,e)}from_time({price:t,time:e}){return new Zn(t,void 0,e)}}class Zn{constructor(t,e,r){z(this,"_index");z(this,"_price");z(this,"_time");this._index=e,this._price=t,this._time=r}get index(){return this._index}get price(){return this._price}get time(){return this._time}copy(){return new Zn(this._price,this._index,this._time)}}class dw{constructor(t){z(this,"_variables");z(this,"_defaultLabel",{text:"",xloc:Oe.bar_index,yloc:qi.price,size:jr.normal,style:ge.styleLabelDown,textalign:Xe.alignCenter});this._variables=t}new(t,e){const r=`label_${e}`,n={...this._defaultLabel,...t,id:r};t.point&&(n.x=n.xloc===Oe.bar_index?t.point.index:t.point.time,n.y=t.point.price);const s=new Hi(r,this._variables);return this._variables.label.add(r,n,s),s}label(t,e){return t.x?t.x:new Hi(e,this._variables)}copy({id:t},e){return t==null?void 0:t.copy(e)}get_x({id:t},e){return t==null?void 0:t.get_x(e)}get_y({id:t},e){return t==null?void 0:t.get_y(e)}set_x({id:t,...e},r){t==null||t.set_x(e,r)}set_y({id:t,...e},r){t==null||t.set_y(e,r)}delete({id:t}){t==null||t.delete()}get_text({id:t},e){return t==null?void 0:t.get_text(e)}set_xy({id:t,...e},r){t==null||t.set_xy(e,r)}set_size({id:t,...e},r){t==null||t.set_size(e,r)}set_xloc({id:t,...e},r){t==null||t.set_xloc(e,r)}set_yloc({id:t,...e},r){t==null||t.set_yloc(e,r)}set_style({id:t,...e},r){t==null||t.set_style(e,r)}set_color({id:t,...e},r){t==null||t.set_color(e,r)}set_tooltip({id:t,...e},r){t==null||t.set_tooltip(e,r)}set_point({id:t,...e},r){t==null||t.set_point(e,r)}set_text({id:t,...e},r){t==null||t.set_text(e,r)}set_textcolor({id:t,...e},r){t==null||t.set_textcolor(e,r)}set_textalign({id:t,...e},r){t==null||t.set_textalign(e,r)}set_text_font_family({id:t,...e},r){t==null||t.set_text_font_family(e,r)}}class Hi{constructor(t,e){z(this,"_id");z(this,"_variables");this._id=t,this._variables=e}copy(t){const e=`label_${t}`,r=this._getLabel(t),n=new Hi(e,this._variables);return r&&this._variables.label.add(e,{...r,id:e},n),n}get_x(t){var e;return(e=this._getLabel(t))==null?void 0:e.x}get_y(t){var e;return(e=this._getLabel(t))==null?void 0:e.y}set_x({x:t},e){const r=this._getLabel(e);r&&(r.x=t)}set_y({y:t},e){const r=this._getLabel(e);r&&(r.y=t)}delete(){this._variables.label.delete(this._id)}set_xy({x:t,y:e},r){const n=this._getLabel(r);n&&(n.x=t,n.y=e)}get_text(t){var e;return(e=this._getLabel(t))==null?void 0:e.text}set_size({size:t},e){const r=this._getLabel(e);r&&(r.size=t)}set_text({text:t},e){const r=this._getLabel(e);r&&(r.text=t)}set_xloc({x:t,xloc:e},r){const n=this._getLabel(r);n&&(n.x=t,n.xloc=e)}set_yloc({yloc:t},e){const r=this._getLabel(e);r&&(r.yloc=t)}set_color({color:t},e){const r=this._getLabel(e);r&&(r.color=t)}set_point({point:t},e){const r=this._getLabel(e);r&&(r.x=r.xloc===Oe.bar_index?t==null?void 0:t.index:t==null?void 0:t.time,r.y=t==null?void 0:t.price)}set_style({style:t},e){const r=this._getLabel(e);r&&(r.style=t)}set_tooltip({tooltip:t},e){const r=this._getLabel(e);r&&(r.tooltip=t)}set_textalign({textalign:t},e){const r=this._getLabel(e);r&&(r.textalign=t)}set_textcolor({textcolor:t},e){const r=this._getLabel(e);r&&(r.textcolor=t)}set_text_font_family({text_font_family:t},e){const r=this._getLabel(e);r&&(r.text_font_family=t)}_getLabel(t){const e=this._variables.label.get(this._id);return e||console.log(`错误${t}: label 不存在`),e}}const _w={freq_all:dn.freqAll,freq_once_per_bar:dn.freqOncePerBar,freq_once_per_bar_close:dn.freqOncePerBarClose},mw={gaps_off:zi.gapsOff,gaps_on:zi.gapsOn,lookahead_off:zi.lookaheadOff,lookahead_on:zi.lookaheadOn},wi={aqua:"#00BCD4",black:"#363A45",blue:"#2196F3",fuchsia:"#E040FB",gray:"#787B86",green:"#4CAF50",lime:"#00E676",maroon:"#880E4F",navy:"#311B92",olive:"#808000",orange:"#FF9800",purple:"#9C27B0",red:"#FF5252",silver:"#B2B5BE",teal:"#00897B",white:"#FFFFFF",yellow:"#FFEB3B"},Yc={AUD:"AUD",BTC:"BTC",CAD:"CAD",CHF:"CHF",ETH:"ETH",EUR:"EUR",GBP:"GBP",HKD:"HKD",INR:"INR",JPY:"JPY",KRW:"KRW",MYR:"MYR",NOK:"NOK",NONE:"NONE",NZD:"NZD",RUB:"RUB",SEK:"SEK",SGD:"SGD",TRY:"TRY",USD:"USD",USDT:"USDT",ZAR:"ZAR"},gw={friday:6,monday:2,saturday:7,sunday:1,thursday:5,tuesday:3,wednesday:4},vw={all:[ir.dataWindow,ir.pane,ir.priceScale,ir.statusLine],data_window:[ir.dataWindow],none:[],pane:[ir.pane],price_scale:[ir.priceScale],status_line:[ir.statusLine]},ww={both:Rn.both,left:Rn.left,none:Rn.none,right:Rn.right},yw={inherit:Pn.inherit,mintick:Pn.mintick,percent:Pn.percent,price:Pn.price,volume:Pn.volume},Dw={style_solid:vs.styleSolid,style_dashed:vs.styleDashed,style_dotted:vs.styleDotted},bw={style_arrowdown:ge.styleArrowdown,style_arrowup:ge.styleArrowup,style_circle:ge.styleCircle,style_cross:ge.styleCross,style_diamond:ge.styleDiamond,style_flag:ge.styleFlag,style_label_center:ge.styleLabelCenter,style_label_down:ge.styleLabelDown,style_label_left:ge.styleLabelLeft,style_label_lower_left:ge.styleLabelLowerLeft,style_label_lower_right:ge.styleLabelLowerRight,style_label_right:ge.styleLabelRight,style_label_up:ge.styleLabelUp,style_label_upper_left:ge.styleLabelUpperLeft,style_label_upper_right:ge.styleLabelUpperRight,style_none:ge.styleNone,style_square:ge.styleSquare,style_text_outline:ge.styleTextOutline,style_triangledown:ge.styleTriangledown,style_triangleup:ge.styleTriangleup,style_xcross:ge.styleXcross},Ew={style_arrow_both:Wr.styleArrowBoth,style_arrow_left:Wr.styleArrowLeft,style_arrow_right:Wr.styleArrowRight,style_dashed:Wr.styleDashed,style_dotted:Wr.styleDotted,style_solid:Wr.styleSolid},xw={abovebar:si.abovebar,absolute:si.absolute,belowbar:si.belowbar,bottom:si.bottom,top:si.top},Aw={e:2.718281828459045,phi:1.618033988749895,pi:3.141592653589793,rphi:.6180339887498948},Cw={style_area:vr.styleArea,style_areabr:vr.styleAreabr,style_circles:vr.styleCircles,style_columns:vr.styleColumns,style_cross:vr.styleCross,style_histogram:vr.styleHistogram,style_line:vr.styleLine,style_linebr:vr.styleLinebr,style_stepline:vr.styleStepline,style_stepline_diamond:vr.styleSteplineDiamond,style_steplinebr:vr.styleSteplinebr},Fw={bottom_center:Tr.bottomCenter,bottom_left:Tr.bottomLeft,bottom_right:Tr.bottomRight,middle_center:Tr.middleCenter,middle_left:Tr.middleLeft,middle_right:Tr.middleRight,top_center:Tr.topCenter,top_left:Tr.topLeft,top_right:Tr.topRight},Mw={left:ws.left,none:ws.none,right:ws.right},Nw={arrowdown:sr.arrowdown,arrowup:sr.arrowup,circle:sr.circle,cross:sr.cross,diamond:sr.diamond,flag:sr.flag,labeldown:sr.labeldown,labelup:sr.labelup,square:sr.square,triangledown:sr.triangledown,triangleup:sr.triangleup,xcross:sr.xcross},Sw={auto:jr.auto,huge:jr.huge,large:jr.large,normal:jr.normal,small:jr.small,tiny:jr.tiny},Bw={cash:Ge.cash,fixed:Ge.fixed,percent_of_equity:Ge.percentOfEquity,commission:{cash_per_contract:Ir.cashPerContract,cash_per_order:Ir.cashPerOrder,percent:Ir.percent},direction:{all:pe.all,long:pe.long,short:pe.short},oca:{cancel:qn.cancel,none:qn.none,reduce:qn.reduce}},Tw={align_bottom:Xe.alignBottom,align_center:Xe.alignCenter,align_left:Xe.alignLeft,align_right:Xe.alignRight,align_top:Xe.alignTop,wrap_auto:Xe.wrapAuto,wrap_none:Xe.wrapNone},Iw={bar_index:Oe.bar_index,bar_time:Oe.bar_time},Ow={abovebar:qi.abovebar,belowbar:qi.belowbar,price:qi.price},$w={actual:ys.actual,estimate:ys.estimate,standardized:ys.standardized};class Lw{constructor(){z(this,"adjustment",{dividends:gs.dividends,none:gs.none,splits:gs.splits});z(this,"alert",_w);z(this,"barmerge",mw);z(this,"color",wi);z(this,"currency",Yc);z(this,"dayofweek",gw);z(this,"earnings",$w);z(this,"display",vw);z(this,"extend",ww);z(this,"font",{family_default:"SimSun",family_monospace:"Monospace"});z(this,"format",yw);z(this,"hline",Dw);z(this,"label",bw);z(this,"line",Ew);z(this,"location",xw);z(this,"math",Aw);z(this,"order",{ascending:zn.ascending,descending:zn.descending});z(this,"plot",Cw);z(this,"position",Fw);z(this,"scale",Mw);z(this,"session",{extended:na.extended,regular:na.regular});z(this,"shape",Nw);z(this,"size",Sw);z(this,"splits",{denominator:"denominator",numerator:"numerator"});z(this,"strategy",Bw);z(this,"text",Tw);z(this,"xloc",Iw);z(this,"yloc",Ow)}updateData(){}}class Rw{constructor(t){z(this,"_variables");z(this,"_defaultPolyline",{curved:!1,closed:!1,xloc:Oe.bar_index,line_color:wi.blue,line_style:Wr.styleSolid,line_width:1});this._variables=t}new(t,e){const r=`polyline_${e}`,n=Object.assign({},this._defaultPolyline,t,{id:r}),s=new Zc(r,this._variables);return this._variables.polyline.add(r,n,s),s}delete({id:t}){t&&t.delete()}}class Zc{constructor(t,e){z(this,"_id");z(this,"_variables");this._variables=e,this._id=t}delete(){this._variables.polyline.delete(this._id)}}class Pw{constructor(t){z(this,"_variables");z(this,"_defaultLine",{xloc:Oe.bar_index,extend:Rn.none,style:Wr.styleSolid});this._variables=t}new({first_point:t,second_point:e,...r},n){const s=`line_${n}`,a={...this._defaultLine,...r,id:s};if(t&&e){const f=a.xloc===Oe.bar_index?t.index:t.time,h=a.xloc===Oe.bar_index?e.index:e.time;Object.assign(a,{x1:f,y1:t.price,x2:h,y2:e.price})}const l=new Ji(s,this._variables);return this._variables.line.add(s,a,l),l}line(t,e){return t.x?t.x:new Ji(e,this._variables)}copy({id:t},e){return t==null?void 0:t.copy(e)}delete({id:t}){t==null||t.delete()}get_x1({id:t},e){return t==null?void 0:t.get_x1(e)}get_x2({id:t},e){return t==null?void 0:t.get_x2(e)}get_y1({id:t},e){return t==null?void 0:t.get_y1(e)}get_y2({id:t},e){return t==null?void 0:t.get_y2(e)}set_x1({id:t,...e},r){t==null||t.set_x1(e,r)}set_x2({id:t,...e},r){t==null||t.set_x2(e,r)}set_y1({id:t,...e},r){t==null||t.set_y1(e,r)}set_y2({id:t,...e},r){t==null||t.set_y2(e,r)}set_xy1({id:t,...e},r){t==null||t.set_xy1(e,r)}set_xy2({id:t,...e},r){t==null||t.set_xy2(e,r)}set_xloc({id:t,...e},r){t==null||t.set_xloc(e,r)}get_price({id:t,...e},r){return t==null?void 0:t.get_price(e,r)}set_color({id:t,...e},r){t==null||t.set_color(e,r)}set_style({id:t,...e},r){t==null||t.set_style(e,r)}set_width({id:t,...e},r){t==null||t.set_width(e,r)}set_extend({id:t,...e},r){t==null||t.set_extend(e,r)}set_first_point({id:t,...e},r){t==null||t.set_first_point(e,r)}set_second_point({id:t,...e},r){t==null||t.set_second_point(e,r)}}class Ji{constructor(t,e){z(this,"_variables");z(this,"_id");this._id=t,this._variables=e}get data(){return this._variables.line.get(this._id)}copy(t){const e=`line_${t}`,r=this._getLine(t),n=new Ji(e,this._variables);return r&&this._variables.line.add(e,{...r,id:e},n),n}delete(){this._variables.line.delete(this._id)}get_price({x:t},e){const r=this._getLine(e);if(t===void 0)return t;if(r&&r.xloc===Oe.bar_index){const{x1:n,y1:s,x2:a,y2:l}=r;return n===void 0||a===void 0||s===void 0||l===void 0?void 0:(l-s)/(a-n)*(t-n)+s}}get_x1(t){var e;return(e=this._getLine(t))==null?void 0:e.x1}get_x2(t){var e;return(e=this._getLine(t))==null?void 0:e.x2}get_y1(t){var e;return(e=this._getLine(t))==null?void 0:e.y1}get_y2(t){var e;return(e=this._getLine(t))==null?void 0:e.y2}set_x1({x:t},e){const r=this._getLine(e);r&&(r.x1=t)}set_x2({x:t},e){const r=this._getLine(e);r&&(r.x2=t)}set_y1({y:t},e){const r=this._getLine(e);r&&(r.y1=t)}set_y2({y:t},e){const r=this._getLine(e);r&&(r.y2=t)}set_xy1({x:t,y:e},r){const n=this._getLine(r);n&&(n.x1=t,n.y1=e)}set_xy2({x:t,y:e},r){const n=this._getLine(r);n&&(n.x2=t,n.y2=e)}set_xloc({xloc:t,x1:e,x2:r},n){const s=this._getLine(n);s&&(s.xloc=t,s.x1=e,s.x2=r)}set_color({color:t},e){const r=this._getLine(e);r&&(r.color=t)}set_style({style:t},e){const r=this._getLine(e);r&&(r.style=t)}set_width({width:t},e){const r=this._getLine(e);r&&(r.width=t)}set_extend({extend:t},e){const r=this._getLine(e);r&&(r.extend=t)}set_first_point({point:t},e){const r=this._getLine(e);if(r){const{index:n,time:s,price:a}=t||{},l=r.xloc===Oe.bar_index?n:s,f=a;l&&(r.x1=l),f&&(r.y1=f)}}set_second_point({point:t},e){const r=this._getLine(e);if(r){const{index:n,time:s,price:a}=t||{},l=r.xloc===Oe.bar_index?n:s,f=a;l&&(r.x2=l),f&&(r.y2=f)}}_getLine(t){const e=this._variables.line.get(this._id);return e||console.log(`${t}: line 不存在`),e}}class zw{constructor(t){z(this,"_variables");this._variables=t}new({line1:t,line2:e,color:r},n){const s=`linefill_${n}`,a=t==null?void 0:t.data,l=e==null?void 0:e.data;a&&(a.linefills=a.linefills||[],a.linefills.push(s)),l&&(l.linefills=l.linefills||[],l.linefills.push(s));const f=new io(this._variables,s,t,e);return(a||l)&&this._variables.linefill.add(s,{line1:a,line2:l,color:r,id:s},f),f}delete({id:t}){t==null||t.delete()}get_line1({id:t}){return t==null?void 0:t.get_line1()}get_line2({id:t}){return t==null?void 0:t.get_line2()}set_color({id:t,...e}){t==null||t.set_color(e)}}class io{constructor(t,e,r,n){z(this,"_id");z(this,"_line1");z(this,"_line2");z(this,"_variables");this._variables=t,this._id=e,this._line1=r,this._line2=n}linefill(t,e){return t.x?t.x:new io(this._variables,e)}delete(){var e,r;const t=this._variables.linefill.get(this._id);if(t){const{line1:n,line2:s}=t;n&&(n.linefills=(e=n.linefills)==null?void 0:e.filter(a=>a!==this._id)),s&&(s.linefills=(r=s.linefills)==null?void 0:r.filter(a=>a!==this._id))}this._line1=void 0,this._line2=void 0,this._variables.linefill.delete(this._id)}get_line1(){return this._line1}get_line2(){return this._line2}set_color({color:t}){const e=this._variables.linefill.get(this._id);e&&(e.color=t)}}class qw{constructor(t){z(this,"_variables");z(this,"_defaultBox",{border_color:wi.blue,border_width:1,bgcolor:wi.blue,xloc:Oe.bar_index,extend:Rn.none,style:Wr.styleSolid,text:"",text_size:jr.auto,text_color:wi.black,text_halign:Xe.alignCenter,text_valign:Xe.alignCenter,text_wrap:Xe.wrapNone});this._variables=t}box({x:t},e){return t===void 0?new Xi(this._variables,e):t}new({top_left:t,bottom_right:e,...r},n){const s=`box_${n}`,a={...this._defaultBox,...r,id:s};if(t){const{price:f,time:h,index:p}=t;a.top=f,a.left=a.xloc===Oe.bar_index?p:h}if(e){const{price:f,time:h,index:p}=e;a.bottom=f,a.right=a.xloc===Oe.bar_index?p:h}const l=new Xi(this._variables,s);return this._variables.box.add(s,a,l),l}copy({id:t},e){return t==null?void 0:t.copy(e)}delete({id:t}){t==null||t.delete()}get_top({id:t}){return t==null?void 0:t.get_top()}get_bottom({id:t}){return t==null?void 0:t.get_bottom()}get_left({id:t}){return t==null?void 0:t.get_left()}get_right({id:t}){return t==null?void 0:t.get_right()}set_top({id:t,...e}){t==null||t.set_top(e)}set_bottom({id:t,...e}){t==null||t.set_bottom(e)}set_left({id:t,...e}){t==null||t.set_left(e)}set_right({id:t,...e}){t==null||t.set_right(e)}set_extend({id:t,...e}){t==null||t.set_extend(e)}set_bgcolor({id:t,...e}){t==null||t.set_bgcolor(e)}set_border_color({id:t,...e}){t==null||t.set_border_color(e)}set_border_width({id:t,...e}){t==null||t.set_border_width(e)}set_border_style({id:t,...e}){t==null||t.set_border_style(e)}set_lefttop({id:t,...e}){t==null||t.set_lefttop(e)}set_rightbottom({id:t,...e}){t==null||t.set_rightbottom(e)}set_text_size({id:t,...e}){t==null||t.set_text_size(e)}set_text_wrap({id:t,...e}){t==null||t.set_text_wrap(e)}set_text_color({id:t,...e}){t==null||t.set_text_color(e)}set_text_halign({id:t,...e}){t==null||t.set_text_halign(e)}set_text_valign({id:t,...e}){t==null||t.set_text_valign(e)}set_top_left_point({id:t,...e}){t==null||t.set_top_left_point(e)}set_bottom_right_point({id:t,...e}){t==null||t.set_bottom_right_point(e)}set_text_font_family({id:t,...e}){t==null||t.set_text_font_family(e)}}class Xi{constructor(t,e){z(this,"_id");z(this,"_variables");this._variables=t,this._id=e}copy(t){const e=`box_${t}`,r=this._getBox(),n=new Xi(this._variables,e);return r&&this._variables.box.add(e,{...r,id:e},n),n}delete(){this._variables.box.delete(this._id)}get_top(){const t=this._getBox();return t&&t.top}set_top({top:t}){const e=this._getBox();e&&(e.top=t)}get_left(){const t=this._getBox();return t&&t.left}set_left({left:t}){const e=this._getBox();e&&(e.left=t)}set_text({text:t}){const e=this._getBox();e&&(e.text=t)}get_right(){const t=this._getBox();return t&&t.right}set_right({right:t}){const e=this._getBox();e&&(e.right=t)}get_bottom(){const t=this._getBox();return t&&t.bottom}set_bottom({bottom:t}){const e=this._getBox();e&&(e.bottom=t)}set_extend({extend:t}){const e=this._getBox();e&&(e.extend=t)}set_bgcolor({color:t}){const e=this._getBox();e&&(e.bgcolor=t)}set_lefttop({left:t,top:e}){const r=this._getBox();r&&(r.left=t,r.top=e)}set_text_size({text_size:t}){const e=this._getBox();e&&(e.text_size=t)}set_text_wrap({text_wrap:t}){const e=this._getBox();e&&(e.text_wrap=t)}set_text_color({text_color:t}){const e=this._getBox();e&&(e.text_color=t)}set_rightbottom({right:t,bottom:e}){const r=this._getBox();r&&(r.right=t,r.bottom=e)}set_text_halign({text_halign:t}){const e=this._getBox();e&&(e.text_halign=t)}set_text_valign({text_valign:t}){const e=this._getBox();e&&(e.text_valign=t)}set_top_left_point({point:t}){const e=this._getBox();if(e){const{index:r,price:n,time:s}=t||{};e.top=n,e.left=e.xloc===Oe.bar_index?r:s}}set_border_color({color:t}){const e=this._getBox();e&&(e.border_color=t)}set_border_style({style:t}){const e=this._getBox();e&&(e.border_style=t)}set_border_width({width:t}){const e=this._getBox();e&&(e.border_width=t)}set_bottom_right_point({point:t}){const e=this._getBox();if(e){const{index:r,price:n,time:s}=t||{};e.bottom=n,e.right=e.xloc===Oe.bar_index?r:s}}set_text_font_family({text_font_family:t}){const e=this._getBox();e&&(e.text_font_family=t)}_getBox(){return this._variables.box.get(this._id)}}class kw{constructor(t){z(this,"_variables");z(this,"_defaultTable",{position:Tr.topLeft,columns:0,rows:0,frame_width:0,border_width:0});this._variables=t}table({x:t},e){return t||new Ra(this._variables,e)}new(t,e){const r=`table_${e}`,n={...this._defaultTable,...t,cell:[],id:r},s=new Ra(this._variables,r);return this._variables.table.add(r,n,s),s}cell({table_id:t,...e}){t==null||t.cell(e)}cell_set_bgcolor({table_id:t,...e}){t==null||t.cell_set_bgcolor(e)}cell_set_height({table_id:t,...e}){t==null||t.cell_set_height(e)}cell_set_text({table_id:t,...e}){t==null||t.cell_set_text(e)}cell_set_text_color({table_id:t,...e}){t==null||t.cell_set_text_color(e)}cell_set_text_font_family({table_id:t,...e}){t==null||t.cell_set_text_font_family(e)}cell_set_text_halign({table_id:t,...e}){t==null||t.cell_set_text_halign(e)}cell_set_text_valign({table_id:t,...e}){t==null||t.cell_set_text_valign(e)}cell_set_text_size({table_id:t,...e}){t==null||t.cell_set_text_size(e)}cell_set_tooltip({table_id:t,...e}){t==null||t.cell_set_tooltip(e)}cell_set_width({table_id:t,...e}){t==null||t.cell_set_width(e)}clear({table_id:t,...e}){t==null||t.clear(e)}delete({table_id:t}){t==null||t.delete()}merge_cells({table_id:t,...e},r){t==null||t.merge_cells(e,r)}set_bgcolor({table_id:t,...e}){t==null||t.set_bgcolor(e)}set_border_color({table_id:t,...e}){t==null||t.set_border_color(e)}set_border_width({table_id:t,...e}){t==null||t.set_border_width(e)}set_frame_color({table_id:t,...e}){t==null||t.set_frame_color(e)}set_frame_width({table_id:t,...e}){t==null||t.set_frame_width(e)}set_position({table_id:t,...e}){t==null||t.set_position(e)}}class Ra{constructor(t,e){z(this,"_id");z(this,"_variables");z(this,"_defaultCell",{column:0,row:0,text:"",text_color:wi.black,text_halign:Xe.alignCenter,text_valign:Xe.alignCenter,text_size:jr.normal});this._variables=t,this._id=e}cell(t){const e={...this._defaultCell,...t},{column:r=0,row:n=0}=e,s=this._variables.table.get(this._id);if(s){const a=s.cell||[],l=a[n]||[];l[r]=e,a[n]=l,s.cell=a}}cell_set_bgcolor({column:t=0,row:e=0,bgcolor:r}){const n=this._getTableItem(t,e);n&&(n.bgcolor=r)}cell_set_height({column:t=0,row:e=0,height:r}){const n=this._getTableItem(t,e);n&&(n.height=r)}cell_set_text({column:t=0,row:e=0,text:r}){const n=this._getTableItem(t,e);n&&(n.text=r)}cell_set_text_color({column:t=0,row:e=0,text_color:r}){const n=this._getTableItem(t,e);n&&(n.text_color=r)}cell_set_text_font_family({column:t=0,row:e=0,text_font_family:r}){const n=this._getTableItem(t,e);n&&(n.text_font_family=r)}cell_set_text_halign({column:t=0,row:e=0,text_halign:r}){const n=this._getTableItem(t,e);n&&(n.text_halign=r)}cell_set_text_valign({column:t=0,row:e=0,text_valign:r}){const n=this._getTableItem(t,e);n&&(n.text_valign=r)}cell_set_text_size({column:t=0,row:e=0,text_size:r}){const n=this._getTableItem(t,e);n&&(n.text_size=r)}cell_set_tooltip({column:t=0,row:e=0,tooltip:r}){const n=this._getTableItem(t,e);n&&(n.tooltip=r)}cell_set_width({column:t=0,row:e=0,width:r}){const n=this._getTableItem(t,e);n&&(n.width=r)}clear({start_column:t=0,start_row:e=0,end_column:r=0,end_row:n=0}){const s=this._variables.table.get(this._id);if(s){const a=s.cell;if(a)for(let l=e;l<=n;l++)for(let f=t;f<=r;f++){const h=a[l];h&&(h[f]=void 0)}}}delete(){this._variables.table.delete(this._id)}merge_cells({start_column:t=0,start_row:e=0,end_column:r=0,end_row:n=0},s){if(t>r||e>n){console.log(`error ${s}: start_column > end_column or start_row > end_row`);return}const a=this._getTableItem(t,e);if(!a)return;this.clear({start_column:t,start_row:e,end_column:r,end_row:n});const l=this._variables.table.get(this._id);l.cell[e][t]={...a,isMerge:!0,merge_columns:r-t+1,merge_rows:n-e+1}}set_bgcolor({bgcolor:t}){const e=this._variables.table.get(this._id);e&&(e.bgcolor=t)}set_border_color({border_color:t}){const e=this._variables.table.get(this._id);e&&(e.border_color=t)}set_border_width({border_width:t}){const e=this._variables.table.get(this._id);e&&(e.border_width=t)}set_frame_color({frame_color:t}){const e=this._variables.table.get(this._id);e&&(e.frame_color=t)}set_frame_width({frame_width:t}){const e=this._variables.table.get(this._id);e&&(e.frame_width=t)}set_position({position:t}){const e=this._variables.table.get(this._id);e&&(e.position=t)}_getTableItem(t,e){const r=this._variables.table.get(this._id);if(r){const n=r.cell;return n?n[e][t]:void 0}}}class Uw{constructor(t){z(this,"_strategy");this._strategy=t}commission({trade_num:t}){return this._verifyTradeNum(t)&&this._strategy.historyOrders[t].commission||0}entry_bar_index({trade_num:t}){if(this._verifyTradeNum(t))return this._strategy.historyOrders[t].in_index}entry_comment({trade_num:t}){if(!this._verifyTradeNum(t))return"";const{comment:e,id:r}=this._strategy.historyOrders[t];return e||r}entry_id({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.historyOrders[t].id:""}entry_price({trade_num:t}){if(this._verifyTradeNum(t))return this._strategy.historyOrders[t].in_price}entry_time({trade_num:t}){if(this._verifyTradeNum(t))return this._strategy.historyOrders[t].in_time}exit_bar_index({trade_num:t}){if(this._verifyTradeNum(t))return this._strategy.historyOrders[t].out_index}exit_comment({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.historyOrders[t].out_comment:""}exit_id({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.historyOrders[t].out_id:""}exit_price({trade_num:t}){if(this._verifyTradeNum(t))return this._strategy.historyOrders[t].out_price}exit_time({trade_num:t}){if(this._verifyTradeNum(t))return this._strategy.historyOrders[t].out_time}max_drawdown({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.historyOrders[t].trading_loss:0}max_drawdown_percent({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.historyOrders[t].trading_loss_percent:0}max_runup({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.historyOrders[t].max_profit:0}max_runup_percent({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.historyOrders[t].max_profit_percent:0}profit({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.historyOrders[t].profit:0}profit_percent({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.historyOrders[t].profit_percent:0}size({trade_num:t}){if(!this._verifyTradeNum(t))return 0;const{out_qty:e=0,direction:r}=this._strategy.historyOrders[t];return r===pe.long?e:-e}_verifyTradeNum(t){if(typeof t!="number"||t<0)return!1;const e=this._strategy.historyOrders.length;return!(t>=e)}}class Ww{constructor(t){z(this,"_strategy");this._strategy=t}commission({trade_num:t}){if(!this._verifyTradeNum(t))return 0;const{qty:e=0,original_qty:r=0,commission:n=0}=this._strategy.orders[t];return n*e/r}entry_bar_index({trade_num:t}){if(this._verifyTradeNum(t))return this._strategy.orders[t].in_index}entry_comment({trade_num:t}){if(!this._verifyTradeNum(t))return"";const{comment:e,id:r}=this._strategy.orders[t];return e||r}entry_id({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.orders[t].id:""}entry_price({trade_num:t}){if(this._verifyTradeNum(t))return this._strategy.orders[t].in_price}entry_time({trade_num:t}){if(this._verifyTradeNum(t))return this._strategy.orders[t].in_time}max_drawdown({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.orders[t].trading_loss:0}max_drawdown_percent({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.orders[t].trading_loss_percent:0}max_runup({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.orders[t].max_profit:0}max_runup_percent({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.orders[t].max_profit_percent:0}profit({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.orders[t].profit:0}profit_percent({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.orders[t].profit_percent:0}size({trade_num:t}){if(!this._verifyTradeNum(t))return 0;const{qty:e=0,direction:r}=this._strategy.orders[t];return r===pe.long?e:-e}_verifyTradeNum(t){if(typeof t!="number"||t<0)return!1;const e=this._strategy.orders.length;return!(t>=e)}}class jw{constructor(t){z(this,"_strategy");this._strategy=t}allow_entry_in({value:t}){this._strategy.updateRisk({allow_entry_in:t})}max_cons_loss_days({count:t}){this._strategy.updateRisk({max_cons_loss_days:t})}max_drawdown({value:t,type:e}){e===Ge.percentOfEquity&&(t=t>100?100:t),this._strategy.updateRisk({max_drawdown:t,max_drawdown_type:e})}max_intraday_filled_orders({count:t}){this._strategy.updateRisk({max_intraday_filled_orders:t})}max_intraday_loss({value:t,type:e}){e===Ge.percentOfEquity&&(t=t>100?100:t),this._strategy.updateRisk({max_intraday_loss:t,max_intraday_loss_type:e})}max_position_size({contracts:t}){this._strategy.updateRisk({max_position_size:t})}}let Yw=class{constructor(t,e,r,n){z(this,"_variables");z(this,"_options");z(this,"_totalChangeCapital");z(this,"_historyOrder");z(this,"_orders");z(this,"_pendingOrders");z(this,"_mintick");z(this,"_funcOptions");z(this,"_pendingCloseOrders");z(this,"_errorListener");z(this,"_risk");z(this,"_opentrades");z(this,"_closedtrades");z(this,"_riskNamespace");this._variables=t,this._errorListener=n,this._options={overlay:!1,format:Pn.inherit,pyramiding:0,calc_on_order_fills:!1,calc_on_every_tick:!1,max_bars_back:0,backtest_fill_limits_assumption:0,default_qty_type:Ge.fixed,default_qty_value:1,initial_capital:1e6,currency:Yc.NONE,slippage:0,commission_type:Ir.percent,commission_value:0,process_orders_on_close:!1,close_entries_rule:"FIFO",margin_long:0,margin_short:0,explicit_plot_zorder:!1,max_lines_count:50,max_labels_count:50,max_boxes_count:50,calc_bars_count:0,risk_free_rate:2,use_bar_magnifier:!1,fill_orders_on_standard_ohlc:!1,max_polylines_count:50},this._funcOptions=e,this._totalChangeCapital=0,this._orders=[],this._pendingOrders=[],this._historyOrder=[],this._pendingCloseOrders=[],this._mintick=r,this._variables.strategy.updateOrders(this._orders),this._variables.strategy.updateHistoryOrders(this._historyOrder),this._variables.strategy.updateStrategyOptions(this._options),this._risk={intradayOrders:0},this._opentrades=new Ww(this),this._closedtrades=new Uw(this),this._riskNamespace=new jw(this)}get orders(){return[...this._orders]}get historyOrders(){return[...this._historyOrder]}get _orderProfit(){return this._orders.reduce((t,e)=>t+(e.profit||0),0)}get _freezeCapital(){const{close:t}=this._variables;return this._orders.reduce((e,r)=>e+t*(r.qty||0),0)}get opentrades(){return this._opentrades}get closedtrades(){return this._closedtrades}get risk(){return this._riskNamespace}updateOptions(t){Object.assign(this._options,t),this._maxConsLossDaysVerify(),this._pendingOrderHandle(),this._maxIntradayFilledOrdersVerify(),this._ordersHandle(),!this._options.process_orders_on_close&&this._calcLiquidate()}updateRisk(t){Object.assign(this._risk,t)}endExecution(){this._calcProfitAndLoss(),this._variables.strategy.update(),this._maxDrawdownVerify(),this._maxIntradayLoss(),this._pendingCloseOrderHandle(),this._options.process_orders_on_close&&this._calcLiquidate()}_maxIntradayLoss(){var g;const{max_intraday_loss:t,max_intraday_loss_type:e,isDisabledOpen:r}=this._risk;if(t===void 0||!e||r)return;const{high:n,low:s,time_tradingday:a,time:l,strategy:{netprofit:f,initial_capital:h}}=this._variables;let{preNetprofit:p=0}=this._risk;l===a&&(p=f,this._risk.preNetprofit=f,this._risk.isTemporaryBan=!1);let c=p-f;c+=this._orders.reduce((w,m)=>{const{in_price:D,direction:v,qty:E=0,commission:b=0,original_qty:N=0}=m,x=v===pe.long?1:-1,F=(n-D)*E,M=(s-D)*E,S=x===1?-M:F;return w+S+E/N*b},0);let d=!1;switch(e){case Ge.cash:d=t<c;break;case Ge.percentOfEquity:const w=c/(h+f)*100;d=t<w;break}if(d){this._risk.isTemporaryBan=!0;const w=(g=this._orders[0])==null?void 0:g.direction;this._closeOrders(this._orders,w===pe.long?s:n,"Close Position (Max intraday Loss)"),this._pendingOrders=[]}}_maxIntradayFilledOrdersVerify(){const{max_intraday_filled_orders:t,intradayOrders:e=0,isDisabledOpen:r}=this._risk;if(t===void 0||r)return;const{time:n,time_tradingday:s,open:a}=this._variables;n===s&&(this._risk.intradayOrders=0,this._risk.isTemporaryBan=!1),t<=e&&(this._risk.isTemporaryBan=!0,this._closeOrders(this._orders,a,"Close Position (Max number of filled orders in one day)"),this._pendingOrders=[])}_maxConsLossDaysVerify(){const{max_cons_loss_days:t,lossDays:e=0,isDisabledOpen:r,totalProfit:n=0}=this._risk;if(t===void 0||r)return;const{time:s,time_tradingday:a,strategy:l,open:f}=this._variables;let h=e;if(s===a){const p=l.netprofit+l.openprofit;p<n?h=0:h++,Object.assign(this._risk,{lossDays:h,totalProfit:p})}t<=h&&this._riskTouchOff(f,"Close Position (Max consecutive loss days)")}_maxDrawdownVerify(){var n;const{max_drawdown:t,max_drawdown_type:e,isDisabledOpen:r}=this._risk;if(!r&&t!==void 0&&e){const{max_drawdown:s,max_drawdown_percent:a}=this._variables.strategy;let l=!1;switch(e){case Ge.percentOfEquity:l=a<s;break;case Ge.cash:l=t<s;break}if(l){const{high:f,low:h}=this._variables,p=(n=this._orders[0])==null?void 0:n.direction;this._riskTouchOff(p===pe.long?f:h,"Close Position (Max Drawdown)")}}}_riskTouchOff(t,e){this._risk.isDisabledOpen=!0,this._closeOrders(this._orders,t,e),this._pendingOrders=[]}strategy(t){this._options={...t},Object.assign(this._funcOptions,{strategy:this._options,scriptType:"strategy"})}order(t){this._risk.isDisabledOpen||this._orderHandle(t)}entry(t){this._risk.isDisabledOpen||this._entryHandle(t)}close(t){if(!this._orders.length)return;const{immediately:e}=t;e||this._options.process_orders_on_close?this._pendingCloseOrders.push({...t,place_order_type:"close"}):this._pendingOrders.push({...t,place_order_type:"close"})}close_all(t){if(typeof t=="string"&&(t={}),!this._orders.length)return;const{immediately:e}=t;e||this._options.process_orders_on_close?this._pendingCloseOrders.push({...t,place_order_type:"close_all"}):this._pendingOrders.push({...t,place_order_type:"close_all"})}cancel({id:t}){this._pendingOrders=this._pendingOrders.filter(e=>!(e.id===t&&e.place_order_type!=="close"))}cancel_all(){this._pendingOrders=this._pendingOrders.filter(t=>t.place_order_type==="close_all")}exit(t,e){this._exit(t,e)}convert_to_account({value:t}){return t}convert_to_symbol({value:t}){return t}default_entry_qty({fill_price:t}){return t?this._calcDefaultQty(t):0}_calcDefaultQty(t){const{default_qty_type:e=Ge.fixed,default_qty_value:r=1,initial_capital:n}=this._options;switch(e){case Ge.fixed:return r;case Ge.cash:return r/t;case Ge.percentOfEquity:return(n+this._orderProfit+this._totalChangeCapital)*r/100/t}}_getCapital(t,e){const{margin_long:r=0,margin_short:n=0}=this._options;return r<100&&r>0&&t===1?e=e*100/r:n<=100&&n>0&&t===-1&&(e=e*100/n),e}_calcProfitAndLoss(){const{high:t,low:e,close:r}=this._variables;for(const n of this._orders){const{in_price:s,qty:a=0,direction:l}=n,f=l===pe.long?1:-1,h=(r-s)*f*a,p=(t-s)*a,c=(e-s)*a,d=f===1?p:-c,g=f===1?-c:p;this._calcOrderPercent(n,h,d,g)}}_calcOrderPercent(t,e,r,n){const{commission_value:s}=this._options,{close:a}=this._variables,{original_qty:l=0,qty:f=0,in_price:h,max_profit:p=0,trading_loss:c=0}=t;let{commission:d=0}=t;const g=h*f;if(s){const w=this._getCommission(a,f);e=e-w,d=d*f/l,r-=d,n+=d}r=Math.max(r,p),n=Math.min(n,c),Object.assign(t,{profit:e-d,total_profit:this._totalChangeCapital+e,max_profit:r,trading_loss:n,profit_percent:e/g*100,max_profit_percent:r/g*100,trading_loss_percent:n/g*100})}_calcLiquidate(){if(!this._orders.length)return;const{high:t,low:e}=this._variables,{initial_capital:r,margin_long:n=0,margin_short:s=0,commission_value:a=0}=this._options,l=this._orders[0].direction===pe.long?1:-1,f=l===1?e:t,h=(l===1?n:s)/100;if(h<=0)return;const[p,c,d]=this._orders.reduce((v,E)=>{let[b,N,x]=v;const{in_price:F,qty:M=0,original_qty:S=0,commission:O=0}=E,C=F*M,T=f*M;if(b+=C,N+=T,a){const L=this._getCommission(f,M);x+=L+M/S*O}return[b,N,x]},[0,0,0]),g=l*(c-p),m=r+this._totalChangeCapital+g-d-c*h;if(m>=0)return;const D=Math.trunc(m/h/f)*4;this._marginCallOrders(f,D,"Margin Call")}_marginCallOrders(t,e,r){const{close_entries_rule:n="FIFO"}=this._options;if(n==="FIFO"){this._processOrders(this._orders,t,e*this._orders.length,r,r);return}for(const s of this.orders)this._processOrder(s,t,e,r,r);this._orders=this._orders.filter(s=>!s.isDeal),this._variables.strategy.updateOrders(this._orders)}_orderHandle(t){const{process_orders_on_close:e,slippage:r=0}=this._options,{orders:n,isMarketPrice:s,quantities:a,close:l,price:f,activePrice:h}=this._orderArgsParse(t),p=t.direction===pe.long?1:-1;if(a<=0)return;let c=a;if(s&&e){if(n.length){const m=this._processOrders(n,l,c,t.id,t.comment);if(m<=0)return;c=m}const g=l+p*r*this._mintick;if(!this._judgeCapitalEnough(c,g,p))return;this._ocaGroupVerify(c,t.oca_name,t.oca_type),this._calcCurrentOrder({...t,in_price:g,in_index:this._variables.bar_index,in_time:this._variables.time,qty:c,place_order_type:"order"});return}this._judgeCapitalEnough(a,f,p)&&this._addPendingOrders(t,f,c,s,h)}_judgeCapitalEnough(t,e,r){if(t<=0)return!1;const{margin_long:n=0,margin_short:s=0}=this._options;if((n===0||n===100)&&r===1||s===0&&r===-1)return!0;const l=this._getCapital(r,this._options.initial_capital+this._orderProfit+this._totalChangeCapital)-this._freezeCapital;return t*e<=l}_ocaGroupVerify(t,e,r){if(!e||!r||r===qn.none)return!1;let n=!1;switch(r){case qn.cancel:this._pendingOrders=this._pendingOrders.filter(s=>{if(s.oca_name===e)s.isCancel=!0,n=!0;else return!0});break;case qn.reduce:this._pendingOrders=this._pendingOrders.filter(s=>{const{qty:a=0,oca_name:l}=s;if(e===l){const f=a-t;return n=!0,f<=0?(s.isCancel=!0,!1):(s.qty=f,!0)}else return!0});break}return n}_processOrders(t,e,r,n,s){let a=r;for(const l of t)if(a=this._processOrder(l,e,a,n,s),a<=0)break;return this._orders=this._orders.filter(l=>!l.isDeal),this._variables.strategy.updateOrders(this._orders),a}_addPendingOrders(t,e,r,n,s){const a=this._pendingOrders.find(l=>l.id===t.id&&!l.isMarketPrice);if(a)Object.assign(a,{...t,in_price:e,isMarketPrice:n,qty:r,active_price:s});else{const l={...t,in_price:e,isMarketPrice:n,qty:r,active_price:s,place_order_type:"order"};this._pendingOrders.push(l)}}_orderArgsParse(t){const{direction:e,qty:r,stop:n}=t;let s=t.limit||0;const{close:a}=this._variables;let l=a,f=!1,h;const p=e===pe.long?1:-1,c=n&&(n-a)*p>0,{backtest_fill_limits_assumption:d=0}=this._options;d>0&&s&&(s-=d*this._mintick*p);const g=s&&(s-a)*p<0;c&&g?(h=n,l=s):c?l=n:g?l=s:f=!0;const w=r||this._calcDefaultQty(l)||1;return{orders:this._orders.filter(D=>D.direction!==e),isMarketPrice:f,activePrice:h,quantities:w,close:a,price:l}}_entryHandle(t){const{process_orders_on_close:e}=this._options,{orders:r,isMarketPrice:n,quantities:s,close:a,price:l,activePrice:f}=this._orderArgsParse(t);if(s<=0)return;if(r.length&&n&&e){this._entryOrder(r,a,s,t);return}this._judgeCapitalEnough(s,a,t.direction===pe.long?1:-1)&&this._addPendingEntry(t,l,s,n,f)}_entryOrder(t,e,r,n){const{time:s,bar_index:a}=this._variables,{slippage:l=0}=this._options,{oca_name:f,oca_type:h,direction:p,comment:c,isMarketPrice:d,id:g}=n,w=p===pe.long?1:-1;if(this._closeOrders(t,e,g,c),r=this._getAvailablePositionSize(r,p),r<=0)return;e=e+l*this._mintick*w;const m={...n,in_price:e,original_qty:r,qty:r,in_index:a,in_time:s,place_order_type:"entry"};if(d){this._calcCurrentOrder(m);return}const{pendingOrders:D,orders:v}=this._getEntryOrders(p),E=D.length+v.length;E&&E>=(this._options.pyramiding||0)||!this._judgeCapitalEnough(r,e,w)||(this._ocaGroupVerify(r,f,h),this._calcCurrentOrder(m))}_getAvailablePositionSize(t,e){const{max_position_size:r,allow_entry_in:n}=this._risk;if(n&&n!==pe.all&&n!==e)return 0;if(r===void 0)return t;const s=this._orders.reduce((a,l)=>a+(l.qty||0),0);return s?s+t>r?0:t:t>r?t-r:0}_getEntryOrders(t){const e=this._pendingOrders.filter(n=>["entry","order"].includes(n.place_order_type)&&n.direction===t),r=this._orders.filter(n=>n.direction===t);return{pendingOrders:e,orders:r}}_addPendingEntry(t,e,r,n,s){if(r=this._getAvailablePositionSize(r,t.direction),r<=0)return;const{pendingOrders:a,orders:l}=this._getEntryOrders(t.direction),f=a.length+l.length,h=a.find(p=>p.id===t.id&&p.place_order_type==="entry");if(h)Object.assign(h,{...t,in_price:e,isMarketPrice:n,qty:r,active_price:s});else if(!f||f<(this._options.pyramiding||1)){const p={...t,in_price:e,isMarketPrice:n,qty:r,active_price:s,place_order_type:"entry"};this._pendingOrders.push(p)}}_closeAllOrders(t,e){const{comment:r}=t,{bar_index:n}=this._variables,s=this._orders.filter(a=>a.in_index!==n);s.length&&(this._closeOrders(s,e,"Close position order",r),this._orders=[],this._variables.strategy.updateOrders(this._orders))}_closeOrders(t,e,r,n){for(const s of t)this._closeOrder(s,e,r,n);this._orders=this._orders.filter(s=>!s.isDeal),this._variables.strategy.updateOrders(this._orders)}_closeOrder(t,e,r,n){const{time:s,bar_index:a}=this._variables,{slippage:l=0}=this._options,{in_price:f,qty:h=0,direction:p}=t,c=p===pe.long?1:-1;e=e-c*l*this._mintick,t.isDeal=!0;const d=(e-f)*c*h,g={...t,out_price:e,out_id:r,out_index:a,out_time:s,out_comment:n,out_qty:h,profit:d};this._calcPercent(g),this._risk.intradayOrders+=1,this._historyOrder.push(g),this._variables.strategy.updateHistoryOrders(this._historyOrder)}_ordersHandle(){const t=this._orders.filter(a=>a.place_order_type==="exit"&&!a.hasExit);if(!t.length)return;const{open:e,low:r,high:n,close:s}=this._variables;for(const a of t){const{stop:l,limit:f,trail_stop_price:h,isMarketPriceLimit:p,isMarketPriceStop:c,direction:d,id:g,out_comment:w,active_price:m,trail_offset:D=0,out_qty:v,comment_loss:E,comment_profit:b,comment_trailing:N}=a;let x=h;const F=d===pe.long?1:-1;let M,S=w;if(p||c?M=e:(f&&r<=f&&n>=f&&(S=b||w,M=f),l&&r<=l&&n>=l&&(M=x?(l-x)*F>0?l:x:l,S=(x===M?N:E)||w)),M)this._processExitOnClose(a,M,{from_entry:g,comment:S,qty:v});else{let O=!1;if(m&&m<=n&&m>=r&&(x=m-D*F*this._mintick,(x-s)*F>=0&&(a.isMarketPriceStop=!0,this._options.process_orders_on_close&&(M=x)),O=!0,a.trail_stop_price=x),x)if((x-e)*F>=0&&!O)M=x;else{const C=(F===1?n:r)-D*F*this._mintick;F===1?x<e&&x>=r&&C>x&&C<s?M=x:C>x?(x=C,C>=s&&(M=C)):x<=n&&r<=x&&(M=x):x>e&&x<=n&&C<x&&C>s?M=x:C<x?(x=C,C<=s&&(M=C)):x<=n&&r<=x&&(M=x),a.trail_stop_price=x}M&&this._processExitOnClose(a,M,{from_entry:g,comment:N||w,qty:v})}}}_pendingOrderHandle(){if(!this._pendingOrders.length)return;const t=[],e=this._pendingOrders.filter(n=>n.place_order_type==="exit"),r=this._pendingOrders.filter(n=>["close","close_all"].includes(n.place_order_type||""));for(const n of r)switch(n.place_order_type){case"close":this._closeOrderHandle(n);break;case"close_all":this._closeAllOrders(n,this._variables.open);break}for(const n of this._pendingOrders){const{isCancel:s,place_order_type:a}=n;if(s)continue;let l;switch(a){case"entry":l=this._entryOrderHandle(n);break;case"order":l=this._orderOrderHandle(n);break}l&&t.push(l)}for(const n of e){const s=this._exitOrderHandle(n);s&&t.push(s)}this._pendingOrders=t}_pendingCloseOrderHandle(){if(!this._pendingCloseOrders.length)return;const t=this._pendingCloseOrders.filter(n=>n.place_order_type==="exit"),e=this._pendingCloseOrders.filter(n=>["close","close_all"].includes(n.place_order_type||"")),{close:r}=this._variables;for(const n of e)switch(n.place_order_type){case"close":this._closeOrderHandle(n,!0);break;case"close_all":this._closeAllOrders(n,r);break}for(const n of t){const{from_entry:s}=n,a=this._orders.filter(l=>!s||l.id===s&&(l.isMarketPriceLimit||l.isMarketPriceStop));for(const l of a)this._processExitOnClose(l,l.limit||l.stop||l.trail_stop_price||r,n)}this._pendingCloseOrders=[]}_entryOrderHandle(t){const{open:e,low:r,high:n}=this._variables,{isMarketPrice:s,qty:a=0,in_price:l,direction:f,active_price:h}=t;if(h&&n>=h&&r<=h)return delete t.active_price,t;let p=l;if(s&&(p=e),p<=n&&p>=r){const c=this._orders.filter(d=>d.direction!==f);this._entryOrder(c,p,a,t)}else return t}_orderOrderHandle(t){const{open:e,low:r,high:n,time:s,bar_index:a}=this._variables,{slippage:l=0}=this._options,{isMarketPrice:f,qty:h=0,in_price:p,direction:c,comment:d,oca_name:g,oca_type:w,active_price:m,id:D}=t;if(m&&n>=m&&r<=m)return delete t.active_price,t;let v=p,E=h;if(f&&(v=e),v<=n&&v>=r){const b=this._orders.filter(x=>x.direction!==c);if(b.length&&(E=this._processOrders(b,v,h,D,d),E<=0))return;const N=c===pe.long?1:-1;this._ocaGroupVerify(E,g,w),this._calcCurrentOrder({...t,in_price:v+N*l*this._mintick,in_index:a,in_time:s,qty:E});return}else return t}_closeOrderHandle(t,e){const{id:r,qty:n,qty_percent:s=100,comment:a}=t,{bar_index:l}=this._variables,f=this._orders.filter(g=>g.id===r&&g.in_index!==l&&(!g.close_qty||g.close_qty<(g.qty||0)));if(!f.length)return;let h=0;if(n?h=n:(h=f.reduce((g,w)=>g+(w.qty||0),h),h=s/100*h),h<=0)return;const{open:p,close:c}=this._variables;let d=h;for(const g of f){const{qty:w=0}=g;d<w?g.close_qty=d:(g.close_qty=w,d-=w)}this._processOrders(this._options.close_entries_rule==="ANY"?f:this._orders,e?c:p,h,`Close entry(s) order ${r}`,a)}_exitOrderHandle(t){const{from_entry:e}=t,r=this._orders.filter(n=>(!e||e===n.id)&&!n.hasExit);if(!(r.length&&!this._ordersToExit(r,t)))return t}_exit(t,e){const{profit:r,loss:n,stop:s,limit:a,trail_offset:l,trail_price:f,trail_points:h,from_entry:p="",id:c}=t;if(this._isNaN(r)&&this._isNaN(n)&&this._isNaN(s)&&this._isNaN(a)&&(this._isNaN(l)||this._isNaN(h)&&this._isNaN(f))){this._errorListener.addError("strategy.exit must have at least one of the following parameters: 'profit', 'limit', 'loss', 'stop' or one of the following pairs: 'trail_offset' and 'trail_price' / 'trail_points'. To close the position at market price, use 'strategy.close'",e,Re.Error);return}const d={...t,place_order_type:"exit"},g=this._orders.filter(D=>(!p||p===D.id)&&!D.hasExit),w=this._pendingOrders.filter(D=>!p||p===D.id);if(g.length){if(!this._ordersToExit(g,d))return}else if(!w.length)return;const m=this._pendingOrders.find(D=>D.id===c);m?Object.assign(m,{...t}):this._pendingOrders.push(d)}_ordersToExit(t,e){const{qty:r,qty_percent:n=100,id:s,comment:a,comment_loss:l,comment_profit:f,comment_trailing:h}=e;let p=r,c=!1;e.comment=a||s;for(const d of t){const{qty:g=0}=d,w=d.direction===pe.long?1:-1;p=r?r>=g?g:r:n/100*g,d.out_qty=p,p<g&&(c=!0),Object.assign(d,{out_comment:a||s,comment_loss:l,comment_profit:f,comment_trailing:h}),!(this._stopProfit(d,w,{...e,qty:p})||this._stopLoss(d,w,{...e,qty:p})||this._trailStopLoss(d,w,{...e,qty:p}))&&(d.place_order_type="exit")}return c}_addExitPendingCloseOrders(t){t.place_order_type="exit";const e=this._pendingCloseOrders.find(r=>r.id===t.id);e?Object.assign(e,{...t}):this._pendingCloseOrders.push(t)}_stopProfit(t,e,r){const{limit:n,profit:s,comment_profit:a,comment:l}=r;let f=n;const{close:h}=this._variables,{in_price:p}=t,{process_orders_on_close:c}=this._options;if(!this._isNaN(s)&&this._isNaN(n)&&(f=p+e*s*this._mintick),t.limit=f,f&&(f-h)*e<=0&&(t.isMarketPriceLimit=!0,r.comment=a||l,Object.assign(t,{out_comment:r.comment}),f=h,c))return this._addExitPendingCloseOrders(r),!0}_stopLoss(t,e,r){const{stop:n,loss:s,comment_loss:a,comment:l}=r;let f=n;const{close:h}=this._variables,{in_price:p}=t,{process_orders_on_close:c}=this._options;if(!this._isNaN(s)&&this._isNaN(n)&&(f=p-e*s*this._mintick),t.stop=f,f&&(f-h)*e>=0&&(t.isMarketPriceStop=!0,r.comment=a||l,Object.assign(t,{out_comment:r.comment}),f=h,c))return this._addExitPendingCloseOrders(r),!0}_trailStopLoss(t,e,r){const{trail_offset:n,trail_price:s,trail_points:a,comment_trailing:l,comment:f}=r;if(!this._isNaN(n)){const{close:h}=this._variables,{in_price:p}=t,{process_orders_on_close:c}=this._options;let d;if(this._isNaN(s)?this._isNaN(a)||(d=p+a*e*this._mintick):d=s,t.trail_offset=n,d&&(d-h)*e<=0){const g=h-n*e*this._mintick;if((g-h)*e>=0&&(t.trail_stop_price=h,t.isMarketPriceStop=!0,r.comment=l||f,Object.assign(t,{out_comment:r.comment}),c))return this._addExitPendingCloseOrders(r),!0;t.trail_stop_price=g}t.active_price=d}}_processExitOnClose(t,e,r){const{qty:n=0,comment:s,id:a}=r,{close_entries_rule:l="FIFO"}=this._options;if(l==="FIFO"){const f=this._processExitOrders(this._orders,e,n,a,s);f&&!f.hasExit?(f.hasExit=!0,Object.assign(t,{trail_stop_price:f.trail_stop_price,stop:f.stop,limit:f.limit,trail_offset:f.trail_offset,active_price:f.active_price})):f&&(t.hasExit=!0)}else t.hasExit=!0,this._processOrders([t],e,n,a,s)}_processExitOrders(t,e,r,n,s){let a=r,l;for(const f of t)if(l=f,a=this._processOrder(f,e,a,n,s),a<=0||!f.hasExit)break;return this._orders=this._orders.filter(f=>!f.isDeal),this._variables.strategy.updateOrders(this._orders),l}_processOrder(t,e,r,n,s){const{time:a,bar_index:l}=this._variables,{slippage:f=0}=this._options,{in_price:h,qty:p=0,max_profit:c=0,trading_loss:d=0,direction:g,commission:w=0,original_qty:m=0}=t,D=g===pe.long?1:-1;if(e=e-D*f*this._mintick,r<p){const v=p-r,E=(e-h)*D*r,b=c/p*r,N=d/p*r;this._calcPercent({...t,out_price:e,out_id:n,out_index:l,out_time:a,out_comment:s,profit:E,out_qty:r,max_profit:b,trading_loss:N});const x=(e-h)*D*v-w*v/m;Object.assign(t,{qty:v,profit:x,max_profit:c-b,trading_loss:d-N,total_profit:this._totalChangeCapital+x}),r=0}else{t.isDeal=!0;const v=(e-h)*D*p;this._calcPercent({...t,out_price:e,out_id:n,out_index:l,out_time:a,out_comment:s,out_qty:p,profit:v}),r-=p}return r}_calcPercent(t){const{commission_value:e}=this._options,{in_price:r,out_qty:n=0,out_price:s=0,original_qty:a=0}=t;let{profit:l=0,max_profit:f=0,trading_loss:h=0,commission:p=0}=t;f=f<0?0:f;const c=r*n;if(this._totalChangeCapital+=l,e){const d=this._getCommission(s,n);this._totalChangeCapital-=d,p=p*n/a+d,l=l-p,Object.assign(t,{commission:p,profit:l,max_profit:f})}Object.assign(t,{total_profit:this._totalChangeCapital,profit_percent:l/c*100,max_profit_percent:f/c*100,trading_loss_percent:h/c*100}),this._risk.intradayOrders+=1,this._historyOrder.push(t),this._variables.strategy.updateHistoryOrders(this._historyOrder)}_getCommission(t,e){const{commission_value:r=0,commission_type:n}=this._options,s=t*e;let a=0;switch(n){case Ir.percent:a=s*r/100;break;case Ir.cashPerContract:a=e*r;break;case Ir.cashPerOrder:a=r;break}return a}_calcCurrentOrder(t){const{commission_value:e}=this._options,{in_price:r,qty:n=0,max_profit:s=0,trading_loss:a=0}=t;let{profit:l=0}=t;const f=r*n;if(e){const h=this._getCommission(r,n);this._totalChangeCapital-=h,l=l-h,Object.assign(t,{commission:h,profit:l,total_profit:this._totalChangeCapital})}Object.assign(t,{original_qty:n,profit_percent:l/f*100,max_profit_percent:s/f*100,trading_loss_percent:a/f*100}),this._risk.intradayOrders+=1,this._orders.push(t),this._variables.strategy.updateOrders(this._orders)}_isNaN(t){return t===void 0||isNaN(t)}};class Zw{constructor(t){z(this,"_logs");z(this,"_variables");this._variables=t,this._logs=[]}get logs(){return this._logs}clearLogs(){this._logs=[]}info(t,e){this._addLog(t,e,"info")}error(t,e){this._addLog(t,e,"error")}warning(t,e){this._addLog(t,e,"warning")}_addLog(t,e,r){const{message:n,formatString:s}=t,{time:a,bar_index:l,precision:f}=this._variables;let h=n;s&&Array.isArray(e)&&e.length&&(h=s.replace(/{(\d+)}/g,(p,c)=>{let d=e[c];return typeof d=="number"&&(d=parseFloat(d.toFixed(f))),d!==void 0?String(d):p})),h&&this._logs.push({message:`[${ee(a).format()}]: ${h}`,time:a,barIndex:l,type:r})}}class Gw{constructor(t){z(this,"_errorListener");this._errorListener=t}error({message:t},e){this._errorListener.addError(t,e,Re.Error)}}class Kw{constructor(){z(this,"_errors");this._errors=new Map}clear(){this._errors.clear()}get errors(){return Sr.flatMap([...this._errors.values()])}addError(t,e,r){const[n,s]=e.split("_").slice(-2),a=this._errors.get(e),l={message:t,endLineNumber:Number(n),startColumn:Number(s)+1,endColumn:Number(s)+1,startLineNumber:Number(n),type:r};a?a.push(l):this._errors.set(e,[l])}}class Hw{constructor(){z(this,"_isMarketOpen");z(this,"_currentBarIndex");z(this,"_totalBarIndex");z(this,"_isRealTimeBar");z(this,"_preBarIndex");this._currentBarIndex=0,this._totalBarIndex=0,this._isRealTimeBar=!1,this._preBarIndex=0,this._isMarketOpen=!0}update(t,e,r,n){this._preBarIndex=this._currentBarIndex,this._currentBarIndex=t,this._totalBarIndex=e,this._isRealTimeBar=r,this._isMarketOpen=n}get isnew(){return!this._isRealTimeBar||this._preBarIndex!==this._currentBarIndex}get islast(){return this._currentBarIndex===this._totalBarIndex}get isfirst(){return this._currentBarIndex===0}get ishistory(){return!this._isRealTimeBar}get isrealtime(){return this._isRealTimeBar}get isconfirmed(){return!this._isRealTimeBar}get islastconfirmedhistory(){return this._isMarketOpen?this._currentBarIndex===this._totalBarIndex-1:this._currentBarIndex===this._totalBarIndex}}class Jw{constructor(t){z(this,"_variables");this._variables=t}get isfirstbar(){return this._variables.timeframe.isdwm?!0:this._variables.time===this._variables.time_tradingday}get isfirstbar_regular(){return this._variables.timeframe.isdwm?!0:this._variables.time===this._variables.time_tradingday}get islastbar(){if(this._variables.timeframe.isdwm)return!0;const t=Xr(this._variables.timeframe.period);return this._variables.time+t===this._variables.time_tradingday+24*60*60*1e3}get islastbar_regular(){if(this._variables.timeframe.isdwm)return!0;const t=Xr(this._variables.timeframe.period);return this._variables.time+t===this._variables.time_tradingday+24*60*60*1e3}get ismarket(){return!0}get ispostmarket(){return!1}get ispremarket(){return!1}}class Xw{constructor(t){z(this,"_orders");z(this,"_historyOrders");z(this,"_options");z(this,"_max_contracts_held_all",0);z(this,"_max_contracts_held_long",0);z(this,"_max_contracts_held_short",0);z(this,"_max_drawdown",0);z(this,"_max_runup",0);z(this,"_max_runup_percent",0);z(this,"_max_drawdown_percent",0);z(this,"_variables");z(this,"_netprofit",0);z(this,"_eventrades",0);z(this,"_avg_trade_percent");z(this,"_closedtrades",0);z(this,"_losstrades",0);z(this,"_grossloss",0);z(this,"_grossloss_percent",0);z(this,"_grossprofit",0);z(this,"_grossprofit_percent",0);z(this,"_wintrades",0);z(this,"_opentrades_capital_held",0);z(this,"_position_avg_price",0);z(this,"_position_size",0);this._orders=[],this._historyOrders=[],this._variables=t}update(){this._calcMaxDrawdownAndMaxRunup()}_calcMaxDrawdownAndMaxRunup(){let t=0,e=0;const{high:r,low:n}=this._variables;for(const h of this._orders){const{in_price:p,qty:c=0,commission:d=0,original_qty:g=0,direction:w}=h,m=w===pe.long?1:-1,D=(r-p)*c,v=(n-p)*c,E=m===1?D:-v,b=m===1?-v:D;t+=b+d*c/g,e+=E+d*c/g}const[s,a]=this._historyOrders.reduce((h,p)=>{let[c,d]=h;const{profit:g=0,commission:w=0}=p;return c+=g,d+=g-w,[c,d]},[0,0]);t-=s,e+=a;const l=t/(this.initial_capital+this.netprofit)*100;this._max_drawdown<t&&(this._max_drawdown=t),l>this._max_drawdown_percent&&(this._max_drawdown_percent=l);const f=e/(this.initial_capital+this.netprofit)*100;e>this._max_runup&&(this._max_runup=e),f>this._max_runup_percent&&(this._max_runup_percent=f)}updateOrders(t){this._orders=t,this._calcMaxContracts()}_calcMaxContracts(){const t=this._orders.length;if(!t)return;const[e,r,n,s,a,l]=this._orders.reduce(([f,h,p,c,d,g],w)=>{const{direction:m,qty:D=0,in_price:v}=w;return m===pe.long?(f+=D,h+=D,g+=D):(f+=D,p+=D,g-=D),c+=D*v,d+=v,[f,h,p,c,d,g]},[0,0,0,0,0,0]);this._position_size=l,this._position_avg_price=a/t,this._opentrades_capital_held=s,this._max_contracts_held_all=Math.max(e,this._max_contracts_held_all),this._max_contracts_held_long=Math.max(r,this._max_contracts_held_long),this._max_contracts_held_short=Math.max(n,this._max_contracts_held_short)}updateHistoryOrders(t){this._historyOrders=t;const e=this._historyOrders.length;this._closedtrades=e;const[r,n,s,a,l,f]=this._historyOrders.reduce((h,p)=>{let[c,d,g,w,m,D]=h;const{profit:v=0,profit_percent:E=0}=p;return c+=v,d+=E,v<0?(g+=v,w+=E):(m+=v,D+=E),[c,d,g,w,m,D]},[0,0,0,0,0,0]);this._avg_trade_percent=e?n/e:void 0,this._netprofit=r,this._grossloss=s,this._grossloss_percent=a,this._grossprofit=l,this._grossprofit_percent=f,this._eventrades=this._historyOrders.filter(h=>h.profit===0).length,this._losstrades=this._historyOrders.filter(h=>(h.profit||0)<0).length,this._wintrades=this._historyOrders.filter(h=>(h.profit||0)>0).length}updateStrategyOptions(t){this._options=t}get long(){return"long"}get short(){return"short"}get account_currency(){return"USD"}get closedtrades(){return this._closedtrades}get opentrades(){return this._orders.length}get opentrades_capital_held(){return this._opentrades_capital_held}get avg_losing_trade(){const t=this.losstrades;return t?Math.abs(this.grossloss/t):void 0}get avg_losing_trade_percent(){const t=this.losstrades;return t?Math.abs(this.grossloss_percent/t):void 0}get avg_trade(){if(this.closedtrades)return Math.abs(this.netprofit/this.closedtrades)}get equity(){return this.initial_capital+this.netprofit+this.openprofit}get netprofit(){return this._netprofit}get eventrades(){return this._eventrades}get openprofit(){return this._orders.reduce((t,e)=>{const{profit:r=0}=e;return t+r},0)}get avg_trade_percent(){return this._avg_trade_percent}get avg_winning_trade(){const t=this.wintrades;return t?Math.abs(this.grossprofit/t):void 0}get avg_winning_trade_percent(){const t=this.wintrades;return t?Math.abs(this.grossprofit_percent/t):void 0}get initial_capital(){var t;return((t=this._options)==null?void 0:t.initial_capital)||0}get losstrades(){return this._losstrades}get grossloss(){return this._grossloss}get grossloss_percent(){return this._grossloss_percent}get grossprofit(){return this._grossprofit}get grossprofit_percent(){return this._grossprofit_percent}get wintrades(){return this._wintrades}get margin_liquidation_price(){if(!this._options)return;const{initial_capital:t,margin_long:e=0,margin_short:r=0,commission_type:n,commission_value:s=0}=this._options,a=this._orders[0].direction===pe.long?1:-1,l=(a===1?e:r)/100;if(l<=0)return;const{close:f}=this._variables,[h,p]=this._orders.reduce((c,d)=>{let[g,w]=c;const{in_price:m,qty:D=0,original_qty:v=0}=d,E=m*D;if(g+=E,s){let b=0;switch(n){case Ir.percent:b=(E+D*f)*s/100;break;case Ir.cashPerContract:b=D*s*2;break;case Ir.cashPerOrder:b=D/v*s+s;break}w+=b}return[g,w]},[0,0]);return(h-(t+this.netprofit-p))*a/this.position_size/(1-a*l)}get max_contracts_held_all(){return this._max_contracts_held_all}get max_contracts_held_long(){return this._max_contracts_held_long}get max_contracts_held_short(){return this._max_contracts_held_short}get max_drawdown(){return this._max_drawdown}get max_runup(){return this._max_runup}get max_runup_percent(){return this._max_runup_percent}get max_drawdown_percent(){return this._max_drawdown_percent}get netprofit_percent(){return this.netprofit/this.initial_capital*100}get openprofit_percent(){return this.openprofit/(this.initial_capital+this.netprofit)*100}get position_avg_price(){return this._position_avg_price}get position_entry_name(){if(this._orders.length)return this._orders[0].id}get position_size(){return this._position_size}}class Vw{constructor(){z(this,"_preAccdist");z(this,"_preNvi");z(this,"_prePvi");z(this,"_preObv");z(this,"_prePvt");z(this,"_preWad");z(this,"_preVwap");z(this,"_preValue");z(this,"_currentData");z(this,"_preData");this._preAccdist=0,this._preNvi=0,this._prePvi=0,this._preObv=0,this._prePvt=0,this._preWad=0,this._preVwap={},this._preValue={},this._currentData={},this._preData={}}update(t){this._preValue={},t.barIndex!==this._currentData.barIndex&&(this._preData={...this._currentData}),this._currentData={...t}}get isRealTime(){return this._preData.barIndex===this._currentData.barIndex}get accdist(){if(this._preValue.accdist)return this._preValue.accdist;const{close:t,low:e,high:r,volume:n}=this._currentData;if(r===e)return this._preAccdist;const s=(t-e-(r-t))/(r-e)*n+this._preAccdist;return!this.isRealTime&&(this._preAccdist=s),this._preValue.accdist=s,s}get iii(){if(this._preValue.iii)return this._preValue.iii;const{close:t,low:e,high:r,volume:n}=this._currentData,s=(2*t-r-e)/((r-e)*n);return this._preValue.iii=s,s}get nvi(){return this._preValue.nvi?this._preValue.nvi:this._getNvi()}get wvad(){if(this._preValue.wvad)return this._preValue.wvad;const{close:t,low:e,high:r,volume:n,open:s}=this._currentData,a=(t-s)/(r-e)*n;return this._preValue.wvad=a,a}get obv(){if(this._preValue.obv)return this._preValue.obv;const{close:t,volume:e}=this._currentData,{close:r}=this._preData;if(r===void 0){this._preObv=0;return}const n=Math.sign(t-r)*e+this._preObv;return!this.isRealTime&&(this._preObv=n),this._preValue.obv=n,n}get pvi(){return this._preValue.pvi?this._preValue.pvi:this._getPvi()}get tr(){if(this._preValue.tr)return this._preValue.tr;const{low:t,high:e}=this._currentData,{close:r}=this._preData;if(r===void 0)return;const n=Math.max(e-t,Math.abs(e-r),Math.abs(t-r));return this._preValue.tr=n,n}get pvt(){if(this._preValue.pvt)return this._preValue.pvt;const{close:t,volume:e}=this._currentData,{close:r}=this._preData;if(r===void 0){this._prePvt=0;return}const n=(t-r)/r*e+this._prePvt;return!this.isRealTime&&(this._prePvt=n),this._preValue.pvt=n,n}get wad(){if(this._preValue.wad)return this._preValue.wad;const{close:t,high:e,low:r}=this._currentData,{close:n}=this._preData;if(n===void 0)return this._preWad=0,0;const s=Math.max(e,n),a=Math.min(r,n),l=t-n,h=(l>0?t-a:l<0?t-s:0)+this._preWad;return!this.isRealTime&&(this._preWad=h),this._preValue.wad=h,h}get vwap(){if(this._preValue.vwap)return this._preValue.vwap;const{hlc3:t,volume:e}=this._currentData;let{sum:r=0,sumV:n=0,isReset:s}=this._preVwap;if(self.buildInFunctions.timeframe.change({timeframe:"1D"},"vwap_buildin")&&(s=!0,r=n=0),!s)return;const l=t*e+r,f=e+n;!this.isRealTime&&(this._preVwap={sum:l,sumV:f,isReset:s});const h=l/f;return this._preValue.vwap=h,h}_getNvi(){const t=this._preNvi||1,{close:e=0,volume:r=0}=this._preData,{close:n,volume:s}=this._currentData;let a=1;const l=t||1;return n&&e?a=s<r?l+(n-e)/e*l:l:a=l,!this.isRealTime&&(this._preNvi=a),this._preValue.nvi=a,a}_getPvi(){const t=this._prePvi||1,{close:e=0,volume:r=0}=this._preData,{close:n,volume:s}=this._currentData;let a=1;const l=t||1;return n&&e?a=s>r?l+(n-e)/e*l:l:a=l,!this.isRealTime&&(this._prePvi=a),this._preValue.pvi=a,a}}class Qw{constructor(){z(this,"_period");z(this,"_multiplier");z(this,"_unit");this._period="1",this._multiplier=1,this._unit="m"}update(t){if(!t)return;this._period=t;const[e,r]=ms(t);this._multiplier=e,this._unit=r}get isdaily(){return this._unit==="d"}get isdwm(){return["d","w","M"].includes(this._unit)}get isintraday(){return["s","m","h"].includes(this._unit)}get isminutes(){return this._unit==="m"}get ismonthly(){return this._unit==="M"}get isseconds(){return this._unit==="s"}get isweekly(){return this._unit==="w"}get multiplier(){return this._multiplier}get period(){return this._period}}ee.extend(Ip),ee.extend(Np),ee.extend(Bp);class ty{constructor(){z(this,"_cacheData");z(this,"_barIndex");z(this,"_isRealTimeBar");z(this,"_barstate");z(this,"_priceVariables");z(this,"_lastBarIndex");z(this,"_currentBarTime");z(this,"_lastBarTime");z(this,"_period");z(this,"_offsetTime");z(this,"_timeframe");z(this,"_ta");z(this,"_polyline");z(this,"_label");z(this,"_line");z(this,"_linefill");z(this,"_box");z(this,"_table");z(this,"_strategy");z(this,"_precision");z(this,"_session");this._cacheData={varData:{},varNewData:{},varipData:{}},this._barIndex=0,this._lastBarIndex=0,this._currentBarTime=0,this._lastBarTime=0,this._offsetTime=0,this._period="",this._isRealTimeBar=!1,this._barstate=new Hw,this._timeframe=new Qw,this._priceVariables={close:0,open:0,low:0,high:0,volume:0},this._ta=new Vw,this._polyline=new yi,this._label=new yi,this._line=new yi,this._linefill=new yi,this._box=new yi,this._table=new yi,this._strategy=new Xw(this),this._precision=4,this._session=new Jw(this)}get table(){return this._table}get box(){return this._box}get linefill(){return this._linefill}get line(){return this._line}get polyline(){return this._polyline}get label(){return this._label}get ta(){return this._ta}get strategy(){return this._strategy}get session(){return this._session}get na(){}get last_bar_index(){return this._lastBarIndex}get bar_index(){return this._barIndex}get barstate(){return this._barstate}get close(){return this._priceVariables.close}get low(){return this._priceVariables.low}get open(){return this._priceVariables.open}get high(){return this._priceVariables.high}get volume(){return this._priceVariables.volume}get ohlc4(){const{close:t,open:e,high:r,low:n}=this._priceVariables;return(t+e+r+n)/4}get hl2(){const{high:t,low:e}=this._priceVariables;return(t+e)/2}get hlc3(){const{close:t,high:e,low:r}=this._priceVariables;return(t+e+r)/3}get hlcc4(){const{close:t,high:e,low:r}=this._priceVariables;return(t*2+e+r)/4}get hour(){return ee(this._currentBarTime).subtract(this._offsetTime,"hour").hour()}get minute(){return ee(this._currentBarTime).minute()}get second(){return ee(this._currentBarTime).second()}get month(){return ee(this._currentBarTime).month()+1}get year(){return ee(this._currentBarTime).year()}get dayofweek(){return ee(this._currentBarTime).day()+1}get dayofmonth(){return ee(this._currentBarTime).date()}get weekofyear(){return ee(this._currentBarTime).week()}get last_bar_time(){return this._lastBarTime}get time(){return this._currentBarTime}get time_close(){const[t,e]=ms(this._period);return this._isRealTimeBar?void 0:ee(this._currentBarTime).add(t,e).valueOf()}get timenow(){return Date.now()}get time_tradingday(){return this.getTimeTradingday(this._currentBarTime,this._period)}get timeframe(){return this._timeframe}get precision(){return this._precision}getTimeTradingday(t,e){const[r,n]=ms(e),s=ee(t);return["M","w","y","d"].includes(n)?s.valueOf():(s.subtract(this._offsetTime,"h"),s.startOf("d").add(this._offsetTime,"h").valueOf())}updateData(t){const{barIndex:e,c:r,o:n,h:s,l:a,volume:l,lastBarIndex:f,time:h,lastBarTime:p,period:c="1D",offsetTime:d=5,precision:g=4}=t;this._priceVariables={close:Number(r),open:Number(n),high:Number(s),low:Number(a),volume:Number(l)},e>this._barIndex&&this._isRealTimeBar&&(this._cacheData.varData=this._cacheData.varNewData,this._cacheData.varNewData={}),this._precision=g,this._currentBarTime=h*1e3,this._lastBarIndex=f,this._barIndex=e,this._lastBarTime=p*1e3,this._period=c,this._offsetTime=d,this._timeframe.update(c),this._barstate.update(e,f,!1,!1),this.ta.update({...this._priceVariables,hlc3:this.hlc3,barIndex:e})}getCacheData(t,e,r){let n=this._cacheData[t]||[];n[this._barIndex]=r,n=n.filter(()=>!0);const s=n[n.length-1-e];return this._cacheData[t]=n,s}setCacheData(t,e){const r=this._cacheData[t]||[];r[this._barIndex]=e,this._cacheData[t]=r}getTypeInstance(t,e){return new Cp(t,e)}getVarValue(t,e,r){const n=`${t}_${e}`,s=r==="var"?this._cacheData.varData[n]:this._cacheData.varipData[n];if(s)return s}setVarValue(t,e,r,n){const s=`${t}_${e}`;let a;switch(typeof r=="object"&&r&&(n="var",a=r.varipKeys),n){case"var":if(this._isRealTimeBar){const l=Sr.cloneDeep(r);if(this._cacheData.varNewData[s]=l,a&&a.length)for(const f of a)this._cacheData.varData[s][f]=l[f]}else this._cacheData.varData[s]=r;break;case"varip":this._cacheData.varipData[s]=r;break}return r}add(t,e){return Array.isArray(t)&&Array.isArray(e)?Sr.uniq([...t,...e]):typeof t=="number"||typeof e=="number"?Number(t)+Number(e):t+e}sub(t,e){return Array.isArray(t)&&Array.isArray(e)?t.filter(r=>!e.includes(r)):Number(t)-Number(e)}againAssignParse(t,e){var n;if(e)return;const r=(n=t==null?void 0:t.constructor)==null?void 0:n.name;if(r)switch(r){case Hi.name:case Zc.name:case Xi.name:case Ra.name:case Ji.name:case io.name:t==null||t.delete();break}}}class yi{constructor(t=50){z(this,"_all");z(this,"_allInstance");z(this,"_pseudoArrayAll");z(this,"_maxLength");this._all=new Map,this._allInstance=new Map,this._pseudoArrayAll=new Jt,this._maxLength=t}setMaxLen(t){this._maxLength=t}get data(){return[...this._all.values()]}get all(){return this._pseudoArrayAll._value=[...this._allInstance.values()],this._pseudoArrayAll}add(t,e,r){this._all.set(t,e),this._allInstance.set(t,r);const n=[...this._all.keys()];if(n.length>this._maxLength){const s=n.shift();s&&this.delete(s)}}get(t){return this._all.get(t)}getInstance(t){return this._allInstance.get(t)}delete(t){this._all.delete(t),this._allInstance.delete(t)}}var Gc={exports:{}};(function(i,t){(function(e,r){i.exports=r()})(jt,function(){return function(e,r,n){r.prototype.isBetween=function(s,a,l,f){var h=n(s),p=n(a),c=(f=f||"()")[0]==="(",d=f[1]===")";return(c?this.isAfter(h,l):!this.isBefore(h,l))&&(d?this.isBefore(p,l):!this.isAfter(p,l))||(c?this.isBefore(h,l):!this.isAfter(h,l))&&(d?this.isAfter(p,l):!this.isBefore(p,l))}}})})(Gc);var ey=Gc.exports,ry=Zt(ey),Kc={exports:{}};(function(i,t){(function(e,r){i.exports=r()})(jt,function(){return function(e,r,n){var s=r.prototype,a=function(d){var g,w=d.date,m=d.utc,D={};if(!((g=w)===null||g instanceof Date||g instanceof Array||s.$utils().u(g)||g.constructor.name!=="Object")){if(!Object.keys(w).length)return new Date;var v=m?n.utc():n();Object.keys(w).forEach(function(O){var C,T;D[C=O,T=s.$utils().p(C),T==="date"?"day":T]=w[O]});var E=D.day||(D.year||D.month>=0?1:v.date()),b=D.year||v.year(),N=D.month>=0?D.month:D.year||D.day?0:v.month(),x=D.hour||0,F=D.minute||0,M=D.second||0,S=D.millisecond||0;return m?new Date(Date.UTC(b,N,E,x,F,M,S)):new Date(b,N,E,x,F,M,S)}return w},l=s.parse;s.parse=function(d){d.date=a.bind(this)(d),l.bind(this)(d)};var f=s.set,h=s.add,p=s.subtract,c=function(d,g,w,m){m===void 0&&(m=1);var D=Object.keys(g),v=this;return D.forEach(function(E){v=d.bind(v)(g[E]*m,E)}),v};s.set=function(d,g){return g=g===void 0?d:g,d.constructor.name==="Object"?c.bind(this)(function(w,m){return f.bind(this)(m,w)},g,d):f.bind(this)(d,g)},s.add=function(d,g){return d.constructor.name==="Object"?c.bind(this)(h,d,g):h.bind(this)(d,g)},s.subtract=function(d,g){return d.constructor.name==="Object"?c.bind(this)(h,d,g,-1):p.bind(this)(d,g)}}})})(Kc);var ny=Kc.exports,iy=Zt(ny),Hc={exports:{}};(function(i,t){(function(e,r){i.exports=r()})(jt,function(){var e,r,n=1e3,s=6e4,a=36e5,l=864e5,f=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,h=31536e6,p=2628e6,c=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,d={years:h,months:p,days:l,hours:a,minutes:s,seconds:n,milliseconds:1,weeks:6048e5},g=function(F){return F instanceof N},w=function(F,M,S){return new N(F,S,M.$l)},m=function(F){return r.p(F)+"s"},D=function(F){return F<0},v=function(F){return D(F)?Math.ceil(F):Math.floor(F)},E=function(F){return Math.abs(F)},b=function(F,M){return F?D(F)?{negative:!0,format:""+E(F)+M}:{negative:!1,format:""+F+M}:{negative:!1,format:""}},N=function(){function F(S,O,C){var T=this;if(this.$d={},this.$l=C,S===void 0&&(this.$ms=0,this.parseFromMilliseconds()),O)return w(S*d[m(O)],this);if(typeof S=="number")return this.$ms=S,this.parseFromMilliseconds(),this;if(typeof S=="object")return Object.keys(S).forEach(function(k){T.$d[m(k)]=S[k]}),this.calMilliseconds(),this;if(typeof S=="string"){var L=S.match(c);if(L){var U=L.slice(2).map(function(k){return k!=null?Number(k):0});return this.$d.years=U[0],this.$d.months=U[1],this.$d.weeks=U[2],this.$d.days=U[3],this.$d.hours=U[4],this.$d.minutes=U[5],this.$d.seconds=U[6],this.calMilliseconds(),this}}return this}var M=F.prototype;return M.calMilliseconds=function(){var S=this;this.$ms=Object.keys(this.$d).reduce(function(O,C){return O+(S.$d[C]||0)*d[C]},0)},M.parseFromMilliseconds=function(){var S=this.$ms;this.$d.years=v(S/h),S%=h,this.$d.months=v(S/p),S%=p,this.$d.days=v(S/l),S%=l,this.$d.hours=v(S/a),S%=a,this.$d.minutes=v(S/s),S%=s,this.$d.seconds=v(S/n),S%=n,this.$d.milliseconds=S},M.toISOString=function(){var S=b(this.$d.years,"Y"),O=b(this.$d.months,"M"),C=+this.$d.days||0;this.$d.weeks&&(C+=7*this.$d.weeks);var T=b(C,"D"),L=b(this.$d.hours,"H"),U=b(this.$d.minutes,"M"),k=this.$d.seconds||0;this.$d.milliseconds&&(k+=this.$d.milliseconds/1e3,k=Math.round(1e3*k)/1e3);var W=b(k,"S"),P=S.negative||O.negative||T.negative||L.negative||U.negative||W.negative,K=L.format||U.format||W.format?"T":"",G=(P?"-":"")+"P"+S.format+O.format+T.format+K+L.format+U.format+W.format;return G==="P"||G==="-P"?"P0D":G},M.toJSON=function(){return this.toISOString()},M.format=function(S){var O=S||"YYYY-MM-DDTHH:mm:ss",C={Y:this.$d.years,YY:r.s(this.$d.years,2,"0"),YYYY:r.s(this.$d.years,4,"0"),M:this.$d.months,MM:r.s(this.$d.months,2,"0"),D:this.$d.days,DD:r.s(this.$d.days,2,"0"),H:this.$d.hours,HH:r.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:r.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:r.s(this.$d.seconds,2,"0"),SSS:r.s(this.$d.milliseconds,3,"0")};return O.replace(f,function(T,L){return L||String(C[T])})},M.as=function(S){return this.$ms/d[m(S)]},M.get=function(S){var O=this.$ms,C=m(S);return C==="milliseconds"?O%=1e3:O=C==="weeks"?v(O/d[C]):this.$d[C],O||0},M.add=function(S,O,C){var T;return T=O?S*d[m(O)]:g(S)?S.$ms:w(S,this).$ms,w(this.$ms+T*(C?-1:1),this)},M.subtract=function(S,O){return this.add(S,O,!0)},M.locale=function(S){var O=this.clone();return O.$l=S,O},M.clone=function(){return w(this.$ms,this)},M.humanize=function(S){return e().add(this.$ms,"ms").locale(this.$l).fromNow(!S)},M.valueOf=function(){return this.asMilliseconds()},M.milliseconds=function(){return this.get("milliseconds")},M.asMilliseconds=function(){return this.as("milliseconds")},M.seconds=function(){return this.get("seconds")},M.asSeconds=function(){return this.as("seconds")},M.minutes=function(){return this.get("minutes")},M.asMinutes=function(){return this.as("minutes")},M.hours=function(){return this.get("hours")},M.asHours=function(){return this.as("hours")},M.days=function(){return this.get("days")},M.asDays=function(){return this.as("days")},M.weeks=function(){return this.get("weeks")},M.asWeeks=function(){return this.as("weeks")},M.months=function(){return this.get("months")},M.asMonths=function(){return this.as("months")},M.years=function(){return this.get("years")},M.asYears=function(){return this.as("years")},F}(),x=function(F,M,S){return F.add(M.years()*S,"y").add(M.months()*S,"M").add(M.days()*S,"d").add(M.hours()*S,"h").add(M.minutes()*S,"m").add(M.seconds()*S,"s").add(M.milliseconds()*S,"ms")};return function(F,M,S){e=S,r=S().$utils(),S.duration=function(T,L){var U=S.locale();return w(T,{$l:U},L)},S.isDuration=g;var O=M.prototype.add,C=M.prototype.subtract;M.prototype.add=function(T,L){return g(T)?x(this,T,1):O.bind(this)(T,L)},M.prototype.subtract=function(T,L){return g(T)?x(this,T,-1):C.bind(this)(T,L)}}})})(Hc);var sy=Hc.exports,oy=Zt(sy);ee.extend(ry),ee.extend(iy),ee.extend(oy);class ay{constructor(t,e){z(this,"array");z(this,"color");z(this,"math");z(this,"str");z(this,"map");z(this,"matrix");z(this,"timeframe");z(this,"ta");z(this,"input");z(this,"_variables");z(this,"_cacheData");z(this,"_options");z(this,"_errorListener");z(this,"_plots");z(this,"_alerts");z(this,"_bgColors");z(this,"_hlines");z(this,"_fills");z(this,"chart");z(this,"line");z(this,"label");z(this,"polyline");z(this,"box");z(this,"table");z(this,"linefill");z(this,"log");z(this,"runtime");z(this,"strategy");this._variables=e,this._errorListener=new Kw,this.array=new Lp(this._errorListener),this.math=new Rp(t,this._errorListener),this.color=new f1,this.str=new cw(this._errorListener),this.map=new hw(this._errorListener),this.timeframe=new fw(e),this.matrix=new lw(this._errorListener),this.ta=new o1(e,this.math,this.timeframe),this._cacheData={},this._options={},this._bgColors={},this._alerts=new Map,this._hlines=new Map,this._fills=new Map,this.input=new l1(e,this._errorListener),this._plots=new Map,this.chart={point:new pw(e)},this.line=new Pw(e),this.label=new dw(e),this.polyline=new Rw(e),this.box=new qw(e),this.table=new kw(e),this.linefill=new zw(e),this.log=new Zw(e),this.runtime=new Gw(this._errorListener),this.strategy=new Yw(this._variables,this._options,1e-4,this._errorListener)}get errors(){return this._errorListener.errors}get options(){const t=this.input.getInputs(),e=this._alerts.size?[...this._alerts.values()]:void 0;this._alerts.clear();const r=Object.keys(this._bgColors).length?{...this._bgColors}:void 0,n=this._hlines.size?[...this._hlines.values()]:void 0,s=this._fills.size?[...this._fills.values()]:void 0,a=this.log.logs.length?this.log.logs:void 0;return this.log.clearLogs(),this._options.scriptType==="strategy"&&Object.assign(this._options,{orders:this.strategy.orders,historyOrders:this.strategy.historyOrders}),Object.assign(this._options,{inputs:t,plots:[...this._plots.values()],draws:this._getDraws(),alerts:e,colors:r,hlines:n,fills:s,logs:a})}_getDraws(){const{line:t,linefill:e,table:r,box:n,polyline:s,label:a}=this._variables,l={};return t.data.length&&(l.lines=t.data),e.data.length&&(l.linefills=e.data),r.data.length&&(l.tables=r.data),n.data.length&&(l.boxes=n.data),s.data.length&&(l.polylines=s.data),a.data.length&&(l.labels=a.data),Object.keys(l).length?l:void 0}update(t){const{barIndex:e,inputs:r}=t;r&&r.length&&this.input.update(r),this.strategy.updateOptions(),this.math.update(e)}endExecution(){this.strategy.endExecution()}indicator(t){this._variables.bar_index||(this._options.scriptType="indicator",this._options.indicator=t)}plot(t,e){const{series:r,color:n,seriesColors:s,...a}=t,{bar_index:l}=this._variables,f=`plot_${e}`,h=this._plots.get(f),p=(h==null?void 0:h.data)||[],c=r!==void 0&&isNaN(r)?void 0:r;if(p[l]=c,s!=null&&s.length&&(this._seriesColorHandle(t,f),p[l]={value:c,itemStyle:{color:n}}),!h){const d=n?[n]:void 0;this._plots.set(f,{editable:!0,...a,colors:d,data:p,id:f})}return{type:"plot",key:f}}plotbar(t,e){const{open:r,close:n,low:s,high:a,color:l,seriesColors:f,...h}=t,{bar_index:p}=this._variables,c=`plotbar_${e}`,d=this._plots.get(c),g=(d==null?void 0:d.data)||[],w=n!==void 0&&isNaN(n)?void 0:n,m=r!==void 0&&isNaN(r)?void 0:r,D=s!==void 0&&isNaN(s)?void 0:s,v=a!==void 0&&isNaN(a)?void 0:a,E=[m,w,D,v];if(g[p]=E,f!=null&&f.length&&(this._seriesColorHandle(t,c),g[p]={value:E,itemStyle:{color:l}}),!d){const b=l?[l]:void 0;this._plots.set(c,{editable:!0,...h,colors:b,data:g,id:c})}}plotchar(t,e){const{series:r,color:n,textcolor:s,...a}=t,{bar_index:l}=this._variables,f=`plotchar_${e}`,h=this._plots.get(f),p=(h==null?void 0:h.data)||[];p[l]={value:r,color:n,textcolor:s},h||this._plots.set(f,{editable:!0,...a,data:p,id:f})}plotarrow(t,e){const{series:r,colorup:n,colordown:s,...a}=t,{bar_index:l}=this._variables,f=`plotarrow_${e}`,h=this._plots.get(f),p=(h==null?void 0:h.data)||[];p[l]={value:r!==void 0&&isNaN(r)?void 0:r,colorup:n,colordown:s},h||this._plots.set(f,{editable:!0,...a,data:p,id:f})}plotshape(t,e){const{series:r,color:n,textcolor:s,...a}=t,{bar_index:l}=this._variables,f=`plotshape_${e}`,h=this._plots.get(f),p=(h==null?void 0:h.data)||[];p[l]={value:r,color:n,textcolor:s},h||this._plots.set(f,{editable:!0,...a,data:p,id:f})}plotcandle(t,e){const{wickcolor:r,bordercolor:n,color:s,close:a,open:l,low:f,high:h,...p}=t,{bar_index:c}=this._variables,d=`plotcandle_${e}`,g=this._plots.get(d),w=(g==null?void 0:g.data)||[],m=a!==void 0&&isNaN(a)?void 0:a,D=l!==void 0&&isNaN(l)?void 0:l,v=f!==void 0&&isNaN(f)?void 0:f,E=h!==void 0&&isNaN(h)?void 0:h,b=[D,m,v,E];w[c]={value:b,wickcolor:r,bordercolor:n,color:s},g||this._plots.set(d,{editable:!0,...p,data:w,id:d})}hline(t,e){const r=`hline_${e}`;return this._hlines.set(r,{linewidth:1,editable:!0,display:ir.all,...t}),{type:"hline",key:r}}fill(t,e){const r=`fill_${e}`;this._fills.set(r,{display:ir.all,editable:!0,fillgaps:!1,...t})}alert({message:t,freq:e=dn.freqOncePerBar},r){const{bar_index:n,_isRealTimeBar:s,last_bar_index:a}=this._variables,l=`alert_${r}`,f=this._cacheData[l].barIndex;if(e===dn.freqOncePerBar&&n===f){this._alerts.delete(l);return}const h={message:t,freq:e,id:l,type:"alert"};if(s){e!==dn.freqOncePerBarClose&&this._alerts.set(l,h),this._cacheData[l].barIndex=n;return}if(!s&&e===dn.freqOncePerBarClose&&n===f&&a===n-1){this._alerts.set(l,h),this._cacheData[l].barIndex=n;return}this._alerts.delete(l)}alertcondition({condition:t,message:e,title:r},n){const{_isRealTimeBar:s}=this._variables,a=`alertcondition_${n}`;s&&t?this._alerts.set(a,{message:e,title:r,id:a,type:"alertcondition"}):this._alerts.delete(a)}barcolor(t){this._setColors(t,"barcolor")}bgcolor(t){this._setColors(t,"bgcolor")}_setColors(t,e){var l,f;const{color:r,...n}=t,{bar_index:s}=this._variables,a=((l=this._bgColors[e])==null?void 0:l.colors)||[];if(!a[s]){const h=((f=this._bgColors[e])==null?void 0:f.setColors)||[];h.includes(r)||h.push(r),a[s]=r,this._bgColors[e]={...n,colors:a,setColors:h}}}max_bars_back({var:t,num:e,var_name:r}){console.log(t,e,r)}float({x:t}){return t}bool({x:t}){return t||!1}string({x:t}){return t}int({x:t}){return t&&Math.trunc(t)}na({x:t}){return t===void 0}fixnan({source:t},e){return t===void 0||isNaN(t)?this._cacheData[`fixnan_${e}`]:(this._cacheData[`fixnan_${e}`]=t,t)}nz({source:t,replacement:e}){return t!==void 0&&!isNaN(t)?t:e||0}time({timeframe:t="",session:e,timezone:r,bars_back:n=0},s){return this._timeHandle(this._variables.time,s,t,e,r,n)}time_close({timeframe:t="",session:e,timezone:r,bars_back:n=0},s){return this._variables.time_close&&this._timeHandle(this._variables.time_close,s,t,e,r,n)}timestamp({dateString:t,timezone:e,year:r,month:n,day:s,hour:a=0,minute:l=0,second:f=0}){if(t)return ee(t).valueOf();let h=ee({year:r,month:n,day:s,hour:a,minute:l,second:f});return e&&(h=Br(h.valueOf(),e)),h.valueOf()}weekofyear({time:t,timezone:e}){return Br(t,e).week()}year({time:t,timezone:e}){return Br(t,e).year()}second({time:t,timezone:e}){return Br(t,e).second()}month({time:t,timezone:e}){return Br(t,e).month()+1}minute({time:t,timezone:e}){return Br(t,e).minute()}hour({time:t,timezone:e}){return Br(t,e).hour()}dayofweek({time:t,timezone:e}){return Br(t,e).day()+1}dayofmonth({time:t,timezone:e}){return Br(t,e).date()}_calcTimeOffset(t,e){const r=this._variables.getTimeTradingday(t,e),n=Xr(e)*1e3;return t-r-Math.floor((t-r)/n)*n}_timeHandle(t,e,r="",n,s,a=0){const l=r||this._variables.timeframe.period,f=Xr(l),h=Xr(this._variables.timeframe.period);let p;if(f<=h)p=t;else{const c=`time_${e}`,d=this._cacheData[c];if(d)d.currentTime+f*1e3-d.offset<=t?(p=t,this._cacheData[c]={currentTime:t,offset:0}):p=d;else{const g=this._calcTimeOffset(t,l);this._cacheData[c]={currentTime:t,offset:g},p=t}}if(n){const{timePeriods:c,weeks:d}=this._parserSession(n),g=ee(t).format("YYYY-MM-DD"),w=p;p=void 0;for(const D of c){const[v,E]=D;if(ee(t).isBetween(`${g} ${v}`,`${g} ${E}`,"hour")){ee(w).isBetween(`${g} ${v}`,`${g} ${E}`,"hour")?p=w:p=ee(`${g} ${v}`).valueOf();break}}const m=this._variables.dayofweek;p&&!d.includes(m)&&(p=void 0)}return s&&(p=p&&Br(p,s).valueOf()),p&&p-a*h*1e3}_seriesColorHandle(t,e){var s,a;const{seriesColors:r}=t,n=this._plots.get(e);if(n&&r!=null&&r.length)for(const l of r){if((s=n.gradientColorKeys)!=null&&s.includes(l))continue;const f=t[l],h=n[`${l}s`]||[];h.includes(f)||(h.push(f),n[`${l}s`]=h,h.length>5&&(n[`${l}s`]=[],(a=n.gradientColorKeys)==null||a.push(l)))}}_parserSession(t){const e=t.split(":"),r=e[0],s=(e[1]||"1234567").split("").map(l=>{const f=parseInt(l,10);if(f<1||f>7)throw new Error(`Invalid day of week: ${l}`);return f});return{timePeriods:r.split(",").map(l=>{const f=l.split("-");if(f.length!==2)throw new Error(`Invalid time period: ${l}`);return[this._processTime(f[0]),this._processTime(f[1])]}),weeks:s}}_processTime(t){const e=parseInt(t.slice(0,2),10),r=parseInt(t.slice(2),10);if(!(e>=0&&e<=23)&&r>=0&&r<=59)throw new Error("Invalid time: Time must be within 00:00 to 23:59");return`${e}:${r}`}}/**
|
61
|
+
${Ic}`)}function D1(i,t,e){return(i>=0&&e?` ${$c(i,t-1)}`:$c(i,t)).padEnd(t)}function $c(i,t){let e=i.toString();if(e.length<=t)return e;let r=i.toFixed(t);if(r.length>t&&(r=i.toFixed(Math.max(0,t-(r.length-t)))),r.length<=t&&!r.startsWith("0.000")&&!r.startsWith("-0.000"))return r;let n=i.toExponential(t);return n.length>t&&(n=i.toExponential(Math.max(0,t-(n.length-t)))),n.slice(0)}function b1(i,t){i.prototype.add=function(r){return typeof r=="number"?this.addS(r):this.addM(r)},i.prototype.addS=function(r){for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)+r);return this},i.prototype.addM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)+r.get(n,s));return this},i.add=function(r,n){return new t(r).add(n)},i.prototype.sub=function(r){return typeof r=="number"?this.subS(r):this.subM(r)},i.prototype.subS=function(r){for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)-r);return this},i.prototype.subM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)-r.get(n,s));return this},i.sub=function(r,n){return new t(r).sub(n)},i.prototype.subtract=i.prototype.sub,i.prototype.subtractS=i.prototype.subS,i.prototype.subtractM=i.prototype.subM,i.subtract=i.sub,i.prototype.mul=function(r){return typeof r=="number"?this.mulS(r):this.mulM(r)},i.prototype.mulS=function(r){for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)*r);return this},i.prototype.mulM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)*r.get(n,s));return this},i.mul=function(r,n){return new t(r).mul(n)},i.prototype.multiply=i.prototype.mul,i.prototype.multiplyS=i.prototype.mulS,i.prototype.multiplyM=i.prototype.mulM,i.multiply=i.mul,i.prototype.div=function(r){return typeof r=="number"?this.divS(r):this.divM(r)},i.prototype.divS=function(r){for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)/r);return this},i.prototype.divM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)/r.get(n,s));return this},i.div=function(r,n){return new t(r).div(n)},i.prototype.divide=i.prototype.div,i.prototype.divideS=i.prototype.divS,i.prototype.divideM=i.prototype.divM,i.divide=i.div,i.prototype.mod=function(r){return typeof r=="number"?this.modS(r):this.modM(r)},i.prototype.modS=function(r){for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)%r);return this},i.prototype.modM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)%r.get(n,s));return this},i.mod=function(r,n){return new t(r).mod(n)},i.prototype.modulus=i.prototype.mod,i.prototype.modulusS=i.prototype.modS,i.prototype.modulusM=i.prototype.modM,i.modulus=i.mod,i.prototype.and=function(r){return typeof r=="number"?this.andS(r):this.andM(r)},i.prototype.andS=function(r){for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)&r);return this},i.prototype.andM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)&r.get(n,s));return this},i.and=function(r,n){return new t(r).and(n)},i.prototype.or=function(r){return typeof r=="number"?this.orS(r):this.orM(r)},i.prototype.orS=function(r){for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)|r);return this},i.prototype.orM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)|r.get(n,s));return this},i.or=function(r,n){return new t(r).or(n)},i.prototype.xor=function(r){return typeof r=="number"?this.xorS(r):this.xorM(r)},i.prototype.xorS=function(r){for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)^r);return this},i.prototype.xorM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)^r.get(n,s));return this},i.xor=function(r,n){return new t(r).xor(n)},i.prototype.leftShift=function(r){return typeof r=="number"?this.leftShiftS(r):this.leftShiftM(r)},i.prototype.leftShiftS=function(r){for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)<<r);return this},i.prototype.leftShiftM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)<<r.get(n,s));return this},i.leftShift=function(r,n){return new t(r).leftShift(n)},i.prototype.signPropagatingRightShift=function(r){return typeof r=="number"?this.signPropagatingRightShiftS(r):this.signPropagatingRightShiftM(r)},i.prototype.signPropagatingRightShiftS=function(r){for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)>>r);return this},i.prototype.signPropagatingRightShiftM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)>>r.get(n,s));return this},i.signPropagatingRightShift=function(r,n){return new t(r).signPropagatingRightShift(n)},i.prototype.rightShift=function(r){return typeof r=="number"?this.rightShiftS(r):this.rightShiftM(r)},i.prototype.rightShiftS=function(r){for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)>>>r);return this},i.prototype.rightShiftM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,this.get(n,s)>>>r.get(n,s));return this},i.rightShift=function(r,n){return new t(r).rightShift(n)},i.prototype.zeroFillRightShift=i.prototype.rightShift,i.prototype.zeroFillRightShiftS=i.prototype.rightShiftS,i.prototype.zeroFillRightShiftM=i.prototype.rightShiftM,i.zeroFillRightShift=i.rightShift,i.prototype.not=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,~this.get(r,n));return this},i.not=function(r){return new t(r).not()},i.prototype.abs=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.abs(this.get(r,n)));return this},i.abs=function(r){return new t(r).abs()},i.prototype.acos=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.acos(this.get(r,n)));return this},i.acos=function(r){return new t(r).acos()},i.prototype.acosh=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.acosh(this.get(r,n)));return this},i.acosh=function(r){return new t(r).acosh()},i.prototype.asin=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.asin(this.get(r,n)));return this},i.asin=function(r){return new t(r).asin()},i.prototype.asinh=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.asinh(this.get(r,n)));return this},i.asinh=function(r){return new t(r).asinh()},i.prototype.atan=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.atan(this.get(r,n)));return this},i.atan=function(r){return new t(r).atan()},i.prototype.atanh=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.atanh(this.get(r,n)));return this},i.atanh=function(r){return new t(r).atanh()},i.prototype.cbrt=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.cbrt(this.get(r,n)));return this},i.cbrt=function(r){return new t(r).cbrt()},i.prototype.ceil=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.ceil(this.get(r,n)));return this},i.ceil=function(r){return new t(r).ceil()},i.prototype.clz32=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.clz32(this.get(r,n)));return this},i.clz32=function(r){return new t(r).clz32()},i.prototype.cos=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.cos(this.get(r,n)));return this},i.cos=function(r){return new t(r).cos()},i.prototype.cosh=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.cosh(this.get(r,n)));return this},i.cosh=function(r){return new t(r).cosh()},i.prototype.exp=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.exp(this.get(r,n)));return this},i.exp=function(r){return new t(r).exp()},i.prototype.expm1=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.expm1(this.get(r,n)));return this},i.expm1=function(r){return new t(r).expm1()},i.prototype.floor=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.floor(this.get(r,n)));return this},i.floor=function(r){return new t(r).floor()},i.prototype.fround=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.fround(this.get(r,n)));return this},i.fround=function(r){return new t(r).fround()},i.prototype.log=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.log(this.get(r,n)));return this},i.log=function(r){return new t(r).log()},i.prototype.log1p=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.log1p(this.get(r,n)));return this},i.log1p=function(r){return new t(r).log1p()},i.prototype.log10=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.log10(this.get(r,n)));return this},i.log10=function(r){return new t(r).log10()},i.prototype.log2=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.log2(this.get(r,n)));return this},i.log2=function(r){return new t(r).log2()},i.prototype.round=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.round(this.get(r,n)));return this},i.round=function(r){return new t(r).round()},i.prototype.sign=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.sign(this.get(r,n)));return this},i.sign=function(r){return new t(r).sign()},i.prototype.sin=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.sin(this.get(r,n)));return this},i.sin=function(r){return new t(r).sin()},i.prototype.sinh=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.sinh(this.get(r,n)));return this},i.sinh=function(r){return new t(r).sinh()},i.prototype.sqrt=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.sqrt(this.get(r,n)));return this},i.sqrt=function(r){return new t(r).sqrt()},i.prototype.tan=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.tan(this.get(r,n)));return this},i.tan=function(r){return new t(r).tan()},i.prototype.tanh=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.tanh(this.get(r,n)));return this},i.tanh=function(r){return new t(r).tanh()},i.prototype.trunc=function(){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,Math.trunc(this.get(r,n)));return this},i.trunc=function(r){return new t(r).trunc()},i.pow=function(r,n){return new t(r).pow(n)},i.prototype.pow=function(r){return typeof r=="number"?this.powS(r):this.powM(r)},i.prototype.powS=function(r){for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,Math.pow(this.get(n,s),r));return this},i.prototype.powM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let n=0;n<this.rows;n++)for(let s=0;s<this.columns;s++)this.set(n,s,Math.pow(this.get(n,s),r.get(n,s)));return this}}function yr(i,t,e){let r=e?i.rows:i.rows-1;if(t<0||t>r)throw new RangeError("Row index out of range")}function Dr(i,t,e){let r=e?i.columns:i.columns-1;if(t<0||t>r)throw new RangeError("Column index out of range")}function _i(i,t){if(t.to1DArray&&(t=t.to1DArray()),t.length!==i.columns)throw new RangeError("vector size must be the same as the number of columns");return t}function mi(i,t){if(t.to1DArray&&(t=t.to1DArray()),t.length!==i.rows)throw new RangeError("vector size must be the same as the number of rows");return t}function Ba(i,t){if(!Qe.isAnyArray(t))throw new TypeError("row indices must be an array");for(let e=0;e<t.length;e++)if(t[e]<0||t[e]>=i.rows)throw new RangeError("row indices are out of range")}function Ta(i,t){if(!Qe.isAnyArray(t))throw new TypeError("column indices must be an array");for(let e=0;e<t.length;e++)if(t[e]<0||t[e]>=i.columns)throw new RangeError("column indices are out of range")}function Ia(i,t,e,r,n){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(Vs("startRow",t),Vs("endRow",e),Vs("startColumn",r),Vs("endColumn",n),t>e||r>n||t<0||t>=i.rows||e<0||e>=i.rows||r<0||r>=i.columns||n<0||n>=i.columns)throw new RangeError("Submatrix indices are out of range")}function Xs(i,t=0){let e=[];for(let r=0;r<i;r++)e.push(t);return e}function Vs(i,t){if(typeof t!="number")throw new TypeError(`${i} must be a number`)}function gi(i){if(i.isEmpty())throw new Error("Empty matrix has no elements to index")}function E1(i){let t=Xs(i.rows);for(let e=0;e<i.rows;++e)for(let r=0;r<i.columns;++r)t[e]+=i.get(e,r);return t}function x1(i){let t=Xs(i.columns);for(let e=0;e<i.rows;++e)for(let r=0;r<i.columns;++r)t[r]+=i.get(e,r);return t}function A1(i){let t=0;for(let e=0;e<i.rows;e++)for(let r=0;r<i.columns;r++)t+=i.get(e,r);return t}function C1(i){let t=Xs(i.rows,1);for(let e=0;e<i.rows;++e)for(let r=0;r<i.columns;++r)t[e]*=i.get(e,r);return t}function F1(i){let t=Xs(i.columns,1);for(let e=0;e<i.rows;++e)for(let r=0;r<i.columns;++r)t[r]*=i.get(e,r);return t}function M1(i){let t=1;for(let e=0;e<i.rows;e++)for(let r=0;r<i.columns;r++)t*=i.get(e,r);return t}function N1(i,t,e){const r=i.rows,n=i.columns,s=[];for(let a=0;a<r;a++){let l=0,f=0,h=0;for(let p=0;p<n;p++)h=i.get(a,p)-e[a],l+=h,f+=h*h;t?s.push((f-l*l/n)/(n-1)):s.push((f-l*l/n)/n)}return s}function S1(i,t,e){const r=i.rows,n=i.columns,s=[];for(let a=0;a<n;a++){let l=0,f=0,h=0;for(let p=0;p<r;p++)h=i.get(p,a)-e[a],l+=h,f+=h*h;t?s.push((f-l*l/r)/(r-1)):s.push((f-l*l/r)/r)}return s}function B1(i,t,e){const r=i.rows,n=i.columns,s=r*n;let a=0,l=0,f=0;for(let h=0;h<r;h++)for(let p=0;p<n;p++)f=i.get(h,p)-e,a+=f,l+=f*f;return t?(l-a*a/s)/(s-1):(l-a*a/s)/s}function T1(i,t){for(let e=0;e<i.rows;e++)for(let r=0;r<i.columns;r++)i.set(e,r,i.get(e,r)-t[e])}function I1(i,t){for(let e=0;e<i.rows;e++)for(let r=0;r<i.columns;r++)i.set(e,r,i.get(e,r)-t[r])}function O1(i,t){for(let e=0;e<i.rows;e++)for(let r=0;r<i.columns;r++)i.set(e,r,i.get(e,r)-t)}function $1(i){const t=[];for(let e=0;e<i.rows;e++){let r=0;for(let n=0;n<i.columns;n++)r+=Math.pow(i.get(e,n),2)/(i.columns-1);t.push(Math.sqrt(r))}return t}function L1(i,t){for(let e=0;e<i.rows;e++)for(let r=0;r<i.columns;r++)i.set(e,r,i.get(e,r)/t[e])}function R1(i){const t=[];for(let e=0;e<i.columns;e++){let r=0;for(let n=0;n<i.rows;n++)r+=Math.pow(i.get(n,e),2)/(i.rows-1);t.push(Math.sqrt(r))}return t}function P1(i,t){for(let e=0;e<i.rows;e++)for(let r=0;r<i.columns;r++)i.set(e,r,i.get(e,r)/t[r])}function z1(i){const t=i.size-1;let e=0;for(let r=0;r<i.columns;r++)for(let n=0;n<i.rows;n++)e+=Math.pow(i.get(n,r),2)/t;return Math.sqrt(e)}function q1(i,t){for(let e=0;e<i.rows;e++)for(let r=0;r<i.columns;r++)i.set(e,r,i.get(e,r)/t)}class $t{static from1DArray(t,e,r){if(t*e!==r.length)throw new RangeError("data length does not match given dimensions");let s=new pt(t,e);for(let a=0;a<t;a++)for(let l=0;l<e;l++)s.set(a,l,r[a*e+l]);return s}static rowVector(t){let e=new pt(1,t.length);for(let r=0;r<t.length;r++)e.set(0,r,t[r]);return e}static columnVector(t){let e=new pt(t.length,1);for(let r=0;r<t.length;r++)e.set(r,0,t[r]);return e}static zeros(t,e){return new pt(t,e)}static ones(t,e){return new pt(t,e).fill(1)}static rand(t,e,r={}){if(typeof r!="object")throw new TypeError("options must be an object");const{random:n=Math.random}=r;let s=new pt(t,e);for(let a=0;a<t;a++)for(let l=0;l<e;l++)s.set(a,l,n());return s}static randInt(t,e,r={}){if(typeof r!="object")throw new TypeError("options must be an object");const{min:n=0,max:s=1e3,random:a=Math.random}=r;if(!Number.isInteger(n))throw new TypeError("min must be an integer");if(!Number.isInteger(s))throw new TypeError("max must be an integer");if(n>=s)throw new RangeError("min must be smaller than max");let l=s-n,f=new pt(t,e);for(let h=0;h<t;h++)for(let p=0;p<e;p++){let c=n+Math.round(a()*l);f.set(h,p,c)}return f}static eye(t,e,r){e===void 0&&(e=t),r===void 0&&(r=1);let n=Math.min(t,e),s=this.zeros(t,e);for(let a=0;a<n;a++)s.set(a,a,r);return s}static diag(t,e,r){let n=t.length;e===void 0&&(e=n),r===void 0&&(r=e);let s=Math.min(n,e,r),a=this.zeros(e,r);for(let l=0;l<s;l++)a.set(l,l,t[l]);return a}static min(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,n=t.columns,s=new pt(r,n);for(let a=0;a<r;a++)for(let l=0;l<n;l++)s.set(a,l,Math.min(t.get(a,l),e.get(a,l)));return s}static max(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,n=t.columns,s=new this(r,n);for(let a=0;a<r;a++)for(let l=0;l<n;l++)s.set(a,l,Math.max(t.get(a,l),e.get(a,l)));return s}static checkMatrix(t){return $t.isMatrix(t)?t:new pt(t)}static isMatrix(t){return t!=null&&t.klass==="Matrix"}get size(){return this.rows*this.columns}apply(t){if(typeof t!="function")throw new TypeError("callback must be a function");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.call(this,e,r);return this}to1DArray(){let t=[];for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.push(this.get(e,r));return t}to2DArray(){let t=[];for(let e=0;e<this.rows;e++){t.push([]);for(let r=0;r<this.columns;r++)t[e].push(this.get(e,r))}return t}toJSON(){return this.to2DArray()}isRowVector(){return this.rows===1}isColumnVector(){return this.columns===1}isVector(){return this.rows===1||this.columns===1}isSquare(){return this.rows===this.columns}isEmpty(){return this.rows===0||this.columns===0}isSymmetric(){if(this.isSquare()){for(let t=0;t<this.rows;t++)for(let e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}isDistance(){if(!this.isSymmetric())return!1;for(let t=0;t<this.rows;t++)if(this.get(t,t)!==0)return!1;return!0}isEchelonForm(){let t=0,e=0,r=-1,n=!0,s=!1;for(;t<this.rows&&n;){for(e=0,s=!1;e<this.columns&&s===!1;)this.get(t,e)===0?e++:this.get(t,e)===1&&e>r?(s=!0,r=e):(n=!1,s=!0);t++}return n}isReducedEchelonForm(){let t=0,e=0,r=-1,n=!0,s=!1;for(;t<this.rows&&n;){for(e=0,s=!1;e<this.columns&&s===!1;)this.get(t,e)===0?e++:this.get(t,e)===1&&e>r?(s=!0,r=e):(n=!1,s=!0);for(let a=e+1;a<this.rows;a++)this.get(t,a)!==0&&(n=!1);t++}return n}echelonForm(){let t=this.clone(),e=0,r=0;for(;e<t.rows&&r<t.columns;){let n=e;for(let s=e;s<t.rows;s++)t.get(s,r)>t.get(n,r)&&(n=s);if(t.get(n,r)===0)r++;else{t.swapRows(e,n);let s=t.get(e,r);for(let a=r;a<t.columns;a++)t.set(e,a,t.get(e,a)/s);for(let a=e+1;a<t.rows;a++){let l=t.get(a,r)/t.get(e,r);t.set(a,r,0);for(let f=r+1;f<t.columns;f++)t.set(a,f,t.get(a,f)-t.get(e,f)*l)}e++,r++}}return t}reducedEchelonForm(){let t=this.echelonForm(),e=t.columns,r=t.rows,n=r-1;for(;n>=0;)if(t.maxRow(n)===0)n--;else{let s=0,a=!1;for(;s<r&&a===!1;)t.get(n,s)===1?a=!0:s++;for(let l=0;l<n;l++){let f=t.get(l,s);for(let h=s;h<e;h++){let p=t.get(l,h)-f*t.get(n,h);t.set(l,h,p)}}n--}return t}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(t={}){if(typeof t!="object")throw new TypeError("options must be an object");const{rows:e=1,columns:r=1}=t;if(!Number.isInteger(e)||e<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(r)||r<=0)throw new TypeError("columns must be a positive integer");let n=new pt(this.rows*e,this.columns*r);for(let s=0;s<e;s++)for(let a=0;a<r;a++)n.setSubMatrix(this,this.rows*s,this.columns*a);return n}fill(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,t);return this}neg(){return this.mulS(-1)}getRow(t){yr(this,t);let e=[];for(let r=0;r<this.columns;r++)e.push(this.get(t,r));return e}getRowVector(t){return pt.rowVector(this.getRow(t))}setRow(t,e){yr(this,t),e=_i(this,e);for(let r=0;r<this.columns;r++)this.set(t,r,e[r]);return this}swapRows(t,e){yr(this,t),yr(this,e);for(let r=0;r<this.columns;r++){let n=this.get(t,r);this.set(t,r,this.get(e,r)),this.set(e,r,n)}return this}getColumn(t){Dr(this,t);let e=[];for(let r=0;r<this.rows;r++)e.push(this.get(r,t));return e}getColumnVector(t){return pt.columnVector(this.getColumn(t))}setColumn(t,e){Dr(this,t),e=mi(this,e);for(let r=0;r<this.rows;r++)this.set(r,t,e[r]);return this}swapColumns(t,e){Dr(this,t),Dr(this,e);for(let r=0;r<this.rows;r++){let n=this.get(r,t);this.set(r,t,this.get(r,e)),this.set(r,e,n)}return this}addRowVector(t){t=_i(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[r]);return this}subRowVector(t){t=_i(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[r]);return this}mulRowVector(t){t=_i(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[r]);return this}divRowVector(t){t=_i(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[r]);return this}addColumnVector(t){t=mi(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[e]);return this}subColumnVector(t){t=mi(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[e]);return this}mulColumnVector(t){t=mi(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[e]);return this}divColumnVector(t){t=mi(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[e]);return this}mulRow(t,e){yr(this,t);for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)*e);return this}mulColumn(t,e){Dr(this,t);for(let r=0;r<this.rows;r++)this.set(r,t,this.get(r,t)*e);return this}max(t){if(this.isEmpty())return NaN;switch(t){case"row":{const e=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)>e[r]&&(e[r]=this.get(r,n));return e}case"column":{const e=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)>e[n]&&(e[n]=this.get(r,n));return e}case void 0:{let e=this.get(0,0);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)>e&&(e=this.get(r,n));return e}default:throw new Error(`invalid option: ${t}`)}}maxIndex(){gi(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)>t&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}min(t){if(this.isEmpty())return NaN;switch(t){case"row":{const e=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)<e[r]&&(e[r]=this.get(r,n));return e}case"column":{const e=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)<e[n]&&(e[n]=this.get(r,n));return e}case void 0:{let e=this.get(0,0);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)<e&&(e=this.get(r,n));return e}default:throw new Error(`invalid option: ${t}`)}}minIndex(){gi(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)<t&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}maxRow(t){if(yr(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)>e&&(e=this.get(t,r));return e}maxRowIndex(t){yr(this,t),gi(this);let e=this.get(t,0),r=[t,0];for(let n=1;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n),r[1]=n);return r}minRow(t){if(yr(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)<e&&(e=this.get(t,r));return e}minRowIndex(t){yr(this,t),gi(this);let e=this.get(t,0),r=[t,0];for(let n=1;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n),r[1]=n);return r}maxColumn(t){if(Dr(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)>e&&(e=this.get(r,t));return e}maxColumnIndex(t){Dr(this,t),gi(this);let e=this.get(0,t),r=[0,t];for(let n=1;n<this.rows;n++)this.get(n,t)>e&&(e=this.get(n,t),r[0]=n);return r}minColumn(t){if(Dr(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)<e&&(e=this.get(r,t));return e}minColumnIndex(t){Dr(this,t),gi(this);let e=this.get(0,t),r=[0,t];for(let n=1;n<this.rows;n++)this.get(n,t)<e&&(e=this.get(n,t),r[0]=n);return r}diag(){let t=Math.min(this.rows,this.columns),e=[];for(let r=0;r<t;r++)e.push(this.get(r,r));return e}norm(t="frobenius"){switch(t){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw new RangeError(`unknown norm type: ${t}`)}}cumulativeSum(){let t=0;for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t+=this.get(e,r),this.set(e,r,t);return this}dot(t){$t.isMatrix(t)&&(t=t.to1DArray());let e=this.to1DArray();if(e.length!==t.length)throw new RangeError("vectors do not have the same size");let r=0;for(let n=0;n<e.length;n++)r+=e[n]*t[n];return r}mmul(t){t=pt.checkMatrix(t);let e=this.rows,r=this.columns,n=t.columns,s=new pt(e,n),a=new Float64Array(r);for(let l=0;l<n;l++){for(let f=0;f<r;f++)a[f]=t.get(f,l);for(let f=0;f<e;f++){let h=0;for(let p=0;p<r;p++)h+=this.get(f,p)*a[p];s.set(f,l,h)}}return s}strassen2x2(t){t=pt.checkMatrix(t);let e=new pt(2,2);const r=this.get(0,0),n=t.get(0,0),s=this.get(0,1),a=t.get(0,1),l=this.get(1,0),f=t.get(1,0),h=this.get(1,1),p=t.get(1,1),c=(r+h)*(n+p),d=(l+h)*n,g=r*(a-p),w=h*(f-n),m=(r+s)*p,D=(l-r)*(n+a),v=(s-h)*(f+p),E=c+w-m+v,b=g+m,N=d+w,x=c-d+g+D;return e.set(0,0,E),e.set(0,1,b),e.set(1,0,N),e.set(1,1,x),e}strassen3x3(t){t=pt.checkMatrix(t);let e=new pt(3,3);const r=this.get(0,0),n=this.get(0,1),s=this.get(0,2),a=this.get(1,0),l=this.get(1,1),f=this.get(1,2),h=this.get(2,0),p=this.get(2,1),c=this.get(2,2),d=t.get(0,0),g=t.get(0,1),w=t.get(0,2),m=t.get(1,0),D=t.get(1,1),v=t.get(1,2),E=t.get(2,0),b=t.get(2,1),N=t.get(2,2),x=(r+n+s-a-l-p-c)*D,F=(r-a)*(-g+D),M=l*(-d+g+m-D-v-E+N),S=(-r+a+l)*(d-g+D),O=(a+l)*(-d+g),C=r*d,T=(-r+h+p)*(d-w+v),L=(-r+h)*(w-v),U=(h+p)*(-d+w),k=(r+n+s-l-f-h-p)*v,W=p*(-d+w+m-D-v-E+b),P=(-s+p+c)*(D+E-b),K=(s-c)*(D-b),G=s*E,V=(p+c)*(-E+b),tt=(-s+l+f)*(v+E-N),ft=(s-f)*(v-N),vt=(l+f)*(-E+N),lt=n*m,yt=f*b,bt=a*w,Bt=h*g,Et=c*N,ne=C+G+lt,It=x+S+O+C+P+G+V,Nt=C+T+U+k+G+tt+vt,se=F+M+S+C+G+tt+ft,Qt=F+S+O+C+yt,qt=G+tt+ft+vt+bt,Kt=C+T+L+W+P+K+G,Ne=P+K+G+V+Bt,ur=C+T+L+U+Et;return e.set(0,0,ne),e.set(0,1,It),e.set(0,2,Nt),e.set(1,0,se),e.set(1,1,Qt),e.set(1,2,qt),e.set(2,0,Kt),e.set(2,1,Ne),e.set(2,2,ur),e}mmulStrassen(t){t=pt.checkMatrix(t);let e=this.clone(),r=e.rows,n=e.columns,s=t.rows,a=t.columns;n!==s&&console.warn(`Multiplying ${r} x ${n} and ${s} x ${a} matrix: dimensions do not match.`);function l(c,d,g){let w=c.rows,m=c.columns;if(w===d&&m===g)return c;{let D=$t.zeros(d,g);return D=D.setSubMatrix(c,0,0),D}}let f=Math.max(r,s),h=Math.max(n,a);e=l(e,f,h),t=l(t,f,h);function p(c,d,g,w){if(g<=512||w<=512)return c.mmul(d);g%2===1&&w%2===1?(c=l(c,g+1,w+1),d=l(d,g+1,w+1)):g%2===1?(c=l(c,g+1,w),d=l(d,g+1,w)):w%2===1&&(c=l(c,g,w+1),d=l(d,g,w+1));let m=parseInt(c.rows/2,10),D=parseInt(c.columns/2,10),v=c.subMatrix(0,m-1,0,D-1),E=d.subMatrix(0,m-1,0,D-1),b=c.subMatrix(0,m-1,D,c.columns-1),N=d.subMatrix(0,m-1,D,d.columns-1),x=c.subMatrix(m,c.rows-1,0,D-1),F=d.subMatrix(m,d.rows-1,0,D-1),M=c.subMatrix(m,c.rows-1,D,c.columns-1),S=d.subMatrix(m,d.rows-1,D,d.columns-1),O=p($t.add(v,M),$t.add(E,S),m,D),C=p($t.add(x,M),E,m,D),T=p(v,$t.sub(N,S),m,D),L=p(M,$t.sub(F,E),m,D),U=p($t.add(v,b),S,m,D),k=p($t.sub(x,v),$t.add(E,N),m,D),W=p($t.sub(b,M),$t.add(F,S),m,D),P=$t.add(O,L);P.sub(U),P.add(W);let K=$t.add(T,U),G=$t.add(C,L),V=$t.sub(O,C);V.add(T),V.add(k);let tt=$t.zeros(2*P.rows,2*P.columns);return tt=tt.setSubMatrix(P,0,0),tt=tt.setSubMatrix(K,P.rows,0),tt=tt.setSubMatrix(G,0,P.columns),tt=tt.setSubMatrix(V,P.rows,P.columns),tt.subMatrix(0,g-1,0,w-1)}return p(e,t,f,h)}scaleRows(t={}){if(typeof t!="object")throw new TypeError("options must be an object");const{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(e>=r)throw new RangeError("min must be smaller than max");let n=new pt(this.rows,this.columns);for(let s=0;s<this.rows;s++){const a=this.getRow(s);a.length>0&&Tc(a,{min:e,max:r,output:a}),n.setRow(s,a)}return n}scaleColumns(t={}){if(typeof t!="object")throw new TypeError("options must be an object");const{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(e>=r)throw new RangeError("min must be smaller than max");let n=new pt(this.rows,this.columns);for(let s=0;s<this.columns;s++){const a=this.getColumn(s);a.length&&Tc(a,{min:e,max:r,output:a}),n.setColumn(s,a)}return n}flipRows(){const t=Math.ceil(this.columns/2);for(let e=0;e<this.rows;e++)for(let r=0;r<t;r++){let n=this.get(e,r),s=this.get(e,this.columns-1-r);this.set(e,r,s),this.set(e,this.columns-1-r,n)}return this}flipColumns(){const t=Math.ceil(this.rows/2);for(let e=0;e<this.columns;e++)for(let r=0;r<t;r++){let n=this.get(r,e),s=this.get(this.rows-1-r,e);this.set(r,e,s),this.set(this.rows-1-r,e,n)}return this}kroneckerProduct(t){t=pt.checkMatrix(t);let e=this.rows,r=this.columns,n=t.rows,s=t.columns,a=new pt(e*n,r*s);for(let l=0;l<e;l++)for(let f=0;f<r;f++)for(let h=0;h<n;h++)for(let p=0;p<s;p++)a.set(n*l+h,s*f+p,this.get(l,f)*t.get(h,p));return a}kroneckerSum(t){if(t=pt.checkMatrix(t),!this.isSquare()||!t.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let e=this.rows,r=t.rows,n=this.kroneckerProduct(pt.eye(r,r)),s=pt.eye(e,e).kroneckerProduct(t);return n.add(s)}transpose(){let t=new pt(this.columns,this.rows);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.set(r,e,this.get(e,r));return t}sortRows(t=Lc){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=Lc){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,r,n){Ia(this,t,e,r,n);let s=new pt(e-t+1,n-r+1);for(let a=t;a<=e;a++)for(let l=r;l<=n;l++)s.set(a-t,l-r,this.get(a,l));return s}subMatrixRow(t,e,r){if(e===void 0&&(e=0),r===void 0&&(r=this.columns-1),e>r||e<0||e>=this.columns||r<0||r>=this.columns)throw new RangeError("Argument out of range");let n=new pt(t.length,r-e+1);for(let s=0;s<t.length;s++)for(let a=e;a<=r;a++){if(t[s]<0||t[s]>=this.rows)throw new RangeError(`Row index out of range: ${t[s]}`);n.set(s,a-e,this.get(t[s],a))}return n}subMatrixColumn(t,e,r){if(e===void 0&&(e=0),r===void 0&&(r=this.rows-1),e>r||e<0||e>=this.rows||r<0||r>=this.rows)throw new RangeError("Argument out of range");let n=new pt(r-e+1,t.length);for(let s=0;s<t.length;s++)for(let a=e;a<=r;a++){if(t[s]<0||t[s]>=this.columns)throw new RangeError(`Column index out of range: ${t[s]}`);n.set(a-e,s,this.get(a,t[s]))}return n}setSubMatrix(t,e,r){if(t=pt.checkMatrix(t),t.isEmpty())return this;let n=e+t.rows-1,s=r+t.columns-1;Ia(this,e,n,r,s);for(let a=0;a<t.rows;a++)for(let l=0;l<t.columns;l++)this.set(e+a,r+l,t.get(a,l));return this}selection(t,e){Ba(this,t),Ta(this,e);let r=new pt(t.length,e.length);for(let n=0;n<t.length;n++){let s=t[n];for(let a=0;a<e.length;a++){let l=e[a];r.set(n,a,this.get(s,l))}}return r}trace(){let t=Math.min(this.rows,this.columns),e=0;for(let r=0;r<t;r++)e+=this.get(r,r);return e}clone(){return this.constructor.copy(this,new pt(this.rows,this.columns))}static copy(t,e){for(const[r,n,s]of t.entries())e.set(r,n,s);return e}sum(t){switch(t){case"row":return E1(this);case"column":return x1(this);case void 0:return A1(this);default:throw new Error(`invalid option: ${t}`)}}product(t){switch(t){case"row":return C1(this);case"column":return F1(this);case void 0:return M1(this);default:throw new Error(`invalid option: ${t}`)}}mean(t){const e=this.sum(t);switch(t){case"row":{for(let r=0;r<this.rows;r++)e[r]/=this.columns;return e}case"column":{for(let r=0;r<this.columns;r++)e[r]/=this.rows;return e}case void 0:return e/this.size;default:throw new Error(`invalid option: ${t}`)}}variance(t,e={}){if(typeof t=="object"&&(e=t,t=void 0),typeof e!="object")throw new TypeError("options must be an object");const{unbiased:r=!0,mean:n=this.mean(t)}=e;if(typeof r!="boolean")throw new TypeError("unbiased must be a boolean");switch(t){case"row":{if(!Qe.isAnyArray(n))throw new TypeError("mean must be an array");return N1(this,r,n)}case"column":{if(!Qe.isAnyArray(n))throw new TypeError("mean must be an array");return S1(this,r,n)}case void 0:{if(typeof n!="number")throw new TypeError("mean must be a number");return B1(this,r,n)}default:throw new Error(`invalid option: ${t}`)}}standardDeviation(t,e){typeof t=="object"&&(e=t,t=void 0);const r=this.variance(t,e);if(t===void 0)return Math.sqrt(r);for(let n=0;n<r.length;n++)r[n]=Math.sqrt(r[n]);return r}center(t,e={}){if(typeof t=="object"&&(e=t,t=void 0),typeof e!="object")throw new TypeError("options must be an object");const{center:r=this.mean(t)}=e;switch(t){case"row":{if(!Qe.isAnyArray(r))throw new TypeError("center must be an array");return T1(this,r),this}case"column":{if(!Qe.isAnyArray(r))throw new TypeError("center must be an array");return I1(this,r),this}case void 0:{if(typeof r!="number")throw new TypeError("center must be a number");return O1(this,r),this}default:throw new Error(`invalid option: ${t}`)}}scale(t,e={}){if(typeof t=="object"&&(e=t,t=void 0),typeof e!="object")throw new TypeError("options must be an object");let r=e.scale;switch(t){case"row":{if(r===void 0)r=$1(this);else if(!Qe.isAnyArray(r))throw new TypeError("scale must be an array");return L1(this,r),this}case"column":{if(r===void 0)r=R1(this);else if(!Qe.isAnyArray(r))throw new TypeError("scale must be an array");return P1(this,r),this}case void 0:{if(r===void 0)r=z1(this);else if(typeof r!="number")throw new TypeError("scale must be a number");return q1(this,r),this}default:throw new Error(`invalid option: ${t}`)}}toString(t){return Oc(this,t)}[Symbol.iterator](){return this.entries()}*entries(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield[t,e,this.get(t,e)]}*values(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield this.get(t,e)}}$t.prototype.klass="Matrix",typeof Symbol<"u"&&($t.prototype[Symbol.for("nodejs.util.inspect.custom")]=w1);function Lc(i,t){return i-t}function k1(i){return i.every(t=>typeof t=="number")}$t.random=$t.rand,$t.randomInt=$t.randInt,$t.diagonal=$t.diag,$t.prototype.diagonal=$t.prototype.diag,$t.identity=$t.eye,$t.prototype.negate=$t.prototype.neg,$t.prototype.tensorProduct=$t.prototype.kroneckerProduct;let pt=(bi=class extends $t{constructor(e,r){super();Dl(this,Vi);z(this,"data");if(bi.isMatrix(e))bl(this,Vi,El).call(this,e.rows,e.columns),bi.copy(e,this);else if(Number.isInteger(e)&&e>=0)bl(this,Vi,El).call(this,e,r);else if(Qe.isAnyArray(e)){const n=e;if(e=n.length,r=e?n[0].length:0,typeof r!="number")throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let s=0;s<e;s++){if(n[s].length!==r)throw new RangeError("Inconsistent array dimensions");if(!k1(n[s]))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(n[s]))}this.rows=e,this.columns=r}else throw new TypeError("First argument must be a positive number or an array")}set(e,r,n){return this.data[e][r]=n,this}get(e,r){return this.data[e][r]}removeRow(e){return yr(this,e),this.data.splice(e,1),this.rows-=1,this}addRow(e,r){return r===void 0&&(r=e,e=this.rows),yr(this,e,!0),r=Float64Array.from(_i(this,r)),this.data.splice(e,0,r),this.rows+=1,this}removeColumn(e){Dr(this,e);for(let r=0;r<this.rows;r++){const n=new Float64Array(this.columns-1);for(let s=0;s<e;s++)n[s]=this.data[r][s];for(let s=e+1;s<this.columns;s++)n[s-1]=this.data[r][s];this.data[r]=n}return this.columns-=1,this}addColumn(e,r){typeof r>"u"&&(r=e,e=this.columns),Dr(this,e,!0),r=mi(this,r);for(let n=0;n<this.rows;n++){const s=new Float64Array(this.columns+1);let a=0;for(;a<e;a++)s[a]=this.data[n][a];for(s[a++]=r[n];a<this.columns+1;a++)s[a]=this.data[n][a-1];this.data[n]=s}return this.columns+=1,this}},Vi=new WeakSet,El=function(e,r){if(this.data=[],Number.isInteger(r)&&r>=0)for(let n=0;n<e;n++)this.data.push(new Float64Array(r));else throw new TypeError("nColumns must be a positive integer");this.rows=e,this.columns=r},bi);b1($t,pt);const fo=class fo extends $t{constructor(e){super();Dl(this,We,void 0);if(pt.isMatrix(e)){if(!e.isSymmetric())throw new TypeError("not symmetric data");ra(this,We,pt.copy(e,new pt(e.rows,e.rows)))}else if(Number.isInteger(e)&&e>=0)ra(this,We,new pt(e,e));else if(ra(this,We,new pt(e)),!this.isSymmetric())throw new TypeError("not symmetric data")}get size(){return kr(this,We).size}get rows(){return kr(this,We).rows}get columns(){return kr(this,We).columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(e){return pt.isMatrix(e)&&e.klassType==="SymmetricMatrix"}static zeros(e){return new this(e)}static ones(e){return new this(e).fill(1)}clone(){const e=new fo(this.diagonalSize);for(const[r,n,s]of this.upperRightEntries())e.set(r,n,s);return e}toMatrix(){return new pt(this)}get(e,r){return kr(this,We).get(e,r)}set(e,r,n){return kr(this,We).set(e,r,n),kr(this,We).set(r,e,n),this}removeCross(e){return kr(this,We).removeRow(e),kr(this,We).removeColumn(e),this}addCross(e,r){r===void 0&&(r=e,e=this.diagonalSize);const n=r.slice();return n.splice(e,1),kr(this,We).addRow(e,n),kr(this,We).addColumn(e,r),this}applyMask(e){if(e.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const r=[];for(const[n,s]of e.entries())s||r.push(n);r.reverse();for(const n of r)this.removeCross(n);return this}toCompact(){const{diagonalSize:e}=this,r=new Array(e*(e+1)/2);for(let n=0,s=0,a=0;a<r.length;a++)r[a]=this.get(s,n),++n>=e&&(n=++s);return r}static fromCompact(e){const r=e.length,n=(Math.sqrt(8*r+1)-1)/2;if(!Number.isInteger(n))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(e)}`);const s=new fo(n);for(let a=0,l=0,f=0;f<r;f++)s.set(a,l,e[f]),++a>=n&&(a=++l);return s}*upperRightEntries(){for(let e=0,r=0;e<this.diagonalSize;void 0){const n=this.get(e,r);yield[e,r,n],++r>=this.diagonalSize&&(r=++e)}}*upperRightValues(){for(let e=0,r=0;e<this.diagonalSize;void 0)yield this.get(e,r),++r>=this.diagonalSize&&(r=++e)}};We=new WeakMap;let Yn=fo;Yn.prototype.klassType="SymmetricMatrix";class Qs extends Yn{static isDistanceMatrix(t){return Yn.isSymmetricMatrix(t)&&t.klassSubType==="DistanceMatrix"}constructor(t){if(super(t),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(t,e,r){return t===e&&(r=0),super.set(t,e,r)}addCross(t,e){return e===void 0&&(e=t,t=this.diagonalSize),e=e.slice(),e[t]=0,super.addCross(t,e)}toSymmetricMatrix(){return new Yn(this)}clone(){const t=new Qs(this.diagonalSize);for(const[e,r,n]of this.upperRightEntries())e!==r&&t.set(e,r,n);return t}toCompact(){const{diagonalSize:t}=this,e=(t-1)*t/2,r=new Array(e);for(let n=1,s=0,a=0;a<r.length;a++)r[a]=this.get(s,n),++n>=t&&(n=++s+1);return r}static fromCompact(t){const e=t.length,r=(Math.sqrt(8*e+1)+1)/2;if(!Number.isInteger(r))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(t)}`);const n=new this(r);for(let s=1,a=0,l=0;l<e;l++)n.set(s,a,t[l]),++s>=r&&(s=++a+1);return n}}Qs.prototype.klassSubType="DistanceMatrix";class tn extends $t{constructor(t,e,r){super(),this.matrix=t,this.rows=e,this.columns=r}}class U1 extends tn{constructor(t,e){Dr(t,e),super(t,t.rows,1),this.column=e}set(t,e,r){return this.matrix.set(t,this.column,r),this}get(t){return this.matrix.get(t,this.column)}}class W1 extends tn{constructor(t,e){Ta(t,e),super(t,t.rows,e.length),this.columnIndices=e}set(t,e,r){return this.matrix.set(t,this.columnIndices[e],r),this}get(t,e){return this.matrix.get(t,this.columnIndices[e])}}class j1 extends tn{constructor(t){super(t,t.rows,t.columns)}set(t,e,r){return this.matrix.set(t,this.columns-e-1,r),this}get(t,e){return this.matrix.get(t,this.columns-e-1)}}class Y1 extends tn{constructor(t){super(t,t.rows,t.columns)}set(t,e,r){return this.matrix.set(this.rows-t-1,e,r),this}get(t,e){return this.matrix.get(this.rows-t-1,e)}}class Z1 extends tn{constructor(t,e){yr(t,e),super(t,1,t.columns),this.row=e}set(t,e,r){return this.matrix.set(this.row,e,r),this}get(t,e){return this.matrix.get(this.row,e)}}class G1 extends tn{constructor(t,e){Ba(t,e),super(t,e.length,t.columns),this.rowIndices=e}set(t,e,r){return this.matrix.set(this.rowIndices[t],e,r),this}get(t,e){return this.matrix.get(this.rowIndices[t],e)}}class to extends tn{constructor(t,e,r){Ba(t,e),Ta(t,r),super(t,e.length,r.length),this.rowIndices=e,this.columnIndices=r}set(t,e,r){return this.matrix.set(this.rowIndices[t],this.columnIndices[e],r),this}get(t,e){return this.matrix.get(this.rowIndices[t],this.columnIndices[e])}}class K1 extends tn{constructor(t,e,r,n,s){Ia(t,e,r,n,s),super(t,r-e+1,s-n+1),this.startRow=e,this.startColumn=n}set(t,e,r){return this.matrix.set(this.startRow+t,this.startColumn+e,r),this}get(t,e){return this.matrix.get(this.startRow+t,this.startColumn+e)}}class H1 extends tn{constructor(t){super(t,t.columns,t.rows)}set(t,e,r){return this.matrix.set(e,t,r),this}get(t,e){return this.matrix.get(e,t)}}class Rc extends $t{constructor(t,e={}){const{rows:r=1}=e;if(t.length%r!==0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=r,this.columns=t.length/r,this.data=t}set(t,e,r){let n=this._calculateIndex(t,e);return this.data[n]=r,this}get(t,e){let r=this._calculateIndex(t,e);return this.data[r]}_calculateIndex(t,e){return t*this.columns+e}}class ar extends $t{constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}}function J1(i,t){if(Qe.isAnyArray(i))return i[0]&&Qe.isAnyArray(i[0])?new ar(i):new Rc(i,t);throw new Error("the argument is not an array")}class eo{constructor(t){t=ar.checkMatrix(t);let e=t.clone(),r=e.rows,n=e.columns,s=new Float64Array(r),a=1,l,f,h,p,c,d,g,w,m;for(l=0;l<r;l++)s[l]=l;for(w=new Float64Array(r),f=0;f<n;f++){for(l=0;l<r;l++)w[l]=e.get(l,f);for(l=0;l<r;l++){for(m=Math.min(l,f),c=0,h=0;h<m;h++)c+=e.get(l,h)*w[h];w[l]-=c,e.set(l,f,w[l])}for(p=f,l=f+1;l<r;l++)Math.abs(w[l])>Math.abs(w[p])&&(p=l);if(p!==f){for(h=0;h<n;h++)d=e.get(p,h),e.set(p,h,e.get(f,h)),e.set(f,h,d);g=s[p],s[p]=s[f],s[f]=g,a=-a}if(f<r&&e.get(f,f)!==0)for(l=f+1;l<r;l++)e.set(l,f,e.get(l,f)/e.get(f,f))}this.LU=e,this.pivotVector=s,this.pivotSign=a}isSingular(){let t=this.LU,e=t.columns;for(let r=0;r<e;r++)if(t.get(r,r)===0)return!0;return!1}solve(t){t=pt.checkMatrix(t);let e=this.LU;if(e.rows!==t.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let n=t.columns,s=t.subMatrixRow(this.pivotVector,0,n-1),a=e.columns,l,f,h;for(h=0;h<a;h++)for(l=h+1;l<a;l++)for(f=0;f<n;f++)s.set(l,f,s.get(l,f)-s.get(h,f)*e.get(l,h));for(h=a-1;h>=0;h--){for(f=0;f<n;f++)s.set(h,f,s.get(h,f)/e.get(h,h));for(l=0;l<h;l++)for(f=0;f<n;f++)s.set(l,f,s.get(l,f)-s.get(h,f)*e.get(l,h))}return s}get determinant(){let t=this.LU;if(!t.isSquare())throw new Error("Matrix must be square");let e=this.pivotSign,r=t.columns;for(let n=0;n<r;n++)e*=t.get(n,n);return e}get lowerTriangularMatrix(){let t=this.LU,e=t.rows,r=t.columns,n=new pt(e,r);for(let s=0;s<e;s++)for(let a=0;a<r;a++)s>a?n.set(s,a,t.get(s,a)):s===a?n.set(s,a,1):n.set(s,a,0);return n}get upperTriangularMatrix(){let t=this.LU,e=t.rows,r=t.columns,n=new pt(e,r);for(let s=0;s<e;s++)for(let a=0;a<r;a++)s<=a?n.set(s,a,t.get(s,a)):n.set(s,a,0);return n}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function en(i,t){let e=0;return Math.abs(i)>Math.abs(t)?(e=t/i,Math.abs(i)*Math.sqrt(1+e*e)):t!==0?(e=i/t,Math.abs(t)*Math.sqrt(1+e*e)):0}class Oa{constructor(t){t=ar.checkMatrix(t);let e=t.clone(),r=t.rows,n=t.columns,s=new Float64Array(n),a,l,f,h;for(f=0;f<n;f++){let p=0;for(a=f;a<r;a++)p=en(p,e.get(a,f));if(p!==0){for(e.get(f,f)<0&&(p=-p),a=f;a<r;a++)e.set(a,f,e.get(a,f)/p);for(e.set(f,f,e.get(f,f)+1),l=f+1;l<n;l++){for(h=0,a=f;a<r;a++)h+=e.get(a,f)*e.get(a,l);for(h=-h/e.get(f,f),a=f;a<r;a++)e.set(a,l,e.get(a,l)+h*e.get(a,f))}}s[f]=-p}this.QR=e,this.Rdiag=s}solve(t){t=pt.checkMatrix(t);let e=this.QR,r=e.rows;if(t.rows!==r)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let n=t.columns,s=t.clone(),a=e.columns,l,f,h,p;for(h=0;h<a;h++)for(f=0;f<n;f++){for(p=0,l=h;l<r;l++)p+=e.get(l,h)*s.get(l,f);for(p=-p/e.get(h,h),l=h;l<r;l++)s.set(l,f,s.get(l,f)+p*e.get(l,h))}for(h=a-1;h>=0;h--){for(f=0;f<n;f++)s.set(h,f,s.get(h,f)/this.Rdiag[h]);for(l=0;l<h;l++)for(f=0;f<n;f++)s.set(l,f,s.get(l,f)-s.get(h,f)*e.get(l,h))}return s.subMatrix(0,a-1,0,n-1)}isFullRank(){let t=this.QR.columns;for(let e=0;e<t;e++)if(this.Rdiag[e]===0)return!1;return!0}get upperTriangularMatrix(){let t=this.QR,e=t.columns,r=new pt(e,e),n,s;for(n=0;n<e;n++)for(s=0;s<e;s++)n<s?r.set(n,s,t.get(n,s)):n===s?r.set(n,s,this.Rdiag[n]):r.set(n,s,0);return r}get orthogonalMatrix(){let t=this.QR,e=t.rows,r=t.columns,n=new pt(e,r),s,a,l,f;for(l=r-1;l>=0;l--){for(s=0;s<e;s++)n.set(s,l,0);for(n.set(l,l,1),a=l;a<r;a++)if(t.get(l,l)!==0){for(f=0,s=l;s<e;s++)f+=t.get(s,l)*n.get(s,a);for(f=-f/t.get(l,l),s=l;s<e;s++)n.set(s,a,n.get(s,a)+f*t.get(s,l))}}return n}}class vi{constructor(t,e={}){if(t=ar.checkMatrix(t),t.isEmpty())throw new Error("Matrix must be non-empty");let r=t.rows,n=t.columns;const{computeLeftSingularVectors:s=!0,computeRightSingularVectors:a=!0,autoTranspose:l=!1}=e;let f=!!s,h=!!a,p=!1,c;if(r<n)if(!l)c=t.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else{c=t.transpose(),r=c.rows,n=c.columns,p=!0;let C=f;f=h,h=C}else c=t.clone();let d=Math.min(r,n),g=Math.min(r+1,n),w=new Float64Array(g),m=new pt(r,d),D=new pt(n,n),v=new Float64Array(n),E=new Float64Array(r),b=new Float64Array(g);for(let C=0;C<g;C++)b[C]=C;let N=Math.min(r-1,n),x=Math.max(0,Math.min(n-2,r)),F=Math.max(N,x);for(let C=0;C<F;C++){if(C<N){w[C]=0;for(let T=C;T<r;T++)w[C]=en(w[C],c.get(T,C));if(w[C]!==0){c.get(C,C)<0&&(w[C]=-w[C]);for(let T=C;T<r;T++)c.set(T,C,c.get(T,C)/w[C]);c.set(C,C,c.get(C,C)+1)}w[C]=-w[C]}for(let T=C+1;T<n;T++){if(C<N&&w[C]!==0){let L=0;for(let U=C;U<r;U++)L+=c.get(U,C)*c.get(U,T);L=-L/c.get(C,C);for(let U=C;U<r;U++)c.set(U,T,c.get(U,T)+L*c.get(U,C))}v[T]=c.get(C,T)}if(f&&C<N)for(let T=C;T<r;T++)m.set(T,C,c.get(T,C));if(C<x){v[C]=0;for(let T=C+1;T<n;T++)v[C]=en(v[C],v[T]);if(v[C]!==0){v[C+1]<0&&(v[C]=0-v[C]);for(let T=C+1;T<n;T++)v[T]/=v[C];v[C+1]+=1}if(v[C]=-v[C],C+1<r&&v[C]!==0){for(let T=C+1;T<r;T++)E[T]=0;for(let T=C+1;T<r;T++)for(let L=C+1;L<n;L++)E[T]+=v[L]*c.get(T,L);for(let T=C+1;T<n;T++){let L=-v[T]/v[C+1];for(let U=C+1;U<r;U++)c.set(U,T,c.get(U,T)+L*E[U])}}if(h)for(let T=C+1;T<n;T++)D.set(T,C,v[T])}}let M=Math.min(n,r+1);if(N<n&&(w[N]=c.get(N,N)),r<M&&(w[M-1]=0),x+1<M&&(v[x]=c.get(x,M-1)),v[M-1]=0,f){for(let C=N;C<d;C++){for(let T=0;T<r;T++)m.set(T,C,0);m.set(C,C,1)}for(let C=N-1;C>=0;C--)if(w[C]!==0){for(let T=C+1;T<d;T++){let L=0;for(let U=C;U<r;U++)L+=m.get(U,C)*m.get(U,T);L=-L/m.get(C,C);for(let U=C;U<r;U++)m.set(U,T,m.get(U,T)+L*m.get(U,C))}for(let T=C;T<r;T++)m.set(T,C,-m.get(T,C));m.set(C,C,1+m.get(C,C));for(let T=0;T<C-1;T++)m.set(T,C,0)}else{for(let T=0;T<r;T++)m.set(T,C,0);m.set(C,C,1)}}if(h)for(let C=n-1;C>=0;C--){if(C<x&&v[C]!==0)for(let T=C+1;T<n;T++){let L=0;for(let U=C+1;U<n;U++)L+=D.get(U,C)*D.get(U,T);L=-L/D.get(C+1,C);for(let U=C+1;U<n;U++)D.set(U,T,D.get(U,T)+L*D.get(U,C))}for(let T=0;T<n;T++)D.set(T,C,0);D.set(C,C,1)}let S=M-1,O=Number.EPSILON;for(;M>0;){let C,T;for(C=M-2;C>=-1&&C!==-1;C--){const L=Number.MIN_VALUE+O*Math.abs(w[C]+Math.abs(w[C+1]));if(Math.abs(v[C])<=L||Number.isNaN(v[C])){v[C]=0;break}}if(C===M-2)T=4;else{let L;for(L=M-1;L>=C&&L!==C;L--){let U=(L!==M?Math.abs(v[L]):0)+(L!==C+1?Math.abs(v[L-1]):0);if(Math.abs(w[L])<=O*U){w[L]=0;break}}L===C?T=3:L===M-1?T=1:(T=2,C=L)}switch(C++,T){case 1:{let L=v[M-2];v[M-2]=0;for(let U=M-2;U>=C;U--){let k=en(w[U],L),W=w[U]/k,P=L/k;if(w[U]=k,U!==C&&(L=-P*v[U-1],v[U-1]=W*v[U-1]),h)for(let K=0;K<n;K++)k=W*D.get(K,U)+P*D.get(K,M-1),D.set(K,M-1,-P*D.get(K,U)+W*D.get(K,M-1)),D.set(K,U,k)}break}case 2:{let L=v[C-1];v[C-1]=0;for(let U=C;U<M;U++){let k=en(w[U],L),W=w[U]/k,P=L/k;if(w[U]=k,L=-P*v[U],v[U]=W*v[U],f)for(let K=0;K<r;K++)k=W*m.get(K,U)+P*m.get(K,C-1),m.set(K,C-1,-P*m.get(K,U)+W*m.get(K,C-1)),m.set(K,U,k)}break}case 3:{const L=Math.max(Math.abs(w[M-1]),Math.abs(w[M-2]),Math.abs(v[M-2]),Math.abs(w[C]),Math.abs(v[C])),U=w[M-1]/L,k=w[M-2]/L,W=v[M-2]/L,P=w[C]/L,K=v[C]/L,G=((k+U)*(k-U)+W*W)/2,V=U*W*(U*W);let tt=0;(G!==0||V!==0)&&(G<0?tt=0-Math.sqrt(G*G+V):tt=Math.sqrt(G*G+V),tt=V/(G+tt));let ft=(P+U)*(P-U)+tt,vt=P*K;for(let lt=C;lt<M-1;lt++){let yt=en(ft,vt);yt===0&&(yt=Number.MIN_VALUE);let bt=ft/yt,Bt=vt/yt;if(lt!==C&&(v[lt-1]=yt),ft=bt*w[lt]+Bt*v[lt],v[lt]=bt*v[lt]-Bt*w[lt],vt=Bt*w[lt+1],w[lt+1]=bt*w[lt+1],h)for(let Et=0;Et<n;Et++)yt=bt*D.get(Et,lt)+Bt*D.get(Et,lt+1),D.set(Et,lt+1,-Bt*D.get(Et,lt)+bt*D.get(Et,lt+1)),D.set(Et,lt,yt);if(yt=en(ft,vt),yt===0&&(yt=Number.MIN_VALUE),bt=ft/yt,Bt=vt/yt,w[lt]=yt,ft=bt*v[lt]+Bt*w[lt+1],w[lt+1]=-Bt*v[lt]+bt*w[lt+1],vt=Bt*v[lt+1],v[lt+1]=bt*v[lt+1],f&<<r-1)for(let Et=0;Et<r;Et++)yt=bt*m.get(Et,lt)+Bt*m.get(Et,lt+1),m.set(Et,lt+1,-Bt*m.get(Et,lt)+bt*m.get(Et,lt+1)),m.set(Et,lt,yt)}v[M-2]=ft;break}case 4:{if(w[C]<=0&&(w[C]=w[C]<0?-w[C]:0,h))for(let L=0;L<=S;L++)D.set(L,C,-D.get(L,C));for(;C<S&&!(w[C]>=w[C+1]);){let L=w[C];if(w[C]=w[C+1],w[C+1]=L,h&&C<n-1)for(let U=0;U<n;U++)L=D.get(U,C+1),D.set(U,C+1,D.get(U,C)),D.set(U,C,L);if(f&&C<r-1)for(let U=0;U<r;U++)L=m.get(U,C+1),m.set(U,C+1,m.get(U,C)),m.set(U,C,L);C++}M--;break}}}if(p){let C=D;D=m,m=C}this.m=r,this.n=n,this.s=w,this.U=m,this.V=D}solve(t){let e=t,r=this.threshold,n=this.s.length,s=pt.zeros(n,n);for(let d=0;d<n;d++)Math.abs(this.s[d])<=r?s.set(d,d,0):s.set(d,d,1/this.s[d]);let a=this.U,l=this.rightSingularVectors,f=l.mmul(s),h=l.rows,p=a.rows,c=pt.zeros(h,p);for(let d=0;d<h;d++)for(let g=0;g<p;g++){let w=0;for(let m=0;m<n;m++)w+=f.get(d,m)*a.get(g,m);c.set(d,g,w)}return c.mmul(e)}solveForDiagonal(t){return this.solve(pt.diag(t))}inverse(){let t=this.V,e=this.threshold,r=t.rows,n=t.columns,s=new pt(r,this.s.length);for(let p=0;p<r;p++)for(let c=0;c<n;c++)Math.abs(this.s[c])>e&&s.set(p,c,t.get(p,c)/this.s[c]);let a=this.U,l=a.rows,f=a.columns,h=new pt(r,l);for(let p=0;p<r;p++)for(let c=0;c<l;c++){let d=0;for(let g=0;g<f;g++)d+=s.get(p,g)*a.get(c,g);h.set(p,c,d)}return h}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,e=0,r=this.s;for(let n=0,s=r.length;n<s;n++)r[n]>t&&e++;return e}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return pt.diag(this.s)}}function X1(i,t=!1){return i=ar.checkMatrix(i),t?new vi(i).inverse():Pc(i,pt.eye(i.rows))}function Pc(i,t,e=!1){return i=ar.checkMatrix(i),t=ar.checkMatrix(t),e?new vi(i).solve(t):i.isSquare()?new eo(i).solve(t):new Oa(i).solve(t)}function ro(i){if(i=pt.checkMatrix(i),i.isSquare()){if(i.columns===0)return 1;let t,e,r,n;if(i.columns===2)return t=i.get(0,0),e=i.get(0,1),r=i.get(1,0),n=i.get(1,1),t*n-e*r;if(i.columns===3){let s,a,l;return s=new to(i,[1,2],[1,2]),a=new to(i,[1,2],[0,2]),l=new to(i,[1,2],[0,1]),t=i.get(0,0),e=i.get(0,1),r=i.get(0,2),t*ro(s)-e*ro(a)+r*ro(l)}else return new eo(i).determinant}else throw Error("determinant can only be calculated for a square matrix")}function V1(i,t){let e=[];for(let r=0;r<i;r++)r!==t&&e.push(r);return e}function Q1(i,t,e,r=1e-9,n=1e-9){if(i>n)return new Array(t.rows+1).fill(0);{let s=t.addRow(e,[0]);for(let a=0;a<s.rows;a++)Math.abs(s.get(a,0))<r&&s.set(a,0,0);return s.to1DArray()}}function tw(i,t={}){const{thresholdValue:e=1e-9,thresholdError:r=1e-9}=t;i=pt.checkMatrix(i);let n=i.rows,s=new pt(n,n);for(let a=0;a<n;a++){let l=pt.columnVector(i.getRow(a)),f=i.subMatrixRow(V1(n,a)).transpose(),p=new vi(f).solve(l),c=pt.sub(l,f.mmul(p)).abs().max();s.setRow(a,Q1(c,p,a,e,r))}return s}function ew(i,t=Number.EPSILON){if(i=pt.checkMatrix(i),i.isEmpty())return i.transpose();let e=new vi(i,{autoTranspose:!0}),r=e.leftSingularVectors,n=e.rightSingularVectors,s=e.diagonal;for(let a=0;a<s.length;a++)Math.abs(s[a])>t?s[a]=1/s[a]:s[a]=0;return n.mmul(pt.diag(s).mmul(r.transpose()))}function rw(i,t=i,e={}){i=new pt(i);let r=!1;if(typeof t=="object"&&!pt.isMatrix(t)&&!Qe.isAnyArray(t)?(e=t,t=i,r=!0):t=new pt(t),i.rows!==t.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:n=!0}=e;n&&(i=i.center("column"),r||(t=t.center("column")));const s=i.transpose().mmul(t);for(let a=0;a<s.rows;a++)for(let l=0;l<s.columns;l++)s.set(a,l,s.get(a,l)*(1/(i.rows-1)));return s}function nw(i,t=i,e={}){i=new pt(i);let r=!1;if(typeof t=="object"&&!pt.isMatrix(t)&&!Qe.isAnyArray(t)?(e=t,t=i,r=!0):t=new pt(t),i.rows!==t.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:n=!0,scale:s=!0}=e;n&&(i.center("column"),r||t.center("column")),s&&(i.scale("column"),r||t.scale("column"));const a=i.standardDeviation("column",{unbiased:!0}),l=r?a:t.standardDeviation("column",{unbiased:!0}),f=i.transpose().mmul(t);for(let h=0;h<f.rows;h++)for(let p=0;p<f.columns;p++)f.set(h,p,f.get(h,p)*(1/(a[h]*l[p]))*(1/(i.rows-1)));return f}let zc=class{constructor(t,e={}){const{assumeSymmetric:r=!1}=e;if(t=ar.checkMatrix(t),!t.isSquare())throw new Error("Matrix is not a square matrix");if(t.isEmpty())throw new Error("Matrix must be non-empty");let n=t.columns,s=new pt(n,n),a=new Float64Array(n),l=new Float64Array(n),f=t,h,p,c=!1;if(r?c=!0:c=t.isSymmetric(),c){for(h=0;h<n;h++)for(p=0;p<n;p++)s.set(h,p,f.get(h,p));iw(n,l,a,s),sw(n,l,a,s)}else{let d=new pt(n,n),g=new Float64Array(n);for(p=0;p<n;p++)for(h=0;h<n;h++)d.set(h,p,f.get(h,p));ow(n,d,g,s),aw(n,l,a,s,d)}this.n=n,this.e=l,this.d=a,this.V=s}get realEigenvalues(){return Array.from(this.d)}get imaginaryEigenvalues(){return Array.from(this.e)}get eigenvectorMatrix(){return this.V}get diagonalMatrix(){let t=this.n,e=this.e,r=this.d,n=new pt(t,t),s,a;for(s=0;s<t;s++){for(a=0;a<t;a++)n.set(s,a,0);n.set(s,s,r[s]),e[s]>0?n.set(s,s+1,e[s]):e[s]<0&&n.set(s,s-1,e[s])}return n}};function iw(i,t,e,r){let n,s,a,l,f,h,p,c;for(f=0;f<i;f++)e[f]=r.get(i-1,f);for(l=i-1;l>0;l--){for(c=0,a=0,h=0;h<l;h++)c=c+Math.abs(e[h]);if(c===0)for(t[l]=e[l-1],f=0;f<l;f++)e[f]=r.get(l-1,f),r.set(l,f,0),r.set(f,l,0);else{for(h=0;h<l;h++)e[h]/=c,a+=e[h]*e[h];for(n=e[l-1],s=Math.sqrt(a),n>0&&(s=-s),t[l]=c*s,a=a-n*s,e[l-1]=n-s,f=0;f<l;f++)t[f]=0;for(f=0;f<l;f++){for(n=e[f],r.set(f,l,n),s=t[f]+r.get(f,f)*n,h=f+1;h<=l-1;h++)s+=r.get(h,f)*e[h],t[h]+=r.get(h,f)*n;t[f]=s}for(n=0,f=0;f<l;f++)t[f]/=a,n+=t[f]*e[f];for(p=n/(a+a),f=0;f<l;f++)t[f]-=p*e[f];for(f=0;f<l;f++){for(n=e[f],s=t[f],h=f;h<=l-1;h++)r.set(h,f,r.get(h,f)-(n*t[h]+s*e[h]));e[f]=r.get(l-1,f),r.set(l,f,0)}}e[l]=a}for(l=0;l<i-1;l++){if(r.set(i-1,l,r.get(l,l)),r.set(l,l,1),a=e[l+1],a!==0){for(h=0;h<=l;h++)e[h]=r.get(h,l+1)/a;for(f=0;f<=l;f++){for(s=0,h=0;h<=l;h++)s+=r.get(h,l+1)*r.get(h,f);for(h=0;h<=l;h++)r.set(h,f,r.get(h,f)-s*e[h])}}for(h=0;h<=l;h++)r.set(h,l+1,0)}for(f=0;f<i;f++)e[f]=r.get(i-1,f),r.set(i-1,f,0);r.set(i-1,i-1,1),t[0]=0}function sw(i,t,e,r){let n,s,a,l,f,h,p,c,d,g,w,m,D,v,E,b;for(a=1;a<i;a++)t[a-1]=t[a];t[i-1]=0;let N=0,x=0,F=Number.EPSILON;for(h=0;h<i;h++){for(x=Math.max(x,Math.abs(e[h])+Math.abs(t[h])),p=h;p<i&&!(Math.abs(t[p])<=F*x);)p++;if(p>h)do{for(n=e[h],c=(e[h+1]-n)/(2*t[h]),d=en(c,1),c<0&&(d=-d),e[h]=t[h]/(c+d),e[h+1]=t[h]*(c+d),g=e[h+1],s=n-e[h],a=h+2;a<i;a++)e[a]-=s;for(N=N+s,c=e[p],w=1,m=w,D=w,v=t[h+1],E=0,b=0,a=p-1;a>=h;a--)for(D=m,m=w,b=E,n=w*t[a],s=w*c,d=en(c,t[a]),t[a+1]=E*d,E=t[a]/d,w=c/d,c=w*e[a]-E*n,e[a+1]=s+E*(w*n+E*e[a]),f=0;f<i;f++)s=r.get(f,a+1),r.set(f,a+1,E*r.get(f,a)+w*s),r.set(f,a,w*r.get(f,a)-E*s);c=-E*b*D*v*t[h]/g,t[h]=E*c,e[h]=w*c}while(Math.abs(t[h])>F*x);e[h]=e[h]+N,t[h]=0}for(a=0;a<i-1;a++){for(f=a,c=e[a],l=a+1;l<i;l++)e[l]<c&&(f=l,c=e[l]);if(f!==a)for(e[f]=e[a],e[a]=c,l=0;l<i;l++)c=r.get(l,a),r.set(l,a,r.get(l,f)),r.set(l,f,c)}}function ow(i,t,e,r){let n=0,s=i-1,a,l,f,h,p,c,d;for(c=n+1;c<=s-1;c++){for(d=0,h=c;h<=s;h++)d=d+Math.abs(t.get(h,c-1));if(d!==0){for(f=0,h=s;h>=c;h--)e[h]=t.get(h,c-1)/d,f+=e[h]*e[h];for(l=Math.sqrt(f),e[c]>0&&(l=-l),f=f-e[c]*l,e[c]=e[c]-l,p=c;p<i;p++){for(a=0,h=s;h>=c;h--)a+=e[h]*t.get(h,p);for(a=a/f,h=c;h<=s;h++)t.set(h,p,t.get(h,p)-a*e[h])}for(h=0;h<=s;h++){for(a=0,p=s;p>=c;p--)a+=e[p]*t.get(h,p);for(a=a/f,p=c;p<=s;p++)t.set(h,p,t.get(h,p)-a*e[p])}e[c]=d*e[c],t.set(c,c-1,d*l)}}for(h=0;h<i;h++)for(p=0;p<i;p++)r.set(h,p,h===p?1:0);for(c=s-1;c>=n+1;c--)if(t.get(c,c-1)!==0){for(h=c+1;h<=s;h++)e[h]=t.get(h,c-1);for(p=c;p<=s;p++){for(l=0,h=c;h<=s;h++)l+=e[h]*r.get(h,p);for(l=l/e[c]/t.get(c,c-1),h=c;h<=s;h++)r.set(h,p,r.get(h,p)+l*e[h])}}}function aw(i,t,e,r,n){let s=i-1,a=0,l=i-1,f=Number.EPSILON,h=0,p=0,c=0,d=0,g=0,w=0,m=0,D=0,v,E,b,N,x,F,M,S,O,C,T,L,U,k,W;for(v=0;v<i;v++)for((v<a||v>l)&&(e[v]=n.get(v,v),t[v]=0),E=Math.max(v-1,0);E<i;E++)p=p+Math.abs(n.get(v,E));for(;s>=a;){for(N=s;N>a&&(w=Math.abs(n.get(N-1,N-1))+Math.abs(n.get(N,N)),w===0&&(w=p),!(Math.abs(n.get(N,N-1))<f*w));)N--;if(N===s)n.set(s,s,n.get(s,s)+h),e[s]=n.get(s,s),t[s]=0,s--,D=0;else if(N===s-1){if(M=n.get(s,s-1)*n.get(s-1,s),c=(n.get(s-1,s-1)-n.get(s,s))/2,d=c*c+M,m=Math.sqrt(Math.abs(d)),n.set(s,s,n.get(s,s)+h),n.set(s-1,s-1,n.get(s-1,s-1)+h),S=n.get(s,s),d>=0){for(m=c>=0?c+m:c-m,e[s-1]=S+m,e[s]=e[s-1],m!==0&&(e[s]=S-M/m),t[s-1]=0,t[s]=0,S=n.get(s,s-1),w=Math.abs(S)+Math.abs(m),c=S/w,d=m/w,g=Math.sqrt(c*c+d*d),c=c/g,d=d/g,E=s-1;E<i;E++)m=n.get(s-1,E),n.set(s-1,E,d*m+c*n.get(s,E)),n.set(s,E,d*n.get(s,E)-c*m);for(v=0;v<=s;v++)m=n.get(v,s-1),n.set(v,s-1,d*m+c*n.get(v,s)),n.set(v,s,d*n.get(v,s)-c*m);for(v=a;v<=l;v++)m=r.get(v,s-1),r.set(v,s-1,d*m+c*r.get(v,s)),r.set(v,s,d*r.get(v,s)-c*m)}else e[s-1]=S+c,e[s]=S+c,t[s-1]=m,t[s]=-m;s=s-2,D=0}else{if(S=n.get(s,s),O=0,M=0,N<s&&(O=n.get(s-1,s-1),M=n.get(s,s-1)*n.get(s-1,s)),D===10){for(h+=S,v=a;v<=s;v++)n.set(v,v,n.get(v,v)-S);w=Math.abs(n.get(s,s-1))+Math.abs(n.get(s-1,s-2)),S=O=.75*w,M=-.4375*w*w}if(D===30&&(w=(O-S)/2,w=w*w+M,w>0)){for(w=Math.sqrt(w),O<S&&(w=-w),w=S-M/((O-S)/2+w),v=a;v<=s;v++)n.set(v,v,n.get(v,v)-w);h+=w,S=O=M=.964}for(D=D+1,x=s-2;x>=N&&(m=n.get(x,x),g=S-m,w=O-m,c=(g*w-M)/n.get(x+1,x)+n.get(x,x+1),d=n.get(x+1,x+1)-m-g-w,g=n.get(x+2,x+1),w=Math.abs(c)+Math.abs(d)+Math.abs(g),c=c/w,d=d/w,g=g/w,!(x===N||Math.abs(n.get(x,x-1))*(Math.abs(d)+Math.abs(g))<f*(Math.abs(c)*(Math.abs(n.get(x-1,x-1))+Math.abs(m)+Math.abs(n.get(x+1,x+1))))));)x--;for(v=x+2;v<=s;v++)n.set(v,v-2,0),v>x+2&&n.set(v,v-3,0);for(b=x;b<=s-1&&(k=b!==s-1,b!==x&&(c=n.get(b,b-1),d=n.get(b+1,b-1),g=k?n.get(b+2,b-1):0,S=Math.abs(c)+Math.abs(d)+Math.abs(g),S!==0&&(c=c/S,d=d/S,g=g/S)),S!==0);b++)if(w=Math.sqrt(c*c+d*d+g*g),c<0&&(w=-w),w!==0){for(b!==x?n.set(b,b-1,-w*S):N!==x&&n.set(b,b-1,-n.get(b,b-1)),c=c+w,S=c/w,O=d/w,m=g/w,d=d/c,g=g/c,E=b;E<i;E++)c=n.get(b,E)+d*n.get(b+1,E),k&&(c=c+g*n.get(b+2,E),n.set(b+2,E,n.get(b+2,E)-c*m)),n.set(b,E,n.get(b,E)-c*S),n.set(b+1,E,n.get(b+1,E)-c*O);for(v=0;v<=Math.min(s,b+3);v++)c=S*n.get(v,b)+O*n.get(v,b+1),k&&(c=c+m*n.get(v,b+2),n.set(v,b+2,n.get(v,b+2)-c*g)),n.set(v,b,n.get(v,b)-c),n.set(v,b+1,n.get(v,b+1)-c*d);for(v=a;v<=l;v++)c=S*r.get(v,b)+O*r.get(v,b+1),k&&(c=c+m*r.get(v,b+2),r.set(v,b+2,r.get(v,b+2)-c*g)),r.set(v,b,r.get(v,b)-c),r.set(v,b+1,r.get(v,b+1)-c*d)}}}if(p!==0){for(s=i-1;s>=0;s--)if(c=e[s],d=t[s],d===0)for(N=s,n.set(s,s,1),v=s-1;v>=0;v--){for(M=n.get(v,v)-c,g=0,E=N;E<=s;E++)g=g+n.get(v,E)*n.get(E,s);if(t[v]<0)m=M,w=g;else if(N=v,t[v]===0?n.set(v,s,M!==0?-g/M:-g/(f*p)):(S=n.get(v,v+1),O=n.get(v+1,v),d=(e[v]-c)*(e[v]-c)+t[v]*t[v],F=(S*w-m*g)/d,n.set(v,s,F),n.set(v+1,s,Math.abs(S)>Math.abs(m)?(-g-M*F)/S:(-w-O*F)/m)),F=Math.abs(n.get(v,s)),f*F*F>1)for(E=v;E<=s;E++)n.set(E,s,n.get(E,s)/F)}else if(d<0)for(N=s-1,Math.abs(n.get(s,s-1))>Math.abs(n.get(s-1,s))?(n.set(s-1,s-1,d/n.get(s,s-1)),n.set(s-1,s,-(n.get(s,s)-c)/n.get(s,s-1))):(W=no(0,-n.get(s-1,s),n.get(s-1,s-1)-c,d),n.set(s-1,s-1,W[0]),n.set(s-1,s,W[1])),n.set(s,s-1,0),n.set(s,s,1),v=s-2;v>=0;v--){for(C=0,T=0,E=N;E<=s;E++)C=C+n.get(v,E)*n.get(E,s-1),T=T+n.get(v,E)*n.get(E,s);if(M=n.get(v,v)-c,t[v]<0)m=M,g=C,w=T;else if(N=v,t[v]===0?(W=no(-C,-T,M,d),n.set(v,s-1,W[0]),n.set(v,s,W[1])):(S=n.get(v,v+1),O=n.get(v+1,v),L=(e[v]-c)*(e[v]-c)+t[v]*t[v]-d*d,U=(e[v]-c)*2*d,L===0&&U===0&&(L=f*p*(Math.abs(M)+Math.abs(d)+Math.abs(S)+Math.abs(O)+Math.abs(m))),W=no(S*g-m*C+d*T,S*w-m*T-d*C,L,U),n.set(v,s-1,W[0]),n.set(v,s,W[1]),Math.abs(S)>Math.abs(m)+Math.abs(d)?(n.set(v+1,s-1,(-C-M*n.get(v,s-1)+d*n.get(v,s))/S),n.set(v+1,s,(-T-M*n.get(v,s)-d*n.get(v,s-1))/S)):(W=no(-g-O*n.get(v,s-1),-w-O*n.get(v,s),m,d),n.set(v+1,s-1,W[0]),n.set(v+1,s,W[1]))),F=Math.max(Math.abs(n.get(v,s-1)),Math.abs(n.get(v,s))),f*F*F>1)for(E=v;E<=s;E++)n.set(E,s-1,n.get(E,s-1)/F),n.set(E,s,n.get(E,s)/F)}for(v=0;v<i;v++)if(v<a||v>l)for(E=v;E<i;E++)r.set(v,E,n.get(v,E));for(E=i-1;E>=a;E--)for(v=a;v<=l;v++){for(m=0,b=a;b<=Math.min(E,l);b++)m=m+r.get(v,b)*n.get(b,E);r.set(v,E,m)}}}function no(i,t,e,r){let n,s;return Math.abs(e)>Math.abs(r)?(n=r/e,s=e+n*r,[(i+n*t)/s,(t-n*i)/s]):(n=e/r,s=r+n*e,[(n*i+t)/s,(n*t-i)/s])}class qc{constructor(t){if(t=ar.checkMatrix(t),!t.isSymmetric())throw new Error("Matrix is not symmetric");let e=t,r=e.rows,n=new pt(r,r),s=!0,a,l,f;for(l=0;l<r;l++){let h=0;for(f=0;f<l;f++){let p=0;for(a=0;a<f;a++)p+=n.get(f,a)*n.get(l,a);p=(e.get(l,f)-p)/n.get(f,f),n.set(l,f,p),h=h+p*p}for(h=e.get(l,l)-h,s&=h>0,n.set(l,l,Math.sqrt(Math.max(h,0))),f=l+1;f<r;f++)n.set(l,f,0)}this.L=n,this.positiveDefinite=!!s}isPositiveDefinite(){return this.positiveDefinite}solve(t){t=ar.checkMatrix(t);let e=this.L,r=e.rows;if(t.rows!==r)throw new Error("Matrix dimensions do not match");if(this.isPositiveDefinite()===!1)throw new Error("Matrix is not positive definite");let n=t.columns,s=t.clone(),a,l,f;for(f=0;f<r;f++)for(l=0;l<n;l++){for(a=0;a<f;a++)s.set(f,l,s.get(f,l)-s.get(a,l)*e.get(f,a));s.set(f,l,s.get(f,l)/e.get(f,f))}for(f=r-1;f>=0;f--)for(l=0;l<n;l++){for(a=f+1;a<r;a++)s.set(f,l,s.get(f,l)-s.get(a,l)*e.get(a,f));s.set(f,l,s.get(f,l)/e.get(f,f))}return s}get lowerTriangularMatrix(){return this.L}}class kc{constructor(t,e={}){t=ar.checkMatrix(t);let{Y:r}=e;const{scaleScores:n=!1,maxIterations:s=1e3,terminationCriteria:a=1e-10}=e;let l;if(r){if(Qe.isAnyArray(r)&&typeof r[0]=="number"?r=pt.columnVector(r):r=ar.checkMatrix(r),r.rows!==t.rows)throw new Error("Y should have the same number of rows as X");l=r.getColumnVector(0)}else l=t.getColumnVector(0);let f=1,h,p,c,d;for(let g=0;g<s&&f>a;g++)c=t.transpose().mmul(l).div(l.transpose().mmul(l).get(0,0)),c=c.div(c.norm()),h=t.mmul(c).div(c.transpose().mmul(c).get(0,0)),g>0&&(f=h.clone().sub(d).pow(2).sum()),d=h.clone(),r?(p=r.transpose().mmul(h).div(h.transpose().mmul(h).get(0,0)),p=p.div(p.norm()),l=r.mmul(p).div(p.transpose().mmul(p).get(0,0))):l=h;if(r){let g=t.transpose().mmul(h).div(h.transpose().mmul(h).get(0,0));g=g.div(g.norm());let w=t.clone().sub(h.clone().mmul(g.transpose())),m=l.transpose().mmul(h).div(h.transpose().mmul(h).get(0,0)),D=r.clone().sub(h.clone().mulS(m.get(0,0)).mmul(p.transpose()));this.t=h,this.p=g.transpose(),this.w=c.transpose(),this.q=p,this.u=l,this.s=h.transpose().mmul(h),this.xResidual=w,this.yResidual=D,this.betas=m}else this.w=c.transpose(),this.s=h.transpose().mmul(h).sqrt(),n?this.t=h.clone().div(this.s.get(0,0)):this.t=h,this.xResidual=t.sub(h.mmul(c.transpose()))}}zt.AbstractMatrix=$t,zt.CHO=qc,zt.CholeskyDecomposition=qc,zt.DistanceMatrix=Qs,zt.EVD=zc;var uw=zt.EigenvalueDecomposition=zc;zt.LU=eo,zt.LuDecomposition=eo;var Uc=zt.Matrix=pt;zt.MatrixColumnSelectionView=W1,zt.MatrixColumnView=U1,zt.MatrixFlipColumnView=j1,zt.MatrixFlipRowView=Y1,zt.MatrixRowSelectionView=G1,zt.MatrixRowView=Z1,zt.MatrixSelectionView=to,zt.MatrixSubView=K1,zt.MatrixTransposeView=H1,zt.NIPALS=kc,zt.Nipals=kc,zt.QR=Oa,zt.QrDecomposition=Oa,zt.SVD=vi,zt.SingularValueDecomposition=vi,zt.SymmetricMatrix=Yn,zt.WrapperMatrix1D=Rc,zt.WrapperMatrix2D=ar,zt.correlation=nw,zt.covariance=rw;var Wc=zt.default=pt;zt.determinant=ro,zt.inverse=X1,zt.linearDependencies=tw,zt.pseudoInverse=ew,zt.solve=Pc,zt.wrap=J1;const jc=uw,Yc=Uc;Wc.Matrix&&Wc.Matrix;class lw{constructor(t){z(this,"_errorListener");this._errorListener=t}new({rows:t,columns:e,initial_value:r}={}){return new $a(t,e,r,this._errorListener)}avg({id:t}){return t==null?void 0:t.avg()}col({id:t,column:e}){return t==null?void 0:t.col({column:e})}det({id:t}){return t==null?void 0:t.det()}get({id:t,row:e,column:r}){return t==null?void 0:t.get({row:e,column:r})}inv({id:t}){return t==null?void 0:t.inv()}max({id:t}){return t==null?void 0:t.max()}min({id:t}){return t==null?void 0:t.min()}pow({id:t,power:e}){return t==null?void 0:t.pow({power:e})}row({id:t,row:e}){return t==null?void 0:t.row({row:e})}set({id:t,row:e,column:r,value:n}){t==null||t.set({row:e,column:r,value:n})}sum({id1:t,id2:e}){return t==null?void 0:t.sum({id2:e})}copy({id:t}){return t==null?void 0:t.copy()}diff({id1:t,id2:e}){return t==null?void 0:t.diff({id2:e})}rows({id:t}){return t==null?void 0:t.rows()}columns({id:t}){return t==null?void 0:t.columns()}fill({id:t,value:e,from_row:r,to_row:n,from_column:s,to_column:a}){t==null||t.fill({value:e,from_row:r,to_row:n,from_column:s,to_column:a})}kron({id1:t,id2:e}){return t==null?void 0:t.kron({id2:e})}mode({id:t}){return t==null?void 0:t.mode()}mult({id1:t,id2:e}){return t==null?void 0:t.mult({id2:e})}pinv({id:t}){return t==null?void 0:t.pinv()}rank({id:t}){return t==null?void 0:t.rank()}sort({id:t,column:e,order:r}){t==null||t.sort({column:e,order:r})}trace({id:t}){return t==null?void 0:t.trace()}concat({id1:t,id2:e}){return t==null?void 0:t.concat({id2:e})}median({id:t}){return t==null?void 0:t.median()}add_col({id:t,column:e,array_id:r}){t==null||t.add_col({column:e,array_id:r})}add_row({id:t,row:e,array_id:r}){t==null||t.add_row({row:e,array_id:r})}is_zero({id:t}){return t==null?void 0:t.is_zero()}reshape({id:t,rows:e,columns:r},n){return t==null?void 0:t.reshape({rows:e,columns:r},n)}reverse({id:t}){t==null||t.reverse()}is_binary({id:t}){return t==null?void 0:t.is_binary()}is_square({id:t}){return t==null?void 0:t.is_square()}submatrix({id:t,from_row:e,to_row:r,from_column:n,to_column:s}){return t==null?void 0:t.submatrix({from_row:e,to_row:r,from_column:n,to_column:s})}swap_rows({id:t,row1:e,row2:r}){t==null||t.swap_rows({row1:e,row2:r})}transpose({id:t}){return t==null?void 0:t.transpose()}remove_col({id:t,column:e}){return t==null?void 0:t.remove_col({column:e})}remove_row({id:t,row:e}){return t==null?void 0:t.remove_row({row:e})}eigenvalues({id:t}){return t==null?void 0:t.eigenvalues()}is_diagonal({id:t}){return t==null?void 0:t.is_diagonal()}is_identity({id:t}){return t==null?void 0:t.is_identity()}eigenvectors({id:t}){return t==null?void 0:t.eigenvectors()}is_symmetric({id:t}){return t==null?void 0:t.is_symmetric()}swap_columns({id:t,column1:e,column2:r}){t==null||t.swap_columns({column1:e,column2:r})}is_stochastic({id:t}){return t==null?void 0:t.is_stochastic()}is_triangular({id:t}){return t==null?void 0:t.is_triangular()}elements_count({id:t}){return t==null?void 0:t.elements_count()}is_antidiagonal({id:t}){return t==null?void 0:t.is_antidiagonal()}is_antisymmetric({id:t}){return t==null?void 0:t.is_antisymmetric()}}class $a{constructor(t=0,e=0,r=void 0,n){z(this,"_matrixInstance");z(this,"_errorListener");this._matrixInstance=this._createMatrix(t,e,r),this._errorListener=n}get _matrixArray(){return this._matrixInstance.map(t=>[...t._value])}get _value(){return this._matrixInstance}set _value(t){this._matrixInstance=t}get isMatrix(){return!0}_createMatrix(t,e,r){return Array.from(new Array(t),()=>new Jt(e,r,this._errorListener))}avg(){let t=0,e=0;for(const n of this._matrixInstance)for(const s of n._value)t+=_t(s)?0:s,e+=1;return t/e}col({column:t}){const e=[],r=new Jt(0,void 0,this._errorListener);if(_t(t))return r;for(const n of this._matrixInstance)e.push(n._value[t]);return r._value=e,r}det(){return Sc(this._matrixArray)}get({row:t,column:e}){var r,n;if(!(_t(t)||_t(e)))return(n=(r=this._matrixInstance[t])==null?void 0:r._value)==null?void 0:n[e]}inv(){const t=Hs(this._matrixArray);return this._newMatrix(t)}max(){return r1(this._matrixArray)}min(){return Sa(this._matrixArray)}pow({power:t}){const e=_t(t)?this._matrixArray:i1(this._matrixArray,t);return this._newMatrix(e)}row({row:t}){return _t(t)?new Jt(0,void 0,this._errorListener):this._matrixInstance[t]}set({row:t,column:e,value:r}){_t(t)||_t(e)||this._matrixInstance[t].set({index:e,value:r})}sum({id2:t}){const e=Gi(this._matrixArray,typeof t=="number"?t:t._matrixArray);return this._newMatrix(e)}copy(){return this._newMatrix(this._matrixArray)}diff({id2:t}){const e=Jv(this._matrixArray,typeof t=="number"?t:t._matrixArray);return this._newMatrix(e)}rows(){return this._matrixInstance.length}columns(){return this._matrixArray.length&&this._matrixArray[0].length}fill({value:t,from_row:e,to_row:r,from_column:n,to_column:s}={}){_t(e)&&(e=0),_t(r)&&(r=this.rows()),_t(n)&&(n=0),_t(s)&&(s=this.columns());for(const[a,l]of this._matrixInstance.entries())for(const[f]of l._value.entries())a<r&&a>=e&&f>=n&&f<s&&l.set({index:f,value:t})}kron({id2:t}){const e=Kv(this._matrixArray,t._matrixArray);return this._newMatrix(e)}mode(){return Sa(Ec(this._matrixArray))}mult({id2:t}){const e=typeof t=="number"?t:t._matrixArray?t._matrixArray:t._value,r=di(this._matrixArray,e);return this._newMatrix(r)}pinv(){const t=n1(this._matrixArray);return this._newMatrix(t)}rank(){return this._matrixRank(this._matrixArray)}sort({column:t,order:e=zn.ascending}={}){_t(t)&&(t=0),this._matrixInstance.sort((r,n)=>{const s=r._value[t],a=n._value[t];return e!==zn.descending?s-a:a-s})}trace(){return e1(this._matrixArray)}concat({id2:t}){for(const e of t._value)this._matrixInstance.push(e);return this}median(){return Bc(this._matrixArray)}add_col({column:t,array_id:e}={}){_t(t)&&(t=this.columns());for(const[r,n]of this._matrixInstance.entries())n.insert({index:t,value:e?e._value[r]:void 0})}add_row({row:t,array_id:e}){_t(t)&&(t=this.rows()),this._matrixInstance.splice(t,0,e||new Jt(this.columns(),void 0,this._errorListener))}is_zero(){return this._matrixArray.every(t=>t.every(e=>e===0))}reshape({rows:t=0,columns:e=0},r){if(t*e!==this.columns()*this.rows()){this._errorListener.addError("New matrix must be of same area as original matrix",r,Ce.Error);return}const n=jv(this._matrixArray,[t,e]);this._matrixInstance=n.map(s=>{const a=new Jt(0,void 0,this._errorListener);return a._value=[...s],a})}reverse(){this._matrixInstance.reverse();for(const t of this._matrixInstance)t.reverse()}is_binary(){return this._matrixArray.every(t=>t.every(e=>e===0||e===1))}is_square(){return this.rows()===this.columns()}submatrix({from_row:t,to_row:e,from_column:r,to_column:n}={}){_t(t)&&(t=0),_t(e)&&(e=this.rows()),_t(r)&&(r=0),_t(n)&&(n=this.columns());const s=this._matrixArray.splice(t,e),a=[];for(const l of s)a.push(l.splice(r,n));return this._newMatrix(a)}swap_rows({row1:t,row2:e}){if(_t(t)||_t(e))return;const r=this._matrixInstance[t],n=this._matrixInstance[e];this._matrixInstance[t]=n,this._matrixInstance[e]=r}transpose(){const t=Ac(this._matrixArray);return this._newMatrix(t)}remove_col({column:t}={}){_t(t)&&(t=this.columns());const e=[];for(const n of this._matrixInstance){const s=n._value.splice(t,1);e.push(s[0])}const r=new Jt(0,void 0,this._errorListener);return r._value=e,r}remove_row({row:t}={}){return _t(t)&&(t=this.rows()),this._matrixInstance.splice(t,1)[0]}eigenvalues(){const t=new jc(new Yc(this._matrixArray)),e=new Jt(0,void 0,this._errorListener);return e._value=t.realEigenvalues,e}is_diagonal(){const t=this.rows(),e=this.columns();if(t!==e)return!1;const r=this._matrixArray;for(let n=0;n<t;n++)for(let s=0;s<e;s++)if(n!==s&&r[n][s]!==0)return!1;return!0}is_identity(){const t=this.rows(),e=this.columns();if(t!==e)return!1;const r=this._matrixArray;for(let n=0;n<t;n++)for(let s=0;s<e;s++)if(n!==s&&r[n][s]!==0||n===s&&r[n][s]!==1)return!1;return!0}eigenvectors(){const t=new jc(new Yc(this._matrixArray));return this._newMatrix(t.eigenvectorMatrix.to2DArray())}is_symmetric(){const t=this.rows(),e=this.columns();if(t!==e)return!1;const r=this._matrixArray;for(let n=0;n<t;n++)for(let s=n+1;s<e;s++)if(r[n][s]!==r[s][n])return!1;return!0}swap_columns({column1:t,column2:e}){if(!(_t(t)||_t(e)))for(const r of this._matrixInstance){const n=r._value[t],s=r._value[e];r.set({index:t,value:s}),r.set({index:e,value:n})}}is_stochastic(){const t=this._matrixArray;for(let e=0;e<t.length;e++){let r=0;for(let n=0;n<t[e].length;n++){if(t[e][n]<0)return!1;r+=t[e][n]}if(Math.abs(r-1)>Number.EPSILON)return!1}return!0}is_triangular(){const t=this.rows(),e=this.columns();return t!==e?!1:this._isUpperTriangular(t)||this._isLowerTriangular(t)}elements_count(){return Yv(this._matrixArray)}is_antidiagonal(){const t=this.rows(),e=this.columns();if(t!==e)return!1;const r=this._matrixArray;for(let n=0;n<t;n++)for(let s=0;s<t;s++)if(n+s!==t-1&&r[n][s]!==0)return!1;return!0}is_antisymmetric(){const t=this.rows(),e=this.columns();if(t!==e)return!1;const r=this._matrixArray;for(let n=0;n<t;n++)for(let s=0;s<t;s++)if(n!==s&&r[n][s]!==-r[s][n])return!1;return!0}_isUpperTriangular(t){const e=this._matrixArray;for(let r=1;r<t;r++)for(let n=0;n<r;n++)if(e[r][n]!==0)return!1;return!0}_isLowerTriangular(t){const e=this._matrixArray;for(let r=0;r<t-1;r++)for(let n=r+1;n<t;n++)if(e[r][n]!==0)return!1;return!0}_newMatrix(t){const e=new $a(0,0,void 0,this._errorListener);return e._value=t.map(r=>{const n=new Jt(0,void 0,this._errorListener);return n._value=[...r],n}),e}_matrixRank(t){let e=0;const r=t.length,n=t[0].length,s=[...t].map(a=>[...a]);for(let a=0;a<r&&!(a>=n);a++){let l=a;for(;l<r&&s[l][a]===0;)l++;if(l===r)continue;if(l!==a){const h=s[l];s[l]=s[a],s[a]=h}const f=s[a][a];for(let h=0;h<n;h++)s[a][h]/=f;for(let h=a+1;h<r;h++){const p=s[h][a];s[h]=s[h].map((c,d)=>c-p*s[a][d]),s[h][a]=0}}for(let a=0;a<r;a++)s[a].some(l=>Number(l.toFixed(8))!==0)&&e++;return e}}class fw{constructor(t){z(this,"_variables");z(this,"_cacheData");this._variables=t,this._cacheData={}}change({timeframe:t},e){if(!t)return!0;const r=Xr(t),n=Xr(this._variables.timeframe.period);if(r<n)return!0;const s=`change_${e}`,a=this._cacheData[s],l=this._variables.time;if(a){if(a.offset){if(a.currentTime+a.offset<=l)return this._cacheData[s]={currentTime:l,offset:0},!0}else if(a.currentTime+r*1e3<=l)return this._cacheData[s]={currentTime:l,offset:0},!0}else{const f=this._calcTimeOffset(l,t);return this._cacheData[s]={currentTime:l,offset:f},!1}return!1}in_seconds({timeframe:t}={}){return Xr(t||this._variables.timeframe.period)}from_seconds({seconds:t=0}){const e=t*1e3,r=Vt.duration(e);if(r.years())return"12M";const s=r.asMonths();if(Gs(s))return`${s}M`;const a=r.asWeeks();if(Gs(a))return`${a}M`;const l=r.asDays();if(l>=1)return`${Math.ceil(l)}D`;const f=r.asMinutes();if(f>=1)return`${Math.ceil(f)}`;const h=r.asSeconds();return h<=1?"1S":h<=5?"5S":h<=10?"10S":h<=15?"15S":h<=30?"30S":"1"}_calcTimeOffset(t,e){let r=0;if(e.includes("W")){const l=Vt(t).day();e="1D",l!==1&&(r=(8-l)*60*60*24*1e3)}else if(e.includes("M")){const l=Vt(t).date();e="1D";const f=Vt(t).daysInMonth();l!==1&&(r=(f-l+1)*60*60*24*1e3)}const n=this._variables.getTimeTradingday(t,e),s=Xr(e)*1e3,a=t-n-Math.floor((t-n)/s)*s;return r?r-a:a}}class cw{constructor(t){z(this,"_errorListener");this._errorListener=t}pos({source:t="",str:e=""}){return t==null?void 0:t.indexOf(e)}trim({source:t=""}){return t==null?void 0:t.trim()}lower({source:t=""}){return t==null?void 0:t.toLocaleLowerCase()}match({source:t="",regex:e=""}){const r=t==null?void 0:t.match(new RegExp(e));return r?r[0]:""}split({string:t="",separator:e=""}){const r=t==null?void 0:t.split(e),n=new Jt;return n._value=r||[],n}upper({source:t=""}){return t==null?void 0:t.toLocaleUpperCase()}format({formatString:t=""},e){return this._strFormat(t,e)}length({string:t=""}){return t==null?void 0:t.length}repeat({source:t="",repeat:e,separator:r=""},n){if(_t(e)){this._errorListener.addError("Invalid array length",n,Ce.Error);return}return Array.from(new Array(e),()=>t).join(r)}replace({source:t="",target:e="",replacement:r="",occurrence:n}){_t(n)&&(n=0);let s=-1;for(let a=0;a<n+1&&(s=t.indexOf(e,s+1),s!==-1);a++);return s!==-1?t.substring(0,s)+r+t.substring(s+e.length):t}contains({source:t="",str:e=""}){return t==null?void 0:t.includes(e)}endswith({source:t="",str:e=""}){return t==null?void 0:t.endsWith(e)}tonumber({string:t=""}){if(/[^\d.]/.test(t))return;const e=parseFloat(t);return isNaN(e)?void 0:e}tostring({value:t,format:e}){if(t===void 0)return"NaN";if(typeof t=="object"){if(t.isArray)return this._arrToStr(t._value,e);if(t.isMatrix){const r=[];for(const n of t._matrixArray)r.push(this._arrToStr(n,e));return r.join(`
|
62
|
+
`)}}if(typeof t=="string")return t;if(typeof t=="boolean")return String(t);if(typeof t=="number")return this._formatNumber(t,e)}_arrToStr(t,e){return`[${t.map(n=>typeof n=="number"?this._formatNumber(n,e):n).toString()}]`}substring({source:t="",begin_pos:e=0,end_pos:r}){return _t(e)&&(e=0),_t(r)&&(r=void 0),t==null?void 0:t.substring(e,r)}startswith({source:t="",str:e=""}){return t==null?void 0:t.startsWith(e)}format_time({time:t,format:e="yyyy-MM-dd'T'HH:mm:ssZ",timezone:r}){return _t(t)&&(t=0),Br(t,r).format(e)}replace_all({source:t="",target:e="",replacement:r=""}){return t==null?void 0:t.replace(new RegExp(e,"g"),r)}_formatNumber(t,e){if(!e)return t;switch(e){case"integer":return String(Math.round(t));case"currency":return`$${t}`;case"percent":return`${t*100}%`;default:const r=e.split(".")[1],n=r?r.length:0;return parseFloat(t.toFixed(n))}}_strFormat(t,e){let r=t;return e.forEach((n,s)=>{if(typeof n=="number"){const a=`\\{\\s*${s}\\s*,\\s*number\\s*,\\s*([^\\}]+)\\s*\\}`,l=t.match(new RegExp(a));if(l){const f=l[1];r=r.replace(new RegExp(a,"g"),String(this._formatNumber(n,f)))}else r=r.replace(new RegExp(`\\{${s}\\}`,"g"),String(n))}else r=r.replace(new RegExp(`\\{${s}\\}`,"g"),n)}),r}}class hw{constructor(t){z(this,"_errorListener");this._errorListener=t}new(){return new La(this._errorListener)}copy({id:t}){return t==null?void 0:t.copy()}get({id:t,key:e}){return t==null?void 0:t.get({key:e})}put({id:t,key:e,value:r}){return t==null?void 0:t.put({key:e,value:r})}keys({id:t}){return t==null?void 0:t.keys()}size({id:t}){return t==null?void 0:t.size()}clear({id:t}){t==null||t.clear()}remove({id:t,key:e}){return t==null?void 0:t.remove({key:e})}values({id:t}){return t==null?void 0:t.values()}put_all({id:t,id2:e}){t==null||t.put_all({id2:e})}contains({id:t,key:e}){return t==null?void 0:t.contains({key:e})}}class La{constructor(t){z(this,"_errorListener");z(this,"_mapInstance");this._errorListener=t,this._mapInstance=new Map}get isMap(){return!0}_copyMap(t){const e=new La(this._errorListener);return e._mapInstance=new Map(t.entries()),e}copy(){return this._copyMap(this._mapInstance)}get({key:t}){return this._mapInstance.get(t)}put({key:t,value:e}){return this._mapInstance.set(t,e)}keys(){const t=new Jt(0,void 0,this._errorListener);return t._value=[...this._mapInstance.keys()],t}size(){return this._mapInstance.size}clear(){this._mapInstance.clear()}remove({key:t}){const e=this._mapInstance.get(t);return this._mapInstance.delete(t),e||void 0}values(){const t=new Jt(0,void 0,this._errorListener);return t._value=[...this._mapInstance.values()],t}put_all({id2:t}){this._mapInstance=new Map([...this._mapInstance,...t._mapInstance])}contains({key:t}){return this._mapInstance.has(t)}}class pw{constructor(t){z(this,"_variables");this._variables=t}new({price:t,time:e,index:r}){return new Zn(t,r,e)}now({price:t}){const{time:e,bar_index:r}=this._variables;return new Zn(t,r,e)}copy({id:t}){const{price:e,time:r,index:n}=t||{};return new Zn(e,n,r)}from_index({price:t,index:e}){return new Zn(t,e)}from_time({price:t,time:e}){return new Zn(t,void 0,e)}}class Zn{constructor(t,e,r){z(this,"_index");z(this,"_price");z(this,"_time");this._index=e,this._price=t,this._time=r}get index(){return this._index}get price(){return this._price}get time(){return this._time}copy(){return new Zn(this._price,this._index,this._time)}}class dw{constructor(t){z(this,"_variables");z(this,"_defaultLabel",{text:"",xloc:$e.bar_index,yloc:qi.price,size:jr.normal,style:ge.styleLabelDown,textalign:Xe.alignCenter});this._variables=t}new(t,e){const r=`label_${e}`,n={...this._defaultLabel,...t,id:r};t.point&&(n.x=n.xloc===$e.bar_index?t.point.index:t.point.time,n.y=t.point.price);const s=new Hi(r,this._variables);return this._variables.label.add(r,n,s),s}label(t,e){return t.x?t.x:new Hi(e,this._variables)}copy({id:t},e){return t==null?void 0:t.copy(e)}get_x({id:t},e){return t==null?void 0:t.get_x(e)}get_y({id:t},e){return t==null?void 0:t.get_y(e)}set_x({id:t,...e},r){t==null||t.set_x(e,r)}set_y({id:t,...e},r){t==null||t.set_y(e,r)}delete({id:t}){t==null||t.delete()}get_text({id:t},e){return t==null?void 0:t.get_text(e)}set_xy({id:t,...e},r){t==null||t.set_xy(e,r)}set_size({id:t,...e},r){t==null||t.set_size(e,r)}set_xloc({id:t,...e},r){t==null||t.set_xloc(e,r)}set_yloc({id:t,...e},r){t==null||t.set_yloc(e,r)}set_style({id:t,...e},r){t==null||t.set_style(e,r)}set_color({id:t,...e},r){t==null||t.set_color(e,r)}set_tooltip({id:t,...e},r){t==null||t.set_tooltip(e,r)}set_point({id:t,...e},r){t==null||t.set_point(e,r)}set_text({id:t,...e},r){t==null||t.set_text(e,r)}set_textcolor({id:t,...e},r){t==null||t.set_textcolor(e,r)}set_textalign({id:t,...e},r){t==null||t.set_textalign(e,r)}set_text_font_family({id:t,...e},r){t==null||t.set_text_font_family(e,r)}}class Hi{constructor(t,e){z(this,"_id");z(this,"_variables");this._id=t,this._variables=e}copy(t){const e=`label_${t}`,r=this._getLabel(t),n=new Hi(e,this._variables);return r&&this._variables.label.add(e,{...r,id:e},n),n}get_x(t){var e;return(e=this._getLabel(t))==null?void 0:e.x}get_y(t){var e;return(e=this._getLabel(t))==null?void 0:e.y}set_x({x:t},e){const r=this._getLabel(e);r&&(r.x=t)}set_y({y:t},e){const r=this._getLabel(e);r&&(r.y=t)}delete(){this._variables.label.delete(this._id)}set_xy({x:t,y:e},r){const n=this._getLabel(r);n&&(n.x=t,n.y=e)}get_text(t){var e;return(e=this._getLabel(t))==null?void 0:e.text}set_size({size:t},e){const r=this._getLabel(e);r&&(r.size=t)}set_text({text:t},e){const r=this._getLabel(e);r&&(r.text=t)}set_xloc({x:t,xloc:e},r){const n=this._getLabel(r);n&&(n.x=t,n.xloc=e)}set_yloc({yloc:t},e){const r=this._getLabel(e);r&&(r.yloc=t)}set_color({color:t},e){const r=this._getLabel(e);r&&(r.color=t)}set_point({point:t},e){const r=this._getLabel(e);r&&(r.x=r.xloc===$e.bar_index?t==null?void 0:t.index:t==null?void 0:t.time,r.y=t==null?void 0:t.price)}set_style({style:t},e){const r=this._getLabel(e);r&&(r.style=t)}set_tooltip({tooltip:t},e){const r=this._getLabel(e);r&&(r.tooltip=t)}set_textalign({textalign:t},e){const r=this._getLabel(e);r&&(r.textalign=t)}set_textcolor({textcolor:t},e){const r=this._getLabel(e);r&&(r.textcolor=t)}set_text_font_family({text_font_family:t},e){const r=this._getLabel(e);r&&(r.text_font_family=t)}_getLabel(t){const e=this._variables.label.get(this._id);return e||console.log(`错误${t}: label 不存在`),e}}const _w={freq_all:dn.freqAll,freq_once_per_bar:dn.freqOncePerBar,freq_once_per_bar_close:dn.freqOncePerBarClose},mw={gaps_off:zi.gapsOff,gaps_on:zi.gapsOn,lookahead_off:zi.lookaheadOff,lookahead_on:zi.lookaheadOn},wi={aqua:"#00BCD4",black:"#363A45",blue:"#2196F3",fuchsia:"#E040FB",gray:"#787B86",green:"#4CAF50",lime:"#00E676",maroon:"#880E4F",navy:"#311B92",olive:"#808000",orange:"#FF9800",purple:"#9C27B0",red:"#FF5252",silver:"#B2B5BE",teal:"#00897B",white:"#FFFFFF",yellow:"#FFEB3B"},Zc={AUD:"AUD",BTC:"BTC",CAD:"CAD",CHF:"CHF",ETH:"ETH",EUR:"EUR",GBP:"GBP",HKD:"HKD",INR:"INR",JPY:"JPY",KRW:"KRW",MYR:"MYR",NOK:"NOK",NONE:"NONE",NZD:"NZD",RUB:"RUB",SEK:"SEK",SGD:"SGD",TRY:"TRY",USD:"USD",USDT:"USDT",ZAR:"ZAR"},gw={friday:6,monday:2,saturday:7,sunday:1,thursday:5,tuesday:3,wednesday:4},vw={all:[ir.dataWindow,ir.pane,ir.priceScale,ir.statusLine],data_window:[ir.dataWindow],none:[],pane:[ir.pane],price_scale:[ir.priceScale],status_line:[ir.statusLine]},ww={both:Rn.both,left:Rn.left,none:Rn.none,right:Rn.right},yw={inherit:Pn.inherit,mintick:Pn.mintick,percent:Pn.percent,price:Pn.price,volume:Pn.volume},Dw={style_solid:vs.styleSolid,style_dashed:vs.styleDashed,style_dotted:vs.styleDotted},bw={style_arrowdown:ge.styleArrowdown,style_arrowup:ge.styleArrowup,style_circle:ge.styleCircle,style_cross:ge.styleCross,style_diamond:ge.styleDiamond,style_flag:ge.styleFlag,style_label_center:ge.styleLabelCenter,style_label_down:ge.styleLabelDown,style_label_left:ge.styleLabelLeft,style_label_lower_left:ge.styleLabelLowerLeft,style_label_lower_right:ge.styleLabelLowerRight,style_label_right:ge.styleLabelRight,style_label_up:ge.styleLabelUp,style_label_upper_left:ge.styleLabelUpperLeft,style_label_upper_right:ge.styleLabelUpperRight,style_none:ge.styleNone,style_square:ge.styleSquare,style_text_outline:ge.styleTextOutline,style_triangledown:ge.styleTriangledown,style_triangleup:ge.styleTriangleup,style_xcross:ge.styleXcross},Ew={style_arrow_both:Wr.styleArrowBoth,style_arrow_left:Wr.styleArrowLeft,style_arrow_right:Wr.styleArrowRight,style_dashed:Wr.styleDashed,style_dotted:Wr.styleDotted,style_solid:Wr.styleSolid},xw={abovebar:si.abovebar,absolute:si.absolute,belowbar:si.belowbar,bottom:si.bottom,top:si.top},Aw={e:2.718281828459045,phi:1.618033988749895,pi:3.141592653589793,rphi:.6180339887498948},Cw={style_area:vr.styleArea,style_areabr:vr.styleAreabr,style_circles:vr.styleCircles,style_columns:vr.styleColumns,style_cross:vr.styleCross,style_histogram:vr.styleHistogram,style_line:vr.styleLine,style_linebr:vr.styleLinebr,style_stepline:vr.styleStepline,style_stepline_diamond:vr.styleSteplineDiamond,style_steplinebr:vr.styleSteplinebr},Fw={bottom_center:Tr.bottomCenter,bottom_left:Tr.bottomLeft,bottom_right:Tr.bottomRight,middle_center:Tr.middleCenter,middle_left:Tr.middleLeft,middle_right:Tr.middleRight,top_center:Tr.topCenter,top_left:Tr.topLeft,top_right:Tr.topRight},Mw={left:ws.left,none:ws.none,right:ws.right},Nw={arrowdown:sr.arrowdown,arrowup:sr.arrowup,circle:sr.circle,cross:sr.cross,diamond:sr.diamond,flag:sr.flag,labeldown:sr.labeldown,labelup:sr.labelup,square:sr.square,triangledown:sr.triangledown,triangleup:sr.triangleup,xcross:sr.xcross},Sw={auto:jr.auto,huge:jr.huge,large:jr.large,normal:jr.normal,small:jr.small,tiny:jr.tiny},Bw={cash:Ge.cash,fixed:Ge.fixed,percent_of_equity:Ge.percentOfEquity,commission:{cash_per_contract:Ir.cashPerContract,cash_per_order:Ir.cashPerOrder,percent:Ir.percent},direction:{all:pe.all,long:pe.long,short:pe.short},oca:{cancel:qn.cancel,none:qn.none,reduce:qn.reduce}},Tw={align_bottom:Xe.alignBottom,align_center:Xe.alignCenter,align_left:Xe.alignLeft,align_right:Xe.alignRight,align_top:Xe.alignTop,wrap_auto:Xe.wrapAuto,wrap_none:Xe.wrapNone},Iw={bar_index:$e.bar_index,bar_time:$e.bar_time},Ow={abovebar:qi.abovebar,belowbar:qi.belowbar,price:qi.price},$w={actual:ys.actual,estimate:ys.estimate,standardized:ys.standardized};class Lw{constructor(){z(this,"adjustment",{dividends:gs.dividends,none:gs.none,splits:gs.splits});z(this,"alert",_w);z(this,"barmerge",mw);z(this,"color",wi);z(this,"currency",Zc);z(this,"dayofweek",gw);z(this,"earnings",$w);z(this,"display",vw);z(this,"extend",ww);z(this,"font",{family_default:"SimSun",family_monospace:"Monospace"});z(this,"format",yw);z(this,"hline",Dw);z(this,"label",bw);z(this,"line",Ew);z(this,"location",xw);z(this,"math",Aw);z(this,"order",{ascending:zn.ascending,descending:zn.descending});z(this,"plot",Cw);z(this,"position",Fw);z(this,"scale",Mw);z(this,"session",{extended:na.extended,regular:na.regular});z(this,"shape",Nw);z(this,"size",Sw);z(this,"splits",{denominator:"denominator",numerator:"numerator"});z(this,"strategy",Bw);z(this,"text",Tw);z(this,"xloc",Iw);z(this,"yloc",Ow)}updateData(){}}class Rw{constructor(t){z(this,"_variables");z(this,"_defaultPolyline",{curved:!1,closed:!1,xloc:$e.bar_index,line_color:wi.blue,line_style:Wr.styleSolid,line_width:1});this._variables=t}new(t,e){const r=`polyline_${e}`,n=Object.assign({},this._defaultPolyline,t,{id:r}),s=new Gc(r,this._variables);return this._variables.polyline.add(r,n,s),s}delete({id:t}){t&&t.delete()}}class Gc{constructor(t,e){z(this,"_id");z(this,"_variables");this._variables=e,this._id=t}delete(){this._variables.polyline.delete(this._id)}}class Pw{constructor(t){z(this,"_variables");z(this,"_defaultLine",{xloc:$e.bar_index,extend:Rn.none,style:Wr.styleSolid});this._variables=t}new({first_point:t,second_point:e,...r},n){const s=`line_${n}`,a={...this._defaultLine,...r,id:s};if(t&&e){const f=a.xloc===$e.bar_index?t.index:t.time,h=a.xloc===$e.bar_index?e.index:e.time;Object.assign(a,{x1:f,y1:t.price,x2:h,y2:e.price})}const l=new Ji(s,this._variables);return this._variables.line.add(s,a,l),l}line(t,e){return t.x?t.x:new Ji(e,this._variables)}copy({id:t},e){return t==null?void 0:t.copy(e)}delete({id:t}){t==null||t.delete()}get_x1({id:t},e){return t==null?void 0:t.get_x1(e)}get_x2({id:t},e){return t==null?void 0:t.get_x2(e)}get_y1({id:t},e){return t==null?void 0:t.get_y1(e)}get_y2({id:t},e){return t==null?void 0:t.get_y2(e)}set_x1({id:t,...e},r){t==null||t.set_x1(e,r)}set_x2({id:t,...e},r){t==null||t.set_x2(e,r)}set_y1({id:t,...e},r){t==null||t.set_y1(e,r)}set_y2({id:t,...e},r){t==null||t.set_y2(e,r)}set_xy1({id:t,...e},r){t==null||t.set_xy1(e,r)}set_xy2({id:t,...e},r){t==null||t.set_xy2(e,r)}set_xloc({id:t,...e},r){t==null||t.set_xloc(e,r)}get_price({id:t,...e},r){return t==null?void 0:t.get_price(e,r)}set_color({id:t,...e},r){t==null||t.set_color(e,r)}set_style({id:t,...e},r){t==null||t.set_style(e,r)}set_width({id:t,...e},r){t==null||t.set_width(e,r)}set_extend({id:t,...e},r){t==null||t.set_extend(e,r)}set_first_point({id:t,...e},r){t==null||t.set_first_point(e,r)}set_second_point({id:t,...e},r){t==null||t.set_second_point(e,r)}}class Ji{constructor(t,e){z(this,"_variables");z(this,"_id");this._id=t,this._variables=e}get data(){return this._variables.line.get(this._id)}copy(t){const e=`line_${t}`,r=this._getLine(t),n=new Ji(e,this._variables);return r&&this._variables.line.add(e,{...r,id:e},n),n}delete(){this._variables.line.delete(this._id)}get_price({x:t},e){const r=this._getLine(e);if(t===void 0)return t;if(r&&r.xloc===$e.bar_index){const{x1:n,y1:s,x2:a,y2:l}=r;return n===void 0||a===void 0||s===void 0||l===void 0?void 0:(l-s)/(a-n)*(t-n)+s}}get_x1(t){var e;return(e=this._getLine(t))==null?void 0:e.x1}get_x2(t){var e;return(e=this._getLine(t))==null?void 0:e.x2}get_y1(t){var e;return(e=this._getLine(t))==null?void 0:e.y1}get_y2(t){var e;return(e=this._getLine(t))==null?void 0:e.y2}set_x1({x:t},e){const r=this._getLine(e);r&&(r.x1=t)}set_x2({x:t},e){const r=this._getLine(e);r&&(r.x2=t)}set_y1({y:t},e){const r=this._getLine(e);r&&(r.y1=t)}set_y2({y:t},e){const r=this._getLine(e);r&&(r.y2=t)}set_xy1({x:t,y:e},r){const n=this._getLine(r);n&&(n.x1=t,n.y1=e)}set_xy2({x:t,y:e},r){const n=this._getLine(r);n&&(n.x2=t,n.y2=e)}set_xloc({xloc:t,x1:e,x2:r},n){const s=this._getLine(n);s&&(s.xloc=t,s.x1=e,s.x2=r)}set_color({color:t},e){const r=this._getLine(e);r&&(r.color=t)}set_style({style:t},e){const r=this._getLine(e);r&&(r.style=t)}set_width({width:t},e){const r=this._getLine(e);r&&(r.width=t)}set_extend({extend:t},e){const r=this._getLine(e);r&&(r.extend=t)}set_first_point({point:t},e){const r=this._getLine(e);if(r){const{index:n,time:s,price:a}=t||{},l=r.xloc===$e.bar_index?n:s,f=a;l&&(r.x1=l),f&&(r.y1=f)}}set_second_point({point:t},e){const r=this._getLine(e);if(r){const{index:n,time:s,price:a}=t||{},l=r.xloc===$e.bar_index?n:s,f=a;l&&(r.x2=l),f&&(r.y2=f)}}_getLine(t){const e=this._variables.line.get(this._id);return e||console.log(`${t}: line 不存在`),e}}class zw{constructor(t){z(this,"_variables");this._variables=t}new({line1:t,line2:e,color:r},n){const s=`linefill_${n}`,a=t==null?void 0:t.data,l=e==null?void 0:e.data;a&&(a.linefills=a.linefills||[],a.linefills.push(s)),l&&(l.linefills=l.linefills||[],l.linefills.push(s));const f=new io(this._variables,s,t,e);return(a||l)&&this._variables.linefill.add(s,{line1:a,line2:l,color:r,id:s},f),f}delete({id:t}){t==null||t.delete()}get_line1({id:t}){return t==null?void 0:t.get_line1()}get_line2({id:t}){return t==null?void 0:t.get_line2()}set_color({id:t,...e}){t==null||t.set_color(e)}}class io{constructor(t,e,r,n){z(this,"_id");z(this,"_line1");z(this,"_line2");z(this,"_variables");this._variables=t,this._id=e,this._line1=r,this._line2=n}linefill(t,e){return t.x?t.x:new io(this._variables,e)}delete(){var e,r;const t=this._variables.linefill.get(this._id);if(t){const{line1:n,line2:s}=t;n&&(n.linefills=(e=n.linefills)==null?void 0:e.filter(a=>a!==this._id)),s&&(s.linefills=(r=s.linefills)==null?void 0:r.filter(a=>a!==this._id))}this._line1=void 0,this._line2=void 0,this._variables.linefill.delete(this._id)}get_line1(){return this._line1}get_line2(){return this._line2}set_color({color:t}){const e=this._variables.linefill.get(this._id);e&&(e.color=t)}}class qw{constructor(t){z(this,"_variables");z(this,"_defaultBox",{border_color:wi.blue,border_width:1,bgcolor:wi.blue,xloc:$e.bar_index,extend:Rn.none,style:Wr.styleSolid,text:"",text_size:jr.auto,text_color:wi.black,text_halign:Xe.alignCenter,text_valign:Xe.alignCenter,text_wrap:Xe.wrapNone});this._variables=t}box({x:t},e){return t===void 0?new Xi(this._variables,e):t}new({top_left:t,bottom_right:e,...r},n){const s=`box_${n}`,a={...this._defaultBox,...r,id:s};if(t){const{price:f,time:h,index:p}=t;a.top=f,a.left=a.xloc===$e.bar_index?p:h}if(e){const{price:f,time:h,index:p}=e;a.bottom=f,a.right=a.xloc===$e.bar_index?p:h}const l=new Xi(this._variables,s);return this._variables.box.add(s,a,l),l}copy({id:t},e){return t==null?void 0:t.copy(e)}delete({id:t}){t==null||t.delete()}get_top({id:t}){return t==null?void 0:t.get_top()}get_bottom({id:t}){return t==null?void 0:t.get_bottom()}get_left({id:t}){return t==null?void 0:t.get_left()}get_right({id:t}){return t==null?void 0:t.get_right()}set_top({id:t,...e}){t==null||t.set_top(e)}set_bottom({id:t,...e}){t==null||t.set_bottom(e)}set_left({id:t,...e}){t==null||t.set_left(e)}set_right({id:t,...e}){t==null||t.set_right(e)}set_extend({id:t,...e}){t==null||t.set_extend(e)}set_bgcolor({id:t,...e}){t==null||t.set_bgcolor(e)}set_border_color({id:t,...e}){t==null||t.set_border_color(e)}set_border_width({id:t,...e}){t==null||t.set_border_width(e)}set_border_style({id:t,...e}){t==null||t.set_border_style(e)}set_lefttop({id:t,...e}){t==null||t.set_lefttop(e)}set_rightbottom({id:t,...e}){t==null||t.set_rightbottom(e)}set_text_size({id:t,...e}){t==null||t.set_text_size(e)}set_text_wrap({id:t,...e}){t==null||t.set_text_wrap(e)}set_text_color({id:t,...e}){t==null||t.set_text_color(e)}set_text_halign({id:t,...e}){t==null||t.set_text_halign(e)}set_text_valign({id:t,...e}){t==null||t.set_text_valign(e)}set_top_left_point({id:t,...e}){t==null||t.set_top_left_point(e)}set_bottom_right_point({id:t,...e}){t==null||t.set_bottom_right_point(e)}set_text_font_family({id:t,...e}){t==null||t.set_text_font_family(e)}}class Xi{constructor(t,e){z(this,"_id");z(this,"_variables");this._variables=t,this._id=e}copy(t){const e=`box_${t}`,r=this._getBox(),n=new Xi(this._variables,e);return r&&this._variables.box.add(e,{...r,id:e},n),n}delete(){this._variables.box.delete(this._id)}get_top(){const t=this._getBox();return t&&t.top}set_top({top:t}){const e=this._getBox();e&&(e.top=t)}get_left(){const t=this._getBox();return t&&t.left}set_left({left:t}){const e=this._getBox();e&&(e.left=t)}set_text({text:t}){const e=this._getBox();e&&(e.text=t)}get_right(){const t=this._getBox();return t&&t.right}set_right({right:t}){const e=this._getBox();e&&(e.right=t)}get_bottom(){const t=this._getBox();return t&&t.bottom}set_bottom({bottom:t}){const e=this._getBox();e&&(e.bottom=t)}set_extend({extend:t}){const e=this._getBox();e&&(e.extend=t)}set_bgcolor({color:t}){const e=this._getBox();e&&(e.bgcolor=t)}set_lefttop({left:t,top:e}){const r=this._getBox();r&&(r.left=t,r.top=e)}set_text_size({text_size:t}){const e=this._getBox();e&&(e.text_size=t)}set_text_wrap({text_wrap:t}){const e=this._getBox();e&&(e.text_wrap=t)}set_text_color({text_color:t}){const e=this._getBox();e&&(e.text_color=t)}set_rightbottom({right:t,bottom:e}){const r=this._getBox();r&&(r.right=t,r.bottom=e)}set_text_halign({text_halign:t}){const e=this._getBox();e&&(e.text_halign=t)}set_text_valign({text_valign:t}){const e=this._getBox();e&&(e.text_valign=t)}set_top_left_point({point:t}){const e=this._getBox();if(e){const{index:r,price:n,time:s}=t||{};e.top=n,e.left=e.xloc===$e.bar_index?r:s}}set_border_color({color:t}){const e=this._getBox();e&&(e.border_color=t)}set_border_style({style:t}){const e=this._getBox();e&&(e.border_style=t)}set_border_width({width:t}){const e=this._getBox();e&&(e.border_width=t)}set_bottom_right_point({point:t}){const e=this._getBox();if(e){const{index:r,price:n,time:s}=t||{};e.bottom=n,e.right=e.xloc===$e.bar_index?r:s}}set_text_font_family({text_font_family:t}){const e=this._getBox();e&&(e.text_font_family=t)}_getBox(){return this._variables.box.get(this._id)}}class kw{constructor(t){z(this,"_variables");z(this,"_defaultTable",{position:Tr.topLeft,columns:0,rows:0,frame_width:0,border_width:0});this._variables=t}table({x:t},e){return t||new Ra(this._variables,e)}new(t,e){const r=`table_${e}`,n={...this._defaultTable,...t,cell:[],id:r},s=new Ra(this._variables,r);return this._variables.table.add(r,n,s),s}cell({table_id:t,...e}){t==null||t.cell(e)}cell_set_bgcolor({table_id:t,...e}){t==null||t.cell_set_bgcolor(e)}cell_set_height({table_id:t,...e}){t==null||t.cell_set_height(e)}cell_set_text({table_id:t,...e}){t==null||t.cell_set_text(e)}cell_set_text_color({table_id:t,...e}){t==null||t.cell_set_text_color(e)}cell_set_text_font_family({table_id:t,...e}){t==null||t.cell_set_text_font_family(e)}cell_set_text_halign({table_id:t,...e}){t==null||t.cell_set_text_halign(e)}cell_set_text_valign({table_id:t,...e}){t==null||t.cell_set_text_valign(e)}cell_set_text_size({table_id:t,...e}){t==null||t.cell_set_text_size(e)}cell_set_tooltip({table_id:t,...e}){t==null||t.cell_set_tooltip(e)}cell_set_width({table_id:t,...e}){t==null||t.cell_set_width(e)}clear({table_id:t,...e}){t==null||t.clear(e)}delete({table_id:t}){t==null||t.delete()}merge_cells({table_id:t,...e},r){t==null||t.merge_cells(e,r)}set_bgcolor({table_id:t,...e}){t==null||t.set_bgcolor(e)}set_border_color({table_id:t,...e}){t==null||t.set_border_color(e)}set_border_width({table_id:t,...e}){t==null||t.set_border_width(e)}set_frame_color({table_id:t,...e}){t==null||t.set_frame_color(e)}set_frame_width({table_id:t,...e}){t==null||t.set_frame_width(e)}set_position({table_id:t,...e}){t==null||t.set_position(e)}}class Ra{constructor(t,e){z(this,"_id");z(this,"_variables");z(this,"_defaultCell",{column:0,row:0,text:"",text_color:wi.black,text_halign:Xe.alignCenter,text_valign:Xe.alignCenter,text_size:jr.normal});this._variables=t,this._id=e}cell(t){const e={...this._defaultCell,...t},{column:r=0,row:n=0}=e,s=this._variables.table.get(this._id);if(s){const a=s.cell||[],l=a[n]||[];l[r]=e,a[n]=l,s.cell=a}}cell_set_bgcolor({column:t=0,row:e=0,bgcolor:r}){const n=this._getTableItem(t,e);n&&(n.bgcolor=r)}cell_set_height({column:t=0,row:e=0,height:r}){const n=this._getTableItem(t,e);n&&(n.height=r)}cell_set_text({column:t=0,row:e=0,text:r}){const n=this._getTableItem(t,e);n&&(n.text=r)}cell_set_text_color({column:t=0,row:e=0,text_color:r}){const n=this._getTableItem(t,e);n&&(n.text_color=r)}cell_set_text_font_family({column:t=0,row:e=0,text_font_family:r}){const n=this._getTableItem(t,e);n&&(n.text_font_family=r)}cell_set_text_halign({column:t=0,row:e=0,text_halign:r}){const n=this._getTableItem(t,e);n&&(n.text_halign=r)}cell_set_text_valign({column:t=0,row:e=0,text_valign:r}){const n=this._getTableItem(t,e);n&&(n.text_valign=r)}cell_set_text_size({column:t=0,row:e=0,text_size:r}){const n=this._getTableItem(t,e);n&&(n.text_size=r)}cell_set_tooltip({column:t=0,row:e=0,tooltip:r}){const n=this._getTableItem(t,e);n&&(n.tooltip=r)}cell_set_width({column:t=0,row:e=0,width:r}){const n=this._getTableItem(t,e);n&&(n.width=r)}clear({start_column:t=0,start_row:e=0,end_column:r=0,end_row:n=0}){const s=this._variables.table.get(this._id);if(s){const a=s.cell;if(a)for(let l=e;l<=n;l++)for(let f=t;f<=r;f++){const h=a[l];h&&(h[f]=void 0)}}}delete(){this._variables.table.delete(this._id)}merge_cells({start_column:t=0,start_row:e=0,end_column:r=0,end_row:n=0},s){if(t>r||e>n){console.log(`error ${s}: start_column > end_column or start_row > end_row`);return}const a=this._getTableItem(t,e);if(!a)return;this.clear({start_column:t,start_row:e,end_column:r,end_row:n});const l=this._variables.table.get(this._id);l.cell[e][t]={...a,isMerge:!0,merge_columns:r-t+1,merge_rows:n-e+1}}set_bgcolor({bgcolor:t}){const e=this._variables.table.get(this._id);e&&(e.bgcolor=t)}set_border_color({border_color:t}){const e=this._variables.table.get(this._id);e&&(e.border_color=t)}set_border_width({border_width:t}){const e=this._variables.table.get(this._id);e&&(e.border_width=t)}set_frame_color({frame_color:t}){const e=this._variables.table.get(this._id);e&&(e.frame_color=t)}set_frame_width({frame_width:t}){const e=this._variables.table.get(this._id);e&&(e.frame_width=t)}set_position({position:t}){const e=this._variables.table.get(this._id);e&&(e.position=t)}_getTableItem(t,e){const r=this._variables.table.get(this._id);if(r){const n=r.cell;return n?n[e][t]:void 0}}}class Uw{constructor(t){z(this,"_strategy");this._strategy=t}commission({trade_num:t}){return this._verifyTradeNum(t)&&this._strategy.historyOrders[t].commission||0}entry_bar_index({trade_num:t}){if(this._verifyTradeNum(t))return this._strategy.historyOrders[t].in_index}entry_comment({trade_num:t}){if(!this._verifyTradeNum(t))return"";const{comment:e,id:r}=this._strategy.historyOrders[t];return e||r}entry_id({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.historyOrders[t].id:""}entry_price({trade_num:t}){if(this._verifyTradeNum(t))return this._strategy.historyOrders[t].in_price}entry_time({trade_num:t}){if(this._verifyTradeNum(t))return this._strategy.historyOrders[t].in_time}exit_bar_index({trade_num:t}){if(this._verifyTradeNum(t))return this._strategy.historyOrders[t].out_index}exit_comment({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.historyOrders[t].out_comment:""}exit_id({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.historyOrders[t].out_id:""}exit_price({trade_num:t}){if(this._verifyTradeNum(t))return this._strategy.historyOrders[t].out_price}exit_time({trade_num:t}){if(this._verifyTradeNum(t))return this._strategy.historyOrders[t].out_time}max_drawdown({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.historyOrders[t].trading_loss:0}max_drawdown_percent({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.historyOrders[t].trading_loss_percent:0}max_runup({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.historyOrders[t].max_profit:0}max_runup_percent({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.historyOrders[t].max_profit_percent:0}profit({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.historyOrders[t].profit:0}profit_percent({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.historyOrders[t].profit_percent:0}size({trade_num:t}){if(!this._verifyTradeNum(t))return 0;const{out_qty:e=0,direction:r}=this._strategy.historyOrders[t];return r===pe.long?e:-e}_verifyTradeNum(t){if(typeof t!="number"||t<0)return!1;const e=this._strategy.historyOrders.length;return!(t>=e)}}class Ww{constructor(t){z(this,"_strategy");this._strategy=t}commission({trade_num:t}){if(!this._verifyTradeNum(t))return 0;const{qty:e=0,original_qty:r=0,commission:n=0}=this._strategy.orders[t];return n*e/r}entry_bar_index({trade_num:t}){if(this._verifyTradeNum(t))return this._strategy.orders[t].in_index}entry_comment({trade_num:t}){if(!this._verifyTradeNum(t))return"";const{comment:e,id:r}=this._strategy.orders[t];return e||r}entry_id({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.orders[t].id:""}entry_price({trade_num:t}){if(this._verifyTradeNum(t))return this._strategy.orders[t].in_price}entry_time({trade_num:t}){if(this._verifyTradeNum(t))return this._strategy.orders[t].in_time}max_drawdown({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.orders[t].trading_loss:0}max_drawdown_percent({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.orders[t].trading_loss_percent:0}max_runup({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.orders[t].max_profit:0}max_runup_percent({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.orders[t].max_profit_percent:0}profit({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.orders[t].profit:0}profit_percent({trade_num:t}){return this._verifyTradeNum(t)?this._strategy.orders[t].profit_percent:0}size({trade_num:t}){if(!this._verifyTradeNum(t))return 0;const{qty:e=0,direction:r}=this._strategy.orders[t];return r===pe.long?e:-e}_verifyTradeNum(t){if(typeof t!="number"||t<0)return!1;const e=this._strategy.orders.length;return!(t>=e)}}class jw{constructor(t){z(this,"_strategy");this._strategy=t}allow_entry_in({value:t}){this._strategy.updateRisk({allow_entry_in:t})}max_cons_loss_days({count:t}){this._strategy.updateRisk({max_cons_loss_days:t})}max_drawdown({value:t,type:e}){e===Ge.percentOfEquity&&(t=t>100?100:t),this._strategy.updateRisk({max_drawdown:t,max_drawdown_type:e})}max_intraday_filled_orders({count:t}){this._strategy.updateRisk({max_intraday_filled_orders:t})}max_intraday_loss({value:t,type:e}){e===Ge.percentOfEquity&&(t=t>100?100:t),this._strategy.updateRisk({max_intraday_loss:t,max_intraday_loss_type:e})}max_position_size({contracts:t}){this._strategy.updateRisk({max_position_size:t})}}let Yw=class{constructor(t,e,r,n){z(this,"_variables");z(this,"_options");z(this,"_totalChangeCapital");z(this,"_historyOrder");z(this,"_orders");z(this,"_pendingOrders");z(this,"_mintick");z(this,"_funcOptions");z(this,"_pendingCloseOrders");z(this,"_errorListener");z(this,"_risk");z(this,"_opentrades");z(this,"_closedtrades");z(this,"_riskNamespace");this._variables=t,this._errorListener=n,this._options={overlay:!1,format:Pn.inherit,pyramiding:0,calc_on_order_fills:!1,calc_on_every_tick:!1,max_bars_back:0,backtest_fill_limits_assumption:0,default_qty_type:Ge.fixed,default_qty_value:1,initial_capital:1e6,currency:Zc.NONE,slippage:0,commission_type:Ir.percent,commission_value:0,process_orders_on_close:!1,close_entries_rule:"FIFO",margin_long:0,margin_short:0,explicit_plot_zorder:!1,max_lines_count:50,max_labels_count:50,max_boxes_count:50,calc_bars_count:0,risk_free_rate:2,use_bar_magnifier:!1,fill_orders_on_standard_ohlc:!1,max_polylines_count:50},this._funcOptions=e,this._totalChangeCapital=0,this._orders=[],this._pendingOrders=[],this._historyOrder=[],this._pendingCloseOrders=[],this._mintick=r,this._variables.strategy.updateOrders(this._orders),this._variables.strategy.updateHistoryOrders(this._historyOrder),this._variables.strategy.updateStrategyOptions(this._options),this._risk={intradayOrders:0},this._opentrades=new Ww(this),this._closedtrades=new Uw(this),this._riskNamespace=new jw(this)}get orders(){return[...this._orders]}get historyOrders(){return[...this._historyOrder]}get _orderProfit(){return this._orders.reduce((t,e)=>t+(e.profit||0),0)}get _freezeCapital(){const{close:t}=this._variables;return this._orders.reduce((e,r)=>e+t*(r.qty||0),0)}get opentrades(){return this._opentrades}get closedtrades(){return this._closedtrades}get risk(){return this._riskNamespace}updateOptions(t){Object.assign(this._options,t),this._maxConsLossDaysVerify(),this._pendingOrderHandle(),this._maxIntradayFilledOrdersVerify(),this._ordersHandle(),!this._options.process_orders_on_close&&this._calcLiquidate()}updateRisk(t){Object.assign(this._risk,t)}endExecution(){this._calcProfitAndLoss(),this._variables.strategy.update(),this._maxDrawdownVerify(),this._maxIntradayLoss(),this._pendingCloseOrderHandle(),this._options.process_orders_on_close&&this._calcLiquidate()}_maxIntradayLoss(){var g;const{max_intraday_loss:t,max_intraday_loss_type:e,isDisabledOpen:r}=this._risk;if(t===void 0||!e||r)return;const{high:n,low:s,time_tradingday:a,time:l,strategy:{netprofit:f,initial_capital:h}}=this._variables;let{preNetprofit:p=0}=this._risk;l===a&&(p=f,this._risk.preNetprofit=f,this._risk.isTemporaryBan=!1);let c=p-f;c+=this._orders.reduce((w,m)=>{const{in_price:D,direction:v,qty:E=0,commission:b=0,original_qty:N=0}=m,x=v===pe.long?1:-1,F=(n-D)*E,M=(s-D)*E,S=x===1?-M:F;return w+S+E/N*b},0);let d=!1;switch(e){case Ge.cash:d=t<c;break;case Ge.percentOfEquity:const w=c/(h+f)*100;d=t<w;break}if(d){this._risk.isTemporaryBan=!0;const w=(g=this._orders[0])==null?void 0:g.direction;this._closeOrders(this._orders,w===pe.long?s:n,"Close Position (Max intraday Loss)"),this._pendingOrders=[]}}_maxIntradayFilledOrdersVerify(){const{max_intraday_filled_orders:t,intradayOrders:e=0,isDisabledOpen:r}=this._risk;if(t===void 0||r)return;const{time:n,time_tradingday:s,open:a}=this._variables;n===s&&(this._risk.intradayOrders=0,this._risk.isTemporaryBan=!1),t<=e&&(this._risk.isTemporaryBan=!0,this._closeOrders(this._orders,a,"Close Position (Max number of filled orders in one day)"),this._pendingOrders=[])}_maxConsLossDaysVerify(){const{max_cons_loss_days:t,lossDays:e=0,isDisabledOpen:r,totalProfit:n=0}=this._risk;if(t===void 0||r)return;const{time:s,time_tradingday:a,strategy:l,open:f}=this._variables;let h=e;if(s===a){const p=l.netprofit+l.openprofit;p<n?h=0:h++,Object.assign(this._risk,{lossDays:h,totalProfit:p})}t<=h&&this._riskTouchOff(f,"Close Position (Max consecutive loss days)")}_maxDrawdownVerify(){var n;const{max_drawdown:t,max_drawdown_type:e,isDisabledOpen:r}=this._risk;if(!r&&t!==void 0&&e){const{max_drawdown:s,max_drawdown_percent:a}=this._variables.strategy;let l=!1;switch(e){case Ge.percentOfEquity:l=a<s;break;case Ge.cash:l=t<s;break}if(l){const{high:f,low:h}=this._variables,p=(n=this._orders[0])==null?void 0:n.direction;this._riskTouchOff(p===pe.long?f:h,"Close Position (Max Drawdown)")}}}_riskTouchOff(t,e){this._risk.isDisabledOpen=!0,this._closeOrders(this._orders,t,e),this._pendingOrders=[]}strategy(t){this._options={...t},Object.assign(this._funcOptions,{strategy:this._options,scriptType:"strategy"})}order(t){this._risk.isDisabledOpen||this._orderHandle(t)}entry(t){this._risk.isDisabledOpen||this._entryHandle(t)}close(t){if(!this._orders.length)return;const{immediately:e}=t;e||this._options.process_orders_on_close?this._pendingCloseOrders.push({...t,place_order_type:"close"}):this._pendingOrders.push({...t,place_order_type:"close"})}close_all(t){if(typeof t=="string"&&(t={}),!this._orders.length)return;const{immediately:e}=t;e||this._options.process_orders_on_close?this._pendingCloseOrders.push({...t,place_order_type:"close_all"}):this._pendingOrders.push({...t,place_order_type:"close_all"})}cancel({id:t}){this._pendingOrders=this._pendingOrders.filter(e=>!(e.id===t&&e.place_order_type!=="close"))}cancel_all(){this._pendingOrders=this._pendingOrders.filter(t=>t.place_order_type==="close_all")}exit(t,e){this._exit(t,e)}convert_to_account({value:t}){return t}convert_to_symbol({value:t}){return t}default_entry_qty({fill_price:t}){return t?this._calcDefaultQty(t):0}_calcDefaultQty(t){const{default_qty_type:e=Ge.fixed,default_qty_value:r=1,initial_capital:n}=this._options;switch(e){case Ge.fixed:return r;case Ge.cash:return r/t;case Ge.percentOfEquity:return(n+this._orderProfit+this._totalChangeCapital)*r/100/t}}_getCapital(t,e){const{margin_long:r=0,margin_short:n=0}=this._options;return r<100&&r>0&&t===1?e=e*100/r:n<=100&&n>0&&t===-1&&(e=e*100/n),e}_calcProfitAndLoss(){const{high:t,low:e,close:r}=this._variables;for(const n of this._orders){const{in_price:s,qty:a=0,direction:l}=n,f=l===pe.long?1:-1,h=(r-s)*f*a,p=(t-s)*a,c=(e-s)*a,d=f===1?p:-c,g=f===1?-c:p;this._calcOrderPercent(n,h,d,g)}}_calcOrderPercent(t,e,r,n){const{commission_value:s}=this._options,{close:a}=this._variables,{original_qty:l=0,qty:f=0,in_price:h,max_profit:p=0,trading_loss:c=0}=t;let{commission:d=0}=t;const g=h*f;if(s){const w=this._getCommission(a,f);e=e-w,d=d*f/l,r-=d,n+=d}r=Math.max(r,p),n=Math.min(n,c),Object.assign(t,{profit:e-d,total_profit:this._totalChangeCapital+e,max_profit:r,trading_loss:n,profit_percent:e/g*100,max_profit_percent:r/g*100,trading_loss_percent:n/g*100})}_calcLiquidate(){if(!this._orders.length)return;const{high:t,low:e}=this._variables,{initial_capital:r,margin_long:n=0,margin_short:s=0,commission_value:a=0}=this._options,l=this._orders[0].direction===pe.long?1:-1,f=l===1?e:t,h=(l===1?n:s)/100;if(h<=0)return;const[p,c,d]=this._orders.reduce((v,E)=>{let[b,N,x]=v;const{in_price:F,qty:M=0,original_qty:S=0,commission:O=0}=E,C=F*M,T=f*M;if(b+=C,N+=T,a){const L=this._getCommission(f,M);x+=L+M/S*O}return[b,N,x]},[0,0,0]),g=l*(c-p),m=r+this._totalChangeCapital+g-d-c*h;if(m>=0)return;const D=Math.trunc(m/h/f)*4;this._marginCallOrders(f,D,"Margin Call")}_marginCallOrders(t,e,r){const{close_entries_rule:n="FIFO"}=this._options;if(n==="FIFO"){this._processOrders(this._orders,t,e*this._orders.length,r,r);return}for(const s of this.orders)this._processOrder(s,t,e,r,r);this._orders=this._orders.filter(s=>!s.isDeal),this._variables.strategy.updateOrders(this._orders)}_orderHandle(t){const{process_orders_on_close:e,slippage:r=0}=this._options,{orders:n,isMarketPrice:s,quantities:a,close:l,price:f,activePrice:h}=this._orderArgsParse(t),p=t.direction===pe.long?1:-1;if(a<=0)return;let c=a;if(s&&e){if(n.length){const m=this._processOrders(n,l,c,t.id,t.comment);if(m<=0)return;c=m}const g=l+p*r*this._mintick;if(!this._judgeCapitalEnough(c,g,p))return;this._ocaGroupVerify(c,t.oca_name,t.oca_type),this._calcCurrentOrder({...t,in_price:g,in_index:this._variables.bar_index,in_time:this._variables.time,qty:c,place_order_type:"order"});return}this._judgeCapitalEnough(a,f,p)&&this._addPendingOrders(t,f,c,s,h)}_judgeCapitalEnough(t,e,r){if(t<=0)return!1;const{margin_long:n=0,margin_short:s=0}=this._options;if((n===0||n===100)&&r===1||s===0&&r===-1)return!0;const l=this._getCapital(r,this._options.initial_capital+this._orderProfit+this._totalChangeCapital)-this._freezeCapital;return t*e<=l}_ocaGroupVerify(t,e,r){if(!e||!r||r===qn.none)return!1;let n=!1;switch(r){case qn.cancel:this._pendingOrders=this._pendingOrders.filter(s=>{if(s.oca_name===e)s.isCancel=!0,n=!0;else return!0});break;case qn.reduce:this._pendingOrders=this._pendingOrders.filter(s=>{const{qty:a=0,oca_name:l}=s;if(e===l){const f=a-t;return n=!0,f<=0?(s.isCancel=!0,!1):(s.qty=f,!0)}else return!0});break}return n}_processOrders(t,e,r,n,s){let a=r;for(const l of t)if(a=this._processOrder(l,e,a,n,s),a<=0)break;return this._orders=this._orders.filter(l=>!l.isDeal),this._variables.strategy.updateOrders(this._orders),a}_addPendingOrders(t,e,r,n,s){const a=this._pendingOrders.find(l=>l.id===t.id&&!l.isMarketPrice);if(a)Object.assign(a,{...t,in_price:e,isMarketPrice:n,qty:r,active_price:s});else{const l={...t,in_price:e,isMarketPrice:n,qty:r,active_price:s,place_order_type:"order"};this._pendingOrders.push(l)}}_orderArgsParse(t){const{direction:e,qty:r,stop:n}=t;let s=t.limit||0;const{close:a}=this._variables;let l=a,f=!1,h;const p=e===pe.long?1:-1,c=n&&(n-a)*p>0,{backtest_fill_limits_assumption:d=0}=this._options;d>0&&s&&(s-=d*this._mintick*p);const g=s&&(s-a)*p<0;c&&g?(h=n,l=s):c?l=n:g?l=s:f=!0;const w=r||this._calcDefaultQty(l)||1;return{orders:this._orders.filter(D=>D.direction!==e),isMarketPrice:f,activePrice:h,quantities:w,close:a,price:l}}_entryHandle(t){const{process_orders_on_close:e}=this._options,{orders:r,isMarketPrice:n,quantities:s,close:a,price:l,activePrice:f}=this._orderArgsParse(t);if(s<=0)return;if(r.length&&n&&e){this._entryOrder(r,a,s,t);return}this._judgeCapitalEnough(s,a,t.direction===pe.long?1:-1)&&this._addPendingEntry(t,l,s,n,f)}_entryOrder(t,e,r,n){const{time:s,bar_index:a}=this._variables,{slippage:l=0}=this._options,{oca_name:f,oca_type:h,direction:p,comment:c,isMarketPrice:d,id:g}=n,w=p===pe.long?1:-1;if(this._closeOrders(t,e,g,c),r=this._getAvailablePositionSize(r,p),r<=0)return;e=e+l*this._mintick*w;const m={...n,in_price:e,original_qty:r,qty:r,in_index:a,in_time:s,place_order_type:"entry"};if(d){this._calcCurrentOrder(m);return}const{pendingOrders:D,orders:v}=this._getEntryOrders(p),E=D.length+v.length;E&&E>=(this._options.pyramiding||0)||!this._judgeCapitalEnough(r,e,w)||(this._ocaGroupVerify(r,f,h),this._calcCurrentOrder(m))}_getAvailablePositionSize(t,e){const{max_position_size:r,allow_entry_in:n}=this._risk;if(n&&n!==pe.all&&n!==e)return 0;if(r===void 0)return t;const s=this._orders.reduce((a,l)=>a+(l.qty||0),0);return s?s+t>r?0:t:t>r?t-r:0}_getEntryOrders(t){const e=this._pendingOrders.filter(n=>["entry","order"].includes(n.place_order_type)&&n.direction===t),r=this._orders.filter(n=>n.direction===t);return{pendingOrders:e,orders:r}}_addPendingEntry(t,e,r,n,s){if(r=this._getAvailablePositionSize(r,t.direction),r<=0)return;const{pendingOrders:a,orders:l}=this._getEntryOrders(t.direction),f=a.length+l.length,h=a.find(p=>p.id===t.id&&p.place_order_type==="entry");if(h)Object.assign(h,{...t,in_price:e,isMarketPrice:n,qty:r,active_price:s});else if(!f||f<(this._options.pyramiding||1)){const p={...t,in_price:e,isMarketPrice:n,qty:r,active_price:s,place_order_type:"entry"};this._pendingOrders.push(p)}}_closeAllOrders(t,e){const{comment:r}=t,{bar_index:n}=this._variables,s=this._orders.filter(a=>a.in_index!==n);s.length&&(this._closeOrders(s,e,"Close position order",r),this._orders=[],this._variables.strategy.updateOrders(this._orders))}_closeOrders(t,e,r,n){for(const s of t)this._closeOrder(s,e,r,n);this._orders=this._orders.filter(s=>!s.isDeal),this._variables.strategy.updateOrders(this._orders)}_closeOrder(t,e,r,n){const{time:s,bar_index:a}=this._variables,{slippage:l=0}=this._options,{in_price:f,qty:h=0,direction:p}=t,c=p===pe.long?1:-1;e=e-c*l*this._mintick,t.isDeal=!0;const d=(e-f)*c*h,g={...t,out_price:e,out_id:r,out_index:a,out_time:s,out_comment:n,out_qty:h,profit:d};this._calcPercent(g),this._risk.intradayOrders+=1,this._historyOrder.push(g),this._variables.strategy.updateHistoryOrders(this._historyOrder)}_ordersHandle(){const t=this._orders.filter(a=>a.place_order_type==="exit"&&!a.hasExit);if(!t.length)return;const{open:e,low:r,high:n,close:s}=this._variables;for(const a of t){const{stop:l,limit:f,trail_stop_price:h,isMarketPriceLimit:p,isMarketPriceStop:c,direction:d,id:g,out_comment:w,active_price:m,trail_offset:D=0,out_qty:v,comment_loss:E,comment_profit:b,comment_trailing:N}=a;let x=h;const F=d===pe.long?1:-1;let M,S=w;if(p||c?M=e:(f&&r<=f&&n>=f&&(S=b||w,M=f),l&&r<=l&&n>=l&&(M=x?(l-x)*F>0?l:x:l,S=(x===M?N:E)||w)),M)this._processExitOnClose(a,M,{from_entry:g,comment:S,qty:v});else{let O=!1;if(m&&m<=n&&m>=r&&(x=m-D*F*this._mintick,(x-s)*F>=0&&(a.isMarketPriceStop=!0,this._options.process_orders_on_close&&(M=x)),O=!0,a.trail_stop_price=x),x)if((x-e)*F>=0&&!O)M=x;else{const C=(F===1?n:r)-D*F*this._mintick;F===1?x<e&&x>=r&&C>x&&C<s?M=x:C>x?(x=C,C>=s&&(M=C)):x<=n&&r<=x&&(M=x):x>e&&x<=n&&C<x&&C>s?M=x:C<x?(x=C,C<=s&&(M=C)):x<=n&&r<=x&&(M=x),a.trail_stop_price=x}M&&this._processExitOnClose(a,M,{from_entry:g,comment:N||w,qty:v})}}}_pendingOrderHandle(){if(!this._pendingOrders.length)return;const t=[],e=this._pendingOrders.filter(n=>n.place_order_type==="exit"),r=this._pendingOrders.filter(n=>["close","close_all"].includes(n.place_order_type||""));for(const n of r)switch(n.place_order_type){case"close":this._closeOrderHandle(n);break;case"close_all":this._closeAllOrders(n,this._variables.open);break}for(const n of this._pendingOrders){const{isCancel:s,place_order_type:a}=n;if(s)continue;let l;switch(a){case"entry":l=this._entryOrderHandle(n);break;case"order":l=this._orderOrderHandle(n);break}l&&t.push(l)}for(const n of e){const s=this._exitOrderHandle(n);s&&t.push(s)}this._pendingOrders=t}_pendingCloseOrderHandle(){if(!this._pendingCloseOrders.length)return;const t=this._pendingCloseOrders.filter(n=>n.place_order_type==="exit"),e=this._pendingCloseOrders.filter(n=>["close","close_all"].includes(n.place_order_type||"")),{close:r}=this._variables;for(const n of e)switch(n.place_order_type){case"close":this._closeOrderHandle(n,!0);break;case"close_all":this._closeAllOrders(n,r);break}for(const n of t){const{from_entry:s}=n,a=this._orders.filter(l=>!s||l.id===s&&(l.isMarketPriceLimit||l.isMarketPriceStop));for(const l of a)this._processExitOnClose(l,l.limit||l.stop||l.trail_stop_price||r,n)}this._pendingCloseOrders=[]}_entryOrderHandle(t){const{open:e,low:r,high:n}=this._variables,{isMarketPrice:s,qty:a=0,in_price:l,direction:f,active_price:h}=t;if(h&&n>=h&&r<=h)return delete t.active_price,t;let p=l;if(s&&(p=e),p<=n&&p>=r){const c=this._orders.filter(d=>d.direction!==f);this._entryOrder(c,p,a,t)}else return t}_orderOrderHandle(t){const{open:e,low:r,high:n,time:s,bar_index:a}=this._variables,{slippage:l=0}=this._options,{isMarketPrice:f,qty:h=0,in_price:p,direction:c,comment:d,oca_name:g,oca_type:w,active_price:m,id:D}=t;if(m&&n>=m&&r<=m)return delete t.active_price,t;let v=p,E=h;if(f&&(v=e),v<=n&&v>=r){const b=this._orders.filter(x=>x.direction!==c);if(b.length&&(E=this._processOrders(b,v,h,D,d),E<=0))return;const N=c===pe.long?1:-1;this._ocaGroupVerify(E,g,w),this._calcCurrentOrder({...t,in_price:v+N*l*this._mintick,in_index:a,in_time:s,qty:E});return}else return t}_closeOrderHandle(t,e){const{id:r,qty:n,qty_percent:s=100,comment:a}=t,{bar_index:l}=this._variables,f=this._orders.filter(g=>g.id===r&&g.in_index!==l&&(!g.close_qty||g.close_qty<(g.qty||0)));if(!f.length)return;let h=0;if(n?h=n:(h=f.reduce((g,w)=>g+(w.qty||0),h),h=s/100*h),h<=0)return;const{open:p,close:c}=this._variables;let d=h;for(const g of f){const{qty:w=0}=g;d<w?g.close_qty=d:(g.close_qty=w,d-=w)}this._processOrders(this._options.close_entries_rule==="ANY"?f:this._orders,e?c:p,h,`Close entry(s) order ${r}`,a)}_exitOrderHandle(t){const{from_entry:e}=t,r=this._orders.filter(n=>(!e||e===n.id)&&!n.hasExit);if(!(r.length&&!this._ordersToExit(r,t)))return t}_exit(t,e){const{profit:r,loss:n,stop:s,limit:a,trail_offset:l,trail_price:f,trail_points:h,from_entry:p="",id:c}=t;if(this._isNaN(r)&&this._isNaN(n)&&this._isNaN(s)&&this._isNaN(a)&&(this._isNaN(l)||this._isNaN(h)&&this._isNaN(f))){this._errorListener.addError("strategy.exit must have at least one of the following parameters: 'profit', 'limit', 'loss', 'stop' or one of the following pairs: 'trail_offset' and 'trail_price' / 'trail_points'. To close the position at market price, use 'strategy.close'",e,Ce.Error);return}const d={...t,place_order_type:"exit"},g=this._orders.filter(D=>(!p||p===D.id)&&!D.hasExit),w=this._pendingOrders.filter(D=>!p||p===D.id);if(g.length){if(!this._ordersToExit(g,d))return}else if(!w.length)return;const m=this._pendingOrders.find(D=>D.id===c);m?Object.assign(m,{...t}):this._pendingOrders.push(d)}_ordersToExit(t,e){const{qty:r,qty_percent:n=100,id:s,comment:a,comment_loss:l,comment_profit:f,comment_trailing:h}=e;let p=r,c=!1;e.comment=a||s;for(const d of t){const{qty:g=0}=d,w=d.direction===pe.long?1:-1;p=r?r>=g?g:r:n/100*g,d.out_qty=p,p<g&&(c=!0),Object.assign(d,{out_comment:a||s,comment_loss:l,comment_profit:f,comment_trailing:h}),!(this._stopProfit(d,w,{...e,qty:p})||this._stopLoss(d,w,{...e,qty:p})||this._trailStopLoss(d,w,{...e,qty:p}))&&(d.place_order_type="exit")}return c}_addExitPendingCloseOrders(t){t.place_order_type="exit";const e=this._pendingCloseOrders.find(r=>r.id===t.id);e?Object.assign(e,{...t}):this._pendingCloseOrders.push(t)}_stopProfit(t,e,r){const{limit:n,profit:s,comment_profit:a,comment:l}=r;let f=n;const{close:h}=this._variables,{in_price:p}=t,{process_orders_on_close:c}=this._options;if(!this._isNaN(s)&&this._isNaN(n)&&(f=p+e*s*this._mintick),t.limit=f,f&&(f-h)*e<=0&&(t.isMarketPriceLimit=!0,r.comment=a||l,Object.assign(t,{out_comment:r.comment}),f=h,c))return this._addExitPendingCloseOrders(r),!0}_stopLoss(t,e,r){const{stop:n,loss:s,comment_loss:a,comment:l}=r;let f=n;const{close:h}=this._variables,{in_price:p}=t,{process_orders_on_close:c}=this._options;if(!this._isNaN(s)&&this._isNaN(n)&&(f=p-e*s*this._mintick),t.stop=f,f&&(f-h)*e>=0&&(t.isMarketPriceStop=!0,r.comment=a||l,Object.assign(t,{out_comment:r.comment}),f=h,c))return this._addExitPendingCloseOrders(r),!0}_trailStopLoss(t,e,r){const{trail_offset:n,trail_price:s,trail_points:a,comment_trailing:l,comment:f}=r;if(!this._isNaN(n)){const{close:h}=this._variables,{in_price:p}=t,{process_orders_on_close:c}=this._options;let d;if(this._isNaN(s)?this._isNaN(a)||(d=p+a*e*this._mintick):d=s,t.trail_offset=n,d&&(d-h)*e<=0){const g=h-n*e*this._mintick;if((g-h)*e>=0&&(t.trail_stop_price=h,t.isMarketPriceStop=!0,r.comment=l||f,Object.assign(t,{out_comment:r.comment}),c))return this._addExitPendingCloseOrders(r),!0;t.trail_stop_price=g}t.active_price=d}}_processExitOnClose(t,e,r){const{qty:n=0,comment:s,id:a}=r,{close_entries_rule:l="FIFO"}=this._options;if(l==="FIFO"){const f=this._processExitOrders(this._orders,e,n,a,s);f&&!f.hasExit?(f.hasExit=!0,Object.assign(t,{trail_stop_price:f.trail_stop_price,stop:f.stop,limit:f.limit,trail_offset:f.trail_offset,active_price:f.active_price})):f&&(t.hasExit=!0)}else t.hasExit=!0,this._processOrders([t],e,n,a,s)}_processExitOrders(t,e,r,n,s){let a=r,l;for(const f of t)if(l=f,a=this._processOrder(f,e,a,n,s),a<=0||!f.hasExit)break;return this._orders=this._orders.filter(f=>!f.isDeal),this._variables.strategy.updateOrders(this._orders),l}_processOrder(t,e,r,n,s){const{time:a,bar_index:l}=this._variables,{slippage:f=0}=this._options,{in_price:h,qty:p=0,max_profit:c=0,trading_loss:d=0,direction:g,commission:w=0,original_qty:m=0}=t,D=g===pe.long?1:-1;if(e=e-D*f*this._mintick,r<p){const v=p-r,E=(e-h)*D*r,b=c/p*r,N=d/p*r;this._calcPercent({...t,out_price:e,out_id:n,out_index:l,out_time:a,out_comment:s,profit:E,out_qty:r,max_profit:b,trading_loss:N});const x=(e-h)*D*v-w*v/m;Object.assign(t,{qty:v,profit:x,max_profit:c-b,trading_loss:d-N,total_profit:this._totalChangeCapital+x}),r=0}else{t.isDeal=!0;const v=(e-h)*D*p;this._calcPercent({...t,out_price:e,out_id:n,out_index:l,out_time:a,out_comment:s,out_qty:p,profit:v}),r-=p}return r}_calcPercent(t){const{commission_value:e}=this._options,{in_price:r,out_qty:n=0,out_price:s=0,original_qty:a=0}=t;let{profit:l=0,max_profit:f=0,trading_loss:h=0,commission:p=0}=t;f=f<0?0:f;const c=r*n;if(this._totalChangeCapital+=l,e){const d=this._getCommission(s,n);this._totalChangeCapital-=d,p=p*n/a+d,l=l-p,Object.assign(t,{commission:p,profit:l,max_profit:f})}Object.assign(t,{total_profit:this._totalChangeCapital,profit_percent:l/c*100,max_profit_percent:f/c*100,trading_loss_percent:h/c*100}),this._risk.intradayOrders+=1,this._historyOrder.push(t),this._variables.strategy.updateHistoryOrders(this._historyOrder)}_getCommission(t,e){const{commission_value:r=0,commission_type:n}=this._options,s=t*e;let a=0;switch(n){case Ir.percent:a=s*r/100;break;case Ir.cashPerContract:a=e*r;break;case Ir.cashPerOrder:a=r;break}return a}_calcCurrentOrder(t){const{commission_value:e}=this._options,{in_price:r,qty:n=0,max_profit:s=0,trading_loss:a=0}=t;let{profit:l=0}=t;const f=r*n;if(e){const h=this._getCommission(r,n);this._totalChangeCapital-=h,l=l-h,Object.assign(t,{commission:h,profit:l,total_profit:this._totalChangeCapital})}Object.assign(t,{original_qty:n,profit_percent:l/f*100,max_profit_percent:s/f*100,trading_loss_percent:a/f*100}),this._risk.intradayOrders+=1,this._orders.push(t),this._variables.strategy.updateOrders(this._orders)}_isNaN(t){return t===void 0||isNaN(t)}};class Zw{constructor(t){z(this,"_logs");z(this,"_variables");z(this,"_intlFormat");this._variables=t,this._logs=[],this._intlFormat=new Intl.NumberFormat("en-US")}get logs(){return this._logs}clearLogs(){this._logs=[]}info(t,e){this._addLog(t,e,"info")}error(t,e){this._addLog(t,e,"error")}warning(t,e){this._addLog(t,e,"warning")}_addLog(t,e,r){const{message:n,formatString:s}=t,{time:a,bar_index:l,precision:f}=this._variables;let h=n;s&&Array.isArray(e)&&e.length&&(h=s.replace(/{(\d+)}/g,(p,c)=>{let d=e[c];return typeof d=="number"&&(d=this._intlFormat.format(parseFloat(d.toFixed(f)))),d!==void 0?d:p})),h&&this._logs.push({message:`[${Vt(a).format()}]: ${h}`,time:a,barIndex:l,type:r})}}class Gw{constructor(t){z(this,"_errorListener");this._errorListener=t}error({message:t},e){this._errorListener.addError(t,e,Ce.Error)}}class Kw{constructor(){z(this,"_errors");this._errors=new Map}clear(){this._errors.clear()}get errors(){return Sr.flatMap([...this._errors.values()])}addError(t,e,r){const[n,s]=e.split("_").slice(-2),a=this._errors.get(e),l={message:t,endLineNumber:Number(n),startColumn:Number(s)+1,endColumn:Number(s)+1,startLineNumber:Number(n),type:r};a?a.push(l):this._errors.set(e,[l])}}class Hw{constructor(){z(this,"_isMarketOpen");z(this,"_currentBarIndex");z(this,"_totalBarIndex");z(this,"_isRealTimeBar");z(this,"_preBarIndex");this._currentBarIndex=0,this._totalBarIndex=0,this._isRealTimeBar=!1,this._preBarIndex=0,this._isMarketOpen=!0}update(t,e,r,n){this._preBarIndex=this._currentBarIndex,this._currentBarIndex=t,this._totalBarIndex=e,this._isRealTimeBar=r,this._isMarketOpen=n}get isnew(){return!this._isRealTimeBar||this._preBarIndex!==this._currentBarIndex}get islast(){return this._currentBarIndex===this._totalBarIndex}get isfirst(){return this._currentBarIndex===0}get ishistory(){return!this._isRealTimeBar}get isrealtime(){return this._isRealTimeBar}get isconfirmed(){return!this._isRealTimeBar}get islastconfirmedhistory(){return this._isMarketOpen?this._currentBarIndex===this._totalBarIndex-1:this._currentBarIndex===this._totalBarIndex}}class Jw{constructor(t){z(this,"_variables");this._variables=t}get isfirstbar(){return this._variables.timeframe.isdwm?!0:this._variables.time===this._variables.time_tradingday}get isfirstbar_regular(){return this._variables.timeframe.isdwm?!0:this._variables.time===this._variables.time_tradingday}get islastbar(){if(this._variables.timeframe.isdwm)return!0;const t=Xr(this._variables.timeframe.period);return this._variables.time+t===this._variables.time_tradingday+24*60*60*1e3}get islastbar_regular(){if(this._variables.timeframe.isdwm)return!0;const t=Xr(this._variables.timeframe.period);return this._variables.time+t===this._variables.time_tradingday+24*60*60*1e3}get ismarket(){return!0}get ispostmarket(){return!1}get ispremarket(){return!1}}class Xw{constructor(t){z(this,"_orders");z(this,"_historyOrders");z(this,"_options");z(this,"_max_contracts_held_all",0);z(this,"_max_contracts_held_long",0);z(this,"_max_contracts_held_short",0);z(this,"_max_drawdown",0);z(this,"_max_runup",0);z(this,"_max_runup_percent",0);z(this,"_max_drawdown_percent",0);z(this,"_variables");z(this,"_netprofit",0);z(this,"_eventrades",0);z(this,"_avg_trade_percent");z(this,"_closedtrades",0);z(this,"_losstrades",0);z(this,"_grossloss",0);z(this,"_grossloss_percent",0);z(this,"_grossprofit",0);z(this,"_grossprofit_percent",0);z(this,"_wintrades",0);z(this,"_opentrades_capital_held",0);z(this,"_position_avg_price",0);z(this,"_position_size",0);this._orders=[],this._historyOrders=[],this._variables=t}update(){this._calcMaxDrawdownAndMaxRunup()}_calcMaxDrawdownAndMaxRunup(){let t=0,e=0;const{high:r,low:n}=this._variables;for(const h of this._orders){const{in_price:p,qty:c=0,commission:d=0,original_qty:g=0,direction:w}=h,m=w===pe.long?1:-1,D=(r-p)*c,v=(n-p)*c,E=m===1?D:-v,b=m===1?-v:D;t+=b+d*c/g,e+=E+d*c/g}const[s,a]=this._historyOrders.reduce((h,p)=>{let[c,d]=h;const{profit:g=0,commission:w=0}=p;return c+=g,d+=g-w,[c,d]},[0,0]);t-=s,e+=a;const l=t/(this.initial_capital+this.netprofit)*100;this._max_drawdown<t&&(this._max_drawdown=t),l>this._max_drawdown_percent&&(this._max_drawdown_percent=l);const f=e/(this.initial_capital+this.netprofit)*100;e>this._max_runup&&(this._max_runup=e),f>this._max_runup_percent&&(this._max_runup_percent=f)}updateOrders(t){this._orders=t,this._calcMaxContracts()}_calcMaxContracts(){const t=this._orders.length;if(!t)return;const[e,r,n,s,a,l]=this._orders.reduce(([f,h,p,c,d,g],w)=>{const{direction:m,qty:D=0,in_price:v}=w;return m===pe.long?(f+=D,h+=D,g+=D):(f+=D,p+=D,g-=D),c+=D*v,d+=v,[f,h,p,c,d,g]},[0,0,0,0,0,0]);this._position_size=l,this._position_avg_price=a/t,this._opentrades_capital_held=s,this._max_contracts_held_all=Math.max(e,this._max_contracts_held_all),this._max_contracts_held_long=Math.max(r,this._max_contracts_held_long),this._max_contracts_held_short=Math.max(n,this._max_contracts_held_short)}updateHistoryOrders(t){this._historyOrders=t;const e=this._historyOrders.length;this._closedtrades=e;const[r,n,s,a,l,f]=this._historyOrders.reduce((h,p)=>{let[c,d,g,w,m,D]=h;const{profit:v=0,profit_percent:E=0}=p;return c+=v,d+=E,v<0?(g+=v,w+=E):(m+=v,D+=E),[c,d,g,w,m,D]},[0,0,0,0,0,0]);this._avg_trade_percent=e?n/e:void 0,this._netprofit=r,this._grossloss=s,this._grossloss_percent=a,this._grossprofit=l,this._grossprofit_percent=f,this._eventrades=this._historyOrders.filter(h=>h.profit===0).length,this._losstrades=this._historyOrders.filter(h=>(h.profit||0)<0).length,this._wintrades=this._historyOrders.filter(h=>(h.profit||0)>0).length}updateStrategyOptions(t){this._options=t}get long(){return"long"}get short(){return"short"}get account_currency(){return"USD"}get closedtrades(){return this._closedtrades}get opentrades(){return{opentrades:this._orders.length,capital_held:this._opentrades_capital_held}}get avg_losing_trade(){const t=this.losstrades;return t?Math.abs(this.grossloss/t):void 0}get avg_losing_trade_percent(){const t=this.losstrades;return t?Math.abs(this.grossloss_percent/t):void 0}get avg_trade(){if(this.closedtrades)return Math.abs(this.netprofit/this.closedtrades)}get equity(){return this.initial_capital+this.netprofit+this.openprofit}get netprofit(){return this._netprofit}get eventrades(){return this._eventrades}get openprofit(){return this._orders.reduce((t,e)=>{const{profit:r=0}=e;return t+r},0)}get avg_trade_percent(){return this._avg_trade_percent}get avg_winning_trade(){const t=this.wintrades;return t?Math.abs(this.grossprofit/t):void 0}get avg_winning_trade_percent(){const t=this.wintrades;return t?Math.abs(this.grossprofit_percent/t):void 0}get initial_capital(){var t;return((t=this._options)==null?void 0:t.initial_capital)||0}get losstrades(){return this._losstrades}get grossloss(){return this._grossloss}get grossloss_percent(){return this._grossloss_percent}get grossprofit(){return this._grossprofit}get grossprofit_percent(){return this._grossprofit_percent}get wintrades(){return this._wintrades}get margin_liquidation_price(){if(!this._options)return;const{initial_capital:t,margin_long:e=0,margin_short:r=0,commission_type:n,commission_value:s=0}=this._options,a=this._orders[0].direction===pe.long?1:-1,l=(a===1?e:r)/100;if(l<=0)return;const{close:f}=this._variables,[h,p]=this._orders.reduce((c,d)=>{let[g,w]=c;const{in_price:m,qty:D=0,original_qty:v=0}=d,E=m*D;if(g+=E,s){let b=0;switch(n){case Ir.percent:b=(E+D*f)*s/100;break;case Ir.cashPerContract:b=D*s*2;break;case Ir.cashPerOrder:b=D/v*s+s;break}w+=b}return[g,w]},[0,0]);return(h-(t+this.netprofit-p))*a/this.position_size/(1-a*l)}get max_contracts_held_all(){return this._max_contracts_held_all}get max_contracts_held_long(){return this._max_contracts_held_long}get max_contracts_held_short(){return this._max_contracts_held_short}get max_drawdown(){return this._max_drawdown}get max_runup(){return this._max_runup}get max_runup_percent(){return this._max_runup_percent}get max_drawdown_percent(){return this._max_drawdown_percent}get netprofit_percent(){return this.netprofit/this.initial_capital*100}get openprofit_percent(){return this.openprofit/(this.initial_capital+this.netprofit)*100}get position_avg_price(){return this._position_avg_price}get position_entry_name(){if(this._orders.length)return this._orders[0].id}get position_size(){return this._position_size}}class Vw{constructor(){z(this,"_preAccdist");z(this,"_preNvi");z(this,"_prePvi");z(this,"_preObv");z(this,"_prePvt");z(this,"_preWad");z(this,"_preVwap");z(this,"_preValue");z(this,"_currentData");z(this,"_preData");this._preAccdist=0,this._preNvi=0,this._prePvi=0,this._preObv=0,this._prePvt=0,this._preWad=0,this._preVwap={},this._preValue={},this._currentData={},this._preData={}}update(t){this._preValue={},t.barIndex!==this._currentData.barIndex&&(this._preData={...this._currentData}),this._currentData={...t}}get isRealTime(){return this._preData.barIndex===this._currentData.barIndex}get accdist(){if(this._preValue.accdist)return this._preValue.accdist;const{close:t,low:e,high:r,volume:n}=this._currentData;if(r===e)return this._preAccdist;const s=(t-e-(r-t))/(r-e)*n+this._preAccdist;return!this.isRealTime&&(this._preAccdist=s),this._preValue.accdist=s,s}get iii(){if(this._preValue.iii)return this._preValue.iii;const{close:t,low:e,high:r,volume:n}=this._currentData,s=(2*t-r-e)/((r-e)*n);return this._preValue.iii=s,s}get nvi(){return this._preValue.nvi?this._preValue.nvi:this._getNvi()}get wvad(){if(this._preValue.wvad)return this._preValue.wvad;const{close:t,low:e,high:r,volume:n,open:s}=this._currentData,a=(t-s)/(r-e)*n;return this._preValue.wvad=a,a}get obv(){if(this._preValue.obv)return this._preValue.obv;const{close:t,volume:e}=this._currentData,{close:r}=this._preData;if(r===void 0){this._preObv=0;return}const n=Math.sign(t-r)*e+this._preObv;return!this.isRealTime&&(this._preObv=n),this._preValue.obv=n,n}get pvi(){return this._preValue.pvi?this._preValue.pvi:this._getPvi()}get tr(){if(this._preValue.tr)return this._preValue.tr;const{low:t,high:e}=this._currentData,{close:r}=this._preData;if(r===void 0)return;const n=Math.max(e-t,Math.abs(e-r),Math.abs(t-r));return this._preValue.tr=n,n}get pvt(){if(this._preValue.pvt)return this._preValue.pvt;const{close:t,volume:e}=this._currentData,{close:r}=this._preData;if(r===void 0){this._prePvt=0;return}const n=(t-r)/r*e+this._prePvt;return!this.isRealTime&&(this._prePvt=n),this._preValue.pvt=n,n}get wad(){if(this._preValue.wad)return this._preValue.wad;const{close:t,high:e,low:r}=this._currentData,{close:n}=this._preData;if(n===void 0)return this._preWad=0,0;const s=Math.max(e,n),a=Math.min(r,n),l=t-n,h=(l>0?t-a:l<0?t-s:0)+this._preWad;return!this.isRealTime&&(this._preWad=h),this._preValue.wad=h,h}get vwap(){if(this._preValue.vwap)return this._preValue.vwap;const{hlc3:t,volume:e}=this._currentData;let{sum:r=0,sumV:n=0,isReset:s}=this._preVwap;if(self.buildInFunctions.timeframe.change({timeframe:"1D"},"vwap_buildin")&&(s=!0,r=n=0),!s)return;const l=t*e+r,f=e+n;!this.isRealTime&&(this._preVwap={sum:l,sumV:f,isReset:s});const h=l/f;return this._preValue.vwap=h,h}_getNvi(){const t=this._preNvi||1,{close:e=0,volume:r=0}=this._preData,{close:n,volume:s}=this._currentData;let a=1;const l=t||1;return n&&e?a=s<r?l+(n-e)/e*l:l:a=l,!this.isRealTime&&(this._preNvi=a),this._preValue.nvi=a,a}_getPvi(){const t=this._prePvi||1,{close:e=0,volume:r=0}=this._preData,{close:n,volume:s}=this._currentData;let a=1;const l=t||1;return n&&e?a=s>r?l+(n-e)/e*l:l:a=l,!this.isRealTime&&(this._prePvi=a),this._preValue.pvi=a,a}}class Qw{constructor(){z(this,"_period");z(this,"_multiplier");z(this,"_unit");this._period="1",this._multiplier=1,this._unit="m"}update(t){if(!t)return;this._period=t;const[e,r]=ms(t);this._multiplier=e,this._unit=r}get isdaily(){return this._unit==="d"}get isdwm(){return["d","w","M"].includes(this._unit)}get isintraday(){return["s","m","h"].includes(this._unit)}get isminutes(){return this._unit==="m"}get ismonthly(){return this._unit==="M"}get isseconds(){return this._unit==="s"}get isweekly(){return this._unit==="w"}get multiplier(){return this._multiplier}get period(){return this._period}}Vt.extend(Ip),Vt.extend(Cl),Vt.extend(Bp);class ty{constructor(){z(this,"_cacheData");z(this,"_barIndex");z(this,"_isRealTimeBar");z(this,"_barstate");z(this,"_priceVariables");z(this,"_lastBarIndex");z(this,"_currentBarTime");z(this,"_lastBarTime");z(this,"_period");z(this,"_offsetTime");z(this,"_timeframe");z(this,"_ta");z(this,"_polyline");z(this,"_label");z(this,"_line");z(this,"_linefill");z(this,"_box");z(this,"_table");z(this,"_strategy");z(this,"_precision");z(this,"_session");this._cacheData={varData:{},varNewData:{},varipData:{}},this._barIndex=0,this._lastBarIndex=0,this._currentBarTime=0,this._lastBarTime=0,this._offsetTime=0,this._period="",this._isRealTimeBar=!1,this._barstate=new Hw,this._timeframe=new Qw,this._priceVariables={close:0,open:0,low:0,high:0,volume:0},this._ta=new Vw,this._polyline=new yi,this._label=new yi,this._line=new yi,this._linefill=new yi,this._box=new yi,this._table=new yi,this._strategy=new Xw(this),this._precision=4,this._session=new Jw(this)}get table(){return this._table}get box(){return this._box}get linefill(){return this._linefill}get line(){return this._line}get polyline(){return this._polyline}get label(){return this._label}get ta(){return this._ta}get strategy(){return this._strategy}get session(){return this._session}get na(){}get last_bar_index(){return this._lastBarIndex}get bar_index(){return this._barIndex}get barstate(){return this._barstate}get close(){return this._priceVariables.close}get low(){return this._priceVariables.low}get open(){return this._priceVariables.open}get high(){return this._priceVariables.high}get volume(){return this._priceVariables.volume}get ohlc4(){const{close:t,open:e,high:r,low:n}=this._priceVariables;return(t+e+r+n)/4}get hl2(){const{high:t,low:e}=this._priceVariables;return(t+e)/2}get hlc3(){const{close:t,high:e,low:r}=this._priceVariables;return(t+e+r)/3}get hlcc4(){const{close:t,high:e,low:r}=this._priceVariables;return(t*2+e+r)/4}get hour(){return Vt(this._currentBarTime).subtract(this._offsetTime,"hour").hour()}get minute(){return Vt(this._currentBarTime).minute()}get second(){return Vt(this._currentBarTime).second()}get month(){return Vt(this._currentBarTime).month()+1}get year(){return Vt(this._currentBarTime).year()}get dayofweek(){return Vt(this._currentBarTime).day()+1}get dayofmonth(){return Vt(this._currentBarTime).date()}get weekofyear(){return Vt(this._currentBarTime).week()}get last_bar_time(){return this._lastBarTime}get time(){return this._currentBarTime}get time_close(){const[t,e]=ms(this._period);return this._isRealTimeBar?void 0:Vt(this._currentBarTime).add(t,e).valueOf()}get timenow(){return Date.now()}get time_tradingday(){return this.getTimeTradingday(this._currentBarTime,this._period)}get timeframe(){return this._timeframe}get precision(){return this._precision}getTimeTradingday(t,e){const[r,n]=ms(e),s=Vt(t);return["M","w","y","d"].includes(n)?s.valueOf():(s.subtract(this._offsetTime,"h"),s.startOf("d").add(this._offsetTime,"h").valueOf())}updateData(t){const{barIndex:e,c:r,o:n,h:s,l:a,volume:l,lastBarIndex:f,time:h,lastBarTime:p,period:c="1D",offsetTime:d=5,precision:g=4}=t;this._priceVariables={close:Number(r),open:Number(n),high:Number(s),low:Number(a),volume:Number(l)},e>this._barIndex&&this._isRealTimeBar&&(this._cacheData.varData=this._cacheData.varNewData,this._cacheData.varNewData={}),this._precision=g,this._currentBarTime=h*1e3,this._lastBarIndex=f,this._barIndex=e,this._lastBarTime=p*1e3,this._period=c,this._offsetTime=d,this._timeframe.update(c),this._barstate.update(e,f,!1,!1),this.ta.update({...this._priceVariables,hlc3:this.hlc3,barIndex:e})}getCacheData(t,e,r){let n=this._cacheData[t]||[];n[this._barIndex]=r,n=n.filter(()=>!0);const s=n[n.length-1-e];return this._cacheData[t]=n,s}setCacheData(t,e){const r=this._cacheData[t]||[];r[this._barIndex]=e,this._cacheData[t]=r}getTypeInstance(t,e){return new Fp(t,e)}getVarValue(t,e,r){const n=`${t}_${e}`,s=r==="var"?this._cacheData.varData[n]:this._cacheData.varipData[n];if(s)return s}setVarValue(t,e,r,n){const s=`${t}_${e}`;let a;switch(typeof r=="object"&&r&&(n="var",a=r.varipKeys),n){case"var":if(this._isRealTimeBar){const l=Sr.cloneDeep(r);if(this._cacheData.varNewData[s]=l,a&&a.length)for(const f of a)this._cacheData.varData[s][f]=l[f]}else this._cacheData.varData[s]=r;break;case"varip":this._cacheData.varipData[s]=r;break}return r}add(t,e){return Array.isArray(t)&&Array.isArray(e)?Sr.uniq([...t,...e]):typeof t=="number"||typeof e=="number"?Number(t)+Number(e):t+e}sub(t,e){return Array.isArray(t)&&Array.isArray(e)?t.filter(r=>!e.includes(r)):Number(t)-Number(e)}againAssignParse(t,e){var n;if(e)return;const r=(n=t==null?void 0:t.constructor)==null?void 0:n.name;if(r)switch(r){case Hi.name:case Gc.name:case Xi.name:case Ra.name:case Ji.name:case io.name:t==null||t.delete();break}}}class yi{constructor(t=50){z(this,"_all");z(this,"_allInstance");z(this,"_pseudoArrayAll");z(this,"_maxLength");this._all=new Map,this._allInstance=new Map,this._pseudoArrayAll=new Jt,this._maxLength=t}setMaxLen(t){this._maxLength=t}get data(){return[...this._all.values()]}get all(){return this._pseudoArrayAll._value=[...this._allInstance.values()],this._pseudoArrayAll}add(t,e,r){this._all.set(t,e),this._allInstance.set(t,r);const n=[...this._all.keys()];if(n.length>this._maxLength){const s=n.shift();s&&this.delete(s)}}get(t){return this._all.get(t)}getInstance(t){return this._allInstance.get(t)}delete(t){this._all.delete(t),this._allInstance.delete(t)}}var Kc={exports:{}};(function(i,t){(function(e,r){i.exports=r()})(jt,function(){return function(e,r,n){r.prototype.isBetween=function(s,a,l,f){var h=n(s),p=n(a),c=(f=f||"()")[0]==="(",d=f[1]===")";return(c?this.isAfter(h,l):!this.isBefore(h,l))&&(d?this.isBefore(p,l):!this.isAfter(p,l))||(c?this.isBefore(h,l):!this.isAfter(h,l))&&(d?this.isAfter(p,l):!this.isBefore(p,l))}}})})(Kc);var ey=Kc.exports,ry=Zt(ey),Hc={exports:{}};(function(i,t){(function(e,r){i.exports=r()})(jt,function(){return function(e,r,n){var s=r.prototype,a=function(d){var g,w=d.date,m=d.utc,D={};if(!((g=w)===null||g instanceof Date||g instanceof Array||s.$utils().u(g)||g.constructor.name!=="Object")){if(!Object.keys(w).length)return new Date;var v=m?n.utc():n();Object.keys(w).forEach(function(O){var C,T;D[C=O,T=s.$utils().p(C),T==="date"?"day":T]=w[O]});var E=D.day||(D.year||D.month>=0?1:v.date()),b=D.year||v.year(),N=D.month>=0?D.month:D.year||D.day?0:v.month(),x=D.hour||0,F=D.minute||0,M=D.second||0,S=D.millisecond||0;return m?new Date(Date.UTC(b,N,E,x,F,M,S)):new Date(b,N,E,x,F,M,S)}return w},l=s.parse;s.parse=function(d){d.date=a.bind(this)(d),l.bind(this)(d)};var f=s.set,h=s.add,p=s.subtract,c=function(d,g,w,m){m===void 0&&(m=1);var D=Object.keys(g),v=this;return D.forEach(function(E){v=d.bind(v)(g[E]*m,E)}),v};s.set=function(d,g){return g=g===void 0?d:g,d.constructor.name==="Object"?c.bind(this)(function(w,m){return f.bind(this)(m,w)},g,d):f.bind(this)(d,g)},s.add=function(d,g){return d.constructor.name==="Object"?c.bind(this)(h,d,g):h.bind(this)(d,g)},s.subtract=function(d,g){return d.constructor.name==="Object"?c.bind(this)(h,d,g,-1):p.bind(this)(d,g)}}})})(Hc);var ny=Hc.exports,iy=Zt(ny),Jc={exports:{}};(function(i,t){(function(e,r){i.exports=r()})(jt,function(){var e,r,n=1e3,s=6e4,a=36e5,l=864e5,f=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,h=31536e6,p=2628e6,c=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,d={years:h,months:p,days:l,hours:a,minutes:s,seconds:n,milliseconds:1,weeks:6048e5},g=function(F){return F instanceof N},w=function(F,M,S){return new N(F,S,M.$l)},m=function(F){return r.p(F)+"s"},D=function(F){return F<0},v=function(F){return D(F)?Math.ceil(F):Math.floor(F)},E=function(F){return Math.abs(F)},b=function(F,M){return F?D(F)?{negative:!0,format:""+E(F)+M}:{negative:!1,format:""+F+M}:{negative:!1,format:""}},N=function(){function F(S,O,C){var T=this;if(this.$d={},this.$l=C,S===void 0&&(this.$ms=0,this.parseFromMilliseconds()),O)return w(S*d[m(O)],this);if(typeof S=="number")return this.$ms=S,this.parseFromMilliseconds(),this;if(typeof S=="object")return Object.keys(S).forEach(function(k){T.$d[m(k)]=S[k]}),this.calMilliseconds(),this;if(typeof S=="string"){var L=S.match(c);if(L){var U=L.slice(2).map(function(k){return k!=null?Number(k):0});return this.$d.years=U[0],this.$d.months=U[1],this.$d.weeks=U[2],this.$d.days=U[3],this.$d.hours=U[4],this.$d.minutes=U[5],this.$d.seconds=U[6],this.calMilliseconds(),this}}return this}var M=F.prototype;return M.calMilliseconds=function(){var S=this;this.$ms=Object.keys(this.$d).reduce(function(O,C){return O+(S.$d[C]||0)*d[C]},0)},M.parseFromMilliseconds=function(){var S=this.$ms;this.$d.years=v(S/h),S%=h,this.$d.months=v(S/p),S%=p,this.$d.days=v(S/l),S%=l,this.$d.hours=v(S/a),S%=a,this.$d.minutes=v(S/s),S%=s,this.$d.seconds=v(S/n),S%=n,this.$d.milliseconds=S},M.toISOString=function(){var S=b(this.$d.years,"Y"),O=b(this.$d.months,"M"),C=+this.$d.days||0;this.$d.weeks&&(C+=7*this.$d.weeks);var T=b(C,"D"),L=b(this.$d.hours,"H"),U=b(this.$d.minutes,"M"),k=this.$d.seconds||0;this.$d.milliseconds&&(k+=this.$d.milliseconds/1e3,k=Math.round(1e3*k)/1e3);var W=b(k,"S"),P=S.negative||O.negative||T.negative||L.negative||U.negative||W.negative,K=L.format||U.format||W.format?"T":"",G=(P?"-":"")+"P"+S.format+O.format+T.format+K+L.format+U.format+W.format;return G==="P"||G==="-P"?"P0D":G},M.toJSON=function(){return this.toISOString()},M.format=function(S){var O=S||"YYYY-MM-DDTHH:mm:ss",C={Y:this.$d.years,YY:r.s(this.$d.years,2,"0"),YYYY:r.s(this.$d.years,4,"0"),M:this.$d.months,MM:r.s(this.$d.months,2,"0"),D:this.$d.days,DD:r.s(this.$d.days,2,"0"),H:this.$d.hours,HH:r.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:r.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:r.s(this.$d.seconds,2,"0"),SSS:r.s(this.$d.milliseconds,3,"0")};return O.replace(f,function(T,L){return L||String(C[T])})},M.as=function(S){return this.$ms/d[m(S)]},M.get=function(S){var O=this.$ms,C=m(S);return C==="milliseconds"?O%=1e3:O=C==="weeks"?v(O/d[C]):this.$d[C],O||0},M.add=function(S,O,C){var T;return T=O?S*d[m(O)]:g(S)?S.$ms:w(S,this).$ms,w(this.$ms+T*(C?-1:1),this)},M.subtract=function(S,O){return this.add(S,O,!0)},M.locale=function(S){var O=this.clone();return O.$l=S,O},M.clone=function(){return w(this.$ms,this)},M.humanize=function(S){return e().add(this.$ms,"ms").locale(this.$l).fromNow(!S)},M.valueOf=function(){return this.asMilliseconds()},M.milliseconds=function(){return this.get("milliseconds")},M.asMilliseconds=function(){return this.as("milliseconds")},M.seconds=function(){return this.get("seconds")},M.asSeconds=function(){return this.as("seconds")},M.minutes=function(){return this.get("minutes")},M.asMinutes=function(){return this.as("minutes")},M.hours=function(){return this.get("hours")},M.asHours=function(){return this.as("hours")},M.days=function(){return this.get("days")},M.asDays=function(){return this.as("days")},M.weeks=function(){return this.get("weeks")},M.asWeeks=function(){return this.as("weeks")},M.months=function(){return this.get("months")},M.asMonths=function(){return this.as("months")},M.years=function(){return this.get("years")},M.asYears=function(){return this.as("years")},F}(),x=function(F,M,S){return F.add(M.years()*S,"y").add(M.months()*S,"M").add(M.days()*S,"d").add(M.hours()*S,"h").add(M.minutes()*S,"m").add(M.seconds()*S,"s").add(M.milliseconds()*S,"ms")};return function(F,M,S){e=S,r=S().$utils(),S.duration=function(T,L){var U=S.locale();return w(T,{$l:U},L)},S.isDuration=g;var O=M.prototype.add,C=M.prototype.subtract;M.prototype.add=function(T,L){return g(T)?x(this,T,1):O.bind(this)(T,L)},M.prototype.subtract=function(T,L){return g(T)?x(this,T,-1):C.bind(this)(T,L)}}})})(Jc);var sy=Jc.exports,oy=Zt(sy);Vt.extend(Cl),Vt.extend(ry),Vt.extend(iy),Vt.extend(oy);class ay{constructor(t,e){z(this,"array");z(this,"color");z(this,"math");z(this,"str");z(this,"map");z(this,"matrix");z(this,"timeframe");z(this,"ta");z(this,"input");z(this,"_variables");z(this,"_cacheData");z(this,"_options");z(this,"_errorListener");z(this,"_plots");z(this,"_alerts");z(this,"_bgColors");z(this,"_hlines");z(this,"_fills");z(this,"chart");z(this,"line");z(this,"label");z(this,"polyline");z(this,"box");z(this,"table");z(this,"linefill");z(this,"log");z(this,"runtime");z(this,"strategy");this._variables=e,this._errorListener=new Kw,this.array=new Lp(this._errorListener),this.math=new Rp(t,this._errorListener),this.color=new f1,this.str=new cw(this._errorListener),this.map=new hw(this._errorListener),this.timeframe=new fw(e),this.matrix=new lw(this._errorListener),this.ta=new o1(e,this.math,this.timeframe),this._cacheData={},this._options={},this._bgColors={},this._alerts=new Map,this._hlines=new Map,this._fills=new Map,this.input=new l1(e,this._errorListener),this._plots=new Map,this.chart={point:new pw(e)},this.line=new Pw(e),this.label=new dw(e),this.polyline=new Rw(e),this.box=new qw(e),this.table=new kw(e),this.linefill=new zw(e),this.log=new Zw(e),this.runtime=new Gw(this._errorListener),this.strategy=new Yw(this._variables,this._options,1e-4,this._errorListener)}get errors(){return this._errorListener.errors}get options(){const t=this.input.getInputs(),e=this._alerts.size?[...this._alerts.values()]:void 0;this._alerts.clear();const r=Object.keys(this._bgColors).length?{...this._bgColors}:void 0,n=this._hlines.size?[...this._hlines.values()]:void 0,s=this._fills.size?[...this._fills.values()]:void 0,a=this.log.logs.length?this.log.logs:void 0;return this.log.clearLogs(),this._options.scriptType==="strategy"&&Object.assign(this._options,{orders:this.strategy.orders,historyOrders:this.strategy.historyOrders}),Object.assign(this._options,{inputs:t,plots:[...this._plots.values()],draws:this._getDraws(),alerts:e,colors:r,hlines:n,fills:s,logs:a})}_getDraws(){const{line:t,linefill:e,table:r,box:n,polyline:s,label:a}=this._variables,l={};return t.data.length&&(l.lines=t.data),e.data.length&&(l.linefills=e.data),r.data.length&&(l.tables=r.data),n.data.length&&(l.boxes=n.data),s.data.length&&(l.polylines=s.data),a.data.length&&(l.labels=a.data),Object.keys(l).length?l:void 0}update(t){const{barIndex:e,inputs:r}=t;r&&r.length&&this.input.update(r),this.strategy.updateOptions(),this.math.update(e)}endExecution(){this.strategy.endExecution()}indicator(t){this._variables.bar_index||(this._options.scriptType="indicator",this._options.indicator=t)}plot(t,e){const{series:r,color:n,seriesColors:s,...a}=t,{bar_index:l}=this._variables,f=`plot_${e}`,h=this._plots.get(f),p=(h==null?void 0:h.data)||[],c=r!==void 0&&isNaN(r)?void 0:r;if(p[l]=c,s!=null&&s.length&&(this._seriesColorHandle(t,f),p[l]={value:c,itemStyle:{color:n}}),!h){const d=n?[n]:void 0;this._plots.set(f,{editable:!0,...a,colors:d,data:p,id:f})}return{type:"plot",key:f}}plotbar(t,e){const{open:r,close:n,low:s,high:a,color:l,seriesColors:f,...h}=t,{bar_index:p}=this._variables,c=`plotbar_${e}`,d=this._plots.get(c),g=(d==null?void 0:d.data)||[],w=n!==void 0&&isNaN(n)?void 0:n,m=r!==void 0&&isNaN(r)?void 0:r,D=s!==void 0&&isNaN(s)?void 0:s,v=a!==void 0&&isNaN(a)?void 0:a,E=[m,w,D,v];if(g[p]=E,f!=null&&f.length&&(this._seriesColorHandle(t,c),g[p]={value:E,itemStyle:{color:l}}),!d){const b=l?[l]:void 0;this._plots.set(c,{editable:!0,...h,colors:b,data:g,id:c})}}plotchar(t,e){const{series:r,color:n,textcolor:s,...a}=t,{bar_index:l}=this._variables,f=`plotchar_${e}`,h=this._plots.get(f),p=(h==null?void 0:h.data)||[];p[l]={value:r,color:n,textcolor:s},h||this._plots.set(f,{editable:!0,...a,data:p,id:f})}plotarrow(t,e){const{series:r,colorup:n,colordown:s,...a}=t,{bar_index:l}=this._variables,f=`plotarrow_${e}`,h=this._plots.get(f),p=(h==null?void 0:h.data)||[];p[l]={value:r!==void 0&&isNaN(r)?void 0:r,colorup:n,colordown:s},h||this._plots.set(f,{editable:!0,...a,data:p,id:f})}plotshape(t,e){const{series:r,color:n,textcolor:s,...a}=t,{bar_index:l}=this._variables,f=`plotshape_${e}`,h=this._plots.get(f),p=(h==null?void 0:h.data)||[];p[l]={value:r,color:n,textcolor:s},h||this._plots.set(f,{editable:!0,...a,data:p,id:f})}plotcandle(t,e){const{wickcolor:r,bordercolor:n,color:s,close:a,open:l,low:f,high:h,...p}=t,{bar_index:c}=this._variables,d=`plotcandle_${e}`,g=this._plots.get(d),w=(g==null?void 0:g.data)||[],m=a!==void 0&&isNaN(a)?void 0:a,D=l!==void 0&&isNaN(l)?void 0:l,v=f!==void 0&&isNaN(f)?void 0:f,E=h!==void 0&&isNaN(h)?void 0:h,b=[D,m,v,E];w[c]={value:b,wickcolor:r,bordercolor:n,color:s},g||this._plots.set(d,{editable:!0,...p,data:w,id:d})}hline(t,e){const r=`hline_${e}`;return this._hlines.set(r,{linewidth:1,editable:!0,display:ir.all,...t}),{type:"hline",key:r}}fill(t,e){const r=`fill_${e}`;this._fills.set(r,{display:ir.all,editable:!0,fillgaps:!1,...t})}alert({message:t,freq:e=dn.freqOncePerBar},r){const{bar_index:n,_isRealTimeBar:s,last_bar_index:a}=this._variables,l=`alert_${r}`,f=this._cacheData[l].barIndex;if(e===dn.freqOncePerBar&&n===f){this._alerts.delete(l);return}const h={message:t,freq:e,id:l,type:"alert"};if(s){e!==dn.freqOncePerBarClose&&this._alerts.set(l,h),this._cacheData[l].barIndex=n;return}if(!s&&e===dn.freqOncePerBarClose&&n===f&&a===n-1){this._alerts.set(l,h),this._cacheData[l].barIndex=n;return}this._alerts.delete(l)}alertcondition({condition:t,message:e,title:r},n){const{_isRealTimeBar:s}=this._variables,a=`alertcondition_${n}`;s&&t?this._alerts.set(a,{message:e,title:r,id:a,type:"alertcondition"}):this._alerts.delete(a)}barcolor(t){this._setColors(t,"barcolor")}bgcolor(t){this._setColors(t,"bgcolor")}_setColors(t,e){var l,f;const{color:r,...n}=t,{bar_index:s}=this._variables,a=((l=this._bgColors[e])==null?void 0:l.colors)||[];if(!a[s]){const h=((f=this._bgColors[e])==null?void 0:f.setColors)||[];h.includes(r)||h.push(r),a[s]=r,this._bgColors[e]={...n,colors:a,setColors:h}}}max_bars_back({var:t,num:e,var_name:r}){console.log(t,e,r)}float({x:t}){return t}bool({x:t}){return t||!1}string({x:t}){return t}int({x:t}){return t&&Math.trunc(t)}na({x:t}){return t===void 0}fixnan({source:t},e){return t===void 0||isNaN(t)?this._cacheData[`fixnan_${e}`]:(this._cacheData[`fixnan_${e}`]=t,t)}nz({source:t,replacement:e}){return t!==void 0&&!isNaN(t)?t:e||0}time({timeframe:t="",session:e,timezone:r,bars_back:n=0},s){return this._timeHandle(this._variables.time,s,t,e,r,n)}time_close({timeframe:t="",session:e,timezone:r,bars_back:n=0},s){return this._variables.time_close&&this._timeHandle(this._variables.time_close,s,t,e,r,n)}timestamp(t){const{dateString:e,timezone:r,year:n,month:s,day:a,hour:l=0,minute:f=0,second:h=0}=t;if(e)return Vt(e).utc(!/GMT|UTC/.test(e)).valueOf();let p=s-1,c=n;if(p<0){const g=Math.ceil(Math.abs(p/12));p=12*g+p,c=n-g}let d=Vt({year:c,month:p,day:a,hour:l,minute:f,second:h});return r&&(d=Br(d.utc(!0).valueOf(),r)),d.utc(!0).valueOf()}weekofyear({time:t,timezone:e}){return Br(t,e).week()}year({time:t,timezone:e}){return Br(t,e).year()}second({time:t,timezone:e}){return Br(t,e).second()}month({time:t,timezone:e}){return Br(t,e).month()+1}minute({time:t,timezone:e}){return Br(t,e).minute()}hour({time:t,timezone:e}){return Br(t,e).hour()}dayofweek({time:t,timezone:e}){return Br(t,e).day()+1}dayofmonth({time:t,timezone:e}){return Br(t,e).date()}_calcTimeOffset(t,e){const r=this._variables.getTimeTradingday(t,e),n=Xr(e)*1e3;return t-r-Math.floor((t-r)/n)*n}_timeHandle(t,e,r="",n,s,a=0){const l=r||this._variables.timeframe.period,f=Xr(l),h=Xr(this._variables.timeframe.period);let p;if(f<=h)p=t;else{const c=`time_${e}`,d=this._cacheData[c];if(d)d.currentTime+f*1e3-d.offset<=t?(p=t,this._cacheData[c]={currentTime:t,offset:0}):p=d;else{const g=this._calcTimeOffset(t,l);this._cacheData[c]={currentTime:t,offset:g},p=t}}if(n){const{timePeriods:c,weeks:d}=this._parserSession(n,e),g=Vt(t).format("YYYY-MM-DD"),w=p;p=void 0;for(const D of c){const[v,E]=D;if(Vt(t).isBetween(`${g} ${v}`,`${g} ${E}`,"hour")){Vt(w).isBetween(`${g} ${v}`,`${g} ${E}`,"hour")?p=w:p=Vt(`${g} ${v}`).valueOf();break}}const m=this._variables.dayofweek;p&&!d.includes(m)&&(p=void 0)}return s&&(p=p&&Br(p,s).valueOf()),p&&p-a*h*1e3}_seriesColorHandle(t,e){var s,a;const{seriesColors:r}=t,n=this._plots.get(e);if(n&&r!=null&&r.length)for(const l of r){if((s=n.gradientColorKeys)!=null&&s.includes(l))continue;const f=t[l],h=n[`${l}s`]||[];h.includes(f)||(h.push(f),n[`${l}s`]=h,h.length>5&&(n[`${l}s`]=[],(a=n.gradientColorKeys)==null||a.push(l)))}}_parserSession(t,e){const r=t.split(":"),n=r[0],a=(r[1]||"1234567").split("").map(f=>{const h=parseInt(f,10);if(h<1||h>7){this._errorListener.addError(`Invalid day of week: ${f}`,e,Ce.Error);return}return h});return{timePeriods:n.split(",").map(f=>{const h=f.split("-");return h.length!==2?(this._errorListener.addError(`Invalid time period: ${f}`,e,Ce.Error),[]):[this._processTime(h[0],e),this._processTime(h[1],e)]}),weeks:a}}_processTime(t,e){const r=parseInt(t.slice(0,2),10),n=parseInt(t.slice(2),10);if(!(r>=0&&r<=23)&&n>=0&&n<=59){this._errorListener.addError("Invalid time: Time must be within 00:00 to 23:59",e,Ce.Error);return}return`${r}:${n}`}}/**
|
63
63
|
* @license
|
64
64
|
* Copyright 2019 Google LLC
|
65
65
|
* SPDX-License-Identifier: Apache-2.0
|
66
|
-
*/const
|
66
|
+
*/const Xc=Symbol("Comlink.proxy"),uy=Symbol("Comlink.endpoint"),ly=Symbol("Comlink.releaseProxy"),Pa=Symbol("Comlink.finalizer"),so=Symbol("Comlink.thrown"),Vc=i=>typeof i=="object"&&i!==null||typeof i=="function",fy={canHandle:i=>Vc(i)&&i[Xc],serialize(i){const{port1:t,port2:e}=new MessageChannel;return za(i,t),[e,[e]]},deserialize(i){return i.start(),dy(i)}},cy={canHandle:i=>Vc(i)&&so in i,serialize({value:i}){let t;return i instanceof Error?t={isError:!0,value:{message:i.message,name:i.name,stack:i.stack}}:t={isError:!1,value:i},[t,[]]},deserialize(i){throw i.isError?Object.assign(new Error(i.value.message),i.value):i.value}},Qc=new Map([["proxy",fy],["throw",cy]]);function hy(i,t){for(const e of i)if(t===e||e==="*"||e instanceof RegExp&&e.test(t))return!0;return!1}function za(i,t=globalThis,e=["*"]){t.addEventListener("message",function r(n){if(!n||!n.data)return;if(!hy(e,n.origin)){console.warn(`Invalid origin '${n.origin}' for comlink proxy`);return}const{id:s,type:a,path:l}=Object.assign({path:[]},n.data),f=(n.data.argumentList||[]).map(Gn);let h;try{const p=l.slice(0,-1).reduce((d,g)=>d[g],i),c=l.reduce((d,g)=>d[g],i);switch(a){case"GET":h=c;break;case"SET":p[l.slice(-1)[0]]=Gn(n.data.value),h=!0;break;case"APPLY":h=c.apply(p,f);break;case"CONSTRUCT":{const d=new c(...f);h=wy(d)}break;case"ENDPOINT":{const{port1:d,port2:g}=new MessageChannel;za(i,g),h=vy(d,[d])}break;case"RELEASE":h=void 0;break;default:return}}catch(p){h={value:p,[so]:0}}Promise.resolve(h).catch(p=>({value:p,[so]:0})).then(p=>{const[c,d]=lo(p);t.postMessage(Object.assign(Object.assign({},c),{id:s}),d),a==="RELEASE"&&(t.removeEventListener("message",r),th(t),Pa in i&&typeof i[Pa]=="function"&&i[Pa]())}).catch(p=>{const[c,d]=lo({value:new TypeError("Unserializable return value"),[so]:0});t.postMessage(Object.assign(Object.assign({},c),{id:s}),d)})}),t.start&&t.start()}function py(i){return i.constructor.name==="MessagePort"}function th(i){py(i)&&i.close()}function dy(i,t){return qa(i,[],t)}function oo(i){if(i)throw new Error("Proxy has been released and is not useable")}function eh(i){return Di(i,{type:"RELEASE"}).then(()=>{th(i)})}const ao=new WeakMap,uo="FinalizationRegistry"in globalThis&&new FinalizationRegistry(i=>{const t=(ao.get(i)||0)-1;ao.set(i,t),t===0&&eh(i)});function _y(i,t){const e=(ao.get(t)||0)+1;ao.set(t,e),uo&&uo.register(i,t,i)}function my(i){uo&&uo.unregister(i)}function qa(i,t=[],e=function(){}){let r=!1;const n=new Proxy(e,{get(s,a){if(oo(r),a===ly)return()=>{my(n),eh(i),r=!0};if(a==="then"){if(t.length===0)return{then:()=>n};const l=Di(i,{type:"GET",path:t.map(f=>f.toString())}).then(Gn);return l.then.bind(l)}return qa(i,[...t,a])},set(s,a,l){oo(r);const[f,h]=lo(l);return Di(i,{type:"SET",path:[...t,a].map(p=>p.toString()),value:f},h).then(Gn)},apply(s,a,l){oo(r);const f=t[t.length-1];if(f===uy)return Di(i,{type:"ENDPOINT"}).then(Gn);if(f==="bind")return qa(i,t.slice(0,-1));const[h,p]=rh(l);return Di(i,{type:"APPLY",path:t.map(c=>c.toString()),argumentList:h},p).then(Gn)},construct(s,a){oo(r);const[l,f]=rh(a);return Di(i,{type:"CONSTRUCT",path:t.map(h=>h.toString()),argumentList:l},f).then(Gn)}});return _y(n,i),n}function gy(i){return Array.prototype.concat.apply([],i)}function rh(i){const t=i.map(lo);return[t.map(e=>e[0]),gy(t.map(e=>e[1]))]}const nh=new WeakMap;function vy(i,t){return nh.set(i,t),i}function wy(i){return Object.assign(i,{[Xc]:!0})}function lo(i){for(const[t,e]of Qc)if(e.canHandle(i)){const[r,n]=e.serialize(i);return[{type:"HANDLER",name:t,value:r},n]}return[{type:"RAW",value:i},nh.get(i)||[]]}function Gn(i){switch(i.type){case"HANDLER":return Qc.get(i.name).deserialize(i.value);case"RAW":return i.value}}function Di(i,t,e){return new Promise(r=>{const n=yy();i.addEventListener("message",function s(a){!a.data||!a.data.id||a.data.id!==n||(i.removeEventListener("message",s),r(a.data))}),i.start&&i.start(),i.postMessage(Object.assign({id:n},t),e)})}function yy(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}class Dy{constructor(){z(this,"_cache");this._cache=new Map}set(t,e){this._cache.set(t,e)}setValue(t,e,r){const n=this._cache.get(t)||{};n[e]=r,this._cache.set(t,n)}updateValue(t,e,r){const n=this._cache.get(t)||{};this._cache.set(t,Object.assign(n[e]||{},r))}get(t){return this._cache.get(t)}has(t){return this._cache.has(t)}delete(t){this._cache.delete(t)}clear(){this._cache.clear()}}function by(i,t,e){const{data:r,isPreParser:n}=t;if(self.workerStorage||(self.workerStorage=new Dy),e&&(self.builtInGather=new ty,self.buildinConstants=new Lw,self.buildInFunctions=new ay(4,self.builtInGather),self.tradingvueFunc=new Function("$_var","$_const","$_func",i)),n)self.tradingvueFunc(self.builtInGather,self.buildinConstants,self.buildInFunctions);else if(r&&r.length){const a=r.length;for(const[l,f]of r.entries()){self.builtInGather.updateData(Object.assign(f,{barIndex:l,lastBarIndex:a-1,lastBarTime:r[a-1].time})),self.buildInFunctions.update({barIndex:l}),self.tradingvueFunc(self.builtInGather,self.buildinConstants,self.buildInFunctions),self.buildInFunctions.endExecution();const h=self.buildInFunctions.errors;if(h.length&&h.some(p=>p.type===Ce.Error))return{status:1,errors:h}}}const s=self.buildInFunctions.errors;return s.length&&s.some(a=>a.type===Ce.Error)?{status:1,errors:s}:{status:0,options:self.buildInFunctions.options}}function Ey(i){self==null||self.workerStorage.delete(i)}za({runScript:by,removeScript:Ey})})();
|