@privy-io/react-auth 1.20.3-beta.2 → 1.20.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var El=Object.create;var go=Object.defineProperty;var xl=Object.getOwnPropertyDescriptor;var _l=Object.getOwnPropertyNames;var Ll=Object.getPrototypeOf,Sl=Object.prototype.hasOwnProperty;var Rn=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ie=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),In=(e,t)=>{for(var o in t)go(e,o,{get:t[o],enumerable:!0})},Mn=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of _l(t))!Sl.call(e,n)&&n!==o&&go(e,n,{get:()=>t[n],enumerable:!(r=xl(t,n))||r.enumerable});return e};var Pl=(e,t,o)=>(o=e!=null?El(Ll(e)):{},Mn(t||!e||!e.__esModule?go(o,"default",{value:e,enumerable:!0}):o,e)),On=e=>Mn(go({},"__esModule",{value:!0}),e);var To=Ie((Gu,Ao)=>{var gi,bi,yi,vi,wi,Ci,Ei,xi,_i,Po,kr,Li,Si,Pi,Et,ki,Ai,Ti,Wi,Ri,Ii,Mi,Oi,Ni,ko;(function(e){var t=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:{};typeof define=="function"&&define.amd?define("tslib",["exports"],function(r){e(o(t,o(r)))}):typeof Ao=="object"&&typeof Ao.exports=="object"?e(o(t,o(Ao.exports))):e(o(t));function o(r,n){return r!==t&&(typeof Object.create=="function"?Object.defineProperty(r,"__esModule",{value:!0}):r.__esModule=!0),function(i,a){return r[i]=n?n(i,a):a}}})(function(e){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])};gi=function(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(r,n);function i(){this.constructor=r}r.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)},bi=Object.assign||function(r){for(var n,i=1,a=arguments.length;i<a;i++){n=arguments[i];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])}return r},yi=function(r,n){var i={};for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&n.indexOf(a)<0&&(i[a]=r[a]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,a=Object.getOwnPropertySymbols(r);s<a.length;s++)n.indexOf(a[s])<0&&Object.prototype.propertyIsEnumerable.call(r,a[s])&&(i[a[s]]=r[a[s]]);return i},vi=function(r,n,i,a){var s=arguments.length,l=s<3?n:a===null?a=Object.getOwnPropertyDescriptor(n,i):a,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(r,n,i,a);else for(var h=r.length-1;h>=0;h--)(d=r[h])&&(l=(s<3?d(l):s>3?d(n,i,l):d(n,i))||l);return s>3&&l&&Object.defineProperty(n,i,l),l},wi=function(r,n){return function(i,a){n(i,a,r)}},Ci=function(r,n){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,n)},Ei=function(r,n,i,a){function s(l){return l instanceof i?l:new i(function(d){d(l)})}return new(i||(i=Promise))(function(l,d){function h(g){try{p(a.next(g))}catch(b){d(b)}}function m(g){try{p(a.throw(g))}catch(b){d(b)}}function p(g){g.done?l(g.value):s(g.value).then(h,m)}p((a=a.apply(r,n||[])).next())})},xi=function(r,n){var i={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},a,s,l,d;return d={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function h(p){return function(g){return m([p,g])}}function m(p){if(a)throw new TypeError("Generator is already executing.");for(;i;)try{if(a=1,s&&(l=p[0]&2?s.return:p[0]?s.throw||((l=s.return)&&l.call(s),0):s.next)&&!(l=l.call(s,p[1])).done)return l;switch(s=0,l&&(p=[p[0]&2,l.value]),p[0]){case 0:case 1:l=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,s=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(l=i.trys,!(l=l.length>0&&l[l.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!l||p[1]>l[0]&&p[1]<l[3])){i.label=p[1];break}if(p[0]===6&&i.label<l[1]){i.label=l[1],l=p;break}if(l&&i.label<l[2]){i.label=l[2],i.ops.push(p);break}l[2]&&i.ops.pop(),i.trys.pop();continue}p=n.call(r,i)}catch(g){p=[6,g],s=0}finally{a=l=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},_i=function(r,n){for(var i in r)i!=="default"&&!Object.prototype.hasOwnProperty.call(n,i)&&ko(n,r,i)},ko=Object.create?function(r,n,i,a){a===void 0&&(a=i);var s=Object.getOwnPropertyDescriptor(n,i);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[i]}}),Object.defineProperty(r,a,s)}:function(r,n,i,a){a===void 0&&(a=i),r[a]=n[i]},Po=function(r){var n=typeof Symbol=="function"&&Symbol.iterator,i=n&&r[n],a=0;if(i)return i.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&a>=r.length&&(r=void 0),{value:r&&r[a++],done:!r}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},kr=function(r,n){var i=typeof Symbol=="function"&&r[Symbol.iterator];if(!i)return r;var a=i.call(r),s,l=[],d;try{for(;(n===void 0||n-- >0)&&!(s=a.next()).done;)l.push(s.value)}catch(h){d={error:h}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(d)throw d.error}}return l},Li=function(){for(var r=[],n=0;n<arguments.length;n++)r=r.concat(kr(arguments[n]));return r},Si=function(){for(var r=0,n=0,i=arguments.length;n<i;n++)r+=arguments[n].length;for(var a=Array(r),s=0,n=0;n<i;n++)for(var l=arguments[n],d=0,h=l.length;d<h;d++,s++)a[s]=l[d];return a},Pi=function(r,n,i){if(i||arguments.length===2)for(var a=0,s=n.length,l;a<s;a++)(l||!(a in n))&&(l||(l=Array.prototype.slice.call(n,0,a)),l[a]=n[a]);return r.concat(l||Array.prototype.slice.call(n))},Et=function(r){return this instanceof Et?(this.v=r,this):new Et(r)},ki=function(r,n,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var a=i.apply(r,n||[]),s,l=[];return s={},d("next"),d("throw"),d("return"),s[Symbol.asyncIterator]=function(){return this},s;function d(c){a[c]&&(s[c]=function(y){return new Promise(function(v,W){l.push([c,y,v,W])>1||h(c,y)})})}function h(c,y){try{m(a[c](y))}catch(v){b(l[0][3],v)}}function m(c){c.value instanceof Et?Promise.resolve(c.value.v).then(p,g):b(l[0][2],c)}function p(c){h("next",c)}function g(c){h("throw",c)}function b(c,y){c(y),l.shift(),l.length&&h(l[0][0],l[0][1])}},Ai=function(r){var n,i;return n={},a("next"),a("throw",function(s){throw s}),a("return"),n[Symbol.iterator]=function(){return this},n;function a(s,l){n[s]=r[s]?function(d){return(i=!i)?{value:Et(r[s](d)),done:s==="return"}:l?l(d):d}:l}},Ti=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r[Symbol.asyncIterator],i;return n?n.call(r):(r=typeof Po=="function"?Po(r):r[Symbol.iterator](),i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i);function a(l){i[l]=r[l]&&function(d){return new Promise(function(h,m){d=r[l](d),s(h,m,d.done,d.value)})}}function s(l,d,h,m){Promise.resolve(m).then(function(p){l({value:p,done:h})},d)}},Wi=function(r,n){return Object.defineProperty?Object.defineProperty(r,"raw",{value:n}):r.raw=n,r};var o=Object.create?function(r,n){Object.defineProperty(r,"default",{enumerable:!0,value:n})}:function(r,n){r.default=n};Ri=function(r){if(r&&r.__esModule)return r;var n={};if(r!=null)for(var i in r)i!=="default"&&Object.prototype.hasOwnProperty.call(r,i)&&ko(n,r,i);return o(n,r),n},Ii=function(r){return r&&r.__esModule?r:{default:r}},Mi=function(r,n,i,a){if(i==="a"&&!a)throw new TypeError("Private accessor was defined without a getter");if(typeof n=="function"?r!==n||!a:!n.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?a:i==="a"?a.call(r):a?a.value:n.get(r)},Oi=function(r,n,i,a,s){if(a==="m")throw new TypeError("Private method is not writable");if(a==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof n=="function"?r!==n||!s:!n.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return a==="a"?s.call(r,i):s?s.value=i:n.set(r,i),i},Ni=function(r,n){if(n===null||typeof n!="object"&&typeof n!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof r=="function"?n===r:r.has(n)},e("__extends",gi),e("__assign",bi),e("__rest",yi),e("__decorate",vi),e("__param",wi),e("__metadata",Ci),e("__awaiter",Ei),e("__generator",xi),e("__exportStar",_i),e("__createBinding",ko),e("__values",Po),e("__read",kr),e("__spread",Li),e("__spreadArrays",Si),e("__spreadArray",Pi),e("__await",Et),e("__asyncGenerator",ki),e("__asyncDelegator",Ai),e("__asyncValues",Ti),e("__makeTemplateObject",Wi),e("__importStar",Ri),e("__importDefault",Ii),e("__classPrivateFieldGet",Mi),e("__classPrivateFieldSet",Oi),e("__classPrivateFieldIn",Ni)})});var Ar=Ie(O=>{"use strict";Object.defineProperty(O,"__esModule",{value:!0});O.getLocalStorage=O.getLocalStorageOrThrow=O.getCrypto=O.getCryptoOrThrow=O.getLocation=O.getLocationOrThrow=O.getNavigator=O.getNavigatorOrThrow=O.getDocument=O.getDocumentOrThrow=O.getFromWindowOrThrow=O.getFromWindow=void 0;function ot(e){let t;return typeof window<"u"&&typeof window[e]<"u"&&(t=window[e]),t}O.getFromWindow=ot;function xt(e){let t=ot(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}O.getFromWindowOrThrow=xt;function Ql(){return xt("document")}O.getDocumentOrThrow=Ql;function ec(){return ot("document")}O.getDocument=ec;function tc(){return xt("navigator")}O.getNavigatorOrThrow=tc;function oc(){return ot("navigator")}O.getNavigator=oc;function rc(){return xt("location")}O.getLocationOrThrow=rc;function nc(){return ot("location")}O.getLocation=nc;function ic(){return xt("crypto")}O.getCryptoOrThrow=ic;function ac(){return ot("crypto")}O.getCrypto=ac;function sc(){return xt("localStorage")}O.getLocalStorageOrThrow=sc;function lc(){return ot("localStorage")}O.getLocalStorage=lc});var Ui=Ie(Wo=>{"use strict";Object.defineProperty(Wo,"__esModule",{value:!0});Wo.getWindowMetadata=void 0;var Di=Ar();function cc(){let e,t;try{e=Di.getDocumentOrThrow(),t=Di.getLocationOrThrow()}catch{return null}function o(){let m=e.getElementsByTagName("link"),p=[];for(let g=0;g<m.length;g++){let b=m[g],c=b.getAttribute("rel");if(c&&c.toLowerCase().indexOf("icon")>-1){let y=b.getAttribute("href");if(y)if(y.toLowerCase().indexOf("https:")===-1&&y.toLowerCase().indexOf("http:")===-1&&y.indexOf("//")!==0){let v=t.protocol+"//"+t.host;if(y.indexOf("/")===0)v+=y;else{let W=t.pathname.split("/");W.pop(),v+=W.join("/")+"/"+y}p.push(v)}else if(y.indexOf("//")===0){let v=t.protocol+y;p.push(v)}else p.push(y)}}return p}function r(...m){let p=e.getElementsByTagName("meta");for(let g=0;g<p.length;g++){let b=p[g],c=["itemprop","property","name"].map(y=>b.getAttribute(y)).filter(y=>y?m.includes(y):!1);if(c.length&&c){let y=b.getAttribute("content");if(y)return y}}return""}function n(){let m=r("name","og:site_name","og:title","twitter:title");return m||(m=e.title),m}function i(){return r("description","og:description","twitter:description","keywords")}let a=n(),s=i(),l=t.origin,d=o();return{description:s,url:l,icons:d,name:a}}Wo.getWindowMetadata=cc});var Ki={};In(Ki,{BotInfo:()=>ji,BrowserInfo:()=>Gi,NodeInfo:()=>Hi,ReactNativeInfo:()=>$i,SearchBotDeviceInfo:()=>Vi,browserName:()=>hc,detect:()=>mc,detectOS:()=>qi,getNodeVersion:()=>Zi,parseUserAgent:()=>Tr});function mc(e){return e?Tr(e):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new $i:typeof navigator<"u"?Tr(navigator.userAgent):Zi()}function zi(e){return e!==""&&fc.reduce(function(t,o){var r=o[0],n=o[1];if(t)return t;var i=n.exec(e);return!!i&&[r,i]},!1)}function hc(e){var t=zi(e);return t?t[0]:null}function Tr(e){var t=zi(e);if(!t)return null;var o=t[0],r=t[1];if(o==="searchbot")return new ji;var n=r[1]&&r[1].split(/[._]/).slice(0,3);n?n.length<Bi&&(n=dc(n,gc(Bi-n.length))):n=[];var i=n.join("."),a=qi(e),s=uc.exec(e);return s&&s[1]?new Vi(o,i,a,s[1]):new Gi(o,i,a)}function qi(e){for(var t=0,o=Fi.length;t<o;t++){var r=Fi[t],n=r[0],i=r[1],a=i.exec(e);if(a)return n}return null}function Zi(){var e=typeof process<"u"&&process.version;return e?new Hi(process.version.slice(1)):null}function gc(e){for(var t=[],o=0;o<e;o++)t.push("0");return t}var dc,Gi,Hi,Vi,ji,$i,pc,uc,Bi,fc,Fi,Ji=Rn(()=>{dc=function(){for(var e=0,t=0,o=arguments.length;t<o;t++)e+=arguments[t].length;for(var r=Array(e),n=0,t=0;t<o;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,n++)r[n]=i[a];return r},Gi=function(){function e(t,o,r){this.name=t,this.version=o,this.os=r,this.type="browser"}return e}(),Hi=function(){function e(t){this.version=t,this.type="node",this.name="node",this.os=process.platform}return e}(),Vi=function(){function e(t,o,r,n){this.name=t,this.version=o,this.os=r,this.bot=n,this.type="bot-device"}return e}(),ji=function(){function e(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return e}(),$i=function(){function e(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return e}(),pc=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,uc=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Bi=3,fc=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["searchbot",pc]],Fi=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]]});var Rr=Ie(x=>{"use strict";Object.defineProperty(x,"__esModule",{value:!0});x.getClientMeta=x.getLocalStorage=x.getLocalStorageOrThrow=x.getCrypto=x.getCryptoOrThrow=x.getLocation=x.getLocationOrThrow=x.getNavigator=x.getNavigatorOrThrow=x.getDocument=x.getDocumentOrThrow=x.getFromWindowOrThrow=x.getFromWindow=x.isBrowser=x.isNode=x.isMobile=x.isIOS=x.isAndroid=x.detectOS=x.detectEnv=void 0;var Yi=To(),bc=Yi.__importStar(Ui()),Ce=Yi.__importStar(Ar()),yc=(Ji(),On(Ki));function Wr(e){return(0,yc.detect)(e)}x.detectEnv=Wr;function Ro(){let e=Wr();return e&&e.os?e.os:void 0}x.detectOS=Ro;function Xi(){let e=Ro();return e?e.toLowerCase().includes("android"):!1}x.isAndroid=Xi;function Qi(){let e=Ro();return e?e.toLowerCase().includes("ios")||e.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}x.isIOS=Qi;function vc(){return Ro()?Xi()||Qi():!1}x.isMobile=vc;function ea(){let e=Wr();return e&&e.name?e.name.toLowerCase()==="node":!1}x.isNode=ea;function wc(){return!ea()&&!!(0,x.getNavigator)()}x.isBrowser=wc;x.getFromWindow=Ce.getFromWindow;x.getFromWindowOrThrow=Ce.getFromWindowOrThrow;x.getDocumentOrThrow=Ce.getDocumentOrThrow;x.getDocument=Ce.getDocument;x.getNavigatorOrThrow=Ce.getNavigatorOrThrow;x.getNavigator=Ce.getNavigator;x.getLocationOrThrow=Ce.getLocationOrThrow;x.getLocation=Ce.getLocation;x.getCryptoOrThrow=Ce.getCryptoOrThrow;x.getCrypto=Ce.getCrypto;x.getLocalStorageOrThrow=Ce.getLocalStorageOrThrow;x.getLocalStorage=Ce.getLocalStorage;function Cc(){return bc.getWindowMetadata()}x.getClientMeta=Cc});var ta={};In(ta,{safeJsonParse:()=>Ec,safeJsonStringify:()=>xc});function Ec(e){if(typeof e!="string")throw new Error(`Cannot safe json parse value of type ${typeof e}`);try{return JSON.parse(e)}catch{return e}}function xc(e){return typeof e=="string"?e:JSON.stringify(e)}var oa=Rn(()=>{});var Ir=Ie(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.safeJsonStringify=_t.safeJsonParse=void 0;var _c=To(),ra=_c.__importStar((oa(),On(ta)));_t.safeJsonParse=ra.safeJsonParse;_t.safeJsonStringify=ra.safeJsonStringify});var Or=Ie(He=>{"use strict";Object.defineProperty(He,"__esModule",{value:!0});He.removeLocal=He.getLocal=He.setLocal=void 0;var na=Ir(),Mr=Rr();function Lc(e,t){let o=(0,na.safeJsonStringify)(t),r=(0,Mr.getLocalStorage)();r&&r.setItem(e,o)}He.setLocal=Lc;function Sc(e){let t=null,o=null,r=(0,Mr.getLocalStorage)();return r&&(o=r.getItem(e)),t=o&&(0,na.safeJsonParse)(o),t}He.getLocal=Sc;function Pc(e){let t=(0,Mr.getLocalStorage)();t&&t.removeItem(e)}He.removeLocal=Pc});var aa=Ie(ce=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.getMobileLinkRegistry=ce.getMobileRegistryEntry=ce.saveMobileLinkInfo=ce.formatIOSMobile=ce.mobileLinkChoiceKey=void 0;var kc=Or();ce.mobileLinkChoiceKey="WALLETCONNECT_DEEPLINK_CHOICE";function Ac(e,t){let o=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${o}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${o}`:""}ce.formatIOSMobile=Ac;function Tc(e){let t=e.href.split("?")[0];(0,kc.setLocal)(ce.mobileLinkChoiceKey,Object.assign(Object.assign({},e),{href:t}))}ce.saveMobileLinkInfo=Tc;function ia(e,t){return e.filter(o=>o.name.toLowerCase().includes(t.toLowerCase()))[0]}ce.getMobileRegistryEntry=ia;function Wc(e,t){let o=e;return t&&(o=t.map(r=>ia(e,r)).filter(Boolean)),o}ce.getMobileLinkRegistry=Wc});var ca=Ie(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.formatMobileRegistry=Pe.formatMobileRegistryEntry=Pe.getDappRegistryUrl=Pe.getWalletRegistryUrl=void 0;var sa="https://registry.walletconnect.com";function Rc(){return sa+"/api/v2/wallets"}Pe.getWalletRegistryUrl=Rc;function Ic(){return sa+"/api/v2/dapps"}Pe.getDappRegistryUrl=Ic;function la(e,t="mobile"){var o;return{name:e.name||"",shortName:e.metadata.shortName||"",color:e.metadata.colors.primary||"",logo:(o=e.image_url.sm)!==null&&o!==void 0?o:"",universalLink:e[t].universal||"",deepLink:e[t].native||""}}Pe.formatMobileRegistryEntry=la;function Mc(e,t="mobile"){return Object.values(e).filter(o=>!!o[t].universal||!!o[t].native).map(o=>la(o,t))}Pe.formatMobileRegistry=Mc});var da=Ie(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});var Kt=To();Kt.__exportStar(Rr(),rt);Kt.__exportStar(Ir(),rt);Kt.__exportStar(Or(),rt);Kt.__exportStar(aa(),rt);Kt.__exportStar(ca(),rt)});import{Web3Provider as w2}from"@ethersproject/providers";import{useEffect as An,useState as te}from"react";var E=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import kl from"axios";var Ee=class extends Error{constructor(o,r){super(o);r instanceof Error&&(this.cause=r)}toString(){return`${this.type}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},mt=class extends Ee{constructor(o,r,n,i){super(n,i);this.type=o;this.status=r}},w=class extends Ee{constructor(o,r){super(o,r);this.type="client_error"}};var q=class extends Ee{constructor(o,r){super(o,r);this.type="connector_error"}},Z=e=>{if(e instanceof Ee)return e;if(!kl.isAxiosError(e))return ye(e);if(!e.response)return new mt("api_error",null,e.message,e);let{type:t,message:o,error:r}=e.response.data;return new mt(t||"ApiError",e.response.status,o||r,e)},ye=e=>e instanceof Ee?e:e instanceof Error?new w(e.message,e):new w(`Internal error: ${e}`);var Nn=()=>"/api/v1/sessions",Dn=()=>"/api/v1/sessions/logout",Un=()=>"/api/v1/sessions/fork",Bn=()=>"/api/v1/sessions/fork/recover",Fn=()=>"/api/v1/siwe/init",Gn=()=>"/api/v1/siwe/authenticate",Hn=()=>"/api/v1/siwe/link",Vn=()=>"/api/v1/passwordless/init",jn=()=>"/api/v1/passwordless/authenticate",$n=()=>"/api/v1/passwordless/link",zn=()=>"/api/v1/passwordless_sms/init",qn=()=>"/api/v1/passwordless_sms/authenticate",Zn=()=>"/api/v1/passwordless_sms/link",Kn=()=>"/api/v1/oauth/init",Jn=()=>"/api/v1/oauth/authenticate",Yn=()=>"/api/v1/oauth/link",Xn=()=>"/api/v1/siwe/unlink",Qn=()=>"/api/v1/passwordless/unlink",ei=()=>"/api/v1/passwordless_sms/unlink",ti=()=>"/api/v1/oauth/unlink";var zt=class{constructor(t){this.meta={email:t}}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new w("Email and email code must be set prior to calling authenticate.");try{let t=jn(),o=await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(t){throw Z(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new w("Email and email code must be set prior to calling authenticate.");try{let t=$n();return(await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode})).data}catch(t){throw Z(t)}}async sendCodeEmail(t){if(!this.api)throw new w("Auth flow has no API instance");if(t&&(this.meta.email=t),!this.meta.email)throw new w("Email must be set when initialzing authentication.");try{let o=Vn();return(await this.api.post(o,{email:this.meta.email})).data}catch(o){throw Z(o)}}};var ht=class{constructor(t,o,r){this.meta={provider:t},this.meta.authorizationCode=o,this.meta.stateCode=r}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new w("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new w("User denied confirmation during OAuth flow");try{let t=Jn(),o=await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(t){throw Z(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new w("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new w("User denied confirmation during OAuth flow");try{let t=Yn();return(await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode})).data}catch(t){throw Z(t)}}async getAuthorizationUrl(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.provider)throw new w("Provider must be set when initialzing OAuth authentication.");try{let t=Kn();return(await this.api.post(t,{provider:this.meta.provider,redirect_to:window.location.href})).data}catch(t){throw Z(t)}}};var gt=class{constructor(t,o,r){this._meta={walletType:o,walletId:r},this.connectors=t,this.walletConnector=this.connectors.createWalletConnector(o,null,r)}get meta(){return{...this._meta,walletName:this.walletConnector.walletBranding.name,walletIcon:this.walletConnector.walletBranding.icon}}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(Gn(),{message:t,signature:o});return this.connectors.addWalletConnector(this.walletConnector),await this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),{user:r.data.user,token:r.data.token,refresh_token:r.data.refresh_token,is_new_user:r.data.is_new_user}}catch(t){throw Z(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(Hn(),{message:t,signature:o});return this.connectors.addWalletConnector(this.walletConnector),await this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),r.data}catch(t){throw Z(t)}}async promptConnect(){if(!this.api)throw new w("Auth flow has no API instance");let t=await this.walletConnector.connect({showPrompt:!0});return await this.buildSiweMessage(t),t}async sign(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.preparedMessage){let o=await this.walletConnector.connect({showPrompt:!1});await this.buildSiweMessage(o)}if(!this.preparedMessage)throw new w("Could not prepare SIWE message");let t=await this.walletConnector.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async buildSiweMessage(t){if(!this.api)throw new w("Auth flow has no API instance");let o=t.address,r=t.chainId,n=await this.api.post(Fn(),{address:o});return this.preparedMessage=this.walletConnector.prepareMessage(r,o,n.data.nonce),this.preparedMessage}};var qt=class{constructor(t){this.meta={phoneNumber:t}}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new w("phone number and sms code must be set prior to calling authenticate.");try{let t=qn(),o=await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(t){throw Z(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new w("phone number and sms code must be set prior to calling authenticate.");try{let t=Zn();return(await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})).data}catch(t){throw Z(t)}}async sendSmsCode(t){if(!this.api)throw new w("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),!this.meta.phoneNumber)throw new w("phone nNumber must be set when initialzing authentication.");try{let o=zn();return(await this.api.post(o,{phoneNumber:this.meta.phoneNumber})).data}catch(o){throw Z(o)}}};import{getAddress as Nc}from"@ethersproject/address";var oi="1.20.3-beta.2";var ri="https://api.privy.io/v0",bo=process.env.NEXT_PUBLIC_PRIVY_AUTH_URL||"https://auth.privy.io",yo="4df5e2316331463a9130964bd6078dfa",ni=1e4,ve=1400,vr=oi;var bt="privy:token",vo="privy:refresh_token",Zt="privy:session_transfer_token",wo="privy:connectors",wr="walletconnect",ii=3e4;var Cr=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,o){o!==void 0?this._cache[t]=o:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},Er=class{get(t){let o=localStorage.getItem(t);return o===null?void 0:JSON.parse(o)}put(t,o){o!==void 0?localStorage.setItem(t,JSON.stringify(o)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function Tl(){return typeof window<"u"&&window.localStorage?new Er:new Cr}var F=Tl();import Bl from"@coinbase/wallet-sdk";import{getAddress as Fl}from"@ethersproject/address";import{jsx as ai,jsxs as Wl}from"react/jsx-runtime";var we=({style:e,...t})=>Wl("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[ai("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),ai("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});import{getAddress as Dl}from"@ethersproject/address";import{Web3Provider as Ul}from"@ethersproject/providers";import{ErrorCode as Rl}from"@ethersproject/logger";var yt=class extends q{constructor(){super("Wallet timeout");this.type="wallet_error"}},Xe=class extends q{constructor(){super("User rejected connection");this.type="wallet_error"}},Le=e=>{if(e instanceof q)return e;if((e==null?void 0:e.code)&&(e==null?void 0:e.reason)){let t=new vt(e);return e.code===Rl.ACTION_REJECTED&&(t.details=Ye.E4001_USER_REJECTED_REQUEST),t}return e!=null&&e.code?new vt(e):new q("Unknown connector error",e)},xr=class extends Ee{constructor(o,r,n){super(o);this.type="provider_error";this.code=r,this.data=n}},vt=class extends xr{constructor(o){var i,a,s;let r=o;super(r.message,r.code,r.data);let n=Object.values(Ye).find(l=>l.eipCode===r.code);this.details=n||Ye.UNKNOWN_ERROR,r.code===-32002&&((i=r.message)!=null&&i.includes("already pending for origin")?(a=r.message)!=null&&a.includes("wallet_requestPermissions")?this.details=Ye.E32002_CONNECTION_ALREADY_PENDING:this.details=Ye.E32002_REQUEST_ALREADY_PENDING:(s=r.message)!=null&&s.includes("Already processing")&&r.message.includes("eth_requestAccounts")&&(this.details=Ye.E32002_WALLET_LOCKED))}},Il={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_REJECTED_CONNECTION:{message:"You rejected the request",detail:"Please try connecting again.",retryable:!0}},Ml={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},Ol={E4001_DEFAULT_USER_REJECTED_REQUEST:{eipCode:4001,message:"User Rejected Request",detail:"The user rejected the request.",default:!0,retryable:!0},E4100_DEFAULT_UNAUTHORIZED:{eipCode:4100,message:"Unauthorized",detail:"The requested method and/or account has not been authorized by the user.",default:!0,retryable:!1},E4200_DEFAULT_UNSUPPORTED_METHOD:{eipCode:4200,message:"Unsupported Method",detail:"The Provider does not support the requested method.",default:!0,retryable:!1},E4900_DEFAULT_DISCONNECTED:{eipCode:4900,message:"Disconnected",detail:"The Provider is disconnected from all chains.",default:!0,retryable:!0},E4901_DEFAULT_CHAIN_DISCONNECTED:{eipCode:4901,message:"Chain Disconnected",detail:"The Provider is not connected to the requested chain.",default:!0,retryable:!0},E32700_DEFAULT_PARSE_ERROR:{eipCode:-32700,message:"Parse error",detail:"Invalid JSON",default:!0,retryable:!1},E32600_DEFAULT_INVALID_REQUEST:{eipCode:-32600,message:"Invalid request",detail:"JSON is not a valid request object",default:!0,retryable:!1},E32601_DEFAULT_METHOD_NOT_FOUND:{eipCode:-32601,message:"Method not found",detail:"Method does not exist",default:!0,retryable:!1},E32602_DEFAULT_INVALID_PARAMS:{eipCode:-32602,message:"Invalid params",detail:"Invalid method parameters",default:!0,retryable:!1},E32603_DEFAULT_INTERNAL_ERROR:{eipCode:-32603,message:"Internal error",detail:"Internal JSON-RPC error",default:!0,retryable:!0},E32000_DEFAULT_INVALID_INPUT:{eipCode:-32e3,message:"Invalid input",detail:"Missing or invalid parameters",default:!0,retryable:!1},E32001_DEFAULT_RESOURCE_NOT_FOUND:{eipCode:-32001,message:"Resource not found",detail:"Requested resource not found",default:!0,retryable:!1},E32002_DEFAULT_RESOURCE_UNAVAILABLE:{eipCode:-32002,message:"Resource unavailable",detail:"Requested resource not available",default:!0,retryable:!0},E32003_DEFAULT_TRANSACTION_REJECTED:{eipCode:-32003,message:"Transaction rejected",detail:"Transaction creation failed",default:!0,retryable:!0},E32004_DEFAULT_METHOD_NOT_SUPPORTED:{eipCode:-32004,message:"Method not supported",detail:"Method is not implemented",default:!0,retryable:!1},E32005_DEFAULT_LIMIT_EXCEEDED:{eipCode:-32005,message:"Limit exceeded",detail:"Request exceeds defined limit",default:!0,retryable:!1},E32006_DEFAULT_JSON_RPC_VERSION_NOT_SUPPORTED:{eipCode:-32006,message:"JSON-RPC version not supported",detail:"Version of JSON-RPC protocol is not supported",default:!0,retryable:!1}},Ye={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...Ol,...Ml},Qe={...Il,...Ye};var Nl=12e4,_r=(e=new yt,t=Nl)=>new Promise((o,r)=>setTimeout(()=>{r(e)},t)),Se=class{constructor(t){this.removeListener=(t,o)=>{if(this.walletProvider)return this.walletProvider.removeListener(t,o)};this.setWalletProvider=t=>{this.walletProvider=t,this._subscriptions.forEach(o=>{var r;(r=this.walletProvider)==null||r.on(o.eventName,o.listener)})};this.walletProvider=t,this._subscriptions=[]}on(t,o){if(this.walletProvider)return this.walletProvider.on(t,o);this._subscriptions.push({eventName:t,listener:o})}async request(t){if(!this.walletProvider)throw new q(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),_r()]).catch(o=>{throw Le(o)})}},et=class extends Se{constructor(o){super(o)}},Co=class extends Se{constructor(t){super(t)}sendAsync(t,o){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var Me=class{constructor(t,o,r){this.createSiweMessage=(t,o,r,n,i,a,s)=>`${r} wants you to sign in with your Ethereum account:
1
+ var El=Object.create;var go=Object.defineProperty;var xl=Object.getOwnPropertyDescriptor;var _l=Object.getOwnPropertyNames;var Ll=Object.getPrototypeOf,Sl=Object.prototype.hasOwnProperty;var Rn=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ie=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),In=(e,t)=>{for(var o in t)go(e,o,{get:t[o],enumerable:!0})},Mn=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of _l(t))!Sl.call(e,n)&&n!==o&&go(e,n,{get:()=>t[n],enumerable:!(r=xl(t,n))||r.enumerable});return e};var Pl=(e,t,o)=>(o=e!=null?El(Ll(e)):{},Mn(t||!e||!e.__esModule?go(o,"default",{value:e,enumerable:!0}):o,e)),On=e=>Mn(go({},"__esModule",{value:!0}),e);var To=Ie((Gu,Ao)=>{var gi,bi,yi,vi,wi,Ci,Ei,xi,_i,Po,kr,Li,Si,Pi,Et,ki,Ai,Ti,Wi,Ri,Ii,Mi,Oi,Ni,ko;(function(e){var t=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:{};typeof define=="function"&&define.amd?define("tslib",["exports"],function(r){e(o(t,o(r)))}):typeof Ao=="object"&&typeof Ao.exports=="object"?e(o(t,o(Ao.exports))):e(o(t));function o(r,n){return r!==t&&(typeof Object.create=="function"?Object.defineProperty(r,"__esModule",{value:!0}):r.__esModule=!0),function(i,a){return r[i]=n?n(i,a):a}}})(function(e){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])};gi=function(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(r,n);function i(){this.constructor=r}r.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)},bi=Object.assign||function(r){for(var n,i=1,a=arguments.length;i<a;i++){n=arguments[i];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])}return r},yi=function(r,n){var i={};for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&n.indexOf(a)<0&&(i[a]=r[a]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,a=Object.getOwnPropertySymbols(r);s<a.length;s++)n.indexOf(a[s])<0&&Object.prototype.propertyIsEnumerable.call(r,a[s])&&(i[a[s]]=r[a[s]]);return i},vi=function(r,n,i,a){var s=arguments.length,l=s<3?n:a===null?a=Object.getOwnPropertyDescriptor(n,i):a,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(r,n,i,a);else for(var h=r.length-1;h>=0;h--)(d=r[h])&&(l=(s<3?d(l):s>3?d(n,i,l):d(n,i))||l);return s>3&&l&&Object.defineProperty(n,i,l),l},wi=function(r,n){return function(i,a){n(i,a,r)}},Ci=function(r,n){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,n)},Ei=function(r,n,i,a){function s(l){return l instanceof i?l:new i(function(d){d(l)})}return new(i||(i=Promise))(function(l,d){function h(g){try{p(a.next(g))}catch(b){d(b)}}function m(g){try{p(a.throw(g))}catch(b){d(b)}}function p(g){g.done?l(g.value):s(g.value).then(h,m)}p((a=a.apply(r,n||[])).next())})},xi=function(r,n){var i={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},a,s,l,d;return d={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function h(p){return function(g){return m([p,g])}}function m(p){if(a)throw new TypeError("Generator is already executing.");for(;i;)try{if(a=1,s&&(l=p[0]&2?s.return:p[0]?s.throw||((l=s.return)&&l.call(s),0):s.next)&&!(l=l.call(s,p[1])).done)return l;switch(s=0,l&&(p=[p[0]&2,l.value]),p[0]){case 0:case 1:l=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,s=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(l=i.trys,!(l=l.length>0&&l[l.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!l||p[1]>l[0]&&p[1]<l[3])){i.label=p[1];break}if(p[0]===6&&i.label<l[1]){i.label=l[1],l=p;break}if(l&&i.label<l[2]){i.label=l[2],i.ops.push(p);break}l[2]&&i.ops.pop(),i.trys.pop();continue}p=n.call(r,i)}catch(g){p=[6,g],s=0}finally{a=l=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},_i=function(r,n){for(var i in r)i!=="default"&&!Object.prototype.hasOwnProperty.call(n,i)&&ko(n,r,i)},ko=Object.create?function(r,n,i,a){a===void 0&&(a=i);var s=Object.getOwnPropertyDescriptor(n,i);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[i]}}),Object.defineProperty(r,a,s)}:function(r,n,i,a){a===void 0&&(a=i),r[a]=n[i]},Po=function(r){var n=typeof Symbol=="function"&&Symbol.iterator,i=n&&r[n],a=0;if(i)return i.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&a>=r.length&&(r=void 0),{value:r&&r[a++],done:!r}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},kr=function(r,n){var i=typeof Symbol=="function"&&r[Symbol.iterator];if(!i)return r;var a=i.call(r),s,l=[],d;try{for(;(n===void 0||n-- >0)&&!(s=a.next()).done;)l.push(s.value)}catch(h){d={error:h}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(d)throw d.error}}return l},Li=function(){for(var r=[],n=0;n<arguments.length;n++)r=r.concat(kr(arguments[n]));return r},Si=function(){for(var r=0,n=0,i=arguments.length;n<i;n++)r+=arguments[n].length;for(var a=Array(r),s=0,n=0;n<i;n++)for(var l=arguments[n],d=0,h=l.length;d<h;d++,s++)a[s]=l[d];return a},Pi=function(r,n,i){if(i||arguments.length===2)for(var a=0,s=n.length,l;a<s;a++)(l||!(a in n))&&(l||(l=Array.prototype.slice.call(n,0,a)),l[a]=n[a]);return r.concat(l||Array.prototype.slice.call(n))},Et=function(r){return this instanceof Et?(this.v=r,this):new Et(r)},ki=function(r,n,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var a=i.apply(r,n||[]),s,l=[];return s={},d("next"),d("throw"),d("return"),s[Symbol.asyncIterator]=function(){return this},s;function d(c){a[c]&&(s[c]=function(y){return new Promise(function(v,W){l.push([c,y,v,W])>1||h(c,y)})})}function h(c,y){try{m(a[c](y))}catch(v){b(l[0][3],v)}}function m(c){c.value instanceof Et?Promise.resolve(c.value.v).then(p,g):b(l[0][2],c)}function p(c){h("next",c)}function g(c){h("throw",c)}function b(c,y){c(y),l.shift(),l.length&&h(l[0][0],l[0][1])}},Ai=function(r){var n,i;return n={},a("next"),a("throw",function(s){throw s}),a("return"),n[Symbol.iterator]=function(){return this},n;function a(s,l){n[s]=r[s]?function(d){return(i=!i)?{value:Et(r[s](d)),done:s==="return"}:l?l(d):d}:l}},Ti=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r[Symbol.asyncIterator],i;return n?n.call(r):(r=typeof Po=="function"?Po(r):r[Symbol.iterator](),i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i);function a(l){i[l]=r[l]&&function(d){return new Promise(function(h,m){d=r[l](d),s(h,m,d.done,d.value)})}}function s(l,d,h,m){Promise.resolve(m).then(function(p){l({value:p,done:h})},d)}},Wi=function(r,n){return Object.defineProperty?Object.defineProperty(r,"raw",{value:n}):r.raw=n,r};var o=Object.create?function(r,n){Object.defineProperty(r,"default",{enumerable:!0,value:n})}:function(r,n){r.default=n};Ri=function(r){if(r&&r.__esModule)return r;var n={};if(r!=null)for(var i in r)i!=="default"&&Object.prototype.hasOwnProperty.call(r,i)&&ko(n,r,i);return o(n,r),n},Ii=function(r){return r&&r.__esModule?r:{default:r}},Mi=function(r,n,i,a){if(i==="a"&&!a)throw new TypeError("Private accessor was defined without a getter");if(typeof n=="function"?r!==n||!a:!n.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?a:i==="a"?a.call(r):a?a.value:n.get(r)},Oi=function(r,n,i,a,s){if(a==="m")throw new TypeError("Private method is not writable");if(a==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof n=="function"?r!==n||!s:!n.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return a==="a"?s.call(r,i):s?s.value=i:n.set(r,i),i},Ni=function(r,n){if(n===null||typeof n!="object"&&typeof n!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof r=="function"?n===r:r.has(n)},e("__extends",gi),e("__assign",bi),e("__rest",yi),e("__decorate",vi),e("__param",wi),e("__metadata",Ci),e("__awaiter",Ei),e("__generator",xi),e("__exportStar",_i),e("__createBinding",ko),e("__values",Po),e("__read",kr),e("__spread",Li),e("__spreadArrays",Si),e("__spreadArray",Pi),e("__await",Et),e("__asyncGenerator",ki),e("__asyncDelegator",Ai),e("__asyncValues",Ti),e("__makeTemplateObject",Wi),e("__importStar",Ri),e("__importDefault",Ii),e("__classPrivateFieldGet",Mi),e("__classPrivateFieldSet",Oi),e("__classPrivateFieldIn",Ni)})});var Ar=Ie(O=>{"use strict";Object.defineProperty(O,"__esModule",{value:!0});O.getLocalStorage=O.getLocalStorageOrThrow=O.getCrypto=O.getCryptoOrThrow=O.getLocation=O.getLocationOrThrow=O.getNavigator=O.getNavigatorOrThrow=O.getDocument=O.getDocumentOrThrow=O.getFromWindowOrThrow=O.getFromWindow=void 0;function ot(e){let t;return typeof window<"u"&&typeof window[e]<"u"&&(t=window[e]),t}O.getFromWindow=ot;function xt(e){let t=ot(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}O.getFromWindowOrThrow=xt;function Ql(){return xt("document")}O.getDocumentOrThrow=Ql;function ec(){return ot("document")}O.getDocument=ec;function tc(){return xt("navigator")}O.getNavigatorOrThrow=tc;function oc(){return ot("navigator")}O.getNavigator=oc;function rc(){return xt("location")}O.getLocationOrThrow=rc;function nc(){return ot("location")}O.getLocation=nc;function ic(){return xt("crypto")}O.getCryptoOrThrow=ic;function ac(){return ot("crypto")}O.getCrypto=ac;function sc(){return xt("localStorage")}O.getLocalStorageOrThrow=sc;function lc(){return ot("localStorage")}O.getLocalStorage=lc});var Ui=Ie(Wo=>{"use strict";Object.defineProperty(Wo,"__esModule",{value:!0});Wo.getWindowMetadata=void 0;var Di=Ar();function cc(){let e,t;try{e=Di.getDocumentOrThrow(),t=Di.getLocationOrThrow()}catch{return null}function o(){let m=e.getElementsByTagName("link"),p=[];for(let g=0;g<m.length;g++){let b=m[g],c=b.getAttribute("rel");if(c&&c.toLowerCase().indexOf("icon")>-1){let y=b.getAttribute("href");if(y)if(y.toLowerCase().indexOf("https:")===-1&&y.toLowerCase().indexOf("http:")===-1&&y.indexOf("//")!==0){let v=t.protocol+"//"+t.host;if(y.indexOf("/")===0)v+=y;else{let W=t.pathname.split("/");W.pop(),v+=W.join("/")+"/"+y}p.push(v)}else if(y.indexOf("//")===0){let v=t.protocol+y;p.push(v)}else p.push(y)}}return p}function r(...m){let p=e.getElementsByTagName("meta");for(let g=0;g<p.length;g++){let b=p[g],c=["itemprop","property","name"].map(y=>b.getAttribute(y)).filter(y=>y?m.includes(y):!1);if(c.length&&c){let y=b.getAttribute("content");if(y)return y}}return""}function n(){let m=r("name","og:site_name","og:title","twitter:title");return m||(m=e.title),m}function i(){return r("description","og:description","twitter:description","keywords")}let a=n(),s=i(),l=t.origin,d=o();return{description:s,url:l,icons:d,name:a}}Wo.getWindowMetadata=cc});var Ki={};In(Ki,{BotInfo:()=>ji,BrowserInfo:()=>Gi,NodeInfo:()=>Hi,ReactNativeInfo:()=>$i,SearchBotDeviceInfo:()=>Vi,browserName:()=>hc,detect:()=>mc,detectOS:()=>qi,getNodeVersion:()=>Zi,parseUserAgent:()=>Tr});function mc(e){return e?Tr(e):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new $i:typeof navigator<"u"?Tr(navigator.userAgent):Zi()}function zi(e){return e!==""&&fc.reduce(function(t,o){var r=o[0],n=o[1];if(t)return t;var i=n.exec(e);return!!i&&[r,i]},!1)}function hc(e){var t=zi(e);return t?t[0]:null}function Tr(e){var t=zi(e);if(!t)return null;var o=t[0],r=t[1];if(o==="searchbot")return new ji;var n=r[1]&&r[1].split(/[._]/).slice(0,3);n?n.length<Bi&&(n=dc(n,gc(Bi-n.length))):n=[];var i=n.join("."),a=qi(e),s=uc.exec(e);return s&&s[1]?new Vi(o,i,a,s[1]):new Gi(o,i,a)}function qi(e){for(var t=0,o=Fi.length;t<o;t++){var r=Fi[t],n=r[0],i=r[1],a=i.exec(e);if(a)return n}return null}function Zi(){var e=typeof process<"u"&&process.version;return e?new Hi(process.version.slice(1)):null}function gc(e){for(var t=[],o=0;o<e;o++)t.push("0");return t}var dc,Gi,Hi,Vi,ji,$i,pc,uc,Bi,fc,Fi,Ji=Rn(()=>{dc=function(){for(var e=0,t=0,o=arguments.length;t<o;t++)e+=arguments[t].length;for(var r=Array(e),n=0,t=0;t<o;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,n++)r[n]=i[a];return r},Gi=function(){function e(t,o,r){this.name=t,this.version=o,this.os=r,this.type="browser"}return e}(),Hi=function(){function e(t){this.version=t,this.type="node",this.name="node",this.os=process.platform}return e}(),Vi=function(){function e(t,o,r,n){this.name=t,this.version=o,this.os=r,this.bot=n,this.type="bot-device"}return e}(),ji=function(){function e(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return e}(),$i=function(){function e(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return e}(),pc=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,uc=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Bi=3,fc=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["searchbot",pc]],Fi=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]]});var Rr=Ie(x=>{"use strict";Object.defineProperty(x,"__esModule",{value:!0});x.getClientMeta=x.getLocalStorage=x.getLocalStorageOrThrow=x.getCrypto=x.getCryptoOrThrow=x.getLocation=x.getLocationOrThrow=x.getNavigator=x.getNavigatorOrThrow=x.getDocument=x.getDocumentOrThrow=x.getFromWindowOrThrow=x.getFromWindow=x.isBrowser=x.isNode=x.isMobile=x.isIOS=x.isAndroid=x.detectOS=x.detectEnv=void 0;var Yi=To(),bc=Yi.__importStar(Ui()),Ce=Yi.__importStar(Ar()),yc=(Ji(),On(Ki));function Wr(e){return(0,yc.detect)(e)}x.detectEnv=Wr;function Ro(){let e=Wr();return e&&e.os?e.os:void 0}x.detectOS=Ro;function Xi(){let e=Ro();return e?e.toLowerCase().includes("android"):!1}x.isAndroid=Xi;function Qi(){let e=Ro();return e?e.toLowerCase().includes("ios")||e.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}x.isIOS=Qi;function vc(){return Ro()?Xi()||Qi():!1}x.isMobile=vc;function ea(){let e=Wr();return e&&e.name?e.name.toLowerCase()==="node":!1}x.isNode=ea;function wc(){return!ea()&&!!(0,x.getNavigator)()}x.isBrowser=wc;x.getFromWindow=Ce.getFromWindow;x.getFromWindowOrThrow=Ce.getFromWindowOrThrow;x.getDocumentOrThrow=Ce.getDocumentOrThrow;x.getDocument=Ce.getDocument;x.getNavigatorOrThrow=Ce.getNavigatorOrThrow;x.getNavigator=Ce.getNavigator;x.getLocationOrThrow=Ce.getLocationOrThrow;x.getLocation=Ce.getLocation;x.getCryptoOrThrow=Ce.getCryptoOrThrow;x.getCrypto=Ce.getCrypto;x.getLocalStorageOrThrow=Ce.getLocalStorageOrThrow;x.getLocalStorage=Ce.getLocalStorage;function Cc(){return bc.getWindowMetadata()}x.getClientMeta=Cc});var ta={};In(ta,{safeJsonParse:()=>Ec,safeJsonStringify:()=>xc});function Ec(e){if(typeof e!="string")throw new Error(`Cannot safe json parse value of type ${typeof e}`);try{return JSON.parse(e)}catch{return e}}function xc(e){return typeof e=="string"?e:JSON.stringify(e)}var oa=Rn(()=>{});var Ir=Ie(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.safeJsonStringify=_t.safeJsonParse=void 0;var _c=To(),ra=_c.__importStar((oa(),On(ta)));_t.safeJsonParse=ra.safeJsonParse;_t.safeJsonStringify=ra.safeJsonStringify});var Or=Ie(He=>{"use strict";Object.defineProperty(He,"__esModule",{value:!0});He.removeLocal=He.getLocal=He.setLocal=void 0;var na=Ir(),Mr=Rr();function Lc(e,t){let o=(0,na.safeJsonStringify)(t),r=(0,Mr.getLocalStorage)();r&&r.setItem(e,o)}He.setLocal=Lc;function Sc(e){let t=null,o=null,r=(0,Mr.getLocalStorage)();return r&&(o=r.getItem(e)),t=o&&(0,na.safeJsonParse)(o),t}He.getLocal=Sc;function Pc(e){let t=(0,Mr.getLocalStorage)();t&&t.removeItem(e)}He.removeLocal=Pc});var aa=Ie(ce=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.getMobileLinkRegistry=ce.getMobileRegistryEntry=ce.saveMobileLinkInfo=ce.formatIOSMobile=ce.mobileLinkChoiceKey=void 0;var kc=Or();ce.mobileLinkChoiceKey="WALLETCONNECT_DEEPLINK_CHOICE";function Ac(e,t){let o=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${o}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${o}`:""}ce.formatIOSMobile=Ac;function Tc(e){let t=e.href.split("?")[0];(0,kc.setLocal)(ce.mobileLinkChoiceKey,Object.assign(Object.assign({},e),{href:t}))}ce.saveMobileLinkInfo=Tc;function ia(e,t){return e.filter(o=>o.name.toLowerCase().includes(t.toLowerCase()))[0]}ce.getMobileRegistryEntry=ia;function Wc(e,t){let o=e;return t&&(o=t.map(r=>ia(e,r)).filter(Boolean)),o}ce.getMobileLinkRegistry=Wc});var ca=Ie(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.formatMobileRegistry=Pe.formatMobileRegistryEntry=Pe.getDappRegistryUrl=Pe.getWalletRegistryUrl=void 0;var sa="https://registry.walletconnect.com";function Rc(){return sa+"/api/v2/wallets"}Pe.getWalletRegistryUrl=Rc;function Ic(){return sa+"/api/v2/dapps"}Pe.getDappRegistryUrl=Ic;function la(e,t="mobile"){var o;return{name:e.name||"",shortName:e.metadata.shortName||"",color:e.metadata.colors.primary||"",logo:(o=e.image_url.sm)!==null&&o!==void 0?o:"",universalLink:e[t].universal||"",deepLink:e[t].native||""}}Pe.formatMobileRegistryEntry=la;function Mc(e,t="mobile"){return Object.values(e).filter(o=>!!o[t].universal||!!o[t].native).map(o=>la(o,t))}Pe.formatMobileRegistry=Mc});var da=Ie(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});var Kt=To();Kt.__exportStar(Rr(),rt);Kt.__exportStar(Ir(),rt);Kt.__exportStar(Or(),rt);Kt.__exportStar(aa(),rt);Kt.__exportStar(ca(),rt)});import{Web3Provider as w2}from"@ethersproject/providers";import{useEffect as An,useState as te}from"react";var E=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import kl from"axios";var Ee=class extends Error{constructor(o,r){super(o);r instanceof Error&&(this.cause=r)}toString(){return`${this.type}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},mt=class extends Ee{constructor(o,r,n,i){super(n,i);this.type=o;this.status=r}},w=class extends Ee{constructor(o,r){super(o,r);this.type="client_error"}};var q=class extends Ee{constructor(o,r){super(o,r);this.type="connector_error"}},Z=e=>{if(e instanceof Ee)return e;if(!kl.isAxiosError(e))return ye(e);if(!e.response)return new mt("api_error",null,e.message,e);let{type:t,message:o,error:r}=e.response.data;return new mt(t||"ApiError",e.response.status,o||r,e)},ye=e=>e instanceof Ee?e:e instanceof Error?new w(e.message,e):new w(`Internal error: ${e}`);var Nn=()=>"/api/v1/sessions",Dn=()=>"/api/v1/sessions/logout",Un=()=>"/api/v1/sessions/fork",Bn=()=>"/api/v1/sessions/fork/recover",Fn=()=>"/api/v1/siwe/init",Gn=()=>"/api/v1/siwe/authenticate",Hn=()=>"/api/v1/siwe/link",Vn=()=>"/api/v1/passwordless/init",jn=()=>"/api/v1/passwordless/authenticate",$n=()=>"/api/v1/passwordless/link",zn=()=>"/api/v1/passwordless_sms/init",qn=()=>"/api/v1/passwordless_sms/authenticate",Zn=()=>"/api/v1/passwordless_sms/link",Kn=()=>"/api/v1/oauth/init",Jn=()=>"/api/v1/oauth/authenticate",Yn=()=>"/api/v1/oauth/link",Xn=()=>"/api/v1/siwe/unlink",Qn=()=>"/api/v1/passwordless/unlink",ei=()=>"/api/v1/passwordless_sms/unlink",ti=()=>"/api/v1/oauth/unlink";var zt=class{constructor(t){this.meta={email:t}}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new w("Email and email code must be set prior to calling authenticate.");try{let t=jn(),o=await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(t){throw Z(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new w("Email and email code must be set prior to calling authenticate.");try{let t=$n();return(await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode})).data}catch(t){throw Z(t)}}async sendCodeEmail(t){if(!this.api)throw new w("Auth flow has no API instance");if(t&&(this.meta.email=t),!this.meta.email)throw new w("Email must be set when initialzing authentication.");try{let o=Vn();return(await this.api.post(o,{email:this.meta.email})).data}catch(o){throw Z(o)}}};var ht=class{constructor(t,o,r){this.meta={provider:t},this.meta.authorizationCode=o,this.meta.stateCode=r}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new w("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new w("User denied confirmation during OAuth flow");try{let t=Jn(),o=await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(t){throw Z(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new w("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new w("User denied confirmation during OAuth flow");try{let t=Yn();return(await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode})).data}catch(t){throw Z(t)}}async getAuthorizationUrl(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.provider)throw new w("Provider must be set when initialzing OAuth authentication.");try{let t=Kn();return(await this.api.post(t,{provider:this.meta.provider,redirect_to:window.location.href})).data}catch(t){throw Z(t)}}};var gt=class{constructor(t,o,r){this._meta={walletType:o,walletId:r},this.connectors=t,this.walletConnector=this.connectors.createWalletConnector(o,null,r)}get meta(){return{...this._meta,walletName:this.walletConnector.walletBranding.name,walletIcon:this.walletConnector.walletBranding.icon}}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(Gn(),{message:t,signature:o});return this.connectors.addWalletConnector(this.walletConnector),await this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),{user:r.data.user,token:r.data.token,refresh_token:r.data.refresh_token,is_new_user:r.data.is_new_user}}catch(t){throw Z(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(Hn(),{message:t,signature:o});return this.connectors.addWalletConnector(this.walletConnector),await this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),r.data}catch(t){throw Z(t)}}async promptConnect(){if(!this.api)throw new w("Auth flow has no API instance");let t=await this.walletConnector.connect({showPrompt:!0});return await this.buildSiweMessage(t),t}async sign(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.preparedMessage){let o=await this.walletConnector.connect({showPrompt:!1});await this.buildSiweMessage(o)}if(!this.preparedMessage)throw new w("Could not prepare SIWE message");let t=await this.walletConnector.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async buildSiweMessage(t){if(!this.api)throw new w("Auth flow has no API instance");let o=t.address,r=t.chainId,n=await this.api.post(Fn(),{address:o});return this.preparedMessage=this.walletConnector.prepareMessage(r,o,n.data.nonce),this.preparedMessage}};var qt=class{constructor(t){this.meta={phoneNumber:t}}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new w("phone number and sms code must be set prior to calling authenticate.");try{let t=qn(),o=await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(t){throw Z(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new w("phone number and sms code must be set prior to calling authenticate.");try{let t=Zn();return(await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})).data}catch(t){throw Z(t)}}async sendSmsCode(t){if(!this.api)throw new w("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),!this.meta.phoneNumber)throw new w("phone nNumber must be set when initialzing authentication.");try{let o=zn();return(await this.api.post(o,{phoneNumber:this.meta.phoneNumber})).data}catch(o){throw Z(o)}}};import{getAddress as Nc}from"@ethersproject/address";var oi="1.20.3";var ri="https://api.privy.io/v0",bo=process.env.NEXT_PUBLIC_PRIVY_AUTH_URL||"https://auth.privy.io",yo="4df5e2316331463a9130964bd6078dfa",ni=1e4,ve=1400,vr=oi;var bt="privy:token",vo="privy:refresh_token",Zt="privy:session_transfer_token",wo="privy:connectors",wr="walletconnect",ii=3e4;var Cr=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,o){o!==void 0?this._cache[t]=o:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},Er=class{get(t){let o=localStorage.getItem(t);return o===null?void 0:JSON.parse(o)}put(t,o){o!==void 0?localStorage.setItem(t,JSON.stringify(o)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function Tl(){return typeof window<"u"&&window.localStorage?new Er:new Cr}var F=Tl();import Bl from"@coinbase/wallet-sdk";import{getAddress as Fl}from"@ethersproject/address";import{jsx as ai,jsxs as Wl}from"react/jsx-runtime";var we=({style:e,...t})=>Wl("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[ai("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),ai("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});import{getAddress as Dl}from"@ethersproject/address";import{Web3Provider as Ul}from"@ethersproject/providers";import{ErrorCode as Rl}from"@ethersproject/logger";var yt=class extends q{constructor(){super("Wallet timeout");this.type="wallet_error"}},Xe=class extends q{constructor(){super("User rejected connection");this.type="wallet_error"}},Le=e=>{if(e instanceof q)return e;if((e==null?void 0:e.code)&&(e==null?void 0:e.reason)){let t=new vt(e);return e.code===Rl.ACTION_REJECTED&&(t.details=Ye.E4001_USER_REJECTED_REQUEST),t}return e!=null&&e.code?new vt(e):new q("Unknown connector error",e)},xr=class extends Ee{constructor(o,r,n){super(o);this.type="provider_error";this.code=r,this.data=n}},vt=class extends xr{constructor(o){var i,a,s;let r=o;super(r.message,r.code,r.data);let n=Object.values(Ye).find(l=>l.eipCode===r.code);this.details=n||Ye.UNKNOWN_ERROR,r.code===-32002&&((i=r.message)!=null&&i.includes("already pending for origin")?(a=r.message)!=null&&a.includes("wallet_requestPermissions")?this.details=Ye.E32002_CONNECTION_ALREADY_PENDING:this.details=Ye.E32002_REQUEST_ALREADY_PENDING:(s=r.message)!=null&&s.includes("Already processing")&&r.message.includes("eth_requestAccounts")&&(this.details=Ye.E32002_WALLET_LOCKED))}},Il={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_REJECTED_CONNECTION:{message:"You rejected the request",detail:"Please try connecting again.",retryable:!0}},Ml={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},Ol={E4001_DEFAULT_USER_REJECTED_REQUEST:{eipCode:4001,message:"User Rejected Request",detail:"The user rejected the request.",default:!0,retryable:!0},E4100_DEFAULT_UNAUTHORIZED:{eipCode:4100,message:"Unauthorized",detail:"The requested method and/or account has not been authorized by the user.",default:!0,retryable:!1},E4200_DEFAULT_UNSUPPORTED_METHOD:{eipCode:4200,message:"Unsupported Method",detail:"The Provider does not support the requested method.",default:!0,retryable:!1},E4900_DEFAULT_DISCONNECTED:{eipCode:4900,message:"Disconnected",detail:"The Provider is disconnected from all chains.",default:!0,retryable:!0},E4901_DEFAULT_CHAIN_DISCONNECTED:{eipCode:4901,message:"Chain Disconnected",detail:"The Provider is not connected to the requested chain.",default:!0,retryable:!0},E32700_DEFAULT_PARSE_ERROR:{eipCode:-32700,message:"Parse error",detail:"Invalid JSON",default:!0,retryable:!1},E32600_DEFAULT_INVALID_REQUEST:{eipCode:-32600,message:"Invalid request",detail:"JSON is not a valid request object",default:!0,retryable:!1},E32601_DEFAULT_METHOD_NOT_FOUND:{eipCode:-32601,message:"Method not found",detail:"Method does not exist",default:!0,retryable:!1},E32602_DEFAULT_INVALID_PARAMS:{eipCode:-32602,message:"Invalid params",detail:"Invalid method parameters",default:!0,retryable:!1},E32603_DEFAULT_INTERNAL_ERROR:{eipCode:-32603,message:"Internal error",detail:"Internal JSON-RPC error",default:!0,retryable:!0},E32000_DEFAULT_INVALID_INPUT:{eipCode:-32e3,message:"Invalid input",detail:"Missing or invalid parameters",default:!0,retryable:!1},E32001_DEFAULT_RESOURCE_NOT_FOUND:{eipCode:-32001,message:"Resource not found",detail:"Requested resource not found",default:!0,retryable:!1},E32002_DEFAULT_RESOURCE_UNAVAILABLE:{eipCode:-32002,message:"Resource unavailable",detail:"Requested resource not available",default:!0,retryable:!0},E32003_DEFAULT_TRANSACTION_REJECTED:{eipCode:-32003,message:"Transaction rejected",detail:"Transaction creation failed",default:!0,retryable:!0},E32004_DEFAULT_METHOD_NOT_SUPPORTED:{eipCode:-32004,message:"Method not supported",detail:"Method is not implemented",default:!0,retryable:!1},E32005_DEFAULT_LIMIT_EXCEEDED:{eipCode:-32005,message:"Limit exceeded",detail:"Request exceeds defined limit",default:!0,retryable:!1},E32006_DEFAULT_JSON_RPC_VERSION_NOT_SUPPORTED:{eipCode:-32006,message:"JSON-RPC version not supported",detail:"Version of JSON-RPC protocol is not supported",default:!0,retryable:!1}},Ye={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...Ol,...Ml},Qe={...Il,...Ye};var Nl=12e4,_r=(e=new yt,t=Nl)=>new Promise((o,r)=>setTimeout(()=>{r(e)},t)),Se=class{constructor(t){this.removeListener=(t,o)=>{if(this.walletProvider)return this.walletProvider.removeListener(t,o)};this.setWalletProvider=t=>{this.walletProvider=t,this._subscriptions.forEach(o=>{var r;(r=this.walletProvider)==null||r.on(o.eventName,o.listener)})};this.walletProvider=t,this._subscriptions=[]}on(t,o){if(this.walletProvider)return this.walletProvider.on(t,o);this._subscriptions.push({eventName:t,listener:o})}async request(t){if(!this.walletProvider)throw new q(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),_r()]).catch(o=>{throw Le(o)})}},et=class extends Se{constructor(o){super(o)}},Co=class extends Se{constructor(t){super(t)}sendAsync(t,o){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var Me=class{constructor(t,o,r){this.createSiweMessage=(t,o,r,n,i,a,s)=>`${r} wants you to sign in with your Ethereum account:
2
2
  ${o}
3
3
 
4
4
  ${s}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var El=Object.create;var Ro=Object.defineProperty;var xl=Object.getOwnPropertyDescriptor;var _l=Object.getOwnPropertyNames;var Ll=Object.getPrototypeOf,Sl=Object.prototype.hasOwnProperty;var Zn=(e,t)=>()=>(e&&(t=e(e=0)),t);var ot=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Gr=(e,t)=>{for(var o in t)Ro(e,o,{get:t[o],enumerable:!0})},Kn=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of _l(t))!Sl.call(e,n)&&n!==o&&Ro(e,n,{get:()=>t[n],enumerable:!(r=xl(t,n))||r.enumerable});return e};var L=(e,t,o)=>(o=e!=null?El(Ll(e)):{},Kn(t||!e||!e.__esModule?Ro(o,"default",{value:e,enumerable:!0}):o,e)),Hr=e=>Kn(Ro({},"__esModule",{value:!0}),e);var Zo=ot((Np,qo)=>{var Di,Ui,Bi,Fi,Gi,Hi,Vi,ji,$i,$o,Yr,zi,qi,Zi,jt,Ki,Ji,Yi,Xi,Qi,ea,ta,oa,ra,zo;(function(e){var t=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:{};typeof define=="function"&&define.amd?define("tslib",["exports"],function(r){e(o(t,o(r)))}):typeof qo=="object"&&typeof qo.exports=="object"?e(o(t,o(qo.exports))):e(o(t));function o(r,n){return r!==t&&(typeof Object.create=="function"?Object.defineProperty(r,"__esModule",{value:!0}):r.__esModule=!0),function(i,a){return r[i]=n?n(i,a):a}}})(function(e){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])};Di=function(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(r,n);function i(){this.constructor=r}r.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)},Ui=Object.assign||function(r){for(var n,i=1,a=arguments.length;i<a;i++){n=arguments[i];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])}return r},Bi=function(r,n){var i={};for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&n.indexOf(a)<0&&(i[a]=r[a]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,a=Object.getOwnPropertySymbols(r);s<a.length;s++)n.indexOf(a[s])<0&&Object.prototype.propertyIsEnumerable.call(r,a[s])&&(i[a[s]]=r[a[s]]);return i},Fi=function(r,n,i,a){var s=arguments.length,l=s<3?n:a===null?a=Object.getOwnPropertyDescriptor(n,i):a,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(r,n,i,a);else for(var h=r.length-1;h>=0;h--)(d=r[h])&&(l=(s<3?d(l):s>3?d(n,i,l):d(n,i))||l);return s>3&&l&&Object.defineProperty(n,i,l),l},Gi=function(r,n){return function(i,a){n(i,a,r)}},Hi=function(r,n){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,n)},Vi=function(r,n,i,a){function s(l){return l instanceof i?l:new i(function(d){d(l)})}return new(i||(i=Promise))(function(l,d){function h(g){try{p(a.next(g))}catch(b){d(b)}}function m(g){try{p(a.throw(g))}catch(b){d(b)}}function p(g){g.done?l(g.value):s(g.value).then(h,m)}p((a=a.apply(r,n||[])).next())})},ji=function(r,n){var i={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},a,s,l,d;return d={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function h(p){return function(g){return m([p,g])}}function m(p){if(a)throw new TypeError("Generator is already executing.");for(;i;)try{if(a=1,s&&(l=p[0]&2?s.return:p[0]?s.throw||((l=s.return)&&l.call(s),0):s.next)&&!(l=l.call(s,p[1])).done)return l;switch(s=0,l&&(p=[p[0]&2,l.value]),p[0]){case 0:case 1:l=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,s=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(l=i.trys,!(l=l.length>0&&l[l.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!l||p[1]>l[0]&&p[1]<l[3])){i.label=p[1];break}if(p[0]===6&&i.label<l[1]){i.label=l[1],l=p;break}if(l&&i.label<l[2]){i.label=l[2],i.ops.push(p);break}l[2]&&i.ops.pop(),i.trys.pop();continue}p=n.call(r,i)}catch(g){p=[6,g],s=0}finally{a=l=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},$i=function(r,n){for(var i in r)i!=="default"&&!Object.prototype.hasOwnProperty.call(n,i)&&zo(n,r,i)},zo=Object.create?function(r,n,i,a){a===void 0&&(a=i);var s=Object.getOwnPropertyDescriptor(n,i);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[i]}}),Object.defineProperty(r,a,s)}:function(r,n,i,a){a===void 0&&(a=i),r[a]=n[i]},$o=function(r){var n=typeof Symbol=="function"&&Symbol.iterator,i=n&&r[n],a=0;if(i)return i.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&a>=r.length&&(r=void 0),{value:r&&r[a++],done:!r}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},Yr=function(r,n){var i=typeof Symbol=="function"&&r[Symbol.iterator];if(!i)return r;var a=i.call(r),s,l=[],d;try{for(;(n===void 0||n-- >0)&&!(s=a.next()).done;)l.push(s.value)}catch(h){d={error:h}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(d)throw d.error}}return l},zi=function(){for(var r=[],n=0;n<arguments.length;n++)r=r.concat(Yr(arguments[n]));return r},qi=function(){for(var r=0,n=0,i=arguments.length;n<i;n++)r+=arguments[n].length;for(var a=Array(r),s=0,n=0;n<i;n++)for(var l=arguments[n],d=0,h=l.length;d<h;d++,s++)a[s]=l[d];return a},Zi=function(r,n,i){if(i||arguments.length===2)for(var a=0,s=n.length,l;a<s;a++)(l||!(a in n))&&(l||(l=Array.prototype.slice.call(n,0,a)),l[a]=n[a]);return r.concat(l||Array.prototype.slice.call(n))},jt=function(r){return this instanceof jt?(this.v=r,this):new jt(r)},Ki=function(r,n,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var a=i.apply(r,n||[]),s,l=[];return s={},d("next"),d("throw"),d("return"),s[Symbol.asyncIterator]=function(){return this},s;function d(c){a[c]&&(s[c]=function(y){return new Promise(function(C,M){l.push([c,y,C,M])>1||h(c,y)})})}function h(c,y){try{m(a[c](y))}catch(C){b(l[0][3],C)}}function m(c){c.value instanceof jt?Promise.resolve(c.value.v).then(p,g):b(l[0][2],c)}function p(c){h("next",c)}function g(c){h("throw",c)}function b(c,y){c(y),l.shift(),l.length&&h(l[0][0],l[0][1])}},Ji=function(r){var n,i;return n={},a("next"),a("throw",function(s){throw s}),a("return"),n[Symbol.iterator]=function(){return this},n;function a(s,l){n[s]=r[s]?function(d){return(i=!i)?{value:jt(r[s](d)),done:s==="return"}:l?l(d):d}:l}},Yi=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r[Symbol.asyncIterator],i;return n?n.call(r):(r=typeof $o=="function"?$o(r):r[Symbol.iterator](),i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i);function a(l){i[l]=r[l]&&function(d){return new Promise(function(h,m){d=r[l](d),s(h,m,d.done,d.value)})}}function s(l,d,h,m){Promise.resolve(m).then(function(p){l({value:p,done:h})},d)}},Xi=function(r,n){return Object.defineProperty?Object.defineProperty(r,"raw",{value:n}):r.raw=n,r};var o=Object.create?function(r,n){Object.defineProperty(r,"default",{enumerable:!0,value:n})}:function(r,n){r.default=n};Qi=function(r){if(r&&r.__esModule)return r;var n={};if(r!=null)for(var i in r)i!=="default"&&Object.prototype.hasOwnProperty.call(r,i)&&zo(n,r,i);return o(n,r),n},ea=function(r){return r&&r.__esModule?r:{default:r}},ta=function(r,n,i,a){if(i==="a"&&!a)throw new TypeError("Private accessor was defined without a getter");if(typeof n=="function"?r!==n||!a:!n.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?a:i==="a"?a.call(r):a?a.value:n.get(r)},oa=function(r,n,i,a,s){if(a==="m")throw new TypeError("Private method is not writable");if(a==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof n=="function"?r!==n||!s:!n.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return a==="a"?s.call(r,i):s?s.value=i:n.set(r,i),i},ra=function(r,n){if(n===null||typeof n!="object"&&typeof n!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof r=="function"?n===r:r.has(n)},e("__extends",Di),e("__assign",Ui),e("__rest",Bi),e("__decorate",Fi),e("__param",Gi),e("__metadata",Hi),e("__awaiter",Vi),e("__generator",ji),e("__exportStar",$i),e("__createBinding",zo),e("__values",$o),e("__read",Yr),e("__spread",zi),e("__spreadArrays",qi),e("__spreadArray",Zi),e("__await",jt),e("__asyncGenerator",Ki),e("__asyncDelegator",Ji),e("__asyncValues",Yi),e("__makeTemplateObject",Xi),e("__importStar",Qi),e("__importDefault",ea),e("__classPrivateFieldGet",ta),e("__classPrivateFieldSet",oa),e("__classPrivateFieldIn",ra)})});var Xr=ot(U=>{"use strict";Object.defineProperty(U,"__esModule",{value:!0});U.getLocalStorage=U.getLocalStorageOrThrow=U.getCrypto=U.getCryptoOrThrow=U.getLocation=U.getLocationOrThrow=U.getNavigator=U.getNavigatorOrThrow=U.getDocument=U.getDocumentOrThrow=U.getFromWindowOrThrow=U.getFromWindow=void 0;function Pt(e){let t;return typeof window<"u"&&typeof window[e]<"u"&&(t=window[e]),t}U.getFromWindow=Pt;function $t(e){let t=Pt(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}U.getFromWindowOrThrow=$t;function Ol(){return $t("document")}U.getDocumentOrThrow=Ol;function Nl(){return Pt("document")}U.getDocument=Nl;function Dl(){return $t("navigator")}U.getNavigatorOrThrow=Dl;function Ul(){return Pt("navigator")}U.getNavigator=Ul;function Bl(){return $t("location")}U.getLocationOrThrow=Bl;function Fl(){return Pt("location")}U.getLocation=Fl;function Gl(){return $t("crypto")}U.getCryptoOrThrow=Gl;function Hl(){return Pt("crypto")}U.getCrypto=Hl;function Vl(){return $t("localStorage")}U.getLocalStorageOrThrow=Vl;function jl(){return Pt("localStorage")}U.getLocalStorage=jl});var ia=ot(Ko=>{"use strict";Object.defineProperty(Ko,"__esModule",{value:!0});Ko.getWindowMetadata=void 0;var na=Xr();function $l(){let e,t;try{e=na.getDocumentOrThrow(),t=na.getLocationOrThrow()}catch{return null}function o(){let m=e.getElementsByTagName("link"),p=[];for(let g=0;g<m.length;g++){let b=m[g],c=b.getAttribute("rel");if(c&&c.toLowerCase().indexOf("icon")>-1){let y=b.getAttribute("href");if(y)if(y.toLowerCase().indexOf("https:")===-1&&y.toLowerCase().indexOf("http:")===-1&&y.indexOf("//")!==0){let C=t.protocol+"//"+t.host;if(y.indexOf("/")===0)C+=y;else{let M=t.pathname.split("/");M.pop(),C+=M.join("/")+"/"+y}p.push(C)}else if(y.indexOf("//")===0){let C=t.protocol+y;p.push(C)}else p.push(y)}}return p}function r(...m){let p=e.getElementsByTagName("meta");for(let g=0;g<p.length;g++){let b=p[g],c=["itemprop","property","name"].map(y=>b.getAttribute(y)).filter(y=>y?m.includes(y):!1);if(c.length&&c){let y=b.getAttribute("content");if(y)return y}}return""}function n(){let m=r("name","og:site_name","og:title","twitter:title");return m||(m=e.title),m}function i(){return r("description","og:description","twitter:description","keywords")}let a=n(),s=i(),l=t.origin,d=o();return{description:s,url:l,icons:d,name:a}}Ko.getWindowMetadata=$l});var ga={};Gr(ga,{BotInfo:()=>pa,BrowserInfo:()=>la,NodeInfo:()=>ca,ReactNativeInfo:()=>ua,SearchBotDeviceInfo:()=>da,browserName:()=>Yl,detect:()=>Jl,detectOS:()=>ma,getNodeVersion:()=>ha,parseUserAgent:()=>Qr});function Jl(e){return e?Qr(e):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new ua:typeof navigator<"u"?Qr(navigator.userAgent):ha()}function fa(e){return e!==""&&Kl.reduce(function(t,o){var r=o[0],n=o[1];if(t)return t;var i=n.exec(e);return!!i&&[r,i]},!1)}function Yl(e){var t=fa(e);return t?t[0]:null}function Qr(e){var t=fa(e);if(!t)return null;var o=t[0],r=t[1];if(o==="searchbot")return new pa;var n=r[1]&&r[1].split(/[._]/).slice(0,3);n?n.length<aa&&(n=zl(n,Xl(aa-n.length))):n=[];var i=n.join("."),a=ma(e),s=Zl.exec(e);return s&&s[1]?new da(o,i,a,s[1]):new la(o,i,a)}function ma(e){for(var t=0,o=sa.length;t<o;t++){var r=sa[t],n=r[0],i=r[1],a=i.exec(e);if(a)return n}return null}function ha(){var e=typeof process<"u"&&process.version;return e?new ca(process.version.slice(1)):null}function Xl(e){for(var t=[],o=0;o<e;o++)t.push("0");return t}var zl,la,ca,da,pa,ua,ql,Zl,aa,Kl,sa,ba=Zn(()=>{zl=function(){for(var e=0,t=0,o=arguments.length;t<o;t++)e+=arguments[t].length;for(var r=Array(e),n=0,t=0;t<o;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,n++)r[n]=i[a];return r},la=function(){function e(t,o,r){this.name=t,this.version=o,this.os=r,this.type="browser"}return e}(),ca=function(){function e(t){this.version=t,this.type="node",this.name="node",this.os=process.platform}return e}(),da=function(){function e(t,o,r,n){this.name=t,this.version=o,this.os=r,this.bot=n,this.type="bot-device"}return e}(),pa=function(){function e(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return e}(),ua=function(){function e(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return e}(),ql=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,Zl=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,aa=3,Kl=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["searchbot",ql]],sa=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]]});var tn=ot(S=>{"use strict";Object.defineProperty(S,"__esModule",{value:!0});S.getClientMeta=S.getLocalStorage=S.getLocalStorageOrThrow=S.getCrypto=S.getCryptoOrThrow=S.getLocation=S.getLocationOrThrow=S.getNavigator=S.getNavigatorOrThrow=S.getDocument=S.getDocumentOrThrow=S.getFromWindowOrThrow=S.getFromWindow=S.isBrowser=S.isNode=S.isMobile=S.isIOS=S.isAndroid=S.detectOS=S.detectEnv=void 0;var ya=Zo(),Ql=ya.__importStar(ia()),Ie=ya.__importStar(Xr()),ec=(ba(),Hr(ga));function en(e){return(0,ec.detect)(e)}S.detectEnv=en;function Jo(){let e=en();return e&&e.os?e.os:void 0}S.detectOS=Jo;function va(){let e=Jo();return e?e.toLowerCase().includes("android"):!1}S.isAndroid=va;function wa(){let e=Jo();return e?e.toLowerCase().includes("ios")||e.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}S.isIOS=wa;function tc(){return Jo()?va()||wa():!1}S.isMobile=tc;function Ca(){let e=en();return e&&e.name?e.name.toLowerCase()==="node":!1}S.isNode=Ca;function oc(){return!Ca()&&!!(0,S.getNavigator)()}S.isBrowser=oc;S.getFromWindow=Ie.getFromWindow;S.getFromWindowOrThrow=Ie.getFromWindowOrThrow;S.getDocumentOrThrow=Ie.getDocumentOrThrow;S.getDocument=Ie.getDocument;S.getNavigatorOrThrow=Ie.getNavigatorOrThrow;S.getNavigator=Ie.getNavigator;S.getLocationOrThrow=Ie.getLocationOrThrow;S.getLocation=Ie.getLocation;S.getCryptoOrThrow=Ie.getCryptoOrThrow;S.getCrypto=Ie.getCrypto;S.getLocalStorageOrThrow=Ie.getLocalStorageOrThrow;S.getLocalStorage=Ie.getLocalStorage;function rc(){return Ql.getWindowMetadata()}S.getClientMeta=rc});var Ea={};Gr(Ea,{safeJsonParse:()=>nc,safeJsonStringify:()=>ic});function nc(e){if(typeof e!="string")throw new Error(`Cannot safe json parse value of type ${typeof e}`);try{return JSON.parse(e)}catch{return e}}function ic(e){return typeof e=="string"?e:JSON.stringify(e)}var xa=Zn(()=>{});var on=ot(zt=>{"use strict";Object.defineProperty(zt,"__esModule",{value:!0});zt.safeJsonStringify=zt.safeJsonParse=void 0;var ac=Zo(),_a=ac.__importStar((xa(),Hr(Ea)));zt.safeJsonParse=_a.safeJsonParse;zt.safeJsonStringify=_a.safeJsonStringify});var nn=ot(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.removeLocal=dt.getLocal=dt.setLocal=void 0;var La=on(),rn=tn();function sc(e,t){let o=(0,La.safeJsonStringify)(t),r=(0,rn.getLocalStorage)();r&&r.setItem(e,o)}dt.setLocal=sc;function lc(e){let t=null,o=null,r=(0,rn.getLocalStorage)();return r&&(o=r.getItem(e)),t=o&&(0,La.safeJsonParse)(o),t}dt.getLocal=lc;function cc(e){let t=(0,rn.getLocalStorage)();t&&t.removeItem(e)}dt.removeLocal=cc});var Pa=ot(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.getMobileLinkRegistry=be.getMobileRegistryEntry=be.saveMobileLinkInfo=be.formatIOSMobile=be.mobileLinkChoiceKey=void 0;var dc=nn();be.mobileLinkChoiceKey="WALLETCONNECT_DEEPLINK_CHOICE";function pc(e,t){let o=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${o}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${o}`:""}be.formatIOSMobile=pc;function uc(e){let t=e.href.split("?")[0];(0,dc.setLocal)(be.mobileLinkChoiceKey,Object.assign(Object.assign({},e),{href:t}))}be.saveMobileLinkInfo=uc;function Sa(e,t){return e.filter(o=>o.name.toLowerCase().includes(t.toLowerCase()))[0]}be.getMobileRegistryEntry=Sa;function fc(e,t){let o=e;return t&&(o=t.map(r=>Sa(e,r)).filter(Boolean)),o}be.getMobileLinkRegistry=fc});var Ta=ot(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.formatMobileRegistry=Ke.formatMobileRegistryEntry=Ke.getDappRegistryUrl=Ke.getWalletRegistryUrl=void 0;var ka="https://registry.walletconnect.com";function mc(){return ka+"/api/v2/wallets"}Ke.getWalletRegistryUrl=mc;function hc(){return ka+"/api/v2/dapps"}Ke.getDappRegistryUrl=hc;function Aa(e,t="mobile"){var o;return{name:e.name||"",shortName:e.metadata.shortName||"",color:e.metadata.colors.primary||"",logo:(o=e.image_url.sm)!==null&&o!==void 0?o:"",universalLink:e[t].universal||"",deepLink:e[t].native||""}}Ke.formatMobileRegistryEntry=Aa;function gc(e,t="mobile"){return Object.values(e).filter(o=>!!o[t].universal||!!o[t].native).map(o=>Aa(o,t))}Ke.formatMobileRegistry=gc});var Wa=ot(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});var yo=Zo();yo.__exportStar(tn(),kt);yo.__exportStar(on(),kt);yo.__exportStar(nn(),kt);yo.__exportStar(Pa(),kt);yo.__exportStar(Ta(),kt)});var D1={};Gr(D1,{AsExternalProvider:()=>ct,ConnectorManager:()=>qt,PrivyClient:()=>Kt,PrivyProvider:()=>bl,PrivyProxyProvider:()=>Ue,VERSION:()=>Oo,WalletConnector:()=>Ze,getAccessToken:()=>gl,usePrivy:()=>G});module.exports=Hr(D1);var hl=require("@ethersproject/providers"),Q=require("react");var _=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};var Jn=L(require("axios")),De=class extends Error{constructor(o,r){super(o);r instanceof Error&&(this.cause=r)}toString(){return`${this.type}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},Dt=class extends De{constructor(o,r,n,i){super(n,i);this.type=o;this.status=r}},E=class extends De{constructor(o,r){super(o,r);this.type="client_error"}};var te=class extends De{constructor(o,r){super(o,r);this.type="connector_error"}},oe=e=>{if(e instanceof De)return e;if(!Jn.default.isAxiosError(e))return Te(e);if(!e.response)return new Dt("api_error",null,e.message,e);let{type:t,message:o,error:r}=e.response.data;return new Dt(t||"ApiError",e.response.status,o||r,e)},Te=e=>e instanceof De?e:e instanceof Error?new E(e.message,e):new E(`Internal error: ${e}`);var Yn=()=>"/api/v1/sessions",Xn=()=>"/api/v1/sessions/logout",Qn=()=>"/api/v1/sessions/fork",ei=()=>"/api/v1/sessions/fork/recover",ti=()=>"/api/v1/siwe/init",oi=()=>"/api/v1/siwe/authenticate",ri=()=>"/api/v1/siwe/link",ni=()=>"/api/v1/passwordless/init",ii=()=>"/api/v1/passwordless/authenticate",ai=()=>"/api/v1/passwordless/link",si=()=>"/api/v1/passwordless_sms/init",li=()=>"/api/v1/passwordless_sms/authenticate",ci=()=>"/api/v1/passwordless_sms/link",di=()=>"/api/v1/oauth/init",pi=()=>"/api/v1/oauth/authenticate",ui=()=>"/api/v1/oauth/link",fi=()=>"/api/v1/siwe/unlink",mi=()=>"/api/v1/passwordless/unlink",hi=()=>"/api/v1/passwordless_sms/unlink",gi=()=>"/api/v1/oauth/unlink";var mo=class{constructor(t){this.meta={email:t}}async authenticate(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new E("Email and email code must be set prior to calling authenticate.");try{let t=ii(),o=await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(t){throw oe(t)}}async link(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new E("Email and email code must be set prior to calling authenticate.");try{let t=ai();return(await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode})).data}catch(t){throw oe(t)}}async sendCodeEmail(t){if(!this.api)throw new E("Auth flow has no API instance");if(t&&(this.meta.email=t),!this.meta.email)throw new E("Email must be set when initialzing authentication.");try{let o=ni();return(await this.api.post(o,{email:this.meta.email})).data}catch(o){throw oe(o)}}};var Ut=class{constructor(t,o,r){this.meta={provider:t},this.meta.authorizationCode=o,this.meta.stateCode=r}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new E("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new E("User denied confirmation during OAuth flow");try{let t=pi(),o=await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(t){throw oe(t)}}async link(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new E("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new E("User denied confirmation during OAuth flow");try{let t=ui();return(await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode})).data}catch(t){throw oe(t)}}async getAuthorizationUrl(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.provider)throw new E("Provider must be set when initialzing OAuth authentication.");try{let t=di();return(await this.api.post(t,{provider:this.meta.provider,redirect_to:window.location.href})).data}catch(t){throw oe(t)}}};var Bt=class{constructor(t,o,r){this._meta={walletType:o,walletId:r},this.connectors=t,this.walletConnector=this.connectors.createWalletConnector(o,null,r)}get meta(){return{...this._meta,walletName:this.walletConnector.walletBranding.name,walletIcon:this.walletConnector.walletBranding.icon}}async authenticate(){if(!this.api)throw new E("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(oi(),{message:t,signature:o});return this.connectors.addWalletConnector(this.walletConnector),await this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),{user:r.data.user,token:r.data.token,refresh_token:r.data.refresh_token,is_new_user:r.data.is_new_user}}catch(t){throw oe(t)}}async link(){if(!this.api)throw new E("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(ri(),{message:t,signature:o});return this.connectors.addWalletConnector(this.walletConnector),await this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),r.data}catch(t){throw oe(t)}}async promptConnect(){if(!this.api)throw new E("Auth flow has no API instance");let t=await this.walletConnector.connect({showPrompt:!0});return await this.buildSiweMessage(t),t}async sign(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.preparedMessage){let o=await this.walletConnector.connect({showPrompt:!1});await this.buildSiweMessage(o)}if(!this.preparedMessage)throw new E("Could not prepare SIWE message");let t=await this.walletConnector.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async buildSiweMessage(t){if(!this.api)throw new E("Auth flow has no API instance");let o=t.address,r=t.chainId,n=await this.api.post(ti(),{address:o});return this.preparedMessage=this.walletConnector.prepareMessage(r,o,n.data.nonce),this.preparedMessage}};var ho=class{constructor(t){this.meta={phoneNumber:t}}async authenticate(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new E("phone number and sms code must be set prior to calling authenticate.");try{let t=li(),o=await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(t){throw oe(t)}}async link(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new E("phone number and sms code must be set prior to calling authenticate.");try{let t=ci();return(await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})).data}catch(t){throw oe(t)}}async sendSmsCode(t){if(!this.api)throw new E("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),!this.meta.phoneNumber)throw new E("phone nNumber must be set when initialzing authentication.");try{let o=si();return(await this.api.post(o,{phoneNumber:this.meta.phoneNumber})).data}catch(o){throw oe(o)}}};var Ua=require("@ethersproject/address");var bi="1.20.3-beta.2";var yi="https://api.privy.io/v0",Io=process.env.NEXT_PUBLIC_PRIVY_AUTH_URL||"https://auth.privy.io",Mo="4df5e2316331463a9130964bd6078dfa",vi=1e4,We=1400,Oo=bi;var Ft="privy:token",No="privy:refresh_token",go="privy:session_transfer_token",Do="privy:connectors",Vr="walletconnect",wi=3e4;var jr=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,o){o!==void 0?this._cache[t]=o:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},$r=class{get(t){let o=localStorage.getItem(t);return o===null?void 0:JSON.parse(o)}put(t,o){o!==void 0?localStorage.setItem(t,JSON.stringify(o)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function kl(){return typeof window<"u"&&window.localStorage?new $r:new jr}var z=kl();var _i=L(require("@coinbase/wallet-sdk")),Li=require("@ethersproject/address");var bo=require("react/jsx-runtime"),Re=({style:e,...t})=>(0,bo.jsxs)("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[(0,bo.jsx)("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),(0,bo.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});var Ei=require("@ethersproject/address"),xi=require("@ethersproject/providers");var Ci=require("@ethersproject/logger");var Gt=class extends te{constructor(){super("Wallet timeout");this.type="wallet_error"}},_t=class extends te{constructor(){super("User rejected connection");this.type="wallet_error"}},qe=e=>{if(e instanceof te)return e;if((e==null?void 0:e.code)&&(e==null?void 0:e.reason)){let t=new Ht(e);return e.code===Ci.ErrorCode.ACTION_REJECTED&&(t.details=xt.E4001_USER_REJECTED_REQUEST),t}return e!=null&&e.code?new Ht(e):new te("Unknown connector error",e)},zr=class extends De{constructor(o,r,n){super(o);this.type="provider_error";this.code=r,this.data=n}},Ht=class extends zr{constructor(o){var i,a,s;let r=o;super(r.message,r.code,r.data);let n=Object.values(xt).find(l=>l.eipCode===r.code);this.details=n||xt.UNKNOWN_ERROR,r.code===-32002&&((i=r.message)!=null&&i.includes("already pending for origin")?(a=r.message)!=null&&a.includes("wallet_requestPermissions")?this.details=xt.E32002_CONNECTION_ALREADY_PENDING:this.details=xt.E32002_REQUEST_ALREADY_PENDING:(s=r.message)!=null&&s.includes("Already processing")&&r.message.includes("eth_requestAccounts")&&(this.details=xt.E32002_WALLET_LOCKED))}},Al={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_REJECTED_CONNECTION:{message:"You rejected the request",detail:"Please try connecting again.",retryable:!0}},Tl={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},Wl={E4001_DEFAULT_USER_REJECTED_REQUEST:{eipCode:4001,message:"User Rejected Request",detail:"The user rejected the request.",default:!0,retryable:!0},E4100_DEFAULT_UNAUTHORIZED:{eipCode:4100,message:"Unauthorized",detail:"The requested method and/or account has not been authorized by the user.",default:!0,retryable:!1},E4200_DEFAULT_UNSUPPORTED_METHOD:{eipCode:4200,message:"Unsupported Method",detail:"The Provider does not support the requested method.",default:!0,retryable:!1},E4900_DEFAULT_DISCONNECTED:{eipCode:4900,message:"Disconnected",detail:"The Provider is disconnected from all chains.",default:!0,retryable:!0},E4901_DEFAULT_CHAIN_DISCONNECTED:{eipCode:4901,message:"Chain Disconnected",detail:"The Provider is not connected to the requested chain.",default:!0,retryable:!0},E32700_DEFAULT_PARSE_ERROR:{eipCode:-32700,message:"Parse error",detail:"Invalid JSON",default:!0,retryable:!1},E32600_DEFAULT_INVALID_REQUEST:{eipCode:-32600,message:"Invalid request",detail:"JSON is not a valid request object",default:!0,retryable:!1},E32601_DEFAULT_METHOD_NOT_FOUND:{eipCode:-32601,message:"Method not found",detail:"Method does not exist",default:!0,retryable:!1},E32602_DEFAULT_INVALID_PARAMS:{eipCode:-32602,message:"Invalid params",detail:"Invalid method parameters",default:!0,retryable:!1},E32603_DEFAULT_INTERNAL_ERROR:{eipCode:-32603,message:"Internal error",detail:"Internal JSON-RPC error",default:!0,retryable:!0},E32000_DEFAULT_INVALID_INPUT:{eipCode:-32e3,message:"Invalid input",detail:"Missing or invalid parameters",default:!0,retryable:!1},E32001_DEFAULT_RESOURCE_NOT_FOUND:{eipCode:-32001,message:"Resource not found",detail:"Requested resource not found",default:!0,retryable:!1},E32002_DEFAULT_RESOURCE_UNAVAILABLE:{eipCode:-32002,message:"Resource unavailable",detail:"Requested resource not available",default:!0,retryable:!0},E32003_DEFAULT_TRANSACTION_REJECTED:{eipCode:-32003,message:"Transaction rejected",detail:"Transaction creation failed",default:!0,retryable:!0},E32004_DEFAULT_METHOD_NOT_SUPPORTED:{eipCode:-32004,message:"Method not supported",detail:"Method is not implemented",default:!0,retryable:!1},E32005_DEFAULT_LIMIT_EXCEEDED:{eipCode:-32005,message:"Limit exceeded",detail:"Request exceeds defined limit",default:!0,retryable:!1},E32006_DEFAULT_JSON_RPC_VERSION_NOT_SUPPORTED:{eipCode:-32006,message:"JSON-RPC version not supported",detail:"Version of JSON-RPC protocol is not supported",default:!0,retryable:!1}},xt={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...Wl,...Tl},Lt={...Al,...xt};var Rl=12e4,qr=(e=new Gt,t=Rl)=>new Promise((o,r)=>setTimeout(()=>{r(e)},t)),Ue=class{constructor(t){this.removeListener=(t,o)=>{if(this.walletProvider)return this.walletProvider.removeListener(t,o)};this.setWalletProvider=t=>{this.walletProvider=t,this._subscriptions.forEach(o=>{var r;(r=this.walletProvider)==null||r.on(o.eventName,o.listener)})};this.walletProvider=t,this._subscriptions=[]}on(t,o){if(this.walletProvider)return this.walletProvider.on(t,o);this._subscriptions.push({eventName:t,listener:o})}async request(t){if(!this.walletProvider)throw new te(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),qr()]).catch(o=>{throw qe(o)})}},ct=class extends Ue{constructor(o){super(o)}},Uo=class extends Ue{constructor(t){super(t)}sendAsync(t,o){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var Ze=class{constructor(t,o,r){this.createSiweMessage=(t,o,r,n,i,a,s)=>`${r} wants you to sign in with your Ethereum account:
1
+ "use strict";var El=Object.create;var Ro=Object.defineProperty;var xl=Object.getOwnPropertyDescriptor;var _l=Object.getOwnPropertyNames;var Ll=Object.getPrototypeOf,Sl=Object.prototype.hasOwnProperty;var Zn=(e,t)=>()=>(e&&(t=e(e=0)),t);var ot=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Gr=(e,t)=>{for(var o in t)Ro(e,o,{get:t[o],enumerable:!0})},Kn=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of _l(t))!Sl.call(e,n)&&n!==o&&Ro(e,n,{get:()=>t[n],enumerable:!(r=xl(t,n))||r.enumerable});return e};var L=(e,t,o)=>(o=e!=null?El(Ll(e)):{},Kn(t||!e||!e.__esModule?Ro(o,"default",{value:e,enumerable:!0}):o,e)),Hr=e=>Kn(Ro({},"__esModule",{value:!0}),e);var Zo=ot((Np,qo)=>{var Di,Ui,Bi,Fi,Gi,Hi,Vi,ji,$i,$o,Yr,zi,qi,Zi,jt,Ki,Ji,Yi,Xi,Qi,ea,ta,oa,ra,zo;(function(e){var t=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:{};typeof define=="function"&&define.amd?define("tslib",["exports"],function(r){e(o(t,o(r)))}):typeof qo=="object"&&typeof qo.exports=="object"?e(o(t,o(qo.exports))):e(o(t));function o(r,n){return r!==t&&(typeof Object.create=="function"?Object.defineProperty(r,"__esModule",{value:!0}):r.__esModule=!0),function(i,a){return r[i]=n?n(i,a):a}}})(function(e){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])};Di=function(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(r,n);function i(){this.constructor=r}r.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)},Ui=Object.assign||function(r){for(var n,i=1,a=arguments.length;i<a;i++){n=arguments[i];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])}return r},Bi=function(r,n){var i={};for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&n.indexOf(a)<0&&(i[a]=r[a]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,a=Object.getOwnPropertySymbols(r);s<a.length;s++)n.indexOf(a[s])<0&&Object.prototype.propertyIsEnumerable.call(r,a[s])&&(i[a[s]]=r[a[s]]);return i},Fi=function(r,n,i,a){var s=arguments.length,l=s<3?n:a===null?a=Object.getOwnPropertyDescriptor(n,i):a,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(r,n,i,a);else for(var h=r.length-1;h>=0;h--)(d=r[h])&&(l=(s<3?d(l):s>3?d(n,i,l):d(n,i))||l);return s>3&&l&&Object.defineProperty(n,i,l),l},Gi=function(r,n){return function(i,a){n(i,a,r)}},Hi=function(r,n){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,n)},Vi=function(r,n,i,a){function s(l){return l instanceof i?l:new i(function(d){d(l)})}return new(i||(i=Promise))(function(l,d){function h(g){try{p(a.next(g))}catch(b){d(b)}}function m(g){try{p(a.throw(g))}catch(b){d(b)}}function p(g){g.done?l(g.value):s(g.value).then(h,m)}p((a=a.apply(r,n||[])).next())})},ji=function(r,n){var i={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},a,s,l,d;return d={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function h(p){return function(g){return m([p,g])}}function m(p){if(a)throw new TypeError("Generator is already executing.");for(;i;)try{if(a=1,s&&(l=p[0]&2?s.return:p[0]?s.throw||((l=s.return)&&l.call(s),0):s.next)&&!(l=l.call(s,p[1])).done)return l;switch(s=0,l&&(p=[p[0]&2,l.value]),p[0]){case 0:case 1:l=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,s=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(l=i.trys,!(l=l.length>0&&l[l.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!l||p[1]>l[0]&&p[1]<l[3])){i.label=p[1];break}if(p[0]===6&&i.label<l[1]){i.label=l[1],l=p;break}if(l&&i.label<l[2]){i.label=l[2],i.ops.push(p);break}l[2]&&i.ops.pop(),i.trys.pop();continue}p=n.call(r,i)}catch(g){p=[6,g],s=0}finally{a=l=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},$i=function(r,n){for(var i in r)i!=="default"&&!Object.prototype.hasOwnProperty.call(n,i)&&zo(n,r,i)},zo=Object.create?function(r,n,i,a){a===void 0&&(a=i);var s=Object.getOwnPropertyDescriptor(n,i);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[i]}}),Object.defineProperty(r,a,s)}:function(r,n,i,a){a===void 0&&(a=i),r[a]=n[i]},$o=function(r){var n=typeof Symbol=="function"&&Symbol.iterator,i=n&&r[n],a=0;if(i)return i.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&a>=r.length&&(r=void 0),{value:r&&r[a++],done:!r}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},Yr=function(r,n){var i=typeof Symbol=="function"&&r[Symbol.iterator];if(!i)return r;var a=i.call(r),s,l=[],d;try{for(;(n===void 0||n-- >0)&&!(s=a.next()).done;)l.push(s.value)}catch(h){d={error:h}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(d)throw d.error}}return l},zi=function(){for(var r=[],n=0;n<arguments.length;n++)r=r.concat(Yr(arguments[n]));return r},qi=function(){for(var r=0,n=0,i=arguments.length;n<i;n++)r+=arguments[n].length;for(var a=Array(r),s=0,n=0;n<i;n++)for(var l=arguments[n],d=0,h=l.length;d<h;d++,s++)a[s]=l[d];return a},Zi=function(r,n,i){if(i||arguments.length===2)for(var a=0,s=n.length,l;a<s;a++)(l||!(a in n))&&(l||(l=Array.prototype.slice.call(n,0,a)),l[a]=n[a]);return r.concat(l||Array.prototype.slice.call(n))},jt=function(r){return this instanceof jt?(this.v=r,this):new jt(r)},Ki=function(r,n,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var a=i.apply(r,n||[]),s,l=[];return s={},d("next"),d("throw"),d("return"),s[Symbol.asyncIterator]=function(){return this},s;function d(c){a[c]&&(s[c]=function(y){return new Promise(function(C,M){l.push([c,y,C,M])>1||h(c,y)})})}function h(c,y){try{m(a[c](y))}catch(C){b(l[0][3],C)}}function m(c){c.value instanceof jt?Promise.resolve(c.value.v).then(p,g):b(l[0][2],c)}function p(c){h("next",c)}function g(c){h("throw",c)}function b(c,y){c(y),l.shift(),l.length&&h(l[0][0],l[0][1])}},Ji=function(r){var n,i;return n={},a("next"),a("throw",function(s){throw s}),a("return"),n[Symbol.iterator]=function(){return this},n;function a(s,l){n[s]=r[s]?function(d){return(i=!i)?{value:jt(r[s](d)),done:s==="return"}:l?l(d):d}:l}},Yi=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r[Symbol.asyncIterator],i;return n?n.call(r):(r=typeof $o=="function"?$o(r):r[Symbol.iterator](),i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i);function a(l){i[l]=r[l]&&function(d){return new Promise(function(h,m){d=r[l](d),s(h,m,d.done,d.value)})}}function s(l,d,h,m){Promise.resolve(m).then(function(p){l({value:p,done:h})},d)}},Xi=function(r,n){return Object.defineProperty?Object.defineProperty(r,"raw",{value:n}):r.raw=n,r};var o=Object.create?function(r,n){Object.defineProperty(r,"default",{enumerable:!0,value:n})}:function(r,n){r.default=n};Qi=function(r){if(r&&r.__esModule)return r;var n={};if(r!=null)for(var i in r)i!=="default"&&Object.prototype.hasOwnProperty.call(r,i)&&zo(n,r,i);return o(n,r),n},ea=function(r){return r&&r.__esModule?r:{default:r}},ta=function(r,n,i,a){if(i==="a"&&!a)throw new TypeError("Private accessor was defined without a getter");if(typeof n=="function"?r!==n||!a:!n.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?a:i==="a"?a.call(r):a?a.value:n.get(r)},oa=function(r,n,i,a,s){if(a==="m")throw new TypeError("Private method is not writable");if(a==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof n=="function"?r!==n||!s:!n.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return a==="a"?s.call(r,i):s?s.value=i:n.set(r,i),i},ra=function(r,n){if(n===null||typeof n!="object"&&typeof n!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof r=="function"?n===r:r.has(n)},e("__extends",Di),e("__assign",Ui),e("__rest",Bi),e("__decorate",Fi),e("__param",Gi),e("__metadata",Hi),e("__awaiter",Vi),e("__generator",ji),e("__exportStar",$i),e("__createBinding",zo),e("__values",$o),e("__read",Yr),e("__spread",zi),e("__spreadArrays",qi),e("__spreadArray",Zi),e("__await",jt),e("__asyncGenerator",Ki),e("__asyncDelegator",Ji),e("__asyncValues",Yi),e("__makeTemplateObject",Xi),e("__importStar",Qi),e("__importDefault",ea),e("__classPrivateFieldGet",ta),e("__classPrivateFieldSet",oa),e("__classPrivateFieldIn",ra)})});var Xr=ot(U=>{"use strict";Object.defineProperty(U,"__esModule",{value:!0});U.getLocalStorage=U.getLocalStorageOrThrow=U.getCrypto=U.getCryptoOrThrow=U.getLocation=U.getLocationOrThrow=U.getNavigator=U.getNavigatorOrThrow=U.getDocument=U.getDocumentOrThrow=U.getFromWindowOrThrow=U.getFromWindow=void 0;function Pt(e){let t;return typeof window<"u"&&typeof window[e]<"u"&&(t=window[e]),t}U.getFromWindow=Pt;function $t(e){let t=Pt(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}U.getFromWindowOrThrow=$t;function Ol(){return $t("document")}U.getDocumentOrThrow=Ol;function Nl(){return Pt("document")}U.getDocument=Nl;function Dl(){return $t("navigator")}U.getNavigatorOrThrow=Dl;function Ul(){return Pt("navigator")}U.getNavigator=Ul;function Bl(){return $t("location")}U.getLocationOrThrow=Bl;function Fl(){return Pt("location")}U.getLocation=Fl;function Gl(){return $t("crypto")}U.getCryptoOrThrow=Gl;function Hl(){return Pt("crypto")}U.getCrypto=Hl;function Vl(){return $t("localStorage")}U.getLocalStorageOrThrow=Vl;function jl(){return Pt("localStorage")}U.getLocalStorage=jl});var ia=ot(Ko=>{"use strict";Object.defineProperty(Ko,"__esModule",{value:!0});Ko.getWindowMetadata=void 0;var na=Xr();function $l(){let e,t;try{e=na.getDocumentOrThrow(),t=na.getLocationOrThrow()}catch{return null}function o(){let m=e.getElementsByTagName("link"),p=[];for(let g=0;g<m.length;g++){let b=m[g],c=b.getAttribute("rel");if(c&&c.toLowerCase().indexOf("icon")>-1){let y=b.getAttribute("href");if(y)if(y.toLowerCase().indexOf("https:")===-1&&y.toLowerCase().indexOf("http:")===-1&&y.indexOf("//")!==0){let C=t.protocol+"//"+t.host;if(y.indexOf("/")===0)C+=y;else{let M=t.pathname.split("/");M.pop(),C+=M.join("/")+"/"+y}p.push(C)}else if(y.indexOf("//")===0){let C=t.protocol+y;p.push(C)}else p.push(y)}}return p}function r(...m){let p=e.getElementsByTagName("meta");for(let g=0;g<p.length;g++){let b=p[g],c=["itemprop","property","name"].map(y=>b.getAttribute(y)).filter(y=>y?m.includes(y):!1);if(c.length&&c){let y=b.getAttribute("content");if(y)return y}}return""}function n(){let m=r("name","og:site_name","og:title","twitter:title");return m||(m=e.title),m}function i(){return r("description","og:description","twitter:description","keywords")}let a=n(),s=i(),l=t.origin,d=o();return{description:s,url:l,icons:d,name:a}}Ko.getWindowMetadata=$l});var ga={};Gr(ga,{BotInfo:()=>pa,BrowserInfo:()=>la,NodeInfo:()=>ca,ReactNativeInfo:()=>ua,SearchBotDeviceInfo:()=>da,browserName:()=>Yl,detect:()=>Jl,detectOS:()=>ma,getNodeVersion:()=>ha,parseUserAgent:()=>Qr});function Jl(e){return e?Qr(e):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new ua:typeof navigator<"u"?Qr(navigator.userAgent):ha()}function fa(e){return e!==""&&Kl.reduce(function(t,o){var r=o[0],n=o[1];if(t)return t;var i=n.exec(e);return!!i&&[r,i]},!1)}function Yl(e){var t=fa(e);return t?t[0]:null}function Qr(e){var t=fa(e);if(!t)return null;var o=t[0],r=t[1];if(o==="searchbot")return new pa;var n=r[1]&&r[1].split(/[._]/).slice(0,3);n?n.length<aa&&(n=zl(n,Xl(aa-n.length))):n=[];var i=n.join("."),a=ma(e),s=Zl.exec(e);return s&&s[1]?new da(o,i,a,s[1]):new la(o,i,a)}function ma(e){for(var t=0,o=sa.length;t<o;t++){var r=sa[t],n=r[0],i=r[1],a=i.exec(e);if(a)return n}return null}function ha(){var e=typeof process<"u"&&process.version;return e?new ca(process.version.slice(1)):null}function Xl(e){for(var t=[],o=0;o<e;o++)t.push("0");return t}var zl,la,ca,da,pa,ua,ql,Zl,aa,Kl,sa,ba=Zn(()=>{zl=function(){for(var e=0,t=0,o=arguments.length;t<o;t++)e+=arguments[t].length;for(var r=Array(e),n=0,t=0;t<o;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,n++)r[n]=i[a];return r},la=function(){function e(t,o,r){this.name=t,this.version=o,this.os=r,this.type="browser"}return e}(),ca=function(){function e(t){this.version=t,this.type="node",this.name="node",this.os=process.platform}return e}(),da=function(){function e(t,o,r,n){this.name=t,this.version=o,this.os=r,this.bot=n,this.type="bot-device"}return e}(),pa=function(){function e(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return e}(),ua=function(){function e(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return e}(),ql=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,Zl=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,aa=3,Kl=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["searchbot",ql]],sa=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]]});var tn=ot(S=>{"use strict";Object.defineProperty(S,"__esModule",{value:!0});S.getClientMeta=S.getLocalStorage=S.getLocalStorageOrThrow=S.getCrypto=S.getCryptoOrThrow=S.getLocation=S.getLocationOrThrow=S.getNavigator=S.getNavigatorOrThrow=S.getDocument=S.getDocumentOrThrow=S.getFromWindowOrThrow=S.getFromWindow=S.isBrowser=S.isNode=S.isMobile=S.isIOS=S.isAndroid=S.detectOS=S.detectEnv=void 0;var ya=Zo(),Ql=ya.__importStar(ia()),Ie=ya.__importStar(Xr()),ec=(ba(),Hr(ga));function en(e){return(0,ec.detect)(e)}S.detectEnv=en;function Jo(){let e=en();return e&&e.os?e.os:void 0}S.detectOS=Jo;function va(){let e=Jo();return e?e.toLowerCase().includes("android"):!1}S.isAndroid=va;function wa(){let e=Jo();return e?e.toLowerCase().includes("ios")||e.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}S.isIOS=wa;function tc(){return Jo()?va()||wa():!1}S.isMobile=tc;function Ca(){let e=en();return e&&e.name?e.name.toLowerCase()==="node":!1}S.isNode=Ca;function oc(){return!Ca()&&!!(0,S.getNavigator)()}S.isBrowser=oc;S.getFromWindow=Ie.getFromWindow;S.getFromWindowOrThrow=Ie.getFromWindowOrThrow;S.getDocumentOrThrow=Ie.getDocumentOrThrow;S.getDocument=Ie.getDocument;S.getNavigatorOrThrow=Ie.getNavigatorOrThrow;S.getNavigator=Ie.getNavigator;S.getLocationOrThrow=Ie.getLocationOrThrow;S.getLocation=Ie.getLocation;S.getCryptoOrThrow=Ie.getCryptoOrThrow;S.getCrypto=Ie.getCrypto;S.getLocalStorageOrThrow=Ie.getLocalStorageOrThrow;S.getLocalStorage=Ie.getLocalStorage;function rc(){return Ql.getWindowMetadata()}S.getClientMeta=rc});var Ea={};Gr(Ea,{safeJsonParse:()=>nc,safeJsonStringify:()=>ic});function nc(e){if(typeof e!="string")throw new Error(`Cannot safe json parse value of type ${typeof e}`);try{return JSON.parse(e)}catch{return e}}function ic(e){return typeof e=="string"?e:JSON.stringify(e)}var xa=Zn(()=>{});var on=ot(zt=>{"use strict";Object.defineProperty(zt,"__esModule",{value:!0});zt.safeJsonStringify=zt.safeJsonParse=void 0;var ac=Zo(),_a=ac.__importStar((xa(),Hr(Ea)));zt.safeJsonParse=_a.safeJsonParse;zt.safeJsonStringify=_a.safeJsonStringify});var nn=ot(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.removeLocal=dt.getLocal=dt.setLocal=void 0;var La=on(),rn=tn();function sc(e,t){let o=(0,La.safeJsonStringify)(t),r=(0,rn.getLocalStorage)();r&&r.setItem(e,o)}dt.setLocal=sc;function lc(e){let t=null,o=null,r=(0,rn.getLocalStorage)();return r&&(o=r.getItem(e)),t=o&&(0,La.safeJsonParse)(o),t}dt.getLocal=lc;function cc(e){let t=(0,rn.getLocalStorage)();t&&t.removeItem(e)}dt.removeLocal=cc});var Pa=ot(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.getMobileLinkRegistry=be.getMobileRegistryEntry=be.saveMobileLinkInfo=be.formatIOSMobile=be.mobileLinkChoiceKey=void 0;var dc=nn();be.mobileLinkChoiceKey="WALLETCONNECT_DEEPLINK_CHOICE";function pc(e,t){let o=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${o}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${o}`:""}be.formatIOSMobile=pc;function uc(e){let t=e.href.split("?")[0];(0,dc.setLocal)(be.mobileLinkChoiceKey,Object.assign(Object.assign({},e),{href:t}))}be.saveMobileLinkInfo=uc;function Sa(e,t){return e.filter(o=>o.name.toLowerCase().includes(t.toLowerCase()))[0]}be.getMobileRegistryEntry=Sa;function fc(e,t){let o=e;return t&&(o=t.map(r=>Sa(e,r)).filter(Boolean)),o}be.getMobileLinkRegistry=fc});var Ta=ot(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.formatMobileRegistry=Ke.formatMobileRegistryEntry=Ke.getDappRegistryUrl=Ke.getWalletRegistryUrl=void 0;var ka="https://registry.walletconnect.com";function mc(){return ka+"/api/v2/wallets"}Ke.getWalletRegistryUrl=mc;function hc(){return ka+"/api/v2/dapps"}Ke.getDappRegistryUrl=hc;function Aa(e,t="mobile"){var o;return{name:e.name||"",shortName:e.metadata.shortName||"",color:e.metadata.colors.primary||"",logo:(o=e.image_url.sm)!==null&&o!==void 0?o:"",universalLink:e[t].universal||"",deepLink:e[t].native||""}}Ke.formatMobileRegistryEntry=Aa;function gc(e,t="mobile"){return Object.values(e).filter(o=>!!o[t].universal||!!o[t].native).map(o=>Aa(o,t))}Ke.formatMobileRegistry=gc});var Wa=ot(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});var yo=Zo();yo.__exportStar(tn(),kt);yo.__exportStar(on(),kt);yo.__exportStar(nn(),kt);yo.__exportStar(Pa(),kt);yo.__exportStar(Ta(),kt)});var D1={};Gr(D1,{AsExternalProvider:()=>ct,ConnectorManager:()=>qt,PrivyClient:()=>Kt,PrivyProvider:()=>bl,PrivyProxyProvider:()=>Ue,VERSION:()=>Oo,WalletConnector:()=>Ze,getAccessToken:()=>gl,usePrivy:()=>G});module.exports=Hr(D1);var hl=require("@ethersproject/providers"),Q=require("react");var _=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};var Jn=L(require("axios")),De=class extends Error{constructor(o,r){super(o);r instanceof Error&&(this.cause=r)}toString(){return`${this.type}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},Dt=class extends De{constructor(o,r,n,i){super(n,i);this.type=o;this.status=r}},E=class extends De{constructor(o,r){super(o,r);this.type="client_error"}};var te=class extends De{constructor(o,r){super(o,r);this.type="connector_error"}},oe=e=>{if(e instanceof De)return e;if(!Jn.default.isAxiosError(e))return Te(e);if(!e.response)return new Dt("api_error",null,e.message,e);let{type:t,message:o,error:r}=e.response.data;return new Dt(t||"ApiError",e.response.status,o||r,e)},Te=e=>e instanceof De?e:e instanceof Error?new E(e.message,e):new E(`Internal error: ${e}`);var Yn=()=>"/api/v1/sessions",Xn=()=>"/api/v1/sessions/logout",Qn=()=>"/api/v1/sessions/fork",ei=()=>"/api/v1/sessions/fork/recover",ti=()=>"/api/v1/siwe/init",oi=()=>"/api/v1/siwe/authenticate",ri=()=>"/api/v1/siwe/link",ni=()=>"/api/v1/passwordless/init",ii=()=>"/api/v1/passwordless/authenticate",ai=()=>"/api/v1/passwordless/link",si=()=>"/api/v1/passwordless_sms/init",li=()=>"/api/v1/passwordless_sms/authenticate",ci=()=>"/api/v1/passwordless_sms/link",di=()=>"/api/v1/oauth/init",pi=()=>"/api/v1/oauth/authenticate",ui=()=>"/api/v1/oauth/link",fi=()=>"/api/v1/siwe/unlink",mi=()=>"/api/v1/passwordless/unlink",hi=()=>"/api/v1/passwordless_sms/unlink",gi=()=>"/api/v1/oauth/unlink";var mo=class{constructor(t){this.meta={email:t}}async authenticate(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new E("Email and email code must be set prior to calling authenticate.");try{let t=ii(),o=await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(t){throw oe(t)}}async link(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new E("Email and email code must be set prior to calling authenticate.");try{let t=ai();return(await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode})).data}catch(t){throw oe(t)}}async sendCodeEmail(t){if(!this.api)throw new E("Auth flow has no API instance");if(t&&(this.meta.email=t),!this.meta.email)throw new E("Email must be set when initialzing authentication.");try{let o=ni();return(await this.api.post(o,{email:this.meta.email})).data}catch(o){throw oe(o)}}};var Ut=class{constructor(t,o,r){this.meta={provider:t},this.meta.authorizationCode=o,this.meta.stateCode=r}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new E("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new E("User denied confirmation during OAuth flow");try{let t=pi(),o=await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(t){throw oe(t)}}async link(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new E("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new E("User denied confirmation during OAuth flow");try{let t=ui();return(await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode})).data}catch(t){throw oe(t)}}async getAuthorizationUrl(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.provider)throw new E("Provider must be set when initialzing OAuth authentication.");try{let t=di();return(await this.api.post(t,{provider:this.meta.provider,redirect_to:window.location.href})).data}catch(t){throw oe(t)}}};var Bt=class{constructor(t,o,r){this._meta={walletType:o,walletId:r},this.connectors=t,this.walletConnector=this.connectors.createWalletConnector(o,null,r)}get meta(){return{...this._meta,walletName:this.walletConnector.walletBranding.name,walletIcon:this.walletConnector.walletBranding.icon}}async authenticate(){if(!this.api)throw new E("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(oi(),{message:t,signature:o});return this.connectors.addWalletConnector(this.walletConnector),await this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),{user:r.data.user,token:r.data.token,refresh_token:r.data.refresh_token,is_new_user:r.data.is_new_user}}catch(t){throw oe(t)}}async link(){if(!this.api)throw new E("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(ri(),{message:t,signature:o});return this.connectors.addWalletConnector(this.walletConnector),await this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),r.data}catch(t){throw oe(t)}}async promptConnect(){if(!this.api)throw new E("Auth flow has no API instance");let t=await this.walletConnector.connect({showPrompt:!0});return await this.buildSiweMessage(t),t}async sign(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.preparedMessage){let o=await this.walletConnector.connect({showPrompt:!1});await this.buildSiweMessage(o)}if(!this.preparedMessage)throw new E("Could not prepare SIWE message");let t=await this.walletConnector.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async buildSiweMessage(t){if(!this.api)throw new E("Auth flow has no API instance");let o=t.address,r=t.chainId,n=await this.api.post(ti(),{address:o});return this.preparedMessage=this.walletConnector.prepareMessage(r,o,n.data.nonce),this.preparedMessage}};var ho=class{constructor(t){this.meta={phoneNumber:t}}async authenticate(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new E("phone number and sms code must be set prior to calling authenticate.");try{let t=li(),o=await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(t){throw oe(t)}}async link(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new E("phone number and sms code must be set prior to calling authenticate.");try{let t=ci();return(await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})).data}catch(t){throw oe(t)}}async sendSmsCode(t){if(!this.api)throw new E("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),!this.meta.phoneNumber)throw new E("phone nNumber must be set when initialzing authentication.");try{let o=si();return(await this.api.post(o,{phoneNumber:this.meta.phoneNumber})).data}catch(o){throw oe(o)}}};var Ua=require("@ethersproject/address");var bi="1.20.3";var yi="https://api.privy.io/v0",Io=process.env.NEXT_PUBLIC_PRIVY_AUTH_URL||"https://auth.privy.io",Mo="4df5e2316331463a9130964bd6078dfa",vi=1e4,We=1400,Oo=bi;var Ft="privy:token",No="privy:refresh_token",go="privy:session_transfer_token",Do="privy:connectors",Vr="walletconnect",wi=3e4;var jr=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,o){o!==void 0?this._cache[t]=o:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},$r=class{get(t){let o=localStorage.getItem(t);return o===null?void 0:JSON.parse(o)}put(t,o){o!==void 0?localStorage.setItem(t,JSON.stringify(o)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function kl(){return typeof window<"u"&&window.localStorage?new $r:new jr}var z=kl();var _i=L(require("@coinbase/wallet-sdk")),Li=require("@ethersproject/address");var bo=require("react/jsx-runtime"),Re=({style:e,...t})=>(0,bo.jsxs)("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[(0,bo.jsx)("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),(0,bo.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});var Ei=require("@ethersproject/address"),xi=require("@ethersproject/providers");var Ci=require("@ethersproject/logger");var Gt=class extends te{constructor(){super("Wallet timeout");this.type="wallet_error"}},_t=class extends te{constructor(){super("User rejected connection");this.type="wallet_error"}},qe=e=>{if(e instanceof te)return e;if((e==null?void 0:e.code)&&(e==null?void 0:e.reason)){let t=new Ht(e);return e.code===Ci.ErrorCode.ACTION_REJECTED&&(t.details=xt.E4001_USER_REJECTED_REQUEST),t}return e!=null&&e.code?new Ht(e):new te("Unknown connector error",e)},zr=class extends De{constructor(o,r,n){super(o);this.type="provider_error";this.code=r,this.data=n}},Ht=class extends zr{constructor(o){var i,a,s;let r=o;super(r.message,r.code,r.data);let n=Object.values(xt).find(l=>l.eipCode===r.code);this.details=n||xt.UNKNOWN_ERROR,r.code===-32002&&((i=r.message)!=null&&i.includes("already pending for origin")?(a=r.message)!=null&&a.includes("wallet_requestPermissions")?this.details=xt.E32002_CONNECTION_ALREADY_PENDING:this.details=xt.E32002_REQUEST_ALREADY_PENDING:(s=r.message)!=null&&s.includes("Already processing")&&r.message.includes("eth_requestAccounts")&&(this.details=xt.E32002_WALLET_LOCKED))}},Al={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_REJECTED_CONNECTION:{message:"You rejected the request",detail:"Please try connecting again.",retryable:!0}},Tl={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},Wl={E4001_DEFAULT_USER_REJECTED_REQUEST:{eipCode:4001,message:"User Rejected Request",detail:"The user rejected the request.",default:!0,retryable:!0},E4100_DEFAULT_UNAUTHORIZED:{eipCode:4100,message:"Unauthorized",detail:"The requested method and/or account has not been authorized by the user.",default:!0,retryable:!1},E4200_DEFAULT_UNSUPPORTED_METHOD:{eipCode:4200,message:"Unsupported Method",detail:"The Provider does not support the requested method.",default:!0,retryable:!1},E4900_DEFAULT_DISCONNECTED:{eipCode:4900,message:"Disconnected",detail:"The Provider is disconnected from all chains.",default:!0,retryable:!0},E4901_DEFAULT_CHAIN_DISCONNECTED:{eipCode:4901,message:"Chain Disconnected",detail:"The Provider is not connected to the requested chain.",default:!0,retryable:!0},E32700_DEFAULT_PARSE_ERROR:{eipCode:-32700,message:"Parse error",detail:"Invalid JSON",default:!0,retryable:!1},E32600_DEFAULT_INVALID_REQUEST:{eipCode:-32600,message:"Invalid request",detail:"JSON is not a valid request object",default:!0,retryable:!1},E32601_DEFAULT_METHOD_NOT_FOUND:{eipCode:-32601,message:"Method not found",detail:"Method does not exist",default:!0,retryable:!1},E32602_DEFAULT_INVALID_PARAMS:{eipCode:-32602,message:"Invalid params",detail:"Invalid method parameters",default:!0,retryable:!1},E32603_DEFAULT_INTERNAL_ERROR:{eipCode:-32603,message:"Internal error",detail:"Internal JSON-RPC error",default:!0,retryable:!0},E32000_DEFAULT_INVALID_INPUT:{eipCode:-32e3,message:"Invalid input",detail:"Missing or invalid parameters",default:!0,retryable:!1},E32001_DEFAULT_RESOURCE_NOT_FOUND:{eipCode:-32001,message:"Resource not found",detail:"Requested resource not found",default:!0,retryable:!1},E32002_DEFAULT_RESOURCE_UNAVAILABLE:{eipCode:-32002,message:"Resource unavailable",detail:"Requested resource not available",default:!0,retryable:!0},E32003_DEFAULT_TRANSACTION_REJECTED:{eipCode:-32003,message:"Transaction rejected",detail:"Transaction creation failed",default:!0,retryable:!0},E32004_DEFAULT_METHOD_NOT_SUPPORTED:{eipCode:-32004,message:"Method not supported",detail:"Method is not implemented",default:!0,retryable:!1},E32005_DEFAULT_LIMIT_EXCEEDED:{eipCode:-32005,message:"Limit exceeded",detail:"Request exceeds defined limit",default:!0,retryable:!1},E32006_DEFAULT_JSON_RPC_VERSION_NOT_SUPPORTED:{eipCode:-32006,message:"JSON-RPC version not supported",detail:"Version of JSON-RPC protocol is not supported",default:!0,retryable:!1}},xt={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...Wl,...Tl},Lt={...Al,...xt};var Rl=12e4,qr=(e=new Gt,t=Rl)=>new Promise((o,r)=>setTimeout(()=>{r(e)},t)),Ue=class{constructor(t){this.removeListener=(t,o)=>{if(this.walletProvider)return this.walletProvider.removeListener(t,o)};this.setWalletProvider=t=>{this.walletProvider=t,this._subscriptions.forEach(o=>{var r;(r=this.walletProvider)==null||r.on(o.eventName,o.listener)})};this.walletProvider=t,this._subscriptions=[]}on(t,o){if(this.walletProvider)return this.walletProvider.on(t,o);this._subscriptions.push({eventName:t,listener:o})}async request(t){if(!this.walletProvider)throw new te(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),qr()]).catch(o=>{throw qe(o)})}},ct=class extends Ue{constructor(o){super(o)}},Uo=class extends Ue{constructor(t){super(t)}sendAsync(t,o){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var Ze=class{constructor(t,o,r){this.createSiweMessage=(t,o,r,n,i,a,s)=>`${r} wants you to sign in with your Ethereum account:
2
2
  ${o}
3
3
 
4
4
  ${s}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@privy-io/react-auth",
3
- "version": "1.20.3-beta.2",
3
+ "version": "1.20.3",
4
4
  "description": "React client for the Privy Auth API",
5
5
  "keywords": [
6
6
  "authentication",