@privy-io/react-auth 1.23.0-beta.5 → 1.23.0
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 +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var kc=Object.create;var Fo=Object.defineProperty;var Wc=Object.getOwnPropertyDescriptor;var Rc=Object.getOwnPropertyNames;var Ic=Object.getPrototypeOf,Mc=Object.prototype.hasOwnProperty;var va=(e,t)=>()=>(e&&(t=e(e=0)),t);var qe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),wa=(e,t)=>{for(var o in t)Fo(e,o,{get:t[o],enumerable:!0})},Ca=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Rc(t))!Mc.call(e,n)&&n!==o&&Fo(e,n,{get:()=>t[n],enumerable:!(r=Wc(t,n))||r.enumerable});return e};var Nc=(e,t,o)=>(o=e!=null?kc(Ic(e)):{},Ca(t||!e||!e.__esModule?Fo(o,"default",{value:e,enumerable:!0}):o,e)),Ea=e=>Ca(Fo({},"__esModule",{value:!0}),e);var tr=qe((Af,er)=>{var ii,si,li,ci,di,pi,ui,fi,mi,Qo,ln,hi,gi,yi,Gt,bi,vi,wi,Ci,Ei,xi,_i,Si,Pi,Xo;(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 er=="object"&&typeof er.exports=="object"?e(o(t,o(er.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(a,i){return r[a]=n?n(a,i):i}}})(function(e){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(r[a]=n[a])};ii=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 a(){this.constructor=r}r.prototype=n===null?Object.create(n):(a.prototype=n.prototype,new a)},si=Object.assign||function(r){for(var n,a=1,i=arguments.length;a<i;a++){n=arguments[a];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])}return r},li=function(r,n){var a={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&n.indexOf(i)<0&&(a[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,i=Object.getOwnPropertySymbols(r);s<i.length;s++)n.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(r,i[s])&&(a[i[s]]=r[i[s]]);return a},ci=function(r,n,a,i){var s=arguments.length,l=s<3?n:i===null?i=Object.getOwnPropertyDescriptor(n,a):i,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(r,n,a,i);else for(var g=r.length-1;g>=0;g--)(c=r[g])&&(l=(s<3?c(l):s>3?c(n,a,l):c(n,a))||l);return s>3&&l&&Object.defineProperty(n,a,l),l},di=function(r,n){return function(a,i){n(a,i,r)}},pi=function(r,n){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,n)},ui=function(r,n,a,i){function s(l){return l instanceof a?l:new a(function(c){c(l)})}return new(a||(a=Promise))(function(l,c){function g(y){try{p(i.next(y))}catch(b){c(b)}}function f(y){try{p(i.throw(y))}catch(b){c(b)}}function p(y){y.done?l(y.value):s(y.value).then(g,f)}p((i=i.apply(r,n||[])).next())})},fi=function(r,n){var a={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},i,s,l,c;return c={next:g(0),throw:g(1),return:g(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function g(p){return function(y){return f([p,y])}}function f(p){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=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 a.label++,{value:p[1],done:!1};case 5:a.label++,s=p[1],p=[0];continue;case 7:p=a.ops.pop(),a.trys.pop();continue;default:if(l=a.trys,!(l=l.length>0&&l[l.length-1])&&(p[0]===6||p[0]===2)){a=0;continue}if(p[0]===3&&(!l||p[1]>l[0]&&p[1]<l[3])){a.label=p[1];break}if(p[0]===6&&a.label<l[1]){a.label=l[1],l=p;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(p);break}l[2]&&a.ops.pop(),a.trys.pop();continue}p=n.call(r,a)}catch(y){p=[6,y],s=0}finally{i=l=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},mi=function(r,n){for(var a in r)a!=="default"&&!Object.prototype.hasOwnProperty.call(n,a)&&Xo(n,r,a)},Xo=Object.create?function(r,n,a,i){i===void 0&&(i=a);var s=Object.getOwnPropertyDescriptor(n,a);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[a]}}),Object.defineProperty(r,i,s)}:function(r,n,a,i){i===void 0&&(i=a),r[i]=n[a]},Qo=function(r){var n=typeof Symbol=="function"&&Symbol.iterator,a=n&&r[n],i=0;if(a)return a.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},ln=function(r,n){var a=typeof Symbol=="function"&&r[Symbol.iterator];if(!a)return r;var i=a.call(r),s,l=[],c;try{for(;(n===void 0||n-- >0)&&!(s=i.next()).done;)l.push(s.value)}catch(g){c={error:g}}finally{try{s&&!s.done&&(a=i.return)&&a.call(i)}finally{if(c)throw c.error}}return l},hi=function(){for(var r=[],n=0;n<arguments.length;n++)r=r.concat(ln(arguments[n]));return r},gi=function(){for(var r=0,n=0,a=arguments.length;n<a;n++)r+=arguments[n].length;for(var i=Array(r),s=0,n=0;n<a;n++)for(var l=arguments[n],c=0,g=l.length;c<g;c++,s++)i[s]=l[c];return i},yi=function(r,n,a){if(a||arguments.length===2)for(var i=0,s=n.length,l;i<s;i++)(l||!(i in n))&&(l||(l=Array.prototype.slice.call(n,0,i)),l[i]=n[i]);return r.concat(l||Array.prototype.slice.call(n))},Gt=function(r){return this instanceof Gt?(this.v=r,this):new Gt(r)},bi=function(r,n,a){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=a.apply(r,n||[]),s,l=[];return s={},c("next"),c("throw"),c("return"),s[Symbol.asyncIterator]=function(){return this},s;function c(d){i[d]&&(s[d]=function(h){return new Promise(function(v,S){l.push([d,h,v,S])>1||g(d,h)})})}function g(d,h){try{f(i[d](h))}catch(v){b(l[0][3],v)}}function f(d){d.value instanceof Gt?Promise.resolve(d.value.v).then(p,y):b(l[0][2],d)}function p(d){g("next",d)}function y(d){g("throw",d)}function b(d,h){d(h),l.shift(),l.length&&g(l[0][0],l[0][1])}},vi=function(r){var n,a;return n={},i("next"),i("throw",function(s){throw s}),i("return"),n[Symbol.iterator]=function(){return this},n;function i(s,l){n[s]=r[s]?function(c){return(a=!a)?{value:Gt(r[s](c)),done:s==="return"}:l?l(c):c}:l}},wi=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r[Symbol.asyncIterator],a;return n?n.call(r):(r=typeof Qo=="function"?Qo(r):r[Symbol.iterator](),a={},i("next"),i("throw"),i("return"),a[Symbol.asyncIterator]=function(){return this},a);function i(l){a[l]=r[l]&&function(c){return new Promise(function(g,f){c=r[l](c),s(g,f,c.done,c.value)})}}function s(l,c,g,f){Promise.resolve(f).then(function(p){l({value:p,done:g})},c)}},Ci=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};Ei=function(r){if(r&&r.__esModule)return r;var n={};if(r!=null)for(var a in r)a!=="default"&&Object.prototype.hasOwnProperty.call(r,a)&&Xo(n,r,a);return o(n,r),n},xi=function(r){return r&&r.__esModule?r:{default:r}},_i=function(r,n,a,i){if(a==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof n=="function"?r!==n||!i:!n.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return a==="m"?i:a==="a"?i.call(r):i?i.value:n.get(r)},Si=function(r,n,a,i,s){if(i==="m")throw new TypeError("Private method is not writable");if(i==="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 i==="a"?s.call(r,a):s?s.value=a:n.set(r,a),a},Pi=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",ii),e("__assign",si),e("__rest",li),e("__decorate",ci),e("__param",di),e("__metadata",pi),e("__awaiter",ui),e("__generator",fi),e("__exportStar",mi),e("__createBinding",Xo),e("__values",Qo),e("__read",ln),e("__spread",hi),e("__spreadArrays",gi),e("__spreadArray",yi),e("__await",Gt),e("__asyncGenerator",bi),e("__asyncDelegator",vi),e("__asyncValues",wi),e("__makeTemplateObject",Ci),e("__importStar",Ei),e("__importDefault",xi),e("__classPrivateFieldGet",_i),e("__classPrivateFieldSet",Si),e("__classPrivateFieldIn",Pi)})});var cn=qe(F=>{"use strict";Object.defineProperty(F,"__esModule",{value:!0});F.getLocalStorage=F.getLocalStorageOrThrow=F.getCrypto=F.getCryptoOrThrow=F.getLocation=F.getLocationOrThrow=F.getNavigator=F.getNavigatorOrThrow=F.getDocument=F.getDocumentOrThrow=F.getFromWindowOrThrow=F.getFromWindow=void 0;function Ct(e){let t;return typeof window<"u"&&typeof window[e]<"u"&&(t=window[e]),t}F.getFromWindow=Ct;function Ht(e){let t=Ct(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}F.getFromWindowOrThrow=Ht;function sd(){return Ht("document")}F.getDocumentOrThrow=sd;function ld(){return Ct("document")}F.getDocument=ld;function cd(){return Ht("navigator")}F.getNavigatorOrThrow=cd;function dd(){return Ct("navigator")}F.getNavigator=dd;function pd(){return Ht("location")}F.getLocationOrThrow=pd;function ud(){return Ct("location")}F.getLocation=ud;function fd(){return Ht("crypto")}F.getCryptoOrThrow=fd;function md(){return Ct("crypto")}F.getCrypto=md;function hd(){return Ht("localStorage")}F.getLocalStorageOrThrow=hd;function gd(){return Ct("localStorage")}F.getLocalStorage=gd});var Ti=qe(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});or.getWindowMetadata=void 0;var Li=cn();function yd(){let e,t;try{e=Li.getDocumentOrThrow(),t=Li.getLocationOrThrow()}catch{return null}function o(){let f=e.getElementsByTagName("link"),p=[];for(let y=0;y<f.length;y++){let b=f[y],d=b.getAttribute("rel");if(d&&d.toLowerCase().indexOf("icon")>-1){let h=b.getAttribute("href");if(h)if(h.toLowerCase().indexOf("https:")===-1&&h.toLowerCase().indexOf("http:")===-1&&h.indexOf("//")!==0){let v=t.protocol+"//"+t.host;if(h.indexOf("/")===0)v+=h;else{let S=t.pathname.split("/");S.pop(),v+=S.join("/")+"/"+h}p.push(v)}else if(h.indexOf("//")===0){let v=t.protocol+h;p.push(v)}else p.push(h)}}return p}function r(...f){let p=e.getElementsByTagName("meta");for(let y=0;y<p.length;y++){let b=p[y],d=["itemprop","property","name"].map(h=>b.getAttribute(h)).filter(h=>h?f.includes(h):!1);if(d.length&&d){let h=b.getAttribute("content");if(h)return h}}return""}function n(){let f=r("name","og:site_name","og:title","twitter:title");return f||(f=e.title),f}function a(){return r("description","og:description","twitter:description","keywords")}let i=n(),s=a(),l=t.origin,c=o();return{description:s,url:l,icons:c,name:i}}or.getWindowMetadata=yd});var Bi={};wa(Bi,{BotInfo:()=>Mi,BrowserInfo:()=>Wi,NodeInfo:()=>Ri,ReactNativeInfo:()=>Ni,SearchBotDeviceInfo:()=>Ii,browserName:()=>xd,detect:()=>Ed,detectOS:()=>Di,getNodeVersion:()=>Ui,parseUserAgent:()=>dn});function Ed(e){return e?dn(e):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Ni:typeof navigator<"u"?dn(navigator.userAgent):Ui()}function Oi(e){return e!==""&&Cd.reduce(function(t,o){var r=o[0],n=o[1];if(t)return t;var a=n.exec(e);return!!a&&[r,a]},!1)}function xd(e){var t=Oi(e);return t?t[0]:null}function dn(e){var t=Oi(e);if(!t)return null;var o=t[0],r=t[1];if(o==="searchbot")return new Mi;var n=r[1]&&r[1].split(/[._]/).slice(0,3);n?n.length<Ai&&(n=bd(n,_d(Ai-n.length))):n=[];var a=n.join("."),i=Di(e),s=wd.exec(e);return s&&s[1]?new Ii(o,a,i,s[1]):new Wi(o,a,i)}function Di(e){for(var t=0,o=ki.length;t<o;t++){var r=ki[t],n=r[0],a=r[1],i=a.exec(e);if(i)return n}return null}function Ui(){var e=typeof process<"u"&&process.version;return e?new Ri(process.version.slice(1)):null}function _d(e){for(var t=[],o=0;o<e;o++)t.push("0");return t}var bd,Wi,Ri,Ii,Mi,Ni,vd,wd,Ai,Cd,ki,Fi=va(()=>{bd=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 a=arguments[t],i=0,s=a.length;i<s;i++,n++)r[n]=a[i];return r},Wi=function(){function e(t,o,r){this.name=t,this.version=o,this.os=r,this.type="browser"}return e}(),Ri=function(){function e(t){this.version=t,this.type="node",this.name="node",this.os=process.platform}return e}(),Ii=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}(),Mi=function(){function e(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return e}(),Ni=function(){function e(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return e}(),vd=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,wd=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Ai=3,Cd=[["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",vd]],ki=[["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 un=qe(P=>{"use strict";Object.defineProperty(P,"__esModule",{value:!0});P.getClientMeta=P.getLocalStorage=P.getLocalStorageOrThrow=P.getCrypto=P.getCryptoOrThrow=P.getLocation=P.getLocationOrThrow=P.getNavigator=P.getNavigatorOrThrow=P.getDocument=P.getDocumentOrThrow=P.getFromWindowOrThrow=P.getFromWindow=P.isBrowser=P.isNode=P.isMobile=P.isIOS=P.isAndroid=P.detectOS=P.detectEnv=void 0;var Gi=tr(),Sd=Gi.__importStar(Ti()),Te=Gi.__importStar(cn()),Pd=(Fi(),Ea(Bi));function pn(e){return(0,Pd.detect)(e)}P.detectEnv=pn;function rr(){let e=pn();return e&&e.os?e.os:void 0}P.detectOS=rr;function Hi(){let e=rr();return e?e.toLowerCase().includes("android"):!1}P.isAndroid=Hi;function Vi(){let e=rr();return e?e.toLowerCase().includes("ios")||e.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}P.isIOS=Vi;function Ld(){return rr()?Hi()||Vi():!1}P.isMobile=Ld;function $i(){let e=pn();return e&&e.name?e.name.toLowerCase()==="node":!1}P.isNode=$i;function Td(){return!$i()&&!!(0,P.getNavigator)()}P.isBrowser=Td;P.getFromWindow=Te.getFromWindow;P.getFromWindowOrThrow=Te.getFromWindowOrThrow;P.getDocumentOrThrow=Te.getDocumentOrThrow;P.getDocument=Te.getDocument;P.getNavigatorOrThrow=Te.getNavigatorOrThrow;P.getNavigator=Te.getNavigator;P.getLocationOrThrow=Te.getLocationOrThrow;P.getLocation=Te.getLocation;P.getCryptoOrThrow=Te.getCryptoOrThrow;P.getCrypto=Te.getCrypto;P.getLocalStorageOrThrow=Te.getLocalStorageOrThrow;P.getLocalStorage=Te.getLocalStorage;function Ad(){return Sd.getWindowMetadata()}P.getClientMeta=Ad});var ji={};wa(ji,{safeJsonParse:()=>kd,safeJsonStringify:()=>Wd});function kd(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 Wd(e){return typeof e=="string"?e:JSON.stringify(e)}var qi=va(()=>{});var fn=qe(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.safeJsonStringify=Vt.safeJsonParse=void 0;var Rd=tr(),zi=Rd.__importStar((qi(),Ea(ji)));Vt.safeJsonParse=zi.safeJsonParse;Vt.safeJsonStringify=zi.safeJsonStringify});var hn=qe(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.removeLocal=it.getLocal=it.setLocal=void 0;var Zi=fn(),mn=un();function Id(e,t){let o=(0,Zi.safeJsonStringify)(t),r=(0,mn.getLocalStorage)();r&&r.setItem(e,o)}it.setLocal=Id;function Md(e){let t=null,o=null,r=(0,mn.getLocalStorage)();return r&&(o=r.getItem(e)),t=o&&(0,Zi.safeJsonParse)(o),t}it.getLocal=Md;function Nd(e){let t=(0,mn.getLocalStorage)();t&&t.removeItem(e)}it.removeLocal=Nd});var Yi=qe(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.getMobileLinkRegistry=be.getMobileRegistryEntry=be.saveMobileLinkInfo=be.formatIOSMobile=be.mobileLinkChoiceKey=void 0;var Od=hn();be.mobileLinkChoiceKey="WALLETCONNECT_DEEPLINK_CHOICE";function Dd(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=Dd;function Ud(e){let t=e.href.split("?")[0];(0,Od.setLocal)(be.mobileLinkChoiceKey,Object.assign(Object.assign({},e),{href:t}))}be.saveMobileLinkInfo=Ud;function Ki(e,t){return e.filter(o=>o.name.toLowerCase().includes(t.toLowerCase()))[0]}be.getMobileRegistryEntry=Ki;function Bd(e,t){let o=e;return t&&(o=t.map(r=>Ki(e,r)).filter(Boolean)),o}be.getMobileLinkRegistry=Bd});var Xi=qe(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.formatMobileRegistry=Oe.formatMobileRegistryEntry=Oe.getDappRegistryUrl=Oe.getWalletRegistryUrl=void 0;var Ji="https://registry.walletconnect.com";function Fd(){return Ji+"/api/v2/wallets"}Oe.getWalletRegistryUrl=Fd;function Gd(){return Ji+"/api/v2/dapps"}Oe.getDappRegistryUrl=Gd;function Qi(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||""}}Oe.formatMobileRegistryEntry=Qi;function Hd(e,t="mobile"){return Object.values(e).filter(o=>!!o[t].universal||!!o[t].native).map(o=>Qi(o,t))}Oe.formatMobileRegistry=Hd});var es=qe(Et=>{"use strict";Object.defineProperty(Et,"__esModule",{value:!0});var go=tr();go.__exportStar(un(),Et);go.__exportStar(fn(),Et);go.__exportStar(hn(),Et);go.__exportStar(Yi(),Et);go.__exportStar(Xi(),Et)});import{Web3Provider as X2}from"@ethersproject/providers";import{useEffect as ya,useState as pe}from"react";var x=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import Oc from"axios";var We=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 We{constructor(o,r,n,a){super(n,a);this.type=o;this.status=r}},C=class extends We{constructor(o,r){super(o,r);this.type="client_error"}};var Z=class extends We{constructor(o,r){super(o,r);this.type="connector_error"}},Q=e=>{if(e instanceof We)return e;if(!Oc.isAxiosError(e))return xe(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)},xe=e=>e instanceof We?e:e instanceof Error?new C(e.message,e):new C(`Internal error: ${e}`);var xa=()=>"/api/v1/sessions",_a=()=>"/api/v1/sessions/logout",Sa=()=>"/api/v1/sessions/fork",Pa=()=>"/api/v1/sessions/fork/recover",La=()=>"/api/v1/siwe/init",Ta=()=>"/api/v1/siwe/authenticate",Aa=()=>"/api/v1/siwe/link",ka=()=>"/api/v1/passwordless/init",Wa=()=>"/api/v1/passwordless/authenticate",Ra=()=>"/api/v1/passwordless/link",Ia=()=>"/api/v1/passwordless_sms/init",Ma=()=>"/api/v1/passwordless_sms/authenticate",Na=()=>"/api/v1/passwordless_sms/link",Oa=()=>"/api/v1/oauth/init",Da=()=>"/api/v1/oauth/authenticate",Ua=()=>"/api/v1/oauth/link",Ba=()=>"/api/v1/siwe/unlink",Fa=()=>"/api/v1/passwordless/unlink",Ga=()=>"/api/v1/passwordless_sms/unlink",Ha=()=>"/api/v1/oauth/unlink",Va=()=>"/api/v1/analytics_events";var mt=class{constructor(t){this.meta={email:t}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new C("Email and email code must be set prior to calling authenticate.");try{let t=Wa(),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 Q(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new C("Email and email code must be set prior to calling authenticate.");try{let t=Ra();return(await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode})).data}catch(t){throw Q(t)}}async sendCodeEmail(t){if(!this.api)throw new C("Auth flow has no API instance");if(t&&(this.meta.email=t),!this.meta.email)throw new C("Email must be set when initialzing authentication.");try{let o=ka();return(await this.api.post(o,{email:this.meta.email})).data}catch(o){throw Q(o)}}};var nt=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 C("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new C("User denied confirmation during OAuth flow");try{let t=Da(),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 Q(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new C("User denied confirmation during OAuth flow");try{let t=Ua();return(await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode})).data}catch(t){throw Q(t)}}async getAuthorizationUrl(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.provider)throw new C("Provider must be set when initialzing OAuth authentication.");try{let t=Oa();return(await this.api.post(t,{provider:this.meta.provider,redirect_to:window.location.href})).data}catch(t){throw Q(t)}}};var at=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 C("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(Ta(),{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 Q(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(Aa(),{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 Q(t)}}async promptConnect(){if(!this.api)throw new C("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 C("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 C("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 C("Auth flow has no API instance");let o=t.address,r=t.chainId,n=await this.api.post(La(),{address:o});return this.preparedMessage=this.walletConnector.prepareMessage(r,o,n.data.nonce),this.preparedMessage}};var ht=class{constructor(t){this.meta={phoneNumber:t}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new C("phone number and sms code must be set prior to calling authenticate.");try{let t=Ma(),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 Q(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new C("phone number and sms code must be set prior to calling authenticate.");try{let t=Na();return(await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})).data}catch(t){throw Q(t)}}async sendSmsCode(t){if(!this.api)throw new C("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),!this.meta.phoneNumber)throw new C("phone nNumber must be set when initialzing authentication.");try{let o=Ia();return(await this.api.post(o,{phoneNumber:this.meta.phoneNumber})).data}catch(o){throw Q(o)}}};import{getAddress as $d}from"@ethersproject/address";var $a="1.23.0-beta.5";var ja="AZD8ITQ3ZQS63BQIJN3SPP767ZZY89SZJX",gt="4df5e2316331463a9130964bd6078dfa",Go="https://auth.privy.io",qa=1e4,_e=1400,Jr=$a;var Nt="privy:token",Ho="privy:refresh_token",ho="privy:session_transfer_token",Vo="privy:connectors",Qr="walletconnect",za=3e4;var Xr=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)}},en=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 Uc(){return typeof window<"u"&&window.localStorage?new en:new Xr}var z=Uc();import zc from"@coinbase/wallet-sdk";import{getAddress as Zc}from"@ethersproject/address";import{jsx as Za,jsxs as Bc}from"react/jsx-runtime";var Se=({style:e,...t})=>Bc("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:[Za("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),Za("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 jc}from"@ethersproject/address";import{Web3Provider as qc}from"@ethersproject/providers";import{ErrorCode as Fc}from"@ethersproject/logger";var Ot=class extends Z{constructor(){super("Wallet timeout");this.type="wallet_error"}},bt=class extends Z{constructor(){super("User rejected connection");this.type="wallet_error"}},Pe=e=>{if(e instanceof Z)return e;if((e==null?void 0:e.code)&&(e==null?void 0:e.reason)){let t=new Dt(e);return e.code===Fc.ACTION_REJECTED&&(t.details=yt.E4001_USER_REJECTED_REQUEST),t}return e!=null&&e.code?new Dt(e):new Z("Unknown connector error",e)},tn=class extends We{constructor(o,r,n){super(o);this.type="provider_error";this.code=r,this.data=n}},Dt=class extends tn{constructor(o){var a,i,s;let r=o;super(r.message,r.code,r.data);let n=Object.values(yt).find(l=>l.eipCode===r.code);this.details=n||yt.UNKNOWN_ERROR,r.code===-32002&&((a=r.message)!=null&&a.includes("already pending for origin")?(i=r.message)!=null&&i.includes("wallet_requestPermissions")?this.details=yt.E32002_CONNECTION_ALREADY_PENDING:this.details=yt.E32002_REQUEST_ALREADY_PENDING:(s=r.message)!=null&&s.includes("Already processing")&&r.message.includes("eth_requestAccounts")&&(this.details=yt.E32002_WALLET_LOCKED))}},Gc={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}},Hc={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}},Vc={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}},yt={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...Vc,...Hc},vt={...Gc,...yt};var $c=12e4,on=(e=new Ot,t=$c)=>new Promise((o,r)=>setTimeout(()=>{r(e)},t)),Re=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 Z(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),on()]).catch(o=>{throw Pe(o)})}},wt=class extends Re{constructor(o){super(o)}},$o=class extends Re{constructor(t){super(t)}sendAsync(t,o){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var Ie=class{constructor(t,o,r){this.createSiweMessage=(t,o,r,n,a,i,s)=>`${r} wants you to sign in with your Ethereum account:
|
|
1
|
+
var kc=Object.create;var Fo=Object.defineProperty;var Wc=Object.getOwnPropertyDescriptor;var Rc=Object.getOwnPropertyNames;var Ic=Object.getPrototypeOf,Mc=Object.prototype.hasOwnProperty;var va=(e,t)=>()=>(e&&(t=e(e=0)),t);var qe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),wa=(e,t)=>{for(var o in t)Fo(e,o,{get:t[o],enumerable:!0})},Ca=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Rc(t))!Mc.call(e,n)&&n!==o&&Fo(e,n,{get:()=>t[n],enumerable:!(r=Wc(t,n))||r.enumerable});return e};var Nc=(e,t,o)=>(o=e!=null?kc(Ic(e)):{},Ca(t||!e||!e.__esModule?Fo(o,"default",{value:e,enumerable:!0}):o,e)),Ea=e=>Ca(Fo({},"__esModule",{value:!0}),e);var tr=qe((Af,er)=>{var ii,si,li,ci,di,pi,ui,fi,mi,Qo,ln,hi,gi,yi,Gt,bi,vi,wi,Ci,Ei,xi,_i,Si,Pi,Xo;(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 er=="object"&&typeof er.exports=="object"?e(o(t,o(er.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(a,i){return r[a]=n?n(a,i):i}}})(function(e){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(r[a]=n[a])};ii=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 a(){this.constructor=r}r.prototype=n===null?Object.create(n):(a.prototype=n.prototype,new a)},si=Object.assign||function(r){for(var n,a=1,i=arguments.length;a<i;a++){n=arguments[a];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])}return r},li=function(r,n){var a={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&n.indexOf(i)<0&&(a[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,i=Object.getOwnPropertySymbols(r);s<i.length;s++)n.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(r,i[s])&&(a[i[s]]=r[i[s]]);return a},ci=function(r,n,a,i){var s=arguments.length,l=s<3?n:i===null?i=Object.getOwnPropertyDescriptor(n,a):i,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(r,n,a,i);else for(var g=r.length-1;g>=0;g--)(c=r[g])&&(l=(s<3?c(l):s>3?c(n,a,l):c(n,a))||l);return s>3&&l&&Object.defineProperty(n,a,l),l},di=function(r,n){return function(a,i){n(a,i,r)}},pi=function(r,n){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,n)},ui=function(r,n,a,i){function s(l){return l instanceof a?l:new a(function(c){c(l)})}return new(a||(a=Promise))(function(l,c){function g(y){try{p(i.next(y))}catch(b){c(b)}}function f(y){try{p(i.throw(y))}catch(b){c(b)}}function p(y){y.done?l(y.value):s(y.value).then(g,f)}p((i=i.apply(r,n||[])).next())})},fi=function(r,n){var a={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},i,s,l,c;return c={next:g(0),throw:g(1),return:g(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function g(p){return function(y){return f([p,y])}}function f(p){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=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 a.label++,{value:p[1],done:!1};case 5:a.label++,s=p[1],p=[0];continue;case 7:p=a.ops.pop(),a.trys.pop();continue;default:if(l=a.trys,!(l=l.length>0&&l[l.length-1])&&(p[0]===6||p[0]===2)){a=0;continue}if(p[0]===3&&(!l||p[1]>l[0]&&p[1]<l[3])){a.label=p[1];break}if(p[0]===6&&a.label<l[1]){a.label=l[1],l=p;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(p);break}l[2]&&a.ops.pop(),a.trys.pop();continue}p=n.call(r,a)}catch(y){p=[6,y],s=0}finally{i=l=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},mi=function(r,n){for(var a in r)a!=="default"&&!Object.prototype.hasOwnProperty.call(n,a)&&Xo(n,r,a)},Xo=Object.create?function(r,n,a,i){i===void 0&&(i=a);var s=Object.getOwnPropertyDescriptor(n,a);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[a]}}),Object.defineProperty(r,i,s)}:function(r,n,a,i){i===void 0&&(i=a),r[i]=n[a]},Qo=function(r){var n=typeof Symbol=="function"&&Symbol.iterator,a=n&&r[n],i=0;if(a)return a.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},ln=function(r,n){var a=typeof Symbol=="function"&&r[Symbol.iterator];if(!a)return r;var i=a.call(r),s,l=[],c;try{for(;(n===void 0||n-- >0)&&!(s=i.next()).done;)l.push(s.value)}catch(g){c={error:g}}finally{try{s&&!s.done&&(a=i.return)&&a.call(i)}finally{if(c)throw c.error}}return l},hi=function(){for(var r=[],n=0;n<arguments.length;n++)r=r.concat(ln(arguments[n]));return r},gi=function(){for(var r=0,n=0,a=arguments.length;n<a;n++)r+=arguments[n].length;for(var i=Array(r),s=0,n=0;n<a;n++)for(var l=arguments[n],c=0,g=l.length;c<g;c++,s++)i[s]=l[c];return i},yi=function(r,n,a){if(a||arguments.length===2)for(var i=0,s=n.length,l;i<s;i++)(l||!(i in n))&&(l||(l=Array.prototype.slice.call(n,0,i)),l[i]=n[i]);return r.concat(l||Array.prototype.slice.call(n))},Gt=function(r){return this instanceof Gt?(this.v=r,this):new Gt(r)},bi=function(r,n,a){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=a.apply(r,n||[]),s,l=[];return s={},c("next"),c("throw"),c("return"),s[Symbol.asyncIterator]=function(){return this},s;function c(d){i[d]&&(s[d]=function(h){return new Promise(function(v,S){l.push([d,h,v,S])>1||g(d,h)})})}function g(d,h){try{f(i[d](h))}catch(v){b(l[0][3],v)}}function f(d){d.value instanceof Gt?Promise.resolve(d.value.v).then(p,y):b(l[0][2],d)}function p(d){g("next",d)}function y(d){g("throw",d)}function b(d,h){d(h),l.shift(),l.length&&g(l[0][0],l[0][1])}},vi=function(r){var n,a;return n={},i("next"),i("throw",function(s){throw s}),i("return"),n[Symbol.iterator]=function(){return this},n;function i(s,l){n[s]=r[s]?function(c){return(a=!a)?{value:Gt(r[s](c)),done:s==="return"}:l?l(c):c}:l}},wi=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r[Symbol.asyncIterator],a;return n?n.call(r):(r=typeof Qo=="function"?Qo(r):r[Symbol.iterator](),a={},i("next"),i("throw"),i("return"),a[Symbol.asyncIterator]=function(){return this},a);function i(l){a[l]=r[l]&&function(c){return new Promise(function(g,f){c=r[l](c),s(g,f,c.done,c.value)})}}function s(l,c,g,f){Promise.resolve(f).then(function(p){l({value:p,done:g})},c)}},Ci=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};Ei=function(r){if(r&&r.__esModule)return r;var n={};if(r!=null)for(var a in r)a!=="default"&&Object.prototype.hasOwnProperty.call(r,a)&&Xo(n,r,a);return o(n,r),n},xi=function(r){return r&&r.__esModule?r:{default:r}},_i=function(r,n,a,i){if(a==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof n=="function"?r!==n||!i:!n.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return a==="m"?i:a==="a"?i.call(r):i?i.value:n.get(r)},Si=function(r,n,a,i,s){if(i==="m")throw new TypeError("Private method is not writable");if(i==="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 i==="a"?s.call(r,a):s?s.value=a:n.set(r,a),a},Pi=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",ii),e("__assign",si),e("__rest",li),e("__decorate",ci),e("__param",di),e("__metadata",pi),e("__awaiter",ui),e("__generator",fi),e("__exportStar",mi),e("__createBinding",Xo),e("__values",Qo),e("__read",ln),e("__spread",hi),e("__spreadArrays",gi),e("__spreadArray",yi),e("__await",Gt),e("__asyncGenerator",bi),e("__asyncDelegator",vi),e("__asyncValues",wi),e("__makeTemplateObject",Ci),e("__importStar",Ei),e("__importDefault",xi),e("__classPrivateFieldGet",_i),e("__classPrivateFieldSet",Si),e("__classPrivateFieldIn",Pi)})});var cn=qe(F=>{"use strict";Object.defineProperty(F,"__esModule",{value:!0});F.getLocalStorage=F.getLocalStorageOrThrow=F.getCrypto=F.getCryptoOrThrow=F.getLocation=F.getLocationOrThrow=F.getNavigator=F.getNavigatorOrThrow=F.getDocument=F.getDocumentOrThrow=F.getFromWindowOrThrow=F.getFromWindow=void 0;function Ct(e){let t;return typeof window<"u"&&typeof window[e]<"u"&&(t=window[e]),t}F.getFromWindow=Ct;function Ht(e){let t=Ct(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}F.getFromWindowOrThrow=Ht;function sd(){return Ht("document")}F.getDocumentOrThrow=sd;function ld(){return Ct("document")}F.getDocument=ld;function cd(){return Ht("navigator")}F.getNavigatorOrThrow=cd;function dd(){return Ct("navigator")}F.getNavigator=dd;function pd(){return Ht("location")}F.getLocationOrThrow=pd;function ud(){return Ct("location")}F.getLocation=ud;function fd(){return Ht("crypto")}F.getCryptoOrThrow=fd;function md(){return Ct("crypto")}F.getCrypto=md;function hd(){return Ht("localStorage")}F.getLocalStorageOrThrow=hd;function gd(){return Ct("localStorage")}F.getLocalStorage=gd});var Ti=qe(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});or.getWindowMetadata=void 0;var Li=cn();function yd(){let e,t;try{e=Li.getDocumentOrThrow(),t=Li.getLocationOrThrow()}catch{return null}function o(){let f=e.getElementsByTagName("link"),p=[];for(let y=0;y<f.length;y++){let b=f[y],d=b.getAttribute("rel");if(d&&d.toLowerCase().indexOf("icon")>-1){let h=b.getAttribute("href");if(h)if(h.toLowerCase().indexOf("https:")===-1&&h.toLowerCase().indexOf("http:")===-1&&h.indexOf("//")!==0){let v=t.protocol+"//"+t.host;if(h.indexOf("/")===0)v+=h;else{let S=t.pathname.split("/");S.pop(),v+=S.join("/")+"/"+h}p.push(v)}else if(h.indexOf("//")===0){let v=t.protocol+h;p.push(v)}else p.push(h)}}return p}function r(...f){let p=e.getElementsByTagName("meta");for(let y=0;y<p.length;y++){let b=p[y],d=["itemprop","property","name"].map(h=>b.getAttribute(h)).filter(h=>h?f.includes(h):!1);if(d.length&&d){let h=b.getAttribute("content");if(h)return h}}return""}function n(){let f=r("name","og:site_name","og:title","twitter:title");return f||(f=e.title),f}function a(){return r("description","og:description","twitter:description","keywords")}let i=n(),s=a(),l=t.origin,c=o();return{description:s,url:l,icons:c,name:i}}or.getWindowMetadata=yd});var Bi={};wa(Bi,{BotInfo:()=>Mi,BrowserInfo:()=>Wi,NodeInfo:()=>Ri,ReactNativeInfo:()=>Ni,SearchBotDeviceInfo:()=>Ii,browserName:()=>xd,detect:()=>Ed,detectOS:()=>Di,getNodeVersion:()=>Ui,parseUserAgent:()=>dn});function Ed(e){return e?dn(e):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Ni:typeof navigator<"u"?dn(navigator.userAgent):Ui()}function Oi(e){return e!==""&&Cd.reduce(function(t,o){var r=o[0],n=o[1];if(t)return t;var a=n.exec(e);return!!a&&[r,a]},!1)}function xd(e){var t=Oi(e);return t?t[0]:null}function dn(e){var t=Oi(e);if(!t)return null;var o=t[0],r=t[1];if(o==="searchbot")return new Mi;var n=r[1]&&r[1].split(/[._]/).slice(0,3);n?n.length<Ai&&(n=bd(n,_d(Ai-n.length))):n=[];var a=n.join("."),i=Di(e),s=wd.exec(e);return s&&s[1]?new Ii(o,a,i,s[1]):new Wi(o,a,i)}function Di(e){for(var t=0,o=ki.length;t<o;t++){var r=ki[t],n=r[0],a=r[1],i=a.exec(e);if(i)return n}return null}function Ui(){var e=typeof process<"u"&&process.version;return e?new Ri(process.version.slice(1)):null}function _d(e){for(var t=[],o=0;o<e;o++)t.push("0");return t}var bd,Wi,Ri,Ii,Mi,Ni,vd,wd,Ai,Cd,ki,Fi=va(()=>{bd=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 a=arguments[t],i=0,s=a.length;i<s;i++,n++)r[n]=a[i];return r},Wi=function(){function e(t,o,r){this.name=t,this.version=o,this.os=r,this.type="browser"}return e}(),Ri=function(){function e(t){this.version=t,this.type="node",this.name="node",this.os=process.platform}return e}(),Ii=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}(),Mi=function(){function e(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return e}(),Ni=function(){function e(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return e}(),vd=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,wd=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Ai=3,Cd=[["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",vd]],ki=[["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 un=qe(P=>{"use strict";Object.defineProperty(P,"__esModule",{value:!0});P.getClientMeta=P.getLocalStorage=P.getLocalStorageOrThrow=P.getCrypto=P.getCryptoOrThrow=P.getLocation=P.getLocationOrThrow=P.getNavigator=P.getNavigatorOrThrow=P.getDocument=P.getDocumentOrThrow=P.getFromWindowOrThrow=P.getFromWindow=P.isBrowser=P.isNode=P.isMobile=P.isIOS=P.isAndroid=P.detectOS=P.detectEnv=void 0;var Gi=tr(),Sd=Gi.__importStar(Ti()),Te=Gi.__importStar(cn()),Pd=(Fi(),Ea(Bi));function pn(e){return(0,Pd.detect)(e)}P.detectEnv=pn;function rr(){let e=pn();return e&&e.os?e.os:void 0}P.detectOS=rr;function Hi(){let e=rr();return e?e.toLowerCase().includes("android"):!1}P.isAndroid=Hi;function Vi(){let e=rr();return e?e.toLowerCase().includes("ios")||e.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}P.isIOS=Vi;function Ld(){return rr()?Hi()||Vi():!1}P.isMobile=Ld;function $i(){let e=pn();return e&&e.name?e.name.toLowerCase()==="node":!1}P.isNode=$i;function Td(){return!$i()&&!!(0,P.getNavigator)()}P.isBrowser=Td;P.getFromWindow=Te.getFromWindow;P.getFromWindowOrThrow=Te.getFromWindowOrThrow;P.getDocumentOrThrow=Te.getDocumentOrThrow;P.getDocument=Te.getDocument;P.getNavigatorOrThrow=Te.getNavigatorOrThrow;P.getNavigator=Te.getNavigator;P.getLocationOrThrow=Te.getLocationOrThrow;P.getLocation=Te.getLocation;P.getCryptoOrThrow=Te.getCryptoOrThrow;P.getCrypto=Te.getCrypto;P.getLocalStorageOrThrow=Te.getLocalStorageOrThrow;P.getLocalStorage=Te.getLocalStorage;function Ad(){return Sd.getWindowMetadata()}P.getClientMeta=Ad});var ji={};wa(ji,{safeJsonParse:()=>kd,safeJsonStringify:()=>Wd});function kd(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 Wd(e){return typeof e=="string"?e:JSON.stringify(e)}var qi=va(()=>{});var fn=qe(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.safeJsonStringify=Vt.safeJsonParse=void 0;var Rd=tr(),zi=Rd.__importStar((qi(),Ea(ji)));Vt.safeJsonParse=zi.safeJsonParse;Vt.safeJsonStringify=zi.safeJsonStringify});var hn=qe(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.removeLocal=it.getLocal=it.setLocal=void 0;var Zi=fn(),mn=un();function Id(e,t){let o=(0,Zi.safeJsonStringify)(t),r=(0,mn.getLocalStorage)();r&&r.setItem(e,o)}it.setLocal=Id;function Md(e){let t=null,o=null,r=(0,mn.getLocalStorage)();return r&&(o=r.getItem(e)),t=o&&(0,Zi.safeJsonParse)(o),t}it.getLocal=Md;function Nd(e){let t=(0,mn.getLocalStorage)();t&&t.removeItem(e)}it.removeLocal=Nd});var Yi=qe(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.getMobileLinkRegistry=be.getMobileRegistryEntry=be.saveMobileLinkInfo=be.formatIOSMobile=be.mobileLinkChoiceKey=void 0;var Od=hn();be.mobileLinkChoiceKey="WALLETCONNECT_DEEPLINK_CHOICE";function Dd(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=Dd;function Ud(e){let t=e.href.split("?")[0];(0,Od.setLocal)(be.mobileLinkChoiceKey,Object.assign(Object.assign({},e),{href:t}))}be.saveMobileLinkInfo=Ud;function Ki(e,t){return e.filter(o=>o.name.toLowerCase().includes(t.toLowerCase()))[0]}be.getMobileRegistryEntry=Ki;function Bd(e,t){let o=e;return t&&(o=t.map(r=>Ki(e,r)).filter(Boolean)),o}be.getMobileLinkRegistry=Bd});var Xi=qe(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.formatMobileRegistry=Oe.formatMobileRegistryEntry=Oe.getDappRegistryUrl=Oe.getWalletRegistryUrl=void 0;var Ji="https://registry.walletconnect.com";function Fd(){return Ji+"/api/v2/wallets"}Oe.getWalletRegistryUrl=Fd;function Gd(){return Ji+"/api/v2/dapps"}Oe.getDappRegistryUrl=Gd;function Qi(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||""}}Oe.formatMobileRegistryEntry=Qi;function Hd(e,t="mobile"){return Object.values(e).filter(o=>!!o[t].universal||!!o[t].native).map(o=>Qi(o,t))}Oe.formatMobileRegistry=Hd});var es=qe(Et=>{"use strict";Object.defineProperty(Et,"__esModule",{value:!0});var go=tr();go.__exportStar(un(),Et);go.__exportStar(fn(),Et);go.__exportStar(hn(),Et);go.__exportStar(Yi(),Et);go.__exportStar(Xi(),Et)});import{Web3Provider as X2}from"@ethersproject/providers";import{useEffect as ya,useState as pe}from"react";var x=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import Oc from"axios";var We=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 We{constructor(o,r,n,a){super(n,a);this.type=o;this.status=r}},C=class extends We{constructor(o,r){super(o,r);this.type="client_error"}};var Z=class extends We{constructor(o,r){super(o,r);this.type="connector_error"}},Q=e=>{if(e instanceof We)return e;if(!Oc.isAxiosError(e))return xe(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)},xe=e=>e instanceof We?e:e instanceof Error?new C(e.message,e):new C(`Internal error: ${e}`);var xa=()=>"/api/v1/sessions",_a=()=>"/api/v1/sessions/logout",Sa=()=>"/api/v1/sessions/fork",Pa=()=>"/api/v1/sessions/fork/recover",La=()=>"/api/v1/siwe/init",Ta=()=>"/api/v1/siwe/authenticate",Aa=()=>"/api/v1/siwe/link",ka=()=>"/api/v1/passwordless/init",Wa=()=>"/api/v1/passwordless/authenticate",Ra=()=>"/api/v1/passwordless/link",Ia=()=>"/api/v1/passwordless_sms/init",Ma=()=>"/api/v1/passwordless_sms/authenticate",Na=()=>"/api/v1/passwordless_sms/link",Oa=()=>"/api/v1/oauth/init",Da=()=>"/api/v1/oauth/authenticate",Ua=()=>"/api/v1/oauth/link",Ba=()=>"/api/v1/siwe/unlink",Fa=()=>"/api/v1/passwordless/unlink",Ga=()=>"/api/v1/passwordless_sms/unlink",Ha=()=>"/api/v1/oauth/unlink",Va=()=>"/api/v1/analytics_events";var mt=class{constructor(t){this.meta={email:t}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new C("Email and email code must be set prior to calling authenticate.");try{let t=Wa(),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 Q(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new C("Email and email code must be set prior to calling authenticate.");try{let t=Ra();return(await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode})).data}catch(t){throw Q(t)}}async sendCodeEmail(t){if(!this.api)throw new C("Auth flow has no API instance");if(t&&(this.meta.email=t),!this.meta.email)throw new C("Email must be set when initialzing authentication.");try{let o=ka();return(await this.api.post(o,{email:this.meta.email})).data}catch(o){throw Q(o)}}};var nt=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 C("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new C("User denied confirmation during OAuth flow");try{let t=Da(),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 Q(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new C("User denied confirmation during OAuth flow");try{let t=Ua();return(await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode})).data}catch(t){throw Q(t)}}async getAuthorizationUrl(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.provider)throw new C("Provider must be set when initialzing OAuth authentication.");try{let t=Oa();return(await this.api.post(t,{provider:this.meta.provider,redirect_to:window.location.href})).data}catch(t){throw Q(t)}}};var at=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 C("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(Ta(),{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 Q(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(Aa(),{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 Q(t)}}async promptConnect(){if(!this.api)throw new C("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 C("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 C("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 C("Auth flow has no API instance");let o=t.address,r=t.chainId,n=await this.api.post(La(),{address:o});return this.preparedMessage=this.walletConnector.prepareMessage(r,o,n.data.nonce),this.preparedMessage}};var ht=class{constructor(t){this.meta={phoneNumber:t}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new C("phone number and sms code must be set prior to calling authenticate.");try{let t=Ma(),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 Q(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new C("phone number and sms code must be set prior to calling authenticate.");try{let t=Na();return(await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})).data}catch(t){throw Q(t)}}async sendSmsCode(t){if(!this.api)throw new C("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),!this.meta.phoneNumber)throw new C("phone nNumber must be set when initialzing authentication.");try{let o=Ia();return(await this.api.post(o,{phoneNumber:this.meta.phoneNumber})).data}catch(o){throw Q(o)}}};import{getAddress as $d}from"@ethersproject/address";var $a="1.23.0";var ja="AZD8ITQ3ZQS63BQIJN3SPP767ZZY89SZJX",gt="4df5e2316331463a9130964bd6078dfa",Go="https://auth.privy.io",qa=1e4,_e=1400,Jr=$a;var Nt="privy:token",Ho="privy:refresh_token",ho="privy:session_transfer_token",Vo="privy:connectors",Qr="walletconnect",za=3e4;var Xr=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)}},en=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 Uc(){return typeof window<"u"&&window.localStorage?new en:new Xr}var z=Uc();import zc from"@coinbase/wallet-sdk";import{getAddress as Zc}from"@ethersproject/address";import{jsx as Za,jsxs as Bc}from"react/jsx-runtime";var Se=({style:e,...t})=>Bc("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:[Za("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),Za("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 jc}from"@ethersproject/address";import{Web3Provider as qc}from"@ethersproject/providers";import{ErrorCode as Fc}from"@ethersproject/logger";var Ot=class extends Z{constructor(){super("Wallet timeout");this.type="wallet_error"}},bt=class extends Z{constructor(){super("User rejected connection");this.type="wallet_error"}},Pe=e=>{if(e instanceof Z)return e;if((e==null?void 0:e.code)&&(e==null?void 0:e.reason)){let t=new Dt(e);return e.code===Fc.ACTION_REJECTED&&(t.details=yt.E4001_USER_REJECTED_REQUEST),t}return e!=null&&e.code?new Dt(e):new Z("Unknown connector error",e)},tn=class extends We{constructor(o,r,n){super(o);this.type="provider_error";this.code=r,this.data=n}},Dt=class extends tn{constructor(o){var a,i,s;let r=o;super(r.message,r.code,r.data);let n=Object.values(yt).find(l=>l.eipCode===r.code);this.details=n||yt.UNKNOWN_ERROR,r.code===-32002&&((a=r.message)!=null&&a.includes("already pending for origin")?(i=r.message)!=null&&i.includes("wallet_requestPermissions")?this.details=yt.E32002_CONNECTION_ALREADY_PENDING:this.details=yt.E32002_REQUEST_ALREADY_PENDING:(s=r.message)!=null&&s.includes("Already processing")&&r.message.includes("eth_requestAccounts")&&(this.details=yt.E32002_WALLET_LOCKED))}},Gc={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}},Hc={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}},Vc={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}},yt={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...Vc,...Hc},vt={...Gc,...yt};var $c=12e4,on=(e=new Ot,t=$c)=>new Promise((o,r)=>setTimeout(()=>{r(e)},t)),Re=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 Z(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),on()]).catch(o=>{throw Pe(o)})}},wt=class extends Re{constructor(o){super(o)}},$o=class extends Re{constructor(t){super(t)}sendAsync(t,o){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var Ie=class{constructor(t,o,r){this.createSiweMessage=(t,o,r,n,a,i,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 Pc=Object.create;var nr=Object.defineProperty;var Lc=Object.getOwnPropertyDescriptor;var Tc=Object.getOwnPropertyNames;var Ac=Object.getPrototypeOf,kc=Object.prototype.hasOwnProperty;var Ra=(e,t)=>()=>(e&&(t=e(e=0)),t);var gt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),En=(e,t)=>{for(var o in t)nr(e,o,{get:t[o],enumerable:!0})},Ia=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Tc(t))!kc.call(e,n)&&n!==o&&nr(e,n,{get:()=>t[n],enumerable:!(r=Lc(t,n))||r.enumerable});return e};var T=(e,t,o)=>(o=e!=null?Pc(Ac(e)):{},Ia(t||!e||!e.__esModule?nr(o,"default",{value:e,enumerable:!0}):o,e)),xn=e=>Ia(nr({},"__esModule",{value:!0}),e);var Cr=gt((a2,wr)=>{var xi,_i,Si,Pi,Li,Ti,Ai,ki,Wi,br,In,Ri,Ii,Mi,po,Ni,Oi,Di,Ui,Bi,Fi,Gi,Hi,Vi,vr;(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 wr=="object"&&typeof wr.exports=="object"?e(o(t,o(wr.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(a,i){return r[a]=n?n(a,i):i}}})(function(e){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(r[a]=n[a])};xi=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 a(){this.constructor=r}r.prototype=n===null?Object.create(n):(a.prototype=n.prototype,new a)},_i=Object.assign||function(r){for(var n,a=1,i=arguments.length;a<i;a++){n=arguments[a];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])}return r},Si=function(r,n){var a={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&n.indexOf(i)<0&&(a[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,i=Object.getOwnPropertySymbols(r);s<i.length;s++)n.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(r,i[s])&&(a[i[s]]=r[i[s]]);return a},Pi=function(r,n,a,i){var s=arguments.length,l=s<3?n:i===null?i=Object.getOwnPropertyDescriptor(n,a):i,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(r,n,a,i);else for(var g=r.length-1;g>=0;g--)(c=r[g])&&(l=(s<3?c(l):s>3?c(n,a,l):c(n,a))||l);return s>3&&l&&Object.defineProperty(n,a,l),l},Li=function(r,n){return function(a,i){n(a,i,r)}},Ti=function(r,n){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,n)},Ai=function(r,n,a,i){function s(l){return l instanceof a?l:new a(function(c){c(l)})}return new(a||(a=Promise))(function(l,c){function g(y){try{p(i.next(y))}catch(b){c(b)}}function f(y){try{p(i.throw(y))}catch(b){c(b)}}function p(y){y.done?l(y.value):s(y.value).then(g,f)}p((i=i.apply(r,n||[])).next())})},ki=function(r,n){var a={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},i,s,l,c;return c={next:g(0),throw:g(1),return:g(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function g(p){return function(y){return f([p,y])}}function f(p){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=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 a.label++,{value:p[1],done:!1};case 5:a.label++,s=p[1],p=[0];continue;case 7:p=a.ops.pop(),a.trys.pop();continue;default:if(l=a.trys,!(l=l.length>0&&l[l.length-1])&&(p[0]===6||p[0]===2)){a=0;continue}if(p[0]===3&&(!l||p[1]>l[0]&&p[1]<l[3])){a.label=p[1];break}if(p[0]===6&&a.label<l[1]){a.label=l[1],l=p;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(p);break}l[2]&&a.ops.pop(),a.trys.pop();continue}p=n.call(r,a)}catch(y){p=[6,y],s=0}finally{i=l=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},Wi=function(r,n){for(var a in r)a!=="default"&&!Object.prototype.hasOwnProperty.call(n,a)&&vr(n,r,a)},vr=Object.create?function(r,n,a,i){i===void 0&&(i=a);var s=Object.getOwnPropertyDescriptor(n,a);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[a]}}),Object.defineProperty(r,i,s)}:function(r,n,a,i){i===void 0&&(i=a),r[i]=n[a]},br=function(r){var n=typeof Symbol=="function"&&Symbol.iterator,a=n&&r[n],i=0;if(a)return a.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},In=function(r,n){var a=typeof Symbol=="function"&&r[Symbol.iterator];if(!a)return r;var i=a.call(r),s,l=[],c;try{for(;(n===void 0||n-- >0)&&!(s=i.next()).done;)l.push(s.value)}catch(g){c={error:g}}finally{try{s&&!s.done&&(a=i.return)&&a.call(i)}finally{if(c)throw c.error}}return l},Ri=function(){for(var r=[],n=0;n<arguments.length;n++)r=r.concat(In(arguments[n]));return r},Ii=function(){for(var r=0,n=0,a=arguments.length;n<a;n++)r+=arguments[n].length;for(var i=Array(r),s=0,n=0;n<a;n++)for(var l=arguments[n],c=0,g=l.length;c<g;c++,s++)i[s]=l[c];return i},Mi=function(r,n,a){if(a||arguments.length===2)for(var i=0,s=n.length,l;i<s;i++)(l||!(i in n))&&(l||(l=Array.prototype.slice.call(n,0,i)),l[i]=n[i]);return r.concat(l||Array.prototype.slice.call(n))},po=function(r){return this instanceof po?(this.v=r,this):new po(r)},Ni=function(r,n,a){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=a.apply(r,n||[]),s,l=[];return s={},c("next"),c("throw"),c("return"),s[Symbol.asyncIterator]=function(){return this},s;function c(d){i[d]&&(s[d]=function(h){return new Promise(function(w,L){l.push([d,h,w,L])>1||g(d,h)})})}function g(d,h){try{f(i[d](h))}catch(w){b(l[0][3],w)}}function f(d){d.value instanceof po?Promise.resolve(d.value.v).then(p,y):b(l[0][2],d)}function p(d){g("next",d)}function y(d){g("throw",d)}function b(d,h){d(h),l.shift(),l.length&&g(l[0][0],l[0][1])}},Oi=function(r){var n,a;return n={},i("next"),i("throw",function(s){throw s}),i("return"),n[Symbol.iterator]=function(){return this},n;function i(s,l){n[s]=r[s]?function(c){return(a=!a)?{value:po(r[s](c)),done:s==="return"}:l?l(c):c}:l}},Di=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r[Symbol.asyncIterator],a;return n?n.call(r):(r=typeof br=="function"?br(r):r[Symbol.iterator](),a={},i("next"),i("throw"),i("return"),a[Symbol.asyncIterator]=function(){return this},a);function i(l){a[l]=r[l]&&function(c){return new Promise(function(g,f){c=r[l](c),s(g,f,c.done,c.value)})}}function s(l,c,g,f){Promise.resolve(f).then(function(p){l({value:p,done:g})},c)}},Ui=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};Bi=function(r){if(r&&r.__esModule)return r;var n={};if(r!=null)for(var a in r)a!=="default"&&Object.prototype.hasOwnProperty.call(r,a)&&vr(n,r,a);return o(n,r),n},Fi=function(r){return r&&r.__esModule?r:{default:r}},Gi=function(r,n,a,i){if(a==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof n=="function"?r!==n||!i:!n.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return a==="m"?i:a==="a"?i.call(r):i?i.value:n.get(r)},Hi=function(r,n,a,i,s){if(i==="m")throw new TypeError("Private method is not writable");if(i==="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 i==="a"?s.call(r,a):s?s.value=a:n.set(r,a),a},Vi=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",xi),e("__assign",_i),e("__rest",Si),e("__decorate",Pi),e("__param",Li),e("__metadata",Ti),e("__awaiter",Ai),e("__generator",ki),e("__exportStar",Wi),e("__createBinding",vr),e("__values",br),e("__read",In),e("__spread",Ri),e("__spreadArrays",Ii),e("__spreadArray",Mi),e("__await",po),e("__asyncGenerator",Ni),e("__asyncDelegator",Oi),e("__asyncValues",Di),e("__makeTemplateObject",Ui),e("__importStar",Bi),e("__importDefault",Fi),e("__classPrivateFieldGet",Gi),e("__classPrivateFieldSet",Hi),e("__classPrivateFieldIn",Vi)})});var Mn=gt(V=>{"use strict";Object.defineProperty(V,"__esModule",{value:!0});V.getLocalStorage=V.getLocalStorageOrThrow=V.getCrypto=V.getCryptoOrThrow=V.getLocation=V.getLocationOrThrow=V.getNavigator=V.getNavigatorOrThrow=V.getDocument=V.getDocumentOrThrow=V.getFromWindowOrThrow=V.getFromWindow=void 0;function Kt(e){let t;return typeof window<"u"&&typeof window[e]<"u"&&(t=window[e]),t}V.getFromWindow=Kt;function uo(e){let t=Kt(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}V.getFromWindowOrThrow=uo;function Bc(){return uo("document")}V.getDocumentOrThrow=Bc;function Fc(){return Kt("document")}V.getDocument=Fc;function Gc(){return uo("navigator")}V.getNavigatorOrThrow=Gc;function Hc(){return Kt("navigator")}V.getNavigator=Hc;function Vc(){return uo("location")}V.getLocationOrThrow=Vc;function $c(){return Kt("location")}V.getLocation=$c;function jc(){return uo("crypto")}V.getCryptoOrThrow=jc;function qc(){return Kt("crypto")}V.getCrypto=qc;function zc(){return uo("localStorage")}V.getLocalStorageOrThrow=zc;function Zc(){return Kt("localStorage")}V.getLocalStorage=Zc});var ji=gt(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Er.getWindowMetadata=void 0;var $i=Mn();function Kc(){let e,t;try{e=$i.getDocumentOrThrow(),t=$i.getLocationOrThrow()}catch{return null}function o(){let f=e.getElementsByTagName("link"),p=[];for(let y=0;y<f.length;y++){let b=f[y],d=b.getAttribute("rel");if(d&&d.toLowerCase().indexOf("icon")>-1){let h=b.getAttribute("href");if(h)if(h.toLowerCase().indexOf("https:")===-1&&h.toLowerCase().indexOf("http:")===-1&&h.indexOf("//")!==0){let w=t.protocol+"//"+t.host;if(h.indexOf("/")===0)w+=h;else{let L=t.pathname.split("/");L.pop(),w+=L.join("/")+"/"+h}p.push(w)}else if(h.indexOf("//")===0){let w=t.protocol+h;p.push(w)}else p.push(h)}}return p}function r(...f){let p=e.getElementsByTagName("meta");for(let y=0;y<p.length;y++){let b=p[y],d=["itemprop","property","name"].map(h=>b.getAttribute(h)).filter(h=>h?f.includes(h):!1);if(d.length&&d){let h=b.getAttribute("content");if(h)return h}}return""}function n(){let f=r("name","og:site_name","og:title","twitter:title");return f||(f=e.title),f}function a(){return r("description","og:description","twitter:description","keywords")}let i=n(),s=a(),l=t.origin,c=o();return{description:s,url:l,icons:c,name:i}}Er.getWindowMetadata=Kc});var os={};En(os,{BotInfo:()=>Ji,BrowserInfo:()=>Zi,NodeInfo:()=>Ki,ReactNativeInfo:()=>Qi,SearchBotDeviceInfo:()=>Yi,browserName:()=>td,detect:()=>ed,detectOS:()=>es,getNodeVersion:()=>ts,parseUserAgent:()=>Nn});function ed(e){return e?Nn(e):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Qi:typeof navigator<"u"?Nn(navigator.userAgent):ts()}function Xi(e){return e!==""&&Xc.reduce(function(t,o){var r=o[0],n=o[1];if(t)return t;var a=n.exec(e);return!!a&&[r,a]},!1)}function td(e){var t=Xi(e);return t?t[0]:null}function Nn(e){var t=Xi(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<qi&&(n=Yc(n,od(qi-n.length))):n=[];var a=n.join("."),i=es(e),s=Qc.exec(e);return s&&s[1]?new Yi(o,a,i,s[1]):new Zi(o,a,i)}function es(e){for(var t=0,o=zi.length;t<o;t++){var r=zi[t],n=r[0],a=r[1],i=a.exec(e);if(i)return n}return null}function ts(){var e=typeof process<"u"&&process.version;return e?new Ki(process.version.slice(1)):null}function od(e){for(var t=[],o=0;o<e;o++)t.push("0");return t}var Yc,Zi,Ki,Yi,Ji,Qi,Jc,Qc,qi,Xc,zi,rs=Ra(()=>{Yc=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 a=arguments[t],i=0,s=a.length;i<s;i++,n++)r[n]=a[i];return r},Zi=function(){function e(t,o,r){this.name=t,this.version=o,this.os=r,this.type="browser"}return e}(),Ki=function(){function e(t){this.version=t,this.type="node",this.name="node",this.os=process.platform}return e}(),Yi=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}(),Qi=function(){function e(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return e}(),Jc=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,Qc=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,qi=3,Xc=[["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",Jc]],zi=[["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 Dn=gt(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.getClientMeta=A.getLocalStorage=A.getLocalStorageOrThrow=A.getCrypto=A.getCryptoOrThrow=A.getLocation=A.getLocationOrThrow=A.getNavigator=A.getNavigatorOrThrow=A.getDocument=A.getDocumentOrThrow=A.getFromWindowOrThrow=A.getFromWindow=A.isBrowser=A.isNode=A.isMobile=A.isIOS=A.isAndroid=A.detectOS=A.detectEnv=void 0;var ns=Cr(),rd=ns.__importStar(ji()),qe=ns.__importStar(Mn()),nd=(rs(),xn(os));function On(e){return(0,nd.detect)(e)}A.detectEnv=On;function xr(){let e=On();return e&&e.os?e.os:void 0}A.detectOS=xr;function as(){let e=xr();return e?e.toLowerCase().includes("android"):!1}A.isAndroid=as;function is(){let e=xr();return e?e.toLowerCase().includes("ios")||e.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}A.isIOS=is;function ad(){return xr()?as()||is():!1}A.isMobile=ad;function ss(){let e=On();return e&&e.name?e.name.toLowerCase()==="node":!1}A.isNode=ss;function id(){return!ss()&&!!(0,A.getNavigator)()}A.isBrowser=id;A.getFromWindow=qe.getFromWindow;A.getFromWindowOrThrow=qe.getFromWindowOrThrow;A.getDocumentOrThrow=qe.getDocumentOrThrow;A.getDocument=qe.getDocument;A.getNavigatorOrThrow=qe.getNavigatorOrThrow;A.getNavigator=qe.getNavigator;A.getLocationOrThrow=qe.getLocationOrThrow;A.getLocation=qe.getLocation;A.getCryptoOrThrow=qe.getCryptoOrThrow;A.getCrypto=qe.getCrypto;A.getLocalStorageOrThrow=qe.getLocalStorageOrThrow;A.getLocalStorage=qe.getLocalStorage;function sd(){return rd.getWindowMetadata()}A.getClientMeta=sd});var ls={};En(ls,{safeJsonParse:()=>ld,safeJsonStringify:()=>cd});function ld(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 cd(e){return typeof e=="string"?e:JSON.stringify(e)}var cs=Ra(()=>{});var Un=gt(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});fo.safeJsonStringify=fo.safeJsonParse=void 0;var dd=Cr(),ds=dd.__importStar((cs(),xn(ls)));fo.safeJsonParse=ds.safeJsonParse;fo.safeJsonStringify=ds.safeJsonStringify});var Fn=gt(Rt=>{"use strict";Object.defineProperty(Rt,"__esModule",{value:!0});Rt.removeLocal=Rt.getLocal=Rt.setLocal=void 0;var ps=Un(),Bn=Dn();function pd(e,t){let o=(0,ps.safeJsonStringify)(t),r=(0,Bn.getLocalStorage)();r&&r.setItem(e,o)}Rt.setLocal=pd;function ud(e){let t=null,o=null,r=(0,Bn.getLocalStorage)();return r&&(o=r.getItem(e)),t=o&&(0,ps.safeJsonParse)(o),t}Rt.getLocal=ud;function fd(e){let t=(0,Bn.getLocalStorage)();t&&t.removeItem(e)}Rt.removeLocal=fd});var fs=gt(Te=>{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.getMobileLinkRegistry=Te.getMobileRegistryEntry=Te.saveMobileLinkInfo=Te.formatIOSMobile=Te.mobileLinkChoiceKey=void 0;var md=Fn();Te.mobileLinkChoiceKey="WALLETCONNECT_DEEPLINK_CHOICE";function hd(e,t){let o=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${o}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${o}`:""}Te.formatIOSMobile=hd;function gd(e){let t=e.href.split("?")[0];(0,md.setLocal)(Te.mobileLinkChoiceKey,Object.assign(Object.assign({},e),{href:t}))}Te.saveMobileLinkInfo=gd;function us(e,t){return e.filter(o=>o.name.toLowerCase().includes(t.toLowerCase()))[0]}Te.getMobileRegistryEntry=us;function yd(e,t){let o=e;return t&&(o=t.map(r=>us(e,r)).filter(Boolean)),o}Te.getMobileLinkRegistry=yd});var gs=gt(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.formatMobileRegistry=it.formatMobileRegistryEntry=it.getDappRegistryUrl=it.getWalletRegistryUrl=void 0;var ms="https://registry.walletconnect.com";function bd(){return ms+"/api/v2/wallets"}it.getWalletRegistryUrl=bd;function vd(){return ms+"/api/v2/dapps"}it.getDappRegistryUrl=vd;function hs(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||""}}it.formatMobileRegistryEntry=hs;function wd(e,t="mobile"){return Object.values(e).filter(o=>!!o[t].universal||!!o[t].native).map(o=>hs(o,t))}it.formatMobileRegistry=wd});var ys=gt(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});var Bo=Cr();Bo.__exportStar(Dn(),Yt);Bo.__exportStar(Un(),Yt);Bo.__exportStar(Fn(),Yt);Bo.__exportStar(fs(),Yt);Bo.__exportStar(gs(),Yt)});var eu={};En(eu,{AsExternalProvider:()=>Wt,ConnectorManager:()=>mo,PrivyClient:()=>go,PrivyProvider:()=>_c,PrivyProxyProvider:()=>He,VERSION:()=>ir,WalletConnector:()=>Ve,getAccessToken:()=>xc,usePrivy:()=>B});module.exports=xn(eu);var Ec=require("@ethersproject/providers"),se=require("react");var S=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};var Ma=T(require("axios")),Qe=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}]`:""}`}},ao=class extends Qe{constructor(o,r,n,a){super(n,a);this.type=o;this.status=r}},_=class extends Qe{constructor(o,r){super(o,r);this.type="client_error"}};var ee=class extends Qe{constructor(o,r){super(o,r);this.type="connector_error"}},le=e=>{if(e instanceof Qe)return e;if(!Ma.default.isAxiosError(e))return Ue(e);if(!e.response)return new ao("api_error",null,e.message,e);let{type:t,message:o,error:r}=e.response.data;return new ao(t||"ApiError",e.response.status,o||r,e)},Ue=e=>e instanceof Qe?e:e instanceof Error?new _(e.message,e):new _(`Internal error: ${e}`);var Na=()=>"/api/v1/sessions",Oa=()=>"/api/v1/sessions/logout",Da=()=>"/api/v1/sessions/fork",Ua=()=>"/api/v1/sessions/fork/recover",Ba=()=>"/api/v1/siwe/init",Fa=()=>"/api/v1/siwe/authenticate",Ga=()=>"/api/v1/siwe/link",Ha=()=>"/api/v1/passwordless/init",Va=()=>"/api/v1/passwordless/authenticate",$a=()=>"/api/v1/passwordless/link",ja=()=>"/api/v1/passwordless_sms/init",qa=()=>"/api/v1/passwordless_sms/authenticate",za=()=>"/api/v1/passwordless_sms/link",Za=()=>"/api/v1/oauth/init",Ka=()=>"/api/v1/oauth/authenticate",Ya=()=>"/api/v1/oauth/link",Ja=()=>"/api/v1/siwe/unlink",Qa=()=>"/api/v1/passwordless/unlink",Xa=()=>"/api/v1/passwordless_sms/unlink",ei=()=>"/api/v1/oauth/unlink",ti=()=>"/api/v1/analytics_events";var Vt=class{constructor(t){this.meta={email:t}}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new _("Email and email code must be set prior to calling authenticate.");try{let t=Va(),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 le(t)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new _("Email and email code must be set prior to calling authenticate.");try{let t=$a();return(await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode})).data}catch(t){throw le(t)}}async sendCodeEmail(t){if(!this.api)throw new _("Auth flow has no API instance");if(t&&(this.meta.email=t),!this.meta.email)throw new _("Email must be set when initialzing authentication.");try{let o=Ha();return(await this.api.post(o,{email:this.meta.email})).data}catch(o){throw le(o)}}};var At=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 _("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new _("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new _("User denied confirmation during OAuth flow");try{let t=Ka(),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 le(t)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new _("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new _("User denied confirmation during OAuth flow");try{let t=Ya();return(await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode})).data}catch(t){throw le(t)}}async getAuthorizationUrl(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.provider)throw new _("Provider must be set when initialzing OAuth authentication.");try{let t=Za();return(await this.api.post(t,{provider:this.meta.provider,redirect_to:window.location.href})).data}catch(t){throw le(t)}}};var kt=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 _("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(Fa(),{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 le(t)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(Ga(),{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 le(t)}}async promptConnect(){if(!this.api)throw new _("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 _("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 _("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 _("Auth flow has no API instance");let o=t.address,r=t.chainId,n=await this.api.post(Ba(),{address:o});return this.preparedMessage=this.walletConnector.prepareMessage(r,o,n.data.nonce),this.preparedMessage}};var $t=class{constructor(t){this.meta={phoneNumber:t}}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new _("phone number and sms code must be set prior to calling authenticate.");try{let t=qa(),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 le(t)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new _("phone number and sms code must be set prior to calling authenticate.");try{let t=za();return(await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})).data}catch(t){throw le(t)}}async sendSmsCode(t){if(!this.api)throw new _("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),!this.meta.phoneNumber)throw new _("phone nNumber must be set when initialzing authentication.");try{let o=ja();return(await this.api.post(o,{phoneNumber:this.meta.phoneNumber})).data}catch(o){throw le(o)}}};var _s=require("@ethersproject/address");var oi="1.23.0-beta.5";var ri="AZD8ITQ3ZQS63BQIJN3SPP767ZZY89SZJX",jt="4df5e2316331463a9130964bd6078dfa",ar="https://auth.privy.io",ni=1e4,Be=1400,ir=oi;var io="privy:token",sr="privy:refresh_token",Do="privy:session_transfer_token",lr="privy:connectors",_n="walletconnect",ai=3e4;var Sn=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)}},Pn=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 Rc(){return typeof window<"u"&&window.localStorage?new Pn:new Sn}var X=Rc();var ci=T(require("@coinbase/wallet-sdk")),di=require("@ethersproject/address");var Uo=require("react/jsx-runtime"),Fe=({style:e,...t})=>(0,Uo.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,Uo.jsx)("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),(0,Uo.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 si=require("@ethersproject/address"),li=require("@ethersproject/providers");var ii=require("@ethersproject/logger");var so=class extends ee{constructor(){super("Wallet timeout");this.type="wallet_error"}},zt=class extends ee{constructor(){super("User rejected connection");this.type="wallet_error"}},Ge=e=>{if(e instanceof ee)return e;if((e==null?void 0:e.code)&&(e==null?void 0:e.reason)){let t=new lo(e);return e.code===ii.ErrorCode.ACTION_REJECTED&&(t.details=qt.E4001_USER_REJECTED_REQUEST),t}return e!=null&&e.code?new lo(e):new ee("Unknown connector error",e)},Ln=class extends Qe{constructor(o,r,n){super(o);this.type="provider_error";this.code=r,this.data=n}},lo=class extends Ln{constructor(o){var a,i,s;let r=o;super(r.message,r.code,r.data);let n=Object.values(qt).find(l=>l.eipCode===r.code);this.details=n||qt.UNKNOWN_ERROR,r.code===-32002&&((a=r.message)!=null&&a.includes("already pending for origin")?(i=r.message)!=null&&i.includes("wallet_requestPermissions")?this.details=qt.E32002_CONNECTION_ALREADY_PENDING:this.details=qt.E32002_REQUEST_ALREADY_PENDING:(s=r.message)!=null&&s.includes("Already processing")&&r.message.includes("eth_requestAccounts")&&(this.details=qt.E32002_WALLET_LOCKED))}},Ic={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}},Mc={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}},Nc={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}},qt={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...Nc,...Mc},Zt={...Ic,...qt};var Oc=12e4,Tn=(e=new so,t=Oc)=>new Promise((o,r)=>setTimeout(()=>{r(e)},t)),He=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 ee(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),Tn()]).catch(o=>{throw Ge(o)})}},Wt=class extends He{constructor(o){super(o)}},cr=class extends He{constructor(t){super(t)}sendAsync(t,o){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var Ve=class{constructor(t,o,r){this.createSiweMessage=(t,o,r,n,a,i,s)=>`${r} wants you to sign in with your Ethereum account:
|
|
1
|
+
"use strict";var Pc=Object.create;var nr=Object.defineProperty;var Lc=Object.getOwnPropertyDescriptor;var Tc=Object.getOwnPropertyNames;var Ac=Object.getPrototypeOf,kc=Object.prototype.hasOwnProperty;var Ra=(e,t)=>()=>(e&&(t=e(e=0)),t);var gt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),En=(e,t)=>{for(var o in t)nr(e,o,{get:t[o],enumerable:!0})},Ia=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Tc(t))!kc.call(e,n)&&n!==o&&nr(e,n,{get:()=>t[n],enumerable:!(r=Lc(t,n))||r.enumerable});return e};var T=(e,t,o)=>(o=e!=null?Pc(Ac(e)):{},Ia(t||!e||!e.__esModule?nr(o,"default",{value:e,enumerable:!0}):o,e)),xn=e=>Ia(nr({},"__esModule",{value:!0}),e);var Cr=gt((a2,wr)=>{var xi,_i,Si,Pi,Li,Ti,Ai,ki,Wi,br,In,Ri,Ii,Mi,po,Ni,Oi,Di,Ui,Bi,Fi,Gi,Hi,Vi,vr;(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 wr=="object"&&typeof wr.exports=="object"?e(o(t,o(wr.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(a,i){return r[a]=n?n(a,i):i}}})(function(e){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(r[a]=n[a])};xi=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 a(){this.constructor=r}r.prototype=n===null?Object.create(n):(a.prototype=n.prototype,new a)},_i=Object.assign||function(r){for(var n,a=1,i=arguments.length;a<i;a++){n=arguments[a];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])}return r},Si=function(r,n){var a={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&n.indexOf(i)<0&&(a[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,i=Object.getOwnPropertySymbols(r);s<i.length;s++)n.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(r,i[s])&&(a[i[s]]=r[i[s]]);return a},Pi=function(r,n,a,i){var s=arguments.length,l=s<3?n:i===null?i=Object.getOwnPropertyDescriptor(n,a):i,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(r,n,a,i);else for(var g=r.length-1;g>=0;g--)(c=r[g])&&(l=(s<3?c(l):s>3?c(n,a,l):c(n,a))||l);return s>3&&l&&Object.defineProperty(n,a,l),l},Li=function(r,n){return function(a,i){n(a,i,r)}},Ti=function(r,n){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,n)},Ai=function(r,n,a,i){function s(l){return l instanceof a?l:new a(function(c){c(l)})}return new(a||(a=Promise))(function(l,c){function g(y){try{p(i.next(y))}catch(b){c(b)}}function f(y){try{p(i.throw(y))}catch(b){c(b)}}function p(y){y.done?l(y.value):s(y.value).then(g,f)}p((i=i.apply(r,n||[])).next())})},ki=function(r,n){var a={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},i,s,l,c;return c={next:g(0),throw:g(1),return:g(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function g(p){return function(y){return f([p,y])}}function f(p){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=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 a.label++,{value:p[1],done:!1};case 5:a.label++,s=p[1],p=[0];continue;case 7:p=a.ops.pop(),a.trys.pop();continue;default:if(l=a.trys,!(l=l.length>0&&l[l.length-1])&&(p[0]===6||p[0]===2)){a=0;continue}if(p[0]===3&&(!l||p[1]>l[0]&&p[1]<l[3])){a.label=p[1];break}if(p[0]===6&&a.label<l[1]){a.label=l[1],l=p;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(p);break}l[2]&&a.ops.pop(),a.trys.pop();continue}p=n.call(r,a)}catch(y){p=[6,y],s=0}finally{i=l=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},Wi=function(r,n){for(var a in r)a!=="default"&&!Object.prototype.hasOwnProperty.call(n,a)&&vr(n,r,a)},vr=Object.create?function(r,n,a,i){i===void 0&&(i=a);var s=Object.getOwnPropertyDescriptor(n,a);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[a]}}),Object.defineProperty(r,i,s)}:function(r,n,a,i){i===void 0&&(i=a),r[i]=n[a]},br=function(r){var n=typeof Symbol=="function"&&Symbol.iterator,a=n&&r[n],i=0;if(a)return a.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},In=function(r,n){var a=typeof Symbol=="function"&&r[Symbol.iterator];if(!a)return r;var i=a.call(r),s,l=[],c;try{for(;(n===void 0||n-- >0)&&!(s=i.next()).done;)l.push(s.value)}catch(g){c={error:g}}finally{try{s&&!s.done&&(a=i.return)&&a.call(i)}finally{if(c)throw c.error}}return l},Ri=function(){for(var r=[],n=0;n<arguments.length;n++)r=r.concat(In(arguments[n]));return r},Ii=function(){for(var r=0,n=0,a=arguments.length;n<a;n++)r+=arguments[n].length;for(var i=Array(r),s=0,n=0;n<a;n++)for(var l=arguments[n],c=0,g=l.length;c<g;c++,s++)i[s]=l[c];return i},Mi=function(r,n,a){if(a||arguments.length===2)for(var i=0,s=n.length,l;i<s;i++)(l||!(i in n))&&(l||(l=Array.prototype.slice.call(n,0,i)),l[i]=n[i]);return r.concat(l||Array.prototype.slice.call(n))},po=function(r){return this instanceof po?(this.v=r,this):new po(r)},Ni=function(r,n,a){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=a.apply(r,n||[]),s,l=[];return s={},c("next"),c("throw"),c("return"),s[Symbol.asyncIterator]=function(){return this},s;function c(d){i[d]&&(s[d]=function(h){return new Promise(function(w,L){l.push([d,h,w,L])>1||g(d,h)})})}function g(d,h){try{f(i[d](h))}catch(w){b(l[0][3],w)}}function f(d){d.value instanceof po?Promise.resolve(d.value.v).then(p,y):b(l[0][2],d)}function p(d){g("next",d)}function y(d){g("throw",d)}function b(d,h){d(h),l.shift(),l.length&&g(l[0][0],l[0][1])}},Oi=function(r){var n,a;return n={},i("next"),i("throw",function(s){throw s}),i("return"),n[Symbol.iterator]=function(){return this},n;function i(s,l){n[s]=r[s]?function(c){return(a=!a)?{value:po(r[s](c)),done:s==="return"}:l?l(c):c}:l}},Di=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r[Symbol.asyncIterator],a;return n?n.call(r):(r=typeof br=="function"?br(r):r[Symbol.iterator](),a={},i("next"),i("throw"),i("return"),a[Symbol.asyncIterator]=function(){return this},a);function i(l){a[l]=r[l]&&function(c){return new Promise(function(g,f){c=r[l](c),s(g,f,c.done,c.value)})}}function s(l,c,g,f){Promise.resolve(f).then(function(p){l({value:p,done:g})},c)}},Ui=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};Bi=function(r){if(r&&r.__esModule)return r;var n={};if(r!=null)for(var a in r)a!=="default"&&Object.prototype.hasOwnProperty.call(r,a)&&vr(n,r,a);return o(n,r),n},Fi=function(r){return r&&r.__esModule?r:{default:r}},Gi=function(r,n,a,i){if(a==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof n=="function"?r!==n||!i:!n.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return a==="m"?i:a==="a"?i.call(r):i?i.value:n.get(r)},Hi=function(r,n,a,i,s){if(i==="m")throw new TypeError("Private method is not writable");if(i==="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 i==="a"?s.call(r,a):s?s.value=a:n.set(r,a),a},Vi=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",xi),e("__assign",_i),e("__rest",Si),e("__decorate",Pi),e("__param",Li),e("__metadata",Ti),e("__awaiter",Ai),e("__generator",ki),e("__exportStar",Wi),e("__createBinding",vr),e("__values",br),e("__read",In),e("__spread",Ri),e("__spreadArrays",Ii),e("__spreadArray",Mi),e("__await",po),e("__asyncGenerator",Ni),e("__asyncDelegator",Oi),e("__asyncValues",Di),e("__makeTemplateObject",Ui),e("__importStar",Bi),e("__importDefault",Fi),e("__classPrivateFieldGet",Gi),e("__classPrivateFieldSet",Hi),e("__classPrivateFieldIn",Vi)})});var Mn=gt(V=>{"use strict";Object.defineProperty(V,"__esModule",{value:!0});V.getLocalStorage=V.getLocalStorageOrThrow=V.getCrypto=V.getCryptoOrThrow=V.getLocation=V.getLocationOrThrow=V.getNavigator=V.getNavigatorOrThrow=V.getDocument=V.getDocumentOrThrow=V.getFromWindowOrThrow=V.getFromWindow=void 0;function Kt(e){let t;return typeof window<"u"&&typeof window[e]<"u"&&(t=window[e]),t}V.getFromWindow=Kt;function uo(e){let t=Kt(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}V.getFromWindowOrThrow=uo;function Bc(){return uo("document")}V.getDocumentOrThrow=Bc;function Fc(){return Kt("document")}V.getDocument=Fc;function Gc(){return uo("navigator")}V.getNavigatorOrThrow=Gc;function Hc(){return Kt("navigator")}V.getNavigator=Hc;function Vc(){return uo("location")}V.getLocationOrThrow=Vc;function $c(){return Kt("location")}V.getLocation=$c;function jc(){return uo("crypto")}V.getCryptoOrThrow=jc;function qc(){return Kt("crypto")}V.getCrypto=qc;function zc(){return uo("localStorage")}V.getLocalStorageOrThrow=zc;function Zc(){return Kt("localStorage")}V.getLocalStorage=Zc});var ji=gt(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Er.getWindowMetadata=void 0;var $i=Mn();function Kc(){let e,t;try{e=$i.getDocumentOrThrow(),t=$i.getLocationOrThrow()}catch{return null}function o(){let f=e.getElementsByTagName("link"),p=[];for(let y=0;y<f.length;y++){let b=f[y],d=b.getAttribute("rel");if(d&&d.toLowerCase().indexOf("icon")>-1){let h=b.getAttribute("href");if(h)if(h.toLowerCase().indexOf("https:")===-1&&h.toLowerCase().indexOf("http:")===-1&&h.indexOf("//")!==0){let w=t.protocol+"//"+t.host;if(h.indexOf("/")===0)w+=h;else{let L=t.pathname.split("/");L.pop(),w+=L.join("/")+"/"+h}p.push(w)}else if(h.indexOf("//")===0){let w=t.protocol+h;p.push(w)}else p.push(h)}}return p}function r(...f){let p=e.getElementsByTagName("meta");for(let y=0;y<p.length;y++){let b=p[y],d=["itemprop","property","name"].map(h=>b.getAttribute(h)).filter(h=>h?f.includes(h):!1);if(d.length&&d){let h=b.getAttribute("content");if(h)return h}}return""}function n(){let f=r("name","og:site_name","og:title","twitter:title");return f||(f=e.title),f}function a(){return r("description","og:description","twitter:description","keywords")}let i=n(),s=a(),l=t.origin,c=o();return{description:s,url:l,icons:c,name:i}}Er.getWindowMetadata=Kc});var os={};En(os,{BotInfo:()=>Ji,BrowserInfo:()=>Zi,NodeInfo:()=>Ki,ReactNativeInfo:()=>Qi,SearchBotDeviceInfo:()=>Yi,browserName:()=>td,detect:()=>ed,detectOS:()=>es,getNodeVersion:()=>ts,parseUserAgent:()=>Nn});function ed(e){return e?Nn(e):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Qi:typeof navigator<"u"?Nn(navigator.userAgent):ts()}function Xi(e){return e!==""&&Xc.reduce(function(t,o){var r=o[0],n=o[1];if(t)return t;var a=n.exec(e);return!!a&&[r,a]},!1)}function td(e){var t=Xi(e);return t?t[0]:null}function Nn(e){var t=Xi(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<qi&&(n=Yc(n,od(qi-n.length))):n=[];var a=n.join("."),i=es(e),s=Qc.exec(e);return s&&s[1]?new Yi(o,a,i,s[1]):new Zi(o,a,i)}function es(e){for(var t=0,o=zi.length;t<o;t++){var r=zi[t],n=r[0],a=r[1],i=a.exec(e);if(i)return n}return null}function ts(){var e=typeof process<"u"&&process.version;return e?new Ki(process.version.slice(1)):null}function od(e){for(var t=[],o=0;o<e;o++)t.push("0");return t}var Yc,Zi,Ki,Yi,Ji,Qi,Jc,Qc,qi,Xc,zi,rs=Ra(()=>{Yc=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 a=arguments[t],i=0,s=a.length;i<s;i++,n++)r[n]=a[i];return r},Zi=function(){function e(t,o,r){this.name=t,this.version=o,this.os=r,this.type="browser"}return e}(),Ki=function(){function e(t){this.version=t,this.type="node",this.name="node",this.os=process.platform}return e}(),Yi=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}(),Qi=function(){function e(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return e}(),Jc=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,Qc=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,qi=3,Xc=[["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",Jc]],zi=[["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 Dn=gt(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.getClientMeta=A.getLocalStorage=A.getLocalStorageOrThrow=A.getCrypto=A.getCryptoOrThrow=A.getLocation=A.getLocationOrThrow=A.getNavigator=A.getNavigatorOrThrow=A.getDocument=A.getDocumentOrThrow=A.getFromWindowOrThrow=A.getFromWindow=A.isBrowser=A.isNode=A.isMobile=A.isIOS=A.isAndroid=A.detectOS=A.detectEnv=void 0;var ns=Cr(),rd=ns.__importStar(ji()),qe=ns.__importStar(Mn()),nd=(rs(),xn(os));function On(e){return(0,nd.detect)(e)}A.detectEnv=On;function xr(){let e=On();return e&&e.os?e.os:void 0}A.detectOS=xr;function as(){let e=xr();return e?e.toLowerCase().includes("android"):!1}A.isAndroid=as;function is(){let e=xr();return e?e.toLowerCase().includes("ios")||e.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}A.isIOS=is;function ad(){return xr()?as()||is():!1}A.isMobile=ad;function ss(){let e=On();return e&&e.name?e.name.toLowerCase()==="node":!1}A.isNode=ss;function id(){return!ss()&&!!(0,A.getNavigator)()}A.isBrowser=id;A.getFromWindow=qe.getFromWindow;A.getFromWindowOrThrow=qe.getFromWindowOrThrow;A.getDocumentOrThrow=qe.getDocumentOrThrow;A.getDocument=qe.getDocument;A.getNavigatorOrThrow=qe.getNavigatorOrThrow;A.getNavigator=qe.getNavigator;A.getLocationOrThrow=qe.getLocationOrThrow;A.getLocation=qe.getLocation;A.getCryptoOrThrow=qe.getCryptoOrThrow;A.getCrypto=qe.getCrypto;A.getLocalStorageOrThrow=qe.getLocalStorageOrThrow;A.getLocalStorage=qe.getLocalStorage;function sd(){return rd.getWindowMetadata()}A.getClientMeta=sd});var ls={};En(ls,{safeJsonParse:()=>ld,safeJsonStringify:()=>cd});function ld(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 cd(e){return typeof e=="string"?e:JSON.stringify(e)}var cs=Ra(()=>{});var Un=gt(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});fo.safeJsonStringify=fo.safeJsonParse=void 0;var dd=Cr(),ds=dd.__importStar((cs(),xn(ls)));fo.safeJsonParse=ds.safeJsonParse;fo.safeJsonStringify=ds.safeJsonStringify});var Fn=gt(Rt=>{"use strict";Object.defineProperty(Rt,"__esModule",{value:!0});Rt.removeLocal=Rt.getLocal=Rt.setLocal=void 0;var ps=Un(),Bn=Dn();function pd(e,t){let o=(0,ps.safeJsonStringify)(t),r=(0,Bn.getLocalStorage)();r&&r.setItem(e,o)}Rt.setLocal=pd;function ud(e){let t=null,o=null,r=(0,Bn.getLocalStorage)();return r&&(o=r.getItem(e)),t=o&&(0,ps.safeJsonParse)(o),t}Rt.getLocal=ud;function fd(e){let t=(0,Bn.getLocalStorage)();t&&t.removeItem(e)}Rt.removeLocal=fd});var fs=gt(Te=>{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.getMobileLinkRegistry=Te.getMobileRegistryEntry=Te.saveMobileLinkInfo=Te.formatIOSMobile=Te.mobileLinkChoiceKey=void 0;var md=Fn();Te.mobileLinkChoiceKey="WALLETCONNECT_DEEPLINK_CHOICE";function hd(e,t){let o=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${o}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${o}`:""}Te.formatIOSMobile=hd;function gd(e){let t=e.href.split("?")[0];(0,md.setLocal)(Te.mobileLinkChoiceKey,Object.assign(Object.assign({},e),{href:t}))}Te.saveMobileLinkInfo=gd;function us(e,t){return e.filter(o=>o.name.toLowerCase().includes(t.toLowerCase()))[0]}Te.getMobileRegistryEntry=us;function yd(e,t){let o=e;return t&&(o=t.map(r=>us(e,r)).filter(Boolean)),o}Te.getMobileLinkRegistry=yd});var gs=gt(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.formatMobileRegistry=it.formatMobileRegistryEntry=it.getDappRegistryUrl=it.getWalletRegistryUrl=void 0;var ms="https://registry.walletconnect.com";function bd(){return ms+"/api/v2/wallets"}it.getWalletRegistryUrl=bd;function vd(){return ms+"/api/v2/dapps"}it.getDappRegistryUrl=vd;function hs(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||""}}it.formatMobileRegistryEntry=hs;function wd(e,t="mobile"){return Object.values(e).filter(o=>!!o[t].universal||!!o[t].native).map(o=>hs(o,t))}it.formatMobileRegistry=wd});var ys=gt(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});var Bo=Cr();Bo.__exportStar(Dn(),Yt);Bo.__exportStar(Un(),Yt);Bo.__exportStar(Fn(),Yt);Bo.__exportStar(fs(),Yt);Bo.__exportStar(gs(),Yt)});var eu={};En(eu,{AsExternalProvider:()=>Wt,ConnectorManager:()=>mo,PrivyClient:()=>go,PrivyProvider:()=>_c,PrivyProxyProvider:()=>He,VERSION:()=>ir,WalletConnector:()=>Ve,getAccessToken:()=>xc,usePrivy:()=>B});module.exports=xn(eu);var Ec=require("@ethersproject/providers"),se=require("react");var S=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};var Ma=T(require("axios")),Qe=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}]`:""}`}},ao=class extends Qe{constructor(o,r,n,a){super(n,a);this.type=o;this.status=r}},_=class extends Qe{constructor(o,r){super(o,r);this.type="client_error"}};var ee=class extends Qe{constructor(o,r){super(o,r);this.type="connector_error"}},le=e=>{if(e instanceof Qe)return e;if(!Ma.default.isAxiosError(e))return Ue(e);if(!e.response)return new ao("api_error",null,e.message,e);let{type:t,message:o,error:r}=e.response.data;return new ao(t||"ApiError",e.response.status,o||r,e)},Ue=e=>e instanceof Qe?e:e instanceof Error?new _(e.message,e):new _(`Internal error: ${e}`);var Na=()=>"/api/v1/sessions",Oa=()=>"/api/v1/sessions/logout",Da=()=>"/api/v1/sessions/fork",Ua=()=>"/api/v1/sessions/fork/recover",Ba=()=>"/api/v1/siwe/init",Fa=()=>"/api/v1/siwe/authenticate",Ga=()=>"/api/v1/siwe/link",Ha=()=>"/api/v1/passwordless/init",Va=()=>"/api/v1/passwordless/authenticate",$a=()=>"/api/v1/passwordless/link",ja=()=>"/api/v1/passwordless_sms/init",qa=()=>"/api/v1/passwordless_sms/authenticate",za=()=>"/api/v1/passwordless_sms/link",Za=()=>"/api/v1/oauth/init",Ka=()=>"/api/v1/oauth/authenticate",Ya=()=>"/api/v1/oauth/link",Ja=()=>"/api/v1/siwe/unlink",Qa=()=>"/api/v1/passwordless/unlink",Xa=()=>"/api/v1/passwordless_sms/unlink",ei=()=>"/api/v1/oauth/unlink",ti=()=>"/api/v1/analytics_events";var Vt=class{constructor(t){this.meta={email:t}}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new _("Email and email code must be set prior to calling authenticate.");try{let t=Va(),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 le(t)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new _("Email and email code must be set prior to calling authenticate.");try{let t=$a();return(await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode})).data}catch(t){throw le(t)}}async sendCodeEmail(t){if(!this.api)throw new _("Auth flow has no API instance");if(t&&(this.meta.email=t),!this.meta.email)throw new _("Email must be set when initialzing authentication.");try{let o=Ha();return(await this.api.post(o,{email:this.meta.email})).data}catch(o){throw le(o)}}};var At=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 _("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new _("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new _("User denied confirmation during OAuth flow");try{let t=Ka(),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 le(t)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new _("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new _("User denied confirmation during OAuth flow");try{let t=Ya();return(await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode})).data}catch(t){throw le(t)}}async getAuthorizationUrl(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.provider)throw new _("Provider must be set when initialzing OAuth authentication.");try{let t=Za();return(await this.api.post(t,{provider:this.meta.provider,redirect_to:window.location.href})).data}catch(t){throw le(t)}}};var kt=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 _("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(Fa(),{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 le(t)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(Ga(),{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 le(t)}}async promptConnect(){if(!this.api)throw new _("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 _("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 _("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 _("Auth flow has no API instance");let o=t.address,r=t.chainId,n=await this.api.post(Ba(),{address:o});return this.preparedMessage=this.walletConnector.prepareMessage(r,o,n.data.nonce),this.preparedMessage}};var $t=class{constructor(t){this.meta={phoneNumber:t}}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new _("phone number and sms code must be set prior to calling authenticate.");try{let t=qa(),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 le(t)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new _("phone number and sms code must be set prior to calling authenticate.");try{let t=za();return(await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})).data}catch(t){throw le(t)}}async sendSmsCode(t){if(!this.api)throw new _("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),!this.meta.phoneNumber)throw new _("phone nNumber must be set when initialzing authentication.");try{let o=ja();return(await this.api.post(o,{phoneNumber:this.meta.phoneNumber})).data}catch(o){throw le(o)}}};var _s=require("@ethersproject/address");var oi="1.23.0";var ri="AZD8ITQ3ZQS63BQIJN3SPP767ZZY89SZJX",jt="4df5e2316331463a9130964bd6078dfa",ar="https://auth.privy.io",ni=1e4,Be=1400,ir=oi;var io="privy:token",sr="privy:refresh_token",Do="privy:session_transfer_token",lr="privy:connectors",_n="walletconnect",ai=3e4;var Sn=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)}},Pn=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 Rc(){return typeof window<"u"&&window.localStorage?new Pn:new Sn}var X=Rc();var ci=T(require("@coinbase/wallet-sdk")),di=require("@ethersproject/address");var Uo=require("react/jsx-runtime"),Fe=({style:e,...t})=>(0,Uo.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,Uo.jsx)("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),(0,Uo.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 si=require("@ethersproject/address"),li=require("@ethersproject/providers");var ii=require("@ethersproject/logger");var so=class extends ee{constructor(){super("Wallet timeout");this.type="wallet_error"}},zt=class extends ee{constructor(){super("User rejected connection");this.type="wallet_error"}},Ge=e=>{if(e instanceof ee)return e;if((e==null?void 0:e.code)&&(e==null?void 0:e.reason)){let t=new lo(e);return e.code===ii.ErrorCode.ACTION_REJECTED&&(t.details=qt.E4001_USER_REJECTED_REQUEST),t}return e!=null&&e.code?new lo(e):new ee("Unknown connector error",e)},Ln=class extends Qe{constructor(o,r,n){super(o);this.type="provider_error";this.code=r,this.data=n}},lo=class extends Ln{constructor(o){var a,i,s;let r=o;super(r.message,r.code,r.data);let n=Object.values(qt).find(l=>l.eipCode===r.code);this.details=n||qt.UNKNOWN_ERROR,r.code===-32002&&((a=r.message)!=null&&a.includes("already pending for origin")?(i=r.message)!=null&&i.includes("wallet_requestPermissions")?this.details=qt.E32002_CONNECTION_ALREADY_PENDING:this.details=qt.E32002_REQUEST_ALREADY_PENDING:(s=r.message)!=null&&s.includes("Already processing")&&r.message.includes("eth_requestAccounts")&&(this.details=qt.E32002_WALLET_LOCKED))}},Ic={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}},Mc={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}},Nc={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}},qt={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...Nc,...Mc},Zt={...Ic,...qt};var Oc=12e4,Tn=(e=new so,t=Oc)=>new Promise((o,r)=>setTimeout(()=>{r(e)},t)),He=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 ee(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),Tn()]).catch(o=>{throw Ge(o)})}},Wt=class extends He{constructor(o){super(o)}},cr=class extends He{constructor(t){super(t)}sendAsync(t,o){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var Ve=class{constructor(t,o,r){this.createSiweMessage=(t,o,r,n,a,i,s)=>`${r} wants you to sign in with your Ethereum account:
|
|
2
2
|
${o}
|
|
3
3
|
|
|
4
4
|
${s}
|