!function(e){function t(e,t){"use strict";function r(e){if("function"==typeof TextEncoder)return new TextEncoder("utf-8").encode(e);e=unescape(encodeURIComponent(e));for(var t=new Uint8Array(e.length),r=0;r=240?(o=4,c=!0):p>=224?(o=3,c=!0):p>=192?(o=2,c=!0):p<128&&(o=1,c=!0)}while(!c);for(var i=o-(s.length-h),y=0;y>8&-39)<<8|87+(t=e[_]>>>4)+(t-10>>8&-39),n+=String.fromCharCode(255&a)+String.fromCharCode(a>>>8);return n}function _(e){if(void 0==e)return wt.URLSAFE_NO_PADDING;if(e!==wt.ORIGINAL&&e!==wt.ORIGINAL_NO_PADDING&&e!==wt.URLSAFE&&e!=wt.URLSAFE_NO_PADDING)throw new Error("unsupported base64 variant");return e}function s(e,t){t=_(t),e=f(n,e,"input");var r,n=[],s=0|Math.floor(e.length/3),c=e.length-3*s,h=4*s+(0!==c?0==(2&t)?4:2+(c>>>1):0),o=new i(h+1),p=y(e);return n.push(p),n.push(o.address),0===kt._sodium_bin2base64(o.address,o.length,p,e.length,t)&&v(n,"conversion failed"),o.length=h,r=a(o.to_Uint8Array()),d(n),r}function c(){return["uint8array","text","hex","base64"]}function h(e,t){var r=t||xt;if(!o(r))throw new Error(r+" output format is not available");if(e instanceof i){if("uint8array"===r)return e.to_Uint8Array();if("text"===r)return a(e.to_Uint8Array());if("hex"===r)return n(e.to_Uint8Array());if("base64"===r)return s(e.to_Uint8Array(),wt.URLSAFE_NO_PADDING);throw new Error('What is output format "'+r+'"?')}if("object"==typeof e){for(var _=Object.keys(e),c={},p=0;p<_.length;p++)c[_[p]]=h(e[_[p]],r);return c}if("string"==typeof e)return e;throw new TypeError("Cannot format output")}function o(e){for(var t=c(),r=0;r>>0;return d([]),t}function gt(e,t){var r=[];p(t);for(var a=kt._malloc(24),n=0;n<6;n++)kt.setValue(a+4*n,kt.Runtime.addFunction(e[["implementation_name","random","stir","uniform","buf","close"][n]]),"i32");0!=(0|kt._randombytes_set_implementation(a))&&v(r,"unsupported implementation"),d(r)}function bt(e){p(e),kt._randombytes_stir()}function ft(e,t){var r=[];p(t),b(r,e,"upper_bound"),("number"!=typeof e||(0|e)!==e||e<0)&&g(r,"upper_bound must be an unsigned integer");var a=kt._randombytes_uniform(e)>>>0;return d(r),a}function mt(){var e=kt._sodium_version_string(),t=kt.Pointer_stringify(e);return d([]),t}var kt,xt="uint8array",Et=t.ready.then(function(){if(0!==(kt=t)._sodium_init())throw new Error("libsodium was not correctly initialized.");for(var r=["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_keygen","crypto_auth_hmacsha256_verify","crypto_auth_hmacsha512","crypto_auth_hmacsha512_keygen","crypto_auth_hmacsha512_verify","crypto_auth_keygen","crypto_auth_verify","crypto_box_beforenm","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_generichash","crypto_generichash_final","crypto_generichash_init","crypto_generichash_keygen","crypto_generichash_update","crypto_hash","crypto_hash_sha256","crypto_hash_sha512","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_verify","crypto_scalarmult","crypto_scalarmult_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_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"],a=[m,k,x,E,w,S,T,Y,A,K,B,I,M,L,N,U,O,R,P,C,G,D,X,V,F,H,j,z,W,J,q,Q,Z,$,ee,te,re,ae,ne,_e,se,ce,he,oe,pe,ie,ye,ue,le,de,ve,ge,be,fe,me,ke,xe,Ee,we,Se,Te,Ye,Ae,Ke,Be,Ie,Me,Le,Ne,Ue,Oe,Re,Pe,Ce,Ge,De,Xe,Ve,Fe,He,je,ze,We,Je,qe,Qe,Ze,$e,et,tt,rt,at,nt,_t,st,ct,ht,ot,pt,it,yt,ut,lt,dt,vt,gt,bt,ft,mt],n=0;n>=8,a+=e[n]+t[r],e[n]=255&a},e.base64_variants=wt,e.compare=function(e,t){if(!(e instanceof Uint8Array&&t instanceof Uint8Array))throw new TypeError("Only Uint8Array instances can be compared");if(e.length!==t.length)throw new TypeError("Only instances of identical length can be compared");for(var r=0,a=1,n=e.length;n-- >0;)r|=t[n]-e[n]>>8&a,a&=(t[n]^e[n])-1>>8;return r+r+a-1},e.from_base64=function(e,t){t=_(t);var r,a=[],n=new i(3*(e=f(a,e,"input")).length/4),s=y(e),c=u(4),h=u(4);return a.push(s),a.push(n.address),a.push(n.result_bin_len_p),a.push(n.b64_end_p),0!==kt._sodium_base642bin(n.address,n.length,s,e.length,0,c,h,t)&&v(a,"invalid input"),kt.getValue(h,"i32")-s!==e.length&&v(a,"incomplete input"),n.length=kt.getValue(c,"i32"),r=n.to_Uint8Array(),d(a),r},e.from_hex=function(e){var t,r=[],a=new i((e=f(r,e,"input")).length/2),n=y(e),_=u(4);return r.push(n),r.push(a.address),r.push(a.hex_end_p),0!==kt._sodium_hex2bin(a.address,a.length,n,e.length,0,0,_)&&v(r,"invalid input"),kt.getValue(_,"i32")-n!==e.length&&v(r,"incomplete input"),t=a.to_Uint8Array(),d(r),t},e.from_string=r,e.increment=function(e){if(!(e instanceof Uint8Array))throw new TypeError("Only Uint8Array instances can be incremented");for(var t=256,r=0,a=e.length;r>=8,t+=e[r],e[r]=255&t},e.is_zero=function(e){if(!(e instanceof Uint8Array))throw new TypeError("Only Uint8Array instances can be checked");for(var t=0,r=0,a=e.length;r 0");var r,a=[],n=u(4),_=1,s=0,c=0|e.length,h=new i(c+t);a.push(n),a.push(h.address);for(var o=h.address,p=h.address+c+t;o>>48|c>>>32|c>>>16|c))-1>>16);return 0!==kt._sodium_pad(n,h.address,e.length,t,h.length)&&v(a,"internal error"),h.length=kt.getValue(n,"i32"),r=h.to_Uint8Array(),d(a),r},e.unpad=function(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 r=[],a=y(e),n=u(4);return r.push(a),r.push(n),0!==kt._sodium_unpad(n,a,e.length,t)&&v(r,"unsupported/invalid padding"),e=new Uint8Array(e),e=e.subarray(0,kt.getValue(n,"i32")),d(r),e},e.ready=Et,e.symbols=function(){return Object.keys(e).sort()},e.to_base64=s,e.to_hex=n,e.to_string=a,e}var r="object"==typeof e.sodium&&"function"==typeof e.sodium.onload?e.sodium.onload:null;"function"==typeof define&&define.amd?define(["exports","libsodium"],t):"object"==typeof exports&&"string"!=typeof exports.nodeName?t(exports,require("libsodium")):e.sodium=t(e.commonJsStrict={},e.libsodium),r&&e.sodium.ready.then(function(){r(e.sodium)})}(this);