@raydium-io/raydium-sdk-v2
Version:
An SDK for building applications on top of Raydium.
1 lines • 69.8 kB
JavaScript
var Kn=Object.defineProperty,Nn=Object.defineProperties;var Ln=Object.getOwnPropertyDescriptors;var Ot=Object.getOwnPropertySymbols;var Rn=Object.prototype.hasOwnProperty,Mn=Object.prototype.propertyIsEnumerable;var Wt=(e,t,n)=>t in e?Kn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,D=(e,t)=>{for(var n in t||(t={}))Rn.call(t,n)&&Wt(e,n,t[n]);if(Ot)for(var n of Ot(t))Mn.call(t,n)&&Wt(e,n,t[n]);return e},q=(e,t)=>Nn(e,Ln(t));import{PublicKey as Gr}from"@solana/web3.js";import{get as Et,set as Fn}from"lodash";var st=class{constructor(t){this.logLevel=t.logLevel!==void 0?t.logLevel:0,this.name=t.name}set level(t){this.logLevel=t}get time(){return Date.now().toString()}get moduleName(){return this.name}isLogLevel(t){return t<=this.logLevel}error(...t){return this.isLogLevel(0)?(console.error(this.time,this.name,"sdk logger error",...t),this):this}logWithError(...t){let n=t.map(i=>typeof i=="object"?JSON.stringify(i):i).join(", ");throw new Error(n)}warning(...t){return this.isLogLevel(1)?(console.warn(this.time,this.name,"sdk logger warning",...t),this):this}info(...t){return this.isLogLevel(2)?(console.info(this.time,this.name,"sdk logger info",...t),this):this}debug(...t){return this.isLogLevel(3)?(console.debug(this.time,this.name,"sdk logger debug",...t),this):this}},vt={},On={};function j(e){let t=Et(vt,e);if(!t){let n=Et(On,e);t=new st({name:e,logLevel:n}),Fn(vt,e,t)}return t}import{MINT_SIZE as zr,TOKEN_PROGRAM_ID as Zr,getTransferFeeConfig as Yr,unpackMint as jr}from"@solana/spl-token";var Qr=j("Raydium_accountInfo_util");import de from"bn.js";var Be=9e15,we=1e9,at="0123456789abcdef",Ge="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Ue="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",ut={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Be,maxE:Be,crypto:!1},Gt,me,S=!0,He="[DecimalError] ",Pe=He+"Invalid argument: ",Ut=He+"Precision limit exceeded",Xt=He+"crypto unavailable",Ht="[object Decimal]",Y=Math.floor,G=Math.pow,Wn=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,En=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,vn=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,zt=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,se=1e7,h=7,_n=9007199254740991,Vn=Ge.length-1,ct=Ue.length-1,p={toStringTag:Ht};p.absoluteValue=p.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),k(e)};p.ceil=function(){return k(new this.constructor(this),this.e+1,2)};p.clampedTo=p.clamp=function(e,t){var n,i=this,o=i.constructor;if(e=new o(e),t=new o(t),!e.s||!t.s)return new o(NaN);if(e.gt(t))throw Error(Pe+t);return n=i.cmp(e),n<0?e:i.cmp(t)>0?t:new o(i)};p.comparedTo=p.cmp=function(e){var t,n,i,o,r=this,s=r.d,a=(e=new r.constructor(e)).d,c=r.s,u=e.s;if(!s||!a)return!c||!u?NaN:c!==u?c:s===a?0:!s^c<0?1:-1;if(!s[0]||!a[0])return s[0]?c:a[0]?-u:0;if(c!==u)return c;if(r.e!==e.e)return r.e>e.e^c<0?1:-1;for(i=s.length,o=a.length,t=0,n=i<o?i:o;t<n;++t)if(s[t]!==a[t])return s[t]>a[t]^c<0?1:-1;return i===o?0:i>o^c<0?1:-1};p.cosine=p.cos=function(){var e,t,n=this,i=n.constructor;return n.d?n.d[0]?(e=i.precision,t=i.rounding,i.precision=e+Math.max(n.e,n.sd())+h,i.rounding=1,n=Dn(i,Jt(i,n)),i.precision=e,i.rounding=t,k(me==2||me==3?n.neg():n,e,t,!0)):new i(1):new i(NaN)};p.cubeRoot=p.cbrt=function(){var e,t,n,i,o,r,s,a,c,u,l=this,m=l.constructor;if(!l.isFinite()||l.isZero())return new m(l);for(S=!1,r=l.s*G(l.s*l,1/3),!r||Math.abs(r)==1/0?(n=U(l.d),e=l.e,(r=(e-n.length+1)%3)&&(n+=r==1||r==-2?"0":"00"),r=G(n,1/3),e=Y((e+1)/3)-(e%3==(e<0?-1:2)),r==1/0?n="5e"+e:(n=r.toExponential(),n=n.slice(0,n.indexOf("e")+1)+e),i=new m(n),i.s=l.s):i=new m(r.toString()),s=(e=m.precision)+3;;)if(a=i,c=a.times(a).times(a),u=c.plus(l),i=O(u.plus(l).times(a),u.plus(c),s+2,1),U(a.d).slice(0,s)===(n=U(i.d)).slice(0,s))if(n=n.slice(s-3,s+1),n=="9999"||!o&&n=="4999"){if(!o&&(k(a,e+1,0),a.times(a).times(a).eq(l))){i=a;break}s+=4,o=1}else{(!+n||!+n.slice(1)&&n.charAt(0)=="5")&&(k(i,e+1,1),t=!i.times(i).times(i).eq(l));break}return S=!0,k(i,e,m.rounding,t)};p.decimalPlaces=p.dp=function(){var e,t=this.d,n=NaN;if(t){if(e=t.length-1,n=(e-Y(this.e/h))*h,e=t[e],e)for(;e%10==0;e/=10)n--;n<0&&(n=0)}return n};p.dividedBy=p.div=function(e){return O(this,new this.constructor(e))};p.dividedToIntegerBy=p.divToInt=function(e){var t=this,n=t.constructor;return k(O(t,new n(e),0,1,1),n.precision,n.rounding)};p.equals=p.eq=function(e){return this.cmp(e)===0};p.floor=function(){return k(new this.constructor(this),this.e+1,3)};p.greaterThan=p.gt=function(e){return this.cmp(e)>0};p.greaterThanOrEqualTo=p.gte=function(e){var t=this.cmp(e);return t==1||t===0};p.hyperbolicCosine=p.cosh=function(){var e,t,n,i,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;n=s.precision,i=s.rounding,s.precision=n+Math.max(r.e,r.sd())+4,s.rounding=1,o=r.d.length,o<32?(e=Math.ceil(o/3),t=(1/Ze(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),r=xe(s,1,r.times(t),new s(1),!0);for(var c,u=e,l=new s(8);u--;)c=r.times(r),r=a.minus(c.times(l.minus(c.times(l))));return k(r,s.precision=n,s.rounding=i,!0)};p.hyperbolicSine=p.sinh=function(){var e,t,n,i,o=this,r=o.constructor;if(!o.isFinite()||o.isZero())return new r(o);if(t=r.precision,n=r.rounding,r.precision=t+Math.max(o.e,o.sd())+4,r.rounding=1,i=o.d.length,i<3)o=xe(r,2,o,o,!0);else{e=1.4*Math.sqrt(i),e=e>16?16:e|0,o=o.times(1/Ze(5,e)),o=xe(r,2,o,o,!0);for(var s,a=new r(5),c=new r(16),u=new r(20);e--;)s=o.times(o),o=o.times(a.plus(s.times(c.times(s).plus(u))))}return r.precision=t,r.rounding=n,k(o,t,n,!0)};p.hyperbolicTangent=p.tanh=function(){var e,t,n=this,i=n.constructor;return n.isFinite()?n.isZero()?new i(n):(e=i.precision,t=i.rounding,i.precision=e+7,i.rounding=1,O(n.sinh(),n.cosh(),i.precision=e,i.rounding=t)):new i(n.s)};p.inverseCosine=p.acos=function(){var e=this,t=e.constructor,n=e.abs().cmp(1),i=t.precision,o=t.rounding;return n!==-1?n===0?e.isNeg()?ue(t,i,o):new t(0):new t(NaN):e.isZero()?ue(t,i+4,o).times(.5):(t.precision=i+6,t.rounding=1,e=new t(1).minus(e).div(e.plus(1)).sqrt().atan(),t.precision=i,t.rounding=o,e.times(2))};p.inverseHyperbolicCosine=p.acosh=function(){var e,t,n=this,i=n.constructor;return n.lte(1)?new i(n.eq(1)?0:NaN):n.isFinite()?(e=i.precision,t=i.rounding,i.precision=e+Math.max(Math.abs(n.e),n.sd())+4,i.rounding=1,S=!1,n=n.times(n).minus(1).sqrt().plus(n),S=!0,i.precision=e,i.rounding=t,n.ln()):new i(n)};p.inverseHyperbolicSine=p.asinh=function(){var e,t,n=this,i=n.constructor;return!n.isFinite()||n.isZero()?new i(n):(e=i.precision,t=i.rounding,i.precision=e+2*Math.max(Math.abs(n.e),n.sd())+6,i.rounding=1,S=!1,n=n.times(n).plus(1).sqrt().plus(n),S=!0,i.precision=e,i.rounding=t,n.ln())};p.inverseHyperbolicTangent=p.atanh=function(){var e,t,n,i,o=this,r=o.constructor;return o.isFinite()?o.e>=0?new r(o.abs().eq(1)?o.s/0:o.isZero()?o:NaN):(e=r.precision,t=r.rounding,i=o.sd(),Math.max(i,e)<2*-o.e-1?k(new r(o),e,t,!0):(r.precision=n=i-o.e,o=O(o.plus(1),new r(1).minus(o),n+e,1),r.precision=e+4,r.rounding=1,o=o.ln(),r.precision=e,r.rounding=t,o.times(.5))):new r(NaN)};p.inverseSine=p.asin=function(){var e,t,n,i,o=this,r=o.constructor;return o.isZero()?new r(o):(t=o.abs().cmp(1),n=r.precision,i=r.rounding,t!==-1?t===0?(e=ue(r,n+4,i).times(.5),e.s=o.s,e):new r(NaN):(r.precision=n+6,r.rounding=1,o=o.div(new r(1).minus(o.times(o)).sqrt().plus(1)).atan(),r.precision=n,r.rounding=i,o.times(2)))};p.inverseTangent=p.atan=function(){var e,t,n,i,o,r,s,a,c,u=this,l=u.constructor,m=l.precision,f=l.rounding;if(u.isFinite()){if(u.isZero())return new l(u);if(u.abs().eq(1)&&m+4<=ct)return s=ue(l,m+4,f).times(.25),s.s=u.s,s}else{if(!u.s)return new l(NaN);if(m+4<=ct)return s=ue(l,m+4,f).times(.5),s.s=u.s,s}for(l.precision=a=m+10,l.rounding=1,n=Math.min(28,a/h+2|0),e=n;e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(S=!1,t=Math.ceil(a/h),i=1,c=u.times(u),s=new l(u),o=u;e!==-1;)if(o=o.times(c),r=s.minus(o.div(i+=2)),o=o.times(c),s=r.plus(o.div(i+=2)),s.d[t]!==void 0)for(e=t;s.d[e]===r.d[e]&&e--;);return n&&(s=s.times(2<<n-1)),S=!0,k(s,l.precision=m,l.rounding=f,!0)};p.isFinite=function(){return!!this.d};p.isInteger=p.isInt=function(){return!!this.d&&Y(this.e/h)>this.d.length-2};p.isNaN=function(){return!this.s};p.isNegative=p.isNeg=function(){return this.s<0};p.isPositive=p.isPos=function(){return this.s>0};p.isZero=function(){return!!this.d&&this.d[0]===0};p.lessThan=p.lt=function(e){return this.cmp(e)<0};p.lessThanOrEqualTo=p.lte=function(e){return this.cmp(e)<1};p.logarithm=p.log=function(e){var t,n,i,o,r,s,a,c,u=this,l=u.constructor,m=l.precision,f=l.rounding,b=5;if(e==null)e=new l(10),t=!0;else{if(e=new l(e),n=e.d,e.s<0||!n||!n[0]||e.eq(1))return new l(NaN);t=e.eq(10)}if(n=u.d,u.s<0||!n||!n[0]||u.eq(1))return new l(n&&!n[0]?-1/0:u.s!=1?NaN:n?0:1/0);if(t)if(n.length>1)r=!0;else{for(o=n[0];o%10===0;)o/=10;r=o!==1}if(S=!1,a=m+b,s=ge(u,a),i=t?Xe(l,a+10):ge(e,a),c=O(s,i,a,1),Ke(c.d,o=m,f))do if(a+=10,s=ge(u,a),i=t?Xe(l,a+10):ge(e,a),c=O(s,i,a,1),!r){+U(c.d).slice(o+1,o+15)+1==1e14&&(c=k(c,m+1,0));break}while(Ke(c.d,o+=10,f));return S=!0,k(c,m,f)};p.minus=p.sub=function(e){var t,n,i,o,r,s,a,c,u,l,m,f,b=this,T=b.constructor;if(e=new T(e),!b.d||!e.d)return!b.s||!e.s?e=new T(NaN):b.d?e.s=-e.s:e=new T(e.d||b.s!==e.s?b:NaN),e;if(b.s!=e.s)return e.s=-e.s,b.plus(e);if(u=b.d,f=e.d,a=T.precision,c=T.rounding,!u[0]||!f[0]){if(f[0])e.s=-e.s;else if(u[0])e=new T(b);else return new T(c===3?-0:0);return S?k(e,a,c):e}if(n=Y(e.e/h),l=Y(b.e/h),u=u.slice(),r=l-n,r){for(m=r<0,m?(t=u,r=-r,s=f.length):(t=f,n=l,s=u.length),i=Math.max(Math.ceil(a/h),s)+2,r>i&&(r=i,t.length=1),t.reverse(),i=r;i--;)t.push(0);t.reverse()}else{for(i=u.length,s=f.length,m=i<s,m&&(s=i),i=0;i<s;i++)if(u[i]!=f[i]){m=u[i]<f[i];break}r=0}for(m&&(t=u,u=f,f=t,e.s=-e.s),s=u.length,i=f.length-s;i>0;--i)u[s++]=0;for(i=f.length;i>r;){if(u[--i]<f[i]){for(o=i;o&&u[--o]===0;)u[o]=se-1;--u[o],u[i]+=se}u[i]-=f[i]}for(;u[--s]===0;)u.pop();for(;u[0]===0;u.shift())--n;return u[0]?(e.d=u,e.e=ze(u,n),S?k(e,a,c):e):new T(c===3?-0:0)};p.modulo=p.mod=function(e){var t,n=this,i=n.constructor;return e=new i(e),!n.d||!e.s||e.d&&!e.d[0]?new i(NaN):!e.d||n.d&&!n.d[0]?k(new i(n),i.precision,i.rounding):(S=!1,i.modulo==9?(t=O(n,e.abs(),0,3,1),t.s*=e.s):t=O(n,e,0,i.modulo,1),t=t.times(e),S=!0,n.minus(t))};p.naturalExponential=p.exp=function(){return lt(this)};p.naturalLogarithm=p.ln=function(){return ge(this)};p.negated=p.neg=function(){var e=new this.constructor(this);return e.s=-e.s,k(e)};p.plus=p.add=function(e){var t,n,i,o,r,s,a,c,u,l,m=this,f=m.constructor;if(e=new f(e),!m.d||!e.d)return!m.s||!e.s?e=new f(NaN):m.d||(e=new f(e.d||m.s===e.s?m:NaN)),e;if(m.s!=e.s)return e.s=-e.s,m.minus(e);if(u=m.d,l=e.d,a=f.precision,c=f.rounding,!u[0]||!l[0])return l[0]||(e=new f(m)),S?k(e,a,c):e;if(r=Y(m.e/h),i=Y(e.e/h),u=u.slice(),o=r-i,o){for(o<0?(n=u,o=-o,s=l.length):(n=l,i=r,s=u.length),r=Math.ceil(a/h),s=r>s?r+1:s+1,o>s&&(o=s,n.length=1),n.reverse();o--;)n.push(0);n.reverse()}for(s=u.length,o=l.length,s-o<0&&(o=s,n=l,l=u,u=n),t=0;o;)t=(u[--o]=u[o]+l[o]+t)/se|0,u[o]%=se;for(t&&(u.unshift(t),++i),s=u.length;u[--s]==0;)u.pop();return e.d=u,e.e=ze(u,i),S?k(e,a,c):e};p.precision=p.sd=function(e){var t,n=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Pe+e);return n.d?(t=Zt(n.d),e&&n.e+1>t&&(t=n.e+1)):t=NaN,t};p.round=function(){var e=this,t=e.constructor;return k(new t(e),e.e+1,t.rounding)};p.sine=p.sin=function(){var e,t,n=this,i=n.constructor;return n.isFinite()?n.isZero()?new i(n):(e=i.precision,t=i.rounding,i.precision=e+Math.max(n.e,n.sd())+h,i.rounding=1,n=Gn(i,Jt(i,n)),i.precision=e,i.rounding=t,k(me>2?n.neg():n,e,t,!0)):new i(NaN)};p.squareRoot=p.sqrt=function(){var e,t,n,i,o,r,s=this,a=s.d,c=s.e,u=s.s,l=s.constructor;if(u!==1||!a||!a[0])return new l(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);for(S=!1,u=Math.sqrt(+s),u==0||u==1/0?(t=U(a),(t.length+c)%2==0&&(t+="0"),u=Math.sqrt(t),c=Y((c+1)/2)-(c<0||c%2),u==1/0?t="5e"+c:(t=u.toExponential(),t=t.slice(0,t.indexOf("e")+1)+c),i=new l(t)):i=new l(u.toString()),n=(c=l.precision)+3;;)if(r=i,i=r.plus(O(s,r,n+2,1)).times(.5),U(r.d).slice(0,n)===(t=U(i.d)).slice(0,n))if(t=t.slice(n-3,n+1),t=="9999"||!o&&t=="4999"){if(!o&&(k(r,c+1,0),r.times(r).eq(s))){i=r;break}n+=4,o=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(k(i,c+1,1),e=!i.times(i).eq(s));break}return S=!0,k(i,c,l.rounding,e)};p.tangent=p.tan=function(){var e,t,n=this,i=n.constructor;return n.isFinite()?n.isZero()?new i(n):(e=i.precision,t=i.rounding,i.precision=e+10,i.rounding=1,n=n.sin(),n.s=1,n=O(n,new i(1).minus(n.times(n)).sqrt(),e+10,0),i.precision=e,i.rounding=t,k(me==2||me==4?n.neg():n,e,t,!0)):new i(NaN)};p.times=p.mul=function(e){var t,n,i,o,r,s,a,c,u,l=this,m=l.constructor,f=l.d,b=(e=new m(e)).d;if(e.s*=l.s,!f||!f[0]||!b||!b[0])return new m(!e.s||f&&!f[0]&&!b||b&&!b[0]&&!f?NaN:!f||!b?e.s/0:e.s*0);for(n=Y(l.e/h)+Y(e.e/h),c=f.length,u=b.length,c<u&&(r=f,f=b,b=r,s=c,c=u,u=s),r=[],s=c+u,i=s;i--;)r.push(0);for(i=u;--i>=0;){for(t=0,o=c+i;o>i;)a=r[o]+b[i]*f[o-i-1]+t,r[o--]=a%se|0,t=a/se|0;r[o]=(r[o]+t)%se|0}for(;!r[--s];)r.pop();return t?++n:r.shift(),e.d=r,e.e=ze(r,n),S?k(e,m.precision,m.rounding):e};p.toBinary=function(e,t){return mt(this,2,e,t)};p.toDecimalPlaces=p.toDP=function(e,t){var n=this,i=n.constructor;return n=new i(n),e===void 0?n:(te(e,0,we),t===void 0?t=i.rounding:te(t,0,8),k(n,e+n.e+1,t))};p.toExponential=function(e,t){var n,i=this,o=i.constructor;return e===void 0?n=ce(i,!0):(te(e,0,we),t===void 0?t=o.rounding:te(t,0,8),i=k(new o(i),e+1,t),n=ce(i,!0,e+1)),i.isNeg()&&!i.isZero()?"-"+n:n};p.toFixed=function(e,t){var n,i,o=this,r=o.constructor;return e===void 0?n=ce(o):(te(e,0,we),t===void 0?t=r.rounding:te(t,0,8),i=k(new r(o),e+o.e+1,t),n=ce(i,!1,e+i.e+1)),o.isNeg()&&!o.isZero()?"-"+n:n};p.toFraction=function(e){var t,n,i,o,r,s,a,c,u,l,m,f,b=this,T=b.d,y=b.constructor;if(!T)return new y(b);if(u=n=new y(1),i=c=new y(0),t=new y(i),r=t.e=Zt(T)-b.e-1,s=r%h,t.d[0]=G(10,s<0?h+s:s),e==null)e=r>0?t:u;else{if(a=new y(e),!a.isInt()||a.lt(u))throw Error(Pe+a);e=a.gt(t)?r>0?t:u:a}for(S=!1,a=new y(U(T)),l=y.precision,y.precision=r=T.length*h*2;m=O(a,t,0,1,1),o=n.plus(m.times(i)),o.cmp(e)!=1;)n=i,i=o,o=u,u=c.plus(m.times(o)),c=o,o=t,t=a.minus(m.times(o)),a=o;return o=O(e.minus(n),i,0,1,1),c=c.plus(o.times(u)),n=n.plus(o.times(i)),c.s=u.s=b.s,f=O(u,i,r,1).minus(b).abs().cmp(O(c,n,r,1).minus(b).abs())<1?[u,i]:[c,n],y.precision=l,S=!0,f};p.toHexadecimal=p.toHex=function(e,t){return mt(this,16,e,t)};p.toNearest=function(e,t){var n=this,i=n.constructor;if(n=new i(n),e==null){if(!n.d)return n;e=new i(1),t=i.rounding}else{if(e=new i(e),t===void 0?t=i.rounding:te(t,0,8),!n.d)return e.s?n:e;if(!e.d)return e.s&&(e.s=n.s),e}return e.d[0]?(S=!1,n=O(n,e,0,t,1).times(e),S=!0,k(n)):(e.s=n.s,n=e),n};p.toNumber=function(){return+this};p.toOctal=function(e,t){return mt(this,8,e,t)};p.toPower=p.pow=function(e){var t,n,i,o,r,s,a=this,c=a.constructor,u=+(e=new c(e));if(!a.d||!e.d||!a.d[0]||!e.d[0])return new c(G(+a,u));if(a=new c(a),a.eq(1))return a;if(i=c.precision,r=c.rounding,e.eq(1))return k(a,i,r);if(t=Y(e.e/h),t>=e.d.length-1&&(n=u<0?-u:u)<=_n)return o=Yt(c,a,n,i),e.s<0?new c(1).div(o):k(o,i,r);if(s=a.s,s<0){if(t<e.d.length-1)return new c(NaN);if((e.d[t]&1)==0&&(s=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=s,a}return n=G(+a,u),t=n==0||!isFinite(n)?Y(u*(Math.log("0."+U(a.d))/Math.LN10+a.e+1)):new c(n+"").e,t>c.maxE+1||t<c.minE-1?new c(t>0?s/0:0):(S=!1,c.rounding=a.s=1,n=Math.min(12,(t+"").length),o=lt(e.times(ge(a,i+n)),i),o.d&&(o=k(o,i+5,1),Ke(o.d,i,r)&&(t=i+10,o=k(lt(e.times(ge(a,t+n)),t),t+5,1),+U(o.d).slice(i+1,i+15)+1==1e14&&(o=k(o,i+1,0)))),o.s=s,S=!0,c.rounding=r,k(o,i,r))};p.toPrecision=function(e,t){var n,i=this,o=i.constructor;return e===void 0?n=ce(i,i.e<=o.toExpNeg||i.e>=o.toExpPos):(te(e,1,we),t===void 0?t=o.rounding:te(t,0,8),i=k(new o(i),e,t),n=ce(i,e<=i.e||i.e<=o.toExpNeg,e)),i.isNeg()&&!i.isZero()?"-"+n:n};p.toSignificantDigits=p.toSD=function(e,t){var n=this,i=n.constructor;return e===void 0?(e=i.precision,t=i.rounding):(te(e,1,we),t===void 0?t=i.rounding:te(t,0,8)),k(new i(n),e,t)};p.toString=function(){var e=this,t=e.constructor,n=ce(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+n:n};p.truncated=p.trunc=function(){return k(new this.constructor(this),this.e+1,1)};p.valueOf=p.toJSON=function(){var e=this,t=e.constructor,n=ce(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+n:n};function U(e){var t,n,i,o=e.length-1,r="",s=e[0];if(o>0){for(r+=s,t=1;t<o;t++)i=e[t]+"",n=h-i.length,n&&(r+=ye(n)),r+=i;s=e[t],i=s+"",n=h-i.length,n&&(r+=ye(n))}else if(s===0)return"0";for(;s%10===0;)s/=10;return r+s}function te(e,t,n){if(e!==~~e||e<t||e>n)throw Error(Pe+e)}function Ke(e,t,n,i){var o,r,s,a;for(r=e[0];r>=10;r/=10)--t;return--t<0?(t+=h,o=0):(o=Math.ceil((t+1)/h),t%=h),r=G(10,h-t),a=e[o]%r|0,i==null?t<3?(t==0?a=a/100|0:t==1&&(a=a/10|0),s=n<4&&a==99999||n>3&&a==49999||a==5e4||a==0):s=(n<4&&a+1==r||n>3&&a+1==r/2)&&(e[o+1]/r/100|0)==G(10,t-2)-1||(a==r/2||a==0)&&(e[o+1]/r/100|0)==0:t<4?(t==0?a=a/1e3|0:t==1?a=a/100|0:t==2&&(a=a/10|0),s=(i||n<4)&&a==9999||!i&&n>3&&a==4999):s=((i||n<4)&&a+1==r||!i&&n>3&&a+1==r/2)&&(e[o+1]/r/1e3|0)==G(10,t-3)-1,s}function De(e,t,n){for(var i,o=[0],r,s=0,a=e.length;s<a;){for(r=o.length;r--;)o[r]*=t;for(o[0]+=at.indexOf(e.charAt(s++)),i=0;i<o.length;i++)o[i]>n-1&&(o[i+1]===void 0&&(o[i+1]=0),o[i+1]+=o[i]/n|0,o[i]%=n)}return o.reverse()}function Dn(e,t){var n,i,o;if(t.isZero())return t;i=t.d.length,i<32?(n=Math.ceil(i/3),o=(1/Ze(4,n)).toString()):(n=16,o="2.3283064365386962890625e-10"),e.precision+=n,t=xe(e,1,t.times(o),new e(1));for(var r=n;r--;){var s=t.times(t);t=s.times(s).minus(s).times(8).plus(1)}return e.precision-=n,t}var O=function(){function e(i,o,r){var s,a=0,c=i.length;for(i=i.slice();c--;)s=i[c]*o+a,i[c]=s%r|0,a=s/r|0;return a&&i.unshift(a),i}function t(i,o,r,s){var a,c;if(r!=s)c=r>s?1:-1;else for(a=c=0;a<r;a++)if(i[a]!=o[a]){c=i[a]>o[a]?1:-1;break}return c}function n(i,o,r,s){for(var a=0;r--;)i[r]-=a,a=i[r]<o[r]?1:0,i[r]=a*s+i[r]-o[r];for(;!i[0]&&i.length>1;)i.shift()}return function(i,o,r,s,a,c){var u,l,m,f,b,T,y,I,K,M,C,N,L,F,ie,J,$,re,V,ae,ee=i.constructor,ot=i.s==o.s?1:-1,Z=i.d,W=o.d;if(!Z||!Z[0]||!W||!W[0])return new ee(!i.s||!o.s||(Z?W&&Z[0]==W[0]:!W)?NaN:Z&&Z[0]==0||!W?ot*0:ot/0);for(c?(b=1,l=i.e-o.e):(c=se,b=h,l=Y(i.e/b)-Y(o.e/b)),V=W.length,$=Z.length,K=new ee(ot),M=K.d=[],m=0;W[m]==(Z[m]||0);m++);if(W[m]>(Z[m]||0)&&l--,r==null?(F=r=ee.precision,s=ee.rounding):a?F=r+(i.e-o.e)+1:F=r,F<0)M.push(1),T=!0;else{if(F=F/b+2|0,m=0,V==1){for(f=0,W=W[0],F++;(m<$||f)&&F--;m++)ie=f*c+(Z[m]||0),M[m]=ie/W|0,f=ie%W|0;T=f||m<$}else{for(f=c/(W[0]+1)|0,f>1&&(W=e(W,f,c),Z=e(Z,f,c),V=W.length,$=Z.length),J=V,C=Z.slice(0,V),N=C.length;N<V;)C[N++]=0;ae=W.slice(),ae.unshift(0),re=W[0],W[1]>=c/2&&++re;do f=0,u=t(W,C,V,N),u<0?(L=C[0],V!=N&&(L=L*c+(C[1]||0)),f=L/re|0,f>1?(f>=c&&(f=c-1),y=e(W,f,c),I=y.length,N=C.length,u=t(y,C,I,N),u==1&&(f--,n(y,V<I?ae:W,I,c))):(f==0&&(u=f=1),y=W.slice()),I=y.length,I<N&&y.unshift(0),n(C,y,N,c),u==-1&&(N=C.length,u=t(W,C,V,N),u<1&&(f++,n(C,V<N?ae:W,N,c))),N=C.length):u===0&&(f++,C=[0]),M[m++]=f,u&&C[0]?C[N++]=Z[J]||0:(C=[Z[J]],N=1);while((J++<$||C[0]!==void 0)&&F--);T=C[0]!==void 0}M[0]||M.shift()}if(b==1)K.e=l,Gt=T;else{for(m=1,f=M[0];f>=10;f/=10)m++;K.e=m+l*b-1,k(K,a?r+K.e+1:r,s,T)}return K}}();function k(e,t,n,i){var o,r,s,a,c,u,l,m,f,b=e.constructor;e:if(t!=null){if(m=e.d,!m)return e;for(o=1,a=m[0];a>=10;a/=10)o++;if(r=t-o,r<0)r+=h,s=t,l=m[f=0],c=l/G(10,o-s-1)%10|0;else if(f=Math.ceil((r+1)/h),a=m.length,f>=a)if(i){for(;a++<=f;)m.push(0);l=c=0,o=1,r%=h,s=r-h+1}else break e;else{for(l=a=m[f],o=1;a>=10;a/=10)o++;r%=h,s=r-h+o,c=s<0?0:l/G(10,o-s-1)%10|0}if(i=i||t<0||m[f+1]!==void 0||(s<0?l:l%G(10,o-s-1)),u=n<4?(c||i)&&(n==0||n==(e.s<0?3:2)):c>5||c==5&&(n==4||i||n==6&&(r>0?s>0?l/G(10,o-s):0:m[f-1])%10&1||n==(e.s<0?8:7)),t<1||!m[0])return m.length=0,u?(t-=e.e+1,m[0]=G(10,(h-t%h)%h),e.e=-t||0):m[0]=e.e=0,e;if(r==0?(m.length=f,a=1,f--):(m.length=f+1,a=G(10,h-r),m[f]=s>0?(l/G(10,o-s)%G(10,s)|0)*a:0),u)for(;;)if(f==0){for(r=1,s=m[0];s>=10;s/=10)r++;for(s=m[0]+=a,a=1;s>=10;s/=10)a++;r!=a&&(e.e++,m[0]==se&&(m[0]=1));break}else{if(m[f]+=a,m[f]!=se)break;m[f--]=0,a=1}for(r=m.length;m[--r]===0;)m.pop()}return S&&(e.e>b.maxE?(e.d=null,e.e=NaN):e.e<b.minE&&(e.e=0,e.d=[0])),e}function ce(e,t,n){if(!e.isFinite())return Qt(e);var i,o=e.e,r=U(e.d),s=r.length;return t?(n&&(i=n-s)>0?r=r.charAt(0)+"."+r.slice(1)+ye(i):s>1&&(r=r.charAt(0)+"."+r.slice(1)),r=r+(e.e<0?"e":"e+")+e.e):o<0?(r="0."+ye(-o-1)+r,n&&(i=n-s)>0&&(r+=ye(i))):o>=s?(r+=ye(o+1-s),n&&(i=n-o-1)>0&&(r=r+"."+ye(i))):((i=o+1)<s&&(r=r.slice(0,i)+"."+r.slice(i)),n&&(i=n-s)>0&&(o+1===s&&(r+="."),r+=ye(i))),r}function ze(e,t){var n=e[0];for(t*=h;n>=10;n/=10)t++;return t}function Xe(e,t,n){if(t>Vn)throw S=!0,n&&(e.precision=n),Error(Ut);return k(new e(Ge),t,1,!0)}function ue(e,t,n){if(t>ct)throw Error(Ut);return k(new e(Ue),t,n,!0)}function Zt(e){var t=e.length-1,n=t*h+1;if(t=e[t],t){for(;t%10==0;t/=10)n--;for(t=e[0];t>=10;t/=10)n++}return n}function ye(e){for(var t="";e--;)t+="0";return t}function Yt(e,t,n,i){var o,r=new e(1),s=Math.ceil(i/h+4);for(S=!1;;){if(n%2&&(r=r.times(t),Dt(r.d,s)&&(o=!0)),n=Y(n/2),n===0){n=r.d.length-1,o&&r.d[n]===0&&++r.d[n];break}t=t.times(t),Dt(t.d,s)}return S=!0,r}function Vt(e){return e.d[e.d.length-1]&1}function jt(e,t,n){for(var i,o,r=new e(t[0]),s=0;++s<t.length;){if(o=new e(t[s]),!o.s){r=o;break}i=r.cmp(o),(i===n||i===0&&r.s===n)&&(r=o)}return r}function lt(e,t){var n,i,o,r,s,a,c,u=0,l=0,m=0,f=e.constructor,b=f.rounding,T=f.precision;if(!e.d||!e.d[0]||e.e>17)return new f(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:0/0);for(t==null?(S=!1,c=T):c=t,a=new f(.03125);e.e>-2;)e=e.times(a),m+=5;for(i=Math.log(G(2,m))/Math.LN10*2+5|0,c+=i,n=r=s=new f(1),f.precision=c;;){if(r=k(r.times(e),c,1),n=n.times(++l),a=s.plus(O(r,n,c,1)),U(a.d).slice(0,c)===U(s.d).slice(0,c)){for(o=m;o--;)s=k(s.times(s),c,1);if(t==null)if(u<3&&Ke(s.d,c-i,b,u))f.precision=c+=10,n=r=a=new f(1),l=0,u++;else return k(s,f.precision=T,b,S=!0);else return f.precision=T,s}s=a}}function ge(e,t){var n,i,o,r,s,a,c,u,l,m,f,b=1,T=10,y=e,I=y.d,K=y.constructor,M=K.rounding,C=K.precision;if(y.s<0||!I||!I[0]||!y.e&&I[0]==1&&I.length==1)return new K(I&&!I[0]?-1/0:y.s!=1?NaN:I?0:y);if(t==null?(S=!1,l=C):l=t,K.precision=l+=T,n=U(I),i=n.charAt(0),Math.abs(r=y.e)<15e14){for(;i<7&&i!=1||i==1&&n.charAt(1)>3;)y=y.times(e),n=U(y.d),i=n.charAt(0),b++;r=y.e,i>1?(y=new K("0."+n),r++):y=new K(i+"."+n.slice(1))}else return u=Xe(K,l+2,C).times(r+""),y=ge(new K(i+"."+n.slice(1)),l-T).plus(u),K.precision=C,t==null?k(y,C,M,S=!0):y;for(m=y,c=s=y=O(y.minus(1),y.plus(1),l,1),f=k(y.times(y),l,1),o=3;;){if(s=k(s.times(f),l,1),u=c.plus(O(s,new K(o),l,1)),U(u.d).slice(0,l)===U(c.d).slice(0,l))if(c=c.times(2),r!==0&&(c=c.plus(Xe(K,l+2,C).times(r+""))),c=O(c,new K(b),l,1),t==null)if(Ke(c.d,l-T,M,a))K.precision=l+=T,u=s=y=O(m.minus(1),m.plus(1),l,1),f=k(y.times(y),l,1),o=a=1;else return k(c,K.precision=C,M,S=!0);else return K.precision=C,c;c=u,o+=2}}function Qt(e){return String(e.s*e.s/0)}function qe(e,t){var n,i,o;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(i=t.search(/e/i))>0?(n<0&&(n=i),n+=+t.slice(i+1),t=t.substring(0,i)):n<0&&(n=t.length),i=0;t.charCodeAt(i)===48;i++);for(o=t.length;t.charCodeAt(o-1)===48;--o);if(t=t.slice(i,o),t){if(o-=i,e.e=n=n-i-1,e.d=[],i=(n+1)%h,n<0&&(i+=h),i<o){for(i&&e.d.push(+t.slice(0,i)),o-=h;i<o;)e.d.push(+t.slice(i,i+=h));t=t.slice(i),i=h-t.length}else i-=o;for(;i--;)t+="0";e.d.push(+t),S&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function qn(e,t){var n,i,o,r,s,a,c,u,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),zt.test(t))return qe(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(En.test(t))n=16,t=t.toLowerCase();else if(Wn.test(t))n=2;else if(vn.test(t))n=8;else throw Error(Pe+t);for(r=t.search(/p/i),r>0?(c=+t.slice(r+1),t=t.substring(2,r)):t=t.slice(2),r=t.indexOf("."),s=r>=0,i=e.constructor,s&&(t=t.replace(".",""),a=t.length,r=a-r,o=Yt(i,new i(n),r,r*2)),u=De(t,n,se),l=u.length-1,r=l;u[r]===0;--r)u.pop();return r<0?new i(e.s*0):(e.e=ze(u,l),e.d=u,S=!1,s&&(e=O(e,o,a*4)),c&&(e=e.times(Math.abs(c)<54?G(2,c):Ye.pow(2,c))),S=!0,e)}function Gn(e,t){var n,i=t.d.length;if(i<3)return t.isZero()?t:xe(e,2,t,t);n=1.4*Math.sqrt(i),n=n>16?16:n|0,t=t.times(1/Ze(5,n)),t=xe(e,2,t,t);for(var o,r=new e(5),s=new e(16),a=new e(20);n--;)o=t.times(t),t=t.times(r.plus(o.times(s.times(o).minus(a))));return t}function xe(e,t,n,i,o){var r,s,a,c,u=1,l=e.precision,m=Math.ceil(l/h);for(S=!1,c=n.times(n),a=new e(i);;){if(s=O(a.times(c),new e(t++*t++),l,1),a=o?i.plus(s):i.minus(s),i=O(s.times(c),new e(t++*t++),l,1),s=a.plus(i),s.d[m]!==void 0){for(r=m;s.d[r]===a.d[r]&&r--;);if(r==-1)break}r=a,a=i,i=s,s=r,u++}return S=!0,s.d.length=m+1,s}function Ze(e,t){for(var n=e;--t;)n*=e;return n}function Jt(e,t){var n,i=t.s<0,o=ue(e,e.precision,1),r=o.times(.5);if(t=t.abs(),t.lte(r))return me=i?4:1,t;if(n=t.divToInt(o),n.isZero())me=i?3:2;else{if(t=t.minus(n.times(o)),t.lte(r))return me=Vt(n)?i?2:3:i?4:1,t;me=Vt(n)?i?1:4:i?3:2}return t.minus(o).abs()}function mt(e,t,n,i){var o,r,s,a,c,u,l,m,f,b=e.constructor,T=n!==void 0;if(T?(te(n,1,we),i===void 0?i=b.rounding:te(i,0,8)):(n=b.precision,i=b.rounding),!e.isFinite())l=Qt(e);else{for(l=ce(e),s=l.indexOf("."),T?(o=2,t==16?n=n*4-3:t==8&&(n=n*3-2)):o=t,s>=0&&(l=l.replace(".",""),f=new b(1),f.e=l.length-s,f.d=De(ce(f),10,o),f.e=f.d.length),m=De(l,10,o),r=c=m.length;m[--c]==0;)m.pop();if(!m[0])l=T?"0p+0":"0";else{if(s<0?r--:(e=new b(e),e.d=m,e.e=r,e=O(e,f,n,i,0,o),m=e.d,r=e.e,u=Gt),s=m[n],a=o/2,u=u||m[n+1]!==void 0,u=i<4?(s!==void 0||u)&&(i===0||i===(e.s<0?3:2)):s>a||s===a&&(i===4||u||i===6&&m[n-1]&1||i===(e.s<0?8:7)),m.length=n,u)for(;++m[--n]>o-1;)m[n]=0,n||(++r,m.unshift(1));for(c=m.length;!m[c-1];--c);for(s=0,l="";s<c;s++)l+=at.charAt(m[s]);if(T){if(c>1)if(t==16||t==8){for(s=t==16?4:3,--c;c%s;c++)l+="0";for(m=De(l,o,t),c=m.length;!m[c-1];--c);for(s=1,l="1.";s<c;s++)l+=at.charAt(m[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>c)for(r-=c;r--;)l+="0";else r<c&&(l=l.slice(0,r)+"."+l.slice(r))}l=(t==16?"0x":t==2?"0b":t==8?"0o":"")+l}return e.s<0?"-"+l:l}function Dt(e,t){if(e.length>t)return e.length=t,!0}function Un(e){return new this(e).abs()}function Xn(e){return new this(e).acos()}function Hn(e){return new this(e).acosh()}function zn(e,t){return new this(e).plus(t)}function Zn(e){return new this(e).asin()}function Yn(e){return new this(e).asinh()}function jn(e){return new this(e).atan()}function Qn(e){return new this(e).atanh()}function Jn(e,t){e=new this(e),t=new this(t);var n,i=this.precision,o=this.rounding,r=i+4;return!e.s||!t.s?n=new this(NaN):!e.d&&!t.d?(n=ue(this,r,1).times(t.s>0?.25:.75),n.s=e.s):!t.d||e.isZero()?(n=t.s<0?ue(this,i,o):new this(0),n.s=e.s):!e.d||t.isZero()?(n=ue(this,r,1).times(.5),n.s=e.s):t.s<0?(this.precision=r,this.rounding=1,n=this.atan(O(e,t,r,1)),t=ue(this,r,1),this.precision=i,this.rounding=o,n=e.s<0?n.minus(t):n.plus(t)):n=this.atan(O(e,t,r,1)),n}function $n(e){return new this(e).cbrt()}function ei(e){return k(e=new this(e),e.e+1,2)}function ti(e,t,n){return new this(e).clamp(t,n)}function ni(e){if(!e||typeof e!="object")throw Error(He+"Object expected");var t,n,i,o=e.defaults===!0,r=["precision",1,we,"rounding",0,8,"toExpNeg",-Be,0,"toExpPos",0,Be,"maxE",0,Be,"minE",-Be,0,"modulo",0,9];for(t=0;t<r.length;t+=3)if(n=r[t],o&&(this[n]=ut[n]),(i=e[n])!==void 0)if(Y(i)===i&&i>=r[t+1]&&i<=r[t+2])this[n]=i;else throw Error(Pe+n+": "+i);if(n="crypto",o&&(this[n]=ut[n]),(i=e[n])!==void 0)if(i===!0||i===!1||i===0||i===1)if(i)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[n]=!0;else throw Error(Xt);else this[n]=!1;else throw Error(Pe+n+": "+i);return this}function ii(e){return new this(e).cos()}function ri(e){return new this(e).cosh()}function $t(e){var t,n,i;function o(r){var s,a,c,u=this;if(!(u instanceof o))return new o(r);if(u.constructor=o,qt(r)){u.s=r.s,S?!r.d||r.e>o.maxE?(u.e=NaN,u.d=null):r.e<o.minE?(u.e=0,u.d=[0]):(u.e=r.e,u.d=r.d.slice()):(u.e=r.e,u.d=r.d?r.d.slice():r.d);return}if(c=typeof r,c==="number"){if(r===0){u.s=1/r<0?-1:1,u.e=0,u.d=[0];return}if(r<0?(r=-r,u.s=-1):u.s=1,r===~~r&&r<1e7){for(s=0,a=r;a>=10;a/=10)s++;S?s>o.maxE?(u.e=NaN,u.d=null):s<o.minE?(u.e=0,u.d=[0]):(u.e=s,u.d=[r]):(u.e=s,u.d=[r]);return}if(r*0!==0){r||(u.s=NaN),u.e=NaN,u.d=null;return}return qe(u,r.toString())}if(c==="string")return(a=r.charCodeAt(0))===45?(r=r.slice(1),u.s=-1):(a===43&&(r=r.slice(1)),u.s=1),zt.test(r)?qe(u,r):qn(u,r);if(c==="bigint")return r<0?(r=-r,u.s=-1):u.s=1,qe(u,r.toString());throw Error(Pe+r)}if(o.prototype=p,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=ni,o.clone=$t,o.isDecimal=qt,o.abs=Un,o.acos=Xn,o.acosh=Hn,o.add=zn,o.asin=Zn,o.asinh=Yn,o.atan=jn,o.atanh=Qn,o.atan2=Jn,o.cbrt=$n,o.ceil=ei,o.clamp=ti,o.cos=ii,o.cosh=ri,o.div=oi,o.exp=si,o.floor=ai,o.hypot=ui,o.ln=ci,o.log=li,o.log10=di,o.log2=mi,o.max=fi,o.min=pi,o.mod=bi,o.mul=yi,o.pow=gi,o.random=Pi,o.round=wi,o.sign=ki,o.sin=Ai,o.sinh=Ti,o.sqrt=hi,o.sub=Bi,o.sum=xi,o.tan=Ii,o.tanh=Si,o.trunc=Ci,e===void 0&&(e={}),e&&e.defaults!==!0)for(i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],t=0;t<i.length;)e.hasOwnProperty(n=i[t++])||(e[n]=this[n]);return o.config(e),o}function oi(e,t){return new this(e).div(t)}function si(e){return new this(e).exp()}function ai(e){return k(e=new this(e),e.e+1,3)}function ui(){var e,t,n=new this(0);for(S=!1,e=0;e<arguments.length;)if(t=new this(arguments[e++]),t.d)n.d&&(n=n.plus(t.times(t)));else{if(t.s)return S=!0,new this(1/0);n=t}return S=!0,n.sqrt()}function qt(e){return e instanceof Ye||e&&e.toStringTag===Ht||!1}function ci(e){return new this(e).ln()}function li(e,t){return new this(e).log(t)}function mi(e){return new this(e).log(2)}function di(e){return new this(e).log(10)}function fi(){return jt(this,arguments,-1)}function pi(){return jt(this,arguments,1)}function bi(e,t){return new this(e).mod(t)}function yi(e,t){return new this(e).mul(t)}function gi(e,t){return new this(e).pow(t)}function Pi(e){var t,n,i,o,r=0,s=new this(1),a=[];if(e===void 0?e=this.precision:te(e,1,we),i=Math.ceil(e/h),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(i));r<i;)o=t[r],o>=429e7?t[r]=crypto.getRandomValues(new Uint32Array(1))[0]:a[r++]=o%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(i*=4);r<i;)o=t[r]+(t[r+1]<<8)+(t[r+2]<<16)+((t[r+3]&127)<<24),o>=214e7?crypto.randomBytes(4).copy(t,r):(a.push(o%1e7),r+=4);r=i/4}else throw Error(Xt);else for(;r<i;)a[r++]=Math.random()*1e7|0;for(i=a[--r],e%=h,i&&e&&(o=G(10,h-e),a[r]=(i/o|0)*o);a[r]===0;r--)a.pop();if(r<0)n=0,a=[0];else{for(n=-1;a[0]===0;n-=h)a.shift();for(i=1,o=a[0];o>=10;o/=10)i++;i<h&&(n-=h-i)}return s.e=n,s.d=a,s}function wi(e){return k(e=new this(e),e.e+1,this.rounding)}function ki(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function Ai(e){return new this(e).sin()}function Ti(e){return new this(e).sinh()}function hi(e){return new this(e).sqrt()}function Bi(e,t){return new this(e).sub(t)}function xi(){var e=0,t=arguments,n=new this(t[e]);for(S=!1;n.s&&++e<t.length;)n=n.plus(t[e]);return S=!0,k(n,this.precision,this.rounding)}function Ii(e){return new this(e).tan()}function Si(e){return new this(e).tanh()}function Ci(e){return k(e=new this(e),e.e+1,1)}p[Symbol.for("nodejs.util.inspect.custom")]=p.toString;p[Symbol.toStringTag]="Decimal";var Ye=p.constructor=$t(ut);Ge=new Ye(Ge);Ue=new Ye(Ue);import Wi from"big.js";import go from"bn.js";import Ki from"toformat";var Ni=Ki,Ne=Ni;import Qe from"big.js";import Ri from"bn.js";import Mi from"decimal.js-light";import Le from"bn.js";var en=9007199254740991;function le(e){let t=j("Raydium_parseBigNumberish");if(e instanceof Le)return e;if(typeof e=="string"){if(e.match(/^-?[0-9]+$/))return new Le(e);t.logWithError(`invalid BigNumberish string: ${e}`)}return typeof e=="number"?(e%1&&t.logWithError(`BigNumberish number underflow: ${e}`),(e>=en||e<=-en)&&t.logWithError(`BigNumberish number overflow: ${e}`),new Le(String(e))):typeof e=="bigint"?new Le(e.toString()):(t.error(`invalid BigNumberish value: ${e}`),new Le(0))}var je=j("module/fraction"),dt=Ne(Qe),Re=Ne(Mi),Fi={[0]:Re.ROUND_DOWN,[1]:Re.ROUND_HALF_UP,[2]:Re.ROUND_UP},Oi={[0]:Qe.roundDown,[1]:Qe.roundHalfUp,[2]:Qe.roundUp},E=class{constructor(t,n=new Ri(1)){this.numerator=le(t),this.denominator=le(n)}get quotient(){return this.numerator.div(this.denominator)}invert(){return new E(this.denominator,this.numerator)}add(t){let n=t instanceof E?t:new E(le(t));return this.denominator.eq(n.denominator)?new E(this.numerator.add(n.numerator),this.denominator):new E(this.numerator.mul(n.denominator).add(n.numerator.mul(this.denominator)),this.denominator.mul(n.denominator))}sub(t){let n=t instanceof E?t:new E(le(t));return this.denominator.eq(n.denominator)?new E(this.numerator.sub(n.numerator),this.denominator):new E(this.numerator.mul(n.denominator).sub(n.numerator.mul(this.denominator)),this.denominator.mul(n.denominator))}mul(t){let n=t instanceof E?t:new E(le(t));return new E(this.numerator.mul(n.numerator),this.denominator.mul(n.denominator))}div(t){let n=t instanceof E?t:new E(le(t));return new E(this.numerator.mul(n.denominator),this.denominator.mul(n.numerator))}toSignificant(t,n={groupSeparator:""},i=1){Number.isInteger(t)||je.logWithError(`${t} is not an integer.`),t<=0&&je.logWithError(`${t} is not positive.`),Re.set({precision:t+1,rounding:Fi[i]});let o=new Re(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(t);return o.toFormat(o.decimalPlaces(),n)}toFixed(t,n={groupSeparator:""},i=1){return Number.isInteger(t)||je.logWithError(`${t} is not an integer.`),t<0&&je.logWithError(`${t} is negative.`),dt.DP=t,dt.RM=Oi[i]||1,new dt(this.numerator.toString()).div(this.denominator.toString()).toFormat(t,n)}isZero(){return this.numerator.isZero()}};var Io=j("Raydium_amount"),So=Ne(Wi);import{PublicKey as vi}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as tn}from"@solana/spl-token";var ft={chainId:101,address:vi.default.toBase58(),programId:tn.toBase58(),decimals:9,symbol:"SOL",name:"solana",logoURI:"https://img-v1.raydium.io/icon/So11111111111111111111111111111111111111112.png",tags:[],priority:2,type:"raydium",extensions:{coingeckoId:"solana"}},ke={chainId:101,address:"So11111111111111111111111111111111111111112",programId:tn.toBase58(),decimals:9,symbol:"WSOL",name:"Wrapped SOL",logoURI:"https://img-v1.raydium.io/icon/So11111111111111111111111111111111111111112.png",tags:[],priority:2,type:"raydium",extensions:{coingeckoId:"solana"}};import{PublicKey as bt}from"@solana/web3.js";import{PublicKey as v,SystemProgram as nn,SYSVAR_RENT_PUBKEY as _i}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as Vi}from"@solana/spl-token";function pt({pubkey:e,isSigner:t=!1,isWritable:n=!0}){return{pubkey:e,isWritable:n,isSigner:t}}var Oo=[pt({pubkey:Vi,isWritable:!1}),pt({pubkey:nn.programId,isWritable:!1}),pt({pubkey:_i,isWritable:!1})];function rn({publicKey:e,transformSol:t}){let n=on(e.toString());if(n instanceof v)return t&&n.equals(Me)?Ve:n;if(t&&n.toString()===Me.toBase58())return Ve;if(typeof n=="string"){if(n===v.default.toBase58())return v.default;try{return new v(n)}catch{throw new Error("invalid public key")}}throw new Error("invalid public key")}function on(e){try{return new v(e)}catch{return e}}var Di=new v("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),qi=new v("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),Je=new v("SysvarRent111111111111111111111111111111111"),Wo=new v("SysvarC1ock11111111111111111111111111111111"),Fe=new v("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),Eo=new v("Sysvar1nstructions1111111111111111111111111"),vo=nn.programId,_o=new v("4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R"),Vo=new v("Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS"),Do=new v("SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt"),qo=new v("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),Go=new v("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"),Uo=new v("mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So"),Xo=new v("7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj"),Ho=new v("USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX"),zo=new v("NRVwhjBQiUPYtfDT5zRBVJajzFQHaBUNtC7SNVvqRFa"),Zo=new v("ANAxByE6G2WjFp7A4NqtWYXb3mgruyzZYg3spfxe6Lbo"),Yo=new v("7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs"),Ve=new v("So11111111111111111111111111111111111111112"),Me=v.default;var yt=class{constructor({mint:t,decimals:n,symbol:i,name:o,skipMint:r=!1,isToken2022:s=!1}){if(t===Me.toBase58()||t instanceof bt&&Me.equals(t)){this.decimals=ke.decimals,this.symbol=ke.symbol,this.name=ke.name,this.mint=new bt(ke.address),this.isToken2022=!1;return}this.decimals=n,this.symbol=i||t.toString().substring(0,6),this.name=o||t.toString().substring(0,6),this.mint=r?bt.default:rn({publicKey:t}),this.isToken2022=s}equals(t){return this===t?!0:this.mint.equals(t.mint)}},Ae=yt;Ae.WSOL=new yt(q(D({},ke),{mint:ke.address}));var gt=class{constructor({decimals:t,symbol:n="UNKNOWN",name:i="UNKNOWN"}){this.decimals=t,this.symbol=n,this.name=i}equals(t){return this===t}},$e=gt;$e.SOL=new gt(ft);import Gi from"bn.js";var as=new E(new Gi(100));var fs=j("Raydium_price");var Ui=new de(0),Ds=new de(1),qs=new de(2),Gs=new de(3),Us=new de(5),Ei=new de(10),Xs=new de(100),Hs=new de(1e3),zs=new de(1e4);import{PublicKey as ga}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as wa}from"@solana/spl-token";import{ComputeBudgetProgram as ta,Keypair as ra,PublicKey as Xi,Transaction as sa,TransactionMessage as ua,VersionedTransaction as ca}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as fa}from"@solana/spl-token";var pa=j("Raydium_txUtil");function tt(e,t){let[n,i]=Xi.findProgramAddressSync(e,t);return{publicKey:n,nonce:i}}import{PublicKey as A}from"@solana/web3.js";var ha=new A("EhhTKczWMGQt46ynNeRX1WfeagwwJd7ufHvCDjRxjo5Q"),Ba=new A("CBuCnLe26faBpcBP2fktp4rp8abpcAnTWft6ZrP5Q4T"),xa=new A("9KEPoZmtHUrBbhWN1v1KWLMkkvwY6WLtAVUCPRtRjP4z"),Ia=new A("FarmqiPv5eAj3j1GMdMCMUGXqPUvmquZtMy86QH6rzhG"),Sa=new A("CLaimxFqjHzgTJtAGHU47NPhg6qrc5sCnpC4tBLyABQS"),Ca=new A("srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX"),Ka=new A("9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin"),Na=new A("675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8"),La=new A("5quBtoiQqxF9Jv6KYKctB59NT3gtJD2Y65kdnB1Uev3h"),Ra=new A("CDSr3ssLcRB6XYPJwAfFt18MZvEZp4LjHcvzBVZ45duo"),Hi=new A("CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK"),zi=new A("LockrWmn6K5twhz3y9w1dQERbmgSaRkfnTeTKbpofwE"),Zi=new A("kN1kEznaF5Xbd8LYuqtEFcxzWSBk5Fv6ygX6SqEGJVy"),Ma=new A("CDSr3ssLcRB6XYPJwAfFt18MZvEZp4LjHcvzBVZ45duo"),Fa=new A("routeUGWgWzqBWFcrCfv8tritsqukccJPu3q5GPP3xS"),Oa=new A("7YttLkHDoNj9wyDur5pM1ejNaAvT9X4eqaYcHQqtj2G5"),Wa=new A("6FJon3QE27qgPVggARueB22hLvoh22VzJpXv4rBEoSLF"),Ea=new A("CC12se5To1CdEuw7fDS27B7Geo5jJyL7t5UK2B44NgiH"),va=new A("9HzJyW1qZsEiSfMUf6L2jo3CcTKAyBmSyKdwQeYisHrC"),_a=new A("DropEU8AvevN3UrXWXTMuz3rqnMczQVNjq3kcSdW2SQi"),Va=new A("CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C"),Da=new A("GpMZbSM2GgvTKHJirzeGfMFoaZ8UR2X7F4v8vHTvxFbL"),qa=new A("DNXgeM9EiiaAbaWvwjHj9fQQLAX5ZsfHyvmYUNRAdNC8"),Ga=new A("LockrWmn6K5twhz3y9w1dQERbmgSaRkfnTeTKbpofwE"),Ua=new A("3f7GcQFG397GAaEnv51zR6tsTVihYRydnydDD1cXekxH"),Xa=new A("LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj"),Ha=new A("WLHv2UAZm6z4KyaaELi5pjdbJh6RESMva1Rnn8pJVVh"),za=new A("DRay6fNdQ5J82H7xV6uq2aV3mNrUZ1J4PgSKsWgptcm6"),Za=new A("5xqNaZXX5eUi4p5HU4oz9i5QnwRNT2y6oN7yyn4qENeq"),Ya=new A("4Bu96XjU84XjPDSpveTVf6LYGCkfW5FK7SNkREWcEfV4"),ja=new A("6s1xP3hpbAfFoNtUNF8mfHsjr2Bd97JxFJRWLbL6aHuX");var Qa={OPEN_BOOK_PROGRAM:new A("EoTcMgcDRTJVZDMZWBoU6rhYHZfkNTVEAfz3uUJRcYGj"),SERUM_PROGRAM_ID_V3:new A("Ray1111111111111111111111111111111111111111"),AMM_V4:new A("DRaya7Kj3aMWQSy19kSjvmuwq9docCHofyP9kanQGaav"),AMM_STABLE:new A("DRayDdXc1NZQ9C3hRWmoSf8zK4iapgMnjdNZWrfwsP8m"),CLMM_PROGRAM_ID:new A("DRayAUgENGQBKVaX8owNhgzkEDyoHTGVEGHVJT1E9pfH"),CLMM_LOCK_PROGRAM_ID:new A("DRay25Usp3YJAi7beckgpGUC7mGJ2cR1AVPxhYfwVCUX"),CLMM_LOCK_AUTH_ID:new A("6Aoh8h2Lw2m5UGxYR8AdAL87jTWYeKoxM52mJRzfYwN"),CREATE_CPMM_POOL_PROGRAM:new A("DRaycpLY18LhpbydsBWbVJtxpNv9oXPgjRSfpF2bWpYb"),CREATE_CPMM_POOL_AUTH:new A("CXniRufdq5xL8t8jZAPxsPZDpuudwuJSPWnbcD5Y5Nxq"),CREATE_CPMM_POOL_FEE_ACC:new A("3oE58BKVt8KuYkGxx8zBojugnymWmBiyafWgMrnb6eYy"),LOCK_CPMM_PROGRAM:new A("DRay25Usp3YJAi7beckgpGUC7mGJ2cR1AVPxhYfwVCUX"),LOCK_CPMM_AUTH:new A("7qWVV8UY2bRJfDLP4s37YzBPKUkVB46DStYJBpYbQzu3"),UTIL1216:A.default,Router:new A("DRaybByLpbUL57LJARs3j8BitTxVfzBg351EaMr5UTCd"),FARM_PROGRAM_ID_V3:new A("DRayWyrLmEW5KEeqs8kdTMMaBabapqagaBC7KWpGtJeZ"),FARM_PROGRAM_ID_V4:new A("Ray1111111111111111111111111111111111111111"),FARM_PROGRAM_ID_V5:new A("DRayiCGSZgku1GTK6rXD6mVDdingXy6APAH1R6R5L2LC"),FARM_PROGRAM_ID_V6:new A("DRayzbYakXs45ELHkzH6vC3fuhQqTAnv5A68gdFuvZyZ"),LAUNCHPAD_PROGRAM:new A("DRay6fNdQ5J82H7xV6uq2aV3mNrUZ1J4PgSKsWgptcm6"),LAUNCHPAD_AUTH:new A("5xqNaZXX5eUi4p5HU4oz9i5QnwRNT2y6oN7yyn4qENeq"),LAUNCHPAD_PLATFORM:new A("2Jx4KTDrVSdWNazuGpcA8n3ZLTRGGBDxAWhuKe2Xcj2a"),LAUNCHPAD_CONFIG:new A("7ZR4zD7PYfY2XxoG1Gxcy2EgEeGYrpxrwzPuwdUBssEt"),FEE_DESTINATION_ID:new A("9y8ENuuZ3b19quffx9hQvRVygG5ky6snHfRvGpuSfeJy"),MODEL_DATA_PUBKEY:new A("Ray1111111111111111111111111111111111111111")};import eu from"bn.js";import{PublicKey as ru,AddressLookupTableAccount as ou}from"@solana/web3.js";import{PublicKey as ku,sendAndConfirmTransaction as Au,SystemProgram as Bu,Transaction as xu,TransactionMessage as Su,VersionedTransaction as Cu}from"@solana/web3.js";import Nu from"axios";import{PublicKey as Eu}from"@solana/web3.js";import _u from"bn.js";import Qi from"bn.js";var Uu=new Qi(1e6);import{PublicKey as ur}from"@solana/web3.js";import ln,{isBN as mn}from"bn.js";import{bits as dc,BitStructure as fc,blob as Ji,Blob as pc,cstr as bc,f32 as yc,f32be as gc,f64 as Pc,f64be as wc,greedy as kc,Layout as $i,ns64 as Ac,ns64be as Tc,nu64 as hc,nu64be as Bc,offset as er,s16 as xc,s16be as Ic,s24 as Sc,s24be as Cc,s32 as tr,s32be as Kc,s40 as Nc,s40be as Lc,s48 as Rc,s48be as Mc,s8 as Fc,seq as nr,struct as Oc,Structure as ir,u16 as rr,u16be as Wc,u24 as Ec,u24be as vc,u32 as or,u32be as _c,u40 as Vc,u40be as Dc,u48 as qc,u48be as Gc,u8 as sr,UInt as ar,union as Uc,Union as Xc,unionLayoutDiscriminator as Hc,utf8 as zc}from"@solana/buffer-layout";var At=$i,an=ir;var Tt=ar;var un=sr,fe=rr;var ht=or;var pe=tr;var cn=nr;var ne=Ji;var Bt=er;var Ie=class extends At{constructor(n,i,o){super(n,o);this.blob=ne(n),this.signed=i}decode(n,i=0){let o=new ln(this.blob.decode(n,i),10,"le");return this.signed?o.fromTwos(this.span*8).clone():o}encode(n,i,o=0){return typeof n=="number"&&(n=new ln(n)),this.signed&&(n=n.toTwos(this.span*8)),this.blob.encode(n.toArrayLike(Buffer,"le",this.span),i,o)}};function g(e){return new Tt(1,e)}function Se(e){return new Tt(4,e)}function d(e){return new Ie(8,!1,e)}function _(e){return new Ie(16,!1,e)}function dn(e){return new Ie(8,!0,e)}function fn(e){return new Ie(16,!0,e)}var he=class extends At{constructor(n,i,o,r){super(n.span,r);this.layout=n,this.decoder=i,this.encoder=o}decode(n,i){return this.decoder(this.layout.decode(n,i))}encode(n,i,o){return this.layout.encode(this.encoder(n),i,o)}getSpan(n,i){return this.layout.getSpan(n,i)}};function P(e){return new he(ne(32),t=>new ur(t),t=>t.toBuffer(),e)}function It(e){return new he(un(),cr,lr,e)}function cr(e){if(e===0)return!1;if(e===1)return!0;throw new Error("Invalid bool: "+e)}function lr(e){return e?1:0}function pn(e,t){let n=ht("length"),i=w([n,R(e,Bt(n,-n.span),"values")]);return new he(i,({values:o})=>o,o=>({values:o}),t)}function mr(e){let t=ht("length"),n=w([t,ne(Bt(t,-t.span),"data")]);return new he(n,({data:i})=>i,i=>({data:i}),e)}function X(e){return new he(mr(),t=>t.toString("utf-8"),t=>Buffer.from(t,"utf-8"),e)}var xt=class extends an{decode(t,n){return super.decode(t,n)}};function w(e,t,n){return new xt(e,t,n)}function R(e,t,n){let i,o=typeof t=="number"?t:mn(t)?t.toNumber():new Proxy(t,{get(r,s){if(!i){let a=Reflect.get(r,"count");i=mn(a)?a.toNumber():a,Reflect.set(r,"count",i)}return Reflect.get(r,s)},set(r,s,a){return s==="count"&&(i=a),Reflect.set(r,s,a)}});return cn(e,o,n)}import{ASSOCIATED_TOKEN_PROGRAM_ID as rt,TOKEN_2022_PROGRAM_ID as Or,TOKEN_PROGRAM_ID as _e}from"@solana/spl-token";import{SystemProgram as Q,TransactionInstruction as H}from"@solana/web3.js";import be from"bn.js";var ol=w([d(),d("epoch"),g("curveType"),fe("index"),d("migrateFee"),d("tradeFeeRate"),d("maxShareFeeRate"),d("minSupplyA"),d("maxLockRate"),d("minSellRateA"),d("minMigrateRateA"),d("minFundRaisingB"),P("mintB"),P("protocolFeeOwner"),P("migrateFeeOwner"),P("migrateToAmmWallet"),P("migrateToCpmmWallet"),R(d(),16)]),dr=w([d("totalLockedAmount"),d("cliffPeriod"),d("unlockPeriod"),d("startTime"),d("totalAllocatedShare")]),sl=w([d(),d("epoch"),g("bump"),g("status"),g("mintDecimalsA"),g("mintDecimalsB"),g("migrateType"),d("supply"),d("totalSellA"),d("virtualA"),d("virtualB"),d("realA"),d("realB"),d("totalFundRaisingB"),d("protocolFee"),d("platformFee"),d("migrateFee"),dr.replicate("vestingSchedule"),P("configId"),P("platformId"),P("mintA"),P("mintB"),P("vaultA"),P("vaultB"),P("creator"),g("mintProgramFlag"),g("cpmmCreatorFeeOn"),d("platformVestingShare"),R(g(),54)]),al=w([d(),d("epoch"),P("poolId"),P("beneficiary"),d("claimedAmount"),d("tokenShareAmount"),R(d(),8)]),St=w([g("migrateType"),g("migrateCpmmFeeOn"),d("supply"),d("totalSellA"),d("totalFundRaisingB"),d("totalLockedAmount"),d("cliffPeriod"),d("unlockPeriod")]),fr=w([d("epoch"),g("index"),P("configId"),St.replicate("bondingCurveParam"),R(d(),50)]),ul=w([d(),d("epoch"),P("platformClaimFeeWallet"),P("platformLockNftWallet"),d("platformScale"),d("creatorScale"),d("burnScale"),d("feeRate"),R(g(),64,"name"),R(g(),256,"web"),R(g(),256,"img"),P("cpConfigId"),d("creatorFeeRate"),P("transferFeeExtensionAuth"),P("platformVestingWallet"),d("platformVestingScale"),P("platformCpCreator"),R(g(),108),pn(fr,"platformCurve")]);import{PublicKey as cf}from"@solana/web3.js";import mf from"bn.js";import{AccountLayout as bf,createAssociatedTokenAccountIdempotentInstruction as yf,TOKEN_2022_PROGRAM_ID as gf,TOKEN_PROGRAM_ID as Pf}from"@solana/spl-token";import{PublicKey as dl}from"@solana/web3.js";import{MintLayout as pl,TOKEN_PROGRAM_ID as yl}from"@solana/spl-token";import{Keypair as Ld,PublicKey as Rd,SystemProgram as Fd,TransactionInstruction as Od}from"@solana/web3.js";import Ed from"bn.js";import{ASSOCIATED_TOKEN_PROGRAM_ID as Vd,TOKEN_2022_PROGRAM_ID as Dd,TOKEN_PROGRAM_ID as qd}from"@solana/spl-token";import ld from"bn.js";import oe from"bn.js";var Ct=new oe(0),bn=new oe(1),yn=new oe(-1),nt=new oe(1).shln(64),gn=new oe(1).shln(128),pr=nt.sub(bn);var br=gn.subn(1),Ce=-443636,We=-Ce,Kt=new oe("4295048016"),Nt=new oe("79226673521066979257578248091"),Cl=new oe("4295048017"),Kl=new oe("79226673521066979257578248090");var yr=new oe(10).pow(new oe(6));var Nl=new oe("18446744073700000000");import jm from"bn.js";var Wl=Buffer.from("amm_config","utf8"),Pr=Buffer.from("pool","utf8"),wr=Buffer.from("pool_vault","utf8"),El=Buffer.from("pool_reward_vault","utf8"),vl=Buffer.from("position","utf8"),_l=Buffer.from("tick_array","utf8"),Vl=Buffer.from("operation","utf8"),Dl=Buffer.from("pool_tick_array_bitmap_extension","utf8"),ql=Buffer.from("observation","utf8");var Gl=Buffer.from("locked_position","utf8");var Ul=Buffer.from("support_mint","utf8");import{PublicKey as hm}from"@solana/web3.js";import{TOKEN_2022_PROGRAM_ID as xm}from"@solana/spl-token";import Sm from"bn.js";import zl from"bn.js";var Mt=14;var it=60;var Br=w([ne(8),g("bump"),fe("index"),P(""),Se("protocolFeeRate"),Se("tradeFeeRate"),fe("tickSpacing"),R(d(),8,"")]),xr=w([Se("blockTimestamp"),dn("tickCumulative"),R(d(),4)]),Sn=w([ne(8),It("initialize