const e=require(`./addresses.cjs`),t=require(`../web3/etherFunctions.cjs`),n=require(`../../data-structures/crypto-keys/keys.cjs`),r=require(`../../data-structures/utxo/Utxo.cjs`),i=require(`../snarkjs/common.snarkjs.cjs`);var a=({userKeys:a,recipientAmounts:o,recipientAddresses:s,recipientInfos:c,nonce:l,tokenAddress:u})=>{if(s.length!==o.length)throw Error(`recipientAddresses must have the same length as recipientAmounts`);if(c&&c.length!==o.length)throw Error(`recipientInfos must have the same length as recipientAmounts`);let d=c??Array(o.length).fill(void 0),f=0n,p=[];return{stealthAddressStructures:o.map((o,c)=>{let m=d[c];if(m){if(!e.isValidPrivateAddress(m))throw Error(`Invalid recipient info`);return e.constructStealthAddressStructure(m)}let h=l+f;f+=1n;let g=a.getClaimableSignatureFromNonce(h),_=new n.UserKeys(g),v=_.getShieldedPrivateKey(),y=_.getSpendingKeyPair().pubSpendingBJJPoint,b=new r.Utxo({amount:o,erc20TokenAddress:u,nullifyingKey:v,spendingPublicKey:y,isNewStyle:!0});return p.push({recipientIndex:c,recipientAddress:s[c],shieldedPrivateKey:v,claimableSignature:g,utxo:b}),i.calcStealthAddressStructure(b.randomization??n.UserKeys.findCorrectRandomization(t.randomBigInt(31),v),v,y)}),fallbackRecipients:p}};exports.buildClaimableDepositPlan=a;