@guihz/trading-vue-editor-tes 0.0.87 → 0.0.89

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,80 @@
1
+ var RC=Object.defineProperty;var LC=(ye,tt,Mt)=>tt in ye?RC(ye,tt,{enumerable:!0,configurable:!0,writable:!0,value:Mt}):ye[tt]=Mt;var U=(ye,tt,Mt)=>(LC(ye,typeof tt!="symbol"?tt+"":tt,Mt),Mt),_f=(ye,tt,Mt)=>{if(!tt.has(ye))throw TypeError("Cannot "+Mt)};var on=(ye,tt,Mt)=>(_f(ye,tt,"read from private field"),Mt?Mt.call(ye):tt.get(ye)),vf=(ye,tt,Mt)=>{if(tt.has(ye))throw TypeError("Cannot add the same private member more than once");tt instanceof WeakSet?tt.add(ye):tt.set(ye,Mt)},Ea=(ye,tt,Mt,Xn)=>(_f(ye,tt,"write to private field"),Xn?Xn.call(ye,Mt):tt.set(ye,Mt),Mt);var gf=(ye,tt,Mt)=>(_f(ye,tt,"access private method"),Mt);(function(){"use strict";var _s,mf,Ri,tr;var ye=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function tt(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function Mt(s){if(s.__esModule)return s;var e=s.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(r){var n=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return s[r]}})}),t}var Xn={exports:{}};/**
2
+ * @license
3
+ * Lodash <https://lodash.com/>
4
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
5
+ * Released under MIT license <https://lodash.com/license>
6
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
7
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
8
+ */Xn.exports,function(s,e){(function(){var t,r="4.17.21",n=200,i="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",u="Invalid `variable` option passed into `_.template`",l="__lodash_hash_undefined__",c=500,h="__lodash_placeholder__",d=1,p=2,v=4,x=1,_=2,y=1,m=2,w=4,D=8,C=16,E=32,F=64,B=128,M=256,O=512,A=30,N="...",T=800,R=16,k=1,z=2,L=3,G=1/0,H=9007199254740991,ee=17976931348623157e292,te=NaN,j=4294967295,X=j-1,Y=j>>>1,Q=[["ary",B],["bind",y],["bindKey",m],["curry",D],["curryRight",C],["flip",O],["partial",E],["partialRight",F],["rearg",M]],pe="[object Arguments]",De="[object Array]",we="[object AsyncFunction]",Ee="[object Boolean]",Oe="[object Date]",Fe="[object DOMException]",nt="[object Error]",Ye="[object Function]",Te="[object GeneratorFunction]",Re="[object Map]",xt="[object Number]",Ut="[object Null]",bt="[object Object]",ur="[object Promise]",Lr="[object Proxy]",fr="[object RegExp]",yt="[object Set]",Ot="[object String]",P="[object Symbol]",V="[object Undefined]",J="[object WeakMap]",ie="[object WeakSet]",ue="[object ArrayBuffer]",se="[object DataView]",_e="[object Float32Array]",he="[object Float64Array]",de="[object Int8Array]",le="[object Int16Array]",Xe="[object Int32Array]",et="[object Uint8Array]",ht="[object Uint8ClampedArray]",kt="[object Uint16Array]",Tt="[object Uint32Array]",rr=/\b__p \+= '';/g,cr=/\b(__p \+=) '' \+/g,en=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Dn=/&(?:amp|lt|gt|quot|#39);/g,fi=/[&<>"']/g,vs=RegExp(Dn.source),gs=RegExp(fi.source),ms=/<%-([\s\S]+?)%>/g,Li=/<%([\s\S]+?)%>/g,Pi=/<%=([\s\S]+?)%>/g,xs=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ki=/^\w*$/,ys=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,zn=/[\\^$.*+?()[\]{}|]/g,Xt=RegExp(zn.source),mr=/^\s+/,zi=/\s/,Ds=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,j0=/\{\n\/\* \[wrapped with (.+)\] \*/,Y0=/,? & /,Z0=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,V0=/[()=,{}\[\]\/\s]/,G0=/\\(\\)?/g,K0=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,$o=/\w*$/,X0=/^[-+]0x[0-9a-f]+$/i,Q0=/^0b[01]+$/i,J0=/^\[object .+?Constructor\]$/,eu=/^0o[0-7]+$/i,tu=/^(?:0|[1-9]\d*)$/,ru=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,qi=/($^)/,ci=/['\n\r\u2028\u2029\\]/g,Qe="\\ud800-\\udfff",nr="\\u0300-\\u036f",nu="\\ufe20-\\ufe2f",Ui="\\u20d0-\\u20ff",qn=nr+nu+Ui,Ro="\\u2700-\\u27bf",zh="a-z\\xdf-\\xf6\\xf8-\\xff",Ow="\\xac\\xb1\\xd7\\xf7",Tw="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Iw="\\u2000-\\u206f",$w=" \\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",qh="A-Z\\xc0-\\xd6\\xd8-\\xde",Uh="\\ufe0e\\ufe0f",Wh=Ow+Tw+Iw+$w,iu="['’]",Rw="["+Qe+"]",Hh="["+Wh+"]",Lo="["+qn+"]",jh="\\d+",Lw="["+Ro+"]",Yh="["+zh+"]",Zh="[^"+Qe+Wh+jh+Ro+zh+qh+"]",su="\\ud83c[\\udffb-\\udfff]",Pw="(?:"+Lo+"|"+su+")",Vh="[^"+Qe+"]",ou="(?:\\ud83c[\\udde6-\\uddff]){2}",au="[\\ud800-\\udbff][\\udc00-\\udfff]",Wi="["+qh+"]",Gh="\\u200d",Kh="(?:"+Yh+"|"+Zh+")",kw="(?:"+Wi+"|"+Zh+")",Xh="(?:"+iu+"(?:d|ll|m|re|s|t|ve))?",Qh="(?:"+iu+"(?:D|LL|M|RE|S|T|VE))?",Jh=Pw+"?",ed="["+Uh+"]?",zw="(?:"+Gh+"(?:"+[Vh,ou,au].join("|")+")"+ed+Jh+")*",qw="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Uw="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",td=ed+Jh+zw,Ww="(?:"+[Lw,ou,au].join("|")+")"+td,Hw="(?:"+[Vh+Lo+"?",Lo,ou,au,Rw].join("|")+")",jw=RegExp(iu,"g"),Yw=RegExp(Lo,"g"),uu=RegExp(su+"(?="+su+")|"+Hw+td,"g"),Zw=RegExp([Wi+"?"+Yh+"+"+Xh+"(?="+[Hh,Wi,"$"].join("|")+")",kw+"+"+Qh+"(?="+[Hh,Wi+Kh,"$"].join("|")+")",Wi+"?"+Kh+"+"+Xh,Wi+"+"+Qh,Uw,qw,jh,Ww].join("|"),"g"),Vw=RegExp("["+Gh+Qe+qn+Uh+"]"),Gw=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Kw=["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"],Xw=-1,Dt={};Dt[_e]=Dt[he]=Dt[de]=Dt[le]=Dt[Xe]=Dt[et]=Dt[ht]=Dt[kt]=Dt[Tt]=!0,Dt[pe]=Dt[De]=Dt[ue]=Dt[Ee]=Dt[se]=Dt[Oe]=Dt[nt]=Dt[Ye]=Dt[Re]=Dt[xt]=Dt[bt]=Dt[fr]=Dt[yt]=Dt[Ot]=Dt[J]=!1;var _t={};_t[pe]=_t[De]=_t[ue]=_t[se]=_t[Ee]=_t[Oe]=_t[_e]=_t[he]=_t[de]=_t[le]=_t[Xe]=_t[Re]=_t[xt]=_t[bt]=_t[fr]=_t[yt]=_t[Ot]=_t[P]=_t[et]=_t[ht]=_t[kt]=_t[Tt]=!0,_t[nt]=_t[Ye]=_t[J]=!1;var Qw={À:"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"},Jw={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},e2={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},t2={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},r2=parseFloat,n2=parseInt,rd=typeof ye=="object"&&ye&&ye.Object===Object&&ye,i2=typeof self=="object"&&self&&self.Object===Object&&self,Qt=rd||i2||Function("return this")(),fu=e&&!e.nodeType&&e,li=fu&&!0&&s&&!s.nodeType&&s,nd=li&&li.exports===fu,cu=nd&&rd.process,Pr=function(){try{var Z=li&&li.require&&li.require("util").types;return Z||cu&&cu.binding&&cu.binding("util")}catch{}}(),id=Pr&&Pr.isArrayBuffer,sd=Pr&&Pr.isDate,od=Pr&&Pr.isMap,ad=Pr&&Pr.isRegExp,ud=Pr&&Pr.isSet,fd=Pr&&Pr.isTypedArray;function Cr(Z,ne,re){switch(re.length){case 0:return Z.call(ne);case 1:return Z.call(ne,re[0]);case 2:return Z.call(ne,re[0],re[1]);case 3:return Z.call(ne,re[0],re[1],re[2])}return Z.apply(ne,re)}function s2(Z,ne,re,be){for(var Le=-1,st=Z==null?0:Z.length;++Le<st;){var Wt=Z[Le];ne(be,Wt,re(Wt),Z)}return be}function kr(Z,ne){for(var re=-1,be=Z==null?0:Z.length;++re<be&&ne(Z[re],re,Z)!==!1;);return Z}function o2(Z,ne){for(var re=Z==null?0:Z.length;re--&&ne(Z[re],re,Z)!==!1;);return Z}function cd(Z,ne){for(var re=-1,be=Z==null?0:Z.length;++re<be;)if(!ne(Z[re],re,Z))return!1;return!0}function Un(Z,ne){for(var re=-1,be=Z==null?0:Z.length,Le=0,st=[];++re<be;){var Wt=Z[re];ne(Wt,re,Z)&&(st[Le++]=Wt)}return st}function Po(Z,ne){var re=Z==null?0:Z.length;return!!re&&Hi(Z,ne,0)>-1}function lu(Z,ne,re){for(var be=-1,Le=Z==null?0:Z.length;++be<Le;)if(re(ne,Z[be]))return!0;return!1}function At(Z,ne){for(var re=-1,be=Z==null?0:Z.length,Le=Array(be);++re<be;)Le[re]=ne(Z[re],re,Z);return Le}function Wn(Z,ne){for(var re=-1,be=ne.length,Le=Z.length;++re<be;)Z[Le+re]=ne[re];return Z}function hu(Z,ne,re,be){var Le=-1,st=Z==null?0:Z.length;for(be&&st&&(re=Z[++Le]);++Le<st;)re=ne(re,Z[Le],Le,Z);return re}function a2(Z,ne,re,be){var Le=Z==null?0:Z.length;for(be&&Le&&(re=Z[--Le]);Le--;)re=ne(re,Z[Le],Le,Z);return re}function du(Z,ne){for(var re=-1,be=Z==null?0:Z.length;++re<be;)if(ne(Z[re],re,Z))return!0;return!1}var u2=pu("length");function f2(Z){return Z.split("")}function c2(Z){return Z.match(Z0)||[]}function ld(Z,ne,re){var be;return re(Z,function(Le,st,Wt){if(ne(Le,st,Wt))return be=st,!1}),be}function ko(Z,ne,re,be){for(var Le=Z.length,st=re+(be?1:-1);be?st--:++st<Le;)if(ne(Z[st],st,Z))return st;return-1}function Hi(Z,ne,re){return ne===ne?w2(Z,ne,re):ko(Z,hd,re)}function l2(Z,ne,re,be){for(var Le=re-1,st=Z.length;++Le<st;)if(be(Z[Le],ne))return Le;return-1}function hd(Z){return Z!==Z}function dd(Z,ne){var re=Z==null?0:Z.length;return re?vu(Z,ne)/re:te}function pu(Z){return function(ne){return ne==null?t:ne[Z]}}function _u(Z){return function(ne){return Z==null?t:Z[ne]}}function pd(Z,ne,re,be,Le){return Le(Z,function(st,Wt,dt){re=be?(be=!1,st):ne(re,st,Wt,dt)}),re}function h2(Z,ne){var re=Z.length;for(Z.sort(ne);re--;)Z[re]=Z[re].value;return Z}function vu(Z,ne){for(var re,be=-1,Le=Z.length;++be<Le;){var st=ne(Z[be]);st!==t&&(re=re===t?st:re+st)}return re}function gu(Z,ne){for(var re=-1,be=Array(Z);++re<Z;)be[re]=ne(re);return be}function d2(Z,ne){return At(ne,function(re){return[re,Z[re]]})}function _d(Z){return Z&&Z.slice(0,xd(Z)+1).replace(mr,"")}function Fr(Z){return function(ne){return Z(ne)}}function mu(Z,ne){return At(ne,function(re){return Z[re]})}function ws(Z,ne){return Z.has(ne)}function vd(Z,ne){for(var re=-1,be=Z.length;++re<be&&Hi(ne,Z[re],0)>-1;);return re}function gd(Z,ne){for(var re=Z.length;re--&&Hi(ne,Z[re],0)>-1;);return re}function p2(Z,ne){for(var re=Z.length,be=0;re--;)Z[re]===ne&&++be;return be}var _2=_u(Qw),v2=_u(Jw);function g2(Z){return"\\"+t2[Z]}function m2(Z,ne){return Z==null?t:Z[ne]}function ji(Z){return Vw.test(Z)}function x2(Z){return Gw.test(Z)}function y2(Z){for(var ne,re=[];!(ne=Z.next()).done;)re.push(ne.value);return re}function xu(Z){var ne=-1,re=Array(Z.size);return Z.forEach(function(be,Le){re[++ne]=[Le,be]}),re}function md(Z,ne){return function(re){return Z(ne(re))}}function Hn(Z,ne){for(var re=-1,be=Z.length,Le=0,st=[];++re<be;){var Wt=Z[re];(Wt===ne||Wt===h)&&(Z[re]=h,st[Le++]=re)}return st}function zo(Z){var ne=-1,re=Array(Z.size);return Z.forEach(function(be){re[++ne]=be}),re}function D2(Z){var ne=-1,re=Array(Z.size);return Z.forEach(function(be){re[++ne]=[be,be]}),re}function w2(Z,ne,re){for(var be=re-1,Le=Z.length;++be<Le;)if(Z[be]===ne)return be;return-1}function E2(Z,ne,re){for(var be=re+1;be--;)if(Z[be]===ne)return be;return be}function Yi(Z){return ji(Z)?A2(Z):u2(Z)}function tn(Z){return ji(Z)?C2(Z):f2(Z)}function xd(Z){for(var ne=Z.length;ne--&&zi.test(Z.charAt(ne)););return ne}var b2=_u(e2);function A2(Z){for(var ne=uu.lastIndex=0;uu.test(Z);)++ne;return ne}function C2(Z){return Z.match(uu)||[]}function F2(Z){return Z.match(Zw)||[]}var B2=function Z(ne){ne=ne==null?Qt:Zi.defaults(Qt.Object(),ne,Zi.pick(Qt,Kw));var re=ne.Array,be=ne.Date,Le=ne.Error,st=ne.Function,Wt=ne.Math,dt=ne.Object,yu=ne.RegExp,M2=ne.String,zr=ne.TypeError,qo=re.prototype,N2=st.prototype,Vi=dt.prototype,Uo=ne["__core-js_shared__"],Wo=N2.toString,ft=Vi.hasOwnProperty,S2=0,yd=function(){var o=/[^.]+$/.exec(Uo&&Uo.keys&&Uo.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""}(),Ho=Vi.toString,O2=Wo.call(dt),T2=Qt._,I2=yu("^"+Wo.call(ft).replace(zn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),jo=nd?ne.Buffer:t,jn=ne.Symbol,Yo=ne.Uint8Array,Dd=jo?jo.allocUnsafe:t,Zo=md(dt.getPrototypeOf,dt),wd=dt.create,Ed=Vi.propertyIsEnumerable,Vo=qo.splice,bd=jn?jn.isConcatSpreadable:t,Es=jn?jn.iterator:t,hi=jn?jn.toStringTag:t,Go=function(){try{var o=gi(dt,"defineProperty");return o({},"",{}),o}catch{}}(),$2=ne.clearTimeout!==Qt.clearTimeout&&ne.clearTimeout,R2=be&&be.now!==Qt.Date.now&&be.now,L2=ne.setTimeout!==Qt.setTimeout&&ne.setTimeout,Ko=Wt.ceil,Xo=Wt.floor,Du=dt.getOwnPropertySymbols,P2=jo?jo.isBuffer:t,Ad=ne.isFinite,k2=qo.join,z2=md(dt.keys,dt),Ht=Wt.max,ir=Wt.min,q2=be.now,U2=ne.parseInt,Cd=Wt.random,W2=qo.reverse,wu=gi(ne,"DataView"),bs=gi(ne,"Map"),Eu=gi(ne,"Promise"),Gi=gi(ne,"Set"),As=gi(ne,"WeakMap"),Cs=gi(dt,"create"),Qo=As&&new As,Ki={},H2=mi(wu),j2=mi(bs),Y2=mi(Eu),Z2=mi(Gi),V2=mi(As),Jo=jn?jn.prototype:t,Fs=Jo?Jo.valueOf:t,Fd=Jo?Jo.toString:t;function I(o){if(Nt(o)&&!Pe(o)&&!(o instanceof Ze)){if(o instanceof qr)return o;if(ft.call(o,"__wrapped__"))return Bp(o)}return new qr(o)}var Xi=function(){function o(){}return function(f){if(!Bt(f))return{};if(wd)return wd(f);o.prototype=f;var g=new o;return o.prototype=t,g}}();function ea(){}function qr(o,f){this.__wrapped__=o,this.__actions__=[],this.__chain__=!!f,this.__index__=0,this.__values__=t}I.templateSettings={escape:ms,evaluate:Li,interpolate:Pi,variable:"",imports:{_:I}},I.prototype=ea.prototype,I.prototype.constructor=I,qr.prototype=Xi(ea.prototype),qr.prototype.constructor=qr;function Ze(o){this.__wrapped__=o,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=j,this.__views__=[]}function G2(){var o=new Ze(this.__wrapped__);return o.__actions__=xr(this.__actions__),o.__dir__=this.__dir__,o.__filtered__=this.__filtered__,o.__iteratees__=xr(this.__iteratees__),o.__takeCount__=this.__takeCount__,o.__views__=xr(this.__views__),o}function K2(){if(this.__filtered__){var o=new Ze(this);o.__dir__=-1,o.__filtered__=!0}else o=this.clone(),o.__dir__*=-1;return o}function X2(){var o=this.__wrapped__.value(),f=this.__dir__,g=Pe(o),b=f<0,S=g?o.length:0,$=f8(0,S,this.__views__),q=$.start,W=$.end,K=W-q,oe=b?W:q-1,ae=this.__iteratees__,ce=ae.length,ge=0,Ae=ir(K,this.__takeCount__);if(!g||!b&&S==K&&Ae==K)return Xd(o,this.__actions__);var Ne=[];e:for(;K--&&ge<Ae;){oe+=f;for(var qe=-1,Se=o[oe];++qe<ce;){var He=ae[qe],Ke=He.iteratee,Nr=He.type,dr=Ke(Se);if(Nr==z)Se=dr;else if(!dr){if(Nr==k)continue e;break e}}Ne[ge++]=Se}return Ne}Ze.prototype=Xi(ea.prototype),Ze.prototype.constructor=Ze;function di(o){var f=-1,g=o==null?0:o.length;for(this.clear();++f<g;){var b=o[f];this.set(b[0],b[1])}}function Q2(){this.__data__=Cs?Cs(null):{},this.size=0}function J2(o){var f=this.has(o)&&delete this.__data__[o];return this.size-=f?1:0,f}function eE(o){var f=this.__data__;if(Cs){var g=f[o];return g===l?t:g}return ft.call(f,o)?f[o]:t}function tE(o){var f=this.__data__;return Cs?f[o]!==t:ft.call(f,o)}function rE(o,f){var g=this.__data__;return this.size+=this.has(o)?0:1,g[o]=Cs&&f===t?l:f,this}di.prototype.clear=Q2,di.prototype.delete=J2,di.prototype.get=eE,di.prototype.has=tE,di.prototype.set=rE;function wn(o){var f=-1,g=o==null?0:o.length;for(this.clear();++f<g;){var b=o[f];this.set(b[0],b[1])}}function nE(){this.__data__=[],this.size=0}function iE(o){var f=this.__data__,g=ta(f,o);if(g<0)return!1;var b=f.length-1;return g==b?f.pop():Vo.call(f,g,1),--this.size,!0}function sE(o){var f=this.__data__,g=ta(f,o);return g<0?t:f[g][1]}function oE(o){return ta(this.__data__,o)>-1}function aE(o,f){var g=this.__data__,b=ta(g,o);return b<0?(++this.size,g.push([o,f])):g[b][1]=f,this}wn.prototype.clear=nE,wn.prototype.delete=iE,wn.prototype.get=sE,wn.prototype.has=oE,wn.prototype.set=aE;function En(o){var f=-1,g=o==null?0:o.length;for(this.clear();++f<g;){var b=o[f];this.set(b[0],b[1])}}function uE(){this.size=0,this.__data__={hash:new di,map:new(bs||wn),string:new di}}function fE(o){var f=da(this,o).delete(o);return this.size-=f?1:0,f}function cE(o){return da(this,o).get(o)}function lE(o){return da(this,o).has(o)}function hE(o,f){var g=da(this,o),b=g.size;return g.set(o,f),this.size+=g.size==b?0:1,this}En.prototype.clear=uE,En.prototype.delete=fE,En.prototype.get=cE,En.prototype.has=lE,En.prototype.set=hE;function pi(o){var f=-1,g=o==null?0:o.length;for(this.__data__=new En;++f<g;)this.add(o[f])}function dE(o){return this.__data__.set(o,l),this}function pE(o){return this.__data__.has(o)}pi.prototype.add=pi.prototype.push=dE,pi.prototype.has=pE;function rn(o){var f=this.__data__=new wn(o);this.size=f.size}function _E(){this.__data__=new wn,this.size=0}function vE(o){var f=this.__data__,g=f.delete(o);return this.size=f.size,g}function gE(o){return this.__data__.get(o)}function mE(o){return this.__data__.has(o)}function xE(o,f){var g=this.__data__;if(g instanceof wn){var b=g.__data__;if(!bs||b.length<n-1)return b.push([o,f]),this.size=++g.size,this;g=this.__data__=new En(b)}return g.set(o,f),this.size=g.size,this}rn.prototype.clear=_E,rn.prototype.delete=vE,rn.prototype.get=gE,rn.prototype.has=mE,rn.prototype.set=xE;function Bd(o,f){var g=Pe(o),b=!g&&xi(o),S=!g&&!b&&Kn(o),$=!g&&!b&&!S&&ts(o),q=g||b||S||$,W=q?gu(o.length,M2):[],K=W.length;for(var oe in o)(f||ft.call(o,oe))&&!(q&&(oe=="length"||S&&(oe=="offset"||oe=="parent")||$&&(oe=="buffer"||oe=="byteLength"||oe=="byteOffset")||Fn(oe,K)))&&W.push(oe);return W}function Md(o){var f=o.length;return f?o[Iu(0,f-1)]:t}function yE(o,f){return pa(xr(o),_i(f,0,o.length))}function DE(o){return pa(xr(o))}function bu(o,f,g){(g!==t&&!nn(o[f],g)||g===t&&!(f in o))&&bn(o,f,g)}function Bs(o,f,g){var b=o[f];(!(ft.call(o,f)&&nn(b,g))||g===t&&!(f in o))&&bn(o,f,g)}function ta(o,f){for(var g=o.length;g--;)if(nn(o[g][0],f))return g;return-1}function wE(o,f,g,b){return Yn(o,function(S,$,q){f(b,S,g(S),q)}),b}function Nd(o,f){return o&&hn(f,Yt(f),o)}function EE(o,f){return o&&hn(f,Dr(f),o)}function bn(o,f,g){f=="__proto__"&&Go?Go(o,f,{configurable:!0,enumerable:!0,value:g,writable:!0}):o[f]=g}function Au(o,f){for(var g=-1,b=f.length,S=re(b),$=o==null;++g<b;)S[g]=$?t:of(o,f[g]);return S}function _i(o,f,g){return o===o&&(g!==t&&(o=o<=g?o:g),f!==t&&(o=o>=f?o:f)),o}function Ur(o,f,g,b,S,$){var q,W=f&d,K=f&p,oe=f&v;if(g&&(q=S?g(o,b,S,$):g(o)),q!==t)return q;if(!Bt(o))return o;var ae=Pe(o);if(ae){if(q=l8(o),!W)return xr(o,q)}else{var ce=sr(o),ge=ce==Ye||ce==Te;if(Kn(o))return ep(o,W);if(ce==bt||ce==pe||ge&&!S){if(q=K||ge?{}:xp(o),!W)return K?e8(o,EE(q,o)):JE(o,Nd(q,o))}else{if(!_t[ce])return S?o:{};q=h8(o,ce,W)}}$||($=new rn);var Ae=$.get(o);if(Ae)return Ae;$.set(o,q),Vp(o)?o.forEach(function(Se){q.add(Ur(Se,f,g,Se,o,$))}):Yp(o)&&o.forEach(function(Se,He){q.set(He,Ur(Se,f,g,He,o,$))});var Ne=oe?K?ju:Hu:K?Dr:Yt,qe=ae?t:Ne(o);return kr(qe||o,function(Se,He){qe&&(He=Se,Se=o[He]),Bs(q,He,Ur(Se,f,g,He,o,$))}),q}function bE(o){var f=Yt(o);return function(g){return Sd(g,o,f)}}function Sd(o,f,g){var b=g.length;if(o==null)return!b;for(o=dt(o);b--;){var S=g[b],$=f[S],q=o[S];if(q===t&&!(S in o)||!$(q))return!1}return!0}function Od(o,f,g){if(typeof o!="function")throw new zr(a);return $s(function(){o.apply(t,g)},f)}function Ms(o,f,g,b){var S=-1,$=Po,q=!0,W=o.length,K=[],oe=f.length;if(!W)return K;g&&(f=At(f,Fr(g))),b?($=lu,q=!1):f.length>=n&&($=ws,q=!1,f=new pi(f));e:for(;++S<W;){var ae=o[S],ce=g==null?ae:g(ae);if(ae=b||ae!==0?ae:0,q&&ce===ce){for(var ge=oe;ge--;)if(f[ge]===ce)continue e;K.push(ae)}else $(f,ce,b)||K.push(ae)}return K}var Yn=sp(ln),Td=sp(Fu,!0);function AE(o,f){var g=!0;return Yn(o,function(b,S,$){return g=!!f(b,S,$),g}),g}function ra(o,f,g){for(var b=-1,S=o.length;++b<S;){var $=o[b],q=f($);if(q!=null&&(W===t?q===q&&!Mr(q):g(q,W)))var W=q,K=$}return K}function CE(o,f,g,b){var S=o.length;for(g=ze(g),g<0&&(g=-g>S?0:S+g),b=b===t||b>S?S:ze(b),b<0&&(b+=S),b=g>b?0:Kp(b);g<b;)o[g++]=f;return o}function Id(o,f){var g=[];return Yn(o,function(b,S,$){f(b,S,$)&&g.push(b)}),g}function Jt(o,f,g,b,S){var $=-1,q=o.length;for(g||(g=p8),S||(S=[]);++$<q;){var W=o[$];f>0&&g(W)?f>1?Jt(W,f-1,g,b,S):Wn(S,W):b||(S[S.length]=W)}return S}var Cu=op(),$d=op(!0);function ln(o,f){return o&&Cu(o,f,Yt)}function Fu(o,f){return o&&$d(o,f,Yt)}function na(o,f){return Un(f,function(g){return Bn(o[g])})}function vi(o,f){f=Vn(f,o);for(var g=0,b=f.length;o!=null&&g<b;)o=o[dn(f[g++])];return g&&g==b?o:t}function Rd(o,f,g){var b=f(o);return Pe(o)?b:Wn(b,g(o))}function lr(o){return o==null?o===t?V:Ut:hi&&hi in dt(o)?u8(o):D8(o)}function Bu(o,f){return o>f}function FE(o,f){return o!=null&&ft.call(o,f)}function BE(o,f){return o!=null&&f in dt(o)}function ME(o,f,g){return o>=ir(f,g)&&o<Ht(f,g)}function Mu(o,f,g){for(var b=g?lu:Po,S=o[0].length,$=o.length,q=$,W=re($),K=1/0,oe=[];q--;){var ae=o[q];q&&f&&(ae=At(ae,Fr(f))),K=ir(ae.length,K),W[q]=!g&&(f||S>=120&&ae.length>=120)?new pi(q&&ae):t}ae=o[0];var ce=-1,ge=W[0];e:for(;++ce<S&&oe.length<K;){var Ae=ae[ce],Ne=f?f(Ae):Ae;if(Ae=g||Ae!==0?Ae:0,!(ge?ws(ge,Ne):b(oe,Ne,g))){for(q=$;--q;){var qe=W[q];if(!(qe?ws(qe,Ne):b(o[q],Ne,g)))continue e}ge&&ge.push(Ne),oe.push(Ae)}}return oe}function NE(o,f,g,b){return ln(o,function(S,$,q){f(b,g(S),$,q)}),b}function Ns(o,f,g){f=Vn(f,o),o=Ep(o,f);var b=o==null?o:o[dn(Hr(f))];return b==null?t:Cr(b,o,g)}function Ld(o){return Nt(o)&&lr(o)==pe}function SE(o){return Nt(o)&&lr(o)==ue}function OE(o){return Nt(o)&&lr(o)==Oe}function Ss(o,f,g,b,S){return o===f?!0:o==null||f==null||!Nt(o)&&!Nt(f)?o!==o&&f!==f:TE(o,f,g,b,Ss,S)}function TE(o,f,g,b,S,$){var q=Pe(o),W=Pe(f),K=q?De:sr(o),oe=W?De:sr(f);K=K==pe?bt:K,oe=oe==pe?bt:oe;var ae=K==bt,ce=oe==bt,ge=K==oe;if(ge&&Kn(o)){if(!Kn(f))return!1;q=!0,ae=!1}if(ge&&!ae)return $||($=new rn),q||ts(o)?vp(o,f,g,b,S,$):o8(o,f,K,g,b,S,$);if(!(g&x)){var Ae=ae&&ft.call(o,"__wrapped__"),Ne=ce&&ft.call(f,"__wrapped__");if(Ae||Ne){var qe=Ae?o.value():o,Se=Ne?f.value():f;return $||($=new rn),S(qe,Se,g,b,$)}}return ge?($||($=new rn),a8(o,f,g,b,S,$)):!1}function IE(o){return Nt(o)&&sr(o)==Re}function Nu(o,f,g,b){var S=g.length,$=S,q=!b;if(o==null)return!$;for(o=dt(o);S--;){var W=g[S];if(q&&W[2]?W[1]!==o[W[0]]:!(W[0]in o))return!1}for(;++S<$;){W=g[S];var K=W[0],oe=o[K],ae=W[1];if(q&&W[2]){if(oe===t&&!(K in o))return!1}else{var ce=new rn;if(b)var ge=b(oe,ae,K,o,f,ce);if(!(ge===t?Ss(ae,oe,x|_,b,ce):ge))return!1}}return!0}function Pd(o){if(!Bt(o)||v8(o))return!1;var f=Bn(o)?I2:J0;return f.test(mi(o))}function $E(o){return Nt(o)&&lr(o)==fr}function RE(o){return Nt(o)&&sr(o)==yt}function LE(o){return Nt(o)&&ya(o.length)&&!!Dt[lr(o)]}function kd(o){return typeof o=="function"?o:o==null?wr:typeof o=="object"?Pe(o)?Ud(o[0],o[1]):qd(o):a1(o)}function Su(o){if(!Is(o))return z2(o);var f=[];for(var g in dt(o))ft.call(o,g)&&g!="constructor"&&f.push(g);return f}function PE(o){if(!Bt(o))return y8(o);var f=Is(o),g=[];for(var b in o)b=="constructor"&&(f||!ft.call(o,b))||g.push(b);return g}function Ou(o,f){return o<f}function zd(o,f){var g=-1,b=yr(o)?re(o.length):[];return Yn(o,function(S,$,q){b[++g]=f(S,$,q)}),b}function qd(o){var f=Zu(o);return f.length==1&&f[0][2]?Dp(f[0][0],f[0][1]):function(g){return g===o||Nu(g,o,f)}}function Ud(o,f){return Gu(o)&&yp(f)?Dp(dn(o),f):function(g){var b=of(g,o);return b===t&&b===f?af(g,o):Ss(f,b,x|_)}}function ia(o,f,g,b,S){o!==f&&Cu(f,function($,q){if(S||(S=new rn),Bt($))kE(o,f,q,g,ia,b,S);else{var W=b?b(Xu(o,q),$,q+"",o,f,S):t;W===t&&(W=$),bu(o,q,W)}},Dr)}function kE(o,f,g,b,S,$,q){var W=Xu(o,g),K=Xu(f,g),oe=q.get(K);if(oe){bu(o,g,oe);return}var ae=$?$(W,K,g+"",o,f,q):t,ce=ae===t;if(ce){var ge=Pe(K),Ae=!ge&&Kn(K),Ne=!ge&&!Ae&&ts(K);ae=K,ge||Ae||Ne?Pe(W)?ae=W:It(W)?ae=xr(W):Ae?(ce=!1,ae=ep(K,!0)):Ne?(ce=!1,ae=tp(K,!0)):ae=[]:Rs(K)||xi(K)?(ae=W,xi(W)?ae=Xp(W):(!Bt(W)||Bn(W))&&(ae=xp(K))):ce=!1}ce&&(q.set(K,ae),S(ae,K,b,$,q),q.delete(K)),bu(o,g,ae)}function Wd(o,f){var g=o.length;if(g)return f+=f<0?g:0,Fn(f,g)?o[f]:t}function Hd(o,f,g){f.length?f=At(f,function($){return Pe($)?function(q){return vi(q,$.length===1?$[0]:$)}:$}):f=[wr];var b=-1;f=At(f,Fr(Me()));var S=zd(o,function($,q,W){var K=At(f,function(oe){return oe($)});return{criteria:K,index:++b,value:$}});return h2(S,function($,q){return QE($,q,g)})}function zE(o,f){return jd(o,f,function(g,b){return af(o,b)})}function jd(o,f,g){for(var b=-1,S=f.length,$={};++b<S;){var q=f[b],W=vi(o,q);g(W,q)&&Os($,Vn(q,o),W)}return $}function qE(o){return function(f){return vi(f,o)}}function Tu(o,f,g,b){var S=b?l2:Hi,$=-1,q=f.length,W=o;for(o===f&&(f=xr(f)),g&&(W=At(o,Fr(g)));++$<q;)for(var K=0,oe=f[$],ae=g?g(oe):oe;(K=S(W,ae,K,b))>-1;)W!==o&&Vo.call(W,K,1),Vo.call(o,K,1);return o}function Yd(o,f){for(var g=o?f.length:0,b=g-1;g--;){var S=f[g];if(g==b||S!==$){var $=S;Fn(S)?Vo.call(o,S,1):Lu(o,S)}}return o}function Iu(o,f){return o+Xo(Cd()*(f-o+1))}function UE(o,f,g,b){for(var S=-1,$=Ht(Ko((f-o)/(g||1)),0),q=re($);$--;)q[b?$:++S]=o,o+=g;return q}function $u(o,f){var g="";if(!o||f<1||f>H)return g;do f%2&&(g+=o),f=Xo(f/2),f&&(o+=o);while(f);return g}function Ue(o,f){return Qu(wp(o,f,wr),o+"")}function WE(o){return Md(rs(o))}function HE(o,f){var g=rs(o);return pa(g,_i(f,0,g.length))}function Os(o,f,g,b){if(!Bt(o))return o;f=Vn(f,o);for(var S=-1,$=f.length,q=$-1,W=o;W!=null&&++S<$;){var K=dn(f[S]),oe=g;if(K==="__proto__"||K==="constructor"||K==="prototype")return o;if(S!=q){var ae=W[K];oe=b?b(ae,K,W):t,oe===t&&(oe=Bt(ae)?ae:Fn(f[S+1])?[]:{})}Bs(W,K,oe),W=W[K]}return o}var Zd=Qo?function(o,f){return Qo.set(o,f),o}:wr,jE=Go?function(o,f){return Go(o,"toString",{configurable:!0,enumerable:!1,value:ff(f),writable:!0})}:wr;function YE(o){return pa(rs(o))}function Wr(o,f,g){var b=-1,S=o.length;f<0&&(f=-f>S?0:S+f),g=g>S?S:g,g<0&&(g+=S),S=f>g?0:g-f>>>0,f>>>=0;for(var $=re(S);++b<S;)$[b]=o[b+f];return $}function ZE(o,f){var g;return Yn(o,function(b,S,$){return g=f(b,S,$),!g}),!!g}function sa(o,f,g){var b=0,S=o==null?b:o.length;if(typeof f=="number"&&f===f&&S<=Y){for(;b<S;){var $=b+S>>>1,q=o[$];q!==null&&!Mr(q)&&(g?q<=f:q<f)?b=$+1:S=$}return S}return Ru(o,f,wr,g)}function Ru(o,f,g,b){var S=0,$=o==null?0:o.length;if($===0)return 0;f=g(f);for(var q=f!==f,W=f===null,K=Mr(f),oe=f===t;S<$;){var ae=Xo((S+$)/2),ce=g(o[ae]),ge=ce!==t,Ae=ce===null,Ne=ce===ce,qe=Mr(ce);if(q)var Se=b||Ne;else oe?Se=Ne&&(b||ge):W?Se=Ne&&ge&&(b||!Ae):K?Se=Ne&&ge&&!Ae&&(b||!qe):Ae||qe?Se=!1:Se=b?ce<=f:ce<f;Se?S=ae+1:$=ae}return ir($,X)}function Vd(o,f){for(var g=-1,b=o.length,S=0,$=[];++g<b;){var q=o[g],W=f?f(q):q;if(!g||!nn(W,K)){var K=W;$[S++]=q===0?0:q}}return $}function Gd(o){return typeof o=="number"?o:Mr(o)?te:+o}function Br(o){if(typeof o=="string")return o;if(Pe(o))return At(o,Br)+"";if(Mr(o))return Fd?Fd.call(o):"";var f=o+"";return f=="0"&&1/o==-G?"-0":f}function Zn(o,f,g){var b=-1,S=Po,$=o.length,q=!0,W=[],K=W;if(g)q=!1,S=lu;else if($>=n){var oe=f?null:i8(o);if(oe)return zo(oe);q=!1,S=ws,K=new pi}else K=f?[]:W;e:for(;++b<$;){var ae=o[b],ce=f?f(ae):ae;if(ae=g||ae!==0?ae:0,q&&ce===ce){for(var ge=K.length;ge--;)if(K[ge]===ce)continue e;f&&K.push(ce),W.push(ae)}else S(K,ce,g)||(K!==W&&K.push(ce),W.push(ae))}return W}function Lu(o,f){return f=Vn(f,o),o=Ep(o,f),o==null||delete o[dn(Hr(f))]}function Kd(o,f,g,b){return Os(o,f,g(vi(o,f)),b)}function oa(o,f,g,b){for(var S=o.length,$=b?S:-1;(b?$--:++$<S)&&f(o[$],$,o););return g?Wr(o,b?0:$,b?$+1:S):Wr(o,b?$+1:0,b?S:$)}function Xd(o,f){var g=o;return g instanceof Ze&&(g=g.value()),hu(f,function(b,S){return S.func.apply(S.thisArg,Wn([b],S.args))},g)}function Pu(o,f,g){var b=o.length;if(b<2)return b?Zn(o[0]):[];for(var S=-1,$=re(b);++S<b;)for(var q=o[S],W=-1;++W<b;)W!=S&&($[S]=Ms($[S]||q,o[W],f,g));return Zn(Jt($,1),f,g)}function Qd(o,f,g){for(var b=-1,S=o.length,$=f.length,q={};++b<S;){var W=b<$?f[b]:t;g(q,o[b],W)}return q}function ku(o){return It(o)?o:[]}function zu(o){return typeof o=="function"?o:wr}function Vn(o,f){return Pe(o)?o:Gu(o,f)?[o]:Fp(at(o))}var VE=Ue;function Gn(o,f,g){var b=o.length;return g=g===t?b:g,!f&&g>=b?o:Wr(o,f,g)}var Jd=$2||function(o){return Qt.clearTimeout(o)};function ep(o,f){if(f)return o.slice();var g=o.length,b=Dd?Dd(g):new o.constructor(g);return o.copy(b),b}function qu(o){var f=new o.constructor(o.byteLength);return new Yo(f).set(new Yo(o)),f}function GE(o,f){var g=f?qu(o.buffer):o.buffer;return new o.constructor(g,o.byteOffset,o.byteLength)}function KE(o){var f=new o.constructor(o.source,$o.exec(o));return f.lastIndex=o.lastIndex,f}function XE(o){return Fs?dt(Fs.call(o)):{}}function tp(o,f){var g=f?qu(o.buffer):o.buffer;return new o.constructor(g,o.byteOffset,o.length)}function rp(o,f){if(o!==f){var g=o!==t,b=o===null,S=o===o,$=Mr(o),q=f!==t,W=f===null,K=f===f,oe=Mr(f);if(!W&&!oe&&!$&&o>f||$&&q&&K&&!W&&!oe||b&&q&&K||!g&&K||!S)return 1;if(!b&&!$&&!oe&&o<f||oe&&g&&S&&!b&&!$||W&&g&&S||!q&&S||!K)return-1}return 0}function QE(o,f,g){for(var b=-1,S=o.criteria,$=f.criteria,q=S.length,W=g.length;++b<q;){var K=rp(S[b],$[b]);if(K){if(b>=W)return K;var oe=g[b];return K*(oe=="desc"?-1:1)}}return o.index-f.index}function np(o,f,g,b){for(var S=-1,$=o.length,q=g.length,W=-1,K=f.length,oe=Ht($-q,0),ae=re(K+oe),ce=!b;++W<K;)ae[W]=f[W];for(;++S<q;)(ce||S<$)&&(ae[g[S]]=o[S]);for(;oe--;)ae[W++]=o[S++];return ae}function ip(o,f,g,b){for(var S=-1,$=o.length,q=-1,W=g.length,K=-1,oe=f.length,ae=Ht($-W,0),ce=re(ae+oe),ge=!b;++S<ae;)ce[S]=o[S];for(var Ae=S;++K<oe;)ce[Ae+K]=f[K];for(;++q<W;)(ge||S<$)&&(ce[Ae+g[q]]=o[S++]);return ce}function xr(o,f){var g=-1,b=o.length;for(f||(f=re(b));++g<b;)f[g]=o[g];return f}function hn(o,f,g,b){var S=!g;g||(g={});for(var $=-1,q=f.length;++$<q;){var W=f[$],K=b?b(g[W],o[W],W,g,o):t;K===t&&(K=o[W]),S?bn(g,W,K):Bs(g,W,K)}return g}function JE(o,f){return hn(o,Vu(o),f)}function e8(o,f){return hn(o,gp(o),f)}function aa(o,f){return function(g,b){var S=Pe(g)?s2:wE,$=f?f():{};return S(g,o,Me(b,2),$)}}function Qi(o){return Ue(function(f,g){var b=-1,S=g.length,$=S>1?g[S-1]:t,q=S>2?g[2]:t;for($=o.length>3&&typeof $=="function"?(S--,$):t,q&&hr(g[0],g[1],q)&&($=S<3?t:$,S=1),f=dt(f);++b<S;){var W=g[b];W&&o(f,W,b,$)}return f})}function sp(o,f){return function(g,b){if(g==null)return g;if(!yr(g))return o(g,b);for(var S=g.length,$=f?S:-1,q=dt(g);(f?$--:++$<S)&&b(q[$],$,q)!==!1;);return g}}function op(o){return function(f,g,b){for(var S=-1,$=dt(f),q=b(f),W=q.length;W--;){var K=q[o?W:++S];if(g($[K],K,$)===!1)break}return f}}function t8(o,f,g){var b=f&y,S=Ts(o);function $(){var q=this&&this!==Qt&&this instanceof $?S:o;return q.apply(b?g:this,arguments)}return $}function ap(o){return function(f){f=at(f);var g=ji(f)?tn(f):t,b=g?g[0]:f.charAt(0),S=g?Gn(g,1).join(""):f.slice(1);return b[o]()+S}}function Ji(o){return function(f){return hu(s1(i1(f).replace(jw,"")),o,"")}}function Ts(o){return function(){var f=arguments;switch(f.length){case 0:return new o;case 1:return new o(f[0]);case 2:return new o(f[0],f[1]);case 3:return new o(f[0],f[1],f[2]);case 4:return new o(f[0],f[1],f[2],f[3]);case 5:return new o(f[0],f[1],f[2],f[3],f[4]);case 6:return new o(f[0],f[1],f[2],f[3],f[4],f[5]);case 7:return new o(f[0],f[1],f[2],f[3],f[4],f[5],f[6])}var g=Xi(o.prototype),b=o.apply(g,f);return Bt(b)?b:g}}function r8(o,f,g){var b=Ts(o);function S(){for(var $=arguments.length,q=re($),W=$,K=es(S);W--;)q[W]=arguments[W];var oe=$<3&&q[0]!==K&&q[$-1]!==K?[]:Hn(q,K);if($-=oe.length,$<g)return hp(o,f,ua,S.placeholder,t,q,oe,t,t,g-$);var ae=this&&this!==Qt&&this instanceof S?b:o;return Cr(ae,this,q)}return S}function up(o){return function(f,g,b){var S=dt(f);if(!yr(f)){var $=Me(g,3);f=Yt(f),g=function(W){return $(S[W],W,S)}}var q=o(f,g,b);return q>-1?S[$?f[q]:q]:t}}function fp(o){return Cn(function(f){var g=f.length,b=g,S=qr.prototype.thru;for(o&&f.reverse();b--;){var $=f[b];if(typeof $!="function")throw new zr(a);if(S&&!q&&ha($)=="wrapper")var q=new qr([],!0)}for(b=q?b:g;++b<g;){$=f[b];var W=ha($),K=W=="wrapper"?Yu($):t;K&&Ku(K[0])&&K[1]==(B|D|E|M)&&!K[4].length&&K[9]==1?q=q[ha(K[0])].apply(q,K[3]):q=$.length==1&&Ku($)?q[W]():q.thru($)}return function(){var oe=arguments,ae=oe[0];if(q&&oe.length==1&&Pe(ae))return q.plant(ae).value();for(var ce=0,ge=g?f[ce].apply(this,oe):ae;++ce<g;)ge=f[ce].call(this,ge);return ge}})}function ua(o,f,g,b,S,$,q,W,K,oe){var ae=f&B,ce=f&y,ge=f&m,Ae=f&(D|C),Ne=f&O,qe=ge?t:Ts(o);function Se(){for(var He=arguments.length,Ke=re(He),Nr=He;Nr--;)Ke[Nr]=arguments[Nr];if(Ae)var dr=es(Se),Sr=p2(Ke,dr);if(b&&(Ke=np(Ke,b,S,Ae)),$&&(Ke=ip(Ke,$,q,Ae)),He-=Sr,Ae&&He<oe){var $t=Hn(Ke,dr);return hp(o,f,ua,Se.placeholder,g,Ke,$t,W,K,oe-He)}var sn=ce?g:this,Nn=ge?sn[o]:o;return He=Ke.length,W?Ke=w8(Ke,W):Ne&&He>1&&Ke.reverse(),ae&&K<He&&(Ke.length=K),this&&this!==Qt&&this instanceof Se&&(Nn=qe||Ts(Nn)),Nn.apply(sn,Ke)}return Se}function cp(o,f){return function(g,b){return NE(g,o,f(b),{})}}function fa(o,f){return function(g,b){var S;if(g===t&&b===t)return f;if(g!==t&&(S=g),b!==t){if(S===t)return b;typeof g=="string"||typeof b=="string"?(g=Br(g),b=Br(b)):(g=Gd(g),b=Gd(b)),S=o(g,b)}return S}}function Uu(o){return Cn(function(f){return f=At(f,Fr(Me())),Ue(function(g){var b=this;return o(f,function(S){return Cr(S,b,g)})})})}function ca(o,f){f=f===t?" ":Br(f);var g=f.length;if(g<2)return g?$u(f,o):f;var b=$u(f,Ko(o/Yi(f)));return ji(f)?Gn(tn(b),0,o).join(""):b.slice(0,o)}function n8(o,f,g,b){var S=f&y,$=Ts(o);function q(){for(var W=-1,K=arguments.length,oe=-1,ae=b.length,ce=re(ae+K),ge=this&&this!==Qt&&this instanceof q?$:o;++oe<ae;)ce[oe]=b[oe];for(;K--;)ce[oe++]=arguments[++W];return Cr(ge,S?g:this,ce)}return q}function lp(o){return function(f,g,b){return b&&typeof b!="number"&&hr(f,g,b)&&(g=b=t),f=Mn(f),g===t?(g=f,f=0):g=Mn(g),b=b===t?f<g?1:-1:Mn(b),UE(f,g,b,o)}}function la(o){return function(f,g){return typeof f=="string"&&typeof g=="string"||(f=jr(f),g=jr(g)),o(f,g)}}function hp(o,f,g,b,S,$,q,W,K,oe){var ae=f&D,ce=ae?q:t,ge=ae?t:q,Ae=ae?$:t,Ne=ae?t:$;f|=ae?E:F,f&=~(ae?F:E),f&w||(f&=~(y|m));var qe=[o,f,S,Ae,ce,Ne,ge,W,K,oe],Se=g.apply(t,qe);return Ku(o)&&bp(Se,qe),Se.placeholder=b,Ap(Se,o,f)}function Wu(o){var f=Wt[o];return function(g,b){if(g=jr(g),b=b==null?0:ir(ze(b),292),b&&Ad(g)){var S=(at(g)+"e").split("e"),$=f(S[0]+"e"+(+S[1]+b));return S=(at($)+"e").split("e"),+(S[0]+"e"+(+S[1]-b))}return f(g)}}var i8=Gi&&1/zo(new Gi([,-0]))[1]==G?function(o){return new Gi(o)}:hf;function dp(o){return function(f){var g=sr(f);return g==Re?xu(f):g==yt?D2(f):d2(f,o(f))}}function An(o,f,g,b,S,$,q,W){var K=f&m;if(!K&&typeof o!="function")throw new zr(a);var oe=b?b.length:0;if(oe||(f&=~(E|F),b=S=t),q=q===t?q:Ht(ze(q),0),W=W===t?W:ze(W),oe-=S?S.length:0,f&F){var ae=b,ce=S;b=S=t}var ge=K?t:Yu(o),Ae=[o,f,g,b,S,ae,ce,$,q,W];if(ge&&x8(Ae,ge),o=Ae[0],f=Ae[1],g=Ae[2],b=Ae[3],S=Ae[4],W=Ae[9]=Ae[9]===t?K?0:o.length:Ht(Ae[9]-oe,0),!W&&f&(D|C)&&(f&=~(D|C)),!f||f==y)var Ne=t8(o,f,g);else f==D||f==C?Ne=r8(o,f,W):(f==E||f==(y|E))&&!S.length?Ne=n8(o,f,g,b):Ne=ua.apply(t,Ae);var qe=ge?Zd:bp;return Ap(qe(Ne,Ae),o,f)}function pp(o,f,g,b){return o===t||nn(o,Vi[g])&&!ft.call(b,g)?f:o}function _p(o,f,g,b,S,$){return Bt(o)&&Bt(f)&&($.set(f,o),ia(o,f,t,_p,$),$.delete(f)),o}function s8(o){return Rs(o)?t:o}function vp(o,f,g,b,S,$){var q=g&x,W=o.length,K=f.length;if(W!=K&&!(q&&K>W))return!1;var oe=$.get(o),ae=$.get(f);if(oe&&ae)return oe==f&&ae==o;var ce=-1,ge=!0,Ae=g&_?new pi:t;for($.set(o,f),$.set(f,o);++ce<W;){var Ne=o[ce],qe=f[ce];if(b)var Se=q?b(qe,Ne,ce,f,o,$):b(Ne,qe,ce,o,f,$);if(Se!==t){if(Se)continue;ge=!1;break}if(Ae){if(!du(f,function(He,Ke){if(!ws(Ae,Ke)&&(Ne===He||S(Ne,He,g,b,$)))return Ae.push(Ke)})){ge=!1;break}}else if(!(Ne===qe||S(Ne,qe,g,b,$))){ge=!1;break}}return $.delete(o),$.delete(f),ge}function o8(o,f,g,b,S,$,q){switch(g){case se:if(o.byteLength!=f.byteLength||o.byteOffset!=f.byteOffset)return!1;o=o.buffer,f=f.buffer;case ue:return!(o.byteLength!=f.byteLength||!$(new Yo(o),new Yo(f)));case Ee:case Oe:case xt:return nn(+o,+f);case nt:return o.name==f.name&&o.message==f.message;case fr:case Ot:return o==f+"";case Re:var W=xu;case yt:var K=b&x;if(W||(W=zo),o.size!=f.size&&!K)return!1;var oe=q.get(o);if(oe)return oe==f;b|=_,q.set(o,f);var ae=vp(W(o),W(f),b,S,$,q);return q.delete(o),ae;case P:if(Fs)return Fs.call(o)==Fs.call(f)}return!1}function a8(o,f,g,b,S,$){var q=g&x,W=Hu(o),K=W.length,oe=Hu(f),ae=oe.length;if(K!=ae&&!q)return!1;for(var ce=K;ce--;){var ge=W[ce];if(!(q?ge in f:ft.call(f,ge)))return!1}var Ae=$.get(o),Ne=$.get(f);if(Ae&&Ne)return Ae==f&&Ne==o;var qe=!0;$.set(o,f),$.set(f,o);for(var Se=q;++ce<K;){ge=W[ce];var He=o[ge],Ke=f[ge];if(b)var Nr=q?b(Ke,He,ge,f,o,$):b(He,Ke,ge,o,f,$);if(!(Nr===t?He===Ke||S(He,Ke,g,b,$):Nr)){qe=!1;break}Se||(Se=ge=="constructor")}if(qe&&!Se){var dr=o.constructor,Sr=f.constructor;dr!=Sr&&"constructor"in o&&"constructor"in f&&!(typeof dr=="function"&&dr instanceof dr&&typeof Sr=="function"&&Sr instanceof Sr)&&(qe=!1)}return $.delete(o),$.delete(f),qe}function Cn(o){return Qu(wp(o,t,Sp),o+"")}function Hu(o){return Rd(o,Yt,Vu)}function ju(o){return Rd(o,Dr,gp)}var Yu=Qo?function(o){return Qo.get(o)}:hf;function ha(o){for(var f=o.name+"",g=Ki[f],b=ft.call(Ki,f)?g.length:0;b--;){var S=g[b],$=S.func;if($==null||$==o)return S.name}return f}function es(o){var f=ft.call(I,"placeholder")?I:o;return f.placeholder}function Me(){var o=I.iteratee||cf;return o=o===cf?kd:o,arguments.length?o(arguments[0],arguments[1]):o}function da(o,f){var g=o.__data__;return _8(f)?g[typeof f=="string"?"string":"hash"]:g.map}function Zu(o){for(var f=Yt(o),g=f.length;g--;){var b=f[g],S=o[b];f[g]=[b,S,yp(S)]}return f}function gi(o,f){var g=m2(o,f);return Pd(g)?g:t}function u8(o){var f=ft.call(o,hi),g=o[hi];try{o[hi]=t;var b=!0}catch{}var S=Ho.call(o);return b&&(f?o[hi]=g:delete o[hi]),S}var Vu=Du?function(o){return o==null?[]:(o=dt(o),Un(Du(o),function(f){return Ed.call(o,f)}))}:df,gp=Du?function(o){for(var f=[];o;)Wn(f,Vu(o)),o=Zo(o);return f}:df,sr=lr;(wu&&sr(new wu(new ArrayBuffer(1)))!=se||bs&&sr(new bs)!=Re||Eu&&sr(Eu.resolve())!=ur||Gi&&sr(new Gi)!=yt||As&&sr(new As)!=J)&&(sr=function(o){var f=lr(o),g=f==bt?o.constructor:t,b=g?mi(g):"";if(b)switch(b){case H2:return se;case j2:return Re;case Y2:return ur;case Z2:return yt;case V2:return J}return f});function f8(o,f,g){for(var b=-1,S=g.length;++b<S;){var $=g[b],q=$.size;switch($.type){case"drop":o+=q;break;case"dropRight":f-=q;break;case"take":f=ir(f,o+q);break;case"takeRight":o=Ht(o,f-q);break}}return{start:o,end:f}}function c8(o){var f=o.match(j0);return f?f[1].split(Y0):[]}function mp(o,f,g){f=Vn(f,o);for(var b=-1,S=f.length,$=!1;++b<S;){var q=dn(f[b]);if(!($=o!=null&&g(o,q)))break;o=o[q]}return $||++b!=S?$:(S=o==null?0:o.length,!!S&&ya(S)&&Fn(q,S)&&(Pe(o)||xi(o)))}function l8(o){var f=o.length,g=new o.constructor(f);return f&&typeof o[0]=="string"&&ft.call(o,"index")&&(g.index=o.index,g.input=o.input),g}function xp(o){return typeof o.constructor=="function"&&!Is(o)?Xi(Zo(o)):{}}function h8(o,f,g){var b=o.constructor;switch(f){case ue:return qu(o);case Ee:case Oe:return new b(+o);case se:return GE(o,g);case _e:case he:case de:case le:case Xe:case et:case ht:case kt:case Tt:return tp(o,g);case Re:return new b;case xt:case Ot:return new b(o);case fr:return KE(o);case yt:return new b;case P:return XE(o)}}function d8(o,f){var g=f.length;if(!g)return o;var b=g-1;return f[b]=(g>1?"& ":"")+f[b],f=f.join(g>2?", ":" "),o.replace(Ds,`{
9
+ /* [wrapped with `+f+`] */
10
+ `)}function p8(o){return Pe(o)||xi(o)||!!(bd&&o&&o[bd])}function Fn(o,f){var g=typeof o;return f=f??H,!!f&&(g=="number"||g!="symbol"&&tu.test(o))&&o>-1&&o%1==0&&o<f}function hr(o,f,g){if(!Bt(g))return!1;var b=typeof f;return(b=="number"?yr(g)&&Fn(f,g.length):b=="string"&&f in g)?nn(g[f],o):!1}function Gu(o,f){if(Pe(o))return!1;var g=typeof o;return g=="number"||g=="symbol"||g=="boolean"||o==null||Mr(o)?!0:ki.test(o)||!xs.test(o)||f!=null&&o in dt(f)}function _8(o){var f=typeof o;return f=="string"||f=="number"||f=="symbol"||f=="boolean"?o!=="__proto__":o===null}function Ku(o){var f=ha(o),g=I[f];if(typeof g!="function"||!(f in Ze.prototype))return!1;if(o===g)return!0;var b=Yu(g);return!!b&&o===b[0]}function v8(o){return!!yd&&yd in o}var g8=Uo?Bn:pf;function Is(o){var f=o&&o.constructor,g=typeof f=="function"&&f.prototype||Vi;return o===g}function yp(o){return o===o&&!Bt(o)}function Dp(o,f){return function(g){return g==null?!1:g[o]===f&&(f!==t||o in dt(g))}}function m8(o){var f=ma(o,function(b){return g.size===c&&g.clear(),b}),g=f.cache;return f}function x8(o,f){var g=o[1],b=f[1],S=g|b,$=S<(y|m|B),q=b==B&&g==D||b==B&&g==M&&o[7].length<=f[8]||b==(B|M)&&f[7].length<=f[8]&&g==D;if(!($||q))return o;b&y&&(o[2]=f[2],S|=g&y?0:w);var W=f[3];if(W){var K=o[3];o[3]=K?np(K,W,f[4]):W,o[4]=K?Hn(o[3],h):f[4]}return W=f[5],W&&(K=o[5],o[5]=K?ip(K,W,f[6]):W,o[6]=K?Hn(o[5],h):f[6]),W=f[7],W&&(o[7]=W),b&B&&(o[8]=o[8]==null?f[8]:ir(o[8],f[8])),o[9]==null&&(o[9]=f[9]),o[0]=f[0],o[1]=S,o}function y8(o){var f=[];if(o!=null)for(var g in dt(o))f.push(g);return f}function D8(o){return Ho.call(o)}function wp(o,f,g){return f=Ht(f===t?o.length-1:f,0),function(){for(var b=arguments,S=-1,$=Ht(b.length-f,0),q=re($);++S<$;)q[S]=b[f+S];S=-1;for(var W=re(f+1);++S<f;)W[S]=b[S];return W[f]=g(q),Cr(o,this,W)}}function Ep(o,f){return f.length<2?o:vi(o,Wr(f,0,-1))}function w8(o,f){for(var g=o.length,b=ir(f.length,g),S=xr(o);b--;){var $=f[b];o[b]=Fn($,g)?S[$]:t}return o}function Xu(o,f){if(!(f==="constructor"&&typeof o[f]=="function")&&f!="__proto__")return o[f]}var bp=Cp(Zd),$s=L2||function(o,f){return Qt.setTimeout(o,f)},Qu=Cp(jE);function Ap(o,f,g){var b=f+"";return Qu(o,d8(b,E8(c8(b),g)))}function Cp(o){var f=0,g=0;return function(){var b=q2(),S=R-(b-g);if(g=b,S>0){if(++f>=T)return arguments[0]}else f=0;return o.apply(t,arguments)}}function pa(o,f){var g=-1,b=o.length,S=b-1;for(f=f===t?b:f;++g<f;){var $=Iu(g,S),q=o[$];o[$]=o[g],o[g]=q}return o.length=f,o}var Fp=m8(function(o){var f=[];return o.charCodeAt(0)===46&&f.push(""),o.replace(ys,function(g,b,S,$){f.push(S?$.replace(G0,"$1"):b||g)}),f});function dn(o){if(typeof o=="string"||Mr(o))return o;var f=o+"";return f=="0"&&1/o==-G?"-0":f}function mi(o){if(o!=null){try{return Wo.call(o)}catch{}try{return o+""}catch{}}return""}function E8(o,f){return kr(Q,function(g){var b="_."+g[0];f&g[1]&&!Po(o,b)&&o.push(b)}),o.sort()}function Bp(o){if(o instanceof Ze)return o.clone();var f=new qr(o.__wrapped__,o.__chain__);return f.__actions__=xr(o.__actions__),f.__index__=o.__index__,f.__values__=o.__values__,f}function b8(o,f,g){(g?hr(o,f,g):f===t)?f=1:f=Ht(ze(f),0);var b=o==null?0:o.length;if(!b||f<1)return[];for(var S=0,$=0,q=re(Ko(b/f));S<b;)q[$++]=Wr(o,S,S+=f);return q}function A8(o){for(var f=-1,g=o==null?0:o.length,b=0,S=[];++f<g;){var $=o[f];$&&(S[b++]=$)}return S}function C8(){var o=arguments.length;if(!o)return[];for(var f=re(o-1),g=arguments[0],b=o;b--;)f[b-1]=arguments[b];return Wn(Pe(g)?xr(g):[g],Jt(f,1))}var F8=Ue(function(o,f){return It(o)?Ms(o,Jt(f,1,It,!0)):[]}),B8=Ue(function(o,f){var g=Hr(f);return It(g)&&(g=t),It(o)?Ms(o,Jt(f,1,It,!0),Me(g,2)):[]}),M8=Ue(function(o,f){var g=Hr(f);return It(g)&&(g=t),It(o)?Ms(o,Jt(f,1,It,!0),t,g):[]});function N8(o,f,g){var b=o==null?0:o.length;return b?(f=g||f===t?1:ze(f),Wr(o,f<0?0:f,b)):[]}function S8(o,f,g){var b=o==null?0:o.length;return b?(f=g||f===t?1:ze(f),f=b-f,Wr(o,0,f<0?0:f)):[]}function O8(o,f){return o&&o.length?oa(o,Me(f,3),!0,!0):[]}function T8(o,f){return o&&o.length?oa(o,Me(f,3),!0):[]}function I8(o,f,g,b){var S=o==null?0:o.length;return S?(g&&typeof g!="number"&&hr(o,f,g)&&(g=0,b=S),CE(o,f,g,b)):[]}function Mp(o,f,g){var b=o==null?0:o.length;if(!b)return-1;var S=g==null?0:ze(g);return S<0&&(S=Ht(b+S,0)),ko(o,Me(f,3),S)}function Np(o,f,g){var b=o==null?0:o.length;if(!b)return-1;var S=b-1;return g!==t&&(S=ze(g),S=g<0?Ht(b+S,0):ir(S,b-1)),ko(o,Me(f,3),S,!0)}function Sp(o){var f=o==null?0:o.length;return f?Jt(o,1):[]}function $8(o){var f=o==null?0:o.length;return f?Jt(o,G):[]}function R8(o,f){var g=o==null?0:o.length;return g?(f=f===t?1:ze(f),Jt(o,f)):[]}function L8(o){for(var f=-1,g=o==null?0:o.length,b={};++f<g;){var S=o[f];b[S[0]]=S[1]}return b}function Op(o){return o&&o.length?o[0]:t}function P8(o,f,g){var b=o==null?0:o.length;if(!b)return-1;var S=g==null?0:ze(g);return S<0&&(S=Ht(b+S,0)),Hi(o,f,S)}function k8(o){var f=o==null?0:o.length;return f?Wr(o,0,-1):[]}var z8=Ue(function(o){var f=At(o,ku);return f.length&&f[0]===o[0]?Mu(f):[]}),q8=Ue(function(o){var f=Hr(o),g=At(o,ku);return f===Hr(g)?f=t:g.pop(),g.length&&g[0]===o[0]?Mu(g,Me(f,2)):[]}),U8=Ue(function(o){var f=Hr(o),g=At(o,ku);return f=typeof f=="function"?f:t,f&&g.pop(),g.length&&g[0]===o[0]?Mu(g,t,f):[]});function W8(o,f){return o==null?"":k2.call(o,f)}function Hr(o){var f=o==null?0:o.length;return f?o[f-1]:t}function H8(o,f,g){var b=o==null?0:o.length;if(!b)return-1;var S=b;return g!==t&&(S=ze(g),S=S<0?Ht(b+S,0):ir(S,b-1)),f===f?E2(o,f,S):ko(o,hd,S,!0)}function j8(o,f){return o&&o.length?Wd(o,ze(f)):t}var Y8=Ue(Tp);function Tp(o,f){return o&&o.length&&f&&f.length?Tu(o,f):o}function Z8(o,f,g){return o&&o.length&&f&&f.length?Tu(o,f,Me(g,2)):o}function V8(o,f,g){return o&&o.length&&f&&f.length?Tu(o,f,t,g):o}var G8=Cn(function(o,f){var g=o==null?0:o.length,b=Au(o,f);return Yd(o,At(f,function(S){return Fn(S,g)?+S:S}).sort(rp)),b});function K8(o,f){var g=[];if(!(o&&o.length))return g;var b=-1,S=[],$=o.length;for(f=Me(f,3);++b<$;){var q=o[b];f(q,b,o)&&(g.push(q),S.push(b))}return Yd(o,S),g}function Ju(o){return o==null?o:W2.call(o)}function X8(o,f,g){var b=o==null?0:o.length;return b?(g&&typeof g!="number"&&hr(o,f,g)?(f=0,g=b):(f=f==null?0:ze(f),g=g===t?b:ze(g)),Wr(o,f,g)):[]}function Q8(o,f){return sa(o,f)}function J8(o,f,g){return Ru(o,f,Me(g,2))}function eb(o,f){var g=o==null?0:o.length;if(g){var b=sa(o,f);if(b<g&&nn(o[b],f))return b}return-1}function tb(o,f){return sa(o,f,!0)}function rb(o,f,g){return Ru(o,f,Me(g,2),!0)}function nb(o,f){var g=o==null?0:o.length;if(g){var b=sa(o,f,!0)-1;if(nn(o[b],f))return b}return-1}function ib(o){return o&&o.length?Vd(o):[]}function sb(o,f){return o&&o.length?Vd(o,Me(f,2)):[]}function ob(o){var f=o==null?0:o.length;return f?Wr(o,1,f):[]}function ab(o,f,g){return o&&o.length?(f=g||f===t?1:ze(f),Wr(o,0,f<0?0:f)):[]}function ub(o,f,g){var b=o==null?0:o.length;return b?(f=g||f===t?1:ze(f),f=b-f,Wr(o,f<0?0:f,b)):[]}function fb(o,f){return o&&o.length?oa(o,Me(f,3),!1,!0):[]}function cb(o,f){return o&&o.length?oa(o,Me(f,3)):[]}var lb=Ue(function(o){return Zn(Jt(o,1,It,!0))}),hb=Ue(function(o){var f=Hr(o);return It(f)&&(f=t),Zn(Jt(o,1,It,!0),Me(f,2))}),db=Ue(function(o){var f=Hr(o);return f=typeof f=="function"?f:t,Zn(Jt(o,1,It,!0),t,f)});function pb(o){return o&&o.length?Zn(o):[]}function _b(o,f){return o&&o.length?Zn(o,Me(f,2)):[]}function vb(o,f){return f=typeof f=="function"?f:t,o&&o.length?Zn(o,t,f):[]}function ef(o){if(!(o&&o.length))return[];var f=0;return o=Un(o,function(g){if(It(g))return f=Ht(g.length,f),!0}),gu(f,function(g){return At(o,pu(g))})}function Ip(o,f){if(!(o&&o.length))return[];var g=ef(o);return f==null?g:At(g,function(b){return Cr(f,t,b)})}var gb=Ue(function(o,f){return It(o)?Ms(o,f):[]}),mb=Ue(function(o){return Pu(Un(o,It))}),xb=Ue(function(o){var f=Hr(o);return It(f)&&(f=t),Pu(Un(o,It),Me(f,2))}),yb=Ue(function(o){var f=Hr(o);return f=typeof f=="function"?f:t,Pu(Un(o,It),t,f)}),Db=Ue(ef);function wb(o,f){return Qd(o||[],f||[],Bs)}function Eb(o,f){return Qd(o||[],f||[],Os)}var bb=Ue(function(o){var f=o.length,g=f>1?o[f-1]:t;return g=typeof g=="function"?(o.pop(),g):t,Ip(o,g)});function $p(o){var f=I(o);return f.__chain__=!0,f}function Ab(o,f){return f(o),o}function _a(o,f){return f(o)}var Cb=Cn(function(o){var f=o.length,g=f?o[0]:0,b=this.__wrapped__,S=function($){return Au($,o)};return f>1||this.__actions__.length||!(b instanceof Ze)||!Fn(g)?this.thru(S):(b=b.slice(g,+g+(f?1:0)),b.__actions__.push({func:_a,args:[S],thisArg:t}),new qr(b,this.__chain__).thru(function($){return f&&!$.length&&$.push(t),$}))});function Fb(){return $p(this)}function Bb(){return new qr(this.value(),this.__chain__)}function Mb(){this.__values__===t&&(this.__values__=Gp(this.value()));var o=this.__index__>=this.__values__.length,f=o?t:this.__values__[this.__index__++];return{done:o,value:f}}function Nb(){return this}function Sb(o){for(var f,g=this;g instanceof ea;){var b=Bp(g);b.__index__=0,b.__values__=t,f?S.__wrapped__=b:f=b;var S=b;g=g.__wrapped__}return S.__wrapped__=o,f}function Ob(){var o=this.__wrapped__;if(o instanceof Ze){var f=o;return this.__actions__.length&&(f=new Ze(this)),f=f.reverse(),f.__actions__.push({func:_a,args:[Ju],thisArg:t}),new qr(f,this.__chain__)}return this.thru(Ju)}function Tb(){return Xd(this.__wrapped__,this.__actions__)}var Ib=aa(function(o,f,g){ft.call(o,g)?++o[g]:bn(o,g,1)});function $b(o,f,g){var b=Pe(o)?cd:AE;return g&&hr(o,f,g)&&(f=t),b(o,Me(f,3))}function Rb(o,f){var g=Pe(o)?Un:Id;return g(o,Me(f,3))}var Lb=up(Mp),Pb=up(Np);function kb(o,f){return Jt(va(o,f),1)}function zb(o,f){return Jt(va(o,f),G)}function qb(o,f,g){return g=g===t?1:ze(g),Jt(va(o,f),g)}function Rp(o,f){var g=Pe(o)?kr:Yn;return g(o,Me(f,3))}function Lp(o,f){var g=Pe(o)?o2:Td;return g(o,Me(f,3))}var Ub=aa(function(o,f,g){ft.call(o,g)?o[g].push(f):bn(o,g,[f])});function Wb(o,f,g,b){o=yr(o)?o:rs(o),g=g&&!b?ze(g):0;var S=o.length;return g<0&&(g=Ht(S+g,0)),Da(o)?g<=S&&o.indexOf(f,g)>-1:!!S&&Hi(o,f,g)>-1}var Hb=Ue(function(o,f,g){var b=-1,S=typeof f=="function",$=yr(o)?re(o.length):[];return Yn(o,function(q){$[++b]=S?Cr(f,q,g):Ns(q,f,g)}),$}),jb=aa(function(o,f,g){bn(o,g,f)});function va(o,f){var g=Pe(o)?At:zd;return g(o,Me(f,3))}function Yb(o,f,g,b){return o==null?[]:(Pe(f)||(f=f==null?[]:[f]),g=b?t:g,Pe(g)||(g=g==null?[]:[g]),Hd(o,f,g))}var Zb=aa(function(o,f,g){o[g?0:1].push(f)},function(){return[[],[]]});function Vb(o,f,g){var b=Pe(o)?hu:pd,S=arguments.length<3;return b(o,Me(f,4),g,S,Yn)}function Gb(o,f,g){var b=Pe(o)?a2:pd,S=arguments.length<3;return b(o,Me(f,4),g,S,Td)}function Kb(o,f){var g=Pe(o)?Un:Id;return g(o,xa(Me(f,3)))}function Xb(o){var f=Pe(o)?Md:WE;return f(o)}function Qb(o,f,g){(g?hr(o,f,g):f===t)?f=1:f=ze(f);var b=Pe(o)?yE:HE;return b(o,f)}function Jb(o){var f=Pe(o)?DE:YE;return f(o)}function e4(o){if(o==null)return 0;if(yr(o))return Da(o)?Yi(o):o.length;var f=sr(o);return f==Re||f==yt?o.size:Su(o).length}function t4(o,f,g){var b=Pe(o)?du:ZE;return g&&hr(o,f,g)&&(f=t),b(o,Me(f,3))}var r4=Ue(function(o,f){if(o==null)return[];var g=f.length;return g>1&&hr(o,f[0],f[1])?f=[]:g>2&&hr(f[0],f[1],f[2])&&(f=[f[0]]),Hd(o,Jt(f,1),[])}),ga=R2||function(){return Qt.Date.now()};function n4(o,f){if(typeof f!="function")throw new zr(a);return o=ze(o),function(){if(--o<1)return f.apply(this,arguments)}}function Pp(o,f,g){return f=g?t:f,f=o&&f==null?o.length:f,An(o,B,t,t,t,t,f)}function kp(o,f){var g;if(typeof f!="function")throw new zr(a);return o=ze(o),function(){return--o>0&&(g=f.apply(this,arguments)),o<=1&&(f=t),g}}var tf=Ue(function(o,f,g){var b=y;if(g.length){var S=Hn(g,es(tf));b|=E}return An(o,b,f,g,S)}),zp=Ue(function(o,f,g){var b=y|m;if(g.length){var S=Hn(g,es(zp));b|=E}return An(f,b,o,g,S)});function qp(o,f,g){f=g?t:f;var b=An(o,D,t,t,t,t,t,f);return b.placeholder=qp.placeholder,b}function Up(o,f,g){f=g?t:f;var b=An(o,C,t,t,t,t,t,f);return b.placeholder=Up.placeholder,b}function Wp(o,f,g){var b,S,$,q,W,K,oe=0,ae=!1,ce=!1,ge=!0;if(typeof o!="function")throw new zr(a);f=jr(f)||0,Bt(g)&&(ae=!!g.leading,ce="maxWait"in g,$=ce?Ht(jr(g.maxWait)||0,f):$,ge="trailing"in g?!!g.trailing:ge);function Ae($t){var sn=b,Nn=S;return b=S=t,oe=$t,q=o.apply(Nn,sn),q}function Ne($t){return oe=$t,W=$s(He,f),ae?Ae($t):q}function qe($t){var sn=$t-K,Nn=$t-oe,u1=f-sn;return ce?ir(u1,$-Nn):u1}function Se($t){var sn=$t-K,Nn=$t-oe;return K===t||sn>=f||sn<0||ce&&Nn>=$}function He(){var $t=ga();if(Se($t))return Ke($t);W=$s(He,qe($t))}function Ke($t){return W=t,ge&&b?Ae($t):(b=S=t,q)}function Nr(){W!==t&&Jd(W),oe=0,b=K=S=W=t}function dr(){return W===t?q:Ke(ga())}function Sr(){var $t=ga(),sn=Se($t);if(b=arguments,S=this,K=$t,sn){if(W===t)return Ne(K);if(ce)return Jd(W),W=$s(He,f),Ae(K)}return W===t&&(W=$s(He,f)),q}return Sr.cancel=Nr,Sr.flush=dr,Sr}var i4=Ue(function(o,f){return Od(o,1,f)}),s4=Ue(function(o,f,g){return Od(o,jr(f)||0,g)});function o4(o){return An(o,O)}function ma(o,f){if(typeof o!="function"||f!=null&&typeof f!="function")throw new zr(a);var g=function(){var b=arguments,S=f?f.apply(this,b):b[0],$=g.cache;if($.has(S))return $.get(S);var q=o.apply(this,b);return g.cache=$.set(S,q)||$,q};return g.cache=new(ma.Cache||En),g}ma.Cache=En;function xa(o){if(typeof o!="function")throw new zr(a);return function(){var f=arguments;switch(f.length){case 0:return!o.call(this);case 1:return!o.call(this,f[0]);case 2:return!o.call(this,f[0],f[1]);case 3:return!o.call(this,f[0],f[1],f[2])}return!o.apply(this,f)}}function a4(o){return kp(2,o)}var u4=VE(function(o,f){f=f.length==1&&Pe(f[0])?At(f[0],Fr(Me())):At(Jt(f,1),Fr(Me()));var g=f.length;return Ue(function(b){for(var S=-1,$=ir(b.length,g);++S<$;)b[S]=f[S].call(this,b[S]);return Cr(o,this,b)})}),rf=Ue(function(o,f){var g=Hn(f,es(rf));return An(o,E,t,f,g)}),Hp=Ue(function(o,f){var g=Hn(f,es(Hp));return An(o,F,t,f,g)}),f4=Cn(function(o,f){return An(o,M,t,t,t,f)});function c4(o,f){if(typeof o!="function")throw new zr(a);return f=f===t?f:ze(f),Ue(o,f)}function l4(o,f){if(typeof o!="function")throw new zr(a);return f=f==null?0:Ht(ze(f),0),Ue(function(g){var b=g[f],S=Gn(g,0,f);return b&&Wn(S,b),Cr(o,this,S)})}function h4(o,f,g){var b=!0,S=!0;if(typeof o!="function")throw new zr(a);return Bt(g)&&(b="leading"in g?!!g.leading:b,S="trailing"in g?!!g.trailing:S),Wp(o,f,{leading:b,maxWait:f,trailing:S})}function d4(o){return Pp(o,1)}function p4(o,f){return rf(zu(f),o)}function _4(){if(!arguments.length)return[];var o=arguments[0];return Pe(o)?o:[o]}function v4(o){return Ur(o,v)}function g4(o,f){return f=typeof f=="function"?f:t,Ur(o,v,f)}function m4(o){return Ur(o,d|v)}function x4(o,f){return f=typeof f=="function"?f:t,Ur(o,d|v,f)}function y4(o,f){return f==null||Sd(o,f,Yt(f))}function nn(o,f){return o===f||o!==o&&f!==f}var D4=la(Bu),w4=la(function(o,f){return o>=f}),xi=Ld(function(){return arguments}())?Ld:function(o){return Nt(o)&&ft.call(o,"callee")&&!Ed.call(o,"callee")},Pe=re.isArray,E4=id?Fr(id):SE;function yr(o){return o!=null&&ya(o.length)&&!Bn(o)}function It(o){return Nt(o)&&yr(o)}function b4(o){return o===!0||o===!1||Nt(o)&&lr(o)==Ee}var Kn=P2||pf,A4=sd?Fr(sd):OE;function C4(o){return Nt(o)&&o.nodeType===1&&!Rs(o)}function F4(o){if(o==null)return!0;if(yr(o)&&(Pe(o)||typeof o=="string"||typeof o.splice=="function"||Kn(o)||ts(o)||xi(o)))return!o.length;var f=sr(o);if(f==Re||f==yt)return!o.size;if(Is(o))return!Su(o).length;for(var g in o)if(ft.call(o,g))return!1;return!0}function B4(o,f){return Ss(o,f)}function M4(o,f,g){g=typeof g=="function"?g:t;var b=g?g(o,f):t;return b===t?Ss(o,f,t,g):!!b}function nf(o){if(!Nt(o))return!1;var f=lr(o);return f==nt||f==Fe||typeof o.message=="string"&&typeof o.name=="string"&&!Rs(o)}function N4(o){return typeof o=="number"&&Ad(o)}function Bn(o){if(!Bt(o))return!1;var f=lr(o);return f==Ye||f==Te||f==we||f==Lr}function jp(o){return typeof o=="number"&&o==ze(o)}function ya(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=H}function Bt(o){var f=typeof o;return o!=null&&(f=="object"||f=="function")}function Nt(o){return o!=null&&typeof o=="object"}var Yp=od?Fr(od):IE;function S4(o,f){return o===f||Nu(o,f,Zu(f))}function O4(o,f,g){return g=typeof g=="function"?g:t,Nu(o,f,Zu(f),g)}function T4(o){return Zp(o)&&o!=+o}function I4(o){if(g8(o))throw new Le(i);return Pd(o)}function $4(o){return o===null}function R4(o){return o==null}function Zp(o){return typeof o=="number"||Nt(o)&&lr(o)==xt}function Rs(o){if(!Nt(o)||lr(o)!=bt)return!1;var f=Zo(o);if(f===null)return!0;var g=ft.call(f,"constructor")&&f.constructor;return typeof g=="function"&&g instanceof g&&Wo.call(g)==O2}var sf=ad?Fr(ad):$E;function L4(o){return jp(o)&&o>=-H&&o<=H}var Vp=ud?Fr(ud):RE;function Da(o){return typeof o=="string"||!Pe(o)&&Nt(o)&&lr(o)==Ot}function Mr(o){return typeof o=="symbol"||Nt(o)&&lr(o)==P}var ts=fd?Fr(fd):LE;function P4(o){return o===t}function k4(o){return Nt(o)&&sr(o)==J}function z4(o){return Nt(o)&&lr(o)==ie}var q4=la(Ou),U4=la(function(o,f){return o<=f});function Gp(o){if(!o)return[];if(yr(o))return Da(o)?tn(o):xr(o);if(Es&&o[Es])return y2(o[Es]());var f=sr(o),g=f==Re?xu:f==yt?zo:rs;return g(o)}function Mn(o){if(!o)return o===0?o:0;if(o=jr(o),o===G||o===-G){var f=o<0?-1:1;return f*ee}return o===o?o:0}function ze(o){var f=Mn(o),g=f%1;return f===f?g?f-g:f:0}function Kp(o){return o?_i(ze(o),0,j):0}function jr(o){if(typeof o=="number")return o;if(Mr(o))return te;if(Bt(o)){var f=typeof o.valueOf=="function"?o.valueOf():o;o=Bt(f)?f+"":f}if(typeof o!="string")return o===0?o:+o;o=_d(o);var g=Q0.test(o);return g||eu.test(o)?n2(o.slice(2),g?2:8):X0.test(o)?te:+o}function Xp(o){return hn(o,Dr(o))}function W4(o){return o?_i(ze(o),-H,H):o===0?o:0}function at(o){return o==null?"":Br(o)}var H4=Qi(function(o,f){if(Is(f)||yr(f)){hn(f,Yt(f),o);return}for(var g in f)ft.call(f,g)&&Bs(o,g,f[g])}),Qp=Qi(function(o,f){hn(f,Dr(f),o)}),wa=Qi(function(o,f,g,b){hn(f,Dr(f),o,b)}),j4=Qi(function(o,f,g,b){hn(f,Yt(f),o,b)}),Y4=Cn(Au);function Z4(o,f){var g=Xi(o);return f==null?g:Nd(g,f)}var V4=Ue(function(o,f){o=dt(o);var g=-1,b=f.length,S=b>2?f[2]:t;for(S&&hr(f[0],f[1],S)&&(b=1);++g<b;)for(var $=f[g],q=Dr($),W=-1,K=q.length;++W<K;){var oe=q[W],ae=o[oe];(ae===t||nn(ae,Vi[oe])&&!ft.call(o,oe))&&(o[oe]=$[oe])}return o}),G4=Ue(function(o){return o.push(t,_p),Cr(Jp,t,o)});function K4(o,f){return ld(o,Me(f,3),ln)}function X4(o,f){return ld(o,Me(f,3),Fu)}function Q4(o,f){return o==null?o:Cu(o,Me(f,3),Dr)}function J4(o,f){return o==null?o:$d(o,Me(f,3),Dr)}function eA(o,f){return o&&ln(o,Me(f,3))}function tA(o,f){return o&&Fu(o,Me(f,3))}function rA(o){return o==null?[]:na(o,Yt(o))}function nA(o){return o==null?[]:na(o,Dr(o))}function of(o,f,g){var b=o==null?t:vi(o,f);return b===t?g:b}function iA(o,f){return o!=null&&mp(o,f,FE)}function af(o,f){return o!=null&&mp(o,f,BE)}var sA=cp(function(o,f,g){f!=null&&typeof f.toString!="function"&&(f=Ho.call(f)),o[f]=g},ff(wr)),oA=cp(function(o,f,g){f!=null&&typeof f.toString!="function"&&(f=Ho.call(f)),ft.call(o,f)?o[f].push(g):o[f]=[g]},Me),aA=Ue(Ns);function Yt(o){return yr(o)?Bd(o):Su(o)}function Dr(o){return yr(o)?Bd(o,!0):PE(o)}function uA(o,f){var g={};return f=Me(f,3),ln(o,function(b,S,$){bn(g,f(b,S,$),b)}),g}function fA(o,f){var g={};return f=Me(f,3),ln(o,function(b,S,$){bn(g,S,f(b,S,$))}),g}var cA=Qi(function(o,f,g){ia(o,f,g)}),Jp=Qi(function(o,f,g,b){ia(o,f,g,b)}),lA=Cn(function(o,f){var g={};if(o==null)return g;var b=!1;f=At(f,function($){return $=Vn($,o),b||(b=$.length>1),$}),hn(o,ju(o),g),b&&(g=Ur(g,d|p|v,s8));for(var S=f.length;S--;)Lu(g,f[S]);return g});function hA(o,f){return e1(o,xa(Me(f)))}var dA=Cn(function(o,f){return o==null?{}:zE(o,f)});function e1(o,f){if(o==null)return{};var g=At(ju(o),function(b){return[b]});return f=Me(f),jd(o,g,function(b,S){return f(b,S[0])})}function pA(o,f,g){f=Vn(f,o);var b=-1,S=f.length;for(S||(S=1,o=t);++b<S;){var $=o==null?t:o[dn(f[b])];$===t&&(b=S,$=g),o=Bn($)?$.call(o):$}return o}function _A(o,f,g){return o==null?o:Os(o,f,g)}function vA(o,f,g,b){return b=typeof b=="function"?b:t,o==null?o:Os(o,f,g,b)}var t1=dp(Yt),r1=dp(Dr);function gA(o,f,g){var b=Pe(o),S=b||Kn(o)||ts(o);if(f=Me(f,4),g==null){var $=o&&o.constructor;S?g=b?new $:[]:Bt(o)?g=Bn($)?Xi(Zo(o)):{}:g={}}return(S?kr:ln)(o,function(q,W,K){return f(g,q,W,K)}),g}function mA(o,f){return o==null?!0:Lu(o,f)}function xA(o,f,g){return o==null?o:Kd(o,f,zu(g))}function yA(o,f,g,b){return b=typeof b=="function"?b:t,o==null?o:Kd(o,f,zu(g),b)}function rs(o){return o==null?[]:mu(o,Yt(o))}function DA(o){return o==null?[]:mu(o,Dr(o))}function wA(o,f,g){return g===t&&(g=f,f=t),g!==t&&(g=jr(g),g=g===g?g:0),f!==t&&(f=jr(f),f=f===f?f:0),_i(jr(o),f,g)}function EA(o,f,g){return f=Mn(f),g===t?(g=f,f=0):g=Mn(g),o=jr(o),ME(o,f,g)}function bA(o,f,g){if(g&&typeof g!="boolean"&&hr(o,f,g)&&(f=g=t),g===t&&(typeof f=="boolean"?(g=f,f=t):typeof o=="boolean"&&(g=o,o=t)),o===t&&f===t?(o=0,f=1):(o=Mn(o),f===t?(f=o,o=0):f=Mn(f)),o>f){var b=o;o=f,f=b}if(g||o%1||f%1){var S=Cd();return ir(o+S*(f-o+r2("1e-"+((S+"").length-1))),f)}return Iu(o,f)}var AA=Ji(function(o,f,g){return f=f.toLowerCase(),o+(g?n1(f):f)});function n1(o){return uf(at(o).toLowerCase())}function i1(o){return o=at(o),o&&o.replace(ru,_2).replace(Yw,"")}function CA(o,f,g){o=at(o),f=Br(f);var b=o.length;g=g===t?b:_i(ze(g),0,b);var S=g;return g-=f.length,g>=0&&o.slice(g,S)==f}function FA(o){return o=at(o),o&&gs.test(o)?o.replace(fi,v2):o}function BA(o){return o=at(o),o&&Xt.test(o)?o.replace(zn,"\\$&"):o}var MA=Ji(function(o,f,g){return o+(g?"-":"")+f.toLowerCase()}),NA=Ji(function(o,f,g){return o+(g?" ":"")+f.toLowerCase()}),SA=ap("toLowerCase");function OA(o,f,g){o=at(o),f=ze(f);var b=f?Yi(o):0;if(!f||b>=f)return o;var S=(f-b)/2;return ca(Xo(S),g)+o+ca(Ko(S),g)}function TA(o,f,g){o=at(o),f=ze(f);var b=f?Yi(o):0;return f&&b<f?o+ca(f-b,g):o}function IA(o,f,g){o=at(o),f=ze(f);var b=f?Yi(o):0;return f&&b<f?ca(f-b,g)+o:o}function $A(o,f,g){return g||f==null?f=0:f&&(f=+f),U2(at(o).replace(mr,""),f||0)}function RA(o,f,g){return(g?hr(o,f,g):f===t)?f=1:f=ze(f),$u(at(o),f)}function LA(){var o=arguments,f=at(o[0]);return o.length<3?f:f.replace(o[1],o[2])}var PA=Ji(function(o,f,g){return o+(g?"_":"")+f.toLowerCase()});function kA(o,f,g){return g&&typeof g!="number"&&hr(o,f,g)&&(f=g=t),g=g===t?j:g>>>0,g?(o=at(o),o&&(typeof f=="string"||f!=null&&!sf(f))&&(f=Br(f),!f&&ji(o))?Gn(tn(o),0,g):o.split(f,g)):[]}var zA=Ji(function(o,f,g){return o+(g?" ":"")+uf(f)});function qA(o,f,g){return o=at(o),g=g==null?0:_i(ze(g),0,o.length),f=Br(f),o.slice(g,g+f.length)==f}function UA(o,f,g){var b=I.templateSettings;g&&hr(o,f,g)&&(f=t),o=at(o),f=wa({},f,b,pp);var S=wa({},f.imports,b.imports,pp),$=Yt(S),q=mu(S,$),W,K,oe=0,ae=f.interpolate||qi,ce="__p += '",ge=yu((f.escape||qi).source+"|"+ae.source+"|"+(ae===Pi?K0:qi).source+"|"+(f.evaluate||qi).source+"|$","g"),Ae="//# sourceURL="+(ft.call(f,"sourceURL")?(f.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Xw+"]")+`
11
+ `;o.replace(ge,function(Se,He,Ke,Nr,dr,Sr){return Ke||(Ke=Nr),ce+=o.slice(oe,Sr).replace(ci,g2),He&&(W=!0,ce+=`' +
12
+ __e(`+He+`) +
13
+ '`),dr&&(K=!0,ce+=`';
14
+ `+dr+`;
15
+ __p += '`),Ke&&(ce+=`' +
16
+ ((__t = (`+Ke+`)) == null ? '' : __t) +
17
+ '`),oe=Sr+Se.length,Se}),ce+=`';
18
+ `;var Ne=ft.call(f,"variable")&&f.variable;if(!Ne)ce=`with (obj) {
19
+ `+ce+`
20
+ }
21
+ `;else if(V0.test(Ne))throw new Le(u);ce=(K?ce.replace(rr,""):ce).replace(cr,"$1").replace(en,"$1;"),ce="function("+(Ne||"obj")+`) {
22
+ `+(Ne?"":`obj || (obj = {});
23
+ `)+"var __t, __p = ''"+(W?", __e = _.escape":"")+(K?`, __j = Array.prototype.join;
24
+ function print() { __p += __j.call(arguments, '') }
25
+ `:`;
26
+ `)+ce+`return __p
27
+ }`;var qe=o1(function(){return st($,Ae+"return "+ce).apply(t,q)});if(qe.source=ce,nf(qe))throw qe;return qe}function WA(o){return at(o).toLowerCase()}function HA(o){return at(o).toUpperCase()}function jA(o,f,g){if(o=at(o),o&&(g||f===t))return _d(o);if(!o||!(f=Br(f)))return o;var b=tn(o),S=tn(f),$=vd(b,S),q=gd(b,S)+1;return Gn(b,$,q).join("")}function YA(o,f,g){if(o=at(o),o&&(g||f===t))return o.slice(0,xd(o)+1);if(!o||!(f=Br(f)))return o;var b=tn(o),S=gd(b,tn(f))+1;return Gn(b,0,S).join("")}function ZA(o,f,g){if(o=at(o),o&&(g||f===t))return o.replace(mr,"");if(!o||!(f=Br(f)))return o;var b=tn(o),S=vd(b,tn(f));return Gn(b,S).join("")}function VA(o,f){var g=A,b=N;if(Bt(f)){var S="separator"in f?f.separator:S;g="length"in f?ze(f.length):g,b="omission"in f?Br(f.omission):b}o=at(o);var $=o.length;if(ji(o)){var q=tn(o);$=q.length}if(g>=$)return o;var W=g-Yi(b);if(W<1)return b;var K=q?Gn(q,0,W).join(""):o.slice(0,W);if(S===t)return K+b;if(q&&(W+=K.length-W),sf(S)){if(o.slice(W).search(S)){var oe,ae=K;for(S.global||(S=yu(S.source,at($o.exec(S))+"g")),S.lastIndex=0;oe=S.exec(ae);)var ce=oe.index;K=K.slice(0,ce===t?W:ce)}}else if(o.indexOf(Br(S),W)!=W){var ge=K.lastIndexOf(S);ge>-1&&(K=K.slice(0,ge))}return K+b}function GA(o){return o=at(o),o&&vs.test(o)?o.replace(Dn,b2):o}var KA=Ji(function(o,f,g){return o+(g?" ":"")+f.toUpperCase()}),uf=ap("toUpperCase");function s1(o,f,g){return o=at(o),f=g?t:f,f===t?x2(o)?F2(o):c2(o):o.match(f)||[]}var o1=Ue(function(o,f){try{return Cr(o,t,f)}catch(g){return nf(g)?g:new Le(g)}}),XA=Cn(function(o,f){return kr(f,function(g){g=dn(g),bn(o,g,tf(o[g],o))}),o});function QA(o){var f=o==null?0:o.length,g=Me();return o=f?At(o,function(b){if(typeof b[1]!="function")throw new zr(a);return[g(b[0]),b[1]]}):[],Ue(function(b){for(var S=-1;++S<f;){var $=o[S];if(Cr($[0],this,b))return Cr($[1],this,b)}})}function JA(o){return bE(Ur(o,d))}function ff(o){return function(){return o}}function eC(o,f){return o==null||o!==o?f:o}var tC=fp(),rC=fp(!0);function wr(o){return o}function cf(o){return kd(typeof o=="function"?o:Ur(o,d))}function nC(o){return qd(Ur(o,d))}function iC(o,f){return Ud(o,Ur(f,d))}var sC=Ue(function(o,f){return function(g){return Ns(g,o,f)}}),oC=Ue(function(o,f){return function(g){return Ns(o,g,f)}});function lf(o,f,g){var b=Yt(f),S=na(f,b);g==null&&!(Bt(f)&&(S.length||!b.length))&&(g=f,f=o,o=this,S=na(f,Yt(f)));var $=!(Bt(g)&&"chain"in g)||!!g.chain,q=Bn(o);return kr(S,function(W){var K=f[W];o[W]=K,q&&(o.prototype[W]=function(){var oe=this.__chain__;if($||oe){var ae=o(this.__wrapped__),ce=ae.__actions__=xr(this.__actions__);return ce.push({func:K,args:arguments,thisArg:o}),ae.__chain__=oe,ae}return K.apply(o,Wn([this.value()],arguments))})}),o}function aC(){return Qt._===this&&(Qt._=T2),this}function hf(){}function uC(o){return o=ze(o),Ue(function(f){return Wd(f,o)})}var fC=Uu(At),cC=Uu(cd),lC=Uu(du);function a1(o){return Gu(o)?pu(dn(o)):qE(o)}function hC(o){return function(f){return o==null?t:vi(o,f)}}var dC=lp(),pC=lp(!0);function df(){return[]}function pf(){return!1}function _C(){return{}}function vC(){return""}function gC(){return!0}function mC(o,f){if(o=ze(o),o<1||o>H)return[];var g=j,b=ir(o,j);f=Me(f),o-=j;for(var S=gu(b,f);++g<o;)f(g);return S}function xC(o){return Pe(o)?At(o,dn):Mr(o)?[o]:xr(Fp(at(o)))}function yC(o){var f=++S2;return at(o)+f}var DC=fa(function(o,f){return o+f},0),wC=Wu("ceil"),EC=fa(function(o,f){return o/f},1),bC=Wu("floor");function AC(o){return o&&o.length?ra(o,wr,Bu):t}function CC(o,f){return o&&o.length?ra(o,Me(f,2),Bu):t}function FC(o){return dd(o,wr)}function BC(o,f){return dd(o,Me(f,2))}function MC(o){return o&&o.length?ra(o,wr,Ou):t}function NC(o,f){return o&&o.length?ra(o,Me(f,2),Ou):t}var SC=fa(function(o,f){return o*f},1),OC=Wu("round"),TC=fa(function(o,f){return o-f},0);function IC(o){return o&&o.length?vu(o,wr):0}function $C(o,f){return o&&o.length?vu(o,Me(f,2)):0}return I.after=n4,I.ary=Pp,I.assign=H4,I.assignIn=Qp,I.assignInWith=wa,I.assignWith=j4,I.at=Y4,I.before=kp,I.bind=tf,I.bindAll=XA,I.bindKey=zp,I.castArray=_4,I.chain=$p,I.chunk=b8,I.compact=A8,I.concat=C8,I.cond=QA,I.conforms=JA,I.constant=ff,I.countBy=Ib,I.create=Z4,I.curry=qp,I.curryRight=Up,I.debounce=Wp,I.defaults=V4,I.defaultsDeep=G4,I.defer=i4,I.delay=s4,I.difference=F8,I.differenceBy=B8,I.differenceWith=M8,I.drop=N8,I.dropRight=S8,I.dropRightWhile=O8,I.dropWhile=T8,I.fill=I8,I.filter=Rb,I.flatMap=kb,I.flatMapDeep=zb,I.flatMapDepth=qb,I.flatten=Sp,I.flattenDeep=$8,I.flattenDepth=R8,I.flip=o4,I.flow=tC,I.flowRight=rC,I.fromPairs=L8,I.functions=rA,I.functionsIn=nA,I.groupBy=Ub,I.initial=k8,I.intersection=z8,I.intersectionBy=q8,I.intersectionWith=U8,I.invert=sA,I.invertBy=oA,I.invokeMap=Hb,I.iteratee=cf,I.keyBy=jb,I.keys=Yt,I.keysIn=Dr,I.map=va,I.mapKeys=uA,I.mapValues=fA,I.matches=nC,I.matchesProperty=iC,I.memoize=ma,I.merge=cA,I.mergeWith=Jp,I.method=sC,I.methodOf=oC,I.mixin=lf,I.negate=xa,I.nthArg=uC,I.omit=lA,I.omitBy=hA,I.once=a4,I.orderBy=Yb,I.over=fC,I.overArgs=u4,I.overEvery=cC,I.overSome=lC,I.partial=rf,I.partialRight=Hp,I.partition=Zb,I.pick=dA,I.pickBy=e1,I.property=a1,I.propertyOf=hC,I.pull=Y8,I.pullAll=Tp,I.pullAllBy=Z8,I.pullAllWith=V8,I.pullAt=G8,I.range=dC,I.rangeRight=pC,I.rearg=f4,I.reject=Kb,I.remove=K8,I.rest=c4,I.reverse=Ju,I.sampleSize=Qb,I.set=_A,I.setWith=vA,I.shuffle=Jb,I.slice=X8,I.sortBy=r4,I.sortedUniq=ib,I.sortedUniqBy=sb,I.split=kA,I.spread=l4,I.tail=ob,I.take=ab,I.takeRight=ub,I.takeRightWhile=fb,I.takeWhile=cb,I.tap=Ab,I.throttle=h4,I.thru=_a,I.toArray=Gp,I.toPairs=t1,I.toPairsIn=r1,I.toPath=xC,I.toPlainObject=Xp,I.transform=gA,I.unary=d4,I.union=lb,I.unionBy=hb,I.unionWith=db,I.uniq=pb,I.uniqBy=_b,I.uniqWith=vb,I.unset=mA,I.unzip=ef,I.unzipWith=Ip,I.update=xA,I.updateWith=yA,I.values=rs,I.valuesIn=DA,I.without=gb,I.words=s1,I.wrap=p4,I.xor=mb,I.xorBy=xb,I.xorWith=yb,I.zip=Db,I.zipObject=wb,I.zipObjectDeep=Eb,I.zipWith=bb,I.entries=t1,I.entriesIn=r1,I.extend=Qp,I.extendWith=wa,lf(I,I),I.add=DC,I.attempt=o1,I.camelCase=AA,I.capitalize=n1,I.ceil=wC,I.clamp=wA,I.clone=v4,I.cloneDeep=m4,I.cloneDeepWith=x4,I.cloneWith=g4,I.conformsTo=y4,I.deburr=i1,I.defaultTo=eC,I.divide=EC,I.endsWith=CA,I.eq=nn,I.escape=FA,I.escapeRegExp=BA,I.every=$b,I.find=Lb,I.findIndex=Mp,I.findKey=K4,I.findLast=Pb,I.findLastIndex=Np,I.findLastKey=X4,I.floor=bC,I.forEach=Rp,I.forEachRight=Lp,I.forIn=Q4,I.forInRight=J4,I.forOwn=eA,I.forOwnRight=tA,I.get=of,I.gt=D4,I.gte=w4,I.has=iA,I.hasIn=af,I.head=Op,I.identity=wr,I.includes=Wb,I.indexOf=P8,I.inRange=EA,I.invoke=aA,I.isArguments=xi,I.isArray=Pe,I.isArrayBuffer=E4,I.isArrayLike=yr,I.isArrayLikeObject=It,I.isBoolean=b4,I.isBuffer=Kn,I.isDate=A4,I.isElement=C4,I.isEmpty=F4,I.isEqual=B4,I.isEqualWith=M4,I.isError=nf,I.isFinite=N4,I.isFunction=Bn,I.isInteger=jp,I.isLength=ya,I.isMap=Yp,I.isMatch=S4,I.isMatchWith=O4,I.isNaN=T4,I.isNative=I4,I.isNil=R4,I.isNull=$4,I.isNumber=Zp,I.isObject=Bt,I.isObjectLike=Nt,I.isPlainObject=Rs,I.isRegExp=sf,I.isSafeInteger=L4,I.isSet=Vp,I.isString=Da,I.isSymbol=Mr,I.isTypedArray=ts,I.isUndefined=P4,I.isWeakMap=k4,I.isWeakSet=z4,I.join=W8,I.kebabCase=MA,I.last=Hr,I.lastIndexOf=H8,I.lowerCase=NA,I.lowerFirst=SA,I.lt=q4,I.lte=U4,I.max=AC,I.maxBy=CC,I.mean=FC,I.meanBy=BC,I.min=MC,I.minBy=NC,I.stubArray=df,I.stubFalse=pf,I.stubObject=_C,I.stubString=vC,I.stubTrue=gC,I.multiply=SC,I.nth=j8,I.noConflict=aC,I.noop=hf,I.now=ga,I.pad=OA,I.padEnd=TA,I.padStart=IA,I.parseInt=$A,I.random=bA,I.reduce=Vb,I.reduceRight=Gb,I.repeat=RA,I.replace=LA,I.result=pA,I.round=OC,I.runInContext=Z,I.sample=Xb,I.size=e4,I.snakeCase=PA,I.some=t4,I.sortedIndex=Q8,I.sortedIndexBy=J8,I.sortedIndexOf=eb,I.sortedLastIndex=tb,I.sortedLastIndexBy=rb,I.sortedLastIndexOf=nb,I.startCase=zA,I.startsWith=qA,I.subtract=TC,I.sum=IC,I.sumBy=$C,I.template=UA,I.times=mC,I.toFinite=Mn,I.toInteger=ze,I.toLength=Kp,I.toLower=WA,I.toNumber=jr,I.toSafeInteger=W4,I.toString=at,I.toUpper=HA,I.trim=jA,I.trimEnd=YA,I.trimStart=ZA,I.truncate=VA,I.unescape=GA,I.uniqueId=yC,I.upperCase=KA,I.upperFirst=uf,I.each=Rp,I.eachRight=Lp,I.first=Op,lf(I,function(){var o={};return ln(I,function(f,g){ft.call(I.prototype,g)||(o[g]=f)}),o}(),{chain:!1}),I.VERSION=r,kr(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){I[o].placeholder=I}),kr(["drop","take"],function(o,f){Ze.prototype[o]=function(g){g=g===t?1:Ht(ze(g),0);var b=this.__filtered__&&!f?new Ze(this):this.clone();return b.__filtered__?b.__takeCount__=ir(g,b.__takeCount__):b.__views__.push({size:ir(g,j),type:o+(b.__dir__<0?"Right":"")}),b},Ze.prototype[o+"Right"]=function(g){return this.reverse()[o](g).reverse()}}),kr(["filter","map","takeWhile"],function(o,f){var g=f+1,b=g==k||g==L;Ze.prototype[o]=function(S){var $=this.clone();return $.__iteratees__.push({iteratee:Me(S,3),type:g}),$.__filtered__=$.__filtered__||b,$}}),kr(["head","last"],function(o,f){var g="take"+(f?"Right":"");Ze.prototype[o]=function(){return this[g](1).value()[0]}}),kr(["initial","tail"],function(o,f){var g="drop"+(f?"":"Right");Ze.prototype[o]=function(){return this.__filtered__?new Ze(this):this[g](1)}}),Ze.prototype.compact=function(){return this.filter(wr)},Ze.prototype.find=function(o){return this.filter(o).head()},Ze.prototype.findLast=function(o){return this.reverse().find(o)},Ze.prototype.invokeMap=Ue(function(o,f){return typeof o=="function"?new Ze(this):this.map(function(g){return Ns(g,o,f)})}),Ze.prototype.reject=function(o){return this.filter(xa(Me(o)))},Ze.prototype.slice=function(o,f){o=ze(o);var g=this;return g.__filtered__&&(o>0||f<0)?new Ze(g):(o<0?g=g.takeRight(-o):o&&(g=g.drop(o)),f!==t&&(f=ze(f),g=f<0?g.dropRight(-f):g.take(f-o)),g)},Ze.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},Ze.prototype.toArray=function(){return this.take(j)},ln(Ze.prototype,function(o,f){var g=/^(?:filter|find|map|reject)|While$/.test(f),b=/^(?:head|last)$/.test(f),S=I[b?"take"+(f=="last"?"Right":""):f],$=b||/^find/.test(f);S&&(I.prototype[f]=function(){var q=this.__wrapped__,W=b?[1]:arguments,K=q instanceof Ze,oe=W[0],ae=K||Pe(q),ce=function(He){var Ke=S.apply(I,Wn([He],W));return b&&ge?Ke[0]:Ke};ae&&g&&typeof oe=="function"&&oe.length!=1&&(K=ae=!1);var ge=this.__chain__,Ae=!!this.__actions__.length,Ne=$&&!ge,qe=K&&!Ae;if(!$&&ae){q=qe?q:new Ze(this);var Se=o.apply(q,W);return Se.__actions__.push({func:_a,args:[ce],thisArg:t}),new qr(Se,ge)}return Ne&&qe?o.apply(this,W):(Se=this.thru(ce),Ne?b?Se.value()[0]:Se.value():Se)})}),kr(["pop","push","shift","sort","splice","unshift"],function(o){var f=qo[o],g=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",b=/^(?:pop|shift)$/.test(o);I.prototype[o]=function(){var S=arguments;if(b&&!this.__chain__){var $=this.value();return f.apply(Pe($)?$:[],S)}return this[g](function(q){return f.apply(Pe(q)?q:[],S)})}}),ln(Ze.prototype,function(o,f){var g=I[f];if(g){var b=g.name+"";ft.call(Ki,b)||(Ki[b]=[]),Ki[b].push({name:f,func:g})}}),Ki[ua(t,m).name]=[{name:"wrapper",func:t}],Ze.prototype.clone=G2,Ze.prototype.reverse=K2,Ze.prototype.value=X2,I.prototype.at=Cb,I.prototype.chain=Fb,I.prototype.commit=Bb,I.prototype.next=Mb,I.prototype.plant=Sb,I.prototype.reverse=Ob,I.prototype.toJSON=I.prototype.valueOf=I.prototype.value=Tb,I.prototype.first=I.prototype.head,Es&&(I.prototype[Es]=Nb),I},Zi=B2();li?((li.exports=Zi)._=Zi,fu._=Zi):Qt._=Zi}).call(ye)}(Xn,Xn.exports);var Yr=Xn.exports;class f1{constructor(e,t){U(this,"_defaultParams");U(this,"_UserTypeFileds");U(this,"_varipKeys");this._defaultParams=e,this._UserTypeFileds=this._createDynamicClass(),this._varipKeys=t}copy(e){return Yr.cloneDeep(e)}new(e={}){return new this._UserTypeFileds(Object.assign(Yr.cloneDeep(this._defaultParams),e),this._varipKeys)}addNewMethod(e,t){this._UserTypeFileds.prototype[e]=t}_createDynamicClass(){return class{constructor(e,t){U(this,"_varipKeys");Object.assign(this,e),this._varipKeys=t}get varipKeys(){return[...this._varipKeys]}copy(){return Yr.cloneDeep(this)}}}}var xf={exports:{}};(function(s,e){(function(t,r){s.exports=r()})(ye,function(){var t=1e3,r=6e4,n=36e5,i="millisecond",a="second",u="minute",l="hour",c="day",h="week",d="month",p="quarter",v="year",x="date",_="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,m=/\[([^\]]+)]|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,w={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 z=["th","st","nd","rd"],L=k%100;return"["+k+(z[(L-20)%10]||z[L]||z[0])+"]"}},D=function(k,z,L){var G=String(k);return!G||G.length>=z?k:""+Array(z+1-G.length).join(L)+k},C={s:D,z:function(k){var z=-k.utcOffset(),L=Math.abs(z),G=Math.floor(L/60),H=L%60;return(z<=0?"+":"-")+D(G,2,"0")+":"+D(H,2,"0")},m:function k(z,L){if(z.date()<L.date())return-k(L,z);var G=12*(L.year()-z.year())+(L.month()-z.month()),H=z.clone().add(G,d),ee=L-H<0,te=z.clone().add(G+(ee?-1:1),d);return+(-(G+(L-H)/(ee?H-te:te-H))||0)},a:function(k){return k<0?Math.ceil(k)||0:Math.floor(k)},p:function(k){return{M:d,y:v,w:h,d:c,D:x,h:l,m:u,s:a,ms:i,Q:p}[k]||String(k||"").toLowerCase().replace(/s$/,"")},u:function(k){return k===void 0}},E="en",F={};F[E]=w;var B="$isDayjsObject",M=function(k){return k instanceof T||!(!k||!k[B])},O=function k(z,L,G){var H;if(!z)return E;if(typeof z=="string"){var ee=z.toLowerCase();F[ee]&&(H=ee),L&&(F[ee]=L,H=ee);var te=z.split("-");if(!H&&te.length>1)return k(te[0])}else{var j=z.name;F[j]=z,H=j}return!G&&H&&(E=H),H||!G&&E},A=function(k,z){if(M(k))return k.clone();var L=typeof z=="object"?z:{};return L.date=k,L.args=arguments,new T(L)},N=C;N.l=O,N.i=M,N.w=function(k,z){return A(k,{locale:z.$L,utc:z.$u,x:z.$x,$offset:z.$offset})};var T=function(){function k(L){this.$L=O(L.locale,null,!0),this.parse(L),this.$x=this.$x||L.x||{},this[B]=!0}var z=k.prototype;return z.parse=function(L){this.$d=function(G){var H=G.date,ee=G.utc;if(H===null)return new Date(NaN);if(N.u(H))return new Date;if(H instanceof Date)return new Date(H);if(typeof H=="string"&&!/Z$/i.test(H)){var te=H.match(y);if(te){var j=te[2]-1||0,X=(te[7]||"0").substring(0,3);return ee?new Date(Date.UTC(te[1],j,te[3]||1,te[4]||0,te[5]||0,te[6]||0,X)):new Date(te[1],j,te[3]||1,te[4]||0,te[5]||0,te[6]||0,X)}}return new Date(H)}(L),this.init()},z.init=function(){var L=this.$d;this.$y=L.getFullYear(),this.$M=L.getMonth(),this.$D=L.getDate(),this.$W=L.getDay(),this.$H=L.getHours(),this.$m=L.getMinutes(),this.$s=L.getSeconds(),this.$ms=L.getMilliseconds()},z.$utils=function(){return N},z.isValid=function(){return this.$d.toString()!==_},z.isSame=function(L,G){var H=A(L);return this.startOf(G)<=H&&H<=this.endOf(G)},z.isAfter=function(L,G){return A(L)<this.startOf(G)},z.isBefore=function(L,G){return this.endOf(G)<A(L)},z.$g=function(L,G,H){return N.u(L)?this[G]:this.set(H,L)},z.unix=function(){return Math.floor(this.valueOf()/1e3)},z.valueOf=function(){return this.$d.getTime()},z.startOf=function(L,G){var H=this,ee=!!N.u(G)||G,te=N.p(L),j=function(Oe,Fe){var nt=N.w(H.$u?Date.UTC(H.$y,Fe,Oe):new Date(H.$y,Fe,Oe),H);return ee?nt:nt.endOf(c)},X=function(Oe,Fe){return N.w(H.toDate()[Oe].apply(H.toDate("s"),(ee?[0,0,0,0]:[23,59,59,999]).slice(Fe)),H)},Y=this.$W,Q=this.$M,pe=this.$D,De="set"+(this.$u?"UTC":"");switch(te){case v:return ee?j(1,0):j(31,11);case d:return ee?j(1,Q):j(0,Q+1);case h:var we=this.$locale().weekStart||0,Ee=(Y<we?Y+7:Y)-we;return j(ee?pe-Ee:pe+(6-Ee),Q);case c:case x:return X(De+"Hours",0);case l:return X(De+"Minutes",1);case u:return X(De+"Seconds",2);case a:return X(De+"Milliseconds",3);default:return this.clone()}},z.endOf=function(L){return this.startOf(L,!1)},z.$set=function(L,G){var H,ee=N.p(L),te="set"+(this.$u?"UTC":""),j=(H={},H[c]=te+"Date",H[x]=te+"Date",H[d]=te+"Month",H[v]=te+"FullYear",H[l]=te+"Hours",H[u]=te+"Minutes",H[a]=te+"Seconds",H[i]=te+"Milliseconds",H)[ee],X=ee===c?this.$D+(G-this.$W):G;if(ee===d||ee===v){var Y=this.clone().set(x,1);Y.$d[j](X),Y.init(),this.$d=Y.set(x,Math.min(this.$D,Y.daysInMonth())).$d}else j&&this.$d[j](X);return this.init(),this},z.set=function(L,G){return this.clone().$set(L,G)},z.get=function(L){return this[N.p(L)]()},z.add=function(L,G){var H,ee=this;L=Number(L);var te=N.p(G),j=function(Q){var pe=A(ee);return N.w(pe.date(pe.date()+Math.round(Q*L)),ee)};if(te===d)return this.set(d,this.$M+L);if(te===v)return this.set(v,this.$y+L);if(te===c)return j(1);if(te===h)return j(7);var X=(H={},H[u]=r,H[l]=n,H[a]=t,H)[te]||1,Y=this.$d.getTime()+L*X;return N.w(Y,this)},z.subtract=function(L,G){return this.add(-1*L,G)},z.format=function(L){var G=this,H=this.$locale();if(!this.isValid())return H.invalidDate||_;var ee=L||"YYYY-MM-DDTHH:mm:ssZ",te=N.z(this),j=this.$H,X=this.$m,Y=this.$M,Q=H.weekdays,pe=H.months,De=H.meridiem,we=function(Fe,nt,Ye,Te){return Fe&&(Fe[nt]||Fe(G,ee))||Ye[nt].slice(0,Te)},Ee=function(Fe){return N.s(j%12||12,Fe,"0")},Oe=De||function(Fe,nt,Ye){var Te=Fe<12?"AM":"PM";return Ye?Te.toLowerCase():Te};return ee.replace(m,function(Fe,nt){return nt||function(Ye){switch(Ye){case"YY":return String(G.$y).slice(-2);case"YYYY":return N.s(G.$y,4,"0");case"M":return Y+1;case"MM":return N.s(Y+1,2,"0");case"MMM":return we(H.monthsShort,Y,pe,3);case"MMMM":return we(pe,Y);case"D":return G.$D;case"DD":return N.s(G.$D,2,"0");case"d":return String(G.$W);case"dd":return we(H.weekdaysMin,G.$W,Q,2);case"ddd":return we(H.weekdaysShort,G.$W,Q,3);case"dddd":return Q[G.$W];case"H":return String(j);case"HH":return N.s(j,2,"0");case"h":return Ee(1);case"hh":return Ee(2);case"a":return Oe(j,X,!0);case"A":return Oe(j,X,!1);case"m":return String(X);case"mm":return N.s(X,2,"0");case"s":return String(G.$s);case"ss":return N.s(G.$s,2,"0");case"SSS":return N.s(G.$ms,3,"0");case"Z":return te}return null}(Fe)||te.replace(":","")})},z.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},z.diff=function(L,G,H){var ee,te=this,j=N.p(G),X=A(L),Y=(X.utcOffset()-this.utcOffset())*r,Q=this-X,pe=function(){return N.m(te,X)};switch(j){case v:ee=pe()/12;break;case d:ee=pe();break;case p:ee=pe()/3;break;case h:ee=(Q-Y)/6048e5;break;case c:ee=(Q-Y)/864e5;break;case l:ee=Q/n;break;case u:ee=Q/r;break;case a:ee=Q/t;break;default:ee=Q}return H?ee:N.a(ee)},z.daysInMonth=function(){return this.endOf(d).$D},z.$locale=function(){return F[this.$L]},z.locale=function(L,G){if(!L)return this.$L;var H=this.clone(),ee=O(L,G,!0);return ee&&(H.$L=ee),H},z.clone=function(){return N.w(this.$d,this)},z.toDate=function(){return new Date(this.valueOf())},z.toJSON=function(){return this.isValid()?this.toISOString():null},z.toISOString=function(){return this.$d.toISOString()},z.toString=function(){return this.$d.toUTCString()},k}(),R=T.prototype;return A.prototype=R,[["$ms",i],["$s",a],["$m",u],["$H",l],["$W",c],["$M",d],["$y",v],["$D",x]].forEach(function(k){R[k[1]]=function(z){return this.$g(z,k[0],k[1])}}),A.extend=function(k,z){return k.$i||(k(z,T,A),k.$i=!0),A},A.locale=O,A.isDayjs=M,A.unix=function(k){return A(1e3*k)},A.en=F[E],A.Ls=F,A.p={},A})})(xf);var c1=xf.exports,ot=tt(c1),yf={exports:{}};(function(s,e){(function(t,r){s.exports=r()})(ye,function(){var t="minute",r=/[+-]\d\d(?::?\d\d)?/g,n=/([+-]|\d\d)/g;return function(i,a,u){var l=a.prototype;u.utc=function(_){var y={date:_,utc:!0,args:arguments};return new a(y)},l.utc=function(_){var y=u(this.toDate(),{locale:this.$L,utc:!0});return _?y.add(this.utcOffset(),t):y},l.local=function(){return u(this.toDate(),{locale:this.$L,utc:!1})};var c=l.parse;l.parse=function(_){_.utc&&(this.$u=!0),this.$utils().u(_.$offset)||(this.$offset=_.$offset),c.call(this,_)};var h=l.init;l.init=function(){if(this.$u){var _=this.$d;this.$y=_.getUTCFullYear(),this.$M=_.getUTCMonth(),this.$D=_.getUTCDate(),this.$W=_.getUTCDay(),this.$H=_.getUTCHours(),this.$m=_.getUTCMinutes(),this.$s=_.getUTCSeconds(),this.$ms=_.getUTCMilliseconds()}else h.call(this)};var d=l.utcOffset;l.utcOffset=function(_,y){var m=this.$utils().u;if(m(_))return this.$u?0:m(this.$offset)?d.call(this):this.$offset;if(typeof _=="string"&&(_=function(E){E===void 0&&(E="");var F=E.match(r);if(!F)return null;var B=(""+F[0]).match(n)||["-",0,0],M=B[0],O=60*+B[1]+ +B[2];return O===0?0:M==="+"?O:-O}(_),_===null))return this;var w=Math.abs(_)<=16?60*_:_,D=this;if(y)return D.$offset=w,D.$u=_===0,D;if(_!==0){var C=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(D=this.local().add(w+C,t)).$offset=w,D.$x.$localOffset=C}else D=this.utc();return D};var p=l.format;l.format=function(_){var y=_||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return p.call(this,y)},l.valueOf=function(){var _=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*_},l.isUTC=function(){return!!this.$u},l.toISOString=function(){return this.toDate().toISOString()},l.toString=function(){return this.toDate().toUTCString()};var v=l.toDate;l.toDate=function(_){return _==="s"&&this.$offset?u(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():v.call(this)};var x=l.diff;l.diff=function(_,y,m){if(_&&this.$u===_.$u)return x.call(this,_,y,m);var w=this.local(),D=u(_).local();return x.call(w,D,y,m)}}})})(yf);var l1=yf.exports,Df=tt(l1),wf={exports:{}};(function(s,e){(function(t,r){s.exports=r()})(ye,function(){var t={year:0,month:1,day:2,hour:3,minute:4,second:5},r={};return function(n,i,a){var u,l=function(p,v,x){x===void 0&&(x={});var _=new Date(p),y=function(m,w){w===void 0&&(w={});var D=w.timeZoneName||"short",C=m+"|"+D,E=r[C];return E||(E=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:m,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:D}),r[C]=E),E}(v,x);return y.formatToParts(_)},c=function(p,v){for(var x=l(p,v),_=[],y=0;y<x.length;y+=1){var m=x[y],w=m.type,D=m.value,C=t[w];C>=0&&(_[C]=parseInt(D,10))}var E=_[3],F=E===24?0:E,B=_[0]+"-"+_[1]+"-"+_[2]+" "+F+":"+_[4]+":"+_[5]+":000",M=+p;return(a.utc(B).valueOf()-(M-=M%1e3))/6e4},h=i.prototype;h.tz=function(p,v){p===void 0&&(p=u);var x=this.utcOffset(),_=this.toDate(),y=_.toLocaleString("en-US",{timeZone:p}),m=Math.round((_-new Date(y))/1e3/60),w=a(y,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(15*-Math.round(_.getTimezoneOffset()/15)-m,!0);if(v){var D=w.utcOffset();w=w.add(x-D,"minute")}return w.$x.$timezone=p,w},h.offsetName=function(p){var v=this.$x.$timezone||a.tz.guess(),x=l(this.valueOf(),v,{timeZoneName:p}).find(function(_){return _.type.toLowerCase()==="timezonename"});return x&&x.value};var d=h.startOf;h.startOf=function(p,v){if(!this.$x||!this.$x.$timezone)return d.call(this,p,v);var x=a(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return d.call(x,p,v).tz(this.$x.$timezone,!0)},a.tz=function(p,v,x){var _=x&&v,y=x||v||u,m=c(+a(),y);if(typeof p!="string")return a(p).tz(y);var w=function(F,B,M){var O=F-60*B*1e3,A=c(O,M);if(B===A)return[O,B];var N=c(O-=60*(A-B)*1e3,M);return A===N?[O,A]:[F-60*Math.min(A,N)*1e3,Math.max(A,N)]}(a.utc(p,_).valueOf(),m,y),D=w[0],C=w[1],E=a(D).utcOffset(C);return E.$x.$timezone=y,E},a.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},a.tz.setDefault=function(p){u=p}}})})(wf);var h1=wf.exports,d1=tt(h1),Ef={exports:{}};(function(s,e){(function(t,r){s.exports=r()})(ye,function(){var t="week",r="year";return function(n,i,a){var u=i.prototype;u.week=function(l){if(l===void 0&&(l=null),l!==null)return this.add(7*(l-this.week()),"day");var c=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var h=a(this).startOf(r).add(1,r).date(c),d=a(this).endOf(t);if(h.isBefore(d))return 1}var p=a(this).startOf(r).date(c).startOf(t).subtract(1,"millisecond"),v=this.diff(p,t,!0);return v<0?a(this).startOf("week").week():Math.ceil(v)},u.weeks=function(l){return l===void 0&&(l=null),this.week(l)}}})})(Ef);var p1=Ef.exports,_1=tt(p1);function or(s,e){return s.replace(/\$(\w+)/g,(t,r)=>String(e[r])||t)}function Ls(s){const e=parseInt(s)||1;let t=s.replace(/\d+/,"");return t==="m"||t==="M"?t="M":t?t=t.toLocaleLowerCase():t="m",[e,t]}function v1(s){const e=/([+-])(\d{1,2})(\d{0,2})/,t=s.replace(/GMT|UTC/,"").match(e);if(!t)throw new Error("Invalid timezone string");const[,r,n,i]=t,a=parseInt(n,10)*60||0,u=parseInt(i,10)||0;return(r==="+"?-1:1)*(a+u)}function Zr(s,e){return e&&(e.startsWith("UTC")||e.startsWith("GMT"))?ot(s).utcOffset(v1(e)):ot(s).tz(e)}function pn(s){const[e,t]=Ls(s);let r=0;switch(t){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(e)*r)}function me(s){return typeof s!="number"||isNaN(s)}var an=(s=>(s.BOOL="bool",s.INT="int",s.FLOAT="float",s.ARRAY="array",s.BOX="box",s.CHART_POINT="chart.point",s.COLOR="color",s.CONST="const",s.LABEL="label",s.LINE="line",s.LINEFILL="linefill",s.MAP="map",s.MATRIX="matrix",s.POLYLINE="polyline",s.SERIES="series",s.SIMPLE="simple",s.STRING="string",s.TABLE="table",s.UNDETERMINED="undetermined type",s.INPUT="input",s.NA="na",s.VOID="void",s))(an||{}),Ps=(s=>(s.dividends="dividends",s.none="none",s.splits="splits",s))(Ps||{}),Vr=(s=>(s.freqAll="freq_all",s.freqOncePerBar="freq_once_per_bar",s.freqOncePerBarClose="freq_once_per_bar_close",s))(Vr||{}),ns=(s=>(s.gapsOff="gaps_off",s.gapsOn="gaps_on",s.lookaheadOff="lookahead_off",s.lookaheadOn="lookahead_on",s))(ns||{}),Zt=(s=>(s.all="all",s.dataWindow="data_window",s.none="none",s.pane="pane",s.priceScale="price_scale",s.statusLine="status_line",s))(Zt||{}),Gr=(s=>(s.both="both",s.left="left",s.none="none",s.right="right",s))(Gr||{}),Je=(s=>(s.inherit="inherit",s.mintick="mintick",s.percent="percent",s.price="price",s.volume="volume",s))(Je||{}),ks=(s=>(s.styleDashed="style_dashed",s.styleDotted="style_dotted",s.styleSolid="style_solid",s))(ks||{}),vt=(s=>(s.styleArrowdown="style_arrowdown",s.styleArrowup="style_arrowup",s.styleCircle="style_circle",s.styleCross="style_cross",s.styleDiamond="style_diamond",s.styleFlag="style_flag",s.styleLabelCenter="style_label_center",s.styleLabelDown="style_label_down",s.styleLabelLeft="style_label_left",s.styleLabelLowerLeft="style_label_lower_left",s.styleLabelLowerRight="style_label_lower_right",s.styleLabelRight="style_label_right",s.styleLabelUp="style_label_up",s.styleLabelUpperLeft="style_label_upper_left",s.styleLabelUpperRight="style_label_upper_right",s.styleNone="style_none",s.styleSquare="style_square",s.styleTextOutline="style_text_outline",s.styleTriangledown="style_triangledown",s.styleTriangleup="style_triangleup",s.styleXcross="style_xcross",s))(vt||{}),zt=(s=>(s.styleArrowBoth="style_arrow_both",s.styleArrowLeft="style_arrow_left",s.styleArrowRight="style_arrow_right",s.styleDashed="style_dashed",s.styleDotted="style_dotted",s.styleSolid="style_solid",s))(zt||{}),_n=(s=>(s.abovebar="abovebar",s.absolute="absolute",s.belowbar="belowbar",s.bottom="bottom",s.top="top",s))(_n||{}),Qn=(s=>(s.ascending="ascending",s.descending="descending",s))(Qn||{}),Or=(s=>(s.styleArea="Area",s.styleAreabr="Area With Breaks",s.styleCircles="Circles",s.styleColumns="Columns",s.styleCross="Cross",s.styleHistogram="Histogram",s.styleLine="Line",s.styleLinebr="Line With Breaks",s.styleStepline="Step Line",s.styleSteplineDiamond="Step Line With Diamonds",s.styleSteplinebr="Step line with Breaks",s))(Or||{}),Er=(s=>(s.bottomCenter="bottom_center",s.bottomLeft="bottom_left",s.bottomRight="bottom_right",s.middleCenter="middle_center",s.middleLeft="middle_left",s.middleRight="middle_right",s.topCenter="top_center",s.topLeft="top_left",s.topRight="top_right",s))(Er||{}),zs=(s=>(s.left="left",s.none="none",s.right="right",s))(zs||{}),ba=(s=>(s.extended="extended",s.regular="regular",s))(ba||{}),pr=(s=>(s.arrowdown="arrowdown",s.arrowup="arrowup",s.circle="circle",s.cross="cross",s.diamond="diamond",s.flag="flag",s.labeldown="labeldown",s.labelup="labelup",s.square="square",s.triangledown="triangledown",s.triangleup="triangleup",s.xcross="xcross",s))(pr||{}),ar=(s=>(s.auto="auto",s.huge="huge",s.large="large",s.normal="normal",s.small="small",s.tiny="tiny",s))(ar||{}),Jn=(s=>(s.familyDefault="default",s.familyMonospace="monospace",s))(Jn||{}),Rt=(s=>(s.cash="cash",s.fixed="fixed",s.percentOfEquity="percent_of_equity",s))(Rt||{}),Tr=(s=>(s.cashPerContract="cash_per_contract",s.cashPerOrder="cash_per_order",s.percent="percent",s))(Tr||{}),gt=(s=>(s.all="all",s.long="long",s.short="short",s))(gt||{}),vn=(s=>(s.cancel="cancel",s.none="none",s.reduce="reduce",s))(vn||{}),je=(s=>(s.alignBottom="align_bottom",s.alignCenter="align_center",s.alignLeft="align_left",s.alignRight="align_right",s.alignTop="align_top",s.wrapAuto="wrap_auto",s.wrapNone="wrap_none",s))(je||{}),wt=(s=>(s.bar_index="bar_index",s.bar_time="bar_time",s))(wt||{}),Kr=(s=>(s.abovebar="abovebar",s.belowbar="belowbar",s.price="price",s))(Kr||{}),qs=(s=>(s.actual="actual",s.estimate="estimate",s.standardized="standardized",s))(qs||{}),ei=(s=>(s.traditional="Traditional",s.fibonacci="Fibonacci",s.woodie="Woodie",s.classic="Classic",s.dm="DM",s.camarilla="Camarilla",s))(ei||{}),_r=(s=>(s.INT="int",s.BOOL="bool",s.TIME="time",s.COLOR="color",s.FLOAT="float",s.PRICE="price",s.SOURCE="source",s.STRING="string",s.SYMBOL="symbol",s.SESSION="session",s.TEXT_AREA="text_area",s.TIMEFRAME="timeframe",s))(_r||{}),Ve=(s=>(s[s.Hint=1]="Hint",s[s.Info=2]="Info",s[s.Warning=4]="Warning",s[s.Error=8]="Error",s))(Ve||{});class g1{constructor(e){U(this,"_errorListener");this._errorListener=e}new({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}new_float({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}new_int({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}new_color({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}new_bool({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}new_string({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}new_line({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}new_box({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}new_table({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}new_linefill({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}new_label({size:e,initial_value:t}={}){return new it(e,t,this._errorListener)}copy({id:e}){return e==null?void 0:e.copy()}slice({id:e,index_from:t,index_to:r}){return e==null?void 0:e.slice({index_from:t,index_to:r})}size({id:e}){return e==null?void 0:e.size()}first({id:e}){return e==null?void 0:e.first()}abs({id:e},t){return e==null?void 0:e.abs(t)}avg({id:e},t){return e==null?void 0:e.avg(t)}binary_search({id:e,val:t},r){return e==null?void 0:e.binary_search({val:t},r)}binary_search_leftmost({id:e,val:t},r){return e==null?void 0:e.binary_search_leftmost({val:t},r)}binary_search_rightmost({id:e,val:t},r){return e==null?void 0:e.binary_search_rightmost({val:t},r)}clear({id:e}){e==null||e.clear()}concat({id1:e,id2:t}){return e==null?void 0:e.concat({id2:t})}covariance({id1:e,id2:t,biased:r},n){return e==null?void 0:e.covariance({id2:t,biased:r},n)}every({id:e},t){return e==null?void 0:e.every(t)}from(e,t){const r=new it(0,void 0,this._errorListener);return r._value=t,r}fill({id:e,value:t,index_from:r,index_to:n}){e==null||e.fill({value:t,index_from:r,index_to:n})}get({id:e,index:t}){return e==null?void 0:e.get({index:t})}includes({id:e,value:t}){return e==null?void 0:e.includes({value:t})}indexof({id:e,value:t}){return e==null?void 0:e.indexof({value:t})}insert({id:e,index:t,value:r}){e==null||e.insert({index:t,value:r})}join({id:e,separator:t},r){return e==null?void 0:e.join({separator:t},r)}last({id:e}){return e==null?void 0:e.last()}lastindexof({id:e,value:t}){return e==null?void 0:e.lastindexof({value:t})}max({id:e,nth:t},r){return e==null?void 0:e.max({nth:t},r)}median({id:e},t){return e==null?void 0:e.median(t)}min({id:e,nth:t},r){return e==null?void 0:e.min({nth:t},r)}mode({id:e},t){return e==null?void 0:e.mode(t)}percentile_linear_interpolation({id:e,percentage:t},r){return e==null?void 0:e.percentile_linear_interpolation({percentage:t},r)}percentile_nearest_rank({id:e,percentage:t},r){return e==null?void 0:e.percentile_nearest_rank({percentage:t},r)}percentrank({id:e,index:t},r){return e==null?void 0:e.percentrank({index:t},r)}pop({id:e}){return e==null?void 0:e.pop()}push({id:e,value:t}){e==null||e.push({value:t})}range({id:e},t){return e==null?void 0:e.range(t)}remove({id:e,index:t}){return e==null?void 0:e.remove({index:t})}reverse({id:e}){return e==null?void 0:e.reverse()}set({id:e,index:t,value:r}){e==null||e.set({index:t,value:r})}shift({id:e}){return e==null?void 0:e.shift()}some({id:e},t){return e==null?void 0:e.some(t)}sort({id:e,order:t},r){e==null||e.sort({order:t},r)}sort_indices({id:e,order:t},r){return e==null?void 0:e.sort_indices({order:t},r)}standardize({id:e},t){return e==null?void 0:e.standardize(t)}stdev({id:e,biased:t},r){return e==null?void 0:e.stdev({biased:t},r)}sum({id:e},t){return e==null?void 0:e.sum(t)}unshift({id:e,value:t}){e==null||e.unshift({value:t})}variance({id:e,biased:t},r){return e==null?void 0:e.variance({biased:t},r)}}class it{constructor(e=0,t,r){U(this,"_arrInstance");U(this,"_errorListener");this._errorListener=r,this._arrInstance=Array.from(new Array(e||0),()=>Yr.cloneDeep(t))}get isArray(){return!0}get _value(){return[...this._arrInstance]}set _value(e){this._arrInstance=[...e]}_deepCopyData(e){this._arrInstance=Yr.cloneDeep(e)}_copyData(e){this._arrInstance=e}copy(){const e=new it(0,void 0,this._errorListener);return e._deepCopyData(this._arrInstance),e}slice({index_from:e,index_to:t}){const r=new it(0,void 0,this._errorListener);return r._copyData(this._arrInstance.slice(e,t)),r}size(){return this._arrInstance.length}first(){return this._arrInstance[0]}abs(e){const t=new it(0,void 0,this._errorListener);this._verifySimpleType("number","abs","int/float",e);const r=this._arrInstance.map(n=>Math.abs(n));return t._copyData(r),t}avg(e){return this._verifySimpleType("number","avg","int/float",e),Yr.mean(this._arrInstance)}binary_search({val:e},t){return this._verifySimpleType("number","binary_search","int/float",t),me(e)?-1:this._binarySearch(this._arrInstance,e)}binary_search_leftmost({val:e},t){return this._verifySimpleType("number","binary_search_leftmost","int/float",t),me(e)?this._arrInstance.length-1:this._binarySearchLeftMost(this._arrInstance,e)}binary_search_rightmost({val:e},t){return this._verifySimpleType("number","binary_search_rightmost","int/float",t),me(e)?this._arrInstance.length:this._binarySearchRightMost(this._arrInstance,e)}clear(){this._arrInstance=[]}concat({id2:e}){return this._arrInstance=this._arrInstance.concat(e==null?void 0:e._value),this}covariance({id2:e,biased:t},r){return this._verifySimpleType("number","covariance","int/float",r),this._verifySimpleType("number","covariance","int/float",r,e==null?void 0:e._value),this._covariance(this._arrInstance,e._value,t,r)}every(e){return this._verifySimpleType("number|boolean","every","int/float/bool",e),this._arrInstance.every(t=>!!t)}fill({value:e,index_from:t=0,index_to:r}){this._arrInstance=this._setElements(this._arrInstance,e,t,r)}get({index:e}){if(!me(e))return this._arrInstance[e]}includes({value:e}){return this._arrInstance.includes(e)}indexof({value:e}){return this._arrInstance.indexOf(e)}insert({index:e,value:t}){me(e)||this._arrInstance.splice(e,0,t)}join({separator:e}={},t){return this._verifySimpleType("number|string","join","int/float/string",t),this._arrInstance.join(e)}last(){return this._arrInstance[this._arrInstance.length-1]}lastindexof({value:e}){return this._arrInstance.lastIndexOf(e)}max({nth:e}={},t){return this._verifySimpleType("number","max","int/float",t),this._maxNth([...this._arrInstance],e)}median(e){return this._verifySimpleType("number","median","int/float",e),this._median([...this._arrInstance])}min({nth:e}={},t){return this._verifySimpleType("number","min","int/float",t),this._minNth([...this._arrInstance],e)}mode(e){return this._verifySimpleType("number","mode","int/float",e),this._mode([...this._arrInstance])}percentile_linear_interpolation({percentage:e},t){return this._verifySimpleType("number","percentile_linear_interpolation","int/float",t),this._percentileLinearInterpolation([...this._arrInstance],e)}percentile_nearest_rank({percentage:e=0},t){var r;if(this._arrInstance.length===0||e<0||e>100||me(e)){(r=this._errorListener)==null||r.addError("Invalid percentile or empty array",t,Ve.Error);return}return this._verifySimpleType("number","percentile_nearest_rank","int/float",t),this._getNearestRankPercentile([...this._arrInstance],e)}percentrank({index:e},t){return this._verifySimpleType("number","percentrank","int/float",t),this._getPercentileRank([...this._arrInstance],e)}pop(){return this._arrInstance.pop()}push({value:e}){this._arrInstance.push(e)}range(e){var i;if(this._arrInstance.length===0){(i=this._errorListener)==null||i.addError("Array must not be empty",e,Ve.Error);return}this._verifySimpleType("number","range","int/float",e);const t=Math.min(...this._arrInstance);return Math.max(...this._arrInstance)-t}remove({index:e}){if(!me(e))return this._arrInstance.splice(e,1)[0]}reverse(){this._arrInstance.reverse()}set({index:e,value:t}){me(e)||(this._arrInstance[e]=t)}shift(){return this._arrInstance.shift()}some(e){return this._verifySimpleType("number|boolean","some","int/float/bool",e),this._arrInstance.some(t=>!!t)}sort({order:e}={},t){this._verifySimpleType("number","sort","int/float",t),this._arrInstance.sort((r,n)=>e!==Qn.descending?r-n:n-r)}sort_indices({order:e}={},t){this._verifySimpleType("number","sort_indices","int/float",t);const r=this._arrInstance.map((i,a)=>a);r.sort((i,a)=>e!==Qn.descending?this._arrInstance[i]-this._arrInstance[a]:this._arrInstance[a]-this._arrInstance[i]);const n=new it(0,void 0,this._errorListener);return n._copyData(r),n}standardize(e){this._verifySimpleType("number","standardize","int/float",e);const t=new it(0,void 0,this._errorListener);return t._copyData(this._standardizeArray([...this._arrInstance])),t}stdev({biased:e}={},t){var r;if(this._arrInstance.length===0){(r=this._errorListener)==null||r.addError("Array must not be empty",t,Ve.Error);return}return this._verifySimpleType("number","stdev","int/float",t),this._calculateStandardDeviations([...this._arrInstance],e)}sum(e){return this._verifySimpleType("number","sum","int/float",e),this._arrInstance.reduce((r,n)=>r+(n||0),0)}unshift({value:e}){this._arrInstance.unshift(e)}variance({biased:e}={},t){var r;if(this._arrInstance.length===0){(r=this._errorListener)==null||r.addError("Array must not be empty",t,Ve.Error);return}return this._verifySimpleType("number","variance","int/float",t),this._calculateVariances([...this._arrInstance],e)}_calculateVariances(e,t=!0){const r=e.reduce((a,u)=>a+(u||0),0)/e.length,n=e.reduce((a,u)=>a+((u||0)-r)**2,0),i=n/e.length;return t?i:e.length>1?n/(e.length-1):i}_calculateStandardDeviations(e,t=!0){const r=e.reduce((a,u)=>a+(u||0),0)/e.length,n=e.reduce((a,u)=>{const l=(u||0)-r;return a+l*l},0),i=Math.sqrt(n/e.length);return t?i:e.length>1?Math.sqrt(n/(e.length-1)):i}_standardizeArray(e){const t=e.reduce((i,a)=>i+(a||0),0)/e.length,r=Math.sqrt(e.reduce((i,a)=>i+Math.pow((a||0)-t,2),0)/e.length);return e.map(i=>((i||0)-t)/r)}_getPercentileRank(e,t=0){if(me(t))return;const r=e[t];let n=0;for(let a=0;a<e.length;a++)(e[a]<r||e[a]===r&&a!=t)&&n++;return n/(e.length-1)*100}_getNearestRankPercentile(e,t=0){const r=e.slice().sort((a,u)=>a-u),n=t/100*r.length,i=Math.ceil(n)-1;return r[i>=r.length?r.length-1:i]}_percentileLinearInterpolation(e,t=0){if(t<0||t>100||me(t))return;e.sort(function(i,a){return i-a});const r=e.length;t/=100;const n=1/(r*2);if(t<=n)return e[0];if(t>=1-1/(r*2))return e[r-1];for(const[i,a]of e.entries()){const u=e[i-1];if(t<(i+.5)/r)return u+(a-u)*(t-(i-.5)/r)/(1/r)}}_mode(e){const t={};let r=0;const n=[];for(const i of e)t[i]=(t[i]||0)+1,r=Math.max(r,t[i]);for(const i in t)t[i]===r&&n.push(Number(i));return Math.min(...r===1?e:n)}_median(e){e.sort(function(r,n){return r-n});const t=Math.floor(e.length/2);return e.length%2?e[t]:(e[t-1]+e[t])/2}_minNth(e,t=0){return e.sort(function(r,n){return r-n}),e[t]}_maxNth(e,t=0){return e.sort(function(r,n){return n-r}),e[t]}_setElements(e,t,r=0,n){n===void 0&&(n=e.length);for(let i=r;i<n;i++)e[i]=t;return e}_covariance(e,t,r=!0,n){var l;if(e.length!=t.length){(l=this._errorListener)==null||l.addError("Arrays have different lengths",n,Ve.Error);return}e=e.filter(c=>c!==void 0),t=t.filter(c=>c!==void 0);const i=e.reduce((c,h)=>c+h,0)/e.length,a=t.reduce((c,h)=>c+h,0)/t.length;let u=0;for(let c=0;c<e.length;c++)u+=(e[c]-i)*(t[c]-a);return r?u/e.length:u/(e.length-1)}_verifySimpleType(e,t,r,n,i=this._arrInstance){var u;i.filter(l=>l!==void 0).some(l=>!e.split("|").includes(typeof l))&&((u=this._errorListener)==null||u.addError(`数组类型错误,array.${t}方法只能使用${r}类型数组!`,n,Ve.Error))}_binarySearch(e,t){let r=0,n=e.length-1;for(;r<=n;){const i=Math.floor((r+n)/2);if(e[i]===t)return i;e[i]<t?r=i+1:n=i-1}return-1}_binarySearchLeftMost(e,t){let r=0,n=e.length-1;const i=[];for(;r<=n;){const a=Math.floor((r+n)/2);e[a]===t&&i.push(a),e[a]<t?r=a+1:n=a-1}return i.length?Math.min(...i):r-1}_binarySearchRightMost(e,t){let r=0,n=e.length-1;const i=[];for(;r<=n;){const a=Math.floor((r+n)/2);e[a]===t&&i.push(a),e[a]<=t?r=a+1:n=a-1}return i.length?Math.max(...i):r}}class m1{constructor(e,t){U(this,"_randomNums");U(this,"_mintick");U(this,"_cacheData");U(this,"_barIndex");U(this,"_errorListener");this._mintick=e,this._randomNums={},this._cacheData={},this._barIndex=0,this._errorListener=t}update(e){this._barIndex=e,this._randomNums={}}abs({number:e}){if(!me(e))return Math.abs(e)}acos({angle:e}){if(me(e))return;const t=Math.acos(e);return isNaN(t)?void 0:t}asin({angle:e}){if(me(e))return;const t=Math.asin(e);return isNaN(t)?void 0:t}atan({angle:e}){if(me(e))return;const t=Math.atan(e);return isNaN(t)?void 0:t}avg(e,t){return Yr.mean(t)}ceil({number:e}){if(!me(e))return Math.ceil(e)}floor({number:e}){if(!me(e))return Math.floor(e)}cos({angle:e}){if(me(e))return;const t=Math.cos(e);return isNaN(t)?void 0:t}sin({angle:e}){if(me(e))return;const t=Math.sin(e);return isNaN(t)?void 0:t}tan({angle:e}){if(me(e))return;const t=Math.tan(e);return isNaN(t)?void 0:t}exp({number:e}){if(!me(e))return Math.exp(e)}log({number:e}){if(!me(e))return Math.log(e)}log10({number:e}){if(!me(e))return Math.log10(e)}max(e,t){return t=t.filter(r=>!me(r)),Math.max(...t)}min(e,t){return t=t.filter(r=>!me(r)),Math.min(...t)}pow({base:e,exponent:t}){if(!(me(e)||me(t)))return Math.pow(e,t)}random({min:e=0,max:t=1,seed:r},n){if(me(e)&&(e=0),me(t)&&(t=1),r&&this._randomNums[r])return this._randomNums[r];if(e>=t){this._errorListener.addError("min must be less than max",n,Ve.Error);return}let i;do i=Math.random()*(t-e)+e;while(i===e||i===t);return r&&(this._randomNums[r]=i),i}round({number:e,precision:t}){if(!me(e))return me(t)?Math.round(e):Number(e==null?void 0:e.toFixed(t))}round_to_mintick({number:e}){if(!me(e))return Number(e==null?void 0:e.toFixed(this._mintick))}sign({number:e}){if(!me(e))return e&&Math.sign(e)}sqrt({number:e}){if(!me(e))return Math.sqrt(e)}sum({source:e,length:t=1},r){let n=this._cacheData[`sum_${r}`];n||(n=[]),n[this._barIndex]=e,this._cacheData[`sum_${r}`]=n;const i=n.filter(a=>!me(a));if(!(i.length<t))return Yr.sum(i.slice(-t))}todegrees({radians:e}){if(!me(e))return e*(180/Math.PI)}toradians({degrees:e}){if(!me(e))return e*(Math.PI/180)}}function Us(){return Us=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(s[r]=t[r])}return s},Us.apply(this,arguments)}var bf={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null};function pt(s){return typeof s=="number"}function St(s){return!s||typeof s!="object"||typeof s.constructor!="function"?!1:s.isBigNumber===!0&&typeof s.constructor.prototype=="object"&&s.constructor.prototype.isBigNumber===!0||typeof s.constructor.isDecimal=="function"&&s.constructor.isDecimal(s)===!0}function Af(s){return s&&typeof s=="object"&&Object.getPrototypeOf(s).isComplex===!0||!1}function Cf(s){return s&&typeof s=="object"&&Object.getPrototypeOf(s).isFraction===!0||!1}function Ff(s){return s&&s.constructor.prototype.isUnit===!0||!1}function un(s){return typeof s=="string"}var Ct=Array.isArray;function mt(s){return s&&s.constructor.prototype.isMatrix===!0||!1}function is(s){return Array.isArray(s)||mt(s)}function x1(s){return s&&s.isDenseMatrix&&s.constructor.prototype.isMatrix===!0||!1}function y1(s){return s&&s.isSparseMatrix&&s.constructor.prototype.isMatrix===!0||!1}function D1(s){return s&&s.constructor.prototype.isRange===!0||!1}function Aa(s){return s&&s.constructor.prototype.isIndex===!0||!1}function w1(s){return typeof s=="boolean"}function E1(s){return s&&s.constructor.prototype.isResultSet===!0||!1}function b1(s){return s&&s.constructor.prototype.isHelp===!0||!1}function A1(s){return typeof s=="function"}function C1(s){return s instanceof Date}function F1(s){return s instanceof RegExp}function Ca(s){return!!(s&&typeof s=="object"&&s.constructor===Object&&!Af(s)&&!Cf(s))}function B1(s){return s===null}function M1(s){return s===void 0}function N1(s){return s&&s.isAccessorNode===!0&&s.constructor.prototype.isNode===!0||!1}function S1(s){return s&&s.isArrayNode===!0&&s.constructor.prototype.isNode===!0||!1}function O1(s){return s&&s.isAssignmentNode===!0&&s.constructor.prototype.isNode===!0||!1}function T1(s){return s&&s.isBlockNode===!0&&s.constructor.prototype.isNode===!0||!1}function I1(s){return s&&s.isConditionalNode===!0&&s.constructor.prototype.isNode===!0||!1}function $1(s){return s&&s.isConstantNode===!0&&s.constructor.prototype.isNode===!0||!1}function R1(s){return s&&s.isFunctionAssignmentNode===!0&&s.constructor.prototype.isNode===!0||!1}function L1(s){return s&&s.isFunctionNode===!0&&s.constructor.prototype.isNode===!0||!1}function P1(s){return s&&s.isIndexNode===!0&&s.constructor.prototype.isNode===!0||!1}function k1(s){return s&&s.isNode===!0&&s.constructor.prototype.isNode===!0||!1}function z1(s){return s&&s.isObjectNode===!0&&s.constructor.prototype.isNode===!0||!1}function q1(s){return s&&s.isOperatorNode===!0&&s.constructor.prototype.isNode===!0||!1}function U1(s){return s&&s.isParenthesisNode===!0&&s.constructor.prototype.isNode===!0||!1}function W1(s){return s&&s.isRangeNode===!0&&s.constructor.prototype.isNode===!0||!1}function H1(s){return s&&s.isRelationalNode===!0&&s.constructor.prototype.isNode===!0||!1}function j1(s){return s&&s.isSymbolNode===!0&&s.constructor.prototype.isNode===!0||!1}function Y1(s){return s&&s.constructor.prototype.isChain===!0||!1}function Sn(s){var e=typeof s;return e==="object"?s===null?"null":St(s)?"BigNumber":s.constructor&&s.constructor.name?s.constructor.name:"Object":e}function ut(s){var e=typeof s;if(e==="number"||e==="string"||e==="boolean"||s===null||s===void 0)return s;if(typeof s.clone=="function")return s.clone();if(Array.isArray(s))return s.map(function(t){return ut(t)});if(s instanceof Date)return new Date(s.valueOf());if(St(s))return s;if(Ca(s))return Z1(s,ut);throw new TypeError("Cannot clone: unknown type of value (value: ".concat(s,")"))}function Z1(s,e){var t={};for(var r in s)ss(s,r)&&(t[r]=e(s[r]));return t}function Bf(s,e){for(var t in e)ss(e,t)&&(s[t]=e[t]);return s}function yi(s,e){var t,r,n;if(Array.isArray(s)){if(!Array.isArray(e)||s.length!==e.length)return!1;for(r=0,n=s.length;r<n;r++)if(!yi(s[r],e[r]))return!1;return!0}else{if(typeof s=="function")return s===e;if(s instanceof Object){if(Array.isArray(e)||!(e instanceof Object))return!1;for(t in s)if(!(t in e)||!yi(s[t],e[t]))return!1;for(t in e)if(!(t in s))return!1;return!0}else return s===e}}function ss(s,e){return s&&Object.hasOwnProperty.call(s,e)}function V1(s,e){for(var t={},r=0;r<e.length;r++){var n=e[r],i=s[n];i!==void 0&&(t[n]=i)}return t}var G1=["Matrix","Array"],K1=["number","BigNumber","Fraction"],br=function(e){if(e)throw new Error(`The global config is readonly.
28
+ Please create a mathjs instance if you want to change the default configuration.
29
+ Example:
30
+
31
+ import { create, all } from 'mathjs';
32
+ const mathjs = create(all);
33
+ mathjs.config({ number: 'BigNumber' });
34
+ `);return Object.freeze(bf)};Us(br,bf,{MATRIX_OPTIONS:G1,NUMBER_OPTIONS:K1});function Mf(){return!0}function Ir(){return!1}function Di(){}const Nf="Argument is not a typed-function.";function Sf(){function s(P){return typeof P=="object"&&P!==null&&P.constructor===Object}const e=[{name:"number",test:function(P){return typeof P=="number"}},{name:"string",test:function(P){return typeof P=="string"}},{name:"boolean",test:function(P){return typeof P=="boolean"}},{name:"Function",test:function(P){return typeof P=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(P){return P instanceof Date}},{name:"RegExp",test:function(P){return P instanceof RegExp}},{name:"Object",test:s},{name:"null",test:function(P){return P===null}},{name:"undefined",test:function(P){return P===void 0}}],t={name:"any",test:Mf,isAny:!0};let r,n,i=0,a={createCount:0};function u(P){const V=r.get(P);if(V)return V;let J='Unknown type "'+P+'"';const ie=P.toLowerCase();let ue;for(ue of n)if(ue.toLowerCase()===ie){J+='. Did you mean "'+ue+'" ?';break}throw new TypeError(J)}function l(P){let V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any";const J=V?u(V).index:n.length,ie=[];for(let se=0;se<P.length;++se){if(!P[se]||typeof P[se].name!="string"||typeof P[se].test!="function")throw new TypeError("Object with properties {name: string, test: function} expected");const _e=P[se].name;if(r.has(_e))throw new TypeError('Duplicate type name "'+_e+'"');ie.push(_e),r.set(_e,{name:_e,test:P[se].test,isAny:P[se].isAny,index:J+se,conversionsTo:[]})}const ue=n.slice(J);n=n.slice(0,J).concat(ie).concat(ue);for(let se=J+ie.length;se<n.length;++se)r.get(n[se]).index=se}function c(){r=new Map,n=[],i=0,l([t],!1)}c(),l(e);function h(){let P;for(P of n)r.get(P).conversionsTo=[];i=0}function d(P){const V=n.filter(J=>{const ie=r.get(J);return!ie.isAny&&ie.test(P)});return V.length?V:["any"]}function p(P){return P&&typeof P=="function"&&"_typedFunctionData"in P}function v(P,V,J){if(!p(P))throw new TypeError(Nf);const ie=J&&J.exact,ue=Array.isArray(V)?V.join(","):V,se=C(ue),_e=y(se);if(!ie||_e in P.signatures){const Xe=P._typedFunctionData.signatureMap.get(_e);if(Xe)return Xe}const he=se.length;let de;if(ie){de=[];let Xe;for(Xe in P.signatures)de.push(P._typedFunctionData.signatureMap.get(Xe))}else de=P._typedFunctionData.signatures;for(let Xe=0;Xe<he;++Xe){const et=se[Xe],ht=[];let kt;for(kt of de){const Tt=M(kt.params,Xe);if(!(!Tt||et.restParam&&!Tt.restParam)){if(!Tt.hasAny){const rr=D(Tt);if(et.types.some(cr=>!rr.has(cr.name)))continue}ht.push(kt)}}if(de=ht,de.length===0)break}let le;for(le of de)if(le.params.length<=he)return le;throw new TypeError("Signature not found (signature: "+(P.name||"unnamed")+"("+y(se,", ")+"))")}function x(P,V,J){return v(P,V,J).implementation}function _(P,V){const J=u(V);if(J.test(P))return P;const ie=J.conversionsTo;if(ie.length===0)throw new Error("There are no conversions to "+V+" defined.");for(let ue=0;ue<ie.length;ue++)if(u(ie[ue].from).test(P))return ie[ue].convert(P);throw new Error("Cannot convert "+P+" to "+V)}function y(P){let V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:",";return P.map(J=>J.name).join(V)}function m(P){const V=P.indexOf("...")===0,ie=(V?P.length>3?P.slice(3):"any":P).split("|").map(he=>u(he.trim()));let ue=!1,se=V?"...":"";return{types:ie.map(function(he){return ue=he.isAny||ue,se+=he.name+"|",{name:he.name,typeIndex:he.index,test:he.test,isAny:he.isAny,conversion:null,conversionIndex:-1}}),name:se.slice(0,-1),hasAny:ue,hasConversion:!1,restParam:V}}function w(P){const V=P.types.map(_e=>_e.name),J=G(V);let ie=P.hasAny,ue=P.name;const se=J.map(function(_e){const he=u(_e.from);return ie=he.isAny||ie,ue+="|"+_e.from,{name:_e.from,typeIndex:he.index,test:he.test,isAny:he.isAny,conversion:_e,conversionIndex:_e.index}});return{types:P.types.concat(se),name:ue,hasAny:ie,hasConversion:se.length>0,restParam:P.restParam}}function D(P){return P.typeSet||(P.typeSet=new Set,P.types.forEach(V=>P.typeSet.add(V.name))),P.typeSet}function C(P){const V=[];if(typeof P!="string")throw new TypeError("Signatures must be strings");const J=P.trim();if(J==="")return V;const ie=J.split(",");for(let ue=0;ue<ie.length;++ue){const se=m(ie[ue].trim());if(se.restParam&&ue!==ie.length-1)throw new SyntaxError('Unexpected rest parameter "'+ie[ue]+'": only allowed for the last parameter');if(se.types.length===0)return null;V.push(se)}return V}function E(P){const V=Oe(P);return V?V.restParam:!1}function F(P){if(!P||P.types.length===0)return Mf;if(P.types.length===1)return u(P.types[0].name).test;if(P.types.length===2){const V=u(P.types[0].name).test,J=u(P.types[1].name).test;return function(ue){return V(ue)||J(ue)}}else{const V=P.types.map(function(J){return u(J.name).test});return function(ie){for(let ue=0;ue<V.length;ue++)if(V[ue](ie))return!0;return!1}}}function B(P){let V,J,ie;if(E(P)){V=Ee(P).map(F);const ue=V.length,se=F(Oe(P)),_e=function(he){for(let de=ue;de<he.length;de++)if(!se(he[de]))return!1;return!0};return function(de){for(let le=0;le<V.length;le++)if(!V[le](de[le]))return!1;return _e(de)&&de.length>=ue+1}}else return P.length===0?function(se){return se.length===0}:P.length===1?(J=F(P[0]),function(se){return J(se[0])&&se.length===1}):P.length===2?(J=F(P[0]),ie=F(P[1]),function(se){return J(se[0])&&ie(se[1])&&se.length===2}):(V=P.map(F),function(se){for(let _e=0;_e<V.length;_e++)if(!V[_e](se[_e]))return!1;return se.length===V.length})}function M(P,V){return V<P.length?P[V]:E(P)?Oe(P):null}function O(P,V){const J=M(P,V);return J?D(J):new Set}function A(P){return P.conversion===null||P.conversion===void 0}function N(P,V){const J=new Set;return P.forEach(ie=>{const ue=O(ie.params,V);let se;for(se of ue)J.add(se)}),J.has("any")?["any"]:Array.from(J)}function T(P,V,J){let ie,ue;const se=P||"unnamed";let _e=J,he;for(he=0;he<V.length;he++){const et=[];if(_e.forEach(ht=>{const kt=M(ht.params,he),Tt=F(kt);(he<ht.params.length||E(ht.params))&&Tt(V[he])&&et.push(ht)}),et.length===0){if(ue=N(_e,he),ue.length>0){const ht=d(V[he]);return ie=new TypeError("Unexpected type of argument in function "+se+" (expected: "+ue.join(" or ")+", actual: "+ht.join(" | ")+", index: "+he+")"),ie.data={category:"wrongType",fn:se,index:he,actual:ht,expected:ue},ie}}else _e=et}const de=_e.map(function(et){return E(et.params)?1/0:et.params.length});if(V.length<Math.min.apply(null,de))return ue=N(_e,he),ie=new TypeError("Too few arguments in function "+se+" (expected: "+ue.join(" or ")+", index: "+V.length+")"),ie.data={category:"tooFewArgs",fn:se,index:V.length,expected:ue},ie;const le=Math.max.apply(null,de);if(V.length>le)return ie=new TypeError("Too many arguments in function "+se+" (expected: "+le+", actual: "+V.length+")"),ie.data={category:"tooManyArgs",fn:se,index:V.length,expectedLength:le},ie;const Xe=[];for(let et=0;et<V.length;++et)Xe.push(d(V[et]).join("|"));return ie=new TypeError('Arguments of type "'+Xe.join(", ")+'" do not match any of the defined signatures of function '+se+"."),ie.data={category:"mismatch",actual:Xe},ie}function R(P){let V=n.length+1;for(let J=0;J<P.types.length;J++)A(P.types[J])&&(V=Math.min(V,P.types[J].typeIndex));return V}function k(P){let V=i+1;for(let J=0;J<P.types.length;J++)A(P.types[J])||(V=Math.min(V,P.types[J].conversionIndex));return V}function z(P,V){if(P.hasAny){if(!V.hasAny)return 1}else if(V.hasAny)return-1;if(P.restParam){if(!V.restParam)return 1}else if(V.restParam)return-1;if(P.hasConversion){if(!V.hasConversion)return 1}else if(V.hasConversion)return-1;const J=R(P)-R(V);if(J<0)return-1;if(J>0)return 1;const ie=k(P)-k(V);return ie<0?-1:ie>0?1:0}function L(P,V){const J=P.params,ie=V.params,ue=Oe(J),se=Oe(ie),_e=E(J),he=E(ie);if(_e&&ue.hasAny){if(!he||!se.hasAny)return 1}else if(he&&se.hasAny)return-1;let de=0,le=0,Xe;for(Xe of J)Xe.hasAny&&++de,Xe.hasConversion&&++le;let et=0,ht=0;for(Xe of ie)Xe.hasAny&&++et,Xe.hasConversion&&++ht;if(de!==et)return de-et;if(_e&&ue.hasConversion){if(!he||!se.hasConversion)return 1}else if(he&&se.hasConversion)return-1;if(le!==ht)return le-ht;if(_e){if(!he)return 1}else if(he)return-1;const kt=(J.length-ie.length)*(_e?-1:1);if(kt!==0)return kt;const Tt=[];let rr=0;for(let en=0;en<J.length;++en){const Dn=z(J[en],ie[en]);Tt.push(Dn),rr+=Dn}if(rr!==0)return rr;let cr;for(cr of Tt)if(cr!==0)return cr;return 0}function G(P){if(P.length===0)return[];const V=P.map(u);P.length>1&&V.sort((ue,se)=>ue.index-se.index);let J=V[0].conversionsTo;if(P.length===1)return J;J=J.concat([]);const ie=new Set(P);for(let ue=1;ue<V.length;++ue){let se;for(se of V[ue].conversionsTo)ie.has(se.from)||(J.push(se),ie.add(se.from))}return J}function H(P,V){let J=V;if(P.some(ue=>ue.hasConversion)){const ue=E(P),se=P.map(ee);J=function(){const he=[],de=ue?arguments.length-1:arguments.length;for(let le=0;le<de;le++)he[le]=se[le](arguments[le]);return ue&&(he[de]=arguments[de].map(se[de])),V.apply(this,he)}}let ie=J;if(E(P)){const ue=P.length-1;ie=function(){return J.apply(this,Fe(arguments,0,ue).concat([Fe(arguments,ue)]))}}return ie}function ee(P){let V,J,ie,ue;const se=[],_e=[];switch(P.types.forEach(function(he){he.conversion&&(se.push(u(he.conversion.from).test),_e.push(he.conversion.convert))}),_e.length){case 0:return function(de){return de};case 1:return V=se[0],ie=_e[0],function(de){return V(de)?ie(de):de};case 2:return V=se[0],J=se[1],ie=_e[0],ue=_e[1],function(de){return V(de)?ie(de):J(de)?ue(de):de};default:return function(de){for(let le=0;le<_e.length;le++)if(se[le](de))return _e[le](de);return de}}}function te(P){function V(J,ie,ue){if(ie<J.length){const se=J[ie];let _e=[];if(se.restParam){const he=se.types.filter(A);he.length<se.types.length&&_e.push({types:he,name:"..."+he.map(de=>de.name).join("|"),hasAny:he.some(de=>de.isAny),hasConversion:!1,restParam:!0}),_e.push(se)}else _e=se.types.map(function(he){return{types:[he],name:he.name,hasAny:he.isAny,hasConversion:he.conversion,restParam:!1}});return Ye(_e,function(he){return V(J,ie+1,ue.concat([he]))})}else return[ue]}return V(P,0,[])}function j(P,V){const J=Math.max(P.length,V.length);for(let he=0;he<J;he++){const de=O(P,he),le=O(V,he);let Xe=!1,et;for(et of le)if(de.has(et)){Xe=!0;break}if(!Xe)return!1}const ie=P.length,ue=V.length,se=E(P),_e=E(V);return se?_e?ie===ue:ue>=ie:_e?ie>=ue:ie===ue}function X(P){return P.map(V=>bt(V)?xt(V.referToSelf.callback):Ut(V)?Re(V.referTo.references,V.referTo.callback):V)}function Y(P,V,J){const ie=[];let ue;for(ue of P){let se=J[ue];if(typeof se!="number")throw new TypeError('No definition for referenced signature "'+ue+'"');if(se=V[se],typeof se!="function")return!1;ie.push(se)}return ie}function Q(P,V,J){const ie=X(P),ue=new Array(ie.length).fill(!1);let se=!0;for(;se;){se=!1;let _e=!0;for(let he=0;he<ie.length;++he){if(ue[he])continue;const de=ie[he];if(bt(de))ie[he]=de.referToSelf.callback(J),ie[he].referToSelf=de.referToSelf,ue[he]=!0,_e=!1;else if(Ut(de)){const le=Y(de.referTo.references,ie,V);le?(ie[he]=de.referTo.callback.apply(this,le),ie[he].referTo=de.referTo,ue[he]=!0,_e=!1):se=!0}}if(_e&&se)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return ie}function pe(P){const V=/\bthis(\(|\.signatures\b)/;Object.keys(P).forEach(J=>{const ie=P[J];if(V.test(ie.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 De(P,V){if(a.createCount++,Object.keys(V).length===0)throw new SyntaxError("No signatures provided");a.warnAgainstDeprecatedThis&&pe(V);const J=[],ie=[],ue={},se=[];let _e;for(_e in V){if(!Object.prototype.hasOwnProperty.call(V,_e))continue;const Qe=C(_e);if(!Qe)continue;J.forEach(function(qn){if(j(qn,Qe))throw new TypeError('Conflicting signatures "'+y(qn)+'" and "'+y(Qe)+'".')}),J.push(Qe);const nr=ie.length;ie.push(V[_e]);const nu=Qe.map(w);let Ui;for(Ui of te(nu)){const qn=y(Ui);se.push({params:Ui,name:qn,fn:nr}),Ui.every(Ro=>!Ro.hasConversion)&&(ue[qn]=nr)}}se.sort(L);const he=Q(ie,ue,ci);let de;for(de in ue)Object.prototype.hasOwnProperty.call(ue,de)&&(ue[de]=he[ue[de]]);const le=[],Xe=new Map;for(de of se)Xe.has(de.name)||(de.fn=he[de.fn],le.push(de),Xe.set(de.name,de));const et=le[0]&&le[0].params.length<=2&&!E(le[0].params),ht=le[1]&&le[1].params.length<=2&&!E(le[1].params),kt=le[2]&&le[2].params.length<=2&&!E(le[2].params),Tt=le[3]&&le[3].params.length<=2&&!E(le[3].params),rr=le[4]&&le[4].params.length<=2&&!E(le[4].params),cr=le[5]&&le[5].params.length<=2&&!E(le[5].params),en=et&&ht&&kt&&Tt&&rr&&cr;for(let Qe=0;Qe<le.length;++Qe)le[Qe].test=B(le[Qe].params);const Dn=et?F(le[0].params[0]):Ir,fi=ht?F(le[1].params[0]):Ir,vs=kt?F(le[2].params[0]):Ir,gs=Tt?F(le[3].params[0]):Ir,ms=rr?F(le[4].params[0]):Ir,Li=cr?F(le[5].params[0]):Ir,Pi=et?F(le[0].params[1]):Ir,xs=ht?F(le[1].params[1]):Ir,ki=kt?F(le[2].params[1]):Ir,ys=Tt?F(le[3].params[1]):Ir,zn=rr?F(le[4].params[1]):Ir,Xt=cr?F(le[5].params[1]):Ir;for(let Qe=0;Qe<le.length;++Qe)le[Qe].implementation=H(le[Qe].params,le[Qe].fn);const mr=et?le[0].implementation:Di,zi=ht?le[1].implementation:Di,Ds=kt?le[2].implementation:Di,j0=Tt?le[3].implementation:Di,Y0=rr?le[4].implementation:Di,Z0=cr?le[5].implementation:Di,V0=et?le[0].params.length:-1,G0=ht?le[1].params.length:-1,K0=kt?le[2].params.length:-1,$o=Tt?le[3].params.length:-1,X0=rr?le[4].params.length:-1,Q0=cr?le[5].params.length:-1,J0=en?6:0,eu=le.length,tu=le.map(Qe=>Qe.test),ru=le.map(Qe=>Qe.implementation),qi=function(){for(let nr=J0;nr<eu;nr++)if(tu[nr](arguments))return ru[nr].apply(this,arguments);return a.onMismatch(P,arguments,le)};function ci(Qe,nr){return arguments.length===V0&&Dn(Qe)&&Pi(nr)?mr.apply(this,arguments):arguments.length===G0&&fi(Qe)&&xs(nr)?zi.apply(this,arguments):arguments.length===K0&&vs(Qe)&&ki(nr)?Ds.apply(this,arguments):arguments.length===$o&&gs(Qe)&&ys(nr)?j0.apply(this,arguments):arguments.length===X0&&ms(Qe)&&zn(nr)?Y0.apply(this,arguments):arguments.length===Q0&&Li(Qe)&&Xt(nr)?Z0.apply(this,arguments):qi.apply(this,arguments)}try{Object.defineProperty(ci,"name",{value:P})}catch{}return ci.signatures=ue,ci._typedFunctionData={signatures:le,signatureMap:Xe},ci}function we(P,V,J){throw T(P,V,J)}function Ee(P){return Fe(P,0,P.length-1)}function Oe(P){return P[P.length-1]}function Fe(P,V,J){return Array.prototype.slice.call(P,V,J)}function nt(P,V){for(let J=0;J<P.length;J++)if(V(P[J]))return P[J]}function Ye(P,V){return Array.prototype.concat.apply([],P.map(V))}function Te(){const P=Ee(arguments).map(J=>y(C(J))),V=Oe(arguments);if(typeof V!="function")throw new TypeError("Callback function expected as last argument");return Re(P,V)}function Re(P,V){return{referTo:{references:P,callback:V}}}function xt(P){if(typeof P!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:P}}}function Ut(P){return P&&typeof P.referTo=="object"&&Array.isArray(P.referTo.references)&&typeof P.referTo.callback=="function"}function bt(P){return P&&typeof P.referToSelf=="object"&&typeof P.referToSelf.callback=="function"}function ur(P,V){if(!P)return V;if(V&&V!==P){const J=new Error("Function names do not match (expected: "+P+", actual: "+V+")");throw J.data={actual:V,expected:P},J}return P}function Lr(P){let V;for(const J in P)Object.prototype.hasOwnProperty.call(P,J)&&(p(P[J])||typeof P[J].signature=="string")&&(V=ur(V,P[J].name));return V}function fr(P,V){let J;for(J in V)if(Object.prototype.hasOwnProperty.call(V,J)){if(J in P&&V[J]!==P[J]){const ie=new Error('Signature "'+J+'" is defined twice');throw ie.data={signature:J,sourceFunction:V[J],destFunction:P[J]},ie}P[J]=V[J]}}const yt=a;a=function(P){const V=typeof P=="string",J=V?1:0;let ie=V?P:"";const ue={};for(let se=J;se<arguments.length;++se){const _e=arguments[se];let he={},de;if(typeof _e=="function"?(de=_e.name,typeof _e.signature=="string"?he[_e.signature]=_e:p(_e)&&(he=_e.signatures)):s(_e)&&(he=_e,V||(de=Lr(_e))),Object.keys(he).length===0){const le=new TypeError("Argument to 'typed' at index "+se+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw le.data={index:se,argument:_e},le}V||(ie=ur(ie,de)),fr(ue,he)}return De(ie||"",ue)},a.create=Sf,a.createCount=yt.createCount,a.onMismatch=we,a.throwMismatchError=we,a.createError=T,a.clear=c,a.clearConversions=h,a.addTypes=l,a._findType=u,a.referTo=Te,a.referToSelf=xt,a.convert=_,a.findSignature=v,a.find=x,a.isTypedFunction=p,a.warnAgainstDeprecatedThis=!0,a.addType=function(P,V){let J="any";V!==!1&&r.has("Object")&&(J="Object"),a.addTypes([P],J)};function Ot(P){if(!P||typeof P.from!="string"||typeof P.to!="string"||typeof P.convert!="function")throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(P.to===P.from)throw new SyntaxError('Illegal to define conversion from "'+P.from+'" to itself.')}return a.addConversion=function(P){Ot(P);const V=u(P.to);if(V.conversionsTo.every(function(J){return J.from!==P.from}))V.conversionsTo.push({from:P.from,convert:P.convert,index:i++});else throw new Error('There is already a conversion from "'+P.from+'" to "'+V.name+'"')},a.addConversions=function(P){P.forEach(a.addConversion)},a.removeConversion=function(P){Ot(P);const V=u(P.to),J=nt(V.conversionsTo,ue=>ue.from===P.from);if(!J)throw new Error("Attempt to remove nonexistent conversion from "+P.from+" to "+P.to);if(J.convert!==P.convert)throw new Error("Conversion to remove does not match existing conversion");const ie=V.conversionsTo.indexOf(J);V.conversionsTo.splice(ie,1)},a.resolve=function(P,V){if(!p(P))throw new TypeError(Nf);const J=P._typedFunctionData.signatures;for(let ie=0;ie<J.length;++ie)if(J[ie].test(V))return J[ie];return null},a}var Of=Sf();function Et(s){return typeof s=="boolean"?!0:isFinite(s)?s===Math.round(s):!1}function Fa(s,e,t){var r={2:"0b",8:"0o",16:"0x"},n=r[e],i="";if(t){if(t<1)throw new Error("size must be in greater than 0");if(!Et(t))throw new Error("size must be an integer");if(s>2**(t-1)-1||s<-(2**(t-1)))throw new Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!Et(s))throw new Error("Value must be an integer");s<0&&(s=s+2**t),i="i".concat(t)}var a="";return s<0&&(s=-s,a="-"),"".concat(a).concat(n).concat(s.toString(e)).concat(i)}function Ba(s,e){if(typeof e=="function")return e(s);if(s===1/0)return"Infinity";if(s===-1/0)return"-Infinity";if(isNaN(s))return"NaN";var{notation:t,precision:r,wordSize:n}=Tf(e);switch(t){case"fixed":return Q1(s,r);case"exponential":return If(s,r);case"engineering":return X1(s,r);case"bin":return Fa(s,2,n);case"oct":return Fa(s,8,n);case"hex":return Fa(s,16,n);case"auto":return J1(s,r,e).replace(/((\.\d*?)(0+))($|e)/,function(){var i=arguments[2],a=arguments[4];return i!=="."?i+a:a});default:throw new Error('Unknown notation "'+t+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function Tf(s){var e="auto",t,r;if(s!==void 0)if(pt(s))t=s;else if(St(s))t=s.toNumber();else if(Ca(s))s.precision!==void 0&&(t=$f(s.precision,()=>{throw new Error('Option "precision" must be a number or BigNumber')})),s.wordSize!==void 0&&(r=$f(s.wordSize,()=>{throw new Error('Option "wordSize" must be a number or BigNumber')})),s.notation&&(e=s.notation);else throw new Error("Unsupported type of options, number, BigNumber, or object expected");return{notation:e,precision:t,wordSize:r}}function Ws(s){var e=String(s).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!e)throw new SyntaxError("Invalid number "+s);var t=e[1],r=e[2],n=parseFloat(e[4]||"0"),i=r.indexOf(".");n+=i!==-1?i-1:r.length-1;var a=r.replace(".","").replace(/^0*/,function(u){return n-=u.length,""}).replace(/0*$/,"").split("").map(function(u){return parseInt(u)});return a.length===0&&(a.push(0),n++),{sign:t,coefficients:a,exponent:n}}function X1(s,e){if(isNaN(s)||!isFinite(s))return String(s);var t=Ws(s),r=Hs(t,e),n=r.exponent,i=r.coefficients,a=n%3===0?n:n<0?n-3-n%3:n-n%3;if(pt(e))for(;e>i.length||n-a+1>i.length;)i.push(0);else for(var u=Math.abs(n-a)-(i.length-1),l=0;l<u;l++)i.push(0);for(var c=Math.abs(n-a),h=1;c>0;)h++,c--;var d=i.slice(h).join(""),p=pt(e)&&d.length||d.match(/[1-9]/)?"."+d:"",v=i.slice(0,h).join("")+p+"e"+(n>=0?"+":"")+a.toString();return r.sign+v}function Q1(s,e){if(isNaN(s)||!isFinite(s))return String(s);var t=Ws(s),r=typeof e=="number"?Hs(t,t.exponent+1+e):t,n=r.coefficients,i=r.exponent+1,a=i+(e||0);return n.length<a&&(n=n.concat(wi(a-n.length))),i<0&&(n=wi(-i+1).concat(n),i=1),i<n.length&&n.splice(i,0,i===0?"0.":"."),r.sign+n.join("")}function If(s,e){if(isNaN(s)||!isFinite(s))return String(s);var t=Ws(s),r=e?Hs(t,e):t,n=r.coefficients,i=r.exponent;n.length<e&&(n=n.concat(wi(e-n.length)));var a=n.shift();return r.sign+a+(n.length>0?"."+n.join(""):"")+"e"+(i>=0?"+":"")+i}function J1(s,e,t){if(isNaN(s)||!isFinite(s))return String(s);var r=Rf(t==null?void 0:t.lowerExp,-3),n=Rf(t==null?void 0:t.upperExp,5),i=Ws(s),a=e?Hs(i,e):i;if(a.exponent<r||a.exponent>=n)return If(s,e);var u=a.coefficients,l=a.exponent;u.length<e&&(u=u.concat(wi(e-u.length))),u=u.concat(wi(l-u.length+1+(u.length<e?e-u.length:0))),u=wi(-l).concat(u);var c=l>0?l:0;return c<u.length-1&&u.splice(c+1,0,"."),a.sign+u.join("")}function Hs(s,e){for(var t={sign:s.sign,coefficients:s.coefficients,exponent:s.exponent},r=t.coefficients;e<=0;)r.unshift(0),t.exponent++,e++;if(r.length>e){var n=r.splice(e,r.length-e);if(n[0]>=5){var i=e-1;for(r[i]++;r[i]===10;)r.pop(),i===0&&(r.unshift(0),t.exponent++,i++),i--,r[i]++}}return t}function wi(s){for(var e=[],t=0;t<s;t++)e.push(0);return e}function e_(s){return s.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length}var t_=Number.EPSILON||2220446049250313e-31;function ti(s,e,t){if(t==null)return s===e;if(s===e)return!0;if(isNaN(s)||isNaN(e))return!1;if(isFinite(s)&&isFinite(e)){var r=Math.abs(s-e);return r<=t_?!0:r<=Math.max(Math.abs(s),Math.abs(e))*t}return!1}function $f(s,e){if(pt(s))return s;if(St(s))return s.toNumber();e()}function Rf(s,e){return pt(s)?s:St(s)?s.toNumber():e}function Ma(s,e,t){var r=s.constructor,n=new r(2),i="";if(t){if(t<1)throw new Error("size must be in greater than 0");if(!Et(t))throw new Error("size must be an integer");if(s.greaterThan(n.pow(t-1).sub(1))||s.lessThan(n.pow(t-1).mul(-1)))throw new Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!s.isInteger())throw new Error("Value must be an integer");s.lessThan(0)&&(s=s.add(n.pow(t))),i="i".concat(t)}switch(e){case 2:return"".concat(s.toBinary()).concat(i);case 8:return"".concat(s.toOctal()).concat(i);case 16:return"".concat(s.toHexadecimal()).concat(i);default:throw new Error("Base ".concat(e," not supported "))}}function r_(s,e){if(typeof e=="function")return e(s);if(!s.isFinite())return s.isNaN()?"NaN":s.gt(0)?"Infinity":"-Infinity";var{notation:t,precision:r,wordSize:n}=Tf(e);switch(t){case"fixed":return i_(s,r);case"exponential":return Lf(s,r);case"engineering":return n_(s,r);case"bin":return Ma(s,2,n);case"oct":return Ma(s,8,n);case"hex":return Ma(s,16,n);case"auto":{var i=Pf(e==null?void 0:e.lowerExp,-3),a=Pf(e==null?void 0:e.upperExp,5);if(s.isZero())return"0";var u,l=s.toSignificantDigits(r),c=l.e;return c>=i&&c<a?u=l.toFixed():u=Lf(s,r),u.replace(/((\.\d*?)(0+))($|e)/,function(){var h=arguments[2],d=arguments[4];return h!=="."?h+d:d})}default:throw new Error('Unknown notation "'+t+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function n_(s,e){var t=s.e,r=t%3===0?t:t<0?t-3-t%3:t-t%3,n=s.mul(Math.pow(10,-r)),i=n.toPrecision(e);if(i.indexOf("e")!==-1){var a=s.constructor;i=new a(i).toFixed()}return i+"e"+(t>=0?"+":"")+r.toString()}function Lf(s,e){return e!==void 0?s.toExponential(e-1):s.toExponential()}function i_(s,e){return s.toFixed(e)}function Pf(s,e){return pt(s)?s:St(s)?s.toNumber():e}function ct(s,e){var t=s_(s,e);return e&&typeof e=="object"&&"truncate"in e&&t.length>e.truncate?t.substring(0,e.truncate-3)+"...":t}function s_(s,e){if(typeof s=="number")return Ba(s,e);if(St(s))return r_(s,e);if(o_(s))return!e||e.fraction!=="decimal"?s.s*s.n+"/"+s.d:s.toString();if(Array.isArray(s))return qf(s,e);if(un(s))return kf(s);if(typeof s=="function")return s.syntax?String(s.syntax):"function";if(s&&typeof s=="object"){if(typeof s.format=="function")return s.format(e);if(s&&s.toString(e)!=={}.toString())return s.toString(e);var t=Object.keys(s).map(r=>kf(r)+": "+ct(s[r],e));return"{"+t.join(", ")+"}"}return String(s)}function kf(s){for(var e=String(s),t="",r=0;r<e.length;){var n=e.charAt(r);t+=n in zf?zf[n]:n,r++}return'"'+t+'"'}var zf={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"};function qf(s,e){if(Array.isArray(s)){for(var t="[",r=s.length,n=0;n<r;n++)n!==0&&(t+=", "),t+=qf(s[n],e);return t+="]",t}else return ct(s,e)}function o_(s){return s&&typeof s=="object"&&typeof s.s=="number"&&typeof s.n=="number"&&typeof s.d=="number"||!1}function rt(s,e,t){if(!(this instanceof rt))throw new SyntaxError("Constructor must be called with the new operator");this.actual=s,this.expected=e,this.relation=t,this.message="Dimension mismatch ("+(Array.isArray(s)?"["+s.join(", ")+"]":s)+" "+(this.relation||"!=")+" "+(Array.isArray(e)?"["+e.join(", ")+"]":e)+")",this.stack=new Error().stack}rt.prototype=new RangeError,rt.prototype.constructor=RangeError,rt.prototype.name="DimensionError",rt.prototype.isDimensionError=!0;function On(s,e,t){if(!(this instanceof On))throw new SyntaxError("Constructor must be called with the new operator");this.index=s,arguments.length<3?(this.min=0,this.max=e):(this.min=e,this.max=t),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}On.prototype=new RangeError,On.prototype.constructor=RangeError,On.prototype.name="IndexError",On.prototype.isIndexError=!0;function Lt(s){for(var e=[];Array.isArray(s);)e.push(s.length),s=s[0];return e}function Uf(s,e,t){var r,n=s.length;if(n!==e[t])throw new rt(n,e[t]);if(t<e.length-1){var i=t+1;for(r=0;r<n;r++){var a=s[r];if(!Array.isArray(a))throw new rt(e.length-1,e.length,"<");Uf(s[r],e,i)}}else for(r=0;r<n;r++)if(Array.isArray(s[r]))throw new rt(e.length+1,e.length,">")}function Wf(s,e){var t=e.length===0;if(t){if(Array.isArray(s))throw new rt(s.length,0)}else Uf(s,e,0)}function Ft(s,e){if(s!==void 0){if(!pt(s)||!Et(s))throw new TypeError("Index must be an integer (value: "+s+")");if(s<0||typeof e=="number"&&s>=e)throw new On(s,e)}}function Na(s,e,t){if(!Array.isArray(e))throw new TypeError("Array expected");if(e.length===0)throw new Error("Resizing to scalar is not supported");e.forEach(function(n){if(!pt(n)||!Et(n)||n<0)throw new TypeError("Invalid size, must contain positive integers (size: "+ct(e)+")")}),(pt(s)||St(s))&&(s=[s]);var r=t!==void 0?t:0;return Sa(s,e,0,r),s}function Sa(s,e,t,r){var n,i,a=s.length,u=e[t],l=Math.min(a,u);if(s.length=u,t<e.length-1){var c=t+1;for(n=0;n<l;n++)i=s[n],Array.isArray(i)||(i=[i],s[n]=i),Sa(i,e,c,r);for(n=l;n<u;n++)i=[],s[n]=i,Sa(i,e,c,r)}else{for(n=0;n<l;n++)for(;Array.isArray(s[n]);)s[n]=s[n][0];for(n=l;n<u;n++)s[n]=r}}function Oa(s,e){var t=Ia(s),r=t.length;if(!Array.isArray(s)||!Array.isArray(e))throw new TypeError("Array expected");if(e.length===0)throw new rt(0,r,"!=");e=Ta(e,r);var n=Hf(e);if(r!==n)throw new rt(n,r,"!=");try{return a_(t,e)}catch(i){throw i instanceof rt?new rt(n,r,"!="):i}}function Ta(s,e){var t=Hf(s),r=s.slice(),n=-1,i=s.indexOf(n),a=s.indexOf(n,i+1)>=0;if(a)throw new Error("More than one wildcard in sizes");var u=i>=0,l=e%t===0;if(u)if(l)r[i]=-e/t;else throw new Error("Could not replace wildcard, since "+e+" is no multiple of "+-t);return r}function Hf(s){return s.reduce((e,t)=>e*t,1)}function a_(s,e){for(var t=s,r,n=e.length-1;n>0;n--){var i=e[n];r=[];for(var a=t.length/i,u=0;u<a;u++)r.push(t.slice(u*i,(u+1)*i));t=r}return t}function jf(s,e,t,r){var n=r||Lt(s);if(t)for(var i=0;i<t;i++)s=[s],n.unshift(1);for(s=Yf(s,e,0);n.length<e;)n.push(1);return s}function Yf(s,e,t){var r,n;if(Array.isArray(s)){var i=t+1;for(r=0,n=s.length;r<n;r++)s[r]=Yf(s[r],e,i)}else for(var a=t;a<e;a++)s=[s];return s}function Ia(s){if(!Array.isArray(s))return s;var e=[];return s.forEach(function t(r){Array.isArray(r)?r.forEach(t):e.push(r)}),e}function js(s,e){for(var t,r=0,n=0;n<s.length;n++){var i=s[n],a=Array.isArray(i);if(n===0&&a&&(r=i.length),a&&i.length!==r)return;var u=a?js(i,e):e(i);if(t===void 0)t=u;else if(t!==u)return"mixed"}return t}function Zf(s,e,t,r){if(r<t){if(s.length!==e.length)throw new rt(s.length,e.length);for(var n=[],i=0;i<s.length;i++)n[i]=Zf(s[i],e[i],t,r+1);return n}else return s.concat(e)}function Vf(){var s=Array.prototype.slice.call(arguments,0,-1),e=Array.prototype.slice.call(arguments,-1);if(s.length===1)return s[0];if(s.length>1)return s.slice(1).reduce(function(t,r){return Zf(t,r,e,0)},s[0]);throw new Error("Wrong number of arguments in function concat")}function u_(){for(var s=arguments.length,e=new Array(s),t=0;t<s;t++)e[t]=arguments[t];for(var r=e.map(p=>p.length),n=Math.max(...r),i=new Array(n).fill(null),a=0;a<e.length;a++)for(var u=e[a],l=r[a],c=0;c<l;c++){var h=n-l+c;u[c]>i[h]&&(i[h]=u[c])}for(var d=0;d<e.length;d++)Ys(e[d],i);return i}function Ys(s,e){for(var t=e.length,r=s.length,n=0;n<r;n++){var i=t-r+n;if(s[n]<e[i]&&s[n]>1||s[n]>e[i])throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(s,") not possible to broadcast dimension ").concat(r," with size ").concat(s[n]," to size ").concat(e[i]))}}function Gf(s,e){var t=Lt(s);if(yi(t,e))return s;Ys(t,e);var r=u_(t,e),n=r.length,i=[...Array(n-t.length).fill(1),...t],a=c_(s);t.length<n&&(a=Oa(a,i),t=Lt(a));for(var u=0;u<n;u++)t[u]<r[u]&&(a=f_(a,r[u],u),t=Lt(a));return a}function f_(s,e,t){return Vf(...Array(e).fill(s),t)}function c_(s){return Us([],s)}function xe(s,e,t,r){function n(i){var a=V1(i,e.map(d_));return l_(s,e,i),t(a)}return n.isFactory=!0,n.fn=s,n.dependencies=e.slice().sort(),r&&(n.meta=r),n}function l_(s,e,t){var r=e.filter(i=>!h_(i)).every(i=>t[i]!==void 0);if(!r){var n=e.filter(i=>t[i]===void 0);throw new Error('Cannot create function "'.concat(s,'", ')+"some dependencies are missing: ".concat(n.map(i=>'"'.concat(i,'"')).join(", "),"."))}}function h_(s){return s&&s[0]==="?"}function d_(s){return s&&s[0]==="?"?s.slice(1):s}function p_(s,e){if(Xf(s)&&Kf(s,e))return s[e];throw typeof s[e]=="function"&&g_(s,e)?new Error('Cannot access method "'+e+'" as a property'):new Error('No access to property "'+e+'"')}function __(s,e,t){if(Xf(s)&&Kf(s,e))return s[e]=t,t;throw new Error('No access to property "'+e+'"')}function v_(s,e){return e in s}function Kf(s,e){return!s||typeof s!="object"?!1:ss(m_,e)?!0:!(e in Object.prototype||e in Function.prototype)}function g_(s,e){return s==null||typeof s[e]!="function"||ss(s,e)&&Object.getPrototypeOf&&e in Object.getPrototypeOf(s)?!1:ss(x_,e)?!0:!(e in Object.prototype||e in Function.prototype)}function Xf(s){return typeof s=="object"&&s&&s.constructor===Object}var m_={length:!0,name:!0},x_={toString:!0,valueOf:!0,toLocaleString:!0};class y_{constructor(e){this.wrappedObject=e,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).values()}get(e){return p_(this.wrappedObject,e)}set(e,t){return __(this.wrappedObject,e,t),this}has(e){return v_(this.wrappedObject,e)}entries(){return D_(this.keys(),e=>[e,this.get(e)])}forEach(e){for(var t of this.keys())e(this.get(t),t,this)}delete(e){delete this.wrappedObject[e]}clear(){for(var e of this.keys())this.delete(e)}get size(){return Object.keys(this.wrappedObject).length}}function D_(s,e){return{next:()=>{var t=s.next();return t.done?t:{value:e(t.value),done:!1}}}}function w_(s){return s?s instanceof Map||s instanceof y_||typeof s.set=="function"&&typeof s.get=="function"&&typeof s.keys=="function"&&typeof s.has=="function":!1}var Qf=function(){return Qf=Of.create,Of},E_=["?BigNumber","?Complex","?DenseMatrix","?Fraction"],b_=xe("typed",E_,function(e){var{BigNumber:t,Complex:r,DenseMatrix:n,Fraction:i}=e,a=Qf();return a.clear(),a.addTypes([{name:"number",test:pt},{name:"Complex",test:Af},{name:"BigNumber",test:St},{name:"Fraction",test:Cf},{name:"Unit",test:Ff},{name:"identifier",test:u=>un&&/^(?:[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(u)},{name:"string",test:un},{name:"Chain",test:Y1},{name:"Array",test:Ct},{name:"Matrix",test:mt},{name:"DenseMatrix",test:x1},{name:"SparseMatrix",test:y1},{name:"Range",test:D1},{name:"Index",test:Aa},{name:"boolean",test:w1},{name:"ResultSet",test:E1},{name:"Help",test:b1},{name:"function",test:A1},{name:"Date",test:C1},{name:"RegExp",test:F1},{name:"null",test:B1},{name:"undefined",test:M1},{name:"AccessorNode",test:N1},{name:"ArrayNode",test:S1},{name:"AssignmentNode",test:O1},{name:"BlockNode",test:T1},{name:"ConditionalNode",test:I1},{name:"ConstantNode",test:$1},{name:"FunctionNode",test:L1},{name:"FunctionAssignmentNode",test:R1},{name:"IndexNode",test:P1},{name:"Node",test:k1},{name:"ObjectNode",test:z1},{name:"OperatorNode",test:q1},{name:"ParenthesisNode",test:U1},{name:"RangeNode",test:W1},{name:"RelationalNode",test:H1},{name:"SymbolNode",test:j1},{name:"Map",test:w_},{name:"Object",test:Ca}]),a.addConversions([{from:"number",to:"BigNumber",convert:function(l){if(t||$a(l),e_(l)>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+l+"). Use function bignumber(x) to convert to BigNumber.");return new t(l)}},{from:"number",to:"Complex",convert:function(l){return r||Zs(l),new r(l,0)}},{from:"BigNumber",to:"Complex",convert:function(l){return r||Zs(l),new r(l.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(l){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(l){return r||Zs(l),new r(l.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(l){i||Ra(l);var c=new i(l);if(c.valueOf()!==l)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+l+"). Use function fraction(x) to convert to Fraction.");return c}},{from:"string",to:"number",convert:function(l){var c=Number(l);if(isNaN(c))throw new Error('Cannot convert "'+l+'" to a number');return c}},{from:"string",to:"BigNumber",convert:function(l){t||$a(l);try{return new t(l)}catch{throw new Error('Cannot convert "'+l+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(l){i||Ra(l);try{return new i(l)}catch{throw new Error('Cannot convert "'+l+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(l){r||Zs(l);try{return new r(l)}catch{throw new Error('Cannot convert "'+l+'" to Complex')}}},{from:"boolean",to:"number",convert:function(l){return+l}},{from:"boolean",to:"BigNumber",convert:function(l){return t||$a(l),new t(+l)}},{from:"boolean",to:"Fraction",convert:function(l){return i||Ra(l),new i(+l)}},{from:"boolean",to:"string",convert:function(l){return String(l)}},{from:"Array",to:"Matrix",convert:function(l){return n||A_(),new n(l)}},{from:"Matrix",to:"Array",convert:function(l){return l.valueOf()}}]),a.onMismatch=(u,l,c)=>{var h=a.createError(u,l,c);if(["wrongType","mismatch"].includes(h.data.category)&&l.length===1&&is(l[0])&&c.some(p=>!p.params.includes(","))){var d=new TypeError("Function '".concat(u,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(u,")'."));throw d.data=h.data,d}throw h},a.onMismatch=(u,l,c)=>{var h=a.createError(u,l,c);if(["wrongType","mismatch"].includes(h.data.category)&&l.length===1&&is(l[0])&&c.some(p=>!p.params.includes(","))){var d=new TypeError("Function '".concat(u,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(u,")'."));throw d.data=h.data,d}throw h},a});function $a(s){throw new Error("Cannot convert value ".concat(s," into a BigNumber: no class 'BigNumber' provided"))}function Zs(s){throw new Error("Cannot convert value ".concat(s," into a Complex number: no class 'Complex' provided"))}function A_(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}function Ra(s){throw new Error("Cannot convert value ".concat(s," into a Fraction, no class 'Fraction' provided."))}/*!
35
+ * decimal.js v10.4.3
36
+ * An arbitrary-precision Decimal type for JavaScript.
37
+ * https://github.com/MikeMcl/decimal.js
38
+ * Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
39
+ * MIT Licence
40
+ */var Ei=9e15,Tn=1e9,La="0123456789abcdef",Vs="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Gs="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Pa={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Ei,maxE:Ei,crypto:!1},Jf,gn,$e=!0,Ks="[DecimalError] ",In=Ks+"Invalid argument: ",ec=Ks+"Precision limit exceeded",tc=Ks+"crypto unavailable",rc="[object Decimal]",er=Math.floor,qt=Math.pow,C_=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,F_=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,B_=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,nc=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Xr=1e7,Be=7,M_=9007199254740991,N_=Vs.length-1,ka=Gs.length-1,fe={toStringTag:rc};fe.absoluteValue=fe.abs=function(){var s=new this.constructor(this);return s.s<0&&(s.s=1),Ce(s)},fe.ceil=function(){return Ce(new this.constructor(this),this.e+1,2)},fe.clampedTo=fe.clamp=function(s,e){var t,r=this,n=r.constructor;if(s=new n(s),e=new n(e),!s.s||!e.s)return new n(NaN);if(s.gt(e))throw Error(In+e);return t=r.cmp(s),t<0?s:r.cmp(e)>0?e:new n(r)},fe.comparedTo=fe.cmp=function(s){var e,t,r,n,i=this,a=i.d,u=(s=new i.constructor(s)).d,l=i.s,c=s.s;if(!a||!u)return!l||!c?NaN:l!==c?l:a===u?0:!a^l<0?1:-1;if(!a[0]||!u[0])return a[0]?l:u[0]?-c:0;if(l!==c)return l;if(i.e!==s.e)return i.e>s.e^l<0?1:-1;for(r=a.length,n=u.length,e=0,t=r<n?r:n;e<t;++e)if(a[e]!==u[e])return a[e]>u[e]^l<0?1:-1;return r===n?0:r>n^l<0?1:-1},fe.cosine=fe.cos=function(){var s,e,t=this,r=t.constructor;return t.d?t.d[0]?(s=r.precision,e=r.rounding,r.precision=s+Math.max(t.e,t.sd())+Be,r.rounding=1,t=S_(r,fc(r,t)),r.precision=s,r.rounding=e,Ce(gn==2||gn==3?t.neg():t,s,e,!0)):new r(1):new r(NaN)},fe.cubeRoot=fe.cbrt=function(){var s,e,t,r,n,i,a,u,l,c,h=this,d=h.constructor;if(!h.isFinite()||h.isZero())return new d(h);for($e=!1,i=h.s*qt(h.s*h,1/3),!i||Math.abs(i)==1/0?(t=Vt(h.d),s=h.e,(i=(s-t.length+1)%3)&&(t+=i==1||i==-2?"0":"00"),i=qt(t,1/3),s=er((s+1)/3)-(s%3==(s<0?-1:2)),i==1/0?t="5e"+s:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+s),r=new d(t),r.s=h.s):r=new d(i.toString()),a=(s=d.precision)+3;;)if(u=r,l=u.times(u).times(u),c=l.plus(h),r=lt(c.plus(h).times(u),c.plus(l),a+2,1),Vt(u.d).slice(0,a)===(t=Vt(r.d)).slice(0,a))if(t=t.slice(a-3,a+1),t=="9999"||!n&&t=="4999"){if(!n&&(Ce(u,s+1,0),u.times(u).times(u).eq(h))){r=u;break}a+=4,n=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(Ce(r,s+1,1),e=!r.times(r).times(r).eq(h));break}return $e=!0,Ce(r,s,d.rounding,e)},fe.decimalPlaces=fe.dp=function(){var s,e=this.d,t=NaN;if(e){if(s=e.length-1,t=(s-er(this.e/Be))*Be,s=e[s],s)for(;s%10==0;s/=10)t--;t<0&&(t=0)}return t},fe.dividedBy=fe.div=function(s){return lt(this,new this.constructor(s))},fe.dividedToIntegerBy=fe.divToInt=function(s){var e=this,t=e.constructor;return Ce(lt(e,new t(s),0,1,1),t.precision,t.rounding)},fe.equals=fe.eq=function(s){return this.cmp(s)===0},fe.floor=function(){return Ce(new this.constructor(this),this.e+1,3)},fe.greaterThan=fe.gt=function(s){return this.cmp(s)>0},fe.greaterThanOrEqualTo=fe.gte=function(s){var e=this.cmp(s);return e==1||e===0},fe.hyperbolicCosine=fe.cosh=function(){var s,e,t,r,n,i=this,a=i.constructor,u=new a(1);if(!i.isFinite())return new a(i.s?1/0:NaN);if(i.isZero())return u;t=a.precision,r=a.rounding,a.precision=t+Math.max(i.e,i.sd())+4,a.rounding=1,n=i.d.length,n<32?(s=Math.ceil(n/3),e=(1/eo(4,s)).toString()):(s=16,e="2.3283064365386962890625e-10"),i=bi(a,1,i.times(e),new a(1),!0);for(var l,c=s,h=new a(8);c--;)l=i.times(i),i=u.minus(l.times(h.minus(l.times(h))));return Ce(i,a.precision=t,a.rounding=r,!0)},fe.hyperbolicSine=fe.sinh=function(){var s,e,t,r,n=this,i=n.constructor;if(!n.isFinite()||n.isZero())return new i(n);if(e=i.precision,t=i.rounding,i.precision=e+Math.max(n.e,n.sd())+4,i.rounding=1,r=n.d.length,r<3)n=bi(i,2,n,n,!0);else{s=1.4*Math.sqrt(r),s=s>16?16:s|0,n=n.times(1/eo(5,s)),n=bi(i,2,n,n,!0);for(var a,u=new i(5),l=new i(16),c=new i(20);s--;)a=n.times(n),n=n.times(u.plus(a.times(l.times(a).plus(c))))}return i.precision=e,i.rounding=t,Ce(n,e,t,!0)},fe.hyperbolicTangent=fe.tanh=function(){var s,e,t=this,r=t.constructor;return t.isFinite()?t.isZero()?new r(t):(s=r.precision,e=r.rounding,r.precision=s+7,r.rounding=1,lt(t.sinh(),t.cosh(),r.precision=s,r.rounding=e)):new r(t.s)},fe.inverseCosine=fe.acos=function(){var s,e=this,t=e.constructor,r=e.abs().cmp(1),n=t.precision,i=t.rounding;return r!==-1?r===0?e.isNeg()?Qr(t,n,i):new t(0):new t(NaN):e.isZero()?Qr(t,n+4,i).times(.5):(t.precision=n+6,t.rounding=1,e=e.asin(),s=Qr(t,n+4,i).times(.5),t.precision=n,t.rounding=i,s.minus(e))},fe.inverseHyperbolicCosine=fe.acosh=function(){var s,e,t=this,r=t.constructor;return t.lte(1)?new r(t.eq(1)?0:NaN):t.isFinite()?(s=r.precision,e=r.rounding,r.precision=s+Math.max(Math.abs(t.e),t.sd())+4,r.rounding=1,$e=!1,t=t.times(t).minus(1).sqrt().plus(t),$e=!0,r.precision=s,r.rounding=e,t.ln()):new r(t)},fe.inverseHyperbolicSine=fe.asinh=function(){var s,e,t=this,r=t.constructor;return!t.isFinite()||t.isZero()?new r(t):(s=r.precision,e=r.rounding,r.precision=s+2*Math.max(Math.abs(t.e),t.sd())+6,r.rounding=1,$e=!1,t=t.times(t).plus(1).sqrt().plus(t),$e=!0,r.precision=s,r.rounding=e,t.ln())},fe.inverseHyperbolicTangent=fe.atanh=function(){var s,e,t,r,n=this,i=n.constructor;return n.isFinite()?n.e>=0?new i(n.abs().eq(1)?n.s/0:n.isZero()?n:NaN):(s=i.precision,e=i.rounding,r=n.sd(),Math.max(r,s)<2*-n.e-1?Ce(new i(n),s,e,!0):(i.precision=t=r-n.e,n=lt(n.plus(1),new i(1).minus(n),t+s,1),i.precision=s+4,i.rounding=1,n=n.ln(),i.precision=s,i.rounding=e,n.times(.5))):new i(NaN)},fe.inverseSine=fe.asin=function(){var s,e,t,r,n=this,i=n.constructor;return n.isZero()?new i(n):(e=n.abs().cmp(1),t=i.precision,r=i.rounding,e!==-1?e===0?(s=Qr(i,t+4,r).times(.5),s.s=n.s,s):new i(NaN):(i.precision=t+6,i.rounding=1,n=n.div(new i(1).minus(n.times(n)).sqrt().plus(1)).atan(),i.precision=t,i.rounding=r,n.times(2)))},fe.inverseTangent=fe.atan=function(){var s,e,t,r,n,i,a,u,l,c=this,h=c.constructor,d=h.precision,p=h.rounding;if(c.isFinite()){if(c.isZero())return new h(c);if(c.abs().eq(1)&&d+4<=ka)return a=Qr(h,d+4,p).times(.25),a.s=c.s,a}else{if(!c.s)return new h(NaN);if(d+4<=ka)return a=Qr(h,d+4,p).times(.5),a.s=c.s,a}for(h.precision=u=d+10,h.rounding=1,t=Math.min(28,u/Be+2|0),s=t;s;--s)c=c.div(c.times(c).plus(1).sqrt().plus(1));for($e=!1,e=Math.ceil(u/Be),r=1,l=c.times(c),a=new h(c),n=c;s!==-1;)if(n=n.times(l),i=a.minus(n.div(r+=2)),n=n.times(l),a=i.plus(n.div(r+=2)),a.d[e]!==void 0)for(s=e;a.d[s]===i.d[s]&&s--;);return t&&(a=a.times(2<<t-1)),$e=!0,Ce(a,h.precision=d,h.rounding=p,!0)},fe.isFinite=function(){return!!this.d},fe.isInteger=fe.isInt=function(){return!!this.d&&er(this.e/Be)>this.d.length-2},fe.isNaN=function(){return!this.s},fe.isNegative=fe.isNeg=function(){return this.s<0},fe.isPositive=fe.isPos=function(){return this.s>0},fe.isZero=function(){return!!this.d&&this.d[0]===0},fe.lessThan=fe.lt=function(s){return this.cmp(s)<0},fe.lessThanOrEqualTo=fe.lte=function(s){return this.cmp(s)<1},fe.logarithm=fe.log=function(s){var e,t,r,n,i,a,u,l,c=this,h=c.constructor,d=h.precision,p=h.rounding,v=5;if(s==null)s=new h(10),e=!0;else{if(s=new h(s),t=s.d,s.s<0||!t||!t[0]||s.eq(1))return new h(NaN);e=s.eq(10)}if(t=c.d,c.s<0||!t||!t[0]||c.eq(1))return new h(t&&!t[0]?-1/0:c.s!=1?NaN:t?0:1/0);if(e)if(t.length>1)i=!0;else{for(n=t[0];n%10===0;)n/=10;i=n!==1}if($e=!1,u=d+v,a=Rn(c,u),r=e?Js(h,u+10):Rn(s,u),l=lt(a,r,u,1),os(l.d,n=d,p))do if(u+=10,a=Rn(c,u),r=e?Js(h,u+10):Rn(s,u),l=lt(a,r,u,1),!i){+Vt(l.d).slice(n+1,n+15)+1==1e14&&(l=Ce(l,d+1,0));break}while(os(l.d,n+=10,p));return $e=!0,Ce(l,d,p)},fe.minus=fe.sub=function(s){var e,t,r,n,i,a,u,l,c,h,d,p,v=this,x=v.constructor;if(s=new x(s),!v.d||!s.d)return!v.s||!s.s?s=new x(NaN):v.d?s.s=-s.s:s=new x(s.d||v.s!==s.s?v:NaN),s;if(v.s!=s.s)return s.s=-s.s,v.plus(s);if(c=v.d,p=s.d,u=x.precision,l=x.rounding,!c[0]||!p[0]){if(p[0])s.s=-s.s;else if(c[0])s=new x(v);else return new x(l===3?-0:0);return $e?Ce(s,u,l):s}if(t=er(s.e/Be),h=er(v.e/Be),c=c.slice(),i=h-t,i){for(d=i<0,d?(e=c,i=-i,a=p.length):(e=p,t=h,a=c.length),r=Math.max(Math.ceil(u/Be),a)+2,i>r&&(i=r,e.length=1),e.reverse(),r=i;r--;)e.push(0);e.reverse()}else{for(r=c.length,a=p.length,d=r<a,d&&(a=r),r=0;r<a;r++)if(c[r]!=p[r]){d=c[r]<p[r];break}i=0}for(d&&(e=c,c=p,p=e,s.s=-s.s),a=c.length,r=p.length-a;r>0;--r)c[a++]=0;for(r=p.length;r>i;){if(c[--r]<p[r]){for(n=r;n&&c[--n]===0;)c[n]=Xr-1;--c[n],c[r]+=Xr}c[r]-=p[r]}for(;c[--a]===0;)c.pop();for(;c[0]===0;c.shift())--t;return c[0]?(s.d=c,s.e=Qs(c,t),$e?Ce(s,u,l):s):new x(l===3?-0:0)},fe.modulo=fe.mod=function(s){var e,t=this,r=t.constructor;return s=new r(s),!t.d||!s.s||s.d&&!s.d[0]?new r(NaN):!s.d||t.d&&!t.d[0]?Ce(new r(t),r.precision,r.rounding):($e=!1,r.modulo==9?(e=lt(t,s.abs(),0,3,1),e.s*=s.s):e=lt(t,s,0,r.modulo,1),e=e.times(s),$e=!0,t.minus(e))},fe.naturalExponential=fe.exp=function(){return za(this)},fe.naturalLogarithm=fe.ln=function(){return Rn(this)},fe.negated=fe.neg=function(){var s=new this.constructor(this);return s.s=-s.s,Ce(s)},fe.plus=fe.add=function(s){var e,t,r,n,i,a,u,l,c,h,d=this,p=d.constructor;if(s=new p(s),!d.d||!s.d)return!d.s||!s.s?s=new p(NaN):d.d||(s=new p(s.d||d.s===s.s?d:NaN)),s;if(d.s!=s.s)return s.s=-s.s,d.minus(s);if(c=d.d,h=s.d,u=p.precision,l=p.rounding,!c[0]||!h[0])return h[0]||(s=new p(d)),$e?Ce(s,u,l):s;if(i=er(d.e/Be),r=er(s.e/Be),c=c.slice(),n=i-r,n){for(n<0?(t=c,n=-n,a=h.length):(t=h,r=i,a=c.length),i=Math.ceil(u/Be),a=i>a?i+1:a+1,n>a&&(n=a,t.length=1),t.reverse();n--;)t.push(0);t.reverse()}for(a=c.length,n=h.length,a-n<0&&(n=a,t=h,h=c,c=t),e=0;n;)e=(c[--n]=c[n]+h[n]+e)/Xr|0,c[n]%=Xr;for(e&&(c.unshift(e),++r),a=c.length;c[--a]==0;)c.pop();return s.d=c,s.e=Qs(c,r),$e?Ce(s,u,l):s},fe.precision=fe.sd=function(s){var e,t=this;if(s!==void 0&&s!==!!s&&s!==1&&s!==0)throw Error(In+s);return t.d?(e=ic(t.d),s&&t.e+1>e&&(e=t.e+1)):e=NaN,e},fe.round=function(){var s=this,e=s.constructor;return Ce(new e(s),s.e+1,e.rounding)},fe.sine=fe.sin=function(){var s,e,t=this,r=t.constructor;return t.isFinite()?t.isZero()?new r(t):(s=r.precision,e=r.rounding,r.precision=s+Math.max(t.e,t.sd())+Be,r.rounding=1,t=T_(r,fc(r,t)),r.precision=s,r.rounding=e,Ce(gn>2?t.neg():t,s,e,!0)):new r(NaN)},fe.squareRoot=fe.sqrt=function(){var s,e,t,r,n,i,a=this,u=a.d,l=a.e,c=a.s,h=a.constructor;if(c!==1||!u||!u[0])return new h(!c||c<0&&(!u||u[0])?NaN:u?a:1/0);for($e=!1,c=Math.sqrt(+a),c==0||c==1/0?(e=Vt(u),(e.length+l)%2==0&&(e+="0"),c=Math.sqrt(e),l=er((l+1)/2)-(l<0||l%2),c==1/0?e="5e"+l:(e=c.toExponential(),e=e.slice(0,e.indexOf("e")+1)+l),r=new h(e)):r=new h(c.toString()),t=(l=h.precision)+3;;)if(i=r,r=i.plus(lt(a,i,t+2,1)).times(.5),Vt(i.d).slice(0,t)===(e=Vt(r.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!n&&e=="4999"){if(!n&&(Ce(i,l+1,0),i.times(i).eq(a))){r=i;break}t+=4,n=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(Ce(r,l+1,1),s=!r.times(r).eq(a));break}return $e=!0,Ce(r,l,h.rounding,s)},fe.tangent=fe.tan=function(){var s,e,t=this,r=t.constructor;return t.isFinite()?t.isZero()?new r(t):(s=r.precision,e=r.rounding,r.precision=s+10,r.rounding=1,t=t.sin(),t.s=1,t=lt(t,new r(1).minus(t.times(t)).sqrt(),s+10,0),r.precision=s,r.rounding=e,Ce(gn==2||gn==4?t.neg():t,s,e,!0)):new r(NaN)},fe.times=fe.mul=function(s){var e,t,r,n,i,a,u,l,c,h=this,d=h.constructor,p=h.d,v=(s=new d(s)).d;if(s.s*=h.s,!p||!p[0]||!v||!v[0])return new d(!s.s||p&&!p[0]&&!v||v&&!v[0]&&!p?NaN:!p||!v?s.s/0:s.s*0);for(t=er(h.e/Be)+er(s.e/Be),l=p.length,c=v.length,l<c&&(i=p,p=v,v=i,a=l,l=c,c=a),i=[],a=l+c,r=a;r--;)i.push(0);for(r=c;--r>=0;){for(e=0,n=l+r;n>r;)u=i[n]+v[r]*p[n-r-1]+e,i[n--]=u%Xr|0,e=u/Xr|0;i[n]=(i[n]+e)%Xr|0}for(;!i[--a];)i.pop();return e?++t:i.shift(),s.d=i,s.e=Qs(i,t),$e?Ce(s,d.precision,d.rounding):s},fe.toBinary=function(s,e){return Ua(this,2,s,e)},fe.toDecimalPlaces=fe.toDP=function(s,e){var t=this,r=t.constructor;return t=new r(t),s===void 0?t:(vr(s,0,Tn),e===void 0?e=r.rounding:vr(e,0,8),Ce(t,s+t.e+1,e))},fe.toExponential=function(s,e){var t,r=this,n=r.constructor;return s===void 0?t=fn(r,!0):(vr(s,0,Tn),e===void 0?e=n.rounding:vr(e,0,8),r=Ce(new n(r),s+1,e),t=fn(r,!0,s+1)),r.isNeg()&&!r.isZero()?"-"+t:t},fe.toFixed=function(s,e){var t,r,n=this,i=n.constructor;return s===void 0?t=fn(n):(vr(s,0,Tn),e===void 0?e=i.rounding:vr(e,0,8),r=Ce(new i(n),s+n.e+1,e),t=fn(r,!1,s+r.e+1)),n.isNeg()&&!n.isZero()?"-"+t:t},fe.toFraction=function(s){var e,t,r,n,i,a,u,l,c,h,d,p,v=this,x=v.d,_=v.constructor;if(!x)return new _(v);if(c=t=new _(1),r=l=new _(0),e=new _(r),i=e.e=ic(x)-v.e-1,a=i%Be,e.d[0]=qt(10,a<0?Be+a:a),s==null)s=i>0?e:c;else{if(u=new _(s),!u.isInt()||u.lt(c))throw Error(In+u);s=u.gt(e)?i>0?e:c:u}for($e=!1,u=new _(Vt(x)),h=_.precision,_.precision=i=x.length*Be*2;d=lt(u,e,0,1,1),n=t.plus(d.times(r)),n.cmp(s)!=1;)t=r,r=n,n=c,c=l.plus(d.times(n)),l=n,n=e,e=u.minus(d.times(n)),u=n;return n=lt(s.minus(t),r,0,1,1),l=l.plus(n.times(c)),t=t.plus(n.times(r)),l.s=c.s=v.s,p=lt(c,r,i,1).minus(v).abs().cmp(lt(l,t,i,1).minus(v).abs())<1?[c,r]:[l,t],_.precision=h,$e=!0,p},fe.toHexadecimal=fe.toHex=function(s,e){return Ua(this,16,s,e)},fe.toNearest=function(s,e){var t=this,r=t.constructor;if(t=new r(t),s==null){if(!t.d)return t;s=new r(1),e=r.rounding}else{if(s=new r(s),e===void 0?e=r.rounding:vr(e,0,8),!t.d)return s.s?t:s;if(!s.d)return s.s&&(s.s=t.s),s}return s.d[0]?($e=!1,t=lt(t,s,0,e,1).times(s),$e=!0,Ce(t)):(s.s=t.s,t=s),t},fe.toNumber=function(){return+this},fe.toOctal=function(s,e){return Ua(this,8,s,e)},fe.toPower=fe.pow=function(s){var e,t,r,n,i,a,u=this,l=u.constructor,c=+(s=new l(s));if(!u.d||!s.d||!u.d[0]||!s.d[0])return new l(qt(+u,c));if(u=new l(u),u.eq(1))return u;if(r=l.precision,i=l.rounding,s.eq(1))return Ce(u,r,i);if(e=er(s.e/Be),e>=s.d.length-1&&(t=c<0?-c:c)<=M_)return n=sc(l,u,t,r),s.s<0?new l(1).div(n):Ce(n,r,i);if(a=u.s,a<0){if(e<s.d.length-1)return new l(NaN);if(s.d[e]&1||(a=1),u.e==0&&u.d[0]==1&&u.d.length==1)return u.s=a,u}return t=qt(+u,c),e=t==0||!isFinite(t)?er(c*(Math.log("0."+Vt(u.d))/Math.LN10+u.e+1)):new l(t+"").e,e>l.maxE+1||e<l.minE-1?new l(e>0?a/0:0):($e=!1,l.rounding=u.s=1,t=Math.min(12,(e+"").length),n=za(s.times(Rn(u,r+t)),r),n.d&&(n=Ce(n,r+5,1),os(n.d,r,i)&&(e=r+10,n=Ce(za(s.times(Rn(u,e+t)),e),e+5,1),+Vt(n.d).slice(r+1,r+15)+1==1e14&&(n=Ce(n,r+1,0)))),n.s=a,$e=!0,l.rounding=i,Ce(n,r,i))},fe.toPrecision=function(s,e){var t,r=this,n=r.constructor;return s===void 0?t=fn(r,r.e<=n.toExpNeg||r.e>=n.toExpPos):(vr(s,1,Tn),e===void 0?e=n.rounding:vr(e,0,8),r=Ce(new n(r),s,e),t=fn(r,s<=r.e||r.e<=n.toExpNeg,s)),r.isNeg()&&!r.isZero()?"-"+t:t},fe.toSignificantDigits=fe.toSD=function(s,e){var t=this,r=t.constructor;return s===void 0?(s=r.precision,e=r.rounding):(vr(s,1,Tn),e===void 0?e=r.rounding:vr(e,0,8)),Ce(new r(t),s,e)},fe.toString=function(){var s=this,e=s.constructor,t=fn(s,s.e<=e.toExpNeg||s.e>=e.toExpPos);return s.isNeg()&&!s.isZero()?"-"+t:t},fe.truncated=fe.trunc=function(){return Ce(new this.constructor(this),this.e+1,1)},fe.valueOf=fe.toJSON=function(){var s=this,e=s.constructor,t=fn(s,s.e<=e.toExpNeg||s.e>=e.toExpPos);return s.isNeg()?"-"+t:t};function Vt(s){var e,t,r,n=s.length-1,i="",a=s[0];if(n>0){for(i+=a,e=1;e<n;e++)r=s[e]+"",t=Be-r.length,t&&(i+=$n(t)),i+=r;a=s[e],r=a+"",t=Be-r.length,t&&(i+=$n(t))}else if(a===0)return"0";for(;a%10===0;)a/=10;return i+a}function vr(s,e,t){if(s!==~~s||s<e||s>t)throw Error(In+s)}function os(s,e,t,r){var n,i,a,u;for(i=s[0];i>=10;i/=10)--e;return--e<0?(e+=Be,n=0):(n=Math.ceil((e+1)/Be),e%=Be),i=qt(10,Be-e),u=s[n]%i|0,r==null?e<3?(e==0?u=u/100|0:e==1&&(u=u/10|0),a=t<4&&u==99999||t>3&&u==49999||u==5e4||u==0):a=(t<4&&u+1==i||t>3&&u+1==i/2)&&(s[n+1]/i/100|0)==qt(10,e-2)-1||(u==i/2||u==0)&&(s[n+1]/i/100|0)==0:e<4?(e==0?u=u/1e3|0:e==1?u=u/100|0:e==2&&(u=u/10|0),a=(r||t<4)&&u==9999||!r&&t>3&&u==4999):a=((r||t<4)&&u+1==i||!r&&t>3&&u+1==i/2)&&(s[n+1]/i/1e3|0)==qt(10,e-3)-1,a}function Xs(s,e,t){for(var r,n=[0],i,a=0,u=s.length;a<u;){for(i=n.length;i--;)n[i]*=e;for(n[0]+=La.indexOf(s.charAt(a++)),r=0;r<n.length;r++)n[r]>t-1&&(n[r+1]===void 0&&(n[r+1]=0),n[r+1]+=n[r]/t|0,n[r]%=t)}return n.reverse()}function S_(s,e){var t,r,n;if(e.isZero())return e;r=e.d.length,r<32?(t=Math.ceil(r/3),n=(1/eo(4,t)).toString()):(t=16,n="2.3283064365386962890625e-10"),s.precision+=t,e=bi(s,1,e.times(n),new s(1));for(var i=t;i--;){var a=e.times(e);e=a.times(a).minus(a).times(8).plus(1)}return s.precision-=t,e}var lt=function(){function s(r,n,i){var a,u=0,l=r.length;for(r=r.slice();l--;)a=r[l]*n+u,r[l]=a%i|0,u=a/i|0;return u&&r.unshift(u),r}function e(r,n,i,a){var u,l;if(i!=a)l=i>a?1:-1;else for(u=l=0;u<i;u++)if(r[u]!=n[u]){l=r[u]>n[u]?1:-1;break}return l}function t(r,n,i,a){for(var u=0;i--;)r[i]-=u,u=r[i]<n[i]?1:0,r[i]=u*a+r[i]-n[i];for(;!r[0]&&r.length>1;)r.shift()}return function(r,n,i,a,u,l){var c,h,d,p,v,x,_,y,m,w,D,C,E,F,B,M,O,A,N,T,R=r.constructor,k=r.s==n.s?1:-1,z=r.d,L=n.d;if(!z||!z[0]||!L||!L[0])return new R(!r.s||!n.s||(z?L&&z[0]==L[0]:!L)?NaN:z&&z[0]==0||!L?k*0:k/0);for(l?(v=1,h=r.e-n.e):(l=Xr,v=Be,h=er(r.e/v)-er(n.e/v)),N=L.length,O=z.length,m=new R(k),w=m.d=[],d=0;L[d]==(z[d]||0);d++);if(L[d]>(z[d]||0)&&h--,i==null?(F=i=R.precision,a=R.rounding):u?F=i+(r.e-n.e)+1:F=i,F<0)w.push(1),x=!0;else{if(F=F/v+2|0,d=0,N==1){for(p=0,L=L[0],F++;(d<O||p)&&F--;d++)B=p*l+(z[d]||0),w[d]=B/L|0,p=B%L|0;x=p||d<O}else{for(p=l/(L[0]+1)|0,p>1&&(L=s(L,p,l),z=s(z,p,l),N=L.length,O=z.length),M=N,D=z.slice(0,N),C=D.length;C<N;)D[C++]=0;T=L.slice(),T.unshift(0),A=L[0],L[1]>=l/2&&++A;do p=0,c=e(L,D,N,C),c<0?(E=D[0],N!=C&&(E=E*l+(D[1]||0)),p=E/A|0,p>1?(p>=l&&(p=l-1),_=s(L,p,l),y=_.length,C=D.length,c=e(_,D,y,C),c==1&&(p--,t(_,N<y?T:L,y,l))):(p==0&&(c=p=1),_=L.slice()),y=_.length,y<C&&_.unshift(0),t(D,_,C,l),c==-1&&(C=D.length,c=e(L,D,N,C),c<1&&(p++,t(D,N<C?T:L,C,l))),C=D.length):c===0&&(p++,D=[0]),w[d++]=p,c&&D[0]?D[C++]=z[M]||0:(D=[z[M]],C=1);while((M++<O||D[0]!==void 0)&&F--);x=D[0]!==void 0}w[0]||w.shift()}if(v==1)m.e=h,Jf=x;else{for(d=1,p=w[0];p>=10;p/=10)d++;m.e=d+h*v-1,Ce(m,u?i+m.e+1:i,a,x)}return m}}();function Ce(s,e,t,r){var n,i,a,u,l,c,h,d,p,v=s.constructor;e:if(e!=null){if(d=s.d,!d)return s;for(n=1,u=d[0];u>=10;u/=10)n++;if(i=e-n,i<0)i+=Be,a=e,h=d[p=0],l=h/qt(10,n-a-1)%10|0;else if(p=Math.ceil((i+1)/Be),u=d.length,p>=u)if(r){for(;u++<=p;)d.push(0);h=l=0,n=1,i%=Be,a=i-Be+1}else break e;else{for(h=u=d[p],n=1;u>=10;u/=10)n++;i%=Be,a=i-Be+n,l=a<0?0:h/qt(10,n-a-1)%10|0}if(r=r||e<0||d[p+1]!==void 0||(a<0?h:h%qt(10,n-a-1)),c=t<4?(l||r)&&(t==0||t==(s.s<0?3:2)):l>5||l==5&&(t==4||r||t==6&&(i>0?a>0?h/qt(10,n-a):0:d[p-1])%10&1||t==(s.s<0?8:7)),e<1||!d[0])return d.length=0,c?(e-=s.e+1,d[0]=qt(10,(Be-e%Be)%Be),s.e=-e||0):d[0]=s.e=0,s;if(i==0?(d.length=p,u=1,p--):(d.length=p+1,u=qt(10,Be-i),d[p]=a>0?(h/qt(10,n-a)%qt(10,a)|0)*u:0),c)for(;;)if(p==0){for(i=1,a=d[0];a>=10;a/=10)i++;for(a=d[0]+=u,u=1;a>=10;a/=10)u++;i!=u&&(s.e++,d[0]==Xr&&(d[0]=1));break}else{if(d[p]+=u,d[p]!=Xr)break;d[p--]=0,u=1}for(i=d.length;d[--i]===0;)d.pop()}return $e&&(s.e>v.maxE?(s.d=null,s.e=NaN):s.e<v.minE&&(s.e=0,s.d=[0])),s}function fn(s,e,t){if(!s.isFinite())return uc(s);var r,n=s.e,i=Vt(s.d),a=i.length;return e?(t&&(r=t-a)>0?i=i.charAt(0)+"."+i.slice(1)+$n(r):a>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(s.e<0?"e":"e+")+s.e):n<0?(i="0."+$n(-n-1)+i,t&&(r=t-a)>0&&(i+=$n(r))):n>=a?(i+=$n(n+1-a),t&&(r=t-n-1)>0&&(i=i+"."+$n(r))):((r=n+1)<a&&(i=i.slice(0,r)+"."+i.slice(r)),t&&(r=t-a)>0&&(n+1===a&&(i+="."),i+=$n(r))),i}function Qs(s,e){var t=s[0];for(e*=Be;t>=10;t/=10)e++;return e}function Js(s,e,t){if(e>N_)throw $e=!0,t&&(s.precision=t),Error(ec);return Ce(new s(Vs),e,1,!0)}function Qr(s,e,t){if(e>ka)throw Error(ec);return Ce(new s(Gs),e,t,!0)}function ic(s){var e=s.length-1,t=e*Be+1;if(e=s[e],e){for(;e%10==0;e/=10)t--;for(e=s[0];e>=10;e/=10)t++}return t}function $n(s){for(var e="";s--;)e+="0";return e}function sc(s,e,t,r){var n,i=new s(1),a=Math.ceil(r/Be+4);for($e=!1;;){if(t%2&&(i=i.times(e),cc(i.d,a)&&(n=!0)),t=er(t/2),t===0){t=i.d.length-1,n&&i.d[t]===0&&++i.d[t];break}e=e.times(e),cc(e.d,a)}return $e=!0,i}function oc(s){return s.d[s.d.length-1]&1}function ac(s,e,t){for(var r,n=new s(e[0]),i=0;++i<e.length;)if(r=new s(e[i]),r.s)n[t](r)&&(n=r);else{n=r;break}return n}function za(s,e){var t,r,n,i,a,u,l,c=0,h=0,d=0,p=s.constructor,v=p.rounding,x=p.precision;if(!s.d||!s.d[0]||s.e>17)return new p(s.d?s.d[0]?s.s<0?0:1/0:1:s.s?s.s<0?0:s:NaN);for(e==null?($e=!1,l=x):l=e,u=new p(.03125);s.e>-2;)s=s.times(u),d+=5;for(r=Math.log(qt(2,d))/Math.LN10*2+5|0,l+=r,t=i=a=new p(1),p.precision=l;;){if(i=Ce(i.times(s),l,1),t=t.times(++h),u=a.plus(lt(i,t,l,1)),Vt(u.d).slice(0,l)===Vt(a.d).slice(0,l)){for(n=d;n--;)a=Ce(a.times(a),l,1);if(e==null)if(c<3&&os(a.d,l-r,v,c))p.precision=l+=10,t=i=u=new p(1),h=0,c++;else return Ce(a,p.precision=x,v,$e=!0);else return p.precision=x,a}a=u}}function Rn(s,e){var t,r,n,i,a,u,l,c,h,d,p,v=1,x=10,_=s,y=_.d,m=_.constructor,w=m.rounding,D=m.precision;if(_.s<0||!y||!y[0]||!_.e&&y[0]==1&&y.length==1)return new m(y&&!y[0]?-1/0:_.s!=1?NaN:y?0:_);if(e==null?($e=!1,h=D):h=e,m.precision=h+=x,t=Vt(y),r=t.charAt(0),Math.abs(i=_.e)<15e14){for(;r<7&&r!=1||r==1&&t.charAt(1)>3;)_=_.times(s),t=Vt(_.d),r=t.charAt(0),v++;i=_.e,r>1?(_=new m("0."+t),i++):_=new m(r+"."+t.slice(1))}else return c=Js(m,h+2,D).times(i+""),_=Rn(new m(r+"."+t.slice(1)),h-x).plus(c),m.precision=D,e==null?Ce(_,D,w,$e=!0):_;for(d=_,l=a=_=lt(_.minus(1),_.plus(1),h,1),p=Ce(_.times(_),h,1),n=3;;){if(a=Ce(a.times(p),h,1),c=l.plus(lt(a,new m(n),h,1)),Vt(c.d).slice(0,h)===Vt(l.d).slice(0,h))if(l=l.times(2),i!==0&&(l=l.plus(Js(m,h+2,D).times(i+""))),l=lt(l,new m(v),h,1),e==null)if(os(l.d,h-x,w,u))m.precision=h+=x,c=a=_=lt(d.minus(1),d.plus(1),h,1),p=Ce(_.times(_),h,1),n=u=1;else return Ce(l,m.precision=D,w,$e=!0);else return m.precision=D,l;l=c,n+=2}}function uc(s){return String(s.s*s.s/0)}function qa(s,e){var t,r,n;for((t=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(t<0&&(t=r),t+=+e.slice(r+1),e=e.substring(0,r)):t<0&&(t=e.length),r=0;e.charCodeAt(r)===48;r++);for(n=e.length;e.charCodeAt(n-1)===48;--n);if(e=e.slice(r,n),e){if(n-=r,s.e=t=t-r-1,s.d=[],r=(t+1)%Be,t<0&&(r+=Be),r<n){for(r&&s.d.push(+e.slice(0,r)),n-=Be;r<n;)s.d.push(+e.slice(r,r+=Be));e=e.slice(r),r=Be-e.length}else r-=n;for(;r--;)e+="0";s.d.push(+e),$e&&(s.e>s.constructor.maxE?(s.d=null,s.e=NaN):s.e<s.constructor.minE&&(s.e=0,s.d=[0]))}else s.e=0,s.d=[0];return s}function O_(s,e){var t,r,n,i,a,u,l,c,h;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),nc.test(e))return qa(s,e)}else if(e==="Infinity"||e==="NaN")return+e||(s.s=NaN),s.e=NaN,s.d=null,s;if(F_.test(e))t=16,e=e.toLowerCase();else if(C_.test(e))t=2;else if(B_.test(e))t=8;else throw Error(In+e);for(i=e.search(/p/i),i>0?(l=+e.slice(i+1),e=e.substring(2,i)):e=e.slice(2),i=e.indexOf("."),a=i>=0,r=s.constructor,a&&(e=e.replace(".",""),u=e.length,i=u-i,n=sc(r,new r(t),i,i*2)),c=Xs(e,t,Xr),h=c.length-1,i=h;c[i]===0;--i)c.pop();return i<0?new r(s.s*0):(s.e=Qs(c,h),s.d=c,$e=!1,a&&(s=lt(s,n,u*4)),l&&(s=s.times(Math.abs(l)<54?qt(2,l):Ai.pow(2,l))),$e=!0,s)}function T_(s,e){var t,r=e.d.length;if(r<3)return e.isZero()?e:bi(s,2,e,e);t=1.4*Math.sqrt(r),t=t>16?16:t|0,e=e.times(1/eo(5,t)),e=bi(s,2,e,e);for(var n,i=new s(5),a=new s(16),u=new s(20);t--;)n=e.times(e),e=e.times(i.plus(n.times(a.times(n).minus(u))));return e}function bi(s,e,t,r,n){var i,a,u,l,c=s.precision,h=Math.ceil(c/Be);for($e=!1,l=t.times(t),u=new s(r);;){if(a=lt(u.times(l),new s(e++*e++),c,1),u=n?r.plus(a):r.minus(a),r=lt(a.times(l),new s(e++*e++),c,1),a=u.plus(r),a.d[h]!==void 0){for(i=h;a.d[i]===u.d[i]&&i--;);if(i==-1)break}i=u,u=r,r=a,a=i}return $e=!0,a.d.length=h+1,a}function eo(s,e){for(var t=s;--e;)t*=s;return t}function fc(s,e){var t,r=e.s<0,n=Qr(s,s.precision,1),i=n.times(.5);if(e=e.abs(),e.lte(i))return gn=r?4:1,e;if(t=e.divToInt(n),t.isZero())gn=r?3:2;else{if(e=e.minus(t.times(n)),e.lte(i))return gn=oc(t)?r?2:3:r?4:1,e;gn=oc(t)?r?1:4:r?3:2}return e.minus(n).abs()}function Ua(s,e,t,r){var n,i,a,u,l,c,h,d,p,v=s.constructor,x=t!==void 0;if(x?(vr(t,1,Tn),r===void 0?r=v.rounding:vr(r,0,8)):(t=v.precision,r=v.rounding),!s.isFinite())h=uc(s);else{for(h=fn(s),a=h.indexOf("."),x?(n=2,e==16?t=t*4-3:e==8&&(t=t*3-2)):n=e,a>=0&&(h=h.replace(".",""),p=new v(1),p.e=h.length-a,p.d=Xs(fn(p),10,n),p.e=p.d.length),d=Xs(h,10,n),i=l=d.length;d[--l]==0;)d.pop();if(!d[0])h=x?"0p+0":"0";else{if(a<0?i--:(s=new v(s),s.d=d,s.e=i,s=lt(s,p,t,r,0,n),d=s.d,i=s.e,c=Jf),a=d[t],u=n/2,c=c||d[t+1]!==void 0,c=r<4?(a!==void 0||c)&&(r===0||r===(s.s<0?3:2)):a>u||a===u&&(r===4||c||r===6&&d[t-1]&1||r===(s.s<0?8:7)),d.length=t,c)for(;++d[--t]>n-1;)d[t]=0,t||(++i,d.unshift(1));for(l=d.length;!d[l-1];--l);for(a=0,h="";a<l;a++)h+=La.charAt(d[a]);if(x){if(l>1)if(e==16||e==8){for(a=e==16?4:3,--l;l%a;l++)h+="0";for(d=Xs(h,n,e),l=d.length;!d[l-1];--l);for(a=1,h="1.";a<l;a++)h+=La.charAt(d[a])}else h=h.charAt(0)+"."+h.slice(1);h=h+(i<0?"p":"p+")+i}else if(i<0){for(;++i;)h="0"+h;h="0."+h}else if(++i>l)for(i-=l;i--;)h+="0";else i<l&&(h=h.slice(0,i)+"."+h.slice(i))}h=(e==16?"0x":e==2?"0b":e==8?"0o":"")+h}return s.s<0?"-"+h:h}function cc(s,e){if(s.length>e)return s.length=e,!0}function I_(s){return new this(s).abs()}function $_(s){return new this(s).acos()}function R_(s){return new this(s).acosh()}function L_(s,e){return new this(s).plus(e)}function P_(s){return new this(s).asin()}function k_(s){return new this(s).asinh()}function z_(s){return new this(s).atan()}function q_(s){return new this(s).atanh()}function U_(s,e){s=new this(s),e=new this(e);var t,r=this.precision,n=this.rounding,i=r+4;return!s.s||!e.s?t=new this(NaN):!s.d&&!e.d?(t=Qr(this,i,1).times(e.s>0?.25:.75),t.s=s.s):!e.d||s.isZero()?(t=e.s<0?Qr(this,r,n):new this(0),t.s=s.s):!s.d||e.isZero()?(t=Qr(this,i,1).times(.5),t.s=s.s):e.s<0?(this.precision=i,this.rounding=1,t=this.atan(lt(s,e,i,1)),e=Qr(this,i,1),this.precision=r,this.rounding=n,t=s.s<0?t.minus(e):t.plus(e)):t=this.atan(lt(s,e,i,1)),t}function W_(s){return new this(s).cbrt()}function H_(s){return Ce(s=new this(s),s.e+1,2)}function j_(s,e,t){return new this(s).clamp(e,t)}function Y_(s){if(!s||typeof s!="object")throw Error(Ks+"Object expected");var e,t,r,n=s.defaults===!0,i=["precision",1,Tn,"rounding",0,8,"toExpNeg",-Ei,0,"toExpPos",0,Ei,"maxE",0,Ei,"minE",-Ei,0,"modulo",0,9];for(e=0;e<i.length;e+=3)if(t=i[e],n&&(this[t]=Pa[t]),(r=s[t])!==void 0)if(er(r)===r&&r>=i[e+1]&&r<=i[e+2])this[t]=r;else throw Error(In+t+": "+r);if(t="crypto",n&&(this[t]=Pa[t]),(r=s[t])!==void 0)if(r===!0||r===!1||r===0||r===1)if(r)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[t]=!0;else throw Error(tc);else this[t]=!1;else throw Error(In+t+": "+r);return this}function Z_(s){return new this(s).cos()}function V_(s){return new this(s).cosh()}function lc(s){var e,t,r;function n(i){var a,u,l,c=this;if(!(c instanceof n))return new n(i);if(c.constructor=n,hc(i)){c.s=i.s,$e?!i.d||i.e>n.maxE?(c.e=NaN,c.d=null):i.e<n.minE?(c.e=0,c.d=[0]):(c.e=i.e,c.d=i.d.slice()):(c.e=i.e,c.d=i.d?i.d.slice():i.d);return}if(l=typeof i,l==="number"){if(i===0){c.s=1/i<0?-1:1,c.e=0,c.d=[0];return}if(i<0?(i=-i,c.s=-1):c.s=1,i===~~i&&i<1e7){for(a=0,u=i;u>=10;u/=10)a++;$e?a>n.maxE?(c.e=NaN,c.d=null):a<n.minE?(c.e=0,c.d=[0]):(c.e=a,c.d=[i]):(c.e=a,c.d=[i]);return}else if(i*0!==0){i||(c.s=NaN),c.e=NaN,c.d=null;return}return qa(c,i.toString())}else if(l!=="string")throw Error(In+i);return(u=i.charCodeAt(0))===45?(i=i.slice(1),c.s=-1):(u===43&&(i=i.slice(1)),c.s=1),nc.test(i)?qa(c,i):O_(c,i)}if(n.prototype=fe,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=Y_,n.clone=lc,n.isDecimal=hc,n.abs=I_,n.acos=$_,n.acosh=R_,n.add=L_,n.asin=P_,n.asinh=k_,n.atan=z_,n.atanh=q_,n.atan2=U_,n.cbrt=W_,n.ceil=H_,n.clamp=j_,n.cos=Z_,n.cosh=V_,n.div=G_,n.exp=K_,n.floor=X_,n.hypot=Q_,n.ln=J_,n.log=ev,n.log10=rv,n.log2=tv,n.max=nv,n.min=iv,n.mod=sv,n.mul=ov,n.pow=av,n.random=uv,n.round=fv,n.sign=cv,n.sin=lv,n.sinh=hv,n.sqrt=dv,n.sub=pv,n.sum=_v,n.tan=vv,n.tanh=gv,n.trunc=mv,s===void 0&&(s={}),s&&s.defaults!==!0)for(r=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<r.length;)s.hasOwnProperty(t=r[e++])||(s[t]=this[t]);return n.config(s),n}function G_(s,e){return new this(s).div(e)}function K_(s){return new this(s).exp()}function X_(s){return Ce(s=new this(s),s.e+1,3)}function Q_(){var s,e,t=new this(0);for($e=!1,s=0;s<arguments.length;)if(e=new this(arguments[s++]),e.d)t.d&&(t=t.plus(e.times(e)));else{if(e.s)return $e=!0,new this(1/0);t=e}return $e=!0,t.sqrt()}function hc(s){return s instanceof Ai||s&&s.toStringTag===rc||!1}function J_(s){return new this(s).ln()}function ev(s,e){return new this(s).log(e)}function tv(s){return new this(s).log(2)}function rv(s){return new this(s).log(10)}function nv(){return ac(this,arguments,"lt")}function iv(){return ac(this,arguments,"gt")}function sv(s,e){return new this(s).mod(e)}function ov(s,e){return new this(s).mul(e)}function av(s,e){return new this(s).pow(e)}function uv(s){var e,t,r,n,i=0,a=new this(1),u=[];if(s===void 0?s=this.precision:vr(s,1,Tn),r=Math.ceil(s/Be),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(r));i<r;)n=e[i],n>=429e7?e[i]=crypto.getRandomValues(new Uint32Array(1))[0]:u[i++]=n%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(r*=4);i<r;)n=e[i]+(e[i+1]<<8)+(e[i+2]<<16)+((e[i+3]&127)<<24),n>=214e7?crypto.randomBytes(4).copy(e,i):(u.push(n%1e7),i+=4);i=r/4}else throw Error(tc);else for(;i<r;)u[i++]=Math.random()*1e7|0;for(r=u[--i],s%=Be,r&&s&&(n=qt(10,Be-s),u[i]=(r/n|0)*n);u[i]===0;i--)u.pop();if(i<0)t=0,u=[0];else{for(t=-1;u[0]===0;t-=Be)u.shift();for(r=1,n=u[0];n>=10;n/=10)r++;r<Be&&(t-=Be-r)}return a.e=t,a.d=u,a}function fv(s){return Ce(s=new this(s),s.e+1,this.rounding)}function cv(s){return s=new this(s),s.d?s.d[0]?s.s:0*s.s:s.s||NaN}function lv(s){return new this(s).sin()}function hv(s){return new this(s).sinh()}function dv(s){return new this(s).sqrt()}function pv(s,e){return new this(s).sub(e)}function _v(){var s=0,e=arguments,t=new this(e[s]);for($e=!1;t.s&&++s<e.length;)t=t.plus(e[s]);return $e=!0,Ce(t,this.precision,this.rounding)}function vv(s){return new this(s).tan()}function gv(s){return new this(s).tanh()}function mv(s){return Ce(s=new this(s),s.e+1,1)}fe[Symbol.for("nodejs.util.inspect.custom")]=fe.toString,fe[Symbol.toStringTag]="Decimal";var Ai=fe.constructor=lc(Pa);Vs=new Ai(Vs),Gs=new Ai(Gs);var xv="BigNumber",yv=["?on","config"],Dv=xe(xv,yv,s=>{var{on:e,config:t}=s,r=Ai.clone({precision:t.precision,modulo:Ai.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)},e&&e("config",function(n,i){n.precision!==i.precision&&r.config({precision:n.precision})}),r},{isClass:!0}),dc={exports:{}};/**
41
+ * @license Complex.js v2.1.1 12/05/2020
42
+ *
43
+ * Copyright (c) 2020, Robert Eisele (robert@xarg.org)
44
+ * Dual licensed under the MIT or GPL Version 2 licenses.
45
+ **/(function(s,e){(function(t){var r=Math.cosh||function(d){return Math.abs(d)<1e-9?1-d:(Math.exp(d)+Math.exp(-d))*.5},n=Math.sinh||function(d){return Math.abs(d)<1e-9?d:(Math.exp(d)-Math.exp(-d))*.5},i=function(d){var p=Math.PI/4;if(-p>d||d>p)return Math.cos(d)-1;var v=d*d;return v*(v*(v*(v*(v*(v*(v*(v/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-1/2)},a=function(d,p){var v=Math.abs(d),x=Math.abs(p);return v<3e3&&x<3e3?Math.sqrt(v*v+x*x):(v<x?(v=x,x=d/p):x=p/d,v*Math.sqrt(1+x*x))},u=function(){throw SyntaxError("Invalid Param")};function l(d,p){var v=Math.abs(d),x=Math.abs(p);return d===0?Math.log(x):p===0?Math.log(v):v<3e3&&x<3e3?Math.log(d*d+p*p)*.5:(d=d/2,p=p/2,.5*Math.log(d*d+p*p)+Math.LN2)}var c=function(d,p){var v={re:0,im:0};if(d==null)v.re=v.im=0;else if(p!==void 0)v.re=d,v.im=p;else switch(typeof d){case"object":if("im"in d&&"re"in d)v.re=d.re,v.im=d.im;else if("abs"in d&&"arg"in d){if(!Number.isFinite(d.abs)&&Number.isFinite(d.arg))return h.INFINITY;v.re=d.abs*Math.cos(d.arg),v.im=d.abs*Math.sin(d.arg)}else if("r"in d&&"phi"in d){if(!Number.isFinite(d.r)&&Number.isFinite(d.phi))return h.INFINITY;v.re=d.r*Math.cos(d.phi),v.im=d.r*Math.sin(d.phi)}else d.length===2?(v.re=d[0],v.im=d[1]):u();break;case"string":v.im=v.re=0;var x=d.match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),_=1,y=0;x===null&&u();for(var m=0;m<x.length;m++){var w=x[m];w===" "||w===" "||w===`
46
+ `||(w==="+"?_++:w==="-"?y++:w==="i"||w==="I"?(_+y===0&&u(),x[m+1]!==" "&&!isNaN(x[m+1])?(v.im+=parseFloat((y%2?"-":"")+x[m+1]),m++):v.im+=parseFloat((y%2?"-":"")+"1"),_=y=0):((_+y===0||isNaN(w))&&u(),x[m+1]==="i"||x[m+1]==="I"?(v.im+=parseFloat((y%2?"-":"")+w),m++):v.re+=parseFloat((y%2?"-":"")+w),_=y=0))}_+y>0&&u();break;case"number":v.im=0,v.re=d;break;default:u()}return isNaN(v.re)||isNaN(v.im),v};function h(d,p){if(!(this instanceof h))return new h(d,p);var v=c(d,p);this.re=v.re,this.im=v.im}h.prototype={re:0,im:0,sign:function(){var d=this.abs();return new h(this.re/d,this.im/d)},add:function(d,p){var v=new h(d,p);return this.isInfinite()&&v.isInfinite()?h.NAN:this.isInfinite()||v.isInfinite()?h.INFINITY:new h(this.re+v.re,this.im+v.im)},sub:function(d,p){var v=new h(d,p);return this.isInfinite()&&v.isInfinite()?h.NAN:this.isInfinite()||v.isInfinite()?h.INFINITY:new h(this.re-v.re,this.im-v.im)},mul:function(d,p){var v=new h(d,p);return this.isInfinite()&&v.isZero()||this.isZero()&&v.isInfinite()?h.NAN:this.isInfinite()||v.isInfinite()?h.INFINITY:v.im===0&&this.im===0?new h(this.re*v.re,0):new h(this.re*v.re-this.im*v.im,this.re*v.im+this.im*v.re)},div:function(d,p){var v=new h(d,p);if(this.isZero()&&v.isZero()||this.isInfinite()&&v.isInfinite())return h.NAN;if(this.isInfinite()||v.isZero())return h.INFINITY;if(this.isZero()||v.isInfinite())return h.ZERO;d=this.re,p=this.im;var x=v.re,_=v.im,y,m;return _===0?new h(d/x,p/x):Math.abs(x)<Math.abs(_)?(m=x/_,y=x*m+_,new h((d*m+p)/y,(p*m-d)/y)):(m=_/x,y=_*m+x,new h((d+p*m)/y,(p-d*m)/y))},pow:function(d,p){var v=new h(d,p);if(d=this.re,p=this.im,v.isZero())return h.ONE;if(v.im===0){if(p===0&&d>0)return new h(Math.pow(d,v.re),0);if(d===0)switch((v.re%4+4)%4){case 0:return new h(Math.pow(p,v.re),0);case 1:return new h(0,Math.pow(p,v.re));case 2:return new h(-Math.pow(p,v.re),0);case 3:return new h(0,-Math.pow(p,v.re))}}if(d===0&&p===0&&v.re>0&&v.im>=0)return h.ZERO;var x=Math.atan2(p,d),_=l(d,p);return d=Math.exp(v.re*_-v.im*x),p=v.im*_+v.re*x,new h(d*Math.cos(p),d*Math.sin(p))},sqrt:function(){var d=this.re,p=this.im,v=this.abs(),x,_;if(d>=0){if(p===0)return new h(Math.sqrt(d),0);x=.5*Math.sqrt(2*(v+d))}else x=Math.abs(p)/Math.sqrt(2*(v-d));return d<=0?_=.5*Math.sqrt(2*(v-d)):_=Math.abs(p)/Math.sqrt(2*(v+d)),new h(x,p<0?-_:_)},exp:function(){var d=Math.exp(this.re);return this.im,new h(d*Math.cos(this.im),d*Math.sin(this.im))},expm1:function(){var d=this.re,p=this.im;return new h(Math.expm1(d)*Math.cos(p)+i(p),Math.exp(d)*Math.sin(p))},log:function(){var d=this.re,p=this.im;return new h(l(d,p),Math.atan2(p,d))},abs:function(){return a(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var d=this.re,p=this.im;return new h(Math.sin(d)*r(p),Math.cos(d)*n(p))},cos:function(){var d=this.re,p=this.im;return new h(Math.cos(d)*r(p),-Math.sin(d)*n(p))},tan:function(){var d=2*this.re,p=2*this.im,v=Math.cos(d)+r(p);return new h(Math.sin(d)/v,n(p)/v)},cot:function(){var d=2*this.re,p=2*this.im,v=Math.cos(d)-r(p);return new h(-Math.sin(d)/v,n(p)/v)},sec:function(){var d=this.re,p=this.im,v=.5*r(2*p)+.5*Math.cos(2*d);return new h(Math.cos(d)*r(p)/v,Math.sin(d)*n(p)/v)},csc:function(){var d=this.re,p=this.im,v=.5*r(2*p)-.5*Math.cos(2*d);return new h(Math.sin(d)*r(p)/v,-Math.cos(d)*n(p)/v)},asin:function(){var d=this.re,p=this.im,v=new h(p*p-d*d+1,-2*d*p).sqrt(),x=new h(v.re-p,v.im+d).log();return new h(x.im,-x.re)},acos:function(){var d=this.re,p=this.im,v=new h(p*p-d*d+1,-2*d*p).sqrt(),x=new h(v.re-p,v.im+d).log();return new h(Math.PI/2-x.im,x.re)},atan:function(){var d=this.re,p=this.im;if(d===0){if(p===1)return new h(0,1/0);if(p===-1)return new h(0,-1/0)}var v=d*d+(1-p)*(1-p),x=new h((1-p*p-d*d)/v,-2*d/v).log();return new h(-.5*x.im,.5*x.re)},acot:function(){var d=this.re,p=this.im;if(p===0)return new h(Math.atan2(1,d),0);var v=d*d+p*p;return v!==0?new h(d/v,-p/v).atan():new h(d!==0?d/0:0,p!==0?-p/0:0).atan()},asec:function(){var d=this.re,p=this.im;if(d===0&&p===0)return new h(0,1/0);var v=d*d+p*p;return v!==0?new h(d/v,-p/v).acos():new h(d!==0?d/0:0,p!==0?-p/0:0).acos()},acsc:function(){var d=this.re,p=this.im;if(d===0&&p===0)return new h(Math.PI/2,1/0);var v=d*d+p*p;return v!==0?new h(d/v,-p/v).asin():new h(d!==0?d/0:0,p!==0?-p/0:0).asin()},sinh:function(){var d=this.re,p=this.im;return new h(n(d)*Math.cos(p),r(d)*Math.sin(p))},cosh:function(){var d=this.re,p=this.im;return new h(r(d)*Math.cos(p),n(d)*Math.sin(p))},tanh:function(){var d=2*this.re,p=2*this.im,v=r(d)+Math.cos(p);return new h(n(d)/v,Math.sin(p)/v)},coth:function(){var d=2*this.re,p=2*this.im,v=r(d)-Math.cos(p);return new h(n(d)/v,-Math.sin(p)/v)},csch:function(){var d=this.re,p=this.im,v=Math.cos(2*p)-r(2*d);return new h(-2*n(d)*Math.cos(p)/v,2*r(d)*Math.sin(p)/v)},sech:function(){var d=this.re,p=this.im,v=Math.cos(2*p)+r(2*d);return new h(2*r(d)*Math.cos(p)/v,-2*n(d)*Math.sin(p)/v)},asinh:function(){var d=this.im;this.im=-this.re,this.re=d;var p=this.asin();return this.re=-this.im,this.im=d,d=p.re,p.re=-p.im,p.im=d,p},acosh:function(){var d=this.acos();if(d.im<=0){var p=d.re;d.re=-d.im,d.im=p}else{var p=d.im;d.im=-d.re,d.re=p}return d},atanh:function(){var d=this.re,p=this.im,v=d>1&&p===0,x=1-d,_=1+d,y=x*x+p*p,m=y!==0?new h((_*x-p*p)/y,(p*x+_*p)/y):new h(d!==-1?d/0:0,p!==0?p/0:0),w=m.re;return m.re=l(m.re,m.im)/2,m.im=Math.atan2(m.im,w)/2,v&&(m.im=-m.im),m},acoth:function(){var d=this.re,p=this.im;if(d===0&&p===0)return new h(0,Math.PI/2);var v=d*d+p*p;return v!==0?new h(d/v,-p/v).atanh():new h(d!==0?d/0:0,p!==0?-p/0:0).atanh()},acsch:function(){var d=this.re,p=this.im;if(p===0)return new h(d!==0?Math.log(d+Math.sqrt(d*d+1)):1/0,0);var v=d*d+p*p;return v!==0?new h(d/v,-p/v).asinh():new h(d!==0?d/0:0,p!==0?-p/0:0).asinh()},asech:function(){var d=this.re,p=this.im;if(this.isZero())return h.INFINITY;var v=d*d+p*p;return v!==0?new h(d/v,-p/v).acosh():new h(d!==0?d/0:0,p!==0?-p/0:0).acosh()},inverse:function(){if(this.isZero())return h.INFINITY;if(this.isInfinite())return h.ZERO;var d=this.re,p=this.im,v=d*d+p*p;return new h(d/v,-p/v)},conjugate:function(){return new h(this.re,-this.im)},neg:function(){return new h(-this.re,-this.im)},ceil:function(d){return d=Math.pow(10,d||0),new h(Math.ceil(this.re*d)/d,Math.ceil(this.im*d)/d)},floor:function(d){return d=Math.pow(10,d||0),new h(Math.floor(this.re*d)/d,Math.floor(this.im*d)/d)},round:function(d){return d=Math.pow(10,d||0),new h(Math.round(this.re*d)/d,Math.round(this.im*d)/d)},equals:function(d,p){var v=new h(d,p);return Math.abs(v.re-this.re)<=h.EPSILON&&Math.abs(v.im-this.im)<=h.EPSILON},clone:function(){return new h(this.re,this.im)},toString:function(){var d=this.re,p=this.im,v="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(d)<h.EPSILON&&(d=0),Math.abs(p)<h.EPSILON&&(p=0),p===0?v+d:(d!==0?(v+=d,v+=" ",p<0?(p=-p,v+="-"):v+="+",v+=" "):p<0&&(p=-p,v+="-"),p!==1&&(v+=p),v+"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())}},h.ZERO=new h(0,0),h.ONE=new h(1,0),h.I=new h(0,1),h.PI=new h(Math.PI,0),h.E=new h(Math.E,0),h.INFINITY=new h(1/0,1/0),h.NAN=new h(NaN,NaN),h.EPSILON=1e-15,Object.defineProperty(h,"__esModule",{value:!0}),h.default=h,h.Complex=h,s.exports=h})()})(dc);var wv=dc.exports,Gt=tt(wv),Ev="Complex",bv=[],Av=xe(Ev,bv,()=>(Object.defineProperty(Gt,"name",{value:"Complex"}),Gt.prototype.constructor=Gt,Gt.prototype.type="Complex",Gt.prototype.isComplex=!0,Gt.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},Gt.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},Gt.prototype.format=function(s){var e="",t=this.im,r=this.re,n=Ba(this.re,s),i=Ba(this.im,s),a=pt(s)?s:s?s.precision:null;if(a!==null){var u=Math.pow(10,-a);Math.abs(r/t)<u&&(r=0),Math.abs(t/r)<u&&(t=0)}return t===0?e=n:r===0?t===1?e="i":t===-1?e="-i":e=i+"i":t<0?t===-1?e=n+" - i":e=n+" - "+i.substring(1)+"i":t===1?e=n+" + i":e=n+" + "+i+"i",e},Gt.fromPolar=function(s){switch(arguments.length){case 1:{var e=arguments[0];if(typeof e=="object")return Gt(e);throw new TypeError("Input has to be an object with r and phi keys.")}case 2:{var t=arguments[0],r=arguments[1];if(pt(t)){if(Ff(r)&&r.hasBase("ANGLE")&&(r=r.toNumber("rad")),pt(r))return new Gt({r:t,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")}},Gt.prototype.valueOf=Gt.prototype.toString,Gt.fromJSON=function(s){return new Gt(s)},Gt.compare=function(s,e){return s.re>e.re?1:s.re<e.re?-1:s.im>e.im?1:s.im<e.im?-1:0},Gt),{isClass:!0}),pc={exports:{}};/**
47
+ * @license Fraction.js v4.3.0 20/08/2023
48
+ * https://www.xarg.org/2014/03/rational-numbers-in-javascript/
49
+ *
50
+ * Copyright (c) 2023, Robert Eisele (robert@raw.org)
51
+ * Dual licensed under the MIT or GPL Version 2 licenses.
52
+ **/(function(s,e){(function(t){var r=2e3,n={s:1,n:0,d:1};function i(m,w){if(isNaN(m=parseInt(m,10)))throw _();return m*w}function a(m,w){if(w===0)throw x();var D=Object.create(v.prototype);D.s=m<0?-1:1,m=m<0?-m:m;var C=p(m,w);return D.n=m/C,D.d=w/C,D}function u(m){for(var w={},D=m,C=2,E=4;E<=D;){for(;D%C===0;)D/=C,w[C]=(w[C]||0)+1;E+=1+2*C++}return D!==m?D>1&&(w[D]=(w[D]||0)+1):w[m]=(w[m]||0)+1,w}var l=function(m,w){var D=0,C=1,E=1,F=0,B=0,M=0,O=1,A=1,N=0,T=1,R=1,k=1,z=1e7,L;if(m!=null)if(w!==void 0){if(D=m,C=w,E=D*C,D%1!==0||C%1!==0)throw y()}else switch(typeof m){case"object":{if("d"in m&&"n"in m)D=m.n,C=m.d,"s"in m&&(D*=m.s);else if(0 in m)D=m[0],1 in m&&(C=m[1]);else throw _();E=D*C;break}case"number":{if(m<0&&(E=m,m=-m),m%1===0)D=m;else if(m>0){for(m>=1&&(A=Math.pow(10,Math.floor(1+Math.log(m)/Math.LN10)),m/=A);T<=z&&k<=z;)if(L=(N+R)/(T+k),m===L){T+k<=z?(D=N+R,C=T+k):k>T?(D=R,C=k):(D=N,C=T);break}else m>L?(N+=R,T+=k):(R+=N,k+=T),T>z?(D=R,C=k):(D=N,C=T);D*=A}else(isNaN(m)||isNaN(w))&&(C=D=NaN);break}case"string":{if(T=m.match(/\d+|./g),T===null)throw _();if(T[N]==="-"?(E=-1,N++):T[N]==="+"&&N++,T.length===N+1?B=i(T[N++],E):T[N+1]==="."||T[N]==="."?(T[N]!=="."&&(F=i(T[N++],E)),N++,(N+1===T.length||T[N+1]==="("&&T[N+3]===")"||T[N+1]==="'"&&T[N+3]==="'")&&(B=i(T[N],E),O=Math.pow(10,T[N].length),N++),(T[N]==="("&&T[N+2]===")"||T[N]==="'"&&T[N+2]==="'")&&(M=i(T[N+1],E),A=Math.pow(10,T[N+1].length)-1,N+=3)):T[N+1]==="/"||T[N+1]===":"?(B=i(T[N],E),O=i(T[N+2],1),N+=3):T[N+3]==="/"&&T[N+1]===" "&&(F=i(T[N],E),B=i(T[N+2],E),O=i(T[N+4],1),N+=5),T.length<=N){C=O*A,E=D=M+C*F+A*B;break}}default:throw _()}if(C===0)throw x();n.s=E<0?-1:1,n.n=Math.abs(D),n.d=Math.abs(C)};function c(m,w,D){for(var C=1;w>0;m=m*m%D,w>>=1)w&1&&(C=C*m%D);return C}function h(m,w){for(;w%2===0;w/=2);for(;w%5===0;w/=5);if(w===1)return 0;for(var D=10%w,C=1;D!==1;C++)if(D=D*10%w,C>r)return 0;return C}function d(m,w,D){for(var C=1,E=c(10,D,w),F=0;F<300;F++){if(C===E)return F;C=C*10%w,E=E*10%w}return 0}function p(m,w){if(!m)return w;if(!w)return m;for(;;){if(m%=w,!m)return w;if(w%=m,!w)return m}}function v(m,w){if(l(m,w),this instanceof v)m=p(n.d,n.n),this.s=n.s,this.n=n.n/m,this.d=n.d/m;else return a(n.s*n.n,n.d)}var x=function(){return new Error("Division by Zero")},_=function(){return new Error("Invalid argument")},y=function(){return new Error("Parameters must be integer")};v.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(m,w){return l(m,w),a(this.s*this.n*n.d+n.s*this.d*n.n,this.d*n.d)},sub:function(m,w){return l(m,w),a(this.s*this.n*n.d-n.s*this.d*n.n,this.d*n.d)},mul:function(m,w){return l(m,w),a(this.s*n.s*this.n*n.n,this.d*n.d)},div:function(m,w){return l(m,w),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(m,w){if(isNaN(this.n)||isNaN(this.d))return new v(NaN);if(m===void 0)return a(this.s*this.n%this.d,1);if(l(m,w),n.n===0&&this.d===0)throw x();return a(this.s*(n.d*this.n)%(n.n*this.d),n.d*this.d)},gcd:function(m,w){return l(m,w),a(p(n.n,this.n)*p(n.d,this.d),n.d*this.d)},lcm:function(m,w){return l(m,w),n.n===0&&this.n===0?a(0,1):a(n.n*this.n,p(n.n,this.n)*p(n.d,this.d))},ceil:function(m){return m=Math.pow(10,m||0),isNaN(this.n)||isNaN(this.d)?new v(NaN):a(Math.ceil(m*this.s*this.n/this.d),m)},floor:function(m){return m=Math.pow(10,m||0),isNaN(this.n)||isNaN(this.d)?new v(NaN):a(Math.floor(m*this.s*this.n/this.d),m)},round:function(m){return m=Math.pow(10,m||0),isNaN(this.n)||isNaN(this.d)?new v(NaN):a(Math.round(m*this.s*this.n/this.d),m)},inverse:function(){return a(this.s*this.d,this.n)},pow:function(m,w){if(l(m,w),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 D=u(this.n),C=u(this.d),E=1,F=1;for(var B in D)if(B!=="1"){if(B==="0"){E=0;break}if(D[B]*=n.n,D[B]%n.d===0)D[B]/=n.d;else return null;E*=Math.pow(B,D[B])}for(var B in C)if(B!=="1"){if(C[B]*=n.n,C[B]%n.d===0)C[B]/=n.d;else return null;F*=Math.pow(B,C[B])}return n.s<0?a(F,E):a(E,F)},equals:function(m,w){return l(m,w),this.s*this.n*n.d===n.s*n.n*this.d},compare:function(m,w){l(m,w);var D=this.s*this.n*n.d-n.s*n.n*this.d;return(0<D)-(D<0)},simplify:function(m){if(isNaN(this.n)||isNaN(this.d))return this;m=m||.001;for(var w=this.abs(),D=w.toContinued(),C=1;C<D.length;C++){for(var E=a(D[C-1],1),F=C-2;F>=0;F--)E=E.inverse().add(D[F]);if(Math.abs(E.sub(w).valueOf())<m)return E.mul(this.s)}return this},divisible:function(m,w){return l(m,w),!(!(n.n*this.d)||this.n*n.d%(n.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(m){var w,D="",C=this.n,E=this.d;return this.s<0&&(D+="-"),E===1?D+=C:(m&&(w=Math.floor(C/E))>0&&(D+=w,D+=" ",C%=E),D+=C,D+="/",D+=E),D},toLatex:function(m){var w,D="",C=this.n,E=this.d;return this.s<0&&(D+="-"),E===1?D+=C:(m&&(w=Math.floor(C/E))>0&&(D+=w,C%=E),D+="\\frac{",D+=C,D+="}{",D+=E,D+="}"),D},toContinued:function(){var m,w=this.n,D=this.d,C=[];if(isNaN(w)||isNaN(D))return C;do C.push(Math.floor(w/D)),m=w%D,w=D,D=m;while(w!==1);return C},toString:function(m){var w=this.n,D=this.d;if(isNaN(w)||isNaN(D))return"NaN";m=m||15;var C=h(w,D),E=d(w,D,C),F=this.s<0?"-":"";if(F+=w/D|0,w%=D,w*=10,w&&(F+="."),C){for(var B=E;B--;)F+=w/D|0,w%=D,w*=10;F+="(";for(var B=C;B--;)F+=w/D|0,w%=D,w*=10;F+=")"}else for(var B=m;w&&B--;)F+=w/D|0,w%=D,w*=10;return F}},Object.defineProperty(v,"__esModule",{value:!0}),v.default=v,v.Fraction=v,s.exports=v})()})(pc);var Cv=pc.exports,mn=tt(Cv),Fv="Fraction",Bv=[],Mv=xe(Fv,Bv,()=>(Object.defineProperty(mn,"name",{value:"Fraction"}),mn.prototype.constructor=mn,mn.prototype.type="Fraction",mn.prototype.isFraction=!0,mn.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},mn.fromJSON=function(s){return new mn(s)},mn),{isClass:!0}),Nv="Matrix",Sv=[],Ov=xe(Nv,Sv,()=>{function s(){if(!(this instanceof s))throw new SyntaxError("Constructor must be called with the new operator")}return s.prototype.type="Matrix",s.prototype.isMatrix=!0,s.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},s.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},s.prototype.create=function(e,t){throw new Error("Cannot invoke create on a Matrix interface")},s.prototype.subset=function(e,t,r){throw new Error("Cannot invoke subset on a Matrix interface")},s.prototype.get=function(e){throw new Error("Cannot invoke get on a Matrix interface")},s.prototype.set=function(e,t,r){throw new Error("Cannot invoke set on a Matrix interface")},s.prototype.resize=function(e,t){throw new Error("Cannot invoke resize on a Matrix interface")},s.prototype.reshape=function(e,t){throw new Error("Cannot invoke reshape on a Matrix interface")},s.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},s.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},s.prototype.map=function(e,t){throw new Error("Cannot invoke map on a Matrix interface")},s.prototype.forEach=function(e){throw new Error("Cannot invoke forEach on a Matrix interface")},s.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},s.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},s.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},s.prototype.format=function(e){throw new Error("Cannot invoke format on a Matrix interface")},s.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},s},{isClass:!0});function _c(s){return Object.keys(s.signatures||{}).reduce(function(e,t){var r=(t.match(/,/g)||[]).length+1;return Math.max(e,r)},-1)}var Tv="DenseMatrix",Iv=["Matrix"],$v=xe(Tv,Iv,s=>{var{Matrix:e}=s;function t(h,d){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");if(d&&!un(d))throw new Error("Invalid datatype: "+d);if(mt(h))h.type==="DenseMatrix"?(this._data=ut(h._data),this._size=ut(h._size),this._datatype=d||h._datatype):(this._data=h.toArray(),this._size=h.size(),this._datatype=d||h._datatype);else if(h&&Ct(h.data)&&Ct(h.size))this._data=h.data,this._size=h.size,Wf(this._data,this._size),this._datatype=d||h.datatype;else if(Ct(h))this._data=c(h),this._size=Lt(this._data),Wf(this._data,this._size),this._datatype=d;else{if(h)throw new TypeError("Unsupported type of data ("+Sn(h)+")");this._data=[],this._size=[0],this._datatype=d}}t.prototype=new e,t.prototype.createDenseMatrix=function(h,d){return new t(h,d)},Object.defineProperty(t,"name",{value:"DenseMatrix"}),t.prototype.constructor=t,t.prototype.type="DenseMatrix",t.prototype.isDenseMatrix=!0,t.prototype.getDataType=function(){return js(this._data,Sn)},t.prototype.storage=function(){return"dense"},t.prototype.datatype=function(){return this._datatype},t.prototype.create=function(h,d){return new t(h,d)},t.prototype.subset=function(h,d,p){switch(arguments.length){case 1:return r(this,h);case 2:case 3:return i(this,h,d,p);default:throw new SyntaxError("Wrong number of arguments")}},t.prototype.get=function(h){if(!Ct(h))throw new TypeError("Array expected");if(h.length!==this._size.length)throw new rt(h.length,this._size.length);for(var d=0;d<h.length;d++)Ft(h[d],this._size[d]);for(var p=this._data,v=0,x=h.length;v<x;v++){var _=h[v];Ft(_,p.length),p=p[_]}return p},t.prototype.set=function(h,d,p){if(!Ct(h))throw new TypeError("Array expected");if(h.length<this._size.length)throw new rt(h.length,this._size.length,"<");var v,x,_,y=h.map(function(w){return w+1});l(this,y,p);var m=this._data;for(v=0,x=h.length-1;v<x;v++)_=h[v],Ft(_,m.length),m=m[_];return _=h[h.length-1],Ft(_,m.length),m[_]=d,this};function r(h,d){if(!Aa(d))throw new TypeError("Invalid index");var p=d.isScalar();if(p)return h.get(d.min());var v=d.size();if(v.length!==h._size.length)throw new rt(v.length,h._size.length);for(var x=d.min(),_=d.max(),y=0,m=h._size.length;y<m;y++)Ft(x[y],h._size[y]),Ft(_[y],h._size[y]);return new t(n(h._data,d,v.length,0),h._datatype)}function n(h,d,p,v){var x=v===p-1,_=d.dimension(v);return x?_.map(function(y){return Ft(y,h.length),h[y]}).valueOf():_.map(function(y){Ft(y,h.length);var m=h[y];return n(m,d,p,v+1)}).valueOf()}function i(h,d,p,v){if(!d||d.isIndex!==!0)throw new TypeError("Invalid index");var x=d.size(),_=d.isScalar(),y;if(mt(p)?(y=p.size(),p=p.valueOf()):y=Lt(p),_){if(y.length!==0)throw new TypeError("Scalar expected");h.set(d.min(),p,v)}else{if(!yi(y,x))try{y.length===0?p=Gf([p],x):p=Gf(p,x),y=Lt(p)}catch{}if(x.length<h._size.length)throw new rt(x.length,h._size.length,"<");if(y.length<x.length){for(var m=0,w=0;x[m]===1&&y[m]===1;)m++;for(;x[m]===1;)w++,m++;p=jf(p,x.length,w,y)}if(!yi(x,y))throw new rt(x,y,">");var D=d.max().map(function(F){return F+1});l(h,D,v);var C=x.length,E=0;a(h._data,d,p,C,E)}return h}function a(h,d,p,v,x){var _=x===v-1,y=d.dimension(x);_?y.forEach(function(m,w){Ft(m),h[m]=p[w[0]]}):y.forEach(function(m,w){Ft(m),a(h[m],d,p[w[0]],v,x+1)})}t.prototype.resize=function(h,d,p){if(!is(h))throw new TypeError("Array or Matrix expected");var v=h.valueOf().map(_=>Array.isArray(_)&&_.length===1?_[0]:_),x=p?this.clone():this;return u(x,v,d)};function u(h,d,p){if(d.length===0){for(var v=h._data;Ct(v);)v=v[0];return v}return h._size=d.slice(0),h._data=Na(h._data,h._size,p),h}t.prototype.reshape=function(h,d){var p=d?this.clone():this;p._data=Oa(p._data,h);var v=p._size.reduce((x,_)=>x*_);return p._size=Ta(h,v),p};function l(h,d,p){for(var v=h._size.slice(0),x=!1;v.length<d.length;)v.push(0),x=!0;for(var _=0,y=d.length;_<y;_++)d[_]>v[_]&&(v[_]=d[_],x=!0);x&&u(h,v,p)}t.prototype.clone=function(){var h=new t({data:ut(this._data),size:ut(this._size),datatype:this._datatype});return h},t.prototype.size=function(){return this._size.slice(0)},t.prototype.map=function(h){var d=this,p=_c(h),v=function y(m,w){return Ct(m)?m.map(function(D,C){return y(D,w.concat(C))}):p===1?h(m):p===2?h(m,w):h(m,w,d)},x=v(this._data,[]),_=this._datatype!==void 0?js(x,Sn):void 0;return new t(x,_)},t.prototype.forEach=function(h){var d=this,p=function v(x,_){Ct(x)?x.forEach(function(y,m){v(y,_.concat(m))}):h(x,_,d)};p(this._data,[])},t.prototype[Symbol.iterator]=function*(){var h=function*d(p,v){if(Ct(p))for(var x=0;x<p.length;x++)yield*d(p[x],v.concat(x));else yield{value:p,index:v}};yield*h(this._data,[])},t.prototype.rows=function(){var h=[],d=this.size();if(d.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");var p=this._data;for(var v of p)h.push(new t([v],this._datatype));return h},t.prototype.columns=function(){var h=this,d=[],p=this.size();if(p.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");for(var v=this._data,x=function(m){var w=v.map(D=>[D[m]]);d.push(new t(w,h._datatype))},_=0;_<p[1];_++)x(_);return d},t.prototype.toArray=function(){return ut(this._data)},t.prototype.valueOf=function(){return this._data},t.prototype.format=function(h){return ct(this._data,h)},t.prototype.toString=function(){return ct(this._data)},t.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},t.prototype.diagonal=function(h){if(h){if(St(h)&&(h=h.toNumber()),!pt(h)||!Et(h))throw new TypeError("The parameter k must be an integer number")}else h=0;for(var d=h>0?h:0,p=h<0?-h:0,v=this._size[0],x=this._size[1],_=Math.min(v-p,x-d),y=[],m=0;m<_;m++)y[m]=this._data[m+p][m+d];return new t({data:y,size:[_],datatype:this._datatype})},t.diagonal=function(h,d,p,v){if(!Ct(h))throw new TypeError("Array expected, size parameter");if(h.length!==2)throw new Error("Only two dimensions matrix are supported");if(h=h.map(function(B){if(St(B)&&(B=B.toNumber()),!pt(B)||!Et(B)||B<1)throw new Error("Size values must be positive integers");return B}),p){if(St(p)&&(p=p.toNumber()),!pt(p)||!Et(p))throw new TypeError("The parameter k must be an integer number")}else p=0;var x=p>0?p:0,_=p<0?-p:0,y=h[0],m=h[1],w=Math.min(y-_,m-x),D;if(Ct(d)){if(d.length!==w)throw new Error("Invalid value array length");D=function(M){return d[M]}}else if(mt(d)){var C=d.size();if(C.length!==1||C[0]!==w)throw new Error("Invalid matrix length");D=function(M){return d.get([M])}}else D=function(){return d};v||(v=St(D(0))?D(0).mul(0):0);var E=[];if(h.length>0){E=Na(E,h,v);for(var F=0;F<w;F++)E[F+_][F+x]=D(F)}return new t({data:E,size:[y,m]})},t.fromJSON=function(h){return new t(h)},t.prototype.swapRows=function(h,d){if(!pt(h)||!Et(h)||!pt(d)||!Et(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 Ft(h,this._size[0]),Ft(d,this._size[0]),t._swapRows(h,d,this._data),this},t._swapRows=function(h,d,p){var v=p[h];p[h]=p[d],p[d]=v};function c(h){return mt(h)?c(h.valueOf()):Ct(h)?h.map(c):h}return t},{isClass:!0});function Rv(s){var e=s.length,t=s[0].length,r,n,i=[];for(n=0;n<t;n++){var a=[];for(r=0;r<e;r++)a.push(s[r][n]);i.push(a)}return i}function to(s){for(var e=0;e<s.length;e++)if(is(s[e]))return!0;return!1}function as(s,e){mt(s)&&(s=s.valueOf());for(var t=0,r=s.length;t<r;t++){var n=s[t];Array.isArray(n)?as(n,e):e(n)}}function Jr(s,e,t){return s&&typeof s.map=="function"?s.map(function(r){return Jr(r,e)}):e(s)}function Wa(s,e,t){var r=Array.isArray(s)?Lt(s):s.size();if(e<0||e>=r.length)throw new On(e,r.length);return mt(s)?s.create(ro(s.valueOf(),e,t)):ro(s,e,t)}function ro(s,e,t){var r,n,i,a;if(e<=0)if(Array.isArray(s[0])){for(a=Rv(s),n=[],r=0;r<a.length;r++)n[r]=ro(a[r],e-1,t);return n}else{for(i=s[0],r=1;r<s.length;r++)i=t(i,s[r]);return i}else{for(n=[],r=0;r<s.length;r++)n[r]=ro(s[r],e-1,t);return n}}var vc="isInteger",Lv=["typed"],Pv=xe(vc,Lv,s=>{var{typed:e}=s;return e(vc,{number:Et,BigNumber:function(r){return r.isInt()},Fraction:function(r){return r.d===1&&isFinite(r.n)},"Array | Matrix":e.referToSelf(t=>r=>Jr(r,t))})}),gc="number",no="number, number";function mc(s){return Math.abs(s)}mc.signature=gc;function xc(s,e){return s+e}xc.signature=no;function yc(s,e){return s-e}yc.signature=no;function Dc(s,e){return s*e}Dc.signature=no;function wc(s){return-s}wc.signature=gc;function Ec(s,e){return s*s<1&&e===1/0||s*s>1&&e===-1/0?0:Math.pow(s,e)}Ec.signature=no;var bc="number";function Ac(s){return s===0}Ac.signature=bc;function Cc(s){return Number.isNaN(s)}Cc.signature=bc;var Fc="isNumeric",kv=["typed"],zv=xe(Fc,kv,s=>{var{typed:e}=s;return e(Fc,{"number | BigNumber | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":e.referToSelf(t=>r=>Jr(r,t))})}),Bc="isZero",qv=["typed"],Uv=xe(Bc,qv,s=>{var{typed:e}=s;return e(Bc,{number:Ac,BigNumber:function(r){return r.isZero()},Complex:function(r){return r.re===0&&r.im===0},Fraction:function(r){return r.d===1&&r.n===0},Unit:e.referToSelf(t=>r=>e.find(t,r.valueType())(r.value)),"Array | Matrix":e.referToSelf(t=>r=>Jr(r,t))})}),Mc="isNaN",Wv=["typed"],Hv=xe(Mc,Wv,s=>{var{typed:e}=s;return e(Mc,{number:Cc,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 Jr(r,Number.isNaN)}})});function io(s,e,t){if(t==null)return s.eq(e);if(s.eq(e))return!0;if(s.isNaN()||e.isNaN())return!1;if(s.isFinite()&&e.isFinite()){var r=s.minus(e).abs();if(r.isZero())return!0;var n=s.constructor.max(s.abs(),e.abs());return r.lte(n.times(t))}return!1}function jv(s,e,t){return ti(s.re,e.re,t)&&ti(s.im,e.im,t)}var so=xe("compareUnits",["typed"],s=>{var{typed:e}=s;return{"Unit, Unit":e.referToSelf(t=>(r,n)=>{if(!r.equalBase(n))throw new Error("Cannot compare units with different base");return e.find(t,[r.valueType(),n.valueType()])(r.value,n.value)})}}),oo="equalScalar",Yv=["typed","config"],Zv=xe(oo,Yv,s=>{var{typed:e,config:t}=s,r=so({typed:e});return e(oo,{"boolean, boolean":function(i,a){return i===a},"number, number":function(i,a){return ti(i,a,t.epsilon)},"BigNumber, BigNumber":function(i,a){return i.eq(a)||io(i,a,t.epsilon)},"Fraction, Fraction":function(i,a){return i.equals(a)},"Complex, Complex":function(i,a){return jv(i,a,t.epsilon)}},r)});xe(oo,["typed","config"],s=>{var{typed:e,config:t}=s;return e(oo,{"number, number":function(n,i){return ti(n,i,t.epsilon)}})});var Vv="SparseMatrix",Gv=["typed","equalScalar","Matrix"],Kv=xe(Vv,Gv,s=>{var{typed:e,equalScalar:t,Matrix:r}=s;function n(_,y){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(y&&!un(y))throw new Error("Invalid datatype: "+y);if(mt(_))i(this,_,y);else if(_&&Ct(_.index)&&Ct(_.ptr)&&Ct(_.size))this._values=_.values,this._index=_.index,this._ptr=_.ptr,this._size=_.size,this._datatype=y||_.datatype;else if(Ct(_))a(this,_,y);else{if(_)throw new TypeError("Unsupported type of data ("+Sn(_)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=y}}function i(_,y,m){y.type==="SparseMatrix"?(_._values=y._values?ut(y._values):void 0,_._index=ut(y._index),_._ptr=ut(y._ptr),_._size=ut(y._size),_._datatype=m||y._datatype):a(_,y.valueOf(),m||y._datatype)}function a(_,y,m){_._values=[],_._index=[],_._ptr=[],_._datatype=m;var w=y.length,D=0,C=t,E=0;if(un(m)&&(C=e.find(t,[m,m])||t,E=e.convert(0,m)),w>0){var F=0;do{_._ptr.push(_._index.length);for(var B=0;B<w;B++){var M=y[B];if(Ct(M)){if(F===0&&D<M.length&&(D=M.length),F<M.length){var O=M[F];C(O,E)||(_._values.push(O),_._index.push(B))}}else F===0&&D<1&&(D=1),C(M,E)||(_._values.push(M),_._index.push(B))}F++}while(F<D)}_._ptr.push(_._index.length),_._size=[w,D]}n.prototype=new r,n.prototype.createSparseMatrix=function(_,y){return new n(_,y)},Object.defineProperty(n,"name",{value:"SparseMatrix"}),n.prototype.constructor=n,n.prototype.type="SparseMatrix",n.prototype.isSparseMatrix=!0,n.prototype.getDataType=function(){return js(this._values,Sn)},n.prototype.storage=function(){return"sparse"},n.prototype.datatype=function(){return this._datatype},n.prototype.create=function(_,y){return new n(_,y)},n.prototype.density=function(){var _=this._size[0],y=this._size[1];return _!==0&&y!==0?this._index.length/(_*y):0},n.prototype.subset=function(_,y,m){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return u(this,_);case 2:case 3:return l(this,_,y,m);default:throw new SyntaxError("Wrong number of arguments")}};function u(_,y){if(!Aa(y))throw new TypeError("Invalid index");var m=y.isScalar();if(m)return _.get(y.min());var w=y.size();if(w.length!==_._size.length)throw new rt(w.length,_._size.length);var D,C,E,F,B=y.min(),M=y.max();for(D=0,C=_._size.length;D<C;D++)Ft(B[D],_._size[D]),Ft(M[D],_._size[D]);var O=_._values,A=_._index,N=_._ptr,T=y.dimension(0),R=y.dimension(1),k=[],z=[];T.forEach(function(ee,te){z[ee]=te[0],k[ee]=!0});var L=O?[]:void 0,G=[],H=[];return R.forEach(function(ee){for(H.push(G.length),E=N[ee],F=N[ee+1];E<F;E++)D=A[E],k[D]===!0&&(G.push(z[D]),L&&L.push(O[E]))}),H.push(G.length),new n({values:L,index:G,ptr:H,size:w,datatype:_._datatype})}function l(_,y,m,w){if(!y||y.isIndex!==!0)throw new TypeError("Invalid index");var D=y.size(),C=y.isScalar(),E;if(mt(m)?(E=m.size(),m=m.toArray()):E=Lt(m),C){if(E.length!==0)throw new TypeError("Scalar expected");_.set(y.min(),m,w)}else{if(D.length!==1&&D.length!==2)throw new rt(D.length,_._size.length,"<");if(E.length<D.length){for(var F=0,B=0;D[F]===1&&E[F]===1;)F++;for(;D[F]===1;)B++,F++;m=jf(m,D.length,B,E)}if(!yi(D,E))throw new rt(D,E,">");if(D.length===1){var M=y.dimension(0);M.forEach(function(N,T){Ft(N),_.set([N,0],m[T[0]],w)})}else{var O=y.dimension(0),A=y.dimension(1);O.forEach(function(N,T){Ft(N),A.forEach(function(R,k){Ft(R),_.set([N,R],m[T[0]][k[0]],w)})})}}return _}n.prototype.get=function(_){if(!Ct(_))throw new TypeError("Array expected");if(_.length!==this._size.length)throw new rt(_.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var y=_[0],m=_[1];Ft(y,this._size[0]),Ft(m,this._size[1]);var w=c(y,this._ptr[m],this._ptr[m+1],this._index);return w<this._ptr[m+1]&&this._index[w]===y?this._values[w]:0},n.prototype.set=function(_,y,m){if(!Ct(_))throw new TypeError("Array expected");if(_.length!==this._size.length)throw new rt(_.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var w=_[0],D=_[1],C=this._size[0],E=this._size[1],F=t,B=0;un(this._datatype)&&(F=e.find(t,[this._datatype,this._datatype])||t,B=e.convert(0,this._datatype)),(w>C-1||D>E-1)&&(p(this,Math.max(w+1,C),Math.max(D+1,E),m),C=this._size[0],E=this._size[1]),Ft(w,C),Ft(D,E);var M=c(w,this._ptr[D],this._ptr[D+1],this._index);return M<this._ptr[D+1]&&this._index[M]===w?F(y,B)?h(M,D,this._values,this._index,this._ptr):this._values[M]=y:F(y,B)||d(M,w,D,y,this._values,this._index,this._ptr),this};function c(_,y,m,w){if(m-y===0)return m;for(var D=y;D<m;D++)if(w[D]===_)return D;return y}function h(_,y,m,w,D){m.splice(_,1),w.splice(_,1);for(var C=y+1;C<D.length;C++)D[C]--}function d(_,y,m,w,D,C,E){D.splice(_,0,w),C.splice(_,0,y);for(var F=m+1;F<E.length;F++)E[F]++}n.prototype.resize=function(_,y,m){if(!is(_))throw new TypeError("Array or Matrix expected");var w=_.valueOf().map(C=>Array.isArray(C)&&C.length===1?C[0]:C);if(w.length!==2)throw new Error("Only two dimensions matrix are supported");w.forEach(function(C){if(!pt(C)||!Et(C)||C<0)throw new TypeError("Invalid size, must contain positive integers (size: "+ct(w)+")")});var D=m?this.clone():this;return p(D,w[0],w[1],y)};function p(_,y,m,w){var D=w||0,C=t,E=0;un(_._datatype)&&(C=e.find(t,[_._datatype,_._datatype])||t,E=e.convert(0,_._datatype),D=e.convert(D,_._datatype));var F=!C(D,E),B=_._size[0],M=_._size[1],O,A,N;if(m>M){for(A=M;A<m;A++)if(_._ptr[A]=_._values.length,F)for(O=0;O<B;O++)_._values.push(D),_._index.push(O);_._ptr[m]=_._values.length}else m<M&&(_._ptr.splice(m+1,M-m),_._values.splice(_._ptr[m],_._values.length),_._index.splice(_._ptr[m],_._index.length));if(M=m,y>B){if(F){var T=0;for(A=0;A<M;A++){_._ptr[A]=_._ptr[A]+T,N=_._ptr[A+1]+T;var R=0;for(O=B;O<y;O++,R++)_._values.splice(N+R,0,D),_._index.splice(N+R,0,O),T++}_._ptr[M]=_._values.length}}else if(y<B){var k=0;for(A=0;A<M;A++){_._ptr[A]=_._ptr[A]-k;var z=_._ptr[A],L=_._ptr[A+1]-k;for(N=z;N<L;N++)O=_._index[N],O>y-1&&(_._values.splice(N,1),_._index.splice(N,1),k++)}_._ptr[A]=_._values.length}return _._size[0]=y,_._size[1]=m,_}n.prototype.reshape=function(_,y){if(!Ct(_))throw new TypeError("Array expected");if(_.length!==2)throw new Error("Sparse matrices can only be reshaped in two dimensions");_.forEach(function(ee){if(!pt(ee)||!Et(ee)||ee<=-2||ee===0)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+ct(_)+")")});var m=this._size[0]*this._size[1];_=Ta(_,m);var w=_[0]*_[1];if(m!==w)throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var D=y?this.clone():this;if(this._size[0]===_[0]&&this._size[1]===_[1])return D;for(var C=[],E=0;E<D._ptr.length;E++)for(var F=0;F<D._ptr[E+1]-D._ptr[E];F++)C.push(E);for(var B=D._values.slice(),M=D._index.slice(),O=0;O<D._index.length;O++){var A=M[O],N=C[O],T=A*D._size[1]+N;C[O]=T%_[1],M[O]=Math.floor(T/_[1])}D._values.length=0,D._index.length=0,D._ptr.length=_[1]+1,D._size=_.slice();for(var R=0;R<D._ptr.length;R++)D._ptr[R]=0;for(var k=0;k<B.length;k++){var z=M[k],L=C[k],G=B[k],H=c(z,D._ptr[L],D._ptr[L+1],D._index);d(H,z,L,G,D._values,D._index,D._ptr)}return D},n.prototype.clone=function(){var _=new n({values:this._values?ut(this._values):void 0,index:ut(this._index),ptr:ut(this._ptr),size:ut(this._size),datatype:this._datatype});return _},n.prototype.size=function(){return this._size.slice(0)},n.prototype.map=function(_,y){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var m=this,w=this._size[0],D=this._size[1],C=_c(_),E=function(B,M,O){return C===1?_(B):C===2?_(B,[M,O]):_(B,[M,O],m)};return v(this,0,w-1,0,D-1,E,y)};function v(_,y,m,w,D,C,E){var F=[],B=[],M=[],O=t,A=0;un(_._datatype)&&(O=e.find(t,[_._datatype,_._datatype])||t,A=e.convert(0,_._datatype));for(var N=function(Y,Q,pe){Y=C(Y,Q,pe),O(Y,A)||(F.push(Y),B.push(Q))},T=w;T<=D;T++){M.push(F.length);var R=_._ptr[T],k=_._ptr[T+1];if(E)for(var z=R;z<k;z++){var L=_._index[z];L>=y&&L<=m&&N(_._values[z],L-y,T-w)}else{for(var G={},H=R;H<k;H++){var ee=_._index[H];G[ee]=_._values[H]}for(var te=y;te<=m;te++){var j=te in G?G[te]:0;N(j,te-y,T-w)}}}return M.push(F.length),new n({values:F,index:B,ptr:M,size:[m-y+1,D-w+1]})}n.prototype.forEach=function(_,y){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var m=this,w=this._size[0],D=this._size[1],C=0;C<D;C++){var E=this._ptr[C],F=this._ptr[C+1];if(y)for(var B=E;B<F;B++){var M=this._index[B];_(this._values[B],[M,C],m)}else{for(var O={},A=E;A<F;A++){var N=this._index[A];O[N]=this._values[A]}for(var T=0;T<w;T++){var R=T in O?O[T]:0;_(R,[T,C],m)}}}},n.prototype[Symbol.iterator]=function*(){if(!this._values)throw new Error("Cannot iterate a Pattern only matrix");for(var _=this._size[1],y=0;y<_;y++)for(var m=this._ptr[y],w=this._ptr[y+1],D=m;D<w;D++){var C=this._index[D];yield{value:this._values[D],index:[C,y]}}},n.prototype.toArray=function(){return x(this._values,this._index,this._ptr,this._size,!0)},n.prototype.valueOf=function(){return x(this._values,this._index,this._ptr,this._size,!1)};function x(_,y,m,w,D){var C=w[0],E=w[1],F=[],B,M;for(B=0;B<C;B++)for(F[B]=[],M=0;M<E;M++)F[B][M]=0;for(M=0;M<E;M++)for(var O=m[M],A=m[M+1],N=O;N<A;N++)B=y[N],F[B][M]=_?D?ut(_[N]):_[N]:1;return F}return n.prototype.format=function(_){for(var y=this._size[0],m=this._size[1],w=this.density(),D="Sparse Matrix ["+ct(y,_)+" x "+ct(m,_)+"] density: "+ct(w,_)+`
53
+ `,C=0;C<m;C++)for(var E=this._ptr[C],F=this._ptr[C+1],B=E;B<F;B++){var M=this._index[B];D+=`
54
+ (`+ct(M,_)+", "+ct(C,_)+") ==> "+(this._values?ct(this._values[B],_):"X")}return D},n.prototype.toString=function(){return ct(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(_){if(_){if(St(_)&&(_=_.toNumber()),!pt(_)||!Et(_))throw new TypeError("The parameter k must be an integer number")}else _=0;var y=_>0?_:0,m=_<0?-_:0,w=this._size[0],D=this._size[1],C=Math.min(w-m,D-y),E=[],F=[],B=[];B[0]=0;for(var M=y;M<D&&E.length<C;M++)for(var O=this._ptr[M],A=this._ptr[M+1],N=O;N<A;N++){var T=this._index[N];if(T===M-y+m){E.push(this._values[N]),F[E.length-1]=T-m;break}}return B.push(E.length),new n({values:E,index:F,ptr:B,size:[C,1]})},n.fromJSON=function(_){return new n(_)},n.diagonal=function(_,y,m,w,D){if(!Ct(_))throw new TypeError("Array expected, size parameter");if(_.length!==2)throw new Error("Only two dimensions matrix are supported");if(_=_.map(function(ee){if(St(ee)&&(ee=ee.toNumber()),!pt(ee)||!Et(ee)||ee<1)throw new Error("Size values must be positive integers");return ee}),m){if(St(m)&&(m=m.toNumber()),!pt(m)||!Et(m))throw new TypeError("The parameter k must be an integer number")}else m=0;var C=t,E=0;un(D)&&(C=e.find(t,[D,D])||t,E=e.convert(0,D));var F=m>0?m:0,B=m<0?-m:0,M=_[0],O=_[1],A=Math.min(M-B,O-F),N;if(Ct(y)){if(y.length!==A)throw new Error("Invalid value array length");N=function(te){return y[te]}}else if(mt(y)){var T=y.size();if(T.length!==1||T[0]!==A)throw new Error("Invalid matrix length");N=function(te){return y.get([te])}}else N=function(){return y};for(var R=[],k=[],z=[],L=0;L<O;L++){z.push(R.length);var G=L-F;if(G>=0&&G<A){var H=N(G);C(H,E)||(k.push(G+B),R.push(H))}}return z.push(R.length),new n({values:R,index:k,ptr:z,size:[M,O]})},n.prototype.swapRows=function(_,y){if(!pt(_)||!Et(_)||!pt(y)||!Et(y))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return Ft(_,this._size[0]),Ft(y,this._size[0]),n._swapRows(_,y,this._size[1],this._values,this._index,this._ptr),this},n._forEachRow=function(_,y,m,w,D){for(var C=w[_],E=w[_+1],F=C;F<E;F++)D(m[F],y[F])},n._swapRows=function(_,y,m,w,D,C){for(var E=0;E<m;E++){var F=C[E],B=C[E+1],M=c(_,F,B,D),O=c(y,F,B,D);if(M<B&&O<B&&D[M]===_&&D[O]===y){if(w){var A=w[M];w[M]=w[O],w[O]=A}continue}if(M<B&&D[M]===_&&(O>=B||D[O]!==y)){var N=w?w[M]:void 0;D.splice(O,0,y),w&&w.splice(O,0,N),D.splice(O<=M?M+1:M,1),w&&w.splice(O<=M?M+1:M,1);continue}if(O<B&&D[O]===y&&(M>=B||D[M]!==_)){var T=w?w[O]:void 0;D.splice(M,0,_),w&&w.splice(M,0,T),D.splice(M<=O?O+1:O,1),w&&w.splice(M<=O?O+1:O,1)}}},n},{isClass:!0}),Xv="number",Qv=["typed"];function Jv(s){var e=s.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(e){var t={"0b":2,"0o":8,"0x":16}[e[1]],r=e[2],n=e[3];return{input:s,radix:t,integerPart:r,fractionalPart:n}}else return null}function eg(s){for(var e=parseInt(s.integerPart,s.radix),t=0,r=0;r<s.fractionalPart.length;r++){var n=parseInt(s.fractionalPart[r],s.radix);t+=n/Math.pow(s.radix,r+1)}var i=e+t;if(isNaN(i))throw new SyntaxError('String "'+s.input+'" is not a valid number');return i}var tg=xe(Xv,Qv,s=>{var{typed:e}=s,t=e("number",{"":function(){return 0},number:function(n){return n},string:function(n){if(n==="NaN")return NaN;var i=Jv(n);if(i)return eg(i);var a=0,u=n.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);u&&(a=Number(u[2]),n=u[1]);var l=Number(n);if(isNaN(l))throw new SyntaxError('String "'+n+'" is not a valid number');if(u){if(l>2**a-1)throw new SyntaxError('String "'.concat(n,'" is out of range'));l>=2**(a-1)&&(l=l-2**a)}return l},BigNumber:function(n){return n.toNumber()},Fraction:function(n){return n.valueOf()},Unit:e.referToSelf(r=>n=>{var i=n.clone();return i.value=r(n.value),i}),null:function(n){return 0},"Unit, string | Unit":function(n,i){return n.toNumber(i)},"Array | Matrix":e.referToSelf(r=>n=>Jr(n,r))});return t.fromJSON=function(r){return parseFloat(r.value)},t}),rg="bignumber",ng=["typed","BigNumber"],ig=xe(rg,ng,s=>{var{typed:e,BigNumber:t}=s;return e("bignumber",{"":function(){return new t(0)},number:function(n){return new t(n+"")},string:function(n){var i=n.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(i){var a=i[2],u=t(i[1]),l=new t(2).pow(Number(a));if(u.gt(l.sub(1)))throw new SyntaxError('String "'.concat(n,'" is out of range'));var c=new t(2).pow(Number(a)-1);return u.gte(c)?u.sub(l):u}return new t(n)},BigNumber:function(n){return n},Unit:e.referToSelf(r=>n=>{var i=n.clone();return i.value=r(n.value),i}),Fraction:function(n){return new t(n.n).div(n.d).times(n.s)},null:function(n){return new t(0)},"Array | Matrix":e.referToSelf(r=>n=>Jr(n,r))})}),sg="fraction",og=["typed","Fraction"],ag=xe(sg,og,s=>{var{typed:e,Fraction:t}=s;return e("fraction",{number:function(n){if(!isFinite(n)||isNaN(n))throw new Error(n+" cannot be represented as a fraction");return new t(n)},string:function(n){return new t(n)},"number, number":function(n,i){return new t(n,i)},null:function(n){return new t(0)},BigNumber:function(n){return new t(n.toString())},Fraction:function(n){return n},Unit:e.referToSelf(r=>n=>{var i=n.clone();return i.value=r(n.value),i}),Object:function(n){return new t(n)},"Array | Matrix":e.referToSelf(r=>n=>Jr(n,r))})}),Nc="matrix",ug=["typed","Matrix","DenseMatrix","SparseMatrix"],fg=xe(Nc,ug,s=>{var{typed:e,Matrix:t,DenseMatrix:r,SparseMatrix:n}=s;return e(Nc,{"":function(){return i([])},string:function(u){return i([],u)},"string, string":function(u,l){return i([],u,l)},Array:function(u){return i(u)},Matrix:function(u){return i(u,u.storage())},"Array | Matrix, string":i,"Array | Matrix, string, string":i});function i(a,u,l){if(u==="dense"||u==="default"||u===void 0)return new r(a,l);if(u==="sparse")return new n(a,l);throw new TypeError("Unknown matrix type "+JSON.stringify(u)+".")}}),Sc="unaryMinus",cg=["typed"],lg=xe(Sc,cg,s=>{var{typed:e}=s;return e(Sc,{number:wc,"Complex | BigNumber | Fraction":t=>t.neg(),Unit:e.referToSelf(t=>r=>{var n=r.clone();return n.value=e.find(t,n.valueType())(r.value),n}),"Array | Matrix":e.referToSelf(t=>r=>Jr(r,t))})}),Oc="abs",hg=["typed"],dg=xe(Oc,hg,s=>{var{typed:e}=s;return e(Oc,{number:mc,"Complex | BigNumber | Fraction | Unit":t=>t.abs(),"Array | Matrix":e.referToSelf(t=>r=>Jr(r,t))})}),Tc="addScalar",pg=["typed"],_g=xe(Tc,pg,s=>{var{typed:e}=s;return e(Tc,{"number, number":xc,"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":e.referToSelf(t=>(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 i=r.clone();return i.value=e.find(t,[i.valueType(),n.valueType()])(i.value,n.value),i.fixPrefix=!1,i})})}),Ic="subtractScalar",vg=["typed"],gg=xe(Ic,vg,s=>{var{typed:e}=s;return e(Ic,{"number, number":yc,"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":e.referToSelf(t=>(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 i=r.clone();return i.value=e.find(t,[i.valueType(),n.valueType()])(i.value,n.value),i.fixPrefix=!1,i})})}),mg="matAlgo11xS0s",xg=["typed","equalScalar"],Ha=xe(mg,xg,s=>{var{typed:e,equalScalar:t}=s;return function(n,i,a,u){var l=n._values,c=n._index,h=n._ptr,d=n._size,p=n._datatype;if(!l)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var v=d[0],x=d[1],_,y=t,m=0,w=a;typeof p=="string"&&(_=p,y=e.find(t,[_,_]),m=e.convert(0,_),i=e.convert(i,_),w=e.find(a,[_,_]));for(var D=[],C=[],E=[],F=0;F<x;F++){E[F]=C.length;for(var B=h[F],M=h[F+1],O=B;O<M;O++){var A=c[O],N=u?w(i,l[O]):w(l[O],i);y(N,m)||(C.push(A),D.push(N))}}return E[x]=C.length,n.createSparseMatrix({values:D,index:C,ptr:E,size:[v,x],datatype:_})}}),yg="matAlgo12xSfs",Dg=["typed","DenseMatrix"],Ci=xe(yg,Dg,s=>{var{typed:e,DenseMatrix:t}=s;return function(n,i,a,u){var l=n._values,c=n._index,h=n._ptr,d=n._size,p=n._datatype;if(!l)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var v=d[0],x=d[1],_,y=a;typeof p=="string"&&(_=p,i=e.convert(i,_),y=e.find(a,[_,_]));for(var m=[],w=[],D=[],C=0;C<x;C++){for(var E=C+1,F=h[C],B=h[C+1],M=F;M<B;M++){var O=c[M];w[O]=l[M],D[O]=E}for(var A=0;A<v;A++)C===0&&(m[A]=[]),D[A]===E?m[A][C]=u?y(i,w[A]):y(w[A],i):m[A][C]=u?y(i,0):y(0,i)}return new t({data:m,size:[v,x],datatype:_})}}),wg="matAlgo14xDs",Eg=["typed"],ja=xe(wg,Eg,s=>{var{typed:e}=s;return function(n,i,a,u){var l=n._data,c=n._size,h=n._datatype,d,p=a;typeof h=="string"&&(d=h,i=e.convert(i,d),p=e.find(a,[d,d]));var v=c.length>0?t(p,0,c,c[0],l,i,u):[];return n.createDenseMatrix({data:v,size:ut(c),datatype:d})};function t(r,n,i,a,u,l,c){var h=[];if(n===i.length-1)for(var d=0;d<a;d++)h[d]=c?r(l,u[d]):r(u[d],l);else for(var p=0;p<a;p++)h[p]=t(r,n+1,i,i[n+1],u[p],l,c);return h}}),bg="matAlgo02xDS0",Ag=["typed","equalScalar"],Cg=xe(bg,Ag,s=>{var{typed:e,equalScalar:t}=s;return function(n,i,a,u){var l=n._data,c=n._size,h=n._datatype||n.getDataType(),d=i._values,p=i._index,v=i._ptr,x=i._size,_=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(c.length!==x.length)throw new rt(c.length,x.length);if(c[0]!==x[0]||c[1]!==x[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+x+")");if(!d)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var y=c[0],m=c[1],w,D=t,C=0,E=a;typeof h=="string"&&h===_&&h!=="mixed"&&(w=h,D=e.find(t,[w,w]),C=e.convert(0,w),E=e.find(a,[w,w]));for(var F=[],B=[],M=[],O=0;O<m;O++){M[O]=B.length;for(var A=v[O],N=v[O+1],T=A;T<N;T++){var R=p[T],k=u?E(d[T],l[R][O]):E(l[R][O],d[T]);D(k,C)||(B.push(R),F.push(k))}}return M[m]=B.length,i.createSparseMatrix({values:F,index:B,ptr:M,size:[y,m],datatype:h===n._datatype&&_===i._datatype?w:void 0})}}),Fg="matAlgo03xDSf",Bg=["typed"],Fi=xe(Fg,Bg,s=>{var{typed:e}=s;return function(r,n,i,a){var u=r._data,l=r._size,c=r._datatype||r.getDataType(),h=n._values,d=n._index,p=n._ptr,v=n._size,x=n._datatype||n._data===void 0?n._datatype:n.getDataType();if(l.length!==v.length)throw new rt(l.length,v.length);if(l[0]!==v[0]||l[1]!==v[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+v+")");if(!h)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var _=l[0],y=l[1],m,w=0,D=i;typeof c=="string"&&c===x&&c!=="mixed"&&(m=c,w=e.convert(0,m),D=e.find(i,[m,m]));for(var C=[],E=0;E<_;E++)C[E]=[];for(var F=[],B=[],M=0;M<y;M++){for(var O=M+1,A=p[M],N=p[M+1],T=A;T<N;T++){var R=d[T];F[R]=a?D(h[T],u[R][M]):D(u[R][M],h[T]),B[R]=O}for(var k=0;k<_;k++)B[k]===O?C[k][M]=F[k]:C[k][M]=a?D(w,u[k][M]):D(u[k][M],w)}return r.createDenseMatrix({data:C,size:[_,y],datatype:c===r._datatype&&x===n._datatype?m:void 0})}}),Mg="matAlgo05xSfSf",Ng=["typed","equalScalar"],$c=xe(Mg,Ng,s=>{var{typed:e,equalScalar:t}=s;return function(n,i,a){var u=n._values,l=n._index,c=n._ptr,h=n._size,d=n._datatype||n._data===void 0?n._datatype:n.getDataType(),p=i._values,v=i._index,x=i._ptr,_=i._size,y=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(h.length!==_.length)throw new rt(h.length,_.length);if(h[0]!==_[0]||h[1]!==_[1])throw new RangeError("Dimension mismatch. Matrix A ("+h+") must match Matrix B ("+_+")");var m=h[0],w=h[1],D,C=t,E=0,F=a;typeof d=="string"&&d===y&&d!=="mixed"&&(D=d,C=e.find(t,[D,D]),E=e.convert(0,D),F=e.find(a,[D,D]));var B=u&&p?[]:void 0,M=[],O=[],A=B?[]:void 0,N=B?[]:void 0,T=[],R=[],k,z,L,G;for(z=0;z<w;z++){O[z]=M.length;var H=z+1;for(L=c[z],G=c[z+1];L<G;L++)k=l[L],M.push(k),T[k]=H,A&&(A[k]=u[L]);for(L=x[z],G=x[z+1];L<G;L++)k=v[L],T[k]!==H&&M.push(k),R[k]=H,N&&(N[k]=p[L]);if(B)for(L=O[z];L<M.length;){k=M[L];var ee=T[k],te=R[k];if(ee===H||te===H){var j=ee===H?A[k]:E,X=te===H?N[k]:E,Y=F(j,X);C(Y,E)?M.splice(L,1):(B.push(Y),L++)}}}return O[w]=M.length,n.createSparseMatrix({values:B,index:M,ptr:O,size:[m,w],datatype:d===n._datatype&&y===i._datatype?D:void 0})}}),Sg="matAlgo13xDD",Og=["typed"],Tg=xe(Sg,Og,s=>{var{typed:e}=s;return function(n,i,a){var u=n._data,l=n._size,c=n._datatype,h=i._data,d=i._size,p=i._datatype,v=[];if(l.length!==d.length)throw new rt(l.length,d.length);for(var x=0;x<l.length;x++){if(l[x]!==d[x])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+d+")");v[x]=l[x]}var _,y=a;typeof c=="string"&&c===p&&(_=c,y=e.find(a,[_,_]));var m=v.length>0?t(y,0,v,v[0],u,h):[];return n.createDenseMatrix({data:m,size:v,datatype:_})};function t(r,n,i,a,u,l){var c=[];if(n===i.length-1)for(var h=0;h<a;h++)c[h]=r(u[h],l[h]);else for(var d=0;d<a;d++)c[d]=t(r,n+1,i,i[n+1],u[d],l[d]);return c}}),Ig="broadcast",$g=["concat"],Rg=xe(Ig,$g,s=>{var{concat:e}=s;return function(n,i){var a=Math.max(n._size.length,i._size.length);if(n._size.length===i._size.length&&n._size.every((x,_)=>x===i._size[_]))return[n,i];for(var u=t(n._size,a,0),l=t(i._size,a,0),c=[],h=0;h<a;h++)c[h]=Math.max(u[h],l[h]);Ys(u,c),Ys(l,c);var d=n.clone(),p=i.clone();d._size.length<a?d.reshape(t(d._size,a,1)):p._size.length<a&&p.reshape(t(p._size,a,1));for(var v=0;v<a;v++)d._size[v]<c[v]&&(d=r(d,c[v],v)),p._size[v]<c[v]&&(p=r(p,c[v],v));return[d,p]};function t(n,i,a){return[...Array(i-n.length).fill(a),...n]}function r(n,i,a){return e(...Array(i).fill(n),a)}}),Lg="matrixAlgorithmSuite",Pg=["typed","matrix","concat"],ri=xe(Lg,Pg,s=>{var{typed:e,matrix:t,concat:r}=s,n=Tg({typed:e}),i=ja({typed:e}),a=Rg({concat:r});return function(l){var c=l.elop,h=l.SD||l.DS,d;c?(d={"DenseMatrix, DenseMatrix":(_,y)=>n(...a(_,y),c),"Array, Array":(_,y)=>n(...a(t(_),t(y)),c).valueOf(),"Array, DenseMatrix":(_,y)=>n(...a(t(_),y),c),"DenseMatrix, Array":(_,y)=>n(...a(_,t(y)),c)},l.SS&&(d["SparseMatrix, SparseMatrix"]=(_,y)=>l.SS(...a(_,y),c,!1)),l.DS&&(d["DenseMatrix, SparseMatrix"]=(_,y)=>l.DS(...a(_,y),c,!1),d["Array, SparseMatrix"]=(_,y)=>l.DS(...a(t(_),y),c,!1)),h&&(d["SparseMatrix, DenseMatrix"]=(_,y)=>h(...a(y,_),c,!0),d["SparseMatrix, Array"]=(_,y)=>h(...a(t(y),_),c,!0))):(d={"DenseMatrix, DenseMatrix":e.referToSelf(_=>(y,m)=>n(...a(y,m),_)),"Array, Array":e.referToSelf(_=>(y,m)=>n(...a(t(y),t(m)),_).valueOf()),"Array, DenseMatrix":e.referToSelf(_=>(y,m)=>n(...a(t(y),m),_)),"DenseMatrix, Array":e.referToSelf(_=>(y,m)=>n(...a(y,t(m)),_))},l.SS&&(d["SparseMatrix, SparseMatrix"]=e.referToSelf(_=>(y,m)=>l.SS(...a(y,m),_,!1))),l.DS&&(d["DenseMatrix, SparseMatrix"]=e.referToSelf(_=>(y,m)=>l.DS(...a(y,m),_,!1)),d["Array, SparseMatrix"]=e.referToSelf(_=>(y,m)=>l.DS(...a(t(y),m),_,!1))),h&&(d["SparseMatrix, DenseMatrix"]=e.referToSelf(_=>(y,m)=>h(...a(m,y),_,!0)),d["SparseMatrix, Array"]=e.referToSelf(_=>(y,m)=>h(...a(t(m),y),_,!0))));var p=l.scalar||"any",v=l.Ds||l.Ss;v&&(c?(d["DenseMatrix,"+p]=(_,y)=>i(_,y,c,!1),d[p+", DenseMatrix"]=(_,y)=>i(y,_,c,!0),d["Array,"+p]=(_,y)=>i(t(_),y,c,!1).valueOf(),d[p+", Array"]=(_,y)=>i(t(y),_,c,!0).valueOf()):(d["DenseMatrix,"+p]=e.referToSelf(_=>(y,m)=>i(y,m,_,!1)),d[p+", DenseMatrix"]=e.referToSelf(_=>(y,m)=>i(m,y,_,!0)),d["Array,"+p]=e.referToSelf(_=>(y,m)=>i(t(y),m,_,!1).valueOf()),d[p+", Array"]=e.referToSelf(_=>(y,m)=>i(t(m),y,_,!0).valueOf())));var x=l.sS!==void 0?l.sS:l.Ss;return c?(l.Ss&&(d["SparseMatrix,"+p]=(_,y)=>l.Ss(_,y,c,!1)),x&&(d[p+", SparseMatrix"]=(_,y)=>x(y,_,c,!0))):(l.Ss&&(d["SparseMatrix,"+p]=e.referToSelf(_=>(y,m)=>l.Ss(y,m,_,!1))),x&&(d[p+", SparseMatrix"]=e.referToSelf(_=>(y,m)=>x(m,y,_,!0)))),c&&c.signatures&&Bf(d,c.signatures),d}}),kg="matAlgo01xDSid",zg=["typed"],Rc=xe(kg,zg,s=>{var{typed:e}=s;return function(r,n,i,a){var u=r._data,l=r._size,c=r._datatype||r.getDataType(),h=n._values,d=n._index,p=n._ptr,v=n._size,x=n._datatype||n._data===void 0?n._datatype:n.getDataType();if(l.length!==v.length)throw new rt(l.length,v.length);if(l[0]!==v[0]||l[1]!==v[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+v+")");if(!h)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var _=l[0],y=l[1],m=typeof c=="string"&&c!=="mixed"&&c===x?c:void 0,w=m?e.find(i,[m,m]):i,D,C,E=[];for(D=0;D<_;D++)E[D]=[];var F=[],B=[];for(C=0;C<y;C++){for(var M=C+1,O=p[C],A=p[C+1],N=O;N<A;N++)D=d[N],F[D]=a?w(h[N],u[D][C]):w(u[D][C],h[N]),B[D]=M;for(D=0;D<_;D++)B[D]===M?E[D][C]=F[D]:E[D][C]=u[D][C]}return r.createDenseMatrix({data:E,size:[_,y],datatype:c===r._datatype&&x===n._datatype?m:void 0})}}),qg="matAlgo04xSidSid",Ug=["typed","equalScalar"],Wg=xe(qg,Ug,s=>{var{typed:e,equalScalar:t}=s;return function(n,i,a){var u=n._values,l=n._index,c=n._ptr,h=n._size,d=n._datatype||n._data===void 0?n._datatype:n.getDataType(),p=i._values,v=i._index,x=i._ptr,_=i._size,y=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(h.length!==_.length)throw new rt(h.length,_.length);if(h[0]!==_[0]||h[1]!==_[1])throw new RangeError("Dimension mismatch. Matrix A ("+h+") must match Matrix B ("+_+")");var m=h[0],w=h[1],D,C=t,E=0,F=a;typeof d=="string"&&d===y&&d!=="mixed"&&(D=d,C=e.find(t,[D,D]),E=e.convert(0,D),F=e.find(a,[D,D]));var B=u&&p?[]:void 0,M=[],O=[],A=u&&p?[]:void 0,N=u&&p?[]:void 0,T=[],R=[],k,z,L,G,H;for(z=0;z<w;z++){O[z]=M.length;var ee=z+1;for(G=c[z],H=c[z+1],L=G;L<H;L++)k=l[L],M.push(k),T[k]=ee,A&&(A[k]=u[L]);for(G=x[z],H=x[z+1],L=G;L<H;L++)if(k=v[L],T[k]===ee){if(A){var te=F(A[k],p[L]);C(te,E)?T[k]=null:A[k]=te}}else M.push(k),R[k]=ee,N&&(N[k]=p[L]);if(A&&N)for(L=O[z];L<M.length;)k=M[L],T[k]===ee?(B[L]=A[k],L++):R[k]===ee?(B[L]=N[k],L++):M.splice(L,1)}return O[w]=M.length,n.createSparseMatrix({values:B,index:M,ptr:O,size:[m,w],datatype:d===n._datatype&&y===i._datatype?D:void 0})}}),Hg="matAlgo10xSids",jg=["typed","DenseMatrix"],Lc=xe(Hg,jg,s=>{var{typed:e,DenseMatrix:t}=s;return function(n,i,a,u){var l=n._values,c=n._index,h=n._ptr,d=n._size,p=n._datatype;if(!l)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var v=d[0],x=d[1],_,y=a;typeof p=="string"&&(_=p,i=e.convert(i,_),y=e.find(a,[_,_]));for(var m=[],w=[],D=[],C=0;C<x;C++){for(var E=C+1,F=h[C],B=h[C+1],M=F;M<B;M++){var O=c[M];w[O]=l[M],D[O]=E}for(var A=0;A<v;A++)C===0&&(m[A]=[]),D[A]===E?m[A][C]=u?y(i,w[A]):y(w[A],i):m[A][C]=i}return new t({data:m,size:[v,x],datatype:_})}}),Yg="multiplyScalar",Zg=["typed"],Vg=xe(Yg,Zg,s=>{var{typed:e}=s;return e("multiplyScalar",{"number, number":Dc,"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":(t,r)=>r.multiply(t),"Unit, number | Fraction | BigNumber | Complex | Unit":(t,r)=>t.multiply(r)})}),Pc="multiply",Gg=["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],Kg=xe(Pc,Gg,s=>{var{typed:e,matrix:t,addScalar:r,multiplyScalar:n,equalScalar:i,dot:a}=s,u=Ha({typed:e,equalScalar:i}),l=ja({typed:e});function c(E,F){switch(E.length){case 1:switch(F.length){case 1:if(E[0]!==F[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(E[0]!==F[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+E[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(E[1]!==F[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+E[1]+") must match Vector length ("+F[0]+")");break;case 2:if(E[1]!==F[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+E[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 "+E.length+" dimensions)")}}function h(E,F,B){if(B===0)throw new Error("Cannot multiply two empty vectors");return a(E,F)}function d(E,F){if(F.storage()!=="dense")throw new Error("Support for SparseMatrix not implemented");return p(E,F)}function p(E,F){var B=E._data,M=E._size,O=E._datatype||E.getDataType(),A=F._data,N=F._size,T=F._datatype||F.getDataType(),R=M[0],k=N[1],z,L=r,G=n;O&&T&&O===T&&typeof O=="string"&&O!=="mixed"&&(z=O,L=e.find(r,[z,z]),G=e.find(n,[z,z]));for(var H=[],ee=0;ee<k;ee++){for(var te=G(B[0],A[0][ee]),j=1;j<R;j++)te=L(te,G(B[j],A[j][ee]));H[ee]=te}return E.createDenseMatrix({data:H,size:[k],datatype:O===E._datatype&&T===F._datatype?z:void 0})}var v=e("_multiplyMatrixVector",{"DenseMatrix, any":_,"SparseMatrix, any":w}),x=e("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":y,"DenseMatrix, SparseMatrix":m,"SparseMatrix, DenseMatrix":D,"SparseMatrix, SparseMatrix":C});function _(E,F){var B=E._data,M=E._size,O=E._datatype||E.getDataType(),A=F._data,N=F._datatype||F.getDataType(),T=M[0],R=M[1],k,z=r,L=n;O&&N&&O===N&&typeof O=="string"&&O!=="mixed"&&(k=O,z=e.find(r,[k,k]),L=e.find(n,[k,k]));for(var G=[],H=0;H<T;H++){for(var ee=B[H],te=L(ee[0],A[0]),j=1;j<R;j++)te=z(te,L(ee[j],A[j]));G[H]=te}return E.createDenseMatrix({data:G,size:[T],datatype:O===E._datatype&&N===F._datatype?k:void 0})}function y(E,F){var B=E._data,M=E._size,O=E._datatype||E.getDataType(),A=F._data,N=F._size,T=F._datatype||F.getDataType(),R=M[0],k=M[1],z=N[1],L,G=r,H=n;O&&T&&O===T&&typeof O=="string"&&O!=="mixed"&&O!=="mixed"&&(L=O,G=e.find(r,[L,L]),H=e.find(n,[L,L]));for(var ee=[],te=0;te<R;te++){var j=B[te];ee[te]=[];for(var X=0;X<z;X++){for(var Y=H(j[0],A[0][X]),Q=1;Q<k;Q++)Y=G(Y,H(j[Q],A[Q][X]));ee[te][X]=Y}}return E.createDenseMatrix({data:ee,size:[R,z],datatype:O===E._datatype&&T===F._datatype?L:void 0})}function m(E,F){var B=E._data,M=E._size,O=E._datatype||E.getDataType(),A=F._values,N=F._index,T=F._ptr,R=F._size,k=F._datatype||F._data===void 0?F._datatype:F.getDataType();if(!A)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var z=M[0],L=R[1],G,H=r,ee=n,te=i,j=0;O&&k&&O===k&&typeof O=="string"&&O!=="mixed"&&(G=O,H=e.find(r,[G,G]),ee=e.find(n,[G,G]),te=e.find(i,[G,G]),j=e.convert(0,G));for(var X=[],Y=[],Q=[],pe=F.createSparseMatrix({values:X,index:Y,ptr:Q,size:[z,L],datatype:O===E._datatype&&k===F._datatype?G:void 0}),De=0;De<L;De++){Q[De]=Y.length;var we=T[De],Ee=T[De+1];if(Ee>we)for(var Oe=0,Fe=0;Fe<z;Fe++){for(var nt=Fe+1,Ye=void 0,Te=we;Te<Ee;Te++){var Re=N[Te];Oe!==nt?(Ye=ee(B[Fe][Re],A[Te]),Oe=nt):Ye=H(Ye,ee(B[Fe][Re],A[Te]))}Oe===nt&&!te(Ye,j)&&(Y.push(Fe),X.push(Ye))}}return Q[L]=Y.length,pe}function w(E,F){var B=E._values,M=E._index,O=E._ptr,A=E._datatype||E._data===void 0?E._datatype:E.getDataType();if(!B)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var N=F._data,T=F._datatype||F.getDataType(),R=E._size[0],k=F._size[0],z=[],L=[],G=[],H,ee=r,te=n,j=i,X=0;A&&T&&A===T&&typeof A=="string"&&A!=="mixed"&&(H=A,ee=e.find(r,[H,H]),te=e.find(n,[H,H]),j=e.find(i,[H,H]),X=e.convert(0,H));var Y=[],Q=[];G[0]=0;for(var pe=0;pe<k;pe++){var De=N[pe];if(!j(De,X))for(var we=O[pe],Ee=O[pe+1],Oe=we;Oe<Ee;Oe++){var Fe=M[Oe];Q[Fe]?Y[Fe]=ee(Y[Fe],te(De,B[Oe])):(Q[Fe]=!0,L.push(Fe),Y[Fe]=te(De,B[Oe]))}}for(var nt=L.length,Ye=0;Ye<nt;Ye++){var Te=L[Ye];z[Ye]=Y[Te]}return G[1]=L.length,E.createSparseMatrix({values:z,index:L,ptr:G,size:[R,1],datatype:A===E._datatype&&T===F._datatype?H:void 0})}function D(E,F){var B=E._values,M=E._index,O=E._ptr,A=E._datatype||E._data===void 0?E._datatype:E.getDataType();if(!B)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var N=F._data,T=F._datatype||F.getDataType(),R=E._size[0],k=F._size[0],z=F._size[1],L,G=r,H=n,ee=i,te=0;A&&T&&A===T&&typeof A=="string"&&A!=="mixed"&&(L=A,G=e.find(r,[L,L]),H=e.find(n,[L,L]),ee=e.find(i,[L,L]),te=e.convert(0,L));for(var j=[],X=[],Y=[],Q=E.createSparseMatrix({values:j,index:X,ptr:Y,size:[R,z],datatype:A===E._datatype&&T===F._datatype?L:void 0}),pe=[],De=[],we=0;we<z;we++){Y[we]=X.length;for(var Ee=we+1,Oe=0;Oe<k;Oe++){var Fe=N[Oe][we];if(!ee(Fe,te))for(var nt=O[Oe],Ye=O[Oe+1],Te=nt;Te<Ye;Te++){var Re=M[Te];De[Re]!==Ee?(De[Re]=Ee,X.push(Re),pe[Re]=H(Fe,B[Te])):pe[Re]=G(pe[Re],H(Fe,B[Te]))}}for(var xt=Y[we],Ut=X.length,bt=xt;bt<Ut;bt++){var ur=X[bt];j[bt]=pe[ur]}}return Y[z]=X.length,Q}function C(E,F){var B=E._values,M=E._index,O=E._ptr,A=E._datatype||E._data===void 0?E._datatype:E.getDataType(),N=F._values,T=F._index,R=F._ptr,k=F._datatype||F._data===void 0?F._datatype:F.getDataType(),z=E._size[0],L=F._size[1],G=B&&N,H,ee=r,te=n;A&&k&&A===k&&typeof A=="string"&&A!=="mixed"&&(H=A,ee=e.find(r,[H,H]),te=e.find(n,[H,H]));for(var j=G?[]:void 0,X=[],Y=[],Q=E.createSparseMatrix({values:j,index:X,ptr:Y,size:[z,L],datatype:A===E._datatype&&k===F._datatype?H:void 0}),pe=G?[]:void 0,De=[],we,Ee,Oe,Fe,nt,Ye,Te,Re,xt=0;xt<L;xt++){Y[xt]=X.length;var Ut=xt+1;for(nt=R[xt],Ye=R[xt+1],Fe=nt;Fe<Ye;Fe++)if(Re=T[Fe],G)for(Ee=O[Re],Oe=O[Re+1],we=Ee;we<Oe;we++)Te=M[we],De[Te]!==Ut?(De[Te]=Ut,X.push(Te),pe[Te]=te(N[Fe],B[we])):pe[Te]=ee(pe[Te],te(N[Fe],B[we]));else for(Ee=O[Re],Oe=O[Re+1],we=Ee;we<Oe;we++)Te=M[we],De[Te]!==Ut&&(De[Te]=Ut,X.push(Te));if(G)for(var bt=Y[xt],ur=X.length,Lr=bt;Lr<ur;Lr++){var fr=X[Lr];j[Lr]=pe[fr]}}return Y[L]=X.length,Q}return e(Pc,n,{"Array, Array":e.referTo("Matrix, Matrix",E=>(F,B)=>{c(Lt(F),Lt(B));var M=E(t(F),t(B));return mt(M)?M.valueOf():M}),"Matrix, Matrix":function(F,B){var M=F.size(),O=B.size();return c(M,O),M.length===1?O.length===1?h(F,B,M[0]):d(F,B):O.length===1?v(F,B):x(F,B)},"Matrix, Array":e.referTo("Matrix,Matrix",E=>(F,B)=>E(F,t(B))),"Array, Matrix":e.referToSelf(E=>(F,B)=>E(t(F,B.storage()),B)),"SparseMatrix, any":function(F,B){return u(F,B,n,!1)},"DenseMatrix, any":function(F,B){return l(F,B,n,!1)},"any, SparseMatrix":function(F,B){return u(B,F,n,!0)},"any, DenseMatrix":function(F,B){return l(B,F,n,!0)},"Array, any":function(F,B){return l(t(F),B,n,!1).valueOf()},"any, Array":function(F,B){return l(t(B),F,n,!0).valueOf()},"any, any":n,"any, any, ...any":e.referToSelf(E=>(F,B,M)=>{for(var O=E(F,B),A=0;A<M.length;A++)O=E(O,M[A]);return O})})}),kc="subtract",Xg=["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],Qg=xe(kc,Xg,s=>{var{typed:e,matrix:t,equalScalar:r,subtractScalar:n,unaryMinus:i,DenseMatrix:a,concat:u}=s,l=Rc({typed:e}),c=Fi({typed:e}),h=$c({typed:e,equalScalar:r}),d=Lc({typed:e,DenseMatrix:a}),p=Ci({typed:e,DenseMatrix:a}),v=ri({typed:e,matrix:t,concat:u});return e(kc,{"any, any":n},v({elop:n,SS:h,DS:l,SD:c,Ss:p,sS:d}))}),Jg="matAlgo07xSSf",em=["typed","DenseMatrix"],ao=xe(Jg,em,s=>{var{typed:e,DenseMatrix:t}=s;return function(i,a,u){var l=i._size,c=i._datatype||i._data===void 0?i._datatype:i.getDataType(),h=a._size,d=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(l.length!==h.length)throw new rt(l.length,h.length);if(l[0]!==h[0]||l[1]!==h[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+h+")");var p=l[0],v=l[1],x,_=0,y=u;typeof c=="string"&&c===d&&c!=="mixed"&&(x=c,_=e.convert(0,x),y=e.find(u,[x,x]));var m,w,D=[];for(m=0;m<p;m++)D[m]=[];var C=[],E=[],F=[],B=[];for(w=0;w<v;w++){var M=w+1;for(r(i,w,F,C,M),r(a,w,B,E,M),m=0;m<p;m++){var O=F[m]===M?C[m]:_,A=B[m]===M?E[m]:_;D[m][w]=y(O,A)}}return new t({data:D,size:[p,v],datatype:c===i._datatype&&d===a._datatype?x:void 0})};function r(n,i,a,u,l){for(var c=n._values,h=n._index,d=n._ptr,p=d[i],v=d[i+1];p<v;p++){var x=h[p];a[x]=l,u[x]=c[p]}}}),zc="conj",tm=["typed"],rm=xe(zc,tm,s=>{var{typed:e}=s;return e(zc,{"number | BigNumber | Fraction":t=>t,Complex:t=>t.conjugate(),"Array | Matrix":e.referToSelf(t=>r=>Jr(r,t))})}),qc="concat",nm=["typed","matrix","isInteger"],im=xe(qc,nm,s=>{var{typed:e,matrix:t,isInteger:r}=s;return e(qc,{"...Array | Matrix | number | BigNumber":function(i){var a,u=i.length,l=-1,c,h=!1,d=[];for(a=0;a<u;a++){var p=i[a];if(mt(p)&&(h=!0),pt(p)||St(p)){if(a!==u-1)throw new Error("Dimension must be specified as last argument");if(c=l,l=p.valueOf(),!r(l))throw new TypeError("Integer number expected for dimension");if(l<0||a>0&&l>c)throw new On(l,c+1)}else{var v=ut(p).valueOf(),x=Lt(v);if(d[a]=v,c=l,l=x.length-1,a>0&&l!==c)throw new rt(c+1,l+1)}}if(d.length===0)throw new SyntaxError("At least one matrix expected");for(var _=d.shift();d.length;)_=Vf(_,d.shift(),l);return h?t(_):_},"...string":function(i){return i.join("")}})}),Uc="count",sm=["typed","size","prod"],om=xe(Uc,sm,s=>{var{typed:e,size:t,prod:r}=s;return e(Uc,{string:function(i){return i.length},"Matrix | Array":function(i){return r(t(i))}})}),Wc="identity",am=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],um=xe(Wc,am,s=>{var{typed:e,config:t,matrix:r,BigNumber:n,DenseMatrix:i,SparseMatrix:a}=s;return e(Wc,{"":function(){return t.matrix==="Matrix"?r([]):[]},string:function(h){return r(h)},"number | BigNumber":function(h){return l(h,h,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, string":function(h,d){return l(h,h,d)},"number | BigNumber, number | BigNumber":function(h,d){return l(h,d,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(h,d,p){return l(h,d,p)},Array:function(h){return u(h)},"Array, string":function(h,d){return u(h,d)},Matrix:function(h){return u(h.valueOf(),h.storage())},"Matrix, string":function(h,d){return u(h.valueOf(),d)}});function u(c,h){switch(c.length){case 0:return h?r(h):[];case 1:return l(c[0],c[0],h);case 2:return l(c[0],c[1],h);default:throw new Error("Vector containing two values expected")}}function l(c,h,d){var p=St(c)||St(h)?n:null;if(St(c)&&(c=c.toNumber()),St(h)&&(h=h.toNumber()),!Et(c)||c<1)throw new Error("Parameters in function identity must be positive integers");if(!Et(h)||h<1)throw new Error("Parameters in function identity must be positive integers");var v=p?new n(1):1,x=p?new p(0):0,_=[c,h];if(d){if(d==="sparse")return a.diagonal(_,v,0,x);if(d==="dense")return i.diagonal(_,v,0,x);throw new TypeError('Unknown matrix type "'.concat(d,'"'))}for(var y=Na([],_,x),m=c<h?c:h,w=0;w<m;w++)y[w][w]=v;return y}}),Hc="kron",fm=["typed","matrix","multiplyScalar"],cm=xe(Hc,fm,s=>{var{typed:e,matrix:t,multiplyScalar:r}=s;return e(Hc,{"Matrix, Matrix":function(a,u){return t(n(a.toArray(),u.toArray()))},"Matrix, Array":function(a,u){return t(n(a.toArray(),u))},"Array, Matrix":function(a,u){return t(n(a,u.toArray()))},"Array, Array":n});function n(i,a){if(Lt(i).length===1&&(i=[i]),Lt(a).length===1&&(a=[a]),Lt(i).length>2||Lt(a).length>2)throw new RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(i.length)+", y = "+JSON.stringify(a.length)+")");var u=[],l=[];return i.map(function(c){return a.map(function(h){return l=[],u.push(l),c.map(function(d){return h.map(function(p){return l.push(r(d,p))})})})})&&u}});function lm(){throw new Error('No "bignumber" implementation available')}function hm(){throw new Error('No "fraction" implementation available')}function dm(){throw new Error('No "matrix" implementation available')}var jc="reshape",pm=["typed","isInteger","matrix"],_m=xe(jc,pm,s=>{var{typed:e,isInteger:t}=s;return e(jc,{"Matrix, Array":function(n,i){return n.reshape(i,!0)},"Array, Array":function(n,i){return i.forEach(function(a){if(!t(a))throw new TypeError("Invalid size for dimension: "+a)}),Oa(n,i)}})}),Yc="size",vm=["typed","config","?matrix"],gm=xe(Yc,vm,s=>{var{typed:e,config:t,matrix:r}=s;return e(Yc,{Matrix:function(i){return i.create(i.size())},Array:Lt,string:function(i){return t.matrix==="Array"?[i.length]:r([i.length])},"number | Complex | BigNumber | Unit | boolean | null":function(i){return t.matrix==="Array"?[]:r?r([]):dm()}})}),Zc="transpose",mm=["typed","matrix"],xm=xe(Zc,mm,s=>{var{typed:e,matrix:t}=s;return e(Zc,{Array:a=>r(t(a)).valueOf(),Matrix:r,any:ut});function r(a){var u=a.size(),l;switch(u.length){case 1:l=a.clone();break;case 2:{var c=u[0],h=u[1];if(h===0)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+ct(u)+")");switch(a.storage()){case"dense":l=n(a,c,h);break;case"sparse":l=i(a,c,h);break}}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+ct(u)+")")}return l}function n(a,u,l){for(var c=a._data,h=[],d,p=0;p<l;p++){d=h[p]=[];for(var v=0;v<u;v++)d[v]=ut(c[v][p])}return a.createDenseMatrix({data:h,size:[l,u],datatype:a._datatype})}function i(a,u,l){for(var c=a._values,h=a._index,d=a._ptr,p=c?[]:void 0,v=[],x=[],_=[],y=0;y<u;y++)_[y]=0;var m,w,D;for(m=0,w=h.length;m<w;m++)_[h[m]]++;for(var C=0,E=0;E<u;E++)x.push(C),C+=_[E],_[E]=x[E];for(x.push(C),D=0;D<l;D++)for(var F=d[D],B=d[D+1],M=F;M<B;M++){var O=_[h[M]]++;v[O]=D,c&&(p[O]=ut(c[M]))}return a.createSparseMatrix({values:p,index:v,ptr:x,size:[l,u],datatype:a._datatype})}}),Vc="ctranspose",ym=["typed","transpose","conj"],Dm=xe(Vc,ym,s=>{var{typed:e,transpose:t,conj:r}=s;return e(Vc,{any:function(i){return r(t(i))}})}),Gc="mode",wm=["typed","isNaN","isNumeric"],Em=xe(Gc,wm,s=>{var{typed:e,isNaN:t,isNumeric:r}=s;return e(Gc,{"Array | Matrix":n,"...":function(a){return n(a)}});function n(i){i=Ia(i.valueOf());var a=i.length;if(a===0)throw new Error("Cannot calculate mode of an empty array");for(var u={},l=[],c=0,h=0;h<i.length;h++){var d=i[h];if(r(d)&&t(d))throw new Error("Cannot calculate mode of an array containing NaN values");d in u||(u[d]=0),u[d]++,u[d]===c?l.push(d):u[d]>c&&(c=u[d],l=[d])}return l}});function Ln(s,e,t){var r;return String(s).indexOf("Unexpected type")!==-1?(r=arguments.length>2?" (type: "+Sn(t)+", value: "+JSON.stringify(t)+")":" (type: "+s.data.actual+")",new TypeError("Cannot calculate "+e+", unexpected type of argument"+r)):String(s).indexOf("complex numbers")!==-1?(r=arguments.length>2?" (type: "+Sn(t)+", value: "+JSON.stringify(t)+")":"",new TypeError("Cannot calculate "+e+", no ordering relation is defined for complex numbers"+r)):s}var Kc="prod",bm=["typed","config","multiplyScalar","numeric"],Am=xe(Kc,bm,s=>{var{typed:e,config:t,multiplyScalar:r,numeric:n}=s;return e(Kc,{"Array | Matrix":i,"Array | Matrix, number | BigNumber":function(u,l){throw new Error("prod(A, dim) is not yet supported")},"...":function(u){return i(u)}});function i(a){var u;if(as(a,function(l){try{u=u===void 0?l:r(u,l)}catch(c){throw Ln(c,"prod",l)}}),typeof u=="string"&&(u=n(u,t.number)),u===void 0)throw new Error("Cannot calculate prod of an empty array");return u}}),Cm="numeric",Fm=["number","?bignumber","?fraction"],Bm=xe(Cm,Fm,s=>{var{number:e,bignumber:t,fraction:r}=s,n={string:!0,number:!0,BigNumber:!0,Fraction:!0},i={number:a=>e(a),BigNumber:t?a=>t(a):lm,Fraction:r?a=>r(a):hm};return function(u){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"number",c=arguments.length>2?arguments[2]:void 0;if(c!==void 0)throw new SyntaxError("numeric() takes one or two arguments");var h=Sn(u);if(!(h in n))throw new TypeError("Cannot convert "+u+' of type "'+h+'"; valid input types are '+Object.keys(n).join(", "));if(!(l in i))throw new TypeError("Cannot convert "+u+' to type "'+l+'"; valid output types are '+Object.keys(i).join(", "));return l===h?u:i[l](u)}}),Xc="divideScalar",Mm=["typed","numeric"],Nm=xe(Xc,Mm,s=>{var{typed:e,numeric:t}=s;return e(Xc,{"number, number":function(n,i){return n/i},"Complex, Complex":function(n,i){return n.div(i)},"BigNumber, BigNumber":function(n,i){return n.div(i)},"Fraction, Fraction":function(n,i){return n.div(i)},"Unit, number | Complex | Fraction | BigNumber | Unit":(r,n)=>r.divide(n),"number | Fraction | Complex | BigNumber, Unit":(r,n)=>n.divideInto(r)})}),Qc="pow",Sm=["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],Om=xe(Qc,Sm,s=>{var{typed:e,config:t,identity:r,multiply:n,matrix:i,inv:a,number:u,fraction:l,Complex:c}=s;return e(Qc,{"number, number":h,"Complex, Complex":function(x,_){return x.pow(_)},"BigNumber, BigNumber":function(x,_){return _.isInteger()||x>=0||t.predictable?x.pow(_):new c(x.toNumber(),0).pow(_.toNumber(),0)},"Fraction, Fraction":function(x,_){var y=x.pow(_);if(y!=null)return y;if(t.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return h(x.valueOf(),_.valueOf())},"Array, number":d,"Array, BigNumber":function(x,_){return d(x,_.toNumber())},"Matrix, number":p,"Matrix, BigNumber":function(x,_){return p(x,_.toNumber())},"Unit, number | BigNumber":function(x,_){return x.pow(_)}});function h(v,x){if(t.predictable&&!Et(x)&&v<0)try{var _=l(x),y=u(_);if((x===y||Math.abs((x-y)/x)<1e-14)&&_.d%2===1)return(_.n%2===0?1:-1)*Math.pow(-v,x)}catch{}return t.predictable&&(v<-1&&x===1/0||v>-1&&v<0&&x===-1/0)?NaN:Et(x)||v>=0||t.predictable?Ec(v,x):v*v<1&&x===1/0||v*v>1&&x===-1/0?0:new c(v,0).pow(x,0)}function d(v,x){if(!Et(x))throw new TypeError("For A^b, b must be an integer (value is "+x+")");var _=Lt(v);if(_.length!==2)throw new Error("For A^b, A must be 2 dimensional (A has "+_.length+" dimensions)");if(_[0]!==_[1])throw new Error("For A^b, A must be square (size is "+_[0]+"x"+_[1]+")");if(x<0)try{return d(a(v),-x)}catch(w){throw w.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 "+x+")"):w}for(var y=r(_[0]).valueOf(),m=v;x>=1;)(x&1)===1&&(y=n(m,y)),x>>=1,m=n(m,m);return y}function p(v,x){return i(d(v.valueOf(),x))}}),Jc="dotDivide",Tm=["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],Im=xe(Jc,Tm,s=>{var{typed:e,matrix:t,equalScalar:r,divideScalar:n,DenseMatrix:i,concat:a}=s,u=Cg({typed:e,equalScalar:r}),l=Fi({typed:e}),c=ao({typed:e,DenseMatrix:i}),h=Ha({typed:e,equalScalar:r}),d=Ci({typed:e,DenseMatrix:i}),p=ri({typed:e,matrix:t,concat:a});return e(Jc,p({elop:n,SS:c,DS:l,SD:u,Ss:h,sS:d}))}),uo="compare",$m=["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],Rm=xe(uo,$m,s=>{var{typed:e,config:t,equalScalar:r,matrix:n,BigNumber:i,Fraction:a,DenseMatrix:u,concat:l}=s,c=Fi({typed:e}),h=$c({typed:e,equalScalar:r}),d=Ci({typed:e,DenseMatrix:u}),p=ri({typed:e,matrix:n,concat:l}),v=so({typed:e});return e(uo,Lm({typed:e,config:t}),{"boolean, boolean":function(_,y){return _===y?0:_>y?1:-1},"BigNumber, BigNumber":function(_,y){return io(_,y,t.epsilon)?new i(0):new i(_.cmp(y))},"Fraction, Fraction":function(_,y){return new a(_.compare(y))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},v,p({SS:h,DS:c,Ss:d}))}),Lm=xe(uo,["typed","config"],s=>{var{typed:e,config:t}=s;return e(uo,{"number, number":function(n,i){return ti(n,i,t.epsilon)?0:n>i?1:-1}})}),fo="equal",Pm=["typed","matrix","equalScalar","DenseMatrix","concat"],km=xe(fo,Pm,s=>{var{typed:e,matrix:t,equalScalar:r,DenseMatrix:n,concat:i}=s,a=Fi({typed:e}),u=ao({typed:e,DenseMatrix:n}),l=Ci({typed:e,DenseMatrix:n}),c=ri({typed:e,matrix:t,concat:i});return e(fo,zm({typed:e,equalScalar:r}),c({elop:r,SS:u,DS:a,Ss:l}))}),zm=xe(fo,["typed","equalScalar"],s=>{var{typed:e,equalScalar:t}=s;return e(fo,{"any, any":function(n,i){return n===null?i===null:i===null?n===null:n===void 0?i===void 0:i===void 0?n===void 0:t(n,i)}})}),co="smaller",qm=["typed","config","matrix","DenseMatrix","concat"],Um=xe(co,qm,s=>{var{typed:e,config:t,matrix:r,DenseMatrix:n,concat:i}=s,a=Fi({typed:e}),u=ao({typed:e,DenseMatrix:n}),l=Ci({typed:e,DenseMatrix:n}),c=ri({typed:e,matrix:r,concat:i}),h=so({typed:e});return e(co,Wm({typed:e,config:t}),{"boolean, boolean":(d,p)=>d<p,"BigNumber, BigNumber":function(p,v){return p.lt(v)&&!io(p,v,t.epsilon)},"Fraction, Fraction":(d,p)=>d.compare(p)===-1,"Complex, Complex":function(p,v){throw new TypeError("No ordering relation is defined for complex numbers")}},h,c({SS:u,DS:a,Ss:l}))}),Wm=xe(co,["typed","config"],s=>{var{typed:e,config:t}=s;return e(co,{"number, number":function(n,i){return n<i&&!ti(n,i,t.epsilon)}})}),lo="larger",Hm=["typed","config","matrix","DenseMatrix","concat"],jm=xe(lo,Hm,s=>{var{typed:e,config:t,matrix:r,DenseMatrix:n,concat:i}=s,a=Fi({typed:e}),u=ao({typed:e,DenseMatrix:n}),l=Ci({typed:e,DenseMatrix:n}),c=ri({typed:e,matrix:r,concat:i}),h=so({typed:e});return e(lo,Ym({typed:e,config:t}),{"boolean, boolean":(d,p)=>d>p,"BigNumber, BigNumber":function(p,v){return p.gt(v)&&!io(p,v,t.epsilon)},"Fraction, Fraction":(d,p)=>d.compare(p)===1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},h,c({SS:u,DS:a,Ss:l}))}),Ym=xe(lo,["typed","config"],s=>{var{typed:e,config:t}=s;return e(lo,{"number, number":function(n,i){return n>i&&!ti(n,i,t.epsilon)}})}),el="deepEqual",Zm=["typed","equal"],Vm=xe(el,Zm,s=>{var{typed:e,equal:t}=s;return e(el,{"any, any":function(i,a){return r(i.valueOf(),a.valueOf())}});function r(n,i){if(Array.isArray(n))if(Array.isArray(i)){var a=n.length;if(a!==i.length)return!1;for(var u=0;u<a;u++)if(!r(n[u],i[u]))return!1;return!0}else return!1;else return Array.isArray(i)?!1:t(n,i)}}),tl="partitionSelect",Gm=["typed","isNumeric","isNaN","compare"],Km=xe(tl,Gm,s=>{var{typed:e,isNumeric:t,isNaN:r,compare:n}=s,i=n,a=(c,h)=>-n(c,h);return e(tl,{"Array | Matrix, number":function(h,d){return u(h,d,i)},"Array | Matrix, number, string":function(h,d,p){if(p==="asc")return u(h,d,i);if(p==="desc")return u(h,d,a);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":u});function u(c,h,d){if(!Et(h)||h<0)throw new Error("k must be a non-negative integer");if(mt(c)){var p=c.size();if(p.length>1)throw new Error("Only one dimensional matrices supported");return l(c.valueOf(),h,d)}if(Array.isArray(c))return l(c,h,d)}function l(c,h,d){if(h>=c.length)throw new Error("k out of bounds");for(var p=0;p<c.length;p++)if(t(c[p])&&r(c[p]))return c[p];for(var v=0,x=c.length-1;v<x;){for(var _=v,y=x,m=c[Math.floor(Math.random()*(x-v+1))+v];_<y;)if(d(c[_],m)>=0){var w=c[y];c[y]=c[_],c[_]=w,--y}else++_;d(c[_],m)>0&&--_,h<=_?x=_:v=_+1}return c[h]}}),rl="max",Xm=["typed","config","numeric","larger"],Qm=xe(rl,Xm,s=>{var{typed:e,config:t,numeric:r,larger:n}=s;return e(rl,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(l,c){return Wa(l,c.valueOf(),i)},"...":function(l){if(to(l))throw new TypeError("Scalar values expected in function max");return a(l)}});function i(u,l){try{return n(u,l)?u:l}catch(c){throw Ln(c,"max",l)}}function a(u){var l;if(as(u,function(c){try{isNaN(c)&&typeof c=="number"?l=NaN:(l===void 0||n(c,l))&&(l=c)}catch(h){throw Ln(h,"max",c)}}),l===void 0)throw new Error("Cannot calculate max of an empty array");return typeof l=="string"&&(l=r(l,t.number)),l}}),nl="min",Jm=["typed","config","numeric","smaller"],ex=xe(nl,Jm,s=>{var{typed:e,config:t,numeric:r,smaller:n}=s;return e(nl,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(l,c){return Wa(l,c.valueOf(),i)},"...":function(l){if(to(l))throw new TypeError("Scalar values expected in function min");return a(l)}});function i(u,l){try{return n(u,l)?u:l}catch(c){throw Ln(c,"min",l)}}function a(u){var l;if(as(u,function(c){try{isNaN(c)&&typeof c=="number"?l=NaN:(l===void 0||n(c,l))&&(l=c)}catch(h){throw Ln(h,"min",c)}}),l===void 0)throw new Error("Cannot calculate min of an empty array");return typeof l=="string"&&(l=r(l,t.number)),l}}),il="add",tx=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],rx=xe(il,tx,s=>{var{typed:e,matrix:t,addScalar:r,equalScalar:n,DenseMatrix:i,SparseMatrix:a,concat:u}=s,l=Rc({typed:e}),c=Wg({typed:e,equalScalar:n}),h=Lc({typed:e,DenseMatrix:i}),d=ri({typed:e,matrix:t,concat:u});return e(il,{"any, any":r,"any, any, ...any":e.referToSelf(p=>(v,x,_)=>{for(var y=p(v,x),m=0;m<_.length;m++)y=p(y,_[m]);return y})},d({elop:r,DS:l,SS:c,Ss:h}))}),sl="dot",nx=["typed","addScalar","multiplyScalar","conj","size"],ix=xe(sl,nx,s=>{var{typed:e,addScalar:t,multiplyScalar:r,conj:n,size:i}=s;return e(sl,{"Array | DenseMatrix, Array | DenseMatrix":u,"SparseMatrix, SparseMatrix":l});function a(h,d){var p=c(h),v=c(d),x,_;if(p.length===1)x=p[0];else if(p.length===2&&p[1]===1)x=p[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+p.join(", ")+")");if(v.length===1)_=v[0];else if(v.length===2&&v[1]===1)_=v[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+v.join(", ")+")");if(x!==_)throw new RangeError("Vectors must have equal length ("+x+" != "+_+")");if(x===0)throw new RangeError("Cannot calculate the dot product of empty vectors");return x}function u(h,d){var p=a(h,d),v=mt(h)?h._data:h,x=mt(h)?h._datatype||h.getDataType():void 0,_=mt(d)?d._data:d,y=mt(d)?d._datatype||d.getDataType():void 0,m=c(h).length===2,w=c(d).length===2,D=t,C=r;if(x&&y&&x===y&&typeof x=="string"&&x!=="mixed"){var E=x;D=e.find(t,[E,E]),C=e.find(r,[E,E])}if(!m&&!w){for(var F=C(n(v[0]),_[0]),B=1;B<p;B++)F=D(F,C(n(v[B]),_[B]));return F}if(!m&&w){for(var M=C(n(v[0]),_[0][0]),O=1;O<p;O++)M=D(M,C(n(v[O]),_[O][0]));return M}if(m&&!w){for(var A=C(n(v[0][0]),_[0]),N=1;N<p;N++)A=D(A,C(n(v[N][0]),_[N]));return A}if(m&&w){for(var T=C(n(v[0][0]),_[0][0]),R=1;R<p;R++)T=D(T,C(n(v[R][0]),_[R][0]));return T}}function l(h,d){a(h,d);for(var p=h._index,v=h._values,x=d._index,_=d._values,y=0,m=t,w=r,D=0,C=0;D<p.length&&C<x.length;){var E=p[D],F=x[C];if(E<F){D++;continue}if(E>F){C++;continue}E===F&&(y=m(y,w(v[D],_[C])),D++,C++)}return y}function c(h){return mt(h)?h.size():i(h)}}),sx="trace",ox=["typed","matrix","add"],ax=xe(sx,ox,s=>{var{typed:e,matrix:t,add:r}=s;return e("trace",{Array:function(u){return n(t(u))},SparseMatrix:i,DenseMatrix:n,any:ut});function n(a){var u=a._size,l=a._data;switch(u.length){case 1:if(u[0]===1)return ut(l[0]);throw new RangeError("Matrix must be square (size: "+ct(u)+")");case 2:{var c=u[0],h=u[1];if(c===h){for(var d=0,p=0;p<c;p++)d=r(d,l[p][p]);return d}else throw new RangeError("Matrix must be square (size: "+ct(u)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+ct(u)+")")}}function i(a){var u=a._values,l=a._index,c=a._ptr,h=a._size,d=h[0],p=h[1];if(d===p){var v=0;if(u.length>0)for(var x=0;x<p;x++)for(var _=c[x],y=c[x+1],m=_;m<y;m++){var w=l[m];if(w===x){v=r(v,u[m]);break}if(w>x)break}return v}throw new RangeError("Matrix must be square (size: "+ct(h)+")")}}),ol="det",ux=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],fx=xe(ol,ux,s=>{var{typed:e,matrix:t,subtractScalar:r,multiply:n,divideScalar:i,isZero:a,unaryMinus:u}=s;return e(ol,{any:function(h){return ut(h)},"Array | Matrix":function(h){var d;switch(mt(h)?d=h.size():Array.isArray(h)?(h=t(h),d=h.size()):d=[],d.length){case 0:return ut(h);case 1:if(d[0]===1)return ut(h.valueOf()[0]);if(d[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+ct(d)+")");case 2:{var p=d[0],v=d[1];if(p===v)return l(h.clone().valueOf(),p);if(v===0)return 1;throw new RangeError("Matrix must be square (size: "+ct(d)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+ct(d)+")")}}});function l(c,h,d){if(h===1)return ut(c[0][0]);if(h===2)return r(n(c[0][0],c[1][1]),n(c[1][0],c[0][1]));for(var p=!1,v=new Array(h).fill(0).map((B,M)=>M),x=0;x<h;x++){var _=v[x];if(a(c[_][x])){var y=void 0;for(y=x+1;y<h;y++)if(!a(c[v[y]][x])){_=v[y],v[y]=v[x],v[x]=_,p=!p;break}if(y===h)return c[_][x]}for(var m=c[_][x],w=x===0?1:c[v[x-1]][x-1],D=x+1;D<h;D++)for(var C=v[D],E=x+1;E<h;E++)c[C][E]=i(r(n(c[C][E],m),n(c[C][x],c[_][E])),w)}var F=c[v[h-1]][h-1];return p?u(F):F}}),al="inv",cx=["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],lx=xe(al,cx,s=>{var{typed:e,matrix:t,divideScalar:r,addScalar:n,multiply:i,unaryMinus:a,det:u,identity:l,abs:c}=s;return e(al,{"Array | Matrix":function(p){var v=mt(p)?p.size():Lt(p);switch(v.length){case 1:if(v[0]===1)return mt(p)?t([r(1,p.valueOf()[0])]):[r(1,p[0])];throw new RangeError("Matrix must be square (size: "+ct(v)+")");case 2:{var x=v[0],_=v[1];if(x===_)return mt(p)?t(h(p.valueOf(),x,_),p.storage()):h(p,x,_);throw new RangeError("Matrix must be square (size: "+ct(v)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+ct(v)+")")}},any:function(p){return r(1,p)}});function h(d,p,v){var x,_,y,m,w;if(p===1){if(m=d[0][0],m===0)throw Error("Cannot calculate inverse, determinant is zero");return[[r(1,m)]]}else if(p===2){var D=u(d);if(D===0)throw Error("Cannot calculate inverse, determinant is zero");return[[r(d[1][1],D),r(a(d[0][1]),D)],[r(a(d[1][0]),D),r(d[0][0],D)]]}else{var C=d.concat();for(x=0;x<p;x++)C[x]=C[x].concat();for(var E=l(p).valueOf(),F=0;F<v;F++){var B=c(C[F][F]),M=F;for(x=F+1;x<p;)c(C[x][F])>B&&(B=c(C[x][F]),M=x),x++;if(B===0)throw Error("Cannot calculate inverse, determinant is zero");x=M,x!==F&&(w=C[F],C[F]=C[x],C[x]=w,w=E[F],E[F]=E[x],E[x]=w);var O=C[F],A=E[F];for(x=0;x<p;x++){var N=C[x],T=E[x];if(x!==F){if(N[F]!==0){for(y=r(a(N[F]),O[F]),_=F;_<v;_++)N[_]=n(N[_],i(y,O[_]));for(_=0;_<v;_++)T[_]=n(T[_],i(y,A[_]))}}else{for(y=O[F],_=F;_<v;_++)N[_]=r(N[_],y);for(_=0;_<v;_++)T[_]=r(T[_],y)}}}return E}}}),ul="pinv",hx=["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],dx=xe(ul,hx,s=>{var{typed:e,matrix:t,inv:r,deepEqual:n,equal:i,dotDivide:a,dot:u,ctranspose:l,divideScalar:c,multiply:h,add:d,Complex:p}=s;return e(ul,{"Array | Matrix":function(D){var C=mt(D)?D.size():Lt(D);switch(C.length){case 1:return m(D)?l(D):C[0]===1?r(D):a(l(D),u(D,D));case 2:{if(m(D))return l(D);var E=C[0],F=C[1];if(E===F)try{return r(D)}catch(B){if(!(B instanceof Error&&B.message.match(/Cannot calculate inverse, determinant is zero/)))throw B}return mt(D)?t(v(D.valueOf(),E,F),D.storage()):v(D,E,F)}default:throw new RangeError("Matrix must be two dimensional (size: "+ct(C)+")")}},any:function(D){return i(D,0)?ut(D):c(1,D)}});function v(w,D,C){var{C:E,F}=_(w,D,C),B=h(r(h(l(E),E)),l(E)),M=h(l(F),r(h(F,l(F))));return h(M,B)}function x(w,D,C){for(var E=ut(w),F=0,B=0;B<D;B++){if(C<=F)return E;for(var M=B;y(E[M][F]);)if(M++,D===M&&(M=B,F++,C===F))return E;[E[M],E[B]]=[E[B],E[M]];for(var O=E[B][F],A=0;A<C;A++)E[B][A]=a(E[B][A],O);for(var N=0;N<D;N++)if(N!==B){O=E[N][F];for(var T=0;T<C;T++)E[N][T]=d(E[N][T],h(-1,h(O,E[B][T])))}F++}return E}function _(w,D,C){var E=x(w,D,C),F=w.map((M,O)=>M.filter((A,N)=>N<D&&!y(u(E[N],E[N])))),B=E.filter((M,O)=>!y(u(E[O],E[O])));return{C:F,F:B}}function y(w){return i(d(w,p(1,1)),d(0,p(1,1)))}function m(w){return n(d(w,p(1,1)),d(h(w,0),p(1,1)))}}),px="divide",_x=["typed","matrix","multiply","equalScalar","divideScalar","inv"],vx=xe(px,_x,s=>{var{typed:e,matrix:t,multiply:r,equalScalar:n,divideScalar:i,inv:a}=s,u=Ha({typed:e,equalScalar:n}),l=ja({typed:e});return e("divide",Bf({"Array | Matrix, Array | Matrix":function(h,d){return r(h,a(d))},"DenseMatrix, any":function(h,d){return l(h,d,i,!1)},"SparseMatrix, any":function(h,d){return u(h,d,i,!1)},"Array, any":function(h,d){return l(t(h),d,i,!1).valueOf()},"any, Array | Matrix":function(h,d){return r(h,a(d))}},i.signatures))}),fl="sum",gx=["typed","config","add","numeric"],mx=xe(fl,gx,s=>{var{typed:e,config:t,add:r,numeric:n}=s;return e(fl,{"Array | Matrix":i,"Array | Matrix, number | BigNumber":a,"...":function(l){if(to(l))throw new TypeError("Scalar values expected in function sum");return i(l)}});function i(u){var l;return as(u,function(c){try{l=l===void 0?c:r(l,c)}catch(h){throw Ln(h,"sum",c)}}),l===void 0&&(l=n(0,t.number)),typeof l=="string"&&(l=n(l,t.number)),l}function a(u,l){try{var c=Wa(u,l,r);return c}catch(h){throw Ln(h,"sum")}}}),cl="median",xx=["typed","add","divide","compare","partitionSelect"],yx=xe(cl,xx,s=>{var{typed:e,add:t,divide:r,compare:n,partitionSelect:i}=s;function a(c){try{c=Ia(c.valueOf());var h=c.length;if(h===0)throw new Error("Cannot calculate median of an empty array");if(h%2===0){for(var d=h/2-1,p=i(c,d+1),v=c[d],x=0;x<d;++x)n(c[x],v)>0&&(v=c[x]);return l(v,p)}else{var _=i(c,(h-1)/2);return u(_)}}catch(y){throw Ln(y,"median")}}var u=e({"number | BigNumber | Complex | Unit":function(h){return h}}),l=e({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(h,d){return r(t(h,d),2)}});return e(cl,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(h,d){throw new Error("median(A, dim) is not yet supported")},"...":function(h){if(to(h))throw new TypeError("Scalar values expected in function median");return a(h)}})}),Dx={},wx=Object.freeze({__proto__:null,default:Dx}),Ex=Mt(wx),ho=Dv({config:br}),Ya=Av({}),Za=Mv({}),Va=Ov({}),cn=$v({Matrix:Va}),Ie=b_({BigNumber:ho,Complex:Ya,DenseMatrix:cn,Fraction:Za}),bx=dg({typed:Ie}),po=_g({typed:Ie}),Ax=ig({BigNumber:ho,typed:Ie}),ll=rm({typed:Ie}),Pn=Zv({config:br,typed:Ie}),_o=Pv({typed:Ie}),Cx=Uv({typed:Ie}),vo=Vg({typed:Ie}),hl=tg({typed:Ie}),Ga=Kv({Matrix:Va,equalScalar:Pn,typed:Ie}),dl=gg({typed:Ie}),pl=Hv({typed:Ie}),Ka=lg({typed:Ie}),_l=ag({Fraction:Za,typed:Ie}),vl=zv({typed:Ie}),Pt=fg({DenseMatrix:cn,Matrix:Va,SparseMatrix:Ga,typed:Ie}),gl=Em({isNaN:pl,isNumeric:vl,typed:Ie}),us=Bm({bignumber:Ax,fraction:_l,number:hl}),Fx=Am({config:br,multiplyScalar:vo,numeric:us,typed:Ie}),Bx=_m({isInteger:_o,matrix:Pt,typed:Ie}),ml=gm({matrix:Pt,config:br,typed:Ie}),xl=xm({matrix:Pt,typed:Ie}),ni=im({isInteger:_o,matrix:Pt,typed:Ie}),Mx=om({prod:Fx,size:ml,typed:Ie}),Nx=Dm({conj:ll,transpose:xl,typed:Ie}),fs=Nm({numeric:us,typed:Ie}),Sx=Im({DenseMatrix:cn,concat:ni,divideScalar:fs,equalScalar:Pn,matrix:Pt,typed:Ie}),yl=km({DenseMatrix:cn,concat:ni,equalScalar:Pn,matrix:Pt,typed:Ie}),Dl=um({BigNumber:ho,DenseMatrix:cn,SparseMatrix:Ga,config:br,matrix:Pt,typed:Ie}),Ox=cm({matrix:Pt,multiplyScalar:vo,typed:Ie}),Tx=Um({DenseMatrix:cn,concat:ni,config:br,matrix:Pt,typed:Ie}),Ix=Qg({DenseMatrix:cn,concat:ni,equalScalar:Pn,matrix:Pt,subtractScalar:dl,typed:Ie,unaryMinus:Ka}),cs=rx({DenseMatrix:cn,SparseMatrix:Ga,addScalar:po,concat:ni,equalScalar:Pn,matrix:Pt,typed:Ie}),wl=Rm({BigNumber:ho,DenseMatrix:cn,Fraction:Za,concat:ni,config:br,equalScalar:Pn,matrix:Pt,typed:Ie}),$x=Vm({equal:yl,typed:Ie}),El=ix({addScalar:po,conj:ll,multiplyScalar:vo,size:ml,typed:Ie}),Rx=jm({DenseMatrix:cn,concat:ni,config:br,matrix:Pt,typed:Ie}),Xa=ex({config:br,numeric:us,smaller:Tx,typed:Ie}),Bi=Kg({addScalar:po,dot:El,equalScalar:Pn,matrix:Pt,multiplyScalar:vo,typed:Ie}),Lx=Km({compare:wl,isNaN:pl,isNumeric:vl,typed:Ie}),Px=mx({add:cs,config:br,numeric:us,typed:Ie}),kx=ax({add:cs,matrix:Pt,typed:Ie}),bl=fx({divideScalar:fs,isZero:Cx,matrix:Pt,multiply:Bi,subtractScalar:dl,typed:Ie,unaryMinus:Ka}),zx=Qm({config:br,larger:Rx,numeric:us,typed:Ie}),go=lx({abs:bx,addScalar:po,det:bl,divideScalar:fs,identity:Dl,matrix:Pt,multiply:Bi,typed:Ie,unaryMinus:Ka}),qx=dx({Complex:Ya,add:cs,ctranspose:Nx,deepEqual:$x,divideScalar:fs,dot:El,dotDivide:Sx,equal:yl,inv:go,matrix:Pt,multiply:Bi,typed:Ie}),Ux=Om({Complex:Ya,config:br,fraction:_l,identity:Dl,inv:go,matrix:Pt,multiply:Bi,number:hl,typed:Ie}),Wx=vx({divideScalar:fs,equalScalar:Pn,inv:go,matrix:Pt,multiply:Bi,typed:Ie}),Al=yx({add:cs,compare:wl,divide:Wx,partitionSelect:Lx,typed:Ie});class Hx{constructor(e,t,r){U(this,"_cacheData");U(this,"_variables");U(this,"_math");U(this,"_timeframe");this._cacheData={},this._variables=e,this._math=t,this._timeframe=r}alma({series:e,length:t,offset:r,sigma:n,floor:i},a){if(t===void 0||r===void 0||n===void 0)return;const u=this._cacheDataList(e,t,`alma_${a}`);if(u===void 0)return;let l=r*(t-1);i&&(l=Math.floor(l));const c=t/n;let h=0,d=0;for(let p=0;p<=t-1;p++){const v=Math.exp(-1*Math.pow(p-l,2)/(2*Math.pow(c,2)));h+=v,d+=u[u.length-1-(t-p-1)]*v}return d/h}sma({source:e,length:t},r){if(e===void 0||isNaN(e)||t===void 0)return;let n=0;const i=this._cacheDataList(e,t,`sma_${r}`);if(i===void 0)return;const a=i.slice(-t);return n=Px(...a)/t,n}rma({source:e,length:t},r){if(e===void 0||t===void 0||isNaN(e))return;const n=this._cacheData[`sma_${r}`]||[];n[this._variables.bar_index]=e,this._cacheData[`sma_${r}`]=n;const{sum:i}=this._cacheData[`rma_${r}`]||{},a=1/t,u=i===void 0?this.sma({source:e,length:t},r):a*e+(1-a)*(i||0);return this._cacheDataHandle(`rma_${r}`,{sum:u}),u}atr({length:e},t){const{high:r,close:n}=this._cacheData[`atr_${t}`]||{},{high:i,close:a,low:u}=this._variables,l=r===void 0?i-u:Math.max(Math.max(i-u,Math.abs(i-n)),Math.abs(u-n));return this._cacheDataHandle(`atr_${t}`,{high:i,close:a}),this.rma({source:l,length:e},t)}barssince({condition:e},t){let{count:r}=this._cacheData[`barssince_${t}`]||{};if(e)r=0;else{if(r===void 0)return;r+=1}return this._cacheDataHandle(`barssince_${t}`,{count:r}),r}stdev({source:e,length:t,biased:r=!0},n){if(e===void 0||isNaN(e)||t===void 0)return;const i=this._cacheDataList(e,t,`stdev_${n}`),a=this.sma({source:e,length:t},n);if(i===void 0)return;let u=0;for(let l=0;l<t;l++){const c=this._sum(i[i.length-1-l],-(a||0));u+=c*c}return r||t<=1?Math.sqrt(u/t):Math.sqrt(u/(t-1))}_sum(e,t){let n=e+t;return Math.abs(n)<=1e-10&&(n=0),n}bb({series:e,length:t,mult:r},n){if(e===void 0||isNaN(e)||t===void 0||r===void 0)return[];const i=this.sma({source:e,length:t},n),a=this.stdev({source:e,length:t},n);if(i===void 0||a===void 0)return[];const u=r*a;return[i,i+u,i-u]}bbw({series:e,length:t,mult:r},n){if(e===void 0||isNaN(e)||t===void 0||r===void 0)return;const i=this.sma({source:e,length:t},n),a=this.stdev({source:e,length:t},n);if(i===void 0||a===void 0)return;const u=r*a;return(i+u-(i-u))/i}cci({source:e,length:t},r){if(e===void 0||isNaN(e)||t===void 0)return;const n=this.sma({source:e,length:t},r),i=this.dev({source:e,length:t},r);if(!(n===void 0||i===void 0))return(e-n)/(.015*i)}change({source:e,length:t=1},r){const n=this._cacheData[`change_${r}`]||[];n[this._variables.bar_index]=e,this._cacheData[`change_${r}`]=n;const i=n[n.length-1-t];if(!(e===void 0||isNaN(e)))return i===void 0?i:typeof e=="boolean"?i!==e:e-i}cmo({series:e,length:t},r){if(e===void 0||isNaN(e)||t===void 0)return;const n=this.change({source:e},r);if(n===void 0)return;const i=this._math.sum({source:n>=0?n:0,length:t},`sm1_${r}`),a=this._math.sum({source:n>=0?0:-n,length:t},`sm2_${r}`);if(!(i===void 0||a===void 0))return 100*(i-a)/(i+a)}cog({source:e,length:t},r){if(e===void 0||isNaN(e)||t===void 0)return;const n=this._cacheDataList(e,t,`cog_${r}`),i=this._math.sum({source:e,length:t},r);if(i===void 0||n===void 0)return;let a=0;for(let u=0;u<t;u++){const l=n[n.length-1-u];a+=l*(u+1)}return-a/i}correlation({source1:e,source2:t,length:r},n){if(e===void 0||isNaN(e)||t===void 0||isNaN(t)||r===void 0)return;const i=this._cacheDataList([e,t],r,`correlation_${n}`),a=this.sma({source:e,length:r},`sma1_${n}`),u=this.sma({source:t,length:r},`sma2_${n}`);if(a===void 0||u===void 0||i===void 0)return;let l=0,c=0,h=0;for(let p=0;p<r;p++){const[v,x]=i[i.length-1-p],_=v-a,y=x-u;l+=_*y,c+=_*_,h+=y*y}return isNaN(c)||isNaN(l)||isNaN(h)?void 0:l/Math.sqrt(c*h)}cross({source1:e,source2:t},r){if(e===void 0||t===void 0)return!1;const{source1:n,source2:i}=this._cacheData[`cross_${r}`]||{};return this._cacheDataHandle(`cross_${r}`,{source1:e,source2:t}),n===void 0||i===void 0?!1:n>=i&&e<t||n<=i&&e>t}crossover({source1:e,source2:t},r){if(e===void 0||t===void 0)return!1;const{source1:n,source2:i}=this._cacheData[`crossover_${r}`]||{};return this._cacheDataHandle(`crossover_${r}`,{source1:e,source2:t}),n===void 0||i===void 0?!1:n<=i&&e>t}crossunder({source1:e,source2:t},r){if(e===void 0||t===void 0)return!1;const{source1:n,source2:i}=this._cacheData[`crossunder_${r}`]||{};return this._cacheDataHandle(`crossunder_${r}`,{source1:e,source2:t}),n===void 0||i===void 0?!1:n>=i&&e<t}cum({source:e=0},t){e=isNaN(e)?0:e;let{sum:r}=this._cacheData[`cum_${t}`]||{};return r=r||0,r+=e,this._cacheDataHandle(`cum_${t}`,{sum:r}),r}dev({source:e,length:t},r){if(e===void 0||isNaN(e)||t===void 0)return;const n=this.sma({source:e,length:t},r);let i=0;const a=this._cacheDataList(e,t,`dev_${r}`);if(!(!a||n===void 0)){for(let u=0;u<t;u++){const l=a[a.length-1-u];i+=Math.abs(l-n)}return i/t}}dmi({diLength:e,adxSmoothing:t},r){if(e===void 0||t===void 0)return[void 0,void 0,void 0];const n=`dmi_${r}`,{low:i,high:a,close:u,PDMS:l,NDMS:c,TRS:h,ADX:d,count:p=0}=this._cacheData[n]||{},{low:v,high:x,close:_}=this._variables;if(i===void 0||a===void 0||u===void 0)return this._cacheData[n]={low:v,high:x,close:_,PDMS:l,NDMS:c,TRS:x-v,count:1},[void 0,void 0,void 0];let y=x-a,m=i-v;y=y>m&&y>0?y:0,m=m>y&&m>0?m:0,y===m&&(y=m=0);const w=Math.max(x-v,Math.abs(x-u),Math.abs(v-u));if(p<e)return this._cacheDataHandle(n,{low:v,high:x,close:_,PDMS:(l||0)+y,NDMS:(c||0)+m,TRS:(h||0)+w,count:p+1}),[void 0,void 0,void 0];{const D=l-l/e+y,C=c-c/e+m,E=h-h/e+w,F=D/E*100,B=C/E*100,M=Math.abs((F-B)/(F+B))*100;let O=M,A=[F,B,void 0];if(p+1-e<t){const N=p+1-e;O=((d||0)*(N-1)+M)/N}else O=(d*(t-1)+M)/t,A=[F,B,O];return this._cacheDataHandle(n,{low:v,high:x,close:_,PDMS:D,NDMS:C,TRS:E,ADX:O,count:p+1}),A}}ema({source:e,length:t},r){if(e===void 0||t===void 0||isNaN(e))return;let{sum:n,count:i=1}=this._cacheData[`ema_${r}`]||{};const a=this.sma({source:e,length:t},r);if(i>t){const u=2/(t+1);n=n===void 0?e:u*e+(1-u)*(n||0)}else n=a;return i+=1,this._cacheDataHandle(`ema_${r}`,{sum:n,count:i}),n}falling({source:e,length:t},r){if(e===void 0||isNaN(e)||t===void 0)return!1;const{source:n,fallings:i=[]}=this._cacheData[`falling_${r}`]||{};i.push(n>e);const a=i.slice(-t);return this._cacheDataHandle(`falling_${r}`,{source:e,fallings:a}),a.length<t?!1:a.every(u=>u)}rising({source:e,length:t},r){if(e===void 0||isNaN(e)||t===void 0)return!1;const{source:n,risings:i=[]}=this._cacheData[`rising_${r}`]||{};i.push(n<e);const a=i.slice(-t);return this._cacheDataHandle(`rising_${r}`,{source:e,risings:a}),a.length<t?!1:a.every(u=>u)}highest({source:e,length:t},r){if(t===void 0||t<=0)return;const n=this._cacheData[`highest_${r}`]||[],{high:i,bar_index:a}=this._variables;typeof e!="number"?n[a]=i:n[a]=e,this._cacheData[`highest_${r}`]=n;const u=n.filter(()=>!0);if(!(u.length<t))return Math.max(...u.slice(-t))}highestbars({source:e,length:t},r){if(t===void 0||t<=0)return;const n=this._cacheData[`highestbars_${r}`]||[],{high:i,bar_index:a}=this._variables;typeof e!="number"?n[a]=i:n[a]=e,this._cacheData[`highestbars_${r}`]=n;const u=n.filter(()=>!0);return u.length<t?void 0:u.slice(-t).reduce((c,h,d,p)=>h>=p[c]?d:c,0)-t+1}wma({source:e,length:t},r){if(t===void 0||e===void 0||isNaN(e)||t<=0)return;const n=this._cacheDataList(e,t,`wma_${r}`);if(!n)return;let i=0,a=0;for(let u=0;u<t;u++){const l=(t-u)*t;i+=l,a+=n[n.length-1-u]*l}return a/i}hma({source:e,length:t},r){if(t===void 0||e===void 0||isNaN(e)||t<=0)return;const n=this.wma({source:e,length:t},r),i=this.wma({source:e,length:Math.round(t/2)},r);return n===void 0||i===void 0?void 0:this.wma({source:2*i-n,length:Math.floor(Math.sqrt(t))},`hma_${r}`)}kc({series:e,length:t,mult:r,useTrueRange:n=!0},i){if(e===void 0||isNaN(e)||t===void 0||r===void 0)return[void 0,void 0,void 0];const a=this.ema({source:e,length:t},i),{ta:u,high:l,low:c}=this._variables,h=n?u.tr:l-c,d=this.ema({source:h,length:t},`range_${i}`);return[a,a+d*r,a-d*r]}kcw({series:e,length:t,mult:r,useTrueRange:n=!0},i){if(e===void 0||isNaN(e)||t===void 0||r===void 0)return;const a=this.ema({source:e,length:t},i),{ta:u,high:l,low:c}=this._variables,h=n?u.tr:l-c,d=this.ema({source:h,length:t},`range_${i}`);return(a+d*r-(a-d*r))/a}linreg({source:e,length:t,offset:r},n){if(t===void 0||r===void 0)return;const i=this._cacheDataList(e,t,`dev_${n}`);if(!i)return;const a=i.slice(-t).filter(v=>v!==void 0);let u=0,l=0,c=0,h=0;for(const[v,x]of a.entries())u+=v,l+=x,c+=v*x,h+=v*v;const d=(t*c-u*l)/(t*h-u*u);return(l-d*u)/t+d*(t-1-r)}lowest({source:e,length:t},r){if(t===void 0||t<=0)return;const n=this._cacheData[`lowest_${r}`]||[],{low:i,bar_index:a}=this._variables;typeof e!="number"?n[a]=i:n[a]=e,this._cacheData[`lowest_${r}`]=n;const u=n.filter(()=>!0);if(!(u.length<t))return Math.min(...u.slice(-t))}lowestbars({source:e,length:t},r){if(t===void 0||t<=0)return;const n=this._cacheData[`lowestbars_${r}`]||[],{low:i,bar_index:a}=this._variables;typeof e!="number"?n[a]=i:n[a]=e,this._cacheData[`lowestbars_${r}`]=n;const u=n.filter(()=>!0);return u.length<t?void 0:u.slice(-t).reduce((c,h,d,p)=>h<=p[c]?d:c,0)-t+1}macd({source:e,fastlen:t,slowlen:r,siglen:n},i){if(e===void 0||isNaN(e)||t===void 0||r===void 0||n===void 0)return[void 0,void 0,void 0];const a=this.ema({source:e,length:t},`ema1_${i}`),u=this.ema({source:e,length:r},`ema2_${i}`);if(a===void 0||u===void 0)return[void 0,void 0,void 0];const l=a-u,c=this.ema({source:l,length:n},`macd_${i}`);if(c===void 0)return[l,c,void 0];const h=l-c;return[l,c,h]}max({source:e},t){if(e===void 0||isNaN(e))return;let r=this._cacheData[`max_${t}`]||0;return e>r&&(r=e),this._cacheData[`max_${t}`]=r,r}min({source:e},t){if(e===void 0||isNaN(e))return;let r=this._cacheData[`min_${t}`]||1/0;return e<r&&(r=e),this._cacheData[`min_${t}`]=r,r}median({source:e,length:t},r){if(t===void 0||e===void 0||isNaN(e)||t<=0)return;const n=this._cacheDataList(e,t,`dev_${r}`);if(n)return Al(n.slice(-t))}mfi({series:e,length:t},r){if(t===void 0||e===void 0||isNaN(e)||t<=0)return;const{volume:n}=this._variables,i=this.change({source:e},r),a=this._math.sum({source:n*(i>=0?0:e),length:t},`lower_${r}`),u=this._math.sum({source:n*(i<=0?0:e),length:t},`upper_${r}`);if(!(u===void 0||a===void 0))return 100-100/(1+u/a)}mode({source:e,length:t},r){if(t===void 0||e===void 0||isNaN(e)||t<=0)return;const n=this._cacheDataList(e,t,`mode_${r}`);if(n)return Xa(gl(n.slice(-t)))}mom({source:e,length:t},r){if(t===void 0||t<0)return;const n=`mom_${r}`,i=this._cacheData[n]||[];if(i[this._variables.bar_index]=e,this._cacheData[n]=i,i.length<=t||e===void 0||isNaN(e))return;let a=i.length-t-1,u;for(;u===void 0&&a>=0;)u=i[a],a--;return u===void 0?u:e-u}percentile_linear_interpolation({source:e,length:t,percentage:r},n){if(t===void 0||r===void 0||t<0||r<0||r>100)return;const i=this._cacheDataList(e,t+1,`percentile_linear_interpolation_${n}`);if(!i)return;const a=this._sort(i.slice(-(t+1))),u=a.length;r/=100;const l=1/(u*2);if(r<=l)return a[0];if(r>=1-1/(u*2))return a[u-1];for(const[c,h]of a.entries()){const d=a[c-1];if(r<(c+.5)/u)return d===void 0||h===void 0?void 0:d+(h-d)*(r-(c-.5)/u)/(1/u)}}percentile_nearest_rank({source:e,length:t,percentage:r},n){if(t===void 0||r===void 0||e===void 0||isNaN(e)||t<0||r<0||r>100)return;const i=this._cacheDataList(e,t,`percentile_nearest_rank_${n}`);if(!i)return;const a=this._sort(i.slice(-t)),u=r/100*a.length,l=Math.ceil(u)-1;return a[l>=a.length?a.length-1:l]}percentrank({source:e,length:t},r){if(t===void 0||t<0)return;const n=this._cacheDataList(e,t+1,`percentile_nearest_rank_${r}`);if(!n)return;const i=n.slice(-(t+1)),a=e;if(a===void 0)return;let u=0;for(let l=0;l<i.length;l++)i[l]!==void 0&&(i[l]<a||i[l]===a&&l<t)&&u++;return u/(i.length-1)*100}pivot_point_levels({type:e,anchor:t,developing:r},n){const i=new it;let{close:a,open:u,low:l,high:c}=this._variables;const h=`pivot_point_levels_${n}`,{close:d,low:p,high:v,open:x,result:_}=this._cacheData[h]||{};if(!t&&(v&&p&&(c=Math.max(v,c),l=Math.min(p,l)),this._cacheDataHandle(h,{close:a,open:u,low:l,high:c,result:_}),!r))return i._value=_||[],i;const y={close:a,open:u,low:l,high:c};t===!0&&!r&&(a=d,u=x,l=p,c=v);const m=this._getPivotPointLevels(c,l,a,u,r,e);return this._cacheDataHandle(h,{...y,result:m}),i._value=m,i}_getPivotPointLevels(e,t,r,n,i,a){if(r===void 0||n===void 0||t===void 0||e===void 0)return[];switch(a){case ei.traditional:return this._traditional(e,t,r);case ei.fibonacci:return this._fibonacci(e,t,r);case ei.woodie:return i?[]:this._woodie(e,t);case ei.classic:return this._classic(e,t,r);case ei.dm:return this._DM(e,t,r,n);case ei.camarilla:return this._camarilla(e,t,r);default:return[]}}_traditional(e,t,r){const n=(e+t+r)/3,i=n*2-t,a=n+(e-t),u=n*2+(e-2*t),l=n*3+(e-3*t),c=n*4+(e-4*t),h=n*2-e,d=n-(e-t),p=n*2-(2*e-t),v=n*3-(3*e-t),x=n*4-(4*e-t);return[n,i,h,a,d,u,p,l,v,c,x]}_fibonacci(e,t,r){const n=(e+t+r)/3,i=n+.382*(e-t),a=n-.382*(e-t),u=n+.618*(e-t),l=n-.618*(e-t),c=n+(e-t),h=n-(e-t);return[n,i,a,u,l,c,h]}_woodie(e,t){const{open:r}=this._variables,n=(e+t+2*r)/4,i=2*n-t,a=2*n-e,u=n+(e-t),l=n-(e-t),c=e+2*(n-t),h=t-2*(e-n),d=c+(e-t),p=h-(e-t);return[n,i,a,u,l,c,h,d,p]}_classic(e,t,r){const n=(e+t+r)/3,i=2*n-t,a=2*n-e,u=n+(e-t),l=n-(e-t),c=n+2*(e-t),h=n-2*(e-t),d=n+3*(e-t),p=n-3*(e-t);return[n,i,a,u,l,c,h,d,p]}_DM(e,t,r,n){let i;n===r?i=e+t+2*r:r>n?i=2*e+t+r:i=2*t+e+r;const a=i/4,u=i/2-t,l=i/2-e;return[a,u,l]}_camarilla(e,t,r){const n=(e+t+r)/3,i=r+1.1*(e-t)/12,a=r-1.1*(e-t)/12,u=r+1.1*(e-t)/6,l=r-1.1*(e-t)/6,c=r+1.1*(e-t)/4,h=r-1.1*(e-t)/4,d=r+1.1*(e-t)/2,p=r-1.1*(e-t)/2,v=e/t*r,x=r-(v-r);return[n,i,a,u,l,c,h,d,p,v,x]}pivothigh({source:e=this._variables.high,leftbars:t,rightbars:r},n){if(t===void 0||r===void 0||t<0||r<0)return;const i=this._cacheDataList(e,t+r+1,`pivothigh_${n}`);if(!i)return;const a=i.slice(-(t+r+1)),u=a[t];return Math.max(...a)===u?u:void 0}pivotlow({source:e=this._variables.low,leftbars:t,rightbars:r},n){if(t===void 0||r===void 0||t<0||r<0)return;const i=this._cacheDataList(e,t+r+1,`pivotlow_${n}`);if(!i)return;const a=i.slice(-(t+r+1)),u=a[t];return Math.min(...a)===u?u:void 0}range({source:e,length:t},r){if(t===void 0||e===void 0||isNaN(e)||t<0)return;const n=this._cacheDataList(e,t,`range_${r}`);if(!n)return;const i=n.filter(l=>l!==void 0).slice(-t),a=Math.max(...i),u=Math.min(...i);return a-u}roc({source:e,length:t},r){if(t===void 0||t<0)return;const n=this._cacheDataList(e,t+1,`roc_${r}`),i=this.change({source:e,length:t},r);if(n)return 100*i/n[n.length-1-t]}rsi({source:e,length:t},r){if(t===void 0||e===void 0||isNaN(e)||t<0)return;const{source:n}=this._cacheData[`rsi_${r}`]||{},i=Math.max(e-n,0),a=Math.max(n-e,0),u=this.rma({source:i,length:t},`rma1_${r}`),l=this.rma({source:a,length:t},`rma2_${r}`);if(this._cacheDataHandle(`rsi_${r}`,{source:e}),!(u===void 0||l===void 0))return 100-100/(1+u/l)}sar({start:e,inc:t,max:r},n){if(e===void 0||t===void 0||r===void 0)return;const{close:i,low:a,high:u,preLow:l,preHigh:c,data:h={}}=this._cacheData[`sar_${n}`]||{};let{result:d,maxMin:p,acceleration:v,isBelow:x}=h,_=!1;const{close:y,low:m,high:w,bar_index:D}=this._variables;return D===1&&(y>i?(x=!0,p=w,d=a):(x=!1,p=m,d=u),_=!0,v=e),d=d+v*(p-d),x?d>m&&(_=!0,x=!1,d=Math.max(w,p||0),p=m,v=e):d<w&&(_=!0,x=!0,d=Math.min(m,p||0),p=w,v=e),_||(x?w>(p||0)&&(p=w,v=Math.min((v||0)+t,r)):m<(p||0)&&(p=m,v=Math.min((v||0)+t,r))),x?(d=Math.min(d,a),D>1&&(d=Math.min(d,l))):(d=Math.max(d,u),D>1&&(d=Math.max(d,c))),this._cacheDataHandle(`sar_${n}`,{high:w,close:y,low:m,preLow:a,preHigh:u,data:Object.assign(h,{result:d,maxMin:p,acceleration:v,isBelow:x})}),d}stoch({source:e,high:t,low:r,length:n},i){if(n===void 0||t===void 0||r===void 0||e===void 0||isNaN(e)||n<0)return;const a=this.lowest({source:r,length:n},i),u=this.highest({source:t,length:n},i);if(!(a===void 0||u===void 0))return 100*(this._variables.close-a)/(u-a)}supertrend({factor:e,atrPeriod:t},r){if(e===void 0||t===void 0)return[void 0,void 0];const{hl2:n,close:i}=this._variables,a=`supertrend_${r}`,{upperBand:u,lowerBand:l,superTrend:c,atr:h,close:d}=this._cacheData[a]||{},p=this.atr({length:t},r);if(p===void 0)return this._cacheDataHandle(a,{close:i}),[void 0,void 0];let v=n+e*p,x=n-e*p;const _=u||0,y=l||0;x=x>y||d<y?x:y,v=v<_||d>_?v:_;let m;h===void 0?m=1:c===_?m=i>v?-1:1:m=i<x?1:-1;const w=m===-1?x:v;return this._cacheDataHandle(a,{upperBand:v,lowerBand:x,superTrend:w,atr:p,close:i}),[w,m]}swma({source:e},t){let{list:r}=this._cacheData[`swma_${t}`]||{};if(r||(r=[]),r.push(e),r=r.slice(-4),this._cacheDataHandle(`swma_${t}`,{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:e=!1},t){const{close:r,low:n,high:i}=this._variables,{close:a}=this._cacheData[`tr_${t}`]||{};return this._cacheDataHandle(`tr_${t}`,{close:r}),a===void 0?e?i-n:void 0:Math.max(i-n,Math.abs(i-a),Math.abs(n-a))}tsi({source:e,short_length:t,long_length:r},n){if(e===void 0||isNaN(e)||t===void 0||r===void 0)return;const i=this.change({source:e},n);if(i===void 0)return;const a=this.ema({source:Math.abs(i),length:t},`absema1_${n}`),u=this.ema({source:i,length:t},`ema1_${n}`);if(u===void 0)return;const l=this.ema({source:u,length:r},`ema2_${n}`),c=this.ema({source:a,length:t},`absema2_${n}`);if(l!==void 0)return l/c}valuewhen({condition:e,source:t,occurrence:r},n){if(t===void 0||r===void 0||r<0)return;let{list:i}=this._cacheData[`valuewhen_${n}`]||{};return i||(i=[]),e&&i.push(t),this._cacheDataHandle(`valuewhen_${n}`,{list:i}),i[i.length-1-r]}variance({source:e,length:t,biased:r=!0},n){if(e===void 0||isNaN(e)||t===void 0||t<0)return;const i=this.sma({source:e,length:t},n),a=this._cacheDataList(e,t,`mode_${n}`);if(!a||i===void 0)return;const u=a.filter(c=>c!==void 0&&!isNaN(c)).slice(-t);if(u.length<t)return;const l=u.reduce((c,h)=>c+Math.pow(h-i,2),0);if(l!==void 0)return r||t<=1?l/t:l/(t-1)}vwap({source:e,anchor:t,stdev_mult:r},n){if(e===void 0)return;t=t===void 0?this._timeframe.change({timeframe:"1D"},n):t;const{volume:i}=this._variables;let{sum:a=0,sumV:u=0,count:l=0,isReset:c,sumS:h=0}=this._cacheData[`vwap_${n}`]||{};if(t&&(a=u=l=h=0,c=!0),!c)return r!==void 0?[]:void 0;const d=e*i+a,p=i+u,v=d/p;return l++,r!==void 0?(h=i*Math.pow(e,2)+h,this._cacheDataHandle(`vwap_${n}`,{sum:d,sumV:p,count:l,isReset:c,sumS:h}),this._computeBands(h,p,r,v)):(this._cacheDataHandle(`vwap_${n}`,{sum:d,sumV:p,count:l,isReset:c}),v)}_computeBands(e,t,r,n){let i=e/t-Math.pow(n,2);i=i<0?0:i;const a=Math.sqrt(i),u=a!==void 0&&!isNaN(a)?n+r*a:void 0,l=a!==void 0&&!isNaN(a)?n-r*a:void 0;return[n,u,l]}vwma({source:e,length:t},r){if(e===void 0||isNaN(e)||t===void 0||t<=0)return;const{volume:n}=this._variables,i=this.sma({source:e*n,length:t},`sma1_${r}`),a=this.sma({source:n,length:t},`sma2_${r}`);if(!(i===void 0||a===void 0))return i/a}wpr({length:e},t){if(e===void 0||e<=0)return;const r=this.highest({length:e},t),n=this.lowest({length:e},t),{close:i}=this._variables;if(!(r===void 0||n===void 0))return(r-i)/(r-n)*-100}_sort(e){const t=e.length;for(let r=0;r<t;r++){let n={};for(let i=0;i<t-r;i++){const{currentVal:a,currentIndex:u}=n,l=e[i];if(l!==void 0){if(a!==void 0&&l<a){e.splice(i,1),e.splice(u,0,l),n={currentIndex:u+1,currentVal:a};continue}n={currentIndex:i,currentVal:l}}}}return e}_cacheDataList(e,t,r){const n=this._cacheData[r]||[];n[this._variables.bar_index]=e,this._cacheData[r]=n;const i=n.filter(()=>!0);if(!(i.length<t))return i}_cacheDataHandle(e,t){const{barIndex:r}=this._cacheData[e]||{};r!==this._variables.bar_index&&(this._cacheData[e]=Object.assign(t,{barIndex:this._variables.bar_index}))}}const Kt={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",typeRepeatErr:"type '$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",typeFieldErr:"In a type declaration, all fields without a default value must be explicitly typified.",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 na 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.",libraryTitleErr:"Invalid argument 'title' in 'library' call. It cannot contain spaces, special characters or begin with a digit.",exportFuncArgErr:"All exported functions args should be typified",indiRunErr:"An indicator must contain at least one of the following: any `plot*()` function, `barcolor()`, `bgcolor()`, `hline()`, `alertcondition()`, or any drawing (line, label, box, table, polyline).",libraryExportErr:"A library must contain at least one exported function, method, or type.",strategyRunErr:"A strategy must contain at least one of the following: any `strategy.*()` function that creates orders, any `plot*()` function, `barcolor()`, `bgcolor()`, `hline()`, or any drawing (line, label, box, table, polyline).",exportUseErr:"Only libraries can contain exported $type.",funcRepeatErr:"The '$name' function has overloads with the same parameters. The type of parameters must be different in overloaded versions of functions.",importMultipleErr:"Cannot import a library more than once",importNotExitErr:"The user '$username' does not have a published library titled '$libraryName'",importNameRepeatErr:"More than one import uses the same alias: $name. Previous usage at line: $line",exportFuncHasInputErr:"The exported function '$func' depends on the '$name' input variable, which is not allowed.",libraryTitleIsKeywordErr:"Invalid argument 'title' in 'library' call. Token: '$name' can't be used as library title.",exportFuncUseGlobalVarErr:"Cannot use global variables in exported functions. Function: $func",loopRuntimeErr:"Loop takes too long to execute (> 500 ms)",paramsErr:"Invalid value '$value' for '$param' parameter of the '$func' function. Possible values: $targetVal",displayErr:"Invalid argument 'display' in '$func' call. Possible values: $values",exportFuncUseReqErr:"Cannot use `request.*()` call in exported function `$name()`",requestExprErr:"Type series $type cannot be used in $name 'expression' argument",argDefaultErr:"The default value assigned to a parameter must be either a literal value (e.g., `5`) or a built-in variable (e.g., `close`)",overloadFuncErr:"Cannot use global variables or any values qualified as 'input' in the local scopes of overloaded functions or methods. Remove any global variables or inputs from the scopes of all '$name()' overloads.",againAssignErr:"Unable to determine the object for the field assignment. Try putting the object into a separate variable before assigning values to its fields.",requestUserInLoopErr:"Cannot use `request.*()` call within loops or conditional structures."};an.SERIES,an.SIMPLE,an.INPUT,an.CONST,an.INT,an.FLOAT,an.BOOL,an.COLOR,an.STRING;const jx=["close","open","high","low","hl2","hlc3","hlcc4","ohlc4","volume"],Yx=["case","catch","default","delete","do","finally","function","instanceof","new","return","this","throw","try","typeof","void","with"],Zx=["linefill","polyline","matrix","series","simple","string","array","color","const","float","label","table","bool","line","box","int","map","continue","for","varip","var","in","export","import","method","switch","break","while","else","type","and","for","not","as","by","if","in","or","to"];class Vx{constructor(e,t,r){U(this,"_cacheData");U(this,"_variables");U(this,"_errorListener");U(this,"_historyInputs");U(this,"_name");this._cacheData={},this._variables=e,this._errorListener=t,this._name=`inputs_${r}`,this._historyInputs=self.workerStorage.get(this._name)||{}}update(e){for(const t of e){const r=t.id;this._cacheData[r]=Object.assign(this._cacheData[r]||{},{...t,isModify:!0}),self.workerStorage.updateValue(this._name,`in_${t.index}`,{modifyDefval:t.sourceTypeName||t.defval})}}input(e,t){return this._cacheHandle(e,t)}int(e,t){return this._cacheHandle(e,t,_r.INT)}bool(e,t){return this._cacheHandle(e,t,_r.BOOL)}color(e,t){return this._cacheHandle(e,t,_r.COLOR)}time(e,t){return this._cacheHandle(e,t,_r.TIME)}float(e,t){return this._cacheHandle(e,t,_r.FLOAT)}price(e,t){return this._cacheHandle(e,t,_r.PRICE)}source(e,t){return this._cacheHandle(e,t,_r.SOURCE)}string(e,t){return this._cacheHandle(e,t,_r.STRING)}symbol(e,t){return this._cacheHandle(e,t,_r.SYMBOL)}session(e,t){return this._cacheHandle(e,t,_r.SESSION)}text_area(e,t){return this._cacheHandle(e,t,_r.TEXT_AREA)}timeframe(e,t){return this._cacheHandle(e,t,_r.TIMEFRAME)}_cacheHandle(e,t,r){if(t.startsWith("export"))return e.defval;const n=`${r||"input"}_${t}`,i=this._cacheData[n];if(e.defval===void 0&&this._errorListener.addError(Kt.inputDefvalErr,t,Ve.Error),i)i.isModify?i.sourceTypeName&&(this._cacheData[n].defval=this._variables[i.sourceTypeName]):Object.assign(this._cacheData[n],e);else{const{defval:a,display:u}=e;this._displayVerify(t,u),e={inputType:r,...e},this._cacheData[n]=e,this._judgeHistoryInputs(e),(r||e.inputType)===_r.SOURCE?this._cacheData[n].options=jx:e.options&&!e.options.includes(a)&&this._errorListener.addError(`input's defval should be in options, but '${a}' is not in [${e.options.toString()}]`,t,Ve.Error)}return this._cacheData[n].defval}_judgeHistoryInputs(e){const{defval:t,sourceTypeName:r,index:n}=e;let i=r||t;const a=`in_${n}`,u=this._historyInputs[a];if(!u)self.workerStorage.setValue(this._name,a,{defval:i});else{const{defval:l,modifyDefval:c}=u;l===i?i=c||i:self.workerStorage.setValue(this._name,a,{defval:i})}r?e.sourceTypeName=i:e.defval=i}_displayVerify(e,t){!t||!t.length||t.includes(Zt.dataWindow)||t.includes(Zt.statusLine)||this._errorListener.addError(or(Kt.displayErr,{func:"input",values:"[display.none, display.data_window, display.status_line, display.all]"}),e,Ve.Error)}getInputs(){const e=Object.keys(this._cacheData),t=[];for(const r of e){const n=this._cacheData[r];n.id=r,t.push(n)}return t.sort((r,n)=>(r.index||0)-(n.index||0))}}class Gx{color({x:e}){return e}new({color:e,transp:t=100}){me(t)&&(t=100);const{r,g:n,b:i}=this._parseColor(e||"");return`rgba(${Math.round(r)}, ${Math.round(n)}, ${Math.round(i)}, ${(100-t)/100})`}rgb({red:e=0,green:t=0,blue:r=0,transp:n=0}){return me(n)&&(n=0),me(e)&&(e=0),me(t)&&(t=0),me(r)&&(r=0),`rgba(${e}, ${t}, ${r}, ${(100-n)/100})`}g({color:e}){return e?this._parseColor(e).g:0}r({color:e}){return e?this._parseColor(e).r:0}b({color:e}){return e?this._parseColor(e).b:0}t({color:e}){return e?Math.round(this._parseColor(e).a*100):0}from_gradient({value:e,bottom_value:t,top_value:r,bottom_color:n,top_color:i}){if(me(e)||me(t)||me(r))return"rgba(0,0,0,1)";const a=(e-t)/(r-t),u=Math.min(Math.max(a,0),1),{r:l,g:c,b:h,a:d}=this._parseColor(n||"rgba(0,0,0,0)"),{r:p,g:v,b:x,a:_}=this._parseColor(i||"rgba(0,0,0,0)"),y=l+u*(p-l),m=c+u*(v-c),w=h+u*(x-h),D=d+u*(_-d);return`rgba(${Math.round(y)}, ${Math.round(m)}, ${Math.round(w)}, ${D.toFixed(2)})`}_parseColor(e){let t,r,n,i;if(e.startsWith("#")){t=parseInt(e.substring(1,3),16),r=parseInt(e.substring(3,5),16),n=parseInt(e.substring(5,7),16);const a=e.substring(7);a?i=(255-parseInt(a,16))/255:i=1}else{const a=this._parserRgbColor(e);t=a[0]||0,r=a[1]||0,n=a[2]||0,i=a[3]||1}return{r:t,g:r,b:n,a:i}}_parserRgbColor(e){var t;return((t=e.match(/\d+/g))==null?void 0:t.map(Number))||[]}}var We={};const Kx=Object.prototype.toString;function ls(s){const e=Kx.call(s);return e.endsWith("Array]")&&!e.includes("Big")}var Xx=Object.freeze({__proto__:null,isAnyArray:ls}),Qx=Mt(Xx);function Jx(s){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!ls(s))throw new TypeError("input must be an array");if(s.length===0)throw new TypeError("input must not be empty");var t=e.fromIndex,r=t===void 0?0:t,n=e.toIndex,i=n===void 0?s.length:n;if(r<0||r>=s.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(i<=r||i>s.length||!Number.isInteger(i))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=s[r],u=r+1;u<i;u++)s[u]>a&&(a=s[u]);return a}function ey(s){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!ls(s))throw new TypeError("input must be an array");if(s.length===0)throw new TypeError("input must not be empty");var t=e.fromIndex,r=t===void 0?0:t,n=e.toIndex,i=n===void 0?s.length:n;if(r<0||r>=s.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(i<=r||i>s.length||!Number.isInteger(i))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=s[r],u=r+1;u<i;u++)s[u]<a&&(a=s[u]);return a}function ty(s){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(ls(s)){if(s.length===0)throw new TypeError("input must not be empty")}else throw new TypeError("input must be an array");var t;if(e.output!==void 0){if(!ls(e.output))throw new TypeError("output option must be an array if specified");t=e.output}else t=new Array(s.length);var r=ey(s),n=Jx(s);if(r===n)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var i=e.min,a=i===void 0?e.autoMinMax?r:0:i,u=e.max,l=u===void 0?e.autoMinMax?n:1:u;if(a>=l)throw new RangeError("min option must be smaller than max option");for(var c=(l-a)/(n-r),h=0;h<s.length;h++)t[h]=(s[h]-r)*c+a;return t}var ry=Object.freeze({__proto__:null,default:ty}),ny=Mt(ry);Object.defineProperty(We,"__esModule",{value:!0});var gr=Qx,Cl=ny;const mo=" ".repeat(2),Fl=" ".repeat(4);function iy(){return Bl(this)}function Bl(s,e={}){const{maxRows:t=15,maxColumns:r=10,maxNumSize:n=8,padMinus:i="auto"}=e;return`${s.constructor.name} {
55
+ ${mo}[
56
+ ${Fl}${sy(s,t,r,n,i)}
57
+ ${mo}]
58
+ ${mo}rows: ${s.rows}
59
+ ${mo}columns: ${s.columns}
60
+ }`}function sy(s,e,t,r,n){const{rows:i,columns:a}=s,u=Math.min(i,e),l=Math.min(a,t),c=[];if(n==="auto"){n=!1;e:for(let h=0;h<u;h++)for(let d=0;d<l;d++)if(s.get(h,d)<0){n=!0;break e}}for(let h=0;h<u;h++){let d=[];for(let p=0;p<l;p++)d.push(oy(s.get(h,p),r,n));c.push(`${d.join(" ")}`)}return l!==a&&(c[c.length-1]+=` ... ${a-t} more columns`),u!==i&&c.push(`... ${i-e} more rows`),c.join(`
61
+ ${Fl}`)}function oy(s,e,t){return(s>=0&&t?` ${Ml(s,e-1)}`:Ml(s,e)).padEnd(e)}function Ml(s,e){let t=s.toString();if(t.length<=e)return t;let r=s.toFixed(e);if(r.length>e&&(r=s.toFixed(Math.max(0,e-(r.length-e)))),r.length<=e&&!r.startsWith("0.000")&&!r.startsWith("-0.000"))return r;let n=s.toExponential(e);return n.length>e&&(n=s.toExponential(Math.max(0,e-(n.length-e)))),n.slice(0)}function ay(s,e){s.prototype.add=function(r){return typeof r=="number"?this.addS(r):this.addM(r)},s.prototype.addS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)+r);return this},s.prototype.addM=function(r){if(r=e.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 i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)+r.get(n,i));return this},s.add=function(r,n){return new e(r).add(n)},s.prototype.sub=function(r){return typeof r=="number"?this.subS(r):this.subM(r)},s.prototype.subS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)-r);return this},s.prototype.subM=function(r){if(r=e.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 i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)-r.get(n,i));return this},s.sub=function(r,n){return new e(r).sub(n)},s.prototype.subtract=s.prototype.sub,s.prototype.subtractS=s.prototype.subS,s.prototype.subtractM=s.prototype.subM,s.subtract=s.sub,s.prototype.mul=function(r){return typeof r=="number"?this.mulS(r):this.mulM(r)},s.prototype.mulS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)*r);return this},s.prototype.mulM=function(r){if(r=e.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 i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)*r.get(n,i));return this},s.mul=function(r,n){return new e(r).mul(n)},s.prototype.multiply=s.prototype.mul,s.prototype.multiplyS=s.prototype.mulS,s.prototype.multiplyM=s.prototype.mulM,s.multiply=s.mul,s.prototype.div=function(r){return typeof r=="number"?this.divS(r):this.divM(r)},s.prototype.divS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)/r);return this},s.prototype.divM=function(r){if(r=e.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 i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)/r.get(n,i));return this},s.div=function(r,n){return new e(r).div(n)},s.prototype.divide=s.prototype.div,s.prototype.divideS=s.prototype.divS,s.prototype.divideM=s.prototype.divM,s.divide=s.div,s.prototype.mod=function(r){return typeof r=="number"?this.modS(r):this.modM(r)},s.prototype.modS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)%r);return this},s.prototype.modM=function(r){if(r=e.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 i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)%r.get(n,i));return this},s.mod=function(r,n){return new e(r).mod(n)},s.prototype.modulus=s.prototype.mod,s.prototype.modulusS=s.prototype.modS,s.prototype.modulusM=s.prototype.modM,s.modulus=s.mod,s.prototype.and=function(r){return typeof r=="number"?this.andS(r):this.andM(r)},s.prototype.andS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)&r);return this},s.prototype.andM=function(r){if(r=e.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 i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)&r.get(n,i));return this},s.and=function(r,n){return new e(r).and(n)},s.prototype.or=function(r){return typeof r=="number"?this.orS(r):this.orM(r)},s.prototype.orS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)|r);return this},s.prototype.orM=function(r){if(r=e.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 i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)|r.get(n,i));return this},s.or=function(r,n){return new e(r).or(n)},s.prototype.xor=function(r){return typeof r=="number"?this.xorS(r):this.xorM(r)},s.prototype.xorS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)^r);return this},s.prototype.xorM=function(r){if(r=e.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 i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)^r.get(n,i));return this},s.xor=function(r,n){return new e(r).xor(n)},s.prototype.leftShift=function(r){return typeof r=="number"?this.leftShiftS(r):this.leftShiftM(r)},s.prototype.leftShiftS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)<<r);return this},s.prototype.leftShiftM=function(r){if(r=e.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 i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)<<r.get(n,i));return this},s.leftShift=function(r,n){return new e(r).leftShift(n)},s.prototype.signPropagatingRightShift=function(r){return typeof r=="number"?this.signPropagatingRightShiftS(r):this.signPropagatingRightShiftM(r)},s.prototype.signPropagatingRightShiftS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)>>r);return this},s.prototype.signPropagatingRightShiftM=function(r){if(r=e.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 i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)>>r.get(n,i));return this},s.signPropagatingRightShift=function(r,n){return new e(r).signPropagatingRightShift(n)},s.prototype.rightShift=function(r){return typeof r=="number"?this.rightShiftS(r):this.rightShiftM(r)},s.prototype.rightShiftS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)>>>r);return this},s.prototype.rightShiftM=function(r){if(r=e.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 i=0;i<this.columns;i++)this.set(n,i,this.get(n,i)>>>r.get(n,i));return this},s.rightShift=function(r,n){return new e(r).rightShift(n)},s.prototype.zeroFillRightShift=s.prototype.rightShift,s.prototype.zeroFillRightShiftS=s.prototype.rightShiftS,s.prototype.zeroFillRightShiftM=s.prototype.rightShiftM,s.zeroFillRightShift=s.rightShift,s.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},s.not=function(r){return new e(r).not()},s.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},s.abs=function(r){return new e(r).abs()},s.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},s.acos=function(r){return new e(r).acos()},s.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},s.acosh=function(r){return new e(r).acosh()},s.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},s.asin=function(r){return new e(r).asin()},s.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},s.asinh=function(r){return new e(r).asinh()},s.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},s.atan=function(r){return new e(r).atan()},s.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},s.atanh=function(r){return new e(r).atanh()},s.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},s.cbrt=function(r){return new e(r).cbrt()},s.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},s.ceil=function(r){return new e(r).ceil()},s.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},s.clz32=function(r){return new e(r).clz32()},s.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},s.cos=function(r){return new e(r).cos()},s.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},s.cosh=function(r){return new e(r).cosh()},s.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},s.exp=function(r){return new e(r).exp()},s.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},s.expm1=function(r){return new e(r).expm1()},s.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},s.floor=function(r){return new e(r).floor()},s.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},s.fround=function(r){return new e(r).fround()},s.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},s.log=function(r){return new e(r).log()},s.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},s.log1p=function(r){return new e(r).log1p()},s.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},s.log10=function(r){return new e(r).log10()},s.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},s.log2=function(r){return new e(r).log2()},s.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},s.round=function(r){return new e(r).round()},s.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},s.sign=function(r){return new e(r).sign()},s.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},s.sin=function(r){return new e(r).sin()},s.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},s.sinh=function(r){return new e(r).sinh()},s.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},s.sqrt=function(r){return new e(r).sqrt()},s.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},s.tan=function(r){return new e(r).tan()},s.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},s.tanh=function(r){return new e(r).tanh()},s.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},s.trunc=function(r){return new e(r).trunc()},s.pow=function(r,n){return new e(r).pow(n)},s.prototype.pow=function(r){return typeof r=="number"?this.powS(r):this.powM(r)},s.prototype.powS=function(r){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.pow(this.get(n,i),r));return this},s.prototype.powM=function(r){if(r=e.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 i=0;i<this.columns;i++)this.set(n,i,Math.pow(this.get(n,i),r.get(n,i)));return this}}function $r(s,e,t){let r=t?s.rows:s.rows-1;if(e<0||e>r)throw new RangeError("Row index out of range")}function Rr(s,e,t){let r=t?s.columns:s.columns-1;if(e<0||e>r)throw new RangeError("Column index out of range")}function Mi(s,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==s.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function Ni(s,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==s.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function Qa(s,e){if(!gr.isAnyArray(e))throw new TypeError("row indices must be an array");for(let t=0;t<e.length;t++)if(e[t]<0||e[t]>=s.rows)throw new RangeError("row indices are out of range")}function Ja(s,e){if(!gr.isAnyArray(e))throw new TypeError("column indices must be an array");for(let t=0;t<e.length;t++)if(e[t]<0||e[t]>=s.columns)throw new RangeError("column indices are out of range")}function e0(s,e,t,r,n){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(yo("startRow",e),yo("endRow",t),yo("startColumn",r),yo("endColumn",n),e>t||r>n||e<0||e>=s.rows||t<0||t>=s.rows||r<0||r>=s.columns||n<0||n>=s.columns)throw new RangeError("Submatrix indices are out of range")}function xo(s,e=0){let t=[];for(let r=0;r<s;r++)t.push(e);return t}function yo(s,e){if(typeof e!="number")throw new TypeError(`${s} must be a number`)}function Si(s){if(s.isEmpty())throw new Error("Empty matrix has no elements to index")}function uy(s){let e=xo(s.rows);for(let t=0;t<s.rows;++t)for(let r=0;r<s.columns;++r)e[t]+=s.get(t,r);return e}function fy(s){let e=xo(s.columns);for(let t=0;t<s.rows;++t)for(let r=0;r<s.columns;++r)e[r]+=s.get(t,r);return e}function cy(s){let e=0;for(let t=0;t<s.rows;t++)for(let r=0;r<s.columns;r++)e+=s.get(t,r);return e}function ly(s){let e=xo(s.rows,1);for(let t=0;t<s.rows;++t)for(let r=0;r<s.columns;++r)e[t]*=s.get(t,r);return e}function hy(s){let e=xo(s.columns,1);for(let t=0;t<s.rows;++t)for(let r=0;r<s.columns;++r)e[r]*=s.get(t,r);return e}function dy(s){let e=1;for(let t=0;t<s.rows;t++)for(let r=0;r<s.columns;r++)e*=s.get(t,r);return e}function py(s,e,t){const r=s.rows,n=s.columns,i=[];for(let a=0;a<r;a++){let u=0,l=0,c=0;for(let h=0;h<n;h++)c=s.get(a,h)-t[a],u+=c,l+=c*c;e?i.push((l-u*u/n)/(n-1)):i.push((l-u*u/n)/n)}return i}function _y(s,e,t){const r=s.rows,n=s.columns,i=[];for(let a=0;a<n;a++){let u=0,l=0,c=0;for(let h=0;h<r;h++)c=s.get(h,a)-t[a],u+=c,l+=c*c;e?i.push((l-u*u/r)/(r-1)):i.push((l-u*u/r)/r)}return i}function vy(s,e,t){const r=s.rows,n=s.columns,i=r*n;let a=0,u=0,l=0;for(let c=0;c<r;c++)for(let h=0;h<n;h++)l=s.get(c,h)-t,a+=l,u+=l*l;return e?(u-a*a/i)/(i-1):(u-a*a/i)/i}function gy(s,e){for(let t=0;t<s.rows;t++)for(let r=0;r<s.columns;r++)s.set(t,r,s.get(t,r)-e[t])}function my(s,e){for(let t=0;t<s.rows;t++)for(let r=0;r<s.columns;r++)s.set(t,r,s.get(t,r)-e[r])}function xy(s,e){for(let t=0;t<s.rows;t++)for(let r=0;r<s.columns;r++)s.set(t,r,s.get(t,r)-e)}function yy(s){const e=[];for(let t=0;t<s.rows;t++){let r=0;for(let n=0;n<s.columns;n++)r+=Math.pow(s.get(t,n),2)/(s.columns-1);e.push(Math.sqrt(r))}return e}function Dy(s,e){for(let t=0;t<s.rows;t++)for(let r=0;r<s.columns;r++)s.set(t,r,s.get(t,r)/e[t])}function wy(s){const e=[];for(let t=0;t<s.columns;t++){let r=0;for(let n=0;n<s.rows;n++)r+=Math.pow(s.get(n,t),2)/(s.rows-1);e.push(Math.sqrt(r))}return e}function Ey(s,e){for(let t=0;t<s.rows;t++)for(let r=0;r<s.columns;r++)s.set(t,r,s.get(t,r)/e[r])}function by(s){const e=s.size-1;let t=0;for(let r=0;r<s.columns;r++)for(let n=0;n<s.rows;n++)t+=Math.pow(s.get(n,r),2)/e;return Math.sqrt(t)}function Ay(s,e){for(let t=0;t<s.rows;t++)for(let r=0;r<s.columns;r++)s.set(t,r,s.get(t,r)/e)}class ke{static from1DArray(e,t,r){if(e*t!==r.length)throw new RangeError("data length does not match given dimensions");let i=new ve(e,t);for(let a=0;a<e;a++)for(let u=0;u<t;u++)i.set(a,u,r[a*t+u]);return i}static rowVector(e){let t=new ve(1,e.length);for(let r=0;r<e.length;r++)t.set(0,r,e[r]);return t}static columnVector(e){let t=new ve(e.length,1);for(let r=0;r<e.length;r++)t.set(r,0,e[r]);return t}static zeros(e,t){return new ve(e,t)}static ones(e,t){return new ve(e,t).fill(1)}static rand(e,t,r={}){if(typeof r!="object")throw new TypeError("options must be an object");const{random:n=Math.random}=r;let i=new ve(e,t);for(let a=0;a<e;a++)for(let u=0;u<t;u++)i.set(a,u,n());return i}static randInt(e,t,r={}){if(typeof r!="object")throw new TypeError("options must be an object");const{min:n=0,max:i=1e3,random:a=Math.random}=r;if(!Number.isInteger(n))throw new TypeError("min must be an integer");if(!Number.isInteger(i))throw new TypeError("max must be an integer");if(n>=i)throw new RangeError("min must be smaller than max");let u=i-n,l=new ve(e,t);for(let c=0;c<e;c++)for(let h=0;h<t;h++){let d=n+Math.round(a()*u);l.set(c,h,d)}return l}static eye(e,t,r){t===void 0&&(t=e),r===void 0&&(r=1);let n=Math.min(e,t),i=this.zeros(e,t);for(let a=0;a<n;a++)i.set(a,a,r);return i}static diag(e,t,r){let n=e.length;t===void 0&&(t=n),r===void 0&&(r=t);let i=Math.min(n,t,r),a=this.zeros(t,r);for(let u=0;u<i;u++)a.set(u,u,e[u]);return a}static min(e,t){e=this.checkMatrix(e),t=this.checkMatrix(t);let r=e.rows,n=e.columns,i=new ve(r,n);for(let a=0;a<r;a++)for(let u=0;u<n;u++)i.set(a,u,Math.min(e.get(a,u),t.get(a,u)));return i}static max(e,t){e=this.checkMatrix(e),t=this.checkMatrix(t);let r=e.rows,n=e.columns,i=new this(r,n);for(let a=0;a<r;a++)for(let u=0;u<n;u++)i.set(a,u,Math.max(e.get(a,u),t.get(a,u)));return i}static checkMatrix(e){return ke.isMatrix(e)?e:new ve(e)}static isMatrix(e){return e!=null&&e.klass==="Matrix"}get size(){return this.rows*this.columns}apply(e){if(typeof e!="function")throw new TypeError("callback must be a function");for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)e.call(this,t,r);return this}to1DArray(){let e=[];for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)e.push(this.get(t,r));return e}to2DArray(){let e=[];for(let t=0;t<this.rows;t++){e.push([]);for(let r=0;r<this.columns;r++)e[t].push(this.get(t,r))}return e}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 e=0;e<this.rows;e++)for(let t=0;t<=e;t++)if(this.get(e,t)!==this.get(t,e))return!1;return!0}return!1}isDistance(){if(!this.isSymmetric())return!1;for(let e=0;e<this.rows;e++)if(this.get(e,e)!==0)return!1;return!0}isEchelonForm(){let e=0,t=0,r=-1,n=!0,i=!1;for(;e<this.rows&&n;){for(t=0,i=!1;t<this.columns&&i===!1;)this.get(e,t)===0?t++:this.get(e,t)===1&&t>r?(i=!0,r=t):(n=!1,i=!0);e++}return n}isReducedEchelonForm(){let e=0,t=0,r=-1,n=!0,i=!1;for(;e<this.rows&&n;){for(t=0,i=!1;t<this.columns&&i===!1;)this.get(e,t)===0?t++:this.get(e,t)===1&&t>r?(i=!0,r=t):(n=!1,i=!0);for(let a=t+1;a<this.rows;a++)this.get(e,a)!==0&&(n=!1);e++}return n}echelonForm(){let e=this.clone(),t=0,r=0;for(;t<e.rows&&r<e.columns;){let n=t;for(let i=t;i<e.rows;i++)e.get(i,r)>e.get(n,r)&&(n=i);if(e.get(n,r)===0)r++;else{e.swapRows(t,n);let i=e.get(t,r);for(let a=r;a<e.columns;a++)e.set(t,a,e.get(t,a)/i);for(let a=t+1;a<e.rows;a++){let u=e.get(a,r)/e.get(t,r);e.set(a,r,0);for(let l=r+1;l<e.columns;l++)e.set(a,l,e.get(a,l)-e.get(t,l)*u)}t++,r++}}return e}reducedEchelonForm(){let e=this.echelonForm(),t=e.columns,r=e.rows,n=r-1;for(;n>=0;)if(e.maxRow(n)===0)n--;else{let i=0,a=!1;for(;i<r&&a===!1;)e.get(n,i)===1?a=!0:i++;for(let u=0;u<n;u++){let l=e.get(u,i);for(let c=i;c<t;c++){let h=e.get(u,c)-l*e.get(n,c);e.set(u,c,h)}}n--}return e}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(e={}){if(typeof e!="object")throw new TypeError("options must be an object");const{rows:t=1,columns:r=1}=e;if(!Number.isInteger(t)||t<=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 ve(this.rows*t,this.columns*r);for(let i=0;i<t;i++)for(let a=0;a<r;a++)n.setSubMatrix(this,this.rows*i,this.columns*a);return n}fill(e){for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)this.set(t,r,e);return this}neg(){return this.mulS(-1)}getRow(e){$r(this,e);let t=[];for(let r=0;r<this.columns;r++)t.push(this.get(e,r));return t}getRowVector(e){return ve.rowVector(this.getRow(e))}setRow(e,t){$r(this,e),t=Mi(this,t);for(let r=0;r<this.columns;r++)this.set(e,r,t[r]);return this}swapRows(e,t){$r(this,e),$r(this,t);for(let r=0;r<this.columns;r++){let n=this.get(e,r);this.set(e,r,this.get(t,r)),this.set(t,r,n)}return this}getColumn(e){Rr(this,e);let t=[];for(let r=0;r<this.rows;r++)t.push(this.get(r,e));return t}getColumnVector(e){return ve.columnVector(this.getColumn(e))}setColumn(e,t){Rr(this,e),t=Ni(this,t);for(let r=0;r<this.rows;r++)this.set(r,e,t[r]);return this}swapColumns(e,t){Rr(this,e),Rr(this,t);for(let r=0;r<this.rows;r++){let n=this.get(r,e);this.set(r,e,this.get(r,t)),this.set(r,t,n)}return this}addRowVector(e){e=Mi(this,e);for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)+e[r]);return this}subRowVector(e){e=Mi(this,e);for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)-e[r]);return this}mulRowVector(e){e=Mi(this,e);for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)*e[r]);return this}divRowVector(e){e=Mi(this,e);for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)/e[r]);return this}addColumnVector(e){e=Ni(this,e);for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)+e[t]);return this}subColumnVector(e){e=Ni(this,e);for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)-e[t]);return this}mulColumnVector(e){e=Ni(this,e);for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)*e[t]);return this}divColumnVector(e){e=Ni(this,e);for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)/e[t]);return this}mulRow(e,t){$r(this,e);for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t);return this}mulColumn(e,t){Rr(this,e);for(let r=0;r<this.rows;r++)this.set(r,e,this.get(r,e)*t);return this}max(e){if(this.isEmpty())return NaN;switch(e){case"row":{const t=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)>t[r]&&(t[r]=this.get(r,n));return t}case"column":{const t=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)>t[n]&&(t[n]=this.get(r,n));return t}case void 0:{let t=this.get(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));return t}default:throw new Error(`invalid option: ${e}`)}}maxIndex(){Si(this);let e=this.get(0,0),t=[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),t[0]=r,t[1]=n);return t}min(e){if(this.isEmpty())return NaN;switch(e){case"row":{const t=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)<t[r]&&(t[r]=this.get(r,n));return t}case"column":{const t=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)<t[n]&&(t[n]=this.get(r,n));return t}case void 0:{let t=this.get(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));return t}default:throw new Error(`invalid option: ${e}`)}}minIndex(){Si(this);let e=this.get(0,0),t=[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),t[0]=r,t[1]=n);return t}maxRow(e){if($r(this,e),this.isEmpty())return NaN;let t=this.get(e,0);for(let r=1;r<this.columns;r++)this.get(e,r)>t&&(t=this.get(e,r));return t}maxRowIndex(e){$r(this,e),Si(this);let t=this.get(e,0),r=[e,0];for(let n=1;n<this.columns;n++)this.get(e,n)>t&&(t=this.get(e,n),r[1]=n);return r}minRow(e){if($r(this,e),this.isEmpty())return NaN;let t=this.get(e,0);for(let r=1;r<this.columns;r++)this.get(e,r)<t&&(t=this.get(e,r));return t}minRowIndex(e){$r(this,e),Si(this);let t=this.get(e,0),r=[e,0];for(let n=1;n<this.columns;n++)this.get(e,n)<t&&(t=this.get(e,n),r[1]=n);return r}maxColumn(e){if(Rr(this,e),this.isEmpty())return NaN;let t=this.get(0,e);for(let r=1;r<this.rows;r++)this.get(r,e)>t&&(t=this.get(r,e));return t}maxColumnIndex(e){Rr(this,e),Si(this);let t=this.get(0,e),r=[0,e];for(let n=1;n<this.rows;n++)this.get(n,e)>t&&(t=this.get(n,e),r[0]=n);return r}minColumn(e){if(Rr(this,e),this.isEmpty())return NaN;let t=this.get(0,e);for(let r=1;r<this.rows;r++)this.get(r,e)<t&&(t=this.get(r,e));return t}minColumnIndex(e){Rr(this,e),Si(this);let t=this.get(0,e),r=[0,e];for(let n=1;n<this.rows;n++)this.get(n,e)<t&&(t=this.get(n,e),r[0]=n);return r}diag(){let e=Math.min(this.rows,this.columns),t=[];for(let r=0;r<e;r++)t.push(this.get(r,r));return t}norm(e="frobenius"){switch(e){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw new RangeError(`unknown norm type: ${e}`)}}cumulativeSum(){let e=0;for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)e+=this.get(t,r),this.set(t,r,e);return this}dot(e){ke.isMatrix(e)&&(e=e.to1DArray());let t=this.to1DArray();if(t.length!==e.length)throw new RangeError("vectors do not have the same size");let r=0;for(let n=0;n<t.length;n++)r+=t[n]*e[n];return r}mmul(e){e=ve.checkMatrix(e);let t=this.rows,r=this.columns,n=e.columns,i=new ve(t,n),a=new Float64Array(r);for(let u=0;u<n;u++){for(let l=0;l<r;l++)a[l]=e.get(l,u);for(let l=0;l<t;l++){let c=0;for(let h=0;h<r;h++)c+=this.get(l,h)*a[h];i.set(l,u,c)}}return i}strassen2x2(e){e=ve.checkMatrix(e);let t=new ve(2,2);const r=this.get(0,0),n=e.get(0,0),i=this.get(0,1),a=e.get(0,1),u=this.get(1,0),l=e.get(1,0),c=this.get(1,1),h=e.get(1,1),d=(r+c)*(n+h),p=(u+c)*n,v=r*(a-h),x=c*(l-n),_=(r+i)*h,y=(u-r)*(n+a),m=(i-c)*(l+h),w=d+x-_+m,D=v+_,C=p+x,E=d-p+v+y;return t.set(0,0,w),t.set(0,1,D),t.set(1,0,C),t.set(1,1,E),t}strassen3x3(e){e=ve.checkMatrix(e);let t=new ve(3,3);const r=this.get(0,0),n=this.get(0,1),i=this.get(0,2),a=this.get(1,0),u=this.get(1,1),l=this.get(1,2),c=this.get(2,0),h=this.get(2,1),d=this.get(2,2),p=e.get(0,0),v=e.get(0,1),x=e.get(0,2),_=e.get(1,0),y=e.get(1,1),m=e.get(1,2),w=e.get(2,0),D=e.get(2,1),C=e.get(2,2),E=(r+n+i-a-u-h-d)*y,F=(r-a)*(-v+y),B=u*(-p+v+_-y-m-w+C),M=(-r+a+u)*(p-v+y),O=(a+u)*(-p+v),A=r*p,N=(-r+c+h)*(p-x+m),T=(-r+c)*(x-m),R=(c+h)*(-p+x),k=(r+n+i-u-l-c-h)*m,z=h*(-p+x+_-y-m-w+D),L=(-i+h+d)*(y+w-D),G=(i-d)*(y-D),H=i*w,ee=(h+d)*(-w+D),te=(-i+u+l)*(m+w-C),j=(i-l)*(m-C),X=(u+l)*(-w+C),Y=n*_,Q=l*D,pe=a*x,De=c*v,we=d*C,Ee=A+H+Y,Oe=E+M+O+A+L+H+ee,Fe=A+N+R+k+H+te+X,nt=F+B+M+A+H+te+j,Ye=F+M+O+A+Q,Te=H+te+j+X+pe,Re=A+N+T+z+L+G+H,xt=L+G+H+ee+De,Ut=A+N+T+R+we;return t.set(0,0,Ee),t.set(0,1,Oe),t.set(0,2,Fe),t.set(1,0,nt),t.set(1,1,Ye),t.set(1,2,Te),t.set(2,0,Re),t.set(2,1,xt),t.set(2,2,Ut),t}mmulStrassen(e){e=ve.checkMatrix(e);let t=this.clone(),r=t.rows,n=t.columns,i=e.rows,a=e.columns;n!==i&&console.warn(`Multiplying ${r} x ${n} and ${i} x ${a} matrix: dimensions do not match.`);function u(d,p,v){let x=d.rows,_=d.columns;if(x===p&&_===v)return d;{let y=ke.zeros(p,v);return y=y.setSubMatrix(d,0,0),y}}let l=Math.max(r,i),c=Math.max(n,a);t=u(t,l,c),e=u(e,l,c);function h(d,p,v,x){if(v<=512||x<=512)return d.mmul(p);v%2===1&&x%2===1?(d=u(d,v+1,x+1),p=u(p,v+1,x+1)):v%2===1?(d=u(d,v+1,x),p=u(p,v+1,x)):x%2===1&&(d=u(d,v,x+1),p=u(p,v,x+1));let _=parseInt(d.rows/2,10),y=parseInt(d.columns/2,10),m=d.subMatrix(0,_-1,0,y-1),w=p.subMatrix(0,_-1,0,y-1),D=d.subMatrix(0,_-1,y,d.columns-1),C=p.subMatrix(0,_-1,y,p.columns-1),E=d.subMatrix(_,d.rows-1,0,y-1),F=p.subMatrix(_,p.rows-1,0,y-1),B=d.subMatrix(_,d.rows-1,y,d.columns-1),M=p.subMatrix(_,p.rows-1,y,p.columns-1),O=h(ke.add(m,B),ke.add(w,M),_,y),A=h(ke.add(E,B),w,_,y),N=h(m,ke.sub(C,M),_,y),T=h(B,ke.sub(F,w),_,y),R=h(ke.add(m,D),M,_,y),k=h(ke.sub(E,m),ke.add(w,C),_,y),z=h(ke.sub(D,B),ke.add(F,M),_,y),L=ke.add(O,T);L.sub(R),L.add(z);let G=ke.add(N,R),H=ke.add(A,T),ee=ke.sub(O,A);ee.add(N),ee.add(k);let te=ke.zeros(2*L.rows,2*L.columns);return te=te.setSubMatrix(L,0,0),te=te.setSubMatrix(G,L.rows,0),te=te.setSubMatrix(H,0,L.columns),te=te.setSubMatrix(ee,L.rows,L.columns),te.subMatrix(0,v-1,0,x-1)}return h(t,e,l,c)}scaleRows(e={}){if(typeof e!="object")throw new TypeError("options must be an object");const{min:t=0,max:r=1}=e;if(!Number.isFinite(t))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(t>=r)throw new RangeError("min must be smaller than max");let n=new ve(this.rows,this.columns);for(let i=0;i<this.rows;i++){const a=this.getRow(i);a.length>0&&Cl(a,{min:t,max:r,output:a}),n.setRow(i,a)}return n}scaleColumns(e={}){if(typeof e!="object")throw new TypeError("options must be an object");const{min:t=0,max:r=1}=e;if(!Number.isFinite(t))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(t>=r)throw new RangeError("min must be smaller than max");let n=new ve(this.rows,this.columns);for(let i=0;i<this.columns;i++){const a=this.getColumn(i);a.length&&Cl(a,{min:t,max:r,output:a}),n.setColumn(i,a)}return n}flipRows(){const e=Math.ceil(this.columns/2);for(let t=0;t<this.rows;t++)for(let r=0;r<e;r++){let n=this.get(t,r),i=this.get(t,this.columns-1-r);this.set(t,r,i),this.set(t,this.columns-1-r,n)}return this}flipColumns(){const e=Math.ceil(this.rows/2);for(let t=0;t<this.columns;t++)for(let r=0;r<e;r++){let n=this.get(r,t),i=this.get(this.rows-1-r,t);this.set(r,t,i),this.set(this.rows-1-r,t,n)}return this}kroneckerProduct(e){e=ve.checkMatrix(e);let t=this.rows,r=this.columns,n=e.rows,i=e.columns,a=new ve(t*n,r*i);for(let u=0;u<t;u++)for(let l=0;l<r;l++)for(let c=0;c<n;c++)for(let h=0;h<i;h++)a.set(n*u+c,i*l+h,this.get(u,l)*e.get(c,h));return a}kroneckerSum(e){if(e=ve.checkMatrix(e),!this.isSquare()||!e.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let t=this.rows,r=e.rows,n=this.kroneckerProduct(ve.eye(r,r)),i=ve.eye(t,t).kroneckerProduct(e);return n.add(i)}transpose(){let e=new ve(this.columns,this.rows);for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)e.set(r,t,this.get(t,r));return e}sortRows(e=Nl){for(let t=0;t<this.rows;t++)this.setRow(t,this.getRow(t).sort(e));return this}sortColumns(e=Nl){for(let t=0;t<this.columns;t++)this.setColumn(t,this.getColumn(t).sort(e));return this}subMatrix(e,t,r,n){e0(this,e,t,r,n);let i=new ve(t-e+1,n-r+1);for(let a=e;a<=t;a++)for(let u=r;u<=n;u++)i.set(a-e,u-r,this.get(a,u));return i}subMatrixRow(e,t,r){if(t===void 0&&(t=0),r===void 0&&(r=this.columns-1),t>r||t<0||t>=this.columns||r<0||r>=this.columns)throw new RangeError("Argument out of range");let n=new ve(e.length,r-t+1);for(let i=0;i<e.length;i++)for(let a=t;a<=r;a++){if(e[i]<0||e[i]>=this.rows)throw new RangeError(`Row index out of range: ${e[i]}`);n.set(i,a-t,this.get(e[i],a))}return n}subMatrixColumn(e,t,r){if(t===void 0&&(t=0),r===void 0&&(r=this.rows-1),t>r||t<0||t>=this.rows||r<0||r>=this.rows)throw new RangeError("Argument out of range");let n=new ve(r-t+1,e.length);for(let i=0;i<e.length;i++)for(let a=t;a<=r;a++){if(e[i]<0||e[i]>=this.columns)throw new RangeError(`Column index out of range: ${e[i]}`);n.set(a-t,i,this.get(a,e[i]))}return n}setSubMatrix(e,t,r){if(e=ve.checkMatrix(e),e.isEmpty())return this;let n=t+e.rows-1,i=r+e.columns-1;e0(this,t,n,r,i);for(let a=0;a<e.rows;a++)for(let u=0;u<e.columns;u++)this.set(t+a,r+u,e.get(a,u));return this}selection(e,t){Qa(this,e),Ja(this,t);let r=new ve(e.length,t.length);for(let n=0;n<e.length;n++){let i=e[n];for(let a=0;a<t.length;a++){let u=t[a];r.set(n,a,this.get(i,u))}}return r}trace(){let e=Math.min(this.rows,this.columns),t=0;for(let r=0;r<e;r++)t+=this.get(r,r);return t}clone(){return this.constructor.copy(this,new ve(this.rows,this.columns))}static copy(e,t){for(const[r,n,i]of e.entries())t.set(r,n,i);return t}sum(e){switch(e){case"row":return uy(this);case"column":return fy(this);case void 0:return cy(this);default:throw new Error(`invalid option: ${e}`)}}product(e){switch(e){case"row":return ly(this);case"column":return hy(this);case void 0:return dy(this);default:throw new Error(`invalid option: ${e}`)}}mean(e){const t=this.sum(e);switch(e){case"row":{for(let r=0;r<this.rows;r++)t[r]/=this.columns;return t}case"column":{for(let r=0;r<this.columns;r++)t[r]/=this.rows;return t}case void 0:return t/this.size;default:throw new Error(`invalid option: ${e}`)}}variance(e,t={}){if(typeof e=="object"&&(t=e,e=void 0),typeof t!="object")throw new TypeError("options must be an object");const{unbiased:r=!0,mean:n=this.mean(e)}=t;if(typeof r!="boolean")throw new TypeError("unbiased must be a boolean");switch(e){case"row":{if(!gr.isAnyArray(n))throw new TypeError("mean must be an array");return py(this,r,n)}case"column":{if(!gr.isAnyArray(n))throw new TypeError("mean must be an array");return _y(this,r,n)}case void 0:{if(typeof n!="number")throw new TypeError("mean must be a number");return vy(this,r,n)}default:throw new Error(`invalid option: ${e}`)}}standardDeviation(e,t){typeof e=="object"&&(t=e,e=void 0);const r=this.variance(e,t);if(e===void 0)return Math.sqrt(r);for(let n=0;n<r.length;n++)r[n]=Math.sqrt(r[n]);return r}center(e,t={}){if(typeof e=="object"&&(t=e,e=void 0),typeof t!="object")throw new TypeError("options must be an object");const{center:r=this.mean(e)}=t;switch(e){case"row":{if(!gr.isAnyArray(r))throw new TypeError("center must be an array");return gy(this,r),this}case"column":{if(!gr.isAnyArray(r))throw new TypeError("center must be an array");return my(this,r),this}case void 0:{if(typeof r!="number")throw new TypeError("center must be a number");return xy(this,r),this}default:throw new Error(`invalid option: ${e}`)}}scale(e,t={}){if(typeof e=="object"&&(t=e,e=void 0),typeof t!="object")throw new TypeError("options must be an object");let r=t.scale;switch(e){case"row":{if(r===void 0)r=yy(this);else if(!gr.isAnyArray(r))throw new TypeError("scale must be an array");return Dy(this,r),this}case"column":{if(r===void 0)r=wy(this);else if(!gr.isAnyArray(r))throw new TypeError("scale must be an array");return Ey(this,r),this}case void 0:{if(r===void 0)r=by(this);else if(typeof r!="number")throw new TypeError("scale must be a number");return Ay(this,r),this}default:throw new Error(`invalid option: ${e}`)}}toString(e){return Bl(this,e)}[Symbol.iterator](){return this.entries()}*entries(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)yield[e,t,this.get(e,t)]}*values(){for(let e=0;e<this.rows;e++)for(let t=0;t<this.columns;t++)yield this.get(e,t)}}ke.prototype.klass="Matrix",typeof Symbol<"u"&&(ke.prototype[Symbol.for("nodejs.util.inspect.custom")]=iy);function Nl(s,e){return s-e}function Cy(s){return s.every(e=>typeof e=="number")}ke.random=ke.rand,ke.randomInt=ke.randInt,ke.diagonal=ke.diag,ke.prototype.diagonal=ke.prototype.diag,ke.identity=ke.eye,ke.prototype.negate=ke.prototype.neg,ke.prototype.tensorProduct=ke.prototype.kroneckerProduct;let ve=(Ri=class extends ke{constructor(t,r){super();vf(this,_s);U(this,"data");if(Ri.isMatrix(t))gf(this,_s,mf).call(this,t.rows,t.columns),Ri.copy(t,this);else if(Number.isInteger(t)&&t>=0)gf(this,_s,mf).call(this,t,r);else if(gr.isAnyArray(t)){const n=t;if(t=n.length,r=t?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 i=0;i<t;i++){if(n[i].length!==r)throw new RangeError("Inconsistent array dimensions");if(!Cy(n[i]))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(n[i]))}this.rows=t,this.columns=r}else throw new TypeError("First argument must be a positive number or an array")}set(t,r,n){return this.data[t][r]=n,this}get(t,r){return this.data[t][r]}removeRow(t){return $r(this,t),this.data.splice(t,1),this.rows-=1,this}addRow(t,r){return r===void 0&&(r=t,t=this.rows),$r(this,t,!0),r=Float64Array.from(Mi(this,r)),this.data.splice(t,0,r),this.rows+=1,this}removeColumn(t){Rr(this,t);for(let r=0;r<this.rows;r++){const n=new Float64Array(this.columns-1);for(let i=0;i<t;i++)n[i]=this.data[r][i];for(let i=t+1;i<this.columns;i++)n[i-1]=this.data[r][i];this.data[r]=n}return this.columns-=1,this}addColumn(t,r){typeof r>"u"&&(r=t,t=this.columns),Rr(this,t,!0),r=Ni(this,r);for(let n=0;n<this.rows;n++){const i=new Float64Array(this.columns+1);let a=0;for(;a<t;a++)i[a]=this.data[n][a];for(i[a++]=r[n];a<this.columns+1;a++)i[a]=this.data[n][a-1];this.data[n]=i}return this.columns+=1,this}},_s=new WeakSet,mf=function(t,r){if(this.data=[],Number.isInteger(r)&&r>=0)for(let n=0;n<t;n++)this.data.push(new Float64Array(r));else throw new TypeError("nColumns must be a positive integer");this.rows=t,this.columns=r},Ri);ay(ke,ve);const Io=class Io extends ke{constructor(t){super();vf(this,tr,void 0);if(ve.isMatrix(t)){if(!t.isSymmetric())throw new TypeError("not symmetric data");Ea(this,tr,ve.copy(t,new ve(t.rows,t.rows)))}else if(Number.isInteger(t)&&t>=0)Ea(this,tr,new ve(t,t));else if(Ea(this,tr,new ve(t)),!this.isSymmetric())throw new TypeError("not symmetric data")}get size(){return on(this,tr).size}get rows(){return on(this,tr).rows}get columns(){return on(this,tr).columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(t){return ve.isMatrix(t)&&t.klassType==="SymmetricMatrix"}static zeros(t){return new this(t)}static ones(t){return new this(t).fill(1)}clone(){const t=new Io(this.diagonalSize);for(const[r,n,i]of this.upperRightEntries())t.set(r,n,i);return t}toMatrix(){return new ve(this)}get(t,r){return on(this,tr).get(t,r)}set(t,r,n){return on(this,tr).set(t,r,n),on(this,tr).set(r,t,n),this}removeCross(t){return on(this,tr).removeRow(t),on(this,tr).removeColumn(t),this}addCross(t,r){r===void 0&&(r=t,t=this.diagonalSize);const n=r.slice();return n.splice(t,1),on(this,tr).addRow(t,n),on(this,tr).addColumn(t,r),this}applyMask(t){if(t.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const r=[];for(const[n,i]of t.entries())i||r.push(n);r.reverse();for(const n of r)this.removeCross(n);return this}toCompact(){const{diagonalSize:t}=this,r=new Array(t*(t+1)/2);for(let n=0,i=0,a=0;a<r.length;a++)r[a]=this.get(i,n),++n>=t&&(n=++i);return r}static fromCompact(t){const r=t.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(t)}`);const i=new Io(n);for(let a=0,u=0,l=0;l<r;l++)i.set(a,u,t[l]),++a>=n&&(a=++u);return i}*upperRightEntries(){for(let t=0,r=0;t<this.diagonalSize;void 0){const n=this.get(t,r);yield[t,r,n],++r>=this.diagonalSize&&(r=++t)}}*upperRightValues(){for(let t=0,r=0;t<this.diagonalSize;void 0)yield this.get(t,r),++r>=this.diagonalSize&&(r=++t)}};tr=new WeakMap;let ii=Io;ii.prototype.klassType="SymmetricMatrix";class Do extends ii{static isDistanceMatrix(e){return ii.isSymmetricMatrix(e)&&e.klassSubType==="DistanceMatrix"}constructor(e){if(super(e),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(e,t,r){return e===t&&(r=0),super.set(e,t,r)}addCross(e,t){return t===void 0&&(t=e,e=this.diagonalSize),t=t.slice(),t[e]=0,super.addCross(e,t)}toSymmetricMatrix(){return new ii(this)}clone(){const e=new Do(this.diagonalSize);for(const[t,r,n]of this.upperRightEntries())t!==r&&e.set(t,r,n);return e}toCompact(){const{diagonalSize:e}=this,t=(e-1)*e/2,r=new Array(t);for(let n=1,i=0,a=0;a<r.length;a++)r[a]=this.get(i,n),++n>=e&&(n=++i+1);return r}static fromCompact(e){const t=e.length,r=(Math.sqrt(8*t+1)+1)/2;if(!Number.isInteger(r))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(e)}`);const n=new this(r);for(let i=1,a=0,u=0;u<t;u++)n.set(i,a,e[u]),++i>=r&&(i=++a+1);return n}}Do.prototype.klassSubType="DistanceMatrix";class xn extends ke{constructor(e,t,r){super(),this.matrix=e,this.rows=t,this.columns=r}}class Fy extends xn{constructor(e,t){Rr(e,t),super(e,e.rows,1),this.column=t}set(e,t,r){return this.matrix.set(e,this.column,r),this}get(e){return this.matrix.get(e,this.column)}}class By extends xn{constructor(e,t){Ja(e,t),super(e,e.rows,t.length),this.columnIndices=t}set(e,t,r){return this.matrix.set(e,this.columnIndices[t],r),this}get(e,t){return this.matrix.get(e,this.columnIndices[t])}}class My extends xn{constructor(e){super(e,e.rows,e.columns)}set(e,t,r){return this.matrix.set(e,this.columns-t-1,r),this}get(e,t){return this.matrix.get(e,this.columns-t-1)}}class Ny extends xn{constructor(e){super(e,e.rows,e.columns)}set(e,t,r){return this.matrix.set(this.rows-e-1,t,r),this}get(e,t){return this.matrix.get(this.rows-e-1,t)}}class Sy extends xn{constructor(e,t){$r(e,t),super(e,1,e.columns),this.row=t}set(e,t,r){return this.matrix.set(this.row,t,r),this}get(e,t){return this.matrix.get(this.row,t)}}class Oy extends xn{constructor(e,t){Qa(e,t),super(e,t.length,e.columns),this.rowIndices=t}set(e,t,r){return this.matrix.set(this.rowIndices[e],t,r),this}get(e,t){return this.matrix.get(this.rowIndices[e],t)}}class wo extends xn{constructor(e,t,r){Qa(e,t),Ja(e,r),super(e,t.length,r.length),this.rowIndices=t,this.columnIndices=r}set(e,t,r){return this.matrix.set(this.rowIndices[e],this.columnIndices[t],r),this}get(e,t){return this.matrix.get(this.rowIndices[e],this.columnIndices[t])}}class Ty extends xn{constructor(e,t,r,n,i){e0(e,t,r,n,i),super(e,r-t+1,i-n+1),this.startRow=t,this.startColumn=n}set(e,t,r){return this.matrix.set(this.startRow+e,this.startColumn+t,r),this}get(e,t){return this.matrix.get(this.startRow+e,this.startColumn+t)}}class Iy extends xn{constructor(e){super(e,e.columns,e.rows)}set(e,t,r){return this.matrix.set(t,e,r),this}get(e,t){return this.matrix.get(t,e)}}class Sl extends ke{constructor(e,t={}){const{rows:r=1}=t;if(e.length%r!==0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=r,this.columns=e.length/r,this.data=e}set(e,t,r){let n=this._calculateIndex(e,t);return this.data[n]=r,this}get(e,t){let r=this._calculateIndex(e,t);return this.data[r]}_calculateIndex(e,t){return e*this.columns+t}}class Ar extends ke{constructor(e){super(),this.data=e,this.rows=e.length,this.columns=e[0].length}set(e,t,r){return this.data[e][t]=r,this}get(e,t){return this.data[e][t]}}function $y(s,e){if(gr.isAnyArray(s))return s[0]&&gr.isAnyArray(s[0])?new Ar(s):new Sl(s,e);throw new Error("the argument is not an array")}class Eo{constructor(e){e=Ar.checkMatrix(e);let t=e.clone(),r=t.rows,n=t.columns,i=new Float64Array(r),a=1,u,l,c,h,d,p,v,x,_;for(u=0;u<r;u++)i[u]=u;for(x=new Float64Array(r),l=0;l<n;l++){for(u=0;u<r;u++)x[u]=t.get(u,l);for(u=0;u<r;u++){for(_=Math.min(u,l),d=0,c=0;c<_;c++)d+=t.get(u,c)*x[c];x[u]-=d,t.set(u,l,x[u])}for(h=l,u=l+1;u<r;u++)Math.abs(x[u])>Math.abs(x[h])&&(h=u);if(h!==l){for(c=0;c<n;c++)p=t.get(h,c),t.set(h,c,t.get(l,c)),t.set(l,c,p);v=i[h],i[h]=i[l],i[l]=v,a=-a}if(l<r&&t.get(l,l)!==0)for(u=l+1;u<r;u++)t.set(u,l,t.get(u,l)/t.get(l,l))}this.LU=t,this.pivotVector=i,this.pivotSign=a}isSingular(){let e=this.LU,t=e.columns;for(let r=0;r<t;r++)if(e.get(r,r)===0)return!0;return!1}solve(e){e=ve.checkMatrix(e);let t=this.LU;if(t.rows!==e.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let n=e.columns,i=e.subMatrixRow(this.pivotVector,0,n-1),a=t.columns,u,l,c;for(c=0;c<a;c++)for(u=c+1;u<a;u++)for(l=0;l<n;l++)i.set(u,l,i.get(u,l)-i.get(c,l)*t.get(u,c));for(c=a-1;c>=0;c--){for(l=0;l<n;l++)i.set(c,l,i.get(c,l)/t.get(c,c));for(u=0;u<c;u++)for(l=0;l<n;l++)i.set(u,l,i.get(u,l)-i.get(c,l)*t.get(u,c))}return i}get determinant(){let e=this.LU;if(!e.isSquare())throw new Error("Matrix must be square");let t=this.pivotSign,r=e.columns;for(let n=0;n<r;n++)t*=e.get(n,n);return t}get lowerTriangularMatrix(){let e=this.LU,t=e.rows,r=e.columns,n=new ve(t,r);for(let i=0;i<t;i++)for(let a=0;a<r;a++)i>a?n.set(i,a,e.get(i,a)):i===a?n.set(i,a,1):n.set(i,a,0);return n}get upperTriangularMatrix(){let e=this.LU,t=e.rows,r=e.columns,n=new ve(t,r);for(let i=0;i<t;i++)for(let a=0;a<r;a++)i<=a?n.set(i,a,e.get(i,a)):n.set(i,a,0);return n}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function yn(s,e){let t=0;return Math.abs(s)>Math.abs(e)?(t=e/s,Math.abs(s)*Math.sqrt(1+t*t)):e!==0?(t=s/e,Math.abs(e)*Math.sqrt(1+t*t)):0}class t0{constructor(e){e=Ar.checkMatrix(e);let t=e.clone(),r=e.rows,n=e.columns,i=new Float64Array(n),a,u,l,c;for(l=0;l<n;l++){let h=0;for(a=l;a<r;a++)h=yn(h,t.get(a,l));if(h!==0){for(t.get(l,l)<0&&(h=-h),a=l;a<r;a++)t.set(a,l,t.get(a,l)/h);for(t.set(l,l,t.get(l,l)+1),u=l+1;u<n;u++){for(c=0,a=l;a<r;a++)c+=t.get(a,l)*t.get(a,u);for(c=-c/t.get(l,l),a=l;a<r;a++)t.set(a,u,t.get(a,u)+c*t.get(a,l))}}i[l]=-h}this.QR=t,this.Rdiag=i}solve(e){e=ve.checkMatrix(e);let t=this.QR,r=t.rows;if(e.rows!==r)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let n=e.columns,i=e.clone(),a=t.columns,u,l,c,h;for(c=0;c<a;c++)for(l=0;l<n;l++){for(h=0,u=c;u<r;u++)h+=t.get(u,c)*i.get(u,l);for(h=-h/t.get(c,c),u=c;u<r;u++)i.set(u,l,i.get(u,l)+h*t.get(u,c))}for(c=a-1;c>=0;c--){for(l=0;l<n;l++)i.set(c,l,i.get(c,l)/this.Rdiag[c]);for(u=0;u<c;u++)for(l=0;l<n;l++)i.set(u,l,i.get(u,l)-i.get(c,l)*t.get(u,c))}return i.subMatrix(0,a-1,0,n-1)}isFullRank(){let e=this.QR.columns;for(let t=0;t<e;t++)if(this.Rdiag[t]===0)return!1;return!0}get upperTriangularMatrix(){let e=this.QR,t=e.columns,r=new ve(t,t),n,i;for(n=0;n<t;n++)for(i=0;i<t;i++)n<i?r.set(n,i,e.get(n,i)):n===i?r.set(n,i,this.Rdiag[n]):r.set(n,i,0);return r}get orthogonalMatrix(){let e=this.QR,t=e.rows,r=e.columns,n=new ve(t,r),i,a,u,l;for(u=r-1;u>=0;u--){for(i=0;i<t;i++)n.set(i,u,0);for(n.set(u,u,1),a=u;a<r;a++)if(e.get(u,u)!==0){for(l=0,i=u;i<t;i++)l+=e.get(i,u)*n.get(i,a);for(l=-l/e.get(u,u),i=u;i<t;i++)n.set(i,a,n.get(i,a)+l*e.get(i,u))}}return n}}class Oi{constructor(e,t={}){if(e=Ar.checkMatrix(e),e.isEmpty())throw new Error("Matrix must be non-empty");let r=e.rows,n=e.columns;const{computeLeftSingularVectors:i=!0,computeRightSingularVectors:a=!0,autoTranspose:u=!1}=t;let l=!!i,c=!!a,h=!1,d;if(r<n)if(!u)d=e.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else{d=e.transpose(),r=d.rows,n=d.columns,h=!0;let A=l;l=c,c=A}else d=e.clone();let p=Math.min(r,n),v=Math.min(r+1,n),x=new Float64Array(v),_=new ve(r,p),y=new ve(n,n),m=new Float64Array(n),w=new Float64Array(r),D=new Float64Array(v);for(let A=0;A<v;A++)D[A]=A;let C=Math.min(r-1,n),E=Math.max(0,Math.min(n-2,r)),F=Math.max(C,E);for(let A=0;A<F;A++){if(A<C){x[A]=0;for(let N=A;N<r;N++)x[A]=yn(x[A],d.get(N,A));if(x[A]!==0){d.get(A,A)<0&&(x[A]=-x[A]);for(let N=A;N<r;N++)d.set(N,A,d.get(N,A)/x[A]);d.set(A,A,d.get(A,A)+1)}x[A]=-x[A]}for(let N=A+1;N<n;N++){if(A<C&&x[A]!==0){let T=0;for(let R=A;R<r;R++)T+=d.get(R,A)*d.get(R,N);T=-T/d.get(A,A);for(let R=A;R<r;R++)d.set(R,N,d.get(R,N)+T*d.get(R,A))}m[N]=d.get(A,N)}if(l&&A<C)for(let N=A;N<r;N++)_.set(N,A,d.get(N,A));if(A<E){m[A]=0;for(let N=A+1;N<n;N++)m[A]=yn(m[A],m[N]);if(m[A]!==0){m[A+1]<0&&(m[A]=0-m[A]);for(let N=A+1;N<n;N++)m[N]/=m[A];m[A+1]+=1}if(m[A]=-m[A],A+1<r&&m[A]!==0){for(let N=A+1;N<r;N++)w[N]=0;for(let N=A+1;N<r;N++)for(let T=A+1;T<n;T++)w[N]+=m[T]*d.get(N,T);for(let N=A+1;N<n;N++){let T=-m[N]/m[A+1];for(let R=A+1;R<r;R++)d.set(R,N,d.get(R,N)+T*w[R])}}if(c)for(let N=A+1;N<n;N++)y.set(N,A,m[N])}}let B=Math.min(n,r+1);if(C<n&&(x[C]=d.get(C,C)),r<B&&(x[B-1]=0),E+1<B&&(m[E]=d.get(E,B-1)),m[B-1]=0,l){for(let A=C;A<p;A++){for(let N=0;N<r;N++)_.set(N,A,0);_.set(A,A,1)}for(let A=C-1;A>=0;A--)if(x[A]!==0){for(let N=A+1;N<p;N++){let T=0;for(let R=A;R<r;R++)T+=_.get(R,A)*_.get(R,N);T=-T/_.get(A,A);for(let R=A;R<r;R++)_.set(R,N,_.get(R,N)+T*_.get(R,A))}for(let N=A;N<r;N++)_.set(N,A,-_.get(N,A));_.set(A,A,1+_.get(A,A));for(let N=0;N<A-1;N++)_.set(N,A,0)}else{for(let N=0;N<r;N++)_.set(N,A,0);_.set(A,A,1)}}if(c)for(let A=n-1;A>=0;A--){if(A<E&&m[A]!==0)for(let N=A+1;N<n;N++){let T=0;for(let R=A+1;R<n;R++)T+=y.get(R,A)*y.get(R,N);T=-T/y.get(A+1,A);for(let R=A+1;R<n;R++)y.set(R,N,y.get(R,N)+T*y.get(R,A))}for(let N=0;N<n;N++)y.set(N,A,0);y.set(A,A,1)}let M=B-1,O=Number.EPSILON;for(;B>0;){let A,N;for(A=B-2;A>=-1&&A!==-1;A--){const T=Number.MIN_VALUE+O*Math.abs(x[A]+Math.abs(x[A+1]));if(Math.abs(m[A])<=T||Number.isNaN(m[A])){m[A]=0;break}}if(A===B-2)N=4;else{let T;for(T=B-1;T>=A&&T!==A;T--){let R=(T!==B?Math.abs(m[T]):0)+(T!==A+1?Math.abs(m[T-1]):0);if(Math.abs(x[T])<=O*R){x[T]=0;break}}T===A?N=3:T===B-1?N=1:(N=2,A=T)}switch(A++,N){case 1:{let T=m[B-2];m[B-2]=0;for(let R=B-2;R>=A;R--){let k=yn(x[R],T),z=x[R]/k,L=T/k;if(x[R]=k,R!==A&&(T=-L*m[R-1],m[R-1]=z*m[R-1]),c)for(let G=0;G<n;G++)k=z*y.get(G,R)+L*y.get(G,B-1),y.set(G,B-1,-L*y.get(G,R)+z*y.get(G,B-1)),y.set(G,R,k)}break}case 2:{let T=m[A-1];m[A-1]=0;for(let R=A;R<B;R++){let k=yn(x[R],T),z=x[R]/k,L=T/k;if(x[R]=k,T=-L*m[R],m[R]=z*m[R],l)for(let G=0;G<r;G++)k=z*_.get(G,R)+L*_.get(G,A-1),_.set(G,A-1,-L*_.get(G,R)+z*_.get(G,A-1)),_.set(G,R,k)}break}case 3:{const T=Math.max(Math.abs(x[B-1]),Math.abs(x[B-2]),Math.abs(m[B-2]),Math.abs(x[A]),Math.abs(m[A])),R=x[B-1]/T,k=x[B-2]/T,z=m[B-2]/T,L=x[A]/T,G=m[A]/T,H=((k+R)*(k-R)+z*z)/2,ee=R*z*(R*z);let te=0;(H!==0||ee!==0)&&(H<0?te=0-Math.sqrt(H*H+ee):te=Math.sqrt(H*H+ee),te=ee/(H+te));let j=(L+R)*(L-R)+te,X=L*G;for(let Y=A;Y<B-1;Y++){let Q=yn(j,X);Q===0&&(Q=Number.MIN_VALUE);let pe=j/Q,De=X/Q;if(Y!==A&&(m[Y-1]=Q),j=pe*x[Y]+De*m[Y],m[Y]=pe*m[Y]-De*x[Y],X=De*x[Y+1],x[Y+1]=pe*x[Y+1],c)for(let we=0;we<n;we++)Q=pe*y.get(we,Y)+De*y.get(we,Y+1),y.set(we,Y+1,-De*y.get(we,Y)+pe*y.get(we,Y+1)),y.set(we,Y,Q);if(Q=yn(j,X),Q===0&&(Q=Number.MIN_VALUE),pe=j/Q,De=X/Q,x[Y]=Q,j=pe*m[Y]+De*x[Y+1],x[Y+1]=-De*m[Y]+pe*x[Y+1],X=De*m[Y+1],m[Y+1]=pe*m[Y+1],l&&Y<r-1)for(let we=0;we<r;we++)Q=pe*_.get(we,Y)+De*_.get(we,Y+1),_.set(we,Y+1,-De*_.get(we,Y)+pe*_.get(we,Y+1)),_.set(we,Y,Q)}m[B-2]=j;break}case 4:{if(x[A]<=0&&(x[A]=x[A]<0?-x[A]:0,c))for(let T=0;T<=M;T++)y.set(T,A,-y.get(T,A));for(;A<M&&!(x[A]>=x[A+1]);){let T=x[A];if(x[A]=x[A+1],x[A+1]=T,c&&A<n-1)for(let R=0;R<n;R++)T=y.get(R,A+1),y.set(R,A+1,y.get(R,A)),y.set(R,A,T);if(l&&A<r-1)for(let R=0;R<r;R++)T=_.get(R,A+1),_.set(R,A+1,_.get(R,A)),_.set(R,A,T);A++}B--;break}}}if(h){let A=y;y=_,_=A}this.m=r,this.n=n,this.s=x,this.U=_,this.V=y}solve(e){let t=e,r=this.threshold,n=this.s.length,i=ve.zeros(n,n);for(let p=0;p<n;p++)Math.abs(this.s[p])<=r?i.set(p,p,0):i.set(p,p,1/this.s[p]);let a=this.U,u=this.rightSingularVectors,l=u.mmul(i),c=u.rows,h=a.rows,d=ve.zeros(c,h);for(let p=0;p<c;p++)for(let v=0;v<h;v++){let x=0;for(let _=0;_<n;_++)x+=l.get(p,_)*a.get(v,_);d.set(p,v,x)}return d.mmul(t)}solveForDiagonal(e){return this.solve(ve.diag(e))}inverse(){let e=this.V,t=this.threshold,r=e.rows,n=e.columns,i=new ve(r,this.s.length);for(let h=0;h<r;h++)for(let d=0;d<n;d++)Math.abs(this.s[d])>t&&i.set(h,d,e.get(h,d)/this.s[d]);let a=this.U,u=a.rows,l=a.columns,c=new ve(r,u);for(let h=0;h<r;h++)for(let d=0;d<u;d++){let p=0;for(let v=0;v<l;v++)p+=i.get(h,v)*a.get(d,v);c.set(h,d,p)}return c}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let e=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,t=0,r=this.s;for(let n=0,i=r.length;n<i;n++)r[n]>e&&t++;return t}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 ve.diag(this.s)}}function Ry(s,e=!1){return s=Ar.checkMatrix(s),e?new Oi(s).inverse():Ol(s,ve.eye(s.rows))}function Ol(s,e,t=!1){return s=Ar.checkMatrix(s),e=Ar.checkMatrix(e),t?new Oi(s).solve(e):s.isSquare()?new Eo(s).solve(e):new t0(s).solve(e)}function bo(s){if(s=ve.checkMatrix(s),s.isSquare()){if(s.columns===0)return 1;let e,t,r,n;if(s.columns===2)return e=s.get(0,0),t=s.get(0,1),r=s.get(1,0),n=s.get(1,1),e*n-t*r;if(s.columns===3){let i,a,u;return i=new wo(s,[1,2],[1,2]),a=new wo(s,[1,2],[0,2]),u=new wo(s,[1,2],[0,1]),e=s.get(0,0),t=s.get(0,1),r=s.get(0,2),e*bo(i)-t*bo(a)+r*bo(u)}else return new Eo(s).determinant}else throw Error("determinant can only be calculated for a square matrix")}function Ly(s,e){let t=[];for(let r=0;r<s;r++)r!==e&&t.push(r);return t}function Py(s,e,t,r=1e-9,n=1e-9){if(s>n)return new Array(e.rows+1).fill(0);{let i=e.addRow(t,[0]);for(let a=0;a<i.rows;a++)Math.abs(i.get(a,0))<r&&i.set(a,0,0);return i.to1DArray()}}function ky(s,e={}){const{thresholdValue:t=1e-9,thresholdError:r=1e-9}=e;s=ve.checkMatrix(s);let n=s.rows,i=new ve(n,n);for(let a=0;a<n;a++){let u=ve.columnVector(s.getRow(a)),l=s.subMatrixRow(Ly(n,a)).transpose(),h=new Oi(l).solve(u),d=ve.sub(u,l.mmul(h)).abs().max();i.setRow(a,Py(d,h,a,t,r))}return i}function zy(s,e=Number.EPSILON){if(s=ve.checkMatrix(s),s.isEmpty())return s.transpose();let t=new Oi(s,{autoTranspose:!0}),r=t.leftSingularVectors,n=t.rightSingularVectors,i=t.diagonal;for(let a=0;a<i.length;a++)Math.abs(i[a])>e?i[a]=1/i[a]:i[a]=0;return n.mmul(ve.diag(i).mmul(r.transpose()))}function qy(s,e=s,t={}){s=new ve(s);let r=!1;if(typeof e=="object"&&!ve.isMatrix(e)&&!gr.isAnyArray(e)?(t=e,e=s,r=!0):e=new ve(e),s.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:n=!0}=t;n&&(s=s.center("column"),r||(e=e.center("column")));const i=s.transpose().mmul(e);for(let a=0;a<i.rows;a++)for(let u=0;u<i.columns;u++)i.set(a,u,i.get(a,u)*(1/(s.rows-1)));return i}function Uy(s,e=s,t={}){s=new ve(s);let r=!1;if(typeof e=="object"&&!ve.isMatrix(e)&&!gr.isAnyArray(e)?(t=e,e=s,r=!0):e=new ve(e),s.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:n=!0,scale:i=!0}=t;n&&(s.center("column"),r||e.center("column")),i&&(s.scale("column"),r||e.scale("column"));const a=s.standardDeviation("column",{unbiased:!0}),u=r?a:e.standardDeviation("column",{unbiased:!0}),l=s.transpose().mmul(e);for(let c=0;c<l.rows;c++)for(let h=0;h<l.columns;h++)l.set(c,h,l.get(c,h)*(1/(a[c]*u[h]))*(1/(s.rows-1)));return l}let Tl=class{constructor(e,t={}){const{assumeSymmetric:r=!1}=t;if(e=Ar.checkMatrix(e),!e.isSquare())throw new Error("Matrix is not a square matrix");if(e.isEmpty())throw new Error("Matrix must be non-empty");let n=e.columns,i=new ve(n,n),a=new Float64Array(n),u=new Float64Array(n),l=e,c,h,d=!1;if(r?d=!0:d=e.isSymmetric(),d){for(c=0;c<n;c++)for(h=0;h<n;h++)i.set(c,h,l.get(c,h));Wy(n,u,a,i),Hy(n,u,a,i)}else{let p=new ve(n,n),v=new Float64Array(n);for(h=0;h<n;h++)for(c=0;c<n;c++)p.set(c,h,l.get(c,h));jy(n,p,v,i),Yy(n,u,a,i,p)}this.n=n,this.e=u,this.d=a,this.V=i}get realEigenvalues(){return Array.from(this.d)}get imaginaryEigenvalues(){return Array.from(this.e)}get eigenvectorMatrix(){return this.V}get diagonalMatrix(){let e=this.n,t=this.e,r=this.d,n=new ve(e,e),i,a;for(i=0;i<e;i++){for(a=0;a<e;a++)n.set(i,a,0);n.set(i,i,r[i]),t[i]>0?n.set(i,i+1,t[i]):t[i]<0&&n.set(i,i-1,t[i])}return n}};function Wy(s,e,t,r){let n,i,a,u,l,c,h,d;for(l=0;l<s;l++)t[l]=r.get(s-1,l);for(u=s-1;u>0;u--){for(d=0,a=0,c=0;c<u;c++)d=d+Math.abs(t[c]);if(d===0)for(e[u]=t[u-1],l=0;l<u;l++)t[l]=r.get(u-1,l),r.set(u,l,0),r.set(l,u,0);else{for(c=0;c<u;c++)t[c]/=d,a+=t[c]*t[c];for(n=t[u-1],i=Math.sqrt(a),n>0&&(i=-i),e[u]=d*i,a=a-n*i,t[u-1]=n-i,l=0;l<u;l++)e[l]=0;for(l=0;l<u;l++){for(n=t[l],r.set(l,u,n),i=e[l]+r.get(l,l)*n,c=l+1;c<=u-1;c++)i+=r.get(c,l)*t[c],e[c]+=r.get(c,l)*n;e[l]=i}for(n=0,l=0;l<u;l++)e[l]/=a,n+=e[l]*t[l];for(h=n/(a+a),l=0;l<u;l++)e[l]-=h*t[l];for(l=0;l<u;l++){for(n=t[l],i=e[l],c=l;c<=u-1;c++)r.set(c,l,r.get(c,l)-(n*e[c]+i*t[c]));t[l]=r.get(u-1,l),r.set(u,l,0)}}t[u]=a}for(u=0;u<s-1;u++){if(r.set(s-1,u,r.get(u,u)),r.set(u,u,1),a=t[u+1],a!==0){for(c=0;c<=u;c++)t[c]=r.get(c,u+1)/a;for(l=0;l<=u;l++){for(i=0,c=0;c<=u;c++)i+=r.get(c,u+1)*r.get(c,l);for(c=0;c<=u;c++)r.set(c,l,r.get(c,l)-i*t[c])}}for(c=0;c<=u;c++)r.set(c,u+1,0)}for(l=0;l<s;l++)t[l]=r.get(s-1,l),r.set(s-1,l,0);r.set(s-1,s-1,1),e[0]=0}function Hy(s,e,t,r){let n,i,a,u,l,c,h,d,p,v,x,_,y,m,w,D;for(a=1;a<s;a++)e[a-1]=e[a];e[s-1]=0;let C=0,E=0,F=Number.EPSILON;for(c=0;c<s;c++){for(E=Math.max(E,Math.abs(t[c])+Math.abs(e[c])),h=c;h<s&&!(Math.abs(e[h])<=F*E);)h++;if(h>c)do{for(n=t[c],d=(t[c+1]-n)/(2*e[c]),p=yn(d,1),d<0&&(p=-p),t[c]=e[c]/(d+p),t[c+1]=e[c]*(d+p),v=t[c+1],i=n-t[c],a=c+2;a<s;a++)t[a]-=i;for(C=C+i,d=t[h],x=1,_=x,y=x,m=e[c+1],w=0,D=0,a=h-1;a>=c;a--)for(y=_,_=x,D=w,n=x*e[a],i=x*d,p=yn(d,e[a]),e[a+1]=w*p,w=e[a]/p,x=d/p,d=x*t[a]-w*n,t[a+1]=i+w*(x*n+w*t[a]),l=0;l<s;l++)i=r.get(l,a+1),r.set(l,a+1,w*r.get(l,a)+x*i),r.set(l,a,x*r.get(l,a)-w*i);d=-w*D*y*m*e[c]/v,e[c]=w*d,t[c]=x*d}while(Math.abs(e[c])>F*E);t[c]=t[c]+C,e[c]=0}for(a=0;a<s-1;a++){for(l=a,d=t[a],u=a+1;u<s;u++)t[u]<d&&(l=u,d=t[u]);if(l!==a)for(t[l]=t[a],t[a]=d,u=0;u<s;u++)d=r.get(u,a),r.set(u,a,r.get(u,l)),r.set(u,l,d)}}function jy(s,e,t,r){let n=0,i=s-1,a,u,l,c,h,d,p;for(d=n+1;d<=i-1;d++){for(p=0,c=d;c<=i;c++)p=p+Math.abs(e.get(c,d-1));if(p!==0){for(l=0,c=i;c>=d;c--)t[c]=e.get(c,d-1)/p,l+=t[c]*t[c];for(u=Math.sqrt(l),t[d]>0&&(u=-u),l=l-t[d]*u,t[d]=t[d]-u,h=d;h<s;h++){for(a=0,c=i;c>=d;c--)a+=t[c]*e.get(c,h);for(a=a/l,c=d;c<=i;c++)e.set(c,h,e.get(c,h)-a*t[c])}for(c=0;c<=i;c++){for(a=0,h=i;h>=d;h--)a+=t[h]*e.get(c,h);for(a=a/l,h=d;h<=i;h++)e.set(c,h,e.get(c,h)-a*t[h])}t[d]=p*t[d],e.set(d,d-1,p*u)}}for(c=0;c<s;c++)for(h=0;h<s;h++)r.set(c,h,c===h?1:0);for(d=i-1;d>=n+1;d--)if(e.get(d,d-1)!==0){for(c=d+1;c<=i;c++)t[c]=e.get(c,d-1);for(h=d;h<=i;h++){for(u=0,c=d;c<=i;c++)u+=t[c]*r.get(c,h);for(u=u/t[d]/e.get(d,d-1),c=d;c<=i;c++)r.set(c,h,r.get(c,h)+u*t[c])}}}function Yy(s,e,t,r,n){let i=s-1,a=0,u=s-1,l=Number.EPSILON,c=0,h=0,d=0,p=0,v=0,x=0,_=0,y=0,m,w,D,C,E,F,B,M,O,A,N,T,R,k,z;for(m=0;m<s;m++)for((m<a||m>u)&&(t[m]=n.get(m,m),e[m]=0),w=Math.max(m-1,0);w<s;w++)h=h+Math.abs(n.get(m,w));for(;i>=a;){for(C=i;C>a&&(x=Math.abs(n.get(C-1,C-1))+Math.abs(n.get(C,C)),x===0&&(x=h),!(Math.abs(n.get(C,C-1))<l*x));)C--;if(C===i)n.set(i,i,n.get(i,i)+c),t[i]=n.get(i,i),e[i]=0,i--,y=0;else if(C===i-1){if(B=n.get(i,i-1)*n.get(i-1,i),d=(n.get(i-1,i-1)-n.get(i,i))/2,p=d*d+B,_=Math.sqrt(Math.abs(p)),n.set(i,i,n.get(i,i)+c),n.set(i-1,i-1,n.get(i-1,i-1)+c),M=n.get(i,i),p>=0){for(_=d>=0?d+_:d-_,t[i-1]=M+_,t[i]=t[i-1],_!==0&&(t[i]=M-B/_),e[i-1]=0,e[i]=0,M=n.get(i,i-1),x=Math.abs(M)+Math.abs(_),d=M/x,p=_/x,v=Math.sqrt(d*d+p*p),d=d/v,p=p/v,w=i-1;w<s;w++)_=n.get(i-1,w),n.set(i-1,w,p*_+d*n.get(i,w)),n.set(i,w,p*n.get(i,w)-d*_);for(m=0;m<=i;m++)_=n.get(m,i-1),n.set(m,i-1,p*_+d*n.get(m,i)),n.set(m,i,p*n.get(m,i)-d*_);for(m=a;m<=u;m++)_=r.get(m,i-1),r.set(m,i-1,p*_+d*r.get(m,i)),r.set(m,i,p*r.get(m,i)-d*_)}else t[i-1]=M+d,t[i]=M+d,e[i-1]=_,e[i]=-_;i=i-2,y=0}else{if(M=n.get(i,i),O=0,B=0,C<i&&(O=n.get(i-1,i-1),B=n.get(i,i-1)*n.get(i-1,i)),y===10){for(c+=M,m=a;m<=i;m++)n.set(m,m,n.get(m,m)-M);x=Math.abs(n.get(i,i-1))+Math.abs(n.get(i-1,i-2)),M=O=.75*x,B=-.4375*x*x}if(y===30&&(x=(O-M)/2,x=x*x+B,x>0)){for(x=Math.sqrt(x),O<M&&(x=-x),x=M-B/((O-M)/2+x),m=a;m<=i;m++)n.set(m,m,n.get(m,m)-x);c+=x,M=O=B=.964}for(y=y+1,E=i-2;E>=C&&(_=n.get(E,E),v=M-_,x=O-_,d=(v*x-B)/n.get(E+1,E)+n.get(E,E+1),p=n.get(E+1,E+1)-_-v-x,v=n.get(E+2,E+1),x=Math.abs(d)+Math.abs(p)+Math.abs(v),d=d/x,p=p/x,v=v/x,!(E===C||Math.abs(n.get(E,E-1))*(Math.abs(p)+Math.abs(v))<l*(Math.abs(d)*(Math.abs(n.get(E-1,E-1))+Math.abs(_)+Math.abs(n.get(E+1,E+1))))));)E--;for(m=E+2;m<=i;m++)n.set(m,m-2,0),m>E+2&&n.set(m,m-3,0);for(D=E;D<=i-1&&(k=D!==i-1,D!==E&&(d=n.get(D,D-1),p=n.get(D+1,D-1),v=k?n.get(D+2,D-1):0,M=Math.abs(d)+Math.abs(p)+Math.abs(v),M!==0&&(d=d/M,p=p/M,v=v/M)),M!==0);D++)if(x=Math.sqrt(d*d+p*p+v*v),d<0&&(x=-x),x!==0){for(D!==E?n.set(D,D-1,-x*M):C!==E&&n.set(D,D-1,-n.get(D,D-1)),d=d+x,M=d/x,O=p/x,_=v/x,p=p/d,v=v/d,w=D;w<s;w++)d=n.get(D,w)+p*n.get(D+1,w),k&&(d=d+v*n.get(D+2,w),n.set(D+2,w,n.get(D+2,w)-d*_)),n.set(D,w,n.get(D,w)-d*M),n.set(D+1,w,n.get(D+1,w)-d*O);for(m=0;m<=Math.min(i,D+3);m++)d=M*n.get(m,D)+O*n.get(m,D+1),k&&(d=d+_*n.get(m,D+2),n.set(m,D+2,n.get(m,D+2)-d*v)),n.set(m,D,n.get(m,D)-d),n.set(m,D+1,n.get(m,D+1)-d*p);for(m=a;m<=u;m++)d=M*r.get(m,D)+O*r.get(m,D+1),k&&(d=d+_*r.get(m,D+2),r.set(m,D+2,r.get(m,D+2)-d*v)),r.set(m,D,r.get(m,D)-d),r.set(m,D+1,r.get(m,D+1)-d*p)}}}if(h!==0){for(i=s-1;i>=0;i--)if(d=t[i],p=e[i],p===0)for(C=i,n.set(i,i,1),m=i-1;m>=0;m--){for(B=n.get(m,m)-d,v=0,w=C;w<=i;w++)v=v+n.get(m,w)*n.get(w,i);if(e[m]<0)_=B,x=v;else if(C=m,e[m]===0?n.set(m,i,B!==0?-v/B:-v/(l*h)):(M=n.get(m,m+1),O=n.get(m+1,m),p=(t[m]-d)*(t[m]-d)+e[m]*e[m],F=(M*x-_*v)/p,n.set(m,i,F),n.set(m+1,i,Math.abs(M)>Math.abs(_)?(-v-B*F)/M:(-x-O*F)/_)),F=Math.abs(n.get(m,i)),l*F*F>1)for(w=m;w<=i;w++)n.set(w,i,n.get(w,i)/F)}else if(p<0)for(C=i-1,Math.abs(n.get(i,i-1))>Math.abs(n.get(i-1,i))?(n.set(i-1,i-1,p/n.get(i,i-1)),n.set(i-1,i,-(n.get(i,i)-d)/n.get(i,i-1))):(z=Ao(0,-n.get(i-1,i),n.get(i-1,i-1)-d,p),n.set(i-1,i-1,z[0]),n.set(i-1,i,z[1])),n.set(i,i-1,0),n.set(i,i,1),m=i-2;m>=0;m--){for(A=0,N=0,w=C;w<=i;w++)A=A+n.get(m,w)*n.get(w,i-1),N=N+n.get(m,w)*n.get(w,i);if(B=n.get(m,m)-d,e[m]<0)_=B,v=A,x=N;else if(C=m,e[m]===0?(z=Ao(-A,-N,B,p),n.set(m,i-1,z[0]),n.set(m,i,z[1])):(M=n.get(m,m+1),O=n.get(m+1,m),T=(t[m]-d)*(t[m]-d)+e[m]*e[m]-p*p,R=(t[m]-d)*2*p,T===0&&R===0&&(T=l*h*(Math.abs(B)+Math.abs(p)+Math.abs(M)+Math.abs(O)+Math.abs(_))),z=Ao(M*v-_*A+p*N,M*x-_*N-p*A,T,R),n.set(m,i-1,z[0]),n.set(m,i,z[1]),Math.abs(M)>Math.abs(_)+Math.abs(p)?(n.set(m+1,i-1,(-A-B*n.get(m,i-1)+p*n.get(m,i))/M),n.set(m+1,i,(-N-B*n.get(m,i)-p*n.get(m,i-1))/M)):(z=Ao(-v-O*n.get(m,i-1),-x-O*n.get(m,i),_,p),n.set(m+1,i-1,z[0]),n.set(m+1,i,z[1]))),F=Math.max(Math.abs(n.get(m,i-1)),Math.abs(n.get(m,i))),l*F*F>1)for(w=m;w<=i;w++)n.set(w,i-1,n.get(w,i-1)/F),n.set(w,i,n.get(w,i)/F)}for(m=0;m<s;m++)if(m<a||m>u)for(w=m;w<s;w++)r.set(m,w,n.get(m,w));for(w=s-1;w>=a;w--)for(m=a;m<=u;m++){for(_=0,D=a;D<=Math.min(w,u);D++)_=_+r.get(m,D)*n.get(D,w);r.set(m,w,_)}}}function Ao(s,e,t,r){let n,i;return Math.abs(t)>Math.abs(r)?(n=r/t,i=t+n*r,[(s+n*e)/i,(e-n*s)/i]):(n=t/r,i=r+n*t,[(n*s+e)/i,(n*e-s)/i])}class Il{constructor(e){if(e=Ar.checkMatrix(e),!e.isSymmetric())throw new Error("Matrix is not symmetric");let t=e,r=t.rows,n=new ve(r,r),i=!0,a,u,l;for(u=0;u<r;u++){let c=0;for(l=0;l<u;l++){let h=0;for(a=0;a<l;a++)h+=n.get(l,a)*n.get(u,a);h=(t.get(u,l)-h)/n.get(l,l),n.set(u,l,h),c=c+h*h}for(c=t.get(u,u)-c,i&=c>0,n.set(u,u,Math.sqrt(Math.max(c,0))),l=u+1;l<r;l++)n.set(u,l,0)}this.L=n,this.positiveDefinite=!!i}isPositiveDefinite(){return this.positiveDefinite}solve(e){e=Ar.checkMatrix(e);let t=this.L,r=t.rows;if(e.rows!==r)throw new Error("Matrix dimensions do not match");if(this.isPositiveDefinite()===!1)throw new Error("Matrix is not positive definite");let n=e.columns,i=e.clone(),a,u,l;for(l=0;l<r;l++)for(u=0;u<n;u++){for(a=0;a<l;a++)i.set(l,u,i.get(l,u)-i.get(a,u)*t.get(l,a));i.set(l,u,i.get(l,u)/t.get(l,l))}for(l=r-1;l>=0;l--)for(u=0;u<n;u++){for(a=l+1;a<r;a++)i.set(l,u,i.get(l,u)-i.get(a,u)*t.get(a,l));i.set(l,u,i.get(l,u)/t.get(l,l))}return i}get lowerTriangularMatrix(){return this.L}}class $l{constructor(e,t={}){e=Ar.checkMatrix(e);let{Y:r}=t;const{scaleScores:n=!1,maxIterations:i=1e3,terminationCriteria:a=1e-10}=t;let u;if(r){if(gr.isAnyArray(r)&&typeof r[0]=="number"?r=ve.columnVector(r):r=Ar.checkMatrix(r),r.rows!==e.rows)throw new Error("Y should have the same number of rows as X");u=r.getColumnVector(0)}else u=e.getColumnVector(0);let l=1,c,h,d,p;for(let v=0;v<i&&l>a;v++)d=e.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0)),d=d.div(d.norm()),c=e.mmul(d).div(d.transpose().mmul(d).get(0,0)),v>0&&(l=c.clone().sub(p).pow(2).sum()),p=c.clone(),r?(h=r.transpose().mmul(c).div(c.transpose().mmul(c).get(0,0)),h=h.div(h.norm()),u=r.mmul(h).div(h.transpose().mmul(h).get(0,0))):u=c;if(r){let v=e.transpose().mmul(c).div(c.transpose().mmul(c).get(0,0));v=v.div(v.norm());let x=e.clone().sub(c.clone().mmul(v.transpose())),_=u.transpose().mmul(c).div(c.transpose().mmul(c).get(0,0)),y=r.clone().sub(c.clone().mulS(_.get(0,0)).mmul(h.transpose()));this.t=c,this.p=v.transpose(),this.w=d.transpose(),this.q=h,this.u=u,this.s=c.transpose().mmul(c),this.xResidual=x,this.yResidual=y,this.betas=_}else this.w=d.transpose(),this.s=c.transpose().mmul(c).sqrt(),n?this.t=c.clone().div(this.s.get(0,0)):this.t=c,this.xResidual=e.sub(c.mmul(d.transpose()))}}We.AbstractMatrix=ke,We.CHO=Il,We.CholeskyDecomposition=Il,We.DistanceMatrix=Do,We.EVD=Tl;var Zy=We.EigenvalueDecomposition=Tl;We.LU=Eo,We.LuDecomposition=Eo;var Rl=We.Matrix=ve;We.MatrixColumnSelectionView=By,We.MatrixColumnView=Fy,We.MatrixFlipColumnView=My,We.MatrixFlipRowView=Ny,We.MatrixRowSelectionView=Oy,We.MatrixRowView=Sy,We.MatrixSelectionView=wo,We.MatrixSubView=Ty,We.MatrixTransposeView=Iy,We.NIPALS=$l,We.Nipals=$l,We.QR=t0,We.QrDecomposition=t0,We.SVD=Oi,We.SingularValueDecomposition=Oi,We.SymmetricMatrix=ii,We.WrapperMatrix1D=Sl,We.WrapperMatrix2D=Ar,We.correlation=Uy,We.covariance=qy;var Ll=We.default=ve;We.determinant=bo,We.inverse=Ry,We.linearDependencies=ky,We.pseudoInverse=zy,We.solve=Ol,We.wrap=$y;const Pl=Zy,kl=Rl;Ll.Matrix&&Ll.Matrix;class Vy{constructor(e){U(this,"_errorListener");this._errorListener=e}new({rows:e,columns:t,initial_value:r}={}){return new r0(e,t,r,this._errorListener)}avg({id:e}){return e==null?void 0:e.avg()}col({id:e,column:t}){return e==null?void 0:e.col({column:t})}det({id:e}){return e==null?void 0:e.det()}get({id:e,row:t,column:r}){return e==null?void 0:e.get({row:t,column:r})}inv({id:e}){return e==null?void 0:e.inv()}max({id:e}){return e==null?void 0:e.max()}min({id:e}){return e==null?void 0:e.min()}pow({id:e,power:t}){return e==null?void 0:e.pow({power:t})}row({id:e,row:t}){return e==null?void 0:e.row({row:t})}set({id:e,row:t,column:r,value:n}){e==null||e.set({row:t,column:r,value:n})}sum({id1:e,id2:t}){return e==null?void 0:e.sum({id2:t})}copy({id:e}){return e==null?void 0:e.copy()}diff({id1:e,id2:t}){return e==null?void 0:e.diff({id2:t})}rows({id:e}){return e==null?void 0:e.rows()}columns({id:e}){return e==null?void 0:e.columns()}fill({id:e,value:t,from_row:r,to_row:n,from_column:i,to_column:a}){e==null||e.fill({value:t,from_row:r,to_row:n,from_column:i,to_column:a})}kron({id1:e,id2:t}){return e==null?void 0:e.kron({id2:t})}mode({id:e}){return e==null?void 0:e.mode()}mult({id1:e,id2:t}){return e==null?void 0:e.mult({id2:t})}pinv({id:e}){return e==null?void 0:e.pinv()}rank({id:e}){return e==null?void 0:e.rank()}sort({id:e,column:t,order:r}){e==null||e.sort({column:t,order:r})}trace({id:e}){return e==null?void 0:e.trace()}concat({id1:e,id2:t}){return e==null?void 0:e.concat({id2:t})}median({id:e}){return e==null?void 0:e.median()}add_col({id:e,column:t,array_id:r}){e==null||e.add_col({column:t,array_id:r})}add_row({id:e,row:t,array_id:r}){e==null||e.add_row({row:t,array_id:r})}is_zero({id:e}){return e==null?void 0:e.is_zero()}reshape({id:e,rows:t,columns:r},n){return e==null?void 0:e.reshape({rows:t,columns:r},n)}reverse({id:e}){e==null||e.reverse()}is_binary({id:e}){return e==null?void 0:e.is_binary()}is_square({id:e}){return e==null?void 0:e.is_square()}submatrix({id:e,from_row:t,to_row:r,from_column:n,to_column:i}){return e==null?void 0:e.submatrix({from_row:t,to_row:r,from_column:n,to_column:i})}swap_rows({id:e,row1:t,row2:r}){e==null||e.swap_rows({row1:t,row2:r})}transpose({id:e}){return e==null?void 0:e.transpose()}remove_col({id:e,column:t}){return e==null?void 0:e.remove_col({column:t})}remove_row({id:e,row:t}){return e==null?void 0:e.remove_row({row:t})}eigenvalues({id:e}){return e==null?void 0:e.eigenvalues()}is_diagonal({id:e}){return e==null?void 0:e.is_diagonal()}is_identity({id:e}){return e==null?void 0:e.is_identity()}eigenvectors({id:e}){return e==null?void 0:e.eigenvectors()}is_symmetric({id:e}){return e==null?void 0:e.is_symmetric()}swap_columns({id:e,column1:t,column2:r}){e==null||e.swap_columns({column1:t,column2:r})}is_stochastic({id:e}){return e==null?void 0:e.is_stochastic()}is_triangular({id:e}){return e==null?void 0:e.is_triangular()}elements_count({id:e}){return e==null?void 0:e.elements_count()}is_antidiagonal({id:e}){return e==null?void 0:e.is_antidiagonal()}is_antisymmetric({id:e}){return e==null?void 0:e.is_antisymmetric()}}class r0{constructor(e=0,t=0,r=void 0,n){U(this,"_matrixInstance");U(this,"_errorListener");this._matrixInstance=this._createMatrix(e,t,r),this._errorListener=n}get _matrixArray(){return this._matrixInstance.map(e=>[...e._value])}get _value(){return this._matrixInstance}set _value(e){this._matrixInstance=e}get isMatrix(){return!0}_createMatrix(e,t,r){return Array.from(new Array(e),()=>new it(t,r,this._errorListener))}avg(){let e=0,t=0;for(const n of this._matrixInstance)for(const i of n._value)e+=me(i)?0:i,t+=1;return e/t}col({column:e}){const t=[],r=new it(0,void 0,this._errorListener);if(me(e))return r;for(const n of this._matrixInstance)t.push(n._value[e]);return r._value=t,r}det(){return bl(this._matrixArray)}get({row:e,column:t}){var r,n;if(!(me(e)||me(t)))return(n=(r=this._matrixInstance[e])==null?void 0:r._value)==null?void 0:n[t]}inv(){const e=go(this._matrixArray);return this._newMatrix(e)}max(){return zx(this._matrixArray)}min(){return Xa(this._matrixArray)}pow({power:e}){const t=me(e)?this._matrixArray:Ux(this._matrixArray,e);return this._newMatrix(t)}row({row:e}){return me(e)?new it(0,void 0,this._errorListener):this._matrixInstance[e]}set({row:e,column:t,value:r}){me(e)||me(t)||this._matrixInstance[e].set({index:t,value:r})}sum({id2:e}){const t=cs(this._matrixArray,typeof e=="number"?e:e._matrixArray);return this._newMatrix(t)}copy(){return this._newMatrix(this._matrixArray)}diff({id2:e}){const t=Ix(this._matrixArray,typeof e=="number"?e:e._matrixArray);return this._newMatrix(t)}rows(){return this._matrixInstance.length}columns(){return this._matrixArray.length&&this._matrixArray[0].length}fill({value:e,from_row:t,to_row:r,from_column:n,to_column:i}={}){me(t)&&(t=0),me(r)&&(r=this.rows()),me(n)&&(n=0),me(i)&&(i=this.columns());for(const[a,u]of this._matrixInstance.entries())for(const[l]of u._value.entries())a<r&&a>=t&&l>=n&&l<i&&u.set({index:l,value:e})}kron({id2:e}){const t=Ox(this._matrixArray,e._matrixArray);return this._newMatrix(t)}mode(){return Xa(gl(this._matrixArray))}mult({id2:e}){const t=typeof e=="number"?e:e._matrixArray?e._matrixArray:e._value,r=Bi(this._matrixArray,t);return this._newMatrix(r)}pinv(){const e=qx(this._matrixArray);return this._newMatrix(e)}rank(){return this._matrixRank(this._matrixArray)}sort({column:e,order:t=Qn.ascending}={}){me(e)&&(e=0),this._matrixInstance.sort((r,n)=>{const i=r._value[e],a=n._value[e];return t!==Qn.descending?i-a:a-i})}trace(){return kx(this._matrixArray)}concat({id2:e}){for(const t of e._value)this._matrixInstance.push(t);return this}median(){return Al(this._matrixArray)}add_col({column:e,array_id:t}={}){me(e)&&(e=this.columns());for(const[r,n]of this._matrixInstance.entries())n.insert({index:e,value:t?t._value[r]:void 0})}add_row({row:e,array_id:t}){me(e)&&(e=this.rows()),this._matrixInstance.splice(e,0,t||new it(this.columns(),void 0,this._errorListener))}is_zero(){return this._matrixArray.every(e=>e.every(t=>t===0))}reshape({rows:e=0,columns:t=0},r){if(e*t!==this.columns()*this.rows()){this._errorListener.addError("New matrix must be of same area as original matrix",r,Ve.Error);return}const n=Bx(this._matrixArray,[e,t]);this._matrixInstance=n.map(i=>{const a=new it(0,void 0,this._errorListener);return a._value=[...i],a})}reverse(){this._matrixInstance.reverse();for(const e of this._matrixInstance)e.reverse()}is_binary(){return this._matrixArray.every(e=>e.every(t=>t===0||t===1))}is_square(){return this.rows()===this.columns()}submatrix({from_row:e,to_row:t,from_column:r,to_column:n}={}){me(e)&&(e=0),me(t)&&(t=this.rows()),me(r)&&(r=0),me(n)&&(n=this.columns());const i=this._matrixArray.splice(e,t),a=[];for(const u of i)a.push(u.splice(r,n));return this._newMatrix(a)}swap_rows({row1:e,row2:t}){if(me(e)||me(t))return;const r=this._matrixInstance[e],n=this._matrixInstance[t];this._matrixInstance[e]=n,this._matrixInstance[t]=r}transpose(){const e=xl(this._matrixArray);return this._newMatrix(e)}remove_col({column:e}={}){me(e)&&(e=this.columns());const t=[];for(const n of this._matrixInstance){const i=n._value.splice(e,1);t.push(i[0])}const r=new it(0,void 0,this._errorListener);return r._value=t,r}remove_row({row:e}={}){return me(e)&&(e=this.rows()),this._matrixInstance.splice(e,1)[0]}eigenvalues(){const e=new Pl(new kl(this._matrixArray)),t=new it(0,void 0,this._errorListener);return t._value=e.realEigenvalues,t}is_diagonal(){const e=this.rows(),t=this.columns();if(e!==t)return!1;const r=this._matrixArray;for(let n=0;n<e;n++)for(let i=0;i<t;i++)if(n!==i&&r[n][i]!==0)return!1;return!0}is_identity(){const e=this.rows(),t=this.columns();if(e!==t)return!1;const r=this._matrixArray;for(let n=0;n<e;n++)for(let i=0;i<t;i++)if(n!==i&&r[n][i]!==0||n===i&&r[n][i]!==1)return!1;return!0}eigenvectors(){const e=new Pl(new kl(this._matrixArray));return this._newMatrix(e.eigenvectorMatrix.to2DArray())}is_symmetric(){const e=this.rows(),t=this.columns();if(e!==t)return!1;const r=this._matrixArray;for(let n=0;n<e;n++)for(let i=n+1;i<t;i++)if(r[n][i]!==r[i][n])return!1;return!0}swap_columns({column1:e,column2:t}){if(!(me(e)||me(t)))for(const r of this._matrixInstance){const n=r._value[e],i=r._value[t];r.set({index:e,value:i}),r.set({index:t,value:n})}}is_stochastic(){const e=this._matrixArray;for(let t=0;t<e.length;t++){let r=0;for(let n=0;n<e[t].length;n++){if(e[t][n]<0)return!1;r+=e[t][n]}if(Math.abs(r-1)>Number.EPSILON)return!1}return!0}is_triangular(){const e=this.rows(),t=this.columns();return e!==t?!1:this._isUpperTriangular(e)||this._isLowerTriangular(e)}elements_count(){return Mx(this._matrixArray)}is_antidiagonal(){const e=this.rows(),t=this.columns();if(e!==t)return!1;const r=this._matrixArray;for(let n=0;n<e;n++)for(let i=0;i<e;i++)if(n+i!==e-1&&r[n][i]!==0)return!1;return!0}is_antisymmetric(){const e=this.rows(),t=this.columns();if(e!==t)return!1;const r=this._matrixArray;for(let n=0;n<e;n++)for(let i=0;i<e;i++)if(n!==i&&r[n][i]!==-r[i][n])return!1;return!0}_isUpperTriangular(e){const t=this._matrixArray;for(let r=1;r<e;r++)for(let n=0;n<r;n++)if(t[r][n]!==0)return!1;return!0}_isLowerTriangular(e){const t=this._matrixArray;for(let r=0;r<e-1;r++)for(let n=r+1;n<e;n++)if(t[r][n]!==0)return!1;return!0}_newMatrix(e){const t=new r0(0,0,void 0,this._errorListener);return t._value=e.map(r=>{const n=new it(0,void 0,this._errorListener);return n._value=[...r],n}),t}_matrixRank(e){let t=0;const r=e.length,n=e[0].length,i=[...e].map(a=>[...a]);for(let a=0;a<r&&!(a>=n);a++){let u=a;for(;u<r&&i[u][a]===0;)u++;if(u===r)continue;if(u!==a){const c=i[u];i[u]=i[a],i[a]=c}const l=i[a][a];for(let c=0;c<n;c++)i[a][c]/=l;for(let c=a+1;c<r;c++){const h=i[c][a];i[c]=i[c].map((d,p)=>d-h*i[a][p]),i[c][a]=0}}for(let a=0;a<r;a++)i[a].some(u=>Number(u.toFixed(8))!==0)&&t++;return t}}class Gy{constructor(e){U(this,"_variables");U(this,"_cacheData");this._variables=e,this._cacheData={}}change({timeframe:e},t){if(!e)return!0;const r=pn(e),n=pn(this._variables.timeframe.period);if(r<n)return!0;const i=`change_${t}`,a=this._cacheData[i],u=this._variables.time;if(a){if(a.offset){if(a.currentTime+a.offset<=u)return this._cacheData[i]={currentTime:u,offset:0},!0}else if(a.currentTime+r*1e3<=u)return this._cacheData[i]={currentTime:u,offset:0},!0}else{const l=this._calcTimeOffset(u,e);return this._cacheData[i]={currentTime:u,offset:l},!1}return!1}in_seconds({timeframe:e}={}){return pn(e||this._variables.timeframe.period)}from_seconds({seconds:e=0}){const t=e*1e3,r=ot.duration(t);if(r.years())return"12M";const i=r.asMonths();if(_o(i))return`${i}M`;const a=r.asWeeks();if(_o(a))return`${a}M`;const u=r.asDays();if(u>=1)return`${Math.ceil(u)}D`;const l=r.asMinutes();if(l>=1)return`${Math.ceil(l)}`;const c=r.asSeconds();return c<=1?"1S":c<=5?"5S":c<=10?"10S":c<=15?"15S":c<=30?"30S":"1"}_calcTimeOffset(e,t){let r=0;if(t.includes("W")){const u=ot(e).day();t="1D",u!==1&&(r=(8-u)*60*60*24*1e3)}else if(t.includes("M")){const u=ot(e).date();t="1D";const l=ot(e).daysInMonth();u!==1&&(r=(l-u+1)*60*60*24*1e3)}const n=this._variables.getTimeTradingday(e,t),i=pn(t)*1e3,a=e-n-Math.floor((e-n)/i)*i;return r?r-a:a}}class Ky{constructor(e,t){U(this,"_errorListener");U(this,"_intlNumberFormatter");U(this,"_precision");this._errorListener=e,this._precision=t,this._intlNumberFormatter=new Intl.NumberFormat("en",{notation:"compact"})}pos({source:e="",str:t=""}){return e==null?void 0:e.indexOf(t)}trim({source:e=""}){return e==null?void 0:e.trim()}lower({source:e=""}){return e==null?void 0:e.toLocaleLowerCase()}match({source:e="",regex:t=""}){const r=e==null?void 0:e.match(new RegExp(t));return r?r[0]:""}split({string:e="",separator:t=""}){const r=e==null?void 0:e.split(t),n=new it;return n._value=r||[],n}upper({source:e=""}){return e==null?void 0:e.toLocaleUpperCase()}format({formatString:e=""},t){return this._strFormat(e,t)}length({string:e=""}){return e==null?void 0:e.length}repeat({source:e="",repeat:t,separator:r=""},n){if(me(t)){this._errorListener.addError("Invalid array length",n,Ve.Error);return}return Array.from(new Array(t),()=>e).join(r)}replace({source:e="",target:t="",replacement:r="",occurrence:n}){me(n)&&(n=0);let i=-1;for(let a=0;a<n+1&&(i=e.indexOf(t,i+1),i!==-1);a++);return i!==-1?e.substring(0,i)+r+e.substring(i+t.length):e}contains({source:e="",str:t=""}){return e==null?void 0:e.includes(t)}endswith({source:e="",str:t=""}){return e==null?void 0:e.endsWith(t)}tonumber({string:e=""}){if(/[^\d.]/.test(e))return;const t=parseFloat(e);return isNaN(t)?void 0:t}tostring({value:e,format:t}){if(e===void 0)return"NaN";if(typeof e=="object"){if(e.isArray)return this._arrToStr(e._value,t);if(e.isMatrix){const r=[];for(const n of e._matrixArray)r.push(this._arrToStr(n,t));return r.join(`
62
+ `)}}if(typeof e=="string")return e;if(typeof e=="boolean")return String(e);if(typeof e=="number")return String(this._toStringFormat(e,t))}_arrToStr(e,t){return`[${e.map(n=>typeof n=="number"?this._toStringFormat(n,t):n).toString()}]`}substring({source:e="",begin_pos:t=0,end_pos:r}){return me(t)&&(t=0),me(r)&&(r=void 0),e==null?void 0:e.substring(t,r)}startswith({source:e="",str:t=""}){return e==null?void 0:e.startsWith(t)}format_time({time:e,format:t="yyyy-MM-dd'T'HH:mm:ssZ",timezone:r}){return me(e)&&(e=0),Zr(e,r).format(t)}replace_all({source:e="",target:t="",replacement:r=""}){return e==null?void 0:e.replace(new RegExp(t,"g"),r)}_toStringFormat(e,t){if(!t)return e;switch(t){case Je.mintick:return e.toFixed(this._precision);case Je.price:return`${e}%`;case Je.volume:return this._intlNumberFormatter.format(Math.round(e));default:const[r,n]=t.split(".");let[i,a=""]=String(e).split(".");if(r.includes("#")?i=r.replace(/#/,i).replace(/#/g,""):i=`${r}${i}`,n&&n.includes("#")){const u=n.split("#").length-1;a=`${a.substring(0,u)}${n.replace(/#/g,"")}`}else a=n||"";return a?`${i}.${a}`:i}}_formatNumber(e,t){if(!t)return e;switch(t){case"integer":return String(Math.round(e));case"currency":return`$${e}`;case"percent":return`${e*100}%`;default:const r=t.split(".")[1],n=r?r.length:0;return parseFloat(e.toFixed(n))}}_strFormat(e,t){let r=e;return t.forEach((n,i)=>{if(typeof n=="number"){const a=`\\{\\s*${i}\\s*,\\s*number\\s*,\\s*([^\\}]+)\\s*\\}`,u=e.match(new RegExp(a));if(u){const l=u[1];r=r.replace(new RegExp(a,"g"),String(this._formatNumber(n,l)))}else r=r.replace(new RegExp(`\\{${i}\\}`,"g"),String(n))}else r=r.replace(new RegExp(`\\{${i}\\}`,"g"),n)}),r}}class Xy{constructor(e){U(this,"_errorListener");this._errorListener=e}new(){return new n0(this._errorListener)}copy({id:e}){return e==null?void 0:e.copy()}get({id:e,key:t}){return e==null?void 0:e.get({key:t})}put({id:e,key:t,value:r}){return e==null?void 0:e.put({key:t,value:r})}keys({id:e}){return e==null?void 0:e.keys()}size({id:e}){return e==null?void 0:e.size()}clear({id:e}){e==null||e.clear()}remove({id:e,key:t}){return e==null?void 0:e.remove({key:t})}values({id:e}){return e==null?void 0:e.values()}put_all({id:e,id2:t}){e==null||e.put_all({id2:t})}contains({id:e,key:t}){return e==null?void 0:e.contains({key:t})}}class n0{constructor(e){U(this,"_errorListener");U(this,"_mapInstance");this._errorListener=e,this._mapInstance=new Map}get isMap(){return!0}_copyMap(e){const t=new n0(this._errorListener);return t._mapInstance=new Map(e.entries()),t}copy(){return this._copyMap(this._mapInstance)}get({key:e}){return this._mapInstance.get(e)}put({key:e,value:t}){return this._mapInstance.set(e,t)}keys(){const e=new it(0,void 0,this._errorListener);return e._value=[...this._mapInstance.keys()],e}size(){return this._mapInstance.size}clear(){this._mapInstance.clear()}remove({key:e}){const t=this._mapInstance.get(e);return this._mapInstance.delete(e),t||void 0}values(){const e=new it(0,void 0,this._errorListener);return e._value=[...this._mapInstance.values()],e}put_all({id2:e}){this._mapInstance=new Map([...this._mapInstance,...e._mapInstance])}contains({key:e}){return this._mapInstance.has(e)}}class Qy{constructor(e){U(this,"_variables");this._variables=e}new({price:e,time:t,index:r}){return new si(e,r,t)}now({price:e}){const{time:t,bar_index:r}=this._variables;return new si(e,r,t)}copy({id:e}){const{price:t,time:r,index:n}=e||{};return new si(t,n,r)}from_index({price:e,index:t}){return new si(e,t)}from_time({price:e,time:t}){return new si(e,void 0,t)}}class si{constructor(e,t,r){U(this,"_index");U(this,"_price");U(this,"_time");this._index=t,this._price=e,this._time=r}get index(){return this._index}get price(){return this._price}get time(){return this._time}copy(){return new si(this._price,this._index,this._time)}}class Jy{constructor(e,t){U(this,"_variables");U(this,"_errorListener");U(this,"_defaultLabel",{text:"",xloc:wt.bar_index,yloc:Kr.price,size:ar.normal,style:vt.styleLabelDown,textalign:je.alignCenter});this._variables=e,this._errorListener=t}new(e,t){const{time:r,high:n,low:i,bar_index:a}=this._variables,u=`label_${t}_${a}`,l={...this._defaultLabel,...e,id:u,time:r};e.point&&(l.x=l.xloc===wt.bar_index?e.point.index:e.point.time,l.y=e.point.price),l.yloc===Kr.abovebar?l.y=n:l.yloc===Kr.belowbar&&(l.y=i),this._verfiyArgs(e,t);const c=new hs(u,this._variables,this._errorListener);return t.startsWith("export")||this._variables.label.add(u,l,c),c}_verfiyArgs(e,t){const{xloc:r,yloc:n,style:i,size:a,textalign:u,text_font_family:l}=e,c="label.new";this._paramVerfiy(i,t,c,Object.values(vt),"style"),this._paramVerfiy(r,t,c,Object.values(wt),"xloc"),this._paramVerfiy(n,t,c,Object.values(Kr),"yloc"),this._paramVerfiy(a,t,c,Object.values(ar),"size"),this._paramVerfiy(u,t,c,[je.alignLeft,je.alignCenter,je.alignRight],"textalign"),this._paramVerfiy(l,t,c,Object.values(Jn),"text_font_family")}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(or(Kt.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ve.Error)}label(e,t){return e.x?e.x:new hs(t,this._variables,this._errorListener)}copy({id:e},t){return e==null?void 0:e.copy(t)}get_x({id:e},t){return e==null?void 0:e.get_x(t)}get_y({id:e},t){return e==null?void 0:e.get_y(t)}set_x({id:e,...t},r){e==null||e.set_x(t,r)}set_y({id:e,...t},r){e==null||e.set_y(t,r)}delete({id:e}){e==null||e.delete()}get_text({id:e},t){return e==null?void 0:e.get_text(t)}set_xy({id:e,...t},r){e==null||e.set_xy(t,r)}set_size({id:e,...t},r){e==null||e.set_size(t,r)}set_xloc({id:e,...t},r){e==null||e.set_xloc(t,r)}set_yloc({id:e,...t},r){e==null||e.set_yloc(t,r)}set_style({id:e,...t},r){e==null||e.set_style(t,r)}set_color({id:e,...t},r){e==null||e.set_color(t,r)}set_tooltip({id:e,...t},r){e==null||e.set_tooltip(t,r)}set_point({id:e,...t},r){e==null||e.set_point(t,r)}set_text({id:e,...t},r){e==null||e.set_text(t,r)}set_textcolor({id:e,...t},r){e==null||e.set_textcolor(t,r)}set_textalign({id:e,...t},r){e==null||e.set_textalign(t,r)}set_text_font_family({id:e,...t},r){e==null||e.set_text_font_family(t,r)}}class hs{constructor(e,t,r){U(this,"_id");U(this,"_variables");U(this,"_errorListener");this._id=e,this._variables=t,this._errorListener=r}copy(e){const t=`label_${e}_${this._variables.bar_index}`,r=this._getLabel(e),n=new hs(t,this._variables,this._errorListener);return r&&this._variables.label.add(t,{...r,id:t},n),n}get_x(e){var t;return(t=this._getLabel(e))==null?void 0:t.x}get_y(e){var t;return(t=this._getLabel(e))==null?void 0:t.y}set_x({x:e},t){const r=this._getLabel(t);r&&(r.x=e)}set_y({y:e},t){const r=this._getLabel(t);r&&(r.y=e)}delete(){this._variables.label.delete(this._id)}set_xy({x:e,y:t},r){const n=this._getLabel(r);n&&(n.x=e,n.y=t)}get_text(e){var t;return(t=this._getLabel(e))==null?void 0:t.text}set_size({size:e},t){const r=this._getLabel(t);r&&(r.size=e),this._paramVerfiy(e,t,"label.set_size",Object.values(ar),"size")}set_text({text:e},t){const r=this._getLabel(t);r&&(r.text=e)}set_xloc({x:e,xloc:t},r){const n=this._getLabel(r);n&&(n.x=e,n.xloc=t,this._paramVerfiy(t,r,"label.set_xloc",Object.values(wt),"xloc"))}set_yloc({yloc:e},t){const r=this._getLabel(t),{high:n,low:i}=this._variables;r&&(r.yloc=e,e===Kr.abovebar?r.y=n:e===Kr.belowbar&&(r.y=i),this._paramVerfiy(e,t,"label.set_yloc",Object.values(Kr),"yloc"))}set_color({color:e},t){const r=this._getLabel(t);r&&(r.color=e)}set_point({point:e},t){const r=this._getLabel(t);r&&(r.x=r.xloc===wt.bar_index?e==null?void 0:e.index:e==null?void 0:e.time,r.y=e==null?void 0:e.price)}set_style({style:e},t){const r=this._getLabel(t);r&&(r.style=e),this._paramVerfiy(e,t,"label.set_style",Object.values(vt),"style")}set_tooltip({tooltip:e},t){const r=this._getLabel(t);r&&(r.tooltip=e)}set_textalign({textalign:e},t){const r=this._getLabel(t);r&&(r.textalign=e),this._paramVerfiy(e,t,"label.set_textalign",[je.alignLeft,je.alignCenter,je.alignRight],"textalign")}set_textcolor({textcolor:e},t){const r=this._getLabel(t);r&&(r.textcolor=e)}set_text_font_family({text_font_family:e},t){const r=this._getLabel(t);r&&(r.text_font_family=e),this._paramVerfiy(e,t,"label.set_text_font_family",Object.values(Jn),"text_font_family")}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(or(Kt.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ve.Error)}_getLabel(e){const t=this._variables.label.get(this._id);return t||console.log(`错误${e}: label 不存在`),t}}const eD={freq_all:Vr.freqAll,freq_once_per_bar:Vr.freqOncePerBar,freq_once_per_bar_close:Vr.freqOncePerBarClose},tD={gaps_off:ns.gapsOff,gaps_on:ns.gapsOn,lookahead_off:ns.lookaheadOff,lookahead_on:ns.lookaheadOn},Ti={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"},zl={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"},rD={friday:6,monday:2,saturday:7,sunday:1,thursday:5,tuesday:3,wednesday:4},ql={all:[Zt.dataWindow,Zt.pane,Zt.priceScale,Zt.statusLine],data_window:[Zt.dataWindow],none:[],pane:[Zt.pane],price_scale:[Zt.priceScale],status_line:[Zt.statusLine]},nD={both:Gr.both,left:Gr.left,none:Gr.none,right:Gr.right},iD={inherit:Je.inherit,mintick:Je.mintick,percent:Je.percent,price:Je.price,volume:Je.volume},sD={style_solid:ks.styleSolid,style_dashed:ks.styleDashed,style_dotted:ks.styleDotted},oD={style_arrowdown:vt.styleArrowdown,style_arrowup:vt.styleArrowup,style_circle:vt.styleCircle,style_cross:vt.styleCross,style_diamond:vt.styleDiamond,style_flag:vt.styleFlag,style_label_center:vt.styleLabelCenter,style_label_down:vt.styleLabelDown,style_label_left:vt.styleLabelLeft,style_label_lower_left:vt.styleLabelLowerLeft,style_label_lower_right:vt.styleLabelLowerRight,style_label_right:vt.styleLabelRight,style_label_up:vt.styleLabelUp,style_label_upper_left:vt.styleLabelUpperLeft,style_label_upper_right:vt.styleLabelUpperRight,style_none:vt.styleNone,style_square:vt.styleSquare,style_text_outline:vt.styleTextOutline,style_triangledown:vt.styleTriangledown,style_triangleup:vt.styleTriangleup,style_xcross:vt.styleXcross},aD={style_arrow_both:zt.styleArrowBoth,style_arrow_left:zt.styleArrowLeft,style_arrow_right:zt.styleArrowRight,style_dashed:zt.styleDashed,style_dotted:zt.styleDotted,style_solid:zt.styleSolid},uD={abovebar:_n.abovebar,absolute:_n.absolute,belowbar:_n.belowbar,bottom:_n.bottom,top:_n.top},fD={e:2.718281828459045,phi:1.618033988749895,pi:3.141592653589793,rphi:.6180339887498948},cD={style_area:Or.styleArea,style_areabr:Or.styleAreabr,style_circles:Or.styleCircles,style_columns:Or.styleColumns,style_cross:Or.styleCross,style_histogram:Or.styleHistogram,style_line:Or.styleLine,style_linebr:Or.styleLinebr,style_stepline:Or.styleStepline,style_stepline_diamond:Or.styleSteplineDiamond,style_steplinebr:Or.styleSteplinebr},lD={bottom_center:Er.bottomCenter,bottom_left:Er.bottomLeft,bottom_right:Er.bottomRight,middle_center:Er.middleCenter,middle_left:Er.middleLeft,middle_right:Er.middleRight,top_center:Er.topCenter,top_left:Er.topLeft,top_right:Er.topRight},hD={left:zs.left,none:zs.none,right:zs.right},dD={arrowdown:pr.arrowdown,arrowup:pr.arrowup,circle:pr.circle,cross:pr.cross,diamond:pr.diamond,flag:pr.flag,labeldown:pr.labeldown,labelup:pr.labelup,square:pr.square,triangledown:pr.triangledown,triangleup:pr.triangleup,xcross:pr.xcross},pD={auto:ar.auto,huge:ar.huge,large:ar.large,normal:ar.normal,small:ar.small,tiny:ar.tiny},_D={cash:Rt.cash,fixed:Rt.fixed,percent_of_equity:Rt.percentOfEquity,commission:{cash_per_contract:Tr.cashPerContract,cash_per_order:Tr.cashPerOrder,percent:Tr.percent},direction:{all:gt.all,long:gt.long,short:gt.short},oca:{cancel:vn.cancel,none:vn.none,reduce:vn.reduce}},vD={align_bottom:je.alignBottom,align_center:je.alignCenter,align_left:je.alignLeft,align_right:je.alignRight,align_top:je.alignTop,wrap_auto:je.wrapAuto,wrap_none:je.wrapNone},gD={bar_index:wt.bar_index,bar_time:wt.bar_time},mD={abovebar:Kr.abovebar,belowbar:Kr.belowbar,price:Kr.price},xD={actual:qs.actual,estimate:qs.estimate,standardized:qs.standardized};class Ul{constructor(){U(this,"adjustment",{dividends:Ps.dividends,none:Ps.none,splits:Ps.splits});U(this,"alert",eD);U(this,"barmerge",tD);U(this,"color",Ti);U(this,"currency",zl);U(this,"dayofweek",rD);U(this,"earnings",xD);U(this,"display",ql);U(this,"extend",nD);U(this,"font",{family_default:Jn.familyDefault,family_monospace:Jn.familyMonospace});U(this,"format",iD);U(this,"hline",sD);U(this,"label",oD);U(this,"line",aD);U(this,"location",uD);U(this,"math",fD);U(this,"order",{ascending:Qn.ascending,descending:Qn.descending});U(this,"plot",cD);U(this,"position",lD);U(this,"scale",hD);U(this,"session",{extended:ba.extended,regular:ba.regular});U(this,"shape",dD);U(this,"size",pD);U(this,"splits",{denominator:"denominator",numerator:"numerator"});U(this,"strategy",_D);U(this,"text",vD);U(this,"xloc",gD);U(this,"yloc",mD)}updateData(){}}class yD{constructor(e,t){U(this,"_variables");U(this,"_errorListener");U(this,"_defaultPolyline",{curved:!1,closed:!1,xloc:wt.bar_index,line_color:Ti.blue,line_style:zt.styleSolid,line_width:1});this._variables=e,this._errorListener=t}new(e,t){const r=`polyline_${t}_${this._variables.bar_index}`,n=Object.assign({},this._defaultPolyline,e,{id:r}),i=new Wl(r,this._variables);return this._verfiyArgs(e,t),t.startsWith("export")||this._variables.polyline.add(r,n,i),i}_verfiyArgs(e,t){const{line_style:r,xloc:n}=e,i="polyline.new";this._paramVerfiy(r,t,i,Object.values(zt),"line_style"),this._paramVerfiy(n,t,i,Object.values(wt),"xloc")}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(or(Kt.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ve.Error)}delete({id:e}){e&&e.delete()}}class Wl{constructor(e,t){U(this,"_id");U(this,"_variables");this._variables=t,this._id=e}delete(){this._variables.polyline.delete(this._id)}}class DD{constructor(e,t){U(this,"_variables");U(this,"_errorListener");U(this,"_defaultLine",{xloc:wt.bar_index,extend:Gr.none,style:zt.styleSolid});this._variables=e,this._errorListener=t}new({first_point:e,second_point:t,...r},n){const i=`line_${n}_${this._variables.bar_index}`,a={...this._defaultLine,...r,id:i};if(e&&t){const l=a.xloc===wt.bar_index?e.index:e.time,c=a.xloc===wt.bar_index?t.index:t.time;Object.assign(a,{x1:l,y1:e.price,x2:c,y2:t.price})}this._verfiyArgs(r,n);const u=new ds(i,this._variables,this._errorListener);return n.startsWith("export")||this._variables.line.add(i,a,u),u}_verfiyArgs(e,t){const{extend:r,xloc:n,style:i}=e,a="line.new";this._paramVerfiy(i,t,a,Object.values(zt),"style"),this._paramVerfiy(r,t,a,Object.values(Gr),"extend"),this._paramVerfiy(n,t,a,Object.values(wt),"xloc")}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(or(Kt.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ve.Error)}line(e,t){return e.x?e.x:new ds(t,this._variables,this._errorListener)}copy({id:e},t){return e==null?void 0:e.copy(t)}delete({id:e}){e==null||e.delete()}get_x1({id:e},t){return e==null?void 0:e.get_x1(t)}get_x2({id:e},t){return e==null?void 0:e.get_x2(t)}get_y1({id:e},t){return e==null?void 0:e.get_y1(t)}get_y2({id:e},t){return e==null?void 0:e.get_y2(t)}set_x1({id:e,...t},r){e==null||e.set_x1(t,r)}set_x2({id:e,...t},r){e==null||e.set_x2(t,r)}set_y1({id:e,...t},r){e==null||e.set_y1(t,r)}set_y2({id:e,...t},r){e==null||e.set_y2(t,r)}set_xy1({id:e,...t},r){e==null||e.set_xy1(t,r)}set_xy2({id:e,...t},r){e==null||e.set_xy2(t,r)}set_xloc({id:e,...t},r){e==null||e.set_xloc(t,r)}get_price({id:e,...t},r){return e==null?void 0:e.get_price(t,r)}set_color({id:e,...t},r){e==null||e.set_color(t,r)}set_style({id:e,...t},r){e==null||e.set_style(t,r)}set_width({id:e,...t},r){e==null||e.set_width(t,r)}set_extend({id:e,...t},r){e==null||e.set_extend(t,r)}set_first_point({id:e,...t},r){e==null||e.set_first_point(t,r)}set_second_point({id:e,...t},r){e==null||e.set_second_point(t,r)}}class ds{constructor(e,t,r){U(this,"_variables");U(this,"_id");U(this,"_errorListener");this._id=e,this._variables=t,this._errorListener=r}get data(){return this._variables.line.get(this._id)}copy(e){const t=`line_${e}_${this._variables.bar_index}`,r=this._getLine(e),n=new ds(t,this._variables,this._errorListener);return r&&this._variables.line.add(t,{...r,id:t},n),n}delete(){this._variables.line.delete(this._id)}get_price({x:e},t){const r=this._getLine(t);if(e===void 0)return e;if(r&&r.xloc===wt.bar_index){const{x1:n,y1:i,x2:a,y2:u}=r;return n===void 0||a===void 0||i===void 0||u===void 0?void 0:(u-i)/(a-n)*(e-n)+i}}get_x1(e){var t;return(t=this._getLine(e))==null?void 0:t.x1}get_x2(e){var t;return(t=this._getLine(e))==null?void 0:t.x2}get_y1(e){var t;return(t=this._getLine(e))==null?void 0:t.y1}get_y2(e){var t;return(t=this._getLine(e))==null?void 0:t.y2}set_x1({x:e},t){const r=this._getLine(t);r&&(r.x1=e)}set_x2({x:e},t){const r=this._getLine(t);r&&(r.x2=e)}set_y1({y:e},t){const r=this._getLine(t);r&&(r.y1=e)}set_y2({y:e},t){const r=this._getLine(t);r&&(r.y2=e)}set_xy1({x:e,y:t},r){const n=this._getLine(r);n&&(n.x1=e,n.y1=t)}set_xy2({x:e,y:t},r){const n=this._getLine(r);n&&(n.x2=e,n.y2=t)}set_xloc({xloc:e,x1:t,x2:r},n){const i=this._getLine(n);i&&(i.xloc=e,i.x1=t,i.x2=r,this._paramVerfiy(e,n,"line.set_xloc",Object.values(wt),"xloc"))}set_color({color:e},t){const r=this._getLine(t);r&&(r.color=e)}set_style({style:e},t){const r=this._getLine(t);r&&(r.style=e,this._paramVerfiy(e,t,"line.set_style",Object.values(zt),"style"))}set_width({width:e},t){const r=this._getLine(t);r&&(r.width=e)}set_extend({extend:e},t){const r=this._getLine(t);r&&(r.extend=e,this._paramVerfiy(e,t,"line.set_extend",Object.values(Gr),"extend"))}set_first_point({point:e},t){const r=this._getLine(t);if(r){const{index:n,time:i,price:a}=e||{},u=r.xloc===wt.bar_index?n:i,l=a;u&&(r.x1=u),l&&(r.y1=l)}}set_second_point({point:e},t){const r=this._getLine(t);if(r){const{index:n,time:i,price:a}=e||{},u=r.xloc===wt.bar_index?n:i,l=a;u&&(r.x2=u),l&&(r.y2=l)}}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(or(Kt.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ve.Error)}_getLine(e){const t=this._variables.line.get(this._id);return t||console.log(`${e}: line 不存在`),t}}class wD{constructor(e){U(this,"_variables");this._variables=e}new({line1:e,line2:t,color:r},n){const i=`linefill_${n}_${this._variables.bar_index}`,a=e==null?void 0:e.data,u=t==null?void 0:t.data;a&&(a.linefills=a.linefills||[],a.linefills.push(i)),u&&(u.linefills=u.linefills||[],u.linefills.push(i));const l=new Co(this._variables,i,e,t);return n.startsWith("export")||(a||u)&&this._variables.linefill.add(i,{line1:a,line2:u,color:r,id:i},l),l}delete({id:e}){e==null||e.delete()}get_line1({id:e}){return e==null?void 0:e.get_line1()}get_line2({id:e}){return e==null?void 0:e.get_line2()}set_color({id:e,...t}){e==null||e.set_color(t)}}class Co{constructor(e,t,r,n){U(this,"_id");U(this,"_line1");U(this,"_line2");U(this,"_variables");this._variables=e,this._id=t,this._line1=r,this._line2=n}linefill(e,t){return e.x?e.x:new Co(this._variables,t)}delete(){var t,r;const e=this._variables.linefill.get(this._id);if(e){const{line1:n,line2:i}=e;n&&(n.linefills=(t=n.linefills)==null?void 0:t.filter(a=>a!==this._id)),i&&(i.linefills=(r=i.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:e}){const t=this._variables.linefill.get(this._id);t&&(t.color=e)}}class ED{constructor(e,t){U(this,"_variables");U(this,"_errorListener");U(this,"_defaultBox",{border_color:Ti.blue,border_width:1,bgcolor:Ti.blue,xloc:wt.bar_index,extend:Gr.none,style:zt.styleSolid,text:"",text_size:ar.auto,text_color:Ti.black,text_halign:je.alignCenter,text_valign:je.alignCenter,text_wrap:je.wrapNone});this._variables=e,this._errorListener=t}box({x:e},t){return e===void 0?new ps(this._variables,t,this._errorListener):e}new({top_left:e,bottom_right:t,...r},n){const i=`box_${n}_${this._variables.bar_index}`,a={...this._defaultBox,...r,id:i};if(e){const{price:l,time:c,index:h}=e;a.top=l,a.left=a.xloc===wt.bar_index?h:c}if(t){const{price:l,time:c,index:h}=t;a.bottom=l,a.right=a.xloc===wt.bar_index?h:c}this._verfiyArgs(r,n);const u=new ps(this._variables,i,this._errorListener);return n.startsWith("export")||this._variables.box.add(i,a,u),u}_verfiyArgs(e,t){const{border_style:r,extend:n,xloc:i,text_size:a,text_halign:u,text_valign:l,text_wrap:c,text_font_family:h}=e,d="box.new";this._paramVerfiy(r,t,d,[zt.styleDashed,zt.styleDotted,zt.styleSolid],"border_style"),this._paramVerfiy(n,t,d,Object.values(Gr),"extend"),this._paramVerfiy(i,t,d,Object.values(wt),"xloc"),this._paramVerfiy(a,t,d,Object.values(ar),"text_size"),this._paramVerfiy(u,t,d,[je.alignLeft,je.alignCenter,je.alignRight],"text_halign"),this._paramVerfiy(l,t,d,[je.alignBottom,je.alignCenter,je.alignTop],"text_valign"),this._paramVerfiy(c,t,d,[je.wrapAuto,je.wrapNone],"text_wrap"),this._paramVerfiy(h,t,d,Object.values(Jn),"text_font_family")}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(or(Kt.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ve.Error)}copy({id:e},t){return e==null?void 0:e.copy(t)}delete({id:e}){e==null||e.delete()}get_top({id:e}){return e==null?void 0:e.get_top()}get_bottom({id:e}){return e==null?void 0:e.get_bottom()}get_left({id:e}){return e==null?void 0:e.get_left()}get_right({id:e}){return e==null?void 0:e.get_right()}set_top({id:e,...t}){e==null||e.set_top(t)}set_bottom({id:e,...t}){e==null||e.set_bottom(t)}set_left({id:e,...t}){e==null||e.set_left(t)}set_right({id:e,...t}){e==null||e.set_right(t)}set_extend({id:e,...t},r){e==null||e.set_extend(t,r)}set_bgcolor({id:e,...t}){e==null||e.set_bgcolor(t)}set_border_color({id:e,...t}){e==null||e.set_border_color(t)}set_border_width({id:e,...t}){e==null||e.set_border_width(t)}set_border_style({id:e,...t},r){e==null||e.set_border_style(t,r)}set_lefttop({id:e,...t}){e==null||e.set_lefttop(t)}set_rightbottom({id:e,...t}){e==null||e.set_rightbottom(t)}set_text_size({id:e,...t},r){e==null||e.set_text_size(t,r)}set_text_wrap({id:e,...t},r){e==null||e.set_text_wrap(t,r)}set_text_color({id:e,...t}){e==null||e.set_text_color(t)}set_text_halign({id:e,...t},r){e==null||e.set_text_halign(t,r)}set_text_valign({id:e,...t},r){e==null||e.set_text_valign(t,r)}set_top_left_point({id:e,...t}){e==null||e.set_top_left_point(t)}set_bottom_right_point({id:e,...t}){e==null||e.set_bottom_right_point(t)}set_text_font_family({id:e,...t},r){e==null||e.set_text_font_family(t,r)}}class ps{constructor(e,t,r){U(this,"_id");U(this,"_variables");U(this,"_errorListener");this._variables=e,this._id=t,this._errorListener=r}copy(e){const t=`box_${e}_${this._variables.bar_index}`,r=this._getBox(),n=new ps(this._variables,t,this._errorListener);return r&&this._variables.box.add(t,{...r,id:t},n),n}delete(){this._variables.box.delete(this._id)}get_top(){const e=this._getBox();return e&&e.top}set_top({top:e}){const t=this._getBox();t&&(t.top=e)}get_left(){const e=this._getBox();return e&&e.left}set_left({left:e}){const t=this._getBox();t&&(t.left=e)}set_text({text:e}){const t=this._getBox();t&&(t.text=e)}get_right(){const e=this._getBox();return e&&e.right}set_right({right:e}){const t=this._getBox();t&&(t.right=e)}get_bottom(){const e=this._getBox();return e&&e.bottom}set_bottom({bottom:e}){const t=this._getBox();t&&(t.bottom=e)}set_extend({extend:e},t){const r=this._getBox();r&&(r.extend=e,this._paramVerfiy(e,t,"box.set_extend",Object.values(Gr),"extend"))}set_bgcolor({color:e}){const t=this._getBox();t&&(t.bgcolor=e)}set_lefttop({left:e,top:t}){const r=this._getBox();r&&(r.left=e,r.top=t)}set_text_size({text_size:e},t){const r=this._getBox();r&&(r.text_size=e,this._paramVerfiy(e,t,"box.set_text_size",Object.values(ar),"text_size"))}set_text_wrap({text_wrap:e},t){const r=this._getBox();r&&(r.text_wrap=e,this._paramVerfiy(e,t,"box.set_text_wrap",[je.wrapAuto,je.wrapNone],"text_wrap"))}set_text_color({text_color:e}){const t=this._getBox();t&&(t.text_color=e)}set_rightbottom({right:e,bottom:t}){const r=this._getBox();r&&(r.right=e,r.bottom=t)}set_text_halign({text_halign:e},t){const r=this._getBox();r&&(r.text_halign=e,this._paramVerfiy(e,t,"box.set_text_halign",[je.alignLeft,je.alignCenter,je.alignRight],"text_halign"))}set_text_valign({text_valign:e},t){const r=this._getBox();r&&(r.text_valign=e,this._paramVerfiy(e,t,"box.set_text_valign",[je.alignBottom,je.alignCenter,je.alignTop],"text_valign"))}set_top_left_point({point:e}){const t=this._getBox();if(t){const{index:r,price:n,time:i}=e||{};t.top=n,t.left=t.xloc===wt.bar_index?r:i}}set_border_color({color:e}){const t=this._getBox();t&&(t.border_color=e)}set_border_style({style:e},t){const r=this._getBox();r&&(r.border_style=e,this._paramVerfiy(e,t,"box.set_border_style",[zt.styleDashed,zt.styleDotted,zt.styleSolid],"style"))}set_border_width({width:e}){const t=this._getBox();t&&(t.border_width=e)}set_bottom_right_point({point:e}){const t=this._getBox();if(t){const{index:r,price:n,time:i}=e||{};t.bottom=n,t.right=t.xloc===wt.bar_index?r:i}}set_text_font_family({text_font_family:e},t){const r=this._getBox();r&&(r.text_font_family=e,this._paramVerfiy(e,t,"box.set_text_font_family",Object.values(Jn),"text_font_family"))}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(or(Kt.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ve.Error)}_getBox(){return this._variables.box.get(this._id)}}class bD{constructor(e,t){U(this,"_variables");U(this,"_errorListener");U(this,"_defaultTable",{position:Er.topLeft,columns:0,rows:0,frame_width:0,border_width:0});this._variables=e,this._errorListener=t}table({x:e},t){return e||new i0(this._variables,t,this._errorListener)}new(e,t){const r=`table_${t}_${this._variables.bar_index}`,n={...this._defaultTable,...e,cell:[],id:r},i=new i0(this._variables,r,this._errorListener);return this._paramVerfiy(e.position,t,"table.new",Object.values(Er),"position"),t.startsWith("export")||this._variables.table.add(r,n,i),i}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(or(Kt.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ve.Error)}cell({table_id:e,...t}){e==null||e.cell(t)}cell_set_bgcolor({table_id:e,...t}){e==null||e.cell_set_bgcolor(t)}cell_set_height({table_id:e,...t}){e==null||e.cell_set_height(t)}cell_set_text({table_id:e,...t}){e==null||e.cell_set_text(t)}cell_set_text_color({table_id:e,...t}){e==null||e.cell_set_text_color(t)}cell_set_text_font_family({table_id:e,...t}){e==null||e.cell_set_text_font_family(t)}cell_set_text_halign({table_id:e,...t}){e==null||e.cell_set_text_halign(t)}cell_set_text_valign({table_id:e,...t}){e==null||e.cell_set_text_valign(t)}cell_set_text_size({table_id:e,...t}){e==null||e.cell_set_text_size(t)}cell_set_tooltip({table_id:e,...t}){e==null||e.cell_set_tooltip(t)}cell_set_width({table_id:e,...t}){e==null||e.cell_set_width(t)}clear({table_id:e,...t}){e==null||e.clear(t)}delete({table_id:e}){e==null||e.delete()}merge_cells({table_id:e,...t},r){e==null||e.merge_cells(t,r)}set_bgcolor({table_id:e,...t}){e==null||e.set_bgcolor(t)}set_border_color({table_id:e,...t}){e==null||e.set_border_color(t)}set_border_width({table_id:e,...t}){e==null||e.set_border_width(t)}set_frame_color({table_id:e,...t}){e==null||e.set_frame_color(t)}set_frame_width({table_id:e,...t}){e==null||e.set_frame_width(t)}set_position({table_id:e,...t},r){e==null||e.set_position(t,r)}}class i0{constructor(e,t,r){U(this,"_id");U(this,"_variables");U(this,"_errorListener");U(this,"_defaultCell",{column:0,row:0,text:"",text_color:Ti.black,text_halign:je.alignCenter,text_valign:je.alignCenter,text_size:ar.normal});this._variables=e,this._id=t,this._errorListener=r}cell(e){const t={...this._defaultCell,...e},{column:r=0,row:n=0}=t,i=this._variables.table.get(this._id);if(i){const a=i.cell||[],u=a[n]||[];u[r]=t,a[n]=u,i.cell=a}}cell_set_bgcolor({column:e=0,row:t=0,bgcolor:r}){const n=this._getTableItem(e,t);n&&(n.bgcolor=r)}cell_set_height({column:e=0,row:t=0,height:r}){const n=this._getTableItem(e,t);n&&(n.height=r)}cell_set_text({column:e=0,row:t=0,text:r}){const n=this._getTableItem(e,t);n&&(n.text=r)}cell_set_text_color({column:e=0,row:t=0,text_color:r}){const n=this._getTableItem(e,t);n&&(n.text_color=r)}cell_set_text_font_family({column:e=0,row:t=0,text_font_family:r}){const n=this._getTableItem(e,t);n&&(n.text_font_family=r)}cell_set_text_halign({column:e=0,row:t=0,text_halign:r}){const n=this._getTableItem(e,t);n&&(n.text_halign=r)}cell_set_text_valign({column:e=0,row:t=0,text_valign:r}){const n=this._getTableItem(e,t);n&&(n.text_valign=r)}cell_set_text_size({column:e=0,row:t=0,text_size:r}){const n=this._getTableItem(e,t);n&&(n.text_size=r)}cell_set_tooltip({column:e=0,row:t=0,tooltip:r}){const n=this._getTableItem(e,t);n&&(n.tooltip=r)}cell_set_width({column:e=0,row:t=0,width:r}){const n=this._getTableItem(e,t);n&&(n.width=r)}clear({start_column:e=0,start_row:t=0,end_column:r=0,end_row:n=0}){const i=this._variables.table.get(this._id);if(i){const a=i.cell;if(a)for(let u=t;u<=n;u++)for(let l=e;l<=r;l++){const c=a[u];c&&(c[l]=void 0)}}}delete(){this._variables.table.delete(this._id)}merge_cells({start_column:e=0,start_row:t=0,end_column:r=0,end_row:n=0},i){if(e>r||t>n){console.log(`error ${i}: start_column > end_column or start_row > end_row`);return}const a=this._getTableItem(e,t);if(!a)return;this.clear({start_column:e,start_row:t,end_column:r,end_row:n});const u=this._variables.table.get(this._id);u.cell[t][e]={...a,isMerge:!0,merge_columns:r-e+1,merge_rows:n-t+1}}set_bgcolor({bgcolor:e}){const t=this._variables.table.get(this._id);t&&(t.bgcolor=e)}set_border_color({border_color:e}){const t=this._variables.table.get(this._id);t&&(t.border_color=e)}set_border_width({border_width:e}){const t=this._variables.table.get(this._id);t&&(t.border_width=e)}set_frame_color({frame_color:e}){const t=this._variables.table.get(this._id);t&&(t.frame_color=e)}set_frame_width({frame_width:e}){const t=this._variables.table.get(this._id);t&&(t.frame_width=e)}set_position({position:e},t){const r=this._variables.table.get(this._id);r&&(r.position=e,this._paramVerfiy(e,t,"table.set_position",Object.values(Er),"position"))}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(or(Kt.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ve.Error)}_getTableItem(e,t){const r=this._variables.table.get(this._id);if(r){const n=r.cell;return n?n[t][e]:void 0}}}class AD{constructor(e){U(this,"_strategy");this._strategy=e}commission({trade_num:e}){return this._verifyTradeNum(e)&&this._strategy.historyOrders[e].commission||0}entry_bar_index({trade_num:e}){if(this._verifyTradeNum(e))return this._strategy.historyOrders[e].in_index}entry_comment({trade_num:e}){if(!this._verifyTradeNum(e))return"";const{comment:t,id:r}=this._strategy.historyOrders[e];return t||r}entry_id({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.historyOrders[e].id:""}entry_price({trade_num:e}){if(this._verifyTradeNum(e))return this._strategy.historyOrders[e].in_price}entry_time({trade_num:e}){if(this._verifyTradeNum(e))return this._strategy.historyOrders[e].in_time}exit_bar_index({trade_num:e}){if(this._verifyTradeNum(e))return this._strategy.historyOrders[e].out_index}exit_comment({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.historyOrders[e].out_comment:""}exit_id({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.historyOrders[e].out_id:""}exit_price({trade_num:e}){if(this._verifyTradeNum(e))return this._strategy.historyOrders[e].out_price}exit_time({trade_num:e}){if(this._verifyTradeNum(e))return this._strategy.historyOrders[e].out_time}max_drawdown({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.historyOrders[e].trading_loss:0}max_drawdown_percent({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.historyOrders[e].trading_loss_percent:0}max_runup({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.historyOrders[e].max_profit:0}max_runup_percent({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.historyOrders[e].max_profit_percent:0}profit({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.historyOrders[e].profit:0}profit_percent({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.historyOrders[e].profit_percent:0}size({trade_num:e}){if(!this._verifyTradeNum(e))return 0;const{out_qty:t=0,direction:r}=this._strategy.historyOrders[e];return r===gt.long?t:-t}_verifyTradeNum(e){if(typeof e!="number"||e<0)return!1;const t=this._strategy.historyOrders.length;return!(e>=t)}}class CD{constructor(e){U(this,"_strategy");this._strategy=e}commission({trade_num:e}){if(!this._verifyTradeNum(e))return 0;const{qty:t=0,original_qty:r=0,commission:n=0}=this._strategy.orders[e];return n*t/r}entry_bar_index({trade_num:e}){if(this._verifyTradeNum(e))return this._strategy.orders[e].in_index}entry_comment({trade_num:e}){if(!this._verifyTradeNum(e))return"";const{comment:t,id:r}=this._strategy.orders[e];return t||r}entry_id({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.orders[e].id:""}entry_price({trade_num:e}){if(this._verifyTradeNum(e))return this._strategy.orders[e].in_price}entry_time({trade_num:e}){if(this._verifyTradeNum(e))return this._strategy.orders[e].in_time}max_drawdown({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.orders[e].trading_loss:0}max_drawdown_percent({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.orders[e].trading_loss_percent:0}max_runup({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.orders[e].max_profit:0}max_runup_percent({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.orders[e].max_profit_percent:0}profit({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.orders[e].profit:0}profit_percent({trade_num:e}){return this._verifyTradeNum(e)?this._strategy.orders[e].profit_percent:0}size({trade_num:e}){if(!this._verifyTradeNum(e))return 0;const{qty:t=0,direction:r}=this._strategy.orders[e];return r===gt.long?t:-t}_verifyTradeNum(e){if(typeof e!="number"||e<0)return!1;const t=this._strategy.orders.length;return!(e>=t)}}class FD{constructor(e,t){U(this,"_strategy");U(this,"_errorListener");this._strategy=e,this._errorListener=t}allow_entry_in({value:e},t){this._paramVerfiy(e,t,"strategy.risk.allow_entry_in",Object.values(gt),"value"),this._strategy.updateRisk({allow_entry_in:e})}max_cons_loss_days({count:e}){this._strategy.updateRisk({max_cons_loss_days:e})}max_drawdown({value:e,type:t},r){this._paramVerfiy(t,r,"strategy.risk.max_drawdown",[Rt.percentOfEquity,Rt.cash],"type"),t===Rt.percentOfEquity&&(e=e>100?100:e),this._strategy.updateRisk({max_drawdown:e,max_drawdown_type:t})}max_intraday_filled_orders({count:e}){this._strategy.updateRisk({max_intraday_filled_orders:e})}max_intraday_loss({value:e,type:t},r){this._paramVerfiy(t,r,"strategy.risk.max_intraday_loss",[Rt.percentOfEquity,Rt.cash],"type"),t===Rt.percentOfEquity&&(e=e>100?100:e),this._strategy.updateRisk({max_intraday_loss:e,max_intraday_loss_type:t})}max_position_size({contracts:e}){this._strategy.updateRisk({max_position_size:e})}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(or(Kt.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ve.Error)}}let BD=class{constructor(e,t,r,n){U(this,"_variables");U(this,"_options");U(this,"_totalChangeCapital");U(this,"_historyOrder");U(this,"_orders");U(this,"_pendingOrders");U(this,"_mintick");U(this,"_funcOptions");U(this,"_pendingCloseOrders");U(this,"_errorListener");U(this,"_risk");U(this,"_opentrades");U(this,"_closedtrades");U(this,"_riskNamespace");this._variables=e,this._errorListener=n,this._options={overlay:!1,format:Je.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:Rt.fixed,default_qty_value:1,initial_capital:1e6,currency:zl.NONE,slippage:0,commission_type:Tr.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=t,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 CD(this),this._closedtrades=new AD(this),this._riskNamespace=new FD(this,n)}get orders(){return[...this._orders]}get historyOrders(){return[...this._historyOrder]}get _orderProfit(){return this._orders.reduce((e,t)=>e+(t.profit||0),0)}get _freezeCapital(){const{close:e}=this._variables;return this._orders.reduce((t,r)=>t+e*(r.qty||0),0)}get opentrades(){return this._opentrades}get closedtrades(){return this._closedtrades}get risk(){return this._riskNamespace}updateOptions(e){Object.assign(this._options,e),this._maxConsLossDaysVerify(),this._pendingOrderHandle(),this._maxIntradayFilledOrdersVerify(),this._ordersHandle(),!this._options.process_orders_on_close&&this._calcLiquidate()}updateRisk(e){Object.assign(this._risk,e)}endExecution(){this._calcProfitAndLoss(),this._variables.strategy.update(),this._maxDrawdownVerify(),this._maxIntradayLoss(),this._pendingCloseOrderHandle(),this._options.process_orders_on_close&&this._calcLiquidate()}_maxIntradayLoss(){var v;const{max_intraday_loss:e,max_intraday_loss_type:t,isDisabledOpen:r}=this._risk;if(e===void 0||!t||r)return;const{high:n,low:i,time_tradingday:a,time:u,strategy:{netprofit:l,initial_capital:c}}=this._variables;let{preNetprofit:h=0}=this._risk;u===a&&(h=l,this._risk.preNetprofit=l,this._risk.isTemporaryBan=!1);let d=h-l;d+=this._orders.reduce((x,_)=>{const{in_price:y,direction:m,qty:w=0,commission:D=0,original_qty:C=0}=_,E=m===gt.long?1:-1,F=(n-y)*w,B=(i-y)*w,M=E===1?-B:F;return x+M+w/C*D},0);let p=!1;switch(t){case Rt.cash:p=e<d;break;case Rt.percentOfEquity:const x=d/(c+l)*100;p=e<x;break}if(p){this._risk.isTemporaryBan=!0;const x=(v=this._orders[0])==null?void 0:v.direction;this._closeOrders(this._orders,x===gt.long?i:n,"Close Position (Max intraday Loss)"),this._pendingOrders=[]}}_maxIntradayFilledOrdersVerify(){const{max_intraday_filled_orders:e,intradayOrders:t=0,isDisabledOpen:r}=this._risk;if(e===void 0||r)return;const{time:n,time_tradingday:i,open:a}=this._variables;n===i&&(this._risk.intradayOrders=0,this._risk.isTemporaryBan=!1),e<=t&&(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:e,lossDays:t=0,isDisabledOpen:r,totalProfit:n=0}=this._risk;if(e===void 0||r)return;const{time:i,time_tradingday:a,strategy:u,open:l}=this._variables;let c=t;if(i===a){const h=u.netprofit+u.openprofit;h<n?c=0:c++,Object.assign(this._risk,{lossDays:c,totalProfit:h})}e<=c&&this._riskTouchOff(l,"Close Position (Max consecutive loss days)")}_maxDrawdownVerify(){var n;const{max_drawdown:e,max_drawdown_type:t,isDisabledOpen:r}=this._risk;if(!r&&e!==void 0&&t){const{max_drawdown:i,max_drawdown_percent:a}=this._variables.strategy;let u=!1;switch(t){case Rt.percentOfEquity:u=a<i;break;case Rt.cash:u=e<i;break}if(u){const{high:l,low:c}=this._variables,h=(n=this._orders[0])==null?void 0:n.direction;this._riskTouchOff(h===gt.long?l:c,"Close Position (Max Drawdown)")}}}_riskTouchOff(e,t){this._risk.isDisabledOpen=!0,this._closeOrders(this._orders,e,t),this._pendingOrders=[]}strategy(e,t){this._variables.bar_index||(this._paramVerfiy(e.format,t,"strategy",[Je.inherit,Je.price,Je.percent,Je.volume],"format"),this._paramVerfiy(e.default_qty_type,t,"strategy",Object.values(Rt),"default_qty_type"),this._paramVerfiy(e.commission_type,t,"strategy",Object.values(Tr),"commission_type"),this._options={...e},this._variables.updateMaxLength(e),Object.assign(this._funcOptions,{strategy:this._options,scriptType:"strategy"}))}order(e,t){this._risk.isDisabledOpen||(this._paramVerfiy(e.oca_type,t,"strategy.order",Object.values(vn),"oca_type"),this._orderHandle(e))}entry(e,t){this._risk.isDisabledOpen||(this._paramVerfiy(e.oca_type,t,"strategy.entry",Object.values(vn),"oca_type"),this._entryHandle(e))}close(e){if(!this._orders.length)return;const{immediately:t}=e;t||this._options.process_orders_on_close?this._pendingCloseOrders.push({...e,place_order_type:"close"}):this._pendingOrders.push({...e,place_order_type:"close"})}close_all(e){if(typeof e=="string"&&(e={}),!this._orders.length)return;const{immediately:t}=e;t||this._options.process_orders_on_close?this._pendingCloseOrders.push({...e,place_order_type:"close_all"}):this._pendingOrders.push({...e,place_order_type:"close_all"})}cancel({id:e}){this._pendingOrders=this._pendingOrders.filter(t=>!(t.id===e&&t.place_order_type!=="close"))}cancel_all(){this._pendingOrders=this._pendingOrders.filter(e=>e.place_order_type==="close_all")}exit(e,t){this._exit(e,t)}convert_to_account({value:e}){return e}convert_to_symbol({value:e}){return e}default_entry_qty({fill_price:e}){return e?this._calcDefaultQty(e):0}_calcDefaultQty(e){const{default_qty_type:t=Rt.fixed,default_qty_value:r=1,initial_capital:n}=this._options;switch(t){case Rt.fixed:return r;case Rt.cash:return r/e;case Rt.percentOfEquity:return(n+this._orderProfit+this._totalChangeCapital)*r/100/e}}_getCapital(e,t){const{margin_long:r=0,margin_short:n=0}=this._options;return r<100&&r>0&&e===1?t=t*100/r:n<=100&&n>0&&e===-1&&(t=t*100/n),t}_calcProfitAndLoss(){const{high:e,low:t,close:r}=this._variables;for(const n of this._orders){const{in_price:i,qty:a=0,direction:u}=n,l=u===gt.long?1:-1,c=(r-i)*l*a,h=(e-i)*a,d=(t-i)*a,p=l===1?h:-d,v=l===1?-d:h;this._calcOrderPercent(n,c,p,v)}}_calcOrderPercent(e,t,r,n){const{commission_value:i}=this._options,{close:a}=this._variables,{original_qty:u=0,qty:l=0,in_price:c,max_profit:h=0,trading_loss:d=0}=e;let{commission:p=0}=e;const v=c*l;if(i){const x=this._getCommission(a,l);t=t-x,p=p*l/u,r-=p,n+=p}r=Math.max(r,h),n=Math.min(n,d),Object.assign(e,{profit:t-p,total_profit:this._totalChangeCapital+t,max_profit:r,trading_loss:n,profit_percent:t/v*100,max_profit_percent:r/v*100,trading_loss_percent:n/v*100})}_calcLiquidate(){if(!this._orders.length)return;const{high:e,low:t}=this._variables,{initial_capital:r,margin_long:n=0,margin_short:i=0,commission_value:a=0}=this._options,u=this._orders[0].direction===gt.long?1:-1,l=u===1?t:e,c=(u===1?n:i)/100;if(c<=0)return;const[h,d,p]=this._orders.reduce((m,w)=>{let[D,C,E]=m;const{in_price:F,qty:B=0,original_qty:M=0,commission:O=0}=w,A=F*B,N=l*B;if(D+=A,C+=N,a){const T=this._getCommission(l,B);E+=T+B/M*O}return[D,C,E]},[0,0,0]),v=u*(d-h),_=r+this._totalChangeCapital+v-p-d*c;if(_>=0)return;const y=Math.trunc(_/c/l)*4;this._marginCallOrders(l,y,"Margin Call")}_marginCallOrders(e,t,r){const{close_entries_rule:n="FIFO"}=this._options;if(n==="FIFO"){this._processOrders(this._orders,e,t*this._orders.length,r,r);return}for(const i of this.orders)this._processOrder(i,e,t,r,r);this._orders=this._orders.filter(i=>!i.isDeal),this._variables.strategy.updateOrders(this._orders)}_orderHandle(e){const{process_orders_on_close:t,slippage:r=0}=this._options,{orders:n,isMarketPrice:i,quantities:a,close:u,price:l,activePrice:c}=this._orderArgsParse(e),h=e.direction===gt.long?1:-1;if(a<=0)return;let d=a;if(i&&t){if(n.length){const _=this._processOrders(n,u,d,e.id,e.comment);if(_<=0)return;d=_}const v=u+h*r*this._mintick;if(!this._judgeCapitalEnough(d,v,h))return;this._ocaGroupVerify(d,e.oca_name,e.oca_type),this._calcCurrentOrder({...e,in_price:v,in_index:this._variables.bar_index,in_time:this._variables.time,qty:d,place_order_type:"order"});return}this._judgeCapitalEnough(a,l,h)&&this._addPendingOrders(e,l,d,i,c)}_judgeCapitalEnough(e,t,r){if(e<=0)return!1;const{margin_long:n=0,margin_short:i=0}=this._options;if((n===0||n===100)&&r===1||i===0&&r===-1)return!0;const u=this._getCapital(r,this._options.initial_capital+this._orderProfit+this._totalChangeCapital)-this._freezeCapital;return e*t<=u}_ocaGroupVerify(e,t,r){if(!t||!r||r===vn.none)return!1;let n=!1;switch(r){case vn.cancel:this._pendingOrders=this._pendingOrders.filter(i=>{if(i.oca_name===t)i.isCancel=!0,n=!0;else return!0});break;case vn.reduce:this._pendingOrders=this._pendingOrders.filter(i=>{const{qty:a=0,oca_name:u}=i;if(t===u){const l=a-e;return n=!0,l<=0?(i.isCancel=!0,!1):(i.qty=l,!0)}else return!0});break}return n}_processOrders(e,t,r,n,i){let a=r;for(const u of e)if(a=this._processOrder(u,t,a,n,i),a<=0)break;return this._orders=this._orders.filter(u=>!u.isDeal),this._variables.strategy.updateOrders(this._orders),a}_addPendingOrders(e,t,r,n,i){const a=this._pendingOrders.find(u=>u.id===e.id&&!u.isMarketPrice);if(a)Object.assign(a,{...e,in_price:t,isMarketPrice:n,qty:r,active_price:i});else{const u={...e,in_price:t,isMarketPrice:n,qty:r,active_price:i,place_order_type:"order"};this._pendingOrders.push(u)}}_orderArgsParse(e){const{direction:t,qty:r,stop:n}=e;let i=e.limit||0;const{close:a}=this._variables;let u=a,l=!1,c;const h=t===gt.long?1:-1,d=n&&(n-a)*h>0,{backtest_fill_limits_assumption:p=0}=this._options;p>0&&i&&(i-=p*this._mintick*h);const v=i&&(i-a)*h<0;d&&v?(c=n,u=i):d?u=n:v?u=i:l=!0;const x=r||this._calcDefaultQty(u)||1;return{orders:this._orders.filter(y=>y.direction!==t),isMarketPrice:l,activePrice:c,quantities:x,close:a,price:u}}_entryHandle(e){const{process_orders_on_close:t}=this._options,{orders:r,isMarketPrice:n,quantities:i,close:a,price:u,activePrice:l}=this._orderArgsParse(e);if(i<=0)return;if(r.length&&n&&t){this._entryOrder(r,a,i,e);return}this._judgeCapitalEnough(i,a,e.direction===gt.long?1:-1)&&this._addPendingEntry(e,u,i,n,l)}_entryOrder(e,t,r,n){const{time:i,bar_index:a}=this._variables,{slippage:u=0}=this._options,{oca_name:l,oca_type:c,direction:h,comment:d,isMarketPrice:p,id:v}=n,x=h===gt.long?1:-1;if(this._closeOrders(e,t,v,d),r=this._getAvailablePositionSize(r,h),r<=0)return;t=t+u*this._mintick*x;const _={...n,in_price:t,original_qty:r,qty:r,in_index:a,in_time:i,place_order_type:"entry"};if(p){this._calcCurrentOrder(_);return}const{pendingOrders:y,orders:m}=this._getEntryOrders(h),w=y.length+m.length;w&&w>=(this._options.pyramiding||0)||!this._judgeCapitalEnough(r,t,x)||(this._ocaGroupVerify(r,l,c),this._calcCurrentOrder(_))}_getAvailablePositionSize(e,t){const{max_position_size:r,allow_entry_in:n}=this._risk;if(n&&n!==gt.all&&n!==t)return 0;if(r===void 0)return e;const i=this._orders.reduce((a,u)=>a+(u.qty||0),0);return i?i+e>r?0:e:e>r?e-r:0}_getEntryOrders(e){const t=this._pendingOrders.filter(n=>["entry","order"].includes(n.place_order_type)&&n.direction===e),r=this._orders.filter(n=>n.direction===e);return{pendingOrders:t,orders:r}}_addPendingEntry(e,t,r,n,i){if(r=this._getAvailablePositionSize(r,e.direction),r<=0)return;const{pendingOrders:a,orders:u}=this._getEntryOrders(e.direction),l=a.length+u.length,c=a.find(h=>h.id===e.id&&h.place_order_type==="entry");if(c)Object.assign(c,{...e,in_price:t,isMarketPrice:n,qty:r,active_price:i});else if(!l||l<(this._options.pyramiding||1)){const h={...e,in_price:t,isMarketPrice:n,qty:r,active_price:i,place_order_type:"entry"};this._pendingOrders.push(h)}}_closeAllOrders(e,t){const{comment:r}=e,{bar_index:n}=this._variables,i=this._orders.filter(a=>a.in_index!==n);i.length&&(this._closeOrders(i,t,"Close position order",r),this._orders=[],this._variables.strategy.updateOrders(this._orders))}_closeOrders(e,t,r,n){for(const i of e)this._closeOrder(i,t,r,n);this._orders=this._orders.filter(i=>!i.isDeal),this._variables.strategy.updateOrders(this._orders)}_closeOrder(e,t,r,n){const{time:i,bar_index:a}=this._variables,{slippage:u=0}=this._options,{in_price:l,qty:c=0,direction:h}=e,d=h===gt.long?1:-1;t=t-d*u*this._mintick,e.isDeal=!0;const p=(t-l)*d*c,v={...e,out_price:t,out_id:r,out_index:a,out_time:i,out_comment:n,out_qty:c,profit:p};this._calcPercent(v),this._risk.intradayOrders+=1,this._historyOrder.push(v),this._variables.strategy.updateHistoryOrders(this._historyOrder)}_ordersHandle(){const e=this._orders.filter(a=>a.place_order_type==="exit"&&!a.hasExit);if(!e.length)return;const{open:t,low:r,high:n,close:i}=this._variables;for(const a of e){const{stop:u,limit:l,trail_stop_price:c,isMarketPriceLimit:h,isMarketPriceStop:d,direction:p,id:v,out_comment:x,active_price:_,trail_offset:y=0,out_qty:m,comment_loss:w,comment_profit:D,comment_trailing:C}=a;let E=c;const F=p===gt.long?1:-1;let B,M=x;if(h||d?B=t:(l&&r<=l&&n>=l&&(M=D||x,B=l),u&&r<=u&&n>=u&&(B=E?(u-E)*F>0?u:E:u,M=(E===B?C:w)||x)),B)this._processExitOnClose(a,B,{from_entry:v,comment:M,qty:m});else{let O=!1;if(_&&_<=n&&_>=r&&(E=_-y*F*this._mintick,(E-i)*F>=0&&(a.isMarketPriceStop=!0,this._options.process_orders_on_close&&(B=E)),O=!0,a.trail_stop_price=E),E)if((E-t)*F>=0&&!O)B=E;else{const A=(F===1?n:r)-y*F*this._mintick;F===1?E<t&&E>=r&&A>E&&A<i?B=E:A>E?(E=A,A>=i&&(B=A)):E<=n&&r<=E&&(B=E):E>t&&E<=n&&A<E&&A>i?B=E:A<E?(E=A,A<=i&&(B=A)):E<=n&&r<=E&&(B=E),a.trail_stop_price=E}B&&this._processExitOnClose(a,B,{from_entry:v,comment:C||x,qty:m})}}}_pendingOrderHandle(){if(!this._pendingOrders.length)return;const e=[],t=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:i,place_order_type:a}=n;if(i)continue;let u;switch(a){case"entry":u=this._entryOrderHandle(n);break;case"order":u=this._orderOrderHandle(n);break}u&&e.push(u)}for(const n of t){const i=this._exitOrderHandle(n);i&&e.push(i)}this._pendingOrders=e}_pendingCloseOrderHandle(){if(!this._pendingCloseOrders.length)return;const e=this._pendingCloseOrders.filter(n=>n.place_order_type==="exit"),t=this._pendingCloseOrders.filter(n=>["close","close_all"].includes(n.place_order_type||"")),{close:r}=this._variables;for(const n of t)switch(n.place_order_type){case"close":this._closeOrderHandle(n,!0);break;case"close_all":this._closeAllOrders(n,r);break}for(const n of e){const{from_entry:i}=n,a=this._orders.filter(u=>!i||u.id===i&&(u.isMarketPriceLimit||u.isMarketPriceStop));for(const u of a)this._processExitOnClose(u,u.limit||u.stop||u.trail_stop_price||r,n)}this._pendingCloseOrders=[]}_entryOrderHandle(e){const{open:t,low:r,high:n}=this._variables,{isMarketPrice:i,qty:a=0,in_price:u,direction:l,active_price:c}=e;if(c&&n>=c&&r<=c)return delete e.active_price,e;let h=u;if(i&&(h=t),h<=n&&h>=r){const d=this._orders.filter(p=>p.direction!==l);this._entryOrder(d,h,a,e)}else return e}_orderOrderHandle(e){const{open:t,low:r,high:n,time:i,bar_index:a}=this._variables,{slippage:u=0}=this._options,{isMarketPrice:l,qty:c=0,in_price:h,direction:d,comment:p,oca_name:v,oca_type:x,active_price:_,id:y}=e;if(_&&n>=_&&r<=_)return delete e.active_price,e;let m=h,w=c;if(l&&(m=t),m<=n&&m>=r){const D=this._orders.filter(E=>E.direction!==d);if(D.length&&(w=this._processOrders(D,m,c,y,p),w<=0))return;const C=d===gt.long?1:-1;this._ocaGroupVerify(w,v,x),this._calcCurrentOrder({...e,in_price:m+C*u*this._mintick,in_index:a,in_time:i,qty:w});return}else return e}_closeOrderHandle(e,t){const{id:r,qty:n,qty_percent:i=100,comment:a}=e,{bar_index:u}=this._variables,l=this._orders.filter(v=>v.id===r&&v.in_index!==u&&(!v.close_qty||v.close_qty<(v.qty||0)));if(!l.length)return;let c=0;if(n?c=n:(c=l.reduce((v,x)=>v+(x.qty||0),c),c=i/100*c),c<=0)return;const{open:h,close:d}=this._variables;let p=c;for(const v of l){const{qty:x=0}=v;p<x?v.close_qty=p:(v.close_qty=x,p-=x)}this._processOrders(this._options.close_entries_rule==="ANY"?l:this._orders,t?d:h,c,`Close entry(s) order ${r}`,a)}_exitOrderHandle(e){const{from_entry:t}=e,r=this._orders.filter(n=>(!t||t===n.id)&&!n.hasExit);if(!(r.length&&!this._ordersToExit(r,e)))return e}_exit(e,t){const{profit:r,loss:n,stop:i,limit:a,trail_offset:u,trail_price:l,trail_points:c,from_entry:h="",id:d}=e;if(this._isNaN(r)&&this._isNaN(n)&&this._isNaN(i)&&this._isNaN(a)&&(this._isNaN(u)||this._isNaN(c)&&this._isNaN(l))){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'",t,Ve.Error);return}const p={...e,place_order_type:"exit"},v=this._orders.filter(y=>(!h||h===y.id)&&!y.hasExit),x=this._pendingOrders.filter(y=>!h||h===y.id);if(v.length){if(!this._ordersToExit(v,p))return}else if(!x.length)return;const _=this._pendingOrders.find(y=>y.id===d);_?Object.assign(_,{...e}):this._pendingOrders.push(p)}_ordersToExit(e,t){const{qty:r,qty_percent:n=100,id:i,comment:a,comment_loss:u,comment_profit:l,comment_trailing:c}=t;let h=r,d=!1;t.comment=a||i;for(const p of e){const{qty:v=0}=p,x=p.direction===gt.long?1:-1;h=r?r>=v?v:r:n/100*v,p.out_qty=h,h<v&&(d=!0),Object.assign(p,{out_comment:a||i,comment_loss:u,comment_profit:l,comment_trailing:c}),!(this._stopProfit(p,x,{...t,qty:h})||this._stopLoss(p,x,{...t,qty:h})||this._trailStopLoss(p,x,{...t,qty:h}))&&(p.place_order_type="exit")}return d}_addExitPendingCloseOrders(e){e.place_order_type="exit";const t=this._pendingCloseOrders.find(r=>r.id===e.id);t?Object.assign(t,{...e}):this._pendingCloseOrders.push(e)}_stopProfit(e,t,r){const{limit:n,profit:i,comment_profit:a,comment:u}=r;let l=n;const{close:c}=this._variables,{in_price:h}=e,{process_orders_on_close:d}=this._options;if(!this._isNaN(i)&&this._isNaN(n)&&(l=h+t*i*this._mintick),e.limit=l,l&&(l-c)*t<=0&&(e.isMarketPriceLimit=!0,r.comment=a||u,Object.assign(e,{out_comment:r.comment}),l=c,d))return this._addExitPendingCloseOrders(r),!0}_stopLoss(e,t,r){const{stop:n,loss:i,comment_loss:a,comment:u}=r;let l=n;const{close:c}=this._variables,{in_price:h}=e,{process_orders_on_close:d}=this._options;if(!this._isNaN(i)&&this._isNaN(n)&&(l=h-t*i*this._mintick),e.stop=l,l&&(l-c)*t>=0&&(e.isMarketPriceStop=!0,r.comment=a||u,Object.assign(e,{out_comment:r.comment}),l=c,d))return this._addExitPendingCloseOrders(r),!0}_trailStopLoss(e,t,r){const{trail_offset:n,trail_price:i,trail_points:a,comment_trailing:u,comment:l}=r;if(!this._isNaN(n)){const{close:c}=this._variables,{in_price:h}=e,{process_orders_on_close:d}=this._options;let p;if(this._isNaN(i)?this._isNaN(a)||(p=h+a*t*this._mintick):p=i,e.trail_offset=n,p&&(p-c)*t<=0){const v=c-n*t*this._mintick;if((v-c)*t>=0&&(e.trail_stop_price=c,e.isMarketPriceStop=!0,r.comment=u||l,Object.assign(e,{out_comment:r.comment}),d))return this._addExitPendingCloseOrders(r),!0;e.trail_stop_price=v}e.active_price=p}}_processExitOnClose(e,t,r){const{qty:n=0,comment:i,id:a}=r,{close_entries_rule:u="FIFO"}=this._options;if(u==="FIFO"){const l=this._processExitOrders(this._orders,t,n,a,i);l&&!l.hasExit?(l.hasExit=!0,Object.assign(e,{trail_stop_price:l.trail_stop_price,stop:l.stop,limit:l.limit,trail_offset:l.trail_offset,active_price:l.active_price})):l&&(e.hasExit=!0)}else e.hasExit=!0,this._processOrders([e],t,n,a,i)}_processExitOrders(e,t,r,n,i){let a=r,u;for(const l of e)if(u=l,a=this._processOrder(l,t,a,n,i),a<=0||!l.hasExit)break;return this._orders=this._orders.filter(l=>!l.isDeal),this._variables.strategy.updateOrders(this._orders),u}_processOrder(e,t,r,n,i){const{time:a,bar_index:u}=this._variables,{slippage:l=0}=this._options,{in_price:c,qty:h=0,max_profit:d=0,trading_loss:p=0,direction:v,commission:x=0,original_qty:_=0}=e,y=v===gt.long?1:-1;if(t=t-y*l*this._mintick,r<h){const m=h-r,w=(t-c)*y*r,D=d/h*r,C=p/h*r;this._calcPercent({...e,out_price:t,out_id:n,out_index:u,out_time:a,out_comment:i,profit:w,out_qty:r,max_profit:D,trading_loss:C});const E=(t-c)*y*m-x*m/_;Object.assign(e,{qty:m,profit:E,max_profit:d-D,trading_loss:p-C,total_profit:this._totalChangeCapital+E}),r=0}else{e.isDeal=!0;const m=(t-c)*y*h;this._calcPercent({...e,out_price:t,out_id:n,out_index:u,out_time:a,out_comment:i,out_qty:h,profit:m}),r-=h}return r}_calcPercent(e){const{commission_value:t}=this._options,{in_price:r,out_qty:n=0,out_price:i=0,original_qty:a=0}=e;let{profit:u=0,max_profit:l=0,trading_loss:c=0,commission:h=0}=e;l=l<0?0:l;const d=r*n;if(this._totalChangeCapital+=u,t){const p=this._getCommission(i,n);this._totalChangeCapital-=p,h=h*n/a+p,u=u-h,Object.assign(e,{commission:h,profit:u,max_profit:l})}Object.assign(e,{total_profit:this._totalChangeCapital,profit_percent:u/d*100,max_profit_percent:l/d*100,trading_loss_percent:c/d*100}),this._risk.intradayOrders+=1,this._historyOrder.push(e),this._variables.strategy.updateHistoryOrders(this._historyOrder)}_getCommission(e,t){const{commission_value:r=0,commission_type:n}=this._options,i=e*t;let a=0;switch(n){case Tr.percent:a=i*r/100;break;case Tr.cashPerContract:a=t*r;break;case Tr.cashPerOrder:a=r;break}return a}_calcCurrentOrder(e){const{commission_value:t}=this._options,{in_price:r,qty:n=0,max_profit:i=0,trading_loss:a=0}=e;let{profit:u=0}=e;const l=r*n;if(t){const c=this._getCommission(r,n);this._totalChangeCapital-=c,u=u-c,Object.assign(e,{commission:c,profit:u,total_profit:this._totalChangeCapital})}Object.assign(e,{original_qty:n,profit_percent:u/l*100,max_profit_percent:i/l*100,trading_loss_percent:a/l*100}),this._risk.intradayOrders+=1,this._orders.push(e),this._variables.strategy.updateOrders(this._orders)}_isNaN(e){return e===void 0||isNaN(e)}_paramVerfiy(e="",t,r,n,i){e&&!n.includes(e)&&this._errorListener.addError(or(Kt.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ve.Error)}};var Hl={exports:{}};(function(s,e){(function(t,r){s.exports=r()})(ye,function(){return function(t,r,n){r.prototype.isBetween=function(i,a,u,l){var c=n(i),h=n(a),d=(l=l||"()")[0]==="(",p=l[1]===")";return(d?this.isAfter(c,u):!this.isBefore(c,u))&&(p?this.isBefore(h,u):!this.isAfter(h,u))||(d?this.isBefore(c,u):!this.isAfter(c,u))&&(p?this.isAfter(h,u):!this.isBefore(h,u))}}})})(Hl);var MD=Hl.exports,ND=tt(MD),jl={exports:{}};(function(s,e){(function(t,r){s.exports=r()})(ye,function(){return function(t,r,n){var i=r.prototype,a=function(p){var v,x=p.date,_=p.utc,y={};if(!((v=x)===null||v instanceof Date||v instanceof Array||i.$utils().u(v)||v.constructor.name!=="Object")){if(!Object.keys(x).length)return new Date;var m=_?n.utc():n();Object.keys(x).forEach(function(O){var A,N;y[A=O,N=i.$utils().p(A),N==="date"?"day":N]=x[O]});var w=y.day||(y.year||y.month>=0?1:m.date()),D=y.year||m.year(),C=y.month>=0?y.month:y.year||y.day?0:m.month(),E=y.hour||0,F=y.minute||0,B=y.second||0,M=y.millisecond||0;return _?new Date(Date.UTC(D,C,w,E,F,B,M)):new Date(D,C,w,E,F,B,M)}return x},u=i.parse;i.parse=function(p){p.date=a.bind(this)(p),u.bind(this)(p)};var l=i.set,c=i.add,h=i.subtract,d=function(p,v,x,_){_===void 0&&(_=1);var y=Object.keys(v),m=this;return y.forEach(function(w){m=p.bind(m)(v[w]*_,w)}),m};i.set=function(p,v){return v=v===void 0?p:v,p.constructor.name==="Object"?d.bind(this)(function(x,_){return l.bind(this)(_,x)},v,p):l.bind(this)(p,v)},i.add=function(p,v){return p.constructor.name==="Object"?d.bind(this)(c,p,v):c.bind(this)(p,v)},i.subtract=function(p,v){return p.constructor.name==="Object"?d.bind(this)(c,p,v,-1):h.bind(this)(p,v)}}})})(jl);var SD=jl.exports,OD=tt(SD),Yl={exports:{}};(function(s,e){(function(t,r){s.exports=r()})(ye,function(){var t,r,n=1e3,i=6e4,a=36e5,u=864e5,l=/\[([^\]]+)]|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,c=31536e6,h=2628e6,d=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,p={years:c,months:h,days:u,hours:a,minutes:i,seconds:n,milliseconds:1,weeks:6048e5},v=function(F){return F instanceof C},x=function(F,B,M){return new C(F,M,B.$l)},_=function(F){return r.p(F)+"s"},y=function(F){return F<0},m=function(F){return y(F)?Math.ceil(F):Math.floor(F)},w=function(F){return Math.abs(F)},D=function(F,B){return F?y(F)?{negative:!0,format:""+w(F)+B}:{negative:!1,format:""+F+B}:{negative:!1,format:""}},C=function(){function F(M,O,A){var N=this;if(this.$d={},this.$l=A,M===void 0&&(this.$ms=0,this.parseFromMilliseconds()),O)return x(M*p[_(O)],this);if(typeof M=="number")return this.$ms=M,this.parseFromMilliseconds(),this;if(typeof M=="object")return Object.keys(M).forEach(function(k){N.$d[_(k)]=M[k]}),this.calMilliseconds(),this;if(typeof M=="string"){var T=M.match(d);if(T){var R=T.slice(2).map(function(k){return k!=null?Number(k):0});return this.$d.years=R[0],this.$d.months=R[1],this.$d.weeks=R[2],this.$d.days=R[3],this.$d.hours=R[4],this.$d.minutes=R[5],this.$d.seconds=R[6],this.calMilliseconds(),this}}return this}var B=F.prototype;return B.calMilliseconds=function(){var M=this;this.$ms=Object.keys(this.$d).reduce(function(O,A){return O+(M.$d[A]||0)*p[A]},0)},B.parseFromMilliseconds=function(){var M=this.$ms;this.$d.years=m(M/c),M%=c,this.$d.months=m(M/h),M%=h,this.$d.days=m(M/u),M%=u,this.$d.hours=m(M/a),M%=a,this.$d.minutes=m(M/i),M%=i,this.$d.seconds=m(M/n),M%=n,this.$d.milliseconds=M},B.toISOString=function(){var M=D(this.$d.years,"Y"),O=D(this.$d.months,"M"),A=+this.$d.days||0;this.$d.weeks&&(A+=7*this.$d.weeks);var N=D(A,"D"),T=D(this.$d.hours,"H"),R=D(this.$d.minutes,"M"),k=this.$d.seconds||0;this.$d.milliseconds&&(k+=this.$d.milliseconds/1e3,k=Math.round(1e3*k)/1e3);var z=D(k,"S"),L=M.negative||O.negative||N.negative||T.negative||R.negative||z.negative,G=T.format||R.format||z.format?"T":"",H=(L?"-":"")+"P"+M.format+O.format+N.format+G+T.format+R.format+z.format;return H==="P"||H==="-P"?"P0D":H},B.toJSON=function(){return this.toISOString()},B.format=function(M){var O=M||"YYYY-MM-DDTHH:mm:ss",A={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(l,function(N,T){return T||String(A[N])})},B.as=function(M){return this.$ms/p[_(M)]},B.get=function(M){var O=this.$ms,A=_(M);return A==="milliseconds"?O%=1e3:O=A==="weeks"?m(O/p[A]):this.$d[A],O||0},B.add=function(M,O,A){var N;return N=O?M*p[_(O)]:v(M)?M.$ms:x(M,this).$ms,x(this.$ms+N*(A?-1:1),this)},B.subtract=function(M,O){return this.add(M,O,!0)},B.locale=function(M){var O=this.clone();return O.$l=M,O},B.clone=function(){return x(this.$ms,this)},B.humanize=function(M){return t().add(this.$ms,"ms").locale(this.$l).fromNow(!M)},B.valueOf=function(){return this.asMilliseconds()},B.milliseconds=function(){return this.get("milliseconds")},B.asMilliseconds=function(){return this.as("milliseconds")},B.seconds=function(){return this.get("seconds")},B.asSeconds=function(){return this.as("seconds")},B.minutes=function(){return this.get("minutes")},B.asMinutes=function(){return this.as("minutes")},B.hours=function(){return this.get("hours")},B.asHours=function(){return this.as("hours")},B.days=function(){return this.get("days")},B.asDays=function(){return this.as("days")},B.weeks=function(){return this.get("weeks")},B.asWeeks=function(){return this.as("weeks")},B.months=function(){return this.get("months")},B.asMonths=function(){return this.as("months")},B.years=function(){return this.get("years")},B.asYears=function(){return this.as("years")},F}(),E=function(F,B,M){return F.add(B.years()*M,"y").add(B.months()*M,"M").add(B.days()*M,"d").add(B.hours()*M,"h").add(B.minutes()*M,"m").add(B.seconds()*M,"s").add(B.milliseconds()*M,"ms")};return function(F,B,M){t=M,r=M().$utils(),M.duration=function(N,T){var R=M.locale();return x(N,{$l:R},T)},M.isDuration=v;var O=B.prototype.add,A=B.prototype.subtract;B.prototype.add=function(N,T){return v(N)?E(this,N,1):O.bind(this)(N,T)},B.prototype.subtract=function(N,T){return v(N)?E(this,N,-1):A.bind(this)(N,T)}}})})(Yl);var TD=Yl.exports,ID=tt(TD);ot.extend(Df),ot.extend(ND),ot.extend(OD),ot.extend(ID);class Zl{constructor(e,t,r){U(this,"array");U(this,"color");U(this,"math");U(this,"str");U(this,"map");U(this,"matrix");U(this,"timeframe");U(this,"ta");U(this,"input");U(this,"_variables");U(this,"_cacheData");U(this,"_options");U(this,"_errorListener");U(this,"_plots");U(this,"_plotshapes");U(this,"_alerts");U(this,"_bgColors");U(this,"_hlines");U(this,"_fills");U(this,"chart");U(this,"line");U(this,"label");U(this,"polyline");U(this,"box");U(this,"table");U(this,"linefill");U(this,"log");U(this,"runtime");U(this,"strategy");U(this,"request");U(this,"_count",0);var i;const n=((i=e.toString().split(".")[1])==null?void 0:i.length)||4;this._variables=t,this._errorListener=new cw,this.array=new g1(this._errorListener),this.math=new m1(n,this._errorListener),this.color=new Gx,this.str=new Ky(this._errorListener,n),this.map=new Xy(this._errorListener),this.timeframe=new Gy(t),this.matrix=new Vy(this._errorListener),this.ta=new Hx(t,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 Vx(t,this._errorListener,r),this._plots=new Map,this._plotshapes=new Map,this.chart={point:new Qy(t)},this.line=new DD(t,this._errorListener),this.label=new Jy(t,this._errorListener),this.polyline=new yD(t,this._errorListener),this.box=new ED(t,this._errorListener),this.table=new bD(t,this._errorListener),this.linefill=new wD(t),this.log=new uw(t),this.runtime=new fw(this._errorListener),this.strategy=new BD(this._variables,this._options,e,this._errorListener),this.request=new aw(this._variables,r)}get errors(){return this._errorListener.errors}get options(){const e=this.input.getInputs(),t=this._alerts.size?[...this._alerts.values()]:void 0;this._alerts.clear();const r=Object.keys(this._bgColors);let n;if(r.length){n={};for(const d of r)n[d]=[...this._bgColors[d].values()]}const i=this._hlines.size?[...this._hlines.values()]:void 0,a=this._fills.size?[...this._fills.values()]:void 0,u=this.log.logs.length?this.log.logs:void 0;this.log.clearLogs(),this._options.scriptType==="strategy"&&Object.assign(this._options,{orders:this.strategy.orders,historyOrders:this.strategy.historyOrders});const l=[...this._plots.values()],c=this._plotshapes.size>0?[...this._plotshapes.values()]:void 0,h=this._getDraws();return Object.assign(this._options,{inputs:e,plots:l,draws:h,alerts:t,colors:n,hlines:i,fills:a,logs:u,plotshapes:c})}_getDraws(){const{line:e,linefill:t,table:r,box:n,polyline:i,label:a}=this._variables,u={};return e.data.length&&(u.lines=e.data),t.data.length&&(u.linefills=t.data),r.data.length&&(u.tables=r.data),n.data.length&&(u.boxes=n.data),i.data.length&&(u.polylines=i.data),a.data.length&&(u.labels=a.data),Object.keys(u).length?u:void 0}updateOptions(e){const{inputs:t}=e;t&&t.length&&this.input.update(t)}update(e){const{barIndex:t}=e;this.strategy.updateOptions(),this.math.update(t)}endExecution(){this.strategy.endExecution()}library(e,t){if(!this._variables.bar_index){const r=/^[^\W\d\s][^\W\s]*$/,{title:n}=e;r.test(n)?(Zx.includes(n)||Yx.includes(n))&&this._errorListener.addError(or(Kt.libraryTitleIsKeywordErr,{name:n}),t,Ve.Error):this._errorListener.addError(Kt.libraryTitleErr,t,Ve.Error),this._options.scriptType="library",this._options.library=e}}indicator(e,t){if(!this._variables.bar_index){const{format:r}=e;this._paramVerfiy(r,t,"indicator",[Je.inherit,Je.percent,Je.price,Je.volume]),this._variables.updateMaxLength(e),this._options.scriptType="indicator",this._options.indicator=e}}_paramVerfiy(e="",t,r,n,i="format"){e&&!n.includes(e)&&this._errorListener.addError(or(Kt.paramsErr,{value:e,func:r,param:i,targetVal:`[${n.join(", ")}]`}),t,Ve.Error)}plot(e,t){const{series:r,color:n,seriesColors:i,...a}=e,{bar_index:u,time:l}=this._variables,c=`plot_${t}`,h=this._plots.get(c),d=(h==null?void 0:h.data)||[],p=r!==void 0&&isNaN(r)?void 0:r;if(d[u]={value:[l,p],itemStyle:{color:n}},i!=null&&i.length&&this._seriesColorHandle(e,h),!h){this._count++,this._paramVerfiy(e.format,t,"plot",[Je.percent,Je.price,Je.volume]);const v=n?[n]:void 0;this._plots.set(c,{editable:!0,...a,colors:v,data:d,id:c,zIndex:this._count})}return{type:"plot",key:c}}plotbar(e,t){const{open:r,close:n,low:i,high:a,color:u,seriesColors:l,...c}=e,{bar_index:h,time:d}=this._variables,p=`plotbar_${t}`,v=this._plots.get(p),x=(v==null?void 0:v.data)||[],_=n!==void 0&&isNaN(n)?void 0:n,y=r!==void 0&&isNaN(r)?void 0:r,m=i!==void 0&&isNaN(i)?void 0:i,w=a!==void 0&&isNaN(a)?void 0:a,D=[d,y,_,m,w];if(x[h]={value:D,itemStyle:{color:u}},l!=null&&l.length&&this._seriesColorHandle(e,v),!v){this._count++,this._paramVerfiy(e.format,t,"plotbar",[Je.percent,Je.price,Je.volume]);const C=u?[u]:void 0;this._plots.set(p,{editable:!0,...c,colors:C,data:x,id:p,zIndex:this._count})}}_verfiyArgs(e,t,r){const{size:n,format:i,location:a,style:u}=e;this._paramVerfiy(u,r,t,Object.values(pr),"style"),this._paramVerfiy(a,r,t,Object.values(_n),"location"),this._paramVerfiy(n,r,t,Object.values(ar),"size"),this._paramVerfiy(i,r,t,[Je.percent,Je.price,Je.volume],"format")}plotchar(e,t){const{series:r,color:n,seriesColors:i,textcolor:a,location:u=_n.abovebar,...l}=e,{bar_index:c,time:h,high:d,low:p}=this._variables,v=`plotchar_${t}`,x=this._plots.get(v),_=(x==null?void 0:x.data)||[],y={value:r,time:h,color:n,textcolor:a,low:p,high:d};_[c]=y,i!=null&&i.length&&this._seriesColorHandle(e,x),x||(this._count++,this._verfiyArgs(e,"plotchar",t),this._plots.set(v,{editable:!0,...l,location:u,data:_,id:v,zIndex:this._count}))}plotarrow(e,t){const{series:r,colorup:n,colordown:i,...a}=e,{bar_index:u}=this._variables,l=`plotarrow_${t}`,c=this._plots.get(l),h=(c==null?void 0:c.data)||[];h[u]={value:r!==void 0&&isNaN(r)?void 0:r,colorup:n,colordown:i},c||(this._count++,this._paramVerfiy(e.format,t,"plotarrow",[Je.percent,Je.price,Je.volume]),this._plots.set(l,{editable:!0,...a,data:h,id:l,zIndex:this._count}))}plotshape(e,t){const{series:r,seriesColors:n,color:i,textcolor:a,location:u=_n.abovebar,...l}=e,{bar_index:c,time:h,low:d,high:p}=this._variables,v=`plotshape_${t}`,x=this._plotshapes.get(v),_=(x==null?void 0:x.data)||[],y={value:r,color:i,textcolor:a,time:h,low:d,high:p};if(_[c]=y,n!=null&&n.length&&this._seriesColorHandle(e,x),!x){this._count++;const m=i?[i]:void 0;this._verfiyArgs(e,"plotshape",t),this._plotshapes.set(v,{editable:!0,...l,data:_,location:u,id:v,colors:m,zIndex:this._count})}}plotcandle(e,t){const{wickcolor:r,bordercolor:n,color:i,close:a,open:u,low:l,high:c,...h}=e,{bar_index:d,time:p}=this._variables,v=`plotcandle_${t}`,x=this._plots.get(v),_=(x==null?void 0:x.data)||[],y=a!==void 0&&isNaN(a)?void 0:a,m=u!==void 0&&isNaN(u)?void 0:u,w=l!==void 0&&isNaN(l)?void 0:l,D=c!==void 0&&isNaN(c)?void 0:c,C=[p,m,y,w,D];_[d]={value:C,wickcolor:r,bordercolor:n,color:i},x||(this._count++,this._paramVerfiy(e.format,t,"plotcandle",[Je.percent,Je.price,Je.volume]),this._plots.set(v,{editable:!0,...h,data:_,id:v,zIndex:this._count}))}hline(e,t){const r=`hline_${t}`;this._verifyDisplay(e.display,"hline",t);const n=e.display&&!e.display.length?Zt.none:Zt.all;return this._hlines.has(r)||(this._count++,this._hlines.set(r,{id:r,linewidth:1,editable:!0,display:n,...e,zIndex:this._count})),{type:"hline",key:r}}fill(e,t){var E,F,B,M,O,A,N,T,R,k;const{color:r,top_color:n,bottom_color:i,seriesColors:a,hline1:u,hline2:l,plot1:c,plot2:h,...d}=e,{bar_index:p,time:v}=this._variables,x=`fill_${t}`,_=this._fills.get(x),y=(_==null?void 0:_.data)||[];this._verifyDisplay(e.display,"fill",t);const m=e.display&&!e.display.length?Zt.none:Zt.all;let w,D,C="plot";if(u&&l)w=(E=this._hlines.get(u==null?void 0:u.key))==null?void 0:E.price,D=(F=this._hlines.get(l==null?void 0:l.key))==null?void 0:F.price,C="hline";else{const z=((B=this._plots.get(c==null?void 0:c.key))==null?void 0:B.data)||[],L=((M=this._plots.get(h==null?void 0:h.key))==null?void 0:M.data)||[];w=(A=(O=z[p])==null?void 0:O.value)==null?void 0:A[1],D=(T=(N=L[p])==null?void 0:N.value)==null?void 0:T[1]}if(y[p]={time:v,color:r,top_color:n,bottom_color:i,plot1:w,plot2:D},a!=null&&a.length&&this._seriesColorHandle(e,_),!_){this._count++;const z=((R=this._options.indicator)==null?void 0:R.explicit_plot_zorder)||((k=this._options.strategy)==null?void 0:k.explicit_plot_zorder),L=r?[r]:void 0,G=n?[n]:void 0,H=i?[i]:void 0;this._fills.set(x,{id:x,colors:L,top_colors:G,bottom_colors:H,display:m,data:y,type:C,editable:!0,fillgaps:!1,hline1:u,hline2:l,plot1:c,plot2:h,...d,zIndex:z?this._count:void 0})}}alert({message:e,freq:t=Vr.freqOncePerBar},r){const{bar_index:n,_isRealTimeBar:i,last_bar_index:a}=this._variables,u=`alert_${r}`,l=this._cacheData[u].barIndex;if(this._paramVerfiy(t,r,"alert",[Vr.freqAll,Vr.freqOncePerBar,Vr.freqOncePerBarClose]),t===Vr.freqOncePerBar&&n===l){this._alerts.delete(u);return}const c={message:e,freq:t,id:u,type:"alert"};if(i){t!==Vr.freqOncePerBarClose&&this._alerts.set(u,c),this._cacheData[u].barIndex=n;return}if(!i&&t===Vr.freqOncePerBarClose&&n===l&&a===n-1){this._alerts.set(u,c),this._cacheData[u].barIndex=n;return}this._alerts.delete(u)}alertcondition({condition:e,message:t,title:r},n){const{_isRealTimeBar:i}=this._variables,a=`alertcondition_${n}`;i&&e?this._alerts.set(a,{message:t,title:r,id:a,type:"alertcondition"}):this._alerts.delete(a)}barcolor(e,t){this._setColors(e,"barcolor",t)}bgcolor(e,t){this._setColors(e,"bgcolor",t)}_verifyDisplay(e=ql.all,t,r){e.length&&e.length<4&&this._errorListener.addError(or(Kt.displayErr,{func:t,values:"[display.none, display.all]"}),r,Ve.Error)}_setColors(e,t,r){const{color:n,seriesColors:i,...a}=e;this._verifyDisplay(a.display,t,r);const u=e.display&&!e.display.length?Zt.none:Zt.all,{bar_index:l,time:c}=this._variables,h=`${t}_${r}`;this._bgColors[t]||(this._bgColors[t]=new Map);const d=this._bgColors[t].get(h),p=(d==null?void 0:d.colors)||[],v=(d==null?void 0:d.setColors)||[];v.includes(n)||v.push(n),p[l]={color:n,time:c},d||this._bgColors[t].set(h,{...a,display:u,colors:p,setColors:v,id:h})}max_bars_back({var:e,num:t,var_name:r}){console.log(e,t,r)}float({x:e}){return e}bool({x:e}){return e||!1}string({x:e}){return e}int({x:e}){return e&&Math.trunc(e)}na({x:e}){return e===void 0}fixnan({source:e},t){return e===void 0||isNaN(e)?this._cacheData[`fixnan_${t}`]:(this._cacheData[`fixnan_${t}`]=e,e)}nz({source:e,replacement:t}){return e!==void 0&&!isNaN(e)?e:t||0}time({timeframe:e="",session:t,timezone:r,bars_back:n=0},i){return this._timeHandle(this._variables.time,i,e,t,r,n)}time_close({timeframe:e="",session:t,timezone:r,bars_back:n=0},i){return this._variables.time_close&&this._timeHandle(this._variables.time_close,i,e,t,r,n)}timestamp(e){const{dateString:t,timezone:r,year:n,month:i,day:a,hour:u=0,minute:l=0,second:c=0}=e;if(t)return ot(t).utc(!/GMT|UTC/.test(t)).valueOf();let h=i-1,d=n;if(h<0){const v=Math.ceil(Math.abs(h/12));h=12*v+h,d=n-v}let p=ot({year:d,month:h,day:a,hour:u,minute:l,second:c});return r&&(p=Zr(p.utc(!0).valueOf(),r)),p.utc(!0).valueOf()}weekofyear({time:e,timezone:t}){return Zr(e,t).week()}year({time:e,timezone:t}){return Zr(e,t).year()}second({time:e,timezone:t}){return Zr(e,t).second()}month({time:e,timezone:t}){return Zr(e,t).month()+1}minute({time:e,timezone:t}){return Zr(e,t).minute()}hour({time:e,timezone:t}){return Zr(e,t).hour()}dayofweek({time:e,timezone:t}){return Zr(e,t).day()+1}dayofmonth({time:e,timezone:t}){return Zr(e,t).date()}_calcTimeOffset(e,t){const r=this._variables.getTimeTradingday(e,t),n=pn(t)*1e3;return e-r-Math.floor((e-r)/n)*n}_timeHandle(e,t,r="",n,i,a=0){const u=r||this._variables.timeframe.period,l=pn(u),c=pn(this._variables.timeframe.period);let h;if(l<=c)h=e;else{const d=`time_${t}`,p=this._cacheData[d];if(p)p.currentTime+l*1e3-p.offset<=e?(h=e,this._cacheData[d]={currentTime:e,offset:0}):h=p;else{const v=this._calcTimeOffset(e,u);this._cacheData[d]={currentTime:e,offset:v},h=e}}if(n){const{timePeriods:d,weeks:p}=this._parserSession(n,t),v=ot(e).format("YYYY-MM-DD"),x=h;h=void 0;for(const y of d){const[m,w]=y;if(ot(e).isBetween(`${v} ${m}`,`${v} ${w}`,"hour")){ot(x).isBetween(`${v} ${m}`,`${v} ${w}`,"hour")?h=x:h=ot(`${v} ${m}`).valueOf();break}}const _=this._variables.dayofweek;h&&!p.includes(_)&&(h=void 0)}return i&&(h=h&&Zr(h,i).valueOf()),h&&h-a*c*1e3}_seriesColorHandle(e,t){var n,i;const{seriesColors:r}=e;if(t&&r!=null&&r.length)for(const a of r){if((n=t.gradientColorKeys)!=null&&n.includes(a))continue;const u=e[a],l=t[`${a}s`]||[];l.includes(u)||(l.push(u),t[`${a}s`]=l,l.length>5&&(t[`${a}s`]=[],(i=t.gradientColorKeys)==null||i.push(a)))}}_parserSession(e,t){const r=e.split(":"),n=r[0],a=(r[1]||"1234567").split("").map(l=>{const c=parseInt(l,10);if(c<1||c>7){this._errorListener.addError(`Invalid day of week: ${l}`,t,Ve.Error);return}return c});return{timePeriods:n.split(",").map(l=>{const c=l.split("-");return c.length!==2?(this._errorListener.addError(`Invalid time period: ${l}`,t,Ve.Error),[]):[this._processTime(c[0],t),this._processTime(c[1],t)]}),weeks:a}}_processTime(e,t){const r=parseInt(e.slice(0,2),10),n=parseInt(e.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",t,Ve.Error);return}return`${r}:${n}`}}var Vl={exports:{}};function $D(s){throw new Error('Could not dynamically require "'+s+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var s0={exports:{}},Gl;function Ge(){return Gl||(Gl=1,function(s,e){(function(t,r){s.exports=r()})(ye,function(){var t=t||function(r,n){var i;if(typeof window<"u"&&window.crypto&&(i=window.crypto),typeof self<"u"&&self.crypto&&(i=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(i=globalThis.crypto),!i&&typeof window<"u"&&window.msCrypto&&(i=window.msCrypto),!i&&typeof ye<"u"&&ye.crypto&&(i=ye.crypto),!i&&typeof $D=="function")try{i=Ex}catch{}var a=function(){if(i){if(typeof i.getRandomValues=="function")try{return i.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof i.randomBytes=="function")try{return i.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},u=Object.create||function(){function w(){}return function(D){var C;return w.prototype=D,C=new w,w.prototype=null,C}}(),l={},c=l.lib={},h=c.Base=function(){return{extend:function(w){var D=u(this);return w&&D.mixIn(w),(!D.hasOwnProperty("init")||this.init===D.init)&&(D.init=function(){D.$super.init.apply(this,arguments)}),D.init.prototype=D,D.$super=this,D},create:function(){var w=this.extend();return w.init.apply(w,arguments),w},init:function(){},mixIn:function(w){for(var D in w)w.hasOwnProperty(D)&&(this[D]=w[D]);w.hasOwnProperty("toString")&&(this.toString=w.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),d=c.WordArray=h.extend({init:function(w,D){w=this.words=w||[],D!=n?this.sigBytes=D:this.sigBytes=w.length*4},toString:function(w){return(w||v).stringify(this)},concat:function(w){var D=this.words,C=w.words,E=this.sigBytes,F=w.sigBytes;if(this.clamp(),E%4)for(var B=0;B<F;B++){var M=C[B>>>2]>>>24-B%4*8&255;D[E+B>>>2]|=M<<24-(E+B)%4*8}else for(var O=0;O<F;O+=4)D[E+O>>>2]=C[O>>>2];return this.sigBytes+=F,this},clamp:function(){var w=this.words,D=this.sigBytes;w[D>>>2]&=4294967295<<32-D%4*8,w.length=r.ceil(D/4)},clone:function(){var w=h.clone.call(this);return w.words=this.words.slice(0),w},random:function(w){for(var D=[],C=0;C<w;C+=4)D.push(a());return new d.init(D,w)}}),p=l.enc={},v=p.Hex={stringify:function(w){for(var D=w.words,C=w.sigBytes,E=[],F=0;F<C;F++){var B=D[F>>>2]>>>24-F%4*8&255;E.push((B>>>4).toString(16)),E.push((B&15).toString(16))}return E.join("")},parse:function(w){for(var D=w.length,C=[],E=0;E<D;E+=2)C[E>>>3]|=parseInt(w.substr(E,2),16)<<24-E%8*4;return new d.init(C,D/2)}},x=p.Latin1={stringify:function(w){for(var D=w.words,C=w.sigBytes,E=[],F=0;F<C;F++){var B=D[F>>>2]>>>24-F%4*8&255;E.push(String.fromCharCode(B))}return E.join("")},parse:function(w){for(var D=w.length,C=[],E=0;E<D;E++)C[E>>>2]|=(w.charCodeAt(E)&255)<<24-E%4*8;return new d.init(C,D)}},_=p.Utf8={stringify:function(w){try{return decodeURIComponent(escape(x.stringify(w)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(w){return x.parse(unescape(encodeURIComponent(w)))}},y=c.BufferedBlockAlgorithm=h.extend({reset:function(){this._data=new d.init,this._nDataBytes=0},_append:function(w){typeof w=="string"&&(w=_.parse(w)),this._data.concat(w),this._nDataBytes+=w.sigBytes},_process:function(w){var D,C=this._data,E=C.words,F=C.sigBytes,B=this.blockSize,M=B*4,O=F/M;w?O=r.ceil(O):O=r.max((O|0)-this._minBufferSize,0);var A=O*B,N=r.min(A*4,F);if(A){for(var T=0;T<A;T+=B)this._doProcessBlock(E,T);D=E.splice(0,A),C.sigBytes-=N}return new d.init(D,N)},clone:function(){var w=h.clone.call(this);return w._data=this._data.clone(),w},_minBufferSize:0});c.Hasher=y.extend({cfg:h.extend(),init:function(w){this.cfg=this.cfg.extend(w),this.reset()},reset:function(){y.reset.call(this),this._doReset()},update:function(w){return this._append(w),this._process(),this},finalize:function(w){w&&this._append(w);var D=this._doFinalize();return D},blockSize:16,_createHelper:function(w){return function(D,C){return new w.init(C).finalize(D)}},_createHmacHelper:function(w){return function(D,C){return new m.HMAC.init(w,C).finalize(D)}}});var m=l.algo={};return l}(Math);return t})}(s0)),s0.exports}var o0={exports:{}},Kl;function Fo(){return Kl||(Kl=1,function(s,e){(function(t,r){s.exports=r(Ge())})(ye,function(t){return function(r){var n=t,i=n.lib,a=i.Base,u=i.WordArray,l=n.x64={};l.Word=a.extend({init:function(c,h){this.high=c,this.low=h}}),l.WordArray=a.extend({init:function(c,h){c=this.words=c||[],h!=r?this.sigBytes=h:this.sigBytes=c.length*8},toX32:function(){for(var c=this.words,h=c.length,d=[],p=0;p<h;p++){var v=c[p];d.push(v.high),d.push(v.low)}return u.create(d,this.sigBytes)},clone:function(){for(var c=a.clone.call(this),h=c.words=this.words.slice(0),d=h.length,p=0;p<d;p++)h[p]=h[p].clone();return c}})}(),t})}(o0)),o0.exports}var a0={exports:{}},Xl;function RD(){return Xl||(Xl=1,function(s,e){(function(t,r){s.exports=r(Ge())})(ye,function(t){return function(){if(typeof ArrayBuffer=="function"){var r=t,n=r.lib,i=n.WordArray,a=i.init,u=i.init=function(l){if(l instanceof ArrayBuffer&&(l=new Uint8Array(l)),(l instanceof Int8Array||typeof Uint8ClampedArray<"u"&&l instanceof Uint8ClampedArray||l instanceof Int16Array||l instanceof Uint16Array||l instanceof Int32Array||l instanceof Uint32Array||l instanceof Float32Array||l instanceof Float64Array)&&(l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength)),l instanceof Uint8Array){for(var c=l.byteLength,h=[],d=0;d<c;d++)h[d>>>2]|=l[d]<<24-d%4*8;a.call(this,h,c)}else a.apply(this,arguments)};u.prototype=i}}(),t.lib.WordArray})}(a0)),a0.exports}var u0={exports:{}},Ql;function LD(){return Ql||(Ql=1,function(s,e){(function(t,r){s.exports=r(Ge())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.WordArray,a=r.enc;a.Utf16=a.Utf16BE={stringify:function(l){for(var c=l.words,h=l.sigBytes,d=[],p=0;p<h;p+=2){var v=c[p>>>2]>>>16-p%4*8&65535;d.push(String.fromCharCode(v))}return d.join("")},parse:function(l){for(var c=l.length,h=[],d=0;d<c;d++)h[d>>>1]|=l.charCodeAt(d)<<16-d%2*16;return i.create(h,c*2)}},a.Utf16LE={stringify:function(l){for(var c=l.words,h=l.sigBytes,d=[],p=0;p<h;p+=2){var v=u(c[p>>>2]>>>16-p%4*8&65535);d.push(String.fromCharCode(v))}return d.join("")},parse:function(l){for(var c=l.length,h=[],d=0;d<c;d++)h[d>>>1]|=u(l.charCodeAt(d)<<16-d%2*16);return i.create(h,c*2)}};function u(l){return l<<8&4278255360|l>>>8&16711935}}(),t.enc.Utf16})}(u0)),u0.exports}var f0={exports:{}},Jl;function oi(){return Jl||(Jl=1,function(s,e){(function(t,r){s.exports=r(Ge())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.WordArray,a=r.enc;a.Base64={stringify:function(l){var c=l.words,h=l.sigBytes,d=this._map;l.clamp();for(var p=[],v=0;v<h;v+=3)for(var x=c[v>>>2]>>>24-v%4*8&255,_=c[v+1>>>2]>>>24-(v+1)%4*8&255,y=c[v+2>>>2]>>>24-(v+2)%4*8&255,m=x<<16|_<<8|y,w=0;w<4&&v+w*.75<h;w++)p.push(d.charAt(m>>>6*(3-w)&63));var D=d.charAt(64);if(D)for(;p.length%4;)p.push(D);return p.join("")},parse:function(l){var c=l.length,h=this._map,d=this._reverseMap;if(!d){d=this._reverseMap=[];for(var p=0;p<h.length;p++)d[h.charCodeAt(p)]=p}var v=h.charAt(64);if(v){var x=l.indexOf(v);x!==-1&&(c=x)}return u(l,c,d)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function u(l,c,h){for(var d=[],p=0,v=0;v<c;v++)if(v%4){var x=h[l.charCodeAt(v-1)]<<v%4*2,_=h[l.charCodeAt(v)]>>>6-v%4*2,y=x|_;d[p>>>2]|=y<<24-p%4*8,p++}return i.create(d,p)}}(),t.enc.Base64})}(f0)),f0.exports}var c0={exports:{}},eh;function PD(){return eh||(eh=1,function(s,e){(function(t,r){s.exports=r(Ge())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.WordArray,a=r.enc;a.Base64url={stringify:function(l,c){c===void 0&&(c=!0);var h=l.words,d=l.sigBytes,p=c?this._safe_map:this._map;l.clamp();for(var v=[],x=0;x<d;x+=3)for(var _=h[x>>>2]>>>24-x%4*8&255,y=h[x+1>>>2]>>>24-(x+1)%4*8&255,m=h[x+2>>>2]>>>24-(x+2)%4*8&255,w=_<<16|y<<8|m,D=0;D<4&&x+D*.75<d;D++)v.push(p.charAt(w>>>6*(3-D)&63));var C=p.charAt(64);if(C)for(;v.length%4;)v.push(C);return v.join("")},parse:function(l,c){c===void 0&&(c=!0);var h=l.length,d=c?this._safe_map:this._map,p=this._reverseMap;if(!p){p=this._reverseMap=[];for(var v=0;v<d.length;v++)p[d.charCodeAt(v)]=v}var x=d.charAt(64);if(x){var _=l.indexOf(x);_!==-1&&(h=_)}return u(l,h,p)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function u(l,c,h){for(var d=[],p=0,v=0;v<c;v++)if(v%4){var x=h[l.charCodeAt(v-1)]<<v%4*2,_=h[l.charCodeAt(v)]>>>6-v%4*2,y=x|_;d[p>>>2]|=y<<24-p%4*8,p++}return i.create(d,p)}}(),t.enc.Base64url})}(c0)),c0.exports}var l0={exports:{}},th;function ai(){return th||(th=1,function(s,e){(function(t,r){s.exports=r(Ge())})(ye,function(t){return function(r){var n=t,i=n.lib,a=i.WordArray,u=i.Hasher,l=n.algo,c=[];(function(){for(var _=0;_<64;_++)c[_]=r.abs(r.sin(_+1))*4294967296|0})();var h=l.MD5=u.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(_,y){for(var m=0;m<16;m++){var w=y+m,D=_[w];_[w]=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360}var C=this._hash.words,E=_[y+0],F=_[y+1],B=_[y+2],M=_[y+3],O=_[y+4],A=_[y+5],N=_[y+6],T=_[y+7],R=_[y+8],k=_[y+9],z=_[y+10],L=_[y+11],G=_[y+12],H=_[y+13],ee=_[y+14],te=_[y+15],j=C[0],X=C[1],Y=C[2],Q=C[3];j=d(j,X,Y,Q,E,7,c[0]),Q=d(Q,j,X,Y,F,12,c[1]),Y=d(Y,Q,j,X,B,17,c[2]),X=d(X,Y,Q,j,M,22,c[3]),j=d(j,X,Y,Q,O,7,c[4]),Q=d(Q,j,X,Y,A,12,c[5]),Y=d(Y,Q,j,X,N,17,c[6]),X=d(X,Y,Q,j,T,22,c[7]),j=d(j,X,Y,Q,R,7,c[8]),Q=d(Q,j,X,Y,k,12,c[9]),Y=d(Y,Q,j,X,z,17,c[10]),X=d(X,Y,Q,j,L,22,c[11]),j=d(j,X,Y,Q,G,7,c[12]),Q=d(Q,j,X,Y,H,12,c[13]),Y=d(Y,Q,j,X,ee,17,c[14]),X=d(X,Y,Q,j,te,22,c[15]),j=p(j,X,Y,Q,F,5,c[16]),Q=p(Q,j,X,Y,N,9,c[17]),Y=p(Y,Q,j,X,L,14,c[18]),X=p(X,Y,Q,j,E,20,c[19]),j=p(j,X,Y,Q,A,5,c[20]),Q=p(Q,j,X,Y,z,9,c[21]),Y=p(Y,Q,j,X,te,14,c[22]),X=p(X,Y,Q,j,O,20,c[23]),j=p(j,X,Y,Q,k,5,c[24]),Q=p(Q,j,X,Y,ee,9,c[25]),Y=p(Y,Q,j,X,M,14,c[26]),X=p(X,Y,Q,j,R,20,c[27]),j=p(j,X,Y,Q,H,5,c[28]),Q=p(Q,j,X,Y,B,9,c[29]),Y=p(Y,Q,j,X,T,14,c[30]),X=p(X,Y,Q,j,G,20,c[31]),j=v(j,X,Y,Q,A,4,c[32]),Q=v(Q,j,X,Y,R,11,c[33]),Y=v(Y,Q,j,X,L,16,c[34]),X=v(X,Y,Q,j,ee,23,c[35]),j=v(j,X,Y,Q,F,4,c[36]),Q=v(Q,j,X,Y,O,11,c[37]),Y=v(Y,Q,j,X,T,16,c[38]),X=v(X,Y,Q,j,z,23,c[39]),j=v(j,X,Y,Q,H,4,c[40]),Q=v(Q,j,X,Y,E,11,c[41]),Y=v(Y,Q,j,X,M,16,c[42]),X=v(X,Y,Q,j,N,23,c[43]),j=v(j,X,Y,Q,k,4,c[44]),Q=v(Q,j,X,Y,G,11,c[45]),Y=v(Y,Q,j,X,te,16,c[46]),X=v(X,Y,Q,j,B,23,c[47]),j=x(j,X,Y,Q,E,6,c[48]),Q=x(Q,j,X,Y,T,10,c[49]),Y=x(Y,Q,j,X,ee,15,c[50]),X=x(X,Y,Q,j,A,21,c[51]),j=x(j,X,Y,Q,G,6,c[52]),Q=x(Q,j,X,Y,M,10,c[53]),Y=x(Y,Q,j,X,z,15,c[54]),X=x(X,Y,Q,j,F,21,c[55]),j=x(j,X,Y,Q,R,6,c[56]),Q=x(Q,j,X,Y,te,10,c[57]),Y=x(Y,Q,j,X,N,15,c[58]),X=x(X,Y,Q,j,H,21,c[59]),j=x(j,X,Y,Q,O,6,c[60]),Q=x(Q,j,X,Y,L,10,c[61]),Y=x(Y,Q,j,X,B,15,c[62]),X=x(X,Y,Q,j,k,21,c[63]),C[0]=C[0]+j|0,C[1]=C[1]+X|0,C[2]=C[2]+Y|0,C[3]=C[3]+Q|0},_doFinalize:function(){var _=this._data,y=_.words,m=this._nDataBytes*8,w=_.sigBytes*8;y[w>>>5]|=128<<24-w%32;var D=r.floor(m/4294967296),C=m;y[(w+64>>>9<<4)+15]=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360,y[(w+64>>>9<<4)+14]=(C<<8|C>>>24)&16711935|(C<<24|C>>>8)&4278255360,_.sigBytes=(y.length+1)*4,this._process();for(var E=this._hash,F=E.words,B=0;B<4;B++){var M=F[B];F[B]=(M<<8|M>>>24)&16711935|(M<<24|M>>>8)&4278255360}return E},clone:function(){var _=u.clone.call(this);return _._hash=this._hash.clone(),_}});function d(_,y,m,w,D,C,E){var F=_+(y&m|~y&w)+D+E;return(F<<C|F>>>32-C)+y}function p(_,y,m,w,D,C,E){var F=_+(y&w|m&~w)+D+E;return(F<<C|F>>>32-C)+y}function v(_,y,m,w,D,C,E){var F=_+(y^m^w)+D+E;return(F<<C|F>>>32-C)+y}function x(_,y,m,w,D,C,E){var F=_+(m^(y|~w))+D+E;return(F<<C|F>>>32-C)+y}n.MD5=u._createHelper(h),n.HmacMD5=u._createHmacHelper(h)}(Math),t.MD5})}(l0)),l0.exports}var h0={exports:{}},rh;function nh(){return rh||(rh=1,function(s,e){(function(t,r){s.exports=r(Ge())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.WordArray,a=n.Hasher,u=r.algo,l=[],c=u.SHA1=a.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(h,d){for(var p=this._hash.words,v=p[0],x=p[1],_=p[2],y=p[3],m=p[4],w=0;w<80;w++){if(w<16)l[w]=h[d+w]|0;else{var D=l[w-3]^l[w-8]^l[w-14]^l[w-16];l[w]=D<<1|D>>>31}var C=(v<<5|v>>>27)+m+l[w];w<20?C+=(x&_|~x&y)+1518500249:w<40?C+=(x^_^y)+1859775393:w<60?C+=(x&_|x&y|_&y)-1894007588:C+=(x^_^y)-899497514,m=y,y=_,_=x<<30|x>>>2,x=v,v=C}p[0]=p[0]+v|0,p[1]=p[1]+x|0,p[2]=p[2]+_|0,p[3]=p[3]+y|0,p[4]=p[4]+m|0},_doFinalize:function(){var h=this._data,d=h.words,p=this._nDataBytes*8,v=h.sigBytes*8;return d[v>>>5]|=128<<24-v%32,d[(v+64>>>9<<4)+14]=Math.floor(p/4294967296),d[(v+64>>>9<<4)+15]=p,h.sigBytes=d.length*4,this._process(),this._hash},clone:function(){var h=a.clone.call(this);return h._hash=this._hash.clone(),h}});r.SHA1=a._createHelper(c),r.HmacSHA1=a._createHmacHelper(c)}(),t.SHA1})}(h0)),h0.exports}var d0={exports:{}},ih;function p0(){return ih||(ih=1,function(s,e){(function(t,r){s.exports=r(Ge())})(ye,function(t){return function(r){var n=t,i=n.lib,a=i.WordArray,u=i.Hasher,l=n.algo,c=[],h=[];(function(){function v(m){for(var w=r.sqrt(m),D=2;D<=w;D++)if(!(m%D))return!1;return!0}function x(m){return(m-(m|0))*4294967296|0}for(var _=2,y=0;y<64;)v(_)&&(y<8&&(c[y]=x(r.pow(_,1/2))),h[y]=x(r.pow(_,1/3)),y++),_++})();var d=[],p=l.SHA256=u.extend({_doReset:function(){this._hash=new a.init(c.slice(0))},_doProcessBlock:function(v,x){for(var _=this._hash.words,y=_[0],m=_[1],w=_[2],D=_[3],C=_[4],E=_[5],F=_[6],B=_[7],M=0;M<64;M++){if(M<16)d[M]=v[x+M]|0;else{var O=d[M-15],A=(O<<25|O>>>7)^(O<<14|O>>>18)^O>>>3,N=d[M-2],T=(N<<15|N>>>17)^(N<<13|N>>>19)^N>>>10;d[M]=A+d[M-7]+T+d[M-16]}var R=C&E^~C&F,k=y&m^y&w^m&w,z=(y<<30|y>>>2)^(y<<19|y>>>13)^(y<<10|y>>>22),L=(C<<26|C>>>6)^(C<<21|C>>>11)^(C<<7|C>>>25),G=B+L+R+h[M]+d[M],H=z+k;B=F,F=E,E=C,C=D+G|0,D=w,w=m,m=y,y=G+H|0}_[0]=_[0]+y|0,_[1]=_[1]+m|0,_[2]=_[2]+w|0,_[3]=_[3]+D|0,_[4]=_[4]+C|0,_[5]=_[5]+E|0,_[6]=_[6]+F|0,_[7]=_[7]+B|0},_doFinalize:function(){var v=this._data,x=v.words,_=this._nDataBytes*8,y=v.sigBytes*8;return x[y>>>5]|=128<<24-y%32,x[(y+64>>>9<<4)+14]=r.floor(_/4294967296),x[(y+64>>>9<<4)+15]=_,v.sigBytes=x.length*4,this._process(),this._hash},clone:function(){var v=u.clone.call(this);return v._hash=this._hash.clone(),v}});n.SHA256=u._createHelper(p),n.HmacSHA256=u._createHmacHelper(p)}(Math),t.SHA256})}(d0)),d0.exports}var _0={exports:{}},sh;function kD(){return sh||(sh=1,function(s,e){(function(t,r,n){s.exports=r(Ge(),p0())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.WordArray,a=r.algo,u=a.SHA256,l=a.SHA224=u.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var c=u._doFinalize.call(this);return c.sigBytes-=4,c}});r.SHA224=u._createHelper(l),r.HmacSHA224=u._createHmacHelper(l)}(),t.SHA224})}(_0)),_0.exports}var v0={exports:{}},oh;function ah(){return oh||(oh=1,function(s,e){(function(t,r,n){s.exports=r(Ge(),Fo())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.Hasher,a=r.x64,u=a.Word,l=a.WordArray,c=r.algo;function h(){return u.create.apply(u,arguments)}var d=[h(1116352408,3609767458),h(1899447441,602891725),h(3049323471,3964484399),h(3921009573,2173295548),h(961987163,4081628472),h(1508970993,3053834265),h(2453635748,2937671579),h(2870763221,3664609560),h(3624381080,2734883394),h(310598401,1164996542),h(607225278,1323610764),h(1426881987,3590304994),h(1925078388,4068182383),h(2162078206,991336113),h(2614888103,633803317),h(3248222580,3479774868),h(3835390401,2666613458),h(4022224774,944711139),h(264347078,2341262773),h(604807628,2007800933),h(770255983,1495990901),h(1249150122,1856431235),h(1555081692,3175218132),h(1996064986,2198950837),h(2554220882,3999719339),h(2821834349,766784016),h(2952996808,2566594879),h(3210313671,3203337956),h(3336571891,1034457026),h(3584528711,2466948901),h(113926993,3758326383),h(338241895,168717936),h(666307205,1188179964),h(773529912,1546045734),h(1294757372,1522805485),h(1396182291,2643833823),h(1695183700,2343527390),h(1986661051,1014477480),h(2177026350,1206759142),h(2456956037,344077627),h(2730485921,1290863460),h(2820302411,3158454273),h(3259730800,3505952657),h(3345764771,106217008),h(3516065817,3606008344),h(3600352804,1432725776),h(4094571909,1467031594),h(275423344,851169720),h(430227734,3100823752),h(506948616,1363258195),h(659060556,3750685593),h(883997877,3785050280),h(958139571,3318307427),h(1322822218,3812723403),h(1537002063,2003034995),h(1747873779,3602036899),h(1955562222,1575990012),h(2024104815,1125592928),h(2227730452,2716904306),h(2361852424,442776044),h(2428436474,593698344),h(2756734187,3733110249),h(3204031479,2999351573),h(3329325298,3815920427),h(3391569614,3928383900),h(3515267271,566280711),h(3940187606,3454069534),h(4118630271,4000239992),h(116418474,1914138554),h(174292421,2731055270),h(289380356,3203993006),h(460393269,320620315),h(685471733,587496836),h(852142971,1086792851),h(1017036298,365543100),h(1126000580,2618297676),h(1288033470,3409855158),h(1501505948,4234509866),h(1607167915,987167468),h(1816402316,1246189591)],p=[];(function(){for(var x=0;x<80;x++)p[x]=h()})();var v=c.SHA512=i.extend({_doReset:function(){this._hash=new l.init([new u.init(1779033703,4089235720),new u.init(3144134277,2227873595),new u.init(1013904242,4271175723),new u.init(2773480762,1595750129),new u.init(1359893119,2917565137),new u.init(2600822924,725511199),new u.init(528734635,4215389547),new u.init(1541459225,327033209)])},_doProcessBlock:function(x,_){for(var y=this._hash.words,m=y[0],w=y[1],D=y[2],C=y[3],E=y[4],F=y[5],B=y[6],M=y[7],O=m.high,A=m.low,N=w.high,T=w.low,R=D.high,k=D.low,z=C.high,L=C.low,G=E.high,H=E.low,ee=F.high,te=F.low,j=B.high,X=B.low,Y=M.high,Q=M.low,pe=O,De=A,we=N,Ee=T,Oe=R,Fe=k,nt=z,Ye=L,Te=G,Re=H,xt=ee,Ut=te,bt=j,ur=X,Lr=Y,fr=Q,yt=0;yt<80;yt++){var Ot,P,V=p[yt];if(yt<16)P=V.high=x[_+yt*2]|0,Ot=V.low=x[_+yt*2+1]|0;else{var J=p[yt-15],ie=J.high,ue=J.low,se=(ie>>>1|ue<<31)^(ie>>>8|ue<<24)^ie>>>7,_e=(ue>>>1|ie<<31)^(ue>>>8|ie<<24)^(ue>>>7|ie<<25),he=p[yt-2],de=he.high,le=he.low,Xe=(de>>>19|le<<13)^(de<<3|le>>>29)^de>>>6,et=(le>>>19|de<<13)^(le<<3|de>>>29)^(le>>>6|de<<26),ht=p[yt-7],kt=ht.high,Tt=ht.low,rr=p[yt-16],cr=rr.high,en=rr.low;Ot=_e+Tt,P=se+kt+(Ot>>>0<_e>>>0?1:0),Ot=Ot+et,P=P+Xe+(Ot>>>0<et>>>0?1:0),Ot=Ot+en,P=P+cr+(Ot>>>0<en>>>0?1:0),V.high=P,V.low=Ot}var Dn=Te&xt^~Te&bt,fi=Re&Ut^~Re&ur,vs=pe&we^pe&Oe^we&Oe,gs=De&Ee^De&Fe^Ee&Fe,ms=(pe>>>28|De<<4)^(pe<<30|De>>>2)^(pe<<25|De>>>7),Li=(De>>>28|pe<<4)^(De<<30|pe>>>2)^(De<<25|pe>>>7),Pi=(Te>>>14|Re<<18)^(Te>>>18|Re<<14)^(Te<<23|Re>>>9),xs=(Re>>>14|Te<<18)^(Re>>>18|Te<<14)^(Re<<23|Te>>>9),ki=d[yt],ys=ki.high,zn=ki.low,Xt=fr+xs,mr=Lr+Pi+(Xt>>>0<fr>>>0?1:0),Xt=Xt+fi,mr=mr+Dn+(Xt>>>0<fi>>>0?1:0),Xt=Xt+zn,mr=mr+ys+(Xt>>>0<zn>>>0?1:0),Xt=Xt+Ot,mr=mr+P+(Xt>>>0<Ot>>>0?1:0),zi=Li+gs,Ds=ms+vs+(zi>>>0<Li>>>0?1:0);Lr=bt,fr=ur,bt=xt,ur=Ut,xt=Te,Ut=Re,Re=Ye+Xt|0,Te=nt+mr+(Re>>>0<Ye>>>0?1:0)|0,nt=Oe,Ye=Fe,Oe=we,Fe=Ee,we=pe,Ee=De,De=Xt+zi|0,pe=mr+Ds+(De>>>0<Xt>>>0?1:0)|0}A=m.low=A+De,m.high=O+pe+(A>>>0<De>>>0?1:0),T=w.low=T+Ee,w.high=N+we+(T>>>0<Ee>>>0?1:0),k=D.low=k+Fe,D.high=R+Oe+(k>>>0<Fe>>>0?1:0),L=C.low=L+Ye,C.high=z+nt+(L>>>0<Ye>>>0?1:0),H=E.low=H+Re,E.high=G+Te+(H>>>0<Re>>>0?1:0),te=F.low=te+Ut,F.high=ee+xt+(te>>>0<Ut>>>0?1:0),X=B.low=X+ur,B.high=j+bt+(X>>>0<ur>>>0?1:0),Q=M.low=Q+fr,M.high=Y+Lr+(Q>>>0<fr>>>0?1:0)},_doFinalize:function(){var x=this._data,_=x.words,y=this._nDataBytes*8,m=x.sigBytes*8;_[m>>>5]|=128<<24-m%32,_[(m+128>>>10<<5)+30]=Math.floor(y/4294967296),_[(m+128>>>10<<5)+31]=y,x.sigBytes=_.length*4,this._process();var w=this._hash.toX32();return w},clone:function(){var x=i.clone.call(this);return x._hash=this._hash.clone(),x},blockSize:1024/32});r.SHA512=i._createHelper(v),r.HmacSHA512=i._createHmacHelper(v)}(),t.SHA512})}(v0)),v0.exports}var g0={exports:{}},uh;function zD(){return uh||(uh=1,function(s,e){(function(t,r,n){s.exports=r(Ge(),Fo(),ah())})(ye,function(t){return function(){var r=t,n=r.x64,i=n.Word,a=n.WordArray,u=r.algo,l=u.SHA512,c=u.SHA384=l.extend({_doReset:function(){this._hash=new a.init([new i.init(3418070365,3238371032),new i.init(1654270250,914150663),new i.init(2438529370,812702999),new i.init(355462360,4144912697),new i.init(1731405415,4290775857),new i.init(2394180231,1750603025),new i.init(3675008525,1694076839),new i.init(1203062813,3204075428)])},_doFinalize:function(){var h=l._doFinalize.call(this);return h.sigBytes-=16,h}});r.SHA384=l._createHelper(c),r.HmacSHA384=l._createHmacHelper(c)}(),t.SHA384})}(g0)),g0.exports}var m0={exports:{}},fh;function qD(){return fh||(fh=1,function(s,e){(function(t,r,n){s.exports=r(Ge(),Fo())})(ye,function(t){return function(r){var n=t,i=n.lib,a=i.WordArray,u=i.Hasher,l=n.x64,c=l.Word,h=n.algo,d=[],p=[],v=[];(function(){for(var y=1,m=0,w=0;w<24;w++){d[y+5*m]=(w+1)*(w+2)/2%64;var D=m%5,C=(2*y+3*m)%5;y=D,m=C}for(var y=0;y<5;y++)for(var m=0;m<5;m++)p[y+5*m]=m+(2*y+3*m)%5*5;for(var E=1,F=0;F<24;F++){for(var B=0,M=0,O=0;O<7;O++){if(E&1){var A=(1<<O)-1;A<32?M^=1<<A:B^=1<<A-32}E&128?E=E<<1^113:E<<=1}v[F]=c.create(B,M)}})();var x=[];(function(){for(var y=0;y<25;y++)x[y]=c.create()})();var _=h.SHA3=u.extend({cfg:u.cfg.extend({outputLength:512}),_doReset:function(){for(var y=this._state=[],m=0;m<25;m++)y[m]=new c.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(y,m){for(var w=this._state,D=this.blockSize/2,C=0;C<D;C++){var E=y[m+2*C],F=y[m+2*C+1];E=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,F=(F<<8|F>>>24)&16711935|(F<<24|F>>>8)&4278255360;var B=w[C];B.high^=F,B.low^=E}for(var M=0;M<24;M++){for(var O=0;O<5;O++){for(var A=0,N=0,T=0;T<5;T++){var B=w[O+5*T];A^=B.high,N^=B.low}var R=x[O];R.high=A,R.low=N}for(var O=0;O<5;O++)for(var k=x[(O+4)%5],z=x[(O+1)%5],L=z.high,G=z.low,A=k.high^(L<<1|G>>>31),N=k.low^(G<<1|L>>>31),T=0;T<5;T++){var B=w[O+5*T];B.high^=A,B.low^=N}for(var H=1;H<25;H++){var A,N,B=w[H],ee=B.high,te=B.low,j=d[H];j<32?(A=ee<<j|te>>>32-j,N=te<<j|ee>>>32-j):(A=te<<j-32|ee>>>64-j,N=ee<<j-32|te>>>64-j);var X=x[p[H]];X.high=A,X.low=N}var Y=x[0],Q=w[0];Y.high=Q.high,Y.low=Q.low;for(var O=0;O<5;O++)for(var T=0;T<5;T++){var H=O+5*T,B=w[H],pe=x[H],De=x[(O+1)%5+5*T],we=x[(O+2)%5+5*T];B.high=pe.high^~De.high&we.high,B.low=pe.low^~De.low&we.low}var B=w[0],Ee=v[M];B.high^=Ee.high,B.low^=Ee.low}},_doFinalize:function(){var y=this._data,m=y.words;this._nDataBytes*8;var w=y.sigBytes*8,D=this.blockSize*32;m[w>>>5]|=1<<24-w%32,m[(r.ceil((w+1)/D)*D>>>5)-1]|=128,y.sigBytes=m.length*4,this._process();for(var C=this._state,E=this.cfg.outputLength/8,F=E/8,B=[],M=0;M<F;M++){var O=C[M],A=O.high,N=O.low;A=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360,N=(N<<8|N>>>24)&16711935|(N<<24|N>>>8)&4278255360,B.push(N),B.push(A)}return new a.init(B,E)},clone:function(){for(var y=u.clone.call(this),m=y._state=this._state.slice(0),w=0;w<25;w++)m[w]=m[w].clone();return y}});n.SHA3=u._createHelper(_),n.HmacSHA3=u._createHmacHelper(_)}(Math),t.SHA3})}(m0)),m0.exports}var x0={exports:{}},ch;function UD(){return ch||(ch=1,function(s,e){(function(t,r){s.exports=r(Ge())})(ye,function(t){/** @preserve
63
+ (c) 2012 by Cédric Mesnil. All rights reserved.
64
+
65
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
66
+
67
+ - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
68
+ - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
69
+
70
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
71
+ */return function(r){var n=t,i=n.lib,a=i.WordArray,u=i.Hasher,l=n.algo,c=a.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),h=a.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),d=a.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),p=a.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),v=a.create([0,1518500249,1859775393,2400959708,2840853838]),x=a.create([1352829926,1548603684,1836072691,2053994217,0]),_=l.RIPEMD160=u.extend({_doReset:function(){this._hash=a.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(F,B){for(var M=0;M<16;M++){var O=B+M,A=F[O];F[O]=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360}var N=this._hash.words,T=v.words,R=x.words,k=c.words,z=h.words,L=d.words,G=p.words,H,ee,te,j,X,Y,Q,pe,De,we;Y=H=N[0],Q=ee=N[1],pe=te=N[2],De=j=N[3],we=X=N[4];for(var Ee,M=0;M<80;M+=1)Ee=H+F[B+k[M]]|0,M<16?Ee+=y(ee,te,j)+T[0]:M<32?Ee+=m(ee,te,j)+T[1]:M<48?Ee+=w(ee,te,j)+T[2]:M<64?Ee+=D(ee,te,j)+T[3]:Ee+=C(ee,te,j)+T[4],Ee=Ee|0,Ee=E(Ee,L[M]),Ee=Ee+X|0,H=X,X=j,j=E(te,10),te=ee,ee=Ee,Ee=Y+F[B+z[M]]|0,M<16?Ee+=C(Q,pe,De)+R[0]:M<32?Ee+=D(Q,pe,De)+R[1]:M<48?Ee+=w(Q,pe,De)+R[2]:M<64?Ee+=m(Q,pe,De)+R[3]:Ee+=y(Q,pe,De)+R[4],Ee=Ee|0,Ee=E(Ee,G[M]),Ee=Ee+we|0,Y=we,we=De,De=E(pe,10),pe=Q,Q=Ee;Ee=N[1]+te+De|0,N[1]=N[2]+j+we|0,N[2]=N[3]+X+Y|0,N[3]=N[4]+H+Q|0,N[4]=N[0]+ee+pe|0,N[0]=Ee},_doFinalize:function(){var F=this._data,B=F.words,M=this._nDataBytes*8,O=F.sigBytes*8;B[O>>>5]|=128<<24-O%32,B[(O+64>>>9<<4)+14]=(M<<8|M>>>24)&16711935|(M<<24|M>>>8)&4278255360,F.sigBytes=(B.length+1)*4,this._process();for(var A=this._hash,N=A.words,T=0;T<5;T++){var R=N[T];N[T]=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360}return A},clone:function(){var F=u.clone.call(this);return F._hash=this._hash.clone(),F}});function y(F,B,M){return F^B^M}function m(F,B,M){return F&B|~F&M}function w(F,B,M){return(F|~B)^M}function D(F,B,M){return F&M|B&~M}function C(F,B,M){return F^(B|~M)}function E(F,B){return F<<B|F>>>32-B}n.RIPEMD160=u._createHelper(_),n.HmacRIPEMD160=u._createHmacHelper(_)}(),t.RIPEMD160})}(x0)),x0.exports}var y0={exports:{}},lh;function D0(){return lh||(lh=1,function(s,e){(function(t,r){s.exports=r(Ge())})(ye,function(t){(function(){var r=t,n=r.lib,i=n.Base,a=r.enc,u=a.Utf8,l=r.algo;l.HMAC=i.extend({init:function(c,h){c=this._hasher=new c.init,typeof h=="string"&&(h=u.parse(h));var d=c.blockSize,p=d*4;h.sigBytes>p&&(h=c.finalize(h)),h.clamp();for(var v=this._oKey=h.clone(),x=this._iKey=h.clone(),_=v.words,y=x.words,m=0;m<d;m++)_[m]^=1549556828,y[m]^=909522486;v.sigBytes=x.sigBytes=p,this.reset()},reset:function(){var c=this._hasher;c.reset(),c.update(this._iKey)},update:function(c){return this._hasher.update(c),this},finalize:function(c){var h=this._hasher,d=h.finalize(c);h.reset();var p=h.finalize(this._oKey.clone().concat(d));return p}})})()})}(y0)),y0.exports}var w0={exports:{}},hh;function WD(){return hh||(hh=1,function(s,e){(function(t,r,n){s.exports=r(Ge(),p0(),D0())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.Base,a=n.WordArray,u=r.algo,l=u.SHA256,c=u.HMAC,h=u.PBKDF2=i.extend({cfg:i.extend({keySize:128/32,hasher:l,iterations:25e4}),init:function(d){this.cfg=this.cfg.extend(d)},compute:function(d,p){for(var v=this.cfg,x=c.create(v.hasher,d),_=a.create(),y=a.create([1]),m=_.words,w=y.words,D=v.keySize,C=v.iterations;m.length<D;){var E=x.update(p).finalize(y);x.reset();for(var F=E.words,B=F.length,M=E,O=1;O<C;O++){M=x.finalize(M),x.reset();for(var A=M.words,N=0;N<B;N++)F[N]^=A[N]}_.concat(E),w[0]++}return _.sigBytes=D*4,_}});r.PBKDF2=function(d,p,v){return h.create(v).compute(d,p)}}(),t.PBKDF2})}(w0)),w0.exports}var E0={exports:{}},dh;function kn(){return dh||(dh=1,function(s,e){(function(t,r,n){s.exports=r(Ge(),nh(),D0())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.Base,a=n.WordArray,u=r.algo,l=u.MD5,c=u.EvpKDF=i.extend({cfg:i.extend({keySize:128/32,hasher:l,iterations:1}),init:function(h){this.cfg=this.cfg.extend(h)},compute:function(h,d){for(var p,v=this.cfg,x=v.hasher.create(),_=a.create(),y=_.words,m=v.keySize,w=v.iterations;y.length<m;){p&&x.update(p),p=x.update(h).finalize(d),x.reset();for(var D=1;D<w;D++)p=x.finalize(p),x.reset();_.concat(p)}return _.sigBytes=m*4,_}});r.EvpKDF=function(h,d,p){return c.create(p).compute(h,d)}}(),t.EvpKDF})}(E0)),E0.exports}var b0={exports:{}},ph;function jt(){return ph||(ph=1,function(s,e){(function(t,r,n){s.exports=r(Ge(),kn())})(ye,function(t){t.lib.Cipher||function(r){var n=t,i=n.lib,a=i.Base,u=i.WordArray,l=i.BufferedBlockAlgorithm,c=n.enc;c.Utf8;var h=c.Base64,d=n.algo,p=d.EvpKDF,v=i.Cipher=l.extend({cfg:a.extend(),createEncryptor:function(A,N){return this.create(this._ENC_XFORM_MODE,A,N)},createDecryptor:function(A,N){return this.create(this._DEC_XFORM_MODE,A,N)},init:function(A,N,T){this.cfg=this.cfg.extend(T),this._xformMode=A,this._key=N,this.reset()},reset:function(){l.reset.call(this),this._doReset()},process:function(A){return this._append(A),this._process()},finalize:function(A){A&&this._append(A);var N=this._doFinalize();return N},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function A(N){return typeof N=="string"?O:F}return function(N){return{encrypt:function(T,R,k){return A(R).encrypt(N,T,R,k)},decrypt:function(T,R,k){return A(R).decrypt(N,T,R,k)}}}}()});i.StreamCipher=v.extend({_doFinalize:function(){var A=this._process(!0);return A},blockSize:1});var x=n.mode={},_=i.BlockCipherMode=a.extend({createEncryptor:function(A,N){return this.Encryptor.create(A,N)},createDecryptor:function(A,N){return this.Decryptor.create(A,N)},init:function(A,N){this._cipher=A,this._iv=N}}),y=x.CBC=function(){var A=_.extend();A.Encryptor=A.extend({processBlock:function(T,R){var k=this._cipher,z=k.blockSize;N.call(this,T,R,z),k.encryptBlock(T,R),this._prevBlock=T.slice(R,R+z)}}),A.Decryptor=A.extend({processBlock:function(T,R){var k=this._cipher,z=k.blockSize,L=T.slice(R,R+z);k.decryptBlock(T,R),N.call(this,T,R,z),this._prevBlock=L}});function N(T,R,k){var z,L=this._iv;L?(z=L,this._iv=r):z=this._prevBlock;for(var G=0;G<k;G++)T[R+G]^=z[G]}return A}(),m=n.pad={},w=m.Pkcs7={pad:function(A,N){for(var T=N*4,R=T-A.sigBytes%T,k=R<<24|R<<16|R<<8|R,z=[],L=0;L<R;L+=4)z.push(k);var G=u.create(z,R);A.concat(G)},unpad:function(A){var N=A.words[A.sigBytes-1>>>2]&255;A.sigBytes-=N}};i.BlockCipher=v.extend({cfg:v.cfg.extend({mode:y,padding:w}),reset:function(){var A;v.reset.call(this);var N=this.cfg,T=N.iv,R=N.mode;this._xformMode==this._ENC_XFORM_MODE?A=R.createEncryptor:(A=R.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==A?this._mode.init(this,T&&T.words):(this._mode=A.call(R,this,T&&T.words),this._mode.__creator=A)},_doProcessBlock:function(A,N){this._mode.processBlock(A,N)},_doFinalize:function(){var A,N=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(N.pad(this._data,this.blockSize),A=this._process(!0)):(A=this._process(!0),N.unpad(A)),A},blockSize:128/32});var D=i.CipherParams=a.extend({init:function(A){this.mixIn(A)},toString:function(A){return(A||this.formatter).stringify(this)}}),C=n.format={},E=C.OpenSSL={stringify:function(A){var N,T=A.ciphertext,R=A.salt;return R?N=u.create([1398893684,1701076831]).concat(R).concat(T):N=T,N.toString(h)},parse:function(A){var N,T=h.parse(A),R=T.words;return R[0]==1398893684&&R[1]==1701076831&&(N=u.create(R.slice(2,4)),R.splice(0,4),T.sigBytes-=16),D.create({ciphertext:T,salt:N})}},F=i.SerializableCipher=a.extend({cfg:a.extend({format:E}),encrypt:function(A,N,T,R){R=this.cfg.extend(R);var k=A.createEncryptor(T,R),z=k.finalize(N),L=k.cfg;return D.create({ciphertext:z,key:T,iv:L.iv,algorithm:A,mode:L.mode,padding:L.padding,blockSize:A.blockSize,formatter:R.format})},decrypt:function(A,N,T,R){R=this.cfg.extend(R),N=this._parse(N,R.format);var k=A.createDecryptor(T,R).finalize(N.ciphertext);return k},_parse:function(A,N){return typeof A=="string"?N.parse(A,this):A}}),B=n.kdf={},M=B.OpenSSL={execute:function(A,N,T,R,k){if(R||(R=u.random(64/8)),k)var z=p.create({keySize:N+T,hasher:k}).compute(A,R);else var z=p.create({keySize:N+T}).compute(A,R);var L=u.create(z.words.slice(N),T*4);return z.sigBytes=N*4,D.create({key:z,iv:L,salt:R})}},O=i.PasswordBasedCipher=F.extend({cfg:F.cfg.extend({kdf:M}),encrypt:function(A,N,T,R){R=this.cfg.extend(R);var k=R.kdf.execute(T,A.keySize,A.ivSize,R.salt,R.hasher);R.iv=k.iv;var z=F.encrypt.call(this,A,N,k.key,R);return z.mixIn(k),z},decrypt:function(A,N,T,R){R=this.cfg.extend(R),N=this._parse(N,R.format);var k=R.kdf.execute(T,A.keySize,A.ivSize,N.salt,R.hasher);R.iv=k.iv;var z=F.decrypt.call(this,A,N,k.key,R);return z}})}()})}(b0)),b0.exports}var A0={exports:{}},_h;function HD(){return _h||(_h=1,function(s,e){(function(t,r,n){s.exports=r(Ge(),jt())})(ye,function(t){return t.mode.CFB=function(){var r=t.lib.BlockCipherMode.extend();r.Encryptor=r.extend({processBlock:function(i,a){var u=this._cipher,l=u.blockSize;n.call(this,i,a,l,u),this._prevBlock=i.slice(a,a+l)}}),r.Decryptor=r.extend({processBlock:function(i,a){var u=this._cipher,l=u.blockSize,c=i.slice(a,a+l);n.call(this,i,a,l,u),this._prevBlock=c}});function n(i,a,u,l){var c,h=this._iv;h?(c=h.slice(0),this._iv=void 0):c=this._prevBlock,l.encryptBlock(c,0);for(var d=0;d<u;d++)i[a+d]^=c[d]}return r}(),t.mode.CFB})}(A0)),A0.exports}var C0={exports:{}},vh;function jD(){return vh||(vh=1,function(s,e){(function(t,r,n){s.exports=r(Ge(),jt())})(ye,function(t){return t.mode.CTR=function(){var r=t.lib.BlockCipherMode.extend(),n=r.Encryptor=r.extend({processBlock:function(i,a){var u=this._cipher,l=u.blockSize,c=this._iv,h=this._counter;c&&(h=this._counter=c.slice(0),this._iv=void 0);var d=h.slice(0);u.encryptBlock(d,0),h[l-1]=h[l-1]+1|0;for(var p=0;p<l;p++)i[a+p]^=d[p]}});return r.Decryptor=n,r}(),t.mode.CTR})}(C0)),C0.exports}var F0={exports:{}},gh;function YD(){return gh||(gh=1,function(s,e){(function(t,r,n){s.exports=r(Ge(),jt())})(ye,function(t){/** @preserve
72
+ * Counter block mode compatible with Dr Brian Gladman fileenc.c
73
+ * derived from CryptoJS.mode.CTR
74
+ * Jan Hruby jhruby.web@gmail.com
75
+ */return t.mode.CTRGladman=function(){var r=t.lib.BlockCipherMode.extend();function n(u){if((u>>24&255)===255){var l=u>>16&255,c=u>>8&255,h=u&255;l===255?(l=0,c===255?(c=0,h===255?h=0:++h):++c):++l,u=0,u+=l<<16,u+=c<<8,u+=h}else u+=1<<24;return u}function i(u){return(u[0]=n(u[0]))===0&&(u[1]=n(u[1])),u}var a=r.Encryptor=r.extend({processBlock:function(u,l){var c=this._cipher,h=c.blockSize,d=this._iv,p=this._counter;d&&(p=this._counter=d.slice(0),this._iv=void 0),i(p);var v=p.slice(0);c.encryptBlock(v,0);for(var x=0;x<h;x++)u[l+x]^=v[x]}});return r.Decryptor=a,r}(),t.mode.CTRGladman})}(F0)),F0.exports}var B0={exports:{}},mh;function ZD(){return mh||(mh=1,function(s,e){(function(t,r,n){s.exports=r(Ge(),jt())})(ye,function(t){return t.mode.OFB=function(){var r=t.lib.BlockCipherMode.extend(),n=r.Encryptor=r.extend({processBlock:function(i,a){var u=this._cipher,l=u.blockSize,c=this._iv,h=this._keystream;c&&(h=this._keystream=c.slice(0),this._iv=void 0),u.encryptBlock(h,0);for(var d=0;d<l;d++)i[a+d]^=h[d]}});return r.Decryptor=n,r}(),t.mode.OFB})}(B0)),B0.exports}var M0={exports:{}},xh;function VD(){return xh||(xh=1,function(s,e){(function(t,r,n){s.exports=r(Ge(),jt())})(ye,function(t){return t.mode.ECB=function(){var r=t.lib.BlockCipherMode.extend();return r.Encryptor=r.extend({processBlock:function(n,i){this._cipher.encryptBlock(n,i)}}),r.Decryptor=r.extend({processBlock:function(n,i){this._cipher.decryptBlock(n,i)}}),r}(),t.mode.ECB})}(M0)),M0.exports}var N0={exports:{}},yh;function GD(){return yh||(yh=1,function(s,e){(function(t,r,n){s.exports=r(Ge(),jt())})(ye,function(t){return t.pad.AnsiX923={pad:function(r,n){var i=r.sigBytes,a=n*4,u=a-i%a,l=i+u-1;r.clamp(),r.words[l>>>2]|=u<<24-l%4*8,r.sigBytes+=u},unpad:function(r){var n=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=n}},t.pad.Ansix923})}(N0)),N0.exports}var S0={exports:{}},Dh;function KD(){return Dh||(Dh=1,function(s,e){(function(t,r,n){s.exports=r(Ge(),jt())})(ye,function(t){return t.pad.Iso10126={pad:function(r,n){var i=n*4,a=i-r.sigBytes%i;r.concat(t.lib.WordArray.random(a-1)).concat(t.lib.WordArray.create([a<<24],1))},unpad:function(r){var n=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=n}},t.pad.Iso10126})}(S0)),S0.exports}var O0={exports:{}},wh;function XD(){return wh||(wh=1,function(s,e){(function(t,r,n){s.exports=r(Ge(),jt())})(ye,function(t){return t.pad.Iso97971={pad:function(r,n){r.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(r,n)},unpad:function(r){t.pad.ZeroPadding.unpad(r),r.sigBytes--}},t.pad.Iso97971})}(O0)),O0.exports}var T0={exports:{}},Eh;function QD(){return Eh||(Eh=1,function(s,e){(function(t,r,n){s.exports=r(Ge(),jt())})(ye,function(t){return t.pad.ZeroPadding={pad:function(r,n){var i=n*4;r.clamp(),r.sigBytes+=i-(r.sigBytes%i||i)},unpad:function(r){for(var n=r.words,i=r.sigBytes-1,i=r.sigBytes-1;i>=0;i--)if(n[i>>>2]>>>24-i%4*8&255){r.sigBytes=i+1;break}}},t.pad.ZeroPadding})}(T0)),T0.exports}var I0={exports:{}},bh;function JD(){return bh||(bh=1,function(s,e){(function(t,r,n){s.exports=r(Ge(),jt())})(ye,function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding})}(I0)),I0.exports}var $0={exports:{}},Ah;function ew(){return Ah||(Ah=1,function(s,e){(function(t,r,n){s.exports=r(Ge(),jt())})(ye,function(t){return function(r){var n=t,i=n.lib,a=i.CipherParams,u=n.enc,l=u.Hex,c=n.format;c.Hex={stringify:function(h){return h.ciphertext.toString(l)},parse:function(h){var d=l.parse(h);return a.create({ciphertext:d})}}}(),t.format.Hex})}($0)),$0.exports}var R0={exports:{}},Ch;function tw(){return Ch||(Ch=1,function(s,e){(function(t,r,n){s.exports=r(Ge(),oi(),ai(),kn(),jt())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.BlockCipher,a=r.algo,u=[],l=[],c=[],h=[],d=[],p=[],v=[],x=[],_=[],y=[];(function(){for(var D=[],C=0;C<256;C++)C<128?D[C]=C<<1:D[C]=C<<1^283;for(var E=0,F=0,C=0;C<256;C++){var B=F^F<<1^F<<2^F<<3^F<<4;B=B>>>8^B&255^99,u[E]=B,l[B]=E;var M=D[E],O=D[M],A=D[O],N=D[B]*257^B*16843008;c[E]=N<<24|N>>>8,h[E]=N<<16|N>>>16,d[E]=N<<8|N>>>24,p[E]=N;var N=A*16843009^O*65537^M*257^E*16843008;v[B]=N<<24|N>>>8,x[B]=N<<16|N>>>16,_[B]=N<<8|N>>>24,y[B]=N,E?(E=M^D[D[D[A^M]]],F^=D[D[F]]):E=F=1}})();var m=[0,1,2,4,8,16,32,64,128,27,54],w=a.AES=i.extend({_doReset:function(){var D;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var C=this._keyPriorReset=this._key,E=C.words,F=C.sigBytes/4,B=this._nRounds=F+6,M=(B+1)*4,O=this._keySchedule=[],A=0;A<M;A++)A<F?O[A]=E[A]:(D=O[A-1],A%F?F>6&&A%F==4&&(D=u[D>>>24]<<24|u[D>>>16&255]<<16|u[D>>>8&255]<<8|u[D&255]):(D=D<<8|D>>>24,D=u[D>>>24]<<24|u[D>>>16&255]<<16|u[D>>>8&255]<<8|u[D&255],D^=m[A/F|0]<<24),O[A]=O[A-F]^D);for(var N=this._invKeySchedule=[],T=0;T<M;T++){var A=M-T;if(T%4)var D=O[A];else var D=O[A-4];T<4||A<=4?N[T]=D:N[T]=v[u[D>>>24]]^x[u[D>>>16&255]]^_[u[D>>>8&255]]^y[u[D&255]]}}},encryptBlock:function(D,C){this._doCryptBlock(D,C,this._keySchedule,c,h,d,p,u)},decryptBlock:function(D,C){var E=D[C+1];D[C+1]=D[C+3],D[C+3]=E,this._doCryptBlock(D,C,this._invKeySchedule,v,x,_,y,l);var E=D[C+1];D[C+1]=D[C+3],D[C+3]=E},_doCryptBlock:function(D,C,E,F,B,M,O,A){for(var N=this._nRounds,T=D[C]^E[0],R=D[C+1]^E[1],k=D[C+2]^E[2],z=D[C+3]^E[3],L=4,G=1;G<N;G++){var H=F[T>>>24]^B[R>>>16&255]^M[k>>>8&255]^O[z&255]^E[L++],ee=F[R>>>24]^B[k>>>16&255]^M[z>>>8&255]^O[T&255]^E[L++],te=F[k>>>24]^B[z>>>16&255]^M[T>>>8&255]^O[R&255]^E[L++],j=F[z>>>24]^B[T>>>16&255]^M[R>>>8&255]^O[k&255]^E[L++];T=H,R=ee,k=te,z=j}var H=(A[T>>>24]<<24|A[R>>>16&255]<<16|A[k>>>8&255]<<8|A[z&255])^E[L++],ee=(A[R>>>24]<<24|A[k>>>16&255]<<16|A[z>>>8&255]<<8|A[T&255])^E[L++],te=(A[k>>>24]<<24|A[z>>>16&255]<<16|A[T>>>8&255]<<8|A[R&255])^E[L++],j=(A[z>>>24]<<24|A[T>>>16&255]<<16|A[R>>>8&255]<<8|A[k&255])^E[L++];D[C]=H,D[C+1]=ee,D[C+2]=te,D[C+3]=j},keySize:256/32});r.AES=i._createHelper(w)}(),t.AES})}(R0)),R0.exports}var L0={exports:{}},Fh;function rw(){return Fh||(Fh=1,function(s,e){(function(t,r,n){s.exports=r(Ge(),oi(),ai(),kn(),jt())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.WordArray,a=n.BlockCipher,u=r.algo,l=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],c=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],h=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],d=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],p=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],v=u.DES=a.extend({_doReset:function(){for(var m=this._key,w=m.words,D=[],C=0;C<56;C++){var E=l[C]-1;D[C]=w[E>>>5]>>>31-E%32&1}for(var F=this._subKeys=[],B=0;B<16;B++){for(var M=F[B]=[],O=h[B],C=0;C<24;C++)M[C/6|0]|=D[(c[C]-1+O)%28]<<31-C%6,M[4+(C/6|0)]|=D[28+(c[C+24]-1+O)%28]<<31-C%6;M[0]=M[0]<<1|M[0]>>>31;for(var C=1;C<7;C++)M[C]=M[C]>>>(C-1)*4+3;M[7]=M[7]<<5|M[7]>>>27}for(var A=this._invSubKeys=[],C=0;C<16;C++)A[C]=F[15-C]},encryptBlock:function(m,w){this._doCryptBlock(m,w,this._subKeys)},decryptBlock:function(m,w){this._doCryptBlock(m,w,this._invSubKeys)},_doCryptBlock:function(m,w,D){this._lBlock=m[w],this._rBlock=m[w+1],x.call(this,4,252645135),x.call(this,16,65535),_.call(this,2,858993459),_.call(this,8,16711935),x.call(this,1,1431655765);for(var C=0;C<16;C++){for(var E=D[C],F=this._lBlock,B=this._rBlock,M=0,O=0;O<8;O++)M|=d[O][((B^E[O])&p[O])>>>0];this._lBlock=B,this._rBlock=F^M}var A=this._lBlock;this._lBlock=this._rBlock,this._rBlock=A,x.call(this,1,1431655765),_.call(this,8,16711935),_.call(this,2,858993459),x.call(this,16,65535),x.call(this,4,252645135),m[w]=this._lBlock,m[w+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function x(m,w){var D=(this._lBlock>>>m^this._rBlock)&w;this._rBlock^=D,this._lBlock^=D<<m}function _(m,w){var D=(this._rBlock>>>m^this._lBlock)&w;this._lBlock^=D,this._rBlock^=D<<m}r.DES=a._createHelper(v);var y=u.TripleDES=a.extend({_doReset:function(){var m=this._key,w=m.words;if(w.length!==2&&w.length!==4&&w.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var D=w.slice(0,2),C=w.length<4?w.slice(0,2):w.slice(2,4),E=w.length<6?w.slice(0,2):w.slice(4,6);this._des1=v.createEncryptor(i.create(D)),this._des2=v.createEncryptor(i.create(C)),this._des3=v.createEncryptor(i.create(E))},encryptBlock:function(m,w){this._des1.encryptBlock(m,w),this._des2.decryptBlock(m,w),this._des3.encryptBlock(m,w)},decryptBlock:function(m,w){this._des3.decryptBlock(m,w),this._des2.encryptBlock(m,w),this._des1.decryptBlock(m,w)},keySize:192/32,ivSize:64/32,blockSize:64/32});r.TripleDES=a._createHelper(y)}(),t.TripleDES})}(L0)),L0.exports}var P0={exports:{}},Bh;function nw(){return Bh||(Bh=1,function(s,e){(function(t,r,n){s.exports=r(Ge(),oi(),ai(),kn(),jt())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.StreamCipher,a=r.algo,u=a.RC4=i.extend({_doReset:function(){for(var h=this._key,d=h.words,p=h.sigBytes,v=this._S=[],x=0;x<256;x++)v[x]=x;for(var x=0,_=0;x<256;x++){var y=x%p,m=d[y>>>2]>>>24-y%4*8&255;_=(_+v[x]+m)%256;var w=v[x];v[x]=v[_],v[_]=w}this._i=this._j=0},_doProcessBlock:function(h,d){h[d]^=l.call(this)},keySize:256/32,ivSize:0});function l(){for(var h=this._S,d=this._i,p=this._j,v=0,x=0;x<4;x++){d=(d+1)%256,p=(p+h[d])%256;var _=h[d];h[d]=h[p],h[p]=_,v|=h[(h[d]+h[p])%256]<<24-x*8}return this._i=d,this._j=p,v}r.RC4=i._createHelper(u);var c=a.RC4Drop=u.extend({cfg:u.cfg.extend({drop:192}),_doReset:function(){u._doReset.call(this);for(var h=this.cfg.drop;h>0;h--)l.call(this)}});r.RC4Drop=i._createHelper(c)}(),t.RC4})}(P0)),P0.exports}var k0={exports:{}},Mh;function iw(){return Mh||(Mh=1,function(s,e){(function(t,r,n){s.exports=r(Ge(),oi(),ai(),kn(),jt())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.StreamCipher,a=r.algo,u=[],l=[],c=[],h=a.Rabbit=i.extend({_doReset:function(){for(var p=this._key.words,v=this.cfg.iv,x=0;x<4;x++)p[x]=(p[x]<<8|p[x]>>>24)&16711935|(p[x]<<24|p[x]>>>8)&4278255360;var _=this._X=[p[0],p[3]<<16|p[2]>>>16,p[1],p[0]<<16|p[3]>>>16,p[2],p[1]<<16|p[0]>>>16,p[3],p[2]<<16|p[1]>>>16],y=this._C=[p[2]<<16|p[2]>>>16,p[0]&4294901760|p[1]&65535,p[3]<<16|p[3]>>>16,p[1]&4294901760|p[2]&65535,p[0]<<16|p[0]>>>16,p[2]&4294901760|p[3]&65535,p[1]<<16|p[1]>>>16,p[3]&4294901760|p[0]&65535];this._b=0;for(var x=0;x<4;x++)d.call(this);for(var x=0;x<8;x++)y[x]^=_[x+4&7];if(v){var m=v.words,w=m[0],D=m[1],C=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360,E=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360,F=C>>>16|E&4294901760,B=E<<16|C&65535;y[0]^=C,y[1]^=F,y[2]^=E,y[3]^=B,y[4]^=C,y[5]^=F,y[6]^=E,y[7]^=B;for(var x=0;x<4;x++)d.call(this)}},_doProcessBlock:function(p,v){var x=this._X;d.call(this),u[0]=x[0]^x[5]>>>16^x[3]<<16,u[1]=x[2]^x[7]>>>16^x[5]<<16,u[2]=x[4]^x[1]>>>16^x[7]<<16,u[3]=x[6]^x[3]>>>16^x[1]<<16;for(var _=0;_<4;_++)u[_]=(u[_]<<8|u[_]>>>24)&16711935|(u[_]<<24|u[_]>>>8)&4278255360,p[v+_]^=u[_]},blockSize:128/32,ivSize:64/32});function d(){for(var p=this._X,v=this._C,x=0;x<8;x++)l[x]=v[x];v[0]=v[0]+1295307597+this._b|0,v[1]=v[1]+3545052371+(v[0]>>>0<l[0]>>>0?1:0)|0,v[2]=v[2]+886263092+(v[1]>>>0<l[1]>>>0?1:0)|0,v[3]=v[3]+1295307597+(v[2]>>>0<l[2]>>>0?1:0)|0,v[4]=v[4]+3545052371+(v[3]>>>0<l[3]>>>0?1:0)|0,v[5]=v[5]+886263092+(v[4]>>>0<l[4]>>>0?1:0)|0,v[6]=v[6]+1295307597+(v[5]>>>0<l[5]>>>0?1:0)|0,v[7]=v[7]+3545052371+(v[6]>>>0<l[6]>>>0?1:0)|0,this._b=v[7]>>>0<l[7]>>>0?1:0;for(var x=0;x<8;x++){var _=p[x]+v[x],y=_&65535,m=_>>>16,w=((y*y>>>17)+y*m>>>15)+m*m,D=((_&4294901760)*_|0)+((_&65535)*_|0);c[x]=w^D}p[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,p[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,p[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,p[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,p[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,p[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,p[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,p[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}r.Rabbit=i._createHelper(h)}(),t.Rabbit})}(k0)),k0.exports}var z0={exports:{}},Nh;function sw(){return Nh||(Nh=1,function(s,e){(function(t,r,n){s.exports=r(Ge(),oi(),ai(),kn(),jt())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.StreamCipher,a=r.algo,u=[],l=[],c=[],h=a.RabbitLegacy=i.extend({_doReset:function(){var p=this._key.words,v=this.cfg.iv,x=this._X=[p[0],p[3]<<16|p[2]>>>16,p[1],p[0]<<16|p[3]>>>16,p[2],p[1]<<16|p[0]>>>16,p[3],p[2]<<16|p[1]>>>16],_=this._C=[p[2]<<16|p[2]>>>16,p[0]&4294901760|p[1]&65535,p[3]<<16|p[3]>>>16,p[1]&4294901760|p[2]&65535,p[0]<<16|p[0]>>>16,p[2]&4294901760|p[3]&65535,p[1]<<16|p[1]>>>16,p[3]&4294901760|p[0]&65535];this._b=0;for(var y=0;y<4;y++)d.call(this);for(var y=0;y<8;y++)_[y]^=x[y+4&7];if(v){var m=v.words,w=m[0],D=m[1],C=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360,E=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360,F=C>>>16|E&4294901760,B=E<<16|C&65535;_[0]^=C,_[1]^=F,_[2]^=E,_[3]^=B,_[4]^=C,_[5]^=F,_[6]^=E,_[7]^=B;for(var y=0;y<4;y++)d.call(this)}},_doProcessBlock:function(p,v){var x=this._X;d.call(this),u[0]=x[0]^x[5]>>>16^x[3]<<16,u[1]=x[2]^x[7]>>>16^x[5]<<16,u[2]=x[4]^x[1]>>>16^x[7]<<16,u[3]=x[6]^x[3]>>>16^x[1]<<16;for(var _=0;_<4;_++)u[_]=(u[_]<<8|u[_]>>>24)&16711935|(u[_]<<24|u[_]>>>8)&4278255360,p[v+_]^=u[_]},blockSize:128/32,ivSize:64/32});function d(){for(var p=this._X,v=this._C,x=0;x<8;x++)l[x]=v[x];v[0]=v[0]+1295307597+this._b|0,v[1]=v[1]+3545052371+(v[0]>>>0<l[0]>>>0?1:0)|0,v[2]=v[2]+886263092+(v[1]>>>0<l[1]>>>0?1:0)|0,v[3]=v[3]+1295307597+(v[2]>>>0<l[2]>>>0?1:0)|0,v[4]=v[4]+3545052371+(v[3]>>>0<l[3]>>>0?1:0)|0,v[5]=v[5]+886263092+(v[4]>>>0<l[4]>>>0?1:0)|0,v[6]=v[6]+1295307597+(v[5]>>>0<l[5]>>>0?1:0)|0,v[7]=v[7]+3545052371+(v[6]>>>0<l[6]>>>0?1:0)|0,this._b=v[7]>>>0<l[7]>>>0?1:0;for(var x=0;x<8;x++){var _=p[x]+v[x],y=_&65535,m=_>>>16,w=((y*y>>>17)+y*m>>>15)+m*m,D=((_&4294901760)*_|0)+((_&65535)*_|0);c[x]=w^D}p[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,p[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,p[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,p[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,p[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,p[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,p[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,p[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}r.RabbitLegacy=i._createHelper(h)}(),t.RabbitLegacy})}(z0)),z0.exports}var q0={exports:{}},Sh;function ow(){return Sh||(Sh=1,function(s,e){(function(t,r,n){s.exports=r(Ge(),oi(),ai(),kn(),jt())})(ye,function(t){return function(){var r=t,n=r.lib,i=n.BlockCipher,a=r.algo;const u=16,l=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],c=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var h={pbox:[],sbox:[]};function d(y,m){let w=m>>24&255,D=m>>16&255,C=m>>8&255,E=m&255,F=y.sbox[0][w]+y.sbox[1][D];return F=F^y.sbox[2][C],F=F+y.sbox[3][E],F}function p(y,m,w){let D=m,C=w,E;for(let F=0;F<u;++F)D=D^y.pbox[F],C=d(y,D)^C,E=D,D=C,C=E;return E=D,D=C,C=E,C=C^y.pbox[u],D=D^y.pbox[u+1],{left:D,right:C}}function v(y,m,w){let D=m,C=w,E;for(let F=u+1;F>1;--F)D=D^y.pbox[F],C=d(y,D)^C,E=D,D=C,C=E;return E=D,D=C,C=E,C=C^y.pbox[1],D=D^y.pbox[0],{left:D,right:C}}function x(y,m,w){for(let B=0;B<4;B++){y.sbox[B]=[];for(let M=0;M<256;M++)y.sbox[B][M]=c[B][M]}let D=0;for(let B=0;B<u+2;B++)y.pbox[B]=l[B]^m[D],D++,D>=w&&(D=0);let C=0,E=0,F=0;for(let B=0;B<u+2;B+=2)F=p(y,C,E),C=F.left,E=F.right,y.pbox[B]=C,y.pbox[B+1]=E;for(let B=0;B<4;B++)for(let M=0;M<256;M+=2)F=p(y,C,E),C=F.left,E=F.right,y.sbox[B][M]=C,y.sbox[B][M+1]=E;return!0}var _=a.Blowfish=i.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var y=this._keyPriorReset=this._key,m=y.words,w=y.sigBytes/4;x(h,m,w)}},encryptBlock:function(y,m){var w=p(h,y[m],y[m+1]);y[m]=w.left,y[m+1]=w.right},decryptBlock:function(y,m){var w=v(h,y[m],y[m+1]);y[m]=w.left,y[m+1]=w.right},blockSize:64/32,keySize:128/32,ivSize:64/32});r.Blowfish=i._createHelper(_)}(),t.Blowfish})}(q0)),q0.exports}(function(s,e){(function(t,r,n){s.exports=r(Ge(),Fo(),RD(),LD(),oi(),PD(),ai(),nh(),p0(),kD(),ah(),zD(),qD(),UD(),D0(),WD(),kn(),jt(),HD(),jD(),YD(),ZD(),VD(),GD(),KD(),XD(),QD(),JD(),ew(),tw(),rw(),nw(),iw(),sw(),ow())})(ye,function(t){return t})})(Vl);var Bo=Vl.exports;class aw{constructor(e,t){U(this,"_variables");U(this,"_scriptId");this._variables=e,this._scriptId=t}security(e,t){const r=self.workerStorage.get(`request_${this._scriptId}`);let{expression:n,paramsExpr:i=[]}=e;if(r!=null&&r.has(t)){const _=r.get(t);return this._runScripts(_,t,!0,i)}let a=[],u=1;n=Bo.AES.decrypt(n,"1234").toString(Bo.enc.Utf8);const l=JSON.parse(n),c=l.pop();let h=(c==null?void 0:c.depends)||[];if(!h.length)return this._runScripts((c==null?void 0:c.code)||"",t,!0,i);let d=[],p=[];if(this._getDependCodes(h,l,a,d,p),p.length){const _=i.length;let y=[];for(let m=_-1;m>=0;m--){const w=i[m];let D=JSON.parse(Bo.AES.decrypt(w,"1234").toString(Bo.enc.Utf8));const C=[];u!==0&&y.unshift("{"),u++,D=D.map(F=>{const{scope:B,code:M,varNames:O,dependSelf:A}=F;return B===2&&!C.includes(O)&&!A&&(F.code=`let ${M}`),O&&C.push(...O.split(",")),F});let E=p.map(F=>({...F,isArg:!1,isPreArg:!0}));p=[],this._getDependCodes(E,D,y,d,p),a=y.concat(a),y=[]}}for(a.push(`return ${c==null?void 0:c.code}`);u>1;)a.push("}"),u--;a=d.concat(a);const v=a.join(`
76
+ `);console.log(v,t,"-------------------------");const x=this._runScripts(v,t,!0,i);return r==null||r.set(t,v),console.log(x,"----------------====================="),x}_getDependCodes(e,t,r,n,i){for(const a of e){if(!a.isArg){const u=t.filter(c=>{var h;return(h=c==null?void 0:c.depends)==null?void 0:h.some(d=>d.name===a.name&&d.scope===a.scope&&d.isAgainAssign)});for(const c of u){const{code:h,depends:d}=c;r.includes(h)||(r.unshift(h),d!=null&&d.length&&this._getDependCodes(d,t,r,n,i))}const l=t.find(c=>{var h;return((h=c.varNames)==null?void 0:h.split(",").includes(a.name))&&(!a.isPreArg||a.isPreArg&&c.methodName===a.functionName)||c.funcName===a.name});if(l){const{code:c,depends:h}=l,d=r.findIndex(p=>p===c);d!==-1&&r.splice(d,1),r.unshift(c),h!=null&&h.length&&this._getDependCodes(h,t,r,n,i);continue}}i.some(u=>u.name===a.name)||i.push(a)}}_runScripts(e,t,r,n,i){const a=`${this._scriptId}_${t}`;let{builtInGather:u,buildinConstants:l,buildInFunctions:c,tradingvueFunc:h}=self.workerStorage.get(a)||{};return r&&(u=new Oh,l=new Ul,c=new Zl(this._variables.mintick||1e-4,u,this._scriptId),h=new Function("$_var","$_const","$_func","$paramsExpr","$posStr",e),self.workerStorage.set(a,{builtInGather:u,buildinConstants:l,buildInFunctions:c,tradingvueFunc:h})),h(u,l,c,n||[],t)}}class uw{constructor(e){U(this,"_logs");U(this,"_variables");U(this,"_intlFormat");this._variables=e,this._logs=[],this._intlFormat=new Intl.NumberFormat("en-US")}get logs(){return this._logs}clearLogs(){this._logs=[]}info(e,t,r){this._addLog(e,t,"info",r)}error(e,t,r){this._addLog(e,t,"error",r)}warning(e,t,r){this._addLog(e,t,"warning",r)}_addLog(e,t,r,n){if(typeof t=="string"&&(n=t),n.startsWith("export"))return;const{message:i,formatString:a}=e,{time:u,bar_index:l}=this._variables;let c=i;a&&Array.isArray(t)&&t.length&&(c=a.replace(/{(\d+)}/g,(h,d)=>{let p=t[d];return typeof p=="number"&&(p=this._intlFormat.format(parseFloat(p.toFixed(3)))),p!==void 0?p:h})),c&&this._logs.push({message:`[${ot(u).format()}]: ${c}`,time:u,barIndex:l,type:r})}}class fw{constructor(e){U(this,"_errorListener");this._errorListener=e}error({message:e},t){t.startsWith("export")||this._errorListener.addError(e,t,Ve.Error)}}class cw{constructor(){U(this,"_errors");this._errors=new Map}clear(){this._errors.clear()}get errors(){return Yr.flatMap([...this._errors.values()])}addError(e,t,r){const[n,i]=t.split("_").slice(-2),a=this._errors.get(t),u={message:e,endLineNumber:Number(n),startColumn:Number(i)+1,endColumn:Number(i)+1,startLineNumber:Number(n),type:r};a?a.push(u):this._errors.set(t,[u])}}class lw{constructor(){U(this,"_isMarketOpen");U(this,"_currentBarIndex");U(this,"_totalBarIndex");U(this,"_isRealTimeBar");U(this,"_preBarIndex");this._currentBarIndex=0,this._totalBarIndex=0,this._isRealTimeBar=!1,this._preBarIndex=0,this._isMarketOpen=!0}update(e,t,r,n){this._preBarIndex=this._currentBarIndex,this._currentBarIndex=e,this._totalBarIndex=t,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 hw{constructor(e){U(this,"_variables");this._variables=e}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 e=pn(this._variables.timeframe.period);return this._variables.time+e===this._variables.time_tradingday+24*60*60*1e3}get islastbar_regular(){if(this._variables.timeframe.isdwm)return!0;const e=pn(this._variables.timeframe.period);return this._variables.time+e===this._variables.time_tradingday+24*60*60*1e3}get ismarket(){return!0}get ispostmarket(){return!1}get ispremarket(){return!1}}class dw{constructor(e){U(this,"_orders");U(this,"_historyOrders");U(this,"_options");U(this,"_max_contracts_held_all",0);U(this,"_max_contracts_held_long",0);U(this,"_max_contracts_held_short",0);U(this,"_max_drawdown",0);U(this,"_max_runup",0);U(this,"_max_runup_percent",0);U(this,"_max_drawdown_percent",0);U(this,"_variables");U(this,"_netprofit",0);U(this,"_eventrades",0);U(this,"_avg_trade_percent");U(this,"_closedtrades",0);U(this,"_losstrades",0);U(this,"_grossloss",0);U(this,"_grossloss_percent",0);U(this,"_grossprofit",0);U(this,"_grossprofit_percent",0);U(this,"_wintrades",0);U(this,"_opentrades_capital_held",0);U(this,"_position_avg_price",0);U(this,"_position_size",0);this._orders=[],this._historyOrders=[],this._variables=e}update(){this._calcMaxDrawdownAndMaxRunup()}_calcMaxDrawdownAndMaxRunup(){let e=0,t=0;const{high:r,low:n}=this._variables;for(const c of this._orders){const{in_price:h,qty:d=0,commission:p=0,original_qty:v=0,direction:x}=c,_=x===gt.long?1:-1,y=(r-h)*d,m=(n-h)*d,w=_===1?y:-m,D=_===1?-m:y;e+=D+p*d/v,t+=w+p*d/v}const[i,a]=this._historyOrders.reduce((c,h)=>{let[d,p]=c;const{profit:v=0,commission:x=0}=h;return d+=v,p+=v-x,[d,p]},[0,0]);e-=i,t+=a;const u=e/(this.initial_capital+this.netprofit)*100;this._max_drawdown<e&&(this._max_drawdown=e),u>this._max_drawdown_percent&&(this._max_drawdown_percent=u);const l=t/(this.initial_capital+this.netprofit)*100;t>this._max_runup&&(this._max_runup=t),l>this._max_runup_percent&&(this._max_runup_percent=l)}updateOrders(e){this._orders=e,this._calcMaxContracts()}_calcMaxContracts(){const e=this._orders.length;if(!e)return;const[t,r,n,i,a,u]=this._orders.reduce(([l,c,h,d,p,v],x)=>{const{direction:_,qty:y=0,in_price:m}=x;return _===gt.long?(l+=y,c+=y,v+=y):(l+=y,h+=y,v-=y),d+=y*m,p+=m,[l,c,h,d,p,v]},[0,0,0,0,0,0]);this._position_size=u,this._position_avg_price=a/e,this._opentrades_capital_held=i,this._max_contracts_held_all=Math.max(t,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(e){this._historyOrders=e;const t=this._historyOrders.length;this._closedtrades=t;const[r,n,i,a,u,l]=this._historyOrders.reduce((c,h)=>{let[d,p,v,x,_,y]=c;const{profit:m=0,profit_percent:w=0}=h;return d+=m,p+=w,m<0?(v+=m,x+=w):(_+=m,y+=w),[d,p,v,x,_,y]},[0,0,0,0,0,0]);this._avg_trade_percent=t?n/t:void 0,this._netprofit=r,this._grossloss=i,this._grossloss_percent=a,this._grossprofit=u,this._grossprofit_percent=l,this._eventrades=this._historyOrders.filter(c=>c.profit===0).length,this._losstrades=this._historyOrders.filter(c=>(c.profit||0)<0).length,this._wintrades=this._historyOrders.filter(c=>(c.profit||0)>0).length}updateStrategyOptions(e){this._options=e}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 e=this.losstrades;return e?Math.abs(this.grossloss/e):void 0}get avg_losing_trade_percent(){const e=this.losstrades;return e?Math.abs(this.grossloss_percent/e):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((e,t)=>{const{profit:r=0}=t;return e+r},0)}get avg_trade_percent(){return this._avg_trade_percent}get avg_winning_trade(){const e=this.wintrades;return e?Math.abs(this.grossprofit/e):void 0}get avg_winning_trade_percent(){const e=this.wintrades;return e?Math.abs(this.grossprofit_percent/e):void 0}get initial_capital(){var e;return((e=this._options)==null?void 0:e.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:e,margin_long:t=0,margin_short:r=0,commission_type:n,commission_value:i=0}=this._options,a=this._orders[0].direction===gt.long?1:-1,u=(a===1?t:r)/100;if(u<=0)return;const{close:l}=this._variables,[c,h]=this._orders.reduce((d,p)=>{let[v,x]=d;const{in_price:_,qty:y=0,original_qty:m=0}=p,w=_*y;if(v+=w,i){let D=0;switch(n){case Tr.percent:D=(w+y*l)*i/100;break;case Tr.cashPerContract:D=y*i*2;break;case Tr.cashPerOrder:D=y/m*i+i;break}x+=D}return[v,x]},[0,0]);return(c-(e+this.netprofit-h))*a/this.position_size/(1-a*u)}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 pw{constructor(){U(this,"_preAccdist");U(this,"_preNvi");U(this,"_prePvi");U(this,"_preObv");U(this,"_prePvt");U(this,"_preWad");U(this,"_preVwap");U(this,"_preValue");U(this,"_currentData");U(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(e){this._preValue={},e.barIndex!==this._currentData.barIndex&&(this._preData={...this._currentData}),this._currentData={...e}}get isRealTime(){return this._preData.barIndex===this._currentData.barIndex}get accdist(){if(this._preValue.accdist)return this._preValue.accdist;const{close:e,low:t,high:r,volume:n}=this._currentData;if(r===t)return this._preAccdist;const i=(e-t-(r-e))/(r-t)*n+this._preAccdist;return!this.isRealTime&&(this._preAccdist=i),this._preValue.accdist=i,i}get iii(){if(this._preValue.iii)return this._preValue.iii;const{close:e,low:t,high:r,volume:n}=this._currentData,i=(2*e-r-t)/((r-t)*n);return this._preValue.iii=i,i}get nvi(){return this._preValue.nvi?this._preValue.nvi:this._getNvi()}get wvad(){if(this._preValue.wvad)return this._preValue.wvad;const{close:e,low:t,high:r,volume:n,open:i}=this._currentData,a=(e-i)/(r-t)*n;return this._preValue.wvad=a,a}get obv(){if(this._preValue.obv)return this._preValue.obv;const{close:e,volume:t}=this._currentData,{close:r}=this._preData;if(r===void 0){this._preObv=0;return}const n=Math.sign(e-r)*t+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:e,high:t}=this._currentData,{close:r}=this._preData;if(r===void 0)return;const n=Math.max(t-e,Math.abs(t-r),Math.abs(e-r));return this._preValue.tr=n,n}get pvt(){if(this._preValue.pvt)return this._preValue.pvt;const{close:e,volume:t}=this._currentData,{close:r}=this._preData;if(r===void 0){this._prePvt=0;return}const n=(e-r)/r*t+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:e,high:t,low:r}=this._currentData,{close:n}=this._preData;if(n===void 0)return this._preWad=0,0;const i=Math.max(t,n),a=Math.min(r,n),u=e-n,c=(u>0?e-a:u<0?e-i:0)+this._preWad;return!this.isRealTime&&(this._preWad=c),this._preValue.wad=c,c}get vwap(){if(this._preValue.vwap)return this._preValue.vwap;const{hlc3:e,volume:t}=this._currentData;let{sum:r=0,sumV:n=0,isReset:i}=this._preVwap;if(self.buildInFunctions.timeframe.change({timeframe:"1D"},"vwap_buildin")&&(i=!0,r=n=0),!i)return;const u=e*t+r,l=t+n;!this.isRealTime&&(this._preVwap={sum:u,sumV:l,isReset:i});const c=u/l;return this._preValue.vwap=c,c}_getNvi(){const e=this._preNvi||1,{close:t=0,volume:r=0}=this._preData,{close:n,volume:i}=this._currentData;let a=1;const u=e||1;return n&&t?a=i<r?u+(n-t)/t*u:u:a=u,!this.isRealTime&&(this._preNvi=a),this._preValue.nvi=a,a}_getPvi(){const e=this._prePvi||1,{close:t=0,volume:r=0}=this._preData,{close:n,volume:i}=this._currentData;let a=1;const u=e||1;return n&&t?a=i>r?u+(n-t)/t*u:u:a=u,!this.isRealTime&&(this._prePvi=a),this._preValue.pvi=a,a}}class _w{constructor(){U(this,"_period");U(this,"_multiplier");U(this,"_unit");this._period="1",this._multiplier=1,this._unit="m"}update(e){if(!e)return;this._period=e;const[t,r]=Ls(e);this._multiplier=t,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}}ot.extend(_1),ot.extend(Df),ot.extend(d1);class Oh{constructor(){U(this,"_cacheData");U(this,"_barIndex");U(this,"_isRealTimeBar");U(this,"_barstate");U(this,"_priceVariables");U(this,"_lastBarIndex");U(this,"_currentBarTime");U(this,"_lastBarTime");U(this,"_period");U(this,"_offsetTime");U(this,"_timeframe");U(this,"_ta");U(this,"_polyline");U(this,"_label");U(this,"_line");U(this,"_linefill");U(this,"_box");U(this,"_table");U(this,"_strategy");U(this,"_session");U(this,"_timeTradingday");U(this,"_mintick");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 lw,this._timeframe=new _w,this._priceVariables={close:0,open:0,low:0,high:0,volume:0},this._ta=new pw,this._polyline=new Ii,this._label=new Ii,this._line=new Ii,this._linefill=new Ii,this._box=new Ii,this._table=new Ii(1),this._strategy=new dw(this),this._session=new hw(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:e,open:t,high:r,low:n}=this._priceVariables;return(e+t+r+n)/4}get hl2(){const{high:e,low:t}=this._priceVariables;return(e+t)/2}get hlc3(){const{close:e,high:t,low:r}=this._priceVariables;return(e+t+r)/3}get hlcc4(){const{close:e,high:t,low:r}=this._priceVariables;return(e*2+t+r)/4}get hour(){return ot(this._currentBarTime).subtract(this._offsetTime,"hour").hour()}get minute(){return ot(this._currentBarTime).minute()}get second(){return ot(this._currentBarTime).second()}get month(){return ot(this._currentBarTime).month()+1}get year(){return ot(this._currentBarTime).year()}get dayofweek(){return ot(this._currentBarTime).day()+1}get dayofmonth(){return ot(this._currentBarTime).date()}get weekofyear(){return ot(this._currentBarTime).week()}get last_bar_time(){return this._lastBarTime}get time(){return this._currentBarTime}get time_close(){const[e,t]=Ls(this._period);return this._isRealTimeBar?void 0:ot(this._currentBarTime).add(e,t).valueOf()}get timenow(){return Date.now()}get time_tradingday(){return this._timeTradingday||this.getTimeTradingday(this._currentBarTime,this._period)}get timeframe(){return this._timeframe}get mintick(){return this._mintick}updateMaxLength(e){const{max_lines_count:t,max_labels_count:r,max_boxes_count:n,max_polylines_count:i}=e;n&&this._box.setMaxLen(n),r&&this._label.setMaxLen(r),t&&this._line.setMaxLen(t),i&&this._polyline.setMaxLen(i)}getTimeTradingday(e,t){const[r,n]=Ls(t),i=ot(e);return["M","w","y","d"].includes(n)?i.valueOf():(i.subtract(this._offsetTime,"h"),i.startOf("d").add(this._offsetTime,"h").valueOf())}updateOptions(e){const{interval:t="1D",offsetTime:r=5,mintick:n}=e;this._period=t,this._mintick=n,this._offsetTime=r,this._timeframe.update(t)}updateData(e){const{barIndex:t,c:r,o:n,h:i,l:a,volume:u,time:l,lastBarIndex:c,lastBarTime:h,complete:d,time_tradingday:p}=e;this._priceVariables={close:Number(r),open:Number(n),high:Number(i),low:Number(a),volume:Number(u)},this._isRealTimeBar=d,t>this._barIndex&&this._isRealTimeBar&&(this._cacheData.varData=this._cacheData.varNewData,this._cacheData.varNewData={}),this._timeTradingday=p,this._currentBarTime=l*1e3,this._lastBarIndex=c,this._barIndex=t,this._lastBarTime=h*1e3,this._barstate.update(t,c,!1,!1),this.ta.update({...this._priceVariables,hlc3:this.hlc3,barIndex:t})}getCacheData(e,t,r){let n=this._cacheData[e]||[];n[this._barIndex]=r,n=n.filter(()=>!0);const i=n[n.length-1-t];return this._cacheData[e]=n,i}setCacheData(e,t){const r=this._cacheData[e]||[];r[this._barIndex]=t,this._cacheData[e]=r}getTypeInstance(e,t){return new f1(e,t)}getVarValue(e,t,r){const n=`${e}_${t}`,i=r==="var"?this._cacheData.varData[n]:this._cacheData.varipData[n];if(i)return i}setVarValue(e,t,r,n){const i=`${e}_${t}`;let a;switch(typeof r=="object"&&r&&(n="var",a=r.varipKeys),n){case"var":if(this._isRealTimeBar){const u=Yr.cloneDeep(r);if(this._cacheData.varNewData[i]=u,a&&a.length)for(const l of a)this._cacheData.varData[i][l]=u[l]}else this._cacheData.varData[i]=r;break;case"varip":this._cacheData.varipData[i]=r;break}return r}add(e,t){return Array.isArray(e)&&Array.isArray(t)?Yr.uniq([...e,...t]):typeof e=="number"||typeof t=="number"?Number(e)+Number(t):e+t}sub(e,t){return Array.isArray(e)&&Array.isArray(t)?e.filter(r=>!t.includes(r)):Number(e)-Number(t)}againAssignParse(e,t){var n;if(t)return;const r=(n=e==null?void 0:e.constructor)==null?void 0:n.name;if(r)switch(r){case hs.name:case Wl.name:case ps.name:case i0.name:case ds.name:case Co.name:e==null||e.delete();break}}}class Ii{constructor(e=50){U(this,"_all");U(this,"_allInstance");U(this,"_pseudoArrayAll");U(this,"_maxLength");this._all=new Map,this._allInstance=new Map,this._pseudoArrayAll=new it,this._maxLength=e}setMaxLen(e){this._maxLength=e}get data(){return[...this._all.values()]}get all(){return this._pseudoArrayAll._value=[...this._allInstance.values()],this._pseudoArrayAll}add(e,t,r){this._all.set(e,t),this._allInstance.set(e,r);const n=[...this._all.keys()];if(n.length>this._maxLength){const i=n.shift();i&&this.delete(i)}}get(e){return this._all.get(e)}getInstance(e){return this._allInstance.get(e)}delete(e){this._all.delete(e),this._allInstance.delete(e)}}/**
77
+ * @license
78
+ * Copyright 2019 Google LLC
79
+ * SPDX-License-Identifier: Apache-2.0
80
+ */const Th=Symbol("Comlink.proxy"),vw=Symbol("Comlink.endpoint"),gw=Symbol("Comlink.releaseProxy"),U0=Symbol("Comlink.finalizer"),Mo=Symbol("Comlink.thrown"),Ih=s=>typeof s=="object"&&s!==null||typeof s=="function",mw={canHandle:s=>Ih(s)&&s[Th],serialize(s){const{port1:e,port2:t}=new MessageChannel;return W0(s,e),[t,[t]]},deserialize(s){return s.start(),ww(s)}},xw={canHandle:s=>Ih(s)&&Mo in s,serialize({value:s}){let e;return s instanceof Error?e={isError:!0,value:{message:s.message,name:s.name,stack:s.stack}}:e={isError:!1,value:s},[e,[]]},deserialize(s){throw s.isError?Object.assign(new Error(s.value.message),s.value):s.value}},$h=new Map([["proxy",mw],["throw",xw]]);function yw(s,e){for(const t of s)if(e===t||t==="*"||t instanceof RegExp&&t.test(e))return!0;return!1}function W0(s,e=globalThis,t=["*"]){e.addEventListener("message",function r(n){if(!n||!n.data)return;if(!yw(t,n.origin)){console.warn(`Invalid origin '${n.origin}' for comlink proxy`);return}const{id:i,type:a,path:u}=Object.assign({path:[]},n.data),l=(n.data.argumentList||[]).map(ui);let c;try{const h=u.slice(0,-1).reduce((p,v)=>p[v],s),d=u.reduce((p,v)=>p[v],s);switch(a){case"GET":c=d;break;case"SET":h[u.slice(-1)[0]]=ui(n.data.value),c=!0;break;case"APPLY":c=d.apply(h,l);break;case"CONSTRUCT":{const p=new d(...l);c=Fw(p)}break;case"ENDPOINT":{const{port1:p,port2:v}=new MessageChannel;W0(s,v),c=Cw(p,[p])}break;case"RELEASE":c=void 0;break;default:return}}catch(h){c={value:h,[Mo]:0}}Promise.resolve(c).catch(h=>({value:h,[Mo]:0})).then(h=>{const[d,p]=To(h);e.postMessage(Object.assign(Object.assign({},d),{id:i}),p),a==="RELEASE"&&(e.removeEventListener("message",r),Rh(e),U0 in s&&typeof s[U0]=="function"&&s[U0]())}).catch(h=>{const[d,p]=To({value:new TypeError("Unserializable return value"),[Mo]:0});e.postMessage(Object.assign(Object.assign({},d),{id:i}),p)})}),e.start&&e.start()}function Dw(s){return s.constructor.name==="MessagePort"}function Rh(s){Dw(s)&&s.close()}function ww(s,e){return H0(s,[],e)}function No(s){if(s)throw new Error("Proxy has been released and is not useable")}function Lh(s){return $i(s,{type:"RELEASE"}).then(()=>{Rh(s)})}const So=new WeakMap,Oo="FinalizationRegistry"in globalThis&&new FinalizationRegistry(s=>{const e=(So.get(s)||0)-1;So.set(s,e),e===0&&Lh(s)});function Ew(s,e){const t=(So.get(e)||0)+1;So.set(e,t),Oo&&Oo.register(s,e,s)}function bw(s){Oo&&Oo.unregister(s)}function H0(s,e=[],t=function(){}){let r=!1;const n=new Proxy(t,{get(i,a){if(No(r),a===gw)return()=>{bw(n),Lh(s),r=!0};if(a==="then"){if(e.length===0)return{then:()=>n};const u=$i(s,{type:"GET",path:e.map(l=>l.toString())}).then(ui);return u.then.bind(u)}return H0(s,[...e,a])},set(i,a,u){No(r);const[l,c]=To(u);return $i(s,{type:"SET",path:[...e,a].map(h=>h.toString()),value:l},c).then(ui)},apply(i,a,u){No(r);const l=e[e.length-1];if(l===vw)return $i(s,{type:"ENDPOINT"}).then(ui);if(l==="bind")return H0(s,e.slice(0,-1));const[c,h]=Ph(u);return $i(s,{type:"APPLY",path:e.map(d=>d.toString()),argumentList:c},h).then(ui)},construct(i,a){No(r);const[u,l]=Ph(a);return $i(s,{type:"CONSTRUCT",path:e.map(c=>c.toString()),argumentList:u},l).then(ui)}});return Ew(n,s),n}function Aw(s){return Array.prototype.concat.apply([],s)}function Ph(s){const e=s.map(To);return[e.map(t=>t[0]),Aw(e.map(t=>t[1]))]}const kh=new WeakMap;function Cw(s,e){return kh.set(s,e),s}function Fw(s){return Object.assign(s,{[Th]:!0})}function To(s){for(const[e,t]of $h)if(t.canHandle(s)){const[r,n]=t.serialize(s);return[{type:"HANDLER",name:e,value:r},n]}return[{type:"RAW",value:s},kh.get(s)||[]]}function ui(s){switch(s.type){case"HANDLER":return $h.get(s.name).deserialize(s.value);case"RAW":return s.value}}function $i(s,e,t){return new Promise(r=>{const n=Bw();s.addEventListener("message",function i(a){!a.data||!a.data.id||a.data.id!==n||(s.removeEventListener("message",i),r(a.data))}),s.start&&s.start(),s.postMessage(Object.assign({id:n},e),t)})}function Bw(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}class Mw{constructor(){U(this,"_cache");this._cache=new Map}set(e,t){this._cache.set(e,t)}setValue(e,t,r){const n=this._cache.get(e)||{};n[t]=r,this._cache.set(e,n)}updateValue(e,t,r){const n=this._cache.get(e)||{};this._cache.set(e,Object.assign(n[t]||{},r))}get(e){return this._cache.get(e)}has(e){return this._cache.has(e)}delete(e){this._cache.delete(e)}clear(){this._cache.clear()}}function Nw(s,e,t){const{data:r,isPreParser:n,id:i="default",syminfo:a,interval:u,inputs:l}=e;self.workerStorage||(self.workerStorage=new Mw);let{builtInGather:c,buildinConstants:h,buildInFunctions:d,tradingvueFunc:p}=self.workerStorage.get(i)||{};if(t&&(c=new Oh,h=new Ul,d=new Zl((a==null?void 0:a.mintick)||1e-4,c,i),p=new Function("$_var","$_const","$_func",s),self.workerStorage.set(i,{builtInGather:c,buildinConstants:h,buildInFunctions:d,tradingvueFunc:p}),self.workerStorage.set(`request_${i}`,new Map)),n)p(c,h,d);else if(r&&r.length){const x=r.length-1;c.updateOptions({interval:u,mintick:(a==null?void 0:a.mintick)||1e-4}),d.updateOptions({inputs:l});for(const[_,y]of r.entries()){const{barindex:m}=y;c.updateData(Object.assign(y,{barIndex:m||_,lastBarIndex:r[x].bar_index||x,lastBarTime:r[x].time})),d.update({barIndex:m||_}),p(c,h,d),d.endExecution();const w=d.errors;if(w.length&&w.some(D=>D.type===Ve.Error))return{status:1,errors:w}}}const v=d.errors;return v.length&&v.some(x=>x.type===Ve.Error)?{status:1,errors:v}:{status:0,options:{...d.options,id:i}}}function Sw(s){self==null||self.workerStorage.delete(s),self==null||self.workerStorage.delete(`inputs_${s}`)}W0({runScript:Nw,removeScript:Sw})})();