!function(e){function r(e,r){"use strict";var a,t=r.ready.then(function(){function t(){if(a._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_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","randombytes_buf","randombytes_buf_deterministic","randombytes_close","randombytes_random","randombytes_set_implementation","randombytes_stir","randombytes_uniform","sodium_version_string"],t=[x,k,S,T,w,Y,B,A,M,I,K,N,L,O,U,C,P,R,X,G,D,F,V,H,W,q,j,z,J,Q,Z,$,ee,re,ae,te,_e,ne,se,ce,oe,he,pe,ye,ie,le,ue,de,ve,ge,be,fe,me,Ee,xe,ke,Se,Te,we,Ye,Be,Ae,Me,Ie,Ke,Ne,Le,Oe,Ue,Ce,Pe,Re,Xe,Ge,De,Fe,Ve,He,We,qe,je,ze,Je,Qe,Ze,$e,er,rr,ar,tr,_r,nr,sr,cr,or,hr,pr,yr,ir,lr,ur,dr,vr,gr,br,fr,mr,Er,xr,kr,Sr,Tr,wr,Yr,Br,Ar,Mr,Ir,Kr,Nr,Lr,Or,Ur,Cr,Pr,Rr,Xr,Gr,Dr,Fr,Vr,Hr,Wr,qr,jr,zr,Jr,Qr,Zr,$r,ea,ra,aa,ta,_a,na,sa,ca,oa,ha,pa,ya,ia,la,ua,da,va,ga,ba,fa,ma,Ea,xa,ka,Sa,Ta,wa,Ya,Ba,Aa,Ma,Ia,Ka,Na,La,Oa,Ua,Ca,Pa,Ra,Xa,Ga,Da,Fa,Va,Ha,Wa,qa],_=0;_=240?(p=4,o=!0):y>=224?(p=3,o=!0):y>=192?(p=2,o=!0):y<128&&(p=1,o=!0)}while(!o);for(var i=p-(c.length-h),l=0;l>8&-39)<<8|87+(r=e[n]>>>4)+(r-10>>8&-39),_+=String.fromCharCode(255&t)+String.fromCharCode(t>>>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 h(e,r){r=o(r);var t=[];e=E(t,e,"input");var _,s=0|Math.floor(e.length/3),c=e.length-3*s,h=4*s+(0!==c?2&r?2+(c>>>1):4:0),p=new l(h+1),y=u(e);return t.push(y),t.push(p.address),0===a._sodium_bin2base64(p.address,p.length,y,e.length,r)&&b(t,"conversion failed"),p.length=h,_=n(p.to_Uint8Array()),g(t),_}function p(e,r){var a=r||"uint8array";if(!y(a))throw new Error(a+" output format is not available");if(e instanceof l){if("uint8array"===a)return e.to_Uint8Array();if("text"===a)return n(e.to_Uint8Array());if("hex"===a)return s(e.to_Uint8Array());if("base64"===a)return h(e.to_Uint8Array(),c.URLSAFE_NO_PADDING);throw new Error('What is output format "'+a+'"?')}if("object"==typeof e){for(var t=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"),h=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 t&&f(c,"ctx must be a string"),(t=_(t+"\0")).length-1!==a._crypto_kdf_contextbytes()&&f(c,"invalid ctx length");var y=u(t);t.length,c.push(y),n=E(c,n,"key");var d,v=0|a._crypto_kdf_keybytes();n.length!==v&&f(c,"invalid key length"),d=u(n),c.push(d);var b=new l(0|e),x=b.address;c.push(x),a._crypto_kdf_derive_from_key(x,e,o,h,y,d);var k=p(b,s);return g(c),k}function Ar(e){var r=[];i(e);var t=new l(0|a._crypto_kdf_keybytes()),_=t.address;r.push(_),a._crypto_kdf_keygen(_);var n=p(t,e);return g(r),n}function Mr(e,r,t,_){var n=[];i(_),e=E(n,e,"clientPublicKey");var s,c=0|a._crypto_kx_publickeybytes();e.length!==c&&f(n,"invalid clientPublicKey length"),s=u(e),n.push(s),r=E(n,r,"clientSecretKey");var o,h=0|a._crypto_kx_secretkeybytes();r.length!==h&&f(n,"invalid clientSecretKey length"),o=u(r),n.push(o),t=E(n,t,"serverPublicKey");var y,d=0|a._crypto_kx_publickeybytes();t.length!==d&&f(n,"invalid serverPublicKey length"),y=u(t),n.push(y);var v=new l(0|a._crypto_kx_sessionkeybytes()),m=v.address;n.push(m);var x=new l(0|a._crypto_kx_sessionkeybytes()),k=x.address;if(n.push(k),!(0|a._crypto_kx_client_session_keys(m,k,s,o,y))){var S=p({sharedRx:v,sharedTx:x},_);return g(n),S}b(n,"invalid usage")}function Ir(e){var r=[];i(e);var t=new l(0|a._crypto_kx_publickeybytes()),_=t.address;r.push(_);var n=new l(0|a._crypto_kx_secretkeybytes()),s=n.address;if(r.push(s),!(0|a._crypto_kx_keypair(_,s))){var c={publicKey:p(t,e),privateKey:p(n,e),keyType:"x25519"};return g(r),c}b(r,"internal error")}function Kr(e,r){var t=[];i(r),e=E(t,e,"seed");var _,n=0|a._crypto_kx_seedbytes();e.length!==n&&f(t,"invalid seed length"),_=u(e),t.push(_);var s=new l(0|a._crypto_kx_publickeybytes()),c=s.address;t.push(c);var o=new l(0|a._crypto_kx_secretkeybytes()),h=o.address;if(t.push(h),!(0|a._crypto_kx_seed_keypair(c,h,_))){var y={publicKey:p(s,r),privateKey:p(o,r),keyType:"x25519"};return g(t),y}b(t,"internal error")}function Nr(e,r,t,_){var n=[];i(_),e=E(n,e,"serverPublicKey");var s,c=0|a._crypto_kx_publickeybytes();e.length!==c&&f(n,"invalid serverPublicKey length"),s=u(e),n.push(s),r=E(n,r,"serverSecretKey");var o,h=0|a._crypto_kx_secretkeybytes();r.length!==h&&f(n,"invalid serverSecretKey length"),o=u(r),n.push(o),t=E(n,t,"clientPublicKey");var y,d=0|a._crypto_kx_publickeybytes();t.length!==d&&f(n,"invalid clientPublicKey length"),y=u(t),n.push(y);var v=new l(0|a._crypto_kx_sessionkeybytes()),m=v.address;n.push(m);var x=new l(0|a._crypto_kx_sessionkeybytes()),k=x.address;if(n.push(k),!(0|a._crypto_kx_server_session_keys(m,k,s,o,y))){var S=p({sharedRx:v,sharedTx:x},_);return g(n),S}b(n,"invalid usage")}function Lr(e,r,t){var _=[];i(t);var n=u(e=E(_,e,"message")),s=e.length;_.push(n),r=E(_,r,"key");var c,o=0|a._crypto_onetimeauth_keybytes();r.length!==o&&f(_,"invalid key length"),c=u(r),_.push(c);var h=new l(0|a._crypto_onetimeauth_bytes()),y=h.address;if(_.push(y),!(0|a._crypto_onetimeauth(y,n,s,0,c))){var d=p(h,t);return g(_),d}b(_,"invalid usage")}function Or(e,r){var t=[];i(r),m(t,e,"state_address");var _=new l(0|a._crypto_onetimeauth_bytes()),n=_.address;if(t.push(n),!(0|a._crypto_onetimeauth_final(e,n))){var s=(a._free(e),p(_,r));return g(t),s}b(t,"invalid usage")}function Ur(e,r){var t=[];i(r);var _=null;null!=e&&(_=u(e=E(t,e,"key")),e.length,t.push(_));var n=new l(144).address;if(!(0|a._crypto_onetimeauth_init(n,_))){var s=n;return g(t),s}b(t,"invalid usage")}function Cr(e){var r=[];i(e);var t=new l(0|a._crypto_onetimeauth_keybytes()),_=t.address;r.push(_),a._crypto_onetimeauth_keygen(_);var n=p(t,e);return g(r),n}function Pr(e,r,t){var _=[];i(t),m(_,e,"state_address");var n=u(r=E(_,r,"message_chunk")),s=r.length;_.push(n),0|a._crypto_onetimeauth_update(e,n,s)&&b(_,"invalid usage"),g(_)}function Rr(e,r,t){var _=[];e=E(_,e,"hash");var n,s=0|a._crypto_onetimeauth_bytes();e.length!==s&&f(_,"invalid hash length"),n=u(e),_.push(n);var c=u(r=E(_,r,"message")),o=r.length;_.push(c),t=E(_,t,"key");var h,p=0|a._crypto_onetimeauth_keybytes();t.length!==p&&f(_,"invalid key length"),h=u(t),_.push(h);var y=!(0|a._crypto_onetimeauth_verify(n,c,o,0,h));return g(_),y}function Xr(e,r,t,_,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 h=u(r=E(o,r,"password")),y=r.length;o.push(h),t=E(o,t,"salt");var d,v=0|a._crypto_pwhash_saltbytes();t.length!==v&&f(o,"invalid salt length"),d=u(t),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 x=new l(0|e),k=x.address;if(o.push(k),!(0|a._crypto_pwhash(k,e,0,h,y,0,d,_,0,n,s))){var S=p(x,c);return g(o),S}b(o,"invalid usage")}function Gr(e,r,t,_,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=u(r=E(c,r,"password")),h=r.length;c.push(o),t=E(c,t,"salt");var y,d=0|a._crypto_pwhash_scryptsalsa208sha256_saltbytes();t.length!==d&&f(c,"invalid salt length"),y=u(t),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 l(0|e),x=v.address;if(c.push(x),!(0|a._crypto_pwhash_scryptsalsa208sha256(x,e,0,o,h,0,y,_,0,n))){var k=p(v,s);return g(c),k}b(c,"invalid usage")}function Dr(e,r,t,_,n,s,c){var o=[];i(c);var h=u(e=E(o,e,"password")),y=e.length;o.push(h);var d=u(r=E(o,r,"salt")),v=r.length;o.push(d),m(o,t,"opsLimit"),("number"!=typeof t||(0|t)!==t||t<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 x=new l(0|s),k=x.address;if(o.push(k),!(0|a._crypto_pwhash_scryptsalsa208sha256_ll(h,y,d,v,t,0,_,n,k,s))){var S=p(x,c);return g(o),S}b(o,"invalid usage")}function Fr(e,r,t,_){var n=[];i(_);var s=u(e=E(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,t,"memLimit"),("number"!=typeof t||(0|t)!==t||t<0)&&f(n,"memLimit must be an unsigned integer");var o=new l(0|a._crypto_pwhash_scryptsalsa208sha256_strbytes()).address;if(n.push(o),!(0|a._crypto_pwhash_scryptsalsa208sha256_str(o,s,c,0,r,0,t))){var h=a.UTF8ToString(o);return g(n),h}b(n,"invalid usage")}function Vr(e,r,t){var n=[];i(t),"string"!=typeof e&&f(n,"hashed_password must be a string");var s=u(e=_(e+"\0"));e.length,n.push(s);var c=u(r=E(n,r,"password")),o=r.length;n.push(c);var h=!(0|a._crypto_pwhash_scryptsalsa208sha256_str_verify(s,c,o,0));return g(n),h}function Hr(e,r,t,_){var n=[];i(_);var s=u(e=E(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,t,"memLimit"),("number"!=typeof t||(0|t)!==t||t<0)&&f(n,"memLimit must be an unsigned integer");var o=new l(0|a._crypto_pwhash_strbytes()).address;if(n.push(o),!(0|a._crypto_pwhash_str(o,s,c,0,r,0,t))){var h=a.UTF8ToString(o);return g(n),h}b(n,"invalid usage")}function Wr(e,r,t,n){var s=[];i(n),"string"!=typeof e&&f(s,"hashed_password must be a string");var c=u(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,t,"memLimit"),("number"!=typeof t||(0|t)!==t||t<0)&&f(s,"memLimit must be an unsigned integer");var o=!!(0|a._crypto_pwhash_str_needs_rehash(c,r,0,t));return g(s),o}function qr(e,r,t){var n=[];i(t),"string"!=typeof e&&f(n,"hashed_password must be a string");var s=u(e=_(e+"\0"));e.length,n.push(s);var c=u(r=E(n,r,"password")),o=r.length;n.push(c);var h=!(0|a._crypto_pwhash_str_verify(s,c,o,0));return g(n),h}function jr(e,r,t){var _=[];i(t),e=E(_,e,"privateKey");var n,s=0|a._crypto_scalarmult_scalarbytes();e.length!==s&&f(_,"invalid privateKey length"),n=u(e),_.push(n),r=E(_,r,"publicKey");var c,o=0|a._crypto_scalarmult_bytes();r.length!==o&&f(_,"invalid publicKey length"),c=u(r),_.push(c);var h=new l(0|a._crypto_scalarmult_bytes()),y=h.address;if(_.push(y),!(0|a._crypto_scalarmult(y,n,c))){var d=p(h,t);return g(_),d}b(_,"weak public key")}function zr(e,r){var t=[];i(r),e=E(t,e,"privateKey");var _,n=0|a._crypto_scalarmult_scalarbytes();e.length!==n&&f(t,"invalid privateKey length"),_=u(e),t.push(_);var s=new l(0|a._crypto_scalarmult_bytes()),c=s.address;if(t.push(c),!(0|a._crypto_scalarmult_base(c,_))){var o=p(s,r);return g(t),o}b(t,"unknown error")}function Jr(e,r,t){var _=[];i(t),e=E(_,e,"n");var n,s=0|a._crypto_scalarmult_ed25519_scalarbytes();e.length!==s&&f(_,"invalid n length"),n=u(e),_.push(n),r=E(_,r,"p");var c,o=0|a._crypto_scalarmult_ed25519_bytes();r.length!==o&&f(_,"invalid p length"),c=u(r),_.push(c);var h=new l(0|a._crypto_scalarmult_ed25519_bytes()),y=h.address;if(_.push(y),!(0|a._crypto_scalarmult_ed25519(y,n,c))){var d=p(h,t);return g(_),d}b(_,"invalid point or scalar is 0")}function Qr(e,r){var t=[];i(r),e=E(t,e,"scalar");var _,n=0|a._crypto_scalarmult_ed25519_scalarbytes();e.length!==n&&f(t,"invalid scalar length"),_=u(e),t.push(_);var s=new l(0|a._crypto_scalarmult_ed25519_bytes()),c=s.address;if(t.push(c),!(0|a._crypto_scalarmult_ed25519_base(c,_))){var o=p(s,r);return g(t),o}b(t,"scalar is 0")}function Zr(e,r){var t=[];i(r),e=E(t,e,"scalar");var _,n=0|a._crypto_scalarmult_ed25519_scalarbytes();e.length!==n&&f(t,"invalid scalar length"),_=u(e),t.push(_);var s=new l(0|a._crypto_scalarmult_ed25519_bytes()),c=s.address;if(t.push(c),!(0|a._crypto_scalarmult_ed25519_base_noclamp(c,_))){var o=p(s,r);return g(t),o}b(t,"scalar is 0")}function $r(e,r,t){var _=[];i(t),e=E(_,e,"n");var n,s=0|a._crypto_scalarmult_ed25519_scalarbytes();e.length!==s&&f(_,"invalid n length"),n=u(e),_.push(n),r=E(_,r,"p");var c,o=0|a._crypto_scalarmult_ed25519_bytes();r.length!==o&&f(_,"invalid p length"),c=u(r),_.push(c);var h=new l(0|a._crypto_scalarmult_ed25519_bytes()),y=h.address;if(_.push(y),!(0|a._crypto_scalarmult_ed25519_noclamp(y,n,c))){var d=p(h,t);return g(_),d}b(_,"invalid point or scalar is 0")}function ea(e,r,t){var _=[];i(t),e=E(_,e,"scalar");var n,s=0|a._crypto_scalarmult_ristretto255_scalarbytes();e.length!==s&&f(_,"invalid scalar length"),n=u(e),_.push(n),r=E(_,r,"element");var c,o=0|a._crypto_scalarmult_ristretto255_bytes();r.length!==o&&f(_,"invalid element length"),c=u(r),_.push(c);var h=new l(0|a._crypto_scalarmult_ristretto255_bytes()),y=h.address;if(_.push(y),!(0|a._crypto_scalarmult_ristretto255(y,n,c))){var d=p(h,t);return g(_),d}b(_,"result is identity element")}function ra(e,r){var t=[];i(r),e=E(t,e,"scalar");var _,n=0|a._crypto_core_ristretto255_scalarbytes();e.length!==n&&f(t,"invalid scalar length"),_=u(e),t.push(_);var s=new l(0|a._crypto_core_ristretto255_bytes()),c=s.address;if(t.push(c),!(0|a._crypto_scalarmult_ristretto255_base(c,_))){var o=p(s,r);return g(t),o}b(t,"scalar is 0")}function aa(e,r,t,_){var n=[];i(_);var s=u(e=E(n,e,"message")),c=e.length;n.push(s),r=E(n,r,"nonce");var o,h=0|a._crypto_secretbox_noncebytes();r.length!==h&&f(n,"invalid nonce length"),o=u(r),n.push(o),t=E(n,t,"key");var y,d=0|a._crypto_secretbox_keybytes();t.length!==d&&f(n,"invalid key length"),y=u(t),n.push(y);var v=new l(0|c),m=v.address;n.push(m);var x=new l(0|a._crypto_secretbox_macbytes()),k=x.address;if(n.push(k),!(0|a._crypto_secretbox_detached(m,k,s,c,0,o,y))){var S=p({mac:x,cipher:v},_);return g(n),S}b(n,"invalid usage")}function ta(e,r,t,_){var n=[];i(_);var s=u(e=E(n,e,"message")),c=e.length;n.push(s),r=E(n,r,"nonce");var o,h=0|a._crypto_secretbox_noncebytes();r.length!==h&&f(n,"invalid nonce length"),o=u(r),n.push(o),t=E(n,t,"key");var y,d=0|a._crypto_secretbox_keybytes();t.length!==d&&f(n,"invalid key length"),y=u(t),n.push(y);var v=new l(c+a._crypto_secretbox_macbytes()|0),m=v.address;if(n.push(m),!(0|a._crypto_secretbox_easy(m,s,c,0,o,y))){var x=p(v,_);return g(n),x}b(n,"invalid usage")}function _a(e){var r=[];i(e);var t=new l(0|a._crypto_secretbox_keybytes()),_=t.address;r.push(_),a._crypto_secretbox_keygen(_);var n=p(t,e);return g(r),n}function na(e,r,t,_,n){var s=[];i(n);var c=u(e=E(s,e,"ciphertext")),o=e.length;s.push(c),r=E(s,r,"mac");var h,y=0|a._crypto_secretbox_macbytes();r.length!==y&&f(s,"invalid mac length"),h=u(r),s.push(h),t=E(s,t,"nonce");var d,v=0|a._crypto_secretbox_noncebytes();t.length!==v&&f(s,"invalid nonce length"),d=u(t),s.push(d),_=E(s,_,"key");var m,x=0|a._crypto_secretbox_keybytes();_.length!==x&&f(s,"invalid key length"),m=u(_),s.push(m);var k=new l(0|o),S=k.address;if(s.push(S),!(0|a._crypto_secretbox_open_detached(S,c,h,o,0,d,m))){var T=p(k,n);return g(s),T}b(s,"wrong secret key for the given ciphertext")}function sa(e,r,t,_){var n=[];i(_),e=E(n,e,"ciphertext");var s,c=a._crypto_secretbox_macbytes(),o=e.length;o>>0;return g([]),r}function Va(e,r){var t=[];i(r);for(var _=a._malloc(24),n=0;n<6;n++)a.setValue(_+4*n,a.Runtime.addFunction(e[["implementation_name","random","stir","uniform","buf","close"][n]]),"i32");0|a._randombytes_set_implementation(_)&&b(t,"unsupported implementation"),g(t)}function Ha(e){i(e),a._randombytes_stir()}function Wa(e,r){var t=[];i(r),m(t,e,"upper_bound"),("number"!=typeof e||(0|e)!==e||e<0)&&f(t,"upper_bound must be an unsigned integer");var _=a._randombytes_uniform(e)>>>0;return g(t),_}function qa(){var e=a._sodium_version_string(),r=a.UTF8ToString(e);return g([]),r}return l.prototype.to_Uint8Array=function(){var e=new Uint8Array(this.length);return e.set(a.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 a=e.length,t=0,_=0;if(r.length!==e.length)throw new TypeError("Arguments must have the same length");for(_=0;_>=8,t+=e[_]+r[_],e[_]=255&t},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 a=0,t=1,_=e.length;_-- >0;)a|=r[_]-e[_]>>8&t,t&=(r[_]^e[_])-1>>8;return a+a+t-1},e.from_base64=function(e,r){r=o(r);var t,_=[],n=new l(3*(e=E(_,e,"input")).length/4),s=u(e),c=d(4),h=d(4);return _.push(s),_.push(n.address),_.push(c),_.push(h),0!==a._sodium_base642bin(n.address,n.length,s,e.length,0,c,h,r)&&b(_,"invalid input"),a.getValue(h,"i32")-s!==e.length&&b(_,"incomplete input"),n.length=a.getValue(c,"i32"),t=n.to_Uint8Array(),g(_),t},e.from_hex=function(e){var r,t=[],_=new l((e=E(t,e,"input")).length/2),n=u(e),s=d(4);return t.push(n),t.push(_.address),t.push(s),0!==a._sodium_hex2bin(_.address,_.length,n,e.length,0,0,s)&&b(t,"invalid input"),a.getValue(s,"i32")-n!==e.length&&b(t,"incomplete input"),r=_.to_Uint8Array(),g(t),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,a=0,t=e.length;a>=8,r+=e[a],e[a]=255&r},e.is_zero=function(e){if(!(e instanceof Uint8Array))throw new TypeError("Only Uint8Array instances can be checked");for(var r=0,a=0,t=e.length;a 0");var t,_=[],n=d(4),s=1,c=0,o=0|e.length,h=new l(o+r);_.push(n),_.push(h.address);for(var p=h.address,y=h.address+o+r;p>>48|o>>>32|o>>>16|o))-1>>16);return 0!==a._sodium_pad(n,h.address,e.length,r,h.length)&&b(_,"internal error"),h.length=a.getValue(n,"i32"),t=h.to_Uint8Array(),g(_),t},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 t=[],_=u(e),n=d(4);return t.push(_),t.push(n),0!==a._sodium_unpad(n,_,e.length,r)&&b(t,"unsupported/invalid padding"),e=(e=new Uint8Array(e)).subarray(0,a.getValue(n,"i32")),g(t),e},e.ready=t,e.symbols=function(){return Object.keys(e).sort()},e.to_base64=h,e.to_hex=s,e.to_string=n,e}var a="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),a&&e.sodium.ready.then(function(){a(e.sodium)})}(this);