UNPKG

@raydium-io/raydium-sdk-v2

Version:

An SDK for building applications on top of Raydium.

1 lines 366 kB
var vc=Object.defineProperty,_c=Object.defineProperties;var Vc=Object.getOwnPropertyDescriptors;var jo=Object.getOwnPropertySymbols;var Hs=Object.prototype.hasOwnProperty,Zs=Object.prototype.propertyIsEnumerable;var js=(o,e,t)=>e in o?vc(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,C=(o,e)=>{for(var t in e||(e={}))Hs.call(e,t)&&js(o,t,e[t]);if(jo)for(var t of jo(e))Zs.call(e,t)&&js(o,t,e[t]);return o},E=(o,e)=>_c(o,Vc(e));var Oe=(o,e)=>{var t={};for(var n in o)Hs.call(o,n)&&e.indexOf(n)<0&&(t[n]=o[n]);if(o!=null&&jo)for(var n of jo(o))e.indexOf(n)<0&&Zs.call(o,n)&&(t[n]=o[n]);return t};import Wa from"axios";import{get as oi,set as $s}from"lodash";var Fc=(r=>(r[r.Error=0]="Error",r[r.Warning=1]="Warning",r[r.Info=2]="Info",r[r.Debug=3]="Debug",r))(Fc||{}),ri=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}},ii={},Js={};function ce(o){let e=oi(ii,o);if(!e){let t=oi(Js,o);e=new ri({name:o,logLevel:t}),$s(ii,o,e)}return e}function Sf(o,e){$s(Js,o,e);let t=oi(ii,o);t&&(t.level=e)}import{PublicKey as Zl}from"@solana/web3.js";import $l from"bn.js";import jl from"big.js";import nn from"bn.js";import Te from"bn.js";var Nn=9e15,tn=1e9,si="0123456789abcdef",Zo="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",$o="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",ai={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Nn,maxE:Nn,crypto:!1},oa,Et,oe=!0,er="[DecimalError] ",en=er+"Invalid argument: ",ra=er+"Precision limit exceeded",ia=er+"crypto unavailable",sa="[object Decimal]",$e=Math.floor,Ve=Math.pow,Ec=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Dc=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Wc=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,aa=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,It=1e7,te=7,qc=9007199254740991,Uc=Zo.length-1,ui=$o.length-1,_={toStringTag:sa};_.absoluteValue=_.abs=function(){var o=new this.constructor(this);return o.s<0&&(o.s=1),$(o)};_.ceil=function(){return $(new this.constructor(this),this.e+1,2)};_.clampedTo=_.clamp=function(o,e){var t,n=this,r=n.constructor;if(o=new r(o),e=new r(e),!o.s||!e.s)return new r(NaN);if(o.gt(e))throw Error(en+e);return t=n.cmp(o),t<0?o:n.cmp(e)>0?e:new r(n)};_.comparedTo=_.cmp=function(o){var e,t,n,r,i=this,s=i.d,a=(o=new i.constructor(o)).d,u=i.s,c=o.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!==o.e)return i.e>o.e^u<0?1:-1;for(n=s.length,r=a.length,e=0,t=n<r?n:r;e<t;++e)if(s[e]!==a[e])return s[e]>a[e]^u<0?1:-1;return n===r?0:n>r^u<0?1:-1};_.cosine=_.cos=function(){var o,e,t=this,n=t.constructor;return t.d?t.d[0]?(o=n.precision,e=n.rounding,n.precision=o+Math.max(t.e,t.sd())+te,n.rounding=1,t=Gc(n,da(n,t)),n.precision=o,n.rounding=e,$(Et==2||Et==3?t.neg():t,o,e,!0)):new n(1):new n(NaN)};_.cubeRoot=_.cbrt=function(){var o,e,t,n,r,i,s,a,u,c,l=this,m=l.constructor;if(!l.isFinite()||l.isZero())return new m(l);for(oe=!1,i=l.s*Ve(l.s*l,1/3),!i||Math.abs(i)==1/0?(t=ze(l.d),o=l.e,(i=(o-t.length+1)%3)&&(t+=i==1||i==-2?"0":"00"),i=Ve(t,1/3),o=$e((o+1)/3)-(o%3==(o<0?-1:2)),i==1/0?t="5e"+o:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+o),n=new m(t),n.s=l.s):n=new m(i.toString()),s=(o=m.precision)+3;;)if(a=n,u=a.times(a).times(a),c=u.plus(l),n=ke(c.plus(l).times(a),c.plus(u),s+2,1),ze(a.d).slice(0,s)===(t=ze(n.d)).slice(0,s))if(t=t.slice(s-3,s+1),t=="9999"||!r&&t=="4999"){if(!r&&($(a,o+1,0),a.times(a).times(a).eq(l))){n=a;break}s+=4,r=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&($(n,o+1,1),e=!n.times(n).times(n).eq(l));break}return oe=!0,$(n,o,m.rounding,e)};_.decimalPlaces=_.dp=function(){var o,e=this.d,t=NaN;if(e){if(o=e.length-1,t=(o-$e(this.e/te))*te,o=e[o],o)for(;o%10==0;o/=10)t--;t<0&&(t=0)}return t};_.dividedBy=_.div=function(o){return ke(this,new this.constructor(o))};_.dividedToIntegerBy=_.divToInt=function(o){var e=this,t=e.constructor;return $(ke(e,new t(o),0,1,1),t.precision,t.rounding)};_.equals=_.eq=function(o){return this.cmp(o)===0};_.floor=function(){return $(new this.constructor(this),this.e+1,3)};_.greaterThan=_.gt=function(o){return this.cmp(o)>0};_.greaterThanOrEqualTo=_.gte=function(o){var e=this.cmp(o);return e==1||e===0};_.hyperbolicCosine=_.cosh=function(){var o,e,t,n,r,i=this,s=i.constructor,a=new s(1);if(!i.isFinite())return new s(i.s?1/0:NaN);if(i.isZero())return a;t=s.precision,n=s.rounding,s.precision=t+Math.max(i.e,i.sd())+4,s.rounding=1,r=i.d.length,r<32?(o=Math.ceil(r/3),e=(1/nr(4,o)).toString()):(o=16,e="2.3283064365386962890625e-10"),i=Mn(s,1,i.times(e),new s(1),!0);for(var u,c=o,l=new s(8);c--;)u=i.times(i),i=a.minus(u.times(l.minus(u.times(l))));return $(i,s.precision=t,s.rounding=n,!0)};_.hyperbolicSine=_.sinh=function(){var o,e,t,n,r=this,i=r.constructor;if(!r.isFinite()||r.isZero())return new i(r);if(e=i.precision,t=i.rounding,i.precision=e+Math.max(r.e,r.sd())+4,i.rounding=1,n=r.d.length,n<3)r=Mn(i,2,r,r,!0);else{o=1.4*Math.sqrt(n),o=o>16?16:o|0,r=r.times(1/nr(5,o)),r=Mn(i,2,r,r,!0);for(var s,a=new i(5),u=new i(16),c=new i(20);o--;)s=r.times(r),r=r.times(a.plus(s.times(u.times(s).plus(c))))}return i.precision=e,i.rounding=t,$(r,e,t,!0)};_.hyperbolicTangent=_.tanh=function(){var o,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(o=n.precision,e=n.rounding,n.precision=o+7,n.rounding=1,ke(t.sinh(),t.cosh(),n.precision=o,n.rounding=e)):new n(t.s)};_.inverseCosine=_.acos=function(){var o,e=this,t=e.constructor,n=e.abs().cmp(1),r=t.precision,i=t.rounding;return n!==-1?n===0?e.isNeg()?Tt(t,r,i):new t(0):new t(NaN):e.isZero()?Tt(t,r+4,i).times(.5):(t.precision=r+6,t.rounding=1,e=e.asin(),o=Tt(t,r+4,i).times(.5),t.precision=r,t.rounding=i,o.minus(e))};_.inverseHyperbolicCosine=_.acosh=function(){var o,e,t=this,n=t.constructor;return t.lte(1)?new n(t.eq(1)?0:NaN):t.isFinite()?(o=n.precision,e=n.rounding,n.precision=o+Math.max(Math.abs(t.e),t.sd())+4,n.rounding=1,oe=!1,t=t.times(t).minus(1).sqrt().plus(t),oe=!0,n.precision=o,n.rounding=e,t.ln()):new n(t)};_.inverseHyperbolicSine=_.asinh=function(){var o,e,t=this,n=t.constructor;return!t.isFinite()||t.isZero()?new n(t):(o=n.precision,e=n.rounding,n.precision=o+2*Math.max(Math.abs(t.e),t.sd())+6,n.rounding=1,oe=!1,t=t.times(t).plus(1).sqrt().plus(t),oe=!0,n.precision=o,n.rounding=e,t.ln())};_.inverseHyperbolicTangent=_.atanh=function(){var o,e,t,n,r=this,i=r.constructor;return r.isFinite()?r.e>=0?new i(r.abs().eq(1)?r.s/0:r.isZero()?r:NaN):(o=i.precision,e=i.rounding,n=r.sd(),Math.max(n,o)<2*-r.e-1?$(new i(r),o,e,!0):(i.precision=t=n-r.e,r=ke(r.plus(1),new i(1).minus(r),t+o,1),i.precision=o+4,i.rounding=1,r=r.ln(),i.precision=o,i.rounding=e,r.times(.5))):new i(NaN)};_.inverseSine=_.asin=function(){var o,e,t,n,r=this,i=r.constructor;return r.isZero()?new i(r):(e=r.abs().cmp(1),t=i.precision,n=i.rounding,e!==-1?e===0?(o=Tt(i,t+4,n).times(.5),o.s=r.s,o):new i(NaN):(i.precision=t+6,i.rounding=1,r=r.div(new i(1).minus(r.times(r)).sqrt().plus(1)).atan(),i.precision=t,i.rounding=n,r.times(2)))};_.inverseTangent=_.atan=function(){var o,e,t,n,r,i,s,a,u,c=this,l=c.constructor,m=l.precision,d=l.rounding;if(c.isFinite()){if(c.isZero())return new l(c);if(c.abs().eq(1)&&m+4<=ui)return s=Tt(l,m+4,d).times(.25),s.s=c.s,s}else{if(!c.s)return new l(NaN);if(m+4<=ui)return s=Tt(l,m+4,d).times(.5),s.s=c.s,s}for(l.precision=a=m+10,l.rounding=1,t=Math.min(28,a/te+2|0),o=t;o;--o)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(oe=!1,e=Math.ceil(a/te),n=1,u=c.times(c),s=new l(c),r=c;o!==-1;)if(r=r.times(u),i=s.minus(r.div(n+=2)),r=r.times(u),s=i.plus(r.div(n+=2)),s.d[e]!==void 0)for(o=e;s.d[o]===i.d[o]&&o--;);return t&&(s=s.times(2<<t-1)),oe=!0,$(s,l.precision=m,l.rounding=d,!0)};_.isFinite=function(){return!!this.d};_.isInteger=_.isInt=function(){return!!this.d&&$e(this.e/te)>this.d.length-2};_.isNaN=function(){return!this.s};_.isNegative=_.isNeg=function(){return this.s<0};_.isPositive=_.isPos=function(){return this.s>0};_.isZero=function(){return!!this.d&&this.d[0]===0};_.lessThan=_.lt=function(o){return this.cmp(o)<0};_.lessThanOrEqualTo=_.lte=function(o){return this.cmp(o)<1};_.logarithm=_.log=function(o){var e,t,n,r,i,s,a,u,c=this,l=c.constructor,m=l.precision,d=l.rounding,p=5;if(o==null)o=new l(10),e=!0;else{if(o=new l(o),t=o.d,o.s<0||!t||!t[0]||o.eq(1))return new l(NaN);e=o.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)i=!0;else{for(r=t[0];r%10===0;)r/=10;i=r!==1}if(oe=!1,a=m+p,s=Jt(c,a),n=e?Jo(l,a+10):Jt(o,a),u=ke(s,n,a,1),$n(u.d,r=m,d))do if(a+=10,s=Jt(c,a),n=e?Jo(l,a+10):Jt(o,a),u=ke(s,n,a,1),!i){+ze(u.d).slice(r+1,r+15)+1==1e14&&(u=$(u,m+1,0));break}while($n(u.d,r+=10,d));return oe=!0,$(u,m,d)};_.minus=_.sub=function(o){var e,t,n,r,i,s,a,u,c,l,m,d,p=this,y=p.constructor;if(o=new y(o),!p.d||!o.d)return!p.s||!o.s?o=new y(NaN):p.d?o.s=-o.s:o=new y(o.d||p.s!==o.s?p:NaN),o;if(p.s!=o.s)return o.s=-o.s,p.plus(o);if(c=p.d,d=o.d,a=y.precision,u=y.rounding,!c[0]||!d[0]){if(d[0])o.s=-o.s;else if(c[0])o=new y(p);else return new y(u===3?-0:0);return oe?$(o,a,u):o}if(t=$e(o.e/te),l=$e(p.e/te),c=c.slice(),i=l-t,i){for(m=i<0,m?(e=c,i=-i,s=d.length):(e=d,t=l,s=c.length),n=Math.max(Math.ceil(a/te),s)+2,i>n&&(i=n,e.length=1),e.reverse(),n=i;n--;)e.push(0);e.reverse()}else{for(n=c.length,s=d.length,m=n<s,m&&(s=n),n=0;n<s;n++)if(c[n]!=d[n]){m=c[n]<d[n];break}i=0}for(m&&(e=c,c=d,d=e,o.s=-o.s),s=c.length,n=d.length-s;n>0;--n)c[s++]=0;for(n=d.length;n>i;){if(c[--n]<d[n]){for(r=n;r&&c[--r]===0;)c[r]=It-1;--c[r],c[n]+=It}c[n]-=d[n]}for(;c[--s]===0;)c.pop();for(;c[0]===0;c.shift())--t;return c[0]?(o.d=c,o.e=tr(c,t),oe?$(o,a,u):o):new y(u===3?-0:0)};_.modulo=_.mod=function(o){var e,t=this,n=t.constructor;return o=new n(o),!t.d||!o.s||o.d&&!o.d[0]?new n(NaN):!o.d||t.d&&!t.d[0]?$(new n(t),n.precision,n.rounding):(oe=!1,n.modulo==9?(e=ke(t,o.abs(),0,3,1),e.s*=o.s):e=ke(t,o,0,n.modulo,1),e=e.times(o),oe=!0,t.minus(e))};_.naturalExponential=_.exp=function(){return ci(this)};_.naturalLogarithm=_.ln=function(){return Jt(this)};_.negated=_.neg=function(){var o=new this.constructor(this);return o.s=-o.s,$(o)};_.plus=_.add=function(o){var e,t,n,r,i,s,a,u,c,l,m=this,d=m.constructor;if(o=new d(o),!m.d||!o.d)return!m.s||!o.s?o=new d(NaN):m.d||(o=new d(o.d||m.s===o.s?m:NaN)),o;if(m.s!=o.s)return o.s=-o.s,m.minus(o);if(c=m.d,l=o.d,a=d.precision,u=d.rounding,!c[0]||!l[0])return l[0]||(o=new d(m)),oe?$(o,a,u):o;if(i=$e(m.e/te),n=$e(o.e/te),c=c.slice(),r=i-n,r){for(r<0?(t=c,r=-r,s=l.length):(t=l,n=i,s=c.length),i=Math.ceil(a/te),s=i>s?i+1:s+1,r>s&&(r=s,t.length=1),t.reverse();r--;)t.push(0);t.reverse()}for(s=c.length,r=l.length,s-r<0&&(r=s,t=l,l=c,c=t),e=0;r;)e=(c[--r]=c[r]+l[r]+e)/It|0,c[r]%=It;for(e&&(c.unshift(e),++n),s=c.length;c[--s]==0;)c.pop();return o.d=c,o.e=tr(c,n),oe?$(o,a,u):o};_.precision=_.sd=function(o){var e,t=this;if(o!==void 0&&o!==!!o&&o!==1&&o!==0)throw Error(en+o);return t.d?(e=ua(t.d),o&&t.e+1>e&&(e=t.e+1)):e=NaN,e};_.round=function(){var o=this,e=o.constructor;return $(new e(o),o.e+1,e.rounding)};_.sine=_.sin=function(){var o,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(o=n.precision,e=n.rounding,n.precision=o+Math.max(t.e,t.sd())+te,n.rounding=1,t=zc(n,da(n,t)),n.precision=o,n.rounding=e,$(Et>2?t.neg():t,o,e,!0)):new n(NaN)};_.squareRoot=_.sqrt=function(){var o,e,t,n,r,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(oe=!1,c=Math.sqrt(+s),c==0||c==1/0?(e=ze(a),(e.length+u)%2==0&&(e+="0"),c=Math.sqrt(e),u=$e((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(i=n,n=i.plus(ke(s,i,t+2,1)).times(.5),ze(i.d).slice(0,t)===(e=ze(n.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!r&&e=="4999"){if(!r&&($(i,u+1,0),i.times(i).eq(s))){n=i;break}t+=4,r=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&($(n,u+1,1),o=!n.times(n).eq(s));break}return oe=!0,$(n,u,l.rounding,o)};_.tangent=_.tan=function(){var o,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(o=n.precision,e=n.rounding,n.precision=o+10,n.rounding=1,t=t.sin(),t.s=1,t=ke(t,new n(1).minus(t.times(t)).sqrt(),o+10,0),n.precision=o,n.rounding=e,$(Et==2||Et==4?t.neg():t,o,e,!0)):new n(NaN)};_.times=_.mul=function(o){var e,t,n,r,i,s,a,u,c,l=this,m=l.constructor,d=l.d,p=(o=new m(o)).d;if(o.s*=l.s,!d||!d[0]||!p||!p[0])return new m(!o.s||d&&!d[0]&&!p||p&&!p[0]&&!d?NaN:!d||!p?o.s/0:o.s*0);for(t=$e(l.e/te)+$e(o.e/te),u=d.length,c=p.length,u<c&&(i=d,d=p,p=i,s=u,u=c,c=s),i=[],s=u+c,n=s;n--;)i.push(0);for(n=c;--n>=0;){for(e=0,r=u+n;r>n;)a=i[r]+p[n]*d[r-n-1]+e,i[r--]=a%It|0,e=a/It|0;i[r]=(i[r]+e)%It|0}for(;!i[--s];)i.pop();return e?++t:i.shift(),o.d=i,o.e=tr(i,t),oe?$(o,m.precision,m.rounding):o};_.toBinary=function(o,e){return mi(this,2,o,e)};_.toDecimalPlaces=_.toDP=function(o,e){var t=this,n=t.constructor;return t=new n(t),o===void 0?t:(at(o,0,tn),e===void 0?e=n.rounding:at(e,0,8),$(t,o+t.e+1,e))};_.toExponential=function(o,e){var t,n=this,r=n.constructor;return o===void 0?t=Nt(n,!0):(at(o,0,tn),e===void 0?e=r.rounding:at(e,0,8),n=$(new r(n),o+1,e),t=Nt(n,!0,o+1)),n.isNeg()&&!n.isZero()?"-"+t:t};_.toFixed=function(o,e){var t,n,r=this,i=r.constructor;return o===void 0?t=Nt(r):(at(o,0,tn),e===void 0?e=i.rounding:at(e,0,8),n=$(new i(r),o+r.e+1,e),t=Nt(n,!1,o+n.e+1)),r.isNeg()&&!r.isZero()?"-"+t:t};_.toFraction=function(o){var e,t,n,r,i,s,a,u,c,l,m,d,p=this,y=p.d,f=p.constructor;if(!y)return new f(p);if(c=t=new f(1),n=u=new f(0),e=new f(n),i=e.e=ua(y)-p.e-1,s=i%te,e.d[0]=Ve(10,s<0?te+s:s),o==null)o=i>0?e:c;else{if(a=new f(o),!a.isInt()||a.lt(c))throw Error(en+a);o=a.gt(e)?i>0?e:c:a}for(oe=!1,a=new f(ze(y)),l=f.precision,f.precision=i=y.length*te*2;m=ke(a,e,0,1,1),r=t.plus(m.times(n)),r.cmp(o)!=1;)t=n,n=r,r=c,c=u.plus(m.times(r)),u=r,r=e,e=a.minus(m.times(r)),a=r;return r=ke(o.minus(t),n,0,1,1),u=u.plus(r.times(c)),t=t.plus(r.times(n)),u.s=c.s=p.s,d=ke(c,n,i,1).minus(p).abs().cmp(ke(u,t,i,1).minus(p).abs())<1?[c,n]:[u,t],f.precision=l,oe=!0,d};_.toHexadecimal=_.toHex=function(o,e){return mi(this,16,o,e)};_.toNearest=function(o,e){var t=this,n=t.constructor;if(t=new n(t),o==null){if(!t.d)return t;o=new n(1),e=n.rounding}else{if(o=new n(o),e===void 0?e=n.rounding:at(e,0,8),!t.d)return o.s?t:o;if(!o.d)return o.s&&(o.s=t.s),o}return o.d[0]?(oe=!1,t=ke(t,o,0,e,1).times(o),oe=!0,$(t)):(o.s=t.s,t=o),t};_.toNumber=function(){return+this};_.toOctal=function(o,e){return mi(this,8,o,e)};_.toPower=_.pow=function(o){var e,t,n,r,i,s,a=this,u=a.constructor,c=+(o=new u(o));if(!a.d||!o.d||!a.d[0]||!o.d[0])return new u(Ve(+a,c));if(a=new u(a),a.eq(1))return a;if(n=u.precision,i=u.rounding,o.eq(1))return $(a,n,i);if(e=$e(o.e/te),e>=o.d.length-1&&(t=c<0?-c:c)<=qc)return r=ca(u,a,t,n),o.s<0?new u(1).div(r):$(r,n,i);if(s=a.s,s<0){if(e<o.d.length-1)return new u(NaN);if((o.d[e]&1)==0&&(s=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=s,a}return t=Ve(+a,c),e=t==0||!isFinite(t)?$e(c*(Math.log("0."+ze(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):(oe=!1,u.rounding=a.s=1,t=Math.min(12,(e+"").length),r=ci(o.times(Jt(a,n+t)),n),r.d&&(r=$(r,n+5,1),$n(r.d,n,i)&&(e=n+10,r=$(ci(o.times(Jt(a,e+t)),e),e+5,1),+ze(r.d).slice(n+1,n+15)+1==1e14&&(r=$(r,n+1,0)))),r.s=s,oe=!0,u.rounding=i,$(r,n,i))};_.toPrecision=function(o,e){var t,n=this,r=n.constructor;return o===void 0?t=Nt(n,n.e<=r.toExpNeg||n.e>=r.toExpPos):(at(o,1,tn),e===void 0?e=r.rounding:at(e,0,8),n=$(new r(n),o,e),t=Nt(n,o<=n.e||n.e<=r.toExpNeg,o)),n.isNeg()&&!n.isZero()?"-"+t:t};_.toSignificantDigits=_.toSD=function(o,e){var t=this,n=t.constructor;return o===void 0?(o=n.precision,e=n.rounding):(at(o,1,tn),e===void 0?e=n.rounding:at(e,0,8)),$(new n(t),o,e)};_.toString=function(){var o=this,e=o.constructor,t=Nt(o,o.e<=e.toExpNeg||o.e>=e.toExpPos);return o.isNeg()&&!o.isZero()?"-"+t:t};_.truncated=_.trunc=function(){return $(new this.constructor(this),this.e+1,1)};_.valueOf=_.toJSON=function(){var o=this,e=o.constructor,t=Nt(o,o.e<=e.toExpNeg||o.e>=e.toExpPos);return o.isNeg()?"-"+t:t};function ze(o){var e,t,n,r=o.length-1,i="",s=o[0];if(r>0){for(i+=s,e=1;e<r;e++)n=o[e]+"",t=te-n.length,t&&(i+=$t(t)),i+=n;s=o[e],n=s+"",t=te-n.length,t&&(i+=$t(t))}else if(s===0)return"0";for(;s%10===0;)s/=10;return i+s}function at(o,e,t){if(o!==~~o||o<e||o>t)throw Error(en+o)}function $n(o,e,t,n){var r,i,s,a;for(i=o[0];i>=10;i/=10)--e;return--e<0?(e+=te,r=0):(r=Math.ceil((e+1)/te),e%=te),i=Ve(10,te-e),a=o[r]%i|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==i||t>3&&a+1==i/2)&&(o[r+1]/i/100|0)==Ve(10,e-2)-1||(a==i/2||a==0)&&(o[r+1]/i/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==i||!n&&t>3&&a+1==i/2)&&(o[r+1]/i/1e3|0)==Ve(10,e-3)-1,s}function Ho(o,e,t){for(var n,r=[0],i,s=0,a=o.length;s<a;){for(i=r.length;i--;)r[i]*=e;for(r[0]+=si.indexOf(o.charAt(s++)),n=0;n<r.length;n++)r[n]>t-1&&(r[n+1]===void 0&&(r[n+1]=0),r[n+1]+=r[n]/t|0,r[n]%=t)}return r.reverse()}function Gc(o,e){var t,n,r;if(e.isZero())return e;n=e.d.length,n<32?(t=Math.ceil(n/3),r=(1/nr(4,t)).toString()):(t=16,r="2.3283064365386962890625e-10"),o.precision+=t,e=Mn(o,1,e.times(r),new o(1));for(var i=t;i--;){var s=e.times(e);e=s.times(s).minus(s).times(8).plus(1)}return o.precision-=t,e}var ke=function(){function o(n,r,i){var s,a=0,u=n.length;for(n=n.slice();u--;)s=n[u]*r+a,n[u]=s%i|0,a=s/i|0;return a&&n.unshift(a),n}function e(n,r,i,s){var a,u;if(i!=s)u=i>s?1:-1;else for(a=u=0;a<i;a++)if(n[a]!=r[a]){u=n[a]>r[a]?1:-1;break}return u}function t(n,r,i,s){for(var a=0;i--;)n[i]-=a,a=n[i]<r[i]?1:0,n[i]=a*s+n[i]-r[i];for(;!n[0]&&n.length>1;)n.shift()}return function(n,r,i,s,a,u){var c,l,m,d,p,y,f,b,g,w,A,k,I,T,S,x,R,B,M,D,V=n.constructor,Z=n.s==r.s?1:-1,G=n.d,q=r.d;if(!G||!G[0]||!q||!q[0])return new V(!n.s||!r.s||(G?q&&G[0]==q[0]:!q)?NaN:G&&G[0]==0||!q?Z*0:Z/0);for(u?(p=1,l=n.e-r.e):(u=It,p=te,l=$e(n.e/p)-$e(r.e/p)),M=q.length,R=G.length,g=new V(Z),w=g.d=[],m=0;q[m]==(G[m]||0);m++);if(q[m]>(G[m]||0)&&l--,i==null?(T=i=V.precision,s=V.rounding):a?T=i+(n.e-r.e)+1:T=i,T<0)w.push(1),y=!0;else{if(T=T/p+2|0,m=0,M==1){for(d=0,q=q[0],T++;(m<R||d)&&T--;m++)S=d*u+(G[m]||0),w[m]=S/q|0,d=S%q|0;y=d||m<R}else{for(d=u/(q[0]+1)|0,d>1&&(q=o(q,d,u),G=o(G,d,u),M=q.length,R=G.length),x=M,A=G.slice(0,M),k=A.length;k<M;)A[k++]=0;D=q.slice(),D.unshift(0),B=q[0],q[1]>=u/2&&++B;do d=0,c=e(q,A,M,k),c<0?(I=A[0],M!=k&&(I=I*u+(A[1]||0)),d=I/B|0,d>1?(d>=u&&(d=u-1),f=o(q,d,u),b=f.length,k=A.length,c=e(f,A,b,k),c==1&&(d--,t(f,M<b?D:q,b,u))):(d==0&&(c=d=1),f=q.slice()),b=f.length,b<k&&f.unshift(0),t(A,f,k,u),c==-1&&(k=A.length,c=e(q,A,M,k),c<1&&(d++,t(A,M<k?D:q,k,u))),k=A.length):c===0&&(d++,A=[0]),w[m++]=d,c&&A[0]?A[k++]=G[x]||0:(A=[G[x]],k=1);while((x++<R||A[0]!==void 0)&&T--);y=A[0]!==void 0}w[0]||w.shift()}if(p==1)g.e=l,oa=y;else{for(m=1,d=w[0];d>=10;d/=10)m++;g.e=m+l*p-1,$(g,a?i+g.e+1:i,s,y)}return g}}();function $(o,e,t,n){var r,i,s,a,u,c,l,m,d,p=o.constructor;e:if(e!=null){if(m=o.d,!m)return o;for(r=1,a=m[0];a>=10;a/=10)r++;if(i=e-r,i<0)i+=te,s=e,l=m[d=0],u=l/Ve(10,r-s-1)%10|0;else if(d=Math.ceil((i+1)/te),a=m.length,d>=a)if(n){for(;a++<=d;)m.push(0);l=u=0,r=1,i%=te,s=i-te+1}else break e;else{for(l=a=m[d],r=1;a>=10;a/=10)r++;i%=te,s=i-te+r,u=s<0?0:l/Ve(10,r-s-1)%10|0}if(n=n||e<0||m[d+1]!==void 0||(s<0?l:l%Ve(10,r-s-1)),c=t<4?(u||n)&&(t==0||t==(o.s<0?3:2)):u>5||u==5&&(t==4||n||t==6&&(i>0?s>0?l/Ve(10,r-s):0:m[d-1])%10&1||t==(o.s<0?8:7)),e<1||!m[0])return m.length=0,c?(e-=o.e+1,m[0]=Ve(10,(te-e%te)%te),o.e=-e||0):m[0]=o.e=0,o;if(i==0?(m.length=d,a=1,d--):(m.length=d+1,a=Ve(10,te-i),m[d]=s>0?(l/Ve(10,r-s)%Ve(10,s)|0)*a:0),c)for(;;)if(d==0){for(i=1,s=m[0];s>=10;s/=10)i++;for(s=m[0]+=a,a=1;s>=10;s/=10)a++;i!=a&&(o.e++,m[0]==It&&(m[0]=1));break}else{if(m[d]+=a,m[d]!=It)break;m[d--]=0,a=1}for(i=m.length;m[--i]===0;)m.pop()}return oe&&(o.e>p.maxE?(o.d=null,o.e=NaN):o.e<p.minE&&(o.e=0,o.d=[0])),o}function Nt(o,e,t){if(!o.isFinite())return ma(o);var n,r=o.e,i=ze(o.d),s=i.length;return e?(t&&(n=t-s)>0?i=i.charAt(0)+"."+i.slice(1)+$t(n):s>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(o.e<0?"e":"e+")+o.e):r<0?(i="0."+$t(-r-1)+i,t&&(n=t-s)>0&&(i+=$t(n))):r>=s?(i+=$t(r+1-s),t&&(n=t-r-1)>0&&(i=i+"."+$t(n))):((n=r+1)<s&&(i=i.slice(0,n)+"."+i.slice(n)),t&&(n=t-s)>0&&(r+1===s&&(i+="."),i+=$t(n))),i}function tr(o,e){var t=o[0];for(e*=te;t>=10;t/=10)e++;return e}function Jo(o,e,t){if(e>Uc)throw oe=!0,t&&(o.precision=t),Error(ra);return $(new o(Zo),e,1,!0)}function Tt(o,e,t){if(e>ui)throw Error(ra);return $(new o($o),e,t,!0)}function ua(o){var e=o.length-1,t=e*te+1;if(e=o[e],e){for(;e%10==0;e/=10)t--;for(e=o[0];e>=10;e/=10)t++}return t}function $t(o){for(var e="";o--;)e+="0";return e}function ca(o,e,t,n){var r,i=new o(1),s=Math.ceil(n/te+4);for(oe=!1;;){if(t%2&&(i=i.times(e),ta(i.d,s)&&(r=!0)),t=$e(t/2),t===0){t=i.d.length-1,r&&i.d[t]===0&&++i.d[t];break}e=e.times(e),ta(e.d,s)}return oe=!0,i}function ea(o){return o.d[o.d.length-1]&1}function la(o,e,t){for(var n,r=new o(e[0]),i=0;++i<e.length;)if(n=new o(e[i]),n.s)r[t](n)&&(r=n);else{r=n;break}return r}function ci(o,e){var t,n,r,i,s,a,u,c=0,l=0,m=0,d=o.constructor,p=d.rounding,y=d.precision;if(!o.d||!o.d[0]||o.e>17)return new d(o.d?o.d[0]?o.s<0?0:1/0:1:o.s?o.s<0?0:o:0/0);for(e==null?(oe=!1,u=y):u=e,a=new d(.03125);o.e>-2;)o=o.times(a),m+=5;for(n=Math.log(Ve(2,m))/Math.LN10*2+5|0,u+=n,t=i=s=new d(1),d.precision=u;;){if(i=$(i.times(o),u,1),t=t.times(++l),a=s.plus(ke(i,t,u,1)),ze(a.d).slice(0,u)===ze(s.d).slice(0,u)){for(r=m;r--;)s=$(s.times(s),u,1);if(e==null)if(c<3&&$n(s.d,u-n,p,c))d.precision=u+=10,t=i=a=new d(1),l=0,c++;else return $(s,d.precision=y,p,oe=!0);else return d.precision=y,s}s=a}}function Jt(o,e){var t,n,r,i,s,a,u,c,l,m,d,p=1,y=10,f=o,b=f.d,g=f.constructor,w=g.rounding,A=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?(oe=!1,l=A):l=e,g.precision=l+=y,t=ze(b),n=t.charAt(0),Math.abs(i=f.e)<15e14){for(;n<7&&n!=1||n==1&&t.charAt(1)>3;)f=f.times(o),t=ze(f.d),n=t.charAt(0),p++;i=f.e,n>1?(f=new g("0."+t),i++):f=new g(n+"."+t.slice(1))}else return c=Jo(g,l+2,A).times(i+""),f=Jt(new g(n+"."+t.slice(1)),l-y).plus(c),g.precision=A,e==null?$(f,A,w,oe=!0):f;for(m=f,u=s=f=ke(f.minus(1),f.plus(1),l,1),d=$(f.times(f),l,1),r=3;;){if(s=$(s.times(d),l,1),c=u.plus(ke(s,new g(r),l,1)),ze(c.d).slice(0,l)===ze(u.d).slice(0,l))if(u=u.times(2),i!==0&&(u=u.plus(Jo(g,l+2,A).times(i+""))),u=ke(u,new g(p),l,1),e==null)if($n(u.d,l-y,w,a))g.precision=l+=y,c=s=f=ke(m.minus(1),m.plus(1),l,1),d=$(f.times(f),l,1),r=a=1;else return $(u,g.precision=A,w,oe=!0);else return g.precision=A,u;u=c,r+=2}}function ma(o){return String(o.s*o.s/0)}function li(o,e){var t,n,r;for((t=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(t<0&&(t=n),t+=+e.slice(n+1),e=e.substring(0,n)):t<0&&(t=e.length),n=0;e.charCodeAt(n)===48;n++);for(r=e.length;e.charCodeAt(r-1)===48;--r);if(e=e.slice(n,r),e){if(r-=n,o.e=t=t-n-1,o.d=[],n=(t+1)%te,t<0&&(n+=te),n<r){for(n&&o.d.push(+e.slice(0,n)),r-=te;n<r;)o.d.push(+e.slice(n,n+=te));e=e.slice(n),n=te-e.length}else n-=r;for(;n--;)e+="0";o.d.push(+e),oe&&(o.e>o.constructor.maxE?(o.d=null,o.e=NaN):o.e<o.constructor.minE&&(o.e=0,o.d=[0]))}else o.e=0,o.d=[0];return o}function Xc(o,e){var t,n,r,i,s,a,u,c,l;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),aa.test(e))return li(o,e)}else if(e==="Infinity"||e==="NaN")return+e||(o.s=NaN),o.e=NaN,o.d=null,o;if(Dc.test(e))t=16,e=e.toLowerCase();else if(Ec.test(e))t=2;else if(Wc.test(e))t=8;else throw Error(en+e);for(i=e.search(/p/i),i>0?(u=+e.slice(i+1),e=e.substring(2,i)):e=e.slice(2),i=e.indexOf("."),s=i>=0,n=o.constructor,s&&(e=e.replace(".",""),a=e.length,i=a-i,r=ca(n,new n(t),i,i*2)),c=Ho(e,t,It),l=c.length-1,i=l;c[i]===0;--i)c.pop();return i<0?new n(o.s*0):(o.e=tr(c,l),o.d=c,oe=!1,s&&(o=ke(o,r,a*4)),u&&(o=o.times(Math.abs(u)<54?Ve(2,u):Jn.pow(2,u))),oe=!0,o)}function zc(o,e){var t,n=e.d.length;if(n<3)return e.isZero()?e:Mn(o,2,e,e);t=1.4*Math.sqrt(n),t=t>16?16:t|0,e=e.times(1/nr(5,t)),e=Mn(o,2,e,e);for(var r,i=new o(5),s=new o(16),a=new o(20);t--;)r=e.times(e),e=e.times(i.plus(r.times(s.times(r).minus(a))));return e}function Mn(o,e,t,n,r){var i,s,a,u,c=1,l=o.precision,m=Math.ceil(l/te);for(oe=!1,u=t.times(t),a=new o(n);;){if(s=ke(a.times(u),new o(e++*e++),l,1),a=r?n.plus(s):n.minus(s),n=ke(s.times(u),new o(e++*e++),l,1),s=a.plus(n),s.d[m]!==void 0){for(i=m;s.d[i]===a.d[i]&&i--;);if(i==-1)break}i=a,a=n,n=s,s=i,c++}return oe=!0,s.d.length=m+1,s}function nr(o,e){for(var t=o;--e;)t*=o;return t}function da(o,e){var t,n=e.s<0,r=Tt(o,o.precision,1),i=r.times(.5);if(e=e.abs(),e.lte(i))return Et=n?4:1,e;if(t=e.divToInt(r),t.isZero())Et=n?3:2;else{if(e=e.minus(t.times(r)),e.lte(i))return Et=ea(t)?n?2:3:n?4:1,e;Et=ea(t)?n?1:4:n?3:2}return e.minus(r).abs()}function mi(o,e,t,n){var r,i,s,a,u,c,l,m,d,p=o.constructor,y=t!==void 0;if(y?(at(t,1,tn),n===void 0?n=p.rounding:at(n,0,8)):(t=p.precision,n=p.rounding),!o.isFinite())l=ma(o);else{for(l=Nt(o),s=l.indexOf("."),y?(r=2,e==16?t=t*4-3:e==8&&(t=t*3-2)):r=e,s>=0&&(l=l.replace(".",""),d=new p(1),d.e=l.length-s,d.d=Ho(Nt(d),10,r),d.e=d.d.length),m=Ho(l,10,r),i=u=m.length;m[--u]==0;)m.pop();if(!m[0])l=y?"0p+0":"0";else{if(s<0?i--:(o=new p(o),o.d=m,o.e=i,o=ke(o,d,t,n,0,r),m=o.d,i=o.e,c=oa),s=m[t],a=r/2,c=c||m[t+1]!==void 0,c=n<4?(s!==void 0||c)&&(n===0||n===(o.s<0?3:2)):s>a||s===a&&(n===4||c||n===6&&m[t-1]&1||n===(o.s<0?8:7)),m.length=t,c)for(;++m[--t]>r-1;)m[t]=0,t||(++i,m.unshift(1));for(u=m.length;!m[u-1];--u);for(s=0,l="";s<u;s++)l+=si.charAt(m[s]);if(y){if(u>1)if(e==16||e==8){for(s=e==16?4:3,--u;u%s;u++)l+="0";for(m=Ho(l,r,e),u=m.length;!m[u-1];--u);for(s=1,l="1.";s<u;s++)l+=si.charAt(m[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=(e==16?"0x":e==2?"0b":e==8?"0o":"")+l}return o.s<0?"-"+l:l}function ta(o,e){if(o.length>e)return o.length=e,!0}function Qc(o){return new this(o).abs()}function Yc(o){return new this(o).acos()}function jc(o){return new this(o).acosh()}function Hc(o,e){return new this(o).plus(e)}function Zc(o){return new this(o).asin()}function $c(o){return new this(o).asinh()}function Jc(o){return new this(o).atan()}function el(o){return new this(o).atanh()}function tl(o,e){o=new this(o),e=new this(e);var t,n=this.precision,r=this.rounding,i=n+4;return!o.s||!e.s?t=new this(NaN):!o.d&&!e.d?(t=Tt(this,i,1).times(e.s>0?.25:.75),t.s=o.s):!e.d||o.isZero()?(t=e.s<0?Tt(this,n,r):new this(0),t.s=o.s):!o.d||e.isZero()?(t=Tt(this,i,1).times(.5),t.s=o.s):e.s<0?(this.precision=i,this.rounding=1,t=this.atan(ke(o,e,i,1)),e=Tt(this,i,1),this.precision=n,this.rounding=r,t=o.s<0?t.minus(e):t.plus(e)):t=this.atan(ke(o,e,i,1)),t}function nl(o){return new this(o).cbrt()}function ol(o){return $(o=new this(o),o.e+1,2)}function rl(o,e,t){return new this(o).clamp(e,t)}function il(o){if(!o||typeof o!="object")throw Error(er+"Object expected");var e,t,n,r=o.defaults===!0,i=["precision",1,tn,"rounding",0,8,"toExpNeg",-Nn,0,"toExpPos",0,Nn,"maxE",0,Nn,"minE",-Nn,0,"modulo",0,9];for(e=0;e<i.length;e+=3)if(t=i[e],r&&(this[t]=ai[t]),(n=o[t])!==void 0)if($e(n)===n&&n>=i[e+1]&&n<=i[e+2])this[t]=n;else throw Error(en+t+": "+n);if(t="crypto",r&&(this[t]=ai[t]),(n=o[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(ia);else this[t]=!1;else throw Error(en+t+": "+n);return this}function sl(o){return new this(o).cos()}function al(o){return new this(o).cosh()}function pa(o){var e,t,n;function r(i){var s,a,u,c=this;if(!(c instanceof r))return new r(i);if(c.constructor=r,na(i)){c.s=i.s,oe?!i.d||i.e>r.maxE?(c.e=NaN,c.d=null):i.e<r.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++;oe?s>r.maxE?(c.e=NaN,c.d=null):s<r.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 li(c,i.toString())}else if(u!=="string")throw Error(en+i);return(a=i.charCodeAt(0))===45?(i=i.slice(1),c.s=-1):(a===43&&(i=i.slice(1)),c.s=1),aa.test(i)?li(c,i):Xc(c,i)}if(r.prototype=_,r.ROUND_UP=0,r.ROUND_DOWN=1,r.ROUND_CEIL=2,r.ROUND_FLOOR=3,r.ROUND_HALF_UP=4,r.ROUND_HALF_DOWN=5,r.ROUND_HALF_EVEN=6,r.ROUND_HALF_CEIL=7,r.ROUND_HALF_FLOOR=8,r.EUCLID=9,r.config=r.set=il,r.clone=pa,r.isDecimal=na,r.abs=Qc,r.acos=Yc,r.acosh=jc,r.add=Hc,r.asin=Zc,r.asinh=$c,r.atan=Jc,r.atanh=el,r.atan2=tl,r.cbrt=nl,r.ceil=ol,r.clamp=rl,r.cos=sl,r.cosh=al,r.div=ul,r.exp=cl,r.floor=ll,r.hypot=ml,r.ln=dl,r.log=pl,r.log10=yl,r.log2=fl,r.max=bl,r.min=gl,r.mod=Al,r.mul=wl,r.pow=Pl,r.random=hl,r.round=kl,r.sign=Tl,r.sin=Il,r.sinh=Bl,r.sqrt=xl,r.sub=Sl,r.sum=Kl,r.tan=Cl,r.tanh=Rl,r.trunc=Ol,o===void 0&&(o={}),o&&o.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<n.length;)o.hasOwnProperty(t=n[e++])||(o[t]=this[t]);return r.config(o),r}function ul(o,e){return new this(o).div(e)}function cl(o){return new this(o).exp()}function ll(o){return $(o=new this(o),o.e+1,3)}function ml(){var o,e,t=new this(0);for(oe=!1,o=0;o<arguments.length;)if(e=new this(arguments[o++]),e.d)t.d&&(t=t.plus(e.times(e)));else{if(e.s)return oe=!0,new this(1/0);t=e}return oe=!0,t.sqrt()}function na(o){return o instanceof Jn||o&&o.toStringTag===sa||!1}function dl(o){return new this(o).ln()}function pl(o,e){return new this(o).log(e)}function fl(o){return new this(o).log(2)}function yl(o){return new this(o).log(10)}function bl(){return la(this,arguments,"lt")}function gl(){return la(this,arguments,"gt")}function Al(o,e){return new this(o).mod(e)}function wl(o,e){return new this(o).mul(e)}function Pl(o,e){return new this(o).pow(e)}function hl(o){var e,t,n,r,i=0,s=new this(1),a=[];if(o===void 0?o=this.precision:at(o,1,tn),n=Math.ceil(o/te),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(n));i<n;)r=e[i],r>=429e7?e[i]=crypto.getRandomValues(new Uint32Array(1))[0]:a[i++]=r%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(n*=4);i<n;)r=e[i]+(e[i+1]<<8)+(e[i+2]<<16)+((e[i+3]&127)<<24),r>=214e7?crypto.randomBytes(4).copy(e,i):(a.push(r%1e7),i+=4);i=n/4}else throw Error(ia);else for(;i<n;)a[i++]=Math.random()*1e7|0;for(n=a[--i],o%=te,n&&o&&(r=Ve(10,te-o),a[i]=(n/r|0)*r);a[i]===0;i--)a.pop();if(i<0)t=0,a=[0];else{for(t=-1;a[0]===0;t-=te)a.shift();for(n=1,r=a[0];r>=10;r/=10)n++;n<te&&(t-=te-n)}return s.e=t,s.d=a,s}function kl(o){return $(o=new this(o),o.e+1,this.rounding)}function Tl(o){return o=new this(o),o.d?o.d[0]?o.s:0*o.s:o.s||NaN}function Il(o){return new this(o).sin()}function Bl(o){return new this(o).sinh()}function xl(o){return new this(o).sqrt()}function Sl(o,e){return new this(o).sub(e)}function Kl(){var o=0,e=arguments,t=new this(e[o]);for(oe=!1;t.s&&++o<e.length;)t=t.plus(e[o]);return oe=!0,$(t,this.precision,this.rounding)}function Cl(o){return new this(o).tan()}function Rl(o){return new this(o).tanh()}function Ol(o){return $(o=new this(o),o.e+1,1)}_[Symbol.for("nodejs.util.inspect.custom")]=_.toString;_[Symbol.toStringTag]="Decimal";var Jn=_.constructor=pa(ai);Zo=new Jn(Zo);$o=new Jn($o);var O=Jn;import{PublicKey as bi}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as Ll}from"@solana/spl-token";import{PublicKey as xe,SystemProgram as fa,SYSVAR_RENT_PUBKEY as Nl}from"@solana/web3.js";function P({pubkey:o,isSigner:e=!1,isWritable:t=!0}){return{pubkey:o,isWritable:t,isSigner:e}}var di=[P({pubkey:Ll,isWritable:!1}),P({pubkey:fa.programId,isWritable:!1}),P({pubkey:Nl,isWritable:!1})];function pi({publicKey:o,transformSol:e}){let t=fi(o.toString());if(t instanceof xe)return e&&t.equals(Fe)?j:t;if(e&&t.toString()===Fe.toBase58())return j;if(typeof t=="string"){if(t===xe.default.toBase58())return xe.default;try{return new xe(t)}catch{throw new Error("invalid public key")}}throw new Error("invalid public key")}function fi(o){try{return new xe(o)}catch{return o}}var or=new xe("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),rr=new xe("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),ut=new xe("SysvarRent111111111111111111111111111111111"),yi=new xe("SysvarC1ock11111111111111111111111111111111"),vn=new xe("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),ir=new xe("Sysvar1nstructions1111111111111111111111111"),sr=fa.programId,Nf=new xe("4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R"),Mf=new xe("Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS"),vf=new xe("SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt"),_f=new xe("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),Vf=new xe("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"),Ff=new xe("mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So"),Ef=new xe("7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj"),Df=new xe("USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX"),Wf=new xe("NRVwhjBQiUPYtfDT5zRBVJajzFQHaBUNtC7SNVvqRFa"),qf=new xe("ANAxByE6G2WjFp7A4NqtWYXb3mgruyzZYg3spfxe6Lbo"),Uf=new xe("7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs"),j=new xe("So11111111111111111111111111111111111111112"),Fe=xe.default;function pt(o){return pi({publicKey:o,transformSol:!0})}import{PublicKey as Ml}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as ya}from"@solana/spl-token";var Mt={chainId:101,address:Ml.default.toBase58(),programId:ya.toBase58(),decimals:9,symbol:"SOL",name:"solana",logoURI:"https://img.raydium.io/icon/So11111111111111111111111111111111111111112.png",tags:[],priority:2,type:"raydium",extensions:{coingeckoId:"solana"}},Ee={chainId:101,address:"So11111111111111111111111111111111111111112",programId:ya.toBase58(),decimals:9,symbol:"WSOL",name:"Wrapped SOL",logoURI:"https://img.raydium.io/icon/So11111111111111111111111111111111111111112.png",tags:[],priority:2,type:"raydium",extensions:{coingeckoId:"solana"}};var gi=class{constructor({mint:e,decimals:t,symbol:n,name:r,skipMint:i=!1,isToken2022:s=!1}){if(e===Fe.toBase58()||e instanceof bi&&Fe.equals(e)){this.decimals=Ee.decimals,this.symbol=Ee.symbol,this.name=Ee.name,this.mint=new bi(Ee.address),this.isToken2022=!1;return}this.decimals=t,this.symbol=n||e.toString().substring(0,6),this.name=r||e.toString().substring(0,6),this.mint=i?bi.default:pi({publicKey:e}),this.isToken2022=s}equals(e){return this===e?!0:this.mint.equals(e.mint)}},ye=gi;ye.WSOL=new gi(E(C({},Ee),{mint:Ee.address}));import ur from"big.js";import Vl from"bn.js";import Fl from"decimal.js-light";import vl from"toformat";var _l=vl,eo=_l;var ar=ce("module/fraction"),Ai=eo(ur),to=eo(Fl),El={[0]:to.ROUND_DOWN,[1]:to.ROUND_HALF_UP,[2]:to.ROUND_UP},Dl={[0]:ur.roundDown,[1]:ur.roundHalfUp,[2]:ur.roundUp},re=class{constructor(e,t=new Vl(1)){this.numerator=Y(e),this.denominator=Y(t)}get quotient(){return this.numerator.div(this.denominator)}invert(){return new re(this.denominator,this.numerator)}add(e){let t=e instanceof re?e:new re(Y(e));return this.denominator.eq(t.denominator)?new re(this.numerator.add(t.numerator),this.denominator):new re(this.numerator.mul(t.denominator).add(t.numerator.mul(this.denominator)),this.denominator.mul(t.denominator))}sub(e){let t=e instanceof re?e:new re(Y(e));return this.denominator.eq(t.denominator)?new re(this.numerator.sub(t.numerator),this.denominator):new re(this.numerator.mul(t.denominator).sub(t.numerator.mul(this.denominator)),this.denominator.mul(t.denominator))}mul(e){let t=e instanceof re?e:new re(Y(e));return new re(this.numerator.mul(t.numerator),this.denominator.mul(t.denominator))}div(e){let t=e instanceof re?e:new re(Y(e));return new re(this.numerator.mul(t.denominator),this.denominator.mul(t.numerator))}toSignificant(e,t={groupSeparator:""},n=1){Number.isInteger(e)||ar.logWithError(`${e} is not an integer.`),e<=0&&ar.logWithError(`${e} is not positive.`),to.set({precision:e+1,rounding:El[n]});let r=new to(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(e);return r.toFormat(r.decimalPlaces(),t)}toFixed(e,t={groupSeparator:""},n=1){return Number.isInteger(e)||ar.logWithError(`${e} is not an integer.`),e<0&&ar.logWithError(`${e} is negative.`),Ai.DP=e,Ai.RM=Dl[n]||1,new Ai(this.numerator.toString()).div(this.denominator.toString()).toFormat(e,t)}isZero(){return this.numerator.isZero()}};var Wl=ce("Raydium_price"),Ue=class extends re{constructor(t){let{baseToken:n,quoteToken:r,numerator:i,denominator:s}=t;super(i,s);this.baseToken=n,this.quoteToken=r,this.scalar=new re(Pi(n.decimals),Pi(r.decimals))}get raw(){return new re(this.numerator,this.denominator)}get adjusted(){return super.mul(this.scalar)}invert(){return new Ue({baseToken:this.quoteToken,quoteToken:this.baseToken,denominator:this.numerator,numerator:this.denominator})}mul(t){this.quoteToken!==t.baseToken&&Wl.logWithError("mul token not equals");let n=super.mul(t);return new Ue({baseToken:this.baseToken,quoteToken:t.quoteToken,denominator:n.denominator,numerator:n.numerator})}toSignificant(t=this.quoteToken.decimals,n,r){return this.adjusted.toSignificant(t,n,r)}toFixed(t=this.quoteToken.decimals,n,r){return this.adjusted.toFixed(t,n,r)}};var hi=class{constructor({decimals:e,symbol:t="UNKNOWN",name:n="UNKNOWN"}){this.decimals=e,this.symbol=t,this.name=n}equals(e){return this===e}},no=hi;no.SOL=new hi(Mt);function Ay(o,e){return o instanceof ye&&e instanceof ye?o.equals(e):o instanceof ye||e instanceof ye?!1:o===e}import ql from"bn.js";var ba=new re(new ql(100)),Me=class extends re{toSignificant(e=5,t,n){return this.mul(ba).toSignificant(e,t,n)}toFixed(e=2,t,n){return this.mul(ba).toFixed(e,t,n)}};function Le(o){if(o instanceof Me)return new re(o.numerator,o.denominator);if(o instanceof Ue)return o.adjusted;if(o instanceof fe)try{return Le(o.toExact())}catch{return new re(De)}if(o instanceof re)return o;let e=String(o),t=dn(e);return new re(t.numerator,t.denominator)}function xy(o){var n;if(o instanceof Me)return{fr:new re(o.numerator,o.denominator)};if(o instanceof Ue)return{fr:o.adjusted};if(o instanceof fe)return{fr:Le(o.toExact()),decimals:o.token.decimals};if(o instanceof re)return{fr:o};let e=String(o),t=dn(e);return{fr:new re(t.numerator,t.denominator),decimals:(n=t.dec)==null?void 0:n.length}}function Sy(o,e){if(o==null||e==null)return!1;let t=Le(o),n=Le(e);return t.sub(n).numerator,t.sub(n).numerator.lt(De)}function Ul(o,e){if(o==null||e==null)return!1;let t=Le(o),n=Le(e);return t.sub(n).numerator.gt(De)}function Ky(o,e){if(o==null||e==null)return!1;let t=Le(o),n=Le(e);return t.sub(n).numerator.lte(De)}function Cy(o,e){if(o==null||e==null)return!1;let t=Le(o),n=Le(e);return t.sub(n).numerator.gte(De)}function Gl(o,e){if(o==null||e==null)return!1;let t=Le(o),n=Le(e);return t.sub(n).numerator.eq(De)}function Ry(o,e){if(o==null||e==null)return;let t=Le(o),n=Le(e);try{return t.div(n)}catch{return t}}function Oy(o,e){if(o==null||e==null)return;let t=Le(o),n=Le(e);return t.sub(n)}function Ly(o){return o==null?!1:!Gl(o,0)}function Ny(o,e){return Ul(e,o)?e:o}function ki(o,e){if(o==null||e==null)return;let t=Le(o),n=Le(e);return t.mul(n)}function My(o,e){if(o==null||e==null)return;let t=Le(o),n=Le(e);return t.add(n)}var wi=(n=>(n[n.ROUND_DOWN=0]="ROUND_DOWN",n[n.ROUND_HALF_UP=1]="ROUND_HALF_UP",n[n.ROUND_UP=2]="ROUND_UP",n))(wi||{}),De=new Te(0),Pa=new Te(1),Qy=new Te(2),Yy=new Te(3),jy=new Te(5),pn=new Te(10),Hy=new Te(100),Zy=new Te(1e3),$y=new Te(1e4),ga=9007199254740991;function Y(o){let e=ce("Raydium_parseBigNumberish");if(o instanceof Te)return o;if(typeof o=="string"){if(o.match(/^-?[0-9]+$/))return new Te(o);e.logWithError(`invalid BigNumberish string: ${o}`)}return typeof o=="number"?(o%1&&e.logWithError(`BigNumberish number underflow: ${o}`),(o>=ga||o<=-ga)&&e.logWithError(`BigNumberish number overflow: ${o}`),new Te(String(o))):typeof o=="bigint"?new Te(o.toString()):(e.error(`invalid BigNumberish value: ${o}`),new Te(0))}function Pi(o){return pn.pow(Y(o))}function dn(o){var a;if(o===void 0)return{denominator:"1",numerator:"0"};if(o instanceof Te)return{numerator:o.toString(),denominator:"1"};if(o instanceof re)return{denominator:o.denominator.toString(),numerator:o.numerator.toString()};let e=String(o),[,t="",n="",r=""]=(a=e.replace(",","").match(/(-?)(\d*)\.?(\d*)/))!=null?a:[],i="1"+"0".repeat(r.length),s=t+(n==="0"?"":n)+r||"0";return{denominator:i,numerator:s,sign:t,int:n,dec:r}}function cr(o,e){let t=o.divmod(e);return t.mod.isZero()?t.div:t.div.isNeg()?t.div.isubn(1):t.div.iaddn(1)}function Xl(o){var n;let[,e="",t=""]=(n=o.toFixed(2).match(/(-?)(\d*)\.?(\d*)/))!=null?n:[];return`${e}${t}`}function zl(o,e=0){return o instanceof Te?o:new Te(Xl(ha(o).mul(pn.pow(new Te(String(e))))))}function ha(o){if(o instanceof Me)return new re(o.numerator,o.denominator);if(o instanceof Ue)return o.adjusted;if(o instanceof fe)try{return ha(o.toExact())}catch{return new re(De)}if(o instanceof re)return o;let e=String(o),t=dn(e);return new re(t.numerator,t.denominator)}function Jy(o,e){let{numerator:t,denominator:n}=dn(o);return new Me(new Te(t),new Te(n).mul(e!=null&&e.alreadyDecimaled?new Te(100):new Te(1)))}function eb(o){let{token:e,numberPrice:t,decimalDone:n}=o,r=new ye({mint:"",decimals:6,symbol:"usd",name:"usd",skipMint:!0}),{numerator:i,denominator:s}=dn(t),a=n?new Te(i).mul(pn.pow(new Te(e.decimals))):i,u=new Te(s).mul(pn.pow(new Te(r.decimals)));return new Ue({baseToken:r,denominator:u.toString(),quoteToken:new ye(E(C({},e),{skipMint:!0,mint:""})),numerator:a.toString()})}function Aa(o){let e=new no({decimals:6,symbol:"usd",name:"usd"}),t=zl(ki(o,10**e.decimals));return new fn(e,t)}function tb(o,e){return Aa(!e||!o?0:ki(o,e))}function Ql(o){if(o==null)return;let{numerator:e,denominator:t}=dn(o.toString());return new re(e,t)}function Yl(o){return o instanceof O}function wa(o){return Yl(o)?Ql(o):Array.isArray(o)?o.map(e=>wa(e)):Ti(o)?Object.fromEntries(Object.entries(o).map(([e,t])=>[e,wa(t)])):o}var Hl=ce("Raydium_amount"),lr=eo(jl);function ka(o,e){let t="0",n="0";if(o.includes(".")){let r=o.split(".");r.length===2?([t,n]=r,n=n.padEnd(e,"0")):Hl.logWithError(`invalid number string, num: ${o}`)}else t=o;return[t,n.slice(0,e)||n]}var fe=class extends re{constructor(t,n,r=!0,i){let s=new nn(0),a=pn.pow(new nn(t.decimals));if(r)s=Y(n);else{let u=new nn(0),c=new nn(0);if(typeof n=="string"||typeof n=="number"||typeof n=="bigint"){let[l,m]=ka(n.toString(),t.decimals);u=Y(l),c=Y(m)}u=u.mul(a),s=u.add(c)}super(s,a);this.logger=ce(i||"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 fe(this.token,this.raw.add(t.raw))}subtract(t){return this.token.equals(t.token)||this.logger.logWithError("sub token not equals"),new fe(this.token,this.raw.sub(t.raw))}toSignificant(t=this.token.decimals,n,r=0){return super.toSignificant(t,n,r)}toFixed(t=this.token.decimals,n,r=0){return t>this.token.decimals&&this.logger.logWithError("decimals overflow"),super.toFixed(t,n,r)}toExact(t={groupSeparator:""}){return lr.DP=this.token.decimals,new lr(this.numerator.toString()).div(this.denominator.toString()).toFormat(t)}},fn=class extends re{constructor(t,n,r=!0,i){let s=new nn(0),a=pn.pow(new nn(t.decimals));if(r)s=Y(n);else{let u=new nn(0),c=new nn(0);if(typeof n=="string"||typeof n=="number"||typeof n=="bigint"){let[l,m]=ka(n.toString(),t.decimals);u=Y(l),c=Y(m)}u=u.mul(a),s=u.add(c)}super(s,a);this.logger=ce(i||"TokenAmount"),this.currency=t}get raw(){return this.numerator}isZero(){return this.raw.isZero()}gt(t){return this.currency.equals(t.currency)||this.logger.logWithError("gt currency not equals"),this.raw.gt(t.raw)}lt(t){return this.currency.equals(t.currency)||this.logger.logWithError("lt currency not equals"),this.raw.lt(t.raw)}add(t){return this.currency.equals(t.currency)||this.logger.logWithError("add currency not equals"),new fn(this.currency,this.raw.add(t.raw))}sub(t){return this.currency.equals(t.currency)||this.logger.logWithError("sub currency not equals"),new fn(this.currency,this.raw.sub(t.raw))}toSignificant(t=this.currency.decimals,n,r=0){return super.toSignificant(t,n,r)}toFixed(t=this.currency.decimals,n,r=0){return t>this.currency.decimals&&this.logger.logWithError("decimals overflow"),super.toFixed(t,n,r)}toExact(t={groupSeparator:""}){return lr.DP=this.currency.decimals,new lr(this.numerator.toString()).div(this.denominator.toString()).toFormat(t)}};async function Ta(o){new Promise(e=>setTimeout(e,o))}function Bb(){return new Date().getTime()}function Ti(o){return typeof o=="object"&&o!==null&&![ye,fe,Zl,re,$l,Ue,Me].some(e=>typeof e=="object"&&o instanceof e)}function Ie(o){return typeof o=="string"?fi(o):Array.isArray(o)?o.map(e=>Ie(e)):Ti(o)?Object.fromEntries(Object.entries(o).map(([e,t])=>[e,Ie(t)])):o}import{PublicKey as io,sendAndConfirmTransaction as Ki,Transaction as so,TransactionMessage as ao,VersionedTransaction as uo}from"@solana/web3.js";import um from"axios";var yn=(t=>(t[t.V0=0]="V0",t[t.LEGACY=1]="LEGACY",t))(yn||{}),F={CreateAccount:"CreateAccount",InitAccount:"InitAccount",CreateATA:"CreateATA",CloseAccount:"CloseAccount",TransferAmount:"TransferAmount",InitMint:"InitMint",MintTo:"MintTo",InitMarket:"InitMarket",Util1216OwnerClaim:"Util1216OwnerClaim",SetComputeUnitPrice:"SetComputeUnitPrice",SetComputeUnitLimit:"SetComputeUnitLimit",ClmmCreatePool:"ClmmCreatePool",ClmmOpenPosition:"ClmmOpenPosition",ClmmIncreasePosition:"ClmmIncreasePosition",ClmmDecreasePosition:"ClmmDecreasePosition",ClmmClosePosition:"ClmmClosePosition",ClmmSwapBaseIn:"ClmmSwapBaseIn",ClmmSwapBaseOut:"ClmmSwapBaseOut",ClmmInitReward:"ClmmInitReward",ClmmSetReward:"ClmmSetReward",ClmmCollectReward:"ClmmCollectReward",AmmV4Swap:"AmmV4Swap",AmmV4AddLiquidity:"AmmV4AddLiquidity",AmmV4RemoveLiquidity:"AmmV4RemoveLiquidity",AmmV4SimulatePoolInfo:"AmmV4SimulatePoolInfo",AmmV4SwapBaseIn:"AmmV4SwapBaseIn",AmmV4SwapBaseOut:"AmmV4SwapBaseOut",AmmV4CreatePool:"AmmV4CreatePool",AmmV4InitPool:"AmmV4InitPool",AmmV5AddLiquidity:"AmmV5AddLiquidity",AmmV5RemoveLiquidity:"AmmV5RemoveLiquidity",AmmV5SimulatePoolInfo:"AmmV5SimulatePoolInfo",AmmV5SwapBaseIn:"AmmV5SwapBaseIn",AmmV5SwapBaseOut:"AmmV5SwapBaseOut",RouteSwap:"RouteSwap",RouteSwap1:"RouteSwap1",RouteSwap2:"RouteSwap2",FarmV3Deposit:"FarmV3Deposit",FarmV3Withdraw:"FarmV3Withdraw",FarmV3CreateLedger:"FarmV3CreateLedger",FarmV5Deposit:"FarmV5Deposit",FarmV5Withdraw:"FarmV5Withdraw",FarmV5CreateLedger:"FarmV5CreateLedger",FarmV6Deposit:"FarmV6Deposit",FarmV6Withdraw:"FarmV6Withdraw",FarmV6Create:"FarmV6Create",FarmV6Restart:"FarmV6Restart",FarmV6CreatorAddReward:"FarmV6CreatorAddReward",FarmV6CreatorWithdraw:"FarmV6CreatorWithdraw",CpmmCreatePool:"CpmmCreatePool",CpmmAddLiquidity:"CpmmAddLiquidity",CpmmWithdrawLiquidity:"CpmmWithdrawLiquidity",CpmmSwapBaseIn:"CpmmSwapBaseIn",CpmmSwapBaseOut:"CpmmSwapBaseOut"};import{PublicKey as Ba,ComputeBudgetProgram as Ia,Transaction as dr,TransactionMessage as Jl,Keypair as xa,VersionedTransaction as Ii}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as e