!function(e){function r(e,r){"use strict";var t,a=r.ready.then(function(){function a(){if(t._sodium_init()<0)throw new Error("libsodium was not correctly initialized.");for(var r=["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=[E,k,S,T,w,Y,B,A,M,I,K,N,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,ue,le,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,ur,lr,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,ut,lt,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,ua,la,da,va,ga,ba,fa,ma,xa,Ea,ka,Sa,Ta,wa,Ya],_=0;_=240?(h=4,o=!0):y>=224?(h=3,o=!0):y>=192?(h=2,o=!0):y<128&&(h=1,o=!0)}while(!o);for(var i=h-(c.length-p),u=0;u>8&-39)<<8|87+(r=e[n]>>>4)+(r-10>>8&-39),_+=String.fromCharCode(255&a)+String.fromCharCode(a>>>8);return _}var c={ORIGINAL:1,ORIGINAL_NO_PADDING:3,URLSAFE:5,URLSAFE_NO_PADDING:7};function o(e){if(void 0===e)return c.URLSAFE_NO_PADDING;if(e!==c.ORIGINAL&&e!==c.ORIGINAL_NO_PADDING&&e!==c.URLSAFE&&e!==c.URLSAFE_NO_PADDING)throw new Error("unsupported base64 variant");return e}function p(e,r){r=o(r);var a=[];e=x(a,e,"input");var _,s=0|Math.floor(e.length/3),c=e.length-3*s,p=4*s+(0!==c?2&r?2+(c>>>1):4:0),h=new u(p+1),y=l(e);return a.push(y),a.push(h.address),0===t._sodium_bin2base64(h.address,h.length,y,e.length,r)&&b(a,"conversion failed"),h.length=p,_=n(h.to_Uint8Array()),g(a),_}function h(e,r){var t=r||"uint8array";if(!y(t))throw new Error(t+" output format is not available");if(e instanceof u){if("uint8array"===t)return e.to_Uint8Array();if("text"===t)return n(e.to_Uint8Array());if("hex"===t)return s(e.to_Uint8Array());if("base64"===t)return p(e.to_Uint8Array(),c.URLSAFE_NO_PADDING);throw new Error('What is output format "'+t+'"?')}if("object"==typeof e){for(var a=Object.keys(e),_={},o=0;o=BigInt(0)){const e=r>>BigInt(32);e>BigInt(4294967295)&&f(c,"subkey_id cannot be more than 64 bits"),p=Number(e),o=Number(r&BigInt(4294967295))}else"number"==typeof r&&(0|r)===r&&r>=0?o=r:f(c,"subkey_id must be an unsigned integer or bigint");"string"!=typeof a&&f(c,"ctx must be a string"),(a=_(a+"\0")).length-1!==t._crypto_kdf_contextbytes()&&f(c,"invalid ctx length");var y=l(a);a.length,c.push(y),n=x(c,n,"key");var d,v=0|t._crypto_kdf_keybytes();n.length!==v&&f(c,"invalid key length"),d=l(n),c.push(d);var b=new u(0|e),E=b.address;c.push(E),t._crypto_kdf_derive_from_key(E,e,o,p,y,d);var k=h(b,s);return g(c),k}function Dr(e){var r=[];i(e);var a=new u(0|t._crypto_kdf_keybytes()),_=a.address;r.push(_),t._crypto_kdf_keygen(_);var n=h(a,e);return g(r),n}function Gr(e,r,a,_){var n=[];i(_),e=x(n,e,"clientPublicKey");var s,c=0|t._crypto_kx_publickeybytes();e.length!==c&&f(n,"invalid clientPublicKey length"),s=l(e),n.push(s),r=x(n,r,"clientSecretKey");var o,p=0|t._crypto_kx_secretkeybytes();r.length!==p&&f(n,"invalid clientSecretKey length"),o=l(r),n.push(o),a=x(n,a,"serverPublicKey");var y,d=0|t._crypto_kx_publickeybytes();a.length!==d&&f(n,"invalid serverPublicKey length"),y=l(a),n.push(y);var v=new u(0|t._crypto_kx_sessionkeybytes()),m=v.address;n.push(m);var E=new u(0|t._crypto_kx_sessionkeybytes()),k=E.address;if(n.push(k),!(0|t._crypto_kx_client_session_keys(m,k,s,o,y))){var S=h({sharedRx:v,sharedTx:E},_);return g(n),S}b(n,"invalid usage")}function Fr(e){var r=[];i(e);var a=new u(0|t._crypto_kx_publickeybytes()),_=a.address;r.push(_);var n=new u(0|t._crypto_kx_secretkeybytes()),s=n.address;if(r.push(s),!(0|t._crypto_kx_keypair(_,s))){var c={publicKey:h(a,e),privateKey:h(n,e),keyType:"x25519"};return g(r),c}b(r,"internal error")}function Vr(e,r){var a=[];i(r),e=x(a,e,"seed");var _,n=0|t._crypto_kx_seedbytes();e.length!==n&&f(a,"invalid seed length"),_=l(e),a.push(_);var s=new u(0|t._crypto_kx_publickeybytes()),c=s.address;a.push(c);var o=new u(0|t._crypto_kx_secretkeybytes()),p=o.address;if(a.push(p),!(0|t._crypto_kx_seed_keypair(c,p,_))){var y={publicKey:h(s,r),privateKey:h(o,r),keyType:"x25519"};return g(a),y}b(a,"internal error")}function qr(e,r,a,_){var n=[];i(_),e=x(n,e,"serverPublicKey");var s,c=0|t._crypto_kx_publickeybytes();e.length!==c&&f(n,"invalid serverPublicKey length"),s=l(e),n.push(s),r=x(n,r,"serverSecretKey");var o,p=0|t._crypto_kx_secretkeybytes();r.length!==p&&f(n,"invalid serverSecretKey length"),o=l(r),n.push(o),a=x(n,a,"clientPublicKey");var y,d=0|t._crypto_kx_publickeybytes();a.length!==d&&f(n,"invalid clientPublicKey length"),y=l(a),n.push(y);var v=new u(0|t._crypto_kx_sessionkeybytes()),m=v.address;n.push(m);var E=new u(0|t._crypto_kx_sessionkeybytes()),k=E.address;if(n.push(k),!(0|t._crypto_kx_server_session_keys(m,k,s,o,y))){var S=h({sharedRx:v,sharedTx:E},_);return g(n),S}b(n,"invalid usage")}function zr(e,r,a){var _=[];i(a);var n=l(e=x(_,e,"message")),s=e.length;_.push(n),r=x(_,r,"key");var c,o=0|t._crypto_onetimeauth_keybytes();r.length!==o&&f(_,"invalid key length"),c=l(r),_.push(c);var p=new u(0|t._crypto_onetimeauth_bytes()),y=p.address;if(_.push(y),!(0|t._crypto_onetimeauth(y,n,s,0,c))){var d=h(p,a);return g(_),d}b(_,"invalid usage")}function Wr(e,r){var a=[];i(r),m(a,e,"state_address");var _=new u(0|t._crypto_onetimeauth_bytes()),n=_.address;if(a.push(n),!(0|t._crypto_onetimeauth_final(e,n))){var s=(t._free(e),h(_,r));return g(a),s}b(a,"invalid usage")}function Hr(e,r){var a=[];i(r);var _=null;null!=e&&(_=l(e=x(a,e,"key")),e.length,a.push(_));var n=new u(144).address;if(!(0|t._crypto_onetimeauth_init(n,_))){var s=n;return g(a),s}b(a,"invalid usage")}function jr(e){var r=[];i(e);var a=new u(0|t._crypto_onetimeauth_keybytes()),_=a.address;r.push(_),t._crypto_onetimeauth_keygen(_);var n=h(a,e);return g(r),n}function Jr(e,r,a){var _=[];i(a),m(_,e,"state_address");var n=l(r=x(_,r,"message_chunk")),s=r.length;_.push(n),0|t._crypto_onetimeauth_update(e,n,s)&&b(_,"invalid usage"),g(_)}function Qr(e,r,a){var _=[];e=x(_,e,"hash");var n,s=0|t._crypto_onetimeauth_bytes();e.length!==s&&f(_,"invalid hash length"),n=l(e),_.push(n);var c=l(r=x(_,r,"message")),o=r.length;_.push(c),a=x(_,a,"key");var p,h=0|t._crypto_onetimeauth_keybytes();a.length!==h&&f(_,"invalid key length"),p=l(a),_.push(p);var y=!(0|t._crypto_onetimeauth_verify(n,c,o,0,p));return g(_),y}function Zr(e,r,a,_,n,s,c){var o=[];i(c),m(o,e,"keyLength"),("number"!=typeof e||(0|e)!==e||e<0)&&f(o,"keyLength must be an unsigned integer");var p=l(r=x(o,r,"password")),y=r.length;o.push(p),a=x(o,a,"salt");var d,v=0|t._crypto_pwhash_saltbytes();a.length!==v&&f(o,"invalid salt length"),d=l(a),o.push(d),m(o,_,"opsLimit"),("number"!=typeof _||(0|_)!==_||_<0)&&f(o,"opsLimit must be an unsigned integer"),m(o,n,"memLimit"),("number"!=typeof n||(0|n)!==n||n<0)&&f(o,"memLimit must be an unsigned integer"),m(o,s,"algorithm"),("number"!=typeof s||(0|s)!==s||s<0)&&f(o,"algorithm must be an unsigned integer");var E=new u(0|e),k=E.address;if(o.push(k),!(0|t._crypto_pwhash(k,e,0,p,y,0,d,_,0,n,s))){var S=h(E,c);return g(o),S}b(o,"invalid usage")}function $r(e,r,a,_,n,s){var c=[];i(s),m(c,e,"keyLength"),("number"!=typeof e||(0|e)!==e||e<0)&&f(c,"keyLength must be an unsigned integer");var o=l(r=x(c,r,"password")),p=r.length;c.push(o),a=x(c,a,"salt");var y,d=0|t._crypto_pwhash_scryptsalsa208sha256_saltbytes();a.length!==d&&f(c,"invalid salt length"),y=l(a),c.push(y),m(c,_,"opsLimit"),("number"!=typeof _||(0|_)!==_||_<0)&&f(c,"opsLimit must be an unsigned integer"),m(c,n,"memLimit"),("number"!=typeof n||(0|n)!==n||n<0)&&f(c,"memLimit must be an unsigned integer");var v=new u(0|e),E=v.address;if(c.push(E),!(0|t._crypto_pwhash_scryptsalsa208sha256(E,e,0,o,p,0,y,_,0,n))){var k=h(v,s);return g(c),k}b(c,"invalid usage")}function et(e,r,a,_,n,s,c){var o=[];i(c);var p=l(e=x(o,e,"password")),y=e.length;o.push(p);var d=l(r=x(o,r,"salt")),v=r.length;o.push(d),m(o,a,"opsLimit"),("number"!=typeof a||(0|a)!==a||a<0)&&f(o,"opsLimit must be an unsigned integer"),m(o,_,"r"),("number"!=typeof _||(0|_)!==_||_<0)&&f(o,"r must be an unsigned integer"),m(o,n,"p"),("number"!=typeof n||(0|n)!==n||n<0)&&f(o,"p must be an unsigned integer"),m(o,s,"keyLength"),("number"!=typeof s||(0|s)!==s||s<0)&&f(o,"keyLength must be an unsigned integer");var E=new u(0|s),k=E.address;if(o.push(k),!(0|t._crypto_pwhash_scryptsalsa208sha256_ll(p,y,d,v,a,0,_,n,k,s))){var S=h(E,c);return g(o),S}b(o,"invalid usage")}function rt(e,r,a,_){var n=[];i(_);var s=l(e=x(n,e,"password")),c=e.length;n.push(s),m(n,r,"opsLimit"),("number"!=typeof r||(0|r)!==r||r<0)&&f(n,"opsLimit must be an unsigned integer"),m(n,a,"memLimit"),("number"!=typeof a||(0|a)!==a||a<0)&&f(n,"memLimit must be an unsigned integer");var o=new u(0|t._crypto_pwhash_scryptsalsa208sha256_strbytes()).address;if(n.push(o),!(0|t._crypto_pwhash_scryptsalsa208sha256_str(o,s,c,0,r,0,a))){var p=t.UTF8ToString(o);return g(n),p}b(n,"invalid usage")}function tt(e,r,a){var n=[];i(a),"string"!=typeof e&&f(n,"hashed_password must be a string");var s=l(e=_(e+"\0"));e.length,n.push(s);var c=l(r=x(n,r,"password")),o=r.length;n.push(c);var p=!(0|t._crypto_pwhash_scryptsalsa208sha256_str_verify(s,c,o,0));return g(n),p}function at(e,r,a,_){var n=[];i(_);var s=l(e=x(n,e,"password")),c=e.length;n.push(s),m(n,r,"opsLimit"),("number"!=typeof r||(0|r)!==r||r<0)&&f(n,"opsLimit must be an unsigned integer"),m(n,a,"memLimit"),("number"!=typeof a||(0|a)!==a||a<0)&&f(n,"memLimit must be an unsigned integer");var o=new u(0|t._crypto_pwhash_strbytes()).address;if(n.push(o),!(0|t._crypto_pwhash_str(o,s,c,0,r,0,a))){var p=t.UTF8ToString(o);return g(n),p}b(n,"invalid usage")}function _t(e,r,a,n){var s=[];i(n),"string"!=typeof e&&f(s,"hashed_password must be a string");var c=l(e=_(e+"\0"));e.length,s.push(c),m(s,r,"opsLimit"),("number"!=typeof r||(0|r)!==r||r<0)&&f(s,"opsLimit must be an unsigned integer"),m(s,a,"memLimit"),("number"!=typeof a||(0|a)!==a||a<0)&&f(s,"memLimit must be an unsigned integer");var o=!!(0|t._crypto_pwhash_str_needs_rehash(c,r,0,a));return g(s),o}function nt(e,r,a){var n=[];i(a),"string"!=typeof e&&f(n,"hashed_password must be a string");var s=l(e=_(e+"\0"));e.length,n.push(s);var c=l(r=x(n,r,"password")),o=r.length;n.push(c);var p=!(0|t._crypto_pwhash_str_verify(s,c,o,0));return g(n),p}function st(e,r,a){var _=[];i(a),e=x(_,e,"privateKey");var n,s=0|t._crypto_scalarmult_scalarbytes();e.length!==s&&f(_,"invalid privateKey length"),n=l(e),_.push(n),r=x(_,r,"publicKey");var c,o=0|t._crypto_scalarmult_bytes();r.length!==o&&f(_,"invalid publicKey length"),c=l(r),_.push(c);var p=new u(0|t._crypto_scalarmult_bytes()),y=p.address;if(_.push(y),!(0|t._crypto_scalarmult(y,n,c))){var d=h(p,a);return g(_),d}b(_,"weak public key")}function ct(e,r){var a=[];i(r),e=x(a,e,"privateKey");var _,n=0|t._crypto_scalarmult_scalarbytes();e.length!==n&&f(a,"invalid privateKey length"),_=l(e),a.push(_);var s=new u(0|t._crypto_scalarmult_bytes()),c=s.address;if(a.push(c),!(0|t._crypto_scalarmult_base(c,_))){var o=h(s,r);return g(a),o}b(a,"unknown error")}function ot(e,r,a){var _=[];i(a),e=x(_,e,"n");var n,s=0|t._crypto_scalarmult_ed25519_scalarbytes();e.length!==s&&f(_,"invalid n length"),n=l(e),_.push(n),r=x(_,r,"p");var c,o=0|t._crypto_scalarmult_ed25519_bytes();r.length!==o&&f(_,"invalid p length"),c=l(r),_.push(c);var p=new u(0|t._crypto_scalarmult_ed25519_bytes()),y=p.address;if(_.push(y),!(0|t._crypto_scalarmult_ed25519(y,n,c))){var d=h(p,a);return g(_),d}b(_,"invalid point or scalar is 0")}function pt(e,r){var a=[];i(r),e=x(a,e,"scalar");var _,n=0|t._crypto_scalarmult_ed25519_scalarbytes();e.length!==n&&f(a,"invalid scalar length"),_=l(e),a.push(_);var s=new u(0|t._crypto_scalarmult_ed25519_bytes()),c=s.address;if(a.push(c),!(0|t._crypto_scalarmult_ed25519_base(c,_))){var o=h(s,r);return g(a),o}b(a,"scalar is 0")}function ht(e,r){var a=[];i(r),e=x(a,e,"scalar");var _,n=0|t._crypto_scalarmult_ed25519_scalarbytes();e.length!==n&&f(a,"invalid scalar length"),_=l(e),a.push(_);var s=new u(0|t._crypto_scalarmult_ed25519_bytes()),c=s.address;if(a.push(c),!(0|t._crypto_scalarmult_ed25519_base_noclamp(c,_))){var o=h(s,r);return g(a),o}b(a,"scalar is 0")}function yt(e,r,a){var _=[];i(a),e=x(_,e,"n");var n,s=0|t._crypto_scalarmult_ed25519_scalarbytes();e.length!==s&&f(_,"invalid n length"),n=l(e),_.push(n),r=x(_,r,"p");var c,o=0|t._crypto_scalarmult_ed25519_bytes();r.length!==o&&f(_,"invalid p length"),c=l(r),_.push(c);var p=new u(0|t._crypto_scalarmult_ed25519_bytes()),y=p.address;if(_.push(y),!(0|t._crypto_scalarmult_ed25519_noclamp(y,n,c))){var d=h(p,a);return g(_),d}b(_,"invalid point or scalar is 0")}function it(e,r,a){var _=[];i(a),e=x(_,e,"scalar");var n,s=0|t._crypto_scalarmult_ristretto255_scalarbytes();e.length!==s&&f(_,"invalid scalar length"),n=l(e),_.push(n),r=x(_,r,"element");var c,o=0|t._crypto_scalarmult_ristretto255_bytes();r.length!==o&&f(_,"invalid element length"),c=l(r),_.push(c);var p=new u(0|t._crypto_scalarmult_ristretto255_bytes()),y=p.address;if(_.push(y),!(0|t._crypto_scalarmult_ristretto255(y,n,c))){var d=h(p,a);return g(_),d}b(_,"result is identity element")}function ut(e,r){var a=[];i(r),e=x(a,e,"scalar");var _,n=0|t._crypto_core_ristretto255_scalarbytes();e.length!==n&&f(a,"invalid scalar length"),_=l(e),a.push(_);var s=new u(0|t._crypto_core_ristretto255_bytes()),c=s.address;if(a.push(c),!(0|t._crypto_scalarmult_ristretto255_base(c,_))){var o=h(s,r);return g(a),o}b(a,"scalar is 0")}function lt(e,r,a,_){var n=[];i(_);var s=l(e=x(n,e,"message")),c=e.length;n.push(s),r=x(n,r,"nonce");var o,p=0|t._crypto_secretbox_noncebytes();r.length!==p&&f(n,"invalid nonce length"),o=l(r),n.push(o),a=x(n,a,"key");var y,d=0|t._crypto_secretbox_keybytes();a.length!==d&&f(n,"invalid key length"),y=l(a),n.push(y);var v=new u(0|c),m=v.address;n.push(m);var E=new u(0|t._crypto_secretbox_macbytes()),k=E.address;if(n.push(k),!(0|t._crypto_secretbox_detached(m,k,s,c,0,o,y))){var S=h({mac:E,cipher:v},_);return g(n),S}b(n,"invalid usage")}function dt(e,r,a,_){var n=[];i(_);var s=l(e=x(n,e,"message")),c=e.length;n.push(s),r=x(n,r,"nonce");var o,p=0|t._crypto_secretbox_noncebytes();r.length!==p&&f(n,"invalid nonce length"),o=l(r),n.push(o),a=x(n,a,"key");var y,d=0|t._crypto_secretbox_keybytes();a.length!==d&&f(n,"invalid key length"),y=l(a),n.push(y);var v=new u(c+t._crypto_secretbox_macbytes()|0),m=v.address;if(n.push(m),!(0|t._crypto_secretbox_easy(m,s,c,0,o,y))){var E=h(v,_);return g(n),E}b(n,"invalid usage")}function vt(e){var r=[];i(e);var a=new u(0|t._crypto_secretbox_keybytes()),_=a.address;r.push(_),t._crypto_secretbox_keygen(_);var n=h(a,e);return g(r),n}function gt(e,r,a,_,n){var s=[];i(n);var c=l(e=x(s,e,"ciphertext")),o=e.length;s.push(c),r=x(s,r,"mac");var p,y=0|t._crypto_secretbox_macbytes();r.length!==y&&f(s,"invalid mac length"),p=l(r),s.push(p),a=x(s,a,"nonce");var d,v=0|t._crypto_secretbox_noncebytes();a.length!==v&&f(s,"invalid nonce length"),d=l(a),s.push(d),_=x(s,_,"key");var m,E=0|t._crypto_secretbox_keybytes();_.length!==E&&f(s,"invalid key length"),m=l(_),s.push(m);var k=new u(0|o),S=k.address;if(s.push(S),!(0|t._crypto_secretbox_open_detached(S,c,p,o,0,d,m))){var T=h(k,n);return g(s),T}b(s,"wrong secret key for the given ciphertext")}function bt(e,r,a,_){var n=[];i(_),e=x(n,e,"ciphertext");var s,c=t._crypto_secretbox_macbytes(),o=e.length;o>>0;return g([]),r}function Ea(e,r){var a=[];i(r);for(var _=t._malloc(24),n=0;n<6;n++)t.setValue(_+4*n,t.Runtime.addFunction(e[["implementation_name","random","stir","uniform","buf","close"][n]]),"i32");0|t._randombytes_set_implementation(_)&&b(a,"unsupported implementation"),g(a)}function ka(e){i(e),t._randombytes_stir()}function Sa(e,r){var a=[];i(r),m(a,e,"upper_bound"),("number"!=typeof e||(0|e)!==e||e<0)&&f(a,"upper_bound must be an unsigned integer");var _=t._randombytes_uniform(e)>>>0;return g(a),_}function Ta(e){var r,a=[];16!==(e=x(a,e,"bin")).length&&f(a,"invalid bin length"),r=l(e),a.push(r);var _=new u(46).address;if(a.push(_),0!==t._sodium_bin2ip(_,46,r)){var n=t.UTF8ToString(_);return g(a),n}b(a,"conversion failed")}function wa(e,r){var a=[];i(r),"string"!=typeof e&&f(a,"ip must be a string");var n=l(e=_(e+"\0")),s=e.length-1;a.push(n);var c=new u(16),o=c.address;if(a.push(o),!(0|t._sodium_ip2bin(o,n,s))){var p=h(c,r);return g(a),p}b(a,"invalid IP address")}function Ya(){var e=t._sodium_version_string(),r=t.UTF8ToString(e);return g([]),r}return u.prototype.to_Uint8Array=function(){var e=new Uint8Array(this.length);return e.set(t.HEAPU8.subarray(this.address,this.address+this.length)),e},e.add=function(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},e.base64_variants=c,e.compare=function(e,r){if(!(e instanceof Uint8Array&&r instanceof Uint8Array))throw new TypeError("Only Uint8Array instances can be compared");if(e.length!==r.length)throw new TypeError("Only instances of identical length can be compared");for(var t=0,a=1,_=e.length;_-- >0;)t|=r[_]-e[_]>>8&a,a&=(r[_]^e[_])-1>>8;return t+t+a-1},e.from_base64=function(e,r){r=o(r);var a,_=[],n=new u(3*(e=x(_,e,"input")).length/4),s=l(e),c=d(4),p=d(4);return _.push(s),_.push(n.address),_.push(c),_.push(p),0!==t._sodium_base642bin(n.address,n.length,s,e.length,0,c,p,r)&&b(_,"invalid input"),t.getValue(p,"i32")-s!==e.length&&b(_,"incomplete input"),n.length=t.getValue(c,"i32"),a=n.to_Uint8Array(),g(_),a},e.from_hex=function(e){var r,a=[],_=new u((e=x(a,e,"input")).length/2),n=l(e),s=d(4);return a.push(n),a.push(_.address),a.push(s),0!==t._sodium_hex2bin(_.address,_.length,n,e.length,0,0,s)&&b(a,"invalid input"),t.getValue(s,"i32")-n!==e.length&&b(a,"incomplete input"),r=_.to_Uint8Array(),g(a),r},e.from_string=_,e.increment=function(e){if(!(e instanceof Uint8Array))throw new TypeError("Only Uint8Array instances can be incremented");for(var r=256,t=0,a=e.length;t>=8,r+=e[t],e[t]=255&r},e.is_zero=function(e){if(!(e instanceof Uint8Array))throw new TypeError("Only Uint8Array instances can be checked");for(var r=0,t=0,a=e.length;t 0");var a,_=[],n=d(4),s=1,c=0,o=0|e.length,p=new u(o+r);_.push(n),_.push(p.address);for(var h=p.address,y=p.address+o+r;h>>48|o>>>32|o>>>16|o))-1>>16);return 0!==t._sodium_pad(n,p.address,e.length,r,p.length)&&b(_,"internal error"),p.length=t.getValue(n,"i32"),a=p.to_Uint8Array(),g(_),a},e.unpad=function(e,r){if(!(e instanceof Uint8Array))throw new TypeError("buffer must be a Uint8Array");if((r|=0)<=0)throw new Error("block size must be > 0");var a=[],_=l(e),n=d(4);return a.push(_),a.push(n),0!==t._sodium_unpad(n,_,e.length,r)&&b(a,"unsupported/invalid padding"),e=(e=new Uint8Array(e)).subarray(0,t.getValue(n,"i32")),g(a),e},e.ready=a,e.symbols=function(){return Object.keys(e).sort()},e.to_base64=p,e.to_hex=s,e.to_string=n,e}var t="object"==typeof e.sodium&&"function"==typeof e.sodium.onload?e.sodium.onload:null;"function"==typeof define&&define.amd?define(["exports","libsodium"],r):"object"==typeof exports&&"string"!=typeof exports.nodeName?r(exports,require("libsodium")):e.sodium=r(e.commonJsStrict={},e.libsodium),t&&e.sodium.ready.then(function(){t(e.sodium)})}(this);