@privy-io/react-auth 1.22.0-beta.6 → 1.22.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 oc=Object.create;var Ao=Object.defineProperty;var rc=Object.getOwnPropertyDescriptor;var nc=Object.getOwnPropertyNames;var ic=Object.getPrototypeOf,ac=Object.prototype.hasOwnProperty;var ei=(e,t)=>()=>(e&&(t=e(e=0)),t);var Be=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ti=(e,t)=>{for(var o in t)Ao(e,o,{get:t[o],enumerable:!0})},oi=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of nc(t))!ac.call(e,n)&&n!==o&&Ao(e,n,{get:()=>t[n],enumerable:!(r=rc(t,n))||r.enumerable});return e};var sc=(e,t,o)=>(o=e!=null?oc(ic(e)):{},oi(t||!e||!e.__esModule?Ao(o,"default",{value:e,enumerable:!0}):o,e)),ri=e=>oi(Ao({},"__esModule",{value:!0}),e);var jo=Be((M0,Vo)=>{var Fi,Gi,Hi,Vi,ji,$i,zi,qi,Zi,Go,zr,Ki,Ji,Yi,Ot,Xi,Qi,ea,ta,oa,ra,na,ia,aa,Ho;(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 Vo=="object"&&typeof Vo.exports=="object"?e(o(t,o(Vo.exports))):e(o(t));function o(r,n){return r!==t&&(typeof Object.create=="function"?Object.defineProperty(r,"__esModule",{value:!0}):r.__esModule=!0),function(i,a){return r[i]=n?n(i,a):a}}})(function(e){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])};Fi=function(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(r,n);function i(){this.constructor=r}r.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)},Gi=Object.assign||function(r){for(var n,i=1,a=arguments.length;i<a;i++){n=arguments[i];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])}return r},Hi=function(r,n){var i={};for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&n.indexOf(a)<0&&(i[a]=r[a]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,a=Object.getOwnPropertySymbols(r);s<a.length;s++)n.indexOf(a[s])<0&&Object.prototype.propertyIsEnumerable.call(r,a[s])&&(i[a[s]]=r[a[s]]);return i},Vi=function(r,n,i,a){var s=arguments.length,l=s<3?n:a===null?a=Object.getOwnPropertyDescriptor(n,i):a,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(r,n,i,a);else for(var g=r.length-1;g>=0;g--)(c=r[g])&&(l=(s<3?c(l):s>3?c(n,i,l):c(n,i))||l);return s>3&&l&&Object.defineProperty(n,i,l),l},ji=function(r,n){return function(i,a){n(i,a,r)}},$i=function(r,n){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,n)},zi=function(r,n,i,a){function s(l){return l instanceof i?l:new i(function(c){c(l)})}return new(i||(i=Promise))(function(l,c){function g(b){try{p(a.next(b))}catch(y){c(y)}}function h(b){try{p(a.throw(b))}catch(y){c(y)}}function p(b){b.done?l(b.value):s(b.value).then(g,h)}p((a=a.apply(r,n||[])).next())})},qi=function(r,n){var i={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},a,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(b){return h([p,b])}}function h(p){if(a)throw new TypeError("Generator is already executing.");for(;i;)try{if(a=1,s&&(l=p[0]&2?s.return:p[0]?s.throw||((l=s.return)&&l.call(s),0):s.next)&&!(l=l.call(s,p[1])).done)return l;switch(s=0,l&&(p=[p[0]&2,l.value]),p[0]){case 0:case 1:l=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,s=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(l=i.trys,!(l=l.length>0&&l[l.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!l||p[1]>l[0]&&p[1]<l[3])){i.label=p[1];break}if(p[0]===6&&i.label<l[1]){i.label=l[1],l=p;break}if(l&&i.label<l[2]){i.label=l[2],i.ops.push(p);break}l[2]&&i.ops.pop(),i.trys.pop();continue}p=n.call(r,i)}catch(b){p=[6,b],s=0}finally{a=l=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},Zi=function(r,n){for(var i in r)i!=="default"&&!Object.prototype.hasOwnProperty.call(n,i)&&Ho(n,r,i)},Ho=Object.create?function(r,n,i,a){a===void 0&&(a=i);var s=Object.getOwnPropertyDescriptor(n,i);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[i]}}),Object.defineProperty(r,a,s)}:function(r,n,i,a){a===void 0&&(a=i),r[a]=n[i]},Go=function(r){var n=typeof Symbol=="function"&&Symbol.iterator,i=n&&r[n],a=0;if(i)return i.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&a>=r.length&&(r=void 0),{value:r&&r[a++],done:!r}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},zr=function(r,n){var i=typeof Symbol=="function"&&r[Symbol.iterator];if(!i)return r;var a=i.call(r),s,l=[],c;try{for(;(n===void 0||n-- >0)&&!(s=a.next()).done;)l.push(s.value)}catch(g){c={error:g}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(c)throw c.error}}return l},Ki=function(){for(var r=[],n=0;n<arguments.length;n++)r=r.concat(zr(arguments[n]));return r},Ji=function(){for(var r=0,n=0,i=arguments.length;n<i;n++)r+=arguments[n].length;for(var a=Array(r),s=0,n=0;n<i;n++)for(var l=arguments[n],c=0,g=l.length;c<g;c++,s++)a[s]=l[c];return a},Yi=function(r,n,i){if(i||arguments.length===2)for(var a=0,s=n.length,l;a<s;a++)(l||!(a in n))&&(l||(l=Array.prototype.slice.call(n,0,a)),l[a]=n[a]);return r.concat(l||Array.prototype.slice.call(n))},Ot=function(r){return this instanceof Ot?(this.v=r,this):new Ot(r)},Xi=function(r,n,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var a=i.apply(r,n||[]),s,l=[];return s={},c("next"),c("throw"),c("return"),s[Symbol.asyncIterator]=function(){return this},s;function c(d){a[d]&&(s[d]=function(m){return new Promise(function(w,S){l.push([d,m,w,S])>1||g(d,m)})})}function g(d,m){try{h(a[d](m))}catch(w){y(l[0][3],w)}}function h(d){d.value instanceof Ot?Promise.resolve(d.value.v).then(p,b):y(l[0][2],d)}function p(d){g("next",d)}function b(d){g("throw",d)}function y(d,m){d(m),l.shift(),l.length&&g(l[0][0],l[0][1])}},Qi=function(r){var n,i;return n={},a("next"),a("throw",function(s){throw s}),a("return"),n[Symbol.iterator]=function(){return this},n;function a(s,l){n[s]=r[s]?function(c){return(i=!i)?{value:Ot(r[s](c)),done:s==="return"}:l?l(c):c}:l}},ea=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r[Symbol.asyncIterator],i;return n?n.call(r):(r=typeof Go=="function"?Go(r):r[Symbol.iterator](),i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i);function a(l){i[l]=r[l]&&function(c){return new Promise(function(g,h){c=r[l](c),s(g,h,c.done,c.value)})}}function s(l,c,g,h){Promise.resolve(h).then(function(p){l({value:p,done:g})},c)}},ta=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};oa=function(r){if(r&&r.__esModule)return r;var n={};if(r!=null)for(var i in r)i!=="default"&&Object.prototype.hasOwnProperty.call(r,i)&&Ho(n,r,i);return o(n,r),n},ra=function(r){return r&&r.__esModule?r:{default:r}},na=function(r,n,i,a){if(i==="a"&&!a)throw new TypeError("Private accessor was defined without a getter");if(typeof n=="function"?r!==n||!a:!n.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?a:i==="a"?a.call(r):a?a.value:n.get(r)},ia=function(r,n,i,a,s){if(a==="m")throw new TypeError("Private method is not writable");if(a==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof n=="function"?r!==n||!s:!n.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return a==="a"?s.call(r,i):s?s.value=i:n.set(r,i),i},aa=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",Fi),e("__assign",Gi),e("__rest",Hi),e("__decorate",Vi),e("__param",ji),e("__metadata",$i),e("__awaiter",zi),e("__generator",qi),e("__exportStar",Zi),e("__createBinding",Ho),e("__values",Go),e("__read",zr),e("__spread",Ki),e("__spreadArrays",Ji),e("__spreadArray",Yi),e("__await",Ot),e("__asyncGenerator",Xi),e("__asyncDelegator",Qi),e("__asyncValues",ea),e("__makeTemplateObject",ta),e("__importStar",oa),e("__importDefault",ra),e("__classPrivateFieldGet",na),e("__classPrivateFieldSet",ia),e("__classPrivateFieldIn",aa)})});var qr=Be(U=>{"use strict";Object.defineProperty(U,"__esModule",{value:!0});U.getLocalStorage=U.getLocalStorageOrThrow=U.getCrypto=U.getCryptoOrThrow=U.getLocation=U.getLocationOrThrow=U.getNavigator=U.getNavigatorOrThrow=U.getDocument=U.getDocumentOrThrow=U.getFromWindowOrThrow=U.getFromWindow=void 0;function mt(e){let t;return typeof window<"u"&&typeof window[e]<"u"&&(t=window[e]),t}U.getFromWindow=mt;function Nt(e){let t=mt(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}U.getFromWindowOrThrow=Nt;function Ic(){return Nt("document")}U.getDocumentOrThrow=Ic;function Mc(){return mt("document")}U.getDocument=Mc;function Oc(){return Nt("navigator")}U.getNavigatorOrThrow=Oc;function Nc(){return mt("navigator")}U.getNavigator=Nc;function Dc(){return Nt("location")}U.getLocationOrThrow=Dc;function Uc(){return mt("location")}U.getLocation=Uc;function Bc(){return Nt("crypto")}U.getCryptoOrThrow=Bc;function Fc(){return mt("crypto")}U.getCrypto=Fc;function Gc(){return Nt("localStorage")}U.getLocalStorageOrThrow=Gc;function Hc(){return mt("localStorage")}U.getLocalStorage=Hc});var la=Be($o=>{"use strict";Object.defineProperty($o,"__esModule",{value:!0});$o.getWindowMetadata=void 0;var sa=qr();function Vc(){let e,t;try{e=sa.getDocumentOrThrow(),t=sa.getLocationOrThrow()}catch{return null}function o(){let h=e.getElementsByTagName("link"),p=[];for(let b=0;b<h.length;b++){let y=h[b],d=y.getAttribute("rel");if(d&&d.toLowerCase().indexOf("icon")>-1){let m=y.getAttribute("href");if(m)if(m.toLowerCase().indexOf("https:")===-1&&m.toLowerCase().indexOf("http:")===-1&&m.indexOf("//")!==0){let w=t.protocol+"//"+t.host;if(m.indexOf("/")===0)w+=m;else{let S=t.pathname.split("/");S.pop(),w+=S.join("/")+"/"+m}p.push(w)}else if(m.indexOf("//")===0){let w=t.protocol+m;p.push(w)}else p.push(m)}}return p}function r(...h){let p=e.getElementsByTagName("meta");for(let b=0;b<p.length;b++){let y=p[b],d=["itemprop","property","name"].map(m=>y.getAttribute(m)).filter(m=>m?h.includes(m):!1);if(d.length&&d){let m=y.getAttribute("content");if(m)return m}}return""}function n(){let h=r("name","og:site_name","og:title","twitter:title");return h||(h=e.title),h}function i(){return r("description","og:description","twitter:description","keywords")}let a=n(),s=i(),l=t.origin,c=o();return{description:s,url:l,icons:c,name:a}}$o.getWindowMetadata=Vc});var va={};ti(va,{BotInfo:()=>ma,BrowserInfo:()=>pa,NodeInfo:()=>ua,ReactNativeInfo:()=>ha,SearchBotDeviceInfo:()=>fa,browserName:()=>Kc,detect:()=>Zc,detectOS:()=>ba,getNodeVersion:()=>ya,parseUserAgent:()=>Zr});function Zc(e){return e?Zr(e):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new ha:typeof navigator<"u"?Zr(navigator.userAgent):ya()}function ga(e){return e!==""&&qc.reduce(function(t,o){var r=o[0],n=o[1];if(t)return t;var i=n.exec(e);return!!i&&[r,i]},!1)}function Kc(e){var t=ga(e);return t?t[0]:null}function Zr(e){var t=ga(e);if(!t)return null;var o=t[0],r=t[1];if(o==="searchbot")return new ma;var n=r[1]&&r[1].split(/[._]/).slice(0,3);n?n.length<ca&&(n=jc(n,Jc(ca-n.length))):n=[];var i=n.join("."),a=ba(e),s=zc.exec(e);return s&&s[1]?new fa(o,i,a,s[1]):new pa(o,i,a)}function ba(e){for(var t=0,o=da.length;t<o;t++){var r=da[t],n=r[0],i=r[1],a=i.exec(e);if(a)return n}return null}function ya(){var e=typeof process<"u"&&process.version;return e?new ua(process.version.slice(1)):null}function Jc(e){for(var t=[],o=0;o<e;o++)t.push("0");return t}var jc,pa,ua,fa,ma,ha,$c,zc,ca,qc,da,wa=ei(()=>{jc=function(){for(var e=0,t=0,o=arguments.length;t<o;t++)e+=arguments[t].length;for(var r=Array(e),n=0,t=0;t<o;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,n++)r[n]=i[a];return r},pa=function(){function e(t,o,r){this.name=t,this.version=o,this.os=r,this.type="browser"}return e}(),ua=function(){function e(t){this.version=t,this.type="node",this.name="node",this.os=process.platform}return e}(),fa=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}(),ma=function(){function e(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return e}(),ha=function(){function e(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return e}(),$c=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,zc=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,ca=3,qc=[["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",$c]],da=[["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 Jr=Be(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 Ca=jo(),Yc=Ca.__importStar(la()),Pe=Ca.__importStar(qr()),Xc=(wa(),ri(va));function Kr(e){return(0,Xc.detect)(e)}P.detectEnv=Kr;function zo(){let e=Kr();return e&&e.os?e.os:void 0}P.detectOS=zo;function Ea(){let e=zo();return e?e.toLowerCase().includes("android"):!1}P.isAndroid=Ea;function xa(){let e=zo();return e?e.toLowerCase().includes("ios")||e.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}P.isIOS=xa;function Qc(){return zo()?Ea()||xa():!1}P.isMobile=Qc;function _a(){let e=Kr();return e&&e.name?e.name.toLowerCase()==="node":!1}P.isNode=_a;function ed(){return!_a()&&!!(0,P.getNavigator)()}P.isBrowser=ed;P.getFromWindow=Pe.getFromWindow;P.getFromWindowOrThrow=Pe.getFromWindowOrThrow;P.getDocumentOrThrow=Pe.getDocumentOrThrow;P.getDocument=Pe.getDocument;P.getNavigatorOrThrow=Pe.getNavigatorOrThrow;P.getNavigator=Pe.getNavigator;P.getLocationOrThrow=Pe.getLocationOrThrow;P.getLocation=Pe.getLocation;P.getCryptoOrThrow=Pe.getCryptoOrThrow;P.getCrypto=Pe.getCrypto;P.getLocalStorageOrThrow=Pe.getLocalStorageOrThrow;P.getLocalStorage=Pe.getLocalStorage;function td(){return Yc.getWindowMetadata()}P.getClientMeta=td});var Pa={};ti(Pa,{safeJsonParse:()=>od,safeJsonStringify:()=>rd});function od(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 rd(e){return typeof e=="string"?e:JSON.stringify(e)}var Sa=ei(()=>{});var Yr=Be(Dt=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:!0});Dt.safeJsonStringify=Dt.safeJsonParse=void 0;var nd=jo(),La=nd.__importStar((Sa(),ri(Pa)));Dt.safeJsonParse=La.safeJsonParse;Dt.safeJsonStringify=La.safeJsonStringify});var Qr=Be(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.removeLocal=Qe.getLocal=Qe.setLocal=void 0;var Aa=Yr(),Xr=Jr();function id(e,t){let o=(0,Aa.safeJsonStringify)(t),r=(0,Xr.getLocalStorage)();r&&r.setItem(e,o)}Qe.setLocal=id;function ad(e){let t=null,o=null,r=(0,Xr.getLocalStorage)();return r&&(o=r.getItem(e)),t=o&&(0,Aa.safeJsonParse)(o),t}Qe.getLocal=ad;function sd(e){let t=(0,Xr.getLocalStorage)();t&&t.removeItem(e)}Qe.removeLocal=sd});var Ta=Be(fe=>{"use strict";Object.defineProperty(fe,"__esModule",{value:!0});fe.getMobileLinkRegistry=fe.getMobileRegistryEntry=fe.saveMobileLinkInfo=fe.formatIOSMobile=fe.mobileLinkChoiceKey=void 0;var ld=Qr();fe.mobileLinkChoiceKey="WALLETCONNECT_DEEPLINK_CHOICE";function cd(e,t){let o=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${o}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${o}`:""}fe.formatIOSMobile=cd;function dd(e){let t=e.href.split("?")[0];(0,ld.setLocal)(fe.mobileLinkChoiceKey,Object.assign(Object.assign({},e),{href:t}))}fe.saveMobileLinkInfo=dd;function ka(e,t){return e.filter(o=>o.name.toLowerCase().includes(t.toLowerCase()))[0]}fe.getMobileRegistryEntry=ka;function pd(e,t){let o=e;return t&&(o=t.map(r=>ka(e,r)).filter(Boolean)),o}fe.getMobileLinkRegistry=pd});var Ia=Be(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.formatMobileRegistry=We.formatMobileRegistryEntry=We.getDappRegistryUrl=We.getWalletRegistryUrl=void 0;var Wa="https://registry.walletconnect.com";function ud(){return Wa+"/api/v2/wallets"}We.getWalletRegistryUrl=ud;function fd(){return Wa+"/api/v2/dapps"}We.getDappRegistryUrl=fd;function Ra(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||""}}We.formatMobileRegistryEntry=Ra;function md(e,t="mobile"){return Object.values(e).filter(o=>!!o[t].universal||!!o[t].native).map(o=>Ra(o,t))}We.formatMobileRegistry=md});var Ma=Be(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});var ao=jo();ao.__exportStar(Jr(),ht);ao.__exportStar(Yr(),ht);ao.__exportStar(Qr(),ht);ao.__exportStar(Ta(),ht);ao.__exportStar(Ia(),ht)});import{Web3Provider as nu}from"@ethersproject/providers";import{useEffect as Yn,useState as ae}from"react";var x=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import lc from"axios";var Le=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}]`:""}`}},At=class extends Le{constructor(o,r,n,i){super(n,i);this.type=o;this.status=r}},C=class extends Le{constructor(o,r){super(o,r);this.type="client_error"}};var $=class extends Le{constructor(o,r){super(o,r);this.type="connector_error"}},Z=e=>{if(e instanceof Le)return e;if(!lc.isAxiosError(e))return we(e);if(!e.response)return new At("api_error",null,e.message,e);let{type:t,message:o,error:r}=e.response.data;return new At(t||"ApiError",e.response.status,o||r,e)},we=e=>e instanceof Le?e:e instanceof Error?new C(e.message,e):new C(`Internal error: ${e}`);var ni=()=>"/api/v1/sessions",ii=()=>"/api/v1/sessions/logout",ai=()=>"/api/v1/sessions/fork",si=()=>"/api/v1/sessions/fork/recover",li=()=>"/api/v1/siwe/init",ci=()=>"/api/v1/siwe/authenticate",di=()=>"/api/v1/siwe/link",pi=()=>"/api/v1/passwordless/init",ui=()=>"/api/v1/passwordless/authenticate",fi=()=>"/api/v1/passwordless/link",mi=()=>"/api/v1/passwordless_sms/init",hi=()=>"/api/v1/passwordless_sms/authenticate",gi=()=>"/api/v1/passwordless_sms/link",bi=()=>"/api/v1/oauth/init",yi=()=>"/api/v1/oauth/authenticate",vi=()=>"/api/v1/oauth/link",wi=()=>"/api/v1/siwe/unlink",Ci=()=>"/api/v1/passwordless/unlink",Ei=()=>"/api/v1/passwordless_sms/unlink",xi=()=>"/api/v1/oauth/unlink",_i=()=>"/api/v1/analytics_events";var st=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=ui(),o=await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(t){throw Z(t)}}async link(){if(!this.api)throw new 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=fi();return(await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode})).data}catch(t){throw Z(t)}}async sendCodeEmail(t){if(!this.api)throw new 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=pi();return(await this.api.post(o,{email:this.meta.email})).data}catch(o){throw Z(o)}}};var Ye=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=yi(),o=await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(t){throw Z(t)}}async link(){if(!this.api)throw new 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=vi();return(await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode})).data}catch(t){throw Z(t)}}async getAuthorizationUrl(){if(!this.api)throw new 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=bi();return(await this.api.post(t,{provider:this.meta.provider,redirect_to:window.location.href})).data}catch(t){throw Z(t)}}};var Xe=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(ci(),{message:t,signature:o});return this.connectors.addWalletConnector(this.walletConnector),await this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),{user:r.data.user,token:r.data.token,refresh_token:r.data.refresh_token,is_new_user:r.data.is_new_user}}catch(t){throw Z(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(di(),{message:t,signature:o});return this.connectors.addWalletConnector(this.walletConnector),await this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),r.data}catch(t){throw Z(t)}}async promptConnect(){if(!this.api)throw new 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(li(),{address:o});return this.preparedMessage=this.walletConnector.prepareMessage(r,o,n.data.nonce),this.preparedMessage}};var lt=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=hi(),o=await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(t){throw Z(t)}}async link(){if(!this.api)throw new 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=gi();return(await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})).data}catch(t){throw Z(t)}}async sendSmsCode(t){if(!this.api)throw new 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=mi();return(await this.api.post(o,{phoneNumber:this.meta.phoneNumber})).data}catch(o){throw Z(o)}}};import{getAddress as gd}from"@ethersproject/address";var Pi="1.22.0-beta.6";var ko="4df5e2316331463a9130964bd6078dfa",To="https://auth.privy.io",Si=1e4,Ce=1400,Nr=Pi;var kt="privy:token",Wo="privy:refresh_token",io="privy:session_transfer_token",Ro="privy:connectors",Dr="walletconnect",Li=3e4;var Ur=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)}},Br=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 dc(){return typeof window<"u"&&window.localStorage?new Br:new Ur}var V=dc();import vc from"@coinbase/wallet-sdk";import{getAddress as wc}from"@ethersproject/address";import{jsx as Ai,jsxs as pc}from"react/jsx-runtime";var Ee=({style:e,...t})=>pc("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[Ai("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),Ai("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});import{getAddress as bc}from"@ethersproject/address";import{Web3Provider as yc}from"@ethersproject/providers";import{ErrorCode as uc}from"@ethersproject/logger";var Tt=class extends ${constructor(){super("Wallet timeout");this.type="wallet_error"}},dt=class extends ${constructor(){super("User rejected connection");this.type="wallet_error"}},xe=e=>{if(e instanceof $)return e;if((e==null?void 0:e.code)&&(e==null?void 0:e.reason)){let t=new Wt(e);return e.code===uc.ACTION_REJECTED&&(t.details=ct.E4001_USER_REJECTED_REQUEST),t}return e!=null&&e.code?new Wt(e):new $("Unknown connector error",e)},Fr=class extends Le{constructor(o,r,n){super(o);this.type="provider_error";this.code=r,this.data=n}},Wt=class extends Fr{constructor(o){var i,a,s;let r=o;super(r.message,r.code,r.data);let n=Object.values(ct).find(l=>l.eipCode===r.code);this.details=n||ct.UNKNOWN_ERROR,r.code===-32002&&((i=r.message)!=null&&i.includes("already pending for origin")?(a=r.message)!=null&&a.includes("wallet_requestPermissions")?this.details=ct.E32002_CONNECTION_ALREADY_PENDING:this.details=ct.E32002_REQUEST_ALREADY_PENDING:(s=r.message)!=null&&s.includes("Already processing")&&r.message.includes("eth_requestAccounts")&&(this.details=ct.E32002_WALLET_LOCKED))}},fc={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}},hc={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}},ct={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...hc,...mc},pt={...fc,...ct};var gc=12e4,Gr=(e=new Tt,t=gc)=>new Promise((o,r)=>setTimeout(()=>{r(e)},t)),Ae=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 $(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),Gr()]).catch(o=>{throw xe(o)})}},ut=class extends Ae{constructor(o){super(o)}},Io=class extends Ae{constructor(t){super(t)}sendAsync(t,o){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var ke=class{constructor(t,o,r){this.createSiweMessage=(t,o,r,n,i,a,s)=>`${r} wants you to sign in with your Ethereum account:
|
|
1
|
+
var oc=Object.create;var Ao=Object.defineProperty;var rc=Object.getOwnPropertyDescriptor;var nc=Object.getOwnPropertyNames;var ic=Object.getPrototypeOf,ac=Object.prototype.hasOwnProperty;var ei=(e,t)=>()=>(e&&(t=e(e=0)),t);var Be=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ti=(e,t)=>{for(var o in t)Ao(e,o,{get:t[o],enumerable:!0})},oi=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of nc(t))!ac.call(e,n)&&n!==o&&Ao(e,n,{get:()=>t[n],enumerable:!(r=rc(t,n))||r.enumerable});return e};var sc=(e,t,o)=>(o=e!=null?oc(ic(e)):{},oi(t||!e||!e.__esModule?Ao(o,"default",{value:e,enumerable:!0}):o,e)),ri=e=>oi(Ao({},"__esModule",{value:!0}),e);var jo=Be((M0,Vo)=>{var Fi,Gi,Hi,Vi,ji,$i,zi,qi,Zi,Go,zr,Ki,Ji,Yi,Ot,Xi,Qi,ea,ta,oa,ra,na,ia,aa,Ho;(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 Vo=="object"&&typeof Vo.exports=="object"?e(o(t,o(Vo.exports))):e(o(t));function o(r,n){return r!==t&&(typeof Object.create=="function"?Object.defineProperty(r,"__esModule",{value:!0}):r.__esModule=!0),function(i,a){return r[i]=n?n(i,a):a}}})(function(e){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])};Fi=function(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(r,n);function i(){this.constructor=r}r.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)},Gi=Object.assign||function(r){for(var n,i=1,a=arguments.length;i<a;i++){n=arguments[i];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])}return r},Hi=function(r,n){var i={};for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&n.indexOf(a)<0&&(i[a]=r[a]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,a=Object.getOwnPropertySymbols(r);s<a.length;s++)n.indexOf(a[s])<0&&Object.prototype.propertyIsEnumerable.call(r,a[s])&&(i[a[s]]=r[a[s]]);return i},Vi=function(r,n,i,a){var s=arguments.length,l=s<3?n:a===null?a=Object.getOwnPropertyDescriptor(n,i):a,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(r,n,i,a);else for(var g=r.length-1;g>=0;g--)(c=r[g])&&(l=(s<3?c(l):s>3?c(n,i,l):c(n,i))||l);return s>3&&l&&Object.defineProperty(n,i,l),l},ji=function(r,n){return function(i,a){n(i,a,r)}},$i=function(r,n){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,n)},zi=function(r,n,i,a){function s(l){return l instanceof i?l:new i(function(c){c(l)})}return new(i||(i=Promise))(function(l,c){function g(b){try{p(a.next(b))}catch(y){c(y)}}function h(b){try{p(a.throw(b))}catch(y){c(y)}}function p(b){b.done?l(b.value):s(b.value).then(g,h)}p((a=a.apply(r,n||[])).next())})},qi=function(r,n){var i={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},a,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(b){return h([p,b])}}function h(p){if(a)throw new TypeError("Generator is already executing.");for(;i;)try{if(a=1,s&&(l=p[0]&2?s.return:p[0]?s.throw||((l=s.return)&&l.call(s),0):s.next)&&!(l=l.call(s,p[1])).done)return l;switch(s=0,l&&(p=[p[0]&2,l.value]),p[0]){case 0:case 1:l=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,s=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(l=i.trys,!(l=l.length>0&&l[l.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!l||p[1]>l[0]&&p[1]<l[3])){i.label=p[1];break}if(p[0]===6&&i.label<l[1]){i.label=l[1],l=p;break}if(l&&i.label<l[2]){i.label=l[2],i.ops.push(p);break}l[2]&&i.ops.pop(),i.trys.pop();continue}p=n.call(r,i)}catch(b){p=[6,b],s=0}finally{a=l=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},Zi=function(r,n){for(var i in r)i!=="default"&&!Object.prototype.hasOwnProperty.call(n,i)&&Ho(n,r,i)},Ho=Object.create?function(r,n,i,a){a===void 0&&(a=i);var s=Object.getOwnPropertyDescriptor(n,i);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[i]}}),Object.defineProperty(r,a,s)}:function(r,n,i,a){a===void 0&&(a=i),r[a]=n[i]},Go=function(r){var n=typeof Symbol=="function"&&Symbol.iterator,i=n&&r[n],a=0;if(i)return i.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&a>=r.length&&(r=void 0),{value:r&&r[a++],done:!r}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},zr=function(r,n){var i=typeof Symbol=="function"&&r[Symbol.iterator];if(!i)return r;var a=i.call(r),s,l=[],c;try{for(;(n===void 0||n-- >0)&&!(s=a.next()).done;)l.push(s.value)}catch(g){c={error:g}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(c)throw c.error}}return l},Ki=function(){for(var r=[],n=0;n<arguments.length;n++)r=r.concat(zr(arguments[n]));return r},Ji=function(){for(var r=0,n=0,i=arguments.length;n<i;n++)r+=arguments[n].length;for(var a=Array(r),s=0,n=0;n<i;n++)for(var l=arguments[n],c=0,g=l.length;c<g;c++,s++)a[s]=l[c];return a},Yi=function(r,n,i){if(i||arguments.length===2)for(var a=0,s=n.length,l;a<s;a++)(l||!(a in n))&&(l||(l=Array.prototype.slice.call(n,0,a)),l[a]=n[a]);return r.concat(l||Array.prototype.slice.call(n))},Ot=function(r){return this instanceof Ot?(this.v=r,this):new Ot(r)},Xi=function(r,n,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var a=i.apply(r,n||[]),s,l=[];return s={},c("next"),c("throw"),c("return"),s[Symbol.asyncIterator]=function(){return this},s;function c(d){a[d]&&(s[d]=function(m){return new Promise(function(w,S){l.push([d,m,w,S])>1||g(d,m)})})}function g(d,m){try{h(a[d](m))}catch(w){y(l[0][3],w)}}function h(d){d.value instanceof Ot?Promise.resolve(d.value.v).then(p,b):y(l[0][2],d)}function p(d){g("next",d)}function b(d){g("throw",d)}function y(d,m){d(m),l.shift(),l.length&&g(l[0][0],l[0][1])}},Qi=function(r){var n,i;return n={},a("next"),a("throw",function(s){throw s}),a("return"),n[Symbol.iterator]=function(){return this},n;function a(s,l){n[s]=r[s]?function(c){return(i=!i)?{value:Ot(r[s](c)),done:s==="return"}:l?l(c):c}:l}},ea=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r[Symbol.asyncIterator],i;return n?n.call(r):(r=typeof Go=="function"?Go(r):r[Symbol.iterator](),i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i);function a(l){i[l]=r[l]&&function(c){return new Promise(function(g,h){c=r[l](c),s(g,h,c.done,c.value)})}}function s(l,c,g,h){Promise.resolve(h).then(function(p){l({value:p,done:g})},c)}},ta=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};oa=function(r){if(r&&r.__esModule)return r;var n={};if(r!=null)for(var i in r)i!=="default"&&Object.prototype.hasOwnProperty.call(r,i)&&Ho(n,r,i);return o(n,r),n},ra=function(r){return r&&r.__esModule?r:{default:r}},na=function(r,n,i,a){if(i==="a"&&!a)throw new TypeError("Private accessor was defined without a getter");if(typeof n=="function"?r!==n||!a:!n.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?a:i==="a"?a.call(r):a?a.value:n.get(r)},ia=function(r,n,i,a,s){if(a==="m")throw new TypeError("Private method is not writable");if(a==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof n=="function"?r!==n||!s:!n.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return a==="a"?s.call(r,i):s?s.value=i:n.set(r,i),i},aa=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",Fi),e("__assign",Gi),e("__rest",Hi),e("__decorate",Vi),e("__param",ji),e("__metadata",$i),e("__awaiter",zi),e("__generator",qi),e("__exportStar",Zi),e("__createBinding",Ho),e("__values",Go),e("__read",zr),e("__spread",Ki),e("__spreadArrays",Ji),e("__spreadArray",Yi),e("__await",Ot),e("__asyncGenerator",Xi),e("__asyncDelegator",Qi),e("__asyncValues",ea),e("__makeTemplateObject",ta),e("__importStar",oa),e("__importDefault",ra),e("__classPrivateFieldGet",na),e("__classPrivateFieldSet",ia),e("__classPrivateFieldIn",aa)})});var qr=Be(U=>{"use strict";Object.defineProperty(U,"__esModule",{value:!0});U.getLocalStorage=U.getLocalStorageOrThrow=U.getCrypto=U.getCryptoOrThrow=U.getLocation=U.getLocationOrThrow=U.getNavigator=U.getNavigatorOrThrow=U.getDocument=U.getDocumentOrThrow=U.getFromWindowOrThrow=U.getFromWindow=void 0;function mt(e){let t;return typeof window<"u"&&typeof window[e]<"u"&&(t=window[e]),t}U.getFromWindow=mt;function Nt(e){let t=mt(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}U.getFromWindowOrThrow=Nt;function Ic(){return Nt("document")}U.getDocumentOrThrow=Ic;function Mc(){return mt("document")}U.getDocument=Mc;function Oc(){return Nt("navigator")}U.getNavigatorOrThrow=Oc;function Nc(){return mt("navigator")}U.getNavigator=Nc;function Dc(){return Nt("location")}U.getLocationOrThrow=Dc;function Uc(){return mt("location")}U.getLocation=Uc;function Bc(){return Nt("crypto")}U.getCryptoOrThrow=Bc;function Fc(){return mt("crypto")}U.getCrypto=Fc;function Gc(){return Nt("localStorage")}U.getLocalStorageOrThrow=Gc;function Hc(){return mt("localStorage")}U.getLocalStorage=Hc});var la=Be($o=>{"use strict";Object.defineProperty($o,"__esModule",{value:!0});$o.getWindowMetadata=void 0;var sa=qr();function Vc(){let e,t;try{e=sa.getDocumentOrThrow(),t=sa.getLocationOrThrow()}catch{return null}function o(){let h=e.getElementsByTagName("link"),p=[];for(let b=0;b<h.length;b++){let y=h[b],d=y.getAttribute("rel");if(d&&d.toLowerCase().indexOf("icon")>-1){let m=y.getAttribute("href");if(m)if(m.toLowerCase().indexOf("https:")===-1&&m.toLowerCase().indexOf("http:")===-1&&m.indexOf("//")!==0){let w=t.protocol+"//"+t.host;if(m.indexOf("/")===0)w+=m;else{let S=t.pathname.split("/");S.pop(),w+=S.join("/")+"/"+m}p.push(w)}else if(m.indexOf("//")===0){let w=t.protocol+m;p.push(w)}else p.push(m)}}return p}function r(...h){let p=e.getElementsByTagName("meta");for(let b=0;b<p.length;b++){let y=p[b],d=["itemprop","property","name"].map(m=>y.getAttribute(m)).filter(m=>m?h.includes(m):!1);if(d.length&&d){let m=y.getAttribute("content");if(m)return m}}return""}function n(){let h=r("name","og:site_name","og:title","twitter:title");return h||(h=e.title),h}function i(){return r("description","og:description","twitter:description","keywords")}let a=n(),s=i(),l=t.origin,c=o();return{description:s,url:l,icons:c,name:a}}$o.getWindowMetadata=Vc});var va={};ti(va,{BotInfo:()=>ma,BrowserInfo:()=>pa,NodeInfo:()=>ua,ReactNativeInfo:()=>ha,SearchBotDeviceInfo:()=>fa,browserName:()=>Kc,detect:()=>Zc,detectOS:()=>ba,getNodeVersion:()=>ya,parseUserAgent:()=>Zr});function Zc(e){return e?Zr(e):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new ha:typeof navigator<"u"?Zr(navigator.userAgent):ya()}function ga(e){return e!==""&&qc.reduce(function(t,o){var r=o[0],n=o[1];if(t)return t;var i=n.exec(e);return!!i&&[r,i]},!1)}function Kc(e){var t=ga(e);return t?t[0]:null}function Zr(e){var t=ga(e);if(!t)return null;var o=t[0],r=t[1];if(o==="searchbot")return new ma;var n=r[1]&&r[1].split(/[._]/).slice(0,3);n?n.length<ca&&(n=jc(n,Jc(ca-n.length))):n=[];var i=n.join("."),a=ba(e),s=zc.exec(e);return s&&s[1]?new fa(o,i,a,s[1]):new pa(o,i,a)}function ba(e){for(var t=0,o=da.length;t<o;t++){var r=da[t],n=r[0],i=r[1],a=i.exec(e);if(a)return n}return null}function ya(){var e=typeof process<"u"&&process.version;return e?new ua(process.version.slice(1)):null}function Jc(e){for(var t=[],o=0;o<e;o++)t.push("0");return t}var jc,pa,ua,fa,ma,ha,$c,zc,ca,qc,da,wa=ei(()=>{jc=function(){for(var e=0,t=0,o=arguments.length;t<o;t++)e+=arguments[t].length;for(var r=Array(e),n=0,t=0;t<o;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,n++)r[n]=i[a];return r},pa=function(){function e(t,o,r){this.name=t,this.version=o,this.os=r,this.type="browser"}return e}(),ua=function(){function e(t){this.version=t,this.type="node",this.name="node",this.os=process.platform}return e}(),fa=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}(),ma=function(){function e(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return e}(),ha=function(){function e(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return e}(),$c=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,zc=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,ca=3,qc=[["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",$c]],da=[["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 Jr=Be(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 Ca=jo(),Yc=Ca.__importStar(la()),Pe=Ca.__importStar(qr()),Xc=(wa(),ri(va));function Kr(e){return(0,Xc.detect)(e)}P.detectEnv=Kr;function zo(){let e=Kr();return e&&e.os?e.os:void 0}P.detectOS=zo;function Ea(){let e=zo();return e?e.toLowerCase().includes("android"):!1}P.isAndroid=Ea;function xa(){let e=zo();return e?e.toLowerCase().includes("ios")||e.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}P.isIOS=xa;function Qc(){return zo()?Ea()||xa():!1}P.isMobile=Qc;function _a(){let e=Kr();return e&&e.name?e.name.toLowerCase()==="node":!1}P.isNode=_a;function ed(){return!_a()&&!!(0,P.getNavigator)()}P.isBrowser=ed;P.getFromWindow=Pe.getFromWindow;P.getFromWindowOrThrow=Pe.getFromWindowOrThrow;P.getDocumentOrThrow=Pe.getDocumentOrThrow;P.getDocument=Pe.getDocument;P.getNavigatorOrThrow=Pe.getNavigatorOrThrow;P.getNavigator=Pe.getNavigator;P.getLocationOrThrow=Pe.getLocationOrThrow;P.getLocation=Pe.getLocation;P.getCryptoOrThrow=Pe.getCryptoOrThrow;P.getCrypto=Pe.getCrypto;P.getLocalStorageOrThrow=Pe.getLocalStorageOrThrow;P.getLocalStorage=Pe.getLocalStorage;function td(){return Yc.getWindowMetadata()}P.getClientMeta=td});var Pa={};ti(Pa,{safeJsonParse:()=>od,safeJsonStringify:()=>rd});function od(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 rd(e){return typeof e=="string"?e:JSON.stringify(e)}var Sa=ei(()=>{});var Yr=Be(Dt=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:!0});Dt.safeJsonStringify=Dt.safeJsonParse=void 0;var nd=jo(),La=nd.__importStar((Sa(),ri(Pa)));Dt.safeJsonParse=La.safeJsonParse;Dt.safeJsonStringify=La.safeJsonStringify});var Qr=Be(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.removeLocal=Qe.getLocal=Qe.setLocal=void 0;var Aa=Yr(),Xr=Jr();function id(e,t){let o=(0,Aa.safeJsonStringify)(t),r=(0,Xr.getLocalStorage)();r&&r.setItem(e,o)}Qe.setLocal=id;function ad(e){let t=null,o=null,r=(0,Xr.getLocalStorage)();return r&&(o=r.getItem(e)),t=o&&(0,Aa.safeJsonParse)(o),t}Qe.getLocal=ad;function sd(e){let t=(0,Xr.getLocalStorage)();t&&t.removeItem(e)}Qe.removeLocal=sd});var Ta=Be(fe=>{"use strict";Object.defineProperty(fe,"__esModule",{value:!0});fe.getMobileLinkRegistry=fe.getMobileRegistryEntry=fe.saveMobileLinkInfo=fe.formatIOSMobile=fe.mobileLinkChoiceKey=void 0;var ld=Qr();fe.mobileLinkChoiceKey="WALLETCONNECT_DEEPLINK_CHOICE";function cd(e,t){let o=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${o}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${o}`:""}fe.formatIOSMobile=cd;function dd(e){let t=e.href.split("?")[0];(0,ld.setLocal)(fe.mobileLinkChoiceKey,Object.assign(Object.assign({},e),{href:t}))}fe.saveMobileLinkInfo=dd;function ka(e,t){return e.filter(o=>o.name.toLowerCase().includes(t.toLowerCase()))[0]}fe.getMobileRegistryEntry=ka;function pd(e,t){let o=e;return t&&(o=t.map(r=>ka(e,r)).filter(Boolean)),o}fe.getMobileLinkRegistry=pd});var Ia=Be(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.formatMobileRegistry=We.formatMobileRegistryEntry=We.getDappRegistryUrl=We.getWalletRegistryUrl=void 0;var Wa="https://registry.walletconnect.com";function ud(){return Wa+"/api/v2/wallets"}We.getWalletRegistryUrl=ud;function fd(){return Wa+"/api/v2/dapps"}We.getDappRegistryUrl=fd;function Ra(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||""}}We.formatMobileRegistryEntry=Ra;function md(e,t="mobile"){return Object.values(e).filter(o=>!!o[t].universal||!!o[t].native).map(o=>Ra(o,t))}We.formatMobileRegistry=md});var Ma=Be(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});var ao=jo();ao.__exportStar(Jr(),ht);ao.__exportStar(Yr(),ht);ao.__exportStar(Qr(),ht);ao.__exportStar(Ta(),ht);ao.__exportStar(Ia(),ht)});import{Web3Provider as nu}from"@ethersproject/providers";import{useEffect as Yn,useState as ae}from"react";var x=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import lc from"axios";var Le=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}]`:""}`}},At=class extends Le{constructor(o,r,n,i){super(n,i);this.type=o;this.status=r}},C=class extends Le{constructor(o,r){super(o,r);this.type="client_error"}};var $=class extends Le{constructor(o,r){super(o,r);this.type="connector_error"}},Z=e=>{if(e instanceof Le)return e;if(!lc.isAxiosError(e))return we(e);if(!e.response)return new At("api_error",null,e.message,e);let{type:t,message:o,error:r}=e.response.data;return new At(t||"ApiError",e.response.status,o||r,e)},we=e=>e instanceof Le?e:e instanceof Error?new C(e.message,e):new C(`Internal error: ${e}`);var ni=()=>"/api/v1/sessions",ii=()=>"/api/v1/sessions/logout",ai=()=>"/api/v1/sessions/fork",si=()=>"/api/v1/sessions/fork/recover",li=()=>"/api/v1/siwe/init",ci=()=>"/api/v1/siwe/authenticate",di=()=>"/api/v1/siwe/link",pi=()=>"/api/v1/passwordless/init",ui=()=>"/api/v1/passwordless/authenticate",fi=()=>"/api/v1/passwordless/link",mi=()=>"/api/v1/passwordless_sms/init",hi=()=>"/api/v1/passwordless_sms/authenticate",gi=()=>"/api/v1/passwordless_sms/link",bi=()=>"/api/v1/oauth/init",yi=()=>"/api/v1/oauth/authenticate",vi=()=>"/api/v1/oauth/link",wi=()=>"/api/v1/siwe/unlink",Ci=()=>"/api/v1/passwordless/unlink",Ei=()=>"/api/v1/passwordless_sms/unlink",xi=()=>"/api/v1/oauth/unlink",_i=()=>"/api/v1/analytics_events";var st=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=ui(),o=await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(t){throw Z(t)}}async link(){if(!this.api)throw new 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=fi();return(await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode})).data}catch(t){throw Z(t)}}async sendCodeEmail(t){if(!this.api)throw new 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=pi();return(await this.api.post(o,{email:this.meta.email})).data}catch(o){throw Z(o)}}};var Ye=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=yi(),o=await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(t){throw Z(t)}}async link(){if(!this.api)throw new 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=vi();return(await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode})).data}catch(t){throw Z(t)}}async getAuthorizationUrl(){if(!this.api)throw new 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=bi();return(await this.api.post(t,{provider:this.meta.provider,redirect_to:window.location.href})).data}catch(t){throw Z(t)}}};var Xe=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(ci(),{message:t,signature:o});return this.connectors.addWalletConnector(this.walletConnector),await this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),{user:r.data.user,token:r.data.token,refresh_token:r.data.refresh_token,is_new_user:r.data.is_new_user}}catch(t){throw Z(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(di(),{message:t,signature:o});return this.connectors.addWalletConnector(this.walletConnector),await this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),r.data}catch(t){throw Z(t)}}async promptConnect(){if(!this.api)throw new 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(li(),{address:o});return this.preparedMessage=this.walletConnector.prepareMessage(r,o,n.data.nonce),this.preparedMessage}};var lt=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=hi(),o=await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(t){throw Z(t)}}async link(){if(!this.api)throw new 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=gi();return(await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})).data}catch(t){throw Z(t)}}async sendSmsCode(t){if(!this.api)throw new 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=mi();return(await this.api.post(o,{phoneNumber:this.meta.phoneNumber})).data}catch(o){throw Z(o)}}};import{getAddress as gd}from"@ethersproject/address";var Pi="1.22.0";var ko="4df5e2316331463a9130964bd6078dfa",To="https://auth.privy.io",Si=1e4,Ce=1400,Nr=Pi;var kt="privy:token",Wo="privy:refresh_token",io="privy:session_transfer_token",Ro="privy:connectors",Dr="walletconnect",Li=3e4;var Ur=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)}},Br=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 dc(){return typeof window<"u"&&window.localStorage?new Br:new Ur}var V=dc();import vc from"@coinbase/wallet-sdk";import{getAddress as wc}from"@ethersproject/address";import{jsx as Ai,jsxs as pc}from"react/jsx-runtime";var Ee=({style:e,...t})=>pc("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[Ai("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),Ai("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});import{getAddress as bc}from"@ethersproject/address";import{Web3Provider as yc}from"@ethersproject/providers";import{ErrorCode as uc}from"@ethersproject/logger";var Tt=class extends ${constructor(){super("Wallet timeout");this.type="wallet_error"}},dt=class extends ${constructor(){super("User rejected connection");this.type="wallet_error"}},xe=e=>{if(e instanceof $)return e;if((e==null?void 0:e.code)&&(e==null?void 0:e.reason)){let t=new Wt(e);return e.code===uc.ACTION_REJECTED&&(t.details=ct.E4001_USER_REJECTED_REQUEST),t}return e!=null&&e.code?new Wt(e):new $("Unknown connector error",e)},Fr=class extends Le{constructor(o,r,n){super(o);this.type="provider_error";this.code=r,this.data=n}},Wt=class extends Fr{constructor(o){var i,a,s;let r=o;super(r.message,r.code,r.data);let n=Object.values(ct).find(l=>l.eipCode===r.code);this.details=n||ct.UNKNOWN_ERROR,r.code===-32002&&((i=r.message)!=null&&i.includes("already pending for origin")?(a=r.message)!=null&&a.includes("wallet_requestPermissions")?this.details=ct.E32002_CONNECTION_ALREADY_PENDING:this.details=ct.E32002_REQUEST_ALREADY_PENDING:(s=r.message)!=null&&s.includes("Already processing")&&r.message.includes("eth_requestAccounts")&&(this.details=ct.E32002_WALLET_LOCKED))}},fc={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}},hc={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}},ct={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...hc,...mc},pt={...fc,...ct};var gc=12e4,Gr=(e=new Tt,t=gc)=>new Promise((o,r)=>setTimeout(()=>{r(e)},t)),Ae=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 $(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),Gr()]).catch(o=>{throw xe(o)})}},ut=class extends Ae{constructor(o){super(o)}},Io=class extends Ae{constructor(t){super(t)}sendAsync(t,o){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var ke=class{constructor(t,o,r){this.createSiweMessage=(t,o,r,n,i,a,s)=>`${r} wants you to sign in with your Ethereum account:
|
|
2
2
|
${o}
|
|
3
3
|
|
|
4
4
|
${s}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Ql=Object.create;var zo=Object.defineProperty;var ec=Object.getOwnPropertyDescriptor;var tc=Object.getOwnPropertyNames;var oc=Object.getPrototypeOf,rc=Object.prototype.hasOwnProperty;var hi=(e,t)=>()=>(e&&(t=e(e=0)),t);var ct=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),sn=(e,t)=>{for(var o in t)zo(e,o,{get:t[o],enumerable:!0})},gi=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of tc(t))!rc.call(e,n)&&n!==o&&zo(e,n,{get:()=>t[n],enumerable:!(r=ec(t,n))||r.enumerable});return e};var S=(e,t,o)=>(o=e!=null?Ql(oc(e)):{},gi(t||!e||!e.__esModule?zo(o,"default",{value:e,enumerable:!0}):o,e)),ln=e=>gi(zo({},"__esModule",{value:!0}),e);var dr=ct((g2,cr)=>{var ia,aa,sa,la,ca,da,pa,ua,fa,sr,yn,ma,ha,ga,no,ba,ya,va,wa,Ca,Ea,xa,_a,Pa,lr;(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 cr=="object"&&typeof cr.exports=="object"?e(o(t,o(cr.exports))):e(o(t));function o(r,n){return r!==t&&(typeof Object.create=="function"?Object.defineProperty(r,"__esModule",{value:!0}):r.__esModule=!0),function(i,a){return r[i]=n?n(i,a):a}}})(function(e){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])};ia=function(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(r,n);function i(){this.constructor=r}r.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)},aa=Object.assign||function(r){for(var n,i=1,a=arguments.length;i<a;i++){n=arguments[i];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])}return r},sa=function(r,n){var i={};for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&n.indexOf(a)<0&&(i[a]=r[a]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,a=Object.getOwnPropertySymbols(r);s<a.length;s++)n.indexOf(a[s])<0&&Object.prototype.propertyIsEnumerable.call(r,a[s])&&(i[a[s]]=r[a[s]]);return i},la=function(r,n,i,a){var s=arguments.length,l=s<3?n:a===null?a=Object.getOwnPropertyDescriptor(n,i):a,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(r,n,i,a);else for(var b=r.length-1;b>=0;b--)(c=r[b])&&(l=(s<3?c(l):s>3?c(n,i,l):c(n,i))||l);return s>3&&l&&Object.defineProperty(n,i,l),l},ca=function(r,n){return function(i,a){n(i,a,r)}},da=function(r,n){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,n)},pa=function(r,n,i,a){function s(l){return l instanceof i?l:new i(function(c){c(l)})}return new(i||(i=Promise))(function(l,c){function b(y){try{p(a.next(y))}catch(v){c(v)}}function h(y){try{p(a.throw(y))}catch(v){c(v)}}function p(y){y.done?l(y.value):s(y.value).then(b,h)}p((a=a.apply(r,n||[])).next())})},ua=function(r,n){var i={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},a,s,l,c;return c={next:b(0),throw:b(1),return:b(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function b(p){return function(y){return h([p,y])}}function h(p){if(a)throw new TypeError("Generator is already executing.");for(;i;)try{if(a=1,s&&(l=p[0]&2?s.return:p[0]?s.throw||((l=s.return)&&l.call(s),0):s.next)&&!(l=l.call(s,p[1])).done)return l;switch(s=0,l&&(p=[p[0]&2,l.value]),p[0]){case 0:case 1:l=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,s=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(l=i.trys,!(l=l.length>0&&l[l.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!l||p[1]>l[0]&&p[1]<l[3])){i.label=p[1];break}if(p[0]===6&&i.label<l[1]){i.label=l[1],l=p;break}if(l&&i.label<l[2]){i.label=l[2],i.ops.push(p);break}l[2]&&i.ops.pop(),i.trys.pop();continue}p=n.call(r,i)}catch(y){p=[6,y],s=0}finally{a=l=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},fa=function(r,n){for(var i in r)i!=="default"&&!Object.prototype.hasOwnProperty.call(n,i)&&lr(n,r,i)},lr=Object.create?function(r,n,i,a){a===void 0&&(a=i);var s=Object.getOwnPropertyDescriptor(n,i);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[i]}}),Object.defineProperty(r,a,s)}:function(r,n,i,a){a===void 0&&(a=i),r[a]=n[i]},sr=function(r){var n=typeof Symbol=="function"&&Symbol.iterator,i=n&&r[n],a=0;if(i)return i.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&a>=r.length&&(r=void 0),{value:r&&r[a++],done:!r}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},yn=function(r,n){var i=typeof Symbol=="function"&&r[Symbol.iterator];if(!i)return r;var a=i.call(r),s,l=[],c;try{for(;(n===void 0||n-- >0)&&!(s=a.next()).done;)l.push(s.value)}catch(b){c={error:b}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(c)throw c.error}}return l},ma=function(){for(var r=[],n=0;n<arguments.length;n++)r=r.concat(yn(arguments[n]));return r},ha=function(){for(var r=0,n=0,i=arguments.length;n<i;n++)r+=arguments[n].length;for(var a=Array(r),s=0,n=0;n<i;n++)for(var l=arguments[n],c=0,b=l.length;c<b;c++,s++)a[s]=l[c];return a},ga=function(r,n,i){if(i||arguments.length===2)for(var a=0,s=n.length,l;a<s;a++)(l||!(a in n))&&(l||(l=Array.prototype.slice.call(n,0,a)),l[a]=n[a]);return r.concat(l||Array.prototype.slice.call(n))},no=function(r){return this instanceof no?(this.v=r,this):new no(r)},ba=function(r,n,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var a=i.apply(r,n||[]),s,l=[];return s={},c("next"),c("throw"),c("return"),s[Symbol.asyncIterator]=function(){return this},s;function c(d){a[d]&&(s[d]=function(m){return new Promise(function(E,A){l.push([d,m,E,A])>1||b(d,m)})})}function b(d,m){try{h(a[d](m))}catch(E){v(l[0][3],E)}}function h(d){d.value instanceof no?Promise.resolve(d.value.v).then(p,y):v(l[0][2],d)}function p(d){b("next",d)}function y(d){b("throw",d)}function v(d,m){d(m),l.shift(),l.length&&b(l[0][0],l[0][1])}},ya=function(r){var n,i;return n={},a("next"),a("throw",function(s){throw s}),a("return"),n[Symbol.iterator]=function(){return this},n;function a(s,l){n[s]=r[s]?function(c){return(i=!i)?{value:no(r[s](c)),done:s==="return"}:l?l(c):c}:l}},va=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r[Symbol.asyncIterator],i;return n?n.call(r):(r=typeof sr=="function"?sr(r):r[Symbol.iterator](),i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i);function a(l){i[l]=r[l]&&function(c){return new Promise(function(b,h){c=r[l](c),s(b,h,c.done,c.value)})}}function s(l,c,b,h){Promise.resolve(h).then(function(p){l({value:p,done:b})},c)}},wa=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};Ca=function(r){if(r&&r.__esModule)return r;var n={};if(r!=null)for(var i in r)i!=="default"&&Object.prototype.hasOwnProperty.call(r,i)&&lr(n,r,i);return o(n,r),n},Ea=function(r){return r&&r.__esModule?r:{default:r}},xa=function(r,n,i,a){if(i==="a"&&!a)throw new TypeError("Private accessor was defined without a getter");if(typeof n=="function"?r!==n||!a:!n.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?a:i==="a"?a.call(r):a?a.value:n.get(r)},_a=function(r,n,i,a,s){if(a==="m")throw new TypeError("Private method is not writable");if(a==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof n=="function"?r!==n||!s:!n.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return a==="a"?s.call(r,i):s?s.value=i:n.set(r,i),i},Pa=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",ia),e("__assign",aa),e("__rest",sa),e("__decorate",la),e("__param",ca),e("__metadata",da),e("__awaiter",pa),e("__generator",ua),e("__exportStar",fa),e("__createBinding",lr),e("__values",sr),e("__read",yn),e("__spread",ma),e("__spreadArrays",ha),e("__spreadArray",ga),e("__await",no),e("__asyncGenerator",ba),e("__asyncDelegator",ya),e("__asyncValues",va),e("__makeTemplateObject",wa),e("__importStar",Ca),e("__importDefault",Ea),e("__classPrivateFieldGet",xa),e("__classPrivateFieldSet",_a),e("__classPrivateFieldIn",Pa)})});var vn=ct(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});G.getLocalStorage=G.getLocalStorageOrThrow=G.getCrypto=G.getCryptoOrThrow=G.getLocation=G.getLocationOrThrow=G.getNavigator=G.getNavigatorOrThrow=G.getDocument=G.getDocumentOrThrow=G.getFromWindowOrThrow=G.getFromWindow=void 0;function Ht(e){let t;return typeof window<"u"&&typeof window[e]<"u"&&(t=window[e]),t}G.getFromWindow=Ht;function io(e){let t=Ht(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}G.getFromWindowOrThrow=io;function uc(){return io("document")}G.getDocumentOrThrow=uc;function fc(){return Ht("document")}G.getDocument=fc;function mc(){return io("navigator")}G.getNavigatorOrThrow=mc;function hc(){return Ht("navigator")}G.getNavigator=hc;function gc(){return io("location")}G.getLocationOrThrow=gc;function bc(){return Ht("location")}G.getLocation=bc;function yc(){return io("crypto")}G.getCryptoOrThrow=yc;function vc(){return Ht("crypto")}G.getCrypto=vc;function wc(){return io("localStorage")}G.getLocalStorageOrThrow=wc;function Cc(){return Ht("localStorage")}G.getLocalStorage=Cc});var La=ct(pr=>{"use strict";Object.defineProperty(pr,"__esModule",{value:!0});pr.getWindowMetadata=void 0;var Sa=vn();function Ec(){let e,t;try{e=Sa.getDocumentOrThrow(),t=Sa.getLocationOrThrow()}catch{return null}function o(){let h=e.getElementsByTagName("link"),p=[];for(let y=0;y<h.length;y++){let v=h[y],d=v.getAttribute("rel");if(d&&d.toLowerCase().indexOf("icon")>-1){let m=v.getAttribute("href");if(m)if(m.toLowerCase().indexOf("https:")===-1&&m.toLowerCase().indexOf("http:")===-1&&m.indexOf("//")!==0){let E=t.protocol+"//"+t.host;if(m.indexOf("/")===0)E+=m;else{let A=t.pathname.split("/");A.pop(),E+=A.join("/")+"/"+m}p.push(E)}else if(m.indexOf("//")===0){let E=t.protocol+m;p.push(E)}else p.push(m)}}return p}function r(...h){let p=e.getElementsByTagName("meta");for(let y=0;y<p.length;y++){let v=p[y],d=["itemprop","property","name"].map(m=>v.getAttribute(m)).filter(m=>m?h.includes(m):!1);if(d.length&&d){let m=v.getAttribute("content");if(m)return m}}return""}function n(){let h=r("name","og:site_name","og:title","twitter:title");return h||(h=e.title),h}function i(){return r("description","og:description","twitter:description","keywords")}let a=n(),s=i(),l=t.origin,c=o();return{description:s,url:l,icons:c,name:a}}pr.getWindowMetadata=Ec});var Ua={};sn(Ua,{BotInfo:()=>Ia,BrowserInfo:()=>Ta,NodeInfo:()=>Wa,ReactNativeInfo:()=>Ma,SearchBotDeviceInfo:()=>Ra,browserName:()=>Ac,detect:()=>Lc,detectOS:()=>Na,getNodeVersion:()=>Da,parseUserAgent:()=>wn});function Lc(e){return e?wn(e):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Ma:typeof navigator<"u"?wn(navigator.userAgent):Da()}function Oa(e){return e!==""&&Sc.reduce(function(t,o){var r=o[0],n=o[1];if(t)return t;var i=n.exec(e);return!!i&&[r,i]},!1)}function Ac(e){var t=Oa(e);return t?t[0]:null}function wn(e){var t=Oa(e);if(!t)return null;var o=t[0],r=t[1];if(o==="searchbot")return new Ia;var n=r[1]&&r[1].split(/[._]/).slice(0,3);n?n.length<Aa&&(n=xc(n,kc(Aa-n.length))):n=[];var i=n.join("."),a=Na(e),s=Pc.exec(e);return s&&s[1]?new Ra(o,i,a,s[1]):new Ta(o,i,a)}function Na(e){for(var t=0,o=ka.length;t<o;t++){var r=ka[t],n=r[0],i=r[1],a=i.exec(e);if(a)return n}return null}function Da(){var e=typeof process<"u"&&process.version;return e?new Wa(process.version.slice(1)):null}function kc(e){for(var t=[],o=0;o<e;o++)t.push("0");return t}var xc,Ta,Wa,Ra,Ia,Ma,_c,Pc,Aa,Sc,ka,Ba=hi(()=>{xc=function(){for(var e=0,t=0,o=arguments.length;t<o;t++)e+=arguments[t].length;for(var r=Array(e),n=0,t=0;t<o;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,n++)r[n]=i[a];return r},Ta=function(){function e(t,o,r){this.name=t,this.version=o,this.os=r,this.type="browser"}return e}(),Wa=function(){function e(t){this.version=t,this.type="node",this.name="node",this.os=process.platform}return e}(),Ra=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}(),Ia=function(){function e(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return e}(),Ma=function(){function e(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return e}(),_c=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,Pc=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Aa=3,Sc=[["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",_c]],ka=[["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 En=ct(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.getClientMeta=L.getLocalStorage=L.getLocalStorageOrThrow=L.getCrypto=L.getCryptoOrThrow=L.getLocation=L.getLocationOrThrow=L.getNavigator=L.getNavigatorOrThrow=L.getDocument=L.getDocumentOrThrow=L.getFromWindowOrThrow=L.getFromWindow=L.isBrowser=L.isNode=L.isMobile=L.isIOS=L.isAndroid=L.detectOS=L.detectEnv=void 0;var Fa=dr(),Tc=Fa.__importStar(La()),Ve=Fa.__importStar(vn()),Wc=(Ba(),ln(Ua));function Cn(e){return(0,Wc.detect)(e)}L.detectEnv=Cn;function ur(){let e=Cn();return e&&e.os?e.os:void 0}L.detectOS=ur;function Ga(){let e=ur();return e?e.toLowerCase().includes("android"):!1}L.isAndroid=Ga;function Ha(){let e=ur();return e?e.toLowerCase().includes("ios")||e.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}L.isIOS=Ha;function Rc(){return ur()?Ga()||Ha():!1}L.isMobile=Rc;function Va(){let e=Cn();return e&&e.name?e.name.toLowerCase()==="node":!1}L.isNode=Va;function Ic(){return!Va()&&!!(0,L.getNavigator)()}L.isBrowser=Ic;L.getFromWindow=Ve.getFromWindow;L.getFromWindowOrThrow=Ve.getFromWindowOrThrow;L.getDocumentOrThrow=Ve.getDocumentOrThrow;L.getDocument=Ve.getDocument;L.getNavigatorOrThrow=Ve.getNavigatorOrThrow;L.getNavigator=Ve.getNavigator;L.getLocationOrThrow=Ve.getLocationOrThrow;L.getLocation=Ve.getLocation;L.getCryptoOrThrow=Ve.getCryptoOrThrow;L.getCrypto=Ve.getCrypto;L.getLocalStorageOrThrow=Ve.getLocalStorageOrThrow;L.getLocalStorage=Ve.getLocalStorage;function Mc(){return Tc.getWindowMetadata()}L.getClientMeta=Mc});var ja={};sn(ja,{safeJsonParse:()=>Oc,safeJsonStringify:()=>Nc});function Oc(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 Nc(e){return typeof e=="string"?e:JSON.stringify(e)}var $a=hi(()=>{});var xn=ct(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.safeJsonStringify=ao.safeJsonParse=void 0;var Dc=dr(),za=Dc.__importStar(($a(),ln(ja)));ao.safeJsonParse=za.safeJsonParse;ao.safeJsonStringify=za.safeJsonStringify});var Pn=ct(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.removeLocal=_t.getLocal=_t.setLocal=void 0;var qa=xn(),_n=En();function Uc(e,t){let o=(0,qa.safeJsonStringify)(t),r=(0,_n.getLocalStorage)();r&&r.setItem(e,o)}_t.setLocal=Uc;function Bc(e){let t=null,o=null,r=(0,_n.getLocalStorage)();return r&&(o=r.getItem(e)),t=o&&(0,qa.safeJsonParse)(o),t}_t.getLocal=Bc;function Fc(e){let t=(0,_n.getLocalStorage)();t&&t.removeItem(e)}_t.removeLocal=Fc});var Ka=ct(xe=>{"use strict";Object.defineProperty(xe,"__esModule",{value:!0});xe.getMobileLinkRegistry=xe.getMobileRegistryEntry=xe.saveMobileLinkInfo=xe.formatIOSMobile=xe.mobileLinkChoiceKey=void 0;var Gc=Pn();xe.mobileLinkChoiceKey="WALLETCONNECT_DEEPLINK_CHOICE";function Hc(e,t){let o=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${o}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${o}`:""}xe.formatIOSMobile=Hc;function Vc(e){let t=e.href.split("?")[0];(0,Gc.setLocal)(xe.mobileLinkChoiceKey,Object.assign(Object.assign({},e),{href:t}))}xe.saveMobileLinkInfo=Vc;function Za(e,t){return e.filter(o=>o.name.toLowerCase().includes(t.toLowerCase()))[0]}xe.getMobileRegistryEntry=Za;function jc(e,t){let o=e;return t&&(o=t.map(r=>Za(e,r)).filter(Boolean)),o}xe.getMobileLinkRegistry=jc});var Xa=ct(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.formatMobileRegistry=tt.formatMobileRegistryEntry=tt.getDappRegistryUrl=tt.getWalletRegistryUrl=void 0;var Ja="https://registry.walletconnect.com";function $c(){return Ja+"/api/v2/wallets"}tt.getWalletRegistryUrl=$c;function zc(){return Ja+"/api/v2/dapps"}tt.getDappRegistryUrl=zc;function Ya(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||""}}tt.formatMobileRegistryEntry=Ya;function qc(e,t="mobile"){return Object.values(e).filter(o=>!!o[t].universal||!!o[t].native).map(o=>Ya(o,t))}tt.formatMobileRegistry=qc});var Qa=ct(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});var Ao=dr();Ao.__exportStar(En(),Vt);Ao.__exportStar(xn(),Vt);Ao.__exportStar(Pn(),Vt);Ao.__exportStar(Ka(),Vt);Ao.__exportStar(Xa(),Vt)});var pp={};sn(pp,{AsExternalProvider:()=>xt,ConnectorManager:()=>so,PrivyClient:()=>co,PrivyProvider:()=>Zl,PrivyProxyProvider:()=>Be,VERSION:()=>Ko,WalletConnector:()=>Fe,getAccessToken:()=>ql,usePrivy:()=>U});module.exports=ln(pp);var zl=require("@ethersproject/providers"),re=require("react");var _=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};var bi=S(require("axios")),Ze=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}]`:""}`}},Qt=class extends Ze{constructor(o,r,n,i){super(n,i);this.type=o;this.status=r}},x=class extends Ze{constructor(o,r){super(o,r);this.type="client_error"}};var Y=class extends Ze{constructor(o,r){super(o,r);this.type="connector_error"}},ne=e=>{if(e instanceof Ze)return e;if(!bi.default.isAxiosError(e))return Oe(e);if(!e.response)return new Qt("api_error",null,e.message,e);let{type:t,message:o,error:r}=e.response.data;return new Qt(t||"ApiError",e.response.status,o||r,e)},Oe=e=>e instanceof Ze?e:e instanceof Error?new x(e.message,e):new x(`Internal error: ${e}`);var yi=()=>"/api/v1/sessions",vi=()=>"/api/v1/sessions/logout",wi=()=>"/api/v1/sessions/fork",Ci=()=>"/api/v1/sessions/fork/recover",Ei=()=>"/api/v1/siwe/init",xi=()=>"/api/v1/siwe/authenticate",_i=()=>"/api/v1/siwe/link",Pi=()=>"/api/v1/passwordless/init",Si=()=>"/api/v1/passwordless/authenticate",Li=()=>"/api/v1/passwordless/link",Ai=()=>"/api/v1/passwordless_sms/init",ki=()=>"/api/v1/passwordless_sms/authenticate",Ti=()=>"/api/v1/passwordless_sms/link",Wi=()=>"/api/v1/oauth/init",Ri=()=>"/api/v1/oauth/authenticate",Ii=()=>"/api/v1/oauth/link",Mi=()=>"/api/v1/siwe/unlink",Oi=()=>"/api/v1/passwordless/unlink",Ni=()=>"/api/v1/passwordless_sms/unlink",Di=()=>"/api/v1/oauth/unlink",Ui=()=>"/api/v1/analytics_events";var Nt=class{constructor(t){this.meta={email:t}}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new x("Email and email code must be set prior to calling authenticate.");try{let t=Si(),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 ne(t)}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new x("Email and email code must be set prior to calling authenticate.");try{let t=Li();return(await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode})).data}catch(t){throw ne(t)}}async sendCodeEmail(t){if(!this.api)throw new x("Auth flow has no API instance");if(t&&(this.meta.email=t),!this.meta.email)throw new x("Email must be set when initialzing authentication.");try{let o=Pi();return(await this.api.post(o,{email:this.meta.email})).data}catch(o){throw ne(o)}}};var Ct=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 x("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new x("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new x("User denied confirmation during OAuth flow");try{let t=Ri(),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 ne(t)}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new x("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new x("User denied confirmation during OAuth flow");try{let t=Ii();return(await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode})).data}catch(t){throw ne(t)}}async getAuthorizationUrl(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.provider)throw new x("Provider must be set when initialzing OAuth authentication.");try{let t=Wi();return(await this.api.post(t,{provider:this.meta.provider,redirect_to:window.location.href})).data}catch(t){throw ne(t)}}};var Et=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 x("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(xi(),{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 ne(t)}}async link(){if(!this.api)throw new x("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(_i(),{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 ne(t)}}async promptConnect(){if(!this.api)throw new x("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 x("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 x("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 x("Auth flow has no API instance");let o=t.address,r=t.chainId,n=await this.api.post(Ei(),{address:o});return this.preparedMessage=this.walletConnector.prepareMessage(r,o,n.data.nonce),this.preparedMessage}};var Dt=class{constructor(t){this.meta={phoneNumber:t}}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new x("phone number and sms code must be set prior to calling authenticate.");try{let t=ki(),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 ne(t)}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new x("phone number and sms code must be set prior to calling authenticate.");try{let t=Ti();return(await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})).data}catch(t){throw ne(t)}}async sendSmsCode(t){if(!this.api)throw new x("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),!this.meta.phoneNumber)throw new x("phone nNumber must be set when initialzing authentication.");try{let o=Ai();return(await this.api.post(o,{phoneNumber:this.meta.phoneNumber})).data}catch(o){throw ne(o)}}};var as=require("@ethersproject/address");var Bi="1.22.0-beta.6";var qo="4df5e2316331463a9130964bd6078dfa",Zo="https://auth.privy.io",Fi=1e4,Ne=1400,Ko=Bi;var eo="privy:token",Jo="privy:refresh_token",So="privy:session_transfer_token",Yo="privy:connectors",cn="walletconnect",Gi=3e4;var dn=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 ic(){return typeof window<"u"&&window.localStorage?new pn:new dn}var K=ic();var $i=S(require("@coinbase/wallet-sdk")),zi=require("@ethersproject/address");var Lo=require("react/jsx-runtime"),De=({style:e,...t})=>(0,Lo.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,Lo.jsx)("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),(0,Lo.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 Vi=require("@ethersproject/address"),ji=require("@ethersproject/providers");var Hi=require("@ethersproject/logger");var to=class extends Y{constructor(){super("Wallet timeout");this.type="wallet_error"}},Bt=class extends Y{constructor(){super("User rejected connection");this.type="wallet_error"}},Ue=e=>{if(e instanceof Y)return e;if((e==null?void 0:e.code)&&(e==null?void 0:e.reason)){let t=new oo(e);return e.code===Hi.ErrorCode.ACTION_REJECTED&&(t.details=Ut.E4001_USER_REJECTED_REQUEST),t}return e!=null&&e.code?new oo(e):new Y("Unknown connector error",e)},un=class extends Ze{constructor(o,r,n){super(o);this.type="provider_error";this.code=r,this.data=n}},oo=class extends un{constructor(o){var i,a,s;let r=o;super(r.message,r.code,r.data);let n=Object.values(Ut).find(l=>l.eipCode===r.code);this.details=n||Ut.UNKNOWN_ERROR,r.code===-32002&&((i=r.message)!=null&&i.includes("already pending for origin")?(a=r.message)!=null&&a.includes("wallet_requestPermissions")?this.details=Ut.E32002_CONNECTION_ALREADY_PENDING:this.details=Ut.E32002_REQUEST_ALREADY_PENDING:(s=r.message)!=null&&s.includes("Already processing")&&r.message.includes("eth_requestAccounts")&&(this.details=Ut.E32002_WALLET_LOCKED))}},ac={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}},sc={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}},lc={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}},Ut={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...lc,...sc},Ft={...ac,...Ut};var cc=12e4,fn=(e=new to,t=cc)=>new Promise((o,r)=>setTimeout(()=>{r(e)},t)),Be=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 Y(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),fn()]).catch(o=>{throw Ue(o)})}},xt=class extends Be{constructor(o){super(o)}},Xo=class extends Be{constructor(t){super(t)}sendAsync(t,o){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var Fe=class{constructor(t,o,r){this.createSiweMessage=(t,o,r,n,i,a,s)=>`${r} wants you to sign in with your Ethereum account:
|
|
1
|
+
"use strict";var Ql=Object.create;var zo=Object.defineProperty;var ec=Object.getOwnPropertyDescriptor;var tc=Object.getOwnPropertyNames;var oc=Object.getPrototypeOf,rc=Object.prototype.hasOwnProperty;var hi=(e,t)=>()=>(e&&(t=e(e=0)),t);var ct=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),sn=(e,t)=>{for(var o in t)zo(e,o,{get:t[o],enumerable:!0})},gi=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of tc(t))!rc.call(e,n)&&n!==o&&zo(e,n,{get:()=>t[n],enumerable:!(r=ec(t,n))||r.enumerable});return e};var S=(e,t,o)=>(o=e!=null?Ql(oc(e)):{},gi(t||!e||!e.__esModule?zo(o,"default",{value:e,enumerable:!0}):o,e)),ln=e=>gi(zo({},"__esModule",{value:!0}),e);var dr=ct((g2,cr)=>{var ia,aa,sa,la,ca,da,pa,ua,fa,sr,yn,ma,ha,ga,no,ba,ya,va,wa,Ca,Ea,xa,_a,Pa,lr;(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 cr=="object"&&typeof cr.exports=="object"?e(o(t,o(cr.exports))):e(o(t));function o(r,n){return r!==t&&(typeof Object.create=="function"?Object.defineProperty(r,"__esModule",{value:!0}):r.__esModule=!0),function(i,a){return r[i]=n?n(i,a):a}}})(function(e){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])};ia=function(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(r,n);function i(){this.constructor=r}r.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)},aa=Object.assign||function(r){for(var n,i=1,a=arguments.length;i<a;i++){n=arguments[i];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])}return r},sa=function(r,n){var i={};for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&n.indexOf(a)<0&&(i[a]=r[a]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,a=Object.getOwnPropertySymbols(r);s<a.length;s++)n.indexOf(a[s])<0&&Object.prototype.propertyIsEnumerable.call(r,a[s])&&(i[a[s]]=r[a[s]]);return i},la=function(r,n,i,a){var s=arguments.length,l=s<3?n:a===null?a=Object.getOwnPropertyDescriptor(n,i):a,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(r,n,i,a);else for(var b=r.length-1;b>=0;b--)(c=r[b])&&(l=(s<3?c(l):s>3?c(n,i,l):c(n,i))||l);return s>3&&l&&Object.defineProperty(n,i,l),l},ca=function(r,n){return function(i,a){n(i,a,r)}},da=function(r,n){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,n)},pa=function(r,n,i,a){function s(l){return l instanceof i?l:new i(function(c){c(l)})}return new(i||(i=Promise))(function(l,c){function b(y){try{p(a.next(y))}catch(v){c(v)}}function h(y){try{p(a.throw(y))}catch(v){c(v)}}function p(y){y.done?l(y.value):s(y.value).then(b,h)}p((a=a.apply(r,n||[])).next())})},ua=function(r,n){var i={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},a,s,l,c;return c={next:b(0),throw:b(1),return:b(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function b(p){return function(y){return h([p,y])}}function h(p){if(a)throw new TypeError("Generator is already executing.");for(;i;)try{if(a=1,s&&(l=p[0]&2?s.return:p[0]?s.throw||((l=s.return)&&l.call(s),0):s.next)&&!(l=l.call(s,p[1])).done)return l;switch(s=0,l&&(p=[p[0]&2,l.value]),p[0]){case 0:case 1:l=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,s=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(l=i.trys,!(l=l.length>0&&l[l.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!l||p[1]>l[0]&&p[1]<l[3])){i.label=p[1];break}if(p[0]===6&&i.label<l[1]){i.label=l[1],l=p;break}if(l&&i.label<l[2]){i.label=l[2],i.ops.push(p);break}l[2]&&i.ops.pop(),i.trys.pop();continue}p=n.call(r,i)}catch(y){p=[6,y],s=0}finally{a=l=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},fa=function(r,n){for(var i in r)i!=="default"&&!Object.prototype.hasOwnProperty.call(n,i)&&lr(n,r,i)},lr=Object.create?function(r,n,i,a){a===void 0&&(a=i);var s=Object.getOwnPropertyDescriptor(n,i);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[i]}}),Object.defineProperty(r,a,s)}:function(r,n,i,a){a===void 0&&(a=i),r[a]=n[i]},sr=function(r){var n=typeof Symbol=="function"&&Symbol.iterator,i=n&&r[n],a=0;if(i)return i.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&a>=r.length&&(r=void 0),{value:r&&r[a++],done:!r}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},yn=function(r,n){var i=typeof Symbol=="function"&&r[Symbol.iterator];if(!i)return r;var a=i.call(r),s,l=[],c;try{for(;(n===void 0||n-- >0)&&!(s=a.next()).done;)l.push(s.value)}catch(b){c={error:b}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(c)throw c.error}}return l},ma=function(){for(var r=[],n=0;n<arguments.length;n++)r=r.concat(yn(arguments[n]));return r},ha=function(){for(var r=0,n=0,i=arguments.length;n<i;n++)r+=arguments[n].length;for(var a=Array(r),s=0,n=0;n<i;n++)for(var l=arguments[n],c=0,b=l.length;c<b;c++,s++)a[s]=l[c];return a},ga=function(r,n,i){if(i||arguments.length===2)for(var a=0,s=n.length,l;a<s;a++)(l||!(a in n))&&(l||(l=Array.prototype.slice.call(n,0,a)),l[a]=n[a]);return r.concat(l||Array.prototype.slice.call(n))},no=function(r){return this instanceof no?(this.v=r,this):new no(r)},ba=function(r,n,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var a=i.apply(r,n||[]),s,l=[];return s={},c("next"),c("throw"),c("return"),s[Symbol.asyncIterator]=function(){return this},s;function c(d){a[d]&&(s[d]=function(m){return new Promise(function(E,A){l.push([d,m,E,A])>1||b(d,m)})})}function b(d,m){try{h(a[d](m))}catch(E){v(l[0][3],E)}}function h(d){d.value instanceof no?Promise.resolve(d.value.v).then(p,y):v(l[0][2],d)}function p(d){b("next",d)}function y(d){b("throw",d)}function v(d,m){d(m),l.shift(),l.length&&b(l[0][0],l[0][1])}},ya=function(r){var n,i;return n={},a("next"),a("throw",function(s){throw s}),a("return"),n[Symbol.iterator]=function(){return this},n;function a(s,l){n[s]=r[s]?function(c){return(i=!i)?{value:no(r[s](c)),done:s==="return"}:l?l(c):c}:l}},va=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r[Symbol.asyncIterator],i;return n?n.call(r):(r=typeof sr=="function"?sr(r):r[Symbol.iterator](),i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i);function a(l){i[l]=r[l]&&function(c){return new Promise(function(b,h){c=r[l](c),s(b,h,c.done,c.value)})}}function s(l,c,b,h){Promise.resolve(h).then(function(p){l({value:p,done:b})},c)}},wa=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};Ca=function(r){if(r&&r.__esModule)return r;var n={};if(r!=null)for(var i in r)i!=="default"&&Object.prototype.hasOwnProperty.call(r,i)&&lr(n,r,i);return o(n,r),n},Ea=function(r){return r&&r.__esModule?r:{default:r}},xa=function(r,n,i,a){if(i==="a"&&!a)throw new TypeError("Private accessor was defined without a getter");if(typeof n=="function"?r!==n||!a:!n.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?a:i==="a"?a.call(r):a?a.value:n.get(r)},_a=function(r,n,i,a,s){if(a==="m")throw new TypeError("Private method is not writable");if(a==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof n=="function"?r!==n||!s:!n.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return a==="a"?s.call(r,i):s?s.value=i:n.set(r,i),i},Pa=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",ia),e("__assign",aa),e("__rest",sa),e("__decorate",la),e("__param",ca),e("__metadata",da),e("__awaiter",pa),e("__generator",ua),e("__exportStar",fa),e("__createBinding",lr),e("__values",sr),e("__read",yn),e("__spread",ma),e("__spreadArrays",ha),e("__spreadArray",ga),e("__await",no),e("__asyncGenerator",ba),e("__asyncDelegator",ya),e("__asyncValues",va),e("__makeTemplateObject",wa),e("__importStar",Ca),e("__importDefault",Ea),e("__classPrivateFieldGet",xa),e("__classPrivateFieldSet",_a),e("__classPrivateFieldIn",Pa)})});var vn=ct(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});G.getLocalStorage=G.getLocalStorageOrThrow=G.getCrypto=G.getCryptoOrThrow=G.getLocation=G.getLocationOrThrow=G.getNavigator=G.getNavigatorOrThrow=G.getDocument=G.getDocumentOrThrow=G.getFromWindowOrThrow=G.getFromWindow=void 0;function Ht(e){let t;return typeof window<"u"&&typeof window[e]<"u"&&(t=window[e]),t}G.getFromWindow=Ht;function io(e){let t=Ht(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}G.getFromWindowOrThrow=io;function uc(){return io("document")}G.getDocumentOrThrow=uc;function fc(){return Ht("document")}G.getDocument=fc;function mc(){return io("navigator")}G.getNavigatorOrThrow=mc;function hc(){return Ht("navigator")}G.getNavigator=hc;function gc(){return io("location")}G.getLocationOrThrow=gc;function bc(){return Ht("location")}G.getLocation=bc;function yc(){return io("crypto")}G.getCryptoOrThrow=yc;function vc(){return Ht("crypto")}G.getCrypto=vc;function wc(){return io("localStorage")}G.getLocalStorageOrThrow=wc;function Cc(){return Ht("localStorage")}G.getLocalStorage=Cc});var La=ct(pr=>{"use strict";Object.defineProperty(pr,"__esModule",{value:!0});pr.getWindowMetadata=void 0;var Sa=vn();function Ec(){let e,t;try{e=Sa.getDocumentOrThrow(),t=Sa.getLocationOrThrow()}catch{return null}function o(){let h=e.getElementsByTagName("link"),p=[];for(let y=0;y<h.length;y++){let v=h[y],d=v.getAttribute("rel");if(d&&d.toLowerCase().indexOf("icon")>-1){let m=v.getAttribute("href");if(m)if(m.toLowerCase().indexOf("https:")===-1&&m.toLowerCase().indexOf("http:")===-1&&m.indexOf("//")!==0){let E=t.protocol+"//"+t.host;if(m.indexOf("/")===0)E+=m;else{let A=t.pathname.split("/");A.pop(),E+=A.join("/")+"/"+m}p.push(E)}else if(m.indexOf("//")===0){let E=t.protocol+m;p.push(E)}else p.push(m)}}return p}function r(...h){let p=e.getElementsByTagName("meta");for(let y=0;y<p.length;y++){let v=p[y],d=["itemprop","property","name"].map(m=>v.getAttribute(m)).filter(m=>m?h.includes(m):!1);if(d.length&&d){let m=v.getAttribute("content");if(m)return m}}return""}function n(){let h=r("name","og:site_name","og:title","twitter:title");return h||(h=e.title),h}function i(){return r("description","og:description","twitter:description","keywords")}let a=n(),s=i(),l=t.origin,c=o();return{description:s,url:l,icons:c,name:a}}pr.getWindowMetadata=Ec});var Ua={};sn(Ua,{BotInfo:()=>Ia,BrowserInfo:()=>Ta,NodeInfo:()=>Wa,ReactNativeInfo:()=>Ma,SearchBotDeviceInfo:()=>Ra,browserName:()=>Ac,detect:()=>Lc,detectOS:()=>Na,getNodeVersion:()=>Da,parseUserAgent:()=>wn});function Lc(e){return e?wn(e):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Ma:typeof navigator<"u"?wn(navigator.userAgent):Da()}function Oa(e){return e!==""&&Sc.reduce(function(t,o){var r=o[0],n=o[1];if(t)return t;var i=n.exec(e);return!!i&&[r,i]},!1)}function Ac(e){var t=Oa(e);return t?t[0]:null}function wn(e){var t=Oa(e);if(!t)return null;var o=t[0],r=t[1];if(o==="searchbot")return new Ia;var n=r[1]&&r[1].split(/[._]/).slice(0,3);n?n.length<Aa&&(n=xc(n,kc(Aa-n.length))):n=[];var i=n.join("."),a=Na(e),s=Pc.exec(e);return s&&s[1]?new Ra(o,i,a,s[1]):new Ta(o,i,a)}function Na(e){for(var t=0,o=ka.length;t<o;t++){var r=ka[t],n=r[0],i=r[1],a=i.exec(e);if(a)return n}return null}function Da(){var e=typeof process<"u"&&process.version;return e?new Wa(process.version.slice(1)):null}function kc(e){for(var t=[],o=0;o<e;o++)t.push("0");return t}var xc,Ta,Wa,Ra,Ia,Ma,_c,Pc,Aa,Sc,ka,Ba=hi(()=>{xc=function(){for(var e=0,t=0,o=arguments.length;t<o;t++)e+=arguments[t].length;for(var r=Array(e),n=0,t=0;t<o;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,n++)r[n]=i[a];return r},Ta=function(){function e(t,o,r){this.name=t,this.version=o,this.os=r,this.type="browser"}return e}(),Wa=function(){function e(t){this.version=t,this.type="node",this.name="node",this.os=process.platform}return e}(),Ra=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}(),Ia=function(){function e(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return e}(),Ma=function(){function e(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return e}(),_c=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,Pc=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Aa=3,Sc=[["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",_c]],ka=[["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 En=ct(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.getClientMeta=L.getLocalStorage=L.getLocalStorageOrThrow=L.getCrypto=L.getCryptoOrThrow=L.getLocation=L.getLocationOrThrow=L.getNavigator=L.getNavigatorOrThrow=L.getDocument=L.getDocumentOrThrow=L.getFromWindowOrThrow=L.getFromWindow=L.isBrowser=L.isNode=L.isMobile=L.isIOS=L.isAndroid=L.detectOS=L.detectEnv=void 0;var Fa=dr(),Tc=Fa.__importStar(La()),Ve=Fa.__importStar(vn()),Wc=(Ba(),ln(Ua));function Cn(e){return(0,Wc.detect)(e)}L.detectEnv=Cn;function ur(){let e=Cn();return e&&e.os?e.os:void 0}L.detectOS=ur;function Ga(){let e=ur();return e?e.toLowerCase().includes("android"):!1}L.isAndroid=Ga;function Ha(){let e=ur();return e?e.toLowerCase().includes("ios")||e.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}L.isIOS=Ha;function Rc(){return ur()?Ga()||Ha():!1}L.isMobile=Rc;function Va(){let e=Cn();return e&&e.name?e.name.toLowerCase()==="node":!1}L.isNode=Va;function Ic(){return!Va()&&!!(0,L.getNavigator)()}L.isBrowser=Ic;L.getFromWindow=Ve.getFromWindow;L.getFromWindowOrThrow=Ve.getFromWindowOrThrow;L.getDocumentOrThrow=Ve.getDocumentOrThrow;L.getDocument=Ve.getDocument;L.getNavigatorOrThrow=Ve.getNavigatorOrThrow;L.getNavigator=Ve.getNavigator;L.getLocationOrThrow=Ve.getLocationOrThrow;L.getLocation=Ve.getLocation;L.getCryptoOrThrow=Ve.getCryptoOrThrow;L.getCrypto=Ve.getCrypto;L.getLocalStorageOrThrow=Ve.getLocalStorageOrThrow;L.getLocalStorage=Ve.getLocalStorage;function Mc(){return Tc.getWindowMetadata()}L.getClientMeta=Mc});var ja={};sn(ja,{safeJsonParse:()=>Oc,safeJsonStringify:()=>Nc});function Oc(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 Nc(e){return typeof e=="string"?e:JSON.stringify(e)}var $a=hi(()=>{});var xn=ct(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.safeJsonStringify=ao.safeJsonParse=void 0;var Dc=dr(),za=Dc.__importStar(($a(),ln(ja)));ao.safeJsonParse=za.safeJsonParse;ao.safeJsonStringify=za.safeJsonStringify});var Pn=ct(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.removeLocal=_t.getLocal=_t.setLocal=void 0;var qa=xn(),_n=En();function Uc(e,t){let o=(0,qa.safeJsonStringify)(t),r=(0,_n.getLocalStorage)();r&&r.setItem(e,o)}_t.setLocal=Uc;function Bc(e){let t=null,o=null,r=(0,_n.getLocalStorage)();return r&&(o=r.getItem(e)),t=o&&(0,qa.safeJsonParse)(o),t}_t.getLocal=Bc;function Fc(e){let t=(0,_n.getLocalStorage)();t&&t.removeItem(e)}_t.removeLocal=Fc});var Ka=ct(xe=>{"use strict";Object.defineProperty(xe,"__esModule",{value:!0});xe.getMobileLinkRegistry=xe.getMobileRegistryEntry=xe.saveMobileLinkInfo=xe.formatIOSMobile=xe.mobileLinkChoiceKey=void 0;var Gc=Pn();xe.mobileLinkChoiceKey="WALLETCONNECT_DEEPLINK_CHOICE";function Hc(e,t){let o=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${o}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${o}`:""}xe.formatIOSMobile=Hc;function Vc(e){let t=e.href.split("?")[0];(0,Gc.setLocal)(xe.mobileLinkChoiceKey,Object.assign(Object.assign({},e),{href:t}))}xe.saveMobileLinkInfo=Vc;function Za(e,t){return e.filter(o=>o.name.toLowerCase().includes(t.toLowerCase()))[0]}xe.getMobileRegistryEntry=Za;function jc(e,t){let o=e;return t&&(o=t.map(r=>Za(e,r)).filter(Boolean)),o}xe.getMobileLinkRegistry=jc});var Xa=ct(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.formatMobileRegistry=tt.formatMobileRegistryEntry=tt.getDappRegistryUrl=tt.getWalletRegistryUrl=void 0;var Ja="https://registry.walletconnect.com";function $c(){return Ja+"/api/v2/wallets"}tt.getWalletRegistryUrl=$c;function zc(){return Ja+"/api/v2/dapps"}tt.getDappRegistryUrl=zc;function Ya(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||""}}tt.formatMobileRegistryEntry=Ya;function qc(e,t="mobile"){return Object.values(e).filter(o=>!!o[t].universal||!!o[t].native).map(o=>Ya(o,t))}tt.formatMobileRegistry=qc});var Qa=ct(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});var Ao=dr();Ao.__exportStar(En(),Vt);Ao.__exportStar(xn(),Vt);Ao.__exportStar(Pn(),Vt);Ao.__exportStar(Ka(),Vt);Ao.__exportStar(Xa(),Vt)});var pp={};sn(pp,{AsExternalProvider:()=>xt,ConnectorManager:()=>so,PrivyClient:()=>co,PrivyProvider:()=>Zl,PrivyProxyProvider:()=>Be,VERSION:()=>Ko,WalletConnector:()=>Fe,getAccessToken:()=>ql,usePrivy:()=>U});module.exports=ln(pp);var zl=require("@ethersproject/providers"),re=require("react");var _=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};var bi=S(require("axios")),Ze=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}]`:""}`}},Qt=class extends Ze{constructor(o,r,n,i){super(n,i);this.type=o;this.status=r}},x=class extends Ze{constructor(o,r){super(o,r);this.type="client_error"}};var Y=class extends Ze{constructor(o,r){super(o,r);this.type="connector_error"}},ne=e=>{if(e instanceof Ze)return e;if(!bi.default.isAxiosError(e))return Oe(e);if(!e.response)return new Qt("api_error",null,e.message,e);let{type:t,message:o,error:r}=e.response.data;return new Qt(t||"ApiError",e.response.status,o||r,e)},Oe=e=>e instanceof Ze?e:e instanceof Error?new x(e.message,e):new x(`Internal error: ${e}`);var yi=()=>"/api/v1/sessions",vi=()=>"/api/v1/sessions/logout",wi=()=>"/api/v1/sessions/fork",Ci=()=>"/api/v1/sessions/fork/recover",Ei=()=>"/api/v1/siwe/init",xi=()=>"/api/v1/siwe/authenticate",_i=()=>"/api/v1/siwe/link",Pi=()=>"/api/v1/passwordless/init",Si=()=>"/api/v1/passwordless/authenticate",Li=()=>"/api/v1/passwordless/link",Ai=()=>"/api/v1/passwordless_sms/init",ki=()=>"/api/v1/passwordless_sms/authenticate",Ti=()=>"/api/v1/passwordless_sms/link",Wi=()=>"/api/v1/oauth/init",Ri=()=>"/api/v1/oauth/authenticate",Ii=()=>"/api/v1/oauth/link",Mi=()=>"/api/v1/siwe/unlink",Oi=()=>"/api/v1/passwordless/unlink",Ni=()=>"/api/v1/passwordless_sms/unlink",Di=()=>"/api/v1/oauth/unlink",Ui=()=>"/api/v1/analytics_events";var Nt=class{constructor(t){this.meta={email:t}}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new x("Email and email code must be set prior to calling authenticate.");try{let t=Si(),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 ne(t)}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new x("Email and email code must be set prior to calling authenticate.");try{let t=Li();return(await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode})).data}catch(t){throw ne(t)}}async sendCodeEmail(t){if(!this.api)throw new x("Auth flow has no API instance");if(t&&(this.meta.email=t),!this.meta.email)throw new x("Email must be set when initialzing authentication.");try{let o=Pi();return(await this.api.post(o,{email:this.meta.email})).data}catch(o){throw ne(o)}}};var Ct=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 x("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new x("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new x("User denied confirmation during OAuth flow");try{let t=Ri(),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 ne(t)}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new x("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new x("User denied confirmation during OAuth flow");try{let t=Ii();return(await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode})).data}catch(t){throw ne(t)}}async getAuthorizationUrl(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.provider)throw new x("Provider must be set when initialzing OAuth authentication.");try{let t=Wi();return(await this.api.post(t,{provider:this.meta.provider,redirect_to:window.location.href})).data}catch(t){throw ne(t)}}};var Et=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 x("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(xi(),{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 ne(t)}}async link(){if(!this.api)throw new x("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(_i(),{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 ne(t)}}async promptConnect(){if(!this.api)throw new x("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 x("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 x("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 x("Auth flow has no API instance");let o=t.address,r=t.chainId,n=await this.api.post(Ei(),{address:o});return this.preparedMessage=this.walletConnector.prepareMessage(r,o,n.data.nonce),this.preparedMessage}};var Dt=class{constructor(t){this.meta={phoneNumber:t}}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new x("phone number and sms code must be set prior to calling authenticate.");try{let t=ki(),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 ne(t)}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new x("phone number and sms code must be set prior to calling authenticate.");try{let t=Ti();return(await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})).data}catch(t){throw ne(t)}}async sendSmsCode(t){if(!this.api)throw new x("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),!this.meta.phoneNumber)throw new x("phone nNumber must be set when initialzing authentication.");try{let o=Ai();return(await this.api.post(o,{phoneNumber:this.meta.phoneNumber})).data}catch(o){throw ne(o)}}};var as=require("@ethersproject/address");var Bi="1.22.0";var qo="4df5e2316331463a9130964bd6078dfa",Zo="https://auth.privy.io",Fi=1e4,Ne=1400,Ko=Bi;var eo="privy:token",Jo="privy:refresh_token",So="privy:session_transfer_token",Yo="privy:connectors",cn="walletconnect",Gi=3e4;var dn=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 ic(){return typeof window<"u"&&window.localStorage?new pn:new dn}var K=ic();var $i=S(require("@coinbase/wallet-sdk")),zi=require("@ethersproject/address");var Lo=require("react/jsx-runtime"),De=({style:e,...t})=>(0,Lo.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,Lo.jsx)("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),(0,Lo.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 Vi=require("@ethersproject/address"),ji=require("@ethersproject/providers");var Hi=require("@ethersproject/logger");var to=class extends Y{constructor(){super("Wallet timeout");this.type="wallet_error"}},Bt=class extends Y{constructor(){super("User rejected connection");this.type="wallet_error"}},Ue=e=>{if(e instanceof Y)return e;if((e==null?void 0:e.code)&&(e==null?void 0:e.reason)){let t=new oo(e);return e.code===Hi.ErrorCode.ACTION_REJECTED&&(t.details=Ut.E4001_USER_REJECTED_REQUEST),t}return e!=null&&e.code?new oo(e):new Y("Unknown connector error",e)},un=class extends Ze{constructor(o,r,n){super(o);this.type="provider_error";this.code=r,this.data=n}},oo=class extends un{constructor(o){var i,a,s;let r=o;super(r.message,r.code,r.data);let n=Object.values(Ut).find(l=>l.eipCode===r.code);this.details=n||Ut.UNKNOWN_ERROR,r.code===-32002&&((i=r.message)!=null&&i.includes("already pending for origin")?(a=r.message)!=null&&a.includes("wallet_requestPermissions")?this.details=Ut.E32002_CONNECTION_ALREADY_PENDING:this.details=Ut.E32002_REQUEST_ALREADY_PENDING:(s=r.message)!=null&&s.includes("Already processing")&&r.message.includes("eth_requestAccounts")&&(this.details=Ut.E32002_WALLET_LOCKED))}},ac={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}},sc={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}},lc={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}},Ut={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...lc,...sc},Ft={...ac,...Ut};var cc=12e4,fn=(e=new to,t=cc)=>new Promise((o,r)=>setTimeout(()=>{r(e)},t)),Be=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 Y(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),fn()]).catch(o=>{throw Ue(o)})}},xt=class extends Be{constructor(o){super(o)}},Xo=class extends Be{constructor(t){super(t)}sendAsync(t,o){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var Fe=class{constructor(t,o,r){this.createSiweMessage=(t,o,r,n,i,a,s)=>`${r} wants you to sign in with your Ethereum account:
|
|
2
2
|
${o}
|
|
3
3
|
|
|
4
4
|
${s}
|