const e=require(`../../constants/chains.constants.cjs`),t=require(`../../data-structures/crypto-keys/keys.cjs`),n=require(`../utils/solanaMint.utils.cjs`),r=require(`../../webworker/worker.registry.cjs`),i=require(`../../webworker/performTaskWithWorker.cjs`),a=require(`../snarkjs/generateZkProof.cjs`),o=require(`../../webworker/zkProofWorker/zkProofWorker.types.cjs`);var s=async(s,c,l,u)=>{let d=e.isSolanaLike(s),f=u.map(e=>e.map(e=>e.amount.toString())),p=u.map(e=>e.map(e=>e.timeStamp)),m=u.map(e=>e.map(e=>e.randomization.toString())),h=u.map(e=>e.map(e=>e.getConstructableParams())),g=u.map(e=>e.map(e=>e.amount===0n?`0`:BigInt(e.getCommitment()).toString())),_=await i.performTaskWithWorker({type:r.WorkerVariant.ZKProof,payload:{type:o.ZKProofWorkerActionType.BUILD_IN_NULLIFIERS,data:{inputUtxosSerialized:h}}}),v=c.getShieldedPrivateKey(),y=d?l.map(e=>{let{compressedAddress:t}=n.formatMintAddress(e);return BigInt(t).toString()}):l.map(e=>BigInt(e).toString());u.forEach((e,n)=>{e.forEach((e,r)=>{let i=e.getStealthAddress(),a=t.UserKeys.getStealthAddress(e.randomization,v);if(BigInt(i).toString()!==BigInt(a).toString())throw Error(`Commitment validation stealth mismatch at tokenIdx=${n}, utxoIdx=${r}`)})});let b={shieldedPrivateKey:v,erc20TokenAddresses:y,inAmounts:f,inTimeStamps:p,inRandomizations:m,inCommitments:g,inNullifiers:_};if(!l.length||!u[0]?.length)return;let{zkCallData:x}=await a.generateZkProof(s,`commitmentCalculator${l.length}x${u[0].length}`,b,!1);if(!Array.isArray(x?.[0])||!Array.isArray(x?.[1])||!Array.isArray(x?.[2]))throw Error(`Invalid zkCallData shape for commitment validation`);return{tokenAddresses:y,inAmounts:f,inTimeStamps:p,inRandomizations:m,inCommitments:g,inNullifiers:_,proof:{a:x[0],b:x[1],c:x[2]}}};exports.buildCommitmentValidationData=s;