UNPKG

based-auth

Version:

A Next.js/Node.js authentication and wallet API kit for Ethereum and Solana, with utilities for serialization and contract interaction, designed for serverless and API route usage.

1 lines 460 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ic=require("next-auth"),$n=require("crypto"),xr=require("@solana/web3.js"),bt=require("ethers"),Nt=require("./chains.cjs"),Pt=require("mongoose"),mt=require("./index-Cws-uUvN.js"),jc=require("stream"),xa=require("next/server"),ia=require("./serialize-hzIq3W0C.js"),si=require("@coral-xyz/anchor"),Rc=require("./constants-BtR1jpY9.js");var St=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Vn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Wn(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var r=e.default;if(typeof r=="function"){var t=function i(){return this instanceof i?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};t.prototype=r.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(e).forEach(function(i){var s=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:function(){return e[i]}})}),t}function Tc(e){return{id:"google",name:"Google",type:"oidc",issuer:"https://accounts.google.com",style:{brandColor:"#1a73e8"},options:e}}function Uc(e){var i,s,a;const r=((i=e==null?void 0:e.enterprise)==null?void 0:i.baseUrl)??"https://github.com",t=(s=e==null?void 0:e.enterprise)!=null&&s.baseUrl?`${(a=e==null?void 0:e.enterprise)==null?void 0:a.baseUrl}/api/v3`:"https://api.github.com";return{id:"github",name:"GitHub",type:"oauth",authorization:{url:`${r}/login/oauth/authorize`,params:{scope:"read:user user:email"}},token:`${r}/login/oauth/access_token`,userinfo:{url:`${t}/user`,async request({tokens:l,provider:n}){var b;const f=await fetch((b=n.userinfo)==null?void 0:b.url,{headers:{Authorization:`Bearer ${l.access_token}`,"User-Agent":"authjs"}}).then(async d=>await d.json());if(!f.email){const d=await fetch(`${t}/user/emails`,{headers:{Authorization:`Bearer ${l.access_token}`,"User-Agent":"authjs"}});if(d.ok){const w=await d.json();f.email=(w.find(p=>p.primary)??w[0]).email}}return f}},profile(l){return{id:l.id.toString(),name:l.name??l.login,email:l.email,image:l.avatar_url}},style:{bg:"#24292f",text:"#fff"},options:e}}function Lc(e){return{id:"twitter",name:"Twitter",type:"oauth",checks:["pkce","state"],authorization:"https://x.com/i/oauth2/authorize?scope=users.read tweet.read offline.access",token:"https://api.x.com/2/oauth2/token",userinfo:"https://api.x.com/2/users/me?user.fields=profile_image_url",profile({data:r}){return{id:r.id,name:r.name,email:r.email??null,image:r.profile_image_url}},style:{bg:"#1da1f2",text:"#fff"},options:e}}function Oc(e){return{id:"credentials",name:"Credentials",type:"credentials",credentials:{},authorize:()=>null,options:e}}function qc(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var ya={exports:{}},ci;function Gn(){return ci||(ci=1,function(e){(function(r){var t=function(h){var _,y=new Float64Array(16);if(h)for(_=0;_<h.length;_++)y[_]=h[_];return y},i=function(){throw new Error("no PRNG")},s=new Uint8Array(16),a=new Uint8Array(32);a[0]=9;var l=t(),n=t([1]),f=t([56129,1]),b=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),d=t([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),w=t([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),p=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),v=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function m(h,_,y,o){h[_]=y>>24&255,h[_+1]=y>>16&255,h[_+2]=y>>8&255,h[_+3]=y&255,h[_+4]=o>>24&255,h[_+5]=o>>16&255,h[_+6]=o>>8&255,h[_+7]=o&255}function g(h,_,y,o,k){var P,$=0;for(P=0;P<k;P++)$|=h[_+P]^y[o+P];return(1&$-1>>>8)-1}function z(h,_,y,o){return g(h,_,y,o,16)}function E(h,_,y,o){return g(h,_,y,o,32)}function C(h,_,y,o){for(var k=o[0]&255|(o[1]&255)<<8|(o[2]&255)<<16|(o[3]&255)<<24,P=y[0]&255|(y[1]&255)<<8|(y[2]&255)<<16|(y[3]&255)<<24,$=y[4]&255|(y[5]&255)<<8|(y[6]&255)<<16|(y[7]&255)<<24,ae=y[8]&255|(y[9]&255)<<8|(y[10]&255)<<16|(y[11]&255)<<24,ce=y[12]&255|(y[13]&255)<<8|(y[14]&255)<<16|(y[15]&255)<<24,ze=o[4]&255|(o[5]&255)<<8|(o[6]&255)<<16|(o[7]&255)<<24,me=_[0]&255|(_[1]&255)<<8|(_[2]&255)<<16|(_[3]&255)<<24,Je=_[4]&255|(_[5]&255)<<8|(_[6]&255)<<16|(_[7]&255)<<24,xe=_[8]&255|(_[9]&255)<<8|(_[10]&255)<<16|(_[11]&255)<<24,Te=_[12]&255|(_[13]&255)<<8|(_[14]&255)<<16|(_[15]&255)<<24,Ue=o[8]&255|(o[9]&255)<<8|(o[10]&255)<<16|(o[11]&255)<<24,Ne=y[16]&255|(y[17]&255)<<8|(y[18]&255)<<16|(y[19]&255)<<24,De=y[20]&255|(y[21]&255)<<8|(y[22]&255)<<16|(y[23]&255)<<24,Le=y[24]&255|(y[25]&255)<<8|(y[26]&255)<<16|(y[27]&255)<<24,Ce=y[28]&255|(y[29]&255)<<8|(y[30]&255)<<16|(y[31]&255)<<24,Oe=o[12]&255|(o[13]&255)<<8|(o[14]&255)<<16|(o[15]&255)<<24,_e=k,Be=P,ve=$,Ee=ae,Se=ce,pe=ze,G=me,K=Je,ie=xe,te=Te,oe=Ue,ne=Ne,je=De,Pe=Le,$e=Ce,Fe=Oe,U,We=0;We<20;We+=2)U=_e+je|0,Se^=U<<7|U>>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>>8&255,h[6]=Be>>>16&255,h[7]=Be>>>24&255,h[8]=ve>>>0&255,h[9]=ve>>>8&255,h[10]=ve>>>16&255,h[11]=ve>>>24&255,h[12]=Ee>>>0&255,h[13]=Ee>>>8&255,h[14]=Ee>>>16&255,h[15]=Ee>>>24&255,h[16]=Se>>>0&255,h[17]=Se>>>8&255,h[18]=Se>>>16&255,h[19]=Se>>>24&255,h[20]=pe>>>0&255,h[21]=pe>>>8&255,h[22]=pe>>>16&255,h[23]=pe>>>24&255,h[24]=G>>>0&255,h[25]=G>>>8&255,h[26]=G>>>16&255,h[27]=G>>>24&255,h[28]=K>>>0&255,h[29]=K>>>8&255,h[30]=K>>>16&255,h[31]=K>>>24&255,h[32]=ie>>>0&255,h[33]=ie>>>8&255,h[34]=ie>>>16&255,h[35]=ie>>>24&255,h[36]=te>>>0&255,h[37]=te>>>8&255,h[38]=te>>>16&255,h[39]=te>>>24&255,h[40]=oe>>>0&255,h[41]=oe>>>8&255,h[42]=oe>>>16&255,h[43]=oe>>>24&255,h[44]=ne>>>0&255,h[45]=ne>>>8&255,h[46]=ne>>>16&255,h[47]=ne>>>24&255,h[48]=je>>>0&255,h[49]=je>>>8&255,h[50]=je>>>16&255,h[51]=je>>>24&255,h[52]=Pe>>>0&255,h[53]=Pe>>>8&255,h[54]=Pe>>>16&255,h[55]=Pe>>>24&255,h[56]=$e>>>0&255,h[57]=$e>>>8&255,h[58]=$e>>>16&255,h[59]=$e>>>24&255,h[60]=Fe>>>0&255,h[61]=Fe>>>8&255,h[62]=Fe>>>16&255,h[63]=Fe>>>24&255}function O(h,_,y,o){for(var k=o[0]&255|(o[1]&255)<<8|(o[2]&255)<<16|(o[3]&255)<<24,P=y[0]&255|(y[1]&255)<<8|(y[2]&255)<<16|(y[3]&255)<<24,$=y[4]&255|(y[5]&255)<<8|(y[6]&255)<<16|(y[7]&255)<<24,ae=y[8]&255|(y[9]&255)<<8|(y[10]&255)<<16|(y[11]&255)<<24,ce=y[12]&255|(y[13]&255)<<8|(y[14]&255)<<16|(y[15]&255)<<24,ze=o[4]&255|(o[5]&255)<<8|(o[6]&255)<<16|(o[7]&255)<<24,me=_[0]&255|(_[1]&255)<<8|(_[2]&255)<<16|(_[3]&255)<<24,Je=_[4]&255|(_[5]&255)<<8|(_[6]&255)<<16|(_[7]&255)<<24,xe=_[8]&255|(_[9]&255)<<8|(_[10]&255)<<16|(_[11]&255)<<24,Te=_[12]&255|(_[13]&255)<<8|(_[14]&255)<<16|(_[15]&255)<<24,Ue=o[8]&255|(o[9]&255)<<8|(o[10]&255)<<16|(o[11]&255)<<24,Ne=y[16]&255|(y[17]&255)<<8|(y[18]&255)<<16|(y[19]&255)<<24,De=y[20]&255|(y[21]&255)<<8|(y[22]&255)<<16|(y[23]&255)<<24,Le=y[24]&255|(y[25]&255)<<8|(y[26]&255)<<16|(y[27]&255)<<24,Ce=y[28]&255|(y[29]&255)<<8|(y[30]&255)<<16|(y[31]&255)<<24,Oe=o[12]&255|(o[13]&255)<<8|(o[14]&255)<<16|(o[15]&255)<<24,_e=k,Be=P,ve=$,Ee=ae,Se=ce,pe=ze,G=me,K=Je,ie=xe,te=Te,oe=Ue,ne=Ne,je=De,Pe=Le,$e=Ce,Fe=Oe,U,We=0;We<20;We+=2)U=_e+je|0,Se^=U<<7|U>>>25,U=Se+_e|0,ie^=U<<9|U>>>23,U=ie+Se|0,je^=U<<13|U>>>19,U=je+ie|0,_e^=U<<18|U>>>14,U=pe+Be|0,te^=U<<7|U>>>25,U=te+pe|0,Pe^=U<<9|U>>>23,U=Pe+te|0,Be^=U<<13|U>>>19,U=Be+Pe|0,pe^=U<<18|U>>>14,U=oe+G|0,$e^=U<<7|U>>>25,U=$e+oe|0,ve^=U<<9|U>>>23,U=ve+$e|0,G^=U<<13|U>>>19,U=G+ve|0,oe^=U<<18|U>>>14,U=Fe+ne|0,Ee^=U<<7|U>>>25,U=Ee+Fe|0,K^=U<<9|U>>>23,U=K+Ee|0,ne^=U<<13|U>>>19,U=ne+K|0,Fe^=U<<18|U>>>14,U=_e+Ee|0,Be^=U<<7|U>>>25,U=Be+_e|0,ve^=U<<9|U>>>23,U=ve+Be|0,Ee^=U<<13|U>>>19,U=Ee+ve|0,_e^=U<<18|U>>>14,U=pe+Se|0,G^=U<<7|U>>>25,U=G+pe|0,K^=U<<9|U>>>23,U=K+G|0,Se^=U<<13|U>>>19,U=Se+K|0,pe^=U<<18|U>>>14,U=oe+te|0,ne^=U<<7|U>>>25,U=ne+oe|0,ie^=U<<9|U>>>23,U=ie+ne|0,te^=U<<13|U>>>19,U=te+ie|0,oe^=U<<18|U>>>14,U=Fe+$e|0,je^=U<<7|U>>>25,U=je+Fe|0,Pe^=U<<9|U>>>23,U=Pe+je|0,$e^=U<<13|U>>>19,U=$e+Pe|0,Fe^=U<<18|U>>>14;h[0]=_e>>>0&255,h[1]=_e>>>8&255,h[2]=_e>>>16&255,h[3]=_e>>>24&255,h[4]=pe>>>0&255,h[5]=pe>>>8&255,h[6]=pe>>>16&255,h[7]=pe>>>24&255,h[8]=oe>>>0&255,h[9]=oe>>>8&255,h[10]=oe>>>16&255,h[11]=oe>>>24&255,h[12]=Fe>>>0&255,h[13]=Fe>>>8&255,h[14]=Fe>>>16&255,h[15]=Fe>>>24&255,h[16]=G>>>0&255,h[17]=G>>>8&255,h[18]=G>>>16&255,h[19]=G>>>24&255,h[20]=K>>>0&255,h[21]=K>>>8&255,h[22]=K>>>16&255,h[23]=K>>>24&255,h[24]=ie>>>0&255,h[25]=ie>>>8&255,h[26]=ie>>>16&255,h[27]=ie>>>24&255,h[28]=te>>>0&255,h[29]=te>>>8&255,h[30]=te>>>16&255,h[31]=te>>>24&255}function j(h,_,y,o){C(h,_,y,o)}function S(h,_,y,o){O(h,_,y,o)}var q=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function F(h,_,y,o,k,P,$){var ae=new Uint8Array(16),ce=new Uint8Array(64),ze,me;for(me=0;me<16;me++)ae[me]=0;for(me=0;me<8;me++)ae[me]=P[me];for(;k>=64;){for(j(ce,ae,$,q),me=0;me<64;me++)h[_+me]=y[o+me]^ce[me];for(ze=1,me=8;me<16;me++)ze=ze+(ae[me]&255)|0,ae[me]=ze&255,ze>>>=8;k-=64,_+=64,o+=64}if(k>0)for(j(ce,ae,$,q),me=0;me<k;me++)h[_+me]=y[o+me]^ce[me];return 0}function V(h,_,y,o,k){var P=new Uint8Array(16),$=new Uint8Array(64),ae,ce;for(ce=0;ce<16;ce++)P[ce]=0;for(ce=0;ce<8;ce++)P[ce]=o[ce];for(;y>=64;){for(j($,P,k,q),ce=0;ce<64;ce++)h[_+ce]=$[ce];for(ae=1,ce=8;ce<16;ce++)ae=ae+(P[ce]&255)|0,P[ce]=ae&255,ae>>>=8;y-=64,_+=64}if(y>0)for(j($,P,k,q),ce=0;ce<y;ce++)h[_+ce]=$[ce];return 0}function L(h,_,y,o,k){var P=new Uint8Array(32);S(P,o,k,q);for(var $=new Uint8Array(8),ae=0;ae<8;ae++)$[ae]=o[ae+16];return V(h,_,y,$,P)}function N(h,_,y,o,k,P,$){var ae=new Uint8Array(32);S(ae,P,$,q);for(var ce=new Uint8Array(8),ze=0;ze<8;ze++)ce[ze]=P[ze+16];return F(h,_,y,o,k,ce,ae)}var Z=function(h){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var _,y,o,k,P,$,ae,ce;_=h[0]&255|(h[1]&255)<<8,this.r[0]=_&8191,y=h[2]&255|(h[3]&255)<<8,this.r[1]=(_>>>13|y<<3)&8191,o=h[4]&255|(h[5]&255)<<8,this.r[2]=(y>>>10|o<<6)&7939,k=h[6]&255|(h[7]&255)<<8,this.r[3]=(o>>>7|k<<9)&8191,P=h[8]&255|(h[9]&255)<<8,this.r[4]=(k>>>4|P<<12)&255,this.r[5]=P>>>1&8190,$=h[10]&255|(h[11]&255)<<8,this.r[6]=(P>>>14|$<<2)&8191,ae=h[12]&255|(h[13]&255)<<8,this.r[7]=($>>>11|ae<<5)&8065,ce=h[14]&255|(h[15]&255)<<8,this.r[8]=(ae>>>8|ce<<8)&8191,this.r[9]=ce>>>5&127,this.pad[0]=h[16]&255|(h[17]&255)<<8,this.pad[1]=h[18]&255|(h[19]&255)<<8,this.pad[2]=h[20]&255|(h[21]&255)<<8,this.pad[3]=h[22]&255|(h[23]&255)<<8,this.pad[4]=h[24]&255|(h[25]&255)<<8,this.pad[5]=h[26]&255|(h[27]&255)<<8,this.pad[6]=h[28]&255|(h[29]&255)<<8,this.pad[7]=h[30]&255|(h[31]&255)<<8};Z.prototype.blocks=function(h,_,y){for(var o=this.fin?0:2048,k,P,$,ae,ce,ze,me,Je,xe,Te,Ue,Ne,De,Le,Ce,Oe,_e,Be,ve,Ee=this.h[0],Se=this.h[1],pe=this.h[2],G=this.h[3],K=this.h[4],ie=this.h[5],te=this.h[6],oe=this.h[7],ne=this.h[8],je=this.h[9],Pe=this.r[0],$e=this.r[1],Fe=this.r[2],U=this.r[3],We=this.r[4],Qe=this.r[5],er=this.r[6],Ve=this.r[7],Ke=this.r[8],Ye=this.r[9];y>=16;)k=h[_+0]&255|(h[_+1]&255)<<8,Ee+=k&8191,P=h[_+2]&255|(h[_+3]&255)<<8,Se+=(k>>>13|P<<3)&8191,$=h[_+4]&255|(h[_+5]&255)<<8,pe+=(P>>>10|$<<6)&8191,ae=h[_+6]&255|(h[_+7]&255)<<8,G+=($>>>7|ae<<9)&8191,ce=h[_+8]&255|(h[_+9]&255)<<8,K+=(ae>>>4|ce<<12)&8191,ie+=ce>>>1&8191,ze=h[_+10]&255|(h[_+11]&255)<<8,te+=(ce>>>14|ze<<2)&8191,me=h[_+12]&255|(h[_+13]&255)<<8,oe+=(ze>>>11|me<<5)&8191,Je=h[_+14]&255|(h[_+15]&255)<<8,ne+=(me>>>8|Je<<8)&8191,je+=Je>>>5|o,xe=0,Te=xe,Te+=Ee*Pe,Te+=Se*(5*Ye),Te+=pe*(5*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&=8191,Oe+=ie*$e,Oe+=te*Pe,Oe+=oe*(5*Ye),Oe+=ne*(5*Ke),Oe+=je*(5*Ve),xe+=Oe>>>13,Oe&=8191,_e=xe,_e+=Ee*Ve,_e+=Se*er,_e+=pe*Qe,_e+=G*We,_e+=K*U,xe=_e>>>13,_e&=8191,_e+=ie*Fe,_e+=te*$e,_e+=oe*Pe,_e+=ne*(5*Ye),_e+=je*(5*Ke),xe+=_e>>>13,_e&=8191,Be=xe,Be+=Ee*Ke,Be+=Se*Ve,Be+=pe*er,Be+=G*Qe,Be+=K*We,xe=Be>>>13,Be&=8191,Be+=ie*U,Be+=te*Fe,Be+=oe*$e,Be+=ne*Pe,Be+=je*(5*Ye),xe+=Be>>>13,Be&=8191,ve=xe,ve+=Ee*Ye,ve+=Se*Ke,ve+=pe*Ve,ve+=G*er,ve+=K*Qe,xe=ve>>>13,ve&=8191,ve+=ie*We,ve+=te*U,ve+=oe*Fe,ve+=ne*$e,ve+=je*Pe,xe+=ve>>>13,ve&=8191,xe=(xe<<2)+xe|0,xe=xe+Te|0,Te=xe&8191,xe=xe>>>13,Ue+=xe,Ee=Te,Se=Ue,pe=Ne,G=De,K=Le,ie=Ce,te=Oe,oe=_e,ne=Be,je=ve,_+=16,y-=16;this.h[0]=Ee,this.h[1]=Se,this.h[2]=pe,this.h[3]=G,this.h[4]=K,this.h[5]=ie,this.h[6]=te,this.h[7]=oe,this.h[8]=ne,this.h[9]=je},Z.prototype.finish=function(h,_){var y=new Uint16Array(10),o,k,P,$;if(this.leftover){for($=this.leftover,this.buffer[$++]=1;$<16;$++)this.buffer[$]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(o=this.h[1]>>>13,this.h[1]&=8191,$=2;$<10;$++)this.h[$]+=o,o=this.h[$]>>>13,this.h[$]&=8191;for(this.h[0]+=o*5,o=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=o,o=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=o,y[0]=this.h[0]+5,o=y[0]>>>13,y[0]&=8191,$=1;$<10;$++)y[$]=this.h[$]+o,o=y[$]>>>13,y[$]&=8191;for(y[9]-=8192,k=(o^1)-1,$=0;$<10;$++)y[$]&=k;for(k=~k,$=0;$<10;$++)this.h[$]=this.h[$]&k|y[$];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,P=this.h[0]+this.pad[0],this.h[0]=P&65535,$=1;$<8;$++)P=(this.h[$]+this.pad[$]|0)+(P>>>16)|0,this.h[$]=P&65535;h[_+0]=this.h[0]>>>0&255,h[_+1]=this.h[0]>>>8&255,h[_+2]=this.h[1]>>>0&255,h[_+3]=this.h[1]>>>8&255,h[_+4]=this.h[2]>>>0&255,h[_+5]=this.h[2]>>>8&255,h[_+6]=this.h[3]>>>0&255,h[_+7]=this.h[3]>>>8&255,h[_+8]=this.h[4]>>>0&255,h[_+9]=this.h[4]>>>8&255,h[_+10]=this.h[5]>>>0&255,h[_+11]=this.h[5]>>>8&255,h[_+12]=this.h[6]>>>0&255,h[_+13]=this.h[6]>>>8&255,h[_+14]=this.h[7]>>>0&255,h[_+15]=this.h[7]>>>8&255},Z.prototype.update=function(h,_,y){var o,k;if(this.leftover){for(k=16-this.leftover,k>y&&(k=y),o=0;o<k;o++)this.buffer[this.leftover+o]=h[_+o];if(y-=k,_+=k,this.leftover+=k,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(y>=16&&(k=y-y%16,this.blocks(h,_,k),_+=k,y-=k),y){for(o=0;o<y;o++)this.buffer[this.leftover+o]=h[_+o];this.leftover+=y}};function le(h,_,y,o,k,P){var $=new Z(P);return $.update(y,o,k),$.finish(h,_),0}function re(h,_,y,o,k,P){var $=new Uint8Array(16);return le($,0,y,o,k,P),z(h,_,$,0)}function ye(h,_,y,o,k){var P;if(y<32)return-1;for(N(h,0,_,0,y,o,k),le(h,16,h,32,y-32,h),P=0;P<16;P++)h[P]=0;return 0}function Ae(h,_,y,o,k){var P,$=new Uint8Array(32);if(y<32||(L($,0,32,o,k),re(_,16,_,32,y-32,$)!==0))return-1;for(N(h,0,_,0,y,o,k),P=0;P<32;P++)h[P]=0;return 0}function Re(h,_){var y;for(y=0;y<16;y++)h[y]=_[y]|0}function Ie(h){var _,y,o=1;for(_=0;_<16;_++)y=h[_]+o+65535,o=Math.floor(y/65536),h[_]=y-o*65536;h[0]+=o-1+37*(o-1)}function he(h,_,y){for(var o,k=~(y-1),P=0;P<16;P++)o=k&(h[P]^_[P]),h[P]^=o,_[P]^=o}function R(h,_){var y,o,k,P=t(),$=t();for(y=0;y<16;y++)$[y]=_[y];for(Ie($),Ie($),Ie($),o=0;o<2;o++){for(P[0]=$[0]-65517,y=1;y<15;y++)P[y]=$[y]-65535-(P[y-1]>>16&1),P[y-1]&=65535;P[15]=$[15]-32767-(P[14]>>16&1),k=P[15]>>16&1,P[14]&=65535,he($,P,1-k)}for(y=0;y<16;y++)h[2*y]=$[y]&255,h[2*y+1]=$[y]>>8}function Y(h,_){var y=new Uint8Array(32),o=new Uint8Array(32);return R(y,h),R(o,_),E(y,0,o,0)}function X(h){var _=new Uint8Array(32);return R(_,h),_[0]&1}function se(h,_){var y;for(y=0;y<16;y++)h[y]=_[2*y]+(_[2*y+1]<<8);h[15]&=32767}function ue(h,_,y){for(var o=0;o<16;o++)h[o]=_[o]+y[o]}function ke(h,_,y){for(var o=0;o<16;o++)h[o]=_[o]-y[o]}function ge(h,_,y){var o,k,P=0,$=0,ae=0,ce=0,ze=0,me=0,Je=0,xe=0,Te=0,Ue=0,Ne=0,De=0,Le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o*U,Ce+=o*We,Oe+=o*Qe,_e+=o*er,Be+=o*Ve,ve+=o*Ke,Ee+=o*Ye,Se+=o*dr,pe+=o*ar,G+=o*lr,K+=o*ur,ie+=o*fr,te+=o*hr,oe+=o*_r,ne+=o*Er,je+=o*kr,o=_[13],Ce+=o*U,Oe+=o*We,_e+=o*Qe,Be+=o*er,ve+=o*Ve,Ee+=o*Ke,Se+=o*Ye,pe+=o*dr,G+=o*ar,K+=o*lr,ie+=o*ur,te+=o*fr,oe+=o*hr,ne+=o*_r,je+=o*Er,Pe+=o*kr,o=_[14],Oe+=o*U,_e+=o*We,Be+=o*Qe,ve+=o*er,Ee+=o*Ve,Se+=o*Ke,pe+=o*Ye,G+=o*dr,K+=o*ar,ie+=o*lr,te+=o*ur,oe+=o*fr,ne+=o*hr,je+=o*_r,Pe+=o*Er,$e+=o*kr,o=_[15],_e+=o*U,Be+=o*We,ve+=o*Qe,Ee+=o*er,Se+=o*Ve,pe+=o*Ke,G+=o*Ye,K+=o*dr,ie+=o*ar,te+=o*lr,oe+=o*ur,ne+=o*fr,je+=o*hr,Pe+=o*_r,$e+=o*Er,Fe+=o*kr,P+=38*Be,$+=38*ve,ae+=38*Ee,ce+=38*Se,ze+=38*pe,me+=38*G,Je+=38*K,xe+=38*ie,Te+=38*te,Ue+=38*oe,Ne+=38*ne,De+=38*je,Le+=38*Pe,Ce+=38*$e,Oe+=38*Fe,k=1,o=P+k+65535,k=Math.floor(o/65536),P=o-k*65536,o=$+k+65535,k=Math.floor(o/65536),$=o-k*65536,o=ae+k+65535,k=Math.floor(o/65536),ae=o-k*65536,o=ce+k+65535,k=Math.floor(o/65536),ce=o-k*65536,o=ze+k+65535,k=Math.floor(o/65536),ze=o-k*65536,o=me+k+65535,k=Math.floor(o/65536),me=o-k*65536,o=Je+k+65535,k=Math.floor(o/65536),Je=o-k*65536,o=xe+k+65535,k=Math.floor(o/65536),xe=o-k*65536,o=Te+k+65535,k=Math.floor(o/65536),Te=o-k*65536,o=Ue+k+65535,k=Math.floor(o/65536),Ue=o-k*65536,o=Ne+k+65535,k=Math.floor(o/65536),Ne=o-k*65536,o=De+k+65535,k=Math.floor(o/65536),De=o-k*65536,o=Le+k+65535,k=Math.floor(o/65536),Le=o-k*65536,o=Ce+k+65535,k=Math.floor(o/65536),Ce=o-k*65536,o=Oe+k+65535,k=Math.floor(o/65536),Oe=o-k*65536,o=_e+k+65535,k=Math.floor(o/65536),_e=o-k*65536,P+=k-1+37*(k-1),k=1,o=P+k+65535,k=Math.floor(o/65536),P=o-k*65536,o=$+k+65535,k=Math.floor(o/65536),$=o-k*65536,o=ae+k+65535,k=Math.floor(o/65536),ae=o-k*65536,o=ce+k+65535,k=Math.floor(o/65536),ce=o-k*65536,o=ze+k+65535,k=Math.floor(o/65536),ze=o-k*65536,o=me+k+65535,k=Math.floor(o/65536),me=o-k*65536,o=Je+k+65535,k=Math.floor(o/65536),Je=o-k*65536,o=xe+k+65535,k=Math.floor(o/65536),xe=o-k*65536,o=Te+k+65535,k=Math.floor(o/65536),Te=o-k*65536,o=Ue+k+65535,k=Math.floor(o/65536),Ue=o-k*65536,o=Ne+k+65535,k=Math.floor(o/65536),Ne=o-k*65536,o=De+k+65535,k=Math.floor(o/65536),De=o-k*65536,o=Le+k+65535,k=Math.floor(o/65536),Le=o-k*65536,o=Ce+k+65535,k=Math.floor(o/65536),Ce=o-k*65536,o=Oe+k+65535,k=Math.floor(o/65536),Oe=o-k*65536,o=_e+k+65535,k=Math.floor(o/65536),_e=o-k*65536,P+=k-1+37*(k-1),h[0]=P,h[1]=$,h[2]=ae,h[3]=ce,h[4]=ze,h[5]=me,h[6]=Je,h[7]=xe,h[8]=Te,h[9]=Ue,h[10]=Ne,h[11]=De,h[12]=Le,h[13]=Ce,h[14]=Oe,h[15]=_e}function M(h,_){ge(h,_,_)}function D(h,_){var y=t(),o;for(o=0;o<16;o++)y[o]=_[o];for(o=253;o>=0;o--)M(y,y),o!==2&&o!==4&&ge(y,y,_);for(o=0;o<16;o++)h[o]=y[o]}function J(h,_){var y=t(),o;for(o=0;o<16;o++)y[o]=_[o];for(o=250;o>=0;o--)M(y,y),o!==1&&ge(y,y,_);for(o=0;o<16;o++)h[o]=y[o]}function de(h,_,y){var o=new Uint8Array(32),k=new Float64Array(80),P,$,ae=t(),ce=t(),ze=t(),me=t(),Je=t(),xe=t();for($=0;$<31;$++)o[$]=_[$];for(o[31]=_[31]&127|64,o[0]&=248,se(k,y),$=0;$<16;$++)ce[$]=k[$],me[$]=ae[$]=ze[$]=0;for(ae[0]=me[0]=1,$=254;$>=0;--$)P=o[$>>>3]>>>($&7)&1,he(ae,ce,P),he(ze,me,P),ue(Je,ae,ze),ke(ae,ae,ze),ue(ze,ce,me),ke(ce,ce,me),M(me,Je),M(xe,ae),ge(ae,ze,ae),ge(ze,ce,Je),ue(Je,ae,ze),ke(ae,ae,ze),M(ce,ae),ke(ze,me,xe),ge(ae,ze,f),ue(ae,ae,me),ge(ze,ze,ae),ge(ae,me,xe),ge(me,ce,k),M(ce,Je),he(ae,ce,P),he(ze,me,P);for($=0;$<16;$++)k[$+16]=ae[$],k[$+32]=ze[$],k[$+48]=ce[$],k[$+64]=me[$];var Te=k.subarray(32),Ue=k.subarray(16);return D(Te,Te),ge(Ue,Ue,Te),R(h,Ue),0}function we(h,_){return de(h,_,a)}function A(h,_){return i(_,32),we(h,_)}function B(h,_,y){var o=new Uint8Array(32);return de(o,y,_),S(h,s,o,q)}var Q=ye,fe=Ae;function Ze(h,_,y,o,k,P){var $=new Uint8Array(32);return B($,k,P),Q(h,_,y,o,$)}function qe(h,_,y,o,k,P){var $=new Uint8Array(32);return B($,k,P),fe(h,_,y,o,$)}var Ge=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function yr(h,_,y,o){for(var k=new Int32Array(16),P=new Int32Array(16),$,ae,ce,ze,me,Je,xe,Te,Ue,Ne,De,Le,Ce,Oe,_e,Be,ve,Ee,Se,pe,G,K,ie,te,oe,ne,je=h[0],Pe=h[1],$e=h[2],Fe=h[3],U=h[4],We=h[5],Qe=h[6],er=h[7],Ve=_[0],Ke=_[1],Ye=_[2],dr=_[3],ar=_[4],lr=_[5],ur=_[6],fr=_[7],hr=0;o>=128;){for(Se=0;Se<16;Se++)pe=8*Se+hr,k[Se]=y[pe+0]<<24|y[pe+1]<<16|y[pe+2]<<8|y[pe+3],P[Se]=y[pe+4]<<24|y[pe+5]<<16|y[pe+6]<<8|y[pe+7];for(Se=0;Se<80;Se++)if($=je,ae=Pe,ce=$e,ze=Fe,me=U,Je=We,xe=Qe,Te=er,Ue=Ve,Ne=Ke,De=Ye,Le=dr,Ce=ar,Oe=lr,_e=ur,Be=fr,G=er,K=fr,ie=K&65535,te=K>>>16,oe=G&65535,ne=G>>>16,G=(U>>>14|ar<<18)^(U>>>18|ar<<14)^(ar>>>9|U<<23),K=(ar>>>14|U<<18)^(ar>>>18|U<<14)^(U>>>9|ar<<23),ie+=K&65535,te+=K>>>16,oe+=G&65535,ne+=G>>>16,G=U&We^~U&Qe,K=ar&lr^~ar&ur,ie+=K&65535,te+=K>>>16,oe+=G&65535,ne+=G>>>16,G=Ge[Se*2],K=Ge[Se*2+1],ie+=K&65535,te+=K>>>16,oe+=G&65535,ne+=G>>>16,G=k[Se%16],K=P[Se%16],ie+=K&65535,te+=K>>>16,oe+=G&65535,ne+=G>>>16,te+=ie>>>16,oe+=te>>>16,ne+=oe>>>16,ve=oe&65535|ne<<16,Ee=ie&65535|te<<16,G=ve,K=Ee,ie=K&65535,te=K>>>16,oe=G&65535,ne=G>>>16,G=(je>>>28|Ve<<4)^(Ve>>>2|je<<30)^(Ve>>>7|je<<25),K=(Ve>>>28|je<<4)^(je>>>2|Ve<<30)^(je>>>7|Ve<<25),ie+=K&65535,te+=K>>>16,oe+=G&65535,ne+=G>>>16,G=je&Pe^je&$e^Pe&$e,K=Ve&Ke^Ve&Ye^Ke&Ye,ie+=K&65535,te+=K>>>16,oe+=G&65535,ne+=G>>>16,te+=ie>>>16,oe+=te>>>16,ne+=oe>>>16,Te=oe&65535|ne<<16,Be=ie&65535|te<<16,G=ze,K=Le,ie=K&65535,te=K>>>16,oe=G&65535,ne=G>>>16,G=ve,K=Ee,ie+=K&65535,te+=K>>>16,oe+=G&65535,ne+=G>>>16,te+=ie>>>16,oe+=te>>>16,ne+=oe>>>16,ze=oe&65535|ne<<16,Le=ie&65535|te<<16,Pe=$,$e=ae,Fe=ce,U=ze,We=me,Qe=Je,er=xe,je=Te,Ke=Ue,Ye=Ne,dr=De,ar=Le,lr=Ce,ur=Oe,fr=_e,Ve=Be,Se%16===15)for(pe=0;pe<16;pe++)G=k[pe],K=P[pe],ie=K&65535,te=K>>>16,oe=G&65535,ne=G>>>16,G=k[(pe+9)%16],K=P[(pe+9)%16],ie+=K&65535,te+=K>>>16,oe+=G&65535,ne+=G>>>16,ve=k[(pe+1)%16],Ee=P[(pe+1)%16],G=(ve>>>1|Ee<<31)^(ve>>>8|Ee<<24)^ve>>>7,K=(Ee>>>1|ve<<31)^(Ee>>>8|ve<<24)^(Ee>>>7|ve<<25),ie+=K&65535,te+=K>>>16,oe+=G&65535,ne+=G>>>16,ve=k[(pe+14)%16],Ee=P[(pe+14)%16],G=(ve>>>19|Ee<<13)^(Ee>>>29|ve<<3)^ve>>>6,K=(Ee>>>19|ve<<13)^(ve>>>29|Ee<<3)^(Ee>>>6|ve<<26),ie+=K&65535,te+=K>>>16,oe+=G&65535,ne+=G>>>16,te+=ie>>>16,oe+=te>>>16,ne+=oe>>>16,k[pe]=oe&65535|ne<<16,P[pe]=ie&65535|te<<16;G=je,K=Ve,ie=K&65535,te=K>>>16,oe=G&65535,ne=G>>>16,G=h[0],K=_[0],ie+=K&65535,te+=K>>>16,oe+=G&65535,ne+=G>>>16,te+=ie>>>16,oe+=te>>>16,ne+=oe>>>16,h[0]=je=oe&65535|ne<<16,_[0]=Ve=ie&65535|te<<16,G=Pe,K=Ke,ie=K&65535,te=K>>>16,oe=G&65535,ne=G>>>16,G=h[1],K=_[1],ie+=K&65535,te+=K>>>16,oe+=G&65535,ne+=G>>>16,te+=ie>>>16,oe+=te>>>16,ne+=oe>>>16,h[1]=Pe=oe&65535|ne<<16,_[1]=Ke=ie&65535|te<<16,G=$e,K=Ye,ie=K&65535,te=K>>>16,oe=G&65535,ne=G>>>16,G=h[2],K=_[2],ie+=K&65535,te+=K>>>16,oe+=G&65535,ne+=G>>>16,te+=ie>>>16,oe+=te>>>16,ne+=oe>>>16,h[2]=$e=oe&65535|ne<<16,_[2]=Ye=ie&65535|te<<16,G=Fe,K=dr,ie=K&65535,te=K>>>16,oe=G&65535,ne=G>>>16,G=h[3],K=_[3],ie+=K&65535,te+=K>>>16,oe+=G&65535,ne+=G>>>16,te+=ie>>>16,oe+=te>>>16,ne+=oe>>>16,h[3]=Fe=oe&65535|ne<<16,_[3]=dr=ie&65535|te<<16,G=U,K=ar,ie=K&65535,te=K>>>16,oe=G&65535,ne=G>>>16,G=h[4],K=_[4],ie+=K&65535,te+=K>>>16,oe+=G&65535,ne+=G>>>16,te+=ie>>>16,oe+=te>>>16,ne+=oe>>>16,h[4]=U=oe&65535|ne<<16,_[4]=ar=ie&65535|te<<16,G=We,K=lr,ie=K&65535,te=K>>>16,oe=G&65535,ne=G>>>16,G=h[5],K=_[5],ie+=K&65535,te+=K>>>16,oe+=G&65535,ne+=G>>>16,te+=ie>>>16,oe+=te>>>16,ne+=oe>>>16,h[5]=We=oe&65535|ne<<16,_[5]=lr=ie&65535|te<<16,G=Qe,K=ur,ie=K&65535,te=K>>>16,oe=G&65535,ne=G>>>16,G=h[6],K=_[6],ie+=K&65535,te+=K>>>16,oe+=G&65535,ne+=G>>>16,te+=ie>>>16,oe+=te>>>16,ne+=oe>>>16,h[6]=Qe=oe&65535|ne<<16,_[6]=ur=ie&65535|te<<16,G=er,K=fr,ie=K&65535,te=K>>>16,oe=G&65535,ne=G>>>16,G=h[7],K=_[7],ie+=K&65535,te+=K>>>16,oe+=G&65535,ne+=G>>>16,te+=ie>>>16,oe+=te>>>16,ne+=oe>>>16,h[7]=er=oe&65535|ne<<16,_[7]=fr=ie&65535|te<<16,hr+=128,o-=128}return o}function gr(h,_,y){var o=new Int32Array(8),k=new Int32Array(8),P=new Uint8Array(256),$,ae=y;for(o[0]=1779033703,o[1]=3144134277,o[2]=1013904242,o[3]=2773480762,o[4]=1359893119,o[5]=2600822924,o[6]=528734635,o[7]=1541459225,k[0]=4089235720,k[1]=2227873595,k[2]=4271175723,k[3]=1595750129,k[4]=2917565137,k[5]=725511199,k[6]=4215389547,k[7]=327033209,yr(o,k,_,y),y%=128,$=0;$<y;$++)P[$]=_[ae-y+$];for(P[y]=128,y=256-128*(y<112?1:0),P[y-9]=0,m(P,y-8,ae/536870912|0,ae<<3),yr(o,k,P,y),$=0;$<8;$++)m(h,8*$,o[$],k[$]);return 0}function Ar(h,_){var y=t(),o=t(),k=t(),P=t(),$=t(),ae=t(),ce=t(),ze=t(),me=t();ke(y,h[1],h[0]),ke(me,_[1],_[0]),ge(y,y,me),ue(o,h[0],h[1]),ue(me,_[0],_[1]),ge(o,o,me),ge(k,h[3],_[3]),ge(k,k,d),ge(P,h[2],_[2]),ue(P,P,P),ke($,o,y),ke(ae,P,k),ue(ce,P,k),ue(ze,o,y),ge(h[0],$,ae),ge(h[1],ze,ce),ge(h[2],ce,ae),ge(h[3],$,ze)}function sr(h,_,y){var o;for(o=0;o<4;o++)he(h[o],_[o],y)}function nr(h,_){var y=t(),o=t(),k=t();D(k,_[2]),ge(y,_[0],k),ge(o,_[1],k),R(h,o),h[31]^=X(y)<<7}function Rr(h,_,y){var o,k;for(Re(h[0],l),Re(h[1],n),Re(h[2],n),Re(h[3],l),k=255;k>=0;--k)o=y[k/8|0]>>(k&7)&1,sr(h,_,o),Ar(_,h),Ar(h,h),sr(h,_,o)}function Or(h,_){var y=[t(),t(),t(),t()];Re(y[0],w),Re(y[1],p),Re(y[2],n),ge(y[3],w,p),Rr(h,y,_)}function wr(h,_,y){var o=new Uint8Array(64),k=[t(),t(),t(),t()],P;for(y||i(_,32),gr(o,_,32),o[0]&=248,o[31]&=127,o[31]|=64,Or(k,o),nr(h,k),P=0;P<32;P++)_[P+32]=h[P];return 0}var qr=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function x(h,_){var y,o,k,P;for(o=63;o>=32;--o){for(y=0,k=o-32,P=o-12;k<P;++k)_[k]+=y-16*_[o]*qr[k-(o-32)],y=Math.floor((_[k]+128)/256),_[k]-=y*256;_[k]+=y,_[o]=0}for(y=0,k=0;k<32;k++)_[k]+=y-(_[31]>>4)*qr[k],y=_[k]>>8,_[k]&=255;for(k=0;k<32;k++)_[k]-=y*qr[k];for(o=0;o<32;o++)_[o+1]+=_[o]>>8,h[o]=_[o]&255}function c(h){var _=new Float64Array(64),y;for(y=0;y<64;y++)_[y]=h[y];for(y=0;y<64;y++)h[y]=0;x(h,_)}function u(h,_,y,o){var k=new Uint8Array(64),P=new Uint8Array(64),$=new Uint8Array(64),ae,ce,ze=new Float64Array(64),me=[t(),t(),t(),t()];gr(k,o,32),k[0]&=248,k[31]&=127,k[31]|=64;var Je=y+64;for(ae=0;ae<y;ae++)h[64+ae]=_[ae];for(ae=0;ae<32;ae++)h[32+ae]=k[32+ae];for(gr($,h.subarray(32),y+32),c($),Or(me,$),nr(h,me),ae=32;ae<64;ae++)h[ae]=o[ae];for(gr(P,h,y+64),c(P),ae=0;ae<64;ae++)ze[ae]=0;for(ae=0;ae<32;ae++)ze[ae]=$[ae];for(ae=0;ae<32;ae++)for(ce=0;ce<32;ce++)ze[ae+ce]+=P[ae]*k[ce];return x(h.subarray(32),ze),Je}function I(h,_){var y=t(),o=t(),k=t(),P=t(),$=t(),ae=t(),ce=t();return Re(h[2],n),se(h[1],_),M(k,h[1]),ge(P,k,b),ke(k,k,h[2]),ue(P,h[2],P),M($,P),M(ae,$),ge(ce,ae,$),ge(y,ce,k),ge(y,y,P),J(y,y),ge(y,y,k),ge(y,y,P),ge(y,y,P),ge(h[0],y,P),M(o,h[0]),ge(o,o,P),Y(o,k)&&ge(h[0],h[0],v),M(o,h[0]),ge(o,o,P),Y(o,k)?-1:(X(h[0])===_[31]>>7&&ke(h[0],l,h[0]),ge(h[3],h[0],h[1]),0)}function H(h,_,y,o){var k,P=new Uint8Array(32),$=new Uint8Array(64),ae=[t(),t(),t(),t()],ce=[t(),t(),t(),t()];if(y<64||I(ce,o))return-1;for(k=0;k<y;k++)h[k]=_[k];for(k=0;k<32;k++)h[k+32]=o[k];if(gr($,h,y),c($),Rr(ae,ce,$),Or(ce,_.subarray(32)),Ar(ae,ce),nr(P,ae),y-=64,E(_,0,P,0)){for(k=0;k<y;k++)h[k]=0;return-1}for(k=0;k<y;k++)h[k]=_[k+64];return y}var W=32,ee=24,He=32,tr=16,rr=32,or=32,Xe=32,jt=32,ma=32,oi=ee,zc=He,Ac=tr,Kr=64,ft=32,xt=64,ga=32,va=64;r.lowlevel={crypto_core_hsalsa20:S,crypto_stream_xor:N,crypto_stream:L,crypto_stream_salsa20_xor:F,crypto_stream_salsa20:V,crypto_onetimeauth:le,crypto_onetimeauth_verify:re,crypto_verify_16:z,crypto_verify_32:E,crypto_secretbox:ye,crypto_secretbox_open:Ae,crypto_scalarmult:de,crypto_scalarmult_base:we,crypto_box_beforenm:B,crypto_box_afternm:Q,crypto_box:Ze,crypto_box_open:qe,crypto_box_keypair:A,crypto_hash:gr,crypto_sign:u,crypto_sign_keypair:wr,crypto_sign_open:H,crypto_secretbox_KEYBYTES:W,crypto_secretbox_NONCEBYTES:ee,crypto_secretbox_ZEROBYTES:He,crypto_secretbox_BOXZEROBYTES:tr,crypto_scalarmult_BYTES:rr,crypto_scalarmult_SCALARBYTES:or,crypto_box_PUBLICKEYBYTES:Xe,crypto_box_SECRETKEYBYTES:jt,crypto_box_BEFORENMBYTES:ma,crypto_box_NONCEBYTES:oi,crypto_box_ZEROBYTES:zc,crypto_box_BOXZEROBYTES:Ac,crypto_sign_BYTES:Kr,crypto_sign_PUBLICKEYBYTES:ft,crypto_sign_SECRETKEYBYTES:xt,crypto_sign_SEEDBYTES:ga,crypto_hash_BYTES:va,gf:t,D:b,L:qr,pack25519:R,unpack25519:se,M:ge,A:ue,S:M,Z:ke,pow2523:J,add:Ar,set25519:Re,modL:x,scalarmult:Rr,scalarbase:Or};function ii(h,_){if(h.length!==W)throw new Error("bad key size");if(_.length!==ee)throw new Error("bad nonce size")}function Bc(h,_){if(h.length!==Xe)throw new Error("bad public key size");if(_.length!==jt)throw new Error("bad secret key size")}function Lr(){for(var h=0;h<arguments.length;h++)if(!(arguments[h]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function ni(h){for(var _=0;_<h.length;_++)h[_]=0}r.randomBytes=function(h){var _=new Uint8Array(h);return i(_,h),_},r.secretbox=function(h,_,y){Lr(h,_,y),ii(y,_);for(var o=new Uint8Array(He+h.length),k=new Uint8Array(o.length),P=0;P<h.length;P++)o[P+He]=h[P];return ye(k,o,o.length,_,y),k.subarray(tr)},r.secretbox.open=function(h,_,y){Lr(h,_,y),ii(y,_);for(var o=new Uint8Array(tr+h.length),k=new Uint8Array(o.length),P=0;P<h.length;P++)o[P+tr]=h[P];return o.length<32||Ae(k,o,o.length,_,y)!==0?null:k.subarray(He)},r.secretbox.keyLength=W,r.secretbox.nonceLength=ee,r.secretbox.overheadLength=tr,r.scalarMult=function(h,_){if(Lr(h,_),h.length!==or)throw new Error("bad n size");if(_.length!==rr)throw new Error("bad p size");var y=new Uint8Array(rr);return de(y,h,_),y},r.scalarMult.base=function(h){if(Lr(h),h.length!==or)throw new Error("bad n size");var _=new Uint8Array(rr);return we(_,h),_},r.scalarMult.scalarLength=or,r.scalarMult.groupElementLength=rr,r.box=function(h,_,y,o){var k=r.box.before(y,o);return r.secretbox(h,_,k)},r.box.before=function(h,_){Lr(h,_),Bc(h,_);var y=new Uint8Array(ma);return B(y,h,_),y},r.box.after=r.secretbox,r.box.open=function(h,_,y,o){var k=r.box.before(y,o);return r.secretbox.open(h,_,k)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var h=new Uint8Array(Xe),_=new Uint8Array(jt);return A(h,_),{publicKey:h,secretKey:_}},r.box.keyPair.fromSecretKey=function(h){if(Lr(h),h.length!==jt)throw new Error("bad secret key size");var _=new Uint8Array(Xe);return we(_,h),{publicKey:_,secretKey:new Uint8Array(h)}},r.box.publicKeyLength=Xe,r.box.secretKeyLength=jt,r.box.sharedKeyLength=ma,r.box.nonceLength=oi,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(h,_){if(Lr(h,_),_.length!==xt)throw new Error("bad secret key size");var y=new Uint8Array(Kr+h.length);return u(y,h,h.length,_),y},r.sign.open=function(h,_){if(Lr(h,_),_.length!==ft)throw new Error("bad public key size");var y=new Uint8Array(h.length),o=H(y,h,h.length,_);if(o<0)return null;for(var k=new Uint8Array(o),P=0;P<k.length;P++)k[P]=y[P];return k},r.sign.detached=function(h,_){for(var y=r.sign(h,_),o=new Uint8Array(Kr),k=0;k<o.length;k++)o[k]=y[k];return o},r.sign.detached.verify=function(h,_,y){if(Lr(h,_,y),_.length!==Kr)throw new Error("bad signature size");if(y.length!==ft)throw new Error("bad public key size");var o=new Uint8Array(Kr+h.length),k=new Uint8Array(Kr+h.length),P;for(P=0;P<Kr;P++)o[P]=_[P];for(P=0;P<h.length;P++)o[P+Kr]=h[P];return H(k,o,o.length,y)>=0},r.sign.keyPair=function(){var h=new Uint8Array(ft),_=new Uint8Array(xt);return wr(h,_),{publicKey:h,secretKey:_}},r.sign.keyPair.fromSecretKey=function(h){if(Lr(h),h.length!==xt)throw new Error("bad secret key size");for(var _=new Uint8Array(ft),y=0;y<_.length;y++)_[y]=h[32+y];return{publicKey:_,secretKey:new Uint8Array(h)}},r.sign.keyPair.fromSeed=function(h){if(Lr(h),h.length!==ga)throw new Error("bad seed size");for(var _=new Uint8Array(ft),y=new Uint8Array(xt),o=0;o<32;o++)y[o]=h[o];return wr(_,y,!0),{publicKey:_,secretKey:y}},r.sign.publicKeyLength=ft,r.sign.secretKeyLength=xt,r.sign.seedLength=ga,r.sign.signatureLength=Kr,r.hash=function(h){Lr(h);var _=new Uint8Array(va);return gr(_,h,h.length),_},r.hash.hashLength=va,r.verify=function(h,_){return Lr(h,_),h.length===0||_.length===0||h.length!==_.length?!1:g(h,0,_,0,h.length)===0},r.setPRNG=function(h){i=h},function(){var h=typeof self<"u"?self.crypto||self.msCrypto:null;if(h&&h.getRandomValues){var _=65536;r.setPRNG(function(y,o){var k,P=new Uint8Array(o);for(k=0;k<o;k+=_)h.getRandomValues(P.subarray(k,k+Math.min(o-k,_)));for(k=0;k<o;k++)y[k]=P[k];ni(P)})}else typeof qc<"u"&&(h=$n,h&&h.randomBytes&&r.setPRNG(function(y,o){var k,P=h.randomBytes(o);for(k=0;k<o;k++)y[k]=P[k];ni(P)}))}()})(e.exports?e.exports:self.nacl=self.nacl||{})}(ya)),ya.exports}var Cc=Gn();const ko=Vn(Cc);var ct=(e=>(e.USER="user",e.ADMIN="admin",e))(ct||{});const Kn=new Pt.Schema({bio:{type:String,default:""},banner:{type:String,default:""},userid:{type:String,default:""},image:{type:String,default:""},metaInfo:{website:{type:String,default:""},twitter:{type:String,default:""},telegram:{type:String,default:""},discord:{type:String,default:""}},lastNetwork:{type:String,default:""},lastSignedIn:{type:Date,default:Date.now},lastAddress:{type:String,default:""},followers:[{type:Pt.Schema.Types.ObjectId,ref:"UserProfile"}],users:[{name:{type:String,default:"",required:!0},chainId:{type:Number,required:!0},network:{type:String,enum:Object.values(mt.NetworkSymbols),required:!0},address:{type:String,required:!0},social:{type:String,default:""},provider:{type:String,default:""},image:{type:String,default:"",required:!0},role:{type:String,default:ct.USER,enum:Object.values(ct)}}]},{timestamps:!0,toObject:{getters:!0,versionKey:!1,transform:(e,r)=>(r.id=r._id.toString(),delete r._id,r)}});Kn.index({"users.network":1,"users.address":1},{unique:!0});var Fn;const Gt=((Fn=Pt.models)==null?void 0:Fn.UserProfile)||Pt.model("UserProfile",Kn),yt={connection:null,promise:null},Yn=async(e={uri:process.env.MONGO_URI||"",options:{}})=>{try{if(!e.uri)throw new Error("MONGO_URI environment variable is not set");if(yt.connection)return;if(!yt.promise){const r={};yt.promise=Pt.connect(e.uri,r)}try{yt.connection=await yt.promise,console.log("Connected to MongoDB successfully")}catch(r){throw yt.promise=null,r}}catch(r){throw console.error("MongoDB connection error:",r),r}};var wa={exports:{}},_a,li;function Mc(){if(li)return _a;li=1;var e=1;function r(){return e=(e*9301+49297)%233280,e/233280}function t(i){e=i}return _a={nextValue:r,seed:t},_a}var Ea,ui;function ha(){if(ui)return Ea;ui=1;var e=Mc(),r="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-",t,i,s;function a(){s=!1}function l(v){if(!v){t!==r&&(t=r,a());return}if(v!==t){if(v.length!==r.length)throw new Error("Custom alphabet for shortid must be "+r.length+" unique characters. You submitted "+v.length+" characters: "+v);var m=v.split("").filter(function(g,z,E){return z!==E.lastIndexOf(g)});if(m.length)throw new Error("Custom alphabet for shortid must be "+r.length+" unique characters. These characters were not unique: "+m.join(", "));t=v,a()}}function n(v){return l(v),t}function f(v){e.seed(v),i!==v&&(a(),i=v)}function b(){t||l(r);for(var v=t.split(""),m=[],g=e.nextValue(),z;v.length>0;)g=e.nextValue(),z=Math.floor(g*v.length),m.push(v.splice(z,1)[0]);return m.join("")}function d(){return s||(s=b(),s)}function w(v){var m=d();return m[v]}function p(){return t||r}return Ea={get:p,characters:n,seed:f,lookup:w,shuffled:d},Ea}var ka,fi;function Hc(){if(fi)return ka;fi=1;var e=typeof window=="object"&&(window.crypto||window.msCrypto),r;return!e||!e.getRandomValues?r=function(t){for(var i=[],s=0;s<t;s++)i.push(Math.floor(Math.random()*256));return i}:r=function(t){return e.getRandomValues(new Uint8Array(t))},ka=r,ka}let Dc="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",Zn=e=>crypto.getRandomValues(new Uint8Array(e)),Xn=(e,r,t)=>{let i=(2<<Math.log(e.length-1)/Math.LN2)-1,s=-~(1.6*i*r/e.length);return(a=r)=>{let l="";for(;;){let n=t(s),f=s|0;for(;f--;)if(l+=e[n[f]&i]||"",l.length===a)return l}}},Nc=(e,r=21)=>Xn(e,r,Zn),Pc=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((r,t)=>(t&=63,t<36?r+=t.toString(36):t<62?r+=(t-26).toString(36).toUpperCase():t>62?r+="-":r+="_",r),"");const Fc=Object.freeze(Object.defineProperty({__proto__:null,customAlphabet:Nc,customRandom:Xn,nanoid:Pc,random:Zn,urlAlphabet:Dc},Symbol.toStringTag,{value:"Module"})),$c=Wn(Fc);var Sa,di;function Vc(){if(di)return Sa;di=1;var e=ha(),r=Hc(),t=$c.customRandom;function i(s){for(var a=0,l,n="";!l;)n=n+t(e.get(),1,r)(),l=s<Math.pow(16,a+1),a++;return n}return Sa=i,Sa}var za,hi;function Wc(){if(hi)return za;hi=1;var e=Vc();ha();var r=1567752802062,t=7,i,s;function a(l){var n="",f=Math.floor((Date.now()-r)*.001);return f===s?i++:(i=0,s=f),n=n+e(t),n=n+e(l),i>0&&(n=n+e(i)),n=n+e(f),n}return za=a,za}var Aa,pi;function Gc(){if(pi)return Aa;pi=1;var e=ha();function r(t){if(!t||typeof t!="string"||t.length<6)return!1;var i=new RegExp("[^"+e.get().replace(/[|\\{}()[\]^$+*?.-]/g,"\\$&")+"]");return!i.test(t)}return Aa=r,Aa}var Ba,bi;function Kc(){return bi||(bi=1,Ba=0),Ba}var mi;function Yc(){return mi||(mi=1,function(e){var r=ha(),t=Wc(),i=Gc(),s=Kc()||0;function a(b){return r.seed(b),e.exports}function l(b){return s=b,e.exports}function n(b){return b!==void 0&&r.characters(b),r.shuffled()}function f(){return t(s)}e.exports=f,e.exports.generate=f,e.exports.seed=a,e.exports.worker=l,e.exports.characters=n,e.exports.isValid=i}(wa)),wa.exports}var Ia,gi;function Zc(){return gi||(gi=1,Ia=Yc()),Ia}var Xc=Zc();const Jc=Vn(Xc);var Cr={},Hr={},ir={},Sr={},ja={},Rt={},vi;function Qc(){return vi||(vi=1,Object.defineProperty(Rt,"__esModule",{value:!0}),Rt.crypto=void 0,Rt.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),Rt}var xi;function Vt(){return xi||(xi=1,function(e){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.Hash=e.nextTick=e.swap32IfBE=e.byteSwapIfBE=e.swap8IfBE=e.isLE=void 0,e.isBytes=t,e.anumber=i,e.abytes=s,e.ahash=a,e.aexists=l,e.aoutput=n,e.u8=f,e.u32=b,e.clean=d,e.createView=w,e.rotr=p,e.rotl=v,e.byteSwap=m,e.byteSwap32=g,e.bytesToHex=C,e.hexToBytes=S,e.asyncLoop=F,e.utf8ToBytes=V,e.bytesToUtf8=L,e.toBytes=N,e.kdfInputToBytes=Z,e.concatBytes=le,e.checkOpts=re,e.createHasher=Ae,e.createOptHasher=Re,e.createXOFer=Ie,e.randomBytes=he;const r=Qc();function t(R){return R instanceof Uint8Array||ArrayBuffer.isView(R)&&R.constructor.name==="Uint8Array"}function i(R){if(!Number.isSafeInteger(R)||R<0)throw new Error("positive integer expected, got "+R)}function s(R,...Y){if(!t(R))throw new Error("Uint8Array expected");if(Y.length>0&&!Y.includes(R.length))throw new Error("Uint8Array expected of length "+Y+", got length="+R.length)}function a(R){if(typeof R!="function"||typeof R.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");i(R.outputLen),i(R.blockLen)}function l(R,Y=!0){if(R.destroyed)throw new Error("Hash instance has been destroyed");if(Y&&R.finished)throw new Error("Hash#digest() has already been called")}function n(R,Y){s(R);const X=Y.outputLen;if(R.length<X)throw new Error("digestInto() expects output buffer of length at least "+X)}function f(R){return new Uint8Array(R.buffer,R.byteOffset,R.byteLength)}function b(R){return new Uint32Array(R.buffer,R.byteOffset,Math.floor(R.byteLength/4))}function d(...R){for(let Y=0;Y<R.length;Y++)R[Y].fill(0)}function w(R){return new DataView(R.buffer,R.byteOffset,R.byteLength)}function p(R,Y){return R<<32-Y|R>>>Y}function v(R,Y){return R<<Y|R>>>32-Y>>>0}e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function m(R){return R<<24&4278190080|R<<8&16711680|R>>>8&65280|R>>>24&255}e.swap8IfBE=e.isLE?R=>R:R=>m(R),e.byteSwapIfBE=e.swap8IfBE;function g(R){for(let Y=0;Y<R.length;Y++)R[Y]=m(R[Y]);return R}e.swap32IfBE=e.isLE?R=>R:g;const z=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",E=Array.from({length:256},(R,Y)=>Y.toString(16).padStart(2,"0"));function C(R){if(s(R),z)return R.toHex();let Y="";for(let X=0;X<R.length;X++)Y+=E[R[X]];return Y}const O={_0:48,_9:57,A:65,F:70,a:97,f:102};function j(R){if(R>=O._0&&R<=O._9)return R-O._0;if(R>=O.A&&R<=O.F)return R-(O.A-10);if(R>=O.a&&R<=O.f)return R-(O.a-10)}function S(R){if(typeof R!="string")throw new Error("hex string expected, got "+typeof R);if(z)return Uint8Array.fromHex(R);const Y=R.length,X=Y/2;if(Y%2)throw new Error("hex string expected, got unpadded hex of length "+Y);const se=new Uint8Array(X);for(let ue=0,ke=0;ue<X;ue++,ke+=2){const ge=j(R.charCodeAt(ke)),M=j(R.charCodeAt(ke+1));if(ge===void 0||M===void 0){const D=R[ke]+R[ke+1];throw new Error('hex string expected, got non-hex character "'+D+'" at index '+ke)}se[ue]=ge*16+M}return se}const q=async()=>{};e.nextTick=q;async function F(R,Y,X){let se=Date.now();for(let ue=0;ue<R;ue++){X(ue);const ke=Date.now()-se;ke>=0&&ke<Y||(await(0,e.nextTick)(),se+=ke)}}function V(R){if(typeof R!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(R))}function L(R){return new TextDecoder().decode(R)}function N(R){return typeof R=="string"&&(R=V(R)),s(R),R}function Z(R){return typeof R=="string"&&(R=V(R)),s(R),R}function le(...R){let Y=0;for(let se=0;se<R.length;se++){const ue=R[se];s(ue),Y+=ue.length}const X=new Uint8Array(Y);for(let se=0,ue=0;se<R.length;se++){const ke=R[se];X.set(ke,ue),ue+=ke.length}return X}function re(R,Y){if(Y!==void 0&&{}.toString.call(Y)!=="[object Object]")throw new Error("options should be object or undefined");return Object.assign(R,Y)}class ye{}e.Hash=ye;function Ae(R){const Y=se=>R().update(N(se)).digest(),X=R();return Y.outputLen=X.outputLen,Y.blockLen=X.blockLen,Y.create=()=>R(),Y}function Re(R){const Y=(se,ue)=>R(ue).update(N(se)).digest(),X=R({});return Y.outputLen=X.outputLen,Y.blockLen=X.blockLen,Y.create=se=>R(se),Y}function Ie(R){const Y=(se,ue)=>R(ue).update(N(se)).digest(),X=R({});return Y.outputLen=X.outputLen,Y.blockLen=X.blockLen,Y.create=se=>R(se),Y}e.wrapConstructor=Ae,e.wrapConstructorWithOpts=Re,e.wrapXOFConstructorWithOpts=Ie;function he(R=32){if(r.crypto&&typeof r.crypto.getRandomValues=="function")return r.crypto.getRandomValues(new Uint8Array(R));if(r.crypto&&typeof r.crypto.randomBytes=="function")return Uint8Array.from(r.crypto.randomBytes(R));throw new Error("crypto.getRandomValues must be defined")}}(ja)),ja}var yi;function el(){if(yi)return Sr;yi=1,Object.defineProperty(Sr,"__esModule",{value:!0}),Sr.SHA512_IV=Sr.SHA384_IV=Sr.SHA224_IV=Sr.SHA256_IV=Sr.HashMD=void 0,Sr.setBigUint64=r,Sr.Chi=t,Sr.Maj=i;const e=Vt();function r(a,l,n,f){if(typeof a.setBigUint64=="function")return a.setBigUint64(l,n,f);const b=BigInt(32),d=BigInt(4294967295),w=Number(n>>b&d),p=Number(n&d),v=f?4:0,m=f?0:4;a.setUint32(l+v,w,f),a.setUint32(l+m,p,f)}function t(a,l,n){return a&l^~a&n}function i(a,l,n){return a&l^a&n^l&n}class s extends e.Hash{constructor(l,n,f,b){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=l,this.outputLen=n,this.padOffset=f,this.isLE=b,this.buffer=new Uint8Array(l),this.view=(0,e.createView)(this.buffer)}update(l){(0,e.aexists)(this),l=(0,e.toBytes)(l),(0,e.abytes)(l);const{view:n,buffer:f,blockLen:b}=this,d=l.length;for(let w=0;w<d;){const p=Math.min(b-this.pos,d-w);if(p===b){const v=(0,e.createView)(l);for(;b<=d-w;w+=b)this.process(v,w);continue}f.set(l.subarray(w,w+p),this.pos),this.pos+=p,w+=p,this.pos===b&&(this.process(n,0),this.pos=0)}return this.length+=l.length,this.roundClean(),this}digestInto(l){(0,e.aexists)(this),(0,e.aoutput)(l,this),this.finished=!0;const{buffer:n,view:f,blockLen:b,isLE:d}=this;let{pos:w}=this;n[w++]=128,(0,e.clean)(this.buffer.subarray(w)),this.padOffset>b-w&&(this.process(f,0),w=0);for(let z=w;z<b;z++)n[z]=0;r(f,b-8,BigInt(this.length*8),d),this.process(f,0);const p=(0,e.createView)(l),v=this.outputLen;if(v%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const m=v/4,g=this.get();if(m>g.length)throw new Error("_sha2: outputLen bigger than state");for(let z=0;z<m;z++)p.setUint32(4*z,g[z],d)}digest(){const{buffer:l,outputLen:n}=this;this.digestInto(l);const f=l.slice(0,n);return this.destroy(),f}_cloneInto(l){l||(l=new this.constructor),l.set(...this.get());const{blockLen:n,buffer:f,length:b,finished:d,destroyed:w,pos:p}=this;return l.destroyed=w,l.finished=d,l.length=b,l.pos=p,b%n&&l.buffer.set(f),l}clone(){return this._cloneInto()}}return Sr.HashMD=s,Sr.SHA256_IV=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Sr.SHA224_IV=Uint32Array.from([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),Sr.SHA384_IV=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839