"use strict";const t=require("./address-DKM11kf_.js");function b(n,e,o,s){t.ahash(n);const a=t.checkOpts$1({dkLen:32,asyncTick:10},s),{c:d,dkLen:i,asyncTick:r}=a;if(t.anumber(d),t.anumber(i),t.anumber(r),d<1)throw new Error("iterations (c) should be >= 1");const f=t.kdfInputToBytes(e),u=t.kdfInputToBytes(o),l=new Uint8Array(i),p=t.hmac.create(n,f),c=p._cloneInto().update(u);return{c:d,dkLen:i,asyncTick:r,DK:l,PRF:p,PRFSalt:c}}function T(n,e,o,s,a){return n.destroy(),e.destroy(),s&&s.destroy(),t.clean(a),o}function L(n,e,o,s){const{c:a,dkLen:d,DK:i,PRF:r,PRFSalt:f}=b(n,e,o,s);let u;const l=new Uint8Array(4),p=t.createView$1(l),c=new Uint8Array(r.outputLen);for(let w=1,y=0;y<d;w++,y+=r.outputLen){const m=i.subarray(y,y+r.outputLen);p.setInt32(0,w,!1),(u=f._cloneInto(u)).update(l).digestInto(c),m.set(c.subarray(0,m.length));for(let h=1;h<a;h++){r._cloneInto(u).update(c).digestInto(c);for(let k=0;k<m.length;k++)m[k]^=c[k]}}return T(r,f,i,u,c)}/*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) */function I(n){if(typeof n!="string")throw new TypeError("invalid mnemonic type: "+typeof n);return n.normalize("NFKD")}function g(n){const e=I(n),o=e.split(" ");if(![12,15,18,21,24].includes(o.length))throw new Error("Invalid mnemonic");return{nfkd:e,words:o}}const S=n=>I("mnemonic"+n);function F(n,e=""){return L(t.sha512$1,g(n).nfkd,S(e),{c:2048,dkLen:64})}exports.mnemonicToSeedSync=F;
