UNPKG

test-rrr-sdk

Version:

An SDK for building applications on top of Raydium.

1 lines 475 kB
var xd=Object.create;var Lo=Object.defineProperty,Sd=Object.defineProperties,Kd=Object.getOwnPropertyDescriptor,Cd=Object.getOwnPropertyDescriptors,Ld=Object.getOwnPropertyNames,Ur=Object.getOwnPropertySymbols,Rd=Object.getPrototypeOf,Ia=Object.prototype.hasOwnProperty,Gc=Object.prototype.propertyIsEnumerable;var Uc=(o,e,t)=>e in o?Lo(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,v=(o,e)=>{for(var t in e||(e={}))Ia.call(e,t)&&Uc(o,t,e[t]);if(Ur)for(var t of Ur(e))Gc.call(e,t)&&Uc(o,t,e[t]);return o},U=(o,e)=>Sd(o,Cd(e));var Ge=(o,e)=>{var t={};for(var n in o)Ia.call(o,n)&&e.indexOf(n)<0&&(t[n]=o[n]);if(o!=null&&Ur)for(var n of Ur(o))e.indexOf(n)<0&&Gc.call(o,n)&&(t[n]=o[n]);return t};var Nd=(o,e)=>{for(var t in e)Lo(o,t,{get:e[t],enumerable:!0})},Xc=(o,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ld(e))!Ia.call(o,i)&&i!==t&&Lo(o,i,{get:()=>e[i],enumerable:!(n=Kd(e,i))||n.enumerable});return o};var fe=(o,e,t)=>(t=o!=null?xd(Rd(o)):{},Xc(e||!o||!o.__esModule?Lo(t,"default",{value:o,enumerable:!0}):t,o)),Od=o=>Xc(Lo({},"__esModule",{value:!0}),o);var ky={};Nd(ky,{ACCOUNT_TYPE_SIZE:()=>vd,ALL_PROGRAM_ID:()=>Ct,AMM_CONFIG_SEED:()=>Lm,AMM_STABLE:()=>Nl,AMM_V4:()=>_i,ANAMint:()=>qp,API_URLS:()=>dt,AccountType:()=>Hc,Api:()=>Yo,BIT_PRECISION:()=>Fu,BNDivCeil:()=>en,BNLayout:()=>ii,BN_100:()=>sf,BN_1000:()=>af,BN_10000:()=>uf,BN_FIVE:()=>rf,BN_ONE:()=>Ua,BN_TEN:()=>Zn,BN_THREE:()=>of,BN_TWO:()=>nf,BN_ZERO:()=>Je,BitStructure:()=>xf,Blob:()=>mu,CLMM_LOCK_AUTH_ID:()=>Fi,CLMM_LOCK_PROGRAM_ID:()=>gi,CLMM_PROGRAM_ID:()=>_n,CLOCK_PROGRAM_ID:()=>rs,CREATE_CPMM_POOL_AUTH:()=>bs,CREATE_CPMM_POOL_FEE_ACC:()=>Fl,CREATE_CPMM_POOL_PROGRAM:()=>Vi,Clmm:()=>yo,ClmmConfigLayout:()=>tc,ClmmInstrument:()=>Me,ConstantProductCurve:()=>Pr,CpmmConfigInfoLayout:()=>Bc,CpmmFee:()=>wr,CpmmPoolInfoLayout:()=>Br,Currency:()=>Mi,CurrencyAmount:()=>Yn,Curve:()=>wn,CurveBase:()=>Gn,CurveCalculator:()=>hr,DEVNET_PROGRAM_ID:()=>Af,DEV_API_URLS:()=>wf,DEV_CREATE_CPMM_POOL_AUTH:()=>Dl,DEV_CREATE_CPMM_POOL_FEE_ACC:()=>Wl,DEV_CREATE_CPMM_POOL_PROGRAM:()=>Vl,DEV_LAUNCHPAD_AUTH:()=>Ql,DEV_LAUNCHPAD_PROGRAM:()=>Xl,DEV_LOCK_CPMM_AUTH:()=>Ul,DEV_LOCK_CPMM_PROGRAM:()=>ql,DataElement:()=>$m,ETHMint:()=>Up,EXTENSION_TICKARRAY_BITMAP_SIZE:()=>ea,FARM_LOCK_MINT:()=>Bu,FARM_LOCK_VAULT:()=>xu,FARM_PROGRAM_ID_V3:()=>ds,FARM_PROGRAM_ID_V4:()=>Ja,FARM_PROGRAM_ID_V5:()=>ps,FARM_PROGRAM_ID_V6:()=>yi,FARM_PROGRAM_TO_VERSION:()=>Qt,FARM_VERSION_TO_LEDGER_LAYOUT:()=>Ku,FARM_VERSION_TO_STATE_LAYOUT:()=>Su,FEE_DESTINATION_ID:()=>eu,FEE_RATE_DENOMINATOR:()=>ur,FEE_RATE_DENOMINATOR_VALUE:()=>nn,FETCH_TICKARRAY_COUNT:()=>Vm,Fee:()=>Cm,FixedPriceCurve:()=>vr,Fraction:()=>pe,IDO_ALL_PROGRAM:()=>qi,IDO_PROGRAM_ID_V1:()=>Ml,IDO_PROGRAM_ID_V2:()=>vl,IDO_PROGRAM_ID_V3:()=>El,IDO_PROGRAM_ID_V4:()=>_l,INSTRUCTION_PROGRAM_ID:()=>_o,InstructionType:()=>X,JupTokenType:()=>tu,LAUNCHPAD_AUTH:()=>Gl,LAUNCHPAD_AUTH_SEED:()=>yd,LAUNCHPAD_CONFIG_SEED:()=>gd,LAUNCHPAD_POOL_PLATFORM_SEED:()=>wd,LAUNCHPAD_POOL_SEED:()=>Ad,LAUNCHPAD_POOL_VAULT_SEED:()=>Pd,LAUNCHPAD_POOL_VESTING_SEED:()=>dy,LAUNCHPAD_PROGRAM:()=>Fn,LIQUIDITY_FEES_DENOMINATOR:()=>pr,LIQUIDITY_FEES_NUMERATOR:()=>na,LIQUIDITY_POOL_PROGRAM_ID_V5_MODEL:()=>Xo,LIQUIDITY_VERSION_TO_SERUM_VERSION:()=>jm,LIQUIDITY_VERSION_TO_STATE_LAYOUT:()=>vb,LOCK_CPMM_AUTH:()=>Wi,LOCK_CPMM_PROGRAM:()=>Di,LOCK_LIQUIDITY_SEED:()=>dd,LOG_B_2_X32:()=>Vu,LOG_B_P_ERR_MARGIN_LOWER_X64:()=>Du,LOG_B_P_ERR_MARGIN_UPPER_X64:()=>Wu,LOOKUP_TABLE_CACHE:()=>zo,LaunchPadConstantProductCurve:()=>Mr,LaunchpadConfig:()=>Ki,LaunchpadPool:()=>Bo,LaunchpadPoolInitParam:()=>di,LaunchpadVesting:()=>Ay,LaunchpadVestingSchedule:()=>hd,Layout:()=>Gi,LinearPriceCurve:()=>Er,LiquidityMath:()=>he,LockClPositionLayoutV2:()=>Cb,LockPositionLayout:()=>Kb,LogLevel:()=>Qc,Logger:()=>Gr,MARKET_STATE_LAYOUT_V2:()=>da,MARKET_STATE_LAYOUT_V3:()=>ya,MARKET_VERSION_TO_STATE_LAYOUT:()=>Kc,MAX_BASE64_SIZE:()=>ja,MAX_SQRT_PRICE_X64:()=>jt,MAX_SQRT_PRICE_X64_SUB_ONE:()=>ar,MAX_TICK:()=>Rt,MEMO_PROGRAM_ID:()=>Eo,MEMO_PROGRAM_ID2:()=>pn,METADATA_PROGRAM_ID:()=>$t,MIN_SQRT_PRICE_X64:()=>Ht,MIN_SQRT_PRICE_X64_ADD_ONE:()=>sr,MIN_TICK:()=>Tt,MODEL_DATA_PUBKEY:()=>Ti,Market:()=>Sr,MathLaunch:()=>So,MathUtil:()=>le,MaxU64:()=>Ji,MaxUint128:()=>_u,NEGATIVE_ONE:()=>Kn,NRVMint:()=>Wp,OBSERVATION_SEED:()=>_m,ONE:()=>qt,OPEN_BOOK_PROGRAM:()=>fs,OPERATION_SEED:()=>vm,ObservationInfoLayout:()=>nc,ObservationLayout:()=>Wm,OperationLayout:()=>ic,OptionLayout:()=>Ss,Owner:()=>Jt,PAIMint:()=>Mp,POOL_LOCK_ID_SEED:()=>ju,POOL_REWARD_VAULT_SEED:()=>Om,POOL_SEED:()=>Rm,POOL_TICK_ARRAY_BITMAP_SEED:()=>Em,POOL_VAULT_SEED:()=>Nm,POSITION_SEED:()=>Xu,Percent:()=>ze,PlatformConfig:()=>Or,PoolFetchType:()=>nu,PoolInfoLayout:()=>si,PoolUtils:()=>Ee,PositionInfoLayout:()=>ao,PositionRewardInfoLayout:()=>Um,PositionUtils:()=>oo,Price:()=>mt,ProtocolPositionLayout:()=>Sb,Q128:()=>rr,Q64:()=>Xe,RAYMint:()=>Op,RENT_PROGRAM_ID:()=>nt,Raydium:()=>Vr,RewardInfo:()=>qm,RoundDirection:()=>yc,Rounding:()=>Jr,Router:()=>Ol,SERUM_PROGRAMID_TO_VERSION:()=>xc,SERUM_PROGRAM_ID_V3:()=>Go,SERUM_VERSION_TO_PROGRAMID:()=>Sc,SESSION_KEY:()=>iu,SOLMint:()=>lt,SOL_INFO:()=>dn,SPL_MINT_LAYOUT:()=>oc,SRMMint:()=>vp,STORAGE_KEY:()=>As,SUPPORT_MINT_SEED:()=>Fm,SYSTEM_PROGRAM_ID:()=>Fo,SqrtPriceMath:()=>se,StableLayout:()=>hi,Structure:()=>Ks,SwapMath:()=>ri,TICK_ARRAY_BITMAP_SIZE:()=>oi,TICK_ARRAY_SEED:()=>Mm,TICK_ARRAY_SIZE:()=>rt,TICK_SPACINGS:()=>Pb,TOKEN_WSOL:()=>ct,TickArrayBitmap:()=>Ln,TickArrayBitmapExtensionLayout:()=>Ju,TickArrayBitmapExtensionUtils:()=>so,TickArrayLayout:()=>ro,TickLayout:()=>Gm,TickMath:()=>ai,TickQuery:()=>Ie,TickUtils:()=>$,Token:()=>Le,TokenAmount:()=>xe,TxBuilder:()=>Ho,TxVersion:()=>vn,U64Resolution:()=>eo,U64_IGNORE_RANGE:()=>kb,UInt:()=>Ts,USDCMint:()=>Ep,USDHMint:()=>Dp,USDTMint:()=>_p,UTIL1216:()=>Rl,Union:()=>Cs,Voter:()=>Tu,VoterDepositEntry:()=>Pm,VoterLockup:()=>Am,VoterRegistrar:()=>hu,VoterVotingMintConfig:()=>gm,WSOLMint:()=>J,WideBits:()=>$o,WrappedLayout:()=>xn,ZERO:()=>we,_100_PERCENT:()=>Va,accountMeta:()=>A,add:()=>ef,addComputeBudget:()=>Wo,addLiquidityLayout:()=>sa,anchorDataBuf:()=>An,array:()=>sb,associatedLedgerAccountLayout:()=>Ns,bits:()=>Bs,blob:()=>Ke,bool:()=>Ue,buyExactInInstruction:()=>Ec,buyExactOutInstruction:()=>fy,calFarmRewardAmount:()=>Xs,ceilDiv:()=>Do,ceilDivBN:()=>Qo,checkLegacyTxSize:()=>vi,checkPoolToAmm:()=>Py,checkV0TxSize:()=>Ei,chunkArray:()=>Xr,claimLayout:()=>wo,claimPlatformFee:()=>Fc,claimVestedToken:()=>yy,clmmComputeInfoToApiInfo:()=>$u,closeAccountInstruction:()=>Sn,collectCpFeeInstruction:()=>Ic,commonSystemAccountMeta:()=>ns,confirmTransaction:()=>qo,cpmmLockPositionInstruction:()=>pd,createAssociatedLedgerAccountInstruction:()=>ji,createLogger:()=>ge,createPlatformConfig:()=>Vc,createPoolFeeLayout:()=>sc,createPoolV4InstructionV2:()=>ca,createPoolV4Layout:()=>Mb,createVestingAccount:()=>gy,createWSolAccountInstructions:()=>bn,cstr:()=>eb,currencyEquals:()=>Gp,decimalToFraction:()=>Tl,decodeBool:()=>am,div:()=>Yp,divCeil:()=>Vo,dwLayout:()=>Lt,encodeBool:()=>um,endlessRetry:()=>kf,eq:()=>Al,f32:()=>jf,f32be:()=>Yf,f64:()=>Zf,f64be:()=>$f,farmAddRewardLayout:()=>Es,farmLedgerLayoutV3_1:()=>mb,farmLedgerLayoutV3_2:()=>zi,farmLedgerLayoutV5_1:()=>db,farmLedgerLayoutV5_2:()=>wu,farmLedgerLayoutV6_1:()=>ku,farmRewardInfoToConfig:()=>Lu,farmRewardLayout:()=>Ms,farmRewardRestartLayout:()=>vs,farmRewardTimeInfoLayout:()=>ym,farmStateV3Layout:()=>Au,farmStateV5Layout:()=>Pu,farmStateV6Layout:()=>Qi,fetchMultipleFarmInfoAndUpdate:()=>pb,fetchMultipleInfo:()=>zb,fetchMultipleMintInfos:()=>fi,findProgramAddress:()=>ae,fixedSwapInLayout:()=>ia,fixedSwapOutLayout:()=>oa,floorDiv:()=>ls,forecastTransactionSize:()=>Uo,formatLayout:()=>nd,generatePubKey:()=>je,getATAAddress:()=>ne,getAssociatedAuthority:()=>Cu,getAssociatedConfigId:()=>br,getAssociatedLedgerAccount:()=>ht,getAssociatedLedgerPoolAccount:()=>Hi,getAssociatedOpenOrders:()=>cd,getAssociatedPoolKeys:()=>ma,getCpLockPda:()=>Tr,getCpmmPdaAmmConfigId:()=>ny,getCpmmPdaPoolId:()=>ba,getCreatePoolKeys:()=>Ac,getDate:()=>Qa,getDepositEntryIndex:()=>Qs,getDxByDyBaseIn:()=>cc,getDyByDxBaseIn:()=>uc,getEpochInfo:()=>yf,getFarmLedgerLayout:()=>wi,getFarmStateLayout:()=>wm,getLiquidityAssociatedAuthority:()=>la,getLiquidityAssociatedId:()=>ci,getLiquidityFromAmounts:()=>Bb,getMax:()=>Jp,getMultipleAccountsInfo:()=>Zt,getMultipleAccountsInfoWithCustomFlags:()=>_e,getMultipleLookupTableInfo:()=>ys,getPdaAmmConfigId:()=>Ib,getPdaCpiEvent:()=>Si,getPdaExBitmapAccount:()=>Ye,getPdaLaunchpadAuth:()=>Io,getPdaLaunchpadConfigId:()=>py,getPdaLaunchpadPoolId:()=>Rr,getPdaLaunchpadVaultId:()=>ka,getPdaLockClPositionIdV2:()=>io,getPdaLockPositionId:()=>$s,getPdaLpMint:()=>md,getPdaMetadataKey:()=>Cn,getPdaMintExAccount:()=>Js,getPdaObservationAccount:()=>Hu,getPdaObservationId:()=>Po,getPdaOperationAccount:()=>no,getPdaPersonalPositionAddress:()=>Nt,getPdaPlatformId:()=>ha,getPdaPoolAuthority:()=>Bi,getPdaPoolId:()=>Qu,getPdaPoolRewardVaulId:()=>zu,getPdaPoolVaultId:()=>Zs,getPdaProtocolPositionAddress:()=>sn,getPdaTickArrayAddress:()=>ke,getPdaVault:()=>gc,getRecentBlockHash:()=>bi,getRegistrarAddress:()=>Vs,getSessionKey:()=>jl,getStablePrice:()=>lc,getTime:()=>Bl,getTimestamp:()=>tf,getTokenOwnerRecordAddress:()=>Gs,getTransferAmountFee:()=>Pf,getTransferAmountFeeV2:()=>Se,getVoterAddress:()=>qs,getVoterWeightRecordAddress:()=>Us,getVotingMintAuthority:()=>Ws,getVotingTokenMint:()=>Ds,governanceCreateTokenOwnerRecord:()=>Bm,greedy:()=>Sf,gt:()=>gl,gte:()=>jp,i128:()=>bu,i16ToBytes:()=>hb,i32ToBytes:()=>lr,i64:()=>Ai,i8:()=>fu,initPoolLayout:()=>ra,initTokenAccountInstruction:()=>Rs,initialize:()=>vc,initializeMarket:()=>ld,intersection:()=>pf,isDateAfter:()=>Ha,isDateBefore:()=>za,isDecimal:()=>Il,isMeaningfulNumber:()=>$p,isNumber:()=>Xa,isValidFarmVersion:()=>_s,isZero:()=>to,jsonInfo2PoolKeys:()=>Fe,judgeFarmType:()=>fb,leadingZeros:()=>js,leastSignificantBit:()=>Gu,liquidityStateV4Layout:()=>ui,liquidityStateV5Layout:()=>Ym,lt:()=>zp,lte:()=>Hp,mSOLMint:()=>Fp,makeAMMSwapInstruction:()=>fr,makeAddLiquidityInstruction:()=>mc,makeAddNewRewardInstruction:()=>Hs,makeClaimInstruction:()=>Lr,makeClaimInstructionV4:()=>wa,makeCpmmLockInstruction:()=>Tc,makeCreateCpmmPoolInInstruction:()=>Pc,makeCreateFarmInstruction:()=>Ru,makeCreateMarketInstruction:()=>gr,makeCreatorWithdrawFarmRewardInstruction:()=>Nu,makeDepositCpmmInInstruction:()=>wc,makeDepositInstructionV3:()=>Mu,makeDepositInstructionV5:()=>vu,makeDepositInstructionV6:()=>Eu,makeDepositTokenInstruction:()=>yb,makeDepositWithdrawInstruction:()=>Ab,makeInitPoolInstructionV4:()=>Xb,makePurchaseInstruction:()=>ly,makeRestartRewardInstruction:()=>zs,makeSimulatePoolInfoInstruction:()=>dc,makeSwapCpmmBaseInInstruction:()=>Ir,makeSwapCpmmBaseOutInstruction:()=>hc,makeSwapFixedInInstruction:()=>od,makeSwapFixedOutInstruction:()=>rd,makeSwapInstruction:()=>Rc,makeTransferInstruction:()=>gu,makeWithdrawCpmmInInstruction:()=>kc,makeWithdrawInstructionV3:()=>$i,makeWithdrawInstructionV4:()=>Ou,makeWithdrawInstructionV5:()=>Zi,makeWithdrawInstructionV6:()=>Yi,makeWithdrawTokenInstruction:()=>gb,minExpirationTime:()=>tn,mockCreatePoolInfo:()=>wb,mockV3CreatePoolInfo:()=>qu,modelDataInfoLayout:()=>Jm,mostSignificantBit:()=>Uu,mul:()=>us,notInnerObject:()=>cs,ns64:()=>qf,ns64be:()=>Hf,nu64:()=>du,nu64be:()=>Ef,offset:()=>xs,offsetDateTime:()=>df,option:()=>nb,parseBigNumberish:()=>ee,parseNumberInfo:()=>$n,parseSimulateLogToJson:()=>Za,parseSimulateValue:()=>In,parseTokenAccountResp:()=>yu,parseTokenInfo:()=>Lb,poolTypeV6:()=>Dn,printSimulate:()=>Jn,publicKey:()=>O,purchaseLayout:()=>Aa,realFarmStateV3Layout:()=>pm,realFarmStateV5Layout:()=>fm,realFarmV6Layout:()=>bm,recursivelyDecimalToFraction:()=>qa,removeLiquidityInstruction:()=>ua,removeLiquidityLayout:()=>aa,route1Instruction:()=>sy,route2Instruction:()=>ay,routeInstruction:()=>fd,rustEnum:()=>rb,s16:()=>Ff,s16be:()=>Uf,s24:()=>Vf,s24be:()=>Gf,s32:()=>Ve,s32be:()=>Xf,s40:()=>Df,s40be:()=>Qf,s48:()=>Wf,s48be:()=>zf,s8:()=>_f,sellExactInInstruction:()=>_c,sellExactOut:()=>by,seq:()=>H,setLoggerLevel:()=>Md,shakeFractionDecimal:()=>kl,simulateMultipleInstruction:()=>Ya,simulatePoolInfoInstruction:()=>Gb,simulateTransaction:()=>Sl,sleep:()=>Da,solToWSol:()=>wt,solToWSolToken:()=>Nb,splAccountLayout:()=>rn,splitNumber:()=>va,stSOLMint:()=>Vp,str:()=>Vn,struct:()=>E,sub:()=>Zp,swapBaseInAutoAccount:()=>uy,swapBaseOutAutoAccount:()=>cy,tagged:()=>ob,tenExponential:()=>as,toAmmComputePoolInfo:()=>yr,toApiV3Token:()=>It,toBN:()=>hl,toBuffer:()=>$a,toFeeConfig:()=>Wn,toFraction:()=>Ga,toFractionWithDecimals:()=>Qp,toPercent:()=>cf,toToken:()=>dr,toTokenAmount:()=>uo,toTokenInfo:()=>Rb,toTokenPrice:()=>lf,toTotalPrice:()=>mf,toUsdCurrency:()=>Wa,trailingZeros:()=>Ys,transformTxToBase64:()=>gf,tryParsePublicKey:()=>os,txToBase64:()=>Kl,u128:()=>ie,u16:()=>on,u16ToBytes:()=>cr,u16be:()=>Rf,u24:()=>Kf,u24be:()=>Nf,u32:()=>yt,u32ToBytes:()=>Tb,u32be:()=>Of,u40:()=>Cf,u40be:()=>Mf,u48:()=>Lf,u48be:()=>vf,u64:()=>w,u8:()=>q,u8ToBytes:()=>kd,union:()=>ab,unionArr:()=>wy,unionLayoutDiscriminator:()=>Jf,uniq:()=>bf,updateFarmPoolInfo:()=>km,updatePlatformConfig:()=>Dc,updateReqHistory:()=>jo,utf8:()=>tb,validateAndParsePublicKey:()=>is,validateFarmRewards:()=>Fs,vec:()=>ib,vecU8:()=>cm,voterStakeRegistryCreateDepositEntry:()=>Sm,voterStakeRegistryCreateVoter:()=>xm,voterStakeRegistryDeposit:()=>hm,voterStakeRegistryUpdateVoterWeightRecord:()=>Tm,voterStakeRegistryWithdraw:()=>Im,wSolToSolToken:()=>Ob,withdrawRewardLayout:()=>Os,xor:()=>ff,zeros:()=>ub});module.exports=Od(ky);var ru=fe(require("axios"));var Sa=require("@solana/web3.js");var pi=require("lodash"),Qc=(i=>(i[i.Error=0]="Error",i[i.Warning=1]="Warning",i[i.Info=2]="Info",i[i.Debug=3]="Debug",i))(Qc||{}),Gr=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}},Ba={},zc={};function ge(o){let e=(0,pi.get)(Ba,o);if(!e){let t=(0,pi.get)(zc,o);e=new Gr({name:o,logLevel:t}),(0,pi.set)(Ba,o,e)}return e}function Md(o,e){(0,pi.set)(zc,o,e);let t=(0,pi.get)(Ba,o);t&&(t.level=e)}var Xn=require("@solana/spl-token"),xa=ge("Raydium_accountInfo_util");async function Zt(o,e,t){let{batchRequest:n,commitment:i="confirmed",chunkCount:r=100}=v({batchRequest:!1},t),s=Xr(e,r),a=new Array(s.length).fill([]);if(n){let c=s.map(m=>{let d=o._buildArgs([m.map(p=>p.toBase58())],i,"base64");return{methodName:"getMultipleAccounts",args:d}}),u=Xr(c,10);a=(await(await Promise.all(u.map(async m=>await o._rpcBatchRequest(m)))).flat()).map(m=>(m.error&&xa.logWithError(`failed to get info for multiple accounts, RPC_ERROR, ${m.error.message}`),m.result.value.map(d=>{if(d){let{data:p,executable:b,lamports:f,owner:y,rentEpoch:g}=d;return p.length!==2&&p[1]!=="base64"&&xa.logWithError("info must be base64 encoded, RPC_ERROR"),{data:Buffer.from(p[0],"base64"),executable:b,lamports:f,owner:new Sa.PublicKey(y),rentEpoch:g}}return null})))}else try{a=await Promise.all(s.map(c=>o.getMultipleAccountsInfo(c,i)))}catch(c){c instanceof Error&&xa.logWithError(`failed to get info for multiple accounts, RPC_ERROR, ${c.message}`)}return a.flat()}async function _e(o,e,t){let n=await Zt(o,e.map(i=>i.pubkey),t);return e.map((i,r)=>U(v({},i),{accountInfo:n[r]}))}var Hc=(n=>(n[n.Uninitialized=0]="Uninitialized",n[n.Mint=1]="Mint",n[n.Account=2]="Account",n))(Hc||{}),vd=1;async function fi({connection:o,mints:e,config:t}){var r,s,a;if(e.length===0)return{};let n=await _e(o,e.map(c=>({pubkey:wt(c)})),t),i={};for(let c of n){if(!c.accountInfo||c.accountInfo.data.length<Xn.MINT_SIZE){console.log("invalid mint account",c.pubkey.toBase58());continue}let u=(0,Xn.unpackMint)(c.pubkey,c.accountInfo,(r=c.accountInfo)==null?void 0:r.owner);i[c.pubkey.toString()]=U(v({},u),{programId:((s=c.accountInfo)==null?void 0:s.owner)||Xn.TOKEN_PROGRAM_ID,feeConfig:(a=(0,Xn.getTransferFeeConfig)(u))!=null?a:void 0})}return i[Sa.PublicKey.default.toBase58()]=i[J.toBase58()],i}var He=fe(require("bn.js"));var Ri=9e15,jn=1e9,Ka="0123456789abcdef",zr="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Hr="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Ca={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Ri,maxE:Ri,crypto:!1},$c,On,de=!0,Yr="[DecimalError] ",Hn=Yr+"Invalid argument: ",Jc=Yr+"Precision limit exceeded",el=Yr+"crypto unavailable",tl="[object Decimal]",Kt=Math.floor,ut=Math.pow,Ed=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,_d=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Fd=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,nl=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,mn=1e7,ue=7,Vd=9007199254740991,Dd=zr.length-1,La=Hr.length-1,G={toStringTag:tl};G.absoluteValue=G.abs=function(){var o=new this.constructor(this);return o.s<0&&(o.s=1),oe(o)};G.ceil=function(){return oe(new this.constructor(this),this.e+1,2)};G.clampedTo=G.clamp=function(o,e){var t,n=this,i=n.constructor;if(o=new i(o),e=new i(e),!o.s||!e.s)return new i(NaN);if(o.gt(e))throw Error(Hn+e);return t=n.cmp(o),t<0?o:n.cmp(e)>0?e:new i(n)};G.comparedTo=G.cmp=function(o){var e,t,n,i,r=this,s=r.d,a=(o=new r.constructor(o)).d,c=r.s,u=o.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!==o.e)return r.e>o.e^c<0?1:-1;for(n=s.length,i=a.length,e=0,t=n<i?n:i;e<t;++e)if(s[e]!==a[e])return s[e]>a[e]^c<0?1:-1;return n===i?0:n>i^c<0?1:-1};G.cosine=G.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())+ue,n.rounding=1,t=Wd(n,al(n,t)),n.precision=o,n.rounding=e,oe(On==2||On==3?t.neg():t,o,e,!0)):new n(1):new n(NaN)};G.cubeRoot=G.cbrt=function(){var o,e,t,n,i,r,s,a,c,u,l=this,m=l.constructor;if(!l.isFinite()||l.isZero())return new m(l);for(de=!1,r=l.s*ut(l.s*l,1/3),!r||Math.abs(r)==1/0?(t=kt(l.d),o=l.e,(r=(o-t.length+1)%3)&&(t+=r==1||r==-2?"0":"00"),r=ut(t,1/3),o=Kt((o+1)/3)-(o%3==(o<0?-1:2)),r==1/0?t="5e"+o:(t=r.toExponential(),t=t.slice(0,t.indexOf("e")+1)+o),n=new m(t),n.s=l.s):n=new m(r.toString()),s=(o=m.precision)+3;;)if(a=n,c=a.times(a).times(a),u=c.plus(l),n=ve(u.plus(l).times(a),u.plus(c),s+2,1),kt(a.d).slice(0,s)===(t=kt(n.d)).slice(0,s))if(t=t.slice(s-3,s+1),t=="9999"||!i&&t=="4999"){if(!i&&(oe(a,o+1,0),a.times(a).times(a).eq(l))){n=a;break}s+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(oe(n,o+1,1),e=!n.times(n).times(n).eq(l));break}return de=!0,oe(n,o,m.rounding,e)};G.decimalPlaces=G.dp=function(){var o,e=this.d,t=NaN;if(e){if(o=e.length-1,t=(o-Kt(this.e/ue))*ue,o=e[o],o)for(;o%10==0;o/=10)t--;t<0&&(t=0)}return t};G.dividedBy=G.div=function(o){return ve(this,new this.constructor(o))};G.dividedToIntegerBy=G.divToInt=function(o){var e=this,t=e.constructor;return oe(ve(e,new t(o),0,1,1),t.precision,t.rounding)};G.equals=G.eq=function(o){return this.cmp(o)===0};G.floor=function(){return oe(new this.constructor(this),this.e+1,3)};G.greaterThan=G.gt=function(o){return this.cmp(o)>0};G.greaterThanOrEqualTo=G.gte=function(o){var e=this.cmp(o);return e==1||e===0};G.hyperbolicCosine=G.cosh=function(){var o,e,t,n,i,r=this,s=r.constructor,a=new s(1);if(!r.isFinite())return new s(r.s?1/0:NaN);if(r.isZero())return a;t=s.precision,n=s.rounding,s.precision=t+Math.max(r.e,r.sd())+4,s.rounding=1,i=r.d.length,i<32?(o=Math.ceil(i/3),e=(1/$r(4,o)).toString()):(o=16,e="2.3283064365386962890625e-10"),r=Ni(s,1,r.times(e),new s(1),!0);for(var c,u=o,l=new s(8);u--;)c=r.times(r),r=a.minus(c.times(l.minus(c.times(l))));return oe(r,s.precision=t,s.rounding=n,!0)};G.hyperbolicSine=G.sinh=function(){var o,e,t,n,i=this,r=i.constructor;if(!i.isFinite()||i.isZero())return new r(i);if(e=r.precision,t=r.rounding,r.precision=e+Math.max(i.e,i.sd())+4,r.rounding=1,n=i.d.length,n<3)i=Ni(r,2,i,i,!0);else{o=1.4*Math.sqrt(n),o=o>16?16:o|0,i=i.times(1/$r(5,o)),i=Ni(r,2,i,i,!0);for(var s,a=new r(5),c=new r(16),u=new r(20);o--;)s=i.times(i),i=i.times(a.plus(s.times(c.times(s).plus(u))))}return r.precision=e,r.rounding=t,oe(i,e,t,!0)};G.hyperbolicTangent=G.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,ve(t.sinh(),t.cosh(),n.precision=o,n.rounding=e)):new n(t.s)};G.inverseCosine=G.acos=function(){var o,e=this,t=e.constructor,n=e.abs().cmp(1),i=t.precision,r=t.rounding;return n!==-1?n===0?e.isNeg()?ln(t,i,r):new t(0):new t(NaN):e.isZero()?ln(t,i+4,r).times(.5):(t.precision=i+6,t.rounding=1,e=e.asin(),o=ln(t,i+4,r).times(.5),t.precision=i,t.rounding=r,o.minus(e))};G.inverseHyperbolicCosine=G.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,de=!1,t=t.times(t).minus(1).sqrt().plus(t),de=!0,n.precision=o,n.rounding=e,t.ln()):new n(t)};G.inverseHyperbolicSine=G.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,de=!1,t=t.times(t).plus(1).sqrt().plus(t),de=!0,n.precision=o,n.rounding=e,t.ln())};G.inverseHyperbolicTangent=G.atanh=function(){var o,e,t,n,i=this,r=i.constructor;return i.isFinite()?i.e>=0?new r(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(o=r.precision,e=r.rounding,n=i.sd(),Math.max(n,o)<2*-i.e-1?oe(new r(i),o,e,!0):(r.precision=t=n-i.e,i=ve(i.plus(1),new r(1).minus(i),t+o,1),r.precision=o+4,r.rounding=1,i=i.ln(),r.precision=o,r.rounding=e,i.times(.5))):new r(NaN)};G.inverseSine=G.asin=function(){var o,e,t,n,i=this,r=i.constructor;return i.isZero()?new r(i):(e=i.abs().cmp(1),t=r.precision,n=r.rounding,e!==-1?e===0?(o=ln(r,t+4,n).times(.5),o.s=i.s,o):new r(NaN):(r.precision=t+6,r.rounding=1,i=i.div(new r(1).minus(i.times(i)).sqrt().plus(1)).atan(),r.precision=t,r.rounding=n,i.times(2)))};G.inverseTangent=G.atan=function(){var o,e,t,n,i,r,s,a,c,u=this,l=u.constructor,m=l.precision,d=l.rounding;if(u.isFinite()){if(u.isZero())return new l(u);if(u.abs().eq(1)&&m+4<=La)return s=ln(l,m+4,d).times(.25),s.s=u.s,s}else{if(!u.s)return new l(NaN);if(m+4<=La)return s=ln(l,m+4,d).times(.5),s.s=u.s,s}for(l.precision=a=m+10,l.rounding=1,t=Math.min(28,a/ue+2|0),o=t;o;--o)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(de=!1,e=Math.ceil(a/ue),n=1,c=u.times(u),s=new l(u),i=u;o!==-1;)if(i=i.times(c),r=s.minus(i.div(n+=2)),i=i.times(c),s=r.plus(i.div(n+=2)),s.d[e]!==void 0)for(o=e;s.d[o]===r.d[o]&&o--;);return t&&(s=s.times(2<<t-1)),de=!0,oe(s,l.precision=m,l.rounding=d,!0)};G.isFinite=function(){return!!this.d};G.isInteger=G.isInt=function(){return!!this.d&&Kt(this.e/ue)>this.d.length-2};G.isNaN=function(){return!this.s};G.isNegative=G.isNeg=function(){return this.s<0};G.isPositive=G.isPos=function(){return this.s>0};G.isZero=function(){return!!this.d&&this.d[0]===0};G.lessThan=G.lt=function(o){return this.cmp(o)<0};G.lessThanOrEqualTo=G.lte=function(o){return this.cmp(o)<1};G.logarithm=G.log=function(o){var e,t,n,i,r,s,a,c,u=this,l=u.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=u.d,u.s<0||!t||!t[0]||u.eq(1))return new l(t&&!t[0]?-1/0:u.s!=1?NaN:t?0:1/0);if(e)if(t.length>1)r=!0;else{for(i=t[0];i%10===0;)i/=10;r=i!==1}if(de=!1,a=m+p,s=zn(u,a),n=e?jr(l,a+10):zn(o,a),c=ve(s,n,a,1),Ro(c.d,i=m,d))do if(a+=10,s=zn(u,a),n=e?jr(l,a+10):zn(o,a),c=ve(s,n,a,1),!r){+kt(c.d).slice(i+1,i+15)+1==1e14&&(c=oe(c,m+1,0));break}while(Ro(c.d,i+=10,d));return de=!0,oe(c,m,d)};G.minus=G.sub=function(o){var e,t,n,i,r,s,a,c,u,l,m,d,p=this,b=p.constructor;if(o=new b(o),!p.d||!o.d)return!p.s||!o.s?o=new b(NaN):p.d?o.s=-o.s:o=new b(o.d||p.s!==o.s?p:NaN),o;if(p.s!=o.s)return o.s=-o.s,p.plus(o);if(u=p.d,d=o.d,a=b.precision,c=b.rounding,!u[0]||!d[0]){if(d[0])o.s=-o.s;else if(u[0])o=new b(p);else return new b(c===3?-0:0);return de?oe(o,a,c):o}if(t=Kt(o.e/ue),l=Kt(p.e/ue),u=u.slice(),r=l-t,r){for(m=r<0,m?(e=u,r=-r,s=d.length):(e=d,t=l,s=u.length),n=Math.max(Math.ceil(a/ue),s)+2,r>n&&(r=n,e.length=1),e.reverse(),n=r;n--;)e.push(0);e.reverse()}else{for(n=u.length,s=d.length,m=n<s,m&&(s=n),n=0;n<s;n++)if(u[n]!=d[n]){m=u[n]<d[n];break}r=0}for(m&&(e=u,u=d,d=e,o.s=-o.s),s=u.length,n=d.length-s;n>0;--n)u[s++]=0;for(n=d.length;n>r;){if(u[--n]<d[n]){for(i=n;i&&u[--i]===0;)u[i]=mn-1;--u[i],u[n]+=mn}u[n]-=d[n]}for(;u[--s]===0;)u.pop();for(;u[0]===0;u.shift())--t;return u[0]?(o.d=u,o.e=Zr(u,t),de?oe(o,a,c):o):new b(c===3?-0:0)};G.modulo=G.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]?oe(new n(t),n.precision,n.rounding):(de=!1,n.modulo==9?(e=ve(t,o.abs(),0,3,1),e.s*=o.s):e=ve(t,o,0,n.modulo,1),e=e.times(o),de=!0,t.minus(e))};G.naturalExponential=G.exp=function(){return Ra(this)};G.naturalLogarithm=G.ln=function(){return zn(this)};G.negated=G.neg=function(){var o=new this.constructor(this);return o.s=-o.s,oe(o)};G.plus=G.add=function(o){var e,t,n,i,r,s,a,c,u,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(u=m.d,l=o.d,a=d.precision,c=d.rounding,!u[0]||!l[0])return l[0]||(o=new d(m)),de?oe(o,a,c):o;if(r=Kt(m.e/ue),n=Kt(o.e/ue),u=u.slice(),i=r-n,i){for(i<0?(t=u,i=-i,s=l.length):(t=l,n=r,s=u.length),r=Math.ceil(a/ue),s=r>s?r+1:s+1,i>s&&(i=s,t.length=1),t.reverse();i--;)t.push(0);t.reverse()}for(s=u.length,i=l.length,s-i<0&&(i=s,t=l,l=u,u=t),e=0;i;)e=(u[--i]=u[i]+l[i]+e)/mn|0,u[i]%=mn;for(e&&(u.unshift(e),++n),s=u.length;u[--s]==0;)u.pop();return o.d=u,o.e=Zr(u,n),de?oe(o,a,c):o};G.precision=G.sd=function(o){var e,t=this;if(o!==void 0&&o!==!!o&&o!==1&&o!==0)throw Error(Hn+o);return t.d?(e=il(t.d),o&&t.e+1>e&&(e=t.e+1)):e=NaN,e};G.round=function(){var o=this,e=o.constructor;return oe(new e(o),o.e+1,e.rounding)};G.sine=G.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())+ue,n.rounding=1,t=Ud(n,al(n,t)),n.precision=o,n.rounding=e,oe(On>2?t.neg():t,o,e,!0)):new n(NaN)};G.squareRoot=G.sqrt=function(){var o,e,t,n,i,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(de=!1,u=Math.sqrt(+s),u==0||u==1/0?(e=kt(a),(e.length+c)%2==0&&(e+="0"),u=Math.sqrt(e),c=Kt((c+1)/2)-(c<0||c%2),u==1/0?e="5e"+c:(e=u.toExponential(),e=e.slice(0,e.indexOf("e")+1)+c),n=new l(e)):n=new l(u.toString()),t=(c=l.precision)+3;;)if(r=n,n=r.plus(ve(s,r,t+2,1)).times(.5),kt(r.d).slice(0,t)===(e=kt(n.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!i&&e=="4999"){if(!i&&(oe(r,c+1,0),r.times(r).eq(s))){n=r;break}t+=4,i=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(oe(n,c+1,1),o=!n.times(n).eq(s));break}return de=!0,oe(n,c,l.rounding,o)};G.tangent=G.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=ve(t,new n(1).minus(t.times(t)).sqrt(),o+10,0),n.precision=o,n.rounding=e,oe(On==2||On==4?t.neg():t,o,e,!0)):new n(NaN)};G.times=G.mul=function(o){var e,t,n,i,r,s,a,c,u,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=Kt(l.e/ue)+Kt(o.e/ue),c=d.length,u=p.length,c<u&&(r=d,d=p,p=r,s=c,c=u,u=s),r=[],s=c+u,n=s;n--;)r.push(0);for(n=u;--n>=0;){for(e=0,i=c+n;i>n;)a=r[i]+p[n]*d[i-n-1]+e,r[i--]=a%mn|0,e=a/mn|0;r[i]=(r[i]+e)%mn|0}for(;!r[--s];)r.pop();return e?++t:r.shift(),o.d=r,o.e=Zr(r,t),de?oe(o,m.precision,m.rounding):o};G.toBinary=function(o,e){return Oa(this,2,o,e)};G.toDecimalPlaces=G.toDP=function(o,e){var t=this,n=t.constructor;return t=new n(t),o===void 0?t:(Wt(o,0,jn),e===void 0?e=n.rounding:Wt(e,0,8),oe(t,o+t.e+1,e))};G.toExponential=function(o,e){var t,n=this,i=n.constructor;return o===void 0?t=Tn(n,!0):(Wt(o,0,jn),e===void 0?e=i.rounding:Wt(e,0,8),n=oe(new i(n),o+1,e),t=Tn(n,!0,o+1)),n.isNeg()&&!n.isZero()?"-"+t:t};G.toFixed=function(o,e){var t,n,i=this,r=i.constructor;return o===void 0?t=Tn(i):(Wt(o,0,jn),e===void 0?e=r.rounding:Wt(e,0,8),n=oe(new r(i),o+i.e+1,e),t=Tn(n,!1,o+n.e+1)),i.isNeg()&&!i.isZero()?"-"+t:t};G.toFraction=function(o){var e,t,n,i,r,s,a,c,u,l,m,d,p=this,b=p.d,f=p.constructor;if(!b)return new f(p);if(u=t=new f(1),n=c=new f(0),e=new f(n),r=e.e=il(b)-p.e-1,s=r%ue,e.d[0]=ut(10,s<0?ue+s:s),o==null)o=r>0?e:u;else{if(a=new f(o),!a.isInt()||a.lt(u))throw Error(Hn+a);o=a.gt(e)?r>0?e:u:a}for(de=!1,a=new f(kt(b)),l=f.precision,f.precision=r=b.length*ue*2;m=ve(a,e,0,1,1),i=t.plus(m.times(n)),i.cmp(o)!=1;)t=n,n=i,i=u,u=c.plus(m.times(i)),c=i,i=e,e=a.minus(m.times(i)),a=i;return i=ve(o.minus(t),n,0,1,1),c=c.plus(i.times(u)),t=t.plus(i.times(n)),c.s=u.s=p.s,d=ve(u,n,r,1).minus(p).abs().cmp(ve(c,t,r,1).minus(p).abs())<1?[u,n]:[c,t],f.precision=l,de=!0,d};G.toHexadecimal=G.toHex=function(o,e){return Oa(this,16,o,e)};G.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:Wt(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]?(de=!1,t=ve(t,o,0,e,1).times(o),de=!0,oe(t)):(o.s=t.s,t=o),t};G.toNumber=function(){return+this};G.toOctal=function(o,e){return Oa(this,8,o,e)};G.toPower=G.pow=function(o){var e,t,n,i,r,s,a=this,c=a.constructor,u=+(o=new c(o));if(!a.d||!o.d||!a.d[0]||!o.d[0])return new c(ut(+a,u));if(a=new c(a),a.eq(1))return a;if(n=c.precision,r=c.rounding,o.eq(1))return oe(a,n,r);if(e=Kt(o.e/ue),e>=o.d.length-1&&(t=u<0?-u:u)<=Vd)return i=ol(c,a,t,n),o.s<0?new c(1).div(i):oe(i,n,r);if(s=a.s,s<0){if(e<o.d.length-1)return new c(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=ut(+a,u),e=t==0||!isFinite(t)?Kt(u*(Math.log("0."+kt(a.d))/Math.LN10+a.e+1)):new c(t+"").e,e>c.maxE+1||e<c.minE-1?new c(e>0?s/0:0):(de=!1,c.rounding=a.s=1,t=Math.min(12,(e+"").length),i=Ra(o.times(zn(a,n+t)),n),i.d&&(i=oe(i,n+5,1),Ro(i.d,n,r)&&(e=n+10,i=oe(Ra(o.times(zn(a,e+t)),e),e+5,1),+kt(i.d).slice(n+1,n+15)+1==1e14&&(i=oe(i,n+1,0)))),i.s=s,de=!0,c.rounding=r,oe(i,n,r))};G.toPrecision=function(o,e){var t,n=this,i=n.constructor;return o===void 0?t=Tn(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Wt(o,1,jn),e===void 0?e=i.rounding:Wt(e,0,8),n=oe(new i(n),o,e),t=Tn(n,o<=n.e||n.e<=i.toExpNeg,o)),n.isNeg()&&!n.isZero()?"-"+t:t};G.toSignificantDigits=G.toSD=function(o,e){var t=this,n=t.constructor;return o===void 0?(o=n.precision,e=n.rounding):(Wt(o,1,jn),e===void 0?e=n.rounding:Wt(e,0,8)),oe(new n(t),o,e)};G.toString=function(){var o=this,e=o.constructor,t=Tn(o,o.e<=e.toExpNeg||o.e>=e.toExpPos);return o.isNeg()&&!o.isZero()?"-"+t:t};G.truncated=G.trunc=function(){return oe(new this.constructor(this),this.e+1,1)};G.valueOf=G.toJSON=function(){var o=this,e=o.constructor,t=Tn(o,o.e<=e.toExpNeg||o.e>=e.toExpPos);return o.isNeg()?"-"+t:t};function kt(o){var e,t,n,i=o.length-1,r="",s=o[0];if(i>0){for(r+=s,e=1;e<i;e++)n=o[e]+"",t=ue-n.length,t&&(r+=Qn(t)),r+=n;s=o[e],n=s+"",t=ue-n.length,t&&(r+=Qn(t))}else if(s===0)return"0";for(;s%10===0;)s/=10;return r+s}function Wt(o,e,t){if(o!==~~o||o<e||o>t)throw Error(Hn+o)}function Ro(o,e,t,n){var i,r,s,a;for(r=o[0];r>=10;r/=10)--e;return--e<0?(e+=ue,i=0):(i=Math.ceil((e+1)/ue),e%=ue),r=ut(10,ue-e),a=o[i]%r|0,n==null?e<3?(e==0?a=a/100|0:e==1&&(a=a/10|0),s=t<4&&a==99999||t>3&&a==49999||a==5e4||a==0):s=(t<4&&a+1==r||t>3&&a+1==r/2)&&(o[i+1]/r/100|0)==ut(10,e-2)-1||(a==r/2||a==0)&&(o[i+1]/r/100|0)==0:e<4?(e==0?a=a/1e3|0:e==1?a=a/100|0:e==2&&(a=a/10|0),s=(n||t<4)&&a==9999||!n&&t>3&&a==4999):s=((n||t<4)&&a+1==r||!n&&t>3&&a+1==r/2)&&(o[i+1]/r/1e3|0)==ut(10,e-3)-1,s}function Qr(o,e,t){for(var n,i=[0],r,s=0,a=o.length;s<a;){for(r=i.length;r--;)i[r]*=e;for(i[0]+=Ka.indexOf(o.charAt(s++)),n=0;n<i.length;n++)i[n]>t-1&&(i[n+1]===void 0&&(i[n+1]=0),i[n+1]+=i[n]/t|0,i[n]%=t)}return i.reverse()}function Wd(o,e){var t,n,i;if(e.isZero())return e;n=e.d.length,n<32?(t=Math.ceil(n/3),i=(1/$r(4,t)).toString()):(t=16,i="2.3283064365386962890625e-10"),o.precision+=t,e=Ni(o,1,e.times(i),new o(1));for(var r=t;r--;){var s=e.times(e);e=s.times(s).minus(s).times(8).plus(1)}return o.precision-=t,e}var ve=function(){function o(n,i,r){var s,a=0,c=n.length;for(n=n.slice();c--;)s=n[c]*i+a,n[c]=s%r|0,a=s/r|0;return a&&n.unshift(a),n}function e(n,i,r,s){var a,c;if(r!=s)c=r>s?1:-1;else for(a=c=0;a<r;a++)if(n[a]!=i[a]){c=n[a]>i[a]?1:-1;break}return c}function t(n,i,r,s){for(var a=0;r--;)n[r]-=a,a=n[r]<i[r]?1:0,n[r]=a*s+n[r]-i[r];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,r,s,a,c){var u,l,m,d,p,b,f,y,g,P,k,T,I,h,S,x,K,B,C,L,R=n.constructor,D=n.s==i.s?1:-1,F=n.d,W=i.d;if(!F||!F[0]||!W||!W[0])return new R(!n.s||!i.s||(F?W&&F[0]==W[0]:!W)?NaN:F&&F[0]==0||!W?D*0:D/0);for(c?(p=1,l=n.e-i.e):(c=mn,p=ue,l=Kt(n.e/p)-Kt(i.e/p)),C=W.length,K=F.length,g=new R(D),P=g.d=[],m=0;W[m]==(F[m]||0);m++);if(W[m]>(F[m]||0)&&l--,r==null?(h=r=R.precision,s=R.rounding):a?h=r+(n.e-i.e)+1:h=r,h<0)P.push(1),b=!0;else{if(h=h/p+2|0,m=0,C==1){for(d=0,W=W[0],h++;(m<K||d)&&h--;m++)S=d*c+(F[m]||0),P[m]=S/W|0,d=S%W|0;b=d||m<K}else{for(d=c/(W[0]+1)|0,d>1&&(W=o(W,d,c),F=o(F,d,c),C=W.length,K=F.length),x=C,k=F.slice(0,C),T=k.length;T<C;)k[T++]=0;L=W.slice(),L.unshift(0),B=W[0],W[1]>=c/2&&++B;do d=0,u=e(W,k,C,T),u<0?(I=k[0],C!=T&&(I=I*c+(k[1]||0)),d=I/B|0,d>1?(d>=c&&(d=c-1),f=o(W,d,c),y=f.length,T=k.length,u=e(f,k,y,T),u==1&&(d--,t(f,C<y?L:W,y,c))):(d==0&&(u=d=1),f=W.slice()),y=f.length,y<T&&f.unshift(0),t(k,f,T,c),u==-1&&(T=k.length,u=e(W,k,C,T),u<1&&(d++,t(k,C<T?L:W,T,c))),T=k.length):u===0&&(d++,k=[0]),P[m++]=d,u&&k[0]?k[T++]=F[x]||0:(k=[F[x]],T=1);while((x++<K||k[0]!==void 0)&&h--);b=k[0]!==void 0}P[0]||P.shift()}if(p==1)g.e=l,$c=b;else{for(m=1,d=P[0];d>=10;d/=10)m++;g.e=m+l*p-1,oe(g,a?r+g.e+1:r,s,b)}return g}}();function oe(o,e,t,n){var i,r,s,a,c,u,l,m,d,p=o.constructor;e:if(e!=null){if(m=o.d,!m)return o;for(i=1,a=m[0];a>=10;a/=10)i++;if(r=e-i,r<0)r+=ue,s=e,l=m[d=0],c=l/ut(10,i-s-1)%10|0;else if(d=Math.ceil((r+1)/ue),a=m.length,d>=a)if(n){for(;a++<=d;)m.push(0);l=c=0,i=1,r%=ue,s=r-ue+1}else break e;else{for(l=a=m[d],i=1;a>=10;a/=10)i++;r%=ue,s=r-ue+i,c=s<0?0:l/ut(10,i-s-1)%10|0}if(n=n||e<0||m[d+1]!==void 0||(s<0?l:l%ut(10,i-s-1)),u=t<4?(c||n)&&(t==0||t==(o.s<0?3:2)):c>5||c==5&&(t==4||n||t==6&&(r>0?s>0?l/ut(10,i-s):0:m[d-1])%10&1||t==(o.s<0?8:7)),e<1||!m[0])return m.length=0,u?(e-=o.e+1,m[0]=ut(10,(ue-e%ue)%ue),o.e=-e||0):m[0]=o.e=0,o;if(r==0?(m.length=d,a=1,d--):(m.length=d+1,a=ut(10,ue-r),m[d]=s>0?(l/ut(10,i-s)%ut(10,s)|0)*a:0),u)for(;;)if(d==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&&(o.e++,m[0]==mn&&(m[0]=1));break}else{if(m[d]+=a,m[d]!=mn)break;m[d--]=0,a=1}for(r=m.length;m[--r]===0;)m.pop()}return de&&(o.e>p.maxE?(o.d=null,o.e=NaN):o.e<p.minE&&(o.e=0,o.d=[0])),o}function Tn(o,e,t){if(!o.isFinite())return sl(o);var n,i=o.e,r=kt(o.d),s=r.length;return e?(t&&(n=t-s)>0?r=r.charAt(0)+"."+r.slice(1)+Qn(n):s>1&&(r=r.charAt(0)+"."+r.slice(1)),r=r+(o.e<0?"e":"e+")+o.e):i<0?(r="0."+Qn(-i-1)+r,t&&(n=t-s)>0&&(r+=Qn(n))):i>=s?(r+=Qn(i+1-s),t&&(n=t-i-1)>0&&(r=r+"."+Qn(n))):((n=i+1)<s&&(r=r.slice(0,n)+"."+r.slice(n)),t&&(n=t-s)>0&&(i+1===s&&(r+="."),r+=Qn(n))),r}function Zr(o,e){var t=o[0];for(e*=ue;t>=10;t/=10)e++;return e}function jr(o,e,t){if(e>Dd)throw de=!0,t&&(o.precision=t),Error(Jc);return oe(new o(zr),e,1,!0)}function ln(o,e,t){if(e>La)throw Error(Jc);return oe(new o(Hr),e,t,!0)}function il(o){var e=o.length-1,t=e*ue+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 Qn(o){for(var e="";o--;)e+="0";return e}function ol(o,e,t,n){var i,r=new o(1),s=Math.ceil(n/ue+4);for(de=!1;;){if(t%2&&(r=r.times(e),Yc(r.d,s)&&(i=!0)),t=Kt(t/2),t===0){t=r.d.length-1,i&&r.d[t]===0&&++r.d[t];break}e=e.times(e),Yc(e.d,s)}return de=!0,r}function jc(o){return o.d[o.d.length-1]&1}function rl(o,e,t){for(var n,i=new o(e[0]),r=0;++r<e.length;)if(n=new o(e[r]),n.s)i[t](n)&&(i=n);else{i=n;break}return i}function Ra(o,e){var t,n,i,r,s,a,c,u=0,l=0,m=0,d=o.constructor,p=d.rounding,b=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?(de=!1,c=b):c=e,a=new d(.03125);o.e>-2;)o=o.times(a),m+=5;for(n=Math.log(ut(2,m))/Math.LN10*2+5|0,c+=n,t=r=s=new d(1),d.precision=c;;){if(r=oe(r.times(o),c,1),t=t.times(++l),a=s.plus(ve(r,t,c,1)),kt(a.d).slice(0,c)===kt(s.d).slice(0,c)){for(i=m;i--;)s=oe(s.times(s),c,1);if(e==null)if(u<3&&Ro(s.d,c-n,p,u))d.precision=c+=10,t=r=a=new d(1),l=0,u++;else return oe(s,d.precision=b,p,de=!0);else return d.precision=b,s}s=a}}function zn(o,e){var t,n,i,r,s,a,c,u,l,m,d,p=1,b=10,f=o,y=f.d,g=f.constructor,P=g.rounding,k=g.precision;if(f.s<0||!y||!y[0]||!f.e&&y[0]==1&&y.length==1)return new g(y&&!y[0]?-1/0:f.s!=1?NaN:y?0:f);if(e==null?(de=!1,l=k):l=e,g.precision=l+=b,t=kt(y),n=t.charAt(0),Math.abs(r=f.e)<15e14){for(;n<7&&n!=1||n==1&&t.charAt(1)>3;)f=f.times(o),t=kt(f.d),n=t.charAt(0),p++;r=f.e,n>1?(f=new g("0."+t),r++):f=new g(n+"."+t.slice(1))}else return u=jr(g,l+2,k).times(r+""),f=zn(new g(n+"."+t.slice(1)),l-b).plus(u),g.precision=k,e==null?oe(f,k,P,de=!0):f;for(m=f,c=s=f=ve(f.minus(1),f.plus(1),l,1),d=oe(f.times(f),l,1),i=3;;){if(s=oe(s.times(d),l,1),u=c.plus(ve(s,new g(i),l,1)),kt(u.d).slice(0,l)===kt(c.d).slice(0,l))if(c=c.times(2),r!==0&&(c=c.plus(jr(g,l+2,k).times(r+""))),c=ve(c,new g(p),l,1),e==null)if(Ro(c.d,l-b,P,a))g.precision=l+=b,u=s=f=ve(m.minus(1),m.plus(1),l,1),d=oe(f.times(f),l,1),i=a=1;else return oe(c,g.precision=k,P,de=!0);else return g.precision=k,c;c=u,i+=2}}function sl(o){return String(o.s*o.s/0)}function Na(o,e){var t,n,i;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(i=e.length;e.charCodeAt(i-1)===48;--i);if(e=e.slice(n,i),e){if(i-=n,o.e=t=t-n-1,o.d=[],n=(t+1)%ue,t<0&&(n+=ue),n<i){for(n&&o.d.push(+e.slice(0,n)),i-=ue;n<i;)o.d.push(+e.slice(n,n+=ue));e=e.slice(n),n=ue-e.length}else n-=i;for(;n--;)e+="0";o.d.push(+e),de&&(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 qd(o,e){var t,n,i,r,s,a,c,u,l;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),nl.test(e))return Na(o,e)}else if(e==="Infinity"||e==="NaN")return+e||(o.s=NaN),o.e=NaN,o.d=null,o;if(_d.test(e))t=16,e=e.toLowerCase();else if(Ed.test(e))t=2;else if(Fd.test(e))t=8;else throw Error(Hn+e);for(r=e.search(/p/i),r>0?(c=+e.slice(r+1),e=e.substring(2,r)):e=e.slice(2),r=e.indexOf("."),s=r>=0,n=o.constructor,s&&(e=e.replace(".",""),a=e.length,r=a-r,i=ol(n,new n(t),r,r*2)),u=Qr(e,t,mn),l=u.length-1,r=l;u[r]===0;--r)u.pop();return r<0?new n(o.s*0):(o.e=Zr(u,l),o.d=u,de=!1,s&&(o=ve(o,i,a*4)),c&&(o=o.times(Math.abs(c)<54?ut(2,c):No.pow(2,c))),de=!0,o)}function Ud(o,e){var t,n=e.d.length;if(n<3)return e.isZero()?e:Ni(o,2,e,e);t=1.4*Math.sqrt(n),t=t>16?16:t|0,e=e.times(1/$r(5,t)),e=Ni(o,2,e,e);for(var i,r=new o(5),s=new o(16),a=new o(20);t--;)i=e.times(e),e=e.times(r.plus(i.times(s.times(i).minus(a))));return e}function Ni(o,e,t,n,i){var r,s,a,c,u=1,l=o.precision,m=Math.ceil(l/ue);for(de=!1,c=t.times(t),a=new o(n);;){if(s=ve(a.times(c),new o(e++*e++),l,1),a=i?n.plus(s):n.minus(s),n=ve(s.times(c),new o(e++*e++),l,1),s=a.plus(n),s.d[m]!==void 0){for(r=m;s.d[r]===a.d[r]&&r--;);if(r==-1)break}r=a,a=n,n=s,s=r,u++}return de=!0,s.d.length=m+1,s}function $r(o,e){for(var t=o;--e;)t*=o;return t}function al(o,e){var t,n=e.s<0,i=ln(o,o.precision,1),r=i.times(.5);if(e=e.abs(),e.lte(r))return On=n?4:1,e;if(t=e.divToInt(i),t.isZero())On=n?3:2;else{if(e=e.minus(t.times(i)),e.lte(r))return On=jc(t)?n?2:3:n?4:1,e;On=jc(t)?n?1:4:n?3:2}return e.minus(i).abs()}function Oa(o,e,t,n){var i,r,s,a,c,u,l,m,d,p=o.constructor,b=t!==void 0;if(b?(Wt(t,1,jn),n===void 0?n=p.rounding:Wt(n,0,8)):(t=p.precision,n=p.rounding),!o.isFinite())l=sl(o);else{for(l=Tn(o),s=l.indexOf("."),b?(i=2,e==16?t=t*4-3:e==8&&(t=t*3-2)):i=e,s>=0&&(l=l.replace(".",""),d=new p(1),d.e=l.length-s,d.d=Qr(Tn(d),10,i),d.e=d.d.length),m=Qr(l,10,i),r=c=m.length;m[--c]==0;)m.pop();if(!m[0])l=b?"0p+0":"0";else{if(s<0?r--:(o=new p(o),o.d=m,o.e=r,o=ve(o,d,t,n,0,i),m=o.d,r=o.e,u=$c),s=m[t],a=i/2,u=u||m[t+1]!==void 0,u=n<4?(s!==void 0||u)&&(n===0||n===(o.s<0?3:2)):s>a||s===a&&(n===4||u||n===6&&m[t-1]&1||n===(o.s<0?8:7)),m.length=t,u)for(;++m[--t]>i-1;)m[t]=0,t||(++r,m.unshift(1));for(c=m.length;!m[c-1];--c);for(s=0,l="";s<c;s++)l+=Ka.charAt(m[s]);if(b){if(c>1)if(e==16||e==8){for(s=e==16?4:3,--c;c%s;c++)l+="0";for(m=Qr(l,i,e),c=m.length;!m[c-1];--c);for(s=1,l="1.";s<c;s++)l+=Ka.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=(e==16?"0x":e==2?"0b":e==8?"0o":"")+l}return o.s<0?"-"+l:l}function Yc(o,e){if(o.length>e)return o.length=e,!0}function Gd(o){return new this(o).abs()}function Xd(o){return new this(o).acos()}function Qd(o){return new this(o).acosh()}function zd(o,e){return new this(o).plus(e)}function Hd(o){return new this(o).asin()}function jd(o){return new this(o).asinh()}function Yd(o){return new this(o).atan()}function Zd(o){return new this(o).atanh()}function $d(o,e){o=new this(o),e=new this(e);var t,n=this.precision,i=this.rounding,r=n+4;return!o.s||!e.s?t=new this(NaN):!o.d&&!e.d?(t=ln(this,r,1).times(e.s>0?.25:.75),t.s=o.s):!e.d||o.isZero()?(t=e.s<0?ln(this,n,i):new this(0),t.s=o.s):!o.d||e.isZero()?(t=ln(this,r,1).times(.5),t.s=o.s):e.s<0?(this.precision=r,this.rounding=1,t=this.atan(ve(o,e,r,1)),e=ln(this,r,1),this.precision=n,this.rounding=i,t=o.s<0?t.minus(e):t.plus(e)):t=this.atan(ve(o,e,r,1)),t}function Jd(o){return new this(o).cbrt()}function ep(o){return oe(o=new this(o),o.e+1,2)}function tp(o,e,t){return new this(o).clamp(e,t)}function np(o){if(!o||typeof o!="object")throw Error(Yr+"Object expected");var e,t,n,i=o.defaults===!0,r=["precision",1,jn,"rounding",0,8,"toExpNeg",-Ri,0,"toExpPos",0,Ri,"maxE",0,Ri,"minE",-Ri,0,"modulo",0,9];for(e=0;e<r.length;e+=3)if(t=r[e],i&&(this[t]=Ca[t]),(n=o[t])!==void 0)if(Kt(n)===n&&n>=r[e+1]&&n<=r[e+2])this[t]=n;else throw Error(Hn+t+": "+n);if(t="crypto",i&&(this[t]=Ca[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(el);else this[t]=!1;else throw Error(Hn+t+": "+n);return this}function ip(o){return new this(o).cos()}function op(o){return new this(o).cosh()}function ul(o){var e,t,n;function i(r){var s,a,c,u=this;if(!(u instanceof i))return new i(r);if(u.constructor=i,Zc(r)){u.s=r.s,de?!r.d||r.e>i.maxE?(u.e=NaN,u.d=null):r.e<i.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++;de?s>i.maxE?(u.e=NaN,u.d=null):s<i.minE?(u.e=0,u.d=[0]):(u.e=s,u.d=[r]):(u.e=s,u.d=[r]);return}else if(r*0!==0){r||(u.s=NaN),u.e=NaN,u.d=null;return}return Na(u,r.toString())}else if(c!=="string")throw Error(Hn+r);return(a=r.charCodeAt(0))===45?(r=r.slice(1),u.s=-1):(a===43&&(r=r.slice(1)),u.s=1),nl.test(r)?Na(u,r):qd(u,r)}if(i.prototype=G,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=np,i.clone=ul,i.isDecimal=Zc,i.abs=Gd,i.acos=Xd,i.acosh=Qd,i.add=zd,i.asin=Hd,i.asinh=jd,i.atan=Yd,i.atanh=Zd,i.atan2=$d,i.cbrt=Jd,i.ceil=ep,i.clamp=tp,i.cos=ip,i.cosh=op,i.div=rp,i.exp=sp,i.floor=ap,i.hypot=up,i.ln=cp,i.log=lp,i.log10=dp,i.log2=mp,i.max=pp,i.min=fp,i.mod=bp,i.mul=yp,i.pow=gp,i.random=Ap,i.round=Pp,i.sign=wp,i.sin=kp,i.sinh=hp,i.sqrt=Tp,i.sub=Ip,i.sum=Bp,i.tan=xp,i.tanh=Sp,i.trunc=Kp,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 i.config(o),i}function rp(o,e){return new this(o).div(e)}function sp(o){return new this(o).exp()}function ap(o){return oe(o=new this(o),o.e+1,3)}function up(){var o,e,t=new this(0);for(de=!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 de=!0,new this(1/0);t=e}return de=!0,t.sqrt()}function Zc(o){return o instanceof No||o&&o.toStringTag===tl||!1}function cp(o){return new this(o).ln()}function lp(o,e){return new this(o).log(e)}function mp(o){return new this(o).log(2)}function dp(o){return new this(o).log(10)}function pp(){return rl(this,arguments,"lt")}function fp(){return rl(this,arguments,"gt")}function bp(o,e){return new this(o).mod(e)}function yp(o,e){return new this(o).mul(e)}function gp(o,e){return new this(o).pow(e)}function Ap(o){var e,t,n,i,r=0,s=new this(1),a=[];if(o===void 0?o=this.precision:Wt(o,1,jn),n=Math.ceil(o/ue),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(n));r<n;)i=e[r],i>=429e7?e[r]=crypto.getRandomValues(new Uint32Array(1))[0]:a[r++]=i%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(n*=4);r<n;)i=e[r]+(e[r+1]<<8)+(e[r+2]<<16)+((e[r+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(e,r):(a.push(i%1e7),r+=4);r=n/4}else throw Error(el);else for(;r<n;)a[r++]=Math.random()*1e7|0;for(n=a[--r],o%=ue,n&&o&&(i=ut(10,ue-o),a[r]=(n/i|0)*i);a[r]===0;r--)a.pop();if(r<0)t=0,a=[0];else{for(t=-1;a[0]===0;t-=ue)a.shift();for(n=1,i=a[0];i>=10;i/=10)n++;n<ue&&(t-=ue-n)}return s.e=t,s.d=a,s}function Pp(o){return oe(o=new this(o),o.e+1,this.rounding)}function wp(o){return o=new this(o),o.d?o.d[0]?o.s:0*o.s:o.s||NaN}function kp(o){return new this(o).sin()}function hp(o){return new this(o).sinh()}function Tp(o){return new this(o).sqrt()}function Ip(o,e){return new this(o).sub(e)}function Bp(){var o=0,e=arguments,t=new this(e[o]);for(de=!1;t.s&&++o<e.length;)t=t.plus(e[o]);return de=!0,oe(t,this.precision,this.rounding)}function xp(o){return new this(o).tan()}function Sp(o){return new this(o).tanh()}function Kp(o){return oe(o=new this(o),o.e+1,1)}G[Symbol.for("nodejs.util.inspect.custom")]=G.toString;G[Symbol.toStringTag]="Decimal";var No=G.constructor=ul(Ca);zr=new No(zr);Hr=new No(Hr);var M=No;var pl=fe(require("big.js")),Mn=fe(require("bn.js"));var cl=fe(require("toformat")),Cp=cl.default,Oo=Cp;var Mo=fe(require("big.js")),ml=fe(require("bn.js")),dl=fe(require("decimal.js-light"));var Oi=fe(require("bn.js"));var Jr=(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))(Jr||{}),ll=9007199254740991;function ee(o){let e=ge("Raydium_parseBigNumberish");if(o instanceof Oi.default)return o;if(typeof o=="string"){if(o.match(/^-?[0-9]+$/))return new Oi.default(o);e.logWithError(`invalid BigNumberish string: ${o}`)}return typeof o=="number"?(o%1&&e.logWithError(`BigNumberish number underflow: ${o}`),(o>=ll||o<=-ll)&&e.logWithError(`BigNumberish number overflow: ${o}`),new Oi.default(String(o))):typeof o=="bigint"?new Oi.default(o.toString()):(e.error(`invalid BigNumberish value: ${o}`),new Oi.default(0))}var es=ge("module/fraction"),Ma=Oo(Mo.default),vo=Oo(dl.default),Lp={[0]:vo.ROUND_DOWN,[1]:vo.ROUND_HALF_UP,[2]:vo.ROUND_UP},Rp={[0]:Mo.default.roundDown,[1]:Mo.default