UNPKG

@raydium-io/raydium-sdk-v2

Version:

An SDK for building applications on top of Raydium.

1 lines 70.2 kB
var it=Object.create;var Pe=Object.defineProperty,ot=Object.defineProperties,st=Object.getOwnPropertyDescriptor,at=Object.getOwnPropertyDescriptors,ut=Object.getOwnPropertyNames,Ee=Object.getOwnPropertySymbols,ct=Object.getPrototypeOf,Je=Object.prototype.hasOwnProperty,bn=Object.prototype.propertyIsEnumerable;var Tn=(e,n,t)=>n in e?Pe(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,j=(e,n)=>{for(var t in n||(n={}))Je.call(n,t)&&Tn(e,t,n[t]);if(Ee)for(var t of Ee(n))bn.call(n,t)&&Tn(e,t,n[t]);return e},oe=(e,n)=>ot(e,at(n));var Le=(e,n)=>{var t={};for(var r in e)Je.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&Ee)for(var r of Ee(e))n.indexOf(r)<0&&bn.call(e,r)&&(t[r]=e[r]);return t};var lt=(e,n)=>{for(var t in n)Pe(e,t,{get:n[t],enumerable:!0})},yn=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of ut(n))!Je.call(e,o)&&o!==t&&Pe(e,o,{get:()=>n[o],enumerable:!(r=st(n,o))||r.enumerable});return e};var Y=(e,n,t)=>(t=e!=null?it(ct(e)):{},yn(n||!e||!e.__esModule?Pe(t,"default",{value:e,enumerable:!0}):t,e)),ft=e=>yn(Pe({},"__esModule",{value:!0}),e);var xr={};lt(xr,{TxBuilder:()=>hn});module.exports=ft(xr);var F=require("@solana/web3.js"),tt=Y(require("axios"));var $=require("@solana/web3.js");var et=require("@solana/web3.js");var ne=Y(require("bn.js"));var ge=9e15,ce=1e9,Xe="0123456789abcdef",Fe="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",_e="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Qe={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-ge,maxE:ge,crypto:!1},Nn,re,B=!0,Ve="[DecimalError] ",ue=Ve+"Invalid argument: ",Sn=Ve+"Precision limit exceeded",kn=Ve+"crypto unavailable",Cn="[object Decimal]",H=Math.floor,U=Math.pow,mt=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,dt=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,pt=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Bn=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Q=1e7,k=7,gt=9007199254740991,ht=Fe.length-1,$e=_e.length-1,d={toStringTag:Cn};d.absoluteValue=d.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),P(e)};d.ceil=function(){return P(new this.constructor(this),this.e+1,2)};d.clampedTo=d.clamp=function(e,n){var t,r=this,o=r.constructor;if(e=new o(e),n=new o(n),!e.s||!n.s)return new o(NaN);if(e.gt(n))throw Error(ue+n);return t=r.cmp(e),t<0?e:r.cmp(n)>0?n:new o(r)};d.comparedTo=d.cmp=function(e){var n,t,r,o,i=this,s=i.d,a=(e=new i.constructor(e)).d,c=i.s,u=e.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(i.e!==e.e)return i.e>e.e^c<0?1:-1;for(r=s.length,o=a.length,n=0,t=r<o?r:o;n<t;++n)if(s[n]!==a[n])return s[n]>a[n]^c<0?1:-1;return r===o?0:r>o^c<0?1:-1};d.cosine=d.cos=function(){var e,n,t=this,r=t.constructor;return t.d?t.d[0]?(e=r.precision,n=r.rounding,r.precision=e+Math.max(t.e,t.sd())+k,r.rounding=1,t=wt(r,En(r,t)),r.precision=e,r.rounding=n,P(re==2||re==3?t.neg():t,e,n,!0)):new r(1):new r(NaN)};d.cubeRoot=d.cbrt=function(){var e,n,t,r,o,i,s,a,c,u,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(B=!1,i=l.s*U(l.s*l,1/3),!i||Math.abs(i)==1/0?(t=G(l.d),e=l.e,(i=(e-t.length+1)%3)&&(t+=i==1||i==-2?"0":"00"),i=U(t,1/3),e=H((e+1)/3)-(e%3==(e<0?-1:2)),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),r=new f(t),r.s=l.s):r=new f(i.toString()),s=(e=f.precision)+3;;)if(a=r,c=a.times(a).times(a),u=c.plus(l),r=W(u.plus(l).times(a),u.plus(c),s+2,1),G(a.d).slice(0,s)===(t=G(r.d)).slice(0,s))if(t=t.slice(s-3,s+1),t=="9999"||!o&&t=="4999"){if(!o&&(P(a,e+1,0),a.times(a).times(a).eq(l))){r=a;break}s+=4,o=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(P(r,e+1,1),n=!r.times(r).times(r).eq(l));break}return B=!0,P(r,e,f.rounding,n)};d.decimalPlaces=d.dp=function(){var e,n=this.d,t=NaN;if(n){if(e=n.length-1,t=(e-H(this.e/k))*k,e=n[e],e)for(;e%10==0;e/=10)t--;t<0&&(t=0)}return t};d.dividedBy=d.div=function(e){return W(this,new this.constructor(e))};d.dividedToIntegerBy=d.divToInt=function(e){var n=this,t=n.constructor;return P(W(n,new t(e),0,1,1),t.precision,t.rounding)};d.equals=d.eq=function(e){return this.cmp(e)===0};d.floor=function(){return P(new this.constructor(this),this.e+1,3)};d.greaterThan=d.gt=function(e){return this.cmp(e)>0};d.greaterThanOrEqualTo=d.gte=function(e){var n=this.cmp(e);return n==1||n===0};d.hyperbolicCosine=d.cosh=function(){var e,n,t,r,o,i=this,s=i.constructor,a=new s(1);if(!i.isFinite())return new s(i.s?1/0:NaN);if(i.isZero())return a;t=s.precision,r=s.rounding,s.precision=t+Math.max(i.e,i.sd())+4,s.rounding=1,o=i.d.length,o<32?(e=Math.ceil(o/3),n=(1/Ke(4,e)).toString()):(e=16,n="2.3283064365386962890625e-10"),i=he(s,1,i.times(n),new s(1),!0);for(var c,u=e,l=new s(8);u--;)c=i.times(i),i=a.minus(c.times(l.minus(c.times(l))));return P(i,s.precision=t,s.rounding=r,!0)};d.hyperbolicSine=d.sinh=function(){var e,n,t,r,o=this,i=o.constructor;if(!o.isFinite()||o.isZero())return new i(o);if(n=i.precision,t=i.rounding,i.precision=n+Math.max(o.e,o.sd())+4,i.rounding=1,r=o.d.length,r<3)o=he(i,2,o,o,!0);else{e=1.4*Math.sqrt(r),e=e>16?16:e|0,o=o.times(1/Ke(5,e)),o=he(i,2,o,o,!0);for(var s,a=new i(5),c=new i(16),u=new i(20);e--;)s=o.times(o),o=o.times(a.plus(s.times(c.times(s).plus(u))))}return i.precision=n,i.rounding=t,P(o,n,t,!0)};d.hyperbolicTangent=d.tanh=function(){var e,n,t=this,r=t.constructor;return t.isFinite()?t.isZero()?new r(t):(e=r.precision,n=r.rounding,r.precision=e+7,r.rounding=1,W(t.sinh(),t.cosh(),r.precision=e,r.rounding=n)):new r(t.s)};d.inverseCosine=d.acos=function(){var e,n=this,t=n.constructor,r=n.abs().cmp(1),o=t.precision,i=t.rounding;return r!==-1?r===0?n.isNeg()?X(t,o,i):new t(0):new t(NaN):n.isZero()?X(t,o+4,i).times(.5):(t.precision=o+6,t.rounding=1,n=n.asin(),e=X(t,o+4,i).times(.5),t.precision=o,t.rounding=i,e.minus(n))};d.inverseHyperbolicCosine=d.acosh=function(){var e,n,t=this,r=t.constructor;return t.lte(1)?new r(t.eq(1)?0:NaN):t.isFinite()?(e=r.precision,n=r.rounding,r.precision=e+Math.max(Math.abs(t.e),t.sd())+4,r.rounding=1,B=!1,t=t.times(t).minus(1).sqrt().plus(t),B=!0,r.precision=e,r.rounding=n,t.ln()):new r(t)};d.inverseHyperbolicSine=d.asinh=function(){var e,n,t=this,r=t.constructor;return!t.isFinite()||t.isZero()?new r(t):(e=r.precision,n=r.rounding,r.precision=e+2*Math.max(Math.abs(t.e),t.sd())+6,r.rounding=1,B=!1,t=t.times(t).plus(1).sqrt().plus(t),B=!0,r.precision=e,r.rounding=n,t.ln())};d.inverseHyperbolicTangent=d.atanh=function(){var e,n,t,r,o=this,i=o.constructor;return o.isFinite()?o.e>=0?new i(o.abs().eq(1)?o.s/0:o.isZero()?o:NaN):(e=i.precision,n=i.rounding,r=o.sd(),Math.max(r,e)<2*-o.e-1?P(new i(o),e,n,!0):(i.precision=t=r-o.e,o=W(o.plus(1),new i(1).minus(o),t+e,1),i.precision=e+4,i.rounding=1,o=o.ln(),i.precision=e,i.rounding=n,o.times(.5))):new i(NaN)};d.inverseSine=d.asin=function(){var e,n,t,r,o=this,i=o.constructor;return o.isZero()?new i(o):(n=o.abs().cmp(1),t=i.precision,r=i.rounding,n!==-1?n===0?(e=X(i,t+4,r).times(.5),e.s=o.s,e):new i(NaN):(i.precision=t+6,i.rounding=1,o=o.div(new i(1).minus(o.times(o)).sqrt().plus(1)).atan(),i.precision=t,i.rounding=r,o.times(2)))};d.inverseTangent=d.atan=function(){var e,n,t,r,o,i,s,a,c,u=this,l=u.constructor,f=l.precision,m=l.rounding;if(u.isFinite()){if(u.isZero())return new l(u);if(u.abs().eq(1)&&f+4<=$e)return s=X(l,f+4,m).times(.25),s.s=u.s,s}else{if(!u.s)return new l(NaN);if(f+4<=$e)return s=X(l,f+4,m).times(.5),s.s=u.s,s}for(l.precision=a=f+10,l.rounding=1,t=Math.min(28,a/k+2|0),e=t;e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(B=!1,n=Math.ceil(a/k),r=1,c=u.times(u),s=new l(u),o=u;e!==-1;)if(o=o.times(c),i=s.minus(o.div(r+=2)),o=o.times(c),s=i.plus(o.div(r+=2)),s.d[n]!==void 0)for(e=n;s.d[e]===i.d[e]&&e--;);return t&&(s=s.times(2<<t-1)),B=!0,P(s,l.precision=f,l.rounding=m,!0)};d.isFinite=function(){return!!this.d};d.isInteger=d.isInt=function(){return!!this.d&&H(this.e/k)>this.d.length-2};d.isNaN=function(){return!this.s};d.isNegative=d.isNeg=function(){return this.s<0};d.isPositive=d.isPos=function(){return this.s>0};d.isZero=function(){return!!this.d&&this.d[0]===0};d.lessThan=d.lt=function(e){return this.cmp(e)<0};d.lessThanOrEqualTo=d.lte=function(e){return this.cmp(e)<1};d.logarithm=d.log=function(e){var n,t,r,o,i,s,a,c,u=this,l=u.constructor,f=l.precision,m=l.rounding,p=5;if(e==null)e=new l(10),n=!0;else{if(e=new l(e),t=e.d,e.s<0||!t||!t[0]||e.eq(1))return new l(NaN);n=e.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(n)if(t.length>1)i=!0;else{for(o=t[0];o%10===0;)o/=10;i=o!==1}if(B=!1,a=f+p,s=ae(u,a),r=n?Oe(l,a+10):ae(e,a),c=W(s,r,a,1),Ae(c.d,o=f,m))do if(a+=10,s=ae(u,a),r=n?Oe(l,a+10):ae(e,a),c=W(s,r,a,1),!i){+G(c.d).slice(o+1,o+15)+1==1e14&&(c=P(c,f+1,0));break}while(Ae(c.d,o+=10,m));return B=!0,P(c,f,m)};d.minus=d.sub=function(e){var n,t,r,o,i,s,a,c,u,l,f,m,p=this,h=p.constructor;if(e=new h(e),!p.d||!e.d)return!p.s||!e.s?e=new h(NaN):p.d?e.s=-e.s:e=new h(e.d||p.s!==e.s?p:NaN),e;if(p.s!=e.s)return e.s=-e.s,p.plus(e);if(u=p.d,m=e.d,a=h.precision,c=h.rounding,!u[0]||!m[0]){if(m[0])e.s=-e.s;else if(u[0])e=new h(p);else return new h(c===3?-0:0);return B?P(e,a,c):e}if(t=H(e.e/k),l=H(p.e/k),u=u.slice(),i=l-t,i){for(f=i<0,f?(n=u,i=-i,s=m.length):(n=m,t=l,s=u.length),r=Math.max(Math.ceil(a/k),s)+2,i>r&&(i=r,n.length=1),n.reverse(),r=i;r--;)n.push(0);n.reverse()}else{for(r=u.length,s=m.length,f=r<s,f&&(s=r),r=0;r<s;r++)if(u[r]!=m[r]){f=u[r]<m[r];break}i=0}for(f&&(n=u,u=m,m=n,e.s=-e.s),s=u.length,r=m.length-s;r>0;--r)u[s++]=0;for(r=m.length;r>i;){if(u[--r]<m[r]){for(o=r;o&&u[--o]===0;)u[o]=Q-1;--u[o],u[r]+=Q}u[r]-=m[r]}for(;u[--s]===0;)u.pop();for(;u[0]===0;u.shift())--t;return u[0]?(e.d=u,e.e=We(u,t),B?P(e,a,c):e):new h(c===3?-0:0)};d.modulo=d.mod=function(e){var n,t=this,r=t.constructor;return e=new r(e),!t.d||!e.s||e.d&&!e.d[0]?new r(NaN):!e.d||t.d&&!t.d[0]?P(new r(t),r.precision,r.rounding):(B=!1,r.modulo==9?(n=W(t,e.abs(),0,3,1),n.s*=e.s):n=W(t,e,0,r.modulo,1),n=n.times(e),B=!0,t.minus(n))};d.naturalExponential=d.exp=function(){return en(this)};d.naturalLogarithm=d.ln=function(){return ae(this)};d.negated=d.neg=function(){var e=new this.constructor(this);return e.s=-e.s,P(e)};d.plus=d.add=function(e){var n,t,r,o,i,s,a,c,u,l,f=this,m=f.constructor;if(e=new m(e),!f.d||!e.d)return!f.s||!e.s?e=new m(NaN):f.d||(e=new m(e.d||f.s===e.s?f:NaN)),e;if(f.s!=e.s)return e.s=-e.s,f.minus(e);if(u=f.d,l=e.d,a=m.precision,c=m.rounding,!u[0]||!l[0])return l[0]||(e=new m(f)),B?P(e,a,c):e;if(i=H(f.e/k),r=H(e.e/k),u=u.slice(),o=i-r,o){for(o<0?(t=u,o=-o,s=l.length):(t=l,r=i,s=u.length),i=Math.ceil(a/k),s=i>s?i+1:s+1,o>s&&(o=s,t.length=1),t.reverse();o--;)t.push(0);t.reverse()}for(s=u.length,o=l.length,s-o<0&&(o=s,t=l,l=u,u=t),n=0;o;)n=(u[--o]=u[o]+l[o]+n)/Q|0,u[o]%=Q;for(n&&(u.unshift(n),++r),s=u.length;u[--s]==0;)u.pop();return e.d=u,e.e=We(u,r),B?P(e,a,c):e};d.precision=d.sd=function(e){var n,t=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(ue+e);return t.d?(n=Rn(t.d),e&&t.e+1>n&&(n=t.e+1)):n=NaN,n};d.round=function(){var e=this,n=e.constructor;return P(new n(e),e.e+1,n.rounding)};d.sine=d.sin=function(){var e,n,t=this,r=t.constructor;return t.isFinite()?t.isZero()?new r(t):(e=r.precision,n=r.rounding,r.precision=e+Math.max(t.e,t.sd())+k,r.rounding=1,t=bt(r,En(r,t)),r.precision=e,r.rounding=n,P(re>2?t.neg():t,e,n,!0)):new r(NaN)};d.squareRoot=d.sqrt=function(){var e,n,t,r,o,i,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(B=!1,u=Math.sqrt(+s),u==0||u==1/0?(n=G(a),(n.length+c)%2==0&&(n+="0"),u=Math.sqrt(n),c=H((c+1)/2)-(c<0||c%2),u==1/0?n="5e"+c:(n=u.toExponential(),n=n.slice(0,n.indexOf("e")+1)+c),r=new l(n)):r=new l(u.toString()),t=(c=l.precision)+3;;)if(i=r,r=i.plus(W(s,i,t+2,1)).times(.5),G(i.d).slice(0,t)===(n=G(r.d)).slice(0,t))if(n=n.slice(t-3,t+1),n=="9999"||!o&&n=="4999"){if(!o&&(P(i,c+1,0),i.times(i).eq(s))){r=i;break}t+=4,o=1}else{(!+n||!+n.slice(1)&&n.charAt(0)=="5")&&(P(r,c+1,1),e=!r.times(r).eq(s));break}return B=!0,P(r,c,l.rounding,e)};d.tangent=d.tan=function(){var e,n,t=this,r=t.constructor;return t.isFinite()?t.isZero()?new r(t):(e=r.precision,n=r.rounding,r.precision=e+10,r.rounding=1,t=t.sin(),t.s=1,t=W(t,new r(1).minus(t.times(t)).sqrt(),e+10,0),r.precision=e,r.rounding=n,P(re==2||re==4?t.neg():t,e,n,!0)):new r(NaN)};d.times=d.mul=function(e){var n,t,r,o,i,s,a,c,u,l=this,f=l.constructor,m=l.d,p=(e=new f(e)).d;if(e.s*=l.s,!m||!m[0]||!p||!p[0])return new f(!e.s||m&&!m[0]&&!p||p&&!p[0]&&!m?NaN:!m||!p?e.s/0:e.s*0);for(t=H(l.e/k)+H(e.e/k),c=m.length,u=p.length,c<u&&(i=m,m=p,p=i,s=c,c=u,u=s),i=[],s=c+u,r=s;r--;)i.push(0);for(r=u;--r>=0;){for(n=0,o=c+r;o>r;)a=i[o]+p[r]*m[o-r-1]+n,i[o--]=a%Q|0,n=a/Q|0;i[o]=(i[o]+n)%Q|0}for(;!i[--s];)i.pop();return n?++t:i.shift(),e.d=i,e.e=We(i,t),B?P(e,f.precision,f.rounding):e};d.toBinary=function(e,n){return tn(this,2,e,n)};d.toDecimalPlaces=d.toDP=function(e,n){var t=this,r=t.constructor;return t=new r(t),e===void 0?t:(z(e,0,ce),n===void 0?n=r.rounding:z(n,0,8),P(t,e+t.e+1,n))};d.toExponential=function(e,n){var t,r=this,o=r.constructor;return e===void 0?t=ee(r,!0):(z(e,0,ce),n===void 0?n=o.rounding:z(n,0,8),r=P(new o(r),e+1,n),t=ee(r,!0,e+1)),r.isNeg()&&!r.isZero()?"-"+t:t};d.toFixed=function(e,n){var t,r,o=this,i=o.constructor;return e===void 0?t=ee(o):(z(e,0,ce),n===void 0?n=i.rounding:z(n,0,8),r=P(new i(o),e+o.e+1,n),t=ee(r,!1,e+r.e+1)),o.isNeg()&&!o.isZero()?"-"+t:t};d.toFraction=function(e){var n,t,r,o,i,s,a,c,u,l,f,m,p=this,h=p.d,g=p.constructor;if(!h)return new g(p);if(u=t=new g(1),r=c=new g(0),n=new g(r),i=n.e=Rn(h)-p.e-1,s=i%k,n.d[0]=U(10,s<0?k+s:s),e==null)e=i>0?n:u;else{if(a=new g(e),!a.isInt()||a.lt(u))throw Error(ue+a);e=a.gt(n)?i>0?n:u:a}for(B=!1,a=new g(G(h)),l=g.precision,g.precision=i=h.length*k*2;f=W(a,n,0,1,1),o=t.plus(f.times(r)),o.cmp(e)!=1;)t=r,r=o,o=u,u=c.plus(f.times(o)),c=o,o=n,n=a.minus(f.times(o)),a=o;return o=W(e.minus(t),r,0,1,1),c=c.plus(o.times(u)),t=t.plus(o.times(r)),c.s=u.s=p.s,m=W(u,r,i,1).minus(p).abs().cmp(W(c,t,i,1).minus(p).abs())<1?[u,r]:[c,t],g.precision=l,B=!0,m};d.toHexadecimal=d.toHex=function(e,n){return tn(this,16,e,n)};d.toNearest=function(e,n){var t=this,r=t.constructor;if(t=new r(t),e==null){if(!t.d)return t;e=new r(1),n=r.rounding}else{if(e=new r(e),n===void 0?n=r.rounding:z(n,0,8),!t.d)return e.s?t:e;if(!e.d)return e.s&&(e.s=t.s),e}return e.d[0]?(B=!1,t=W(t,e,0,n,1).times(e),B=!0,P(t)):(e.s=t.s,t=e),t};d.toNumber=function(){return+this};d.toOctal=function(e,n){return tn(this,8,e,n)};d.toPower=d.pow=function(e){var n,t,r,o,i,s,a=this,c=a.constructor,u=+(e=new c(e));if(!a.d||!e.d||!a.d[0]||!e.d[0])return new c(U(+a,u));if(a=new c(a),a.eq(1))return a;if(r=c.precision,i=c.rounding,e.eq(1))return P(a,r,i);if(n=H(e.e/k),n>=e.d.length-1&&(t=u<0?-u:u)<=gt)return o=In(c,a,t,r),e.s<0?new c(1).div(o):P(o,r,i);if(s=a.s,s<0){if(n<e.d.length-1)return new c(NaN);if((e.d[n]&1)==0&&(s=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=s,a}return t=U(+a,u),n=t==0||!isFinite(t)?H(u*(Math.log("0."+G(a.d))/Math.LN10+a.e+1)):new c(t+"").e,n>c.maxE+1||n<c.minE-1?new c(n>0?s/0:0):(B=!1,c.rounding=a.s=1,t=Math.min(12,(n+"").length),o=en(e.times(ae(a,r+t)),r),o.d&&(o=P(o,r+5,1),Ae(o.d,r,i)&&(n=r+10,o=P(en(e.times(ae(a,n+t)),n),n+5,1),+G(o.d).slice(r+1,r+15)+1==1e14&&(o=P(o,r+1,0)))),o.s=s,B=!0,c.rounding=i,P(o,r,i))};d.toPrecision=function(e,n){var t,r=this,o=r.constructor;return e===void 0?t=ee(r,r.e<=o.toExpNeg||r.e>=o.toExpPos):(z(e,1,ce),n===void 0?n=o.rounding:z(n,0,8),r=P(new o(r),e,n),t=ee(r,e<=r.e||r.e<=o.toExpNeg,e)),r.isNeg()&&!r.isZero()?"-"+t:t};d.toSignificantDigits=d.toSD=function(e,n){var t=this,r=t.constructor;return e===void 0?(e=r.precision,n=r.rounding):(z(e,1,ce),n===void 0?n=r.rounding:z(n,0,8)),P(new r(t),e,n)};d.toString=function(){var e=this,n=e.constructor,t=ee(e,e.e<=n.toExpNeg||e.e>=n.toExpPos);return e.isNeg()&&!e.isZero()?"-"+t:t};d.truncated=d.trunc=function(){return P(new this.constructor(this),this.e+1,1)};d.valueOf=d.toJSON=function(){var e=this,n=e.constructor,t=ee(e,e.e<=n.toExpNeg||e.e>=n.toExpPos);return e.isNeg()?"-"+t:t};function G(e){var n,t,r,o=e.length-1,i="",s=e[0];if(o>0){for(i+=s,n=1;n<o;n++)r=e[n]+"",t=k-r.length,t&&(i+=se(t)),i+=r;s=e[n],r=s+"",t=k-r.length,t&&(i+=se(t))}else if(s===0)return"0";for(;s%10===0;)s/=10;return i+s}function z(e,n,t){if(e!==~~e||e<n||e>t)throw Error(ue+e)}function Ae(e,n,t,r){var o,i,s,a;for(i=e[0];i>=10;i/=10)--n;return--n<0?(n+=k,o=0):(o=Math.ceil((n+1)/k),n%=k),i=U(10,k-n),a=e[o]%i|0,r==null?n<3?(n==0?a=a/100|0:n==1&&(a=a/10|0),s=t<4&&a==99999||t>3&&a==49999||a==5e4||a==0):s=(t<4&&a+1==i||t>3&&a+1==i/2)&&(e[o+1]/i/100|0)==U(10,n-2)-1||(a==i/2||a==0)&&(e[o+1]/i/100|0)==0:n<4?(n==0?a=a/1e3|0:n==1?a=a/100|0:n==2&&(a=a/10|0),s=(r||t<4)&&a==9999||!r&&t>3&&a==4999):s=((r||t<4)&&a+1==i||!r&&t>3&&a+1==i/2)&&(e[o+1]/i/1e3|0)==U(10,n-3)-1,s}function ve(e,n,t){for(var r,o=[0],i,s=0,a=e.length;s<a;){for(i=o.length;i--;)o[i]*=n;for(o[0]+=Xe.indexOf(e.charAt(s++)),r=0;r<o.length;r++)o[r]>t-1&&(o[r+1]===void 0&&(o[r+1]=0),o[r+1]+=o[r]/t|0,o[r]%=t)}return o.reverse()}function wt(e,n){var t,r,o;if(n.isZero())return n;r=n.d.length,r<32?(t=Math.ceil(r/3),o=(1/Ke(4,t)).toString()):(t=16,o="2.3283064365386962890625e-10"),e.precision+=t,n=he(e,1,n.times(o),new e(1));for(var i=t;i--;){var s=n.times(n);n=s.times(s).minus(s).times(8).plus(1)}return e.precision-=t,n}var W=function(){function e(r,o,i){var s,a=0,c=r.length;for(r=r.slice();c--;)s=r[c]*o+a,r[c]=s%i|0,a=s/i|0;return a&&r.unshift(a),r}function n(r,o,i,s){var a,c;if(i!=s)c=i>s?1:-1;else for(a=c=0;a<i;a++)if(r[a]!=o[a]){c=r[a]>o[a]?1:-1;break}return c}function t(r,o,i,s){for(var a=0;i--;)r[i]-=a,a=r[i]<o[i]?1:0,r[i]=a*s+r[i]-o[i];for(;!r[0]&&r.length>1;)r.shift()}return function(r,o,i,s,a,c){var u,l,f,m,p,h,g,w,N,S,x,T,b,y,I,C,M,v,E,D,L=r.constructor,K=r.s==o.s?1:-1,_=r.d,R=o.d;if(!_||!_[0]||!R||!R[0])return new L(!r.s||!o.s||(_?R&&_[0]==R[0]:!R)?NaN:_&&_[0]==0||!R?K*0:K/0);for(c?(p=1,l=r.e-o.e):(c=Q,p=k,l=H(r.e/p)-H(o.e/p)),E=R.length,M=_.length,N=new L(K),S=N.d=[],f=0;R[f]==(_[f]||0);f++);if(R[f]>(_[f]||0)&&l--,i==null?(y=i=L.precision,s=L.rounding):a?y=i+(r.e-o.e)+1:y=i,y<0)S.push(1),h=!0;else{if(y=y/p+2|0,f=0,E==1){for(m=0,R=R[0],y++;(f<M||m)&&y--;f++)I=m*c+(_[f]||0),S[f]=I/R|0,m=I%R|0;h=m||f<M}else{for(m=c/(R[0]+1)|0,m>1&&(R=e(R,m,c),_=e(_,m,c),E=R.length,M=_.length),C=E,x=_.slice(0,E),T=x.length;T<E;)x[T++]=0;D=R.slice(),D.unshift(0),v=R[0],R[1]>=c/2&&++v;do m=0,u=n(R,x,E,T),u<0?(b=x[0],E!=T&&(b=b*c+(x[1]||0)),m=b/v|0,m>1?(m>=c&&(m=c-1),g=e(R,m,c),w=g.length,T=x.length,u=n(g,x,w,T),u==1&&(m--,t(g,E<w?D:R,w,c))):(m==0&&(u=m=1),g=R.slice()),w=g.length,w<T&&g.unshift(0),t(x,g,T,c),u==-1&&(T=x.length,u=n(R,x,E,T),u<1&&(m++,t(x,E<T?D:R,T,c))),T=x.length):u===0&&(m++,x=[0]),S[f++]=m,u&&x[0]?x[T++]=_[C]||0:(x=[_[C]],T=1);while((C++<M||x[0]!==void 0)&&y--);h=x[0]!==void 0}S[0]||S.shift()}if(p==1)N.e=l,Nn=h;else{for(f=1,m=S[0];m>=10;m/=10)f++;N.e=f+l*p-1,P(N,a?i+N.e+1:i,s,h)}return N}}();function P(e,n,t,r){var o,i,s,a,c,u,l,f,m,p=e.constructor;e:if(n!=null){if(f=e.d,!f)return e;for(o=1,a=f[0];a>=10;a/=10)o++;if(i=n-o,i<0)i+=k,s=n,l=f[m=0],c=l/U(10,o-s-1)%10|0;else if(m=Math.ceil((i+1)/k),a=f.length,m>=a)if(r){for(;a++<=m;)f.push(0);l=c=0,o=1,i%=k,s=i-k+1}else break e;else{for(l=a=f[m],o=1;a>=10;a/=10)o++;i%=k,s=i-k+o,c=s<0?0:l/U(10,o-s-1)%10|0}if(r=r||n<0||f[m+1]!==void 0||(s<0?l:l%U(10,o-s-1)),u=t<4?(c||r)&&(t==0||t==(e.s<0?3:2)):c>5||c==5&&(t==4||r||t==6&&(i>0?s>0?l/U(10,o-s):0:f[m-1])%10&1||t==(e.s<0?8:7)),n<1||!f[0])return f.length=0,u?(n-=e.e+1,f[0]=U(10,(k-n%k)%k),e.e=-n||0):f[0]=e.e=0,e;if(i==0?(f.length=m,a=1,m--):(f.length=m+1,a=U(10,k-i),f[m]=s>0?(l/U(10,o-s)%U(10,s)|0)*a:0),u)for(;;)if(m==0){for(i=1,s=f[0];s>=10;s/=10)i++;for(s=f[0]+=a,a=1;s>=10;s/=10)a++;i!=a&&(e.e++,f[0]==Q&&(f[0]=1));break}else{if(f[m]+=a,f[m]!=Q)break;f[m--]=0,a=1}for(i=f.length;f[--i]===0;)f.pop()}return B&&(e.e>p.maxE?(e.d=null,e.e=NaN):e.e<p.minE&&(e.e=0,e.d=[0])),e}function ee(e,n,t){if(!e.isFinite())return Dn(e);var r,o=e.e,i=G(e.d),s=i.length;return n?(t&&(r=t-s)>0?i=i.charAt(0)+"."+i.slice(1)+se(r):s>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(e.e<0?"e":"e+")+e.e):o<0?(i="0."+se(-o-1)+i,t&&(r=t-s)>0&&(i+=se(r))):o>=s?(i+=se(o+1-s),t&&(r=t-o-1)>0&&(i=i+"."+se(r))):((r=o+1)<s&&(i=i.slice(0,r)+"."+i.slice(r)),t&&(r=t-s)>0&&(o+1===s&&(i+="."),i+=se(r))),i}function We(e,n){var t=e[0];for(n*=k;t>=10;t/=10)n++;return n}function Oe(e,n,t){if(n>ht)throw B=!0,t&&(e.precision=t),Error(Sn);return P(new e(Fe),n,1,!0)}function X(e,n,t){if(n>$e)throw Error(Sn);return P(new e(_e),n,t,!0)}function Rn(e){var n=e.length-1,t=n*k+1;if(n=e[n],n){for(;n%10==0;n/=10)t--;for(n=e[0];n>=10;n/=10)t++}return t}function se(e){for(var n="";e--;)n+="0";return n}function In(e,n,t,r){var o,i=new e(1),s=Math.ceil(r/k+4);for(B=!1;;){if(t%2&&(i=i.times(n),Pn(i.d,s)&&(o=!0)),t=H(t/2),t===0){t=i.d.length-1,o&&i.d[t]===0&&++i.d[t];break}n=n.times(n),Pn(n.d,s)}return B=!0,i}function xn(e){return e.d[e.d.length-1]&1}function Mn(e,n,t){for(var r,o=new e(n[0]),i=0;++i<n.length;)if(r=new e(n[i]),r.s)o[t](r)&&(o=r);else{o=r;break}return o}function en(e,n){var t,r,o,i,s,a,c,u=0,l=0,f=0,m=e.constructor,p=m.rounding,h=m.precision;if(!e.d||!e.d[0]||e.e>17)return new m(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:0/0);for(n==null?(B=!1,c=h):c=n,a=new m(.03125);e.e>-2;)e=e.times(a),f+=5;for(r=Math.log(U(2,f))/Math.LN10*2+5|0,c+=r,t=i=s=new m(1),m.precision=c;;){if(i=P(i.times(e),c,1),t=t.times(++l),a=s.plus(W(i,t,c,1)),G(a.d).slice(0,c)===G(s.d).slice(0,c)){for(o=f;o--;)s=P(s.times(s),c,1);if(n==null)if(u<3&&Ae(s.d,c-r,p,u))m.precision=c+=10,t=i=a=new m(1),l=0,u++;else return P(s,m.precision=h,p,B=!0);else return m.precision=h,s}s=a}}function ae(e,n){var t,r,o,i,s,a,c,u,l,f,m,p=1,h=10,g=e,w=g.d,N=g.constructor,S=N.rounding,x=N.precision;if(g.s<0||!w||!w[0]||!g.e&&w[0]==1&&w.length==1)return new N(w&&!w[0]?-1/0:g.s!=1?NaN:w?0:g);if(n==null?(B=!1,l=x):l=n,N.precision=l+=h,t=G(w),r=t.charAt(0),Math.abs(i=g.e)<15e14){for(;r<7&&r!=1||r==1&&t.charAt(1)>3;)g=g.times(e),t=G(g.d),r=t.charAt(0),p++;i=g.e,r>1?(g=new N("0."+t),i++):g=new N(r+"."+t.slice(1))}else return u=Oe(N,l+2,x).times(i+""),g=ae(new N(r+"."+t.slice(1)),l-h).plus(u),N.precision=x,n==null?P(g,x,S,B=!0):g;for(f=g,c=s=g=W(g.minus(1),g.plus(1),l,1),m=P(g.times(g),l,1),o=3;;){if(s=P(s.times(m),l,1),u=c.plus(W(s,new N(o),l,1)),G(u.d).slice(0,l)===G(c.d).slice(0,l))if(c=c.times(2),i!==0&&(c=c.plus(Oe(N,l+2,x).times(i+""))),c=W(c,new N(p),l,1),n==null)if(Ae(c.d,l-h,S,a))N.precision=l+=h,u=s=g=W(f.minus(1),f.plus(1),l,1),m=P(g.times(g),l,1),o=a=1;else return P(c,N.precision=x,S,B=!0);else return N.precision=x,c;c=u,o+=2}}function Dn(e){return String(e.s*e.s/0)}function nn(e,n){var t,r,o;for((t=n.indexOf("."))>-1&&(n=n.replace(".","")),(r=n.search(/e/i))>0?(t<0&&(t=r),t+=+n.slice(r+1),n=n.substring(0,r)):t<0&&(t=n.length),r=0;n.charCodeAt(r)===48;r++);for(o=n.length;n.charCodeAt(o-1)===48;--o);if(n=n.slice(r,o),n){if(o-=r,e.e=t=t-r-1,e.d=[],r=(t+1)%k,t<0&&(r+=k),r<o){for(r&&e.d.push(+n.slice(0,r)),o-=k;r<o;)e.d.push(+n.slice(r,r+=k));n=n.slice(r),r=k-n.length}else r-=o;for(;r--;)n+="0";e.d.push(+n),B&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function Tt(e,n){var t,r,o,i,s,a,c,u,l;if(n.indexOf("_")>-1){if(n=n.replace(/(\d)_(?=\d)/g,"$1"),Bn.test(n))return nn(e,n)}else if(n==="Infinity"||n==="NaN")return+n||(e.s=NaN),e.e=NaN,e.d=null,e;if(dt.test(n))t=16,n=n.toLowerCase();else if(mt.test(n))t=2;else if(pt.test(n))t=8;else throw Error(ue+n);for(i=n.search(/p/i),i>0?(c=+n.slice(i+1),n=n.substring(2,i)):n=n.slice(2),i=n.indexOf("."),s=i>=0,r=e.constructor,s&&(n=n.replace(".",""),a=n.length,i=a-i,o=In(r,new r(t),i,i*2)),u=ve(n,t,Q),l=u.length-1,i=l;u[i]===0;--i)u.pop();return i<0?new r(e.s*0):(e.e=We(u,l),e.d=u,B=!1,s&&(e=W(e,o,a*4)),c&&(e=e.times(Math.abs(c)<54?U(2,c):qe.pow(2,c))),B=!0,e)}function bt(e,n){var t,r=n.d.length;if(r<3)return n.isZero()?n:he(e,2,n,n);t=1.4*Math.sqrt(r),t=t>16?16:t|0,n=n.times(1/Ke(5,t)),n=he(e,2,n,n);for(var o,i=new e(5),s=new e(16),a=new e(20);t--;)o=n.times(n),n=n.times(i.plus(o.times(s.times(o).minus(a))));return n}function he(e,n,t,r,o){var i,s,a,c,u=1,l=e.precision,f=Math.ceil(l/k);for(B=!1,c=t.times(t),a=new e(r);;){if(s=W(a.times(c),new e(n++*n++),l,1),a=o?r.plus(s):r.minus(s),r=W(s.times(c),new e(n++*n++),l,1),s=a.plus(r),s.d[f]!==void 0){for(i=f;s.d[i]===a.d[i]&&i--;);if(i==-1)break}i=a,a=r,r=s,s=i,u++}return B=!0,s.d.length=f+1,s}function Ke(e,n){for(var t=e;--n;)t*=e;return t}function En(e,n){var t,r=n.s<0,o=X(e,e.precision,1),i=o.times(.5);if(n=n.abs(),n.lte(i))return re=r?4:1,n;if(t=n.divToInt(o),t.isZero())re=r?3:2;else{if(n=n.minus(t.times(o)),n.lte(i))return re=xn(t)?r?2:3:r?4:1,n;re=xn(t)?r?1:4:r?3:2}return n.minus(o).abs()}function tn(e,n,t,r){var o,i,s,a,c,u,l,f,m,p=e.constructor,h=t!==void 0;if(h?(z(t,1,ce),r===void 0?r=p.rounding:z(r,0,8)):(t=p.precision,r=p.rounding),!e.isFinite())l=Dn(e);else{for(l=ee(e),s=l.indexOf("."),h?(o=2,n==16?t=t*4-3:n==8&&(t=t*3-2)):o=n,s>=0&&(l=l.replace(".",""),m=new p(1),m.e=l.length-s,m.d=ve(ee(m),10,o),m.e=m.d.length),f=ve(l,10,o),i=c=f.length;f[--c]==0;)f.pop();if(!f[0])l=h?"0p+0":"0";else{if(s<0?i--:(e=new p(e),e.d=f,e.e=i,e=W(e,m,t,r,0,o),f=e.d,i=e.e,u=Nn),s=f[t],a=o/2,u=u||f[t+1]!==void 0,u=r<4?(s!==void 0||u)&&(r===0||r===(e.s<0?3:2)):s>a||s===a&&(r===4||u||r===6&&f[t-1]&1||r===(e.s<0?8:7)),f.length=t,u)for(;++f[--t]>o-1;)f[t]=0,t||(++i,f.unshift(1));for(c=f.length;!f[c-1];--c);for(s=0,l="";s<c;s++)l+=Xe.charAt(f[s]);if(h){if(c>1)if(n==16||n==8){for(s=n==16?4:3,--c;c%s;c++)l+="0";for(f=ve(l,o,n),c=f.length;!f[c-1];--c);for(s=1,l="1.";s<c;s++)l+=Xe.charAt(f[s])}else l=l.charAt(0)+"."+l.slice(1);l=l+(i<0?"p":"p+")+i}else if(i<0){for(;++i;)l="0"+l;l="0."+l}else if(++i>c)for(i-=c;i--;)l+="0";else i<c&&(l=l.slice(0,i)+"."+l.slice(i))}l=(n==16?"0x":n==2?"0b":n==8?"0o":"")+l}return e.s<0?"-"+l:l}function Pn(e,n){if(e.length>n)return e.length=n,!0}function yt(e){return new this(e).abs()}function xt(e){return new this(e).acos()}function Pt(e){return new this(e).acosh()}function At(e,n){return new this(e).plus(n)}function Nt(e){return new this(e).asin()}function St(e){return new this(e).asinh()}function kt(e){return new this(e).atan()}function Ct(e){return new this(e).atanh()}function Bt(e,n){e=new this(e),n=new this(n);var t,r=this.precision,o=this.rounding,i=r+4;return!e.s||!n.s?t=new this(NaN):!e.d&&!n.d?(t=X(this,i,1).times(n.s>0?.25:.75),t.s=e.s):!n.d||e.isZero()?(t=n.s<0?X(this,r,o):new this(0),t.s=e.s):!e.d||n.isZero()?(t=X(this,i,1).times(.5),t.s=e.s):n.s<0?(this.precision=i,this.rounding=1,t=this.atan(W(e,n,i,1)),n=X(this,i,1),this.precision=r,this.rounding=o,t=e.s<0?t.minus(n):t.plus(n)):t=this.atan(W(e,n,i,1)),t}function Rt(e){return new this(e).cbrt()}function It(e){return P(e=new this(e),e.e+1,2)}function Mt(e,n,t){return new this(e).clamp(n,t)}function Dt(e){if(!e||typeof e!="object")throw Error(Ve+"Object expected");var n,t,r,o=e.defaults===!0,i=["precision",1,ce,"rounding",0,8,"toExpNeg",-ge,0,"toExpPos",0,ge,"maxE",0,ge,"minE",-ge,0,"modulo",0,9];for(n=0;n<i.length;n+=3)if(t=i[n],o&&(this[t]=Qe[t]),(r=e[t])!==void 0)if(H(r)===r&&r>=i[n+1]&&r<=i[n+2])this[t]=r;else throw Error(ue+t+": "+r);if(t="crypto",o&&(this[t]=Qe[t]),(r=e[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(kn);else this[t]=!1;else throw Error(ue+t+": "+r);return this}function Et(e){return new this(e).cos()}function Lt(e){return new this(e).cosh()}function Ln(e){var n,t,r;function o(i){var s,a,c,u=this;if(!(u instanceof o))return new o(i);if(u.constructor=o,An(i)){u.s=i.s,B?!i.d||i.e>o.maxE?(u.e=NaN,u.d=null):i.e<o.minE?(u.e=0,u.d=[0]):(u.e=i.e,u.d=i.d.slice()):(u.e=i.e,u.d=i.d?i.d.slice():i.d);return}if(c=typeof i,c==="number"){if(i===0){u.s=1/i<0?-1:1,u.e=0,u.d=[0];return}if(i<0?(i=-i,u.s=-1):u.s=1,i===~~i&&i<1e7){for(s=0,a=i;a>=10;a/=10)s++;B?s>o.maxE?(u.e=NaN,u.d=null):s<o.minE?(u.e=0,u.d=[0]):(u.e=s,u.d=[i]):(u.e=s,u.d=[i]);return}else if(i*0!==0){i||(u.s=NaN),u.e=NaN,u.d=null;return}return nn(u,i.toString())}else if(c!=="string")throw Error(ue+i);return(a=i.charCodeAt(0))===45?(i=i.slice(1),u.s=-1):(a===43&&(i=i.slice(1)),u.s=1),Bn.test(i)?nn(u,i):Tt(u,i)}if(o.prototype=d,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.EUCLID=9,o.config=o.set=Dt,o.clone=Ln,o.isDecimal=An,o.abs=yt,o.acos=xt,o.acosh=Pt,o.add=At,o.asin=Nt,o.asinh=St,o.atan=kt,o.atanh=Ct,o.atan2=Bt,o.cbrt=Rt,o.ceil=It,o.clamp=Mt,o.cos=Et,o.cosh=Lt,o.div=vt,o.exp=Ft,o.floor=_t,o.hypot=Ot,o.ln=Vt,o.log=Wt,o.log10=qt,o.log2=Kt,o.max=Ut,o.min=Gt,o.mod=Ht,o.mul=Zt,o.pow=jt,o.random=zt,o.round=Yt,o.sign=Jt,o.sin=Xt,o.sinh=Qt,o.sqrt=$t,o.sub=er,o.sum=nr,o.tan=tr,o.tanh=rr,o.trunc=ir,e===void 0&&(e={}),e&&e.defaults!==!0)for(r=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],n=0;n<r.length;)e.hasOwnProperty(t=r[n++])||(e[t]=this[t]);return o.config(e),o}function vt(e,n){return new this(e).div(n)}function Ft(e){return new this(e).exp()}function _t(e){return P(e=new this(e),e.e+1,3)}function Ot(){var e,n,t=new this(0);for(B=!1,e=0;e<arguments.length;)if(n=new this(arguments[e++]),n.d)t.d&&(t=t.plus(n.times(n)));else{if(n.s)return B=!0,new this(1/0);t=n}return B=!0,t.sqrt()}function An(e){return e instanceof qe||e&&e.toStringTag===Cn||!1}function Vt(e){return new this(e).ln()}function Wt(e,n){return new this(e).log(n)}function Kt(e){return new this(e).log(2)}function qt(e){return new this(e).log(10)}function Ut(){return Mn(this,arguments,"lt")}function Gt(){return Mn(this,arguments,"gt")}function Ht(e,n){return new this(e).mod(n)}function Zt(e,n){return new this(e).mul(n)}function jt(e,n){return new this(e).pow(n)}function zt(e){var n,t,r,o,i=0,s=new this(1),a=[];if(e===void 0?e=this.precision:z(e,1,ce),r=Math.ceil(e/k),this.crypto)if(crypto.getRandomValues)for(n=crypto.getRandomValues(new Uint32Array(r));i<r;)o=n[i],o>=429e7?n[i]=crypto.getRandomValues(new Uint32Array(1))[0]:a[i++]=o%1e7;else if(crypto.randomBytes){for(n=crypto.randomBytes(r*=4);i<r;)o=n[i]+(n[i+1]<<8)+(n[i+2]<<16)+((n[i+3]&127)<<24),o>=214e7?crypto.randomBytes(4).copy(n,i):(a.push(o%1e7),i+=4);i=r/4}else throw Error(kn);else for(;i<r;)a[i++]=Math.random()*1e7|0;for(r=a[--i],e%=k,r&&e&&(o=U(10,k-e),a[i]=(r/o|0)*o);a[i]===0;i--)a.pop();if(i<0)t=0,a=[0];else{for(t=-1;a[0]===0;t-=k)a.shift();for(r=1,o=a[0];o>=10;o/=10)r++;r<k&&(t-=k-r)}return s.e=t,s.d=a,s}function Yt(e){return P(e=new this(e),e.e+1,this.rounding)}function Jt(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function Xt(e){return new this(e).sin()}function Qt(e){return new this(e).sinh()}function $t(e){return new this(e).sqrt()}function er(e,n){return new this(e).sub(n)}function nr(){var e=0,n=arguments,t=new this(n[e]);for(B=!1;t.s&&++e<n.length;)t=t.plus(n[e]);return B=!0,P(t,this.precision,this.rounding)}function tr(e){return new this(e).tan()}function rr(e){return new this(e).tanh()}function ir(e){return P(e=new this(e),e.e+1,1)}d[Symbol.for("nodejs.util.inspect.custom")]=d.toString;d[Symbol.toStringTag]="Decimal";var qe=d.constructor=Ln(Qe);Fe=new qe(Fe);_e=new qe(_e);var Wn=Y(require("big.js")),lr=Y(require("bn.js"));var Ne=require("lodash");var rn=class{constructor(n){this.logLevel=n.logLevel!==void 0?n.logLevel:0,this.name=n.name}set level(n){this.logLevel=n}get time(){return Date.now().toString()}get moduleName(){return this.name}isLogLevel(n){return n<=this.logLevel}error(...n){return this.isLogLevel(0)?(console.error(this.time,this.name,"sdk logger error",...n),this):this}logWithError(...n){let t=n.map(r=>typeof r=="object"?JSON.stringify(r):r).join(", ");throw new Error(t)}warning(...n){return this.isLogLevel(1)?(console.warn(this.time,this.name,"sdk logger warning",...n),this):this}info(...n){return this.isLogLevel(2)?(console.info(this.time,this.name,"sdk logger info",...n),this):this}debug(...n){return this.isLogLevel(3)?(console.debug(this.time,this.name,"sdk logger debug",...n),this):this}},vn={},or={};function J(e){let n=(0,Ne.get)(vn,e);if(!n){let t=(0,Ne.get)(or,e);n=new rn({name:e,logLevel:t}),(0,Ne.set)(vn,e,n)}return n}var Fn=Y(require("toformat")),sr=Fn.default,Se=sr;var ke=Y(require("big.js")),On=Y(require("bn.js")),Vn=Y(require("decimal.js-light"));var we=Y(require("bn.js"));var _n=9007199254740991;function ie(e){let n=J("Raydium_parseBigNumberish");if(e instanceof we.default)return e;if(typeof e=="string"){if(e.match(/^-?[0-9]+$/))return new we.default(e);n.logWithError(`invalid BigNumberish string: ${e}`)}return typeof e=="number"?(e%1&&n.logWithError(`BigNumberish number underflow: ${e}`),(e>=_n||e<=-_n)&&n.logWithError(`BigNumberish number overflow: ${e}`),new we.default(String(e))):typeof e=="bigint"?new we.default(e.toString()):(n.error(`invalid BigNumberish value: ${e}`),new we.default(0))}var Ue=J("module/fraction"),on=Se(ke.default),Ce=Se(Vn.default),ur={[0]:Ce.ROUND_DOWN,[1]:Ce.ROUND_HALF_UP,[2]:Ce.ROUND_UP},cr={[0]:ke.default.roundDown,[1]:ke.default.roundHalfUp,[2]:ke.default.roundUp},q=class{constructor(n,t=new On.default(1)){this.numerator=ie(n),this.denominator=ie(t)}get quotient(){return this.numerator.div(this.denominator)}invert(){return new q(this.denominator,this.numerator)}add(n){let t=n instanceof q?n:new q(ie(n));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(n){let t=n instanceof q?n:new q(ie(n));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(n){let t=n instanceof q?n:new q(ie(n));return new q(this.numerator.mul(t.numerator),this.denominator.mul(t.denominator))}div(n){let t=n instanceof q?n:new q(ie(n));return new q(this.numerator.mul(t.denominator),this.denominator.mul(t.numerator))}toSignificant(n,t={groupSeparator:""},r=1){Number.isInteger(n)||Ue.logWithError(`${n} is not an integer.`),n<=0&&Ue.logWithError(`${n} is not positive.`),Ce.set({precision:n+1,rounding:ur[r]});let o=new Ce(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(n);return o.toFormat(o.decimalPlaces(),t)}toFixed(n,t={groupSeparator:""},r=1){return Number.isInteger(n)||Ue.logWithError(`${n} is not an integer.`),n<0&&Ue.logWithError(`${n} is negative.`),on.DP=n,on.RM=cr[r]||1,new on(this.numerator.toString()).div(this.denominator.toString()).toFormat(n,t)}isZero(){return this.numerator.isZero()}};var Kr=J("Raydium_amount"),qr=Se(Wn.default);var Kn=require("@solana/web3.js"),sn=require("@solana/spl-token"),qn={chainId:101,address:Kn.PublicKey.default.toBase58(),programId:sn.TOKEN_PROGRAM_ID.toBase58(),decimals:9,symbol:"SOL",name:"solana",logoURI:"https://img-v1.raydium.io/icon/So11111111111111111111111111111111111111112.png",tags:[],priority:2,type:"raydium",extensions:{coingeckoId:"solana"}},me={chainId:101,address:"So11111111111111111111111111111111111111112",programId:sn.TOKEN_PROGRAM_ID.toBase58(),decimals:9,symbol:"WSOL",name:"Wrapped SOL",logoURI:"https://img-v1.raydium.io/icon/So11111111111111111111111111111111111111112.png",tags:[],priority:2,type:"raydium",extensions:{coingeckoId:"solana"}};var Ge=require("@solana/web3.js");var O=require("@solana/web3.js"),Un=require("@solana/spl-token");function an({pubkey:e,isSigner:n=!1,isWritable:t=!0}){return{pubkey:e,isWritable:t,isSigner:n}}var Zr=[an({pubkey:Un.TOKEN_PROGRAM_ID,isWritable:!1}),an({pubkey:O.SystemProgram.programId,isWritable:!1}),an({pubkey:O.SYSVAR_RENT_PUBKEY,isWritable:!1})];function Gn({publicKey:e,transformSol:n}){let t=Hn(e.toString());if(t instanceof O.PublicKey)return n&&t.equals(Be)?un:t;if(n&&t.toString()===Be.toBase58())return un;if(typeof t=="string"){if(t===O.PublicKey.default.toBase58())return O.PublicKey.default;try{return new O.PublicKey(t)}catch{throw new Error("invalid public key")}}throw new Error("invalid public key")}function Hn(e){try{return new O.PublicKey(e)}catch{return e}}var jr=new O.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),zr=new O.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),Yr=new O.PublicKey("SysvarRent111111111111111111111111111111111"),Jr=new O.PublicKey("SysvarC1ock11111111111111111111111111111111"),Xr=new O.PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),Qr=new O.PublicKey("Sysvar1nstructions1111111111111111111111111"),$r=O.SystemProgram.programId,ei=new O.PublicKey("4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R"),ni=new O.PublicKey("Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS"),ti=new O.PublicKey("SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt"),ri=new O.PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),ii=new O.PublicKey("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"),oi=new O.PublicKey("mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So"),si=new O.PublicKey("7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj"),ai=new O.PublicKey("USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX"),ui=new O.PublicKey("NRVwhjBQiUPYtfDT5zRBVJajzFQHaBUNtC7SNVvqRFa"),ci=new O.PublicKey("ANAxByE6G2WjFp7A4NqtWYXb3mgruyzZYg3spfxe6Lbo"),li=new O.PublicKey("7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs"),un=new O.PublicKey("So11111111111111111111111111111111111111112"),Be=O.PublicKey.default;var cn=class{constructor({mint:n,decimals:t,symbol:r,name:o,skipMint:i=!1,isToken2022:s=!1}){if(n===Be.toBase58()||n instanceof Ge.PublicKey&&Be.equals(n)){this.decimals=me.decimals,this.symbol=me.symbol,this.name=me.name,this.mint=new Ge.PublicKey(me.address),this.isToken2022=!1;return}this.decimals=t,this.symbol=r||n.toString().substring(0,6),this.name=o||n.toString().substring(0,6),this.mint=i?Ge.PublicKey.default:Gn({publicKey:n}),this.isToken2022=s}equals(n){return this===n?!0:this.mint.equals(n.mint)}},Te=cn;Te.WSOL=new cn(oe(j({},me),{mint:me.address}));var ln=class{constructor({decimals:n,symbol:t="UNKNOWN",name:r="UNKNOWN"}){this.decimals=n,this.symbol=t,this.name=r}equals(n){return this===n}},He=ln;He.SOL=new ln(qn);var Zn=Y(require("bn.js"));var yi=new q(new Zn.default(100));var ki=J("Raydium_price");var mr=new ne.default(0),eo=new ne.default(1),no=new ne.default(2),to=new ne.default(3),ro=new ne.default(5),fr=new ne.default(10),io=new ne.default(100),oo=new ne.default(1e3),so=new ne.default(1e4);function fn(e,n=1,t=[]){let r=[...e];if(n<=0)return t;for(;r.length;)t.push(r.splice(0,n));return t}var hr=require("@solana/web3.js"),wr=require("@solana/spl-token");var Z=require("@solana/web3.js");var Re={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",FarmV4Withdraw:"FarmV4Withdraw",FarmV5Deposit:"FarmV5Deposit",FarmV5Withdraw:"FarmV5Withdraw",FarmV5CreateLedger:"FarmV5CreateLedger",FarmV6Deposit:"FarmV6Deposit",FarmV6Withdraw:"FarmV6Withdraw",FarmV6Create:"FarmV6Create",FarmV6Restart:"FarmV6Restart",FarmV6CreatorAddReward:"FarmV6CreatorAddReward",FarmV6CreatorWithdraw:"FarmV6CreatorWithdraw",CpmmCreatePool:"CpmmCreatePool",CpmmAddLiquidity:"CpmmAddLiquidity",CpmmWithdrawLiquidity:"CpmmWithdrawLiquidity",CpmmSwapBaseIn:"CpmmSwapBaseIn",CpmmSwapBaseOut:"CpmmSwapBaseOut",CpmmLockLp:"CpmmLockLp",CpmmCollectLockFee:"CpmmCollectLockFee",TransferTip:"TransferTip"};var Xn=require("@solana/spl-token"),Jn=J("Raydium_txUtil"),Qn=1644;function Ze(e){let n=[],t=[];return e.microLamports&&(n.push(Z.ComputeBudgetProgram.setComputeUnitPrice({microLamports:e.microLamports})),t.push(Re.SetComputeUnitPrice)),e.units&&(n.push(Z.ComputeBudgetProgram.setComputeUnitLimit({units:e.units})),t.push(Re.SetComputeUnitLimit)),{instructions:n,instructionTypes:t}}async function be(e,n){var r,o;let t=n!=null?n:"confirmed";return(o=await((r=e.getLatestBlockhash)==null?void 0:r.call(e,{commitment:t})))==null?void 0:o.blockhash}async function je(e,n){return e.getSignatureStatuses([n]),new Promise((t,r)=>{let o=setTimeout(r,6e4);e.onSignature(n,i=>{if(clearTimeout(o),!i.err){t("");return}r(Object.assign(i.err,{txId:n}))},"confirmed")})}function dr(e,n){e.length<1&&Jn.logWithError(`no instructions provided: ${e.toString()}`),n.length<1&&Jn.logWithError(`no signers provided:, ${n.toString()}`);let t=new Z.Transaction;t.recentBlockhash="11111111111111111111111111111111",t.feePayer=n[0],t.add(...e);try{return Buffer.from(t.serialize({verifySignatures:!1})).toString("base64").length<Qn}catch{return!1}}function Ie({instructions:e,payer:n,signers:t}){return dr(e,[n,...t])}function Me({instructions:e,payer:n,lookupTableAddressAccount:t,recentBlockhash:r=Z.Keypair.generate().publicKey.toString()}){let i=new Z.TransactionMessage({payerKey:n,recentBlockhash:r,instructions:e}).compileToV0Message(Object.values(t!=null?t:{}));try{return Buffer.from(new Z.VersionedTransaction(i).serialize()).toString("base64").length<Qn}catch{return!1}}var pr=e=>Buffer.isBuffer(e)?e:e instanceof Uint8Array?Buffer.from(e.buffer,e.byteOffset,e.byteLength):Buffer.from(e),gr=e=>{let n=e.serialize({requireAllSignatures:!1,verifySignatures:!1});e instanceof Z.VersionedTransaction&&(n=pr(n));try{return n instanceof Buffer?n.toString("base64"):Buffer.from(n).toString("base64")}catch{return n.toString("base64")}};function de(e){let n=[];return e.forEach(t=>{t instanceof Z.Transaction&&(t.recentBlockhash||(t.recentBlockhash=Xn.TOKEN_PROGRAM_ID.toBase58()),t.feePayer||(t.feePayer=Z.Keypair.generate().publicKey)),n.push(gr(t))}),console.log("simulate tx string:",n),n}var A=require("@solana/web3.js"),No=new A.PublicKey("EhhTKczWMGQt46ynNeRX1WfeagwwJd7ufHvCDjRxjo5Q"),So=new A.PublicKey("CBuCnLe26faBpcBP2fktp4rp8abpcAnTWft6ZrP5Q4T"),ko=new A.PublicKey("9KEPoZmtHUrBbhWN1v1KWLMkkvwY6WLtAVUCPRtRjP4z"),Co=new A.PublicKey("FarmqiPv5eAj3j1GMdMCMUGXqPUvmquZtMy86QH6rzhG"),Bo=new A.PublicKey("CLaimxFqjHzgTJtAGHU47NPhg6qrc5sCnpC4tBLyABQS"),Ro=new A.PublicKey("srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX"),Io=new A.PublicKey("9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin"),Mo=new A.PublicKey("675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8"),Do=new A.PublicKey("5quBtoiQqxF9Jv6KYKctB59NT3gtJD2Y65kdnB1Uev3h"),Eo=new A.PublicKey("CDSr3ssLcRB6XYPJwAfFt18MZvEZp4LjHcvzBVZ45duo"),Lo=new A.PublicKey("CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK"),vo=new A.PublicKey("LockrWmn6K5twhz3y9w1dQERbmgSaRkfnTeTKbpofwE"),Fo=new A.PublicKey("kN1kEznaF5Xbd8LYuqtEFcxzWSBk5Fv6ygX6SqEGJVy"),_o=new A.PublicKey("CDSr3ssLcRB6XYPJwAfFt18MZvEZp4LjHcvzBVZ45duo"),Oo=new A.PublicKey("routeUGWgWzqBWFcrCfv8tritsqukccJPu3q5GPP3xS"),Vo=new A.PublicKey("7YttLkHDoNj9wyDur5pM1ejNaAvT9X4eqaYcHQqtj2G5"),Wo=new A.PublicKey("6FJon3QE27qgPVggARueB22hLvoh22VzJpXv4rBEoSLF"),Ko=new A.PublicKey("CC12se5To1CdEuw7fDS27B7Geo5jJyL7t5UK2B44NgiH"),qo=new A.PublicKey("9HzJyW1qZsEiSfMUf6L2jo3CcTKAyBmSyKdwQeYisHrC"),Uo=new A.PublicKey("DropEU8AvevN3UrXWXTMuz3rqnMczQVNjq3kcSdW2SQi"),Go=new A.PublicKey("CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C"),Ho=new A.PublicKey("GpMZbSM2GgvTKHJirzeGfMFoaZ8UR2X7F4v8vHTvxFbL"),Zo=new A.PublicKey("DNXgeM9EiiaAbaWvwjHj9fQQLAX5ZsfHyvmYUNRAdNC8"),jo=new A.PublicKey("LockrWmn6K5twhz3y9w1dQERbmgSaRkfnTeTKbpofwE"),zo=new A.PublicKey("3f7GcQFG397GAaEnv51zR6tsTVihYRydnydDD1cXekxH"),Yo=new A.PublicKey("LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj"),Jo=new A.PublicKey("WLHv2UAZm6z4KyaaELi5pjdbJh6RESMva1Rnn8pJVVh"),Xo=new A.PublicKey("DRay6fNdQ5J82H7xV6uq2aV3mNrUZ1J4PgSKsWgptcm6"),Qo=new A.PublicKey("5xqNaZXX5eUi4p5HU4oz9i5QnwRNT2y6oN7yyn4qENeq"),$o=new A.PublicKey("4Bu96XjU84XjPDSpveTVf6LYGCkfW5FK7SNkREWcEfV4"),es=new A.PublicKey("6s1xP3hpbAfFoNtUNF8mfHsjr2Bd97JxFJRWLbL6aHuX");var ns={OPEN_BOOK_PROGRAM:new A.PublicKey("EoTcMgcDRTJVZDMZWBoU6rhYHZfkNTVEAfz3uUJRcYGj"),SERUM_PROGRAM_ID_V3:new A.PublicKey("Ray1111111111111111111111111111111111111111"),AMM_V4:new A.PublicKey("DRaya7Kj3aMWQSy19kSjvmuwq9docCHofyP9kanQGaav"),AMM_STABLE:new A.PublicKey("DRayDdXc1NZQ9C3hRWmoSf8zK4iapgMnjdNZWrfwsP8m"),CLMM_PROGRAM_ID:new A.PublicKey("DRayAUgENGQBKVaX8owNhgzkEDyoHTGVEGHVJT1E9pfH"),CLMM_LOCK_PROGRAM_ID:new A.PublicKey("DRay25Usp3YJAi7beckgpGUC7mGJ2cR1AVPxhYfwVCUX"),CLMM_LOCK_AUTH_ID:new A.PublicKey("6Aoh8h2Lw2m5UGxYR8AdAL87jTWYeKoxM52mJRzfYwN"),CREATE_CPMM_POOL_PROGRAM:new A.PublicKey("DRaycpLY18LhpbydsBWbVJtxpNv9oXPgjRSfpF2bWpYb"),CREATE_CPMM_POOL_AUTH:new A.PublicKey("CXniRufdq5xL8t8jZAPxsPZDpuudwuJSPWnbcD5Y5Nxq"),CREATE_CPMM_POOL_FEE_ACC:new A.PublicKey("3oE58BKVt8KuYkGxx8zBojugnymWmBiyafWgMrnb6eYy"),LOCK_CPMM_PROGRAM:new A.PublicKey("DRay25Usp3YJAi7beckgpGUC7mGJ2cR1AVPxhYfwVCUX"),LOCK_CPMM_AUTH:new A.PublicKey("7qWVV8UY2bRJfDLP4s37YzBPKUkVB46DStYJBpYbQzu3"),UTIL1216:A.PublicKey.default,Router:new A.PublicKey("DRaybByLpbUL57LJARs3j8BitTxVfzBg351EaMr5UTCd"),FARM_PROGRAM_ID_V3:new A.PublicKey("DRayWyrLmEW5KEeqs8kdTMMaBabapqagaBC7KWpGtJeZ"),FARM_PROGRAM_ID_V4:new A.PublicKey("Ray1111111111111111111111111111111111111111"),FARM_PROGRAM_ID_V5:new A.PublicKey("DRayiCGSZgku1GTK6rXD6mVDdingXy6APAH1R6R5L2LC"),FARM_PROGRAM_ID_V6:new A.PublicKey("DRayzbYakXs45ELHkzH6vC3fuhQqTAnv5A68gdFuvZyZ"),LAUNCHPAD_PROGRAM:new A.PublicKey("DRay6fNdQ5J82H7xV6uq2aV3mNrUZ1J4PgSKsWgptcm6"),LAUNCHPAD_AUTH:new A.PublicKey("5xqNaZXX5eUi4p5HU4oz9i5QnwRNT2y6oN7yyn4qENeq"),LAUNCHPAD_PLATFORM:new A.PublicKey("2Jx4KTDrVSdWNazuGpcA8n3ZLTRGGBDxAWhuKe2Xcj2a"),LAUNCHPAD_CONFIG:new A.PublicKey("7ZR4zD7PYfY2XxoG1Gxcy2EgEeGYrpxrwzPuwdUBssEt"),FEE_DESTINATION_ID:new A.PublicKey("9y8ENuuZ3b19quffx9hQvRVygG5ky6snHfRvGpuSfeJy"),MODEL_DATA_PUBKEY:new A.PublicKey("Ray1111111111111111111111111111111111111111")};var Tr=Y(require("bn.js"));var br=require("@solana/web3.js"),yr=Y(require("bn.js"));var $n=Y(require("bn.js")),as=new $n.default(1e6);var ze=require("@solana/spl-token"),mn=J("Raydium_accountInfo_util");async function nt(e,n,t){let{batchRequest:r,commitment:o="confirmed",chunkCount:i=100}=j({batchRequest:!1},t),s=fn(n,i),a=new Array(s.length).fill([]);if(r){let c=s.map(f=>{let m=e._buildArgs([f.map(p=>p.toBase58())],o,"base64");return{methodName:"getMultipleAccounts",args:m}}),u=fn(c,10);a=(await(await Promise.all(u.map(async f=>await e._rpcBatchRequest(f)))).flat()).map(f=>(f.error&&mn.logWithError(`failed to get info for multiple accounts, RPC_ERROR, ${f.error.message}`),f.result.value.map(m=>{if(m){let{data:p,executable:h,lamports:g,owner:w,rentEpoch:N}=m;return p.length!==2&&p[1]!=="base64"&&mn.logWithError("info must be base64 encoded, RPC_ERROR"),{data:Buffer.from(p[0],"base64"),executable:h,lamports:g,owner:new et.PublicKey(w),rentEpoch:N}}return null})))}else try{a=await Promise.all(s.map(c=>e.