@raydium-io/raydium-sdk-v2
Version:
An SDK for building applications on top of Raydium.
1 lines • 170 kB
JavaScript
var or=Object.create;var Ot=Object.defineProperty,rr=Object.defineProperties,sr=Object.getOwnPropertyDescriptor,ar=Object.getOwnPropertyDescriptors,ur=Object.getOwnPropertyNames,Pi=Object.getOwnPropertySymbols,cr=Object.getPrototypeOf,ki=Object.prototype.hasOwnProperty,lr=Object.prototype.propertyIsEnumerable;var Ai=(i,e,t)=>e in i?Ot(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,j=(i,e)=>{for(var t in e||(e={}))ki.call(e,t)&&Ai(i,t,e[t]);if(Pi)for(var t of Pi(e))lr.call(e,t)&&Ai(i,t,e[t]);return i},ee=(i,e)=>rr(i,ar(e));var mr=(i,e)=>{for(var t in e)Ot(i,t,{get:e[t],enumerable:!0})},wi=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ur(e))!ki.call(i,o)&&o!==t&&Ot(i,o,{get:()=>e[o],enumerable:!(n=sr(e,o))||n.enumerable});return i};var Z=(i,e,t)=>(t=i!=null?or(cr(i)):{},wi(e||!i||!i.__esModule?Ot(t,"default",{value:i,enumerable:!0}):t,i)),pr=i=>wi(Ot({},"__esModule",{value:!0}),i);var Ua={};mr(Ua,{makeSwapInstruction:()=>Qo,route1Instruction:()=>xa,route2Instruction:()=>Sa,routeInstruction:()=>Ho,swapBaseInAutoAccount:()=>Ka,swapBaseOutAutoAccount:()=>Ca});module.exports=pr(Ua);var nr=require("@solana/web3.js"),$t=require("@solana/spl-token"),ir=Z(require("bn.js"));var Bt=9e15,ft=1e9,Sn="0123456789abcdef",tn="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",nn="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Kn={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Bt,maxE:Bt,crypto:!1},Ii,it,z=!0,rn="[DecimalError] ",dt=rn+"Invalid argument: ",xi=rn+"Precision limit exceeded",Si=rn+"crypto unavailable",Ki="[object Decimal]",Re=Math.floor,we=Math.pow,dr=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,fr=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,br=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Ci=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,He=1e7,q=7,yr=9007199254740991,gr=tn.length-1,Cn=nn.length-1,T={toStringTag:Ki};T.absoluteValue=T.abs=function(){var i=new this.constructor(this);return i.s<0&&(i.s=1),V(i)};T.ceil=function(){return V(new this.constructor(this),this.e+1,2)};T.clampedTo=T.clamp=function(i,e){var t,n=this,o=n.constructor;if(i=new o(i),e=new o(e),!i.s||!e.s)return new o(NaN);if(i.gt(e))throw Error(dt+e);return t=n.cmp(i),t<0?i:n.cmp(e)>0?e:new o(n)};T.comparedTo=T.cmp=function(i){var e,t,n,o,r=this,s=r.d,a=(i=new r.constructor(i)).d,u=r.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(r.e!==i.e)return r.e>i.e^u<0?1:-1;for(n=s.length,o=a.length,e=0,t=n<o?n:o;e<t;++e)if(s[e]!==a[e])return s[e]>a[e]^u<0?1:-1;return n===o?0:n>o^u<0?1:-1};T.cosine=T.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=Pr(n,Mi(n,t)),n.precision=i,n.rounding=e,V(it==2||it==3?t.neg():t,i,e,!0)):new n(1):new n(NaN)};T.cubeRoot=T.cbrt=function(){var i,e,t,n,o,r,s,a,u,c,l=this,p=l.constructor;if(!l.isFinite()||l.isZero())return new p(l);for(z=!1,r=l.s*we(l.s*l,1/3),!r||Math.abs(r)==1/0?(t=Ce(l.d),i=l.e,(r=(i-t.length+1)%3)&&(t+=r==1||r==-2?"0":"00"),r=we(t,1/3),i=Re((i+1)/3)-(i%3==(i<0?-1:2)),r==1/0?t="5e"+i:(t=r.toExponential(),t=t.slice(0,t.indexOf("e")+1)+i),n=new p(t),n.s=l.s):n=new p(r.toString()),s=(i=p.precision)+3;;)if(a=n,u=a.times(a).times(a),c=u.plus(l),n=ae(c.plus(l).times(a),c.plus(u),s+2,1),Ce(a.d).slice(0,s)===(t=Ce(n.d)).slice(0,s))if(t=t.slice(s-3,s+1),t=="9999"||!o&&t=="4999"){if(!o&&(V(a,i+1,0),a.times(a).times(a).eq(l))){n=a;break}s+=4,o=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(V(n,i+1,1),e=!n.times(n).times(n).eq(l));break}return z=!0,V(n,i,p.rounding,e)};T.decimalPlaces=T.dp=function(){var i,e=this.d,t=NaN;if(e){if(i=e.length-1,t=(i-Re(this.e/q))*q,i=e[i],i)for(;i%10==0;i/=10)t--;t<0&&(t=0)}return t};T.dividedBy=T.div=function(i){return ae(this,new this.constructor(i))};T.dividedToIntegerBy=T.divToInt=function(i){var e=this,t=e.constructor;return V(ae(e,new t(i),0,1,1),t.precision,t.rounding)};T.equals=T.eq=function(i){return this.cmp(i)===0};T.floor=function(){return V(new this.constructor(this),this.e+1,3)};T.greaterThan=T.gt=function(i){return this.cmp(i)>0};T.greaterThanOrEqualTo=T.gte=function(i){var e=this.cmp(i);return e==1||e===0};T.hyperbolicCosine=T.cosh=function(){var i,e,t,n,o,r=this,s=r.constructor,a=new s(1);if(!r.isFinite())return new s(r.s?1/0:NaN);if(r.isZero())return a;t=s.precision,n=s.rounding,s.precision=t+Math.max(r.e,r.sd())+4,s.rounding=1,o=r.d.length,o<32?(i=Math.ceil(o/3),e=(1/an(4,i)).toString()):(i=16,e="2.3283064365386962890625e-10"),r=It(s,1,r.times(e),new s(1),!0);for(var u,c=i,l=new s(8);c--;)u=r.times(r),r=a.minus(u.times(l.minus(u.times(l))));return V(r,s.precision=t,s.rounding=n,!0)};T.hyperbolicSine=T.sinh=function(){var i,e,t,n,o=this,r=o.constructor;if(!o.isFinite()||o.isZero())return new r(o);if(e=r.precision,t=r.rounding,r.precision=e+Math.max(o.e,o.sd())+4,r.rounding=1,n=o.d.length,n<3)o=It(r,2,o,o,!0);else{i=1.4*Math.sqrt(n),i=i>16?16:i|0,o=o.times(1/an(5,i)),o=It(r,2,o,o,!0);for(var s,a=new r(5),u=new r(16),c=new r(20);i--;)s=o.times(o),o=o.times(a.plus(s.times(u.times(s).plus(c))))}return r.precision=e,r.rounding=t,V(o,e,t,!0)};T.hyperbolicTangent=T.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,ae(t.sinh(),t.cosh(),n.precision=i,n.rounding=e)):new n(t.s)};T.inverseCosine=T.acos=function(){var i,e=this,t=e.constructor,n=e.abs().cmp(1),o=t.precision,r=t.rounding;return n!==-1?n===0?e.isNeg()?Ye(t,o,r):new t(0):new t(NaN):e.isZero()?Ye(t,o+4,r).times(.5):(t.precision=o+6,t.rounding=1,e=e.asin(),i=Ye(t,o+4,r).times(.5),t.precision=o,t.rounding=r,i.minus(e))};T.inverseHyperbolicCosine=T.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)};T.inverseHyperbolicSine=T.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())};T.inverseHyperbolicTangent=T.atanh=function(){var i,e,t,n,o=this,r=o.constructor;return o.isFinite()?o.e>=0?new r(o.abs().eq(1)?o.s/0:o.isZero()?o:NaN):(i=r.precision,e=r.rounding,n=o.sd(),Math.max(n,i)<2*-o.e-1?V(new r(o),i,e,!0):(r.precision=t=n-o.e,o=ae(o.plus(1),new r(1).minus(o),t+i,1),r.precision=i+4,r.rounding=1,o=o.ln(),r.precision=i,r.rounding=e,o.times(.5))):new r(NaN)};T.inverseSine=T.asin=function(){var i,e,t,n,o=this,r=o.constructor;return o.isZero()?new r(o):(e=o.abs().cmp(1),t=r.precision,n=r.rounding,e!==-1?e===0?(i=Ye(r,t+4,n).times(.5),i.s=o.s,i):new r(NaN):(r.precision=t+6,r.rounding=1,o=o.div(new r(1).minus(o.times(o)).sqrt().plus(1)).atan(),r.precision=t,r.rounding=n,o.times(2)))};T.inverseTangent=T.atan=function(){var i,e,t,n,o,r,s,a,u,c=this,l=c.constructor,p=l.precision,d=l.rounding;if(c.isFinite()){if(c.isZero())return new l(c);if(c.abs().eq(1)&&p+4<=Cn)return s=Ye(l,p+4,d).times(.25),s.s=c.s,s}else{if(!c.s)return new l(NaN);if(p+4<=Cn)return s=Ye(l,p+4,d).times(.5),s.s=c.s,s}for(l.precision=a=p+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),o=c;i!==-1;)if(o=o.times(u),r=s.minus(o.div(n+=2)),o=o.times(u),s=r.plus(o.div(n+=2)),s.d[e]!==void 0)for(i=e;s.d[i]===r.d[i]&&i--;);return t&&(s=s.times(2<<t-1)),z=!0,V(s,l.precision=p,l.rounding=d,!0)};T.isFinite=function(){return!!this.d};T.isInteger=T.isInt=function(){return!!this.d&&Re(this.e/q)>this.d.length-2};T.isNaN=function(){return!this.s};T.isNegative=T.isNeg=function(){return this.s<0};T.isPositive=T.isPos=function(){return this.s>0};T.isZero=function(){return!!this.d&&this.d[0]===0};T.lessThan=T.lt=function(i){return this.cmp(i)<0};T.lessThanOrEqualTo=T.lte=function(i){return this.cmp(i)<1};T.logarithm=T.log=function(i){var e,t,n,o,r,s,a,u,c=this,l=c.constructor,p=l.precision,d=l.rounding,m=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)r=!0;else{for(o=t[0];o%10===0;)o/=10;r=o!==1}if(z=!1,a=p+m,s=pt(c,a),n=e?on(l,a+10):pt(i,a),u=ae(s,n,a,1),Mt(u.d,o=p,d))do if(a+=10,s=pt(c,a),n=e?on(l,a+10):pt(i,a),u=ae(s,n,a,1),!r){+Ce(u.d).slice(o+1,o+15)+1==1e14&&(u=V(u,p+1,0));break}while(Mt(u.d,o+=10,d));return z=!0,V(u,p,d)};T.minus=T.sub=function(i){var e,t,n,o,r,s,a,u,c,l,p,d,m=this,P=m.constructor;if(i=new P(i),!m.d||!i.d)return!m.s||!i.s?i=new P(NaN):m.d?i.s=-i.s:i=new P(i.d||m.s!==i.s?m:NaN),i;if(m.s!=i.s)return i.s=-i.s,m.plus(i);if(c=m.d,d=i.d,a=P.precision,u=P.rounding,!c[0]||!d[0]){if(d[0])i.s=-i.s;else if(c[0])i=new P(m);else return new P(u===3?-0:0);return z?V(i,a,u):i}if(t=Re(i.e/q),l=Re(m.e/q),c=c.slice(),r=l-t,r){for(p=r<0,p?(e=c,r=-r,s=d.length):(e=d,t=l,s=c.length),n=Math.max(Math.ceil(a/q),s)+2,r>n&&(r=n,e.length=1),e.reverse(),n=r;n--;)e.push(0);e.reverse()}else{for(n=c.length,s=d.length,p=n<s,p&&(s=n),n=0;n<s;n++)if(c[n]!=d[n]){p=c[n]<d[n];break}r=0}for(p&&(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>r;){if(c[--n]<d[n]){for(o=n;o&&c[--o]===0;)c[o]=He-1;--c[o],c[n]+=He}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=sn(c,t),z?V(i,a,u):i):new P(u===3?-0:0)};T.modulo=T.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]?V(new n(t),n.precision,n.rounding):(z=!1,n.modulo==9?(e=ae(t,i.abs(),0,3,1),e.s*=i.s):e=ae(t,i,0,n.modulo,1),e=e.times(i),z=!0,t.minus(e))};T.naturalExponential=T.exp=function(){return Nn(this)};T.naturalLogarithm=T.ln=function(){return pt(this)};T.negated=T.neg=function(){var i=new this.constructor(this);return i.s=-i.s,V(i)};T.plus=T.add=function(i){var e,t,n,o,r,s,a,u,c,l,p=this,d=p.constructor;if(i=new d(i),!p.d||!i.d)return!p.s||!i.s?i=new d(NaN):p.d||(i=new d(i.d||p.s===i.s?p:NaN)),i;if(p.s!=i.s)return i.s=-i.s,p.minus(i);if(c=p.d,l=i.d,a=d.precision,u=d.rounding,!c[0]||!l[0])return l[0]||(i=new d(p)),z?V(i,a,u):i;if(r=Re(p.e/q),n=Re(i.e/q),c=c.slice(),o=r-n,o){for(o<0?(t=c,o=-o,s=l.length):(t=l,n=r,s=c.length),r=Math.ceil(a/q),s=r>s?r+1:s+1,o>s&&(o=s,t.length=1),t.reverse();o--;)t.push(0);t.reverse()}for(s=c.length,o=l.length,s-o<0&&(o=s,t=l,l=c,c=t),e=0;o;)e=(c[--o]=c[o]+l[o]+e)/He|0,c[o]%=He;for(e&&(c.unshift(e),++n),s=c.length;c[--s]==0;)c.pop();return i.d=c,i.e=sn(c,n),z?V(i,a,u):i};T.precision=T.sd=function(i){var e,t=this;if(i!==void 0&&i!==!!i&&i!==1&&i!==0)throw Error(dt+i);return t.d?(e=Ni(t.d),i&&t.e+1>e&&(e=t.e+1)):e=NaN,e};T.round=function(){var i=this,e=i.constructor;return V(new e(i),i.e+1,e.rounding)};T.sine=T.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=kr(n,Mi(n,t)),n.precision=i,n.rounding=e,V(it>2?t.neg():t,i,e,!0)):new n(NaN)};T.squareRoot=T.sqrt=function(){var i,e,t,n,o,r,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=Ce(a),(e.length+u)%2==0&&(e+="0"),c=Math.sqrt(e),u=Re((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(r=n,n=r.plus(ae(s,r,t+2,1)).times(.5),Ce(r.d).slice(0,t)===(e=Ce(n.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!o&&e=="4999"){if(!o&&(V(r,u+1,0),r.times(r).eq(s))){n=r;break}t+=4,o=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(V(n,u+1,1),i=!n.times(n).eq(s));break}return z=!0,V(n,u,l.rounding,i)};T.tangent=T.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=ae(t,new n(1).minus(t.times(t)).sqrt(),i+10,0),n.precision=i,n.rounding=e,V(it==2||it==4?t.neg():t,i,e,!0)):new n(NaN)};T.times=T.mul=function(i){var e,t,n,o,r,s,a,u,c,l=this,p=l.constructor,d=l.d,m=(i=new p(i)).d;if(i.s*=l.s,!d||!d[0]||!m||!m[0])return new p(!i.s||d&&!d[0]&&!m||m&&!m[0]&&!d?NaN:!d||!m?i.s/0:i.s*0);for(t=Re(l.e/q)+Re(i.e/q),u=d.length,c=m.length,u<c&&(r=d,d=m,m=r,s=u,u=c,c=s),r=[],s=u+c,n=s;n--;)r.push(0);for(n=c;--n>=0;){for(e=0,o=u+n;o>n;)a=r[o]+m[n]*d[o-n-1]+e,r[o--]=a%He|0,e=a/He|0;r[o]=(r[o]+e)%He|0}for(;!r[--s];)r.pop();return e?++t:r.shift(),i.d=r,i.e=sn(r,t),z?V(i,p.precision,p.rounding):i};T.toBinary=function(i,e){return Ln(this,2,i,e)};T.toDecimalPlaces=T.toDP=function(i,e){var t=this,n=t.constructor;return t=new n(t),i===void 0?t:(Fe(i,0,ft),e===void 0?e=n.rounding:Fe(e,0,8),V(t,i+t.e+1,e))};T.toExponential=function(i,e){var t,n=this,o=n.constructor;return i===void 0?t=et(n,!0):(Fe(i,0,ft),e===void 0?e=o.rounding:Fe(e,0,8),n=V(new o(n),i+1,e),t=et(n,!0,i+1)),n.isNeg()&&!n.isZero()?"-"+t:t};T.toFixed=function(i,e){var t,n,o=this,r=o.constructor;return i===void 0?t=et(o):(Fe(i,0,ft),e===void 0?e=r.rounding:Fe(e,0,8),n=V(new r(o),i+o.e+1,e),t=et(n,!1,i+n.e+1)),o.isNeg()&&!o.isZero()?"-"+t:t};T.toFraction=function(i){var e,t,n,o,r,s,a,u,c,l,p,d,m=this,P=m.d,f=m.constructor;if(!P)return new f(m);if(c=t=new f(1),n=u=new f(0),e=new f(n),r=e.e=Ni(P)-m.e-1,s=r%q,e.d[0]=we(10,s<0?q+s:s),i==null)i=r>0?e:c;else{if(a=new f(i),!a.isInt()||a.lt(c))throw Error(dt+a);i=a.gt(e)?r>0?e:c:a}for(z=!1,a=new f(Ce(P)),l=f.precision,f.precision=r=P.length*q*2;p=ae(a,e,0,1,1),o=t.plus(p.times(n)),o.cmp(i)!=1;)t=n,n=o,o=c,c=u.plus(p.times(o)),u=o,o=e,e=a.minus(p.times(o)),a=o;return o=ae(i.minus(t),n,0,1,1),u=u.plus(o.times(c)),t=t.plus(o.times(n)),u.s=c.s=m.s,d=ae(c,n,r,1).minus(m).abs().cmp(ae(u,t,r,1).minus(m).abs())<1?[c,n]:[u,t],f.precision=l,z=!0,d};T.toHexadecimal=T.toHex=function(i,e){return Ln(this,16,i,e)};T.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:Fe(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=ae(t,i,0,e,1).times(i),z=!0,V(t)):(i.s=t.s,t=i),t};T.toNumber=function(){return+this};T.toOctal=function(i,e){return Ln(this,8,i,e)};T.toPower=T.pow=function(i){var e,t,n,o,r,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(we(+a,c));if(a=new u(a),a.eq(1))return a;if(n=u.precision,r=u.rounding,i.eq(1))return V(a,n,r);if(e=Re(i.e/q),e>=i.d.length-1&&(t=c<0?-c:c)<=yr)return o=Ri(u,a,t,n),i.s<0?new u(1).div(o):V(o,n,r);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=we(+a,c),e=t==0||!isFinite(t)?Re(c*(Math.log("0."+Ce(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),o=Nn(i.times(pt(a,n+t)),n),o.d&&(o=V(o,n+5,1),Mt(o.d,n,r)&&(e=n+10,o=V(Nn(i.times(pt(a,e+t)),e),e+5,1),+Ce(o.d).slice(n+1,n+15)+1==1e14&&(o=V(o,n+1,0)))),o.s=s,z=!0,u.rounding=r,V(o,n,r))};T.toPrecision=function(i,e){var t,n=this,o=n.constructor;return i===void 0?t=et(n,n.e<=o.toExpNeg||n.e>=o.toExpPos):(Fe(i,1,ft),e===void 0?e=o.rounding:Fe(e,0,8),n=V(new o(n),i,e),t=et(n,i<=n.e||n.e<=o.toExpNeg,i)),n.isNeg()&&!n.isZero()?"-"+t:t};T.toSignificantDigits=T.toSD=function(i,e){var t=this,n=t.constructor;return i===void 0?(i=n.precision,e=n.rounding):(Fe(i,1,ft),e===void 0?e=n.rounding:Fe(e,0,8)),V(new n(t),i,e)};T.toString=function(){var i=this,e=i.constructor,t=et(i,i.e<=e.toExpNeg||i.e>=e.toExpPos);return i.isNeg()&&!i.isZero()?"-"+t:t};T.truncated=T.trunc=function(){return V(new this.constructor(this),this.e+1,1)};T.valueOf=T.toJSON=function(){var i=this,e=i.constructor,t=et(i,i.e<=e.toExpNeg||i.e>=e.toExpPos);return i.isNeg()?"-"+t:t};function Ce(i){var e,t,n,o=i.length-1,r="",s=i[0];if(o>0){for(r+=s,e=1;e<o;e++)n=i[e]+"",t=q-n.length,t&&(r+=mt(t)),r+=n;s=i[e],n=s+"",t=q-n.length,t&&(r+=mt(t))}else if(s===0)return"0";for(;s%10===0;)s/=10;return r+s}function Fe(i,e,t){if(i!==~~i||i<e||i>t)throw Error(dt+i)}function Mt(i,e,t,n){var o,r,s,a;for(r=i[0];r>=10;r/=10)--e;return--e<0?(e+=q,o=0):(o=Math.ceil((e+1)/q),e%=q),r=we(10,q-e),a=i[o]%r|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==r||t>3&&a+1==r/2)&&(i[o+1]/r/100|0)==we(10,e-2)-1||(a==r/2||a==0)&&(i[o+1]/r/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==r||!n&&t>3&&a+1==r/2)&&(i[o+1]/r/1e3|0)==we(10,e-3)-1,s}function en(i,e,t){for(var n,o=[0],r,s=0,a=i.length;s<a;){for(r=o.length;r--;)o[r]*=e;for(o[0]+=Sn.indexOf(i.charAt(s++)),n=0;n<o.length;n++)o[n]>t-1&&(o[n+1]===void 0&&(o[n+1]=0),o[n+1]+=o[n]/t|0,o[n]%=t)}return o.reverse()}function Pr(i,e){var t,n,o;if(e.isZero())return e;n=e.d.length,n<32?(t=Math.ceil(n/3),o=(1/an(4,t)).toString()):(t=16,o="2.3283064365386962890625e-10"),i.precision+=t,e=It(i,1,e.times(o),new i(1));for(var r=t;r--;){var s=e.times(e);e=s.times(s).minus(s).times(8).plus(1)}return i.precision-=t,e}var ae=function(){function i(n,o,r){var s,a=0,u=n.length;for(n=n.slice();u--;)s=n[u]*o+a,n[u]=s%r|0,a=s/r|0;return a&&n.unshift(a),n}function e(n,o,r,s){var a,u;if(r!=s)u=r>s?1:-1;else for(a=u=0;a<r;a++)if(n[a]!=o[a]){u=n[a]>o[a]?1:-1;break}return u}function t(n,o,r,s){for(var a=0;r--;)n[r]-=a,a=n[r]<o[r]?1:0,n[r]=a*s+n[r]-o[r];for(;!n[0]&&n.length>1;)n.shift()}return function(n,o,r,s,a,u){var c,l,p,d,m,P,f,b,g,I,B,N,E,x,O,M,G,K,W,ye,ue=n.constructor,Ie=n.s==o.s?1:-1,fe=n.d,oe=o.d;if(!fe||!fe[0]||!oe||!oe[0])return new ue(!n.s||!o.s||(fe?oe&&fe[0]==oe[0]:!oe)?NaN:fe&&fe[0]==0||!oe?Ie*0:Ie/0);for(u?(m=1,l=n.e-o.e):(u=He,m=q,l=Re(n.e/m)-Re(o.e/m)),W=oe.length,G=fe.length,g=new ue(Ie),I=g.d=[],p=0;oe[p]==(fe[p]||0);p++);if(oe[p]>(fe[p]||0)&&l--,r==null?(x=r=ue.precision,s=ue.rounding):a?x=r+(n.e-o.e)+1:x=r,x<0)I.push(1),P=!0;else{if(x=x/m+2|0,p=0,W==1){for(d=0,oe=oe[0],x++;(p<G||d)&&x--;p++)O=d*u+(fe[p]||0),I[p]=O/oe|0,d=O%oe|0;P=d||p<G}else{for(d=u/(oe[0]+1)|0,d>1&&(oe=i(oe,d,u),fe=i(fe,d,u),W=oe.length,G=fe.length),M=W,B=fe.slice(0,W),N=B.length;N<W;)B[N++]=0;ye=oe.slice(),ye.unshift(0),K=oe[0],oe[1]>=u/2&&++K;do d=0,c=e(oe,B,W,N),c<0?(E=B[0],W!=N&&(E=E*u+(B[1]||0)),d=E/K|0,d>1?(d>=u&&(d=u-1),f=i(oe,d,u),b=f.length,N=B.length,c=e(f,B,b,N),c==1&&(d--,t(f,W<b?ye:oe,b,u))):(d==0&&(c=d=1),f=oe.slice()),b=f.length,b<N&&f.unshift(0),t(B,f,N,u),c==-1&&(N=B.length,c=e(oe,B,W,N),c<1&&(d++,t(B,W<N?ye:oe,N,u))),N=B.length):c===0&&(d++,B=[0]),I[p++]=d,c&&B[0]?B[N++]=fe[M]||0:(B=[fe[M]],N=1);while((M++<G||B[0]!==void 0)&&x--);P=B[0]!==void 0}I[0]||I.shift()}if(m==1)g.e=l,Ii=P;else{for(p=1,d=I[0];d>=10;d/=10)p++;g.e=p+l*m-1,V(g,a?r+g.e+1:r,s,P)}return g}}();function V(i,e,t,n){var o,r,s,a,u,c,l,p,d,m=i.constructor;e:if(e!=null){if(p=i.d,!p)return i;for(o=1,a=p[0];a>=10;a/=10)o++;if(r=e-o,r<0)r+=q,s=e,l=p[d=0],u=l/we(10,o-s-1)%10|0;else if(d=Math.ceil((r+1)/q),a=p.length,d>=a)if(n){for(;a++<=d;)p.push(0);l=u=0,o=1,r%=q,s=r-q+1}else break e;else{for(l=a=p[d],o=1;a>=10;a/=10)o++;r%=q,s=r-q+o,u=s<0?0:l/we(10,o-s-1)%10|0}if(n=n||e<0||p[d+1]!==void 0||(s<0?l:l%we(10,o-s-1)),c=t<4?(u||n)&&(t==0||t==(i.s<0?3:2)):u>5||u==5&&(t==4||n||t==6&&(r>0?s>0?l/we(10,o-s):0:p[d-1])%10&1||t==(i.s<0?8:7)),e<1||!p[0])return p.length=0,c?(e-=i.e+1,p[0]=we(10,(q-e%q)%q),i.e=-e||0):p[0]=i.e=0,i;if(r==0?(p.length=d,a=1,d--):(p.length=d+1,a=we(10,q-r),p[d]=s>0?(l/we(10,o-s)%we(10,s)|0)*a:0),c)for(;;)if(d==0){for(r=1,s=p[0];s>=10;s/=10)r++;for(s=p[0]+=a,a=1;s>=10;s/=10)a++;r!=a&&(i.e++,p[0]==He&&(p[0]=1));break}else{if(p[d]+=a,p[d]!=He)break;p[d--]=0,a=1}for(r=p.length;p[--r]===0;)p.pop()}return z&&(i.e>m.maxE?(i.d=null,i.e=NaN):i.e<m.minE&&(i.e=0,i.d=[0])),i}function et(i,e,t){if(!i.isFinite())return Oi(i);var n,o=i.e,r=Ce(i.d),s=r.length;return e?(t&&(n=t-s)>0?r=r.charAt(0)+"."+r.slice(1)+mt(n):s>1&&(r=r.charAt(0)+"."+r.slice(1)),r=r+(i.e<0?"e":"e+")+i.e):o<0?(r="0."+mt(-o-1)+r,t&&(n=t-s)>0&&(r+=mt(n))):o>=s?(r+=mt(o+1-s),t&&(n=t-o-1)>0&&(r=r+"."+mt(n))):((n=o+1)<s&&(r=r.slice(0,n)+"."+r.slice(n)),t&&(n=t-s)>0&&(o+1===s&&(r+="."),r+=mt(n))),r}function sn(i,e){var t=i[0];for(e*=q;t>=10;t/=10)e++;return e}function on(i,e,t){if(e>gr)throw z=!0,t&&(i.precision=t),Error(xi);return V(new i(tn),e,1,!0)}function Ye(i,e,t){if(e>Cn)throw Error(xi);return V(new i(nn),e,t,!0)}function Ni(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 Ri(i,e,t,n){var o,r=new i(1),s=Math.ceil(n/q+4);for(z=!1;;){if(t%2&&(r=r.times(e),hi(r.d,s)&&(o=!0)),t=Re(t/2),t===0){t=r.d.length-1,o&&r.d[t]===0&&++r.d[t];break}e=e.times(e),hi(e.d,s)}return z=!0,r}function Ti(i){return i.d[i.d.length-1]&1}function Li(i,e,t){for(var n,o=new i(e[0]),r=0;++r<e.length;)if(n=new i(e[r]),n.s)o[t](n)&&(o=n);else{o=n;break}return o}function Nn(i,e){var t,n,o,r,s,a,u,c=0,l=0,p=0,d=i.constructor,m=d.rounding,P=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=P):u=e,a=new d(.03125);i.e>-2;)i=i.times(a),p+=5;for(n=Math.log(we(2,p))/Math.LN10*2+5|0,u+=n,t=r=s=new d(1),d.precision=u;;){if(r=V(r.times(i),u,1),t=t.times(++l),a=s.plus(ae(r,t,u,1)),Ce(a.d).slice(0,u)===Ce(s.d).slice(0,u)){for(o=p;o--;)s=V(s.times(s),u,1);if(e==null)if(c<3&&Mt(s.d,u-n,m,c))d.precision=u+=10,t=r=a=new d(1),l=0,c++;else return V(s,d.precision=P,m,z=!0);else return d.precision=P,s}s=a}}function pt(i,e){var t,n,o,r,s,a,u,c,l,p,d,m=1,P=10,f=i,b=f.d,g=f.constructor,I=g.rounding,B=g.precision;if(f.s<0||!b||!b[0]||!f.e&&b[0]==1&&b.length==1)return new g(b&&!b[0]?-1/0:f.s!=1?NaN:b?0:f);if(e==null?(z=!1,l=B):l=e,g.precision=l+=P,t=Ce(b),n=t.charAt(0),Math.abs(r=f.e)<15e14){for(;n<7&&n!=1||n==1&&t.charAt(1)>3;)f=f.times(i),t=Ce(f.d),n=t.charAt(0),m++;r=f.e,n>1?(f=new g("0."+t),r++):f=new g(n+"."+t.slice(1))}else return c=on(g,l+2,B).times(r+""),f=pt(new g(n+"."+t.slice(1)),l-P).plus(c),g.precision=B,e==null?V(f,B,I,z=!0):f;for(p=f,u=s=f=ae(f.minus(1),f.plus(1),l,1),d=V(f.times(f),l,1),o=3;;){if(s=V(s.times(d),l,1),c=u.plus(ae(s,new g(o),l,1)),Ce(c.d).slice(0,l)===Ce(u.d).slice(0,l))if(u=u.times(2),r!==0&&(u=u.plus(on(g,l+2,B).times(r+""))),u=ae(u,new g(m),l,1),e==null)if(Mt(u.d,l-P,I,a))g.precision=l+=P,c=s=f=ae(p.minus(1),p.plus(1),l,1),d=V(f.times(f),l,1),o=a=1;else return V(u,g.precision=B,I,z=!0);else return g.precision=B,u;u=c,o+=2}}function Oi(i){return String(i.s*i.s/0)}function Rn(i,e){var t,n,o;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(o=e.length;e.charCodeAt(o-1)===48;--o);if(e=e.slice(n,o),e){if(o-=n,i.e=t=t-n-1,i.d=[],n=(t+1)%q,t<0&&(n+=q),n<o){for(n&&i.d.push(+e.slice(0,n)),o-=q;n<o;)i.d.push(+e.slice(n,n+=q));e=e.slice(n),n=q-e.length}else n-=o;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 Ar(i,e){var t,n,o,r,s,a,u,c,l;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),Ci.test(e))return Rn(i,e)}else if(e==="Infinity"||e==="NaN")return+e||(i.s=NaN),i.e=NaN,i.d=null,i;if(fr.test(e))t=16,e=e.toLowerCase();else if(dr.test(e))t=2;else if(br.test(e))t=8;else throw Error(dt+e);for(r=e.search(/p/i),r>0?(u=+e.slice(r+1),e=e.substring(2,r)):e=e.slice(2),r=e.indexOf("."),s=r>=0,n=i.constructor,s&&(e=e.replace(".",""),a=e.length,r=a-r,o=Ri(n,new n(t),r,r*2)),c=en(e,t,He),l=c.length-1,r=l;c[r]===0;--r)c.pop();return r<0?new n(i.s*0):(i.e=sn(c,l),i.d=c,z=!1,s&&(i=ae(i,o,a*4)),u&&(i=i.times(Math.abs(u)<54?we(2,u):Ft.pow(2,u))),z=!0,i)}function kr(i,e){var t,n=e.d.length;if(n<3)return e.isZero()?e:It(i,2,e,e);t=1.4*Math.sqrt(n),t=t>16?16:t|0,e=e.times(1/an(5,t)),e=It(i,2,e,e);for(var o,r=new i(5),s=new i(16),a=new i(20);t--;)o=e.times(e),e=e.times(r.plus(o.times(s.times(o).minus(a))));return e}function It(i,e,t,n,o){var r,s,a,u,c=1,l=i.precision,p=Math.ceil(l/q);for(z=!1,u=t.times(t),a=new i(n);;){if(s=ae(a.times(u),new i(e++*e++),l,1),a=o?n.plus(s):n.minus(s),n=ae(s.times(u),new i(e++*e++),l,1),s=a.plus(n),s.d[p]!==void 0){for(r=p;s.d[r]===a.d[r]&&r--;);if(r==-1)break}r=a,a=n,n=s,s=r,c++}return z=!0,s.d.length=p+1,s}function an(i,e){for(var t=i;--e;)t*=i;return t}function Mi(i,e){var t,n=e.s<0,o=Ye(i,i.precision,1),r=o.times(.5);if(e=e.abs(),e.lte(r))return it=n?4:1,e;if(t=e.divToInt(o),t.isZero())it=n?3:2;else{if(e=e.minus(t.times(o)),e.lte(r))return it=Ti(t)?n?2:3:n?4:1,e;it=Ti(t)?n?1:4:n?3:2}return e.minus(o).abs()}function Ln(i,e,t,n){var o,r,s,a,u,c,l,p,d,m=i.constructor,P=t!==void 0;if(P?(Fe(t,1,ft),n===void 0?n=m.rounding:Fe(n,0,8)):(t=m.precision,n=m.rounding),!i.isFinite())l=Oi(i);else{for(l=et(i),s=l.indexOf("."),P?(o=2,e==16?t=t*4-3:e==8&&(t=t*3-2)):o=e,s>=0&&(l=l.replace(".",""),d=new m(1),d.e=l.length-s,d.d=en(et(d),10,o),d.e=d.d.length),p=en(l,10,o),r=u=p.length;p[--u]==0;)p.pop();if(!p[0])l=P?"0p+0":"0";else{if(s<0?r--:(i=new m(i),i.d=p,i.e=r,i=ae(i,d,t,n,0,o),p=i.d,r=i.e,c=Ii),s=p[t],a=o/2,c=c||p[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&&p[t-1]&1||n===(i.s<0?8:7)),p.length=t,c)for(;++p[--t]>o-1;)p[t]=0,t||(++r,p.unshift(1));for(u=p.length;!p[u-1];--u);for(s=0,l="";s<u;s++)l+=Sn.charAt(p[s]);if(P){if(u>1)if(e==16||e==8){for(s=e==16?4:3,--u;u%s;u++)l+="0";for(p=en(l,o,e),u=p.length;!p[u-1];--u);for(s=1,l="1.";s<u;s++)l+=Sn.charAt(p[s])}else l=l.charAt(0)+"."+l.slice(1);l=l+(r<0?"p":"p+")+r}else if(r<0){for(;++r;)l="0"+l;l="0."+l}else if(++r>u)for(r-=u;r--;)l+="0";else r<u&&(l=l.slice(0,r)+"."+l.slice(r))}l=(e==16?"0x":e==2?"0b":e==8?"0o":"")+l}return i.s<0?"-"+l:l}function hi(i,e){if(i.length>e)return i.length=e,!0}function wr(i){return new this(i).abs()}function Tr(i){return new this(i).acos()}function hr(i){return new this(i).acosh()}function Br(i,e){return new this(i).plus(e)}function Ir(i){return new this(i).asin()}function xr(i){return new this(i).asinh()}function Sr(i){return new this(i).atan()}function Kr(i){return new this(i).atanh()}function Cr(i,e){i=new this(i),e=new this(e);var t,n=this.precision,o=this.rounding,r=n+4;return!i.s||!e.s?t=new this(NaN):!i.d&&!e.d?(t=Ye(this,r,1).times(e.s>0?.25:.75),t.s=i.s):!e.d||i.isZero()?(t=e.s<0?Ye(this,n,o):new this(0),t.s=i.s):!i.d||e.isZero()?(t=Ye(this,r,1).times(.5),t.s=i.s):e.s<0?(this.precision=r,this.rounding=1,t=this.atan(ae(i,e,r,1)),e=Ye(this,r,1),this.precision=n,this.rounding=o,t=i.s<0?t.minus(e):t.plus(e)):t=this.atan(ae(i,e,r,1)),t}function Nr(i){return new this(i).cbrt()}function Rr(i){return V(i=new this(i),i.e+1,2)}function Lr(i,e,t){return new this(i).clamp(e,t)}function Or(i){if(!i||typeof i!="object")throw Error(rn+"Object expected");var e,t,n,o=i.defaults===!0,r=["precision",1,ft,"rounding",0,8,"toExpNeg",-Bt,0,"toExpPos",0,Bt,"maxE",0,Bt,"minE",-Bt,0,"modulo",0,9];for(e=0;e<r.length;e+=3)if(t=r[e],o&&(this[t]=Kn[t]),(n=i[t])!==void 0)if(Re(n)===n&&n>=r[e+1]&&n<=r[e+2])this[t]=n;else throw Error(dt+t+": "+n);if(t="crypto",o&&(this[t]=Kn[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(Si);else this[t]=!1;else throw Error(dt+t+": "+n);return this}function Mr(i){return new this(i).cos()}function Fr(i){return new this(i).cosh()}function Fi(i){var e,t,n;function o(r){var s,a,u,c=this;if(!(c instanceof o))return new o(r);if(c.constructor=o,Bi(r)){c.s=r.s,z?!r.d||r.e>o.maxE?(c.e=NaN,c.d=null):r.e<o.minE?(c.e=0,c.d=[0]):(c.e=r.e,c.d=r.d.slice()):(c.e=r.e,c.d=r.d?r.d.slice():r.d);return}if(u=typeof r,u==="number"){if(r===0){c.s=1/r<0?-1:1,c.e=0,c.d=[0];return}if(r<0?(r=-r,c.s=-1):c.s=1,r===~~r&&r<1e7){for(s=0,a=r;a>=10;a/=10)s++;z?s>o.maxE?(c.e=NaN,c.d=null):s<o.minE?(c.e=0,c.d=[0]):(c.e=s,c.d=[r]):(c.e=s,c.d=[r]);return}else if(r*0!==0){r||(c.s=NaN),c.e=NaN,c.d=null;return}return Rn(c,r.toString())}else if(u!=="string")throw Error(dt+r);return(a=r.charCodeAt(0))===45?(r=r.slice(1),c.s=-1):(a===43&&(r=r.slice(1)),c.s=1),Ci.test(r)?Rn(c,r):Ar(c,r)}if(o.prototype=T,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=Or,o.clone=Fi,o.isDecimal=Bi,o.abs=wr,o.acos=Tr,o.acosh=hr,o.add=Br,o.asin=Ir,o.asinh=xr,o.atan=Sr,o.atanh=Kr,o.atan2=Cr,o.cbrt=Nr,o.ceil=Rr,o.clamp=Lr,o.cos=Mr,o.cosh=Fr,o.div=vr,o.exp=Er,o.floor=Wr,o.hypot=Vr,o.ln=Dr,o.log=_r,o.log10=Gr,o.log2=qr,o.max=Ur,o.min=Xr,o.mod=zr,o.mul=Yr,o.pow=Hr,o.random=Qr,o.round=Zr,o.sign=jr,o.sin=Jr,o.sinh=$r,o.sqrt=es,o.sub=ts,o.sum=ns,o.tan=is,o.tanh=os,o.trunc=rs,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 o.config(i),o}function vr(i,e){return new this(i).div(e)}function Er(i){return new this(i).exp()}function Wr(i){return V(i=new this(i),i.e+1,3)}function Vr(){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 Bi(i){return i instanceof Ft||i&&i.toStringTag===Ki||!1}function Dr(i){return new this(i).ln()}function _r(i,e){return new this(i).log(e)}function qr(i){return new this(i).log(2)}function Gr(i){return new this(i).log(10)}function Ur(){return Li(this,arguments,"lt")}function Xr(){return Li(this,arguments,"gt")}function zr(i,e){return new this(i).mod(e)}function Yr(i,e){return new this(i).mul(e)}function Hr(i,e){return new this(i).pow(e)}function Qr(i){var e,t,n,o,r=0,s=new this(1),a=[];if(i===void 0?i=this.precision:Fe(i,1,ft),n=Math.ceil(i/q),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(n));r<n;)o=e[r],o>=429e7?e[r]=crypto.getRandomValues(new Uint32Array(1))[0]:a[r++]=o%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(n*=4);r<n;)o=e[r]+(e[r+1]<<8)+(e[r+2]<<16)+((e[r+3]&127)<<24),o>=214e7?crypto.randomBytes(4).copy(e,r):(a.push(o%1e7),r+=4);r=n/4}else throw Error(Si);else for(;r<n;)a[r++]=Math.random()*1e7|0;for(n=a[--r],i%=q,n&&i&&(o=we(10,q-i),a[r]=(n/o|0)*o);a[r]===0;r--)a.pop();if(r<0)t=0,a=[0];else{for(t=-1;a[0]===0;t-=q)a.shift();for(n=1,o=a[0];o>=10;o/=10)n++;n<q&&(t-=q-n)}return s.e=t,s.d=a,s}function Zr(i){return V(i=new this(i),i.e+1,this.rounding)}function jr(i){return i=new this(i),i.d?i.d[0]?i.s:0*i.s:i.s||NaN}function Jr(i){return new this(i).sin()}function $r(i){return new this(i).sinh()}function es(i){return new this(i).sqrt()}function ts(i,e){return new this(i).sub(e)}function ns(){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,V(t,this.precision,this.rounding)}function is(i){return new this(i).tan()}function os(i){return new this(i).tanh()}function rs(i){return V(i=new this(i),i.e+1,1)}T[Symbol.for("nodejs.util.inspect.custom")]=T.toString;T[Symbol.toStringTag]="Decimal";var Ft=T.constructor=Fi(Kn);tn=new Ft(tn);nn=new Ft(nn);var L=Ft;var Ei=require("@solana/web3.js");var vt=require("lodash");var On=class{constructor(e){this.logLevel=e.logLevel!==void 0?e.logLevel:0,this.name=e.name}set level(e){this.logLevel=e}get time(){return Date.now().toString()}get moduleName(){return this.name}isLogLevel(e){return e<=this.logLevel}error(...e){return this.isLogLevel(0)?(console.error(this.time,this.name,"sdk logger error",...e),this):this}logWithError(...e){let t=e.map(n=>typeof n=="object"?JSON.stringify(n):n).join(", ");throw new Error(t)}warning(...e){return this.isLogLevel(1)?(console.warn(this.time,this.name,"sdk logger warning",...e),this):this}info(...e){return this.isLogLevel(2)?(console.info(this.time,this.name,"sdk logger info",...e),this):this}debug(...e){return this.isLogLevel(3)?(console.debug(this.time,this.name,"sdk logger debug",...e),this):this}},vi={},ss={};function ce(i){let e=(0,vt.get)(vi,i);if(!e){let t=(0,vt.get)(ss,i);e=new On({name:i,logLevel:t}),(0,vt.set)(vi,i,e)}return e}var un=require("@solana/spl-token"),Mn=ce("Raydium_accountInfo_util");async function bt(i,e,t){let{batchRequest:n,commitment:o="confirmed",chunkCount:r=100}=j({batchRequest:!1},t),s=Fn(e,r),a=new Array(s.length).fill([]);if(n){let u=s.map(p=>{let d=i._buildArgs([p.map(m=>m.toBase58())],o,"base64");return{methodName:"getMultipleAccounts",args:d}}),c=Fn(u,10);a=(await(await Promise.all(c.map(async p=>await i._rpcBatchRequest(p)))).flat()).map(p=>(p.error&&Mn.logWithError(`failed to get info for multiple accounts, RPC_ERROR, ${p.error.message}`),p.result.value.map(d=>{if(d){let{data:m,executable:P,lamports:f,owner:b,rentEpoch:g}=d;return m.length!==2&&m[1]!=="base64"&&Mn.logWithError("info must be base64 encoded, RPC_ERROR"),{data:Buffer.from(m[0],"base64"),executable:P,lamports:f,owner:new Ei.PublicKey(b),rentEpoch:g}}return null})))}else try{a=await Promise.all(s.map(u=>i.getMultipleAccountsInfo(u,o)))}catch(u){u instanceof Error&&Mn.logWithError(`failed to get info for multiple accounts, RPC_ERROR, ${u.message}`)}return a.flat()}async function xt(i,e,t){let n=await bt(i,e.map(o=>o.pubkey),t);return e.map((o,r)=>ee(j({},o),{accountInfo:n[r]}))}var tt=Z(require("bn.js"));var Gi=Z(require("big.js")),_t=Z(require("bn.js"));var Wi=Z(require("toformat")),as=Wi.default,Wt=as;var Vt=Z(require("big.js")),Di=Z(require("bn.js")),_i=Z(require("decimal.js-light"));var Kt=Z(require("bn.js"));var Vi=9007199254740991;function me(i){let e=ce("Raydium_parseBigNumberish");if(i instanceof Kt.default)return i;if(typeof i=="string"){if(i.match(/^-?[0-9]+$/))return new Kt.default(i);e.logWithError(`invalid BigNumberish string: ${i}`)}return typeof i=="number"?(i%1&&e.logWithError(`BigNumberish number underflow: ${i}`),(i>=Vi||i<=-Vi)&&e.logWithError(`BigNumberish number overflow: ${i}`),new Kt.default(String(i))):typeof i=="bigint"?new Kt.default(i.toString()):(e.error(`invalid BigNumberish value: ${i}`),new Kt.default(0))}var cn=ce("module/fraction"),vn=Wt(Vt.default),Dt=Wt(_i.default),cs={[0]:Dt.ROUND_DOWN,[1]:Dt.ROUND_HALF_UP,[2]:Dt.ROUND_UP},ls={[0]:Vt.default.roundDown,[1]:Vt.default.roundHalfUp,[2]:Vt.default.roundUp},te=class{constructor(e,t=new Di.default(1)){this.numerator=me(e),this.denominator=me(t)}get quotient(){return this.numerator.div(this.denominator)}invert(){return new te(this.denominator,this.numerator)}add(e){let t=e instanceof te?e:new te(me(e));return this.denominator.eq(t.denominator)?new te(this.numerator.add(t.numerator),this.denominator):new te(this.numerator.mul(t.denominator).add(t.numerator.mul(this.denominator)),this.denominator.mul(t.denominator))}sub(e){let t=e instanceof te?e:new te(me(e));return this.denominator.eq(t.denominator)?new te(this.numerator.sub(t.numerator),this.denominator):new te(this.numerator.mul(t.denominator).sub(t.numerator.mul(this.denominator)),this.denominator.mul(t.denominator))}mul(e){let t=e instanceof te?e:new te(me(e));return new te(this.numerator.mul(t.numerator),this.denominator.mul(t.denominator))}div(e){let t=e instanceof te?e:new te(me(e));return new te(this.numerator.mul(t.denominator),this.denominator.mul(t.numerator))}toSignificant(e,t={groupSeparator:""},n=1){Number.isInteger(e)||cn.logWithError(`${e} is not an integer.`),e<=0&&cn.logWithError(`${e} is not positive.`),Dt.set({precision:e+1,rounding:cs[n]});let o=new Dt(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(e);return o.toFormat(o.decimalPlaces(),t)}toFixed(e,t={groupSeparator:""},n=1){return Number.isInteger(e)||cn.logWithError(`${e} is not an integer.`),e<0&&cn.logWithError(`${e} is negative.`),vn.DP=e,vn.RM=ls[n]||1,new vn(this.numerator.toString()).div(this.denominator.toString()).toFormat(e,t)}isZero(){return this.numerator.isZero()}};var ms=ce("Raydium_amount"),qi=Wt(Gi.default);function ps(i,e){let t="0",n="0";if(i.includes(".")){let o=i.split(".");o.length===2?([t,n]=o,n=n.padEnd(e,"0")):ms.logWithError(`invalid number string, num: ${i}`)}else t=i;return[t,n.slice(0,e)||n]}var Te=class extends te{constructor(t,n,o=!0,r){let s=new _t.default(0),a=En.pow(new _t.default(t.decimals));if(o)s=me(n);else{let u=new _t.default(0),c=new _t.default(0);if(typeof n=="string"||typeof n=="number"||typeof n=="bigint"){let[l,p]=ps(n.toString(),t.decimals);u=me(l),c=me(p)}u=u.mul(a),s=u.add(c)}super(s,a);this.logger=ce(r||"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 Te(this.token,this.raw.add(t.raw))}subtract(t){return this.token.equals(t.token)||this.logger.logWithError("sub token not equals"),new Te(this.token,this.raw.sub(t.raw))}toSignificant(t=this.token.decimals,n,o=0){return super.toSignificant(t,n,o)}toFixed(t=this.token.decimals,n,o=0){return t>this.token.decimals&&this.logger.logWithError("decimals overflow"),super.toFixed(t,n,o)}toExact(t={groupSeparator:""}){return qi.DP=this.token.decimals,new qi(this.numerator.toString()).div(this.denominator.toString()).toFormat(t)}};var Ui=require("@solana/web3.js"),Wn=require("@solana/spl-token"),Vn={chainId:101,address:Ui.PublicKey.default.toBase58(),programId:Wn.TOKEN_PROGRAM_ID.toBase58(),decimals:9,symbol:"SOL",name:"solana",logoURI:"https://img-v1.raydium.io/icon/So11111111111111111111111111111111111111112.png",tags:[],priority:2,type:"raydium",extensions:{coingeckoId:"solana"}},ot={chainId:101,address:"So11111111111111111111111111111111111111112",programId:Wn.TOKEN_PROGRAM_ID.toBase58(),decimals:9,symbol:"WSOL",name:"Wrapped SOL",logoURI:"https://img-v1.raydium.io/icon/So11111111111111111111111111111111111111112.png",tags:[],priority:2,type:"raydium",extensions:{coingeckoId:"solana"}};var mn=require("@solana/web3.js");var ie=require("@solana/web3.js"),Xi=require("@solana/spl-token");function A({pubkey:i,isSigner:e=!1,isWritable:t=!0}){return{pubkey:i,isWritable:t,isSigner:e}}var Au=[A({pubkey:Xi.TOKEN_PROGRAM_ID,isWritable:!1}),A({pubkey:ie.SystemProgram.programId,isWritable:!1}),A({pubkey:ie.SYSVAR_RENT_PUBKEY,isWritable:!1})];function Dn({publicKey:i,transformSol:e}){let t=_n(i.toString());if(t instanceof ie.PublicKey)return e&&t.equals(qt)?Et:t;if(e&&t.toString()===qt.toBase58())return Et;if(typeof t=="string"){if(t===ie.PublicKey.default.toBase58())return ie.PublicKey.default;try{return new ie.PublicKey(t)}catch{throw new Error("invalid public key")}}throw new Error("invalid public key")}function _n(i){try{return new ie.PublicKey(i)}catch{return i}}var ln=new ie.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),yt=new ie.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),Qe=new ie.PublicKey("SysvarRent111111111111111111111111111111111"),ku=new ie.PublicKey("SysvarC1ock11111111111111111111111111111111"),rt=new ie.PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),wu=new ie.PublicKey("Sysvar1nstructions1111111111111111111111111"),ds=ie.SystemProgram.programId,Tu=new ie.PublicKey("4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R"),hu=new ie.PublicKey("Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS"),Bu=new ie.PublicKey("SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt"),Iu=new ie.PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),xu=new ie.PublicKey("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"),Su=new ie.PublicKey("mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So"),Ku=new ie.PublicKey("7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj"),Cu=new ie.PublicKey("USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX"),Nu=new ie.PublicKey("NRVwhjBQiUPYtfDT5zRBVJajzFQHaBUNtC7SNVvqRFa"),Ru=new ie.PublicKey("ANAxByE6G2WjFp7A4NqtWYXb3mgruyzZYg3spfxe6Lbo"),Lu=new ie.PublicKey("7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs"),Et=new ie.PublicKey("So11111111111111111111111111111111111111112"),qt=ie.PublicKey.default;function St(i){return Dn({publicKey:i,transformSol:!0})}var qn=class{constructor({mint:e,decimals:t,symbol:n,name:o,skipMint:r=!1,isToken2022:s=!1}){if(e===qt.toBase58()||e instanceof mn.PublicKey&&qt.equals(e)){this.decimals=ot.decimals,this.symbol=ot.symbol,this.name=ot.name,this.mint=new mn.PublicKey(ot.address),this.isToken2022=!1;return}this.decimals=t,this.symbol=n||e.toString().substring(0,6),this.name=o||e.toString().substring(0,6),this.mint=r?mn.PublicKey.default:Dn({publicKey:e}),this.isToken2022=s}equals(e){return this===e?!0:this.mint.equals(e.mint)}},Ze=qn;Ze.WSOL=new qn(ee(j({},ot),{mint:ot.address}));var Gn=class{constructor({decimals:e,symbol:t="UNKNOWN",name:n="UNKNOWN"}){this.decimals=e,this.symbol=t,this.name=n}equals(e){return this===e}},pn=Gn;pn.SOL=new Gn(Vn);var Yi=Z(require("bn.js"));var zi=new te(new Yi.default(100)),st=class extends te{toSignificant(e=5,t,n){return this.mul(zi).toSignificant(e,t,n)}toFixed(e=2,t,n){return this.mul(zi).toFixed(e,t,n)}};var fs=ce("Raydium_price"),Ve=class extends te{constructor(t){let{baseToken:n,quoteToken:o,numerator:r,denominator:s}=t;super(r,s);this.baseToken=n,this.quoteToken=o,this.scalar=new te(Un(n.decimals),Un(o.decimals))}get raw(){return new te(this.numerator,this.denominator)}get adjusted(){return super.mul(this.scalar)}invert(){return new Ve({baseToken:this.quoteToken,quoteToken:this.baseToken,denominator:this.numerator,numerator:this.denominator})}mul(t){this.quoteToken!==t.baseToken&&fs.logWithError("mul token not equals");let n=super.mul(t);return new Ve({baseToken:this.baseToken,quoteToken:t.quoteToken,denominator:n.denominator,numerator:n.numerator})}toSignificant(t=this.quoteToken.decimals,n,o){return this.adjusted.toSignificant(t,n,o)}toFixed(t=this.quoteToken.decimals,n,o){return this.adjusted.toFixed(t,n,o)}};var Hi=new tt.default(0),bs=new tt.default(1),Pc=new tt.default(2),Ac=new tt.default(3),kc=new tt.default(5),En=new tt.default(10),wc=new tt.default(100),Tc=new tt.default(1e3),hc=new tt.default(1e4);function Un(i){return En.pow(me(i))}function Fn(i,e=1,t=[]){let n=[...i];if(e<=0)return t;for(;n.length;)t.push(n.splice(0,e));return t}var Qi=require("@solana/web3.js"),Zi=require("@solana/spl-token");var Pt=require("@solana/web3.js");var re={CreateAccount:"CreateAccount",InitAccount:"InitAccount",CreateATA:"CreateATA",CloseAccount:"CloseAccount",TransferAmount:"TransferAmount",InitMint:"InitMint",MintTo:"MintTo",InitMarket:"InitMarket",Util1216OwnerClaim:"Util1216OwnerClaim",SetComputeUnitPrice:"SetComputeUnitPrice",SetComputeUnitLimit:"SetComputeUnitLimit",ClmmCreatePool:"ClmmCreatePool",ClmmOpenPosition:"ClmmOpenPosition",ClmmIncreasePosition:"ClmmIncreasePosition",ClmmDecreasePosition:"ClmmDecreasePosition",ClmmClosePosition:"ClmmClosePosition",ClmmSwapBaseIn:"ClmmSwapBaseIn",ClmmSwapBaseOut:"ClmmSwapBaseOut",ClmmInitReward:"ClmmInitReward",ClmmSetReward:"ClmmSetReward",ClmmCollectReward:"ClmmCollectReward",ClmmLockPosition:"ClmmLockPosition",ClmmHarvestLockPosition:"ClmmHarvestLockPosition",AmmV4Swap:"AmmV4Swap",AmmV4AddLiquidity:"AmmV4AddLiquidity",AmmV4RemoveLiquidity:"AmmV4RemoveLiquidity",AmmV4SimulatePoolInfo:"AmmV4SimulatePoolInfo",AmmV4SwapBaseIn:"AmmV4SwapBaseIn",AmmV4SwapBaseOut:"AmmV4SwapBaseOut",AmmV4CreatePool:"AmmV4CreatePool",AmmV4InitPool:"AmmV4InitPool",AmmV5AddLiquidity:"AmmV5AddLiquidity",AmmV5RemoveLiquidity:"AmmV5RemoveLiquidity",AmmV5SimulatePoolInfo:"AmmV5SimulatePoolInfo",AmmV5SwapBaseIn:"AmmV5SwapBaseIn",AmmV5SwapBaseOut:"AmmV5SwapBaseOut",RouteSwap:"RouteSwap",RouteSwap1:"RouteSwap1",RouteSwap2:"RouteSwap2",FarmV3Deposit:"FarmV3Deposit",FarmV3Withdraw:"FarmV3Withdraw",FarmV3CreateLedger:"FarmV3CreateLedger",FarmV4Withdraw:"FarmV4Withdraw",FarmV5Deposit:"FarmV5Deposit",FarmV5Withdraw:"FarmV5Withdraw",FarmV5CreateLedger:"FarmV5CreateLedger",FarmV6Deposit:"FarmV6Deposit",FarmV6Withdraw:"FarmV6Withdraw",FarmV6Create:"FarmV6Create",FarmV6Restart:"FarmV6Restart",FarmV6CreatorAddReward:"FarmV6CreatorAddReward",FarmV6CreatorWithdraw:"FarmV6CreatorWithdraw",CpmmCreatePool:"CpmmCreatePool",CpmmAddLiquidity:"CpmmAddLiquidity",CpmmWithdrawLiquidity:"CpmmWithdrawLiquidity",CpmmSwapBaseIn:"CpmmSwapBaseIn",CpmmSwapBaseOut:"CpmmSwapBaseOut",CpmmLockLp:"CpmmLockLp",CpmmCollectLockFee:"CpmmCollectLockFee",TransferTip:"TransferTip"};var ys=require("@solana/spl-token"),vc=ce("Raydium_txUtil");function xe(i,e){let[t,n]=Pt.PublicKey.findProgramAddressSync(i,e);return{publicKey:t,nonce:n}}function se(i,e,t){return xe([i.toBuffer(),(t!=null?t:Zi.TOKEN_PROGRAM_ID).toBuffer(),e.toBuffer()],new Qi.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"))}var D=require("@solana/web3.js"),gs=new D.PublicKey("EhhTKczWMGQt46ynNeRX1WfeagwwJd7ufHvCDjRxjo5Q"),Ps=new D.PublicKey("CBuCnLe26faBpcBP2fktp4rp8abpcAnTWft6ZrP5Q4T"),As=new D.PublicKey("9KEPoZmtHUrBbhWN1v1KWLMkkvwY6WLtAVUCPRtRjP4z"),ks=new D.PublicKey("FarmqiPv5eAj3j1GMdMCMUGXqPUvmquZtMy86QH6rzhG"),ws=new D.PublicKey("CLaimxFqjHzgTJtAGHU47NPhg6qrc5sCnpC4tBLyABQS"),Ts=new D.PublicKey("srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX"),Xn=new D.PublicKey("9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin"),ji=new D.PublicKey("675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8"),hs=new D.PublicKey("5quBtoiQqxF9Jv6KYKctB59NT3gtJD2Y65kdnB1Uev3h"),dn=new D.PublicKey("CDSr3ssLcRB6XYPJwAfFt18MZvEZp4LjHcvzBVZ45duo"),zn=new D.PublicKey("CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK"),Ji=new D.PublicKey("LockrWmn6K5twhz3y9w1dQERbmgSaRkfnTeTKbpofwE"),$i=new D.PublicKey("kN1kEznaF5Xbd8LYuqtEFcxzWSBk5Fv6ygX6SqEGJVy"),Gt=new D.PublicKey("CDSr3ssLcRB6XYPJwAfFt18MZvEZp4LjHcvzBVZ45duo"),Bs=new D.PublicKey("routeUGWgWzqBWFcrCfv8tritsqukccJPu3q5GPP3xS"),Is=new D.PublicKey("7YttLkHDoNj9wyDur5pM1ejNaAvT9X4eqaYcHQqtj2G5"),Dc=new D.PublicKey("6FJon3QE27qgPVggARueB22hLvoh22VzJpXv4rBEoSLF"),_c=new D.PublicKey("CC12se5To1CdEuw7fDS27B7Geo5jJyL7t5UK2B44NgiH"),qc=new D.PublicKey("9HzJyW1qZsEiSfMUf6L2jo3CcTKAyBmSyKdwQeYisHrC"),Gc=new D.PublicKey("DropEU8AvevN3UrXWXTMuz3rqnMczQVNjq3kcSdW2SQi"),Yn=new D.PublicKey("CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C"),eo=new D.PublicKey("GpMZbSM2GgvTKHJirzeGfMFoaZ8UR2X7F4v8vHTvxFbL"),xs=new D.PublicKey("DNXgeM9EiiaAbaWvwjHj9fQQLAX5ZsfHyvmYUNRAdNC8"),Ss=new D.PublicKey("LockrWmn6K5twhz3y9w1dQERbmgSaRkfnTeTKbpofwE"),Ks=new D.PublicKey("3f7GcQFG397GAaEnv51zR6tsTVihYRydnydDD1cXekxH"),to=new D.PublicKey("LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj"),Cs=new D.PublicKey("WLHv2UAZm6z4KyaaELi5pjdbJh6RESMva1Rnn8pJVVh"),Uc=new D.PublicKey("DRay6fNdQ5J82H7xV6uq2aV3mNrUZ1J4PgSKsWgptcm6"),Xc=new D.PublicKey("5xqNaZXX5eUi4p5HU4oz9i5QnwRNT2y6oN7yyn4qENeq"),Ns=new D.PublicKey("4Bu96XjU84XjPDSpveTVf6LYGCkfW5FK7SNkREWcEfV4"),Rs=new D.PublicKey("6s1xP3hpbAfFoNtUNF8mfHsjr2Bd97JxFJRWLbL6aHuX");var Oe={AMM_V4:ji,AMM_STABLE:hs,CLMM_PROGRAM_ID:zn,CLMM_LOCK_PROGRAM_ID:Ji,CLMM_LOCK_AUTH_ID:$i,FARM_PROGRAM_ID_V3:gs,FARM_PROGRAM_ID_V4:Ps,FARM_PROGRAM_ID_V5:As,FARM_PROGRAM_ID_V6:ks,OPEN_BOOK_PROGRAM:Ts,SERUM_PROGRAM_ID_V3:Xn,UTIL1216:ws,Router:Bs,CREATE_CPMM_POOL_PROGRAM:Yn,CREATE_CPMM_POOL_AUTH:eo,CREATE_CPMM_POOL_FEE_ACC:xs,LOCK_CPMM_PROGRAM:Ss,LOCK_CPMM_AUTH:Ks,LAUNCHPAD_PROGRAM:to,LAUNCHPAD_AUTH:Cs,LAUNCHPAD_PLATFORM:Ns,LAUNCHPAD_CONFIG:Rs,FEE_DESTINATION_ID:Is,MODEL_DATA_PUBKEY:Gt},zc={OPEN_BOOK_PROGRAM:new D.PublicKey("EoTcMgcDRTJVZDMZWBoU6rhYHZfkNTVEAfz3uUJRcYGj"),SERUM_PROGRAM_ID_V3:new D.PublicKey("Ray1111111111111111111111111111111111111111"),AMM_V4:new D.PublicKey("DRaya7Kj3aMWQSy19kSjvmuwq9docCHofyP9kanQGaav"),AMM_STABLE:new D.PublicKey("DRayDdXc1NZQ9C3hRWmoSf8zK4iapgMnjdNZWrfwsP8m"),CLMM_PROGRAM_ID:new D.PublicKey("DRayAUgENGQBKVaX8owNhgzkEDyoHTGVEGHVJT1E9pfH"),CLMM_LOCK_PROGRAM_I