UNPKG

snapper-sdk

Version:

An SDK for building applications on top of Snapper.

1 lines 181 kB
import{PublicKey as C}from"@solana/web3.js";import Ke from"bn.js";var bt=9e15,rt=1e9,xn="0123456789abcdef",Qt="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Jt="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Bn={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-bt,maxE:bt,crypto:!1},mi,Ze,v=!0,en="[DecimalError] ",it=en+"Invalid argument: ",di=en+"Precision limit exceeded",pi=en+"crypto unavailable",fi="[object Decimal]",ke=Math.floor,pe=Math.pow,Pr=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Ar=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,kr=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,gi=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Ee=1e7,E=7,hr=9007199254740991,Tr=Qt.length-1,In=Jt.length-1,x={toStringTag:fi};x.absoluteValue=x.abs=function(){var r=new this.constructor(this);return r.s<0&&(r.s=1),R(r)};x.ceil=function(){return R(new this.constructor(this),this.e+1,2)};x.clampedTo=x.clamp=function(r,e){var t,n=this,i=n.constructor;if(r=new i(r),e=new i(e),!r.s||!e.s)return new i(NaN);if(r.gt(e))throw Error(it+e);return t=n.cmp(r),t<0?r:n.cmp(e)>0?e:new i(n)};x.comparedTo=x.cmp=function(r){var e,t,n,i,o=this,s=o.d,a=(r=new o.constructor(r)).d,c=o.s,u=r.s;if(!s||!a)return!c||!u?NaN:c!==u?c:s===a?0:!s^c<0?1:-1;if(!s[0]||!a[0])return s[0]?c:a[0]?-u:0;if(c!==u)return c;if(o.e!==r.e)return o.e>r.e^c<0?1:-1;for(n=s.length,i=a.length,e=0,t=n<i?n:i;e<t;++e)if(s[e]!==a[e])return s[e]>a[e]^c<0?1:-1;return n===i?0:n>i^c<0?1:-1};x.cosine=x.cos=function(){var r,e,t=this,n=t.constructor;return t.d?t.d[0]?(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+E,n.rounding=1,t=xr(n,Ai(n,t)),n.precision=r,n.rounding=e,R(Ze==2||Ze==3?t.neg():t,r,e,!0)):new n(1):new n(NaN)};x.cubeRoot=x.cbrt=function(){var r,e,t,n,i,o,s,a,c,u,l=this,m=l.constructor;if(!l.isFinite()||l.isZero())return new m(l);for(v=!1,o=l.s*pe(l.s*l,1/3),!o||Math.abs(o)==1/0?(t=ye(l.d),r=l.e,(o=(r-t.length+1)%3)&&(t+=o==1||o==-2?"0":"00"),o=pe(t,1/3),r=ke((r+1)/3)-(r%3==(r<0?-1:2)),o==1/0?t="5e"+r:(t=o.toExponential(),t=t.slice(0,t.indexOf("e")+1)+r),n=new m(t),n.s=l.s):n=new m(o.toString()),s=(r=m.precision)+3;;)if(a=n,c=a.times(a).times(a),u=c.plus(l),n=ne(u.plus(l).times(a),u.plus(c),s+2,1),ye(a.d).slice(0,s)===(t=ye(n.d)).slice(0,s))if(t=t.slice(s-3,s+1),t=="9999"||!i&&t=="4999"){if(!i&&(R(a,r+1,0),a.times(a).times(a).eq(l))){n=a;break}s+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(R(n,r+1,1),e=!n.times(n).times(n).eq(l));break}return v=!0,R(n,r,m.rounding,e)};x.decimalPlaces=x.dp=function(){var r,e=this.d,t=NaN;if(e){if(r=e.length-1,t=(r-ke(this.e/E))*E,r=e[r],r)for(;r%10==0;r/=10)t--;t<0&&(t=0)}return t};x.dividedBy=x.div=function(r){return ne(this,new this.constructor(r))};x.dividedToIntegerBy=x.divToInt=function(r){var e=this,t=e.constructor;return R(ne(e,new t(r),0,1,1),t.precision,t.rounding)};x.equals=x.eq=function(r){return this.cmp(r)===0};x.floor=function(){return R(new this.constructor(this),this.e+1,3)};x.greaterThan=x.gt=function(r){return this.cmp(r)>0};x.greaterThanOrEqualTo=x.gte=function(r){var e=this.cmp(r);return e==1||e===0};x.hyperbolicCosine=x.cosh=function(){var r,e,t,n,i,o=this,s=o.constructor,a=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return a;t=s.precision,n=s.rounding,s.precision=t+Math.max(o.e,o.sd())+4,s.rounding=1,i=o.d.length,i<32?(r=Math.ceil(i/3),e=(1/nn(4,r)).toString()):(r=16,e="2.3283064365386962890625e-10"),o=yt(s,1,o.times(e),new s(1),!0);for(var c,u=r,l=new s(8);u--;)c=o.times(o),o=a.minus(c.times(l.minus(c.times(l))));return R(o,s.precision=t,s.rounding=n,!0)};x.hyperbolicSine=x.sinh=function(){var r,e,t,n,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(e=o.precision,t=o.rounding,o.precision=e+Math.max(i.e,i.sd())+4,o.rounding=1,n=i.d.length,n<3)i=yt(o,2,i,i,!0);else{r=1.4*Math.sqrt(n),r=r>16?16:r|0,i=i.times(1/nn(5,r)),i=yt(o,2,i,i,!0);for(var s,a=new o(5),c=new o(16),u=new o(20);r--;)s=i.times(i),i=i.times(a.plus(s.times(c.times(s).plus(u))))}return o.precision=e,o.rounding=t,R(i,e,t,!0)};x.hyperbolicTangent=x.tanh=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+7,n.rounding=1,ne(t.sinh(),t.cosh(),n.precision=r,n.rounding=e)):new n(t.s)};x.inverseCosine=x.acos=function(){var r,e=this,t=e.constructor,n=e.abs().cmp(1),i=t.precision,o=t.rounding;return n!==-1?n===0?e.isNeg()?Fe(t,i,o):new t(0):new t(NaN):e.isZero()?Fe(t,i+4,o).times(.5):(t.precision=i+6,t.rounding=1,e=e.asin(),r=Fe(t,i+4,o).times(.5),t.precision=i,t.rounding=o,r.minus(e))};x.inverseHyperbolicCosine=x.acosh=function(){var r,e,t=this,n=t.constructor;return t.lte(1)?new n(t.eq(1)?0:NaN):t.isFinite()?(r=n.precision,e=n.rounding,n.precision=r+Math.max(Math.abs(t.e),t.sd())+4,n.rounding=1,v=!1,t=t.times(t).minus(1).sqrt().plus(t),v=!0,n.precision=r,n.rounding=e,t.ln()):new n(t)};x.inverseHyperbolicSine=x.asinh=function(){var r,e,t=this,n=t.constructor;return!t.isFinite()||t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+2*Math.max(Math.abs(t.e),t.sd())+6,n.rounding=1,v=!1,t=t.times(t).plus(1).sqrt().plus(t),v=!0,n.precision=r,n.rounding=e,t.ln())};x.inverseHyperbolicTangent=x.atanh=function(){var r,e,t,n,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(r=o.precision,e=o.rounding,n=i.sd(),Math.max(n,r)<2*-i.e-1?R(new o(i),r,e,!0):(o.precision=t=n-i.e,i=ne(i.plus(1),new o(1).minus(i),t+r,1),o.precision=r+4,o.rounding=1,i=i.ln(),o.precision=r,o.rounding=e,i.times(.5))):new o(NaN)};x.inverseSine=x.asin=function(){var r,e,t,n,i=this,o=i.constructor;return i.isZero()?new o(i):(e=i.abs().cmp(1),t=o.precision,n=o.rounding,e!==-1?e===0?(r=Fe(o,t+4,n).times(.5),r.s=i.s,r):new o(NaN):(o.precision=t+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=t,o.rounding=n,i.times(2)))};x.inverseTangent=x.atan=function(){var r,e,t,n,i,o,s,a,c,u=this,l=u.constructor,m=l.precision,d=l.rounding;if(u.isFinite()){if(u.isZero())return new l(u);if(u.abs().eq(1)&&m+4<=In)return s=Fe(l,m+4,d).times(.25),s.s=u.s,s}else{if(!u.s)return new l(NaN);if(m+4<=In)return s=Fe(l,m+4,d).times(.5),s.s=u.s,s}for(l.precision=a=m+10,l.rounding=1,t=Math.min(28,a/E+2|0),r=t;r;--r)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(v=!1,e=Math.ceil(a/E),n=1,c=u.times(u),s=new l(u),i=u;r!==-1;)if(i=i.times(c),o=s.minus(i.div(n+=2)),i=i.times(c),s=o.plus(i.div(n+=2)),s.d[e]!==void 0)for(r=e;s.d[r]===o.d[r]&&r--;);return t&&(s=s.times(2<<t-1)),v=!0,R(s,l.precision=m,l.rounding=d,!0)};x.isFinite=function(){return!!this.d};x.isInteger=x.isInt=function(){return!!this.d&&ke(this.e/E)>this.d.length-2};x.isNaN=function(){return!this.s};x.isNegative=x.isNeg=function(){return this.s<0};x.isPositive=x.isPos=function(){return this.s>0};x.isZero=function(){return!!this.d&&this.d[0]===0};x.lessThan=x.lt=function(r){return this.cmp(r)<0};x.lessThanOrEqualTo=x.lte=function(r){return this.cmp(r)<1};x.logarithm=x.log=function(r){var e,t,n,i,o,s,a,c,u=this,l=u.constructor,m=l.precision,d=l.rounding,p=5;if(r==null)r=new l(10),e=!0;else{if(r=new l(r),t=r.d,r.s<0||!t||!t[0]||r.eq(1))return new l(NaN);e=r.eq(10)}if(t=u.d,u.s<0||!t||!t[0]||u.eq(1))return new l(t&&!t[0]?-1/0:u.s!=1?NaN:t?0:1/0);if(e)if(t.length>1)o=!0;else{for(i=t[0];i%10===0;)i/=10;o=i!==1}if(v=!1,a=m+p,s=nt(u,a),n=e?$t(l,a+10):nt(r,a),c=ne(s,n,a,1),Tt(c.d,i=m,d))do if(a+=10,s=nt(u,a),n=e?$t(l,a+10):nt(r,a),c=ne(s,n,a,1),!o){+ye(c.d).slice(i+1,i+15)+1==1e14&&(c=R(c,m+1,0));break}while(Tt(c.d,i+=10,d));return v=!0,R(c,m,d)};x.minus=x.sub=function(r){var e,t,n,i,o,s,a,c,u,l,m,d,p=this,g=p.constructor;if(r=new g(r),!p.d||!r.d)return!p.s||!r.s?r=new g(NaN):p.d?r.s=-r.s:r=new g(r.d||p.s!==r.s?p:NaN),r;if(p.s!=r.s)return r.s=-r.s,p.plus(r);if(u=p.d,d=r.d,a=g.precision,c=g.rounding,!u[0]||!d[0]){if(d[0])r.s=-r.s;else if(u[0])r=new g(p);else return new g(c===3?-0:0);return v?R(r,a,c):r}if(t=ke(r.e/E),l=ke(p.e/E),u=u.slice(),o=l-t,o){for(m=o<0,m?(e=u,o=-o,s=d.length):(e=d,t=l,s=u.length),n=Math.max(Math.ceil(a/E),s)+2,o>n&&(o=n,e.length=1),e.reverse(),n=o;n--;)e.push(0);e.reverse()}else{for(n=u.length,s=d.length,m=n<s,m&&(s=n),n=0;n<s;n++)if(u[n]!=d[n]){m=u[n]<d[n];break}o=0}for(m&&(e=u,u=d,d=e,r.s=-r.s),s=u.length,n=d.length-s;n>0;--n)u[s++]=0;for(n=d.length;n>o;){if(u[--n]<d[n]){for(i=n;i&&u[--i]===0;)u[i]=Ee-1;--u[i],u[n]+=Ee}u[n]-=d[n]}for(;u[--s]===0;)u.pop();for(;u[0]===0;u.shift())--t;return u[0]?(r.d=u,r.e=tn(u,t),v?R(r,a,c):r):new g(c===3?-0:0)};x.modulo=x.mod=function(r){var e,t=this,n=t.constructor;return r=new n(r),!t.d||!r.s||r.d&&!r.d[0]?new n(NaN):!r.d||t.d&&!t.d[0]?R(new n(t),n.precision,n.rounding):(v=!1,n.modulo==9?(e=ne(t,r.abs(),0,3,1),e.s*=r.s):e=ne(t,r,0,n.modulo,1),e=e.times(r),v=!0,t.minus(e))};x.naturalExponential=x.exp=function(){return Sn(this)};x.naturalLogarithm=x.ln=function(){return nt(this)};x.negated=x.neg=function(){var r=new this.constructor(this);return r.s=-r.s,R(r)};x.plus=x.add=function(r){var e,t,n,i,o,s,a,c,u,l,m=this,d=m.constructor;if(r=new d(r),!m.d||!r.d)return!m.s||!r.s?r=new d(NaN):m.d||(r=new d(r.d||m.s===r.s?m:NaN)),r;if(m.s!=r.s)return r.s=-r.s,m.minus(r);if(u=m.d,l=r.d,a=d.precision,c=d.rounding,!u[0]||!l[0])return l[0]||(r=new d(m)),v?R(r,a,c):r;if(o=ke(m.e/E),n=ke(r.e/E),u=u.slice(),i=o-n,i){for(i<0?(t=u,i=-i,s=l.length):(t=l,n=o,s=u.length),o=Math.ceil(a/E),s=o>s?o+1:s+1,i>s&&(i=s,t.length=1),t.reverse();i--;)t.push(0);t.reverse()}for(s=u.length,i=l.length,s-i<0&&(i=s,t=l,l=u,u=t),e=0;i;)e=(u[--i]=u[i]+l[i]+e)/Ee|0,u[i]%=Ee;for(e&&(u.unshift(e),++n),s=u.length;u[--s]==0;)u.pop();return r.d=u,r.e=tn(u,n),v?R(r,a,c):r};x.precision=x.sd=function(r){var e,t=this;if(r!==void 0&&r!==!!r&&r!==1&&r!==0)throw Error(it+r);return t.d?(e=bi(t.d),r&&t.e+1>e&&(e=t.e+1)):e=NaN,e};x.round=function(){var r=this,e=r.constructor;return R(new e(r),r.e+1,e.rounding)};x.sine=x.sin=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+E,n.rounding=1,t=Ir(n,Ai(n,t)),n.precision=r,n.rounding=e,R(Ze>2?t.neg():t,r,e,!0)):new n(NaN)};x.squareRoot=x.sqrt=function(){var r,e,t,n,i,o,s=this,a=s.d,c=s.e,u=s.s,l=s.constructor;if(u!==1||!a||!a[0])return new l(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);for(v=!1,u=Math.sqrt(+s),u==0||u==1/0?(e=ye(a),(e.length+c)%2==0&&(e+="0"),u=Math.sqrt(e),c=ke((c+1)/2)-(c<0||c%2),u==1/0?e="5e"+c:(e=u.toExponential(),e=e.slice(0,e.indexOf("e")+1)+c),n=new l(e)):n=new l(u.toString()),t=(c=l.precision)+3;;)if(o=n,n=o.plus(ne(s,o,t+2,1)).times(.5),ye(o.d).slice(0,t)===(e=ye(n.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!i&&e=="4999"){if(!i&&(R(o,c+1,0),o.times(o).eq(s))){n=o;break}t+=4,i=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(R(n,c+1,1),r=!n.times(n).eq(s));break}return v=!0,R(n,c,l.rounding,r)};x.tangent=x.tan=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+10,n.rounding=1,t=t.sin(),t.s=1,t=ne(t,new n(1).minus(t.times(t)).sqrt(),r+10,0),n.precision=r,n.rounding=e,R(Ze==2||Ze==4?t.neg():t,r,e,!0)):new n(NaN)};x.times=x.mul=function(r){var e,t,n,i,o,s,a,c,u,l=this,m=l.constructor,d=l.d,p=(r=new m(r)).d;if(r.s*=l.s,!d||!d[0]||!p||!p[0])return new m(!r.s||d&&!d[0]&&!p||p&&!p[0]&&!d?NaN:!d||!p?r.s/0:r.s*0);for(t=ke(l.e/E)+ke(r.e/E),c=d.length,u=p.length,c<u&&(o=d,d=p,p=o,s=c,c=u,u=s),o=[],s=c+u,n=s;n--;)o.push(0);for(n=u;--n>=0;){for(e=0,i=c+n;i>n;)a=o[i]+p[n]*d[i-n-1]+e,o[i--]=a%Ee|0,e=a/Ee|0;o[i]=(o[i]+e)%Ee|0}for(;!o[--s];)o.pop();return e?++t:o.shift(),r.d=o,r.e=tn(o,t),v?R(r,m.precision,m.rounding):r};x.toBinary=function(r,e){return Kn(this,2,r,e)};x.toDecimalPlaces=x.toDP=function(r,e){var t=this,n=t.constructor;return t=new n(t),r===void 0?t:(Ce(r,0,rt),e===void 0?e=n.rounding:Ce(e,0,8),R(t,r+t.e+1,e))};x.toExponential=function(r,e){var t,n=this,i=n.constructor;return r===void 0?t=Ge(n,!0):(Ce(r,0,rt),e===void 0?e=i.rounding:Ce(e,0,8),n=R(new i(n),r+1,e),t=Ge(n,!0,r+1)),n.isNeg()&&!n.isZero()?"-"+t:t};x.toFixed=function(r,e){var t,n,i=this,o=i.constructor;return r===void 0?t=Ge(i):(Ce(r,0,rt),e===void 0?e=o.rounding:Ce(e,0,8),n=R(new o(i),r+i.e+1,e),t=Ge(n,!1,r+n.e+1)),i.isNeg()&&!i.isZero()?"-"+t:t};x.toFraction=function(r){var e,t,n,i,o,s,a,c,u,l,m,d,p=this,g=p.d,f=p.constructor;if(!g)return new f(p);if(u=t=new f(1),n=c=new f(0),e=new f(n),o=e.e=bi(g)-p.e-1,s=o%E,e.d[0]=pe(10,s<0?E+s:s),r==null)r=o>0?e:u;else{if(a=new f(r),!a.isInt()||a.lt(u))throw Error(it+a);r=a.gt(e)?o>0?e:u:a}for(v=!1,a=new f(ye(g)),l=f.precision,f.precision=o=g.length*E*2;m=ne(a,e,0,1,1),i=t.plus(m.times(n)),i.cmp(r)!=1;)t=n,n=i,i=u,u=c.plus(m.times(i)),c=i,i=e,e=a.minus(m.times(i)),a=i;return i=ne(r.minus(t),n,0,1,1),c=c.plus(i.times(u)),t=t.plus(i.times(n)),c.s=u.s=p.s,d=ne(u,n,o,1).minus(p).abs().cmp(ne(c,t,o,1).minus(p).abs())<1?[u,n]:[c,t],f.precision=l,v=!0,d};x.toHexadecimal=x.toHex=function(r,e){return Kn(this,16,r,e)};x.toNearest=function(r,e){var t=this,n=t.constructor;if(t=new n(t),r==null){if(!t.d)return t;r=new n(1),e=n.rounding}else{if(r=new n(r),e===void 0?e=n.rounding:Ce(e,0,8),!t.d)return r.s?t:r;if(!r.d)return r.s&&(r.s=t.s),r}return r.d[0]?(v=!1,t=ne(t,r,0,e,1).times(r),v=!0,R(t)):(r.s=t.s,t=r),t};x.toNumber=function(){return+this};x.toOctal=function(r,e){return Kn(this,8,r,e)};x.toPower=x.pow=function(r){var e,t,n,i,o,s,a=this,c=a.constructor,u=+(r=new c(r));if(!a.d||!r.d||!a.d[0]||!r.d[0])return new c(pe(+a,u));if(a=new c(a),a.eq(1))return a;if(n=c.precision,o=c.rounding,r.eq(1))return R(a,n,o);if(e=ke(r.e/E),e>=r.d.length-1&&(t=u<0?-u:u)<=hr)return i=yi(c,a,t,n),r.s<0?new c(1).div(i):R(i,n,o);if(s=a.s,s<0){if(e<r.d.length-1)return new c(NaN);if((r.d[e]&1)==0&&(s=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=s,a}return t=pe(+a,u),e=t==0||!isFinite(t)?ke(u*(Math.log("0."+ye(a.d))/Math.LN10+a.e+1)):new c(t+"").e,e>c.maxE+1||e<c.minE-1?new c(e>0?s/0:0):(v=!1,c.rounding=a.s=1,t=Math.min(12,(e+"").length),i=Sn(r.times(nt(a,n+t)),n),i.d&&(i=R(i,n+5,1),Tt(i.d,n,o)&&(e=n+10,i=R(Sn(r.times(nt(a,e+t)),e),e+5,1),+ye(i.d).slice(n+1,n+15)+1==1e14&&(i=R(i,n+1,0)))),i.s=s,v=!0,c.rounding=o,R(i,n,o))};x.toPrecision=function(r,e){var t,n=this,i=n.constructor;return r===void 0?t=Ge(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Ce(r,1,rt),e===void 0?e=i.rounding:Ce(e,0,8),n=R(new i(n),r,e),t=Ge(n,r<=n.e||n.e<=i.toExpNeg,r)),n.isNeg()&&!n.isZero()?"-"+t:t};x.toSignificantDigits=x.toSD=function(r,e){var t=this,n=t.constructor;return r===void 0?(r=n.precision,e=n.rounding):(Ce(r,1,rt),e===void 0?e=n.rounding:Ce(e,0,8)),R(new n(t),r,e)};x.toString=function(){var r=this,e=r.constructor,t=Ge(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()&&!r.isZero()?"-"+t:t};x.truncated=x.trunc=function(){return R(new this.constructor(this),this.e+1,1)};x.valueOf=x.toJSON=function(){var r=this,e=r.constructor,t=Ge(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()?"-"+t:t};function ye(r){var e,t,n,i=r.length-1,o="",s=r[0];if(i>0){for(o+=s,e=1;e<i;e++)n=r[e]+"",t=E-n.length,t&&(o+=tt(t)),o+=n;s=r[e],n=s+"",t=E-n.length,t&&(o+=tt(t))}else if(s===0)return"0";for(;s%10===0;)s/=10;return o+s}function Ce(r,e,t){if(r!==~~r||r<e||r>t)throw Error(it+r)}function Tt(r,e,t,n){var i,o,s,a;for(o=r[0];o>=10;o/=10)--e;return--e<0?(e+=E,i=0):(i=Math.ceil((e+1)/E),e%=E),o=pe(10,E-e),a=r[i]%o|0,n==null?e<3?(e==0?a=a/100|0:e==1&&(a=a/10|0),s=t<4&&a==99999||t>3&&a==49999||a==5e4||a==0):s=(t<4&&a+1==o||t>3&&a+1==o/2)&&(r[i+1]/o/100|0)==pe(10,e-2)-1||(a==o/2||a==0)&&(r[i+1]/o/100|0)==0:e<4?(e==0?a=a/1e3|0:e==1?a=a/100|0:e==2&&(a=a/10|0),s=(n||t<4)&&a==9999||!n&&t>3&&a==4999):s=((n||t<4)&&a+1==o||!n&&t>3&&a+1==o/2)&&(r[i+1]/o/1e3|0)==pe(10,e-3)-1,s}function Zt(r,e,t){for(var n,i=[0],o,s=0,a=r.length;s<a;){for(o=i.length;o--;)i[o]*=e;for(i[0]+=xn.indexOf(r.charAt(s++)),n=0;n<i.length;n++)i[n]>t-1&&(i[n+1]===void 0&&(i[n+1]=0),i[n+1]+=i[n]/t|0,i[n]%=t)}return i.reverse()}function xr(r,e){var t,n,i;if(e.isZero())return e;n=e.d.length,n<32?(t=Math.ceil(n/3),i=(1/nn(4,t)).toString()):(t=16,i="2.3283064365386962890625e-10"),r.precision+=t,e=yt(r,1,e.times(i),new r(1));for(var o=t;o--;){var s=e.times(e);e=s.times(s).minus(s).times(8).plus(1)}return r.precision-=t,e}var ne=function(){function r(n,i,o){var s,a=0,c=n.length;for(n=n.slice();c--;)s=n[c]*i+a,n[c]=s%o|0,a=s/o|0;return a&&n.unshift(a),n}function e(n,i,o,s){var a,c;if(o!=s)c=o>s?1:-1;else for(a=c=0;a<o;a++)if(n[a]!=i[a]){c=n[a]>i[a]?1:-1;break}return c}function t(n,i,o,s){for(var a=0;o--;)n[o]-=a,a=n[o]<i[o]?1:0,n[o]=a*s+n[o]-i[o];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,o,s,a,c){var u,l,m,d,p,g,f,y,b,P,w,k,T,A,h,B,N,F,L,Z,J=n.constructor,ue=n.s==i.s?1:-1,te=n.d,j=i.d;if(!te||!te[0]||!j||!j[0])return new J(!n.s||!i.s||(te?j&&te[0]==j[0]:!j)?NaN:te&&te[0]==0||!j?ue*0:ue/0);for(c?(p=1,l=n.e-i.e):(c=Ee,p=E,l=ke(n.e/p)-ke(i.e/p)),L=j.length,N=te.length,b=new J(ue),P=b.d=[],m=0;j[m]==(te[m]||0);m++);if(j[m]>(te[m]||0)&&l--,o==null?(A=o=J.precision,s=J.rounding):a?A=o+(n.e-i.e)+1:A=o,A<0)P.push(1),g=!0;else{if(A=A/p+2|0,m=0,L==1){for(d=0,j=j[0],A++;(m<N||d)&&A--;m++)h=d*c+(te[m]||0),P[m]=h/j|0,d=h%j|0;g=d||m<N}else{for(d=c/(j[0]+1)|0,d>1&&(j=r(j,d,c),te=r(te,d,c),L=j.length,N=te.length),B=L,w=te.slice(0,L),k=w.length;k<L;)w[k++]=0;Z=j.slice(),Z.unshift(0),F=j[0],j[1]>=c/2&&++F;do d=0,u=e(j,w,L,k),u<0?(T=w[0],L!=k&&(T=T*c+(w[1]||0)),d=T/F|0,d>1?(d>=c&&(d=c-1),f=r(j,d,c),y=f.length,k=w.length,u=e(f,w,y,k),u==1&&(d--,t(f,L<y?Z:j,y,c))):(d==0&&(u=d=1),f=j.slice()),y=f.length,y<k&&f.unshift(0),t(w,f,k,c),u==-1&&(k=w.length,u=e(j,w,L,k),u<1&&(d++,t(w,L<k?Z:j,k,c))),k=w.length):u===0&&(d++,w=[0]),P[m++]=d,u&&w[0]?w[k++]=te[B]||0:(w=[te[B]],k=1);while((B++<N||w[0]!==void 0)&&A--);g=w[0]!==void 0}P[0]||P.shift()}if(p==1)b.e=l,mi=g;else{for(m=1,d=P[0];d>=10;d/=10)m++;b.e=m+l*p-1,R(b,a?o+b.e+1:o,s,g)}return b}}();function R(r,e,t,n){var i,o,s,a,c,u,l,m,d,p=r.constructor;e:if(e!=null){if(m=r.d,!m)return r;for(i=1,a=m[0];a>=10;a/=10)i++;if(o=e-i,o<0)o+=E,s=e,l=m[d=0],c=l/pe(10,i-s-1)%10|0;else if(d=Math.ceil((o+1)/E),a=m.length,d>=a)if(n){for(;a++<=d;)m.push(0);l=c=0,i=1,o%=E,s=o-E+1}else break e;else{for(l=a=m[d],i=1;a>=10;a/=10)i++;o%=E,s=o-E+i,c=s<0?0:l/pe(10,i-s-1)%10|0}if(n=n||e<0||m[d+1]!==void 0||(s<0?l:l%pe(10,i-s-1)),u=t<4?(c||n)&&(t==0||t==(r.s<0?3:2)):c>5||c==5&&(t==4||n||t==6&&(o>0?s>0?l/pe(10,i-s):0:m[d-1])%10&1||t==(r.s<0?8:7)),e<1||!m[0])return m.length=0,u?(e-=r.e+1,m[0]=pe(10,(E-e%E)%E),r.e=-e||0):m[0]=r.e=0,r;if(o==0?(m.length=d,a=1,d--):(m.length=d+1,a=pe(10,E-o),m[d]=s>0?(l/pe(10,i-s)%pe(10,s)|0)*a:0),u)for(;;)if(d==0){for(o=1,s=m[0];s>=10;s/=10)o++;for(s=m[0]+=a,a=1;s>=10;s/=10)a++;o!=a&&(r.e++,m[0]==Ee&&(m[0]=1));break}else{if(m[d]+=a,m[d]!=Ee)break;m[d--]=0,a=1}for(o=m.length;m[--o]===0;)m.pop()}return v&&(r.e>p.maxE?(r.d=null,r.e=NaN):r.e<p.minE&&(r.e=0,r.d=[0])),r}function Ge(r,e,t){if(!r.isFinite())return Pi(r);var n,i=r.e,o=ye(r.d),s=o.length;return e?(t&&(n=t-s)>0?o=o.charAt(0)+"."+o.slice(1)+tt(n):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(r.e<0?"e":"e+")+r.e):i<0?(o="0."+tt(-i-1)+o,t&&(n=t-s)>0&&(o+=tt(n))):i>=s?(o+=tt(i+1-s),t&&(n=t-i-1)>0&&(o=o+"."+tt(n))):((n=i+1)<s&&(o=o.slice(0,n)+"."+o.slice(n)),t&&(n=t-s)>0&&(i+1===s&&(o+="."),o+=tt(n))),o}function tn(r,e){var t=r[0];for(e*=E;t>=10;t/=10)e++;return e}function $t(r,e,t){if(e>Tr)throw v=!0,t&&(r.precision=t),Error(di);return R(new r(Qt),e,1,!0)}function Fe(r,e,t){if(e>In)throw Error(di);return R(new r(Jt),e,t,!0)}function bi(r){var e=r.length-1,t=e*E+1;if(e=r[e],e){for(;e%10==0;e/=10)t--;for(e=r[0];e>=10;e/=10)t++}return t}function tt(r){for(var e="";r--;)e+="0";return e}function yi(r,e,t,n){var i,o=new r(1),s=Math.ceil(n/E+4);for(v=!1;;){if(t%2&&(o=o.times(e),ui(o.d,s)&&(i=!0)),t=ke(t/2),t===0){t=o.d.length-1,i&&o.d[t]===0&&++o.d[t];break}e=e.times(e),ui(e.d,s)}return v=!0,o}function ci(r){return r.d[r.d.length-1]&1}function wi(r,e,t){for(var n,i=new r(e[0]),o=0;++o<e.length;)if(n=new r(e[o]),n.s)i[t](n)&&(i=n);else{i=n;break}return i}function Sn(r,e){var t,n,i,o,s,a,c,u=0,l=0,m=0,d=r.constructor,p=d.rounding,g=d.precision;if(!r.d||!r.d[0]||r.e>17)return new d(r.d?r.d[0]?r.s<0?0:1/0:1:r.s?r.s<0?0:r:0/0);for(e==null?(v=!1,c=g):c=e,a=new d(.03125);r.e>-2;)r=r.times(a),m+=5;for(n=Math.log(pe(2,m))/Math.LN10*2+5|0,c+=n,t=o=s=new d(1),d.precision=c;;){if(o=R(o.times(r),c,1),t=t.times(++l),a=s.plus(ne(o,t,c,1)),ye(a.d).slice(0,c)===ye(s.d).slice(0,c)){for(i=m;i--;)s=R(s.times(s),c,1);if(e==null)if(u<3&&Tt(s.d,c-n,p,u))d.precision=c+=10,t=o=a=new d(1),l=0,u++;else return R(s,d.precision=g,p,v=!0);else return d.precision=g,s}s=a}}function nt(r,e){var t,n,i,o,s,a,c,u,l,m,d,p=1,g=10,f=r,y=f.d,b=f.constructor,P=b.rounding,w=b.precision;if(f.s<0||!y||!y[0]||!f.e&&y[0]==1&&y.length==1)return new b(y&&!y[0]?-1/0:f.s!=1?NaN:y?0:f);if(e==null?(v=!1,l=w):l=e,b.precision=l+=g,t=ye(y),n=t.charAt(0),Math.abs(o=f.e)<15e14){for(;n<7&&n!=1||n==1&&t.charAt(1)>3;)f=f.times(r),t=ye(f.d),n=t.charAt(0),p++;o=f.e,n>1?(f=new b("0."+t),o++):f=new b(n+"."+t.slice(1))}else return u=$t(b,l+2,w).times(o+""),f=nt(new b(n+"."+t.slice(1)),l-g).plus(u),b.precision=w,e==null?R(f,w,P,v=!0):f;for(m=f,c=s=f=ne(f.minus(1),f.plus(1),l,1),d=R(f.times(f),l,1),i=3;;){if(s=R(s.times(d),l,1),u=c.plus(ne(s,new b(i),l,1)),ye(u.d).slice(0,l)===ye(c.d).slice(0,l))if(c=c.times(2),o!==0&&(c=c.plus($t(b,l+2,w).times(o+""))),c=ne(c,new b(p),l,1),e==null)if(Tt(c.d,l-g,P,a))b.precision=l+=g,u=s=f=ne(m.minus(1),m.plus(1),l,1),d=R(f.times(f),l,1),i=a=1;else return R(c,b.precision=w,P,v=!0);else return b.precision=w,c;c=u,i+=2}}function Pi(r){return String(r.s*r.s/0)}function Cn(r,e){var t,n,i;for((t=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(t<0&&(t=n),t+=+e.slice(n+1),e=e.substring(0,n)):t<0&&(t=e.length),n=0;e.charCodeAt(n)===48;n++);for(i=e.length;e.charCodeAt(i-1)===48;--i);if(e=e.slice(n,i),e){if(i-=n,r.e=t=t-n-1,r.d=[],n=(t+1)%E,t<0&&(n+=E),n<i){for(n&&r.d.push(+e.slice(0,n)),i-=E;n<i;)r.d.push(+e.slice(n,n+=E));e=e.slice(n),n=E-e.length}else n-=i;for(;n--;)e+="0";r.d.push(+e),v&&(r.e>r.constructor.maxE?(r.d=null,r.e=NaN):r.e<r.constructor.minE&&(r.e=0,r.d=[0]))}else r.e=0,r.d=[0];return r}function Br(r,e){var t,n,i,o,s,a,c,u,l;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),gi.test(e))return Cn(r,e)}else if(e==="Infinity"||e==="NaN")return+e||(r.s=NaN),r.e=NaN,r.d=null,r;if(Ar.test(e))t=16,e=e.toLowerCase();else if(Pr.test(e))t=2;else if(kr.test(e))t=8;else throw Error(it+e);for(o=e.search(/p/i),o>0?(c=+e.slice(o+1),e=e.substring(2,o)):e=e.slice(2),o=e.indexOf("."),s=o>=0,n=r.constructor,s&&(e=e.replace(".",""),a=e.length,o=a-o,i=yi(n,new n(t),o,o*2)),u=Zt(e,t,Ee),l=u.length-1,o=l;u[o]===0;--o)u.pop();return o<0?new n(r.s*0):(r.e=tn(u,l),r.d=u,v=!1,s&&(r=ne(r,i,a*4)),c&&(r=r.times(Math.abs(c)<54?pe(2,c):xt.pow(2,c))),v=!0,r)}function Ir(r,e){var t,n=e.d.length;if(n<3)return e.isZero()?e:yt(r,2,e,e);t=1.4*Math.sqrt(n),t=t>16?16:t|0,e=e.times(1/nn(5,t)),e=yt(r,2,e,e);for(var i,o=new r(5),s=new r(16),a=new r(20);t--;)i=e.times(e),e=e.times(o.plus(i.times(s.times(i).minus(a))));return e}function yt(r,e,t,n,i){var o,s,a,c,u=1,l=r.precision,m=Math.ceil(l/E);for(v=!1,c=t.times(t),a=new r(n);;){if(s=ne(a.times(c),new r(e++*e++),l,1),a=i?n.plus(s):n.minus(s),n=ne(s.times(c),new r(e++*e++),l,1),s=a.plus(n),s.d[m]!==void 0){for(o=m;s.d[o]===a.d[o]&&o--;);if(o==-1)break}o=a,a=n,n=s,s=o,u++}return v=!0,s.d.length=m+1,s}function nn(r,e){for(var t=r;--e;)t*=r;return t}function Ai(r,e){var t,n=e.s<0,i=Fe(r,r.precision,1),o=i.times(.5);if(e=e.abs(),e.lte(o))return Ze=n?4:1,e;if(t=e.divToInt(i),t.isZero())Ze=n?3:2;else{if(e=e.minus(t.times(i)),e.lte(o))return Ze=ci(t)?n?2:3:n?4:1,e;Ze=ci(t)?n?1:4:n?3:2}return e.minus(i).abs()}function Kn(r,e,t,n){var i,o,s,a,c,u,l,m,d,p=r.constructor,g=t!==void 0;if(g?(Ce(t,1,rt),n===void 0?n=p.rounding:Ce(n,0,8)):(t=p.precision,n=p.rounding),!r.isFinite())l=Pi(r);else{for(l=Ge(r),s=l.indexOf("."),g?(i=2,e==16?t=t*4-3:e==8&&(t=t*3-2)):i=e,s>=0&&(l=l.replace(".",""),d=new p(1),d.e=l.length-s,d.d=Zt(Ge(d),10,i),d.e=d.d.length),m=Zt(l,10,i),o=c=m.length;m[--c]==0;)m.pop();if(!m[0])l=g?"0p+0":"0";else{if(s<0?o--:(r=new p(r),r.d=m,r.e=o,r=ne(r,d,t,n,0,i),m=r.d,o=r.e,u=mi),s=m[t],a=i/2,u=u||m[t+1]!==void 0,u=n<4?(s!==void 0||u)&&(n===0||n===(r.s<0?3:2)):s>a||s===a&&(n===4||u||n===6&&m[t-1]&1||n===(r.s<0?8:7)),m.length=t,u)for(;++m[--t]>i-1;)m[t]=0,t||(++o,m.unshift(1));for(c=m.length;!m[c-1];--c);for(s=0,l="";s<c;s++)l+=xn.charAt(m[s]);if(g){if(c>1)if(e==16||e==8){for(s=e==16?4:3,--c;c%s;c++)l+="0";for(m=Zt(l,i,e),c=m.length;!m[c-1];--c);for(s=1,l="1.";s<c;s++)l+=xn.charAt(m[s])}else l=l.charAt(0)+"."+l.slice(1);l=l+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)l="0"+l;l="0."+l}else if(++o>c)for(o-=c;o--;)l+="0";else o<c&&(l=l.slice(0,o)+"."+l.slice(o))}l=(e==16?"0x":e==2?"0b":e==8?"0o":"")+l}return r.s<0?"-"+l:l}function ui(r,e){if(r.length>e)return r.length=e,!0}function Sr(r){return new this(r).abs()}function Cr(r){return new this(r).acos()}function Kr(r){return new this(r).acosh()}function Nr(r,e){return new this(r).plus(e)}function Lr(r){return new this(r).asin()}function Rr(r){return new this(r).asinh()}function Mr(r){return new this(r).atan()}function Or(r){return new this(r).atanh()}function Fr(r,e){r=new this(r),e=new this(e);var t,n=this.precision,i=this.rounding,o=n+4;return!r.s||!e.s?t=new this(NaN):!r.d&&!e.d?(t=Fe(this,o,1).times(e.s>0?.25:.75),t.s=r.s):!e.d||r.isZero()?(t=e.s<0?Fe(this,n,i):new this(0),t.s=r.s):!r.d||e.isZero()?(t=Fe(this,o,1).times(.5),t.s=r.s):e.s<0?(this.precision=o,this.rounding=1,t=this.atan(ne(r,e,o,1)),e=Fe(this,o,1),this.precision=n,this.rounding=i,t=r.s<0?t.minus(e):t.plus(e)):t=this.atan(ne(r,e,o,1)),t}function Er(r){return new this(r).cbrt()}function Dr(r){return R(r=new this(r),r.e+1,2)}function vr(r,e,t){return new this(r).clamp(e,t)}function Vr(r){if(!r||typeof r!="object")throw Error(en+"Object expected");var e,t,n,i=r.defaults===!0,o=["precision",1,rt,"rounding",0,8,"toExpNeg",-bt,0,"toExpPos",0,bt,"maxE",0,bt,"minE",-bt,0,"modulo",0,9];for(e=0;e<o.length;e+=3)if(t=o[e],i&&(this[t]=Bn[t]),(n=r[t])!==void 0)if(ke(n)===n&&n>=o[e+1]&&n<=o[e+2])this[t]=n;else throw Error(it+t+": "+n);if(t="crypto",i&&(this[t]=Bn[t]),(n=r[t])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[t]=!0;else throw Error(pi);else this[t]=!1;else throw Error(it+t+": "+n);return this}function _r(r){return new this(r).cos()}function qr(r){return new this(r).cosh()}function ki(r){var e,t,n;function i(o){var s,a,c,u=this;if(!(u instanceof i))return new i(o);if(u.constructor=i,li(o)){u.s=o.s,v?!o.d||o.e>i.maxE?(u.e=NaN,u.d=null):o.e<i.minE?(u.e=0,u.d=[0]):(u.e=o.e,u.d=o.d.slice()):(u.e=o.e,u.d=o.d?o.d.slice():o.d);return}if(c=typeof o,c==="number"){if(o===0){u.s=1/o<0?-1:1,u.e=0,u.d=[0];return}if(o<0?(o=-o,u.s=-1):u.s=1,o===~~o&&o<1e7){for(s=0,a=o;a>=10;a/=10)s++;v?s>i.maxE?(u.e=NaN,u.d=null):s<i.minE?(u.e=0,u.d=[0]):(u.e=s,u.d=[o]):(u.e=s,u.d=[o]);return}else if(o*0!==0){o||(u.s=NaN),u.e=NaN,u.d=null;return}return Cn(u,o.toString())}else if(c!=="string")throw Error(it+o);return(a=o.charCodeAt(0))===45?(o=o.slice(1),u.s=-1):(a===43&&(o=o.slice(1)),u.s=1),gi.test(o)?Cn(u,o):Br(u,o)}if(i.prototype=x,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=Vr,i.clone=ki,i.isDecimal=li,i.abs=Sr,i.acos=Cr,i.acosh=Kr,i.add=Nr,i.asin=Lr,i.asinh=Rr,i.atan=Mr,i.atanh=Or,i.atan2=Fr,i.cbrt=Er,i.ceil=Dr,i.clamp=vr,i.cos=_r,i.cosh=qr,i.div=Wr,i.exp=Gr,i.floor=Ur,i.hypot=Xr,i.ln=zr,i.log=Hr,i.log10=jr,i.log2=Yr,i.max=Zr,i.min=Qr,i.mod=Jr,i.mul=$r,i.pow=eo,i.random=to,i.round=no,i.sign=io,i.sin=ro,i.sinh=oo,i.sqrt=so,i.sub=ao,i.sum=co,i.tan=uo,i.tanh=lo,i.trunc=mo,r===void 0&&(r={}),r&&r.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<n.length;)r.hasOwnProperty(t=n[e++])||(r[t]=this[t]);return i.config(r),i}function Wr(r,e){return new this(r).div(e)}function Gr(r){return new this(r).exp()}function Ur(r){return R(r=new this(r),r.e+1,3)}function Xr(){var r,e,t=new this(0);for(v=!1,r=0;r<arguments.length;)if(e=new this(arguments[r++]),e.d)t.d&&(t=t.plus(e.times(e)));else{if(e.s)return v=!0,new this(1/0);t=e}return v=!0,t.sqrt()}function li(r){return r instanceof xt||r&&r.toStringTag===fi||!1}function zr(r){return new this(r).ln()}function Hr(r,e){return new this(r).log(e)}function Yr(r){return new this(r).log(2)}function jr(r){return new this(r).log(10)}function Zr(){return wi(this,arguments,"lt")}function Qr(){return wi(this,arguments,"gt")}function Jr(r,e){return new this(r).mod(e)}function $r(r,e){return new this(r).mul(e)}function eo(r,e){return new this(r).pow(e)}function to(r){var e,t,n,i,o=0,s=new this(1),a=[];if(r===void 0?r=this.precision:Ce(r,1,rt),n=Math.ceil(r/E),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(n));o<n;)i=e[o],i>=429e7?e[o]=crypto.getRandomValues(new Uint32Array(1))[0]:a[o++]=i%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(n*=4);o<n;)i=e[o]+(e[o+1]<<8)+(e[o+2]<<16)+((e[o+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(e,o):(a.push(i%1e7),o+=4);o=n/4}else throw Error(pi);else for(;o<n;)a[o++]=Math.random()*1e7|0;for(n=a[--o],r%=E,n&&r&&(i=pe(10,E-r),a[o]=(n/i|0)*i);a[o]===0;o--)a.pop();if(o<0)t=0,a=[0];else{for(t=-1;a[0]===0;t-=E)a.shift();for(n=1,i=a[0];i>=10;i/=10)n++;n<E&&(t-=E-n)}return s.e=t,s.d=a,s}function no(r){return R(r=new this(r),r.e+1,this.rounding)}function io(r){return r=new this(r),r.d?r.d[0]?r.s:0*r.s:r.s||NaN}function ro(r){return new this(r).sin()}function oo(r){return new this(r).sinh()}function so(r){return new this(r).sqrt()}function ao(r,e){return new this(r).sub(e)}function co(){var r=0,e=arguments,t=new this(e[r]);for(v=!1;t.s&&++r<e.length;)t=t.plus(e[r]);return v=!0,R(t,this.precision,this.rounding)}function uo(r){return new this(r).tan()}function lo(r){return new this(r).tanh()}function mo(r){return R(r=new this(r),r.e+1,1)}x[Symbol.for("nodejs.util.inspect.custom")]=x.toString;x[Symbol.toStringTag]="Decimal";var xt=x.constructor=ki(Bn);Qt=new xt(Qt);Jt=new xt(Jt);var S=xt;import{PublicKey as xi}from"@solana/web3.js";import{get as hi,set as po}from"lodash";var Nn=class{constructor(e){this.logLevel=e.logLevel!==void 0?e.logLevel:0,this.name=e.name}set level(e){this.logLevel=e}get time(){return Date.now().toString()}get moduleName(){return this.name}isLogLevel(e){return e<=this.logLevel}error(...e){return this.isLogLevel(0)?(console.error(this.time,this.name,"sdk logger error",...e),this):this}logWithError(...e){let t=e.map(n=>typeof n=="object"?JSON.stringify(n):n).join(", ");throw new Error(t)}warning(...e){return this.isLogLevel(1)?(console.warn(this.time,this.name,"sdk logger warning",...e),this):this}info(...e){return this.isLogLevel(2)?(console.info(this.time,this.name,"sdk logger info",...e),this):this}debug(...e){return this.isLogLevel(3)?(console.debug(this.time,this.name,"sdk logger debug",...e),this):this}},Ti={},fo={};function we(r){let e=hi(Ti,r);if(!e){let t=hi(fo,r);e=new Nn({name:r,logLevel:t}),po(Ti,r,e)}return e}import{MINT_SIZE as go,TOKEN_PROGRAM_ID as bo,getTransferFeeConfig as yo,unpackMint as wo}from"@solana/spl-token";var Ln=we("Raydium_accountInfo_util");async function Qe(r,e,t){let{batchRequest:n,commitment:i="confirmed",chunkCount:o=100}={batchRequest:!1,...t},s=Rn(e,o),a=new Array(s.length).fill([]);if(n){let c=s.map(m=>{let d=r._buildArgs([m.map(p=>p.toBase58())],i,"base64");return{methodName:"getMultipleAccounts",args:d}}),u=Rn(c,10);a=(await(await Promise.all(u.map(async m=>await r._rpcBatchRequest(m)))).flat()).map(m=>(m.error&&Ln.logWithError(`failed to get info for multiple accounts, RPC_ERROR, ${m.error.message}`),m.result.value.map(d=>{if(d){let{data:p,executable:g,lamports:f,owner:y,rentEpoch:b}=d;return p.length!==2&&p[1]!=="base64"&&Ln.logWithError("info must be base64 encoded, RPC_ERROR"),{data:Buffer.from(p[0],"base64"),executable:g,lamports:f,owner:new xi(y),rentEpoch:b}}return null})))}else try{a=await Promise.all(s.map(c=>r.getMultipleAccountsInfo(c,i)))}catch(c){c instanceof Error&&Ln.logWithError(`failed to get info for multiple accounts, RPC_ERROR, ${c.message}`)}return a.flat()}async function ot(r,e,t){let n=await Qe(r,e.map(i=>i.pubkey),t);return e.map((i,o)=>({...i,accountInfo:n[o]}))}async function Bi({connection:r,mints:e,config:t}){var o,s,a;if(e.length===0)return{};let n=await ot(r,e.map(c=>({pubkey:ut(c)})),t),i={};for(let c of n){if(!c.accountInfo||c.accountInfo.data.length<go){console.log("invalid mint account",c.pubkey.toBase58());continue}let u=wo(c.pubkey,c.accountInfo,(o=c.accountInfo)==null?void 0:o.owner);i[c.pubkey.toString()]={...u,programId:((s=c.accountInfo)==null?void 0:s.owner)||bo,feeConfig:(a=yo(u))!=null?a:void 0}}return i[xi.default.toBase58()]=i[Y.toBase58()],i}import Je from"bn.js";import Io from"big.js";import sn from"bn.js";import Po from"toformat";var Ao=Po,Bt=Ao;import on from"big.js";import ho from"bn.js";import To from"decimal.js-light";import It from"bn.js";var Ii=9007199254740991;function ge(r){let e=we("Raydium_parseBigNumberish");if(r instanceof It)return r;if(typeof r=="string"){if(r.match(/^-?[0-9]+$/))return new It(r);e.logWithError(`invalid BigNumberish string: ${r}`)}return typeof r=="number"?(r%1&&e.logWithError(`BigNumberish number underflow: ${r}`),(r>=Ii||r<=-Ii)&&e.logWithError(`BigNumberish number overflow: ${r}`),new It(String(r))):typeof r=="bigint"?new It(r.toString()):(e.error(`invalid BigNumberish value: ${r}`),new It(0))}var rn=we("module/fraction"),Mn=Bt(on),St=Bt(To),xo={[0]:St.ROUND_DOWN,[1]:St.ROUND_HALF_UP,[2]:St.ROUND_UP},Bo={[0]:on.roundDown,[1]:on.roundHalfUp,[2]:on.roundUp},Q=class{constructor(e,t=new ho(1)){this.numerator=ge(e),this.denominator=ge(t)}get quotient(){return this.numerator.div(this.denominator)}invert(){return new Q(this.denominator,this.numerator)}add(e){let t=e instanceof Q?e:new Q(ge(e));return this.denominator.eq(t.denominator)?new Q(this.numerator.add(t.numerator),this.denominator):new Q(this.numerator.mul(t.denominator).add(t.numerator.mul(this.denominator)),this.denominator.mul(t.denominator))}sub(e){let t=e instanceof Q?e:new Q(ge(e));return this.denominator.eq(t.denominator)?new Q(this.numerator.sub(t.numerator),this.denominator):new Q(this.numerator.mul(t.denominator).sub(t.numerator.mul(this.denominator)),this.denominator.mul(t.denominator))}mul(e){let t=e instanceof Q?e:new Q(ge(e));return new Q(this.numerator.mul(t.numerator),this.denominator.mul(t.denominator))}div(e){let t=e instanceof Q?e:new Q(ge(e));return new Q(this.numerator.mul(t.denominator),this.denominator.mul(t.numerator))}toSignificant(e,t={groupSeparator:""},n=1){Number.isInteger(e)||rn.logWithError(`${e} is not an integer.`),e<=0&&rn.logWithError(`${e} is not positive.`),St.set({precision:e+1,rounding:xo[n]});let i=new St(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(e);return i.toFormat(i.decimalPlaces(),t)}toFixed(e,t={groupSeparator:""},n=1){return Number.isInteger(e)||rn.logWithError(`${e} is not an integer.`),e<0&&rn.logWithError(`${e} is negative.`),Mn.DP=e,Mn.RM=Bo[n]||1,new Mn(this.numerator.toString()).div(this.denominator.toString()).toFormat(e,t)}isZero(){return this.numerator.isZero()}};var So=we("Raydium_amount"),Si=Bt(Io);function Co(r,e){let t="0",n="0";if(r.includes(".")){let i=r.split(".");i.length===2?([t,n]=i,n=n.padEnd(e,"0")):So.logWithError(`invalid number string, num: ${r}`)}else t=r;return[t,n.slice(0,e)||n]}var Pe=class extends Q{constructor(t,n,i=!0,o){let s=new sn(0),a=On.pow(new sn(t.decimals));if(i)s=ge(n);else{let c=new sn(0),u=new sn(0);if(typeof n=="string"||typeof n=="number"||typeof n=="bigint"){let[l,m]=Co(n.toString(),t.decimals);c=ge(l),u=ge(m)}c=c.mul(a),s=c.add(u)}super(s,a);this.logger=we(o||"TokenAmount"),this.token=t}get raw(){return this.numerator}isZero(){return this.raw.isZero()}gt(t){return this.token.equals(t.token)||this.logger.logWithError("gt token not equals"),this.raw.gt(t.raw)}lt(t){return this.token.equals(t.token)||this.logger.logWithError("lt token not equals"),this.raw.lt(t.raw)}add(t){return this.token.equals(t.token)||this.logger.logWithError("add token not equals"),new Pe(this.token,this.raw.add(t.raw))}subtract(t){return this.token.equals(t.token)||this.logger.logWithError("sub token not equals"),new Pe(this.token,this.raw.sub(t.raw))}toSignificant(t=this.token.decimals,n,i=0){return super.toSignificant(t,n,i)}toFixed(t=this.token.decimals,n,i=0){return t>this.token.decimals&&this.logger.logWithError("decimals overflow"),super.toFixed(t,n,i)}toExact(t={groupSeparator:""}){return Si.DP=this.token.decimals,new Si(this.numerator.toString()).div(this.denominator.toString()).toFormat(t)}};import{PublicKey as Ko}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as Ci}from"@solana/spl-token";var Fn={chainId:101,address:Ko.default.toBase58(),programId:Ci.toBase58(),decimals:9,symbol:"SOL",name:"solana",logoURI:"https://img.raydium.io/icon/So11111111111111111111111111111111111111112.png",tags:[],priority:2,type:"raydium",extensions:{coingeckoId:"solana"}},st={chainId:101,address:"So11111111111111111111111111111111111111112",programId:Ci.toBase58(),decimals:9,symbol:"WSOL",name:"Wrapped SOL",logoURI:"https://img.raydium.io/icon/So11111111111111111111111111111111111111112.png",tags:[],priority:2,type:"raydium",extensions:{coingeckoId:"solana"}};import{PublicKey as Vn}from"@solana/web3.js";import{PublicKey as se,SystemProgram as Ki,SYSVAR_RENT_PUBKEY as No}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as Lo}from"@solana/spl-token";function En({pubkey:r,isSigner:e=!1,isWritable:t=!0}){return{pubkey:r,isWritable:t,isSigner:e}}var la=[En({pubkey:Lo,isWritable:!1}),En({pubkey:Ki.programId,isWritable:!1}),En({pubkey:No,isWritable:!1})];function Dn({publicKey:r,transformSol:e}){let t=Ni(r.toString());if(t instanceof se)return e&&t.equals(Ct)?Y:t;if(e&&t.toString()===Ct.toBase58())return Y;if(typeof t=="string"){if(t===se.default.toBase58())return se.default;try{return new se(t)}catch{throw new Error("invalid public key")}}throw new Error("invalid public key")}function Ni(r){try{return new se(r)}catch{return r}}var an=new se("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),vn=new se("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),wt=new se("SysvarRent111111111111111111111111111111111"),ma=new se("SysvarC1ock11111111111111111111111111111111"),lt=new se("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),da=new se("Sysvar1nstructions1111111111111111111111111"),pa=Ki.programId,fa=new se("2cpMA1jNS4obgRz8XNg38QuSP83L1AXpUgfxPNcvnAGj"),ga=new se("Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS"),ba=new se("SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt"),ya=new se("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),wa=new se("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"),Pa=new se("mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So"),Aa=new se("7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj"),ka=new se("USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX"),ha=new se("NRVwhjBQiUPYtfDT5zRBVJajzFQHaBUNtC7SNVvqRFa"),Ta=new se("ANAxByE6G2WjFp7A4NqtWYXb3mgruyzZYg3spfxe6Lbo"),xa=new se("7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs"),Y=new se("So11111111111111111111111111111111111111112"),Ct=se.default;function ut(r){return Dn({publicKey:r,transformSol:!0})}var _n=class{constructor({mint:e,decimals:t,symbol:n,name:i,skipMint:o=!1,isToken2022:s=!1}){if(e===Ct.toBase58()||e instanceof Vn&&Ct.equals(e)){this.decimals=st.decimals,this.symbol=st.symbol,this.name=st.name,this.mint=new Vn(st.address),this.isToken2022=!1;return}this.decimals=t,this.symbol=n||e.toString().substring(0,6),this.name=i||e.toString().substring(0,6),this.mint=o?Vn.default:Dn({publicKey:e}),this.isToken2022=s}equals(e){return this===e?!0:this.mint.equals(e.mint)}},Ue=_n;Ue.WSOL=new _n({...st,mint:st.address});var qn=class{constructor({decimals:e,symbol:t="UNKNOWN",name:n="UNKNOWN"}){this.decimals=e,this.symbol=t,this.name=n}equals(e){return this===e}},cn=qn;cn.SOL=new qn(Fn);import Ro from"bn.js";var Li=new Q(new Ro(100)),at=class extends Q{toSignificant(e=5,t,n){return this.mul(Li).toSignificant(e,t,n)}toFixed(e=2,t,n){return this.mul(Li).toFixed(e,t,n)}};var Mo=we("Raydium_price"),De=class extends Q{constructor(t){let{baseToken:n,quoteToken:i,numerator:o,denominator:s}=t;super(o,s);this.baseToken=n,this.quoteToken=i,this.scalar=new Q(Wn(n.decimals),Wn(i.decimals))}get raw(){return new Q(this.numerator,this.denominator)}get adjusted(){return super.mul(this.scalar)}invert(){return new De({baseToken:this.quoteToken,quoteToken:this.baseToken,denominator:this.numerator,numerator:this.denominator})}mul(t){this.quoteToken!==t.baseToken&&Mo.logWithError("mul token not equals");let n=super.mul(t);return new De({baseToken:this.baseToken,quoteToken:t.quoteToken,denominator:n.denominator,numerator:n.numerator})}toSignificant(t=this.quoteToken.decimals,n,i){return this.adjusted.toSignificant(t,n,i)}toFixed(t=this.quoteToken.decimals,n,i){return this.adjusted.toFixed(t,n,i)}};import{PublicKey as nc}from"@solana/web3.js";import rc from"bn.js";var Oo=new Je(0),hc=new Je(1),Tc=new Je(2),xc=new Je(3),Bc=new Je(5),On=new Je(10),Ic=new Je(100),Sc=new Je(1e3),Cc=new Je(1e4);function Wn(r){return On.pow(ge(r))}function Rn(r,e=1,t=[]){let n=[...r];if(e<=0)return t;for(;n.length;)t.push(n.splice(0,e));return t}import{PublicKey as qo}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as Wo}from"@solana/spl-token";import{ComputeBudgetProgram as Ri,Keypair as Oi,PublicKey as Fo,Transaction as Fi,TransactionMessage as Eo,VersionedTransaction as Ei}from"@solana/web3.js";var le={CreateAccount:"CreateAccount",InitAccount:"InitAccount",CreateATA:"CreateATA",CloseAccount:"CloseAccount",TransferAmount:"TransferAmount",InitMint:"InitMint",MintTo:"MintTo",InitMarket:"InitMarket",Util1216OwnerClaim:"Util1216OwnerClaim",SetComputeUnitPrice:"SetComputeUnitPrice",SetComputeUnitLimit:"SetComputeUnitLimit",ClmmCreatePool:"ClmmCreatePool",ClmmOpenPosition:"ClmmOpenPosition",ClmmIncreasePosition:"ClmmIncreasePosition",ClmmDecreasePosition:"ClmmDecreasePosition",ClmmClosePosition:"ClmmClosePosition",ClmmSwapBaseIn:"ClmmSwapBaseIn",ClmmSwapBaseOut:"ClmmSwapBaseOut",ClmmInitReward:"ClmmInitReward",ClmmSetReward:"ClmmSetReward",ClmmCollectReward:"ClmmCollectReward",ClmmLockPosition:"ClmmLockPosition",ClmmHarvestLockPosition:"ClmmHarvestLockPosition",AmmV4Swap:"AmmV4Swap",AmmV4AddLiquidity:"AmmV4AddLiquidity",AmmV4RemoveLiquidity:"AmmV4RemoveLiquidity",AmmV4SimulatePoolInfo:"AmmV4SimulatePoolInfo",AmmV4SwapBaseIn:"AmmV4SwapBaseIn",AmmV4SwapBaseOut:"AmmV4SwapBaseOut",AmmV4CreatePool:"AmmV4CreatePool",AmmV4InitPool:"AmmV4InitPool",AmmV5AddLiquidity:"AmmV5AddLiquidity",AmmV5RemoveLiquidity:"AmmV5RemoveLiquidity",AmmV5SimulatePoolInfo:"AmmV5SimulatePoolInfo",AmmV5SwapBaseIn:"AmmV5SwapBaseIn",AmmV5SwapBaseOut:"AmmV5SwapBaseOut",RouteSwap:"RouteSwap",RouteSwap1:"RouteSwap1",RouteSwap2:"RouteSwap2",FarmV3Deposit:"FarmV3Deposit",FarmV3Withdraw:"FarmV3Withdraw",FarmV3CreateLedger:"FarmV3CreateLedger",FarmV5Deposit:"FarmV5Deposit",FarmV5Withdraw:"FarmV5Withdraw",FarmV5CreateLedger:"FarmV5CreateLedger",FarmV6Deposit:"FarmV6Deposit",FarmV6Withdraw:"FarmV6Withdraw",FarmV6Create:"FarmV6Create",FarmV6Restart:"FarmV6Restart",FarmV6CreatorAddReward:"FarmV6CreatorAddReward",FarmV6CreatorWithdraw:"FarmV6CreatorWithdraw",CpmmCreatePool:"CpmmCreatePool",CpmmCreateConfig:"CpmmCreateConfig",CpmmAddLiquidity:"CpmmAddLiquidity",CpmmWithdrawLiquidity:"CpmmWithdrawLiquidity",CpmmSwapBaseIn:"CpmmSwapBaseIn",CpmmSwapBaseOut:"CpmmSwapBaseOut",CpmmLockLp:"CpmmLockLp",CpmmCollectLockFee:"CpmmCollectLockFee"};import{TOKEN_PROGRAM_ID as Do}from"@solana/spl-token";var Mi=we("Raydium_txUtil"),Di=1644;function un(r){let e=[],t=[];return r.microLamports&&(e.push(Ri.setComputeUnitPrice({microLamports:r.microLamports})),t.push(le.SetComputeUnitPrice)),r.units&&(e.push(Ri.setComputeUnitLimit({units:r.units})),t.push(le.SetComputeUnitLimit)),{instructions:e,instructionTypes:t}}async function Pt(r,e){var n,i;let t=e!=null?e:"confirmed";return(i=await((n=r.getLatestBlockhash)==null?void 0:n.call(r,{commitment:t})))==null?void 0:i.blockhash}async function ln(r,e){return r.getSignatureStatuses([e]),new Promise((t,n)=>{let i=setTimeout(n,6e4);r.onSignature(e,o=>{if(clearTimeout(i),!o.err){t("");return}n(o.err.toString())},"confirmed")})}function vo(r,e){r.length<1&&Mi.logWithError(`no instructions provided: ${r.toString()}`),e.length<1&&Mi.logWithError(`no signers provided:, ${e.toString()}`);let t=new Fi;t.recentBlockhash="11111111111111111111111111111111",t.feePayer=e[0],t.add(...r);try{return Buffer.from(t.serialize({verifySignatures:!1})).toString("base64").length<Di}catch{return!1}}function he(r,e){let[t,n]=Fo.findProgramAddressSync(r,e);return{publicKey:t,nonce:n}}function Kt({instructions:r,payer:e,signers:t}){return vo(r,[e,...t])}function Nt({instructions:r,payer:e,lookupTableAddressAccount:t,recentBlockhash:n=Oi.generate().publicKey.toString()}){let o=new Eo({payerKey:e,recentBlockhash:n,instructions:r}).compileToV0Message(Object.values(t!=null?t:{}));try{return Buffer.from(new Ei(o).serialize()).toString("base64").length<Di}catch{return!1}}var Vo=r=>Buffer.isBuffer(r)?r:r instanceof Uint8Array?Buffer.from(r.buffer,r.byteOffset,r.byteLength):Buffer.from(r),_o=r=>{let e=r.serialize({requireAllSignatures:!1,verifySignatures:!1});r instanceof Ei&&(e=Vo(e));try{return e instanceof Buffer?e.toString("base64"):Buffer.from(e).toString("base64")}catch{return e.toString("base64")}};function mt(r){let e=[];return r.forEach(t=>{t instanceof Fi&&(t.recentBlockhash||(t.recentBlockhash=Do.toBase58()),t.feePayer||(t.feePayer=Oi.generate().publicKey)),e.push(_o(t))}),console.log("simulate tx string:",e),e}function Te(r,e,t){return he([r.toBuffer(),(t!=null?t:Wo).toBuffer(),e.toBuffer()],new qo("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"))}import{PublicKey as W}from"@solana/web3.js";var jc=new W("EhhTKczWMGQt46ynNeRX1WfeagwwJd7ufHvCDjRxjo5Q"),Zc=new W("9KEPoZmtHUrBbhWN1v1KWLMkkvwY6WLtAVUCPRtRjP4z"),Qc=new W("FarmqiPv5eAj3j1GMdMCMUGXqPUvmquZtMy86QH6rzhG"),Jc=new W("CLaimxFqjHzgTJtAGHU47NPhg6qrc5sCnpC4tBLyABQS"),$c=new W("srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX"),eu=new W("9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin"),tu=new W("675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8"),nu=new W("5quBtoiQqxF9Jv6KYKctB59NT3gtJD2Y65kdnB1Uev3h"),iu=new W("CDSr3ssLcRB6XYPJwAfFt18MZvEZp4LjHcvzBVZ45duo"),mn=new W("CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK"),Lt=new W("LockrWmn6K5twhz3y9w1dQERbmgSaRkfnTeTKbpofwE"),dn=new W("kN1kEznaF5Xbd8LYuqtEFcxzWSBk5Fv6ygX6SqEGJVy"),ru=new W("routeUGWgWzqBWFcrCfv8tritsqukccJPu3q5GPP3xS"),ou=new W("7YttLkHDoNj9wyDur5pM1ejNaAvT9X4eqaYcHQqtj2G5"),su=new W("6FJon3QE27qgPVggARueB22hLvoh22VzJpXv4rBEoSLF"),au=new W("CC12se5To1CdEuw7fDS27B7Geo5jJyL7t5UK2B44NgiH"),cu=new W("9HzJyW1qZsEiSfMUf6L2jo3CcTKAyBmSyKdwQeYisHrC"),uu=new W("DropEU8AvevN3UrXWXTMuz3rqnMczQVNjq3kcSdW2SQi"),lu=new W("SNaPnpKUY656VPwbKmKT8FG4T85g4VWhRH1B4TQUfKs"),mu=new W("9pR79Lqe6wDNjag3v8MeVYUostoXjY2ognTydor6AtEZ"),du=new W("DNXgeM9EiiaAbaWvwjHj9fQQLAX5ZsfHyvmYUNRAdNC8"),Go=new W("4AscABy58S62owbByjUUkQfZsP7fxYH1rDYb69V58HPM"),Uo=new W("7rQ1QFNosMkUCuh7Z7fPbTHvh73b68sQYdirycEzJVuw"),Xo=new W("G11FKBRaAkHAKuLCgLM6K6NUc9rTjPAznRCjZifrTQe2"),pu=new W("LockrWmn6K5twhz3y9w1dQERbmgSaRkfnTeTKbpofwE"),zo=new W("DLockwT7X7sxtLmGH9g5kmfcjaBtncdbUmi738m5bvQC"),fu=new W("3f7GcQFG397GAaEnv51zR6tsTVihYRydnydDD1cXekxH"),Ho=new W("7AFUeLVRjBfzqK3tTGw8hN48KLQWSk6DTE8xprWdPqix");var gu={SERUM_MARKET:W.default,OPENBOOK_MARKET:new W("EoTcMgcDRTJVZDMZWBoU6rhYHZfkNTVEAfz3uUJRcYGj"),UTIL1216:W.default,FarmV3:new W("85BFyr98MbCUU9MVTEgzx1nbhWACbJqLzho6zd6DZcWL"),FarmV5:new W("EcLzTrNg9V7qhcdyXDe2qjtPkiGzDM2UbdRaeaadU5r2"),FarmV6:new W("Farm2hJLcqPtPg8M4rR6DMrsRNc5TPm5Cs4bVQrMe2T7"),AmmV4:new W("HWy1jotHpo6UqeQxx49dpYYdQB8wj9Qk9MdxwjLvDHB8"),AmmStable:new W("DDg4V