test-raydium-sdk-v2
Version:
An SDK for building applications on top of Raydium.
1 lines • 266 kB
JavaScript
var wa=Object.create;var Kn=Object.defineProperty,ka=Object.defineProperties,ha=Object.getOwnPropertyDescriptor,Aa=Object.getOwnPropertyDescriptors,Pa=Object.getOwnPropertyNames,ur=Object.getOwnPropertySymbols,Ta=Object.getPrototypeOf,Qr=Object.prototype.hasOwnProperty,fo=Object.prototype.propertyIsEnumerable;var po=(i,e,t)=>e in i?Kn(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,N=(i,e)=>{for(var t in e||(e={}))Qr.call(e,t)&&po(i,t,e[t]);if(ur)for(var t of ur(e))fo.call(e,t)&&po(i,t,e[t]);return i},q=(i,e)=>ka(i,Aa(e));var Fe=(i,e)=>{var t={};for(var n in i)Qr.call(i,n)&&e.indexOf(n)<0&&(t[n]=i[n]);if(i!=null&&ur)for(var n of ur(i))e.indexOf(n)<0&&fo.call(i,n)&&(t[n]=i[n]);return t};var Ia=(i,e)=>{for(var t in e)Kn(i,t,{get:e[t],enumerable:!0})},yo=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Pa(e))!Qr.call(i,r)&&r!==t&&Kn(i,r,{get:()=>e[r],enumerable:!(n=ha(e,r))||n.enumerable});return i};var oe=(i,e,t)=>(t=i!=null?wa(Ta(i)):{},yo(e||!i||!i.__esModule?Kn(t,"default",{value:i,enumerable:!0}):t,i)),xa=i=>yo(Kn({},"__esModule",{value:!0}),i);var Lc={};Ia(Lc,{Raydium:()=>sr});module.exports=xa(Lc);var ga=require("lodash");var is=oe(require("axios"));var Cn=require("lodash"),Hr=oe(require("dayjs")),go=oe(require("dayjs/plugin/utc"));Hr.default.extend(go.default);var jr=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(0,Hr.default)().utc().format("YYYY/MM/DD HH:mm:ss UTC")}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}},bo={},Ba={};function ae(i){let e=(0,Cn.get)(bo,i);if(!e){let t=(0,Cn.get)(Ba,i);e=new jr({name:i,logLevel:t}),(0,Cn.set)(bo,i,e)}return e}var Xo=require("@solana/web3.js"),zo=oe(require("bn.js"));var Go=oe(require("big.js")),Mn=oe(require("bn.js"));var Re=oe(require("bn.js"));var un=9e15,Ft=1e9,Zr="0123456789abcdef",lr="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",mr="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Jr={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-un,maxE:un,crypto:!1},Ao,Ct,Z=!0,pr="[DecimalError] ",Et=pr+"Invalid argument: ",Po=pr+"Precision limit exceeded",To=pr+"crypto unavailable",Io="[object Decimal]",ve=Math.floor,Le=Math.pow,Sa=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Ka=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Ca=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,xo=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ct=1e7,Q=7,La=9007199254740991,Ra=lr.length-1,$r=mr.length-1,B={toStringTag:Io};B.absoluteValue=B.abs=function(){var i=new this.constructor(this);return i.s<0&&(i.s=1),U(i)};B.ceil=function(){return U(new this.constructor(this),this.e+1,2)};B.clampedTo=B.clamp=function(i,e){var t,n=this,r=n.constructor;if(i=new r(i),e=new r(e),!i.s||!e.s)return new r(NaN);if(i.gt(e))throw Error(Et+e);return t=n.cmp(i),t<0?i:n.cmp(e)>0?e:new r(n)};B.comparedTo=B.cmp=function(i){var e,t,n,r,o=this,s=o.d,a=(i=new o.constructor(i)).d,u=o.s,c=i.s;if(!s||!a)return!u||!c?NaN:u!==c?u:s===a?0:!s^u<0?1:-1;if(!s[0]||!a[0])return s[0]?u:a[0]?-c:0;if(u!==c)return u;if(o.e!==i.e)return o.e>i.e^u<0?1:-1;for(n=s.length,r=a.length,e=0,t=n<r?n:r;e<t;++e)if(s[e]!==a[e])return s[e]>a[e]^u<0?1:-1;return n===r?0:n>r^u<0?1:-1};B.cosine=B.cos=function(){var i,e,t=this,n=t.constructor;return t.d?t.d[0]?(i=n.precision,e=n.rounding,n.precision=i+Math.max(t.e,t.sd())+Q,n.rounding=1,t=Oa(n,Lo(n,t)),n.precision=i,n.rounding=e,U(Ct==2||Ct==3?t.neg():t,i,e,!0)):new n(1):new n(NaN)};B.cubeRoot=B.cbrt=function(){var i,e,t,n,r,o,s,a,u,c,l=this,m=l.constructor;if(!l.isFinite()||l.isZero())return new m(l);for(Z=!1,o=l.s*Le(l.s*l,1/3),!o||Math.abs(o)==1/0?(t=_e(l.d),i=l.e,(o=(i-t.length+1)%3)&&(t+=o==1||o==-2?"0":"00"),o=Le(t,1/3),i=ve((i+1)/3)-(i%3==(i<0?-1:2)),o==1/0?t="5e"+i:(t=o.toExponential(),t=t.slice(0,t.indexOf("e")+1)+i),n=new m(t),n.s=l.s):n=new m(o.toString()),s=(i=m.precision)+3;;)if(a=n,u=a.times(a).times(a),c=u.plus(l),n=ge(c.plus(l).times(a),c.plus(u),s+2,1),_e(a.d).slice(0,s)===(t=_e(n.d)).slice(0,s))if(t=t.slice(s-3,s+1),t=="9999"||!r&&t=="4999"){if(!r&&(U(a,i+1,0),a.times(a).times(a).eq(l))){n=a;break}s+=4,r=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(U(n,i+1,1),e=!n.times(n).times(n).eq(l));break}return Z=!0,U(n,i,m.rounding,e)};B.decimalPlaces=B.dp=function(){var i,e=this.d,t=NaN;if(e){if(i=e.length-1,t=(i-ve(this.e/Q))*Q,i=e[i],i)for(;i%10==0;i/=10)t--;t<0&&(t=0)}return t};B.dividedBy=B.div=function(i){return ge(this,new this.constructor(i))};B.dividedToIntegerBy=B.divToInt=function(i){var e=this,t=e.constructor;return U(ge(e,new t(i),0,1,1),t.precision,t.rounding)};B.equals=B.eq=function(i){return this.cmp(i)===0};B.floor=function(){return U(new this.constructor(this),this.e+1,3)};B.greaterThan=B.gt=function(i){return this.cmp(i)>0};B.greaterThanOrEqualTo=B.gte=function(i){var e=this.cmp(i);return e==1||e===0};B.hyperbolicCosine=B.cosh=function(){var i,e,t,n,r,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,r=o.d.length,r<32?(i=Math.ceil(r/3),e=(1/yr(4,i)).toString()):(i=16,e="2.3283064365386962890625e-10"),o=cn(s,1,o.times(e),new s(1),!0);for(var u,c=i,l=new s(8);c--;)u=o.times(o),o=a.minus(u.times(l.minus(u.times(l))));return U(o,s.precision=t,s.rounding=n,!0)};B.hyperbolicSine=B.sinh=function(){var i,e,t,n,r=this,o=r.constructor;if(!r.isFinite()||r.isZero())return new o(r);if(e=o.precision,t=o.rounding,o.precision=e+Math.max(r.e,r.sd())+4,o.rounding=1,n=r.d.length,n<3)r=cn(o,2,r,r,!0);else{i=1.4*Math.sqrt(n),i=i>16?16:i|0,r=r.times(1/yr(5,i)),r=cn(o,2,r,r,!0);for(var s,a=new o(5),u=new o(16),c=new o(20);i--;)s=r.times(r),r=r.times(a.plus(s.times(u.times(s).plus(c))))}return o.precision=e,o.rounding=t,U(r,e,t,!0)};B.hyperbolicTangent=B.tanh=function(){var i,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(i=n.precision,e=n.rounding,n.precision=i+7,n.rounding=1,ge(t.sinh(),t.cosh(),n.precision=i,n.rounding=e)):new n(t.s)};B.inverseCosine=B.acos=function(){var i,e=this,t=e.constructor,n=e.abs().cmp(1),r=t.precision,o=t.rounding;return n!==-1?n===0?e.isNeg()?ut(t,r,o):new t(0):new t(NaN):e.isZero()?ut(t,r+4,o).times(.5):(t.precision=r+6,t.rounding=1,e=e.asin(),i=ut(t,r+4,o).times(.5),t.precision=r,t.rounding=o,i.minus(e))};B.inverseHyperbolicCosine=B.acosh=function(){var i,e,t=this,n=t.constructor;return t.lte(1)?new n(t.eq(1)?0:NaN):t.isFinite()?(i=n.precision,e=n.rounding,n.precision=i+Math.max(Math.abs(t.e),t.sd())+4,n.rounding=1,Z=!1,t=t.times(t).minus(1).sqrt().plus(t),Z=!0,n.precision=i,n.rounding=e,t.ln()):new n(t)};B.inverseHyperbolicSine=B.asinh=function(){var i,e,t=this,n=t.constructor;return!t.isFinite()||t.isZero()?new n(t):(i=n.precision,e=n.rounding,n.precision=i+2*Math.max(Math.abs(t.e),t.sd())+6,n.rounding=1,Z=!1,t=t.times(t).plus(1).sqrt().plus(t),Z=!0,n.precision=i,n.rounding=e,t.ln())};B.inverseHyperbolicTangent=B.atanh=function(){var i,e,t,n,r=this,o=r.constructor;return r.isFinite()?r.e>=0?new o(r.abs().eq(1)?r.s/0:r.isZero()?r:NaN):(i=o.precision,e=o.rounding,n=r.sd(),Math.max(n,i)<2*-r.e-1?U(new o(r),i,e,!0):(o.precision=t=n-r.e,r=ge(r.plus(1),new o(1).minus(r),t+i,1),o.precision=i+4,o.rounding=1,r=r.ln(),o.precision=i,o.rounding=e,r.times(.5))):new o(NaN)};B.inverseSine=B.asin=function(){var i,e,t,n,r=this,o=r.constructor;return r.isZero()?new o(r):(e=r.abs().cmp(1),t=o.precision,n=o.rounding,e!==-1?e===0?(i=ut(o,t+4,n).times(.5),i.s=r.s,i):new o(NaN):(o.precision=t+6,o.rounding=1,r=r.div(new o(1).minus(r.times(r)).sqrt().plus(1)).atan(),o.precision=t,o.rounding=n,r.times(2)))};B.inverseTangent=B.atan=function(){var i,e,t,n,r,o,s,a,u,c=this,l=c.constructor,m=l.precision,d=l.rounding;if(c.isFinite()){if(c.isZero())return new l(c);if(c.abs().eq(1)&&m+4<=$r)return s=ut(l,m+4,d).times(.25),s.s=c.s,s}else{if(!c.s)return new l(NaN);if(m+4<=$r)return s=ut(l,m+4,d).times(.5),s.s=c.s,s}for(l.precision=a=m+10,l.rounding=1,t=Math.min(28,a/Q+2|0),i=t;i;--i)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(Z=!1,e=Math.ceil(a/Q),n=1,u=c.times(c),s=new l(c),r=c;i!==-1;)if(r=r.times(u),o=s.minus(r.div(n+=2)),r=r.times(u),s=o.plus(r.div(n+=2)),s.d[e]!==void 0)for(i=e;s.d[i]===o.d[i]&&i--;);return t&&(s=s.times(2<<t-1)),Z=!0,U(s,l.precision=m,l.rounding=d,!0)};B.isFinite=function(){return!!this.d};B.isInteger=B.isInt=function(){return!!this.d&&ve(this.e/Q)>this.d.length-2};B.isNaN=function(){return!this.s};B.isNegative=B.isNeg=function(){return this.s<0};B.isPositive=B.isPos=function(){return this.s>0};B.isZero=function(){return!!this.d&&this.d[0]===0};B.lessThan=B.lt=function(i){return this.cmp(i)<0};B.lessThanOrEqualTo=B.lte=function(i){return this.cmp(i)<1};B.logarithm=B.log=function(i){var e,t,n,r,o,s,a,u,c=this,l=c.constructor,m=l.precision,d=l.rounding,p=5;if(i==null)i=new l(10),e=!0;else{if(i=new l(i),t=i.d,i.s<0||!t||!t[0]||i.eq(1))return new l(NaN);e=i.eq(10)}if(t=c.d,c.s<0||!t||!t[0]||c.eq(1))return new l(t&&!t[0]?-1/0:c.s!=1?NaN:t?0:1/0);if(e)if(t.length>1)o=!0;else{for(r=t[0];r%10===0;)r/=10;o=r!==1}if(Z=!1,a=m+p,s=Vt(c,a),n=e?dr(l,a+10):Vt(i,a),u=ge(s,n,a,1),Ln(u.d,r=m,d))do if(a+=10,s=Vt(c,a),n=e?dr(l,a+10):Vt(i,a),u=ge(s,n,a,1),!o){+_e(u.d).slice(r+1,r+15)+1==1e14&&(u=U(u,m+1,0));break}while(Ln(u.d,r+=10,d));return Z=!0,U(u,m,d)};B.minus=B.sub=function(i){var e,t,n,r,o,s,a,u,c,l,m,d,p=this,y=p.constructor;if(i=new y(i),!p.d||!i.d)return!p.s||!i.s?i=new y(NaN):p.d?i.s=-i.s:i=new y(i.d||p.s!==i.s?p:NaN),i;if(p.s!=i.s)return i.s=-i.s,p.plus(i);if(c=p.d,d=i.d,a=y.precision,u=y.rounding,!c[0]||!d[0]){if(d[0])i.s=-i.s;else if(c[0])i=new y(p);else return new y(u===3?-0:0);return Z?U(i,a,u):i}if(t=ve(i.e/Q),l=ve(p.e/Q),c=c.slice(),o=l-t,o){for(m=o<0,m?(e=c,o=-o,s=d.length):(e=d,t=l,s=c.length),n=Math.max(Math.ceil(a/Q),s)+2,o>n&&(o=n,e.length=1),e.reverse(),n=o;n--;)e.push(0);e.reverse()}else{for(n=c.length,s=d.length,m=n<s,m&&(s=n),n=0;n<s;n++)if(c[n]!=d[n]){m=c[n]<d[n];break}o=0}for(m&&(e=c,c=d,d=e,i.s=-i.s),s=c.length,n=d.length-s;n>0;--n)c[s++]=0;for(n=d.length;n>o;){if(c[--n]<d[n]){for(r=n;r&&c[--r]===0;)c[r]=ct-1;--c[r],c[n]+=ct}c[n]-=d[n]}for(;c[--s]===0;)c.pop();for(;c[0]===0;c.shift())--t;return c[0]?(i.d=c,i.e=fr(c,t),Z?U(i,a,u):i):new y(u===3?-0:0)};B.modulo=B.mod=function(i){var e,t=this,n=t.constructor;return i=new n(i),!t.d||!i.s||i.d&&!i.d[0]?new n(NaN):!i.d||t.d&&!t.d[0]?U(new n(t),n.precision,n.rounding):(Z=!1,n.modulo==9?(e=ge(t,i.abs(),0,3,1),e.s*=i.s):e=ge(t,i,0,n.modulo,1),e=e.times(i),Z=!0,t.minus(e))};B.naturalExponential=B.exp=function(){return ei(this)};B.naturalLogarithm=B.ln=function(){return Vt(this)};B.negated=B.neg=function(){var i=new this.constructor(this);return i.s=-i.s,U(i)};B.plus=B.add=function(i){var e,t,n,r,o,s,a,u,c,l,m=this,d=m.constructor;if(i=new d(i),!m.d||!i.d)return!m.s||!i.s?i=new d(NaN):m.d||(i=new d(i.d||m.s===i.s?m:NaN)),i;if(m.s!=i.s)return i.s=-i.s,m.minus(i);if(c=m.d,l=i.d,a=d.precision,u=d.rounding,!c[0]||!l[0])return l[0]||(i=new d(m)),Z?U(i,a,u):i;if(o=ve(m.e/Q),n=ve(i.e/Q),c=c.slice(),r=o-n,r){for(r<0?(t=c,r=-r,s=l.length):(t=l,n=o,s=c.length),o=Math.ceil(a/Q),s=o>s?o+1:s+1,r>s&&(r=s,t.length=1),t.reverse();r--;)t.push(0);t.reverse()}for(s=c.length,r=l.length,s-r<0&&(r=s,t=l,l=c,c=t),e=0;r;)e=(c[--r]=c[r]+l[r]+e)/ct|0,c[r]%=ct;for(e&&(c.unshift(e),++n),s=c.length;c[--s]==0;)c.pop();return i.d=c,i.e=fr(c,n),Z?U(i,a,u):i};B.precision=B.sd=function(i){var e,t=this;if(i!==void 0&&i!==!!i&&i!==1&&i!==0)throw Error(Et+i);return t.d?(e=Bo(t.d),i&&t.e+1>e&&(e=t.e+1)):e=NaN,e};B.round=function(){var i=this,e=i.constructor;return U(new e(i),i.e+1,e.rounding)};B.sine=B.sin=function(){var i,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(i=n.precision,e=n.rounding,n.precision=i+Math.max(t.e,t.sd())+Q,n.rounding=1,t=_a(n,Lo(n,t)),n.precision=i,n.rounding=e,U(Ct>2?t.neg():t,i,e,!0)):new n(NaN)};B.squareRoot=B.sqrt=function(){var i,e,t,n,r,o,s=this,a=s.d,u=s.e,c=s.s,l=s.constructor;if(c!==1||!a||!a[0])return new l(!c||c<0&&(!a||a[0])?NaN:a?s:1/0);for(Z=!1,c=Math.sqrt(+s),c==0||c==1/0?(e=_e(a),(e.length+u)%2==0&&(e+="0"),c=Math.sqrt(e),u=ve((u+1)/2)-(u<0||u%2),c==1/0?e="5e"+u:(e=c.toExponential(),e=e.slice(0,e.indexOf("e")+1)+u),n=new l(e)):n=new l(c.toString()),t=(u=l.precision)+3;;)if(o=n,n=o.plus(ge(s,o,t+2,1)).times(.5),_e(o.d).slice(0,t)===(e=_e(n.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!r&&e=="4999"){if(!r&&(U(o,u+1,0),o.times(o).eq(s))){n=o;break}t+=4,r=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(U(n,u+1,1),i=!n.times(n).eq(s));break}return Z=!0,U(n,u,l.rounding,i)};B.tangent=B.tan=function(){var i,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(i=n.precision,e=n.rounding,n.precision=i+10,n.rounding=1,t=t.sin(),t.s=1,t=ge(t,new n(1).minus(t.times(t)).sqrt(),i+10,0),n.precision=i,n.rounding=e,U(Ct==2||Ct==4?t.neg():t,i,e,!0)):new n(NaN)};B.times=B.mul=function(i){var e,t,n,r,o,s,a,u,c,l=this,m=l.constructor,d=l.d,p=(i=new m(i)).d;if(i.s*=l.s,!d||!d[0]||!p||!p[0])return new m(!i.s||d&&!d[0]&&!p||p&&!p[0]&&!d?NaN:!d||!p?i.s/0:i.s*0);for(t=ve(l.e/Q)+ve(i.e/Q),u=d.length,c=p.length,u<c&&(o=d,d=p,p=o,s=u,u=c,c=s),o=[],s=u+c,n=s;n--;)o.push(0);for(n=c;--n>=0;){for(e=0,r=u+n;r>n;)a=o[r]+p[n]*d[r-n-1]+e,o[r--]=a%ct|0,e=a/ct|0;o[r]=(o[r]+e)%ct|0}for(;!o[--s];)o.pop();return e?++t:o.shift(),i.d=o,i.e=fr(o,t),Z?U(i,m.precision,m.rounding):i};B.toBinary=function(i,e){return ni(this,2,i,e)};B.toDecimalPlaces=B.toDP=function(i,e){var t=this,n=t.constructor;return t=new n(t),i===void 0?t:(je(i,0,Ft),e===void 0?e=n.rounding:je(e,0,8),U(t,i+t.e+1,e))};B.toExponential=function(i,e){var t,n=this,r=n.constructor;return i===void 0?t=ht(n,!0):(je(i,0,Ft),e===void 0?e=r.rounding:je(e,0,8),n=U(new r(n),i+1,e),t=ht(n,!0,i+1)),n.isNeg()&&!n.isZero()?"-"+t:t};B.toFixed=function(i,e){var t,n,r=this,o=r.constructor;return i===void 0?t=ht(r):(je(i,0,Ft),e===void 0?e=o.rounding:je(e,0,8),n=U(new o(r),i+r.e+1,e),t=ht(n,!1,i+n.e+1)),r.isNeg()&&!r.isZero()?"-"+t:t};B.toFraction=function(i){var e,t,n,r,o,s,a,u,c,l,m,d,p=this,y=p.d,f=p.constructor;if(!y)return new f(p);if(c=t=new f(1),n=u=new f(0),e=new f(n),o=e.e=Bo(y)-p.e-1,s=o%Q,e.d[0]=Le(10,s<0?Q+s:s),i==null)i=o>0?e:c;else{if(a=new f(i),!a.isInt()||a.lt(c))throw Error(Et+a);i=a.gt(e)?o>0?e:c:a}for(Z=!1,a=new f(_e(y)),l=f.precision,f.precision=o=y.length*Q*2;m=ge(a,e,0,1,1),r=t.plus(m.times(n)),r.cmp(i)!=1;)t=n,n=r,r=c,c=u.plus(m.times(r)),u=r,r=e,e=a.minus(m.times(r)),a=r;return r=ge(i.minus(t),n,0,1,1),u=u.plus(r.times(c)),t=t.plus(r.times(n)),u.s=c.s=p.s,d=ge(c,n,o,1).minus(p).abs().cmp(ge(u,t,o,1).minus(p).abs())<1?[c,n]:[u,t],f.precision=l,Z=!0,d};B.toHexadecimal=B.toHex=function(i,e){return ni(this,16,i,e)};B.toNearest=function(i,e){var t=this,n=t.constructor;if(t=new n(t),i==null){if(!t.d)return t;i=new n(1),e=n.rounding}else{if(i=new n(i),e===void 0?e=n.rounding:je(e,0,8),!t.d)return i.s?t:i;if(!i.d)return i.s&&(i.s=t.s),i}return i.d[0]?(Z=!1,t=ge(t,i,0,e,1).times(i),Z=!0,U(t)):(i.s=t.s,t=i),t};B.toNumber=function(){return+this};B.toOctal=function(i,e){return ni(this,8,i,e)};B.toPower=B.pow=function(i){var e,t,n,r,o,s,a=this,u=a.constructor,c=+(i=new u(i));if(!a.d||!i.d||!a.d[0]||!i.d[0])return new u(Le(+a,c));if(a=new u(a),a.eq(1))return a;if(n=u.precision,o=u.rounding,i.eq(1))return U(a,n,o);if(e=ve(i.e/Q),e>=i.d.length-1&&(t=c<0?-c:c)<=La)return r=So(u,a,t,n),i.s<0?new u(1).div(r):U(r,n,o);if(s=a.s,s<0){if(e<i.d.length-1)return new u(NaN);if((i.d[e]&1)==0&&(s=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=s,a}return t=Le(+a,c),e=t==0||!isFinite(t)?ve(c*(Math.log("0."+_e(a.d))/Math.LN10+a.e+1)):new u(t+"").e,e>u.maxE+1||e<u.minE-1?new u(e>0?s/0:0):(Z=!1,u.rounding=a.s=1,t=Math.min(12,(e+"").length),r=ei(i.times(Vt(a,n+t)),n),r.d&&(r=U(r,n+5,1),Ln(r.d,n,o)&&(e=n+10,r=U(ei(i.times(Vt(a,e+t)),e),e+5,1),+_e(r.d).slice(n+1,n+15)+1==1e14&&(r=U(r,n+1,0)))),r.s=s,Z=!0,u.rounding=o,U(r,n,o))};B.toPrecision=function(i,e){var t,n=this,r=n.constructor;return i===void 0?t=ht(n,n.e<=r.toExpNeg||n.e>=r.toExpPos):(je(i,1,Ft),e===void 0?e=r.rounding:je(e,0,8),n=U(new r(n),i,e),t=ht(n,i<=n.e||n.e<=r.toExpNeg,i)),n.isNeg()&&!n.isZero()?"-"+t:t};B.toSignificantDigits=B.toSD=function(i,e){var t=this,n=t.constructor;return i===void 0?(i=n.precision,e=n.rounding):(je(i,1,Ft),e===void 0?e=n.rounding:je(e,0,8)),U(new n(t),i,e)};B.toString=function(){var i=this,e=i.constructor,t=ht(i,i.e<=e.toExpNeg||i.e>=e.toExpPos);return i.isNeg()&&!i.isZero()?"-"+t:t};B.truncated=B.trunc=function(){return U(new this.constructor(this),this.e+1,1)};B.valueOf=B.toJSON=function(){var i=this,e=i.constructor,t=ht(i,i.e<=e.toExpNeg||i.e>=e.toExpPos);return i.isNeg()?"-"+t:t};function _e(i){var e,t,n,r=i.length-1,o="",s=i[0];if(r>0){for(o+=s,e=1;e<r;e++)n=i[e]+"",t=Q-n.length,t&&(o+=Mt(t)),o+=n;s=i[e],n=s+"",t=Q-n.length,t&&(o+=Mt(t))}else if(s===0)return"0";for(;s%10===0;)s/=10;return o+s}function je(i,e,t){if(i!==~~i||i<e||i>t)throw Error(Et+i)}function Ln(i,e,t,n){var r,o,s,a;for(o=i[0];o>=10;o/=10)--e;return--e<0?(e+=Q,r=0):(r=Math.ceil((e+1)/Q),e%=Q),o=Le(10,Q-e),a=i[r]%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)&&(i[r+1]/o/100|0)==Le(10,e-2)-1||(a==o/2||a==0)&&(i[r+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)&&(i[r+1]/o/1e3|0)==Le(10,e-3)-1,s}function cr(i,e,t){for(var n,r=[0],o,s=0,a=i.length;s<a;){for(o=r.length;o--;)r[o]*=e;for(r[0]+=Zr.indexOf(i.charAt(s++)),n=0;n<r.length;n++)r[n]>t-1&&(r[n+1]===void 0&&(r[n+1]=0),r[n+1]+=r[n]/t|0,r[n]%=t)}return r.reverse()}function Oa(i,e){var t,n,r;if(e.isZero())return e;n=e.d.length,n<32?(t=Math.ceil(n/3),r=(1/yr(4,t)).toString()):(t=16,r="2.3283064365386962890625e-10"),i.precision+=t,e=cn(i,1,e.times(r),new i(1));for(var o=t;o--;){var s=e.times(e);e=s.times(s).minus(s).times(8).plus(1)}return i.precision-=t,e}var ge=function(){function i(n,r,o){var s,a=0,u=n.length;for(n=n.slice();u--;)s=n[u]*r+a,n[u]=s%o|0,a=s/o|0;return a&&n.unshift(a),n}function e(n,r,o,s){var a,u;if(o!=s)u=o>s?1:-1;else for(a=u=0;a<o;a++)if(n[a]!=r[a]){u=n[a]>r[a]?1:-1;break}return u}function t(n,r,o,s){for(var a=0;o--;)n[o]-=a,a=n[o]<r[o]?1:0,n[o]=a*s+n[o]-r[o];for(;!n[0]&&n.length>1;)n.shift()}return function(n,r,o,s,a,u){var c,l,m,d,p,y,f,b,w,A,k,P,T,I,x,R,C,O,F,ne,v=n.constructor,ee=n.s==r.s?1:-1,j=n.d,re=r.d;if(!j||!j[0]||!re||!re[0])return new v(!n.s||!r.s||(j?re&&j[0]==re[0]:!re)?NaN:j&&j[0]==0||!re?ee*0:ee/0);for(u?(p=1,l=n.e-r.e):(u=ct,p=Q,l=ve(n.e/p)-ve(r.e/p)),F=re.length,C=j.length,w=new v(ee),A=w.d=[],m=0;re[m]==(j[m]||0);m++);if(re[m]>(j[m]||0)&&l--,o==null?(I=o=v.precision,s=v.rounding):a?I=o+(n.e-r.e)+1:I=o,I<0)A.push(1),y=!0;else{if(I=I/p+2|0,m=0,F==1){for(d=0,re=re[0],I++;(m<C||d)&&I--;m++)x=d*u+(j[m]||0),A[m]=x/re|0,d=x%re|0;y=d||m<C}else{for(d=u/(re[0]+1)|0,d>1&&(re=i(re,d,u),j=i(j,d,u),F=re.length,C=j.length),R=F,k=j.slice(0,F),P=k.length;P<F;)k[P++]=0;ne=re.slice(),ne.unshift(0),O=re[0],re[1]>=u/2&&++O;do d=0,c=e(re,k,F,P),c<0?(T=k[0],F!=P&&(T=T*u+(k[1]||0)),d=T/O|0,d>1?(d>=u&&(d=u-1),f=i(re,d,u),b=f.length,P=k.length,c=e(f,k,b,P),c==1&&(d--,t(f,F<b?ne:re,b,u))):(d==0&&(c=d=1),f=re.slice()),b=f.length,b<P&&f.unshift(0),t(k,f,P,u),c==-1&&(P=k.length,c=e(re,k,F,P),c<1&&(d++,t(k,F<P?ne:re,P,u))),P=k.length):c===0&&(d++,k=[0]),A[m++]=d,c&&k[0]?k[P++]=j[R]||0:(k=[j[R]],P=1);while((R++<C||k[0]!==void 0)&&I--);y=k[0]!==void 0}A[0]||A.shift()}if(p==1)w.e=l,Ao=y;else{for(m=1,d=A[0];d>=10;d/=10)m++;w.e=m+l*p-1,U(w,a?o+w.e+1:o,s,y)}return w}}();function U(i,e,t,n){var r,o,s,a,u,c,l,m,d,p=i.constructor;e:if(e!=null){if(m=i.d,!m)return i;for(r=1,a=m[0];a>=10;a/=10)r++;if(o=e-r,o<0)o+=Q,s=e,l=m[d=0],u=l/Le(10,r-s-1)%10|0;else if(d=Math.ceil((o+1)/Q),a=m.length,d>=a)if(n){for(;a++<=d;)m.push(0);l=u=0,r=1,o%=Q,s=o-Q+1}else break e;else{for(l=a=m[d],r=1;a>=10;a/=10)r++;o%=Q,s=o-Q+r,u=s<0?0:l/Le(10,r-s-1)%10|0}if(n=n||e<0||m[d+1]!==void 0||(s<0?l:l%Le(10,r-s-1)),c=t<4?(u||n)&&(t==0||t==(i.s<0?3:2)):u>5||u==5&&(t==4||n||t==6&&(o>0?s>0?l/Le(10,r-s):0:m[d-1])%10&1||t==(i.s<0?8:7)),e<1||!m[0])return m.length=0,c?(e-=i.e+1,m[0]=Le(10,(Q-e%Q)%Q),i.e=-e||0):m[0]=i.e=0,i;if(o==0?(m.length=d,a=1,d--):(m.length=d+1,a=Le(10,Q-o),m[d]=s>0?(l/Le(10,r-s)%Le(10,s)|0)*a:0),c)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&&(i.e++,m[0]==ct&&(m[0]=1));break}else{if(m[d]+=a,m[d]!=ct)break;m[d--]=0,a=1}for(o=m.length;m[--o]===0;)m.pop()}return Z&&(i.e>p.maxE?(i.d=null,i.e=NaN):i.e<p.minE&&(i.e=0,i.d=[0])),i}function ht(i,e,t){if(!i.isFinite())return Co(i);var n,r=i.e,o=_e(i.d),s=o.length;return e?(t&&(n=t-s)>0?o=o.charAt(0)+"."+o.slice(1)+Mt(n):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(i.e<0?"e":"e+")+i.e):r<0?(o="0."+Mt(-r-1)+o,t&&(n=t-s)>0&&(o+=Mt(n))):r>=s?(o+=Mt(r+1-s),t&&(n=t-r-1)>0&&(o=o+"."+Mt(n))):((n=r+1)<s&&(o=o.slice(0,n)+"."+o.slice(n)),t&&(n=t-s)>0&&(r+1===s&&(o+="."),o+=Mt(n))),o}function fr(i,e){var t=i[0];for(e*=Q;t>=10;t/=10)e++;return e}function dr(i,e,t){if(e>Ra)throw Z=!0,t&&(i.precision=t),Error(Po);return U(new i(lr),e,1,!0)}function ut(i,e,t){if(e>$r)throw Error(Po);return U(new i(mr),e,t,!0)}function Bo(i){var e=i.length-1,t=e*Q+1;if(e=i[e],e){for(;e%10==0;e/=10)t--;for(e=i[0];e>=10;e/=10)t++}return t}function Mt(i){for(var e="";i--;)e+="0";return e}function So(i,e,t,n){var r,o=new i(1),s=Math.ceil(n/Q+4);for(Z=!1;;){if(t%2&&(o=o.times(e),ko(o.d,s)&&(r=!0)),t=ve(t/2),t===0){t=o.d.length-1,r&&o.d[t]===0&&++o.d[t];break}e=e.times(e),ko(e.d,s)}return Z=!0,o}function wo(i){return i.d[i.d.length-1]&1}function Ko(i,e,t){for(var n,r=new i(e[0]),o=0;++o<e.length;)if(n=new i(e[o]),n.s)r[t](n)&&(r=n);else{r=n;break}return r}function ei(i,e){var t,n,r,o,s,a,u,c=0,l=0,m=0,d=i.constructor,p=d.rounding,y=d.precision;if(!i.d||!i.d[0]||i.e>17)return new d(i.d?i.d[0]?i.s<0?0:1/0:1:i.s?i.s<0?0:i:0/0);for(e==null?(Z=!1,u=y):u=e,a=new d(.03125);i.e>-2;)i=i.times(a),m+=5;for(n=Math.log(Le(2,m))/Math.LN10*2+5|0,u+=n,t=o=s=new d(1),d.precision=u;;){if(o=U(o.times(i),u,1),t=t.times(++l),a=s.plus(ge(o,t,u,1)),_e(a.d).slice(0,u)===_e(s.d).slice(0,u)){for(r=m;r--;)s=U(s.times(s),u,1);if(e==null)if(c<3&&Ln(s.d,u-n,p,c))d.precision=u+=10,t=o=a=new d(1),l=0,c++;else return U(s,d.precision=y,p,Z=!0);else return d.precision=y,s}s=a}}function Vt(i,e){var t,n,r,o,s,a,u,c,l,m,d,p=1,y=10,f=i,b=f.d,w=f.constructor,A=w.rounding,k=w.precision;if(f.s<0||!b||!b[0]||!f.e&&b[0]==1&&b.length==1)return new w(b&&!b[0]?-1/0:f.s!=1?NaN:b?0:f);if(e==null?(Z=!1,l=k):l=e,w.precision=l+=y,t=_e(b),n=t.charAt(0),Math.abs(o=f.e)<15e14){for(;n<7&&n!=1||n==1&&t.charAt(1)>3;)f=f.times(i),t=_e(f.d),n=t.charAt(0),p++;o=f.e,n>1?(f=new w("0."+t),o++):f=new w(n+"."+t.slice(1))}else return c=dr(w,l+2,k).times(o+""),f=Vt(new w(n+"."+t.slice(1)),l-y).plus(c),w.precision=k,e==null?U(f,k,A,Z=!0):f;for(m=f,u=s=f=ge(f.minus(1),f.plus(1),l,1),d=U(f.times(f),l,1),r=3;;){if(s=U(s.times(d),l,1),c=u.plus(ge(s,new w(r),l,1)),_e(c.d).slice(0,l)===_e(u.d).slice(0,l))if(u=u.times(2),o!==0&&(u=u.plus(dr(w,l+2,k).times(o+""))),u=ge(u,new w(p),l,1),e==null)if(Ln(u.d,l-y,A,a))w.precision=l+=y,c=s=f=ge(m.minus(1),m.plus(1),l,1),d=U(f.times(f),l,1),r=a=1;else return U(u,w.precision=k,A,Z=!0);else return w.precision=k,u;u=c,r+=2}}function Co(i){return String(i.s*i.s/0)}function ti(i,e){var t,n,r;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(r=e.length;e.charCodeAt(r-1)===48;--r);if(e=e.slice(n,r),e){if(r-=n,i.e=t=t-n-1,i.d=[],n=(t+1)%Q,t<0&&(n+=Q),n<r){for(n&&i.d.push(+e.slice(0,n)),r-=Q;n<r;)i.d.push(+e.slice(n,n+=Q));e=e.slice(n),n=Q-e.length}else n-=r;for(;n--;)e+="0";i.d.push(+e),Z&&(i.e>i.constructor.maxE?(i.d=null,i.e=NaN):i.e<i.constructor.minE&&(i.e=0,i.d=[0]))}else i.e=0,i.d=[0];return i}function Na(i,e){var t,n,r,o,s,a,u,c,l;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),xo.test(e))return ti(i,e)}else if(e==="Infinity"||e==="NaN")return+e||(i.s=NaN),i.e=NaN,i.d=null,i;if(Ka.test(e))t=16,e=e.toLowerCase();else if(Sa.test(e))t=2;else if(Ca.test(e))t=8;else throw Error(Et+e);for(o=e.search(/p/i),o>0?(u=+e.slice(o+1),e=e.substring(2,o)):e=e.slice(2),o=e.indexOf("."),s=o>=0,n=i.constructor,s&&(e=e.replace(".",""),a=e.length,o=a-o,r=So(n,new n(t),o,o*2)),c=cr(e,t,ct),l=c.length-1,o=l;c[o]===0;--o)c.pop();return o<0?new n(i.s*0):(i.e=fr(c,l),i.d=c,Z=!1,s&&(i=ge(i,r,a*4)),u&&(i=i.times(Math.abs(u)<54?Le(2,u):Rn.pow(2,u))),Z=!0,i)}function _a(i,e){var t,n=e.d.length;if(n<3)return e.isZero()?e:cn(i,2,e,e);t=1.4*Math.sqrt(n),t=t>16?16:t|0,e=e.times(1/yr(5,t)),e=cn(i,2,e,e);for(var r,o=new i(5),s=new i(16),a=new i(20);t--;)r=e.times(e),e=e.times(o.plus(r.times(s.times(r).minus(a))));return e}function cn(i,e,t,n,r){var o,s,a,u,c=1,l=i.precision,m=Math.ceil(l/Q);for(Z=!1,u=t.times(t),a=new i(n);;){if(s=ge(a.times(u),new i(e++*e++),l,1),a=r?n.plus(s):n.minus(s),n=ge(s.times(u),new i(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,c++}return Z=!0,s.d.length=m+1,s}function yr(i,e){for(var t=i;--e;)t*=i;return t}function Lo(i,e){var t,n=e.s<0,r=ut(i,i.precision,1),o=r.times(.5);if(e=e.abs(),e.lte(o))return Ct=n?4:1,e;if(t=e.divToInt(r),t.isZero())Ct=n?3:2;else{if(e=e.minus(t.times(r)),e.lte(o))return Ct=wo(t)?n?2:3:n?4:1,e;Ct=wo(t)?n?1:4:n?3:2}return e.minus(r).abs()}function ni(i,e,t,n){var r,o,s,a,u,c,l,m,d,p=i.constructor,y=t!==void 0;if(y?(je(t,1,Ft),n===void 0?n=p.rounding:je(n,0,8)):(t=p.precision,n=p.rounding),!i.isFinite())l=Co(i);else{for(l=ht(i),s=l.indexOf("."),y?(r=2,e==16?t=t*4-3:e==8&&(t=t*3-2)):r=e,s>=0&&(l=l.replace(".",""),d=new p(1),d.e=l.length-s,d.d=cr(ht(d),10,r),d.e=d.d.length),m=cr(l,10,r),o=u=m.length;m[--u]==0;)m.pop();if(!m[0])l=y?"0p+0":"0";else{if(s<0?o--:(i=new p(i),i.d=m,i.e=o,i=ge(i,d,t,n,0,r),m=i.d,o=i.e,c=Ao),s=m[t],a=r/2,c=c||m[t+1]!==void 0,c=n<4?(s!==void 0||c)&&(n===0||n===(i.s<0?3:2)):s>a||s===a&&(n===4||c||n===6&&m[t-1]&1||n===(i.s<0?8:7)),m.length=t,c)for(;++m[--t]>r-1;)m[t]=0,t||(++o,m.unshift(1));for(u=m.length;!m[u-1];--u);for(s=0,l="";s<u;s++)l+=Zr.charAt(m[s]);if(y){if(u>1)if(e==16||e==8){for(s=e==16?4:3,--u;u%s;u++)l+="0";for(m=cr(l,r,e),u=m.length;!m[u-1];--u);for(s=1,l="1.";s<u;s++)l+=Zr.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>u)for(o-=u;o--;)l+="0";else o<u&&(l=l.slice(0,o)+"."+l.slice(o))}l=(e==16?"0x":e==2?"0b":e==8?"0o":"")+l}return i.s<0?"-"+l:l}function ko(i,e){if(i.length>e)return i.length=e,!0}function Ma(i){return new this(i).abs()}function Va(i){return new this(i).acos()}function Ea(i){return new this(i).acosh()}function Fa(i,e){return new this(i).plus(e)}function va(i){return new this(i).asin()}function Wa(i){return new this(i).asinh()}function Da(i){return new this(i).atan()}function qa(i){return new this(i).atanh()}function Ua(i,e){i=new this(i),e=new this(e);var t,n=this.precision,r=this.rounding,o=n+4;return!i.s||!e.s?t=new this(NaN):!i.d&&!e.d?(t=ut(this,o,1).times(e.s>0?.25:.75),t.s=i.s):!e.d||i.isZero()?(t=e.s<0?ut(this,n,r):new this(0),t.s=i.s):!i.d||e.isZero()?(t=ut(this,o,1).times(.5),t.s=i.s):e.s<0?(this.precision=o,this.rounding=1,t=this.atan(ge(i,e,o,1)),e=ut(this,o,1),this.precision=n,this.rounding=r,t=i.s<0?t.minus(e):t.plus(e)):t=this.atan(ge(i,e,o,1)),t}function Ga(i){return new this(i).cbrt()}function Xa(i){return U(i=new this(i),i.e+1,2)}function za(i,e,t){return new this(i).clamp(e,t)}function Ya(i){if(!i||typeof i!="object")throw Error(pr+"Object expected");var e,t,n,r=i.defaults===!0,o=["precision",1,Ft,"rounding",0,8,"toExpNeg",-un,0,"toExpPos",0,un,"maxE",0,un,"minE",-un,0,"modulo",0,9];for(e=0;e<o.length;e+=3)if(t=o[e],r&&(this[t]=Jr[t]),(n=i[t])!==void 0)if(ve(n)===n&&n>=o[e+1]&&n<=o[e+2])this[t]=n;else throw Error(Et+t+": "+n);if(t="crypto",r&&(this[t]=Jr[t]),(n=i[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(To);else this[t]=!1;else throw Error(Et+t+": "+n);return this}function Qa(i){return new this(i).cos()}function ja(i){return new this(i).cosh()}function Ro(i){var e,t,n;function r(o){var s,a,u,c=this;if(!(c instanceof r))return new r(o);if(c.constructor=r,ho(o)){c.s=o.s,Z?!o.d||o.e>r.maxE?(c.e=NaN,c.d=null):o.e<r.minE?(c.e=0,c.d=[0]):(c.e=o.e,c.d=o.d.slice()):(c.e=o.e,c.d=o.d?o.d.slice():o.d);return}if(u=typeof o,u==="number"){if(o===0){c.s=1/o<0?-1:1,c.e=0,c.d=[0];return}if(o<0?(o=-o,c.s=-1):c.s=1,o===~~o&&o<1e7){for(s=0,a=o;a>=10;a/=10)s++;Z?s>r.maxE?(c.e=NaN,c.d=null):s<r.minE?(c.e=0,c.d=[0]):(c.e=s,c.d=[o]):(c.e=s,c.d=[o]);return}else if(o*0!==0){o||(c.s=NaN),c.e=NaN,c.d=null;return}return ti(c,o.toString())}else if(u!=="string")throw Error(Et+o);return(a=o.charCodeAt(0))===45?(o=o.slice(1),c.s=-1):(a===43&&(o=o.slice(1)),c.s=1),xo.test(o)?ti(c,o):Na(c,o)}if(r.prototype=B,r.ROUND_UP=0,r.ROUND_DOWN=1,r.ROUND_CEIL=2,r.ROUND_FLOOR=3,r.ROUND_HALF_UP=4,r.ROUND_HALF_DOWN=5,r.ROUND_HALF_EVEN=6,r.ROUND_HALF_CEIL=7,r.ROUND_HALF_FLOOR=8,r.EUCLID=9,r.config=r.set=Ya,r.clone=Ro,r.isDecimal=ho,r.abs=Ma,r.acos=Va,r.acosh=Ea,r.add=Fa,r.asin=va,r.asinh=Wa,r.atan=Da,r.atanh=qa,r.atan2=Ua,r.cbrt=Ga,r.ceil=Xa,r.clamp=za,r.cos=Qa,r.cosh=ja,r.div=Ha,r.exp=Za,r.floor=Ja,r.hypot=$a,r.ln=eu,r.log=tu,r.log10=ru,r.log2=nu,r.max=iu,r.min=ou,r.mod=su,r.mul=au,r.pow=uu,r.random=cu,r.round=lu,r.sign=mu,r.sin=du,r.sinh=pu,r.sqrt=fu,r.sub=yu,r.sum=bu,r.tan=gu,r.tanh=wu,r.trunc=ku,i===void 0&&(i={}),i&&i.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<n.length;)i.hasOwnProperty(t=n[e++])||(i[t]=this[t]);return r.config(i),r}function Ha(i,e){return new this(i).div(e)}function Za(i){return new this(i).exp()}function Ja(i){return U(i=new this(i),i.e+1,3)}function $a(){var i,e,t=new this(0);for(Z=!1,i=0;i<arguments.length;)if(e=new this(arguments[i++]),e.d)t.d&&(t=t.plus(e.times(e)));else{if(e.s)return Z=!0,new this(1/0);t=e}return Z=!0,t.sqrt()}function ho(i){return i instanceof Rn||i&&i.toStringTag===Io||!1}function eu(i){return new this(i).ln()}function tu(i,e){return new this(i).log(e)}function nu(i){return new this(i).log(2)}function ru(i){return new this(i).log(10)}function iu(){return Ko(this,arguments,"lt")}function ou(){return Ko(this,arguments,"gt")}function su(i,e){return new this(i).mod(e)}function au(i,e){return new this(i).mul(e)}function uu(i,e){return new this(i).pow(e)}function cu(i){var e,t,n,r,o=0,s=new this(1),a=[];if(i===void 0?i=this.precision:je(i,1,Ft),n=Math.ceil(i/Q),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(n));o<n;)r=e[o],r>=429e7?e[o]=crypto.getRandomValues(new Uint32Array(1))[0]:a[o++]=r%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(n*=4);o<n;)r=e[o]+(e[o+1]<<8)+(e[o+2]<<16)+((e[o+3]&127)<<24),r>=214e7?crypto.randomBytes(4).copy(e,o):(a.push(r%1e7),o+=4);o=n/4}else throw Error(To);else for(;o<n;)a[o++]=Math.random()*1e7|0;for(n=a[--o],i%=Q,n&&i&&(r=Le(10,Q-i),a[o]=(n/r|0)*r);a[o]===0;o--)a.pop();if(o<0)t=0,a=[0];else{for(t=-1;a[0]===0;t-=Q)a.shift();for(n=1,r=a[0];r>=10;r/=10)n++;n<Q&&(t-=Q-n)}return s.e=t,s.d=a,s}function lu(i){return U(i=new this(i),i.e+1,this.rounding)}function mu(i){return i=new this(i),i.d?i.d[0]?i.s:0*i.s:i.s||NaN}function du(i){return new this(i).sin()}function pu(i){return new this(i).sinh()}function fu(i){return new this(i).sqrt()}function yu(i,e){return new this(i).sub(e)}function bu(){var i=0,e=arguments,t=new this(e[i]);for(Z=!1;t.s&&++i<e.length;)t=t.plus(e[i]);return Z=!0,U(t,this.precision,this.rounding)}function gu(i){return new this(i).tan()}function wu(i){return new this(i).tanh()}function ku(i){return U(i=new this(i),i.e+1,1)}B[Symbol.for("nodejs.util.inspect.custom")]=B.toString;B[Symbol.toStringTag]="Decimal";var Rn=B.constructor=Ro(Jr);lr=new Rn(lr);mr=new Rn(mr);var V=Rn;var br=require("@solana/web3.js");var Oo=require("@solana/spl-token"),fe=require("@solana/web3.js");function h({pubkey:i,isSigner:e=!1,isWritable:t=!0}){return{pubkey:i,isWritable:t,isSigner:e}}var ri=[h({pubkey:Oo.TOKEN_PROGRAM_ID,isWritable:!1}),h({pubkey:fe.SystemProgram.programId,isWritable:!1}),h({pubkey:fe.SYSVAR_RENT_PUBKEY,isWritable:!1})];function ln({publicKey:i,transformSol:e}){let t=ii(i.toString());if(t instanceof fe.PublicKey)return e&&t.equals(me)?J:t;if(e&&t.toString()===me.toBase58())return J;if(typeof t=="string"){if(t===fe.PublicKey.default.toBase58())return fe.PublicKey.default;try{return new fe.PublicKey(t)}catch{throw new Error("invalid public key")}}throw new Error("invalid public key")}function ii(i){try{return new fe.PublicKey(i)}catch{return i}}var mn=new fe.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),Lt=new fe.PublicKey("SysvarRent111111111111111111111111111111111"),No=new fe.PublicKey("SysvarC1ock11111111111111111111111111111111"),dn=new fe.PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),hu=new fe.PublicKey("Sysvar1nstructions1111111111111111111111111"),Mc=new fe.PublicKey("4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R"),Vc=new fe.PublicKey("Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS"),Ec=new fe.PublicKey("SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt"),Fc=new fe.PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),vc=new fe.PublicKey("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"),Wc=new fe.PublicKey("mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So"),Dc=new fe.PublicKey("7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj"),qc=new fe.PublicKey("USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX"),Uc=new fe.PublicKey("NRVwhjBQiUPYtfDT5zRBVJajzFQHaBUNtC7SNVvqRFa"),Gc=new fe.PublicKey("ANAxByE6G2WjFp7A4NqtWYXb3mgruyzZYg3spfxe6Lbo"),Xc=new fe.PublicKey("7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs"),J=new fe.PublicKey("So11111111111111111111111111111111111111112"),me=fe.PublicKey.default;function vt(i){return ln({publicKey:i,transformSol:!0})}var _o=require("@solana/web3.js"),oi=require("@solana/spl-token"),Je={chainId:101,address:_o.PublicKey.default.toBase58(),programId:oi.TOKEN_PROGRAM_ID.toBase58(),decimals:9,symbol:"SOL",name:"solana",logoURI:"https://img.raydium.io/icon/So11111111111111111111111111111111111111112.png",tags:[],priority:2,type:"raydium",extensions:{coingeckoId:"solana"}},Me={chainId:101,address:"So11111111111111111111111111111111111111112",programId:oi.TOKEN_PROGRAM_ID.toBase58(),decimals:9,symbol:"WSOL",name:"Wrapped SOL",logoURI:"https://img.raydium.io/icon/So11111111111111111111111111111111111111112.png",tags:[],priority:2,type:"raydium",extensions:{coingeckoId:"solana"}};var si=class{constructor({mint:e,decimals:t,symbol:n,name:r,skipMint:o=!1,isToken2022:s=!1}){if(e===me.toBase58()||e instanceof br.PublicKey&&me.equals(e)){this.decimals=Me.decimals,this.symbol=Me.symbol,this.name=Me.name,this.mint=new br.PublicKey(Me.address),this.isToken2022=!1;return}this.decimals=t,this.symbol=n||e.toString().substring(0,6),this.name=r||e.toString().substring(0,6),this.mint=o?br.PublicKey.default:ln({publicKey:e}),this.isToken2022=s}equals(e){return this===e?!0:this.mint.equals(e.mint)}},ce=si;ce.WSOL=new si(q(N({},Me),{mint:Me.address}));var Nn=oe(require("big.js")),Vo=oe(require("bn.js")),Eo=oe(require("decimal.js-light"));var Mo=oe(require("toformat")),Au=Mo.default,On=Au;var gr=ae("module/fraction"),ai=On(Nn.default),_n=On(Eo.default),Pu={[0]:_n.ROUND_DOWN,[1]:_n.ROUND_HALF_UP,[2]:_n.ROUND_UP},Tu={[0]:Nn.default.roundDown,[1]:Nn.default.roundHalfUp,[2]:Nn.default.roundUp},ie=class{constructor(e,t=new Vo.default(1)){this.numerator=Y(e),this.denominator=Y(t)}get quotient(){return this.numerator.div(this.denominator)}invert(){return new ie(this.denominator,this.numerator)}add(e){let t=e instanceof ie?e:new ie(Y(e));return this.denominator.eq(t.denominator)?new ie(this.numerator.add(t.numerator),this.denominator):new ie(this.numerator.mul(t.denominator).add(t.numerator.mul(this.denominator)),this.denominator.mul(t.denominator))}sub(e){let t=e instanceof ie?e:new ie(Y(e));return this.denominator.eq(t.denominator)?new ie(this.numerator.sub(t.numerator),this.denominator):new ie(this.numerator.mul(t.denominator).sub(t.numerator.mul(this.denominator)),this.denominator.mul(t.denominator))}mul(e){let t=e instanceof ie?e:new ie(Y(e));return new ie(this.numerator.mul(t.numerator),this.denominator.mul(t.denominator))}div(e){let t=e instanceof ie?e:new ie(Y(e));return new ie(this.numerator.mul(t.denominator),this.denominator.mul(t.numerator))}toSignificant(e,t={groupSeparator:""},n=1){Number.isInteger(e)||gr.logWithError(`${e} is not an integer.`),e<=0&&gr.logWithError(`${e} is not positive.`),_n.set({precision:e+1,rounding:Pu[n]});let r=new _n(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(e);return r.toFormat(r.decimalPlaces(),t)}toFixed(e,t={groupSeparator:""},n=1){return Number.isInteger(e)||gr.logWithError(`${e} is not an integer.`),e<0&&gr.logWithError(`${e} is negative.`),ai.DP=e,ai.RM=Tu[n]||1,new ai(this.numerator.toString()).div(this.denominator.toString()).toFormat(e,t)}isZero(){return this.numerator.isZero()}};var xu=ae("Raydium_price"),$e=class extends ie{constructor(t){let{baseToken:n,quoteToken:r,numerator:o,denominator:s}=t;super(o,s);this.baseToken=n,this.quoteToken=r,this.scalar=new ie(ui(n.decimals),ui(r.decimals))}get raw(){return new ie(this.numerator,this.denominator)}get adjusted(){return super.mul(this.scalar)}invert(){return new $e({baseToken:this.quoteToken,quoteToken:this.baseToken,denominator:this.numerator,numerator:this.denominator})}mul(t){this.quoteToken!==t.baseToken&&xu.logWithError("mul token not equals");let n=super.mul(t);return new $e({baseToken:this.baseToken,quoteToken:t.quoteToken,denominator:n.denominator,numerator:n.numerator})}toSignificant(t=this.quoteToken.decimals,n,r){return this.adjusted.toSignificant(t,n,r)}toFixed(t=this.quoteToken.decimals,n,r){return this.adjusted.toFixed(t,n,r)}};var ci=class{constructor({decimals:e,symbol:t="UNKNOWN",name:n="UNKNOWN"}){this.decimals=e,this.symbol=t,this.name=n}equals(e){return this===e}},wr=ci;wr.SOL=new ci(Je);var vo=oe(require("bn.js"));var Fo=new ie(new vo.default(100)),et=class extends ie{toSignificant(e=5,t,n){return this.mul(Fo).toSignificant(e,t,n)}toFixed(e=2,t,n){return this.mul(Fo).toFixed(e,t,n)}};var He=new Re.default(0),kr=new Re.default(1),Rl=new Re.default(2),Ol=new Re.default(3),Nl=new Re.default(5),hr=new Re.default(10),_l=new Re.default(100),Ml=new Re.default(1e3),Vl=new Re.default(1e4),Wo=9007199254740991;function Y(i){let e=ae("Raydium_parseBigNumberish");if(i instanceof Re.default)return i;if(typeof i=="string"){if(i.match(/^-?[0-9]+$/))return new Re.default(i);e.logWithError(`invalid BigNumberish string: ${i}`)}return typeof i=="number"?(i%1&&e.logWithError(`BigNumberish number underflow: ${i}`),(i>=Wo||i<=-Wo)&&e.logWithError(`BigNumberish number overflow: ${i}`),new Re.default(String(i))):typeof i=="bigint"?new Re.default(i.toString()):(e.error(`invalid BigNumberish value: ${i}`),new Re.default(0))}function ui(i){return hr.pow(Y(i))}function pn(i){var a;if(i===void 0)return{denominator:"1",numerator:"0"};if(i instanceof Re.default)return{numerator:i.toString(),denominator:"1"};if(i instanceof ie)return{denominator:i.denominator.toString(),numerator:i.numerator.toString()};let e=String(i),[,t="",n="",r=""]=(a=e.replace(",","").match(/(-?)(\d*)\.?(\d*)/))!=null?a:[],o="1"+"0".repeat(r.length),s=t+(n==="0"?"":n)+r||"0";return{denominator:o,numerator:s,sign:t,int:n,dec:r}}function Ar(i,e){let t=i.divmod(e);return t.mod.isZero()?t.div:t.div.isNeg()?t.div.isubn(1):t.div.iaddn(1)}function Bu(i){var n;let[,e="",t=""]=(n=i.toFixed(2).match(/(-?)(\d*)\.?(\d*)/))!=null?n:[];return`${e}${t}`}function li(i,e=0){return i instanceof Re.default?i:new Re.default(Bu(Do(i).mul(hr.pow(new Re.default(String(e))))))}function Do(i){if(i instanceof et)return new ie(i.numerator,i.denominator);if(i instanceof $e)return i.adjusted;if(i instanceof we)try{return Do(i.toExact())}catch{return new ie(He)}if(i instanceof ie)return i;let e=String(i),t=pn(e);return new ie(t.numerator,t.denominator)}var Su=ae("Raydium_amount"),Uo=On(Go.default);function Ku(i,e){let t="0",n="0";if(i.includes(".")){let r=i.split(".");r.length===2?([t,n]=r,n=n.padEnd(e,"0")):Su.logWithError(`invalid number string, num: ${i}`)}else t=i;return[t,n.slice(0,e)||n]}var we=class extends ie{constructor(t,n,r=!0,o){let s=new Mn.default(0),a=hr.pow(new Mn.default(t.decimals));if(r)s=Y(n);else{let u=new Mn.default(0),c=new Mn.default(0);if(typeof n=="string"||typeof n=="number"||typeof n=="bigint"){let[l,m]=Ku(n.toString(),t.decimals);u=Y(l),c=Y(m)}u=u.mul(a),s=u.add(c)}super(s,a);this.logger=ae(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 we(this.token,this.raw.add(t.raw))}subtract(t){return this.token.equals(t.token)||this.logger.logWithError("sub token not equals"),new we(this.token,this.raw.sub(t.raw))}toSignificant(t=this.token.decimals,n,r=0){return super.toSignificant(t,n,r)}toFixed(t=this.token.decimals,n,r=0){return t>this.token.decimals&&this.logger.logWithError("decimals overflow"),super.toFixed(t,n,r)}toExact(t={groupSeparator:""}){return Uo.DP=this.token.decimals,new Uo(this.numerator.toString()).div(this.denominator.toString()).toFormat(t)}};function qo(i){return typeof i=="object"&&i!==null&&![ce,we,Xo.PublicKey,ie,zo.default,$e,et].some(e=>typeof e=="object"&&i instanceof e)}function Se(i){return typeof i=="string"?ii(i):Array.isArray(i)?i.map(e=>Se(e)):qo(i)?Object.fromEntries(Object.entries(i).map(([e,t])=>[e,Se(t)])):i}var ye=require("@solana/web3.js"),Jo=oe(require("axios"));var _={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",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"};var We=require("@solana/web3.js"),Qo=require("@solana/spl-token");var Yo=ae("Raydium_txUtil"),jo=1644;function fn(i){let e=[],t=[];return i.microLamports&&(e.push(We.ComputeBudgetProgram.setComputeUnitPrice({microLamports:i.microLamports})),t.push(_.SetComputeUnitPrice)),i.units&&(e.push(We.ComputeBudgetProgram.setComputeUnitLimit({units:i.units})),t.push(_.SetComputeUnitLimit)),{instructions:e,instructionTypes:t}}async function yn(i){var e,t;try{return((t=await((e=i.getLatestBlockhash)==null?void 0:e.call(i)))==null?void 0:t.blockhash)||(await i.getRecentBlockhash()).blockhash}catch{return(await i.getRecentBlockhash()).blockhash}}function Wt(i,e){i.length<1&&Yo.logWithError(`no instructions provided: ${i.toString()}`),e.length<1&&Yo.logWithError(`no signers provided:, ${e.toString()}`);let t=new We.Transaction;t.recentBlockhash="11111111111111111111111111111111",t.feePayer=e[0],t.add(...i);try{return Buffer.from(t.serialize({verifySignatures:!1})).toString("base64").length<jo}catch{return!1}}function ke(i,e){let[t,n]=We.PublicKey.findProgramAddressSync(i,e);return{publicKey:t,nonce:n}}function Vn({instructions:i,payer:e,signers:t}){return Wt(i,[e,...t])}function En({instructions:i,payer:e,lookupTableAddressAccount:t,recentBlockhash:n=We.Keypair.generate().publicKey.toString()}){let o=new We.TransactionMessage({payerKey:e,recentBlockhash:n,instructions:i}).compileToV0Message(Object.values(t!=null?t:{}));try{return Buffer.from(new We.VersionedTransaction(o).serialize()).toString("base64").length<jo}catch{return!1}}var Cu=i=>Buffer.isBuffer(i)?i:i instanceof Uint8Array?Buffer.from(i.buffer,i.byteOffset,i.byteLength):Buffer.from(i);function Zt(i){let e=[];return i.forEach(t=>{t instanceof We.Transaction&&(t.recentBlockhash||(t.recentBlockhash=Qo.TOKEN_PROGRAM_ID.toBase58()),t.feePayer||(t.feePayer=We.Keypair.generate().publicKey));let n=t.serialize({requireAllSignatures:!1,verifySignatures:!1});t instanceof We.VersionedTransaction&&(n=Cu(n));let r=n.toString("base64");e.push(r)}),console.log("simulate tx string:",e),e}var Dt=require("@solana/web3.js");var Ho=require("@solana/web3.js"),Zo=require("@solana/spl-token");var mi=ae("Raydium_accountInfo_util");async function At(i,e,t){let{batchRequest:n,commitment:r="confirmed"}=N({batchRequest:!1},t),o=di(e,100),s=new Array(o.length).fill([]);if(n){let a=o.map(l=>{let m=i._buildArgs([l.map(d=>d.toBase58())],r,"base64");return{methodName:"getMultipleAccounts",args:m}}),u=di(a,10);s=(await(await Promise.all(u.map(async l=>await i._rpcBatchRequest(l)))).flat()).map(l=>(l.error&&mi.logWithError(`failed to get info for multiple accounts, RPC_ERROR, ${l.error.message}`),l.result.value.map(m=>{if(m){let{data:d,executable:p,lamports:y,owner:f,rentEpoch:b}=m;return d.length!==2&&d[1]!=="base64"&&mi.logWithError("info must be base64 encoded, RPC_ERROR"),{data:Buffer.from(d[0],"base64"),executable:p,lamports:y,owner:new Ho.PublicKey(f),rentEpoch:b}}return null})))}else try{s=await Promise.all(o.map(a=>i.getMultipleAccountsInfo(a,r)))}catch(a){a instanceof Error&&mi.logWithError(`failed to get info for multiple accounts, RPC_ERROR, ${a.message}`)}return s.flat()}async function Pr(i,e,t){let n=await At(i,e.map(r=>r.pubkey),t);return e.map((r,o)=>q(N({},r),{accountInfo:n[o]}))}async function pi({connection:i,address:e}){let t=await At(i,[...new Set(e.map(r=>r.toString()))].map(r=>new Dt.PublicKey(r))),n={};for(let r=0;r<e.length;r++){let o=t[r],s=e[r];if(!o)continue;let a=new Dt.AddressLookupTableAccount({key:s,state:Dt.AddressLookupTableAccount.deserialize(o.data)});n[s.toString()]=a,Tr[s.toString()]=a}return n}var Tr={"2immgwYNHBbyVQKVGCEkgWpi53bLwWNRMB5G2nbgYV17":new Dt.AddressLookupTableAccount({key:new Dt.PublicKe