import e from"libsodium";let r;const t={},a=e.ready.then(function(){function a(){if(r._sodium_init()<0)throw new Error("libsodium was not correctly initialized.");for(var e=["crypto_aead_aegis128l_decrypt","crypto_aead_aegis128l_decrypt_detached","crypto_aead_aegis128l_encrypt","crypto_aead_aegis128l_encrypt_detached","crypto_aead_aegis128l_keygen","crypto_aead_aegis256_decrypt","crypto_aead_aegis256_decrypt_detached","crypto_aead_aegis256_encrypt","crypto_aead_aegis256_encrypt_detached","crypto_aead_aegis256_keygen","crypto_aead_chacha20poly1305_decrypt","crypto_aead_chacha20poly1305_decrypt_detached","crypto_aead_chacha20poly1305_encrypt","crypto_aead_chacha20poly1305_encrypt_detached","crypto_aead_chacha20poly1305_ietf_decrypt","crypto_aead_chacha20poly1305_ietf_decrypt_detached","crypto_aead_chacha20poly1305_ietf_encrypt","crypto_aead_chacha20poly1305_ietf_encrypt_detached","crypto_aead_chacha20poly1305_ietf_keygen","crypto_aead_chacha20poly1305_keygen","crypto_aead_xchacha20poly1305_ietf_decrypt","crypto_aead_xchacha20poly1305_ietf_decrypt_detached","crypto_aead_xchacha20poly1305_ietf_encrypt","crypto_aead_xchacha20poly1305_ietf_encrypt_detached","crypto_aead_xchacha20poly1305_ietf_keygen","crypto_auth","crypto_auth_hmacsha256","crypto_auth_hmacsha256_final","crypto_auth_hmacsha256_init","crypto_auth_hmacsha256_keygen","crypto_auth_hmacsha256_update","crypto_auth_hmacsha256_verify","crypto_auth_hmacsha512","crypto_auth_hmacsha512256","crypto_auth_hmacsha512256_final","crypto_auth_hmacsha512256_init","crypto_auth_hmacsha512256_keygen","crypto_auth_hmacsha512256_update","crypto_auth_hmacsha512256_verify","crypto_auth_hmacsha512_final","crypto_auth_hmacsha512_init","crypto_auth_hmacsha512_keygen","crypto_auth_hmacsha512_update","crypto_auth_hmacsha512_verify","crypto_auth_keygen","crypto_auth_verify","crypto_box_beforenm","crypto_box_curve25519xchacha20poly1305_beforenm","crypto_box_curve25519xchacha20poly1305_detached","crypto_box_curve25519xchacha20poly1305_detached_afternm","crypto_box_curve25519xchacha20poly1305_easy","crypto_box_curve25519xchacha20poly1305_easy_afternm","crypto_box_curve25519xchacha20poly1305_keypair","crypto_box_curve25519xchacha20poly1305_open_detached","crypto_box_curve25519xchacha20poly1305_open_detached_afternm","crypto_box_curve25519xchacha20poly1305_open_easy","crypto_box_curve25519xchacha20poly1305_open_easy_afternm","crypto_box_curve25519xchacha20poly1305_seal","crypto_box_curve25519xchacha20poly1305_seal_open","crypto_box_curve25519xchacha20poly1305_seed_keypair","crypto_box_detached","crypto_box_easy","crypto_box_easy_afternm","crypto_box_keypair","crypto_box_open_detached","crypto_box_open_easy","crypto_box_open_easy_afternm","crypto_box_seal","crypto_box_seal_open","crypto_box_seed_keypair","crypto_core_ed25519_add","crypto_core_ed25519_from_hash","crypto_core_ed25519_from_uniform","crypto_core_ed25519_is_valid_point","crypto_core_ed25519_random","crypto_core_ed25519_scalar_add","crypto_core_ed25519_scalar_complement","crypto_core_ed25519_scalar_invert","crypto_core_ed25519_scalar_mul","crypto_core_ed25519_scalar_negate","crypto_core_ed25519_scalar_random","crypto_core_ed25519_scalar_reduce","crypto_core_ed25519_scalar_sub","crypto_core_ed25519_sub","crypto_core_hchacha20","crypto_core_hsalsa20","crypto_core_ristretto255_add","crypto_core_ristretto255_from_hash","crypto_core_ristretto255_is_valid_point","crypto_core_ristretto255_random","crypto_core_ristretto255_scalar_add","crypto_core_ristretto255_scalar_complement","crypto_core_ristretto255_scalar_invert","crypto_core_ristretto255_scalar_mul","crypto_core_ristretto255_scalar_negate","crypto_core_ristretto255_scalar_random","crypto_core_ristretto255_scalar_reduce","crypto_core_ristretto255_scalar_sub","crypto_core_ristretto255_sub","crypto_generichash","crypto_generichash_blake2b_salt_personal","crypto_generichash_final","crypto_generichash_init","crypto_generichash_keygen","crypto_generichash_update","crypto_hash","crypto_hash_sha256","crypto_hash_sha256_final","crypto_hash_sha256_init","crypto_hash_sha256_update","crypto_hash_sha512","crypto_hash_sha512_final","crypto_hash_sha512_init","crypto_hash_sha512_update","crypto_ipcrypt_decrypt","crypto_ipcrypt_encrypt","crypto_ipcrypt_keygen","crypto_ipcrypt_nd_decrypt","crypto_ipcrypt_nd_encrypt","crypto_ipcrypt_nd_keygen","crypto_ipcrypt_ndx_decrypt","crypto_ipcrypt_ndx_encrypt","crypto_ipcrypt_ndx_keygen","crypto_ipcrypt_pfx_decrypt","crypto_ipcrypt_pfx_encrypt","crypto_ipcrypt_pfx_keygen","crypto_kdf_derive_from_key","crypto_kdf_keygen","crypto_kx_client_session_keys","crypto_kx_keypair","crypto_kx_seed_keypair","crypto_kx_server_session_keys","crypto_onetimeauth","crypto_onetimeauth_final","crypto_onetimeauth_init","crypto_onetimeauth_keygen","crypto_onetimeauth_update","crypto_onetimeauth_verify","crypto_pwhash","crypto_pwhash_scryptsalsa208sha256","crypto_pwhash_scryptsalsa208sha256_ll","crypto_pwhash_scryptsalsa208sha256_str","crypto_pwhash_scryptsalsa208sha256_str_verify","crypto_pwhash_str","crypto_pwhash_str_needs_rehash","crypto_pwhash_str_verify","crypto_scalarmult","crypto_scalarmult_base","crypto_scalarmult_ed25519","crypto_scalarmult_ed25519_base","crypto_scalarmult_ed25519_base_noclamp","crypto_scalarmult_ed25519_noclamp","crypto_scalarmult_ristretto255","crypto_scalarmult_ristretto255_base","crypto_secretbox_detached","crypto_secretbox_easy","crypto_secretbox_keygen","crypto_secretbox_open_detached","crypto_secretbox_open_easy","crypto_secretstream_xchacha20poly1305_init_pull","crypto_secretstream_xchacha20poly1305_init_push","crypto_secretstream_xchacha20poly1305_keygen","crypto_secretstream_xchacha20poly1305_pull","crypto_secretstream_xchacha20poly1305_push","crypto_secretstream_xchacha20poly1305_rekey","crypto_shorthash","crypto_shorthash_keygen","crypto_shorthash_siphashx24","crypto_sign","crypto_sign_detached","crypto_sign_ed25519_pk_to_curve25519","crypto_sign_ed25519_sk_to_curve25519","crypto_sign_ed25519_sk_to_pk","crypto_sign_ed25519_sk_to_seed","crypto_sign_final_create","crypto_sign_final_verify","crypto_sign_init","crypto_sign_keypair","crypto_sign_open","crypto_sign_seed_keypair","crypto_sign_update","crypto_sign_verify_detached","crypto_stream_chacha20","crypto_stream_chacha20_ietf_xor","crypto_stream_chacha20_ietf_xor_ic","crypto_stream_chacha20_keygen","crypto_stream_chacha20_xor","crypto_stream_chacha20_xor_ic","crypto_stream_keygen","crypto_stream_xchacha20_keygen","crypto_stream_xchacha20_xor","crypto_stream_xchacha20_xor_ic","crypto_xof_shake128","crypto_xof_shake128_init","crypto_xof_shake128_init_with_domain","crypto_xof_shake128_squeeze","crypto_xof_shake128_update","crypto_xof_shake256","crypto_xof_shake256_init","crypto_xof_shake256_init_with_domain","crypto_xof_shake256_squeeze","crypto_xof_shake256_update","crypto_xof_turboshake128","crypto_xof_turboshake128_init","crypto_xof_turboshake128_init_with_domain","crypto_xof_turboshake128_squeeze","crypto_xof_turboshake128_update","crypto_xof_turboshake256","crypto_xof_turboshake256_init","crypto_xof_turboshake256_init_with_domain","crypto_xof_turboshake256_squeeze","crypto_xof_turboshake256_update","randombytes_buf","randombytes_buf_deterministic","randombytes_close","randombytes_random","randombytes_set_implementation","randombytes_stir","randombytes_uniform","sodium_bin2ip","sodium_ip2bin","sodium_version_string"],a=[L,O,U,P,C,R,X,D,G,F,V,q,z,W,H,j,J,Q,Z,$,ee,re,te,ae,_e,ne,se,ce,oe,pe,he,ye,ie,le,ue,de,ve,ge,be,fe,me,xe,Ee,ke,Se,Te,we,Ye,Be,Ae,Me,Ie,Ke,Ne,Le,Oe,Ue,Pe,Ce,Re,Xe,De,Ge,Fe,Ve,qe,ze,We,He,je,Je,Qe,Ze,$e,er,rr,tr,ar,_r,nr,sr,cr,or,pr,hr,yr,ir,lr,ur,dr,vr,gr,br,fr,mr,xr,Er,kr,Sr,Tr,wr,Yr,Br,Ar,Mr,Ir,Kr,Nr,Lr,Or,Ur,Pr,Cr,Rr,Xr,Dr,Gr,Fr,Vr,qr,zr,Wr,Hr,jr,Jr,Qr,Zr,$r,et,rt,tt,at,_t,nt,st,ct,ot,pt,ht,yt,it,lt,ut,dt,vt,gt,bt,ft,mt,xt,Et,kt,St,Tt,wt,Yt,Bt,At,Mt,It,Kt,Nt,Lt,Ot,Ut,Pt,Ct,Rt,Xt,Dt,Gt,Ft,Vt,qt,zt,Wt,Ht,jt,Jt,Qt,Zt,$t,ea,ra,ta,aa,_a,na,sa,ca,oa,pa,ha,ya,ia,la,ua,da,va,ga,ba,fa,ma,xa,Ea,ka,Sa,Ta,wa,Ya,Ba,Aa,Ma,Ia,Ka,Na,La,Oa,Ua,Pa,Ca,Ra],_=0;_>=8,r+=e[t],e[t]=255&r}function s(e,r){if(!(e instanceof Uint8Array&&r instanceof Uint8Array))throw new TypeError("Only Uint8Array instances can be added");var t=e.length,a=0,_=0;if(r.length!==e.length)throw new TypeError("Arguments must have the same length");for(_=0;_>=8,a+=e[_]+r[_],e[_]=255&a}function c(e){if(!(e instanceof Uint8Array))throw new TypeError("Only Uint8Array instances can be checked");for(var r=0,t=0,a=e.length;t0;)t|=r[_]-e[_]>>8&a,a&=(r[_]^e[_])-1>>8;return t+t+a-1}function y(e,t){if(!(e instanceof Uint8Array))throw new TypeError("buffer must be a Uint8Array");if((t|=0)<=0)throw new Error("block size must be > 0");var a,_=[],n=Y(4),s=1,c=0,o=0|e.length,p=new T(o+t);_.push(n),_.push(p.address);for(var h=p.address,y=p.address+o+t;h>>48|o>>>32|o>>>16|o))-1>>16);return 0!==r._sodium_pad(n,p.address,e.length,t,p.length)&&M(_,"internal error"),p.length=r.getValue(n,"i32"),a=p.to_Uint8Array(),A(_),a}function i(e,t){if(!(e instanceof Uint8Array))throw new TypeError("buffer must be a Uint8Array");if((t|=0)<=0)throw new Error("block size must be > 0");var a=[],_=w(e),n=Y(4);return a.push(_),a.push(n),0!==r._sodium_unpad(n,_,e.length,t)&&M(a,"unsupported/invalid padding"),e=(e=new Uint8Array(e)).subarray(0,r.getValue(n,"i32")),A(a),e}function l(e){if("function"==typeof TextEncoder)return(new TextEncoder).encode(e);e=unescape(encodeURIComponent(e));for(var r=new Uint8Array(e.length),t=0,a=e.length;t=240?(p=4,c=!0):h>=224?(p=3,c=!0):h>=192?(p=2,c=!0):h<128&&(p=1,c=!0)}while(!c);for(var y=p-(s.length-o),i=0;i>8&-39)<<8|87+(r=e[n]>>>4)+(r-10>>8&-39),_+=String.fromCharCode(255&a)+String.fromCharCode(a>>>8);return _}var g={ORIGINAL:1,ORIGINAL_NO_PADDING:3,URLSAFE:5,URLSAFE_NO_PADDING:7};function b(e){if(void 0===e)return g.URLSAFE_NO_PADDING;if(e!==g.ORIGINAL&&e!==g.ORIGINAL_NO_PADDING&&e!==g.URLSAFE&&e!==g.URLSAFE_NO_PADDING)throw new Error("unsupported base64 variant");return e}function f(e,t){t=b(t);var a,_=[],n=new T(3*(e=N(_,e,"input")).length/4),s=w(e),c=Y(4),o=Y(4);return _.push(s),_.push(n.address),_.push(c),_.push(o),0!==r._sodium_base642bin(n.address,n.length,s,e.length,0,c,o,t)&&M(_,"invalid input"),r.getValue(o,"i32")-s!==e.length&&M(_,"incomplete input"),n.length=r.getValue(c,"i32"),a=n.to_Uint8Array(),A(_),a}function m(e,t){t=b(t);var a=[];e=N(a,e,"input");var _,n=0|Math.floor(e.length/3),s=e.length-3*n,c=4*n+(0!==s?2&t?2+(s>>>1):4:0),o=new T(c+1),p=w(e);return a.push(p),a.push(o.address),0===r._sodium_bin2base64(o.address,o.length,p,e.length,t)&&M(a,"conversion failed"),o.length=c,_=u(o.to_Uint8Array()),A(a),_}function x(){return["uint8array","text","hex","base64"]}function E(e,r){var t=r||"uint8array";if(!k(t))throw new Error(t+" output format is not available");if(e instanceof T){if("uint8array"===t)return e.to_Uint8Array();if("text"===t)return u(e.to_Uint8Array());if("hex"===t)return v(e.to_Uint8Array());if("base64"===t)return m(e.to_Uint8Array(),g.URLSAFE_NO_PADDING);throw new Error('What is output format "'+t+'"?')}if("object"==typeof e){for(var a=Object.keys(e),_={},n=0;n=BigInt(0)){const e=t>>BigInt(32);e>BigInt(4294967295)&&I(s,"subkey_id cannot be more than 64 bits"),o=Number(e),c=Number(t&BigInt(4294967295))}else"number"==typeof t&&(0|t)===t&&t>=0?c=t:I(s,"subkey_id must be an unsigned integer or bigint");"string"!=typeof a&&I(s,"ctx must be a string"),(a=l(a+"\0")).length-1!==r._crypto_kdf_contextbytes()&&I(s,"invalid ctx length");var p=w(a);a.length,s.push(p),_=N(s,_,"key");var h,y=0|r._crypto_kdf_keybytes();_.length!==y&&I(s,"invalid key length"),h=w(_),s.push(h);var i=new T(0|e),u=i.address;s.push(u),r._crypto_kdf_derive_from_key(u,e,c,o,p,h);var d=E(i,n);return A(s),d}function $r(e){var t=[];S(e);var a=new T(0|r._crypto_kdf_keybytes()),_=a.address;t.push(_),r._crypto_kdf_keygen(_);var n=E(a,e);return A(t),n}function et(e,t,a,_){var n=[];S(_),e=N(n,e,"clientPublicKey");var s,c=0|r._crypto_kx_publickeybytes();e.length!==c&&I(n,"invalid clientPublicKey length"),s=w(e),n.push(s),t=N(n,t,"clientSecretKey");var o,p=0|r._crypto_kx_secretkeybytes();t.length!==p&&I(n,"invalid clientSecretKey length"),o=w(t),n.push(o),a=N(n,a,"serverPublicKey");var h,y=0|r._crypto_kx_publickeybytes();a.length!==y&&I(n,"invalid serverPublicKey length"),h=w(a),n.push(h);var i=new T(0|r._crypto_kx_sessionkeybytes()),l=i.address;n.push(l);var u=new T(0|r._crypto_kx_sessionkeybytes()),d=u.address;if(n.push(d),!(0|r._crypto_kx_client_session_keys(l,d,s,o,h))){var v=E({sharedRx:i,sharedTx:u},_);return A(n),v}M(n,"invalid usage")}function rt(e){var t=[];S(e);var a=new T(0|r._crypto_kx_publickeybytes()),_=a.address;t.push(_);var n=new T(0|r._crypto_kx_secretkeybytes()),s=n.address;if(t.push(s),!(0|r._crypto_kx_keypair(_,s))){var c={publicKey:E(a,e),privateKey:E(n,e),keyType:"x25519"};return A(t),c}M(t,"internal error")}function tt(e,t){var a=[];S(t),e=N(a,e,"seed");var _,n=0|r._crypto_kx_seedbytes();e.length!==n&&I(a,"invalid seed length"),_=w(e),a.push(_);var s=new T(0|r._crypto_kx_publickeybytes()),c=s.address;a.push(c);var o=new T(0|r._crypto_kx_secretkeybytes()),p=o.address;if(a.push(p),!(0|r._crypto_kx_seed_keypair(c,p,_))){var h={publicKey:E(s,t),privateKey:E(o,t),keyType:"x25519"};return A(a),h}M(a,"internal error")}function at(e,t,a,_){var n=[];S(_),e=N(n,e,"serverPublicKey");var s,c=0|r._crypto_kx_publickeybytes();e.length!==c&&I(n,"invalid serverPublicKey length"),s=w(e),n.push(s),t=N(n,t,"serverSecretKey");var o,p=0|r._crypto_kx_secretkeybytes();t.length!==p&&I(n,"invalid serverSecretKey length"),o=w(t),n.push(o),a=N(n,a,"clientPublicKey");var h,y=0|r._crypto_kx_publickeybytes();a.length!==y&&I(n,"invalid clientPublicKey length"),h=w(a),n.push(h);var i=new T(0|r._crypto_kx_sessionkeybytes()),l=i.address;n.push(l);var u=new T(0|r._crypto_kx_sessionkeybytes()),d=u.address;if(n.push(d),!(0|r._crypto_kx_server_session_keys(l,d,s,o,h))){var v=E({sharedRx:i,sharedTx:u},_);return A(n),v}M(n,"invalid usage")}function _t(e,t,a){var _=[];S(a);var n=w(e=N(_,e,"message")),s=e.length;_.push(n),t=N(_,t,"key");var c,o=0|r._crypto_onetimeauth_keybytes();t.length!==o&&I(_,"invalid key length"),c=w(t),_.push(c);var p=new T(0|r._crypto_onetimeauth_bytes()),h=p.address;if(_.push(h),!(0|r._crypto_onetimeauth(h,n,s,0,c))){var y=E(p,a);return A(_),y}M(_,"invalid usage")}function nt(e,t){var a=[];S(t),K(a,e,"state_address");var _=new T(0|r._crypto_onetimeauth_bytes()),n=_.address;if(a.push(n),!(0|r._crypto_onetimeauth_final(e,n))){var s=(r._free(e),E(_,t));return A(a),s}M(a,"invalid usage")}function st(e,t){var a=[];S(t);var _=null;null!=e&&(_=w(e=N(a,e,"key")),e.length,a.push(_));var n=new T(144).address;if(!(0|r._crypto_onetimeauth_init(n,_))){var s=n;return A(a),s}M(a,"invalid usage")}function ct(e){var t=[];S(e);var a=new T(0|r._crypto_onetimeauth_keybytes()),_=a.address;t.push(_),r._crypto_onetimeauth_keygen(_);var n=E(a,e);return A(t),n}function ot(e,t,a){var _=[];S(a),K(_,e,"state_address");var n=w(t=N(_,t,"message_chunk")),s=t.length;_.push(n),0|r._crypto_onetimeauth_update(e,n,s)&&M(_,"invalid usage"),A(_)}function pt(e,t,a){var _=[];e=N(_,e,"hash");var n,s=0|r._crypto_onetimeauth_bytes();e.length!==s&&I(_,"invalid hash length"),n=w(e),_.push(n);var c=w(t=N(_,t,"message")),o=t.length;_.push(c),a=N(_,a,"key");var p,h=0|r._crypto_onetimeauth_keybytes();a.length!==h&&I(_,"invalid key length"),p=w(a),_.push(p);var y=!(0|r._crypto_onetimeauth_verify(n,c,o,0,p));return A(_),y}function ht(e,t,a,_,n,s,c){var o=[];S(c),K(o,e,"keyLength"),("number"!=typeof e||(0|e)!==e||e<0)&&I(o,"keyLength must be an unsigned integer");var p=w(t=N(o,t,"password")),h=t.length;o.push(p),a=N(o,a,"salt");var y,i=0|r._crypto_pwhash_saltbytes();a.length!==i&&I(o,"invalid salt length"),y=w(a),o.push(y),K(o,_,"opsLimit"),("number"!=typeof _||(0|_)!==_||_<0)&&I(o,"opsLimit must be an unsigned integer"),K(o,n,"memLimit"),("number"!=typeof n||(0|n)!==n||n<0)&&I(o,"memLimit must be an unsigned integer"),K(o,s,"algorithm"),("number"!=typeof s||(0|s)!==s||s<0)&&I(o,"algorithm must be an unsigned integer");var l=new T(0|e),u=l.address;if(o.push(u),!(0|r._crypto_pwhash(u,e,0,p,h,0,y,_,0,n,s))){var d=E(l,c);return A(o),d}M(o,"invalid usage")}function yt(e,t,a,_,n,s){var c=[];S(s),K(c,e,"keyLength"),("number"!=typeof e||(0|e)!==e||e<0)&&I(c,"keyLength must be an unsigned integer");var o=w(t=N(c,t,"password")),p=t.length;c.push(o),a=N(c,a,"salt");var h,y=0|r._crypto_pwhash_scryptsalsa208sha256_saltbytes();a.length!==y&&I(c,"invalid salt length"),h=w(a),c.push(h),K(c,_,"opsLimit"),("number"!=typeof _||(0|_)!==_||_<0)&&I(c,"opsLimit must be an unsigned integer"),K(c,n,"memLimit"),("number"!=typeof n||(0|n)!==n||n<0)&&I(c,"memLimit must be an unsigned integer");var i=new T(0|e),l=i.address;if(c.push(l),!(0|r._crypto_pwhash_scryptsalsa208sha256(l,e,0,o,p,0,h,_,0,n))){var u=E(i,s);return A(c),u}M(c,"invalid usage")}function it(e,t,a,_,n,s,c){var o=[];S(c);var p=w(e=N(o,e,"password")),h=e.length;o.push(p);var y=w(t=N(o,t,"salt")),i=t.length;o.push(y),K(o,a,"opsLimit"),("number"!=typeof a||(0|a)!==a||a<0)&&I(o,"opsLimit must be an unsigned integer"),K(o,_,"r"),("number"!=typeof _||(0|_)!==_||_<0)&&I(o,"r must be an unsigned integer"),K(o,n,"p"),("number"!=typeof n||(0|n)!==n||n<0)&&I(o,"p must be an unsigned integer"),K(o,s,"keyLength"),("number"!=typeof s||(0|s)!==s||s<0)&&I(o,"keyLength must be an unsigned integer");var l=new T(0|s),u=l.address;if(o.push(u),!(0|r._crypto_pwhash_scryptsalsa208sha256_ll(p,h,y,i,a,0,_,n,u,s))){var d=E(l,c);return A(o),d}M(o,"invalid usage")}function lt(e,t,a,_){var n=[];S(_);var s=w(e=N(n,e,"password")),c=e.length;n.push(s),K(n,t,"opsLimit"),("number"!=typeof t||(0|t)!==t||t<0)&&I(n,"opsLimit must be an unsigned integer"),K(n,a,"memLimit"),("number"!=typeof a||(0|a)!==a||a<0)&&I(n,"memLimit must be an unsigned integer");var o=new T(0|r._crypto_pwhash_scryptsalsa208sha256_strbytes()).address;if(n.push(o),!(0|r._crypto_pwhash_scryptsalsa208sha256_str(o,s,c,0,t,0,a))){var p=r.UTF8ToString(o);return A(n),p}M(n,"invalid usage")}function ut(e,t,a){var _=[];S(a),"string"!=typeof e&&I(_,"hashed_password must be a string");var n=w(e=l(e+"\0"));e.length,_.push(n);var s=w(t=N(_,t,"password")),c=t.length;_.push(s);var o=!(0|r._crypto_pwhash_scryptsalsa208sha256_str_verify(n,s,c,0));return A(_),o}function dt(e,t,a,_){var n=[];S(_);var s=w(e=N(n,e,"password")),c=e.length;n.push(s),K(n,t,"opsLimit"),("number"!=typeof t||(0|t)!==t||t<0)&&I(n,"opsLimit must be an unsigned integer"),K(n,a,"memLimit"),("number"!=typeof a||(0|a)!==a||a<0)&&I(n,"memLimit must be an unsigned integer");var o=new T(0|r._crypto_pwhash_strbytes()).address;if(n.push(o),!(0|r._crypto_pwhash_str(o,s,c,0,t,0,a))){var p=r.UTF8ToString(o);return A(n),p}M(n,"invalid usage")}function vt(e,t,a,_){var n=[];S(_),"string"!=typeof e&&I(n,"hashed_password must be a string");var s=w(e=l(e+"\0"));e.length,n.push(s),K(n,t,"opsLimit"),("number"!=typeof t||(0|t)!==t||t<0)&&I(n,"opsLimit must be an unsigned integer"),K(n,a,"memLimit"),("number"!=typeof a||(0|a)!==a||a<0)&&I(n,"memLimit must be an unsigned integer");var c=!!(0|r._crypto_pwhash_str_needs_rehash(s,t,0,a));return A(n),c}function gt(e,t,a){var _=[];S(a),"string"!=typeof e&&I(_,"hashed_password must be a string");var n=w(e=l(e+"\0"));e.length,_.push(n);var s=w(t=N(_,t,"password")),c=t.length;_.push(s);var o=!(0|r._crypto_pwhash_str_verify(n,s,c,0));return A(_),o}function bt(e,t,a){var _=[];S(a),e=N(_,e,"privateKey");var n,s=0|r._crypto_scalarmult_scalarbytes();e.length!==s&&I(_,"invalid privateKey length"),n=w(e),_.push(n),t=N(_,t,"publicKey");var c,o=0|r._crypto_scalarmult_bytes();t.length!==o&&I(_,"invalid publicKey length"),c=w(t),_.push(c);var p=new T(0|r._crypto_scalarmult_bytes()),h=p.address;if(_.push(h),!(0|r._crypto_scalarmult(h,n,c))){var y=E(p,a);return A(_),y}M(_,"weak public key")}function ft(e,t){var a=[];S(t),e=N(a,e,"privateKey");var _,n=0|r._crypto_scalarmult_scalarbytes();e.length!==n&&I(a,"invalid privateKey length"),_=w(e),a.push(_);var s=new T(0|r._crypto_scalarmult_bytes()),c=s.address;if(a.push(c),!(0|r._crypto_scalarmult_base(c,_))){var o=E(s,t);return A(a),o}M(a,"unknown error")}function mt(e,t,a){var _=[];S(a),e=N(_,e,"n");var n,s=0|r._crypto_scalarmult_ed25519_scalarbytes();e.length!==s&&I(_,"invalid n length"),n=w(e),_.push(n),t=N(_,t,"p");var c,o=0|r._crypto_scalarmult_ed25519_bytes();t.length!==o&&I(_,"invalid p length"),c=w(t),_.push(c);var p=new T(0|r._crypto_scalarmult_ed25519_bytes()),h=p.address;if(_.push(h),!(0|r._crypto_scalarmult_ed25519(h,n,c))){var y=E(p,a);return A(_),y}M(_,"invalid point or scalar is 0")}function xt(e,t){var a=[];S(t),e=N(a,e,"scalar");var _,n=0|r._crypto_scalarmult_ed25519_scalarbytes();e.length!==n&&I(a,"invalid scalar length"),_=w(e),a.push(_);var s=new T(0|r._crypto_scalarmult_ed25519_bytes()),c=s.address;if(a.push(c),!(0|r._crypto_scalarmult_ed25519_base(c,_))){var o=E(s,t);return A(a),o}M(a,"scalar is 0")}function Et(e,t){var a=[];S(t),e=N(a,e,"scalar");var _,n=0|r._crypto_scalarmult_ed25519_scalarbytes();e.length!==n&&I(a,"invalid scalar length"),_=w(e),a.push(_);var s=new T(0|r._crypto_scalarmult_ed25519_bytes()),c=s.address;if(a.push(c),!(0|r._crypto_scalarmult_ed25519_base_noclamp(c,_))){var o=E(s,t);return A(a),o}M(a,"scalar is 0")}function kt(e,t,a){var _=[];S(a),e=N(_,e,"n");var n,s=0|r._crypto_scalarmult_ed25519_scalarbytes();e.length!==s&&I(_,"invalid n length"),n=w(e),_.push(n),t=N(_,t,"p");var c,o=0|r._crypto_scalarmult_ed25519_bytes();t.length!==o&&I(_,"invalid p length"),c=w(t),_.push(c);var p=new T(0|r._crypto_scalarmult_ed25519_bytes()),h=p.address;if(_.push(h),!(0|r._crypto_scalarmult_ed25519_noclamp(h,n,c))){var y=E(p,a);return A(_),y}M(_,"invalid point or scalar is 0")}function St(e,t,a){var _=[];S(a),e=N(_,e,"scalar");var n,s=0|r._crypto_scalarmult_ristretto255_scalarbytes();e.length!==s&&I(_,"invalid scalar length"),n=w(e),_.push(n),t=N(_,t,"element");var c,o=0|r._crypto_scalarmult_ristretto255_bytes();t.length!==o&&I(_,"invalid element length"),c=w(t),_.push(c);var p=new T(0|r._crypto_scalarmult_ristretto255_bytes()),h=p.address;if(_.push(h),!(0|r._crypto_scalarmult_ristretto255(h,n,c))){var y=E(p,a);return A(_),y}M(_,"result is identity element")}function Tt(e,t){var a=[];S(t),e=N(a,e,"scalar");var _,n=0|r._crypto_core_ristretto255_scalarbytes();e.length!==n&&I(a,"invalid scalar length"),_=w(e),a.push(_);var s=new T(0|r._crypto_core_ristretto255_bytes()),c=s.address;if(a.push(c),!(0|r._crypto_scalarmult_ristretto255_base(c,_))){var o=E(s,t);return A(a),o}M(a,"scalar is 0")}function wt(e,t,a,_){var n=[];S(_);var s=w(e=N(n,e,"message")),c=e.length;n.push(s),t=N(n,t,"nonce");var o,p=0|r._crypto_secretbox_noncebytes();t.length!==p&&I(n,"invalid nonce length"),o=w(t),n.push(o),a=N(n,a,"key");var h,y=0|r._crypto_secretbox_keybytes();a.length!==y&&I(n,"invalid key length"),h=w(a),n.push(h);var i=new T(0|c),l=i.address;n.push(l);var u=new T(0|r._crypto_secretbox_macbytes()),d=u.address;if(n.push(d),!(0|r._crypto_secretbox_detached(l,d,s,c,0,o,h))){var v=E({mac:u,cipher:i},_);return A(n),v}M(n,"invalid usage")}function Yt(e,t,a,_){var n=[];S(_);var s=w(e=N(n,e,"message")),c=e.length;n.push(s),t=N(n,t,"nonce");var o,p=0|r._crypto_secretbox_noncebytes();t.length!==p&&I(n,"invalid nonce length"),o=w(t),n.push(o),a=N(n,a,"key");var h,y=0|r._crypto_secretbox_keybytes();a.length!==y&&I(n,"invalid key length"),h=w(a),n.push(h);var i=new T(c+r._crypto_secretbox_macbytes()|0),l=i.address;if(n.push(l),!(0|r._crypto_secretbox_easy(l,s,c,0,o,h))){var u=E(i,_);return A(n),u}M(n,"invalid usage")}function Bt(e){var t=[];S(e);var a=new T(0|r._crypto_secretbox_keybytes()),_=a.address;t.push(_),r._crypto_secretbox_keygen(_);var n=E(a,e);return A(t),n}function At(e,t,a,_,n){var s=[];S(n);var c=w(e=N(s,e,"ciphertext")),o=e.length;s.push(c),t=N(s,t,"mac");var p,h=0|r._crypto_secretbox_macbytes();t.length!==h&&I(s,"invalid mac length"),p=w(t),s.push(p),a=N(s,a,"nonce");var y,i=0|r._crypto_secretbox_noncebytes();a.length!==i&&I(s,"invalid nonce length"),y=w(a),s.push(y),_=N(s,_,"key");var l,u=0|r._crypto_secretbox_keybytes();_.length!==u&&I(s,"invalid key length"),l=w(_),s.push(l);var d=new T(0|o),v=d.address;if(s.push(v),!(0|r._crypto_secretbox_open_detached(v,c,p,o,0,y,l))){var g=E(d,n);return A(s),g}M(s,"wrong secret key for the given ciphertext")}function Mt(e,t,a,_){var n=[];S(_),e=N(n,e,"ciphertext");var s,c=r._crypto_secretbox_macbytes(),o=e.length;o>>0;return A([]),t}function La(e,t){var a=[];S(t);for(var _=r._malloc(24),n=0;n<6;n++)r.setValue(_+4*n,r.Runtime.addFunction(e[["implementation_name","random","stir","uniform","buf","close"][n]]),"i32");0|r._randombytes_set_implementation(_)&&M(a,"unsupported implementation"),A(a)}function Oa(e){S(e),r._randombytes_stir()}function Ua(e,t){var a=[];S(t),K(a,e,"upper_bound"),("number"!=typeof e||(0|e)!==e||e<0)&&I(a,"upper_bound must be an unsigned integer");var _=r._randombytes_uniform(e)>>>0;return A(a),_}function Pa(e){var t,a=[];16!==(e=N(a,e,"bin")).length&&I(a,"invalid bin length"),t=w(e),a.push(t);var _=new T(46).address;if(a.push(_),0!==r._sodium_bin2ip(_,46,t)){var n=r.UTF8ToString(_);return A(a),n}M(a,"conversion failed")}function Ca(e,t){var a=[];S(t),"string"!=typeof e&&I(a,"ip must be a string");var _=w(e=l(e+"\0")),n=e.length-1;a.push(_);var s=new T(16),c=s.address;if(a.push(c),!(0|r._sodium_ip2bin(c,_,n))){var o=E(s,t);return A(a),o}M(a,"invalid IP address")}function Ra(){var e=r._sodium_version_string(),t=r.UTF8ToString(e);return A([]),t}T.prototype.to_Uint8Array=function(){var e=new Uint8Array(this.length);return e.set(r.HEAPU8.subarray(this.address,this.address+this.length)),e},t.add=s,t.base64_variants=g,t.compare=h,t.from_base64=f,t.from_hex=d,t.from_string=l,t.increment=n,t.is_zero=c,t.libsodium=e,t.memcmp=p,t.memzero=o,t.output_formats=x,t.pad=y,t.unpad=i,t.ready=a,t.symbols=_,t.to_base64=m,t.to_hex=v,t.to_string=u;export default t;export{a as ready,s as add,h as compare,f as from_base64,d as from_hex,l as from_string,n as increment,c as is_zero,p as memcmp,o as memzero,y as pad,i as unpad,_ as symbols,m as to_base64,v as to_hex,u as to_string,x as output_formats,g as base64_variants,e as libsodium};