UNPKG

@raydium-io/raydium-sdk-v2

Version:

An SDK for building applications on top of Raydium.

1 lines 87.8 kB
var Wn=Object.defineProperty,qn=Object.defineProperties;var Gn=Object.getOwnPropertyDescriptors;var Ue=Object.getOwnPropertySymbols;var jt=Object.prototype.hasOwnProperty,Zt=Object.prototype.propertyIsEnumerable;var Ht=(e,t,n)=>t in e?Wn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,q=(e,t)=>{for(var n in t||(t={}))jt.call(t,n)&&Ht(e,n,t[n]);if(Ue)for(var n of Ue(t))Zt.call(t,n)&&Ht(e,n,t[n]);return e},ie=(e,t)=>qn(e,Gn(t));var ge=(e,t)=>{var n={};for(var r in e)jt.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ue)for(var r of Ue(e))t.indexOf(r)<0&&Zt.call(e,r)&&(n[r]=e[r]);return n};import{PublicKey as pt,SystemProgram as Fo}from"@solana/web3.js";import{PublicKey as Zn}from"@solana/web3.js";import{get as zt,set as Hn}from"lodash";var mt=class{constructor(t){this.logLevel=t.logLevel!==void 0?t.logLevel:0,this.name=t.name}set level(t){this.logLevel=t}get time(){return Date.now().toString()}get moduleName(){return this.name}isLogLevel(t){return t<=this.logLevel}error(...t){return this.isLogLevel(0)?(console.error(this.time,this.name,"sdk logger error",...t),this):this}logWithError(...t){let n=t.map(r=>typeof r=="object"?JSON.stringify(r):r).join(", ");throw new Error(n)}warning(...t){return this.isLogLevel(1)?(console.warn(this.time,this.name,"sdk logger warning",...t),this):this}info(...t){return this.isLogLevel(2)?(console.info(this.time,this.name,"sdk logger info",...t),this):this}debug(...t){return this.isLogLevel(3)?(console.debug(this.time,this.name,"sdk logger debug",...t),this):this}},Qt={},jn={};function Z(e){let t=zt(Qt,e);if(!t){let n=zt(jn,e);t=new mt({name:e,logLevel:n}),Hn(Qt,e,t)}return t}import{MINT_SIZE as Jo,TOKEN_PROGRAM_ID as Yo,getTransferFeeConfig as $o,unpackMint as ei}from"@solana/spl-token";var dt=Z("Raydium_accountInfo_util");async function Xt(e,t,n){let{batchRequest:r,commitment:o="confirmed",chunkCount:i=100}=q({batchRequest:!1},n),s=ht(t,i),a=new Array(s.length).fill([]);if(r){let u=s.map(f=>{let p=e._buildArgs([f.map(m=>m.toBase58())],o,"base64");return{methodName:"getMultipleAccounts",args:p}}),c=ht(u,10);a=(await(await Promise.all(c.map(async f=>await e._rpcBatchRequest(f)))).flat()).map(f=>(f.error&&dt.logWithError(`failed to get info for multiple accounts, RPC_ERROR, ${f.error.message}`),f.result.value.map(p=>{if(p){let{data:m,executable:d,lamports:g,owner:y,rentEpoch:P}=p;return m.length!==2&&m[1]!=="base64"&&dt.logWithError("info must be base64 encoded, RPC_ERROR"),{data:Buffer.from(m[0],"base64"),executable:d,lamports:g,owner:new Zn(y),rentEpoch:P}}return null})))}else try{a=await Promise.all(s.map(u=>e.getMultipleAccountsInfo(u,o)))}catch(u){u instanceof Error&&dt.logWithError(`failed to get info for multiple accounts, RPC_ERROR, ${u.message}`)}return a.flat()}import oe from"bn.js";var we=9e15,le=1e9,gt="0123456789abcdef",qe="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Ge="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",bt={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-we,maxE:we,crypto:!1},en,ne,I=!0,je="[DecimalError] ",ue=je+"Invalid argument: ",tn=je+"Precision limit exceeded",nn=je+"crypto unavailable",rn="[object Decimal]",z=Math.floor,H=Math.pow,zn=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Qn=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Xn=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,on=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,J=1e7,S=7,Jn=9007199254740991,Yn=qe.length-1,yt=Ge.length-1,h={toStringTag:rn};h.absoluteValue=h.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),k(e)};h.ceil=function(){return k(new this.constructor(this),this.e+1,2)};h.clampedTo=h.clamp=function(e,t){var n,r=this,o=r.constructor;if(e=new o(e),t=new o(t),!e.s||!t.s)return new o(NaN);if(e.gt(t))throw Error(ue+t);return n=r.cmp(e),n<0?e:r.cmp(t)>0?t:new o(r)};h.comparedTo=h.cmp=function(e){var t,n,r,o,i=this,s=i.d,a=(e=new i.constructor(e)).d,u=i.s,c=e.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(i.e!==e.e)return i.e>e.e^u<0?1:-1;for(r=s.length,o=a.length,t=0,n=r<o?r:o;t<n;++t)if(s[t]!==a[t])return s[t]>a[t]^u<0?1:-1;return r===o?0:r>o^u<0?1:-1};h.cosine=h.cos=function(){var e,t,n=this,r=n.constructor;return n.d?n.d[0]?(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+S,r.rounding=1,n=$n(r,ln(r,n)),r.precision=e,r.rounding=t,k(ne==2||ne==3?n.neg():n,e,t,!0)):new r(1):new r(NaN)};h.cubeRoot=h.cbrt=function(){var e,t,n,r,o,i,s,a,u,c,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(I=!1,i=l.s*H(l.s*l,1/3),!i||Math.abs(i)==1/0?(n=j(l.d),e=l.e,(i=(e-n.length+1)%3)&&(n+=i==1||i==-2?"0":"00"),i=H(n,1/3),e=z((e+1)/3)-(e%3==(e<0?-1:2)),i==1/0?n="5e"+e:(n=i.toExponential(),n=n.slice(0,n.indexOf("e")+1)+e),r=new f(n),r.s=l.s):r=new f(i.toString()),s=(e=f.precision)+3;;)if(a=r,u=a.times(a).times(a),c=u.plus(l),r=F(c.plus(l).times(a),c.plus(u),s+2,1),j(a.d).slice(0,s)===(n=j(r.d)).slice(0,s))if(n=n.slice(s-3,s+1),n=="9999"||!o&&n=="4999"){if(!o&&(k(a,e+1,0),a.times(a).times(a).eq(l))){r=a;break}s+=4,o=1}else{(!+n||!+n.slice(1)&&n.charAt(0)=="5")&&(k(r,e+1,1),t=!r.times(r).times(r).eq(l));break}return I=!0,k(r,e,f.rounding,t)};h.decimalPlaces=h.dp=function(){var e,t=this.d,n=NaN;if(t){if(e=t.length-1,n=(e-z(this.e/S))*S,e=t[e],e)for(;e%10==0;e/=10)n--;n<0&&(n=0)}return n};h.dividedBy=h.div=function(e){return F(this,new this.constructor(e))};h.dividedToIntegerBy=h.divToInt=function(e){var t=this,n=t.constructor;return k(F(t,new n(e),0,1,1),n.precision,n.rounding)};h.equals=h.eq=function(e){return this.cmp(e)===0};h.floor=function(){return k(new this.constructor(this),this.e+1,3)};h.greaterThan=h.gt=function(e){return this.cmp(e)>0};h.greaterThanOrEqualTo=h.gte=function(e){var t=this.cmp(e);return t==1||t===0};h.hyperbolicCosine=h.cosh=function(){var e,t,n,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;n=s.precision,r=s.rounding,s.precision=n+Math.max(i.e,i.sd())+4,s.rounding=1,o=i.d.length,o<32?(e=Math.ceil(o/3),t=(1/ze(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),i=Te(s,1,i.times(t),new s(1),!0);for(var u,c=e,l=new s(8);c--;)u=i.times(i),i=a.minus(u.times(l.minus(u.times(l))));return k(i,s.precision=n,s.rounding=r,!0)};h.hyperbolicSine=h.sinh=function(){var e,t,n,r,o=this,i=o.constructor;if(!o.isFinite()||o.isZero())return new i(o);if(t=i.precision,n=i.rounding,i.precision=t+Math.max(o.e,o.sd())+4,i.rounding=1,r=o.d.length,r<3)o=Te(i,2,o,o,!0);else{e=1.4*Math.sqrt(r),e=e>16?16:e|0,o=o.times(1/ze(5,e)),o=Te(i,2,o,o,!0);for(var s,a=new i(5),u=new i(16),c=new i(20);e--;)s=o.times(o),o=o.times(a.plus(s.times(u.times(s).plus(c))))}return i.precision=t,i.rounding=n,k(o,t,n,!0)};h.hyperbolicTangent=h.tanh=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+7,r.rounding=1,F(n.sinh(),n.cosh(),r.precision=e,r.rounding=t)):new r(n.s)};h.inverseCosine=h.acos=function(){var e,t=this,n=t.constructor,r=t.abs().cmp(1),o=n.precision,i=n.rounding;return r!==-1?r===0?t.isNeg()?X(n,o,i):new n(0):new n(NaN):t.isZero()?X(n,o+4,i).times(.5):(n.precision=o+6,n.rounding=1,t=t.asin(),e=X(n,o+4,i).times(.5),n.precision=o,n.rounding=i,e.minus(t))};h.inverseHyperbolicCosine=h.acosh=function(){var e,t,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(e=r.precision,t=r.rounding,r.precision=e+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,I=!1,n=n.times(n).minus(1).sqrt().plus(n),I=!0,r.precision=e,r.rounding=t,n.ln()):new r(n)};h.inverseHyperbolicSine=h.asinh=function(){var e,t,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,I=!1,n=n.times(n).plus(1).sqrt().plus(n),I=!0,r.precision=e,r.rounding=t,n.ln())};h.inverseHyperbolicTangent=h.atanh=function(){var e,t,n,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,t=i.rounding,r=o.sd(),Math.max(r,e)<2*-o.e-1?k(new i(o),e,t,!0):(i.precision=n=r-o.e,o=F(o.plus(1),new i(1).minus(o),n+e,1),i.precision=e+4,i.rounding=1,o=o.ln(),i.precision=e,i.rounding=t,o.times(.5))):new i(NaN)};h.inverseSine=h.asin=function(){var e,t,n,r,o=this,i=o.constructor;return o.isZero()?new i(o):(t=o.abs().cmp(1),n=i.precision,r=i.rounding,t!==-1?t===0?(e=X(i,n+4,r).times(.5),e.s=o.s,e):new i(NaN):(i.precision=n+6,i.rounding=1,o=o.div(new i(1).minus(o.times(o)).sqrt().plus(1)).atan(),i.precision=n,i.rounding=r,o.times(2)))};h.inverseTangent=h.atan=function(){var e,t,n,r,o,i,s,a,u,c=this,l=c.constructor,f=l.precision,p=l.rounding;if(c.isFinite()){if(c.isZero())return new l(c);if(c.abs().eq(1)&&f+4<=yt)return s=X(l,f+4,p).times(.25),s.s=c.s,s}else{if(!c.s)return new l(NaN);if(f+4<=yt)return s=X(l,f+4,p).times(.5),s.s=c.s,s}for(l.precision=a=f+10,l.rounding=1,n=Math.min(28,a/S+2|0),e=n;e;--e)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(I=!1,t=Math.ceil(a/S),r=1,u=c.times(c),s=new l(c),o=c;e!==-1;)if(o=o.times(u),i=s.minus(o.div(r+=2)),o=o.times(u),s=i.plus(o.div(r+=2)),s.d[t]!==void 0)for(e=t;s.d[e]===i.d[e]&&e--;);return n&&(s=s.times(2<<n-1)),I=!0,k(s,l.precision=f,l.rounding=p,!0)};h.isFinite=function(){return!!this.d};h.isInteger=h.isInt=function(){return!!this.d&&z(this.e/S)>this.d.length-2};h.isNaN=function(){return!this.s};h.isNegative=h.isNeg=function(){return this.s<0};h.isPositive=h.isPos=function(){return this.s>0};h.isZero=function(){return!!this.d&&this.d[0]===0};h.lessThan=h.lt=function(e){return this.cmp(e)<0};h.lessThanOrEqualTo=h.lte=function(e){return this.cmp(e)<1};h.logarithm=h.log=function(e){var t,n,r,o,i,s,a,u,c=this,l=c.constructor,f=l.precision,p=l.rounding,m=5;if(e==null)e=new l(10),t=!0;else{if(e=new l(e),n=e.d,e.s<0||!n||!n[0]||e.eq(1))return new l(NaN);t=e.eq(10)}if(n=c.d,c.s<0||!n||!n[0]||c.eq(1))return new l(n&&!n[0]?-1/0:c.s!=1?NaN:n?0:1/0);if(t)if(n.length>1)i=!0;else{for(o=n[0];o%10===0;)o/=10;i=o!==1}if(I=!1,a=f+m,s=ce(c,a),r=t?He(l,a+10):ce(e,a),u=F(s,r,a,1),Ce(u.d,o=f,p))do if(a+=10,s=ce(c,a),r=t?He(l,a+10):ce(e,a),u=F(s,r,a,1),!i){+j(u.d).slice(o+1,o+15)+1==1e14&&(u=k(u,f+1,0));break}while(Ce(u.d,o+=10,p));return I=!0,k(u,f,p)};h.minus=h.sub=function(e){var t,n,r,o,i,s,a,u,c,l,f,p,m=this,d=m.constructor;if(e=new d(e),!m.d||!e.d)return!m.s||!e.s?e=new d(NaN):m.d?e.s=-e.s:e=new d(e.d||m.s!==e.s?m:NaN),e;if(m.s!=e.s)return e.s=-e.s,m.plus(e);if(c=m.d,p=e.d,a=d.precision,u=d.rounding,!c[0]||!p[0]){if(p[0])e.s=-e.s;else if(c[0])e=new d(m);else return new d(u===3?-0:0);return I?k(e,a,u):e}if(n=z(e.e/S),l=z(m.e/S),c=c.slice(),i=l-n,i){for(f=i<0,f?(t=c,i=-i,s=p.length):(t=p,n=l,s=c.length),r=Math.max(Math.ceil(a/S),s)+2,i>r&&(i=r,t.length=1),t.reverse(),r=i;r--;)t.push(0);t.reverse()}else{for(r=c.length,s=p.length,f=r<s,f&&(s=r),r=0;r<s;r++)if(c[r]!=p[r]){f=c[r]<p[r];break}i=0}for(f&&(t=c,c=p,p=t,e.s=-e.s),s=c.length,r=p.length-s;r>0;--r)c[s++]=0;for(r=p.length;r>i;){if(c[--r]<p[r]){for(o=r;o&&c[--o]===0;)c[o]=J-1;--c[o],c[r]+=J}c[r]-=p[r]}for(;c[--s]===0;)c.pop();for(;c[0]===0;c.shift())--n;return c[0]?(e.d=c,e.e=Ze(c,n),I?k(e,a,u):e):new d(u===3?-0:0)};h.modulo=h.mod=function(e){var t,n=this,r=n.constructor;return e=new r(e),!n.d||!e.s||e.d&&!e.d[0]?new r(NaN):!e.d||n.d&&!n.d[0]?k(new r(n),r.precision,r.rounding):(I=!1,r.modulo==9?(t=F(n,e.abs(),0,3,1),t.s*=e.s):t=F(n,e,0,r.modulo,1),t=t.times(e),I=!0,n.minus(t))};h.naturalExponential=h.exp=function(){return wt(this)};h.naturalLogarithm=h.ln=function(){return ce(this)};h.negated=h.neg=function(){var e=new this.constructor(this);return e.s=-e.s,k(e)};h.plus=h.add=function(e){var t,n,r,o,i,s,a,u,c,l,f=this,p=f.constructor;if(e=new p(e),!f.d||!e.d)return!f.s||!e.s?e=new p(NaN):f.d||(e=new p(e.d||f.s===e.s?f:NaN)),e;if(f.s!=e.s)return e.s=-e.s,f.minus(e);if(c=f.d,l=e.d,a=p.precision,u=p.rounding,!c[0]||!l[0])return l[0]||(e=new p(f)),I?k(e,a,u):e;if(i=z(f.e/S),r=z(e.e/S),c=c.slice(),o=i-r,o){for(o<0?(n=c,o=-o,s=l.length):(n=l,r=i,s=c.length),i=Math.ceil(a/S),s=i>s?i+1:s+1,o>s&&(o=s,n.length=1),n.reverse();o--;)n.push(0);n.reverse()}for(s=c.length,o=l.length,s-o<0&&(o=s,n=l,l=c,c=n),t=0;o;)t=(c[--o]=c[o]+l[o]+t)/J|0,c[o]%=J;for(t&&(c.unshift(t),++r),s=c.length;c[--s]==0;)c.pop();return e.d=c,e.e=Ze(c,r),I?k(e,a,u):e};h.precision=h.sd=function(e){var t,n=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(ue+e);return n.d?(t=sn(n.d),e&&n.e+1>t&&(t=n.e+1)):t=NaN,t};h.round=function(){var e=this,t=e.constructor;return k(new t(e),e.e+1,t.rounding)};h.sine=h.sin=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+S,r.rounding=1,n=tr(r,ln(r,n)),r.precision=e,r.rounding=t,k(ne>2?n.neg():n,e,t,!0)):new r(NaN)};h.squareRoot=h.sqrt=function(){var e,t,n,r,o,i,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(I=!1,c=Math.sqrt(+s),c==0||c==1/0?(t=j(a),(t.length+u)%2==0&&(t+="0"),c=Math.sqrt(t),u=z((u+1)/2)-(u<0||u%2),c==1/0?t="5e"+u:(t=c.toExponential(),t=t.slice(0,t.indexOf("e")+1)+u),r=new l(t)):r=new l(c.toString()),n=(u=l.precision)+3;;)if(i=r,r=i.plus(F(s,i,n+2,1)).times(.5),j(i.d).slice(0,n)===(t=j(r.d)).slice(0,n))if(t=t.slice(n-3,n+1),t=="9999"||!o&&t=="4999"){if(!o&&(k(i,u+1,0),i.times(i).eq(s))){r=i;break}n+=4,o=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(k(r,u+1,1),e=!r.times(r).eq(s));break}return I=!0,k(r,u,l.rounding,e)};h.tangent=h.tan=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+10,r.rounding=1,n=n.sin(),n.s=1,n=F(n,new r(1).minus(n.times(n)).sqrt(),e+10,0),r.precision=e,r.rounding=t,k(ne==2||ne==4?n.neg():n,e,t,!0)):new r(NaN)};h.times=h.mul=function(e){var t,n,r,o,i,s,a,u,c,l=this,f=l.constructor,p=l.d,m=(e=new f(e)).d;if(e.s*=l.s,!p||!p[0]||!m||!m[0])return new f(!e.s||p&&!p[0]&&!m||m&&!m[0]&&!p?NaN:!p||!m?e.s/0:e.s*0);for(n=z(l.e/S)+z(e.e/S),u=p.length,c=m.length,u<c&&(i=p,p=m,m=i,s=u,u=c,c=s),i=[],s=u+c,r=s;r--;)i.push(0);for(r=c;--r>=0;){for(t=0,o=u+r;o>r;)a=i[o]+m[r]*p[o-r-1]+t,i[o--]=a%J|0,t=a/J|0;i[o]=(i[o]+t)%J|0}for(;!i[--s];)i.pop();return t?++n:i.shift(),e.d=i,e.e=Ze(i,n),I?k(e,f.precision,f.rounding):e};h.toBinary=function(e,t){return xt(this,2,e,t)};h.toDecimalPlaces=h.toDP=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(Q(e,0,le),t===void 0?t=r.rounding:Q(t,0,8),k(n,e+n.e+1,t))};h.toExponential=function(e,t){var n,r=this,o=r.constructor;return e===void 0?n=ee(r,!0):(Q(e,0,le),t===void 0?t=o.rounding:Q(t,0,8),r=k(new o(r),e+1,t),n=ee(r,!0,e+1)),r.isNeg()&&!r.isZero()?"-"+n:n};h.toFixed=function(e,t){var n,r,o=this,i=o.constructor;return e===void 0?n=ee(o):(Q(e,0,le),t===void 0?t=i.rounding:Q(t,0,8),r=k(new i(o),e+o.e+1,t),n=ee(r,!1,e+r.e+1)),o.isNeg()&&!o.isZero()?"-"+n:n};h.toFraction=function(e){var t,n,r,o,i,s,a,u,c,l,f,p,m=this,d=m.d,g=m.constructor;if(!d)return new g(m);if(c=n=new g(1),r=u=new g(0),t=new g(r),i=t.e=sn(d)-m.e-1,s=i%S,t.d[0]=H(10,s<0?S+s:s),e==null)e=i>0?t:c;else{if(a=new g(e),!a.isInt()||a.lt(c))throw Error(ue+a);e=a.gt(t)?i>0?t:c:a}for(I=!1,a=new g(j(d)),l=g.precision,g.precision=i=d.length*S*2;f=F(a,t,0,1,1),o=n.plus(f.times(r)),o.cmp(e)!=1;)n=r,r=o,o=c,c=u.plus(f.times(o)),u=o,o=t,t=a.minus(f.times(o)),a=o;return o=F(e.minus(n),r,0,1,1),u=u.plus(o.times(c)),n=n.plus(o.times(r)),u.s=c.s=m.s,p=F(c,r,i,1).minus(m).abs().cmp(F(u,n,i,1).minus(m).abs())<1?[c,r]:[u,n],g.precision=l,I=!0,p};h.toHexadecimal=h.toHex=function(e,t){return xt(this,16,e,t)};h.toNearest=function(e,t){var n=this,r=n.constructor;if(n=new r(n),e==null){if(!n.d)return n;e=new r(1),t=r.rounding}else{if(e=new r(e),t===void 0?t=r.rounding:Q(t,0,8),!n.d)return e.s?n:e;if(!e.d)return e.s&&(e.s=n.s),e}return e.d[0]?(I=!1,n=F(n,e,0,t,1).times(e),I=!0,k(n)):(e.s=n.s,n=e),n};h.toNumber=function(){return+this};h.toOctal=function(e,t){return xt(this,8,e,t)};h.toPower=h.pow=function(e){var t,n,r,o,i,s,a=this,u=a.constructor,c=+(e=new u(e));if(!a.d||!e.d||!a.d[0]||!e.d[0])return new u(H(+a,c));if(a=new u(a),a.eq(1))return a;if(r=u.precision,i=u.rounding,e.eq(1))return k(a,r,i);if(t=z(e.e/S),t>=e.d.length-1&&(n=c<0?-c:c)<=Jn)return o=an(u,a,n,r),e.s<0?new u(1).div(o):k(o,r,i);if(s=a.s,s<0){if(t<e.d.length-1)return new u(NaN);if((e.d[t]&1)==0&&(s=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=s,a}return n=H(+a,c),t=n==0||!isFinite(n)?z(c*(Math.log("0."+j(a.d))/Math.LN10+a.e+1)):new u(n+"").e,t>u.maxE+1||t<u.minE-1?new u(t>0?s/0:0):(I=!1,u.rounding=a.s=1,n=Math.min(12,(t+"").length),o=wt(e.times(ce(a,r+n)),r),o.d&&(o=k(o,r+5,1),Ce(o.d,r,i)&&(t=r+10,o=k(wt(e.times(ce(a,t+n)),t),t+5,1),+j(o.d).slice(r+1,r+15)+1==1e14&&(o=k(o,r+1,0)))),o.s=s,I=!0,u.rounding=i,k(o,r,i))};h.toPrecision=function(e,t){var n,r=this,o=r.constructor;return e===void 0?n=ee(r,r.e<=o.toExpNeg||r.e>=o.toExpPos):(Q(e,1,le),t===void 0?t=o.rounding:Q(t,0,8),r=k(new o(r),e,t),n=ee(r,e<=r.e||r.e<=o.toExpNeg,e)),r.isNeg()&&!r.isZero()?"-"+n:n};h.toSignificantDigits=h.toSD=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(Q(e,1,le),t===void 0?t=r.rounding:Q(t,0,8)),k(new r(n),e,t)};h.toString=function(){var e=this,t=e.constructor,n=ee(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+n:n};h.truncated=h.trunc=function(){return k(new this.constructor(this),this.e+1,1)};h.valueOf=h.toJSON=function(){var e=this,t=e.constructor,n=ee(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+n:n};function j(e){var t,n,r,o=e.length-1,i="",s=e[0];if(o>0){for(i+=s,t=1;t<o;t++)r=e[t]+"",n=S-r.length,n&&(i+=ae(n)),i+=r;s=e[t],r=s+"",n=S-r.length,n&&(i+=ae(n))}else if(s===0)return"0";for(;s%10===0;)s/=10;return i+s}function Q(e,t,n){if(e!==~~e||e<t||e>n)throw Error(ue+e)}function Ce(e,t,n,r){var o,i,s,a;for(i=e[0];i>=10;i/=10)--t;return--t<0?(t+=S,o=0):(o=Math.ceil((t+1)/S),t%=S),i=H(10,S-t),a=e[o]%i|0,r==null?t<3?(t==0?a=a/100|0:t==1&&(a=a/10|0),s=n<4&&a==99999||n>3&&a==49999||a==5e4||a==0):s=(n<4&&a+1==i||n>3&&a+1==i/2)&&(e[o+1]/i/100|0)==H(10,t-2)-1||(a==i/2||a==0)&&(e[o+1]/i/100|0)==0:t<4?(t==0?a=a/1e3|0:t==1?a=a/100|0:t==2&&(a=a/10|0),s=(r||n<4)&&a==9999||!r&&n>3&&a==4999):s=((r||n<4)&&a+1==i||!r&&n>3&&a+1==i/2)&&(e[o+1]/i/1e3|0)==H(10,t-3)-1,s}function We(e,t,n){for(var r,o=[0],i,s=0,a=e.length;s<a;){for(i=o.length;i--;)o[i]*=t;for(o[0]+=gt.indexOf(e.charAt(s++)),r=0;r<o.length;r++)o[r]>n-1&&(o[r+1]===void 0&&(o[r+1]=0),o[r+1]+=o[r]/n|0,o[r]%=n)}return o.reverse()}function $n(e,t){var n,r,o;if(t.isZero())return t;r=t.d.length,r<32?(n=Math.ceil(r/3),o=(1/ze(4,n)).toString()):(n=16,o="2.3283064365386962890625e-10"),e.precision+=n,t=Te(e,1,t.times(o),new e(1));for(var i=n;i--;){var s=t.times(t);t=s.times(s).minus(s).times(8).plus(1)}return e.precision-=n,t}var F=function(){function e(r,o,i){var s,a=0,u=r.length;for(r=r.slice();u--;)s=r[u]*o+a,r[u]=s%i|0,a=s/i|0;return a&&r.unshift(a),r}function t(r,o,i,s){var a,u;if(i!=s)u=i>s?1:-1;else for(a=u=0;a<i;a++)if(r[a]!=o[a]){u=r[a]>o[a]?1:-1;break}return u}function n(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,u){var c,l,f,p,m,d,g,y,P,A,w,T,b,x,N,C,_,O,D,M,v=r.constructor,V=r.s==o.s?1:-1,K=r.d,B=o.d;if(!K||!K[0]||!B||!B[0])return new v(!r.s||!o.s||(K?B&&K[0]==B[0]:!B)?NaN:K&&K[0]==0||!B?V*0:V/0);for(u?(m=1,l=r.e-o.e):(u=J,m=S,l=z(r.e/m)-z(o.e/m)),D=B.length,_=K.length,P=new v(V),A=P.d=[],f=0;B[f]==(K[f]||0);f++);if(B[f]>(K[f]||0)&&l--,i==null?(x=i=v.precision,s=v.rounding):a?x=i+(r.e-o.e)+1:x=i,x<0)A.push(1),d=!0;else{if(x=x/m+2|0,f=0,D==1){for(p=0,B=B[0],x++;(f<_||p)&&x--;f++)N=p*u+(K[f]||0),A[f]=N/B|0,p=N%B|0;d=p||f<_}else{for(p=u/(B[0]+1)|0,p>1&&(B=e(B,p,u),K=e(K,p,u),D=B.length,_=K.length),C=D,w=K.slice(0,D),T=w.length;T<D;)w[T++]=0;M=B.slice(),M.unshift(0),O=B[0],B[1]>=u/2&&++O;do p=0,c=t(B,w,D,T),c<0?(b=w[0],D!=T&&(b=b*u+(w[1]||0)),p=b/O|0,p>1?(p>=u&&(p=u-1),g=e(B,p,u),y=g.length,T=w.length,c=t(g,w,y,T),c==1&&(p--,n(g,D<y?M:B,y,u))):(p==0&&(c=p=1),g=B.slice()),y=g.length,y<T&&g.unshift(0),n(w,g,T,u),c==-1&&(T=w.length,c=t(B,w,D,T),c<1&&(p++,n(w,D<T?M:B,T,u))),T=w.length):c===0&&(p++,w=[0]),A[f++]=p,c&&w[0]?w[T++]=K[C]||0:(w=[K[C]],T=1);while((C++<_||w[0]!==void 0)&&x--);d=w[0]!==void 0}A[0]||A.shift()}if(m==1)P.e=l,en=d;else{for(f=1,p=A[0];p>=10;p/=10)f++;P.e=f+l*m-1,k(P,a?i+P.e+1:i,s,d)}return P}}();function k(e,t,n,r){var o,i,s,a,u,c,l,f,p,m=e.constructor;e:if(t!=null){if(f=e.d,!f)return e;for(o=1,a=f[0];a>=10;a/=10)o++;if(i=t-o,i<0)i+=S,s=t,l=f[p=0],u=l/H(10,o-s-1)%10|0;else if(p=Math.ceil((i+1)/S),a=f.length,p>=a)if(r){for(;a++<=p;)f.push(0);l=u=0,o=1,i%=S,s=i-S+1}else break e;else{for(l=a=f[p],o=1;a>=10;a/=10)o++;i%=S,s=i-S+o,u=s<0?0:l/H(10,o-s-1)%10|0}if(r=r||t<0||f[p+1]!==void 0||(s<0?l:l%H(10,o-s-1)),c=n<4?(u||r)&&(n==0||n==(e.s<0?3:2)):u>5||u==5&&(n==4||r||n==6&&(i>0?s>0?l/H(10,o-s):0:f[p-1])%10&1||n==(e.s<0?8:7)),t<1||!f[0])return f.length=0,c?(t-=e.e+1,f[0]=H(10,(S-t%S)%S),e.e=-t||0):f[0]=e.e=0,e;if(i==0?(f.length=p,a=1,p--):(f.length=p+1,a=H(10,S-i),f[p]=s>0?(l/H(10,o-s)%H(10,s)|0)*a:0),c)for(;;)if(p==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]==J&&(f[0]=1));break}else{if(f[p]+=a,f[p]!=J)break;f[p--]=0,a=1}for(i=f.length;f[--i]===0;)f.pop()}return I&&(e.e>m.maxE?(e.d=null,e.e=NaN):e.e<m.minE&&(e.e=0,e.d=[0])),e}function ee(e,t,n){if(!e.isFinite())return un(e);var r,o=e.e,i=j(e.d),s=i.length;return t?(n&&(r=n-s)>0?i=i.charAt(0)+"."+i.slice(1)+ae(r):s>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(e.e<0?"e":"e+")+e.e):o<0?(i="0."+ae(-o-1)+i,n&&(r=n-s)>0&&(i+=ae(r))):o>=s?(i+=ae(o+1-s),n&&(r=n-o-1)>0&&(i=i+"."+ae(r))):((r=o+1)<s&&(i=i.slice(0,r)+"."+i.slice(r)),n&&(r=n-s)>0&&(o+1===s&&(i+="."),i+=ae(r))),i}function Ze(e,t){var n=e[0];for(t*=S;n>=10;n/=10)t++;return t}function He(e,t,n){if(t>Yn)throw I=!0,n&&(e.precision=n),Error(tn);return k(new e(qe),t,1,!0)}function X(e,t,n){if(t>yt)throw Error(tn);return k(new e(Ge),t,n,!0)}function sn(e){var t=e.length-1,n=t*S+1;if(t=e[t],t){for(;t%10==0;t/=10)n--;for(t=e[0];t>=10;t/=10)n++}return n}function ae(e){for(var t="";e--;)t+="0";return t}function an(e,t,n,r){var o,i=new e(1),s=Math.ceil(r/S+4);for(I=!1;;){if(n%2&&(i=i.times(t),Yt(i.d,s)&&(o=!0)),n=z(n/2),n===0){n=i.d.length-1,o&&i.d[n]===0&&++i.d[n];break}t=t.times(t),Yt(t.d,s)}return I=!0,i}function Jt(e){return e.d[e.d.length-1]&1}function cn(e,t,n){for(var r,o=new e(t[0]),i=0;++i<t.length;)if(r=new e(t[i]),r.s)o[n](r)&&(o=r);else{o=r;break}return o}function wt(e,t){var n,r,o,i,s,a,u,c=0,l=0,f=0,p=e.constructor,m=p.rounding,d=p.precision;if(!e.d||!e.d[0]||e.e>17)return new p(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:0/0);for(t==null?(I=!1,u=d):u=t,a=new p(.03125);e.e>-2;)e=e.times(a),f+=5;for(r=Math.log(H(2,f))/Math.LN10*2+5|0,u+=r,n=i=s=new p(1),p.precision=u;;){if(i=k(i.times(e),u,1),n=n.times(++l),a=s.plus(F(i,n,u,1)),j(a.d).slice(0,u)===j(s.d).slice(0,u)){for(o=f;o--;)s=k(s.times(s),u,1);if(t==null)if(c<3&&Ce(s.d,u-r,m,c))p.precision=u+=10,n=i=a=new p(1),l=0,c++;else return k(s,p.precision=d,m,I=!0);else return p.precision=d,s}s=a}}function ce(e,t){var n,r,o,i,s,a,u,c,l,f,p,m=1,d=10,g=e,y=g.d,P=g.constructor,A=P.rounding,w=P.precision;if(g.s<0||!y||!y[0]||!g.e&&y[0]==1&&y.length==1)return new P(y&&!y[0]?-1/0:g.s!=1?NaN:y?0:g);if(t==null?(I=!1,l=w):l=t,P.precision=l+=d,n=j(y),r=n.charAt(0),Math.abs(i=g.e)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)g=g.times(e),n=j(g.d),r=n.charAt(0),m++;i=g.e,r>1?(g=new P("0."+n),i++):g=new P(r+"."+n.slice(1))}else return c=He(P,l+2,w).times(i+""),g=ce(new P(r+"."+n.slice(1)),l-d).plus(c),P.precision=w,t==null?k(g,w,A,I=!0):g;for(f=g,u=s=g=F(g.minus(1),g.plus(1),l,1),p=k(g.times(g),l,1),o=3;;){if(s=k(s.times(p),l,1),c=u.plus(F(s,new P(o),l,1)),j(c.d).slice(0,l)===j(u.d).slice(0,l))if(u=u.times(2),i!==0&&(u=u.plus(He(P,l+2,w).times(i+""))),u=F(u,new P(m),l,1),t==null)if(Ce(u.d,l-d,A,a))P.precision=l+=d,c=s=g=F(f.minus(1),f.plus(1),l,1),p=k(g.times(g),l,1),o=a=1;else return k(u,P.precision=w,A,I=!0);else return P.precision=w,u;u=c,o+=2}}function un(e){return String(e.s*e.s/0)}function Tt(e,t){var n,r,o;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;r++);for(o=t.length;t.charCodeAt(o-1)===48;--o);if(t=t.slice(r,o),t){if(o-=r,e.e=n=n-r-1,e.d=[],r=(n+1)%S,n<0&&(r+=S),r<o){for(r&&e.d.push(+t.slice(0,r)),o-=S;r<o;)e.d.push(+t.slice(r,r+=S));t=t.slice(r),r=S-t.length}else r-=o;for(;r--;)t+="0";e.d.push(+t),I&&(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 er(e,t){var n,r,o,i,s,a,u,c,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),on.test(t))return Tt(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(Qn.test(t))n=16,t=t.toLowerCase();else if(zn.test(t))n=2;else if(Xn.test(t))n=8;else throw Error(ue+t);for(i=t.search(/p/i),i>0?(u=+t.slice(i+1),t=t.substring(2,i)):t=t.slice(2),i=t.indexOf("."),s=i>=0,r=e.constructor,s&&(t=t.replace(".",""),a=t.length,i=a-i,o=an(r,new r(n),i,i*2)),c=We(t,n,J),l=c.length-1,i=l;c[i]===0;--i)c.pop();return i<0?new r(e.s*0):(e.e=Ze(c,l),e.d=c,I=!1,s&&(e=F(e,o,a*4)),u&&(e=e.times(Math.abs(u)<54?H(2,u):Qe.pow(2,u))),I=!0,e)}function tr(e,t){var n,r=t.d.length;if(r<3)return t.isZero()?t:Te(e,2,t,t);n=1.4*Math.sqrt(r),n=n>16?16:n|0,t=t.times(1/ze(5,n)),t=Te(e,2,t,t);for(var o,i=new e(5),s=new e(16),a=new e(20);n--;)o=t.times(t),t=t.times(i.plus(o.times(s.times(o).minus(a))));return t}function Te(e,t,n,r,o){var i,s,a,u,c=1,l=e.precision,f=Math.ceil(l/S);for(I=!1,u=n.times(n),a=new e(r);;){if(s=F(a.times(u),new e(t++*t++),l,1),a=o?r.plus(s):r.minus(s),r=F(s.times(u),new e(t++*t++),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,c++}return I=!0,s.d.length=f+1,s}function ze(e,t){for(var n=e;--t;)n*=e;return n}function ln(e,t){var n,r=t.s<0,o=X(e,e.precision,1),i=o.times(.5);if(t=t.abs(),t.lte(i))return ne=r?4:1,t;if(n=t.divToInt(o),n.isZero())ne=r?3:2;else{if(t=t.minus(n.times(o)),t.lte(i))return ne=Jt(n)?r?2:3:r?4:1,t;ne=Jt(n)?r?1:4:r?3:2}return t.minus(o).abs()}function xt(e,t,n,r){var o,i,s,a,u,c,l,f,p,m=e.constructor,d=n!==void 0;if(d?(Q(n,1,le),r===void 0?r=m.rounding:Q(r,0,8)):(n=m.precision,r=m.rounding),!e.isFinite())l=un(e);else{for(l=ee(e),s=l.indexOf("."),d?(o=2,t==16?n=n*4-3:t==8&&(n=n*3-2)):o=t,s>=0&&(l=l.replace(".",""),p=new m(1),p.e=l.length-s,p.d=We(ee(p),10,o),p.e=p.d.length),f=We(l,10,o),i=u=f.length;f[--u]==0;)f.pop();if(!f[0])l=d?"0p+0":"0";else{if(s<0?i--:(e=new m(e),e.d=f,e.e=i,e=F(e,p,n,r,0,o),f=e.d,i=e.e,c=en),s=f[n],a=o/2,c=c||f[n+1]!==void 0,c=r<4?(s!==void 0||c)&&(r===0||r===(e.s<0?3:2)):s>a||s===a&&(r===4||c||r===6&&f[n-1]&1||r===(e.s<0?8:7)),f.length=n,c)for(;++f[--n]>o-1;)f[n]=0,n||(++i,f.unshift(1));for(u=f.length;!f[u-1];--u);for(s=0,l="";s<u;s++)l+=gt.charAt(f[s]);if(d){if(u>1)if(t==16||t==8){for(s=t==16?4:3,--u;u%s;u++)l+="0";for(f=We(l,o,t),u=f.length;!f[u-1];--u);for(s=1,l="1.";s<u;s++)l+=gt.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>u)for(i-=u;i--;)l+="0";else i<u&&(l=l.slice(0,i)+"."+l.slice(i))}l=(t==16?"0x":t==2?"0b":t==8?"0o":"")+l}return e.s<0?"-"+l:l}function Yt(e,t){if(e.length>t)return e.length=t,!0}function nr(e){return new this(e).abs()}function rr(e){return new this(e).acos()}function or(e){return new this(e).acosh()}function ir(e,t){return new this(e).plus(t)}function sr(e){return new this(e).asin()}function ar(e){return new this(e).asinh()}function cr(e){return new this(e).atan()}function ur(e){return new this(e).atanh()}function lr(e,t){e=new this(e),t=new this(t);var n,r=this.precision,o=this.rounding,i=r+4;return!e.s||!t.s?n=new this(NaN):!e.d&&!t.d?(n=X(this,i,1).times(t.s>0?.25:.75),n.s=e.s):!t.d||e.isZero()?(n=t.s<0?X(this,r,o):new this(0),n.s=e.s):!e.d||t.isZero()?(n=X(this,i,1).times(.5),n.s=e.s):t.s<0?(this.precision=i,this.rounding=1,n=this.atan(F(e,t,i,1)),t=X(this,i,1),this.precision=r,this.rounding=o,n=e.s<0?n.minus(t):n.plus(t)):n=this.atan(F(e,t,i,1)),n}function fr(e){return new this(e).cbrt()}function pr(e){return k(e=new this(e),e.e+1,2)}function mr(e,t,n){return new this(e).clamp(t,n)}function dr(e){if(!e||typeof e!="object")throw Error(je+"Object expected");var t,n,r,o=e.defaults===!0,i=["precision",1,le,"rounding",0,8,"toExpNeg",-we,0,"toExpPos",0,we,"maxE",0,we,"minE",-we,0,"modulo",0,9];for(t=0;t<i.length;t+=3)if(n=i[t],o&&(this[n]=bt[n]),(r=e[n])!==void 0)if(z(r)===r&&r>=i[t+1]&&r<=i[t+2])this[n]=r;else throw Error(ue+n+": "+r);if(n="crypto",o&&(this[n]=bt[n]),(r=e[n])!==void 0)if(r===!0||r===!1||r===0||r===1)if(r)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[n]=!0;else throw Error(nn);else this[n]=!1;else throw Error(ue+n+": "+r);return this}function hr(e){return new this(e).cos()}function gr(e){return new this(e).cosh()}function fn(e){var t,n,r;function o(i){var s,a,u,c=this;if(!(c instanceof o))return new o(i);if(c.constructor=o,$t(i)){c.s=i.s,I?!i.d||i.e>o.maxE?(c.e=NaN,c.d=null):i.e<o.minE?(c.e=0,c.d=[0]):(c.e=i.e,c.d=i.d.slice()):(c.e=i.e,c.d=i.d?i.d.slice():i.d);return}if(u=typeof i,u==="number"){if(i===0){c.s=1/i<0?-1:1,c.e=0,c.d=[0];return}if(i<0?(i=-i,c.s=-1):c.s=1,i===~~i&&i<1e7){for(s=0,a=i;a>=10;a/=10)s++;I?s>o.maxE?(c.e=NaN,c.d=null):s<o.minE?(c.e=0,c.d=[0]):(c.e=s,c.d=[i]):(c.e=s,c.d=[i]);return}else if(i*0!==0){i||(c.s=NaN),c.e=NaN,c.d=null;return}return Tt(c,i.toString())}else if(u!=="string")throw Error(ue+i);return(a=i.charCodeAt(0))===45?(i=i.slice(1),c.s=-1):(a===43&&(i=i.slice(1)),c.s=1),on.test(i)?Tt(c,i):er(c,i)}if(o.prototype=h,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=dr,o.clone=fn,o.isDecimal=$t,o.abs=nr,o.acos=rr,o.acosh=or,o.add=ir,o.asin=sr,o.asinh=ar,o.atan=cr,o.atanh=ur,o.atan2=lr,o.cbrt=fr,o.ceil=pr,o.clamp=mr,o.cos=hr,o.cosh=gr,o.div=br,o.exp=yr,o.floor=wr,o.hypot=Tr,o.ln=xr,o.log=Pr,o.log10=kr,o.log2=Ar,o.max=Sr,o.min=Cr,o.mod=Ir,o.mul=Lr,o.pow=Br,o.random=Nr,o.round=Er,o.sign=Rr,o.sin=_r,o.sinh=Mr,o.sqrt=Dr,o.sub=vr,o.sum=Or,o.tan=Kr,o.tanh=Fr,o.trunc=Vr,e===void 0&&(e={}),e&&e.defaults!==!0)for(r=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],t=0;t<r.length;)e.hasOwnProperty(n=r[t++])||(e[n]=this[n]);return o.config(e),o}function br(e,t){return new this(e).div(t)}function yr(e){return new this(e).exp()}function wr(e){return k(e=new this(e),e.e+1,3)}function Tr(){var e,t,n=new this(0);for(I=!1,e=0;e<arguments.length;)if(t=new this(arguments[e++]),t.d)n.d&&(n=n.plus(t.times(t)));else{if(t.s)return I=!0,new this(1/0);n=t}return I=!0,n.sqrt()}function $t(e){return e instanceof Qe||e&&e.toStringTag===rn||!1}function xr(e){return new this(e).ln()}function Pr(e,t){return new this(e).log(t)}function Ar(e){return new this(e).log(2)}function kr(e){return new this(e).log(10)}function Sr(){return cn(this,arguments,"lt")}function Cr(){return cn(this,arguments,"gt")}function Ir(e,t){return new this(e).mod(t)}function Lr(e,t){return new this(e).mul(t)}function Br(e,t){return new this(e).pow(t)}function Nr(e){var t,n,r,o,i=0,s=new this(1),a=[];if(e===void 0?e=this.precision:Q(e,1,le),r=Math.ceil(e/S),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(r));i<r;)o=t[i],o>=429e7?t[i]=crypto.getRandomValues(new Uint32Array(1))[0]:a[i++]=o%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(r*=4);i<r;)o=t[i]+(t[i+1]<<8)+(t[i+2]<<16)+((t[i+3]&127)<<24),o>=214e7?crypto.randomBytes(4).copy(t,i):(a.push(o%1e7),i+=4);i=r/4}else throw Error(nn);else for(;i<r;)a[i++]=Math.random()*1e7|0;for(r=a[--i],e%=S,r&&e&&(o=H(10,S-e),a[i]=(r/o|0)*o);a[i]===0;i--)a.pop();if(i<0)n=0,a=[0];else{for(n=-1;a[0]===0;n-=S)a.shift();for(r=1,o=a[0];o>=10;o/=10)r++;r<S&&(n-=S-r)}return s.e=n,s.d=a,s}function Er(e){return k(e=new this(e),e.e+1,this.rounding)}function Rr(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function _r(e){return new this(e).sin()}function Mr(e){return new this(e).sinh()}function Dr(e){return new this(e).sqrt()}function vr(e,t){return new this(e).sub(t)}function Or(){var e=0,t=arguments,n=new this(t[e]);for(I=!1;n.s&&++e<t.length;)n=n.plus(t[e]);return I=!0,k(n,this.precision,this.rounding)}function Kr(e){return new this(e).tan()}function Fr(e){return new this(e).tanh()}function Vr(e){return k(e=new this(e),e.e+1,1)}h[Symbol.for("nodejs.util.inspect.custom")]=h.toString;h[Symbol.toStringTag]="Decimal";var Qe=h.constructor=fn(bt);qe=new Qe(qe);Ge=new Qe(Ge);import zr from"big.js";import wi from"bn.js";import Ur from"toformat";var Wr=Ur,Ie=Wr;import Je from"big.js";import Gr from"bn.js";import Hr from"decimal.js-light";import Le from"bn.js";var pn=9007199254740991;function Y(e){let t=Z("Raydium_parseBigNumberish");if(e instanceof Le)return e;if(typeof e=="string"){if(e.match(/^-?[0-9]+$/))return new Le(e);t.logWithError(`invalid BigNumberish string: ${e}`)}return typeof e=="number"?(e%1&&t.logWithError(`BigNumberish number underflow: ${e}`),(e>=pn||e<=-pn)&&t.logWithError(`BigNumberish number overflow: ${e}`),new Le(String(e))):typeof e=="bigint"?new Le(e.toString()):(t.error(`invalid BigNumberish value: ${e}`),new Le(0))}var Xe=Z("module/fraction"),Pt=Ie(Je),Be=Ie(Hr),jr={[0]:Be.ROUND_DOWN,[1]:Be.ROUND_HALF_UP,[2]:Be.ROUND_UP},Zr={[0]:Je.roundDown,[1]:Je.roundHalfUp,[2]:Je.roundUp},U=class{constructor(t,n=new Gr(1)){this.numerator=Y(t),this.denominator=Y(n)}get quotient(){return this.numerator.div(this.denominator)}invert(){return new U(this.denominator,this.numerator)}add(t){let n=t instanceof U?t:new U(Y(t));return this.denominator.eq(n.denominator)?new U(this.numerator.add(n.numerator),this.denominator):new U(this.numerator.mul(n.denominator).add(n.numerator.mul(this.denominator)),this.denominator.mul(n.denominator))}sub(t){let n=t instanceof U?t:new U(Y(t));return this.denominator.eq(n.denominator)?new U(this.numerator.sub(n.numerator),this.denominator):new U(this.numerator.mul(n.denominator).sub(n.numerator.mul(this.denominator)),this.denominator.mul(n.denominator))}mul(t){let n=t instanceof U?t:new U(Y(t));return new U(this.numerator.mul(n.numerator),this.denominator.mul(n.denominator))}div(t){let n=t instanceof U?t:new U(Y(t));return new U(this.numerator.mul(n.denominator),this.denominator.mul(n.numerator))}toSignificant(t,n={groupSeparator:""},r=1){Number.isInteger(t)||Xe.logWithError(`${t} is not an integer.`),t<=0&&Xe.logWithError(`${t} is not positive.`),Be.set({precision:t+1,rounding:jr[r]});let o=new Be(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(t);return o.toFormat(o.decimalPlaces(),n)}toFixed(t,n={groupSeparator:""},r=1){return Number.isInteger(t)||Xe.logWithError(`${t} is not an integer.`),t<0&&Xe.logWithError(`${t} is negative.`),Pt.DP=t,Pt.RM=Zr[r]||1,new Pt(this.numerator.toString()).div(this.denominator.toString()).toFormat(t,n)}isZero(){return this.numerator.isZero()}};var Li=Z("Raydium_amount"),Bi=Ie(zr);import{PublicKey as Xr}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as mn}from"@solana/spl-token";var dn={chainId:101,address:Xr.default.toBase58(),programId:mn.toBase58(),decimals:9,symbol:"SOL",name:"solana",logoURI:"https://img-v1.raydium.io/icon/So11111111111111111111111111111111111111112.png",tags:[],priority:2,type:"raydium",extensions:{coingeckoId:"solana"}},re={chainId:101,address:"So11111111111111111111111111111111111111112",programId:mn.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"}};import{PublicKey as kt}from"@solana/web3.js";import{PublicKey as W,SystemProgram as hn,SYSVAR_RENT_PUBKEY as Jr}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as Yr}from"@solana/spl-token";function At({pubkey:e,isSigner:t=!1,isWritable:n=!0}){return{pubkey:e,isWritable:n,isSigner:t}}var Oi=[At({pubkey:Yr,isWritable:!1}),At({pubkey:hn.programId,isWritable:!1}),At({pubkey:Jr,isWritable:!1})];function gn({publicKey:e,transformSol:t}){let n=bn(e.toString());if(n instanceof W)return t&&n.equals(Ne)?se:n;if(t&&n.toString()===Ne.toBase58())return se;if(typeof n=="string"){if(n===W.default.toBase58())return W.default;try{return new W(n)}catch{throw new Error("invalid public key")}}throw new Error("invalid public key")}function bn(e){try{return new W(e)}catch{return e}}var Ki=new W("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),Fi=new W("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),Vi=new W("SysvarRent111111111111111111111111111111111"),Ui=new W("SysvarC1ock11111111111111111111111111111111"),Wi=new W("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),qi=new W("Sysvar1nstructions1111111111111111111111111"),Gi=hn.programId,Hi=new W("4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R"),ji=new W("Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS"),Zi=new W("SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt"),zi=new W("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),Qi=new W("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"),Xi=new W("mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So"),Ji=new W("7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj"),Yi=new W("USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX"),$i=new W("NRVwhjBQiUPYtfDT5zRBVJajzFQHaBUNtC7SNVvqRFa"),es=new W("ANAxByE6G2WjFp7A4NqtWYXb3mgruyzZYg3spfxe6Lbo"),ts=new W("7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs"),se=new W("So11111111111111111111111111111111111111112"),Ne=W.default;var St=class{constructor({mint:t,decimals:n,symbol:r,name:o,skipMint:i=!1,isToken2022:s=!1}){if(t===Ne.toBase58()||t instanceof kt&&Ne.equals(t)){this.decimals=re.decimals,this.symbol=re.symbol,this.name=re.name,this.mint=new kt(re.address),this.isToken2022=!1;return}this.decimals=n,this.symbol=r||t.toString().substring(0,6),this.name=o||t.toString().substring(0,6),this.mint=i?kt.default:gn({publicKey:t}),this.isToken2022=s}equals(t){return this===t?!0:this.mint.equals(t.mint)}},xe=St;xe.WSOL=new St(ie(q({},re),{mint:re.address}));var Ct=class{constructor({decimals:t,symbol:n="UNKNOWN",name:r="UNKNOWN"}){this.decimals=t,this.symbol=n,this.name=r}equals(t){return this===t}},Ye=Ct;Ye.SOL=new Ct(dn);import $r from"bn.js";var ms=new U(new $r(100));var ws=Z("Raydium_price");import{PublicKey as vs}from"@solana/web3.js";import Ks from"bn.js";var eo=new oe(0),ra=new oe(1),oa=new oe(2),ia=new oe(3),sa=new oe(5),Qr=new oe(10),aa=new oe(100),ca=new oe(1e3),ua=new oe(1e4);function ht(e,t=1,n=[]){let r=[...e];if(t<=0)return n;for(;r.length;)n.push(r.splice(0,t));return n}import{PublicKey as ao}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as co}from"@solana/spl-token";import{ComputeBudgetProgram as xn,Keypair as An,PublicKey as to,Transaction as kn,TransactionMessage as no,VersionedTransaction as Sn}from"@solana/web3.js";var G={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"};import{TOKEN_PROGRAM_ID as ro}from"@solana/spl-token";var Pn=Z("Raydium_txUtil"),Cn=1644;function $e(e){let t=[],n=[];return e.microLamports&&(t.push(xn.setComputeUnitPrice({microLamports:e.microLamports})),n.push(G.SetComputeUnitPrice)),e.units&&(t.push(xn.setComputeUnitLimit({units:e.units})),n.push(G.SetComputeUnitLimit)),{instructions:t,instructionTypes:n}}async function Pe(e,t){var r,o;let n=t!=null?t:"confirmed";return(o=await((r=e.getLatestBlockhash)==null?void 0:r.call(e,{commitment:n})))==null?void 0:o.blockhash}async function et(e,t){return e.getSignatureStatuses([t]),new Promise((n,r)=>{let o=setTimeout(r,6e4);e.onSignature(t,i=>{if(clearTimeout(o),!i.err){n("");return}r(Object.assign(i.err,{txId:t}))},"confirmed")})}function oo(e,t){e.length<1&&Pn.logWithError(`no instructions provided: ${e.toString()}`),t.length<1&&Pn.logWithError(`no signers provided:, ${t.toString()}`);let n=new kn;n.recentBlockhash="11111111111111111111111111111111",n.feePayer=t[0],n.add(...e);try{return Buffer.from(n.serialize({verifySignatures:!1})).toString("base64").length<Cn}catch{return!1}}function In(e,t){let[n,r]=to.findProgramAddressSync(e,t);return{publicKey:n,nonce:r}}function Ee({instructions:e,payer:t,signers:n}){return oo(e,[t,...n])}function Re({instructions:e,payer:t,lookupTableAddressAccount:n,recentBlockhash:r=An.generate().publicKey.toString()}){let i=new no({payerKey:t,recentBlockhash:r,instructions:e}).compileToV0Message(Object.values(n!=null?n:{}));try{return Buffer.from(new Sn(i).serialize()).toString("base64").length<Cn}catch{return!1}}var io=e=>Buffer.isBuffer(e)?e:e instanceof Uint8Array?Buffer.from(e.buffer,e.byteOffset,e.byteLength):Buffer.from(e),so=e=>{let t=e.serialize({requireAllSignatures:!1,verifySignatures:!1});e instanceof Sn&&(t=io(t));try{return t instanceof Buffer?t.toString("base64"):Buffer.from(t).toString("base64")}catch{return t.toString("base64")}};function be(e){let t=[];return e.forEach(n=>{n instanceof kn&&(n.recentBlockhash||(n.recentBlockhash=ro.toBase58()),n.feePayer||(n.feePayer=An.generate().publicKey)),t.push(so(n))}),console.log("simulate tx string:",t),t}function tt(e,t,n){return In([e.toBuffer(),(n!=null?n:co).toBuffer(),t.toBuffer()],new ao("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"))}import{PublicKey as L}from"@solana/web3.js";var Na=new L("EhhTKczWMGQt46ynNeRX1WfeagwwJd7ufHvCDjRxjo5Q"),Ea=new L("CBuCnLe26faBpcBP2fktp4rp8abpcAnTWft6ZrP5Q4T"),Ra=new L("9KEPoZmtHUrBbhWN1v1KWLMkkvwY6WLtAVUCPRtRjP4z"),_a=new L("FarmqiPv5eAj3j1GMdMCMUGXqPUvmquZtMy86QH6rzhG"),Ma=new L("CLaimxFqjHzgTJtAGHU47NPhg6qrc5sCnpC4tBLyABQS"),Da=new L("srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX"),va=new L("9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin"),Oa=new L("675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8"),Ka=new L("5quBtoiQqxF9Jv6KYKctB59NT3gtJD2Y65kdnB1Uev3h"),Fa=new L("CDSr3ssLcRB6XYPJwAfFt18MZvEZp4LjHcvzBVZ45duo"),Va=new L("CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK"),Ua=new L("LockrWmn6K5twhz3y9w1dQERbmgSaRkfnTeTKbpofwE"),Wa=new L("kN1kEznaF5Xbd8LYuqtEFcxzWSBk5Fv6ygX6SqEGJVy"),qa=new L("routeUGWgWzqBWFcrCfv8tritsqukccJPu3q5GPP3xS"),Ga=new L("7YttLkHDoNj9wyDur5pM1ejNaAvT9X4eqaYcHQqtj2G5"),Ha=new L("6FJon3QE27qgPVggARueB22hLvoh22VzJpXv4rBEoSLF"),ja=new L("CC12se5To1CdEuw7fDS27B7Geo5jJyL7t5UK2B44NgiH"),Za=new L("9HzJyW1qZsEiSfMUf6L2jo3CcTKAyBmSyKdwQeYisHrC"),za=new L("DropEU8AvevN3UrXWXTMuz3rqnMczQVNjq3kcSdW2SQi"),Qa=new L("CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C"),Xa=new L("GpMZbSM2GgvTKHJirzeGfMFoaZ8UR2X7F4v8vHTvxFbL"),Ja=new L("DNXgeM9EiiaAbaWvwjHj9fQQLAX5ZsfHyvmYUNRAdNC8"),uo=new L("CPMDWBwJDtYax9qW7AyRuVC19Cc4L4Vcy4n2BHAbHkCW"),lo=new L("7rQ1QFNosMkUCuh7Z7fPbTHvh73b68sQYdirycEzJVuw"),fo=new L("G11FKBRaAkHAKuLCgLM6K6NUc9rTjPAznRCjZifrTQe2"),Ya=new L("LockrWmn6K5twhz3y9w1dQERbmgSaRkfnTeTKbpofwE"),po=new L("DLockwT7X7sxtLmGH9g5kmfcjaBtncdbUmi738m5bvQC"),$a=new L("3f7GcQFG397GAaEnv51zR6tsTVihYRydnydDD1cXekxH"),mo=new L("7AFUeLVRjBfzqK3tTGw8hN48KLQWSk6DTE8xprWdPqix"),ec=new L("LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj"),tc=new L("WLHv2UAZm6z4KyaaELi5pjdbJh6RESMva1Rnn8pJVVh"),ho=new L("7soRSLviCKHCKzCbRuVpZDif76NWLVqFtbjt8LpyxWSq"),go=new L("DG6kZFFCqxdtWXw53Zc28hLs3MTr28Efkm2FrsNERNSQ");var nc={SERUM_MARKET:L.default,OPENBOOK_MARKET:new L("EoTcMgcDRTJVZDMZWBoU6rhYHZfkNTVEAfz3uUJRcYGj"),UTIL1216:L.default,FarmV3:new L("85BFyr98MbCUU9MVTEgzx1nbhWACbJqLzho6zd6DZcWL"),FarmV5:new L("EcLzTrNg9V7qhcdyXDe2qjtPkiGzDM2UbdRaeaadU5r2"),FarmV6:new L("Farm2hJLcqPtPg8M4rR6DMrsRNc5TPm5Cs4bVQrMe2T7"),AmmV4:new L("HWy1jotHpo6UqeQxx49dpYYdQB8wj9Qk9MdxwjLvDHB8"),AmmStable:new L("DDg4VmQaJV9ogWce7LpcjBA9bv22wRp5uaTPa5pGjijF"),CLMM:new L("devi51mZmdwUJGU9hjN27vEz64Gps7uUefqxg27EAtH"),CLMM_LOCK_PROGRAM_ID:new L("DLockwT7X7sxtLmGH9g5kmfcjaBtncdbUmi738m5bvQC"),CLMM_LOCK_AUTH_ID:new L("8qmHNvu2Kr2C7U8mJL4Vz1vTDxMhVuXKREwU7TNoaVEo"),Router:new L("BVChZ3XFEwTMUk1o9i3HAf91H6mFxSwa5X2wFAWhYPhU"),CREATE_CPMM_POOL_PROGRAM:uo,CREATE_CPMM_POOL_AUTH:lo,CREATE_CPMM_POOL_FEE_ACC:fo,FEE_DESTINATION_ID:new L("3XMrhbv989VxAMi3DErLV9eJht1pHppW5LbKxe9fkEFR"),LOCK_CPMM_PROGRAM:po,LCOK_CPMM_AUTH:mo,LAUNCHPAD_PROGRAM:ho,LAUNCHPAD_AUTH:go};import ic from"bn.js";import{PublicKey as Ln,AddressLookupTableAccount as nt}from"@solana/web3.js";async function It({connection:e,address:t}){let n=await Xt(e,[...new Set(t.map(o=>o.toString()))].map(o=>new Ln(o))),r={};for(let o=0;o<t.length;o++){let i=n[o],s=t[o];if(!i)continue;let a=new nt({key:s,state:nt.deserialize(i.data)});r[s.toString()]=a,rt[s.toString()]=a}return r}var rt={AcL1Vo8oy1ULiavEcjSUcwfBSForXMudcZvDZy5nzJkU:new nt({key:new Ln("AcL1Vo8oy1ULiavEcjSUcwfBSForXMudcZvDZy5nzJkU"),state:nt.deserialize(Buffer.from("AQAAAP//////////I1rcEwAAAAAvAQYwun9CU6c5Ikm2pAj+D9IEnCOR45nK+SFTGSdpd6J6AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAbd9uHXZaGT2cvhRs7reawctIXtX1s3kTqM9YV+/wCpBt324e51j94YQl285GzN2rYa/E2DuQ0n/r35KNihi/wFSlNQ+F3IgtYUpVZyeIopbd8eq6vQpgZ4iEky9O72oAVKU1qZKSEGTSTocWDaOHx8NbXdvJK7geQfqEBBBUSNBqfVFxksXFEhjMlMPUrxf1ja7gibof1E49vZigAAAAAGp9UXGMd0yShWY5hpHV62i164o5tLbVxzVVshAAAAAIyXJY9OJInxuz0QKRSODYMLWhOZ2v8QhASOe9jb6fhZC3BlsePRfEU4nVJ/awTDzVi4bHMaoP21SbbRvAP4KUbIScv+6Yw2LHF/6K0ZjUPibbSWXCirYPGuuVl7zT789IUPLW4CpHr4JNCatp3ELXDLKMv6JJ+37le50lbBJ2LvBkX2T9y7AHdNGviJAqQNtlDUDCnauQRWybsLji6nPM8Qkw5asQRvCdB3MbX6IEBwytOrpM32l4jQygKG9TKgR0vZScQ2AsM/IHeQ7RajUkyhuZdc8SGiqQz/7H34torNR/Wir3sl0ruUrVxJWEZfUg+QLNAxxODdBi53/OP7Ioil1cqeBM9dtZC3FLov4yyxWRM/wcGStyJX/QfTnLBAHqkqWotPKVlShCVQqpP9W5W1rOao65IMk5QuQ2kMIOxzDMKAy2vjGSxQODgBz0QwGA+eP4ZjIjrIAQaXENv31QfLlOdXSRCkaybRniDHF4C8YcwhcvsqrOVuTP4B2Na+9wLdtrB31uz2rtlFI5kahdsnp/d1SrASDInYCtTYtdoke4kX+hoKWcEWM4Tle8pTUkUVv4BxS6fje/EzKBE4Qu/YsA/yfEEFGcr8Z57VKDw8uQzpiru7g4lvjnfapW62W030syevD8k07SGoxUHiuT/ai7gAHWWhDsVmg/C63ajgpkH7Sn3GdutArDTfyqOkdqv4/IPC/EFFy7mGkfDd2C57N5a/4jC+BbmJy7wQaSEZr0CQU88lPtUxIVvzGjC95b8Ooss2TqmkrayGKofkPMGQn7Ux+9lfwBSNfxwH8NgbpqC/7LNlV4I7nCvsXf3p+ohQk9NrAJb2KAFpUqEIJ9ZBV7BYDzHF/ORKYlgtvPnXjudZQ6CEo